ebta-workflow-prod 4.1.0 → 4.1.2

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.0",
4
+ "version": "4.1.2",
5
5
  "description": "",
6
6
  "license": "UNLICENSED",
7
7
  "author": "",
@@ -33,6 +33,7 @@
33
33
  "@mantine/core": "^7.16.0",
34
34
  "@mantine/hooks": "^9.5.1",
35
35
  "@mui/icons-material": "^5.17.1",
36
+ "@mui/base": "5.0.0-beta.70",
36
37
  "@mui/material": "^5.17.1",
37
38
  "@mui/x-charts": "^7.6.2",
38
39
  "@turf/turf": "^6.5.0",
@@ -18,14 +18,10 @@ import Box from "@vertigis/web/ui/Box"
18
18
  import Checkbox from "@vertigis/web/ui/Checkbox"
19
19
  import { ThemeProvider } from "@emotion/react";
20
20
  import Typography from '@vertigis/web/ui/Typography';
21
- // import { DateRangePicker } from '@mui/x-date-pickers-pro/DateRangePicker';
22
21
  import dayjs, { Dayjs } from 'dayjs';
23
22
  import timezone from 'dayjs/plugin/timezone';
24
23
  import utc from 'dayjs/plugin/utc';
25
24
  import customParseFormat from 'dayjs/plugin/customParseFormat'
26
- // import { DemoContainer } from '@mui/x-date-pickers/internals/demo';
27
- // import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
28
- // import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
29
25
  import 'dayjs/locale/en-au';
30
26
  import Chip from '@mui/material/Chip';
31
27
  import Button from '@vertigis/web/ui/Button';
@@ -35,7 +31,7 @@ import FormControlLabel from '@vertigis/web/ui/FormControlLabel';
35
31
  import AttributeFilterEasyComp from './modules/AttributeFilterEasyComp';
36
32
  import Stack from '@vertigis/web/ui/Stack';
37
33
  import Graphic from "@arcgis/core/Graphic";
38
- const { Search, SearchIconWrapper, StyledInputBase, StyledBadge, LightTooltip, defaultTheme } = AttributeFilterEasyComp;
34
+ const { Search, SearchIconWrapper, StyledInputBase, StyledBadge, LightTooltip, defaultTheme, CustomNumberInput} = AttributeFilterEasyComp;
39
35
  dayjs.extend(utc);
40
36
  dayjs.extend(timezone);
41
37
  dayjs.extend(customParseFormat);
@@ -1314,6 +1310,8 @@ function AttributeFilter(props: AttributeFilterProps): React.ReactElement {
1314
1310
  setProperty("filteredValues" as any, filterrangeResult)
1315
1311
  };
1316
1312
 
1313
+ const normalizeNumber = (value: number) => Number(value.toFixed(10));
1314
+
1317
1315
  const maxStringLength = 28
