vxe-table 4.14.0-beta.0 → 4.14.0-beta.10

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 (207) hide show
  1. package/README.en.md +1 -70
  2. package/README.ja-JP.md +1 -70
  3. package/README.md +9 -18
  4. package/README.zh-TW.md +1 -69
  5. package/es/grid/src/grid.js +129 -96
  6. package/es/index.css +1 -1
  7. package/es/index.esm.js +2 -2
  8. package/es/index.min.css +1 -1
  9. package/es/locale/lang/ar-EG.js +4 -1
  10. package/es/locale/lang/de-DE.js +4 -1
  11. package/es/locale/lang/en-US.js +4 -1
  12. package/es/locale/lang/es-ES.js +4 -1
  13. package/es/locale/lang/fr-FR.js +4 -1
  14. package/es/locale/lang/hu-HU.js +4 -1
  15. package/es/locale/lang/hy-AM.js +4 -1
  16. package/es/locale/lang/id-ID.js +4 -1
  17. package/es/locale/lang/it-IT.js +4 -1
  18. package/es/locale/lang/ja-JP.js +4 -1
  19. package/es/locale/lang/ko-KR.js +4 -1
  20. package/es/locale/lang/ms-MY.js +4 -1
  21. package/es/locale/lang/nb-NO.js +4 -1
  22. package/es/locale/lang/pt-BR.js +4 -1
  23. package/es/locale/lang/ru-RU.js +4 -1
  24. package/es/locale/lang/th-TH.js +4 -1
  25. package/es/locale/lang/ug-CN.js +4 -1
  26. package/es/locale/lang/uk-UA.js +4 -1
  27. package/es/locale/lang/uz-UZ.js +4 -1
  28. package/es/locale/lang/vi-VN.js +4 -1
  29. package/es/locale/lang/zh-CHT.js +4 -1
  30. package/es/locale/lang/zh-CN.js +4 -1
  31. package/es/style.css +1 -1
  32. package/es/style.min.css +1 -1
  33. package/es/table/module/custom/hook.js +0 -4
  34. package/es/table/module/custom/panel.js +0 -1
  35. package/es/table/module/edit/hook.js +31 -1
  36. package/es/table/module/filter/hook.js +1 -1
  37. package/es/table/module/keyboard/hook.js +2 -2
  38. package/es/table/src/anime.js +46 -0
  39. package/es/table/src/body.js +13 -27
  40. package/es/table/src/cell.js +1 -1
  41. package/es/table/src/columnInfo.js +5 -0
  42. package/es/table/src/footer.js +8 -25
  43. package/es/table/src/header.js +5 -22
  44. package/es/table/src/table.js +610 -382
  45. package/es/table/src/util.js +6 -2
  46. package/es/table/style.css +8 -8
  47. package/es/table/style.min.css +1 -1
  48. package/es/ui/index.js +8 -2
  49. package/es/ui/src/log.js +1 -1
  50. package/es/vxe-table/style.css +8 -8
  51. package/es/vxe-table/style.min.css +1 -1
  52. package/lib/grid/src/grid.js +145 -100
  53. package/lib/grid/src/grid.min.js +1 -1
  54. package/lib/index.common.js +5 -5
  55. package/lib/index.css +1 -1
  56. package/lib/index.min.css +1 -1
  57. package/lib/index.umd.js +325 -234
  58. package/lib/index.umd.min.js +1 -1
  59. package/lib/locale/lang/ar-EG.js +4 -1
  60. package/lib/locale/lang/ar-EG.min.js +1 -1
  61. package/lib/locale/lang/ar-EG.umd.js +4 -1
  62. package/lib/locale/lang/de-DE.js +4 -1
  63. package/lib/locale/lang/de-DE.min.js +1 -1
  64. package/lib/locale/lang/de-DE.umd.js +4 -1
  65. package/lib/locale/lang/en-US.js +4 -1
  66. package/lib/locale/lang/en-US.min.js +1 -1
  67. package/lib/locale/lang/en-US.umd.js +4 -1
  68. package/lib/locale/lang/es-ES.js +4 -1
  69. package/lib/locale/lang/es-ES.min.js +1 -1
  70. package/lib/locale/lang/es-ES.umd.js +4 -1
  71. package/lib/locale/lang/fr-FR.js +4 -1
  72. package/lib/locale/lang/fr-FR.min.js +1 -1
  73. package/lib/locale/lang/fr-FR.umd.js +4 -1
  74. package/lib/locale/lang/hu-HU.js +4 -1
  75. package/lib/locale/lang/hu-HU.min.js +1 -1
  76. package/lib/locale/lang/hu-HU.umd.js +4 -1
  77. package/lib/locale/lang/hy-AM.js +4 -1
  78. package/lib/locale/lang/hy-AM.min.js +1 -1
  79. package/lib/locale/lang/hy-AM.umd.js +4 -1
  80. package/lib/locale/lang/id-ID.js +4 -1
  81. package/lib/locale/lang/id-ID.min.js +1 -1
  82. package/lib/locale/lang/id-ID.umd.js +4 -1
  83. package/lib/locale/lang/it-IT.js +4 -1
  84. package/lib/locale/lang/it-IT.min.js +1 -1
  85. package/lib/locale/lang/it-IT.umd.js +4 -1
  86. package/lib/locale/lang/ja-JP.js +4 -1
  87. package/lib/locale/lang/ja-JP.min.js +1 -1
  88. package/lib/locale/lang/ja-JP.umd.js +4 -1
  89. package/lib/locale/lang/ko-KR.js +4 -1
  90. package/lib/locale/lang/ko-KR.min.js +1 -1
  91. package/lib/locale/lang/ko-KR.umd.js +4 -1
  92. package/lib/locale/lang/ms-MY.js +4 -1
  93. package/lib/locale/lang/ms-MY.min.js +1 -1
  94. package/lib/locale/lang/ms-MY.umd.js +4 -1
  95. package/lib/locale/lang/nb-NO.js +4 -1
  96. package/lib/locale/lang/nb-NO.min.js +1 -1
  97. package/lib/locale/lang/nb-NO.umd.js +4 -1
  98. package/lib/locale/lang/pt-BR.js +4 -1
  99. package/lib/locale/lang/pt-BR.min.js +1 -1
  100. package/lib/locale/lang/pt-BR.umd.js +4 -1
  101. package/lib/locale/lang/ru-RU.js +4 -1
  102. package/lib/locale/lang/ru-RU.min.js +1 -1
  103. package/lib/locale/lang/ru-RU.umd.js +4 -1
  104. package/lib/locale/lang/th-TH.js +4 -1
  105. package/lib/locale/lang/th-TH.min.js +1 -1
  106. package/lib/locale/lang/th-TH.umd.js +4 -1
  107. package/lib/locale/lang/ug-CN.js +4 -1
  108. package/lib/locale/lang/ug-CN.min.js +1 -1
  109. package/lib/locale/lang/ug-CN.umd.js +4 -1
  110. package/lib/locale/lang/uk-UA.js +4 -1
  111. package/lib/locale/lang/uk-UA.min.js +1 -1
  112. package/lib/locale/lang/uk-UA.umd.js +4 -1
  113. package/lib/locale/lang/uz-UZ.js +4 -1
  114. package/lib/locale/lang/uz-UZ.min.js +1 -1
  115. package/lib/locale/lang/uz-UZ.umd.js +4 -1
  116. package/lib/locale/lang/vi-VN.js +4 -1
  117. package/lib/locale/lang/vi-VN.min.js +1 -1
  118. package/lib/locale/lang/vi-VN.umd.js +4 -1
  119. package/lib/locale/lang/zh-CHT.js +4 -1
  120. package/lib/locale/lang/zh-CHT.min.js +1 -1
  121. package/lib/locale/lang/zh-CHT.umd.js +4 -1
  122. package/lib/locale/lang/zh-CN.js +4 -1
  123. package/lib/locale/lang/zh-CN.min.js +1 -1
  124. package/lib/locale/lang/zh-CN.umd.js +4 -1
  125. package/lib/style.css +1 -1
  126. package/lib/style.min.css +1 -1
  127. package/lib/table/module/custom/hook.js +0 -4
  128. package/lib/table/module/custom/hook.min.js +1 -1
  129. package/lib/table/module/custom/panel.js +0 -1
  130. package/lib/table/module/custom/panel.min.js +1 -1
  131. package/lib/table/module/edit/hook.js +30 -1
  132. package/lib/table/module/edit/hook.min.js +1 -1
  133. package/lib/table/module/filter/hook.js +1 -1
  134. package/lib/table/module/filter/hook.min.js +1 -1
  135. package/lib/table/module/keyboard/hook.js +2 -2
  136. package/lib/table/module/keyboard/hook.min.js +1 -1
  137. package/lib/table/src/anime.js +56 -0
  138. package/lib/table/src/anime.min.js +1 -0
  139. package/lib/table/src/body.js +6 -29
  140. package/lib/table/src/body.min.js +1 -1
  141. package/lib/table/src/cell.js +1 -1
  142. package/lib/table/src/cell.min.js +1 -1
  143. package/lib/table/src/columnInfo.js +5 -0
  144. package/lib/table/src/columnInfo.min.js +1 -1
  145. package/lib/table/src/footer.js +6 -23
  146. package/lib/table/src/footer.min.js +1 -1
  147. package/lib/table/src/header.js +3 -20
  148. package/lib/table/src/header.min.js +1 -1
  149. package/lib/table/src/table.js +57 -46
  150. package/lib/table/src/table.min.js +1 -1
  151. package/lib/table/src/util.js +11 -3
  152. package/lib/table/src/util.min.js +1 -1
  153. package/lib/table/style/style.css +8 -8
  154. package/lib/table/style/style.min.css +1 -1
  155. package/lib/ui/index.js +8 -2
  156. package/lib/ui/index.min.js +1 -1
  157. package/lib/ui/src/log.js +1 -1
  158. package/lib/ui/src/log.min.js +1 -1
  159. package/lib/vxe-table/style/style.css +8 -8
  160. package/lib/vxe-table/style/style.min.css +1 -1
  161. package/package.json +2 -2
  162. package/packages/grid/src/grid.ts +138 -103
  163. package/packages/index.ts +2 -2
  164. package/packages/locale/lang/ar-EG.ts +4 -1
  165. package/packages/locale/lang/de-DE.ts +4 -1
  166. package/packages/locale/lang/en-US.ts +4 -1
  167. package/packages/locale/lang/es-ES.ts +4 -1
  168. package/packages/locale/lang/fr-FR.ts +4 -1
  169. package/packages/locale/lang/hu-HU.ts +4 -1
  170. package/packages/locale/lang/hy-AM.ts +4 -1
  171. package/packages/locale/lang/id-ID.ts +4 -1
  172. package/packages/locale/lang/it-IT.ts +4 -1
  173. package/packages/locale/lang/ja-JP.ts +4 -1
  174. package/packages/locale/lang/ko-KR.ts +4 -1
  175. package/packages/locale/lang/ms-MY.ts +4 -1
  176. package/packages/locale/lang/nb-NO.ts +4 -1
  177. package/packages/locale/lang/pt-BR.ts +4 -1
  178. package/packages/locale/lang/ru-RU.ts +4 -1
  179. package/packages/locale/lang/th-TH.ts +4 -1
  180. package/packages/locale/lang/ug-CN.ts +4 -1
  181. package/packages/locale/lang/uk-UA.ts +4 -1
  182. package/packages/locale/lang/uz-UZ.ts +4 -1
  183. package/packages/locale/lang/vi-VN.ts +4 -1
  184. package/packages/locale/lang/zh-CHT.ts +4 -1
  185. package/packages/locale/lang/zh-CN.ts +4 -1
  186. package/packages/table/module/custom/hook.ts +0 -4
  187. package/packages/table/module/custom/panel.ts +0 -1
  188. package/packages/table/module/edit/hook.ts +29 -1
  189. package/packages/table/module/filter/hook.ts +1 -1
  190. package/packages/table/module/keyboard/hook.ts +2 -2
  191. package/packages/table/src/anime.ts +52 -0
  192. package/packages/table/src/body.ts +20 -41
  193. package/packages/table/src/cell.ts +1 -1
  194. package/packages/table/src/columnInfo.ts +5 -0
  195. package/packages/table/src/footer.ts +8 -25
  196. package/packages/table/src/header.ts +5 -22
  197. package/packages/table/src/table.ts +621 -385
  198. package/packages/table/src/util.ts +6 -2
  199. package/packages/ui/index.ts +7 -1
  200. package/styles/components/table.scss +9 -9
  201. package/types/all.d.ts +3 -18
  202. /package/es/{iconfont.1750770364548.ttf → iconfont.1751970630744.ttf} +0 -0
  203. /package/es/{iconfont.1750770364548.woff → iconfont.1751970630744.woff} +0 -0
  204. /package/es/{iconfont.1750770364548.woff2 → iconfont.1751970630744.woff2} +0 -0
  205. /package/lib/{iconfont.1750770364548.ttf → iconfont.1751970630744.ttf} +0 -0
  206. /package/lib/{iconfont.1750770364548.woff → iconfont.1751970630744.woff} +0 -0
  207. /package/lib/{iconfont.1750770364548.woff2 → iconfont.1751970630744.woff2} +0 -0
