@gnwebsoft/ui 2.18.46 → 2.18.47
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-F6RJXISB.mjs → chunk-7HVI5RBL.mjs} +60 -88
- package/dist/{chunk-22MN4IPU.js → chunk-PTW4AAPV.js} +59 -87
- package/dist/index.js +3 -3
- package/dist/index.mjs +2 -2
- package/dist/wrappers/index.d.mts +1 -4
- package/dist/wrappers/index.d.ts +1 -4
- package/dist/wrappers/index.js +2 -2
- package/dist/wrappers/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -1096,7 +1096,6 @@ var Component8 = function SelectElement(props) {
|
|
|
1096
1096
|
sx,
|
|
1097
1097
|
variant,
|
|
1098
1098
|
disabled,
|
|
1099
|
-
initialValue,
|
|
1100
1099
|
labelKey = "Label",
|
|
1101
1100
|
valueKey = "Value",
|
|
1102
1101
|
placeholder,
|
|
@@ -1109,8 +1108,7 @@ var Component8 = function SelectElement(props) {
|
|
|
1109
1108
|
fieldState: { error }
|
|
1110
1109
|
} = useController8({
|
|
1111
1110
|
name,
|
|
1112
|
-
control
|
|
1113
|
-
defaultValue: initialValue
|
|
1111
|
+
control
|
|
1114
1112
|
});
|
|
1115
1113
|
const theme = useTheme6();
|
|
1116
1114
|
const getOptionValue = useCallback4(
|
|
@@ -1133,20 +1131,16 @@ var Component8 = function SelectElement(props) {
|
|
|
1133
1131
|
onChange?.(event, newValue, reason);
|
|
1134
1132
|
};
|
|
1135
1133
|
useEffect4(() => {
|
|
1136
|
-
if (!isEdit && options.length === 1 && (field.value == null || field.value === "")) {
|
|
1134
|
+
if (!isEdit && options.length === 1 && (field.value == null || field.value == void 0 || field.value === "")) {
|
|
1137
1135
|
const defaultOption = options[0];
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
if (isEdit) {
|
|
1141
|
-
if (field.value == null || field.value === "") {
|
|
1142
|
-
return;
|
|
1143
|
-
}
|
|
1136
|
+
const defaultValue = getOptionValue(defaultOption);
|
|
1137
|
+
field.onChange(defaultValue);
|
|
1144
1138
|
}
|
|
1145
|
-
}, [isEdit, options
|
|
1146
|
-
const autocompleteValue = useMemo3(
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1139
|
+
}, [isEdit, options]);
|
|
1140
|
+
const autocompleteValue = useMemo3(
|
|
1141
|
+
() => options.find((option) => getOptionValue(option) === field.value) ?? null,
|
|
1142
|
+
[field.value, options, getOptionValue]
|
|
1143
|
+
);
|
|
1150
1144
|
return /* @__PURE__ */ jsx8(
|
|
1151
1145
|
Autocomplete3,
|
|
1152
1146
|
{
|
|
@@ -1186,7 +1180,7 @@ var Component8 = function SelectElement(props) {
|
|
|
1186
1180
|
);
|
|
1187
1181
|
};
|
|
1188
1182
|
var SelectElement2 = ({
|
|
1189
|
-
gridProps,
|
|
1183
|
+
gridProps = { size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 } },
|
|
1190
1184
|
...props
|
|
1191
1185
|
}) => {
|
|
1192
1186
|
if (gridProps) {
|
|
@@ -1206,7 +1200,6 @@ var SelectElement_default = SelectElement2;
|
|
|
1206
1200
|
// src/wrappers/SelectMultiElement/SelectMultiElement.tsx
|
|
1207
1201
|
import { Fragment as Fragment3 } from "react";
|
|
1208
1202
|
import { useController as useController9 } from "react-hook-form";
|
|
1209
|
-
import Chip from "@mui/material/Chip";
|
|
1210
1203
|
import CheckBoxIcon from "@mui/icons-material/CheckBox";
|
|
1211
1204
|
import CheckBoxOutlineBlankIcon from "@mui/icons-material/CheckBoxOutlineBlank";
|
|
1212
1205
|
import {
|
|
@@ -1231,7 +1224,6 @@ var Component9 = function SelectMultiElement(props) {
|
|
|
1231
1224
|
sx,
|
|
1232
1225
|
labelKey = "Label",
|
|
1233
1226
|
valueKey = "Value",
|
|
1234
|
-
multiple = true,
|
|
1235
1227
|
...rest
|
|
1236
1228
|
} = props;
|
|
1237
1229
|
const {
|
|
@@ -1249,19 +1241,13 @@ var Component9 = function SelectMultiElement(props) {
|
|
|
1249
1241
|
if (typeof option === "string") return option;
|
|
1250
1242
|
return option ? option[labelKey] : "";
|
|
1251
1243
|
};
|
|
1252
|
-
const selectedValue =
|
|
1253
|
-
const handleChange = (_2,
|
|
1254
|
-
if (
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
(option) => getOptionValue(option)
|
|
1260
|
-
);
|
|
1261
|
-
field.onChange(newValues);
|
|
1262
|
-
}
|
|
1263
|
-
} else {
|
|
1264
|
-
field.onChange(selected ? getOptionValue(selected) : null);
|
|
1244
|
+
const selectedValue = field.value && Array.isArray(field.value) ? options.filter((option) => field.value.includes(getOptionValue(option))) : [];
|
|
1245
|
+
const handleChange = (_2, selectedOptions, reason) => {
|
|
1246
|
+
if (reason === "clear") {
|
|
1247
|
+
field.onChange([]);
|
|
1248
|
+
} else if (reason === "selectOption" || reason === "removeOption") {
|
|
1249
|
+
const newValues = selectedOptions.map((option) => getOptionValue(option));
|
|
1250
|
+
field.onChange(newValues);
|
|
1265
1251
|
}
|
|
1266
1252
|
};
|
|
1267
1253
|
const icon = /* @__PURE__ */ jsx9(CheckBoxOutlineBlankIcon, { fontSize: "small" });
|
|
@@ -1269,14 +1255,14 @@ var Component9 = function SelectMultiElement(props) {
|
|
|
1269
1255
|
return /* @__PURE__ */ jsx9(
|
|
1270
1256
|
Autocomplete4,
|
|
1271
1257
|
{
|
|
1272
|
-
multiple,
|
|
1258
|
+
multiple: true,
|
|
1273
1259
|
value: selectedValue,
|
|
1274
1260
|
loading,
|
|
1275
1261
|
options,
|
|
1276
|
-
getOptionLabel
|
|
1262
|
+
getOptionLabel,
|
|
1277
1263
|
isOptionEqualToValue: (option, value) => getOptionValue(option) === getOptionValue(value),
|
|
1278
|
-
filterSelectedOptions:
|
|
1279
|
-
disableCloseOnSelect:
|
|
1264
|
+
filterSelectedOptions: true,
|
|
1265
|
+
disableCloseOnSelect: true,
|
|
1280
1266
|
ref: field.ref,
|
|
1281
1267
|
disabled: disabled ?? field.disabled,
|
|
1282
1268
|
onChange: handleChange,
|
|
@@ -1287,26 +1273,20 @@ var Component9 = function SelectMultiElement(props) {
|
|
|
1287
1273
|
}
|
|
1288
1274
|
},
|
|
1289
1275
|
fullWidth: true,
|
|
1290
|
-
renderOption: (props1, option, { selected }) =>
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
...getTagProps({ index }),
|
|
1305
|
-
label: getOptionLabel(option),
|
|
1306
|
-
size: "small",
|
|
1307
|
-
variant: "filled"
|
|
1308
|
-
}
|
|
1309
|
-
)),
|
|
1276
|
+
renderOption: (props1, option, { selected }) => {
|
|
1277
|
+
const { key, ...optionProps } = props1;
|
|
1278
|
+
return /* @__PURE__ */ jsxs4("li", { ...optionProps, children: [
|
|
1279
|
+
/* @__PURE__ */ jsx9(
|
|
1280
|
+
Checkbox,
|
|
1281
|
+
{
|
|
1282
|
+
icon,
|
|
1283
|
+
checkedIcon,
|
|
1284
|
+
checked: selected
|
|
1285
|
+
}
|
|
1286
|
+
),
|
|
1287
|
+
getOptionLabel(option)
|
|
1288
|
+
] }, key);
|
|
1289
|
+
},
|
|
1310
1290
|
renderInput: (params) => /* @__PURE__ */ jsx9(
|
|
1311
1291
|
TextField6,
|
|
1312
1292
|
{
|
|
@@ -1378,7 +1358,6 @@ var Component10 = function SelectCascadeElement(props) {
|
|
|
1378
1358
|
placeholder,
|
|
1379
1359
|
label,
|
|
1380
1360
|
dependsOn,
|
|
1381
|
-
initialValue,
|
|
1382
1361
|
textFieldProps = {},
|
|
1383
1362
|
variant,
|
|
1384
1363
|
sx,
|
|
@@ -1391,13 +1370,7 @@ var Component10 = function SelectCascadeElement(props) {
|
|
|
1391
1370
|
if (typeof option === "string" || typeof option === "number")
|
|
1392
1371
|
return option;
|
|
1393
1372
|
const key = option ? option[valueKey] : void 0;
|
|
1394
|
-
|
|
1395
|
-
return "";
|
|
1396
|
-
}
|
|
1397
|
-
if (typeof key === "string" || typeof key === "number") {
|
|
1398
|
-
return key;
|
|
1399
|
-
}
|
|
1400
|
-
return String(key);
|
|
1373
|
+
return key !== void 0 && key !== null ? String(key) : "";
|
|
1401
1374
|
},
|
|
1402
1375
|
[valueKey]
|
|
1403
1376
|
);
|
|
@@ -1414,8 +1387,7 @@ var Component10 = function SelectCascadeElement(props) {
|
|
|
1414
1387
|
fieldState: { error }
|
|
1415
1388
|
} = useController10({
|
|
1416
1389
|
name,
|
|
1417
|
-
control
|
|
1418
|
-
defaultValue: initialValue
|
|
1390
|
+
control
|
|
1419
1391
|
});
|
|
1420
1392
|
const theme = useTheme7();
|
|
1421
1393
|
const { field: dependentField } = useController10({
|
|
@@ -1425,48 +1397,47 @@ var Component10 = function SelectCascadeElement(props) {
|
|
|
1425
1397
|
const parentValueRef = useRef3(dependentField.value ?? null);
|
|
1426
1398
|
const [hasAutoSelected, setHasAutoSelected] = useState4(false);
|
|
1427
1399
|
useEffect5(() => {
|
|
1428
|
-
if (parentValueRef
|
|
1429
|
-
parentValueRef.current = dependentField.value;
|
|
1400
|
+
if (!!dependentField.value && parentValueRef?.current !== dependentField.value || dependentField.value === null) {
|
|
1430
1401
|
field.onChange(null);
|
|
1431
1402
|
setHasAutoSelected(false);
|
|
1432
1403
|
}
|
|
1433
|
-
}, [dependentField.value
|
|
1404
|
+
}, [dependentField.value]);
|
|
1434
1405
|
useEffect5(() => {
|
|
1435
|
-
if (!
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
if (options.length === 1 && !hasAutoSelected) {
|
|
1439
|
-
field.onChange(getOptionKey(options[0]));
|
|
1440
|
-
setHasAutoSelected(true);
|
|
1441
|
-
}
|
|
1406
|
+
if (isEdit && !disabled && options.length === 1 && field.value == null && !hasAutoSelected) {
|
|
1407
|
+
field.onChange(getOptionKey(options[0]));
|
|
1408
|
+
setHasAutoSelected(true);
|
|
1442
1409
|
} else {
|
|
1443
|
-
if (options.length === 1 &&
|
|
1410
|
+
if (options.length === 1 && field.value == null && !hasAutoSelected) {
|
|
1444
1411
|
field.onChange(getOptionKey(options[0]));
|
|
1445
1412
|
setHasAutoSelected(true);
|
|
1446
1413
|
}
|
|
1447
1414
|
}
|
|
1448
1415
|
}, [
|
|
1449
|
-
isEdit,
|
|
1450
1416
|
options,
|
|
1451
1417
|
field.value,
|
|
1452
|
-
|
|
1453
|
-
getOptionKey,
|
|
1418
|
+
field.onChange,
|
|
1454
1419
|
hasAutoSelected,
|
|
1455
|
-
|
|
1420
|
+
isEdit,
|
|
1421
|
+
disabled,
|
|
1422
|
+
field,
|
|
1423
|
+
getOptionKey,
|
|
1424
|
+
dependentField.onChange
|
|
1456
1425
|
]);
|
|
1457
|
-
const autocompleteValue = options.find((opt) => getOptionKey(opt) === field.value) ?? null;
|
|
1458
1426
|
return /* @__PURE__ */ jsx10(
|
|
1459
1427
|
Autocomplete5,
|
|
1460
1428
|
{
|
|
1461
1429
|
...rest,
|
|
1462
|
-
value:
|
|
1430
|
+
value: options.map(
|
|
1431
|
+
(option) => getOptionKey(option) === field.value ? option : null
|
|
1432
|
+
).find(Boolean) || null,
|
|
1463
1433
|
size: "small",
|
|
1464
1434
|
loading,
|
|
1465
1435
|
options,
|
|
1436
|
+
getOptionKey,
|
|
1466
1437
|
getOptionLabel,
|
|
1467
1438
|
isOptionEqualToValue,
|
|
1468
1439
|
ref: field.ref,
|
|
1469
|
-
disabled:
|
|
1440
|
+
disabled: dependentField.value == null || disabled,
|
|
1470
1441
|
onChange: (event, newValue, reason) => {
|
|
1471
1442
|
field.onChange(newValue ? getOptionKey(newValue) : null);
|
|
1472
1443
|
if (onChange && typeof onChange === "function") {
|
|
@@ -1479,6 +1450,7 @@ var Component10 = function SelectCascadeElement(props) {
|
|
|
1479
1450
|
onBlur(event);
|
|
1480
1451
|
}
|
|
1481
1452
|
},
|
|
1453
|
+
fullWidth: true,
|
|
1482
1454
|
renderInput: (params) => /* @__PURE__ */ jsx10(
|
|
1483
1455
|
TextField7,
|
|
1484
1456
|
{
|
|
@@ -1489,14 +1461,14 @@ var Component10 = function SelectCascadeElement(props) {
|
|
|
1489
1461
|
helperText: error ? error.message : "",
|
|
1490
1462
|
placeholder,
|
|
1491
1463
|
label,
|
|
1492
|
-
variant: variant
|
|
1464
|
+
variant: variant ? variant : "outlined",
|
|
1493
1465
|
sx: {
|
|
1494
1466
|
"& .MuiOutlinedInput-root": {
|
|
1495
|
-
bgcolor: disabled ||
|
|
1467
|
+
bgcolor: disabled || dependentField.value == null ? theme.palette.action.disabledBackground : "transparent"
|
|
1496
1468
|
},
|
|
1497
1469
|
"& .MuiInputLabel-asterisk": { color: "red" },
|
|
1498
1470
|
"& .MuiInputBase-input": {
|
|
1499
|
-
cursor: disabled ||
|
|
1471
|
+
cursor: disabled || dependentField.value == null ? "not-allowed" : "default"
|
|
1500
1472
|
},
|
|
1501
1473
|
...sx
|
|
1502
1474
|
}
|
|
@@ -1674,7 +1646,7 @@ import { useRef as useRef4, Fragment as Fragment4, useState as useState6, useEff
|
|
|
1674
1646
|
import CheckBoxIcon2 from "@mui/icons-material/CheckBox";
|
|
1675
1647
|
import CheckBoxOutlineBlankIcon2 from "@mui/icons-material/CheckBoxOutlineBlank";
|
|
1676
1648
|
import {
|
|
1677
|
-
Chip
|
|
1649
|
+
Chip,
|
|
1678
1650
|
Grid2 as Grid213,
|
|
1679
1651
|
Checkbox as Checkbox4,
|
|
1680
1652
|
TextField as TextField8,
|
|
@@ -1814,7 +1786,7 @@ var Component13 = function SelectMultiCascadeElement(props) {
|
|
|
1814
1786
|
getOptionLabel(option)
|
|
1815
1787
|
] }) : /* @__PURE__ */ jsx13("li", { ...props1, children: getOptionLabel(option) }),
|
|
1816
1788
|
renderTags: (tagValue, getTagProps) => tagValue.map((option, index) => /* @__PURE__ */ jsx13(
|
|
1817
|
-
|
|
1789
|
+
Chip,
|
|
1818
1790
|
{
|
|
1819
1791
|
...getTagProps({ index }),
|
|
1820
1792
|
label: getOptionLabel(option),
|
|
@@ -1096,7 +1096,6 @@ var Component8 = function SelectElement(props) {
|
|
|
1096
1096
|
sx,
|
|
1097
1097
|
variant,
|
|
1098
1098
|
disabled,
|
|
1099
|
-
initialValue,
|
|
1100
1099
|
labelKey = "Label",
|
|
1101
1100
|
valueKey = "Value",
|
|
1102
1101
|
placeholder,
|
|
@@ -1109,8 +1108,7 @@ var Component8 = function SelectElement(props) {
|
|
|
1109
1108
|
fieldState: { error }
|
|
1110
1109
|
} = _reacthookform.useController.call(void 0, {
|
|
1111
1110
|
name,
|
|
1112
|
-
control
|
|
1113
|
-
defaultValue: initialValue
|
|
1111
|
+
control
|
|
1114
1112
|
});
|
|
1115
1113
|
const theme = _material.useTheme.call(void 0, );
|
|
1116
1114
|
const getOptionValue = _react.useCallback.call(void 0,
|
|
@@ -1133,20 +1131,16 @@ var Component8 = function SelectElement(props) {
|
|
|
1133
1131
|
_optionalChain([onChange, 'optionalCall', _24 => _24(event, newValue, reason)]);
|
|
1134
1132
|
};
|
|
1135
1133
|
_react.useEffect.call(void 0, () => {
|
|
1136
|
-
if (!isEdit && options.length === 1 && (field.value == null || field.value === "")) {
|
|
1134
|
+
if (!isEdit && options.length === 1 && (field.value == null || field.value == void 0 || field.value === "")) {
|
|
1137
1135
|
const defaultOption = options[0];
|
|
1138
|
-
|
|
1136
|
+
const defaultValue = getOptionValue(defaultOption);
|
|
1137
|
+
field.onChange(defaultValue);
|
|
1139
1138
|
}
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
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]);
|
|
1139
|
+
}, [isEdit, options]);
|
|
1140
|
+
const autocompleteValue = _react.useMemo.call(void 0,
|
|
1141
|
+
() => _nullishCoalesce(options.find((option) => getOptionValue(option) === field.value), () => ( null)),
|
|
1142
|
+
[field.value, options, getOptionValue]
|
|
1143
|
+
);
|
|
1150
1144
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1151
1145
|
_material.Autocomplete,
|
|
1152
1146
|
{
|
|
@@ -1186,7 +1180,7 @@ var Component8 = function SelectElement(props) {
|
|
|
1186
1180
|
);
|
|
1187
1181
|
};
|
|
1188
1182
|
var SelectElement2 = ({
|
|
1189
|
-
gridProps,
|
|
1183
|
+
gridProps = { size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 } },
|
|
1190
1184
|
...props
|
|
1191
1185
|
}) => {
|
|
1192
1186
|
if (gridProps) {
|
|
@@ -1206,7 +1200,6 @@ var SelectElement_default = SelectElement2;
|
|
|
1206
1200
|
// src/wrappers/SelectMultiElement/SelectMultiElement.tsx
|
|
1207
1201
|
|
|
1208
1202
|
|
|
1209
|
-
var _Chip = require('@mui/material/Chip'); var _Chip2 = _interopRequireDefault(_Chip);
|
|
1210
1203
|
var _CheckBox = require('@mui/icons-material/CheckBox'); var _CheckBox2 = _interopRequireDefault(_CheckBox);
|
|
1211
1204
|
var _CheckBoxOutlineBlank = require('@mui/icons-material/CheckBoxOutlineBlank'); var _CheckBoxOutlineBlank2 = _interopRequireDefault(_CheckBoxOutlineBlank);
|
|
1212
1205
|
|
|
@@ -1231,7 +1224,6 @@ var Component9 = function SelectMultiElement(props) {
|
|
|
1231
1224
|
sx,
|
|
1232
1225
|
labelKey = "Label",
|
|
1233
1226
|
valueKey = "Value",
|
|
1234
|
-
multiple = true,
|
|
1235
1227
|
...rest
|
|
1236
1228
|
} = props;
|
|
1237
1229
|
const {
|
|
@@ -1249,19 +1241,13 @@ var Component9 = function SelectMultiElement(props) {
|
|
|
1249
1241
|
if (typeof option === "string") return option;
|
|
1250
1242
|
return option ? option[labelKey] : "";
|
|
1251
1243
|
};
|
|
1252
|
-
const selectedValue =
|
|
1253
|
-
const handleChange = (_2,
|
|
1254
|
-
if (
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
(option) => getOptionValue(option)
|
|
1260
|
-
);
|
|
1261
|
-
field.onChange(newValues);
|
|
1262
|
-
}
|
|
1263
|
-
} else {
|
|
1264
|
-
field.onChange(selected ? getOptionValue(selected) : null);
|
|
1244
|
+
const selectedValue = field.value && Array.isArray(field.value) ? options.filter((option) => field.value.includes(getOptionValue(option))) : [];
|
|
1245
|
+
const handleChange = (_2, selectedOptions, reason) => {
|
|
1246
|
+
if (reason === "clear") {
|
|
1247
|
+
field.onChange([]);
|
|
1248
|
+
} else if (reason === "selectOption" || reason === "removeOption") {
|
|
1249
|
+
const newValues = selectedOptions.map((option) => getOptionValue(option));
|
|
1250
|
+
field.onChange(newValues);
|
|
1265
1251
|
}
|
|
1266
1252
|
};
|
|
1267
1253
|
const icon = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _CheckBoxOutlineBlank2.default, { fontSize: "small" });
|
|
@@ -1269,14 +1255,14 @@ var Component9 = function SelectMultiElement(props) {
|
|
|
1269
1255
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1270
1256
|
_material.Autocomplete,
|
|
1271
1257
|
{
|
|
1272
|
-
multiple,
|
|
1258
|
+
multiple: true,
|
|
1273
1259
|
value: selectedValue,
|
|
1274
1260
|
loading,
|
|
1275
1261
|
options,
|
|
1276
|
-
getOptionLabel
|
|
1262
|
+
getOptionLabel,
|
|
1277
1263
|
isOptionEqualToValue: (option, value) => getOptionValue(option) === getOptionValue(value),
|
|
1278
|
-
filterSelectedOptions:
|
|
1279
|
-
disableCloseOnSelect:
|
|
1264
|
+
filterSelectedOptions: true,
|
|
1265
|
+
disableCloseOnSelect: true,
|
|
1280
1266
|
ref: field.ref,
|
|
1281
1267
|
disabled: _nullishCoalesce(disabled, () => ( field.disabled)),
|
|
1282
1268
|
onChange: handleChange,
|
|
@@ -1287,26 +1273,20 @@ var Component9 = function SelectMultiElement(props) {
|
|
|
1287
1273
|
}
|
|
1288
1274
|
},
|
|
1289
1275
|
fullWidth: true,
|
|
1290
|
-
renderOption: (props1, option, { selected }) =>
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
...getTagProps({ index }),
|
|
1305
|
-
label: getOptionLabel(option),
|
|
1306
|
-
size: "small",
|
|
1307
|
-
variant: "filled"
|
|
1308
|
-
}
|
|
1309
|
-
)),
|
|
1276
|
+
renderOption: (props1, option, { selected }) => {
|
|
1277
|
+
const { key, ...optionProps } = props1;
|
|
1278
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "li", { ...optionProps, children: [
|
|
1279
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1280
|
+
_material.Checkbox,
|
|
1281
|
+
{
|
|
1282
|
+
icon,
|
|
1283
|
+
checkedIcon,
|
|
1284
|
+
checked: selected
|
|
1285
|
+
}
|
|
1286
|
+
),
|
|
1287
|
+
getOptionLabel(option)
|
|
1288
|
+
] }, key);
|
|
1289
|
+
},
|
|
1310
1290
|
renderInput: (params) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1311
1291
|
_material.TextField,
|
|
1312
1292
|
{
|
|
@@ -1378,7 +1358,6 @@ var Component10 = function SelectCascadeElement(props) {
|
|
|
1378
1358
|
placeholder,
|
|
1379
1359
|
label,
|
|
1380
1360
|
dependsOn,
|
|
1381
|
-
initialValue,
|
|
1382
1361
|
textFieldProps = {},
|
|
1383
1362
|
variant,
|
|
1384
1363
|
sx,
|
|
@@ -1391,13 +1370,7 @@ var Component10 = function SelectCascadeElement(props) {
|
|
|
1391
1370
|
if (typeof option === "string" || typeof option === "number")
|
|
1392
1371
|
return option;
|
|
1393
1372
|
const key = option ? option[valueKey] : void 0;
|
|
1394
|
-
|
|
1395
|
-
return "";
|
|
1396
|
-
}
|
|
1397
|
-
if (typeof key === "string" || typeof key === "number") {
|
|
1398
|
-
return key;
|
|
1399
|
-
}
|
|
1400
|
-
return String(key);
|
|
1373
|
+
return key !== void 0 && key !== null ? String(key) : "";
|
|
1401
1374
|
},
|
|
1402
1375
|
[valueKey]
|
|
1403
1376
|
);
|
|
@@ -1414,8 +1387,7 @@ var Component10 = function SelectCascadeElement(props) {
|
|
|
1414
1387
|
fieldState: { error }
|
|
1415
1388
|
} = _reacthookform.useController.call(void 0, {
|
|
1416
1389
|
name,
|
|
1417
|
-
control
|
|
1418
|
-
defaultValue: initialValue
|
|
1390
|
+
control
|
|
1419
1391
|
});
|
|
1420
1392
|
const theme = _material.useTheme.call(void 0, );
|
|
1421
1393
|
const { field: dependentField } = _reacthookform.useController.call(void 0, {
|
|
@@ -1425,48 +1397,47 @@ var Component10 = function SelectCascadeElement(props) {
|
|
|
1425
1397
|
const parentValueRef = _react.useRef.call(void 0, _nullishCoalesce(dependentField.value, () => ( null)));
|
|
1426
1398
|
const [hasAutoSelected, setHasAutoSelected] = _react.useState.call(void 0, false);
|
|
1427
1399
|
_react.useEffect.call(void 0, () => {
|
|
1428
|
-
if (parentValueRef.current !== dependentField.value) {
|
|
1429
|
-
parentValueRef.current = dependentField.value;
|
|
1400
|
+
if (!!dependentField.value && _optionalChain([parentValueRef, 'optionalAccess', _25 => _25.current]) !== dependentField.value || dependentField.value === null) {
|
|
1430
1401
|
field.onChange(null);
|
|
1431
1402
|
setHasAutoSelected(false);
|
|
1432
1403
|
}
|
|
1433
|
-
}, [dependentField.value
|
|
1404
|
+
}, [dependentField.value]);
|
|
1434
1405
|
_react.useEffect.call(void 0, () => {
|
|
1435
|
-
if (!
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
if (options.length === 1 && !hasAutoSelected) {
|
|
1439
|
-
field.onChange(getOptionKey(options[0]));
|
|
1440
|
-
setHasAutoSelected(true);
|
|
1441
|
-
}
|
|
1406
|
+
if (isEdit && !disabled && options.length === 1 && field.value == null && !hasAutoSelected) {
|
|
1407
|
+
field.onChange(getOptionKey(options[0]));
|
|
1408
|
+
setHasAutoSelected(true);
|
|
1442
1409
|
} else {
|
|
1443
|
-
if (options.length === 1 &&
|
|
1410
|
+
if (options.length === 1 && field.value == null && !hasAutoSelected) {
|
|
1444
1411
|
field.onChange(getOptionKey(options[0]));
|
|
1445
1412
|
setHasAutoSelected(true);
|
|
1446
1413
|
}
|
|
1447
1414
|
}
|
|
1448
1415
|
}, [
|
|
1449
|
-
isEdit,
|
|
1450
1416
|
options,
|
|
1451
1417
|
field.value,
|
|
1452
|
-
|
|
1453
|
-
getOptionKey,
|
|
1418
|
+
field.onChange,
|
|
1454
1419
|
hasAutoSelected,
|
|
1455
|
-
|
|
1420
|
+
isEdit,
|
|
1421
|
+
disabled,
|
|
1422
|
+
field,
|
|
1423
|
+
getOptionKey,
|
|
1424
|
+
dependentField.onChange
|
|
1456
1425
|
]);
|
|
1457
|
-
const autocompleteValue = _nullishCoalesce(options.find((opt) => getOptionKey(opt) === field.value), () => ( null));
|
|
1458
1426
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1459
1427
|
_material.Autocomplete,
|
|
1460
1428
|
{
|
|
1461
1429
|
...rest,
|
|
1462
|
-
value:
|
|
1430
|
+
value: options.map(
|
|
1431
|
+
(option) => getOptionKey(option) === field.value ? option : null
|
|
1432
|
+
).find(Boolean) || null,
|
|
1463
1433
|
size: "small",
|
|
1464
1434
|
loading,
|
|
1465
1435
|
options,
|
|
1436
|
+
getOptionKey,
|
|
1466
1437
|
getOptionLabel,
|
|
1467
1438
|
isOptionEqualToValue,
|
|
1468
1439
|
ref: field.ref,
|
|
1469
|
-
disabled:
|
|
1440
|
+
disabled: dependentField.value == null || disabled,
|
|
1470
1441
|
onChange: (event, newValue, reason) => {
|
|
1471
1442
|
field.onChange(newValue ? getOptionKey(newValue) : null);
|
|
1472
1443
|
if (onChange && typeof onChange === "function") {
|
|
@@ -1479,6 +1450,7 @@ var Component10 = function SelectCascadeElement(props) {
|
|
|
1479
1450
|
onBlur(event);
|
|
1480
1451
|
}
|
|
1481
1452
|
},
|
|
1453
|
+
fullWidth: true,
|
|
1482
1454
|
renderInput: (params) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1483
1455
|
_material.TextField,
|
|
1484
1456
|
{
|
|
@@ -1489,14 +1461,14 @@ var Component10 = function SelectCascadeElement(props) {
|
|
|
1489
1461
|
helperText: error ? error.message : "",
|
|
1490
1462
|
placeholder,
|
|
1491
1463
|
label,
|
|
1492
|
-
variant:
|
|
1464
|
+
variant: variant ? variant : "outlined",
|
|
1493
1465
|
sx: {
|
|
1494
1466
|
"& .MuiOutlinedInput-root": {
|
|
1495
|
-
bgcolor: disabled ||
|
|
1467
|
+
bgcolor: disabled || dependentField.value == null ? theme.palette.action.disabledBackground : "transparent"
|
|
1496
1468
|
},
|
|
1497
1469
|
"& .MuiInputLabel-asterisk": { color: "red" },
|
|
1498
1470
|
"& .MuiInputBase-input": {
|
|
1499
|
-
cursor: disabled ||
|
|
1471
|
+
cursor: disabled || dependentField.value == null ? "not-allowed" : "default"
|
|
1500
1472
|
},
|
|
1501
1473
|
...sx
|
|
1502
1474
|
}
|
|
@@ -1615,7 +1587,7 @@ var Component12 = function CheckboxGroup(props) {
|
|
|
1615
1587
|
disabled: rest.disabled
|
|
1616
1588
|
});
|
|
1617
1589
|
const [selectedValues, setSelectedValues] = _react.useState.call(void 0,
|
|
1618
|
-
options.filter((c) => _optionalChain([field, 'access',
|
|
1590
|
+
options.filter((c) => _optionalChain([field, 'access', _26 => _26.value, 'optionalAccess', _27 => _27.includes, 'call', _28 => _28(c.Value)])).map((c) => c.Value) || []
|
|
1619
1591
|
);
|
|
1620
1592
|
_react.useEffect.call(void 0, () => {
|
|
1621
1593
|
field.onChange(selectedValues ? [...selectedValues] : []);
|
package/dist/index.js
CHANGED
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
|
|
12
12
|
var _chunkJKUOV3MNjs = require('./chunk-JKUOV3MN.js');
|
|
13
13
|
require('./chunk-7M2VOCYN.js');
|
|
14
|
-
require('./chunk-6BGQA4BQ.js');
|
|
15
14
|
|
|
16
15
|
|
|
17
|
-
var
|
|
16
|
+
var _chunkPTW4AAPVjs = require('./chunk-PTW4AAPV.js');
|
|
17
|
+
require('./chunk-6BGQA4BQ.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 = _chunkPTW4AAPVjs.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
|
@@ -11,10 +11,10 @@ import {
|
|
|
11
11
|
SimpleToolbar_default
|
|
12
12
|
} from "./chunk-FSU3H777.mjs";
|
|
13
13
|
import "./chunk-2JFL7TS5.mjs";
|
|
14
|
-
import "./chunk-EVPUCTZA.mjs";
|
|
15
14
|
import {
|
|
16
15
|
Field_default
|
|
17
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-7HVI5RBL.mjs";
|
|
17
|
+
import "./chunk-EVPUCTZA.mjs";
|
|
18
18
|
import {
|
|
19
19
|
Field_default as Field_default2
|
|
20
20
|
} from "./chunk-5HOGPCEO.mjs";
|
|
@@ -63,13 +63,12 @@ type SelectCascadeElementProps<TOption, TFieldValues extends FieldValues = Field
|
|
|
63
63
|
disabled?: boolean;
|
|
64
64
|
sx?: SxProps;
|
|
65
65
|
isEdit?: boolean;
|
|
66
|
-
initialValue?: any;
|
|
67
66
|
labelKey?: keyof TOption;
|
|
68
67
|
valueKey?: keyof TOption;
|
|
69
68
|
textFieldProps?: Omit<TextFieldProps, "name">;
|
|
70
69
|
};
|
|
71
70
|
|
|
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">;
|
|
71
|
+
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" | "multiple" | "onChange" | "value">;
|
|
73
72
|
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
73
|
rules?: UseControllerProps<TFieldValues, TName>["rules"];
|
|
75
74
|
name: TName;
|
|
@@ -81,7 +80,6 @@ type SelectMultiElementProps<TFieldValues extends FieldValues = FieldValues, TNa
|
|
|
81
80
|
sx?: SxProps;
|
|
82
81
|
labelKey?: keyof TOption;
|
|
83
82
|
valueKey?: keyof TOption;
|
|
84
|
-
multiple?: Multiple;
|
|
85
83
|
};
|
|
86
84
|
|
|
87
85
|
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"> & {
|
|
@@ -95,7 +93,6 @@ type SelectElementProps<TOption, TFieldValues extends FieldValues = FieldValues,
|
|
|
95
93
|
sx?: SxProps;
|
|
96
94
|
isEdit?: boolean;
|
|
97
95
|
disabled?: boolean;
|
|
98
|
-
initialValue?: any;
|
|
99
96
|
labelKey?: string;
|
|
100
97
|
valueKey?: keyof TOption;
|
|
101
98
|
textFieldProps?: Omit<TextFieldProps, "name">;
|
package/dist/wrappers/index.d.ts
CHANGED
|
@@ -63,13 +63,12 @@ type SelectCascadeElementProps<TOption, TFieldValues extends FieldValues = Field
|
|
|
63
63
|
disabled?: boolean;
|
|
64
64
|
sx?: SxProps;
|
|
65
65
|
isEdit?: boolean;
|
|
66
|
-
initialValue?: any;
|
|
67
66
|
labelKey?: keyof TOption;
|
|
68
67
|
valueKey?: keyof TOption;
|
|
69
68
|
textFieldProps?: Omit<TextFieldProps, "name">;
|
|
70
69
|
};
|
|
71
70
|
|
|
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">;
|
|
71
|
+
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" | "multiple" | "onChange" | "value">;
|
|
73
72
|
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
73
|
rules?: UseControllerProps<TFieldValues, TName>["rules"];
|
|
75
74
|
name: TName;
|
|
@@ -81,7 +80,6 @@ type SelectMultiElementProps<TFieldValues extends FieldValues = FieldValues, TNa
|
|
|
81
80
|
sx?: SxProps;
|
|
82
81
|
labelKey?: keyof TOption;
|
|
83
82
|
valueKey?: keyof TOption;
|
|
84
|
-
multiple?: Multiple;
|
|
85
83
|
};
|
|
86
84
|
|
|
87
85
|
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"> & {
|
|
@@ -95,7 +93,6 @@ type SelectElementProps<TOption, TFieldValues extends FieldValues = FieldValues,
|
|
|
95
93
|
sx?: SxProps;
|
|
96
94
|
isEdit?: boolean;
|
|
97
95
|
disabled?: boolean;
|
|
98
|
-
initialValue?: any;
|
|
99
96
|
labelKey?: string;
|
|
100
97
|
valueKey?: keyof TOption;
|
|
101
98
|
textFieldProps?: Omit<TextFieldProps, "name">;
|
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 _chunkPTW4AAPVjs = require('../chunk-PTW4AAPV.js');
|
|
4
4
|
require('../chunk-6JZ35VQJ.js');
|
|
5
5
|
require('../chunk-I7EIUZKK.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
exports.Field =
|
|
8
|
+
exports.Field = _chunkPTW4AAPVjs.Field_default;
|
package/dist/wrappers/index.mjs
CHANGED