vxe-table 4.19.4 → 4.19.5

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 (39) hide show
  1. package/dist/all.esm.js +88 -16
  2. package/dist/style.css +1 -1
  3. package/es/style.css +1 -1
  4. package/es/table/module/export/hook.js +3 -3
  5. package/es/table/src/cell.js +8 -7
  6. package/es/table/src/columnInfo.js +1 -4
  7. package/es/table/src/table.js +77 -0
  8. package/es/table/src/util.js +1 -0
  9. package/es/ui/index.js +1 -1
  10. package/es/ui/src/log.js +1 -1
  11. package/lib/index.umd.js +18 -21
  12. package/lib/index.umd.min.js +1 -1
  13. package/lib/style.css +1 -1
  14. package/lib/table/module/export/hook.js +3 -3
  15. package/lib/table/module/export/hook.min.js +1 -1
  16. package/lib/table/src/cell.js +8 -8
  17. package/lib/table/src/cell.min.js +1 -1
  18. package/lib/table/src/columnInfo.js +1 -5
  19. package/lib/table/src/columnInfo.min.js +1 -1
  20. package/lib/table/src/table.js +3 -3
  21. package/lib/table/src/table.min.js +1 -1
  22. package/lib/table/src/util.js +1 -0
  23. package/lib/table/src/util.min.js +1 -1
  24. package/lib/ui/index.js +1 -1
  25. package/lib/ui/index.min.js +1 -1
  26. package/lib/ui/src/log.js +1 -1
  27. package/lib/ui/src/log.min.js +1 -1
  28. package/package.json +2 -2
  29. package/packages/table/module/export/hook.ts +3 -3
  30. package/packages/table/src/cell.ts +8 -7
  31. package/packages/table/src/columnInfo.ts +1 -5
  32. package/packages/table/src/table.ts +75 -0
  33. package/packages/table/src/util.ts +1 -0
  34. /package/es/{iconfont.1779936744129.ttf → iconfont.1780200147870.ttf} +0 -0
  35. /package/es/{iconfont.1779936744129.woff → iconfont.1780200147870.woff} +0 -0
  36. /package/es/{iconfont.1779936744129.woff2 → iconfont.1780200147870.woff2} +0 -0
  37. /package/lib/{iconfont.1779936744129.ttf → iconfont.1780200147870.ttf} +0 -0
  38. /package/lib/{iconfont.1779936744129.woff → iconfont.1780200147870.woff} +0 -0
  39. /package/lib/{iconfont.1779936744129.woff2 → iconfont.1780200147870.woff2} +0 -0
package/dist/all.esm.js CHANGED
@@ -44,7 +44,7 @@ function eqEmptyValue(cellValue) {
44
44
  return cellValue === '' || XEUtils.eqNull(cellValue);
45
45
  }
46
46
 
47
- const version$1 = "4.19.4";
47
+ const version$1 = "4.19.5";
48
48
  VxeUI.version = version$1;
49
49
  VxeUI.tableVersion = version$1;
