vxe-table 4.12.0-beta.1 → 4.12.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.
- package/es/grid/src/grid.js +16 -32
- package/es/style.css +1 -1
- package/es/table/module/custom/panel.js +19 -21
- package/es/table/module/export/export-panel.js +17 -19
- package/es/table/module/export/hook.js +5 -11
- package/es/table/module/export/import-panel.js +11 -13
- package/es/table/module/validator/hook.js +1 -3
- package/es/table/render/index.js +81 -61
- package/es/table/src/columnInfo.js +26 -28
- package/es/table/src/table.js +115 -98
- package/es/toolbar/src/toolbar.js +16 -24
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/grid/src/grid.js +16 -32
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +332 -321
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/module/custom/panel.js +21 -23
- package/lib/table/module/custom/panel.min.js +1 -1
- package/lib/table/module/export/export-panel.js +17 -19
- package/lib/table/module/export/export-panel.min.js +1 -1
- package/lib/table/module/export/hook.js +5 -11
- package/lib/table/module/export/hook.min.js +1 -1
- package/lib/table/module/export/import-panel.js +11 -13
- package/lib/table/module/export/import-panel.min.js +1 -1
- package/lib/table/module/validator/hook.js +1 -3
- package/lib/table/module/validator/hook.min.js +1 -1
- package/lib/table/render/index.js +87 -67
- package/lib/table/render/index.min.js +1 -1
- package/lib/table/src/columnInfo.js +30 -32
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/table.js +122 -95
- package/lib/table/src/table.min.js +1 -1
- package/lib/toolbar/src/toolbar.js +16 -24
- package/lib/toolbar/src/toolbar.min.js +1 -1
- package/lib/ui/index.js +1 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/package.json +2 -2
- package/packages/grid/src/grid.ts +17 -32
- package/packages/table/module/custom/panel.ts +19 -21
- package/packages/table/module/export/export-panel.ts +17 -19
- package/packages/table/module/export/hook.ts +5 -11
- package/packages/table/module/export/import-panel.ts +11 -13
- package/packages/table/module/validator/hook.ts +1 -3
- package/packages/table/render/index.ts +80 -59
- package/packages/table/src/columnInfo.ts +26 -28
- package/packages/table/src/table.ts +113 -95
- package/packages/toolbar/src/toolbar.ts +16 -24
- /package/es/{iconfont.1741051902838.ttf → iconfont.1741160677181.ttf} +0 -0
- /package/es/{iconfont.1741051902838.woff → iconfont.1741160677181.woff} +0 -0
- /package/es/{iconfont.1741051902838.woff2 → iconfont.1741160677181.woff2} +0 -0
- /package/lib/{iconfont.1741051902838.ttf → iconfont.1741160677181.ttf} +0 -0
- /package/lib/{iconfont.1741051902838.woff → iconfont.1741160677181.woff} +0 -0
- /package/lib/{iconfont.1741051902838.woff2 → iconfont.1741160677181.woff2} +0 -0
|
@@ -493,25 +493,23 @@ export default defineComponent({
|
|
|
493
493
|
})
|
|
494
494
|
: createCommentVNode();
|
|
495
495
|
};
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
});
|
|
514
|
-
}
|
|
496
|
+
nextTick(() => {
|
|
497
|
+
if (!VxeUIModalComponent) {
|
|
498
|
+
errLog('vxe.error.reqComp', ['vxe-modal']);
|
|
499
|
+
}
|
|
500
|
+
if (!VxeUIButtonComponent) {
|
|
501
|
+
errLog('vxe.error.reqComp', ['vxe-button']);
|
|
502
|
+
}
|
|
503
|
+
if (!VxeUISelectComponent) {
|
|
504
|
+
errLog('vxe.error.reqComp', ['vxe-select']);
|
|
505
|
+
}
|
|
506
|
+
if (!VxeUIInputComponent) {
|
|
507
|
+
errLog('vxe.error.reqComp', ['vxe-input']);
|
|
508
|
+
}
|
|
509
|
+
if (!VxeUICheckboxComponent) {
|
|
510
|
+
errLog('vxe.error.reqComp', ['vxe-checkbox']);
|
|
511
|
+
}
|
|
512
|
+
});
|
|
515
513
|
return renderVN;
|
|
516
514
|
}
|
|
517
515
|
});
|
|
@@ -893,9 +893,7 @@ hooks.add('tableExportModule', {
|
|
|
893
893
|
}
|
|
894
894
|
else {
|
|
895
895
|
// 不支持的浏览器
|
|
896
|
-
|
|
897
|
-
errLog('vxe.error.notExp');
|
|
898
|
-
}
|
|
896
|
+
errLog('vxe.error.notExp');
|
|
899
897
|
_importResolve({ status: true });
|
|
900
898
|
}
|
|
901
899
|
});
|
|
@@ -1512,10 +1510,8 @@ hooks.add('tableExportModule', {
|
|
|
1512
1510
|
message: true,
|
|
1513
1511
|
types: XEUtils.keys(exportOpts._typeMaps)
|
|
1514
1512
|
}, exportOpts, options);
|
|
1515
|
-
if (
|
|
1516
|
-
|
|
1517
|
-
errLog('vxe.error.reqProp', ['export-config']);
|
|
1518
|
-
}
|
|
1513
|
+
if (!props.exportConfig) {
|
|
1514
|
+
errLog('vxe.error.reqProp', ['export-config']);
|
|
1519
1515
|
}
|
|
1520
1516
|
handleExportAndPrint(defOpts);
|
|
1521
1517
|
},
|
|
@@ -1525,10 +1521,8 @@ hooks.add('tableExportModule', {
|
|
|
1525
1521
|
const defOpts = Object.assign({
|
|
1526
1522
|
message: true
|
|
1527
1523
|
}, printOpts, options);
|
|
1528
|
-
if (
|
|
1529
|
-
|
|
1530
|
-
errLog('vxe.error.reqProp', ['print-config']);
|
|
1531
|
-
}
|
|
1524
|
+
if (!props.printConfig) {
|
|
1525
|
+
errLog('vxe.error.reqProp', ['print-config']);
|
|
1532
1526
|
}
|
|
1533
1527
|
handleExportAndPrint(defOpts, true);
|
|
1534
1528
|
}
|
|
@@ -218,19 +218,17 @@ export default defineComponent({
|
|
|
218
218
|
})
|
|
219
219
|
: createCommentVNode();
|
|
220
220
|
};
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
});
|
|
233
|
-
}
|
|
221
|
+
nextTick(() => {
|
|
222
|
+
if (!VxeUIModalComponent) {
|
|
223
|
+
errLog('vxe.error.reqComp', ['vxe-modal']);
|
|
224
|
+
}
|
|
225
|
+
if (!VxeUIButtonComponent) {
|
|
226
|
+
errLog('vxe.error.reqComp', ['vxe-button']);
|
|
227
|
+
}
|
|
228
|
+
if (!VxeUISelectComponent) {
|
|
229
|
+
errLog('vxe.error.reqComp', ['vxe-select']);
|
|
230
|
+
}
|
|
231
|
+
});
|
|
234
232
|
return renderVN;
|
|
235
233
|
}
|
|
236
234
|
});
|
package/es/table/render/index.js
CHANGED
|
@@ -152,10 +152,8 @@ function getComponentOns(renderOpts, params, eFns) {
|
|
|
152
152
|
const ons = {};
|
|
153
153
|
XEUtils.objectEach(events, (func, key) => {
|
|
154
154
|
ons[getOnName(key)] = function (...args) {
|
|
155
|
-
if (
|
|
156
|
-
|
|
157
|
-
errLog('vxe.error.errFunc', [func]);
|
|
158
|
-
}
|
|
155
|
+
if (!XEUtils.isFunction(func)) {
|
|
156
|
+
errLog('vxe.error.errFunc', [func]);
|
|
159
157
|
}
|
|
160
158
|
func(params, ...args);
|
|
161
159
|
};
|
|
@@ -502,6 +500,63 @@ function handleExportTreeSelectMethod(params) {
|
|
|
502
500
|
const { row, column, options } = params;
|
|
503
501
|
return options.original ? getCellValue(row, column) : getTreeSelectCellValue(column.editRender || column.cellRender, params);
|
|
504
502
|
}
|
|
503
|
+
function handleNumberCell(renderOpts, params) {
|
|
504
|
+
const { props = {}, showNegativeStatus } = renderOpts;
|
|
505
|
+
const { row, column } = params;
|
|
506
|
+
const { type } = props;
|
|
507
|
+
let cellValue = XEUtils.get(row, column.field);
|
|
508
|
+
let isNegative = false;
|
|
509
|
+
if (!isEmptyValue(cellValue)) {
|
|
510
|
+
const numberInputConfig = getConfig().numberInput || {};
|
|
511
|
+
if (type === 'float') {
|
|
512
|
+
const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
|
|
513
|
+
const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 1);
|
|
514
|
+
cellValue = XEUtils.toFixed(XEUtils.floor(cellValue, digits), digits);
|
|
515
|
+
if (!autoFill) {
|
|
516
|
+
cellValue = XEUtils.toNumber(cellValue);
|
|
517
|
+
}
|
|
518
|
+
if (showNegativeStatus) {
|
|
519
|
+
if (cellValue < 0) {
|
|
520
|
+
isNegative = true;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
else if (type === 'amount') {
|
|
525
|
+
const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
|
|
526
|
+
const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 2);
|
|
527
|
+
const showCurrency = handleDefaultValue(props.showCurrency, numberInputConfig.showCurrency, false);
|
|
528
|
+
cellValue = XEUtils.toNumber(cellValue);
|
|
529
|
+
if (showNegativeStatus) {
|
|
530
|
+
if (cellValue < 0) {
|
|
531
|
+
isNegative = true;
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
cellValue = XEUtils.commafy(cellValue, { digits });
|
|
535
|
+
if (!autoFill) {
|
|
536
|
+
const [iStr, dStr] = cellValue.split('.');
|
|
537
|
+
if (dStr) {
|
|
538
|
+
const dRest = dStr.replace(/0+$/, '');
|
|
539
|
+
cellValue = dRest ? [iStr, '.', dRest].join('') : iStr;
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
if (showCurrency) {
|
|
543
|
+
cellValue = `${props.currencySymbol || numberInputConfig.currencySymbol || getI18n('vxe.numberInput.currencySymbol') || ''}${cellValue}`;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
else {
|
|
547
|
+
if (showNegativeStatus) {
|
|
548
|
+
if (XEUtils.toNumber(cellValue) < 0) {
|
|
549
|
+
isNegative = true;
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
return getCellLabelVNs(renderOpts, params, cellValue, isNegative
|
|
555
|
+
? {
|
|
556
|
+
class: 'is--negative'
|
|
557
|
+
}
|
|
558
|
+
: {});
|
|
559
|
+
}
|
|
505
560
|
/**
|
|
506
561
|
* 表格 - 渲染器
|
|
507
562
|
*/
|
|
@@ -561,66 +616,13 @@ renderer.mixin({
|
|
|
561
616
|
renderTableFilter: defaultFilterRender,
|
|
562
617
|
tableFilterDefaultMethod: handleInputFilterMethod
|
|
563
618
|
},
|
|
619
|
+
FormatNumberInput: {
|
|
620
|
+
renderTableDefault: handleNumberCell
|
|
621
|
+
},
|
|
564
622
|
VxeNumberInput: {
|
|
565
623
|
tableAutoFocus: 'input',
|
|
566
624
|
renderTableEdit: defaultEditRender,
|
|
567
|
-
renderTableCell
|
|
568
|
-
const { props = {}, showNegativeStatus } = renderOpts;
|
|
569
|
-
const { row, column } = params;
|
|
570
|
-
const { type } = props;
|
|
571
|
-
let cellValue = XEUtils.get(row, column.field);
|
|
572
|
-
let isNegative = false;
|
|
573
|
-
if (!isEmptyValue(cellValue)) {
|
|
574
|
-
const numberInputConfig = getConfig().numberInput || {};
|
|
575
|
-
if (type === 'float') {
|
|
576
|
-
const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
|
|
577
|
-
const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 1);
|
|
578
|
-
cellValue = XEUtils.toFixed(XEUtils.floor(cellValue, digits), digits);
|
|
579
|
-
if (!autoFill) {
|
|
580
|
-
cellValue = XEUtils.toNumber(cellValue);
|
|
581
|
-
}
|
|
582
|
-
if (showNegativeStatus) {
|
|
583
|
-
if (cellValue < 0) {
|
|
584
|
-
isNegative = true;
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
else if (type === 'amount') {
|
|
589
|
-
const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
|
|
590
|
-
const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 2);
|
|
591
|
-
const showCurrency = handleDefaultValue(props.showCurrency, numberInputConfig.showCurrency, false);
|
|
592
|
-
cellValue = XEUtils.toNumber(cellValue);
|
|
593
|
-
if (showNegativeStatus) {
|
|
594
|
-
if (cellValue < 0) {
|
|
595
|
-
isNegative = true;
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
cellValue = XEUtils.commafy(cellValue, { digits });
|
|
599
|
-
if (!autoFill) {
|
|
600
|
-
const [iStr, dStr] = cellValue.split('.');
|
|
601
|
-
if (dStr) {
|
|
602
|
-
const dRest = dStr.replace(/0+$/, '');
|
|
603
|
-
cellValue = dRest ? [iStr, '.', dRest].join('') : iStr;
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
if (showCurrency) {
|
|
607
|
-
cellValue = `${props.currencySymbol || numberInputConfig.currencySymbol || getI18n('vxe.numberInput.currencySymbol') || ''}${cellValue}`;
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
else {
|
|
611
|
-
if (showNegativeStatus) {
|
|
612
|
-
if (XEUtils.toNumber(cellValue) < 0) {
|
|
613
|
-
isNegative = true;
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
return getCellLabelVNs(renderOpts, params, cellValue, isNegative
|
|
619
|
-
? {
|
|
620
|
-
class: 'is--negative'
|
|
621
|
-
}
|
|
622
|
-
: {});
|
|
623
|
-
},
|
|
625
|
+
renderTableCell: handleNumberCell,
|
|
624
626
|
renderTableFooter(renderOpts, params) {
|
|
625
627
|
const { props = {} } = renderOpts;
|
|
626
628
|
const { row, column, _columnIndex } = params;
|
|
@@ -723,11 +725,20 @@ renderer.mixin({
|
|
|
723
725
|
tableFilterDefaultMethod: handleFilterMethod,
|
|
724
726
|
tableExportMethod: handleExportSelectMethod
|
|
725
727
|
},
|
|
728
|
+
/**
|
|
729
|
+
* 已废弃,被 FormatSelect 替换
|
|
730
|
+
* @deprecated
|
|
731
|
+
*/
|
|
726
732
|
formatOption: {
|
|
727
733
|
renderTableDefault(renderOpts, params) {
|
|
728
734
|
return getCellLabelVNs(renderOpts, params, getSelectCellValue(renderOpts, params));
|
|
729
735
|
}
|
|
730
736
|
},
|
|
737
|
+
FormatSelect: {
|
|
738
|
+
renderTableDefault(renderOpts, params) {
|
|
739
|
+
return getCellLabelVNs(renderOpts, params, getSelectCellValue(renderOpts, params));
|
|
740
|
+
}
|
|
741
|
+
},
|
|
731
742
|
VxeTreeSelect: {
|
|
732
743
|
tableAutoFocus: 'input',
|
|
733
744
|
renderTableEdit: defaultTableOrTreeSelectEditRender,
|
|
@@ -736,11 +747,20 @@ renderer.mixin({
|
|
|
736
747
|
},
|
|
737
748
|
tableExportMethod: handleExportTreeSelectMethod
|
|
738
749
|
},
|
|
750
|
+
/**
|
|
751
|
+
* 已废弃,被 FormatTreeSelect 替换
|
|
752
|
+
* @deprecated
|
|
753
|
+
*/
|
|
739
754
|
formatTree: {
|
|
740
755
|
renderTableDefault(renderOpts, params) {
|
|
741
756
|
return getCellLabelVNs(renderOpts, params, getTreeSelectCellValue(renderOpts, params));
|
|
742
757
|
}
|
|
743
758
|
},
|
|
759
|
+
FormatTreeSelect: {
|
|
760
|
+
renderTableDefault(renderOpts, params) {
|
|
761
|
+
return getCellLabelVNs(renderOpts, params, getTreeSelectCellValue(renderOpts, params));
|
|
762
|
+
}
|
|
763
|
+
},
|
|
744
764
|
VxeTableSelect: {
|
|
745
765
|
tableAutoFocus: 'input',
|
|
746
766
|
renderTableEdit: defaultTableOrTreeSelectEditRender,
|
|
@@ -11,37 +11,35 @@ export class ColumnInfo {
|
|
|
11
11
|
const formatter = _vm.formatter;
|
|
12
12
|
const visible = XEUtils.isBoolean(_vm.visible) ? _vm.visible : true;
|
|
13
13
|
const { props: tableProps } = $xeTable;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
const types = ['seq', 'checkbox', 'radio', 'expand', 'html'];
|
|
15
|
+
if (_vm.type && types.indexOf(_vm.type) === -1) {
|
|
16
|
+
warnLog('vxe.error.errProp', [`type=${_vm.type}`, types.join(', ')]);
|
|
17
|
+
}
|
|
18
|
+
if (XEUtils.isBoolean(_vm.cellRender) || (_vm.cellRender && !XEUtils.isObject(_vm.cellRender))) {
|
|
19
|
+
warnLog('vxe.error.errProp', [`column.cell-render=${_vm.cellRender}`, 'column.cell-render={}']);
|
|
20
|
+
}
|
|
21
|
+
if (XEUtils.isBoolean(_vm.editRender) || (_vm.editRender && !XEUtils.isObject(_vm.editRender))) {
|
|
22
|
+
warnLog('vxe.error.errProp', [`column.edit-render=${_vm.editRender}`, 'column.edit-render={}']);
|
|
23
|
+
}
|
|
24
|
+
if (_vm.type === 'expand') {
|
|
25
|
+
const { treeConfig } = tableProps;
|
|
26
|
+
const { computeTreeOpts } = $xeTable.getComputeMaps();
|
|
27
|
+
const treeOpts = computeTreeOpts.value;
|
|
28
|
+
if (treeConfig && (treeOpts.showLine || treeOpts.line)) {
|
|
29
|
+
errLog('vxe.error.errConflicts', ['tree-config.showLine', 'column.type=expand']);
|
|
24
30
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
if (
|
|
30
|
-
errLog('vxe.error.
|
|
31
|
+
}
|
|
32
|
+
if (formatter) {
|
|
33
|
+
if (XEUtils.isString(formatter)) {
|
|
34
|
+
const gFormatOpts = formats.get(formatter) || XEUtils[formatter];
|
|
35
|
+
if (!gFormatOpts || !XEUtils.isFunction(gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod)) {
|
|
36
|
+
errLog('vxe.error.notFormats', [formatter]);
|
|
31
37
|
}
|
|
32
38
|
}
|
|
33
|
-
if (formatter) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
errLog('vxe.error.notFormats', [formatter]);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
else if (XEUtils.isArray(formatter)) {
|
|
41
|
-
const gFormatOpts = formats.get(formatter[0]) || XEUtils[formatter[0]];
|
|
42
|
-
if (!gFormatOpts || !XEUtils.isFunction(gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod)) {
|
|
43
|
-
errLog('vxe.error.notFormats', [formatter[0]]);
|
|
44
|
-
}
|
|
39
|
+
else if (XEUtils.isArray(formatter)) {
|
|
40
|
+
const gFormatOpts = formats.get(formatter[0]) || XEUtils[formatter[0]];
|
|
41
|
+
if (!gFormatOpts || !XEUtils.isFunction(gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod)) {
|
|
42
|
+
errLog('vxe.error.notFormats', [formatter[0]]);
|
|
45
43
|
}
|
|
46
44
|
}
|
|
47
45
|
}
|