@instructure/ui-tree-browser 11.7.3-snapshot-25 → 11.7.3-snapshot-27
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/CHANGELOG.md +5 -2
- package/es/TreeBrowser/v1/TreeButton/index.js +56 -49
- package/es/TreeBrowser/v1/TreeButton/styles.js +7 -5
- package/es/TreeBrowser/v1/TreeButton/theme.js +32 -31
- package/es/TreeBrowser/v1/TreeCollection/index.js +115 -104
- package/es/TreeBrowser/v1/TreeCollection/styles.js +4 -2
- package/es/TreeBrowser/v1/TreeCollection/theme.js +11 -10
- package/es/TreeBrowser/v1/TreeNode/index.js +39 -37
- package/es/TreeBrowser/v1/index.js +94 -82
- package/es/TreeBrowser/v1/theme.js +8 -7
- package/es/TreeBrowser/v2/TreeButton/index.js +82 -71
- package/es/TreeBrowser/v2/TreeButton/styles.js +10 -8
- package/es/TreeBrowser/v2/TreeCollection/index.js +115 -104
- package/es/TreeBrowser/v2/TreeCollection/styles.js +4 -2
- package/es/TreeBrowser/v2/TreeNode/index.js +64 -58
- package/es/TreeBrowser/v2/index.js +112 -99
- package/lib/TreeBrowser/v1/TreeButton/index.js +56 -49
- package/lib/TreeBrowser/v1/TreeButton/styles.js +7 -5
- package/lib/TreeBrowser/v1/TreeButton/theme.js +32 -31
- package/lib/TreeBrowser/v1/TreeCollection/index.js +115 -104
- package/lib/TreeBrowser/v1/TreeCollection/styles.js +4 -2
- package/lib/TreeBrowser/v1/TreeCollection/theme.js +11 -10
- package/lib/TreeBrowser/v1/TreeNode/index.js +39 -37
- package/lib/TreeBrowser/v1/index.js +94 -82
- package/lib/TreeBrowser/v1/theme.js +8 -7
- package/lib/TreeBrowser/v2/TreeButton/index.js +82 -71
- package/lib/TreeBrowser/v2/TreeButton/styles.js +10 -8
- package/lib/TreeBrowser/v2/TreeCollection/index.js +115 -104
- package/lib/TreeBrowser/v2/TreeCollection/styles.js +4 -2
- package/lib/TreeBrowser/v2/TreeNode/index.js +64 -58
- package/lib/TreeBrowser/v2/index.js +112 -99
- package/package.json +12 -12
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -14,7 +14,7 @@ var _props = require("./props");
|
|
|
14
14
|
var _TreeBrowserContext = _interopRequireDefault(require("../TreeBrowserContext"));
|
|
15
15
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
16
16
|
var _react2 = require("@emotion/react");
|
|
17
|
-
var _dec, _class
|
|
17
|
+
var _dec, _class;
|
|
18
18
|
/*
|
|
19
19
|
* The MIT License (MIT)
|
|
20
20
|
*
|
|
@@ -44,72 +44,88 @@ parent: TreeBrowser
|
|
|
44
44
|
id: TreeBrowser.Collection
|
|
45
45
|
---
|
|
46
46
|
**/
|
|
47
|
-
let TreeCollection = exports.TreeCollection = (_dec = (0, _emotion.withStyle)(_styles.default, 'TreeBrowserTreeCollection'), _dec(_class =
|
|
47
|
+
let TreeCollection = exports.TreeCollection = (_dec = (0, _emotion.withStyle)(_styles.default, 'TreeBrowserTreeCollection'), _dec(_class = class TreeCollection extends _react.Component {
|
|
48
|
+
static displayName = "TreeCollection";
|
|
49
|
+
static componentId = 'TreeBrowser.Collection';
|
|
50
|
+
static allowedProps = _props.allowedProps;
|
|
51
|
+
static contextType = _TreeBrowserContext.default;
|
|
52
|
+
static defaultProps = {
|
|
53
|
+
collections: [],
|
|
54
|
+
items: [],
|
|
55
|
+
expanded: false,
|
|
56
|
+
selection: '',
|
|
57
|
+
size: 'medium',
|
|
58
|
+
variant: 'folderTree',
|
|
59
|
+
getItemProps: props => props,
|
|
60
|
+
getCollectionProps: props => props,
|
|
61
|
+
isCollectionFlattened: false
|
|
62
|
+
};
|
|
63
|
+
ref = null;
|
|
48
64
|
constructor(props) {
|
|
49
65
|
super(props);
|
|
50
|
-
this.ref = null;
|
|
51
|
-
this.handleFocus = (e, item) => {
|
|
52
|
-
e.stopPropagation();
|
|
53
|
-
this.setState({
|
|
54
|
-
focused: `${item.type}_${item.id}`
|
|
55
|
-
});
|
|
56
|
-
};
|
|
57
|
-
this.handleBlur = (e, _item) => {
|
|
58
|
-
e.stopPropagation();
|
|
59
|
-
this.setState({
|
|
60
|
-
focused: ''
|
|
61
|
-
});
|
|
62
|
-
};
|
|
63
|
-
this.handleCollectionClick = e => {
|
|
64
|
-
const _this$props = this.props,
|
|
65
|
-
id = _this$props.id,
|
|
66
|
-
onCollectionClick = _this$props.onCollectionClick,
|
|
67
|
-
expanded = _this$props.expanded;
|
|
68
|
-
const collection = {
|
|
69
|
-
id,
|
|
70
|
-
expanded: !expanded,
|
|
71
|
-
type: 'collection'
|
|
72
|
-
};
|
|
73
|
-
if (onCollectionClick && typeof onCollectionClick === 'function') {
|
|
74
|
-
onCollectionClick(e, collection);
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
this.handleCollectionKeyDown = e => {
|
|
78
|
-
const _this$props2 = this.props,
|
|
79
|
-
id = _this$props2.id,
|
|
80
|
-
onKeyDown = _this$props2.onKeyDown,
|
|
81
|
-
expanded = _this$props2.expanded;
|
|
82
|
-
const collection = {
|
|
83
|
-
id,
|
|
84
|
-
expanded: !expanded,
|
|
85
|
-
type: 'collection'
|
|
86
|
-
};
|
|
87
|
-
if (onKeyDown && typeof onKeyDown === 'function') {
|
|
88
|
-
onKeyDown(e, collection);
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
66
|
this.state = {
|
|
92
67
|
focused: ''
|
|
93
68
|
};
|
|
94
69
|
}
|
|
95
70
|
componentDidMount() {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
animation: (_this$context = this.context) === null || _this$context === void 0 ? void 0 : _this$context.animation
|
|
71
|
+
this.props.makeStyles?.({
|
|
72
|
+
animation: this.context?.animation
|
|
99
73
|
});
|
|
100
74
|
}
|
|
101
75
|
componentDidUpdate() {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
animation: (_this$context2 = this.context) === null || _this$context2 === void 0 ? void 0 : _this$context2.animation
|
|
76
|
+
this.props.makeStyles?.({
|
|
77
|
+
animation: this.context?.animation
|
|
105
78
|
});
|
|
106
79
|
}
|
|
107
80
|
get itemsLevel() {
|
|
108
|
-
const
|
|
109
|
-
level
|
|
110
|
-
isCollectionFlattened
|
|
81
|
+
const {
|
|
82
|
+
level,
|
|
83
|
+
isCollectionFlattened
|
|
84
|
+
} = this.props;
|
|
111
85
|
return isCollectionFlattened ? level : level + 1;
|
|
112
86
|
}
|
|
87
|
+
handleFocus = (e, item) => {
|
|
88
|
+
e.stopPropagation();
|
|
89
|
+
this.setState({
|
|
90
|
+
focused: `${item.type}_${item.id}`
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
handleBlur = (e, _item) => {
|
|
94
|
+
e.stopPropagation();
|
|
95
|
+
this.setState({
|
|
96
|
+
focused: ''
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
handleCollectionClick = e => {
|
|
100
|
+
const {
|
|
101
|
+
id,
|
|
102
|
+
onCollectionClick,
|
|
103
|
+
expanded
|
|
104
|
+
} = this.props;
|
|
105
|
+
const collection = {
|
|
106
|
+
id,
|
|
107
|
+
expanded: !expanded,
|
|
108
|
+
type: 'collection'
|
|
109
|
+
};
|
|
110
|
+
if (onCollectionClick && typeof onCollectionClick === 'function') {
|
|
111
|
+
onCollectionClick(e, collection);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
handleCollectionKeyDown = e => {
|
|
115
|
+
const {
|
|
116
|
+
id,
|
|
117
|
+
onKeyDown,
|
|
118
|
+
expanded
|
|
119
|
+
} = this.props;
|
|
120
|
+
const collection = {
|
|
121
|
+
id,
|
|
122
|
+
expanded: !expanded,
|
|
123
|
+
type: 'collection'
|
|
124
|
+
};
|
|
125
|
+
if (onKeyDown && typeof onKeyDown === 'function') {
|
|
126
|
+
onKeyDown(e, collection);
|
|
127
|
+
}
|
|
128
|
+
};
|
|
113
129
|
get collectionsCount() {
|
|
114
130
|
const collections = this.props.collections;
|
|
115
131
|
return collections && collections.length > 0 ? collections.length : 0;
|
|
@@ -122,10 +138,11 @@ let TreeCollection = exports.TreeCollection = (_dec = (0, _emotion.withStyle)(_s
|
|
|
122
138
|
return this.collectionsCount + this.itemsCount + (this.props.renderBeforeItems ? 1 : 0) + (this.props.renderAfterItems ? 1 : 0);
|
|
123
139
|
}
|
|
124
140
|
sortChildren() {
|
|
125
|
-
const
|
|
126
|
-
collections
|
|
127
|
-
items
|
|
128
|
-
compareFunc
|
|
141
|
+
const {
|
|
142
|
+
collections,
|
|
143
|
+
items,
|
|
144
|
+
compareFunc
|
|
145
|
+
} = this.props;
|
|
129
146
|
if (!compareFunc) return [];
|
|
130
147
|
const collections_ = collections ? collections.map(collection => {
|
|
131
148
|
return {
|
|
@@ -144,13 +161,14 @@ let TreeCollection = exports.TreeCollection = (_dec = (0, _emotion.withStyle)(_s
|
|
|
144
161
|
return renderQueue;
|
|
145
162
|
}
|
|
146
163
|
renderChildren() {
|
|
147
|
-
const
|
|
148
|
-
collections
|
|
149
|
-
items
|
|
150
|
-
id
|
|
151
|
-
renderBeforeItems
|
|
152
|
-
renderAfterItems
|
|
153
|
-
compareFunc
|
|
164
|
+
const {
|
|
165
|
+
collections,
|
|
166
|
+
items,
|
|
167
|
+
id,
|
|
168
|
+
renderBeforeItems,
|
|
169
|
+
renderAfterItems,
|
|
170
|
+
compareFunc
|
|
171
|
+
} = this.props;
|
|
154
172
|
let position = 1;
|
|
155
173
|
const sortedChildren = this.sortChildren();
|
|
156
174
|
return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
@@ -168,11 +186,12 @@ let TreeCollection = exports.TreeCollection = (_dec = (0, _emotion.withStyle)(_s
|
|
|
168
186
|
});
|
|
169
187
|
}
|
|
170
188
|
renderCollectionChildren(collectionId, child, position, keyword) {
|
|
171
|
-
const
|
|
172
|
-
selection
|
|
173
|
-
onKeyDown
|
|
174
|
-
getItemProps
|
|
175
|
-
styles
|
|
189
|
+
const {
|
|
190
|
+
selection,
|
|
191
|
+
onKeyDown,
|
|
192
|
+
getItemProps,
|
|
193
|
+
styles
|
|
194
|
+
} = this.props;
|
|
176
195
|
const key = `${collectionId}_${keyword}`;
|
|
177
196
|
const ariaSelected = {};
|
|
178
197
|
if (selection) {
|
|
@@ -194,7 +213,7 @@ let TreeCollection = exports.TreeCollection = (_dec = (0, _emotion.withStyle)(_s
|
|
|
194
213
|
id: key
|
|
195
214
|
/* eslint-disable-next-line jsx-a11y/role-has-required-aria-props */,
|
|
196
215
|
role: "treeitem",
|
|
197
|
-
css: styles
|
|
216
|
+
css: styles?.item,
|
|
198
217
|
tabIndex: -1,
|
|
199
218
|
"aria-posinset": position,
|
|
200
219
|
"aria-setsize": this.childCount,
|
|
@@ -212,7 +231,7 @@ let TreeCollection = exports.TreeCollection = (_dec = (0, _emotion.withStyle)(_s
|
|
|
212
231
|
if (typeof child.props.onKeyDown === 'function') {
|
|
213
232
|
child.props.onKeyDown(e);
|
|
214
233
|
} else {
|
|
215
|
-
onKeyDown
|
|
234
|
+
onKeyDown?.(e, itemHash);
|
|
216
235
|
}
|
|
217
236
|
},
|
|
218
237
|
onBlur: e => this.handleBlur(e, itemHash),
|
|
@@ -241,12 +260,13 @@ let TreeCollection = exports.TreeCollection = (_dec = (0, _emotion.withStyle)(_s
|
|
|
241
260
|
});
|
|
242
261
|
}
|
|
243
262
|
renderItemNode(item, position) {
|
|
244
|
-
const
|
|
245
|
-
selection
|
|
246
|
-
onItemClick
|
|
247
|
-
onKeyDown
|
|
248
|
-
getItemProps
|
|
249
|
-
styles
|
|
263
|
+
const {
|
|
264
|
+
selection,
|
|
265
|
+
onItemClick,
|
|
266
|
+
onKeyDown,
|
|
267
|
+
getItemProps,
|
|
268
|
+
styles
|
|
269
|
+
} = this.props;
|
|
250
270
|
const ariaSelected = {};
|
|
251
271
|
if (selection) {
|
|
252
272
|
ariaSelected['aria-selected'] = selection === `item_${item.id}`;
|
|
@@ -270,12 +290,12 @@ let TreeCollection = exports.TreeCollection = (_dec = (0, _emotion.withStyle)(_s
|
|
|
270
290
|
/* eslint-disable-next-line jsx-a11y/role-has-required-aria-props */,
|
|
271
291
|
role: "treeitem",
|
|
272
292
|
"aria-label": item.name,
|
|
273
|
-
css: styles
|
|
293
|
+
css: styles?.item,
|
|
274
294
|
"aria-level": this.itemsLevel,
|
|
275
295
|
"aria-posinset": position,
|
|
276
296
|
"aria-setsize": this.childCount,
|
|
277
|
-
onClick: e => onItemClick
|
|
278
|
-
onKeyDown: e => onKeyDown
|
|
297
|
+
onClick: e => onItemClick?.(e, itemHash),
|
|
298
|
+
onKeyDown: e => onKeyDown?.(e, itemHash),
|
|
279
299
|
onFocus: e => this.handleFocus(e, itemHash),
|
|
280
300
|
onBlur: e => this.handleBlur(e, itemHash),
|
|
281
301
|
...ariaSelected,
|
|
@@ -297,17 +317,18 @@ let TreeCollection = exports.TreeCollection = (_dec = (0, _emotion.withStyle)(_s
|
|
|
297
317
|
};
|
|
298
318
|
}
|
|
299
319
|
render() {
|
|
300
|
-
const
|
|
301
|
-
id
|
|
302
|
-
name
|
|
303
|
-
expanded
|
|
304
|
-
collectionIcon
|
|
305
|
-
collectionIconExpanded
|
|
306
|
-
isCollectionFlattened
|
|
307
|
-
getCollectionProps
|
|
308
|
-
level
|
|
309
|
-
position
|
|
310
|
-
styles
|
|
320
|
+
const {
|
|
321
|
+
id,
|
|
322
|
+
name,
|
|
323
|
+
expanded,
|
|
324
|
+
collectionIcon,
|
|
325
|
+
collectionIconExpanded,
|
|
326
|
+
isCollectionFlattened,
|
|
327
|
+
getCollectionProps,
|
|
328
|
+
level,
|
|
329
|
+
position,
|
|
330
|
+
styles
|
|
331
|
+
} = this.props;
|
|
311
332
|
const collectionProps = getCollectionProps({
|
|
312
333
|
...this.getCommonButtonProps(),
|
|
313
334
|
expanded: expanded,
|
|
@@ -320,14 +341,14 @@ let TreeCollection = exports.TreeCollection = (_dec = (0, _emotion.withStyle)(_s
|
|
|
320
341
|
level
|
|
321
342
|
});
|
|
322
343
|
const ariaSelected = {
|
|
323
|
-
'aria-selected':
|
|
344
|
+
'aria-selected': undefined
|
|
324
345
|
};
|
|
325
346
|
if (this.props.selection) ariaSelected['aria-selected'] = this.props.selection === `collection_${id}`;
|
|
326
347
|
return isCollectionFlattened ? this.renderChildren() : (0, _jsxRuntime.jsxs)("li", {
|
|
327
348
|
ref: el => {
|
|
328
349
|
this.ref = el;
|
|
329
350
|
},
|
|
330
|
-
css: styles
|
|
351
|
+
css: styles?.treeCollection,
|
|
331
352
|
tabIndex: -1
|
|
332
353
|
/* eslint-disable-next-line jsx-a11y/role-has-required-aria-props */,
|
|
333
354
|
role: "treeitem",
|
|
@@ -352,21 +373,11 @@ let TreeCollection = exports.TreeCollection = (_dec = (0, _emotion.withStyle)(_s
|
|
|
352
373
|
...collectionProps
|
|
353
374
|
}), expanded && this.childCount > 0 && (0, _jsxRuntime.jsx)("ul", {
|
|
354
375
|
"aria-label": name,
|
|
355
|
-
css: styles
|
|
376
|
+
css: styles?.list,
|
|
356
377
|
role: "group",
|
|
357
378
|
children: this.renderChildren()
|
|
358
379
|
})]
|
|
359
380
|
});
|
|
360
381
|
}
|
|
361
|
-
}
|
|
362
|
-
collections: [],
|
|
363
|
-
items: [],
|
|
364
|
-
expanded: false,
|
|
365
|
-
selection: '',
|
|
366
|
-
size: 'medium',
|
|
367
|
-
variant: 'folderTree',
|
|
368
|
-
getItemProps: props => props,
|
|
369
|
-
getCollectionProps: props => props,
|
|
370
|
-
isCollectionFlattened: false
|
|
371
|
-
}, _TreeCollection)) || _class);
|
|
382
|
+
}) || _class);
|
|
372
383
|
var _default = exports.default = TreeCollection;
|
|
@@ -47,8 +47,10 @@ const list = (0, _emotion.keyframes)`
|
|
|
47
47
|
*/
|
|
48
48
|
|
|
49
49
|
const generateStyles = (componentTheme, props, sharedTokens, state) => {
|
|
50
|
-
const
|
|
51
|
-
|
|
50
|
+
const {
|
|
51
|
+
size,
|
|
52
|
+
variant
|
|
53
|
+
} = props;
|
|
52
54
|
const sizeMap = {
|
|
53
55
|
small: {
|
|
54
56
|
indent: {
|
|
@@ -13,7 +13,7 @@ var _styles = _interopRequireDefault(require("../TreeButton/styles"));
|
|
|
13
13
|
var _props = require("./props");
|
|
14
14
|
var _TreeBrowserContext = _interopRequireDefault(require("../TreeBrowserContext"));
|
|
15
15
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
16
|
-
var _dec, _class
|
|
16
|
+
var _dec, _class;
|
|
17
17
|
/*
|
|
18
18
|
* The MIT License (MIT)
|
|
19
19
|
*
|
|
@@ -54,51 +54,61 @@ id: TreeBrowser.Node
|
|
|
54
54
|
A helper class used to render the :renderBeforeItems and :renderAfterItems
|
|
55
55
|
in the TreeBrowser.
|
|
56
56
|
**/
|
|
57
|
-
let TreeNode = exports.TreeNode = (_dec = (0, _emotion.withStyle)(_styles.default, 'TreeBrowserTreeButton'), _dec(_class =
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
isHovered: true
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
this.handleMouseLeave = () => {
|
|
78
|
-
if (this.props.hoverable) {
|
|
79
|
-
this.setState({
|
|
80
|
-
isHovered: false
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
}
|
|
57
|
+
let TreeNode = exports.TreeNode = (_dec = (0, _emotion.withStyle)(_styles.default, 'TreeBrowserTreeButton'), _dec(_class = class TreeNode extends _react.Component {
|
|
58
|
+
static displayName = "TreeNode";
|
|
59
|
+
static componentId = 'TreeBrowser.Node';
|
|
60
|
+
static allowedProps = _props.allowedProps;
|
|
61
|
+
static contextType = _TreeBrowserContext.default;
|
|
62
|
+
static defaultProps = {
|
|
63
|
+
size: 'medium',
|
|
64
|
+
variant: 'folderTree',
|
|
65
|
+
selected: false,
|
|
66
|
+
focused: false,
|
|
67
|
+
hoverable: true
|
|
68
|
+
};
|
|
69
|
+
ref = null;
|
|
70
|
+
state = {
|
|
71
|
+
isHovered: false
|
|
72
|
+
};
|
|
85
73
|
componentDidMount() {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
animation: (_this$context = this.context) === null || _this$context === void 0 ? void 0 : _this$context.animation,
|
|
74
|
+
this.props.makeStyles?.({
|
|
75
|
+
animation: this.context?.animation,
|
|
89
76
|
hoverable: this.props.hoverable
|
|
90
77
|
});
|
|
91
78
|
}
|
|
92
79
|
componentDidUpdate() {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
animation: (_this$context2 = this.context) === null || _this$context2 === void 0 ? void 0 : _this$context2.animation,
|
|
80
|
+
this.props.makeStyles?.({
|
|
81
|
+
animation: this.context?.animation,
|
|
96
82
|
hoverable: this.props.hoverable
|
|
97
83
|
});
|
|
98
84
|
}
|
|
85
|
+
handleRef = el => {
|
|
86
|
+
if (el && typeof this.props.containerRef === 'function') {
|
|
87
|
+
this.props.containerRef(el.parentElement);
|
|
88
|
+
}
|
|
89
|
+
this.ref = el;
|
|
90
|
+
};
|
|
91
|
+
handleMouseEnter = () => {
|
|
92
|
+
if (this.props.hoverable) {
|
|
93
|
+
this.setState({
|
|
94
|
+
isHovered: true
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
handleMouseLeave = () => {
|
|
99
|
+
if (this.props.hoverable) {
|
|
100
|
+
this.setState({
|
|
101
|
+
isHovered: false
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
};
|
|
99
105
|
getIconColor() {
|
|
100
|
-
const
|
|
101
|
-
|
|
106
|
+
const {
|
|
107
|
+
selected
|
|
108
|
+
} = this.props;
|
|
109
|
+
const {
|
|
110
|
+
isHovered
|
|
111
|
+
} = this.state;
|
|
102
112
|
|
|
103
113
|
// Priority: selected > hover > default
|
|
104
114
|
if (selected) return 'onColor';
|
|
@@ -106,14 +116,15 @@ let TreeNode = exports.TreeNode = (_dec = (0, _emotion.withStyle)(_styles.defaul
|
|
|
106
116
|
return 'baseColor';
|
|
107
117
|
}
|
|
108
118
|
renderItemImage() {
|
|
109
|
-
const
|
|
110
|
-
thumbnail
|
|
111
|
-
itemIcon
|
|
112
|
-
styles
|
|
113
|
-
size
|
|
119
|
+
const {
|
|
120
|
+
thumbnail,
|
|
121
|
+
itemIcon,
|
|
122
|
+
styles,
|
|
123
|
+
size
|
|
124
|
+
} = this.props;
|
|
114
125
|
if (thumbnail) {
|
|
115
126
|
return (0, _jsxRuntime.jsx)("div", {
|
|
116
|
-
css: styles
|
|
127
|
+
css: styles?.thumbnail,
|
|
117
128
|
children: (0, _jsxRuntime.jsx)(_latest.Img, {
|
|
118
129
|
src: thumbnail,
|
|
119
130
|
constrain: "cover",
|
|
@@ -126,37 +137,32 @@ let TreeNode = exports.TreeNode = (_dec = (0, _emotion.withStyle)(_styles.defaul
|
|
|
126
137
|
const iconColor = this.getIconColor();
|
|
127
138
|
const iconElement = (0, _renderIconWithProps.renderIconWithProps)(itemIcon, iconSize, iconColor);
|
|
128
139
|
return (0, _jsxRuntime.jsx)("div", {
|
|
129
|
-
css: styles
|
|
140
|
+
css: styles?.icon,
|
|
130
141
|
children: iconElement
|
|
131
142
|
});
|
|
132
143
|
}
|
|
133
|
-
return
|
|
144
|
+
return undefined;
|
|
134
145
|
}
|
|
135
146
|
render() {
|
|
136
|
-
const
|
|
137
|
-
children
|
|
138
|
-
styles
|
|
147
|
+
const {
|
|
148
|
+
children,
|
|
149
|
+
styles
|
|
150
|
+
} = this.props;
|
|
139
151
|
return (0, _jsxRuntime.jsx)("div", {
|
|
140
152
|
ref: this.handleRef,
|
|
141
153
|
tabIndex: -1,
|
|
142
|
-
css: styles
|
|
154
|
+
css: styles?.treeButton,
|
|
143
155
|
"data-cid": "TreeNode",
|
|
144
156
|
onMouseEnter: this.handleMouseEnter,
|
|
145
157
|
onMouseLeave: this.handleMouseLeave,
|
|
146
158
|
children: (0, _jsxRuntime.jsxs)("span", {
|
|
147
|
-
css: styles
|
|
159
|
+
css: styles?.layout,
|
|
148
160
|
children: [this.renderItemImage(), (0, _jsxRuntime.jsx)("span", {
|
|
149
|
-
css: styles
|
|
161
|
+
css: styles?.node,
|
|
150
162
|
children: children
|
|
151
163
|
})]
|
|
152
164
|
})
|
|
153
165
|
});
|
|
154
166
|
}
|
|
155
|
-
}
|
|
156
|
-
size: 'medium',
|
|
157
|
-
variant: 'folderTree',
|
|
158
|
-
selected: false,
|
|
159
|
-
focused: false,
|
|
160
|
-
hoverable: true
|
|
161
|
-
}, _TreeNode)) || _class);
|
|
167
|
+
}) || _class);
|
|
162
168
|
var _default = exports.default = TreeNode;
|