@gnwebsoft/ui 2.18.45 → 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-BWQUYXUW.mjs → chunk-7HVI5RBL.mjs} +235 -7
- package/dist/{chunk-D3J7MWAU.js → chunk-PTW4AAPV.js} +234 -6
- package/dist/index.js +3 -3
- package/dist/index.mjs +2 -2
- package/dist/wrappers/index.d.mts +27 -8
- package/dist/wrappers/index.d.ts +27 -8
- package/dist/wrappers/index.js +2 -2
- package/dist/wrappers/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -1202,7 +1202,13 @@ import { Fragment as Fragment3 } from "react";
|
|
|
1202
1202
|
import { useController as useController9 } from "react-hook-form";
|
|
1203
1203
|
import CheckBoxIcon from "@mui/icons-material/CheckBox";
|
|
1204
1204
|
import CheckBoxOutlineBlankIcon from "@mui/icons-material/CheckBoxOutlineBlank";
|
|
1205
|
-
import {
|
|
1205
|
+
import {
|
|
1206
|
+
Grid2 as Grid29,
|
|
1207
|
+
Checkbox,
|
|
1208
|
+
TextField as TextField6,
|
|
1209
|
+
Autocomplete as Autocomplete4,
|
|
1210
|
+
CircularProgress as CircularProgress3
|
|
1211
|
+
} from "@mui/material";
|
|
1206
1212
|
import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1207
1213
|
var Component9 = function SelectMultiElement(props) {
|
|
1208
1214
|
const {
|
|
@@ -1270,7 +1276,14 @@ var Component9 = function SelectMultiElement(props) {
|
|
|
1270
1276
|
renderOption: (props1, option, { selected }) => {
|
|
1271
1277
|
const { key, ...optionProps } = props1;
|
|
1272
1278
|
return /* @__PURE__ */ jsxs4("li", { ...optionProps, children: [
|
|
1273
|
-
/* @__PURE__ */ jsx9(
|
|
1279
|
+
/* @__PURE__ */ jsx9(
|
|
1280
|
+
Checkbox,
|
|
1281
|
+
{
|
|
1282
|
+
icon,
|
|
1283
|
+
checkedIcon,
|
|
1284
|
+
checked: selected
|
|
1285
|
+
}
|
|
1286
|
+
),
|
|
1274
1287
|
getOptionLabel(option)
|
|
1275
1288
|
] }, key);
|
|
1276
1289
|
},
|
|
@@ -1306,7 +1319,13 @@ var SelectMultiElement2 = ({
|
|
|
1306
1319
|
...props
|
|
1307
1320
|
}) => {
|
|
1308
1321
|
if (gridProps) {
|
|
1309
|
-
return /* @__PURE__ */ jsx9(
|
|
1322
|
+
return /* @__PURE__ */ jsx9(
|
|
1323
|
+
Grid29,
|
|
1324
|
+
{
|
|
1325
|
+
...{ size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }, ...gridProps },
|
|
1326
|
+
children: /* @__PURE__ */ jsx9(Component9, { ...props })
|
|
1327
|
+
}
|
|
1328
|
+
);
|
|
1310
1329
|
}
|
|
1311
1330
|
return /* @__PURE__ */ jsx9(Component9, { ...props });
|
|
1312
1331
|
};
|
|
@@ -1348,7 +1367,8 @@ var Component10 = function SelectCascadeElement(props) {
|
|
|
1348
1367
|
const { required } = textFieldProps;
|
|
1349
1368
|
const getOptionKey = useCallback5(
|
|
1350
1369
|
(option) => {
|
|
1351
|
-
if (typeof option === "string" || typeof option === "number")
|
|
1370
|
+
if (typeof option === "string" || typeof option === "number")
|
|
1371
|
+
return option;
|
|
1352
1372
|
const key = option ? option[valueKey] : void 0;
|
|
1353
1373
|
return key !== void 0 && key !== null ? String(key) : "";
|
|
1354
1374
|
},
|
|
@@ -1407,7 +1427,9 @@ var Component10 = function SelectCascadeElement(props) {
|
|
|
1407
1427
|
Autocomplete5,
|
|
1408
1428
|
{
|
|
1409
1429
|
...rest,
|
|
1410
|
-
value: options.map(
|
|
1430
|
+
value: options.map(
|
|
1431
|
+
(option) => getOptionKey(option) === field.value ? option : null
|
|
1432
|
+
).find(Boolean) || null,
|
|
1411
1433
|
size: "small",
|
|
1412
1434
|
loading,
|
|
1413
1435
|
options,
|
|
@@ -1460,7 +1482,13 @@ var SelectCascadeElement2 = ({
|
|
|
1460
1482
|
...props
|
|
1461
1483
|
}) => {
|
|
1462
1484
|
if (gridProps) {
|
|
1463
|
-
return /* @__PURE__ */ jsx10(
|
|
1485
|
+
return /* @__PURE__ */ jsx10(
|
|
1486
|
+
Grid210,
|
|
1487
|
+
{
|
|
1488
|
+
...{ size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }, ...gridProps },
|
|
1489
|
+
children: /* @__PURE__ */ jsx10(Component10, { ...props })
|
|
1490
|
+
}
|
|
1491
|
+
);
|
|
1464
1492
|
}
|
|
1465
1493
|
return /* @__PURE__ */ jsx10(Component10, { ...props });
|
|
1466
1494
|
};
|
|
@@ -1612,6 +1640,205 @@ var CheckboxGroup2 = ({
|
|
|
1612
1640
|
CheckboxGroup2.displayName = "CheckboxGroup";
|
|
1613
1641
|
var CheckboxGroup_default = CheckboxGroup2;
|
|
1614
1642
|
|
|
1643
|
+
// src/wrappers/SelectMultiCascadeElement/SelectMultiCascadeElement.tsx
|
|
1644
|
+
import { useController as useController13 } from "react-hook-form";
|
|
1645
|
+
import { useRef as useRef4, Fragment as Fragment4, useState as useState6, useEffect as useEffect7, useCallback as useCallback6 } from "react";
|
|
1646
|
+
import CheckBoxIcon2 from "@mui/icons-material/CheckBox";
|
|
1647
|
+
import CheckBoxOutlineBlankIcon2 from "@mui/icons-material/CheckBoxOutlineBlank";
|
|
1648
|
+
import {
|
|
1649
|
+
Chip,
|
|
1650
|
+
Grid2 as Grid213,
|
|
1651
|
+
Checkbox as Checkbox4,
|
|
1652
|
+
TextField as TextField8,
|
|
1653
|
+
Autocomplete as Autocomplete6,
|
|
1654
|
+
CircularProgress as CircularProgress4
|
|
1655
|
+
} from "@mui/material";
|
|
1656
|
+
import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1657
|
+
var Component13 = function SelectMultiCascadeElement(props) {
|
|
1658
|
+
const {
|
|
1659
|
+
name,
|
|
1660
|
+
control,
|
|
1661
|
+
dependsOn,
|
|
1662
|
+
onBlur,
|
|
1663
|
+
disabled,
|
|
1664
|
+
options,
|
|
1665
|
+
loading = false,
|
|
1666
|
+
placeholder,
|
|
1667
|
+
label,
|
|
1668
|
+
variant,
|
|
1669
|
+
sx,
|
|
1670
|
+
labelKey = "Label",
|
|
1671
|
+
valueKey = "Value",
|
|
1672
|
+
multiple = true,
|
|
1673
|
+
isEdit = false,
|
|
1674
|
+
initialValue,
|
|
1675
|
+
...rest
|
|
1676
|
+
} = props;
|
|
1677
|
+
const {
|
|
1678
|
+
field,
|
|
1679
|
+
fieldState: { error }
|
|
1680
|
+
} = useController13({
|
|
1681
|
+
name,
|
|
1682
|
+
control,
|
|
1683
|
+
defaultValue: initialValue
|
|
1684
|
+
});
|
|
1685
|
+
const { field: dependentField } = useController13({
|
|
1686
|
+
name: dependsOn,
|
|
1687
|
+
control
|
|
1688
|
+
});
|
|
1689
|
+
const parentValueRef = useRef4(dependentField.value ?? null);
|
|
1690
|
+
const [hasAutoSelected, setHasAutoSelected] = useState6(false);
|
|
1691
|
+
const getOptionValue = useCallback6(
|
|
1692
|
+
(option) => {
|
|
1693
|
+
if (typeof option === "string") return option;
|
|
1694
|
+
return option ? option[valueKey] : null;
|
|
1695
|
+
},
|
|
1696
|
+
[valueKey]
|
|
1697
|
+
);
|
|
1698
|
+
const getOptionLabel = useCallback6(
|
|
1699
|
+
(option) => {
|
|
1700
|
+
if (typeof option === "string") return option;
|
|
1701
|
+
return option ? option[labelKey] : "";
|
|
1702
|
+
},
|
|
1703
|
+
[labelKey]
|
|
1704
|
+
);
|
|
1705
|
+
useEffect7(() => {
|
|
1706
|
+
if (parentValueRef.current !== dependentField.value) {
|
|
1707
|
+
parentValueRef.current = dependentField.value;
|
|
1708
|
+
field.onChange(multiple ? [] : null);
|
|
1709
|
+
setHasAutoSelected(false);
|
|
1710
|
+
}
|
|
1711
|
+
}, [dependentField.value, field, multiple]);
|
|
1712
|
+
useEffect7(() => {
|
|
1713
|
+
if (!dependentField.value) return;
|
|
1714
|
+
if (isEdit) {
|
|
1715
|
+
if (field.value && (multiple ? field.value.length > 0 : field.value))
|
|
1716
|
+
return;
|
|
1717
|
+
if (options.length === 1 && !hasAutoSelected) {
|
|
1718
|
+
field.onChange(
|
|
1719
|
+
multiple ? [getOptionValue(options[0])] : getOptionValue(options[0])
|
|
1720
|
+
);
|
|
1721
|
+
setHasAutoSelected(true);
|
|
1722
|
+
}
|
|
1723
|
+
} else {
|
|
1724
|
+
if (options.length === 1 && (!field.value || field.value.length === 0) && !hasAutoSelected) {
|
|
1725
|
+
field.onChange(
|
|
1726
|
+
multiple ? [getOptionValue(options[0])] : getOptionValue(options[0])
|
|
1727
|
+
);
|
|
1728
|
+
setHasAutoSelected(true);
|
|
1729
|
+
}
|
|
1730
|
+
}
|
|
1731
|
+
}, [
|
|
1732
|
+
isEdit,
|
|
1733
|
+
options,
|
|
1734
|
+
field.value,
|
|
1735
|
+
dependentField.value,
|
|
1736
|
+
multiple,
|
|
1737
|
+
getOptionValue,
|
|
1738
|
+
hasAutoSelected,
|
|
1739
|
+
field
|
|
1740
|
+
]);
|
|
1741
|
+
const selectedValue = multiple ? Array.isArray(field.value) ? options.filter((opt) => field.value.includes(getOptionValue(opt))) : [] : options.find((opt) => getOptionValue(opt) === field.value) ?? null;
|
|
1742
|
+
const handleChange = (_2, selected, reason) => {
|
|
1743
|
+
if (multiple) {
|
|
1744
|
+
if (reason === "clear") {
|
|
1745
|
+
field.onChange([]);
|
|
1746
|
+
} else {
|
|
1747
|
+
const newValues = selected.map((opt) => getOptionValue(opt));
|
|
1748
|
+
field.onChange(newValues);
|
|
1749
|
+
}
|
|
1750
|
+
} else {
|
|
1751
|
+
field.onChange(selected ? getOptionValue(selected) : null);
|
|
1752
|
+
}
|
|
1753
|
+
};
|
|
1754
|
+
const icon = /* @__PURE__ */ jsx13(CheckBoxOutlineBlankIcon2, { fontSize: "small" });
|
|
1755
|
+
const checkedIcon = /* @__PURE__ */ jsx13(CheckBoxIcon2, { fontSize: "small" });
|
|
1756
|
+
return /* @__PURE__ */ jsx13(
|
|
1757
|
+
Autocomplete6,
|
|
1758
|
+
{
|
|
1759
|
+
multiple,
|
|
1760
|
+
value: selectedValue,
|
|
1761
|
+
loading,
|
|
1762
|
+
options,
|
|
1763
|
+
getOptionLabel,
|
|
1764
|
+
isOptionEqualToValue: (option, value) => getOptionValue(option) === getOptionValue(value),
|
|
1765
|
+
filterSelectedOptions: multiple,
|
|
1766
|
+
disableCloseOnSelect: multiple,
|
|
1767
|
+
ref: field.ref,
|
|
1768
|
+
disabled: !dependentField.value || disabled,
|
|
1769
|
+
onChange: handleChange,
|
|
1770
|
+
onBlur: (event) => {
|
|
1771
|
+
field.onBlur();
|
|
1772
|
+
if (typeof onBlur === "function") {
|
|
1773
|
+
onBlur(event);
|
|
1774
|
+
}
|
|
1775
|
+
},
|
|
1776
|
+
fullWidth: true,
|
|
1777
|
+
renderOption: (props1, option, { selected }) => multiple ? /* @__PURE__ */ jsxs7("li", { ...props1, children: [
|
|
1778
|
+
/* @__PURE__ */ jsx13(
|
|
1779
|
+
Checkbox4,
|
|
1780
|
+
{
|
|
1781
|
+
icon,
|
|
1782
|
+
checkedIcon,
|
|
1783
|
+
checked: selected
|
|
1784
|
+
}
|
|
1785
|
+
),
|
|
1786
|
+
getOptionLabel(option)
|
|
1787
|
+
] }) : /* @__PURE__ */ jsx13("li", { ...props1, children: getOptionLabel(option) }),
|
|
1788
|
+
renderTags: (tagValue, getTagProps) => tagValue.map((option, index) => /* @__PURE__ */ jsx13(
|
|
1789
|
+
Chip,
|
|
1790
|
+
{
|
|
1791
|
+
...getTagProps({ index }),
|
|
1792
|
+
label: getOptionLabel(option),
|
|
1793
|
+
size: "small",
|
|
1794
|
+
variant: "filled"
|
|
1795
|
+
}
|
|
1796
|
+
)),
|
|
1797
|
+
renderInput: (params) => /* @__PURE__ */ jsx13(
|
|
1798
|
+
TextField8,
|
|
1799
|
+
{
|
|
1800
|
+
...params,
|
|
1801
|
+
label,
|
|
1802
|
+
error: !!error,
|
|
1803
|
+
helperText: error ? error.message : "",
|
|
1804
|
+
placeholder,
|
|
1805
|
+
slotProps: {
|
|
1806
|
+
input: {
|
|
1807
|
+
...params.InputProps,
|
|
1808
|
+
endAdornment: /* @__PURE__ */ jsxs7(Fragment4, { children: [
|
|
1809
|
+
loading ? /* @__PURE__ */ jsx13(CircularProgress4, { color: "inherit", size: 20 }) : null,
|
|
1810
|
+
params.InputProps.endAdornment
|
|
1811
|
+
] })
|
|
1812
|
+
}
|
|
1813
|
+
},
|
|
1814
|
+
variant: variant ? variant : "outlined",
|
|
1815
|
+
sx: {
|
|
1816
|
+
...sx
|
|
1817
|
+
}
|
|
1818
|
+
}
|
|
1819
|
+
),
|
|
1820
|
+
...rest
|
|
1821
|
+
}
|
|
1822
|
+
);
|
|
1823
|
+
};
|
|
1824
|
+
var SelectMultiCascadeElement2 = ({
|
|
1825
|
+
gridProps = { size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 } },
|
|
1826
|
+
...props
|
|
1827
|
+
}) => {
|
|
1828
|
+
if (gridProps) {
|
|
1829
|
+
return /* @__PURE__ */ jsx13(
|
|
1830
|
+
Grid213,
|
|
1831
|
+
{
|
|
1832
|
+
...{ size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }, ...gridProps },
|
|
1833
|
+
children: /* @__PURE__ */ jsx13(Component13, { ...props })
|
|
1834
|
+
}
|
|
1835
|
+
);
|
|
1836
|
+
}
|
|
1837
|
+
return /* @__PURE__ */ jsx13(Component13, { ...props });
|
|
1838
|
+
};
|
|
1839
|
+
SelectMultiCascadeElement2.displayName = "SelectMultiCascadeElement";
|
|
1840
|
+
var SelectMultiCascadeElement_default = SelectMultiCascadeElement2;
|
|
1841
|
+
|
|
1615
1842
|
// src/wrappers/Field/index.ts
|
|
1616
1843
|
var Field = {
|
|
1617
1844
|
Text: TextFieldElement_default,
|
|
@@ -1625,7 +1852,8 @@ var Field = {
|
|
|
1625
1852
|
SelectCascade: SelectCascadeElement_default,
|
|
1626
1853
|
AsyncSelect: AsyncSelectElement_default,
|
|
1627
1854
|
AsyncMultiSelect: AsyncMultiSelect_default,
|
|
1628
|
-
CheckboxGroup: CheckboxGroup_default
|
|
1855
|
+
CheckboxGroup: CheckboxGroup_default,
|
|
1856
|
+
SelectMultiCascadeElement: SelectMultiCascadeElement_default
|
|
1629
1857
|
};
|
|
1630
1858
|
var Field_default = Field;
|
|
1631
1859
|
|
|
@@ -1204,6 +1204,12 @@ var _CheckBox = require('@mui/icons-material/CheckBox'); var _CheckBox2 = _inter
|
|
|
1204
1204
|
var _CheckBoxOutlineBlank = require('@mui/icons-material/CheckBoxOutlineBlank'); var _CheckBoxOutlineBlank2 = _interopRequireDefault(_CheckBoxOutlineBlank);
|
|
1205
1205
|
|
|
1206
1206
|
|
|
1207
|
+
|
|
1208
|
+
|
|
1209
|
+
|
|
1210
|
+
|
|
1211
|
+
|
|
1212
|
+
|
|
1207
1213
|
var Component9 = function SelectMultiElement(props) {
|
|
1208
1214
|
const {
|
|
1209
1215
|
name,
|
|
@@ -1270,7 +1276,14 @@ var Component9 = function SelectMultiElement(props) {
|
|
|
1270
1276
|
renderOption: (props1, option, { selected }) => {
|
|
1271
1277
|
const { key, ...optionProps } = props1;
|
|
1272
1278
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "li", { ...optionProps, children: [
|
|
1273
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1279
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1280
|
+
_material.Checkbox,
|
|
1281
|
+
{
|
|
1282
|
+
icon,
|
|
1283
|
+
checkedIcon,
|
|
1284
|
+
checked: selected
|
|
1285
|
+
}
|
|
1286
|
+
),
|
|
1274
1287
|
getOptionLabel(option)
|
|
1275
1288
|
] }, key);
|
|
1276
1289
|
},
|
|
@@ -1306,7 +1319,13 @@ var SelectMultiElement2 = ({
|
|
|
1306
1319
|
...props
|
|
1307
1320
|
}) => {
|
|
1308
1321
|
if (gridProps) {
|
|
1309
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1322
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1323
|
+
_material.Grid2,
|
|
1324
|
+
{
|
|
1325
|
+
...{ size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }, ...gridProps },
|
|
1326
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component9, { ...props })
|
|
1327
|
+
}
|
|
1328
|
+
);
|
|
1310
1329
|
}
|
|
1311
1330
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component9, { ...props });
|
|
1312
1331
|
};
|
|
@@ -1348,7 +1367,8 @@ var Component10 = function SelectCascadeElement(props) {
|
|
|
1348
1367
|
const { required } = textFieldProps;
|
|
1349
1368
|
const getOptionKey = _react.useCallback.call(void 0,
|
|
1350
1369
|
(option) => {
|
|
1351
|
-
if (typeof option === "string" || typeof option === "number")
|
|
1370
|
+
if (typeof option === "string" || typeof option === "number")
|
|
1371
|
+
return option;
|
|
1352
1372
|
const key = option ? option[valueKey] : void 0;
|
|
1353
1373
|
return key !== void 0 && key !== null ? String(key) : "";
|
|
1354
1374
|
},
|
|
@@ -1407,7 +1427,9 @@ var Component10 = function SelectCascadeElement(props) {
|
|
|
1407
1427
|
_material.Autocomplete,
|
|
1408
1428
|
{
|
|
1409
1429
|
...rest,
|
|
1410
|
-
value: options.map(
|
|
1430
|
+
value: options.map(
|
|
1431
|
+
(option) => getOptionKey(option) === field.value ? option : null
|
|
1432
|
+
).find(Boolean) || null,
|
|
1411
1433
|
size: "small",
|
|
1412
1434
|
loading,
|
|
1413
1435
|
options,
|
|
@@ -1460,7 +1482,13 @@ var SelectCascadeElement2 = ({
|
|
|
1460
1482
|
...props
|
|
1461
1483
|
}) => {
|
|
1462
1484
|
if (gridProps) {
|
|
1463
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1485
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1486
|
+
_material.Grid2,
|
|
1487
|
+
{
|
|
1488
|
+
...{ size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }, ...gridProps },
|
|
1489
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component10, { ...props })
|
|
1490
|
+
}
|
|
1491
|
+
);
|
|
1464
1492
|
}
|
|
1465
1493
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component10, { ...props });
|
|
1466
1494
|
};
|
|
@@ -1612,6 +1640,205 @@ var CheckboxGroup2 = ({
|
|
|
1612
1640
|
CheckboxGroup2.displayName = "CheckboxGroup";
|
|
1613
1641
|
var CheckboxGroup_default = CheckboxGroup2;
|
|
1614
1642
|
|
|
1643
|
+
// src/wrappers/SelectMultiCascadeElement/SelectMultiCascadeElement.tsx
|
|
1644
|
+
|
|
1645
|
+
|
|
1646
|
+
|
|
1647
|
+
|
|
1648
|
+
|
|
1649
|
+
|
|
1650
|
+
|
|
1651
|
+
|
|
1652
|
+
|
|
1653
|
+
|
|
1654
|
+
|
|
1655
|
+
|
|
1656
|
+
|
|
1657
|
+
var Component13 = function SelectMultiCascadeElement(props) {
|
|
1658
|
+
const {
|
|
1659
|
+
name,
|
|
1660
|
+
control,
|
|
1661
|
+
dependsOn,
|
|
1662
|
+
onBlur,
|
|
1663
|
+
disabled,
|
|
1664
|
+
options,
|
|
1665
|
+
loading = false,
|
|
1666
|
+
placeholder,
|
|
1667
|
+
label,
|
|
1668
|
+
variant,
|
|
1669
|
+
sx,
|
|
1670
|
+
labelKey = "Label",
|
|
1671
|
+
valueKey = "Value",
|
|
1672
|
+
multiple = true,
|
|
1673
|
+
isEdit = false,
|
|
1674
|
+
initialValue,
|
|
1675
|
+
...rest
|
|
1676
|
+
} = props;
|
|
1677
|
+
const {
|
|
1678
|
+
field,
|
|
1679
|
+
fieldState: { error }
|
|
1680
|
+
} = _reacthookform.useController.call(void 0, {
|
|
1681
|
+
name,
|
|
1682
|
+
control,
|
|
1683
|
+
defaultValue: initialValue
|
|
1684
|
+
});
|
|
1685
|
+
const { field: dependentField } = _reacthookform.useController.call(void 0, {
|
|
1686
|
+
name: dependsOn,
|
|
1687
|
+
control
|
|
1688
|
+
});
|
|
1689
|
+
const parentValueRef = _react.useRef.call(void 0, _nullishCoalesce(dependentField.value, () => ( null)));
|
|
1690
|
+
const [hasAutoSelected, setHasAutoSelected] = _react.useState.call(void 0, false);
|
|
1691
|
+
const getOptionValue = _react.useCallback.call(void 0,
|
|
1692
|
+
(option) => {
|
|
1693
|
+
if (typeof option === "string") return option;
|
|
1694
|
+
return option ? option[valueKey] : null;
|
|
1695
|
+
},
|
|
1696
|
+
[valueKey]
|
|
1697
|
+
);
|
|
1698
|
+
const getOptionLabel = _react.useCallback.call(void 0,
|
|
1699
|
+
(option) => {
|
|
1700
|
+
if (typeof option === "string") return option;
|
|
1701
|
+
return option ? option[labelKey] : "";
|
|
1702
|
+
},
|
|
1703
|
+
[labelKey]
|
|
1704
|
+
);
|
|
1705
|
+
_react.useEffect.call(void 0, () => {
|
|
1706
|
+
if (parentValueRef.current !== dependentField.value) {
|
|
1707
|
+
parentValueRef.current = dependentField.value;
|
|
1708
|
+
field.onChange(multiple ? [] : null);
|
|
1709
|
+
setHasAutoSelected(false);
|
|
1710
|
+
}
|
|
1711
|
+
}, [dependentField.value, field, multiple]);
|
|
1712
|
+
_react.useEffect.call(void 0, () => {
|
|
1713
|
+
if (!dependentField.value) return;
|
|
1714
|
+
if (isEdit) {
|
|
1715
|
+
if (field.value && (multiple ? field.value.length > 0 : field.value))
|
|
1716
|
+
return;
|
|
1717
|
+
if (options.length === 1 && !hasAutoSelected) {
|
|
1718
|
+
field.onChange(
|
|
1719
|
+
multiple ? [getOptionValue(options[0])] : getOptionValue(options[0])
|
|
1720
|
+
);
|
|
1721
|
+
setHasAutoSelected(true);
|
|
1722
|
+
}
|
|
1723
|
+
} else {
|
|
1724
|
+
if (options.length === 1 && (!field.value || field.value.length === 0) && !hasAutoSelected) {
|
|
1725
|
+
field.onChange(
|
|
1726
|
+
multiple ? [getOptionValue(options[0])] : getOptionValue(options[0])
|
|
1727
|
+
);
|
|
1728
|
+
setHasAutoSelected(true);
|
|
1729
|
+
}
|
|
1730
|
+
}
|
|
1731
|
+
}, [
|
|
1732
|
+
isEdit,
|
|
1733
|
+
options,
|
|
1734
|
+
field.value,
|
|
1735
|
+
dependentField.value,
|
|
1736
|
+
multiple,
|
|
1737
|
+
getOptionValue,
|
|
1738
|
+
hasAutoSelected,
|
|
1739
|
+
field
|
|
1740
|
+
]);
|
|
1741
|
+
const selectedValue = multiple ? Array.isArray(field.value) ? options.filter((opt) => field.value.includes(getOptionValue(opt))) : [] : _nullishCoalesce(options.find((opt) => getOptionValue(opt) === field.value), () => ( null));
|
|
1742
|
+
const handleChange = (_2, selected, reason) => {
|
|
1743
|
+
if (multiple) {
|
|
1744
|
+
if (reason === "clear") {
|
|
1745
|
+
field.onChange([]);
|
|
1746
|
+
} else {
|
|
1747
|
+
const newValues = selected.map((opt) => getOptionValue(opt));
|
|
1748
|
+
field.onChange(newValues);
|
|
1749
|
+
}
|
|
1750
|
+
} else {
|
|
1751
|
+
field.onChange(selected ? getOptionValue(selected) : null);
|
|
1752
|
+
}
|
|
1753
|
+
};
|
|
1754
|
+
const icon = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _CheckBoxOutlineBlank2.default, { fontSize: "small" });
|
|
1755
|
+
const checkedIcon = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _CheckBox2.default, { fontSize: "small" });
|
|
1756
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1757
|
+
_material.Autocomplete,
|
|
1758
|
+
{
|
|
1759
|
+
multiple,
|
|
1760
|
+
value: selectedValue,
|
|
1761
|
+
loading,
|
|
1762
|
+
options,
|
|
1763
|
+
getOptionLabel,
|
|
1764
|
+
isOptionEqualToValue: (option, value) => getOptionValue(option) === getOptionValue(value),
|
|
1765
|
+
filterSelectedOptions: multiple,
|
|
1766
|
+
disableCloseOnSelect: multiple,
|
|
1767
|
+
ref: field.ref,
|
|
1768
|
+
disabled: !dependentField.value || disabled,
|
|
1769
|
+
onChange: handleChange,
|
|
1770
|
+
onBlur: (event) => {
|
|
1771
|
+
field.onBlur();
|
|
1772
|
+
if (typeof onBlur === "function") {
|
|
1773
|
+
onBlur(event);
|
|
1774
|
+
}
|
|
1775
|
+
},
|
|
1776
|
+
fullWidth: true,
|
|
1777
|
+
renderOption: (props1, option, { selected }) => multiple ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "li", { ...props1, children: [
|
|
1778
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1779
|
+
_material.Checkbox,
|
|
1780
|
+
{
|
|
1781
|
+
icon,
|
|
1782
|
+
checkedIcon,
|
|
1783
|
+
checked: selected
|
|
1784
|
+
}
|
|
1785
|
+
),
|
|
1786
|
+
getOptionLabel(option)
|
|
1787
|
+
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "li", { ...props1, children: getOptionLabel(option) }),
|
|
1788
|
+
renderTags: (tagValue, getTagProps) => tagValue.map((option, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1789
|
+
_material.Chip,
|
|
1790
|
+
{
|
|
1791
|
+
...getTagProps({ index }),
|
|
1792
|
+
label: getOptionLabel(option),
|
|
1793
|
+
size: "small",
|
|
1794
|
+
variant: "filled"
|
|
1795
|
+
}
|
|
1796
|
+
)),
|
|
1797
|
+
renderInput: (params) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1798
|
+
_material.TextField,
|
|
1799
|
+
{
|
|
1800
|
+
...params,
|
|
1801
|
+
label,
|
|
1802
|
+
error: !!error,
|
|
1803
|
+
helperText: error ? error.message : "",
|
|
1804
|
+
placeholder,
|
|
1805
|
+
slotProps: {
|
|
1806
|
+
input: {
|
|
1807
|
+
...params.InputProps,
|
|
1808
|
+
endAdornment: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _react.Fragment, { children: [
|
|
1809
|
+
loading ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.CircularProgress, { color: "inherit", size: 20 }) : null,
|
|
1810
|
+
params.InputProps.endAdornment
|
|
1811
|
+
] })
|
|
1812
|
+
}
|
|
1813
|
+
},
|
|
1814
|
+
variant: variant ? variant : "outlined",
|
|
1815
|
+
sx: {
|
|
1816
|
+
...sx
|
|
1817
|
+
}
|
|
1818
|
+
}
|
|
1819
|
+
),
|
|
1820
|
+
...rest
|
|
1821
|
+
}
|
|
1822
|
+
);
|
|
1823
|
+
};
|
|
1824
|
+
var SelectMultiCascadeElement2 = ({
|
|
1825
|
+
gridProps = { size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 } },
|
|
1826
|
+
...props
|
|
1827
|
+
}) => {
|
|
1828
|
+
if (gridProps) {
|
|
1829
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1830
|
+
_material.Grid2,
|
|
1831
|
+
{
|
|
1832
|
+
...{ size: { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }, ...gridProps },
|
|
1833
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component13, { ...props })
|
|
1834
|
+
}
|
|
1835
|
+
);
|
|
1836
|
+
}
|
|
1837
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component13, { ...props });
|
|
1838
|
+
};
|
|
1839
|
+
SelectMultiCascadeElement2.displayName = "SelectMultiCascadeElement";
|
|
1840
|
+
var SelectMultiCascadeElement_default = SelectMultiCascadeElement2;
|
|
1841
|
+
|
|
1615
1842
|
// src/wrappers/Field/index.ts
|
|
1616
1843
|
var Field = {
|
|
1617
1844
|
Text: TextFieldElement_default,
|
|
@@ -1625,7 +1852,8 @@ var Field = {
|
|
|
1625
1852
|
SelectCascade: SelectCascadeElement_default,
|
|
1626
1853
|
AsyncSelect: AsyncSelectElement_default,
|
|
1627
1854
|
AsyncMultiSelect: AsyncMultiSelect_default,
|
|
1628
|
-
CheckboxGroup: CheckboxGroup_default
|
|
1855
|
+
CheckboxGroup: CheckboxGroup_default,
|
|
1856
|
+
SelectMultiCascadeElement: SelectMultiCascadeElement_default
|
|
1629
1857
|
};
|
|
1630
1858
|
var Field_default = Field;
|
|
1631
1859
|
|
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";
|
|
@@ -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>;
|
|
@@ -47,12 +65,12 @@ type SelectCascadeElementProps<TOption, TFieldValues extends FieldValues = Field
|
|
|
47
65
|
isEdit?: boolean;
|
|
48
66
|
labelKey?: keyof TOption;
|
|
49
67
|
valueKey?: keyof TOption;
|
|
50
|
-
textFieldProps?: Omit<TextFieldProps,
|
|
68
|
+
textFieldProps?: Omit<TextFieldProps, "name">;
|
|
51
69
|
};
|
|
52
70
|
|
|
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>[
|
|
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">;
|
|
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> & {
|
|
73
|
+
rules?: UseControllerProps<TFieldValues, TName>["rules"];
|
|
56
74
|
name: TName;
|
|
57
75
|
control?: Control<TFieldValues>;
|
|
58
76
|
gridProps?: Grid2Props;
|
|
@@ -196,6 +214,7 @@ declare const Field: {
|
|
|
196
214
|
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
215
|
AsyncMultiSelect: any;
|
|
198
216
|
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;
|
|
217
|
+
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
218
|
};
|
|
200
219
|
|
|
201
220
|
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>;
|
|
@@ -47,12 +65,12 @@ type SelectCascadeElementProps<TOption, TFieldValues extends FieldValues = Field
|
|
|
47
65
|
isEdit?: boolean;
|
|
48
66
|
labelKey?: keyof TOption;
|
|
49
67
|
valueKey?: keyof TOption;
|
|
50
|
-
textFieldProps?: Omit<TextFieldProps,
|
|
68
|
+
textFieldProps?: Omit<TextFieldProps, "name">;
|
|
51
69
|
};
|
|
52
70
|
|
|
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>[
|
|
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">;
|
|
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> & {
|
|
73
|
+
rules?: UseControllerProps<TFieldValues, TName>["rules"];
|
|
56
74
|
name: TName;
|
|
57
75
|
control?: Control<TFieldValues>;
|
|
58
76
|
gridProps?: Grid2Props;
|
|
@@ -196,6 +214,7 @@ declare const Field: {
|
|
|
196
214
|
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
215
|
AsyncMultiSelect: any;
|
|
198
216
|
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;
|
|
217
|
+
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
218
|
};
|
|
200
219
|
|
|
201
220
|
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 _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