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