vxe-table 4.11.16 → 4.11.18

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.
Files changed (61) hide show
  1. package/es/grid/src/grid.js +15 -29
  2. package/es/style.css +1 -1
  3. package/es/table/module/custom/panel.js +19 -21
  4. package/es/table/module/edit/hook.js +3 -5
  5. package/es/table/module/export/export-panel.js +17 -19
  6. package/es/table/module/export/hook.js +5 -11
  7. package/es/table/module/export/import-panel.js +11 -13
  8. package/es/table/module/validator/hook.js +1 -3
  9. package/es/table/render/index.js +90 -61
  10. package/es/table/src/columnInfo.js +26 -28
  11. package/es/table/src/table.js +132 -89
  12. package/es/toolbar/src/toolbar.js +16 -24
  13. package/es/ui/index.js +1 -1
  14. package/es/ui/src/log.js +1 -1
  15. package/lib/grid/src/grid.js +15 -29
  16. package/lib/grid/src/grid.min.js +1 -1
  17. package/lib/index.umd.js +361 -312
  18. package/lib/index.umd.min.js +1 -1
  19. package/lib/style.css +1 -1
  20. package/lib/table/module/custom/panel.js +21 -23
  21. package/lib/table/module/custom/panel.min.js +1 -1
  22. package/lib/table/module/edit/hook.js +3 -5
  23. package/lib/table/module/edit/hook.min.js +1 -1
  24. package/lib/table/module/export/export-panel.js +17 -19
  25. package/lib/table/module/export/export-panel.min.js +1 -1
  26. package/lib/table/module/export/hook.js +5 -11
  27. package/lib/table/module/export/hook.min.js +1 -1
  28. package/lib/table/module/export/import-panel.js +11 -13
  29. package/lib/table/module/export/import-panel.min.js +1 -1
  30. package/lib/table/module/validator/hook.js +1 -3
  31. package/lib/table/module/validator/hook.min.js +1 -1
  32. package/lib/table/render/index.js +98 -66
  33. package/lib/table/render/index.min.js +1 -1
  34. package/lib/table/src/columnInfo.js +30 -32
  35. package/lib/table/src/columnInfo.min.js +1 -1
  36. package/lib/table/src/table.js +138 -85
  37. package/lib/table/src/table.min.js +1 -1
  38. package/lib/toolbar/src/toolbar.js +16 -24
  39. package/lib/toolbar/src/toolbar.min.js +1 -1
  40. package/lib/ui/index.js +1 -1
  41. package/lib/ui/index.min.js +1 -1
  42. package/lib/ui/src/log.js +1 -1
  43. package/lib/ui/src/log.min.js +1 -1
  44. package/package.json +2 -2
  45. package/packages/grid/src/grid.ts +16 -29
  46. package/packages/table/module/custom/panel.ts +19 -21
  47. package/packages/table/module/edit/hook.ts +3 -5
  48. package/packages/table/module/export/export-panel.ts +17 -19
  49. package/packages/table/module/export/hook.ts +5 -11
  50. package/packages/table/module/export/import-panel.ts +11 -13
  51. package/packages/table/module/validator/hook.ts +1 -3
  52. package/packages/table/render/index.ts +89 -59
  53. package/packages/table/src/columnInfo.ts +26 -28
  54. package/packages/table/src/table.ts +128 -85
  55. package/packages/toolbar/src/toolbar.ts +16 -24
  56. /package/es/{iconfont.1741051544689.ttf → iconfont.1741224125327.ttf} +0 -0
  57. /package/es/{iconfont.1741051544689.woff → iconfont.1741224125327.woff} +0 -0
  58. /package/es/{iconfont.1741051544689.woff2 → iconfont.1741224125327.woff2} +0 -0
  59. /package/lib/{iconfont.1741051544689.ttf → iconfont.1741224125327.ttf} +0 -0
  60. /package/lib/{iconfont.1741051544689.woff → iconfont.1741224125327.woff} +0 -0
  61. /package/lib/{iconfont.1741051544689.woff2 → iconfont.1741224125327.woff2} +0 -0
