vxe-table 4.11.17 → 4.11.19
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 +4 -1
- package/es/style.css +1 -1
- package/es/table/render/index.js +88 -57
- package/es/table/src/body.js +11 -6
- package/es/table/src/footer.js +7 -2
- package/es/table/src/table.js +188 -67
- package/es/table/src/util.js +13 -3
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/grid/src/grid.js +4 -1
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +335 -143
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/render/index.js +96 -62
- package/lib/table/render/index.min.js +1 -1
- package/lib/table/src/body.js +10 -5
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/footer.js +7 -2
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/table.js +203 -66
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +16 -6
- package/lib/table/src/util.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 +4 -1
- package/packages/table/render/index.ts +87 -55
- package/packages/table/src/body.ts +10 -5
- package/packages/table/src/footer.ts +7 -2
- package/packages/table/src/table.ts +187 -67
- package/packages/table/src/util.ts +15 -3
- /package/es/{iconfont.1741140593243.ttf → iconfont.1741333398347.ttf} +0 -0
- /package/es/{iconfont.1741140593243.woff → iconfont.1741333398347.woff} +0 -0
- /package/es/{iconfont.1741140593243.woff2 → iconfont.1741333398347.woff2} +0 -0
- /package/lib/{iconfont.1741140593243.ttf → iconfont.1741333398347.ttf} +0 -0
- /package/lib/{iconfont.1741140593243.woff → iconfont.1741333398347.woff} +0 -0
- /package/lib/{iconfont.1741140593243.woff2 → iconfont.1741333398347.woff2} +0 -0
package/es/table/render/index.js
CHANGED
|
@@ -500,6 +500,63 @@ function handleExportTreeSelectMethod(params) {
|
|
|
500
500
|
const { row, column, options } = params;
|
|
501
501
|
return options.original ? getCellValue(row, column) : getTreeSelectCellValue(column.editRender || column.cellRender, params);
|
|
502
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
|
+
}
|
|
503
560
|
/**
|
|
504
561
|
* 表格 - 渲染器
|
|
505
562
|
*/
|
|
@@ -559,66 +616,19 @@ renderer.mixin({
|
|
|
559
616
|
renderTableFilter: defaultFilterRender,
|
|
560
617
|
tableFilterDefaultMethod: handleInputFilterMethod
|
|
561
618
|
},
|
|
619
|
+
FormatNumberInput: {
|
|
620
|
+
renderTableDefault: handleNumberCell,
|
|
621
|
+
tableFilterDefaultMethod: handleInputFilterMethod,
|
|
622
|
+
tableExportMethod(params) {
|
|
623
|
+
const { row, column } = params;
|
|
624
|
+
const cellValue = XEUtils.get(row, column.field);
|
|
625
|
+
return cellValue;
|
|
626
|
+
}
|
|
627
|
+
},
|
|
562
628
|
VxeNumberInput: {
|
|
563
629
|
tableAutoFocus: 'input',
|
|
564
630
|
renderTableEdit: defaultEditRender,
|
|
565
|
-
renderTableCell
|
|
566
|
-
const { props = {}, showNegativeStatus } = renderOpts;
|
|
567
|
-
const { row, column } = params;
|
|
568
|
-
const { type } = props;
|
|
569
|
-
let cellValue = XEUtils.get(row, column.field);
|
|
570
|
-
let isNegative = false;
|
|
571
|
-
if (!isEmptyValue(cellValue)) {
|
|
572
|
-
const numberInputConfig = getConfig().numberInput || {};
|
|
573
|
-
if (type === 'float') {
|
|
574
|
-
const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
|
|
575
|
-
const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 1);
|
|
576
|
-
cellValue = XEUtils.toFixed(XEUtils.floor(cellValue, digits), digits);
|
|
577
|
-
if (!autoFill) {
|
|
578
|
-
cellValue = XEUtils.toNumber(cellValue);
|
|
579
|
-
}
|
|
580
|
-
if (showNegativeStatus) {
|
|
581
|
-
if (cellValue < 0) {
|
|
582
|
-
isNegative = true;
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
else if (type === 'amount') {
|
|
587
|
-
const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
|
|
588
|
-
const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 2);
|
|
589
|
-
const showCurrency = handleDefaultValue(props.showCurrency, numberInputConfig.showCurrency, false);
|
|
590
|
-
cellValue = XEUtils.toNumber(cellValue);
|
|
591
|
-
if (showNegativeStatus) {
|
|
592
|
-
if (cellValue < 0) {
|
|
593
|
-
isNegative = true;
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
cellValue = XEUtils.commafy(cellValue, { digits });
|
|
597
|
-
if (!autoFill) {
|
|
598
|
-
const [iStr, dStr] = cellValue.split('.');
|
|
599
|
-
if (dStr) {
|
|
600
|
-
const dRest = dStr.replace(/0+$/, '');
|
|
601
|
-
cellValue = dRest ? [iStr, '.', dRest].join('') : iStr;
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
if (showCurrency) {
|
|
605
|
-
cellValue = `${props.currencySymbol || numberInputConfig.currencySymbol || getI18n('vxe.numberInput.currencySymbol') || ''}${cellValue}`;
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
else {
|
|
609
|
-
if (showNegativeStatus) {
|
|
610
|
-
if (XEUtils.toNumber(cellValue) < 0) {
|
|
611
|
-
isNegative = true;
|
|
612
|
-
}
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
return getCellLabelVNs(renderOpts, params, cellValue, isNegative
|
|
617
|
-
? {
|
|
618
|
-
class: 'is--negative'
|
|
619
|
-
}
|
|
620
|
-
: {});
|
|
621
|
-
},
|
|
631
|
+
renderTableCell: handleNumberCell,
|
|
622
632
|
renderTableFooter(renderOpts, params) {
|
|
623
633
|
const { props = {} } = renderOpts;
|
|
624
634
|
const { row, column, _columnIndex } = params;
|
|
@@ -721,11 +731,22 @@ renderer.mixin({
|
|
|
721
731
|
tableFilterDefaultMethod: handleFilterMethod,
|
|
722
732
|
tableExportMethod: handleExportSelectMethod
|
|
723
733
|
},
|
|
734
|
+
/**
|
|
735
|
+
* 已废弃,被 FormatSelect 替换
|
|
736
|
+
* @deprecated
|
|
737
|
+
*/
|
|
724
738
|
formatOption: {
|
|
725
739
|
renderTableDefault(renderOpts, params) {
|
|
726
740
|
return getCellLabelVNs(renderOpts, params, getSelectCellValue(renderOpts, params));
|
|
727
741
|
}
|
|
728
742
|
},
|
|
743
|
+
FormatSelect: {
|
|
744
|
+
renderTableDefault(renderOpts, params) {
|
|
745
|
+
return getCellLabelVNs(renderOpts, params, getSelectCellValue(renderOpts, params));
|
|
746
|
+
},
|
|
747
|
+
tableFilterDefaultMethod: handleFilterMethod,
|
|
748
|
+
tableExportMethod: handleExportSelectMethod
|
|
749
|
+
},
|
|
729
750
|
VxeTreeSelect: {
|
|
730
751
|
tableAutoFocus: 'input',
|
|
731
752
|
renderTableEdit: defaultTableOrTreeSelectEditRender,
|
|
@@ -734,11 +755,21 @@ renderer.mixin({
|
|
|
734
755
|
},
|
|
735
756
|
tableExportMethod: handleExportTreeSelectMethod
|
|
736
757
|
},
|
|
758
|
+
/**
|
|
759
|
+
* 已废弃,被 FormatTreeSelect 替换
|
|
760
|
+
* @deprecated
|
|
761
|
+
*/
|
|
737
762
|
formatTree: {
|
|
738
763
|
renderTableDefault(renderOpts, params) {
|
|
739
764
|
return getCellLabelVNs(renderOpts, params, getTreeSelectCellValue(renderOpts, params));
|
|
740
765
|
}
|
|
741
766
|
},
|
|
767
|
+
FormatTreeSelect: {
|
|
768
|
+
renderTableDefault(renderOpts, params) {
|
|
769
|
+
return getCellLabelVNs(renderOpts, params, getTreeSelectCellValue(renderOpts, params));
|
|
770
|
+
},
|
|
771
|
+
tableExportMethod: handleExportTreeSelectMethod
|
|
772
|
+
},
|
|
742
773
|
VxeTableSelect: {
|
|
743
774
|
tableAutoFocus: 'input',
|
|
744
775
|
renderTableEdit: defaultTableOrTreeSelectEditRender,
|
package/es/table/src/body.js
CHANGED
|
@@ -205,6 +205,7 @@ export default defineComponent({
|
|
|
205
205
|
tdOns.onDblclick = (evnt) => {
|
|
206
206
|
$xeTable.triggerCellDblclickEvent(evnt, cellParams);
|
|
207
207
|
};
|
|
208
|
+
let isMergeCell = false;
|
|
208
209
|
// 合并行或列
|
|
209
210
|
if (mergeList.length) {
|
|
210
211
|
const spanRest = mergeBodyMethod(mergeList, _rowIndex, _columnIndex);
|
|
@@ -214,9 +215,11 @@ export default defineComponent({
|
|
|
214
215
|
return null;
|
|
215
216
|
}
|
|
216
217
|
if (rowspan > 1) {
|
|
218
|
+
isMergeCell = true;
|
|
217
219
|
tdAttrs.rowspan = rowspan;
|
|
218
220
|
}
|
|
219
221
|
if (colspan > 1) {
|
|
222
|
+
isMergeCell = true;
|
|
220
223
|
tdAttrs.colspan = colspan;
|
|
221
224
|
}
|
|
222
225
|
}
|
|
@@ -249,12 +252,14 @@ export default defineComponent({
|
|
|
249
252
|
const isLastColumn = $columnIndex === columns.length - 1;
|
|
250
253
|
const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
|
|
251
254
|
let isVNPreEmptyStatus = false;
|
|
252
|
-
if (!
|
|
253
|
-
if (
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
255
|
+
if (!isMergeCell) {
|
|
256
|
+
if (!dragRow || getRowid($xeTable, dragRow) !== rowid) {
|
|
257
|
+
if (scrollYLoad && (_rowIndex < scrollYStore.visibleStartIndex - scrollYStore.preloadSize || _rowIndex > scrollYStore.visibleEndIndex + scrollYStore.preloadSize)) {
|
|
258
|
+
isVNPreEmptyStatus = true;
|
|
259
|
+
}
|
|
260
|
+
else if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
|
|
261
|
+
isVNPreEmptyStatus = true;
|
|
262
|
+
}
|
|
258
263
|
}
|
|
259
264
|
}
|
|
260
265
|
const tcStyle = {};
|
package/es/table/src/footer.js
CHANGED
|
@@ -126,6 +126,7 @@ export default defineComponent({
|
|
|
126
126
|
tfOns.onDblclick = (evnt) => {
|
|
127
127
|
$xeTable.dispatchEvent('footer-cell-dblclick', Object.assign({ cell: evnt.currentTarget }, cellParams), evnt);
|
|
128
128
|
};
|
|
129
|
+
let isMergeCell = false;
|
|
129
130
|
// 合并行或列
|
|
130
131
|
if (mergeFooterList.length) {
|
|
131
132
|
const spanRest = mergeFooterMethod(mergeFooterList, _rowIndex, _columnIndex);
|
|
@@ -135,9 +136,11 @@ export default defineComponent({
|
|
|
135
136
|
return null;
|
|
136
137
|
}
|
|
137
138
|
if (rowspan > 1) {
|
|
139
|
+
isMergeCell = true;
|
|
138
140
|
attrs.rowspan = rowspan;
|
|
139
141
|
}
|
|
140
142
|
if (colspan > 1) {
|
|
143
|
+
isMergeCell = true;
|
|
141
144
|
attrs.colspan = colspan;
|
|
142
145
|
}
|
|
143
146
|
}
|
|
@@ -158,8 +161,10 @@ export default defineComponent({
|
|
|
158
161
|
const isLastColumn = $columnIndex === tableColumn.length - 1;
|
|
159
162
|
const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
|
|
160
163
|
let isVNPreEmptyStatus = false;
|
|
161
|
-
if (
|
|
162
|
-
|
|
164
|
+
if (!isMergeCell) {
|
|
165
|
+
if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
|
|
166
|
+
isVNPreEmptyStatus = true;
|
|
167
|
+
}
|
|
163
168
|
}
|
|
164
169
|
const tcStyle = {};
|
|
165
170
|
if (hasEllipsis) {
|