vxe-table 3.10.14 → 3.10.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.
@@ -3012,7 +3012,14 @@ const Methods = {
3012
3012
  if (isClear ||
3013
3013
  // 如果点击了当前表格之外
3014
3014
  !getEventTargetNode(evnt, $el).flag) {
3015
- setTimeout(() => this.clearEdit(evnt));
3015
+ setTimeout(() => {
3016
+ this.clearEdit(evnt).then(() => {
3017
+ // 如果存在校验,点击了表格之外则清除
3018
+ if (!this.isActivated && editRules && validOpts.autoClear) {
3019
+ this.validErrorMaps = {};
3020
+ }
3021
+ });
3022
+ });
3016
3023
  }
3017
3024
  });
3018
3025
  }
@@ -6396,7 +6403,7 @@ const Methods = {
6396
6403
  }
6397
6404
  };
6398
6405
  // Module methods
6399
- const funcs = 'setFilter,openFilter,clearFilter,getCheckedFilters,updateFilterOptionStatus,closeMenu,setActiveCellArea,getActiveCellArea,getCellAreas,clearCellAreas,copyCellArea,cutCellArea,pasteCellArea,getCopyCellArea,getCopyCellAreas,clearCopyCellArea,setCellAreas,openFNR,openFind,openReplace,closeFNR,getSelectedCell,clearSelected,insert,insertAt,insertNextAt,remove,removeCheckboxRow,removeRadioRow,removeCurrentRow,getRecordset,getInsertRecords,getRemoveRecords,getUpdateRecords,clearEdit,clearActived,getEditRecord,getActiveRecord,isEditByRow,isActiveByRow,setEditRow,setActiveRow,setEditCell,setActiveCell,setSelectCell,clearValidate,fullValidate,validate,openExport,closeExport,openPrint,closePrint,getPrintHtml,exportData,openImport,closeImport,importData,saveFile,readFile,importByFile,print,openCustom,closeCustom,saveCustom,cancelCustom,resetCustom,toggleCustomAllCheckbox,setCustomAllCheckbox'.split(',');
6406
+ const funcs = 'setFilter,openFilter,clearFilter,getCheckedFilters,updateFilterOptionStatus,closeMenu,setActiveCellArea,getActiveCellArea,getCellAreas,clearCellAreas,copyCellArea,cutCellArea,pasteCellArea,getCopyCellArea,getCopyCellAreas,clearCopyCellArea,setCellAreas,openFNR,openFind,openReplace,closeFNR,getSelectedCell,clearSelected,insert,insertAt,insertNextAt,remove,removeCheckboxRow,removeRadioRow,removeCurrentRow,getRecordset,getInsertRecords,getRemoveRecords,getUpdateRecords,clearEdit,clearActived,getEditRecord,getActiveRecord,isEditByRow,isActiveByRow,setEditRow,setActiveRow,setEditCell,setActiveCell,setSelectCell,clearValidate,fullValidate,validate,fullValidateField,validateField,openExport,closeExport,openPrint,closePrint,getPrintHtml,exportData,openImport,closeImport,importData,saveFile,readFile,importByFile,print,openCustom,closeCustom,saveCustom,cancelCustom,resetCustom,toggleCustomAllCheckbox,setCustomAllCheckbox'.split(',');
6400
6407
  funcs.forEach(name => {
6401
6408
  Methods[name] = function (...args) {
6402
6409
  if (process.env.NODE_ENV === 'development') {
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.10.14";
3
+ export const version = "3.10.16";
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.10.14"}`;
3
+ const version = `table v${"3.10.16"}`;
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.10.14";
2223
+ const version = "3.10.16";
2224
2224
  core_.VxeUI.version = version;
2225
2225
  core_.VxeUI.tableVersion = version;
2226
2226
  core_.VxeUI.setConfig({
@@ -2769,7 +2769,7 @@ function isNodeElement(elem) {
2769
2769
  const {
2770
2770
  log: log_log
2771
2771
  } = core_.VxeUI;
2772
- const log_version = `table v${"3.10.14"}`;
2772
+ const log_version = `table v${"3.10.16"}`;
2773
2773
  const warnLog = log_log.create('warn', log_version);
2774
2774
  const errLog = log_log.create('error', log_version);
2775
2775
  ;// CONCATENATED MODULE: ./packages/table/src/columnInfo.ts
@@ -8282,7 +8282,14 @@ const Methods = {
8282
8282
  if (isClear ||
8283
8283
  // 如果点击了当前表格之外
8284
8284
  !getEventTargetNode(evnt, $el).flag) {
8285
- setTimeout(() => this.clearEdit(evnt));
8285
+ setTimeout(() => {
8286
+ this.clearEdit(evnt).then(() => {
8287
+ // 如果存在校验,点击了表格之外则清除
8288
+ if (!this.isActivated && editRules && validOpts.autoClear) {
8289
+ this.validErrorMaps = {};
8290
+ }
8291
+ });
8292
+ });
8286
8293
  }
8287
8294
  });
8288
8295
  }
@@ -12390,7 +12397,7 @@ const Methods = {
12390
12397
  }
12391
12398
  };
12392
12399
  // Module methods
12393
- const funcs = 'setFilter,openFilter,clearFilter,getCheckedFilters,updateFilterOptionStatus,closeMenu,setActiveCellArea,getActiveCellArea,getCellAreas,clearCellAreas,copyCellArea,cutCellArea,pasteCellArea,getCopyCellArea,getCopyCellAreas,clearCopyCellArea,setCellAreas,openFNR,openFind,openReplace,closeFNR,getSelectedCell,clearSelected,insert,insertAt,insertNextAt,remove,removeCheckboxRow,removeRadioRow,removeCurrentRow,getRecordset,getInsertRecords,getRemoveRecords,getUpdateRecords,clearEdit,clearActived,getEditRecord,getActiveRecord,isEditByRow,isActiveByRow,setEditRow,setActiveRow,setEditCell,setActiveCell,setSelectCell,clearValidate,fullValidate,validate,openExport,closeExport,openPrint,closePrint,getPrintHtml,exportData,openImport,closeImport,importData,saveFile,readFile,importByFile,print,openCustom,closeCustom,saveCustom,cancelCustom,resetCustom,toggleCustomAllCheckbox,setCustomAllCheckbox'.split(',');
12400
+ const funcs = 'setFilter,openFilter,clearFilter,getCheckedFilters,updateFilterOptionStatus,closeMenu,setActiveCellArea,getActiveCellArea,getCellAreas,clearCellAreas,copyCellArea,cutCellArea,pasteCellArea,getCopyCellArea,getCopyCellAreas,clearCopyCellArea,setCellAreas,openFNR,openFind,openReplace,closeFNR,getSelectedCell,clearSelected,insert,insertAt,insertNextAt,remove,removeCheckboxRow,removeRadioRow,removeCurrentRow,getRecordset,getInsertRecords,getRemoveRecords,getUpdateRecords,clearEdit,clearActived,getEditRecord,getActiveRecord,isEditByRow,isActiveByRow,setEditRow,setActiveRow,setEditCell,setActiveCell,setSelectCell,clearValidate,fullValidate,validate,fullValidateField,validateField,openExport,closeExport,openPrint,closePrint,getPrintHtml,exportData,openImport,closeImport,importData,saveFile,readFile,importByFile,print,openCustom,closeCustom,saveCustom,cancelCustom,resetCustom,toggleCustomAllCheckbox,setCustomAllCheckbox'.split(',');
12394
12401
  funcs.forEach(name => {
12395
12402
  Methods[name] = function (...args) {
12396
12403
  if (true) {
@@ -19830,29 +19837,46 @@ function getTargetOffset(target, container) {
19830
19837
  offsetLeft
19831
19838
  };
19832
19839
  }
19833
- function getCheckboxRangeRows(_vm, params, targetTrElem, moveRange) {
19840
+ function getCheckboxRangeRows($xeTable, evnt, params, targetTrElem, trRect, offsetClientTop, moveRange) {
19841
+ const reactData = $xeTable;
19842
+ const internalData = $xeTable;
19834
19843
  let countHeight = 0;
19835
19844
  let rangeRows = [];
19845
+ let moveSize = 0;
19836
19846
  const isDown = moveRange > 0;
19837
- const moveSize = moveRange > 0 ? moveRange : Math.abs(moveRange) + targetTrElem.offsetHeight;
19838
19847
  const {
19839
- afterFullData,
19840
- scrollYStore,
19841
19848
  scrollYLoad
19842
- } = _vm;
19849
+ } = reactData;
19850
+ const {
19851
+ afterFullData,
19852
+ scrollYStore
19853
+ } = internalData;
19843
19854
  if (scrollYLoad) {
19844
- const _rowIndex = _vm.getVTRowIndex(params.row);
19855
+ if (isDown) {
19856
+ moveSize = offsetClientTop + moveRange;
19857
+ } else {
19858
+ moveSize = trRect.height - offsetClientTop + Math.abs(moveRange);
19859
+ }
19860
+ const _rowIndex = $xeTable.getVTRowIndex(params.row);
19845
19861
  if (isDown) {
19846
19862
  rangeRows = afterFullData.slice(_rowIndex, _rowIndex + Math.ceil(moveSize / scrollYStore.rowHeight));
19847
19863
  } else {
19848
- rangeRows = afterFullData.slice(_rowIndex - Math.floor(moveSize / scrollYStore.rowHeight) + 1, _rowIndex + 1);
19864
+ rangeRows = afterFullData.slice(_rowIndex - Math.floor(moveSize / scrollYStore.rowHeight), _rowIndex + 1);
19849
19865
  }
19850
19866
  } else {
19867
+ if (isDown) {
19868
+ moveSize = evnt.clientY - trRect.y;
19869
+ } else {
19870
+ moveSize = trRect.y - evnt.clientY + trRect.height;
19871
+ }
19851
19872
  const siblingProp = isDown ? 'next' : 'previous';
19852
19873
  while (targetTrElem && countHeight < moveSize) {
19853
- rangeRows.push(_vm.getRowNode(targetTrElem).item);
19854
- countHeight += targetTrElem.offsetHeight;
19855
- targetTrElem = targetTrElem[`${siblingProp}ElementSibling`];
19874
+ const rowNodeRest = $xeTable.getRowNode(targetTrElem);
19875
+ if (rowNodeRest) {
19876
+ rangeRows.push(rowNodeRest.item);
19877
+ countHeight += targetTrElem.offsetHeight;
19878
+ targetTrElem = targetTrElem[`${siblingProp}ElementSibling`];
19879
+ }
19856
19880
  }
19857
19881
  }
19858
19882
  return rangeRows;
@@ -20077,6 +20101,8 @@ function getCheckboxRangeRows(_vm, params, targetTrElem, moveRange) {
20077
20101
  const startLeft = offsetRest.offsetLeft + evnt.offsetX;
20078
20102
  const startScrollTop = bodyWrapperElem.scrollTop;
20079
20103
  const rowHeight = trElem.offsetHeight;
20104
+ const trRect = trElem.getBoundingClientRect();
20105
+ const offsetClientTop = disY - trRect.y;
20080
20106
  let mouseScrollTimeout = null;
20081
20107
  let isMouseScrollDown = false;
20082
20108
  let mouseScrollSpaceSize = 1;
@@ -20124,7 +20150,7 @@ function getCheckboxRangeRows(_vm, params, targetTrElem, moveRange) {
20124
20150
  checkboxRangeElem.style.left = `${rangeLeft}px`;
20125
20151
  checkboxRangeElem.style.top = `${rangeTop}px`;
20126
20152
  checkboxRangeElem.style.display = 'block';
20127
- const rangeRows = getCheckboxRangeRows(this, params, trElem, offsetTop < marginSize ? -rangeHeight : rangeHeight);
20153
+ const rangeRows = getCheckboxRangeRows(this, evnt, params, trElem, trRect, offsetClientTop, offsetTop < marginSize ? -rangeHeight : rangeHeight);
20128
20154
  // 至少滑动 10px 才能有效匹配
20129
20155
  if (rangeHeight > 10 && rangeRows.length !== lastRangeRows.length) {
20130
20156
  lastRangeRows = rangeRows;
@@ -20342,7 +20368,7 @@ function validErrorRuleValue(rule, val) {
20342
20368
  warnLog('vxe.error.notValidators', ['fullValidate(rows, callback)', 'fullValidate(rows)']);
20343
20369
  }
20344
20370
  }
20345
- return this.beginValidate(rows, cb, true);
20371
+ return this.beginValidate(rows, null, cb, true);
20346
20372
  },
20347
20373
  /**
20348
20374
  * 快速校验,如果存在记录不通过的记录,则返回不再继续校验(异步校验除外)
@@ -20353,7 +20379,27 @@ function validErrorRuleValue(rule, val) {
20353
20379
  warnLog('vxe.error.notValidators', ['validate(rows, callback)', 'validate(rows)']);
20354
20380
  }
20355
20381
  }
20356
- return this.beginValidate(rows, cb);
20382
+ return this.beginValidate(rows, null, cb);
20383
+ },
20384
+ /**
20385
+ * 完整校验单元格,和 validateField 的区别就是会给有效数据中的每一行进行校验
20386
+ */
20387
+ _fullValidateField(rows, fieldOrColumn) {
20388
+ const colList = (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(fieldOrColumn) ? fieldOrColumn : fieldOrColumn ? [fieldOrColumn] : []).map(column => handleFieldOrColumn(this, column));
20389
+ if (colList.length) {
20390
+ return this.beginValidate(rows, colList, null, true);
20391
+ }
20392
+ return this.$nextTick();
20393
+ },
20394
+ /**
20395
+ * 快速校验单元格,如果存在记录不通过的记录,则返回不再继续校验(异步校验除外)
20396
+ */
20397
+ _validateField(rows, fieldOrColumn) {
20398
+ const colList = (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(fieldOrColumn) ? fieldOrColumn : fieldOrColumn ? [fieldOrColumn] : []).map(column => handleFieldOrColumn(this, column));
20399
+ if (colList.length) {
20400
+ return this.beginValidate(rows, colList, null);
20401
+ }
20402
+ return this.$nextTick();
20357
20403
  },
20358
20404
  /**
20359
20405
  * 聚焦到校验通过的单元格并弹出校验错误提示
@@ -20402,7 +20448,7 @@ function validErrorRuleValue(rule, val) {
20402
20448
  * 如果只传 callback 否则默认验证整个表格数据
20403
20449
  * 返回 Promise 对象,或者使用回调方式
20404
20450
  */
20405
- beginValidate(rows, cb, isFull) {
20451
+ beginValidate(rows, cols, cb, isFull) {
20406
20452
  const validRest = {};
20407
20453
  const {
20408
20454
  editRules,
@@ -20431,12 +20477,13 @@ function validErrorRuleValue(rule, val) {
20431
20477
  this.clearValidate();
20432
20478
  const validErrMaps = {};
20433
20479
  if (editRules) {
20434
- const columns = this.getColumns();
20480
+ const columns = cols && cols.length ? cols : this.getColumns();
20435
20481
  const handleVaild = row => {
20436
20482
  if (isFull || !this.validRuleErr) {
20437
20483
  const colVailds = [];
20438
20484
  columns.forEach(column => {
20439
- if ((isFull || !this.validRuleErr) && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().has(editRules, column.property)) {
20485
+ const field = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(column) ? column : column.field;
20486
+ if ((isFull || !this.validRuleErr) && external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().has(editRules, field)) {
20440
20487
  colVailds.push(this.validCellRules('all', row, column).catch(({
20441
20488
  rule,
20442
20489
  rules
@@ -20448,11 +20495,11 @@ function validErrorRuleValue(rule, val) {
20448
20495
  row,
20449
20496
  columnIndex: this.getColumnIndex(column),
20450
20497
  column,
20451
- field: column.property,
20498
+ field,
20452
20499
  $table: this
20453
20500
  };
20454
- if (!validRest[column.property]) {
20455
- validRest[column.property] = [];
20501
+ if (!validRest[field]) {
20502
+ validRest[field] = [];
20456
20503
  }
20457
20504
  validErrMaps[`${getRowid(this, row)}:${column.id}`] = {
20458
20505
  column,
@@ -20460,7 +20507,7 @@ function validErrorRuleValue(rule, val) {
20460
20507
  rule,
20461
20508
  content: rule.content
20462
20509
  };
20463
- validRest[column.property].push(rest);
20510
+ validRest[field].push(rest);
20464
20511
  if (!isFull) {
20465
20512
  this.validRuleErr = true;
20466
20513
  return Promise.reject(rest);
@@ -20677,7 +20724,7 @@ function validErrorRuleValue(rule, val) {
20677
20724
  } = this;
20678
20725
  const validTip = this.$refs.validTip;
20679
20726
  const rowList = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows) ? rows : rows ? [rows] : [];
20680
- const colList = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(fieldOrColumn) ? fieldOrColumn : (fieldOrColumn ? [fieldOrColumn] : []).map(column => handleFieldOrColumn(this, column));
20727
+ const colList = (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(fieldOrColumn) ? fieldOrColumn : fieldOrColumn ? [fieldOrColumn] : []).map(column => handleFieldOrColumn(this, column));
20681
20728
  let validErrMaps = {};
20682
20729
  if (validTip && validTip.visible) {
20683
20730
  validTip.close();