@@ -9,7 +9,7 @@ import VxeToolbarComponent from '../../toolbar/src/toolbar'
9
9
  import tableComponentProps from '../../table/src/props'
10
10
  import tableComponentEmits from '../../table/src/emits'
11
11
  import { getSlotVNs } from '../../ui/src/vn'
12
- import { errLog } from '../../ui/src/log'
12
+ import { warnLog, errLog } from '../../ui/src/log'
13
13
 
14
14
  import type { ValueOf, VxePagerComponent, VxeFormComponent, VxeFormEvents, VxeFormInstance, VxePagerEvents, VxeFormItemProps, VxePagerInstance, VxeComponentStyleType } from 'vxe-pc-ui'
15
15
  import type { VxeTableMethods, VxeGridConstructor, VxeGridEmits, GridReactData, VxeGridPropTypes, VxeToolbarPropTypes, GridMethods, GridPrivateMethods, VxeGridPrivateComputed, VxeGridPrivateMethods, VxeToolbarInstance, GridPrivateRef, VxeTableProps, VxeTableConstructor, VxeTablePrivateMethods, VxeTableEvents, VxeTableDefines, VxeTableEventProps, VxeGridProps } from '../../../types'
@@ -119,29 +119,29 @@ export default defineVxeComponent({
119
119
  })
