ebta-workflow-prod 4.1.1 → 4.1.3

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ebta-workflow-prod",
3
3
  "private": false,
4
- "version": "4.1.1",
4
+ "version": "4.1.3",
5
5
  "description": "",
6
6
  "license": "UNLICENSED",
7
7
  "author": "",
@@ -1310,6 +1310,8 @@ function AttributeFilter(props: AttributeFilterProps): React.ReactElement {
1310
1310
  setProperty("filteredValues" as any, filterrangeResult)
1311
1311
  };
1312
1312
 
1313
+ const normalizeNumber = (value: number) => Number(value.toFixed(1));
1314
+
1313
1315
  const maxStringLength = 28
1314
1316
  function itemText(item: fieldValue, type?: string) {
1315
1317
  let rawResult: string = ''
@@ -1398,7 +1400,7 @@ function AttributeFilter(props: AttributeFilterProps): React.ReactElement {
1398
1400
  const newStart = event.target.value ? dayjs(event.target.value) : startDate;
1399
1401
  handleDateRangeChange(newStart, endDate);
1400
1402
  }}
1401
- style={{ color: 'var(--accentIconBorder)', border: '1px solid var(--accentIconBorder)', borderRadius: 4, padding: '4px 8px', marginRight: 8 }}
1403
+ style={{ color: 'var(--accentIconBorder)', backgroundColor: '#fff', colorScheme: 'light', border: '1px solid var(--accentIconBorder)', borderRadius: 4, padding: '4px 8px', marginRight: 8 }}
1402
1404
  />
1403
1405
  <span>to</span>
1404
1406
  <input
@@ -1410,42 +1412,44 @@ function AttributeFilter(props: AttributeFilterProps): React.ReactElement {
1410
1412
  const newEnd = event.target.value ? dayjs(event.target.value) : endDate;
1411
1413
  handleDateRangeChange(startDate, newEnd);
1412
1414
  }}
1413
- style={{ color: 'var(--accentIconBorder)', border: '1px solid var(--accentIconBorder)', borderRadius: 4, padding: '4px 8px', marginLeft: 8 }}
1415
+ style={{ color: 'var(--accentIconBorder)', backgroundColor: '#fff', colorScheme: 'light', border: '1px solid var(--accentIconBorder)', borderRadius: 4, padding: '4px 8px', marginLeft: 8 }}
1414
1416
  />
1415
1417
  </Box>
1416
1418
  :
1417
1419
  ISnumberAttribute && (attribute.uniqValue.length > 6) ?
1418
1420
  //Display String search or number Range , don't display if value amount is limited
1419
1421
  <Box display="flex" alignItems="center">
