From be712804fdc19110696d4cf9c8a39897391eacef Mon Sep 17 00:00:00 2001 From: Peter Kosztolanyi Date: Sun, 6 May 2018 14:31:40 +0100 Subject: [PATCH 1/4] Add onClick property --- README.md | 1 + examples/dist/index.html | 7 + examples/dist/index.js | 23667 +------------------- examples/dist/style.css | 9 + examples/src/index.html | 7 + examples/src/index.js | 2 + examples/src/js/ClickableLabelsExample.js | 143 + src/js/CheckboxTree.js | 4 + src/js/TreeNode.js | 79 +- src/scss/react-checkbox-tree.scss | 12 + test/TreeNode.js | 77 + 11 files changed, 344 insertions(+), 23664 deletions(-) create mode 100644 examples/src/js/ClickableLabelsExample.js diff --git a/README.md b/README.md index cfabbfcd..429cb023 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,7 @@ All node objects **must** have a unique `value`. This value is serialized into t | `optimisticToggle` | bool | If true, toggling a partially-checked node will select all children. If false, it will deselect. | `true` | | `showNodeIcon` | bool | If true, each node will show a parent or leaf icon. | `true` | | `onCheck` | function | onCheck handler: `function(checked) {}` | `() => {}` | +| `onClick` | function | onClick handler: `function(clicked) {}`. If set, it will be called when clicked on a node label. | `() => {}` | | `onExpand` | function | onExpand handler: `function(expanded) {}` | `() => {}` | #### Node Properties diff --git a/examples/dist/index.html b/examples/dist/index.html index c4752a69..99670bdf 100644 --- a/examples/dist/index.html +++ b/examples/dist/index.html @@ -64,6 +64,13 @@

Large Data Example

The checkbox tree is capable of supporting a large number of nodes at once.

+

Clickable Labels Example

+

+ By default, clicking on the node label texts toggle the checkbox value. Providing an onClick property the checkbox will toggle + only when clicking on the checkbox and the provided function will be called when clicking on the node label text. +

+
+