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