aefis-core-ui 2.3.0-rc11 → 2.3.0-rc12

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.
@@ -69,8 +69,11 @@ import StepConnector, { stepConnectorClasses } from '@mui/material/StepConnector
69
69
  import DeleteOutlineOutlinedIcon from '@mui/icons-material/DeleteOutlineOutlined';
70
70
  import '@mui/icons-material/KeyboardArrowUpOutlined';
71
71
  import '@mui/icons-material/KeyboardArrowDownOutlined';
72
+ import { MenuButton as MenuButton$1 } from 'core-ui';
72
73
  import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp';
73
74
  import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
75
+ import 'core-ui/components/AnimatedExpandMoreIcon/AnimatedExpandMoreIcon';
76
+ import '@mui/icons-material/MoreVert';
74
77
  import produce from 'immer';
75
78
  import { v4 } from 'uuid';
76
79
  import { MuiForm5 } from '@rjsf/material-ui';
@@ -1913,7 +1916,12 @@ MenuButton.propTypes = {
1913
1916
  /** Button variant */
1914
1917
  variant: PropTypes.oneOf(["contained", "outlined", "text"]),
1915
1918
  /** The type of the button */
1916
- menuConfiguration: PropTypes.array,
1919
+ menuConfiguration: PropTypes.arrayOf(PropTypes.shape({
1920
+ name: PropTypes.string,
1921
+ icon: PropTypes.any,
1922
+ divider: PropTypes.any,
1923
+ onClick: PropTypes.function
1924
+ })),
1917
1925
  /** The function to execute when the button is clicked. */
1918
1926
  onClick: PropTypes.func
1919
1927
  };
@@ -15387,25 +15395,35 @@ function Row({
15387
15395
  })]
15388
15396
  }), /*#__PURE__*/jsx(Box$1, {
15389
15397
  sx: {
15390
- width: "48px"
15398
+ width: "48px",
15399
+ marginTop: "22px"
15391
15400
  },
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"
15401
+ children: /*#__PURE__*/jsx(MenuButton$1, {
15402
+ displayType: "icon",
15403
+ menuConfiguration: [{
15404
+ name: "Move Up",
15405
+ icon: /*#__PURE__*/jsx(KeyboardArrowUpIcon, {}),
15406
+ onClick: () => {}
15407
+ }, {
15408
+ name: "Move Down",
15409
+ icon: /*#__PURE__*/jsx(KeyboardArrowDownIcon, {}),
15410
+ onClick: () => {}
15411
+ }, {
15412
+ name: "Add Rule Below",
15413
+ icon: /*#__PURE__*/jsx(AddIcon, {}),
15414
+ onClick: () => {}
15415
+ }, {
15416
+ name: "Delete",
15417
+ icon: /*#__PURE__*/jsx(DeleteOutlineOutlinedIcon, {}),
15418
+ onClick: () => {
15419
+ onRuleDelete({
15420
+ ruleId,
15421
+ index,
15422
+ ruleIndex,
15423
+ groupId
15424
+ });
15407
15425
  }
15408
- })
15426
+ }]
15409
15427
  })
15410
15428
  })]
15411
15429
  });
