vxe-table 4.13.39 → 4.13.41

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 (222) hide show
  1. package/README.en.md +2 -0
  2. package/README.ja-JP.md +2 -0
  3. package/README.md +3 -0
  4. package/README.zh-TW.md +3 -1
  5. package/es/grid/src/grid.js +21 -6
  6. package/es/{iconfont.1749800539928.ttf → iconfont.1750153812846.ttf} +0 -0
  7. package/es/iconfont.1750153812846.woff +0 -0
  8. package/es/iconfont.1750153812846.woff2 +0 -0
  9. package/es/index.css +1 -1
  10. package/es/index.min.css +1 -1
  11. package/es/locale/lang/ar-EG.js +6 -0
  12. package/es/locale/lang/de-DE.js +6 -0
  13. package/es/locale/lang/en-US.js +6 -0
  14. package/es/locale/lang/es-ES.js +6 -0
  15. package/es/locale/lang/fr-FR.js +6 -0
  16. package/es/locale/lang/hu-HU.js +6 -0
  17. package/es/locale/lang/hy-AM.js +6 -0
  18. package/es/locale/lang/id-ID.js +6 -0
  19. package/es/locale/lang/it-IT.js +6 -0
  20. package/es/locale/lang/ja-JP.js +6 -0
  21. package/es/locale/lang/ko-KR.js +6 -0
  22. package/es/locale/lang/ms-MY.js +6 -0
  23. package/es/locale/lang/nb-NO.js +6 -0
  24. package/es/locale/lang/pt-BR.js +6 -0
  25. package/es/locale/lang/ru-RU.js +6 -0
  26. package/es/locale/lang/th-TH.js +6 -0
  27. package/es/locale/lang/ug-CN.js +6 -0
  28. package/es/locale/lang/uk-UA.js +6 -0
  29. package/es/locale/lang/uz-UZ.js +6 -0
  30. package/es/locale/lang/vi-VN.js +6 -0
  31. package/es/locale/lang/zh-CHT.js +6 -0
  32. package/es/locale/lang/zh-CN.js +6 -0
  33. package/es/style.css +1 -1
  34. package/es/style.min.css +1 -1
  35. package/es/table/module/custom/hook.js +29 -4
  36. package/es/table/module/custom/panel.js +105 -93
  37. package/es/table/module/export/export-panel.js +3 -2
  38. package/es/table/module/export/import-panel.js +3 -2
  39. package/es/table/module/filter/panel.js +3 -2
  40. package/es/table/module/menu/panel.js +3 -2
  41. package/es/table/src/body.js +7 -5
  42. package/es/table/src/cell.js +14 -14
  43. package/es/table/src/column.js +3 -2
  44. package/es/table/src/footer.js +3 -2
  45. package/es/table/src/group.js +3 -2
  46. package/es/table/src/header.js +3 -2
  47. package/es/table/src/props.js +28 -7
  48. package/es/table/src/table.js +64 -47
  49. package/es/table/style.css +22 -3
  50. package/es/table/style.min.css +1 -1
  51. package/es/toolbar/src/toolbar.js +155 -61
  52. package/es/ui/index.js +12 -1
  53. package/es/ui/src/comp.js +2 -0
  54. package/es/ui/src/log.js +1 -1
  55. package/es/vxe-table/style.css +22 -3
  56. package/es/vxe-table/style.min.css +1 -1
  57. package/lib/grid/src/grid.js +20 -5
  58. package/lib/grid/src/grid.min.js +1 -1
  59. package/lib/{iconfont.1749800539928.ttf → iconfont.1750153812846.ttf} +0 -0
  60. package/lib/iconfont.1750153812846.woff +0 -0
  61. package/lib/iconfont.1750153812846.woff2 +0 -0
  62. package/lib/index.css +1 -1
  63. package/lib/index.min.css +1 -1
  64. package/lib/index.umd.js +350 -150
  65. package/lib/index.umd.min.js +1 -1
  66. package/lib/locale/lang/ar-EG.js +6 -0
  67. package/lib/locale/lang/ar-EG.min.js +1 -1
  68. package/lib/locale/lang/ar-EG.umd.js +6 -0
  69. package/lib/locale/lang/de-DE.js +6 -0
  70. package/lib/locale/lang/de-DE.min.js +1 -1
  71. package/lib/locale/lang/de-DE.umd.js +6 -0
  72. package/lib/locale/lang/en-US.js +6 -0
  73. package/lib/locale/lang/en-US.min.js +1 -1
  74. package/lib/locale/lang/en-US.umd.js +6 -0
  75. package/lib/locale/lang/es-ES.js +6 -0
  76. package/lib/locale/lang/es-ES.min.js +1 -1
  77. package/lib/locale/lang/es-ES.umd.js +6 -0
  78. package/lib/locale/lang/fr-FR.js +6 -0
  79. package/lib/locale/lang/fr-FR.min.js +1 -1
  80. package/lib/locale/lang/fr-FR.umd.js +6 -0
  81. package/lib/locale/lang/hu-HU.js +6 -0
  82. package/lib/locale/lang/hu-HU.min.js +1 -1
  83. package/lib/locale/lang/hu-HU.umd.js +6 -0
  84. package/lib/locale/lang/hy-AM.js +6 -0
  85. package/lib/locale/lang/hy-AM.min.js +1 -1
  86. package/lib/locale/lang/hy-AM.umd.js +6 -0
  87. package/lib/locale/lang/id-ID.js +6 -0
  88. package/lib/locale/lang/id-ID.min.js +1 -1
  89. package/lib/locale/lang/id-ID.umd.js +6 -0
  90. package/lib/locale/lang/it-IT.js +6 -0
  91. package/lib/locale/lang/it-IT.min.js +1 -1
  92. package/lib/locale/lang/it-IT.umd.js +6 -0
  93. package/lib/locale/lang/ja-JP.js +6 -0
  94. package/lib/locale/lang/ja-JP.min.js +1 -1
  95. package/lib/locale/lang/ja-JP.umd.js +6 -0
  96. package/lib/locale/lang/ko-KR.js +6 -0
  97. package/lib/locale/lang/ko-KR.min.js +1 -1
  98. package/lib/locale/lang/ko-KR.umd.js +6 -0
  99. package/lib/locale/lang/ms-MY.js +6 -0
  100. package/lib/locale/lang/ms-MY.min.js +1 -1
  101. package/lib/locale/lang/ms-MY.umd.js +6 -0
  102. package/lib/locale/lang/nb-NO.js +6 -0
  103. package/lib/locale/lang/nb-NO.min.js +1 -1
  104. package/lib/locale/lang/nb-NO.umd.js +6 -0
  105. package/lib/locale/lang/pt-BR.js +6 -0
  106. package/lib/locale/lang/pt-BR.min.js +1 -1
  107. package/lib/locale/lang/pt-BR.umd.js +6 -0
  108. package/lib/locale/lang/ru-RU.js +6 -0
  109. package/lib/locale/lang/ru-RU.min.js +1 -1
  110. package/lib/locale/lang/ru-RU.umd.js +6 -0
  111. package/lib/locale/lang/th-TH.js +6 -0
  112. package/lib/locale/lang/th-TH.min.js +1 -1
  113. package/lib/locale/lang/th-TH.umd.js +6 -0
  114. package/lib/locale/lang/ug-CN.js +6 -0
  115. package/lib/locale/lang/ug-CN.min.js +1 -1
  116. package/lib/locale/lang/ug-CN.umd.js +6 -0
  117. package/lib/locale/lang/uk-UA.js +6 -0
  118. package/lib/locale/lang/uk-UA.min.js +1 -1
  119. package/lib/locale/lang/uk-UA.umd.js +6 -0
  120. package/lib/locale/lang/uz-UZ.js +6 -0
  121. package/lib/locale/lang/uz-UZ.min.js +1 -1
  122. package/lib/locale/lang/uz-UZ.umd.js +6 -0
  123. package/lib/locale/lang/vi-VN.js +6 -0
  124. package/lib/locale/lang/vi-VN.min.js +1 -1
  125. package/lib/locale/lang/vi-VN.umd.js +6 -0
  126. package/lib/locale/lang/zh-CHT.js +6 -0
  127. package/lib/locale/lang/zh-CHT.min.js +1 -1
  128. package/lib/locale/lang/zh-CHT.umd.js +6 -0
  129. package/lib/locale/lang/zh-CN.js +6 -0
  130. package/lib/locale/lang/zh-CN.min.js +1 -1
  131. package/lib/locale/lang/zh-CN.umd.js +6 -0
  132. package/lib/style.css +1 -1
  133. package/lib/style.min.css +1 -1
  134. package/lib/table/module/custom/hook.js +32 -4
  135. package/lib/table/module/custom/hook.min.js +1 -1
  136. package/lib/table/module/custom/panel.js +14 -3
  137. package/lib/table/module/custom/panel.min.js +1 -1
  138. package/lib/table/module/export/export-panel.js +2 -1
  139. package/lib/table/module/export/export-panel.min.js +1 -1
  140. package/lib/table/module/export/import-panel.js +2 -1
  141. package/lib/table/module/export/import-panel.min.js +1 -1
  142. package/lib/table/module/filter/panel.js +2 -1
  143. package/lib/table/module/filter/panel.min.js +1 -1
  144. package/lib/table/module/menu/panel.js +2 -1
  145. package/lib/table/module/menu/panel.min.js +1 -1
  146. package/lib/table/src/body.js +9 -9
  147. package/lib/table/src/body.min.js +1 -1
  148. package/lib/table/src/cell.js +16 -16
  149. package/lib/table/src/cell.min.js +1 -1
  150. package/lib/table/src/column.js +2 -1
  151. package/lib/table/src/column.min.js +1 -1
  152. package/lib/table/src/footer.js +2 -1
  153. package/lib/table/src/footer.min.js +1 -1
  154. package/lib/table/src/group.js +2 -1
  155. package/lib/table/src/group.min.js +1 -1
  156. package/lib/table/src/header.js +2 -1
  157. package/lib/table/src/header.min.js +1 -1
  158. package/lib/table/src/props.js +28 -7
  159. package/lib/table/src/table.js +13 -11
  160. package/lib/table/src/table.min.js +1 -1
  161. package/lib/table/style/style.css +22 -3
  162. package/lib/table/style/style.min.css +1 -1
  163. package/lib/toolbar/src/toolbar.js +180 -85
  164. package/lib/toolbar/src/toolbar.min.js +1 -1
  165. package/lib/ui/index.js +12 -1
  166. package/lib/ui/index.min.js +1 -1
  167. package/lib/ui/src/comp.js +8 -0
  168. package/lib/ui/src/comp.min.js +1 -0
  169. package/lib/ui/src/log.js +1 -1
  170. package/lib/ui/src/log.min.js +1 -1
  171. package/lib/vxe-table/style/style.css +22 -3
  172. package/lib/vxe-table/style/style.min.css +1 -1
  173. package/package.json +1 -1
  174. package/packages/grid/src/grid.ts +29 -7
  175. package/packages/locale/lang/ar-EG.ts +6 -0
  176. package/packages/locale/lang/de-DE.ts +6 -0
  177. package/packages/locale/lang/en-US.ts +6 -0
  178. package/packages/locale/lang/es-ES.ts +6 -0
  179. package/packages/locale/lang/fr-FR.ts +6 -0
  180. package/packages/locale/lang/hu-HU.ts +6 -0
  181. package/packages/locale/lang/hy-AM.ts +6 -0
  182. package/packages/locale/lang/id-ID.ts +6 -0
  183. package/packages/locale/lang/it-IT.ts +6 -0
  184. package/packages/locale/lang/ja-JP.ts +6 -0
  185. package/packages/locale/lang/ko-KR.ts +6 -0
  186. package/packages/locale/lang/ms-MY.ts +6 -0
  187. package/packages/locale/lang/nb-NO.ts +6 -0
  188. package/packages/locale/lang/pt-BR.ts +6 -0
  189. package/packages/locale/lang/ru-RU.ts +6 -0
  190. package/packages/locale/lang/th-TH.ts +6 -0
  191. package/packages/locale/lang/ug-CN.ts +6 -0
  192. package/packages/locale/lang/uk-UA.ts +6 -0
  193. package/packages/locale/lang/uz-UZ.ts +6 -0
  194. package/packages/locale/lang/vi-VN.ts +6 -0
  195. package/packages/locale/lang/zh-CHT.ts +6 -0
  196. package/packages/locale/lang/zh-CN.ts +6 -0
  197. package/packages/table/module/custom/hook.ts +27 -4
  198. package/packages/table/module/custom/panel.ts +114 -102
  199. package/packages/table/module/export/export-panel.ts +3 -2
  200. package/packages/table/module/export/import-panel.ts +3 -2
  201. package/packages/table/module/filter/panel.ts +3 -2
  202. package/packages/table/module/menu/panel.ts +3 -2
  203. package/packages/table/src/body.ts +10 -8
  204. package/packages/table/src/cell.ts +14 -14
  205. package/packages/table/src/column.ts +3 -2
  206. package/packages/table/src/footer.ts +3 -2
  207. package/packages/table/src/group.ts +3 -2
  208. package/packages/table/src/header.ts +3 -2
  209. package/packages/table/src/props.ts +28 -7
  210. package/packages/table/src/table.ts +66 -46
  211. package/packages/toolbar/src/toolbar.ts +157 -58
  212. package/packages/ui/index.ts +11 -0
  213. package/packages/ui/src/comp.ts +3 -0
  214. package/styles/components/icon.scss +13 -1
  215. package/styles/components/table-module/custom.scss +9 -2
  216. package/styles/icon/iconfont.ttf +0 -0
  217. package/styles/icon/iconfont.woff +0 -0
  218. package/styles/icon/iconfont.woff2 +0 -0
  219. package/es/iconfont.1749800539928.woff +0 -0
  220. package/es/iconfont.1749800539928.woff2 +0 -0
  221. package/lib/iconfont.1749800539928.woff +0 -0
  222. package/lib/iconfont.1749800539928.woff2 +0 -0
