vxe-table 3.14.0-beta.2 → 3.14.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.
@@ -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,13 @@ renderer.mixin({
620
677
  renderTableFilter: defaultFilterRender,
621
678
  tableFilterDefaultMethod: handleInputFilterMethod
622
679
  },
680
+ FormatNumberInput: {
681
+ renderTableDefault: handleNumberCell
682
+ },
623
683
  VxeNumberInput: {
624
684
  tableAutoFocus: 'input',
625
685
  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
- },
686
+ renderTableCell: handleNumberCell,
683
687
  renderTableFooter(h, renderOpts, params) {
684
688
  const { props = {} } = renderOpts;
685
689
  const { row, column, _columnIndex } = params;
@@ -784,11 +788,20 @@ renderer.mixin({
784
788
  tableFilterDefaultMethod: handleFilterMethod,
785
789
  tableExportMethod: handleExportSelectMethod
786
790
  },
791
+ /**
792
+ * 已废弃,被 FormatSelect 替换
793
+ * @deprecated
794
+ */
787
795
  formatOption: {
788
796
  renderTableDefault(h, renderOpts, params) {
789
797
  return getCellLabelVNs(h, renderOpts, params, getSelectCellValue(renderOpts, params));
790
798
  }
791
799
  },
800
+ FormatSelect: {
801
+ renderTableDefault(h, renderOpts, params) {
802
+ return getCellLabelVNs(h, renderOpts, params, getSelectCellValue(renderOpts, params));
803
+ }
804
+ },
792
805
  VxeTreeSelect: {
793
806
  tableAutoFocus: 'input',
794
807
  renderTableEdit: defaultTableOrTreeSelectEditRender,
@@ -805,11 +818,20 @@ renderer.mixin({
805
818
  },
806
819
  tableExportMethod: handleExportTreeSelectMethod
807
820
  },
821
+ /**
822
+ * 已废弃,被 FormatTreeSelect 替换
823
+ * @deprecated
824
+ */
808
825
  formatTree: {
809
826
  renderTableDefault(h, renderOpts, params) {
810
827
  return getCellLabelVNs(h, renderOpts, params, getTreeSelectCellValue(renderOpts, params));
811
828
  }
812
829
  },
830
+ FormatTreeSelect: {
831
+ renderTableDefault(h, renderOpts, params) {
832
+ return getCellLabelVNs(h, renderOpts, params, getTreeSelectCellValue(renderOpts, params));
833
+ }
834
+ },
813
835
  VxeColorPicker: {
814
836
  tableAutoFocus: 'input',
815
837
  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.3";
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.3"}`;
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.3";
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.3"}`;
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,13 @@ render_renderer.mixin({
30365
30428
  renderTableFilter: defaultFilterRender,
30366
30429
  tableFilterDefaultMethod: handleInputFilterMethod
30367
30430
  },
30431
+ FormatNumberInput: {
30432
+ renderTableDefault: handleNumberCell
30433
+ },
30368
30434
  VxeNumberInput: {
30369
30435
  tableAutoFocus: 'input',
30370
30436
  renderTableEdit: defaultEditRender,
30371
- renderTableCell(h, renderOpts, params) {
30372
- const {
30373
- props = {},
30374
- showNegativeStatus
30375
- } = renderOpts;
30376
- const {
30377
- row,
30378
- column
30379
- } = 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
- },
30437
+ renderTableCell: handleNumberCell,
30434
30438
  renderTableFooter(h, renderOpts, params) {
30435
30439
  const {
30436
30440
  props = {}
@@ -30567,11 +30571,20 @@ render_renderer.mixin({
30567
30571
  tableFilterDefaultMethod: handleFilterMethod,
30568
30572
  tableExportMethod: handleExportSelectMethod
30569
30573
  },
30574
+ /**
30575
+ * 已废弃,被 FormatSelect 替换
30576
+ * @deprecated
30577
+ */
30570
30578
  formatOption: {
30571
30579
  renderTableDefault(h, renderOpts, params) {
30572
30580
  return getCellLabelVNs(h, renderOpts, params, getSelectCellValue(renderOpts, params));
30573
30581
  }
30574
30582
  },
30583
+ FormatSelect: {
30584
+ renderTableDefault(h, renderOpts, params) {
30585
+ return getCellLabelVNs(h, renderOpts, params, getSelectCellValue(renderOpts, params));
30586
+ }
30587
+ },
30575
30588
  VxeTreeSelect: {
30576
30589
  tableAutoFocus: 'input',
30577
30590
  renderTableEdit: defaultTableOrTreeSelectEditRender,
@@ -30588,11 +30601,20 @@ render_renderer.mixin({
30588
30601
  },
30589
30602
  tableExportMethod: handleExportTreeSelectMethod
30590
30603
  },
30604
+ /**
30605
+ * 已废弃,被 FormatTreeSelect 替换
30606
+ * @deprecated
30607
+ */
30591
30608
  formatTree: {
30592
30609
  renderTableDefault(h, renderOpts, params) {
30593
30610
  return getCellLabelVNs(h, renderOpts, params, getTreeSelectCellValue(renderOpts, params));
30594
30611
  }
30595
30612
  },
30613
+ FormatTreeSelect: {
30614
+ renderTableDefault(h, renderOpts, params) {
30615
+ return getCellLabelVNs(h, renderOpts, params, getTreeSelectCellValue(renderOpts, params));
30616
+ }
30617
+ },
30596
30618
  VxeColorPicker: {
30597
30619
  tableAutoFocus: 'input',
30598
30620
  renderTableEdit(h, renderOpts, params) {