120
120
 
121
121
  const computeProxyOpts = computed(() => {
122
- return XEUtils.merge({}, XEUtils.clone(getConfig().grid.proxyConfig, true), props.proxyConfig) as VxeGridPropTypes.ProxyConfig
122
+ return XEUtils.merge({}, XEUtils.clone(getConfig().grid.proxyConfig, true), props.proxyConfig)
123
123
  })
124
124
 
125
125
  const computeIsRespMsg = computed(() => {
126
126
  const proxyOpts = computeProxyOpts.value
127
- return XEUtils.isBoolean(proxyOpts.message) ? proxyOpts.message : proxyOpts.showResponseMsg
127
+ return !!(XEUtils.isBoolean(proxyOpts.message) ? proxyOpts.message : proxyOpts.showResponseMsg)
128
128
  })
129
129
 
130
130
  const computeIsActiveMsg = computed(() => {
131
131
  const proxyOpts = computeProxyOpts.value
132
- return proxyOpts.showActiveMsg
132
+ return !!proxyOpts.showActiveMsg
133
133
  })
134
134
 
135
135
  const computePagerOpts = computed(() => {
136
- return Object.assign({}, getConfig().grid.pagerConfig, props.pagerConfig) as VxeGridPropTypes.PagerConfig
136
+ return Object.assign({}, getConfig().grid.pagerConfig, props.pagerConfig)
137
137
  })
138
138
 
139
139
  const computeFormOpts = computed(() => {
140
- return Object.assign({}, getConfig().grid.formConfig, props.formConfig) as VxeGridPropTypes.FormOpts
140
+ return Object.assign({}, getConfig().grid.formConfig, props.formConfig)
141
141
  })
142
142
 
143
143
  const computeToolbarOpts = computed(() => {
144
- return Object.assign({}, getConfig().grid.toolbarConfig, props.toolbarConfig) as VxeGridPropTypes.ToolbarOpts
144
+ return Object.assign({}, getConfig().grid.toolbarConfig, props.toolbarConfig)
145
145
  })
146
146
 
