es-grid-template 1.9.53 → 1.9.56

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 (133) hide show
  1. package/es/ali-table/Grid.d.ts +1 -0
  2. package/es/ali-table/Grid.js +12 -4
  3. package/es/ali-table/InternalTable.js +39 -7
  4. package/es/ali-table/base-table/html-table-default.d.ts +20 -0
  5. package/es/ali-table/base-table/html-table-default.js +224 -0
  6. package/es/ali-table/base-table/html-table-new.d.ts +20 -0
  7. package/es/ali-table/base-table/html-table-new.js +417 -0
  8. package/es/ali-table/base-table/html-table.js +324 -182
  9. package/es/ali-table/base-table/styles.d.ts +1 -0
  10. package/es/ali-table/base-table/styles.js +5 -4
  11. package/es/ali-table/base-table/table.d.ts +4 -0
  12. package/es/ali-table/base-table/table.js +24 -5
  13. package/es/ali-table/pipeline/features/columnCustom.js +3 -3
  14. package/es/ali-table/pipeline/features/pagination.js +1 -1
  15. package/es/ali-table/utils/convertColumnsChoose.d.ts +2 -2
  16. package/es/grid-component/control/InputControl/InputControl.js +2 -3
  17. package/es/grid-component/hooks/calender.d.ts +19 -0
  18. package/es/grid-component/hooks/calender.js +32 -0
  19. package/es/grid-component/type.d.ts +15 -2
  20. package/es/group-component/ColumnsChoose.js +1 -2
  21. package/es/group-component/ColumnsGroup/ColumnsGroup.js +1 -2
  22. package/es/group-component/TableContainerEdit.js +3 -4
  23. package/es/group-component/body/EditableCell.js +7 -6
  24. package/es/group-component/body/TableBodyRow.js +15 -4
  25. package/es/group-component/components/EditForm/EditForm.js +1 -2
  26. package/es/group-component/components/InputControl/InputControl.js +1 -2
  27. package/es/group-component/components/checkbox-filter/CheckboxFilter.js +1 -2
  28. package/es/group-component/components/checkbox-filter/FilterSearch.d.ts +1 -1
  29. package/es/group-component/components/checkbox-filter/FilterSearch.js +0 -3
  30. package/es/group-component/header/TableHeadCell.js +1 -2
  31. package/es/group-component/header/TableHeadCell2.js +1 -2
  32. package/es/group-component/hook/utils.d.ts +4 -4
  33. package/es/group-component/table/Grid.js +1 -1
  34. package/es/index.d.ts +2 -2
  35. package/es/index.js +1 -1
  36. package/es/table-component/ColumnsChoose.js +1 -1
  37. package/es/table-component/ColumnsConfig.d.ts +17 -0
  38. package/es/table-component/ColumnsConfig.js +303 -0
  39. package/es/table-component/ContextMenu.js +1 -1
  40. package/es/table-component/InternalTable.js +30 -9
  41. package/es/table-component/TableContainer.js +4 -2
  42. package/es/table-component/TableContainerEdit.js +18 -5
  43. package/es/table-component/body/EditableCell.js +104 -119
  44. package/es/table-component/body/TableBodyCellEdit.js +1 -1
  45. package/es/table-component/body/TableBodyRow.js +0 -5
  46. package/es/table-component/components/EditForm/EditForm.js +1 -4
  47. package/es/table-component/components/InputControl/InputControl.js +1 -1
  48. package/es/table-component/components/checkbox-filter/CheckboxFilter.js +1 -2
  49. package/es/table-component/components/checkbox-filter/FilterSearch.d.ts +1 -1
  50. package/es/table-component/components/checkbox-filter/FilterSearch.js +4 -2
  51. package/es/table-component/header/TableHeadCell.js +1 -1
  52. package/es/table-component/header/TableHeadCell2.js +1 -1
  53. package/es/table-component/header/TableHeadRow.js +6 -6
  54. package/es/table-component/hook/utils.d.ts +3 -3
  55. package/es/table-component/hook/utils.js +28 -4
  56. package/es/table-component/style.js +2 -2
  57. package/es/table-component/table/Grid.js +2 -1
  58. package/es/table-virtuoso/ColumnsGroup/ColumnsGroup.js +1 -1
  59. package/es/table-virtuoso/header/TableHeadCell.js +1 -1
  60. package/es/table-virtuoso/hook/utils.d.ts +1 -1
  61. package/es/table-virtuoso/table/Grid.js +1 -1
  62. package/es/table-virtuoso/table/TableContainer.js +1 -1
  63. package/es/table-virtuoso/table/TableWrapper.d.ts +1 -2
  64. package/es/table-virtuoso/table/TableWrapper.js +1 -0
  65. package/lib/ali-table/Grid.d.ts +1 -0
  66. package/lib/ali-table/Grid.js +12 -4
  67. package/lib/ali-table/InternalTable.js +39 -7
  68. package/lib/ali-table/base-table/html-table-default.d.ts +20 -0
  69. package/lib/ali-table/base-table/html-table-default.js +231 -0
  70. package/lib/ali-table/base-table/html-table-new.d.ts +20 -0
  71. package/lib/ali-table/base-table/html-table-new.js +424 -0
  72. package/lib/ali-table/base-table/html-table.js +324 -182
  73. package/lib/ali-table/base-table/styles.d.ts +1 -0
  74. package/lib/ali-table/base-table/styles.js +5 -4
  75. package/lib/ali-table/base-table/table.d.ts +4 -0
  76. package/lib/ali-table/base-table/table.js +24 -5
  77. package/lib/ali-table/pipeline/features/columnCustom.js +4 -4
  78. package/lib/ali-table/pipeline/features/pagination.js +1 -1
  79. package/lib/ali-table/utils/convertColumnsChoose.d.ts +2 -2
  80. package/lib/grid-component/control/InputControl/InputControl.js +4 -6
  81. package/lib/grid-component/hooks/calender.d.ts +19 -0
  82. package/lib/grid-component/hooks/calender.js +40 -0
  83. package/lib/grid-component/type.d.ts +15 -2
  84. package/lib/group-component/ColumnsChoose.js +6 -7
  85. package/lib/group-component/ColumnsGroup/ColumnsGroup.js +3 -4
  86. package/lib/group-component/TableContainerEdit.js +4 -5
  87. package/lib/group-component/body/EditableCell.js +14 -13
  88. package/lib/group-component/body/TableBodyRow.js +15 -4
  89. package/lib/group-component/components/EditForm/EditForm.js +1 -2
  90. package/lib/group-component/components/InputControl/InputControl.js +4 -6
  91. package/lib/group-component/components/checkbox-filter/CheckboxFilter.js +1 -2
  92. package/lib/group-component/components/checkbox-filter/FilterSearch.d.ts +1 -1
  93. package/lib/group-component/components/checkbox-filter/FilterSearch.js +0 -2
  94. package/lib/group-component/header/TableHeadCell.js +3 -4
  95. package/lib/group-component/header/TableHeadCell2.js +3 -4
  96. package/lib/group-component/hook/utils.d.ts +1 -1
  97. package/lib/group-component/table/Grid.js +2 -2
  98. package/lib/index.d.ts +2 -2
  99. package/lib/index.js +2 -2
  100. package/lib/table-component/ColumnsChoose.js +5 -5
  101. package/lib/table-component/ColumnsConfig.d.ts +17 -0
  102. package/lib/table-component/ColumnsConfig.js +313 -0
  103. package/lib/table-component/ContextMenu.js +3 -3
  104. package/lib/table-component/InternalTable.js +25 -8
  105. package/lib/table-component/TableContainer.js +4 -2
  106. package/lib/table-component/TableContainerEdit.js +20 -8
  107. package/lib/table-component/body/EditableCell.js +113 -129
  108. package/lib/table-component/body/TableBodyCellEdit.js +1 -1
  109. package/lib/table-component/body/TableBodyRow.js +0 -5
  110. package/lib/table-component/components/EditForm/EditForm.js +3 -6
  111. package/lib/table-component/components/InputControl/InputControl.js +1 -2
  112. package/lib/table-component/components/checkbox-filter/CheckboxFilter.js +1 -2
  113. package/lib/table-component/components/checkbox-filter/FilterSearch.d.ts +1 -1
  114. package/lib/table-component/components/checkbox-filter/FilterSearch.js +5 -2
  115. package/lib/table-component/header/TableHeadCell.js +4 -5
  116. package/lib/table-component/header/TableHeadCell2.js +2 -3
  117. package/lib/table-component/header/TableHeadRow.js +6 -6
  118. package/lib/table-component/hook/utils.d.ts +3 -3
  119. package/lib/table-component/hook/utils.js +28 -4
  120. package/lib/table-component/style.js +2 -2
  121. package/lib/table-component/table/Grid.js +3 -2
  122. package/lib/table-virtuoso/ColumnsGroup/ColumnsGroup.js +3 -4
  123. package/lib/table-virtuoso/header/TableHeadCell.js +4 -5
  124. package/lib/table-virtuoso/hook/utils.d.ts +1 -1
  125. package/lib/table-virtuoso/table/Grid.js +2 -2
  126. package/lib/table-virtuoso/table/TableContainer.js +1 -1
  127. package/lib/table-virtuoso/table/TableWrapper.d.ts +1 -2
  128. package/lib/table-virtuoso/table/TableWrapper.js +2 -0
  129. package/package.json +2 -3
  130. /package/es/{datepicker → datePicker}/index.d.ts +0 -0
  131. /package/es/{datepicker → datePicker}/index.js +0 -0
  132. /package/lib/{datepicker → datePicker}/index.d.ts +0 -0
  133. /package/lib/{datepicker → datePicker}/index.js +0 -0
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { ColumnDef, Table } from "@tanstack/react-table";
3
- import type { CommandClick, ContextInfo, PaginationConfig } from '../../grid-component/type';
4
- import type { ContextMenuItem } from "../..";
3
+ import type { CommandClick, ContextInfo, ContextMenuItem, PaginationConfig } from '../../grid-component/type';
5
4
  type Props<T> = {
6
5
  tableContainerRef: React.RefObject<HTMLDivElement>;
7
6
  table: Table<T>;
@@ -7,6 +7,7 @@ import { TableContext } from "../useContext";
7
7
  import classNames from 'classnames';
8
8
  import TableBodyRow from "../body/TableBodyRow";
9
9
  import TableFooterCell from "../footer/TableFooterCell";
10
+ // import type { ContextMenuItem } from 'es-grid-template';
10
11
  import { Tooltip } from 'react-tooltip';
11
12
  import ContextMenu from "../../table-component/ContextMenu";
12
13
  const TableWrapper = props => {
@@ -17,5 +17,6 @@ declare const Grid: React.ForwardRefExoticComponent<Omit<TableProps, "useVirtual
17
17
  vertical?: VirtualEnum;
18
18
  header?: VirtualEnum;
19
19
  };
20
+ dataRowIds: any[];
20
21
  } & React.RefAttributes<BaseTable>>;
