vxe-table 3.9.0-rc.11 → 3.9.0-rc.13

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 (84) hide show
  1. package/es/grid/src/grid.js +98 -60
  2. package/es/style.css +1 -1
  3. package/es/style.min.css +1 -1
  4. package/es/table/module/custom/panel.js +183 -173
  5. package/es/table/module/edit/mixin.js +8 -8
  6. package/es/table/module/export/export-panel.js +28 -0
  7. package/es/table/module/export/import-panel.js +20 -1
  8. package/es/table/module/export/mixin.js +11 -11
  9. package/es/table/module/menu/mixin.js +2 -2
  10. package/es/table/module/validator/mixin.js +4 -4
  11. package/es/table/render/index.js +2 -10
  12. package/es/table/src/columnInfo.js +1 -1
  13. package/es/table/src/methods.js +38 -27
  14. package/es/table/src/table.js +47 -24
  15. package/es/table/src/util.js +1 -1
  16. package/es/table/style.css +2 -2
  17. package/es/table/style.min.css +1 -1
  18. package/es/toolbar/src/toolbar.js +6 -1
  19. package/es/ui/index.js +2 -2
  20. package/es/ui/src/log.js +1 -1
  21. package/es/vxe-table/style.css +2 -2
  22. package/es/vxe-table/style.min.css +1 -1
  23. package/lib/grid/src/grid.js +93 -62
  24. package/lib/grid/src/grid.min.js +1 -1
  25. package/lib/index.umd.js +271 -164
  26. package/lib/index.umd.min.js +1 -1
  27. package/lib/style.css +1 -1
  28. package/lib/style.min.css +1 -1
  29. package/lib/table/module/custom/panel.js +12 -7
  30. package/lib/table/module/custom/panel.min.js +1 -1
  31. package/lib/table/module/edit/mixin.js +8 -8
  32. package/lib/table/module/edit/mixin.min.js +1 -1
  33. package/lib/table/module/export/export-panel.js +28 -0
  34. package/lib/table/module/export/export-panel.min.js +1 -1
  35. package/lib/table/module/export/import-panel.js +20 -1
  36. package/lib/table/module/export/import-panel.min.js +1 -1
  37. package/lib/table/module/export/mixin.js +11 -11
  38. package/lib/table/module/export/mixin.min.js +1 -1
  39. package/lib/table/module/menu/mixin.js +2 -2
  40. package/lib/table/module/menu/mixin.min.js +1 -1
  41. package/lib/table/module/validator/mixin.js +4 -4
  42. package/lib/table/module/validator/mixin.min.js +1 -1
  43. package/lib/table/render/index.js +2 -10
  44. package/lib/table/render/index.min.js +1 -1
  45. package/lib/table/src/columnInfo.js +1 -1
  46. package/lib/table/src/columnInfo.min.js +1 -1
  47. package/lib/table/src/methods.js +37 -27
  48. package/lib/table/src/methods.min.js +1 -1
  49. package/lib/table/src/table.js +32 -15
  50. package/lib/table/src/table.min.js +1 -1
  51. package/lib/table/src/util.js +1 -1
  52. package/lib/table/src/util.min.js +1 -1
  53. package/lib/table/style/style.css +2 -2
  54. package/lib/table/style/style.min.css +1 -1
  55. package/lib/toolbar/src/toolbar.js +6 -1
  56. package/lib/toolbar/src/toolbar.min.js +1 -1
  57. package/lib/ui/index.js +2 -2
  58. package/lib/ui/index.min.js +1 -1
  59. package/lib/ui/src/log.js +1 -1
  60. package/lib/ui/src/log.min.js +1 -1
  61. package/lib/vxe-table/style/style.css +2 -2
  62. package/lib/vxe-table/style/style.min.css +1 -1
  63. package/package.json +2 -2
  64. package/packages/grid/src/grid.ts +105 -59
  65. package/packages/table/module/custom/panel.ts +186 -175
  66. package/packages/table/module/edit/mixin.ts +8 -8
  67. package/packages/table/module/export/export-panel.ts +32 -0
  68. package/packages/table/module/export/import-panel.ts +24 -1
  69. package/packages/table/module/export/mixin.ts +11 -11
  70. package/packages/table/module/menu/mixin.ts +2 -2
  71. package/packages/table/module/validator/mixin.ts +4 -4
  72. package/packages/table/render/index.ts +2 -10
  73. package/packages/table/src/columnInfo.ts +1 -1
  74. package/packages/table/src/methods.ts +37 -27
  75. package/packages/table/src/table.ts +52 -24
  76. package/packages/table/src/util.ts +1 -1
  77. package/packages/toolbar/src/toolbar.ts +6 -1
  78. package/styles/components/table.scss +2 -2
  79. /package/es/{iconfont.1726713861908.ttf → iconfont.1727075751305.ttf} +0 -0
  80. /package/es/{iconfont.1726713861908.woff → iconfont.1727075751305.woff} +0 -0
  81. /package/es/{iconfont.1726713861908.woff2 → iconfont.1727075751305.woff2} +0 -0
  82. /package/lib/{iconfont.1726713861908.ttf → iconfont.1727075751305.ttf} +0 -0
  83. /package/lib/{iconfont.1726713861908.woff → iconfont.1727075751305.woff} +0 -0
  84. /package/lib/{iconfont.1726713861908.woff2 → iconfont.1727075751305.woff2} +0 -0
