@gnwebsoft/ui 2.18.45 → 2.18.46
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-D3J7MWAU.js → chunk-22MN4IPU.js} +310 -54
- package/dist/{chunk-BWQUYXUW.mjs → chunk-F6RJXISB.mjs} +310 -54
- package/dist/index.js +2 -2
- package/dist/index.mjs +1 -1
- package/dist/wrappers/index.d.mts +30 -8
- package/dist/wrappers/index.d.ts +30 -8
- package/dist/wrappers/index.js +2 -2
- package/dist/wrappers/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -1096,6 +1096,7 @@ var Component8 = function SelectElement(props) {
|
|
|
1096
1096
|
sx,
|
|
1097
1097
|
variant,
|
|
1098
1098
|
disabled,
|
|
1099
|
+
initialValue,
|
|
1099
1100
|
labelKey = "Label",
|
|
1100
1101
|
valueKey = "Value",
|
|
1101
1102
|
placeholder,
|
|
@@ -1108,7 +1109,8 @@ var Component8 = function SelectElement(props) {
|
|
|
1108
1109
|
fieldState: { error }
|
|
1109
1110
|
} = _reacthookform.useController.call(void 0, {
|
|
1110
1111
|
name,
|
|
1111
|
-
control
|
|
1112
|
+
control,
|
|
1113
|
+
defaultValue: initialValue
|
|
1112
1114
|
});
|
|
1113
1115
|
const theme = _material.useTheme.call(void 0, );
|
|
1114
1116
|
const getOptionValue = _react.useCallback.call(void 0,
|
|
@@ -1131,16 +1133,20 @@ var Component8 = function SelectElement(props) {
|
|
|
1131
1133
|
_optionalChain([onChange, 'optionalCall', _24 => _24(event, newValue, reason)]);
|
|
1132
1134
|
};
|
|
1133
1135
|
_react.useEffect.call(void 0, () => {
|
|
1134
|
-
if (!isEdit && options.length === 1 && (field.value == null || field.value
|
|
1136
|
+
if (!isEdit && options.length === 1 && (field.value == null || field.value === "")) {
|
|
1135
1137
|
const defaultOption = options[0];
|
|
1136
|
-
|
|
1137
|
-
field.onChange(defaultValue);
|
|
1138
|
+
field.onChange(getOptionValue(defaultOption));
|
|
1138
1139
|
}
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
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]);
|
|
1144
1150
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1145
1151
|
_material.Autocomplete,
|
|
1146
1152
|
{
|
|
@@ -1180,7 +1186,7 @@ var Component8 = function SelectElement(props) {
|
|
|
1180
1186
|
);
|
|
1181
1187
|
};
|
|
1182
1188
|
var SelectElement2 = ({
|
|
1183
|
-
gridProps
|
|
1189
|
+
gridProps,
|
|
1184
1190
|
...props
|
|
1185
1191
|
}) => {
|
|
1186
1192
|
if (gridProps) {
|
|
@@ -1200,10 +1206,17 @@ var SelectElement_default = SelectElement2;
|
|
|
1200
1206
|
// src/wrappers/SelectMultiElement/SelectMultiElement.tsx
|
|
1201
1207
|
|
|
1202
1208
|
|
|
1209
|
+
var _Chip = require('@mui/material/Chip'); var _Chip2 = _interopRequireDefault(_Chip);
|
|
1203
1210
|
var _CheckBox = require('@mui/icons-material/CheckBox'); var _CheckBox2 = _interopRequireDefault(_CheckBox);
|
|
1204
1211
|
var _CheckBoxOutlineBlank = require('@mui/icons-material/CheckBoxOutlineBlank'); var _CheckBoxOutlineBlank2 = _interopRequireDefault(_CheckBoxOutlineBlank);
|
|
1205
1212
|
|
|
1206
1213
|
|
|
1214
|
+
|
|
1215
|
+
|
|
1216
|
+
|
|
1217
|
+
|
|
1218
|
+
|
|
1219
|
+
|
|
1207
1220
|
var Component9 = function SelectMultiElement(props) {
|
|
1208
1221
|
const {
|
|
1209
1222
|
name,
|
|
@@ -1218,6 +1231,7 @@ var Component9 = function SelectMultiElement(props) {
|
|
|
1218
1231
|
sx,
|
|
1219
1232
|
labelKey = "Label",
|
|
1220
1233
|
valueKey = "Value",
|
|
1234
|
+
multiple = true,
|
|
1221
1235
|
...rest
|
|
1222
1236
|
} = props;
|
|
1223
1237
|
const {
|
|
@@ -1235,13 +1249,19 @@ var Component9 = function SelectMultiElement(props) {
|
|
|
1235
1249
|
if (typeof option === "string") return option;
|
|
1236
1250
|
return option ? option[labelKey] : "";
|
|
1237
1251
|
};
|
|
1238
|
-
const selectedValue =
|
|
1239
|
-
const handleChange = (_2,
|
|
1240
|
-
if (
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
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);
|
|
1245
1265
|
}
|
|
1246
1266
|
};
|
|
1247
1267
|
const icon = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _CheckBoxOutlineBlank2.default, { fontSize: "small" });
|
|
@@ -1249,14 +1269,14 @@ var Component9 = function SelectMultiElement(props) {
|
|
|
1249
1269
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1250
1270
|
_material.Autocomplete,
|
|
1251
1271
|
{
|
|
1252
|
-
multiple
|
|
1272
|
+
multiple,
|
|
1253
1273
|
value: selectedValue,
|
|
1254
1274
|
loading,
|
|
1255
1275
|
options,
|
|
1256
|
-
getOptionLabel,
|
|
1276
|
+
getOptionLabel: (option) => getOptionLabel(option),
|
|
1257
1277
|
isOptionEqualToValue: (option, value) => getOptionValue(option) === getOptionValue(value),
|
|
1258
|
-
filterSelectedOptions:
|
|
1259
|
-
disableCloseOnSelect:
|
|
1278
|
+
filterSelectedOptions: multiple,
|
|
1279
|
+
disableCloseOnSelect: multiple,
|
|
1260
1280
|
ref: field.ref,
|
|
1261
1281
|
disabled: _nullishCoalesce(disabled, () => ( field.disabled)),
|
|
1262
1282
|
onChange: handleChange,
|
|
@@ -1267,13 +1287,26 @@ var Component9 = function SelectMultiElement(props) {
|
|
|
1267
1287
|
}
|
|
1268
1288
|
},
|
|
1269
1289
|
fullWidth: true,
|
|
1270
|
-
renderOption: (props1, option, { selected }) => {
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
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
|
+
)),
|
|
1277
1310
|
renderInput: (params) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1278
1311
|
_material.TextField,
|
|
1279
1312
|
{
|
|
@@ -1306,7 +1339,13 @@ var SelectMultiElement2 = ({
|
|
|
1306
1339
|
...props
|
|
1307
1340
|
}) => {
|
|
1308
1341
|
if (gridProps) {
|
|
1309
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
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
|
+
);
|
|
1310
1349
|
}
|
|
1311
1350
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component9, { ...props });
|
|
1312
1351
|
};
|
|
@@ -1339,6 +1378,7 @@ var Component10 = function SelectCascadeElement(props) {
|
|
|
1339
1378
|
placeholder,
|
|
1340
1379
|
label,
|
|
1341
1380
|
dependsOn,
|
|
1381
|
+
initialValue,
|
|
1342
1382
|
textFieldProps = {},
|
|
1343
1383
|
variant,
|
|
1344
1384
|
sx,
|
|
@@ -1348,9 +1388,16 @@ var Component10 = function SelectCascadeElement(props) {
|
|
|
1348
1388
|
const { required } = textFieldProps;
|
|
1349
1389
|
const getOptionKey = _react.useCallback.call(void 0,
|
|
1350
1390
|
(option) => {
|
|
1351
|
-
if (typeof option === "string" || typeof option === "number")
|
|
1391
|
+
if (typeof option === "string" || typeof option === "number")
|
|
1392
|
+
return option;
|
|
1352
1393
|
const key = option ? option[valueKey] : void 0;
|
|
1353
|
-
|
|
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);
|
|
1354
1401
|
},
|
|
1355
1402
|
[valueKey]
|
|
1356
1403
|
);
|
|
@@ -1367,7 +1414,8 @@ var Component10 = function SelectCascadeElement(props) {
|
|
|
1367
1414
|
fieldState: { error }
|
|
1368
1415
|
} = _reacthookform.useController.call(void 0, {
|
|
1369
1416
|
name,
|
|
1370
|
-
control
|
|
1417
|
+
control,
|
|
1418
|
+
defaultValue: initialValue
|
|
1371
1419
|
});
|
|
1372
1420
|
const theme = _material.useTheme.call(void 0, );
|
|
1373
1421
|
const { field: dependentField } = _reacthookform.useController.call(void 0, {
|
|
@@ -1377,45 +1425,48 @@ var Component10 = function SelectCascadeElement(props) {
|
|
|
1377
1425
|
const parentValueRef = _react.useRef.call(void 0, _nullishCoalesce(dependentField.value, () => ( null)));
|
|
1378
1426
|
const [hasAutoSelected, setHasAutoSelected] = _react.useState.call(void 0, false);
|
|
1379
1427
|
_react.useEffect.call(void 0, () => {
|
|
1380
|
-
if (
|
|
1428
|
+
if (parentValueRef.current !== dependentField.value) {
|
|
1429
|
+
parentValueRef.current = dependentField.value;
|
|
1381
1430
|
field.onChange(null);
|
|
1382
1431
|
setHasAutoSelected(false);
|
|
1383
1432
|
}
|
|
1384
|
-
}, [dependentField.value]);
|
|
1433
|
+
}, [dependentField.value, field]);
|
|
1385
1434
|
_react.useEffect.call(void 0, () => {
|
|
1386
|
-
if (
|
|
1387
|
-
|
|
1388
|
-
|
|
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
|
+
}
|
|
1389
1442
|
} else {
|
|
1390
|
-
if (options.length === 1 && field.value
|
|
1443
|
+
if (options.length === 1 && !field.value && !hasAutoSelected) {
|
|
1391
1444
|
field.onChange(getOptionKey(options[0]));
|
|
1392
1445
|
setHasAutoSelected(true);
|
|
1393
1446
|
}
|
|
1394
1447
|
}
|
|
1395
1448
|
}, [
|
|
1449
|
+
isEdit,
|
|
1396
1450
|
options,
|
|
1397
1451
|
field.value,
|
|
1398
|
-
|
|
1399
|
-
hasAutoSelected,
|
|
1400
|
-
isEdit,
|
|
1401
|
-
disabled,
|
|
1402
|
-
field,
|
|
1452
|
+
dependentField.value,
|
|
1403
1453
|
getOptionKey,
|
|
1404
|
-
|
|
1454
|
+
hasAutoSelected,
|
|
1455
|
+
field
|
|
1405
1456
|
]);
|
|
1457
|
+
const autocompleteValue = _nullishCoalesce(options.find((opt) => getOptionKey(opt) === field.value), () => ( null));
|
|
1406
1458
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1407
1459
|
_material.Autocomplete,
|
|
1408
1460
|
{
|
|
1409
1461
|
...rest,
|
|
1410
|
-
value:
|
|
1462
|
+
value: autocompleteValue,
|
|
1411
1463
|
size: "small",
|
|
1412
1464
|
loading,
|
|
1413
1465
|
options,
|
|
1414
|
-
getOptionKey,
|
|
1415
1466
|
getOptionLabel,
|
|
1416
1467
|
isOptionEqualToValue,
|
|
1417
1468
|
ref: field.ref,
|
|
1418
|
-
disabled: dependentField.value
|
|
1469
|
+
disabled: !dependentField.value || disabled,
|
|
1419
1470
|
onChange: (event, newValue, reason) => {
|
|
1420
1471
|
field.onChange(newValue ? getOptionKey(newValue) : null);
|
|
1421
1472
|
if (onChange && typeof onChange === "function") {
|
|
@@ -1428,7 +1479,6 @@ var Component10 = function SelectCascadeElement(props) {
|
|
|
1428
1479
|
onBlur(event);
|
|
1429
1480
|
}
|
|
1430
1481
|
},
|
|
1431
|
-
fullWidth: true,
|
|
1432
1482
|
renderInput: (params) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1433
1483
|
_material.TextField,
|
|
1434
1484
|
{
|
|
@@ -1439,14 +1489,14 @@ var Component10 = function SelectCascadeElement(props) {
|
|
|
1439
1489
|
helperText: error ? error.message : "",
|
|
1440
1490
|
placeholder,
|
|
1441
1491
|
label,
|
|
1442
|
-
variant: variant
|
|
1492
|
+
variant: _nullishCoalesce(variant, () => ( "outlined")),
|
|
1443
1493
|
sx: {
|
|
1444
1494
|
"& .MuiOutlinedInput-root": {
|
|
1445
|
-
bgcolor: disabled || dependentField.value
|
|
1495
|
+
bgcolor: disabled || !dependentField.value ? theme.palette.action.disabledBackground : "transparent"
|
|
1446
1496
|
},
|
|
1447
1497
|
"& .MuiInputLabel-asterisk": { color: "red" },
|
|
1448
1498
|
"& .MuiInputBase-input": {
|
|
1449
|
-
cursor: disabled || dependentField.value
|
|
1499
|
+
cursor: disabled || !dependentField.value ? "not-allowed" : "default"
|
|
1450
1500
|
},
|
|
1451
1501
|
...sx
|
|
1452
1502
|
}
|
|
@@ -1460,7 +1510,13 @@ var SelectCascadeElement2 = ({
|
|
|
1460
1510
|
...props
|
|
1461
1511
|
}) => {
|
|
1462
1512
|
if (gridProps) {
|
|
1463
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
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
|
+
);
|
|
1464
1520
|
}
|
|
1465
1521
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component10, { ...props });
|
|
1466
1522
|
};
|
|
@@ -1559,7 +1615,7 @@ var Component12 = function CheckboxGroup(props) {
|
|
|
1559
1615
|
disabled: rest.disabled
|
|
1560
1616
|
});
|
|
1561
1617
|
const [selectedValues, setSelectedValues] = _react.useState.call(void 0,
|
|
1562
|
-
options.filter((c) => _optionalChain([field, 'access',
|
|
1618
|
+
options.filter((c) => _optionalChain([field, 'access', _25 => _25.value, 'optionalAccess', _26 => _26.includes, 'call', _27 => _27(c.Value)])).map((c) => c.Value) || []
|
|
1563
1619
|
);
|
|
1564
1620
|
_react.useEffect.call(void 0, () => {
|
|
1565
1621
|
field.onChange(selectedValues ? [...selectedValues] : []);
|
|
@@ -1612,6 +1668,205 @@ var CheckboxGroup2 = ({
|
|
|
1612
1668
|
CheckboxGroup2.displayName = "CheckboxGroup";
|
|
1613
1669
|
var CheckboxGroup_default = CheckboxGroup2;
|
|
1614
1670
|
|
|
1671
|
+
// src/wrappers/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
|
+
|
|
1615
1870
|
// src/wrappers/Field/index.ts
|
|
1616
1871
|
var Field = {
|
|
1617
1872
|
Text: TextFieldElement_default,
|
|
@@ -1625,7 +1880,8 @@ var Field = {
|
|
|
1625
1880
|
SelectCascade: SelectCascadeElement_default,
|
|
1626
1881
|
AsyncSelect: AsyncSelectElement_default,
|
|
1627
1882
|
AsyncMultiSelect: AsyncMultiSelect_default,
|
|
1628
|
-
CheckboxGroup: CheckboxGroup_default
|
|
1883
|
+
CheckboxGroup: CheckboxGroup_default,
|
|
1884
|
+
SelectMultiCascadeElement: SelectMultiCascadeElement_default
|
|
1629
1885
|
};
|
|
1630
1886
|
var Field_default = Field;
|
|
1631
1887
|
|
|
@@ -1096,6 +1096,7 @@ var Component8 = function SelectElement(props) {
|
|
|
1096
1096
|
sx,
|
|
1097
1097
|
variant,
|
|
1098
1098
|
disabled,
|
|
1099
|
+
initialValue,
|
|
1099
1100
|
labelKey = "Label",
|
|
1100
1101
|
valueKey = "Value",
|
|
1101
1102
|
placeholder,
|
|
@@ -1108,7 +1109,8 @@ var Component8 = function SelectElement(props) {
|
|
|
1108
1109
|
fieldState: { error }
|
|
1109
1110
|
} = useController8({
|
|
1110
1111
|
name,
|
|
1111
|
-
control
|
|
1112
|
+
control,
|
|
1113
|
+
defaultValue: initialValue
|
|
1112
1114
|
});
|
|
1113
1115
|
const theme = useTheme6();
|
|
1114
1116
|
const getOptionValue = useCallback4(
|
|
@@ -1131,16 +1133,20 @@ var Component8 = function SelectElement(props) {
|
|
|
1131
1133
|
onChange?.(event, newValue, reason);
|
|
1132
1134
|
};
|
|
1133
1135
|
useEffect4(() => {
|
|
1134
|
-
if (!isEdit && options.length === 1 && (field.value == null || field.value
|
|
1136
|
+
if (!isEdit && options.length === 1 && (field.value == null || field.value === "")) {
|
|
1135
1137
|
const defaultOption = options[0];
|
|
1136
|
-
|
|
1137
|
-
field.onChange(defaultValue);
|
|
1138
|
+
field.onChange(getOptionValue(defaultOption));
|
|
1138
1139
|
}
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
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 = useMemo3(() => {
|
|
1147
|
+
if (!field.value) return null;
|
|
1148
|
+
return options.find((option) => getOptionValue(option) === field.value) ?? null;
|
|
1149
|
+
}, [field.value, options, getOptionValue]);
|
|
1144
1150
|
return /* @__PURE__ */ jsx8(
|
|
1145
1151
|
Autocomplete3,
|
|
1146
1152
|
{
|
|
@@ -1180,7 +1186,7 @@ var Component8 = function SelectElement(props) {
|
|
|
1180
1186
|
);
|
|
1181
1187
|
};
|
|
1182
1188
|
var SelectElement2 = ({
|
|
1183
|
-
gridProps
|
|
1189
|
+
gridProps,
|
|
1184
1190
|
...props
|
|
1185
1191
|
}) => {
|
|
1186
1192
|
if (gridProps) {
|
|
@@ -1200,9 +1206,16 @@ var SelectElement_default = SelectElement2;
|
|
|
1200
1206
|
// src/wrappers/SelectMultiElement/SelectMultiElement.tsx
|
|
1201
1207
|
import { Fragment as Fragment3 } from "react";
|
|
1202
1208
|
import { useController as useController9 } from "react-hook-form";
|
|
1209
|
+
import Chip from "@mui/material/Chip";
|
|
1203
1210
|
import CheckBoxIcon from "@mui/icons-material/CheckBox";
|
|
1204
1211
|
import CheckBoxOutlineBlankIcon from "@mui/icons-material/CheckBoxOutlineBlank";
|
|
1205
|
-
import {
|
|
1212
|
+
import {
|
|
1213
|
+
Grid2 as Grid29,
|
|
1214
|
+
Checkbox,
|
|
1215
|
+
TextField as TextField6,
|
|
1216
|
+
Autocomplete as Autocomplete4,
|
|
1217
|
+
CircularProgress as CircularProgress3
|
|
1218
|
+
} from "@mui/material";
|
|
1206
1219
|
import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1207
1220
|
var Component9 = function SelectMultiElement(props) {
|
|
1208
1221
|
const {
|
|
@@ -1218,6 +1231,7 @@ var Component9 = function SelectMultiElement(props) {
|
|
|
1218
1231
|
sx,
|
|
1219
1232
|
labelKey = "Label",
|
|
1220
1233
|
valueKey = "Value",
|
|
1234
|
+
multiple = true,
|
|
1221
1235
|
...rest
|
|
1222
1236
|
} = props;
|
|
1223
1237
|
const {
|
|
@@ -1235,13 +1249,19 @@ var Component9 = function SelectMultiElement(props) {
|
|
|
1235
1249
|
if (typeof option === "string") return option;
|
|
1236
1250
|
return option ? option[labelKey] : "";
|
|
1237
1251
|
};
|
|
1238
|
-
const selectedValue =
|
|
1239
|
-
const handleChange = (_2,
|
|
1240
|
-
if (
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1252
|
+
const selectedValue = multiple ? Array.isArray(field.value) ? options.filter((option) => field.value.includes(getOptionValue(option))) : [] : 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);
|
|
1245
1265
|
}
|
|
1246
1266
|
};
|
|
1247
1267
|
const icon = /* @__PURE__ */ jsx9(CheckBoxOutlineBlankIcon, { fontSize: "small" });
|
|
@@ -1249,14 +1269,14 @@ var Component9 = function SelectMultiElement(props) {
|
|
|
1249
1269
|
return /* @__PURE__ */ jsx9(
|
|
1250
1270
|
Autocomplete4,
|
|
1251
1271
|
{
|
|
1252
|
-
multiple
|
|
1272
|
+
multiple,
|
|
1253
1273
|
value: selectedValue,
|
|
1254
1274
|
loading,
|
|
1255
1275
|
options,
|
|
1256
|
-
getOptionLabel,
|
|
1276
|
+
getOptionLabel: (option) => getOptionLabel(option),
|
|
1257
1277
|
isOptionEqualToValue: (option, value) => getOptionValue(option) === getOptionValue(value),
|
|
1258
|
-
filterSelectedOptions:
|
|
1259
|
-
disableCloseOnSelect:
|
|
1278
|
+
filterSelectedOptions: multiple,
|
|
1279
|
+
disableCloseOnSelect: multiple,
|
|
1260
1280
|
ref: field.ref,
|
|
1261
1281
|
disabled: disabled ?? field.disabled,
|
|
1262
1282
|
onChange: handleChange,
|
|
@@ -1267,13 +1287,26 @@ var Component9 = function SelectMultiElement(props) {
|
|
|
1267
1287
|
}
|
|
1268
1288
|
},
|
|
1269
1289
|
fullWidth: true,
|
|
1270
|
-
renderOption: (props1, option, { selected }) => {
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1290
|
+
renderOption: (props1, option, { selected }) => multiple ? /* @__PURE__ */ jsxs4("li", { ...props1, children: [
|
|
1291
|
+
/* @__PURE__ */ jsx9(
|
|
1292
|
+
Checkbox,
|
|
1293
|
+
{
|
|
1294
|
+
icon,
|
|
1295
|
+
checkedIcon,
|
|
1296
|
+
checked: selected
|
|
1297
|
+
}
|
|
1298
|
+
),
|
|
1299
|
+
getOptionLabel(option)
|
|
1300
|
+
] }) : /* @__PURE__ */ jsx9("li", { ...props1, children: getOptionLabel(option) }),
|
|
1301
|
+
renderTags: (tagValue, getTagProps) => tagValue.map((option, index) => /* @__PURE__ */ jsx9(
|
|
1302
|
+
Chip,
|
|
1303
|
+
{
|
|
1304
|
+
...getTagProps({ index }),
|
|
1305
|
+
label: getOptionLabel(option),
|
|
1306
|
+
size: "small",
|
|
1307
|
+
variant: "filled"
|
|
1308
|
+
}
|
|
1309
|
+
)),
|
|
1277
1310
|
renderInput: (params) => /* @__PURE__ */ jsx9(
|
|
1278
1311
|
TextField6,
|
|
1279
1312
|
{
|
|
@@ -1306,7 +1339,13 @@ var SelectMultiElement2 = ({
|
|
|
1306
1339
|
...props
|
|
1307
1340
|
}) => {
|
|
1308
1341
|
if (gridProps) {
|
|
1309
|
-
return /* @__PURE__ */ jsx9(
|
|
1342
|
+
return /* @__PURE__ */ jsx9(
|
|
1343
|
+
Grid29,
|
|
1344
|
+
{
|
|
1345
|
+
...{ size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }, ...gridProps },
|
|
1346
|
+
children: /* @__PURE__ */ jsx9(Component9, { ...props })
|
|
1347
|
+
}
|
|
1348
|
+
);
|
|
1310
1349
|
}
|
|
1311
1350
|
return /* @__PURE__ */ jsx9(Component9, { ...props });
|
|
1312
1351
|
};
|
|
@@ -1339,6 +1378,7 @@ var Component10 = function SelectCascadeElement(props) {
|
|
|
1339
1378
|
placeholder,
|
|
1340
1379
|
label,
|
|
1341
1380
|
dependsOn,
|
|
1381
|
+
initialValue,
|
|
1342
1382
|
textFieldProps = {},
|
|
1343
1383
|
variant,
|
|
1344
1384
|
sx,
|
|
@@ -1348,9 +1388,16 @@ var Component10 = function SelectCascadeElement(props) {
|
|
|
1348
1388
|
const { required } = textFieldProps;
|
|
1349
1389
|
const getOptionKey = useCallback5(
|
|
1350
1390
|
(option) => {
|
|
1351
|
-
if (typeof option === "string" || typeof option === "number")
|
|
1391
|
+
if (typeof option === "string" || typeof option === "number")
|
|
1392
|
+
return option;
|
|
1352
1393
|
const key = option ? option[valueKey] : void 0;
|
|
1353
|
-
|
|
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);
|
|
1354
1401
|
},
|
|
1355
1402
|
[valueKey]
|
|
1356
1403
|
);
|
|
@@ -1367,7 +1414,8 @@ var Component10 = function SelectCascadeElement(props) {
|
|
|
1367
1414
|
fieldState: { error }
|
|
1368
1415
|
} = useController10({
|
|
1369
1416
|
name,
|
|
1370
|
-
control
|
|
1417
|
+
control,
|
|
1418
|
+
defaultValue: initialValue
|
|
1371
1419
|
});
|
|
1372
1420
|
const theme = useTheme7();
|
|
1373
1421
|
const { field: dependentField } = useController10({
|
|
@@ -1377,45 +1425,48 @@ var Component10 = function SelectCascadeElement(props) {
|
|
|
1377
1425
|
const parentValueRef = useRef3(dependentField.value ?? null);
|
|
1378
1426
|
const [hasAutoSelected, setHasAutoSelected] = useState4(false);
|
|
1379
1427
|
useEffect5(() => {
|
|
1380
|
-
if (
|
|
1428
|
+
if (parentValueRef.current !== dependentField.value) {
|
|
1429
|
+
parentValueRef.current = dependentField.value;
|
|
1381
1430
|
field.onChange(null);
|
|
1382
1431
|
setHasAutoSelected(false);
|
|
1383
1432
|
}
|
|
1384
|
-
}, [dependentField.value]);
|
|
1433
|
+
}, [dependentField.value, field]);
|
|
1385
1434
|
useEffect5(() => {
|
|
1386
|
-
if (
|
|
1387
|
-
|
|
1388
|
-
|
|
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
|
+
}
|
|
1389
1442
|
} else {
|
|
1390
|
-
if (options.length === 1 && field.value
|
|
1443
|
+
if (options.length === 1 && !field.value && !hasAutoSelected) {
|
|
1391
1444
|
field.onChange(getOptionKey(options[0]));
|
|
1392
1445
|
setHasAutoSelected(true);
|
|
1393
1446
|
}
|
|
1394
1447
|
}
|
|
1395
1448
|
}, [
|
|
1449
|
+
isEdit,
|
|
1396
1450
|
options,
|
|
1397
1451
|
field.value,
|
|
1398
|
-
|
|
1399
|
-
hasAutoSelected,
|
|
1400
|
-
isEdit,
|
|
1401
|
-
disabled,
|
|
1402
|
-
field,
|
|
1452
|
+
dependentField.value,
|
|
1403
1453
|
getOptionKey,
|
|
1404
|
-
|
|
1454
|
+
hasAutoSelected,
|
|
1455
|
+
field
|
|
1405
1456
|
]);
|
|
1457
|
+
const autocompleteValue = options.find((opt) => getOptionKey(opt) === field.value) ?? null;
|
|
1406
1458
|
return /* @__PURE__ */ jsx10(
|
|
1407
1459
|
Autocomplete5,
|
|
1408
1460
|
{
|
|
1409
1461
|
...rest,
|
|
1410
|
-
value:
|
|
1462
|
+
value: autocompleteValue,
|
|
1411
1463
|
size: "small",
|
|
1412
1464
|
loading,
|
|
1413
1465
|
options,
|
|
1414
|
-
getOptionKey,
|
|
1415
1466
|
getOptionLabel,
|
|
1416
1467
|
isOptionEqualToValue,
|
|
1417
1468
|
ref: field.ref,
|
|
1418
|
-
disabled: dependentField.value
|
|
1469
|
+
disabled: !dependentField.value || disabled,
|
|
1419
1470
|
onChange: (event, newValue, reason) => {
|
|
1420
1471
|
field.onChange(newValue ? getOptionKey(newValue) : null);
|
|
1421
1472
|
if (onChange && typeof onChange === "function") {
|
|
@@ -1428,7 +1479,6 @@ var Component10 = function SelectCascadeElement(props) {
|
|
|
1428
1479
|
onBlur(event);
|
|
1429
1480
|
}
|
|
1430
1481
|
},
|
|
1431
|
-
fullWidth: true,
|
|
1432
1482
|
renderInput: (params) => /* @__PURE__ */ jsx10(
|
|
1433
1483
|
TextField7,
|
|
1434
1484
|
{
|
|
@@ -1439,14 +1489,14 @@ var Component10 = function SelectCascadeElement(props) {
|
|
|
1439
1489
|
helperText: error ? error.message : "",
|
|
1440
1490
|
placeholder,
|
|
1441
1491
|
label,
|
|
1442
|
-
variant: variant
|
|
1492
|
+
variant: variant ?? "outlined",
|
|
1443
1493
|
sx: {
|
|
1444
1494
|
"& .MuiOutlinedInput-root": {
|
|
1445
|
-
bgcolor: disabled || dependentField.value
|
|
1495
|
+
bgcolor: disabled || !dependentField.value ? theme.palette.action.disabledBackground : "transparent"
|
|
1446
1496
|
},
|
|
1447
1497
|
"& .MuiInputLabel-asterisk": { color: "red" },
|
|
1448
1498
|
"& .MuiInputBase-input": {
|
|
1449
|
-
cursor: disabled || dependentField.value
|
|
1499
|
+
cursor: disabled || !dependentField.value ? "not-allowed" : "default"
|
|
1450
1500
|
},
|
|
1451
1501
|
...sx
|
|
1452
1502
|
}
|
|
@@ -1460,7 +1510,13 @@ var SelectCascadeElement2 = ({
|
|
|
1460
1510
|
...props
|
|
1461
1511
|
}) => {
|
|
1462
1512
|
if (gridProps) {
|
|
1463
|
-
return /* @__PURE__ */ jsx10(
|
|
1513
|
+
return /* @__PURE__ */ jsx10(
|
|
1514
|
+
Grid210,
|
|
1515
|
+
{
|
|
1516
|
+
...{ size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }, ...gridProps },
|
|
1517
|
+
children: /* @__PURE__ */ jsx10(Component10, { ...props })
|
|
1518
|
+
}
|
|
1519
|
+
);
|
|
1464
1520
|
}
|
|
1465
1521
|
return /* @__PURE__ */ jsx10(Component10, { ...props });
|
|
1466
1522
|
};
|
|
@@ -1612,6 +1668,205 @@ var CheckboxGroup2 = ({
|
|
|
1612
1668
|
CheckboxGroup2.displayName = "CheckboxGroup";
|
|
1613
1669
|
var CheckboxGroup_default = CheckboxGroup2;
|
|
1614
1670
|
|
|
1671
|
+
// src/wrappers/SelectMultiCascadeElement/SelectMultiCascadeElement.tsx
|
|
1672
|
+
import { useController as useController13 } from "react-hook-form";
|
|
1673
|
+
import { useRef as useRef4, Fragment as Fragment4, useState as useState6, useEffect as useEffect7, useCallback as useCallback6 } from "react";
|
|
1674
|
+
import CheckBoxIcon2 from "@mui/icons-material/CheckBox";
|
|
1675
|
+
import CheckBoxOutlineBlankIcon2 from "@mui/icons-material/CheckBoxOutlineBlank";
|
|
1676
|
+
import {
|
|
1677
|
+
Chip as Chip2,
|
|
1678
|
+
Grid2 as Grid213,
|
|
1679
|
+
Checkbox as Checkbox4,
|
|
1680
|
+
TextField as TextField8,
|
|
1681
|
+
Autocomplete as Autocomplete6,
|
|
1682
|
+
CircularProgress as CircularProgress4
|
|
1683
|
+
} from "@mui/material";
|
|
1684
|
+
import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
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
|
+
} = useController13({
|
|
1709
|
+
name,
|
|
1710
|
+
control,
|
|
1711
|
+
defaultValue: initialValue
|
|
1712
|
+
});
|
|
1713
|
+
const { field: dependentField } = useController13({
|
|
1714
|
+
name: dependsOn,
|
|
1715
|
+
control
|
|
1716
|
+
});
|
|
1717
|
+
const parentValueRef = useRef4(dependentField.value ?? null);
|
|
1718
|
+
const [hasAutoSelected, setHasAutoSelected] = useState6(false);
|
|
1719
|
+
const getOptionValue = useCallback6(
|
|
1720
|
+
(option) => {
|
|
1721
|
+
if (typeof option === "string") return option;
|
|
1722
|
+
return option ? option[valueKey] : null;
|
|
1723
|
+
},
|
|
1724
|
+
[valueKey]
|
|
1725
|
+
);
|
|
1726
|
+
const getOptionLabel = useCallback6(
|
|
1727
|
+
(option) => {
|
|
1728
|
+
if (typeof option === "string") return option;
|
|
1729
|
+
return option ? option[labelKey] : "";
|
|
1730
|
+
},
|
|
1731
|
+
[labelKey]
|
|
1732
|
+
);
|
|
1733
|
+
useEffect7(() => {
|
|
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
|
+
useEffect7(() => {
|
|
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))) : [] : 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__ */ jsx13(CheckBoxOutlineBlankIcon2, { fontSize: "small" });
|
|
1783
|
+
const checkedIcon = /* @__PURE__ */ jsx13(CheckBoxIcon2, { fontSize: "small" });
|
|
1784
|
+
return /* @__PURE__ */ jsx13(
|
|
1785
|
+
Autocomplete6,
|
|
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__ */ jsxs7("li", { ...props1, children: [
|
|
1806
|
+
/* @__PURE__ */ jsx13(
|
|
1807
|
+
Checkbox4,
|
|
1808
|
+
{
|
|
1809
|
+
icon,
|
|
1810
|
+
checkedIcon,
|
|
1811
|
+
checked: selected
|
|
1812
|
+
}
|
|
1813
|
+
),
|
|
1814
|
+
getOptionLabel(option)
|
|
1815
|
+
] }) : /* @__PURE__ */ jsx13("li", { ...props1, children: getOptionLabel(option) }),
|
|
1816
|
+
renderTags: (tagValue, getTagProps) => tagValue.map((option, index) => /* @__PURE__ */ jsx13(
|
|
1817
|
+
Chip2,
|
|
1818
|
+
{
|
|
1819
|
+
...getTagProps({ index }),
|
|
1820
|
+
label: getOptionLabel(option),
|
|
1821
|
+
size: "small",
|
|
1822
|
+
variant: "filled"
|
|
1823
|
+
}
|
|
1824
|
+
)),
|
|
1825
|
+
renderInput: (params) => /* @__PURE__ */ jsx13(
|
|
1826
|
+
TextField8,
|
|
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__ */ jsxs7(Fragment4, { children: [
|
|
1837
|
+
loading ? /* @__PURE__ */ jsx13(CircularProgress4, { 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__ */ jsx13(
|
|
1858
|
+
Grid213,
|
|
1859
|
+
{
|
|
1860
|
+
...{ size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }, ...gridProps },
|
|
1861
|
+
children: /* @__PURE__ */ jsx13(Component13, { ...props })
|
|
1862
|
+
}
|
|
1863
|
+
);
|
|
1864
|
+
}
|
|
1865
|
+
return /* @__PURE__ */ jsx13(Component13, { ...props });
|
|
1866
|
+
};
|
|
1867
|
+
SelectMultiCascadeElement2.displayName = "SelectMultiCascadeElement";
|
|
1868
|
+
var SelectMultiCascadeElement_default = SelectMultiCascadeElement2;
|
|
1869
|
+
|
|
1615
1870
|
// src/wrappers/Field/index.ts
|
|
1616
1871
|
var Field = {
|
|
1617
1872
|
Text: TextFieldElement_default,
|
|
@@ -1625,7 +1880,8 @@ var Field = {
|
|
|
1625
1880
|
SelectCascade: SelectCascadeElement_default,
|
|
1626
1881
|
AsyncSelect: AsyncSelectElement_default,
|
|
1627
1882
|
AsyncMultiSelect: AsyncMultiSelect_default,
|
|
1628
|
-
CheckboxGroup: CheckboxGroup_default
|
|
1883
|
+
CheckboxGroup: CheckboxGroup_default,
|
|
1884
|
+
SelectMultiCascadeElement: SelectMultiCascadeElement_default
|
|
1629
1885
|
};
|
|
1630
1886
|
var Field_default = Field;
|
|
1631
1887
|
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ require('./chunk-7M2VOCYN.js');
|
|
|
14
14
|
require('./chunk-6BGQA4BQ.js');
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _chunk22MN4IPUjs = require('./chunk-22MN4IPU.js');
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
var _chunk6NOXJGU2js = require('./chunk-6NOXJGU2.js');
|
|
@@ -55,4 +55,4 @@ var _chunkI7EIUZKKjs = require('./chunk-I7EIUZKK.js');
|
|
|
55
55
|
|
|
56
56
|
|
|
57
57
|
|
|
58
|
-
exports.AuthorizedView = _chunkJKUOV3MNjs.AuthorizedView_default; exports.CancelButton = _chunkJKUOV3MNjs.CancelButton_default; exports.ClearButton = _chunkJKUOV3MNjs.ClearButton_default; exports.Field =
|
|
58
|
+
exports.AuthorizedView = _chunkJKUOV3MNjs.AuthorizedView_default; exports.CancelButton = _chunkJKUOV3MNjs.CancelButton_default; exports.ClearButton = _chunkJKUOV3MNjs.ClearButton_default; exports.Field = _chunk22MN4IPUjs.Field_default; exports.Field2 = _chunk6NOXJGU2js.Field_default; exports.FilterButton = _chunkJKUOV3MNjs.FilterButton_default; exports.FilterWrapper = _chunkJKUOV3MNjs.FilterWrapper_default; exports.FormWrapper = _chunkJKUOV3MNjs.FormWrapper_default; exports.LabelText = _chunkJKUOV3MNjs.LabelText_default; exports.ListWrapper = _chunkJKUOV3MNjs.ListWrapper_default; exports.SimpleButton = _chunkJKUOV3MNjs.SimpleButton_default; exports.SimpleToolbar = _chunkJKUOV3MNjs.SimpleToolbar_default; exports.api = _chunkI7EIUZKKjs.api; exports.api2 = _chunkI7EIUZKKjs.api2; exports.flattenObjectKeys = _chunkI7EIUZKKjs.flattenObjectKeys; exports.getTimezone = _chunkI7EIUZKKjs.getTimezone; exports.handleServerErrors = _chunkI7EIUZKKjs.handleServerErrors; exports.propertyExists = _chunkI7EIUZKKjs.propertyExists; exports.readValueAsDate = _chunkI7EIUZKKjs.readValueAsDate; exports.removeLeadingTrailingSlashes = _chunkI7EIUZKKjs.removeLeadingTrailingSlashes; exports.schemaTools = _chunkI7EIUZKKjs.schemaTools; exports.useTransform = _chunk6JZ35VQJjs.useTransform;
|
package/dist/index.mjs
CHANGED
|
@@ -1,12 +1,30 @@
|
|
|
1
|
-
import { CheckboxProps, FormControlLabelProps, Grid2Props, ChipTypeMap, AutocompleteProps, TextFieldVariants, SxProps, TextFieldProps, IconButtonProps, FormLabelProps, RadioProps, TextField } from '@mui/material';
|
|
2
1
|
import * as react_hook_form from 'react-hook-form';
|
|
3
|
-
import { FieldValues, FieldPath, Control, Path,
|
|
2
|
+
import { FieldValues, FieldPath, UseControllerProps, Control, Path, FieldError, PathValue } from 'react-hook-form';
|
|
3
|
+
import { ChipTypeMap, AutocompleteProps, Grid2Props, TextFieldVariants, SxProps, CheckboxProps, FormControlLabelProps, TextFieldProps, IconButtonProps, FormLabelProps, RadioProps, TextField } from '@mui/material';
|
|
4
4
|
import { A as AsyncSelectPayload } from '../AsyncSelectPayload-Cz4bgak0.mjs';
|
|
5
5
|
import * as react from 'react';
|
|
6
6
|
import { ReactNode, ChangeEvent } from 'react';
|
|
7
7
|
import { TimePickerProps, TimePickerSlotProps, PickerChangeHandlerContext, TimeValidationError, PickerValidDate as PickerValidDate$1, DateValidationError, DatePickerSlotProps, DatePickerProps } from '@mui/x-date-pickers';
|
|
8
8
|
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
9
9
|
|
|
10
|
+
type BaseAutocompleteProps$1<TOption, Multiple extends boolean | undefined, DisableClearable extends boolean | undefined, FreeSolo extends boolean | undefined, ChipComponent extends React.ElementType> = Omit<AutocompleteProps<TOption, Multiple, DisableClearable, FreeSolo, ChipComponent>, "name" | "renderInput" | "onChange" | "value">;
|
|
11
|
+
type SelectMultiCascadeElementProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>, TOption extends Record<string, any> = Record<string, any>, Multiple extends boolean | undefined = true, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, ChipComponent extends React.ElementType = ChipTypeMap["defaultComponent"]> = BaseAutocompleteProps$1<TOption, Multiple, DisableClearable, FreeSolo, ChipComponent> & {
|
|
12
|
+
rules?: UseControllerProps<TFieldValues, TName>["rules"];
|
|
13
|
+
name: TName;
|
|
14
|
+
dependsOn: TName;
|
|
15
|
+
control?: Control<TFieldValues>;
|
|
16
|
+
gridProps?: Grid2Props;
|
|
17
|
+
placeholder?: string;
|
|
18
|
+
label?: string;
|
|
19
|
+
variant?: TextFieldVariants;
|
|
20
|
+
sx?: SxProps;
|
|
21
|
+
labelKey?: keyof TOption;
|
|
22
|
+
valueKey?: keyof TOption;
|
|
23
|
+
multiple?: Multiple;
|
|
24
|
+
isEdit?: boolean;
|
|
25
|
+
initialValue?: any;
|
|
26
|
+
};
|
|
27
|
+
|
|
10
28
|
type CheckboxGroupProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>, TValue extends number[] = number[]> = Omit<CheckboxProps, "name"> & {
|
|
11
29
|
name: TName;
|
|
12
30
|
control?: Control<TFieldValues>;
|
|
@@ -33,8 +51,8 @@ type AsyncSelectElementProps<TOption extends Record<string, any> = Record<string
|
|
|
33
51
|
valueKey?: string;
|
|
34
52
|
};
|
|
35
53
|
|
|
36
|
-
type SelectCascadeElementProps<TOption, TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>, Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, ChipComponent extends React.ElementType = ChipTypeMap[
|
|
37
|
-
rules?: UseControllerProps<TFieldValues, TName>[
|
|
54
|
+
type SelectCascadeElementProps<TOption, TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>, Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, ChipComponent extends React.ElementType = ChipTypeMap["defaultComponent"]> = Omit<AutocompleteProps<TOption, Multiple, DisableClearable, FreeSolo, ChipComponent>, "name" | "renderInput" | "isOptionEqualToValue" | "getOptionLabel" | "disabled"> & {
|
|
55
|
+
rules?: UseControllerProps<TFieldValues, TName>["rules"];
|
|
38
56
|
name: TName;
|
|
39
57
|
dependsOn: TName;
|
|
40
58
|
control?: Control<TFieldValues>;
|
|
@@ -45,14 +63,15 @@ type SelectCascadeElementProps<TOption, TFieldValues extends FieldValues = Field
|
|
|
45
63
|
disabled?: boolean;
|
|
46
64
|
sx?: SxProps;
|
|
47
65
|
isEdit?: boolean;
|
|
66
|
+
initialValue?: any;
|
|
48
67
|
labelKey?: keyof TOption;
|
|
49
68
|
valueKey?: keyof TOption;
|
|
50
|
-
textFieldProps?: Omit<TextFieldProps,
|
|
69
|
+
textFieldProps?: Omit<TextFieldProps, "name">;
|
|
51
70
|
};
|
|
52
71
|
|
|
53
|
-
type BaseAutocompleteProps<TOption, Multiple extends boolean | undefined, DisableClearable extends boolean | undefined, FreeSolo extends boolean | undefined, ChipComponent extends React.ElementType> = Omit<AutocompleteProps<TOption, Multiple, DisableClearable, FreeSolo, ChipComponent>,
|
|
54
|
-
type SelectMultiElementProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>, TOption extends Record<string, any> = Record<string, any>, Multiple extends boolean | undefined = true, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, ChipComponent extends React.ElementType = ChipTypeMap[
|
|
55
|
-
rules?: UseControllerProps<TFieldValues, TName>[
|
|
72
|
+
type BaseAutocompleteProps<TOption, Multiple extends boolean | undefined, DisableClearable extends boolean | undefined, FreeSolo extends boolean | undefined, ChipComponent extends React.ElementType> = Omit<AutocompleteProps<TOption, Multiple, DisableClearable, FreeSolo, ChipComponent>, "name" | "renderInput" | "onChange" | "value">;
|
|
73
|
+
type SelectMultiElementProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>, TOption extends Record<string, any> = Record<string, any>, Multiple extends boolean | undefined = true, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, ChipComponent extends React.ElementType = ChipTypeMap["defaultComponent"]> = BaseAutocompleteProps<TOption, Multiple, DisableClearable, FreeSolo, ChipComponent> & {
|
|
74
|
+
rules?: UseControllerProps<TFieldValues, TName>["rules"];
|
|
56
75
|
name: TName;
|
|
57
76
|
control?: Control<TFieldValues>;
|
|
58
77
|
gridProps?: Grid2Props;
|
|
@@ -62,6 +81,7 @@ type SelectMultiElementProps<TFieldValues extends FieldValues = FieldValues, TNa
|
|
|
62
81
|
sx?: SxProps;
|
|
63
82
|
labelKey?: keyof TOption;
|
|
64
83
|
valueKey?: keyof TOption;
|
|
84
|
+
multiple?: Multiple;
|
|
65
85
|
};
|
|
66
86
|
|
|
67
87
|
type SelectElementProps<TOption, TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>, Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, ChipComponent extends React.ElementType = ChipTypeMap["defaultComponent"]> = Omit<AutocompleteProps<TOption, Multiple, DisableClearable, FreeSolo, ChipComponent>, "name" | "renderInput" | "isOptionEqualToValue" | "getOptionLabel" | "disabled"> & {
|
|
@@ -75,6 +95,7 @@ type SelectElementProps<TOption, TFieldValues extends FieldValues = FieldValues,
|
|
|
75
95
|
sx?: SxProps;
|
|
76
96
|
isEdit?: boolean;
|
|
77
97
|
disabled?: boolean;
|
|
98
|
+
initialValue?: any;
|
|
78
99
|
labelKey?: string;
|
|
79
100
|
valueKey?: keyof TOption;
|
|
80
101
|
textFieldProps?: Omit<TextFieldProps, "name">;
|
|
@@ -196,6 +217,7 @@ declare const Field: {
|
|
|
196
217
|
AsyncSelect: <TOption extends Record<string, any> = Record<string, any>, TFieldValues extends react_hook_form.FieldValues = react_hook_form.FieldValues, TName extends react_hook_form.FieldPath<TFieldValues> = react_hook_form.Path<TFieldValues>, Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, ChipComponent extends React.ElementType = "div">(props: AsyncSelectElementProps<TOption, TFieldValues, TName, Multiple, DisableClearable, FreeSolo, ChipComponent>) => react.JSX.Element;
|
|
197
218
|
AsyncMultiSelect: any;
|
|
198
219
|
CheckboxGroup: <TFieldValues extends react_hook_form.FieldValues = react_hook_form.FieldValues, TName extends react_hook_form.FieldPath<TFieldValues> = react_hook_form.FieldPath<TFieldValues>, TValue extends number[] = number[]>(props: CheckboxGroupProps<TFieldValues, TName, TValue>) => JSX.Element;
|
|
220
|
+
SelectMultiCascadeElement: <TFieldValues extends react_hook_form.FieldValues = react_hook_form.FieldValues, TName extends react_hook_form.FieldPath<TFieldValues> = react_hook_form.FieldPath<TFieldValues>, TOption extends Record<string, any> = Record<string, any>, Multiple extends boolean | undefined = true, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, ChipComponent extends React.ElementType = "div">(props: SelectMultiCascadeElementProps<TFieldValues, TName, TOption, Multiple, DisableClearable, FreeSolo, ChipComponent>) => react.JSX.Element;
|
|
199
221
|
};
|
|
200
222
|
|
|
201
223
|
export { Field };
|
package/dist/wrappers/index.d.ts
CHANGED
|
@@ -1,12 +1,30 @@
|
|
|
1
|
-
import { CheckboxProps, FormControlLabelProps, Grid2Props, ChipTypeMap, AutocompleteProps, TextFieldVariants, SxProps, TextFieldProps, IconButtonProps, FormLabelProps, RadioProps, TextField } from '@mui/material';
|
|
2
1
|
import * as react_hook_form from 'react-hook-form';
|
|
3
|
-
import { FieldValues, FieldPath, Control, Path,
|
|
2
|
+
import { FieldValues, FieldPath, UseControllerProps, Control, Path, FieldError, PathValue } from 'react-hook-form';
|
|
3
|
+
import { ChipTypeMap, AutocompleteProps, Grid2Props, TextFieldVariants, SxProps, CheckboxProps, FormControlLabelProps, TextFieldProps, IconButtonProps, FormLabelProps, RadioProps, TextField } from '@mui/material';
|
|
4
4
|
import { A as AsyncSelectPayload } from '../AsyncSelectPayload-Cz4bgak0.js';
|
|
5
5
|
import * as react from 'react';
|
|
6
6
|
import { ReactNode, ChangeEvent } from 'react';
|
|
7
7
|
import { TimePickerProps, TimePickerSlotProps, PickerChangeHandlerContext, TimeValidationError, PickerValidDate as PickerValidDate$1, DateValidationError, DatePickerSlotProps, DatePickerProps } from '@mui/x-date-pickers';
|
|
8
8
|
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
9
9
|
|
|
10
|
+
type BaseAutocompleteProps$1<TOption, Multiple extends boolean | undefined, DisableClearable extends boolean | undefined, FreeSolo extends boolean | undefined, ChipComponent extends React.ElementType> = Omit<AutocompleteProps<TOption, Multiple, DisableClearable, FreeSolo, ChipComponent>, "name" | "renderInput" | "onChange" | "value">;
|
|
11
|
+
type SelectMultiCascadeElementProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>, TOption extends Record<string, any> = Record<string, any>, Multiple extends boolean | undefined = true, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, ChipComponent extends React.ElementType = ChipTypeMap["defaultComponent"]> = BaseAutocompleteProps$1<TOption, Multiple, DisableClearable, FreeSolo, ChipComponent> & {
|
|
12
|
+
rules?: UseControllerProps<TFieldValues, TName>["rules"];
|
|
13
|
+
name: TName;
|
|
14
|
+
dependsOn: TName;
|
|
15
|
+
control?: Control<TFieldValues>;
|
|
16
|
+
gridProps?: Grid2Props;
|
|
17
|
+
placeholder?: string;
|
|
18
|
+
label?: string;
|
|
19
|
+
variant?: TextFieldVariants;
|
|
20
|
+
sx?: SxProps;
|
|
21
|
+
labelKey?: keyof TOption;
|
|
22
|
+
valueKey?: keyof TOption;
|
|
23
|
+
multiple?: Multiple;
|
|
24
|
+
isEdit?: boolean;
|
|
25
|
+
initialValue?: any;
|
|
26
|
+
};
|
|
27
|
+
|
|
10
28
|
type CheckboxGroupProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>, TValue extends number[] = number[]> = Omit<CheckboxProps, "name"> & {
|
|
11
29
|
name: TName;
|
|
12
30
|
control?: Control<TFieldValues>;
|
|
@@ -33,8 +51,8 @@ type AsyncSelectElementProps<TOption extends Record<string, any> = Record<string
|
|
|
33
51
|
valueKey?: string;
|
|
34
52
|
};
|
|
35
53
|
|
|
36
|
-
type SelectCascadeElementProps<TOption, TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>, Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, ChipComponent extends React.ElementType = ChipTypeMap[
|
|
37
|
-
rules?: UseControllerProps<TFieldValues, TName>[
|
|
54
|
+
type SelectCascadeElementProps<TOption, TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>, Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, ChipComponent extends React.ElementType = ChipTypeMap["defaultComponent"]> = Omit<AutocompleteProps<TOption, Multiple, DisableClearable, FreeSolo, ChipComponent>, "name" | "renderInput" | "isOptionEqualToValue" | "getOptionLabel" | "disabled"> & {
|
|
55
|
+
rules?: UseControllerProps<TFieldValues, TName>["rules"];
|
|
38
56
|
name: TName;
|
|
39
57
|
dependsOn: TName;
|
|
40
58
|
control?: Control<TFieldValues>;
|
|
@@ -45,14 +63,15 @@ type SelectCascadeElementProps<TOption, TFieldValues extends FieldValues = Field
|
|
|
45
63
|
disabled?: boolean;
|
|
46
64
|
sx?: SxProps;
|
|
47
65
|
isEdit?: boolean;
|
|
66
|
+
initialValue?: any;
|
|
48
67
|
labelKey?: keyof TOption;
|
|
49
68
|
valueKey?: keyof TOption;
|
|
50
|
-
textFieldProps?: Omit<TextFieldProps,
|
|
69
|
+
textFieldProps?: Omit<TextFieldProps, "name">;
|
|
51
70
|
};
|
|
52
71
|
|
|
53
|
-
type BaseAutocompleteProps<TOption, Multiple extends boolean | undefined, DisableClearable extends boolean | undefined, FreeSolo extends boolean | undefined, ChipComponent extends React.ElementType> = Omit<AutocompleteProps<TOption, Multiple, DisableClearable, FreeSolo, ChipComponent>,
|
|
54
|
-
type SelectMultiElementProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>, TOption extends Record<string, any> = Record<string, any>, Multiple extends boolean | undefined = true, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, ChipComponent extends React.ElementType = ChipTypeMap[
|
|
55
|
-
rules?: UseControllerProps<TFieldValues, TName>[
|
|
72
|
+
type BaseAutocompleteProps<TOption, Multiple extends boolean | undefined, DisableClearable extends boolean | undefined, FreeSolo extends boolean | undefined, ChipComponent extends React.ElementType> = Omit<AutocompleteProps<TOption, Multiple, DisableClearable, FreeSolo, ChipComponent>, "name" | "renderInput" | "onChange" | "value">;
|
|
73
|
+
type SelectMultiElementProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>, TOption extends Record<string, any> = Record<string, any>, Multiple extends boolean | undefined = true, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, ChipComponent extends React.ElementType = ChipTypeMap["defaultComponent"]> = BaseAutocompleteProps<TOption, Multiple, DisableClearable, FreeSolo, ChipComponent> & {
|
|
74
|
+
rules?: UseControllerProps<TFieldValues, TName>["rules"];
|
|
56
75
|
name: TName;
|
|
57
76
|
control?: Control<TFieldValues>;
|
|
58
77
|
gridProps?: Grid2Props;
|
|
@@ -62,6 +81,7 @@ type SelectMultiElementProps<TFieldValues extends FieldValues = FieldValues, TNa
|
|
|
62
81
|
sx?: SxProps;
|
|
63
82
|
labelKey?: keyof TOption;
|
|
64
83
|
valueKey?: keyof TOption;
|
|
84
|
+
multiple?: Multiple;
|
|
65
85
|
};
|
|
66
86
|
|
|
67
87
|
type SelectElementProps<TOption, TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>, Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, ChipComponent extends React.ElementType = ChipTypeMap["defaultComponent"]> = Omit<AutocompleteProps<TOption, Multiple, DisableClearable, FreeSolo, ChipComponent>, "name" | "renderInput" | "isOptionEqualToValue" | "getOptionLabel" | "disabled"> & {
|
|
@@ -75,6 +95,7 @@ type SelectElementProps<TOption, TFieldValues extends FieldValues = FieldValues,
|
|
|
75
95
|
sx?: SxProps;
|
|
76
96
|
isEdit?: boolean;
|
|
77
97
|
disabled?: boolean;
|
|
98
|
+
initialValue?: any;
|
|
78
99
|
labelKey?: string;
|
|
79
100
|
valueKey?: keyof TOption;
|
|
80
101
|
textFieldProps?: Omit<TextFieldProps, "name">;
|
|
@@ -196,6 +217,7 @@ declare const Field: {
|
|
|
196
217
|
AsyncSelect: <TOption extends Record<string, any> = Record<string, any>, TFieldValues extends react_hook_form.FieldValues = react_hook_form.FieldValues, TName extends react_hook_form.FieldPath<TFieldValues> = react_hook_form.Path<TFieldValues>, Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, ChipComponent extends React.ElementType = "div">(props: AsyncSelectElementProps<TOption, TFieldValues, TName, Multiple, DisableClearable, FreeSolo, ChipComponent>) => react.JSX.Element;
|
|
197
218
|
AsyncMultiSelect: any;
|
|
198
219
|
CheckboxGroup: <TFieldValues extends react_hook_form.FieldValues = react_hook_form.FieldValues, TName extends react_hook_form.FieldPath<TFieldValues> = react_hook_form.FieldPath<TFieldValues>, TValue extends number[] = number[]>(props: CheckboxGroupProps<TFieldValues, TName, TValue>) => JSX.Element;
|
|
220
|
+
SelectMultiCascadeElement: <TFieldValues extends react_hook_form.FieldValues = react_hook_form.FieldValues, TName extends react_hook_form.FieldPath<TFieldValues> = react_hook_form.FieldPath<TFieldValues>, TOption extends Record<string, any> = Record<string, any>, Multiple extends boolean | undefined = true, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, ChipComponent extends React.ElementType = "div">(props: SelectMultiCascadeElementProps<TFieldValues, TName, TOption, Multiple, DisableClearable, FreeSolo, ChipComponent>) => react.JSX.Element;
|
|
199
221
|
};
|
|
200
222
|
|
|
201
223
|
export { Field };
|
package/dist/wrappers/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk22MN4IPUjs = require('../chunk-22MN4IPU.js');
|
|
4
4
|
require('../chunk-6JZ35VQJ.js');
|
|
5
5
|
require('../chunk-I7EIUZKK.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
exports.Field =
|
|
8
|
+
exports.Field = _chunk22MN4IPUjs.Field_default;
|
package/dist/wrappers/index.mjs
CHANGED