@pdg/react-table 1.0.103 → 1.0.105

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.
Files changed (54) hide show
  1. package/dist/@types/index.d.ts +1 -1
  2. package/dist/@types/types.d.ts +11 -11
  3. package/dist/InfoTable/InfoTable.d.ts +7 -7
  4. package/dist/InfoTable/InfoTable.types.d.ts +78 -79
  5. package/dist/InfoTable/index.d.ts +4 -4
  6. package/dist/SearchTable/SearchTable.d.ts +8 -8
  7. package/dist/SearchTable/SearchTable.types.d.ts +42 -34
  8. package/dist/SearchTable/index.d.ts +4 -4
  9. package/dist/Table/Table.d.ts +8 -8
  10. package/dist/Table/Table.types.d.ts +129 -130
  11. package/dist/Table/index.d.ts +4 -4
  12. package/dist/TableBodyCell/TableBodyCell.d.ts +4 -4
  13. package/dist/TableBodyCell/TableBodyCell.types.d.ts +18 -18
  14. package/dist/TableBodyCell/index.d.ts +4 -4
  15. package/dist/TableBodyRow/TableBodyRow.d.ts +7 -7
  16. package/dist/TableBodyRow/TableBodyRow.types.d.ts +18 -19
  17. package/dist/TableBodyRow/index.d.ts +4 -4
  18. package/dist/TableButton/TableButton.d.ts +4 -4
  19. package/dist/TableButton/TableButton.types.d.ts +3 -4
  20. package/dist/TableButton/index.d.ts +4 -4
  21. package/dist/TableCommonCell/TableCommonCell.d.ts +4 -4
  22. package/dist/TableCommonCell/TableCommonCell.types.d.ts +11 -11
  23. package/dist/TableCommonCell/index.d.ts +4 -4
  24. package/dist/TableContext/TableContext.d.ts +4 -4
  25. package/dist/TableContext/TableContext.types.d.ts +14 -14
  26. package/dist/TableContext/index.d.ts +5 -5
  27. package/dist/TableContext/useTableState.d.ts +2 -2
  28. package/dist/TableContextProvider/TableContextProvider.d.ts +4 -4
  29. package/dist/TableContextProvider/TableContextProvider.types.d.ts +6 -6
  30. package/dist/TableContextProvider/index.d.ts +4 -4
  31. package/dist/TableFooterCell/TableFooterCell.d.ts +4 -4
  32. package/dist/TableFooterCell/TableFooterCell.types.d.ts +5 -5
  33. package/dist/TableFooterCell/index.d.ts +4 -4
  34. package/dist/TableHeadCell/TableHeadCell.d.ts +4 -4
  35. package/dist/TableHeadCell/TableHeadCell.types.d.ts +11 -11
  36. package/dist/TableHeadCell/index.d.ts +4 -4
  37. package/dist/TableMenuButton/TableMenuButton.d.ts +4 -4
  38. package/dist/TableMenuButton/TableMenuButton.types.d.ts +9 -10
  39. package/dist/TableMenuButton/index.d.ts +4 -4
  40. package/dist/TablePagination/TablePagination.d.ts +4 -4
  41. package/dist/TablePagination/TablePagination.types.d.ts +13 -13
  42. package/dist/TablePagination/index.d.ts +4 -4
  43. package/dist/TableTopHead/TableTopHead.d.ts +4 -4
  44. package/dist/TableTopHead/TableTopHead.types.d.ts +17 -18
  45. package/dist/TableTopHead/index.d.ts +4 -4
  46. package/dist/index.d.ts +7 -7
  47. package/dist/index.esm.js +1896 -2007
  48. package/dist/index.js +1896 -2007
  49. package/package.json +18 -18
  50. package/dist/@util/index.d.ts +0 -1
  51. package/dist/@util/table.d.ts +0 -8
  52. package/dist/InfoTable/InfoTable.style.d.ts +0 -14
  53. package/dist/Table/Table.styles.d.ts +0 -5
  54. package/dist/TableTopHead/TableTopHead.style.d.ts +0 -4
