@pdg/react-table 1.0.140 → 1.1.0
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/@types/types.d.ts +2 -2
- package/dist/PInfoTable/PInfoTable.d.ts +7 -0
- package/dist/{InfoTable/InfoTable.types.d.ts → PInfoTable/PInfoTable.types.d.ts} +27 -27
- package/dist/PInfoTable/index.d.ts +4 -0
- package/dist/PSearchTable/PSearchTable.d.ts +8 -0
- package/dist/PSearchTable/PSearchTable.types.d.ts +42 -0
- package/dist/PSearchTable/index.d.ts +4 -0
- package/dist/PTable/PTable.d.ts +7 -0
- package/dist/{Table/Table.types.d.ts → PTable/PTable.types.d.ts} +51 -51
- package/dist/PTable/index.d.ts +4 -0
- package/dist/PTableBodyRow/PTableBodyRow.d.ts +5 -0
- package/dist/PTableBodyRow/PTableBodyRow.types.d.ts +18 -0
- package/dist/PTableBodyRow/index.d.ts +4 -0
- package/dist/{TableButton/TableButton.d.ts → PTableButton/PTableButton.d.ts} +1 -1
- package/dist/PTableButton/PTableButton.types.d.ts +3 -0
- package/dist/PTableButton/index.d.ts +4 -0
- package/dist/PTableCommonCell/PTableCommonCell.d.ts +4 -0
- package/dist/PTableCommonCell/PTableCommonCell.types.d.ts +11 -0
- package/dist/PTableCommonCell/index.d.ts +4 -0
- package/dist/PTableContext/PTableContext.d.ts +3 -0
- package/dist/PTableContext/PTableContext.types.d.ts +15 -0
- package/dist/PTableContext/index.d.ts +5 -0
- package/dist/PTableContext/useTableState.d.ts +2 -0
- package/dist/PTableContextProvider/PTableContextProvider.d.ts +4 -0
- package/dist/PTableContextProvider/PTableContextProvider.types.d.ts +6 -0
- package/dist/PTableContextProvider/index.d.ts +4 -0
- package/dist/PTableFooterCell/PTableFooterCell.d.ts +4 -0
- package/dist/PTableFooterCell/PTableFooterCell.types.d.ts +6 -0
- package/dist/PTableFooterCell/index.d.ts +4 -0
- package/dist/PTableHeadCell/PTableHeadCell.d.ts +4 -0
- package/dist/PTableHeadCell/PTableHeadCell.types.d.ts +12 -0
- package/dist/PTableHeadCell/index.d.ts +4 -0
- package/dist/PTableMenuButton/PTableMenuButton.d.ts +4 -0
- package/dist/{TableMenuButton/TableMenuButton.types.d.ts → PTableMenuButton/PTableMenuButton.types.d.ts} +2 -2
- package/dist/PTableMenuButton/index.d.ts +4 -0
- package/dist/PTablePagination/PTablePagination.d.ts +4 -0
- package/dist/PTablePagination/PTablePagination.types.d.ts +13 -0
- package/dist/PTablePagination/index.d.ts +4 -0
- package/dist/PTableSortableBody/PTableSortableBody.d.ts +4 -0
- package/dist/PTableSortableBody/PTableSortableBody.types.d.ts +8 -0
- package/dist/PTableSortableBody/index.d.ts +4 -0
- package/dist/PTableSortableBodyBlock/PTableSortableBodyBlock.d.ts +4 -0
- package/dist/PTableSortableBodyBlock/PTableSortableBodyBlock.types.d.ts +4 -0
- package/dist/PTableSortableBodyBlock/index.d.ts +4 -0
- package/dist/PTableTopHead/PTableTopHead.d.ts +4 -0
- package/dist/PTableTopHead/PTableTopHead.types.d.ts +18 -0
- package/dist/PTableTopHead/index.d.ts +4 -0
- package/dist/TableBodyCell/PTableBodyCell.d.ts +4 -0
- package/dist/TableBodyCell/PTableBodyCell.types.d.ts +18 -0
- package/dist/TableBodyCell/index.d.ts +4 -4
- package/dist/index.d.ts +5 -5
- package/dist/index.esm.js +81 -81
- package/dist/index.js +78 -78
- package/package.json +12 -7
- package/dist/InfoTable/InfoTable.d.ts +0 -7
- package/dist/InfoTable/index.d.ts +0 -4
- package/dist/SearchTable/SearchTable.d.ts +0 -8
- package/dist/SearchTable/SearchTable.types.d.ts +0 -42
- package/dist/SearchTable/index.d.ts +0 -4
- package/dist/Table/Table.d.ts +0 -7
- package/dist/Table/index.d.ts +0 -4
- package/dist/TableBodyCell/TableBodyCell.d.ts +0 -4
- package/dist/TableBodyCell/TableBodyCell.types.d.ts +0 -18
- package/dist/TableBodyRow/TableBodyRow.d.ts +0 -5
- package/dist/TableBodyRow/TableBodyRow.types.d.ts +0 -18
- package/dist/TableBodyRow/index.d.ts +0 -4
- package/dist/TableButton/TableButton.types.d.ts +0 -3
- package/dist/TableButton/index.d.ts +0 -4
- package/dist/TableCommonCell/TableCommonCell.d.ts +0 -4
- package/dist/TableCommonCell/TableCommonCell.types.d.ts +0 -11
- package/dist/TableCommonCell/index.d.ts +0 -4
- package/dist/TableContext/TableContext.d.ts +0 -3
- package/dist/TableContext/TableContext.types.d.ts +0 -15
- package/dist/TableContext/index.d.ts +0 -5
- package/dist/TableContext/useTableState.d.ts +0 -2
- package/dist/TableContextProvider/TableContextProvider.d.ts +0 -4
- package/dist/TableContextProvider/TableContextProvider.types.d.ts +0 -6
- package/dist/TableContextProvider/index.d.ts +0 -4
- package/dist/TableFooterCell/TableFooterCell.d.ts +0 -4
- package/dist/TableFooterCell/TableFooterCell.types.d.ts +0 -6
- package/dist/TableFooterCell/index.d.ts +0 -4
- package/dist/TableHeadCell/TableHeadCell.d.ts +0 -4
- package/dist/TableHeadCell/TableHeadCell.types.d.ts +0 -12
- package/dist/TableHeadCell/index.d.ts +0 -4
- package/dist/TableMenuButton/TableMenuButton.d.ts +0 -4
- package/dist/TableMenuButton/index.d.ts +0 -4
- package/dist/TablePagination/TablePagination.d.ts +0 -4
- package/dist/TablePagination/TablePagination.types.d.ts +0 -13
- package/dist/TablePagination/index.d.ts +0 -4
- package/dist/TableSortableBody/TableSortableBody.d.ts +0 -4
- package/dist/TableSortableBody/TableSortableBody.types.d.ts +0 -8
- package/dist/TableSortableBody/index.d.ts +0 -4
- package/dist/TableSortableBodyBlock/TableSortableBodyBlock.d.ts +0 -4
- package/dist/TableSortableBodyBlock/TableSortableBodyBlock.types.d.ts +0 -4
- package/dist/TableSortableBodyBlock/index.d.ts +0 -4
- package/dist/TableTopHead/TableTopHead.d.ts +0 -4
- package/dist/TableTopHead/TableTopHead.types.d.ts +0 -18
- package/dist/TableTopHead/index.d.ts +0 -4
package/dist/@types/types.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import { SxProps } from '@mui/system';
|
|
3
3
|
import { Theme } from '@mui/material/styles';
|
|
4
|
-
export interface
|
|
4
|
+
export interface PTableCommonProps {
|
|
5
5
|
children?: ReactNode;
|
|
6
6
|
className?: string;
|
|
7
7
|
style?: CSSProperties;
|
|
8
8
|
}
|
|
9
|
-
export interface
|
|
9
|
+
export interface PTableCommonSxProps extends PTableCommonProps {
|
|
10
10
|
sx?: SxProps<Theme>;
|
|
11
11
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PInfoTableProps as Props, PInfoTableInfo } from './PInfoTable.types';
|
|
3
|
+
interface WithType<T = PInfoTableInfo> extends React.FC<Props<T>> {
|
|
4
|
+
<T = PInfoTableInfo>(props: Props<T>): ReturnType<React.FC<Props<T>>>;
|
|
5
|
+
}
|
|
6
|
+
declare const PInfoTable: WithType;
|
|
7
|
+
export default PInfoTable;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { BoxProps, GridProps, IconButtonProps, TypographyProps } from '@mui/material';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
export interface
|
|
3
|
+
import { PTableCommonSxProps } from '../@types';
|
|
4
|
+
import { PIconProps } from '@pdg/react-component';
|
|
5
|
+
export interface PInfoTableInfo {
|
|
6
6
|
[key: string]: any;
|
|
7
7
|
}
|
|
8
|
-
export type
|
|
9
|
-
export interface
|
|
10
|
-
icon?:
|
|
8
|
+
export type PInfoTableItemType = 'text' | 'number' | 'tel' | 'url' | 'email' | 'date' | 'datetime' | 'date-hour' | 'date-minute' | 'business_no' | 'personal_no' | 'divider';
|
|
9
|
+
export interface PInfoTableItem<T = PInfoTableInfo> {
|
|
10
|
+
icon?: PIconProps['children'];
|
|
11
11
|
label?: ReactNode;
|
|
12
12
|
name?: keyof T;
|
|
13
|
-
type?:
|
|
13
|
+
type?: PInfoTableItemType;
|
|
14
14
|
ellipsis?: boolean;
|
|
15
15
|
className?: string;
|
|
16
16
|
dateFormat?: string;
|
|
@@ -19,15 +19,15 @@ export interface InfoTableItem<T = InfoTableInfo> {
|
|
|
19
19
|
numberSuffix?: string;
|
|
20
20
|
dividerColor?: TypographyProps['color'];
|
|
21
21
|
dividerLine?: boolean;
|
|
22
|
-
style?:
|
|
22
|
+
style?: PTableCommonSxProps['style'];
|
|
23
23
|
sx?: BoxProps['sx'];
|
|
24
24
|
labelClassName?: string;
|
|
25
25
|
labelColor?: TypographyProps['color'];
|
|
26
|
-
labelStyle?:
|
|
26
|
+
labelStyle?: PTableCommonSxProps['style'];
|
|
27
27
|
labelSx?: BoxProps['sx'];
|
|
28
28
|
valueClassName?: string;
|
|
29
|
-
valueStyle?:
|
|
30
|
-
valueSx?:
|
|
29
|
+
valueStyle?: PTableCommonSxProps['style'];
|
|
30
|
+
valueSx?: PTableCommonSxProps['sx'];
|
|
31
31
|
xs?: number;
|
|
32
32
|
sm?: number;
|
|
33
33
|
md?: number;
|
|
@@ -46,33 +46,33 @@ export interface InfoTableItem<T = InfoTableInfo> {
|
|
|
46
46
|
onLg?(info: T): number;
|
|
47
47
|
onXl?(info: T): number;
|
|
48
48
|
}
|
|
49
|
-
export type
|
|
50
|
-
export type
|
|
51
|
-
export interface
|
|
52
|
-
cols:
|
|
53
|
-
xs?:
|
|
54
|
-
sm?:
|
|
55
|
-
md?:
|
|
56
|
-
lg?:
|
|
57
|
-
xl?:
|
|
49
|
+
export type PInfoTableItems<T = PInfoTableInfo> = (PInfoTableItem<T> | false | undefined | null)[];
|
|
50
|
+
export type PInfoTableCols = 1 | 2 | 3 | 4 | 6 | 12;
|
|
51
|
+
export interface PInfoTableProps<T = PInfoTableInfo> {
|
|
52
|
+
cols: PInfoTableCols | {
|
|
53
|
+
xs?: PInfoTableCols;
|
|
54
|
+
sm?: PInfoTableCols;
|
|
55
|
+
md?: PInfoTableCols;
|
|
56
|
+
lg?: PInfoTableCols;
|
|
57
|
+
xl?: PInfoTableCols;
|
|
58
58
|
};
|
|
59
59
|
spacing?: GridProps['spacing'];
|
|
60
60
|
columnSpacing?: GridProps['spacing'];
|
|
61
61
|
rowSpacing?: GridProps['spacing'];
|
|
62
62
|
className?: string;
|
|
63
|
-
style?:
|
|
64
|
-
sx?:
|
|
63
|
+
style?: PTableCommonSxProps['style'];
|
|
64
|
+
sx?: PTableCommonSxProps['sx'];
|
|
65
65
|
labelClassName?: string;
|
|
66
66
|
labelColor?: TypographyProps['color'];
|
|
67
|
-
labelStyle?:
|
|
67
|
+
labelStyle?: PTableCommonSxProps['style'];
|
|
68
68
|
labelSx?: BoxProps['sx'];
|
|
69
69
|
dividerColor?: TypographyProps['color'];
|
|
70
70
|
valueClassName?: string;
|
|
71
|
-
valueStyle?:
|
|
72
|
-
valueSx?:
|
|
71
|
+
valueStyle?: PTableCommonSxProps['style'];
|
|
72
|
+
valueSx?: PTableCommonSxProps['sx'];
|
|
73
73
|
ellipsis?: boolean;
|
|
74
74
|
valueUnderline?: boolean;
|
|
75
75
|
info: T;
|
|
76
|
-
items:
|
|
77
|
-
onCopyToClipboard?(item:
|
|
76
|
+
items: PInfoTableItems<T>;
|
|
77
|
+
onCopyToClipboard?(item: PInfoTableItem<T>, text: string): void;
|
|
78
78
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PSearchTableProps, PSearchTableCommands } from './PSearchTable.types';
|
|
3
|
+
import { PTableItem } from '../PTable';
|
|
4
|
+
interface WithForwardRefType<T = PTableItem> extends React.FC<PSearchTableProps<T>> {
|
|
5
|
+
<T = PTableItem>(props: PSearchTableProps<T> & React.RefAttributes<PSearchTableCommands<T>>): ReturnType<React.FC<PSearchTableProps<T>>>;
|
|
6
|
+
}
|
|
7
|
+
declare const PSearchTable: WithForwardRefType;
|
|
8
|
+
export default PSearchTable;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PTableProps, PTableCommands, PTableItem } from '../PTable';
|
|
3
|
+
import { PFormValueMap, PSearchCommands, PSearchProps } from '@pdg/react-form';
|
|
4
|
+
import { ReactNode } from 'react';
|
|
5
|
+
import { PTableCommonSxProps } from '../@types';
|
|
6
|
+
export interface PSearchInfo {
|
|
7
|
+
ref?: PSearchTableSearchProps['ref'];
|
|
8
|
+
searchGroups?: PSearchTableSearchProps['searchGroups'];
|
|
9
|
+
props?: Omit<PSearchTableSearchProps, 'ref' | 'searchGroups'>;
|
|
10
|
+
}
|
|
11
|
+
export interface PTableInfo {
|
|
12
|
+
ref?: PSearchTableTableProps['ref'];
|
|
13
|
+
props?: Omit<PSearchTableTableProps, 'ref'>;
|
|
14
|
+
}
|
|
15
|
+
export interface PSearchTableData<T = PTableItem> {
|
|
16
|
+
items: PTableProps<T>['items'];
|
|
17
|
+
paging?: PTableProps<T>['paging'];
|
|
18
|
+
}
|
|
19
|
+
export interface PSearchTableSearchProps extends Omit<PSearchProps, 'ref' | 'color' | 'autoSubmit' | 'onSubmit'> {
|
|
20
|
+
ref?: React.ForwardedRef<PSearchCommands>;
|
|
21
|
+
searchGroups?: ReactNode;
|
|
22
|
+
}
|
|
23
|
+
export interface PSearchTableTableProps<T = PTableItem> extends Omit<PTableProps<T>, 'ref' | 'items' | 'paging' | 'onPageChange'> {
|
|
24
|
+
ref?: React.ForwardedRef<PTableCommands<T>>;
|
|
25
|
+
}
|
|
26
|
+
export interface PSearchTableProps<T = PTableItem> extends PTableCommonSxProps {
|
|
27
|
+
color?: PSearchProps['color'];
|
|
28
|
+
hash?: boolean;
|
|
29
|
+
stickyHeader?: boolean;
|
|
30
|
+
fullHeight?: boolean;
|
|
31
|
+
search?: PSearchTableSearchProps;
|
|
32
|
+
table: PSearchTableTableProps<T>;
|
|
33
|
+
betweenSearchTableComponent?: ReactNode;
|
|
34
|
+
onGetData?(data: PFormValueMap): Promise<PSearchTableData<T>>;
|
|
35
|
+
onRequestHashChange?(hash: string): void;
|
|
36
|
+
}
|
|
37
|
+
export interface PSearchTableCommands<T = PTableItem> {
|
|
38
|
+
reload(page?: number): void;
|
|
39
|
+
getLastLoadData(): PFormValueMap;
|
|
40
|
+
getSearch(): PSearchCommands | undefined;
|
|
41
|
+
getTable(): PTableCommands<T> | undefined;
|
|
42
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PTableProps, PTableCommands, PTableItem } from './PTable.types';
|
|
3
|
+
interface WithForwardRefType<T = PTableItem> extends React.FC<PTableProps<T>> {
|
|
4
|
+
<T = PTableItem>(props: PTableProps<T> & React.RefAttributes<PTableCommands<T>>): ReturnType<React.FC<PTableProps<T>>>;
|
|
5
|
+
}
|
|
6
|
+
declare const PTable: WithForwardRefType;
|
|
7
|
+
export default PTable;
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import { TableCellProps, TooltipProps } from '@mui/material';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { PTablePaginationProps } from '../PTablePagination/PTablePagination.types';
|
|
4
|
+
import { PTableCommonSxProps } from '../@types';
|
|
5
|
+
import { PTableTopHeadProps } from '../PTableTopHead';
|
|
6
6
|
/********************************************************************************************************************
|
|
7
|
-
*
|
|
7
|
+
* PTableItem
|
|
8
8
|
* ******************************************************************************************************************/
|
|
9
|
-
export interface
|
|
9
|
+
export interface PTableItem {
|
|
10
10
|
[key: string]: any;
|
|
11
11
|
}
|
|
12
12
|
/********************************************************************************************************************
|
|
13
|
-
*
|
|
13
|
+
* PTableProgressiveVisibleInfo
|
|
14
14
|
* ******************************************************************************************************************/
|
|
15
|
-
export interface
|
|
15
|
+
export interface PTableProgressiveVisibleInfo {
|
|
16
16
|
rowHeight: number;
|
|
17
17
|
blockSize?: number;
|
|
18
18
|
delay?: number;
|
|
19
19
|
}
|
|
20
20
|
/********************************************************************************************************************
|
|
21
|
-
*
|
|
21
|
+
* PTableColumn
|
|
22
22
|
* ******************************************************************************************************************/
|
|
23
|
-
export interface
|
|
23
|
+
export interface PTableColumn<T = PTableItem> {
|
|
24
24
|
id?: string;
|
|
25
25
|
type?: 'text' | 'number' | 'tel' | 'date' | 'datetime' | 'date-hour' | 'date-minute' | 'business_no' | 'personal_no' | 'img' | 'button' | 'buttons' | 'check';
|
|
26
26
|
label?: ReactNode;
|
|
@@ -45,33 +45,33 @@ export interface TableColumn<T = TableItem> {
|
|
|
45
45
|
paddingLeft?: number;
|
|
46
46
|
paddingRight?: number;
|
|
47
47
|
head?: {
|
|
48
|
-
className?:
|
|
49
|
-
style?:
|
|
48
|
+
className?: PTableCommonSxProps['className'];
|
|
49
|
+
style?: PTableCommonSxProps['style'];
|
|
50
50
|
backgroundColor?: CSSProperties['backgroundColor'];
|
|
51
|
-
sx?:
|
|
52
|
-
onGetClassName?(items?: T[]):
|
|
53
|
-
onGetStyle?(items?: T[]):
|
|
54
|
-
onGetSx?(items?: T[]):
|
|
51
|
+
sx?: PTableCommonSxProps['sx'];
|
|
52
|
+
onGetClassName?(items?: T[]): PTableCommonSxProps['className'];
|
|
53
|
+
onGetStyle?(items?: T[]): PTableCommonSxProps['style'];
|
|
54
|
+
onGetSx?(items?: T[]): PTableCommonSxProps['sx'];
|
|
55
55
|
onRender?(items?: T[]): ReactNode;
|
|
56
56
|
};
|
|
57
57
|
footer?: {
|
|
58
58
|
value?: ReactNode;
|
|
59
|
-
className?:
|
|
60
|
-
style?:
|
|
59
|
+
className?: PTableCommonSxProps['className'];
|
|
60
|
+
style?: PTableCommonSxProps['style'];
|
|
61
61
|
backgroundColor?: CSSProperties['backgroundColor'];
|
|
62
|
-
sx?:
|
|
63
|
-
onGetClassName?(items?: T[]):
|
|
64
|
-
onGetStyle?(items?: T[]):
|
|
65
|
-
onGetSx?(items?: T[]):
|
|
62
|
+
sx?: PTableCommonSxProps['sx'];
|
|
63
|
+
onGetClassName?(items?: T[]): PTableCommonSxProps['className'];
|
|
64
|
+
onGetStyle?(items?: T[]): PTableCommonSxProps['style'];
|
|
65
|
+
onGetSx?(items?: T[]): PTableCommonSxProps['sx'];
|
|
66
66
|
onRender?(items?: T[]): ReactNode;
|
|
67
67
|
};
|
|
68
|
-
className?:
|
|
69
|
-
style?:
|
|
68
|
+
className?: PTableCommonSxProps['className'];
|
|
69
|
+
style?: PTableCommonSxProps['style'];
|
|
70
70
|
backgroundColor?: CSSProperties['backgroundColor'];
|
|
71
|
-
sx?:
|
|
72
|
-
onGetClassName?(item: T, index: number):
|
|
73
|
-
onGetStyle?(item: T, index: number):
|
|
74
|
-
onGetSx?(item: T, index: number):
|
|
71
|
+
sx?: PTableCommonSxProps['sx'];
|
|
72
|
+
onGetClassName?(item: T, index: number): PTableCommonSxProps['className'];
|
|
73
|
+
onGetStyle?(item: T, index: number): PTableCommonSxProps['style'];
|
|
74
|
+
onGetSx?(item: T, index: number): PTableCommonSxProps['sx'];
|
|
75
75
|
onHide?(item: T, index: number): boolean;
|
|
76
76
|
onGetTooltip?(item: T, index: number): ReactNode;
|
|
77
77
|
onRender?(item: T, index: number): ReactNode;
|
|
@@ -81,20 +81,20 @@ export interface TableColumn<T = TableItem> {
|
|
|
81
81
|
onCheckChange?(item: T, checked: boolean): void;
|
|
82
82
|
onCheckDisabledChange?(item: T, checkDisabled: boolean): void;
|
|
83
83
|
}
|
|
84
|
-
export type
|
|
84
|
+
export type PTableColumns<T = PTableItem> = (PTableColumn<T> | false | undefined | null)[];
|
|
85
85
|
/********************************************************************************************************************
|
|
86
86
|
* TableProps
|
|
87
87
|
* ******************************************************************************************************************/
|
|
88
|
-
export interface
|
|
88
|
+
export interface PTableProps<T = PTableItem> extends PTableCommonSxProps {
|
|
89
89
|
caption?: ReactNode;
|
|
90
|
-
topHeadRows?:
|
|
91
|
-
columns?:
|
|
90
|
+
topHeadRows?: PTableTopHeadProps['rows'];
|
|
91
|
+
columns?: PTableColumns<T>;
|
|
92
92
|
defaultAlign?: TableCellProps['align'];
|
|
93
93
|
defaultEllipsis?: boolean;
|
|
94
94
|
stickyHeader?: boolean;
|
|
95
95
|
items?: T[];
|
|
96
|
-
paging?:
|
|
97
|
-
pagingAlign?:
|
|
96
|
+
paging?: PTablePaginationProps['paging'];
|
|
97
|
+
pagingAlign?: PTablePaginationProps['align'];
|
|
98
98
|
height?: string | number;
|
|
99
99
|
maxHeight?: string | number;
|
|
100
100
|
minHeight?: string | number;
|
|
@@ -105,33 +105,33 @@ export interface TableProps<T = TableItem> extends TableCommonSxProps {
|
|
|
105
105
|
footer?: boolean;
|
|
106
106
|
noData?: ReactNode;
|
|
107
107
|
pagination?: {
|
|
108
|
-
className?:
|
|
109
|
-
style?:
|
|
110
|
-
sx?:
|
|
108
|
+
className?: PTableCommonSxProps['className'];
|
|
109
|
+
style?: PTableCommonSxProps['style'];
|
|
110
|
+
sx?: PTableCommonSxProps['sx'];
|
|
111
111
|
};
|
|
112
|
-
progressiveVisible?:
|
|
112
|
+
progressiveVisible?: PTableProgressiveVisibleInfo;
|
|
113
113
|
sortable?: boolean;
|
|
114
114
|
onClick?(item: T, index: number): void;
|
|
115
|
-
onGetBodyRowClassName?(item: T, index: number):
|
|
116
|
-
onGetBodyRowStyle?(item: T, index: number):
|
|
117
|
-
onGetBodyRowSx?(item: T, index: number):
|
|
118
|
-
onGetBodyColumnClassName?(column:
|
|
119
|
-
onGetBodyColumnStyle?(column:
|
|
120
|
-
onGetBodyColumnSx?(column:
|
|
115
|
+
onGetBodyRowClassName?(item: T, index: number): PTableCommonSxProps['className'] | undefined;
|
|
116
|
+
onGetBodyRowStyle?(item: T, index: number): PTableCommonSxProps['style'] | undefined;
|
|
117
|
+
onGetBodyRowSx?(item: T, index: number): PTableCommonSxProps['sx'] | undefined;
|
|
118
|
+
onGetBodyColumnClassName?(column: PTableColumn<T>, item: T, index: number): PTableCommonSxProps['className'] | undefined;
|
|
119
|
+
onGetBodyColumnStyle?(column: PTableColumn<T>, item: T, index: number): PTableCommonSxProps['style'] | undefined;
|
|
120
|
+
onGetBodyColumnSx?(column: PTableColumn<T>, item: T, index: number): PTableCommonSxProps['sx'] | undefined;
|
|
121
121
|
onPageChange?(page: number): void;
|
|
122
122
|
onSortChange?(items: T[]): void;
|
|
123
123
|
onCheckChange?(columnId: string, items: T[]): void;
|
|
124
124
|
}
|
|
125
125
|
/********************************************************************************************************************
|
|
126
|
-
*
|
|
126
|
+
* PTableCommands
|
|
127
127
|
* ******************************************************************************************************************/
|
|
128
|
-
export interface
|
|
129
|
-
getColumns():
|
|
130
|
-
setColumns(columns:
|
|
131
|
-
getItems():
|
|
132
|
-
setItems(items:
|
|
133
|
-
getPaging():
|
|
134
|
-
setItemsPaging(items:
|
|
128
|
+
export interface PTableCommands<T = PTableItem> {
|
|
129
|
+
getColumns(): PTableProps<T>['columns'];
|
|
130
|
+
setColumns(columns: PTableProps<T>['columns']): void;
|
|
131
|
+
getItems(): PTableProps<T>['items'];
|
|
132
|
+
setItems(items: PTableProps<T>['items']): void;
|
|
133
|
+
getPaging(): PTableProps<T>['paging'];
|
|
134
|
+
setItemsPaging(items: PTableProps<T>['items'], paging: PTableProps<T>['paging']): void;
|
|
135
135
|
resetSort(): void;
|
|
136
136
|
getCheckedItems(columnId: string): T[];
|
|
137
137
|
getChecked(itemKey: string, itemValue: any, columnId: string): boolean;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PTableBodyRowProps as Props } from './PTableBodyRow.types';
|
|
3
|
+
export declare const PStyledBodyRow: import("@emotion/styled").StyledComponent<import("@mui/material").TableRowOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, "className" | "style" | "classes" | "children" | "hover" | "selected" | "sx"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
4
|
+
declare const PTableBodyRow: React.FC<Props>;
|
|
5
|
+
export default PTableBodyRow;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { TableCellProps, TableRowProps } from '@mui/material';
|
|
2
|
+
import { PTableColumn, PTableItem, PTableProps } from '../PTable';
|
|
3
|
+
import { PTableBodyCellProps } from '../TableBodyCell';
|
|
4
|
+
import { PTableCommonSxProps } from '../@types';
|
|
5
|
+
export interface PTableBodyRowProps extends Omit<TableRowProps, 'id' | 'onClick'> {
|
|
6
|
+
id: string | number;
|
|
7
|
+
index: number;
|
|
8
|
+
defaultAlign?: TableCellProps['align'];
|
|
9
|
+
defaultEllipsis?: boolean;
|
|
10
|
+
sortable?: boolean;
|
|
11
|
+
columns: PTableColumn[];
|
|
12
|
+
item: PTableItem;
|
|
13
|
+
onClick: PTableProps['onClick'];
|
|
14
|
+
onCheckChange: PTableBodyCellProps['onCheckChange'];
|
|
15
|
+
onGetColumnClassName?(column: PTableColumn, item: PTableItem, index: number): PTableCommonSxProps['className'] | undefined;
|
|
16
|
+
onGetColumnStyle?(column: PTableColumn, item: PTableItem, index: number): PTableCommonSxProps['style'] | undefined;
|
|
17
|
+
onGetColumnSx?(column: PTableColumn, item: PTableItem, index: number): PTableCommonSxProps['sx'] | undefined;
|
|
18
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { PTableButtonProps as Props } from './PTableButton.types';
|
|
3
3
|
declare const _default: React.NamedExoticComponent<Props & React.RefAttributes<HTMLButtonElement>>;
|
|
4
4
|
export default _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PTableColumn, PTableItem, PTableProps } from '../PTable/PTable.types';
|
|
2
|
+
import { PTableCommonSxProps } from '../@types';
|
|
3
|
+
export interface PTableCommonCellProps extends PTableCommonSxProps {
|
|
4
|
+
type: 'head' | 'body' | 'footer';
|
|
5
|
+
column: PTableColumn;
|
|
6
|
+
defaultAlign?: PTableProps['defaultAlign'];
|
|
7
|
+
defaultEllipsis?: boolean;
|
|
8
|
+
index?: number;
|
|
9
|
+
item?: PTableItem;
|
|
10
|
+
onClick?: PTableProps['onClick'];
|
|
11
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { PTableColumn, PTableItem, PTableProgressiveVisibleInfo } from '../PTable';
|
|
2
|
+
import { PTableBodyCellCommands } from '../TableBodyCell';
|
|
3
|
+
import { PTableHeadCellCommands } from '../PTableHeadCell';
|
|
4
|
+
export interface PTableContextValue {
|
|
5
|
+
menuOpen: boolean;
|
|
6
|
+
openMenuId?: string;
|
|
7
|
+
progressiveVisible?: PTableProgressiveVisibleInfo;
|
|
8
|
+
setMenuOpen(menuOpen: boolean, openMenuId?: string): void;
|
|
9
|
+
setItemColumnChecked(item: PTableItem, column: PTableColumn, checked: boolean): void;
|
|
10
|
+
setItemColumnCheckDisabled(item: PTableItem, column: PTableColumn, checkDisabled: boolean): void;
|
|
11
|
+
setItemColumnCommands(item: PTableItem, column: PTableColumn, commands: PTableBodyCellCommands): void;
|
|
12
|
+
setHeadColumnChecked(column: PTableColumn, checked: boolean): void;
|
|
13
|
+
setHeadColumnCommands(column: PTableColumn, commands: PTableHeadCellCommands): void;
|
|
14
|
+
}
|
|
15
|
+
export declare const PTableContextDefaultValue: PTableContextValue;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PTableColumn, PTableItem, PTableProps } from '../PTable/PTable.types';
|
|
2
|
+
export interface PTableHeadCellCommands {
|
|
3
|
+
setChecked(checked: boolean): void;
|
|
4
|
+
setCheckDisabled(checkDisabled: boolean): void;
|
|
5
|
+
}
|
|
6
|
+
export interface PTableHeadCellProps<T = PTableItem> {
|
|
7
|
+
column: PTableColumn;
|
|
8
|
+
items?: T[];
|
|
9
|
+
defaultAlign?: PTableProps['defaultAlign'];
|
|
10
|
+
top?: number;
|
|
11
|
+
onCheckChange(column: PTableColumn, checked: boolean): void;
|
|
12
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { PButtonProps } from '@pdg/react-component';
|
|
3
3
|
import { PopperPlacementType, MenuListProps } from '@mui/material';
|
|
4
|
-
export interface
|
|
4
|
+
export interface PTableMenuButtonProps extends Omit<PButtonProps, 'size' | 'onClick'> {
|
|
5
5
|
placement?: PopperPlacementType;
|
|
6
6
|
inModal?: boolean;
|
|
7
7
|
zIndex?: number;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { StackProps } from '@mui/material';
|
|
2
|
+
import { PTableCommonSxProps } from '../@types';
|
|
3
|
+
export interface PTablePaging {
|
|
4
|
+
current_page: number;
|
|
5
|
+
per_page: number;
|
|
6
|
+
last_page: number;
|
|
7
|
+
total: number;
|
|
8
|
+
}
|
|
9
|
+
export interface PTablePaginationProps extends Pick<PTableCommonSxProps, 'className' | 'style' | 'sx'> {
|
|
10
|
+
paging: PTablePaging;
|
|
11
|
+
align?: StackProps['alignItems'];
|
|
12
|
+
onChange?(page: number): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PTableSortableBodyProps as Props } from './PTableSortableBody.types';
|
|
3
|
+
export declare const PTableSortableBody: ({ items, columns, showOddColor, showEvenColor, onGetBodyRowStyle, onGetBodyRowSx, onGetBodyRowClassName, onGetBodyColumnClassName, onGetBodyColumnStyle, onGetBodyColumnSx, defaultAlign, defaultEllipsis, sortable, onClick, onCheckChange, }: Props) => React.JSX.Element;
|
|
4
|
+
export default PTableSortableBody;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PTableColumn, PTableItem, PTableProps } from '../PTable/PTable.types';
|
|
2
|
+
import { PTableBodyRowProps } from '../PTableBodyRow';
|
|
3
|
+
export interface PTableSortableBodyProps extends Pick<PTableProps, 'showOddColor' | 'showEvenColor' | 'onGetBodyRowSx' | 'onGetBodyRowClassName' | 'onGetBodyRowStyle' | 'onGetBodyColumnClassName' | 'onGetBodyColumnSx' | 'onGetBodyColumnStyle' | 'defaultAlign' | 'defaultEllipsis' | 'sortable' | 'onClick'>, Pick<PTableBodyRowProps, 'onCheckChange'> {
|
|
4
|
+
items: (PTableItem & {
|
|
5
|
+
id: number | string;
|
|
6
|
+
})[];
|
|
7
|
+
columns: PTableColumn[];
|
|
8
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PTableSortableBodyBlockProps as Props } from './PTableSortableBodyBlock.types';
|
|
3
|
+
export declare const PTableSortableBodyBlock: ({ items, baseIndex, columns, showOddColor, showEvenColor, onGetBodyRowStyle, onGetBodyRowSx, onGetBodyRowClassName, onGetBodyColumnClassName, onGetBodyColumnStyle, onGetBodyColumnSx, defaultAlign, defaultEllipsis, sortable, onClick, onCheckChange, }: Props) => React.JSX.Element;
|
|
4
|
+
export default PTableSortableBodyBlock;
|