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