[ARVADOS-WORKBENCH2] updated: 1.1.4-439-g41c1d2b
Git user
git at public.curoverse.com
Fri Jul 27 06:18:46 EDT 2018
Summary of changes:
src/components/tree/tree.test.tsx | 2 +-
src/components/tree/tree.tsx | 11 +++++++----
2 files changed, 8 insertions(+), 5 deletions(-)
via 41c1d2bdade3ee0565a012e13e47142da0bac937 (commit)
from 1e42face4cff8350eed9351d810bf82b83f86576 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 41c1d2bdade3ee0565a012e13e47142da0bac937
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date: Fri Jul 27 12:18:21 2018 +0200
Update tree component with disableRipple prop, handle checkbox using onClick prop
Feature #13855
Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
diff --git a/src/components/tree/tree.test.tsx b/src/components/tree/tree.test.tsx
index 3018a49..1db379f 100644
--- a/src/components/tree/tree.test.tsx
+++ b/src/components/tree/tree.test.tsx
@@ -86,7 +86,7 @@ describe("Tree component", () => {
onContextMenu={jest.fn()}
onSelectionChange={onSelectionChanged}
items={[project]} />);
- wrapper.find(Checkbox).prop('onChange')();
+ wrapper.find(Checkbox).prop('onClick')();
expect(spy).toHaveBeenLastCalledWith({
data: mockProjectResource(),
id: "3",
diff --git a/src/components/tree/tree.tsx b/src/components/tree/tree.tsx
index f16348c..34207c0 100644
--- a/src/components/tree/tree.tsx
+++ b/src/components/tree/tree.tsx
@@ -88,19 +88,21 @@ interface TreeProps<T> {
level?: number;
onContextMenu: (event: React.MouseEvent<HTMLElement>, item: TreeItem<T>) => void;
showSelection?: boolean;
- onSelectionChange?: (event: React.ChangeEvent<HTMLInputElement>, item: TreeItem<T>) => void;
+ onSelectionChange?: (event: React.MouseEvent<HTMLElement>, item: TreeItem<T>) => void;
+ disableRipple?: boolean;
}
export const Tree = withStyles(styles)(
class Component<T> extends React.Component<TreeProps<T> & WithStyles<CssRules>, {}> {
render(): ReactElement<any> {
const level = this.props.level ? this.props.level : 0;
- const { classes, render, toggleItemOpen, items, toggleItemActive, onContextMenu } = this.props;
+ const { classes, render, toggleItemOpen, items, toggleItemActive, onContextMenu, disableRipple } = this.props;
const { list, listItem, loader, toggableIconContainer, renderContainer } = classes;
return <List component="div" className={list}>
{items && items.map((it: TreeItem<T>, idx: number) =>
<div key={`item/${level}/${idx}`}>
<ListItem button className={listItem} style={{ paddingLeft: (level + 1) * 20 }}
+ disableRipple={disableRipple}
onClick={() => toggleItemActive(it.id, it.status)}
onContextMenu={this.handleRowContextMenu(it)}>
{it.status === TreeItemStatus.PENDING ?
@@ -116,7 +118,7 @@ export const Tree = withStyles(styles)(
checked={it.selected}
className={classes.checkbox}
color="primary"
- onChange={this.handleCheckboxChange(it)} />}
+ onClick={this.handleCheckboxChange(it)} />}
<div className={renderContainer}>
{render(it, level)}
</div>
@@ -127,6 +129,7 @@ export const Tree = withStyles(styles)(
showSelection={this.props.showSelection}
items={it.items}
render={render}
+ disableRipple={disableRipple}
toggleItemOpen={toggleItemOpen}
toggleItemActive={toggleItemActive}
level={level + 1}
@@ -152,7 +155,7 @@ export const Tree = withStyles(styles)(
handleCheckboxChange = (item: TreeItem<T>) => {
const { onSelectionChange } = this.props;
return onSelectionChange
- ? (event: React.ChangeEvent<HTMLInputElement>, checked: boolean) => {
+ ? (event: React.MouseEvent<HTMLElement>) => {
onSelectionChange(event, item);
}
: undefined;
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list