@@ -1 +1 @@
1
- export * from './types';
1
+ export * from './types';
@@ -1,11 +1,11 @@
1
- import { CSSProperties, ReactNode } from 'react';
2
- import { SxProps } from '@mui/system';
3
- import { Theme } from '@mui/material/styles';
4
- export interface CommonProps {
5
- children?: ReactNode;
6
- className?: string;
7
- style?: CSSProperties;
8
- }
9
- export interface CommonSxProps extends CommonProps {
10
- sx?: SxProps<Theme>;
11
- }
1
+ import { CSSProperties, ReactNode } from 'react';
2
+ import { SxProps } from '@mui/system';
3
+ import { Theme } from '@mui/material/styles';
4
+ export interface TableCommonProps {
5
+ children?: ReactNode;
6
+ className?: string;
7
+ style?: CSSProperties;
8
+ }
9
+ export interface TableCommonSxProps extends TableCommonProps {
10
+ sx?: SxProps<Theme>;
11
+ }
@@ -1,7 +1,7 @@
1
- import React from 'react';
2
- import { InfoTableProps as Props, InfoTableInfo } from './InfoTable.types';
3
- interface WithType<T = InfoTableInfo> extends React.FC<Props<T>> {
4
- <T = InfoTableInfo>(props: Props<T>): ReturnType<React.FC<Props<T>>>;
5
- }
6
- declare const InfoTable: WithType;
7
- export default InfoTable;
1
+ import React from 'react';
2
+ import { InfoTableProps as Props, InfoTableInfo } from './InfoTable.types';
3
+ interface WithType<T = InfoTableInfo> extends React.FC<Props<T>> {
4
+ <T = InfoTableInfo>(props: Props<T>): ReturnType<React.FC<Props<T>>>;
5
+ }
6
+ declare const InfoTable: WithType;
7
+ export default InfoTable;
@@ -1,79 +1,78 @@
1
- import { ReactNode } from 'react';
2
- import { BoxProps, GridProps, IconButtonProps, TypographyProps } from '@mui/material';
3
- import { CommonSxProps } from '../@types';
4
- import { PdgIconProps } from '@pdg/react-component';
5
- export interface InfoTableInfo {
6
- [key: string]: any;
7
- }
8
- export type InfoTableItemType = 'text' | 'number' | 'tel' | 'url' | 'email' | 'date' | 'datetime' | 'date-hour' | 'date-minute' | 'company_no' | 'personal_no' | 'divider';
9
- export interface InfoTableItem<T = InfoTableInfo> {
10
- icon?: PdgIconProps['children'];
11
- label?: ReactNode;
12
- name?: keyof T;
13
- type?: InfoTableItemType;
14
- ellipsis?: boolean;
15
- className?: string;
16
- dateFormat?: string;
17
- dateTwoLine?: boolean;
18
- numberPrefix?: string;
19
- numberSuffix?: string;
20
- dividerColor?: TypographyProps['color'];
21
- dividerLine?: boolean;
22
- style?: CommonSxProps['style'];
23
- sx?: BoxProps['sx'];
24
- labelClassName?: string;
25
- labelColor?: TypographyProps['color'];
26
- labelStyle?: CommonSxProps['style'];
27
- labelSx?: BoxProps['sx'];
28
- valueClassName?: string;
29
- valueStyle?: CommonSxProps['style'];
30
- valueSx?: CommonSxProps['sx'];
31
- xs?: number;
32
- sm?: number;
33
- md?: number;
34
- lg?: number;
35
- xl?: number;
36
- clipboard?: boolean;
37
- clipboardIcon?: string;
38
- clipboardText?: string;
39
- clipboardProps?: Omit<IconButtonProps, 'children'>;
40
- onRender?(info: T): ReactNode;
41
- onRenderEmpty?(info: T): ReactNode;
42
- onHide?(info: T): boolean;
43
- onXs?(info: T): number;
44
- onSm?(info: T): number;
45
- onMd?(info: T): number;
46
- onLg?(info: T): number;
47
- onXl?(info: T): number;
48
- }
49
- export type InfoTableItems<T = InfoTableInfo> = (InfoTableItem<T> | false | undefined | null)[];
50
- export type InfoTableCols = 1 | 2 | 3 | 4 | 6 | 12;
51
- export interface InfoTableProps<T = InfoTableInfo> {
52
- cols: InfoTableCols | {
53
- xs?: InfoTableCols;
54
- sm?: InfoTableCols;
55
- md?: InfoTableCols;
56
- lg?: InfoTableCols;
57
- xl?: InfoTableCols;
58
- };
59
- spacing?: GridProps['spacing'];
60
- columnSpacing?: GridProps['spacing'];
61
- rowSpacing?: GridProps['spacing'];
62
- className?: string;
63
- style?: CommonSxProps['style'];
64
- sx?: CommonSxProps['sx'];
65
- labelClassName?: string;
66
- labelColor?: TypographyProps['color'];
67
- labelStyle?: CommonSxProps['style'];
68
- labelSx?: BoxProps['sx'];
69
- dividerColor?: TypographyProps['color'];
70
- valueClassName?: string;
71
- valueStyle?: CommonSxProps['style'];
72
- valueSx?: CommonSxProps['sx'];
73
- ellipsis?: boolean;
74
- valueUnderline?: boolean;
75
- info: T;
76
- items: InfoTableItems<T>;
77
- onCopyToClipboard?(item: InfoTableItem<T>, text: string): void;
78
- }
79
- export declare const InfoTableDefaultProps: Pick<InfoTableProps, 'spacing' | 'columnSpacing' | 'rowSpacing' | 'labelColor' | 'dividerColor'>;
1
+ import { ReactNode } from 'react';
2
+ import { BoxProps, GridProps, IconButtonProps, TypographyProps } from '@mui/material';
3
+ import { TableCommonSxProps } from '../@types';
4
+ import { PdgIconProps } from '@pdg/react-component';
5
+ export interface InfoTableInfo {
6
+ [key: string]: any;
7
+ }
8
+ export type InfoTableItemType = 'text' | 'number' | 'tel' | 'url' | 'email' | 'date' | 'datetime' | 'date-hour' | 'date-minute' | 'company_no' | 'personal_no' | 'divider';
9
+ export interface InfoTableItem<T = InfoTableInfo> {
10
+ icon?: PdgIconProps['children'];
11
+ label?: ReactNode;
12
+ name?: keyof T;
13
+ type?: InfoTableItemType;
14
+ ellipsis?: boolean;
15
+ className?: string;
16
+ dateFormat?: string;
17
+ dateTwoLine?: boolean;
18
+ numberPrefix?: string;
19
+ numberSuffix?: string;
20
+ dividerColor?: TypographyProps['color'];
21
+ dividerLine?: boolean;
22
+ style?: TableCommonSxProps['style'];
23
+ sx?: BoxProps['sx'];
24
+ labelClassName?: string;
25
+ labelColor?: TypographyProps['color'];
26
+ labelStyle?: TableCommonSxProps['style'];
27
+ labelSx?: BoxProps['sx'];
28
+ valueClassName?: string;
29
+ valueStyle?: TableCommonSxProps['style'];
30
+ valueSx?: TableCommonSxProps['sx'];
31
+ xs?: number;
32
+ sm?: number;
33
+ md?: number;
34
+ lg?: number;
35
+ xl?: number;
36
+ clipboard?: boolean;
37
+ clipboardIcon?: string;
38
+ clipboardText?: string;
39
+ clipboardProps?: Omit<IconButtonProps, 'children'>;
40
+ onRender?(info: T): ReactNode;
41
+ onRenderEmpty?(info: T): ReactNode;
42
+ onHide?(info: T): boolean;
43
+ onXs?(info: T): number;
44
+ onSm?(info: T): number;
45
+ onMd?(info: T): number;
46
+ onLg?(info: T): number;
47
+ onXl?(info: T): number;
48
+ }
49
+ export type InfoTableItems<T = InfoTableInfo> = (InfoTableItem<T> | false | undefined | null)[];
50
+ export type InfoTableCols = 1 | 2 | 3 | 4 | 6 | 12;
51
+ export interface InfoTableProps<T = InfoTableInfo> {
52
+ cols: InfoTableCols | {
53
+ xs?: InfoTableCols;
54
+ sm?: InfoTableCols;
55
+ md?: InfoTableCols;
56
+ lg?: InfoTableCols;
57
+ xl?: InfoTableCols;
58
+ };
59
+ spacing?: GridProps['spacing'];
60
+ columnSpacing?: GridProps['spacing'];
61
+ rowSpacing?: GridProps['spacing'];
62
+ className?: string;
63
+ style?: TableCommonSxProps['style'];
64
+ sx?: TableCommonSxProps['sx'];
65
+ labelClassName?: string;
66
+ labelColor?: TypographyProps['color'];
67
+ labelStyle?: TableCommonSxProps['style'];
68
+ labelSx?: BoxProps['sx'];
69
+ dividerColor?: TypographyProps['color'];
70
+ valueClassName?: string;
71
+ valueStyle?: TableCommonSxProps['style'];
72
+ valueSx?: TableCommonSxProps['sx'];
73
+ ellipsis?: boolean;
74
+ valueUnderline?: boolean;
75
+ info: T;
76
+ items: InfoTableItems<T>;
77
+ onCopyToClipboard?(item: InfoTableItem<T>, text: string): void;
78
+ }
@@ -1,4 +1,4 @@
1
- import InfoTable from './InfoTable';
2
- export default InfoTable;
3
- export { InfoTable };
4
- export * from './InfoTable.types';
1
+ import InfoTable from './InfoTable';
2
+ export default InfoTable;
3
+ export { InfoTable };
4
+ export * from './InfoTable.types';
@@ -1,8 +1,8 @@
1
- import React from 'react';
2
- import { SearchTableProps, SearchTableCommands } from './SearchTable.types';
3
- import { TableItem } from '../Table';
4
- interface WithForwardRefType<T = TableItem> extends React.FC<SearchTableProps<T>> {
5
- <T = TableItem>(props: SearchTableProps<T> & React.RefAttributes<SearchTableCommands<T>>): ReturnType<React.FC<SearchTableProps<T>>>;
6
- }
7
- declare const SearchTable: WithForwardRefType;
8
- export default SearchTable;
1
+ import React from 'react';
2
+ import { SearchTableProps, SearchTableCommands } from './SearchTable.types';
3
+ import { TableItem } from '../Table';
4
+ interface WithForwardRefType<T = TableItem> extends React.FC<SearchTableProps<T>> {
5
+ <T = TableItem>(props: SearchTableProps<T> & React.RefAttributes<SearchTableCommands<T>>): ReturnType<React.FC<SearchTableProps<T>>>;
6
+ }
7
+ declare const SearchTable: WithForwardRefType;
8
+ export default SearchTable;
@@ -1,34 +1,42 @@
1
- import React from 'react';
2
- import { TableProps, TableCommands, TableItem } from '../Table';
3
- import { FormValueMap, SearchCommands, SearchProps } from '@pdg/react-form';
4
- import { ReactNode } from 'react';
5
- import { CommonSxProps } from '../@types';
6
- export interface SearchTableData<T = TableItem> {
7
- items: TableProps<T>['items'];
8
- paging?: TableProps<T>['paging'];
9
- }
10
- export interface SearchTableSearchProps extends Omit<SearchProps, 'ref' | 'color' | 'autoSubmit' | 'onSubmit'> {
11
- ref?: React.ForwardedRef<SearchCommands>;
12
- searchGroups?: ReactNode;
13
- }
14
- export interface SearchTableTableProps<T = TableItem> extends Omit<TableProps<T>, 'ref' | 'items' | 'paging' | 'onPageChange'> {
15
- ref?: React.ForwardedRef<TableCommands<T>>;
16
- }
17
- export interface SearchTableProps<T = TableItem> extends CommonSxProps {
18
- color?: SearchProps['color'];
19
- hash?: boolean;
20
- stickyHeader?: boolean;
21
- fullHeight?: boolean;
22
- search?: SearchTableSearchProps;
23
- table: SearchTableTableProps<T>;
24
- betweenSearchTableComponent?: ReactNode;
25
- onGetData?(data: FormValueMap): Promise<SearchTableData<T>>;
26
- onRequestHashChange?(hash: string): void;
27
- }
28
- export declare const SearchTableDefaultProps: {};
29
- export interface SearchTableCommands<T = TableItem> {
30
- reload(page?: number): void;
31
- getLastLoadData(): FormValueMap;
32
- getSearch(): SearchCommands | undefined;
33
- getTable(): TableCommands<T> | undefined;
34
- }
1
+ import React from 'react';
2
+ import { TableProps, TableCommands, TableItem } from '../Table';
3
+ import { FormValueMap, SearchCommands, SearchProps } from '@pdg/react-form';
4
+ import { ReactNode } from 'react';
5
+ import { TableCommonSxProps } from '../@types';
6
+ export interface SearchInfo {
7
+ ref?: SearchTableSearchProps['ref'];
8
+ searchGroups?: SearchTableSearchProps['searchGroups'];
9
+ props?: Omit<SearchTableSearchProps, 'ref' | 'searchGroups'>;
10
+ }
11
+ export interface TableInfo {
12
+ ref?: SearchTableTableProps['ref'];
13
+ props?: Omit<SearchTableTableProps, 'ref'>;
14
+ }
15
+ export interface SearchTableData<T = TableItem> {
16
+ items: TableProps<T>['items'];
17
+ paging?: TableProps<T>['paging'];
18
+ }
19
+ export interface SearchTableSearchProps extends Omit<SearchProps, 'ref' | 'color' | 'autoSubmit' | 'onSubmit'> {
20
+ ref?: React.ForwardedRef<SearchCommands>;
21
+ searchGroups?: ReactNode;
22
+ }
23
+ export interface SearchTableTableProps<T = TableItem> extends Omit<TableProps<T>, 'ref' | 'items' | 'paging' | 'onPageChange'> {
24
+ ref?: React.ForwardedRef<TableCommands<T>>;
25
+ }
26
+ export interface SearchTableProps<T = TableItem> extends TableCommonSxProps {
27
+ color?: SearchProps['color'];
28
+ hash?: boolean;
29
+ stickyHeader?: boolean;
30
+ fullHeight?: boolean;
31
+ search?: SearchTableSearchProps;
32
+ table: SearchTableTableProps<T>;
33
+ betweenSearchTableComponent?: ReactNode;
34
+ onGetData?(data: FormValueMap): Promise<SearchTableData<T>>;
35
+ onRequestHashChange?(hash: string): void;
36
+ }
37
+ export interface SearchTableCommands<T = TableItem> {
38
+ reload(page?: number): void;
39
+ getLastLoadData(): FormValueMap;
40
+ getSearch(): SearchCommands | undefined;
41
+ getTable(): TableCommands<T> | undefined;
42
+ }
@@ -1,4 +1,4 @@
1
- import SearchTable from './SearchTable';
2
- export default SearchTable;
3
- export { SearchTable };
4
- export * from './SearchTable.types';
1
+ import SearchTable from './SearchTable';
2
+ export default SearchTable;
3
+ export { SearchTable };
4
+ export * from './SearchTable.types';
@@ -1,8 +1,8 @@
1
- import React from 'react';
2
- import { TableProps, TableCommands, TableItem } from './Table.types';
3
- import 'simplebar-react/dist/simplebar.min.css';
4
- interface WithForwardRefType<T = TableItem> extends React.FC<TableProps<T>> {
5
- <T = TableItem>(props: TableProps<T> & React.RefAttributes<TableCommands<T>>): ReturnType<React.FC<TableProps<T>>>;
6
- }
7
- declare const Table: WithForwardRefType;
8
- export default Table;
1
+ import React from 'react';
2
+ import { TableProps, TableCommands, TableItem } from './Table.types';
3
+ import 'simplebar-react/dist/simplebar.min.css';
4
+ interface WithForwardRefType<T = TableItem> extends React.FC<TableProps<T>> {
5
+ <T = TableItem>(props: TableProps<T> & React.RefAttributes<TableCommands<T>>): ReturnType<React.FC<TableProps<T>>>;
6
+ }
7
+ declare const Table: WithForwardRefType;
8
+ export default Table;
@@ -1,130 +1,129 @@
1
- import { CSSProperties, ReactNode } from 'react';
2
- import { TableCellProps, TooltipProps } from '@mui/material';
3
- import { TablePaginationProps } from '../TablePagination/TablePagination.types';
4
- import { CommonSxProps } from '../@types';
5
- import { TableTopHeadProps } from '../TableTopHead';
6
- /********************************************************************************************************************
7
- * TableItem
8
- * ******************************************************************************************************************/
9
- export interface TableItem {
10
- [key: string]: any;
11
- }
12
- /********************************************************************************************************************
13
- * TableColumn
14
- * ******************************************************************************************************************/
15
- export interface TableColumn<T = TableItem> {
16
- id?: string;
17
- type?: 'text' | 'number' | 'tel' | 'date' | 'datetime' | 'date-hour' | 'date-minute' | 'company_no' | 'personal_no' | 'img' | 'button' | 'buttons' | 'check';
18
- label?: ReactNode;
19
- name?: keyof T;
20
- align?: TableCellProps['align'];
21
- width?: string | number;
22
- minWidth?: string | number;
23
- ellipsis?: boolean;
24
- dateFormat?: string;
25
- dateTwoLine?: boolean;
26
- hideAllCheck?: boolean;
27
- numberPrefix?: string;
28
- numberSuffix?: string;
29
- tooltipProps?: Omit<TooltipProps, 'children' | 'title'>;
30
- display?: {
31
- xs?: boolean;
32
- sm?: boolean;
33
- md?: boolean;
34
- lg?: boolean;
35
- xl?: boolean;
36
- };
37
- paddingLeft?: number;
38
- paddingRight?: number;
39
- head?: {
40
- className?: CommonSxProps['className'];
41
- style?: CommonSxProps['style'];
42
- backgroundColor?: CSSProperties['backgroundColor'];
43
- sx?: CommonSxProps['sx'];
44
- onGetClassName?(): CommonSxProps['className'];
45
- onGetStyle?(): CommonSxProps['style'];
46
- onGetSx?(): CommonSxProps['sx'];
47
- onRender?(): ReactNode;
48
- };
49
- footer?: {
50
- value?: ReactNode;
51
- className?: CommonSxProps['className'];
52
- style?: CommonSxProps['style'];
53
- backgroundColor?: CSSProperties['backgroundColor'];
54
- sx?: CommonSxProps['sx'];
55
- onGetClassName?(): CommonSxProps['className'];
56
- onGetStyle?(): CommonSxProps['style'];
57
- onGetSx?(): CommonSxProps['sx'];
58
- onRender?(): ReactNode;
59
- };
60
- className?: CommonSxProps['className'];
61
- style?: CommonSxProps['style'];
62
- backgroundColor?: CSSProperties['backgroundColor'];
63
- sx?: CommonSxProps['sx'];
64
- onGetClassName?(item: T, index: number): CommonSxProps['className'];
65
- onGetStyle?(item: T, index: number): CommonSxProps['style'];
66
- onGetSx?(item: T, index: number): CommonSxProps['sx'];
67
- onHide?(item: T, index: number): boolean;
68
- onGetTooltip?(item: T, index: number): ReactNode;
69
- onRender?(item: T, index: number): ReactNode;
70
- onClick?(item: T, index: number): void;
71
- onInitChecked?(item: T): boolean;
72
- onCheckDisabled?(item: T): boolean;
73
- onCheckChange?(item: T, checked: boolean): void;
74
- onCheckDisabledChange?(item: T, checkDisabled: boolean): void;
75
- }
76
- export type TableColumns<T = TableItem> = (TableColumn<T> | false | undefined | null)[];
77
- /********************************************************************************************************************
78
- * TableProps
79
- * ******************************************************************************************************************/
80
- export interface TableProps<T = TableItem> extends CommonSxProps {
81
- caption?: ReactNode;
82
- topHeadRows?: TableTopHeadProps['rows'];
83
- columns?: TableColumns<T>;
84
- defaultAlign?: TableCellProps['align'];
85
- defaultEllipsis?: boolean;
86
- stickyHeader?: boolean;
87
- items?: T[];
88
- paging?: TablePaginationProps['paging'];
89
- pagingAlign?: TablePaginationProps['align'];
90
- height?: string | number;
91
- maxHeight?: string | number;
92
- minHeight?: string | number;
93
- fullHeight?: boolean;
94
- showOddColor?: boolean;
95
- showEvenColor?: boolean;
96
- cellPadding?: string | number;
97
- footer?: boolean;
98
- noData?: ReactNode;
99
- pagination?: {
100
- className?: CommonSxProps['className'];
101
- style?: CommonSxProps['style'];
102
- sx?: CommonSxProps['sx'];
103
- };
104
- sortable?: boolean;
105
- onClick?(item: T, index: number): void;
106
- onGetBodyRowClassName?(item: T, index: number): CommonSxProps['className'] | undefined;
107
- onGetBodyRowStyle?(item: T, index: number): CommonSxProps['style'] | undefined;
108
- onGetBodyRowSx?(item: T, index: number): CommonSxProps['sx'] | undefined;
109
- onGetBodyColumnClassName?(column: TableColumn<T>, item: T, index: number): CommonSxProps['className'] | undefined;
110
- onGetBodyColumnStyle?(column: TableColumn<T>, item: T, index: number): CommonSxProps['style'] | undefined;
111
- onGetBodyColumnSx?(column: TableColumn<T>, item: T, index: number): CommonSxProps['sx'] | undefined;
112
- onPageChange?(page: number): void;
113
- onSortChange?(items: T[]): void;
114
- onCheckChange?(columnId: string, items: T[]): void;
115
- }
116
- export declare const TableDefaultProps: Pick<TableProps, 'defaultAlign' | 'pagingAlign' | 'cellPadding'>;
117
- /********************************************************************************************************************
118
- * TableCommands
119
- * ******************************************************************************************************************/
120
- export interface TableCommands<T = TableItem> {
121
- getColumns(): TableProps<T>['columns'];
122
- setColumns(columns: TableProps<T>['columns']): void;
123
- getItems(): TableProps<T>['items'];
124
- setItems(items: TableProps<T>['items']): void;
125
- getPaging(): TableProps<T>['paging'];
126
- setItemsPaging(items: TableProps<T>['items'], paging: TableProps<T>['paging']): void;
127
- resetSort(): void;
128
- getCheckedItems(columnId: string): T[];
129
- scrollToTop(): void;
130
- }
1
+ import { CSSProperties, ReactNode } from 'react';
2
+ import { TableCellProps, TooltipProps } from '@mui/material';
3
+ import { TablePaginationProps } from '../TablePagination/TablePagination.types';
4
+ import { TableCommonSxProps } from '../@types';
5
+ import { TableTopHeadProps } from '../TableTopHead';
6
+ /********************************************************************************************************************
7
+ * TableItem
8
+ * ******************************************************************************************************************/
9
+ export interface TableItem {
10
+ [key: string]: any;
11
+ }
12
+ /********************************************************************************************************************
13
+ * TableColumn
14
+ * ******************************************************************************************************************/
15
+ export interface TableColumn<T = TableItem> {
16
+ id?: string;
17
+ type?: 'text' | 'number' | 'tel' | 'date' | 'datetime' | 'date-hour' | 'date-minute' | 'company_no' | 'personal_no' | 'img' | 'button' | 'buttons' | 'check';
18
+ label?: ReactNode;
19
+ name?: keyof T;
20
+ align?: TableCellProps['align'];
21
+ width?: string | number;
22
+ minWidth?: string | number;
23
+ ellipsis?: boolean;
24
+ dateFormat?: string;
25
+ dateTwoLine?: boolean;
26
+ hideAllCheck?: boolean;
27
+ numberPrefix?: string;
28
+ numberSuffix?: string;
29
+ tooltipProps?: Omit<TooltipProps, 'children' | 'title'>;
30
+ display?: {
31
+ xs?: boolean;
32
+ sm?: boolean;
33
+ md?: boolean;
34
+ lg?: boolean;
35
+ xl?: boolean;
36
+ };
37
+ paddingLeft?: number;
38
+ paddingRight?: number;
39
+ head?: {
40
+ className?: TableCommonSxProps['className'];
41
+ style?: TableCommonSxProps['style'];
42
+ backgroundColor?: CSSProperties['backgroundColor'];
43
+ sx?: TableCommonSxProps['sx'];
44
+ onGetClassName?(): TableCommonSxProps['className'];
45
+ onGetStyle?(): TableCommonSxProps['style'];
46
+ onGetSx?(): TableCommonSxProps['sx'];
47
+ onRender?(): ReactNode;
48
+ };
49
+ footer?: {
50
+ value?: ReactNode;
51
+ className?: TableCommonSxProps['className'];
52
+ style?: TableCommonSxProps['style'];
53
+ backgroundColor?: CSSProperties['backgroundColor'];
54
+ sx?: TableCommonSxProps['sx'];
55
+ onGetClassName?(): TableCommonSxProps['className'];
56
+ onGetStyle?(): TableCommonSxProps['style'];
57
+ onGetSx?(): TableCommonSxProps['sx'];
58
+ onRender?(): ReactNode;
59
+ };
60
+ className?: TableCommonSxProps['className'];
61
+ style?: TableCommonSxProps['style'];
62
+ backgroundColor?: CSSProperties['backgroundColor'];
63
+ sx?: TableCommonSxProps['sx'];
64
+ onGetClassName?(item: T, index: number): TableCommonSxProps['className'];
65
+ onGetStyle?(item: T, index: number): TableCommonSxProps['style'];
66
+ onGetSx?(item: T, index: number): TableCommonSxProps['sx'];
67
+ onHide?(item: T, index: number): boolean;
68
+ onGetTooltip?(item: T, index: number): ReactNode;
69
+ onRender?(item: T, index: number): ReactNode;
70
+ onClick?(item: T, index: number): void;
71
+ onInitChecked?(item: T): boolean;
72
+ onCheckDisabled?(item: T): boolean;
73
+ onCheckChange?(item: T, checked: boolean): void;
74
+ onCheckDisabledChange?(item: T, checkDisabled: boolean): void;
75
+ }
76
+ export type TableColumns<T = TableItem> = (TableColumn<T> | false | undefined | null)[];
77
+ /********************************************************************************************************************
78
+ * TableProps
79
+ * ******************************************************************************************************************/
80
+ export interface TableProps<T = TableItem> extends TableCommonSxProps {
81
+ caption?: ReactNode;
82
+ topHeadRows?: TableTopHeadProps['rows'];
83
+ columns?: TableColumns<T>;
84
+ defaultAlign?: TableCellProps['align'];
85
+ defaultEllipsis?: boolean;
86
+ stickyHeader?: boolean;
87
+ items?: T[];
88
+ paging?: TablePaginationProps['paging'];
89
+ pagingAlign?: TablePaginationProps['align'];
90
+ height?: string | number;
91
+ maxHeight?: string | number;
92
+ minHeight?: string | number;
93
+ fullHeight?: boolean;
94
+ showOddColor?: boolean;
95
+ showEvenColor?: boolean;
96
+ cellPadding?: string | number;
97
+ footer?: boolean;
98
+ noData?: ReactNode;
99
+ pagination?: {
100
+ className?: TableCommonSxProps['className'];
101
+ style?: TableCommonSxProps['style'];
102
+ sx?: TableCommonSxProps['sx'];
103
+ };
104
+ sortable?: boolean;
105
+ onClick?(item: T, index: number): void;
106
+ onGetBodyRowClassName?(item: T, index: number): TableCommonSxProps['className'] | undefined;
107
+ onGetBodyRowStyle?(item: T, index: number): TableCommonSxProps['style'] | undefined;
108
+ onGetBodyRowSx?(item: T, index: number): TableCommonSxProps['sx'] | undefined;
109
+ onGetBodyColumnClassName?(column: TableColumn<T>, item: T, index: number): TableCommonSxProps['className'] | undefined;
110
+ onGetBodyColumnStyle?(column: TableColumn<T>, item: T, index: number): TableCommonSxProps['style'] | undefined;
111
+ onGetBodyColumnSx?(column: TableColumn<T>, item: T, index: number): TableCommonSxProps['sx'] | undefined;
112
+ onPageChange?(page: number): void;
113
+ onSortChange?(items: T[]): void;
114
+ onCheckChange?(columnId: string, items: T[]): void;
115
+ }
116
+ /********************************************************************************************************************
117
+ * TableCommands
118
+ * ******************************************************************************************************************/
119
+ export interface TableCommands<T = TableItem> {
120
+ getColumns(): TableProps<T>['columns'];
121
+ setColumns(columns: TableProps<T>['columns']): void;
122
+ getItems(): TableProps<T>['items'];
123
+ setItems(items: TableProps<T>['items']): void;
124
+ getPaging(): TableProps<T>['paging'];
125
+ setItemsPaging(items: TableProps<T>['items'], paging: TableProps<T>['paging']): void;
126
+ resetSort(): void;
127
+ getCheckedItems(columnId: string): T[];
128
+ scrollToTop(): void;
129
+ }
@@ -1,4 +1,4 @@
1
- import Table from './Table';
2
- export default Table;
3
- export { Table };
4
- export * from './Table.types';
1
+ import Table from './Table';
2
+ export default Table;
3
+ export { Table };
4
+ export * from './Table.types';
@@ -1,4 +1,4 @@
1
- import React from 'react';
2
- import { TableBodyCellProps as Props } from './TableBodyCell.types';
3
- declare const TableBodyCell: React.FC<Props>;
4
- export default TableBodyCell;
1
+ import React from 'react';
2
+ import { TableBodyCellProps as Props } from './TableBodyCell.types';
3
+ declare const TableBodyCell: React.FC<Props>;
4
+ export default TableBodyCell;