@pdg/react-table 1.1.7 → 1.1.8
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/PInfoTable/PInfoTable.types.d.ts +9 -9
- package/dist/PSearchTable/PSearchTable.types.d.ts +6 -6
- package/dist/PTable/PTable.types.d.ts +42 -42
- package/dist/PTableBodyCell/PTableBodyCell.types.d.ts +3 -3
- package/dist/PTableBodyRow/PTableBodyRow.types.d.ts +3 -3
- package/dist/PTableContext/PTableContext.types.d.ts +6 -7
- package/dist/PTableHeadCell/PTableHeadCell.types.d.ts +3 -3
- package/dist/PTablePagination/PTablePagination.types.d.ts +1 -1
- package/dist/PTableTopHead/PTableTopHead.types.d.ts +1 -1
- package/dist/index.esm.js +2 -11
- package/dist/index.js +2 -11
- package/package.json +1 -1
|
@@ -37,14 +37,14 @@ export interface PInfoTableItem<T = PInfoTableInfo> {
|
|
|
37
37
|
clipboardIcon?: string;
|
|
38
38
|
clipboardText?: string;
|
|
39
39
|
clipboardProps?: Omit<IconButtonProps, 'children'>;
|
|
40
|
-
onRender
|
|
41
|
-
onRenderEmpty
|
|
42
|
-
onHide
|
|
43
|
-
onXs
|
|
44
|
-
onSm
|
|
45
|
-
onMd
|
|
46
|
-
onLg
|
|
47
|
-
onXl
|
|
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
48
|
}
|
|
49
49
|
export type PInfoTableItems<T = PInfoTableInfo> = (PInfoTableItem<T> | false | undefined | null)[];
|
|
50
50
|
export type PInfoTableCols = 1 | 2 | 3 | 4 | 6 | 12;
|
|
@@ -74,5 +74,5 @@ export interface PInfoTableProps<T = PInfoTableInfo> {
|
|
|
74
74
|
valueUnderline?: boolean;
|
|
75
75
|
info: T;
|
|
76
76
|
items: PInfoTableItems<T>;
|
|
77
|
-
onCopyToClipboard
|
|
77
|
+
onCopyToClipboard?: (item: PInfoTableItem<T>, text: string) => void;
|
|
78
78
|
}
|
|
@@ -31,12 +31,12 @@ export interface PSearchTableProps<T = PTableItem> extends PTableCommonSxProps {
|
|
|
31
31
|
search?: PSearchTableSearchProps;
|
|
32
32
|
table: PSearchTableTableProps<T>;
|
|
33
33
|
betweenSearchTableComponent?: ReactNode;
|
|
34
|
-
onGetData
|
|
35
|
-
onRequestHashChange
|
|
34
|
+
onGetData?: (data: PFormValueMap) => Promise<PSearchTableData<T>>;
|
|
35
|
+
onRequestHashChange?: (hash: string) => void;
|
|
36
36
|
}
|
|
37
37
|
export interface PSearchTableCommands<T = PTableItem> {
|
|
38
|
-
reload(page?: number)
|
|
39
|
-
getLastLoadData()
|
|
40
|
-
getSearch()
|
|
41
|
-
getTable()
|
|
38
|
+
reload: (page?: number) => void;
|
|
39
|
+
getLastLoadData: () => PFormValueMap;
|
|
40
|
+
getSearch: () => PSearchCommands | undefined;
|
|
41
|
+
getTable: () => PTableCommands<T> | undefined;
|
|
42
42
|
}
|
|
@@ -49,10 +49,10 @@ export interface PTableColumn<T = PTableItem> {
|
|
|
49
49
|
style?: PTableCommonSxProps['style'];
|
|
50
50
|
backgroundColor?: CSSProperties['backgroundColor'];
|
|
51
51
|
sx?: PTableCommonSxProps['sx'];
|
|
52
|
-
onGetClassName
|
|
53
|
-
onGetStyle
|
|
54
|
-
onGetSx
|
|
55
|
-
onRender
|
|
52
|
+
onGetClassName?: (items?: T[]) => PTableCommonSxProps['className'];
|
|
53
|
+
onGetStyle?: (items?: T[]) => PTableCommonSxProps['style'];
|
|
54
|
+
onGetSx?: (items?: T[]) => PTableCommonSxProps['sx'];
|
|
55
|
+
onRender?: (items?: T[]) => ReactNode;
|
|
56
56
|
};
|
|
57
57
|
footer?: {
|
|
58
58
|
value?: ReactNode;
|
|
@@ -60,26 +60,26 @@ export interface PTableColumn<T = PTableItem> {
|
|
|
60
60
|
style?: PTableCommonSxProps['style'];
|
|
61
61
|
backgroundColor?: CSSProperties['backgroundColor'];
|
|
62
62
|
sx?: PTableCommonSxProps['sx'];
|
|
63
|
-
onGetClassName
|
|
64
|
-
onGetStyle
|
|
65
|
-
onGetSx
|
|
66
|
-
onRender
|
|
63
|
+
onGetClassName?: (items?: T[]) => PTableCommonSxProps['className'];
|
|
64
|
+
onGetStyle?: (items?: T[]) => PTableCommonSxProps['style'];
|
|
65
|
+
onGetSx?: (items?: T[]) => PTableCommonSxProps['sx'];
|
|
66
|
+
onRender?: (items?: T[]) => ReactNode;
|
|
67
67
|
};
|
|
68
68
|
className?: PTableCommonSxProps['className'];
|
|
69
69
|
style?: PTableCommonSxProps['style'];
|
|
70
70
|
backgroundColor?: CSSProperties['backgroundColor'];
|
|
71
71
|
sx?: PTableCommonSxProps['sx'];
|
|
72
|
-
onGetClassName
|
|
73
|
-
onGetStyle
|
|
74
|
-
onGetSx
|
|
75
|
-
onHide
|
|
76
|
-
onGetTooltip
|
|
77
|
-
onRender
|
|
78
|
-
onClick
|
|
79
|
-
onInitChecked
|
|
80
|
-
onCheckDisabled
|
|
81
|
-
onCheckChange
|
|
82
|
-
onCheckDisabledChange
|
|
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
|
+
onHide?: (item: T, index: number) => boolean;
|
|
76
|
+
onGetTooltip?: (item: T, index: number) => ReactNode;
|
|
77
|
+
onRender?: (item: T, index: number) => ReactNode;
|
|
78
|
+
onClick?: (item: T, index: number) => void;
|
|
79
|
+
onInitChecked?: (item: T) => boolean;
|
|
80
|
+
onCheckDisabled?: (item: T) => boolean;
|
|
81
|
+
onCheckChange?: (item: T, checked: boolean) => void;
|
|
82
|
+
onCheckDisabledChange?: (item: T, checkDisabled: boolean) => void;
|
|
83
83
|
}
|
|
84
84
|
export type PTableColumns<T = PTableItem> = (PTableColumn<T> | false | undefined | null)[];
|
|
85
85
|
/********************************************************************************************************************
|
|
@@ -111,32 +111,32 @@ export interface PTableProps<T = PTableItem> extends PTableCommonSxProps {
|
|
|
111
111
|
};
|
|
112
112
|
progressiveVisible?: PTableProgressiveVisibleInfo;
|
|
113
113
|
sortable?: boolean;
|
|
114
|
-
onClick
|
|
115
|
-
onGetBodyRowClassName
|
|
116
|
-
onGetBodyRowStyle
|
|
117
|
-
onGetBodyRowSx
|
|
118
|
-
onGetBodyColumnClassName
|
|
119
|
-
onGetBodyColumnStyle
|
|
120
|
-
onGetBodyColumnSx
|
|
121
|
-
onPageChange
|
|
122
|
-
onSortChange
|
|
123
|
-
onCheckChange
|
|
114
|
+
onClick?: (item: T, index: number) => void;
|
|
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
|
+
onPageChange?: (page: number) => void;
|
|
122
|
+
onSortChange?: (items: T[]) => void;
|
|
123
|
+
onCheckChange?: (columnId: string, items: T[]) => void;
|
|
124
124
|
}
|
|
125
125
|
/********************************************************************************************************************
|
|
126
126
|
* PTableCommands
|
|
127
127
|
* ******************************************************************************************************************/
|
|
128
128
|
export interface PTableCommands<T = PTableItem> {
|
|
129
|
-
getColumns()
|
|
130
|
-
setColumns(columns: PTableProps<T>['columns'])
|
|
131
|
-
getItems()
|
|
132
|
-
setItems(items: PTableProps<T>['items'])
|
|
133
|
-
getPaging()
|
|
134
|
-
setItemsPaging(items: PTableProps<T>['items'], paging: PTableProps<T>['paging'])
|
|
135
|
-
resetSort()
|
|
136
|
-
getCheckedItems(columnId: string)
|
|
137
|
-
getChecked(itemKey: string, itemValue: any, columnId: string)
|
|
138
|
-
setChecked(itemKey: string, itemValue: any, columnId: string, checked: boolean)
|
|
139
|
-
toggleChecked(itemKey: string, itemValue: any, columnId: string)
|
|
140
|
-
setCheckedAll(columnId: string, checked: boolean)
|
|
141
|
-
scrollToTop()
|
|
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
|
+
resetSort: () => void;
|
|
136
|
+
getCheckedItems: (columnId: string) => T[];
|
|
137
|
+
getChecked: (itemKey: string, itemValue: any, columnId: string) => boolean;
|
|
138
|
+
setChecked: (itemKey: string, itemValue: any, columnId: string, checked: boolean) => void;
|
|
139
|
+
toggleChecked: (itemKey: string, itemValue: any, columnId: string) => void;
|
|
140
|
+
setCheckedAll: (columnId: string, checked: boolean) => void;
|
|
141
|
+
scrollToTop: () => void;
|
|
142
142
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { PTableColumn, PTableItem, PTableProps } from '../PTable/PTable.types';
|
|
2
2
|
import { PTableCommonSxProps } from '../@types';
|
|
3
3
|
export interface PTableBodyCellCommands {
|
|
4
|
-
setChecked(checked: boolean)
|
|
5
|
-
setCheckDisabled(disabled: boolean)
|
|
4
|
+
setChecked: (checked: boolean) => void;
|
|
5
|
+
setCheckDisabled: (disabled: boolean) => void;
|
|
6
6
|
}
|
|
7
7
|
export interface PTableBodyCellProps {
|
|
8
8
|
className?: PTableCommonSxProps['className'];
|
|
@@ -14,5 +14,5 @@ export interface PTableBodyCellProps {
|
|
|
14
14
|
defaultAlign?: PTableProps['defaultAlign'];
|
|
15
15
|
defaultEllipsis?: boolean;
|
|
16
16
|
onClick: PTableProps['onClick'];
|
|
17
|
-
onCheckChange(item: PTableItem, column: PTableColumn, checked: boolean)
|
|
17
|
+
onCheckChange: (item: PTableItem, column: PTableColumn, checked: boolean) => void;
|
|
18
18
|
}
|
|
@@ -12,7 +12,7 @@ export interface PTableBodyRowProps extends Omit<TableRowProps, 'id' | 'onClick'
|
|
|
12
12
|
item: PTableItem;
|
|
13
13
|
onClick: PTableProps['onClick'];
|
|
14
14
|
onCheckChange: PTableBodyCellProps['onCheckChange'];
|
|
15
|
-
onGetColumnClassName
|
|
16
|
-
onGetColumnStyle
|
|
17
|
-
onGetColumnSx
|
|
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
18
|
}
|
|
@@ -5,11 +5,10 @@ export interface PTableContextValue {
|
|
|
5
5
|
menuOpen: boolean;
|
|
6
6
|
openMenuId?: string;
|
|
7
7
|
progressiveVisible?: PTableProgressiveVisibleInfo;
|
|
8
|
-
setMenuOpen(menuOpen: boolean, openMenuId?: string)
|
|
9
|
-
setItemColumnChecked(item: PTableItem, column: PTableColumn, checked: boolean)
|
|
10
|
-
setItemColumnCheckDisabled(item: PTableItem, column: PTableColumn, checkDisabled: boolean)
|
|
11
|
-
setItemColumnCommands(item: PTableItem, column: PTableColumn, commands: PTableBodyCellCommands)
|
|
12
|
-
setHeadColumnChecked(column: PTableColumn, checked: boolean)
|
|
13
|
-
setHeadColumnCommands(column: PTableColumn, commands: PTableHeadCellCommands)
|
|
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
14
|
}
|
|
15
|
-
export declare const PTableContextDefaultValue: PTableContextValue;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { PTableColumn, PTableItem, PTableProps } from '../PTable/PTable.types';
|
|
2
2
|
export interface PTableHeadCellCommands {
|
|
3
|
-
setChecked(checked: boolean)
|
|
4
|
-
setCheckDisabled(checkDisabled: boolean)
|
|
3
|
+
setChecked: (checked: boolean) => void;
|
|
4
|
+
setCheckDisabled: (checkDisabled: boolean) => void;
|
|
5
5
|
}
|
|
6
6
|
export interface PTableHeadCellProps<T = PTableItem> {
|
|
7
7
|
column: PTableColumn;
|
|
8
8
|
items?: T[];
|
|
9
9
|
defaultAlign?: PTableProps['defaultAlign'];
|
|
10
10
|
top?: number;
|
|
11
|
-
onCheckChange(column: PTableColumn, checked: boolean)
|
|
11
|
+
onCheckChange: (column: PTableColumn, checked: boolean) => void;
|
|
12
12
|
}
|
|
@@ -9,5 +9,5 @@ export interface PTablePaging {
|
|
|
9
9
|
export interface PTablePaginationProps extends Pick<PTableCommonSxProps, 'className' | 'style' | 'sx'> {
|
|
10
10
|
paging: PTablePaging;
|
|
11
11
|
align?: StackProps['alignItems'];
|
|
12
|
-
onChange
|
|
12
|
+
onChange?: (page: number) => void;
|
|
13
13
|
}
|
|
@@ -14,5 +14,5 @@ export interface PTableTopHeadProps<T = PTableItem> {
|
|
|
14
14
|
columns: PTableColumn[];
|
|
15
15
|
items?: T[];
|
|
16
16
|
defaultAlign: PTableProps['defaultAlign'];
|
|
17
|
-
onCheckChange(column: PTableColumn, checked: boolean)
|
|
17
|
+
onCheckChange: (column: PTableColumn, checked: boolean) => void;
|
|
18
18
|
}
|
package/dist/index.esm.js
CHANGED
|
@@ -1263,18 +1263,9 @@ function useResizeDetector({ skipOnMount = false, refreshMode, refreshRate = 100
|
|
|
1263
1263
|
});
|
|
1264
1264
|
});
|
|
1265
1265
|
var StyledNoDataDiv = styled('div')(templateObject_1$3 || (templateObject_1$3 = __makeTemplateObject(["\n text-align: center;\n padding: 30px 0;\n font-weight: 500;\n font-size: 13px;\n color: #94a0b2;\n opacity: 0.8;\n\n .material-icons {\n font-size: 40px;\n margin-bottom: 5px;\n }\n"], ["\n text-align: center;\n padding: 30px 0;\n font-weight: 500;\n font-size: 13px;\n color: #94a0b2;\n opacity: 0.8;\n\n .material-icons {\n font-size: 40px;\n margin-bottom: 5px;\n }\n"])));
|
|
1266
|
-
var templateObject_1$3;var
|
|
1267
|
-
menuOpen: false,
|
|
1268
|
-
openMenuId: undefined,
|
|
1269
|
-
setMenuOpen: function () { },
|
|
1270
|
-
setItemColumnChecked: function () { },
|
|
1271
|
-
setItemColumnCheckDisabled: function () { },
|
|
1272
|
-
setItemColumnCommands: function () { },
|
|
1273
|
-
setHeadColumnChecked: function () { },
|
|
1274
|
-
setHeadColumnCommands: function () { },
|
|
1275
|
-
};var PTableContext = createContext(PTableContextDefaultValue);function useTableState() {
|
|
1266
|
+
var templateObject_1$3;var PTableContext = createContext({});function useTableState() {
|
|
1276
1267
|
var value = useContext(PTableContext);
|
|
1277
|
-
if (value
|
|
1268
|
+
if (empty(value)) {
|
|
1278
1269
|
throw new Error('useFormState should be used within TableContext.Provider');
|
|
1279
1270
|
}
|
|
1280
1271
|
return value;
|
package/dist/index.js
CHANGED
|
@@ -1263,18 +1263,9 @@ function useResizeDetector({ skipOnMount = false, refreshMode, refreshRate = 100
|
|
|
1263
1263
|
});
|
|
1264
1264
|
});
|
|
1265
1265
|
var StyledNoDataDiv = material.styled('div')(templateObject_1$3 || (templateObject_1$3 = __makeTemplateObject(["\n text-align: center;\n padding: 30px 0;\n font-weight: 500;\n font-size: 13px;\n color: #94a0b2;\n opacity: 0.8;\n\n .material-icons {\n font-size: 40px;\n margin-bottom: 5px;\n }\n"], ["\n text-align: center;\n padding: 30px 0;\n font-weight: 500;\n font-size: 13px;\n color: #94a0b2;\n opacity: 0.8;\n\n .material-icons {\n font-size: 40px;\n margin-bottom: 5px;\n }\n"])));
|
|
1266
|
-
var templateObject_1$3;var
|
|
1267
|
-
menuOpen: false,
|
|
1268
|
-
openMenuId: undefined,
|
|
1269
|
-
setMenuOpen: function () { },
|
|
1270
|
-
setItemColumnChecked: function () { },
|
|
1271
|
-
setItemColumnCheckDisabled: function () { },
|
|
1272
|
-
setItemColumnCommands: function () { },
|
|
1273
|
-
setHeadColumnChecked: function () { },
|
|
1274
|
-
setHeadColumnCommands: function () { },
|
|
1275
|
-
};var PTableContext = React.createContext(PTableContextDefaultValue);function useTableState() {
|
|
1266
|
+
var templateObject_1$3;var PTableContext = React.createContext({});function useTableState() {
|
|
1276
1267
|
var value = React.useContext(PTableContext);
|
|
1277
|
-
if (value
|
|
1268
|
+
if (compare.empty(value)) {
|
|
1278
1269
|
throw new Error('useFormState should be used within TableContext.Provider');
|
|
1279
1270
|
}
|
|
1280
1271
|
return value;
|