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
|
@@ -35,9 +35,6 @@ export default defineComponent({
|
|
|
35
35
|
}
|
|
36
36
|
}, 300);
|
|
37
37
|
};
|
|
38
|
-
const getStoreData = () => {
|
|
39
|
-
return {};
|
|
40
|
-
};
|
|
41
38
|
const handleSaveStore = (type) => {
|
|
42
39
|
const { id } = tableProps;
|
|
43
40
|
const customOpts = computeCustomOpts.value;
|
|
@@ -46,17 +43,34 @@ export default defineComponent({
|
|
|
46
43
|
updateStore({
|
|
47
44
|
id,
|
|
48
45
|
type,
|
|
49
|
-
storeData:
|
|
46
|
+
storeData: $xeTable.getCustomStoreData()
|
|
50
47
|
});
|
|
51
48
|
}
|
|
52
49
|
};
|
|
53
50
|
const confirmCustomEvent = (evnt) => {
|
|
54
51
|
const { customColumnList } = reactData;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
52
|
+
const customOpts = computeCustomOpts.value;
|
|
53
|
+
const { allowVisible, allowSort, allowFixed, allowResizable } = customOpts;
|
|
54
|
+
XEUtils.eachTree(customColumnList, (column, index, items, path, parent) => {
|
|
55
|
+
if (!parent) {
|
|
56
|
+
if (allowSort) {
|
|
57
|
+
const sortIndex = index + 1;
|
|
58
|
+
column.renderSortNumber = sortIndex;
|
|
59
|
+
}
|
|
60
|
+
if (allowFixed) {
|
|
61
|
+
column.fixed = column.renderFixed;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (allowResizable) {
|
|
65
|
+
if (column.renderVisible && (!column.children || column.children.length)) {
|
|
66
|
+
if (column.renderResizeWidth !== column.renderWidth) {
|
|
67
|
+
column.resizeWidth = column.renderResizeWidth;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (allowVisible) {
|
|
72
|
+
column.visible = column.renderVisible;
|
|
73
|
+
}
|
|
60
74
|
});
|
|
61
75
|
$xeTable.closeCustom();
|
|
62
76
|
$xeTable.emitCustomEvent('confirm', evnt);
|
|
@@ -66,15 +80,26 @@ export default defineComponent({
|
|
|
66
80
|
const { customStore } = props;
|
|
67
81
|
const { customColumnList } = reactData;
|
|
68
82
|
const { oldSortMaps, oldFixedMaps, oldVisibleMaps } = customStore;
|
|
83
|
+
const customOpts = computeCustomOpts.value;
|
|
84
|
+
const { allowVisible, allowSort, allowFixed, allowResizable } = customOpts;
|
|
69
85
|
XEUtils.eachTree(customColumnList, column => {
|
|
70
86
|
const colid = column.getKey();
|
|
71
87
|
const visible = !!oldVisibleMaps[colid];
|
|
72
88
|
const fixed = oldFixedMaps[colid] || '';
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
89
|
+
if (allowVisible) {
|
|
90
|
+
column.renderVisible = visible;
|
|
91
|
+
column.visible = visible;
|
|
92
|
+
}
|
|
93
|
+
if (allowFixed) {
|
|
94
|
+
column.renderFixed = fixed;
|
|
95
|
+
column.fixed = fixed;
|
|
96
|
+
}
|
|
97
|
+
if (allowSort) {
|
|
98
|
+
column.renderSortNumber = oldSortMaps[colid] || 0;
|
|
99
|
+
}
|
|
100
|
+
if (allowResizable) {
|
|
101
|
+
column.renderResizeWidth = column.renderWidth;
|
|
102
|
+
}
|
|
78
103
|
}, { children: 'children' });
|
|
79
104
|
$xeTable.closeCustom();
|
|
80
105
|
$xeTable.emitCustomEvent('cancel', evnt);
|
|
@@ -83,7 +108,7 @@ export default defineComponent({
|
|
|
83
108
|
$xeTable.resetColumn(true);
|
|
84
109
|
$xeTable.closeCustom();
|
|
85
110
|
$xeTable.emitCustomEvent('reset', evnt);
|
|
86
|
-
handleSaveStore('
|
|
111
|
+
handleSaveStore('reset');
|
|
87
112
|
};
|
|
88
113
|
const resetCustomEvent = (evnt) => {
|
|
89
114
|
if (VxeUI.modal) {
|
|
@@ -263,7 +288,7 @@ export default defineComponent({
|
|
|
263
288
|
const { customColumnList } = reactData;
|
|
264
289
|
const customOpts = computeCustomOpts.value;
|
|
265
290
|
const { maxHeight } = customStore;
|
|
266
|
-
const { checkMethod, visibleMethod, allowSort, allowFixed, trigger } = customOpts;
|
|
291
|
+
const { checkMethod, visibleMethod, allowVisible, allowSort, allowFixed, trigger, placement } = customOpts;
|
|
267
292
|
const isMaxFixedColumn = computeIsMaxFixedColumn.value;
|
|
268
293
|
const colVNs = [];
|
|
269
294
|
const customWrapperOns = {};
|
|
@@ -290,23 +315,25 @@ export default defineComponent({
|
|
|
290
315
|
onDragend: sortDragendEvent,
|
|
291
316
|
onDragover: sortDragoverEvent
|
|
292
317
|
}, [
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
318
|
+
allowVisible
|
|
319
|
+
? h('div', {
|
|
320
|
+
class: ['vxe-table-custom--checkbox-option', {
|
|
321
|
+
'is--checked': isChecked,
|
|
322
|
+
'is--indeterminate': isIndeterminate,
|
|
323
|
+
'is--disabled': isDisabled
|
|
324
|
+
}],
|
|
325
|
+
title: getI18n('vxe.custom.setting.colVisible'),
|
|
326
|
+
onClick: () => {
|
|
327
|
+
if (!isDisabled) {
|
|
328
|
+
changeCheckboxOption(column);
|
|
329
|
+
}
|
|
303
330
|
}
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
331
|
+
}, [
|
|
332
|
+
h('span', {
|
|
333
|
+
class: ['vxe-checkbox--icon', isIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
|
|
334
|
+
})
|
|
335
|
+
])
|
|
336
|
+
: createCommentVNode(),
|
|
310
337
|
allowSort && column.level === 1
|
|
311
338
|
? h('div', {
|
|
312
339
|
class: 'vxe-table-custom--sort-option'
|
|
@@ -361,9 +388,14 @@ export default defineComponent({
|
|
|
361
388
|
return h('div', {
|
|
362
389
|
ref: refElem,
|
|
363
390
|
key: 'simple',
|
|
364
|
-
class: ['vxe-table-custom-wrapper', {
|
|
391
|
+
class: ['vxe-table-custom-wrapper', `placement--${placement}`, {
|
|
365
392
|
'is--active': customStore.visible
|
|
366
|
-
}]
|
|
393
|
+
}],
|
|
394
|
+
style: maxHeight && !['left', 'right'].includes(placement)
|
|
395
|
+
? {
|
|
396
|
+
maxHeight: `${maxHeight}px`
|
|
397
|
+
}
|
|
398
|
+
: {}
|
|
367
399
|
}, customStore.visible
|
|
368
400
|
? [
|
|
369
401
|
h('ul', {
|
|
@@ -372,32 +404,32 @@ export default defineComponent({
|
|
|
372
404
|
h('li', {
|
|
373
405
|
class: 'vxe-table-custom--option'
|
|
374
406
|
}, [
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
407
|
+
allowVisible
|
|
408
|
+
? h('div', {
|
|
409
|
+
class: ['vxe-table-custom--checkbox-option', {
|
|
410
|
+
'is--checked': isAllChecked,
|
|
411
|
+
'is--indeterminate': isAllIndeterminate
|
|
412
|
+
}],
|
|
413
|
+
title: getI18n('vxe.table.allTitle'),
|
|
414
|
+
onClick: allCustomEvent
|
|
415
|
+
}, [
|
|
416
|
+
h('span', {
|
|
417
|
+
class: ['vxe-checkbox--icon', isAllIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isAllChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
|
|
418
|
+
}),
|
|
419
|
+
h('span', {
|
|
420
|
+
class: 'vxe-checkbox--label'
|
|
421
|
+
}, getI18n('vxe.toolbar.customAll'))
|
|
422
|
+
])
|
|
423
|
+
: h('span', {
|
|
387
424
|
class: 'vxe-checkbox--label'
|
|
388
|
-
}, getI18n('vxe.
|
|
389
|
-
])
|
|
425
|
+
}, getI18n('vxe.table.customTitle'))
|
|
390
426
|
])
|
|
391
427
|
]),
|
|
392
428
|
h('div', {
|
|
393
429
|
ref: bodyElemRef,
|
|
394
430
|
class: 'vxe-table-custom--list-wrapper'
|
|
395
431
|
}, [
|
|
396
|
-
h(TransitionGroup, Object.assign({ class: 'vxe-table-custom--body', name: 'vxe-table-custom--list', tag: 'ul',
|
|
397
|
-
? {
|
|
398
|
-
maxHeight: `${maxHeight}px`
|
|
399
|
-
}
|
|
400
|
-
: {} }, customWrapperOns), {
|
|
432
|
+
h(TransitionGroup, Object.assign({ class: 'vxe-table-custom--body', name: 'vxe-table-custom--list', tag: 'ul' }, customWrapperOns), {
|
|
401
433
|
default: () => colVNs
|
|
402
434
|
}),
|
|
403
435
|
h('div', {
|
|
@@ -432,7 +464,7 @@ export default defineComponent({
|
|
|
432
464
|
const { customStore } = props;
|
|
433
465
|
const { customColumnList } = reactData;
|
|
434
466
|
const customOpts = computeCustomOpts.value;
|
|
435
|
-
const { allowSort, allowFixed, checkMethod, visibleMethod } = customOpts;
|
|
467
|
+
const { allowVisible, allowSort, allowFixed, allowResizable, checkMethod, visibleMethod } = customOpts;
|
|
436
468
|
const columnOpts = computeColumnOpts.value;
|
|
437
469
|
const isMaxFixedColumn = computeIsMaxFixedColumn.value;
|
|
438
470
|
const trVNs = [];
|
|
@@ -454,27 +486,29 @@ export default defineComponent({
|
|
|
454
486
|
onDragend: sortDragendEvent,
|
|
455
487
|
onDragover: sortDragoverEvent
|
|
456
488
|
}, [
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
h('div', {
|
|
461
|
-
class: ['vxe-table-custom--checkbox-option', {
|
|
462
|
-
'is--checked': isChecked,
|
|
463
|
-
'is--indeterminate': isIndeterminate,
|
|
464
|
-
'is--disabled': isDisabled
|
|
465
|
-
}],
|
|
466
|
-
title: getI18n('vxe.custom.setting.colVisible'),
|
|
467
|
-
onClick: () => {
|
|
468
|
-
if (!isDisabled) {
|
|
469
|
-
changeCheckboxOption(column);
|
|
470
|
-
}
|
|
471
|
-
}
|
|
489
|
+
allowVisible
|
|
490
|
+
? h('td', {
|
|
491
|
+
class: 'vxe-table-custom-popup--column-item col--visible'
|
|
472
492
|
}, [
|
|
473
|
-
h('
|
|
474
|
-
class: ['vxe-checkbox
|
|
475
|
-
|
|
493
|
+
h('div', {
|
|
494
|
+
class: ['vxe-table-custom--checkbox-option', {
|
|
495
|
+
'is--checked': isChecked,
|
|
496
|
+
'is--indeterminate': isIndeterminate,
|
|
497
|
+
'is--disabled': isDisabled
|
|
498
|
+
}],
|
|
499
|
+
title: getI18n('vxe.custom.setting.colVisible'),
|
|
500
|
+
onClick: () => {
|
|
501
|
+
if (!isDisabled) {
|
|
502
|
+
changeCheckboxOption(column);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
}, [
|
|
506
|
+
h('span', {
|
|
507
|
+
class: ['vxe-checkbox--icon', isIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
|
|
508
|
+
})
|
|
509
|
+
])
|
|
476
510
|
])
|
|
477
|
-
|
|
511
|
+
: createCommentVNode(),
|
|
478
512
|
allowSort
|
|
479
513
|
? h('td', {
|
|
480
514
|
class: 'vxe-table-custom-popup--column-item col--sort'
|
|
@@ -490,7 +524,7 @@ export default defineComponent({
|
|
|
490
524
|
class: getIcon().TABLE_CUSTOM_SORT
|
|
491
525
|
})
|
|
492
526
|
])
|
|
493
|
-
:
|
|
527
|
+
: h('span', '-')
|
|
494
528
|
])
|
|
495
529
|
: createCommentVNode(),
|
|
496
530
|
h('td', {
|
|
@@ -501,12 +535,29 @@ export default defineComponent({
|
|
|
501
535
|
title: colTitle
|
|
502
536
|
}, colTitle)
|
|
503
537
|
]),
|
|
538
|
+
allowResizable
|
|
539
|
+
? h('td', {
|
|
540
|
+
class: 'vxe-table-custom-popup--column-item col--resizable'
|
|
541
|
+
}, [
|
|
542
|
+
!isChecked || (column.children && column.children.length)
|
|
543
|
+
? h('span', '-')
|
|
544
|
+
: h(resolveComponent('vxe-input'), {
|
|
545
|
+
type: 'integer',
|
|
546
|
+
min: 40,
|
|
547
|
+
modelValue: column.renderResizeWidth,
|
|
548
|
+
'onUpdate:modelValue'(value) {
|
|
549
|
+
column.renderResizeWidth = Math.max(40, Number(value));
|
|
550
|
+
}
|
|
551
|
+
})
|
|
552
|
+
])
|
|
553
|
+
: createCommentVNode(),
|
|
504
554
|
allowFixed
|
|
505
555
|
? h('td', {
|
|
506
556
|
class: 'vxe-table-custom-popup--column-item col--fixed'
|
|
507
557
|
}, [
|
|
508
|
-
|
|
509
|
-
? h(
|
|
558
|
+
parent
|
|
559
|
+
? h('span', '-')
|
|
560
|
+
: h(resolveComponent('vxe-radio-group'), {
|
|
510
561
|
modelValue: column.renderFixed || '',
|
|
511
562
|
type: 'button',
|
|
512
563
|
size: 'mini',
|
|
@@ -522,7 +573,6 @@ export default defineComponent({
|
|
|
522
573
|
// changePopupFixedOption(column)
|
|
523
574
|
// }
|
|
524
575
|
})
|
|
525
|
-
: null
|
|
526
576
|
])
|
|
527
577
|
: createCommentVNode()
|
|
528
578
|
]));
|
|
@@ -535,10 +585,10 @@ export default defineComponent({
|
|
|
535
585
|
className: 'vxe-table-custom-popup-wrapper vxe-table--ignore-clear',
|
|
536
586
|
modelValue: customStore.visible,
|
|
537
587
|
title: getI18n('vxe.custom.cstmTitle'),
|
|
538
|
-
width:
|
|
539
|
-
minWidth:
|
|
540
|
-
height:
|
|
541
|
-
minHeight:
|
|
588
|
+
width: 700,
|
|
589
|
+
minWidth: 700,
|
|
590
|
+
height: 400,
|
|
591
|
+
minHeight: 400,
|
|
542
592
|
mask: true,
|
|
543
593
|
lockView: true,
|
|
544
594
|
showFooter: true,
|
|
@@ -559,11 +609,13 @@ export default defineComponent({
|
|
|
559
609
|
}, [
|
|
560
610
|
h('table', {}, [
|
|
561
611
|
h('colgroup', {}, [
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
612
|
+
allowVisible
|
|
613
|
+
? h('col', {
|
|
614
|
+
style: {
|
|
615
|
+
width: '80px'
|
|
616
|
+
}
|
|
617
|
+
})
|
|
618
|
+
: createCommentVNode(),
|
|
567
619
|
allowSort
|
|
568
620
|
? h('col', {
|
|
569
621
|
style: {
|
|
@@ -576,6 +628,13 @@ export default defineComponent({
|
|
|
576
628
|
minWidth: '120px'
|
|
577
629
|
}
|
|
578
630
|
}),
|
|
631
|
+
allowResizable
|
|
632
|
+
? h('col', {
|
|
633
|
+
style: {
|
|
634
|
+
width: '140px'
|
|
635
|
+
}
|
|
636
|
+
})
|
|
637
|
+
: createCommentVNode(),
|
|
579
638
|
allowFixed
|
|
580
639
|
? h('col', {
|
|
581
640
|
style: {
|
|
@@ -586,23 +645,25 @@ export default defineComponent({
|
|
|
586
645
|
]),
|
|
587
646
|
h('thead', {}, [
|
|
588
647
|
h('tr', {}, [
|
|
589
|
-
|
|
590
|
-
h('
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
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
|
+
])
|
|
604
665
|
])
|
|
605
|
-
|
|
666
|
+
: createCommentVNode(),
|
|
606
667
|
allowSort
|
|
607
668
|
? h('th', {}, [
|
|
608
669
|
h('span', {
|
|
@@ -621,6 +682,9 @@ export default defineComponent({
|
|
|
621
682
|
])
|
|
622
683
|
: createCommentVNode(),
|
|
623
684
|
h('th', {}, getI18n('vxe.custom.setting.colTitle')),
|
|
685
|
+
allowResizable
|
|
686
|
+
? h('th', {}, getI18n('vxe.custom.setting.colResizable'))
|
|
687
|
+
: createCommentVNode(),
|
|
624
688
|
allowFixed
|
|
625
689
|
? h('th', {}, getI18n('vxe.custom.setting.colFixed', [columnOpts.maxFixedSize || 0]))
|
|
626
690
|
: createCommentVNode()
|
|
@@ -4,7 +4,8 @@ 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
|
-
|
|
7
|
+
import { warnLog, errLog } from '../../../ui/src/log';
|
|
8
|
+
const { getConfig, renderer, hooks, getI18n } = VxeUI;
|
|
8
9
|
const tableEditMethodKeys = ['insert', 'insertAt', 'insertNextAt', 'remove', 'removeCheckboxRow', 'removeRadioRow', 'removeCurrentRow', 'getRecordset', 'getInsertRecords', 'getRemoveRecords', 'getUpdateRecords', 'getEditRecord', 'getActiveRecord', 'getSelectedCell', 'clearEdit', 'clearActived', 'clearSelected', 'isEditByRow', 'isActiveByRow', 'setEditRow', 'setActiveRow', 'setEditCell', 'setActiveCell', 'setSelectCell'];
|
|
9
10
|
hooks.add('tableEditModule', {
|
|
10
11
|
setupTable($xeTable) {
|
|
@@ -82,7 +83,7 @@ hooks.add('tableEditModule', {
|
|
|
82
83
|
else {
|
|
83
84
|
if (process.env.NODE_ENV === 'development') {
|
|
84
85
|
if (parentRowId) {
|
|
85
|
-
|
|
86
|
+
warnLog('vxe.error.unableInsert');
|
|
86
87
|
}
|
|
87
88
|
}
|
|
88
89
|
afterFullData[funcName](item);
|
|
@@ -153,7 +154,7 @@ hooks.add('tableEditModule', {
|
|
|
153
154
|
if (process.env.NODE_ENV === 'development') {
|
|
154
155
|
if (item[treeOpts.parentField]) {
|
|
155
156
|
if (parentRow && item[treeOpts.parentField] !== parentRow[rowField]) {
|
|
156
|
-
|
|
157
|
+
errLog('vxe.error.errProp', [`${treeOpts.parentField}=${item[treeOpts.parentField]}`, `${treeOpts.parentField}=${parentRow[rowField]}`]);
|
|
157
158
|
}
|
|
158
159
|
}
|
|
159
160
|
}
|
|
@@ -184,7 +185,7 @@ hooks.add('tableEditModule', {
|
|
|
184
185
|
}
|
|
185
186
|
else {
|
|
186
187
|
if (process.env.NODE_ENV === 'development') {
|
|
187
|
-
|
|
188
|
+
warnLog('vxe.error.unableInsert');
|
|
188
189
|
}
|
|
189
190
|
insertTreeRow(newRecords, true);
|
|
190
191
|
}
|
|
@@ -208,7 +209,7 @@ hooks.add('tableEditModule', {
|
|
|
208
209
|
afIndex = Math.min(afterFullData.length, afIndex + 1);
|
|
209
210
|
}
|
|
210
211
|
if (afIndex === -1) {
|
|
211
|
-
throw new Error(
|
|
212
|
+
throw new Error(getI18n('vxe.error.unableInsert'));
|
|
212
213
|
}
|
|
213
214
|
afterFullData.splice(afIndex, 0, ...newRecords);
|
|
214
215
|
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.NODE_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.NODE_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.NODE_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.NODE_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.NODE_ENV === 'development') {
|
|
593
|
-
|
|
594
|
+
warnLog('vxe.error.delFunc', ['setActiveCell', 'setEditCell']);
|
|
594
595
|
}
|
|
595
596
|
// 即将废弃
|
|
596
597
|
return editMethods.setEditCell(row, fieldOrColumn);
|
|
@@ -4,7 +4,8 @@ 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
|
-
|
|
7
|
+
import { warnLog, errLog } from '../../../ui/src/log';
|
|
8
|
+
const { getI18n, hooks, renderer } = VxeUI;
|
|
8
9
|
let htmlCellElem;
|
|
9
10
|
const csvBOM = '\ufeff';
|
|
10
11
|
const enterSymbol = '\r\n';
|
|
@@ -851,7 +852,7 @@ hooks.add('tableExportModule', {
|
|
|
851
852
|
$xeTable.preventEvent(null, 'event.import', { file, options, columns: tableFullColumn }, () => {
|
|
852
853
|
const reader = new FileReader();
|
|
853
854
|
reader.onerror = () => {
|
|
854
|
-
|
|
855
|
+
errLog('vxe.error.notType', [type]);
|
|
855
856
|
_importReject({ status: false });
|
|
856
857
|
};
|
|
857
858
|
reader.onload = (e) => {
|
|
@@ -864,7 +865,7 @@ hooks.add('tableExportModule', {
|
|
|
864
865
|
else {
|
|
865
866
|
// 不支持的浏览器
|
|
866
867
|
if (process.env.NODE_ENV === 'development') {
|
|
867
|
-
|
|
868
|
+
errLog('vxe.error.notExp');
|
|
868
869
|
}
|
|
869
870
|
_importResolve({ status: true });
|
|
870
871
|
}
|
|
@@ -1077,7 +1078,7 @@ hooks.add('tableExportModule', {
|
|
|
1077
1078
|
// 检查类型,如果为自定义导出,则不需要校验类型
|
|
1078
1079
|
if (!opts.exportMethod && !XEUtils.includes(XEUtils.keys(exportOpts._typeMaps), type)) {
|
|
1079
1080
|
if (process.env.NODE_ENV === 'development') {
|
|
1080
|
-
|
|
1081
|
+
errLog('vxe.error.notType', [type]);
|
|
1081
1082
|
}
|
|
1082
1083
|
const params = { status: false };
|
|
1083
1084
|
return Promise.reject(params);
|
|
@@ -1101,7 +1102,7 @@ hooks.add('tableExportModule', {
|
|
|
1101
1102
|
else if (mode === 'all') {
|
|
1102
1103
|
if (process.env.NODE_ENV === 'development') {
|
|
1103
1104
|
if (!$xeGrid) {
|
|
1104
|
-
|
|
1105
|
+
warnLog('vxe.error.errProp', ['all', 'mode=current,selected']);
|
|
1105
1106
|
}
|
|
1106
1107
|
}
|
|
1107
1108
|
if ($xeGrid && !opts.remote) {
|
|
@@ -1112,7 +1113,7 @@ hooks.add('tableExportModule', {
|
|
|
1112
1113
|
const ajaxMethods = ajax.queryAll;
|
|
1113
1114
|
if (process.env.NODE_ENV === 'development') {
|
|
1114
1115
|
if (!ajaxMethods) {
|
|
1115
|
-
|
|
1116
|
+
warnLog('vxe.error.notFunc', ['proxy-config.ajax.queryAll']);
|
|
1116
1117
|
}
|
|
1117
1118
|
}
|
|
1118
1119
|
if (ajaxMethods) {
|
|
@@ -1193,13 +1194,15 @@ hooks.add('tableExportModule', {
|
|
|
1193
1194
|
if (VxeUI.print) {
|
|
1194
1195
|
if (opts.content) {
|
|
1195
1196
|
resolve(VxeUI.print({
|
|
1196
|
-
|
|
1197
|
+
title: opts.sheetName,
|
|
1198
|
+
html: opts.content
|
|
1197
1199
|
}));
|
|
1198
1200
|
}
|
|
1199
1201
|
else {
|
|
1200
1202
|
resolve(exportMethods.exportData(opts).then(({ content }) => {
|
|
1201
1203
|
return VxeUI.print({
|
|
1202
|
-
|
|
1204
|
+
title: opts.sheetName,
|
|
1205
|
+
html: content
|
|
1203
1206
|
});
|
|
1204
1207
|
}));
|
|
1205
1208
|
}
|
|
@@ -1210,6 +1213,23 @@ hooks.add('tableExportModule', {
|
|
|
1210
1213
|
}
|
|
1211
1214
|
});
|
|
1212
1215
|
},
|
|
1216
|
+
getPrintHtml(options) {
|
|
1217
|
+
const printOpts = computePrintOpts.value;
|
|
1218
|
+
const opts = Object.assign({
|
|
1219
|
+
original: false
|
|
1220
|
+
// beforePrintMethod
|
|
1221
|
+
}, printOpts, options, {
|
|
1222
|
+
type: 'html',
|
|
1223
|
+
download: false,
|
|
1224
|
+
remote: false,
|
|
1225
|
+
print: true
|
|
1226
|
+
});
|
|
1227
|
+
return exportMethods.exportData(opts).then(({ content }) => {
|
|
1228
|
+
return {
|
|
1229
|
+
html: content
|
|
1230
|
+
};
|
|
1231
|
+
});
|
|
1232
|
+
},
|
|
1213
1233
|
openImport(options) {
|
|
1214
1234
|
const { treeConfig, importConfig } = props;
|
|
1215
1235
|
const { initStore, importStore, importParams } = reactData;
|
|
@@ -1226,7 +1246,7 @@ hooks.add('tableExportModule', {
|
|
|
1226
1246
|
return;
|
|
1227
1247
|
}
|
|
1228
1248
|
if (!importConfig) {
|
|
1229
|
-
|
|
1249
|
+
errLog('vxe.error.reqProp', ['import-config']);
|
|
1230
1250
|
}
|
|
1231
1251
|
// 处理类型
|
|
1232
1252
|
const typeList = types.map((value) => {
|
|
@@ -1256,7 +1276,7 @@ hooks.add('tableExportModule', {
|
|
|
1256
1276
|
const exportOpts = computeExportOpts.value;
|
|
1257
1277
|
if (process.env.NODE_ENV === 'development') {
|
|
1258
1278
|
if (!props.exportConfig) {
|
|
1259
|
-
|
|
1279
|
+
errLog('vxe.error.reqProp', ['export-config']);
|
|
1260
1280
|
}
|
|
1261
1281
|
}
|
|
1262
1282
|
handleExportAndPrint(Object.assign({}, exportOpts, options));
|
|
@@ -1265,7 +1285,7 @@ hooks.add('tableExportModule', {
|
|
|
1265
1285
|
const printOpts = computePrintOpts.value;
|
|
1266
1286
|
if (process.env.NODE_ENV === 'development') {
|
|
1267
1287
|
if (!props.printConfig) {
|
|
1268
|
-
|
|
1288
|
+
errLog('vxe.error.reqProp', ['print-config']);
|
|
1269
1289
|
}
|
|
1270
1290
|
}
|
|
1271
1291
|
handleExportAndPrint(Object.assign({}, printOpts, options), true);
|