vxe-table 3.9.0-rc.12 → 3.9.0-rc.14

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 (89) hide show
  1. package/es/grid/src/grid.js +82 -51
  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 -1
  12. package/es/table/src/body.js +1 -0
  13. package/es/table/src/columnInfo.js +1 -1
  14. package/es/table/src/methods.js +23 -23
  15. package/es/table/src/props.js +65 -15
  16. package/es/table/src/table.js +48 -24
  17. package/es/table/src/util.js +1 -1
  18. package/es/table/style.css +39 -20
  19. package/es/table/style.min.css +1 -1
  20. package/es/ui/index.js +3 -2
  21. package/es/ui/src/log.js +1 -1
  22. package/es/vxe-table/style.css +39 -20
  23. package/es/vxe-table/style.min.css +1 -1
  24. package/lib/grid/src/grid.js +78 -54
  25. package/lib/grid/src/grid.min.js +1 -1
  26. package/lib/index.umd.js +246 -144
  27. package/lib/index.umd.min.js +1 -1
  28. package/lib/style.css +1 -1
  29. package/lib/style.min.css +1 -1
  30. package/lib/table/module/custom/panel.js +12 -7
  31. package/lib/table/module/custom/panel.min.js +1 -1
  32. package/lib/table/module/edit/mixin.js +8 -8
  33. package/lib/table/module/edit/mixin.min.js +1 -1
  34. package/lib/table/module/export/export-panel.js +28 -0
  35. package/lib/table/module/export/export-panel.min.js +1 -1
  36. package/lib/table/module/export/import-panel.js +20 -1
  37. package/lib/table/module/export/import-panel.min.js +1 -1
  38. package/lib/table/module/export/mixin.js +11 -11
  39. package/lib/table/module/export/mixin.min.js +1 -1
  40. package/lib/table/module/menu/mixin.js +2 -2
  41. package/lib/table/module/menu/mixin.min.js +1 -1
  42. package/lib/table/module/validator/mixin.js +4 -4
  43. package/lib/table/module/validator/mixin.min.js +1 -1
  44. package/lib/table/render/index.js +2 -1
  45. package/lib/table/render/index.min.js +1 -1
  46. package/lib/table/src/body.js +1 -1
  47. package/lib/table/src/body.min.js +1 -1
  48. package/lib/table/src/columnInfo.js +1 -1
  49. package/lib/table/src/columnInfo.min.js +1 -1
  50. package/lib/table/src/methods.js +23 -23
  51. package/lib/table/src/methods.min.js +1 -1
  52. package/lib/table/src/props.js +7 -0
  53. package/lib/table/src/props.min.js +1 -1
  54. package/lib/table/src/table.js +33 -16
  55. package/lib/table/src/table.min.js +1 -1
  56. package/lib/table/src/util.js +1 -1
  57. package/lib/table/src/util.min.js +1 -1
  58. package/lib/table/style/style.css +39 -20
  59. package/lib/table/style/style.min.css +1 -1
  60. package/lib/ui/index.js +3 -2
  61. package/lib/ui/index.min.js +1 -1
  62. package/lib/ui/src/log.js +1 -1
  63. package/lib/ui/src/log.min.js +1 -1
  64. package/lib/vxe-table/style/style.css +39 -20
  65. package/lib/vxe-table/style/style.min.css +1 -1
  66. package/package.json +2 -2
  67. package/packages/grid/src/grid.ts +90 -51
  68. package/packages/table/module/custom/panel.ts +186 -175
  69. package/packages/table/module/edit/mixin.ts +8 -8
  70. package/packages/table/module/export/export-panel.ts +32 -0
  71. package/packages/table/module/export/import-panel.ts +24 -1
  72. package/packages/table/module/export/mixin.ts +11 -11
  73. package/packages/table/module/menu/mixin.ts +2 -2
  74. package/packages/table/module/validator/mixin.ts +4 -4
  75. package/packages/table/render/index.ts +2 -1
  76. package/packages/table/src/body.ts +1 -0
  77. package/packages/table/src/columnInfo.ts +1 -1
  78. package/packages/table/src/methods.ts +23 -23
  79. package/packages/table/src/props.ts +68 -15
  80. package/packages/table/src/table.ts +53 -24
  81. package/packages/table/src/util.ts +1 -1
  82. package/packages/ui/index.ts +1 -0
  83. package/styles/components/table.scss +80 -14
  84. /package/es/{iconfont.1727008685370.ttf → iconfont.1727151996913.ttf} +0 -0
  85. /package/es/{iconfont.1727008685370.woff → iconfont.1727151996913.woff} +0 -0
  86. /package/es/{iconfont.1727008685370.woff2 → iconfont.1727151996913.woff2} +0 -0
  87. /package/lib/{iconfont.1727008685370.ttf → iconfont.1727151996913.ttf} +0 -0
  88. /package/lib/{iconfont.1727008685370.woff → iconfont.1727151996913.woff} +0 -0
  89. /package/lib/{iconfont.1727008685370.woff2 → iconfont.1727151996913.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
  },
