vxe-table 4.23.17 → 4.23.18

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.
package/dist/all.esm.js CHANGED
@@ -123,7 +123,7 @@ function getDefaultConfig(val1, def1) {
123
123
  }
124
124
 
125
125
  // packages_temp/ui/index.ts
126
- var version = "4.23.17";
126
+ var version = "4.23.18";
127
127
  VxeUI2.version = version;
128
128
  VxeUI2.tableVersion = version;
129
129
  VxeUI2.setConfig({
@@ -952,7 +952,7 @@ function getPopupAppendElement(appendTo) {
952
952
  // packages_temp/ui/src/log.ts
953
953
  import { VxeUI as VxeUI3 } from "@vxe-ui/core";
954
954
  var { log } = VxeUI3;
955
- var tableVersion = `table v${"4.23.17"}`;
955
+ var tableVersion = `table v${"4.23.18"}`;
956
956
  function createComponentLog(name) {
957
957
  const uiVersion = VxeUI3.uiVersion ? `ui v${VxeUI3.uiVersion}` : "";
958
958
  const ganttVersion = VxeUI3.ganttVersion ? `gantt v${VxeUI3.ganttVersion}` : "";
@@ -10891,76 +10891,26 @@ hooks3.add("tableEditModule", {
10891
10891
  const { editRender } = column;
10892
10892
  const { isFocus, isPos, isClear } = options;
10893
10893
  const cell = params.cell || $xeTable.getCellElement(row, column);
10894
- const beforeEditMethod = editOpts.beforeEditMethod || editOpts.activeMethod;
10894
+ const beforeEditFn = editOpts.beforeEditMethod || editOpts.activeMethod;
10895
+ const beforeEditAsyncFn = editOpts.beforeEditAsyncMethod;
10895
10896
  const editParams = { ...params, cell };
10896
- if (cell && isEnableConf(editConfig) && isEnableConf(editRender)) {
10897
- if (!$xeTable.isPendingByRow(row) && !$xeTable.isAggregateRecord(row)) {
10898
- if (actived.row !== row || (mode === "cell" ? actived.column !== column : false)) {
10899
- let type = "edit-disabled";
10900
- if (!beforeEditMethod || beforeEditMethod({ ...editParams, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt })) {
10901
- if (hasEnableConf(mouseConfig, mouseOpts)) {
10902
- $xeTable.clearSelected();
10903
- if ($xeTable.clearCellAreas) {
10904
- $xeTable.clearCellAreas();
10905
- $xeTable.clearCopyCellArea();
10906
- }
10907
- }
10908
- $xeTable.closeTooltip();
10909
- if (actived.column) {
10910
- handleClearEdit(evnt);
10911
- }
10912
- type = "edit-activated";
10913
- column.renderHeight = cell.offsetHeight;
10914
- actived.args = editParams;
10915
- actived.row = row;
10916
- actived.column = column;
10917
- $xeTable.handlePushStack();
10918
- if (isClear) {
10919
- setCellValue(row, column, null);
10920
- }
10921
- if (mode === "row") {
10922
- tableColumn.forEach((column2) => getEditColumnModel(row, column2));
10923
- } else {
10924
- getEditColumnModel(row, column);
10925
- }
10926
- const afterEditMethod = editOpts.afterEditMethod;
10927
- nextTick9(() => {
10928
- if (isFocus) {
10929
- $xeTable.handleFocus(editParams, evnt);
10930
- }
10931
- if (afterEditMethod) {
10932
- afterEditMethod({ ...editParams, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt });
10933
- }
10934
- });
10935
- }
10936
- $xeTable.dispatchEvent(
10937
- type,
10938
- {
10939
- row,
10940
- rowIndex: $xeTable.getRowIndex(row),
10941
- $rowIndex: $xeTable.getVMRowIndex(row),
10942
- column,
10943
- columnIndex: $xeTable.getColumnIndex(column),
10944
- $columnIndex: $xeTable.getVMColumnIndex(column)
10945
- },
10946
- evnt
10947
- );
10948
- if (type === "edit-activated") {
10949
- $xeTable.dispatchEvent(
10950
- "edit-actived",
10951
- {
10952
- row,
10953
- rowIndex: $xeTable.getRowIndex(row),
10954
- $rowIndex: $xeTable.getVMRowIndex(row),
10955
- column,
10956
- columnIndex: $xeTable.getColumnIndex(column),
10957
- $columnIndex: $xeTable.getVMColumnIndex(column)
10958
- },
10959
- evnt
10960
- );
10961
- }
10962
- } else {
10963
- const { column: oldColumn } = actived;
10897
+ if (!cell || !isEnableConf(editConfig) || !isEnableConf(editRender)) {
10898
+ return nextTick9();
10899
+ }
10900
+ if ($xeTable.isPendingByRow(row) || $xeTable.isAggregateRecord(row)) {
10901
+ return nextTick9();
10902
+ }
10903
+ if (actived.row !== row || (mode === "cell" ? actived.column !== column : false)) {
10904
+ const evntParams = {
10905
+ row,
10906
+ rowIndex: $xeTable.getRowIndex(row),
10907
+ $rowIndex: $xeTable.getVMRowIndex(row),
10908
+ column,
10909
+ columnIndex: $xeTable.getColumnIndex(column),
10910
+ $columnIndex: $xeTable.getVMColumnIndex(column)
10911
+ };
10912
+ const handleCellEdit = (status) => {
10913
+ if (status) {
10964
10914
  if (hasEnableConf(mouseConfig, mouseOpts)) {
10965
10915
  $xeTable.clearSelected();
10966
10916
  if ($xeTable.clearCellAreas) {
@@ -10968,29 +10918,81 @@ hooks3.add("tableEditModule", {
10968
10918
  $xeTable.clearCopyCellArea();
10969
10919
  }
10970
10920
  }
10971
- if (oldColumn && oldColumn !== column) {
10972
- const { model: oldModel } = oldColumn;
10973
- if (oldModel.update) {
10974
- setCellValue(row, oldColumn, oldModel.value);
10975
- }
10976
- if ($xeTable.clearValidate) {
10977
- $xeTable.clearValidate(row, column);
10978
- }
10921
+ $xeTable.closeTooltip();
10922
+ if (actived.column) {
10923
+ handleClearEdit(evnt);
10979
10924
  }
10980
10925
  column.renderHeight = cell.offsetHeight;
10981
10926
  actived.args = editParams;
10927
+ actived.row = row;
10982
10928
  actived.column = column;
10983
- if (isPos) {
10984
- setTimeout(() => {
10985
- $xeTable.handleFocus(editParams, evnt);
10986
- });
10929
+ $xeTable.handlePushStack();
10930
+ if (isClear) {
10931
+ setCellValue(row, column, null);
10932
+ }
10933
+ if (mode === "row") {
10934
+ tableColumn.forEach((column2) => getEditColumnModel(row, column2));
10935
+ } else {
10936
+ getEditColumnModel(row, column);
10987
10937
  }
10938
+ const afterEditMethod = editOpts.afterEditMethod;
10939
+ nextTick9(() => {
10940
+ if (isFocus) {
10941
+ $xeTable.handleFocus(editParams, evnt);
10942
+ }
10943
+ if (afterEditMethod) {
10944
+ afterEditMethod({ ...editParams, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt });
10945
+ }
10946
+ });
10947
+ $xeTable.dispatchEvent("edit-activated", evntParams, evnt);
10948
+ $xeTable.dispatchEvent("edit-actived", evntParams, evnt);
10949
+ } else {
10950
+ $xeTable.dispatchEvent("edit-disabled", evntParams, evnt);
10988
10951
  }
10989
10952
  focused.column = null;
10990
10953
  focused.row = null;
10991
10954
  $xeTable.focus();
10955
+ };
10956
+ const eFnParams = { ...editParams, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt };
10957
+ if (beforeEditFn) {
10958
+ handleCellEdit(!!beforeEditFn(eFnParams));
10959
+ } else if (beforeEditAsyncFn) {
10960
+ return Promise.resolve().then(() => beforeEditAsyncFn(eFnParams)).catch(() => false).then((status) => {
10961
+ handleCellEdit(!!status);
10962
+ });
10963
+ } else {
10964
+ handleCellEdit(true);
10965
+ }
10966
+ return nextTick9();
10967
+ }
10968
+ const { column: oldColumn } = actived;
10969
+ if (hasEnableConf(mouseConfig, mouseOpts)) {
10970
+ $xeTable.clearSelected();
10971
+ if ($xeTable.clearCellAreas) {
10972
+ $xeTable.clearCellAreas();
10973
+ $xeTable.clearCopyCellArea();
10974
+ }
10975
+ }
10976
+ if (oldColumn && oldColumn !== column) {
10977
+ const { model: oldModel } = oldColumn;
10978
+ if (oldModel.update) {
10979
+ setCellValue(row, oldColumn, oldModel.value);
10980
+ }
10981
+ if ($xeTable.clearValidate) {
10982
+ $xeTable.clearValidate(row, column);
10992
10983
  }
10993
10984
  }
10985
+ column.renderHeight = cell.offsetHeight;
10986
+ actived.args = editParams;
10987
+ actived.column = column;
10988
+ if (isPos) {
10989
+ setTimeout(() => {
10990
+ $xeTable.handleFocus(editParams, evnt);
10991
+ });
10992
+ }
10993
+ focused.column = null;
10994
+ focused.row = null;
10995
+ $xeTable.focus();
10994
10996
  return nextTick9();
10995
10997
  };
10996
10998
  const handleEditCell = (row, fieldOrColumn, options) => {
@@ -24925,7 +24927,8 @@ var table_default = (
24925
24927
  const operArrow = isLeftArrow || isUpArrow || isRightArrow || isDwArrow;
24926
24928
  const operCtxMenu = isContentMenu && ctxMenuStore.visible && (isEnter || isSpacebar || operArrow);
24927
24929
  const isEditStatus = isEnableConf(editConfig) && actived.column && actived.row;
24928
- const beforeEditMethod = editOpts.beforeEditMethod || editOpts.activeMethod;
24930
+ const beforeEditFn = editOpts.beforeEditMethod || editOpts.activeMethod;
24931
+ const beforeEditAsyncFn = editOpts.beforeEditAsyncMethod;
24929
24932
  const selectRow = selected.row;
24930
24933
  const selectColumn = selected.column;
24931
24934
  if (operCtxMenu) {
@@ -25153,7 +25156,7 @@ var table_default = (
25153
25156
  $grid: $xeGrid,
25154
25157
  $gantt: $xeGantt
25155
25158
  };
25156
- if (!beforeEditMethod || beforeEditMethod(params)) {
25159
+ const handleEdit = () => {
25157
25160
  if (delMethod) {
25158
25161
  delMethod(params);
25159
25162
  } else {
@@ -25165,6 +25168,20 @@ var table_default = (
25165
25168
  }
25166
25169
  $xeTable.updateFooter();
25167
25170
  dispatchEvent("cell-delete-value", params, evnt);
25171
+ };
25172
+ if (beforeEditFn) {
25173
+ if (beforeEditFn(params)) {
25174
+ handleEdit();
25175
+ }
25176
+ } else if (beforeEditAsyncFn) {
25177
+ Promise.resolve(beforeEditAsyncFn(params)).then((status) => {
25178
+ if (status) {
25179
+ handleEdit();
25180
+ }
25181
+ }).catch(() => {
25182
+ });
25183
+ } else {
25184
+ handleEdit();
25168
25185
  }
25169
25186
  }
25170
25187
  } else if (hasBackspaceKey && hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isBack && isEnableConf(editConfig) && (selectRow || selectColumn)) {
@@ -25184,7 +25201,7 @@ var table_default = (
25184
25201
  $grid: $xeGrid,
25185
25202
  $gantt: $xeGantt
25186
25203
  };
25187
- if (!beforeEditMethod || beforeEditMethod(params)) {
25204
+ const handleEdit = () => {
25188
25205
  if (backMethod) {
25189
25206
  backMethod(params);
25190
25207
  } else {
@@ -25193,6 +25210,20 @@ var table_default = (
25193
25210
  });
25194
25211
  }
25195
25212
  dispatchEvent("cell-backspace-value", params, evnt);
25213
+ };
25214
+ if (beforeEditFn) {
25215
+ if (beforeEditFn(params)) {
25216
+ handleEdit();
25217
+ }
25218
+ } else if (beforeEditAsyncFn) {
25219
+ Promise.resolve(beforeEditAsyncFn(params)).then((status) => {
25220
+ if (status) {
25221
+ handleEdit();
25222
+ }
25223
+ }).catch(() => {
25224
+ });
25225
+ } else {
25226
+ handleEdit();
25196
25227
  }
25197
25228
  }
25198
25229
  }
@@ -25223,7 +25254,6 @@ var table_default = (
25223
25254
  } else if (hasEnableConf(keyboardConfig, keyboardOpts) && isEnableConf(editConfig) && keyboardOpts.isEdit && !isControlKey && (isSpacebar || isProcess || evnt.key === "Process" || keyCode >= 48 && keyCode <= 57 || keyCode >= 65 && keyCode <= 90 || keyCode >= 96 && keyCode <= 111 || keyCode >= 186 && keyCode <= 192 || keyCode >= 219 && keyCode <= 222)) {
25224
25255
  const { editMode, editMethod } = keyboardOpts;
25225
25256
  if (selectColumn && selectRow && isEnableConf(selectColumn.editRender)) {
25226
- const beforeEditMethod2 = editOpts.beforeEditMethod || editOpts.activeMethod;
25227
25257
  const params = {
25228
25258
  row: selectRow,
25229
25259
  rowIndex: $xeTable.getRowIndex(selectRow),
@@ -25237,7 +25267,7 @@ var table_default = (
25237
25267
  $grid: $xeGrid,
25238
25268
  $gantt: $xeGantt
25239
25269
  };
25240
- if (!beforeEditMethod2 || beforeEditMethod2(params)) {
25270
+ const handleEdit = () => {
25241
25271
  if (editMethod) {
25242
25272
  editMethod(params);
25243
25273
  } else {
@@ -25249,6 +25279,20 @@ var table_default = (
25249
25279
  isClear: isClearValue
25250
25280
  });
25251
25281
  }
25282
+ };
25283
+ if (beforeEditFn) {
25284
+ if (beforeEditFn(params)) {
25285
+ handleEdit();
25286
+ }
25287
+ } else if (beforeEditAsyncFn) {
25288
+ Promise.resolve(beforeEditAsyncFn(params)).then((status) => {
25289
+ if (status) {
25290
+ handleEdit();
25291
+ }
25292
+ }).catch(() => {
25293
+ });
25294
+ } else {
25295
+ handleEdit();
25252
25296
  }
25253
25297
  }
25254
25298
  }
@@ -31014,6 +31058,7 @@ var table_default = (
31014
31058
  const mouseOpts = computeMouseOpts.value;
31015
31059
  const exportOpts = computeExportOpts.value;
31016
31060
  const importOpts = computeImportOpts.value;
31061
+ const keyboardOpts = computeKeyboardOpts.value;
31017
31062
  const rowDragOpts = computeRowDragOpts.value;
31018
31063
  const areaOpts = computeAreaOpts.value;
31019
31064
  const sortOpts = computeSortOpts.value;
@@ -31172,8 +31217,16 @@ var table_default = (
31172
31217
  if (mouseOpts.area && props.treeConfig && !treeOpts.transform) {
31173
31218
  errLog10("vxe.error.notSupportProp", ["mouse-config.area", "tree-config.transform=false", "tree-config.transform=true"]);
31174
31219
  }
31175
- if (props.editConfig && editOpts.activeMethod) {
31176
- warnLog7("vxe.error.delProp", ["edit-config.activeMethod", "edit-config.beforeEditMethod"]);
31220
+ if (props.editConfig) {
31221
+ if (editOpts.activeMethod) {
31222
+ warnLog7("vxe.error.delProp", ["edit-config.activeMethod", "edit-config.beforeEditMethod"]);
31223
+ }
31224
+ if (editOpts.beforeEditMethod && editOpts.beforeEditAsyncMethod) {
31225
+ errLog10("vxe.error.errConflicts", ["edit-config.beforeEditMethod", "edit-config.beforeEditAsyncMethod"]);
31226
+ }
31227
+ if (keyboardOpts.isEdit && editOpts.beforeEditAsyncMethod) {
31228
+ warnLog7("vxe.error.errConflicts", ["keyboard-config.isEdit", "edit-config.beforeEditAsyncMethod"]);
31229
+ }
31177
31230
  }
31178
31231
  if (checkboxOpts.halfField) {
31179
31232
  warnLog7("vxe.error.delProp", ["checkbox-config.halfField", "checkbox-config.indeterminateField"]);
@@ -32339,14 +32392,6 @@ var grid_default = (
32339
32392
  return funcs;
32340
32393
  };
32341
32394
  const gridExtendTableMethods = extendTableMethods(tableComponentMethodKeys);
32342
- tableComponentMethodKeys.forEach((name) => {
32343
- gridExtendTableMethods[name] = (...args) => {
32344
- const $xeTable = refTable.value;
32345
- if ($xeTable && $xeTable[name]) {
32346
- return $xeTable && $xeTable[name](...args);
32347
- }
32348
- };
32349
- });
32350
32395
  const computeProxyOpts = computed7(() => {
32351
32396
  return XEUtils27.merge({}, XEUtils27.clone(getConfig10().grid.proxyConfig, true), props.proxyConfig);
32352
32397
  });