es-grid-template 1.8.75 → 1.8.77

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.
Files changed (136) hide show
  1. package/es/grid-component/type.d.ts +57 -38
  2. package/es/group-component/ColumnsGroup/ColumnsGroup.d.ts +2 -0
  3. package/es/group-component/ColumnsGroup/ColumnsGroup.js +6 -12
  4. package/es/group-component/InternalTable.d.ts +1 -1
  5. package/es/group-component/InternalTable.js +15 -3
  6. package/es/group-component/TableContainer.js +31 -20
  7. package/es/group-component/TableContainerEdit.js +59 -25
  8. package/es/group-component/body/EditableCell.js +30 -51
  9. package/es/group-component/body/TableBody.js +1 -1
  10. package/es/group-component/header/TableHeadCell.js +5 -4
  11. package/es/group-component/header/TableHeadCell2.js +15 -24
  12. package/es/group-component/header/renderFilter.d.ts +1 -0
  13. package/es/group-component/header/renderFilter.js +15 -21
  14. package/es/group-component/hook/utils.d.ts +8 -8
  15. package/es/group-component/table/Grid.js +2 -1
  16. package/es/locale/context.d.ts +7 -0
  17. package/es/locale/context.js +3 -0
  18. package/es/locale/de_DE.d.ts +3 -0
  19. package/es/locale/de_DE.js +156 -0
  20. package/es/locale/en_US.d.ts +3 -0
  21. package/es/locale/en_US.js +170 -0
  22. package/es/locale/index.d.ts +54 -0
  23. package/es/locale/index.js +33 -0
  24. package/es/locale/ja_JP.d.ts +3 -0
  25. package/es/locale/ja_JP.js +183 -0
  26. package/es/locale/useLocale.d.ts +157 -0
  27. package/es/locale/useLocale.js +69 -0
  28. package/es/locale/vi_VN.d.ts +3 -0
  29. package/es/locale/vi_VN.js +172 -0
  30. package/es/locale/zh_CN.d.ts +3 -0
  31. package/es/locale/zh_CN.js +171 -0
  32. package/es/locales/de_DE.d.ts +169 -0
  33. package/es/locales/de_DE.js +92 -0
  34. package/es/locales/en_GB.d.ts +169 -0
  35. package/es/locales/en_GB.js +92 -0
  36. package/es/locales/en_US.d.ts +153 -0
  37. package/es/locales/en_US.js +88 -0
  38. package/es/locales/index.d.ts +26 -0
  39. package/es/locales/index.js +5 -0
  40. package/es/locales/ja_JP.d.ts +169 -0
  41. package/es/locales/ja_JP.js +92 -0
  42. package/es/locales/vi_VN.d.ts +153 -0
  43. package/es/locales/vi_VN.js +88 -0
  44. package/es/locales/zh_CN.d.ts +153 -0
  45. package/es/locales/zh_CN.js +88 -0
  46. package/es/table-component/ColumnsChoose.d.ts +4 -1
  47. package/es/table-component/ColumnsChoose.js +10 -7
  48. package/es/table-component/InternalTable.js +18 -4
  49. package/es/table-component/TableContainer.js +16 -10
  50. package/es/table-component/TableContainerEdit.js +55 -21
  51. package/es/table-component/body/EditableCell.js +27 -83
  52. package/es/table-component/body/TableBody.js +1 -1
  53. package/es/table-component/body/TableBodyCellEdit.js +3 -5
  54. package/es/table-component/header/TableHeadCell.js +5 -6
  55. package/es/table-component/header/TableHeadCell2.js +16 -24
  56. package/es/table-component/header/renderFilter.d.ts +1 -0
  57. package/es/table-component/header/renderFilter.js +20 -18
  58. package/es/table-component/hook/utils.d.ts +2 -2
  59. package/es/table-component/hook/utils.js +15 -8
  60. package/es/table-component/style.scss +10 -1
  61. package/es/table-component/useContext.d.ts +1 -0
  62. package/es/table-virtuoso/InternalTable.js +14 -2
  63. package/es/table-virtuoso/header/TableHeadCell.js +3 -3
  64. package/es/table-virtuoso/header/renderFilter.js +2 -1
  65. package/es/table-virtuoso/style.js +1 -1
  66. package/es/table-virtuoso/table/TableContainer.js +11 -8
  67. package/lib/grid-component/type.d.ts +57 -38
  68. package/lib/group-component/ColumnsGroup/ColumnsGroup.d.ts +2 -0
  69. package/lib/group-component/ColumnsGroup/ColumnsGroup.js +5 -12
  70. package/lib/group-component/InternalTable.d.ts +1 -1
  71. package/lib/group-component/InternalTable.js +15 -3
  72. package/lib/group-component/TableContainer.js +32 -20
  73. package/lib/group-component/TableContainerEdit.js +60 -25
  74. package/lib/group-component/body/EditableCell.js +32 -54
  75. package/lib/group-component/body/TableBody.js +1 -1
  76. package/lib/group-component/header/TableHeadCell.js +5 -4
  77. package/lib/group-component/header/TableHeadCell2.js +15 -24
  78. package/lib/group-component/header/renderFilter.d.ts +1 -0
  79. package/lib/group-component/header/renderFilter.js +14 -20
  80. package/lib/group-component/table/Grid.js +3 -1
  81. package/lib/locale/context.d.ts +7 -0
  82. package/lib/locale/context.js +9 -0
  83. package/lib/locale/de_DE.d.ts +3 -0
  84. package/lib/locale/de_DE.js +163 -0
  85. package/lib/locale/en_US.d.ts +3 -0
  86. package/lib/locale/en_US.js +177 -0
  87. package/lib/locale/index.d.ts +54 -0
  88. package/lib/locale/index.js +41 -0
  89. package/lib/locale/ja_JP.d.ts +3 -0
  90. package/lib/locale/ja_JP.js +190 -0
  91. package/lib/locale/useLocale.d.ts +157 -0
  92. package/lib/locale/useLocale.js +79 -0
  93. package/lib/locale/vi_VN.d.ts +3 -0
  94. package/lib/locale/vi_VN.js +179 -0
  95. package/lib/locale/zh_CN.d.ts +3 -0
  96. package/lib/locale/zh_CN.js +178 -0
  97. package/lib/locales/de_DE.d.ts +169 -0
  98. package/lib/locales/de_DE.js +99 -0
  99. package/lib/locales/en_GB.d.ts +169 -0
  100. package/lib/locales/en_GB.js +99 -0
  101. package/lib/locales/en_US.d.ts +153 -0
  102. package/lib/locales/en_US.js +95 -0
  103. package/lib/locales/index.d.ts +26 -0
  104. package/lib/locales/index.js +41 -0
  105. package/lib/locales/ja_JP.d.ts +169 -0
  106. package/lib/locales/ja_JP.js +99 -0
  107. package/lib/locales/vi_VN.d.ts +153 -0
  108. package/lib/locales/vi_VN.js +95 -0
  109. package/lib/locales/zh_CN.d.ts +153 -0
  110. package/lib/locales/zh_CN.js +95 -0
  111. package/lib/table-component/ColumnsChoose.d.ts +4 -1
  112. package/lib/table-component/ColumnsChoose.js +9 -6
  113. package/lib/table-component/InternalTable.js +18 -4
  114. package/lib/table-component/TableContainer.js +16 -10
  115. package/lib/table-component/TableContainerEdit.js +54 -20
  116. package/lib/table-component/body/EditableCell.js +30 -87
  117. package/lib/table-component/body/TableBody.js +1 -1
  118. package/lib/table-component/body/TableBodyCellEdit.js +3 -5
  119. package/lib/table-component/header/TableHeadCell.js +5 -6
  120. package/lib/table-component/header/TableHeadCell2.js +16 -24
  121. package/lib/table-component/header/renderFilter.d.ts +1 -0
  122. package/lib/table-component/header/renderFilter.js +19 -17
  123. package/lib/table-component/hook/utils.d.ts +2 -2
  124. package/lib/table-component/hook/utils.js +15 -8
  125. package/lib/table-component/style.scss +10 -1
  126. package/lib/table-component/useContext.d.ts +1 -0
  127. package/lib/table-virtuoso/InternalTable.js +14 -2
  128. package/lib/table-virtuoso/header/TableHeadCell.js +3 -3
  129. package/lib/table-virtuoso/header/renderFilter.js +2 -1
  130. package/lib/table-virtuoso/style.js +1 -1
  131. package/lib/table-virtuoso/table/TableContainer.js +11 -8
  132. package/package.json +2 -2
  133. package/es/grid-component/styles.scss +0 -1438
  134. package/es/group-component/style.scss +0 -1438
  135. package/lib/grid-component/styles.scss +0 -1438
  136. package/lib/group-component/style.scss +0 -1438
