vxe-table 3.23.0-beta.2 → 3.23.0-beta.3

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.
@@ -2,7 +2,7 @@ import { CreateElement, VNode, PropType } from 'vue'
2
2
  import { defineVxeComponent } from '../../../ui/src/comp'
3
3
  import { VxeUI } from '../../../ui'
4
4
  import XEUtils from 'xe-utils'
5
- import { formatText } from '../../../ui/src/utils'
5
+ import { formatText, getDefaultConfig } from '../../../ui/src/utils'
6
6
  import { createComponentLog } from '../../../ui/src/log'
7
7
 
8
8
  import type { VxeComponentSizeType } from 'vxe-pc-ui'
@@ -260,6 +260,10 @@ export default /* define-vxe-component start */ defineVxeComponent({
260
260
  const { hasTree, hasRowGroup, hasMerge, isPrint, hasColgroup, columns } = storeData
261
261
  const { isHeader } = defaultOptions
262
262
  const colVNs: VNode[] = []
263
+ const exportOpts = $xeTable.computeExportOpts
264
+ const printOpts = $xeTable.computePrintOpts
265
+ const modelOptions = (isPrint ? printOpts : exportOpts).modelOptions || {}
266
+ const settingOptions = (isPrint ? printOpts : exportOpts).settingOptions || {}
263
267
  const checkedAll = $xeExportPanel.computeCheckedAll
264
268
  const showSheet = $xeExportPanel.computeShowSheet
265
269
  const supportMerge = $xeExportPanel.computeSupportMerge
@@ -321,17 +325,19 @@ export default /* define-vxe-component start */ defineVxeComponent({
321
325
  props: {
322
326
  id: 'VXE_EXPORT_MODAL',
323
327
  value: storeData.visible,
324
- title: getI18n(isPrint ? 'vxe.export.printTitle' : 'vxe.export.expTitle'),
325
- width: 660,
326
- minWidth: 500,
327
- minHeight: 400,
328
+ title: modelOptions.title || getI18n(isPrint ? 'vxe.export.printTitle' : 'vxe.export.expTitle'),
329
+ width: modelOptions.width || 660,
330
+ height: modelOptions.height,
331
+ minWidth: modelOptions.minWidth || 500,
332
+ minHeight: modelOptions.minHeight || 400,
328
333
  mask: true,
329
334
  lockView: true,
330
335
  showFooter: true,
331
336
  escClosable: true,
332
337
  maskClosable: true,
333
- showMaximize: true,
334
- resize: true,
338
+ showMinimize: modelOptions.showMinimize,
339
+ showMaximize: getDefaultConfig(modelOptions.showMaximize, true),
340
+ resize: getDefaultConfig(modelOptions.resize, true),
335
341
  loading: reactData.loading
336
342
  },
337
343
  on: {
@@ -375,7 +381,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
375
381
  }, [
376
382
  h('tbody', [
377
383
  [
378
- isPrint
384
+ isPrint || settingOptions.showFileName === false
379
385
  ? renderEmptyElement($xeTable)
380
386
  : h('tr', [
381
387
  h('td', getI18n('vxe.export.expName')),
@@ -398,7 +404,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
398
404
  : renderEmptyElement($xeTable)
399
405
  ])
400
406
  ]),
401
- isPrint
407
+ isPrint || settingOptions.showType === false
402
408
  ? renderEmptyElement($xeTable)
403
409
  : h('tr', [
404
410
  h('td', getI18n('vxe.export.expType')),
@@ -416,7 +422,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
416
422
  })
417
423
  ])
418
424
  ]),
419
- isPrint || showSheet
425
+ (isPrint || showSheet) && settingOptions.showSheet !== false
420
426
  ? h('tr', [
421
427
  h('td', getI18n('vxe.export.expSheetName')),
422
428
  h('td', [
@@ -439,58 +445,62 @@ export default /* define-vxe-component start */ defineVxeComponent({
439
445
  ])
440
446
  ])
441
447
  : renderEmptyElement($xeTable),
442
- h('tr', [
443
- h('td', getI18n('vxe.export.expMode')),
444
- h('td', [
445
- h(VxeUISelectComponent, {
446
- props: {
447
- value: defaultOptions.mode,
448
- options: storeData.modeList
449
- },
450
- on: {
451
- modelValue (value: any) {
452
- defaultOptions.mode = value
448
+ settingOptions.showMode === false
449
+ ? renderEmptyElement($xeTable)
450
+ : h('tr', [
451
+ h('td', getI18n('vxe.export.expMode')),
452
+ h('td', [
453
+ h(VxeUISelectComponent, {
454
+ props: {
455
+ value: defaultOptions.mode,
456
+ options: storeData.modeList
457
+ },
458
+ on: {
459
+ modelValue (value: any) {
460
+ defaultOptions.mode = value
461
+ }
453
462
  }
454
- }
455
- })
456
- ])
457
- ]),
458
- h('tr', [
459
- h('td', [getI18n('vxe.export.expColumn')]),
460
- h('td', [
461
- h('div', {
462
- class: 'vxe-table-export--panel-column'
463
- }, [
464
- h('ul', {
465
- class: 'vxe-table-export--panel-column-header'
463
+ })
464
+ ])
465
+ ]),
466
+ settingOptions.showColumn === false
467
+ ? renderEmptyElement($xeTable)
468
+ : h('tr', [
469
+ h('td', [getI18n('vxe.export.expColumn')]),
470
+ h('td', [
471
+ h('div', {
472
+ class: 'vxe-table-export--panel-column'
466
473
  }, [
467
- h('li', {
468
- class: ['vxe-table-export--panel-column-option', {
469
- 'is--checked': isAllChecked,
470
- 'is--indeterminate': isAllIndeterminate
471
- }],
472
- attrs: {
473
- title: getI18n('vxe.table.allTitle')
474
- },
475
- on: {
476
- click: $xeExportPanel.allColumnEvent
477
- }
474
+ h('ul', {
475
+ class: 'vxe-table-export--panel-column-header'
478
476
  }, [
479
- h('span', {
480
- class: ['vxe-checkbox--icon', isAllIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isAllChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
481
- }),
482
- h('span', {
483
- class: 'vxe-checkbox--label'
484
- }, getI18n('vxe.export.expCurrentColumn'))
485
- ])
486
- ]),
487
- h('ul', {
488
- class: 'vxe-table-export--panel-column-body'
489
- }, colVNs)
477
+ h('li', {
478
+ class: ['vxe-table-export--panel-column-option', {
479
+ 'is--checked': isAllChecked,
480
+ 'is--indeterminate': isAllIndeterminate
481
+ }],
482
+ attrs: {
483
+ title: getI18n('vxe.table.allTitle')
484
+ },
485
+ on: {
486
+ click: $xeExportPanel.allColumnEvent
487
+ }
488
+ }, [
489
+ h('span', {
490
+ class: ['vxe-checkbox--icon', isAllIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isAllChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
491
+ }),
492
+ h('span', {
493
+ class: 'vxe-checkbox--label'
494
+ }, getI18n('vxe.export.expCurrentColumn'))
495
+ ])
496
+ ]),
497
+ h('ul', {
498
+ class: 'vxe-table-export--panel-column-body'
499
+ }, colVNs)
500
+ ])
490
501
  ])
491
- ])
492
- ]),
493
- isPrint
502
+ ]),
503
+ isPrint && (settingOptions.showWidthMode !== false)
494
504
  ? h('tr', [
495
505
  h('td', getI18n('vxe.export.widthMode')),
496
506
  h('td', [
@@ -510,154 +520,156 @@ export default /* define-vxe-component start */ defineVxeComponent({
510
520
  ])
511
521
  ])
512
522
  : renderEmptyElement($xeTable),
513
- h('tr', [
514
- h('td', getI18n('vxe.export.expOpts')),
515
- parameterSlot
516
- ? h('td', [
517
- h('div', {
518
- class: 'vxe-table-export--panel-option-row'
519
- }, $xeTable.callSlot(parameterSlot, params, h))
520
- ])
521
- : h('td', [
522
- h('div', {
523
- class: 'vxe-table-export--panel-option-row'
524
- }, VxeUICheckboxComponent
525
- ? [
526
- h(VxeUICheckboxComponent, {
527
- props: {
528
- value: hasEmptyData || isHeader,
529
- disabled: hasEmptyData,
530
- title: getI18n('vxe.export.expHeaderTitle'),
531
- content: getI18n('vxe.export.expOptHeader')
532
- },
533
- on: {
534
- input (value: any) {
535
- defaultOptions.isHeader = value
536
- }
537
- }
538
- }),
539
- h(VxeUICheckboxComponent, {
540
- props: {
541
- value: defaultOptions.isFooter,
542
- disabled: !storeData.hasFooter,
543
- title: getI18n('vxe.export.expFooterTitle'),
544
- content: getI18n('vxe.export.expOptFooter')
545
- },
546
- on: {
547
- input (value: any) {
548
- defaultOptions.isFooter = value
523
+ settingOptions.showParameter === false
524
+ ? renderEmptyElement($xeTable)
525
+ : h('tr', [
526
+ h('td', getI18n('vxe.export.expOpts')),
527
+ parameterSlot
528
+ ? h('td', [
529
+ h('div', {
530
+ class: 'vxe-table-export--panel-option-row'
531
+ }, $xeTable.callSlot(parameterSlot, params, h))
532
+ ])
533
+ : h('td', [
534
+ h('div', {
535
+ class: 'vxe-table-export--panel-option-row'
536
+ }, VxeUICheckboxComponent
537
+ ? [
538
+ h(VxeUICheckboxComponent, {
539
+ props: {
540
+ value: hasEmptyData || isHeader,
541
+ disabled: hasEmptyData,
542
+ title: getI18n('vxe.export.expHeaderTitle'),
543
+ content: getI18n('vxe.export.expOptHeader')
544
+ },
545
+ on: {
546
+ input (value: any) {
547
+ defaultOptions.isHeader = value
548
+ }
549
549
  }
550
- }
551
- }),
552
- h(VxeUICheckboxComponent, {
553
- props: {
554
- value: isHeader ? defaultOptions.isTitle : false,
555
- disabled: !isHeader,
556
- title: getI18n('vxe.export.expTitleTitle'),
557
- content: getI18n('vxe.export.expOptTitle')
558
- },
559
- on: {
560
- input (value: any) {
561
- defaultOptions.isTitle = value
550
+ }),
551
+ h(VxeUICheckboxComponent, {
552
+ props: {
553
+ value: defaultOptions.isFooter,
554
+ disabled: !storeData.hasFooter,
555
+ title: getI18n('vxe.export.expFooterTitle'),
556
+ content: getI18n('vxe.export.expOptFooter')
557
+ },
558
+ on: {
559
+ input (value: any) {
560
+ defaultOptions.isFooter = value
561
+ }
562
562
  }
563
- }
564
- }),
565
- h(VxeUICheckboxComponent, {
566
- props: {
567
- value: isHeader && hasColgroup && supportMerge ? defaultOptions.isColgroup : false,
568
- disabled: !isHeader || !hasColgroup || !supportMerge,
569
- title: getI18n('vxe.export.expColgroupTitle'),
570
- content: getI18n('vxe.export.expOptColgroup')
571
- },
572
- on: {
573
- input (value: any) {
574
- defaultOptions.isColgroup = value
563
+ }),
564
+ h(VxeUICheckboxComponent, {
565
+ props: {
566
+ value: isHeader ? defaultOptions.isTitle : false,
567
+ disabled: !isHeader,
568
+ title: getI18n('vxe.export.expTitleTitle'),
569
+ content: getI18n('vxe.export.expOptTitle')
570
+ },
571
+ on: {
572
+ input (value: any) {
573
+ defaultOptions.isTitle = value
574
+ }
575
575
  }
576
- }
577
- })
578
- ]
579
- : []),
580
- h('div', {
581
- class: 'vxe-table-export--panel-option-row'
582
- }, VxeUICheckboxComponent
583
- ? [
584
- h(VxeUICheckboxComponent, {
585
- props: {
586
- value: hasEmptyData ? false : defaultOptions.original,
587
- disabled: hasEmptyData,
588
- title: getI18n('vxe.export.expOriginalTitle'),
589
- content: getI18n('vxe.export.expOptOriginal')
590
- },
591
- on: {
592
- input (value: any) {
593
- defaultOptions.original = value
576
+ }),
577
+ h(VxeUICheckboxComponent, {
578
+ props: {
579
+ value: isHeader && hasColgroup && supportMerge ? defaultOptions.isColgroup : false,
580
+ disabled: !isHeader || !hasColgroup || !supportMerge,
581
+ title: getI18n('vxe.export.expColgroupTitle'),
582
+ content: getI18n('vxe.export.expOptColgroup')
583
+ },
584
+ on: {
585
+ input (value: any) {
586
+ defaultOptions.isColgroup = value
587
+ }
594
588
  }
595
- }
596
- }),
597
- h(VxeUICheckboxComponent, {
598
- props: {
599
- value: hasMerge && supportMerge && checkedAll ? defaultOptions.isMerge : false,
600
- disabled: hasEmptyData || !hasMerge || !supportMerge || !checkedAll,
601
- title: getI18n('vxe.export.expMergeTitle'),
602
- content: getI18n('vxe.export.expOptMerge')
603
- },
604
- on: {
605
- input (value: any) {
606
- defaultOptions.isMerge = value
589
+ })
590
+ ]
591
+ : []),
592
+ h('div', {
593
+ class: 'vxe-table-export--panel-option-row'
594
+ }, VxeUICheckboxComponent
595
+ ? [
596
+ h(VxeUICheckboxComponent, {
597
+ props: {
598
+ value: hasEmptyData ? false : defaultOptions.original,
599
+ disabled: hasEmptyData,
600
+ title: getI18n('vxe.export.expOriginalTitle'),
601
+ content: getI18n('vxe.export.expOptOriginal')
602
+ },
603
+ on: {
604
+ input (value: any) {
605
+ defaultOptions.original = value
606
+ }
607
607
  }
608
- }
609
- }),
610
- isPrint
611
- ? renderEmptyElement($xeTable)
612
- : h(VxeUICheckboxComponent, {
608
+ }),
609
+ h(VxeUICheckboxComponent, {
613
610
  props: {
614
- value: supportStyle ? defaultOptions.useStyle : false,
615
- disabled: !supportStyle,
616
- title: getI18n('vxe.export.expUseStyleTitle'),
617
- content: getI18n('vxe.export.expOptUseStyle')
611
+ value: hasMerge && supportMerge && checkedAll ? defaultOptions.isMerge : false,
612
+ disabled: hasEmptyData || !hasMerge || !supportMerge || !checkedAll,
613
+ title: getI18n('vxe.export.expMergeTitle'),
614
+ content: getI18n('vxe.export.expOptMerge')
618
615
  },
619
616
  on: {
620
617
  input (value: any) {
621
- defaultOptions.useStyle = value
618
+ defaultOptions.isMerge = value
622
619
  }
623
620
  }
624
- })
625
- ]
626
- : []),
627
- h('div', {
628
- class: 'vxe-table-export--panel-option-row'
629
- }, VxeUICheckboxComponent
630
- ? [
631
- h(VxeUICheckboxComponent, {
632
- props: {
633
- value: hasTree ? defaultOptions.isTreeAllExpanded : false,
634
- disabled: hasEmptyData || !hasTree,
635
- title: getI18n('vxe.export.expTreeAllExpandTitle'),
636
- content: getI18n('vxe.export.expOptTreeAllExpand')
637
- },
638
- on: {
639
- input (value: any) {
640
- defaultOptions.isTreeAllExpanded = value
621
+ }),
622
+ isPrint
623
+ ? renderEmptyElement($xeTable)
624
+ : h(VxeUICheckboxComponent, {
625
+ props: {
626
+ value: supportStyle ? defaultOptions.useStyle : false,
627
+ disabled: !supportStyle,
628
+ title: getI18n('vxe.export.expUseStyleTitle'),
629
+ content: getI18n('vxe.export.expOptUseStyle')
630
+ },
631
+ on: {
632
+ input (value: any) {
633
+ defaultOptions.useStyle = value
634
+ }
635
+ }
636
+ })
637
+ ]
638
+ : []),
639
+ h('div', {
640
+ class: 'vxe-table-export--panel-option-row'
641
+ }, VxeUICheckboxComponent
642
+ ? [
643
+ h(VxeUICheckboxComponent, {
644
+ props: {
645
+ value: hasTree ? defaultOptions.isTreeAllExpanded : false,
646
+ disabled: hasEmptyData || !hasTree,
647
+ title: getI18n('vxe.export.expTreeAllExpandTitle'),
648
+ content: getI18n('vxe.export.expOptTreeAllExpand')
649
+ },
650
+ on: {
651
+ input (value: any) {
652
+ defaultOptions.isTreeAllExpanded = value
653
+ }
641
654
  }
642
- }
643
- }),
644
- h(VxeUICheckboxComponent, {
645
- props: {
646
- value: hasRowGroup ? defaultOptions.isRowGroupAllExpanded : false,
647
- disabled: hasEmptyData || !hasRowGroup,
648
- title: getI18n('vxe.export.expRowGroupAllExpandTitle'),
649
- content: getI18n('vxe.export.expOptRowGroupAllExpand')
650
- },
651
- on: {
652
- input (value: any) {
653
- defaultOptions.isRowGroupAllExpanded = value
655
+ }),
656
+ h(VxeUICheckboxComponent, {
657
+ props: {
658
+ value: hasRowGroup ? defaultOptions.isRowGroupAllExpanded : false,
659
+ disabled: hasEmptyData || !hasRowGroup,
660
+ title: getI18n('vxe.export.expRowGroupAllExpandTitle'),
661
+ content: getI18n('vxe.export.expOptRowGroupAllExpand')
662
+ },
663
+ on: {
664
+ input (value: any) {
665
+ defaultOptions.isRowGroupAllExpanded = value
666
+ }
654
667
  }
655
- }
656
- })
657
- ]
658
- : [])
659
- ])
660
- ])
668
+ })
669
+ ]
670
+ : [])
671
+ ])
672
+ ])
661
673
  ]
662
674
  ])
663
675
  ])
@@ -2,7 +2,7 @@ import { CreateElement, PropType } from 'vue'
2
2
  import { defineVxeComponent } from '../../../ui/src/comp'
3
3
  import { VxeUI } from '../../../ui'
4
4
  import XEUtils from 'xe-utils'
5
- import { parseFile } from '../../../ui/src/utils'
5
+ import { getDefaultConfig, parseFile } from '../../../ui/src/utils'
6
6
  import { createComponentLog } from '../../../ui/src/log'
7
7
 
8
8
  import type { VxeComponentSizeType } from 'vxe-pc-ui'
@@ -154,7 +154,10 @@ export default /* define-vxe-component start */ defineVxeComponent({
154
154
  const { defaultOptions, storeData } = props
155
155
  const selectName = $xeImportPanel.computeSelectName as string
156
156
  const hasFile = $xeImportPanel.computeHasFile
157
+ const importOpts = $xeTable.computeImportOpts
157
158
  const parseTypeLabel = $xeImportPanel.computeParseTypeLabel as string
159
+ const modelOptions = importOpts.modelOptions || {}
160
+ const settingOptions = importOpts.settingOptions || {}
158
161
  const slots = defaultOptions.slots || {}
159
162
  const topSlot = slots.top
160
163
  const bottomSlot = slots.bottom
@@ -165,17 +168,19 @@ export default /* define-vxe-component start */ defineVxeComponent({
165
168
  props: {
166
169
  id: 'VXE_IMPORT_MODAL',
167
170
  value: storeData.visible,
168
- title: getI18n('vxe.import.impTitle'),
169
- width: 540,
170
- minWidth: 360,
171
- minHeight: 240,
171
+ title: modelOptions.title || getI18n('vxe.import.impTitle'),
172
+ width: modelOptions.width || 540,
173
+ height: modelOptions.height,
174
+ minWidth: modelOptions.minWidth || 360,
175
+ minHeight: modelOptions.minHeight || 240,
172
176
  mask: true,
173
177
  lockView: true,
174
178
  showFooter: true,
175
179
  escClosable: true,
176
180
  maskClosable: true,
177
- showMaximize: true,
178
- resize: true,
181
+ showMinimize: modelOptions.showMinimize,
182
+ showMaximize: getDefaultConfig(modelOptions.showMaximize, true),
183
+ resize: getDefaultConfig(modelOptions.resize, true),
179
184
  loading: reactData.loading
180
185
  },
181
186
  on: {
@@ -250,22 +255,24 @@ export default /* define-vxe-component start */ defineVxeComponent({
250
255
  h('td', getI18n('vxe.import.impType')),
251
256
  h('td', parseTypeLabel)
252
257
  ]),
253
- h('tr', [
254
- h('td', getI18n('vxe.import.impMode')),
255
- h('td', [
256
- h('vxe-select', {
257
- props: {
258
- value: defaultOptions.mode,
259
- options: storeData.modeList
260
- },
261
- on: {
262
- modelValue (value: any) {
263
- defaultOptions.mode = value
258
+ settingOptions.showMode === false
259
+ ? renderEmptyElement($xeTable)
260
+ : h('tr', [
261
+ h('td', getI18n('vxe.import.impMode')),
262
+ h('td', [
263
+ h('vxe-select', {
264
+ props: {
265
+ value: defaultOptions.mode,
266
+ options: storeData.modeList
267
+ },
268
+ on: {
269
+ modelValue (value: any) {
270
+ defaultOptions.mode = value
271
+ }
264
272
  }
265
- }
266
- })
273
+ })
274
+ ])
267
275
  ])
268
- ])
269
276
  ])
270
277
  ])
271
278
  ]
@@ -54,3 +54,7 @@ export function eqEmptyValue (cellValue: any) {
54
54
  export function getClass (property: any, params: any) {
55
55
  return property ? XEUtils.isFunction(property) ? property(params) : property : ''
56
56
  }
57
+
58
+ export function getDefaultConfig (val1: any, def1: any) {
59
+ return XEUtils.eqNull(val1) ? def1 : val1
60
+ }