vxe-table 3.19.14 → 3.19.16

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.
@@ -1 +1 @@
1
- Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _xeUtils=_interopRequireDefault(require("xe-utils")),_util=require("../../src/util");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function calcMaxHeight(e){var t=e.$xeGantt,s=e.customStore;let i=e.$refs.refElem,l=0;(i=t&&(e=t.$refs.refGanttContainerElem)?e:i)&&(l=i.clientHeight-28),s.maxHeight=Math.max(88,l)}function emitCustomEvent(e,t,s){(e.$xeGrid||e.$xeGantt||e).dispatchEvent("custom",{type:t},s)}var _default=exports.default={methods:{_getCustomVisible(){var e=this.customStore;return e.visible},_openCustom(){let e=this;var{initStore:t,customStore:s}=e;return s.visible=!0,t.custom=!0,e.handleUpdateCustomColumn(),e.checkCustomStatus(),calcMaxHeight(e),e.$nextTick().then(()=>calcMaxHeight(e))},_closeCustom(){var e=this,t=e.customStore,s=e.computeCustomOpts;return t.visible&&(t.visible=!1,s.immediate||e.handleCustom()),e.$nextTick()},_toggleCustom(){var e=this,t=e.customStore;return t.visible?e.closeCustom():e.openCustom()},_saveCustom(){var e=this,t=e,s=e;let{customColumnList:i,aggHandleFields:l,rowGroupList:o}=t,{allowVisible:r,allowSort:u,allowFixed:a,allowResizable:n,allowGroup:d,allowValues:m}=e.computeCustomOpts;return _xeUtils.default.eachTree(i,(e,t,s,i,l)=>{l?e.fixed=l.fixed:(u&&(e.renderSortNumber=t+1),a&&(e.fixed=e.renderFixed)),n&&e.renderVisible&&(!e.children||e.children.length)&&e.renderResizeWidth!==e.renderWidth&&(e.resizeWidth=e.renderResizeWidth,e.renderWidth=e.renderResizeWidth),r&&(e.visible=e.renderVisible),d&&m&&(e.aggFunc=e.renderAggFn)}),t.isCustomStatus=!0,d&&m&&e.handlePivotTableAggregateData&&(o.length!==l.length||o.some((e,t)=>e.field!==l[t])?l.length?e.setRowGroups(l):e.clearRowGroups():m&&e.handleUpdateAggData()),u&&(s.collectColumn=i),e.saveCustomStore("confirm")},_cancelCustom(){var e=this,{customColumnList:t,customStore:s}=e;let{oldSortMaps:l,oldFixedMaps:o,oldVisibleMaps:r}=s,{allowVisible:u,allowSort:a,allowFixed:n,allowResizable:d}=e.computeCustomOpts;return _xeUtils.default.eachTree(t,e=>{var t=e.getKey(),s=!!r[t],i=o[t]||"";u&&(e.renderVisible=s,e.visible=s),n&&(e.renderFixed=i,e.fixed=i),a&&(e.renderSortNumber=l[t]||0),d&&(e.renderResizeWidth=e.renderWidth)},{children:"children"}),e.$nextTick()},_resetCustom(e){let t=this;var s=t,i=t;let l=s.rowGroupList;var o=i.collectColumn;let r=t.computeCustomOpts.checkMethod,u=Object.assign({visible:!0,resizable:!0===e,fixed:!0===e,sort:!0===e,aggFunc:!0===e},e),a=[];return _xeUtils.default.eachTree(o,e=>{u.resizable&&(e.resizeWidth=0),u.fixed&&(e.fixed=e.defaultFixed),u.sort&&(e.renderSortNumber=e.sortNumber,e.parentId=e.defaultParentId),r&&!r({$table:t,column:e})||(e.visible=e.defaultVisible),u.aggFunc&&(e.aggFunc=e.defaultAggFunc,e.renderAggFn=e.defaultAggFunc),e.renderResizeWidth=e.renderWidth,a.push(e)}),u.sort&&(e=_xeUtils.default.toArrayTree(_xeUtils.default.orderBy(a,"renderSortNumber"),{key:"id",parentKey:"parentId",children:"children"}),i.collectColumn=e,i.tableFullColumn=(0,_util.getColumnList)(e)),s.isCustomStatus=!1,t.handleCustom().then(()=>{var e;u.aggFunc&&t.handlePivotTableAggregateData&&(((e=t.computeRowGroupFields)||l).length?e&&e.length?t.setRowGroups(e):t.clearRowGroups():t.handleUpdateAggData()),t.saveCustomStore("reset")})},_toggleCustomAllCheckbox(){var e=this.customStore,e=!e.isAll;return this.setCustomAllCheckbox(e)},_setCustomAllCheckbox(e){let t=this;var s=t,i=s.customStore,l=s.customColumnList,o=t.computeCustomOpts;let{checkMethod:r,visibleMethod:u}=o,a=!!e;o.immediate?(_xeUtils.default.eachTree(l,e=>{u&&!u({$table:t,column:e})||r&&!r({$table:t,column:e})||(e.visible=a,e.renderVisible=a,e.halfVisible=!1)}),i.isAll=a,s.isCustomStatus=!0,t.handleCustom(),t.saveCustomStore("update:visible")):(_xeUtils.default.eachTree(l,e=>{u&&!u({$table:t,column:e})||r&&!r({$table:t,column:e})||(e.renderVisible=a,e.halfVisible=!1)}),i.isAll=a),t.checkCustomStatus()},checkCustomStatus(){let t=this;var e=t.customStore,s=t.collectColumn;let i=t.computeCustomOpts.checkMethod;e.isAll=s.every(e=>!!i&&!i({$table:t,column:e})||e.renderVisible),e.isIndeterminate=!e.isAll&&s.some(e=>(!i||i({$table:t,column:e}))&&(e.renderVisible||e.halfVisible))},emitCustomEvent(e,t){this.dispatchEvent("custom",{type:e},t)},triggerCustomEvent(e){var t=this.customStore;t.visible?(this.closeCustom(),emitCustomEvent(this,"close",e)):(t.btnEl=e.target,this.openCustom(),emitCustomEvent(this,"open",e))},customOpenEvent(e){var t=this.customStore;t.visible&&(t.activeBtn=!0,t.btnEl=e.target,this.openCustom(),emitCustomEvent(this,"open",e))},customCloseEvent(e){var t=this.customStore;t.visible&&(t.activeBtn=!1,this.closeCustom(),emitCustomEvent(this,"close",e))},handleUpdateCustomColumn(){var e=this,t=e.customStore,o=this.collectColumn;if(t.visible){let s={},i={},l={};_xeUtils.default.eachTree(o,e=>{var t=e.getKey();e.renderFixed=e.fixed,e.renderVisible=e.visible,e.renderResizeWidth=e.renderWidth,s[t]=e.renderSortNumber,i[t]=e.fixed,l[t]=e.visible}),t.oldSortMaps=s,t.oldFixedMaps=i,t.oldVisibleMaps=l,e.customColumnList=o.slice(0)}}}};
1
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _xeUtils=_interopRequireDefault(require("xe-utils")),_util=require("../../src/util");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function calcMaxHeight(e){var t=e.$xeGantt,s=e.customStore;let i=e.$refs.refElem,l=0;(i=t&&(e=t.$refs.refGanttContainerElem)?e:i)&&(l=i.clientHeight-28),s.maxHeight=Math.max(88,l)}function emitCustomEvent(e,t,s){(e.$xeGrid||e.$xeGantt||e).dispatchEvent("custom",{type:t},s)}var _default=exports.default={methods:{_getCustomVisible(){var e=this.customStore;return e.visible},_openCustom(){let e=this;var{initStore:t,customStore:s}=e;return s.visible=!0,t.custom=!0,e.handleUpdateCustomColumn(),e.checkCustomStatus(),calcMaxHeight(e),e.$nextTick().then(()=>calcMaxHeight(e))},_closeCustom(){var e=this,t=e.customStore,s=e.computeCustomOpts;return t.visible&&(t.visible=!1,s.immediate||e.handleCustom()),e.$nextTick()},_toggleCustom(){var e=this,t=e.customStore;return t.visible?e.closeCustom():e.openCustom()},_saveCustom(){var e=this,t=e,s=e;let{customColumnList:i,aggHandleFields:l,rowGroupList:o}=t,{allowVisible:r,allowSort:u,allowFixed:a,allowResizable:n,allowGroup:d,allowValues:m}=e.computeCustomOpts;return _xeUtils.default.eachTree(i,(e,t,s,i,l)=>{l?e.fixed=l.fixed:(u&&(e.renderSortNumber=t+1),a&&(e.fixed=e.renderFixed)),!n||!e.renderVisible||e.children&&e.children.length||e.renderResizeWidth!==e.renderWidth&&(e.resizeWidth=e.renderResizeWidth,e.renderWidth=e.renderResizeWidth),r&&(e.visible=e.renderVisible),d&&m&&(e.aggFunc=e.renderAggFn)}),t.isCustomStatus=!0,d&&m&&e.handlePivotTableAggregateData&&(o.length!==l.length||o.some((e,t)=>e.field!==l[t])?l.length?e.setRowGroups(l):e.clearRowGroups():m&&e.handleUpdateAggData()),u&&(s.collectColumn=i),e.saveCustomStore("confirm")},_cancelCustom(){var e=this,{customColumnList:t,customStore:s}=e;let{oldSortMaps:l,oldFixedMaps:o,oldVisibleMaps:r}=s,{allowVisible:u,allowSort:a,allowFixed:n,allowResizable:d}=e.computeCustomOpts;return _xeUtils.default.eachTree(t,e=>{var t=e.getKey(),s=!!r[t],i=o[t]||"";u&&(e.renderVisible=s,e.visible=s),n&&(e.renderFixed=i,e.fixed=i),a&&(e.renderSortNumber=l[t]||0),d&&(e.renderResizeWidth=e.renderWidth)},{children:"children"}),e.$nextTick()},_resetCustom(e){let t=this;var s=t,i=t;let l=s.rowGroupList;var o=i.collectColumn;let r=t.computeCustomOpts.checkMethod,u=Object.assign({visible:!0,resizable:!0===e,fixed:!0===e,sort:!0===e,aggFunc:!0===e},e),a=[];return _xeUtils.default.eachTree(o,e=>{u.resizable&&(e.resizeWidth=0),u.fixed&&(e.fixed=e.defaultFixed),u.sort&&(e.renderSortNumber=e.sortNumber,e.parentId=e.defaultParentId),r&&!r({$table:t,column:e})||(e.visible=e.defaultVisible),u.aggFunc&&(e.aggFunc=e.defaultAggFunc,e.renderAggFn=e.defaultAggFunc),e.renderResizeWidth=e.renderWidth,a.push(e)}),u.sort&&(e=_xeUtils.default.toArrayTree(_xeUtils.default.orderBy(a,"renderSortNumber"),{key:"id",parentKey:"parentId",children:"children"}),i.collectColumn=e,i.tableFullColumn=(0,_util.getColumnList)(e)),s.isCustomStatus=!1,t.handleCustom().then(()=>{var e;u.aggFunc&&t.handlePivotTableAggregateData&&(((e=t.computeRowGroupFields)||l).length?e&&e.length?t.setRowGroups(e):t.clearRowGroups():t.handleUpdateAggData()),t.saveCustomStore("reset")})},_toggleCustomAllCheckbox(){var e=this.customStore,e=!e.isAll;return this.setCustomAllCheckbox(e)},_setCustomAllCheckbox(e){let t=this;var s=t,i=s.customStore,l=s.customColumnList,o=t.computeCustomOpts;let{checkMethod:r,visibleMethod:u}=o,a=!!e;o.immediate?(_xeUtils.default.eachTree(l,e=>{u&&!u({$table:t,column:e})||r&&!r({$table:t,column:e})||(e.visible=a,e.renderVisible=a,e.halfVisible=!1)}),i.isAll=a,s.isCustomStatus=!0,t.handleCustom(),t.saveCustomStore("update:visible")):(_xeUtils.default.eachTree(l,e=>{u&&!u({$table:t,column:e})||r&&!r({$table:t,column:e})||(e.renderVisible=a,e.halfVisible=!1)}),i.isAll=a),t.checkCustomStatus()},checkCustomStatus(){let t=this;var e=t.customStore,s=t.collectColumn;let i=t.computeCustomOpts.checkMethod;e.isAll=s.every(e=>!!i&&!i({$table:t,column:e})||e.renderVisible),e.isIndeterminate=!e.isAll&&s.some(e=>(!i||i({$table:t,column:e}))&&(e.renderVisible||e.halfVisible))},emitCustomEvent(e,t){this.dispatchEvent("custom",{type:e},t)},triggerCustomEvent(e){var t=this.customStore;t.visible?(this.closeCustom(),emitCustomEvent(this,"close",e)):(t.btnEl=e.target,this.openCustom(),emitCustomEvent(this,"open",e))},customOpenEvent(e){var t=this.customStore;t.visible&&(t.activeBtn=!0,t.btnEl=e.target,this.openCustom(),emitCustomEvent(this,"open",e))},customCloseEvent(e){var t=this.customStore;t.visible&&(t.activeBtn=!1,this.closeCustom(),emitCustomEvent(this,"close",e))},handleUpdateCustomColumn(){var e=this,t=e.customStore,o=this.collectColumn;if(t.visible){let s={},i={},l={};_xeUtils.default.eachTree(o,e=>{var t=e.getKey();e.renderFixed=e.fixed,e.renderVisible=e.visible,e.renderResizeWidth=e.renderWidth,s[t]=e.renderSortNumber,i[t]=e.fixed,l[t]=e.visible}),t.oldSortMaps=s,t.oldFixedMaps=i,t.oldVisibleMaps=l,e.customColumnList=o.slice(0)}}}};
@@ -3269,6 +3269,17 @@ function clearRowDragData($xeTable) {
3269
3269
  reactData.dragRow = null;
3270
3270
  reactData.dragCol = null;
3271
3271
  }