21
22
  export default Grid;
@@ -66,7 +66,8 @@ const Grid = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
66
66
  useVirtual,
67
67
  useOuterBorder = true,
68
68
  showHeader = true,
69
- gridLines
69
+ gridLines,
70
+ dataRowIds
70
71
  } = props;
71
72
  const {
72
73
  cssVariables
@@ -173,16 +174,20 @@ const Grid = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
173
174
  [`${prefix}-grid-line-horizontal`]: gridLines === 'Horizontal',
174
175
  [`${prefix}-grid-line-vertical`]: gridLines === 'Vertical',
175
176
  [`${prefix}-grid-line-none`]: gridLines === 'None',
176
- [`use-outer-border`]: useOuterBorder
177
+ [`use-outer-border`]: useOuterBorder,
178
+ [`auto-height`]: !minHeight
179
+ // [`has-title`]: showToolbar !== false && ( fullScreen !== false || title || topToolbaritems.length > 0)
177
180
  }),
178
181
  style: {
179
- maxHeight: height ?? 700,
182
+ // maxHeight: height ?? 700,
183
+ maxHeight: height ?? minHeight,
184
+ // height: height ?? minHeight,
180
185
  minHeight,
181
186
  display: 'flex',
182
187
  flexDirection: 'column',
183
188
  ...artTableWrapperProps.style
184
189
  }
