mui-design-system 0.0.21 → 0.0.23
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/custom-auto-complete/CustomAutoComplete.d.ts +1 -1
- package/dist/components/custom-auto-complete/components/AutoCompleteInput.d.ts +1 -1
- package/dist/components/custom-date-picker/CustomComponent.d.ts +1 -1
- package/dist/components/custom-date-picker/CustomDatePicker.d.ts +1 -1
- package/dist/components/custom-date-picker/CustomDatePicker.js +16 -11
- package/dist/components/custom-pagination/custom-pagination-1/CustomPagination1.d.ts +1 -1
- package/dist/components/custom-pagination/custom-pagination-2/CustomPagination2.d.ts +1 -1
- package/dist/components/custom-table/CustomTable.d.ts +2 -53
- package/dist/components/custom-table/CustomTable.js +7 -13
- package/dist/components/custom-table/components/CustomTableBody.d.ts +5 -4
- package/dist/components/custom-table/components/CustomTableBody.js +22 -4
- package/dist/components/custom-table/components/CustomTableCell.d.ts +2 -2
- package/dist/components/custom-table/components/CustomTableCell.js +16 -14
- package/dist/components/custom-table/components/CustomTableHead.d.ts +5 -3
- package/dist/components/custom-table/components/CustomTableHead.js +14 -13
- package/dist/components/custom-table/components/CustomTableRow.d.ts +5 -9
- package/dist/components/custom-table/components/CustomTableRow.js +17 -14
- package/dist/components/custom-table/components/useTable.d.ts +4 -16
- package/dist/components/custom-table/components/useTable.js +5 -5
- package/dist/components/custom-table/types.d.ts +77 -0
- package/dist/components/{input-list → form}/UseFormInput.js +1 -4
- package/dist/components/{input-list → form}/type.d.ts +1 -5
- package/dist/components/form/type.js +1 -0
- package/dist/components/index.d.ts +42 -98
- package/dist/components/index.js +55 -69
- package/dist/context/FormContext.d.ts +1 -1
- package/dist/mui/Button/MuiButton.js +13 -12
- package/dist/mui/Typography/index.js +13 -13
- package/dist/mui/palette/dark/darkPalette.js +47 -86
- package/dist/mui/palette/light/lightPalette.js +48 -87
- package/package.json +1 -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-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-dialog/CustomDialog.d.ts +0 -41
- package/dist/components/custom-dialog/CustomDialog.js +0 -38
- 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-stepper/CustomStepper.d.ts +0 -31
- package/dist/components/custom-stepper/CustomStepper.js +0 -170
- package/dist/components/custom-tabs/CustomTabs.d.ts +0 -22
- package/dist/components/custom-tabs/CustomTabs.js +0 -70
- package/dist/components/input-list/InputListWithUseForm.d.ts +0 -22
- package/dist/components/input-list/InputListWithUseForm.js +0 -22
- package/dist/components/input-list/components/UFDatePickerMobile.d.ts +0 -9
- package/dist/components/input-list/components/UFDatePickerMobile.js +0 -6
- 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/icons/Add.d.ts +0 -7
- package/dist/icons/Add.js +0 -3
- package/dist/icons/EyeSlash.d.ts +0 -7
- package/dist/icons/EyeSlash.js +0 -3
- package/dist/icons/Tick.d.ts +0 -7
- package/dist/icons/Tick.js +0 -3
- package/dist/icons/Warning2.d.ts +0 -7
- package/dist/icons/Warning2.js +0 -3
- /package/dist/components/{input-list/type.js → custom-table/types.js} +0 -0
- /package/dist/components/{input-list → form}/Form.d.ts +0 -0
- /package/dist/components/{input-list → form}/Form.js +0 -0
- /package/dist/components/{input-list → form}/UseFormInput.d.ts +0 -0
- /package/dist/components/{input-list → form}/checkbox-list/CheckboxList.d.ts +0 -0
- /package/dist/components/{input-list → form}/checkbox-list/CheckboxList.js +0 -0
- /package/dist/components/{input-list → form}/components/UFAutoComplete.d.ts +0 -0
- /package/dist/components/{input-list → form}/components/UFAutoComplete.js +0 -0
- /package/dist/components/{input-list → form}/components/UFCheckbox.d.ts +0 -0
- /package/dist/components/{input-list → form}/components/UFCheckbox.js +0 -0
- /package/dist/components/{input-list → form}/components/UFCurrency.d.ts +0 -0
- /package/dist/components/{input-list → form}/components/UFCurrency.js +0 -0
- /package/dist/components/{input-list → form}/components/UFDatePicker.d.ts +0 -0
- /package/dist/components/{input-list → form}/components/UFDatePicker.js +0 -0
- /package/dist/components/{input-list → form}/components/UFMultiCheckbox.d.ts +0 -0
- /package/dist/components/{input-list → form}/components/UFMultiCheckbox.js +0 -0
- /package/dist/components/{input-list → form}/components/UFMultiSelect.d.ts +0 -0
- /package/dist/components/{input-list → form}/components/UFMultiSelect.js +0 -0
- /package/dist/components/{input-list → form}/components/UFRadio.d.ts +0 -0
- /package/dist/components/{input-list → form}/components/UFRadio.js +0 -0
- /package/dist/components/{input-list → form}/components/UFSelect.d.ts +0 -0
- /package/dist/components/{input-list → form}/components/UFSelect.js +0 -0
- /package/dist/components/{input-list → form}/components/UFSwitch.d.ts +0 -0
- /package/dist/components/{input-list → form}/components/UFSwitch.js +0 -0
- /package/dist/components/{input-list → form}/components/UFTextArea.d.ts +0 -0
- /package/dist/components/{input-list → form}/components/UFTextArea.js +0 -0
- /package/dist/components/{input-list → form}/components/UFTextField.d.ts +0 -0
- /package/dist/components/{input-list → form}/components/UFTextField.js +0 -0
- /package/dist/components/{input-list → form}/components/UFTime.d.ts +0 -0
- /package/dist/components/{input-list → form}/components/UFTime.js +0 -0
- /package/dist/components/{input-list → form}/components/UFUploader.d.ts +0 -0
- /package/dist/components/{input-list → form}/components/UFUploader.js +0 -0
|
@@ -2,7 +2,7 @@ import { FC, ReactNode } from 'react';
|
|
|
2
2
|
import { AutocompleteProps } from '@mui/material/Autocomplete';
|
|
3
3
|
import { TextFieldProps } from '@mui/material/TextField';
|
|
4
4
|
import { TextFieldVariants } from '@mui/material';
|
|
5
|
-
import { TInputLabelMode } from '../
|
|
5
|
+
import { TInputLabelMode } from '../form/type';
|
|
6
6
|
export interface CustomAutocompleteProps extends Omit<AutocompleteProps<any, boolean, boolean, undefined>, 'renderInput'> {
|
|
7
7
|
label?: string | ReactNode;
|
|
8
8
|
width?: number | string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FC, ReactNode } from 'react';
|
|
2
2
|
import { AutocompleteRenderInputParams, TextFieldVariants } from '@mui/material';
|
|
3
3
|
import { TextFieldProps } from '@mui/material/TextField';
|
|
4
|
-
import { TInputLabelMode } from '../../
|
|
4
|
+
import { TInputLabelMode } from '../../form/type';
|
|
5
5
|
interface Props {
|
|
6
6
|
params: AutocompleteRenderInputParams;
|
|
7
7
|
variant?: TextFieldVariants;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { TextFieldVariants } from '@mui/material';
|
|
3
3
|
import { BaseTextFieldProps } from '@mui/material/TextField/TextField';
|
|
4
|
-
import { TInputLabelMode } from '../
|
|
4
|
+
import { TInputLabelMode } from '../form/type';
|
|
5
5
|
interface Props extends BaseTextFieldProps {
|
|
6
6
|
openCalendar: any;
|
|
7
7
|
value?: any;
|
|
@@ -2,7 +2,7 @@ import { FC } from "react";
|
|
|
2
2
|
import "../../styles/datePicker.css";
|
|
3
3
|
import { CalendarProps } from "react-multi-date-picker";
|
|
4
4
|
import { BaseTextFieldProps } from "@mui/material/TextField/TextField";
|
|
5
|
-
import { TInputLabelMode } from "../
|
|
5
|
+
import { TInputLabelMode } from "../form/type";
|
|
6
6
|
export interface ICustomDatePickerProps extends CalendarProps {
|
|
7
7
|
error: any;
|
|
8
8
|
textFieldProps?: BaseTextFieldProps;
|
|
@@ -41,15 +41,20 @@ const CustomDatePicker = ({ onChange, value, disabled, error, readOnly, textFiel
|
|
|
41
41
|
export default CustomDatePicker;
|
|
42
42
|
const setColors = (colors) => {
|
|
43
43
|
const { primary: primaryThemeColor, background: bgThemeColor, text: textThemeColor, } = colors;
|
|
44
|
-
const params = [
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
];
|
|
54
|
-
params?.forEach((param) =>
|
|
44
|
+
// const params = [
|
|
45
|
+
// { className: "--rmdp-primary-theme", value: primaryThemeColor?.main },
|
|
46
|
+
// { className: "--rmdp-secondary-theme", value: primaryThemeColor?.[2] },
|
|
47
|
+
// { className: "--rmdp-shadow-theme", value: primaryThemeColor?.[1] },
|
|
48
|
+
// { className: "--rmdp-today-theme", value: primaryThemeColor?.[5] },
|
|
49
|
+
// { className: "--rmdp-hover-theme", value: primaryThemeColor?.[4] },
|
|
50
|
+
// { className: "--rmdp-deselect-theme", value: primaryThemeColor?.[9] },
|
|
51
|
+
// { className: "--rmdp-background-theme", value: bgThemeColor?.paper },
|
|
52
|
+
// { className: "--rmdp-text-theme", value: textThemeColor?.primary },
|
|
53
|
+
// ];
|
|
54
|
+
// params?.forEach((param: any) =>
|
|
55
|
+
// document.documentElement.style.setProperty(
|
|
56
|
+
// param?.className!,
|
|
57
|
+
// param?.value!,
|
|
58
|
+
// ),
|
|
59
|
+
// );
|
|
55
60
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FC } from "react";
|
|
2
2
|
import { BoxProps } from "@mui/material/Box";
|
|
3
|
-
import { ITablePagination } from
|
|
3
|
+
import { ITablePagination } from '../../custom-table/types';
|
|
4
4
|
export interface CustomPagination1Props {
|
|
5
5
|
pagination: ITablePagination;
|
|
6
6
|
boxProps?: BoxProps;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FC } from "react";
|
|
2
2
|
import { BoxProps, SelectProps } from "@mui/material";
|
|
3
|
-
import { ITablePagination } from
|
|
3
|
+
import { ITablePagination } from '../../custom-table/types';
|
|
4
4
|
export interface ITableFooterProps {
|
|
5
5
|
pagination: ITablePagination;
|
|
6
6
|
boxProps?: BoxProps;
|
|
@@ -1,55 +1,4 @@
|
|
|
1
|
-
import { FC
|
|
2
|
-
import {
|
|
3
|
-
import { TypographyProps } from '@mui/material/Typography';
|
|
4
|
-
import { Cell, Row, Table as TableType } from '@tanstack/react-table';
|
|
5
|
-
import { ITableFooterProps } from '../custom-pagination/custom-pagination-2/CustomPagination2';
|
|
6
|
-
import { SystemStyleObject } from '@mui/system';
|
|
7
|
-
import { RadioProps } from '@mui/material/Radio';
|
|
8
|
-
import { ICheckboxProps } from './components/CustomTableRow';
|
|
9
|
-
export interface ITablePagination {
|
|
10
|
-
pageIndex: number;
|
|
11
|
-
pageSize: number;
|
|
12
|
-
pageCounts: number;
|
|
13
|
-
onChangePage: (pageIndex: number) => void;
|
|
14
|
-
onChangePageSize?: (pageSize: number) => void;
|
|
15
|
-
}
|
|
16
|
-
export interface ITableRowStyle {
|
|
17
|
-
row: Row<any>;
|
|
18
|
-
hover?: boolean;
|
|
19
|
-
}
|
|
20
|
-
export interface ITableCellsStyle {
|
|
21
|
-
row: Row<any>;
|
|
22
|
-
cell?: Cell<any, any>;
|
|
23
|
-
hover?: boolean;
|
|
24
|
-
}
|
|
25
|
-
export type TRowStyle = (props: ITableRowStyle) => SystemStyleObject;
|
|
26
|
-
export type TCellsStyle = (props: ITableCellsStyle) => SystemStyleObject;
|
|
27
|
-
export type TCheckboxProps = ((props: {
|
|
28
|
-
row?: Row<any>;
|
|
29
|
-
table: TableType<any>;
|
|
30
|
-
}) => ICheckboxProps) | ICheckboxProps;
|
|
31
|
-
export interface ICustomTable {
|
|
32
|
-
id?: string;
|
|
33
|
-
pagination?: ITablePagination;
|
|
34
|
-
table: TableType<any>;
|
|
35
|
-
variant?: 'fill' | 'standard';
|
|
36
|
-
wrapperStackProps?: StackProps;
|
|
37
|
-
footerProps?: Omit<ITableFooterProps, 'pagination'>;
|
|
38
|
-
onClickRow?: (row: Row<any>) => void;
|
|
39
|
-
renderSubComponent?: any;
|
|
40
|
-
isLoading?: boolean;
|
|
41
|
-
isError?: boolean;
|
|
42
|
-
withRadio?: boolean;
|
|
43
|
-
withSelect?: boolean;
|
|
44
|
-
withIndex?: boolean;
|
|
45
|
-
rowStyle?: TRowStyle;
|
|
46
|
-
cellsStyle?: TCellsStyle;
|
|
47
|
-
headerStyle?: SystemStyleObject;
|
|
48
|
-
headerTypoProps?: TypographyProps;
|
|
49
|
-
checkboxProps?: TCheckboxProps;
|
|
50
|
-
radioProps?: RadioProps;
|
|
51
|
-
emptyListComponent?: string | ReactNode;
|
|
52
|
-
rowBorderRadius?: number;
|
|
53
|
-
}
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { ICustomTable } from './types';
|
|
54
3
|
declare const CustomTable: FC<ICustomTable>;
|
|
55
4
|
export default CustomTable;
|
|
@@ -10,10 +10,13 @@ import Stack from '@mui/material/Stack';
|
|
|
10
10
|
import Typography from '@mui/material/Typography';
|
|
11
11
|
import TableContainer from '@mui/material/TableContainer';
|
|
12
12
|
import Table from '@mui/material/Table';
|
|
13
|
+
//------------------------------------------------------------------------------------
|
|
14
|
+
//@Components
|
|
13
15
|
import CustomTableHead from '../custom-table/components/CustomTableHead';
|
|
14
|
-
import CustomPagination2 from '../custom-pagination/custom-pagination-2/CustomPagination2';
|
|
15
16
|
import CustomTableBody from '../custom-table/components/CustomTableBody';
|
|
16
|
-
|
|
17
|
+
import CustomPagination1 from '../custom-pagination/custom-pagination-1/CustomPagination1';
|
|
18
|
+
//------------------------------------------------------------------------------------
|
|
19
|
+
const CustomTable = ({ id, isLoading, variant = "linear", table, wrapperStackProps, footerProps, renderSubComponent, pagination, onClickRow, withRadio, withSelect, withIndex, rowStyle, cellsStyle, headerStyle, headerTypoProps, checkboxProps, emptyListComponent, radioProps, rowBorderRadius = 0, borderRadius = 2, }) => {
|
|
17
20
|
const pageCounts = pagination?.pageCounts;
|
|
18
21
|
if (pagination && pageCounts && pagination?.pageIndex > pageCounts) {
|
|
19
22
|
pagination?.onChangePage(pageCounts);
|
|
@@ -27,16 +30,7 @@ const CustomTable = ({ id, isLoading, variant, table, wrapperStackProps, footerP
|
|
|
27
30
|
flexGrow: '1',
|
|
28
31
|
overflowX: 'unset',
|
|
29
32
|
overflowY: 'auto',
|
|
30
|
-
}, children: _jsxs(Table, { sx: { position: 'relative' }, children: [_jsx(CustomTableHead, { table: table, variant: variant, withRadio: withRadio, withSelect: withSelect, withIndex: withIndex, headerStyle: headerStyle, checkboxProps: checkboxProps, headerTypoProps: headerTypoProps }), isLoading ? (_jsx(TableBody, { sx: { height: '150px', width: '100%' }, children: _jsx(_Fragment, { children: Array.from({ length: 10 }).map((item, index) => (_jsx(TableRow, { children: table?.getHeaderGroups()[0]?.headers?.map((col, index) => (_jsx(TableCell, { children: _jsx(Box, { children: index === 0 ? (_jsx(Skeleton, { sx: { borderRadius: 1 }, animation: 'wave', width: '17px', height: '16px', variant: 'rectangular' })) : (_jsx(Skeleton, { sx: { borderRadius: 1 }, animation: 'wave', width: '100%', variant: 'rectangular' })) }) }, index))) }, index))) }) })) :
|
|
31
|
-
position: 'absolute',
|
|
32
|
-
width: '100%',
|
|
33
|
-
top: '47px',
|
|
34
|
-
mt: '16px',
|
|
35
|
-
textAlign: 'center',
|
|
36
|
-
display: 'flex',
|
|
37
|
-
flexDirection: 'column',
|
|
38
|
-
alignItems: 'center',
|
|
39
|
-
}, children: _jsx(TableCell, { children: _jsx(Typography, { variant: 'h4', fontWeight: 400, children: "\u062E\u0637\u0627\u06CC \u062F\u0631\u06CC\u0627\u0641\u062A \u0627\u0637\u0644\u0627\u0639\u0627\u062A" }) }) }) })) : table?.getRowModel()?.rows.length == 0 ? (_jsx(TableBody, { sx: { height: '150px', width: '100%' }, children: _jsx(TableRow, { sx: {
|
|
33
|
+
}, children: _jsxs(Table, { sx: { position: 'relative' }, children: [_jsx(CustomTableHead, { table: table, variant: variant, withRadio: withRadio, withSelect: withSelect, withIndex: withIndex, headerStyle: headerStyle, checkboxProps: checkboxProps, headerTypoProps: headerTypoProps, borderRadius: borderRadius, rowBorderRadius: rowBorderRadius }), isLoading ? (_jsx(TableBody, { sx: { height: '150px', width: '100%' }, children: _jsx(_Fragment, { children: Array.from({ length: 10 }).map((item, index) => (_jsx(TableRow, { children: table?.getHeaderGroups()[0]?.headers?.map((col, index) => (_jsx(TableCell, { children: _jsx(Box, { children: index === 0 ? (_jsx(Skeleton, { sx: { borderRadius: 1 }, animation: 'wave', width: '17px', height: '16px', variant: 'rectangular' })) : (_jsx(Skeleton, { sx: { borderRadius: 1 }, animation: 'wave', width: '100%', variant: 'rectangular' })) }) }, index))) }, index))) }) })) : table?.getRowModel()?.rows.length == 0 ? (_jsx(TableBody, { sx: { height: '150px', width: '100%' }, children: _jsx(TableRow, { sx: {
|
|
40
34
|
position: 'absolute',
|
|
41
35
|
width: '100%',
|
|
42
36
|
top: '47px',
|
|
@@ -45,6 +39,6 @@ const CustomTable = ({ id, isLoading, variant, table, wrapperStackProps, footerP
|
|
|
45
39
|
display: 'flex',
|
|
46
40
|
flexDirection: 'column',
|
|
47
41
|
alignItems: 'center',
|
|
48
|
-
}, children: _jsx(TableCell, { children: emptyListComponent ?? (_jsx(Typography, { variant: 'h4', fontWeight: 400, children: "\u0628\u062F\u0648\u0646 \u062F\u06CC\u062A\u0627" })) }) }) })) : (_jsx(CustomTableBody, { table: table, withIndex: withIndex, withSelect: withSelect, withRadio: withRadio, onClickRow: onClickRow, renderSubComponent: renderSubComponent, pagination: pagination, rowStyle: rowStyle, cellsStyle: cellsStyle, checkboxProps: checkboxProps, radioProps: radioProps, rowBorderRadius: rowBorderRadius }))] }) }), pagination && (_jsx(
|
|
42
|
+
}, children: _jsx(TableCell, { children: emptyListComponent ?? (_jsx(Typography, { variant: 'h4', fontWeight: 400, children: "\u0628\u062F\u0648\u0646 \u062F\u06CC\u062A\u0627" })) }) }) })) : (_jsx(CustomTableBody, { table: table, withIndex: withIndex, withSelect: withSelect, withRadio: withRadio, onClickRow: onClickRow, renderSubComponent: renderSubComponent, pagination: pagination, rowStyle: rowStyle, cellsStyle: cellsStyle, checkboxProps: checkboxProps, radioProps: radioProps, rowBorderRadius: rowBorderRadius, borderRadius: borderRadius, variant: variant }))] }) }), pagination && (_jsx(CustomPagination1, { pagination: pagination, ...footerProps }))] }));
|
|
49
43
|
};
|
|
50
44
|
export default CustomTable;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import { Row } from '@tanstack/react-table';
|
|
3
|
-
import { Table as TableType } from '@tanstack/table-core/build/lib/types';
|
|
4
|
-
import { ITablePagination, TCellsStyle, TCheckboxProps, TRowStyle } from '../CustomTable';
|
|
2
|
+
import { Row, Table as TableType } from '@tanstack/react-table';
|
|
5
3
|
import { RadioProps } from '@mui/material/Radio';
|
|
4
|
+
import { ITablePagination, TCellsStyle, TCheckboxProps, TRowStyle, TTableVariants } from '../types';
|
|
6
5
|
interface CustomTableBodyProps {
|
|
7
6
|
table: TableType<any>;
|
|
8
7
|
onClickRow?: (row: Row<any>) => void;
|
|
@@ -15,7 +14,9 @@ interface CustomTableBodyProps {
|
|
|
15
14
|
cellsStyle?: TCellsStyle;
|
|
16
15
|
checkboxProps?: TCheckboxProps;
|
|
17
16
|
radioProps?: RadioProps;
|
|
18
|
-
rowBorderRadius
|
|
17
|
+
rowBorderRadius: number;
|
|
18
|
+
borderRadius: number;
|
|
19
|
+
variant: TTableVariants;
|
|
19
20
|
}
|
|
20
21
|
declare const CustomTableBody: FC<CustomTableBodyProps>;
|
|
21
22
|
export default CustomTableBody;
|
|
@@ -1,11 +1,29 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
//-----------------------------------------------------------------------------------------
|
|
3
3
|
//@Mui
|
|
4
|
-
import { TableBody } from '@mui/material';
|
|
4
|
+
import { TableBody, useTheme } from '@mui/material';
|
|
5
|
+
// Components
|
|
5
6
|
import CustomTableRow from '../../custom-table/components/CustomTableRow';
|
|
6
|
-
const CustomTableBody = ({ table, onClickRow, renderSubComponent, withSelect, withRadio, withIndex, pagination, rowStyle, cellsStyle, checkboxProps, radioProps, rowBorderRadius, }) => {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const CustomTableBody = ({ table, onClickRow, renderSubComponent, withSelect, withRadio, withIndex, pagination, rowStyle, cellsStyle, checkboxProps, radioProps, rowBorderRadius, borderRadius, variant, }) => {
|
|
8
|
+
const theme = useTheme();
|
|
9
|
+
return (_jsx(TableBody, { sx: {
|
|
10
|
+
'& tr': {
|
|
11
|
+
'& > td > div': {
|
|
12
|
+
borderBottom: variant === 'zebra' ? 'unset' : '1px solid',
|
|
13
|
+
borderColor: "border.primary"
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
'& tr:last-child': {
|
|
17
|
+
'& > td > div': { border: 'unset' },
|
|
18
|
+
'& > td:first-child > div': {
|
|
19
|
+
borderEndStartRadius: borderRadius * theme.shape.borderRadius,
|
|
20
|
+
},
|
|
21
|
+
'& > td:last-child > div': {
|
|
22
|
+
borderEndEndRadius: borderRadius * theme.shape.borderRadius,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
}, children: table?.getRowModel()?.rows?.map((row, i) => {
|
|
26
|
+
return (_jsx(CustomTableRow, { row: row, onClickRow: onClickRow, renderSubComponent: renderSubComponent, withSelect: withSelect, withRadio: withRadio, withIndex: withIndex, pagination: pagination, rowStyle: rowStyle, cellsStyle: cellsStyle, checkboxProps: checkboxProps, radioProps: radioProps, rowBorderRadius: rowBorderRadius, table: table, variant: variant }, row.id));
|
|
9
27
|
}) }));
|
|
10
28
|
};
|
|
11
29
|
export default CustomTableBody;
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
|
|
2
|
+
// Mui
|
|
3
|
+
import Box from '@mui/material/Box';
|
|
4
|
+
import Typography from '@mui/material/Typography';
|
|
5
|
+
import { TableCell } from '@mui/material';
|
|
6
|
+
const CustomTableCell = ({ cell, children }) => {
|
|
5
7
|
return (_jsx(TableCell, { id: `c-${cell.id}`, sx: {
|
|
6
8
|
px: 0,
|
|
7
9
|
py: 0,
|
|
8
|
-
width: cell?.getContext()?.column?.id ===
|
|
9
|
-
border:
|
|
10
|
-
height:
|
|
10
|
+
width: cell?.getContext()?.column?.id === 'select' ? 50 : 150,
|
|
11
|
+
border: 'none',
|
|
12
|
+
height: 'inherit',
|
|
11
13
|
}, children: _jsx(Box, { sx: {
|
|
12
|
-
backgroundColor:
|
|
13
|
-
justifyContent: cell?.getContext()?.column?.id ===
|
|
14
|
-
height:
|
|
14
|
+
backgroundColor: 'white',
|
|
15
|
+
justifyContent: cell?.getContext()?.column?.id === 'select' ? 'left' : 'center',
|
|
16
|
+
height: '100%',
|
|
15
17
|
fontSize: 14,
|
|
16
18
|
fontWeight: 500,
|
|
17
|
-
display:
|
|
18
|
-
alignItems:
|
|
19
|
-
px: cell?.getContext()?.column?.id ===
|
|
20
|
-
borderBottom:
|
|
21
|
-
}, children: children }) }, cell?.id));
|
|
19
|
+
display: 'flex',
|
|
20
|
+
alignItems: 'center',
|
|
21
|
+
px: cell?.getContext()?.column?.id === 'select' ? 0 : 4,
|
|
22
|
+
borderBottom: '1px solid #C5D0FF',
|
|
23
|
+
}, children: typeof children === 'string' || typeof children === 'number' ? (_jsx(Typography, { color: 'content.primary', fontSize: { xs: 10, md: 14 }, fontWeight: 300, children: children })) : (children) }) }, cell?.id));
|
|
22
24
|
};
|
|
23
25
|
export default CustomTableCell;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import { Table as TableType } from '@tanstack/table
|
|
2
|
+
import { Table as TableType } from '@tanstack/react-table';
|
|
3
3
|
import { TypographyProps } from '@mui/material/Typography';
|
|
4
4
|
import { SystemStyleObject } from '@mui/system';
|
|
5
|
-
import { TCheckboxProps } from '../
|
|
5
|
+
import { TCheckboxProps, TTableVariants } from '../types';
|
|
6
6
|
interface CustomTableHeadProps {
|
|
7
|
-
variant?:
|
|
7
|
+
variant?: TTableVariants;
|
|
8
8
|
table: TableType<any>;
|
|
9
9
|
withRadio?: boolean;
|
|
10
10
|
withSelect?: boolean;
|
|
@@ -12,6 +12,8 @@ interface CustomTableHeadProps {
|
|
|
12
12
|
headerStyle?: SystemStyleObject;
|
|
13
13
|
checkboxProps?: TCheckboxProps;
|
|
14
14
|
headerTypoProps?: TypographyProps;
|
|
15
|
+
borderRadius: number;
|
|
16
|
+
rowBorderRadius: number;
|
|
15
17
|
}
|
|
16
18
|
declare const CustomTableHead: FC<CustomTableHeadProps>;
|
|
17
19
|
export default CustomTableHead;
|
|
@@ -8,8 +8,10 @@ import Typography from '@mui/material/Typography';
|
|
|
8
8
|
import TableHead from '@mui/material/TableHead';
|
|
9
9
|
import TableRow from '@mui/material/TableRow';
|
|
10
10
|
import TableCell from '@mui/material/TableCell';
|
|
11
|
-
import
|
|
12
|
-
|
|
11
|
+
import Checkbox from '@mui/material/Checkbox';
|
|
12
|
+
import { useTheme } from '@mui/material';
|
|
13
|
+
const CustomTableHead = ({ table, variant, withSelect, withRadio, withIndex, headerStyle, checkboxProps, headerTypoProps, borderRadius, rowBorderRadius, }) => {
|
|
14
|
+
const theme = useTheme();
|
|
13
15
|
const { onChange: onChangeCheckbox, ...restCheckboxProps } = typeof checkboxProps === 'function'
|
|
14
16
|
? checkboxProps({ table })
|
|
15
17
|
: checkboxProps || {};
|
|
@@ -18,16 +20,16 @@ const CustomTableHead = ({ table, variant, withSelect, withRadio, withIndex, hea
|
|
|
18
20
|
zIndex: 10,
|
|
19
21
|
top: 0,
|
|
20
22
|
mb: 2,
|
|
21
|
-
bgcolor: '
|
|
23
|
+
bgcolor: 'surface.secondary',
|
|
22
24
|
borderBottom: (theme) => `1px solid ${theme.palette.divider}`,
|
|
23
25
|
'& th:first-of-type': {
|
|
24
|
-
borderRadius:
|
|
26
|
+
borderRadius: `${borderRadius * theme?.shape.borderRadius}px 0 0 ${rowBorderRadius * theme?.shape.borderRadius}px`,
|
|
25
27
|
},
|
|
26
28
|
'& th:last-child': {
|
|
27
|
-
borderRadius:
|
|
29
|
+
borderRadius: `0 ${borderRadius * theme?.shape.borderRadius}px ${rowBorderRadius * theme?.shape.borderRadius}px 0`,
|
|
28
30
|
},
|
|
29
31
|
'& th': {
|
|
30
|
-
border: variant === '
|
|
32
|
+
border: variant === 'linear' ? 0 : '',
|
|
31
33
|
fontSize: 10,
|
|
32
34
|
fontWeight: 700,
|
|
33
35
|
lineHeight: '13px',
|
|
@@ -41,8 +43,8 @@ const CustomTableHead = ({ table, variant, withSelect, withRadio, withIndex, hea
|
|
|
41
43
|
},
|
|
42
44
|
...headerStyle,
|
|
43
45
|
}, children: table?.getHeaderGroups()?.map((headerGroup) => (_jsxs(TableRow, { sx: {
|
|
44
|
-
height:
|
|
45
|
-
borderBottom: variant === 'standard' ? '1px solid #EBEBEB' : '',
|
|
46
|
+
height: { xs: 44, md: 56 },
|
|
47
|
+
// borderBottom: variant === 'standard' ? '1px solid #EBEBEB' : '',
|
|
46
48
|
}, 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
49
|
if (onChangeCheckbox) {
|
|
48
50
|
onChangeCheckbox?.(e, table.getIsAllRowsSelected());
|
|
@@ -51,13 +53,12 @@ const CustomTableHead = ({ table, variant, withSelect, withRadio, withIndex, hea
|
|
|
51
53
|
table.getToggleAllRowsSelectedHandler()(e);
|
|
52
54
|
}
|
|
53
55
|
}, ...restCheckboxProps })) : ('') }) }, 'head-cell')), headerGroup?.headers?.map((header) => {
|
|
54
|
-
|
|
56
|
+
const headerContext = flexRender(header?.column?.columnDef?.header, header?.getContext());
|
|
57
|
+
return (_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()
|
|
55
58
|
? 'cursor-pointer select-none'
|
|
56
59
|
: '',
|
|
57
|
-
onClick: header?.column?.getToggleSortingHandler(), children:
|
|
58
|
-
? '
|
|
59
|
-
: '',
|
|
60
|
-
onClick: header?.column?.getToggleSortingHandler(), children: _jsx(Typography, { ...headerTypoProps, children: flexRender(header?.column?.columnDef?.header, header?.getContext()) }) })) }, header?.id));
|
|
60
|
+
onClick: header?.column?.getToggleSortingHandler(), children: typeof headerContext === 'string' ||
|
|
61
|
+
typeof headerContext === 'number' ? (_jsx(Typography, { color: 'content.primary', fontSize: { xs: 10, md: 14 }, fontWeight: 300, ...headerTypoProps, children: headerContext })) : (headerContext) })) }, header?.id));
|
|
61
62
|
})] }, headerGroup.id))) }));
|
|
62
63
|
};
|
|
63
64
|
export default CustomTableHead;
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { Row } from '@tanstack/react-table';
|
|
4
|
-
import { ITablePagination, TCellsStyle, TCheckboxProps, TRowStyle } from '../CustomTable';
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { Row, Table as TableType } from '@tanstack/react-table';
|
|
5
3
|
import { RadioProps } from '@mui/material/Radio';
|
|
6
|
-
import {
|
|
7
|
-
export interface ICheckboxProps extends Omit<MuiCheckboxProps, 'onChange'> {
|
|
8
|
-
onChange?: (event: React.ChangeEvent<HTMLInputElement>, checked: boolean, row?: Row<any>) => void;
|
|
9
|
-
}
|
|
4
|
+
import { ITablePagination, TCellsStyle, TCheckboxProps, TRowStyle, TTableVariants } from '../types';
|
|
10
5
|
interface CustomTableRowProps {
|
|
11
6
|
row: Row<any>;
|
|
12
7
|
onClickRow?: (row: Row<any>) => void;
|
|
@@ -20,7 +15,8 @@ interface CustomTableRowProps {
|
|
|
20
15
|
checkboxProps?: TCheckboxProps;
|
|
21
16
|
radioProps?: RadioProps;
|
|
22
17
|
table: TableType<any>;
|
|
23
|
-
rowBorderRadius
|
|
18
|
+
rowBorderRadius: number;
|
|
19
|
+
variant: TTableVariants;
|
|
24
20
|
}
|
|
25
21
|
declare const CustomTableRow: FC<CustomTableRowProps>;
|
|
26
22
|
export default CustomTableRow;
|
|
@@ -1,32 +1,35 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { flexRender } from '@tanstack/react-table';
|
|
2
3
|
//@Mui
|
|
3
4
|
import Box from '@mui/material/Box';
|
|
4
|
-
import
|
|
5
|
-
import { Checkbox, TableCell, TableRow } from '@mui/material';
|
|
6
|
-
import { flexRender } from '@tanstack/react-table';
|
|
7
|
-
import CustomTableCell from '../components/CustomTableCell';
|
|
5
|
+
import TableRow from '@mui/material/TableRow';
|
|
8
6
|
import Typography from '@mui/material/Typography';
|
|
7
|
+
import Collapse from '@mui/material/Collapse';
|
|
8
|
+
import TableCell from '@mui/material/TableCell';
|
|
9
|
+
import Checkbox from '@mui/material/Checkbox';
|
|
9
10
|
import Radio from '@mui/material/Radio';
|
|
10
|
-
|
|
11
|
+
import { useTheme } from '@mui/material';
|
|
12
|
+
// Components
|
|
13
|
+
import CustomTableCell from '../components/CustomTableCell';
|
|
14
|
+
const CustomTableRow = ({ row, onClickRow, renderSubComponent, withSelect, withIndex, withRadio, pagination, rowStyle, cellsStyle, checkboxProps, radioProps, table, rowBorderRadius, variant }) => {
|
|
15
|
+
const theme = useTheme();
|
|
11
16
|
const { onChange: onChangeCheckbox, ...restCheckboxProps } = typeof checkboxProps === 'function'
|
|
12
17
|
? checkboxProps({ row, table })
|
|
13
18
|
: checkboxProps || {};
|
|
14
19
|
return (_jsxs(_Fragment, { children: [_jsxs(TableRow, { id: `tr-${row.index}`, onClick: () => (onClickRow ? onClickRow(row) : ''), sx: {
|
|
15
|
-
height:
|
|
20
|
+
height: { xs: 44, md: 56 },
|
|
16
21
|
cursor: onClickRow ? 'pointer' : '',
|
|
17
22
|
'& td:first-of-type > div': {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
borderStartStartRadius: row.index === 0 ? 0 : rowBorderRadius ?? 10,
|
|
23
|
+
borderEndStartRadius: rowBorderRadius * theme?.shape.borderRadius,
|
|
24
|
+
borderStartStartRadius: rowBorderRadius * theme?.shape.borderRadius,
|
|
21
25
|
},
|
|
22
26
|
'& td:last-child > div': {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
borderStartEndRadius: row.index === 0 ? 0 : rowBorderRadius ?? 10,
|
|
27
|
+
borderEndEndRadius: rowBorderRadius * theme?.shape.borderRadius,
|
|
28
|
+
borderStartEndRadius: rowBorderRadius * theme?.shape.borderRadius,
|
|
26
29
|
},
|
|
27
30
|
...(rowStyle ? rowStyle({ row }) : {}),
|
|
28
31
|
'& td > div': {
|
|
29
|
-
|
|
32
|
+
bgcolor: variant === "linear" ? "surface.primary" : row.index % 2 === 0 ? "surface.primary" : "surface.secondary",
|
|
30
33
|
...(cellsStyle ? cellsStyle({ row }) : {}),
|
|
31
34
|
transition: '0.15s ease all',
|
|
32
35
|
},
|
|
@@ -53,7 +56,7 @@ const CustomTableRow = ({ row, onClickRow, renderSubComponent, withSelect, withI
|
|
|
53
56
|
px: 5,
|
|
54
57
|
border: 'unset !important',
|
|
55
58
|
// borderBottom: "1px solid #C5D0FF",
|
|
56
|
-
}, children: _jsx(Typography, {
|
|
59
|
+
}, children: _jsx(Typography, { children: pagination
|
|
57
60
|
? (pagination.pageIndex - 1) * pagination.pageSize +
|
|
58
61
|
row.index +
|
|
59
62
|
1
|
|
@@ -1,24 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
import { ITablePagination } from '
|
|
4
|
-
|
|
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) => {
|
|
2
|
+
import { Row } from '@tanstack/react-table';
|
|
3
|
+
import { ITablePagination, IUseTableProps } from '../types';
|
|
4
|
+
declare const useTable: ({ state, getRowId, data, columns, pageSize, ...props }: IUseTableProps) => {
|
|
17
5
|
table: import("@tanstack/react-table").Table<any>;
|
|
18
6
|
pagination: ITablePagination;
|
|
19
7
|
selectedRows: Row<any>[];
|
|
20
8
|
renderSubComponent: ((props: {
|
|
21
9
|
row: Row<any>;
|
|
22
|
-
}) =>
|
|
10
|
+
}) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) | undefined;
|
|
23
11
|
};
|
|
24
12
|
export default useTable;
|
|
@@ -14,8 +14,8 @@ const useTable = ({ state, getRowId, data, columns, pageSize, ...props }) => {
|
|
|
14
14
|
const selectedRowIds = Object?.keys(old);
|
|
15
15
|
if (selectedRowIds) {
|
|
16
16
|
// @ts-ignore
|
|
17
|
-
setSelectedRows(
|
|
18
|
-
const newSelectedRows = selectedRowIds.map(
|
|
17
|
+
setSelectedRows(prv => {
|
|
18
|
+
const newSelectedRows = selectedRowIds.map(id => {
|
|
19
19
|
return table?.getRowModel()?.rowsById?.[id]
|
|
20
20
|
? getRowInCurrentPage(id)
|
|
21
21
|
: getRowInOtherPage(id);
|
|
@@ -32,7 +32,7 @@ const useTable = ({ state, getRowId, data, columns, pageSize, ...props }) => {
|
|
|
32
32
|
//selection
|
|
33
33
|
const [rowSelection, setRowSelection] = useState({});
|
|
34
34
|
const { renderSubComponent, getRowCanExpand, onSelectRow, multiSelect, ...tProps } = props;
|
|
35
|
-
const memoColumns = useMemo(() => columns, [
|
|
35
|
+
const memoColumns = useMemo(() => columns, []);
|
|
36
36
|
const memoData = useMemo(() => data, [data]);
|
|
37
37
|
//generate table with react-table
|
|
38
38
|
const table = useReactTable({
|
|
@@ -49,7 +49,7 @@ const useTable = ({ state, getRowId, data, columns, pageSize, ...props }) => {
|
|
|
49
49
|
// getRowId && at(row, getRowId)?.[0]
|
|
50
50
|
// ? at(row, getRowId)?.[0]
|
|
51
51
|
// : row.id,
|
|
52
|
-
onRowSelectionChange:
|
|
52
|
+
onRowSelectionChange: row => handleSelectRow(row),
|
|
53
53
|
getCoreRowModel: getCoreRowModel(),
|
|
54
54
|
columns: memoColumns,
|
|
55
55
|
...tProps,
|
|
@@ -65,7 +65,7 @@ const useTable = ({ state, getRowId, data, columns, pageSize, ...props }) => {
|
|
|
65
65
|
pageIndex: table?.getState()?.pagination?.pageIndex + 1,
|
|
66
66
|
pageSize: table?.getState()?.pagination?.pageSize,
|
|
67
67
|
pageCounts: table?.getPageCount(),
|
|
68
|
-
onChangePage:
|
|
68
|
+
onChangePage: page => table.setPageIndex(page - 1),
|
|
69
69
|
};
|
|
70
70
|
return {
|
|
71
71
|
table,
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { Cell, Row, ColumnDef, TableOptions, Table as TableType } from '@tanstack/react-table';
|
|
3
|
+
import { SystemStyleObject } from '@mui/system';
|
|
4
|
+
import { StackProps } from '@mui/material/Stack';
|
|
5
|
+
import { TypographyProps } from '@mui/material/Typography';
|
|
6
|
+
import { RadioProps } from '@mui/material/Radio';
|
|
7
|
+
import { ITableFooterProps } from '../custom-pagination/custom-pagination-2/CustomPagination2';
|
|
8
|
+
import { CheckboxProps as MuiCheckboxProps } from '@mui/material/Checkbox';
|
|
9
|
+
export type TColumns = ColumnDef<any, any>[];
|
|
10
|
+
export interface IUseTableProps extends Partial<Omit<TableOptions<any>, 'getRowId'>> {
|
|
11
|
+
columns: ColumnDef<any, any>[];
|
|
12
|
+
data: any;
|
|
13
|
+
pageSize?: number;
|
|
14
|
+
multiSelect?: boolean;
|
|
15
|
+
onSelectRow?: (data: any) => void;
|
|
16
|
+
getRowId?: string;
|
|
17
|
+
renderSubComponent?: (props: {
|
|
18
|
+
row: Row<any>;
|
|
19
|
+
}) => React.ReactElement;
|
|
20
|
+
getRowCanExpand?: (row: Row<any>) => boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface ITablePagination {
|
|
23
|
+
pageIndex: number;
|
|
24
|
+
pageSize: number;
|
|
25
|
+
pageCounts: number;
|
|
26
|
+
onChangePage: (pageIndex: number) => void;
|
|
27
|
+
onChangePageSize?: (pageSize: number) => void;
|
|
28
|
+
}
|
|
29
|
+
export interface ITableRowStyle {
|
|
30
|
+
row: Row<any>;
|
|
31
|
+
hover?: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface ITableCellsStyle {
|
|
34
|
+
row: Row<any>;
|
|
35
|
+
cell?: Cell<any, any>;
|
|
36
|
+
hover?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export type TRowStyle = (props: ITableRowStyle) => SystemStyleObject;
|
|
39
|
+
export type TCellsStyle = (props: ITableCellsStyle) => SystemStyleObject;
|
|
40
|
+
export interface ICheckboxProps extends Omit<MuiCheckboxProps, 'onChange'> {
|
|
41
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>, checked: boolean, row?: Row<any>) => void;
|
|
42
|
+
}
|
|
43
|
+
export type TCheckboxProps = ((props: {
|
|
44
|
+
row?: Row<any>;
|
|
45
|
+
table: TableType<any>;
|
|
46
|
+
}) => ICheckboxProps) | ICheckboxProps;
|
|
47
|
+
export type TTableVariants = 'zebra' | 'linear';
|
|
48
|
+
export interface ICustomTable {
|
|
49
|
+
id?: string;
|
|
50
|
+
pagination?: ITablePagination;
|
|
51
|
+
table: TableType<any>;
|
|
52
|
+
variant?: TTableVariants;
|
|
53
|
+
wrapperStackProps?: StackProps;
|
|
54
|
+
footerProps?: Omit<ITableFooterProps, 'pagination'>;
|
|
55
|
+
onClickRow?: (row: Row<any>) => void;
|
|
56
|
+
renderSubComponent?: any;
|
|
57
|
+
isLoading?: boolean;
|
|
58
|
+
isError?: boolean;
|
|
59
|
+
withRadio?: boolean;
|
|
60
|
+
withSelect?: boolean;
|
|
61
|
+
withIndex?: boolean;
|
|
62
|
+
rowStyle?: TRowStyle;
|
|
63
|
+
cellsStyle?: TCellsStyle;
|
|
64
|
+
headerStyle?: SystemStyleObject;
|
|
65
|
+
headerTypoProps?: TypographyProps;
|
|
66
|
+
checkboxProps?: TCheckboxProps;
|
|
67
|
+
radioProps?: RadioProps;
|
|
68
|
+
emptyListComponent?: string | ReactNode;
|
|
69
|
+
rowBorderRadius?: number;
|
|
70
|
+
borderRadius?: number;
|
|
71
|
+
}
|
|
72
|
+
export interface ITableAction {
|
|
73
|
+
label: string | React.ReactNode;
|
|
74
|
+
icon?: React.ReactElement;
|
|
75
|
+
onClick?: () => void;
|
|
76
|
+
disabled?: boolean;
|
|
77
|
+
}
|