es-grid-template 1.7.38 → 1.7.39
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/CHANGELOG.md +6 -0
- package/LICENSE +21 -21
- package/README.md +1 -1
- package/es/grid-component/hooks/constant.js +6 -6
- package/es/grid-component/hooks/useColumns.d.ts +1 -3
- 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 +3 -2
- package/es/table-component/ContextMenu.js +2 -2
- package/es/table-component/InternalTable.d.ts +6 -6
- package/es/table-component/InternalTable.js +25 -134
- package/es/table-component/TableContainer.d.ts +5 -5
- package/es/table-component/TableContainer.js +32 -31
- package/es/table-component/TableContainerEdit.d.ts +1 -1
- package/es/table-component/TableContainerEdit.js +247 -228
- package/es/table-component/body/EditableCell.js +146 -147
- 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 +18 -37
- package/es/table-component/body/TableBodyCellEdit.d.ts +4 -4
- package/es/table-component/body/TableBodyCellEdit.js +64 -63
- package/es/table-component/body/TableBodyRow.js +1 -0
- package/es/table-component/footer/TableFooterCell.d.ts +3 -3
- package/es/table-component/footer/TableFooterCell.js +6 -8
- 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 +3 -2
- package/es/table-component/hook/utils.js +159 -202
- 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 +20 -23
- package/es/table-component/type.d.ts +40 -40
- package/es/table-component/useContext.d.ts +3 -4
- package/es/table-component/useContext.js +4 -4
- package/lib/grid-component/hooks/constant.js +6 -6
- package/lib/grid-component/hooks/useColumns.d.ts +1 -3
- 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 +3 -2
- package/lib/table-component/InternalTable.d.ts +6 -6
- package/lib/table-component/InternalTable.js +18 -125
- package/lib/table-component/TableContainer.d.ts +5 -5
- package/lib/table-component/TableContainer.js +26 -24
- package/lib/table-component/TableContainerEdit.d.ts +1 -1
- package/lib/table-component/TableContainerEdit.js +246 -227
- package/lib/table-component/body/EditableCell.js +145 -146
- 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 +17 -36
- package/lib/table-component/body/TableBodyCellEdit.d.ts +4 -4
- package/lib/table-component/body/TableBodyCellEdit.js +60 -59
- package/lib/table-component/body/TableBodyRow.js +1 -0
- package/lib/table-component/footer/TableFooterCell.d.ts +3 -3
- package/lib/table-component/footer/TableFooterCell.js +5 -7
- 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 +3 -2
- package/lib/table-component/hook/utils.js +159 -201
- 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 +20 -23
- package/lib/table-component/type.d.ts +40 -40
- package/lib/table-component/useContext.d.ts +3 -4
- package/lib/table-component/useContext.js +3 -3
- package/package.json +116 -116
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import type { ContextInfo
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { ContextInfo } from "./type";
|
|
3
|
+
import type { ContextMenuItem } from "./type";
|
|
3
4
|
export declare const findItemByKey: (array: any[], key: string, value: any) => any;
|
|
4
5
|
type Props<RecordType> = {
|
|
5
6
|
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,10 +20,11 @@ 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";
|
|
27
28
|
// import { Group } from 'becoxy-icons'
|
|
28
29
|
|
|
29
30
|
// import { Tooltip } from 'react-tooltip'
|
|
@@ -36,9 +37,7 @@ getAllRowKey, getDiffent2Array, getFixedFields, getInvisibleColumns, groupArrayB
|
|
|
36
37
|
// import GridEdit from './table/GridEdit'
|
|
37
38
|
import { convertToTanStackColumns } from "./hook/useColumns";
|
|
38
39
|
import { convertColumns } from "./hook/convert";
|
|
39
|
-
import { Modal } from
|
|
40
|
-
import Grid from "./table/Grid";
|
|
41
|
-
|
|
40
|
+
import { Modal } from 'antd';
|
|
42
41
|
// import { columns111 } from '../test-2/columns'
|
|
43
42
|
|
|
44
43
|
dayjs.extend(customParseFormat);
|
|
@@ -54,7 +53,7 @@ const InternalTable = props => {
|
|
|
54
53
|
t,
|
|
55
54
|
columns: propsColumns,
|
|
56
55
|
// columns,
|
|
57
|
-
|
|
56
|
+
lang,
|
|
58
57
|
locale,
|
|
59
58
|
dataSource,
|
|
60
59
|
editAble,
|
|
@@ -63,12 +62,6 @@ const InternalTable = props => {
|
|
|
63
62
|
groupSetting,
|
|
64
63
|
groupColumns,
|
|
65
64
|
selectionSettings,
|
|
66
|
-
// infiniteScroll,
|
|
67
|
-
// wrapSettings,
|
|
68
|
-
// onFilter,
|
|
69
|
-
// expandable,
|
|
70
|
-
// contextMenuItems: propContextMenuItems,
|
|
71
|
-
// contextMenuHidden,
|
|
72
65
|
// contextMenuClick,
|
|
73
66
|
// contextMenuOpen,
|
|
74
67
|
height,
|
|
@@ -77,8 +70,8 @@ const InternalTable = props => {
|
|
|
77
70
|
const id = React.useMemo(() => {
|
|
78
71
|
return faker.string.alpha(20);
|
|
79
72
|
}, []);
|
|
80
|
-
const rowKey =
|
|
81
|
-
const prefix =
|
|
73
|
+
const rowKey = 'rowId';
|
|
74
|
+
const prefix = 'ui-rc';
|
|
82
75
|
const getWindowSize = () => {
|
|
83
76
|
const {
|
|
84
77
|
innerWidth,
|
|
@@ -94,37 +87,11 @@ const InternalTable = props => {
|
|
|
94
87
|
const handleWindowResize = () => {
|
|
95
88
|
setWindowSize(getWindowSize());
|
|
96
89
|
};
|
|
97
|
-
window.addEventListener(
|
|
90
|
+
window.addEventListener('resize', handleWindowResize);
|
|
98
91
|
return () => {
|
|
99
|
-
window.removeEventListener(
|
|
92
|
+
window.removeEventListener('resize', handleWindowResize);
|
|
100
93
|
};
|
|
101
94
|
}, []);
|
|
102
|
-
|
|
103
|
-
// const local = lang && lang === 'en' ? en : vi
|
|
104
|
-
// const dateRangeLocale = lang && lang === 'en' ? enDr : viDr
|
|
105
|
-
|
|
106
|
-
// const buddhistLocale: PickerLocale = {
|
|
107
|
-
// ...local,
|
|
108
|
-
// lang: {
|
|
109
|
-
// ...local.lang
|
|
110
|
-
// }
|
|
111
|
-
// }
|
|
112
|
-
|
|
113
|
-
// const menuRef = React.useRef<any>(null)
|
|
114
|
-
// const viewportWidth = windowSize.innerWidth
|
|
115
|
-
// const viewportHeight = windowSize.innerHeight
|
|
116
|
-
|
|
117
|
-
// const [menuVisible, setMenuVisible] = React.useState(false)
|
|
118
|
-
// const [selectedRowData, setSelectedRowData] = React.useState<RecordType | null>(null)
|
|
119
|
-
// const [position, setPosition] = React.useState<{
|
|
120
|
-
// x: number | undefined
|
|
121
|
-
// y: number | undefined
|
|
122
|
-
// viewportWidth: number
|
|
123
|
-
// viewportHeight: number
|
|
124
|
-
// }>({ x: 0, y: 0, viewportWidth, viewportHeight })
|
|
125
|
-
|
|
126
|
-
// const [tooltipContent, setTooltipContent] = useState<any>('')
|
|
127
|
-
|
|
128
95
|
const [filterStates, setFilterState] = React.useState(null);
|
|
129
96
|
const [sorterStates, setSorterStates] = React.useState([]);
|
|
130
97
|
const [isFullScreen, setIsFullScreen] = React.useState(false);
|
|
@@ -157,8 +124,8 @@ const InternalTable = props => {
|
|
|
157
124
|
}, [dataSource]);
|
|
158
125
|
const columnPinning = React.useMemo(() => {
|
|
159
126
|
return {
|
|
160
|
-
left: getFixedFields(columns,
|
|
161
|
-
right: getFixedFields(columns,
|
|
127
|
+
left: getFixedFields(columns, 'left'),
|
|
128
|
+
right: getFixedFields(columns, 'right')
|
|
162
129
|
};
|
|
163
130
|
}, [columns]);
|
|
164
131
|
|
|
@@ -186,7 +153,7 @@ const InternalTable = props => {
|
|
|
186
153
|
value: undefined
|
|
187
154
|
});
|
|
188
155
|
const triggerChangeColumns = (cols, keys, type) => {
|
|
189
|
-
if (type ===
|
|
156
|
+
if (type === 'cellClick') {
|
|
190
157
|
setColumns(cols);
|
|
191
158
|
} else {
|
|
192
159
|
const aa = flatColumns2(columns).map(it => it.field);
|
|
@@ -194,81 +161,6 @@ const InternalTable = props => {
|
|
|
194
161
|
setColumnsHiddenKeys(rsss);
|
|
195
162
|
}
|
|
196
163
|
};
|
|
197
|
-
|
|
198
|
-
// const contextMenuItems = React.useMemo(() => {
|
|
199
|
-
// if (typeof contextMenuHidden === 'function' && propContextMenuItems && selectedRowData) {
|
|
200
|
-
// const hiddenItems = contextMenuHidden({
|
|
201
|
-
// rowInfo: {
|
|
202
|
-
// rowData: selectedRowData
|
|
203
|
-
// }
|
|
204
|
-
// })
|
|
205
|
-
|
|
206
|
-
// return propContextMenuItems.filter(item => !(hiddenItems as string[]).includes(item?.key as string))
|
|
207
|
-
// }
|
|
208
|
-
|
|
209
|
-
// if (contextMenuHidden && typeof contextMenuHidden !== 'function' && propContextMenuItems) {
|
|
210
|
-
// return propContextMenuItems.filter(item => !(contextMenuHidden as string[]).includes(item?.key as string))
|
|
211
|
-
// }
|
|
212
|
-
|
|
213
|
-
// return propContextMenuItems
|
|
214
|
-
// }, [propContextMenuItems, contextMenuHidden, selectedRowData])
|
|
215
|
-
|
|
216
|
-
// const onContextMenu = (data: RecordType) => (event: any) => {
|
|
217
|
-
// event.preventDefault() // Ngăn chặn menu mặc định của trình duyệt
|
|
218
|
-
|
|
219
|
-
// setSelectedRowData(data)
|
|
220
|
-
|
|
221
|
-
// contextMenuOpen?.({
|
|
222
|
-
// rowInfo: {
|
|
223
|
-
// rowData: data
|
|
224
|
-
// },
|
|
225
|
-
// event
|
|
226
|
-
// })
|
|
227
|
-
|
|
228
|
-
// setMenuVisible(true)
|
|
229
|
-
|
|
230
|
-
// // Đợi DOM cập nhật và lấy kích thước menu
|
|
231
|
-
// setTimeout(() => {
|
|
232
|
-
// const menuElement = menuRef.current // Lấy menu từ DOM
|
|
233
|
-
// const menuWidth = menuElement?.offsetWidth || 200 // Mặc định 200px nếu chưa render
|
|
234
|
-
// const menuHeight = menuElement?.offsetHeight // Mặc định 450px nếu chưa render
|
|
235
|
-
|
|
236
|
-
// // Điều chỉnh vị trí menu
|
|
237
|
-
// let x = event.clientX
|
|
238
|
-
// let y = event.clientY
|
|
239
|
-
|
|
240
|
-
// if (x + menuWidth > viewportWidth) {
|
|
241
|
-
// x = x - menuWidth - 10 // Cách cạnh phải 10px
|
|
242
|
-
// }
|
|
243
|
-
|
|
244
|
-
// if (y + menuHeight > viewportHeight) {
|
|
245
|
-
// if (y < menuHeight) {
|
|
246
|
-
// y = 10
|
|
247
|
-
// } else {
|
|
248
|
-
// y = y - 10 - menuHeight // Cách cạnh dưới 10px
|
|
249
|
-
// }
|
|
250
|
-
// }
|
|
251
|
-
|
|
252
|
-
// setPosition(prevState => ({ ...prevState, x, y }))
|
|
253
|
-
// }, 100)
|
|
254
|
-
|
|
255
|
-
// if (!menuVisible) {
|
|
256
|
-
// document.addEventListener(`click`, function onClickOutside(e) {
|
|
257
|
-
// const element: any = e.target
|
|
258
|
-
// const menuContainer = document.querySelector('.popup-context-menu')
|
|
259
|
-
|
|
260
|
-
// const isInsideContainer = element.closest('.popup-context-menu') && menuContainer
|
|
261
|
-
|
|
262
|
-
// if (isInsideContainer) {
|
|
263
|
-
// return
|
|
264
|
-
// }
|
|
265
|
-
// setMenuVisible(false)
|
|
266
|
-
// setPosition(prevState => ({ ...prevState, x: undefined, y: undefined }))
|
|
267
|
-
// document.removeEventListener(`click`, onClickOutside)
|
|
268
|
-
// })
|
|
269
|
-
// }
|
|
270
|
-
// }
|
|
271
|
-
|
|
272
164
|
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(Grid, _extends({}, rest, {
|
|
273
165
|
t: t,
|
|
274
166
|
id: id,
|
|
@@ -295,9 +187,7 @@ const InternalTable = props => {
|
|
|
295
187
|
// onContextMenu={onContextMenu}
|
|
296
188
|
// contextMenuItems={contextMenuItems}
|
|
297
189
|
,
|
|
298
|
-
editAble: isFullScreen ? false : editAble
|
|
299
|
-
// editAble={editAble}
|
|
300
|
-
,
|
|
190
|
+
editAble: isFullScreen ? false : editAble,
|
|
301
191
|
triggerChangeColumns: triggerChangeColumns,
|
|
302
192
|
setExpanded: setExpanded,
|
|
303
193
|
isFullScreen: isFullScreen,
|
|
@@ -312,27 +202,28 @@ const InternalTable = props => {
|
|
|
312
202
|
footer: null,
|
|
313
203
|
centered: true,
|
|
314
204
|
closable: true,
|
|
315
|
-
width:
|
|
205
|
+
width: '100%',
|
|
316
206
|
style: {
|
|
317
|
-
maxWidth:
|
|
318
|
-
height:
|
|
207
|
+
maxWidth: '100%',
|
|
208
|
+
height: '100%'
|
|
319
209
|
}
|
|
320
210
|
// onClose={() => setIsFullScreen(false)}
|
|
321
211
|
,
|
|
322
212
|
onCancel: () => setIsFullScreen(false)
|
|
213
|
+
|
|
323
214
|
// destroyOnClose
|
|
324
215
|
,
|
|
325
216
|
styles: {
|
|
326
217
|
content: {
|
|
327
|
-
height:
|
|
218
|
+
height: '100vh',
|
|
328
219
|
borderRadius: 0,
|
|
329
|
-
padding:
|
|
220
|
+
padding: '15px 10px'
|
|
330
221
|
},
|
|
331
222
|
wrapper: {
|
|
332
223
|
zIndex: 1050
|
|
333
224
|
}
|
|
334
225
|
},
|
|
335
|
-
|
|
226
|
+
destroyOnClose: true
|
|
336
227
|
}, /*#__PURE__*/React.createElement("div", {
|
|
337
228
|
style: {
|
|
338
229
|
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,25 +1,26 @@
|
|
|
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
|
|
19
|
+
import { numericFormatter } from 'react-numeric-component';
|
|
20
|
+
// import ComponentSpinner from '../grid-component/LoadingSpinner'
|
|
20
21
|
import TableWrapper from "./table/TableWrapper";
|
|
21
22
|
import { sumSize } from "./hook/utils";
|
|
22
|
-
import { useVirtualizer } from
|
|
23
|
+
import { useVirtualizer } from '@tanstack/react-virtual';
|
|
23
24
|
const TableContainer = props => {
|
|
24
25
|
const {
|
|
25
26
|
t,
|
|
@@ -100,7 +101,7 @@ const TableContainer = props => {
|
|
|
100
101
|
// return element?.getBoundingClientRect().width;
|
|
101
102
|
// },
|
|
102
103
|
|
|
103
|
-
measureElement: typeof window !==
|
|
104
|
+
measureElement: typeof window !== 'undefined' && navigator.userAgent.indexOf('Firefox') === -1 ? element => element?.getBoundingClientRect().height : undefined,
|
|
104
105
|
overscan: 1 //how many columns to render on each side off screen each way (adjust this for performance)
|
|
105
106
|
});
|
|
106
107
|
const virtualColumns = columnVirtualizer.getVirtualItems();
|
|
@@ -137,49 +138,49 @@ const TableContainer = props => {
|
|
|
137
138
|
className: classNames(`${prefix}-grid-top-toolbar`, {})
|
|
138
139
|
}, /*#__PURE__*/React.createElement("div", {
|
|
139
140
|
style: {
|
|
140
|
-
display:
|
|
141
|
-
justifyContent:
|
|
142
|
-
alignItems:
|
|
143
|
-
gap:
|
|
141
|
+
display: 'flex',
|
|
142
|
+
justifyContent: 'space-between',
|
|
143
|
+
alignItems: 'center',
|
|
144
|
+
gap: '.75rem'
|
|
144
145
|
}
|
|
145
146
|
}, toolbarItems && toolbarItems?.length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
146
147
|
style: {
|
|
147
148
|
flex: 1,
|
|
148
|
-
overflow:
|
|
149
|
+
overflow: 'hidden'
|
|
149
150
|
}
|
|
150
151
|
}, /*#__PURE__*/React.createElement(Toolbar, {
|
|
151
|
-
items: (toolbarItems ?? []).filter(it => it.position !==
|
|
152
|
-
mode:
|
|
152
|
+
items: (toolbarItems ?? []).filter(it => it.position !== 'Bottom'),
|
|
153
|
+
mode: 'scroll'
|
|
153
154
|
})), fullScreen !== false && (isFullScreen ? /*#__PURE__*/React.createElement(Minimize, {
|
|
154
155
|
fontSize: 16,
|
|
155
156
|
onClick: () => {
|
|
156
157
|
setIsFullScreen(!isFullScreen);
|
|
157
158
|
},
|
|
158
159
|
"data-tooltip-id": `${id}-tooltip-content`,
|
|
159
|
-
"data-tooltip-content": t ? t(
|
|
160
|
+
"data-tooltip-content": t ? t('Minimized') : 'Minimized'
|
|
160
161
|
}) : /*#__PURE__*/React.createElement(Maximize, {
|
|
161
162
|
fontSize: 16,
|
|
162
163
|
onClick: () => {
|
|
163
164
|
setIsFullScreen(!isFullScreen);
|
|
164
165
|
},
|
|
165
166
|
"data-tooltip-id": `${id}-tooltip-content`,
|
|
166
|
-
"data-tooltip-content": t ? t(
|
|
167
|
+
"data-tooltip-content": t ? t('Full screen') : 'Full screen'
|
|
167
168
|
})), /*#__PURE__*/React.createElement("div", {
|
|
168
169
|
style: {
|
|
169
|
-
display:
|
|
170
|
-
justifyContent:
|
|
171
|
-
alignItems:
|
|
172
|
-
gap:
|
|
170
|
+
display: 'flex',
|
|
171
|
+
justifyContent: 'space-between',
|
|
172
|
+
alignItems: 'center',
|
|
173
|
+
gap: '.75rem'
|
|
173
174
|
}
|
|
174
|
-
}, pagination && pagination.onChange && pagination?.position && pagination?.position[0] ===
|
|
175
|
+
}, pagination && pagination.onChange && pagination?.position && pagination?.position[0] === 'topRight' && /*#__PURE__*/React.createElement(Pagination, _extends({
|
|
175
176
|
showSizeChanger: true,
|
|
176
177
|
responsive: true,
|
|
177
|
-
size:
|
|
178
|
-
rootClassName:
|
|
178
|
+
size: 'small',
|
|
179
|
+
rootClassName: 'top-pagination',
|
|
179
180
|
showTotal: (totalItems, range) =>
|
|
180
181
|
// @ts-ignore
|
|
181
|
-
`${range[0]}-${range[1]} / ${totalItems} ${t ? t(pagination?.locale?.items ??
|
|
182
|
-
}, pagination)), typeof actionTemplate ===
|
|
182
|
+
`${range[0]}-${range[1]} / ${totalItems} ${t ? t(pagination?.locale?.items ?? 'items') : 'items'}`
|
|
183
|
+
}, pagination)), typeof actionTemplate === 'function' ? actionTemplate() : actionTemplate, showColumnChoose && /*#__PURE__*/React.createElement(ColumnsChoose, {
|
|
183
184
|
columnHidden: columnHidden,
|
|
184
185
|
columns: columns,
|
|
185
186
|
originColumns: propsColumns,
|
|
@@ -239,18 +240,18 @@ const TableContainer = props => {
|
|
|
239
240
|
}, pagination && !infiniteScroll && /*#__PURE__*/React.createElement(Pagination
|
|
240
241
|
// style={{padding: '0.75rem 1rem'}}
|
|
241
242
|
, _extends({}, pagination, {
|
|
242
|
-
rootClassName:
|
|
243
|
+
rootClassName: 'pagination-template',
|
|
243
244
|
showSizeChanger: true,
|
|
244
245
|
responsive: true,
|
|
245
|
-
size:
|
|
246
|
+
size: 'small',
|
|
246
247
|
total: pagination.total,
|
|
247
248
|
pageSize: pagination.onChange ? pagination.pageSize : table.getState().pagination.pageSize,
|
|
248
249
|
showTotal: (totalItems, range) => `${numericFormatter((range[0] ?? 0).toString(), {
|
|
249
|
-
thousandSeparator:
|
|
250
|
+
thousandSeparator: '.'
|
|
250
251
|
})}-${numericFormatter((range[1] ?? 0).toString(), {
|
|
251
|
-
thousandSeparator:
|
|
252
|
+
thousandSeparator: '.'
|
|
252
253
|
})} / ${numericFormatter((totalItems ?? 0).toString(), {
|
|
253
|
-
thousandSeparator:
|
|
254
|
+
thousandSeparator: '.'
|
|
254
255
|
})} items`,
|
|
255
256
|
pageSizeOptions: [20, 50, 100, 1000, 10000],
|
|
256
257
|
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;
|