50
50
  VxeUI.setConfig({
@@ -556,7 +556,7 @@ const modal = {
556
556
  const defineVxeComponent = defineComponent;
557
557
 
558
558
  const { log } = VxeUI;
559
- const version = `table v${"4.19.4"}`;
559
+ const version = `table v${"4.19.5"}`;
560
560
  const warnLog = log.create('warn', version);
561
561
  const errLog = log.create('error', version);
562
562
 
@@ -568,16 +568,13 @@ class ColumnInfo {
568
568
  const $xeGrid = $xeTable.xeGrid;
569
569
  const $xeGantt = $xeTable.xeGantt;
570
570
  const $xeGGWrapper = $xeGrid || $xeGantt;
571
- const { field, editRender, filterRender, headerFormatter } = _vm;
571
+ const { field, editRender, filterRender } = _vm;
572
572
  const colId = _vm.colId || XEUtils.uniqueId('col_');
573
573
  const formatter = _vm.formatter;
574
574
  const visible = XEUtils.isBoolean(_vm.visible) ? _vm.visible : true;
575
575
  const flCompConf = isEnableConf(filterRender) ? renderer$b.get(filterRender.name) : null;
576
576
  const ctFilterOptions = flCompConf ? flCompConf.createTableFilterOptions : null;
577
577
  const filters = toFilters(_vm.filters, colId);
578
- if (headerFormatter) {
579
- errLog('vxe.error.notProp', ['header-formatter']);
580
- }
581
578
  const types = ['seq', 'checkbox', 'radio', 'expand', 'html'];
582
579
  if (_vm.type && types.indexOf(_vm.type) === -1) {
583
580
  warnLog('vxe.error.errProp', [`type=${_vm.type}`, types.join(', ')]);
@@ -1016,6 +1013,7 @@ function createInternalData$3() {
1016
1013
  // 数据集(仅可视)
1017
1014
  visibleDataRowIdData: {},
1018
1015
  keepUpdateFieldMaps: {},
1016
+ headerFullDataColData: {},
1019
1017
  footerFullDataRowData: {},
1020
1018
  // 渲染中缓存数据
1021
1019
  sourceDataRowIdData: {},
@@ -2300,7 +2298,7 @@ const Cell = {
2300
2298
  }
2301
2299
  }
2302
2300
  }
2303
- return renderTitleContent(params, formatText(column.getTitle(), 1));
2301
+ return renderTitleContent(params, $table.getHeaderCellLabel(column));
2304
2302
  },
2305
2303
  renderDefaultHeader(params) {
2306
2304
  return renderHeaderCellBaseVNs(params, Cell.renderHeaderTitle(params));
@@ -2312,7 +2310,7 @@ const Cell = {
2312
2310
  const tableInternalData = $table.internalData;
2313
2311
  const { isRowGroupStatus } = tableReactData;
2314
2312
  const { editConfig } = tableProps;
2315
- const { field, slots, editRender, cellRender, rowGroupNode, aggFunc, formatter } = column;
2313
+ const { field, slots, editRender, cellRender, rowGroupNode, aggFunc } = column;
2316
2314
  const isEnableEdit = editConfig && isEnableConf(editConfig);
2317
2315
  const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null;
2318
2316
  const cellRenderOpts = isEnableConf(cellRender) ? cellRender : null;
@@ -2388,8 +2386,9 @@ const Cell = {
2388
2386
  return renderCellBaseVNs(params, $table.callSlot(defaultSlot, params));
2389
2387
  }
2390
2388
  const renderOpts = editRenderOpts || cellRenderOpts;
2391
- // formatter > (renderTableCell | renderTableDefault)
2392
- if (renderOpts && !formatter) {
2389
+ // 如果是编辑表格:renderTableCell > formatter
2390
+ // 如果是查看表格:renderTableDefault > formatter
2391
+ if (renderOpts) {
2393
2392
  const compConf = renderer$a.get(renderOpts.name);
2394
2393
  if (compConf) {
2395
2394
  const renderFn = editRenderOpts ? (compConf.renderTableCell || compConf.renderCell) : (compConf.renderTableDefault || compConf.renderDefault);
@@ -2560,7 +2559,7 @@ const Cell = {
2560
2559
  const { $table, column } = params;
2561
2560
  const { slots } = column;
2562
2561
  const headerSlot = slots ? slots.header : null;
2563
- return renderHeaderCellBaseVNs(params, renderTitleContent(params, headerSlot ? $table.callSlot(headerSlot, params) : formatText(column.getTitle(), 1)));
2562
+ return renderHeaderCellBaseVNs(params, renderTitleContent(params, headerSlot ? $table.callSlot(headerSlot, params) : $table.getHeaderCellLabel(column)));
2564
2563
  },
2565
2564
  renderSeqCell(params) {
2566
2565
  const { $table, column } = params;
@@ -2595,7 +2594,7 @@ const Cell = {
2595
2594
  : [
2596
2595
  h('span', {
2597
2596
  class: 'vxe-radio--label'
2598
- }, titleSlot ? $table.callSlot(titleSlot, params) : formatText(column.getTitle(), 1))
2597
+ }, titleSlot ? $table.callSlot(titleSlot, params) : $table.getHeaderCellLabel(column))
2599
2598
  ]));
2600
2599
  },
2601
2600
  renderRadioCell(params) {
@@ -2664,7 +2663,7 @@ const Cell = {
2664
2663
  const titleSlot = slots ? slots.title : null;
2665
2664
  const checkboxOpts = computeCheckboxOpts.value;
2666
2665
  const { checkStrictly, showHeader, headerTitle } = checkboxOpts;
2667
- const colTitle = column.getTitle();
2666
+ const colTitle = $table.getHeaderCellLabel(column);
2668
2667
  const ons = {};
2669
2668
  if (!isHidden) {
2670
2669
  ons.onClick = (evnt) => {
@@ -10415,7 +10414,7 @@ hooks$4.add('tableExportModule', {
10415
10414
  function getHeaderTitle(opts, column) {
10416
10415
  const columnOpts = computeColumnOpts.value;
10417
10416
  const headExportMethod = column.headerExportMethod || columnOpts.headerExportMethod;
10418
- return headExportMethod ? headExportMethod({ column, options: opts, $table: $xeTable }) : ((opts.isTitle ? column.getTitle() : column.field) || '');
10417
+ return headExportMethod ? headExportMethod({ column, options: opts, $table: $xeTable }) : ((opts.isTitle ? $xeTable.getHeaderCellLabel(column) : column.field) || '');
10419
10418
  }
10420
10419
  const toBooleanValue = (cellValue) => {
10421
10420
  return XEUtils.isBoolean(cellValue) ? (cellValue ? 'TRUE' : 'FALSE') : cellValue;
@@ -11069,12 +11068,12 @@ hooks$4.add('tableExportModule', {
11069
11068
  const tableTitleMaps = {};
11070
11069
  tableFullColumn.forEach((column) => {
11071
11070
  const field = column.field;
11072
- const title = column.getTitle();
11071
+ const title = $xeTable.getHeaderCellLabel(column);
11073
11072
  if (field) {
11074
11073
  tableFieldMaps[field] = column;
11075
11074
  }
11076
11075
  if (title) {
11077
- tableTitleMaps[column.getTitle()] = column;
11076
+ tableTitleMaps[title] = column;
11078
11077
  }
11079
11078
  });
11080
11079
  const tableConf = {
@@ -18671,6 +18670,7 @@ var VxeTableComponent = defineVxeComponent({
18671
18670
  loadScrollXData();
18672
18671
  }
18673
18672
  });
18673
+ $xeTable.clearHeaderFormatterCache();
18674
18674
  $xeTable.clearMergeCells();
18675
18675
  $xeTable.clearMergeFooterItems();
18676
18676
  $xeTable.handleTableData(true);
@@ -19912,6 +19912,77 @@ var VxeTableComponent = defineVxeComponent({
19912
19912
  }
19913
19913
  return nextTick();
19914
19914
  },
19915
+ getHeaderCellLabel(fieldOrColumn) {
19916
+ const column = handleFieldOrColumn($xeTable, fieldOrColumn);
19917
+ if (!column) {
19918
+ return null;
19919
+ }
19920
+ const { headerFormatter } = column;
19921
+ const _columnIndex = $xeTable.getVTColumnIndex(column);
19922
+ let cellLabel = column.getTitle();
19923
+ if (headerFormatter) {
19924
+ const { headerFullDataColData } = internalData;
19925
+ const colid = column.id;
19926
+ let colRest = headerFullDataColData[colid];
19927
+ if (!colRest) {
19928
+ colRest = headerFullDataColData[colid] = {};
19929
+ }
19930
+ const formatObj = colRest.formatObj;
19931
+ if (formatObj && formatObj.value === cellLabel) {
19932
+ return formatObj.label;
19933
+ }
19934
+ const headFormatParams = {
19935
+ $table: $xeTable,
19936
+ cellTitle: cellLabel,
19937
+ cellValue: cellLabel,
19938
+ column,
19939
+ _columnIndex,
19940
+ columnIndex: $xeTable.getColumnIndex(column)
19941
+ };
19942
+ if (XEUtils.isString(headerFormatter)) {
19943
+ const gFormatOpts = formats.get(headerFormatter);
19944
+ const fcFormatMethod = gFormatOpts ? gFormatOpts.tableHeaderCellFormatMethod : null;
19945
+ cellLabel = XEUtils.toValueString(fcFormatMethod ? fcFormatMethod(headFormatParams) : '');
19946
+ }
19947
+ else if (XEUtils.isArray(headerFormatter)) {
19948
+ const gFormatOpts = formats.get(headerFormatter[0]);
19949
+ const fcFormatMethod = gFormatOpts ? gFormatOpts.tableHeaderCellFormatMethod : null;
19950
+ cellLabel = XEUtils.toValueString(fcFormatMethod ? fcFormatMethod(headFormatParams, ...headerFormatter.slice(1)) : '');
19951
+ }
19952
+ else {
19953
+ cellLabel = XEUtils.toValueString(headerFormatter(headFormatParams));
19954
+ }
19955
+ }
19956
+ return cellLabel;
19957
+ },
19958
+ updateHeaderCellLabel(fieldOrColumn) {
19959
+ const column = handleFieldOrColumn($xeTable, fieldOrColumn);
19960
+ if (!column) {
19961
+ return '';
19962
+ }
19963
+ const { headerFullDataColData } = internalData;
19964
+ const colid = column.id;
19965
+ const colRest = headerFullDataColData[colid];
19966
+ if (colRest) {
19967
+ colRest.formatObj = undefined;
19968
+ }
19969
+ return $xeTable.getHeaderCellLabel(column);
19970
+ },
19971
+ clearHeaderFormatterCache(isUpdate) {
19972
+ const { tableColumn } = reactData;
19973
+ const { headerFullDataColData } = internalData;
19974
+ XEUtils.each(headerFullDataColData, (colRest) => {
19975
+ if (colRest.formatObj) {
19976
+ colRest.formatObj = undefined;
19977
+ }
19978
+ });
19979
+ if (isUpdate) {
19980
+ tableColumn.forEach(column => {
19981
+ $xeTable.getHeaderCellLabel(column);
19982
+ });
19983
+ }
19984
+ return nextTick();
19985
+ },
19915
19986
  getFooterCellLabel(row, fieldOrColumn) {
19916
19987
  const column = handleFieldOrColumn($xeTable, fieldOrColumn);
19917
19988
  if (!column) {
@@ -22123,6 +22194,7 @@ var VxeTableComponent = defineVxeComponent({
22123
22194
  footData = visibleColumn.length ? footerMethod({ columns: visibleColumn, data: afterFullData, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt }) : [];
22124
22195
  }
22125
22196
  reactData.footerTableData = footData;
22197
+ $xeTable.clearFooterFormatterCache();
22126
22198
  $xeTable.handleUpdateFooterMerge();
22127
22199
  $xeTable.dispatchEvent('footer-data-change', {
22128
22200
  visibleColumn: internalData.visibleColumn,