@gnwebsoft/ui 2.18.44 → 2.18.46

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.
@@ -3,7 +3,7 @@
3
3
  var _chunk6JZ35VQJjs = require('./chunk-6JZ35VQJ.js');
4
4
 
5
5
 
6
- var _chunkFYN7F5WJjs = require('./chunk-FYN7F5WJ.js');
6
+ var _chunkI7EIUZKKjs = require('./chunk-I7EIUZKK.js');
7
7
 
8
8
  // src/wrappers/DatePickerElement/DatePickerElement.tsx
9
9
  var _react = require('react'); var React = _interopRequireWildcard(_react);
@@ -54,6 +54,7 @@ var Component = function DatePickerElement(props) {
54
54
  ...rest
55
55
  } = props;
56
56
  const adapter = _internals.useLocalizationContext.call(void 0, );
57
+ const theme = _material.useTheme.call(void 0, );
57
58
  const { disabled, inputRef, onClose, ...restDatePickerProps } = datePickerProps;
58
59
  const {
59
60
  field,
@@ -98,7 +99,16 @@ var Component = function DatePickerElement(props) {
98
99
  datePickerProps.onChange(newValue, context);
99
100
  }
100
101
  },
101
- sx,
102
+ sx: {
103
+ "& .MuiOutlinedInput-root": {
104
+ bgcolor: disabled ? theme.palette.action.disabledBackground : "transparent"
105
+ },
106
+ "& .MuiInputLabel-asterisk": { color: "red" },
107
+ "& .MuiInputBase-input": {
108
+ cursor: disabled ? "not-allowed" : "default"
109
+ },
110
+ ...sx
111
+ },
102
112
  slotProps: {
103
113
  ...slotProps,
104
114
  actionBar: {
@@ -127,11 +137,17 @@ var Component = function DatePickerElement(props) {
127
137
  );
128
138
  };
129
139
  var DatePickerElement2 = ({
130
- gridProps,
140
+ gridProps = { size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 } },
131
141
  ...props
132
142
  }) => {
133
143
  if (gridProps) {
134
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Grid2, { ...gridProps, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component, { ...props }) });
144
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
145
+ _material.Grid2,
146
+ {
147
+ ...{ size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }, ...gridProps },
148
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component, { ...props })
149
+ }
150
+ );
135
151
  }
136
152
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component, { ...props });
137
153
  };
@@ -225,11 +241,17 @@ var Component2 = function PasswordEl(props) {
225
241
  );
226
242
  };
227
243
  var PasswordElement = ({
228
- gridProps,
244
+ gridProps = { size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 } },
229
245
  ...props
230
246
  }) => {
231
247
  if (gridProps) {
232
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Grid2, { ...{ size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }, ...gridProps }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component2, { ...props }) });
248
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
249
+ _material.Grid2,
250
+ {
251
+ ...{ size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }, ...gridProps },
252
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component2, { ...props })
253
+ }
254
+ );
233
255
  }
234
256
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component2, { ...props });
235
257
  };
@@ -368,11 +390,17 @@ var Component3 = function RadioButtonGroup(props) {
368
390
  ] });
369
391
  };
370
392
  var RadioButtonGroup2 = ({
371
- gridProps,
393
+ gridProps = { size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 } },
372
394
  ...props
373
395
  }) => {
374
396
  if (gridProps) {
375
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Grid2, { ...{ size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }, ...gridProps }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component3, { ...props }) });
397
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
398
+ _material.Grid2,
399
+ {
400
+ ...{ size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }, ...gridProps },
401
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component3, { ...props })
402
+ }
403
+ );
376
404
  }
377
405
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component3, { ...props });
378
406
  };
@@ -488,11 +516,17 @@ var Component4 = function TextFieldElement(props) {
488
516
  );
489
517
  };
490
518
  var TextFieldElement2 = ({
491
- gridProps,
519
+ gridProps = { size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 } },
492
520
  ...props
493
521
  }) => {
494
522
  if (gridProps) {
495
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Grid2, { ...{ size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }, ...gridProps }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component4, { ...props }) });
523
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
524
+ _material.Grid2,
525
+ {
526
+ ...{ size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }, ...gridProps },
527
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component4, { ...props })
528
+ }
529
+ );
496
530
  }
497
531
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component4, { ...props });
498
532
  };
