ywana-core8 0.0.982 → 0.0.984
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 +10 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +5 -0
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +10 -3
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +10 -3
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/html/tree.css +5 -0
- package/src/html/tree.js +9 -3
package/package.json
CHANGED
package/src/html/tree.css
CHANGED
package/src/html/tree.js
CHANGED
@@ -18,15 +18,21 @@ export const Tree = ({ nodes = [], children }) => {
|
|
18
18
|
/**
|
19
19
|
* Tree Node
|
20
20
|
*/
|
21
|
-
export const TreeNode = ({ icon = 'folder', label, tooltip, open=false, children, actions }) => {
|
21
|
+
export const TreeNode = ({ id, icon = 'folder', label, tooltip, open=false, children, actions, onSelect }) => {
|
22
22
|
|
23
23
|
const labelTxt = label ? <Text format={TEXTFORMATS.STRING}>{label}</Text> : null
|
24
24
|
|
25
|
+
function select() {
|
26
|
+
if (onSelect) onSelect(id)
|
27
|
+
}
|
28
|
+
|
29
|
+
const clickable = onSelect ? "clickable" : ""
|
30
|
+
|
25
31
|
return (
|
26
|
-
<details className="tree-node" open={open}>
|
32
|
+
<details className="tree-node" open={open} >
|
27
33
|
<summary className="tree-item">
|
28
34
|
{ icon ? <Icon icon={icon} size="small" small /> : null }
|
29
|
-
<div className=
|
35
|
+
<div className={`label ${clickable}`} onClick={select} >{labelTxt}</div>
|
30
36
|
<div className="actions">{actions}</div>
|
31
37
|
</summary>
|
32
38
|
{children}
|