@@ -717,7 +748,7 @@ export default {
717
748
  });
718
749
  }
719
750
  else {
720
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
751
+ if (process.env.NODE_ENV === 'development') {
721
752
  errLog('vxe.error.notFunc', ['proxy-config.ajax.query']);
722
753
  }
723
754
  }
@@ -745,7 +776,7 @@ export default {
745
776
  $xetable.setPendingRow(removeRecords, false);
746
777
  if (isRespMsg) {
747
778
  // 检测弹窗模块
748
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
779
+ if (process.env.NODE_ENV === 'development') {
749
780
  if (!VxeUI.modal) {
750
781
  errLog('vxe.error.reqModule', ['Modal']);
751
782
  }
@@ -767,7 +798,7 @@ export default {
767
798
  this.tableLoading = false;
768
799
  if (isRespMsg) {
769
800
  // 检测弹窗模块
770
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
801
+ if (process.env.NODE_ENV === 'development') {
771
802
  if (!VxeUI.modal) {
772
803
  errLog('vxe.error.reqModule', ['Modal']);
773
804
  }
@@ -784,7 +815,7 @@ export default {
784
815
  else {
785
816
  if (isActiveMsg) {
786
817
  // 检测弹窗模块
787
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
818
+ if (process.env.NODE_ENV === 'development') {
788
819
  if (!VxeUI.modal) {
789
820
  errLog('vxe.error.reqModule', ['Modal']);
790
821
  }
@@ -794,7 +825,7 @@ export default {
794
825
  }
795
826
  }
796
827
  else {
797
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
828
+ if (process.env.NODE_ENV === 'development') {
798
829
  errLog('vxe.error.notFunc', ['proxy-config.ajax.delete']);
799
830
  }
800
831
  }
@@ -835,7 +866,7 @@ export default {
835
866
  $xetable.clearPendingRow();
836
867
  if (isRespMsg) {
837
868
  // 检测弹窗模块
838
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
869
+ if (process.env.NODE_ENV === 'development') {
839
870
  if (!VxeUI.modal) {
840
871
  errLog('vxe.error.reqModule', ['Modal']);
841
872
  }
@@ -857,7 +888,7 @@ export default {
857
888
  this.tableLoading = false;
858
889
  if (isRespMsg) {
859
890
  // 检测弹窗模块
860
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
891
+ if (process.env.NODE_ENV === 'development') {
861
892
  if (!VxeUI.modal) {
862
893
  errLog('vxe.error.reqModule', ['Modal']);
863
894
  }
@@ -873,7 +904,7 @@ export default {
873
904
  else {
874
905
  if (isActiveMsg) {
875
906
  // 检测弹窗模块
876
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
907
+ if (process.env.NODE_ENV === 'development') {
877
908
  if (!VxeUI.modal) {
878
909
  errLog('vxe.error.reqModule', ['Modal']);
879
910
  }
@@ -884,7 +915,7 @@ export default {
884
915
  });
885
916
  }
886
917
  else {
887
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
918
+ if (process.env.NODE_ENV === 'development') {
888
919
  errLog('vxe.error.notFunc', ['proxy-config.ajax.save']);
889
920
  }
890
921
  }
@@ -897,7 +928,7 @@ export default {
897
928
  gCommandOpts.commandMethod({ code, button, $grid: this, $table: $xetable }, ...args);
898
929
  }
899
930
  else {
900
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
931
+ if (process.env.NODE_ENV === 'development') {
901
932
  errLog('vxe.error.notCommands', [code]);
902
933
  }
903
934
  }
@@ -927,7 +958,7 @@ export default {
927
958
  }
928
959
  else {
929
960
  // 检测弹窗模块
930
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
961
+ if (process.env.NODE_ENV === 'development') {
931
962
  if (!VxeUI.modal) {
932
963
  errLog('vxe.error.reqModule', ['Modal']);
933
964
  }
@@ -980,7 +1011,7 @@ export default {
980
1011
  else {
981
1012
  if (isActiveMsg) {
982
1013
  // 检测弹窗模块
983
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
1014
+ if (process.env.NODE_ENV === 'development') {
984
1015
  if (!VxeUI.modal) {
985
1016
  errLog('vxe.error.reqModule', ['Modal']);
986
1017
  }
@@ -1097,7 +1128,7 @@ export default {
1097
1128
  };
1098
1129
  }
1099
1130
  return null;
1100
- } }), (process.env.VUE_APP_VXE_TABLE_ENV === 'development'
1131
+ } }), (process.env.NODE_ENV === 'development'
1101
1132
  ? {
1102
1133
  loadColumn(columns) {
1103
1134
  const { $scopedSlots } = this;