@@ -537,7 +571,7 @@ var Component5 = function TimePickerElement(props) {
537
571
  value: field.value,
538
572
  onChange: field.onChange,
539
573
  transform: {
540
- input: typeof _optionalChain([transform, 'optionalAccess', _18 => _18.input]) === "function" ? transform.input : (newValue) => _chunkFYN7F5WJjs.readValueAsDate.call(void 0, adapter, newValue),
574
+ input: typeof _optionalChain([transform, 'optionalAccess', _18 => _18.input]) === "function" ? transform.input : (newValue) => _chunkI7EIUZKKjs.readValueAsDate.call(void 0, adapter, newValue),
541
575
  output: typeof _optionalChain([transform, 'optionalAccess', _19 => _19.output]) === "function" ? transform.output : (newValue) => newValue
542
576
  }
543
577
  });
@@ -579,11 +613,17 @@ var Component5 = function TimePickerElement(props) {
579
613
  );
580
614
  };
581
615
  var TimePickerElement2 = ({
582
- gridProps,
616
+ gridProps = { size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 } },
583
617
  ...props
584
618
  }) => {
585
619
  if (gridProps) {
586
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Grid2, { ...{ size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }, ...gridProps }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component5, { ...props }) });
620
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
621
+ _material.Grid2,
622
+ {
623
+ ...{ size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }, ...gridProps },
624
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component5, { ...props })
625
+ }
626
+ );
587
627
  }
588
628
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component5, { ...props });
589
629
  };
@@ -594,6 +634,13 @@ var TimePickerElement_default = TimePickerElement2;
594
634
 
595
635
 
596
636
 
637
+
638
+
639
+
640
+
641
+
642
+
643
+
597
644
  var _utils = require('@mui/material/utils');
598
645
  var _TextField = require('@mui/material/TextField'); var _TextField2 = _interopRequireDefault(_TextField);
599
646
  var _Autocomplete = require('@mui/material/Autocomplete'); var _Autocomplete2 = _interopRequireDefault(_Autocomplete);
@@ -628,16 +675,22 @@ var Component6 = function AsyncSelectElement(props) {
628
675
  const [selectedOption, setSelectedOption] = _react.useState.call(void 0, null);
629
676
  const [inputValue, setInputValue] = _react.useState.call(void 0, "");
630
677
  const inputValue2 = _react.useMemo.call(void 0, () => inputValue, [inputValue]);
631
- const setInputValue2 = _react.useCallback.call(void 0, (newValue) => setInputValue(newValue), []);
678
+ const setInputValue2 = _react.useCallback.call(void 0,
679
+ (newValue) => setInputValue(newValue),
680
+ []
681
+ );
632
682
  const [options, setOptions] = _react.useState.call(void 0, []);
633
683
  const initialValueLoaded = _react.useRef.call(void 0,
634
684
  !initialValue ? true : !(initialValue != null)
635
685
  );
636
686
  const fieldValue = _react.useRef.call(void 0, field.value);
637
687
  const fetchData = _react.useMemo.call(void 0,
638
- () => _utils.debounce.call(void 0, (payload, callback) => {
639
- queryFn(payload).then((c) => callback(c));
640
- }, 400),
688
+ () => _utils.debounce.call(void 0,
689
+ (payload, callback) => {
690
+ queryFn(payload).then((c) => callback(c));
691
+ },
692
+ 400
693
+ ),
641
694
  []
642
695
  );
643
696
  const fillOptions = (results) => {
@@ -790,11 +843,17 @@ var Component6 = function AsyncSelectElement(props) {
790
843
  );
791
844
  };
792
845
  var AsyncSelectElement2 = ({
793
- gridProps,
846
+ gridProps = { size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 } },
794
847
  ...props
795
848
  }) => {
796
849
  if (gridProps) {
797
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Grid2, { ...{ size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }, ...gridProps }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component6, { ...props }) });
850
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
851
+ _material.Grid2,
852
+ {
853
+ ...{ size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }, ...gridProps },
854
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component6, { ...props })
855
+ }
856
+ );
798
857
  }
799
858
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component6, { ...props });
800
859
  };