185
- }, (showToolbar !== false || fullScreen !== false || title || topToolbaritems.length > 0) && /*#__PURE__*/_react.default.createElement("div", {
190
+ }, showToolbar !== false && (fullScreen !== false || title || topToolbaritems.length > 0) && /*#__PURE__*/_react.default.createElement("div", {
186
191
  className: (0, _classnames.default)(`${prefix}-grid-top`, {})
187
192
  }, /*#__PURE__*/_react.default.createElement("div", {
188
193
  style: {
@@ -252,6 +257,8 @@ const Grid = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
252
257
  isStickyHeader: true,
253
258
  stickyBottom: 0,
254
259
  stickyTop: 0,
260
+ isBottom: !!(bottom || pagination && !infiniteScroll),
261
+ isTitle: !!(showToolbar !== false && (fullScreen !== false || title || topToolbaritems.length > 0)),
255
262
  defaultColumnWidth: 100,
256
263
  originData: originData,
257
264
  format: format
@@ -306,6 +313,7 @@ const Grid = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
306
313
  };
307
314
  },
308
315
  theme: theme,
316
+ dataRowIds: dataRowIds,
309
317
  footerDataSource: footerDataSource
310
318
  })), (bottom || pagination && !infiniteScroll) && /*#__PURE__*/_react.default.createElement("div", {
311
319
  className: (0, _classnames.default)(`${prefix}-grid-bottom`, {})
@@ -14,11 +14,13 @@ var _react = _interopRequireDefault(require("react"));
14
14
  require("./base-table/styles.scss");
15
15
  var _utils = require("../table-component/hook/utils");
16
16
  var _rcMasterUi = require("rc-master-ui");
17
- var _antd = require("antd");
18
17
  var _useLocale = require("../locale/useLocale");
19
18
  var _useContext = require("./useContext");
20
19
  var _Grid = _interopRequireDefault(require("./Grid"));
21
20
  var _selected = require("./utils/selected");
21
+ var _core = require("@dnd-kit/core");
22
+ var _modifiers = require("@dnd-kit/modifiers");
23
+ var _sortable = require("@dnd-kit/sortable");
22
24
  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); }
