@gnwebsoft/ui 2.18.46 → 2.18.48

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.
@@ -1096,7 +1096,6 @@ var Component8 = function SelectElement(props) {
1096
1096
  sx,
1097
1097
  variant,
1098
1098
  disabled,
1099
- initialValue,
1100
1099
  labelKey = "Label",
1101
1100
  valueKey = "Value",
1102
1101
  placeholder,
@@ -1109,8 +1108,7 @@ var Component8 = function SelectElement(props) {
1109
1108
  fieldState: { error }
1110
1109
  } = useController8({
1111
1110
  name,
1112
- control,
1113
- defaultValue: initialValue
1111
+ control
1114
1112
  });
1115
1113
  const theme = useTheme6();
1116
1114
  const getOptionValue = useCallback4(
@@ -1133,20 +1131,16 @@ var Component8 = function SelectElement(props) {
1133
1131
  onChange?.(event, newValue, reason);
1134
1132
  };
1135
1133
  useEffect4(() => {
1136
- if (!isEdit && options.length === 1 && (field.value == null || field.value === "")) {
1134
+ if (!isEdit && options.length === 1 && (field.value == null || field.value == void 0 || field.value === "")) {
1137
1135
  const defaultOption = options[0];
1138
- field.onChange(getOptionValue(defaultOption));
1139
- }
1140
- if (isEdit) {
1141
- if (field.value == null || field.value === "") {
1142
- return;
1143
- }
1136
+ const defaultValue = getOptionValue(defaultOption);
1137
+ field.onChange(defaultValue);
1144
1138
  }
1145
- }, [isEdit, options, field.value, getOptionValue, field.onChange]);
1146
- const autocompleteValue = useMemo3(() => {
1147
- if (!field.value) return null;
1148
- return options.find((option) => getOptionValue(option) === field.value) ?? null;
1149
- }, [field.value, options, getOptionValue]);
1139
+ }, [isEdit, options]);
1140
+ const autocompleteValue = useMemo3(
1141
+ () => options.find((option) => getOptionValue(option) === field.value) ?? null,
1142
+ [field.value, options, getOptionValue]
1143
+ );
1150
1144
  return /* @__PURE__ */ jsx8(
1151
1145
  Autocomplete3,
1152
1146
  {
@@ -1186,7 +1180,7 @@ var Component8 = function SelectElement(props) {
1186
1180
  );
1187
1181
  };
1188
1182
  var SelectElement2 = ({
1189
- gridProps,
1183
+ gridProps = { size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 } },
1190
1184
  ...props
1191
1185
  }) => {
1192
1186
  if (gridProps) {
@@ -1206,7 +1200,6 @@ var SelectElement_default = SelectElement2;
1206
1200
  // src/wrappers/SelectMultiElement/SelectMultiElement.tsx
1207
1201
  import { Fragment as Fragment3 } from "react";
1208
1202
  import { useController as useController9 } from "react-hook-form";
1209
- import Chip from "@mui/material/Chip";
1210
1203
  import CheckBoxIcon from "@mui/icons-material/CheckBox";
1211
1204
  import CheckBoxOutlineBlankIcon from "@mui/icons-material/CheckBoxOutlineBlank";
1212
1205
  import {
@@ -1231,7 +1224,6 @@ var Component9 = function SelectMultiElement(props) {
1231
1224
  sx,
1232
1225
  labelKey = "Label",
1233
1226
  valueKey = "Value",
1234
- multiple = true,
1235
1227
  ...rest
1236
1228
  } = props;
1237
1229
  const {
@@ -1249,19 +1241,13 @@ var Component9 = function SelectMultiElement(props) {
1249
1241
  if (typeof option === "string") return option;
1250
1242
  return option ? option[labelKey] : "";
1251
1243
  };
1252
- const selectedValue = multiple ? Array.isArray(field.value) ? options.filter((option) => field.value.includes(getOptionValue(option))) : [] : options.find((option) => getOptionValue(option) === field.value) ?? null;
1253
- const handleChange = (_2, selected, reason) => {
1254
- if (multiple) {
1255
- if (reason === "clear") {
1256
- field.onChange([]);
1257
- } else {
1258
- const newValues = selected.map(
1259
- (option) => getOptionValue(option)
1260
- );
1261
- field.onChange(newValues);
1262
- }
1263
- } else {
1264
- field.onChange(selected ? getOptionValue(selected) : null);
1244
+ const selectedValue = field.value && Array.isArray(field.value) ? options.filter((option) => field.value.includes(getOptionValue(option))) : [];
1245
+ const handleChange = (_2, selectedOptions, reason) => {
1246
+ if (reason === "clear") {
1247
+ field.onChange([]);
1248
+ } else if (reason === "selectOption" || reason === "removeOption") {
1249
+ const newValues = selectedOptions.map((option) => getOptionValue(option));
1250
+ field.onChange(newValues);
1265
1251
  }
1266
1252
  };
1267
1253
  const icon = /* @__PURE__ */ jsx9(CheckBoxOutlineBlankIcon, { fontSize: "small" });
@@ -1269,14 +1255,14 @@ var Component9 = function SelectMultiElement(props) {
1269
1255
  return /* @__PURE__ */ jsx9(
1270
1256
  Autocomplete4,
1271
1257
  {
1272
- multiple,
1258
+ multiple: true,
1273
1259
  value: selectedValue,
1274
1260
  loading,
1275
1261
  options,
1276
- getOptionLabel: (option) => getOptionLabel(option),
1262
+ getOptionLabel,
1277
1263
  isOptionEqualToValue: (option, value) => getOptionValue(option) === getOptionValue(value),
1278
- filterSelectedOptions: multiple,
1279
- disableCloseOnSelect: multiple,
1264
+ filterSelectedOptions: true,
1265
+ disableCloseOnSelect: true,
1280
1266
  ref: field.ref,
1281
1267
  disabled: disabled ?? field.disabled,
1282
1268
  onChange: handleChange,
@@ -1287,26 +1273,20 @@ var Component9 = function SelectMultiElement(props) {
1287
1273
  }
1288
1274
  },
1289
1275
  fullWidth: true,
1290
- renderOption: (props1, option, { selected }) => multiple ? /* @__PURE__ */ jsxs4("li", { ...props1, children: [
1291
- /* @__PURE__ */ jsx9(
1292
- Checkbox,
1293
- {
1294
- icon,
1295
- checkedIcon,
1296
- checked: selected
1297
- }
1298
- ),
1299
- getOptionLabel(option)
1300
- ] }) : /* @__PURE__ */ jsx9("li", { ...props1, children: getOptionLabel(option) }),
1301
- renderTags: (tagValue, getTagProps) => tagValue.map((option, index) => /* @__PURE__ */ jsx9(
1302
- Chip,
1303
- {
1304
- ...getTagProps({ index }),
1305
- label: getOptionLabel(option),
1306
- size: "small",
1307
- variant: "filled"
1308
- }
1309
- )),
1276
+ renderOption: (props1, option, { selected }) => {
1277
+ const { key, ...optionProps } = props1;
1278
+ return /* @__PURE__ */ jsxs4("li", { ...optionProps, children: [
1279
+ /* @__PURE__ */ jsx9(
1280
+ Checkbox,
1281
+ {
1282
+ icon,
1283
+ checkedIcon,
1284
+ checked: selected
1285
+ }
1286
+ ),
1287
+ getOptionLabel(option)
1288
+ ] }, key);
1289
+ },
1310
1290
  renderInput: (params) => /* @__PURE__ */ jsx9(
1311
1291
  TextField6,
1312
1292
  {
@@ -1378,7 +1358,6 @@ var Component10 = function SelectCascadeElement(props) {
1378
1358
  placeholder,
1379
1359
  label,
1380
1360
  dependsOn,
1381
- initialValue,
1382
1361
  textFieldProps = {},
1383
1362
  variant,
1384
1363
  sx,
@@ -1391,13 +1370,7 @@ var Component10 = function SelectCascadeElement(props) {
1391
1370
  if (typeof option === "string" || typeof option === "number")
1392
1371
  return option;
1393
1372
  const key = option ? option[valueKey] : void 0;
1394
- if (key === void 0 || key === null) {
1395
- return "";
1396
- }
1397
- if (typeof key === "string" || typeof key === "number") {
1398
- return key;
1399
- }
1400
- return String(key);
1373
+ return key !== void 0 && key !== null ? String(key) : "";
1401
1374
  },
1402
1375
  [valueKey]
1403
1376
  );
@@ -1414,8 +1387,7 @@ var Component10 = function SelectCascadeElement(props) {
1414
1387
  fieldState: { error }
1415
1388
  } = useController10({
1416
1389
  name,
1417
- control,
1418
- defaultValue: initialValue
1390
+ control
1419
1391
  });
1420
1392
  const theme = useTheme7();
1421
1393
  const { field: dependentField } = useController10({
@@ -1425,48 +1397,47 @@ var Component10 = function SelectCascadeElement(props) {
1425
1397
  const parentValueRef = useRef3(dependentField.value ?? null);
1426
1398
  const [hasAutoSelected, setHasAutoSelected] = useState4(false);
1427
1399
  useEffect5(() => {
1428
- if (parentValueRef.current !== dependentField.value) {
1429
- parentValueRef.current = dependentField.value;
1400
+ if (!!dependentField.value && parentValueRef?.current !== dependentField.value || dependentField.value === null) {
1430
1401
  field.onChange(null);
1431
1402
  setHasAutoSelected(false);
1432
1403
  }
1433
- }, [dependentField.value, field]);
1404
+ }, [dependentField.value]);
1434
1405
  useEffect5(() => {
1435
- if (!dependentField.value) return;
1436
- if (isEdit) {
1437
- if (field.value) return;
1438
- if (options.length === 1 && !hasAutoSelected) {
1439
- field.onChange(getOptionKey(options[0]));
1440
- setHasAutoSelected(true);
1441
- }
1406
+ if (isEdit && !disabled && options.length === 1 && field.value == null && !hasAutoSelected) {
1407
+ field.onChange(getOptionKey(options[0]));
1408
+ setHasAutoSelected(true);
1442
1409
  } else {
1443
- if (options.length === 1 && !field.value && !hasAutoSelected) {
1410
+ if (options.length === 1 && field.value == null && !hasAutoSelected) {
1444
1411
  field.onChange(getOptionKey(options[0]));
1445
1412
  setHasAutoSelected(true);
1446
1413
  }
1447
1414
  }
1448
1415
  }, [
1449
- isEdit,
1450
1416
  options,
1451
1417
  field.value,
1452
- dependentField.value,
1453
- getOptionKey,
1418
+ field.onChange,
1454
1419
  hasAutoSelected,
1455
- field
1420
+ isEdit,
1421
+ disabled,
1422
+ field,
1423
+ getOptionKey,
1424
+ dependentField.onChange
1456
1425
  ]);
1457
- const autocompleteValue = options.find((opt) => getOptionKey(opt) === field.value) ?? null;
1458
1426
  return /* @__PURE__ */ jsx10(
1459
1427
  Autocomplete5,
1460
1428
  {
1461
1429
  ...rest,
1462
- value: autocompleteValue,
1430
+ value: options.map(
1431
+ (option) => getOptionKey(option) === field.value ? option : null
1432
+ ).find(Boolean) || null,
1463
1433
  size: "small",
1464
1434
  loading,
1465
1435
  options,
1436
+ getOptionKey,
1466
1437
  getOptionLabel,
1467
1438
  isOptionEqualToValue,
1468
1439
  ref: field.ref,
1469
- disabled: !dependentField.value || disabled,
1440
+ disabled: dependentField.value == null || disabled,
1470
1441
  onChange: (event, newValue, reason) => {
1471
1442
  field.onChange(newValue ? getOptionKey(newValue) : null);
1472
1443
  if (onChange && typeof onChange === "function") {
@@ -1479,6 +1450,7 @@ var Component10 = function SelectCascadeElement(props) {
1479
1450
  onBlur(event);
1480
1451
  }
1481
1452
  },
1453
+ fullWidth: true,
1482
1454
  renderInput: (params) => /* @__PURE__ */ jsx10(
1483
1455
  TextField7,
1484
1456
  {
@@ -1489,14 +1461,14 @@ var Component10 = function SelectCascadeElement(props) {
1489
1461
  helperText: error ? error.message : "",
1490
1462
  placeholder,
1491
1463
  label,
1492
- variant: variant ?? "outlined",
1464
+ variant: variant ? variant : "outlined",
1493
1465
  sx: {
1494
1466
  "& .MuiOutlinedInput-root": {
1495
- bgcolor: disabled || !dependentField.value ? theme.palette.action.disabledBackground : "transparent"
1467
+ bgcolor: disabled || dependentField.value == null ? theme.palette.action.disabledBackground : "transparent"
1496
1468
  },
1497
1469
  "& .MuiInputLabel-asterisk": { color: "red" },
1498
1470
  "& .MuiInputBase-input": {
1499
- cursor: disabled || !dependentField.value ? "not-allowed" : "default"
1471
+ cursor: disabled || dependentField.value == null ? "not-allowed" : "default"
1500
1472
  },
1501
1473
  ...sx
1502
1474
  }
@@ -1674,7 +1646,7 @@ import { useRef as useRef4, Fragment as Fragment4, useState as useState6, useEff
1674
1646
  import CheckBoxIcon2 from "@mui/icons-material/CheckBox";
1675
1647
  import CheckBoxOutlineBlankIcon2 from "@mui/icons-material/CheckBoxOutlineBlank";
1676
1648
  import {
1677
- Chip as Chip2,
1649
+ Chip,
1678
1650
  Grid2 as Grid213,
1679
1651
  Checkbox as Checkbox4,
1680
1652
  TextField as TextField8,
@@ -1814,7 +1786,7 @@ var Component13 = function SelectMultiCascadeElement(props) {
1814
1786
  getOptionLabel(option)
1815
1787
  ] }) : /* @__PURE__ */ jsx13("li", { ...props1, children: getOptionLabel(option) }),
1816
1788
  renderTags: (tagValue, getTagProps) => tagValue.map((option, index) => /* @__PURE__ */ jsx13(
1817
- Chip2,
1789
+ Chip,
1818
1790
  {
1819
1791
  ...getTagProps({ index }),
1820
1792
  label: getOptionLabel(option),
@@ -1096,7 +1096,6 @@ var Component8 = function SelectElement(props) {
1096
1096
  sx,
1097
1097
  variant,
1098
1098
  disabled,
1099
- initialValue,
1100
1099
  labelKey = "Label",
1101
1100
  valueKey = "Value",
1102
1101
  placeholder,
@@ -1109,8 +1108,7 @@ var Component8 = function SelectElement(props) {
1109
1108
  fieldState: { error }
1110
1109
  } = _reacthookform.useController.call(void 0, {
1111
1110
  name,
1112
- control,
1113
- defaultValue: initialValue
1111
+ control
1114
1112
  });
1115
1113
  const theme = _material.useTheme.call(void 0, );
1116
1114
  const getOptionValue = _react.useCallback.call(void 0,
@@ -1133,20 +1131,16 @@ var Component8 = function SelectElement(props) {
1133
1131
  _optionalChain([onChange, 'optionalCall', _24 => _24(event, newValue, reason)]);
1134
1132
  };
1135
1133
  _react.useEffect.call(void 0, () => {
1136
- if (!isEdit && options.length === 1 && (field.value == null || field.value === "")) {
1134
+ if (!isEdit && options.length === 1 && (field.value == null || field.value == void 0 || field.value === "")) {
1137
1135
  const defaultOption = options[0];
1138
- field.onChange(getOptionValue(defaultOption));
1136
+ const defaultValue = getOptionValue(defaultOption);
1137
+ field.onChange(defaultValue);
1139
1138
  }
1140
- if (isEdit) {
1141
- if (field.value == null || field.value === "") {
1142
- return;
1143
- }
1144
- }
1145
- }, [isEdit, options, field.value, getOptionValue, field.onChange]);
1146
- const autocompleteValue = _react.useMemo.call(void 0, () => {
1147
- if (!field.value) return null;
1148
- return _nullishCoalesce(options.find((option) => getOptionValue(option) === field.value), () => ( null));
1149
- }, [field.value, options, getOptionValue]);
1139
+ }, [isEdit, options]);
1140
+ const autocompleteValue = _react.useMemo.call(void 0,
1141
+ () => _nullishCoalesce(options.find((option) => getOptionValue(option) === field.value), () => ( null)),
1142
+ [field.value, options, getOptionValue]
1143
+ );
1150
1144
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1151
1145
  _material.Autocomplete,
1152
1146
  {
@@ -1186,7 +1180,7 @@ var Component8 = function SelectElement(props) {
1186
1180
  );
1187
1181
  };
1188
1182
  var SelectElement2 = ({
1189
- gridProps,
1183
+ gridProps = { size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 } },
1190
1184
  ...props
1191
1185
  }) => {
1192
1186
  if (gridProps) {
@@ -1206,7 +1200,6 @@ var SelectElement_default = SelectElement2;
1206
1200
  // src/wrappers/SelectMultiElement/SelectMultiElement.tsx
1207
1201
 
1208
1202
 
1209
- var _Chip = require('@mui/material/Chip'); var _Chip2 = _interopRequireDefault(_Chip);
1210
1203
  var _CheckBox = require('@mui/icons-material/CheckBox'); var _CheckBox2 = _interopRequireDefault(_CheckBox);
1211
1204
  var _CheckBoxOutlineBlank = require('@mui/icons-material/CheckBoxOutlineBlank'); var _CheckBoxOutlineBlank2 = _interopRequireDefault(_CheckBoxOutlineBlank);
1212
1205
 
@@ -1231,7 +1224,6 @@ var Component9 = function SelectMultiElement(props) {
1231
1224
  sx,
1232
1225
  labelKey = "Label",
1233
1226
  valueKey = "Value",
1234
- multiple = true,
1235
1227
  ...rest
1236
1228
  } = props;
1237
1229
  const {
@@ -1249,19 +1241,13 @@ var Component9 = function SelectMultiElement(props) {
1249
1241
  if (typeof option === "string") return option;
1250
1242
  return option ? option[labelKey] : "";
1251
1243
  };
1252
- const selectedValue = multiple ? Array.isArray(field.value) ? options.filter((option) => field.value.includes(getOptionValue(option))) : [] : _nullishCoalesce(options.find((option) => getOptionValue(option) === field.value), () => ( null));
1253
- const handleChange = (_2, selected, reason) => {
1254
- if (multiple) {
1255
- if (reason === "clear") {
1256
- field.onChange([]);
1257
- } else {
1258
- const newValues = selected.map(
1259
- (option) => getOptionValue(option)
1260
- );
1261
- field.onChange(newValues);
1262
- }
1263
- } else {
1264
- field.onChange(selected ? getOptionValue(selected) : null);
1244
+ const selectedValue = field.value && Array.isArray(field.value) ? options.filter((option) => field.value.includes(getOptionValue(option))) : [];
1245
+ const handleChange = (_2, selectedOptions, reason) => {
1246
+ if (reason === "clear") {
1247
+ field.onChange([]);
1248
+ } else if (reason === "selectOption" || reason === "removeOption") {
1249
+ const newValues = selectedOptions.map((option) => getOptionValue(option));
1250
+ field.onChange(newValues);
1265
1251
  }
1266
1252
  };
1267
1253
  const icon = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _CheckBoxOutlineBlank2.default, { fontSize: "small" });
@@ -1269,14 +1255,14 @@ var Component9 = function SelectMultiElement(props) {
1269
1255
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1270
1256
  _material.Autocomplete,
1271
1257
  {
1272
- multiple,
1258
+ multiple: true,
1273
1259
  value: selectedValue,
1274
1260
  loading,
1275
1261
  options,
1276
- getOptionLabel: (option) => getOptionLabel(option),
1262
+ getOptionLabel,
1277
1263
  isOptionEqualToValue: (option, value) => getOptionValue(option) === getOptionValue(value),
1278
- filterSelectedOptions: multiple,
1279
- disableCloseOnSelect: multiple,
1264
+ filterSelectedOptions: true,
1265
+ disableCloseOnSelect: true,
1280
1266
  ref: field.ref,
1281
1267
  disabled: _nullishCoalesce(disabled, () => ( field.disabled)),
1282
1268
  onChange: handleChange,
@@ -1287,26 +1273,20 @@ var Component9 = function SelectMultiElement(props) {
1287
1273
  }
1288
1274
  },
1289
1275
  fullWidth: true,
1290
- renderOption: (props1, option, { selected }) => multiple ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "li", { ...props1, children: [
1291
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1292
- _material.Checkbox,
1293
- {
1294
- icon,
1295
- checkedIcon,
1296
- checked: selected
1297
- }
1298
- ),
1299
- getOptionLabel(option)
1300
- ] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "li", { ...props1, children: getOptionLabel(option) }),
1301
- renderTags: (tagValue, getTagProps) => tagValue.map((option, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1302
- _Chip2.default,
1303
- {
1304
- ...getTagProps({ index }),
1305
- label: getOptionLabel(option),
1306
- size: "small",
1307
- variant: "filled"
1308
- }
1309
- )),
1276
+ renderOption: (props1, option, { selected }) => {
1277
+ const { key, ...optionProps } = props1;
1278
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "li", { ...optionProps, children: [
1279
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1280
+ _material.Checkbox,
1281
+ {
1282
+ icon,
1283
+ checkedIcon,
1284
+ checked: selected
1285
+ }
1286
+ ),
1287
+ getOptionLabel(option)
1288
+ ] }, key);
1289
+ },
1310
1290
  renderInput: (params) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1311
1291
  _material.TextField,
1312
1292
  {
@@ -1378,7 +1358,6 @@ var Component10 = function SelectCascadeElement(props) {
1378
1358
  placeholder,
1379
1359
  label,
1380
1360
  dependsOn,
1381
- initialValue,
1382
1361
  textFieldProps = {},
1383
1362
  variant,
1384
1363
  sx,
@@ -1391,13 +1370,7 @@ var Component10 = function SelectCascadeElement(props) {
1391
1370
  if (typeof option === "string" || typeof option === "number")
1392
1371
  return option;
1393
1372
  const key = option ? option[valueKey] : void 0;
1394
- if (key === void 0 || key === null) {
1395
- return "";
1396
- }
1397
- if (typeof key === "string" || typeof key === "number") {
1398
- return key;
1399
- }
1400
- return String(key);
1373
+ return key !== void 0 && key !== null ? String(key) : "";
1401
1374
  },
1402
1375
  [valueKey]
1403
1376
  );
@@ -1414,8 +1387,7 @@ var Component10 = function SelectCascadeElement(props) {
1414
1387
  fieldState: { error }
1415
1388
  } = _reacthookform.useController.call(void 0, {
1416
1389
  name,
1417
- control,
1418
- defaultValue: initialValue
1390
+ control
1419
1391
  });
1420
1392
  const theme = _material.useTheme.call(void 0, );
1421
1393
  const { field: dependentField } = _reacthookform.useController.call(void 0, {
@@ -1425,48 +1397,47 @@ var Component10 = function SelectCascadeElement(props) {
1425
1397
  const parentValueRef = _react.useRef.call(void 0, _nullishCoalesce(dependentField.value, () => ( null)));
1426
1398
  const [hasAutoSelected, setHasAutoSelected] = _react.useState.call(void 0, false);
1427
1399
  _react.useEffect.call(void 0, () => {
1428
- if (parentValueRef.current !== dependentField.value) {
1429
- parentValueRef.current = dependentField.value;
1400
+ if (!!dependentField.value && _optionalChain([parentValueRef, 'optionalAccess', _25 => _25.current]) !== dependentField.value || dependentField.value === null) {
1430
1401
  field.onChange(null);
1431
1402
  setHasAutoSelected(false);
1432
1403
  }
1433
- }, [dependentField.value, field]);
1404
+ }, [dependentField.value]);
1434
1405
  _react.useEffect.call(void 0, () => {
1435
- if (!dependentField.value) return;
1436
- if (isEdit) {
1437
- if (field.value) return;
1438
- if (options.length === 1 && !hasAutoSelected) {
1439
- field.onChange(getOptionKey(options[0]));
1440
- setHasAutoSelected(true);
1441
- }
1406
+ if (isEdit && !disabled && options.length === 1 && field.value == null && !hasAutoSelected) {
1407
+ field.onChange(getOptionKey(options[0]));
1408
+ setHasAutoSelected(true);
1442
1409
  } else {
1443
- if (options.length === 1 && !field.value && !hasAutoSelected) {
1410
+ if (options.length === 1 && field.value == null && !hasAutoSelected) {
1444
1411
  field.onChange(getOptionKey(options[0]));
1445
1412
  setHasAutoSelected(true);
1446
1413
  }
1447
1414
  }
1448
1415
  }, [
1449
- isEdit,
1450
1416
  options,
1451
1417
  field.value,
1452
- dependentField.value,
1453
- getOptionKey,
1418
+ field.onChange,
1454
1419
  hasAutoSelected,
1455
- field
1420
+ isEdit,
1421
+ disabled,
1422
+ field,
1423
+ getOptionKey,
1424
+ dependentField.onChange
1456
1425
  ]);
1457
- const autocompleteValue = _nullishCoalesce(options.find((opt) => getOptionKey(opt) === field.value), () => ( null));
1458
1426
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1459
1427
  _material.Autocomplete,
1460
1428
  {
1461
1429
  ...rest,
1462
- value: autocompleteValue,
1430
+ value: options.map(
1431
+ (option) => getOptionKey(option) === field.value ? option : null
1432
+ ).find(Boolean) || null,
1463
1433
  size: "small",
1464
1434
  loading,
1465
1435
  options,
1436
+ getOptionKey,
1466
1437
  getOptionLabel,
1467
1438
  isOptionEqualToValue,
1468
1439
  ref: field.ref,
1469
- disabled: !dependentField.value || disabled,
1440
+ disabled: dependentField.value == null || disabled,
1470
1441
  onChange: (event, newValue, reason) => {
1471
1442
  field.onChange(newValue ? getOptionKey(newValue) : null);
1472
1443
  if (onChange && typeof onChange === "function") {
@@ -1479,6 +1450,7 @@ var Component10 = function SelectCascadeElement(props) {
1479
1450
  onBlur(event);
1480
1451
  }
1481
1452
  },
1453
+ fullWidth: true,
1482
1454
  renderInput: (params) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1483
1455
  _material.TextField,
1484
1456
  {
@@ -1489,14 +1461,14 @@ var Component10 = function SelectCascadeElement(props) {
1489
1461
  helperText: error ? error.message : "",
1490
1462
  placeholder,
1491
1463
  label,
1492
- variant: _nullishCoalesce(variant, () => ( "outlined")),
1464
+ variant: variant ? variant : "outlined",
1493
1465
  sx: {
1494
1466
  "& .MuiOutlinedInput-root": {
1495
- bgcolor: disabled || !dependentField.value ? theme.palette.action.disabledBackground : "transparent"
1467
+ bgcolor: disabled || dependentField.value == null ? theme.palette.action.disabledBackground : "transparent"
1496
1468
  },
1497
1469
  "& .MuiInputLabel-asterisk": { color: "red" },
1498
1470
  "& .MuiInputBase-input": {
1499
- cursor: disabled || !dependentField.value ? "not-allowed" : "default"
1471
+ cursor: disabled || dependentField.value == null ? "not-allowed" : "default"
1500
1472
  },
1501
1473
  ...sx
1502
1474
  }
@@ -1615,7 +1587,7 @@ var Component12 = function CheckboxGroup(props) {
1615
1587
  disabled: rest.disabled
1616
1588
  });
1617
1589
  const [selectedValues, setSelectedValues] = _react.useState.call(void 0,
1618
- options.filter((c) => _optionalChain([field, 'access', _25 => _25.value, 'optionalAccess', _26 => _26.includes, 'call', _27 => _27(c.Value)])).map((c) => c.Value) || []
1590
+ options.filter((c) => _optionalChain([field, 'access', _26 => _26.value, 'optionalAccess', _27 => _27.includes, 'call', _28 => _28(c.Value)])).map((c) => c.Value) || []
1619
1591
  );
1620
1592
  _react.useEffect.call(void 0, () => {
1621
1593
  field.onChange(selectedValues ? [...selectedValues] : []);