vxe-table 3.9.0-rc.2 → 3.9.0-rc.21

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 (186) hide show
  1. package/es/grid/src/grid.js +120 -66
  2. package/es/locale/lang/en-US.js +2 -8
  3. package/es/locale/lang/es-ES.js +2 -1
  4. package/es/locale/lang/hu-HU.d.ts +2 -0
  5. package/es/locale/lang/hu-HU.js +497 -501
  6. package/es/locale/lang/ja-JP.js +2 -8
  7. package/es/locale/lang/ko-KR.d.ts +2 -0
  8. package/es/locale/lang/ko-KR.js +2 -8
  9. package/es/locale/lang/pt-BR.js +2 -8
  10. package/es/locale/lang/ru-RU.d.ts +2 -0
  11. package/es/locale/lang/ru-RU.js +497 -503
  12. package/es/locale/lang/uk-UA.d.ts +2 -0
  13. package/es/locale/lang/uk-UA.js +667 -0
  14. package/es/locale/lang/vi-VN.js +2 -8
  15. package/es/locale/lang/zh-CHT.d.ts +2 -0
  16. package/es/locale/lang/zh-CHT.js +667 -0
  17. package/es/locale/lang/zh-CN.js +2 -8
  18. package/es/locale/lang/zh-HK.js +2 -2
  19. package/es/locale/lang/zh-MO.js +2 -2
  20. package/es/locale/lang/zh-TC.js +2 -673
  21. package/es/locale/lang/zh-TW.js +2 -2
  22. package/es/style.css +1 -1
  23. package/es/style.min.css +1 -1
  24. package/es/table/index.js +29 -3
  25. package/es/table/module/custom/panel.js +183 -173
  26. package/es/table/module/edit/mixin.js +33 -24
  27. package/es/table/module/export/export-panel.js +32 -4
  28. package/es/table/module/export/import-panel.js +24 -5
  29. package/es/table/module/export/mixin.js +11 -11
  30. package/es/table/module/menu/mixin.js +2 -2
  31. package/es/table/module/validator/mixin.js +4 -4
  32. package/es/table/render/index.js +23 -38
  33. package/es/table/src/body.js +1 -0
  34. package/es/table/src/columnInfo.js +3 -3
  35. package/es/table/src/methods.js +48 -40
  36. package/es/table/src/props.js +65 -15
  37. package/es/table/src/table.js +161 -55
  38. package/es/table/src/util.js +3 -2
  39. package/es/table/style.css +37 -23
  40. package/es/table/style.min.css +1 -1
  41. package/es/toolbar/src/toolbar.js +21 -7
  42. package/es/ui/index.js +5 -4
  43. package/es/ui/src/log.js +1 -1
  44. package/es/ui/src/vn.js +24 -1
  45. package/es/vxe-table/style.css +37 -23
  46. package/es/vxe-table/style.min.css +1 -1
  47. package/lib/grid/src/grid.js +115 -68
  48. package/lib/grid/src/grid.min.js +1 -1
  49. package/lib/index.umd.js +632 -330
  50. package/lib/index.umd.min.js +1 -1
  51. package/lib/locale/lang/en-US.js +2 -8
  52. package/lib/locale/lang/en-US.min.js +1 -1
  53. package/lib/locale/lang/en-US.umd.js +2 -8
  54. package/lib/locale/lang/es-ES.js +2 -1
  55. package/lib/locale/lang/es-ES.min.js +1 -1
  56. package/lib/locale/lang/es-ES.umd.js +2 -1
  57. package/lib/locale/lang/hu-HU.d.ts +2 -0
  58. package/lib/locale/lang/hu-HU.js +497 -501
  59. package/lib/locale/lang/hu-HU.min.js +1 -1
  60. package/lib/locale/lang/hu-HU.umd.js +687 -0
  61. package/lib/locale/lang/ja-JP.js +2 -8
  62. package/lib/locale/lang/ja-JP.min.js +1 -1
  63. package/lib/locale/lang/ja-JP.umd.js +2 -8
  64. package/lib/locale/lang/ko-KR.d.ts +2 -0
  65. package/lib/locale/lang/ko-KR.js +2 -8
  66. package/lib/locale/lang/ko-KR.min.js +1 -1
  67. package/lib/locale/lang/ko-KR.umd.js +687 -0
  68. package/lib/locale/lang/pt-BR.js +2 -8
  69. package/lib/locale/lang/pt-BR.min.js +1 -1
  70. package/lib/locale/lang/pt-BR.umd.js +2 -8
  71. package/lib/locale/lang/ru-RU.d.ts +2 -0
  72. package/lib/locale/lang/ru-RU.js +497 -503
  73. package/lib/locale/lang/ru-RU.min.js +1 -1
  74. package/lib/locale/lang/ru-RU.umd.js +687 -0
  75. package/lib/locale/lang/uk-UA.d.ts +2 -0
  76. package/lib/locale/lang/uk-UA.js +673 -0
  77. package/lib/locale/lang/uk-UA.min.js +1 -0
  78. package/lib/locale/lang/uk-UA.umd.js +687 -0
  79. package/lib/locale/lang/vi-VN.js +2 -8
  80. package/lib/locale/lang/vi-VN.min.js +1 -1
  81. package/lib/locale/lang/zh-CHT.d.ts +2 -0
  82. package/lib/locale/lang/zh-CHT.js +673 -0
  83. package/lib/locale/lang/zh-CHT.min.js +1 -0
  84. package/lib/locale/lang/zh-CHT.umd.js +687 -0
  85. package/lib/locale/lang/zh-CN.js +2 -8
  86. package/lib/locale/lang/zh-CN.min.js +1 -1
  87. package/lib/locale/lang/zh-CN.umd.js +2 -8
  88. package/lib/locale/lang/zh-HK.js +2 -2
  89. package/lib/locale/lang/zh-HK.min.js +1 -1
  90. package/lib/locale/lang/zh-HK.umd.js +7 -677
  91. package/lib/locale/lang/zh-MO.js +2 -2
  92. package/lib/locale/lang/zh-MO.min.js +1 -1
  93. package/lib/locale/lang/zh-MO.umd.js +7 -677
  94. package/lib/locale/lang/zh-TC.js +3 -673
  95. package/lib/locale/lang/zh-TC.min.js +1 -1
  96. package/lib/locale/lang/zh-TC.umd.js +7 -677
  97. package/lib/locale/lang/zh-TW.js +2 -2
  98. package/lib/locale/lang/zh-TW.min.js +1 -1
  99. package/lib/locale/lang/zh-TW.umd.js +7 -677
  100. package/lib/style.css +1 -1
  101. package/lib/style.min.css +1 -1
  102. package/lib/table/index.js +30 -3
  103. package/lib/table/index.min.js +1 -1
  104. package/lib/table/module/custom/panel.js +12 -7
  105. package/lib/table/module/custom/panel.min.js +1 -1
  106. package/lib/table/module/edit/mixin.js +32 -23
  107. package/lib/table/module/edit/mixin.min.js +1 -1
  108. package/lib/table/module/export/export-panel.js +31 -4
  109. package/lib/table/module/export/export-panel.min.js +1 -1
  110. package/lib/table/module/export/import-panel.js +23 -5
  111. package/lib/table/module/export/import-panel.min.js +1 -1
  112. package/lib/table/module/export/mixin.js +11 -11
  113. package/lib/table/module/export/mixin.min.js +1 -1
  114. package/lib/table/module/menu/mixin.js +2 -2
  115. package/lib/table/module/menu/mixin.min.js +1 -1
  116. package/lib/table/module/validator/mixin.js +4 -4
  117. package/lib/table/module/validator/mixin.min.js +1 -1
  118. package/lib/table/render/index.js +27 -41
  119. package/lib/table/render/index.min.js +1 -1
  120. package/lib/table/src/body.js +1 -1
  121. package/lib/table/src/body.min.js +1 -1
  122. package/lib/table/src/columnInfo.js +3 -3
  123. package/lib/table/src/columnInfo.min.js +1 -1
  124. package/lib/table/src/methods.js +47 -40
  125. package/lib/table/src/methods.min.js +1 -1
  126. package/lib/table/src/props.js +7 -0
  127. package/lib/table/src/props.min.js +1 -1
  128. package/lib/table/src/table.js +147 -48
  129. package/lib/table/src/table.min.js +1 -1
  130. package/lib/table/src/util.js +3 -2
  131. package/lib/table/src/util.min.js +1 -1
  132. package/lib/table/style/style.css +37 -23
  133. package/lib/table/style/style.min.css +1 -1
  134. package/lib/toolbar/src/toolbar.js +21 -7
  135. package/lib/toolbar/src/toolbar.min.js +1 -1
  136. package/lib/ui/index.js +6 -5
  137. package/lib/ui/index.min.js +1 -1
  138. package/lib/ui/src/log.js +1 -1
  139. package/lib/ui/src/log.min.js +1 -1
  140. package/lib/ui/src/vn.js +26 -1
  141. package/lib/ui/src/vn.min.js +1 -1
  142. package/lib/vxe-table/style/style.css +37 -23
  143. package/lib/vxe-table/style/style.min.css +1 -1
  144. package/package.json +2 -2
  145. package/packages/grid/src/grid.ts +127 -65
  146. package/packages/locale/lang/en-US.ts +2 -10
  147. package/packages/locale/lang/es-ES.ts +2 -1
  148. package/packages/locale/lang/hu-HU.ts +497 -503
  149. package/packages/locale/lang/ja-JP.ts +2 -10
  150. package/packages/locale/lang/ko-KR.ts +2 -10
  151. package/packages/locale/lang/pt-BR.ts +2 -10
  152. package/packages/locale/lang/ru-RU.ts +497 -505
  153. package/packages/locale/lang/uk-UA.ts +667 -0
  154. package/packages/locale/lang/vi-VN.ts +2 -10
  155. package/packages/locale/lang/zh-CHT.ts +667 -0
  156. package/packages/locale/lang/zh-CN.ts +2 -10
  157. package/packages/locale/lang/zh-HK.ts +2 -2
  158. package/packages/locale/lang/zh-MO.ts +2 -2
  159. package/packages/locale/lang/zh-TC.ts +2 -674
  160. package/packages/locale/lang/zh-TW.ts +2 -2
  161. package/packages/table/index.ts +28 -5
  162. package/packages/table/module/custom/panel.ts +186 -175
  163. package/packages/table/module/edit/mixin.ts +32 -23
  164. package/packages/table/module/export/export-panel.ts +36 -4
  165. package/packages/table/module/export/import-panel.ts +28 -5
  166. package/packages/table/module/export/mixin.ts +11 -11
  167. package/packages/table/module/menu/mixin.ts +2 -2
  168. package/packages/table/module/validator/mixin.ts +4 -4
  169. package/packages/table/render/index.ts +26 -40
  170. package/packages/table/src/body.ts +1 -0
  171. package/packages/table/src/columnInfo.ts +3 -3
  172. package/packages/table/src/methods.ts +47 -40
  173. package/packages/table/src/props.ts +68 -15
  174. package/packages/table/src/table.ts +167 -56
  175. package/packages/table/src/util.ts +3 -2
  176. package/packages/toolbar/src/toolbar.ts +21 -7
  177. package/packages/ui/index.ts +3 -2
  178. package/packages/ui/src/vn.ts +26 -1
  179. package/styles/components/table.scss +82 -17
  180. package/types/all.d.ts +2 -2
  181. /package/es/{iconfont.1726028471123.ttf → iconfont.1727868548661.ttf} +0 -0
  182. /package/es/{iconfont.1726028471123.woff → iconfont.1727868548661.woff} +0 -0
  183. /package/es/{iconfont.1726028471123.woff2 → iconfont.1727868548661.woff2} +0 -0
  184. /package/lib/{iconfont.1726028471123.ttf → iconfont.1727868548661.ttf} +0 -0
  185. /package/lib/{iconfont.1726028471123.woff → iconfont.1727868548661.woff} +0 -0
  186. /package/lib/{iconfont.1726028471123.woff2 → iconfont.1727868548661.woff2} +0 -0