23
25
  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; }
24
26
  const InternalTable = props => {
@@ -49,6 +51,7 @@ const InternalTable = props => {
49
51
  footerDataSource,
50
52
  summary,
51
53
  useVirtual,
54
+ rowDnd,
52
55
  ...rest
53
56
  } = props;
54
57
  const prefix = 'ui-rc';
@@ -88,8 +91,8 @@ const InternalTable = props => {
88
91
  const [filterState, setFilterState] = _react.default.useState(undefined);
89
92
  const [sortState, setSortState] = _react.default.useState(undefined);
90
93
  const columns = _react.default.useMemo(() => {
91
- return (0, _utils.sortByType)(propColumns);
92
- }, [propColumns]);
94
+ return (0, _utils.sortByType)(propColumns, rowDnd);
95
+ }, [propColumns, rowDnd]);
93
96
  const convertData = _react.default.useMemo(() => {
94
97
  if (groupAble && groupSetting && groupSetting.client !== false) {
95
98
  return (0, _utils.groupArrayByColumns)(dataSource, groupColumns);
@@ -135,6 +138,7 @@ const InternalTable = props => {
135
138
  // return getInvisibleColumns(columns)
136
139
  // }, [columns])
137
140
 
141
+ const dataIds = _react.default.useMemo(() => mergedData.map(it => it.rowId), [mergedData]);
138
142
  const columnVisibility = _react.default.useMemo(() => {
139
143
  return (0, _utils.getVisibleFields)(columns);
140
144
  }, [columns]);
@@ -235,6 +239,27 @@ const InternalTable = props => {
235
239
 
236
240
  // }
237
241
 
242
+ // reorder rows after drag & drop
243
+ function handleDragEnd(event) {
244
+ const {
245
+ active,
246
+ over
247
+ } = event;
248
+ if (over && active.id !== over.id) {
249
+ // data dạng phẳng
250
+
251
+ const oldIndex = dataIds.indexOf(active.id);
252
+ const newIndex = dataIds.indexOf(over.id);
253
+ const rs = (0, _sortable.arrayMove)(mergedData, oldIndex, newIndex); // this is just a splice util
254
+
255
+ if (rowDnd?.onChange) {
256
+ rowDnd?.onChange({
257
+ rows: rs
258
+ });
259
+ }
260
+ }
261
+ }
262
+ const sensors = (0, _core.useSensors)((0, _core.useSensor)(_core.MouseSensor, {}), (0, _core.useSensor)(_core.TouchSensor, {}), (0, _core.useSensor)(_core.KeyboardSensor, {}));
238
263
  return /*#__PURE__*/_react.default.createElement(_rcMasterUi.ConfigProvider, {
239
264
  locale: language,
240
265
  theme: {
@@ -293,6 +318,11 @@ const InternalTable = props => {
293
318
  lang,
294
319
  locale
295
320
  }
321
+ }, /*#__PURE__*/_react.default.createElement(_core.DndContext, {
322
+ collisionDetection: _core.closestCenter,
323
+ modifiers: [_modifiers.restrictToVerticalAxis],
324
+ onDragEnd: handleDragEnd,
325
+ sensors: sensors
296
326
  }, /*#__PURE__*/_react.default.createElement(_Grid.default, (0, _extends2.default)({}, rest, {
297
327
  id: id,
298
328
  useVirtual: {
@@ -313,8 +343,9 @@ const InternalTable = props => {
313
343
  onFilter: onFilter,
314
344
  onSorter: onSorter,
315
345
  defaultFilter: defaultFilter,
316
- defaultSorter: defaultSorter
317
- })), /*#__PURE__*/_react.default.createElement(_antd.Modal, {
346
+ defaultSorter: defaultSorter,
347
+ dataRowIds: dataIds
348
+ })), /*#__PURE__*/_react.default.createElement(_rcMasterUi.Modal, {
318
349
  open: isFullScreen,
319
350
  footer: null,
320
351
  centered: true,
@@ -363,7 +394,8 @@ const InternalTable = props => {
363
394
  onFilter: onFilter,
364
395
  onSorter: onSorter,
365
396
  defaultFilter: defaultFilter,
366
- defaultSorter: defaultSorter
367
- })))))));
397
+ defaultSorter: defaultSorter,
398
+ dataRowIds: dataIds
399
+ }))))))));
368
400
  };
