@sis-cc/dotstatsuite-visions 7.20.4 → 7.20.6
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/AdvancedFilterDialog/AdvancedFilterDialog.js +107 -52
- package/es/HierarchicalFilter/HierarchicalFilter.js +20 -4
- package/es/VirtualizedTree/Item.js +2 -0
- package/es/VirtualizedTree/VirtualizedTree.js +88 -114
- package/es/VirtualizedTree/withExpansionTree.js +56 -0
- package/lib/AdvancedFilterDialog/AdvancedFilterDialog.js +107 -51
- package/lib/HierarchicalFilter/HierarchicalFilter.js +20 -4
- package/lib/VirtualizedTree/Item.js +2 -0
- package/lib/VirtualizedTree/VirtualizedTree.js +87 -116
- package/lib/VirtualizedTree/withExpansionTree.js +71 -0
- package/package.json +1 -1
|
@@ -25,10 +25,6 @@ var _List = require('react-virtualized/dist/commonjs/List');
|
|
|
25
25
|
|
|
26
26
|
var _List2 = _interopRequireDefault(_List);
|
|
27
27
|
|
|
28
|
-
var _Button = require('@material-ui/core/Button');
|
|
29
|
-
|
|
30
|
-
var _Button2 = _interopRequireDefault(_Button);
|
|
31
|
-
|
|
32
28
|
var _ExpandMore = require('@material-ui/icons/ExpandMore');
|
|
33
29
|
|
|
34
30
|
var _ExpandMore2 = _interopRequireDefault(_ExpandMore);
|
|
@@ -103,7 +99,9 @@ var VirtualizedTree = function VirtualizedTree(props) {
|
|
|
103
99
|
items = props.items,
|
|
104
100
|
labelRenderer = props.labelRenderer,
|
|
105
101
|
labels = props.labels,
|
|
106
|
-
|
|
102
|
+
expandedIds = props.expandedIds,
|
|
103
|
+
expand = props.expand,
|
|
104
|
+
collapse = props.collapse,
|
|
107
105
|
_props$maxTreeHeight = props.maxTreeHeight,
|
|
108
106
|
maxTreeHeight = _props$maxTreeHeight === undefined ? 250 : _props$maxTreeHeight,
|
|
109
107
|
_props$getItemScope = props.getItemScope,
|
|
@@ -111,25 +109,21 @@ var VirtualizedTree = function VirtualizedTree(props) {
|
|
|
111
109
|
|
|
112
110
|
var theme = (0, _core.useTheme)();
|
|
113
111
|
|
|
114
|
-
var _useState = (0, _react.useState)(
|
|
115
|
-
|
|
116
|
-
|
|
112
|
+
var _useState = (0, _react.useState)(undefined),
|
|
113
|
+
scrollTop = _useState[0],
|
|
114
|
+
setScrollTop = _useState[1];
|
|
117
115
|
|
|
118
|
-
var _useState2 = (0, _react.useState)(
|
|
119
|
-
|
|
120
|
-
|
|
116
|
+
var _useState2 = (0, _react.useState)([]),
|
|
117
|
+
shiftIndexes = _useState2[0],
|
|
118
|
+
setShiftIndexes = _useState2[1];
|
|
121
119
|
|
|
122
|
-
var _useState3 = (0, _react.useState)(
|
|
123
|
-
|
|
124
|
-
|
|
120
|
+
var _useState3 = (0, _react.useState)({}),
|
|
121
|
+
selectIds = _useState3[0],
|
|
122
|
+
setSelectIds = _useState3[1];
|
|
125
123
|
|
|
126
|
-
var _useState4 = (0, _react.useState)(
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
var _useState5 = (0, _react.useState)(false),
|
|
131
|
-
isMouseDown = _useState5[0],
|
|
132
|
-
setIsMouseDown = _useState5[1];
|
|
124
|
+
var _useState4 = (0, _react.useState)(false),
|
|
125
|
+
isMouseDown = _useState4[0],
|
|
126
|
+
setIsMouseDown = _useState4[1];
|
|
133
127
|
|
|
134
128
|
var _useMemo = (0, _react.useMemo)(function () {
|
|
135
129
|
var indexedItemsById = R.indexBy(getHierarchicalId, items);
|
|
@@ -197,21 +191,26 @@ var VirtualizedTree = function VirtualizedTree(props) {
|
|
|
197
191
|
apply();
|
|
198
192
|
} : null,
|
|
199
193
|
onMouseDown: function onMouseDown(e) {
|
|
200
|
-
if (e.ctrlKey) {
|
|
201
|
-
|
|
202
|
-
} else if (e.shiftKey) {
|
|
203
|
-
shiftSelect(index);
|
|
204
|
-
} else {
|
|
205
|
-
multiSelect(id);
|
|
206
|
-
setIsMouseDown(true);
|
|
194
|
+
if (e.ctrlKey || e.shiftKey) {
|
|
195
|
+
return;
|
|
207
196
|
}
|
|
197
|
+
multiSelect(id);
|
|
198
|
+
setIsMouseDown(true);
|
|
208
199
|
},
|
|
209
200
|
onMouseEnter: isMouseDown ? function (e) {
|
|
210
201
|
if (e.ctrlKey || e.shiftKey) {
|
|
211
202
|
return;
|
|
212
203
|
}
|
|
213
204
|
multiSelect(id);
|
|
214
|
-
} : null
|
|
205
|
+
} : null,
|
|
206
|
+
onClick: function onClick(e) {
|
|
207
|
+
e.preventDefault();
|
|
208
|
+
if (e.ctrlKey) {
|
|
209
|
+
multiSelect(id);
|
|
210
|
+
} else if (e.shiftKey) {
|
|
211
|
+
shiftSelect(index);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
215
214
|
};
|
|
216
215
|
};
|
|
217
216
|
var onKeyUp = function onKeyUp(e) {
|
|
@@ -263,99 +262,68 @@ var VirtualizedTree = function VirtualizedTree(props) {
|
|
|
263
262
|
}, [scrollTop]);
|
|
264
263
|
var maxHeight = R.pipe(R.length, R.multiply(_styles.height), R.ifElse(R.gt(maxTreeHeight), R.add(10), R.always(maxTreeHeight)))(list);
|
|
265
264
|
|
|
266
|
-
var expand = function expand(index) {
|
|
267
|
-
var parentId = R.nth(index, list);
|
|
268
|
-
setExpandedIds(R.assoc(parentId, parentId, expandedIds));
|
|
269
|
-
};
|
|
270
|
-
|
|
271
|
-
var collapse = function collapse(index) {
|
|
272
|
-
var parentId = R.nth(index, list);
|
|
273
|
-
setExpandedIds(R.dissoc(parentId, expandedIds));
|
|
274
|
-
};
|
|
275
|
-
|
|
276
|
-
var expandAll = function expandAll() {
|
|
277
|
-
setExpandedIds(indexedItemsById);
|
|
278
|
-
};
|
|
279
|
-
|
|
280
|
-
var collapseAll = function collapseAll() {
|
|
281
|
-
setExpandedIds({});
|
|
282
|
-
};
|
|
283
|
-
|
|
284
265
|
if (R.isEmpty(list)) {
|
|
285
266
|
return null;
|
|
286
267
|
}
|
|
287
268
|
var isRtl = (0, _utils.getIsRtl)(theme);
|
|
288
|
-
|
|
289
269
|
return _react2.default.createElement(
|
|
290
|
-
|
|
291
|
-
|
|
270
|
+
_List4.default,
|
|
271
|
+
{
|
|
272
|
+
disablePadding: true,
|
|
273
|
+
style: { height: maxHeight + 2 },
|
|
274
|
+
onKeyUp: onKeyUp,
|
|
275
|
+
onMouseLeave: isMouseDown ? apply : null,
|
|
276
|
+
ref: ref
|
|
277
|
+
},
|
|
292
278
|
_react2.default.createElement(
|
|
293
|
-
|
|
294
|
-
{ disablePadding: true, style: { height: maxHeight + 2 }, onKeyUp: onKeyUp, ref: ref },
|
|
295
|
-
_react2.default.createElement(
|
|
296
|
-
_AutoSizer2.default,
|
|
297
|
-
null,
|
|
298
|
-
function (_ref) {
|
|
299
|
-
var height = _ref.height,
|
|
300
|
-
width = _ref.width;
|
|
301
|
-
return _react2.default.createElement(_List2.default, {
|
|
302
|
-
overscan: 10,
|
|
303
|
-
tabIndex: -1,
|
|
304
|
-
height: height + 2,
|
|
305
|
-
width: width,
|
|
306
|
-
scrollTop: scrollTop // control scroll position with ctrl or shift key
|
|
307
|
-
, rowCount: R.length(list),
|
|
308
|
-
rowHeight: R.add(1)(_styles.height) // 1 is space between elements
|
|
309
|
-
, rowRenderer: function rowRenderer(_ref2) {
|
|
310
|
-
var index = _ref2.index,
|
|
311
|
-
style = _ref2.style;
|
|
312
|
-
|
|
313
|
-
var itemId = R.nth(index, list);
|
|
314
|
-
var item = R.prop(itemId, indexedItemsById);
|
|
315
|
-
return _react2.default.createElement(_Item2.default, _extends({}, item, {
|
|
316
|
-
id: getHierarchicalId(item),
|
|
317
|
-
label: labelRenderer(item),
|
|
318
|
-
key: getHierarchicalId(item),
|
|
319
|
-
depth: getDepth(indexedItemsById)(item),
|
|
320
|
-
hasChild: R.has(itemId, groupedItemsByParentId),
|
|
321
|
-
hasChildrenOnLevel: getHasChildrenOnLevel(groupedItemsByParentId)(item),
|
|
322
|
-
changeList: R.has(itemId, expandedIds) ? function () {
|
|
323
|
-
return collapse(index);
|
|
324
|
-
} : function () {
|
|
325
|
-
return expand(index);
|
|
326
|
-
},
|
|
327
|
-
NavigateIcon: R.has(itemId, expandedIds) ? _ExpandLess2.default : _ExpandMore2.default,
|
|
328
|
-
isRtl: isRtl,
|
|
329
|
-
isDisabled: R.is(Function, disableAccessor) ? disableAccessor(item) : false,
|
|
330
|
-
eventsCallbacks: eventsCallbacks,
|
|
331
|
-
isSelected: isItemSelected(item, index),
|
|
332
|
-
HTMLRenderer: HTMLRenderer,
|
|
333
|
-
classes: classes,
|
|
334
|
-
labels: labels,
|
|
335
|
-
index: index,
|
|
336
|
-
style: style,
|
|
337
|
-
accessibility: accessibility,
|
|
338
|
-
ariaLabel: R.prop('navigateNext')(labels),
|
|
339
|
-
theme: theme
|
|
340
|
-
}));
|
|
341
|
-
}
|
|
342
|
-
});
|
|
343
|
-
}
|
|
344
|
-
)
|
|
345
|
-
),
|
|
346
|
-
withExpandControl && _react2.default.createElement(
|
|
347
|
-
'div',
|
|
279
|
+
_AutoSizer2.default,
|
|
348
280
|
null,
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
281
|
+
function (_ref) {
|
|
282
|
+
var height = _ref.height,
|
|
283
|
+
width = _ref.width;
|
|
284
|
+
return _react2.default.createElement(_List2.default, {
|
|
285
|
+
overscan: 10,
|
|
286
|
+
tabIndex: -1,
|
|
287
|
+
height: height + 2,
|
|
288
|
+
width: width,
|
|
289
|
+
scrollTop: scrollTop // control scroll position with ctrl or shift key
|
|
290
|
+
, rowCount: R.length(list),
|
|
291
|
+
rowHeight: R.add(1)(_styles.height) // 1 is space between elements
|
|
292
|
+
, rowRenderer: function rowRenderer(_ref2) {
|
|
293
|
+
var index = _ref2.index,
|
|
294
|
+
style = _ref2.style;
|
|
295
|
+
|
|
296
|
+
var itemId = R.nth(index, list);
|
|
297
|
+
var item = R.prop(itemId, indexedItemsById);
|
|
298
|
+
return _react2.default.createElement(_Item2.default, _extends({}, item, {
|
|
299
|
+
id: getHierarchicalId(item),
|
|
300
|
+
label: labelRenderer(item),
|
|
301
|
+
key: getHierarchicalId(item),
|
|
302
|
+
depth: getDepth(indexedItemsById)(item),
|
|
303
|
+
hasChild: R.has(itemId, groupedItemsByParentId),
|
|
304
|
+
hasChildrenOnLevel: getHasChildrenOnLevel(groupedItemsByParentId)(item),
|
|
305
|
+
changeList: R.has(itemId, expandedIds) ? function () {
|
|
306
|
+
return collapse(getHierarchicalId(item));
|
|
307
|
+
} : function () {
|
|
308
|
+
return expand(getHierarchicalId(item));
|
|
309
|
+
},
|
|
310
|
+
NavigateIcon: R.has(itemId, expandedIds) ? _ExpandLess2.default : _ExpandMore2.default,
|
|
311
|
+
isRtl: isRtl,
|
|
312
|
+
isDisabled: R.is(Function, disableAccessor) ? disableAccessor(item) : false,
|
|
313
|
+
eventsCallbacks: eventsCallbacks,
|
|
314
|
+
isSelected: isItemSelected(item, index),
|
|
315
|
+
HTMLRenderer: HTMLRenderer,
|
|
316
|
+
classes: classes,
|
|
317
|
+
labels: labels,
|
|
318
|
+
index: index,
|
|
319
|
+
style: style,
|
|
320
|
+
accessibility: accessibility,
|
|
321
|
+
ariaLabel: R.prop('navigateNext')(labels),
|
|
322
|
+
theme: theme
|
|
323
|
+
}));
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
}
|
|
359
327
|
)
|
|
360
328
|
);
|
|
361
329
|
};
|
|
@@ -375,7 +343,10 @@ VirtualizedTree.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
375
343
|
}),
|
|
376
344
|
labelRenderer: _propTypes2.default.func,
|
|
377
345
|
withExpandControl: _propTypes2.default.bool,
|
|
378
|
-
maxTreeHeight: _propTypes2.default.number
|
|
346
|
+
maxTreeHeight: _propTypes2.default.number,
|
|
347
|
+
expandedIds: _propTypes2.default.object,
|
|
348
|
+
expand: _propTypes2.default.func,
|
|
349
|
+
collapse: _propTypes2.default.func
|
|
379
350
|
} : {};
|
|
380
351
|
|
|
381
352
|
exports.default = VirtualizedTree;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.withExpansionTree = undefined;
|
|
5
|
+
|
|
6
|
+
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
7
|
+
|
|
8
|
+
var _react = require('react');
|
|
9
|
+
|
|
10
|
+
var _react2 = _interopRequireDefault(_react);
|
|
11
|
+
|
|
12
|
+
var _ramda = require('ramda');
|
|
13
|
+
|
|
14
|
+
var R = _interopRequireWildcard(_ramda);
|
|
15
|
+
|
|
16
|
+
var _VirtualizedTree = require('./VirtualizedTree');
|
|
17
|
+
|
|
18
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
|
19
|
+
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
+
|
|
22
|
+
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } /* eslint react/prop-types: 0 */
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
var withExpansionTree = function withExpansionTree(Component) {
|
|
26
|
+
return function (_ref) {
|
|
27
|
+
var items = _ref.items,
|
|
28
|
+
defaultExpandedIds = _ref.defaultExpandedIds,
|
|
29
|
+
rest = _objectWithoutProperties(_ref, ['items', 'defaultExpandedIds']);
|
|
30
|
+
|
|
31
|
+
var _useState = (0, _react.useState)({}),
|
|
32
|
+
expandedIds = _useState[0],
|
|
33
|
+
setExpandedIds = _useState[1];
|
|
34
|
+
|
|
35
|
+
(0, _react.useEffect)(function () {
|
|
36
|
+
if (!R.isNil(defaultExpandedIds)) {
|
|
37
|
+
setExpandedIds(defaultExpandedIds);
|
|
38
|
+
} else {
|
|
39
|
+
var ids = R.pipe(R.map(_VirtualizedTree.getHierarchicalId), R.indexBy(R.identity))(items);
|
|
40
|
+
setExpandedIds(ids);
|
|
41
|
+
}
|
|
42
|
+
}, [items, defaultExpandedIds]);
|
|
43
|
+
|
|
44
|
+
var expand = function expand(id) {
|
|
45
|
+
setExpandedIds(R.assoc(id, id, expandedIds));
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
var collapse = function collapse(id) {
|
|
49
|
+
setExpandedIds(R.dissoc(id, expandedIds));
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
var expandAll = function expandAll() {
|
|
53
|
+
var ids = R.pipe(R.map(_VirtualizedTree.getHierarchicalId), R.indexBy(R.identity))(items);
|
|
54
|
+
setExpandedIds(ids);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
var collapseAll = function collapseAll() {
|
|
58
|
+
setExpandedIds({});
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return _react2.default.createElement(Component, _extends({}, rest, {
|
|
62
|
+
items: items,
|
|
63
|
+
expand: expand,
|
|
64
|
+
collapse: collapse,
|
|
65
|
+
expandAll: expandAll,
|
|
66
|
+
collapseAll: collapseAll,
|
|
67
|
+
expandedIds: expandedIds
|
|
68
|
+
}));
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
exports.withExpansionTree = withExpansionTree;
|