vxe-table 4.12.0-beta.2 → 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.
@@ -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,13 @@ renderer.mixin({
559
616
  renderTableFilter: defaultFilterRender,
560
617
  tableFilterDefaultMethod: handleInputFilterMethod
561
618
  },
619
+ FormatNumberInput: {
620
+ renderTableDefault: handleNumberCell
621
+ },
562
622
  VxeNumberInput: {
563
623
  tableAutoFocus: 'input',
564
624
  renderTableEdit: defaultEditRender,
565
- renderTableCell(renderOpts, params) {
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
- },
625
+ renderTableCell: handleNumberCell,
622
626
  renderTableFooter(renderOpts, params) {
623
627
  const { props = {} } = renderOpts;
624
628
  const { row, column, _columnIndex } = params;
@@ -721,11 +725,20 @@ renderer.mixin({
721
725
  tableFilterDefaultMethod: handleFilterMethod,
722
726
  tableExportMethod: handleExportSelectMethod
723
727
  },
728
+ /**
729
+ * 已废弃,被 FormatSelect 替换
730
+ * @deprecated
731
+ */
724
732
  formatOption: {
725
733
  renderTableDefault(renderOpts, params) {
726
734
  return getCellLabelVNs(renderOpts, params, getSelectCellValue(renderOpts, params));
727
735
  }
728
736
  },
737
+ FormatSelect: {
738
+ renderTableDefault(renderOpts, params) {
739
+ return getCellLabelVNs(renderOpts, params, getSelectCellValue(renderOpts, params));
740
+ }
741
+ },
729
742
  VxeTreeSelect: {
730
743
  tableAutoFocus: 'input',
731
744
  renderTableEdit: defaultTableOrTreeSelectEditRender,
@@ -734,11 +747,20 @@ renderer.mixin({
734
747
  },
735
748
  tableExportMethod: handleExportTreeSelectMethod
736
749
  },
750
+ /**
751
+ * 已废弃,被 FormatTreeSelect 替换
752
+ * @deprecated
753
+ */
737
754
  formatTree: {
738
755
  renderTableDefault(renderOpts, params) {
739
756
  return getCellLabelVNs(renderOpts, params, getTreeSelectCellValue(renderOpts, params));
740
757
  }
741
758
  },
759
+ FormatTreeSelect: {
760
+ renderTableDefault(renderOpts, params) {
761
+ return getCellLabelVNs(renderOpts, params, getTreeSelectCellValue(renderOpts, params));
762
+ }
763
+ },
742
764
  VxeTableSelect: {
743
765
  tableAutoFocus: 'input',
744
766
  renderTableEdit: defaultTableOrTreeSelectEditRender,
@@ -2746,7 +2746,7 @@ export default defineComponent({
2746
2746
  // warnLog('vxe.error.reqProp', ['table.show-overflow'])
2747
2747
  // }
2748
2748
  if (props.spanMethod) {
2749
- warnLog('vxe.error.scrollErrProp', ['table.span-method']);
2749
+ errLog('vxe.error.scrollErrProp', ['table.span-method']);
2750
2750
  }
2751
2751
  }
2752
2752
  handleReserveStatus();
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 = "4.12.0-beta.2";
3
+ export const version = "4.12.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${"4.12.0-beta.2"}`;
3
+ const version = `table v${"4.12.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
@@ -3138,7 +3138,7 @@ function eqEmptyValue(cellValue) {
3138
3138
  ;// ./packages/ui/index.ts
3139
3139
 
3140
3140
 
3141
- const version = "4.12.0-beta.2";
3141
+ const version = "4.12.0-beta.3";
3142
3142
  core_.VxeUI.version = version;
3143
3143
  core_.VxeUI.tableVersion = version;
3144
3144
  core_.VxeUI.setConfig({
@@ -3586,7 +3586,7 @@ var esnext_iterator_some = __webpack_require__(7550);
3586
3586
  const {
3587
3587
  log: log_log
3588
3588
  } = core_.VxeUI;
3589
- const log_version = `table v${"4.12.0-beta.2"}`;
3589
+ const log_version = `table v${"4.12.0-beta.3"}`;
3590
3590
  const warnLog = log_log.create('warn', log_version);
3591
3591
  const errLog = log_log.create('error', log_version);
3592
3592
  ;// ./packages/table/src/columnInfo.ts
@@ -13522,7 +13522,7 @@ const maxXWidth = 5e6;
13522
13522
  // warnLog('vxe.error.reqProp', ['table.show-overflow'])
13523
13523
  // }
13524
13524
  if (props.spanMethod) {
13525
- warnLog('vxe.error.scrollErrProp', ['table.span-method']);
13525
+ errLog('vxe.error.scrollErrProp', ['table.span-method']);
13526
13526
  }
13527
13527
  }
13528
13528
  handleReserveStatus();
@@ -28258,6 +28258,69 @@ function handleExportTreeSelectMethod(params) {
28258
28258
  } = params;
28259
28259
  return options.original ? getCellValue(row, column) : getTreeSelectCellValue(column.editRender || column.cellRender, params);
28260
28260
  }
28261
+ function handleNumberCell(renderOpts, params) {
28262
+ const {
28263
+ props = {},
28264
+ showNegativeStatus
28265
+ } = renderOpts;
28266
+ const {
28267
+ row,
28268
+ column
28269
+ } = params;
28270
+ const {
28271
+ type
28272
+ } = props;
28273
+ let cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
28274
+ let isNegative = false;
28275
+ if (!isEmptyValue(cellValue)) {
28276
+ const numberInputConfig = render_getConfig().numberInput || {};
28277
+ if (type === 'float') {
28278
+ const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
28279
+ const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 1);
28280
+ 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);
28281
+ if (!autoFill) {
28282
+ cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellValue);
28283
+ }
28284
+ if (showNegativeStatus) {
28285
+ if (cellValue < 0) {
28286
+ isNegative = true;
28287
+ }
28288
+ }
28289
+ } else if (type === 'amount') {
28290
+ const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
28291
+ const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 2);
28292
+ const showCurrency = handleDefaultValue(props.showCurrency, numberInputConfig.showCurrency, false);
28293
+ cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellValue);
28294
+ if (showNegativeStatus) {
28295
+ if (cellValue < 0) {
28296
+ isNegative = true;
28297
+ }
28298
+ }
28299
+ cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().commafy(cellValue, {
28300
+ digits
28301
+ });
28302
+ if (!autoFill) {
28303
+ const [iStr, dStr] = cellValue.split('.');
28304
+ if (dStr) {
28305
+ const dRest = dStr.replace(/0+$/, '');
28306
+ cellValue = dRest ? [iStr, '.', dRest].join('') : iStr;
28307
+ }
28308
+ }
28309
+ if (showCurrency) {
28310
+ cellValue = `${props.currencySymbol || numberInputConfig.currencySymbol || render_getI18n('vxe.numberInput.currencySymbol') || ''}${cellValue}`;
28311
+ }
28312
+ } else {
28313
+ if (showNegativeStatus) {
28314
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellValue) < 0) {
28315
+ isNegative = true;
28316
+ }
28317
+ }
28318
+ }
28319
+ }
28320
+ return getCellLabelVNs(renderOpts, params, cellValue, isNegative ? {
28321
+ class: 'is--negative'
28322
+ } : {});
28323
+ }
28261
28324
  /**
28262
28325
  * 表格 - 渲染器
28263
28326
  */
@@ -28329,72 +28392,13 @@ render_renderer.mixin({
28329
28392
  renderTableFilter: defaultFilterRender,
28330
28393
  tableFilterDefaultMethod: handleInputFilterMethod
28331
28394
  },
28395
+ FormatNumberInput: {
28396
+ renderTableDefault: handleNumberCell
28397
+ },
28332
28398
  VxeNumberInput: {
28333
28399
  tableAutoFocus: 'input',
28334
28400
  renderTableEdit: defaultEditRender,
28335
- renderTableCell(renderOpts, params) {
28336
- const {
28337
- props = {},
28338
- showNegativeStatus
28339
- } = renderOpts;
28340
- const {
28341
- row,
28342
- column
28343
- } = params;
28344
- const {
28345
- type
28346
- } = props;
28347
- let cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
28348
- let isNegative = false;
28349
- if (!isEmptyValue(cellValue)) {
28350
- const numberInputConfig = render_getConfig().numberInput || {};
28351
- if (type === 'float') {
28352
- const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
28353
- const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 1);
28354
- 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);
28355
- if (!autoFill) {
28356
- cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellValue);
28357
- }
28358
- if (showNegativeStatus) {
28359
- if (cellValue < 0) {
28360
- isNegative = true;
28361
- }
28362
- }
28363
- } else if (type === 'amount') {
28364
- const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
28365
- const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 2);
28366
- const showCurrency = handleDefaultValue(props.showCurrency, numberInputConfig.showCurrency, false);
28367
- cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellValue);
28368
- if (showNegativeStatus) {
28369
- if (cellValue < 0) {
28370
- isNegative = true;
28371
- }
28372
- }
28373
- cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().commafy(cellValue, {
28374
- digits
28375
- });
28376
- if (!autoFill) {
28377
- const [iStr, dStr] = cellValue.split('.');
28378
- if (dStr) {
28379
- const dRest = dStr.replace(/0+$/, '');
28380
- cellValue = dRest ? [iStr, '.', dRest].join('') : iStr;
28381
- }
28382
- }
28383
- if (showCurrency) {
28384
- cellValue = `${props.currencySymbol || numberInputConfig.currencySymbol || render_getI18n('vxe.numberInput.currencySymbol') || ''}${cellValue}`;
28385
- }
28386
- } else {
28387
- if (showNegativeStatus) {
28388
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellValue) < 0) {
28389
- isNegative = true;
28390
- }
28391
- }
28392
- }
28393
- }
28394
- return getCellLabelVNs(renderOpts, params, cellValue, isNegative ? {
28395
- class: 'is--negative'
28396
- } : {});
28397
- },
28401
+ renderTableCell: handleNumberCell,
28398
28402
  renderTableFooter(renderOpts, params) {
28399
28403
  const {
28400
28404
  props = {}
@@ -28537,11 +28541,20 @@ render_renderer.mixin({
28537
28541
  tableFilterDefaultMethod: handleFilterMethod,
28538
28542
  tableExportMethod: handleExportSelectMethod
28539
28543
  },
28544
+ /**
28545
+ * 已废弃,被 FormatSelect 替换
28546
+ * @deprecated
28547
+ */
28540
28548
  formatOption: {
28541
28549
  renderTableDefault(renderOpts, params) {
28542
28550
  return getCellLabelVNs(renderOpts, params, getSelectCellValue(renderOpts, params));
28543
28551
  }
28544
28552
  },
28553
+ FormatSelect: {
28554
+ renderTableDefault(renderOpts, params) {
28555
+ return getCellLabelVNs(renderOpts, params, getSelectCellValue(renderOpts, params));
28556
+ }
28557
+ },
28545
28558
  VxeTreeSelect: {
28546
28559
  tableAutoFocus: 'input',
28547
28560
  renderTableEdit: defaultTableOrTreeSelectEditRender,
@@ -28550,11 +28563,20 @@ render_renderer.mixin({
28550
28563
  },
28551
28564
  tableExportMethod: handleExportTreeSelectMethod
28552
28565
  },
28566
+ /**
28567
+ * 已废弃,被 FormatTreeSelect 替换
28568
+ * @deprecated
28569
+ */
28553
28570
  formatTree: {
28554
28571
  renderTableDefault(renderOpts, params) {
28555
28572
  return getCellLabelVNs(renderOpts, params, getTreeSelectCellValue(renderOpts, params));
28556
28573
  }
28557
28574
  },
28575
+ FormatTreeSelect: {
28576
+ renderTableDefault(renderOpts, params) {
28577
+ return getCellLabelVNs(renderOpts, params, getTreeSelectCellValue(renderOpts, params));
28578
+ }
28579
+ },
28558
28580
  VxeTableSelect: {
28559
28581
  tableAutoFocus: 'input',
28560
28582
  renderTableEdit: defaultTableOrTreeSelectEditRender,