es-grid-template 1.9.53 → 1.9.55

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 (116) 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/common-views.d.ts +1 -1
  14. package/es/ali-table/pipeline/features/columnCustom.js +3 -3
  15. package/es/ali-table/pipeline/features/pagination.js +1 -1
  16. package/es/ali-table/utils/convertColumnsChoose.d.ts +2 -2
  17. package/es/grid-component/control/InputControl/InputControl.js +2 -3
  18. package/es/grid-component/hooks/calender.d.ts +19 -0
  19. package/es/grid-component/hooks/calender.js +32 -0
  20. package/es/grid-component/type.d.ts +15 -2
  21. package/es/group-component/ColumnsChoose.js +1 -2
  22. package/es/group-component/ColumnsGroup/ColumnsGroup.js +1 -2
  23. package/es/group-component/TableContainerEdit.js +1 -2
  24. package/es/group-component/body/EditableCell.js +7 -6
  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 +302 -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 +3 -3
  43. package/es/table-component/body/EditableCell.js +9 -5
  44. package/es/table-component/body/TableBodyRow.js +0 -5
  45. package/es/table-component/components/EditForm/EditForm.js +1 -4
  46. package/es/table-component/components/InputControl/InputControl.js +1 -1
  47. package/es/table-component/components/checkbox-filter/CheckboxFilter.js +1 -2
  48. package/es/table-component/components/checkbox-filter/FilterSearch.d.ts +1 -1
  49. package/es/table-component/components/checkbox-filter/FilterSearch.js +4 -2
  50. package/es/table-component/header/TableHeadCell.js +1 -1
  51. package/es/table-component/header/TableHeadCell2.js +1 -1
  52. package/es/table-component/header/TableHeadRow.js +6 -6
  53. package/es/table-component/hook/utils.d.ts +3 -3
  54. package/es/table-component/hook/utils.js +28 -4
  55. package/es/table-component/style.js +1 -1
  56. package/es/table-component/table/Grid.js +2 -1
  57. package/lib/ali-table/Grid.d.ts +1 -0
  58. package/lib/ali-table/Grid.js +12 -4
  59. package/lib/ali-table/InternalTable.js +39 -7
  60. package/lib/ali-table/base-table/html-table-default.d.ts +20 -0
  61. package/lib/ali-table/base-table/html-table-default.js +231 -0
  62. package/lib/ali-table/base-table/html-table-new.d.ts +20 -0
  63. package/lib/ali-table/base-table/html-table-new.js +424 -0
  64. package/lib/ali-table/base-table/html-table.js +324 -182
  65. package/lib/ali-table/base-table/styles.d.ts +1 -0
  66. package/lib/ali-table/base-table/styles.js +5 -4
  67. package/lib/ali-table/base-table/table.d.ts +4 -0
  68. package/lib/ali-table/base-table/table.js +24 -5
  69. package/lib/ali-table/pipeline/features/columnCustom.js +4 -4
  70. package/lib/ali-table/pipeline/features/pagination.js +1 -1
  71. package/lib/ali-table/utils/convertColumnsChoose.d.ts +2 -2
  72. package/lib/grid-component/control/InputControl/InputControl.js +4 -6
  73. package/lib/grid-component/hooks/calender.d.ts +19 -0
  74. package/lib/grid-component/hooks/calender.js +40 -0
  75. package/lib/grid-component/type.d.ts +15 -2
  76. package/lib/group-component/ColumnsChoose.js +6 -7
  77. package/lib/group-component/ColumnsGroup/ColumnsGroup.js +3 -4
  78. package/lib/group-component/TableContainerEdit.js +2 -3
  79. package/lib/group-component/body/EditableCell.js +14 -13
  80. package/lib/group-component/components/EditForm/EditForm.js +1 -2
  81. package/lib/group-component/components/InputControl/InputControl.js +4 -6
  82. package/lib/group-component/components/checkbox-filter/CheckboxFilter.js +1 -2
  83. package/lib/group-component/components/checkbox-filter/FilterSearch.d.ts +1 -1
  84. package/lib/group-component/components/checkbox-filter/FilterSearch.js +0 -2
  85. package/lib/group-component/header/TableHeadCell.js +3 -4
  86. package/lib/group-component/header/TableHeadCell2.js +3 -4
  87. package/lib/group-component/hook/utils.d.ts +1 -1
  88. package/lib/group-component/table/Grid.js +2 -2
  89. package/lib/index.d.ts +2 -2
  90. package/lib/index.js +2 -2
  91. package/lib/table-component/ColumnsChoose.js +5 -5
  92. package/lib/table-component/ColumnsConfig.d.ts +17 -0
  93. package/lib/table-component/ColumnsConfig.js +312 -0
  94. package/lib/table-component/ContextMenu.js +3 -3
  95. package/lib/table-component/InternalTable.js +25 -8
  96. package/lib/table-component/TableContainer.js +4 -2
  97. package/lib/table-component/TableContainerEdit.js +5 -6
  98. package/lib/table-component/body/EditableCell.js +18 -15
  99. package/lib/table-component/body/TableBodyRow.js +0 -5
  100. package/lib/table-component/components/EditForm/EditForm.js +3 -6
  101. package/lib/table-component/components/InputControl/InputControl.js +1 -2
  102. package/lib/table-component/components/checkbox-filter/CheckboxFilter.js +1 -2
  103. package/lib/table-component/components/checkbox-filter/FilterSearch.d.ts +1 -1
  104. package/lib/table-component/components/checkbox-filter/FilterSearch.js +5 -2
  105. package/lib/table-component/header/TableHeadCell.js +4 -5
  106. package/lib/table-component/header/TableHeadCell2.js +2 -3
  107. package/lib/table-component/header/TableHeadRow.js +6 -6
  108. package/lib/table-component/hook/utils.d.ts +3 -3
  109. package/lib/table-component/hook/utils.js +28 -4
  110. package/lib/table-component/style.js +1 -1
  111. package/lib/table-component/table/Grid.js +3 -2
  112. package/package.json +2 -2
  113. /package/es/{datepicker → datePicker}/index.d.ts +0 -0
  114. /package/es/{datepicker → datePicker}/index.js +0 -0
  115. /package/lib/{datepicker → datePicker}/index.d.ts +0 -0
  116. /package/lib/{datepicker → datePicker}/index.js +0 -0