@@ -5,6 +5,7 @@ import type { ReactElement, ReactNode } from 'react';
5
5
  import type { ColorPickerProps } from 'antd';
6
6
  import type { TableLocale } from "rc-master-ui/lib/table/interface";
7
7
  import type { IOperator } from '../grid-component/hooks';
8
+ import type { PaginationLocale } from 'rc-master-ui/lib/pagination/Pagination';
8
9
  declare module "@tanstack/table-core" {
9
10
  interface ColumnMeta<any, any> extends ColumnTable {
10
11
  rowSpan?: number;
@@ -28,8 +29,54 @@ export interface DensityOptions {
28
29
  onOperatorChange?: OnChangeFn<OpetorState>;
29
30
  }
30
31
  export type Key = React.Key;
31
- export type PaginationConfig = TablePaginationConfig & {
32
+ export type GridTableLocale = TableLocale & {
33
+ ok_btn?: string;
34
+ cancel_btn?: string;
35
+ add_rows?: string;
36
+ add_rows_before?: string;
37
+ add_rows_after?: string;
38
+ add_1?: string;
39
+ add_10?: string;
40
+ add_50?: string;
41
+ add_100?: string;
42
+ add_children?: string;
43
+ delete_content?: string;
44
+ delete_rows?: string;
45
+ custom?: string;
46
+ filterTitle?: string;
47
+ filterConfirm?: React.ReactNode;
48
+ filterReset?: React.ReactNode;
49
+ filterEmptyText?: React.ReactNode;
50
+ filterCheckall?: React.ReactNode;
51
+ filterSearchPlaceholder?: string;
52
+ emptyText?: React.ReactNode | (() => React.ReactNode);
53
+ selectAll?: React.ReactNode;
54
+ selectNone?: React.ReactNode;
55
+ selectInvert?: React.ReactNode;
56
+ selectionAll?: React.ReactNode;
57
+ sortTitle?: string;
58
+ expand?: string;
59
+ collapse?: string;
60
+ triggerDesc?: string;
61
+ triggerAsc?: string;
62
+ cancelSort?: string;
63
+ fullScreen?: string;
64
+ minimized?: string;
65
+ setting?: string;
66
+ groupData?: string;
67
+ textPlaceholder?: string;
68
+ selectPlaceholder?: string;
69
+ };
70
+ export type PagingLocale = PaginationLocale & {
71
+ items?: string;
72
+ };
73
+ export type Locale = {
74
+ table?: GridTableLocale;
75
+ pager?: PagingLocale;
76
+ };
77
+ export type PaginationConfig = Omit<TablePaginationConfig, 'locale'> & {
32
78
  currentPage?: number;
79
+ locale?: PagingLocale;
33
80
  };
34
81
  export type AnyObject = Record<PropertyKey, any>;
35
82
  export type IFormat = {
@@ -162,37 +209,6 @@ export type ColumnTable<RecordType = AnyObject> = {
162
209
  sumGroup?: boolean;
163
210
  onCell?: (rowData: RecordType, index: number) => React.TdHTMLAttributes<HTMLTableCellElement>;
164
211
  };
165
- export type Locale = TableLocale & {
166
- ok_btn?: string;
167
- cancel_btn?: string;
168
- add_rows?: string;
169
- add_rows_before?: string;
170
- add_rows_after?: string;
171
- add_1?: string;
172
- add_10?: string;
173
- add_50?: string;
174
- add_100?: string;
175
- add_children?: string;
176
- delete_content?: string;
177
- delete_rows?: string;
178
- custom?: string;
179
- filterTitle: string;
180
- filterConfirm: string;
181
- filterEmptyText: string;
182
- filterCheckall: string;
183
- filterSearchPlaceholder: string;
184
- emptyText: string;
185
- selectAll: string;
186
- selectInvert: string;
187
- selectNone: string;
188
- selectionAll: string;
189
- sortTitle: string;
190
- expand: string;
191
- collapse: string;
192
- triggerDesc: string;
193
- triggerAsc: string;
194
- cancelSort: string;
195
- };
196
212
  export type ColumnsTable<RecordType = AnyObject> = ColumnTable<RecordType>[];
197
213
  export type TableProps<RecordType = AnyObject> = {
198
214
  id?: string;
@@ -221,7 +237,9 @@ export type TableProps<RecordType = AnyObject> = {
221
237
  height?: number;
222
238
  minHeight?: number;
223
239
  format?: IFormat;
240
+ /** useTranslation 'react-i18next' */
224
241
  t?: any;
242
+ /** Language code: exp: vi || en || ja || zh .... */
225
243
  lang?: string;
226
244
  contextMenuItems?: ContextMenuItem[];
227
245
  showDefaultContext?: boolean;
@@ -240,6 +258,13 @@ export type TableProps<RecordType = AnyObject> = {
240
258
  predicate: 'and' | 'or';
241
259
  value: any;
242
260
  }[]) => void;
261
+ dataSourceFilter?: SourceFilter[];
262
+ onFilterClick?: (column: ColumnTable<RecordType>, callback: (key: string, data: any) => void) => void;
263
+ /** mặc định so sánh không dấu + lowercase
264
+ * ignoreAccents !== false => không khai báo hoặc ignoreAccents = true => so sánh không dấu
265
+ * ignoreAccents = false => so sánh có dấu + uperrcase sensitive
266
+ * **/
267
+ ignoreAccents?: boolean;
243
268
  allowSortering?: boolean;
244
269
  onSorter?: (args: Sorter[]) => void;
245
270
  selectionSettings?: SelectionSettings;
@@ -249,8 +274,6 @@ export type TableProps<RecordType = AnyObject> = {
249
274
  rowData: RecordType;
250
275
  selected: RecordType | RecordType[];
251
276
  }) => void;
252
- dataSourceFilter?: SourceFilter[];
253
- onFilterClick?: (column: ColumnTable<RecordType>, callback: (key: string, data: any) => void) => void;
254
277
  loading?: boolean;
255
278
  allowResizing?: boolean;
256
279
  showToolbar?: boolean;
@@ -324,10 +347,6 @@ export type IEditSelectSettings = {
324
347
  fieldLabel?: string;
325
348
  /** cho phép nhập giá trị - onBlur: giá trị search được set thành value **/
326
349
  searchTextAsValue?: boolean;
327
- /**
328
- * @deprecated Please use `allowSorter` instead.
329
- * @since 1.7.25
330
- */
331
350
  inputKey?: string;
332
351
  filterKey?: string[];
333
352
  selectMode?: SelectMode;
@@ -1,5 +1,7 @@
1
1
  import React from "react";
2
2
  type IColumnsGroup = {
3
+ id: string;
4
+ tableLocal?: any;
3
5
  columns: any[];
4
6
  dataSource?: string[];
5
7
  onSubmit: (value: any) => void;
@@ -1,13 +1,6 @@
1
1
  import { Group } from "becoxy-icons";
2
2
  import React, { useRef, useState } from "react";
3
- // import {
4
- // // groupArrayByColumns,
5
- // // ungroupArray,
6
- // // useOnClickOutside
7
- // } from "../../hooks"
8
-
9
- import { Button, Popover, Tooltip } from "antd";
10
- // import {SettingOutlined} from "@ant-design/icons";
3
+ import { Button, Popover } from "antd";
11
4
  import { Select } from "rc-master-ui";
12
5
  import styled from "styled-components";
13
6
  import { customFilterOption } from "../../grid-component/hooks";
@@ -17,6 +10,8 @@ const BoxAction = styled.div.withConfig({
17
10
  })(["padding-top:.75rem;display:flex;justify-content:end;gap:10px;.btn-action{background:none !important;border:none !important;&.btn-action-submit{color:#df4318;&:disabled{background-color:#f0f0f0 !important;}&:hover{color:#df4318 !important;}}&:hover{background-color:#f0f0f0 !important;}}"]);
18
11
  export const ColumnsGroup = props => {
19
12
  const {
13
+ id,
14
+ tableLocal,
20
15
  columns,
21
16
  columnsGrouped,
22
17
  onSubmit,
@@ -217,14 +212,13 @@ export const ColumnsGroup = props => {
217
212
  open: clicked,
218
213
  onOpenChange: handleClickChange,
219
214
  arrow: false
220
- }, /*#__PURE__*/React.createElement(Tooltip, {
221
- arrow: false,
222
- title: 'Nhóm dữ liệu'
223
215
  }, /*#__PURE__*/React.createElement(Group, {
216
+ "data-tooltip-id": `${id}-tooltip-content`,
217
+ "data-tooltip-content": tableLocal?.GroupData || 'Group Data',
224
218
  fontSize: 18,
225
219
  color: "#555555",
226
220
  style: {
227
221
  cursor: 'pointer'
228
222
  }
229
- }))));
223
+ })));
230
224
  };
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import 'react-resizable/css/styles.css';
3
3
  import 'dayjs/locale/es';
4
4
  import 'dayjs/locale/vi';
5
- import './style.scss';
5
+ import '../table-component';
6
6
  import type { TableProps } from './../grid-component/type';
7
7
  declare const InternalTable: <RecordType extends object>(props: TableProps<RecordType>) => React.JSX.Element;
8
8
  export default InternalTable;
@@ -5,7 +5,7 @@ import 'react-resizable/css/styles.css';
5
5
  import dayjs from 'dayjs';
6
6
  import 'dayjs/locale/es';
7
7
  import 'dayjs/locale/vi';
8
- import "./style.scss";
8
+ import "../table-component";
9
9
  import { faker } from '@faker-js/faker';
10
10
  import useMergedState from "rc-util/es/hooks/useMergedState";
11
11
  import Grid from "./table/Grid";
@@ -14,6 +14,8 @@ import { convertToTanStackColumns } from "./hook/useColumns";
14
14
  import { convertColumns } from "./hook/convert";
15
15
  import { removeInvisibleColumns } from "../grid-component/hooks";
16
16
  import { groupArrayByColumns } from "../table-virtuoso/hook/utils";
17
+ import { ConfigProvider, CustomProvider } from 'rc-master-ui';
18
+ import { getLocale, getLocales } from "../locale/useLocale";
17
19
  dayjs.extend(customParseFormat);
18
20
  const InternalTable = props => {
19
21
  const {
@@ -39,6 +41,12 @@ const InternalTable = props => {
39
41
  const id = React.useMemo(() => {
40
42
  return faker.string.alpha(20);
41
43
  }, []);
44
+ const language = React.useMemo(() => {
45
+ return getLocale(lang);
46
+ }, [lang]);
47
+ const languages = React.useMemo(() => {
48
+ return getLocales(lang);
49
+ }, [lang]);
42
50
  const {
43
51
  defaultExpandedRowKeys,
44
52
  defaultExpandAllRows
@@ -175,7 +183,11 @@ const InternalTable = props => {
175
183
  });
176
184
  }
177
185
  };
178
- return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(Grid, _extends({}, rest, {
186
+ return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(ConfigProvider, {
187
+ locale: language
188
+ }, /*#__PURE__*/React.createElement(CustomProvider, {
189
+ locale: languages
190
+ }, /*#__PURE__*/React.createElement(Grid, _extends({}, rest, {
179
191
  t: t,
180
192
  id: id,
181
193
  prefix: prefix
@@ -219,6 +231,6 @@ const InternalTable = props => {
219
231
  setColumns: setColumns,
220
232
  columnVisibility: columnVisibility,
221
233
  setColumnVisibility: setColumnVisibility
222
- })));
234
+ })))));
223
235
  };
