ywana-core8 0.0.544 → 0.0.545

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ywana-core8",
3
- "version": "0.0.544",
3
+ "version": "0.0.545",
4
4
  "description": "ywana-core8",
5
5
  "homepage": "https://ywana.github.io/workspace",
6
6
  "author": "Ernesto Roldan Garcia",
@@ -238,7 +238,7 @@ export const CollectionTree = (props) => {
238
238
  const title = typeof node.name === 'boolean' ? `${node.field} = ${node.name}` : node.name
239
239
  return (
240
240
  <TreeNode key={node.name} icon={null} label={title} open={true}>
241
- {node.nodes ? renderNodes(node.nodes) : node.items.map(item => <TreeItem icon={icon} key={item.id} id={item.id} label={item.name} onSelect={select}>item</TreeItem>)}
241
+ {node.nodes ? renderNodes(node.nodes) : node.items.map(item => <TreeItem icon={icon} key={item.id} id={item.id} label={item.name} onSelect={select} selected={item.id === pageContext.selected}>item</TreeItem>)}
242
242
  </TreeNode>
243
243
  )
244
244
  })
package/src/html/tree.js CHANGED
@@ -33,14 +33,16 @@ export const TreeNode = ({ icon = 'folder', label, tooltip, open=false, children
33
33
  /**
34
34
  * Tree Item
35
35
  */
36
- export const TreeItem = ({ id, icon = 'description', label, actions, onSelect }) => {
36
+ export const TreeItem = ({ id, icon = 'description', label, actions, onSelect, selected = false }) => {
37
37
 
38
38
  function select() {
39
39
  if (onSelect) onSelect(id)
40
40
  }
41
41
 
42
+ const style = selected ? "selected" : ""
43
+
42
44
  return (
43
- <div className="tree-item final" onClick={select}>
45
+ <div className={`tree-item final ${style}`} onClick={select}>
44
46
  <Icon icon={icon} size="small" small />
45
47
  <div className="label">{label}</div>
46
48
  <div className="actions">{actions}</div>