@@ -15512,7 +15530,7 @@ const RuleGroupIndex = /*#__PURE__*/memo(({
15512
15530
  flexDirection: "column",
15513
15531
  alignItems: "center",
15514
15532
  position: "relative",
15515
- top: "-8px",
15533
+ top: "0px",
15516
15534
  width: "20px"
15517
15535
  },
15518
15536
  children: [/*#__PURE__*/jsx(IconButton$1, {
@@ -15661,6 +15679,11 @@ const TextBuilder = /*#__PURE__*/memo(({
15661
15679
  setRows(newRules);
15662
15680
  };
15663
15681
  return /*#__PURE__*/jsxs(ContentBox, {
15682
+ sx: {
15683
+ ".MuiFormControl-root": {
15684
+ background: "white"
15685
+ }
15686
+ },
15664
15687
  children: [/*#__PURE__*/jsx(BuilderHeader, {
15665
15688
  onAdd: handleAddGroup,
15666
15689
  children: renderHeader()
@@ -17363,7 +17386,7 @@ const DateSelectReadOnly$1 = ({
17363
17386
  schema
17364
17387
  }) => {
17365
17388
  const value = useMemo(() => {
17366
- if (formData == undefined) return null;
17389
+ if (!(formData != null && formData.date)) return null;
17367
17390
  const date = new Date(formData.date);
17368
17391
  const options = _extends({}, formData.type === "y" && {
17369
17392
  year: "numeric"
@@ -17413,30 +17436,37 @@ const DateSelect = props => {
17413
17436
  rawErrors,
17414
17437
  disabled
17415
17438
  } = props;
17416
- const [selectedDate, setSelectedDate] = useState(null);
17417
- const [dateType, setDateType] = useState(dateTypes.day);
17418
17439
  const serverSideDateFormat = "MM-dd-yyyy";
17419
- useEffect(() => {
17440
+ const [{
17441
+ selectedDate,
17442
+ dateType
17443
+ }, setFieldValue] = useState(() => {
17420
17444
  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()));
17445
+ return {
17446
+ selectedDate: parse$1(formData.date, serverSideDateFormat, new Date()),
17447
+ dateType: findDateType(formData.type)
17448
+ };
17424
17449
  } else {
17425
- setDateType(dateTypes.day);
17426
- setSelectedDate(null);
17450
+ return {
17451
+ selectedDate: null,
17452
+ dateType: formData != null && formData.type ? findDateType(formData.type) : dateTypes.day
17453
+ };
17427
17454
  }
17428
- }, [formData]);
17455
+ });
17429
17456
  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
- }
17457
+ // INFO: toggle sends null value on double click
17458
+ if (!newDateType) return;
17459
+ let newDate = null;
17460
+ if (typeof selectedDate !== "undefined" && selectedDate != null) {
17461
+ newDate = format$1(selectedDate, serverSideDateFormat);
17439
17462
  }
17463
+ setFieldValue(prev => _extends({}, prev, {
17464
+ dateType: newDateType
17465
+ }));
17466
+ onChange({
17467
+ date: newDate,
17468
+ type: newDateType.type
17469
+ });
17440
17470
  };
17441
17471
  const handleDateChange = newDate => {
17442
17472
  if (newDate != null) {
@@ -17446,13 +17476,17 @@ const DateSelect = props => {
17446
17476
  newDate = setDate(newDate, 1);
17447
17477
  newDate = setMonth(newDate, 0);
17448
17478
  }
17449
- setSelectedDate(newDate);
17479
+ setFieldValue(prev => _extends({}, prev, {
17480
+ selectedDate: newDate
17481
+ }));
17450
17482
  onChange({
17451
17483
  date: format$1(newDate, serverSideDateFormat),
17452
17484
  type: dateType.type
17453
17485
  });
17454
17486
  } else {
17455
- setSelectedDate(newDate);
17487
+ setFieldValue(prev => _extends({}, prev, {
17488
+ selectedDate: null
17489
+ }));
17456
17490
  onChange({
17457
17491
  date: null,
17458
17492
  type: dateType.type
@@ -17522,7 +17556,7 @@ const DateSelect = props => {
17522
17556
  inputVariant: "outlined",
17523
17557
  inputFormat: dateType.format,
17524
17558
  views: dateType.views,
17525
- value: typeof selectedDate === "undefined" ? null : selectedDate,
17559
+ value: selectedDate || null,
17526
17560
  onChange: handleDateChange,
17527
17561
  disabled: disabled,
17528
17562
  renderInput: params => /*#__PURE__*/jsx(TextField, _extends({}, params, {
@@ -17532,7 +17566,12 @@ const DateSelect = props => {
17532
17566
  sx: dateInputStyles
17533
17567
  })),
17534
17568
  minDate: minDate,
17535
- maxDate: maxDate
17569
+ maxDate: maxDate,
17570
+ componentsProps: {
17571
+ actionBar: {
17572
+ actions: ["cancel", "clear", "accept"]
17573
+ }
17574
+ }
17536
17575
  })
17537
17576
  })]
17538
17577
  });
@@ -18914,7 +18953,13 @@ const DateWidgetRaw = ({
18914
18953
  required: required,
18915
18954
  onChange: handleChange,
18916
18955
  disabled: disabled
18917
- }, uiSchema == null ? void 0 : uiSchema["ui:props"]));
18956
+ }, uiSchema == null ? void 0 : uiSchema["ui:props"], {
18957
+ componentsProps: {
18958
+ actionBar: {
18959
+ actions: ["cancel", "clear", "accept"]
18960
+ }
18961
+ }
18962
+ }));
18918
18963
  };
18919
18964
  DateWidgetRaw.propTypes = {
18920
18965
  onChange: PropTypes.func,