224
236
  export default InternalTable;
@@ -5,13 +5,15 @@ import { TableContext } from "./useContext";
5
5
  import Pagination from 'rc-master-ui/es/pagination';
6
6
  import { Toolbar } from 'rc-master-ui';
7
7
  import { Collapse2, Expand2, Maximize, Minimize } from 'becoxy-icons';
8
- import { ColumnsChoose } from "./ColumnsChoose";
8
+ // import { ColumnsChoose } from './ColumnsChoose'
9
9
  import { numericFormatter } from 'react-numeric-component';
10
10
  import TableWrapper from "./table/TableWrapper";
11
11
  import { getTableHeight, sumSize, updateColumnWidthsRecursive } from "./hook/utils";
12
12
  import { useVirtualizer } from '@tanstack/react-virtual';
13
13
  import { convertToObjTrue, findAllChildrenKeys2, flatColumns2, isObjEmpty } from "../table-component/hook/utils";
14
14
  import { ColumnsGroup } from "./ColumnsGroup";
15
+ import { useLocale } from 'rc-master-ui/es/locale';
16
+ import { ColumnsChoose } from "../table-component/ColumnsChoose";
15
17
  const TableContainer = props => {
16
18
  const {
17
19
  t,
@@ -75,6 +77,8 @@ const TableContainer = props => {
75
77
  groupSetting,
76
78
  triggerGroupColumns
77
79
  } = props;
80
+ const [paginationLocal] = useLocale('Pagination');
81
+ const [tableLocal] = useLocale('Table');
78
82
  const tableContainerRef = React.useRef(null);
79
83
  const containerRef = React.useRef(null);
80
84
  const bottomToolbarRef = React.useRef(null);
@@ -198,26 +202,31 @@ const TableContainer = props => {
198
202
  style: {
199
203
  display: 'flex',
200
204
  gap: '10px',
201
- marginRight: 10
205
+ marginRight: 10,
206
+ outline: 'none'
202
207
  }
203
208
  }, groupSetting?.showGroupIcon !== false && /*#__PURE__*/React.createElement(ColumnsGroup, {
204
- t: t
205
- // defaultGroupColumns={['name']}
206
- ,
207
- unClearableLevel: groupSetting?.unClearableLevel
208
- // unClearableLevel={2}
209
- ,
209
+ t: t,
210
+ id: id,
211
+ tableLocal: tableLocal,
212
+ unClearableLevel: groupSetting?.unClearableLevel,
210
213
  columns: propsColumns ? flatColumns2(propsColumns) : [],
211
214
  columnsGrouped: groupColumns,
212
215
  onSubmit: handleOnGroup
213
216
  }), /*#__PURE__*/React.createElement(React.Fragment, null, !isObjEmpty(expanded) ? /*#__PURE__*/React.createElement(Collapse2, {
217
+ "data-tooltip-id": `${id}-tooltip-content`,
218
+ "data-tooltip-content": tableLocal?.collapseAll || 'Collapse all',
214
219
  fontSize: 16,
215
220
  color: '#555555',
216
- onClick: handleCollapseAllGroup
221
+ onClick: handleCollapseAllGroup,
222
+ className: "toolbar-icon"
217
223
  }) : /*#__PURE__*/React.createElement(Expand2, {
224
+ "data-tooltip-id": `${id}-tooltip-content`,
225
+ "data-tooltip-content": tableLocal?.expandAll || 'Expand all',
218
226
  fontSize: 16,
219
227
  color: '#555555',
220
- onClick: handleExpandAllGroup
228
+ onClick: handleExpandAllGroup,
229
+ className: "toolbar-icon"
221
230
  })));
222
231
  };
