vxe-table 4.1.13 → 4.1.15-beta.2

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.
@@ -2023,6 +2023,19 @@ export default defineComponent({
2023
2023
  reactData.inputValue = val;
2024
2024
  changeValue();
2025
2025
  });
2026
+ watch(function () { return props.type; }, function () {
2027
+ // 切换类型是重置内置变量
2028
+ Object.assign(reactData, {
2029
+ inputValue: props.modelValue,
2030
+ datetimePanelValue: null,
2031
+ datePanelValue: null,
2032
+ datePanelLabel: '',
2033
+ datePanelType: 'day',
2034
+ selectMonth: null,
2035
+ currentDate: null
2036
+ });
2037
+ initValue();
2038
+ });
2026
2039
  watch(computeDateLabelFormat, function () {
2027
2040
  dateParseValue(reactData.datePanelValue);
2028
2041
  reactData.inputValue = reactData.datePanelLabel;
@@ -58,9 +58,12 @@ export default defineComponent({
58
58
  return 0;
59
59
  };
60
60
  var countTreeExpand = function (prevRow, params) {
61
+ var count = 1;
62
+ if (!prevRow) {
63
+ return count;
64
+ }
61
65
  var treeOpts = computeTreeOpts.value;
62
66
  var rowChildren = prevRow[treeOpts.children];
63
- var count = 1;
64
67
  if ($xetable.isTreeExpandByRow(prevRow)) {
65
68
  for (var index = 0; index < rowChildren.length; index++) {
66
69
  count += countTreeExpand(rowChildren[index], params);
@@ -68,13 +71,12 @@ export default defineComponent({
68
71
  }
69
72
  return count;
70
73
  };
71
- var calcTreeLine = function (params, items) {
72
- var $rowIndex = params.$rowIndex;
74
+ var calcTreeLine = function (params, items, rIndex) {
73
75
  var expandSize = 1;
74
- if ($rowIndex) {
75
- expandSize = countTreeExpand(items[$rowIndex - 1], params);
76
+ if (rIndex) {
77
+ expandSize = countTreeExpand(items[rIndex - 1], params);
76
78
  }
77
- return tableReactData.rowHeight * expandSize - ($rowIndex ? 1 : (12 - getOffsetSize()));
79
+ return tableReactData.rowHeight * expandSize - (rIndex ? 1 : (12 - getOffsetSize()));
78
80
  };
79
81
  // 滚动、拖动过程中不需要触发
80
82
  var isOperateMouse = function () {
@@ -82,11 +84,22 @@ export default defineComponent({
82
84
  var lastScrollTime = tableInternalData.lastScrollTime, _isResize = tableInternalData._isResize;
83
85
  return _isResize || (lastScrollTime && Date.now() < lastScrollTime + delayHover);
84
86
  };
85
- var renderLine = function (rowLevel, items, params) {
86
- var column = params.column;
87
+ var renderLine = function (params) {
88
+ var row = params.row, column = params.column;
87
89
  var treeConfig = tableProps.treeConfig;
88
90
  var treeOpts = computeTreeOpts.value;
89
91
  var slots = column.slots, treeNode = column.treeNode;
92
+ var fullAllDataRowIdData = tableInternalData.fullAllDataRowIdData;
93
+ var rowid = getRowid($xetable, row);
94
+ var rest = fullAllDataRowIdData[rowid];
95
+ var rLevel = 0;
96
+ var rIndex = 0;
97
+ var items = [];
98
+ if (rest) {
99
+ rLevel = rest.level;
100
+ rIndex = rest._index;
101
+ items = rest.items;
102
+ }
90
103
  if (slots && slots.line) {
91
104
  return $xetable.callSlot(slots.line, params);
92
105
  }
@@ -98,8 +111,8 @@ export default defineComponent({
98
111
  h('div', {
99
112
  class: 'vxe-tree--line',
100
113
  style: {
101
- height: calcTreeLine(params, items) + "px",
102
- left: (rowLevel * treeOpts.indent) + (rowLevel ? 2 - getOffsetSize() : 0) + 16 + "px"
114
+ height: calcTreeLine(params, items, rIndex) + "px",
115
+ left: (rLevel * treeOpts.indent) + (rLevel ? 2 - getOffsetSize() : 0) + 16 + "px"
103
116
  }
104
117
  })
105
118
  ])
@@ -242,7 +255,7 @@ export default defineComponent({
242
255
  }
243
256
  else {
244
257
  // 渲染单元格
245
- tdVNs.push.apply(tdVNs, __spreadArray(__spreadArray([], renderLine(rowLevel, items, params)), [h('div', {
258
+ tdVNs.push.apply(tdVNs, __spreadArray(__spreadArray([], renderLine(params)), [h('div', {
246
259
  class: ['vxe-cell', {
247
260
  'c--title': showTitle,
248
261
  'c--tooltip': showTooltip,
@@ -296,7 +309,6 @@ export default defineComponent({
296
309
  tableData.forEach(function (row, $rowIndex) {
297
310
  var trOn = {};
298
311
  var rowIndex = $rowIndex;
299
- var _rowIndex = $xetable.getVTRowIndex(row);
300
312
  // 确保任何情况下 rowIndex 都精准指向真实 data 索引
301
313
  rowIndex = $xetable.getRowIndex(row);
302
314
  // 事件绑定
@@ -318,9 +330,11 @@ export default defineComponent({
318
330
  var rest = fullAllDataRowIdData[rowid];
319
331
  var rowLevel = 0;
320
332
  var seq = -1;
333
+ var _rowIndex = 0;
321
334
  if (rest) {
322
335
  rowLevel = rest.level;
323
336
  seq = rest.seq;
337
+ _rowIndex = rest._index;
324
338
  }
325
339
  var params = { $table: $xetable, seq: seq, rowid: rowid, fixed: fixedType, type: renderType, level: rowLevel, row: row, rowIndex: rowIndex, $rowIndex: $rowIndex, _rowIndex: _rowIndex };
326
340
  // 处理新增状态
@@ -3598,6 +3598,7 @@ export default defineComponent({
3598
3598
  return handleAsyncTreeExpandChilds(row);
3599
3599
  }).then(function () {
3600
3600
  if (transform) {
3601
+ handleVirtualTreeToList();
3601
3602
  return tablePrivateMethods.handleTableData();
3602
3603
  }
3603
3604
  }).then(function () {
@@ -3691,9 +3692,11 @@ export default defineComponent({
3691
3692
  return tablePrivateMethods.handleTableData().then(function () {
3692
3693
  if (transform) {
3693
3694
  handleVirtualTreeToList();
3695
+ return tablePrivateMethods.handleTableData();
3694
3696
  }
3697
+ }).then(function () {
3695
3698
  if (isExists) {
3696
- tableMethods.recalculate();
3699
+ return tableMethods.recalculate();
3697
3700
  }
3698
3701
  });
3699
3702
  },
@@ -10,6 +10,7 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import { nextTick } from 'vue';
13
+ import GlobalConfig from '../../v-x-e-table/src/conf';
13
14
  import XEUtils from 'xe-utils';
14
15
  import { getFuncText, eqEmptyValue } from '../../tools/utils';
15
16
  import { scrollToView } from '../../tools/dom';
@@ -167,7 +168,7 @@ var validatorHook = {
167
168
  }
168
169
  });
169
170
  }).catch(function (firstErrParams) {
170
- return new Promise(function (resolve) {
171
+ return new Promise(function (resolve, reject) {
171
172
  var finish = function () {
172
173
  nextTick(function () {
173
174
  if (cb) {
@@ -175,7 +176,13 @@ var validatorHook = {
175
176
  resolve();
176
177
  }
177
178
  else {
178
- resolve(validRest);
179
+ if (GlobalConfig.validToReject === 'obsolete') {
180
+ // 已废弃,校验失败将不会执行catch
181
+ reject(validRest);
182
+ }
183
+ else {
184
+ resolve(validRest);
185
+ }
179
186
  }
180
187
  });
181
188
  };
package/lib/index.umd.js CHANGED
@@ -17140,6 +17140,21 @@ function toStringTimeDate(str) {
17140
17140
  reactData.inputValue = val;
17141
17141
  changeValue();
17142
17142
  });
17143
+ Object(external_commonjs_vue_commonjs2_vue_root_Vue_["watch"])(function () {
17144
+ return props.type;
17145
+ }, function () {
17146
+ // 切换类型是重置内置变量
17147
+ Object.assign(reactData, {
17148
+ inputValue: props.modelValue,
17149
+ datetimePanelValue: null,
17150
+ datePanelValue: null,
17151
+ datePanelLabel: '',
17152
+ datePanelType: 'day',
17153
+ selectMonth: null,
17154
+ currentDate: null
17155
+ });
17156
+ initValue();
17157
+ });
17143
17158
  Object(external_commonjs_vue_commonjs2_vue_root_Vue_["watch"])(computeDateLabelFormat, function () {
17144
17159
  dateParseValue(reactData.datePanelValue);
17145
17160
  reactData.inputValue = reactData.datePanelLabel;
@@ -21570,6 +21585,7 @@ var Keyboard = {
21570
21585
 
21571
21586
 
21572
21587
 
21588
+
21573
21589
 
21574
21590
  /**
21575
21591
  * 校验规则
@@ -21753,14 +21769,19 @@ var validatorHook = {
21753
21769
  }
21754
21770
  });
21755
21771
  }).catch(function (firstErrParams) {
21756
- return new Promise(function (resolve) {
21772
+ return new Promise(function (resolve, reject) {
21757
21773
  var finish = function finish() {
21758
21774
  Object(external_commonjs_vue_commonjs2_vue_root_Vue_["nextTick"])(function () {
21759
21775
  if (cb) {
21760
21776
  cb(validRest);
21761
21777
  resolve();
21762
21778
  } else {
21763
- resolve(validRest);
21779
+ if (conf.validToReject === 'obsolete') {
21780
+ // 已废弃,校验失败将不会执行catch
21781
+ reject(validRest);
21782
+ } else {
21783
+ resolve(validRest);
21784
+ }
21764
21785
  }
21765
21786
  });
21766
21787
  };
@@ -30882,9 +30903,14 @@ var lineOffsetSizes = {
30882
30903
  };
30883
30904
 
30884
30905
  var countTreeExpand = function countTreeExpand(prevRow, params) {
30906
+ var count = 1;
30907
+
30908
+ if (!prevRow) {
30909
+ return count;
30910
+ }
30911
+
30885
30912
  var treeOpts = computeTreeOpts.value;
30886
30913
  var rowChildren = prevRow[treeOpts.children];
30887
- var count = 1;
30888
30914
 
30889
30915
  if ($xetable.isTreeExpandByRow(prevRow)) {
30890
30916
  for (var index = 0; index < rowChildren.length; index++) {
@@ -30895,15 +30921,14 @@ var lineOffsetSizes = {
30895
30921
  return count;
30896
30922
  };
30897
30923
 
30898
- var calcTreeLine = function calcTreeLine(params, items) {
30899
- var $rowIndex = params.$rowIndex;
30924
+ var calcTreeLine = function calcTreeLine(params, items, rIndex) {
30900
30925
  var expandSize = 1;
30901
30926
 
30902
- if ($rowIndex) {
30903
- expandSize = countTreeExpand(items[$rowIndex - 1], params);
30927
+ if (rIndex) {
30928
+ expandSize = countTreeExpand(items[rIndex - 1], params);
30904
30929
  }
30905
30930
 
30906
- return tableReactData.rowHeight * expandSize - ($rowIndex ? 1 : 12 - getOffsetSize());
30931
+ return tableReactData.rowHeight * expandSize - (rIndex ? 1 : 12 - getOffsetSize());
30907
30932
  }; // 滚动、拖动过程中不需要触发
30908
30933
 
30909
30934
 
@@ -30914,12 +30939,25 @@ var lineOffsetSizes = {
30914
30939
  return _isResize || lastScrollTime && Date.now() < lastScrollTime + delayHover;
30915
30940
  };
30916
30941
 
30917
- var renderLine = function renderLine(rowLevel, items, params) {
30918
- var column = params.column;
30942
+ var renderLine = function renderLine(params) {
30943
+ var row = params.row,
30944
+ column = params.column;
30919
30945
  var treeConfig = tableProps.treeConfig;
30920
30946
  var treeOpts = computeTreeOpts.value;
30921
30947
  var slots = column.slots,
30922
30948
  treeNode = column.treeNode;
30949
+ var fullAllDataRowIdData = tableInternalData.fullAllDataRowIdData;
30950
+ var rowid = util_getRowid($xetable, row);
30951
+ var rest = fullAllDataRowIdData[rowid];
30952
+ var rLevel = 0;
30953
+ var rIndex = 0;
30954
+ var items = [];
30955
+
30956
+ if (rest) {
30957
+ rLevel = rest.level;
30958
+ rIndex = rest._index;
30959
+ items = rest.items;
30960
+ }
30923
30961
 
30924
30962
  if (slots && slots.line) {
30925
30963
  return $xetable.callSlot(slots.line, params);
@@ -30931,8 +30969,8 @@ var lineOffsetSizes = {
30931
30969
  }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["h"])('div', {
30932
30970
  class: 'vxe-tree--line',
30933
30971
  style: {
30934
- height: "".concat(calcTreeLine(params, items), "px"),
30935
- left: "".concat(rowLevel * treeOpts.indent + (rowLevel ? 2 - getOffsetSize() : 0) + 16, "px")
30972
+ height: "".concat(calcTreeLine(params, items, rIndex), "px"),
30973
+ left: "".concat(rLevel * treeOpts.indent + (rLevel ? 2 - getOffsetSize() : 0) + 16, "px")
30936
30974
  }
30937
30975
  })])];
30938
30976
  }
@@ -31150,7 +31188,7 @@ var lineOffsetSizes = {
31150
31188
  }));
31151
31189
  } else {
31152
31190
  // 渲染单元格
31153
- tdVNs.push.apply(tdVNs, _toConsumableArray(renderLine(rowLevel, items, params)).concat([Object(external_commonjs_vue_commonjs2_vue_root_Vue_["h"])('div', {
31191
+ tdVNs.push.apply(tdVNs, _toConsumableArray(renderLine(params)).concat([Object(external_commonjs_vue_commonjs2_vue_root_Vue_["h"])('div', {
31154
31192
  class: ['vxe-cell', {
31155
31193
  'c--title': showTitle,
31156
31194
  'c--tooltip': showTooltip,
@@ -31210,10 +31248,7 @@ var lineOffsetSizes = {
31210
31248
  var rows = [];
31211
31249
  tableData.forEach(function (row, $rowIndex) {
31212
31250
  var trOn = {};
31213
- var rowIndex = $rowIndex;
31214
-
31215
- var _rowIndex = $xetable.getVTRowIndex(row); // 确保任何情况下 rowIndex 都精准指向真实 data 索引
31216
-
31251
+ var rowIndex = $rowIndex; // 确保任何情况下 rowIndex 都精准指向真实 data 索引
31217
31252
 
31218
31253
  rowIndex = $xetable.getRowIndex(row); // 事件绑定
31219
31254
 
@@ -31242,10 +31277,12 @@ var lineOffsetSizes = {
31242
31277
  var rest = fullAllDataRowIdData[rowid];
31243
31278
  var rowLevel = 0;
31244
31279
  var seq = -1;
31280
+ var _rowIndex = 0;
31245
31281
 
31246
31282
  if (rest) {
31247
31283
  rowLevel = rest.level;
31248
31284
  seq = rest.seq;
31285
+ _rowIndex = rest._index;
31249
31286
  }
31250
31287
 
31251
31288
  var params = {
@@ -36280,6 +36317,7 @@ var visibleStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_VISIBLE';
36280
36317
  return handleAsyncTreeExpandChilds(row);
36281
36318
  }).then(function () {
36282
36319
  if (transform) {
36320
+ handleVirtualTreeToList();
36283
36321
  return tablePrivateMethods.handleTableData();
36284
36322
  }
36285
36323
  }).then(function () {
@@ -36390,10 +36428,11 @@ var visibleStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_VISIBLE';
36390
36428
  return tablePrivateMethods.handleTableData().then(function () {
36391
36429
  if (transform) {
36392
36430
  handleVirtualTreeToList();
36431
+ return tablePrivateMethods.handleTableData();
36393
36432
  }
36394
-
36433
+ }).then(function () {
36395
36434
  if (isExists) {
36396
- tableMethods.recalculate();
36435
+ return tableMethods.recalculate();
36397
36436
  }
36398
36437
  });
36399
36438
  },