vxe-table 4.1.2 → 4.1.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.
@@ -2231,12 +2231,12 @@ var _default = (0, _vue.defineComponent)({
2231
2231
  if (transform) {
2232
2232
  // 树结构自动转换
2233
2233
  if (process.env.NODE_ENV === 'development') {
2234
- if (!treeOpts.rowtKey) {
2235
- (0, _utils.errLog)('vxe.error.reqProp', ['tree-config.rowtKey']);
2234
+ if (!treeOpts.rowField) {
2235
+ (0, _utils.errLog)('vxe.error.reqProp', ['tree-config.rowField']);
2236
2236
  }
2237
2237
 
2238
- if (!treeOpts.parentKey) {
2239
- (0, _utils.errLog)('vxe.error.reqProp', ['tree-config.parentKey']);
2238
+ if (!treeOpts.parentField) {
2239
+ (0, _utils.errLog)('vxe.error.reqProp', ['tree-config.parentField']);
2240
2240
  }
2241
2241
 
2242
2242
  if (!treeOpts.children) {
@@ -2251,8 +2251,8 @@ var _default = (0, _vue.defineComponent)({
2251
2251
  }
2252
2252
 
2253
2253
  treeData = _xeUtils.default.toArrayTree(fullData, {
2254
- key: treeOpts.rowtKey,
2255
- parentKey: treeOpts.parentKey,
2254
+ key: treeOpts.rowField,
2255
+ parentKey: treeOpts.parentField,
2256
2256
  children: treeOpts.children
2257
2257
  });
2258
2258
  fullData = treeData.slice(0);
@@ -2610,9 +2610,11 @@ var _default = (0, _vue.defineComponent)({
2610
2610
  var treeFullData = internalData.treeFullData;
2611
2611
  var treeOpts = computeTreeOpts.value;
2612
2612
  var fullData = [];
2613
+ var expandMaps = new Map();
2613
2614
 
2614
2615
  _xeUtils.default.eachTree(treeFullData, function (row, index, items, path, parent) {
2615
- if (!parent || $xetable.findRowIndexOf(treeExpandeds, parent) > -1) {
2616
+ if (!parent || expandMaps.has(parent) && $xetable.findRowIndexOf(treeExpandeds, parent) > -1) {
2617
+ expandMaps.set(row, 1);
2616
2618
  fullData.push(row);
2617
2619
  }
2618
2620
  }, treeOpts);
@@ -2864,18 +2866,15 @@ var _default = (0, _vue.defineComponent)({
2864
2866
 
2865
2867
  if (oRow && row) {
2866
2868
  if (field) {
2867
- _xeUtils.default.set(oRow, field, _xeUtils.default.get(record || row, field));
2868
- } else {
2869
- if (record) {
2870
- tableSourceData[rowIndex] = record;
2869
+ var newValue = _xeUtils.default.get(record || row, field);
2871
2870
 
2872
- _xeUtils.default.clear(row, undefined);
2871
+ _xeUtils.default.set(row, field, newValue);
2873
2872
 
2874
- Object.assign(row, tablePrivateMethods.defineField(Object.assign({}, record)));
2875
- tablePrivateMethods.cacheRowMap(true);
2876
- } else {
2877
- _xeUtils.default.destructuring(oRow, _xeUtils.default.clone(row, true));
2878
- }
2873
+ _xeUtils.default.set(oRow, field, newValue);
2874
+ } else {
2875
+ var newRecord = _xeUtils.default.clone(__assign({}, record), true);
2876
+
2877
+ _xeUtils.default.destructuring(oRow, Object.assign(row, newRecord));
2879
2878
  }
2880
2879
  }
2881
2880
 
@@ -2899,8 +2898,8 @@ var _default = (0, _vue.defineComponent)({
2899
2898
  fullAllDataRowIdData = internalData.fullAllDataRowIdData;
2900
2899
  var treeOpts = computeTreeOpts.value;
2901
2900
  var children = treeOpts.children;
2902
- var rest = fullAllDataRowIdData[(0, _util.getRowid)($xetable, row)];
2903
- var parentLevel = rest ? rest.level : 0;
2901
+ var parentRest = fullAllDataRowIdData[(0, _util.getRowid)($xetable, row)];
2902
+ var parentLevel = parentRest ? parentRest.level : 0;
2904
2903
  return tableMethods.createData(childRecords).then(function (rows) {
2905
2904
  if (keepSource) {
2906
2905
  var rowid_1 = (0, _util.getRowid)($xetable, row);
@@ -3961,12 +3960,13 @@ var _default = (0, _vue.defineComponent)({
3961
3960
  * @param {Row} row 行对象
3962
3961
  */
3963
3962
  setCurrentRow: function setCurrentRow(row) {
3963
+ var rowOpts = computeRowOpts.value;
3964
3964
  var el = refElem.value;
3965
3965
  tableMethods.clearCurrentRow();
3966
3966
  tableMethods.clearCurrentColumn();
3967
3967
  reactData.currentRow = row;
3968
3968
 
3969
- if (props.highlightCurrentRow) {
3969
+ if (rowOpts.isCurrent || props.highlightCurrentRow) {
3970
3970
  if (el) {
3971
3971
  _xeUtils.default.arrayEach(el.querySelectorAll("[rowid=\"" + (0, _util.getRowid)($xetable, row) + "\"]"), function (elem) {
3972
3972
  return (0, _dom.addClass)(elem, 'row--current');
@@ -4027,7 +4027,8 @@ var _default = (0, _vue.defineComponent)({
4027
4027
  * 用于当前行,获取当前行的数据
4028
4028
  */
4029
4029
  getCurrentRecord: function getCurrentRecord() {
4030
- return props.highlightCurrentRow ? reactData.currentRow : null;
4030
+ var rowOpts = computeRowOpts.value;
4031
+ return rowOpts.isCurrent || props.highlightCurrentRow ? reactData.currentRow : null;
4031
4032
  },
4032
4033
 
4033
4034
  /**
@@ -4069,7 +4070,8 @@ var _default = (0, _vue.defineComponent)({
4069
4070
  return null;
4070
4071
  },
4071
4072
  getCurrentColumn: function getCurrentColumn() {
4072
- return props.highlightCurrentColumn ? reactData.currentColumn : null;
4073
+ var columnOpts = computeColumnOpts.value;
4074
+ return columnOpts.isCurrent || props.highlightCurrentColumn ? reactData.currentColumn : null;
4073
4075
  },
4074
4076
 
4075
4077
  /**
@@ -5081,6 +5083,7 @@ var _default = (0, _vue.defineComponent)({
5081
5083
  var editOpts = computeEditOpts.value;
5082
5084
  var treeOpts = computeTreeOpts.value;
5083
5085
  var menuList = computeMenuList.value;
5086
+ var rowOpts = computeRowOpts.value;
5084
5087
  var selected = editStore.selected,
5085
5088
  actived = editStore.actived;
5086
5089
  var keyCode = evnt.keyCode;
@@ -5161,7 +5164,7 @@ var _default = (0, _vue.defineComponent)({
5161
5164
  keyCtxTimeout = setTimeout(function () {
5162
5165
  internalData._keyCtx = false;
5163
5166
  }, 1000);
5164
- } else if (isEnter && !isAltKey && keyboardConfig && keyboardOpts.isEnter && (selected.row || actived.row || treeConfig && highlightCurrentRow && currentRow)) {
5167
+ } else if (isEnter && !isAltKey && keyboardConfig && keyboardOpts.isEnter && (selected.row || actived.row || treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow)) {
5165
5168
  // 退出选中
5166
5169
  if (hasCtrlKey) {
5167
5170
  // 如果是激活编辑状态,则取消编辑
@@ -5193,7 +5196,7 @@ var _default = (0, _vue.defineComponent)({
5193
5196
  $xetable.moveSelected(targetArgs, isLeftArrow, false, isRightArrow, true, evnt);
5194
5197
  }
5195
5198
  }
5196
- } else if (treeConfig && highlightCurrentRow && currentRow) {
5199
+ } else if (treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow) {
5197
5200
  // 如果是树形表格当前行回车移动到子节点
5198
5201
  var childrens = currentRow[treeOpts.children];
5199
5202
 
@@ -5219,7 +5222,7 @@ var _default = (0, _vue.defineComponent)({
5219
5222
  // 如果按下了方向键
5220
5223
  if (selected.row && selected.column) {
5221
5224
  $xetable.moveSelected(selected.args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt);
5222
- } else if ((isUpArrow || isDwArrow) && highlightCurrentRow) {
5225
+ } else if ((isUpArrow || isDwArrow) && (rowOpts.isCurrent || highlightCurrentRow)) {
5223
5226
  // 当前行按键上下移动
5224
5227
  $xetable.moveCurrentRow(isUpArrow, isDwArrow, evnt);
5225
5228
  }
@@ -5231,7 +5234,7 @@ var _default = (0, _vue.defineComponent)({
5231
5234
  } else if (actived.row || actived.column) {
5232
5235
  $xetable.moveTabSelected(actived.args, hasShiftKey, evnt);
5233
5236
  }
5234
- } else if (keyboardConfig && (0, _utils.isEnableConf)(editConfig) && (isDel || (treeConfig && highlightCurrentRow && currentRow ? isBack && keyboardOpts.isArrow : isBack))) {
5237
+ } else if (keyboardConfig && (0, _utils.isEnableConf)(editConfig) && (isDel || (treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow ? isBack && keyboardOpts.isArrow : isBack))) {
5235
5238
  if (!isEditStatus) {
5236
5239
  var delMethod = keyboardOpts.delMethod,
5237
5240
  backMethod = keyboardOpts.backMethod; // 如果是删除键
@@ -5265,7 +5268,7 @@ var _default = (0, _vue.defineComponent)({
5265
5268
  // 如果按下 del 键,更新表尾数据
5266
5269
  tableMethods.updateFooter();
5267
5270
  }
5268
- } else if (isBack && keyboardOpts.isArrow && treeConfig && highlightCurrentRow && currentRow) {
5271
+ } else if (isBack && keyboardOpts.isArrow && treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow) {
5269
5272
  // 如果树形表格回退键关闭当前行返回父节点
5270
5273
  var parentRow_1 = _xeUtils.default.findTree(internalData.afterFullData, function (item) {
5271
5274
  return item === currentRow;
@@ -6110,6 +6113,7 @@ var _default = (0, _vue.defineComponent)({
6110
6113
  triggerHeaderCellClickEvent: function triggerHeaderCellClickEvent(evnt, params) {
6111
6114
  var _lastResizeTime = internalData._lastResizeTime;
6112
6115
  var sortOpts = computeSortOpts.value;
6116
+ var columnOpts = computeColumnOpts.value;
6113
6117
  var column = params.column;
6114
6118
  var cell = evnt.currentTarget;
6115
6119
 
@@ -6129,7 +6133,7 @@ var _default = (0, _vue.defineComponent)({
6129
6133
  cell: cell
6130
6134
  }, params), evnt);
6131
6135
 
6132
- if (props.highlightCurrentColumn) {
6136
+ if (columnOpts.isCurrent || props.highlightCurrentColumn) {
6133
6137
  tableMethods.setCurrentColumn(column);
6134
6138
  }
6135
6139
  },
@@ -6153,6 +6157,7 @@ var _default = (0, _vue.defineComponent)({
6153
6157
  var treeOpts = computeTreeOpts.value;
6154
6158
  var radioOpts = computeRadioOpts.value;
6155
6159
  var checkboxOpts = computeCheckboxOpts.value;
6160
+ var rowOpts = computeRowOpts.value;
6156
6161
  var actived = editStore.actived;
6157
6162
  var row = params.row,
6158
6163
  column = params.column;
@@ -6190,7 +6195,7 @@ var _default = (0, _vue.defineComponent)({
6190
6195
  if (!triggerTreeNode) {
6191
6196
  if (!triggerExpandNode) {
6192
6197
  // 如果是高亮行
6193
- if (highlightCurrentRow) {
6198
+ if (rowOpts.isCurrent || highlightCurrentRow) {
6194
6199
  if (!triggerCheckbox && !triggerRadio) {
6195
6200
  tablePrivateMethods.triggerCurrentRowEvent(evnt, params);
6196
6201
  }
@@ -6584,6 +6589,7 @@ var _default = (0, _vue.defineComponent)({
6584
6589
  tablePrivateMethods.handleTableData();
6585
6590
  tablePrivateMethods.updateScrollYSpace();
6586
6591
  },
6592
+ updateVirtualTreeData: updateVirtualTreeData,
6587
6593
 
6588
6594
  /**
6589
6595
  * 处理固定列的显示状态
@@ -7234,6 +7240,8 @@ var _default = (0, _vue.defineComponent)({
7234
7240
  rightList = columnStore.rightList;
7235
7241
  var tooltipOpts = computeTooltipOpts.value;
7236
7242
  var treeOpts = computeTreeOpts.value;
7243
+ var rowOpts = computeRowOpts.value;
7244
+ var columnOpts = computeColumnOpts.value;
7237
7245
  var vSize = computeSize.value;
7238
7246
  var tableBorder = computeTableBorder.value;
7239
7247
  var mouseOpts = computeMouseOpts.value;
@@ -7242,7 +7250,7 @@ var _default = (0, _vue.defineComponent)({
7242
7250
  var isMenu = computeIsMenu.value;
7243
7251
  return (0, _vue.h)('div', {
7244
7252
  ref: refElem,
7245
- class: ['vxe-table', 'vxe-table--render-default', "tid_" + xID, "border--" + tableBorder, (_a = {}, _a["size--" + vSize] = vSize, _a['vxe-editable'] = !!editConfig, _a['cell--highlight'] = highlightCell, _a['cell--selected'] = mouseConfig && mouseOpts.selected, _a['cell--area'] = mouseConfig && mouseOpts.area, _a['row--highlight'] = highlightHoverRow, _a['column--highlight'] = highlightHoverColumn, _a['is--header'] = showHeader, _a['is--footer'] = showFooter, _a['is--group'] = isGroup, _a['is--tree-line'] = treeConfig && treeOpts.line, _a['is--fixed-left'] = leftList.length, _a['is--fixed-right'] = rightList.length, _a['is--animat'] = !!props.animat, _a['is--round'] = props.round, _a['is--stripe'] = !treeConfig && stripe, _a['is--loading'] = loading, _a['is--empty'] = !loading && !tableData.length, _a['is--scroll-y'] = overflowY, _a['is--scroll-x'] = overflowX, _a['is--virtual-x'] = scrollXLoad, _a['is--virtual-y'] = scrollYLoad, _a)],
7253
+ class: ['vxe-table', 'vxe-table--render-default', "tid_" + xID, "border--" + tableBorder, (_a = {}, _a["size--" + vSize] = vSize, _a['vxe-editable'] = !!editConfig, _a['cell--highlight'] = highlightCell, _a['cell--selected'] = mouseConfig && mouseOpts.selected, _a['cell--area'] = mouseConfig && mouseOpts.area, _a['row--highlight'] = rowOpts.isHover || highlightHoverRow, _a['column--highlight'] = columnOpts.isHover || highlightHoverColumn, _a['is--header'] = showHeader, _a['is--footer'] = showFooter, _a['is--group'] = isGroup, _a['is--tree-line'] = treeConfig && treeOpts.line, _a['is--fixed-left'] = leftList.length, _a['is--fixed-right'] = rightList.length, _a['is--animat'] = !!props.animat, _a['is--round'] = props.round, _a['is--stripe'] = !treeConfig && stripe, _a['is--loading'] = loading, _a['is--empty'] = !loading && !tableData.length, _a['is--scroll-y'] = overflowY, _a['is--scroll-x'] = overflowX, _a['is--virtual-x'] = scrollXLoad, _a['is--virtual-y'] = scrollYLoad, _a)],
7246
7254
  onKeydown: keydownEvent
7247
7255
  }, [
7248
7256
  /**