@gnwebsoft/ui 2.18.48 → 2.18.49
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-7E3IFHIS.mjs +1890 -0
- package/dist/chunk-TFNX5LRO.js +1890 -0
- package/dist/index.js +5 -1882
- package/dist/index.mjs +3 -1880
- package/dist/wrappers3/index.js +8 -0
- package/dist/wrappers3/index.mjs +8 -0
- package/package.json +1 -1
- package/dist/AsyncSelectPayload-Cz4bgak0.d.mts +0 -10
- package/dist/AsyncSelectPayload-Cz4bgak0.d.ts +0 -10
- package/dist/OptionItem-oN6XnOTJ.d.mts +0 -14
- package/dist/OptionItem-oN6XnOTJ.d.ts +0 -14
- package/dist/components/index.d.mts +0 -103
- package/dist/components/index.d.ts +0 -103
- package/dist/hooks/index.d.mts +0 -17
- package/dist/hooks/index.d.ts +0 -17
- package/dist/index.d.mts +0 -236
- package/dist/index.d.ts +0 -236
- package/dist/types/index.d.mts +0 -44
- package/dist/types/index.d.ts +0 -44
- package/dist/utils/index.d.mts +0 -59
- package/dist/utils/index.d.ts +0 -59
- package/dist/wrappers/index.d.mts +0 -220
- package/dist/wrappers/index.d.ts +0 -220
- package/dist/wrappers2/index.d.mts +0 -247
- package/dist/wrappers2/index.d.ts +0 -247
package/dist/index.mjs
CHANGED
|
@@ -18,6 +18,9 @@ import {
|
|
|
18
18
|
import {
|
|
19
19
|
Field_default as Field_default2
|
|
20
20
|
} from "./chunk-5HOGPCEO.mjs";
|
|
21
|
+
import {
|
|
22
|
+
Field_default as Field_default3
|
|
23
|
+
} from "./chunk-7E3IFHIS.mjs";
|
|
21
24
|
import {
|
|
22
25
|
useTransform
|
|
23
26
|
} from "./chunk-GFSTK7KN.mjs";
|
|
@@ -32,1886 +35,6 @@ import {
|
|
|
32
35
|
removeLeadingTrailingSlashes,
|
|
33
36
|
schemaTools
|
|
34
37
|
} from "./chunk-RQS44YC7.mjs";
|
|
35
|
-
|
|
36
|
-
// src/wrappers3/DatePickerElement/DatePickerElement.tsx
|
|
37
|
-
import { useCallback } from "react";
|
|
38
|
-
import { useController } from "react-hook-form";
|
|
39
|
-
import { DatePicker } from "@mui/x-date-pickers";
|
|
40
|
-
import { Grid2, useForkRef, useTheme } from "@mui/material";
|
|
41
|
-
import { useLocalizationContext } from "@mui/x-date-pickers/internals";
|
|
42
|
-
import { jsx } from "react/jsx-runtime";
|
|
43
|
-
function readValueAsDate2(adapter, value) {
|
|
44
|
-
if (typeof value === "string") {
|
|
45
|
-
if (value === "") {
|
|
46
|
-
return null;
|
|
47
|
-
}
|
|
48
|
-
return adapter.utils.date(value);
|
|
49
|
-
}
|
|
50
|
-
return value;
|
|
51
|
-
}
|
|
52
|
-
function useTransform2(options) {
|
|
53
|
-
const value = typeof options.transform?.input === "function" ? options.transform.input(options.value) : options.value;
|
|
54
|
-
const onChange = useCallback(
|
|
55
|
-
(...event) => {
|
|
56
|
-
if (typeof options.transform?.output === "function") {
|
|
57
|
-
options.onChange(options.transform.output(...event));
|
|
58
|
-
} else {
|
|
59
|
-
options.onChange(...event);
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
[options]
|
|
63
|
-
);
|
|
64
|
-
return {
|
|
65
|
-
value,
|
|
66
|
-
onChange
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
var Component = function DatePickerElement(props) {
|
|
70
|
-
const {
|
|
71
|
-
name,
|
|
72
|
-
required,
|
|
73
|
-
inputProps,
|
|
74
|
-
control,
|
|
75
|
-
textReadOnly,
|
|
76
|
-
label,
|
|
77
|
-
placeholder,
|
|
78
|
-
slotProps,
|
|
79
|
-
datePickerProps = {},
|
|
80
|
-
transform,
|
|
81
|
-
sx,
|
|
82
|
-
...rest
|
|
83
|
-
} = props;
|
|
84
|
-
const adapter = useLocalizationContext();
|
|
85
|
-
const theme = useTheme();
|
|
86
|
-
const { disabled, inputRef, onClose, ...restDatePickerProps } = datePickerProps;
|
|
87
|
-
const {
|
|
88
|
-
field,
|
|
89
|
-
fieldState: { error }
|
|
90
|
-
} = useController({
|
|
91
|
-
name,
|
|
92
|
-
control,
|
|
93
|
-
defaultValue: null
|
|
94
|
-
});
|
|
95
|
-
const { value, onChange } = useTransform2({
|
|
96
|
-
value: field.value,
|
|
97
|
-
onChange: field.onChange,
|
|
98
|
-
transform: {
|
|
99
|
-
input: typeof transform?.input === "function" ? transform.input : (newValue) => readValueAsDate2(adapter, newValue),
|
|
100
|
-
output: (outputValue, context) => {
|
|
101
|
-
if (outputValue === null) return null;
|
|
102
|
-
return outputValue;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
const handleInputRef = useForkRef(field.ref, inputRef);
|
|
107
|
-
return /* @__PURE__ */ jsx(
|
|
108
|
-
DatePicker,
|
|
109
|
-
{
|
|
110
|
-
...rest,
|
|
111
|
-
...restDatePickerProps,
|
|
112
|
-
...field,
|
|
113
|
-
value,
|
|
114
|
-
label,
|
|
115
|
-
disabled,
|
|
116
|
-
...datePickerProps,
|
|
117
|
-
inputRef: handleInputRef,
|
|
118
|
-
onClose: (...args) => {
|
|
119
|
-
field.onBlur();
|
|
120
|
-
if (onClose) {
|
|
121
|
-
onClose(...args);
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
onChange: (newValue, context) => {
|
|
125
|
-
onChange(newValue, context);
|
|
126
|
-
if (typeof datePickerProps.onChange === "function") {
|
|
127
|
-
datePickerProps.onChange(newValue, context);
|
|
128
|
-
}
|
|
129
|
-
},
|
|
130
|
-
sx: {
|
|
131
|
-
"& .MuiOutlinedInput-root": {
|
|
132
|
-
bgcolor: disabled ? theme.palette.action.disabledBackground : "transparent"
|
|
133
|
-
},
|
|
134
|
-
"& .MuiInputLabel-asterisk": { color: "red" },
|
|
135
|
-
"& .MuiInputBase-input": {
|
|
136
|
-
cursor: disabled ? "not-allowed" : "default"
|
|
137
|
-
},
|
|
138
|
-
...sx
|
|
139
|
-
},
|
|
140
|
-
slotProps: {
|
|
141
|
-
...slotProps,
|
|
142
|
-
actionBar: {
|
|
143
|
-
actions: ["clear", "today", "cancel", "accept"]
|
|
144
|
-
},
|
|
145
|
-
textField: {
|
|
146
|
-
...inputProps,
|
|
147
|
-
required,
|
|
148
|
-
placeholder,
|
|
149
|
-
fullWidth: true,
|
|
150
|
-
onBlur: (event) => {
|
|
151
|
-
field.onBlur();
|
|
152
|
-
if (typeof inputProps?.onBlur === "function") {
|
|
153
|
-
inputProps.onBlur(event);
|
|
154
|
-
}
|
|
155
|
-
},
|
|
156
|
-
error: !!error,
|
|
157
|
-
helperText: error ? error.message : inputProps?.helperText || rest.helperText,
|
|
158
|
-
inputProps: {
|
|
159
|
-
readOnly: !!textReadOnly,
|
|
160
|
-
...inputProps?.inputProps
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
);
|
|
166
|
-
};
|
|
167
|
-
var DatePickerElement2 = ({
|
|
168
|
-
gridProps = { size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 } },
|
|
169
|
-
...props
|
|
170
|
-
}) => {
|
|
171
|
-
if (gridProps) {
|
|
172
|
-
return /* @__PURE__ */ jsx(
|
|
173
|
-
Grid2,
|
|
174
|
-
{
|
|
175
|
-
...{ size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }, ...gridProps },
|
|
176
|
-
children: /* @__PURE__ */ jsx(Component, { ...props })
|
|
177
|
-
}
|
|
178
|
-
);
|
|
179
|
-
}
|
|
180
|
-
return /* @__PURE__ */ jsx(Component, { ...props });
|
|
181
|
-
};
|
|
182
|
-
DatePickerElement2.displayName = "DatePickerElement";
|
|
183
|
-
var DatePickerElement_default = DatePickerElement2;
|
|
184
|
-
|
|
185
|
-
// src/wrappers3/PasswordElement/PasswordElement.tsx
|
|
186
|
-
import { useState } from "react";
|
|
187
|
-
import {
|
|
188
|
-
IconButton,
|
|
189
|
-
InputAdornment,
|
|
190
|
-
TextField,
|
|
191
|
-
useForkRef as useForkRef2,
|
|
192
|
-
Grid2 as Grid22
|
|
193
|
-
} from "@mui/material";
|
|
194
|
-
import Visibility from "@mui/icons-material/Visibility";
|
|
195
|
-
import VisibilityOff from "@mui/icons-material/VisibilityOff";
|
|
196
|
-
import {
|
|
197
|
-
useController as useController2
|
|
198
|
-
} from "react-hook-form";
|
|
199
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
200
|
-
var Component2 = function PasswordEl(props) {
|
|
201
|
-
const {
|
|
202
|
-
type,
|
|
203
|
-
required,
|
|
204
|
-
iconColor,
|
|
205
|
-
renderIcon = (password2) => password2 ? /* @__PURE__ */ jsx2(Visibility, {}) : /* @__PURE__ */ jsx2(VisibilityOff, {}),
|
|
206
|
-
slotProps,
|
|
207
|
-
name,
|
|
208
|
-
control,
|
|
209
|
-
component: TextFieldComponent = TextField,
|
|
210
|
-
inputRef,
|
|
211
|
-
onBlur,
|
|
212
|
-
...rest
|
|
213
|
-
} = props;
|
|
214
|
-
const [password, setPassword] = useState(true);
|
|
215
|
-
const endAdornment = /* @__PURE__ */ jsx2(InputAdornment, { position: "end", children: /* @__PURE__ */ jsx2(
|
|
216
|
-
IconButton,
|
|
217
|
-
{
|
|
218
|
-
onMouseDown: (e) => e.preventDefault(),
|
|
219
|
-
onClick: () => setPassword(!password),
|
|
220
|
-
tabIndex: -1,
|
|
221
|
-
color: iconColor ?? "default",
|
|
222
|
-
children: renderIcon(password)
|
|
223
|
-
}
|
|
224
|
-
) });
|
|
225
|
-
const {
|
|
226
|
-
field,
|
|
227
|
-
fieldState: { error }
|
|
228
|
-
} = useController2({
|
|
229
|
-
name,
|
|
230
|
-
control
|
|
231
|
-
});
|
|
232
|
-
const handleInputRef = useForkRef2(field.ref, inputRef);
|
|
233
|
-
return /* @__PURE__ */ jsx2(
|
|
234
|
-
TextField,
|
|
235
|
-
{
|
|
236
|
-
...rest,
|
|
237
|
-
inputRef: handleInputRef,
|
|
238
|
-
type: password ? "password" : "text",
|
|
239
|
-
value: field.value,
|
|
240
|
-
fullWidth: true,
|
|
241
|
-
onChange: (event) => {
|
|
242
|
-
field.onChange(event);
|
|
243
|
-
if (typeof rest.onChange === "function") {
|
|
244
|
-
rest.onChange(event);
|
|
245
|
-
}
|
|
246
|
-
},
|
|
247
|
-
onBlur: (event) => {
|
|
248
|
-
field.onBlur();
|
|
249
|
-
if (typeof onBlur === "function") {
|
|
250
|
-
onBlur(event);
|
|
251
|
-
}
|
|
252
|
-
},
|
|
253
|
-
...typeof slotProps === "undefined" ? {
|
|
254
|
-
InputProps: {
|
|
255
|
-
endAdornment
|
|
256
|
-
}
|
|
257
|
-
} : {
|
|
258
|
-
slotProps: {
|
|
259
|
-
...slotProps,
|
|
260
|
-
input: {
|
|
261
|
-
endAdornment,
|
|
262
|
-
...slotProps?.input
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
},
|
|
266
|
-
error: !!error,
|
|
267
|
-
helperText: error ? error.message : ""
|
|
268
|
-
}
|
|
269
|
-
);
|
|
270
|
-
};
|
|
271
|
-
var PasswordElement = ({
|
|
272
|
-
gridProps = { size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 } },
|
|
273
|
-
...props
|
|
274
|
-
}) => {
|
|
275
|
-
if (gridProps) {
|
|
276
|
-
return /* @__PURE__ */ jsx2(
|
|
277
|
-
Grid22,
|
|
278
|
-
{
|
|
279
|
-
...{ size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }, ...gridProps },
|
|
280
|
-
children: /* @__PURE__ */ jsx2(Component2, { ...props })
|
|
281
|
-
}
|
|
282
|
-
);
|
|
283
|
-
}
|
|
284
|
-
return /* @__PURE__ */ jsx2(Component2, { ...props });
|
|
285
|
-
};
|
|
286
|
-
PasswordElement.displayName = "PasswordElement";
|
|
287
|
-
var PasswordElement_default = PasswordElement;
|
|
288
|
-
|
|
289
|
-
// src/wrappers3/RadioButtonGroup/RadioButtonGroup.tsx
|
|
290
|
-
import {
|
|
291
|
-
useController as useController3
|
|
292
|
-
} from "react-hook-form";
|
|
293
|
-
import {
|
|
294
|
-
FormControl,
|
|
295
|
-
FormControlLabel,
|
|
296
|
-
FormHelperText,
|
|
297
|
-
FormLabel,
|
|
298
|
-
Radio,
|
|
299
|
-
RadioGroup,
|
|
300
|
-
useTheme as useTheme2,
|
|
301
|
-
Grid2 as Grid23
|
|
302
|
-
} from "@mui/material";
|
|
303
|
-
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
304
|
-
import { createElement } from "react";
|
|
305
|
-
var Component3 = function RadioButtonGroup(props) {
|
|
306
|
-
const {
|
|
307
|
-
helperText,
|
|
308
|
-
options,
|
|
309
|
-
label,
|
|
310
|
-
name,
|
|
311
|
-
parseError,
|
|
312
|
-
labelKey = "label",
|
|
313
|
-
valueKey = "id",
|
|
314
|
-
disabledKey = "disabled",
|
|
315
|
-
required,
|
|
316
|
-
emptyOptionLabel,
|
|
317
|
-
returnObject,
|
|
318
|
-
row,
|
|
319
|
-
control,
|
|
320
|
-
type,
|
|
321
|
-
labelProps,
|
|
322
|
-
disabled,
|
|
323
|
-
formLabelProps,
|
|
324
|
-
radioProps,
|
|
325
|
-
transform,
|
|
326
|
-
rules = {},
|
|
327
|
-
...rest
|
|
328
|
-
} = props;
|
|
329
|
-
const theme = useTheme2();
|
|
330
|
-
const {
|
|
331
|
-
field,
|
|
332
|
-
fieldState: { error }
|
|
333
|
-
} = useController3({
|
|
334
|
-
name,
|
|
335
|
-
disabled,
|
|
336
|
-
control
|
|
337
|
-
});
|
|
338
|
-
const { value, onChange } = useTransform({
|
|
339
|
-
value: field.value,
|
|
340
|
-
onChange: field.onChange,
|
|
341
|
-
transform: {
|
|
342
|
-
input: typeof transform?.input === "function" ? transform.input : (value2) => {
|
|
343
|
-
return value2 || "";
|
|
344
|
-
},
|
|
345
|
-
output: typeof transform?.output === "function" ? transform?.output : (_event, value2) => {
|
|
346
|
-
if (value2 && type === "number") {
|
|
347
|
-
return Number(value2);
|
|
348
|
-
}
|
|
349
|
-
return value2;
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
});
|
|
353
|
-
const onRadioChange = (event, radioValue) => {
|
|
354
|
-
const returnValue = returnObject ? options.find((items) => items[valueKey] === radioValue) : radioValue;
|
|
355
|
-
onChange(event, returnValue);
|
|
356
|
-
if (typeof rest.onChange === "function") {
|
|
357
|
-
rest.onChange(returnValue);
|
|
358
|
-
}
|
|
359
|
-
};
|
|
360
|
-
return /* @__PURE__ */ jsxs(FormControl, { error: !!error, children: [
|
|
361
|
-
label && /* @__PURE__ */ jsx3(FormLabel, { ...formLabelProps, required, error: !!error, children: label }),
|
|
362
|
-
/* @__PURE__ */ jsxs(RadioGroup, { onChange: onRadioChange, name, row, value, children: [
|
|
363
|
-
emptyOptionLabel && /* @__PURE__ */ jsx3(
|
|
364
|
-
FormControlLabel,
|
|
365
|
-
{
|
|
366
|
-
...labelProps,
|
|
367
|
-
control: /* @__PURE__ */ jsx3(
|
|
368
|
-
Radio,
|
|
369
|
-
{
|
|
370
|
-
...radioProps,
|
|
371
|
-
sx: {
|
|
372
|
-
color: error ? theme.palette.error.main : void 0
|
|
373
|
-
},
|
|
374
|
-
checked: !value
|
|
375
|
-
}
|
|
376
|
-
),
|
|
377
|
-
label: emptyOptionLabel,
|
|
378
|
-
value: ""
|
|
379
|
-
}
|
|
380
|
-
),
|
|
381
|
-
options.map((option) => {
|
|
382
|
-
const optionKey = option[valueKey];
|
|
383
|
-
const optionDisabled = option[disabledKey] || false;
|
|
384
|
-
if (optionKey === void 0) {
|
|
385
|
-
console.error(
|
|
386
|
-
`RadioButtonGroup: valueKey ${valueKey} does not exist on option`,
|
|
387
|
-
option
|
|
388
|
-
);
|
|
389
|
-
}
|
|
390
|
-
let val = returnObject ? value?.[valueKey] : value;
|
|
391
|
-
if (type === "number") {
|
|
392
|
-
val = Number(val);
|
|
393
|
-
}
|
|
394
|
-
const isChecked = val === optionKey;
|
|
395
|
-
return /* @__PURE__ */ createElement(
|
|
396
|
-
FormControlLabel,
|
|
397
|
-
{
|
|
398
|
-
...labelProps,
|
|
399
|
-
control: /* @__PURE__ */ jsx3(
|
|
400
|
-
Radio,
|
|
401
|
-
{
|
|
402
|
-
...radioProps,
|
|
403
|
-
sx: {
|
|
404
|
-
color: error ? theme.palette.error.main : void 0
|
|
405
|
-
},
|
|
406
|
-
disabled: disabled || optionDisabled,
|
|
407
|
-
checked: isChecked
|
|
408
|
-
}
|
|
409
|
-
),
|
|
410
|
-
value: optionKey,
|
|
411
|
-
label: option[labelKey],
|
|
412
|
-
key: optionKey
|
|
413
|
-
}
|
|
414
|
-
);
|
|
415
|
-
})
|
|
416
|
-
] }),
|
|
417
|
-
error && /* @__PURE__ */ jsx3(FormHelperText, { children: error.message })
|
|
418
|
-
] });
|
|
419
|
-
};
|
|
420
|
-
var RadioButtonGroup2 = ({
|
|
421
|
-
gridProps = { size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 } },
|
|
422
|
-
...props
|
|
423
|
-
}) => {
|
|
424
|
-
if (gridProps) {
|
|
425
|
-
return /* @__PURE__ */ jsx3(
|
|
426
|
-
Grid23,
|
|
427
|
-
{
|
|
428
|
-
...{ size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }, ...gridProps },
|
|
429
|
-
children: /* @__PURE__ */ jsx3(Component3, { ...props })
|
|
430
|
-
}
|
|
431
|
-
);
|
|
432
|
-
}
|
|
433
|
-
return /* @__PURE__ */ jsx3(Component3, { ...props });
|
|
434
|
-
};
|
|
435
|
-
RadioButtonGroup2.displayName = "RadioButtonGroup";
|
|
436
|
-
var RadioButtonGroup_default = RadioButtonGroup2;
|
|
437
|
-
|
|
438
|
-
// src/wrappers3/TextFieldElement/TextFieldElement.tsx
|
|
439
|
-
import {
|
|
440
|
-
Grid2 as Grid24,
|
|
441
|
-
TextField as TextField2,
|
|
442
|
-
useForkRef as useForkRef3,
|
|
443
|
-
useTheme as useTheme3
|
|
444
|
-
} from "@mui/material";
|
|
445
|
-
import {
|
|
446
|
-
useController as useController4
|
|
447
|
-
} from "react-hook-form";
|
|
448
|
-
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
449
|
-
var Component4 = function TextFieldElement(props) {
|
|
450
|
-
const {
|
|
451
|
-
rules = {},
|
|
452
|
-
parseError,
|
|
453
|
-
name,
|
|
454
|
-
control,
|
|
455
|
-
component: TextFieldComponent = TextField2,
|
|
456
|
-
gridProps,
|
|
457
|
-
transform,
|
|
458
|
-
label,
|
|
459
|
-
placeholder,
|
|
460
|
-
textFieldProps = {},
|
|
461
|
-
variant,
|
|
462
|
-
sx,
|
|
463
|
-
...rest
|
|
464
|
-
} = props;
|
|
465
|
-
const {
|
|
466
|
-
type,
|
|
467
|
-
required,
|
|
468
|
-
helperText,
|
|
469
|
-
inputRef,
|
|
470
|
-
onBlur,
|
|
471
|
-
disabled,
|
|
472
|
-
...restTextProps
|
|
473
|
-
} = textFieldProps;
|
|
474
|
-
const {
|
|
475
|
-
field,
|
|
476
|
-
fieldState: { error }
|
|
477
|
-
} = useController4({
|
|
478
|
-
name,
|
|
479
|
-
control
|
|
480
|
-
});
|
|
481
|
-
const theme = useTheme3();
|
|
482
|
-
const { value, onChange } = useTransform({
|
|
483
|
-
value: field.value,
|
|
484
|
-
onChange: field.onChange,
|
|
485
|
-
transform: {
|
|
486
|
-
input: typeof transform?.input === "function" ? transform.input : (value2) => {
|
|
487
|
-
return value2 ?? "";
|
|
488
|
-
},
|
|
489
|
-
output: typeof transform?.output === "function" ? transform.output : (event) => {
|
|
490
|
-
const value2 = event.target.value;
|
|
491
|
-
if (type !== "number") {
|
|
492
|
-
return value2;
|
|
493
|
-
}
|
|
494
|
-
if (value2 === "") {
|
|
495
|
-
return null;
|
|
496
|
-
}
|
|
497
|
-
if (value2 == null) {
|
|
498
|
-
return value2;
|
|
499
|
-
}
|
|
500
|
-
return Number(value2);
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
});
|
|
504
|
-
const handleInputRef = useForkRef3(field.ref, inputRef);
|
|
505
|
-
return /* @__PURE__ */ jsx4(
|
|
506
|
-
TextFieldComponent,
|
|
507
|
-
{
|
|
508
|
-
...rest,
|
|
509
|
-
...restTextProps,
|
|
510
|
-
name: field.name,
|
|
511
|
-
value,
|
|
512
|
-
onChange: (event) => {
|
|
513
|
-
field.onChange(event);
|
|
514
|
-
if (typeof onChange === "function") {
|
|
515
|
-
onChange(event);
|
|
516
|
-
}
|
|
517
|
-
},
|
|
518
|
-
onBlur: (event) => {
|
|
519
|
-
field.onBlur();
|
|
520
|
-
if (typeof onBlur === "function") {
|
|
521
|
-
onBlur(event);
|
|
522
|
-
}
|
|
523
|
-
},
|
|
524
|
-
disabled,
|
|
525
|
-
label,
|
|
526
|
-
placeholder,
|
|
527
|
-
fullWidth: true,
|
|
528
|
-
required,
|
|
529
|
-
type,
|
|
530
|
-
error: !!error,
|
|
531
|
-
helperText: error ? error.message : helperText,
|
|
532
|
-
inputRef: handleInputRef,
|
|
533
|
-
variant: variant ? variant : "outlined",
|
|
534
|
-
size: "small",
|
|
535
|
-
sx: {
|
|
536
|
-
"& .MuiInputLabel-asterisk": { color: "red" },
|
|
537
|
-
"& .MuiInputBase-input": {
|
|
538
|
-
cursor: disabled ? "not-allowed" : "default"
|
|
539
|
-
},
|
|
540
|
-
bgcolor: disabled ? theme.palette.action.disabledBackground : "transparent",
|
|
541
|
-
...sx
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
);
|
|
545
|
-
};
|
|
546
|
-
var TextFieldElement2 = ({
|
|
547
|
-
gridProps = { size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 } },
|
|
548
|
-
...props
|
|
549
|
-
}) => {
|
|
550
|
-
if (gridProps) {
|
|
551
|
-
return /* @__PURE__ */ jsx4(
|
|
552
|
-
Grid24,
|
|
553
|
-
{
|
|
554
|
-
...{ size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }, ...gridProps },
|
|
555
|
-
children: /* @__PURE__ */ jsx4(Component4, { ...props })
|
|
556
|
-
}
|
|
557
|
-
);
|
|
558
|
-
}
|
|
559
|
-
return /* @__PURE__ */ jsx4(Component4, { ...props });
|
|
560
|
-
};
|
|
561
|
-
TextFieldElement2.displayName = "TextFieldElement";
|
|
562
|
-
var TextFieldElement_default = TextFieldElement2;
|
|
563
|
-
|
|
564
|
-
// src/wrappers3/TimePickerElement/TimePickerElement.tsx
|
|
565
|
-
import {
|
|
566
|
-
TimePicker
|
|
567
|
-
} from "@mui/x-date-pickers";
|
|
568
|
-
import {
|
|
569
|
-
useController as useController5
|
|
570
|
-
} from "react-hook-form";
|
|
571
|
-
import { useForkRef as useForkRef4, Grid2 as Grid25 } from "@mui/material";
|
|
572
|
-
import { useLocalizationContext as useLocalizationContext2 } from "@mui/x-date-pickers/internals";
|
|
573
|
-
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
574
|
-
var Component5 = function TimePickerElement(props) {
|
|
575
|
-
const {
|
|
576
|
-
parseError,
|
|
577
|
-
name,
|
|
578
|
-
required,
|
|
579
|
-
rules = {},
|
|
580
|
-
inputProps,
|
|
581
|
-
control,
|
|
582
|
-
textReadOnly,
|
|
583
|
-
slotProps,
|
|
584
|
-
inputRef,
|
|
585
|
-
transform,
|
|
586
|
-
...rest
|
|
587
|
-
} = props;
|
|
588
|
-
const adapter = useLocalizationContext2();
|
|
589
|
-
const {
|
|
590
|
-
field,
|
|
591
|
-
fieldState: { error }
|
|
592
|
-
} = useController5({
|
|
593
|
-
name,
|
|
594
|
-
control,
|
|
595
|
-
disabled: rest.disabled,
|
|
596
|
-
defaultValue: null
|
|
597
|
-
});
|
|
598
|
-
const { value, onChange } = useTransform({
|
|
599
|
-
value: field.value,
|
|
600
|
-
onChange: field.onChange,
|
|
601
|
-
transform: {
|
|
602
|
-
input: typeof transform?.input === "function" ? transform.input : (newValue) => readValueAsDate(adapter, newValue),
|
|
603
|
-
output: typeof transform?.output === "function" ? transform.output : (newValue) => newValue
|
|
604
|
-
}
|
|
605
|
-
});
|
|
606
|
-
const handleInputRef = useForkRef4(field.ref, inputRef);
|
|
607
|
-
return /* @__PURE__ */ jsx5(
|
|
608
|
-
TimePicker,
|
|
609
|
-
{
|
|
610
|
-
...rest,
|
|
611
|
-
...field,
|
|
612
|
-
value,
|
|
613
|
-
inputRef: handleInputRef,
|
|
614
|
-
onClose: (...args) => {
|
|
615
|
-
field.onBlur();
|
|
616
|
-
if (rest.onClose) {
|
|
617
|
-
rest.onClose(...args);
|
|
618
|
-
}
|
|
619
|
-
},
|
|
620
|
-
onChange: (value2, context) => {
|
|
621
|
-
onChange(value2, context);
|
|
622
|
-
if (typeof rest.onChange === "function") {
|
|
623
|
-
rest.onChange(value2, context);
|
|
624
|
-
}
|
|
625
|
-
},
|
|
626
|
-
slotProps: {
|
|
627
|
-
...slotProps,
|
|
628
|
-
textField: {
|
|
629
|
-
...inputProps,
|
|
630
|
-
required,
|
|
631
|
-
fullWidth: true,
|
|
632
|
-
error: !!error,
|
|
633
|
-
helperText: error ? error.message : inputProps?.helperText || rest.helperText,
|
|
634
|
-
inputProps: {
|
|
635
|
-
readOnly: textReadOnly,
|
|
636
|
-
...inputProps?.inputProps
|
|
637
|
-
}
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
);
|
|
642
|
-
};
|
|
643
|
-
var TimePickerElement2 = ({
|
|
644
|
-
gridProps = { size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 } },
|
|
645
|
-
...props
|
|
646
|
-
}) => {
|
|
647
|
-
if (gridProps) {
|
|
648
|
-
return /* @__PURE__ */ jsx5(
|
|
649
|
-
Grid25,
|
|
650
|
-
{
|
|
651
|
-
...{ size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }, ...gridProps },
|
|
652
|
-
children: /* @__PURE__ */ jsx5(Component5, { ...props })
|
|
653
|
-
}
|
|
654
|
-
);
|
|
655
|
-
}
|
|
656
|
-
return /* @__PURE__ */ jsx5(Component5, { ...props });
|
|
657
|
-
};
|
|
658
|
-
TimePickerElement2.displayName = "TimePickerElement";
|
|
659
|
-
var TimePickerElement_default = TimePickerElement2;
|
|
660
|
-
|
|
661
|
-
// src/wrappers3/AsyncSelect/AsyncSelectElement.tsx
|
|
662
|
-
import * as React from "react";
|
|
663
|
-
import { useController as useController6 } from "react-hook-form";
|
|
664
|
-
import {
|
|
665
|
-
useRef,
|
|
666
|
-
useMemo,
|
|
667
|
-
Fragment,
|
|
668
|
-
useState as useState2,
|
|
669
|
-
useEffect as useEffect2,
|
|
670
|
-
useCallback as useCallback2
|
|
671
|
-
} from "react";
|
|
672
|
-
import { debounce } from "@mui/material/utils";
|
|
673
|
-
import TextField3 from "@mui/material/TextField";
|
|
674
|
-
import Autocomplete from "@mui/material/Autocomplete";
|
|
675
|
-
import { Grid2 as Grid26, useTheme as useTheme4, CircularProgress } from "@mui/material";
|
|
676
|
-
import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
677
|
-
var Component6 = function AsyncSelectElement(props) {
|
|
678
|
-
const {
|
|
679
|
-
name,
|
|
680
|
-
onBlur,
|
|
681
|
-
disabled,
|
|
682
|
-
control,
|
|
683
|
-
gridProps,
|
|
684
|
-
placeholder,
|
|
685
|
-
initialValue,
|
|
686
|
-
label,
|
|
687
|
-
queryFn,
|
|
688
|
-
variant,
|
|
689
|
-
labelKey = "Label",
|
|
690
|
-
valueKey = "Value",
|
|
691
|
-
sx,
|
|
692
|
-
...rest
|
|
693
|
-
} = props;
|
|
694
|
-
const {
|
|
695
|
-
field,
|
|
696
|
-
fieldState: { error }
|
|
697
|
-
} = useController6({
|
|
698
|
-
name,
|
|
699
|
-
control
|
|
700
|
-
});
|
|
701
|
-
const theme = useTheme4();
|
|
702
|
-
const [loading, setLoading] = useState2(false);
|
|
703
|
-
const [selectedOption, setSelectedOption] = useState2(null);
|
|
704
|
-
const [inputValue, setInputValue] = useState2("");
|
|
705
|
-
const inputValue2 = useMemo(() => inputValue, [inputValue]);
|
|
706
|
-
const setInputValue2 = useCallback2(
|
|
707
|
-
(newValue) => setInputValue(newValue),
|
|
708
|
-
[]
|
|
709
|
-
);
|
|
710
|
-
const [options, setOptions] = useState2([]);
|
|
711
|
-
const initialValueLoaded = useRef(
|
|
712
|
-
!initialValue ? true : !(initialValue != null)
|
|
713
|
-
);
|
|
714
|
-
const fieldValue = useRef(field.value);
|
|
715
|
-
const fetchData = useMemo(
|
|
716
|
-
() => debounce(
|
|
717
|
-
(payload, callback) => {
|
|
718
|
-
queryFn(payload).then((c) => callback(c));
|
|
719
|
-
},
|
|
720
|
-
400
|
|
721
|
-
),
|
|
722
|
-
[]
|
|
723
|
-
);
|
|
724
|
-
const fillOptions = (results) => {
|
|
725
|
-
let newOptions = [];
|
|
726
|
-
if (selectedOption) {
|
|
727
|
-
newOptions = [selectedOption];
|
|
728
|
-
}
|
|
729
|
-
if (results) {
|
|
730
|
-
newOptions = [...newOptions, ...results];
|
|
731
|
-
}
|
|
732
|
-
setOptions(newOptions);
|
|
733
|
-
setLoading(false);
|
|
734
|
-
};
|
|
735
|
-
useEffect2(() => {
|
|
736
|
-
if (initialValueLoaded.current) return void 0;
|
|
737
|
-
let active = true;
|
|
738
|
-
const payload = {
|
|
739
|
-
query: null,
|
|
740
|
-
initialValue
|
|
741
|
-
};
|
|
742
|
-
setLoading(true);
|
|
743
|
-
fetchData(payload, (results) => {
|
|
744
|
-
if (active) {
|
|
745
|
-
if (!!results && results.length > 0) {
|
|
746
|
-
fillOptions(results?.filter((c) => c.Value == initialValue));
|
|
747
|
-
setSelectedOption(results[0]);
|
|
748
|
-
field.onChange(results[0].Value);
|
|
749
|
-
fieldValue.current = results[0].Value;
|
|
750
|
-
}
|
|
751
|
-
initialValueLoaded.current = true;
|
|
752
|
-
setLoading(false);
|
|
753
|
-
}
|
|
754
|
-
});
|
|
755
|
-
return () => {
|
|
756
|
-
active = false;
|
|
757
|
-
};
|
|
758
|
-
}, [initialValue]);
|
|
759
|
-
React.useEffect(() => {
|
|
760
|
-
let active = true;
|
|
761
|
-
if (inputValue2 === "" || initialValueLoaded.current === false) {
|
|
762
|
-
setOptions(selectedOption ? [selectedOption] : []);
|
|
763
|
-
setLoading(false);
|
|
764
|
-
return void 0;
|
|
765
|
-
}
|
|
766
|
-
if (fieldValue.current) {
|
|
767
|
-
if (field.value === fieldValue.current) {
|
|
768
|
-
return void 0;
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
|
-
setLoading(true);
|
|
772
|
-
const payload = {
|
|
773
|
-
query: inputValue2,
|
|
774
|
-
initialValue: null
|
|
775
|
-
};
|
|
776
|
-
fetchData(payload, (results) => {
|
|
777
|
-
if (active) {
|
|
778
|
-
fillOptions(results);
|
|
779
|
-
}
|
|
780
|
-
});
|
|
781
|
-
return () => {
|
|
782
|
-
active = false;
|
|
783
|
-
};
|
|
784
|
-
}, [initialValue, inputValue2, fetchData]);
|
|
785
|
-
const selectRef = useRef(null);
|
|
786
|
-
const handleChange = (_2, newSelectedOption, reason) => {
|
|
787
|
-
if (reason === "clear") {
|
|
788
|
-
setSelectedOption(null);
|
|
789
|
-
field.onChange(null);
|
|
790
|
-
setLoading(false);
|
|
791
|
-
} else if (reason === "selectOption" || reason === "removeOption") {
|
|
792
|
-
if (newSelectedOption) {
|
|
793
|
-
setSelectedOption(newSelectedOption);
|
|
794
|
-
field.onChange(newSelectedOption.Value);
|
|
795
|
-
fieldValue.current = newSelectedOption.Value;
|
|
796
|
-
setLoading(false);
|
|
797
|
-
}
|
|
798
|
-
}
|
|
799
|
-
setOptions([]);
|
|
800
|
-
setLoading(false);
|
|
801
|
-
};
|
|
802
|
-
useEffect2(() => {
|
|
803
|
-
if (!field.value) {
|
|
804
|
-
setInputValue("");
|
|
805
|
-
setSelectedOption(null);
|
|
806
|
-
setLoading(false);
|
|
807
|
-
}
|
|
808
|
-
}, [field.value]);
|
|
809
|
-
const getOptionValue = (option) => {
|
|
810
|
-
if (typeof option === "string") return option;
|
|
811
|
-
return option ? option[valueKey] : null;
|
|
812
|
-
};
|
|
813
|
-
const getOptionLabel = (option) => {
|
|
814
|
-
if (typeof option === "string") return option;
|
|
815
|
-
return option ? option[labelKey] : "";
|
|
816
|
-
};
|
|
817
|
-
return /* @__PURE__ */ jsx6(
|
|
818
|
-
Autocomplete,
|
|
819
|
-
{
|
|
820
|
-
...rest,
|
|
821
|
-
ref: selectRef,
|
|
822
|
-
fullWidth: true,
|
|
823
|
-
loading,
|
|
824
|
-
getOptionLabel,
|
|
825
|
-
getOptionKey: getOptionValue,
|
|
826
|
-
isOptionEqualToValue: (option, value) => getOptionValue(option) === getOptionValue(value),
|
|
827
|
-
autoComplete: true,
|
|
828
|
-
disabled,
|
|
829
|
-
includeInputInList: true,
|
|
830
|
-
options,
|
|
831
|
-
filterOptions: (x) => x,
|
|
832
|
-
value: selectedOption,
|
|
833
|
-
filterSelectedOptions: true,
|
|
834
|
-
onChange: handleChange,
|
|
835
|
-
onInputChange: (_2, newInputValue) => {
|
|
836
|
-
setInputValue2(newInputValue);
|
|
837
|
-
},
|
|
838
|
-
noOptionsText: "Type Something...",
|
|
839
|
-
renderInput: (params) => /* @__PURE__ */ jsx6(
|
|
840
|
-
TextField3,
|
|
841
|
-
{
|
|
842
|
-
...params,
|
|
843
|
-
label,
|
|
844
|
-
error: !!error,
|
|
845
|
-
helperText: error ? error.message : "",
|
|
846
|
-
placeholder,
|
|
847
|
-
slotProps: {
|
|
848
|
-
input: {
|
|
849
|
-
...params.InputProps,
|
|
850
|
-
endAdornment: /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
851
|
-
loading ? /* @__PURE__ */ jsx6(CircularProgress, { color: "inherit", size: 20 }) : null,
|
|
852
|
-
params.InputProps.endAdornment
|
|
853
|
-
] })
|
|
854
|
-
}
|
|
855
|
-
},
|
|
856
|
-
variant: variant ? variant : "outlined",
|
|
857
|
-
sx: {
|
|
858
|
-
"& .MuiInputBase-input": {
|
|
859
|
-
cursor: disabled ? "not-allowed" : "default"
|
|
860
|
-
},
|
|
861
|
-
bgcolor: disabled ? theme.palette.action.disabledBackground : "transparent",
|
|
862
|
-
...sx
|
|
863
|
-
}
|
|
864
|
-
}
|
|
865
|
-
),
|
|
866
|
-
renderOption: (renderProps, option) => {
|
|
867
|
-
const { key, ...optionProps } = renderProps;
|
|
868
|
-
return /* @__PURE__ */ jsx6("li", { ...optionProps, children: option.Label }, key);
|
|
869
|
-
}
|
|
870
|
-
}
|
|
871
|
-
);
|
|
872
|
-
};
|
|
873
|
-
var AsyncSelectElement2 = ({
|
|
874
|
-
gridProps = { size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 } },
|
|
875
|
-
...props
|
|
876
|
-
}) => {
|
|
877
|
-
if (gridProps) {
|
|
878
|
-
return /* @__PURE__ */ jsx6(
|
|
879
|
-
Grid26,
|
|
880
|
-
{
|
|
881
|
-
...{ size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }, ...gridProps },
|
|
882
|
-
children: /* @__PURE__ */ jsx6(Component6, { ...props })
|
|
883
|
-
}
|
|
884
|
-
);
|
|
885
|
-
}
|
|
886
|
-
return /* @__PURE__ */ jsx6(Component6, { ...props });
|
|
887
|
-
};
|
|
888
|
-
AsyncSelectElement2.displayName = "AsyncSelectElement";
|
|
889
|
-
var AsyncSelectElement_default = AsyncSelectElement2;
|
|
890
|
-
|
|
891
|
-
// src/wrappers3/AsyncMultiSelect/AsyncMultiSelect.tsx
|
|
892
|
-
import _ from "lodash";
|
|
893
|
-
import {
|
|
894
|
-
useState as useState3,
|
|
895
|
-
useRef as useRef2,
|
|
896
|
-
useMemo as useMemo2,
|
|
897
|
-
useEffect as useEffect3,
|
|
898
|
-
useCallback as useCallback3,
|
|
899
|
-
Fragment as Fragment2
|
|
900
|
-
} from "react";
|
|
901
|
-
import { debounce as debounce2 } from "lodash";
|
|
902
|
-
import {
|
|
903
|
-
Autocomplete as Autocomplete2,
|
|
904
|
-
CircularProgress as CircularProgress2,
|
|
905
|
-
Grid2 as Grid27,
|
|
906
|
-
TextField as TextField4,
|
|
907
|
-
useTheme as useTheme5
|
|
908
|
-
} from "@mui/material";
|
|
909
|
-
import { useController as useController7 } from "react-hook-form";
|
|
910
|
-
import match from "autosuggest-highlight/match";
|
|
911
|
-
import parse from "autosuggest-highlight/parse";
|
|
912
|
-
import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
913
|
-
var Component7 = function AsyncSelectMultiElement(props) {
|
|
914
|
-
const {
|
|
915
|
-
name,
|
|
916
|
-
onBlur,
|
|
917
|
-
disabled,
|
|
918
|
-
control,
|
|
919
|
-
gridProps,
|
|
920
|
-
placeholder,
|
|
921
|
-
initialValues,
|
|
922
|
-
label,
|
|
923
|
-
queryFn,
|
|
924
|
-
variant,
|
|
925
|
-
sx,
|
|
926
|
-
...rest
|
|
927
|
-
} = props;
|
|
928
|
-
const {
|
|
929
|
-
field,
|
|
930
|
-
fieldState: { error }
|
|
931
|
-
} = useController7({
|
|
932
|
-
name,
|
|
933
|
-
control
|
|
934
|
-
});
|
|
935
|
-
const theme = useTheme5();
|
|
936
|
-
const multiSelectRef = useRef2(null);
|
|
937
|
-
const [selectedOptions, setSelectedOptions] = useState3([]);
|
|
938
|
-
const [inputValue, setInputValue] = useState3("");
|
|
939
|
-
const [options, setOptions] = useState3([]);
|
|
940
|
-
const [loading, setLoading] = useState3(false);
|
|
941
|
-
const initialValuesLoaded = useRef2(
|
|
942
|
-
!(initialValues && initialValues.length > 0)
|
|
943
|
-
);
|
|
944
|
-
const inputValue2 = useMemo2(() => inputValue, [inputValue]);
|
|
945
|
-
const setInputValue2 = useCallback3(
|
|
946
|
-
(inputValue3) => setInputValue(inputValue3),
|
|
947
|
-
[]
|
|
948
|
-
);
|
|
949
|
-
const fetchData = useMemo2(
|
|
950
|
-
() => debounce2(
|
|
951
|
-
(payload, callback) => {
|
|
952
|
-
queryFn(payload).then((c) => callback(c));
|
|
953
|
-
},
|
|
954
|
-
400
|
|
955
|
-
),
|
|
956
|
-
[]
|
|
957
|
-
);
|
|
958
|
-
const fillOptions = (results) => {
|
|
959
|
-
let newOptions = [];
|
|
960
|
-
if (selectedOptions) {
|
|
961
|
-
newOptions = [...selectedOptions];
|
|
962
|
-
}
|
|
963
|
-
if (results) {
|
|
964
|
-
const newlyAdded = _.differenceBy(
|
|
965
|
-
results,
|
|
966
|
-
selectedOptions,
|
|
967
|
-
(c) => c.Value
|
|
968
|
-
);
|
|
969
|
-
newOptions = [...newOptions, ...newlyAdded];
|
|
970
|
-
}
|
|
971
|
-
setOptions(newOptions);
|
|
972
|
-
setLoading(false);
|
|
973
|
-
};
|
|
974
|
-
useEffect3(() => {
|
|
975
|
-
if (initialValuesLoaded.current) return void 0;
|
|
976
|
-
let active = true;
|
|
977
|
-
const payload = {
|
|
978
|
-
query: null,
|
|
979
|
-
initialValues
|
|
980
|
-
};
|
|
981
|
-
setLoading(true);
|
|
982
|
-
fetchData(payload, (results) => {
|
|
983
|
-
if (active) {
|
|
984
|
-
setSelectedOptions([...results]);
|
|
985
|
-
field.onChange([...results.map((c) => c.Value)]);
|
|
986
|
-
initialValuesLoaded.current = true;
|
|
987
|
-
setLoading(false);
|
|
988
|
-
}
|
|
989
|
-
});
|
|
990
|
-
return () => {
|
|
991
|
-
active = false;
|
|
992
|
-
};
|
|
993
|
-
}, [initialValues]);
|
|
994
|
-
useEffect3(() => {
|
|
995
|
-
let active = true;
|
|
996
|
-
if (inputValue2 === "" || initialValuesLoaded.current === false) {
|
|
997
|
-
setOptions(selectedOptions ? [...selectedOptions] : []);
|
|
998
|
-
return void 0;
|
|
999
|
-
}
|
|
1000
|
-
setLoading(true);
|
|
1001
|
-
const payload = {
|
|
1002
|
-
query: inputValue2,
|
|
1003
|
-
initialValues: null
|
|
1004
|
-
};
|
|
1005
|
-
fetchData(payload, (results) => {
|
|
1006
|
-
if (active) {
|
|
1007
|
-
fillOptions(results);
|
|
1008
|
-
}
|
|
1009
|
-
});
|
|
1010
|
-
return () => {
|
|
1011
|
-
active = false;
|
|
1012
|
-
};
|
|
1013
|
-
}, [initialValues, inputValue2, fetchData]);
|
|
1014
|
-
const handleChange = (_2, selectedOptions2, reason) => {
|
|
1015
|
-
if (reason === "clear") {
|
|
1016
|
-
setSelectedOptions([]);
|
|
1017
|
-
field.onChange([]);
|
|
1018
|
-
} else if (reason === "selectOption" || reason === "removeOption") {
|
|
1019
|
-
setSelectedOptions(selectedOptions2);
|
|
1020
|
-
field.onChange(selectedOptions2.map((c) => c.Value));
|
|
1021
|
-
}
|
|
1022
|
-
setOptions([]);
|
|
1023
|
-
};
|
|
1024
|
-
return /* @__PURE__ */ jsx7(
|
|
1025
|
-
Autocomplete2,
|
|
1026
|
-
{
|
|
1027
|
-
ref: multiSelectRef,
|
|
1028
|
-
multiple: true,
|
|
1029
|
-
loading,
|
|
1030
|
-
getOptionLabel: (option) => option.Label,
|
|
1031
|
-
getOptionKey: (option) => option.Value,
|
|
1032
|
-
isOptionEqualToValue: (option, val) => option.Value === val.Value,
|
|
1033
|
-
options,
|
|
1034
|
-
value: selectedOptions,
|
|
1035
|
-
disabled,
|
|
1036
|
-
filterSelectedOptions: true,
|
|
1037
|
-
onChange: handleChange,
|
|
1038
|
-
onInputChange: (_2, newInputValue) => {
|
|
1039
|
-
setInputValue2(newInputValue);
|
|
1040
|
-
},
|
|
1041
|
-
renderInput: (params) => /* @__PURE__ */ jsx7(
|
|
1042
|
-
TextField4,
|
|
1043
|
-
{
|
|
1044
|
-
...params,
|
|
1045
|
-
label,
|
|
1046
|
-
error: !!error,
|
|
1047
|
-
helperText: error ? error.message : "",
|
|
1048
|
-
placeholder,
|
|
1049
|
-
slotProps: {
|
|
1050
|
-
input: {
|
|
1051
|
-
...params.InputProps,
|
|
1052
|
-
endAdornment: /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
1053
|
-
loading ? /* @__PURE__ */ jsx7(CircularProgress2, { color: "inherit", size: 20 }) : null,
|
|
1054
|
-
params.InputProps.endAdornment
|
|
1055
|
-
] })
|
|
1056
|
-
}
|
|
1057
|
-
},
|
|
1058
|
-
variant: variant ? variant : "outlined",
|
|
1059
|
-
sx: {
|
|
1060
|
-
"& .MuiInputBase-input": {
|
|
1061
|
-
cursor: disabled ? "not-allowed" : "default"
|
|
1062
|
-
},
|
|
1063
|
-
bgcolor: disabled ? theme.palette.action.disabledBackground : "transparent",
|
|
1064
|
-
...sx
|
|
1065
|
-
}
|
|
1066
|
-
}
|
|
1067
|
-
),
|
|
1068
|
-
renderOption: (props2, option, { inputValue: inputValue3 }) => {
|
|
1069
|
-
const { key, ...optionProps } = props2;
|
|
1070
|
-
const matches = match(option.Label, inputValue3, { insideWords: true });
|
|
1071
|
-
const parts = parse(option.Label, matches);
|
|
1072
|
-
return /* @__PURE__ */ jsx7("li", { ...optionProps, children: /* @__PURE__ */ jsx7("div", { children: parts.map((part, index) => /* @__PURE__ */ jsx7(
|
|
1073
|
-
"span",
|
|
1074
|
-
{
|
|
1075
|
-
style: {
|
|
1076
|
-
fontWeight: part.highlight ? 700 : 400
|
|
1077
|
-
},
|
|
1078
|
-
children: part.text
|
|
1079
|
-
},
|
|
1080
|
-
index
|
|
1081
|
-
)) }) }, key);
|
|
1082
|
-
},
|
|
1083
|
-
...rest
|
|
1084
|
-
}
|
|
1085
|
-
);
|
|
1086
|
-
};
|
|
1087
|
-
var AsyncSelectMultiElement2 = ({
|
|
1088
|
-
gridProps,
|
|
1089
|
-
...props
|
|
1090
|
-
}) => {
|
|
1091
|
-
if (gridProps) {
|
|
1092
|
-
return /* @__PURE__ */ jsx7(
|
|
1093
|
-
Grid27,
|
|
1094
|
-
{
|
|
1095
|
-
...{ size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }, ...gridProps },
|
|
1096
|
-
children: /* @__PURE__ */ jsx7(Component7, { ...props })
|
|
1097
|
-
}
|
|
1098
|
-
);
|
|
1099
|
-
}
|
|
1100
|
-
return /* @__PURE__ */ jsx7(Component7, { ...props });
|
|
1101
|
-
};
|
|
1102
|
-
AsyncSelectMultiElement2.displayName = "AsyncSelectMulti";
|
|
1103
|
-
var AsyncMultiSelect_default = AsyncSelectMultiElement2;
|
|
1104
|
-
|
|
1105
|
-
// src/wrappers3/SelectElement/SelectElement.tsx
|
|
1106
|
-
import {
|
|
1107
|
-
useMemo as useMemo3,
|
|
1108
|
-
useEffect as useEffect4,
|
|
1109
|
-
useCallback as useCallback4
|
|
1110
|
-
} from "react";
|
|
1111
|
-
import {
|
|
1112
|
-
useController as useController8
|
|
1113
|
-
} from "react-hook-form";
|
|
1114
|
-
import { Grid2 as Grid28, useTheme as useTheme6, TextField as TextField5, Autocomplete as Autocomplete3 } from "@mui/material";
|
|
1115
|
-
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1116
|
-
var Component8 = function SelectElement(props) {
|
|
1117
|
-
const {
|
|
1118
|
-
name,
|
|
1119
|
-
control,
|
|
1120
|
-
onChange,
|
|
1121
|
-
isEdit,
|
|
1122
|
-
options,
|
|
1123
|
-
label,
|
|
1124
|
-
sx,
|
|
1125
|
-
variant,
|
|
1126
|
-
disabled,
|
|
1127
|
-
initialValue,
|
|
1128
|
-
labelKey = "Label",
|
|
1129
|
-
valueKey = "Value",
|
|
1130
|
-
placeholder,
|
|
1131
|
-
textFieldProps = {},
|
|
1132
|
-
...rest
|
|
1133
|
-
} = props;
|
|
1134
|
-
const { required } = textFieldProps;
|
|
1135
|
-
const {
|
|
1136
|
-
field,
|
|
1137
|
-
fieldState: { error }
|
|
1138
|
-
} = useController8({
|
|
1139
|
-
name,
|
|
1140
|
-
control,
|
|
1141
|
-
defaultValue: initialValue
|
|
1142
|
-
});
|
|
1143
|
-
const theme = useTheme6();
|
|
1144
|
-
const getOptionValue = useCallback4(
|
|
1145
|
-
(option) => {
|
|
1146
|
-
if (typeof option === "string") return option;
|
|
1147
|
-
return option ? option[valueKey] : null;
|
|
1148
|
-
},
|
|
1149
|
-
[valueKey]
|
|
1150
|
-
);
|
|
1151
|
-
const getOptionLabel = useCallback4(
|
|
1152
|
-
(option) => {
|
|
1153
|
-
if (typeof option === "string") return option;
|
|
1154
|
-
return option ? String(option[labelKey]) : "";
|
|
1155
|
-
},
|
|
1156
|
-
[labelKey]
|
|
1157
|
-
);
|
|
1158
|
-
const handleChange = (event, newValue, reason) => {
|
|
1159
|
-
const option = newValue;
|
|
1160
|
-
field.onChange(option ? getOptionValue(option) : null);
|
|
1161
|
-
onChange?.(event, newValue, reason);
|
|
1162
|
-
};
|
|
1163
|
-
useEffect4(() => {
|
|
1164
|
-
if (!isEdit && options.length === 1 && (field.value == null || field.value === "")) {
|
|
1165
|
-
const defaultOption = options[0];
|
|
1166
|
-
field.onChange(getOptionValue(defaultOption));
|
|
1167
|
-
}
|
|
1168
|
-
if (isEdit) {
|
|
1169
|
-
if (field.value == null || field.value === "") {
|
|
1170
|
-
return;
|
|
1171
|
-
}
|
|
1172
|
-
}
|
|
1173
|
-
}, [isEdit, options, field.value, getOptionValue, field.onChange]);
|
|
1174
|
-
const autocompleteValue = useMemo3(() => {
|
|
1175
|
-
if (!field.value) return null;
|
|
1176
|
-
return options.find((option) => getOptionValue(option) === field.value) ?? null;
|
|
1177
|
-
}, [field.value, options, getOptionValue]);
|
|
1178
|
-
return /* @__PURE__ */ jsx8(
|
|
1179
|
-
Autocomplete3,
|
|
1180
|
-
{
|
|
1181
|
-
...rest,
|
|
1182
|
-
filterSelectedOptions: false,
|
|
1183
|
-
options,
|
|
1184
|
-
value: autocompleteValue,
|
|
1185
|
-
onChange: handleChange,
|
|
1186
|
-
disabled,
|
|
1187
|
-
getOptionLabel: (option) => getOptionLabel(option),
|
|
1188
|
-
ref: field.ref,
|
|
1189
|
-
isOptionEqualToValue: (option, value) => getOptionValue(option) === getOptionValue(value),
|
|
1190
|
-
renderInput: (params) => /* @__PURE__ */ jsx8(
|
|
1191
|
-
TextField5,
|
|
1192
|
-
{
|
|
1193
|
-
...params,
|
|
1194
|
-
fullWidth: true,
|
|
1195
|
-
required,
|
|
1196
|
-
error: !!error,
|
|
1197
|
-
helperText: error ? error.message : "",
|
|
1198
|
-
label,
|
|
1199
|
-
placeholder,
|
|
1200
|
-
variant: variant ? variant : "outlined",
|
|
1201
|
-
sx: {
|
|
1202
|
-
"& .MuiOutlinedInput-root": {
|
|
1203
|
-
bgcolor: disabled ? theme.palette.action.disabledBackground : "transparent"
|
|
1204
|
-
},
|
|
1205
|
-
"& .MuiInputLabel-asterisk": { color: "red" },
|
|
1206
|
-
"& .MuiInputBase-input": {
|
|
1207
|
-
cursor: disabled ? "not-allowed" : "default"
|
|
1208
|
-
},
|
|
1209
|
-
...sx
|
|
1210
|
-
}
|
|
1211
|
-
}
|
|
1212
|
-
)
|
|
1213
|
-
}
|
|
1214
|
-
);
|
|
1215
|
-
};
|
|
1216
|
-
var SelectElement2 = ({
|
|
1217
|
-
gridProps,
|
|
1218
|
-
...props
|
|
1219
|
-
}) => {
|
|
1220
|
-
if (gridProps) {
|
|
1221
|
-
return /* @__PURE__ */ jsx8(
|
|
1222
|
-
Grid28,
|
|
1223
|
-
{
|
|
1224
|
-
...{ size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }, ...gridProps },
|
|
1225
|
-
children: /* @__PURE__ */ jsx8(Component8, { ...props })
|
|
1226
|
-
}
|
|
1227
|
-
);
|
|
1228
|
-
}
|
|
1229
|
-
return /* @__PURE__ */ jsx8(Component8, { ...props });
|
|
1230
|
-
};
|
|
1231
|
-
SelectElement2.displayName = "SelectElement";
|
|
1232
|
-
var SelectElement_default = SelectElement2;
|
|
1233
|
-
|
|
1234
|
-
// src/wrappers3/SelectMultiElement/SelectMultiElement.tsx
|
|
1235
|
-
import { Fragment as Fragment3 } from "react";
|
|
1236
|
-
import { useController as useController9 } from "react-hook-form";
|
|
1237
|
-
import Chip from "@mui/material/Chip";
|
|
1238
|
-
import CheckBoxIcon from "@mui/icons-material/CheckBox";
|
|
1239
|
-
import CheckBoxOutlineBlankIcon from "@mui/icons-material/CheckBoxOutlineBlank";
|
|
1240
|
-
import {
|
|
1241
|
-
Grid2 as Grid29,
|
|
1242
|
-
Checkbox,
|
|
1243
|
-
TextField as TextField6,
|
|
1244
|
-
Autocomplete as Autocomplete4,
|
|
1245
|
-
CircularProgress as CircularProgress3
|
|
1246
|
-
} from "@mui/material";
|
|
1247
|
-
import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1248
|
-
var Component9 = function SelectMultiElement(props) {
|
|
1249
|
-
const {
|
|
1250
|
-
name,
|
|
1251
|
-
control,
|
|
1252
|
-
onBlur,
|
|
1253
|
-
disabled,
|
|
1254
|
-
options,
|
|
1255
|
-
loading = false,
|
|
1256
|
-
placeholder,
|
|
1257
|
-
label,
|
|
1258
|
-
variant,
|
|
1259
|
-
sx,
|
|
1260
|
-
labelKey = "Label",
|
|
1261
|
-
valueKey = "Value",
|
|
1262
|
-
multiple = true,
|
|
1263
|
-
...rest
|
|
1264
|
-
} = props;
|
|
1265
|
-
const {
|
|
1266
|
-
field,
|
|
1267
|
-
fieldState: { error }
|
|
1268
|
-
} = useController9({
|
|
1269
|
-
name,
|
|
1270
|
-
control
|
|
1271
|
-
});
|
|
1272
|
-
const getOptionValue = (option) => {
|
|
1273
|
-
if (typeof option === "string") return option;
|
|
1274
|
-
return option ? option[valueKey] : null;
|
|
1275
|
-
};
|
|
1276
|
-
const getOptionLabel = (option) => {
|
|
1277
|
-
if (typeof option === "string") return option;
|
|
1278
|
-
return option ? option[labelKey] : "";
|
|
1279
|
-
};
|
|
1280
|
-
const selectedValue = multiple ? Array.isArray(field.value) ? options.filter((option) => field.value.includes(getOptionValue(option))) : [] : options.find((option) => getOptionValue(option) === field.value) ?? null;
|
|
1281
|
-
const handleChange = (_2, selected, reason) => {
|
|
1282
|
-
if (multiple) {
|
|
1283
|
-
if (reason === "clear") {
|
|
1284
|
-
field.onChange([]);
|
|
1285
|
-
} else {
|
|
1286
|
-
const newValues = selected.map(
|
|
1287
|
-
(option) => getOptionValue(option)
|
|
1288
|
-
);
|
|
1289
|
-
field.onChange(newValues);
|
|
1290
|
-
}
|
|
1291
|
-
} else {
|
|
1292
|
-
field.onChange(selected ? getOptionValue(selected) : null);
|
|
1293
|
-
}
|
|
1294
|
-
};
|
|
1295
|
-
const icon = /* @__PURE__ */ jsx9(CheckBoxOutlineBlankIcon, { fontSize: "small" });
|
|
1296
|
-
const checkedIcon = /* @__PURE__ */ jsx9(CheckBoxIcon, { fontSize: "small" });
|
|
1297
|
-
return /* @__PURE__ */ jsx9(
|
|
1298
|
-
Autocomplete4,
|
|
1299
|
-
{
|
|
1300
|
-
multiple,
|
|
1301
|
-
value: selectedValue,
|
|
1302
|
-
loading,
|
|
1303
|
-
options,
|
|
1304
|
-
getOptionLabel: (option) => getOptionLabel(option),
|
|
1305
|
-
isOptionEqualToValue: (option, value) => getOptionValue(option) === getOptionValue(value),
|
|
1306
|
-
filterSelectedOptions: multiple,
|
|
1307
|
-
disableCloseOnSelect: multiple,
|
|
1308
|
-
ref: field.ref,
|
|
1309
|
-
disabled: disabled ?? field.disabled,
|
|
1310
|
-
onChange: handleChange,
|
|
1311
|
-
onBlur: (event) => {
|
|
1312
|
-
field.onBlur();
|
|
1313
|
-
if (typeof onBlur === "function") {
|
|
1314
|
-
onBlur(event);
|
|
1315
|
-
}
|
|
1316
|
-
},
|
|
1317
|
-
fullWidth: true,
|
|
1318
|
-
renderOption: (props1, option, { selected }) => multiple ? /* @__PURE__ */ jsxs4("li", { ...props1, children: [
|
|
1319
|
-
/* @__PURE__ */ jsx9(
|
|
1320
|
-
Checkbox,
|
|
1321
|
-
{
|
|
1322
|
-
icon,
|
|
1323
|
-
checkedIcon,
|
|
1324
|
-
checked: selected
|
|
1325
|
-
}
|
|
1326
|
-
),
|
|
1327
|
-
getOptionLabel(option)
|
|
1328
|
-
] }) : /* @__PURE__ */ jsx9("li", { ...props1, children: getOptionLabel(option) }),
|
|
1329
|
-
renderTags: (tagValue, getTagProps) => tagValue.map((option, index) => /* @__PURE__ */ jsx9(
|
|
1330
|
-
Chip,
|
|
1331
|
-
{
|
|
1332
|
-
...getTagProps({ index }),
|
|
1333
|
-
label: getOptionLabel(option),
|
|
1334
|
-
size: "small",
|
|
1335
|
-
variant: "filled"
|
|
1336
|
-
}
|
|
1337
|
-
)),
|
|
1338
|
-
renderInput: (params) => /* @__PURE__ */ jsx9(
|
|
1339
|
-
TextField6,
|
|
1340
|
-
{
|
|
1341
|
-
...params,
|
|
1342
|
-
label,
|
|
1343
|
-
error: !!error,
|
|
1344
|
-
helperText: error ? error.message : "",
|
|
1345
|
-
placeholder,
|
|
1346
|
-
slotProps: {
|
|
1347
|
-
input: {
|
|
1348
|
-
...params.InputProps,
|
|
1349
|
-
endAdornment: /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
1350
|
-
loading ? /* @__PURE__ */ jsx9(CircularProgress3, { color: "inherit", size: 20 }) : null,
|
|
1351
|
-
params.InputProps.endAdornment
|
|
1352
|
-
] })
|
|
1353
|
-
}
|
|
1354
|
-
},
|
|
1355
|
-
variant: variant ? variant : "outlined",
|
|
1356
|
-
sx: {
|
|
1357
|
-
...sx
|
|
1358
|
-
}
|
|
1359
|
-
}
|
|
1360
|
-
),
|
|
1361
|
-
...rest
|
|
1362
|
-
}
|
|
1363
|
-
);
|
|
1364
|
-
};
|
|
1365
|
-
var SelectMultiElement2 = ({
|
|
1366
|
-
gridProps = { size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 } },
|
|
1367
|
-
...props
|
|
1368
|
-
}) => {
|
|
1369
|
-
if (gridProps) {
|
|
1370
|
-
return /* @__PURE__ */ jsx9(
|
|
1371
|
-
Grid29,
|
|
1372
|
-
{
|
|
1373
|
-
...{ size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }, ...gridProps },
|
|
1374
|
-
children: /* @__PURE__ */ jsx9(Component9, { ...props })
|
|
1375
|
-
}
|
|
1376
|
-
);
|
|
1377
|
-
}
|
|
1378
|
-
return /* @__PURE__ */ jsx9(Component9, { ...props });
|
|
1379
|
-
};
|
|
1380
|
-
SelectMultiElement2.displayName = "SelectMultiElement";
|
|
1381
|
-
var SelectMultiElement_default = SelectMultiElement2;
|
|
1382
|
-
|
|
1383
|
-
// src/wrappers3/SelectCascadeElement/SelectCascadeElement.tsx
|
|
1384
|
-
import { useRef as useRef3, useState as useState4, useEffect as useEffect5, useCallback as useCallback5 } from "react";
|
|
1385
|
-
import {
|
|
1386
|
-
useController as useController10
|
|
1387
|
-
} from "react-hook-form";
|
|
1388
|
-
import {
|
|
1389
|
-
Grid2 as Grid210,
|
|
1390
|
-
useTheme as useTheme7,
|
|
1391
|
-
TextField as TextField7,
|
|
1392
|
-
Autocomplete as Autocomplete5
|
|
1393
|
-
} from "@mui/material";
|
|
1394
|
-
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1395
|
-
var Component10 = function SelectCascadeElement(props) {
|
|
1396
|
-
const {
|
|
1397
|
-
labelKey = "Label",
|
|
1398
|
-
valueKey = "Value",
|
|
1399
|
-
name,
|
|
1400
|
-
onBlur,
|
|
1401
|
-
onChange,
|
|
1402
|
-
disabled,
|
|
1403
|
-
options,
|
|
1404
|
-
control,
|
|
1405
|
-
loading = false,
|
|
1406
|
-
placeholder,
|
|
1407
|
-
label,
|
|
1408
|
-
dependsOn,
|
|
1409
|
-
initialValue,
|
|
1410
|
-
textFieldProps = {},
|
|
1411
|
-
variant,
|
|
1412
|
-
sx,
|
|
1413
|
-
isEdit = false,
|
|
1414
|
-
...rest
|
|
1415
|
-
} = props;
|
|
1416
|
-
const { required } = textFieldProps;
|
|
1417
|
-
const getOptionKey = useCallback5(
|
|
1418
|
-
(option) => {
|
|
1419
|
-
if (typeof option === "string" || typeof option === "number")
|
|
1420
|
-
return option;
|
|
1421
|
-
const key = option ? option[valueKey] : void 0;
|
|
1422
|
-
if (key === void 0 || key === null) {
|
|
1423
|
-
return "";
|
|
1424
|
-
}
|
|
1425
|
-
if (typeof key === "string" || typeof key === "number") {
|
|
1426
|
-
return key;
|
|
1427
|
-
}
|
|
1428
|
-
return String(key);
|
|
1429
|
-
},
|
|
1430
|
-
[valueKey]
|
|
1431
|
-
);
|
|
1432
|
-
const getOptionLabel = useCallback5(
|
|
1433
|
-
(option) => {
|
|
1434
|
-
if (typeof option === "string") return option;
|
|
1435
|
-
return option ? String(option[labelKey]) : "";
|
|
1436
|
-
},
|
|
1437
|
-
[labelKey]
|
|
1438
|
-
);
|
|
1439
|
-
const isOptionEqualToValue = (option, value) => getOptionKey(option) === getOptionKey(value);
|
|
1440
|
-
const {
|
|
1441
|
-
field,
|
|
1442
|
-
fieldState: { error }
|
|
1443
|
-
} = useController10({
|
|
1444
|
-
name,
|
|
1445
|
-
control,
|
|
1446
|
-
defaultValue: initialValue
|
|
1447
|
-
});
|
|
1448
|
-
const theme = useTheme7();
|
|
1449
|
-
const { field: dependentField } = useController10({
|
|
1450
|
-
name: dependsOn,
|
|
1451
|
-
control
|
|
1452
|
-
});
|
|
1453
|
-
const parentValueRef = useRef3(dependentField.value ?? null);
|
|
1454
|
-
const [hasAutoSelected, setHasAutoSelected] = useState4(false);
|
|
1455
|
-
useEffect5(() => {
|
|
1456
|
-
if (parentValueRef.current !== dependentField.value) {
|
|
1457
|
-
parentValueRef.current = dependentField.value;
|
|
1458
|
-
field.onChange(null);
|
|
1459
|
-
setHasAutoSelected(false);
|
|
1460
|
-
}
|
|
1461
|
-
}, [dependentField.value, field]);
|
|
1462
|
-
useEffect5(() => {
|
|
1463
|
-
if (!dependentField.value) return;
|
|
1464
|
-
if (isEdit) {
|
|
1465
|
-
if (field.value) return;
|
|
1466
|
-
if (options.length === 1 && !hasAutoSelected) {
|
|
1467
|
-
field.onChange(getOptionKey(options[0]));
|
|
1468
|
-
setHasAutoSelected(true);
|
|
1469
|
-
}
|
|
1470
|
-
} else {
|
|
1471
|
-
if (options.length === 1 && !field.value && !hasAutoSelected) {
|
|
1472
|
-
field.onChange(getOptionKey(options[0]));
|
|
1473
|
-
setHasAutoSelected(true);
|
|
1474
|
-
}
|
|
1475
|
-
}
|
|
1476
|
-
}, [
|
|
1477
|
-
isEdit,
|
|
1478
|
-
options,
|
|
1479
|
-
field.value,
|
|
1480
|
-
dependentField.value,
|
|
1481
|
-
getOptionKey,
|
|
1482
|
-
hasAutoSelected,
|
|
1483
|
-
field
|
|
1484
|
-
]);
|
|
1485
|
-
const autocompleteValue = options.find((opt) => getOptionKey(opt) === field.value) ?? null;
|
|
1486
|
-
return /* @__PURE__ */ jsx10(
|
|
1487
|
-
Autocomplete5,
|
|
1488
|
-
{
|
|
1489
|
-
...rest,
|
|
1490
|
-
value: autocompleteValue,
|
|
1491
|
-
size: "small",
|
|
1492
|
-
loading,
|
|
1493
|
-
options,
|
|
1494
|
-
getOptionLabel,
|
|
1495
|
-
isOptionEqualToValue,
|
|
1496
|
-
ref: field.ref,
|
|
1497
|
-
disabled: !dependentField.value || disabled,
|
|
1498
|
-
onChange: (event, newValue, reason) => {
|
|
1499
|
-
field.onChange(newValue ? getOptionKey(newValue) : null);
|
|
1500
|
-
if (onChange && typeof onChange === "function") {
|
|
1501
|
-
onChange(event, newValue, reason);
|
|
1502
|
-
}
|
|
1503
|
-
},
|
|
1504
|
-
onBlur: (event) => {
|
|
1505
|
-
field.onBlur();
|
|
1506
|
-
if (typeof onBlur === "function") {
|
|
1507
|
-
onBlur(event);
|
|
1508
|
-
}
|
|
1509
|
-
},
|
|
1510
|
-
renderInput: (params) => /* @__PURE__ */ jsx10(
|
|
1511
|
-
TextField7,
|
|
1512
|
-
{
|
|
1513
|
-
...params,
|
|
1514
|
-
fullWidth: true,
|
|
1515
|
-
error: !!error,
|
|
1516
|
-
required,
|
|
1517
|
-
helperText: error ? error.message : "",
|
|
1518
|
-
placeholder,
|
|
1519
|
-
label,
|
|
1520
|
-
variant: variant ?? "outlined",
|
|
1521
|
-
sx: {
|
|
1522
|
-
"& .MuiOutlinedInput-root": {
|
|
1523
|
-
bgcolor: disabled || !dependentField.value ? theme.palette.action.disabledBackground : "transparent"
|
|
1524
|
-
},
|
|
1525
|
-
"& .MuiInputLabel-asterisk": { color: "red" },
|
|
1526
|
-
"& .MuiInputBase-input": {
|
|
1527
|
-
cursor: disabled || !dependentField.value ? "not-allowed" : "default"
|
|
1528
|
-
},
|
|
1529
|
-
...sx
|
|
1530
|
-
}
|
|
1531
|
-
}
|
|
1532
|
-
)
|
|
1533
|
-
}
|
|
1534
|
-
);
|
|
1535
|
-
};
|
|
1536
|
-
var SelectCascadeElement2 = ({
|
|
1537
|
-
gridProps = { size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 } },
|
|
1538
|
-
...props
|
|
1539
|
-
}) => {
|
|
1540
|
-
if (gridProps) {
|
|
1541
|
-
return /* @__PURE__ */ jsx10(
|
|
1542
|
-
Grid210,
|
|
1543
|
-
{
|
|
1544
|
-
...{ size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }, ...gridProps },
|
|
1545
|
-
children: /* @__PURE__ */ jsx10(Component10, { ...props })
|
|
1546
|
-
}
|
|
1547
|
-
);
|
|
1548
|
-
}
|
|
1549
|
-
return /* @__PURE__ */ jsx10(Component10, { ...props });
|
|
1550
|
-
};
|
|
1551
|
-
SelectCascadeElement2.displayName = "SelectCascadeElement";
|
|
1552
|
-
var SelectCascadeElement_default = SelectCascadeElement2;
|
|
1553
|
-
|
|
1554
|
-
// src/wrappers3/CheckboxElement/CheckboxElement.tsx
|
|
1555
|
-
import {
|
|
1556
|
-
Checkbox as Checkbox2,
|
|
1557
|
-
FormControl as FormControl2,
|
|
1558
|
-
FormControlLabel as FormControlLabel2,
|
|
1559
|
-
FormGroup,
|
|
1560
|
-
FormHelperText as FormHelperText2,
|
|
1561
|
-
Grid2 as Grid211
|
|
1562
|
-
} from "@mui/material";
|
|
1563
|
-
import {
|
|
1564
|
-
useController as useController11
|
|
1565
|
-
} from "react-hook-form";
|
|
1566
|
-
import { jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1567
|
-
var Component11 = function CheckboxElement(props) {
|
|
1568
|
-
const { name, control, label, labelProps, inputRef, ...rest } = props;
|
|
1569
|
-
const {
|
|
1570
|
-
field,
|
|
1571
|
-
fieldState: { error }
|
|
1572
|
-
} = useController11({
|
|
1573
|
-
name,
|
|
1574
|
-
control,
|
|
1575
|
-
disabled: rest.disabled
|
|
1576
|
-
});
|
|
1577
|
-
return /* @__PURE__ */ jsxs5(FormControl2, { error: !!error, children: [
|
|
1578
|
-
/* @__PURE__ */ jsx11(FormGroup, { row: true, children: /* @__PURE__ */ jsx11(
|
|
1579
|
-
FormControlLabel2,
|
|
1580
|
-
{
|
|
1581
|
-
label: label || "",
|
|
1582
|
-
...labelProps,
|
|
1583
|
-
control: /* @__PURE__ */ jsx11(
|
|
1584
|
-
Checkbox2,
|
|
1585
|
-
{
|
|
1586
|
-
...rest,
|
|
1587
|
-
color: rest.color || "primary",
|
|
1588
|
-
sx: [
|
|
1589
|
-
...Array.isArray(rest.sx) ? rest.sx : [rest.sx],
|
|
1590
|
-
{
|
|
1591
|
-
color: error ? "error.main" : void 0
|
|
1592
|
-
}
|
|
1593
|
-
],
|
|
1594
|
-
value: field.value,
|
|
1595
|
-
checked: !!field.value,
|
|
1596
|
-
onChange: (event, newValue) => {
|
|
1597
|
-
field.onChange(event, newValue);
|
|
1598
|
-
if (typeof rest.onChange === "function") {
|
|
1599
|
-
rest.onChange(event, newValue);
|
|
1600
|
-
}
|
|
1601
|
-
}
|
|
1602
|
-
}
|
|
1603
|
-
)
|
|
1604
|
-
}
|
|
1605
|
-
) }),
|
|
1606
|
-
error && /* @__PURE__ */ jsx11(FormHelperText2, { error: !!error, children: error.message })
|
|
1607
|
-
] });
|
|
1608
|
-
};
|
|
1609
|
-
var CheckboxElement2 = ({
|
|
1610
|
-
gridProps,
|
|
1611
|
-
...props
|
|
1612
|
-
}) => {
|
|
1613
|
-
if (gridProps) {
|
|
1614
|
-
return /* @__PURE__ */ jsx11(Grid211, { ...{ size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }, ...gridProps }, children: /* @__PURE__ */ jsx11(Component11, { ...props }) });
|
|
1615
|
-
}
|
|
1616
|
-
return /* @__PURE__ */ jsx11(Component11, { ...props });
|
|
1617
|
-
};
|
|
1618
|
-
CheckboxElement2.displayName = "CheckboxElement";
|
|
1619
|
-
var CheckboxElement_default = CheckboxElement2;
|
|
1620
|
-
|
|
1621
|
-
// src/wrappers3/CheckboxGroup/CheckboxGroup.tsx
|
|
1622
|
-
import {
|
|
1623
|
-
Checkbox as Checkbox3,
|
|
1624
|
-
FormControl as FormControl3,
|
|
1625
|
-
FormControlLabel as FormControlLabel3,
|
|
1626
|
-
FormGroup as FormGroup2,
|
|
1627
|
-
FormHelperText as FormHelperText3,
|
|
1628
|
-
Grid2 as Grid212
|
|
1629
|
-
} from "@mui/material";
|
|
1630
|
-
import { useEffect as useEffect6, useState as useState5 } from "react";
|
|
1631
|
-
import {
|
|
1632
|
-
useController as useController12
|
|
1633
|
-
} from "react-hook-form";
|
|
1634
|
-
import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1635
|
-
var Component12 = function CheckboxGroup(props) {
|
|
1636
|
-
const { name, control, label, labelProps, inputRef, options, ...rest } = props;
|
|
1637
|
-
const {
|
|
1638
|
-
field,
|
|
1639
|
-
fieldState: { error }
|
|
1640
|
-
} = useController12({
|
|
1641
|
-
name,
|
|
1642
|
-
control,
|
|
1643
|
-
disabled: rest.disabled
|
|
1644
|
-
});
|
|
1645
|
-
const [selectedValues, setSelectedValues] = useState5(
|
|
1646
|
-
options.filter((c) => field.value?.includes(c.Value)).map((c) => c.Value) || []
|
|
1647
|
-
);
|
|
1648
|
-
useEffect6(() => {
|
|
1649
|
-
field.onChange(selectedValues ? [...selectedValues] : []);
|
|
1650
|
-
}, [selectedValues]);
|
|
1651
|
-
const handleChange = (event) => {
|
|
1652
|
-
const value = parseInt(event.target.value, 10);
|
|
1653
|
-
if (event.target.checked) {
|
|
1654
|
-
setSelectedValues([...selectedValues, value]);
|
|
1655
|
-
} else {
|
|
1656
|
-
setSelectedValues(selectedValues.filter((item) => item !== value));
|
|
1657
|
-
}
|
|
1658
|
-
};
|
|
1659
|
-
return /* @__PURE__ */ jsxs6(FormControl3, { error: !!error, children: [
|
|
1660
|
-
/* @__PURE__ */ jsx12(FormGroup2, { row: true, children: options.map((option) => /* @__PURE__ */ jsx12(
|
|
1661
|
-
FormControlLabel3,
|
|
1662
|
-
{
|
|
1663
|
-
label: option.Label,
|
|
1664
|
-
...labelProps,
|
|
1665
|
-
control: /* @__PURE__ */ jsx12(
|
|
1666
|
-
Checkbox3,
|
|
1667
|
-
{
|
|
1668
|
-
...rest,
|
|
1669
|
-
color: rest.color || "primary",
|
|
1670
|
-
sx: [
|
|
1671
|
-
...Array.isArray(rest.sx) ? rest.sx : [rest.sx],
|
|
1672
|
-
{
|
|
1673
|
-
color: error ? "error.main" : void 0
|
|
1674
|
-
}
|
|
1675
|
-
],
|
|
1676
|
-
value: option.Value,
|
|
1677
|
-
checked: selectedValues.includes(option.Value),
|
|
1678
|
-
onChange: handleChange
|
|
1679
|
-
}
|
|
1680
|
-
)
|
|
1681
|
-
},
|
|
1682
|
-
`${option.Value}`
|
|
1683
|
-
)) }),
|
|
1684
|
-
error && /* @__PURE__ */ jsx12(FormHelperText3, { error: !!error, children: error.message })
|
|
1685
|
-
] });
|
|
1686
|
-
};
|
|
1687
|
-
var CheckboxGroup2 = ({
|
|
1688
|
-
gridProps,
|
|
1689
|
-
...props
|
|
1690
|
-
}) => {
|
|
1691
|
-
if (gridProps) {
|
|
1692
|
-
return /* @__PURE__ */ jsx12(Grid212, { ...{ size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }, ...gridProps }, children: /* @__PURE__ */ jsx12(Component12, { ...props }) });
|
|
1693
|
-
}
|
|
1694
|
-
return /* @__PURE__ */ jsx12(Component12, { ...props });
|
|
1695
|
-
};
|
|
1696
|
-
CheckboxGroup2.displayName = "CheckboxGroup";
|
|
1697
|
-
var CheckboxGroup_default = CheckboxGroup2;
|
|
1698
|
-
|
|
1699
|
-
// src/wrappers3/SelectMultiCascadeElement/SelectMultiCascadeElement.tsx
|
|
1700
|
-
import { useController as useController13 } from "react-hook-form";
|
|
1701
|
-
import { useRef as useRef4, Fragment as Fragment4, useState as useState6, useEffect as useEffect7, useCallback as useCallback6 } from "react";
|
|
1702
|
-
import CheckBoxIcon2 from "@mui/icons-material/CheckBox";
|
|
1703
|
-
import CheckBoxOutlineBlankIcon2 from "@mui/icons-material/CheckBoxOutlineBlank";
|
|
1704
|
-
import {
|
|
1705
|
-
Chip as Chip2,
|
|
1706
|
-
Grid2 as Grid213,
|
|
1707
|
-
Checkbox as Checkbox4,
|
|
1708
|
-
TextField as TextField8,
|
|
1709
|
-
Autocomplete as Autocomplete6,
|
|
1710
|
-
CircularProgress as CircularProgress4
|
|
1711
|
-
} from "@mui/material";
|
|
1712
|
-
import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1713
|
-
var Component13 = function SelectMultiCascadeElement(props) {
|
|
1714
|
-
const {
|
|
1715
|
-
name,
|
|
1716
|
-
control,
|
|
1717
|
-
dependsOn,
|
|
1718
|
-
onBlur,
|
|
1719
|
-
disabled,
|
|
1720
|
-
options,
|
|
1721
|
-
loading = false,
|
|
1722
|
-
placeholder,
|
|
1723
|
-
label,
|
|
1724
|
-
variant,
|
|
1725
|
-
sx,
|
|
1726
|
-
labelKey = "Label",
|
|
1727
|
-
valueKey = "Value",
|
|
1728
|
-
multiple = true,
|
|
1729
|
-
isEdit = false,
|
|
1730
|
-
initialValue,
|
|
1731
|
-
...rest
|
|
1732
|
-
} = props;
|
|
1733
|
-
const {
|
|
1734
|
-
field,
|
|
1735
|
-
fieldState: { error }
|
|
1736
|
-
} = useController13({
|
|
1737
|
-
name,
|
|
1738
|
-
control,
|
|
1739
|
-
defaultValue: initialValue
|
|
1740
|
-
});
|
|
1741
|
-
const { field: dependentField } = useController13({
|
|
1742
|
-
name: dependsOn,
|
|
1743
|
-
control
|
|
1744
|
-
});
|
|
1745
|
-
const parentValueRef = useRef4(dependentField.value ?? null);
|
|
1746
|
-
const [hasAutoSelected, setHasAutoSelected] = useState6(false);
|
|
1747
|
-
const getOptionValue = useCallback6(
|
|
1748
|
-
(option) => {
|
|
1749
|
-
if (typeof option === "string") return option;
|
|
1750
|
-
return option ? option[valueKey] : null;
|
|
1751
|
-
},
|
|
1752
|
-
[valueKey]
|
|
1753
|
-
);
|
|
1754
|
-
const getOptionLabel = useCallback6(
|
|
1755
|
-
(option) => {
|
|
1756
|
-
if (typeof option === "string") return option;
|
|
1757
|
-
return option ? option[labelKey] : "";
|
|
1758
|
-
},
|
|
1759
|
-
[labelKey]
|
|
1760
|
-
);
|
|
1761
|
-
useEffect7(() => {
|
|
1762
|
-
if (parentValueRef.current !== dependentField.value) {
|
|
1763
|
-
parentValueRef.current = dependentField.value;
|
|
1764
|
-
field.onChange(multiple ? [] : null);
|
|
1765
|
-
setHasAutoSelected(false);
|
|
1766
|
-
}
|
|
1767
|
-
}, [dependentField.value, field, multiple]);
|
|
1768
|
-
useEffect7(() => {
|
|
1769
|
-
if (!dependentField.value) return;
|
|
1770
|
-
if (isEdit) {
|
|
1771
|
-
if (field.value && (multiple ? field.value.length > 0 : field.value))
|
|
1772
|
-
return;
|
|
1773
|
-
if (options.length === 1 && !hasAutoSelected) {
|
|
1774
|
-
field.onChange(
|
|
1775
|
-
multiple ? [getOptionValue(options[0])] : getOptionValue(options[0])
|
|
1776
|
-
);
|
|
1777
|
-
setHasAutoSelected(true);
|
|
1778
|
-
}
|
|
1779
|
-
} else {
|
|
1780
|
-
if (options.length === 1 && (!field.value || field.value.length === 0) && !hasAutoSelected) {
|
|
1781
|
-
field.onChange(
|
|
1782
|
-
multiple ? [getOptionValue(options[0])] : getOptionValue(options[0])
|
|
1783
|
-
);
|
|
1784
|
-
setHasAutoSelected(true);
|
|
1785
|
-
}
|
|
1786
|
-
}
|
|
1787
|
-
}, [
|
|
1788
|
-
isEdit,
|
|
1789
|
-
options,
|
|
1790
|
-
field.value,
|
|
1791
|
-
dependentField.value,
|
|
1792
|
-
multiple,
|
|
1793
|
-
getOptionValue,
|
|
1794
|
-
hasAutoSelected,
|
|
1795
|
-
field
|
|
1796
|
-
]);
|
|
1797
|
-
const selectedValue = multiple ? Array.isArray(field.value) ? options.filter((opt) => field.value.includes(getOptionValue(opt))) : [] : options.find((opt) => getOptionValue(opt) === field.value) ?? null;
|
|
1798
|
-
const handleChange = (_2, selected, reason) => {
|
|
1799
|
-
if (multiple) {
|
|
1800
|
-
if (reason === "clear") {
|
|
1801
|
-
field.onChange([]);
|
|
1802
|
-
} else {
|
|
1803
|
-
const newValues = selected.map((opt) => getOptionValue(opt));
|
|
1804
|
-
field.onChange(newValues);
|
|
1805
|
-
}
|
|
1806
|
-
} else {
|
|
1807
|
-
field.onChange(selected ? getOptionValue(selected) : null);
|
|
1808
|
-
}
|
|
1809
|
-
};
|
|
1810
|
-
const icon = /* @__PURE__ */ jsx13(CheckBoxOutlineBlankIcon2, { fontSize: "small" });
|
|
1811
|
-
const checkedIcon = /* @__PURE__ */ jsx13(CheckBoxIcon2, { fontSize: "small" });
|
|
1812
|
-
return /* @__PURE__ */ jsx13(
|
|
1813
|
-
Autocomplete6,
|
|
1814
|
-
{
|
|
1815
|
-
multiple,
|
|
1816
|
-
value: selectedValue,
|
|
1817
|
-
loading,
|
|
1818
|
-
options,
|
|
1819
|
-
getOptionLabel,
|
|
1820
|
-
isOptionEqualToValue: (option, value) => getOptionValue(option) === getOptionValue(value),
|
|
1821
|
-
filterSelectedOptions: multiple,
|
|
1822
|
-
disableCloseOnSelect: multiple,
|
|
1823
|
-
ref: field.ref,
|
|
1824
|
-
disabled: !dependentField.value || disabled,
|
|
1825
|
-
onChange: handleChange,
|
|
1826
|
-
onBlur: (event) => {
|
|
1827
|
-
field.onBlur();
|
|
1828
|
-
if (typeof onBlur === "function") {
|
|
1829
|
-
onBlur(event);
|
|
1830
|
-
}
|
|
1831
|
-
},
|
|
1832
|
-
fullWidth: true,
|
|
1833
|
-
renderOption: (props1, option, { selected }) => multiple ? /* @__PURE__ */ jsxs7("li", { ...props1, children: [
|
|
1834
|
-
/* @__PURE__ */ jsx13(
|
|
1835
|
-
Checkbox4,
|
|
1836
|
-
{
|
|
1837
|
-
icon,
|
|
1838
|
-
checkedIcon,
|
|
1839
|
-
checked: selected
|
|
1840
|
-
}
|
|
1841
|
-
),
|
|
1842
|
-
getOptionLabel(option)
|
|
1843
|
-
] }) : /* @__PURE__ */ jsx13("li", { ...props1, children: getOptionLabel(option) }),
|
|
1844
|
-
renderTags: (tagValue, getTagProps) => tagValue.map((option, index) => /* @__PURE__ */ jsx13(
|
|
1845
|
-
Chip2,
|
|
1846
|
-
{
|
|
1847
|
-
...getTagProps({ index }),
|
|
1848
|
-
label: getOptionLabel(option),
|
|
1849
|
-
size: "small",
|
|
1850
|
-
variant: "filled"
|
|
1851
|
-
}
|
|
1852
|
-
)),
|
|
1853
|
-
renderInput: (params) => /* @__PURE__ */ jsx13(
|
|
1854
|
-
TextField8,
|
|
1855
|
-
{
|
|
1856
|
-
...params,
|
|
1857
|
-
label,
|
|
1858
|
-
error: !!error,
|
|
1859
|
-
helperText: error ? error.message : "",
|
|
1860
|
-
placeholder,
|
|
1861
|
-
slotProps: {
|
|
1862
|
-
input: {
|
|
1863
|
-
...params.InputProps,
|
|
1864
|
-
endAdornment: /* @__PURE__ */ jsxs7(Fragment4, { children: [
|
|
1865
|
-
loading ? /* @__PURE__ */ jsx13(CircularProgress4, { color: "inherit", size: 20 }) : null,
|
|
1866
|
-
params.InputProps.endAdornment
|
|
1867
|
-
] })
|
|
1868
|
-
}
|
|
1869
|
-
},
|
|
1870
|
-
variant: variant ? variant : "outlined",
|
|
1871
|
-
sx: {
|
|
1872
|
-
...sx
|
|
1873
|
-
}
|
|
1874
|
-
}
|
|
1875
|
-
),
|
|
1876
|
-
...rest
|
|
1877
|
-
}
|
|
1878
|
-
);
|
|
1879
|
-
};
|
|
1880
|
-
var SelectMultiCascadeElement2 = ({
|
|
1881
|
-
gridProps = { size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 } },
|
|
1882
|
-
...props
|
|
1883
|
-
}) => {
|
|
1884
|
-
if (gridProps) {
|
|
1885
|
-
return /* @__PURE__ */ jsx13(
|
|
1886
|
-
Grid213,
|
|
1887
|
-
{
|
|
1888
|
-
...{ size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }, ...gridProps },
|
|
1889
|
-
children: /* @__PURE__ */ jsx13(Component13, { ...props })
|
|
1890
|
-
}
|
|
1891
|
-
);
|
|
1892
|
-
}
|
|
1893
|
-
return /* @__PURE__ */ jsx13(Component13, { ...props });
|
|
1894
|
-
};
|
|
1895
|
-
SelectMultiCascadeElement2.displayName = "SelectMultiCascadeElement";
|
|
1896
|
-
var SelectMultiCascadeElement_default = SelectMultiCascadeElement2;
|
|
1897
|
-
|
|
1898
|
-
// src/wrappers3/Field/index.ts
|
|
1899
|
-
var Field3 = {
|
|
1900
|
-
Text: TextFieldElement_default,
|
|
1901
|
-
Checkbox: CheckboxElement_default,
|
|
1902
|
-
Date: DatePickerElement_default,
|
|
1903
|
-
RadioGroup: RadioButtonGroup_default,
|
|
1904
|
-
Password: PasswordElement_default,
|
|
1905
|
-
Time: TimePickerElement_default,
|
|
1906
|
-
Select: SelectElement_default,
|
|
1907
|
-
SelectMulti: SelectMultiElement_default,
|
|
1908
|
-
SelectCascade: SelectCascadeElement_default,
|
|
1909
|
-
AsyncSelect: AsyncSelectElement_default,
|
|
1910
|
-
AsyncMultiSelect: AsyncMultiSelect_default,
|
|
1911
|
-
CheckboxGroup: CheckboxGroup_default,
|
|
1912
|
-
SelectMultiCascadeElement: SelectMultiCascadeElement_default
|
|
1913
|
-
};
|
|
1914
|
-
var Field_default3 = Field3;
|
|
1915
38
|
export {
|
|
1916
39
|
AuthorizedView_default as AuthorizedView,
|
|
1917
40
|
CancelButton_default as CancelButton,
|