147
147
  const computeZoomOpts = computed(() => {
@@ -175,11 +175,12 @@ export default defineVxeComponent({
175
175
  })
176
176
 
177
177
  const computeTableProps = computed(() => {
178
- const { seqConfig, pagerConfig, loading, editConfig, proxyConfig } = props
179
- const { isZMax, tableLoading, tablePage } = reactData
178
+ const { seqConfig, pagerConfig, editConfig, proxyConfig } = props
179
+ const { isZMax, tablePage } = reactData
180
180
  const tableExtendProps = computeTableExtendProps.value
181
181
  const proxyOpts = computeProxyOpts.value
182
182
  const pagerOpts = computePagerOpts.value
183
+ const isLoading = computeIsLoading.value
183
184
  const tProps = Object.assign({}, tableExtendProps)
184
185
  if (isZMax) {
185
186
  if (tableExtendProps.maxHeight) {
@@ -189,7 +190,7 @@ export default defineVxeComponent({
189
190
  }
190
191
  }
191
192
  if (proxyConfig && isEnableConf(proxyOpts)) {
192
- tProps.loading = loading || tableLoading
193
+ tProps.loading = isLoading
193
194
  if (pagerConfig && proxyOpts.seq && isEnableConf(pagerOpts)) {
194
195
  tProps.seqConfig = Object.assign({}, seqConfig, { startIndex: (tablePage.currentPage - 1) * tablePage.pageSize })
195
196
  }
@@ -242,6 +243,14 @@ export default defineVxeComponent({
242
243
  return pagerOpts.total
243
244
  })
244
245
 
246
+ const computeIsLoading = computed(() => {
247
+ const { loading, proxyConfig } = props
248
+ const { tableLoading } = reactData
249
+ const proxyOpts = computeProxyOpts.value
250
+ const { showLoading } = proxyOpts
251
+ return loading || (tableLoading && showLoading && proxyConfig && isEnableConf(proxyOpts))
252
+ })
253
+
245
254
  const refMaps: GridPrivateRef = {
246
255
  refElem,
247
256
  refTable,
@@ -390,12 +399,12 @@ export default defineVxeComponent({
390
399
  reactData.sortData = params.sortList
391
400
  if (proxyConfig && isEnableConf(proxyOpts)) {
392
401
  reactData.tablePage.currentPage = 1
393
- gridMethods.commitProxy('query').then((rest) => {
394
- gridMethods.dispatchEvent('proxy-query', rest, params.$event)
402
+ $xeGrid.commitProxy('query').then((rest) => {
403
+ $xeGrid.dispatchEvent('proxy-query', rest, params.$event)
395
404
  })
396
405
  }
397
406
  }
398
- gridMethods.dispatchEvent('sort-change', params, params.$event)
407
+ $xeGrid.dispatchEvent('sort-change', params, params.$event)
399
408
  }
400
409
 
401
410
  const filterChangeEvent: VxeTableEvents.FilterChange = (params) => {
@@ -409,12 +418,12 @@ export default defineVxeComponent({
409
418
  reactData.filterData = params.filterList
410
419
  if (proxyConfig && isEnableConf(proxyOpts)) {
411
420
  reactData.tablePage.currentPage = 1
412
- gridMethods.commitProxy('query').then((rest) => {
413
- gridMethods.dispatchEvent('proxy-query', rest, params.$event)
421
+ $xeGrid.commitProxy('query').then((rest) => {
422
+ $xeGrid.dispatchEvent('proxy-query', rest, params.$event)
414
423
  })
415
424
  }
416
425
  }
417
- gridMethods.dispatchEvent('filter-change', params, params.$event)
426
+ $xeGrid.dispatchEvent('filter-change', params, params.$event)
418
427
  }
419
428
 
420
429
  const submitFormEvent: VxeFormEvents.Submit = (params) => {
@@ -424,35 +433,35 @@ export default defineVxeComponent({
424
433
  return
425
434
  }
426
435
  if (proxyConfig && isEnableConf(proxyOpts)) {
427
- gridMethods.commitProxy('reload').then((rest) => {
428
- gridMethods.dispatchEvent('proxy-query', { ...rest, isReload: true }, params.$event)
436
+ $xeGrid.commitProxy('reload').then((rest) => {
437
+ $xeGrid.dispatchEvent('proxy-query', { ...rest, isReload: true }, params.$event)
429
438
  })
430
439
  }
431
- gridMethods.dispatchEvent('form-submit', params, params.$event)
440
+ $xeGrid.dispatchEvent('form-submit', params, params.$event)
432
441
  }
433
442
 
434
443
  const resetFormEvent: VxeFormEvents.Reset = (params) => {
444
+ const $xeTable = refTable.value
435
445
  const { proxyConfig } = props
436
446
  const { $event } = params
437
447
  const proxyOpts = computeProxyOpts.value
438
- const $xeTable = refTable.value
439
448
  if (proxyConfig && isEnableConf(proxyOpts)) {
440
449
  $xeTable.clearScroll()
441
- gridMethods.commitProxy('reload').then((rest) => {
442
- gridMethods.dispatchEvent('proxy-query', { ...rest, isReload: true }, $event)
450
+ $xeGrid.commitProxy('reload').then((rest) => {
451
+ $xeGrid.dispatchEvent('proxy-query', { ...rest, isReload: true }, $event)
443
452
  })
444
453
  }
445
- gridMethods.dispatchEvent('form-reset', params, $event)
454
+ $xeGrid.dispatchEvent('form-reset', params, $event)
446
455
  }
447
456
 
448
457
  const submitInvalidEvent: VxeFormEvents.SubmitInvalid = (params) => {
449
- gridMethods.dispatchEvent('form-submit-invalid', params, params.$event)
458
+ $xeGrid.dispatchEvent('form-submit-invalid', params, params.$event)
450
459
  }
451
460
 
452
461
  const collapseEvent: VxeFormEvents.Collapse = (params) => {
453
462
  const { $event } = params
454
- gridMethods.dispatchEvent('form-toggle-collapse', params, $event)
455
- gridMethods.dispatchEvent('form-collapse', params, $event)
463
+ $xeGrid.dispatchEvent('form-toggle-collapse', params, $event)
464
+ $xeGrid.dispatchEvent('form-collapse', params, $event)
456
465
  }
457
466
 
458
467
  const handleZoom = (isMax?: boolean) => {
@@ -464,9 +473,9 @@ export default defineVxeComponent({
464
473
  }
465
474
  }
466
475
  return nextTick()
467
- .then(() => gridExtendTableMethods.recalculate(true))
476
+ .then(() => $xeGrid.recalculate(true))
468
477
  .then(() => {
469
- setTimeout(() => gridExtendTableMethods.recalculate(true), 15)
478
+ setTimeout(() => $xeGrid.recalculate(true), 15)
470
479
  return reactData.isZMax
471
480
  })
472
481
  }
@@ -520,8 +529,8 @@ export default defineVxeComponent({
520
529
  } else {
521
530
  if (formOpts.items) {
522
531
  const formSlots: { [key: string]: () => VNode[] } = {}
523
- if (!formOpts.inited) {
524
- formOpts.inited = true
532
+ if (!(formOpts as any).inited) {
533
+ (formOpts as any).inited = true
525
534
  const beforeItem = proxyOpts.beforeItem
526
535
  if (proxyOpts && beforeItem) {
527
536
  formOpts.items.forEach((item) => {
@@ -631,12 +640,13 @@ export default defineVxeComponent({
631
640
  * 渲染表格顶部区域
632
641
  */
633
642
  const renderTop = () => {
634
- if (slots.top) {
643
+ const topSlot = slots.top
644
+ if (topSlot) {
635
645
  return h('div', {
636
646
  ref: refTopWrapper,
637
647
  key: 'top',
638
648
  class: 'vxe-grid--top-wrapper'
639
- }, slots.top({ $grid: $xeGrid }))
649
+ }, topSlot({ $grid: $xeGrid }))
640
650
  }
641
651
  return renderEmptyElement($xeGrid)
642
652
  }
@@ -830,6 +840,30 @@ export default defineVxeComponent({
830
840
  tableCompEvents[type] = (...args: any[]) => emit(name, ...args)
831
841
  })
832
842
 
843
+ const getDefaultFormData = () => {
844
+ const formOpts = computeFormOpts.value
845
+ if (formOpts.items) {
846
+ const fData: any = {}
847
+ formOpts.items.forEach(item => {
848
+ const { field, itemRender } = item
849
+ if (field) {
850
+ let itemValue: any = null
851
+ if (itemRender) {
852
+ const { defaultValue } = itemRender
853
+ if (XEUtils.isFunction(defaultValue)) {
854
+ itemValue = defaultValue({ item })
855
+ } else if (!XEUtils.isUndefined(defaultValue)) {
856
+ itemValue = defaultValue
857
+ }
858
+ }
859
+ fData[field] = itemValue
860
+ }
861
+ })
862
+ return fData
863
+ }
864
+ return {}
865
+ }
866
+
833
867
  const initProxy = () => {
834
868
  const { proxyConfig, formConfig } = props
835
869
  const { proxyInited } = reactData
@@ -837,40 +871,24 @@ export default defineVxeComponent({
837
871
  const formOpts = computeFormOpts.value
838
872
  if (proxyConfig && isEnableConf(proxyOpts)) {
839
873
  if (formConfig && isEnableConf(formOpts) && proxyOpts.form && formOpts.items) {
840
- const fData: any = {}
841
- formOpts.items.forEach(item => {
842
- const { field, itemRender } = item
843
- if (field) {
844
- let itemValue: any = null
845
- if (itemRender) {
846
- const { defaultValue } = itemRender
847
- if (XEUtils.isFunction(defaultValue)) {
848
- itemValue = defaultValue({ item })
849
- } else if (!XEUtils.isUndefined(defaultValue)) {
850
- itemValue = defaultValue
851
- }
852
- }
853
- fData[field] = itemValue
854
- }
855
- })
856
- reactData.formData = fData
874
+ reactData.formData = getDefaultFormData()
857
875
  }
858
876
  if (!proxyInited) {
859
877
  reactData.proxyInited = true
860
878
  if (proxyOpts.autoLoad !== false) {
861
- nextTick().then(() => gridMethods.commitProxy('_init')).then((rest) => {
862
- gridMethods.dispatchEvent('proxy-query', { ...rest, isInited: true }, new Event('init'))
879
+ nextTick().then(() => gridMethods.commitProxy('initial')).then((rest) => {
880
+ gridMethods.dispatchEvent('proxy-query', { ...rest, isInited: true }, new Event('initial'))
863
881
  })
864
882
  }
865
883
  }
866
884
  }
867
885
  }
868
886
 
869
- const handleGlobalKeydownEvent = (evnt: any) => {
887
+ const handleGlobalKeydownEvent = (evnt: KeyboardEvent) => {
870
888
  const zoomOpts = computeZoomOpts.value
871
889
  const isEsc = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ESCAPE)
872
890
  if (isEsc && reactData.isZMax && zoomOpts.escRestore !== false) {
873
- gridPrivateMethods.triggerZoomEvent(evnt)
891
+ $xeGrid.triggerZoomEvent(evnt)
874
892
  }
875
893
  }
876
894
 
@@ -888,7 +906,7 @@ export default defineVxeComponent({
888
906
  * @param {String/Object} code 字符串或对象
889
907
  */
890
908
  commitProxy (proxyTarget: string | VxeToolbarPropTypes.ButtonConfig, ...args: any[]) {
891
- const { toolbarConfig, pagerConfig, editRules, validConfig } = props
909
+ const { proxyConfig, toolbarConfig, pagerConfig, editRules, validConfig } = props
892
910
  const { tablePage } = reactData
893
911
  const isActiveMsg = computeIsActiveMsg.value
894
912
  const isRespMsg = computeIsRespMsg.value
@@ -898,7 +916,7 @@ export default defineVxeComponent({
898
916
  const { beforeQuery, afterQuery, beforeDelete, afterDelete, beforeSave, afterSave, ajax = {} } = proxyOpts
899
917
  const resConfigs = proxyOpts.response || proxyOpts.props || {}
900
918
  const $xeTable = refTable.value
901
- const formData = getFormData()
919
+ let formData = getFormData()
902
920
  let button: VxeToolbarPropTypes.ButtonConfig | null = null
903
921
  let code: string | null = null
904
922
  if (XEUtils.isString(proxyTarget)) {
@@ -915,11 +933,11 @@ export default defineVxeComponent({
915
933
  case 'insert':
916
934
  return $xeTable.insert({})
917
935
  case 'insert_edit':
918
- return $xeTable.insert({}).then(({ row }) => $xeTable.setEditRow(row))
936
+ return $xeTable.insert({}).then(({ row }) => $xeTable.setEditRow(row, true))
919
937
 
920
938
  // 已废弃
921
939
  case 'insert_actived':
922
- return $xeTable.insert({}).then(({ row }) => $xeTable.setEditRow(row))
940
+ return $xeTable.insert({}).then(({ row }) => $xeTable.setEditRow(row, true))
923
941
  // 已废弃
924
942
 
925
943
  case 'mark_cancel':
@@ -941,14 +959,14 @@ export default defineVxeComponent({
941
959
  break
942
960
  case 'reset_custom':
943
961
  return $xeTable.resetCustom(true)
944
- case '_init':
962
+ case 'initial':
945
963
  case 'reload':
946
964
  case 'query': {
947
965
  const ajaxMethods = ajax.query
948
966
  const querySuccessMethods = ajax.querySuccess
949
967
  const queryErrorMethods = ajax.queryError
950
968
  if (ajaxMethods) {
951
- const isInited = code === '_init'
969
+ const isInited = code === 'initial'
952
970
  const isReload = code === 'reload'
953
971
  if (!isInited && reactData.tableLoading) {
954
972
  return nextTick()
@@ -958,6 +976,7 @@ export default defineVxeComponent({
958
976
  let pageParams: any = {}
959
977
  if (pagerConfig) {
960
978
  if (isInited || isReload) {
979
+ // 重置分页
961
980
  tablePage.currentPage = 1
962
981
  }
963
982
  if (isEnableConf(pagerOpts)) {
@@ -965,26 +984,41 @@ export default defineVxeComponent({
965
984
  }
966
985
  }
967
986
  if (isInited) {
968
- let defaultSort = null
987
+ // 重置代理表单数据
988
+ if (proxyConfig && isEnableConf(proxyOpts) && proxyOpts.form) {
989
+ formData = getDefaultFormData()
990
+ reactData.formData = formData
991
+ }
969
992
  if ($xeTable) {
993
+ const tableInternalData = $xeTable.internalData
994
+ const { tableFullColumn, fullColumnFieldData } = tableInternalData
970
995
  const { computeSortOpts } = $xeTable.getComputeMaps()
971
996
  const sortOpts = computeSortOpts.value
972
- defaultSort = sortOpts.defaultSort
973
- }
974
- // 如果使用默认排序
975
- if (defaultSort) {
976
- if (!XEUtils.isArray(defaultSort)) {
977
- defaultSort = [defaultSort]
978
- }
979
- sortList = defaultSort.map((item) => {
980
- return {
981
- field: item.field,
982
- property: item.field,
983
- order: item.order
984
- }
997
+ let defaultSort = sortOpts.defaultSort
998
+ tableFullColumn.forEach((column) => {
999
+ column.order = null
985
1000
  })
986
- }
987
- if ($xeTable) {
1001
+ // 如果使用默认排序
1002
+ if (defaultSort) {
1003
+ if (!XEUtils.isArray(defaultSort)) {
1004
+ defaultSort = [defaultSort]
1005
+ }
1006
+ sortList = defaultSort.map((item) => {
1007
+ const { field, order } = item
1008
+ const colRest = fullColumnFieldData[field]
1009
+ if (colRest) {
1010
+ const column = colRest.column
1011
+ if (column) {
1012
+ column.order = order
1013
+ }
1014
+ }
1015
+ return {
1016
+ field,
1017
+ property: field,
1018
+ order
1019
+ }
1020
+ })
1021
+ }
988
1022
  filterList = $xeTable.getCheckedFilters()
989
1023
  }
990
1024
  } else {
@@ -1310,23 +1344,23 @@ export default defineVxeComponent({
1310
1344
  },
1311
1345
  triggerToolbarCommitEvent (params, evnt) {
1312
1346
  const { code } = params
1313
- return gridMethods.commitProxy(params, evnt).then((rest) => {
1347
+ return $xeGrid.commitProxy(params, evnt).then((rest) => {
1314
1348
  if (code && rest && rest.status && ['query', 'reload', 'delete', 'save'].includes(code)) {
1315
- gridMethods.dispatchEvent(code === 'delete' || code === 'save' ? `proxy-${code as 'delete' | 'save'}` : 'proxy-query', { ...rest, isReload: code === 'reload' }, evnt)
1349
+ $xeGrid.dispatchEvent(code === 'delete' || code === 'save' ? `proxy-${code as 'delete' | 'save'}` : 'proxy-query', { ...rest, isReload: code === 'reload' }, evnt)
1316
1350
  }
1317
1351
  })
1318
1352
  },
1319
1353
  triggerToolbarBtnEvent (button, evnt) {
1320
- gridPrivateMethods.triggerToolbarCommitEvent(button, evnt)
1321
- gridMethods.dispatchEvent('toolbar-button-click', { code: button.code, button }, evnt)
1354
+ $xeGrid.triggerToolbarCommitEvent(button, evnt)
1355
+ $xeGrid.dispatchEvent('toolbar-button-click', { code: button.code, button }, evnt)
1322
1356
  },
1323
1357
  triggerToolbarTolEvent (tool, evnt) {
1324
- gridPrivateMethods.triggerToolbarCommitEvent(tool, evnt)
1325
- gridMethods.dispatchEvent('toolbar-tool-click', { code: tool.code, tool }, evnt)
1358
+ $xeGrid.triggerToolbarCommitEvent(tool, evnt)
1359
+ $xeGrid.dispatchEvent('toolbar-tool-click', { code: tool.code, tool }, evnt)
1326
1360
  },
1327
1361
  triggerZoomEvent (evnt) {
1328
- gridMethods.zoom()
1329
- gridMethods.dispatchEvent('zoom', { type: reactData.isZMax ? 'max' : 'revert' }, evnt)
1362
+ $xeGrid.zoom()
1363
+ $xeGrid.dispatchEvent('zoom', { type: reactData.isZMax ? 'max' : 'revert' }, evnt)
1330
1364
  }
1331
1365
  }
1332
1366
 
@@ -1356,6 +1390,23 @@ export default defineVxeComponent({
1356
1390
  }
1357
1391
  })
1358
1392
 
1393
+ const renderVN = () => {
1394
+ const vSize = computeSize.value
1395
+ const styles = computeStyles.value
1396
+ const isLoading = computeIsLoading.value
1397
+ return h('div', {
1398
+ ref: refElem,
1399
+ class: ['vxe-grid', {
1400
+ [`size--${vSize}`]: vSize,
1401
+ 'is--animat': !!props.animat,
1402
+ 'is--round': props.round,
1403
+ 'is--maximize': reactData.isZMax,
1404
+ 'is--loading': isLoading
1405
+ }],
1406
+ style: styles
1407
+ }, renderLayout())
1408
+ }
1409
+
1359
1410
  const columnFlag = ref(0)
1360
1411
  watch(() => props.columns ? props.columns.length : -1, () => {
1361
1412
  columnFlag.value++
@@ -1402,6 +1453,7 @@ export default defineVxeComponent({
1402
1453
  onMounted(() => {
1403
1454
  nextTick(() => {
1404
1455
  const { columns } = props
1456
+ const proxyOpts = computeProxyOpts.value
1405
1457
 
1406
1458
  if (props.formConfig) {
1407
1459
  if (!VxeUIFormComponent) {
@@ -1415,15 +1467,14 @@ export default defineVxeComponent({
1415
1467
  }
1416
1468
 
1417
1469
  // const { data, columns, proxyConfig } = props
1418
- // const proxyOpts = computeProxyOpts.value
1419
1470
  // const formOpts = computeFormOpts.value
1420
1471
  // if (isEnableConf(proxyConfig) && (data || (proxyOpts.form && formOpts.data))) {
1421
1472
  // errLog('vxe.error.errConflicts', ['grid.data', 'grid.proxy-config'])
1422
1473
  // }
1423
1474
 
1424
- // if (proxyOpts.props) {
1425
- // warnLog('vxe.error.delProp', ['proxy-config.props', 'proxy-config.response'])
1426
- // }
1475
+ if (proxyOpts.props) {
1476
+ warnLog('vxe.error.delProp', ['proxy-config.props', 'proxy-config.response'])
1477
+ }
1427
1478
 
1428
1479
  if (columns && columns.length) {
1429
1480
  $xeGrid.loadColumn(columns)
@@ -1438,22 +1489,6 @@ export default defineVxeComponent({
1438
1489
  globalEvents.off($xeGrid, 'keydown')
1439
1490
  })
1440
1491
 
1441
- const renderVN = () => {
1442
- const vSize = computeSize.value
1443
- const styles = computeStyles.value
1444
- return h('div', {
1445
- ref: refElem,
1446
- class: ['vxe-grid', {
1447
- [`size--${vSize}`]: vSize,
1448
- 'is--animat': !!props.animat,
1449
- 'is--round': props.round,
1450
- 'is--maximize': reactData.isZMax,
1451
- 'is--loading': props.loading || reactData.tableLoading
1452
- }],
1453
- style: styles
1454
- }, renderLayout())
1455
- }
1456
-
1457
1492
  $xeGrid.renderVN = renderVN
1458
1493
 
1459
1494
  provide('$xeGrid', $xeGrid)
package/packages/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- import * as VxeTableExport from './components'
1
+ import * as VxeUITableExport from './components'
2
2
 
3
3
  export * from './components'
4
- export default VxeTableExport
4
+ export default VxeUITableExport
@@ -36,6 +36,7 @@ export default {
36
36
  notCommands: 'التوجيه العالمي "{0}" غير موجود',
37
37
  notSlot: 'الفتحة "{0}" غير موجودة',
38
38
  noTree: '"{0}" غير مدعوم في بنية الشجرة',
39
+ noGroup: '数据分组后不支持 "{0}"',
39
40
  notProp: 'المعلمة غير المدعومة "{0}"',
40
41
  checkProp: 'عندما يكون حجم البيانات كبيرًا جدًا ، قد يتم تعثر خانة الاختيار. يوصى بتعيين المعلمة "{0}" لتحسين سرعة التقديم',
41
42
  coverProp: 'يتم تعريف المعلمة "{1}" من "{0}" مرارًا وتكرارًا ، والتي قد تسبب خطأً',
@@ -336,6 +337,7 @@ export default {
336
337
  overCountErr: 'يمكن تحديد ملفات {0} فقط على الأكثر!',
337
338
  overCountExtraErr: 'تم تجاوز الحد الأقصى لعدد {0} ، وسيتم تجاهل الملفات الزائدة {1}!',
338
339
  overSizeErr: 'لا يمكن أن يتجاوز حجم الملف الأقصى {0}!',
340
+ manualUpload: '点击上传',
339
341
  reUpload: 'إعادة التحميل',
340
342
  uploadProgress: 'تحميل {0} ٪',
341
343
  uploadErr: 'فشل التحميل',
@@ -354,7 +356,8 @@ export default {
354
356
  colorPicker: {
355
357
  clear: 'واضح',
356
358
  confirm: 'يتأكد',
357
- copySuccess: 'نسخ إلى الحافظة: {0}'
359
+ copySuccess: 'نسخ إلى الحافظة: {0}',
360
+ hex: 'HEX'
358
361
  },
359
362
  formDesign: {
360
363
  formName: 'اسم النموذج',
@@ -36,6 +36,7 @@ export default {
36
36
  notCommands: 'Die globale Richtlinie "{0}" existiert nicht',
37
37
  notSlot: 'Slot "{0}" existiert nicht',
38
38
  noTree: '"{0}" wird in der Baumstruktur nicht unterstützt',
39
+ noGroup: '数据分组后不支持 "{0}"',
39
40
  notProp: 'Nicht unterstützter Parameter "{0}"',
40
41
  checkProp: 'Wenn das Datenvolumen zu groß ist, kann das Kontrollkästchen stottern. Es wird empfohlen, den Parameter "{0}" festzulegen, um die Rendering -Geschwindigkeit zu verbessern',
41
42
  coverProp: 'Der Parameter "{1}" von "{0}" wird wiederholt definiert, was einen Fehler verursachen kann',
@@ -336,6 +337,7 @@ export default {
336
337
  overCountErr: 'Nur {0} -Dateien können höchstens ausgewählt werden!',
337
338
  overCountExtraErr: 'Die maximale Anzahl von {0} wurde überschritten, und die überschüssigen {1} -Dateien werden ignoriert!',
338
339
  overSizeErr: 'Die maximale Dateigröße darf {0} nicht überschreiten!',
340
+ manualUpload: '点击上传',
339
341
  reUpload: 'Wiederbelastung',
340
342
  uploadProgress: 'Hochladen {0}%',
341
343
  uploadErr: 'Upload fehlgeschlagen',
@@ -354,7 +356,8 @@ export default {
354
356
  colorPicker: {
355
357
  clear: 'Klar',
356
358
  confirm: 'bestätigen',
357
- copySuccess: 'Kopieren Sie in Zwischenablage: {0}'
359
+ copySuccess: 'Kopieren Sie in Zwischenablage: {0}',
360
+ hex: 'HEX'
358
361
  },
359
362
  formDesign: {
360
363
  formName: 'Formname',
@@ -36,6 +36,7 @@ export default {
36
36
  notCommands: 'The global directive "{0}" does not exist',
37
37
  notSlot: 'Slot "{0}" does not exist',
38
38
  noTree: '"{0}" is not supported in the tree structure',
39
+ noGroup: '"{0}" is not supported in the aggregation grouping',
39
40
  notProp: 'Unsupported parameter "{0}"',
40
41
  checkProp: 'When the data volume is too large, the check box may be stuttered. It is recommended to set the parameter "{0}" to improve rendering speed',
41
42
  coverProp: 'The parameter "{1}" of "{0}" is repeatedly defined, which may cause an error',
@@ -336,6 +337,7 @@ export default {
336
337
  overCountErr: 'Only {0} files can be selected at most!',
337
338
  overCountExtraErr: 'The maximum number of {0} has been exceeded, and the excess {1} files will be ignored!',
338
339
  overSizeErr: 'The maximum file size cannot exceed {0}!',
340
+ manualUpload: '点击上传',
339
341
  reUpload: 'Re-upload',
340
342
  uploadProgress: 'Uploading {0}%',
341
343
  uploadErr: 'Upload failed',
@@ -354,7 +356,8 @@ export default {
354
356
  colorPicker: {
355
357
  clear: 'Clear',
356
358
  confirm: 'confirm',
357
- copySuccess: 'Copyed to clipboard: {0}'
359
+ copySuccess: 'Copyed to clipboard: {0}',
360
+ hex: 'HEX'
358
361
  },
359
362
  formDesign: {
360
363
  formName: 'Form name',
@@ -36,6 +36,7 @@ export default {
36
36
  notCommands: 'La directiva global "{0}" no existe',
37
37
  notSlot: 'La ranura "{0}" no existe',
38
38
  noTree: '"{0}" no es compatible con la estructura del árbol',
39
+ noGroup: '数据分组后不支持 "{0}"',
39
40
  notProp: 'Parámetro no compatible "{0}"',
40
41
  checkProp: 'Cuando el volumen de datos es demasiado grande, la casilla de verificación puede tartamudear. Se recomienda establecer el parámetro "{0}" para mejorar la velocidad de renderización',
41
42
  coverProp: 'El parámetro "{1}" de "{0}" se define repetidamente, lo que puede causar un error',
@@ -336,6 +337,7 @@ export default {
336
337
  overCountErr: '¡Solo los archivos {0} se pueden seleccionar como máximo!',
337
338
  overCountExtraErr: 'Se ha excedido el número máximo de {0}, ¡y los archivos de exceso {1} se ignorarán!',
338
339
  overSizeErr: '¡El tamaño máximo del archivo no puede exceder {0}!',
340
+ manualUpload: '点击上传',
339
341
  reUpload: 'Volver a cargar',
340
342
  uploadProgress: 'Cargando {0}%',
341
343
  uploadErr: 'Carga falló',
@@ -354,7 +356,8 @@ export default {
354
356
  colorPicker: {
355
357
  clear: 'Claro',
356
358
  confirm: 'confirmar',
357
- copySuccess: 'Copiado al portapapeles: {0}'
359
+ copySuccess: 'Copiado al portapapeles: {0}',
360
+ hex: 'HEX'
358
361
  },
359
362
  formDesign: {
360
363
  formName: 'Nombre del formulario',
@@ -36,6 +36,7 @@ export default {
36
36
  notCommands: "La directive globale \"{0}\" n'existe pas",
37
37
  notSlot: "Slot \"{0}\" n'existe pas",
38
38
  noTree: "\"{0}\" n'est pas pris en charge dans la structure de l'arbre",
39
+ noGroup: '数据分组后不支持 "{0}"',
39
40
  notProp: 'Paramètre non pris en charge "{0}"',
40
41
  checkProp: 'Lorsque le volume de données est trop grand, la case peut être bégayée. Il est recommandé de définir le paramètre "{0}" pour améliorer la vitesse de rendu',
41
42
  coverProp: 'Le paramètre "{1}" de "{0}" est défini à plusieurs reprises, ce qui peut provoquer une erreur',
@@ -336,6 +337,7 @@ export default {
336
337
  overCountErr: 'Seuls les fichiers {0} peuvent être sélectionnés au maximum!',
337
338
  overCountExtraErr: 'Le nombre maximum de {0} a été dépassé et les fichiers excédentaires {1} seront ignorés!',
338
339
  overSizeErr: 'La taille maximale du fichier ne peut pas dépasser {0}!',
340
+ manualUpload: '点击上传',
339
341
  reUpload: 'Télécharger à nouveau',
340
342
  uploadProgress: 'Téléchargement {0}%',
341
343
  uploadErr: 'Le téléchargement a échoué',
@@ -354,7 +356,8 @@ export default {
354
356
  colorPicker: {
355
357
  clear: 'Clair',
356
358
  confirm: 'confirmer',
357
- copySuccess: 'Copie dans le presse-papiers: {0}'
359
+ copySuccess: 'Copie dans le presse-papiers: {0}',
360
+ hex: 'HEX'
358
361
  },
359
362
  formDesign: {
360
363
  formName: 'Nom de formulaire',
@@ -36,6 +36,7 @@ export default {
36
36
  notCommands: 'A "{0}" globális irányelv nem létezik',
37
37
  notSlot: 'A "{0}" rés nem létezik',
38
38
  noTree: 'A "{0}" nem támogatott a faszerkezetben',
39
+ noGroup: '数据分组后不支持 "{0}"',
39
40
  notProp: 'Nem támogatott paraméter "{0}"',
40
41
  checkProp: 'Ha az adatmennyiség túl nagy, akkor a jelölőnégyzet dadoghat. Javasoljuk, hogy állítsa be a "{0}" paramétert a megjelenítési sebesség javítása érdekében',
41
42
  coverProp: 'A "{1}" paramétert a "{0}" paramétere többször meghatározza, ami hibát okozhat',
@@ -336,6 +337,7 @@ export default {
336
337
  overCountErr: 'Csak a {0} fájlok választhatók legfeljebb!',
337
338
  overCountExtraErr: 'A {0} maximális számát túllépték, és a {1} felesleges fájlokat figyelmen kívül hagyják!',
338
339
  overSizeErr: 'A maximális fájlméret nem haladhatja meg a {0}!',
340
+ manualUpload: '点击上传',
339
341
  reUpload: 'Újból feltölt',
340
342
  uploadProgress: 'Feltöltés {0}%',
341
343
  uploadErr: 'A feltöltés sikertelen',
@@ -354,7 +356,8 @@ export default {
354
356
  colorPicker: {
355
357
  clear: 'Világos',
356
358
  confirm: 'megerősít',
357
- copySuccess: 'Másolva a vágólapra: {0}'
359
+ copySuccess: 'Másolva a vágólapra: {0}',
360
+ hex: 'HEX'
358
361
  },
359
362
  formDesign: {
360
363
  formName: 'Forma neve',