1420
- <CustomNumberInput aria-label="min value input" placeholder={`Min (${attributeMin} ~ ${attributeMax})`} min={attributeMin - 1} max={attributeMax + 1}
1421
- value={minValue == -Infinity ? undefined : minValue} step={0.1}
1422
+ <CustomNumberInput aria-label="min value input" placeholder={`Min (${normalizeNumber(attributeMin)} ~ ${normalizeNumber(attributeMax)})`} min={attributeMin - 1} max={attributeMax + 1}
1423
+ value={minValue == -Infinity ? undefined : normalizeNumber(minValue)} step={0.1}
1422
1424
  onChange={(event, val) => {
1423
- if (((val || val == 0) && (val <= maxValue))) { setProperty("minValue" as any, val) };
1424
- if (val == undefined || val == null) { setProperty("minValue" as any, -Infinity) };
1425
+ const normalizedValue = typeof val === 'number' ? normalizeNumber(val) : val;
1426
+ if (((normalizedValue || normalizedValue == 0) && (normalizedValue <= maxValue))) { setProperty("minValue" as any, normalizedValue) };
1427
+ if (normalizedValue == undefined || normalizedValue == null) { setProperty("minValue" as any, -Infinity) };
1425
1428
 
1426
- if ((val || val == 0) && val > maxValue) {
1429
+ if ((normalizedValue || normalizedValue == 0) && normalizedValue > maxValue) {
1427
1430
  setProperty("minValue" as any, maxValue - 1)
1428
1431
  const filterrangeResult = filterRange(attribute, maxValue - 1, maxValue)
1429
1432
  setProperty("filteredValues" as any, filterrangeResult)
1430
1433
  }
1431
1434
  else {
1432
- const filterrangeResult = filterRange(attribute, val !== null ? val : -Infinity, maxValue !== Infinity ? maxValue : Infinity)
1435
+ const filterrangeResult = filterRange(attribute, normalizedValue !== null && normalizedValue !== undefined ? normalizedValue : -Infinity, maxValue !== Infinity ? maxValue : Infinity)
1433
1436
  setProperty("filteredValues" as any, filterrangeResult)
1434
1437
  }
1435
1438
  }}
1436
1439
  />
1437
- <CustomNumberInput aria-label="max value input" placeholder={`Max (${attributeMin} ~ ${attributeMax})`} min={attributeMin - 1} max={attributeMax + 1}
1438
- value={maxValue == Infinity ? undefined : maxValue} step={0.1}
1440
+ <CustomNumberInput aria-label="max value input" placeholder={`Max (${normalizeNumber(attributeMin)} ~ ${normalizeNumber(attributeMax)})`} min={attributeMin - 1} max={attributeMax + 1}
1441
+ value={maxValue == Infinity ? undefined : normalizeNumber(maxValue)} step={0.1}
1439
1442
  onChange={(_event, val) => {
1440
- if ((val || val == 0) && (val >= minValue)) { setProperty("maxValue" as any, val) };
1441
- if (val == undefined) { setProperty("maxValue" as any, Infinity) };
1442
- if ((val || val == 0) && val < minValue) {
1443
+ const normalizedValue = typeof val === 'number' ? normalizeNumber(val) : val;
1444
+ if ((normalizedValue || normalizedValue == 0) && (normalizedValue >= minValue)) { setProperty("maxValue" as any, normalizedValue) };
1445
+ if (normalizedValue == undefined || normalizedValue == null) { setProperty("maxValue" as any, Infinity) };
1446
+ if ((normalizedValue || normalizedValue == 0) && normalizedValue < minValue) {
1443
1447
  setProperty("maxValue" as any, minValue + 1)
1444
1448
  const filterrangeResult = filterRange(attribute, minValue, minValue + 1)
1445
1449
  setProperty("filteredValues" as any, filterrangeResult)
1446
1450
  }
1447
1451
  else {
1448
- const filterrangeResult = filterRange(attribute, minValue !== -Infinity ? minValue : -Infinity, val !== null ? val : Infinity || Infinity)
1452
+ const filterrangeResult = filterRange(attribute, minValue !== -Infinity ? minValue : -Infinity, normalizedValue !== null && normalizedValue !== undefined ? normalizedValue : Infinity)
1449
1453
  setProperty("filteredValues" as any, filterrangeResult)
1450
1454
  }
1451
1455
  }}
@@ -114,6 +114,16 @@ const StyledButton = styled('button')(
114
114
  `,
115
115
  )
116
116
 
117
+ const StyledIncrementButton = styled(StyledButton)({
118
+ gridColumn: 2,
119
+ gridRow: 1,
120
+ });
121
+
122
+ const StyledDecrementButton = styled(StyledButton)({
123
+ gridColumn: 2,
124
+ gridRow: 2,
125
+ });
126
+
117
127
 
118
128
 
119
129
 
@@ -151,17 +161,15 @@ const CustomNumberInput = React.forwardRef(function CustomNumberInput(
151
161
  slots={{
152
162
  root: StyledInputRoot,
153
163
  input: StyledInputElement,
154
- incrementButton: StyledButton,
155
- decrementButton: StyledButton,
164
+ incrementButton: StyledIncrementButton,
165
+ decrementButton: StyledDecrementButton,
156
166
  }}
157
167
  slotProps={{
158
168
  incrementButton: {
159
- children: 'Increase value',
160
- 'aria-label': 'Increase value',
169
+ children: '▴',
161
170
  },
162
171
  decrementButton: {
163
- children: 'Decrease value',
164
- 'aria-label': 'Decrease value',
172
+ children: '▾',
165
173
  },
166
174
  }}
167
175
  {...props}