@@ -2,12 +2,17 @@ import { CreateElement } from 'vue'
2
2
  import { VxeUI } from '../../../ui'
3
3
  import XEUtils from 'xe-utils'
4
4
  import { parseFile } from '../../../ui/src/utils'
5
- // import { errLog } from '../../../ui/src/log'
5
+ import { errLog } from '../../../ui/src/log'
6
6
 
7
- const { getI18n, getIcon } = VxeUI
7
+ import type { VxeModalComponent, VxeSelectComponent, VxeButtonComponent } from 'vxe-pc-ui'
8
+
9
+ const { getI18n, getIcon, globalMixins } = VxeUI
8
10
 
9
11
  export default {
10
12
  name: 'VxeTableImportPanel',
13
+ mixins: [
14
+ globalMixins.sizeMixin
15
+ ],
11
16
  props: {
12
17
  defaultOptions: Object,
13
18
  storeData: Object
@@ -22,9 +27,6 @@ export default {
22
27
  }
23
28
  },
24
29
  computed: {
25
- vSize () {
26
- return this.size || this.$parent.size || this.$parent.vSize
27
- },
28
30
  selectName () {
29
31
  return `${this.storeData.filename}.${this.storeData.type}`
30
32
  },
@@ -41,6 +43,27 @@ export default {
41
43
  return `*.${typeList.map((item: any) => item.value).join(', *.')}`
42
44
  }
43
45
  } as any,
46
+ created (this: any) {
47
+ const $xeTableImportPanel = this
48
+
49
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
50
+ const VxeUIModalComponent = VxeUI.getComponent<VxeModalComponent>('VxeModal')
51
+ const VxeUIButtonComponent = VxeUI.getComponent<VxeButtonComponent>('VxeButton')
52
+ const VxeUISelectComponent = VxeUI.getComponent<VxeSelectComponent>('VxeSelect')
53
+
54
+ $xeTableImportPanel.$nextTick(() => {
55
+ if (!VxeUIModalComponent) {
56
+ errLog('vxe.error.reqComp', ['vxe-modal'])
57
+ }
58
+ if (!VxeUIButtonComponent) {
59
+ errLog('vxe.error.reqComp', ['vxe-button'])
60
+ }
61
+ if (!VxeUISelectComponent) {
62
+ errLog('vxe.error.reqComp', ['vxe-select'])
63
+ }
64
+ })
65
+ }
66
+ },
44
67
  render (this: any, h: CreateElement) {
45
68
  const { hasFile, parseTypeLabel, defaultOptions, storeData, selectName } = this
46
69
  return h('vxe-modal', {
@@ -584,7 +584,7 @@ function downloadFile ($xetable: any, opts: any, content: any) {
584
584
  saveLocalFile({ filename, type, content }).then(() => {
585
585
  if (opts.message !== false) {
586
586
  // 检测弹窗模块
587
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
587
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
588
588
  if (!VxeUI.modal) {
589
589
  errLog('vxe.error.reqModule', ['Modal'])
590
590
  }
@@ -813,7 +813,7 @@ function handleImport ($xetable: any, content: any, opts: any) {
813
813
  }
814
814
  if (opts.message !== false) {
815
815
  // 检测弹窗模块
816
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
816
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
817
817
  if (!VxeUI.modal) {
818
818
  errLog('vxe.error.reqModule', ['Modal'])
819
819
  }
@@ -828,7 +828,7 @@ function handleImport ($xetable: any, content: any, opts: any) {
828
828
  })
829
829
  } else if (opts.message !== false) {
830
830
  // 检测弹窗模块
831
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
831
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
832
832
  if (!VxeUI.modal) {
833
833
  errLog('vxe.error.reqModule', ['Modal'])
834
834
  }
@@ -849,7 +849,7 @@ function handleFileImport ($xetable: any, file: any, opts: any) {
849
849
  if (!importMethod && !XEUtils.includes(XEUtils.keys(importOpts._typeMaps), type)) {
850
850
  if (opts.message !== false) {
851
851
  // 检测弹窗模块
852
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
852
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
853
853
  if (!VxeUI.modal) {
854
854
  errLog('vxe.error.reqModule', ['Modal'])
855
855
  }
@@ -900,7 +900,7 @@ function handleFileImport ($xetable: any, file: any, opts: any) {
900
900
  }
901
901
  } else {
902
902
  // 不支持的浏览器
903
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
903
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
904
904
  errLog('vxe.error.notExp')
905
905
  }
906
906
  _importResolve({ status: true })
@@ -957,7 +957,7 @@ export function readLocalFile (options: any = {}) {
957
957
  } else {
958
958
  if (options.message !== false) {
959
959
  // 检测弹窗模块
960
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
960
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
961
961
  if (!VxeUI.modal) {
962
962
  errLog('vxe.error.reqModule', ['Modal'])
963
963
  }
@@ -1277,7 +1277,7 @@ export default {
1277
1277
 
1278
1278
  // 检查类型,如果为自定义导出,则不需要校验类型
1279
1279
  if (!opts.exportMethod && !XEUtils.includes(XEUtils.keys(exportOpts._typeMaps), type)) {
1280
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
1280
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
1281
1281
  errLog('vxe.error.notType', [type])
1282
1282
  }
1283
1283
  const params = { status: false }
@@ -1300,7 +1300,7 @@ export default {
1300
1300
  opts.data = selectRecords
1301
1301
  }
1302
1302
  } else if (mode === 'all') {
1303
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
1303
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
1304
1304
  if (!$xegrid) {
1305
1305
  warnLog('vxe.error.errProp', ['all', 'mode=current,selected'])
1306
1306
  }
@@ -1312,7 +1312,7 @@ export default {
1312
1312
  const queryAllSuccessMethods = ajax.queryAllSuccess
1313
1313
  const queryAllErrorMethods = ajax.queryAllError
1314
1314
 
1315
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
1315
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
1316
1316
  if (!ajaxMethods) {
1317
1317
  warnLog('vxe.error.notFunc', ['proxy-config.ajax.queryAll'])
1318
1318
  }
@@ -1484,7 +1484,7 @@ export default {
1484
1484
  },
1485
1485
  _openExport (options: any) {
1486
1486
  const { exportOpts } = this
1487
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
1487
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
1488
1488
  if (!this.exportConfig) {
1489
1489
  errLog('vxe.error.reqProp', ['export-config'])
1490
1490
  }
@@ -1493,7 +1493,7 @@ export default {
1493
1493
  },
1494
1494
  _openPrint (options: any) {
1495
1495
  const { printOpts } = this
1496
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
1496
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
1497
1497
  if (!this.printConfig) {
1498
1498
  errLog('vxe.error.reqProp', ['print-config'])
1499
1499
  }
@@ -107,7 +107,7 @@ export default {
107
107
  this.handleOpenMenuEvent(evnt, layout, params)
108
108
  // 在 v4 中废弃事件 cell-context-menu、header-cell-context-menu、footer-cell-context-menu
109
109
  if (this.$listeners[`${typePrefix}cell-context-menu`]) {
110
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
110
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
111
111
  warnLog('vxe.error.delEvent', [`${typePrefix}cell-context-menu`, `${typePrefix}cell-menu`])
112
112
  }
113
113
  this.emitEvent(`${typePrefix}cell-context-menu`, params, evnt)
@@ -258,7 +258,7 @@ export default {
258
258
  }
259
259
  // 在 v4 中废弃事件 context-menu-click
260
260
  if (this.$listeners['context-menu-click']) {
261
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
261
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
262
262
  warnLog('vxe.error.delEvent', ['context-menu-click', 'menu-click'])
263
263
  }
264
264
  this.emitEvent('context-menu-click', params, evnt)
@@ -68,7 +68,7 @@ export default {
68
68
  * 完整校验,和 validate 的区别就是会给有效数据中的每一行进行校验
69
69
  */
70
70
  _fullValidate (rows: any, cb: any) {
71
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
71
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
72
72
  if (XEUtils.isFunction(cb)) {
73
73
  warnLog('vxe.error.notValidators', ['fullValidate(rows, callback)', 'fullValidate(rows)'])
74
74
  }
@@ -79,7 +79,7 @@ export default {
79
79
  * 快速校验,如果存在记录不通过的记录,则返回不再继续校验(异步校验除外)
80
80
  */
81
81
  _validate (rows: any, cb: any) {
82
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
82
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
83
83
  if (XEUtils.isFunction(cb)) {
84
84
  warnLog('vxe.error.notValidators', ['validate(rows, callback)', 'validate(rows)'])
85
85
  }
@@ -308,12 +308,12 @@ export default {
308
308
  if (gvItem.cellValidatorMethod) {
309
309
  customValid = gvItem.cellValidatorMethod(validParams)
310
310
  } else {
311
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
311
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
312
312
  warnLog('vxe.error.notValidators', [validator])
313
313
  }
314
314
  }
315
315
  } else {
316
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
316
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
317
317
  errLog('vxe.error.notValidators', [validator])
318
318
  }
319
319
  }
@@ -3,40 +3,17 @@ import XEUtils from 'xe-utils'
3
3
  import { VxeUI } from '../../ui'
4
4
  import { getCellValue, setCellValue } from '../src/util'
5
5
  import { getFuncText, formatText, isEmptyValue } from '../../ui/src/utils'
6
- import { getOnName } from '../../ui/src/vn'
6
+ import { getOnName, getModelEvent, getChangeEvent } from '../../ui/src/vn'
7
7
  import { errLog } from '../../ui/src/log'
8
8
 
9
9
  import type { VxeGlobalRendererHandles, VxeColumnPropTypes } from '../../../types'
10
10
 
11
11
  const { getConfig, renderer, getI18n } = VxeUI
12
12
 
13
- const componentDefaultModelProp = 'modelValue'
13
+ const componentDefaultModelProp = 'value'
14
14
 
15
15
  const defaultCompProps = { transfer: true }
16
16
 
17
- function getModelEvent (renderOpts: any) {
18
- switch (renderOpts.name) {
19
- case 'input':
20
- case 'textarea':
21
- return 'input'
22
- }
23
- return 'update:modelValue'
24
- }
25
-
26
- function getChangeEvent (renderOpts: any) {
27
- switch (renderOpts.name) {
28
- case 'input':
29
- case 'textarea':
30
- case 'VxeInput':
31
- case 'VxeNumberInput':
32
- case 'VxeTextarea':
33
- case '$input':
34
- case '$textarea':
35
- return 'input'
36
- }
37
- return 'change'
38
- }
39
-
40
17
  function parseDate (value: any, props: any) {
41
18
  return value && props.valueFormat ? XEUtils.toStringDate(value, props.valueFormat) : value
42
19
  }
@@ -47,7 +24,7 @@ function getFormatDate (value: any, props: any, defaultFormat: string) {
47
24
  }
48
25
 
49
26
  function getLabelFormatDate (value: any, props: any) {
50
- return getFormatDate(value, props, getI18n(`vxe.input.date.labelFormat.${props.type}`))
27
+ return getFormatDate(value, props, getI18n(`vxe.input.date.labelFormat.${props.type || 'date'}`))
51
28
  }
52
29
 
53
30
  /**
@@ -132,7 +109,7 @@ function getCellLabelVNs (h: CreateElement, renderOpts: any, params: any, cellLa
132
109
  * @param modelFunc
133
110
  * @param changeFunc
134
111
  */
135
- function getElementOns (renderOpts: any, params: any, modelFunc?: any, changeFunc?: any) {
112
+ function getNativeElementOns (renderOpts: any, params: any, modelFunc?: any, changeFunc?: any) {
136
113
  const { events } = renderOpts
137
114
  const modelEvent = getModelEvent(renderOpts)
138
115
  const changeEvent = getChangeEvent(renderOpts)
@@ -245,7 +222,7 @@ function getFilterOns (renderOpts: any, params: any, option: any) {
245
222
  function getNativeEditOns (renderOpts: any, params: any) {
246
223
  const { $table, row, column } = params
247
224
  const { model } = column
248
- return getElementOns(renderOpts, params, (evnt: any) => {
225
+ return getNativeElementOns(renderOpts, params, (evnt: any) => {
249
226
  // 处理 model 值双向绑定
250
227
  const cellValue = evnt.target.value
251
228
  if (isImmediateCell(renderOpts, params)) {
@@ -262,7 +239,7 @@ function getNativeEditOns (renderOpts: any, params: any) {
262
239
  }
263
240
 
264
241
  function getNativeFilterOns (renderOpts: any, params: any, option: any) {
265
- return getElementOns(renderOpts, params, (evnt: any) => {
242
+ return getNativeElementOns(renderOpts, params, (evnt: any) => {
266
243
  // 处理 model 值双向绑定
267
244
  option.data = evnt.target.value
268
245
  }, () => {
@@ -368,7 +345,7 @@ function renderNativeOptgroups (h: CreateElement, renderOpts: any, params: any,
368
345
  return optionGroups.map((group: any, gIndex: any) => {
369
346
  return h('optgroup', {
370
347
  key: gIndex,
371
- props: {
348
+ attrs: {
372
349
  label: group[groupLabel]
373
350
  }
374
351
  }, renderOptionsMethods(h, group[groupOptions], renderOpts, params))
@@ -663,15 +640,7 @@ renderer.mixin({
663
640
  const { row, column } = params
664
641
  let cellValue = XEUtils.get(row, column.field)
665
642
  if (cellValue) {
666
- switch (props.type) {
667
- case 'date':
668
- case 'week':
669
- case 'month':
670
- case 'quarter':
671
- case 'year':
672
- cellValue = getLabelFormatDate(cellValue, props)
673
- break
674
- }
643
+ cellValue = getLabelFormatDate(cellValue, props)
675
644
  }
676
645
  return getCellLabelVNs(h, renderOpts, params, cellValue)
677
646
  },
@@ -680,7 +649,8 @@ renderer.mixin({
680
649
  tableFilterDefaultMethod: handleFilterMethod
681
650
  },
682
651
  VxeTextarea: {
683
- tableAutoFocus: 'VxeTextarea'
652
+ tableAutoFocus: 'textarea',
653
+ renderTableEdit: defaultEditRender
684
654
  },
685
655
  VxeButton: {
686
656
  renderTableDefault: buttonCellRender
@@ -788,6 +758,22 @@ renderer.mixin({
788
758
  ]
789
759
  }
790
760
  },
761
+ VxeTextEllipsis: {
762
+ renderTableDefault (h, renderOpts, params) {
763
+ const { row, column } = params
764
+ const { props } = renderOpts
765
+ const cellValue = getCellValue(row, column)
766
+ return [
767
+ h(getDefaultComponent(renderOpts), {
768
+ props: {
769
+ ...props,
770
+ content: cellValue
771
+ },
772
+ on: getEditOns(renderOpts, params)
773
+ })
774
+ ]
775
+ }
776
+ },
791
777
 
792
778
  // 以下已废弃
793
779
  $input: {
@@ -280,6 +280,7 @@ function renderColumn (h: any, _vm: any, $xetable: any, seq: any, rowid: any, fi
280
280
  'col--tree-node': treeNode,
281
281
  'col--edit': isEdit,
282
282
  'col--ellipsis': hasEllipsis,
283
+ 'col--height': !!rowOpts.height,
283
284
  'fixed--hidden': fixedHiddenColumn,
284
285
  'col--dirty': isDirty,
285
286
  'col--active': editConfig && isEdit && (actived.row === row && (actived.column === column || editOpts.mode === 'row')),
@@ -14,7 +14,7 @@ export class ColumnInfo {
14
14
  const formatter = _vm.formatter
15
15
  const visible = XEUtils.isBoolean(_vm.visible) ? _vm.visible : true
16
16
 
17
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
17
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
18
18
  const types = ['seq', 'checkbox', 'radio', 'expand', 'html']
19
19
  if (_vm.type && types.indexOf(_vm.type) === -1) {
20
20
  warnLog('vxe.error.errProp', [`type=${_vm.type}`, types.join(', ')])
@@ -42,12 +42,12 @@ export class ColumnInfo {
42
42
  if (formatter) {
43
43
  if (XEUtils.isString(formatter)) {
44
44
  const gFormatOpts = formats.get(formatter) || XEUtils[formatter]
45
- if (!gFormatOpts || !XEUtils.isFunction(gFormatOpts.cellFormatMethod)) {
45
+ if (!gFormatOpts || !XEUtils.isFunction(gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod)) {
46
46
  errLog('vxe.error.notFormats', [formatter])
47
47
  }
48
48
  } else if (XEUtils.isArray(formatter)) {
49
49
  const gFormatOpts = formats.get(formatter[0]) || XEUtils[formatter[0]]
50
- if (!gFormatOpts || !XEUtils.isFunction(gFormatOpts.cellFormatMethod)) {
50
+ if (!gFormatOpts || !XEUtils.isFunction(gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod)) {
51
51
  errLog('vxe.error.notFormats', [formatter[0]])
52
52
  }
53
53
  }
@@ -107,9 +107,10 @@ function computeVirtualX (_vm: any) {
107
107
  }
108
108
 
109
109
  function computeVirtualY (_vm: any) {
110
- const { $refs, vSize, rowHeightMaps } = _vm
110
+ const { $refs, computeSize, rowHeightMaps } = _vm
111
111
  const { tableHeader, tableBody } = $refs
112
112
  const tableBodyElem = tableBody ? tableBody.$el : null
113
+ const vSize = computeSize
113
114
  if (tableBodyElem) {
114
115
  const tableHeaderElem = tableHeader ? tableHeader.$el : null
115
116
  let rowHeight = 0
@@ -395,7 +396,7 @@ const Methods = {
395
396
  if (treeConfig) {
396
397
  // 树结构自动转换
397
398
  if (treeOpts.transform) {
398
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
399
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
399
400
  if (!treeOpts.rowField) {
400
401
  errLog('vxe.error.reqProp', ['table.tree-config.rowField'])
401
402
  }
@@ -449,7 +450,7 @@ const Methods = {
449
450
  if (keepSource) {
450
451
  this.cacheSourceMap(fullData)
451
452
  }
452
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
453
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
453
454
  if (sYLoad) {
454
455
  if (!(this.height || this.maxHeight)) {
455
456
  errLog('vxe.error.reqProp', ['table.height | table.max-height | table.scroll-y={enabled: false}'])
@@ -580,7 +581,7 @@ const Methods = {
580
581
  }
581
582
  this.tableData = tableData.slice(0)
582
583
  } else {
583
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
584
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
584
585
  warnLog('vxe.error.reqProp', ['keep-source'])
585
586
  }
586
587
  }
@@ -632,7 +633,7 @@ const Methods = {
632
633
  this.clearMergeCells()
633
634
  this.clearMergeFooterItems()
634
635
  this.handleTableData(true)
635
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
636
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
636
637
  if ((this.scrollXLoad || this.scrollYLoad) && this.expandColumn) {
637
638
  warnLog('vxe.error.scrollErrProp', ['column.type=expand'])
638
639
  }
@@ -770,7 +771,7 @@ const Methods = {
770
771
  const { id: colid, field, fixed, type, treeNode } = column
771
772
  const rest = { column, colid, index, items, parent }
772
773
  if (field) {
773
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
774
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
774
775
  if (fullColumnFieldData[field]) {
775
776
  warnLog('vxe.error.colRepet', ['field', field])
776
777
  }
@@ -786,7 +787,7 @@ const Methods = {
786
787
  }
787
788
 
788
789
  if (treeNode) {
789
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
790
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
790
791
  if (treeNodeColumn) {
791
792
  warnLog('vxe.error.colRepet', ['tree-node', treeNode])
792
793
  }
@@ -795,7 +796,7 @@ const Methods = {
795
796
  treeNodeColumn = column
796
797
  }
797
798
  } else if (type === 'expand') {
798
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
799
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
799
800
  if (expandColumn) {
800
801
  warnLog('vxe.error.colRepet', ['type', type])
801
802
  }
@@ -804,7 +805,7 @@ const Methods = {
804
805
  expandColumn = column
805
806
  }
806
807
  }
807
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
808
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
808
809
  if (type === 'checkbox') {
809
810
  if (checkboxColumn) {
810
811
  warnLog('vxe.error.colRepet', ['type', type])
@@ -821,7 +822,7 @@ const Methods = {
821
822
  }
822
823
  }
823
824
  }
824
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
825
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
825
826
  if (this.showOverflow && column.showOverflow === false) {
826
827
  warnLog('vxe.error.errConflicts', [`table.show-overflow=${this.showOverflow}`, `column.show-overflow=${column.showOverflow}`])
827
828
  }
@@ -833,7 +834,7 @@ const Methods = {
833
834
  }
834
835
  }
835
836
 
836
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
837
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
837
838
  if (htmlColumn) {
838
839
  if (!columnOpts.useKey) {
839
840
  errLog('vxe.error.reqProp', ['column-config.useKey', 'column.type=html'])
@@ -863,7 +864,7 @@ const Methods = {
863
864
  tableFullColumn.forEach(handleFunc)
864
865
  }
865
866
 
866
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
867
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
867
868
  if (expandColumn && this.mouseOpts.area) {
868
869
  errLog('vxe.error.errConflicts', ['mouse-config.area', 'column.type=expand'])
869
870
  }
@@ -935,7 +936,7 @@ const Methods = {
935
936
  },
936
937
  // 在 v3 中废弃
937
938
  _getRowIndex (row: any) {
938
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
939
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
939
940
  warnLog('vxe.error.delFunc', ['_getRowIndex', 'getVTRowIndex'])
940
941
  }
941
942
  return this.getVTRowIndex(row)
@@ -949,7 +950,7 @@ const Methods = {
949
950
  },
950
951
  // 在 v3 中废弃
951
952
  $getRowIndex (row: any) {
952
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
953
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
953
954
  warnLog('vxe.error.delFunc', ['$getRowIndex', 'getVMRowIndex'])
954
955
  }
955
956
  return this.getVMRowIndex(row)
@@ -970,7 +971,7 @@ const Methods = {
970
971
  },
971
972
  // 在 v3 中废弃
972
973
  _getColumnIndex (column: any) {
973
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
974
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
974
975
  warnLog('vxe.error.delFunc', ['_getColumnIndex', 'getVTColumnIndex'])
975
976
  }
976
977
  return this.getVTColumnIndex(column)
@@ -984,7 +985,7 @@ const Methods = {
984
985
  },
985
986
  // 在 v3 中废弃
986
987
  $getColumnIndex (column: any) {
987
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
988
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
988
989
  warnLog('vxe.error.delFunc', ['$getColumnIndex', 'getVMColumnIndex'])
989
990
  }
990
991
  return this.getVMColumnIndex(column)
@@ -1071,7 +1072,7 @@ const Methods = {
1071
1072
  revertData (rows: any, field: any) {
1072
1073
  const { keepSource, tableSourceData, treeConfig } = this
1073
1074
  if (!keepSource) {
1074
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
1075
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
1075
1076
  warnLog('vxe.error.reqProp', ['keep-source'])
1076
1077
  }
1077
1078
  return this.$nextTick()
@@ -1180,10 +1181,12 @@ const Methods = {
1180
1181
  const formatParams = { cellValue, row, rowIndex: this.getRowIndex(row), column, columnIndex: this.getColumnIndex(column) }
1181
1182
  if (XEUtils.isString(formatter)) {
1182
1183
  const gFormatOpts = formats.get(formatter)
1183
- cellLabel = gFormatOpts && gFormatOpts.cellFormatMethod ? gFormatOpts.cellFormatMethod(formatParams) : ''
1184
+ const tcFormatMethod = gFormatOpts ? (gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod) : null
1185
+ cellLabel = tcFormatMethod ? tcFormatMethod(formatParams) : ''
1184
1186
  } else if (XEUtils.isArray(formatter)) {
1185
1187
  const gFormatOpts = formats.get(formatter[0])
1186
- cellLabel = gFormatOpts && gFormatOpts.cellFormatMethod ? gFormatOpts.cellFormatMethod(formatParams, ...formatter.slice(1)) : ''
1188
+ const tcFormatMethod = gFormatOpts ? (gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod) : null
1189
+ cellLabel = tcFormatMethod ? tcFormatMethod(formatParams, ...formatter.slice(1)) : ''
1187
1190
  } else {
1188
1191
  cellLabel = formatter(formatParams)
1189
1192
  }
@@ -1389,8 +1392,8 @@ const Methods = {
1389
1392
  if (valueList.length && !allRemoteFilter) {
1390
1393
  const { filterMethod, filterRender, field } = column
1391
1394
  const compConf = isEnableConf(filterRender) ? renderer.get(filterRender.name) : null
1392
- const compFilterMethod = compConf && compConf.renderFilter ? (compConf.tableFilterMethod || compConf.filterMethod) : null
1393
- const defaultFilterMethod = compConf ? (compConf.tableFilterDefaultMethod || compConf.defaultTableFilterMethod || compConf.defaultFilterMethod) : null
1395
+ const compFilterMethod = compConf ? (compConf.tableFilterMethod || compConf.filterMethod) : null
1396
+ const tdFilterMethod = compConf ? (compConf.tableFilterDefaultMethod || compConf.defaultTableFilterMethod || compConf.defaultFilterMethod) : null
1394
1397
  const cellValue = getCellValue(row, column)
1395
1398
  if (filterMethod) {
1396
1399
  return itemList.some((item: any) => filterMethod({ value: item.value, option: item, cellValue, row, column, $table: this }))
@@ -1398,8 +1401,8 @@ const Methods = {
1398
1401
  return itemList.some((item: any) => compFilterMethod({ value: item.value, option: item, cellValue, row, column, $table: this }))
1399
1402
  } else if (allFilterMethod) {
1400
1403
  return allFilterMethod({ options: itemList, values: valueList, cellValue, row, column })
1401
- } else if (defaultFilterMethod) {
1402
- return itemList.some((item: any) => defaultFilterMethod({ value: item.value, option: item, cellValue, row, column, $table: this }))
1404
+ } else if (tdFilterMethod) {
1405
+ return itemList.some((item: any) => tdFilterMethod({ value: item.value, option: item, cellValue, row, column, $table: this }))
1403
1406
  }
1404
1407
  return valueList.indexOf(XEUtils.get(row, field)) > -1
1405
1408
  }
@@ -1982,7 +1985,7 @@ const Methods = {
1982
1985
  this.hasFixedColumn = leftList.length > 0 || rightList.length > 0
1983
1986
  Object.assign(columnStore, { leftList, centerList, rightList })
1984
1987
  if (scrollXLoad) {
1985
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
1988
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
1986
1989
  // if (this.showHeader && !this.showHeaderOverflow) {
1987
1990
  // warnLog('vxe.error.reqProp', ['show-header-overflow'])
1988
1991
  // }
@@ -2130,10 +2133,20 @@ const Methods = {
2130
2133
  paddingSize = Math.floor(XEUtils.toNumber(cellStyle.paddingLeft) + XEUtils.toNumber(cellStyle.paddingRight)) + 2
2131
2134
  }
2132
2135
  let colWidth = column.renderAutoWidth - paddingSize
2133
- XEUtils.arrayEach(cellElList, (cellEl: any) => {
2134
- const labelEl = cellEl.firstChild
2135
- if (labelEl) {
2136
- colWidth = Math.max(colWidth, Math.ceil(labelEl.offsetWidth) + 4)
2136
+ XEUtils.arrayEach(cellElList, (itemEl) => {
2137
+ const cellEl = itemEl as HTMLElement
2138
+ const thElem = cellEl.parentNode as HTMLElement
2139
+ let titleWidth = 0
2140
+ if (`${thElem.tagName}`.toLowerCase() === 'th') {
2141
+ XEUtils.arrayEach(cellEl.children, (btnEl) => {
2142
+ titleWidth += (btnEl as HTMLElement).offsetWidth + 1
2143
+ })
2144
+ } else {
2145
+ const labelEl = cellEl.firstChild as HTMLElement
2146
+ titleWidth = labelEl.offsetWidth
2147
+ }
2148
+ if (titleWidth) {
2149
+ colWidth = Math.max(colWidth, Math.ceil(titleWidth) + 4)
2137
2150
  }
2138
2151
  })
2139
2152
  column.renderAutoWidth = colWidth + paddingSize
@@ -2590,7 +2603,7 @@ const Methods = {
2590
2603
  // 兼容老版本
2591
2604
  if (!evntList.length && type === 'event.clearEdit') {
2592
2605
  evntList = interceptor.get('event.clearActived')
2593
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
2606
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
2594
2607
  if (evntList.length) {
2595
2608
  warnLog('vxe.error.delEvent', ['event.clearActived', 'event.clearEdit'])
2596
2609
  }
@@ -2988,12 +3001,6 @@ const Methods = {
2988
3001
  setCellValue(selected.row, selected.column, null)
2989
3002
  this.handleEdit(selected.args, evnt)
2990
3003
  }
2991
- const afterEditMethod = editOpts.afterEditMethod
2992
- if (afterEditMethod) {
2993
- this.$nextTick(() => {
2994
- afterEditMethod(params)
2995
- })
2996
- }
2997
3004
  }
2998
3005
  }
2999
3006
  }
@@ -4394,7 +4401,7 @@ const Methods = {
4394
4401
  },
4395
4402
  // 在 v3 中废弃
4396
4403
  getSortColumn () {
4397
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
4404
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
4398
4405
  warnLog('vxe.error.delFunc', ['getSortColumn', 'getSortColumns'])
4399
4406
  }
4400
4407
  return XEUtils.find(this.tableFullColumn, column => (column.sortable || column.remoteSort) && column.order)
@@ -4491,7 +4498,7 @@ const Methods = {
4491
4498
  return this.$nextTick()
4492
4499
  },
4493
4500
  reloadExpandContent (row: any) {
4494
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
4501
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
4495
4502
  warnLog('vxe.error.delFunc', ['reloadExpandContent', 'reloadRowExpand'])
4496
4503
  }
4497
4504
  // 即将废弃
@@ -4653,7 +4660,7 @@ const Methods = {
4653
4660
  return !!rowExpandedMaps[rowid]
4654
4661
  },
4655
4662
  isExpandByRow (row: any) {
4656
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
4663
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
4657
4664
  warnLog('vxe.error.delFunc', ['isExpandByRow', 'isRowExpandByRow'])
4658
4665
  }
4659
4666
  // 即将废弃
@@ -4770,7 +4777,7 @@ const Methods = {
4770
4777
  return this.$nextTick()
4771
4778
  },
4772
4779
  reloadTreeChilds (row: any) {
4773
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
4780
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
4774
4781
  warnLog('vxe.error.delFunc', ['reloadTreeChilds', 'reloadTreeExpand'])
4775
4782
  }
4776
4783
  // 即将废弃
@@ -5537,7 +5544,7 @@ const funcs = 'setFilter,openFilter,clearFilter,getCheckedFilters,updateFilterOp
5537
5544
 
5538
5545
  funcs.forEach(name => {
5539
5546
  Methods[name] = function (...args: any[]) {
5540
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
5547
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
5541
5548
  if (!this[`_${name}`]) {
5542
5549
  if ('openExport,openPrint,exportData,openImport,importData,saveFile,readFile,importByFile,print'.split(',').includes(name)) {
5543
5550
  errLog('vxe.error.reqModule', ['VxeTableExportModule'])