@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.
@@ -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 onChangeFrequency = function onChangeFrequency(value) {
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
- React.createElement(
104
- Grid,
105
- { container: true, direction: 'row' },
106
- React.createElement(
107
- Grid,
108
- { item: true, xs: 12 },
109
- React.createElement(Select, {
110
- id: labels.frequency,
111
- label: labels.frequency,
112
- onChange: onChangeFrequency,
113
- value: frequency,
114
- items: frequencies
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) && R.map(function (_ref3) {
120
- var getter = _ref3.getter,
121
- layout = _ref3.layout,
122
- label = _ref3.label,
123
- value = _ref3.value,
124
- testId = _ref3.testId,
125
- getIsDisabled = _ref3.getIsDisabled;
126
- return React.createElement(
127
- Grid,
128
- { key: getter, item: true, xs: 12, 'data-testid': testId },
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
- { container: true, direction: 'row' },
132
+ { key: getter, item: true, xs: 5, 'data-testid': testId, justifyContent: 'space-between' },
132
133
  React.createElement(
133
134
  Grid,
134
- { item: true, xs: 12, className: classes.sideLabel },
135
+ { container: true, direction: 'row' },
135
136
  React.createElement(
136
- Typography,
137
- {
138
- variant: 'body2',
139
- tabIndex: 0 // eslint-disable-line jsx-a11y/no-noninteractive-tabindex
140
- , 'aria-label': label
141
- },
142
- label
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
- { item: true, xs: 12 },
152
+ { container: true, direction: 'row' },
152
153
  React.createElement(
153
154
  Grid,
154
- { container: true, className: classes.headerContainer, spacing: 1 },
155
- R.map(function (row) {
156
- return R.map(function (_ref4) {
157
- var id = _ref4.id,
158
- values = _ref4.values;
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
- var selectedValue = R.isNil(R.prop(id)(value)) ? R.head(values) : R.prop(id)(value);
161
- return React.createElement(
162
- Grid,
163
- {
164
- key: id,
165
- item: true,
166
- xs: 12 / R.length(row),
167
- className: classes.selectContainer
168
- },
169
- React.createElement(Select, {
170
- onChange: onChangePeriod(getter, id),
171
- label: R.prop(id)(labels),
172
- id: id + '-' + label,
173
- dataTestId: id + '-' + label + '-test-id',
174
- value: selectedValue,
175
- disabled: disabled || false,
176
- items: R.map(function (option) {
177
- return {
178
- id: id,
179
- value: option,
180
- disabled: getIsDisabled(option, id),
181
- label: R.ifElse(R.is(String), R.identity, R.prop(id)(numeralFormat))(option)
182
- };
183
- })(values)
184
- })
185
- );
186
- })(row);
187
- })(layout)
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
- getter: 'start',
194
- testId: 'period-picker-start-period-test-id',
195
- layout: getLayout(frequency, R.head(ranges)),
196
- label: R.prop('start')(labels),
197
- value: getPeriodValue(R.head(destructuringDates)),
198
- getIsDisabled: _getIsDisabled('start')
199
- }, {
200
- getter: 'end',
201
- testId: 'period-picker-end-period-test-id',
202
- layout: getLayout(frequency, R.last(ranges), /*R.last(availableRanges)*/[]),
203
- label: R.prop('end')(labels),
204
- value: getPeriodValue(R.last(destructuringDates)),
205
- getIsDisabled: _getIsDisabled('end')
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';