@sis-cc/dotstatsuite-visions 12.18.0 → 12.19.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 +483 -0
- package/es/DynamicDrawer/DynamicDrawer.js +265 -0
- package/es/DynamicDrawer/SelectionModesMobile.js +93 -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 +538 -0
- package/lib/DynamicDrawer/DynamicDrawer.js +299 -0
- package/lib/DynamicDrawer/SelectionModesMobile.js +116 -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 +43291 -42488
- package/umd/@sis-cc/dotstatsuite-visions.min.js +10 -10
- package/umd/@sis-cc/dotstatsuite-visions.min.js.map +1 -1
|
@@ -0,0 +1,265 @@
|
|
|
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 Box from '@mui/material/Box';
|
|
9
|
+
import AdvancedSelection from './AdvancedSelection';
|
|
10
|
+
import { Paper, Tab, Tabs, Typography } from '@mui/material';
|
|
11
|
+
import makeStyles from '@mui/styles/makeStyles';
|
|
12
|
+
import CloseIcon from '@mui/icons-material/Close';
|
|
13
|
+
import IconButton from '@mui/material/Button';
|
|
14
|
+
import { Button } from '..';
|
|
15
|
+
|
|
16
|
+
var useStyles = makeStyles(function (theme) {
|
|
17
|
+
return {
|
|
18
|
+
label: _extends({
|
|
19
|
+
textTransform: 'none',
|
|
20
|
+
color: theme.palette.grey[700]
|
|
21
|
+
}, R.pathOr({}, ['mixins', 'expansionPanel', 'title'], theme)),
|
|
22
|
+
tabPanel: {
|
|
23
|
+
backgroundColor: theme.palette.background.default,
|
|
24
|
+
position: 'absolute',
|
|
25
|
+
top: '176px',
|
|
26
|
+
zIndex: 1000,
|
|
27
|
+
width: '80vw',
|
|
28
|
+
height: '100vh',
|
|
29
|
+
left: '200px'
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
var TabPanel = function TabPanel(props) {
|
|
35
|
+
var children = props.children,
|
|
36
|
+
open = props.open,
|
|
37
|
+
item = props.item,
|
|
38
|
+
classes = props.classes,
|
|
39
|
+
labels = props.labels,
|
|
40
|
+
onClose = props.onClose,
|
|
41
|
+
other = _objectWithoutProperties(props, ['children', 'open', 'item', 'classes', 'labels', 'onClose']);
|
|
42
|
+
|
|
43
|
+
return React.createElement(
|
|
44
|
+
'div',
|
|
45
|
+
_extends({
|
|
46
|
+
role: 'tabpanel',
|
|
47
|
+
hidden: !open,
|
|
48
|
+
id: 'vertical-tabpanel-' + item.index,
|
|
49
|
+
'aria-labelledby': 'vertical-tab-' + item.index,
|
|
50
|
+
className: classes.tabPanel
|
|
51
|
+
}, other),
|
|
52
|
+
open && React.createElement(
|
|
53
|
+
Box,
|
|
54
|
+
{ sx: { p: 3 } },
|
|
55
|
+
React.createElement(
|
|
56
|
+
IconButton,
|
|
57
|
+
{
|
|
58
|
+
onClick: onClose,
|
|
59
|
+
'aria-label': R.prop('cancel', labels),
|
|
60
|
+
sx: {
|
|
61
|
+
color: 'grey !important',
|
|
62
|
+
padding: 0,
|
|
63
|
+
float: 'right'
|
|
64
|
+
},
|
|
65
|
+
size: 'large'
|
|
66
|
+
},
|
|
67
|
+
React.createElement(CloseIcon, null)
|
|
68
|
+
),
|
|
69
|
+
children
|
|
70
|
+
)
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
TabPanel.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
74
|
+
item: PropTypes.object,
|
|
75
|
+
open: PropTypes.bool,
|
|
76
|
+
classes: PropTypes.object,
|
|
77
|
+
labels: PropTypes.object,
|
|
78
|
+
onClose: PropTypes.func,
|
|
79
|
+
children: PropTypes.node
|
|
80
|
+
} : {};
|
|
81
|
+
|
|
82
|
+
var PaperComponent = function PaperComponent(props) {
|
|
83
|
+
var classes = useStyles();
|
|
84
|
+
// const Chip = R.isNil(props.tag) ? InternalTag : props.tag;
|
|
85
|
+
return React.createElement(
|
|
86
|
+
Paper,
|
|
87
|
+
props,
|
|
88
|
+
React.createElement(
|
|
89
|
+
Typography,
|
|
90
|
+
{ noWrap: true, variant: 'body2', title: props.label, className: classes.label },
|
|
91
|
+
props.label
|
|
92
|
+
)
|
|
93
|
+
);
|
|
94
|
+
};
|
|
95
|
+
PaperComponent.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
96
|
+
label: PropTypes.string,
|
|
97
|
+
tag: PropTypes.elementType,
|
|
98
|
+
items: PropTypes.array,
|
|
99
|
+
tagValueLabel: PropTypes.func,
|
|
100
|
+
tagValue: PropTypes.string
|
|
101
|
+
} : {};
|
|
102
|
+
|
|
103
|
+
var DynamicDrawer = function DynamicDrawer(props) {
|
|
104
|
+
var _useState = useState(false),
|
|
105
|
+
open = _useState[0],
|
|
106
|
+
setOpen = _useState[1];
|
|
107
|
+
|
|
108
|
+
var _useState2 = useState({}),
|
|
109
|
+
filter = _useState2[0],
|
|
110
|
+
setFilter = _useState2[1];
|
|
111
|
+
|
|
112
|
+
var _useState3 = useState({}),
|
|
113
|
+
selection = _useState3[0],
|
|
114
|
+
setSelection = _useState3[1];
|
|
115
|
+
|
|
116
|
+
var _useState4 = useState({}),
|
|
117
|
+
allSelection = _useState4[0],
|
|
118
|
+
setAllSelection = _useState4[1];
|
|
119
|
+
|
|
120
|
+
var list = props.list,
|
|
121
|
+
labelRenderer = props.labelRenderer,
|
|
122
|
+
onClick = props.onClick,
|
|
123
|
+
handleChangePanel = props.handleChangePanel,
|
|
124
|
+
isNarrow = props.isNarrow,
|
|
125
|
+
labels = props.labels,
|
|
126
|
+
_props$disableAccesso = props.disableAccessor,
|
|
127
|
+
disableAccessor = _props$disableAccesso === undefined ? R.always(false) : _props$disableAccesso,
|
|
128
|
+
expandAll = props.expandAll,
|
|
129
|
+
collapseAll = props.collapseAll,
|
|
130
|
+
expandedIds = props.expandedIds,
|
|
131
|
+
allItems = props.allItems,
|
|
132
|
+
periodPanel = props.periodPanel,
|
|
133
|
+
classes = props.classes,
|
|
134
|
+
tag = props.tag,
|
|
135
|
+
_props$testId = props.testId,
|
|
136
|
+
testId = _props$testId === undefined ? 'tabs' : _props$testId,
|
|
137
|
+
children = props.children,
|
|
138
|
+
rest = _objectWithoutProperties(props, ['list', 'labelRenderer', 'onClick', 'handleChangePanel', 'isNarrow', 'labels', 'disableAccessor', 'expandAll', 'collapseAll', 'expandedIds', 'allItems', 'periodPanel', 'classes', 'tag', 'testId', 'children']);
|
|
139
|
+
|
|
140
|
+
var handleChange = function handleChange(e, item) {
|
|
141
|
+
console.log({ item: item, selection: selection, allSelection: allSelection });
|
|
142
|
+
setSelection(_extends({}, allSelection[item.id]));
|
|
143
|
+
handleChangePanel(item.id, allSelection);
|
|
144
|
+
setFilter(item);
|
|
145
|
+
setOpen(true);
|
|
146
|
+
};
|
|
147
|
+
var handleSubmit = function handleSubmit() {
|
|
148
|
+
onClick(allSelection);
|
|
149
|
+
setAllSelection({});
|
|
150
|
+
setSelection({});
|
|
151
|
+
setOpen(false);
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
return React.createElement(
|
|
155
|
+
'div',
|
|
156
|
+
{ style: { display: 'flex', flexDirection: 'row' } },
|
|
157
|
+
React.createElement(
|
|
158
|
+
Tabs,
|
|
159
|
+
{
|
|
160
|
+
orientation: 'vertical',
|
|
161
|
+
variant: 'scrollable',
|
|
162
|
+
value: false,
|
|
163
|
+
onChange: handleChange,
|
|
164
|
+
'aria-label': 'filters',
|
|
165
|
+
'data-testid': testId,
|
|
166
|
+
sx: { width: '100%', height: '100%', borderRight: 1, borderColor: 'divider' }
|
|
167
|
+
},
|
|
168
|
+
R.map(function (item) {
|
|
169
|
+
return React.createElement(Tab, {
|
|
170
|
+
key: item.id,
|
|
171
|
+
id: filter.id,
|
|
172
|
+
'data-testid': item.id + '-tab',
|
|
173
|
+
component: function component(props) {
|
|
174
|
+
return PaperComponent(_extends({ label: labelRenderer(item), tag: tag }, props));
|
|
175
|
+
},
|
|
176
|
+
label: labelRenderer(item),
|
|
177
|
+
'aria-label': labelRenderer(item),
|
|
178
|
+
sx: { alignItems: 'start', maxWidth: '100%' },
|
|
179
|
+
value: item,
|
|
180
|
+
'aria-selected': filter.id === item.id,
|
|
181
|
+
wrapped: true
|
|
182
|
+
});
|
|
183
|
+
})(list),
|
|
184
|
+
open && React.createElement(
|
|
185
|
+
Button,
|
|
186
|
+
{
|
|
187
|
+
sx: { float: 'bottom', margin: '10px' },
|
|
188
|
+
'aria-label': R.prop('apply', labels),
|
|
189
|
+
id: 'apply_button',
|
|
190
|
+
variant: 'contained',
|
|
191
|
+
onClick: handleSubmit
|
|
192
|
+
},
|
|
193
|
+
R.prop('apply', labels)
|
|
194
|
+
)
|
|
195
|
+
),
|
|
196
|
+
React.createElement(
|
|
197
|
+
TabPanel,
|
|
198
|
+
{
|
|
199
|
+
item: filter,
|
|
200
|
+
'data-testid': testId + '_panel',
|
|
201
|
+
open: open,
|
|
202
|
+
labels: labels,
|
|
203
|
+
classes: classes,
|
|
204
|
+
onClose: function onClose() {
|
|
205
|
+
return setOpen(false);
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
R.equals(filter.id, periodPanel) ? children : React.createElement(AdvancedSelection, _extends({
|
|
209
|
+
id: filter.id,
|
|
210
|
+
items: filter.values,
|
|
211
|
+
isOpen: open,
|
|
212
|
+
labelRenderer: labelRenderer,
|
|
213
|
+
disableAccessor: disableAccessor ? R.pipe(R.prop('isEnabled'), R.not) : undefined,
|
|
214
|
+
labels: labels,
|
|
215
|
+
isNarrow: isNarrow,
|
|
216
|
+
expandAll: expandAll,
|
|
217
|
+
collapseAll: collapseAll,
|
|
218
|
+
expandedIds: expandedIds,
|
|
219
|
+
allItems: allItems,
|
|
220
|
+
selection: selection,
|
|
221
|
+
setSelection: setSelection,
|
|
222
|
+
setAllSelection: setAllSelection,
|
|
223
|
+
allSelection: allSelection
|
|
224
|
+
}, rest, {
|
|
225
|
+
filter: filter
|
|
226
|
+
}))
|
|
227
|
+
)
|
|
228
|
+
);
|
|
229
|
+
};
|
|
230
|
+
DynamicDrawer.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
231
|
+
classes: PropTypes.object,
|
|
232
|
+
testId: PropTypes.string,
|
|
233
|
+
list: PropTypes.array,
|
|
234
|
+
labelAccessor: PropTypes.func,
|
|
235
|
+
tagAccessor: PropTypes.func,
|
|
236
|
+
tagValueLabel: PropTypes.func,
|
|
237
|
+
tag: PropTypes.elementType,
|
|
238
|
+
tagAriaLabel: PropTypes.func,
|
|
239
|
+
handleChangePanel: PropTypes.func,
|
|
240
|
+
displayChildren: PropTypes.func,
|
|
241
|
+
labels: PropTypes.shape({
|
|
242
|
+
placeholder: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
|
|
243
|
+
disableItemLabel: PropTypes.string,
|
|
244
|
+
singleSelection: PropTypes.string,
|
|
245
|
+
childrenSelection: PropTypes.string,
|
|
246
|
+
branchSelection: PropTypes.string,
|
|
247
|
+
levelSelection: PropTypes.string,
|
|
248
|
+
selectAll: PropTypes.string,
|
|
249
|
+
deselectAll: PropTypes.string,
|
|
250
|
+
apply: PropTypes.string,
|
|
251
|
+
cancel: PropTypes.string
|
|
252
|
+
}),
|
|
253
|
+
labelRenderer: PropTypes.func,
|
|
254
|
+
expandAll: PropTypes.func,
|
|
255
|
+
collapseAll: PropTypes.func,
|
|
256
|
+
expandedIds: PropTypes.object,
|
|
257
|
+
allItems: PropTypes.array,
|
|
258
|
+
onClick: PropTypes.func,
|
|
259
|
+
periodPanel: PropTypes.string,
|
|
260
|
+
isNarrow: PropTypes.bool,
|
|
261
|
+
disableAccessor: PropTypes.func,
|
|
262
|
+
children: PropTypes.node
|
|
263
|
+
} : {};
|
|
264
|
+
|
|
265
|
+
export default DynamicDrawer;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import cx from 'classnames';
|
|
4
|
+
import * as R from 'ramda';
|
|
5
|
+
import { Box, Button, Paper, Typography } from '@mui/material';
|
|
6
|
+
import { Tooltip } from '..';
|
|
7
|
+
|
|
8
|
+
var mapIndexed = R.addIndex(R.map);
|
|
9
|
+
var ButtonCarousel = function ButtonCarousel(_ref) {
|
|
10
|
+
var _cx;
|
|
11
|
+
|
|
12
|
+
var selectionModes = _ref.selectionModes,
|
|
13
|
+
selectionMode = _ref.selectionMode,
|
|
14
|
+
setSelectionMode = _ref.setSelectionMode,
|
|
15
|
+
isNarrow = _ref.isNarrow,
|
|
16
|
+
classes = _ref.classes;
|
|
17
|
+
|
|
18
|
+
return React.createElement(
|
|
19
|
+
Box,
|
|
20
|
+
{
|
|
21
|
+
sx: {
|
|
22
|
+
display: 'flex',
|
|
23
|
+
overflowX: 'auto',
|
|
24
|
+
gap: 2,
|
|
25
|
+
padding: 2,
|
|
26
|
+
scrollSnapType: 'x mandatory',
|
|
27
|
+
'&::-webkit-scrollbar': { display: 'none' }, // Hide scrollbar on Webkit
|
|
28
|
+
scrollbarWidth: 'none' // Hide scrollbar on Firefox
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
React.createElement(
|
|
32
|
+
'div',
|
|
33
|
+
{ className: cx(classes.selectModeContainer, (_cx = {}, _cx[classes.narrowHeader] = isNarrow, _cx)) },
|
|
34
|
+
mapIndexed(function (_ref2) {
|
|
35
|
+
var value = _ref2.value,
|
|
36
|
+
label = _ref2.label,
|
|
37
|
+
img = _ref2.img;
|
|
38
|
+
return React.createElement(
|
|
39
|
+
Tooltip,
|
|
40
|
+
{
|
|
41
|
+
key: value,
|
|
42
|
+
classes: { tooltip: classes.tooltip },
|
|
43
|
+
title: React.createElement('img', { style: { width: '72px', height: '90px' }, src: img, alt: value }),
|
|
44
|
+
tabIndex: -1
|
|
45
|
+
},
|
|
46
|
+
React.createElement(
|
|
47
|
+
Button,
|
|
48
|
+
{
|
|
49
|
+
className: classes.selectButton,
|
|
50
|
+
selected: value === selectionMode,
|
|
51
|
+
onClick: function onClick() {
|
|
52
|
+
setSelectionMode(value);
|
|
53
|
+
},
|
|
54
|
+
'aria-pressed': value === selectionMode,
|
|
55
|
+
'aria-label': label,
|
|
56
|
+
tabIndex: 0,
|
|
57
|
+
sx: {
|
|
58
|
+
flex: '0 0 auto', // Prevents buttons from shrinking
|
|
59
|
+
scrollSnapAlign: 'center',
|
|
60
|
+
minWidth: 120, // Minimum width for buttons
|
|
61
|
+
whiteSpace: 'nowrap'
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
React.createElement(
|
|
65
|
+
Paper,
|
|
66
|
+
{ elevation: 0, className: classes.selectModeItem, key: value },
|
|
67
|
+
React.createElement(
|
|
68
|
+
Typography,
|
|
69
|
+
null,
|
|
70
|
+
label
|
|
71
|
+
),
|
|
72
|
+
!R.isNil(img) && R.is(String, img) && React.createElement('img', { src: img, alt: value })
|
|
73
|
+
)
|
|
74
|
+
)
|
|
75
|
+
);
|
|
76
|
+
}, selectionModes)
|
|
77
|
+
)
|
|
78
|
+
);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export default ButtonCarousel;
|
|
82
|
+
|
|
83
|
+
ButtonCarousel.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
84
|
+
selectionModes: PropTypes.arrayOf(PropTypes.shape({
|
|
85
|
+
value: PropTypes.string.isRequired,
|
|
86
|
+
label: PropTypes.string.isRequired,
|
|
87
|
+
img: PropTypes.string
|
|
88
|
+
})).isRequired,
|
|
89
|
+
selectionMode: PropTypes.string.isRequired,
|
|
90
|
+
setSelectionMode: PropTypes.func.isRequired,
|
|
91
|
+
classes: PropTypes.object.isRequired,
|
|
92
|
+
isNarrow: PropTypes.bool.isRequired
|
|
93
|
+
} : {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @memberOf VISIONS
|
|
3
|
+
* @name DynamicDrawer
|
|
4
|
+
* @tag component
|
|
5
|
+
* @api public
|
|
6
|
+
* @props
|
|
7
|
+
* DynamicDrawer.propTypes = {
|
|
8
|
+
* classes: PropTypes.object,
|
|
9
|
+
* testId: PropTypes.string,
|
|
10
|
+
* list: PropTypes.array,
|
|
11
|
+
* labelAccessor: PropTypes.func,
|
|
12
|
+
* tagAccessor: PropTypes.func,
|
|
13
|
+
* tagValueLabel: PropTypes.func,
|
|
14
|
+
* tag: PropTypes.elementType,
|
|
15
|
+
* tagAriaLabel: PropTypes.func,
|
|
16
|
+
* handleChangePanel: PropTypes.func,
|
|
17
|
+
* displayChildren: PropTypes.func,
|
|
18
|
+
* labels: PropTypes.shape({
|
|
19
|
+
* placeholder: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
|
|
20
|
+
* disableItemLabel: PropTypes.string,
|
|
21
|
+
* singleSelection: PropTypes.string,
|
|
22
|
+
* childrenSelection: PropTypes.string,
|
|
23
|
+
* branchSelection: PropTypes.string,
|
|
24
|
+
* levelSelection: PropTypes.string,
|
|
25
|
+
* selectAll: PropTypes.string,
|
|
26
|
+
* deselectAll: PropTypes.string,
|
|
27
|
+
* apply: PropTypes.string,
|
|
28
|
+
* cancel: PropTypes.string,
|
|
29
|
+
* }),
|
|
30
|
+
* labelRenderer: PropTypes.func,
|
|
31
|
+
* expandAll: PropTypes.func,
|
|
32
|
+
* collapseAll: PropTypes.func,
|
|
33
|
+
* expandedIds: PropTypes.object,
|
|
34
|
+
* allItems: PropTypes.array,
|
|
35
|
+
* onClick: PropTypes.func,
|
|
36
|
+
* periodPanel: PropTypes.string,
|
|
37
|
+
* isNarrow: PropTypes.bool,
|
|
38
|
+
* disableAccessor: PropTypes.func,
|
|
39
|
+
* children: PropTypes.node,
|
|
40
|
+
* },
|
|
41
|
+
* }
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
export { default } from './DynamicDrawer';
|
|
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
|
|
|
4
4
|
import dateFns from 'date-fns';
|
|
5
5
|
import { Grid, Typography } from '@mui/material';
|
|
6
6
|
import { numeralFormat } from './lib';
|
|
7
|
-
import { Select } from '../';
|
|
7
|
+
import { Button, Select } from '../';
|
|
8
8
|
import useStyles from './styles';
|
|
9
9
|
import { defaultfreq } from './constants';
|
|
10
10
|
import { getRange, getFrequencyOptions, getDefaultFrequency, getLayout, getPeriodValue, getDate, getDateInTheRange, getDestructuringDate, isValidNumber } from './lib';
|
|
@@ -46,7 +46,8 @@ var Period = function Period(_ref) {
|
|
|
46
46
|
var showFrequency = R.and(R.gt(R.length(frequencies), 1), R.not(frequencyDisabled));
|
|
47
47
|
var destructuringDates = R.map(getDestructuringDate)(period);
|
|
48
48
|
|
|
49
|
-
var
|
|
49
|
+
var onClickFrequency = function onClickFrequency(e, value) {
|
|
50
|
+
console.log(value);
|
|
50
51
|
if (R.is(Function, changeFrequency)) return changeFrequency(value);
|
|
51
52
|
};
|
|
52
53
|
var _getIsDisabled = function _getIsDisabled(getter) {
|
|
@@ -100,110 +101,114 @@ var Period = function Period(_ref) {
|
|
|
100
101
|
className: classes.headerContainer,
|
|
101
102
|
'data-testid': 'period-picker-frequency-test-id'
|
|
102
103
|
},
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
)
|
|
117
|
-
)
|
|
104
|
+
R.map(function (freq) {
|
|
105
|
+
return React.createElement(
|
|
106
|
+
Button,
|
|
107
|
+
{
|
|
108
|
+
sx: { margin: 2 },
|
|
109
|
+
'aria-label': freq.label,
|
|
110
|
+
key: freq.value,
|
|
111
|
+
onClick: function onClick(e) {
|
|
112
|
+
return onClickFrequency(e, R.prop('value', freq));
|
|
113
|
+
},
|
|
114
|
+
selected: frequency
|
|
115
|
+
},
|
|
116
|
+
freq.label
|
|
117
|
+
);
|
|
118
|
+
})(frequencies)
|
|
118
119
|
),
|
|
119
|
-
R.not(isPeriodDisabled) &&
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
React.createElement(
|
|
120
|
+
R.not(isPeriodDisabled) && React.createElement(
|
|
121
|
+
Grid,
|
|
122
|
+
{ container: true, xs: 12, justifyContent: 'space-between' },
|
|
123
|
+
R.map(function (_ref3) {
|
|
124
|
+
var getter = _ref3.getter,
|
|
125
|
+
layout = _ref3.layout,
|
|
126
|
+
label = _ref3.label,
|
|
127
|
+
value = _ref3.value,
|
|
128
|
+
testId = _ref3.testId,
|
|
129
|
+
getIsDisabled = _ref3.getIsDisabled;
|
|
130
|
+
return React.createElement(
|
|
130
131
|
Grid,
|
|
131
|
-
{
|
|
132
|
+
{ key: getter, item: true, xs: 5, 'data-testid': testId, justifyContent: 'space-between' },
|
|
132
133
|
React.createElement(
|
|
133
134
|
Grid,
|
|
134
|
-
{
|
|
135
|
+
{ container: true, direction: 'row' },
|
|
135
136
|
React.createElement(
|
|
136
|
-
|
|
137
|
-
{
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
137
|
+
Grid,
|
|
138
|
+
{ item: true, xs: 12, className: classes.sideLabel },
|
|
139
|
+
React.createElement(
|
|
140
|
+
Typography,
|
|
141
|
+
{
|
|
142
|
+
variant: 'body2',
|
|
143
|
+
tabIndex: 0 // eslint-disable-line jsx-a11y/no-noninteractive-tabindex
|
|
144
|
+
, 'aria-label': label
|
|
145
|
+
},
|
|
146
|
+
label
|
|
147
|
+
)
|
|
143
148
|
)
|
|
144
|
-
)
|
|
145
|
-
),
|
|
146
|
-
React.createElement(
|
|
147
|
-
Grid,
|
|
148
|
-
{ container: true, direction: 'row' },
|
|
149
|
+
),
|
|
149
150
|
React.createElement(
|
|
150
151
|
Grid,
|
|
151
|
-
{
|
|
152
|
+
{ container: true, direction: 'row' },
|
|
152
153
|
React.createElement(
|
|
153
154
|
Grid,
|
|
154
|
-
{
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
155
|
+
{ item: true, xs: 12 },
|
|
156
|
+
React.createElement(
|
|
157
|
+
Grid,
|
|
158
|
+
{ container: true, className: classes.headerContainer, spacing: 1 },
|
|
159
|
+
R.map(function (row) {
|
|
160
|
+
return R.map(function (_ref4) {
|
|
161
|
+
var id = _ref4.id,
|
|
162
|
+
values = _ref4.values;
|
|
159
163
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
164
|
+
var selectedValue = R.isNil(R.prop(id)(value)) ? R.head(values) : R.prop(id)(value);
|
|
165
|
+
return React.createElement(
|
|
166
|
+
Grid,
|
|
167
|
+
{
|
|
168
|
+
key: id,
|
|
169
|
+
item: true,
|
|
170
|
+
xs: 12 / R.length(row),
|
|
171
|
+
className: classes.selectContainer
|
|
172
|
+
},
|
|
173
|
+
React.createElement(Select, {
|
|
174
|
+
onChange: onChangePeriod(getter, id),
|
|
175
|
+
label: R.prop(id)(labels),
|
|
176
|
+
id: id + '-' + label,
|
|
177
|
+
dataTestId: id + '-' + label + '-test-id',
|
|
178
|
+
value: selectedValue,
|
|
179
|
+
disabled: disabled || false,
|
|
180
|
+
items: R.map(function (option) {
|
|
181
|
+
return {
|
|
182
|
+
id: id,
|
|
183
|
+
value: option,
|
|
184
|
+
disabled: getIsDisabled(option, id),
|
|
185
|
+
label: R.ifElse(R.is(String), R.identity, R.prop(id)(numeralFormat))(option)
|
|
186
|
+
};
|
|
187
|
+
})(values)
|
|
188
|
+
})
|
|
189
|
+
);
|
|
190
|
+
})(row);
|
|
191
|
+
})(layout)
|
|
192
|
+
)
|
|
188
193
|
)
|
|
189
194
|
)
|
|
190
|
-
)
|
|
191
|
-
)
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
195
|
+
);
|
|
196
|
+
})([{
|
|
197
|
+
getter: 'start',
|
|
198
|
+
testId: 'period-picker-start-period-test-id',
|
|
199
|
+
layout: getLayout(frequency, R.head(ranges)),
|
|
200
|
+
label: R.prop('start')(labels),
|
|
201
|
+
value: getPeriodValue(R.head(destructuringDates)),
|
|
202
|
+
getIsDisabled: _getIsDisabled('start')
|
|
203
|
+
}, {
|
|
204
|
+
getter: 'end',
|
|
205
|
+
testId: 'period-picker-end-period-test-id',
|
|
206
|
+
layout: getLayout(frequency, R.last(ranges), /*R.last(availableRanges)*/[]),
|
|
207
|
+
label: R.prop('end')(labels),
|
|
208
|
+
value: getPeriodValue(R.last(destructuringDates)),
|
|
209
|
+
getIsDisabled: _getIsDisabled('end')
|
|
210
|
+
}])
|
|
211
|
+
)
|
|
207
212
|
);
|
|
208
213
|
};
|
|
209
214
|
|
package/es/index.js
CHANGED
|
@@ -16,6 +16,7 @@ export { default as DataEdit } from './DataEdit';
|
|
|
16
16
|
export { default as Dataflow } from './Dataflow';
|
|
17
17
|
export { default as DataHeader } from './DataHeader';
|
|
18
18
|
export { default as DataFooter } from './DataFooter';
|
|
19
|
+
export { default as DynamicDrawer } from './DynamicDrawer';
|
|
19
20
|
export { default as ExpansionPanel } from './ExpansionPanel';
|
|
20
21
|
export * from './Icons';
|
|
21
22
|
export { default as Input } from './Input';
|