tp-react-elements-dev 1.10.8 → 1.10.10
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/components/SelectField/MultiSelectFieldComponent.d.ts +11 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +139 -9
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +139 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -54032,12 +54032,12 @@ function makeStyles(stylesOrCreator, options = {}) {
|
|
|
54032
54032
|
return useStyles;
|
|
54033
54033
|
}
|
|
54034
54034
|
|
|
54035
|
-
const ITEM_HEIGHT = 48;
|
|
54036
|
-
const ITEM_PADDING_TOP = 3;
|
|
54037
|
-
const MenuProps = {
|
|
54035
|
+
const ITEM_HEIGHT$1 = 48;
|
|
54036
|
+
const ITEM_PADDING_TOP$1 = 3;
|
|
54037
|
+
const MenuProps$1 = {
|
|
54038
54038
|
PaperProps: {
|
|
54039
54039
|
style: {
|
|
54040
|
-
maxHeight: ITEM_HEIGHT * 5.5 + ITEM_PADDING_TOP,
|
|
54040
|
+
maxHeight: ITEM_HEIGHT$1 * 5.5 + ITEM_PADDING_TOP$1,
|
|
54041
54041
|
// width: 250,
|
|
54042
54042
|
},
|
|
54043
54043
|
},
|
|
@@ -54052,7 +54052,7 @@ makeStyles((theme) => ({
|
|
|
54052
54052
|
fontSize: "11px",
|
|
54053
54053
|
},
|
|
54054
54054
|
}));
|
|
54055
|
-
const extractValuesToArray = (inputString) => {
|
|
54055
|
+
const extractValuesToArray$1 = (inputString) => {
|
|
54056
54056
|
const valuesArray = inputString === null || inputString === void 0 ? void 0 : inputString.split(",");
|
|
54057
54057
|
const trimmedArray = valuesArray === null || valuesArray === void 0 ? void 0 : valuesArray.map((value) => value.trim());
|
|
54058
54058
|
return trimmedArray;
|
|
@@ -54061,7 +54061,7 @@ function MultiSelectV1({ props, variant }) {
|
|
|
54061
54061
|
var _a;
|
|
54062
54062
|
console.log(props, "ksjh");
|
|
54063
54063
|
const [personName, setPersonName] = React__namespace.useState(props.getValues(props.item.name)
|
|
54064
|
-
? extractValuesToArray(props.getValues(props.item.name))
|
|
54064
|
+
? extractValuesToArray$1(props.getValues(props.item.name))
|
|
54065
54065
|
: []);
|
|
54066
54066
|
const [searchText, setSearchText] = React$1.useState("");
|
|
54067
54067
|
const options = (_a = props.item) === null || _a === void 0 ? void 0 : _a.options;
|
|
@@ -54122,7 +54122,7 @@ function MultiSelectV1({ props, variant }) {
|
|
|
54122
54122
|
fontSize: "5px !important",
|
|
54123
54123
|
},
|
|
54124
54124
|
}, disabled: props.item.disable, value: props.getValues(props.item.name)
|
|
54125
|
-
? extractValuesToArray(props.getValues(props.item.name))
|
|
54125
|
+
? extractValuesToArray$1(props.getValues(props.item.name))
|
|
54126
54126
|
: [], onChange: handleChange, onOpen: () => {
|
|
54127
54127
|
setTimeout(() => {
|
|
54128
54128
|
var _a;
|
|
@@ -54136,7 +54136,7 @@ function MultiSelectV1({ props, variant }) {
|
|
|
54136
54136
|
((_a = props === null || props === void 0 ? void 0 : props.item) === null || _a === void 0 ? void 0 : _a.onCloseMenu) && ((_b = props === null || props === void 0 ? void 0 : props.item) === null || _b === void 0 ? void 0 : _b.onCloseMenu());
|
|
54137
54137
|
}, input: jsxRuntimeExports.jsx(OutlinedInput, { label: variant !== "standard" ? props.item.label : '' }), renderValue: (selected) => (jsxRuntimeExports.jsx(Tooltip, Object.assign({ title: selectedValues }, { children: selectedOptions.length > 3
|
|
54138
54138
|
? selectedOptions.length + " Selected"
|
|
54139
|
-
: selectedValues }))), MenuProps: MenuProps, autoFocus: false }, { children: [jsxRuntimeExports.jsx(Box, Object.assign({ sx: {
|
|
54139
|
+
: selectedValues }))), MenuProps: MenuProps$1, autoFocus: false }, { children: [jsxRuntimeExports.jsx(Box, Object.assign({ sx: {
|
|
54140
54140
|
width: "100%",
|
|
54141
54141
|
position: "sticky",
|
|
54142
54142
|
top: "0px",
|
|
@@ -63070,12 +63070,143 @@ const SessionTimeOut = ({ sessionTime, handleSubmitSession, onSessionExpire, han
|
|
|
63070
63070
|
return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsx(ConfirmationDialog, { openConfirmDialog: openConfirmModal, handleCancel: handleCancel, onClickSubmit: handleSubmit, text: sessionMessage, Submit: SubmitButtonName, buttonStyleProps: buttonStyleProps }) }));
|
|
63071
63071
|
};
|
|
63072
63072
|
|
|
63073
|
+
const ITEM_HEIGHT = 48;
|
|
63074
|
+
const ITEM_PADDING_TOP = 3;
|
|
63075
|
+
const MenuProps = {
|
|
63076
|
+
PaperProps: {
|
|
63077
|
+
style: {
|
|
63078
|
+
maxHeight: ITEM_HEIGHT * 5.5 + ITEM_PADDING_TOP,
|
|
63079
|
+
// width: 250,
|
|
63080
|
+
},
|
|
63081
|
+
},
|
|
63082
|
+
autoFocus: false,
|
|
63083
|
+
disableAutoFocusItem: true,
|
|
63084
|
+
};
|
|
63085
|
+
makeStyles((theme) => ({
|
|
63086
|
+
option: {
|
|
63087
|
+
fontSize: "10px", // Adjust the font size as needed
|
|
63088
|
+
},
|
|
63089
|
+
option2: {
|
|
63090
|
+
fontSize: "11px",
|
|
63091
|
+
},
|
|
63092
|
+
}));
|
|
63093
|
+
const extractValuesToArray = (inputString) => {
|
|
63094
|
+
const valuesArray = inputString === null || inputString === void 0 ? void 0 : inputString.split(",");
|
|
63095
|
+
const trimmedArray = valuesArray === null || valuesArray === void 0 ? void 0 : valuesArray.map((value) => value.trim());
|
|
63096
|
+
return trimmedArray;
|
|
63097
|
+
};
|
|
63098
|
+
function MultiSelectFieldComponent({ value, options, onChangeFn, disable = false, }) {
|
|
63099
|
+
const [personName, setPersonName] = React__namespace.useState(value ? extractValuesToArray(value) : []);
|
|
63100
|
+
const [searchText, setSearchText] = React$1.useState("");
|
|
63101
|
+
const [filterOptions, setFilterOptions] = React$1.useState(options);
|
|
63102
|
+
const [selectAll, setSelectAll] = React$1.useState(false);
|
|
63103
|
+
const textfieldRef = React__namespace.useRef();
|
|
63104
|
+
const fieldValue = value;
|
|
63105
|
+
const mappedIds = filterOptions.map((item) => item.value);
|
|
63106
|
+
const filterIds = filterOptions.map((item) => item.value);
|
|
63107
|
+
// console.log(value, "mnnmnmnnn");
|
|
63108
|
+
React__namespace.useEffect(() => {
|
|
63109
|
+
// setFilterOptions(options);
|
|
63110
|
+
if (searchText !== "") {
|
|
63111
|
+
setFilterOptions(options.filter((item) => item.label.toLowerCase().includes(searchText.toLowerCase())));
|
|
63112
|
+
}
|
|
63113
|
+
else {
|
|
63114
|
+
setFilterOptions(options);
|
|
63115
|
+
}
|
|
63116
|
+
}, [options, searchText]);
|
|
63117
|
+
function hasExactMatch(array, value) {
|
|
63118
|
+
return array.some((item) => item === value);
|
|
63119
|
+
}
|
|
63120
|
+
React__namespace.useEffect(() => {
|
|
63121
|
+
if ((fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.split(",").length) !== filterOptions.length) {
|
|
63122
|
+
setSelectAll(false);
|
|
63123
|
+
}
|
|
63124
|
+
else {
|
|
63125
|
+
console.log(fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.split(","), 'fieldValue?.split(",")', filterIds);
|
|
63126
|
+
if (fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.split(",").every((value) => hasExactMatch(filterIds, value))) {
|
|
63127
|
+
setSelectAll(true);
|
|
63128
|
+
}
|
|
63129
|
+
}
|
|
63130
|
+
}, [filterOptions, fieldValue]);
|
|
63131
|
+
const handleChange = (event) => {
|
|
63132
|
+
const { target: { value }, } = event;
|
|
63133
|
+
setPersonName(typeof value === "string" ? value === null || value === void 0 ? void 0 : value.split(",") : value);
|
|
63134
|
+
onChangeFn((typeof value === "string" ? value === null || value === void 0 ? void 0 : value.split(",") : value).join(","));
|
|
63135
|
+
};
|
|
63136
|
+
const selectedOptions = options.filter((item) => fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.split(",").some((value) => value === item.value));
|
|
63137
|
+
const selectedValues = selectedOptions
|
|
63138
|
+
.map((item) => item.label)
|
|
63139
|
+
.join(" , ");
|
|
63140
|
+
// console.log(fieldValue,'sjshshsh');
|
|
63141
|
+
console.log(value, "value");
|
|
63142
|
+
return (jsxRuntimeExports.jsx(Box, { children: jsxRuntimeExports.jsx(FormControl, Object.assign({ fullWidth: true, sx: {
|
|
63143
|
+
"& .css-kichxs-MuiFormLabel-root-MuiInputLabel-root,.css-1holvmy": {
|
|
63144
|
+
top: "-10px",
|
|
63145
|
+
},
|
|
63146
|
+
} }, { children: jsxRuntimeExports.jsxs(Select, Object.assign({ labelId: "demo-multiple-checkbox-label", id: "demo-multiple-checkbox", multiple: true, sx: {
|
|
63147
|
+
"& .MuiTypography-root": {
|
|
63148
|
+
fontSize: "5px !important",
|
|
63149
|
+
},
|
|
63150
|
+
}, disabled: disable, value: value ? extractValuesToArray(value) : [], onChange: handleChange, onOpen: () => {
|
|
63151
|
+
setTimeout(() => {
|
|
63152
|
+
var _a;
|
|
63153
|
+
if (textfieldRef.current) {
|
|
63154
|
+
(_a = textfieldRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
63155
|
+
}
|
|
63156
|
+
}, 0);
|
|
63157
|
+
}, onClose: () => {
|
|
63158
|
+
setSearchText("");
|
|
63159
|
+
// props?.item?.onCloseMenu && props?.item?.onCloseMenu();
|
|
63160
|
+
}, renderValue: (selected) => (jsxRuntimeExports.jsx(Tooltip, Object.assign({ title: selectedValues }, { children: selectedOptions.length > 3
|
|
63161
|
+
? selectedOptions.length + " Selected"
|
|
63162
|
+
: selectedValues }))), MenuProps: MenuProps, autoFocus: false }, { children: [jsxRuntimeExports.jsx(Box, Object.assign({ sx: {
|
|
63163
|
+
width: "100%",
|
|
63164
|
+
position: "sticky",
|
|
63165
|
+
top: "0px",
|
|
63166
|
+
padding: "7px",
|
|
63167
|
+
zIndex: 2,
|
|
63168
|
+
height: "33px",
|
|
63169
|
+
background: "#fff",
|
|
63170
|
+
display: options.length === 0 ? "none" : undefined,
|
|
63171
|
+
} }, { children: jsxRuntimeExports.jsx(TextField, { inputRef: textfieldRef, autoFocus: true, value: searchText, sx: {
|
|
63172
|
+
width: "100%",
|
|
63173
|
+
}, placeholder: "Search...", onChange: (e) => {
|
|
63174
|
+
setSearchText(e.target.value);
|
|
63175
|
+
}, onKeyDown: (e) => {
|
|
63176
|
+
if (e.key !== "Escape") {
|
|
63177
|
+
e.stopPropagation();
|
|
63178
|
+
}
|
|
63179
|
+
} }) })), jsxRuntimeExports.jsxs(MenuItem, Object.assign({ disabled: filterOptions.length === 0, sx: { zIndex: 0, fontSize: "5px !important" } }, { children: [jsxRuntimeExports.jsx(Checkbox, { size: "small", checked: selectAll, onChange: (e) => {
|
|
63180
|
+
setSelectAll(!selectAll);
|
|
63181
|
+
const selectChanged = !selectAll;
|
|
63182
|
+
if (!selectChanged) {
|
|
63183
|
+
onChangeFn("");
|
|
63184
|
+
}
|
|
63185
|
+
else {
|
|
63186
|
+
const allDataMapped = mappedIds.join(",");
|
|
63187
|
+
console.log(allDataMapped, "allDataMapped");
|
|
63188
|
+
onChangeFn(allDataMapped);
|
|
63189
|
+
}
|
|
63190
|
+
} }), jsxRuntimeExports.jsx(ListItemText, { primary: "Select All", sx: {
|
|
63191
|
+
fontSize: "5px !important",
|
|
63192
|
+
"& span": {
|
|
63193
|
+
fontSize: "12px !important",
|
|
63194
|
+
},
|
|
63195
|
+
} })] })), filterOptions.length !== 0 ? (filterOptions.map((option) => (jsxRuntimeExports.jsxs(MenuItem, Object.assign({ value: `${option.value}`, sx: { zIndex: 0, fontSize: "11px !important" } }, { children: [jsxRuntimeExports.jsx(Checkbox, { checked: fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.split(",").some((value) => value === option.value), size: "small" }), jsxRuntimeExports.jsx(ListItemText, { primary: option.label, sx: {
|
|
63196
|
+
fontSize: "5px !important",
|
|
63197
|
+
"& span": {
|
|
63198
|
+
fontSize: "12px !important",
|
|
63199
|
+
},
|
|
63200
|
+
} })] }), option.value)))) : (jsxRuntimeExports.jsx(MenuItem, Object.assign({ disabled: true, value: "NA" }, { children: "No data Found" }), "NA"))] })) })) }));
|
|
63201
|
+
}
|
|
63202
|
+
|
|
63073
63203
|
exports.BoxTP = Box;
|
|
63074
63204
|
exports.ButtonTP = Button;
|
|
63075
63205
|
exports.DeleteField = DeleteField;
|
|
63076
63206
|
exports.DeleteFieldTP = DeleteField;
|
|
63077
63207
|
exports.Experimental_CssVarsProvider = CssVarsProvider;
|
|
63078
63208
|
exports.GridTP = Grid;
|
|
63209
|
+
exports.MultiSelectFieldComponent = MultiSelectFieldComponent;
|
|
63079
63210
|
exports.RenderForm = FormRenderWrapper;
|
|
63080
63211
|
exports.RenderFormTP = FormRenderWrapper;
|
|
63081
63212
|
exports.SessionTimeoutField = SessionTimeOut;
|