es-grid-template 1.7.37 → 1.7.38
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/LICENSE +21 -21
- package/README.md +1 -1
- package/es/grid-component/ContextMenu.d.ts +2 -3
- package/es/grid-component/ContextMenu.js +2 -2
- package/es/grid-component/InternalTable.d.ts +1 -1
- package/es/grid-component/InternalTable.js +31 -39
- package/es/grid-component/hooks/constant.js +6 -6
- package/es/grid-component/hooks/content/TooltipContent.d.ts +2 -1
- package/es/grid-component/hooks/useColumns.d.ts +3 -1
- package/es/grid-component/hooks/utils.d.ts +1 -1
- package/es/grid-component/styles.scss +1437 -1437
- package/es/table-component/ContextMenu.d.ts +2 -3
- package/es/table-component/ContextMenu.js +2 -2
- package/es/table-component/InternalTable.d.ts +6 -6
- package/es/table-component/InternalTable.js +32 -29
- package/es/table-component/TableContainer.d.ts +5 -5
- package/es/table-component/TableContainer.js +31 -32
- package/es/table-component/TableContainerEdit.d.ts +1 -1
- package/es/table-component/TableContainerEdit.js +236 -200
- package/es/table-component/body/EditableCell.js +154 -157
- package/es/table-component/body/TableBody.d.ts +1 -1
- package/es/table-component/body/TableBody.js +5 -5
- package/es/table-component/body/TableBodyCell.js +37 -18
- package/es/table-component/body/TableBodyCellEdit.d.ts +4 -4
- package/es/table-component/body/TableBodyCellEdit.js +61 -53
- package/es/table-component/body/TableBodyRow.js +0 -1
- package/es/table-component/footer/TableFooterCell.d.ts +3 -3
- package/es/table-component/footer/TableFooterCell.js +8 -6
- package/es/table-component/header/TableHead.d.ts +5 -5
- package/es/table-component/header/TableHead.js +2 -2
- package/es/table-component/hook/constant.js +6 -6
- package/es/table-component/hook/useFilterOperator.d.ts +1 -1
- package/es/table-component/hook/utils.d.ts +2 -2
- package/es/table-component/hook/utils.js +202 -154
- package/es/table-component/style.scss +1197 -1197
- package/es/table-component/table/TableWrapper.d.ts +4 -4
- package/es/table-component/table/TableWrapper.js +23 -20
- package/es/table-component/type.d.ts +40 -40
- package/es/table-component/useContext.d.ts +4 -3
- package/es/table-component/useContext.js +4 -4
- package/lib/grid-component/ContextMenu.d.ts +2 -3
- package/lib/grid-component/InternalTable.d.ts +1 -1
- package/lib/grid-component/InternalTable.js +25 -33
- package/lib/grid-component/hooks/constant.js +6 -6
- package/lib/grid-component/hooks/content/TooltipContent.d.ts +2 -1
- package/lib/grid-component/hooks/useColumns.d.ts +3 -1
- package/lib/grid-component/hooks/utils.d.ts +1 -1
- package/lib/grid-component/styles.scss +1437 -1437
- package/lib/table-component/ContextMenu.d.ts +2 -3
- package/lib/table-component/InternalTable.d.ts +6 -6
- package/lib/table-component/InternalTable.js +23 -22
- package/lib/table-component/TableContainer.d.ts +5 -5
- package/lib/table-component/TableContainer.js +24 -26
- package/lib/table-component/TableContainerEdit.d.ts +1 -1
- package/lib/table-component/TableContainerEdit.js +235 -199
- package/lib/table-component/body/EditableCell.js +153 -156
- package/lib/table-component/body/TableBody.d.ts +1 -1
- package/lib/table-component/body/TableBody.js +5 -5
- package/lib/table-component/body/TableBodyCell.js +36 -17
- package/lib/table-component/body/TableBodyCellEdit.d.ts +4 -4
- package/lib/table-component/body/TableBodyCellEdit.js +58 -50
- package/lib/table-component/body/TableBodyRow.js +0 -1
- package/lib/table-component/footer/TableFooterCell.d.ts +3 -3
- package/lib/table-component/footer/TableFooterCell.js +7 -5
- package/lib/table-component/header/TableHead.d.ts +5 -5
- package/lib/table-component/header/TableHead.js +1 -1
- package/lib/table-component/hook/constant.js +6 -6
- package/lib/table-component/hook/useFilterOperator.d.ts +1 -1
- package/lib/table-component/hook/utils.d.ts +2 -2
- package/lib/table-component/hook/utils.js +201 -153
- package/lib/table-component/style.scss +1197 -1197
- package/lib/table-component/table/TableWrapper.d.ts +4 -4
- package/lib/table-component/table/TableWrapper.js +23 -20
- package/lib/table-component/type.d.ts +40 -40
- package/lib/table-component/useContext.d.ts +4 -3
- package/lib/table-component/useContext.js +3 -3
- package/package.json +2 -2
- package/CHANGELOG.md +0 -6
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import type { ContextInfo } from
|
|
3
|
-
import type { ContextMenuItem } from "./type";
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { ContextInfo, ContextMenuItem } from './type';
|
|
4
3
|
export declare const findItemByKey: (array: any[], key: string, value: any) => any;
|
|
5
4
|
type Props<RecordType> = {
|
|
6
5
|
rowData: RecordType | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as React from
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
// import type { MenuProps } from "antd";
|
|
3
|
-
import { Dropdown, Menu } from
|
|
3
|
+
import { Dropdown, Menu } from 'antd';
|
|
4
4
|
export const findItemByKey = (array, key, value) => {
|
|
5
5
|
for (let i = 0; i < array.length; i++) {
|
|
6
6
|
const item = array[i];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import type { TableProps } from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "react-resizable/css/styles.css";
|
|
3
|
+
import "dayjs/locale/es";
|
|
4
|
+
import "dayjs/locale/vi";
|
|
5
|
+
import "./style.scss";
|
|
6
|
+
import type { TableProps } from "./type";
|
|
7
7
|
export declare const SELECTION_COLUMN: {};
|
|
8
8
|
declare const InternalTable: <RecordType extends object>(props: TableProps<RecordType>) => React.JSX.Element;
|
|
9
9
|
export default InternalTable;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import customParseFormat from
|
|
3
|
-
import React, { Fragment, useState } from
|
|
4
|
-
import
|
|
5
|
-
import dayjs from
|
|
6
|
-
import
|
|
7
|
-
import
|
|
2
|
+
import customParseFormat from "dayjs/plugin/customParseFormat";
|
|
3
|
+
import React, { Fragment, useState } from "react";
|
|
4
|
+
import "react-resizable/css/styles.css";
|
|
5
|
+
import dayjs from "dayjs";
|
|
6
|
+
import "dayjs/locale/es";
|
|
7
|
+
import "dayjs/locale/vi";
|
|
8
8
|
|
|
9
9
|
// import en from "rc-master-ui/es/date-picker/locale/en_US"
|
|
10
10
|
// import vi from "rc-master-ui/es/date-picker/locale/vi_VN"
|
|
@@ -20,11 +20,10 @@ import "./style.scss";
|
|
|
20
20
|
// import withReactContent from "sweetalert2-react-content"
|
|
21
21
|
// import { Tooltip } from "react-tooltip"
|
|
22
22
|
|
|
23
|
-
import { faker } from
|
|
23
|
+
import { faker } from "@faker-js/faker";
|
|
24
24
|
import useMergedState from "rc-util/es/hooks/useMergedState";
|
|
25
25
|
// import InfiniteTable from './table/InfiniteTable'
|
|
26
26
|
// import GridEdit from './table/GridEdit'
|
|
27
|
-
import Grid from "./table/Grid";
|
|
28
27
|
// import { Group } from 'becoxy-icons'
|
|
29
28
|
|
|
30
29
|
// import { Tooltip } from 'react-tooltip'
|
|
@@ -37,7 +36,9 @@ getAllRowKey, getDiffent2Array, getFixedFields, getInvisibleColumns, groupArrayB
|
|
|
37
36
|
// import GridEdit from './table/GridEdit'
|
|
38
37
|
import { convertToTanStackColumns } from "./hook/useColumns";
|
|
39
38
|
import { convertColumns } from "./hook/convert";
|
|
40
|
-
import { Modal } from
|
|
39
|
+
import { Modal } from "antd";
|
|
40
|
+
import Grid from "./table/Grid";
|
|
41
|
+
|
|
41
42
|
// import { columns111 } from '../test-2/columns'
|
|
42
43
|
|
|
43
44
|
dayjs.extend(customParseFormat);
|
|
@@ -53,7 +54,7 @@ const InternalTable = props => {
|
|
|
53
54
|
t,
|
|
54
55
|
columns: propsColumns,
|
|
55
56
|
// columns,
|
|
56
|
-
lang,
|
|
57
|
+
// lang,
|
|
57
58
|
locale,
|
|
58
59
|
dataSource,
|
|
59
60
|
editAble,
|
|
@@ -68,16 +69,16 @@ const InternalTable = props => {
|
|
|
68
69
|
// expandable,
|
|
69
70
|
// contextMenuItems: propContextMenuItems,
|
|
70
71
|
// contextMenuHidden,
|
|
71
|
-
contextMenuClick,
|
|
72
|
-
contextMenuOpen,
|
|
72
|
+
// contextMenuClick,
|
|
73
|
+
// contextMenuOpen,
|
|
73
74
|
height,
|
|
74
75
|
...rest
|
|
75
76
|
} = props;
|
|
76
77
|
const id = React.useMemo(() => {
|
|
77
78
|
return faker.string.alpha(20);
|
|
78
79
|
}, []);
|
|
79
|
-
const rowKey =
|
|
80
|
-
const prefix =
|
|
80
|
+
const rowKey = "rowId";
|
|
81
|
+
const prefix = "ui-rc";
|
|
81
82
|
const getWindowSize = () => {
|
|
82
83
|
const {
|
|
83
84
|
innerWidth,
|
|
@@ -93,9 +94,9 @@ const InternalTable = props => {
|
|
|
93
94
|
const handleWindowResize = () => {
|
|
94
95
|
setWindowSize(getWindowSize());
|
|
95
96
|
};
|
|
96
|
-
window.addEventListener(
|
|
97
|
+
window.addEventListener("resize", handleWindowResize);
|
|
97
98
|
return () => {
|
|
98
|
-
window.removeEventListener(
|
|
99
|
+
window.removeEventListener("resize", handleWindowResize);
|
|
99
100
|
};
|
|
100
101
|
}, []);
|
|
101
102
|
|
|
@@ -156,8 +157,8 @@ const InternalTable = props => {
|
|
|
156
157
|
}, [dataSource]);
|
|
157
158
|
const columnPinning = React.useMemo(() => {
|
|
158
159
|
return {
|
|
159
|
-
left: getFixedFields(columns,
|
|
160
|
-
right: getFixedFields(columns,
|
|
160
|
+
left: getFixedFields(columns, "left"),
|
|
161
|
+
right: getFixedFields(columns, "right")
|
|
161
162
|
};
|
|
162
163
|
}, [columns]);
|
|
163
164
|
|
|
@@ -185,7 +186,7 @@ const InternalTable = props => {
|
|
|
185
186
|
value: undefined
|
|
186
187
|
});
|
|
187
188
|
const triggerChangeColumns = (cols, keys, type) => {
|
|
188
|
-
if (type ===
|
|
189
|
+
if (type === "cellClick") {
|
|
189
190
|
setColumns(cols);
|
|
190
191
|
} else {
|
|
191
192
|
const aa = flatColumns2(columns).map(it => it.field);
|
|
@@ -294,7 +295,9 @@ const InternalTable = props => {
|
|
|
294
295
|
// onContextMenu={onContextMenu}
|
|
295
296
|
// contextMenuItems={contextMenuItems}
|
|
296
297
|
,
|
|
297
|
-
editAble: editAble
|
|
298
|
+
editAble: isFullScreen ? false : editAble
|
|
299
|
+
// editAble={editAble}
|
|
300
|
+
,
|
|
298
301
|
triggerChangeColumns: triggerChangeColumns,
|
|
299
302
|
setExpanded: setExpanded,
|
|
300
303
|
isFullScreen: isFullScreen,
|
|
@@ -309,27 +312,27 @@ const InternalTable = props => {
|
|
|
309
312
|
footer: null,
|
|
310
313
|
centered: true,
|
|
311
314
|
closable: true,
|
|
312
|
-
width:
|
|
315
|
+
width: "100%",
|
|
313
316
|
style: {
|
|
314
|
-
maxWidth:
|
|
315
|
-
height:
|
|
316
|
-
}
|
|
317
|
-
onClose
|
|
317
|
+
maxWidth: "100%",
|
|
318
|
+
height: "100%"
|
|
319
|
+
}
|
|
320
|
+
// onClose={() => setIsFullScreen(false)}
|
|
321
|
+
,
|
|
318
322
|
onCancel: () => setIsFullScreen(false)
|
|
319
|
-
|
|
320
323
|
// destroyOnClose
|
|
321
324
|
,
|
|
322
325
|
styles: {
|
|
323
326
|
content: {
|
|
324
|
-
height:
|
|
327
|
+
height: "100vh",
|
|
325
328
|
borderRadius: 0,
|
|
326
|
-
padding:
|
|
329
|
+
padding: "15px 10px"
|
|
327
330
|
},
|
|
328
331
|
wrapper: {
|
|
329
332
|
zIndex: 1050
|
|
330
333
|
}
|
|
331
334
|
},
|
|
332
|
-
|
|
335
|
+
destroyOnHidden: true
|
|
333
336
|
}, /*#__PURE__*/React.createElement("div", {
|
|
334
337
|
style: {
|
|
335
338
|
paddingTop: 40
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { Dispatch, SetStateAction } from
|
|
2
|
-
import React from
|
|
3
|
-
import type { ColumnDef, Table } from
|
|
4
|
-
import type { ColumnsTable, TableProps } from
|
|
5
|
-
type TableContainerProps<T> = Omit<TableProps<T>,
|
|
1
|
+
import type { Dispatch, SetStateAction } from "react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import type { ColumnDef, Table } from "@tanstack/react-table";
|
|
4
|
+
import type { ColumnsTable, TableProps } from "./type";
|
|
5
|
+
type TableContainerProps<T> = Omit<TableProps<T>, "columns"> & {
|
|
6
6
|
table: Table<T>;
|
|
7
7
|
prefix: string;
|
|
8
8
|
id: string;
|
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
// import type { Dispatch, SetStateAction } from "react";
|
|
3
3
|
|
|
4
|
-
import React from
|
|
4
|
+
import React from "react";
|
|
5
5
|
// import TableHead from './header/TableHead'
|
|
6
6
|
// import { sumSize } from './hook/utils'
|
|
7
7
|
|
|
8
8
|
// import { useVirtualizer } from '@tanstack/react-virtual'
|
|
9
9
|
|
|
10
|
-
import classNames from
|
|
10
|
+
import classNames from "classnames";
|
|
11
11
|
// import TableBody from './body/TableBody'
|
|
12
12
|
import { TableContext } from "./useContext";
|
|
13
|
-
import Pagination from
|
|
14
|
-
import { Toolbar } from
|
|
15
|
-
import { Maximize, Minimize } from
|
|
13
|
+
import Pagination from "rc-master-ui/es/pagination";
|
|
14
|
+
import { Toolbar } from "rc-master-ui";
|
|
15
|
+
import { Maximize, Minimize } from "becoxy-icons";
|
|
16
16
|
import { ColumnsChoose } from "./ColumnsChoose";
|
|
17
17
|
// import TableFooter from './footer/TableFooter'
|
|
18
18
|
// import TableBody from './body/TableBody'
|
|
19
|
-
import { numericFormatter } from
|
|
20
|
-
// import ComponentSpinner from '../grid-component/LoadingSpinner'
|
|
19
|
+
import { numericFormatter } from "react-numeric-component";
|
|
21
20
|
import TableWrapper from "./table/TableWrapper";
|
|
22
21
|
import { sumSize } from "./hook/utils";
|
|
23
|
-
import { useVirtualizer } from
|
|
22
|
+
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
24
23
|
const TableContainer = props => {
|
|
25
24
|
const {
|
|
26
25
|
t,
|
|
@@ -101,7 +100,7 @@ const TableContainer = props => {
|
|
|
101
100
|
// return element?.getBoundingClientRect().width;
|
|
102
101
|
// },
|
|
103
102
|
|
|
104
|
-
measureElement: typeof window !==
|
|
103
|
+
measureElement: typeof window !== "undefined" && navigator.userAgent.indexOf("Firefox") === -1 ? element => element?.getBoundingClientRect().height : undefined,
|
|
105
104
|
overscan: 1 //how many columns to render on each side off screen each way (adjust this for performance)
|
|
106
105
|
});
|
|
107
106
|
const virtualColumns = columnVirtualizer.getVirtualItems();
|
|
@@ -138,49 +137,49 @@ const TableContainer = props => {
|
|
|
138
137
|
className: classNames(`${prefix}-grid-top-toolbar`, {})
|
|
139
138
|
}, /*#__PURE__*/React.createElement("div", {
|
|
140
139
|
style: {
|
|
141
|
-
display:
|
|
142
|
-
justifyContent:
|
|
143
|
-
alignItems:
|
|
144
|
-
gap:
|
|
140
|
+
display: "flex",
|
|
141
|
+
justifyContent: "space-between",
|
|
142
|
+
alignItems: "center",
|
|
143
|
+
gap: ".75rem"
|
|
145
144
|
}
|
|
146
145
|
}, toolbarItems && toolbarItems?.length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
147
146
|
style: {
|
|
148
147
|
flex: 1,
|
|
149
|
-
overflow:
|
|
148
|
+
overflow: "hidden"
|
|
150
149
|
}
|
|
151
150
|
}, /*#__PURE__*/React.createElement(Toolbar, {
|
|
152
|
-
items: (toolbarItems ?? []).filter(it => it.position !==
|
|
153
|
-
mode:
|
|
151
|
+
items: (toolbarItems ?? []).filter(it => it.position !== "Bottom"),
|
|
152
|
+
mode: "scroll"
|
|
154
153
|
})), fullScreen !== false && (isFullScreen ? /*#__PURE__*/React.createElement(Minimize, {
|
|
155
154
|
fontSize: 16,
|
|
156
155
|
onClick: () => {
|
|
157
156
|
setIsFullScreen(!isFullScreen);
|
|
158
157
|
},
|
|
159
158
|
"data-tooltip-id": `${id}-tooltip-content`,
|
|
160
|
-
"data-tooltip-content": t ? t(
|
|
159
|
+
"data-tooltip-content": t ? t("Minimized") : "Minimized"
|
|
161
160
|
}) : /*#__PURE__*/React.createElement(Maximize, {
|
|
162
161
|
fontSize: 16,
|
|
163
162
|
onClick: () => {
|
|
164
163
|
setIsFullScreen(!isFullScreen);
|
|
165
164
|
},
|
|
166
165
|
"data-tooltip-id": `${id}-tooltip-content`,
|
|
167
|
-
"data-tooltip-content": t ? t(
|
|
166
|
+
"data-tooltip-content": t ? t("Full screen") : "Full screen"
|
|
168
167
|
})), /*#__PURE__*/React.createElement("div", {
|
|
169
168
|
style: {
|
|
170
|
-
display:
|
|
171
|
-
justifyContent:
|
|
172
|
-
alignItems:
|
|
173
|
-
gap:
|
|
169
|
+
display: "flex",
|
|
170
|
+
justifyContent: "space-between",
|
|
171
|
+
alignItems: "center",
|
|
172
|
+
gap: ".75rem"
|
|
174
173
|
}
|
|
175
|
-
}, pagination && pagination.onChange && pagination?.position && pagination?.position[0] ===
|
|
174
|
+
}, pagination && pagination.onChange && pagination?.position && pagination?.position[0] === "topRight" && /*#__PURE__*/React.createElement(Pagination, _extends({
|
|
176
175
|
showSizeChanger: true,
|
|
177
176
|
responsive: true,
|
|
178
|
-
size:
|
|
179
|
-
rootClassName:
|
|
177
|
+
size: "small",
|
|
178
|
+
rootClassName: "top-pagination",
|
|
180
179
|
showTotal: (totalItems, range) =>
|
|
181
180
|
// @ts-ignore
|
|
182
|
-
`${range[0]}-${range[1]} / ${totalItems} ${t ? t(pagination?.locale?.items ??
|
|
183
|
-
}, pagination)), typeof actionTemplate ===
|
|
181
|
+
`${range[0]}-${range[1]} / ${totalItems} ${t ? t(pagination?.locale?.items ?? "items") : "items"}`
|
|
182
|
+
}, pagination)), typeof actionTemplate === "function" ? actionTemplate() : actionTemplate, showColumnChoose && /*#__PURE__*/React.createElement(ColumnsChoose, {
|
|
184
183
|
columnHidden: columnHidden,
|
|
185
184
|
columns: columns,
|
|
186
185
|
originColumns: propsColumns,
|
|
@@ -240,18 +239,18 @@ const TableContainer = props => {
|
|
|
240
239
|
}, pagination && !infiniteScroll && /*#__PURE__*/React.createElement(Pagination
|
|
241
240
|
// style={{padding: '0.75rem 1rem'}}
|
|
242
241
|
, _extends({}, pagination, {
|
|
243
|
-
rootClassName:
|
|
242
|
+
rootClassName: "pagination-template",
|
|
244
243
|
showSizeChanger: true,
|
|
245
244
|
responsive: true,
|
|
246
|
-
size:
|
|
245
|
+
size: "small",
|
|
247
246
|
total: pagination.total,
|
|
248
247
|
pageSize: pagination.onChange ? pagination.pageSize : table.getState().pagination.pageSize,
|
|
249
248
|
showTotal: (totalItems, range) => `${numericFormatter((range[0] ?? 0).toString(), {
|
|
250
|
-
thousandSeparator:
|
|
249
|
+
thousandSeparator: "."
|
|
251
250
|
})}-${numericFormatter((range[1] ?? 0).toString(), {
|
|
252
|
-
thousandSeparator:
|
|
251
|
+
thousandSeparator: "."
|
|
253
252
|
})} / ${numericFormatter((totalItems ?? 0).toString(), {
|
|
254
|
-
thousandSeparator:
|
|
253
|
+
thousandSeparator: "."
|
|
255
254
|
})} items`,
|
|
256
255
|
pageSizeOptions: [20, 50, 100, 1000, 10000],
|
|
257
256
|
onChange: (page, pageSize1) => {
|
|
@@ -2,7 +2,7 @@ import type { Dispatch, SetStateAction } from "react";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import type { ColumnDef, Table } from "@tanstack/react-table";
|
|
4
4
|
import type { ColumnsTable, TableProps } from "./type";
|
|
5
|
-
type TableContainerProps<T> = Omit<TableProps<T>,
|
|
5
|
+
type TableContainerProps<T> = Omit<TableProps<T>, "columns"> & {
|
|
6
6
|
table: Table<T>;
|
|
7
7
|
prefix: string;
|
|
8
8
|
id: string;
|