3272
+ function clearColDragData($xeTable) {
3273
+ const reactData = $xeTable;
3274
+ const internalData = $xeTable;
3275
+ const el = $xeTable.$refs.refElem;
3276
+ hideDropTip($xeTable);
3277
+ clearColDropOrigin($xeTable);
3278
+ (0, _anime.clearColAnimate)(el, ['.vxe-table--column']);
3279
+ internalData.prevDragToChild = false;
3280
+ reactData.dragRow = null;
3281
+ reactData.dragCol = null;
3282
+ }
3272
3283
  /**
3273
3284
  * 处理显示 tooltip
3274
3285
  * @param {Event} evnt 事件
@@ -4417,7 +4428,7 @@ function checkLastSyncScroll($xeTable, isRollX, isRollY) {
4417
4428
  });
4418
4429
  }
4419
4430
  $xeTable.updateCellAreas();
4420
- }, 200);
4431
+ }, 250);
4421
4432
  }
4422
4433
  const getWheelSpeed = lastScrollTime => {
4423
4434
  let multiple = 1;
@@ -5075,15 +5086,15 @@ const Methods = {
5075
5086
  if ($xeTable.isAggregateRecord(row)) {
5076
5087
  return $xeTable.$nextTick();
5077
5088
  }
5078
- const oRow = sourceDataRowIdData[(0, _util.getRowid)($xeTable, row)];
5089
+ const rowkey = (0, _util.getRowkey)($xeTable);
5090
+ const rowid = _xeUtils.default.get(row, rowkey);
5091
+ const oRow = sourceDataRowIdData[rowid];
5079
5092
  if (oRow && row) {
5080
5093
  if (field) {
5081
5094
  const newValue = _xeUtils.default.clone(_xeUtils.default.get(record || row, field), true);
5082
5095
  _xeUtils.default.set(row, field, newValue);
5083
5096
  _xeUtils.default.set(oRow, field, newValue);
5084
5097
  } else {
5085
- const rowkey = (0, _util.getRowkey)($xeTable);
5086
- const rowid = (0, _util.getRowid)($xeTable, row);
5087
5098
  const newRecord = _xeUtils.default.clone(Object.assign({}, record), true);
5088
5099
  _xeUtils.default.set(newRecord, rowkey, rowid);
5089
5100
  _xeUtils.default.destructuring(oRow, Object.assign(row, newRecord));
@@ -6087,7 +6098,6 @@ const Methods = {
6087
6098
  }
6088
6099
  }
6089
6100
  const rest = $xeTable.handleRowDragSwapEvent(null, true, dragRow, prevDragRow, dragPos || defPos, dragToChild === true);
6090
- clearRowDragData($xeTable);
6091
6101
  return rest;
6092
6102
  },
6093
6103
  /**
@@ -10106,6 +10116,8 @@ const Methods = {
10106
10116
  const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild;
10107
10117
  return Promise.resolve(dEndMethod ? dEndMethod(dragParams) : true).then(status => {
10108
10118
  if (!status) {
10119
+ clearRowDragData($xeTable);
10120
+ clearCrossTableDragStatus($xeTable);
10109
10121
  return errRest;
10110
10122
  }
10111
10123
  const dragRowid = (0, _util.getRowid)($xeTable, dragRow);
@@ -10233,6 +10245,8 @@ const Methods = {
10233
10245
  afterFullData.splice(nafIndex, 0, dragRow);
10234
10246
  tableFullData.splice(ntfIndex, 0, dragRow);
10235
10247
  }
10248
+ clearRowDragData($xeTable);
10249
+ clearCrossTableDragStatus($xeTable);
10236
10250
  $xeTable.handleTableData(treeConfig && transform);
10237
10251
  $xeTable.cacheRowMap(false);
10238
10252
  updateScrollYStatus($xeTable);
@@ -10340,6 +10354,11 @@ const Methods = {
10340
10354
  }
10341
10355
  return Promise.resolve(errRest);
10342
10356
  },
10357
+ handleCrossTableRowDragCancelEvent() {
10358
+ const $xeTable = this;
10359
+ clearRowDragData($xeTable);
10360
+ clearCrossTableDragStatus($xeTable);
10361
+ },
10343
10362
  /**
10344
10363
  * 处理跨表拖拽完成
10345
10364
  */
