@sis-cc/dotstatsuite-visions 12.18.0 → 12.20.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/DynamicDrawer/AdvancedSelection.js +532 -0
- package/es/DynamicDrawer/DynamicDrawer.js +370 -0
- package/es/DynamicDrawer/SelectionModesMobile.js +85 -0
- package/es/DynamicDrawer/index.js +44 -0
- package/es/PeriodPicker/PeriodPicker.js +98 -93
- package/es/index.js +1 -0
- package/lib/DynamicDrawer/AdvancedSelection.js +590 -0
- package/lib/DynamicDrawer/DynamicDrawer.js +410 -0
- package/lib/DynamicDrawer/SelectionModesMobile.js +105 -0
- package/lib/DynamicDrawer/index.js +16 -0
- package/lib/PeriodPicker/PeriodPicker.js +97 -92
- package/lib/index.js +10 -1
- package/package.json +1 -1
- package/umd/@sis-cc/dotstatsuite-visions.js +64402 -63359
- package/umd/@sis-cc/dotstatsuite-visions.min.js +10 -10
- package/umd/@sis-cc/dotstatsuite-visions.min.js.map +1 -1
|
@@ -0,0 +1,532 @@
|
|
|
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
|
+
import React, { useState } from 'react';
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
|
+
import * as R from 'ramda';
|
|
8
|
+
import cx from 'classnames';
|
|
9
|
+
import { getEvolvedDisableAccessor, getHierarchicalId, getScopeGetters } from '../VirtualizedTree/utils';
|
|
10
|
+
import IconButton from '@mui/material/Button';
|
|
11
|
+
import Paper from '@mui/material/Paper';
|
|
12
|
+
import Grid from '@mui/material/Grid';
|
|
13
|
+
import Typography from '@mui/material/Typography';
|
|
14
|
+
import { Button, Spotlight, Tooltip, VirtualizedTree } from '..';
|
|
15
|
+
import { withExpansionTree } from '../VirtualizedTree/withExpansionTree';
|
|
16
|
+
import { withSpotlight } from '../VirtualizedTree/withSpotlight';
|
|
17
|
+
import makeStyles from '@mui/styles/makeStyles';
|
|
18
|
+
import HintIcon from '@mui/icons-material/EmojiObjects';
|
|
19
|
+
import singleImg from '../AdvancedFilterDialog/images/single-selection.png';
|
|
20
|
+
import childrenImg from '../AdvancedFilterDialog/images/children-selection.png';
|
|
21
|
+
import branchImg from '../AdvancedFilterDialog/images/branch-selection.png';
|
|
22
|
+
import levelImg from '../AdvancedFilterDialog/images/level-selection.png';
|
|
23
|
+
import { Divider } from '@mui/material';
|
|
24
|
+
import ButtonCarousel from './SelectionModesMobile';
|
|
25
|
+
|
|
26
|
+
var useStyles = makeStyles(function (theme) {
|
|
27
|
+
return {
|
|
28
|
+
header: {
|
|
29
|
+
color: 'black',
|
|
30
|
+
display: 'flex',
|
|
31
|
+
alignItems: 'center',
|
|
32
|
+
justifyContent: 'space-between',
|
|
33
|
+
width: '100%'
|
|
34
|
+
},
|
|
35
|
+
headerLabel: {
|
|
36
|
+
fontSize: '16px',
|
|
37
|
+
fontFamily: 'PT Sans Narrow',
|
|
38
|
+
fontWeight: '700',
|
|
39
|
+
color: theme.palette.grey[700]
|
|
40
|
+
},
|
|
41
|
+
selectionTitle: {
|
|
42
|
+
fontSize: '12px',
|
|
43
|
+
fontFamily: "'Helvetica Neue', Helvetica, Arial, sans-serif",
|
|
44
|
+
fontWeight: '500',
|
|
45
|
+
color: theme.palette.grey['A700']
|
|
46
|
+
},
|
|
47
|
+
closeButton: {
|
|
48
|
+
color: 'grey !important',
|
|
49
|
+
padding: 0
|
|
50
|
+
},
|
|
51
|
+
selectMode: {
|
|
52
|
+
marginLeft: 10,
|
|
53
|
+
'& .MuiInputBase-root': {
|
|
54
|
+
height: 32
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
narrowTop: {
|
|
58
|
+
flexDirection: 'column',
|
|
59
|
+
alignItems: 'flex-start'
|
|
60
|
+
},
|
|
61
|
+
spotlight: { width: '45%' },
|
|
62
|
+
selection: {
|
|
63
|
+
display: 'flex',
|
|
64
|
+
alignItems: 'center'
|
|
65
|
+
},
|
|
66
|
+
narrowSpotlight: { width: '100%' },
|
|
67
|
+
selectionButton: {
|
|
68
|
+
marginLeft: 24,
|
|
69
|
+
marginRight: 15,
|
|
70
|
+
height: 32
|
|
71
|
+
},
|
|
72
|
+
narrowSelectionButton: {
|
|
73
|
+
height: 32,
|
|
74
|
+
marginTop: 15,
|
|
75
|
+
marginRight: 10
|
|
76
|
+
},
|
|
77
|
+
selectionMenu: {
|
|
78
|
+
width: '50%',
|
|
79
|
+
maxHeight: '100%',
|
|
80
|
+
position: 'absolute',
|
|
81
|
+
top: 110,
|
|
82
|
+
right: 48,
|
|
83
|
+
zIndex: 1
|
|
84
|
+
},
|
|
85
|
+
narrowSelectionMenu: {
|
|
86
|
+
width: '100%'
|
|
87
|
+
},
|
|
88
|
+
selectModeContainer: {
|
|
89
|
+
display: 'flex',
|
|
90
|
+
flexDirection: 'column',
|
|
91
|
+
flexWrap: 'wrap',
|
|
92
|
+
alignItems: 'flex-start'
|
|
93
|
+
},
|
|
94
|
+
selectButton: {
|
|
95
|
+
color: theme.palette.primary.main,
|
|
96
|
+
'&:hover': {
|
|
97
|
+
color: theme.palette.primary.main,
|
|
98
|
+
backgroundColor: theme.palette.action.hover
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
selectModeItem: {
|
|
102
|
+
boxShadow: 'none',
|
|
103
|
+
display: 'flex',
|
|
104
|
+
backgroundColor: 'transparent',
|
|
105
|
+
flexDirection: 'row-reverse',
|
|
106
|
+
alignItems: 'center',
|
|
107
|
+
'& p': {
|
|
108
|
+
paddingLeft: '5px',
|
|
109
|
+
fontSize: '12px',
|
|
110
|
+
fontFamily: "'Helvetica Neue', Helvetica, Arial, sans-serif",
|
|
111
|
+
color: theme.palette.primary.main,
|
|
112
|
+
fontWeight: '500',
|
|
113
|
+
lineHeight: 1.43,
|
|
114
|
+
textAlign: 'left'
|
|
115
|
+
},
|
|
116
|
+
'& img': {
|
|
117
|
+
width: 21,
|
|
118
|
+
height: 24
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
hint: {
|
|
122
|
+
display: 'flex',
|
|
123
|
+
flexDirection: 'row',
|
|
124
|
+
alignItems: 'center',
|
|
125
|
+
marginRight: 7,
|
|
126
|
+
color: theme.palette.primary.main
|
|
127
|
+
},
|
|
128
|
+
divider: {
|
|
129
|
+
backgroundColor: theme.palette.primary.light
|
|
130
|
+
},
|
|
131
|
+
actions: {
|
|
132
|
+
justifyContent: 'flex-end'
|
|
133
|
+
},
|
|
134
|
+
ellipsis: {
|
|
135
|
+
whiteSpace: 'nowrap',
|
|
136
|
+
overflow: 'hidden',
|
|
137
|
+
textOverflow: 'ellipsis'
|
|
138
|
+
},
|
|
139
|
+
tooltip: {
|
|
140
|
+
backgroundColor: theme.palette.action.hover
|
|
141
|
+
},
|
|
142
|
+
subheader: {
|
|
143
|
+
display: 'flex',
|
|
144
|
+
flexDirection: 'column',
|
|
145
|
+
alignItems: 'flex-start',
|
|
146
|
+
justifyContent: 'space-between'
|
|
147
|
+
},
|
|
148
|
+
narrowHeader: {
|
|
149
|
+
alignItems: 'flex-start',
|
|
150
|
+
width: '100%'
|
|
151
|
+
},
|
|
152
|
+
topElements: {
|
|
153
|
+
display: 'flex',
|
|
154
|
+
flexDirection: 'row',
|
|
155
|
+
justifyContent: 'space-between'
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
var AdvancedSelection = function AdvancedSelection(props) {
|
|
161
|
+
var _cx, _cx2, _cx3, _cx4;
|
|
162
|
+
|
|
163
|
+
var id = props.id,
|
|
164
|
+
items = props.items,
|
|
165
|
+
labelRenderer = props.labelRenderer,
|
|
166
|
+
isNarrow = props.isNarrow,
|
|
167
|
+
labels = props.labels,
|
|
168
|
+
_props$disableAccesso = props.disableAccessor,
|
|
169
|
+
disableAccessor = _props$disableAccesso === undefined ? R.always(false) : _props$disableAccesso,
|
|
170
|
+
expandAll = props.expandAll,
|
|
171
|
+
collapseAll = props.collapseAll,
|
|
172
|
+
selection = props.selection,
|
|
173
|
+
setSelection = props.setSelection,
|
|
174
|
+
allSelection = props.allSelection,
|
|
175
|
+
setAllSelection = props.setAllSelection,
|
|
176
|
+
spotlight = props.spotlight,
|
|
177
|
+
setSpotlight = props.setSpotlight,
|
|
178
|
+
expandedIds = props.expandedIds,
|
|
179
|
+
allItems = props.allItems,
|
|
180
|
+
filter = props.filter,
|
|
181
|
+
rest = _objectWithoutProperties(props, ['id', 'items', 'labelRenderer', 'isNarrow', 'labels', 'disableAccessor', 'expandAll', 'collapseAll', 'selection', 'setSelection', 'allSelection', 'setAllSelection', 'spotlight', 'setSpotlight', 'expandedIds', 'allItems', 'filter']);
|
|
182
|
+
|
|
183
|
+
var _useState = useState('single'),
|
|
184
|
+
selectionMode = _useState[0],
|
|
185
|
+
setSelectionMode = _useState[1];
|
|
186
|
+
|
|
187
|
+
var classes = useStyles();
|
|
188
|
+
var getTotal = function getTotal(items, spotlightAcc) {
|
|
189
|
+
var itemsIds = R.pluck('id', items);
|
|
190
|
+
var total = R.pipe(R.uniq, R.length)(itemsIds);
|
|
191
|
+
if (R.is(Function, spotlightAcc)) {
|
|
192
|
+
return spotlightAcc(total);
|
|
193
|
+
}
|
|
194
|
+
return total;
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
var selectionItems = R.map(function (item) {
|
|
198
|
+
return _extends({}, item, {
|
|
199
|
+
isSelected: R.has(item.id, selection) ? !item.isSelected : !!item.isSelected
|
|
200
|
+
});
|
|
201
|
+
}, items);
|
|
202
|
+
var indexedFilteredItems = R.indexBy(getHierarchicalId, selectionItems);
|
|
203
|
+
|
|
204
|
+
var selectionOptions = [{
|
|
205
|
+
value: 'single',
|
|
206
|
+
label: R.prop('singleSelection', labels),
|
|
207
|
+
img: singleImg
|
|
208
|
+
}, {
|
|
209
|
+
value: 'children',
|
|
210
|
+
label: R.prop('childrenSelection', labels),
|
|
211
|
+
img: childrenImg
|
|
212
|
+
}, {
|
|
213
|
+
value: 'branch',
|
|
214
|
+
label: R.prop('branchSelection', labels),
|
|
215
|
+
img: branchImg
|
|
216
|
+
}, {
|
|
217
|
+
value: 'level',
|
|
218
|
+
label: R.prop('levelSelection', labels),
|
|
219
|
+
img: levelImg
|
|
220
|
+
}];
|
|
221
|
+
|
|
222
|
+
var _allGroupedItems = R.pipe(R.map(function (item) {
|
|
223
|
+
return _extends({}, item, {
|
|
224
|
+
isSelected: R.has(item.id, selection) ? !item.isSelected : !!item.isSelected
|
|
225
|
+
});
|
|
226
|
+
}), R.groupBy(R.propOr('#ROOT', 'parentId')))(allItems);
|
|
227
|
+
|
|
228
|
+
var isChildInSelectionScope = function isChildInSelectionScope(child, ancestor) {
|
|
229
|
+
if (!R.has(getHierarchicalId(child), indexedFilteredItems)) {
|
|
230
|
+
return false;
|
|
231
|
+
}
|
|
232
|
+
if (selectionMode === 'single' || selectionMode === 'level') {
|
|
233
|
+
return false;
|
|
234
|
+
}
|
|
235
|
+
if (selectionMode === 'children') {
|
|
236
|
+
return child.parentId === getHierarchicalId(ancestor);
|
|
237
|
+
}
|
|
238
|
+
return true;
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
var _disableAccessor = getEvolvedDisableAccessor(_allGroupedItems, disableAccessor, isChildInSelectionScope);
|
|
242
|
+
|
|
243
|
+
var isDisabled = function isDisabled(item) {
|
|
244
|
+
return R.is(Function, disableAccessor) ? disableAccessor(item) : false;
|
|
245
|
+
};
|
|
246
|
+
var scopeGetter = R.prop(selectionMode, getScopeGetters);
|
|
247
|
+
|
|
248
|
+
var onChangeSelection = function onChangeSelection(ids) {
|
|
249
|
+
var _extends2;
|
|
250
|
+
|
|
251
|
+
var nextSelection = R.reduce(function (acc, id) {
|
|
252
|
+
return R.has(id, acc) ? R.dissoc(id, acc) : R.assoc(id, id, acc);
|
|
253
|
+
}, selection, ids);
|
|
254
|
+
setSelection(nextSelection);
|
|
255
|
+
setAllSelection(_extends({}, allSelection, (_extends2 = {}, _extends2[id] = R.values(nextSelection), _extends2)));
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
var rejectonlyDisabledItems = function rejectonlyDisabledItems(item) {
|
|
259
|
+
return _disableAccessor(item);
|
|
260
|
+
};
|
|
261
|
+
var getSelectedItems = function getSelectedItems(item) {
|
|
262
|
+
return R.propOr(false, 'isSelected')(item);
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
var selectAll = function selectAll() {
|
|
266
|
+
var _extends3;
|
|
267
|
+
|
|
268
|
+
var imposedIds = R.reduce(function (acc, item) {
|
|
269
|
+
return R.uniq(R.concat(R.propOr([], 'imposedIds', item), acc));
|
|
270
|
+
}, [])(items);
|
|
271
|
+
var ids = R.pluck('id', R.reject(getSelectedItems, R.reject(rejectonlyDisabledItems, items)));
|
|
272
|
+
var allIds = R.concat(imposedIds, ids);
|
|
273
|
+
var nextSelection = R.reduce(function (acc, id) {
|
|
274
|
+
return R.has(id, acc) ? acc : R.assoc(id, id, acc);
|
|
275
|
+
}, {}, allIds);
|
|
276
|
+
setSelection(nextSelection);
|
|
277
|
+
setAllSelection(_extends({}, allSelection, (_extends3 = {}, _extends3[id] = R.values(nextSelection), _extends3)));
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
var deselectAll = function deselectAll() {
|
|
281
|
+
var _extends4;
|
|
282
|
+
|
|
283
|
+
var itemIds = R.pipe(R.filter(getSelectedItems), R.pluck('id'))(items);
|
|
284
|
+
var ids = R.difference(itemIds, selection);
|
|
285
|
+
var nextSelection = R.reduce(function (acc, id) {
|
|
286
|
+
return R.has(id, acc) ? acc : R.assoc(id, id, acc);
|
|
287
|
+
}, {}, ids);
|
|
288
|
+
setSelection(nextSelection);
|
|
289
|
+
setAllSelection(_extends({}, allSelection, (_extends4 = {}, _extends4[id] = R.values(nextSelection), _extends4)));
|
|
290
|
+
};
|
|
291
|
+
var mapIndexed = R.addIndex(R.map);
|
|
292
|
+
return React.createElement(
|
|
293
|
+
Grid,
|
|
294
|
+
{ container: true },
|
|
295
|
+
React.createElement(
|
|
296
|
+
Grid,
|
|
297
|
+
{
|
|
298
|
+
item: true,
|
|
299
|
+
container: true,
|
|
300
|
+
xs: 12,
|
|
301
|
+
className: cx(classes.topElements, (_cx = {}, _cx[classes.narrowTop] = isNarrow, _cx))
|
|
302
|
+
},
|
|
303
|
+
isNarrow && React.createElement(
|
|
304
|
+
Grid,
|
|
305
|
+
{ item: true, container: true, xs: 12 },
|
|
306
|
+
React.createElement(
|
|
307
|
+
'div',
|
|
308
|
+
{ className: cx(classes.selectModeContainer, (_cx2 = {}, _cx2[classes.narrowHeader] = isNarrow, _cx2)) },
|
|
309
|
+
React.createElement(
|
|
310
|
+
'div',
|
|
311
|
+
{ className: classes.hint },
|
|
312
|
+
React.createElement(
|
|
313
|
+
Tooltip,
|
|
314
|
+
{
|
|
315
|
+
role: 'tooltip',
|
|
316
|
+
variant: 'light',
|
|
317
|
+
title: React.createElement(
|
|
318
|
+
Typography,
|
|
319
|
+
{ variant: 'body2' },
|
|
320
|
+
R.prop('hint', labels)
|
|
321
|
+
),
|
|
322
|
+
'aria-label': R.prop('hint', labels),
|
|
323
|
+
tabIndex: 0
|
|
324
|
+
},
|
|
325
|
+
React.createElement(
|
|
326
|
+
IconButton,
|
|
327
|
+
null,
|
|
328
|
+
React.createElement(HintIcon, null)
|
|
329
|
+
)
|
|
330
|
+
),
|
|
331
|
+
React.createElement(
|
|
332
|
+
Typography,
|
|
333
|
+
{
|
|
334
|
+
className: classes.selectionTitle,
|
|
335
|
+
'aria-label': R.prop('selectionMode', labels),
|
|
336
|
+
tabIndex: 0
|
|
337
|
+
},
|
|
338
|
+
R.prop('selectionMode', labels)
|
|
339
|
+
)
|
|
340
|
+
),
|
|
341
|
+
React.createElement(ButtonCarousel, {
|
|
342
|
+
selectionModes: selectionOptions,
|
|
343
|
+
selectionMode: selectionMode,
|
|
344
|
+
setSelectionMode: setSelectionMode,
|
|
345
|
+
classes: classes,
|
|
346
|
+
isNarrow: isNarrow
|
|
347
|
+
})
|
|
348
|
+
)
|
|
349
|
+
),
|
|
350
|
+
React.createElement(
|
|
351
|
+
'div',
|
|
352
|
+
{ className: classes.spotlight },
|
|
353
|
+
React.createElement(Spotlight, {
|
|
354
|
+
hasClearAll: true,
|
|
355
|
+
placeholder: getTotal(items, R.prop('placeholder', labels)),
|
|
356
|
+
term: spotlight.term,
|
|
357
|
+
hasCommit: false,
|
|
358
|
+
spotlight: { fields: {} },
|
|
359
|
+
action: setSpotlight
|
|
360
|
+
})
|
|
361
|
+
)
|
|
362
|
+
),
|
|
363
|
+
React.createElement(
|
|
364
|
+
Grid,
|
|
365
|
+
{ item: true, xs: isNarrow ? 12 : 8 },
|
|
366
|
+
React.createElement(
|
|
367
|
+
'div',
|
|
368
|
+
{ style: { display: 'flex', flexDirection: 'row' } },
|
|
369
|
+
React.createElement(
|
|
370
|
+
'div',
|
|
371
|
+
null,
|
|
372
|
+
React.createElement(
|
|
373
|
+
Button,
|
|
374
|
+
{ onClick: collapseAll, color: 'primary' },
|
|
375
|
+
R.prop('colapseAll', labels)
|
|
376
|
+
),
|
|
377
|
+
React.createElement(
|
|
378
|
+
Button,
|
|
379
|
+
{ style: { marginLeft: 10 }, onClick: expandAll, color: 'primary' },
|
|
380
|
+
R.prop('expandAll', labels)
|
|
381
|
+
)
|
|
382
|
+
),
|
|
383
|
+
React.createElement(
|
|
384
|
+
'div',
|
|
385
|
+
null,
|
|
386
|
+
React.createElement(
|
|
387
|
+
Button,
|
|
388
|
+
{ onClick: selectAll, color: 'primary' },
|
|
389
|
+
R.prop('selectAll', labels)
|
|
390
|
+
),
|
|
391
|
+
React.createElement(
|
|
392
|
+
Button,
|
|
393
|
+
{ style: { marginLeft: 10 }, onClick: deselectAll, color: 'primary' },
|
|
394
|
+
R.prop('deselectAll', labels)
|
|
395
|
+
)
|
|
396
|
+
)
|
|
397
|
+
),
|
|
398
|
+
React.createElement(Divider, { className: classes.divider }),
|
|
399
|
+
React.createElement(VirtualizedTree, _extends({}, rest, {
|
|
400
|
+
disableAccessor: _disableAccessor,
|
|
401
|
+
isGreyed: isDisabled,
|
|
402
|
+
labels: labels,
|
|
403
|
+
labelRenderer: labelRenderer,
|
|
404
|
+
items: selectionItems,
|
|
405
|
+
changeSelection: function changeSelection(selection, ids) {
|
|
406
|
+
return onChangeSelection(selection, ids, filter);
|
|
407
|
+
},
|
|
408
|
+
withExpandControl: true,
|
|
409
|
+
treeHeight: isNarrow ? 0 : '700px',
|
|
410
|
+
scopeGetter: scopeGetter,
|
|
411
|
+
expandedIds: expandedIds
|
|
412
|
+
}))
|
|
413
|
+
),
|
|
414
|
+
!isNarrow && React.createElement(
|
|
415
|
+
Grid,
|
|
416
|
+
{ item: true, container: true, xs: 4 },
|
|
417
|
+
React.createElement(
|
|
418
|
+
'div',
|
|
419
|
+
{ className: cx(classes.selectModeContainer, (_cx3 = {}, _cx3[classes.narrowHeader] = isNarrow, _cx3)) },
|
|
420
|
+
React.createElement(
|
|
421
|
+
'div',
|
|
422
|
+
{ className: classes.hint },
|
|
423
|
+
React.createElement(
|
|
424
|
+
Tooltip,
|
|
425
|
+
{
|
|
426
|
+
role: 'tooltip',
|
|
427
|
+
variant: 'light',
|
|
428
|
+
title: React.createElement(
|
|
429
|
+
Typography,
|
|
430
|
+
{ variant: 'body2' },
|
|
431
|
+
R.prop('hint', labels)
|
|
432
|
+
),
|
|
433
|
+
'aria-label': R.prop('hint', labels),
|
|
434
|
+
tabIndex: 0
|
|
435
|
+
},
|
|
436
|
+
React.createElement(
|
|
437
|
+
IconButton,
|
|
438
|
+
null,
|
|
439
|
+
React.createElement(HintIcon, null)
|
|
440
|
+
)
|
|
441
|
+
),
|
|
442
|
+
React.createElement(
|
|
443
|
+
Typography,
|
|
444
|
+
{
|
|
445
|
+
className: classes.selectionTitle,
|
|
446
|
+
'aria-label': R.prop('selectionMode', labels),
|
|
447
|
+
tabIndex: 0
|
|
448
|
+
},
|
|
449
|
+
R.prop('selectionMode', labels)
|
|
450
|
+
)
|
|
451
|
+
),
|
|
452
|
+
React.createElement(
|
|
453
|
+
'div',
|
|
454
|
+
{ className: cx(classes.selectModeContainer, (_cx4 = {}, _cx4[classes.narrowHeader] = isNarrow, _cx4)) },
|
|
455
|
+
mapIndexed(function (_ref) {
|
|
456
|
+
var value = _ref.value,
|
|
457
|
+
label = _ref.label,
|
|
458
|
+
img = _ref.img;
|
|
459
|
+
return React.createElement(
|
|
460
|
+
Tooltip,
|
|
461
|
+
{
|
|
462
|
+
key: value,
|
|
463
|
+
classes: { tooltip: classes.tooltip },
|
|
464
|
+
title: React.createElement('img', { style: { width: '72px', height: '90px' }, src: img, alt: value }),
|
|
465
|
+
tabIndex: -1
|
|
466
|
+
},
|
|
467
|
+
React.createElement(
|
|
468
|
+
Button,
|
|
469
|
+
{
|
|
470
|
+
className: classes.selectButton,
|
|
471
|
+
selected: value === selectionMode,
|
|
472
|
+
onClick: function onClick() {
|
|
473
|
+
setSelectionMode(value);
|
|
474
|
+
},
|
|
475
|
+
'aria-pressed': value === selectionMode,
|
|
476
|
+
'aria-label': label,
|
|
477
|
+
tabIndex: 0
|
|
478
|
+
},
|
|
479
|
+
React.createElement(
|
|
480
|
+
Paper,
|
|
481
|
+
{ elevation: 0, className: classes.selectModeItem, key: value },
|
|
482
|
+
React.createElement(
|
|
483
|
+
Typography,
|
|
484
|
+
null,
|
|
485
|
+
label
|
|
486
|
+
),
|
|
487
|
+
!R.isNil(img) && R.is(String, img) && React.createElement('img', { src: img, alt: value })
|
|
488
|
+
)
|
|
489
|
+
)
|
|
490
|
+
);
|
|
491
|
+
}, selectionOptions)
|
|
492
|
+
)
|
|
493
|
+
)
|
|
494
|
+
)
|
|
495
|
+
);
|
|
496
|
+
};
|
|
497
|
+
|
|
498
|
+
AdvancedSelection.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
499
|
+
id: PropTypes.string,
|
|
500
|
+
accessibility: PropTypes.bool,
|
|
501
|
+
disableAccessor: PropTypes.func,
|
|
502
|
+
HTMLRenderer: PropTypes.func,
|
|
503
|
+
filter: PropTypes.object,
|
|
504
|
+
selection: PropTypes.object,
|
|
505
|
+
allSelection: PropTypes.object,
|
|
506
|
+
setAllSelection: PropTypes.func,
|
|
507
|
+
setSelection: PropTypes.func,
|
|
508
|
+
isRtl: PropTypes.bool,
|
|
509
|
+
isNarrow: PropTypes.bool,
|
|
510
|
+
items: PropTypes.array,
|
|
511
|
+
labels: PropTypes.shape({
|
|
512
|
+
placeholder: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
|
|
513
|
+
disableItemLabel: PropTypes.string,
|
|
514
|
+
singleSelection: PropTypes.string,
|
|
515
|
+
childrenSelection: PropTypes.string,
|
|
516
|
+
branchSelection: PropTypes.string,
|
|
517
|
+
levelSelection: PropTypes.string,
|
|
518
|
+
selectAll: PropTypes.string,
|
|
519
|
+
deselectAll: PropTypes.string,
|
|
520
|
+
apply: PropTypes.string,
|
|
521
|
+
cancel: PropTypes.string
|
|
522
|
+
}),
|
|
523
|
+
labelRenderer: PropTypes.func,
|
|
524
|
+
expandAll: PropTypes.func,
|
|
525
|
+
collapseAll: PropTypes.func,
|
|
526
|
+
spotlight: PropTypes.object,
|
|
527
|
+
setSpotlight: PropTypes.func,
|
|
528
|
+
expandedIds: PropTypes.object,
|
|
529
|
+
allItems: PropTypes.array
|
|
530
|
+
} : {};
|
|
531
|
+
|
|
532
|
+
export default withSpotlight(withExpansionTree(AdvancedSelection));
|