tp-react-elements-dev 1.12.21 → 1.12.22
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/DeleteComponent/DeleteField.js +24 -0
- package/dist/components/Form/Form.styles.js +111 -0
- package/dist/components/Form/FormActiveSwitch.js +27 -0
- package/dist/components/Form/FormConstants.d.ts +1 -1
- package/dist/components/Form/FormConstants.d.ts.map +1 -1
- package/dist/components/Form/FormConstants.js +336 -0
- package/dist/components/Form/FormRender.d.ts +1 -1
- package/dist/components/Form/FormRender.d.ts.map +1 -1
- package/dist/components/Form/FormRender.js +96 -0
- package/dist/components/Form/FormRenderWrapper.d.ts +1 -1
- package/dist/components/Form/FormRenderWrapper.d.ts.map +1 -1
- package/dist/components/Form/FormRenderWrapper.js +13 -0
- package/dist/components/FormComponents/DatePicker/DateRangePicker.d.ts +1 -1
- package/dist/components/FormComponents/DatePicker/DateRangePicker.d.ts.map +1 -1
- package/dist/components/FormComponents/DatePicker/DatepickerWrapperV2.d.ts +1 -1
- package/dist/components/FormComponents/DatePicker/DatepickerWrapperV2.d.ts.map +1 -1
- package/dist/components/FormComponents/DatePicker/DatepickerWrapperV2.js +58 -0
- package/dist/components/FormComponents/DatePicker/MonthPicker.js +48 -0
- package/dist/components/FormComponents/DatePicker/Monthpickerrender.d.ts +1 -1
- package/dist/components/FormComponents/DatePicker/Monthpickerrender.d.ts.map +1 -1
- package/dist/components/FormComponents/DatePicker/Monthpickerrender.js +61 -0
- package/dist/components/FormComponents/FileUpload/FormRenderFileUpload.d.ts +1 -1
- package/dist/components/FormComponents/FileUpload/FormRenderFileUpload.d.ts.map +1 -1
- package/dist/components/FormComponents/FileUpload/FormRenderFileUpload.js +86 -0
- package/dist/components/FormComponents/FileUpload/FormRenderMultiFileUpload.d.ts +1 -1
- package/dist/components/FormComponents/FileUpload/FormRenderMultiFileUpload.d.ts.map +1 -1
- package/dist/components/FormComponents/FileUpload/FormRenderMultiFileUpload.js +96 -0
- package/dist/components/FormComponents/FormBottomField/FormBottomField.d.ts +1 -1
- package/dist/components/FormComponents/FormBottomField/FormBottomField.d.ts.map +1 -1
- package/dist/components/FormComponents/FormBottomField/FormBottomField.js +9 -0
- package/dist/components/FormComponents/FormCheckBox/FormCheckBox.d.ts +1 -1
- package/dist/components/FormComponents/FormCheckBox/FormCheckBox.d.ts.map +1 -1
- package/dist/components/FormComponents/FormCheckBox/FormCheckBox.js +10 -0
- package/dist/components/FormComponents/FormCheckBoxGroup/FormCheckBoxGroup.d.ts +1 -1
- package/dist/components/FormComponents/FormCheckBoxGroup/FormCheckBoxGroup.d.ts.map +1 -1
- package/dist/components/FormComponents/FormCheckBoxGroup/FormCheckBoxGroup.js +23 -0
- package/dist/components/FormComponents/FormErrorField/FormErrorField.d.ts +1 -1
- package/dist/components/FormComponents/FormErrorField/FormErrorField.d.ts.map +1 -1
- package/dist/components/FormComponents/FormErrorField/FormErrorField.js +9 -0
- package/dist/components/FormComponents/FormNumberField/FormNumberField.d.ts +1 -1
- package/dist/components/FormComponents/FormNumberField/FormNumberField.d.ts.map +1 -1
- package/dist/components/FormComponents/FormNumberField/FormNumberField.js +49 -0
- package/dist/components/FormComponents/FormNumberField/FormNumberFieldDecimal.d.ts +1 -1
- package/dist/components/FormComponents/FormNumberField/FormNumberFieldDecimal.d.ts.map +1 -1
- package/dist/components/FormComponents/FormNumberField/FormNumberFieldDecimal.js +45 -0
- package/dist/components/FormComponents/FormRadioGroup/FormRadioGroup.d.ts +1 -1
- package/dist/components/FormComponents/FormRadioGroup/FormRadioGroup.d.ts.map +1 -1
- package/dist/components/FormComponents/FormRadioGroup/FormRadioGroup.js +26 -0
- package/dist/components/FormComponents/FormTextAreaField/FormTextAreaField.d.ts +1 -1
- package/dist/components/FormComponents/FormTextAreaField/FormTextAreaField.d.ts.map +1 -1
- package/dist/components/FormComponents/FormTextAreaField/FormTextAreaField.js +31 -0
- package/dist/components/FormComponents/FormTextAreaField/FormTextAreaField.styles.js +35 -0
- package/dist/components/FormComponents/FormTextField/FormTextField.d.ts +1 -1
- package/dist/components/FormComponents/FormTextField/FormTextField.d.ts.map +1 -1
- package/dist/components/FormComponents/FormTextField/FormTextField.js +46 -0
- package/dist/components/FormComponents/FormTextField/FormTextField.styles.js +22 -0
- package/dist/components/FormComponents/HelperText/HelperText.d.ts +1 -1
- package/dist/components/FormComponents/HelperText/HelperText.d.ts.map +1 -1
- package/dist/components/FormComponents/HelperText/HelperText.js +10 -0
- package/dist/components/FormComponents/PasswordField/PasswordField.d.ts +1 -1
- package/dist/components/FormComponents/PasswordField/PasswordField.d.ts.map +1 -1
- package/dist/components/FormComponents/PasswordField/PasswordField.js +49 -0
- package/dist/components/FormComponents/RichTextEditor/RichTextEditor.d.ts +1 -1
- package/dist/components/FormComponents/RichTextEditor/RichTextEditor.d.ts.map +1 -1
- package/dist/components/FormComponents/RichTextEditor/RichTextEditor.js +95 -0
- package/dist/components/FormComponents/RichTextEditor/RichTextEditorWrapper.d.ts +1 -1
- package/dist/components/FormComponents/RichTextEditor/RichTextEditorWrapper.d.ts.map +1 -1
- package/dist/components/FormComponents/RichTextEditor/RichTextEditorWrapper.js +11 -0
- package/dist/components/FormComponents/RichTextEditor/jodit.index.js +27 -0
- package/dist/components/FormComponents/Select/MultiSelectv1.d.ts +1 -1
- package/dist/components/FormComponents/Select/MultiSelectv1.d.ts.map +1 -1
- package/dist/components/FormComponents/Select/MultiSelectv1.js +157 -0
- package/dist/components/FormComponents/Select/SingleSelect.d.ts +1 -1
- package/dist/components/FormComponents/Select/SingleSelect.d.ts.map +1 -1
- package/dist/components/FormComponents/Select/SingleSelect.js +51 -0
- package/dist/components/FormComponents/Select/SingleSelectNonAutoComplete.d.ts +1 -1
- package/dist/components/FormComponents/Select/SingleSelectNonAutoComplete.d.ts.map +1 -1
- package/dist/components/FormComponents/Select/SingleSelectNonAutoComplete.js +27 -0
- package/dist/components/FormComponents/Select/SingleSelectSearchApi.js +204 -0
- package/dist/components/FormComponents/TimePicker/TimePicker.d.ts +1 -1
- package/dist/components/FormComponents/TimePicker/TimePicker.d.ts.map +1 -1
- package/dist/components/FormComponents/TimePicker/TimePicker.js +55 -0
- package/dist/components/FormComponents/YearPickerField/YearPickerField.js +82 -0
- package/dist/components/FormComponents/index.js +26 -0
- package/dist/components/Global.styles.js +79 -0
- package/dist/components/ModalField/ConfirmationDialog.js +48 -0
- package/dist/components/ModalField/ModalField.js +32 -0
- package/dist/components/SelectField/MultiSelectFieldComponent.js +129 -0
- package/dist/components/SessionTimeOut/SessionTimeOut.js +63 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -2648
- package/dist/lib/Constants/FormConstants.d.ts.map +1 -0
- package/dist/lib/Constants/FormConstants.js +54 -0
- package/dist/lib/Constants/FunctionConstants.d.ts.map +1 -0
- package/dist/lib/Constants/FunctionConstants.js +244 -0
- package/dist/lib/Interface/FormInterface.d.ts.map +1 -0
- package/dist/lib/index.d.ts +3 -2
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +4 -0
- package/dist/theme/index.js +64 -0
- package/dist/validation/schemas.js +60 -0
- package/package.json +8 -6
- package/dist/Utilities/Constants/FormConstants.d.ts.map +0 -1
- package/dist/Utilities/Constants/FunctionConstants.d.ts.map +0 -1
- package/dist/Utilities/Interface/FormInterface.d.ts.map +0 -1
- package/dist/Utilities/index.d.ts +0 -4
- package/dist/Utilities/index.d.ts.map +0 -1
- package/dist/index.esm.css +0 -1
- package/dist/index.esm.js +0 -2607
- package/dist/lib/cache-buster.d.ts +0 -2
- package/dist/lib/cache-buster.d.ts.map +0 -1
- package/dist/lib/constants.d.ts +0 -2
- package/dist/lib/constants.d.ts.map +0 -1
- package/dist/lib/hook-form.d.ts +0 -4
- package/dist/lib/hook-form.d.ts.map +0 -1
- /package/dist/{Utilities → lib}/Constants/FormConstants.d.ts +0 -0
- /package/dist/{Utilities → lib}/Constants/FunctionConstants.d.ts +0 -0
- /package/dist/{Utilities → lib}/Interface/FormInterface.d.ts +0 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import { Button, Typography, Grid, Dialog, DialogTitle } from '@mui/material';
|
|
3
|
+
|
|
4
|
+
styled(Button) `
|
|
5
|
+
border: 0;
|
|
6
|
+
color: #fff;
|
|
7
|
+
position: absolute;
|
|
8
|
+
text-align: center;
|
|
9
|
+
padding: 5px 12px;
|
|
10
|
+
font-size: 13px;
|
|
11
|
+
height: 30px;
|
|
12
|
+
right: -38px;
|
|
13
|
+
text-transform: none;
|
|
14
|
+
z-index: 2;
|
|
15
|
+
border-radius: 10px 0px 0px 10px;
|
|
16
|
+
&:hover {
|
|
17
|
+
right: 0px;
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
20
|
+
const SubmitButton = styled(Button) `
|
|
21
|
+
text-transform: none;
|
|
22
|
+
`;
|
|
23
|
+
const CancelButton = styled(Button) `
|
|
24
|
+
text-transform: none;
|
|
25
|
+
color: #000;
|
|
26
|
+
background: #ececee;
|
|
27
|
+
&:hover {
|
|
28
|
+
background: #0009;
|
|
29
|
+
color: #fff;
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
32
|
+
const SaveAsDraftButton = styled(Button) `
|
|
33
|
+
text-transform: none;
|
|
34
|
+
font-size: 12px;
|
|
35
|
+
background: orange;
|
|
36
|
+
&:hover {
|
|
37
|
+
background: orange;
|
|
38
|
+
}
|
|
39
|
+
`;
|
|
40
|
+
styled(Typography) ``;
|
|
41
|
+
styled(Grid, {
|
|
42
|
+
shouldForwardProp: (prop) => prop !== "isActive" && prop !== "noOfColumn",
|
|
43
|
+
}) `
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
margin-bottom: 8px;
|
|
46
|
+
min-width: 10%;
|
|
47
|
+
padding-left: 0px;
|
|
48
|
+
z-index: 2;
|
|
49
|
+
padding-right: 0px;
|
|
50
|
+
border: 1px solid #0003;
|
|
51
|
+
font-size: 12px;
|
|
52
|
+
padding: 6px;
|
|
53
|
+
text-align: center;
|
|
54
|
+
&:hover {
|
|
55
|
+
cursor: pointer;
|
|
56
|
+
}
|
|
57
|
+
`;
|
|
58
|
+
const DialogContainer = styled(Dialog) `
|
|
59
|
+
position: fixed;
|
|
60
|
+
top: -16px;
|
|
61
|
+
left: 0;
|
|
62
|
+
right: 0;
|
|
63
|
+
bottom: auto;
|
|
64
|
+
& .css-tlc64q-MuiPaper-root-MuiDialog-paper,
|
|
65
|
+
.css-mbdu2s {
|
|
66
|
+
max-width: 900px;
|
|
67
|
+
}
|
|
68
|
+
`;
|
|
69
|
+
const DialogTitleWrapper = styled(DialogTitle) `
|
|
70
|
+
padding: 8px 16px;
|
|
71
|
+
display: flex;
|
|
72
|
+
align-items: center;
|
|
73
|
+
justify-content: space-between;
|
|
74
|
+
font-size: 14px;
|
|
75
|
+
cursor: move;
|
|
76
|
+
border-bottom: 1px solid rgb(229 231 235 / 1);
|
|
77
|
+
`;
|
|
78
|
+
|
|
79
|
+
export { CancelButton, DialogContainer, DialogTitleWrapper, SaveAsDraftButton, SubmitButton };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import CloseIcon from '@mui/icons-material/Close';
|
|
3
|
+
import { Dialog, Slide, DialogTitle, DialogContent, Typography, Grid, DialogActions, Button } from '@mui/material';
|
|
4
|
+
import { SubmitButton } from '../Global.styles.js';
|
|
5
|
+
|
|
6
|
+
const ConfirmationDialog = ({ openConfirmDialog, handleCancel, onClickSubmit, text, Submit = "Submit", Cancel = "Cancel", buttonStyleProps, }) => {
|
|
7
|
+
return (jsxs(Dialog, { open: openConfirmDialog, TransitionComponent: Slide, fullWidth: true, sx: {
|
|
8
|
+
position: "fixed",
|
|
9
|
+
top: "10%",
|
|
10
|
+
left: 0,
|
|
11
|
+
right: 0,
|
|
12
|
+
bottom: "auto",
|
|
13
|
+
"& .css-tlc64q-MuiPaper-root-MuiDialog-paper,.css-mbdu2s": {
|
|
14
|
+
maxWidth: "500px",
|
|
15
|
+
},
|
|
16
|
+
zIndex: 40,
|
|
17
|
+
}, "aria-labelledby": "draggable-dialog-title", children: [jsxs(DialogTitle, { sx: {
|
|
18
|
+
// background: theme.palette.primary.main,
|
|
19
|
+
// color: "#fff",
|
|
20
|
+
padding: "8px 16px",
|
|
21
|
+
display: "flex",
|
|
22
|
+
alignItems: "center",
|
|
23
|
+
justifyContent: "space-between",
|
|
24
|
+
// fontFamily: "Roboto",
|
|
25
|
+
fontSize: "14px",
|
|
26
|
+
cursor: "move",
|
|
27
|
+
borderBottom: "1px solid rgb(229 231 235 / 1)",
|
|
28
|
+
}, children: [jsx("span", { children: "Confirmation Dailog" }), jsx(CloseIcon, { sx: { cursor: "pointer" }, onClick: () => handleCancel() })] }), jsxs(DialogContent, { style: { paddingTop: "20px", paddingBottom: 0 }, sx: {
|
|
29
|
+
"& .pt-0": {
|
|
30
|
+
paddingTop: 0,
|
|
31
|
+
},
|
|
32
|
+
}, children: [jsx(Typography, { children: text }), jsx(Grid, { container: true, gap: 3 })] }), jsx(DialogActions, { sx: { borderTop: "1px solid #e0e0e0", marginTop: 3 }, children: jsxs("div", { style: {
|
|
33
|
+
display: "flex",
|
|
34
|
+
justifyContent: "flex-end",
|
|
35
|
+
gap: "8px",
|
|
36
|
+
}, children: [jsx(SubmitButton, { variant: "contained", size: "small", type: "submit", onClick: () => onClickSubmit(), sx: {
|
|
37
|
+
...buttonStyleProps,
|
|
38
|
+
}, children: Submit }), jsx(Button, { variant: "text",
|
|
39
|
+
// color="error"
|
|
40
|
+
size: "small", sx: {
|
|
41
|
+
textTransform: "none",
|
|
42
|
+
color: "#000",
|
|
43
|
+
background: "#ececee",
|
|
44
|
+
":hover": { background: "#0009", color: "#fff" },
|
|
45
|
+
}, onClick: () => handleCancel(), children: Cancel })] }) })] }));
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export { ConfirmationDialog as default };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import CloseIcon from '@mui/icons-material/Close';
|
|
3
|
+
import { DialogContent, DialogActions, Slide } from '@mui/material';
|
|
4
|
+
import { DialogContainer, DialogTitleWrapper, SaveAsDraftButton, SubmitButton, CancelButton } from '../Global.styles.js';
|
|
5
|
+
|
|
6
|
+
const ModalField = ({ name, openModal, handleCancel, content, width = "900px", Transition = "", handleSubmit, styles = {}, saveButton: isSaveButton = false, submitButton = true, handleSaveButton = () => null, SubmitButtonName = "Submit", }) => {
|
|
7
|
+
const TransitionComponent = () => {
|
|
8
|
+
switch (Transition) {
|
|
9
|
+
case "Slide":
|
|
10
|
+
return Slide;
|
|
11
|
+
default:
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
return (jsxs(DialogContainer, { open: openModal, TransitionComponent: TransitionComponent(), fullWidth: true, "aria-labelledby": "draggable-dialog-title", sx: {
|
|
16
|
+
zIndex: 20,
|
|
17
|
+
"& .css-tlc64q-MuiPaper-root-MuiDialog-paper,.css-mbdu2s": {
|
|
18
|
+
maxWidth: width,
|
|
19
|
+
},
|
|
20
|
+
...styles,
|
|
21
|
+
}, children: [jsxs(DialogTitleWrapper, { children: [jsx("span", { children: name }), jsx(CloseIcon, { sx: { cursor: "pointer" }, onClick: () => handleCancel() })] }), jsx(DialogContent, { style: { paddingTop: "20px", paddingBottom: 0 }, sx: {
|
|
22
|
+
"& .pt-0": {
|
|
23
|
+
paddingTop: 0,
|
|
24
|
+
},
|
|
25
|
+
}, children: content }), jsx(DialogActions, { sx: { borderTop: "1px solid #e0e0e0", marginTop: 3 }, children: jsxs("div", { style: {
|
|
26
|
+
display: "flex",
|
|
27
|
+
justifyContent: "flex-end",
|
|
28
|
+
gap: "8px",
|
|
29
|
+
}, children: [isSaveButton && (jsx(SaveAsDraftButton, { variant: "contained", size: "small", onClick: () => handleSaveButton(), children: "Save" })), submitButton && (jsx(SubmitButton, { variant: "contained", size: "small", onClick: () => handleSubmit(), children: SubmitButtonName })), jsx(CancelButton, { variant: "text", size: "small", onClick: () => handleCancel(), children: "Cancel" })] }) })] }));
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { ModalField as default };
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { Box, TextField, Tooltip } from '@mui/material';
|
|
3
|
+
import Checkbox from '@mui/material/Checkbox';
|
|
4
|
+
import FormControl from '@mui/material/FormControl';
|
|
5
|
+
import ListItemText from '@mui/material/ListItemText';
|
|
6
|
+
import MenuItem from '@mui/material/MenuItem';
|
|
7
|
+
import Select from '@mui/material/Select';
|
|
8
|
+
import * as React from 'react';
|
|
9
|
+
import { useState } from 'react';
|
|
10
|
+
|
|
11
|
+
const ITEM_HEIGHT = 48;
|
|
12
|
+
const ITEM_PADDING_TOP = 3;
|
|
13
|
+
const MenuProps = {
|
|
14
|
+
PaperProps: {
|
|
15
|
+
style: {
|
|
16
|
+
maxHeight: ITEM_HEIGHT * 5.5 + ITEM_PADDING_TOP,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
autoFocus: false,
|
|
20
|
+
disableAutoFocusItem: true,
|
|
21
|
+
};
|
|
22
|
+
const extractValuesToArray = (inputString) => {
|
|
23
|
+
const valuesArray = inputString?.split(",");
|
|
24
|
+
const trimmedArray = valuesArray?.map((value) => value.trim());
|
|
25
|
+
return trimmedArray;
|
|
26
|
+
};
|
|
27
|
+
function MultiSelectFieldComponent({ value, options, onChangeFn, disable = false, }) {
|
|
28
|
+
const [personName, setPersonName] = React.useState(value ? extractValuesToArray(value) : []);
|
|
29
|
+
const [searchText, setSearchText] = useState("");
|
|
30
|
+
const [filterOptions, setFilterOptions] = useState(options);
|
|
31
|
+
const [selectAll, setSelectAll] = useState(false);
|
|
32
|
+
const textfieldRef = React.useRef(null);
|
|
33
|
+
const fieldValue = value;
|
|
34
|
+
const mappedIds = filterOptions.map((item) => item.value);
|
|
35
|
+
const filterIds = filterOptions.map((item) => item.value);
|
|
36
|
+
React.useEffect(() => {
|
|
37
|
+
if (searchText !== "") {
|
|
38
|
+
setFilterOptions(options.filter((item) => item.label.toLowerCase().includes(searchText.toLowerCase())));
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
setFilterOptions(options);
|
|
42
|
+
}
|
|
43
|
+
}, [options, searchText]);
|
|
44
|
+
function hasExactMatch(array, value) {
|
|
45
|
+
return array.some((item) => item === value);
|
|
46
|
+
}
|
|
47
|
+
React.useEffect(() => {
|
|
48
|
+
if (fieldValue?.split(",").length !== filterOptions.length) {
|
|
49
|
+
setSelectAll(false);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
if (fieldValue
|
|
53
|
+
?.split(",")
|
|
54
|
+
.every((value) => hasExactMatch(filterIds, value))) {
|
|
55
|
+
setSelectAll(true);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}, [filterOptions, fieldValue]);
|
|
59
|
+
const handleChange = (event) => {
|
|
60
|
+
const { target: { value }, } = event;
|
|
61
|
+
setPersonName(typeof value === "string" ? value?.split(",") : value);
|
|
62
|
+
onChangeFn((typeof value === "string" ? value?.split(",") : value).join(","));
|
|
63
|
+
};
|
|
64
|
+
const selectedOptions = options.filter((item) => fieldValue?.split(",").some((value) => value === item.value));
|
|
65
|
+
const selectedValues = selectedOptions
|
|
66
|
+
.map((item) => item.label)
|
|
67
|
+
.join(" , ");
|
|
68
|
+
return (jsx(Box, { children: jsx(FormControl, { fullWidth: true, sx: {
|
|
69
|
+
"& .css-kichxs-MuiFormLabel-root-MuiInputLabel-root,.css-1holvmy": {
|
|
70
|
+
top: "-10px",
|
|
71
|
+
},
|
|
72
|
+
}, children: jsxs(Select, { labelId: "demo-multiple-checkbox-label", id: "demo-multiple-checkbox", multiple: true, sx: {
|
|
73
|
+
"& .MuiTypography-root": {
|
|
74
|
+
fontSize: "5px !important",
|
|
75
|
+
},
|
|
76
|
+
}, disabled: disable, value: value ? extractValuesToArray(value) : [], onChange: handleChange, onOpen: () => {
|
|
77
|
+
setTimeout(() => {
|
|
78
|
+
if (textfieldRef.current) {
|
|
79
|
+
textfieldRef.current?.focus();
|
|
80
|
+
}
|
|
81
|
+
}, 0);
|
|
82
|
+
}, onClose: () => {
|
|
83
|
+
setSearchText("");
|
|
84
|
+
}, renderValue: () => (jsx(Tooltip, { title: selectedValues, children: jsx("span", { children: selectedOptions.length > 3
|
|
85
|
+
? `${selectedOptions.length} Selected`
|
|
86
|
+
: selectedValues }) })), MenuProps: MenuProps, autoFocus: false, children: [jsx(Box, { sx: {
|
|
87
|
+
width: "100%",
|
|
88
|
+
position: "sticky",
|
|
89
|
+
top: "0px",
|
|
90
|
+
padding: "7px",
|
|
91
|
+
zIndex: 2,
|
|
92
|
+
height: "33px",
|
|
93
|
+
background: "#fff",
|
|
94
|
+
display: options.length === 0 ? "none" : undefined,
|
|
95
|
+
}, children: jsx(TextField, { inputRef: textfieldRef, autoFocus: true, value: searchText, sx: {
|
|
96
|
+
width: "100%",
|
|
97
|
+
}, placeholder: "Search...", onChange: (e) => {
|
|
98
|
+
setSearchText(e.target.value);
|
|
99
|
+
}, onKeyDown: (e) => {
|
|
100
|
+
if (e.key !== "Escape") {
|
|
101
|
+
e.stopPropagation();
|
|
102
|
+
}
|
|
103
|
+
} }) }), jsxs(MenuItem, { disabled: filterOptions.length === 0, sx: { zIndex: 0, fontSize: "5px !important" }, children: [jsx(Checkbox, { size: "small", checked: selectAll, onChange: () => {
|
|
104
|
+
setSelectAll(!selectAll);
|
|
105
|
+
const selectChanged = !selectAll;
|
|
106
|
+
if (!selectChanged) {
|
|
107
|
+
onChangeFn("");
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
const allDataMapped = mappedIds.join(",");
|
|
111
|
+
console.log(allDataMapped, "allDataMapped");
|
|
112
|
+
onChangeFn(allDataMapped);
|
|
113
|
+
}
|
|
114
|
+
} }), jsx(ListItemText, { primary: "Select All", sx: {
|
|
115
|
+
fontSize: "5px !important",
|
|
116
|
+
"& span": {
|
|
117
|
+
fontSize: "12px !important",
|
|
118
|
+
},
|
|
119
|
+
} })] }), filterOptions.length !== 0 ? (filterOptions.map((option) => (jsxs(MenuItem, { value: `${option.value}`, sx: { zIndex: 0, fontSize: "11px !important" }, children: [jsx(Checkbox, { checked: fieldValue
|
|
120
|
+
?.split(",")
|
|
121
|
+
.some((value) => value === option.value), size: "small" }), jsx(ListItemText, { primary: option.label, sx: {
|
|
122
|
+
fontSize: "5px !important",
|
|
123
|
+
"& span": {
|
|
124
|
+
fontSize: "12px !important",
|
|
125
|
+
},
|
|
126
|
+
} })] }, option.value)))) : (jsx(MenuItem, { disabled: true, value: "NA", children: "No data Found" }, "NA"))] }) }) }));
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export { MultiSelectFieldComponent as default };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
import { useIdleTimer } from 'react-idle-timer';
|
|
4
|
+
import ConfirmationDialog from '../ModalField/ConfirmationDialog.js';
|
|
5
|
+
|
|
6
|
+
const secondsToMMSS = (totalSeconds) => {
|
|
7
|
+
const minutes = Math.floor(totalSeconds / 60);
|
|
8
|
+
const seconds = Math.floor(totalSeconds % 60);
|
|
9
|
+
const formattedMinutes = String(minutes).padStart(2, "0");
|
|
10
|
+
const formattedSeconds = String(seconds).padStart(2, "0");
|
|
11
|
+
return `${formattedMinutes}:${formattedSeconds}`;
|
|
12
|
+
};
|
|
13
|
+
const promptBeforeValue = 120000;
|
|
14
|
+
const SessionTimeOut = ({ sessionTime, handleSubmitSession, onSessionExpire, handleSessionCancel, SubmitButtonName = "Submit", buttonStyleProps, }) => {
|
|
15
|
+
const [openConfirmModal, setOpenConfirmModal] = useState(false);
|
|
16
|
+
const expiryDetails = sessionTime;
|
|
17
|
+
const providedTimestamp = new Date(expiryDetails).getTime();
|
|
18
|
+
const currentTimestamp = new Date().getTime();
|
|
19
|
+
const remainingTime = providedTimestamp - currentTimestamp;
|
|
20
|
+
const timeout = remainingTime;
|
|
21
|
+
const promptBeforeIdle = Math.min(promptBeforeValue, timeout - 1000);
|
|
22
|
+
const [, setRemainingTimeInSeconds] = useState(Math.ceil(timeout / 1000));
|
|
23
|
+
const [formattedRemainingTime, setFormattedRemainingTime] = useState(secondsToMMSS(Math.ceil(timeout / 1000)));
|
|
24
|
+
const onIdle = () => {
|
|
25
|
+
if (sessionTime) {
|
|
26
|
+
onSessionExpire();
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const handleSubmit = () => {
|
|
30
|
+
handleSubmitSession();
|
|
31
|
+
setOpenConfirmModal(false);
|
|
32
|
+
};
|
|
33
|
+
const handleCancel = () => {
|
|
34
|
+
handleSessionCancel();
|
|
35
|
+
setOpenConfirmModal(false);
|
|
36
|
+
};
|
|
37
|
+
const onPrompt = () => {
|
|
38
|
+
setOpenConfirmModal(true);
|
|
39
|
+
};
|
|
40
|
+
const { getRemainingTime } = useIdleTimer({
|
|
41
|
+
onIdle,
|
|
42
|
+
onPrompt,
|
|
43
|
+
promptBeforeIdle,
|
|
44
|
+
timeout,
|
|
45
|
+
throttle: 1000, // Adjust throttle to reduce delays
|
|
46
|
+
});
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
const interval = setInterval(() => {
|
|
49
|
+
const remainingSeconds = Math.ceil(getRemainingTime() / 1000);
|
|
50
|
+
setRemainingTimeInSeconds(promptBeforeIdle !== promptBeforeValue ? remainingSeconds : 0);
|
|
51
|
+
const formattedTime = secondsToMMSS(remainingSeconds);
|
|
52
|
+
setFormattedRemainingTime(promptBeforeIdle !== promptBeforeValue ? formattedTime : "00:00");
|
|
53
|
+
}, 1000); // Adjust interval to 1000 ms
|
|
54
|
+
return () => {
|
|
55
|
+
clearInterval(interval);
|
|
56
|
+
};
|
|
57
|
+
}, [promptBeforeIdle, getRemainingTime]);
|
|
58
|
+
const sessionMessage = `Your session will expire in ${formattedRemainingTime} seconds. Do you want to extend the session?`;
|
|
59
|
+
console.log(promptBeforeIdle, "promptBeforeIdle");
|
|
60
|
+
return (jsx(Fragment, { children: jsx(ConfirmationDialog, { openConfirmDialog: openConfirmModal, handleCancel: handleCancel, onClickSubmit: handleSubmit, text: sessionMessage, Submit: SubmitButtonName, buttonStyleProps: buttonStyleProps }) }));
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export { SessionTimeOut as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { ConfirmationDialog, DeleteField, ModalField, MultiSelectFieldComponent, RenderForm, SessionTimeoutField, useFormValidatingContext, } from "./components";
|
|
2
|
-
export { calculateTotalArrayValueTotal, checkIsDateIsBefore, findMenuHierarchy, getDesiredDate, getFormattedDate, getInitials, getUsernameFromEmail, handleDownloadReactTableDataExcel, lightenColor, } from "./
|
|
2
|
+
export { calculateTotalArrayValueTotal, checkIsDateIsBefore, findMenuHierarchy, getDesiredDate, getFormattedDate, getInitials, getUsernameFromEmail, handleDownloadReactTableDataExcel, lightenColor, } from "./lib";
|
|
3
3
|
export * as FormComponents from "./components/FormComponents";
|
|
4
|
-
export * as Utils from "./
|
|
4
|
+
export * as Utils from "./lib";
|
|
5
5
|
export * as ValidationSchemas from "./validation/schemas";
|
|
6
6
|
export * as Theme from "./theme";
|
|
7
|
-
export type { FormRenderProps } from "./
|
|
7
|
+
export type { FormRenderProps } from "./lib/Interface/FormInterface";
|
|
8
8
|
export type { FormRenderWrapperProps } from "./components/Form/FormRenderWrapper";
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,UAAU,EACV,yBAAyB,EACzB,UAAU,EACV,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,6BAA6B,EAC7B,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,oBAAoB,EACpB,iCAAiC,EACjC,YAAY,GACb,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,UAAU,EACV,yBAAyB,EACzB,UAAU,EACV,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,6BAA6B,EAC7B,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,oBAAoB,EACpB,iCAAiC,EACjC,YAAY,GACb,MAAM,OAAO,CAAC;AAOf,OAAO,KAAK,cAAc,MAAM,6BAA6B,CAAC;AAG9D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,iBAAiB,MAAM,sBAAsB,CAAC;AAG1D,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAOjC,YAAY,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACrE,YAAY,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC"}
|