@sis-cc/dotstatsuite-visions 10.7.0 → 10.9.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/TableHtml5/TableHtml5.js +11 -6
- package/es/TableHtml5/header.js +3 -3
- package/es/TableHtml5/section.js +9 -7
- 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/TableHtml5/TableHtml5.js +11 -6
- package/lib/TableHtml5/header.js +3 -3
- package/lib/TableHtml5/section.js +9 -7
- 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 +90 -52
- 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;
|
|
@@ -38,12 +38,13 @@ var useStyles = makeStyles(function (theme) {
|
|
|
38
38
|
var mapIndexed = R.addIndex(R.map);
|
|
39
39
|
|
|
40
40
|
export var getEnhancedValuesHeaderData = function getEnhancedValuesHeaderData(data) {
|
|
41
|
-
var colLength = R.pipe(R.
|
|
41
|
+
var colLength = R.pipe(R.last, R.propOr([], 'data'), R.length)(data);
|
|
42
42
|
return R.pipe(R.pluck('data'),
|
|
43
43
|
// mix merge and transpose for performance
|
|
44
44
|
R.reduce(function (acc, cells) {
|
|
45
|
-
R.addIndex(R.forEach)(function (
|
|
46
|
-
var
|
|
45
|
+
R.addIndex(R.forEach)(function (_, rowIndex) {
|
|
46
|
+
var cell = R.nth(rowIndex, cells) || {};
|
|
47
|
+
var cellId = R.has('values', cell) ? R.pipe(R.prop('values'), R.pluck('id'), R.join(','))(cell) : R.pathOr('missing' + rowIndex, ['value', 'id'], cell);
|
|
47
48
|
var topCell = rowIndex > 0 ? R.pipe(R.nth(rowIndex - 1), R.last)(acc) : null;
|
|
48
49
|
var cellKey = R.isNil(topCell) ? cellId : topCell.key + '-' + cellId;
|
|
49
50
|
|
|
@@ -51,9 +52,13 @@ export var getEnhancedValuesHeaderData = function getEnhancedValuesHeaderData(da
|
|
|
51
52
|
if (R.prop('key', leftCell) === cellKey && rowIndex !== colLength - 1) {
|
|
52
53
|
acc = R.over(R.lensIndex(rowIndex), R.over(R.lensIndex(-1), R.evolve({ spanCount: R.add(1) })))(acc);
|
|
53
54
|
} else {
|
|
54
|
-
acc = R.over(R.lensIndex(rowIndex), R.append(_extends({}, R.pick(['value', 'values'], cell), {
|
|
55
|
+
acc = R.over(R.lensIndex(rowIndex), R.append(_extends({}, R.pick(['value', 'values'], cell), {
|
|
56
|
+
key: cellKey,
|
|
57
|
+
spanCount: 1,
|
|
58
|
+
isEmpty: R.isEmpty(cell)
|
|
59
|
+
})))(acc);
|
|
55
60
|
}
|
|
56
|
-
})(
|
|
61
|
+
})(acc);
|
|
57
62
|
return acc;
|
|
58
63
|
}, R.times(R.always([]), colLength)))(data);
|
|
59
64
|
};
|
|
@@ -118,7 +123,7 @@ var TableHtml5 = function TableHtml5(_ref) {
|
|
|
118
123
|
};
|
|
119
124
|
}, []);
|
|
120
125
|
|
|
121
|
-
var xLayoutData = R.pathOr([], [0, 1,
|
|
126
|
+
var xLayoutData = R.pathOr([], [0, 1, -1, 'data'], sectionsData);
|
|
122
127
|
var xLayoutDataLength = R.length(xLayoutData);
|
|
123
128
|
|
|
124
129
|
var _useMemo = useMemo(function () {
|
package/es/TableHtml5/header.js
CHANGED
|
@@ -93,7 +93,7 @@ var Header = function Header(_ref) {
|
|
|
93
93
|
React.createElement(
|
|
94
94
|
Typography,
|
|
95
95
|
{ variant: 'body1', className: classes.cellLabelHeader },
|
|
96
|
-
R.pipe(R.path([
|
|
96
|
+
R.pipe(R.path([-1, 'data', index, 'dimension']), labelAccessor)(headerData),
|
|
97
97
|
React.createElement(Flags, {
|
|
98
98
|
HTMLRenderer: HTMLRenderer,
|
|
99
99
|
flags: flags,
|
|
@@ -106,7 +106,7 @@ var Header = function Header(_ref) {
|
|
|
106
106
|
mapIndexed(function (headerItem, idx) {
|
|
107
107
|
var _cx;
|
|
108
108
|
|
|
109
|
-
var value = getValue(labelAccessor)(headerItem);
|
|
109
|
+
var value = headerItem.isEmpty ? { label: '' } : getValue(labelAccessor)(headerItem);
|
|
110
110
|
var flags = R.propOr([], 'flags', value);
|
|
111
111
|
var hierarchySpace = R.pipe(R.propOr([], 'parents'), R.length, R.times(function () {
|
|
112
112
|
return '·';
|
|
@@ -154,7 +154,7 @@ var Header = function Header(_ref) {
|
|
|
154
154
|
);
|
|
155
155
|
}, R.nth(index, valuesHeaderData))
|
|
156
156
|
);
|
|
157
|
-
}, R.compose(R.length, R.pathOr([], [
|
|
157
|
+
}, R.compose(R.length, R.pathOr([], [-1, 'data']))(headerData));
|
|
158
158
|
};
|
|
159
159
|
|
|
160
160
|
Header.propTypes = process.env.NODE_ENV !== "production" ? {
|
package/es/TableHtml5/section.js
CHANGED
|
@@ -105,7 +105,7 @@ var Section = function Section(_ref) {
|
|
|
105
105
|
HTMLRenderer: HTMLRenderer,
|
|
106
106
|
labelAccessor: labelAccessor
|
|
107
107
|
}),
|
|
108
|
-
|
|
108
|
+
mapIndexed(function (sectionbody, rowIndex) {
|
|
109
109
|
var _cx2;
|
|
110
110
|
|
|
111
111
|
var rowId = sectionbody.key + '_' + sectionIndex + '_' + rowIndex;
|
|
@@ -115,11 +115,12 @@ var Section = function Section(_ref) {
|
|
|
115
115
|
return React.createElement(
|
|
116
116
|
TableRow,
|
|
117
117
|
{ key: rowId },
|
|
118
|
-
|
|
118
|
+
R.times(function (index) {
|
|
119
119
|
var _cx;
|
|
120
120
|
|
|
121
|
-
var
|
|
122
|
-
var
|
|
121
|
+
var cell = R.path(['data', index], sectionbody);
|
|
122
|
+
var value = R.isNil(cell) ? { label: '' } : getValue(labelAccessor)(cell);
|
|
123
|
+
var flags = R.propOr([], 'flags', value);
|
|
123
124
|
var id = rowIndex + '_' + rowId + '_' + index;
|
|
124
125
|
|
|
125
126
|
// special space is used for hierarchy U+2007    
|
|
@@ -133,7 +134,7 @@ var Section = function Section(_ref) {
|
|
|
133
134
|
TableCell,
|
|
134
135
|
{
|
|
135
136
|
key: id,
|
|
136
|
-
className: cx(classes.rowTitle, classes.stickyHeader, (_cx = {}, _cx[classes.highlight] = R.prop(rowId)(activeCellIds), _cx[classes.timePeriodCells] = R.is(Function, isNoWrap) && isNoWrap(R.
|
|
137
|
+
className: cx(classes.rowTitle, classes.stickyHeader, (_cx = {}, _cx[classes.highlight] = R.prop(rowId)(activeCellIds), _cx[classes.timePeriodCells] = R.is(Function, isNoWrap) && isNoWrap(R.propOr({}, 'dimension', cell)), _cx)),
|
|
137
138
|
id: id,
|
|
138
139
|
headers: 'subHeader_' + index + ' ' + currentSection,
|
|
139
140
|
component: 'th',
|
|
@@ -159,7 +160,7 @@ var Section = function Section(_ref) {
|
|
|
159
160
|
)
|
|
160
161
|
)
|
|
161
162
|
);
|
|
162
|
-
}, R.prop('data', sectionbody)),
|
|
163
|
+
}, xLayoutDataLength /*R.prop('data', sectionbody)*/),
|
|
163
164
|
React.createElement(
|
|
164
165
|
TableCell,
|
|
165
166
|
{
|
|
@@ -185,8 +186,9 @@ var Section = function Section(_ref) {
|
|
|
185
186
|
|
|
186
187
|
var intersectionCellId = rowId + '/' + columnIndex;
|
|
187
188
|
var isActive = R.pipe(R.propOr({}, 'intersectionCellId'), R.equals(intersectionCellId))(activeCellIds);
|
|
189
|
+
var missingValLabel = item.isEmpty || sectionbody.isEmpty ? '' : '..';
|
|
188
190
|
return React.createElement(Cell, _extends({}, R.pipe(R.pathOr({ value: null }, [item.key, currentSection, sectionbody.key, 0]), R.over(R.lensProp('value'), function (val) {
|
|
189
|
-
return R.isNil(val) ?
|
|
191
|
+
return R.isNil(val) ? missingValLabel : cellValueAccessor(val);
|
|
190
192
|
}))(cells), {
|
|
191
193
|
key: intersectionCellId,
|
|
192
194
|
headers: rowIds + ' ' + columnIds + ' ' + currentSection,
|
|
@@ -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;
|
|
@@ -72,12 +72,13 @@ var useStyles = (0, _styles.makeStyles)(function (theme) {
|
|
|
72
72
|
var mapIndexed = R.addIndex(R.map);
|
|
73
73
|
|
|
74
74
|
var getEnhancedValuesHeaderData = exports.getEnhancedValuesHeaderData = function getEnhancedValuesHeaderData(data) {
|
|
75
|
-
var colLength = R.pipe(R.
|
|
75
|
+
var colLength = R.pipe(R.last, R.propOr([], 'data'), R.length)(data);
|
|
76
76
|
return R.pipe(R.pluck('data'),
|
|
77
77
|
// mix merge and transpose for performance
|
|
78
78
|
R.reduce(function (acc, cells) {
|
|
79
|
-
R.addIndex(R.forEach)(function (
|
|
80
|
-
var
|
|
79
|
+
R.addIndex(R.forEach)(function (_, rowIndex) {
|
|
80
|
+
var cell = R.nth(rowIndex, cells) || {};
|
|
81
|
+
var cellId = R.has('values', cell) ? R.pipe(R.prop('values'), R.pluck('id'), R.join(','))(cell) : R.pathOr('missing' + rowIndex, ['value', 'id'], cell);
|
|
81
82
|
var topCell = rowIndex > 0 ? R.pipe(R.nth(rowIndex - 1), R.last)(acc) : null;
|
|
82
83
|
var cellKey = R.isNil(topCell) ? cellId : topCell.key + '-' + cellId;
|
|
83
84
|
|
|
@@ -85,9 +86,13 @@ var getEnhancedValuesHeaderData = exports.getEnhancedValuesHeaderData = function
|
|
|
85
86
|
if (R.prop('key', leftCell) === cellKey && rowIndex !== colLength - 1) {
|
|
86
87
|
acc = R.over(R.lensIndex(rowIndex), R.over(R.lensIndex(-1), R.evolve({ spanCount: R.add(1) })))(acc);
|
|
87
88
|
} else {
|
|
88
|
-
acc = R.over(R.lensIndex(rowIndex), R.append(_extends({}, R.pick(['value', 'values'], cell), {
|
|
89
|
+
acc = R.over(R.lensIndex(rowIndex), R.append(_extends({}, R.pick(['value', 'values'], cell), {
|
|
90
|
+
key: cellKey,
|
|
91
|
+
spanCount: 1,
|
|
92
|
+
isEmpty: R.isEmpty(cell)
|
|
93
|
+
})))(acc);
|
|
89
94
|
}
|
|
90
|
-
})(
|
|
95
|
+
})(acc);
|
|
91
96
|
return acc;
|
|
92
97
|
}, R.times(R.always([]), colLength)))(data);
|
|
93
98
|
};
|
|
@@ -152,7 +157,7 @@ var TableHtml5 = function TableHtml5(_ref) {
|
|
|
152
157
|
};
|
|
153
158
|
}, []);
|
|
154
159
|
|
|
155
|
-
var xLayoutData = R.pathOr([], [0, 1,
|
|
160
|
+
var xLayoutData = R.pathOr([], [0, 1, -1, 'data'], sectionsData);
|
|
156
161
|
var xLayoutDataLength = R.length(xLayoutData);
|
|
157
162
|
|
|
158
163
|
var _useMemo = (0, _react.useMemo)(function () {
|
package/lib/TableHtml5/header.js
CHANGED
|
@@ -127,7 +127,7 @@ var Header = function Header(_ref) {
|
|
|
127
127
|
_react2.default.createElement(
|
|
128
128
|
_Typography2.default,
|
|
129
129
|
{ variant: 'body1', className: classes.cellLabelHeader },
|
|
130
|
-
R.pipe(R.path([
|
|
130
|
+
R.pipe(R.path([-1, 'data', index, 'dimension']), labelAccessor)(headerData),
|
|
131
131
|
_react2.default.createElement(_flags2.default, {
|
|
132
132
|
HTMLRenderer: HTMLRenderer,
|
|
133
133
|
flags: flags,
|
|
@@ -140,7 +140,7 @@ var Header = function Header(_ref) {
|
|
|
140
140
|
mapIndexed(function (headerItem, idx) {
|
|
141
141
|
var _cx;
|
|
142
142
|
|
|
143
|
-
var value = (0, _utils2.getValue)(labelAccessor)(headerItem);
|
|
143
|
+
var value = headerItem.isEmpty ? { label: '' } : (0, _utils2.getValue)(labelAccessor)(headerItem);
|
|
144
144
|
var flags = R.propOr([], 'flags', value);
|
|
145
145
|
var hierarchySpace = R.pipe(R.propOr([], 'parents'), R.length, R.times(function () {
|
|
146
146
|
return '·';
|
|
@@ -188,7 +188,7 @@ var Header = function Header(_ref) {
|
|
|
188
188
|
);
|
|
189
189
|
}, R.nth(index, valuesHeaderData))
|
|
190
190
|
);
|
|
191
|
-
}, R.compose(R.length, R.pathOr([], [
|
|
191
|
+
}, R.compose(R.length, R.pathOr([], [-1, 'data']))(headerData));
|
|
192
192
|
};
|
|
193
193
|
|
|
194
194
|
Header.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
@@ -147,7 +147,7 @@ var Section = function Section(_ref) {
|
|
|
147
147
|
HTMLRenderer: HTMLRenderer,
|
|
148
148
|
labelAccessor: labelAccessor
|
|
149
149
|
}),
|
|
150
|
-
|
|
150
|
+
mapIndexed(function (sectionbody, rowIndex) {
|
|
151
151
|
var _cx2;
|
|
152
152
|
|
|
153
153
|
var rowId = sectionbody.key + '_' + sectionIndex + '_' + rowIndex;
|
|
@@ -157,11 +157,12 @@ var Section = function Section(_ref) {
|
|
|
157
157
|
return _react2.default.createElement(
|
|
158
158
|
_TableRow2.default,
|
|
159
159
|
{ key: rowId },
|
|
160
|
-
|
|
160
|
+
R.times(function (index) {
|
|
161
161
|
var _cx;
|
|
162
162
|
|
|
163
|
-
var
|
|
164
|
-
var
|
|
163
|
+
var cell = R.path(['data', index], sectionbody);
|
|
164
|
+
var value = R.isNil(cell) ? { label: '' } : (0, _utils2.getValue)(labelAccessor)(cell);
|
|
165
|
+
var flags = R.propOr([], 'flags', value);
|
|
165
166
|
var id = rowIndex + '_' + rowId + '_' + index;
|
|
166
167
|
|
|
167
168
|
// special space is used for hierarchy U+2007    
|
|
@@ -175,7 +176,7 @@ var Section = function Section(_ref) {
|
|
|
175
176
|
_TableCell2.default,
|
|
176
177
|
{
|
|
177
178
|
key: id,
|
|
178
|
-
className: (0, _classnames2.default)(classes.rowTitle, classes.stickyHeader, (_cx = {}, _cx[classes.highlight] = R.prop(rowId)(activeCellIds), _cx[classes.timePeriodCells] = R.is(Function, isNoWrap) && isNoWrap(R.
|
|
179
|
+
className: (0, _classnames2.default)(classes.rowTitle, classes.stickyHeader, (_cx = {}, _cx[classes.highlight] = R.prop(rowId)(activeCellIds), _cx[classes.timePeriodCells] = R.is(Function, isNoWrap) && isNoWrap(R.propOr({}, 'dimension', cell)), _cx)),
|
|
179
180
|
id: id,
|
|
180
181
|
headers: 'subHeader_' + index + ' ' + currentSection,
|
|
181
182
|
component: 'th',
|
|
@@ -201,7 +202,7 @@ var Section = function Section(_ref) {
|
|
|
201
202
|
)
|
|
202
203
|
)
|
|
203
204
|
);
|
|
204
|
-
}, R.prop('data', sectionbody)),
|
|
205
|
+
}, xLayoutDataLength /*R.prop('data', sectionbody)*/),
|
|
205
206
|
_react2.default.createElement(
|
|
206
207
|
_TableCell2.default,
|
|
207
208
|
{
|
|
@@ -227,8 +228,9 @@ var Section = function Section(_ref) {
|
|
|
227
228
|
|
|
228
229
|
var intersectionCellId = rowId + '/' + columnIndex;
|
|
229
230
|
var isActive = R.pipe(R.propOr({}, 'intersectionCellId'), R.equals(intersectionCellId))(activeCellIds);
|
|
231
|
+
var missingValLabel = item.isEmpty || sectionbody.isEmpty ? '' : '..';
|
|
230
232
|
return _react2.default.createElement(_cell2.default, _extends({}, R.pipe(R.pathOr({ value: null }, [item.key, currentSection, sectionbody.key, 0]), R.over(R.lensProp('value'), function (val) {
|
|
231
|
-
return R.isNil(val) ?
|
|
233
|
+
return R.isNil(val) ? missingValLabel : cellValueAccessor(val);
|
|
232
234
|
}))(cells), {
|
|
233
235
|
key: intersectionCellId,
|
|
234
236
|
headers: rowIds + ' ' + columnIds + ' ' + currentSection,
|
|
@@ -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
|
};
|