vxe-table 3.16.0-beta.1 → 3.16.0-beta.2

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 (73) hide show
  1. package/es/grid/src/grid.js +17 -5
  2. package/es/index.css +1 -1
  3. package/es/index.min.css +1 -1
  4. package/es/style.css +1 -1
  5. package/es/style.min.css +1 -1
  6. package/es/table/module/custom/mixin.js +0 -4
  7. package/es/table/module/custom/panel.js +0 -1
  8. package/es/table/src/anime.js +46 -0
  9. package/es/table/src/body.js +15 -40
  10. package/es/table/src/columnInfo.js +5 -0
  11. package/es/table/src/footer.js +1 -19
  12. package/es/table/src/header.js +1 -19
  13. package/es/table/src/methods.js +532 -346
  14. package/es/table/src/table.js +21 -2
  15. package/es/table/style.css +8 -8
  16. package/es/table/style.min.css +1 -1
  17. package/es/ui/index.js +2 -1
  18. package/es/ui/src/log.js +1 -1
  19. package/es/vxe-table/style.css +8 -8
  20. package/es/vxe-table/style.min.css +1 -1
  21. package/lib/grid/src/grid.js +22 -7
  22. package/lib/grid/src/grid.min.js +1 -1
  23. package/lib/index.css +1 -1
  24. package/lib/index.min.css +1 -1
  25. package/lib/index.umd.js +642 -436
  26. package/lib/index.umd.min.js +1 -1
  27. package/lib/style.css +1 -1
  28. package/lib/style.min.css +1 -1
  29. package/lib/table/module/custom/mixin.js +0 -4
  30. package/lib/table/module/custom/mixin.min.js +1 -1
  31. package/lib/table/module/custom/panel.js +0 -1
  32. package/lib/table/module/custom/panel.min.js +1 -1
  33. package/lib/table/src/anime.js +56 -0
  34. package/lib/table/src/anime.min.js +1 -0
  35. package/lib/table/src/body.js +3 -28
  36. package/lib/table/src/body.min.js +1 -1
  37. package/lib/table/src/columnInfo.js +5 -0
  38. package/lib/table/src/columnInfo.min.js +1 -1
  39. package/lib/table/src/footer.js +1 -19
  40. package/lib/table/src/footer.min.js +1 -1
  41. package/lib/table/src/header.js +1 -19
  42. package/lib/table/src/header.min.js +1 -1
  43. package/lib/table/src/methods.js +539 -355
  44. package/lib/table/src/methods.min.js +1 -1
  45. package/lib/table/src/table.js +21 -1
  46. package/lib/table/src/table.min.js +1 -1
  47. package/lib/table/style/style.css +8 -8
  48. package/lib/table/style/style.min.css +1 -1
  49. package/lib/ui/index.js +2 -1
  50. package/lib/ui/index.min.js +1 -1
  51. package/lib/ui/src/log.js +1 -1
  52. package/lib/ui/src/log.min.js +1 -1
  53. package/lib/vxe-table/style/style.css +8 -8
  54. package/lib/vxe-table/style/style.min.css +1 -1
  55. package/package.json +1 -1
  56. package/packages/grid/src/grid.ts +19 -6
  57. package/packages/table/module/custom/mixin.ts +0 -4
  58. package/packages/table/module/custom/panel.ts +0 -1
  59. package/packages/table/src/anime.ts +52 -0
  60. package/packages/table/src/body.ts +15 -40
  61. package/packages/table/src/columnInfo.ts +5 -0
  62. package/packages/table/src/footer.ts +1 -19
  63. package/packages/table/src/header.ts +1 -20
  64. package/packages/table/src/methods.ts +554 -360
  65. package/packages/table/src/table.ts +21 -2
  66. package/packages/ui/index.ts +1 -0
  67. package/styles/components/table.scss +9 -9
  68. /package/es/{iconfont.1750910486943.ttf → iconfont.1751194972120.ttf} +0 -0
  69. /package/es/{iconfont.1750910486943.woff → iconfont.1751194972120.woff} +0 -0
  70. /package/es/{iconfont.1750910486943.woff2 → iconfont.1751194972120.woff2} +0 -0
  71. /package/lib/{iconfont.1750910486943.ttf → iconfont.1751194972120.ttf} +0 -0
  72. /package/lib/{iconfont.1750910486943.woff → iconfont.1751194972120.woff} +0 -0
  73. /package/lib/{iconfont.1750910486943.woff2 → iconfont.1751194972120.woff2} +0 -0
