ywana-core8 0.1.46 → 0.1.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +12 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +12 -2
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +12 -2
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/html/tree.js +6 -1
package/package.json
CHANGED
package/src/html/tree.js
CHANGED
@@ -43,17 +43,22 @@ export const TreeNode = ({ id, icon = 'folder', label, tooltip, open=false, chil
|
|
43
43
|
/**
|
44
44
|
* Tree Item
|
45
45
|
*/
|
46
|
-
export const TreeItem = ({ id, icon = 'description', label, actions, onSelect, selected = false }) => {
|
46
|
+
export const TreeItem = ({ id, icon = 'description', label, actions, onSelect, selected = false, onCheck, checked = false }) => {
|
47
47
|
|
48
48
|
function select() {
|
49
49
|
if (onSelect) onSelect(id)
|
50
50
|
}
|
51
51
|
|
52
|
+
function check(event) {
|
53
|
+
if (onCheck) onCheck(id, event.target.checked)
|
54
|
+
}
|
55
|
+
|
52
56
|
const style = selected ? "selected" : ""
|
53
57
|
const labelTxt = label ? <Text format={TEXTFORMATS.STRING}>{label}</Text> : null
|
54
58
|
|
55
59
|
return (
|
56
60
|
<div className={`tree-item final ${style}`} onClick={select}>
|
61
|
+
{ onCheck ? <input type="checkbox" checked={checked} onChange={check} /> : null }
|
57
62
|
<Icon icon={icon} size="small" small />
|
58
63
|
<div className="label">{labelTxt}</div>
|
59
64
|
<div className="actions">{actions}</div>
|