aefis-core-ui 2.3.0-rc11 → 2.3.0-rc13

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.
@@ -67,10 +67,9 @@ import 'lodash/camelCase';
67
67
  import debounce from 'lodash/debounce';
68
68
  import StepConnector, { stepConnectorClasses } from '@mui/material/StepConnector';
69
69
  import DeleteOutlineOutlinedIcon from '@mui/icons-material/DeleteOutlineOutlined';
70
- import '@mui/icons-material/KeyboardArrowUpOutlined';
71
- import '@mui/icons-material/KeyboardArrowDownOutlined';
72
70
  import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp';
73
71
  import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
72
+ import '@mui/icons-material/MoreVert';
74
73
  import produce from 'immer';
75
74
  import { v4 } from 'uuid';
76
75
  import { MuiForm5 } from '@rjsf/material-ui';
@@ -1913,7 +1912,12 @@ MenuButton.propTypes = {
1913
1912
  /** Button variant */
1914
1913
  variant: PropTypes.oneOf(["contained", "outlined", "text"]),
1915
1914
  /** The type of the button */
1916
- menuConfiguration: PropTypes.array,
1915
+ menuConfiguration: PropTypes.arrayOf(PropTypes.shape({
1916
+ name: PropTypes.string,
1917
+ icon: PropTypes.any,
1918
+ divider: PropTypes.any,
1919
+ onClick: PropTypes.function
1920
+ })),
1917
1921
  /** The function to execute when the button is clicked. */
1918
1922
  onClick: PropTypes.func
1919
1923
  };
@@ -15387,25 +15391,35 @@ function Row({
15387
15391
  })]
15388
15392
  }), /*#__PURE__*/jsx(Box$1, {
15389
15393
  sx: {
15390
- width: "48px"
15394
+ width: "48px",
15395
+ marginTop: "22px"
15391
15396
  },
15392
- children: /*#__PURE__*/jsx(IconButton$1, {
15393
- "aria-label": "delete rule",
15394
- sx: {
15395
- marginTop: "16px",
15396
- marginLeft: "8px"
15397
- },
15398
- onClick: () => onRuleDelete({
15399
- ruleId,
15400
- index,
15401
- ruleIndex,
15402
- groupId
15403
- }),
15404
- children: /*#__PURE__*/jsx(DeleteOutlineOutlinedIcon, {
15405
- sx: {
15406
- color: "grey"
15397
+ children: /*#__PURE__*/jsx(MenuButton, {
15398
+ displayType: "icon",
15399
+ menuConfiguration: [{
15400
+ name: "Move Up",
15401
+ icon: /*#__PURE__*/jsx(KeyboardArrowUpIcon, {}),
15402
+ onClick: () => {}
15403
+ }, {
15404
+ name: "Move Down",
15405
+ icon: /*#__PURE__*/jsx(KeyboardArrowDownIcon, {}),
15406
+ onClick: () => {}
15407
+ }, {
15408
+ name: "Add Rule Below",
15409
+ icon: /*#__PURE__*/jsx(AddIcon, {}),
15410
+ onClick: () => {}
15411
+ }, {
15412
+ name: "Delete",
15413
+ icon: /*#__PURE__*/jsx(DeleteOutlineOutlinedIcon, {}),
15414
+ onClick: () => {
15415
+ onRuleDelete({
15416
+ ruleId,
15417
+ index,
15418
+ ruleIndex,
15419
+ groupId
15420
+ });
15407
15421
  }
15408
- })
15422
+ }]
15409
15423
  })
15410
15424
  })]
15411
15425
  });
