vxe-table 3.19.10 → 3.19.12

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 (41) hide show
  1. package/es/style.css +1 -1
  2. package/es/table/module/export/mixin.js +4 -7
  3. package/es/table/src/cell.js +8 -26
  4. package/es/table/src/columnInfo.js +4 -1
  5. package/es/table/src/methods.js +73 -3
  6. package/es/table/src/table.js +2 -0
  7. package/es/table/src/util.js +1 -0
  8. package/es/ui/index.js +1 -1
  9. package/es/ui/src/log.js +1 -1
  10. package/lib/index.umd.js +992 -14052
  11. package/lib/index.umd.min.js +1 -1
  12. package/lib/style.css +1 -1
  13. package/lib/table/module/export/mixin.js +4 -8
  14. package/lib/table/module/export/mixin.min.js +1 -1
  15. package/lib/table/src/cell.js +7 -28
  16. package/lib/table/src/cell.min.js +1 -1
  17. package/lib/table/src/columnInfo.js +5 -1
  18. package/lib/table/src/columnInfo.min.js +1 -1
  19. package/lib/table/src/methods.js +79 -3
  20. package/lib/table/src/methods.min.js +1 -1
  21. package/lib/table/src/table.js +2 -0
  22. package/lib/table/src/table.min.js +1 -1
  23. package/lib/table/src/util.js +1 -0
  24. package/lib/table/src/util.min.js +1 -1
  25. package/lib/ui/index.js +1 -1
  26. package/lib/ui/index.min.js +1 -1
  27. package/lib/ui/src/log.js +1 -1
  28. package/lib/ui/src/log.min.js +1 -1
  29. package/package.json +1 -1
  30. package/packages/table/module/export/mixin.ts +4 -7
  31. package/packages/table/src/cell.ts +8 -25
  32. package/packages/table/src/columnInfo.ts +5 -1
  33. package/packages/table/src/methods.ts +72 -4
  34. package/packages/table/src/table.ts +2 -0
  35. package/packages/table/src/util.ts +3 -0
  36. /package/es/{iconfont.1762412469745.ttf → iconfont.1762579776761.ttf} +0 -0
  37. /package/es/{iconfont.1762412469745.woff → iconfont.1762579776761.woff} +0 -0
  38. /package/es/{iconfont.1762412469745.woff2 → iconfont.1762579776761.woff2} +0 -0
  39. /package/lib/{iconfont.1762412469745.ttf → iconfont.1762579776761.ttf} +0 -0
  40. /package/lib/{iconfont.1762412469745.woff → iconfont.1762579776761.woff} +0 -0
  41. /package/lib/{iconfont.1762412469745.woff2 → iconfont.1762579776761.woff2} +0 -0
@@ -236,15 +236,12 @@ function getFooterCellValue($xeTable, opts, row, column) {
236
236
  if (!footLabelMethod) {
237
237
  footLabelMethod = columnOpts.footerExportMethod;
238
238
  }
239
- const _columnIndex = $xeTable.getVTColumnIndex(column);
240
239
  if (footLabelMethod) {
240
+ const _columnIndex = $xeTable.getVTColumnIndex(column);
241
241
  return footLabelMethod({ $table: $xeTable, items: row, itemIndex: _columnIndex, row, _columnIndex, column, options: opts });
242
242
  }
243
- // 兼容老模式
244
- if (XEUtils.isArray(row)) {
245
- return XEUtils.toValueString(row[_columnIndex]);
246
- }
247
- return XEUtils.get(row, column.field);
243
+ const cellValue = $xeTable.getFooterCellLabel(row, column);
244
+ return cellValue;
248
245
  }
