@sis-cc/dotstatsuite-visions 7.20.3 → 7.20.5
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/TableHtml5/flags.js +5 -2
- package/es/TableHtml5/header.js +7 -7
- package/es/TableHtml5/sectionHeader.js +2 -2
- 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/TableHtml5/flags.js +5 -2
- package/lib/TableHtml5/header.js +7 -7
- package/lib/TableHtml5/sectionHeader.js +2 -2
- 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
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
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; };
|
|
2
2
|
|
|
3
|
-
import React, {
|
|
3
|
+
import React, { useRef, useEffect, useState, useMemo } from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import * as R from 'ramda';
|
|
6
6
|
import AutoSizer from 'react-virtualized/dist/commonjs/AutoSizer';
|
|
7
7
|
import VirtualizedList from 'react-virtualized/dist/commonjs/List';
|
|
8
|
-
import Button from '@material-ui/core/Button';
|
|
9
8
|
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
|
|
10
9
|
import ExpandLessIcon from '@material-ui/icons/ExpandLess';
|
|
11
10
|
import List from '@material-ui/core/List';
|
|
@@ -62,7 +61,9 @@ var VirtualizedTree = function VirtualizedTree(props) {
|
|
|
62
61
|
items = props.items,
|
|
63
62
|
labelRenderer = props.labelRenderer,
|
|
64
63
|
labels = props.labels,
|
|
65
|
-
|
|
64
|
+
expandedIds = props.expandedIds,
|
|
65
|
+
expand = props.expand,
|
|
66
|
+
collapse = props.collapse,
|
|
66
67
|
_props$maxTreeHeight = props.maxTreeHeight,
|
|
67
68
|
maxTreeHeight = _props$maxTreeHeight === undefined ? 250 : _props$maxTreeHeight,
|
|
68
69
|
_props$getItemScope = props.getItemScope,
|
|
@@ -70,25 +71,21 @@ var VirtualizedTree = function VirtualizedTree(props) {
|
|
|
70
71
|
|
|
71
72
|
var theme = useTheme();
|
|
72
73
|
|
|
73
|
-
var _useState = useState(
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
var _useState = useState(undefined),
|
|
75
|
+
scrollTop = _useState[0],
|
|
76
|
+
setScrollTop = _useState[1];
|
|
76
77
|
|
|
77
|
-
var _useState2 = useState(
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
var _useState2 = useState([]),
|
|
79
|
+
shiftIndexes = _useState2[0],
|
|
80
|
+
setShiftIndexes = _useState2[1];
|
|
80
81
|
|
|
81
|
-
var _useState3 = useState(
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
var _useState3 = useState({}),
|
|
83
|
+
selectIds = _useState3[0],
|
|
84
|
+
setSelectIds = _useState3[1];
|
|
84
85
|
|
|
85
|
-
var _useState4 = useState(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
var _useState5 = useState(false),
|
|
90
|
-
isMouseDown = _useState5[0],
|
|
91
|
-
setIsMouseDown = _useState5[1];
|
|
86
|
+
var _useState4 = useState(false),
|
|
87
|
+
isMouseDown = _useState4[0],
|
|
88
|
+
setIsMouseDown = _useState4[1];
|
|
92
89
|
|
|
93
90
|
var _useMemo = useMemo(function () {
|
|
94
91
|
var indexedItemsById = R.indexBy(getHierarchicalId, items);
|
|
@@ -156,21 +153,26 @@ var VirtualizedTree = function VirtualizedTree(props) {
|
|
|
156
153
|
apply();
|
|
157
154
|
} : null,
|
|
158
155
|
onMouseDown: function onMouseDown(e) {
|
|
159
|
-
if (e.ctrlKey) {
|
|
160
|
-
|
|
161
|
-
} else if (e.shiftKey) {
|
|
162
|
-
shiftSelect(index);
|
|
163
|
-
} else {
|
|
164
|
-
multiSelect(id);
|
|
165
|
-
setIsMouseDown(true);
|
|
156
|
+
if (e.ctrlKey || e.shiftKey) {
|
|
157
|
+
return;
|
|
166
158
|
}
|
|
159
|
+
multiSelect(id);
|
|
160
|
+
setIsMouseDown(true);
|
|
167
161
|
},
|
|
168
162
|
onMouseEnter: isMouseDown ? function (e) {
|
|
169
163
|
if (e.ctrlKey || e.shiftKey) {
|
|
170
164
|
return;
|
|
171
165
|
}
|
|
172
166
|
multiSelect(id);
|
|
173
|
-
} : null
|
|
167
|
+
} : null,
|
|
168
|
+
onClick: function onClick(e) {
|
|
169
|
+
e.preventDefault();
|
|
170
|
+
if (e.ctrlKey) {
|
|
171
|
+
multiSelect(id);
|
|
172
|
+
} else if (e.shiftKey) {
|
|
173
|
+
shiftSelect(index);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
174
176
|
};
|
|
175
177
|
};
|
|
176
178
|
var onKeyUp = function onKeyUp(e) {
|
|
@@ -222,99 +224,68 @@ var VirtualizedTree = function VirtualizedTree(props) {
|
|
|
222
224
|
}, [scrollTop]);
|
|
223
225
|
var maxHeight = R.pipe(R.length, R.multiply(rowHeight), R.ifElse(R.gt(maxTreeHeight), R.add(10), R.always(maxTreeHeight)))(list);
|
|
224
226
|
|
|
225
|
-
var expand = function expand(index) {
|
|
226
|
-
var parentId = R.nth(index, list);
|
|
227
|
-
setExpandedIds(R.assoc(parentId, parentId, expandedIds));
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
var collapse = function collapse(index) {
|
|
231
|
-
var parentId = R.nth(index, list);
|
|
232
|
-
setExpandedIds(R.dissoc(parentId, expandedIds));
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
var expandAll = function expandAll() {
|
|
236
|
-
setExpandedIds(indexedItemsById);
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
var collapseAll = function collapseAll() {
|
|
240
|
-
setExpandedIds({});
|
|
241
|
-
};
|
|
242
|
-
|
|
243
227
|
if (R.isEmpty(list)) {
|
|
244
228
|
return null;
|
|
245
229
|
}
|
|
246
230
|
var isRtl = getIsRtl(theme);
|
|
247
|
-
|
|
248
231
|
return React.createElement(
|
|
249
|
-
|
|
250
|
-
|
|
232
|
+
List,
|
|
233
|
+
{
|
|
234
|
+
disablePadding: true,
|
|
235
|
+
style: { height: maxHeight + 2 },
|
|
236
|
+
onKeyUp: onKeyUp,
|
|
237
|
+
onMouseLeave: isMouseDown ? apply : null,
|
|
238
|
+
ref: ref
|
|
239
|
+
},
|
|
251
240
|
React.createElement(
|
|
252
|
-
|
|
253
|
-
{ disablePadding: true, style: { height: maxHeight + 2 }, onKeyUp: onKeyUp, ref: ref },
|
|
254
|
-
React.createElement(
|
|
255
|
-
AutoSizer,
|
|
256
|
-
null,
|
|
257
|
-
function (_ref) {
|
|
258
|
-
var height = _ref.height,
|
|
259
|
-
width = _ref.width;
|
|
260
|
-
return React.createElement(VirtualizedList, {
|
|
261
|
-
overscan: 10,
|
|
262
|
-
tabIndex: -1,
|
|
263
|
-
height: height + 2,
|
|
264
|
-
width: width,
|
|
265
|
-
scrollTop: scrollTop // control scroll position with ctrl or shift key
|
|
266
|
-
, rowCount: R.length(list),
|
|
267
|
-
rowHeight: R.add(1)(rowHeight) // 1 is space between elements
|
|
268
|
-
, rowRenderer: function rowRenderer(_ref2) {
|
|
269
|
-
var index = _ref2.index,
|
|
270
|
-
style = _ref2.style;
|
|
271
|
-
|
|
272
|
-
var itemId = R.nth(index, list);
|
|
273
|
-
var item = R.prop(itemId, indexedItemsById);
|
|
274
|
-
return React.createElement(Item, _extends({}, item, {
|
|
275
|
-
id: getHierarchicalId(item),
|
|
276
|
-
label: labelRenderer(item),
|
|
277
|
-
key: getHierarchicalId(item),
|
|
278
|
-
depth: getDepth(indexedItemsById)(item),
|
|
279
|
-
hasChild: R.has(itemId, groupedItemsByParentId),
|
|
280
|
-
hasChildrenOnLevel: getHasChildrenOnLevel(groupedItemsByParentId)(item),
|
|
281
|
-
changeList: R.has(itemId, expandedIds) ? function () {
|
|
282
|
-
return collapse(index);
|
|
283
|
-
} : function () {
|
|
284
|
-
return expand(index);
|
|
285
|
-
},
|
|
286
|
-
NavigateIcon: R.has(itemId, expandedIds) ? ExpandLessIcon : ExpandMoreIcon,
|
|
287
|
-
isRtl: isRtl,
|
|
288
|
-
isDisabled: R.is(Function, disableAccessor) ? disableAccessor(item) : false,
|
|
289
|
-
eventsCallbacks: eventsCallbacks,
|
|
290
|
-
isSelected: isItemSelected(item, index),
|
|
291
|
-
HTMLRenderer: HTMLRenderer,
|
|
292
|
-
classes: classes,
|
|
293
|
-
labels: labels,
|
|
294
|
-
index: index,
|
|
295
|
-
style: style,
|
|
296
|
-
accessibility: accessibility,
|
|
297
|
-
ariaLabel: R.prop('navigateNext')(labels),
|
|
298
|
-
theme: theme
|
|
299
|
-
}));
|
|
300
|
-
}
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
)
|
|
304
|
-
),
|
|
305
|
-
withExpandControl && React.createElement(
|
|
306
|
-
'div',
|
|
241
|
+
AutoSizer,
|
|
307
242
|
null,
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
243
|
+
function (_ref) {
|
|
244
|
+
var height = _ref.height,
|
|
245
|
+
width = _ref.width;
|
|
246
|
+
return React.createElement(VirtualizedList, {
|
|
247
|
+
overscan: 10,
|
|
248
|
+
tabIndex: -1,
|
|
249
|
+
height: height + 2,
|
|
250
|
+
width: width,
|
|
251
|
+
scrollTop: scrollTop // control scroll position with ctrl or shift key
|
|
252
|
+
, rowCount: R.length(list),
|
|
253
|
+
rowHeight: R.add(1)(rowHeight) // 1 is space between elements
|
|
254
|
+
, rowRenderer: function rowRenderer(_ref2) {
|
|
255
|
+
var index = _ref2.index,
|
|
256
|
+
style = _ref2.style;
|
|
257
|
+
|
|
258
|
+
var itemId = R.nth(index, list);
|
|
259
|
+
var item = R.prop(itemId, indexedItemsById);
|
|
260
|
+
return React.createElement(Item, _extends({}, item, {
|
|
261
|
+
id: getHierarchicalId(item),
|
|
262
|
+
label: labelRenderer(item),
|
|
263
|
+
key: getHierarchicalId(item),
|
|
264
|
+
depth: getDepth(indexedItemsById)(item),
|
|
265
|
+
hasChild: R.has(itemId, groupedItemsByParentId),
|
|
266
|
+
hasChildrenOnLevel: getHasChildrenOnLevel(groupedItemsByParentId)(item),
|
|
267
|
+
changeList: R.has(itemId, expandedIds) ? function () {
|
|
268
|
+
return collapse(getHierarchicalId(item));
|
|
269
|
+
} : function () {
|
|
270
|
+
return expand(getHierarchicalId(item));
|
|
271
|
+
},
|
|
272
|
+
NavigateIcon: R.has(itemId, expandedIds) ? ExpandLessIcon : ExpandMoreIcon,
|
|
273
|
+
isRtl: isRtl,
|
|
274
|
+
isDisabled: R.is(Function, disableAccessor) ? disableAccessor(item) : false,
|
|
275
|
+
eventsCallbacks: eventsCallbacks,
|
|
276
|
+
isSelected: isItemSelected(item, index),
|
|
277
|
+
HTMLRenderer: HTMLRenderer,
|
|
278
|
+
classes: classes,
|
|
279
|
+
labels: labels,
|
|
280
|
+
index: index,
|
|
281
|
+
style: style,
|
|
282
|
+
accessibility: accessibility,
|
|
283
|
+
ariaLabel: R.prop('navigateNext')(labels),
|
|
284
|
+
theme: theme
|
|
285
|
+
}));
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
}
|
|
318
289
|
)
|
|
319
290
|
);
|
|
320
291
|
};
|
|
@@ -334,7 +305,10 @@ VirtualizedTree.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
334
305
|
}),
|
|
335
306
|
labelRenderer: PropTypes.func,
|
|
336
307
|
withExpandControl: PropTypes.bool,
|
|
337
|
-
maxTreeHeight: PropTypes.number
|
|
308
|
+
maxTreeHeight: PropTypes.number,
|
|
309
|
+
expandedIds: PropTypes.object,
|
|
310
|
+
expand: PropTypes.func,
|
|
311
|
+
collapse: PropTypes.func
|
|
338
312
|
} : {};
|
|
339
313
|
|
|
340
314
|
export default VirtualizedTree;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
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; };
|
|
2
|
+
|
|
3
|
+
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; }
|
|
4
|
+
|
|
5
|
+
/* eslint react/prop-types: 0 */
|
|
6
|
+
import React, { useState, useEffect } from 'react';
|
|
7
|
+
import * as R from 'ramda';
|
|
8
|
+
import { getHierarchicalId } from './VirtualizedTree';
|
|
9
|
+
|
|
10
|
+
var withExpansionTree = function withExpansionTree(Component) {
|
|
11
|
+
return function (_ref) {
|
|
12
|
+
var items = _ref.items,
|
|
13
|
+
defaultExpandedIds = _ref.defaultExpandedIds,
|
|
14
|
+
rest = _objectWithoutProperties(_ref, ['items', 'defaultExpandedIds']);
|
|
15
|
+
|
|
16
|
+
var _useState = useState({}),
|
|
17
|
+
expandedIds = _useState[0],
|
|
18
|
+
setExpandedIds = _useState[1];
|
|
19
|
+
|
|
20
|
+
useEffect(function () {
|
|
21
|
+
if (!R.isNil(defaultExpandedIds) && !R.isEmpty(defaultExpandedIds)) {
|
|
22
|
+
setExpandedIds(defaultExpandedIds);
|
|
23
|
+
} else {
|
|
24
|
+
var ids = R.pipe(R.map(getHierarchicalId), R.indexBy(R.identity))(items);
|
|
25
|
+
setExpandedIds(ids);
|
|
26
|
+
}
|
|
27
|
+
}, [items, defaultExpandedIds]);
|
|
28
|
+
|
|
29
|
+
var expand = function expand(id) {
|
|
30
|
+
setExpandedIds(R.assoc(id, id, expandedIds));
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
var collapse = function collapse(id) {
|
|
34
|
+
setExpandedIds(R.dissoc(id, expandedIds));
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
var expandAll = function expandAll() {
|
|
38
|
+
var ids = R.pipe(R.map(getHierarchicalId), R.indexBy(R.identity))(items);
|
|
39
|
+
setExpandedIds(ids);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
var collapseAll = function collapseAll() {
|
|
43
|
+
setExpandedIds({});
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
return React.createElement(Component, _extends({}, rest, {
|
|
47
|
+
items: items,
|
|
48
|
+
expand: expand,
|
|
49
|
+
collapse: collapse,
|
|
50
|
+
expandAll: expandAll,
|
|
51
|
+
collapseAll: collapseAll,
|
|
52
|
+
expandedIds: expandedIds
|
|
53
|
+
}));
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
export { withExpansionTree };
|
|
@@ -81,6 +81,8 @@ var _reactDraggable2 = _interopRequireDefault(_reactDraggable);
|
|
|
81
81
|
|
|
82
82
|
var _ = require('..');
|
|
83
83
|
|
|
84
|
+
var _withExpansionTree = require('../VirtualizedTree/withExpansionTree');
|
|
85
|
+
|
|
84
86
|
var _styles = require('@material-ui/core/styles');
|
|
85
87
|
|
|
86
88
|
var _singleSelection = require('./images/single-selection.png');
|
|
@@ -133,7 +135,7 @@ var PaperComponent = function PaperComponent(props) {
|
|
|
133
135
|
return _react2.default.createElement(
|
|
134
136
|
_reactDraggable2.default,
|
|
135
137
|
{ handle: '#draggable-dialog-title', cancel: '[class*="MuiDialogContent-root"]' },
|
|
136
|
-
_react2.default.createElement(_Paper2.default, _extends({ style: { minWidth: '75%', height:
|
|
138
|
+
_react2.default.createElement(_Paper2.default, _extends({ style: { minWidth: '75%', height: '75%' } }, props))
|
|
137
139
|
);
|
|
138
140
|
};
|
|
139
141
|
|
|
@@ -177,16 +179,19 @@ var useStyles = (0, _styles.makeStyles)(function (theme) {
|
|
|
177
179
|
narrowSpotlight: { width: '100%' },
|
|
178
180
|
selectionButton: {
|
|
179
181
|
marginLeft: 24,
|
|
182
|
+
marginRight: 15,
|
|
180
183
|
height: 32
|
|
181
184
|
},
|
|
182
185
|
narrowSelectionButton: {
|
|
183
186
|
height: 32,
|
|
184
|
-
marginTop: 5
|
|
187
|
+
marginTop: 5,
|
|
188
|
+
marginRight: 15
|
|
185
189
|
},
|
|
186
190
|
selectionMenu: {
|
|
187
191
|
width: '50%',
|
|
192
|
+
maxHeight: '100%',
|
|
188
193
|
position: 'absolute',
|
|
189
|
-
top:
|
|
194
|
+
top: 110,
|
|
190
195
|
right: 48,
|
|
191
196
|
zIndex: 1
|
|
192
197
|
},
|
|
@@ -205,12 +210,6 @@ var useStyles = (0, _styles.makeStyles)(function (theme) {
|
|
|
205
210
|
backgroundColor: theme.palette.action.hover
|
|
206
211
|
}
|
|
207
212
|
},
|
|
208
|
-
selectedButton: {
|
|
209
|
-
backgroundColor: theme.palette.secondary.main,
|
|
210
|
-
'&:hover': {
|
|
211
|
-
backgroundColor: theme.palette.action.selected
|
|
212
|
-
}
|
|
213
|
-
},
|
|
214
213
|
selectModeItem: {
|
|
215
214
|
boxShadow: 'none',
|
|
216
215
|
display: 'flex',
|
|
@@ -230,6 +229,9 @@ var useStyles = (0, _styles.makeStyles)(function (theme) {
|
|
|
230
229
|
marginRight: 10,
|
|
231
230
|
display: 'flex',
|
|
232
231
|
flexDirection: 'row'
|
|
232
|
+
},
|
|
233
|
+
actions: {
|
|
234
|
+
justifyContent: 'space-between'
|
|
233
235
|
}
|
|
234
236
|
};
|
|
235
237
|
});
|
|
@@ -272,7 +274,8 @@ var SelectionModeMenu = function SelectionModeMenu(_ref) {
|
|
|
272
274
|
selected = _ref.selected,
|
|
273
275
|
classes = _ref.classes,
|
|
274
276
|
isNarrow = _ref.isNarrow,
|
|
275
|
-
hint = _ref.hint
|
|
277
|
+
hint = _ref.hint,
|
|
278
|
+
maxHeight = _ref.maxHeight;
|
|
276
279
|
|
|
277
280
|
if (!isOpen) {
|
|
278
281
|
return null;
|
|
@@ -282,26 +285,24 @@ var SelectionModeMenu = function SelectionModeMenu(_ref) {
|
|
|
282
285
|
{ className: isNarrow ? classes.narrowSelectionMenu : classes.selectionMenu },
|
|
283
286
|
_react2.default.createElement(
|
|
284
287
|
_Card2.default,
|
|
285
|
-
|
|
288
|
+
{ style: { maxHeight: maxHeight - 5, overflow: 'auto' } },
|
|
286
289
|
_react2.default.createElement(
|
|
287
290
|
_CardContent2.default,
|
|
288
291
|
{ className: classes.selectModeContainer },
|
|
289
292
|
R.map(function (_ref2) {
|
|
290
|
-
var _cx;
|
|
291
|
-
|
|
292
293
|
var value = _ref2.value,
|
|
293
294
|
label = _ref2.label,
|
|
294
295
|
img = _ref2.img;
|
|
295
296
|
return _react2.default.createElement(
|
|
296
297
|
_.Button,
|
|
297
|
-
|
|
298
|
-
className:
|
|
299
|
-
|
|
298
|
+
{
|
|
299
|
+
className: classes.selectButton,
|
|
300
|
+
selected: value === selected,
|
|
300
301
|
key: value,
|
|
301
302
|
onClick: function onClick() {
|
|
302
303
|
return onSelect(value);
|
|
303
304
|
}
|
|
304
|
-
}
|
|
305
|
+
},
|
|
305
306
|
_react2.default.createElement(
|
|
306
307
|
_Paper2.default,
|
|
307
308
|
{ className: classes.selectModeItem, key: value },
|
|
@@ -335,7 +336,8 @@ SelectionModeMenu.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
335
336
|
isOpen: _propTypes2.default.bool,
|
|
336
337
|
onSelect: _propTypes2.default.func,
|
|
337
338
|
options: _propTypes2.default.array,
|
|
338
|
-
selected: _propTypes2.default.string
|
|
339
|
+
selected: _propTypes2.default.string,
|
|
340
|
+
maxHeight: _propTypes2.default.number
|
|
339
341
|
} : {};
|
|
340
342
|
|
|
341
343
|
var icons = {
|
|
@@ -347,7 +349,7 @@ var icons = {
|
|
|
347
349
|
};
|
|
348
350
|
|
|
349
351
|
var AdvancedFilterDialog = function AdvancedFilterDialog(props) {
|
|
350
|
-
var
|
|
352
|
+
var _cx;
|
|
351
353
|
|
|
352
354
|
var id = props.id,
|
|
353
355
|
title = props.title,
|
|
@@ -359,9 +361,13 @@ var AdvancedFilterDialog = function AdvancedFilterDialog(props) {
|
|
|
359
361
|
isNarrow = props.isNarrow,
|
|
360
362
|
labels = props.labels,
|
|
361
363
|
disableAccessor = props.disableAccessor,
|
|
362
|
-
|
|
364
|
+
expandAll = props.expandAll,
|
|
365
|
+
collapseAll = props.collapseAll,
|
|
366
|
+
defaultSpotlight = props.defaultSpotlight,
|
|
367
|
+
expandedIds = props.expandedIds,
|
|
368
|
+
rest = _objectWithoutProperties(props, ['id', 'title', 'items', 'labelRenderer', 'onClose', 'changeSelection', 'isOpen', 'isNarrow', 'labels', 'disableAccessor', 'expandAll', 'collapseAll', 'defaultSpotlight', 'expandedIds']);
|
|
363
369
|
|
|
364
|
-
var _useState = (0, _react.useState)(''),
|
|
370
|
+
var _useState = (0, _react.useState)({ term: '' }),
|
|
365
371
|
term = _useState[0].term,
|
|
366
372
|
setSpotlight = _useState[1];
|
|
367
373
|
|
|
@@ -379,6 +385,23 @@ var AdvancedFilterDialog = function AdvancedFilterDialog(props) {
|
|
|
379
385
|
|
|
380
386
|
var classes = useStyles();
|
|
381
387
|
|
|
388
|
+
var _useState5 = (0, _react.useState)(0),
|
|
389
|
+
height = _useState5[0],
|
|
390
|
+
setHeight = _useState5[1];
|
|
391
|
+
|
|
392
|
+
var measureRef = _react2.default.useCallback(function (node) {
|
|
393
|
+
if (node !== null) {
|
|
394
|
+
setHeight(node.getBoundingClientRect().height * 75 / 100);
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
(0, _react.useEffect)(function () {
|
|
398
|
+
if (!R.isNil(defaultSpotlight) && !R.isEmpty(defaultSpotlight)) {
|
|
399
|
+
setSpotlight(defaultSpotlight);
|
|
400
|
+
}
|
|
401
|
+
}, [defaultSpotlight]);
|
|
402
|
+
|
|
403
|
+
var listHeight = height - 170;
|
|
404
|
+
|
|
382
405
|
var groupedItemsByParentId = R.groupBy(R.propOr('#ROOT', 'parentId'), items);
|
|
383
406
|
|
|
384
407
|
var recurse = R.filter(function (item) {
|
|
@@ -438,8 +461,9 @@ var AdvancedFilterDialog = function AdvancedFilterDialog(props) {
|
|
|
438
461
|
};
|
|
439
462
|
|
|
440
463
|
var handleSubmit = function handleSubmit() {
|
|
441
|
-
changeSelection(id, R.values(selection));
|
|
464
|
+
changeSelection(id, R.values(selection), { expandedIds: expandedIds, spotlight: { term: term } });
|
|
442
465
|
setSelection({});
|
|
466
|
+
setSpotlight({ term: '' });
|
|
443
467
|
};
|
|
444
468
|
|
|
445
469
|
return _react2.default.createElement(
|
|
@@ -448,7 +472,8 @@ var AdvancedFilterDialog = function AdvancedFilterDialog(props) {
|
|
|
448
472
|
open: isOpen,
|
|
449
473
|
PaperComponent: PaperComponent,
|
|
450
474
|
'aria-labelledby': 'draggable-dialog-title',
|
|
451
|
-
onClose: onClose
|
|
475
|
+
onClose: onClose,
|
|
476
|
+
ref: measureRef
|
|
452
477
|
},
|
|
453
478
|
_react2.default.createElement(
|
|
454
479
|
_DialogTitle2.default,
|
|
@@ -478,11 +503,12 @@ var AdvancedFilterDialog = function AdvancedFilterDialog(props) {
|
|
|
478
503
|
{ container: true },
|
|
479
504
|
_react2.default.createElement(
|
|
480
505
|
_Grid2.default,
|
|
481
|
-
{ item: true, xs: 12, className: (0, _classnames2.default)(classes.topElements, (
|
|
506
|
+
{ item: true, xs: 12, className: (0, _classnames2.default)(classes.topElements, (_cx = {}, _cx[classes.narrowTop] = isNarrow, _cx)) },
|
|
482
507
|
_react2.default.createElement(
|
|
483
508
|
'div',
|
|
484
509
|
{ className: isNarrow ? classes.narrowSpotlight : classes.spotlight },
|
|
485
510
|
_react2.default.createElement(_.Spotlight, {
|
|
511
|
+
hasClearAll: true,
|
|
486
512
|
placeholder: R.prop('placeholder', labels),
|
|
487
513
|
term: term,
|
|
488
514
|
hasCommit: false,
|
|
@@ -513,7 +539,11 @@ var AdvancedFilterDialog = function AdvancedFilterDialog(props) {
|
|
|
513
539
|
_react.Fragment,
|
|
514
540
|
null,
|
|
515
541
|
'\xA0',
|
|
516
|
-
_react2.default.createElement('img', {
|
|
542
|
+
_react2.default.createElement('img', {
|
|
543
|
+
style: { marginLeft: 15 },
|
|
544
|
+
src: R.prop(selectionMode, icons),
|
|
545
|
+
alt: selectionMode
|
|
546
|
+
})
|
|
517
547
|
)
|
|
518
548
|
)
|
|
519
549
|
),
|
|
@@ -530,7 +560,8 @@ var AdvancedFilterDialog = function AdvancedFilterDialog(props) {
|
|
|
530
560
|
setIsOpenSelectionMenu(false);
|
|
531
561
|
},
|
|
532
562
|
selected: selectionMode,
|
|
533
|
-
hint: R.prop('hint', labels)
|
|
563
|
+
hint: R.prop('hint', labels),
|
|
564
|
+
maxHeight: listHeight
|
|
534
565
|
}),
|
|
535
566
|
_react2.default.createElement(_.VirtualizedTree, _extends({}, rest, {
|
|
536
567
|
disableAccessor: disableAccessor,
|
|
@@ -539,36 +570,57 @@ var AdvancedFilterDialog = function AdvancedFilterDialog(props) {
|
|
|
539
570
|
items: selectionItems,
|
|
540
571
|
changeSelection: onChangeSelection,
|
|
541
572
|
withExpandControl: true,
|
|
542
|
-
maxTreeHeight:
|
|
543
|
-
getItemScope: R.prop(selectionMode, scopeGetters)
|
|
573
|
+
maxTreeHeight: listHeight,
|
|
574
|
+
getItemScope: R.prop(selectionMode, scopeGetters),
|
|
575
|
+
expandedIds: expandedIds
|
|
544
576
|
}))
|
|
545
577
|
)
|
|
546
578
|
)
|
|
547
579
|
),
|
|
548
580
|
_react2.default.createElement(
|
|
549
581
|
_DialogActions2.default,
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
582
|
+
{ className: classes.actions },
|
|
583
|
+
_react2.default.createElement(
|
|
584
|
+
'div',
|
|
585
|
+
null,
|
|
586
|
+
_react2.default.createElement(
|
|
587
|
+
_.Button,
|
|
588
|
+
{ onClick: collapseAll, color: 'primary' },
|
|
589
|
+
R.prop('colapseAll', labels)
|
|
590
|
+
),
|
|
591
|
+
_react2.default.createElement(
|
|
592
|
+
_.Button,
|
|
593
|
+
{ style: { marginLeft: 10 }, onClick: expandAll, color: 'primary' },
|
|
594
|
+
R.prop('expandAll', labels)
|
|
595
|
+
)
|
|
561
596
|
),
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
597
|
+
_react2.default.createElement(
|
|
598
|
+
'div',
|
|
599
|
+
null,
|
|
600
|
+
R.is(Function, onClose) && _react2.default.createElement(
|
|
601
|
+
_.Button,
|
|
602
|
+
{
|
|
603
|
+
onClick: function onClick() {
|
|
604
|
+
onClose();
|
|
605
|
+
setSelection({});
|
|
606
|
+
setSpotlight({ term: '' });
|
|
607
|
+
},
|
|
608
|
+
color: 'primary'
|
|
609
|
+
},
|
|
610
|
+
R.prop('cancel', labels)
|
|
611
|
+
),
|
|
612
|
+
R.is(Function, changeSelection) && _react2.default.createElement(
|
|
613
|
+
_.Button,
|
|
614
|
+
{
|
|
615
|
+
disabled: R.isEmpty(selection),
|
|
616
|
+
onClick: handleSubmit,
|
|
617
|
+
color: 'primary',
|
|
618
|
+
variant: 'contained',
|
|
619
|
+
alternative: 'siscc',
|
|
620
|
+
style: { marginLeft: 10 }
|
|
621
|
+
},
|
|
622
|
+
R.prop('apply', labels)
|
|
623
|
+
)
|
|
572
624
|
)
|
|
573
625
|
)
|
|
574
626
|
);
|
|
@@ -597,7 +649,11 @@ AdvancedFilterDialog.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
597
649
|
}),
|
|
598
650
|
onClose: _propTypes2.default.func,
|
|
599
651
|
labelRenderer: _propTypes2.default.func,
|
|
600
|
-
title: _propTypes2.default.string
|
|
652
|
+
title: _propTypes2.default.string,
|
|
653
|
+
expandAll: _propTypes2.default.func,
|
|
654
|
+
collapseAll: _propTypes2.default.func,
|
|
655
|
+
defaultSpotlight: _propTypes2.default.object,
|
|
656
|
+
expandedIds: _propTypes2.default.object
|
|
601
657
|
} : {};
|
|
602
658
|
|
|
603
|
-
exports.default = AdvancedFilterDialog;
|
|
659
|
+
exports.default = (0, _withExpansionTree.withExpansionTree)(AdvancedFilterDialog);
|