@gnwebsoft/ui 2.18.39 → 2.18.41

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,41 +3,48 @@
3
3
  var _chunk6JZ35VQJjs = require('./chunk-6JZ35VQJ.js');
4
4
 
5
5
 
6
- var _chunkDKBPCLECjs = require('./chunk-DKBPCLEC.js');
6
+ var _chunkFYN7F5WJjs = require('./chunk-FYN7F5WJ.js');
7
7
 
8
8
  // src/wrappers/DatePickerElement/DatePickerElement.tsx
9
-
10
-
9
+ var _react = require('react'); var React = _interopRequireWildcard(_react);
11
10
  var _reacthookform = require('react-hook-form');
12
-
13
-
14
-
15
- var _material = require('@mui/material');
16
-
17
-
18
11
  var _xdatepickers = require('@mui/x-date-pickers');
19
- var _internals = require('@mui/x-date-pickers/internals');
12
+ var _material = require('@mui/material');
20
13
  var _jsxruntime = require('react/jsx-runtime');
14
+ function useTransform2(options) {
15
+ const value = _react.useMemo.call(void 0,
16
+ () => typeof _optionalChain([options, 'access', _3 => _3.transform, 'optionalAccess', _4 => _4.input]) === "function" ? options.transform.input(options.value) : options.value,
17
+ [options.transform, options.value]
18
+ );
19
+ const onChange = _react.useCallback.call(void 0,
20
+ (...event) => {
21
+ if (typeof _optionalChain([options, 'access', _5 => _5.transform, 'optionalAccess', _6 => _6.output]) === "function") {
22
+ options.onChange(options.transform.output(...event));
23
+ } else {
24
+ options.onChange(...event);
25
+ }
26
+ },
27
+ [options]
28
+ );
29
+ return {
30
+ value,
31
+ onChange
32
+ };
33
+ }
21
34
  var Component = function DatePickerElement(props) {
22
35
  const {
23
- parseError,
24
36
  name,
25
37
  required,
26
- rules = {},
27
38
  inputProps,
28
39
  control,
29
40
  textReadOnly,
30
41
  label,
31
42
  placeholder,
32
- gridProps,
33
43
  slotProps,
34
- transform,
35
44
  datePickerProps = {},
36
- variant,
37
45
  sx,
38
46
  ...rest
39
47
  } = props;
40
- const adapter = _internals.useLocalizationContext.call(void 0, );
41
48
  const { disabled, inputRef, onClose, ...restDatePickerProps } = datePickerProps;
42
49
  const {
43
50
  field,
@@ -47,12 +54,15 @@ var Component = function DatePickerElement(props) {
47
54
  control,
48
55
  defaultValue: null
49
56
  });
50
- const { value, onChange } = _chunk6JZ35VQJjs.useTransform.call(void 0, {
57
+ const { value, onChange } = useTransform2({
51
58
  value: field.value,
52
59
  onChange: field.onChange,
53
60
  transform: {
54
- input: typeof _optionalChain([transform, 'optionalAccess', _3 => _3.input]) === "function" ? transform.input : (newValue) => _chunkDKBPCLECjs.readValueAsDate.call(void 0, adapter, newValue),
55
- output: typeof _optionalChain([transform, 'optionalAccess', _4 => _4.output]) === "function" ? transform.output : (newValue) => newValue
61
+ //@ts-ignore
62
+ output: (outputValue, context) => {
63
+ if (outputValue === null) return null;
64
+ return outputValue;
65
+ }
56
66
  }
57
67
  });
58
68
  const handleInputRef = _material.useForkRef.call(void 0, field.ref, inputRef);
@@ -82,6 +92,9 @@ var Component = function DatePickerElement(props) {
82
92
  sx,
83
93
  slotProps: {
84
94
  ...slotProps,
95
+ actionBar: {
96
+ actions: ["clear", "today", "cancel", "accept"]
97
+ },
85
98
  textField: {
86
99
  ...inputProps,
87
100
  required,
@@ -89,15 +102,15 @@ var Component = function DatePickerElement(props) {
89
102
  fullWidth: true,
90
103
  onBlur: (event) => {
91
104
  field.onBlur();
92
- if (typeof _optionalChain([inputProps, 'optionalAccess', _5 => _5.onBlur]) === "function") {
105
+ if (typeof _optionalChain([inputProps, 'optionalAccess', _7 => _7.onBlur]) === "function") {
93
106
  inputProps.onBlur(event);
94
107
  }
95
108
  },
96
109
  error: !!error,
97
- helperText: error ? error.message : _optionalChain([inputProps, 'optionalAccess', _6 => _6.helperText]) || rest.helperText,
110
+ helperText: error ? error.message : _optionalChain([inputProps, 'optionalAccess', _8 => _8.helperText]) || rest.helperText,
98
111
  inputProps: {
99
112
  readOnly: !!textReadOnly,
100
- ..._optionalChain([inputProps, 'optionalAccess', _7 => _7.inputProps])
113
+ ..._optionalChain([inputProps, 'optionalAccess', _9 => _9.inputProps])
101
114
  }
102
115
  }
103
116
  }
@@ -117,7 +130,7 @@ DatePickerElement2.displayName = "DatePickerElement";
117
130
  var DatePickerElement_default = DatePickerElement2;
118
131
 
119
132
  // src/wrappers/PasswordElement/PasswordElement.tsx
120
- var _react = require('react'); var React = _interopRequireWildcard(_react);
133
+
121
134
 
122
135
 
123
136
 
@@ -193,7 +206,7 @@ var Component2 = function PasswordEl(props) {
193
206
  ...slotProps,
194
207
  input: {
195
208
  endAdornment,
196
- ..._optionalChain([slotProps, 'optionalAccess', _8 => _8.input])
209
+ ..._optionalChain([slotProps, 'optionalAccess', _10 => _10.input])
197
210
  }
198
211
  }
199
212
  },
@@ -267,10 +280,10 @@ var Component3 = function RadioButtonGroup(props) {
267
280
  value: field.value,
268
281
  onChange: field.onChange,
269
282
  transform: {
270
- input: typeof _optionalChain([transform, 'optionalAccess', _9 => _9.input]) === "function" ? transform.input : (value2) => {
283
+ input: typeof _optionalChain([transform, 'optionalAccess', _11 => _11.input]) === "function" ? transform.input : (value2) => {
271
284
  return value2 || "";
272
285
  },
273
- output: typeof _optionalChain([transform, 'optionalAccess', _10 => _10.output]) === "function" ? _optionalChain([transform, 'optionalAccess', _11 => _11.output]) : (_event, value2) => {
286
+ output: typeof _optionalChain([transform, 'optionalAccess', _12 => _12.output]) === "function" ? _optionalChain([transform, 'optionalAccess', _13 => _13.output]) : (_event, value2) => {
274
287
  if (value2 && type === "number") {
275
288
  return Number(value2);
276
289
  }
@@ -315,7 +328,7 @@ var Component3 = function RadioButtonGroup(props) {
315
328
  option
316
329
  );
317
330
  }
318
- let val = returnObject ? _optionalChain([value, 'optionalAccess', _12 => _12[valueKey]]) : value;
331
+ let val = returnObject ? _optionalChain([value, 'optionalAccess', _14 => _14[valueKey]]) : value;
319
332
  if (type === "number") {
320
333
  val = Number(val);
321
334
  }
@@ -405,10 +418,10 @@ var Component4 = function TextFieldElement(props) {
405
418
  value: field.value,
406
419
  onChange: field.onChange,
407
420
  transform: {
408
- input: typeof _optionalChain([transform, 'optionalAccess', _13 => _13.input]) === "function" ? transform.input : (value2) => {
421
+ input: typeof _optionalChain([transform, 'optionalAccess', _15 => _15.input]) === "function" ? transform.input : (value2) => {
409
422
  return _nullishCoalesce(value2, () => ( ""));
410
423
  },
411
- output: typeof _optionalChain([transform, 'optionalAccess', _14 => _14.output]) === "function" ? transform.output : (event) => {
424
+ output: typeof _optionalChain([transform, 'optionalAccess', _16 => _16.output]) === "function" ? transform.output : (event) => {
412
425
  const value2 = event.target.value;
413
426
  if (type !== "number") {
414
427
  return value2;
@@ -485,7 +498,7 @@ var TextFieldElement_default = TextFieldElement2;
485
498
 
486
499
 
487
500
 
488
-
501
+ var _internals = require('@mui/x-date-pickers/internals');
489
502
 
490
503
  var Component5 = function TimePickerElement(props) {
491
504
  const {
@@ -515,8 +528,8 @@ var Component5 = function TimePickerElement(props) {
515
528
  value: field.value,
516
529
  onChange: field.onChange,
517
530
  transform: {
518
- input: typeof _optionalChain([transform, 'optionalAccess', _15 => _15.input]) === "function" ? transform.input : (newValue) => _chunkDKBPCLECjs.readValueAsDate.call(void 0, adapter, newValue),
519
- output: typeof _optionalChain([transform, 'optionalAccess', _16 => _16.output]) === "function" ? transform.output : (newValue) => newValue
531
+ input: typeof _optionalChain([transform, 'optionalAccess', _17 => _17.input]) === "function" ? transform.input : (newValue) => _chunkFYN7F5WJjs.readValueAsDate.call(void 0, adapter, newValue),
532
+ output: typeof _optionalChain([transform, 'optionalAccess', _18 => _18.output]) === "function" ? transform.output : (newValue) => newValue
520
533
  }
521
534
  });
522
535
  const handleInputRef = _material.useForkRef.call(void 0, field.ref, inputRef);
@@ -546,10 +559,10 @@ var Component5 = function TimePickerElement(props) {
546
559
  required,
547
560
  fullWidth: true,
548
561
  error: !!error,
549
- helperText: error ? error.message : _optionalChain([inputProps, 'optionalAccess', _17 => _17.helperText]) || rest.helperText,
562
+ helperText: error ? error.message : _optionalChain([inputProps, 'optionalAccess', _19 => _19.helperText]) || rest.helperText,
550
563
  inputProps: {
551
564
  readOnly: textReadOnly,
552
- ..._optionalChain([inputProps, 'optionalAccess', _18 => _18.inputProps])
565
+ ..._optionalChain([inputProps, 'optionalAccess', _20 => _20.inputProps])
553
566
  }
554
567
  }
555
568
  }
@@ -568,20 +581,13 @@ var TimePickerElement2 = ({
568
581
  TimePickerElement2.displayName = "TimePickerElement";
569
582
  var TimePickerElement_default = TimePickerElement2;
570
583
 
571
- // src/wrappers/AsyncSelect/AsyncSelect.tsx
572
-
573
- var _TextField = require('@mui/material/TextField'); var _TextField2 = _interopRequireDefault(_TextField);
574
- var _Autocomplete = require('@mui/material/Autocomplete'); var _Autocomplete2 = _interopRequireDefault(_Autocomplete);
575
- var _utils = require('@mui/material/utils');
576
-
577
-
578
-
579
-
580
-
581
-
584
+ // src/wrappers/AsyncSelect/AsyncSelectElement.tsx
582
585
 
583
586
 
584
587
 
588
+ var _utils = require('@mui/material/utils');
589
+ var _TextField = require('@mui/material/TextField'); var _TextField2 = _interopRequireDefault(_TextField);
590
+ var _Autocomplete = require('@mui/material/Autocomplete'); var _Autocomplete2 = _interopRequireDefault(_Autocomplete);
585
591
 
586
592
 
587
593
  var Component6 = function AsyncSelectElement(props) {
@@ -596,6 +602,8 @@ var Component6 = function AsyncSelectElement(props) {
596
602
  label,
597
603
  queryFn,
598
604
  variant,
605
+ labelKey = "Label",
606
+ valueKey = "Value",
599
607
  sx,
600
608
  ...rest
601
609
  } = props;
@@ -611,22 +619,16 @@ var Component6 = function AsyncSelectElement(props) {
611
619
  const [selectedOption, setSelectedOption] = _react.useState.call(void 0, null);
612
620
  const [inputValue, setInputValue] = _react.useState.call(void 0, "");
613
621
  const inputValue2 = _react.useMemo.call(void 0, () => inputValue, [inputValue]);
614
- const setInputValue2 = _react.useCallback.call(void 0,
615
- (inputValue3) => setInputValue(inputValue3),
616
- []
617
- );
622
+ const setInputValue2 = _react.useCallback.call(void 0, (newValue) => setInputValue(newValue), []);
618
623
  const [options, setOptions] = _react.useState.call(void 0, []);
619
624
  const initialValueLoaded = _react.useRef.call(void 0,
620
- !initialValue ? true : !(initialValue != null && initialValue > 0)
625
+ !initialValue ? true : !(initialValue != null)
621
626
  );
622
627
  const fieldValue = _react.useRef.call(void 0, field.value);
623
628
  const fetchData = _react.useMemo.call(void 0,
624
- () => _utils.debounce.call(void 0,
625
- (payload, callback) => {
626
- queryFn(payload).then((c) => callback(c));
627
- },
628
- 400
629
- ),
629
+ () => _utils.debounce.call(void 0, (payload, callback) => {
630
+ queryFn(payload).then((c) => callback(c));
631
+ }, 400),
630
632
  []
631
633
  );
632
634
  const fillOptions = (results) => {
@@ -651,7 +653,7 @@ var Component6 = function AsyncSelectElement(props) {
651
653
  fetchData(payload, (results) => {
652
654
  if (active) {
653
655
  if (!!results && results.length > 0) {
654
- fillOptions(_optionalChain([results, 'optionalAccess', _19 => _19.filter, 'call', _20 => _20((c) => c.Value == initialValue)]));
656
+ fillOptions(_optionalChain([results, 'optionalAccess', _21 => _21.filter, 'call', _22 => _22((c) => c.Value == initialValue)]));
655
657
  setSelectedOption(results[0]);
656
658
  field.onChange(results[0].Value);
657
659
  fieldValue.current = results[0].Value;
@@ -671,7 +673,7 @@ var Component6 = function AsyncSelectElement(props) {
671
673
  setLoading(false);
672
674
  return void 0;
673
675
  }
674
- if (!!fieldValue.current) {
676
+ if (fieldValue.current) {
675
677
  if (field.value === fieldValue.current) {
676
678
  return void 0;
677
679
  }
@@ -691,16 +693,16 @@ var Component6 = function AsyncSelectElement(props) {
691
693
  };
692
694
  }, [initialValue, inputValue2, fetchData]);
693
695
  const selectRef = _react.useRef.call(void 0, null);
694
- const handleChange = (_2, selectedOption2, reason) => {
696
+ const handleChange = (_2, newSelectedOption, reason) => {
695
697
  if (reason === "clear") {
696
698
  setSelectedOption(null);
697
699
  field.onChange(null);
698
700
  setLoading(false);
699
701
  } else if (reason === "selectOption" || reason === "removeOption") {
700
- if (selectedOption2) {
701
- setSelectedOption(selectedOption2);
702
- field.onChange(selectedOption2.Value);
703
- fieldValue.current = selectedOption2.Value;
702
+ if (newSelectedOption) {
703
+ setSelectedOption(newSelectedOption);
704
+ field.onChange(newSelectedOption.Value);
705
+ fieldValue.current = newSelectedOption.Value;
704
706
  setLoading(false);
705
707
  }
706
708
  }
@@ -714,6 +716,14 @@ var Component6 = function AsyncSelectElement(props) {
714
716
  setLoading(false);
715
717
  }
716
718
  }, [field.value]);
719
+ const getOptionValue = (option) => {
720
+ if (typeof option === "string") return option;
721
+ return option ? option[valueKey] : null;
722
+ };
723
+ const getOptionLabel = (option) => {
724
+ if (typeof option === "string") return option;
725
+ return option ? option[labelKey] : "";
726
+ };
717
727
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
718
728
  _Autocomplete2.default,
719
729
  {
@@ -721,13 +731,14 @@ var Component6 = function AsyncSelectElement(props) {
721
731
  ref: selectRef,
722
732
  fullWidth: true,
723
733
  loading,
724
- getOptionLabel: (option) => option.Label,
725
- getOptionKey: (option) => option.Value,
726
- isOptionEqualToValue: (option, val) => option.Value === val.Value,
734
+ getOptionLabel,
735
+ getOptionKey: getOptionValue,
736
+ isOptionEqualToValue: (option, value) => getOptionValue(option) === getOptionValue(value),
727
737
  autoComplete: true,
728
738
  disabled,
729
739
  includeInputInList: true,
730
740
  options,
741
+ filterOptions: (x) => x,
731
742
  value: selectedOption,
732
743
  filterSelectedOptions: true,
733
744
  onChange: handleChange,
@@ -762,8 +773,8 @@ var Component6 = function AsyncSelectElement(props) {
762
773
  }
763
774
  }
764
775
  ),
765
- renderOption: (props2, option) => {
766
- const { key, ...optionProps } = props2;
776
+ renderOption: (renderProps, option) => {
777
+ const { key, ...optionProps } = renderProps;
767
778
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "li", { ...optionProps, children: option.Label }, key);
768
779
  }
769
780
  }
@@ -779,7 +790,7 @@ var AsyncSelectElement2 = ({
779
790
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component6, { ...props });
780
791
  };
781
792
  AsyncSelectElement2.displayName = "AsyncSelectElement";
782
- var AsyncSelect_default = AsyncSelectElement2;
793
+ var AsyncSelectElement_default = AsyncSelectElement2;
783
794
 
784
795
  // src/wrappers/AsyncMultiSelect/AsyncMultiSelect.tsx
785
796
  var _lodash = require('lodash'); var _lodash2 = _interopRequireDefault(_lodash);
@@ -996,7 +1007,6 @@ var AsyncMultiSelect_default = AsyncSelectMultiElement2;
996
1007
 
997
1008
 
998
1009
 
999
-
1000
1010
  var Component8 = function SelectElement(props) {
1001
1011
  const {
1002
1012
  name,
@@ -1005,16 +1015,24 @@ var Component8 = function SelectElement(props) {
1005
1015
  isEdit,
1006
1016
  options,
1007
1017
  label,
1018
+ sx,
1019
+ variant,
1020
+ disabled,
1008
1021
  labelKey = "Label",
1009
1022
  valueKey = "Value",
1023
+ placeholder,
1010
1024
  textFieldProps = {},
1011
1025
  ...rest
1012
1026
  } = props;
1013
- const { required, disabled } = textFieldProps;
1014
- const { field } = _reacthookform.useController.call(void 0, {
1027
+ const { required } = textFieldProps;
1028
+ const {
1029
+ field,
1030
+ fieldState: { error }
1031
+ } = _reacthookform.useController.call(void 0, {
1015
1032
  name,
1016
1033
  control
1017
1034
  });
1035
+ const theme = _material.useTheme.call(void 0, );
1018
1036
  const getOptionValue = _react.useCallback.call(void 0,
1019
1037
  (option) => {
1020
1038
  if (typeof option === "string") return option;
@@ -1032,7 +1050,7 @@ var Component8 = function SelectElement(props) {
1032
1050
  const handleChange = (event, newValue, reason) => {
1033
1051
  const option = newValue;
1034
1052
  field.onChange(option ? getOptionValue(option) : null);
1035
- _optionalChain([onChange, 'optionalCall', _21 => _21(event, newValue, reason)]);
1053
+ _optionalChain([onChange, 'optionalCall', _23 => _23(event, newValue, reason)]);
1036
1054
  };
1037
1055
  _react.useEffect.call(void 0, () => {
1038
1056
  if (!isEdit && options.length === 1 && (field.value == null || field.value == void 0 || field.value === "")) {
@@ -1040,7 +1058,7 @@ var Component8 = function SelectElement(props) {
1040
1058
  const defaultValue = getOptionValue(defaultOption);
1041
1059
  field.onChange(defaultValue);
1042
1060
  }
1043
- }, [isEdit, options, field.value, field.onChange, getOptionValue, field]);
1061
+ }, [isEdit, options]);
1044
1062
  const autocompleteValue = _react.useMemo.call(void 0,
1045
1063
  () => _nullishCoalesce(options.find((option) => getOptionValue(option) === field.value), () => ( null)),
1046
1064
  [field.value, options, getOptionValue]
@@ -1053,24 +1071,33 @@ var Component8 = function SelectElement(props) {
1053
1071
  options,
1054
1072
  value: autocompleteValue,
1055
1073
  onChange: handleChange,
1074
+ disabled,
1056
1075
  getOptionLabel: (option) => getOptionLabel(option),
1076
+ ref: field.ref,
1057
1077
  isOptionEqualToValue: (option, value) => getOptionValue(option) === getOptionValue(value),
1058
- renderInput: (params) => {
1059
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1060
- _material.TextField,
1061
- {
1062
- ...params,
1063
- required,
1064
- label,
1065
- sx: {
1066
- "& .MuiInputLabel-asterisk": { color: "red" },
1067
- "& .MuiInputBase-input": {
1068
- cursor: disabled ? "not-allowed" : "default"
1069
- }
1070
- }
1078
+ renderInput: (params) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1079
+ _material.TextField,
1080
+ {
1081
+ ...params,
1082
+ fullWidth: true,
1083
+ required,
1084
+ error: !!error,
1085
+ helperText: error ? error.message : "",
1086
+ label,
1087
+ placeholder,
1088
+ variant: variant ? variant : "outlined",
1089
+ sx: {
1090
+ "& .MuiOutlinedInput-root": {
1091
+ bgcolor: disabled ? theme.palette.action.disabledBackground : "transparent"
1092
+ },
1093
+ "& .MuiInputLabel-asterisk": { color: "red" },
1094
+ "& .MuiInputBase-input": {
1095
+ cursor: disabled ? "not-allowed" : "default"
1096
+ },
1097
+ ...sx
1071
1098
  }
1072
- );
1073
- }
1099
+ }
1100
+ )
1074
1101
  }
1075
1102
  );
1076
1103
  };
@@ -1089,27 +1116,24 @@ var SelectElement_default = SelectElement2;
1089
1116
  // src/wrappers/SelectMultiElement/SelectMultiElement.tsx
1090
1117
 
1091
1118
 
1092
-
1093
-
1094
-
1095
-
1096
-
1097
-
1098
-
1119
+ var _CheckBox = require('@mui/icons-material/CheckBox'); var _CheckBox2 = _interopRequireDefault(_CheckBox);
1120
+ var _CheckBoxOutlineBlank = require('@mui/icons-material/CheckBoxOutlineBlank'); var _CheckBoxOutlineBlank2 = _interopRequireDefault(_CheckBoxOutlineBlank);
1099
1121
 
1100
1122
 
1101
1123
  var Component9 = function SelectMultiElement(props) {
1102
1124
  const {
1103
1125
  name,
1126
+ control,
1104
1127
  onBlur,
1105
1128
  disabled,
1106
1129
  options,
1107
- control,
1108
1130
  loading = false,
1109
1131
  placeholder,
1110
1132
  label,
1111
1133
  variant,
1112
1134
  sx,
1135
+ labelKey = "Label",
1136
+ valueKey = "Value",
1113
1137
  ...rest
1114
1138
  } = props;
1115
1139
  const {
@@ -1119,27 +1143,38 @@ var Component9 = function SelectMultiElement(props) {
1119
1143
  name,
1120
1144
  control
1121
1145
  });
1122
- const [selectedOptions, setSelectedOptions] = _react.useState.call(void 0, []);
1123
- const handleChange = (_2, selectedOptions2, reason) => {
1146
+ const getOptionValue = (option) => {
1147
+ if (typeof option === "string") return option;
1148
+ return option ? option[valueKey] : null;
1149
+ };
1150
+ const getOptionLabel = (option) => {
1151
+ if (typeof option === "string") return option;
1152
+ return option ? option[labelKey] : "";
1153
+ };
1154
+ const selectedValue = field.value && Array.isArray(field.value) ? options.filter((option) => field.value.includes(getOptionValue(option))) : [];
1155
+ const handleChange = (_2, selectedOptions, reason) => {
1124
1156
  if (reason === "clear") {
1125
- setSelectedOptions([]);
1126
1157
  field.onChange([]);
1127
1158
  } else if (reason === "selectOption" || reason === "removeOption") {
1128
- setSelectedOptions(selectedOptions2);
1129
- field.onChange(selectedOptions2.map((c) => c.Value));
1159
+ const newValues = selectedOptions.map((option) => getOptionValue(option));
1160
+ field.onChange(newValues);
1130
1161
  }
1131
1162
  };
1163
+ const icon = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _CheckBoxOutlineBlank2.default, { fontSize: "small" });
1164
+ const checkedIcon = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _CheckBox2.default, { fontSize: "small" });
1132
1165
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1133
1166
  _material.Autocomplete,
1134
1167
  {
1135
1168
  multiple: true,
1136
- value: selectedOptions,
1169
+ value: selectedValue,
1137
1170
  loading,
1138
1171
  options,
1139
- getOptionLabel: (c) => c.Label,
1172
+ getOptionLabel,
1173
+ isOptionEqualToValue: (option, value) => getOptionValue(option) === getOptionValue(value),
1140
1174
  filterSelectedOptions: true,
1175
+ disableCloseOnSelect: true,
1141
1176
  ref: field.ref,
1142
- disabled: field.disabled,
1177
+ disabled: _nullishCoalesce(disabled, () => ( field.disabled)),
1143
1178
  onChange: handleChange,
1144
1179
  onBlur: (event) => {
1145
1180
  field.onBlur();
@@ -1148,6 +1183,13 @@ var Component9 = function SelectMultiElement(props) {
1148
1183
  }
1149
1184
  },
1150
1185
  fullWidth: true,
1186
+ renderOption: (props1, option, { selected }) => {
1187
+ const { key, ...optionProps } = props1;
1188
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "li", { ...optionProps, children: [
1189
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Checkbox, { icon, checkedIcon, checked: selected }),
1190
+ getOptionLabel(option)
1191
+ ] }, key);
1192
+ },
1151
1193
  renderInput: (params) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1152
1194
  _material.TextField,
1153
1195
  {
@@ -1201,23 +1243,41 @@ var SelectMultiElement_default = SelectMultiElement2;
1201
1243
 
1202
1244
  var Component10 = function SelectCascadeElement(props) {
1203
1245
  const {
1246
+ labelKey = "Label",
1247
+ valueKey = "Value",
1204
1248
  name,
1205
1249
  onBlur,
1206
1250
  onChange,
1207
1251
  disabled,
1208
1252
  options,
1209
1253
  control,
1210
- gridProps,
1211
1254
  loading = false,
1212
1255
  placeholder,
1213
1256
  label,
1214
1257
  dependsOn,
1215
- initialValue,
1258
+ textFieldProps = {},
1216
1259
  variant,
1217
1260
  sx,
1218
1261
  isEdit = false,
1219
1262
  ...rest
1220
1263
  } = props;
1264
+ const { required } = textFieldProps;
1265
+ const getOptionKey = _react.useCallback.call(void 0,
1266
+ (option) => {
1267
+ if (typeof option === "string" || typeof option === "number") return option;
1268
+ const key = option ? option[valueKey] : void 0;
1269
+ return key !== void 0 && key !== null ? String(key) : "";
1270
+ },
1271
+ [valueKey]
1272
+ );
1273
+ const getOptionLabel = _react.useCallback.call(void 0,
1274
+ (option) => {
1275
+ if (typeof option === "string") return option;
1276
+ return option ? String(option[labelKey]) : "";
1277
+ },
1278
+ [labelKey]
1279
+ );
1280
+ const isOptionEqualToValue = (option, value) => getOptionKey(option) === getOptionKey(value);
1221
1281
  const {
1222
1282
  field,
1223
1283
  fieldState: { error }
@@ -1231,44 +1291,49 @@ var Component10 = function SelectCascadeElement(props) {
1231
1291
  control
1232
1292
  });
1233
1293
  const parentValueRef = _react.useRef.call(void 0, _nullishCoalesce(dependentField.value, () => ( null)));
1294
+ const [hasAutoSelected, setHasAutoSelected] = _react.useState.call(void 0, false);
1234
1295
  _react.useEffect.call(void 0, () => {
1235
- if (!!dependentField.value && _optionalChain([parentValueRef, 'optionalAccess', _22 => _22.current, 'optionalAccess', _23 => _23.Value]) !== dependentField.value || dependentField.value === null) {
1296
+ if (!!dependentField.value && _optionalChain([parentValueRef, 'optionalAccess', _24 => _24.current]) !== dependentField.value || dependentField.value === null) {
1236
1297
  field.onChange(null);
1298
+ setHasAutoSelected(false);
1237
1299
  }
1238
1300
  }, [dependentField.value]);
1239
- _react.useEffect.call(void 0, () => {
1240
- if (initialValue) {
1241
- field.onChange(initialValue);
1242
- }
1243
- }, [initialValue]);
1244
- const [hasAutoSelected, setHasAutoSelected] = _react.useState.call(void 0, false);
1245
1301
  _react.useEffect.call(void 0, () => {
1246
1302
  if (isEdit && !disabled && options.length === 1 && field.value == null && !hasAutoSelected) {
1247
- field.onChange(options[0].Value);
1303
+ field.onChange(getOptionKey(options[0]));
1248
1304
  setHasAutoSelected(true);
1249
1305
  } else {
1250
1306
  if (options.length === 1 && field.value == null && !hasAutoSelected) {
1251
- field.onChange(options[0].Value);
1307
+ field.onChange(getOptionKey(options[0]));
1252
1308
  setHasAutoSelected(true);
1253
1309
  }
1254
1310
  }
1255
- }, [options, field.value, field.onChange, hasAutoSelected, isEdit]);
1311
+ }, [
1312
+ options,
1313
+ field.value,
1314
+ field.onChange,
1315
+ hasAutoSelected,
1316
+ isEdit,
1317
+ disabled,
1318
+ field,
1319
+ getOptionKey,
1320
+ dependentField.onChange
1321
+ ]);
1256
1322
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1257
1323
  _material.Autocomplete,
1258
1324
  {
1259
1325
  ...rest,
1260
- value: field.value !== null ? _nullishCoalesce(options.find((option) => {
1261
- return field.value === option.Value;
1262
- }), () => ( null)) : null,
1326
+ value: options.map((option) => getOptionKey(option) === field.value ? option : null).find(Boolean) || null,
1263
1327
  size: "small",
1264
1328
  loading,
1265
1329
  options,
1266
- getOptionLabel: (c) => c.Label,
1267
- isOptionEqualToValue: (option, value) => option.Value === value.Value,
1330
+ getOptionKey,
1331
+ getOptionLabel,
1332
+ isOptionEqualToValue,
1268
1333
  ref: field.ref,
1269
- disabled,
1334
+ disabled: dependentField.value == null || disabled,
1270
1335
  onChange: (event, newValue, reason) => {
1271
- field.onChange(newValue ? newValue.Value : null);
1336
+ field.onChange(newValue ? getOptionKey(newValue) : null);
1272
1337
  if (onChange && typeof onChange === "function") {
1273
1338
  onChange(event, newValue, reason);
1274
1339
  }
@@ -1286,15 +1351,19 @@ var Component10 = function SelectCascadeElement(props) {
1286
1351
  ...params,
1287
1352
  fullWidth: true,
1288
1353
  error: !!error,
1354
+ required,
1289
1355
  helperText: error ? error.message : "",
1290
1356
  placeholder,
1291
1357
  label,
1292
1358
  variant: variant ? variant : "outlined",
1293
1359
  sx: {
1360
+ "& .MuiOutlinedInput-root": {
1361
+ bgcolor: disabled || dependentField.value == null ? theme.palette.action.disabledBackground : "transparent"
1362
+ },
1363
+ "& .MuiInputLabel-asterisk": { color: "red" },
1294
1364
  "& .MuiInputBase-input": {
1295
- cursor: disabled ? "not-allowed" : "default"
1365
+ cursor: disabled || dependentField.value == null ? "not-allowed" : "default"
1296
1366
  },
1297
- bgcolor: disabled ? theme.palette.action.disabledBackground : "transparent",
1298
1367
  ...sx
1299
1368
  }
1300
1369
  }
@@ -1406,7 +1475,7 @@ var Component12 = function CheckboxGroup(props) {
1406
1475
  disabled: rest.disabled
1407
1476
  });
1408
1477
  const [selectedValues, setSelectedValues] = _react.useState.call(void 0,
1409
- options.filter((c) => _optionalChain([field, 'access', _24 => _24.value, 'optionalAccess', _25 => _25.includes, 'call', _26 => _26(c.Value)])).map((c) => c.Value) || []
1478
+ options.filter((c) => _optionalChain([field, 'access', _25 => _25.value, 'optionalAccess', _26 => _26.includes, 'call', _27 => _27(c.Value)])).map((c) => c.Value) || []
1410
1479
  );
1411
1480
  _react.useEffect.call(void 0, () => {
1412
1481
  field.onChange(selectedValues ? [...selectedValues] : []);
@@ -1470,7 +1539,7 @@ var Field = {
1470
1539
  Select: SelectElement_default,
1471
1540
  SelectMulti: SelectMultiElement_default,
1472
1541
  SelectCascade: SelectCascadeElement_default,
1473
- AsyncSelect: AsyncSelect_default,
1542
+ AsyncSelect: AsyncSelectElement_default,
1474
1543
  AsyncMultiSelect: AsyncMultiSelect_default,
1475
1544
  CheckboxGroup: CheckboxGroup_default
1476
1545
  };