@@ -1,4 +1,5 @@
1
- import { defineComponent, h, ref, computed, inject, Teleport } from 'vue'
1
+ import { h, ref, computed, inject, Teleport } from 'vue'
2
+ import { defineVxeComponent } from '../../../ui/src/comp'
2
3
  import { VxeUI } from '../../../ui'
3
4
  import { formatText, isEnableConf } from '../../../ui/src/utils'
4
5
  import { getPropClass } from '../../../ui/src/dom'
@@ -9,7 +10,7 @@ import type { VxeTableConstructor, VxeTableMethods, VxeTablePrivateMethods } fro
9
10
 
10
11
  const { getI18n, getIcon, renderer } = VxeUI
11
12
 
12
- export default defineComponent({
13
+ export default defineVxeComponent({
13
14
  name: 'VxeTableFilterPanel',
14
15
  props: {
15
16
  filterStore: Object as any
@@ -1,4 +1,5 @@
1
- import { defineComponent, h, Teleport, inject, ref, Ref, createCommentVNode } from 'vue'
1
+ import { h, Teleport, inject, ref, Ref, createCommentVNode } from 'vue'
2
+ import { defineVxeComponent } from '../../../ui/src/comp'
2
3
  import { VxeUI } from '../../../ui'
3
4
  import { getFuncText } from '../../../ui/src/utils'
4
5
  import XEUtils from 'xe-utils'
@@ -7,7 +8,7 @@ import type { VxeTablePrivateMethods, VxeTableConstructor, VxeTableMethods } fro
7
8
 
8
9
  const { getIcon } = VxeUI
9
10
 
10
- export default defineComponent({
11
+ export default defineVxeComponent({
11
12
  name: 'VxeTableMenuPanel',
12
13
  setup (props, context) {
13
14
  const xID = XEUtils.uniqueId()
@@ -1,4 +1,5 @@
1
- import { defineComponent, TransitionGroup, h, ref, Ref, PropType, inject, nextTick, onMounted, onUnmounted } from 'vue'
1
+ import { TransitionGroup, h, ref, Ref, PropType, inject, nextTick, onMounted, onUnmounted } from 'vue'
2
+ import { defineVxeComponent } from '../../ui/src/comp'
2
3
  import XEUtils from 'xe-utils'
3
4
  import { VxeUI } from '../../ui'
4
5
  import { getOffsetSize, calcTreeLine, getRowid, createHandleGetRowId, getCellRestHeight } from './util'
@@ -12,7 +13,7 @@ const { getI18n, renderer, renderEmptyElement } = VxeUI
12
13
 
13
14
  const renderType = 'body'
14
15
 
15
- export default defineComponent({
16
+ export default defineVxeComponent({
16
17
  name: 'VxeTableBody',
17
18
  props: {
18
19
  tableData: Array as PropType<any[]>,
@@ -45,7 +46,7 @@ export default defineComponent({
45
46
  return !!(isDragResize || (lastScrollTime && Date.now() < lastScrollTime + (delayHover as number)))
46
47
  }
47
48
 
48
- const renderLine = (rowid: string, params: VxeTableDefines.CellRenderBodyParams, cellHeight: number) => {
49
+ const renderLine = (rowid: string, params: VxeTableDefines.CellRenderBodyParams, cellHeight: number): VxeComponentSlotType[] => {
49
50
  const { row, column } = params
50
51
  const { afterFullData } = tableInternalData
51
52
  const { treeConfig } = tableProps
@@ -326,7 +327,7 @@ export default defineComponent({
326
327
  tcStyle.minHeight = `${cellHeight}px`
327
328
  }
328
329
 
329
- const tdVNs: any[] = []
330
+ const tdVNs: VxeComponentSlotType[] = []
330
331
  if (fixedHiddenColumn && isAllOverflow) {
331
332
  tdVNs.push(
332
333
  h('div', {
@@ -609,7 +610,7 @@ export default defineComponent({
609
610
  const { showOverflow } = expandColumn || {}
610
611
  const colid = expandColumn.id
611
612
  const colRest = fullColumnIdData[colid] || {}
612
- const hasEllipsis = (XEUtils.isUndefined(showOverflow) || XEUtils.isNull(showOverflow)) ? isAllOverflow : showOverflow
613
+ const hasEllipsis = XEUtils.eqNull(showOverflow) ? isAllOverflow : showOverflow
613
614
  let columnIndex = -1
614
615
  let $columnIndex = -1
615
616
  let _columnIndex = -1
@@ -791,13 +792,14 @@ export default defineComponent({
791
792
 
792
793
  let emptyContent: string | VxeComponentSlotType | VxeComponentSlotType[]
793
794
  const emptySlot = slots ? slots.empty : null
795
+ const emptyParams = { $table: $xeTable, $grid: $xeGrid }
794
796
  if (emptySlot) {
795
- emptyContent = $xeTable.callSlot(emptySlot, { $table: $xeTable, $grid: $xeGrid })
797
+ emptyContent = $xeTable.callSlot(emptySlot, emptyParams)
796
798
  } else {
797
799
  const compConf = emptyOpts.name ? renderer.get(emptyOpts.name) : null
798
800
  const rtEmptyView = compConf ? (compConf.renderTableEmpty || compConf.renderTableEmptyView || compConf.renderEmpty) : null
799
801
  if (rtEmptyView) {
800
- emptyContent = getSlotVNs(rtEmptyView(emptyOpts, { $table: $xeTable }))
802
+ emptyContent = getSlotVNs(rtEmptyView(emptyOpts, emptyParams))
801
803
  } else {
802
804
  emptyContent = tableProps.emptyText || getI18n('vxe.table.emptyText')
803
805
  }
@@ -880,7 +882,7 @@ export default defineComponent({
880
882
  ? [
881
883
  h('span', {
882
884
  class: 'vxe-table--cell-main-area-btn',
883
- onMousedown (evnt: any) {
885
+ onMousedown (evnt: MouseEvent) {
884
886
  if ($xeTable.triggerCellAreaExtendMousedownEvent) {
885
887
  $xeTable.triggerCellAreaExtendMousedownEvent(evnt, { $table: $xeTable, fixed: fixedType, type: renderType })
886
888
  }
@@ -400,20 +400,6 @@ export const Cell = {
400
400
  const { field, slots, editRender, cellRender, rowGroupNode, aggFunc } = column
401
401
  const renderOpts = editRender || cellRender
402
402
  const defaultSlot = slots ? slots.default : null
403
- if (defaultSlot) {
404
- return renderCellBaseVNs(params, $table.callSlot(defaultSlot, params))
405
- }
406
- if (renderOpts) {
407
- const compConf = renderer.get(renderOpts.name)
408
- if (compConf) {
409
- const rtCell = compConf.renderTableCell || compConf.renderCell
410
- const rtDefault = compConf.renderTableDefault || compConf.renderDefault
411
- const renderFn = editRender ? rtCell : rtDefault
412
- if (renderFn) {
413
- return renderCellBaseVNs(params, getSlotVNs(renderFn(renderOpts, Object.assign({ $type: editRender ? 'edit' : 'cell' }, params))))
414
- }
415
- }
416
- }
417
403
  let cellValue: string | number | null = ''
418
404
  if (isRowGroupStatus && field && row.isAggregate) {
419
405
  const aggRow: VxeTableDefines.AggregateRowInfo = row
@@ -460,6 +446,20 @@ export const Cell = {
460
446
  }
461
447
  }
462
448
  } else {
449
+ if (defaultSlot) {
450
+ return renderCellBaseVNs(params, $table.callSlot(defaultSlot, params))
451
+ }
452
+ if (renderOpts) {
453
+ const compConf = renderer.get(renderOpts.name)
454
+ if (compConf) {
455
+ const rtCell = compConf.renderTableCell || compConf.renderCell
456
+ const rtDefault = compConf.renderTableDefault || compConf.renderDefault
457
+ const renderFn = editRender ? rtCell : rtDefault
458
+ if (renderFn) {
459
+ return renderCellBaseVNs(params, getSlotVNs(renderFn(renderOpts, Object.assign({ $type: editRender ? 'edit' : 'cell' }, params))))
460
+ }
461
+ }
462
+ }
463
463
  cellValue = $table.getCellLabel(row, column)
464
464
  }
465
465
  const cellPlaceholder = editRender ? editRender.placeholder : ''
@@ -1,4 +1,5 @@
1
- import { defineComponent, h, onUnmounted, inject, ref, PropType, provide, onMounted, createCommentVNode } from 'vue'
1
+ import { h, onUnmounted, inject, ref, PropType, provide, onMounted, createCommentVNode } from 'vue'
2
+ import { defineVxeComponent } from '../../ui/src/comp'
2
3
  import { XEColumnInstance, watchColumn, assembleColumn, destroyColumn } from './util'
3
4
  import Cell from './cell'
4
5
 
@@ -130,7 +131,7 @@ export const columnProps = {
130
131
  params: Object as PropType<VxeColumnPropTypes.Params>
131
132
  }
132
133
 
133
- export default defineComponent({
134
+ export default defineVxeComponent({
134
135
  name: 'VxeColumn',
135
136
  props: columnProps,
136
137
  setup (props, { slots }) {
@@ -1,4 +1,5 @@
1
- import { defineComponent, TransitionGroup, h, ref, Ref, PropType, inject, nextTick, onMounted, onUnmounted } from 'vue'
1
+ import { TransitionGroup, h, ref, Ref, PropType, inject, nextTick, onMounted, onUnmounted } from 'vue'
2
+ import { defineVxeComponent } from '../../ui/src/comp'
2
3
  import XEUtils from 'xe-utils'
3
4
  import { VxeUI } from '../../ui'
4
5
  import { updateCellTitle, getPropClass } from '../../ui/src/dom'
@@ -10,7 +11,7 @@ const { renderer, renderEmptyElement } = VxeUI
10
11
 
11
12
  const renderType = 'footer'
12
13
 
13
- export default defineComponent({
14
+ export default defineVxeComponent({
14
15
  name: 'VxeTableFooter',
15
16
  props: {
16
17
  footerTableData: {
@@ -1,11 +1,12 @@
1
- import { defineComponent, h, onUnmounted, provide, inject, ref, onMounted, Slot, createCommentVNode } from 'vue'
1
+ import { h, onUnmounted, provide, inject, ref, onMounted, Slot, createCommentVNode } from 'vue'
2
+ import { defineVxeComponent } from '../../ui/src/comp'
2
3
  import { columnProps } from './column'
3
4
  import { XEColumnInstance, watchColumn, assembleColumn, destroyColumn } from './util'
4
5
  import Cell from './cell'
5
6
 
6
7
  import type { VxeTableConstructor, VxeTablePrivateMethods } from '../../../types'
7
8
 
8
- export default defineComponent({
9
+ export default defineVxeComponent({
9
10
  name: 'VxeColgroup',
10
11
  props: columnProps,
11
12
  setup (props, { slots }) {
@@ -1,4 +1,5 @@
1
- import { defineComponent, TransitionGroup, h, ref, Ref, PropType, inject, nextTick, watch, onMounted, onUnmounted } from 'vue'
1
+ import { TransitionGroup, h, ref, Ref, PropType, inject, nextTick, watch, onMounted, onUnmounted } from 'vue'
2
+ import { defineVxeComponent } from '../../ui/src/comp'
2
3
  import XEUtils from 'xe-utils'
3
4
  import { VxeUI } from '../../ui'
4
5
  import { getCellHeight, convertHeaderColumnToRows } from './util'
@@ -9,7 +10,7 @@ const { renderer, renderEmptyElement } = VxeUI
9
10
 
10
11
  const renderType = 'header'
11
12
 
12
- export default defineComponent({
13
+ export default defineVxeComponent({
13
14
  name: 'VxeTableHeader',
14
15
  props: {
15
16
  tableData: Array as PropType<any[]>,
@@ -159,11 +159,20 @@ export default {
159
159
  },
160
160
 
161
161
  /** 高级属性 */
162
- // (即将废弃)columnKey 已废弃,被 column-config.useKey 替换
162
+ /**
163
+ * (即将废弃)columnKey 已废弃,被 column-config.useKey 替换
164
+ * @deprecated
165
+ */
163
166
  columnKey: Boolean as PropType<VxeTablePropTypes.ColumnKey>,
164
- // (即将废弃)rowKey 已废弃,被 row-config.useKey 替换
167
+ /**
168
+ * (即将废弃)rowKey 已废弃,被 row-config.useKey 替换
169
+ * @deprecated
170
+ */
165
171
  rowKey: Boolean as PropType<VxeTablePropTypes.RowKey>,
166
- // (即将废弃)rowId 已废弃,被 row-config.keyField 替换
172
+ /**
173
+ * (即将废弃)rowId 已废弃,被 row-config.keyField 替换
174
+ * @deprecated
175
+ */
167
176
  rowId: {
168
177
  type: String as PropType<VxeTablePropTypes.RowId>,
169
178
  default: () => getConfig().table.rowId
@@ -200,11 +209,17 @@ export default {
200
209
  rowConfig: Object as PropType<VxeTablePropTypes.RowConfig>,
201
210
  // 数据聚合配置项
202
211
  aggregateConfig: Object as PropType<VxeTablePropTypes.AggregateConfig>,
203
- // 已废弃,被 aggregateConfig 替换
212
+ /**
213
+ * 已废弃,被 aggregateConfig 替换
214
+ * @deprecated
215
+ */
204
216
  rowGroupConfig: Object as PropType<VxeTablePropTypes.RowGroupConfig>,
205
217
  // 当前行配置项
206
218
  currentRowConfig: Object as PropType<VxeTablePropTypes.CurrentRowConfig>,
207
- // 已废弃,被 rowDragConfig 替换
219
+ /**
220
+ * 已废弃,被 rowDragConfig 替换
221
+ * @deprecated
222
+ */
208
223
  dragConfig: Object as PropType<VxeTablePropTypes.DragConfig>,
209
224
  // 行拖拽排序配置项
210
225
  rowDragConfig: Object as PropType<VxeTablePropTypes.RowDragConfig>,
@@ -258,9 +273,15 @@ export default {
258
273
  emptyRender: Object as PropType<VxeTablePropTypes.EmptyRender>,
259
274
  // 自定义列配置项
260
275
  customConfig: Object as PropType<VxeTablePropTypes.CustomConfig>,
261
- // (即将废弃)横向虚拟滚动配置项
276
+ /**
277
+ * (即将废弃)横向虚拟滚动配置项
278
+ * @deprecated
279
+ */
262
280
  scrollX: Object as PropType<VxeTablePropTypes.ScrollX>,
263
- // (即将废弃)纵向虚拟滚动配置项
281
+ /**
282
+ * (即将废弃)纵向虚拟滚动配置项
283
+ * @deprecated
284
+ */
264
285
  scrollY: Object as PropType<VxeTablePropTypes.ScrollY>,
265
286
  // 横向虚拟滚动配置项
266
287
  virtualXConfig: Object as PropType<VxeTablePropTypes.VirtualXConfig>,
@@ -1,4 +1,5 @@
1
- import { defineComponent, h, ComponentPublicInstance, reactive, ref, Ref, provide, inject, nextTick, onActivated, onDeactivated, onBeforeUnmount, onUnmounted, watch, computed, onMounted } from 'vue'
1
+ import { h, ComponentPublicInstance, reactive, ref, Ref, provide, inject, nextTick, onActivated, onDeactivated, onBeforeUnmount, onUnmounted, watch, computed, onMounted } from 'vue'
2
+ import { defineVxeComponent } from '../../ui/src/comp'
2
3
  import XEUtils from 'xe-utils'
3
4
  import { initTpImg, getTpImg, isPx, isScale, hasClass, addClass, removeClass, getEventTargetNode, getPaddingTopBottomSize, setScrollTop, setScrollLeft, toCssUnit, hasControlKey } from '../../ui/src/dom'
4
5
  import { getLastZIndex, nextZIndex, hasChildrenList, getFuncText, isEnableConf, formatText, eqEmptyValue } from '../../ui/src/utils'
@@ -28,7 +29,7 @@ const customStorageKey = 'VXE_CUSTOM_STORE'
28
29
  const maxYHeight = 5e6
29
30
  const maxXWidth = 5e6
30
31
 
31
- export default defineComponent({
32
+ export default defineVxeComponent({
32
33
  name: 'VxeTable',
33
34
  props: tableProps,
34
35
  emits: tableEmits,
@@ -247,6 +248,7 @@ export default defineComponent({
247
248
 
248
249
  isRowGroupStatus: false,
249
250
  rowGroupList: [],
251
+ aggHandleFields: [],
250
252
 
251
253
  rowGroupExpandedFlag: 1,
252
254
  rowExpandedFlag: 1,
@@ -769,22 +771,15 @@ export default defineComponent({
769
771
  })
770
772
 
771
773
  const computeTableRowExpandedList = computed(() => {
772
- const { treeConfig } = props
773
- const { rowExpandedFlag, expandColumn, rowGroupExpandedFlag, treeExpandedFlag, isRowGroupStatus } = reactData
774
+ const { rowExpandedFlag, expandColumn, rowGroupExpandedFlag, treeExpandedFlag } = reactData
774
775
  const { visibleDataRowIdData, rowExpandedMaps } = internalData
775
- const treeOpts = computeTreeOpts.value
776
- const { transform } = treeOpts
777
776
  const expandList: any[] = []
778
777
  if (expandColumn && rowExpandedFlag && rowGroupExpandedFlag && treeExpandedFlag) {
779
- if (isRowGroupStatus || (treeConfig && transform)) {
780
- XEUtils.each(rowExpandedMaps, (row, rowid) => {
781
- if (visibleDataRowIdData[rowid]) {
782
- expandList.push(row)
783
- }
784
- })
785
- } else {
786
- return XEUtils.values(rowExpandedMaps)
787
- }
778
+ XEUtils.each(rowExpandedMaps, (row, rowid) => {
779
+ if (visibleDataRowIdData[rowid]) {
780
+ expandList.push(row)
781
+ }
782
+ })
788
783
  }
789
784
  return expandList
790
785
  })
@@ -866,6 +861,19 @@ export default defineComponent({
866
861
  return rowGroupOpts.groupFields
867
862
  })
868
863
 
864
+ const computeRowGroupColumns = computed(() => {
865
+ const { rowGroupList } = reactData
866
+ const { fullColumnFieldData } = internalData
867
+ const rgColumns: VxeTableDefines.ColumnInfo[] = []
868
+ rowGroupList.forEach(aggConf => {
869
+ const colRest = fullColumnFieldData[aggConf.field]
870
+ if (colRest) {
871
+ rgColumns.push(colRest.column)
872
+ }
873
+ })
874
+ return rgColumns
875
+ })
876
+
869
877
  const refMaps: VxeTablePrivateRef = {
870
878
  refElem,
871
879
  refTooltip,
@@ -954,6 +962,8 @@ export default defineComponent({
954
962
  computeIsMaxFixedColumn,
955
963
  computeIsAllCheckboxDisabled,
956
964
  computeVirtualScrollBars,
965
+ computeRowGroupFields,
966
+ computeRowGroupColumns,
957
967
 
958
968
  computeSXOpts,
959
969
  computeSYOpts
@@ -990,6 +1000,10 @@ export default defineComponent({
990
1000
  internalData.isCurrDeepKey = hasDeepKey(keyField)
991
1001
  }
992
1002
 
1003
+ const hangleStorageDefaultValue = (value: boolean | null | undefined, isAll: boolean) => {
1004
+ return XEUtils.isBoolean(value) ? value : isAll
1005
+ }
1006
+
993
1007
  const getNextSortOrder = (column: VxeTableDefines.ColumnInfo) => {
994
1008
  const sortOpts = computeSortOpts.value
995
1009
  const { orders = [] } = sortOpts
@@ -1523,13 +1537,13 @@ export default defineComponent({
1523
1537
  const { customConfig } = props
1524
1538
  const tableId = computeTableId.value
1525
1539
  const customOpts = computeCustomOpts.value
1526
- const { storage, restoreStore } = customOpts
1540
+ const { storage, restoreStore, storeOptions } = customOpts
1527
1541
  const isAllCustom = storage === true
1528
- const storageOpts: VxeTableDefines.VxeTableCustomStorageObj = isAllCustom ? {} : Object.assign({}, storage || {})
1529
- const isCustomResizable = isAllCustom || storageOpts.resizable
1530
- const isCustomVisible = isAllCustom || storageOpts.visible
1531
- const isCustomFixed = isAllCustom || storageOpts.fixed
1532
- const isCustomSort = isAllCustom || storageOpts.sort
1542
+ const storageOpts: VxeTableDefines.VxeTableCustomStorageObj = isAllCustom ? {} : Object.assign({}, storage || {}, storeOptions)
1543
+ const isCustomResizable = hangleStorageDefaultValue(storageOpts.resizable, isAllCustom)
1544
+ const isCustomVisible = hangleStorageDefaultValue(storageOpts.visible, isAllCustom)
1545
+ const isCustomFixed = hangleStorageDefaultValue(storageOpts.fixed, isAllCustom)
1546
+ const isCustomSort = hangleStorageDefaultValue(storageOpts.sort, isAllCustom)
1533
1547
  if ((customConfig ? isEnableConf(customOpts) : customOpts.enabled) && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort)) {
1534
1548
  if (!tableId) {
1535
1549
  errLog('vxe.error.reqProp', ['id'])
@@ -3135,13 +3149,18 @@ export default defineComponent({
3135
3149
  }
3136
3150
 
3137
3151
  const handleUpdateRowGroup = (groupFields?: string[]) => {
3138
- reactData.rowGroupList = groupFields
3139
- ? (XEUtils.isArray(groupFields) ? groupFields : [groupFields]).map(field => {
3140
- return {
3141
- field
3142
- }
3152
+ const aggFields: string[] = []
3153
+ const aggConfs: { field: string }[] = []
3154
+ if (groupFields) {
3155
+ (XEUtils.isArray(groupFields) ? groupFields : [groupFields]).forEach(field => {
3156
+ aggFields.push(field)
3157
+ aggConfs.push({
3158
+ field
3143
3159
  })
3144
- : []
3160
+ })
3161
+ }
3162
+ reactData.rowGroupList = aggConfs
3163
+ reactData.aggHandleFields = aggFields
3145
3164
  }
3146
3165
 
3147
3166
  const handleeGroupSummary = (aggList: VxeTableDefines.AggregateRowInfo[]) => {
@@ -3323,9 +3342,9 @@ export default defineComponent({
3323
3342
  internalData.cvCacheMaps = {}
3324
3343
  reactData.isRowLoading = true
3325
3344
  reactData.scrollVMLoading = false
3326
- internalData.treeExpandedMaps = {}
3345
+ // internalData.treeExpandedMaps = {}
3327
3346
  reactData.treeExpandedFlag++
3328
- internalData.rowExpandedMaps = {}
3347
+ // internalData.rowExpandedMaps = {}
3329
3348
  reactData.rowExpandedFlag++
3330
3349
  internalData.insertRowMaps = {}
3331
3350
  reactData.insertRowFlag++
@@ -4072,7 +4091,7 @@ export default defineComponent({
4072
4091
  const handleUpdateResize = () => {
4073
4092
  const el = refElem.value
4074
4093
  if (el && el.clientWidth && el.clientHeight) {
4075
- tableMethods.recalculate()
4094
+ $xeTable.recalculate()
4076
4095
  }
4077
4096
  }
4078
4097
 
@@ -6715,13 +6734,13 @@ export default defineComponent({
6715
6734
  const { id } = props
6716
6735
  const customOpts = computeCustomOpts.value
6717
6736
  const { collectColumn } = internalData
6718
- const { storage, checkMethod } = customOpts
6737
+ const { storage, checkMethod, storeOptions } = customOpts
6719
6738
  const isAllCustom = storage === true
6720
- const storageOpts: VxeTableDefines.VxeTableCustomStorageObj = isAllCustom ? {} : Object.assign({}, storage || {})
6721
- const isCustomResizable = isAllCustom || storageOpts.resizable
6722
- const isCustomVisible = isAllCustom || storageOpts.visible
6723
- const isCustomFixed = isAllCustom || storageOpts.fixed
6724
- const isCustomSort = isAllCustom || storageOpts.sort
6739
+ const storageOpts: VxeTableDefines.VxeTableCustomStorageObj = isAllCustom ? {} : Object.assign({}, storage || {}, storeOptions)
6740
+ const isCustomResizable = hangleStorageDefaultValue(storageOpts.resizable, isAllCustom)
6741
+ const isCustomVisible = hangleStorageDefaultValue(storageOpts.visible, isAllCustom)
6742
+ const isCustomFixed = hangleStorageDefaultValue(storageOpts.fixed, isAllCustom)
6743
+ const isCustomSort = hangleStorageDefaultValue(storageOpts.sort, isAllCustom)
6725
6744
  const resizableData: Record<string, number> = {}
6726
6745
  const sortData: Record<string, number> = {}
6727
6746
  const visibleData: Record<string, boolean> = {}
@@ -8204,13 +8223,13 @@ export default defineComponent({
8204
8223
  const { customConfig } = props
8205
8224
  const tableId = computeTableId.value
8206
8225
  const customOpts = computeCustomOpts.value
8207
- const { updateStore, storage } = customOpts
8226
+ const { updateStore, storage, storeOptions } = customOpts
8208
8227
  const isAllCustom = storage === true
8209
- const storageOpts: VxeTableDefines.VxeTableCustomStorageObj = isAllCustom ? {} : Object.assign({}, storage || {})
8210
- const isCustomResizable = isAllCustom || storageOpts.resizable
8211
- const isCustomVisible = isAllCustom || storageOpts.visible
8212
- const isCustomFixed = isAllCustom || storageOpts.fixed
8213
- const isCustomSort = isAllCustom || storageOpts.sort
8228
+ const storageOpts: VxeTableDefines.VxeTableCustomStorageObj = isAllCustom ? {} : Object.assign({}, storage || {}, storeOptions)
8229
+ const isCustomResizable = hangleStorageDefaultValue(storageOpts.resizable, isAllCustom)
8230
+ const isCustomVisible = hangleStorageDefaultValue(storageOpts.visible, isAllCustom)
8231
+ const isCustomFixed = hangleStorageDefaultValue(storageOpts.fixed, isAllCustom)
8232
+ const isCustomSort = hangleStorageDefaultValue(storageOpts.sort, isAllCustom)
8214
8233
  if (type !== 'reset') {
8215
8234
  // fix:修复拖动列宽,重置按钮无法点击的问题
8216
8235
  reactData.isCustomStatus = true
@@ -10687,14 +10706,15 @@ export default defineComponent({
10687
10706
 
10688
10707
  const renderEmptyBody = () => {
10689
10708
  const emptyOpts = computeEmptyOpts.value
10690
- const params = { $table: $xeTable }
10691
- if (slots.empty) {
10692
- return slots.empty(params)
10709
+ const emptySlot = slots.empty
10710
+ const emptyParams = { $table: $xeTable, $grid: $xeGrid }
10711
+ if (emptySlot) {
10712
+ return emptySlot(emptyParams)
10693
10713
  } else {
10694
10714
  const compConf = emptyOpts.name ? renderer.get(emptyOpts.name) : null
10695
10715
  const rtEmptyView = compConf ? (compConf.renderTableEmpty || compConf.renderTableEmptyView || compConf.renderEmpty) : null
10696
10716
  if (rtEmptyView) {
10697
- return getSlotVNs(rtEmptyView(emptyOpts, params))
10717
+ return getSlotVNs(rtEmptyView(emptyOpts, emptyParams))
10698
10718
  }
10699
10719
  }
10700
10720
  return getFuncText(props.emptyText) || getI18n('vxe.table.emptyText')