@@ -10517,6 +10536,13 @@ const Methods = {
10517
10536
  };
10518
10537
  Promise.resolve(dragEndMethod ? dragEndMethod(dragParams) : true).then(status => {
10519
10538
  if (!status) {
10539
+ if ($oldTable) {
10540
+ if ($oldTable.xID !== $xeTable.xID) {
10541
+ $oldTable.handleCrossTableRowDragCancelEvent(evnt);
10542
+ }
10543
+ }
10544
+ clearRowDragData($xeTable);
10545
+ clearCrossTableDragStatus($xeTable);
10520
10546
  return errRest;
10521
10547
  }
10522
10548
  let insertRest = Promise.resolve();
@@ -10667,8 +10693,6 @@ const Methods = {
10667
10693
  } else {
10668
10694
  $xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
10669
10695
  }
10670
- clearRowDragData($xeTable);
10671
- clearCrossTableDragStatus($xeTable);
10672
10696
  },
10673
10697
  handleRowDragDragoverEvent(evnt) {
10674
10698
  const $xeTable = this;
@@ -11012,6 +11036,8 @@ const Methods = {
11012
11036
  $xeTable.clearCopyCellArea();
11013
11037
  }
11014
11038
  }
11039
+ clearColDragData($xeTable);
11040
+ clearCrossTableDragStatus($xeTable);
11015
11041
  if (evnt) {
11016
11042
  $xeTable.dispatchEvent('column-dragend', {
11017
11043
  oldColumn: dragColumn,
@@ -11134,15 +11160,7 @@ const Methods = {
11134
11160
  prevDragPos,
11135
11161
  prevDragToChild
11136
11162
  } = internalData;
11137
- const el = $xeTable.$refs.refElem;
11138
11163
  $xeTable.handleColDragSwapEvent(evnt, true, dragCol, prevDragCol, prevDragPos, prevDragToChild);
11139
- hideDropTip($xeTable);
11140
- clearColDropOrigin($xeTable);
11141
- (0, _anime.clearColAnimate)(el, ['.vxe-table--column']);
11142
- internalData.prevDragToChild = false;
11143
- reactData.dragRow = null;
11144
- reactData.dragCol = null;
11145
- clearCrossTableDragStatus($xeTable);
11146
11164
  },
11147
11165
  handleHeaderCellDragDragoverEvent(evnt) {
11148
11166
  const $xeTable = this;