@gnwebsoft/ui 2.18.39 → 2.18.40
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.
- package/dist/{chunk-OHRT3LMC.mjs → chunk-RVKKPXZC.mjs} +181 -112
- package/dist/{chunk-NTUP43A7.js → chunk-VNU4ZOUE.js} +163 -94
- package/dist/index.js +2 -2
- package/dist/index.mjs +1 -1
- package/dist/wrappers/index.d.mts +35 -52
- package/dist/wrappers/index.d.ts +35 -52
- package/dist/wrappers/index.js +2 -2
- package/dist/wrappers/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -6,38 +6,45 @@ var _chunk6JZ35VQJjs = require('./chunk-6JZ35VQJ.js');
|
|
|
6
6
|
var _chunkDKBPCLECjs = require('./chunk-DKBPCLEC.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
|
|
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 } =
|
|
57
|
+
const { value, onChange } = useTransform2({
|
|
51
58
|
value: field.value,
|
|
52
59
|
onChange: field.onChange,
|
|
53
60
|
transform: {
|
|
54
|
-
|
|
55
|
-
output:
|
|
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',
|
|
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',
|
|
110
|
+
helperText: error ? error.message : _optionalChain([inputProps, 'optionalAccess', _8 => _8.helperText]) || rest.helperText,
|
|
98
111
|
inputProps: {
|
|
99
112
|
readOnly: !!textReadOnly,
|
|
100
|
-
..._optionalChain([inputProps, 'optionalAccess',
|
|
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
|
-
|
|
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',
|
|
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',
|
|
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',
|
|
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',
|
|
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',
|
|
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',
|
|
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',
|
|
519
|
-
output: typeof _optionalChain([transform, 'optionalAccess',
|
|
531
|
+
input: typeof _optionalChain([transform, 'optionalAccess', _17 => _17.input]) === "function" ? transform.input : (newValue) => _chunkDKBPCLECjs.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',
|
|
562
|
+
helperText: error ? error.message : _optionalChain([inputProps, 'optionalAccess', _19 => _19.helperText]) || rest.helperText,
|
|
550
563
|
inputProps: {
|
|
551
564
|
readOnly: textReadOnly,
|
|
552
|
-
..._optionalChain([inputProps, 'optionalAccess',
|
|
565
|
+
..._optionalChain([inputProps, 'optionalAccess', _20 => _20.inputProps])
|
|
553
566
|
}
|
|
554
567
|
}
|
|
555
568
|
}
|
|
@@ -651,7 +664,7 @@ var Component6 = function AsyncSelectElement(props) {
|
|
|
651
664
|
fetchData(payload, (results) => {
|
|
652
665
|
if (active) {
|
|
653
666
|
if (!!results && results.length > 0) {
|
|
654
|
-
fillOptions(_optionalChain([results, 'optionalAccess',
|
|
667
|
+
fillOptions(_optionalChain([results, 'optionalAccess', _21 => _21.filter, 'call', _22 => _22((c) => c.Value == initialValue)]));
|
|
655
668
|
setSelectedOption(results[0]);
|
|
656
669
|
field.onChange(results[0].Value);
|
|
657
670
|
fieldValue.current = results[0].Value;
|
|
@@ -996,7 +1009,6 @@ var AsyncMultiSelect_default = AsyncSelectMultiElement2;
|
|
|
996
1009
|
|
|
997
1010
|
|
|
998
1011
|
|
|
999
|
-
|
|
1000
1012
|
var Component8 = function SelectElement(props) {
|
|
1001
1013
|
const {
|
|
1002
1014
|
name,
|
|
@@ -1005,16 +1017,24 @@ var Component8 = function SelectElement(props) {
|
|
|
1005
1017
|
isEdit,
|
|
1006
1018
|
options,
|
|
1007
1019
|
label,
|
|
1020
|
+
sx,
|
|
1021
|
+
variant,
|
|
1022
|
+
disabled,
|
|
1008
1023
|
labelKey = "Label",
|
|
1009
1024
|
valueKey = "Value",
|
|
1025
|
+
placeholder,
|
|
1010
1026
|
textFieldProps = {},
|
|
1011
1027
|
...rest
|
|
1012
1028
|
} = props;
|
|
1013
|
-
const { required
|
|
1014
|
-
const {
|
|
1029
|
+
const { required } = textFieldProps;
|
|
1030
|
+
const {
|
|
1031
|
+
field,
|
|
1032
|
+
fieldState: { error }
|
|
1033
|
+
} = _reacthookform.useController.call(void 0, {
|
|
1015
1034
|
name,
|
|
1016
1035
|
control
|
|
1017
1036
|
});
|
|
1037
|
+
const theme = _material.useTheme.call(void 0, );
|
|
1018
1038
|
const getOptionValue = _react.useCallback.call(void 0,
|
|
1019
1039
|
(option) => {
|
|
1020
1040
|
if (typeof option === "string") return option;
|
|
@@ -1032,7 +1052,7 @@ var Component8 = function SelectElement(props) {
|
|
|
1032
1052
|
const handleChange = (event, newValue, reason) => {
|
|
1033
1053
|
const option = newValue;
|
|
1034
1054
|
field.onChange(option ? getOptionValue(option) : null);
|
|
1035
|
-
_optionalChain([onChange, 'optionalCall',
|
|
1055
|
+
_optionalChain([onChange, 'optionalCall', _23 => _23(event, newValue, reason)]);
|
|
1036
1056
|
};
|
|
1037
1057
|
_react.useEffect.call(void 0, () => {
|
|
1038
1058
|
if (!isEdit && options.length === 1 && (field.value == null || field.value == void 0 || field.value === "")) {
|
|
@@ -1040,7 +1060,7 @@ var Component8 = function SelectElement(props) {
|
|
|
1040
1060
|
const defaultValue = getOptionValue(defaultOption);
|
|
1041
1061
|
field.onChange(defaultValue);
|
|
1042
1062
|
}
|
|
1043
|
-
}, [isEdit, options
|
|
1063
|
+
}, [isEdit, options]);
|
|
1044
1064
|
const autocompleteValue = _react.useMemo.call(void 0,
|
|
1045
1065
|
() => _nullishCoalesce(options.find((option) => getOptionValue(option) === field.value), () => ( null)),
|
|
1046
1066
|
[field.value, options, getOptionValue]
|
|
@@ -1053,24 +1073,33 @@ var Component8 = function SelectElement(props) {
|
|
|
1053
1073
|
options,
|
|
1054
1074
|
value: autocompleteValue,
|
|
1055
1075
|
onChange: handleChange,
|
|
1076
|
+
disabled,
|
|
1056
1077
|
getOptionLabel: (option) => getOptionLabel(option),
|
|
1078
|
+
ref: field.ref,
|
|
1057
1079
|
isOptionEqualToValue: (option, value) => getOptionValue(option) === getOptionValue(value),
|
|
1058
|
-
renderInput: (params) =>
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1080
|
+
renderInput: (params) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1081
|
+
_material.TextField,
|
|
1082
|
+
{
|
|
1083
|
+
...params,
|
|
1084
|
+
fullWidth: true,
|
|
1085
|
+
required,
|
|
1086
|
+
error: !!error,
|
|
1087
|
+
helperText: error ? error.message : "",
|
|
1088
|
+
label,
|
|
1089
|
+
placeholder,
|
|
1090
|
+
variant: variant ? variant : "outlined",
|
|
1091
|
+
sx: {
|
|
1092
|
+
"& .MuiOutlinedInput-root": {
|
|
1093
|
+
bgcolor: disabled ? theme.palette.action.disabledBackground : "transparent"
|
|
1094
|
+
},
|
|
1095
|
+
"& .MuiInputLabel-asterisk": { color: "red" },
|
|
1096
|
+
"& .MuiInputBase-input": {
|
|
1097
|
+
cursor: disabled ? "not-allowed" : "default"
|
|
1098
|
+
},
|
|
1099
|
+
...sx
|
|
1071
1100
|
}
|
|
1072
|
-
|
|
1073
|
-
|
|
1101
|
+
}
|
|
1102
|
+
)
|
|
1074
1103
|
}
|
|
1075
1104
|
);
|
|
1076
1105
|
};
|
|
@@ -1089,27 +1118,24 @@ var SelectElement_default = SelectElement2;
|
|
|
1089
1118
|
// src/wrappers/SelectMultiElement/SelectMultiElement.tsx
|
|
1090
1119
|
|
|
1091
1120
|
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1121
|
+
var _CheckBox = require('@mui/icons-material/CheckBox'); var _CheckBox2 = _interopRequireDefault(_CheckBox);
|
|
1122
|
+
var _CheckBoxOutlineBlank = require('@mui/icons-material/CheckBoxOutlineBlank'); var _CheckBoxOutlineBlank2 = _interopRequireDefault(_CheckBoxOutlineBlank);
|
|
1099
1123
|
|
|
1100
1124
|
|
|
1101
1125
|
var Component9 = function SelectMultiElement(props) {
|
|
1102
1126
|
const {
|
|
1103
1127
|
name,
|
|
1128
|
+
control,
|
|
1104
1129
|
onBlur,
|
|
1105
1130
|
disabled,
|
|
1106
1131
|
options,
|
|
1107
|
-
control,
|
|
1108
1132
|
loading = false,
|
|
1109
1133
|
placeholder,
|
|
1110
1134
|
label,
|
|
1111
1135
|
variant,
|
|
1112
1136
|
sx,
|
|
1137
|
+
labelKey = "Label",
|
|
1138
|
+
valueKey = "Value",
|
|
1113
1139
|
...rest
|
|
1114
1140
|
} = props;
|
|
1115
1141
|
const {
|
|
@@ -1119,27 +1145,38 @@ var Component9 = function SelectMultiElement(props) {
|
|
|
1119
1145
|
name,
|
|
1120
1146
|
control
|
|
1121
1147
|
});
|
|
1122
|
-
const
|
|
1123
|
-
|
|
1148
|
+
const getOptionValue = (option) => {
|
|
1149
|
+
if (typeof option === "string") return option;
|
|
1150
|
+
return option ? option[valueKey] : null;
|
|
1151
|
+
};
|
|
1152
|
+
const getOptionLabel = (option) => {
|
|
1153
|
+
if (typeof option === "string") return option;
|
|
1154
|
+
return option ? option[labelKey] : "";
|
|
1155
|
+
};
|
|
1156
|
+
const selectedValue = field.value && Array.isArray(field.value) ? options.filter((option) => field.value.includes(getOptionValue(option))) : [];
|
|
1157
|
+
const handleChange = (_2, selectedOptions, reason) => {
|
|
1124
1158
|
if (reason === "clear") {
|
|
1125
|
-
setSelectedOptions([]);
|
|
1126
1159
|
field.onChange([]);
|
|
1127
1160
|
} else if (reason === "selectOption" || reason === "removeOption") {
|
|
1128
|
-
|
|
1129
|
-
field.onChange(
|
|
1161
|
+
const newValues = selectedOptions.map((option) => getOptionValue(option));
|
|
1162
|
+
field.onChange(newValues);
|
|
1130
1163
|
}
|
|
1131
1164
|
};
|
|
1165
|
+
const icon = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _CheckBoxOutlineBlank2.default, { fontSize: "small" });
|
|
1166
|
+
const checkedIcon = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _CheckBox2.default, { fontSize: "small" });
|
|
1132
1167
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1133
1168
|
_material.Autocomplete,
|
|
1134
1169
|
{
|
|
1135
1170
|
multiple: true,
|
|
1136
|
-
value:
|
|
1171
|
+
value: selectedValue,
|
|
1137
1172
|
loading,
|
|
1138
1173
|
options,
|
|
1139
|
-
getOptionLabel
|
|
1174
|
+
getOptionLabel,
|
|
1175
|
+
isOptionEqualToValue: (option, value) => getOptionValue(option) === getOptionValue(value),
|
|
1140
1176
|
filterSelectedOptions: true,
|
|
1177
|
+
disableCloseOnSelect: true,
|
|
1141
1178
|
ref: field.ref,
|
|
1142
|
-
disabled: field.disabled,
|
|
1179
|
+
disabled: _nullishCoalesce(disabled, () => ( field.disabled)),
|
|
1143
1180
|
onChange: handleChange,
|
|
1144
1181
|
onBlur: (event) => {
|
|
1145
1182
|
field.onBlur();
|
|
@@ -1148,6 +1185,13 @@ var Component9 = function SelectMultiElement(props) {
|
|
|
1148
1185
|
}
|
|
1149
1186
|
},
|
|
1150
1187
|
fullWidth: true,
|
|
1188
|
+
renderOption: (props1, option, { selected }) => {
|
|
1189
|
+
const { key, ...optionProps } = props1;
|
|
1190
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "li", { ...optionProps, children: [
|
|
1191
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Checkbox, { icon, checkedIcon, checked: selected }),
|
|
1192
|
+
getOptionLabel(option)
|
|
1193
|
+
] }, key);
|
|
1194
|
+
},
|
|
1151
1195
|
renderInput: (params) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1152
1196
|
_material.TextField,
|
|
1153
1197
|
{
|
|
@@ -1199,25 +1243,43 @@ var SelectMultiElement_default = SelectMultiElement2;
|
|
|
1199
1243
|
|
|
1200
1244
|
|
|
1201
1245
|
|
|
1202
|
-
var Component10 = function
|
|
1246
|
+
var Component10 = function SelectCascadeElement2(props) {
|
|
1203
1247
|
const {
|
|
1248
|
+
labelKey = "Label",
|
|
1249
|
+
valueKey = "Value",
|
|
1204
1250
|
name,
|
|
1205
1251
|
onBlur,
|
|
1206
1252
|
onChange,
|
|
1207
1253
|
disabled,
|
|
1208
1254
|
options,
|
|
1209
1255
|
control,
|
|
1210
|
-
gridProps,
|
|
1211
1256
|
loading = false,
|
|
1212
1257
|
placeholder,
|
|
1213
1258
|
label,
|
|
1214
1259
|
dependsOn,
|
|
1215
|
-
|
|
1260
|
+
textFieldProps = {},
|
|
1216
1261
|
variant,
|
|
1217
1262
|
sx,
|
|
1218
1263
|
isEdit = false,
|
|
1219
1264
|
...rest
|
|
1220
1265
|
} = props;
|
|
1266
|
+
const { required } = textFieldProps;
|
|
1267
|
+
const getOptionKey = _react.useCallback.call(void 0,
|
|
1268
|
+
(option) => {
|
|
1269
|
+
if (typeof option === "string" || typeof option === "number") return option;
|
|
1270
|
+
const key = option ? option[valueKey] : void 0;
|
|
1271
|
+
return key !== void 0 && key !== null ? String(key) : "";
|
|
1272
|
+
},
|
|
1273
|
+
[valueKey]
|
|
1274
|
+
);
|
|
1275
|
+
const getOptionLabel = _react.useCallback.call(void 0,
|
|
1276
|
+
(option) => {
|
|
1277
|
+
if (typeof option === "string") return option;
|
|
1278
|
+
return option ? String(option[labelKey]) : "";
|
|
1279
|
+
},
|
|
1280
|
+
[labelKey]
|
|
1281
|
+
);
|
|
1282
|
+
const isOptionEqualToValue = (option, value) => getOptionKey(option) === getOptionKey(value);
|
|
1221
1283
|
const {
|
|
1222
1284
|
field,
|
|
1223
1285
|
fieldState: { error }
|
|
@@ -1232,43 +1294,46 @@ var Component10 = function SelectCascadeElement(props) {
|
|
|
1232
1294
|
});
|
|
1233
1295
|
const parentValueRef = _react.useRef.call(void 0, _nullishCoalesce(dependentField.value, () => ( null)));
|
|
1234
1296
|
_react.useEffect.call(void 0, () => {
|
|
1235
|
-
if (!!dependentField.value && _optionalChain([parentValueRef, 'optionalAccess',
|
|
1297
|
+
if (!!dependentField.value && _optionalChain([parentValueRef, 'optionalAccess', _24 => _24.current]) !== dependentField.value || dependentField.value === null) {
|
|
1236
1298
|
field.onChange(null);
|
|
1237
1299
|
}
|
|
1238
|
-
}, [dependentField.value]);
|
|
1239
|
-
_react.useEffect.call(void 0, () => {
|
|
1240
|
-
if (initialValue) {
|
|
1241
|
-
field.onChange(initialValue);
|
|
1242
|
-
}
|
|
1243
|
-
}, [initialValue]);
|
|
1300
|
+
}, [dependentField.value, field]);
|
|
1244
1301
|
const [hasAutoSelected, setHasAutoSelected] = _react.useState.call(void 0, false);
|
|
1245
1302
|
_react.useEffect.call(void 0, () => {
|
|
1246
1303
|
if (isEdit && !disabled && options.length === 1 && field.value == null && !hasAutoSelected) {
|
|
1247
|
-
field.onChange(options[0]
|
|
1304
|
+
field.onChange(getOptionKey(options[0]));
|
|
1248
1305
|
setHasAutoSelected(true);
|
|
1249
1306
|
} else {
|
|
1250
1307
|
if (options.length === 1 && field.value == null && !hasAutoSelected) {
|
|
1251
|
-
field.onChange(options[0]
|
|
1308
|
+
field.onChange(getOptionKey(options[0]));
|
|
1252
1309
|
setHasAutoSelected(true);
|
|
1253
1310
|
}
|
|
1254
1311
|
}
|
|
1255
|
-
}, [
|
|
1312
|
+
}, [
|
|
1313
|
+
options,
|
|
1314
|
+
field.value,
|
|
1315
|
+
field.onChange,
|
|
1316
|
+
hasAutoSelected,
|
|
1317
|
+
isEdit,
|
|
1318
|
+
disabled,
|
|
1319
|
+
field,
|
|
1320
|
+
getOptionKey
|
|
1321
|
+
]);
|
|
1256
1322
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1257
1323
|
_material.Autocomplete,
|
|
1258
1324
|
{
|
|
1259
1325
|
...rest,
|
|
1260
|
-
value: field.value
|
|
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
|
-
|
|
1267
|
-
|
|
1330
|
+
getOptionKey,
|
|
1331
|
+
getOptionLabel,
|
|
1332
|
+
isOptionEqualToValue,
|
|
1268
1333
|
ref: field.ref,
|
|
1269
1334
|
disabled,
|
|
1270
1335
|
onChange: (event, newValue, reason) => {
|
|
1271
|
-
field.onChange(newValue ? newValue
|
|
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 ? theme.palette.action.disabledBackground : "transparent"
|
|
1362
|
+
},
|
|
1363
|
+
"& .MuiInputLabel-asterisk": { color: "red" },
|
|
1294
1364
|
"& .MuiInputBase-input": {
|
|
1295
1365
|
cursor: disabled ? "not-allowed" : "default"
|
|
1296
1366
|
},
|
|
1297
|
-
bgcolor: disabled ? theme.palette.action.disabledBackground : "transparent",
|
|
1298
1367
|
...sx
|
|
1299
1368
|
}
|
|
1300
1369
|
}
|
|
@@ -1302,7 +1371,7 @@ var Component10 = function SelectCascadeElement(props) {
|
|
|
1302
1371
|
}
|
|
1303
1372
|
);
|
|
1304
1373
|
};
|
|
1305
|
-
var
|
|
1374
|
+
var SelectCascadeElement = ({
|
|
1306
1375
|
gridProps,
|
|
1307
1376
|
...props
|
|
1308
1377
|
}) => {
|
|
@@ -1311,8 +1380,8 @@ var SelectCascadeElement2 = ({
|
|
|
1311
1380
|
}
|
|
1312
1381
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component10, { ...props });
|
|
1313
1382
|
};
|
|
1314
|
-
|
|
1315
|
-
var SelectCascadeElement_default =
|
|
1383
|
+
SelectCascadeElement.displayName = "SelectCascadeElement";
|
|
1384
|
+
var SelectCascadeElement_default = SelectCascadeElement;
|
|
1316
1385
|
|
|
1317
1386
|
// src/wrappers/CheckboxElement/CheckboxElement.tsx
|
|
1318
1387
|
|
|
@@ -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',
|
|
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] : []);
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ require('./chunk-7M2VOCYN.js');
|
|
|
14
14
|
require('./chunk-6BGQA4BQ.js');
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _chunkVNU4ZOUEjs = require('./chunk-VNU4ZOUE.js');
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
var _chunkSTC2BZ2Ljs = require('./chunk-STC2BZ2L.js');
|
|
@@ -55,4 +55,4 @@ var _chunkDKBPCLECjs = require('./chunk-DKBPCLEC.js');
|
|
|
55
55
|
|
|
56
56
|
|
|
57
57
|
|
|
58
|
-
exports.AuthorizedView = _chunkJKUOV3MNjs.AuthorizedView_default; exports.CancelButton = _chunkJKUOV3MNjs.CancelButton_default; exports.ClearButton = _chunkJKUOV3MNjs.ClearButton_default; exports.Field =
|
|
58
|
+
exports.AuthorizedView = _chunkJKUOV3MNjs.AuthorizedView_default; exports.CancelButton = _chunkJKUOV3MNjs.CancelButton_default; exports.ClearButton = _chunkJKUOV3MNjs.ClearButton_default; exports.Field = _chunkVNU4ZOUEjs.Field_default; exports.Field2 = _chunkSTC2BZ2Ljs.Field_default; exports.FilterButton = _chunkJKUOV3MNjs.FilterButton_default; exports.FilterWrapper = _chunkJKUOV3MNjs.FilterWrapper_default; exports.FormWrapper = _chunkJKUOV3MNjs.FormWrapper_default; exports.LabelText = _chunkJKUOV3MNjs.LabelText_default; exports.ListWrapper = _chunkJKUOV3MNjs.ListWrapper_default; exports.SimpleButton = _chunkJKUOV3MNjs.SimpleButton_default; exports.SimpleToolbar = _chunkJKUOV3MNjs.SimpleToolbar_default; exports.api = _chunkDKBPCLECjs.api; exports.api2 = _chunkDKBPCLECjs.api2; exports.flattenObjectKeys = _chunkDKBPCLECjs.flattenObjectKeys; exports.getTimezone = _chunkDKBPCLECjs.getTimezone; exports.handleServerErrors = _chunkDKBPCLECjs.handleServerErrors; exports.propertyExists = _chunkDKBPCLECjs.propertyExists; exports.readValueAsDate = _chunkDKBPCLECjs.readValueAsDate; exports.removeLeadingTrailingSlashes = _chunkDKBPCLECjs.removeLeadingTrailingSlashes; exports.schemaTools = _chunkDKBPCLECjs.schemaTools; exports.useTransform = _chunk6JZ35VQJjs.useTransform;
|
package/dist/index.mjs
CHANGED