249
246
  function getFooterData($xeTable, opts, footerTableData) {
250
247
  const $xeGrid = $xeTable.$xeGrid;
@@ -777,7 +774,7 @@ function handleImport($xeTable, content, opts) {
777
774
  if (opts.mode === 'insert' || opts.mode === 'insertBottom') {
778
775
  loadRest = $xeTable.insertAt(data, -1);
779
776
  }
780
- if (opts.mode === 'insertTop') {
777
+ else if (opts.mode === 'insertTop') {
781
778
  loadRest = $xeTable.insert(data);
782
779
  }
783
780
  else {
@@ -4,7 +4,7 @@ import { getFuncText, isEnableConf, formatText, eqEmptyValue } from '../../ui/sr
4
4
  import { updateCellTitle } from '../../ui/src/dom';
5
5
  import { createColumn, getRowid } from './util';
6
6
  import { getSlotVNs } from '../../ui/src/vn';
7
- const { getI18n, getIcon, renderer, formats, renderEmptyElement } = VxeUI;
7
+ const { getI18n, getIcon, renderer, renderEmptyElement } = VxeUI;
8
8
  function renderTitlePrefixIcon(h, params) {
9
9
  const { $table, column } = params;
10
10
  const titlePrefix = column.titlePrefix || column.titleHelp;
@@ -216,39 +216,21 @@ function renderTitleContent(h, params, content) {
216
216
  ];
217
217
  }
218
218
  function getFooterContent(h, params) {
219
- const { $table, column, _columnIndex, row, items } = params;
220
- const { slots, editRender, cellRender, footerFormatter } = column;
219
+ const { $table, column, row } = params;
220
+ const { slots, editRender, cellRender } = column;
221
221
  const renderOpts = editRender || cellRender;
222
222
  if (slots && slots.footer) {
223
223
  return $table.callSlot(slots.footer, params, h);
224
224
  }
225
- let itemValue = '';
226
- // 兼容老模式
227
- if (XEUtils.isArray(items)) {
228
- itemValue = items[_columnIndex];
229
- }
230
- else {
231
- itemValue = XEUtils.get(row, column.field);
232
- }
233
- const footParams = Object.assign(params, {
234
- itemValue
235
- });
236
- if (footerFormatter) {
237
- if (XEUtils.isFunction(footerFormatter)) {
238
- return `${footerFormatter(footParams)}`;
239
- }
240
- const isArr = XEUtils.isArray(footerFormatter);
241
- const gFormatOpts = isArr ? formats.get(footerFormatter[0]) : formats.get(footerFormatter);
242
- const footerFormatMethod = gFormatOpts ? gFormatOpts.tableFooterCellFormatMethod : null;
243
- if (footerFormatMethod) {
244
- return `${isArr ? footerFormatMethod(footParams, ...footerFormatter.slice(1)) : footerFormatMethod(footParams)}`;
245
- }
246
- return '';
247
- }
225
+ const itemValue = $table.getFooterCellLabel(row, column);
248
226
  if (renderOpts) {
249
227
  const compConf = renderer.get(renderOpts.name);
250
228
  const rtFooter = compConf ? (compConf.renderTableFooter || compConf.renderFooter) : null;
251
229
  if (rtFooter) {
230
+ const footParams = Object.assign(params, {
231
+ cellValue: itemValue,
232
+ itemValue
233
+ });
252
234
  return getSlotVNs(rtFooter.call($table, h, renderOpts, footParams));
253
235
  }
254
236
  }
@@ -11,7 +11,7 @@ export class ColumnInfo {
11
11
  const $xeGrid = $xeTable.$xeGrid;
12
12
  const $xeGantt = $xeTable.$xeGantt;
13
13
  const $xeGGWrapper = $xeGrid || $xeGantt;
14
- const { field, editRender, filterRender } = _vm;
14
+ const { field, editRender, filterRender, headerFormatter } = _vm;
15
15
  const colId = _vm.colId || XEUtils.uniqueId('col_');
16
16
  const proxyOpts = $xeGrid ? $xeGrid.computeProxyOpts : null;
17
17
  const formatter = _vm.formatter;
@@ -19,6 +19,9 @@ export class ColumnInfo {
19
19
  const flCompConf = isEnableConf(filterRender) ? renderer.get(filterRender.name) : null;
20
20
  const ctFilterOptions = flCompConf ? flCompConf.createTableFilterOptions : null;
21
21
  const filters = toFilters(_vm.filters, colId);
22
+ if (headerFormatter) {
23
+ errLog('vxe.error.notProp', ['header-formatter']);
24
+ }
22
25
  const types = ['seq', 'checkbox', 'radio', 'expand', 'html'];
23
26
  if (_vm.type && types.indexOf(_vm.type) === -1) {
24
27
  warnLog('vxe.error.errProp', [`type=${_vm.type}`, types.join(', ')]);
@@ -3254,9 +3254,9 @@ function loadTableData($xeTable, datas, isReset) {
3254
3254
  // if (!props.showOverflow) {
3255
3255
  // warnLog('vxe.error.reqProp', ['table.show-overflow'])
3256
3256
  // }
3257
- if (props.spanMethod) {
3258
- errLog('vxe.error.scrollErrProp', ['table.span-method']);
3259
- }
3257
+ // if (props.spanMethod) {
3258
+ // warnLog('vxe.error.scrollErrProp', ['span-method'])
3259
+ // }
3260
3260
  }
3261
3261
  handleReserveStatus($xeTable);
3262
3262
  $xeTable.checkSelectionStatus();
@@ -4905,6 +4905,76 @@ const Methods = {
4905
4905
  }
4906
4906
  return cellLabel;
4907
4907
  },
4908
+ getFooterCellLabel(row, fieldOrColumn) {
4909
+ const $xeTable = this;
4910
+ const reactData = $xeTable;
4911
+ const internalData = $xeTable;
4912
+ const column = handleFieldOrColumn($xeTable, fieldOrColumn);
4913
+ if (!column) {
4914
+ return null;
4915
+ }
4916
+ const { footerFormatter } = column;
4917
+ const _columnIndex = $xeTable.getVTColumnIndex(column);
4918
+ let itemValue = '';
4919
+ // 兼容老模式
4920
+ if (XEUtils.isArray(row)) {
4921
+ itemValue = row[_columnIndex];
4922
+ }
4923
+ else {
4924
+ itemValue = XEUtils.get(row, column.field);
4925
+ }
4926
+ let cellLabel = itemValue;
4927
+ if (footerFormatter) {
4928
+ let formatData;
4929
+ const { footerTableData } = reactData;
4930
+ const { footerFullDataRowData } = internalData;
4931
+ const colid = column.id;
4932
+ const $rowIndex = footerTableData.indexOf(row);
4933
+ let rowRest = null;
4934
+ if ($rowIndex > -1) {
4935
+ rowRest = footerFullDataRowData[$rowIndex];
4936
+ if (!rowRest) {
4937
+ rowRest = footerFullDataRowData[$rowIndex] = {};
4938
+ }
4939
+ formatData = rowRest.formatData;
4940
+ if (!formatData) {
4941
+ formatData = footerFullDataRowData[$rowIndex].formatData = {};
4942
+ }
4943
+ if (rowRest && formatData[colid]) {
4944
+ if (formatData[colid].value === itemValue) {
4945
+ return formatData[colid].label;
4946
+ }
4947
+ }
4948
+ }
4949
+ const footerFormatParams = {
4950
+ cellValue: itemValue,
4951
+ itemValue,
4952
+ row,
4953
+ items: row,
4954
+ $rowIndex,
4955
+ column,
4956
+ _columnIndex,
4957
+ columnIndex: $xeTable.getColumnIndex(column)
4958
+ };
4959
+ if (XEUtils.isString(footerFormatter)) {
4960
+ const gFormatOpts = formats.get(footerFormatter);
4961
+ const fcFormatMethod = gFormatOpts ? gFormatOpts.tableFooterCellFormatMethod : null;
4962
+ cellLabel = fcFormatMethod ? fcFormatMethod(footerFormatParams) : '';
4963
+ }
4964
+ else if (XEUtils.isArray(footerFormatter)) {
4965
+ const gFormatOpts = formats.get(footerFormatter[0]);
4966
+ const fcFormatMethod = gFormatOpts ? gFormatOpts.tableFooterCellFormatMethod : null;
4967
+ cellLabel = fcFormatMethod ? fcFormatMethod(footerFormatParams, ...footerFormatter.slice(1)) : '';
4968
+ }
4969
+ else {
4970
+ cellLabel = footerFormatter(footerFormatParams);
4971
+ }
4972
+ if (formatData) {
4973
+ formatData[colid] = { value: itemValue, label: cellLabel };
4974
+ }
4975
+ }
4976
+ return cellLabel;
4977
+ },
4908
4978
  /**
4909
4979
  * 检查是否为临时行数据
4910
4980
  */
@@ -1538,6 +1538,8 @@ export default {
1538
1538
  },
1539
1539
  footFlag() {
1540
1540
  const $xeTable = this;
1541
+ const internalData = $xeTable;
1542
+ internalData.footerFullDataRowData = {};
1541
1543
  $xeTable.updateFooter();
1542
1544
  },
1543
1545
  syncResize(value) {
@@ -76,6 +76,7 @@ export function createInternalData() {
76
76
  fullDataRowIdData: {},
77
77
  // 数据集(仅可视)
78
78
  visibleDataRowIdData: {},
79
+ footerFullDataRowData: {},
79
80
  // 渲染中缓存数据
80
81
  sourceDataRowIdData: {},
81
82
  fullColumnIdData: {},
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.19.10";
3
+ export const version = "3.19.12";
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.19.10"}`;
3
+ const version = `table v${"3.19.12"}`;
4
4
  export const warnLog = log.create('warn', version);
5
5
  export const errLog = log.create('error', version);