@@ -11,7 +11,7 @@ import { getSlotVNs } from '../../ui/src/vn'
11
11
  import { warnLog, errLog } from '../../ui/src/log'
12
12
 
13
13
  import type { VxeFormComponent, VxePagerComponent, VxeFormItemProps, VxeFormDefines, VxeComponentStyleType, VxeComponentSizeType, ValueOf } from 'vxe-pc-ui'
14
- import type { GridReactData, VxeTablePropTypes, VxeGridConstructor, VxeToolbarPropTypes, VxeToolbarInstance, VxeGridPropTypes, VxeTableMethods, VxeGridEmits, VxePagerDefines, VxeTableConstructor, VxeTableDefines, VxeTablePrivateMethods } from '../../../types'
14
+ import type { GridReactData, VxeTablePropTypes, VxeGridConstructor, VxeToolbarPropTypes, VxeToolbarInstance, VxeGridPropTypes, VxeTableMethods, VxeGridEmits, VxePagerDefines, VxeTableConstructor, VxeTableDefines, VxeTablePrivateMethods, TableInternalData } from '../../../types'
15
15
 
16
16
  const { getConfig, getI18n, commands, globalEvents, globalMixins, createEvent, GLOBAL_EVENT_KEYS, renderEmptyElement } = VxeUI
17
17
 