369
401
  var _default = exports.default = InternalTable;
@@ -0,0 +1,20 @@
1
+ /// <reference types="react" />
2
+ import type { RenderInfo } from './interfaces';
3
+ import type { BaseTableProps } from './table';
4
+ import type { CommandClick, IFormat } from '../../grid-component/type';
5
+ export interface HtmlTableProps extends Required<Pick<BaseTableProps, 'getRowProps' | 'primaryKey' | 'components'>> {
6
+ tbodyHtmlTag: 'tbody' | 'tfoot';
7
+ data: any[];
8
+ originData: any[];
9
+ format?: IFormat;
10
+ id: string;
11
+ commandClick?: (args: CommandClick<any>) => void;
12
+ horizontalRenderInfo: Pick<RenderInfo, 'flat' | 'visible' | 'horizontalRenderRange' | 'stickyLeftMap' | 'stickyRightMap'>;
13
+ verticalRenderInfo: {
14
+ offset: number;
15
+ first: number;
16
+ last: number;
17
+ limit: number;
18
+ };
19
+ }
20
+ export declare function HtmlTable({ tbodyHtmlTag, getRowProps, primaryKey, data, originData, format, commandClick, id, verticalRenderInfo: verInfo, horizontalRenderInfo: hozInfo, components: { Row, Cell, TableBody }, }: HtmlTableProps): JSX.Element;
@@ -0,0 +1,231 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.HtmlTable = HtmlTable;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _classnames = _interopRequireDefault(require("classnames"));
10
+ var _react = _interopRequireDefault(require("react"));
11
+ var _internals = require("../internals");
12
+ var _colgroup = require("./colgroup");
13
+ var _SpanManager = _interopRequireDefault(require("./helpers/SpanManager"));
14
+ var _styles = require("./styles");
15
+ var _hooks = require("../../grid-component/hooks");
16
+ var _rcMasterUi = require("rc-master-ui");
17
+ var _Command = _interopRequireDefault(require("../../table-component/components/command/Command"));
18
+ var _useColumns = require("../../table-component/hook/useColumns");
19
+ function HtmlTable({
20
+ tbodyHtmlTag,
21
+ getRowProps,
22
+ primaryKey,
23
+ data,
24
+ originData,
25
+ format,
26
+ commandClick,
27
+ id,
28
+ verticalRenderInfo: verInfo,
29
+ horizontalRenderInfo: hozInfo,
30
+ components: {
31
+ Row,
32
+ Cell,
33
+ TableBody
34
+ }
35
+ }) {
36
+ const {
37
+ flat,
38
+ horizontalRenderRange: hoz
39
+ } = hozInfo;
40
+ const spanManager = new _SpanManager.default();
41
+ const fullFlatCount = flat.full.length;
42
+ const leftFlatCount = flat.left.length;
43
+ const rightFlatCount = flat.right.length;
44
+ const tbody = TableBody != null && tbodyHtmlTag === 'tbody' ? /*#__PURE__*/_react.default.createElement(TableBody, {
45
+ tbodyProps: {
46
+ children: data.map(renderRow)
47
+ }
48
+ }) : ( /*#__PURE__*/_react.default.createElement(tbodyHtmlTag, null, data.map(renderRow)));
49
+ return /*#__PURE__*/_react.default.createElement("table", null, /*#__PURE__*/_react.default.createElement(_colgroup.Colgroup, {
50
+ descriptors: hozInfo.visible
51
+ }), tbody);
52
+ function renderRow(row, i) {
53
+ const rowIndex = verInfo.offset + i;
54
+ spanManager.stripUpwards(rowIndex);
55
+ const rowProps = getRowProps(row, rowIndex);
56
+ const rowClass = (0, _classnames.default)(_styles.Classes.tableRow, {
57
+ first: rowIndex === verInfo.first,
58
+ last: rowIndex === verInfo.last,
59
+ even: rowIndex % 2 === 0,
60
+ odd: rowIndex % 2 === 1
61
+ }, rowProps?.className);
62
+ const onContextMenu = rowProps?.onContextMenu;
63
+ const trProps = {
64
+ ...rowProps,
65
+ className: rowClass,
66
+ onContextMenu: tbodyHtmlTag === 'tbody' ? onContextMenu : undefined,
67
+ 'data-rowindex': rowIndex,
68
+ children: hozInfo.visible.map(descriptor => {
69
+ if (descriptor.type === 'blank') {
70
+ return /*#__PURE__*/_react.default.createElement("td", {
71
+ key: descriptor.blankSide
72
+ });
73
+ }
74
+ return renderBodyCell(row, rowIndex, descriptor.col, descriptor.colIndex);
75
+ })
76
+ };
77
+ const key = _internals.internals.safeGetRowKey(primaryKey, row, rowIndex);
78
+ if (Row != null && tbodyHtmlTag === 'tbody') {
79
+ return /*#__PURE__*/_react.default.createElement(Row, {
80
+ key,
81
+ row,
82
+ rowIndex,
83
+ trProps
84
+ });
85
+ } else {
86
+ return /*#__PURE__*/_react.default.createElement("tr", (0, _extends2.default)({
87
+ key: key
88
+ }, trProps));
89
+ }
90
+ }
91
+ function renderBodyCell(row, rowIndex, column, colIndex) {
92
+ if (spanManager.testSkip(rowIndex, colIndex)) {
93
+ return null;
94
+ }
95
+ const value = _internals.internals.safeGetValue(column, row, rowIndex);
96
+ const cellProps = column.getCellProps?.(value, row, rowIndex) ?? {};
97
+ const a = (0, _useColumns.renderValueCell)(column, value, row, rowIndex, colIndex, format, false);
98
+
99
+ // let cellContent: ReactNode = value
100
+ let cellContent = a;
101
+
102
+ // if (column.render) {
103
+ // cellContent = column.render(value, row, rowIndex)
104
+ // }
105
+ // if (column.field === '#') {
106
+
107
+ // cellContent = findItemPath(originData, row, primaryKey)
108
+ // }
109
+
110
+ if (column.field === 'command') {
111
+ const commands = column.commandItems ? column.commandItems.map(it => {
112
+ return {
113
+ ...it,
114
+ visible: typeof it.visible === 'function' ? it.visible?.(row) : it.visible
115
+ };
116
+ }) : [];
117
+ cellContent = /*#__PURE__*/_react.default.createElement("div", {
118
+ className: "ui-rc_cell-content"
119
+ }, /*#__PURE__*/_react.default.createElement(_rcMasterUi.Space, null, commands.filter(it => it.visible !== false).map(item => {
120
+ return /*#__PURE__*/_react.default.createElement(_Command.default, {
121
+ id: id,
122
+ key: item.id,
123
+ item: item,
124
+ record: row,
125
+ onClick: () => {
126
+ commandClick?.({
127
+ id: item.id,
128
+ // rowId: getRowKey(record, index) as any,
129
+ rowId: row.rowId,
130
+ rowData: row,
131
+ index: rowIndex,
132
+ rows: [...originData]
133
+ });
134
+ }
135
+ });
136
+ })));
137
+ }
138
+ if (column.template) {
139
+ cellContent = column.template({
140
+ value,
141
+ rowData: row,
142
+ index: rowIndex,
143
+ field: column.field ?? ''
144
+ });
145
+ }
146
+
147
+ //
148
+
149
+ let colSpan = 1;
150
+ let rowSpan = 1;
151
+ if (column.getSpanRect) {
152
+ const spanRect = column.getSpanRect(value, row, rowIndex);
153
+ colSpan = spanRect == null ? 1 : spanRect.right - colIndex;
154
+ rowSpan = spanRect == null ? 1 : spanRect.bottom - rowIndex;
155
+ } else {
156
+ if (cellProps.colSpan != null) {
157
+ colSpan = cellProps.colSpan;
158
+ }
159
+ if (cellProps.rowSpan != null) {
160
+ rowSpan = cellProps.rowSpan;
161
+ }
162
+ }
163
+
164
+ // rowSpan/colSpan should not be too large to avoid affecting cells that are not rendered due to virtual scrolling
165
+ rowSpan = Math.min(rowSpan, verInfo.limit - rowIndex);
166
+ colSpan = Math.min(colSpan, leftFlatCount + hoz.rightIndex - colIndex);
167
+ const hasSpan = colSpan > 1 || rowSpan > 1;
168
+ if (hasSpan) {
169
+ spanManager.add(rowIndex, colIndex, colSpan, rowSpan);
170
+ }
171
+ const positionStyle = {};
172
+ if (colIndex < leftFlatCount) {
173
+ positionStyle.position = 'sticky';
174
+ positionStyle.left = hozInfo.stickyLeftMap.get(colIndex);
175
+ } else if (colIndex >= fullFlatCount - rightFlatCount) {
176
+ positionStyle.position = 'sticky';
177
+ positionStyle.right = hozInfo.stickyRightMap.get(colIndex);
178
+ }
179
+ const tdProps = {
180
+ ...cellProps,
181
+ className: (0, _classnames.default)(_styles.Classes.tableCell, cellProps.className, {
182
+ first: colIndex === 0,
183
+ last: colIndex + colSpan === fullFlatCount,
184
+ 'lock-left': colIndex < leftFlatCount,
185
+ 'lock-right': colIndex >= fullFlatCount - rightFlatCount
186
+ }),
187
+ ...(hasSpan ? {
188
+ colSpan,
189
+ rowSpan
190
+ } : null),
191
+ style: {
192
+ textAlign: column.textAlign,
193
+ ...cellProps.style,
194
+ ...positionStyle
195
+ },
196
+ // children: <div className='ui-rc_cell-content'>{cellContent}</div>
197
+
198
+ children: cellContent
199
+ // children: () => {
200
+ // return (
201
+ // <span className='abcccc'>{cellContent}</span>
202
+ // )
203
+ // },
204
+ };
205
+ if (tbodyHtmlTag === 'tfoot') {
206
+ if (!_hooks.nonActionColumn.includes(column.field) && column.isSummary !== false) {
207
+ return /*#__PURE__*/_react.default.createElement("td", (0, _extends2.default)({
208
+ key: colIndex
209
+ }, tdProps));
210
+ } else {
211
+ return /*#__PURE__*/_react.default.createElement("td", (0, _extends2.default)({
212
+ key: colIndex
213
+ }, tdProps), '');
214
+ }
215
+ }
216
+ if (Cell != null && tbodyHtmlTag === 'tbody') {
217
+ return /*#__PURE__*/_react.default.createElement(Cell, {
218
+ key: colIndex,
219
+ tdProps: tdProps,
220
+ row: row,
221
+ rowIndex: rowIndex,
222
+ column: column,
223
+ colIndex: colIndex
224
+ });
225
+ } else {
226
+ return /*#__PURE__*/_react.default.createElement("td", (0, _extends2.default)({
227
+ key: colIndex
228
+ }, tdProps));
229
+ }
230
+ }
231
+ }
@@ -0,0 +1,20 @@
1
+ /// <reference types="react" />
2
+ import type { RenderInfo } from './interfaces';
3
+ import type { BaseTableProps } from './table';
4
+ import type { CommandClick, IFormat } from '../../grid-component/type';
5
+ export interface HtmlTableProps extends Required<Pick<BaseTableProps, 'getRowProps' | 'primaryKey' | 'components'>> {
6
+ tbodyHtmlTag: 'tbody' | 'tfoot';
7
+ data: any[];
8
+ originData: any[];
9
+ format?: IFormat;
10
+ id: string;
11
+ commandClick?: (args: CommandClick<any>) => void;
12
+ horizontalRenderInfo: Pick<RenderInfo, 'flat' | 'visible' | 'horizontalRenderRange' | 'stickyLeftMap' | 'stickyRightMap'>;
13
+ verticalRenderInfo: {
14
+ offset: number;
15
+ first: number;
16
+ last: number;
17
+ limit: number;
18
+ };
19
+ }
20
+ export declare function HtmlTable({ tbodyHtmlTag, getRowProps, primaryKey, data, originData, format, commandClick, id, verticalRenderInfo: verInfo, horizontalRenderInfo: hozInfo, components: { Row, Cell, TableBody }, }: HtmlTableProps): JSX.Element;