@@ -7,11 +7,15 @@ import VxeToolbarComponent from '../../toolbar/src/toolbar';
7
7
  import tableComponentProps from '../../table/src/props';
8
8
  import { getSlotVNs } from '../../ui/src/vn';
9
9
  import { warnLog, errLog } from '../../ui/src/log';
10
- const { getConfig, getI18n, commands, globalEvents, globalMixins } = VxeUI;
10
+ const { getConfig, getI18n, commands, globalEvents, globalMixins, renderEmptyElement } = VxeUI;
11
11
  const methods = {};
12
12
  const propKeys = Object.keys(tableComponentProps);
13
- function renderDefaultForm(h, _vm) {
14
- const { $scopedSlots, proxyConfig, proxyOpts, formData, formConfig, formOpts } = _vm;
13
+ function renderDefaultForm(h, $xeGrid) {
14
+ const VxeUIFormComponent = VxeUI.getComponent('VxeForm');
15
+ const props = $xeGrid;
16
+ const slots = $xeGrid.$scopedSlots;
17
+ const { proxyConfig, formConfig } = props;
18
+ const { proxyOpts, formData, formOpts } = $xeGrid;
15
19
  if (isEnableConf(formConfig) && formOpts.items && formOpts.items.length) {
16
20
  const formSlots = {};
17
21
  if (!formOpts.inited) {
@@ -19,7 +23,7 @@ function renderDefaultForm(h, _vm) {
19
23
  const beforeItem = proxyOpts.beforeItem;
20
24
  if (proxyOpts && beforeItem) {
21
25
  formOpts.items.forEach((item) => {
22
- beforeItem.call(_vm, { $grid: _vm, item });
26
+ beforeItem.call($xeGrid, { $grid: $xeGrid, item });
23
27
  });
24
28
  }
25
29
  }
@@ -27,39 +31,41 @@ function renderDefaultForm(h, _vm) {
27
31
  formOpts.items.forEach((item) => {
28
32
  XEUtils.each(item.slots, (func) => {
29
33
  if (!XEUtils.isFunction(func)) {
30
- if ($scopedSlots[func]) {
31
- formSlots[func] = $scopedSlots[func];
34
+ if (slots[func]) {
35
+ formSlots[func] = slots[func];
32
36
  }
33
37
  }
34
38
  });
35
39
  });
36
40
  return [
37
- h('vxe-form', {
38
- props: Object.assign({}, formOpts, {
39
- data: proxyConfig && proxyOpts.form ? formData : formOpts.data
40
- }),
41
- on: {
42
- submit: _vm.submitEvent,
43
- reset: _vm.resetEvent,
44
- collapse: _vm.collapseEvent,
45
- 'submit-invalid': _vm.submitInvalidEvent
46
- },
47
- scopedSlots: formSlots
48
- })
41
+ VxeUIFormComponent
42
+ ? h(VxeUIFormComponent, {
43
+ props: Object.assign({}, formOpts, {
44
+ data: proxyConfig && proxyOpts.form ? formData : formOpts.data
45
+ }),
46
+ on: {
47
+ submit: $xeGrid.submitEvent,
48
+ reset: $xeGrid.resetEvent,
49
+ collapse: $xeGrid.collapseEvent,
50
+ 'submit-invalid': $xeGrid.submitInvalidEvent
51
+ },
52
+ scopedSlots: formSlots
53
+ })
54
+ : renderEmptyElement($xeGrid)
49
55
  ];
50
56
  }
51
57
  return [];
52
58
  }
53
- function getFuncSlot(_vm, optSlots, slotKey) {
54
- const { $scopedSlots } = _vm;
59
+ function getFuncSlot($xeGrid, optSlots, slotKey) {
60
+ const slots = $xeGrid.$scopedSlots;
55
61
  const funcSlot = optSlots[slotKey];
56
62
  if (funcSlot) {
57
63
  if (XEUtils.isString(funcSlot)) {
58
- if ($scopedSlots[funcSlot]) {
59
- return $scopedSlots[funcSlot];
64
+ if (slots[funcSlot]) {
65
+ return slots[funcSlot];
60
66
  }
61
67
  else {
62
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
68
+ if (process.env.NODE_ENV === 'development') {
63
69
  errLog('vxe.error.notSlot', [funcSlot]);
64
70
  }
65
71
  }
@@ -76,7 +82,7 @@ function getToolbarSlots(_vm) {
76
82
  let buttonsSlot;
77
83
  let toolsSlot;
78
84
  const slots = {};
79
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
85
+ if (process.env.NODE_ENV === 'development') {
80
86
  if ($scopedSlots.buttons && (!toolbarOptSlots || toolbarOptSlots.buttons !== 'buttons')) {
81
87
  warnLog('vxe.error.reqProp', ['toolbar-config.slots.buttons']);
82
88
  }
@@ -240,8 +246,11 @@ function renderBottom(h, _vm) {
240
246
  /**
241
247
  * 渲染分页
242
248
  */
243
- function renderPager(h, _vm) {
244
- const { _e, $scopedSlots, pagerConfig, proxyConfig, tablePage } = _vm;
249
+ function renderPager(h, $xeGrid) {
250
+ const VxeUIPagerComponent = VxeUI.getComponent('VxePager');
251
+ const props = $xeGrid;
252
+ const { pagerConfig, proxyConfig } = props;
253
+ const { $scopedSlots, tablePage } = $xeGrid;
245
254
  const pagerSlot = $scopedSlots.pager;
246
255
  const hasPager = !!(pagerSlot || isEnableConf(pagerConfig));
247
256
  if (hasPager) {
@@ -250,18 +259,20 @@ function renderPager(h, _vm) {
250
259
  ref: 'pagerWrapper',
251
260
  class: 'vxe-grid--pager-wrapper'
252
261
  }, pagerSlot
253
- ? pagerSlot.call(_vm, { $grid: _vm }, h)
262
+ ? pagerSlot.call($xeGrid, { $grid: $xeGrid }, h)
254
263
  : [
255
- h('vxe-pager', {
256
- props: Object.assign(Object.assign({}, _vm.pagerOpts), (proxyConfig ? tablePage : {})),
257
- on: {
258
- 'page-change': _vm.pageChangeEvent
259
- },
260
- scopedSlots: getPagerSlots(_vm)
261
- })
264
+ VxeUIPagerComponent
265
+ ? h(VxeUIPagerComponent, {
266
+ props: Object.assign(Object.assign({}, $xeGrid.pagerOpts), (proxyConfig ? tablePage : {})),
267
+ on: {
268
+ 'page-change': $xeGrid.pageChangeEvent
269
+ },
270
+ scopedSlots: getPagerSlots($xeGrid)
271
+ })
272
+ : renderEmptyElement($xeGrid)
262
273
  ]);
263
274
  }
264
- return _e();
275
+ return renderEmptyElement($xeGrid);
265
276
  }
266
277
  const defaultLayouts = ['Form', 'Toolbar', 'Top', 'Table', 'Bottom', 'Pager'];
267
278
  function renderLayout(h, _vm) {
@@ -296,7 +307,7 @@ function renderLayout(h, _vm) {
296
307
  vns.push(renderPager(h, _vm));
297
308
  break;
298
309
  default:
299
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
310
+ if (process.env.NODE_ENV === 'development') {
300
311
  errLog('vxe.error.notProp', [`layouts -> ${name}`]);
301
312
  }
302
313
  break;
@@ -322,6 +333,7 @@ export default {
322
333
  };
323
334
  },
324
335
  data() {
336
+ var _a;
325
337
  return {
326
338
  tableLoading: false,
327
339
  isZMax: false,
@@ -332,7 +344,7 @@ export default {
332
344
  tZindex: 0,
333
345
  tablePage: {
334
346
  total: 0,
335
- pageSize: getConfig().pager.pageSize || 10,
347
+ pageSize: ((_a = getConfig().pager) === null || _a === void 0 ? void 0 : _a.pageSize) || 10,
336
348
  currentPage: 1
337
349
  }
338
350
  };
@@ -431,11 +443,13 @@ export default {
431
443
  }
432
444
  },
433
445
  created() {
446
+ const $xeGrid = this;
447
+ const props = $xeGrid;
434
448
  // const { data, formOpts, proxyOpts, proxyConfig } = this
435
449
  // if (proxyConfig && (data || (proxyOpts.form && formOpts.data))) {
436
450
  // errLog('vxe.error.errConflicts', ['grid.data', 'grid.proxy-config'])
437
451
  // }
438
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
452
+ if (process.env.NODE_ENV === 'development') {
439
453
  if (this.toolbar) {
440
454
  warnLog('vxe.error.delProp', ['grid.toolbar', 'grid.toolbar-config']);
441
455
  }
@@ -446,6 +460,23 @@ export default {
446
460
  // warnLog('vxe.error.delProp', ['proxy-config.props', 'proxy-config.response'])
447
461
  // }
448
462
  }
463
+ if (process.env.NODE_ENV === 'development') {
464
+ // 使用已安装的组件,如果未安装则不渲染
465
+ const VxeUIFormComponent = VxeUI.getComponent('VxeForm');
466
+ const VxeUIPagerComponent = VxeUI.getComponent('VxePager');
467
+ $xeGrid.$nextTick(() => {
468
+ if (props.formConfig) {
469
+ if (!VxeUIFormComponent) {
470
+ errLog('vxe.error.reqComp', ['vxe-form']);
471
+ }
472
+ }
473
+ if (props.pagerConfig) {
474
+ if (!VxeUIPagerComponent) {
475
+ errLog('vxe.error.reqComp', ['vxe-pager']);
476
+ }
477
+ }
478
+ });
479
+ }
449
480
  this.initPages();
450
481
  globalEvents.on(this, 'keydown', this.handleGlobalKeydownEvent);
451
482
  },
@@ -627,8 +658,11 @@ export default {
627
658
  }
628
659
  }
629
660
  if (isInited) {
630
- const { sortOpts } = $xetable;
631
- let defaultSort = sortOpts.defaultSort;
661
+ let defaultSort = null;
662
+ if ($xetable) {
663
+ const { sortOpts } = $xetable;
664
+ defaultSort = sortOpts.defaultSort;
665
+ }
632
666
  // 如果使用默认排序
633
667
  if (defaultSort) {
634
668
  if (!XEUtils.isArray(defaultSort)) {
@@ -642,15 +676,19 @@ export default {
642
676
  };
643
677
  });
644
678
  }
645
- filterList = $xetable.getCheckedFilters();
679
+ if ($xetable) {
680
+ filterList = $xetable.getCheckedFilters();
681
+ }
646
682
  }
647
683
  else {
648
- if (isReload) {
649
- $xetable.clearAll();
650
- }
651
- else {
652
- sortList = $xetable.getSortColumns();
653
- filterList = $xetable.getCheckedFilters();
684
+ if ($xetable) {
685
+ if (isReload) {
686
+ $xetable.clearAll();
687
+ }
688
+ else {
689
+ sortList = $xetable.getSortColumns();
690
+ filterList = $xetable.getCheckedFilters();
691
+ }
654
692
  }
655
693
  }
656
694
  const commitParams = {
@@ -710,7 +748,7 @@ export default {
710
748
  });
711
749
  }
712
750
  else {
713
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
751
+ if (process.env.NODE_ENV === 'development') {
714
752
  errLog('vxe.error.notFunc', ['proxy-config.ajax.query']);
715
753
  }
716
754
  }
@@ -738,7 +776,7 @@ export default {
738
776
  $xetable.setPendingRow(removeRecords, false);
739
777
  if (isRespMsg) {
740
778
  // 检测弹窗模块
741
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
779
+ if (process.env.NODE_ENV === 'development') {
742
780
  if (!VxeUI.modal) {
743
781
  errLog('vxe.error.reqModule', ['Modal']);
744
782
  }
@@ -760,7 +798,7 @@ export default {
760
798
  this.tableLoading = false;
761
799
  if (isRespMsg) {
762
800
  // 检测弹窗模块
763
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
801
+ if (process.env.NODE_ENV === 'development') {
764
802
  if (!VxeUI.modal) {
765
803
  errLog('vxe.error.reqModule', ['Modal']);
766
804
  }
@@ -777,7 +815,7 @@ export default {
777
815
  else {
778
816
  if (isActiveMsg) {
779
817
  // 检测弹窗模块
780
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
818
+ if (process.env.NODE_ENV === 'development') {
781
819
  if (!VxeUI.modal) {
782
820
  errLog('vxe.error.reqModule', ['Modal']);
783
821
  }
@@ -787,7 +825,7 @@ export default {
787
825
  }
788
826
  }
789
827
  else {
790
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
828
+ if (process.env.NODE_ENV === 'development') {
791
829
  errLog('vxe.error.notFunc', ['proxy-config.ajax.delete']);
792
830
  }
793
831
  }
@@ -828,7 +866,7 @@ export default {
828
866
  $xetable.clearPendingRow();
829
867
  if (isRespMsg) {
830
868
  // 检测弹窗模块
831
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
869
+ if (process.env.NODE_ENV === 'development') {
832
870
  if (!VxeUI.modal) {
833
871
  errLog('vxe.error.reqModule', ['Modal']);
834
872
  }
@@ -850,7 +888,7 @@ export default {
850
888
  this.tableLoading = false;
851
889
  if (isRespMsg) {
852
890
  // 检测弹窗模块
853
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
891
+ if (process.env.NODE_ENV === 'development') {
854
892
  if (!VxeUI.modal) {
855
893
  errLog('vxe.error.reqModule', ['Modal']);
856
894
  }
@@ -866,7 +904,7 @@ export default {
866
904
  else {
867
905
  if (isActiveMsg) {
868
906
  // 检测弹窗模块
869
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
907
+ if (process.env.NODE_ENV === 'development') {
870
908
  if (!VxeUI.modal) {
871
909
  errLog('vxe.error.reqModule', ['Modal']);
872
910
  }
@@ -877,7 +915,7 @@ export default {
877
915
  });
878
916
  }
879
917
  else {
880
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
918
+ if (process.env.NODE_ENV === 'development') {
881
919
  errLog('vxe.error.notFunc', ['proxy-config.ajax.save']);
882
920
  }
883
921
  }
@@ -890,7 +928,7 @@ export default {
890
928
  gCommandOpts.commandMethod({ code, button, $grid: this, $table: $xetable }, ...args);
891
929
  }
892
930
  else {
893
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
931
+ if (process.env.NODE_ENV === 'development') {
894
932
  errLog('vxe.error.notCommands', [code]);
895
933
  }
896
934
  }
@@ -920,7 +958,7 @@ export default {
920
958
  }
921
959
  else {
922
960
  // 检测弹窗模块
923
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
961
+ if (process.env.NODE_ENV === 'development') {
924
962
  if (!VxeUI.modal) {
925
963
  errLog('vxe.error.reqModule', ['Modal']);
926
964
  }
@@ -973,7 +1011,7 @@ export default {
973
1011
  else {
974
1012
  if (isActiveMsg) {
975
1013
  // 检测弹窗模块
976
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
1014
+ if (process.env.NODE_ENV === 'development') {
977
1015
  if (!VxeUI.modal) {
978
1016
  errLog('vxe.error.reqModule', ['Modal']);
979
1017
  }
@@ -1090,7 +1128,7 @@ export default {
1090
1128
  };
1091
1129
  }
1092
1130
  return null;
1093
- } }), (process.env.VUE_APP_VXE_TABLE_ENV === 'development'
1131
+ } }), (process.env.NODE_ENV === 'development'
1094
1132
  ? {
1095
1133
  loadColumn(columns) {
1096
1134
  const { $scopedSlots } = this;