vxe-table 3.14.0-beta.2 → 3.14.0-beta.4

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.
@@ -556,6 +556,63 @@ function handleExportTreeSelectMethod(params) {
556
556
  const { row, column, options } = params;
557
557
  return options.original ? getCellValue(row, column) : getTreeSelectCellValue(column.editRender || column.cellRender, params);
558
558
  }
559
+ function handleNumberCell(h, renderOpts, params) {
560
+ const { props = {}, showNegativeStatus } = renderOpts;
561
+ const { row, column } = params;
562
+ const { type } = props;
563
+ let cellValue = XEUtils.get(row, column.field);
564
+ let isNegative = false;
565
+ if (!isEmptyValue(cellValue)) {
566
+ const numberInputConfig = getConfig().numberInput || {};
567
+ if (type === 'float') {
568
+ const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
569
+ const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 1);
570
+ cellValue = XEUtils.toFixed(XEUtils.floor(cellValue, digits), digits);
571
+ if (!autoFill) {
572
+ cellValue = XEUtils.toNumber(cellValue);
573
+ }
574
+ if (showNegativeStatus) {
575
+ if (cellValue < 0) {
576
+ isNegative = true;
577
+ }
578
+ }
579
+ }
580
+ else if (type === 'amount') {
581
+ const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
582
+ const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 2);
583
+ const showCurrency = handleDefaultValue(props.showCurrency, numberInputConfig.showCurrency, false);
584
+ cellValue = XEUtils.toNumber(cellValue);
585
+ if (showNegativeStatus) {
586
+ if (cellValue < 0) {
587
+ isNegative = true;
588
+ }
589
+ }
590
+ cellValue = XEUtils.commafy(cellValue, { digits });
591
+ if (!autoFill) {
592
+ const [iStr, dStr] = cellValue.split('.');
593
+ if (dStr) {
594
+ const dRest = dStr.replace(/0+$/, '');
595
+ cellValue = dRest ? [iStr, '.', dRest].join('') : iStr;
596
+ }
597
+ }
598
+ if (showCurrency) {
599
+ cellValue = `${props.currencySymbol || numberInputConfig.currencySymbol || getI18n('vxe.numberInput.currencySymbol') || ''}${cellValue}`;
600
+ }
601
+ }
602
+ else {
603
+ if (showNegativeStatus) {
604
+ if (XEUtils.toNumber(cellValue) < 0) {
605
+ isNegative = true;
606
+ }
607
+ }
608
+ }
609
+ }
610
+ return getCellLabelVNs(h, renderOpts, params, cellValue, isNegative
611
+ ? {
612
+ class: 'is--negative'
613
+ }
614
+ : {});
615
+ }
559
616
  /**
560
617
  * 表格 - 渲染器
561
618
  */