@@ -1037,6 +1096,7 @@ var Component8 = function SelectElement(props) {
1037
1096
  sx,
1038
1097
  variant,
1039
1098
  disabled,
1099
+ initialValue,
1040
1100
  labelKey = "Label",
1041
1101
  valueKey = "Value",
1042
1102
  placeholder,
@@ -1049,7 +1109,8 @@ var Component8 = function SelectElement(props) {
1049
1109
  fieldState: { error }
1050
1110
  } = _reacthookform.useController.call(void 0, {
1051
1111
  name,
1052
- control
1112
+ control,
1113
+ defaultValue: initialValue
1053
1114
  });
1054
1115
  const theme = _material.useTheme.call(void 0, );
1055
1116
  const getOptionValue = _react.useCallback.call(void 0,
@@ -1072,16 +1133,20 @@ var Component8 = function SelectElement(props) {
1072
1133
  _optionalChain([onChange, 'optionalCall', _24 => _24(event, newValue, reason)]);
1073
1134
  };
1074
1135
  _react.useEffect.call(void 0, () => {
1075
- if (!isEdit && options.length === 1 && (field.value == null || field.value == void 0 || field.value === "")) {
1136
+ if (!isEdit && options.length === 1 && (field.value == null || field.value === "")) {
1076
1137
  const defaultOption = options[0];
1077
- const defaultValue = getOptionValue(defaultOption);
1078
- field.onChange(defaultValue);
1138
+ field.onChange(getOptionValue(defaultOption));
1079
1139
  }
1080
- }, [isEdit, options]);
1081
- const autocompleteValue = _react.useMemo.call(void 0,
1082
- () => _nullishCoalesce(options.find((option) => getOptionValue(option) === field.value), () => ( null)),
1083
- [field.value, options, getOptionValue]
1084
- );
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]);
1085
1150
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1086
1151
  _material.Autocomplete,
1087
1152
  {
@@ -1141,10 +1206,17 @@ var SelectElement_default = SelectElement2;
1141
1206
  // src/wrappers/SelectMultiElement/SelectMultiElement.tsx
1142
1207
 
1143
1208
 
1209
+ var _Chip = require('@mui/material/Chip'); var _Chip2 = _interopRequireDefault(_Chip);
1144
1210
  var _CheckBox = require('@mui/icons-material/CheckBox'); var _CheckBox2 = _interopRequireDefault(_CheckBox);
1145
1211
  var _CheckBoxOutlineBlank = require('@mui/icons-material/CheckBoxOutlineBlank'); var _CheckBoxOutlineBlank2 = _interopRequireDefault(_CheckBoxOutlineBlank);
1146
1212
 
1147
1213
 
1214
+
1215
+
1216
+
1217
+
1218
+
1219
+
1148
1220
  var Component9 = function SelectMultiElement(props) {
1149
1221
  const {
1150
1222
  name,
@@ -1159,6 +1231,7 @@ var Component9 = function SelectMultiElement(props) {
1159
1231
  sx,
1160
1232
  labelKey = "Label",
1161
1233
  valueKey = "Value",
1234
+ multiple = true,
1162
1235
  ...rest
1163
1236
  } = props;
1164
1237
  const {
@@ -1176,13 +1249,19 @@ var Component9 = function SelectMultiElement(props) {
1176
1249
  if (typeof option === "string") return option;
1177
1250
  return option ? option[labelKey] : "";
1178
1251
  };
1179
- const selectedValue = field.value && Array.isArray(field.value) ? options.filter((option) => field.value.includes(getOptionValue(option))) : [];
1180
- const handleChange = (_2, selectedOptions, reason) => {
1181
- if (reason === "clear") {
1182
- field.onChange([]);
1183
- } else if (reason === "selectOption" || reason === "removeOption") {
1184
- const newValues = selectedOptions.map((option) => getOptionValue(option));
1185
- field.onChange(newValues);
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);
1186
1265
  }
1187
1266
  };
1188
1267
  const icon = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _CheckBoxOutlineBlank2.default, { fontSize: "small" });
@@ -1190,14 +1269,14 @@ var Component9 = function SelectMultiElement(props) {
1190
1269
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1191
1270
  _material.Autocomplete,
1192
1271
  {
1193
- multiple: true,
1272
+ multiple,
1194
1273
  value: selectedValue,
1195
1274
  loading,
1196
1275
  options,
1197
- getOptionLabel,
1276
+ getOptionLabel: (option) => getOptionLabel(option),
1198
1277
  isOptionEqualToValue: (option, value) => getOptionValue(option) === getOptionValue(value),
1199
- filterSelectedOptions: true,
1200
- disableCloseOnSelect: true,
1278
+ filterSelectedOptions: multiple,
1279
+ disableCloseOnSelect: multiple,
1201
1280
  ref: field.ref,
1202
1281
  disabled: _nullishCoalesce(disabled, () => ( field.disabled)),
1203
1282
  onChange: handleChange,
@@ -1208,13 +1287,26 @@ var Component9 = function SelectMultiElement(props) {
1208
1287
  }
1209
1288
  },
1210
1289
  fullWidth: true,
1211
- renderOption: (props1, option, { selected }) => {
1212
- const { key, ...optionProps } = props1;
1213
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "li", { ...optionProps, children: [
1214
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Checkbox, { icon, checkedIcon, checked: selected }),
1215
- getOptionLabel(option)
1216
- ] }, key);
1217
- },
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
+ )),
1218
1310
  renderInput: (params) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1219
