vxe-table 4.7.18-beta.0 → 4.7.18

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 (53) hide show
  1. package/es/colgroup/index.js +1 -0
  2. package/es/column/index.js +1 -0
  3. package/es/grid/index.js +1 -0
  4. package/es/grid/src/grid.js +12 -5
  5. package/es/table/index.js +1 -0
  6. package/es/table/module/custom/panel.js +179 -160
  7. package/es/table/module/export/export-panel.js +243 -212
  8. package/es/table/module/export/import-panel.js +96 -79
  9. package/es/table/src/table.js +28 -19
  10. package/es/toolbar/index.js +1 -0
  11. package/es/toolbar/src/toolbar.js +99 -81
  12. package/es/ui/index.js +2 -2
  13. package/es/ui/src/log.js +1 -1
  14. package/lib/colgroup/index.js +1 -0
  15. package/lib/colgroup/index.min.js +1 -1
  16. package/lib/column/index.js +1 -0
  17. package/lib/column/index.min.js +1 -1
  18. package/lib/grid/index.js +1 -0
  19. package/lib/grid/index.min.js +1 -1
  20. package/lib/grid/src/grid.js +22 -15
  21. package/lib/grid/src/grid.min.js +1 -1
  22. package/lib/index.umd.js +151 -114
  23. package/lib/index.umd.min.js +1 -1
  24. package/lib/table/index.js +1 -0
  25. package/lib/table/index.min.js +1 -1
  26. package/lib/table/module/custom/panel.js +17 -12
  27. package/lib/table/module/custom/panel.min.js +1 -1
  28. package/lib/table/module/export/export-panel.js +24 -19
  29. package/lib/table/module/export/export-panel.min.js +1 -1
  30. package/lib/table/module/export/import-panel.js +17 -11
  31. package/lib/table/module/export/import-panel.min.js +1 -1
  32. package/lib/table/src/table.js +10 -7
  33. package/lib/table/src/table.min.js +1 -1
  34. package/lib/toolbar/index.js +1 -0
  35. package/lib/toolbar/index.min.js +1 -1
  36. package/lib/toolbar/src/toolbar.js +52 -46
  37. package/lib/toolbar/src/toolbar.min.js +1 -1
  38. package/lib/ui/index.js +2 -2
  39. package/lib/ui/index.min.js +1 -1
  40. package/lib/ui/src/log.js +1 -1
  41. package/lib/ui/src/log.min.js +1 -1
  42. package/package.json +2 -2
  43. package/packages/colgroup/index.ts +2 -0
  44. package/packages/column/index.ts +2 -0
  45. package/packages/grid/index.ts +2 -0
  46. package/packages/grid/src/grid.ts +29 -21
  47. package/packages/table/index.ts +2 -0
  48. package/packages/table/module/custom/panel.ts +184 -160
  49. package/packages/table/module/export/export-panel.ts +244 -211
  50. package/packages/table/module/export/import-panel.ts +96 -78
  51. package/packages/table/src/table.ts +32 -22
  52. package/packages/toolbar/index.ts +2 -0
  53. package/packages/toolbar/src/toolbar.ts +111 -92
@@ -12,5 +12,6 @@ if (VxeUI.dynamicApp) {
12
12
  // 兼容旧用法
13
13
  VxeUI.dynamicApp.component('VxeTableColgroup', VxeColgroupComponent);
14
14
  }
15
+ VxeUI.component(VxeColgroupComponent);
15
16
  export const Colgroup = VxeColgroup;
16
17
  export default VxeColgroup;
@@ -12,5 +12,6 @@ if (VxeUI.dynamicApp) {
12
12
  // 兼容旧用法
13
13
  VxeUI.dynamicApp.component('VxeTableColumn', VxeColumnComponent);
14
14
  }
15
+ VxeUI.component(VxeColumnComponent);
15
16
  export const Column = VxeColumn;
