@sis-cc/dotstatsuite-visions 10.9.0 → 10.10.0
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/es/Chips/CustomChip.js +5 -3
- package/es/Chips/GroupedChips.js +3 -1
- package/es/HierarchicalFilter/HierarchicalFilter.js +7 -3
- package/es/VirtualizedTree/Item.js +13 -17
- package/es/VirtualizedTree/VirtualizedTree.js +41 -32
- package/lib/Chips/CustomChip.js +5 -3
- package/lib/Chips/GroupedChips.js +3 -1
- package/lib/HierarchicalFilter/HierarchicalFilter.js +7 -3
- package/lib/VirtualizedTree/Item.js +13 -17
- package/lib/VirtualizedTree/VirtualizedTree.js +41 -32
- package/package.json +1 -1
- package/umd/@sis-cc/dotstatsuite-visions.js +102 -89
- package/umd/@sis-cc/dotstatsuite-visions.min.js +3 -3
- package/umd/@sis-cc/dotstatsuite-visions.min.js.map +1 -1
package/es/Chips/CustomChip.js
CHANGED
|
@@ -31,14 +31,15 @@ var CustomChip = function CustomChip(_ref) {
|
|
|
31
31
|
_ref$testId = _ref.testId,
|
|
32
32
|
testId = _ref$testId === undefined ? 'deleteChip-test-id' : _ref$testId,
|
|
33
33
|
_ref$labelRenderer = _ref.labelRenderer,
|
|
34
|
-
labelRenderer = _ref$labelRenderer === undefined ? R.prop('label') : _ref$labelRenderer
|
|
34
|
+
labelRenderer = _ref$labelRenderer === undefined ? R.prop('label') : _ref$labelRenderer,
|
|
35
|
+
deprecated = _ref.deprecated;
|
|
35
36
|
|
|
36
37
|
var theme = useTheme();
|
|
37
38
|
var isRtl = getIsRtl(theme);
|
|
38
39
|
var classes = useStyles();
|
|
39
40
|
var mapIndexed = R.addIndex(R.map);
|
|
40
41
|
var onChange = R.is(Function)(onDelete) ? function () {
|
|
41
|
-
return onDelete(parentId, R.isNil(id) ? [] : [
|
|
42
|
+
return onDelete(parentId, R.isNil(id) ? [] : R.append(id, deprecated || []));
|
|
42
43
|
} : null;
|
|
43
44
|
var hasTooltip = shownTooltip(items);
|
|
44
45
|
var hasMultiLinedTooltip = showMultiLinedTooltip(items);
|
|
@@ -105,7 +106,8 @@ CustomChip.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
105
106
|
labelClasses: PropTypes.string,
|
|
106
107
|
ariaLabel: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
107
108
|
items: PropTypes.array,
|
|
108
|
-
labelRenderer: PropTypes.func
|
|
109
|
+
labelRenderer: PropTypes.func,
|
|
110
|
+
deprecated: PropTypes.array
|
|
109
111
|
} : {};
|
|
110
112
|
|
|
111
113
|
export default CustomChip;
|
package/es/Chips/GroupedChips.js
CHANGED
|
@@ -55,10 +55,12 @@ var GroupedChips = function GroupedChips(_ref) {
|
|
|
55
55
|
}) : R.map(function (items) {
|
|
56
56
|
var lastItem = R.last(items);
|
|
57
57
|
var id = lastItem.id,
|
|
58
|
-
isNotRemovable = lastItem.isNotRemovable
|
|
58
|
+
isNotRemovable = lastItem.isNotRemovable,
|
|
59
|
+
deprecated = lastItem.deprecated;
|
|
59
60
|
|
|
60
61
|
|
|
61
62
|
return React.createElement(CustomChip, {
|
|
63
|
+
deprecated: deprecated,
|
|
62
64
|
key: id,
|
|
63
65
|
id: id,
|
|
64
66
|
items: R.pipe(R.length, R.gte(2)) ? items : null,
|
|
@@ -47,14 +47,17 @@ var HierarchicalFilter = function HierarchicalFilter(props) {
|
|
|
47
47
|
hasSpotlight = props.hasSpotlight,
|
|
48
48
|
_props$disableAccesso = props.disableAccessor,
|
|
49
49
|
disableAccessor = _props$disableAccesso === undefined ? R.always(false) : _props$disableAccesso,
|
|
50
|
-
allItems = props.allItems
|
|
50
|
+
allItems = props.allItems,
|
|
51
|
+
_props$simpleSelectio = props.simpleSelectionMode,
|
|
52
|
+
simpleSelectionMode = _props$simpleSelectio === undefined ? false : _props$simpleSelectio;
|
|
51
53
|
|
|
52
54
|
var classes = useStyles({ accessibility: accessibility });
|
|
53
55
|
var theme = useTheme();
|
|
54
56
|
var isRtl = getIsRtl(theme);
|
|
55
57
|
var Chip = R.isNil(Tag) ? InternalTag : Tag;
|
|
56
58
|
var _allGroupedItems = R.groupBy(R.propOr('#ROOT', 'parentId'), allItems);
|
|
57
|
-
var _disableAccessor = getEvolvedDisableAccessor(_allGroupedItems, disableAccessor, R.always(false));
|
|
59
|
+
var _disableAccessor = simpleSelectionMode ? disableAccessor : getEvolvedDisableAccessor(_allGroupedItems, disableAccessor, R.always(false));
|
|
60
|
+
|
|
58
61
|
var tagValue = getCounter(items, _disableAccessor, tagAccessor);
|
|
59
62
|
var isDisabled = function isDisabled(item) {
|
|
60
63
|
return R.is(Function, disableAccessor) ? disableAccessor(item) : false;
|
|
@@ -153,7 +156,8 @@ HierarchicalFilter.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
153
156
|
spotlight: PropTypes.object,
|
|
154
157
|
setSpotlight: PropTypes.func,
|
|
155
158
|
hasSpotlight: PropTypes.bool,
|
|
156
|
-
allItems: PropTypes.array
|
|
159
|
+
allItems: PropTypes.array,
|
|
160
|
+
simpleSelectionMode: PropTypes.bool
|
|
157
161
|
} : {};
|
|
158
162
|
|
|
159
163
|
export default withSpotlight(withExpansionTree(HierarchicalFilter));
|
|
@@ -35,19 +35,17 @@ var Item = function Item(_ref) {
|
|
|
35
35
|
style = _ref.style,
|
|
36
36
|
isRtl = _ref.isRtl,
|
|
37
37
|
accessibility = _ref.accessibility,
|
|
38
|
-
index = _ref.index,
|
|
39
38
|
HTMLRenderer = _ref.HTMLRenderer,
|
|
40
39
|
hierarchicalId = _ref.hierarchicalId,
|
|
41
40
|
labels = _ref.labels,
|
|
42
41
|
_ref$depth = _ref.depth,
|
|
43
42
|
depth = _ref$depth === undefined ? 0 : _ref$depth,
|
|
44
|
-
|
|
43
|
+
eventsListeners = _ref.eventsListeners;
|
|
45
44
|
|
|
46
45
|
var _React$useState = React.useState(false),
|
|
47
46
|
isTooltipShown = _React$useState[0],
|
|
48
47
|
setIsTooltipShown = _React$useState[1];
|
|
49
48
|
|
|
50
|
-
var callbacks = eventsCallbacks(hierarchicalId || id, index);
|
|
51
49
|
var padding = depth * 30 + (depth > 0 && !hasChildrenOnLevel ? 30 : 0) + (!hasChild && hasChildrenOnLevel ? 30 : 0);
|
|
52
50
|
return React.createElement(
|
|
53
51
|
ListItem,
|
|
@@ -77,23 +75,21 @@ var Item = function Item(_ref) {
|
|
|
77
75
|
},
|
|
78
76
|
React.createElement(NavigateIcon, null)
|
|
79
77
|
),
|
|
80
|
-
React.createElement(ListItemText,
|
|
78
|
+
React.createElement(ListItemText, {
|
|
81
79
|
'data-testid': 'value_' + id,
|
|
82
80
|
tabIndex: 0,
|
|
83
|
-
'aria-label':
|
|
81
|
+
'aria-label': isGreyed ? R.propOr('', 'disableItemLabel')(labels) + ' ' + label : label,
|
|
84
82
|
'aria-pressed': isSelected,
|
|
85
83
|
'aria-disabled': isDisabled,
|
|
86
84
|
primaryTypographyProps: { noWrap: true, color: 'inherit' },
|
|
87
85
|
secondaryTypographyProps: { color: 'inherit' },
|
|
88
86
|
classes: { root: classes.listItem },
|
|
89
|
-
className: cx((_cx = {}, _cx[classes.accessibilityItemHover] = accessibility, _cx[classes.listItemSelected] = isSelected
|
|
90
|
-
onClick: isDisabled ? null :
|
|
91
|
-
onMouseDown: isDisabled || isTooltipShown ? null :
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
title: isDisabled ? R.propOr('', 'disableItemLabel')(labels) + ' ' + label : label,
|
|
96
|
-
style: { opacity: isDisabled ? '0.5' : '1' },
|
|
87
|
+
className: cx((_cx = {}, _cx[classes.accessibilityItemHover] = accessibility, _cx[classes.listItemSelected] = isSelected, _cx[classes.listItemHover] = !isDisabled, _cx)),
|
|
88
|
+
onClick: isDisabled ? null : eventsListeners.onClick,
|
|
89
|
+
onMouseDown: isDisabled || isTooltipShown ? null : eventsListeners.onMouseDown,
|
|
90
|
+
onMouseEnter: isDisabled || isTooltipShown ? null : eventsListeners.onMouseEnter,
|
|
91
|
+
title: isGreyed ? R.propOr('', 'disableItemLabel')(labels) + ' ' + label : label,
|
|
92
|
+
style: { opacity: isDisabled && isGreyed ? '0.5' : '1' },
|
|
97
93
|
primary: React.createElement(
|
|
98
94
|
'div',
|
|
99
95
|
{
|
|
@@ -104,7 +100,8 @@ var Item = function Item(_ref) {
|
|
|
104
100
|
Icon,
|
|
105
101
|
{
|
|
106
102
|
color: 'primary',
|
|
107
|
-
className: cx(classes.labelIcon, (_cx3 = {}, _cx3[classes.disabledLabel] = isDisabled, _cx3))
|
|
103
|
+
className: cx(classes.labelIcon, (_cx3 = {}, _cx3[classes.disabledLabel] = isDisabled, _cx3)),
|
|
104
|
+
style: { opacity: isDisabled ? '0.5' : '1' }
|
|
108
105
|
},
|
|
109
106
|
isSelected ? React.createElement(CheckedBoxIcon, null) : React.createElement(CheckBoxIcon, null)
|
|
110
107
|
),
|
|
@@ -154,7 +151,7 @@ var Item = function Item(_ref) {
|
|
|
154
151
|
')'
|
|
155
152
|
)
|
|
156
153
|
)
|
|
157
|
-
})
|
|
154
|
+
})
|
|
158
155
|
);
|
|
159
156
|
};
|
|
160
157
|
|
|
@@ -178,13 +175,12 @@ Item.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
178
175
|
style: PropTypes.object,
|
|
179
176
|
isRtl: PropTypes.bool,
|
|
180
177
|
accessibility: PropTypes.bool,
|
|
181
|
-
index: PropTypes.number,
|
|
182
178
|
labelRenderer: PropTypes.func,
|
|
183
179
|
HTMLRenderer: PropTypes.func,
|
|
184
180
|
hierarchicalId: PropTypes.string,
|
|
185
181
|
labels: PropTypes.object,
|
|
186
182
|
depth: PropTypes.number,
|
|
187
|
-
|
|
183
|
+
eventsListeners: PropTypes.object,
|
|
188
184
|
isGreyed: PropTypes.bool
|
|
189
185
|
} : {};
|
|
190
186
|
|
|
@@ -61,7 +61,9 @@ var VirtualizedTree = function VirtualizedTree(props) {
|
|
|
61
61
|
_props$scopeGetter = props.scopeGetter,
|
|
62
62
|
scopeGetter = _props$scopeGetter === undefined ? singleScopeGetter : _props$scopeGetter,
|
|
63
63
|
_props$treeHeight = props.treeHeight,
|
|
64
|
-
treeHeight = _props$treeHeight === undefined ? 0 : _props$treeHeight
|
|
64
|
+
treeHeight = _props$treeHeight === undefined ? 0 : _props$treeHeight,
|
|
65
|
+
_props$simpleSelectio = props.simpleSelectionMode,
|
|
66
|
+
simpleSelectionMode = _props$simpleSelectio === undefined ? false : _props$simpleSelectio;
|
|
65
67
|
|
|
66
68
|
var theme = useTheme();
|
|
67
69
|
|
|
@@ -177,56 +179,63 @@ var VirtualizedTree = function VirtualizedTree(props) {
|
|
|
177
179
|
setIsMouseDown(false);
|
|
178
180
|
}
|
|
179
181
|
};
|
|
180
|
-
|
|
182
|
+
|
|
183
|
+
var onMouseUp = function onMouseUp(e) {
|
|
184
|
+
if (!isMouseDown) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
e.preventDefault();
|
|
188
|
+
apply();
|
|
189
|
+
setIsMouseDown(false);
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
var onMouseLeave = function onMouseLeave() {
|
|
193
|
+
if (isMouseDown) {
|
|
194
|
+
apply();
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
var onKeyUp = function onKeyUp(e) {
|
|
199
|
+
e.preventDefault();
|
|
200
|
+
if (e.key === 'Shift' && !R.isEmpty(shiftIndexes)) {
|
|
201
|
+
apply();
|
|
202
|
+
} else if (e.key === 'Control' && !R.isEmpty(selectIds)) {
|
|
203
|
+
apply();
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
var itemEventsListeners = function itemEventsListeners(id, index) {
|
|
181
208
|
return {
|
|
182
|
-
onMouseUp: isMouseDown ? function (e) {
|
|
183
|
-
e.preventDefault();
|
|
184
|
-
apply();
|
|
185
|
-
if (!R.isEmpty(selectIds)) {
|
|
186
|
-
setLastItemId(id);
|
|
187
|
-
}
|
|
188
|
-
setIsMouseDown(false);
|
|
189
|
-
} : null,
|
|
190
209
|
onMouseDown: function onMouseDown(e) {
|
|
191
|
-
e.
|
|
192
|
-
if (e.ctrlKey || e.shiftKey) {
|
|
210
|
+
if (!simpleSelectionMode && (e.ctrlKey || e.shiftKey)) {
|
|
193
211
|
return;
|
|
194
212
|
}
|
|
195
213
|
setIsMouseDown(true);
|
|
196
214
|
multiSelect(id);
|
|
197
215
|
},
|
|
198
|
-
onMouseEnter:
|
|
216
|
+
onMouseEnter: function onMouseEnter(e) {
|
|
199
217
|
e.preventDefault();
|
|
200
|
-
if (e.ctrlKey || e.shiftKey) {
|
|
218
|
+
if (!isMouseDown || simpleSelectionMode || e.ctrlKey || e.shiftKey) {
|
|
201
219
|
return;
|
|
202
220
|
}
|
|
203
221
|
multiSelect(id);
|
|
204
|
-
|
|
222
|
+
setLastItemId(id);
|
|
223
|
+
},
|
|
205
224
|
onClick: function onClick(e) {
|
|
206
225
|
e.preventDefault();
|
|
207
|
-
|
|
208
|
-
if (e.ctrlKey) {
|
|
226
|
+
if (e.ctrlKey && !simpleSelectionMode) {
|
|
209
227
|
multiSelect(id);
|
|
210
|
-
} else if (e.shiftKey) {
|
|
228
|
+
} else if (e.shiftKey && !simpleSelectionMode) {
|
|
211
229
|
shiftSelect(index);
|
|
212
230
|
} else {
|
|
213
231
|
setIsMouseDown(false);
|
|
214
232
|
setLastItemId(id);
|
|
215
233
|
}
|
|
216
234
|
}
|
|
217
|
-
// ondblclick: () => null
|
|
218
235
|
};
|
|
219
236
|
};
|
|
220
|
-
var onKeyUp = function onKeyUp(e) {
|
|
221
|
-
if (e.key === 'Shift' && !R.isEmpty(shiftIndexes)) {
|
|
222
|
-
apply();
|
|
223
|
-
} else if (e.key === 'Control' && !R.isEmpty(selectIds)) {
|
|
224
|
-
apply();
|
|
225
|
-
}
|
|
226
|
-
};
|
|
227
237
|
var ref = useRef();
|
|
228
238
|
var classes = useStyles();
|
|
229
|
-
|
|
230
239
|
useEffect(function () {
|
|
231
240
|
var current = ref.current;
|
|
232
241
|
var handler = function handler(event) {
|
|
@@ -249,7 +258,6 @@ var VirtualizedTree = function VirtualizedTree(props) {
|
|
|
249
258
|
setScrollTop(undefined);
|
|
250
259
|
}
|
|
251
260
|
if (R.isNil(current)) return;
|
|
252
|
-
|
|
253
261
|
current.addEventListener('wheel', handler, { passive: false });
|
|
254
262
|
return function () {
|
|
255
263
|
current.removeEventListener('wheel', handler, { passive: false });
|
|
@@ -267,7 +275,8 @@ var VirtualizedTree = function VirtualizedTree(props) {
|
|
|
267
275
|
disablePadding: true,
|
|
268
276
|
style: { height: maxHeight + 2 },
|
|
269
277
|
onKeyUp: onKeyUp,
|
|
270
|
-
|
|
278
|
+
onMouseUp: onMouseUp,
|
|
279
|
+
onMouseLeave: onMouseLeave,
|
|
271
280
|
ref: ref
|
|
272
281
|
},
|
|
273
282
|
React.createElement(
|
|
@@ -304,11 +313,10 @@ var VirtualizedTree = function VirtualizedTree(props) {
|
|
|
304
313
|
},
|
|
305
314
|
NavigateIcon: R.has(itemId, expandedIds) ? ExpandLessIcon : ExpandMoreIcon,
|
|
306
315
|
isRtl: isRtl,
|
|
307
|
-
|
|
316
|
+
eventsListeners: itemEventsListeners(getHierarchicalId(item), index),
|
|
308
317
|
HTMLRenderer: HTMLRenderer,
|
|
309
318
|
classes: classes,
|
|
310
319
|
labels: labels,
|
|
311
|
-
index: index,
|
|
312
320
|
style: style,
|
|
313
321
|
accessibility: accessibility,
|
|
314
322
|
ariaLabel: R.prop('navigateNext')(labels),
|
|
@@ -340,7 +348,8 @@ VirtualizedTree.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
340
348
|
collapse: PropTypes.func,
|
|
341
349
|
treeHeight: PropTypes.number,
|
|
342
350
|
isGreyed: PropTypes.func,
|
|
343
|
-
scopeGetter: PropTypes.func
|
|
351
|
+
scopeGetter: PropTypes.func,
|
|
352
|
+
simpleSelectionMode: PropTypes.bool
|
|
344
353
|
} : {};
|
|
345
354
|
|
|
346
355
|
export default VirtualizedTree;
|
package/lib/Chips/CustomChip.js
CHANGED
|
@@ -68,14 +68,15 @@ var CustomChip = function CustomChip(_ref) {
|
|
|
68
68
|
_ref$testId = _ref.testId,
|
|
69
69
|
testId = _ref$testId === undefined ? 'deleteChip-test-id' : _ref$testId,
|
|
70
70
|
_ref$labelRenderer = _ref.labelRenderer,
|
|
71
|
-
labelRenderer = _ref$labelRenderer === undefined ? R.prop('label') : _ref$labelRenderer
|
|
71
|
+
labelRenderer = _ref$labelRenderer === undefined ? R.prop('label') : _ref$labelRenderer,
|
|
72
|
+
deprecated = _ref.deprecated;
|
|
72
73
|
|
|
73
74
|
var theme = (0, _styles.useTheme)();
|
|
74
75
|
var isRtl = (0, _utils.getIsRtl)(theme);
|
|
75
76
|
var classes = useStyles();
|
|
76
77
|
var mapIndexed = R.addIndex(R.map);
|
|
77
78
|
var onChange = R.is(Function)(onDelete) ? function () {
|
|
78
|
-
return onDelete(parentId, R.isNil(id) ? [] : [
|
|
79
|
+
return onDelete(parentId, R.isNil(id) ? [] : R.append(id, deprecated || []));
|
|
79
80
|
} : null;
|
|
80
81
|
var hasTooltip = (0, _utils2.shownTooltip)(items);
|
|
81
82
|
var hasMultiLinedTooltip = (0, _utils2.showMultiLinedTooltip)(items);
|
|
@@ -142,7 +143,8 @@ CustomChip.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
142
143
|
labelClasses: _propTypes2.default.string,
|
|
143
144
|
ariaLabel: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.element]),
|
|
144
145
|
items: _propTypes2.default.array,
|
|
145
|
-
labelRenderer: _propTypes2.default.func
|
|
146
|
+
labelRenderer: _propTypes2.default.func,
|
|
147
|
+
deprecated: _propTypes2.default.array
|
|
146
148
|
} : {};
|
|
147
149
|
|
|
148
150
|
exports.default = CustomChip;
|
|
@@ -83,10 +83,12 @@ var GroupedChips = function GroupedChips(_ref) {
|
|
|
83
83
|
}) : R.map(function (items) {
|
|
84
84
|
var lastItem = R.last(items);
|
|
85
85
|
var id = lastItem.id,
|
|
86
|
-
isNotRemovable = lastItem.isNotRemovable
|
|
86
|
+
isNotRemovable = lastItem.isNotRemovable,
|
|
87
|
+
deprecated = lastItem.deprecated;
|
|
87
88
|
|
|
88
89
|
|
|
89
90
|
return _react2.default.createElement(_CustomChip2.default, {
|
|
91
|
+
deprecated: deprecated,
|
|
90
92
|
key: id,
|
|
91
93
|
id: id,
|
|
92
94
|
items: R.pipe(R.length, R.gte(2)) ? items : null,
|
|
@@ -76,14 +76,17 @@ var HierarchicalFilter = function HierarchicalFilter(props) {
|
|
|
76
76
|
hasSpotlight = props.hasSpotlight,
|
|
77
77
|
_props$disableAccesso = props.disableAccessor,
|
|
78
78
|
disableAccessor = _props$disableAccesso === undefined ? R.always(false) : _props$disableAccesso,
|
|
79
|
-
allItems = props.allItems
|
|
79
|
+
allItems = props.allItems,
|
|
80
|
+
_props$simpleSelectio = props.simpleSelectionMode,
|
|
81
|
+
simpleSelectionMode = _props$simpleSelectio === undefined ? false : _props$simpleSelectio;
|
|
80
82
|
|
|
81
83
|
var classes = (0, _styles.useStyles)({ accessibility: accessibility });
|
|
82
84
|
var theme = (0, _core.useTheme)();
|
|
83
85
|
var isRtl = (0, _utils2.getIsRtl)(theme);
|
|
84
86
|
var Chip = R.isNil(Tag) ? _.Tag : Tag;
|
|
85
87
|
var _allGroupedItems = R.groupBy(R.propOr('#ROOT', 'parentId'), allItems);
|
|
86
|
-
var _disableAccessor = (0, _utils.getEvolvedDisableAccessor)(_allGroupedItems, disableAccessor, R.always(false));
|
|
88
|
+
var _disableAccessor = simpleSelectionMode ? disableAccessor : (0, _utils.getEvolvedDisableAccessor)(_allGroupedItems, disableAccessor, R.always(false));
|
|
89
|
+
|
|
87
90
|
var tagValue = getCounter(items, _disableAccessor, tagAccessor);
|
|
88
91
|
var isDisabled = function isDisabled(item) {
|
|
89
92
|
return R.is(Function, disableAccessor) ? disableAccessor(item) : false;
|
|
@@ -182,7 +185,8 @@ HierarchicalFilter.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
182
185
|
spotlight: _propTypes2.default.object,
|
|
183
186
|
setSpotlight: _propTypes2.default.func,
|
|
184
187
|
hasSpotlight: _propTypes2.default.bool,
|
|
185
|
-
allItems: _propTypes2.default.array
|
|
188
|
+
allItems: _propTypes2.default.array,
|
|
189
|
+
simpleSelectionMode: _propTypes2.default.bool
|
|
186
190
|
} : {};
|
|
187
191
|
|
|
188
192
|
exports.default = (0, _withSpotlight.withSpotlight)((0, _withExpansionTree.withExpansionTree)(HierarchicalFilter));
|
|
@@ -75,19 +75,17 @@ var Item = function Item(_ref) {
|
|
|
75
75
|
style = _ref.style,
|
|
76
76
|
isRtl = _ref.isRtl,
|
|
77
77
|
accessibility = _ref.accessibility,
|
|
78
|
-
index = _ref.index,
|
|
79
78
|
HTMLRenderer = _ref.HTMLRenderer,
|
|
80
79
|
hierarchicalId = _ref.hierarchicalId,
|
|
81
80
|
labels = _ref.labels,
|
|
82
81
|
_ref$depth = _ref.depth,
|
|
83
82
|
depth = _ref$depth === undefined ? 0 : _ref$depth,
|
|
84
|
-
|
|
83
|
+
eventsListeners = _ref.eventsListeners;
|
|
85
84
|
|
|
86
85
|
var _React$useState = _react2.default.useState(false),
|
|
87
86
|
isTooltipShown = _React$useState[0],
|
|
88
87
|
setIsTooltipShown = _React$useState[1];
|
|
89
88
|
|
|
90
|
-
var callbacks = eventsCallbacks(hierarchicalId || id, index);
|
|
91
89
|
var padding = depth * 30 + (depth > 0 && !hasChildrenOnLevel ? 30 : 0) + (!hasChild && hasChildrenOnLevel ? 30 : 0);
|
|
92
90
|
return _react2.default.createElement(
|
|
93
91
|
_ListItem2.default,
|
|
@@ -117,23 +115,21 @@ var Item = function Item(_ref) {
|
|
|
117
115
|
},
|
|
118
116
|
_react2.default.createElement(NavigateIcon, null)
|
|
119
117
|
),
|
|
120
|
-
_react2.default.createElement(_ListItemText2.default,
|
|
118
|
+
_react2.default.createElement(_ListItemText2.default, {
|
|
121
119
|
'data-testid': 'value_' + id,
|
|
122
120
|
tabIndex: 0,
|
|
123
|
-
'aria-label':
|
|
121
|
+
'aria-label': isGreyed ? R.propOr('', 'disableItemLabel')(labels) + ' ' + label : label,
|
|
124
122
|
'aria-pressed': isSelected,
|
|
125
123
|
'aria-disabled': isDisabled,
|
|
126
124
|
primaryTypographyProps: { noWrap: true, color: 'inherit' },
|
|
127
125
|
secondaryTypographyProps: { color: 'inherit' },
|
|
128
126
|
classes: { root: classes.listItem },
|
|
129
|
-
className: (0, _classnames2.default)((_cx = {}, _cx[classes.accessibilityItemHover] = accessibility, _cx[classes.listItemSelected] = isSelected
|
|
130
|
-
onClick: isDisabled ? null :
|
|
131
|
-
onMouseDown: isDisabled || isTooltipShown ? null :
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
title: isDisabled ? R.propOr('', 'disableItemLabel')(labels) + ' ' + label : label,
|
|
136
|
-
style: { opacity: isDisabled ? '0.5' : '1' },
|
|
127
|
+
className: (0, _classnames2.default)((_cx = {}, _cx[classes.accessibilityItemHover] = accessibility, _cx[classes.listItemSelected] = isSelected, _cx[classes.listItemHover] = !isDisabled, _cx)),
|
|
128
|
+
onClick: isDisabled ? null : eventsListeners.onClick,
|
|
129
|
+
onMouseDown: isDisabled || isTooltipShown ? null : eventsListeners.onMouseDown,
|
|
130
|
+
onMouseEnter: isDisabled || isTooltipShown ? null : eventsListeners.onMouseEnter,
|
|
131
|
+
title: isGreyed ? R.propOr('', 'disableItemLabel')(labels) + ' ' + label : label,
|
|
132
|
+
style: { opacity: isDisabled && isGreyed ? '0.5' : '1' },
|
|
137
133
|
primary: _react2.default.createElement(
|
|
138
134
|
'div',
|
|
139
135
|
{
|
|
@@ -144,7 +140,8 @@ var Item = function Item(_ref) {
|
|
|
144
140
|
_SvgIcon2.default,
|
|
145
141
|
{
|
|
146
142
|
color: 'primary',
|
|
147
|
-
className: (0, _classnames2.default)(classes.labelIcon, (_cx3 = {}, _cx3[classes.disabledLabel] = isDisabled, _cx3))
|
|
143
|
+
className: (0, _classnames2.default)(classes.labelIcon, (_cx3 = {}, _cx3[classes.disabledLabel] = isDisabled, _cx3)),
|
|
144
|
+
style: { opacity: isDisabled ? '0.5' : '1' }
|
|
148
145
|
},
|
|
149
146
|
isSelected ? _react2.default.createElement(_CheckBoxOutlined2.default, null) : _react2.default.createElement(_CheckBoxOutlineBlankOutlined2.default, null)
|
|
150
147
|
),
|
|
@@ -194,7 +191,7 @@ var Item = function Item(_ref) {
|
|
|
194
191
|
')'
|
|
195
192
|
)
|
|
196
193
|
)
|
|
197
|
-
})
|
|
194
|
+
})
|
|
198
195
|
);
|
|
199
196
|
};
|
|
200
197
|
|
|
@@ -218,13 +215,12 @@ Item.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
218
215
|
style: _propTypes2.default.object,
|
|
219
216
|
isRtl: _propTypes2.default.bool,
|
|
220
217
|
accessibility: _propTypes2.default.bool,
|
|
221
|
-
index: _propTypes2.default.number,
|
|
222
218
|
labelRenderer: _propTypes2.default.func,
|
|
223
219
|
HTMLRenderer: _propTypes2.default.func,
|
|
224
220
|
hierarchicalId: _propTypes2.default.string,
|
|
225
221
|
labels: _propTypes2.default.object,
|
|
226
222
|
depth: _propTypes2.default.number,
|
|
227
|
-
|
|
223
|
+
eventsListeners: _propTypes2.default.object,
|
|
228
224
|
isGreyed: _propTypes2.default.bool
|
|
229
225
|
} : {};
|
|
230
226
|
|
|
@@ -100,7 +100,9 @@ var VirtualizedTree = function VirtualizedTree(props) {
|
|
|
100
100
|
_props$scopeGetter = props.scopeGetter,
|
|
101
101
|
scopeGetter = _props$scopeGetter === undefined ? singleScopeGetter : _props$scopeGetter,
|
|
102
102
|
_props$treeHeight = props.treeHeight,
|
|
103
|
-
treeHeight = _props$treeHeight === undefined ? 0 : _props$treeHeight
|
|
103
|
+
treeHeight = _props$treeHeight === undefined ? 0 : _props$treeHeight,
|
|
104
|
+
_props$simpleSelectio = props.simpleSelectionMode,
|
|
105
|
+
simpleSelectionMode = _props$simpleSelectio === undefined ? false : _props$simpleSelectio;
|
|
104
106
|
|
|
105
107
|
var theme = (0, _core.useTheme)();
|
|
106
108
|
|
|
@@ -216,56 +218,63 @@ var VirtualizedTree = function VirtualizedTree(props) {
|
|
|
216
218
|
setIsMouseDown(false);
|
|
217
219
|
}
|
|
218
220
|
};
|
|
219
|
-
|
|
221
|
+
|
|
222
|
+
var onMouseUp = function onMouseUp(e) {
|
|
223
|
+
if (!isMouseDown) {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
e.preventDefault();
|
|
227
|
+
apply();
|
|
228
|
+
setIsMouseDown(false);
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
var onMouseLeave = function onMouseLeave() {
|
|
232
|
+
if (isMouseDown) {
|
|
233
|
+
apply();
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
var onKeyUp = function onKeyUp(e) {
|
|
238
|
+
e.preventDefault();
|
|
239
|
+
if (e.key === 'Shift' && !R.isEmpty(shiftIndexes)) {
|
|
240
|
+
apply();
|
|
241
|
+
} else if (e.key === 'Control' && !R.isEmpty(selectIds)) {
|
|
242
|
+
apply();
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
var itemEventsListeners = function itemEventsListeners(id, index) {
|
|
220
247
|
return {
|
|
221
|
-
onMouseUp: isMouseDown ? function (e) {
|
|
222
|
-
e.preventDefault();
|
|
223
|
-
apply();
|
|
224
|
-
if (!R.isEmpty(selectIds)) {
|
|
225
|
-
setLastItemId(id);
|
|
226
|
-
}
|
|
227
|
-
setIsMouseDown(false);
|
|
228
|
-
} : null,
|
|
229
248
|
onMouseDown: function onMouseDown(e) {
|
|
230
|
-
e.
|
|
231
|
-
if (e.ctrlKey || e.shiftKey) {
|
|
249
|
+
if (!simpleSelectionMode && (e.ctrlKey || e.shiftKey)) {
|
|
232
250
|
return;
|
|
233
251
|
}
|
|
234
252
|
setIsMouseDown(true);
|
|
235
253
|
multiSelect(id);
|
|
236
254
|
},
|
|
237
|
-
onMouseEnter:
|
|
255
|
+
onMouseEnter: function onMouseEnter(e) {
|
|
238
256
|
e.preventDefault();
|
|
239
|
-
if (e.ctrlKey || e.shiftKey) {
|
|
257
|
+
if (!isMouseDown || simpleSelectionMode || e.ctrlKey || e.shiftKey) {
|
|
240
258
|
return;
|
|
241
259
|
}
|
|
242
260
|
multiSelect(id);
|
|
243
|
-
|
|
261
|
+
setLastItemId(id);
|
|
262
|
+
},
|
|
244
263
|
onClick: function onClick(e) {
|
|
245
264
|
e.preventDefault();
|
|
246
|
-
|
|
247
|
-
if (e.ctrlKey) {
|
|
265
|
+
if (e.ctrlKey && !simpleSelectionMode) {
|
|
248
266
|
multiSelect(id);
|
|
249
|
-
} else if (e.shiftKey) {
|
|
267
|
+
} else if (e.shiftKey && !simpleSelectionMode) {
|
|
250
268
|
shiftSelect(index);
|
|
251
269
|
} else {
|
|
252
270
|
setIsMouseDown(false);
|
|
253
271
|
setLastItemId(id);
|
|
254
272
|
}
|
|
255
273
|
}
|
|
256
|
-
// ondblclick: () => null
|
|
257
274
|
};
|
|
258
275
|
};
|
|
259
|
-
var onKeyUp = function onKeyUp(e) {
|
|
260
|
-
if (e.key === 'Shift' && !R.isEmpty(shiftIndexes)) {
|
|
261
|
-
apply();
|
|
262
|
-
} else if (e.key === 'Control' && !R.isEmpty(selectIds)) {
|
|
263
|
-
apply();
|
|
264
|
-
}
|
|
265
|
-
};
|
|
266
276
|
var ref = (0, _react.useRef)();
|
|
267
277
|
var classes = (0, _styles.useStyles)();
|
|
268
|
-
|
|
269
278
|
(0, _react.useEffect)(function () {
|
|
270
279
|
var current = ref.current;
|
|
271
280
|
var handler = function handler(event) {
|
|
@@ -288,7 +297,6 @@ var VirtualizedTree = function VirtualizedTree(props) {
|
|
|
288
297
|
setScrollTop(undefined);
|
|
289
298
|
}
|
|
290
299
|
if (R.isNil(current)) return;
|
|
291
|
-
|
|
292
300
|
current.addEventListener('wheel', handler, { passive: false });
|
|
293
301
|
return function () {
|
|
294
302
|
current.removeEventListener('wheel', handler, { passive: false });
|
|
@@ -306,7 +314,8 @@ var VirtualizedTree = function VirtualizedTree(props) {
|
|
|
306
314
|
disablePadding: true,
|
|
307
315
|
style: { height: maxHeight + 2 },
|
|
308
316
|
onKeyUp: onKeyUp,
|
|
309
|
-
|
|
317
|
+
onMouseUp: onMouseUp,
|
|
318
|
+
onMouseLeave: onMouseLeave,
|
|
310
319
|
ref: ref
|
|
311
320
|
},
|
|
312
321
|
_react2.default.createElement(
|
|
@@ -343,11 +352,10 @@ var VirtualizedTree = function VirtualizedTree(props) {
|
|
|
343
352
|
},
|
|
344
353
|
NavigateIcon: R.has(itemId, expandedIds) ? _ExpandLess2.default : _ExpandMore2.default,
|
|
345
354
|
isRtl: isRtl,
|
|
346
|
-
|
|
355
|
+
eventsListeners: itemEventsListeners((0, _utils.getHierarchicalId)(item), index),
|
|
347
356
|
HTMLRenderer: HTMLRenderer,
|
|
348
357
|
classes: classes,
|
|
349
358
|
labels: labels,
|
|
350
|
-
index: index,
|
|
351
359
|
style: style,
|
|
352
360
|
accessibility: accessibility,
|
|
353
361
|
ariaLabel: R.prop('navigateNext')(labels),
|
|
@@ -379,7 +387,8 @@ VirtualizedTree.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
379
387
|
collapse: _propTypes2.default.func,
|
|
380
388
|
treeHeight: _propTypes2.default.number,
|
|
381
389
|
isGreyed: _propTypes2.default.func,
|
|
382
|
-
scopeGetter: _propTypes2.default.func
|
|
390
|
+
scopeGetter: _propTypes2.default.func,
|
|
391
|
+
simpleSelectionMode: _propTypes2.default.bool
|
|
383
392
|
} : {};
|
|
384
393
|
|
|
385
394
|
exports.default = VirtualizedTree;
|