223
232
  return /*#__PURE__*/React.createElement("div", {
@@ -266,15 +275,19 @@ const TableContainer = props => {
266
275
  setIsFullScreen(!isFullScreen);
267
276
  },
268
277
  "data-tooltip-id": `${id}-tooltip-content`,
269
- "data-tooltip-content": t ? t('Minimized') : 'Minimized'
278
+ "data-tooltip-content": tableLocal?.Minimized || 'Minimized',
279
+ className: "toolbar-icon"
270
280
  }) : /*#__PURE__*/React.createElement(Maximize, {
271
281
  fontSize: 16,
272
282
  onClick: () => {
273
283
  setIsFullScreen(!isFullScreen);
274
284
  },
275
285
  "data-tooltip-id": `${id}-tooltip-content`,
276
- "data-tooltip-content": t ? t('Full screen') : 'Full screen'
286
+ "data-tooltip-content": tableLocal?.fullScreen || 'Full screen',
287
+ className: "toolbar-icon"
277
288
  })), showColumnChoose && /*#__PURE__*/React.createElement(ColumnsChoose, {
289
+ id: id,
290
+ tableLocal: tableLocal,
278
291
  columnHidden: columnHidden,
279
292
  columns: columns,
280
293
  originColumns: propsColumns,
@@ -342,14 +355,10 @@ const TableContainer = props => {
342
355
  fixedRightColumns: fixedRightColumns
343
356
  })), /*#__PURE__*/React.createElement("div", {
344
357
  ref: bottomToolbarRef
345
- }, pagination && !infiniteScroll && /*#__PURE__*/React.createElement(Pagination
346
- // style={{padding: '0.75rem 1rem'}}
347
- , _extends({
348
- pageSizeOptions: [20, 50, 100, 1000, 10000]
349
- }, pagination, {
358
+ }, pagination && !infiniteScroll && /*#__PURE__*/React.createElement(Pagination, _extends({
359
+ pageSizeOptions: [20, 50, 100, 1000, 10000],
350
360
  rootClassName: 'pagination-template',
351
361
  showSizeChanger: true,
352
- responsive: true,
353
362
  size: 'small',
354
363
  total: pagination.total,
355
364
  pageSize: pagination.onChange ? pagination.pageSize : table.getState().pagination.pageSize,
@@ -359,7 +368,8 @@ const TableContainer = props => {
359
368
  thousandSeparator: '.'
360
369
  })} / ${numericFormatter((totalItems ?? 0).toString(), {
361
370
  thousandSeparator: '.'
362
- })} items`,
371
+ })} ${pagination?.locale?.items || paginationLocal?.items || ''}`
372
+ }, pagination, {
363
373
  onChange: (page, pageSize1) => {
364
374
  if (pagination.onChange) {
365
375
  pagination.onChange(page, pageSize1);
@@ -369,7 +379,8 @@ const TableContainer = props => {
369
379
  table.setPageIndex(page - 1);
370
380
  table.setPageSize(pageSize1);
371
381
  }
372
- }
382
+ },
383
+ responsive: true
373
384
  }))));
