@onehat/ui 0.4.17 → 0.4.18

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": "@onehat/ui",
3
- "version": "0.4.17",
3
+ "version": "0.4.18",
4
4
  "description": "Base UI for OneHat apps",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -77,6 +77,9 @@ function TreeComponent(props) {
77
77
  }
78
78
  return item[displayIx];
79
79
  },
80
+ getNodeContent = (item) => { // extracts model/data and decides what the row content should be
81
+ return null;
82
+ },
80
83
  getDisplayTextFromSearchResults = (item) => {
81
84
  return item.id
82
85
  },
@@ -505,6 +508,7 @@ function TreeComponent(props) {
505
508
  datum = {
506
509
  item: treeNode,
507
510
  text: getNodeText(treeNode),
511
+ content: getNodeContent(treeNode),
508
512
  iconCollapsed: getNodeIcon(COLLAPSED, treeNode),
509
513
  iconExpanded: getNodeIcon(EXPANDED, treeNode),
510
514
  iconLeaf: getNodeIcon(LEAF, treeNode),
@@ -35,6 +35,7 @@ export default function TreeNode(props) {
35
35
  hasChildren = item.hasChildren,
36
36
  depth = item.depth,
37
37
  text = datum.text,
38
+ content = datum.content,
38
39
  iconCollapsed = datum.iconCollapsed,
39
40
  iconExpanded = datum.iconExpanded,
40
41
  iconLeaf = datum.iconLeaf,
@@ -96,21 +97,23 @@ export default function TreeNode(props) {
96
97
  /> :
97
98
  <Icon as={icon} className="ml-4 mr-1" />)}
98
99
 
99
- <TextNative
100
- numberOfLines={1}
101
- ellipsizeMode="head"
102
- // {...propsToPass}
103
- className={`
104
- TreeNode-TextNative
105
- self-center
106
- overflow-hidden
107
- flex
108
- flex-1
109
- text-ellipsis
110
- ${styles.TREE_NODE_CLASSNAME}
111
- `}
112
- style={{ userSelect: 'none', }}
113
- >{text}</TextNative>
100
+ {text ? <TextNative
101
+ numberOfLines={1}
102
+ ellipsizeMode="head"
103
+ // {...propsToPass}
104
+ className={`
105
+ TreeNode-TextNative
106
+ self-center
107
+ overflow-hidden
108
+ flex
109
+ flex-1
110
+ text-ellipsis
111
+ ${styles.TREE_NODE_CLASSNAME}
112
+ `}
113
+ style={{ userSelect: 'none', }}
114
+ >{text}</TextNative> : null}
115
+
116
+ {content}
114
117
 
115
118
  </HStack>;
116
119
  }, [
@@ -127,6 +130,7 @@ export default function TreeNode(props) {
127
130
  hasChildren,
128
131
  depth,
129
132
  text,
133
+ content,
130
134
  onToggle,
131
135
  isLoading,
132
136
  ]);