@@ -163,11 +163,9 @@ hooks.add('tableEditModule', {
163
163
  const parentLevel = parentRest ? parentRest.level : 0;
164
164
  newRecords.forEach((item, i) => {
165
165
  const rowid = getRowid($xeTable, item);
166
- if (process.env.NODE_ENV === 'development') {
167
- if (item[treeOpts.parentField]) {
168
- if (parentRow && item[treeOpts.parentField] !== parentRow[rowField]) {
169
- errLog('vxe.error.errProp', [`${treeOpts.parentField}=${item[treeOpts.parentField]}`, `${treeOpts.parentField}=${parentRow[rowField]}`]);
170
- }
166
+ if (item[treeOpts.parentField]) {
167
+ if (parentRow && item[treeOpts.parentField] !== parentRow[rowField]) {
168
+ errLog('vxe.error.errProp', [`${treeOpts.parentField}=${item[treeOpts.parentField]}`, `${treeOpts.parentField}=${parentRow[rowField]}`]);
171
169
  }
172
170
  }
173
171
  if (parentRow) {
@@ -493,25 +493,23 @@ export default defineComponent({
493
493
  })
494
494
  : createCommentVNode();
495
495
  };
496
- if (process.env.NODE_ENV === 'development') {
497
- nextTick(() => {
498
- if (!VxeUIModalComponent) {
499
- errLog('vxe.error.reqComp', ['vxe-modal']);
500
- }
501
- if (!VxeUIButtonComponent) {
502
- errLog('vxe.error.reqComp', ['vxe-button']);
503
- }
504
- if (!VxeUISelectComponent) {
505
- errLog('vxe.error.reqComp', ['vxe-select']);
506
- }
507
- if (!VxeUIInputComponent) {
508
- errLog('vxe.error.reqComp', ['vxe-input']);
509
- }
510
- if (!VxeUICheckboxComponent) {
511
- errLog('vxe.error.reqComp', ['vxe-checkbox']);
512
- }
513
- });
514
- }
496
+ nextTick(() => {
497
+ if (!VxeUIModalComponent) {
498
+ errLog('vxe.error.reqComp', ['vxe-modal']);
499
+ }
500
+ if (!VxeUIButtonComponent) {
501
+ errLog('vxe.error.reqComp', ['vxe-button']);
502
+ }
503
+ if (!VxeUISelectComponent) {
504
+ errLog('vxe.error.reqComp', ['vxe-select']);
505
+ }
506
+ if (!VxeUIInputComponent) {
507
+ errLog('vxe.error.reqComp', ['vxe-input']);
508
+ }
509
+ if (!VxeUICheckboxComponent) {
510
+ errLog('vxe.error.reqComp', ['vxe-checkbox']);
511
+ }
512
+ });
515
513
  return renderVN;
516
514
  }
517
515
  });
@@ -893,9 +893,7 @@ hooks.add('tableExportModule', {
893
893
  }
894
894
  else {
895
895
  // 不支持的浏览器
896
- if (process.env.NODE_ENV === 'development') {
897
- errLog('vxe.error.notExp');
898
- }
896
+ errLog('vxe.error.notExp');
899
897
  _importResolve({ status: true });
900
898
  }
901
899
  });
@@ -1512,10 +1510,8 @@ hooks.add('tableExportModule', {
1512
1510
  message: true,
1513
1511
  types: XEUtils.keys(exportOpts._typeMaps)
1514
1512
  }, exportOpts, options);
1515
- if (process.env.NODE_ENV === 'development') {
1516
- if (!props.exportConfig) {
1517
- errLog('vxe.error.reqProp', ['export-config']);
1518
- }
1513
+ if (!props.exportConfig) {
1514
+ errLog('vxe.error.reqProp', ['export-config']);
1519
1515
  }
1520
1516
  handleExportAndPrint(defOpts);
1521
1517
  },
@@ -1525,10 +1521,8 @@ hooks.add('tableExportModule', {
1525
1521
  const defOpts = Object.assign({
1526
1522
  message: true
1527
1523
  }, printOpts, options);
1528
- if (process.env.NODE_ENV === 'development') {
1529
- if (!props.printConfig) {
1530
- errLog('vxe.error.reqProp', ['print-config']);
1531
- }
1524
+ if (!props.printConfig) {
1525
+ errLog('vxe.error.reqProp', ['print-config']);
1532
1526
  }
1533
1527
  handleExportAndPrint(defOpts, true);
1534
1528
  }
@@ -218,19 +218,17 @@ export default defineComponent({
218
218
  })
219
219
  : createCommentVNode();
220
220
  };
221
- if (process.env.NODE_ENV === 'development') {
222
- nextTick(() => {
223
- if (!VxeUIModalComponent) {
224
- errLog('vxe.error.reqComp', ['vxe-modal']);
225
- }
226
- if (!VxeUIButtonComponent) {
227
- errLog('vxe.error.reqComp', ['vxe-button']);
228
- }
229
- if (!VxeUISelectComponent) {
230
- errLog('vxe.error.reqComp', ['vxe-select']);
231
- }
232
- });
233
- }
221
+ nextTick(() => {
222
+ if (!VxeUIModalComponent) {
223
+ errLog('vxe.error.reqComp', ['vxe-modal']);
224
+ }
225
+ if (!VxeUIButtonComponent) {
226
+ errLog('vxe.error.reqComp', ['vxe-button']);
227
+ }
228
+ if (!VxeUISelectComponent) {
229
+ errLog('vxe.error.reqComp', ['vxe-select']);
230
+ }
231
+ });
234
232
  return renderVN;
235
233
  }
236
234
  });
