tp-react-elements-dev 1.10.8 → 1.10.11
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/Form/FormRender.d.ts +1 -0
- 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 +140 -12
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +140 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface MultiSelectProps {
|
|
2
|
+
value: string;
|
|
3
|
+
options: {
|
|
4
|
+
value: number | string;
|
|
5
|
+
label: string;
|
|
6
|
+
}[];
|
|
7
|
+
onChangeFn: (e: any) => void;
|
|
8
|
+
disable?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export default function MultiSelectFieldComponent({ value, options, onChangeFn, disable, }: MultiSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -7,3 +7,4 @@ export { Box as BoxTP } from "@mui/material";
|
|
|
7
7
|
export { Grid as GridTP } from "@mui/material";
|
|
8
8
|
export { ThemeProvider as ThemeProviderTP } from "@emotion/react";
|
|
9
9
|
export * from '@mui/material/styles';
|
|
10
|
+
export { default as MultiSelectFieldComponent } from '../components/SelectField/MultiSelectFieldComponent';
|
package/dist/index.d.ts
CHANGED
|
@@ -17,3 +17,4 @@ export { default as DeleteFieldTP } from "./components/DeleteComponent/DeleteFie
|
|
|
17
17
|
export { default as SessionTimeoutFieldTP } from "./components/SessionTimeOut/SessionTimeOut";
|
|
18
18
|
export { useForm as useFormElementTP };
|
|
19
19
|
export { yupResolver as yupResolverTP };
|
|
20
|
+
export { default as MultiSelectFieldComponent } from './components/SelectField/MultiSelectFieldComponent';
|
package/dist/index.esm.js
CHANGED
|
@@ -54012,12 +54012,12 @@ function makeStyles(stylesOrCreator, options = {}) {
|
|
|
54012
54012
|
return useStyles;
|
|
54013
54013
|
}
|
|
54014
54014
|
|
|
54015
|
-
const ITEM_HEIGHT = 48;
|
|
54016
|
-
const ITEM_PADDING_TOP = 3;
|
|
54017
|
-
const MenuProps = {
|
|
54015
|
+
const ITEM_HEIGHT$1 = 48;
|
|
54016
|
+
const ITEM_PADDING_TOP$1 = 3;
|
|
54017
|
+
const MenuProps$1 = {
|
|
54018
54018
|
PaperProps: {
|
|
54019
54019
|
style: {
|
|
54020
|
-
maxHeight: ITEM_HEIGHT * 5.5 + ITEM_PADDING_TOP,
|
|
54020
|
+
maxHeight: ITEM_HEIGHT$1 * 5.5 + ITEM_PADDING_TOP$1,
|
|
54021
54021
|
// width: 250,
|
|
54022
54022
|
},
|
|
54023
54023
|
},
|
|
@@ -54032,7 +54032,7 @@ makeStyles((theme) => ({
|
|
|
54032
54032
|
fontSize: "11px",
|
|
54033
54033
|
},
|
|
54034
54034
|
}));
|
|
54035
|
-
const extractValuesToArray = (inputString) => {
|
|
54035
|
+
const extractValuesToArray$1 = (inputString) => {
|
|
54036
54036
|
const valuesArray = inputString === null || inputString === void 0 ? void 0 : inputString.split(",");
|
|
54037
54037
|
const trimmedArray = valuesArray === null || valuesArray === void 0 ? void 0 : valuesArray.map((value) => value.trim());
|
|
54038
54038
|
return trimmedArray;
|
|
@@ -54041,7 +54041,7 @@ function MultiSelectV1({ props, variant }) {
|
|
|
54041
54041
|
var _a;
|
|
54042
54042
|
console.log(props, "ksjh");
|
|
54043
54043
|
const [personName, setPersonName] = React$1.useState(props.getValues(props.item.name)
|
|
54044
|
-
? extractValuesToArray(props.getValues(props.item.name))
|
|
54044
|
+
? extractValuesToArray$1(props.getValues(props.item.name))
|
|
54045
54045
|
: []);
|
|
54046
54046
|
const [searchText, setSearchText] = useState("");
|
|
54047
54047
|
const options = (_a = props.item) === null || _a === void 0 ? void 0 : _a.options;
|
|
@@ -54102,7 +54102,7 @@ function MultiSelectV1({ props, variant }) {
|
|
|
54102
54102
|
fontSize: "5px !important",
|
|
54103
54103
|
},
|
|
54104
54104
|
}, disabled: props.item.disable, value: props.getValues(props.item.name)
|
|
54105
|
-
? extractValuesToArray(props.getValues(props.item.name))
|
|
54105
|
+
? extractValuesToArray$1(props.getValues(props.item.name))
|
|
54106
54106
|
: [], onChange: handleChange, onOpen: () => {
|
|
54107
54107
|
setTimeout(() => {
|
|
54108
54108
|
var _a;
|
|
@@ -54116,7 +54116,7 @@ function MultiSelectV1({ props, variant }) {
|
|
|
54116
54116
|
((_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());
|
|
54117
54117
|
}, input: jsxRuntimeExports.jsx(OutlinedInput, { label: variant !== "standard" ? props.item.label : '' }), renderValue: (selected) => (jsxRuntimeExports.jsx(Tooltip, Object.assign({ title: selectedValues }, { children: selectedOptions.length > 3
|
|
54118
54118
|
? selectedOptions.length + " Selected"
|
|
54119
|
-
: selectedValues }))), MenuProps: MenuProps, autoFocus: false }, { children: [jsxRuntimeExports.jsx(Box, Object.assign({ sx: {
|
|
54119
|
+
: selectedValues }))), MenuProps: MenuProps$1, autoFocus: false }, { children: [jsxRuntimeExports.jsx(Box, Object.assign({ sx: {
|
|
54120
54120
|
width: "100%",
|
|
54121
54121
|
position: "sticky",
|
|
54122
54122
|
top: "0px",
|
|
@@ -59543,9 +59543,7 @@ function formatDayjsToCustomTime(date) {
|
|
|
59543
59543
|
}
|
|
59544
59544
|
function TimePickerFieldWrapper({ props, }) {
|
|
59545
59545
|
const value = props.getValues(props.item.name);
|
|
59546
|
-
return (jsxRuntimeExports.jsxs(LocalizationProvider, Object.assign({ dateAdapter: AdapterDayjs }, { children: [jsxRuntimeExports.jsx(Controller, { name: "time", control: props.control, render: ({ field }) => (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [" ", renderLabel(props.variant, props), jsxRuntimeExports.jsx(TimePicker
|
|
59547
|
-
// ampm={false}
|
|
59548
|
-
, Object.assign({}, field, { value: value ? parseCustomTime(value) : null, onChange: (newTime) => {
|
|
59546
|
+
return (jsxRuntimeExports.jsxs(LocalizationProvider, Object.assign({ dateAdapter: AdapterDayjs }, { children: [jsxRuntimeExports.jsx(Controller, { name: "time", control: props.control, render: ({ field }) => (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [" ", renderLabel(props.variant, props), jsxRuntimeExports.jsx(TimePicker, Object.assign({ ampm: props.item.ampm ? true : false }, field, { value: value ? parseCustomTime(value) : null, onChange: (newTime) => {
|
|
59549
59547
|
const parsedTime = parseCustomTime(formatDayjsToCustomTime(newTime));
|
|
59550
59548
|
const min = props.item.minTime
|
|
59551
59549
|
? parseCustomTime(props.item.minTime)
|
|
@@ -63050,5 +63048,135 @@ const SessionTimeOut = ({ sessionTime, handleSubmitSession, onSessionExpire, han
|
|
|
63050
63048
|
return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsx(ConfirmationDialog, { openConfirmDialog: openConfirmModal, handleCancel: handleCancel, onClickSubmit: handleSubmit, text: sessionMessage, Submit: SubmitButtonName, buttonStyleProps: buttonStyleProps }) }));
|
|
63051
63049
|
};
|
|
63052
63050
|
|
|
63053
|
-
|
|
63051
|
+
const ITEM_HEIGHT = 48;
|
|
63052
|
+
const ITEM_PADDING_TOP = 3;
|
|
63053
|
+
const MenuProps = {
|
|
63054
|
+
PaperProps: {
|
|
63055
|
+
style: {
|
|
63056
|
+
maxHeight: ITEM_HEIGHT * 5.5 + ITEM_PADDING_TOP,
|
|
63057
|
+
// width: 250,
|
|
63058
|
+
},
|
|
63059
|
+
},
|
|
63060
|
+
autoFocus: false,
|
|
63061
|
+
disableAutoFocusItem: true,
|
|
63062
|
+
};
|
|
63063
|
+
makeStyles((theme) => ({
|
|
63064
|
+
option: {
|
|
63065
|
+
fontSize: "10px", // Adjust the font size as needed
|
|
63066
|
+
},
|
|
63067
|
+
option2: {
|
|
63068
|
+
fontSize: "11px",
|
|
63069
|
+
},
|
|
63070
|
+
}));
|
|
63071
|
+
const extractValuesToArray = (inputString) => {
|
|
63072
|
+
const valuesArray = inputString === null || inputString === void 0 ? void 0 : inputString.split(",");
|
|
63073
|
+
const trimmedArray = valuesArray === null || valuesArray === void 0 ? void 0 : valuesArray.map((value) => value.trim());
|
|
63074
|
+
return trimmedArray;
|
|
63075
|
+
};
|
|
63076
|
+
function MultiSelectFieldComponent({ value, options, onChangeFn, disable = false, }) {
|
|
63077
|
+
const [personName, setPersonName] = React$1.useState(value ? extractValuesToArray(value) : []);
|
|
63078
|
+
const [searchText, setSearchText] = useState("");
|
|
63079
|
+
const [filterOptions, setFilterOptions] = useState(options);
|
|
63080
|
+
const [selectAll, setSelectAll] = useState(false);
|
|
63081
|
+
const textfieldRef = React$1.useRef();
|
|
63082
|
+
const fieldValue = value;
|
|
63083
|
+
const mappedIds = filterOptions.map((item) => item.value);
|
|
63084
|
+
const filterIds = filterOptions.map((item) => item.value);
|
|
63085
|
+
// console.log(value, "mnnmnmnnn");
|
|
63086
|
+
React$1.useEffect(() => {
|
|
63087
|
+
// setFilterOptions(options);
|
|
63088
|
+
if (searchText !== "") {
|
|
63089
|
+
setFilterOptions(options.filter((item) => item.label.toLowerCase().includes(searchText.toLowerCase())));
|
|
63090
|
+
}
|
|
63091
|
+
else {
|
|
63092
|
+
setFilterOptions(options);
|
|
63093
|
+
}
|
|
63094
|
+
}, [options, searchText]);
|
|
63095
|
+
function hasExactMatch(array, value) {
|
|
63096
|
+
return array.some((item) => item === value);
|
|
63097
|
+
}
|
|
63098
|
+
React$1.useEffect(() => {
|
|
63099
|
+
if ((fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.split(",").length) !== filterOptions.length) {
|
|
63100
|
+
setSelectAll(false);
|
|
63101
|
+
}
|
|
63102
|
+
else {
|
|
63103
|
+
console.log(fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.split(","), 'fieldValue?.split(",")', filterIds);
|
|
63104
|
+
if (fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.split(",").every((value) => hasExactMatch(filterIds, value))) {
|
|
63105
|
+
setSelectAll(true);
|
|
63106
|
+
}
|
|
63107
|
+
}
|
|
63108
|
+
}, [filterOptions, fieldValue]);
|
|
63109
|
+
const handleChange = (event) => {
|
|
63110
|
+
const { target: { value }, } = event;
|
|
63111
|
+
setPersonName(typeof value === "string" ? value === null || value === void 0 ? void 0 : value.split(",") : value);
|
|
63112
|
+
onChangeFn((typeof value === "string" ? value === null || value === void 0 ? void 0 : value.split(",") : value).join(","));
|
|
63113
|
+
};
|
|
63114
|
+
const selectedOptions = options.filter((item) => fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.split(",").some((value) => value === item.value));
|
|
63115
|
+
const selectedValues = selectedOptions
|
|
63116
|
+
.map((item) => item.label)
|
|
63117
|
+
.join(" , ");
|
|
63118
|
+
// console.log(fieldValue,'sjshshsh');
|
|
63119
|
+
console.log(value, "value");
|
|
63120
|
+
return (jsxRuntimeExports.jsx(Box, { children: jsxRuntimeExports.jsx(FormControl, Object.assign({ fullWidth: true, sx: {
|
|
63121
|
+
"& .css-kichxs-MuiFormLabel-root-MuiInputLabel-root,.css-1holvmy": {
|
|
63122
|
+
top: "-10px",
|
|
63123
|
+
},
|
|
63124
|
+
} }, { children: jsxRuntimeExports.jsxs(Select, Object.assign({ labelId: "demo-multiple-checkbox-label", id: "demo-multiple-checkbox", multiple: true, sx: {
|
|
63125
|
+
"& .MuiTypography-root": {
|
|
63126
|
+
fontSize: "5px !important",
|
|
63127
|
+
},
|
|
63128
|
+
}, disabled: disable, value: value ? extractValuesToArray(value) : [], onChange: handleChange, onOpen: () => {
|
|
63129
|
+
setTimeout(() => {
|
|
63130
|
+
var _a;
|
|
63131
|
+
if (textfieldRef.current) {
|
|
63132
|
+
(_a = textfieldRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
63133
|
+
}
|
|
63134
|
+
}, 0);
|
|
63135
|
+
}, onClose: () => {
|
|
63136
|
+
setSearchText("");
|
|
63137
|
+
// props?.item?.onCloseMenu && props?.item?.onCloseMenu();
|
|
63138
|
+
}, renderValue: (selected) => (jsxRuntimeExports.jsx(Tooltip, Object.assign({ title: selectedValues }, { children: selectedOptions.length > 3
|
|
63139
|
+
? selectedOptions.length + " Selected"
|
|
63140
|
+
: selectedValues }))), MenuProps: MenuProps, autoFocus: false }, { children: [jsxRuntimeExports.jsx(Box, Object.assign({ sx: {
|
|
63141
|
+
width: "100%",
|
|
63142
|
+
position: "sticky",
|
|
63143
|
+
top: "0px",
|
|
63144
|
+
padding: "7px",
|
|
63145
|
+
zIndex: 2,
|
|
63146
|
+
height: "33px",
|
|
63147
|
+
background: "#fff",
|
|
63148
|
+
display: options.length === 0 ? "none" : undefined,
|
|
63149
|
+
} }, { children: jsxRuntimeExports.jsx(TextField, { inputRef: textfieldRef, autoFocus: true, value: searchText, sx: {
|
|
63150
|
+
width: "100%",
|
|
63151
|
+
}, placeholder: "Search...", onChange: (e) => {
|
|
63152
|
+
setSearchText(e.target.value);
|
|
63153
|
+
}, onKeyDown: (e) => {
|
|
63154
|
+
if (e.key !== "Escape") {
|
|
63155
|
+
e.stopPropagation();
|
|
63156
|
+
}
|
|
63157
|
+
} }) })), 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) => {
|
|
63158
|
+
setSelectAll(!selectAll);
|
|
63159
|
+
const selectChanged = !selectAll;
|
|
63160
|
+
if (!selectChanged) {
|
|
63161
|
+
onChangeFn("");
|
|
63162
|
+
}
|
|
63163
|
+
else {
|
|
63164
|
+
const allDataMapped = mappedIds.join(",");
|
|
63165
|
+
console.log(allDataMapped, "allDataMapped");
|
|
63166
|
+
onChangeFn(allDataMapped);
|
|
63167
|
+
}
|
|
63168
|
+
} }), jsxRuntimeExports.jsx(ListItemText, { primary: "Select All", sx: {
|
|
63169
|
+
fontSize: "5px !important",
|
|
63170
|
+
"& span": {
|
|
63171
|
+
fontSize: "12px !important",
|
|
63172
|
+
},
|
|
63173
|
+
} })] })), 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: {
|
|
63174
|
+
fontSize: "5px !important",
|
|
63175
|
+
"& span": {
|
|
63176
|
+
fontSize: "12px !important",
|
|
63177
|
+
},
|
|
63178
|
+
} })] }), option.value)))) : (jsxRuntimeExports.jsx(MenuItem, Object.assign({ disabled: true, value: "NA" }, { children: "No data Found" }), "NA"))] })) })) }));
|
|
63179
|
+
}
|
|
63180
|
+
|
|
63181
|
+
export { Box as BoxTP, Button as ButtonTP, DeleteField, DeleteField as DeleteFieldTP, CssVarsProvider as Experimental_CssVarsProvider, Grid as GridTP, MultiSelectFieldComponent, FormRenderWrapper as RenderForm, FormRenderWrapper as RenderFormTP, SessionTimeOut as SessionTimeoutField, SessionTimeOut as SessionTimeoutFieldTP, StyledEngineProvider, THEME_ID, ThemeProvider, ThemeProvider$3 as ThemeProviderTP, Typography as TypographyTP, adaptV4Theme, alpha, createMuiTheme, createStyles, createTheme, css$1 as css, darken, decomposeColor, duration, easing, emphasize, styled$1 as experimentalStyled, extendTheme as experimental_extendTheme, experimental_sx, getContrastRatio, getInitColorSchemeScript, getLuminance, getOverlayAlpha$1 as getOverlayAlpha, hexToRgb, hslToRgb, keyframes, lighten, makeStyles$1 as makeStyles, createMixins as private_createMixins, createTypography as private_createTypography, excludeVariablesFromRoot$1 as private_excludeVariablesFromRoot, recomposeColor, responsiveFontSizes, rgbToHex, shouldSkipGeneratingVar, styled$1 as styled, createMuiStrictModeTheme as unstable_createMuiStrictModeTheme, getUnit as unstable_getUnit, toUnitless as unstable_toUnitless, useColorScheme, useForm as useFormElement, useForm as useFormElementTP, useFormValidatingContext, useFormValidatingContext as useFormValidatingContextTP, useTheme$2 as useTheme, useThemeProps$1 as useThemeProps, withStyles, withTheme, o as yupResolverTP };
|
|
63054
63182
|
//# sourceMappingURL=index.esm.js.map
|