1311
  _material.TextField,
1220
1312
  {
@@ -1243,11 +1335,17 @@ var Component9 = function SelectMultiElement(props) {
1243
1335
  );
1244
1336
  };
1245
1337
  var SelectMultiElement2 = ({
1246
- gridProps,
1338
+ gridProps = { size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 } },
1247
1339
  ...props
1248
1340
  }) => {
1249
1341
  if (gridProps) {
1250
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Grid2, { ...{ size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }, ...gridProps }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component9, { ...props }) });
1342
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1343
+ _material.Grid2,
1344
+ {
1345
+ ...{ size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }, ...gridProps },
1346
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component9, { ...props })
1347
+ }
1348
+ );
1251
1349
  }
1252
1350
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component9, { ...props });
1253
1351
  };
@@ -1280,6 +1378,7 @@ var Component10 = function SelectCascadeElement(props) {
1280
1378
  placeholder,
1281
1379
  label,
1282
1380
  dependsOn,
1381
+ initialValue,
1283
1382
  textFieldProps = {},
1284
1383
  variant,
1285
1384
  sx,
@@ -1289,9 +1388,16 @@ var Component10 = function SelectCascadeElement(props) {
1289
1388
  const { required } = textFieldProps;
1290
1389
  const getOptionKey = _react.useCallback.call(void 0,
1291
1390
  (option) => {
1292
- if (typeof option === "string" || typeof option === "number") return option;
1391
+ if (typeof option === "string" || typeof option === "number")
1392
+ return option;
1293
1393
  const key = option ? option[valueKey] : void 0;
1294
- return key !== void 0 && key !== null ? String(key) : "";
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);
1295
1401
  },
1296
1402
  [valueKey]
1297
1403
  );
@@ -1308,7 +1414,8 @@ var Component10 = function SelectCascadeElement(props) {
1308
1414
  fieldState: { error }
1309
1415
  } = _reacthookform.useController.call(void 0, {
1310
1416
  name,
1311
- control
1417
+ control,
1418
+ defaultValue: initialValue
1312
1419
  });
1313
1420
  const theme = _material.useTheme.call(void 0, );
1314
1421
  const { field: dependentField } = _reacthookform.useController.call(void 0, {
@@ -1318,45 +1425,48 @@ var Component10 = function SelectCascadeElement(props) {
1318
1425
  const parentValueRef = _react.useRef.call(void 0, _nullishCoalesce(dependentField.value, () => ( null)));
1319
1426
  const [hasAutoSelected, setHasAutoSelected] = _react.useState.call(void 0, false);
1320
1427
  _react.useEffect.call(void 0, () => {
1321
- if (!!dependentField.value && _optionalChain([parentValueRef, 'optionalAccess', _25 => _25.current]) !== dependentField.value || dependentField.value === null) {
1428
+ if (parentValueRef.current !== dependentField.value) {
1429
+ parentValueRef.current = dependentField.value;
1322
1430
  field.onChange(null);
1323
1431
  setHasAutoSelected(false);
1324
1432
  }
1325
- }, [dependentField.value]);
1433
+ }, [dependentField.value, field]);
1326
1434
  _react.useEffect.call(void 0, () => {
1327
- if (isEdit && !disabled && options.length === 1 && field.value == null && !hasAutoSelected) {
1328
- field.onChange(getOptionKey(options[0]));
1329
- setHasAutoSelected(true);
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
+ }
1330
1442
  } else {
1331
- if (options.length === 1 && field.value == null && !hasAutoSelected) {
1443
+ if (options.length === 1 && !field.value && !hasAutoSelected) {
1332
1444
  field.onChange(getOptionKey(options[0]));
1333
1445
  setHasAutoSelected(true);
1334
1446
  }
1335
1447
  }
1336
1448
  }, [
1449
+ isEdit,
1337
1450
  options,
1338
1451
  field.value,
1339
- field.onChange,
1340
- hasAutoSelected,
1341
- isEdit,
1342
- disabled,
1343
- field,
1452
+ dependentField.value,
1344
1453
  getOptionKey,
1345
- dependentField.onChange
1454
+ hasAutoSelected,
1455
+ field
1346
1456
  ]);
1457
+ const autocompleteValue = _nullishCoalesce(options.find((opt) => getOptionKey(opt) === field.value), () => ( null));
1347
1458
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1348
1459
  _material.Autocomplete,
1349
1460
  {
1350
1461
  ...rest,
1351
- value: options.map((option) => getOptionKey(option) === field.value ? option : null).find(Boolean) || null,
1462
+ value: autocompleteValue,
1352
1463
  size: "small",
1353
1464
  loading,
1354
1465
  options,
1355
- getOptionKey,
1356
1466
  getOptionLabel,
1357
1467
  isOptionEqualToValue,
1358
1468
  ref: field.ref,
1359
- disabled: dependentField.value == null || disabled,
1469
+ disabled: !dependentField.value || disabled,
1360
1470
  onChange: (event, newValue, reason) => {
1361
1471
  field.onChange(newValue ? getOptionKey(newValue) : null);
1362
1472
  if (onChange && typeof onChange === "function") {
@@ -1369,7 +1479,6 @@ var Component10 = function SelectCascadeElement(props) {
1369
1479
  onBlur(event);
1370
1480
  }
1371
1481
  },
1372
- fullWidth: true,
1373
1482
  renderInput: (params) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1374
1483
  _material.TextField,
1375
1484
  {
@@ -1380,14 +1489,14 @@ var Component10 = function SelectCascadeElement(props) {
1380
1489
  helperText: error ? error.message : "",
1381
1490
  placeholder,
1382
1491
  label,
1383
- variant: variant ? variant : "outlined",
1492
+ variant: _nullishCoalesce(variant, () => ( "outlined")),
1384
1493
  sx: {
1385
1494
  "& .MuiOutlinedInput-root": {
1386
- bgcolor: disabled || dependentField.value == null ? theme.palette.action.disabledBackground : "transparent"
1495
+ bgcolor: disabled || !dependentField.value ? theme.palette.action.disabledBackground : "transparent"
1387
1496
  },
1388
1497
  "& .MuiInputLabel-asterisk": { color: "red" },
1389
1498
  "& .MuiInputBase-input": {
1390
- cursor: disabled || dependentField.value == null ? "not-allowed" : "default"
1499
+ cursor: disabled || !dependentField.value ? "not-allowed" : "default"
1391
1500
  },
1392
1501
  ...sx
1393
1502
  }
@@ -1401,7 +1510,13 @@ var SelectCascadeElement2 = ({
1401
1510
  ...props
1402
1511
  }) => {
1403
1512
  if (gridProps) {
1404
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Grid2, { ...{ size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }, ...gridProps }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component10, { ...props }) });
1513
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1514
+ _material.Grid2,
1515
+ {
1516
+ ...{ size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }, ...gridProps },
1517
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component10, { ...props })
1518
+ }
1519
+ );
1405
1520
  }
1406
1521
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component10, { ...props });
1407
1522
  };
