vxe-table 4.12.0-beta.2 → 4.12.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.
@@ -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(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
- },
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,
@@ -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.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${"4.12.0-beta.2"}`;
3
+ const version = `table v${"4.12.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
@@ -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.4";
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.4"}`;
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,22 @@ render_renderer.mixin({
28329
28392
  renderTableFilter: defaultFilterRender,
28330
28393
  tableFilterDefaultMethod: handleInputFilterMethod
28331
28394
  },
28332
- VxeNumberInput: {
28333
- tableAutoFocus: 'input',
28334
- renderTableEdit: defaultEditRender,
28335
- renderTableCell(renderOpts, params) {
28336
- const {
28337
- props = {},
28338
- showNegativeStatus
28339
- } = renderOpts;
28395
+ FormatNumberInput: {
28396
+ renderTableDefault: handleNumberCell,
28397
+ tableFilterDefaultMethod: handleInputFilterMethod,
28398
+ tableExportMethod(params) {
28340
28399
  const {
28341
28400
  row,
28342
28401
  column
28343
28402
  } = 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
- },
28403
+ const cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
28404
+ return cellValue;
28405
+ }
28406
+ },
28407
+ VxeNumberInput: {
28408
+ tableAutoFocus: 'input',
28409
+ renderTableEdit: defaultEditRender,
28410
+ renderTableCell: handleNumberCell,
28398
28411
  renderTableFooter(renderOpts, params) {
28399
28412
  const {
28400
28413
  props = {}
@@ -28537,11 +28550,22 @@ render_renderer.mixin({
28537
28550
  tableFilterDefaultMethod: handleFilterMethod,
28538
28551
  tableExportMethod: handleExportSelectMethod
28539
28552
  },
28553
+ /**
28554
+ * 已废弃,被 FormatSelect 替换
28555
+ * @deprecated
28556
+ */
28540
28557
  formatOption: {
28541
28558
  renderTableDefault(renderOpts, params) {
28542
28559
  return getCellLabelVNs(renderOpts, params, getSelectCellValue(renderOpts, params));
28543
28560
  }
28544
28561
  },
28562
+ FormatSelect: {
28563
+ renderTableDefault(renderOpts, params) {
28564
+ return getCellLabelVNs(renderOpts, params, getSelectCellValue(renderOpts, params));
28565
+ },
28566
+ tableFilterDefaultMethod: handleFilterMethod,
28567
+ tableExportMethod: handleExportSelectMethod
28568
+ },
28545
28569
  VxeTreeSelect: {
28546
28570
  tableAutoFocus: 'input',
28547
28571
  renderTableEdit: defaultTableOrTreeSelectEditRender,
@@ -28550,11 +28574,21 @@ render_renderer.mixin({
28550
28574
  },
28551
28575
  tableExportMethod: handleExportTreeSelectMethod
28552
28576
  },
28577
+ /**
28578
+ * 已废弃,被 FormatTreeSelect 替换
28579
+ * @deprecated
28580
+ */
28553
28581
  formatTree: {
28554
28582
  renderTableDefault(renderOpts, params) {
28555
28583
  return getCellLabelVNs(renderOpts, params, getTreeSelectCellValue(renderOpts, params));
28556
28584
  }
28557
28585
  },
28586
+ FormatTreeSelect: {
28587
+ renderTableDefault(renderOpts, params) {
28588
+ return getCellLabelVNs(renderOpts, params, getTreeSelectCellValue(renderOpts, params));
28589
+ },
28590
+ tableExportMethod: handleExportTreeSelectMethod
28591
+ },
28558
28592
  VxeTableSelect: {
28559
28593
  tableAutoFocus: 'input',
28560
28594
  renderTableEdit: defaultTableOrTreeSelectEditRender,