@@ -15512,7 +15526,7 @@ const RuleGroupIndex = /*#__PURE__*/memo(({
15512
15526
  flexDirection: "column",
15513
15527
  alignItems: "center",
15514
15528
  position: "relative",
15515
- top: "-8px",
15529
+ top: "0px",
15516
15530
  width: "20px"
15517
15531
  },
15518
15532
  children: [/*#__PURE__*/jsx(IconButton$1, {
@@ -15661,6 +15675,11 @@ const TextBuilder = /*#__PURE__*/memo(({
15661
15675
  setRows(newRules);
15662
15676
  };
15663
15677
  return /*#__PURE__*/jsxs(ContentBox, {
15678
+ sx: {
15679
+ ".MuiFormControl-root": {
15680
+ background: "white"
15681
+ }
15682
+ },
15664
15683
  children: [/*#__PURE__*/jsx(BuilderHeader, {
15665
15684
  onAdd: handleAddGroup,
15666
15685
  children: renderHeader()
@@ -17363,7 +17382,7 @@ const DateSelectReadOnly$1 = ({
17363
17382
  schema
17364
17383
  }) => {
17365
17384
  const value = useMemo(() => {
17366
- if (formData == undefined) return null;
17385
+ if (!(formData != null && formData.date)) return null;
17367
17386
  const date = new Date(formData.date);
17368
17387
  const options = _extends({}, formData.type === "y" && {
17369
17388
  year: "numeric"
@@ -17413,30 +17432,37 @@ const DateSelect = props => {
17413
17432
  rawErrors,
17414
17433
  disabled
17415
17434
  } = props;
17416
- const [selectedDate, setSelectedDate] = useState(null);
17417
- const [dateType, setDateType] = useState(dateTypes.day);
17418
17435
  const serverSideDateFormat = "MM-dd-yyyy";
17419
- useEffect(() => {
17436
+ const [{
17437
+ selectedDate,
17438
+ dateType
17439
+ }, setFieldValue] = useState(() => {
17420
17440
  if (formData && typeof formData === "object" && formData.date != undefined) {
17421
- let obj = formData;
17422
- setDateType(findDateType(obj.type));
17423
- setSelectedDate(parse$1(obj.date, serverSideDateFormat, new Date()));
17441
+ return {
17442
+ selectedDate: parse$1(formData.date, serverSideDateFormat, new Date()),
17443
+ dateType: findDateType(formData.type)
17444
+ };
17424
17445
  } else {
17425
- setDateType(dateTypes.day);
17426
- setSelectedDate(null);
17446
+ return {
17447
+ selectedDate: null,
17448
+ dateType: formData != null && formData.type ? findDateType(formData.type) : dateTypes.day
17449
+ };
17427
17450
  }
17428
- }, [formData]);
17451
+ });
17429
17452
  const handleDateTypeChange = (event, newDateType) => {
17430
- if (newDateType != null) {
17431
- setDateType(newDateType);
17432
- if (typeof selectedDate !== "undefined" && selectedDate != null) {
17433
- format$1(selectedDate, serverSideDateFormat);
17434
- onChange({
17435
- date: format$1(selectedDate, serverSideDateFormat),
17436
- type: newDateType.type
17437
- });
17438
- }
17453
+ // INFO: toggle sends null value on double click
17454
+ if (!newDateType) return;
17455
+ let newDate = null;
17456
+ if (typeof selectedDate !== "undefined" && selectedDate != null) {
17457
+ newDate = format$1(selectedDate, serverSideDateFormat);
17439
17458
  }
17459
+ setFieldValue(prev => _extends({}, prev, {
17460
+ dateType: newDateType
17461
+ }));
17462
+ onChange({
17463
+ date: newDate,
17464
+ type: newDateType.type
17465
+ });
17440
17466
  };
17441
17467
  const handleDateChange = newDate => {
17442
17468
  if (newDate != null) {
@@ -17446,13 +17472,17 @@ const DateSelect = props => {
17446
17472
  newDate = setDate(newDate, 1);
17447
17473
  newDate = setMonth(newDate, 0);
17448
17474
  }
17449
- setSelectedDate(newDate);
17475
+ setFieldValue(prev => _extends({}, prev, {
17476
+ selectedDate: newDate
17477
+ }));
17450
17478
  onChange({
17451
17479
  date: format$1(newDate, serverSideDateFormat),
17452
17480
  type: dateType.type
17453
17481
  });
17454
17482
  } else {
17455
- setSelectedDate(newDate);
17483
+ setFieldValue(prev => _extends({}, prev, {
17484
+ selectedDate: null
17485
+ }));
17456
17486
  onChange({
17457
17487
  date: null,
17458
17488
  type: dateType.type
@@ -17522,7 +17552,7 @@ const DateSelect = props => {
17522
17552
  inputVariant: "outlined",
17523
17553
  inputFormat: dateType.format,
17524
17554
  views: dateType.views,
17525
- value: typeof selectedDate === "undefined" ? null : selectedDate,
17555
+ value: selectedDate || null,
17526
17556
  onChange: handleDateChange,
17527
17557
  disabled: disabled,
17528
17558
  renderInput: params => /*#__PURE__*/jsx(TextField, _extends({}, params, {
@@ -17532,7 +17562,12 @@ const DateSelect = props => {
17532
17562
  sx: dateInputStyles
17533
17563
  })),
17534
17564
  minDate: minDate,
17535
- maxDate: maxDate
17565
+ maxDate: maxDate,
17566
+ componentsProps: {
17567
+ actionBar: {
17568
+ actions: ["cancel", "clear", "accept"]
17569
+ }
17570
+ }
17536
17571
  })
17537
17572
  })]
17538
17573
  });
@@ -18914,7 +18949,13 @@ const DateWidgetRaw = ({
18914
18949
  required: required,
18915
18950
  onChange: handleChange,
18916
18951
  disabled: disabled
18917
- }, uiSchema == null ? void 0 : uiSchema["ui:props"]));
18952
+ }, uiSchema == null ? void 0 : uiSchema["ui:props"], {
18953
+ componentsProps: {
18954
+ actionBar: {
18955
+ actions: ["cancel", "clear", "accept"]
18956
+ }
18957
+ }
18958
+ }));
18918
18959
  };
18919
18960
  DateWidgetRaw.propTypes = {
18920
18961
  onChange: PropTypes.func,