@@ -0,0 +1,424 @@
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
+ var _sortable = require("@dnd-kit/sortable");
20
+ var _utilities = require("@dnd-kit/utilities");
21
+ var _becoxyIcons = require("becoxy-icons");
22
+ const RowDragHandleCell = ({
23
+ rowId
24
+ }) => {
25
+ const {
26
+ attributes,
27
+ listeners
28
+ } = (0, _sortable.useSortable)({
29
+ id: rowId
30
+ });
31
+ return (
32
+ /*#__PURE__*/
33
+ // Alternatively, you could set these attributes on the rows themselves
34
+ _react.default.createElement("span", (0, _extends2.default)({}, attributes, listeners), /*#__PURE__*/_react.default.createElement(_becoxyIcons.DragDrop, {
35
+ fontSize: 14
36
+ }))
37
+ );
38
+ };
39
+ function renderBodyCell(args) {
40
+ const {
41
+ row,
42
+ rowIndex,
43
+ column,
44
+ colIndex,
45
+ spanManager,
46
+ format,
47
+ Cell,
48
+ commandClick,
49
+ originData,
50
+ id,
51
+ verInfo,
52
+ hozInfo,
53
+ hoz,
54
+ leftFlatCount,
55
+ fullFlatCount,
56
+ rightFlatCount,
57
+ tbodyHtmlTag
58
+ } = args;
59
+ if (spanManager.testSkip(rowIndex, colIndex)) {
60
+ return null;
61
+ }
62
+ const value = _internals.internals.safeGetValue(column, row, rowIndex);
63
+ const cellProps = column.getCellProps?.(value, row, rowIndex) ?? {};
64
+ const a = (0, _useColumns.renderValueCell)(column, value, row, rowIndex, colIndex, format, false);
65
+
66
+ // let cellContent: ReactNode = value
67
+ let cellContent = a;
68
+
69
+ // if (column.render) {
70
+ // cellContent = column.render(value, row, rowIndex)
71
+ // }
72
+ // if (column.field === '#') {
73
+
74
+ // cellContent = findItemPath(originData, row, primaryKey)
75
+ // }
76
+
77
+ if (column.field === 'drag-handle') {
78
+ cellContent = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(RowDragHandleCell, {
79
+ rowId: row.rowId
80
+ }));
81
+ }
82
+ if (column.field === 'command') {
83
+ const commands = column.commandItems ? column.commandItems.map(it => {
84
+ return {
85
+ ...it,
86
+ visible: typeof it.visible === 'function' ? it.visible?.(row) : it.visible
87
+ };
88
+ }) : [];
89
+ cellContent = /*#__PURE__*/_react.default.createElement("div", {
90
+ className: "ui-rc_cell-content"
91
+ }, /*#__PURE__*/_react.default.createElement(_rcMasterUi.Space, null, commands.filter(it => it.visible !== false).map(item => {
92
+ return /*#__PURE__*/_react.default.createElement(_Command.default, {
93
+ id: id,
94
+ key: item.id,
95
+ item: item,
96
+ record: row,
97
+ onClick: () => {
98
+ commandClick?.({
99
+ id: item.id,
100
+ // rowId: getRowKey(record, index) as any,
101
+ rowId: row.rowId,
102
+ rowData: row,
103
+ index: rowIndex,
104
+ rows: [...originData]
105
+ });
106
+ }
107
+ });
108
+ })));
109
+ }
110
+ if (column.template) {
111
+ cellContent = column.template({
112
+ value,
113
+ rowData: row,
114
+ index: rowIndex,
115
+ field: column.field ?? ''
116
+ });
117
+ }
118
+
119
+ //
120
+
121
+ let colSpan = 1;
122
+ let rowSpan = 1;
123
+ if (column.getSpanRect) {
124
+ const spanRect = column.getSpanRect(value, row, rowIndex);
125
+ colSpan = spanRect == null ? 1 : spanRect.right - colIndex;
126
+ rowSpan = spanRect == null ? 1 : spanRect.bottom - rowIndex;
127
+ } else {
128
+ if (cellProps.colSpan != null) {
129
+ colSpan = cellProps.colSpan;
130
+ }
131
+ if (cellProps.rowSpan != null) {
132
+ rowSpan = cellProps.rowSpan;
133
+ }
134
+ }
135
+
136
+ // rowSpan/colSpan should not be too large to avoid affecting cells that are not rendered due to virtual scrolling
137
+ rowSpan = Math.min(rowSpan, verInfo.limit - rowIndex);
138
+ colSpan = Math.min(colSpan, leftFlatCount + hoz.rightIndex - colIndex);
139
+ const hasSpan = colSpan > 1 || rowSpan > 1;
140
+ if (hasSpan) {
141
+ spanManager.add(rowIndex, colIndex, colSpan, rowSpan);
142
+ }
143
+ const positionStyle = {};
144
+ if (colIndex < leftFlatCount) {
145
+ positionStyle.position = 'sticky';
146
+ positionStyle.left = hozInfo.stickyLeftMap.get(colIndex);
147
+ } else if (colIndex >= fullFlatCount - rightFlatCount) {
148
+ positionStyle.position = 'sticky';
149
+ positionStyle.right = hozInfo.stickyRightMap.get(colIndex);
150
+ }
151
+ const tdProps = {
152
+ ...cellProps,
153
+ className: (0, _classnames.default)(_styles.Classes.tableCell, cellProps.className, {
154
+ first: colIndex === 0,
155
+ last: colIndex + colSpan === fullFlatCount,
156
+ 'lock-left': colIndex < leftFlatCount,
157
+ 'lock-right': colIndex >= fullFlatCount - rightFlatCount
158
+ }),
159
+ ...(hasSpan ? {
160
+ colSpan,
161
+ rowSpan
162
+ } : null),
163
+ style: {
164
+ textAlign: column.textAlign,
165
+ ...cellProps.style,
166
+ ...positionStyle
167
+ },
168
+ // children: <div className='ui-rc_cell-content'>{cellContent}</div>
169
+
170
+ children: cellContent
171
+ // children: () => {
172
+ // return (
173
+ // <span className='abcccc'>{cellContent}</span>
174
+ // )
175
+ // },
176
+ };
177
+ if (tbodyHtmlTag === 'tfoot') {
178
+ if (!_hooks.nonActionColumn.includes(column.field) && column.isSummary !== false) {
179
+ return /*#__PURE__*/_react.default.createElement("td", (0, _extends2.default)({
180
+ key: colIndex
181
+ }, tdProps));
182
+ } else {
183
+ return /*#__PURE__*/_react.default.createElement("td", (0, _extends2.default)({
184
+ key: colIndex
185
+ }, tdProps), '');
186
+ }
187
+ }
188
+ if (Cell != null && tbodyHtmlTag === 'tbody') {
189
+ return /*#__PURE__*/_react.default.createElement(Cell, {
190
+ key: colIndex,
191
+ tdProps: tdProps,
192
+ row: row,
193
+ rowIndex: rowIndex,
194
+ column: column,
195
+ colIndex: colIndex
196
+ });
197
+ } else {
198
+ return /*#__PURE__*/_react.default.createElement("td", (0, _extends2.default)({
199
+ key: colIndex
200
+ }, tdProps));
201
+ }
202
+ }
203
+ const RenderRow = props => {
204
+ const {
205
+ verInfo,
206
+ hozInfo,
207
+ spanManager,
208
+ getRowProps,
209
+ row,
210
+ i,
211
+ tbodyHtmlTag,
212
+ primaryKey,
213
+ Row,
214
+ fullFlatCount,
215
+ hoz,
216
+ leftFlatCount,
217
+ rightFlatCount,
218
+ id,
219
+ originData,
220
+ Cell,
221
+ commandClick,
222
+ format
223
+ } = props;
224
+ const {
225
+ transform,
226
+ transition,
227
+ setNodeRef,
228
+ isDragging
229
+ } = (0, _sortable.useSortable)({
230
+ id: row.rowId
231
+ });
232
+ const rowIndex = verInfo.offset + i;
233
+ spanManager.stripUpwards(rowIndex);
234
+ const rowProps = getRowProps(row, rowIndex);
235
+ const rowClass = (0, _classnames.default)(_styles.Classes.tableRow, {
236
+ first: rowIndex === verInfo.first,
237
+ last: rowIndex === verInfo.last,
238
+ even: rowIndex % 2 === 0,
239
+ odd: rowIndex % 2 === 1
240
+ }, rowProps?.className);
241
+ const onContextMenu = rowProps?.onContextMenu;
242
+ const style = {
243
+ transform: _utilities.CSS.Translate.toString(transform),
244
+ // translate instead of transform to avoid squishing
245
+ transition: transition,
246
+ opacity: isDragging ? 0.8 : 1,
247
+ zIndex: isDragging ? 1 : 0,
248
+ position: 'relative'
249
+ };
250
+ const trProps = {
251
+ ...rowProps,
252
+ ref: setNodeRef,
253
+ className: rowClass,
254
+ style: {
255
+ ...rowProps.style,
256
+ ...style
257
+ },
258
+ onContextMenu: tbodyHtmlTag === 'tbody' ? onContextMenu : undefined,
259
+ 'data-rowindex': rowIndex,
260
+ children: hozInfo.visible.map(descriptor => {
261
+ if (descriptor.type === 'blank') {
262
+ return /*#__PURE__*/_react.default.createElement("td", {
263
+ key: descriptor.blankSide
264
+ });
265
+ }
266
+ return renderBodyCell({
267
+ row,
268
+ rowIndex,
269
+ column: descriptor.col,
270
+ colIndex: descriptor.colIndex,
271
+ fullFlatCount,
272
+ hoz,
273
+ hozInfo,
274
+ id,
275
+ leftFlatCount,
276
+ rightFlatCount,
277
+ originData,
278
+ spanManager,
279
+ tbodyHtmlTag,
280
+ verInfo,
281
+ Cell,
282
+ commandClick,
283
+ format
284
+ });
285
+ })
286
+ };
287
+ const key = _internals.internals.safeGetRowKey(primaryKey, row, rowIndex);
288
+ if (Row != null && tbodyHtmlTag === 'tbody') {
289
+ return /*#__PURE__*/_react.default.createElement(Row, {
290
+ key,
291
+ row,
292
+ rowIndex,
293
+ trProps
294
+ });
295
+ } else {
296
+ return /*#__PURE__*/_react.default.createElement("tr", (0, _extends2.default)({
297
+ key: key
298
+ }, trProps));
299
+ }
300
+ };
301
+ function HtmlTable({
302
+ tbodyHtmlTag,
303
+ getRowProps,
304
+ primaryKey,
305
+ data,
306
+ originData,
307
+ format,
308
+ commandClick,
309
+ id,
310
+ verticalRenderInfo: verInfo,
311
+ horizontalRenderInfo: hozInfo,
312
+ components: {
313
+ Row,
314
+ Cell,
315
+ TableBody
316
+ }
317
+ }) {
318
+ const {
319
+ flat,
320
+ horizontalRenderRange: hoz
321
+ } = hozInfo;
322
+ const spanManager = new _SpanManager.default();
323
+ const fullFlatCount = flat.full.length;
324
+ const leftFlatCount = flat.left.length;
325
+ const rightFlatCount = flat.right.length;
326
+ const tbody = TableBody != null && tbodyHtmlTag === 'tbody' ? /*#__PURE__*/_react.default.createElement(TableBody, {
327
+ tbodyProps: {
328
+ children: data.map((row, i) => {
329
+ return /*#__PURE__*/_react.default.createElement(RenderRow, {
330
+ key: row.rowid,
331
+ getRowProps: getRowProps,
332
+ hozInfo: hozInfo,
333
+ i: i,
334
+ primaryKey: primaryKey,
335
+ row: row,
336
+ spanManager: spanManager,
337
+ tbodyHtmlTag: tbodyHtmlTag,
338
+ verInfo: verInfo,
339
+ Row: Row,
340
+ fullFlatCount: fullFlatCount,
341
+ leftFlatCount: leftFlatCount,
342
+ rightFlatCount: rightFlatCount,
343
+ Cell: Cell,
344
+ hoz: hoz,
345
+ id: id,
346
+ originData: originData,
347
+ commandClick: commandClick,
348
+ format: format
349
+ });
350
+ })
351
+ }
352
+ }) : ( /*#__PURE__*/_react.default.createElement(tbodyHtmlTag, null, data.map((row, i) => {
353
+ return /*#__PURE__*/_react.default.createElement(RenderRow, {
354
+ key: row.rowid,
355
+ getRowProps: getRowProps,
356
+ hozInfo: hozInfo,
357
+ i: i,
358
+ primaryKey: primaryKey,
359
+ row: row,
360
+ spanManager: spanManager,
361
+ tbodyHtmlTag: tbodyHtmlTag,
362
+ verInfo: verInfo,
363
+ Row: Row,
364
+ fullFlatCount: fullFlatCount,
365
+ leftFlatCount: leftFlatCount,
366
+ rightFlatCount: rightFlatCount,
367
+ Cell: Cell,
368
+ hoz: hoz,
369
+ id: id,
370
+ originData: originData,
371
+ commandClick: commandClick,
372
+ format: format
373
+ });
374
+ })));
375
+ return /*#__PURE__*/_react.default.createElement("table", null, /*#__PURE__*/_react.default.createElement(_colgroup.Colgroup, {
376
+ descriptors: hozInfo.visible
377
+ }), tbody);
378
+
379
+ // function renderRow(row: any, i: number) {
380
+ // const rowIndex = verInfo.offset + i
381
+ // spanManager.stripUpwards(rowIndex)
382
+
383
+ // const rowProps = getRowProps(row, rowIndex)
384
+
385
+ // const rowClass = cx(
386
+ // Classes.tableRow,
387
+ // {
388
+ // first: rowIndex === verInfo.first,
389
+ // last: rowIndex === verInfo.last,
390
+ // even: rowIndex % 2 === 0,
391
+ // odd: rowIndex % 2 === 1,
392
+ // },
393
+ // rowProps?.className,
394
+ // )
395
+
396
+ // const onContextMenu = rowProps?.onContextMenu
397
+
398
+ // const trProps = {
399
+ // ...rowProps,
400
+ // className: rowClass,
401
+ // onContextMenu: tbodyHtmlTag === 'tbody' ? onContextMenu : undefined,
402
+ // 'data-rowindex': rowIndex,
403
+ // children: hozInfo.visible.map((descriptor) => {
404
+ // if (descriptor.type === 'blank') {
405
+ // return <td key={descriptor.blankSide} />
406
+ // }
407
+ // return renderBodyCell(row, rowIndex, descriptor.col, descriptor.colIndex)
408
+ // }),
409
+ // }
410
+
411
+ // const key = internals.safeGetRowKey(primaryKey, row, rowIndex)
412
+
413
+ // if (Row != null && tbodyHtmlTag === 'tbody') {
414
+
415
+ // return React.createElement(Row, { key, row, rowIndex, trProps })
416
+
417
+ // } else {
418
+
419
+ // return <tr key={key} {...trProps} />
420
+
421
+ // }
422
+
423
+ // }
424
+ }