374
385
  };
375
386
  export default TableContainer;
@@ -14,13 +14,15 @@ import { yupResolver } from "@hookform/resolvers/yup";
14
14
  import { Toolbar } from "rc-master-ui";
15
15
  import classNames from "classnames";
16
16
  import { Collapse2, Expand2, Maximize, Minimize } from "becoxy-icons";
17
- import { ColumnsChoose } from "./ColumnsChoose";
17
+ // import { ColumnsChoose } from "./ColumnsChoose";
18
18
  import TableWrapper from "./table/TableWrapper";
19
19
  import withReactContent from "sweetalert2-react-content";
20
20
  import Swal from "sweetalert2";
21
21
  import { convertToObjTrue, findAllChildrenKeys2, flatColumns2, isObjEmpty } from "../table-component/hook/utils";
22
22
  import { ColumnsGroup } from "./ColumnsGroup";
23
23
  import { unGroupData } from "../table-virtuoso/hook/utils";
24
+ import { useLocale } from "rc-master-ui/es/locale";
25
+ import { ColumnsChoose } from "../table-component/ColumnsChoose";
24
26
  const MySwal = withReactContent(Swal);
25
27
  const {
26
28
  Paragraph,
@@ -133,6 +135,8 @@ const TableContainerEdit = props => {
133
135
  dataSourceFilter,
134
136
  triggerGroupColumns
135
137
  } = props;
138
+ const [paginationLocal] = useLocale('Pagination');
139
+ const [tableLocal] = useLocale('Table');
136
140
  const containerRef = React.useRef(null);
137
141
  const bottomToolbarRef = React.useRef(null);
138
142
  const topToolbarRef = React.useRef(null);
@@ -1849,23 +1853,27 @@ const TableContainerEdit = props => {
1849
1853
  marginRight: 10
1850
1854
  }
1851
1855
  }, groupSetting?.showGroupIcon !== false && /*#__PURE__*/React.createElement(ColumnsGroup, {
1852
- t: t
1853
- // defaultGroupColumns={['name']}
1854
- ,
1855
- unClearableLevel: groupSetting?.unClearableLevel
1856
- // unClearableLevel={2}
1857
- ,
1856
+ id: id,
1857
+ tableLocal: tableLocal,
1858
+ t: t,
1859
+ unClearableLevel: groupSetting?.unClearableLevel,
1858
1860
  columns: propsColumns ? flatColumns2(propsColumns) : [],
1859
1861
  columnsGrouped: groupColumns,
1860
1862
  onSubmit: handleOnGroup
1861
1863
  }), /*#__PURE__*/React.createElement(React.Fragment, null, !isObjEmpty(expanded) ? /*#__PURE__*/React.createElement(Collapse2, {
1864
+ "data-tooltip-id": `${id}-tooltip-content`,
1865
+ "data-tooltip-content": tableLocal?.collapseAll || 'Collapse all',
1862
1866
  fontSize: 16,
1863
1867
  color: '#555555',
1864
- onClick: handleCollapseAllGroup
1868
+ onClick: handleCollapseAllGroup,
1869
+ className: "toolbar-icon"
1865
1870
  }) : /*#__PURE__*/React.createElement(Expand2, {
1871
+ "data-tooltip-id": `${id}-tooltip-content`,
1872
+ "data-tooltip-content": tableLocal?.expandAll || 'Expand all',
1866
1873
  fontSize: 16,
1867
1874
  color: '#555555',
1868
- onClick: handleExpandAllGroup
1875
+ onClick: handleExpandAllGroup,
1876
+ className: "toolbar-icon"
1869
1877
  })));