1318
1316
  function itemText(item: fieldValue, type?: string) {
1319
1317
  let rawResult: string = ''
@@ -1392,55 +1390,17 @@ function AttributeFilter(props: AttributeFilterProps): React.ReactElement {
1392
1390
  {attribute.uniqValue ?
1393
1391
  (<Collapse in={attribute.display} timeout="auto" unmountOnExit>
1394
1392
  {attribute.type && attribute.type == 'date' && (attribute.uniqValue.length > 6) ?
1395
- // <Box display="flex" alignItems="center" >
1396
- // <LocalizationProvider dateAdapter={AdapterDayjs} >
1397
- // <DemoContainer components={['DatePicker', 'DatePicker']} >
1398
- // <LocalizationProvider dateAdapter={AdapterDayjs} adapterLocale="en-au">
1399
- // <DateRangePicker defaultValue={[dayjs.unix(minDate.current), dayjs.unix(maxDate.current)]} maxDate={dayjs.unix(maxDate.current)} minDate={dayjs.unix(minDate.current)}
1400
- // value={[startDate, endDate]}
1401
- // onChange={([newstart, newend]) => handleDateRangeChange(newstart || startDate, newend || endDate)}
1402
- // sx={{
1403
- // // Customize the date text color
1404
- // '& .MuiInputBase-input': {
1405
- // color: 'var(--accentIconBorder)', // Change text color for the selected date
1406
- // },
1407
-
1408
- // // Customize the start & end labels
1409
- // '& .MuiInputLabel-root': {
1410
- // color: 'var(--accentIconBorder)', // Change label color for both start and end dates
1411
- // },
1412
-
1413
- // // Customize the border color of the input
1414
- // '& .MuiOutlinedInput-root': {
1415
- // '& fieldset': {
1416
- // borderColor: 'var(--accentIconBorder)', // Change border color when the input is not focused
1417
- // },
1418
- // '&:hover fieldset': {
1419
- // borderColor: 'var(--accentIconBorder)', // Change border color on hover
1420
- // },
1421
- // '&.Mui-focused fieldset': {
1422
- // borderColor: 'var(--accentIconBorder)', // Change border color when focused
1423
- // },
1424
- // },
1425
- // }}
1426
-
1427
- // />
1428
- // </LocalizationProvider>
1429
- // </DemoContainer>
1430
- // </LocalizationProvider>
1431
- // </Box>
1432
-
1433
1393
  <Box display="flex" alignItems="center" gap={1}>
1434
1394
  <input
1435
1395
  type="date"
1436
1396
  value={startDate ? startDate.format('YYYY-MM-DD') : ''}
1437
1397
  min={dayjs.unix(minDate.current).format('YYYY-MM-DD')}
1438
1398
  max={dayjs.unix(maxDate.current).format('YYYY-MM-DD')}
1439
- onChange={(e) => {
1440
- const newstart = e.target.value ? dayjs(e.target.value) : startDate;
1441
- handleDateRangeChange(newstart, endDate);
1399
+ onChange={(event) => {
1400
+ const newStart = event.target.value ? dayjs(event.target.value) : startDate;
1401
+ handleDateRangeChange(newStart, endDate);
1442
1402
  }}
1443
- 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 }}
1444
1404
  />
1445
1405
  <span>to</span>
1446
1406
  <input
@@ -1448,18 +1408,52 @@ function AttributeFilter(props: AttributeFilterProps): React.ReactElement {
1448
1408
  value={endDate ? endDate.format('YYYY-MM-DD') : ''}
1449
1409
  min={dayjs.unix(minDate.current).format('YYYY-MM-DD')}
1450
1410
  max={dayjs.unix(maxDate.current).format('YYYY-MM-DD')}
1451
- onChange={(e) => {
1452
- const newend = e.target.value ? dayjs(e.target.value) : endDate;
1453
- handleDateRangeChange(startDate, newend);
1411
+ onChange={(event) => {
1412
+ const newEnd = event.target.value ? dayjs(event.target.value) : endDate;
1413
+ handleDateRangeChange(startDate, newEnd);
1454
1414
  }}
1455
- 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 }}
1456
1416
  />
1457
1417
  </Box>
1458
1418
  :
1459
1419
  ISnumberAttribute && (attribute.uniqValue.length > 6) ?
1460
1420
  //Display String search or number Range , don't display if value amount is limited
1461
1421
  <Box display="flex" alignItems="center">
1462
-
1422
+ <CustomNumberInput aria-label="min value input" placeholder={`Min (${attributeMin} ~ ${attributeMax})`} min={attributeMin - 1} max={attributeMax + 1}
1423
+ value={minValue == -Infinity ? undefined : minValue} step={0.1}
1424
+ onChange={(event, val) => {
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) };
1428
+
1429
+ if ((normalizedValue || normalizedValue == 0) && normalizedValue > maxValue) {
1430
+ setProperty("minValue" as any, maxValue - 1)
1431
+ const filterrangeResult = filterRange(attribute, maxValue - 1, maxValue)
1432
+ setProperty("filteredValues" as any, filterrangeResult)
1433
+ }
1434
+ else {
1435
+ const filterrangeResult = filterRange(attribute, normalizedValue !== null && normalizedValue !== undefined ? normalizedValue : -Infinity, maxValue !== Infinity ? maxValue : Infinity)
1436
+ setProperty("filteredValues" as any, filterrangeResult)
1437
+ }
1438
+ }}
1439
+ />
1440
+ <CustomNumberInput aria-label="max value input" placeholder={`Max (${attributeMin} ~ ${attributeMax})`} min={attributeMin - 1} max={attributeMax + 1}
1441
+ value={maxValue == Infinity ? undefined : maxValue} step={0.1}
1442
+ onChange={(_event, val) => {
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) {
1447
+ setProperty("maxValue" as any, minValue + 1)
1448
+ const filterrangeResult = filterRange(attribute, minValue, minValue + 1)
1449
+ setProperty("filteredValues" as any, filterrangeResult)
1450
+ }
1451
+ else {
1452
+ const filterrangeResult = filterRange(attribute, minValue !== -Infinity ? minValue : -Infinity, normalizedValue !== null && normalizedValue !== undefined ? normalizedValue : Infinity)
1453
+ setProperty("filteredValues" as any, filterrangeResult)
1454
+ }
1455
+ }}
1456
+ />
1463
1457
  </Box>
1464
1458
  :
1465
1459
  (attribute.uniqValue.length > 6) || searchValue ?
@@ -4,11 +4,10 @@ import InputBase from '@mui/material/InputBase';
4
4
  import Badge, { BadgeProps } from '@mui/material/Badge';
5
5
  import Tooltip, { TooltipProps, tooltipClasses } from '@mui/material/Tooltip';
6
6
  import { createTheme } from "@mui/material/styles";
7
- // import {
8
- // Unstable_NumberInput as BaseNumberInput,
9
- // NumberInputProps,
10
- // numberInputClasses,
11
- // } from '@mui/base/Unstable_NumberInput';
7
+ import {
8
+ Unstable_NumberInput as BaseNumberInput,
9
+ NumberInputProps,
10
+ } from '@mui/base/Unstable_NumberInput';
12
11
 
13
12
  const Search =styled('div')(({ theme }) => ({
14
13
  position: 'relative',
@@ -143,31 +142,31 @@ const defaultTheme = createTheme({
143
142
  },
144
143
  });
145
144
 
146
- // const CustomNumberInput =React.forwardRef(function CustomNumberInputfunction(
147
- // props: NumberInputProps,
148
- // ref: React.ForwardedRef<HTMLDivElement>,
149
- // ) {
150
- // return (
151
- // <BaseNumberInput
152
- // slots={{
153
- // root: StyledInputRoot,
154
- // input: StyledInputElement,
155
- // incrementButton: StyledButton,
156
- // decrementButton: StyledButton,
157
- // }}
158
- // slotProps={{
159
- // incrementButton: {
160
- // children: '▴',
161
- // },
162
- // decrementButton: {
163
- // children: '▾',
164
- // },
165
- // }}
166
- // {...props}
167
- // ref={ref}
168
- // />
169
- // );
170
- // })
145
+ const CustomNumberInput = React.forwardRef(function CustomNumberInput(
146
+ props: NumberInputProps,
147
+ ref: React.ForwardedRef<HTMLDivElement>,
148
+ ) {
149
+ return (
150
+ <BaseNumberInput
151
+ slots={{
152
+ root: StyledInputRoot,
153
+ input: StyledInputElement,
154
+ incrementButton: StyledButton,
155
+ decrementButton: StyledButton,
156
+ }}
157
+ slotProps={{
158
+ incrementButton: {
159
+ children: '▴',
160
+ },
161
+ decrementButton: {
162
+ children: '▾',
163
+ },
164
+ }}
165
+ {...props}
166
+ ref={ref}
167
+ />
168
+ );
169
+ });
171
170
 
172
171
  const StyledInputElement = styled('input')(
173
172
  () => `
@@ -220,4 +219,4 @@ const defaultTheme = createTheme({
220
219
  `,
221
220
  );
222
221
 
223
- export default {Search,SearchIconWrapper,StyledInputBase,StyledBadge,StyledInputRoot,StyledInputElement,StyledButton,defaultTheme,LightTooltip}
222
+ export default {Search,SearchIconWrapper,StyledInputBase,StyledBadge,StyledInputRoot,StyledInputElement,StyledButton,CustomNumberInput,defaultTheme,LightTooltip}