@gnwebsoft/ui 2.18.38 → 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-KADZH5FM.mjs → chunk-FSU3H777.mjs} +23 -1
- package/dist/{chunk-RWMC36UO.js → chunk-JKUOV3MN.js} +23 -1
- package/dist/{chunk-VOOWINZA.mjs → chunk-RVKKPXZC.mjs} +207 -122
- package/dist/{chunk-DIGNPXO5.js → chunk-VNU4ZOUE.js} +192 -107
- package/dist/components/index.d.mts +8 -1
- package/dist/components/index.d.ts +8 -1
- package/dist/components/index.js +4 -2
- package/dist/components/index.mjs +3 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -3
- package/dist/index.mjs +4 -2
- package/dist/wrappers/index.d.mts +36 -52
- package/dist/wrappers/index.d.ts +36 -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,13 +1009,6 @@ var AsyncMultiSelect_default = AsyncSelectMultiElement2;
|
|
|
996
1009
|
|
|
997
1010
|
|
|
998
1011
|
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
function isOptionType(option, key) {
|
|
1004
|
-
return typeof option === "object" && option !== null && key in option;
|
|
1005
|
-
}
|
|
1006
1012
|
var Component8 = function SelectElement(props) {
|
|
1007
1013
|
const {
|
|
1008
1014
|
name,
|
|
@@ -1011,50 +1017,89 @@ var Component8 = function SelectElement(props) {
|
|
|
1011
1017
|
isEdit,
|
|
1012
1018
|
options,
|
|
1013
1019
|
label,
|
|
1020
|
+
sx,
|
|
1021
|
+
variant,
|
|
1022
|
+
disabled,
|
|
1014
1023
|
labelKey = "Label",
|
|
1015
1024
|
valueKey = "Value",
|
|
1025
|
+
placeholder,
|
|
1026
|
+
textFieldProps = {},
|
|
1016
1027
|
...rest
|
|
1017
1028
|
} = props;
|
|
1018
|
-
const {
|
|
1029
|
+
const { required } = textFieldProps;
|
|
1030
|
+
const {
|
|
1031
|
+
field,
|
|
1032
|
+
fieldState: { error }
|
|
1033
|
+
} = _reacthookform.useController.call(void 0, {
|
|
1019
1034
|
name,
|
|
1020
1035
|
control
|
|
1021
1036
|
});
|
|
1022
|
-
const
|
|
1037
|
+
const theme = _material.useTheme.call(void 0, );
|
|
1038
|
+
const getOptionValue = _react.useCallback.call(void 0,
|
|
1039
|
+
(option) => {
|
|
1040
|
+
if (typeof option === "string") return option;
|
|
1041
|
+
return option ? option[valueKey] : null;
|
|
1042
|
+
},
|
|
1043
|
+
[valueKey]
|
|
1044
|
+
);
|
|
1045
|
+
const getOptionLabel = _react.useCallback.call(void 0,
|
|
1046
|
+
(option) => {
|
|
1047
|
+
if (typeof option === "string") return option;
|
|
1048
|
+
return option ? String(option[labelKey]) : "";
|
|
1049
|
+
},
|
|
1050
|
+
[labelKey]
|
|
1051
|
+
);
|
|
1023
1052
|
const handleChange = (event, newValue, reason) => {
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
} else {
|
|
1028
|
-
const option = newValue;
|
|
1029
|
-
field.onChange(_nullishCoalesce(option[valueKey], () => ( null)));
|
|
1030
|
-
setHasAutoSelected(true);
|
|
1031
|
-
}
|
|
1032
|
-
_optionalChain([onChange, 'optionalCall', _21 => _21(event, newValue, reason)]);
|
|
1053
|
+
const option = newValue;
|
|
1054
|
+
field.onChange(option ? getOptionValue(option) : null);
|
|
1055
|
+
_optionalChain([onChange, 'optionalCall', _23 => _23(event, newValue, reason)]);
|
|
1033
1056
|
};
|
|
1034
1057
|
_react.useEffect.call(void 0, () => {
|
|
1035
|
-
if (isEdit) {
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
const option = options[0];
|
|
1040
|
-
field.onChange(option);
|
|
1041
|
-
setHasAutoSelected(true);
|
|
1042
|
-
}
|
|
1058
|
+
if (!isEdit && options.length === 1 && (field.value == null || field.value == void 0 || field.value === "")) {
|
|
1059
|
+
const defaultOption = options[0];
|
|
1060
|
+
const defaultValue = getOptionValue(defaultOption);
|
|
1061
|
+
field.onChange(defaultValue);
|
|
1043
1062
|
}
|
|
1044
|
-
}, [
|
|
1063
|
+
}, [isEdit, options]);
|
|
1064
|
+
const autocompleteValue = _react.useMemo.call(void 0,
|
|
1065
|
+
() => _nullishCoalesce(options.find((option) => getOptionValue(option) === field.value), () => ( null)),
|
|
1066
|
+
[field.value, options, getOptionValue]
|
|
1067
|
+
);
|
|
1045
1068
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1046
1069
|
_material.Autocomplete,
|
|
1047
1070
|
{
|
|
1048
1071
|
...rest,
|
|
1049
1072
|
filterSelectedOptions: false,
|
|
1050
1073
|
options,
|
|
1051
|
-
value:
|
|
1052
|
-
(option) => isOptionType(option, valueKey) && field.value === option[valueKey]
|
|
1053
|
-
), () => ( null)) : null,
|
|
1074
|
+
value: autocompleteValue,
|
|
1054
1075
|
onChange: handleChange,
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1076
|
+
disabled,
|
|
1077
|
+
getOptionLabel: (option) => getOptionLabel(option),
|
|
1078
|
+
ref: field.ref,
|
|
1079
|
+
isOptionEqualToValue: (option, value) => getOptionValue(option) === getOptionValue(value),
|
|
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
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
)
|
|
1058
1103
|
}
|
|
1059
1104
|
);
|
|
1060
1105
|
};
|
|
@@ -1073,27 +1118,24 @@ var SelectElement_default = SelectElement2;
|
|
|
1073
1118
|
// src/wrappers/SelectMultiElement/SelectMultiElement.tsx
|
|
1074
1119
|
|
|
1075
1120
|
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1121
|
+
var _CheckBox = require('@mui/icons-material/CheckBox'); var _CheckBox2 = _interopRequireDefault(_CheckBox);
|
|
1122
|
+
var _CheckBoxOutlineBlank = require('@mui/icons-material/CheckBoxOutlineBlank'); var _CheckBoxOutlineBlank2 = _interopRequireDefault(_CheckBoxOutlineBlank);
|
|
1083
1123
|
|
|
1084
1124
|
|
|
1085
1125
|
var Component9 = function SelectMultiElement(props) {
|
|
1086
1126
|
const {
|
|
1087
1127
|
name,
|
|
1128
|
+
control,
|
|
1088
1129
|
onBlur,
|
|
1089
1130
|
disabled,
|
|
1090
1131
|
options,
|
|
1091
|
-
control,
|
|
1092
1132
|
loading = false,
|
|
1093
1133
|
placeholder,
|
|
1094
1134
|
label,
|
|
1095
1135
|
variant,
|
|
1096
1136
|
sx,
|
|
1137
|
+
labelKey = "Label",
|
|
1138
|
+
valueKey = "Value",
|
|
1097
1139
|
...rest
|
|
1098
1140
|
} = props;
|
|
1099
1141
|
const {
|
|
@@ -1103,27 +1145,38 @@ var Component9 = function SelectMultiElement(props) {
|
|
|
1103
1145
|
name,
|
|
1104
1146
|
control
|
|
1105
1147
|
});
|
|
1106
|
-
const
|
|
1107
|
-
|
|
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) => {
|
|
1108
1158
|
if (reason === "clear") {
|
|
1109
|
-
setSelectedOptions([]);
|
|
1110
1159
|
field.onChange([]);
|
|
1111
1160
|
} else if (reason === "selectOption" || reason === "removeOption") {
|
|
1112
|
-
|
|
1113
|
-
field.onChange(
|
|
1161
|
+
const newValues = selectedOptions.map((option) => getOptionValue(option));
|
|
1162
|
+
field.onChange(newValues);
|
|
1114
1163
|
}
|
|
1115
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" });
|
|
1116
1167
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1117
1168
|
_material.Autocomplete,
|
|
1118
1169
|
{
|
|
1119
1170
|
multiple: true,
|
|
1120
|
-
value:
|
|
1171
|
+
value: selectedValue,
|
|
1121
1172
|
loading,
|
|
1122
1173
|
options,
|
|
1123
|
-
getOptionLabel
|
|
1174
|
+
getOptionLabel,
|
|
1175
|
+
isOptionEqualToValue: (option, value) => getOptionValue(option) === getOptionValue(value),
|
|
1124
1176
|
filterSelectedOptions: true,
|
|
1177
|
+
disableCloseOnSelect: true,
|
|
1125
1178
|
ref: field.ref,
|
|
1126
|
-
disabled: field.disabled,
|
|
1179
|
+
disabled: _nullishCoalesce(disabled, () => ( field.disabled)),
|
|
1127
1180
|
onChange: handleChange,
|
|
1128
1181
|
onBlur: (event) => {
|
|
1129
1182
|
field.onBlur();
|
|
@@ -1132,6 +1185,13 @@ var Component9 = function SelectMultiElement(props) {
|
|
|
1132
1185
|
}
|
|
1133
1186
|
},
|
|
1134
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
|
+
},
|
|
1135
1195
|
renderInput: (params) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1136
1196
|
_material.TextField,
|
|
1137
1197
|
{
|
|
@@ -1183,25 +1243,43 @@ var SelectMultiElement_default = SelectMultiElement2;
|
|
|
1183
1243
|
|
|
1184
1244
|
|
|
1185
1245
|
|
|
1186
|
-
var Component10 = function
|
|
1246
|
+
var Component10 = function SelectCascadeElement2(props) {
|
|
1187
1247
|
const {
|
|
1248
|
+
labelKey = "Label",
|
|
1249
|
+
valueKey = "Value",
|
|
1188
1250
|
name,
|
|
1189
1251
|
onBlur,
|
|
1190
1252
|
onChange,
|
|
1191
1253
|
disabled,
|
|
1192
1254
|
options,
|
|
1193
1255
|
control,
|
|
1194
|
-
gridProps,
|
|
1195
1256
|
loading = false,
|
|
1196
1257
|
placeholder,
|
|
1197
1258
|
label,
|
|
1198
1259
|
dependsOn,
|
|
1199
|
-
|
|
1260
|
+
textFieldProps = {},
|
|
1200
1261
|
variant,
|
|
1201
1262
|
sx,
|
|
1202
1263
|
isEdit = false,
|
|
1203
1264
|
...rest
|
|
1204
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);
|
|
1205
1283
|
const {
|
|
1206
1284
|
field,
|
|
1207
1285
|
fieldState: { error }
|
|
@@ -1216,43 +1294,46 @@ var Component10 = function SelectCascadeElement(props) {
|
|
|
1216
1294
|
});
|
|
1217
1295
|
const parentValueRef = _react.useRef.call(void 0, _nullishCoalesce(dependentField.value, () => ( null)));
|
|
1218
1296
|
_react.useEffect.call(void 0, () => {
|
|
1219
|
-
if (!!dependentField.value && _optionalChain([parentValueRef, 'optionalAccess',
|
|
1297
|
+
if (!!dependentField.value && _optionalChain([parentValueRef, 'optionalAccess', _24 => _24.current]) !== dependentField.value || dependentField.value === null) {
|
|
1220
1298
|
field.onChange(null);
|
|
1221
1299
|
}
|
|
1222
|
-
}, [dependentField.value]);
|
|
1223
|
-
_react.useEffect.call(void 0, () => {
|
|
1224
|
-
if (initialValue) {
|
|
1225
|
-
field.onChange(initialValue);
|
|
1226
|
-
}
|
|
1227
|
-
}, [initialValue]);
|
|
1300
|
+
}, [dependentField.value, field]);
|
|
1228
1301
|
const [hasAutoSelected, setHasAutoSelected] = _react.useState.call(void 0, false);
|
|
1229
1302
|
_react.useEffect.call(void 0, () => {
|
|
1230
1303
|
if (isEdit && !disabled && options.length === 1 && field.value == null && !hasAutoSelected) {
|
|
1231
|
-
field.onChange(options[0]
|
|
1304
|
+
field.onChange(getOptionKey(options[0]));
|
|
1232
1305
|
setHasAutoSelected(true);
|
|
1233
1306
|
} else {
|
|
1234
1307
|
if (options.length === 1 && field.value == null && !hasAutoSelected) {
|
|
1235
|
-
field.onChange(options[0]
|
|
1308
|
+
field.onChange(getOptionKey(options[0]));
|
|
1236
1309
|
setHasAutoSelected(true);
|
|
1237
1310
|
}
|
|
1238
1311
|
}
|
|
1239
|
-
}, [
|
|
1312
|
+
}, [
|
|
1313
|
+
options,
|
|
1314
|
+
field.value,
|
|
1315
|
+
field.onChange,
|
|
1316
|
+
hasAutoSelected,
|
|
1317
|
+
isEdit,
|
|
1318
|
+
disabled,
|
|
1319
|
+
field,
|
|
1320
|
+
getOptionKey
|
|
1321
|
+
]);
|
|
1240
1322
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1241
1323
|
_material.Autocomplete,
|
|
1242
1324
|
{
|
|
1243
1325
|
...rest,
|
|
1244
|
-
value: field.value
|
|
1245
|
-
return field.value === option.Value;
|
|
1246
|
-
}), () => ( null)) : null,
|
|
1326
|
+
value: options.map((option) => getOptionKey(option) === field.value ? option : null).find(Boolean) || null,
|
|
1247
1327
|
size: "small",
|
|
1248
1328
|
loading,
|
|
1249
1329
|
options,
|
|
1250
|
-
|
|
1251
|
-
|
|
1330
|
+
getOptionKey,
|
|
1331
|
+
getOptionLabel,
|
|
1332
|
+
isOptionEqualToValue,
|
|
1252
1333
|
ref: field.ref,
|
|
1253
1334
|
disabled,
|
|
1254
1335
|
onChange: (event, newValue, reason) => {
|
|
1255
|
-
field.onChange(newValue ? newValue
|
|
1336
|
+
field.onChange(newValue ? getOptionKey(newValue) : null);
|
|
1256
1337
|
if (onChange && typeof onChange === "function") {
|
|
1257
1338
|
onChange(event, newValue, reason);
|
|
1258
1339
|
}
|
|
@@ -1270,15 +1351,19 @@ var Component10 = function SelectCascadeElement(props) {
|
|
|
1270
1351
|
...params,
|
|
1271
1352
|
fullWidth: true,
|
|
1272
1353
|
error: !!error,
|
|
1354
|
+
required,
|
|
1273
1355
|
helperText: error ? error.message : "",
|
|
1274
1356
|
placeholder,
|
|
1275
1357
|
label,
|
|
1276
1358
|
variant: variant ? variant : "outlined",
|
|
1277
1359
|
sx: {
|
|
1360
|
+
"& .MuiOutlinedInput-root": {
|
|
1361
|
+
bgcolor: disabled ? theme.palette.action.disabledBackground : "transparent"
|
|
1362
|
+
},
|
|
1363
|
+
"& .MuiInputLabel-asterisk": { color: "red" },
|
|
1278
1364
|
"& .MuiInputBase-input": {
|
|
1279
1365
|
cursor: disabled ? "not-allowed" : "default"
|
|
1280
1366
|
},
|
|
1281
|
-
bgcolor: disabled ? theme.palette.action.disabledBackground : "transparent",
|
|
1282
1367
|
...sx
|
|
1283
1368
|
}
|
|
1284
1369
|
}
|
|
@@ -1286,7 +1371,7 @@ var Component10 = function SelectCascadeElement(props) {
|
|
|
1286
1371
|
}
|
|
1287
1372
|
);
|
|
1288
1373
|
};
|
|
1289
|
-
var
|
|
1374
|
+
var SelectCascadeElement = ({
|
|
1290
1375
|
gridProps,
|
|
1291
1376
|
...props
|
|
1292
1377
|
}) => {
|
|
@@ -1295,8 +1380,8 @@ var SelectCascadeElement2 = ({
|
|
|
1295
1380
|
}
|
|
1296
1381
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component10, { ...props });
|
|
1297
1382
|
};
|
|
1298
|
-
|
|
1299
|
-
var SelectCascadeElement_default =
|
|
1383
|
+
SelectCascadeElement.displayName = "SelectCascadeElement";
|
|
1384
|
+
var SelectCascadeElement_default = SelectCascadeElement;
|
|
1300
1385
|
|
|
1301
1386
|
// src/wrappers/CheckboxElement/CheckboxElement.tsx
|
|
1302
1387
|
|
|
@@ -1390,7 +1475,7 @@ var Component12 = function CheckboxGroup(props) {
|
|
|
1390
1475
|
disabled: rest.disabled
|
|
1391
1476
|
});
|
|
1392
1477
|
const [selectedValues, setSelectedValues] = _react.useState.call(void 0,
|
|
1393
|
-
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) || []
|
|
1394
1479
|
);
|
|
1395
1480
|
_react.useEffect.call(void 0, () => {
|
|
1396
1481
|
field.onChange(selectedValues ? [...selectedValues] : []);
|
|
@@ -93,4 +93,11 @@ type AuthorizedViewProps = PropsWithChildren & {
|
|
|
93
93
|
};
|
|
94
94
|
declare const AuthorizedView: ({ children, show }: AuthorizedViewProps) => react_jsx_runtime.JSX.Element;
|
|
95
95
|
|
|
96
|
-
|
|
96
|
+
type CancelButtonProps = {
|
|
97
|
+
isSubmitting: boolean;
|
|
98
|
+
handleCancel: () => void;
|
|
99
|
+
sx?: SxProps;
|
|
100
|
+
};
|
|
101
|
+
declare const CancelButton: ({ isSubmitting, handleCancel, sx, }: CancelButtonProps) => react_jsx_runtime.JSX.Element;
|
|
102
|
+
|
|
103
|
+
export { AuthorizedView, CancelButton, ClearButton, FilterButton, FilterWrapper, FormWrapper, LabelText, ListWrapper, SimpleButton, SimpleToolbar };
|
|
@@ -93,4 +93,11 @@ type AuthorizedViewProps = PropsWithChildren & {
|
|
|
93
93
|
};
|
|
94
94
|
declare const AuthorizedView: ({ children, show }: AuthorizedViewProps) => react_jsx_runtime.JSX.Element;
|
|
95
95
|
|
|
96
|
-
|
|
96
|
+
type CancelButtonProps = {
|
|
97
|
+
isSubmitting: boolean;
|
|
98
|
+
handleCancel: () => void;
|
|
99
|
+
sx?: SxProps;
|
|
100
|
+
};
|
|
101
|
+
declare const CancelButton: ({ isSubmitting, handleCancel, sx, }: CancelButtonProps) => react_jsx_runtime.JSX.Element;
|
|
102
|
+
|
|
103
|
+
export { AuthorizedView, CancelButton, ClearButton, FilterButton, FilterWrapper, FormWrapper, LabelText, ListWrapper, SimpleButton, SimpleToolbar };
|
package/dist/components/index.js
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var _chunkRWMC36UOjs = require('../chunk-RWMC36UO.js');
|
|
12
11
|
|
|
12
|
+
var _chunkJKUOV3MNjs = require('../chunk-JKUOV3MN.js');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
@@ -19,4 +19,6 @@ var _chunkRWMC36UOjs = require('../chunk-RWMC36UO.js');
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
exports.AuthorizedView = _chunkJKUOV3MNjs.AuthorizedView_default; exports.CancelButton = _chunkJKUOV3MNjs.CancelButton_default; exports.ClearButton = _chunkJKUOV3MNjs.ClearButton_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;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AuthorizedView_default,
|
|
3
|
+
CancelButton_default,
|
|
3
4
|
ClearButton_default,
|
|
4
5
|
FilterButton_default,
|
|
5
6
|
FilterWrapper_default,
|
|
@@ -8,9 +9,10 @@ import {
|
|
|
8
9
|
ListWrapper_default,
|
|
9
10
|
SimpleButton_default,
|
|
10
11
|
SimpleToolbar_default
|
|
11
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-FSU3H777.mjs";
|
|
12
13
|
export {
|
|
13
14
|
AuthorizedView_default as AuthorizedView,
|
|
15
|
+
CancelButton_default as CancelButton,
|
|
14
16
|
ClearButton_default as ClearButton,
|
|
15
17
|
FilterButton_default as FilterButton,
|
|
16
18
|
FilterWrapper_default as FilterWrapper,
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AuthorizedView, ClearButton, FilterButton, FilterWrapper, FormWrapper, LabelText, ListWrapper, SimpleButton, SimpleToolbar } from './components/index.mjs';
|
|
1
|
+
export { AuthorizedView, CancelButton, ClearButton, FilterButton, FilterWrapper, FormWrapper, LabelText, ListWrapper, SimpleButton, SimpleToolbar } from './components/index.mjs';
|
|
2
2
|
export { UseTransformOptions, UseTransformReturn, useTransform } from './hooks/index.mjs';
|
|
3
3
|
export { ApiResponse, ListResponse, OperationResponse, PostModel, ValidationErrors, ValueLabel } from './types/index.mjs';
|
|
4
4
|
export { api, api2, flattenObjectKeys, getTimezone, handleServerErrors, propertyExists, readValueAsDate, removeLeadingTrailingSlashes, schemaTools } from './utils/index.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AuthorizedView, ClearButton, FilterButton, FilterWrapper, FormWrapper, LabelText, ListWrapper, SimpleButton, SimpleToolbar } from './components/index.js';
|
|
1
|
+
export { AuthorizedView, CancelButton, ClearButton, FilterButton, FilterWrapper, FormWrapper, LabelText, ListWrapper, SimpleButton, SimpleToolbar } from './components/index.js';
|
|
2
2
|
export { UseTransformOptions, UseTransformReturn, useTransform } from './hooks/index.js';
|
|
3
3
|
export { ApiResponse, ListResponse, OperationResponse, PostModel, ValidationErrors, ValueLabel } from './types/index.js';
|
|
4
4
|
export { api, api2, flattenObjectKeys, getTimezone, handleServerErrors, propertyExists, readValueAsDate, removeLeadingTrailingSlashes, schemaTools } from './utils/index.js';
|