16
17
  export default VxeColumn;
package/es/grid/index.js CHANGED
@@ -8,5 +8,6 @@ export const VxeGrid = Object.assign({}, VxeGridComponent, {
8
8
  if (VxeUI.dynamicApp) {
9
9
  VxeUI.dynamicApp.component(VxeGridComponent.name, VxeGridComponent);
10
10
  }
11
+ VxeUI.component(VxeGridComponent);
11
12
  export const Grid = VxeGrid;
12
13
  export default VxeGrid;
@@ -1,4 +1,4 @@
1
- import { defineComponent, h, ref, computed, provide, resolveComponent, reactive, onUnmounted, watch, nextTick, onMounted, createCommentVNode } from 'vue';
1
+ import { defineComponent, h, ref, computed, provide, reactive, onUnmounted, watch, nextTick, onMounted, createCommentVNode } from 'vue';
2
2
  import XEUtils from 'xe-utils';
3
3
  import { getLastZIndex, nextZIndex, isEnableConf } from '../../ui/src/utils';
4
4
  import { getOffsetHeight, getPaddingTopBottomSize, getDomNode } from '../../ui/src/dom';
@@ -35,6 +35,9 @@ export default defineComponent({
35
35
  var _a;
36
36
  const { slots, emit } = context;
37
37
  const xID = XEUtils.uniqueId();
38
+ // 使用已安装的组件,如果未安装则不渲染
39
+ const VxeUIFormComponent = VxeUI.getComponent('VxeForm');
40
+ const VxeUIPagerComponent = VxeUI.getComponent('VxePager');
38
41
  const { computeSize } = useFns.useSize(props);
39
42
  const reactData = reactive({
40
43
  tableLoading: false,
@@ -383,9 +386,11 @@ export default defineComponent({
383
386
  }
384
387
  });
385
388
  });
386
- slotVNs.push(h(resolveComponent('vxe-form'), Object.assign(Object.assign({ ref: refForm }, Object.assign({}, formOpts, {
387
- data: proxyConfig && isEnableConf(proxyOpts) && proxyOpts.form ? formData : formOpts.data
388
- })), { onSubmit: submitFormEvent, onReset: resetFormEvent, onSubmitInvalid: submitInvalidEvent, onCollapse: collapseEvent }), formSlots));
389
+ if (VxeUIFormComponent) {
390
+ slotVNs.push(h(VxeUIFormComponent, Object.assign(Object.assign({ ref: refForm }, Object.assign({}, formOpts, {
391
+ data: proxyConfig && isEnableConf(proxyOpts) && proxyOpts.form ? formData : formOpts.data
392
+ })), { onSubmit: submitFormEvent, onReset: resetFormEvent, onSubmitInvalid: submitInvalidEvent, onCollapse: collapseEvent }), formSlots));
393
+ }
389
394
  }
390
395
  }
391
396
  return h('div', {
@@ -534,7 +539,9 @@ export default defineComponent({
534
539
  pagerSlots.right = rightSlot;
535
540
  }
536
541
  }
537
- slotVNs.push(h(resolveComponent('vxe-pager'), Object.assign(Object.assign(Object.assign({ ref: refPager }, pagerOpts), (proxyConfig && isEnableConf(proxyOpts) ? reactData.tablePage : {})), { onPageChange: pageChangeEvent }), pagerSlots));
542
+ if (VxeUIPagerComponent) {
543
+ slotVNs.push(h(VxeUIPagerComponent, Object.assign(Object.assign(Object.assign({ ref: refPager }, pagerOpts), (proxyConfig && isEnableConf(proxyOpts) ? reactData.tablePage : {})), { onPageChange: pageChangeEvent }), pagerSlots));
544
+ }
538
545
  }
539
546
  return h('div', {
540
547
  ref: refPagerWrapper,
package/es/table/index.js CHANGED
@@ -16,5 +16,6 @@ export const VxeTable = Object.assign({}, VxeTableComponent, {
16
16
  if (VxeUI.dynamicApp) {
17
17
  VxeUI.dynamicApp.component(VxeTableComponent.name, VxeTableComponent);
18
18
  }
19
+ VxeUI.component(VxeTableComponent);
19
20
  export const Table = VxeTable;
20
21
  export default VxeTable;
@@ -1,4 +1,4 @@
1
- import { defineComponent, h, inject, ref, resolveComponent, TransitionGroup, createCommentVNode } from 'vue';
1
+ import { defineComponent, h, inject, ref, TransitionGroup, createCommentVNode } from 'vue';
2
2
  import { VxeUI } from '../../../ui';
3
3
  import { formatText } from '../../../ui/src/utils';
4
4
  import { addClass, removeClass } from '../../../ui/src/dom';
@@ -13,6 +13,11 @@ export default defineComponent({
13
13
  }
14
14
  },
15
15
  setup(props) {
16
+ const VxeUIModalComponent = VxeUI.getComponent('VxeModal');
17
+ const VxeUIButtonComponent = VxeUI.getComponent('VxeButton');
18
+ const VxeUIInputComponent = VxeUI.getComponent('VxeInput');
19
+ const VxeUITooltipComponent = VxeUI.getComponent('VxeTooltip');
20
+ const VxeUIRadioGroupComponent = VxeUI.getComponent('VxeRadioGroup');
16
21
  const $xeTable = inject('$xeTable', {});
17
22
  const { reactData } = $xeTable;
18
23
  const { computeCustomOpts, computeColumnOpts, computeIsMaxFixedColumn } = $xeTable.getComputeMaps();
@@ -531,14 +536,16 @@ export default defineComponent({
531
536
  }, [
532
537
  !isChecked || (column.children && column.children.length)
533
538
  ? h('span', '-')
534
- : h(resolveComponent('vxe-input'), {
535
- type: 'integer',
536
- min: 40,
537
- modelValue: column.renderResizeWidth,
538
- 'onUpdate:modelValue'(value) {
539
- column.renderResizeWidth = Math.max(40, Number(value));
540
- }
541
- })
539
+ : (VxeUIInputComponent
540
+ ? h(VxeUIInputComponent, {
541
+ type: 'integer',
542
+ min: 40,
543
+ modelValue: column.renderResizeWidth,
544
+ 'onUpdate:modelValue'(value) {
545
+ column.renderResizeWidth = Math.max(40, Number(value));
546
+ }
547
+ })
548
+ : createCommentVNode())
542
549
  ])
543
550
  : createCommentVNode(),
544
551
  allowFixed
@@ -547,22 +554,24 @@ export default defineComponent({
547
554
  }, [
548
555
  parent
549
556
  ? h('span', '-')
550
- : h(resolveComponent('vxe-radio-group'), {
551
- modelValue: column.renderFixed || '',
552
- type: 'button',
553
- size: 'mini',
554
- options: [
555
- { label: getI18n('vxe.custom.setting.fixedLeft'), value: 'left', disabled: isMaxFixedColumn },
556
- { label: getI18n('vxe.custom.setting.fixedUnset'), value: '' },
557
- { label: getI18n('vxe.custom.setting.fixedRight'), value: 'right', disabled: isMaxFixedColumn }
558
- ],
559
- 'onUpdate:modelValue'(value) {
560
- column.renderFixed = value;
561
- }
562
- // onChange () {
563
- // changePopupFixedOption(column)
564
- // }
565
- })
557
+ : (VxeUIRadioGroupComponent
558
+ ? h(VxeUIRadioGroupComponent, {
559
+ modelValue: column.renderFixed || '',
560
+ type: 'button',
561
+ size: 'mini',
562
+ options: [
563
+ { label: getI18n('vxe.custom.setting.fixedLeft'), value: 'left', disabled: isMaxFixedColumn },
564
+ { label: getI18n('vxe.custom.setting.fixedUnset'), value: '' },
565
+ { label: getI18n('vxe.custom.setting.fixedRight'), value: 'right', disabled: isMaxFixedColumn }
566
+ ],
567
+ 'onUpdate:modelValue'(value) {
568
+ column.renderFixed = value;
569
+ }
570
+ // onChange () {
571
+ // changePopupFixedOption(column)
572
+ // }
573
+ })
574
+ : createCommentVNode())
566
575
  ])
567
576
  : createCommentVNode()
568
577
  ]));
@@ -570,151 +579,161 @@ export default defineComponent({
570
579
  });
571
580
  const isAllChecked = customStore.isAll;
572
581
  const isAllIndeterminate = customStore.isIndeterminate;
573
- return h(resolveComponent('vxe-modal'), {
574
- key: 'popup',
575
- className: ['vxe-table-custom-popup-wrapper', 'vxe-table--ignore-clear', modalOpts.className || ''].join(' '),
576
- modelValue: customStore.visible,
577
- title: modalOpts.title || getI18n('vxe.custom.cstmTitle'),
578
- width: modalOpts.width || '50vw',
579
- minWidth: modalOpts.minWidth || 700,
580
- height: modalOpts.height || '50vh',
581
- minHeight: modalOpts.minHeight || 400,
582
- mask: true,
583
- lockView: true,
584
- showFooter: true,
585
- resize: true,
586
- escClosable: true,
587
- destroyOnClose: true,
588
- 'onUpdate:modelValue'(value) {
589
- customStore.visible = value;
590
- }
591
- }, {
592
- default: () => {
593
- return h('div', {
594
- ref: bodyElemRef,
595
- class: 'vxe-table-custom-popup--body'
596
- }, [
597
- h('div', {
598
- class: 'vxe-table-custom-popup--table-wrapper'
582
+ return VxeUIModalComponent
583
+ ? h(VxeUIModalComponent, {
584
+ key: 'popup',
585
+ className: ['vxe-table-custom-popup-wrapper', 'vxe-table--ignore-clear', modalOpts.className || ''].join(' '),
586
+ modelValue: customStore.visible,
587
+ title: modalOpts.title || getI18n('vxe.custom.cstmTitle'),
588
+ width: modalOpts.width || '50vw',
589
+ minWidth: modalOpts.minWidth || 700,
590
+ height: modalOpts.height || '50vh',
591
+ minHeight: modalOpts.minHeight || 400,
592
+ mask: true,
593
+ lockView: true,
594
+ showFooter: true,
595
+ resize: true,
596
+ escClosable: true,
597
+ destroyOnClose: true,
598
+ 'onUpdate:modelValue'(value) {
599
+ customStore.visible = value;
600
+ }
601
+ }, {
602
+ default: () => {
603
+ return h('div', {
604
+ ref: bodyElemRef,
605
+ class: 'vxe-table-custom-popup--body'
599
606
  }, [
600
- h('table', {}, [
601
- h('colgroup', {}, [
602
- allowVisible
603
- ? h('col', {
604
- style: {
605
- width: '80px'
606
- }
607
- })
608
- : createCommentVNode(),
609
- allowSort
610
- ? h('col', {
611
- style: {
612
- width: '80px'
613
- }
614
- })
615
- : createCommentVNode(),
616
- h('col', {
617
- style: {
618
- minWidth: '120px'
619
- }
620
- }),
621
- allowResizable
622
- ? h('col', {
623
- style: {
624
- width: '140px'
625
- }
626
- })
627
- : createCommentVNode(),
628
- allowFixed
629
- ? h('col', {
630
- style: {
631
- width: '200px'
632
- }
633
- })
634
- : createCommentVNode()
635
- ]),
636
- h('thead', {}, [
637
- h('tr', {}, [
607
+ h('div', {
608
+ class: 'vxe-table-custom-popup--table-wrapper'
609
+ }, [
610
+ h('table', {}, [
611
+ h('colgroup', {}, [
638
612
  allowVisible
639
- ? h('th', {}, [
640
- h('div', {
641
- class: ['vxe-table-custom--checkbox-option', {
642
- 'is--checked': isAllChecked,
643
- 'is--indeterminate': isAllIndeterminate
644
- }],
645
- title: getI18n('vxe.table.allTitle'),
646
- onClick: allCustomEvent
647
- }, [
648
- h('span', {
649
- class: ['vxe-checkbox--icon', isAllIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isAllChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
650
- }),
651
- h('span', {
652
- class: 'vxe-checkbox--label'
653
- }, getI18n('vxe.toolbar.customAll'))
654
- ])
655
- ])
613
+ ? h('col', {
614
+ style: {
615
+ width: '80px'
616
+ }
617
+ })
656
618
  : createCommentVNode(),
657
619
  allowSort
658
- ? h('th', {}, [
659
- h('span', {
660
- class: 'vxe-table-custom-popup--table-sort-help-title'
661
- }, getI18n('vxe.custom.setting.colSort')),
662
- h(resolveComponent('vxe-tooltip'), {
663
- enterable: true,
664
- content: getI18n('vxe.custom.setting.sortHelpTip')
665
- }, {
666
- default: () => {
667
- return h('i', {
668
- class: 'vxe-table-custom-popup--table-sort-help-icon vxe-icon-question-circle-fill'
669
- });
670
- }
671
- })
672
- ])
620
+ ? h('col', {
621
+ style: {
622
+ width: '80px'
623
+ }
624
+ })
673
625
  : createCommentVNode(),
674
- h('th', {}, getI18n('vxe.custom.setting.colTitle')),
626
+ h('col', {
627
+ style: {
628
+ minWidth: '120px'
629
+ }
630
+ }),
675
631
  allowResizable
676
- ? h('th', {}, getI18n('vxe.custom.setting.colResizable'))
632
+ ? h('col', {
633
+ style: {
634
+ width: '140px'
635
+ }
636
+ })
677
637
  : createCommentVNode(),
678
638
  allowFixed
679
- ? h('th', {}, getI18n('vxe.custom.setting.colFixed', [columnOpts.maxFixedSize || 0]))
639
+ ? h('col', {
640
+ style: {
641
+ width: '200px'
642
+ }
643
+ })
680
644
  : createCommentVNode()
681
- ])
682
- ]),
683
- h(TransitionGroup, {
684
- class: 'vxe-table-custom--body',
685
- tag: 'tbody',
686
- name: 'vxe-table-custom--list'
687
- }, {
688
- default: () => trVNs
645
+ ]),
646
+ h('thead', {}, [
647
+ h('tr', {}, [
648
+ allowVisible
649
+ ? h('th', {}, [
650
+ h('div', {
651
+ class: ['vxe-table-custom--checkbox-option', {
652
+ 'is--checked': isAllChecked,
653
+ 'is--indeterminate': isAllIndeterminate
654
+ }],
655
+ title: getI18n('vxe.table.allTitle'),
656
+ onClick: allCustomEvent
657
+ }, [
658
+ h('span', {
659
+ class: ['vxe-checkbox--icon', isAllIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isAllChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
660
+ }),
661
+ h('span', {
662
+ class: 'vxe-checkbox--label'
663
+ }, getI18n('vxe.toolbar.customAll'))
664
+ ])
665
+ ])
666
+ : createCommentVNode(),
667
+ allowSort
668
+ ? h('th', {}, [
669
+ h('span', {
670
+ class: 'vxe-table-custom-popup--table-sort-help-title'
671
+ }, getI18n('vxe.custom.setting.colSort')),
672
+ VxeUITooltipComponent
673
+ ? h(VxeUITooltipComponent, {
674
+ enterable: true,
675
+ content: getI18n('vxe.custom.setting.sortHelpTip')
676
+ }, {
677
+ default: () => {
678
+ return h('i', {
679
+ class: 'vxe-table-custom-popup--table-sort-help-icon vxe-icon-question-circle-fill'
680
+ });
681
+ }
682
+ })
683
+ : createCommentVNode()
684
+ ])
685
+ : createCommentVNode(),
686
+ h('th', {}, getI18n('vxe.custom.setting.colTitle')),
687
+ allowResizable
688
+ ? h('th', {}, getI18n('vxe.custom.setting.colResizable'))
689
+ : createCommentVNode(),
690
+ allowFixed
691
+ ? h('th', {}, getI18n('vxe.custom.setting.colFixed', [columnOpts.maxFixedSize || 0]))
692
+ : createCommentVNode()
693
+ ])
694
+ ]),
695
+ h(TransitionGroup, {
696
+ class: 'vxe-table-custom--body',
697
+ tag: 'tbody',
698
+ name: 'vxe-table-custom--list'
699
+ }, {
700
+ default: () => trVNs
701
+ })
702
+ ])
703
+ ]),
704
+ h('div', {
705
+ ref: dragHintElemRef,
706
+ class: 'vxe-table-custom-popup--drag-hint'
707
+ }, getI18n('vxe.custom.cstmDragTarget', [dragColumn.value ? dragColumn.value.getTitle() : '']))
708
+ ]);
709
+ },
710
+ footer: () => {
711
+ return h('div', {
712
+ class: 'vxe-table-custom-popup--footer'
713
+ }, [
714
+ VxeUIButtonComponent
715
+ ? h(VxeUIButtonComponent, {
716
+ content: customOpts.resetButtonText || getI18n('vxe.custom.cstmRestore'),
717
+ onClick: resetCustomEvent
689
718
  })
690
- ])
691
- ]),
692
- h('div', {
693
- ref: dragHintElemRef,
694
- class: 'vxe-table-custom-popup--drag-hint'
695
- }, getI18n('vxe.custom.cstmDragTarget', [dragColumn.value ? dragColumn.value.getTitle() : '']))
696
- ]);
697
- },
698
- footer: () => {
699
- return h('div', {
700
- class: 'vxe-table-custom-popup--footer'
701
- }, [
702
- h(resolveComponent('vxe-button'), {
703
- content: customOpts.resetButtonText || getI18n('vxe.custom.cstmRestore'),
704
- onClick: resetCustomEvent
705
- }),
706
- h(resolveComponent('vxe-button'), {
707
- content: customOpts.resetButtonText || getI18n('vxe.custom.cstmCancel'),
708
- onClick: cancelCustomEvent
709
- }),
710
- h(resolveComponent('vxe-button'), {
711
- status: 'primary',
712
- content: customOpts.confirmButtonText || getI18n('vxe.custom.cstmConfirm'),
713
- onClick: confirmCustomEvent
714
- })
715
- ]);
716
- }
717
- });
719
+ : createCommentVNode(),
720
+ VxeUIButtonComponent
721
+ ? h(VxeUIButtonComponent, {
722
+ content: customOpts.resetButtonText || getI18n('vxe.custom.cstmCancel'),
723
+ onClick: cancelCustomEvent
724
+ })
725
+ : createCommentVNode(),
726
+ VxeUIButtonComponent
727
+ ? h(VxeUIButtonComponent, {
728
+ status: 'primary',
729
+ content: customOpts.confirmButtonText || getI18n('vxe.custom.cstmConfirm'),
730
+ onClick: confirmCustomEvent
731
+ })
732
+ : createCommentVNode()
733
+ ]);
734
+ }
735
+ })
736
+ : createCommentVNode();
718
737
  };
719
738
  const renderVN = () => {
720
739
  const customOpts = computeCustomOpts.value;