@sis-cc/dotstatsuite-visions 10.7.0 → 10.8.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/AdvancedFilterDialog/AdvancedFilterDialog.js +18 -3
- package/es/HierarchicalFilter/HierarchicalFilter.js +2 -2
- package/es/VirtualizedTree/Item.js +3 -3
- package/es/VirtualizedTree/VirtualizedTree.js +2 -2
- package/es/VirtualizedTree/utils.js +41 -25
- package/lib/AdvancedFilterDialog/AdvancedFilterDialog.js +17 -2
- package/lib/HierarchicalFilter/HierarchicalFilter.js +1 -1
- package/lib/VirtualizedTree/Item.js +3 -3
- package/lib/VirtualizedTree/VirtualizedTree.js +1 -1
- package/lib/VirtualizedTree/utils.js +42 -26
- package/package.json +1 -1
- package/umd/@sis-cc/dotstatsuite-visions.js +65 -34
- package/umd/@sis-cc/dotstatsuite-visions.min.js +3 -3
- package/umd/@sis-cc/dotstatsuite-visions.min.js.map +1 -1
|
@@ -6,7 +6,7 @@ import React, { useState, Fragment } from 'react';
|
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import * as R from 'ramda';
|
|
8
8
|
import cx from 'classnames';
|
|
9
|
-
import {
|
|
9
|
+
import { getEvolvedDisableAccessor, getHierarchicalId, getScopeGetters } from '../VirtualizedTree/utils';
|
|
10
10
|
import IconButton from '@material-ui/core/Button';
|
|
11
11
|
import Dialog from '@material-ui/core/Dialog';
|
|
12
12
|
import DialogTitle from '@material-ui/core/DialogTitle';
|
|
@@ -207,7 +207,7 @@ var AdvancedFilterDialog = function AdvancedFilterDialog(props) {
|
|
|
207
207
|
isSelected: R.has(item.id, selection) ? !item.isSelected : !!item.isSelected
|
|
208
208
|
});
|
|
209
209
|
}, items);
|
|
210
|
-
var
|
|
210
|
+
var indexedFilteredItems = R.indexBy(getHierarchicalId, selectionItems);
|
|
211
211
|
|
|
212
212
|
var selectionOptions = [{
|
|
213
213
|
value: 'single',
|
|
@@ -236,7 +236,22 @@ var AdvancedFilterDialog = function AdvancedFilterDialog(props) {
|
|
|
236
236
|
isSelected: R.has(item.id, selection) ? !item.isSelected : !!item.isSelected
|
|
237
237
|
});
|
|
238
238
|
}), R.groupBy(R.propOr('#ROOT', 'parentId')))(allItems);
|
|
239
|
-
|
|
239
|
+
|
|
240
|
+
var isChildInSelectionScope = function isChildInSelectionScope(child, ancestor) {
|
|
241
|
+
if (!R.has(getHierarchicalId(child), indexedFilteredItems)) {
|
|
242
|
+
return false;
|
|
243
|
+
}
|
|
244
|
+
if (selectionMode === 'single' || selectionMode === 'level') {
|
|
245
|
+
return false;
|
|
246
|
+
}
|
|
247
|
+
if (selectionMode === 'children') {
|
|
248
|
+
return child.parentId === getHierarchicalId(ancestor);
|
|
249
|
+
}
|
|
250
|
+
return true;
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
var _disableAccessor = getEvolvedDisableAccessor(_allGroupedItems, disableAccessor, isChildInSelectionScope);
|
|
254
|
+
|
|
240
255
|
var isDisabled = function isDisabled(item) {
|
|
241
256
|
return R.is(Function, disableAccessor) ? disableAccessor(item) : false;
|
|
242
257
|
};
|
|
@@ -8,7 +8,7 @@ import ZoomOutMapIcon from '@material-ui/icons/ZoomOutMap';
|
|
|
8
8
|
import { ExpansionPanel, Tag as InternalTag, VerticalButton, Spotlight, VirtualizedTree, Tooltip } from '../';
|
|
9
9
|
import { withExpansionTree } from '../VirtualizedTree/withExpansionTree';
|
|
10
10
|
import { withSpotlight } from '../VirtualizedTree/withSpotlight';
|
|
11
|
-
import {
|
|
11
|
+
import { getEvolvedDisableAccessor } from '../VirtualizedTree/utils';
|
|
12
12
|
import { useStyles } from '../ScopeList/styles';
|
|
13
13
|
import { useTheme } from '@material-ui/core';
|
|
14
14
|
import { getIsRtl } from '../utils';
|
|
@@ -54,7 +54,7 @@ var HierarchicalFilter = function HierarchicalFilter(props) {
|
|
|
54
54
|
var isRtl = getIsRtl(theme);
|
|
55
55
|
var Chip = R.isNil(Tag) ? InternalTag : Tag;
|
|
56
56
|
var _allGroupedItems = R.groupBy(R.propOr('#ROOT', 'parentId'), allItems);
|
|
57
|
-
var _disableAccessor =
|
|
57
|
+
var _disableAccessor = getEvolvedDisableAccessor(_allGroupedItems, disableAccessor, R.always(false));
|
|
58
58
|
var tagValue = getCounter(items, _disableAccessor, tagAccessor);
|
|
59
59
|
var isDisabled = function isDisabled(item) {
|
|
60
60
|
return R.is(Function, disableAccessor) ? disableAccessor(item) : false;
|
|
@@ -86,7 +86,7 @@ var Item = function Item(_ref) {
|
|
|
86
86
|
primaryTypographyProps: { noWrap: true, color: 'inherit' },
|
|
87
87
|
secondaryTypographyProps: { color: 'inherit' },
|
|
88
88
|
classes: { root: classes.listItem },
|
|
89
|
-
className: cx((_cx = {}, _cx[classes.accessibilityItemHover] = accessibility, _cx[classes.listItemSelected] =
|
|
89
|
+
className: cx((_cx = {}, _cx[classes.accessibilityItemHover] = accessibility, _cx[classes.listItemSelected] = isSelected && (!isDisabled || !isGreyed), _cx[classes.listItemHover] = !isDisabled || !isGreyed, _cx)),
|
|
90
90
|
onClick: isDisabled ? null : callbacks.onClick,
|
|
91
91
|
onMouseDown: isDisabled || isTooltipShown ? null : callbacks.onMouseDown,
|
|
92
92
|
onMouseUp: isDisabled || isTooltipShown ? null : callbacks.onMouseUp,
|
|
@@ -112,7 +112,7 @@ var Item = function Item(_ref) {
|
|
|
112
112
|
SvgIcon,
|
|
113
113
|
{
|
|
114
114
|
color: 'primary',
|
|
115
|
-
className: cx(classes.labelIcon, (_cx4 = {}, _cx4[classes.disabledLabel] =
|
|
115
|
+
className: cx(classes.labelIcon, (_cx4 = {}, _cx4[classes.disabledLabel] = isDisabled, _cx4))
|
|
116
116
|
},
|
|
117
117
|
React.createElement('path', { d: svgPath })
|
|
118
118
|
),
|
|
@@ -141,7 +141,7 @@ var Item = function Item(_ref) {
|
|
|
141
141
|
{
|
|
142
142
|
color: 'inherit',
|
|
143
143
|
variant: 'body2',
|
|
144
|
-
className: cx(classes.label, (_cx5 = {}, _cx5[classes.disabledLabel] = isGreyed
|
|
144
|
+
className: cx(classes.label, (_cx5 = {}, _cx5[classes.disabledLabel] = isGreyed, _cx5[classes.tooltipNotice] = !R.isEmpty(description), _cx5))
|
|
145
145
|
},
|
|
146
146
|
label
|
|
147
147
|
)
|
|
@@ -11,7 +11,7 @@ import List from '@material-ui/core/List';
|
|
|
11
11
|
import Item from './Item';
|
|
12
12
|
import { useTheme } from '@material-ui/core';
|
|
13
13
|
import { useStyles, height as rowHeight } from '../ScopeList/styles';
|
|
14
|
-
import { getDepth, getHierarchicalId, isItemSelected as _isItemSelected, getDeprecatedIds, getDuplicates } from './utils';
|
|
14
|
+
import { getDepth, getHierarchicalId, isItemSelected as _isItemSelected, getDeprecatedIds, getDuplicates, getImposedItems } from './utils';
|
|
15
15
|
import { getIsRtl } from '../utils';
|
|
16
16
|
|
|
17
17
|
var singleScopeGetter = function singleScopeGetter() {
|
|
@@ -110,7 +110,7 @@ var VirtualizedTree = function VirtualizedTree(props) {
|
|
|
110
110
|
|
|
111
111
|
var multiSelect = function multiSelect(id) {
|
|
112
112
|
var item = R.prop(id, indexedItemsById);
|
|
113
|
-
var ids = R.pipe(getItemScope, R.filter(function (v) {
|
|
113
|
+
var ids = R.pipe(getItemScope, getImposedItems(selectIds, indexedItemsById), R.filter(function (v) {
|
|
114
114
|
return v.isSelected === item.isSelected;
|
|
115
115
|
}), function (items) {
|
|
116
116
|
return getDuplicates(items, indexedItemsById);
|
|
@@ -84,34 +84,37 @@ export var getDeprecatedIds = function getDeprecatedIds(ids, items, selectedIds)
|
|
|
84
84
|
return reccurse(ids);
|
|
85
85
|
};
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
87
|
+
// evolved disableAccessor with hierarchical context and selection mode
|
|
88
|
+
export var getEvolvedDisableAccessor = function getEvolvedDisableAccessor(groupedItems) {
|
|
89
|
+
var disableAccessor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : R.always(false);
|
|
90
|
+
var getIsChildInSelectionScope = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : R.always(true);
|
|
91
|
+
return (//combine selection mode + spotlight
|
|
92
|
+
function (item, selectedIds) {
|
|
93
|
+
var hierarchicalFinder = function hierarchicalFinder(validator) {
|
|
94
|
+
return function (parentId) {
|
|
95
|
+
return R.find(function (child) {
|
|
96
|
+
if (validator(child)) return true;
|
|
97
|
+
return !R.isNil(hierarchicalFinder(validator)(getHierarchicalId(child)));
|
|
98
|
+
}, R.propOr([], parentId, groupedItems));
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
// selected forcedItem isn't deselectable unless all selected descendants are in deselection scope
|
|
102
|
+
if (isItemSelected(selectedIds)(item) && R.propOr(false, 'isForced', item)) {
|
|
103
|
+
var outOfScopeSelectedDescendant = hierarchicalFinder(function (child) {
|
|
104
|
+
return isItemSelected(selectedIds)(child) && !getIsChildInSelectionScope(child, item);
|
|
105
|
+
})(getHierarchicalId(item));
|
|
106
|
+
return !R.isNil(outOfScopeSelectedDescendant);
|
|
107
|
+
}
|
|
108
|
+
// non selected invalid item is disabled unless some (valid) children are selected or selectable in scope
|
|
109
|
+
if (!isItemSelected(selectedIds)(item) && disableAccessor(item)) {
|
|
110
|
+
var validDescendant = hierarchicalFinder(function (child) {
|
|
111
|
+
return isItemSelected(selectedIds)(child) || getIsChildInSelectionScope(child, item) && !disableAccessor(child);
|
|
112
|
+
})(getHierarchicalId(item));
|
|
109
113
|
return R.isNil(validDescendant);
|
|
110
114
|
}
|
|
115
|
+
return false;
|
|
111
116
|
}
|
|
112
|
-
|
|
113
|
-
};
|
|
114
|
-
return accessor;
|
|
117
|
+
);
|
|
115
118
|
};
|
|
116
119
|
|
|
117
120
|
export var getScopeGetters = {
|
|
@@ -147,4 +150,17 @@ export var getScopeGetters = {
|
|
|
147
150
|
}, R.values(indexed));
|
|
148
151
|
};
|
|
149
152
|
}
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export var getImposedItems = function getImposedItems(selectIds, indexedItems) {
|
|
156
|
+
return function (selectedItems) {
|
|
157
|
+
return R.reduce(function (acc, item) {
|
|
158
|
+
var isSelected = isItemSelected(selectIds)(item);
|
|
159
|
+
if (!isSelected) {
|
|
160
|
+
var imposedItems = R.props(R.propOr([], 'imposedIds', item), indexedItems);
|
|
161
|
+
return R.concat(acc, R.append(item, imposedItems));
|
|
162
|
+
}
|
|
163
|
+
return R.append(item, acc);
|
|
164
|
+
}, [], selectedItems);
|
|
165
|
+
};
|
|
150
166
|
};
|
|
@@ -298,7 +298,7 @@ var AdvancedFilterDialog = function AdvancedFilterDialog(props) {
|
|
|
298
298
|
isSelected: R.has(item.id, selection) ? !item.isSelected : !!item.isSelected
|
|
299
299
|
});
|
|
300
300
|
}, items);
|
|
301
|
-
var
|
|
301
|
+
var indexedFilteredItems = R.indexBy(_utils.getHierarchicalId, selectionItems);
|
|
302
302
|
|
|
303
303
|
var selectionOptions = [{
|
|
304
304
|
value: 'single',
|
|
@@ -327,7 +327,22 @@ var AdvancedFilterDialog = function AdvancedFilterDialog(props) {
|
|
|
327
327
|
isSelected: R.has(item.id, selection) ? !item.isSelected : !!item.isSelected
|
|
328
328
|
});
|
|
329
329
|
}), R.groupBy(R.propOr('#ROOT', 'parentId')))(allItems);
|
|
330
|
-
|
|
330
|
+
|
|
331
|
+
var isChildInSelectionScope = function isChildInSelectionScope(child, ancestor) {
|
|
332
|
+
if (!R.has((0, _utils.getHierarchicalId)(child), indexedFilteredItems)) {
|
|
333
|
+
return false;
|
|
334
|
+
}
|
|
335
|
+
if (selectionMode === 'single' || selectionMode === 'level') {
|
|
336
|
+
return false;
|
|
337
|
+
}
|
|
338
|
+
if (selectionMode === 'children') {
|
|
339
|
+
return child.parentId === (0, _utils.getHierarchicalId)(ancestor);
|
|
340
|
+
}
|
|
341
|
+
return true;
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
var _disableAccessor = (0, _utils.getEvolvedDisableAccessor)(_allGroupedItems, disableAccessor, isChildInSelectionScope);
|
|
345
|
+
|
|
331
346
|
var isDisabled = function isDisabled(item) {
|
|
332
347
|
return R.is(Function, disableAccessor) ? disableAccessor(item) : false;
|
|
333
348
|
};
|
|
@@ -83,7 +83,7 @@ var HierarchicalFilter = function HierarchicalFilter(props) {
|
|
|
83
83
|
var isRtl = (0, _utils2.getIsRtl)(theme);
|
|
84
84
|
var Chip = R.isNil(Tag) ? _.Tag : Tag;
|
|
85
85
|
var _allGroupedItems = R.groupBy(R.propOr('#ROOT', 'parentId'), allItems);
|
|
86
|
-
var _disableAccessor = (0, _utils.
|
|
86
|
+
var _disableAccessor = (0, _utils.getEvolvedDisableAccessor)(_allGroupedItems, disableAccessor, R.always(false));
|
|
87
87
|
var tagValue = getCounter(items, _disableAccessor, tagAccessor);
|
|
88
88
|
var isDisabled = function isDisabled(item) {
|
|
89
89
|
return R.is(Function, disableAccessor) ? disableAccessor(item) : false;
|
|
@@ -126,7 +126,7 @@ var Item = function Item(_ref) {
|
|
|
126
126
|
primaryTypographyProps: { noWrap: true, color: 'inherit' },
|
|
127
127
|
secondaryTypographyProps: { color: 'inherit' },
|
|
128
128
|
classes: { root: classes.listItem },
|
|
129
|
-
className: (0, _classnames2.default)((_cx = {}, _cx[classes.accessibilityItemHover] = accessibility, _cx[classes.listItemSelected] =
|
|
129
|
+
className: (0, _classnames2.default)((_cx = {}, _cx[classes.accessibilityItemHover] = accessibility, _cx[classes.listItemSelected] = isSelected && (!isDisabled || !isGreyed), _cx[classes.listItemHover] = !isDisabled || !isGreyed, _cx)),
|
|
130
130
|
onClick: isDisabled ? null : callbacks.onClick,
|
|
131
131
|
onMouseDown: isDisabled || isTooltipShown ? null : callbacks.onMouseDown,
|
|
132
132
|
onMouseUp: isDisabled || isTooltipShown ? null : callbacks.onMouseUp,
|
|
@@ -152,7 +152,7 @@ var Item = function Item(_ref) {
|
|
|
152
152
|
_SvgIcon2.default,
|
|
153
153
|
{
|
|
154
154
|
color: 'primary',
|
|
155
|
-
className: (0, _classnames2.default)(classes.labelIcon, (_cx4 = {}, _cx4[classes.disabledLabel] =
|
|
155
|
+
className: (0, _classnames2.default)(classes.labelIcon, (_cx4 = {}, _cx4[classes.disabledLabel] = isDisabled, _cx4))
|
|
156
156
|
},
|
|
157
157
|
_react2.default.createElement('path', { d: svgPath })
|
|
158
158
|
),
|
|
@@ -181,7 +181,7 @@ var Item = function Item(_ref) {
|
|
|
181
181
|
{
|
|
182
182
|
color: 'inherit',
|
|
183
183
|
variant: 'body2',
|
|
184
|
-
className: (0, _classnames2.default)(classes.label, (_cx5 = {}, _cx5[classes.disabledLabel] = isGreyed
|
|
184
|
+
className: (0, _classnames2.default)(classes.label, (_cx5 = {}, _cx5[classes.disabledLabel] = isGreyed, _cx5[classes.tooltipNotice] = !R.isEmpty(description), _cx5))
|
|
185
185
|
},
|
|
186
186
|
label
|
|
187
187
|
)
|
|
@@ -149,7 +149,7 @@ var VirtualizedTree = function VirtualizedTree(props) {
|
|
|
149
149
|
|
|
150
150
|
var multiSelect = function multiSelect(id) {
|
|
151
151
|
var item = R.prop(id, indexedItemsById);
|
|
152
|
-
var ids = R.pipe(getItemScope, R.filter(function (v) {
|
|
152
|
+
var ids = R.pipe(getItemScope, (0, _utils.getImposedItems)(selectIds, indexedItemsById), R.filter(function (v) {
|
|
153
153
|
return v.isSelected === item.isSelected;
|
|
154
154
|
}), function (items) {
|
|
155
155
|
return (0, _utils.getDuplicates)(items, indexedItemsById);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.
|
|
4
|
+
exports.getImposedItems = exports.getScopeGetters = exports.getEvolvedDisableAccessor = exports.getDeprecatedIds = exports.getDuplicates = exports.getDepth = exports.isItemSelected = exports.getDescendants = exports.getHierarchicalId = undefined;
|
|
5
5
|
|
|
6
6
|
var _ramda = require('ramda');
|
|
7
7
|
|
|
@@ -93,34 +93,37 @@ var getDeprecatedIds = exports.getDeprecatedIds = function getDeprecatedIds(ids,
|
|
|
93
93
|
return reccurse(ids);
|
|
94
94
|
};
|
|
95
95
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
96
|
+
// evolved disableAccessor with hierarchical context and selection mode
|
|
97
|
+
var getEvolvedDisableAccessor = exports.getEvolvedDisableAccessor = function getEvolvedDisableAccessor(groupedItems) {
|
|
98
|
+
var disableAccessor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : R.always(false);
|
|
99
|
+
var getIsChildInSelectionScope = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : R.always(true);
|
|
100
|
+
return (//combine selection mode + spotlight
|
|
101
|
+
function (item, selectedIds) {
|
|
102
|
+
var hierarchicalFinder = function hierarchicalFinder(validator) {
|
|
103
|
+
return function (parentId) {
|
|
104
|
+
return R.find(function (child) {
|
|
105
|
+
if (validator(child)) return true;
|
|
106
|
+
return !R.isNil(hierarchicalFinder(validator)(getHierarchicalId(child)));
|
|
107
|
+
}, R.propOr([], parentId, groupedItems));
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
// selected forcedItem isn't deselectable unless all selected descendants are in deselection scope
|
|
111
|
+
if (isItemSelected(selectedIds)(item) && R.propOr(false, 'isForced', item)) {
|
|
112
|
+
var outOfScopeSelectedDescendant = hierarchicalFinder(function (child) {
|
|
113
|
+
return isItemSelected(selectedIds)(child) && !getIsChildInSelectionScope(child, item);
|
|
114
|
+
})(getHierarchicalId(item));
|
|
115
|
+
return !R.isNil(outOfScopeSelectedDescendant);
|
|
116
|
+
}
|
|
117
|
+
// non selected invalid item is disabled unless some (valid) children are selected or selectable in scope
|
|
118
|
+
if (!isItemSelected(selectedIds)(item) && disableAccessor(item)) {
|
|
119
|
+
var validDescendant = hierarchicalFinder(function (child) {
|
|
120
|
+
return isItemSelected(selectedIds)(child) || getIsChildInSelectionScope(child, item) && !disableAccessor(child);
|
|
121
|
+
})(getHierarchicalId(item));
|
|
118
122
|
return R.isNil(validDescendant);
|
|
119
123
|
}
|
|
124
|
+
return false;
|
|
120
125
|
}
|
|
121
|
-
|
|
122
|
-
};
|
|
123
|
-
return accessor;
|
|
126
|
+
);
|
|
124
127
|
};
|
|
125
128
|
|
|
126
129
|
var getScopeGetters = exports.getScopeGetters = {
|
|
@@ -156,4 +159,17 @@ var getScopeGetters = exports.getScopeGetters = {
|
|
|
156
159
|
}, R.values(indexed));
|
|
157
160
|
};
|
|
158
161
|
}
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
var getImposedItems = exports.getImposedItems = function getImposedItems(selectIds, indexedItems) {
|
|
165
|
+
return function (selectedItems) {
|
|
166
|
+
return R.reduce(function (acc, item) {
|
|
167
|
+
var isSelected = isItemSelected(selectIds)(item);
|
|
168
|
+
if (!isSelected) {
|
|
169
|
+
var imposedItems = R.props(R.propOr([], 'imposedIds', item), indexedItems);
|
|
170
|
+
return R.concat(acc, R.append(item, imposedItems));
|
|
171
|
+
}
|
|
172
|
+
return R.append(item, acc);
|
|
173
|
+
}, [], selectedItems);
|
|
174
|
+
};
|
|
159
175
|
};
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @sis-cc/dotstatsuite-visions v10.
|
|
2
|
+
* @sis-cc/dotstatsuite-visions v10.8.0 - https://visions-qa.siscc.org/#o
|
|
3
3
|
* MIT Licensed
|
|
4
4
|
*/
|
|
5
5
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
@@ -6699,7 +6699,7 @@ function removeClassName(el
|
|
|
6699
6699
|
/* 121 */
|
|
6700
6700
|
/***/ (function(module) {
|
|
6701
6701
|
|
|
6702
|
-
module.exports = {"name":"@sis-cc/dotstatsuite-visions","version":"10.
|
|
6702
|
+
module.exports = {"name":"@sis-cc/dotstatsuite-visions","version":"10.8.0","description":"Library of visual components","author":"OECD","homepage":"https://visions-qa.siscc.org/#o","license":"MIT","repository":"https://gitlab.com/sis-cc/.stat-suite/dotstatsuite-visions","main":"lib/index.js","module":"es/index.js","engines":{"node":">=14"},"files":["css","es","lib","umd"],"scripts":{"build":"nwb build-react-component --copy-files --no-demo && node scripts/doc && nwb build-demo","build:dev":"nwb build-react-component --copy-files --no-demo","clean":"nwb clean-module && nwb clean-demo","prepublishOnly":"npm run build","start":"nwb serve-react-demo","test":"jest","test:watch":"jest --watch --no-cache","lint":"eslint src/ --color","precommit":"lint-staged"},"dependencies":{"@react-hook/size":"^2.1.1","classnames":"^2.2.6","date-fns":"^1.30.1","isemail":"^3.2.0","numeral":"^2.0.6","prop-types":"^15.7.2","ramda":"^0.27.0","react-beautiful-dnd":"^13.0.0","react-draggable":"^4.4.5","react-error-boundary":"^4.0.10","react-virtualized":"^9.21.2"},"peerDependencies":{"@material-ui/core":"^4","@material-ui/icons":"^4","@sis-cc/dotstatsuite-sdmxjs":"^8.x","react":"^18","react-dom":"^18"},"devDependencies":{"@babel/eslint-parser":"^7.5.4","@babel/plugin-syntax-dynamic-import":"^7.2.0","@cfaester/enzyme-adapter-react-18":"^0.7.0","@material-ui/core":"^4","@material-ui/icons":"^4","@sis-cc/dotstatsuite-sdmxjs":"*","@testing-library/jest-dom":"^5.16.5","@testing-library/react":"^14.0.0","babel-jest":"^24.8.0","babel-preset-react-app":"^9.0.0","dox":"^0.9.0","eslint":"^8.39.0","eslint-plugin-import":"^2.27.5","eslint-plugin-jsx-a11y":"^6.7.1","eslint-plugin-prettier":"^4.2.1","eslint-plugin-react":"^7.32.2","eslint-plugin-react-hooks":"^4.6.0","husky":"^2.7.0","identity-obj-proxy":"^3.0.0","jest":"^24.8.0","jss":"^10.10.0","jss-rtl":"^0.2.3","lint-staged":"^8.2.1","mutationobserver-shim":"^0.3.7","nwb":"0.23.0","prettier":"^2.8.8","pretty-quick":"^3.1.3","react":"^18","react-a11y":"^1.1.0","react-dom":"^18","react-helmet":"^5.2.1","react-scrollable-anchor":"^0.6.1","react-syntax-highlighter":"^10.2.1","sanitize-html":"2.7.0","webpack":"^5.68.0","webpack-cli":"^4.9.2","webpack-dev-server":"^4.7.4"},"jest":{"verbose":true,"coverageDirectory":"coverage","collectCoverageFrom":["src/**/*.{js,jsx,ts,tsx}","!src/ScopeList/*.{js,jsx,ts,tsx}","!src/**/*.d.ts"],"setupFilesAfterEnv":["<rootDir>/tests/setup.js"],"testMatch":["**/tests/**/*.{spec,test}.{js,jsx,ts,tsx}","!**/tests/ScopeList.test.js"],"testEnvironment":"jsdom","transform":{"^.+\\.(js|jsx|ts|tsx)$":"<rootDir>/node_modules/babel-jest"},"transformIgnorePatterns":["[/\\\\]node_modules[/\\\\].+\\.(js|jsx|ts|tsx)$","^.+\\.module\\.(css|sass|scss)$"],"modulePaths":[],"moduleNameMapper":{"^react-native$":"react-native-web","^.+\\.module\\.(css|sass|scss)$":"identity-obj-proxy","\\.(jpg|jpeg|png)$":"identity-obj-proxy"},"moduleFileExtensions":["web.js","js","web.ts","ts","web.tsx","tsx","json","web.jsx","jsx","node"]},"babel":{"presets":["react-app"],"plugins":["@babel/plugin-syntax-dynamic-import"]},"eslintConfig":{"env":{"browser":true,"jest":true,"node":true,"es6":true},"extends":["eslint:recommended","plugin:react/recommended","plugin:jsx-a11y/recommended"],"parser":"@babel/eslint-parser","parserOptions":{"babelOptions":{"presets":[["babel-preset-react-app",false],"babel-preset-react-app/test"]},"ecmaFeatures":{"experimentalObjectRestSpread":true,"jsx":true},"sourceType":"module"},"plugins":["prettier","react","import","react-hooks","jsx-a11y"],"rules":{"no-console":"warn","no-unused-vars":"error","react/display-name":"off","react-hooks/rules-of-hooks":"error","react-hooks/exhaustive-deps":"warn","no-use-before-define":"error"}},"browserslist":{"production":[">0.2%","not dead","not op_mini all"],"development":["last 1 chrome version","last 1 firefox version","last 1 safari version"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"src/**/*.{js,css}":["prettier --write","git add","yarn lint"]},"prettier":{"endOfLine":"lf","useTabs":false,"printWidth":100,"tabWidth":2,"singleQuote":true,"trailingComma":"all","bracketSameLine":false,"bracketSpacing":true,"parser":"babel","semi":true,"arrowParens":"avoid"}};
|
|
6703
6703
|
|
|
6704
6704
|
/***/ }),
|
|
6705
6705
|
/* 122 */
|
|
@@ -70623,7 +70623,7 @@ var VirtualizedTree_Item_Item = function Item(_ref) {
|
|
|
70623
70623
|
primaryTypographyProps: { noWrap: true, color: 'inherit' },
|
|
70624
70624
|
secondaryTypographyProps: { color: 'inherit' },
|
|
70625
70625
|
classes: { root: classes.listItem },
|
|
70626
|
-
className: classnames_default()((_cx = {}, _cx[classes.accessibilityItemHover] = accessibility, _cx[classes.listItemSelected] =
|
|
70626
|
+
className: classnames_default()((_cx = {}, _cx[classes.accessibilityItemHover] = accessibility, _cx[classes.listItemSelected] = isSelected && (!isDisabled || !isGreyed), _cx[classes.listItemHover] = !isDisabled || !isGreyed, _cx)),
|
|
70627
70627
|
onClick: isDisabled ? null : callbacks.onClick,
|
|
70628
70628
|
onMouseDown: isDisabled || isTooltipShown ? null : callbacks.onMouseDown,
|
|
70629
70629
|
onMouseUp: isDisabled || isTooltipShown ? null : callbacks.onMouseUp,
|
|
@@ -70649,7 +70649,7 @@ var VirtualizedTree_Item_Item = function Item(_ref) {
|
|
|
70649
70649
|
SvgIcon["a" /* default */],
|
|
70650
70650
|
{
|
|
70651
70651
|
color: 'primary',
|
|
70652
|
-
className: classnames_default()(classes.labelIcon, (_cx4 = {}, _cx4[classes.disabledLabel] =
|
|
70652
|
+
className: classnames_default()(classes.labelIcon, (_cx4 = {}, _cx4[classes.disabledLabel] = isDisabled, _cx4))
|
|
70653
70653
|
},
|
|
70654
70654
|
react_default.a.createElement('path', { d: svgPath })
|
|
70655
70655
|
),
|
|
@@ -70678,7 +70678,7 @@ var VirtualizedTree_Item_Item = function Item(_ref) {
|
|
|
70678
70678
|
{
|
|
70679
70679
|
color: 'inherit',
|
|
70680
70680
|
variant: 'body2',
|
|
70681
|
-
className: classnames_default()(classes.label, (_cx5 = {}, _cx5[classes.disabledLabel] = isGreyed
|
|
70681
|
+
className: classnames_default()(classes.label, (_cx5 = {}, _cx5[classes.disabledLabel] = isGreyed, _cx5[classes.tooltipNotice] = !es_isEmpty(description), _cx5))
|
|
70682
70682
|
},
|
|
70683
70683
|
label
|
|
70684
70684
|
)
|
|
@@ -70965,34 +70965,37 @@ var utils_getDeprecatedIds = function getDeprecatedIds(ids, items, selectedIds)
|
|
|
70965
70965
|
return reccurse(ids);
|
|
70966
70966
|
};
|
|
70967
70967
|
|
|
70968
|
-
|
|
70969
|
-
|
|
70970
|
-
|
|
70971
|
-
|
|
70972
|
-
|
|
70973
|
-
|
|
70974
|
-
|
|
70975
|
-
|
|
70976
|
-
|
|
70977
|
-
|
|
70978
|
-
|
|
70979
|
-
|
|
70980
|
-
|
|
70981
|
-
|
|
70982
|
-
|
|
70983
|
-
|
|
70984
|
-
|
|
70985
|
-
|
|
70986
|
-
|
|
70987
|
-
|
|
70988
|
-
|
|
70989
|
-
|
|
70968
|
+
// evolved disableAccessor with hierarchical context and selection mode
|
|
70969
|
+
var utils_getEvolvedDisableAccessor = function getEvolvedDisableAccessor(groupedItems) {
|
|
70970
|
+
var disableAccessor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : es_always(false);
|
|
70971
|
+
var getIsChildInSelectionScope = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : es_always(true);
|
|
70972
|
+
return (//combine selection mode + spotlight
|
|
70973
|
+
function (item, selectedIds) {
|
|
70974
|
+
var hierarchicalFinder = function hierarchicalFinder(validator) {
|
|
70975
|
+
return function (parentId) {
|
|
70976
|
+
return es_find(function (child) {
|
|
70977
|
+
if (validator(child)) return true;
|
|
70978
|
+
return !es_isNil(hierarchicalFinder(validator)(utils_getHierarchicalId(child)));
|
|
70979
|
+
}, es_propOr([], parentId, groupedItems));
|
|
70980
|
+
};
|
|
70981
|
+
};
|
|
70982
|
+
// selected forcedItem isn't deselectable unless all selected descendants are in deselection scope
|
|
70983
|
+
if (utils_isItemSelected(selectedIds)(item) && es_propOr(false, 'isForced', item)) {
|
|
70984
|
+
var outOfScopeSelectedDescendant = hierarchicalFinder(function (child) {
|
|
70985
|
+
return utils_isItemSelected(selectedIds)(child) && !getIsChildInSelectionScope(child, item);
|
|
70986
|
+
})(utils_getHierarchicalId(item));
|
|
70987
|
+
return !es_isNil(outOfScopeSelectedDescendant);
|
|
70988
|
+
}
|
|
70989
|
+
// non selected invalid item is disabled unless some (valid) children are selected or selectable in scope
|
|
70990
|
+
if (!utils_isItemSelected(selectedIds)(item) && disableAccessor(item)) {
|
|
70991
|
+
var validDescendant = hierarchicalFinder(function (child) {
|
|
70992
|
+
return utils_isItemSelected(selectedIds)(child) || getIsChildInSelectionScope(child, item) && !disableAccessor(child);
|
|
70993
|
+
})(utils_getHierarchicalId(item));
|
|
70990
70994
|
return es_isNil(validDescendant);
|
|
70991
70995
|
}
|
|
70996
|
+
return false;
|
|
70992
70997
|
}
|
|
70993
|
-
|
|
70994
|
-
};
|
|
70995
|
-
return accessor;
|
|
70998
|
+
);
|
|
70996
70999
|
};
|
|
70997
71000
|
|
|
70998
71001
|
var getScopeGetters = {
|
|
@@ -71029,6 +71032,19 @@ var getScopeGetters = {
|
|
|
71029
71032
|
};
|
|
71030
71033
|
}
|
|
71031
71034
|
};
|
|
71035
|
+
|
|
71036
|
+
var utils_getImposedItems = function getImposedItems(selectIds, indexedItems) {
|
|
71037
|
+
return function (selectedItems) {
|
|
71038
|
+
return es_reduce(function (acc, item) {
|
|
71039
|
+
var isSelected = utils_isItemSelected(selectIds)(item);
|
|
71040
|
+
if (!isSelected) {
|
|
71041
|
+
var imposedItems = es_props(es_propOr([], 'imposedIds', item), indexedItems);
|
|
71042
|
+
return es_concat(acc, es_append(item, imposedItems));
|
|
71043
|
+
}
|
|
71044
|
+
return es_append(item, acc);
|
|
71045
|
+
}, [], selectedItems);
|
|
71046
|
+
};
|
|
71047
|
+
};
|
|
71032
71048
|
// CONCATENATED MODULE: ./src/VirtualizedTree/VirtualizedTree.js
|
|
71033
71049
|
var VirtualizedTree_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; };
|
|
71034
71050
|
|
|
@@ -71142,7 +71158,7 @@ var VirtualizedTree_VirtualizedTree = function VirtualizedTree(props) {
|
|
|
71142
71158
|
|
|
71143
71159
|
var multiSelect = function multiSelect(id) {
|
|
71144
71160
|
var item = es_prop(id, indexedItemsById);
|
|
71145
|
-
var ids = pipe(getItemScope, es_filter(function (v) {
|
|
71161
|
+
var ids = pipe(getItemScope, utils_getImposedItems(selectIds, indexedItemsById), es_filter(function (v) {
|
|
71146
71162
|
return v.isSelected === item.isSelected;
|
|
71147
71163
|
}), function (items) {
|
|
71148
71164
|
return utils_getDuplicates(items, indexedItemsById);
|
|
@@ -72041,7 +72057,7 @@ var AdvancedFilterDialog_AdvancedFilterDialog = function AdvancedFilterDialog(pr
|
|
|
72041
72057
|
isSelected: es_has(item.id, selection) ? !item.isSelected : !!item.isSelected
|
|
72042
72058
|
});
|
|
72043
72059
|
}, items);
|
|
72044
|
-
var
|
|
72060
|
+
var indexedFilteredItems = es_indexBy(utils_getHierarchicalId, selectionItems);
|
|
72045
72061
|
|
|
72046
72062
|
var selectionOptions = [{
|
|
72047
72063
|
value: 'single',
|
|
@@ -72070,7 +72086,22 @@ var AdvancedFilterDialog_AdvancedFilterDialog = function AdvancedFilterDialog(pr
|
|
|
72070
72086
|
isSelected: es_has(item.id, selection) ? !item.isSelected : !!item.isSelected
|
|
72071
72087
|
});
|
|
72072
72088
|
}), es_groupBy(es_propOr('#ROOT', 'parentId')))(allItems);
|
|
72073
|
-
|
|
72089
|
+
|
|
72090
|
+
var isChildInSelectionScope = function isChildInSelectionScope(child, ancestor) {
|
|
72091
|
+
if (!es_has(utils_getHierarchicalId(child), indexedFilteredItems)) {
|
|
72092
|
+
return false;
|
|
72093
|
+
}
|
|
72094
|
+
if (selectionMode === 'single' || selectionMode === 'level') {
|
|
72095
|
+
return false;
|
|
72096
|
+
}
|
|
72097
|
+
if (selectionMode === 'children') {
|
|
72098
|
+
return child.parentId === utils_getHierarchicalId(ancestor);
|
|
72099
|
+
}
|
|
72100
|
+
return true;
|
|
72101
|
+
};
|
|
72102
|
+
|
|
72103
|
+
var _disableAccessor = utils_getEvolvedDisableAccessor(_allGroupedItems, disableAccessor, isChildInSelectionScope);
|
|
72104
|
+
|
|
72074
72105
|
var isDisabled = function isDisabled(item) {
|
|
72075
72106
|
return es_is(Function, disableAccessor) ? disableAccessor(item) : false;
|
|
72076
72107
|
};
|
|
@@ -72377,7 +72408,7 @@ var HierarchicalFilter_HierarchicalFilter = function HierarchicalFilter(props) {
|
|
|
72377
72408
|
var isRtl = utils_getIsRtl(theme);
|
|
72378
72409
|
var Chip = es_isNil(Tag) ? src_Tag_Tag : Tag;
|
|
72379
72410
|
var _allGroupedItems = es_groupBy(es_propOr('#ROOT', 'parentId'), allItems);
|
|
72380
|
-
var _disableAccessor =
|
|
72411
|
+
var _disableAccessor = utils_getEvolvedDisableAccessor(_allGroupedItems, disableAccessor, es_always(false));
|
|
72381
72412
|
var tagValue = HierarchicalFilter_getCounter(items, _disableAccessor, tagAccessor);
|
|
72382
72413
|
var isDisabled = function isDisabled(item) {
|
|
72383
72414
|
return es_is(Function, disableAccessor) ? disableAccessor(item) : false;
|