vxe-table 4.7.5 → 4.7.7

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 (65) hide show
  1. package/es/grid/src/grid.js +10 -9
  2. package/es/style.css +1 -1
  3. package/es/style.min.css +1 -1
  4. package/es/table/module/custom/hook.js +8 -15
  5. package/es/table/module/custom/panel.js +166 -102
  6. package/es/table/module/edit/hook.js +11 -10
  7. package/es/table/module/export/hook.js +31 -11
  8. package/es/table/module/validator/hook.js +6 -5
  9. package/es/table/render/index.js +3 -2
  10. package/es/table/src/columnInfo.js +10 -8
  11. package/es/table/src/table.js +143 -85
  12. package/es/table/style.css +49 -12
  13. package/es/table/style.min.css +1 -1
  14. package/es/toolbar/src/toolbar.js +12 -11
  15. package/es/ui/index.js +6 -3
  16. package/es/ui/src/log.js +5 -0
  17. package/es/vxe-table/style.css +49 -12
  18. package/es/vxe-table/style.min.css +1 -1
  19. package/lib/grid/src/grid.js +9 -9
  20. package/lib/grid/src/grid.min.js +1 -1
  21. package/lib/index.umd.js +348 -206
  22. package/lib/index.umd.min.js +1 -1
  23. package/lib/style.css +1 -1
  24. package/lib/style.min.css +1 -1
  25. package/lib/table/module/custom/hook.js +8 -17
  26. package/lib/table/module/custom/hook.min.js +1 -1
  27. package/lib/table/module/custom/panel.js +96 -42
  28. package/lib/table/module/custom/panel.min.js +1 -1
  29. package/lib/table/module/edit/hook.js +10 -10
  30. package/lib/table/module/edit/hook.min.js +1 -1
  31. package/lib/table/module/export/hook.js +33 -12
  32. package/lib/table/module/export/hook.min.js +1 -1
  33. package/lib/table/module/validator/hook.js +6 -6
  34. package/lib/table/module/validator/hook.min.js +1 -1
  35. package/lib/table/render/index.js +3 -3
  36. package/lib/table/render/index.min.js +1 -1
  37. package/lib/table/src/columnInfo.js +10 -9
  38. package/lib/table/src/columnInfo.min.js +1 -1
  39. package/lib/table/src/table.js +149 -85
  40. package/lib/table/src/table.min.js +1 -1
  41. package/lib/table/style/style.css +49 -12
  42. package/lib/table/style/style.min.css +1 -1
  43. package/lib/toolbar/src/toolbar.js +11 -11
  44. package/lib/toolbar/src/toolbar.min.js +1 -1
  45. package/lib/ui/index.js +6 -3
  46. package/lib/ui/index.min.js +1 -1
  47. package/lib/ui/src/log.js +13 -0
  48. package/lib/ui/src/log.min.js +1 -0
  49. package/lib/vxe-table/style/style.css +49 -12
  50. package/lib/vxe-table/style/style.min.css +1 -1
  51. package/package.json +2 -2
  52. package/packages/grid/src/grid.ts +10 -9
  53. package/packages/table/module/custom/hook.ts +10 -17
  54. package/packages/table/module/custom/panel.ts +166 -104
  55. package/packages/table/module/edit/hook.ts +11 -10
  56. package/packages/table/module/export/hook.ts +35 -13
  57. package/packages/table/module/validator/hook.ts +6 -5
  58. package/packages/table/render/index.ts +3 -2
  59. package/packages/table/src/columnInfo.ts +11 -8
  60. package/packages/table/src/table.ts +142 -85
  61. package/packages/toolbar/src/toolbar.ts +12 -11
  62. package/packages/ui/index.ts +4 -1
  63. package/packages/ui/src/log.ts +8 -0
  64. package/styles/components/table-module/custom.scss +45 -9
  65. package/styles/components/table.scss +1 -0
@@ -4,7 +4,7 @@ import { formatText } from '../../../ui/src/utils'
4
4
  import { addClass, removeClass } from '../../../ui/src/dom'
5
5
  import XEUtils from 'xe-utils'
6
6
 