1870
1878
  };
1871
1879
  return /*#__PURE__*/React.createElement("div", {
@@ -1914,15 +1922,17 @@ const TableContainerEdit = props => {
1914
1922
  setIsFullScreen(!isFullScreen);
1915
1923
  },
1916
1924
  "data-tooltip-id": `${id}-tooltip-content`,
1917
- "data-tooltip-content": t ? t('Minimized') : 'Minimized'
1925
+ "data-tooltip-content": tableLocal?.Minimized || 'Minimized'
1918
1926
  }) : /*#__PURE__*/React.createElement(Maximize, {
1919
1927
  fontSize: 16,
1920
1928
  onClick: () => {
1921
1929
  setIsFullScreen(!isFullScreen);
1922
1930
  },
1923
1931
  "data-tooltip-id": `${id}-tooltip-content`,
1924
- "data-tooltip-content": t ? t('Full screen') : 'Full screen'
1932
+ "data-tooltip-content": tableLocal?.fullScreen || 'Full screen'
1925
1933
  })), showColumnChoose && /*#__PURE__*/React.createElement(ColumnsChoose, {
1934
+ id: id,
1935
+ tableLocal: tableLocal,
1926
1936
  columns: columns,
1927
1937
  originColumns: propsColumns,
1928
1938
  t: t,
@@ -2040,29 +2050,53 @@ const TableContainerEdit = props => {
2040
2050
  onClick: ({}) => {
2041
2051
  setEditingKey('');
2042
2052
  }
2043
- })), pagination && !infiniteScroll && /*#__PURE__*/React.createElement(Pagination, _extends({}, pagination, {
2053
+ })), pagination && !infiniteScroll &&
2054
+ /*#__PURE__*/
2055
+ // <Pagination
2056
+ // {...pagination}
2057
+ // rootClassName={'pagination-template'}
2058
+ // showSizeChanger={true}
2059
+ // responsive={true}
2060
+ // size={'small'}
2061
+ // total={pagination.total}
2062
+ // pageSize={pagination.onChange ? pagination?.pageSize : table.getState().pagination.pageSize}
2063
+ // pageSizeOptions={[20, 50, 100, 1000, 10000]}
2064
+ // onChange={(page, pageSize) => {
2065
+ // if (pagination.onChange) {
2066
+ // pagination.onChange(page, pageSize)
2067
+ // } else {
2068
+ // table.setPageIndex(page - 1)
2069
+ // table.setPageSize(pageSize)
2070
+ // }
2071
+ // }}
2072
+ // showTotal={(total: any, range: any) => `${numericFormatter((range[0] ?? 0).toString(), { thousandSeparator: '.' })}-${numericFormatter((range[1] ?? 0).toString(), { thousandSeparator: '.' })} / ${numericFormatter((total ?? 0).toString(), { thousandSeparator: '.' })} items`}
2073
+ // />
2074
+ React.createElement(Pagination, _extends({
2075
+ pageSizeOptions: [20, 50, 100, 1000, 10000],
2044
2076
  rootClassName: 'pagination-template',
2045
2077
  showSizeChanger: true,
2046
- responsive: true,
2047
2078
  size: 'small',
2048
2079
  total: pagination.total,
2049
- pageSize: pagination.onChange ? pagination?.pageSize : table.getState().pagination.pageSize,
2050
- pageSizeOptions: [20, 50, 100, 1000, 10000],
2051
- onChange: (page, pageSize) => {
2080
+ pageSize: pagination.onChange ? pagination.pageSize : table.getState().pagination.pageSize,
2081
+ showTotal: (totalItems, range) => `${numericFormatter((range[0] ?? 0).toString(), {
2082
+ thousandSeparator: '.'
2083
+ })}-${numericFormatter((range[1] ?? 0).toString(), {
2084
+ thousandSeparator: '.'
2085
+ })} / ${numericFormatter((totalItems ?? 0).toString(), {
2086
+ thousandSeparator: '.'
2087
+ })} ${pagination?.locale?.items || paginationLocal?.items || ''}`
2088
+ }, pagination, {
2089
+ onChange: (page, pageSize1) => {
2052
2090
  if (pagination.onChange) {
2053
- pagination.onChange(page, pageSize);
2091
+ pagination.onChange(page, pageSize1);
2092
+ table.setPageIndex(page - 1); // có thể bỏ dòng này
2093
+ table.setPageSize(pageSize1); // có thể bỏ dòng này
2054
2094
  } else {
2055
2095
  table.setPageIndex(page - 1);
2056
- table.setPageSize(pageSize);
2096
+ table.setPageSize(pageSize1);
2057
2097
  }
2058
2098
  },
2059
- showTotal: (total, range) => `${numericFormatter((range[0] ?? 0).toString(), {
2060
- thousandSeparator: '.'
2061
- })}-${numericFormatter((range[1] ?? 0).toString(), {
2062
- thousandSeparator: '.'
2063
- })} / ${numericFormatter((total ?? 0).toString(), {
2064
- thousandSeparator: '.'
2065
- })} items`
2099
+ responsive: true
2066
2100
  }))));
2067
2101
  };
2068
2102
  export default TableContainerEdit;