es-grid-template 1.8.88 → 1.8.89

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 (95) hide show
  1. package/es/ali-table/Grid.d.ts +7 -1
  2. package/es/ali-table/Grid.js +11 -9
  3. package/es/ali-table/InternalTable.js +15 -5
  4. package/es/ali-table/pipeline/features/ColumnsChoose.js +2 -1
  5. package/es/ali-table/pipeline/features/columnCustom.d.ts +1 -0
  6. package/es/ali-table/pipeline/features/columnCustom.js +27 -13
  7. package/es/ali-table/pipeline/features/multiSelect.js +0 -3
  8. package/es/ali-table/pipeline/features/tips.js +1 -4
  9. package/es/ali-table/pipeline/features/treeSelect.js +2 -4
  10. package/es/ali-table/utils/convertColumnsChoose.d.ts +1 -1
  11. package/es/ali-table/utils/selected.js +1 -0
  12. package/es/ali-table/utils/smartCompare.js +7 -7
  13. package/es/grid-component/hooks/utils.d.ts +1 -1
  14. package/es/grid-component/type.d.ts +41 -31
  15. package/es/group-component/ColumnsChoose.d.ts +1 -0
  16. package/es/group-component/ColumnsChoose.js +6 -6
  17. package/es/group-component/TableContainerEdit.js +9 -4
  18. package/es/group-component/body/EditableCell.js +0 -2
  19. package/es/group-component/body/TableBodyCell.js +13 -13
  20. package/es/group-component/body/TableBodyCellEdit.js +14 -6
  21. package/es/group-component/body/TableBodyCellEmpty.js +0 -2
  22. package/es/group-component/body/TableBodyRowGroupCell.js +13 -13
  23. package/es/group-component/header/TableHead.js +0 -1
  24. package/es/group-component/header/TableHeadCell.js +4 -6
  25. package/es/group-component/header/TableHeadCell2.js +4 -6
  26. package/es/group-component/header/TableHeadGroupCell.js +6 -7
  27. package/es/group-component/hook/utils.d.ts +1 -1
  28. package/es/group-component/style.js +0 -1
  29. package/es/group-component/table/TableWrapper.js +8 -2
  30. package/es/table-component/TableContainerEdit.js +6 -2
  31. package/es/table-component/body/TableBodyCell.js +32 -15
  32. package/es/table-component/body/TableBodyCellEdit.js +14 -8
  33. package/es/table-component/header/TableHead.js +0 -33
  34. package/es/table-component/header/TableHeadCell.js +4 -6
  35. package/es/table-component/header/TableHeadCell2.js +10 -9
  36. package/es/table-component/header/TableHeadGroupCell.js +5 -6
  37. package/es/table-component/hook/utils.d.ts +1 -1
  38. package/es/table-component/table/Grid.js +1 -1
  39. package/es/table-component/table/TableWrapper.js +8 -2
  40. package/es/table-virtuoso/ColumnsGroup/ColumnsGroup.d.ts +1 -0
  41. package/es/table-virtuoso/ColumnsGroup/ColumnsGroup.js +7 -7
  42. package/es/table-virtuoso/body/TableBodyCell.js +15 -9
  43. package/es/table-virtuoso/body/TableBodyCellRowGroup.js +2 -5
  44. package/es/table-virtuoso/header/TableHeadCell.js +4 -6
  45. package/es/table-virtuoso/hook/utils.d.ts +1 -1
  46. package/es/table-virtuoso/table/TableContainer.js +2 -1
  47. package/es/table-virtuoso/table/TableWrapper.js +8 -2
  48. package/lib/ali-table/Grid.d.ts +7 -1
  49. package/lib/ali-table/Grid.js +11 -10
  50. package/lib/ali-table/InternalTable.js +15 -5
  51. package/lib/ali-table/pipeline/features/ColumnsChoose.js +6 -5
  52. package/lib/ali-table/pipeline/features/columnCustom.d.ts +1 -0
  53. package/lib/ali-table/pipeline/features/columnCustom.js +26 -12
  54. package/lib/ali-table/pipeline/features/multiSelect.js +0 -3
  55. package/lib/ali-table/pipeline/features/tips.js +1 -4
  56. package/lib/ali-table/pipeline/features/treeSelect.js +2 -4
  57. package/lib/ali-table/utils/convertColumnsChoose.d.ts +1 -1
  58. package/lib/ali-table/utils/selected.js +1 -0
  59. package/lib/ali-table/utils/smartCompare.js +7 -7
  60. package/lib/grid-component/hooks/utils.d.ts +1 -1
  61. package/lib/grid-component/type.d.ts +41 -31
  62. package/lib/group-component/ColumnsChoose.d.ts +1 -0
  63. package/lib/group-component/ColumnsChoose.js +5 -5
  64. package/lib/group-component/TableContainerEdit.js +17 -12
  65. package/lib/group-component/body/EditableCell.js +0 -2
  66. package/lib/group-component/body/TableBodyCell.js +13 -13
  67. package/lib/group-component/body/TableBodyCellEdit.js +14 -6
  68. package/lib/group-component/body/TableBodyCellEmpty.js +0 -2
  69. package/lib/group-component/body/TableBodyRowGroupCell.js +13 -13
  70. package/lib/group-component/header/TableHead.js +0 -1
  71. package/lib/group-component/header/TableHeadCell.js +4 -6
  72. package/lib/group-component/header/TableHeadCell2.js +4 -6
  73. package/lib/group-component/header/TableHeadGroupCell.js +6 -7
  74. package/lib/group-component/hook/utils.d.ts +1 -1
  75. package/lib/group-component/style.js +0 -1
  76. package/lib/group-component/table/TableWrapper.js +8 -2
  77. package/lib/table-component/TableContainerEdit.js +6 -2
  78. package/lib/table-component/body/TableBodyCell.js +31 -14
  79. package/lib/table-component/body/TableBodyCellEdit.js +13 -7
  80. package/lib/table-component/header/TableHead.js +0 -33
  81. package/lib/table-component/header/TableHeadCell.js +4 -6
  82. package/lib/table-component/header/TableHeadCell2.js +10 -9
  83. package/lib/table-component/header/TableHeadGroupCell.js +5 -6
  84. package/lib/table-component/hook/utils.d.ts +1 -1
  85. package/lib/table-component/table/Grid.js +1 -1
  86. package/lib/table-component/table/TableWrapper.js +8 -2
  87. package/lib/table-virtuoso/ColumnsGroup/ColumnsGroup.d.ts +1 -0
  88. package/lib/table-virtuoso/ColumnsGroup/ColumnsGroup.js +6 -6
  89. package/lib/table-virtuoso/body/TableBodyCell.js +14 -8
  90. package/lib/table-virtuoso/body/TableBodyCellRowGroup.js +2 -5
  91. package/lib/table-virtuoso/header/TableHeadCell.js +4 -6
  92. package/lib/table-virtuoso/hook/utils.d.ts +1 -1
  93. package/lib/table-virtuoso/table/TableContainer.js +2 -1
  94. package/lib/table-virtuoso/table/TableWrapper.js +8 -2
  95. package/package.json +1 -1
