vxe-table 3.12.8 → 3.12.9

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.
@@ -61,11 +61,6 @@ export const convertHeaderColumnToRows = (originColumns) => {
61
61
  });
62
62
  return rows;
63
63
  };
64
- const lineOffsetSizes = {
65
- mini: 3,
66
- small: 2,
67
- medium: 1
68
- };
69
64
  export function restoreScrollLocation($xeTable, scrollLeft, scrollTop) {
70
65
  const internalData = $xeTable;
71
66
  return $xeTable.clearScroll().then(() => {
@@ -229,15 +224,21 @@ export function getColReMinWidth(params) {
229
224
  }
230
225
  return mWidth;
231
226
  }
227
+ const lineOffsetSizes = {
228
+ mini: 3,
229
+ small: 2,
230
+ medium: 1
231
+ };
232
232
  function countTreeExpand(prevRow, params) {
233
233
  let count = 1;
234
234
  if (!prevRow) {
235
235
  return count;
236
236
  }
237
237
  const { $table } = params;
238
- const { treeOpts } = $table;
238
+ const treeOpts = $table.computeTreeOpts;
239
+ const { transform, mapChildrenField } = treeOpts;
239
240
  const childrenField = treeOpts.children || treeOpts.childrenField;
240
- const rowChildren = prevRow[childrenField];
241
+ const rowChildren = prevRow[transform ? mapChildrenField : childrenField];
241
242
  if (rowChildren && $table.isTreeExpandByRow(prevRow)) {
242
243
  for (let index = 0; index < rowChildren.length; index++) {
243
244
  count += countTreeExpand(rowChildren[index], params);
@@ -245,17 +246,21 @@ function countTreeExpand(prevRow, params) {
245
246
  }
246
247
  return count;
247
248
  }
248
- export function getOffsetSize($xetable) {
249
- const vSize = $xetable.computeSize;
250
- return lineOffsetSizes[vSize] || 0;
249
+ export function getOffsetSize($xeTable) {
250
+ const vSize = $xeTable.computeSize;
251
+ if (vSize) {
252
+ return lineOffsetSizes[vSize] || 0;
253
+ }
254
+ return 0;
251
255
  }
252
- export function calcTreeLine(params, items, rIndex) {
256
+ export function calcTreeLine(params, prevRow) {
253
257
  const { $table } = params;
258
+ const tableReactData = $table;
254
259
  let expandSize = 1;
255
- if (rIndex) {
256
- expandSize = countTreeExpand(items[rIndex - 1], params);
260
+ if (prevRow) {
261
+ expandSize = countTreeExpand(prevRow, params);
257
262
  }
258
- return $table.rowHeight * expandSize - (rIndex ? 1 : (12 - getOffsetSize($table)));
263
+ return tableReactData.rowHeight * expandSize - (prevRow ? 1 : (12 - getOffsetSize($table)));
259
264
  }
260
265
  export function mergeBodyMethod(mergeList, _rowIndex, _columnIndex) {
261
266
  for (let mIndex = 0; mIndex < mergeList.length; mIndex++) {
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.12.8";
3
+ export const version = "3.12.9";
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.12.8"}`;
3
+ const version = `table v${"3.12.9"}`;
4
4
  export const warnLog = log.create('warn', version);
5
5
  export const errLog = log.create('error', version);
package/lib/index.umd.js CHANGED
@@ -2220,7 +2220,7 @@ function getClass(property, params) {
2220
2220
  ;// CONCATENATED MODULE: ./packages/ui/index.ts
2221
2221
 
2222
2222
 
2223
- const version = "3.12.8";
2223
+ const version = "3.12.9";
2224
2224
  core_.VxeUI.version = version;
2225
2225
  core_.VxeUI.tableVersion = version;
2226
2226
  core_.VxeUI.setConfig({
@@ -2814,7 +2814,7 @@ function isNodeElement(elem) {
2814
2814
  const {
2815
2815
  log: log_log
2816
2816
  } = core_.VxeUI;
2817
- const log_version = `table v${"3.12.8"}`;
2817
+ const log_version = `table v${"3.12.9"}`;
2818
2818
  const warnLog = log_log.create('warn', log_version);
2819
2819
  const errLog = log_log.create('error', log_version);
2820
2820
  ;// CONCATENATED MODULE: ./packages/table/src/columnInfo.ts
@@ -3055,11 +3055,6 @@ const convertHeaderColumnToRows = originColumns => {
3055
3055
  });
3056
3056
  return rows;
3057
3057
  };
3058
- const lineOffsetSizes = {
3059
- mini: 3,
3060
- small: 2,
3061
- medium: 1
3062
- };
3063
3058
  function restoreScrollLocation($xeTable, scrollLeft, scrollTop) {
3064
3059
  const internalData = $xeTable;
3065
3060
  return $xeTable.clearScroll().then(() => {
@@ -3255,6 +3250,11 @@ function getColReMinWidth(params) {
3255
3250
  }
3256
3251
  return mWidth;
3257
3252
  }
3253
+ const lineOffsetSizes = {
3254
+ mini: 3,
3255
+ small: 2,
3256
+ medium: 1
3257
+ };
3258
3258
  function countTreeExpand(prevRow, params) {
3259
3259
  let count = 1;
3260
3260
  if (!prevRow) {
@@ -3263,11 +3263,13 @@ function countTreeExpand(prevRow, params) {
3263
3263
  const {
3264
3264
  $table
3265
3265
  } = params;
3266
+ const treeOpts = $table.computeTreeOpts;
3266
3267
  const {
3267
- treeOpts
3268
- } = $table;
3268
+ transform,
3269
+ mapChildrenField
3270
+ } = treeOpts;
3269
3271
  const childrenField = treeOpts.children || treeOpts.childrenField;
3270
- const rowChildren = prevRow[childrenField];
3272
+ const rowChildren = prevRow[transform ? mapChildrenField : childrenField];
3271
3273
  if (rowChildren && $table.isTreeExpandByRow(prevRow)) {
3272
3274
  for (let index = 0; index < rowChildren.length; index++) {
3273
3275
  count += countTreeExpand(rowChildren[index], params);
@@ -3275,19 +3277,23 @@ function countTreeExpand(prevRow, params) {
3275
3277
  }
3276
3278
  return count;
3277
3279
  }
3278
- function getOffsetSize($xetable) {
3279
- const vSize = $xetable.computeSize;
3280
- return lineOffsetSizes[vSize] || 0;
3280
+ function getOffsetSize($xeTable) {
3281
+ const vSize = $xeTable.computeSize;
3282
+ if (vSize) {
3283
+ return lineOffsetSizes[vSize] || 0;
3284
+ }
3285
+ return 0;
3281
3286
  }
3282
- function calcTreeLine(params, items, rIndex) {
3287
+ function calcTreeLine(params, prevRow) {
3283
3288
  const {
3284
3289
  $table
3285
3290
  } = params;
3291
+ const tableReactData = $table;
3286
3292
  let expandSize = 1;
3287
- if (rIndex) {
3288
- expandSize = countTreeExpand(items[rIndex - 1], params);
3293
+ if (prevRow) {
3294
+ expandSize = countTreeExpand(prevRow, params);
3289
3295
  }
3290
- return $table.rowHeight * expandSize - (rIndex ? 1 : 12 - getOffsetSize($table));
3296
+ return tableReactData.rowHeight * expandSize - (prevRow ? 1 : 12 - getOffsetSize($table));
3291
3297
  }
3292
3298
  function mergeBodyMethod(mergeList, _rowIndex, _columnIndex) {
3293
3299
  for (let mIndex = 0; mIndex < mergeList.length; mIndex++) {
@@ -7646,47 +7652,6 @@ const Methods = {
7646
7652
  this.afterTreeFullData = tableTree;
7647
7653
  this.updateAfterDataIndex();
7648
7654
  },
7649
- updateTreeDataIndex() {
7650
- const $xeTable = this;
7651
- const props = $xeTable;
7652
- const internalData = $xeTable;
7653
- const {
7654
- treeConfig
7655
- } = props;
7656
- const {
7657
- afterFullData,
7658
- fullDataRowIdData,
7659
- fullAllDataRowIdData
7660
- } = internalData;
7661
- const treeOpts = $xeTable.computeTreeOpts;
7662
- if (treeConfig) {
7663
- if (treeOpts.transform) {
7664
- afterFullData.forEach((row, index) => {
7665
- const rowid = getRowid($xeTable, row);
7666
- const rowRest = fullAllDataRowIdData[rowid];
7667
- if (rowRest) {
7668
- rowRest._index = index;
7669
- } else {
7670
- const rest = {
7671
- row,
7672
- rowid,
7673
- seq: '-1',
7674
- index: -1,
7675
- $index: -1,
7676
- _index: index,
7677
- items: [],
7678
- parent: null,
7679
- level: 0,
7680
- height: 0,
7681
- oTop: 0
7682
- };
7683
- fullAllDataRowIdData[rowid] = rest;
7684
- fullDataRowIdData[rowid] = rest;
7685
- }
7686
- });
7687
- }
7688
- }
7689
- },
7690
7655
  /**
7691
7656
  * 预编译
7692
7657
  * 对渲染中的数据提前解析序号及索引。牺牲提前编译耗时换取渲染中额外损耗,使运行时更加流畅
@@ -7736,7 +7701,6 @@ const Methods = {
7736
7701
  }, {
7737
7702
  children: treeOpts.transform ? treeOpts.mapChildrenField : childrenField
7738
7703
  });
7739
- $xeTable.updateTreeDataIndex();
7740
7704
  } else {
7741
7705
  afterFullData.forEach((row, index) => {
7742
7706
  const rowid = getRowid($xeTable, row);
@@ -12934,7 +12898,7 @@ const Methods = {
12934
12898
  return this.$nextTick().then(() => {
12935
12899
  if (transform) {
12936
12900
  this.handleTableData();
12937
- this.updateTreeDataIndex();
12901
+ this.updateAfterDataIndex();
12938
12902
  return this.$nextTick();
12939
12903
  }
12940
12904
  });
@@ -13078,7 +13042,7 @@ const Methods = {
13078
13042
  return this.handleBaseTreeExpand(rows, expanded).then(() => {
13079
13043
  handleVirtualTreeToList($xeTable);
13080
13044
  this.handleTableData();
13081
- this.updateTreeDataIndex();
13045
+ this.updateAfterDataIndex();
13082
13046
  }).then(() => {
13083
13047
  return this.recalculate();
13084
13048
  }).then(() => {
@@ -14090,43 +14054,47 @@ const renderType = 'body';
14090
14054
  function isVMScrollProcess($xetable) {
14091
14055
  return $xetable._isResize || $xetable.lastScrollTime && Date.now() < $xetable.lastScrollTime + $xetable.delayHover;
14092
14056
  }
14093
- function renderLine(h, _vm, $xetable, params) {
14057
+ function renderLine(h, _vm, $xeTable, params) {
14058
+ const tableProps = $xeTable;
14059
+ const tableInternalData = $xeTable;
14094
14060
  const {
14095
14061
  row,
14096
14062
  column
14097
14063
  } = params;
14098
14064
  const {
14099
- afterFullData,
14100
- treeOpts,
14101
- treeConfig,
14102
- fullAllDataRowIdData
14103
- } = $xetable;
14065
+ afterFullData
14066
+ } = tableInternalData;
14067
+ const {
14068
+ treeConfig
14069
+ } = tableProps;
14070
+ const treeOpts = $xeTable.computeTreeOpts;
14104
14071
  const {
14105
14072
  slots,
14106
14073
  treeNode
14107
14074
  } = column;
14108
- const rowid = getRowid($xetable, row);
14075
+ const {
14076
+ fullAllDataRowIdData
14077
+ } = tableInternalData;
14078
+ if (slots && slots.line) {
14079
+ return $xeTable.callSlot(slots.line, params, h);
14080
+ }
14081
+ const rowid = getRowid($xeTable, row);
14109
14082
  const rest = fullAllDataRowIdData[rowid];
14110
14083
  let rLevel = 0;
14111
- let rIndex = 0;
14112
- let items = [];
14084
+ let prevRow = null;
14113
14085
  if (rest) {
14114
14086
  rLevel = rest.level;
14115
- rIndex = rest._index;
14116
- items = rest.items;
14117
- }
14118
- if (slots && slots.line) {
14119
- return $xetable.callSlot(slots.line, params, h);
14087
+ prevRow = rest.items[rest._index - 1];
14120
14088
  }
14121
- const isFirstRow = $xetable.eqRow(afterFullData[0], row);
14089
+ const isFirstRow = $xeTable.eqRow(afterFullData[0], row);
14122
14090
  if (treeConfig && treeNode && (treeOpts.showLine || treeOpts.line)) {
14123
14091
  return [h('div', {
14124
14092
  class: 'vxe-tree--line-wrapper'
14125
14093
  }, [h('div', {
14126
14094
  class: 'vxe-tree--line',
14127
14095
  style: {
14128
- height: `${isFirstRow ? 1 : calcTreeLine(params, items, rIndex)}px`,
14129
- left: `${rLevel * treeOpts.indent + (rLevel ? 2 - getOffsetSize($xetable) : 0) + 16}px`
14096
+ height: `${isFirstRow ? 1 : calcTreeLine(params, prevRow)}px`,
14097
+ left: `${rLevel * treeOpts.indent + (rLevel ? 2 - getOffsetSize($xeTable) : 0) + 16}px`
14130
14098
  }
14131
14099
  })])];
14132
14100
  }