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.
- package/es/grid/src/grid.js +10 -9
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/module/custom/hook.js +8 -15
- package/es/table/module/custom/panel.js +166 -102
- package/es/table/module/edit/hook.js +11 -10
- package/es/table/module/export/hook.js +31 -11
- package/es/table/module/validator/hook.js +6 -5
- package/es/table/render/index.js +3 -2
- package/es/table/src/columnInfo.js +10 -8
- package/es/table/src/table.js +143 -85
- package/es/table/style.css +49 -12
- package/es/table/style.min.css +1 -1
- package/es/toolbar/src/toolbar.js +12 -11
- package/es/ui/index.js +6 -3
- package/es/ui/src/log.js +5 -0
- package/es/vxe-table/style.css +49 -12
- package/es/vxe-table/style.min.css +1 -1
- package/lib/grid/src/grid.js +9 -9
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +348 -206
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/module/custom/hook.js +8 -17
- package/lib/table/module/custom/hook.min.js +1 -1
- package/lib/table/module/custom/panel.js +96 -42
- package/lib/table/module/custom/panel.min.js +1 -1
- package/lib/table/module/edit/hook.js +10 -10
- package/lib/table/module/edit/hook.min.js +1 -1
- package/lib/table/module/export/hook.js +33 -12
- package/lib/table/module/export/hook.min.js +1 -1
- package/lib/table/module/validator/hook.js +6 -6
- package/lib/table/module/validator/hook.min.js +1 -1
- package/lib/table/render/index.js +3 -3
- package/lib/table/render/index.min.js +1 -1
- package/lib/table/src/columnInfo.js +10 -9
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/table.js +149 -85
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/style/style.css +49 -12
- package/lib/table/style/style.min.css +1 -1
- package/lib/toolbar/src/toolbar.js +11 -11
- package/lib/toolbar/src/toolbar.min.js +1 -1
- package/lib/ui/index.js +6 -3
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +13 -0
- package/lib/ui/src/log.min.js +1 -0
- package/lib/vxe-table/style/style.css +49 -12
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +2 -2
- package/packages/grid/src/grid.ts +10 -9
- package/packages/table/module/custom/hook.ts +10 -17
- package/packages/table/module/custom/panel.ts +166 -104
- package/packages/table/module/edit/hook.ts +11 -10
- package/packages/table/module/export/hook.ts +35 -13
- package/packages/table/module/validator/hook.ts +6 -5
- package/packages/table/render/index.ts +3 -2
- package/packages/table/src/columnInfo.ts +11 -8
- package/packages/table/src/table.ts +142 -85
- package/packages/toolbar/src/toolbar.ts +12 -11
- package/packages/ui/index.ts +4 -1
- package/packages/ui/src/log.ts +8 -0
- package/styles/components/table-module/custom.scss +45 -9
- 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:
|
|
57
|
+
storeData: $xeTable.getCustomStoreData()
|
|
62
58
|
})
|
|
63
59
|
}
|
|
64
60
|
}
|
|
65
61
|
|
|
66
62
|
const confirmCustomEvent = (evnt: Event) => {
|
|
67
63
|
const { customColumnList } = reactData
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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('
|
|
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
|
-
|
|
321
|
-
|
|
322
|
-
'
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
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
|
-
|
|
334
|
-
|
|
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
|
-
|
|
404
|
-
|
|
405
|
-
'
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
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.
|
|
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
|
-
|
|
494
|
-
|
|
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('
|
|
510
|
-
class: ['vxe-checkbox
|
|
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
|
-
:
|
|
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
|
-
|
|
545
|
-
? h(
|
|
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:
|
|
576
|
-
minWidth:
|
|
577
|
-
height:
|
|
578
|
-
minHeight:
|
|
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
|
-
|
|
600
|
-
|
|
601
|
-
|
|
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
|
-
|
|
627
|
-
h('
|
|
628
|
-
|
|
629
|
-
'
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
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,
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
1241
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1335
|
+
errLog('vxe.error.reqProp', ['print-config'])
|
|
1314
1336
|
}
|
|
1315
1337
|
}
|
|
1316
1338
|
handleExportAndPrint(Object.assign({}, printOpts, options), true)
|