@@ -4,12 +4,18 @@ import React from "react";
4
4
  import './base-table/styles.scss';
5
5
  import type { TableProps } from "../table-component";
6
6
  import type { BaseTable } from "./base-table/table";
7
- declare const Grid: React.ForwardRefExoticComponent<TableProps & {
7
+ import type { VirtualEnum } from "./base-table/interfaces";
8
+ declare const Grid: React.ForwardRefExoticComponent<Omit<TableProps, "useVirtual"> & {
8
9
  isFullScreen: boolean;
9
10
  setIsFullScreen: Dispatch<SetStateAction<boolean>>;
10
11
  pipeline: TablePipeline;
11
12
  originData: any[];
12
13
  originColumns: any[];
13
14
  setVisibleKeys: Dispatch<SetStateAction<any>>;
15
+ useVirtual?: VirtualEnum | {
16
+ horizontal?: VirtualEnum;
17
+ vertical?: VirtualEnum;
18
+ header?: VirtualEnum;
19
+ };
14
20
  } & React.RefAttributes<BaseTable>>;
15
21
  export default Grid;
@@ -3,7 +3,6 @@ import { WebsiteBaseTable } from "./assets/WebsiteBaseTable";
3
3
  import { useLocale } from "rc-master-ui/es/locale";
4
4
  import React, { useContext } from "react";
5
5
  import { Tooltip } from "react-tooltip";
6
- // @ts-ignore
7
6
  import "./base-table/styles.scss";
8
7
  import { Toolbar } from 'rc-master-ui';
9
8
  import classNames from "classnames";
@@ -50,7 +49,8 @@ const Grid = /*#__PURE__*/React.forwardRef((props, ref) => {
50
49
  groupColumns,
51
50
  setVisibleKeys,
52
51
  footerDataSource,
53
- loading
52
+ loading,
53
+ useVirtual
54
54
 
55
55
  // onRowFooterStyles,
56
56
  // onRowHeaderStyles
@@ -216,11 +216,7 @@ const Grid = /*#__PURE__*/React.forwardRef((props, ref) => {
216
216
  id: id,
217
217
  commandClick: commandClick,
218
218
  isLoading: loading,
219
- useVirtual: {
220
- header: false,
221
- vertical: true,
222
- horizontal: true
223
- },
219
+ useVirtual: useVirtual,
224
220
  hasStickyScroll: true,
225
221
  isStickyFooter: true,
226
222
  isStickyHeader: true,
@@ -309,9 +305,15 @@ const Grid = /*#__PURE__*/React.forwardRef((props, ref) => {
309
305
  id: `${id}-tooltip-content`,
310
306
  style: {
311
307
  zIndex: 1999,
312
- maxWidth: 450
308
+ maxWidth: 450,
309
+ whiteSpace: 'normal',
310
+ wordWrap: 'break-word'
313
311
  },
314
- delayShow: 100
312
+ delayShow: 100,
313
+ render: ({
314
+ content,
315
+ activeAnchor
316
+ }) => activeAnchor?.getAttribute('data-tooltip-sort') || content
315
317
  }), /*#__PURE__*/React.createElement(Tooltip, {
316
318
  id: `${id}-tooltip-error`,
317
319
  style: {
@@ -7,14 +7,11 @@ import React from "react";
7
7
  import "./base-table/styles.scss";
8
8
  import { addRowIdArray, filterDataByColumns, groupArrayByColumns, isTreeArray, sortByType, sumFields } from "../table-component/hook/utils";
9
9
  import { CustomProvider, ConfigProvider } from 'rc-master-ui';
10
+ import { Modal } from 'antd';
10
11
  import { getLocale, getLocales } from "../locale/useLocale";
11
12
  import { TableContext } from "./useContext";
12
13
  import Grid from "./Grid";
13
- import { Modal } from "antd";
14
14
  import { getParentKeysLarge, getRowsByKeysKeepTreeOrder } from "./utils/selected";
15
- // import { collectNodes } from "./utils"
16
- // import { filterColumnsByField } from "./utils/convertColumnsChoose"
17
-
18
15
  const InternalTable = props => {
19
16
  const {
20
17
  t,
@@ -39,6 +36,7 @@ const InternalTable = props => {
39
36
  onSorter,
40
37
  footerDataSource,
41
38
  summary,
39
+ useVirtual,
42
40
  ...rest
43
41
  } = props;
44
42
  const prefix = 'ui-rc';
@@ -119,7 +117,8 @@ const InternalTable = props => {
119
117
  columns
120
118
  }).primaryKey(rowKey)
121
119
  // .mapDataSource((dta) => collectNodes(dta, 'pre'))
122
- .snapshot('flat').use(features.hiddenColumns({
120
+ // .snapshot('flat')
121
+ .use(features.hiddenColumns({
123
122
  columns,
124
123
  visibleKeys
125
124
  })).use(features.treeSelect({
@@ -177,6 +176,7 @@ const InternalTable = props => {
177
176
  ignoreAccents,
178
177
  currentPage: pagination ? pagination?.currentPage : undefined,
179
178
  pageSize: pagination ? pagination?.pageSize : undefined,
179
+ isDataTree,
180
180
  onFilter(val) {
181
181
  // const rs =
182
182
 
@@ -218,6 +218,11 @@ const InternalTable = props => {
218
218
  }
219
219
  }, /*#__PURE__*/React.createElement(Grid, _extends({}, rest, {
220
220
  id: id,
221
+ useVirtual: {
222
+ header: false,
223
+ horizontal: useVirtual?.horizontal ?? true,
224
+ vertical: useVirtual?.vertical ?? true
225
+ },
221
226
  isFullScreen: isFullScreen,
222
227
  pagination: pagination,
223
228
  setIsFullScreen: setIsFullScreen,
@@ -259,6 +264,11 @@ const InternalTable = props => {
259
264
  style: {}
260
265
  }, /*#__PURE__*/React.createElement(Grid, _extends({}, rest, {
261
266
  id: id,
267
+ useVirtual: {
268
+ header: false,
269
+ horizontal: useVirtual?.horizontal ?? true,
270
+ vertical: useVirtual?.vertical ?? true
271
+ },
262
272
  isFullScreen: isFullScreen,
263
273
  setIsFullScreen: setIsFullScreen,
264
274
  pipeline: pipeline,
@@ -1,12 +1,13 @@
1
1
  import useMergedState from "rc-util/es/hooks/useMergedState";
2
2
  import React, { Fragment, useState } from "react";
3
3
  import styled from "styled-components";
4
- import { Button, Input, Popover } from "antd";
5
4
  import Tree from "rc-master-ui/es/tree";
6
5
  import SearchOutlined from "@ant-design/icons/SearchOutlined";
7
6
  import { Settings } from "becoxy-icons";
8
7
  import { updateColumns1 } from "../../../table-component/hook/utils";
9
8
  import { convertColumnsToTreeData, filterColumnsByField } from "../../utils/convertColumnsChoose";
9
+ import { Input, Popover } from "rc-master-ui";
10
+ import Button from "rc-master-ui/es/button";
10
11
  const CustomStyle = styled.div.withConfig({
11
12
  displayName: "CustomStyle",
12
13
  componentId: "es-grid-template__sc-1yz2fsm-0"
@@ -5,6 +5,7 @@ import type { FilterItem, IFormat, IWrapSettings, Sorter, SourceFilter } from '.
5
5
  export interface ColumnFeatureOptions {
6
6
  id: any;
7
7
  columns: any[];
8
+ isDataTree?: boolean;
8
9
  dataSource: any[];
9
10
  /** Uncontrolled usage: default column widths array */
10
11
  defaultSizes?: number[];
@@ -3,13 +3,13 @@ import { internals } from "../../internals";
3
3
  import { collectNodes, makeRecursiveMapper, mergeCellProps } from "../../utils";
4
4
  import Resizer from "../../base-table/ColumnResizer";
5
5
  import { ArrowDown, ArrowUp, FilterFill, SortCancel } from 'becoxy-icons';
6
- import { booleanOperator, findItemPath, nonActionColumn, numberOperator, stringOperator, translateOption, updateArrayByKey } from "../../../grid-component/hooks";
6
+ import { booleanOperator, findItemPath, nonActionColumn, numberOperator, pageSizeOptions, stringOperator, translateOption, updateArrayByKey } from "../../../grid-component/hooks";
7
7
  import classNames from 'classnames';
8
8
  import { Button } from 'antd';
9
9
  import { Dropdown, Select, Space } from 'rc-master-ui';
10
10
  import { convertFilters, extendsObject, getDefaultOperator, getTypeFilter } from "../../../table-component/hook/utils";
11
11
  import { renderFilter } from "../../base-table/renderFilter";
12
- import ReactDOMServer from 'react-dom/server';
12
+ import { renderValueCell } from "../../../table-component/hook/useColumns";
13
13
  function clamp(min, x, max) {
14
14
  return Math.max(min, Math.min(max, x));
15
15
  }
@@ -19,6 +19,7 @@ export function columnCustom(opts) {
19
19
  const stateKeySorter = 'columnsSorter';
20
20
  const stateKeyVisible = 'visible';
21
21
  const stateKeyTooltip = 'tooltip';
22
+ const stateKey = 'pagination';
22
23
  const stateKeyColumnFilter = 'columnFilter';
23
24
 
24
25
  // const disableUserSelectWhenResizing = opts.disableUserSelectWhenResizing ?? true
@@ -40,8 +41,9 @@ export function columnCustom(opts) {
40
41
  wrapSettings,
41
42
  // ignoreAccents,
42
43
  dataSource,
43
- currentPage,
44
- pageSize
44
+ isDataTree
45
+ // currentPage = 1,
46
+ // pageSize
45
47
  } = opts;
46
48
  const {
47
49
  orders = ['descend', 'ascend', 'none'],
@@ -53,6 +55,8 @@ export function columnCustom(opts) {
53
55
  const filterState = pipeline.getStateAtKey(stateKeyFilter) ?? [];
54
56
  const visible = pipeline.getStateAtKey(stateKeyVisible) ?? '';
55
57
  const isOpenTooltip = pipeline.getStateAtKey(stateKeyTooltip) ?? false;
58
+ const pageSize = opts?.pageSize ?? pipeline.getStateAtKey(stateKey)?.pageSize ?? pageSizeOptions[0];
59
+ const currentPage = opts?.currentPage ?? pipeline.getStateAtKey(stateKey)?.currentPage ?? 1;
56
60
 
57
61
  // const data = pipeline.getDataSource()
58
62
 
@@ -233,7 +237,8 @@ export function columnCustom(opts) {
233
237
  endIndex
234
238
  }) => {
235
239
  const prevTitle = internals.safeRenderHeader(col);
236
- const prevTitleContent = internals.safeRenderHeaderContent(col, t);
240
+
241
+ // const prevTitleContent = internals.safeRenderHeaderContent(col, t)
237
242
 
238
243
  // col: flat columns tính cả column cha
239
244
 
@@ -391,13 +396,18 @@ export function columnCustom(opts) {
391
396
  })),
392
397
  template: args => {
393
398
  const {
399
+ index,
394
400
  rowData
395
401
  } = args;
402
+ const a = currentPage && pageSize ? (currentPage - 1) * pageSize + index + 1 : index + 1;
403
+ const b = () => {
404
+ return findItemPath(dataSource, rowData, 'rowId', currentPage, pageSize);
405
+ };
396
406
  return /*#__PURE__*/React.createElement("div", {
397
407
  style: {
398
408
  display: 'flex'
399
409
  }
400
- }, prevContent?.(args), /*#__PURE__*/React.createElement("span", null, findItemPath(dataSource, rowData, 'rowId', currentPage, pageSize)));
410
+ }, prevContent?.(args), /*#__PURE__*/React.createElement("span", null, isDataTree ? b() : a));
401
411
  },
402
412
  headerCellProps: mergeCellProps(col.headerCellProps ?? {}, {
403
413
  style: {
@@ -433,8 +443,8 @@ export function columnCustom(opts) {
433
443
  };
434
444
  }
435
445
  const prevGetCellProps = col?.getCellProps;
436
- const headerCustomTooltip = col.headerTooltip;
437
- const htmlTooltip = ReactDOMServer.renderToStaticMarkup( /*#__PURE__*/React.createElement(React.Fragment, null, headerCustomTooltip ?? prevTitleContent));
446
+ const headerCustomTooltip = col.headerTooltip ?? (t ? t(col.headerText) : col.headerText);
447
+ const htmlTooltip = headerCustomTooltip;
438
448
  const hasValue = htmlTooltip.trim().length > 0;
439
449
 
440
450
  // Cell thường có thể filter và sort được
@@ -476,16 +486,19 @@ export function columnCustom(opts) {
476
486
  color: '#000',
477
487
  className: "toolbar-icon",
478
488
  "data-tooltip-id": `${id}-tooltip-content`,
479
- "data-tooltip-content": locale?.table?.cancelSort ?? tableLocal?.cancelSort
489
+ "data-tooltip-content": locale?.table?.cancelSort ?? tableLocal?.cancelSort,
490
+ "data-tooltip-sort": locale?.table?.cancelSort ?? tableLocal?.cancelSort
480
491
  }) : /*#__PURE__*/React.createElement(ArrowUp, {
481
492
  fontSize: 14,
482
493
  color: '#000',
483
494
  className: "toolbar-icon",
484
495
  "data-tooltip-id": `${id}-tooltip-content`,
485
- "data-tooltip-content": locale?.table?.triggerAsc ?? tableLocal?.triggerAsc
496
+ "data-tooltip-content": locale?.table?.triggerAsc ?? tableLocal?.triggerAsc,
497
+ "data-tooltip-sort": locale?.table?.triggerAsc ?? tableLocal?.triggerAsc
486
498
  }) : /*#__PURE__*/React.createElement(SortCancel, {
487
499
  "data-tooltip-id": `${id}-tooltip-content`,
488
500
  "data-tooltip-content": locale?.table?.triggerDesc ?? tableLocal?.triggerDesc,
501
+ "data-tooltip-sort": locale?.table?.triggerDesc ?? tableLocal?.triggerDesc,
489
502
  fontSize: 15,
490
503
  style: {
491
504
  display: 'flex'
@@ -505,7 +518,7 @@ export function columnCustom(opts) {
505
518
  })),
506
519
  headerCellProps: mergeCellProps(col.headerCellProps ?? {}, {
507
520
  'data-tooltip-id': `${id}-tooltip-content`,
508
- 'data-tooltip-html': !hasValue ? '' : htmlTooltip,
521
+ 'data-tooltip-content': !hasValue ? '' : htmlTooltip,
509
522
  style: {
510
523
  overflow: 'visible',
511
524
  position: 'relative'
@@ -514,15 +527,16 @@ export function columnCustom(opts) {
514
527
  getCellProps(value, record, rowIndex) {
515
528
  const prevCellProps = prevGetCellProps?.(value, record, rowIndex);
516
529
  const cellStyles = typeof col.onCellStyles === 'function' ? col.onCellStyles(value, col) : col.onCellStyles;
530
+ const fomatedValue = ['color', 'checkbox', 'field'].includes(col.type ?? '') ? '' : renderValueCell(col, value, record, rowIndex, 0, format, false);
517
531
  const tooltipContent = isOpenTooltip === false ? '' : col?.tooltipDescription ? typeof col.tooltipDescription === 'function' ? col.tooltipDescription({
518
532
  value,
519
533
  rowData: record
520
- }) : col.tooltipDescription : col.template && typeof col.template !== 'function' ? col.template : value;
534
+ }) : col.tooltipDescription : fomatedValue;
521
535
  return mergeCellProps(prevCellProps, {
522
536
  // @ts-ignore
523
537
  'data-col-key': col.field,
524
538
  'data-tooltip-id': `${id}-tooltip-content`,
525
- 'data-tooltip-html': ReactDOMServer.renderToStaticMarkup( /*#__PURE__*/React.createElement(React.Fragment, null, tooltipContent)),
539
+ 'data-tooltip-content': tooltipContent,
526
540
  style: {
527
541
  ...prevCellProps?.style,
528
542
  ...cellStyles
@@ -90,9 +90,6 @@ export function multiSelect(opts = {}) {
90
90
  checked: checked,
91
91
  disabled: isDisabled(row, rowIndex),
92
92
  onChange: clickArea === 'checkbox' ? (arg1, arg2) => {
93
- // Need to support both antd and fusion APIs
94
- // fusion: arg2?.nativeEvent
95
- // antd: arg1.nativeEvent
96
93
  const nativeEvent = arg2?.nativeEvent ?? arg1.nativeEvent;
97
94
  if (nativeEvent) {
98
95
  if (opts.stopClickEventPropagation) {
@@ -35,10 +35,7 @@ export function tips() {
35
35
  }, /*#__PURE__*/React.createElement(icons.Info, {
36
36
  className: "tip-icon"
37
37
  }))
38
- }, col.features.tips) :
39
- /*#__PURE__*/
40
- // antd
41
- React.createElement(Tooltip, {
38
+ }, col.features.tips) : /*#__PURE__*/React.createElement(Tooltip, {
42
39
  title: col.features.tips
43
40
  }, /*#__PURE__*/React.createElement("div", {
44
41
  className: "tip-icon-wrapper"
@@ -109,12 +109,10 @@ export function treeSelect(opts) {
109
109
 
110
110
  if (!isChecked) {
111
111
  if (checkedStrategy === 'parent') {
112
-
113
112
  // const nextValue = treeDataHelper.getValueAfterToggle('root')
114
113
 
115
- // pipeline.setStateAtKey(STATE_KEY, new Set(enabledParentKeys))
116
-
117
- // opts.onChange?.(enabledParentKeys, undefined, 'all')
114
+ pipeline.setStateAtKey(STATE_KEY, new Set(enabledParentKeys));
115
+ opts.onChange?.(enabledParentKeys, undefined, 'all');
118
116
  } else {
119
117
  const nextValue = getAllEnabledKeys(tree, primaryKey, isDisabled);
120
118
  pipeline.setStateAtKey(STATE_KEY, nextValue);
@@ -1,4 +1,4 @@
1
- import type { TreeDataNode } from "antd";
1
+ import { TreeDataNode } from "antd";
2
2
  import type { ColumnTable } from "../../table-component";
3
3
  export declare function convertColumnsToTreeData(columns: ColumnTable[], groupColumns?: string[], t?: any): TreeDataNode[];
4
4
  export declare function filterColumnsByField(columns: ColumnTable[], fieldList: string[]): ColumnTable[];
@@ -402,6 +402,7 @@ export function isRowChecked(key, selectedKeys, treeIndex, checkedStrategy, isDi
402
402
  // =========================
403
403
  if (checkedStrategy === 'parent') {
404
404
  // node disable => chỉ true nếu explicit chọn
405
+ // console.log('isDisabled', isDisabled)
405
406
  if (isDisabled) {
406
407
  const abc = selectedKeys.has(key);
407
408
  return abc;
@@ -1,10 +1,10 @@
1
- /** 比较函数,支持字符串、数字、数组和 null。
2
- * * 对于字符串将比较两者的字典序;
3
- * * 对数字将比较两者大小;
4
- * * null 值在比较时总是小于另一个值;
5
- * * 对于数组来说,将逐个比较数组中的元素,第一个不相等的比较结果将作为整个数组的比较结果
6
- *
7
- * 数组的比较可参考 python 中的元祖比较:
1
+ /** 比较函数,支持字符串、数字、数组和 null。
2
+ * * 对于字符串将比较两者的字典序;
3
+ * * 对数字将比较两者大小;
4
+ * * null 值在比较时总是小于另一个值;
5
+ * * 对于数组来说,将逐个比较数组中的元素,第一个不相等的比较结果将作为整个数组的比较结果
6
+ *
7
+ * 数组的比较可参考 python 中的元祖比较:
8
8
  * https://stackoverflow.com/questions/5292303/how-does-tuple-comparison-work-in-python */
9
9
  export default function smartCompare(x, y) {
10
10
  // 将 null 排在最后面
@@ -52,7 +52,7 @@ export declare const isObjEmpty: (obj: any) => boolean;
52
52
  export declare const getColumnsVisible: <T>(columns: ColumnsTable<T>, index: number) => ColumnTable<T>[];
53
53
  export declare const updateData: <Record = AnyObject>(initData: Record[], rows: Record[], key: keyof Record) => Record[];
54
54
  export declare const parseBooleanToValue: (value: boolean, type: 'boolean' | 'number') => number | boolean;
55
- export declare const genPresets: (presets?: import("@ant-design/colors").PalettesProps) => import("antd/es/color-picker/interface").PresetsItem[];
55
+ export declare const genPresets: (presets?: import("@ant-design/colors").PalettesProps) => import("rc-master-ui/lib/color-picker/interface").PresetsItem[];
56
56
  export declare function findAllChildrenKeys<RecordType>(data: readonly RecordType[], getRowKey: GetRowKey<RecordType>, childrenColumnName: string): Key[];
57
57
  export declare function findAllChildrenKeys2<RecordType>(data: readonly RecordType[], rowKey: any, childrenColumnName: string): Key[];
58
58
  export declare const flattenArray: <RecordType extends AnyObject = AnyObject>(arr: any[]) => RecordType[];
@@ -1,8 +1,7 @@
1
- import type { CheckboxProps, TablePaginationConfig } from 'rc-master-ui';
1
+ import type { CheckboxProps, ColorPickerProps, TablePaginationConfig } from 'rc-master-ui';
2
2
  import type { ItemType } from 'rc-master-ui/es/menu/interface';
3
3
  import type { Cell, Header, OnChangeFn } from '@tanstack/react-table';
4
4
  import type { CSSProperties, ReactElement, ReactNode } from 'react';
5
- import type { ColorPickerProps } from 'antd';
6
5
  import type { TableLocale } from "rc-master-ui/lib/table/interface";
7
6
  import type { IOperator } from '../grid-component/hooks';
8
7
  import type { PaginationLocale } from 'rc-master-ui/lib/pagination/Pagination';
@@ -235,21 +234,10 @@ export type TableProps<RecordType = AnyObject> = {
235
234
  className?: string;
236
235
  title?: ReactNode | ((data: RecordType) => ReactNode);
237
236
  fullScreenTitle?: ReactNode | (() => ReactNode);
238
- editAble?: boolean;
239
237
  rowKey?: string;
240
- infiniteScroll?: boolean;
241
- next?: () => void;
242
- onEndReachedThreshold?: number;
243
- locale?: Locale;
244
- groupAble?: boolean;
245
- groupColumns?: string[];
246
- groupSetting?: IGroupSetting;
247
- onChooseColumns?: (props: IOnChooseColumns) => void;
248
- pagination?: false | PaginationConfig;
249
- showCustomTooltip?: boolean;
250
- sortMultiple?: boolean;
251
238
  dataSource: RecordType[];
252
239
  columns: ColumnsTable<RecordType>;
240
+ loading?: boolean;
253
241
  height?: number;
254
242
  minHeight?: number;
255
243
  format?: IFormat;
@@ -257,6 +245,24 @@ export type TableProps<RecordType = AnyObject> = {
257
245
  t?: any;
258
246
  /** Language code: exp: vi || en || ja || zh .... */
259
247
  lang?: string;
248
+ locale?: Locale;
249
+ wrapSettings?: IWrapSettings;
250
+ infiniteScroll?: boolean;
251
+ next?: () => void;
252
+ onEndReachedThreshold?: number;
253
+ /** Group data by columns */
254
+ groupAble?: boolean;
255
+ groupColumns?: string[];
256
+ groupSetting?: IGroupSetting;
257
+ /** Toolbar */
258
+ showToolbar?: boolean;
259
+ toolbarItems?: ToolbarItem[];
260
+ showColumnChoose?: boolean;
261
+ onChooseColumns?: (props: IOnChooseColumns) => void;
262
+ fullScreen?: boolean;
263
+ pagination?: false | PaginationConfig;
264
+ showCustomTooltip?: boolean;
265
+ /** Context Menu */
260
266
  contextMenuItems?: ContextMenuItem[];
261
267
  showDefaultContext?: boolean;
262
268
  contextMenuHidden?: string[] | ((args?: Omit<ContextInfo<RecordType>, 'item' | 'event'>) => string[]);
@@ -264,8 +270,7 @@ export type TableProps<RecordType = AnyObject> = {
264
270
  contextMenuClick?: (args: ContextInfo<RecordType>) => void;
265
271
  recordDoubleClick?: (args: RecordDoubleClickEventArgs<RecordType>) => void;
266
272
  recordClick?: (args: RecordDoubleClickEventArgs<RecordType>) => void;
267
- toolbarItems?: ToolbarItem[];
268
- showColumnChoose?: boolean;
273
+ /** Filter */
269
274
  showAdvanceFilter?: boolean;
270
275
  allowFiltering?: boolean;
271
276
  defaultFilter?: FilterItem[];
@@ -277,9 +282,12 @@ export type TableProps<RecordType = AnyObject> = {
277
282
  * ignoreAccents = false => so sánh có dấu + uperrcase sensitive
278
283
  * **/
279
284
  ignoreAccents?: boolean;
285
+ /** Sorter */
286
+ sortMultiple?: boolean;
280
287
  allowSortering?: boolean;
281
288
  onSorter?: (args: Sorter[]) => void;
282
289
  defaultSorter?: Sorter[];
290
+ /** selected record feature */
283
291
  selectionSettings?: SelectionSettings;
284
292
  rowSelection?: RowSelection<RecordType>;
285
293
  rowSelected?: (args: {
@@ -287,35 +295,37 @@ export type TableProps<RecordType = AnyObject> = {
287
295
  rowData: RecordType;
288
296
  selected: RecordType | RecordType[];
289
297
  }) => void;
290
- loading?: boolean;
298
+ /** resize column width feature */
291
299
  allowResizing?: boolean;
292
- showToolbar?: boolean;
293
- onDataChange?: (data: RecordType[]) => void;
294
- defaultValue?: AnyObject | (() => AnyObject);
295
300
  summary?: boolean;
296
301
  footerDataSource?: any[];
297
302
  showEmptyText?: boolean;
298
303
  commandSettings?: CommandSettings;
299
- rowClassName?: string | RowClassName<RecordType>;
300
- onCellPaste?: ICellPasteModel<RecordType>;
301
- onCellChange?: (args: CellChangeArgs<RecordType>, handleCallback: (rowData: any, index: any, value?: any) => void) => void;
302
- onCellClick?: (args: ICellClick, callback?: any) => void;
303
- rowEditable?: (rowData: RecordType) => boolean;
304
- validate?: any;
305
- onBlur?: (data: RecordType[]) => void;
304
+ commandClick?: (args: CommandClick<RecordType>) => void;
306
305
  onExpandClick?: (args: {
307
306
  expandedKeys: string[];
308
307
  key: string;
309
308
  rowData: any;
310
309
  }) => void;
311
- wrapSettings?: IWrapSettings;
312
- actionTemplate?: ReactNode | ReactElement | (() => ReactNode | ReactElement);
313
- commandClick?: (args: CommandClick<RecordType>) => void;
314
310
  expandable?: ExpandableConfig<RecordType>;
315
- fullScreen?: boolean;
311
+ actionTemplate?: ReactNode | ReactElement | (() => ReactNode | ReactElement);
312
+ rowClassName?: string | RowClassName<RecordType>;
316
313
  onRowStyles?: CSSProperties | ((data: RecordType) => CSSProperties);
317
314
  onRowHeaderStyles?: Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'> | (() => Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'>);
318
315
  onRowFooterStyles?: Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'> | (() => Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'>);
316
+ useVirtual?: {
317
+ horizontal?: boolean;
318
+ vertical?: boolean;
319
+ };
320
+ editAble?: boolean;
321
+ onDataChange?: (data: RecordType[]) => void;
322
+ defaultValue?: AnyObject | (() => AnyObject);
323
+ onCellPaste?: ICellPasteModel<RecordType>;
324
+ onCellChange?: (args: CellChangeArgs<RecordType>, handleCallback: (rowData: any, index: any, value?: any) => void) => void;
325
+ onCellClick?: (args: ICellClick, callback?: any) => void;
326
+ rowEditable?: (rowData: RecordType) => boolean;
327
+ validate?: any;
328
+ onBlur?: (data: RecordType[]) => void;
319
329
  };
320
330
  export type ExpandableConfig<RecordType> = {
321
331
  expandedRowKeys?: readonly Key[];
@@ -9,5 +9,6 @@ export type IColumnsChoose<RecordType> = {
9
9
  t?: any;
10
10
  triggerChangeKeys?: any;
11
11
  columnHidden: any;
12
+ id: any;
12
13
  };
13
14
  export declare const ColumnsChoose: <RecordType extends object>(props: IColumnsChoose<RecordType>) => React.JSX.Element;
@@ -1,7 +1,7 @@
1
1
  import useMergedState from "rc-util/es/hooks/useMergedState";
2
2
  import React, { Fragment, useState } from "react";
3
3
  import styled from "styled-components";
4
- import { Button, Input, Popover, Tooltip } from "antd";
4
+ import { Button, Input, Popover } from "antd";
5
5
  import Tree from "rc-master-ui/es/tree";
6
6
  import SearchOutlined from "@ant-design/icons/SearchOutlined";
7
7
  import { convertColumnsToTreeData, getVisibleColumnKeys1, updateColumns1 } from "./hook/utils";
@@ -18,6 +18,7 @@ export const ColumnsChoose = props => {
18
18
  triggerChangeColumns,
19
19
  // triggerChangeKeys,
20
20
  t,
21
+ id,
21
22
  columnsGroup
22
23
  } = props;
23
24
  const treeColumns = React.useMemo(() => {
@@ -199,13 +200,12 @@ export const ColumnsChoose = props => {
199
200
  onOpenChange: handleClickChange,
200
201
  arrow: false,
201
202
  zIndex: 1065
202
- }, /*#__PURE__*/React.createElement(Tooltip, {
203
- arrow: false,
204
- title: 'Cài đặt'
205
203
  }, /*#__PURE__*/React.createElement(Settings, {
206
204
  fontSize: 16,
207
205
  style: {
208
206
  cursor: 'pointer'
209
- }
210
- }))));
207
+ },
208
+ "data-tooltip-id": `${id}-tooltip-content`,
209
+ "data-tooltip-content": t ? t('Setting') : 'Cài đặt'
210
+ })));
211
211
  };
@@ -6,12 +6,12 @@ import { checkDecimalSeparator, checkThousandSeparator, detectSeparators, findIt
6
6
  unFlattenData, updateArrayByKey, updateColumnWidthsRecursive, updateOrInsert } from "./hook/utils";
7
7
  import { useVirtualizer } from "@tanstack/react-virtual";
8
8
  import { useForm } from 'react-hook-form';
9
- import { Button, Modal, Typography, Dropdown } from "antd";
10
9
  import Pagination from "rc-master-ui/es/pagination";
11
10
  import { numericFormatter, removeNumericFormat } from "react-numeric-component";
12
11
  import { TableContext } from "./useContext";
13
12
  import { yupResolver } from "@hookform/resolvers/yup";
14
- import { Toolbar } from "rc-master-ui";
13
+ import { Dropdown, Toolbar } from "rc-master-ui";
14
+ import { Modal, Typography } from "antd";
15
15
  import classNames from "classnames";
16
16
  import { Collapse2, Expand2, Maximize, Minimize } from "becoxy-icons";
17
17
  // import { ColumnsChoose } from "./ColumnsChoose";
@@ -23,6 +23,7 @@ import { ColumnsGroup } from "./ColumnsGroup";
23
23
  import { unGroupData } from "../table-virtuoso/hook/utils";
24
24
  import { useLocale } from "rc-master-ui/es/locale";
25
25
  import { ColumnsChoose } from "../table-component/ColumnsChoose";
26
+ import Button from "rc-master-ui/es/button";
26
27
  const MySwal = withReactContent(Swal);
27
28
  const {
28
29
  Paragraph,
@@ -930,7 +931,9 @@ const TableContainerEdit = props => {
930
931
  if (index > -1) {
931
932
  triggerChangeData?.(rs);
932
933
  }
933
- } catch (errInfo) {}
934
+ } catch (errInfo) {
935
+ console.log('Validate Failed:', errInfo);
936
+ }
934
937
  };
935
938
  const onSubmit2 = (formData, newOriginData) => {
936
939
  try {
@@ -948,7 +951,9 @@ const TableContainerEdit = props => {
948
951
  if (index > -1) {
949
952
  triggerChangeData?.(rs);
950
953
  }
951
- } catch (errInfo) {}
954
+ } catch (errInfo) {
955
+ console.log('Validate Failed:', errInfo);
956
+ }
952
957
  };
953
958
  const handleCellChange = args => {
954
959
  const {
@@ -9,8 +9,6 @@ import dayjs from "dayjs";
9
9
  import moment from "moment";
10
10
  import { Controller } from "react-hook-form";
11
11
  import { Checkbox, TreeSelect, Select } from "rc-master-ui";
12
- // import { Select } from "antd"
13
-
14
12
  import { AsyncSelect } from "../components/async-select";
15
13
  import { AsyncTableSelect } from "../components/async-table-select";
16
14
  import { cyan, green, red, blue } from '@ant-design/colors';