es-grid-template 1.8.64 → 1.8.65
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/es/grid-component/ColumnsGroup/ColumnsGroup.js +4 -1
- package/es/grid-component/TempTable.js +2 -2
- package/es/grid-component/hooks/utils.d.ts +2 -8
- package/es/grid-component/hooks/utils.js +175 -144
- package/es/grid-component/index.d.ts +1 -1
- package/es/grid-component/index.js +0 -4
- package/es/grid-component/type.d.ts +7 -0
- package/es/table-component/type.d.ts +8 -0
- package/es/table-virtuoso/ColumnsGroup/ColumnsGroup.d.ts +12 -0
- package/es/table-virtuoso/ColumnsGroup/ColumnsGroup.js +232 -0
- package/es/table-virtuoso/ColumnsGroup/index.d.ts +1 -0
- package/es/table-virtuoso/ColumnsGroup/index.js +1 -0
- package/es/{grid-component → table-virtuoso}/InternalTable.d.ts +2 -3
- package/es/table-virtuoso/InternalTable.js +413 -0
- package/es/table-virtuoso/body/TableBody.d.ts +14 -0
- package/es/table-virtuoso/body/TableBody.js +84 -0
- package/es/table-virtuoso/body/TableBodyCell.d.ts +14 -0
- package/es/table-virtuoso/body/TableBodyCell.js +466 -0
- package/es/table-virtuoso/body/TableBodyRow.d.ts +13 -0
- package/es/table-virtuoso/body/TableBodyRow.js +116 -0
- package/es/table-virtuoso/footer/TableFooterCell.d.ts +7 -0
- package/es/table-virtuoso/footer/TableFooterCell.js +54 -0
- package/es/table-virtuoso/header/TableHeadCell.d.ts +14 -0
- package/es/table-virtuoso/header/TableHeadCell.js +265 -0
- package/es/table-virtuoso/header/renderFilter.d.ts +20 -0
- package/es/table-virtuoso/header/renderFilter.js +289 -0
- package/es/table-virtuoso/hook/constant.d.ts +73 -0
- package/es/table-virtuoso/hook/constant.js +240 -0
- package/es/table-virtuoso/hook/convert.d.ts +1 -0
- package/es/table-virtuoso/hook/convert.js +28 -0
- package/es/table-virtuoso/hook/useColumns.d.ts +28 -0
- package/es/table-virtuoso/hook/useColumns.js +302 -0
- package/es/table-virtuoso/hook/useFilterOperator.d.ts +7 -0
- package/es/table-virtuoso/hook/useFilterOperator.js +33 -0
- package/es/table-virtuoso/hook/utils.d.ts +159 -0
- package/es/table-virtuoso/hook/utils.js +2263 -0
- package/es/table-virtuoso/index.d.ts +2 -0
- package/es/table-virtuoso/index.js +2 -0
- package/es/table-virtuoso/style.d.ts +22 -0
- package/es/table-virtuoso/style.js +11 -0
- package/es/table-virtuoso/style.scss +1440 -0
- package/es/table-virtuoso/table/Grid.d.ts +37 -0
- package/es/table-virtuoso/table/Grid.js +302 -0
- package/es/table-virtuoso/table/TableContainer.d.ts +49 -0
- package/es/table-virtuoso/table/TableContainer.js +305 -0
- package/es/table-virtuoso/table/TableWrapper.d.ts +20 -0
- package/es/table-virtuoso/table/TableWrapper.js +158 -0
- package/es/table-virtuoso/type.d.ts +0 -0
- package/es/table-virtuoso/type.js +785 -0
- package/es/table-virtuoso/useContext.d.ts +97 -0
- package/es/table-virtuoso/useContext.js +21 -0
- package/lib/grid-component/ColumnsGroup/ColumnsGroup.js +4 -1
- package/lib/grid-component/TempTable.js +2 -2
- package/lib/grid-component/hooks/utils.d.ts +2 -8
- package/lib/grid-component/hooks/utils.js +176 -152
- package/lib/grid-component/index.d.ts +1 -1
- package/lib/grid-component/index.js +0 -3
- package/lib/grid-component/type.d.ts +7 -0
- package/lib/table-component/type.d.ts +8 -0
- package/lib/table-virtuoso/ColumnsGroup/ColumnsGroup.d.ts +12 -0
- package/lib/table-virtuoso/ColumnsGroup/ColumnsGroup.js +243 -0
- package/lib/table-virtuoso/ColumnsGroup/index.d.ts +1 -0
- package/lib/table-virtuoso/ColumnsGroup/index.js +16 -0
- package/lib/{grid-component → table-virtuoso}/InternalTable.d.ts +2 -3
- package/lib/table-virtuoso/InternalTable.js +422 -0
- package/lib/table-virtuoso/body/TableBody.d.ts +14 -0
- package/lib/table-virtuoso/body/TableBody.js +95 -0
- package/lib/table-virtuoso/body/TableBodyCell.d.ts +14 -0
- package/lib/table-virtuoso/body/TableBodyCell.js +473 -0
- package/lib/table-virtuoso/body/TableBodyRow.d.ts +13 -0
- package/lib/table-virtuoso/body/TableBodyRow.js +124 -0
- package/lib/table-virtuoso/footer/TableFooterCell.d.ts +7 -0
- package/lib/table-virtuoso/footer/TableFooterCell.js +63 -0
- package/lib/table-virtuoso/header/TableHeadCell.d.ts +14 -0
- package/lib/table-virtuoso/header/TableHeadCell.js +274 -0
- package/lib/table-virtuoso/header/renderFilter.d.ts +20 -0
- package/lib/table-virtuoso/header/renderFilter.js +299 -0
- package/lib/table-virtuoso/hook/constant.d.ts +73 -0
- package/lib/table-virtuoso/hook/constant.js +247 -0
- package/lib/table-virtuoso/hook/convert.d.ts +1 -0
- package/lib/table-virtuoso/hook/convert.js +34 -0
- package/lib/table-virtuoso/hook/useColumns.d.ts +28 -0
- package/lib/table-virtuoso/hook/useColumns.js +315 -0
- package/lib/table-virtuoso/hook/useFilterOperator.d.ts +7 -0
- package/lib/table-virtuoso/hook/useFilterOperator.js +40 -0
- package/lib/table-virtuoso/hook/utils.d.ts +159 -0
- package/lib/table-virtuoso/hook/utils.js +2389 -0
- package/lib/table-virtuoso/index.d.ts +2 -0
- package/lib/table-virtuoso/index.js +9 -0
- package/lib/table-virtuoso/style.d.ts +22 -0
- package/lib/table-virtuoso/style.js +18 -0
- package/lib/table-virtuoso/style.scss +1440 -0
- package/lib/table-virtuoso/table/Grid.d.ts +37 -0
- package/lib/table-virtuoso/table/Grid.js +311 -0
- package/lib/table-virtuoso/table/TableContainer.d.ts +49 -0
- package/lib/table-virtuoso/table/TableContainer.js +313 -0
- package/lib/table-virtuoso/table/TableWrapper.d.ts +20 -0
- package/lib/table-virtuoso/table/TableWrapper.js +164 -0
- package/lib/table-virtuoso/type.d.ts +0 -0
- package/lib/table-virtuoso/type.js +786 -0
- package/lib/table-virtuoso/useContext.d.ts +97 -0
- package/lib/table-virtuoso/useContext.js +27 -0
- package/package.json +2 -1
- package/es/grid-component/ConvertColumnTable.d.ts +0 -7
- package/es/grid-component/ConvertColumnTable.js +0 -144
- package/es/grid-component/InternalTable.js +0 -1170
- package/es/grid-component/table/Grid.d.ts +0 -23
- package/es/grid-component/table/Grid.js +0 -49
- package/es/grid-component/table/GridEdit.d.ts +0 -23
- package/es/grid-component/table/GridEdit.js +0 -2726
- package/es/grid-component/table/Group.d.ts +0 -21
- package/es/grid-component/table/Group.js +0 -195
- package/es/grid-component/table/InfiniteTable.d.ts +0 -23
- package/es/grid-component/table/InfiniteTable.js +0 -101
- package/lib/grid-component/ConvertColumnTable.d.ts +0 -7
- package/lib/grid-component/ConvertColumnTable.js +0 -153
- package/lib/grid-component/InternalTable.js +0 -1178
- package/lib/grid-component/table/Grid.d.ts +0 -23
- package/lib/grid-component/table/Grid.js +0 -58
- package/lib/grid-component/table/GridEdit.d.ts +0 -23
- package/lib/grid-component/table/GridEdit.js +0 -2723
- package/lib/grid-component/table/Group.d.ts +0 -21
- package/lib/grid-component/table/Group.js +0 -204
- package/lib/grid-component/table/InfiniteTable.d.ts +0 -23
- package/lib/grid-component/table/InfiniteTable.js +0 -109
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { ColumnsTable, GridTableProps } from "../type";
|
|
3
|
-
import type { GetRowKey } from "../type";
|
|
4
|
-
type Props<T> = GridTableProps<T> & {
|
|
5
|
-
tableRef: any;
|
|
6
|
-
triggerChangeColumns?: (columns: ColumnsTable<T>, type: string) => void;
|
|
7
|
-
triggerChangeData?: (newData: T[], type: string) => void;
|
|
8
|
-
getRowKey: GetRowKey<T>;
|
|
9
|
-
triggerGroupColumns?: (groupedColumns: string[]) => void;
|
|
10
|
-
triggerPaste?: (pastedRows: T[], pastedColumnsArray: string[], newData: T[], copyRows: T[]) => void;
|
|
11
|
-
triggerFilter?: (queries: any) => void;
|
|
12
|
-
setTooltipContent?: any;
|
|
13
|
-
scrollHeight?: number;
|
|
14
|
-
originData: T[];
|
|
15
|
-
mergedFilterKeys?: any;
|
|
16
|
-
setMergedFilterKeys?: any;
|
|
17
|
-
handleFullScreen?: any;
|
|
18
|
-
isFullScreen?: boolean;
|
|
19
|
-
};
|
|
20
|
-
declare const Group: <RecordType extends object>(props: Props<RecordType>) => React.JSX.Element;
|
|
21
|
-
export default Group;
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import React, { Fragment } from 'react';
|
|
3
|
-
import { GridStyle } from "../GridStyle";
|
|
4
|
-
import TableGrid from "../TableGrid";
|
|
5
|
-
import { findAllChildrenKeys } from "../hooks";
|
|
6
|
-
import { ColumnsGroup } from "../ColumnsGroup/ColumnsGroup";
|
|
7
|
-
import { flatColumns2 } from "../hooks/columns";
|
|
8
|
-
import { Collapse2, Expand2 } from "becoxy-icons";
|
|
9
|
-
import { ConfigProvider } from 'rc-master-ui';
|
|
10
|
-
const Group = props => {
|
|
11
|
-
const {
|
|
12
|
-
t,
|
|
13
|
-
id,
|
|
14
|
-
columns,
|
|
15
|
-
height,
|
|
16
|
-
scrollHeight,
|
|
17
|
-
style,
|
|
18
|
-
rowHoverable,
|
|
19
|
-
groupAble,
|
|
20
|
-
expandable,
|
|
21
|
-
dataSource,
|
|
22
|
-
rowKey,
|
|
23
|
-
getRowKey,
|
|
24
|
-
groupSetting,
|
|
25
|
-
groupColumns,
|
|
26
|
-
triggerGroupColumns,
|
|
27
|
-
onExpandClick,
|
|
28
|
-
isFullScreen,
|
|
29
|
-
...rest
|
|
30
|
-
} = props;
|
|
31
|
-
const {
|
|
32
|
-
defaultExpandedRowKeys,
|
|
33
|
-
defaultExpandAllRows
|
|
34
|
-
} = expandable || {};
|
|
35
|
-
const childrenColumnName = 'children';
|
|
36
|
-
const [innerExpandedKeys, setInnerExpandedKeys] = React.useState(() => {
|
|
37
|
-
if (defaultExpandedRowKeys) {
|
|
38
|
-
return defaultExpandedRowKeys;
|
|
39
|
-
}
|
|
40
|
-
if (defaultExpandAllRows) {
|
|
41
|
-
return findAllChildrenKeys(dataSource, getRowKey, childrenColumnName) ?? [];
|
|
42
|
-
}
|
|
43
|
-
return [];
|
|
44
|
-
});
|
|
45
|
-
React.useEffect(() => {
|
|
46
|
-
if (defaultExpandAllRows) {
|
|
47
|
-
setInnerExpandedKeys(findAllChildrenKeys(dataSource, getRowKey, childrenColumnName) ?? []);
|
|
48
|
-
} else {
|
|
49
|
-
if (defaultExpandedRowKeys) {
|
|
50
|
-
setInnerExpandedKeys(defaultExpandedRowKeys);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}, [defaultExpandedRowKeys, defaultExpandAllRows, dataSource]);
|
|
54
|
-
const mergedExpandedKeys = React.useMemo(() => new Set(innerExpandedKeys || []), [innerExpandedKeys]);
|
|
55
|
-
const onTriggerExpand = React.useCallback(record => {
|
|
56
|
-
const key = getRowKey(record, dataSource.indexOf(record));
|
|
57
|
-
let newExpandedKeys;
|
|
58
|
-
const hasKey = mergedExpandedKeys.has(key);
|
|
59
|
-
if (hasKey) {
|
|
60
|
-
mergedExpandedKeys.delete(key);
|
|
61
|
-
newExpandedKeys = [...mergedExpandedKeys];
|
|
62
|
-
} else {
|
|
63
|
-
newExpandedKeys = [...mergedExpandedKeys, key];
|
|
64
|
-
// gọi sự kiện expand
|
|
65
|
-
|
|
66
|
-
onExpandClick?.({
|
|
67
|
-
expandedKeys: newExpandedKeys,
|
|
68
|
-
key: key,
|
|
69
|
-
rowData: record
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
setInnerExpandedKeys(newExpandedKeys);
|
|
73
|
-
}, [getRowKey, dataSource, mergedExpandedKeys, onExpandClick]);
|
|
74
|
-
const handleExpandAllGroup = () => {
|
|
75
|
-
setInnerExpandedKeys(findAllChildrenKeys(dataSource, getRowKey, childrenColumnName) ?? []);
|
|
76
|
-
};
|
|
77
|
-
const handleCollapseAllGroup = () => {
|
|
78
|
-
setInnerExpandedKeys([]);
|
|
79
|
-
};
|
|
80
|
-
const handleOnGroup = value => {
|
|
81
|
-
triggerGroupColumns?.(value);
|
|
82
|
-
};
|
|
83
|
-
const groupToolbar = () => {
|
|
84
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
85
|
-
style: {
|
|
86
|
-
display: 'flex',
|
|
87
|
-
gap: '10px',
|
|
88
|
-
marginRight: 10
|
|
89
|
-
}
|
|
90
|
-
}, groupSetting?.showGroupIcon !== false && /*#__PURE__*/React.createElement(ColumnsGroup, {
|
|
91
|
-
t: t
|
|
92
|
-
// defaultGroupColumns={['name']}
|
|
93
|
-
,
|
|
94
|
-
unClearableLevel: groupSetting?.unClearableLevel
|
|
95
|
-
// unClearableLevel={2}
|
|
96
|
-
,
|
|
97
|
-
columns: columns ? flatColumns2(columns) : [],
|
|
98
|
-
columnsGrouped: groupColumns,
|
|
99
|
-
onSubmit: handleOnGroup
|
|
100
|
-
}), /*#__PURE__*/React.createElement(Fragment, null, innerExpandedKeys.length > 0 ? /*#__PURE__*/React.createElement(Collapse2, {
|
|
101
|
-
fontSize: 16,
|
|
102
|
-
color: '#555555',
|
|
103
|
-
onClick: handleCollapseAllGroup
|
|
104
|
-
}) : /*#__PURE__*/React.createElement(Expand2, {
|
|
105
|
-
fontSize: 16,
|
|
106
|
-
color: '#555555',
|
|
107
|
-
onClick: handleExpandAllGroup
|
|
108
|
-
})));
|
|
109
|
-
};
|
|
110
|
-
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(GridStyle, {
|
|
111
|
-
$heightTable: height,
|
|
112
|
-
$heightScroll: scrollHeight,
|
|
113
|
-
$isFullScreen: isFullScreen,
|
|
114
|
-
style: {
|
|
115
|
-
position: 'relative'
|
|
116
|
-
},
|
|
117
|
-
id: id
|
|
118
|
-
}, /*#__PURE__*/React.createElement(ConfigProvider, {
|
|
119
|
-
theme: {
|
|
120
|
-
components: {
|
|
121
|
-
Table: {
|
|
122
|
-
rowHoverBg: '#eb461912',
|
|
123
|
-
rowSelectedBg: '#eb4619',
|
|
124
|
-
rowSelectedHoverBg: '#eb4619',
|
|
125
|
-
cellFontSize: 12,
|
|
126
|
-
cellFontSizeSM: 13,
|
|
127
|
-
headerBg: '#ffffff',
|
|
128
|
-
cellPaddingBlockSM: 7
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}, /*#__PURE__*/React.createElement(TableGrid, _extends({}, rest, {
|
|
133
|
-
t: t,
|
|
134
|
-
id: id,
|
|
135
|
-
rowKey: rowKey,
|
|
136
|
-
columns: columns
|
|
137
|
-
// style={{...style, minHeight: height}}
|
|
138
|
-
,
|
|
139
|
-
rowHoverable: rowHoverable ?? true,
|
|
140
|
-
dataSource: dataSource,
|
|
141
|
-
getRowKey: getRowKey,
|
|
142
|
-
groupAble: groupAble,
|
|
143
|
-
groupSetting: groupSetting,
|
|
144
|
-
expandable: {
|
|
145
|
-
expandIconColumnIndex: 3,
|
|
146
|
-
defaultExpandAllRows: true,
|
|
147
|
-
indentSize: 25,
|
|
148
|
-
expandIcon: args => {
|
|
149
|
-
const {
|
|
150
|
-
record,
|
|
151
|
-
expanded,
|
|
152
|
-
onExpand
|
|
153
|
-
} = args;
|
|
154
|
-
if (!groupColumns || groupColumns?.length === 0) {
|
|
155
|
-
return '';
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
// @ts-ignore
|
|
159
|
-
if ((record?.children || record?.isChildren) && groupColumns?.length > 0) {
|
|
160
|
-
return expanded ? /*#__PURE__*/React.createElement("button", {
|
|
161
|
-
onClick: e => {
|
|
162
|
-
e.preventDefault();
|
|
163
|
-
e.stopPropagation();
|
|
164
|
-
onExpand(record, e);
|
|
165
|
-
if (groupAble) {
|
|
166
|
-
onTriggerExpand(record);
|
|
167
|
-
}
|
|
168
|
-
},
|
|
169
|
-
className: 'ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-expanded'
|
|
170
|
-
}) : /*#__PURE__*/React.createElement("button", {
|
|
171
|
-
onClick: e => {
|
|
172
|
-
e.preventDefault();
|
|
173
|
-
e.stopPropagation();
|
|
174
|
-
onExpand(record, e);
|
|
175
|
-
if (groupAble) {
|
|
176
|
-
onTriggerExpand(record);
|
|
177
|
-
}
|
|
178
|
-
},
|
|
179
|
-
className: 'ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-collapsed'
|
|
180
|
-
});
|
|
181
|
-
} else {
|
|
182
|
-
return /*#__PURE__*/React.createElement("button", {
|
|
183
|
-
className: 'ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-spaced'
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
},
|
|
187
|
-
expandedRowKeys: groupAble ? innerExpandedKeys : undefined,
|
|
188
|
-
...expandable
|
|
189
|
-
},
|
|
190
|
-
groupToolbar: groupToolbar,
|
|
191
|
-
groupColumns: groupColumns,
|
|
192
|
-
isFullScreen: isFullScreen
|
|
193
|
-
})))));
|
|
194
|
-
};
|
|
195
|
-
export default Group;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { ColumnsTable, GetRowKey } from "../type";
|
|
3
|
-
import type { TableProps } from "../type";
|
|
4
|
-
type Props<T> = TableProps<T> & {
|
|
5
|
-
scrollHeight?: number;
|
|
6
|
-
tableRef: any;
|
|
7
|
-
triggerFilter?: (queries: any) => void;
|
|
8
|
-
triggerChangeColumns?: (columns: ColumnsTable<T>, type: string) => void;
|
|
9
|
-
triggerChangeData?: (newData: T[], type: string) => void;
|
|
10
|
-
getRowKey: GetRowKey<T>;
|
|
11
|
-
triggerGroupColumns?: (groupedColumns: string[]) => void;
|
|
12
|
-
setTooltipContent?: any;
|
|
13
|
-
triggerPaste?: (pastedRows: T[], pastedColumnsArray: string[], newData: T[], copyRows: T[]) => void;
|
|
14
|
-
isFilter?: boolean;
|
|
15
|
-
setIsFilter?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
16
|
-
originData: T[];
|
|
17
|
-
mergedFilterKeys?: any;
|
|
18
|
-
setMergedFilterKeys?: any;
|
|
19
|
-
handleFullScreen?: any;
|
|
20
|
-
isFullScreen?: boolean;
|
|
21
|
-
};
|
|
22
|
-
declare const InfiniteTable: <RecordType extends object>(props: Props<RecordType>) => React.JSX.Element;
|
|
23
|
-
export default InfiniteTable;
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import React, { Fragment, useRef } from 'react';
|
|
3
|
-
import { GridStyle } from "../GridStyle";
|
|
4
|
-
import { ConfigProvider } from "rc-master-ui";
|
|
5
|
-
import TableGrid from "../TableGrid";
|
|
6
|
-
|
|
7
|
-
// type Props = {
|
|
8
|
-
// columns: any[]
|
|
9
|
-
// data: any[]
|
|
10
|
-
// currentPage: number
|
|
11
|
-
// pageSize: number
|
|
12
|
-
// total: number
|
|
13
|
-
// loading?: boolean
|
|
14
|
-
// next?: () => void
|
|
15
|
-
// }
|
|
16
|
-
|
|
17
|
-
const InfiniteTable = props => {
|
|
18
|
-
const {
|
|
19
|
-
next,
|
|
20
|
-
loading
|
|
21
|
-
} = props;
|
|
22
|
-
const {
|
|
23
|
-
id,
|
|
24
|
-
height,
|
|
25
|
-
scrollHeight,
|
|
26
|
-
rowHoverable,
|
|
27
|
-
pagination,
|
|
28
|
-
dataSource,
|
|
29
|
-
isFullScreen,
|
|
30
|
-
...rest
|
|
31
|
-
} = props;
|
|
32
|
-
const {
|
|
33
|
-
currentPage,
|
|
34
|
-
pageSize,
|
|
35
|
-
total
|
|
36
|
-
} = pagination ?? {};
|
|
37
|
-
const loadingRef = useRef(false);
|
|
38
|
-
const hasMoreRef = useRef(true);
|
|
39
|
-
const loadData = page => {
|
|
40
|
-
if (!hasMoreRef.current || loadingRef.current || loading) return;
|
|
41
|
-
loadingRef.current = true;
|
|
42
|
-
setTimeout(() => {
|
|
43
|
-
next?.();
|
|
44
|
-
if (page * pageSize >= total) {
|
|
45
|
-
hasMoreRef.current = false;
|
|
46
|
-
}
|
|
47
|
-
loadingRef.current = false;
|
|
48
|
-
}, 10);
|
|
49
|
-
};
|
|
50
|
-
const handleNext = () => {
|
|
51
|
-
loadData(currentPage + 1);
|
|
52
|
-
};
|
|
53
|
-
const handleScroll = e => {
|
|
54
|
-
if (loadingRef.current || loading || dataSource?.length === 0) {
|
|
55
|
-
e.stopPropagation();
|
|
56
|
-
e.preventDefault();
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
const {
|
|
60
|
-
scrollHeight: tbScrollHeight,
|
|
61
|
-
scrollTop,
|
|
62
|
-
clientHeight
|
|
63
|
-
} = e.currentTarget;
|
|
64
|
-
const isEnd = scrollTop + clientHeight >= tbScrollHeight - 50;
|
|
65
|
-
if (isEnd && !loadingRef.current && hasMoreRef.current && dataSource?.length > 0) {
|
|
66
|
-
handleNext();
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(GridStyle, {
|
|
70
|
-
$heightTable: height,
|
|
71
|
-
$heightScroll: scrollHeight,
|
|
72
|
-
$isFullScreen: isFullScreen,
|
|
73
|
-
style: {
|
|
74
|
-
position: 'relative'
|
|
75
|
-
},
|
|
76
|
-
id: id
|
|
77
|
-
}, /*#__PURE__*/React.createElement(ConfigProvider, {
|
|
78
|
-
theme: {
|
|
79
|
-
components: {
|
|
80
|
-
Table: {
|
|
81
|
-
rowHoverBg: '#eb461912',
|
|
82
|
-
rowSelectedBg: '#eb4619',
|
|
83
|
-
rowSelectedHoverBg: '#eb4619',
|
|
84
|
-
cellFontSize: 12,
|
|
85
|
-
cellFontSizeSM: 13,
|
|
86
|
-
headerBg: '#ffffff',
|
|
87
|
-
cellPaddingBlockSM: 7
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}, /*#__PURE__*/React.createElement(TableGrid, _extends({}, rest, {
|
|
92
|
-
id: id,
|
|
93
|
-
dataSource: dataSource,
|
|
94
|
-
pagination: false,
|
|
95
|
-
virtualRow: true,
|
|
96
|
-
onScroll: handleScroll,
|
|
97
|
-
loading: loading,
|
|
98
|
-
isFullScreen: isFullScreen
|
|
99
|
-
})))));
|
|
100
|
-
};
|
|
101
|
-
export default InfiniteTable;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { GridTableProps } from "./type";
|
|
3
|
-
import 'dayjs/locale/es';
|
|
4
|
-
import 'dayjs/locale/vi';
|
|
5
|
-
import './styles.scss';
|
|
6
|
-
declare const ConvertColumnTable: <RecordType extends object>(props: GridTableProps<RecordType>) => React.JSX.Element;
|
|
7
|
-
export default ConvertColumnTable;
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _reactResizable = require("react-resizable");
|
|
11
|
-
var _customParseFormat = _interopRequireDefault(require("dayjs/plugin/customParseFormat"));
|
|
12
|
-
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
13
|
-
require("dayjs/locale/es");
|
|
14
|
-
require("dayjs/locale/vi");
|
|
15
|
-
var _en_US = _interopRequireDefault(require("rc-master-ui/es/date-picker/locale/en_US"));
|
|
16
|
-
var _vi_VN = _interopRequireDefault(require("rc-master-ui/es/date-picker/locale/vi_VN"));
|
|
17
|
-
require("./styles.scss");
|
|
18
|
-
var _InternalTable = _interopRequireDefault(require("./InternalTable"));
|
|
19
|
-
var _useColumns = _interopRequireDefault(require("./hooks/useColumns"));
|
|
20
|
-
var _hooks = require("./hooks");
|
|
21
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
22
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
23
|
-
// import classNames from "classnames";
|
|
24
|
-
|
|
25
|
-
// import useMergedState from "rc-util/lib/hooks/useMergedState";
|
|
26
|
-
|
|
27
|
-
_dayjs.default.extend(_customParseFormat.default);
|
|
28
|
-
|
|
29
|
-
// const ASCEND = 'ascend';
|
|
30
|
-
// const DESCEND = 'descend';
|
|
31
|
-
|
|
32
|
-
const ResizableTitle = props => {
|
|
33
|
-
const {
|
|
34
|
-
onResize,
|
|
35
|
-
width,
|
|
36
|
-
...restProps
|
|
37
|
-
} = props;
|
|
38
|
-
if (!width) {
|
|
39
|
-
return /*#__PURE__*/_react.default.createElement("th", restProps);
|
|
40
|
-
}
|
|
41
|
-
return (
|
|
42
|
-
/*#__PURE__*/
|
|
43
|
-
// @ts-ignore
|
|
44
|
-
_react.default.createElement(_reactResizable.Resizable, {
|
|
45
|
-
width: width,
|
|
46
|
-
height: 0,
|
|
47
|
-
handle: /*#__PURE__*/_react.default.createElement("span", {
|
|
48
|
-
className: "react-resizable-handle",
|
|
49
|
-
onClick: e => {
|
|
50
|
-
e.stopPropagation();
|
|
51
|
-
}
|
|
52
|
-
}),
|
|
53
|
-
onResize: onResize,
|
|
54
|
-
draggableOpts: {
|
|
55
|
-
enableUserSelectHack: false
|
|
56
|
-
}
|
|
57
|
-
}, /*#__PURE__*/_react.default.createElement("th", restProps))
|
|
58
|
-
);
|
|
59
|
-
};
|
|
60
|
-
const ConvertColumnTable = props => {
|
|
61
|
-
const {
|
|
62
|
-
t,
|
|
63
|
-
columns: propsColumns,
|
|
64
|
-
dataSource,
|
|
65
|
-
lang,
|
|
66
|
-
locale,
|
|
67
|
-
format,
|
|
68
|
-
allowResizing,
|
|
69
|
-
dataSourceFilter: propDataSourceFilter,
|
|
70
|
-
onFilterClick,
|
|
71
|
-
editAble,
|
|
72
|
-
rowKey: propRowKey,
|
|
73
|
-
sortMultiple,
|
|
74
|
-
groupAble,
|
|
75
|
-
groupSetting,
|
|
76
|
-
groupColumns,
|
|
77
|
-
...rest
|
|
78
|
-
} = props;
|
|
79
|
-
const local = lang && lang === 'en' ? _en_US.default : _vi_VN.default;
|
|
80
|
-
const buddhistLocale = {
|
|
81
|
-
...local,
|
|
82
|
-
lang: {
|
|
83
|
-
...local.lang
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
const rowKey = (0, _react.useMemo)(() => {
|
|
87
|
-
return editAble ? 'rowId' : propRowKey ?? 'id';
|
|
88
|
-
}, [editAble, propRowKey]);
|
|
89
|
-
const [columns, setColumns] = _react.default.useState([]);
|
|
90
|
-
|
|
91
|
-
// ========================= Keys =========================
|
|
92
|
-
// const [columns, setColumns] = useMergedState(
|
|
93
|
-
// propsColumns || [],
|
|
94
|
-
// {
|
|
95
|
-
// value: propsColumns,
|
|
96
|
-
// },
|
|
97
|
-
// );
|
|
98
|
-
|
|
99
|
-
_react.default.useEffect(() => {
|
|
100
|
-
setColumns(propsColumns);
|
|
101
|
-
}, [propsColumns]);
|
|
102
|
-
const handleResize = column => (e, {
|
|
103
|
-
size
|
|
104
|
-
}) => {
|
|
105
|
-
const newColumn = {
|
|
106
|
-
...column,
|
|
107
|
-
width: size.width
|
|
108
|
-
};
|
|
109
|
-
const newColumns = (0, _hooks.updateArrayByKey)(columns, newColumn, 'field');
|
|
110
|
-
setColumns(newColumns);
|
|
111
|
-
};
|
|
112
|
-
const [transformSelectionColumns] = (0, _useColumns.default)({
|
|
113
|
-
locale,
|
|
114
|
-
t,
|
|
115
|
-
buddhistLocale,
|
|
116
|
-
dataSource,
|
|
117
|
-
dataSourceFilter: propDataSourceFilter,
|
|
118
|
-
format,
|
|
119
|
-
sortMultiple,
|
|
120
|
-
groupAble,
|
|
121
|
-
groupSetting,
|
|
122
|
-
groupColumns,
|
|
123
|
-
handleResize
|
|
124
|
-
});
|
|
125
|
-
const mergedColumns = _react.default.useMemo(() => {
|
|
126
|
-
return transformSelectionColumns(columns);
|
|
127
|
-
}, [columns, transformSelectionColumns]);
|
|
128
|
-
const mergerdData = _react.default.useMemo(() => {
|
|
129
|
-
return dataSource;
|
|
130
|
-
}, [dataSource]);
|
|
131
|
-
return /*#__PURE__*/_react.default.createElement(_InternalTable.default, (0, _extends2.default)({}, rest, {
|
|
132
|
-
t: t,
|
|
133
|
-
editAble: editAble,
|
|
134
|
-
dataSource: mergerdData,
|
|
135
|
-
format: format,
|
|
136
|
-
locale: locale,
|
|
137
|
-
components: {
|
|
138
|
-
header: {
|
|
139
|
-
cell: allowResizing ? ResizableTitle : undefined
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
// columns={mergedColumns}
|
|
143
|
-
,
|
|
144
|
-
columns: mergedColumns ?? [],
|
|
145
|
-
showSorterTooltip: {
|
|
146
|
-
target: 'sorter-icon'
|
|
147
|
-
},
|
|
148
|
-
rowKey: rowKey,
|
|
149
|
-
groupAble: groupAble,
|
|
150
|
-
groupSetting: groupSetting
|
|
151
|
-
}));
|
|
152
|
-
};
|
|
153
|
-
var _default = exports.default = ConvertColumnTable;
|