@@ -232,11 +232,12 @@ export default /* define-vxe-component start */ defineVxeComponent({
232
232
  const props = $xeGrid
233
233
  const reactData = $xeGrid.reactData
234
234
 
235
- const { seqConfig, pagerConfig, loading, editConfig, proxyConfig } = props
236
- const { isZMax, tableLoading, tablePage } = reactData
235
+ const { seqConfig, pagerConfig, editConfig, proxyConfig } = props
236
+ const { isZMax, tablePage } = reactData
237
237
  const tableExtendProps = $xeGrid.computeTableExtendProps as any
238
238
  const proxyOpts = $xeGrid.computeProxyOpts
239
239
  const pagerOpts = $xeGrid.computePagerOpts
240
+ const isLoading = $xeGrid.computeIsLoading
240
241
  const tProps = Object.assign({}, tableExtendProps)
241
242
  if (isZMax) {
242
243
  if (tableExtendProps.maxHeight) {
@@ -246,7 +247,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
246
247
  }
247
248
  }
248
249
  if (proxyConfig && isEnableConf(proxyOpts)) {
249
- tProps.loading = loading || tableLoading
250
+ tProps.loading = isLoading
250
251
  if (pagerConfig && proxyOpts.seq && isEnableConf(pagerOpts)) {
251
252
  tProps.seqConfig = Object.assign({}, seqConfig, { startIndex: (tablePage.currentPage - 1) * tablePage.pageSize })
252
253
  }
@@ -307,6 +308,17 @@ export default /* define-vxe-component start */ defineVxeComponent({
307
308
 
308
309
  const pagerOpts = $xeGrid.computePagerOpts as VxeGridPropTypes.PagerConfig
309
310
  return pagerOpts.total
311
+ },
312
+ computeIsLoading () {
313
+ const $xeGrid = this
314
+ const props = $xeGrid
315
+ const reactData = ($xeGrid as any).reactData as GridReactData
316
+
317
+ const { loading, proxyConfig } = props
318
+ const { tableLoading } = reactData
319
+ const proxyOpts = $xeGrid.computeProxyOpts as VxeGridPropTypes.ProxyConfig
320
+ const { showLoading } = proxyOpts
321
+ return loading || (tableLoading && showLoading && proxyConfig && isEnableConf(proxyOpts))
310
322
  }
311
323
  },
312
324
  watch: {
@@ -656,7 +668,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
656
668
  reactData.formData = formData
657
669
  }
658
670
  if ($xeTable) {
659
- const { internalData: tableInternalData } = $xeTable
671
+ const tableInternalData = $xeTable as unknown as TableInternalData
660
672
  const { tableFullColumn, fullColumnFieldData } = tableInternalData
661
673
  const sortOpts = $xeTable.computeSortOpts
662
674
  let defaultSort = sortOpts.defaultSort
@@ -1537,6 +1549,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
1537
1549
 
1538
1550
  const vSize = $xeGrid.computeSize
1539
1551
  const styles = $xeGrid.computeStyles
1552
+ const isLoading = $xeGrid.computeIsLoading
1540
1553
  return h('div', {
1541
1554
  ref: 'refElem',
1542
1555
  class: ['vxe-grid', {
@@ -1544,7 +1557,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
1544
1557
  'is--animat': !!props.animat,
1545
1558
  'is--round': props.round,
1546
1559
  'is--maximize': reactData.isZMax,
1547
- 'is--loading': props.loading || reactData.tableLoading
1560
+ 'is--loading': isLoading
1548
1561
  }],
1549
1562
  style: styles
1550
1563
  }, $xeGrid.renderLayout(h))
@@ -96,10 +96,6 @@ export default {
96
96
  }
97
97
  })
98
98
  reactData.isCustomStatus = true
99
- reactData.isDragColMove = true
100
- setTimeout(() => {
101
- reactData.isDragColMove = false
102
- }, 1000)
103
99
  return $xeTable.saveCustomStore('confirm').then(() => {
104
100
  if (allowGroup && allowValues && ($xeTable as any).handlePivotTableAggregateData) {
105
101
  if (rowGroupList.length !== aggHandleFields.length || rowGroupList.some((conf, i) => conf.field !== aggHandleFields[i])) {
@@ -1358,7 +1358,6 @@ export default {
1358
1358
  customColumnList.splice(nafIndex + dragOffsetIndex, 0, dragColumn)
1359
1359
  }
1360
1360
 
1361
- tableReactData.isDragColMove = true
1362
1361
  if (mouseConfig) {
1363
1362
  if ($xeTable.clearSelected) {
1364
1363
  $xeTable.clearSelected()
@@ -0,0 +1,52 @@
1
+
2
+ import XEUtils from 'xe-utils'
3
+ import { addClass, removeClass } from '../../ui/src/dom'
4
+
5
+ const rowMoveCls = 'row--drag-move'
6
+ const colMoveClass = 'col--drag-move'
7
+
8
+ /**
9
+ * 上下拖拽
10
+ */
11
+ export function moveRowAnimateToTb (elemList: NodeListOf<HTMLElement> | HTMLDivElement[], offsetTop: number) {
12
+ XEUtils.arrayEach(elemList, trEl => {
13
+ trEl.style.transform = `translateY(${offsetTop}px)`
14
+ })
15
+ requestAnimationFrame(() => {
16
+ XEUtils.arrayEach(elemList, trEl => {
17
+ addClass(trEl, rowMoveCls)
18
+ trEl.style.transform = ''
19
+ })
20
+ })
21
+ }
22
+
23
+ export function clearRowAnimate (elem: HTMLElement | undefined) {
24
+ setTimeout(() => {
25
+ if (elem) {
26
+ XEUtils.arrayEach(elem.querySelectorAll(`.vxe-body--row.${rowMoveCls}`), elem => removeClass(elem, rowMoveCls))
27
+ }
28
+ }, 500)
29
+ }
30
+
31
+ /**
32
+ * 左右拖拽
33
+ */
34
+ export function moveColAnimateToLr (elemList: NodeListOf<HTMLElement> | HTMLDivElement[], offsetLeft: number) {
35
+ XEUtils.arrayEach(elemList, trEl => {
36
+ trEl.style.transform = `translateX(${offsetLeft}px)`
37
+ })
38
+ requestAnimationFrame(() => {
39
+ XEUtils.arrayEach(elemList, trEl => {
40
+ addClass(trEl, colMoveClass)
41
+ trEl.style.transform = ''
42
+ })
43
+ })
44
+ }
45
+
46
+ export function clearColAnimate (elem: HTMLElement | undefined) {
47
+ setTimeout(() => {
48
+ if (elem) {
49
+ XEUtils.arrayEach(elem.querySelectorAll(`.vxe-table--column.${colMoveClass}`), elem => removeClass(elem, colMoveClass))
50
+ }
51
+ }, 500)
52
+ }
@@ -425,7 +425,7 @@ function renderTdColumn (
425
425
 
426
426
  return h('td', {
427
427
  class: [
428
- 'vxe-body--column',
428
+ 'vxe-table--column vxe-body--column',
429
429
  colid,
430
430
  cellVerticalAlign ? `col--vertical-${cellVerticalAlign}` : '',
431
431
  cellAlign ? `col--${cellAlign}` : '',
@@ -469,7 +469,7 @@ function renderRows (h: CreateElement, _vm: any, fixedType: 'left' | 'right' | '
469
469
  const $xeGrid = $xeTable.$xeGrid
470
470
 
471
471
  const { stripe, rowKey, highlightHoverRow, rowClassName, rowStyle, editConfig, treeConfig } = tableProps
472
- const { hasFixedColumn, treeExpandedFlag, isColLoading, scrollXLoad, scrollYLoad, isAllOverflow, rowExpandedFlag, expandColumn, selectRadioRow, pendingRowFlag, isDragColMove, rowExpandHeightFlag, isRowGroupStatus } = tableReactData
472
+ const { hasFixedColumn, treeExpandedFlag, scrollXLoad, scrollYLoad, isAllOverflow, rowExpandedFlag, expandColumn, selectRadioRow, pendingRowFlag, rowExpandHeightFlag, isRowGroupStatus } = tableReactData
473
473
  const { fullAllDataRowIdData, fullColumnIdData, treeExpandedMaps, pendingRowMaps, rowExpandedMaps } = tableInternalData
474
474
  const checkboxOpts = $xeTable.computeCheckboxOpts
475
475
  const radioOpts = $xeTable.computeRadioOpts
@@ -477,7 +477,6 @@ function renderRows (h: CreateElement, _vm: any, fixedType: 'left' | 'right' | '
477
477
  const editOpts = $xeTable.computeEditOpts
478
478
  const rowOpts = $xeTable.computeRowOpts
479
479
  const columnOpts = $xeTable.computeColumnOpts
480
- const columnDragOpts = $xeTable.computeColumnDragOpts
481
480
  const { transform, seqMode } = treeOpts
482
481
  const childrenField = treeOpts.children || treeOpts.childrenField
483
482
  const rows: any[] = []
@@ -558,29 +557,15 @@ function renderRows (h: CreateElement, _vm: any, fixedType: 'left' | 'right' | '
558
557
  return renderTdColumn(h, $xeTable, seq, rowid, fixedType, isOptimizeMode, rowLevel, row, rowIndex, $rowIndex, _rowIndex, column, $columnIndex, tableColumn, tableData)
559
558
  })
560
559
  rows.push(
561
- !isColLoading && (columnOpts.drag && columnDragOpts.animation)
562
- ? h('transition-group', {
563
- props: {
564
- tag: 'tr',
565
- name: `vxe-header--col-list${isDragColMove ? '' : '-disabled'}`
566
- },
567
- class: trClass,
568
- attrs: {
569
- rowid
570
- },
571
- style: rowStyle ? (XEUtils.isFunction(rowStyle) ? rowStyle(params) : rowStyle) as VxeComponentStyleType : undefined,
572
- key: rowKey || scrollXLoad || scrollYLoad || rowOpts.useKey || rowOpts.drag || columnOpts.drag || isRowGroupStatus || treeConfig ? rowid : $rowIndex,
573
- nativeOn: trOn
574
- }, tdVNs)
575
- : h('tr', {
576
- class: trClass,
577
- attrs: {
578
- rowid
579
- },
580
- style: rowStyle ? (XEUtils.isFunction(rowStyle) ? rowStyle(params) : rowStyle) as VxeComponentStyleType : undefined,
581
- key: rowKey || scrollXLoad || scrollYLoad || rowOpts.useKey || rowOpts.drag || columnOpts.drag || isRowGroupStatus || treeConfig ? rowid : $rowIndex,
582
- on: trOn
583
- }, tdVNs)
560
+ h('tr', {
561
+ class: trClass,
562
+ attrs: {
563
+ rowid
564
+ },
565
+ style: rowStyle ? (XEUtils.isFunction(rowStyle) ? rowStyle(params) : rowStyle) as VxeComponentStyleType : undefined,
566
+ key: rowKey || scrollXLoad || scrollYLoad || rowOpts.useKey || rowOpts.drag || columnOpts.drag || isRowGroupStatus || treeConfig ? rowid : $rowIndex,
567
+ on: trOn
568
+ }, tdVNs)
584
569
  )
585
570
  // 如果行被展开了
586
571
  if (isExpandRow) {
@@ -744,12 +729,10 @@ export default {
744
729
  const { fixedColumn, fixedType, tableColumn } = props
745
730
 
746
731
  const { spanMethod, footerSpanMethod, mouseConfig } = tableProps
747
- const { isGroup, tableData, isRowLoading, isColLoading, overflowX, scrollXLoad, scrollYLoad, isAllOverflow, isDragRowMove, expandColumn, dragRow, dragCol } = tableReactData
732
+ const { isGroup, tableData, isColLoading, overflowX, scrollXLoad, scrollYLoad, isAllOverflow, expandColumn, dragRow, dragCol } = tableReactData
748
733
  const { visibleColumn, fullAllDataRowIdData, fullColumnIdData } = tableInternalData
749
- const rowOpts = $xeTable.computeRowOpts
750
734
  const emptyOpts = $xeTable.computeEmptyOpts
751
735
  const mouseOpts = $xeTable.computeMouseOpts
752
- const rowDragOpts = $xeTable.computeRowDragOpts
753
736
  const expandOpts = $xeTable.computeExpandOpts
754
737
 
755
738
  let renderDataList = tableData
@@ -895,17 +878,9 @@ export default {
895
878
  /**
896
879
  * 内容
897
880
  */
898
- !(isRowLoading || isColLoading) && (rowOpts.drag && rowDragOpts.animation)
899
- ? h('transition-group', {
900
- ref: 'refBodyTBody',
901
- props: {
902
- tag: 'tbody',
903
- name: `vxe-body--row-list${isDragRowMove ? '' : '-disabled'}`
904
- }
905
- }, renderRows(h, this, fixedType, isOptimizeMode, renderDataList, renderColumnList))
906
- : h('tbody', {
907
- ref: 'refBodyTBody'
908
- }, renderRows(h, this, fixedType, isOptimizeMode, renderDataList, renderColumnList))
881
+ h('tbody', {
882
+ ref: 'refBodyTBody'
883
+ }, renderRows(h, this, fixedType, isOptimizeMode, renderDataList, renderColumnList))
909
884
  ]),
910
885
  h('div', {
911
886
  class: 'vxe-table--checkbox-range'
@@ -53,6 +53,11 @@ export class ColumnInfo {
53
53
  }
54
54
  }
55
55
  }
56
+ if (_vm.aggFunc) {
57
+ if (!$xeTable.handlePivotTableAggregateData && _vm.aggFunc !== true) {
58
+ errLog('vxe.error.errProp', [`column.agg-func=${_vm.aggFunc}`, 'column.agg-func=true'])
59
+ }
60
+ }
56
61
 
57
62
  Object.assign(this, {
58
63
  // 基本属性
@@ -145,7 +145,7 @@ function renderRows (h: CreateElement, _vm: any, isOptimizeMode: boolean, tableC
145
145
  }
146
146
 
147
147
  return h('td', {
148
- class: ['vxe-footer--column', column.id, {
148
+ class: ['vxe-table--column vxe-footer--column', column.id, {
149
149
  [`col--${footAlign}`]: footAlign,
150
150
  [`col--${type}`]: type,
151
151
  'col--last': isLastColumn,
@@ -199,33 +199,15 @@ function renderHeads (h: CreateElement, _vm: any, isOptimizeMode: boolean, rende
199
199
  const props = _vm
200
200
  const $xeTable = _vm.$parent as VxeTableConstructor & VxeTablePrivateMethods
201
201
  const tableProps = $xeTable
202
- const tableReactData = $xeTable as unknown as TableReactData
203
202
 
204
203
  const { fixedType, footerTableData } = props
205
204
 
206
205
  const { footerRowClassName, footerRowStyle } = tableProps
207
- const { isColLoading, isDragColMove } = tableReactData
208
- const columnOpts = $xeTable.computeColumnOpts
209
- const columnDragOpts = $xeTable.computeColumnDragOpts
210
206
 
211
207
  return (footerTableData as any[][]).map((row, $rowIndex) => {
212
208
  const _rowIndex = $rowIndex
213
209
  const rowParams = { $table: $xeTable, row, _rowIndex, $rowIndex, fixed: fixedType, type: renderType }
214
210
 
215
- if (!isColLoading && columnOpts.drag && columnDragOpts.animation) {
216
- return h('transition-group', {
217
- key: $rowIndex,
218
- props: {
219
- tag: 'tr',
220
- name: `vxe-header--col-list${isDragColMove ? '' : '-disabled'}`,
221
- class: [
222
- 'vxe-footer--row',
223
- footerRowClassName ? XEUtils.isFunction(footerRowClassName) ? footerRowClassName(rowParams) : footerRowClassName : ''
224
- ],
225
- style: footerRowStyle ? (XEUtils.isFunction(footerRowStyle) ? footerRowStyle(rowParams) : footerRowStyle) as VxeComponentStyleType : undefined
226
- }
227
- }, renderRows(h, _vm, isOptimizeMode, renderColumnList, footerTableData, row, $rowIndex, _rowIndex))
228
- }
229
211
  return h('tr', {
230
212
  key: $rowIndex,
231
213
  class: [
@@ -116,7 +116,7 @@ const renderRows = (h: CreateElement, _vm: any, isGroup: boolean, isOptimizeMode
116
116
  }
117
117
 
118
118
  return h('th', {
119
- class: ['vxe-header--column', colid, {
119
+ class: ['vxe-table--column vxe-header--column', colid, {
120
120
  [`col--${headAlign}`]: headAlign,
121
121
  [`col--${type}`]: type,
122
122
  'col--last': isLastColumn,
@@ -175,33 +175,14 @@ function renderHeads (h: CreateElement, _vm: any, isGroup: boolean, isOptimizeMo
175
175
  const props = _vm
176
176
  const $xeTable = _vm.$parent as VxeTableConstructor & VxeTablePrivateMethods
177
177
  const tableProps = $xeTable
178
- const tableReactData = $xeTable as unknown as TableReactData
179
178
 
180
179
  const { fixedType } = props
181
180
 
182
- const columnOpts = $xeTable.computeColumnOpts
183
- const columnDragOpts = $xeTable.computeColumnDragOpts
184
-
185
181
  const { headerRowClassName, headerRowStyle } = tableProps
186
- const { isColLoading, isDragColMove } = tableReactData
187
182
 
188
183
  return headerGroups.map((cols: any, $rowIndex: any) => {
189
184
  const params = { $table: $xeTable, $rowIndex, fixed: fixedType, type: cellType }
190
185
 
191
- if (!isColLoading && columnOpts.drag && columnDragOpts.animation) {
192
- return h('transition-group', {
193
- key: $rowIndex,
194
- props: {
195
- tag: 'tr',
196
- name: `vxe-header--col-list${isDragColMove ? '' : '-disabled'}`,
197
- class: [
198
- 'vxe-header--row',
199
- headerRowClassName ? XEUtils.isFunction(headerRowClassName) ? headerRowClassName(params) : headerRowClassName : ''
200
- ],
201
- style: headerRowStyle ? (XEUtils.isFunction(headerRowStyle) ? headerRowStyle(params) : headerRowStyle) : null
202
- }
203
- }, renderRows(h, _vm, isGroup, isOptimizeMode, cols, $rowIndex))
204
- }
205
186
  return h('tr', {
206
187
  key: $rowIndex,
207
188
  class: [