@@ -1500,7 +1615,7 @@ var Component12 = function CheckboxGroup(props) {
1500
1615
  disabled: rest.disabled
1501
1616
  });
1502
1617
  const [selectedValues, setSelectedValues] = _react.useState.call(void 0,
1503
- options.filter((c) => _optionalChain([field, 'access', _26 => _26.value, 'optionalAccess', _27 => _27.includes, 'call', _28 => _28(c.Value)])).map((c) => c.Value) || []
1618
+ options.filter((c) => _optionalChain([field, 'access', _25 => _25.value, 'optionalAccess', _26 => _26.includes, 'call', _27 => _27(c.Value)])).map((c) => c.Value) || []
1504
1619
  );
1505
1620
  _react.useEffect.call(void 0, () => {
1506
1621
  field.onChange(selectedValues ? [...selectedValues] : []);
@@ -1553,6 +1668,205 @@ var CheckboxGroup2 = ({
1553
1668
  CheckboxGroup2.displayName = "CheckboxGroup";
1554
1669
  var CheckboxGroup_default = CheckboxGroup2;
1555
1670
 
1671
+ // src/wrappers/SelectMultiCascadeElement/SelectMultiCascadeElement.tsx
1672
+
1673
+
1674
+
1675
+
1676
+
1677
+
1678
+
1679
+
1680
+
1681
+
1682
+
1683
+
1684
+
1685
+ var Component13 = function SelectMultiCascadeElement(props) {
1686
+ const {
1687
+ name,
1688
+ control,
1689
+ dependsOn,
1690
+ onBlur,
1691
+ disabled,
1692
+ options,
1693
+ loading = false,
1694
+ placeholder,
1695
+ label,
1696
+ variant,
1697
+ sx,
1698
+ labelKey = "Label",
1699
+ valueKey = "Value",
1700
+ multiple = true,
1701
+ isEdit = false,
1702
+ initialValue,
1703
+ ...rest
1704
+ } = props;
1705
+ const {
1706
+ field,
1707
+ fieldState: { error }
1708
+ } = _reacthookform.useController.call(void 0, {
1709
+ name,
1710
+ control,
1711
+ defaultValue: initialValue
1712
+ });
1713
+ const { field: dependentField } = _reacthookform.useController.call(void 0, {
1714
+ name: dependsOn,
1715
+ control
1716
+ });
1717
+ const parentValueRef = _react.useRef.call(void 0, _nullishCoalesce(dependentField.value, () => ( null)));
1718
+ const [hasAutoSelected, setHasAutoSelected] = _react.useState.call(void 0, false);
1719
+ const getOptionValue = _react.useCallback.call(void 0,
1720
+ (option) => {
1721
+ if (typeof option === "string") return option;
1722
+ return option ? option[valueKey] : null;
1723
+ },
1724
+ [valueKey]
1725
+ );
1726
+ const getOptionLabel = _react.useCallback.call(void 0,
1727
+ (option) => {
1728
+ if (typeof option === "string") return option;
1729
+ return option ? option[labelKey] : "";
1730
+ },
1731
+ [labelKey]
1732
+ );
1733
+ _react.useEffect.call(void 0, () => {
1734
+ if (parentValueRef.current !== dependentField.value) {
1735
+ parentValueRef.current = dependentField.value;
1736
+ field.onChange(multiple ? [] : null);
1737
+ setHasAutoSelected(false);
1738
+ }
1739
+ }, [dependentField.value, field, multiple]);
1740
+ _react.useEffect.call(void 0, () => {
1741
+ if (!dependentField.value) return;
1742
+ if (isEdit) {
1743
+ if (field.value && (multiple ? field.value.length > 0 : field.value))
1744
+ return;
1745
+ if (options.length === 1 && !hasAutoSelected) {
1746
+ field.onChange(
1747
+ multiple ? [getOptionValue(options[0])] : getOptionValue(options[0])
1748
+ );
1749
+ setHasAutoSelected(true);
1750
+ }
1751
+ } else {
1752
+ if (options.length === 1 && (!field.value || field.value.length === 0) && !hasAutoSelected) {
1753
+ field.onChange(
1754
+ multiple ? [getOptionValue(options[0])] : getOptionValue(options[0])
1755
+ );
1756
+ setHasAutoSelected(true);
1757
+ }
1758
+ }
1759
+ }, [
1760
+ isEdit,
1761
+ options,
1762
+ field.value,
1763
+ dependentField.value,
1764
+ multiple,
1765
+ getOptionValue,
1766
+ hasAutoSelected,
1767
+ field
1768
+ ]);
1769
+ const selectedValue = multiple ? Array.isArray(field.value) ? options.filter((opt) => field.value.includes(getOptionValue(opt))) : [] : _nullishCoalesce(options.find((opt) => getOptionValue(opt) === field.value), () => ( null));
1770
+ const handleChange = (_2, selected, reason) => {
1771
+ if (multiple) {
1772
+ if (reason === "clear") {
1773
+ field.onChange([]);
1774
+ } else {
1775
+ const newValues = selected.map((opt) => getOptionValue(opt));
1776
+ field.onChange(newValues);
1777
+ }
1778
+ } else {
1779
+ field.onChange(selected ? getOptionValue(selected) : null);
1780
+ }
1781
+ };
1782
+ const icon = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _CheckBoxOutlineBlank2.default, { fontSize: "small" });
1783
+ const checkedIcon = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _CheckBox2.default, { fontSize: "small" });
1784
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1785
+ _material.Autocomplete,
1786
+ {
1787
+ multiple,
1788
+ value: selectedValue,
1789
+ loading,
1790
+ options,
1791
+ getOptionLabel,
1792
+ isOptionEqualToValue: (option, value) => getOptionValue(option) === getOptionValue(value),
1793
+ filterSelectedOptions: multiple,
1794
+ disableCloseOnSelect: multiple,
1795
+ ref: field.ref,
1796
+ disabled: !dependentField.value || disabled,
1797
+ onChange: handleChange,
1798
+ onBlur: (event) => {
1799
+ field.onBlur();
1800
+ if (typeof onBlur === "function") {
1801
+ onBlur(event);
1802
+ }
1803
+ },
1804
+ fullWidth: true,
1805
+ renderOption: (props1, option, { selected }) => multiple ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "li", { ...props1, children: [
1806
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1807
+ _material.Checkbox,
1808
+ {
1809
+ icon,
1810
+ checkedIcon,
1811
+ checked: selected
1812
+ }
1813
+ ),
1814
+ getOptionLabel(option)
1815
+ ] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "li", { ...props1, children: getOptionLabel(option) }),
1816
+ renderTags: (tagValue, getTagProps) => tagValue.map((option, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1817
+ _material.Chip,
1818
+ {
1819
+ ...getTagProps({ index }),
1820
+ label: getOptionLabel(option),
1821
+ size: "small",
1822
+ variant: "filled"
1823
+ }
1824
+ )),
1825
+ renderInput: (params) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1826
+ _material.TextField,
1827
+ {
1828
+ ...params,
1829
+ label,
1830
+ error: !!error,
1831
+ helperText: error ? error.message : "",
1832
+ placeholder,
1833
+ slotProps: {
1834
+ input: {
1835
+ ...params.InputProps,
1836
+ endAdornment: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _react.Fragment, { children: [
1837
+ loading ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.CircularProgress, { color: "inherit", size: 20 }) : null,
1838
+ params.InputProps.endAdornment
1839
+ ] })
1840
+ }
1841
+ },
1842
+ variant: variant ? variant : "outlined",
1843
+ sx: {
1844
+ ...sx
1845
+ }
1846
+ }
1847
+ ),
1848
+ ...rest
1849
+ }
1850
+ );
1851
+ };
1852
+ var SelectMultiCascadeElement2 = ({
1853
+ gridProps = { size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 } },
1854
+ ...props
1855
+ }) => {
1856
+ if (gridProps) {
1857
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1858
+ _material.Grid2,
1859
+ {
1860
+ ...{ size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }, ...gridProps },
1861
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component13, { ...props })
1862
+ }
1863
+ );
1864
+ }
1865
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component13, { ...props });
1866
+ };
1867
+ SelectMultiCascadeElement2.displayName = "SelectMultiCascadeElement";
1868
+ var SelectMultiCascadeElement_default = SelectMultiCascadeElement2;
1869
+
1556
1870
  // src/wrappers/Field/index.ts
1557
1871
  var Field = {
1558
1872
  Text: TextFieldElement_default,
@@ -1566,7 +1880,8 @@ var Field = {
1566
1880
  SelectCascade: SelectCascadeElement_default,
1567
1881
  AsyncSelect: AsyncSelectElement_default,
1568
1882
  AsyncMultiSelect: AsyncMultiSelect_default,
1569
- CheckboxGroup: CheckboxGroup_default
1883
+ CheckboxGroup: CheckboxGroup_default,
1884
+ SelectMultiCascadeElement: SelectMultiCascadeElement_default
1570
1885
  };
1571
1886
  var Field_default = Field;
1572
1887