@@ -620,66 +677,19 @@ renderer.mixin({
620
677
  renderTableFilter: defaultFilterRender,
621
678
  tableFilterDefaultMethod: handleInputFilterMethod
622
679
  },
680
+ FormatNumberInput: {
681
+ renderTableDefault: handleNumberCell,
682
+ tableFilterDefaultMethod: handleInputFilterMethod,
683
+ tableExportMethod(params) {
684
+ const { row, column } = params;
685
+ const cellValue = XEUtils.get(row, column.field);
686
+ return cellValue;
687
+ }
688
+ },
623
689
  VxeNumberInput: {
624
690
  tableAutoFocus: 'input',
625
691
  renderTableEdit: defaultEditRender,
626
- renderTableCell(h, renderOpts, params) {
627
- const { props = {}, showNegativeStatus } = renderOpts;
628
- const { row, column } = params;
629
- const { type } = props;
630
- let cellValue = XEUtils.get(row, column.field);
631
- let isNegative = false;
632
- if (!isEmptyValue(cellValue)) {
633
- const numberInputConfig = getConfig().numberInput || {};
634
- if (type === 'float') {
635
- const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
636
- const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 1);
637
- cellValue = XEUtils.toFixed(XEUtils.floor(cellValue, digits), digits);
638
- if (!autoFill) {
639
- cellValue = XEUtils.toNumber(cellValue);
640
- }
641
- if (showNegativeStatus) {
642
- if (cellValue < 0) {
643
- isNegative = true;
644
- }
645
- }
646
- }
647
- else if (type === 'amount') {
648
- const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
649
- const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 2);
650
- const showCurrency = handleDefaultValue(props.showCurrency, numberInputConfig.showCurrency, false);
651
- cellValue = XEUtils.toNumber(cellValue);
652
- if (showNegativeStatus) {
653
- if (cellValue < 0) {
654
- isNegative = true;
655
- }
656
- }
657
- cellValue = XEUtils.commafy(cellValue, { digits });
658
- if (!autoFill) {
659
- const [iStr, dStr] = cellValue.split('.');
660
- if (dStr) {
661
- const dRest = dStr.replace(/0+$/, '');
662
- cellValue = dRest ? [iStr, '.', dRest].join('') : iStr;
663
- }
664
- }
665
- if (showCurrency) {
666
- cellValue = `${props.currencySymbol || numberInputConfig.currencySymbol || getI18n('vxe.numberInput.currencySymbol') || ''}${cellValue}`;
667
- }
668
- }
669
- else {
670
- if (showNegativeStatus) {
671
- if (XEUtils.toNumber(cellValue) < 0) {
672
- isNegative = true;
673
- }
674
- }
675
- }
676
- }
677
- return getCellLabelVNs(h, renderOpts, params, cellValue, isNegative
678
- ? {
679
- class: 'is--negative'
680
- }
681
- : {});
682
- },
692
+ renderTableCell: handleNumberCell,
683
693
  renderTableFooter(h, renderOpts, params) {
684
694
  const { props = {} } = renderOpts;
685
695
  const { row, column, _columnIndex } = params;
@@ -784,11 +794,22 @@ renderer.mixin({
784
794
  tableFilterDefaultMethod: handleFilterMethod,
785
795
  tableExportMethod: handleExportSelectMethod
786
796
  },
797
+ /**
798
+ * 已废弃,被 FormatSelect 替换
799
+ * @deprecated
800
+ */
787
801
  formatOption: {
788
802
  renderTableDefault(h, renderOpts, params) {
789
803
  return getCellLabelVNs(h, renderOpts, params, getSelectCellValue(renderOpts, params));
790
804
  }
791
805
  },
806
+ FormatSelect: {
807
+ renderTableDefault(h, renderOpts, params) {
808
+ return getCellLabelVNs(h, renderOpts, params, getSelectCellValue(renderOpts, params));
809
+ },
810
+ tableFilterDefaultMethod: handleFilterMethod,
811
+ tableExportMethod: handleExportSelectMethod
812
+ },
792
813
  VxeTreeSelect: {
793
814
  tableAutoFocus: 'input',
794
815
  renderTableEdit: defaultTableOrTreeSelectEditRender,
@@ -805,11 +826,21 @@ renderer.mixin({
805
826
  },
806
827
  tableExportMethod: handleExportTreeSelectMethod
807
828
  },
829
+ /**
830
+ * 已废弃,被 FormatTreeSelect 替换
831
+ * @deprecated
832
+ */
808
833
  formatTree: {
809
834
  renderTableDefault(h, renderOpts, params) {
810
835
  return getCellLabelVNs(h, renderOpts, params, getTreeSelectCellValue(renderOpts, params));
811
836
  }
812
837
  },
838
+ FormatTreeSelect: {
839
+ renderTableDefault(h, renderOpts, params) {
840
+ return getCellLabelVNs(h, renderOpts, params, getTreeSelectCellValue(renderOpts, params));
841
+ },
842
+ tableExportMethod: handleExportTreeSelectMethod
843
+ },
813
844
  VxeColorPicker: {
814
845
  tableAutoFocus: 'input',
815
846
  renderTableEdit(h, renderOpts, params) {
@@ -2459,7 +2459,7 @@ const Methods = {
2459
2459
  // warnLog('vxe.error.reqProp', ['table.show-overflow'])
2460
2460
  // }
2461
2461
  if (this.spanMethod) {
2462
- warnLog('vxe.error.scrollErrProp', ['table.span-method']);
2462
+ errLog('vxe.error.scrollErrProp', ['table.span-method']);
2463
2463
  }
2464
2464
  }
2465
2465
  handleReserveStatus($xeTable);
package/es/ui/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { VxeUI } from '@vxe-ui/core';
2
2
  import { getFuncText } from './src/utils';
3
- export const version = "3.14.0-beta.2";
3
+ export const version = "3.14.0-beta.4";
4
4
  VxeUI.version = version;
5
5
  VxeUI.tableVersion = version;
6
6
  VxeUI.setConfig({
package/es/ui/src/log.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { VxeUI } from '@vxe-ui/core';
2
2
  const { log } = VxeUI;
3
- const version = `table v${"3.14.0-beta.2"}`;
3
+ const version = `table v${"3.14.0-beta.4"}`;
4
4
  export const warnLog = log.create('warn', version);
5
5
  export const errLog = log.create('error', version);
package/lib/index.umd.js CHANGED
@@ -2220,7 +2220,7 @@ function getClass(property, params) {
2220
2220
  ;// CONCATENATED MODULE: ./packages/ui/index.ts
2221
2221
 
2222
2222
 
2223
- const version = "3.14.0-beta.2";
2223
+ const version = "3.14.0-beta.4";
2224
2224
  core_.VxeUI.version = version;
2225
2225
  core_.VxeUI.tableVersion = version;
2226
2226
  core_.VxeUI.setConfig({
@@ -2843,7 +2843,7 @@ function isNodeElement(elem) {
2843
2843
  const {
2844
2844
  log: log_log
2845
2845
  } = core_.VxeUI;
2846
- const log_version = `table v${"3.14.0-beta.2"}`;
2846
+ const log_version = `table v${"3.14.0-beta.4"}`;
2847
2847
  const warnLog = log_log.create('warn', log_version);
2848
2848
  const errLog = log_log.create('error', log_version);
2849
2849
  ;// CONCATENATED MODULE: ./packages/table/src/columnInfo.ts
@@ -7919,7 +7919,7 @@ const Methods = {
7919
7919
  // warnLog('vxe.error.reqProp', ['table.show-overflow'])
7920
7920
  // }
7921
7921
  if (this.spanMethod) {
7922
- warnLog('vxe.error.scrollErrProp', ['table.span-method']);
7922
+ errLog('vxe.error.scrollErrProp', ['table.span-method']);
7923
7923
  }
7924
7924
  }
7925
7925
  handleReserveStatus($xeTable);
@@ -30294,6 +30294,69 @@ function handleExportTreeSelectMethod(params) {
30294
30294
  } = params;
30295
30295
  return options.original ? getCellValue(row, column) : getTreeSelectCellValue(column.editRender || column.cellRender, params);
30296
30296
  }
30297
+ function handleNumberCell(h, renderOpts, params) {
30298
+ const {
30299
+ props = {},
30300
+ showNegativeStatus
30301
+ } = renderOpts;
30302
+ const {
30303
+ row,
30304
+ column
30305
+ } = params;
30306
+ const {
30307
+ type
30308
+ } = props;
30309
+ let cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
30310
+ let isNegative = false;
30311
+ if (!isEmptyValue(cellValue)) {
30312
+ const numberInputConfig = render_getConfig().numberInput || {};
30313
+ if (type === 'float') {
30314
+ const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
30315
+ const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 1);
30316
+ cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toFixed(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().floor(cellValue, digits), digits);
30317
+ if (!autoFill) {
30318
+ cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellValue);
30319
+ }
30320
+ if (showNegativeStatus) {
30321
+ if (cellValue < 0) {
30322
+ isNegative = true;
30323
+ }
30324
+ }
30325
+ } else if (type === 'amount') {
30326
+ const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
30327
+ const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 2);
30328
+ const showCurrency = handleDefaultValue(props.showCurrency, numberInputConfig.showCurrency, false);
30329
+ cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellValue);
30330
+ if (showNegativeStatus) {
30331
+ if (cellValue < 0) {
30332
+ isNegative = true;
30333
+ }
30334
+ }
30335
+ cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().commafy(cellValue, {
30336
+ digits
30337
+ });
30338
+ if (!autoFill) {
30339
+ const [iStr, dStr] = cellValue.split('.');
30340
+ if (dStr) {
30341
+ const dRest = dStr.replace(/0+$/, '');
30342
+ cellValue = dRest ? [iStr, '.', dRest].join('') : iStr;
30343
+ }
30344
+ }
30345
+ if (showCurrency) {
30346
+ cellValue = `${props.currencySymbol || numberInputConfig.currencySymbol || render_getI18n('vxe.numberInput.currencySymbol') || ''}${cellValue}`;
30347
+ }
30348
+ } else {
30349
+ if (showNegativeStatus) {
30350
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellValue) < 0) {
30351
+ isNegative = true;
30352
+ }
30353
+ }
30354
+ }
30355
+ }
30356
+ return getCellLabelVNs(h, renderOpts, params, cellValue, isNegative ? {
30357
+ class: 'is--negative'
30358
+ } : {});
30359
+ }
30297
30360
  /**
30298
30361
  * 表格 - 渲染器
30299
30362
  */
@@ -30365,72 +30428,22 @@ render_renderer.mixin({
30365
30428
  renderTableFilter: defaultFilterRender,
30366
30429
  tableFilterDefaultMethod: handleInputFilterMethod
30367
30430
  },
30368
- VxeNumberInput: {
30369
- tableAutoFocus: 'input',
30370
- renderTableEdit: defaultEditRender,
30371
- renderTableCell(h, renderOpts, params) {
30372
- const {
30373
- props = {},
30374
- showNegativeStatus
30375
- } = renderOpts;
30431
+ FormatNumberInput: {
30432
+ renderTableDefault: handleNumberCell,
30433
+ tableFilterDefaultMethod: handleInputFilterMethod,
30434
+ tableExportMethod(params) {
30376
30435
  const {
30377
30436
  row,
30378
30437
  column
30379
30438
  } = params;
30380
- const {
30381
- type
30382
- } = props;
30383
- let cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
30384
- let isNegative = false;
30385
- if (!isEmptyValue(cellValue)) {
30386
- const numberInputConfig = render_getConfig().numberInput || {};
30387
- if (type === 'float') {
30388
- const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
30389
- const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 1);
30390
- cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toFixed(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().floor(cellValue, digits), digits);
30391
- if (!autoFill) {
30392
- cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellValue);
30393
- }
30394
- if (showNegativeStatus) {
30395
- if (cellValue < 0) {
30396
- isNegative = true;
30397
- }
30398
- }
30399
- } else if (type === 'amount') {
30400
- const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
30401
- const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 2);
30402
- const showCurrency = handleDefaultValue(props.showCurrency, numberInputConfig.showCurrency, false);
30403
- cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellValue);
30404
- if (showNegativeStatus) {
30405
- if (cellValue < 0) {
30406
- isNegative = true;
30407
- }
30408
- }
30409
- cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().commafy(cellValue, {
30410
- digits
30411
- });
30412
- if (!autoFill) {
30413
- const [iStr, dStr] = cellValue.split('.');
30414
- if (dStr) {
30415
- const dRest = dStr.replace(/0+$/, '');
30416
- cellValue = dRest ? [iStr, '.', dRest].join('') : iStr;
30417
- }
30418
- }
30419
- if (showCurrency) {
30420
- cellValue = `${props.currencySymbol || numberInputConfig.currencySymbol || render_getI18n('vxe.numberInput.currencySymbol') || ''}${cellValue}`;
30421
- }
30422
- } else {
30423
- if (showNegativeStatus) {
30424
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellValue) < 0) {
30425
- isNegative = true;
30426
- }
30427
- }
30428
- }
30429
- }
30430
- return getCellLabelVNs(h, renderOpts, params, cellValue, isNegative ? {
30431
- class: 'is--negative'
30432
- } : {});
30433
- },
30439
+ const cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
30440
+ return cellValue;
30441
+ }
30442
+ },
30443
+ VxeNumberInput: {
30444
+ tableAutoFocus: 'input',
30445
+ renderTableEdit: defaultEditRender,
30446
+ renderTableCell: handleNumberCell,
30434
30447
  renderTableFooter(h, renderOpts, params) {
30435
30448
  const {
30436
30449
  props = {}
@@ -30567,11 +30580,22 @@ render_renderer.mixin({
30567
30580
  tableFilterDefaultMethod: handleFilterMethod,
30568
30581
  tableExportMethod: handleExportSelectMethod
30569
30582
  },
30583
+ /**
30584
+ * 已废弃,被 FormatSelect 替换
30585
+ * @deprecated
30586
+ */
30570
30587
  formatOption: {
30571
30588
  renderTableDefault(h, renderOpts, params) {
30572
30589
  return getCellLabelVNs(h, renderOpts, params, getSelectCellValue(renderOpts, params));
30573
30590
  }
30574
30591
  },
30592
+ FormatSelect: {
30593
+ renderTableDefault(h, renderOpts, params) {
30594
+ return getCellLabelVNs(h, renderOpts, params, getSelectCellValue(renderOpts, params));
30595
+ },
30596
+ tableFilterDefaultMethod: handleFilterMethod,
30597
+ tableExportMethod: handleExportSelectMethod
30598
+ },
30575
30599
  VxeTreeSelect: {
30576
30600
  tableAutoFocus: 'input',
30577
30601
  renderTableEdit: defaultTableOrTreeSelectEditRender,
@@ -30588,11 +30612,21 @@ render_renderer.mixin({
30588
30612
  },
30589
30613
  tableExportMethod: handleExportTreeSelectMethod
30590
30614
  },
30615
+ /**
30616
+ * 已废弃,被 FormatTreeSelect 替换
30617
+ * @deprecated
30618
+ */
30591
30619
  formatTree: {
30592
30620
  renderTableDefault(h, renderOpts, params) {
30593
30621
  return getCellLabelVNs(h, renderOpts, params, getTreeSelectCellValue(renderOpts, params));
30594
30622
  }
30595
30623
  },
30624
+ FormatTreeSelect: {
30625
+ renderTableDefault(h, renderOpts, params) {
30626
+ return getCellLabelVNs(h, renderOpts, params, getTreeSelectCellValue(renderOpts, params));
30627
+ },
30628
+ tableExportMethod: handleExportTreeSelectMethod
30629
+ },
30596
30630
  VxeColorPicker: {
30597
30631
  tableAutoFocus: 'input',
30598
30632
  renderTableEdit(h, renderOpts, params) {