7
- import type { VxeTableDefines, VxeTablePrivateMethods, VxeTableConstructor, VxeTableMethods, VxeColumnPropTypes, VxeModalComponent, VxeButtonComponent, VxeRadioGroupComponent, VxeTooltipComponent } from '../../../../types'
7
+ import type { VxeTableDefines, VxeTablePrivateMethods, VxeTableConstructor, VxeTableMethods, VxeColumnPropTypes, VxeModalComponent, VxeButtonComponent, VxeRadioGroupComponent, VxeTooltipComponent, VxeInputComponent } from '../../../../types'
8
8
 
9
9
  const { getI18n, getIcon } = VxeUI
10
10
 
@@ -46,10 +46,6 @@ export default defineComponent({
46
46
  }, 300)
47
47
  }
48
48
 
49
- const getStoreData = (): VxeTableDefines.CustomStoreData => {
50
- return {}
51
- }
52
-
53
49
  const handleSaveStore = (type: 'confirm' | 'reset') => {
54
50
  const { id } = tableProps
55
51
  const customOpts = computeCustomOpts.value
@@ -58,18 +54,35 @@ export default defineComponent({
58
54
  updateStore({
59
55
  id,
60
56
  type,
61
- storeData: getStoreData()
57
+ storeData: $xeTable.getCustomStoreData()
62
58
  })
63
59
  }
64
60
  }
65
61
 
66
62
  const confirmCustomEvent = (evnt: Event) => {
67
63
  const { customColumnList } = reactData
68
- customColumnList.forEach((column, index) => {
69
- const sortIndex = index + 1
70
- column.renderSortNumber = sortIndex
71
- column.fixed = column.renderFixed
72
- column.visible = column.renderVisible
64
+ const customOpts = computeCustomOpts.value
65
+ const { allowVisible, allowSort, allowFixed, allowResizable } = customOpts
66
+ XEUtils.eachTree(customColumnList, (column, index, items, path, parent) => {
67
+ if (!parent) {
68
+ if (allowSort) {
69
+ const sortIndex = index + 1
70
+ column.renderSortNumber = sortIndex
71
+ }
72
+ if (allowFixed) {
73
+ column.fixed = column.renderFixed
74
+ }
75
+ }
76
+ if (allowResizable) {
77
+ if (column.renderVisible && (!column.children || column.children.length)) {
78
+ if (column.renderResizeWidth !== column.renderWidth) {
79
+ column.resizeWidth = column.renderResizeWidth
80
+ }
81
+ }
82
+ }
83
+ if (allowVisible) {
84
+ column.visible = column.renderVisible
85
+ }
73
86
  })
74
87
  $xeTable.closeCustom()
75
88
  $xeTable.emitCustomEvent('confirm', evnt)
@@ -80,15 +93,26 @@ export default defineComponent({
80
93
  const { customStore } = props
81
94
  const { customColumnList } = reactData
82
95
  const { oldSortMaps, oldFixedMaps, oldVisibleMaps } = customStore
96
+ const customOpts = computeCustomOpts.value
97
+ const { allowVisible, allowSort, allowFixed, allowResizable } = customOpts
83
98
  XEUtils.eachTree(customColumnList, column => {
84
99
  const colid = column.getKey()
85
100
  const visible = !!oldVisibleMaps[colid]
86
101
  const fixed = oldFixedMaps[colid] || ''
87
- column.renderVisible = visible
88
- column.visible = visible
89
- column.renderFixed = fixed
90
- column.fixed = fixed
91
- column.renderSortNumber = oldSortMaps[colid] || 0
102
+ if (allowVisible) {
103
+ column.renderVisible = visible
104
+ column.visible = visible
105
+ }
106
+ if (allowFixed) {
107
+ column.renderFixed = fixed
108
+ column.fixed = fixed
109
+ }
110
+ if (allowSort) {
111
+ column.renderSortNumber = oldSortMaps[colid] || 0
112
+ }
113
+ if (allowResizable) {
114
+ column.renderResizeWidth = column.renderWidth
115
+ }
92
116
  }, { children: 'children' })
93
117
  $xeTable.closeCustom()
94
118
  $xeTable.emitCustomEvent('cancel', evnt)
@@ -98,7 +122,7 @@ export default defineComponent({
98
122
  $xeTable.resetColumn(true)
99
123
  $xeTable.closeCustom()
100
124
  $xeTable.emitCustomEvent('reset', evnt)
101
- handleSaveStore('confirm')
125
+ handleSaveStore('reset')
102
126
  }
103
127
 
104
128
  const resetCustomEvent = (evnt: Event) => {
@@ -289,7 +313,7 @@ export default defineComponent({
289
313
  const { customColumnList } = reactData
290
314
  const customOpts = computeCustomOpts.value
291
315
  const { maxHeight } = customStore
292
- const { checkMethod, visibleMethod, allowSort, allowFixed, trigger } = customOpts
316
+ const { checkMethod, visibleMethod, allowVisible, allowSort, allowFixed, trigger, placement } = customOpts
293
317
  const isMaxFixedColumn = computeIsMaxFixedColumn.value
294
318
  const colVNs: VNode[] = []
295
319
  const customWrapperOns: any = {}
@@ -317,23 +341,25 @@ export default defineComponent({
317
341
  onDragend: sortDragendEvent,
318
342
  onDragover: sortDragoverEvent
319
343
  }, [
320
- h('div', {
321
- class: ['vxe-table-custom--checkbox-option', {
322
- 'is--checked': isChecked,
323
- 'is--indeterminate': isIndeterminate,
324
- 'is--disabled': isDisabled
325
- }],
326
- title: getI18n('vxe.custom.setting.colVisible'),
327
- onClick: () => {
328
- if (!isDisabled) {
329
- changeCheckboxOption(column)
344
+ allowVisible
345
+ ? h('div', {
346
+ class: ['vxe-table-custom--checkbox-option', {
347
+ 'is--checked': isChecked,
348
+ 'is--indeterminate': isIndeterminate,
349
+ 'is--disabled': isDisabled
350
+ }],
351
+ title: getI18n('vxe.custom.setting.colVisible'),
352
+ onClick: () => {
353
+ if (!isDisabled) {
354
+ changeCheckboxOption(column)
355
+ }
330
356
  }
331
- }
332
- }, [
333
- h('span', {
334
- class: ['vxe-checkbox--icon', isIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
335
- })
336
- ]),
357
+ }, [
358
+ h('span', {
359
+ class: ['vxe-checkbox--icon', isIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
360
+ })
361
+ ])
362
+ : createCommentVNode(),
337
363
  allowSort && column.level === 1
338
364
  ? h('div', {
339
365
  class: 'vxe-table-custom--sort-option'
@@ -389,9 +415,14 @@ export default defineComponent({
389
415
  return h('div', {
390
416
  ref: refElem,
391
417
  key: 'simple',
392
- class: ['vxe-table-custom-wrapper', {
418
+ class: ['vxe-table-custom-wrapper', `placement--${placement}`, {
393
419
  'is--active': customStore.visible
394
- }]
420
+ }],
421
+ style: maxHeight && !['left', 'right'].includes(placement as string)
422
+ ? {
423
+ maxHeight: `${maxHeight}px`
424
+ }
425
+ : {}
395
426
  }, customStore.visible
396
427
  ? [
397
428
  h('ul', {
@@ -400,21 +431,25 @@ export default defineComponent({
400
431
  h('li', {
401
432
  class: 'vxe-table-custom--option'
402
433
  }, [
403
- h('div', {
404
- class: ['vxe-table-custom--checkbox-option', {
405
- 'is--checked': isAllChecked,
406
- 'is--indeterminate': isAllIndeterminate
407
- }],
408
- title: getI18n('vxe.table.allTitle'),
409
- onClick: allCustomEvent
410
- }, [
411
- h('span', {
412
- class: ['vxe-checkbox--icon', isAllIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isAllChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
413
- }),
414
- h('span', {
434
+ allowVisible
435
+ ? h('div', {
436
+ class: ['vxe-table-custom--checkbox-option', {
437
+ 'is--checked': isAllChecked,
438
+ 'is--indeterminate': isAllIndeterminate
439
+ }],
440
+ title: getI18n('vxe.table.allTitle'),
441
+ onClick: allCustomEvent
442
+ }, [
443
+ h('span', {
444
+ class: ['vxe-checkbox--icon', isAllIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isAllChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
445
+ }),
446
+ h('span', {
447
+ class: 'vxe-checkbox--label'
448
+ }, getI18n('vxe.toolbar.customAll'))
449
+ ])
450
+ : h('span', {
415
451
  class: 'vxe-checkbox--label'
416
- }, getI18n('vxe.toolbar.customAll'))
417
- ])
452
+ }, getI18n('vxe.table.customTitle'))
418
453
  ])
419
454
  ]),
420
455
  h('div', {
@@ -425,11 +460,6 @@ export default defineComponent({
425
460
  class: 'vxe-table-custom--body',
426
461
  name: 'vxe-table-custom--list',
427
462
  tag: 'ul',
428
- style: maxHeight
429
- ? {
430
- maxHeight: `${maxHeight}px`
431
- }
432
- : {},
433
463
  ...customWrapperOns
434
464
  }, {
435
465
  default: () => colVNs
@@ -467,7 +497,7 @@ export default defineComponent({
467
497
  const { customStore } = props
468
498
  const { customColumnList } = reactData
469
499
  const customOpts = computeCustomOpts.value
470
- const { allowSort, allowFixed, checkMethod, visibleMethod } = customOpts
500
+ const { allowVisible, allowSort, allowFixed, allowResizable, checkMethod, visibleMethod } = customOpts
471
501
  const columnOpts = computeColumnOpts.value
472
502
  const isMaxFixedColumn = computeIsMaxFixedColumn.value
473
503
  const trVNs: VNode[] = []
@@ -490,27 +520,29 @@ export default defineComponent({
490
520
  onDragend: sortDragendEvent,
491
521
  onDragover: sortDragoverEvent
492
522
  }, [
493
- h('td', {
494
- class: 'vxe-table-custom-popup--column-item col--visible'
495
- }, [
496
- h('div', {
497
- class: ['vxe-table-custom--checkbox-option', {
498
- 'is--checked': isChecked,
499
- 'is--indeterminate': isIndeterminate,
500
- 'is--disabled': isDisabled
501
- }],
502
- title: getI18n('vxe.custom.setting.colVisible'),
503
- onClick: () => {
504
- if (!isDisabled) {
505
- changeCheckboxOption(column)
506
- }
507
- }
523
+ allowVisible
524
+ ? h('td', {
525
+ class: 'vxe-table-custom-popup--column-item col--visible'
508
526
  }, [
509
- h('span', {
510
- class: ['vxe-checkbox--icon', isIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
511
- })
527
+ h('div', {
528
+ class: ['vxe-table-custom--checkbox-option', {
529
+ 'is--checked': isChecked,
530
+ 'is--indeterminate': isIndeterminate,
531
+ 'is--disabled': isDisabled
532
+ }],
533
+ title: getI18n('vxe.custom.setting.colVisible'),
534
+ onClick: () => {
535
+ if (!isDisabled) {
536
+ changeCheckboxOption(column)
537
+ }
538
+ }
539
+ }, [
540
+ h('span', {
541
+ class: ['vxe-checkbox--icon', isIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
542
+ })
543
+ ])
512
544
  ])
513
- ]),
545
+ : createCommentVNode(),
514
546
  allowSort
515
547
  ? h('td', {
516
548
  class: 'vxe-table-custom-popup--column-item col--sort'
@@ -526,7 +558,7 @@ export default defineComponent({
526
558
  class: getIcon().TABLE_CUSTOM_SORT
527
559
  })
528
560
  ])
529
- : null
561
+ : h('span', '-')
530
562
  ])
531
563
  : createCommentVNode(),
532
564
  h('td', {
@@ -537,12 +569,29 @@ export default defineComponent({
537
569
  title: colTitle
538
570
  }, colTitle)
539
571
  ]),
572
+ allowResizable
573
+ ? h('td', {
574
+ class: 'vxe-table-custom-popup--column-item col--resizable'
575
+ }, [
576
+ !isChecked || (column.children && column.children.length)
577
+ ? h('span', '-')
578
+ : h(resolveComponent('vxe-input') as VxeInputComponent, {
579
+ type: 'integer',
580
+ min: 40,
581
+ modelValue: column.renderResizeWidth,
582
+ 'onUpdate:modelValue' (value: any) {
583
+ column.renderResizeWidth = Math.max(40, Number(value))
584
+ }
585
+ })
586
+ ])
587
+ : createCommentVNode(),
540
588
  allowFixed
541
589
  ? h('td', {
542
590
  class: 'vxe-table-custom-popup--column-item col--fixed'
543
591
  }, [
544
- !parent
545
- ? h(resolveComponent('vxe-radio-group') as VxeRadioGroupComponent, {
592
+ parent
593
+ ? h('span', '-')
594
+ : h(resolveComponent('vxe-radio-group') as VxeRadioGroupComponent, {
546
595
  modelValue: column.renderFixed || '',
547
596
  type: 'button',
548
597
  size: 'mini',
@@ -558,7 +607,6 @@ export default defineComponent({
558
607
  // changePopupFixedOption(column)
559
608
  // }
560
609
  })
561
- : null
562
610
  ])
563
611
  : createCommentVNode()
564
612
  ])
@@ -572,10 +620,10 @@ export default defineComponent({
572
620
  className: 'vxe-table-custom-popup-wrapper vxe-table--ignore-clear',
573
621
  modelValue: customStore.visible,
574
622
  title: getI18n('vxe.custom.cstmTitle'),
575
- width: '40vw',
576
- minWidth: 520,
577
- height: '50vh',
578
- minHeight: 300,
623
+ width: 700,
624
+ minWidth: 700,
625
+ height: 400,
626
+ minHeight: 400,
579
627
  mask: true,
580
628
  lockView: true,
581
629
  showFooter: true,
@@ -596,11 +644,13 @@ export default defineComponent({
596
644
  }, [
597
645
  h('table', {}, [
598
646
  h('colgroup', {}, [
599
- h('col', {
600
- style: {
601
- width: '80px'
602
- }
603
- }),
647
+ allowVisible
648
+ ? h('col', {
649
+ style: {
650
+ width: '80px'
651
+ }
652
+ })
653
+ : createCommentVNode(),
604
654
  allowSort
605
655
  ? h('col', {
606
656
  style: {
@@ -613,6 +663,13 @@ export default defineComponent({
613
663
  minWidth: '120px'
614
664
  }
615
665
  }),
666
+ allowResizable
667
+ ? h('col', {
668
+ style: {
669
+ width: '140px'
670
+ }
671
+ })
672
+ : createCommentVNode(),
616
673
  allowFixed
617
674
  ? h('col', {
618
675
  style: {
@@ -623,23 +680,25 @@ export default defineComponent({
623
680
  ]),
624
681
  h('thead', {}, [
625
682
  h('tr', {}, [
626
- h('th', {}, [
627
- h('div', {
628
- class: ['vxe-table-custom--checkbox-option', {
629
- 'is--checked': isAllChecked,
630
- 'is--indeterminate': isAllIndeterminate
631
- }],
632
- title: getI18n('vxe.table.allTitle'),
633
- onClick: allCustomEvent
634
- }, [
635
- h('span', {
636
- class: ['vxe-checkbox--icon', isAllIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isAllChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
637
- }),
638
- h('span', {
639
- class: 'vxe-checkbox--label'
640
- }, getI18n('vxe.toolbar.customAll'))
683
+ allowVisible
684
+ ? h('th', {}, [
685
+ h('div', {
686
+ class: ['vxe-table-custom--checkbox-option', {
687
+ 'is--checked': isAllChecked,
688
+ 'is--indeterminate': isAllIndeterminate
689
+ }],
690
+ title: getI18n('vxe.table.allTitle'),
691
+ onClick: allCustomEvent
692
+ }, [
693
+ h('span', {
694
+ class: ['vxe-checkbox--icon', isAllIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isAllChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
695
+ }),
696
+ h('span', {
697
+ class: 'vxe-checkbox--label'
698
+ }, getI18n('vxe.toolbar.customAll'))
699
+ ])
641
700
  ])
642
- ]),
701
+ : createCommentVNode(),
643
702
  allowSort
644
703
  ? h('th', {}, [
645
704
  h('span', {
@@ -658,6 +717,9 @@ export default defineComponent({
658
717
  ])
659
718
  : createCommentVNode(),
660
719
  h('th', {}, getI18n('vxe.custom.setting.colTitle')),
720
+ allowResizable
721
+ ? h('th', {}, getI18n('vxe.custom.setting.colResizable'))
722
+ : createCommentVNode(),
661
723
  allowFixed
662
724
  ? h('th', {}, getI18n('vxe.custom.setting.colFixed', [columnOpts.maxFixedSize || 0]))
663
725
  : createCommentVNode()
@@ -4,10 +4,11 @@ import { VxeUI } from '../../../ui'
4
4
  import { isEnableConf } from '../../../ui/src/utils'
5
5
  import { getCellValue, setCellValue, getRowid } from '../../src/util'
6
6
  import { browse, removeClass, addClass } from '../../../ui/src/dom'
7
+ import { warnLog, errLog } from '../../../ui/src/log'
7
8
 
8
9
  import type { TableEditMethods, TableEditPrivateMethods } from '../../../../types'
9
10
 
10
- const { getConfig, renderer, hooks, log, getI18n } = VxeUI
11
+ const { getConfig, renderer, hooks, getI18n } = VxeUI
11
12
 
12
13
  const tableEditMethodKeys: (keyof TableEditMethods)[] = ['insert', 'insertAt', 'insertNextAt', 'remove', 'removeCheckboxRow', 'removeRadioRow', 'removeCurrentRow', 'getRecordset', 'getInsertRecords', 'getRemoveRecords', 'getUpdateRecords', 'getEditRecord', 'getActiveRecord', 'getSelectedCell', 'clearEdit', 'clearActived', 'clearSelected', 'isEditByRow', 'isActiveByRow', 'setEditRow', 'setActiveRow', 'setEditCell', 'setActiveCell', 'setSelectCell']
13
14
 
@@ -91,7 +92,7 @@ hooks.add('tableEditModule', {
91
92
  } else {
92
93
  if (process.env.VUE_APP_VXE_ENV === 'development') {
93
94
  if (parentRowId) {
94
- log.warn('vxe.error.unableInsert')
95
+ warnLog('vxe.error.unableInsert')
95
96
  }
96
97
  }
97
98
  afterFullData[funcName](item)
@@ -159,7 +160,7 @@ hooks.add('tableEditModule', {
159
160
  if (process.env.VUE_APP_VXE_ENV === 'development') {
160
161
  if (item[treeOpts.parentField]) {
161
162
  if (parentRow && item[treeOpts.parentField] !== parentRow[rowField]) {
162
- log.err('vxe.error.errProp', [`${treeOpts.parentField}=${item[treeOpts.parentField]}`, `${treeOpts.parentField}=${parentRow[rowField]}`])
163
+ errLog('vxe.error.errProp', [`${treeOpts.parentField}=${item[treeOpts.parentField]}`, `${treeOpts.parentField}=${parentRow[rowField]}`])
163
164
  }
164
165
  }
165
166
  }
@@ -190,7 +191,7 @@ hooks.add('tableEditModule', {
190
191
  }
191
192
  } else {
192
193
  if (process.env.VUE_APP_VXE_ENV === 'development') {
193
- log.warn('vxe.error.unableInsert')
194
+ warnLog('vxe.error.unableInsert')
194
195
  }
195
196
  insertTreeRow(newRecords, true)
196
197
  }
@@ -212,7 +213,7 @@ hooks.add('tableEditModule', {
212
213
  afIndex = Math.min(afterFullData.length, afIndex + 1)
213
214
  }
214
215
  if (afIndex === -1) {
215
- throw new Error(log.err('vxe.error.unableInsert'))
216
+ throw new Error(getI18n('vxe.error.unableInsert'))
216
217
  }
217
218
  afterFullData.splice(afIndex, 0, ...newRecords)
218
219
  tableFullData.splice($xeTable.findRowIndexOf(tableFullData, row), 0, ...newRecords)
@@ -481,7 +482,7 @@ hooks.add('tableEditModule', {
481
482
  },
482
483
  getActiveRecord () {
483
484
  if (process.env.VUE_APP_VXE_ENV === 'development') {
484
- log.warn('vxe.error.delFunc', ['getActiveRecord', 'getEditRecord'])
485
+ warnLog('vxe.error.delFunc', ['getActiveRecord', 'getEditRecord'])
485
486
  }
486
487
  return this.getEditRecord()
487
488
  },
@@ -509,7 +510,7 @@ hooks.add('tableEditModule', {
509
510
  clearActived (evnt) {
510
511
  // 即将废弃
511
512
  if (process.env.VUE_APP_VXE_ENV === 'development') {
512
- log.warn('vxe.error.delFunc', ['clearActived', 'clearEdit'])
513
+ warnLog('vxe.error.delFunc', ['clearActived', 'clearEdit'])
513
514
  }
514
515
  return this.clearEdit(evnt)
515
516
  },
@@ -557,7 +558,7 @@ hooks.add('tableEditModule', {
557
558
  },
558
559
  isActiveByRow (row) {
559
560
  if (process.env.VUE_APP_VXE_ENV === 'development') {
560
- log.warn('vxe.error.delFunc', ['isActiveByRow', 'isEditByRow'])
561
+ warnLog('vxe.error.delFunc', ['isActiveByRow', 'isEditByRow'])
561
562
  }
562
563
  // 即将废弃
563
564
  return this.isEditByRow(row)
@@ -572,7 +573,7 @@ hooks.add('tableEditModule', {
572
573
  },
573
574
  setActiveRow (row) {
574
575
  if (process.env.VUE_APP_VXE_ENV === 'development') {
575
- log.warn('vxe.error.delFunc', ['setActiveRow', 'setEditRow'])
576
+ warnLog('vxe.error.delFunc', ['setActiveRow', 'setEditRow'])
576
577
  }
577
578
  // 即将废弃
578
579
  return editMethods.setEditRow(row)
@@ -590,7 +591,7 @@ hooks.add('tableEditModule', {
590
591
  },
591
592
  setActiveCell (row, fieldOrColumn) {
592
593
  if (process.env.VUE_APP_VXE_ENV === 'development') {
593
- log.warn('vxe.error.delFunc', ['setActiveCell', 'setEditCell'])
594
+ warnLog('vxe.error.delFunc', ['setActiveCell', 'setEditCell'])
594
595
  }
595
596
  // 即将废弃
596
597
  return editMethods.setEditCell(row, fieldOrColumn)
@@ -4,10 +4,11 @@ import { VxeUI } from '../../../ui'
4
4
  import { isColumnInfo, mergeBodyMethod, getCellValue } from '../../src/util'
5
5
  import { parseFile, formatText } from '../../../ui/src/utils'
6
6
  import { createHtmlPage, getExportBlobByContent } from './util'
7
+ import { warnLog, errLog } from '../../../ui/src/log'
7
8
 
8
9
  import type { VxeGridConstructor, VxeGridPrivateMethods, TableExportMethods } from '../../../../types'
9
10
 
10
- const { getI18n, hooks, renderer, log } = VxeUI
11
+ const { getI18n, hooks, renderer } = VxeUI
11
12
 
12
13
  let htmlCellElem: any
13
14
 
@@ -897,7 +898,7 @@ hooks.add('tableExportModule', {
897
898
  $xeTable.preventEvent(null, 'event.import', { file, options, columns: tableFullColumn }, () => {
898
899
  const reader = new FileReader()
899
900
  reader.onerror = () => {
900
- log.err('vxe.error.notType', [type])
901
+ errLog('vxe.error.notType', [type])
901
902
  _importReject({ status: false })
902
903
  }
903
904
  reader.onload = (e: any) => {
@@ -909,7 +910,7 @@ hooks.add('tableExportModule', {
909
910
  } else {
910
911
  // 不支持的浏览器
911
912
  if (process.env.VUE_APP_VXE_ENV === 'development') {
912
- log.err('vxe.error.notExp')
913
+ errLog('vxe.error.notExp')
913
914
  }
914
915
  _importResolve({ status: true })
915
916
  }
@@ -1119,7 +1120,7 @@ hooks.add('tableExportModule', {
1119
1120
  // 检查类型,如果为自定义导出,则不需要校验类型
1120
1121
  if (!opts.exportMethod && !XEUtils.includes(XEUtils.keys(exportOpts._typeMaps), type)) {
1121
1122
  if (process.env.VUE_APP_VXE_ENV === 'development') {
1122
- log.err('vxe.error.notType', [type])
1123
+ errLog('vxe.error.notType', [type])
1123
1124
  }
1124
1125
  const params = { status: false }
1125
1126
  return Promise.reject(params)
@@ -1143,7 +1144,7 @@ hooks.add('tableExportModule', {
1143
1144
  } else if (mode === 'all') {
1144
1145
  if (process.env.VUE_APP_VXE_ENV === 'development') {
1145
1146
  if (!$xeGrid) {
1146
- log.warn('vxe.error.errProp', ['all', 'mode=current,selected'])
1147
+ warnLog('vxe.error.errProp', ['all', 'mode=current,selected'])
1147
1148
  }
1148
1149
  }
1149
1150
 
@@ -1156,7 +1157,7 @@ hooks.add('tableExportModule', {
1156
1157
 
1157
1158
  if (process.env.VUE_APP_VXE_ENV === 'development') {
1158
1159
  if (!ajaxMethods) {
1159
- log.warn('vxe.error.notFunc', ['proxy-config.ajax.queryAll'])
1160
+ warnLog('vxe.error.notFunc', ['proxy-config.ajax.queryAll'])
1160
1161
  }
1161
1162
  }
1162
1163
 
@@ -1237,14 +1238,18 @@ hooks.add('tableExportModule', {
1237
1238
  return new Promise((resolve, reject) => {
1238
1239
  if (VxeUI.print) {
1239
1240
  if (opts.content) {
1240
- resolve(VxeUI.print({
1241
- content: opts.content
1242
- }))
1241
+ resolve(
1242
+ VxeUI.print({
1243
+ title: opts.sheetName,
1244
+ html: opts.content
1245
+ })
1246
+ )
1243
1247
  } else {
1244
1248
  resolve(
1245
1249
  exportMethods.exportData(opts).then(({ content }: any) => {
1246
1250
  return VxeUI.print({
1247
- content
1251
+ title: opts.sheetName,
1252
+ html: content
1248
1253
  })
1249
1254
  })
1250
1255
  )
@@ -1255,6 +1260,23 @@ hooks.add('tableExportModule', {
1255
1260
  }
1256
1261
  })
1257
1262
  },
1263
+ getPrintHtml (options) {
1264
+ const printOpts = computePrintOpts.value
1265
+ const opts = Object.assign({
1266
+ original: false
1267
+ // beforePrintMethod
1268
+ }, printOpts, options, {
1269
+ type: 'html',
1270
+ download: false,
1271
+ remote: false,
1272
+ print: true
1273
+ })
1274
+ return exportMethods.exportData(opts).then(({ content }) => {
1275
+ return {
1276
+ html: content
1277
+ }
1278
+ })
1279
+ },
1258
1280
  openImport (options) {
1259
1281
  const { treeConfig, importConfig } = props
1260
1282
  const { initStore, importStore, importParams } = reactData
@@ -1271,7 +1293,7 @@ hooks.add('tableExportModule', {
1271
1293
  return
1272
1294
  }
1273
1295
  if (!importConfig) {
1274
- log.err('vxe.error.reqProp', ['import-config'])
1296
+ errLog('vxe.error.reqProp', ['import-config'])
1275
1297
  }
1276
1298
  // 处理类型
1277
1299
  const typeList = types.map((value: any) => {
@@ -1301,7 +1323,7 @@ hooks.add('tableExportModule', {
1301
1323
  const exportOpts = computeExportOpts.value
1302
1324
  if (process.env.VUE_APP_VXE_ENV === 'development') {
1303
1325
  if (!props.exportConfig) {
1304
- log.err('vxe.error.reqProp', ['export-config'])
1326
+ errLog('vxe.error.reqProp', ['export-config'])
1305
1327
  }
1306
1328
  }
1307
1329
  handleExportAndPrint(Object.assign({}, exportOpts, options))
@@ -1310,7 +1332,7 @@ hooks.add('tableExportModule', {
1310
1332
  const printOpts = computePrintOpts.value
1311
1333
  if (process.env.VUE_APP_VXE_ENV === 'development') {
1312
1334
  if (!props.printConfig) {
1313
- log.err('vxe.error.reqProp', ['print-config'])
1335
+ errLog('vxe.error.reqProp', ['print-config'])
1314
1336
  }
1315
1337
  }
1316
1338
  handleExportAndPrint(Object.assign({}, printOpts, options), true)