mui-design-system 0.0.21 → 0.0.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/package.json +1 -1
- package/dist/colors/index.d.ts +0 -4
- package/dist/colors/index.js +0 -93
- package/dist/colors/type.d.ts +0 -5
- package/dist/colors/type.js +0 -1
- package/dist/components/checkbox-list/CheckboxList.d.ts +0 -21
- package/dist/components/checkbox-list/CheckboxList.js +0 -31
- package/dist/components/custom-auto-complete/CustomAutoComplete.d.ts +0 -27
- package/dist/components/custom-auto-complete/CustomAutoComplete.js +0 -75
- package/dist/components/custom-auto-complete/components/AutoCompleteInput.d.ts +0 -21
- package/dist/components/custom-auto-complete/components/AutoCompleteInput.js +0 -29
- package/dist/components/custom-auto-complete/components/ListBox.d.ts +0 -5
- package/dist/components/custom-auto-complete/components/ListBox.js +0 -62
- package/dist/components/custom-auto-complete/components/ListRow.d.ts +0 -2
- package/dist/components/custom-auto-complete/components/ListRow.js +0 -21
- package/dist/components/custom-auto-complete-advanced/CustomAutoComplete.d.ts +0 -28
- package/dist/components/custom-auto-complete-advanced/CustomAutoComplete.js +0 -92
- package/dist/components/custom-auto-complete-advanced/components/ListBox.d.ts +0 -6
- package/dist/components/custom-auto-complete-advanced/components/ListBox.js +0 -76
- package/dist/components/custom-auto-complete-advanced/components/ListRow.d.ts +0 -2
- package/dist/components/custom-auto-complete-advanced/components/ListRow.js +0 -17
- package/dist/components/custom-auto-complete-advanced/components/RenderInput.d.ts +0 -23
- package/dist/components/custom-auto-complete-advanced/components/RenderInput.js +0 -51
- package/dist/components/custom-auto-complete-advanced/components/RenderTags.d.ts +0 -9
- package/dist/components/custom-auto-complete-advanced/components/RenderTags.js +0 -22
- package/dist/components/custom-breadcrumbs/CustomBreadcrumbs.d.ts +0 -17
- package/dist/components/custom-breadcrumbs/CustomBreadcrumbs.js +0 -11
- package/dist/components/custom-card/CustomHorizontalCard.d.ts +0 -3
- package/dist/components/custom-card/CustomHorizontalCard.js +0 -9
- package/dist/components/custom-card/CustomVerticalCard.d.ts +0 -3
- package/dist/components/custom-card/CustomVerticalCard.js +0 -9
- package/dist/components/custom-chip/CustomChip.d.ts +0 -12
- package/dist/components/custom-chip/CustomChip.js +0 -10
- package/dist/components/custom-date-picker/CustomComponent.d.ts +0 -17
- package/dist/components/custom-date-picker/CustomComponent.js +0 -36
- package/dist/components/custom-date-picker/CustomDatePicker.d.ts +0 -14
- package/dist/components/custom-date-picker/CustomDatePicker.js +0 -55
- package/dist/components/custom-dialog/CustomDialog.d.ts +0 -41
- package/dist/components/custom-dialog/CustomDialog.js +0 -38
- package/dist/components/custom-input/CustomNumericInput.d.ts +0 -9
- package/dist/components/custom-input/CustomNumericInput.js +0 -32
- package/dist/components/custom-mobile-date-picker/CustomBottomSheet.d.ts +0 -9
- package/dist/components/custom-mobile-date-picker/CustomBottomSheet.js +0 -29
- package/dist/components/custom-mobile-date-picker/CustomMobileDatePicker.d.ts +0 -19
- package/dist/components/custom-mobile-date-picker/CustomMobileDatePicker.js +0 -98
- package/dist/components/custom-mobile-date-picker/DatePickerBottomSheet.d.ts +0 -19
- package/dist/components/custom-mobile-date-picker/DatePickerBottomSheet.js +0 -40
- package/dist/components/custom-mobile-date-picker/ItemPicker.d.ts +0 -10
- package/dist/components/custom-mobile-date-picker/ItemPicker.js +0 -72
- package/dist/components/custom-modal/CustomModal.d.ts +0 -21
- package/dist/components/custom-modal/CustomModal.js +0 -38
- package/dist/components/custom-pagination/custom-pagination-1/CustomPagination1.d.ts +0 -9
- package/dist/components/custom-pagination/custom-pagination-1/CustomPagination1.js +0 -13
- package/dist/components/custom-pagination/custom-pagination-2/CustomPagination2.d.ts +0 -20
- package/dist/components/custom-pagination/custom-pagination-2/CustomPagination2.js +0 -33
- package/dist/components/custom-progress/LinearBufferProgress.d.ts +0 -6
- package/dist/components/custom-progress/LinearBufferProgress.js +0 -14
- package/dist/components/custom-stepper/CustomStepper.d.ts +0 -31
- package/dist/components/custom-stepper/CustomStepper.js +0 -170
- package/dist/components/custom-table/CustomTable.d.ts +0 -55
- package/dist/components/custom-table/CustomTable.js +0 -50
- package/dist/components/custom-table/components/CustomTableBody.d.ts +0 -21
- package/dist/components/custom-table/components/CustomTableBody.js +0 -11
- package/dist/components/custom-table/components/CustomTableCell.d.ts +0 -8
- package/dist/components/custom-table/components/CustomTableCell.js +0 -23
- package/dist/components/custom-table/components/CustomTableHead.d.ts +0 -17
- package/dist/components/custom-table/components/CustomTableHead.js +0 -63
- package/dist/components/custom-table/components/CustomTableRow.d.ts +0 -26
- package/dist/components/custom-table/components/CustomTableRow.js +0 -102
- package/dist/components/custom-table/components/useTable.d.ts +0 -24
- package/dist/components/custom-table/components/useTable.js +0 -77
- package/dist/components/custom-tabs/CustomTabs.d.ts +0 -22
- package/dist/components/custom-tabs/CustomTabs.js +0 -70
- package/dist/components/custom-uploader/CustomUploader.d.ts +0 -23
- package/dist/components/custom-uploader/CustomUploader.js +0 -68
- package/dist/components/error boundary/ErrorComponent.d.ts +0 -7
- package/dist/components/error boundary/ErrorComponent.js +0 -6
- package/dist/components/error boundary/withErrorBoundary.d.ts +0 -7
- package/dist/components/error boundary/withErrorBoundary.js +0 -10
- package/dist/components/index.d.ts +0 -183
- package/dist/components/index.js +0 -70
- package/dist/components/input-list/Form.d.ts +0 -21
- package/dist/components/input-list/Form.js +0 -19
- package/dist/components/input-list/InputListWithUseForm.d.ts +0 -22
- package/dist/components/input-list/InputListWithUseForm.js +0 -22
- package/dist/components/input-list/UseFormInput.d.ts +0 -11
- package/dist/components/input-list/UseFormInput.js +0 -50
- package/dist/components/input-list/checkbox-list/CheckboxList.d.ts +0 -19
- package/dist/components/input-list/checkbox-list/CheckboxList.js +0 -30
- package/dist/components/input-list/components/UFAutoComplete.d.ts +0 -9
- package/dist/components/input-list/components/UFAutoComplete.js +0 -41
- package/dist/components/input-list/components/UFCheckbox.d.ts +0 -19
- package/dist/components/input-list/components/UFCheckbox.js +0 -21
- package/dist/components/input-list/components/UFCurrency.d.ts +0 -9
- package/dist/components/input-list/components/UFCurrency.js +0 -47
- package/dist/components/input-list/components/UFDatePicker.d.ts +0 -9
- package/dist/components/input-list/components/UFDatePicker.js +0 -17
- package/dist/components/input-list/components/UFDatePickerMobile.d.ts +0 -9
- package/dist/components/input-list/components/UFDatePickerMobile.js +0 -6
- package/dist/components/input-list/components/UFMultiCheckbox.d.ts +0 -9
- package/dist/components/input-list/components/UFMultiCheckbox.js +0 -17
- package/dist/components/input-list/components/UFMultiSelect.d.ts +0 -9
- package/dist/components/input-list/components/UFMultiSelect.js +0 -56
- package/dist/components/input-list/components/UFRadio.d.ts +0 -9
- package/dist/components/input-list/components/UFRadio.js +0 -19
- package/dist/components/input-list/components/UFSelect.d.ts +0 -9
- package/dist/components/input-list/components/UFSelect.js +0 -19
- package/dist/components/input-list/components/UFSwitch.d.ts +0 -19
- package/dist/components/input-list/components/UFSwitch.js +0 -99
- package/dist/components/input-list/components/UFTextArea.d.ts +0 -9
- package/dist/components/input-list/components/UFTextArea.js +0 -12
- package/dist/components/input-list/components/UFTextField.d.ts +0 -11
- package/dist/components/input-list/components/UFTextField.js +0 -29
- package/dist/components/input-list/components/UFTime.d.ts +0 -10
- package/dist/components/input-list/components/UFTime.js +0 -93
- package/dist/components/input-list/components/UFUploader.d.ts +0 -9
- package/dist/components/input-list/components/UFUploader.js +0 -41
- package/dist/components/input-list/type.d.ts +0 -165
- package/dist/components/input-list/type.js +0 -1
- package/dist/components/otp-input/OTPInput.d.ts +0 -19
- package/dist/components/otp-input/OTPInput.js +0 -161
- package/dist/components/rich-tooltip/RichTooltip.d.ts +0 -18
- package/dist/components/rich-tooltip/RichTooltip.js +0 -32
- package/dist/context/FormContext.d.ts +0 -16
- package/dist/context/FormContext.js +0 -8
- package/dist/icons/Add.d.ts +0 -7
- package/dist/icons/Add.js +0 -3
- package/dist/icons/ArrowDown.d.ts +0 -7
- package/dist/icons/ArrowDown.js +0 -3
- package/dist/icons/ArrowLeft1.d.ts +0 -7
- package/dist/icons/ArrowLeft1.js +0 -3
- package/dist/icons/ArrowRight1.d.ts +0 -7
- package/dist/icons/ArrowRight1.js +0 -3
- package/dist/icons/Calendar.d.ts +0 -7
- package/dist/icons/Calendar.js +0 -3
- package/dist/icons/CloseCircle.d.ts +0 -7
- package/dist/icons/CloseCircle.js +0 -3
- package/dist/icons/DocumentDownload.d.ts +0 -7
- package/dist/icons/DocumentDownload.js +0 -3
- package/dist/icons/Eye.d.ts +0 -7
- package/dist/icons/Eye.js +0 -3
- package/dist/icons/EyeSlash.d.ts +0 -7
- package/dist/icons/EyeSlash.js +0 -3
- package/dist/icons/FolderAdd.d.ts +0 -7
- package/dist/icons/FolderAdd.js +0 -3
- package/dist/icons/InfoCircle.d.ts +0 -7
- package/dist/icons/InfoCircle.js +0 -3
- package/dist/icons/Tick.d.ts +0 -7
- package/dist/icons/Tick.js +0 -3
- package/dist/icons/Trash.d.ts +0 -7
- package/dist/icons/Trash.js +0 -3
- package/dist/icons/Union.d.ts +0 -7
- package/dist/icons/Union.js +0 -3
- package/dist/icons/Warning2.d.ts +0 -7
- package/dist/icons/Warning2.js +0 -3
- package/dist/index.d.ts +0 -8
- package/dist/index.js +0 -8
- package/dist/methods/debounce.d.ts +0 -3
- package/dist/methods/debounce.js +0 -20
- package/dist/methods/general.d.ts +0 -2
- package/dist/methods/general.js +0 -32
- package/dist/mui/Alert/Alert.d.ts +0 -2
- package/dist/mui/Alert/Alert.js +0 -13
- package/dist/mui/AutoComplete/MuiAutoComplete.d.ts +0 -2
- package/dist/mui/AutoComplete/MuiAutoComplete.js +0 -27
- package/dist/mui/BreadCrumbs/MuiBreadCrumbs.d.ts +0 -2
- package/dist/mui/BreadCrumbs/MuiBreadCrumbs.js +0 -31
- package/dist/mui/Button/MuiButton.d.ts +0 -7
- package/dist/mui/Button/MuiButton.js +0 -185
- package/dist/mui/Card/MuiCard.d.ts +0 -2
- package/dist/mui/Card/MuiCard.js +0 -7
- package/dist/mui/Checkbox/Checkbox.d.ts +0 -2
- package/dist/mui/Checkbox/Checkbox.js +0 -31
- package/dist/mui/Checkbox/assets/CheckedIcon.d.ts +0 -8
- package/dist/mui/Checkbox/assets/CheckedIcon.js +0 -12
- package/dist/mui/Checkbox/assets/IntermediateIcon.d.ts +0 -8
- package/dist/mui/Checkbox/assets/IntermediateIcon.js +0 -10
- package/dist/mui/Checkbox/assets/UnChekedIcon.d.ts +0 -7
- package/dist/mui/Checkbox/assets/UnChekedIcon.js +0 -9
- package/dist/mui/Chip/MuiChip.d.ts +0 -10
- package/dist/mui/Chip/MuiChip.js +0 -35
- package/dist/mui/Dialog/MuiDialog.d.ts +0 -7
- package/dist/mui/Dialog/MuiDialog.js +0 -22
- package/dist/mui/FormControl/MuiFormControlLabel.d.ts +0 -2
- package/dist/mui/FormControl/MuiFormControlLabel.js +0 -13
- package/dist/mui/IconButton/MuiIconButon.d.ts +0 -2
- package/dist/mui/IconButton/MuiIconButon.js +0 -7
- package/dist/mui/InputAdornment/MuiInputAdornment.d.ts +0 -2
- package/dist/mui/InputAdornment/MuiInputAdornment.js +0 -6
- package/dist/mui/InputLabel/MuiInputLabel.d.ts +0 -2
- package/dist/mui/InputLabel/MuiInputLabel.js +0 -43
- package/dist/mui/Pagination/MuiPagination.d.ts +0 -2
- package/dist/mui/Pagination/MuiPagination.js +0 -15
- package/dist/mui/Pagination/MuiPaginationItem.d.ts +0 -2
- package/dist/mui/Pagination/MuiPaginationItem.js +0 -15
- package/dist/mui/Radio/MuiRadio.d.ts +0 -2
- package/dist/mui/Radio/MuiRadio.js +0 -17
- package/dist/mui/Select/MuiSelect.d.ts +0 -2
- package/dist/mui/Select/MuiSelect.js +0 -47
- package/dist/mui/Switch/MuiSwitch.d.ts +0 -2
- package/dist/mui/Switch/MuiSwitch.js +0 -83
- package/dist/mui/Tabs/MuiTabs.d.ts +0 -2
- package/dist/mui/Tabs/MuiTabs.js +0 -21
- package/dist/mui/Tabs/Tab/MuiTab.d.ts +0 -2
- package/dist/mui/Tabs/Tab/MuiTab.js +0 -26
- package/dist/mui/TextField/MuiFilledInput.d.ts +0 -2
- package/dist/mui/TextField/MuiFilledInput.js +0 -91
- package/dist/mui/TextField/MuiOutlinedInput.d.ts +0 -2
- package/dist/mui/TextField/MuiOutlinedInput.js +0 -66
- package/dist/mui/TextField/TextField.d.ts +0 -2
- package/dist/mui/TextField/TextField.js +0 -78
- package/dist/mui/Tooltip/MuiTooltip.d.ts +0 -2
- package/dist/mui/Tooltip/MuiTooltip.js +0 -26
- package/dist/mui/Typography/MuiTypography.d.ts +0 -2
- package/dist/mui/Typography/MuiTypography.js +0 -9
- package/dist/mui/Typography/index.d.ts +0 -2
- package/dist/mui/Typography/index.js +0 -138
- package/dist/mui/accordion/MuiAccodrion.d.ts +0 -2
- package/dist/mui/accordion/MuiAccodrion.js +0 -13
- package/dist/mui/breakpoints/index.d.ts +0 -9
- package/dist/mui/breakpoints/index.js +0 -9
- package/dist/mui/menu/MuiMenu.d.ts +0 -2
- package/dist/mui/menu/MuiMenu.js +0 -8
- package/dist/mui/menu/MuiMenuItem.d.ts +0 -2
- package/dist/mui/menu/MuiMenuItem.js +0 -14
- package/dist/mui/mui-css-baseline/index.d.ts +0 -3
- package/dist/mui/mui-css-baseline/index.js +0 -37
- package/dist/mui/palette/dark/darkPalette.d.ts +0 -2
- package/dist/mui/palette/dark/darkPalette.js +0 -135
- package/dist/mui/palette/light/lightPalette.d.ts +0 -2
- package/dist/mui/palette/light/lightPalette.js +0 -135
- package/dist/nextjs/NextCacheProvider.d.ts +0 -7
- package/dist/nextjs/NextCacheProvider.js +0 -13
- package/dist/react/ReactCacheProvider.d.ts +0 -7
- package/dist/react/ReactCacheProvider.js +0 -15
- package/dist/theme/theme.d.ts +0 -3
- package/dist/theme/theme.js +0 -75
- package/dist/types/palette.d.ts +0 -60
- package/dist/types/palette.js +0 -1
- package/dist/types/types.d.ts +0 -102
- package/dist/types/types.js +0 -4
- package/dist/types/typography.d.ts +0 -71
- package/dist/types/typography.js +0 -1
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React, { FC } from "react";
|
|
2
|
-
import { Cell } from "@tanstack/react-table";
|
|
3
|
-
interface CustomTableCellProps {
|
|
4
|
-
cell: Cell<any, any>;
|
|
5
|
-
children: React.ReactNode;
|
|
6
|
-
}
|
|
7
|
-
declare const CustomTableCell: FC<CustomTableCellProps>;
|
|
8
|
-
export default CustomTableCell;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import Box from "@mui/material/Box";
|
|
3
|
-
import { TableCell } from "@mui/material";
|
|
4
|
-
const CustomTableCell = ({ cell, children, }) => {
|
|
5
|
-
return (_jsx(TableCell, { id: `c-${cell.id}`, sx: {
|
|
6
|
-
px: 0,
|
|
7
|
-
py: 0,
|
|
8
|
-
width: cell?.getContext()?.column?.id === "select" ? 50 : 150,
|
|
9
|
-
border: "none",
|
|
10
|
-
height: "inherit",
|
|
11
|
-
}, children: _jsx(Box, { sx: {
|
|
12
|
-
backgroundColor: "white",
|
|
13
|
-
justifyContent: cell?.getContext()?.column?.id === "select" ? "left" : "center",
|
|
14
|
-
height: "100%",
|
|
15
|
-
fontSize: 14,
|
|
16
|
-
fontWeight: 500,
|
|
17
|
-
display: "flex",
|
|
18
|
-
alignItems: "center",
|
|
19
|
-
px: cell?.getContext()?.column?.id === "select" ? 0 : 4,
|
|
20
|
-
borderBottom: "1px solid #C5D0FF",
|
|
21
|
-
}, children: children }) }, cell?.id));
|
|
22
|
-
};
|
|
23
|
-
export default CustomTableCell;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
|
-
import { Table as TableType } from '@tanstack/table-core/build/lib/types';
|
|
3
|
-
import { TypographyProps } from '@mui/material/Typography';
|
|
4
|
-
import { SystemStyleObject } from '@mui/system';
|
|
5
|
-
import { TCheckboxProps } from '../CustomTable';
|
|
6
|
-
interface CustomTableHeadProps {
|
|
7
|
-
variant?: 'fill' | 'standard' | undefined;
|
|
8
|
-
table: TableType<any>;
|
|
9
|
-
withRadio?: boolean;
|
|
10
|
-
withSelect?: boolean;
|
|
11
|
-
withIndex?: boolean;
|
|
12
|
-
headerStyle?: SystemStyleObject;
|
|
13
|
-
checkboxProps?: TCheckboxProps;
|
|
14
|
-
headerTypoProps?: TypographyProps;
|
|
15
|
-
}
|
|
16
|
-
declare const CustomTableHead: FC<CustomTableHeadProps>;
|
|
17
|
-
export default CustomTableHead;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
//@3rd Party
|
|
3
|
-
import { flexRender } from '@tanstack/react-table';
|
|
4
|
-
//-------------------------------------------------------------------------
|
|
5
|
-
//@Mui
|
|
6
|
-
import Box from '@mui/material/Box';
|
|
7
|
-
import Typography from '@mui/material/Typography';
|
|
8
|
-
import TableHead from '@mui/material/TableHead';
|
|
9
|
-
import TableRow from '@mui/material/TableRow';
|
|
10
|
-
import TableCell from '@mui/material/TableCell';
|
|
11
|
-
import { Checkbox } from '@mui/material';
|
|
12
|
-
const CustomTableHead = ({ table, variant, withSelect, withRadio, withIndex, headerStyle, checkboxProps, headerTypoProps, }) => {
|
|
13
|
-
const { onChange: onChangeCheckbox, ...restCheckboxProps } = typeof checkboxProps === 'function'
|
|
14
|
-
? checkboxProps({ table })
|
|
15
|
-
: checkboxProps || {};
|
|
16
|
-
return (_jsx(TableHead, { sx: {
|
|
17
|
-
position: 'sticky',
|
|
18
|
-
zIndex: 10,
|
|
19
|
-
top: 0,
|
|
20
|
-
mb: 2,
|
|
21
|
-
bgcolor: '#EAEDFF',
|
|
22
|
-
borderBottom: (theme) => `1px solid ${theme.palette.divider}`,
|
|
23
|
-
'& th:first-of-type': {
|
|
24
|
-
borderRadius: '10px 0 0 0',
|
|
25
|
-
},
|
|
26
|
-
'& th:last-child': {
|
|
27
|
-
borderRadius: '0 10px 0 0',
|
|
28
|
-
},
|
|
29
|
-
'& th': {
|
|
30
|
-
border: variant === 'fill' ? 0 : '',
|
|
31
|
-
fontSize: 10,
|
|
32
|
-
fontWeight: 700,
|
|
33
|
-
lineHeight: '13px',
|
|
34
|
-
textAlign: 'center',
|
|
35
|
-
p: 2.5,
|
|
36
|
-
},
|
|
37
|
-
'& .MuiTableCell-head': {
|
|
38
|
-
height: 46,
|
|
39
|
-
maxHeight: 46,
|
|
40
|
-
p: 0,
|
|
41
|
-
},
|
|
42
|
-
...headerStyle,
|
|
43
|
-
}, children: table?.getHeaderGroups()?.map((headerGroup) => (_jsxs(TableRow, { sx: {
|
|
44
|
-
height: 71,
|
|
45
|
-
borderBottom: variant === 'standard' ? '1px solid #EBEBEB' : '',
|
|
46
|
-
}, children: [withIndex && (_jsx(TableCell, { sx: { border: 'none' }, children: _jsx(Box, { display: 'flex', minWidth: 'max-content', px: 5, children: _jsx(Typography, { ...headerTypoProps, children: "\u0631\u062F\u06CC\u0641" }) }) }, 'head-cell')), withRadio && (_jsx(TableCell, { sx: { border: 'none' }, children: _jsx(Box, { display: 'flex', minWidth: 'max-content', pl: 8, children: _jsx(Typography, { ...headerTypoProps, children: "\u0627\u0646\u062A\u062E\u0627\u0628" }) }) }, 'head-cell')), withSelect && (_jsx(TableCell, { sx: { border: 'none' }, children: _jsx(Box, { display: 'flex', minWidth: 'max-content', px: 0, children: table.options.enableMultiRowSelection === true ? (_jsx(Checkbox, { checked: table.getIsAllRowsSelected(), indeterminate: table.getIsSomePageRowsSelected(), onChange: (e, checked) => {
|
|
47
|
-
if (onChangeCheckbox) {
|
|
48
|
-
onChangeCheckbox?.(e, table.getIsAllRowsSelected());
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
table.getToggleAllRowsSelectedHandler()(e);
|
|
52
|
-
}
|
|
53
|
-
}, ...restCheckboxProps })) : ('') }) }, 'head-cell')), headerGroup?.headers?.map((header) => {
|
|
54
|
-
return header.id === 'select' ? (_jsx(TableCell, { colSpan: header.colSpan, sx: { border: 'none' }, children: header.isPlaceholder ? null : (_jsx(Box, { display: 'flex', minWidth: 'max-content', px: 0, className: header?.column?.getCanSort()
|
|
55
|
-
? 'cursor-pointer select-none'
|
|
56
|
-
: '',
|
|
57
|
-
onClick: header?.column?.getToggleSortingHandler(), children: flexRender(header?.column?.columnDef?.header, header?.getContext()) })) }, header.id)) : (_jsx(TableCell, { colSpan: header?.colSpan, sx: { border: 'none' }, children: header?.isPlaceholder ? null : (_jsx(Box, { display: 'flex', minWidth: 'max-content', textAlign: 'center', justifyContent: 'center', px: 2, className: header?.column?.getCanSort()
|
|
58
|
-
? 'cursor-pointer select-none'
|
|
59
|
-
: '',
|
|
60
|
-
onClick: header?.column?.getToggleSortingHandler(), children: _jsx(Typography, { ...headerTypoProps, children: flexRender(header?.column?.columnDef?.header, header?.getContext()) }) })) }, header?.id));
|
|
61
|
-
})] }, headerGroup.id))) }));
|
|
62
|
-
};
|
|
63
|
-
export default CustomTableHead;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import React, { FC } from 'react';
|
|
2
|
-
import { CheckboxProps as MuiCheckboxProps } from '@mui/material/Checkbox';
|
|
3
|
-
import { Row } from '@tanstack/react-table';
|
|
4
|
-
import { ITablePagination, TCellsStyle, TCheckboxProps, TRowStyle } from '../CustomTable';
|
|
5
|
-
import { RadioProps } from '@mui/material/Radio';
|
|
6
|
-
import { Table as TableType } from '@tanstack/table-core/build/lib/types';
|
|
7
|
-
export interface ICheckboxProps extends Omit<MuiCheckboxProps, 'onChange'> {
|
|
8
|
-
onChange?: (event: React.ChangeEvent<HTMLInputElement>, checked: boolean, row?: Row<any>) => void;
|
|
9
|
-
}
|
|
10
|
-
interface CustomTableRowProps {
|
|
11
|
-
row: Row<any>;
|
|
12
|
-
onClickRow?: (row: Row<any>) => void;
|
|
13
|
-
renderSubComponent?: (data: any) => any;
|
|
14
|
-
withSelect?: boolean;
|
|
15
|
-
withIndex?: boolean;
|
|
16
|
-
withRadio?: boolean;
|
|
17
|
-
pagination?: ITablePagination;
|
|
18
|
-
rowStyle?: TRowStyle;
|
|
19
|
-
cellsStyle?: TCellsStyle;
|
|
20
|
-
checkboxProps?: TCheckboxProps;
|
|
21
|
-
radioProps?: RadioProps;
|
|
22
|
-
table: TableType<any>;
|
|
23
|
-
rowBorderRadius?: number;
|
|
24
|
-
}
|
|
25
|
-
declare const CustomTableRow: FC<CustomTableRowProps>;
|
|
26
|
-
export default CustomTableRow;
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
//@Mui
|
|
3
|
-
import Box from '@mui/material/Box';
|
|
4
|
-
import Collapse from '@mui/material/Collapse';
|
|
5
|
-
import { Checkbox, TableCell, TableRow } from '@mui/material';
|
|
6
|
-
import { flexRender } from '@tanstack/react-table';
|
|
7
|
-
import CustomTableCell from '../components/CustomTableCell';
|
|
8
|
-
import Typography from '@mui/material/Typography';
|
|
9
|
-
import Radio from '@mui/material/Radio';
|
|
10
|
-
const CustomTableRow = ({ row, onClickRow, renderSubComponent, withSelect, withIndex, withRadio, pagination, rowStyle, cellsStyle, checkboxProps, radioProps, table, rowBorderRadius, }) => {
|
|
11
|
-
const { onChange: onChangeCheckbox, ...restCheckboxProps } = typeof checkboxProps === 'function'
|
|
12
|
-
? checkboxProps({ row, table })
|
|
13
|
-
: checkboxProps || {};
|
|
14
|
-
return (_jsxs(_Fragment, { children: [_jsxs(TableRow, { id: `tr-${row.index}`, onClick: () => (onClickRow ? onClickRow(row) : ''), sx: {
|
|
15
|
-
height: 71,
|
|
16
|
-
cursor: onClickRow ? 'pointer' : '',
|
|
17
|
-
'& td:first-of-type > div': {
|
|
18
|
-
border: 'unset !important',
|
|
19
|
-
borderEndStartRadius: rowBorderRadius ?? 10,
|
|
20
|
-
borderStartStartRadius: row.index === 0 ? 0 : rowBorderRadius ?? 10,
|
|
21
|
-
},
|
|
22
|
-
'& td:last-child > div': {
|
|
23
|
-
border: 'unset !important',
|
|
24
|
-
borderEndEndRadius: rowBorderRadius ?? 10,
|
|
25
|
-
borderStartEndRadius: row.index === 0 ? 0 : rowBorderRadius ?? 10,
|
|
26
|
-
},
|
|
27
|
-
...(rowStyle ? rowStyle({ row }) : {}),
|
|
28
|
-
'& td > div': {
|
|
29
|
-
border: 'unset !important',
|
|
30
|
-
...(cellsStyle ? cellsStyle({ row }) : {}),
|
|
31
|
-
transition: '0.15s ease all',
|
|
32
|
-
},
|
|
33
|
-
'&:hover': {
|
|
34
|
-
'& td > div': {
|
|
35
|
-
...(cellsStyle ? cellsStyle({ row, hover: true }) : {}),
|
|
36
|
-
},
|
|
37
|
-
...(rowStyle ? rowStyle({ row, hover: true }) : {}),
|
|
38
|
-
},
|
|
39
|
-
}, children: [withIndex && (_jsx(TableCell, { id: `c-select`, className: 'CustomTable-index', sx: {
|
|
40
|
-
px: 0,
|
|
41
|
-
py: 0,
|
|
42
|
-
width: 50,
|
|
43
|
-
border: 'none',
|
|
44
|
-
height: 'inherit',
|
|
45
|
-
}, children: _jsx(Box, { sx: {
|
|
46
|
-
backgroundColor: 'white',
|
|
47
|
-
justifyContent: 'left',
|
|
48
|
-
height: '100%',
|
|
49
|
-
fontSize: 10,
|
|
50
|
-
fontWeight: 500,
|
|
51
|
-
display: 'flex',
|
|
52
|
-
alignItems: 'center',
|
|
53
|
-
px: 5,
|
|
54
|
-
border: 'unset !important',
|
|
55
|
-
// borderBottom: "1px solid #C5D0FF",
|
|
56
|
-
}, children: _jsx(Typography, { variant: 'caption2', children: pagination
|
|
57
|
-
? (pagination.pageIndex - 1) * pagination.pageSize +
|
|
58
|
-
row.index +
|
|
59
|
-
1
|
|
60
|
-
: '-' }) }) })), withRadio && (_jsx(TableCell, { id: `c-select`, className: 'CustomTable-radio', sx: {
|
|
61
|
-
px: 0,
|
|
62
|
-
py: 0,
|
|
63
|
-
width: 50,
|
|
64
|
-
border: 'none',
|
|
65
|
-
height: 'inherit',
|
|
66
|
-
}, children: _jsx(Box, { sx: {
|
|
67
|
-
backgroundColor: 'white',
|
|
68
|
-
justifyContent: 'left',
|
|
69
|
-
height: '100%',
|
|
70
|
-
fontSize: 10,
|
|
71
|
-
fontWeight: 500,
|
|
72
|
-
display: 'flex',
|
|
73
|
-
alignItems: 'center',
|
|
74
|
-
pl: 8,
|
|
75
|
-
}, children: _jsx(Radio, { checked: row.getIsSelected(), onChange: row.getToggleSelectedHandler(), onClick: (e) => e.stopPropagation(), ...radioProps }) }) })), withSelect && (_jsx(TableCell, { className: 'CustomTable-checkBox', id: `c-select`, sx: {
|
|
76
|
-
px: 0,
|
|
77
|
-
py: 0,
|
|
78
|
-
width: 50,
|
|
79
|
-
border: 'none',
|
|
80
|
-
height: 'inherit',
|
|
81
|
-
}, children: _jsx(Box, { sx: {
|
|
82
|
-
backgroundColor: 'white',
|
|
83
|
-
justifyContent: 'left',
|
|
84
|
-
height: '100%',
|
|
85
|
-
fontSize: 10,
|
|
86
|
-
fontWeight: 500,
|
|
87
|
-
display: 'flex',
|
|
88
|
-
alignItems: 'center',
|
|
89
|
-
px: 0,
|
|
90
|
-
// borderBottom: "1px solid #C5D0FF",
|
|
91
|
-
}, children: _jsx(Checkbox, { checked: row.getIsSelected(), onChange: (e) => {
|
|
92
|
-
row?.getToggleSelectedHandler()(e);
|
|
93
|
-
onChangeCheckbox?.(e, row.getIsSelected(), row);
|
|
94
|
-
}, onClick: (e) => e.stopPropagation(), ...restCheckboxProps }) }) })), row?.getVisibleCells()?.map((cell, index) => {
|
|
95
|
-
return (_jsx(CustomTableCell, { cell: cell, children: flexRender(cell?.column?.columnDef?.cell, cell?.getContext()) }, index));
|
|
96
|
-
})] }, row.id), renderSubComponent && (_jsx(TableRow, { sx: {
|
|
97
|
-
'& td:first-child': {
|
|
98
|
-
px: 0,
|
|
99
|
-
},
|
|
100
|
-
}, children: _jsx(TableCell, { style: { paddingBottom: 0, paddingTop: 4 }, colSpan: 12, children: _jsx(Collapse, { in: row.getIsExpanded(), timeout: 'auto', unmountOnExit: true, children: _jsx(Box, { px: 5, borderRadius: '0px 0px 10px 10px', children: renderSubComponent({ row }) }) }) }) }))] }));
|
|
101
|
-
};
|
|
102
|
-
export default CustomTableRow;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { ColumnDef, Row, TableOptions } from '@tanstack/react-table';
|
|
3
|
-
import { ITablePagination } from '../../custom-table/CustomTable';
|
|
4
|
-
interface IProps extends Partial<Omit<TableOptions<any>, 'getRowId'>> {
|
|
5
|
-
columns: ColumnDef<any, any>[];
|
|
6
|
-
data: any;
|
|
7
|
-
pageSize?: number;
|
|
8
|
-
multiSelect?: boolean;
|
|
9
|
-
onSelectRow?: (data: any) => void;
|
|
10
|
-
getRowId?: string;
|
|
11
|
-
renderSubComponent?: (props: {
|
|
12
|
-
row: Row<any>;
|
|
13
|
-
}) => React.ReactElement;
|
|
14
|
-
getRowCanExpand?: (row: Row<any>) => boolean;
|
|
15
|
-
}
|
|
16
|
-
declare const useTable: ({ state, getRowId, data, columns, pageSize, ...props }: IProps) => {
|
|
17
|
-
table: import("@tanstack/react-table").Table<any>;
|
|
18
|
-
pagination: ITablePagination;
|
|
19
|
-
selectedRows: Row<any>[];
|
|
20
|
-
renderSubComponent: ((props: {
|
|
21
|
-
row: Row<any>;
|
|
22
|
-
}) => React.ReactElement) | undefined;
|
|
23
|
-
};
|
|
24
|
-
export default useTable;
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { useEffect, useMemo, useState } from 'react';
|
|
2
|
-
import { getCoreRowModel, getExpandedRowModel, useReactTable, } from '@tanstack/react-table';
|
|
3
|
-
const useTable = ({ state, getRowId, data, columns, pageSize, ...props }) => {
|
|
4
|
-
const [selectedRows, setSelectedRows] = useState([]);
|
|
5
|
-
const getRowInCurrentPage = (id) => {
|
|
6
|
-
return table.getRowModel()?.rowsById?.[id];
|
|
7
|
-
};
|
|
8
|
-
const getRowInOtherPage = (id) => {
|
|
9
|
-
return selectedRows?.find((row) => row?.id === id);
|
|
10
|
-
};
|
|
11
|
-
const handleSelectRow = (row) => {
|
|
12
|
-
setRowSelection(row);
|
|
13
|
-
setRowSelection((old) => {
|
|
14
|
-
const selectedRowIds = Object?.keys(old);
|
|
15
|
-
if (selectedRowIds) {
|
|
16
|
-
// @ts-ignore
|
|
17
|
-
setSelectedRows((prv) => {
|
|
18
|
-
const newSelectedRows = selectedRowIds.map((id) => {
|
|
19
|
-
return table?.getRowModel()?.rowsById?.[id]
|
|
20
|
-
? getRowInCurrentPage(id)
|
|
21
|
-
: getRowInOtherPage(id);
|
|
22
|
-
});
|
|
23
|
-
if (props?.onSelectRow) {
|
|
24
|
-
props?.onSelectRow(newSelectedRows);
|
|
25
|
-
}
|
|
26
|
-
return newSelectedRows;
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
return old;
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
//selection
|
|
33
|
-
const [rowSelection, setRowSelection] = useState({});
|
|
34
|
-
const { renderSubComponent, getRowCanExpand, onSelectRow, multiSelect, ...tProps } = props;
|
|
35
|
-
const memoColumns = useMemo(() => columns, [JSON.stringify(columns)]);
|
|
36
|
-
const memoData = useMemo(() => data, [data]);
|
|
37
|
-
//generate table with react-table
|
|
38
|
-
const table = useReactTable({
|
|
39
|
-
data: memoData || [],
|
|
40
|
-
enableMultiRowSelection: props.multiSelect,
|
|
41
|
-
state: {
|
|
42
|
-
rowSelection,
|
|
43
|
-
...state,
|
|
44
|
-
},
|
|
45
|
-
getRowCanExpand,
|
|
46
|
-
getExpandedRowModel: getExpandedRowModel(),
|
|
47
|
-
manualPagination: true,
|
|
48
|
-
// getRowId: (row) =>
|
|
49
|
-
// getRowId && at(row, getRowId)?.[0]
|
|
50
|
-
// ? at(row, getRowId)?.[0]
|
|
51
|
-
// : row.id,
|
|
52
|
-
onRowSelectionChange: (row) => handleSelectRow(row),
|
|
53
|
-
getCoreRowModel: getCoreRowModel(),
|
|
54
|
-
columns: memoColumns,
|
|
55
|
-
...tProps,
|
|
56
|
-
});
|
|
57
|
-
// react table has not default pageSize and we set manually
|
|
58
|
-
useEffect(() => {
|
|
59
|
-
if (pageSize) {
|
|
60
|
-
table?.setPageSize(pageSize);
|
|
61
|
-
}
|
|
62
|
-
}, []);
|
|
63
|
-
// ready object for CustomTable
|
|
64
|
-
const pagination = {
|
|
65
|
-
pageIndex: table?.getState()?.pagination?.pageIndex + 1,
|
|
66
|
-
pageSize: table?.getState()?.pagination?.pageSize,
|
|
67
|
-
pageCounts: table?.getPageCount(),
|
|
68
|
-
onChangePage: (page) => table.setPageIndex(page - 1),
|
|
69
|
-
};
|
|
70
|
-
return {
|
|
71
|
-
table,
|
|
72
|
-
pagination,
|
|
73
|
-
selectedRows,
|
|
74
|
-
renderSubComponent,
|
|
75
|
-
};
|
|
76
|
-
};
|
|
77
|
-
export default useTable;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { ReactElement, ReactNode } from 'react';
|
|
2
|
-
import { TabProps, TabsProps } from '@mui/material';
|
|
3
|
-
import { BoxProps } from '@mui/material/Box';
|
|
4
|
-
interface ITabProps {
|
|
5
|
-
label: ReactNode;
|
|
6
|
-
icon?: string | ReactElement;
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
}
|
|
9
|
-
export interface CustomTabsProps extends TabsProps {
|
|
10
|
-
indicator?: 'line' | 'fullHeight' | 'none';
|
|
11
|
-
tabs: ITabProps[];
|
|
12
|
-
tabPanels?: {
|
|
13
|
-
component: ReactNode;
|
|
14
|
-
}[];
|
|
15
|
-
color?: string;
|
|
16
|
-
withoutDivider?: boolean;
|
|
17
|
-
tabProps?: TabProps;
|
|
18
|
-
wrapperProps?: BoxProps;
|
|
19
|
-
tabOrientation?: 'horizontal' | 'vertical';
|
|
20
|
-
}
|
|
21
|
-
declare const CustomTabs: ({ tabs, tabPanels, indicator, orientation, color, withoutDivider, tabProps, wrapperProps, tabOrientation, ...props }: CustomTabsProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
-
export default CustomTabs;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import { Tab as MuiTab, Tabs as MuiTabs, useTheme, } from '@mui/material';
|
|
4
|
-
import Box from '@mui/material/Box';
|
|
5
|
-
const CustomTabs = ({ tabs, tabPanels, indicator = 'none', orientation = 'horizontal', color, withoutDivider, tabProps, wrapperProps, tabOrientation = 'horizontal', ...props }) => {
|
|
6
|
-
const theme = useTheme();
|
|
7
|
-
const [value, setValue] = useState(0);
|
|
8
|
-
const handleChange = (event, newValue) => {
|
|
9
|
-
setValue(newValue);
|
|
10
|
-
};
|
|
11
|
-
return (_jsxs(Box, { width: '100%', display: 'flex', height: '100%', flexDirection: orientation === 'vertical' ? 'row' : 'column', ...wrapperProps, children: [_jsx(MuiTabs, { centered: props?.centered, orientation: orientation, variant: props?.variant, value: value, onChange: handleChange, "aria-label": 'basic tabs', TabIndicatorProps: {
|
|
12
|
-
style: {
|
|
13
|
-
background: color || theme.palette.primary.main,
|
|
14
|
-
...(indicator === 'fullHeight'
|
|
15
|
-
? {
|
|
16
|
-
...(orientation === 'horizontal' && {
|
|
17
|
-
height: 'calc(100% - 4px)',
|
|
18
|
-
}),
|
|
19
|
-
...(orientation === 'vertical' && {
|
|
20
|
-
width: 'calc(100% - 4px)',
|
|
21
|
-
marginLeft: '4px',
|
|
22
|
-
}),
|
|
23
|
-
borderRadius: 8,
|
|
24
|
-
marginBottom: '4px',
|
|
25
|
-
}
|
|
26
|
-
: {}),
|
|
27
|
-
},
|
|
28
|
-
hidden: indicator === 'none',
|
|
29
|
-
}, style: { borderBottom: withoutDivider ? 'none' : '' }, ...props, children: tabs?.map(({ label, icon, disabled }, index) => (_jsx(MuiTab, { disabled: disabled, label: label, id: `tab-${index}`, "aria-controls": `tabPanel-${index}`, icon: icon ? icon : undefined, ...tabProps, sx: [
|
|
30
|
-
{
|
|
31
|
-
...theme.typography.caption2,
|
|
32
|
-
...(tabOrientation === 'vertical'
|
|
33
|
-
? { writingMode: 'tb-rl' }
|
|
34
|
-
: {}),
|
|
35
|
-
'&.Mui-selected': {
|
|
36
|
-
...theme.typography['caption2.medium'],
|
|
37
|
-
...(indicator === 'fullHeight'
|
|
38
|
-
? {
|
|
39
|
-
backgroundColor: 'transparent',
|
|
40
|
-
zIndex: 10,
|
|
41
|
-
color: (theme) => theme.palette.mode === 'light'
|
|
42
|
-
? theme.palette.text.secondary
|
|
43
|
-
: theme.palette.text.primary,
|
|
44
|
-
stroke: (theme) => theme.palette.mode === 'light'
|
|
45
|
-
? theme.palette.text.secondary
|
|
46
|
-
: theme.palette.text.primary,
|
|
47
|
-
}
|
|
48
|
-
: indicator === 'line'
|
|
49
|
-
? {
|
|
50
|
-
backgroundColor: 'transparent',
|
|
51
|
-
color: (theme) => color || theme.palette.primary.main,
|
|
52
|
-
stroke: (theme) => theme.palette.primary.main,
|
|
53
|
-
}
|
|
54
|
-
: {
|
|
55
|
-
backgroundColor: 'transparent',
|
|
56
|
-
...(orientation === 'vertical' && {
|
|
57
|
-
width: '100%',
|
|
58
|
-
justifyContent: 'flex-start',
|
|
59
|
-
}),
|
|
60
|
-
}),
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
...(Array.isArray(tabProps?.sx) ? tabProps.sx : [tabProps?.sx]),
|
|
64
|
-
] }, index))) }), tabPanels?.map((children, index) => (_jsx(CustomTabPanel, { value: value, index: index, children: children.component }, index)))] }));
|
|
65
|
-
};
|
|
66
|
-
export default CustomTabs;
|
|
67
|
-
function CustomTabPanel(props) {
|
|
68
|
-
const { children, value, index, ...other } = props;
|
|
69
|
-
return (_jsx("div", { role: 'tabpanel', hidden: value !== index, id: `tabPanel-${index}`, "aria-labelledby": `tab-${index}`, ...other, children: value === index && children }));
|
|
70
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React, { FC } from "react";
|
|
2
|
-
import { TypographyProps } from "@mui/material/Typography";
|
|
3
|
-
import { StackProps } from "@mui/material";
|
|
4
|
-
export interface ICustomUploaderProps {
|
|
5
|
-
link?: string;
|
|
6
|
-
title?: string;
|
|
7
|
-
onChange?: (files: FileList, preview: string[]) => void;
|
|
8
|
-
isLoading?: boolean;
|
|
9
|
-
progress?: number;
|
|
10
|
-
onDeleteDocument?: () => void;
|
|
11
|
-
accept?: string;
|
|
12
|
-
defaultIcon?: string;
|
|
13
|
-
typoProps?: TypographyProps;
|
|
14
|
-
stackProps?: StackProps;
|
|
15
|
-
imageProps?: React.ImgHTMLAttributes<HTMLImageElement>;
|
|
16
|
-
inputProps?: React.InputHTMLAttributes<HTMLInputElement>;
|
|
17
|
-
color?: string;
|
|
18
|
-
width?: number | string;
|
|
19
|
-
height?: number | string;
|
|
20
|
-
multiple?: boolean;
|
|
21
|
-
}
|
|
22
|
-
declare const CustomUploader: FC<ICustomUploaderProps>;
|
|
23
|
-
export default CustomUploader;
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from "react";
|
|
3
|
-
// Mui
|
|
4
|
-
import Box from "@mui/material/Box";
|
|
5
|
-
import Stack from "@mui/material/Stack";
|
|
6
|
-
import Typography from "@mui/material/Typography";
|
|
7
|
-
import { useTheme } from "@mui/material";
|
|
8
|
-
import SvgTrash from "../../icons/Trash";
|
|
9
|
-
import SvgFolderAdd from "../../icons/FolderAdd";
|
|
10
|
-
// components and utils
|
|
11
|
-
import LinearBufferProgress from "../custom-progress/LinearBufferProgress";
|
|
12
|
-
import SvgEye from "../../icons/Eye";
|
|
13
|
-
const CustomUploader = ({ link, title = "", typoProps, color, onChange, isLoading, progress, onDeleteDocument, accept, defaultIcon, stackProps, inputProps, height, width, imageProps, multiple }) => {
|
|
14
|
-
const theme = useTheme();
|
|
15
|
-
const [isOpenDeleteModal, setIsOpenDeleteModal] = useState(false);
|
|
16
|
-
//Handlers
|
|
17
|
-
const handleClickDeleteIcon = async () => {
|
|
18
|
-
setIsOpenDeleteModal(true);
|
|
19
|
-
};
|
|
20
|
-
const handleDownload = async (link, nameOfDownload) => {
|
|
21
|
-
const response = await fetch(link);
|
|
22
|
-
const blobImage = await response.blob();
|
|
23
|
-
const href = URL.createObjectURL(blobImage);
|
|
24
|
-
const anchorElement = document.createElement("a");
|
|
25
|
-
anchorElement.href = href;
|
|
26
|
-
anchorElement.download = nameOfDownload;
|
|
27
|
-
document.body.appendChild(anchorElement);
|
|
28
|
-
anchorElement.click();
|
|
29
|
-
document.body.removeChild(anchorElement);
|
|
30
|
-
window.URL.revokeObjectURL(href);
|
|
31
|
-
};
|
|
32
|
-
const handleDownloadImage = async () => {
|
|
33
|
-
// await handleDownload(link!, `${title}`);
|
|
34
|
-
window.open(link);
|
|
35
|
-
};
|
|
36
|
-
const handleDelete = () => {
|
|
37
|
-
if (onDeleteDocument) {
|
|
38
|
-
onDeleteDocument();
|
|
39
|
-
}
|
|
40
|
-
setIsOpenDeleteModal(false);
|
|
41
|
-
};
|
|
42
|
-
const handleChange = (e) => {
|
|
43
|
-
const files = e.target?.files || [];
|
|
44
|
-
const objectUrlFiles = [];
|
|
45
|
-
for (let i = 0; i < files?.length; i++) {
|
|
46
|
-
objectUrlFiles.push(URL.createObjectURL(files[i]));
|
|
47
|
-
}
|
|
48
|
-
if (onChange && files instanceof FileList) {
|
|
49
|
-
onChange(files, objectUrlFiles);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
return (_jsxs(Stack, { flexGrow: { xs: 1, sm: "unset" }, width: width || 100, height: height || 100, border: "1px dashed", borderRadius: 2, borderColor: color || "primary.main", ...stackProps, children: [!link && !isLoading && (_jsx("input", { multiple: multiple, type: "file", accept: accept || "image/jpeg, image/png, image/jpg", id: link + title, style: { display: "none" }, onChange: handleChange, ...inputProps })), _jsxs(Stack, { component: "label", htmlFor: link + title, width: "100%", height: "100%", sx: {
|
|
53
|
-
position: "relative",
|
|
54
|
-
"&:hover #icons-box": {
|
|
55
|
-
display: link ? "flex" : "none",
|
|
56
|
-
},
|
|
57
|
-
"&:hover #doc-card": {
|
|
58
|
-
filter: link ? "blur(3px)" : "",
|
|
59
|
-
cursor: link ? "default" : "",
|
|
60
|
-
},
|
|
61
|
-
}, children: [_jsxs(Box, { zIndex: 10, display: "none", id: "icons-box", position: "absolute", top: "50%", left: "50%", sx: { transform: "translate(-50%, -50%)" }, gap: 2, children: [handleDownloadImage && (_jsx(SvgEye, { primarycolor: color || theme.palette.primary["main"], style: { cursor: "pointer" }, onClick: () => handleDownloadImage() })), onDeleteDocument && (_jsx(SvgTrash, { primarycolor: "red", style: { cursor: "pointer" }, onClick: () => handleClickDeleteIcon() }))] }), _jsx(Stack, { position: "relative", id: "doc-card", height: "100%", sx: {
|
|
62
|
-
cursor: "pointer",
|
|
63
|
-
"&:hover": {
|
|
64
|
-
filter: link ? "blur(2px)" : "",
|
|
65
|
-
},
|
|
66
|
-
}, children: _jsx(Stack, { justifyContent: "center", alignItems: "center", position: "absolute", top: "50%", left: "50%", sx: { transform: "translate(-50%, -50%)" }, width: "100%", height: "100%", children: isLoading && progress ? (_jsxs(Box, { width: "80%", display: "flex", alignItems: "center", height: "100%", gap: 2, children: [_jsx(LinearBufferProgress, { progress: progress }), _jsxs(Typography, { textAlign: "center", fontWeight: 500, width: 50, children: [progress, " %"] })] })) : (_jsxs(_Fragment, { children: [link ? (_jsx("img", { src: defaultIcon || link, alt: "document", width: "100%", height: "100%", style: { objectFit: "contain" }, ...imageProps })) : (_jsx(SvgFolderAdd, { width: 32, height: 32, primarycolor: color || theme.palette.primary.main })), !link && (_jsx(Typography, { color: color || "primary", fontWeight: "bold", width: "max-content", ...typoProps, children: title }))] })) }) })] })] }));
|
|
67
|
-
};
|
|
68
|
-
export default CustomUploader;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import Skeleton from "@mui/material/Skeleton";
|
|
3
|
-
const ErrorComponent = ({ skeletonHeight = "100%", skeletonWidth = "100%" }) => {
|
|
4
|
-
return (_jsx(Skeleton, { variant: "rectangular", width: skeletonWidth, height: skeletonHeight, sx: { borderRadius: 1 } }));
|
|
5
|
-
};
|
|
6
|
-
export default ErrorComponent;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ComponentType, FC } from "react";
|
|
2
|
-
type WithErrorBoundaryProps = {
|
|
3
|
-
skeletonWidth?: string | number;
|
|
4
|
-
skeletonHeight?: string | number;
|
|
5
|
-
};
|
|
6
|
-
declare const withErrorBoundary: <P extends object>(WrappedComponent: ComponentType<P>) => FC<P & WithErrorBoundaryProps>;
|
|
7
|
-
export default withErrorBoundary;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { ErrorBoundary } from "react-error-boundary";
|
|
3
|
-
import ErrorComponent from "./ErrorComponent";
|
|
4
|
-
const withErrorBoundary = (WrappedComponent) => {
|
|
5
|
-
const ComponentWithErrorBoundary = (props) => {
|
|
6
|
-
return (_jsx(ErrorBoundary, { fallback: _jsx(ErrorComponent, { skeletonWidth: props?.skeletonWidth || "100%", skeletonHeight: props?.skeletonHeight || "100%" }), children: _jsx(WrappedComponent, { ...props }) }));
|
|
7
|
-
};
|
|
8
|
-
return ComponentWithErrorBoundary;
|
|
9
|
-
};
|
|
10
|
-
export default withErrorBoundary;
|