@@ -392,9 +392,7 @@ hooks.add('tableValidatorModule', {
392
392
  }
393
393
  }
394
394
  else {
395
- if (process.env.NODE_ENV === 'development') {
396
- errLog('vxe.error.notValidators', [validator]);
397
- }
395
+ errLog('vxe.error.notValidators', [validator]);
398
396
  }
399
397
  }
400
398
  else {
@@ -152,10 +152,8 @@ function getComponentOns(renderOpts, params, eFns) {
152
152
  const ons = {};
153
153
  XEUtils.objectEach(events, (func, key) => {
154
154
  ons[getOnName(key)] = function (...args) {
155
- if (process.env.NODE_ENV === 'development') {
156
- if (!XEUtils.isFunction(func)) {
157
- errLog('vxe.error.errFunc', [func]);
158
- }
155
+ if (!XEUtils.isFunction(func)) {
156
+ errLog('vxe.error.errFunc', [func]);
159
157
  }
160
158
  func(params, ...args);
161
159
  };
@@ -502,6 +500,63 @@ function handleExportTreeSelectMethod(params) {
502
500
  const { row, column, options } = params;
503
501
  return options.original ? getCellValue(row, column) : getTreeSelectCellValue(column.editRender || column.cellRender, params);
504
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
+ }
505
560
  /**
506
561
  * 表格 - 渲染器
507
562
  */
@@ -561,66 +616,19 @@ renderer.mixin({
561
616
  renderTableFilter: defaultFilterRender,
562
617
  tableFilterDefaultMethod: handleInputFilterMethod
563
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
+ },
564
628
  VxeNumberInput: {
565
629
  tableAutoFocus: 'input',
566
630
  renderTableEdit: defaultEditRender,
567
- renderTableCell(renderOpts, params) {
568
- const { props = {}, showNegativeStatus } = renderOpts;
569
- const { row, column } = params;
570
- const { type } = props;
571
- let cellValue = XEUtils.get(row, column.field);
572
- let isNegative = false;
573
- if (!isEmptyValue(cellValue)) {
574
- const numberInputConfig = getConfig().numberInput || {};
575
- if (type === 'float') {
576
- const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
577
- const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 1);
578
- cellValue = XEUtils.toFixed(XEUtils.floor(cellValue, digits), digits);
579
- if (!autoFill) {
580
- cellValue = XEUtils.toNumber(cellValue);
581
- }
582
- if (showNegativeStatus) {
583
- if (cellValue < 0) {
584
- isNegative = true;
585
- }
586
- }
587
- }
588
- else if (type === 'amount') {
589
- const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
590
- const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 2);
591
- const showCurrency = handleDefaultValue(props.showCurrency, numberInputConfig.showCurrency, false);
592
- cellValue = XEUtils.toNumber(cellValue);
593
- if (showNegativeStatus) {
594
- if (cellValue < 0) {
595
- isNegative = true;
596
- }
597
- }
598
- cellValue = XEUtils.commafy(cellValue, { digits });
599
- if (!autoFill) {
600
- const [iStr, dStr] = cellValue.split('.');
601
- if (dStr) {
602
- const dRest = dStr.replace(/0+$/, '');
603
- cellValue = dRest ? [iStr, '.', dRest].join('') : iStr;
604
- }
605
- }
606
- if (showCurrency) {
607
- cellValue = `${props.currencySymbol || numberInputConfig.currencySymbol || getI18n('vxe.numberInput.currencySymbol') || ''}${cellValue}`;
608
- }
609
- }
610
- else {
611
- if (showNegativeStatus) {
612
- if (XEUtils.toNumber(cellValue) < 0) {
613
- isNegative = true;
614
- }
615
- }
616
- }
617
- }
618
- return getCellLabelVNs(renderOpts, params, cellValue, isNegative
619
- ? {
620
- class: 'is--negative'
621
- }
622
- : {});
623
- },
631
+ renderTableCell: handleNumberCell,
624
632
  renderTableFooter(renderOpts, params) {
625
633
  const { props = {} } = renderOpts;
626
634
  const { row, column, _columnIndex } = params;
@@ -723,11 +731,22 @@ renderer.mixin({
723
731
  tableFilterDefaultMethod: handleFilterMethod,
724
732
  tableExportMethod: handleExportSelectMethod
725
733
  },
734
+ /**
735
+ * 已废弃,被 FormatSelect 替换
736
+ * @deprecated
737
+ */
726
738
  formatOption: {
727
739
  renderTableDefault(renderOpts, params) {
728
740
  return getCellLabelVNs(renderOpts, params, getSelectCellValue(renderOpts, params));
729
741
  }
730
742
  },
743
+ FormatSelect: {
744
+ renderTableDefault(renderOpts, params) {
745
+ return getCellLabelVNs(renderOpts, params, getSelectCellValue(renderOpts, params));
746
+ },
747
+ tableFilterDefaultMethod: handleFilterMethod,
748
+ tableExportMethod: handleExportSelectMethod
749
+ },
731
750
  VxeTreeSelect: {
732
751
  tableAutoFocus: 'input',
733
752
  renderTableEdit: defaultTableOrTreeSelectEditRender,
@@ -736,11 +755,21 @@ renderer.mixin({
736
755
  },
737
756
  tableExportMethod: handleExportTreeSelectMethod
738
757
  },
758
+ /**
759
+ * 已废弃,被 FormatTreeSelect 替换
760
+ * @deprecated
761
+ */
739
762
  formatTree: {
740
763
  renderTableDefault(renderOpts, params) {
741
764
  return getCellLabelVNs(renderOpts, params, getTreeSelectCellValue(renderOpts, params));
742
765
  }
743
766
  },
767
+ FormatTreeSelect: {
768
+ renderTableDefault(renderOpts, params) {
769
+ return getCellLabelVNs(renderOpts, params, getTreeSelectCellValue(renderOpts, params));
770
+ },
771
+ tableExportMethod: handleExportTreeSelectMethod
772
+ },
744
773
  VxeTableSelect: {
745
774
  tableAutoFocus: 'input',
746
775
  renderTableEdit: defaultTableOrTreeSelectEditRender,
@@ -11,37 +11,35 @@ export class ColumnInfo {
11
11
  const formatter = _vm.formatter;
12
12
  const visible = XEUtils.isBoolean(_vm.visible) ? _vm.visible : true;
13
13
  const { props: tableProps } = $xeTable;
14
- if (process.env.NODE_ENV === 'development') {
15
- const types = ['seq', 'checkbox', 'radio', 'expand', 'html'];
16
- if (_vm.type && types.indexOf(_vm.type) === -1) {
17
- warnLog('vxe.error.errProp', [`type=${_vm.type}`, types.join(', ')]);
18
- }
19
- if (XEUtils.isBoolean(_vm.cellRender) || (_vm.cellRender && !XEUtils.isObject(_vm.cellRender))) {
20
- warnLog('vxe.error.errProp', [`column.cell-render=${_vm.cellRender}`, 'column.cell-render={}']);
21
- }
22
- if (XEUtils.isBoolean(_vm.editRender) || (_vm.editRender && !XEUtils.isObject(_vm.editRender))) {
23
- warnLog('vxe.error.errProp', [`column.edit-render=${_vm.editRender}`, 'column.edit-render={}']);
14
+ const types = ['seq', 'checkbox', 'radio', 'expand', 'html'];
15
+ if (_vm.type && types.indexOf(_vm.type) === -1) {
16
+ warnLog('vxe.error.errProp', [`type=${_vm.type}`, types.join(', ')]);
17
+ }
18
+ if (XEUtils.isBoolean(_vm.cellRender) || (_vm.cellRender && !XEUtils.isObject(_vm.cellRender))) {
19
+ warnLog('vxe.error.errProp', [`column.cell-render=${_vm.cellRender}`, 'column.cell-render={}']);
20
+ }
21
+ if (XEUtils.isBoolean(_vm.editRender) || (_vm.editRender && !XEUtils.isObject(_vm.editRender))) {
22
+ warnLog('vxe.error.errProp', [`column.edit-render=${_vm.editRender}`, 'column.edit-render={}']);
23
+ }
24
+ if (_vm.type === 'expand') {
25
+ const { treeConfig } = tableProps;
26
+ const { computeTreeOpts } = $xeTable.getComputeMaps();
27
+ const treeOpts = computeTreeOpts.value;
28
+ if (treeConfig && (treeOpts.showLine || treeOpts.line)) {
29
+ errLog('vxe.error.errConflicts', ['tree-config.showLine', 'column.type=expand']);
24
30
  }
25
- if (_vm.type === 'expand') {
26
- const { treeConfig } = tableProps;
27
- const { computeTreeOpts } = $xeTable.getComputeMaps();
28
- const treeOpts = computeTreeOpts.value;
29
- if (treeConfig && (treeOpts.showLine || treeOpts.line)) {
30
- errLog('vxe.error.errConflicts', ['tree-config.showLine', 'column.type=expand']);
31
+ }
32
+ if (formatter) {
33
+ if (XEUtils.isString(formatter)) {
34
+ const gFormatOpts = formats.get(formatter) || XEUtils[formatter];
35
+ if (!gFormatOpts || !XEUtils.isFunction(gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod)) {
36
+ errLog('vxe.error.notFormats', [formatter]);
31
37
  }
32
38
  }
33
- if (formatter) {
34
- if (XEUtils.isString(formatter)) {
35
- const gFormatOpts = formats.get(formatter) || XEUtils[formatter];
36
- if (!gFormatOpts || !XEUtils.isFunction(gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod)) {
37
- errLog('vxe.error.notFormats', [formatter]);
38
- }
39
- }
40
- else if (XEUtils.isArray(formatter)) {
41
- const gFormatOpts = formats.get(formatter[0]) || XEUtils[formatter[0]];
42
- if (!gFormatOpts || !XEUtils.isFunction(gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod)) {
43
- errLog('vxe.error.notFormats', [formatter[0]]);
44
- }
39
+ else if (XEUtils.isArray(formatter)) {
40
+ const gFormatOpts = formats.get(formatter[0]) || XEUtils[formatter[0]];
41
+ if (!gFormatOpts || !XEUtils.isFunction(gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod)) {
42
+ errLog('vxe.error.notFormats', [formatter[0]]);
45
43
  }
46
44
  }
47
45
  }