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/lib/index.umd.js CHANGED
@@ -318,7 +318,7 @@ function getDefaultConfig(val1, def1) {
318
318
  }
319
319
 
320
320
  // packages_temp/ui/index.ts
321
- var version = "4.23.17";
321
+ var version = "4.23.18";
322
322
  import_core2.VxeUI.version = version;
323
323
  import_core2.VxeUI.tableVersion = version;
324
324
  import_core2.VxeUI.setConfig({
@@ -1147,7 +1147,7 @@ function getPopupAppendElement(appendTo) {
1147
1147
  // packages_temp/ui/src/log.ts
1148
1148
  var import_core3 = require("@vxe-ui/core");
1149
1149
  var { log } = import_core3.VxeUI;
1150
- var tableVersion = `table v${"4.23.17"}`;
1150
+ var tableVersion = `table v${"4.23.18"}`;
1151
1151
  function createComponentLog(name) {
1152
1152
  const uiVersion = import_core3.VxeUI.uiVersion ? `ui v${import_core3.VxeUI.uiVersion}` : "";
1153
1153
  const ganttVersion = import_core3.VxeUI.ganttVersion ? `gantt v${import_core3.VxeUI.ganttVersion}` : "";
@@ -11086,76 +11086,26 @@ hooks3.add("tableEditModule", {
11086
11086
  const { editRender } = column;
11087
11087
  const { isFocus, isPos, isClear } = options;
11088
11088
  const cell = params.cell || $xeTable.getCellElement(row, column);
11089
- const beforeEditMethod = editOpts.beforeEditMethod || editOpts.activeMethod;
11089
+ const beforeEditFn = editOpts.beforeEditMethod || editOpts.activeMethod;
11090
+ const beforeEditAsyncFn = editOpts.beforeEditAsyncMethod;
11090
11091
  const editParams = { ...params, cell };
11091
- if (cell && isEnableConf(editConfig) && isEnableConf(editRender)) {
11092
- if (!$xeTable.isPendingByRow(row) && !$xeTable.isAggregateRecord(row)) {
11093
- if (actived.row !== row || (mode === "cell" ? actived.column !== column : false)) {
11094
- let type = "edit-disabled";
11095
- if (!beforeEditMethod || beforeEditMethod({ ...editParams, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt })) {
11096
- if (hasEnableConf(mouseConfig, mouseOpts)) {
11097
- $xeTable.clearSelected();
11098
- if ($xeTable.clearCellAreas) {
11099
- $xeTable.clearCellAreas();
11100
- $xeTable.clearCopyCellArea();
11101
- }
11102
- }
11103
- $xeTable.closeTooltip();
11104
- if (actived.column) {
11105
- handleClearEdit(evnt);
11106
- }
11107
- type = "edit-activated";
11108
- column.renderHeight = cell.offsetHeight;
11109
- actived.args = editParams;
11110
- actived.row = row;
11111
- actived.column = column;
11112
- $xeTable.handlePushStack();
11113
- if (isClear) {
11114
- setCellValue(row, column, null);
11115
- }
11116
- if (mode === "row") {
11117
- tableColumn.forEach((column2) => getEditColumnModel(row, column2));
11118
- } else {
11119
- getEditColumnModel(row, column);
11120
- }
11121
- const afterEditMethod = editOpts.afterEditMethod;
11122
- (0, import_vue17.nextTick)(() => {
11123
- if (isFocus) {
11124
- $xeTable.handleFocus(editParams, evnt);
11125
- }
11126
- if (afterEditMethod) {
11127
- afterEditMethod({ ...editParams, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt });
11128
- }
11129
- });
11130
- }
11131
- $xeTable.dispatchEvent(
11132
- type,
11133
- {
11134
- row,
11135
- rowIndex: $xeTable.getRowIndex(row),
11136
- $rowIndex: $xeTable.getVMRowIndex(row),
11137
- column,
11138
- columnIndex: $xeTable.getColumnIndex(column),
11139
- $columnIndex: $xeTable.getVMColumnIndex(column)
11140
- },
11141
- evnt
11142
- );
11143
- if (type === "edit-activated") {
11144
- $xeTable.dispatchEvent(
11145
- "edit-actived",
11146
- {
11147
- row,
11148
- rowIndex: $xeTable.getRowIndex(row),
11149
- $rowIndex: $xeTable.getVMRowIndex(row),
11150
- column,
11151
- columnIndex: $xeTable.getColumnIndex(column),
11152
- $columnIndex: $xeTable.getVMColumnIndex(column)
11153
- },
11154
- evnt
11155
- );
11156
- }
11157
- } else {
11158
- const { column: oldColumn } = actived;
11092
+ if (!cell || !isEnableConf(editConfig) || !isEnableConf(editRender)) {
11093
+ return (0, import_vue17.nextTick)();
11094
+ }
11095
+ if ($xeTable.isPendingByRow(row) || $xeTable.isAggregateRecord(row)) {
11096
+ return (0, import_vue17.nextTick)();
11097
+ }
11098
+ if (actived.row !== row || (mode === "cell" ? actived.column !== column : false)) {
11099
+ const evntParams = {
11100
+ row,
11101
+ rowIndex: $xeTable.getRowIndex(row),
11102
+ $rowIndex: $xeTable.getVMRowIndex(row),
11103
+ column,
11104
+ columnIndex: $xeTable.getColumnIndex(column),
11105
+ $columnIndex: $xeTable.getVMColumnIndex(column)
11106
+ };
11107
+ const handleCellEdit = (status) => {
11108
+ if (status) {
11159
11109
  if (hasEnableConf(mouseConfig, mouseOpts)) {
11160
11110
  $xeTable.clearSelected();
11161
11111
  if ($xeTable.clearCellAreas) {
@@ -11163,29 +11113,81 @@ hooks3.add("tableEditModule", {
11163
11113
  $xeTable.clearCopyCellArea();
11164
11114
  }
11165
11115
  }
11166
- if (oldColumn && oldColumn !== column) {
11167
- const { model: oldModel } = oldColumn;
11168
- if (oldModel.update) {
11169
- setCellValue(row, oldColumn, oldModel.value);
11170
- }
11171
- if ($xeTable.clearValidate) {
11172
- $xeTable.clearValidate(row, column);
11173
- }
11116
+ $xeTable.closeTooltip();
11117
+ if (actived.column) {
11118
+ handleClearEdit(evnt);
11174
11119
  }
11175
11120
  column.renderHeight = cell.offsetHeight;
11176
11121
  actived.args = editParams;
11122
+ actived.row = row;
11177
11123
  actived.column = column;
11178
- if (isPos) {
11179
- setTimeout(() => {
11180
- $xeTable.handleFocus(editParams, evnt);
11181
- });
11124
+ $xeTable.handlePushStack();
11125
+ if (isClear) {
11126
+ setCellValue(row, column, null);
11127
+ }
11128
+ if (mode === "row") {
11129
+ tableColumn.forEach((column2) => getEditColumnModel(row, column2));
11130
+ } else {
11131
+ getEditColumnModel(row, column);
11182
11132
  }
11133
+ const afterEditMethod = editOpts.afterEditMethod;
11134
+ (0, import_vue17.nextTick)(() => {
11135
+ if (isFocus) {
11136
+ $xeTable.handleFocus(editParams, evnt);
11137
+ }
11138
+ if (afterEditMethod) {
11139
+ afterEditMethod({ ...editParams, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt });
11140
+ }
11141
+ });
11142
+ $xeTable.dispatchEvent("edit-activated", evntParams, evnt);
11143
+ $xeTable.dispatchEvent("edit-actived", evntParams, evnt);
11144
+ } else {
11145
+ $xeTable.dispatchEvent("edit-disabled", evntParams, evnt);
11183
11146
  }
11184
11147
  focused.column = null;
11185
11148
  focused.row = null;
11186
11149
  $xeTable.focus();
11150
+ };
11151
+ const eFnParams = { ...editParams, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt };
11152
+ if (beforeEditFn) {
11153
+ handleCellEdit(!!beforeEditFn(eFnParams));
11154
+ } else if (beforeEditAsyncFn) {
11155
+ return Promise.resolve().then(() => beforeEditAsyncFn(eFnParams)).catch(() => false).then((status) => {
11156
+ handleCellEdit(!!status);
11157
+ });
11158
+ } else {
11159
+ handleCellEdit(true);
11160
+ }
11161
+ return (0, import_vue17.nextTick)();
11162
+ }
11163
+ const { column: oldColumn } = actived;
11164
+ if (hasEnableConf(mouseConfig, mouseOpts)) {
11165
+ $xeTable.clearSelected();
11166
+ if ($xeTable.clearCellAreas) {
11167
+ $xeTable.clearCellAreas();
11168
+ $xeTable.clearCopyCellArea();
11169
+ }
11170
+ }
11171
+ if (oldColumn && oldColumn !== column) {
11172
+ const { model: oldModel } = oldColumn;
11173
+ if (oldModel.update) {
11174
+ setCellValue(row, oldColumn, oldModel.value);
11175
+ }
11176
+ if ($xeTable.clearValidate) {
11177
+ $xeTable.clearValidate(row, column);
11187
11178
  }
11188
11179
  }
11180
+ column.renderHeight = cell.offsetHeight;
11181
+ actived.args = editParams;
11182
+ actived.column = column;
11183
+ if (isPos) {
11184
+ setTimeout(() => {
11185
+ $xeTable.handleFocus(editParams, evnt);
11186
+ });
11187
+ }
11188
+ focused.column = null;
11189
+ focused.row = null;
11190
+ $xeTable.focus();
11189
11191
  return (0, import_vue17.nextTick)();
11190
11192
  };
11191
11193
  const handleEditCell = (row, fieldOrColumn, options) => {
@@ -25120,7 +25122,8 @@ var table_default = (
25120
25122
  const operArrow = isLeftArrow || isUpArrow || isRightArrow || isDwArrow;
25121
25123
  const operCtxMenu = isContentMenu && ctxMenuStore.visible && (isEnter || isSpacebar || operArrow);
25122
25124
  const isEditStatus = isEnableConf(editConfig) && actived.column && actived.row;
25123
- const beforeEditMethod = editOpts.beforeEditMethod || editOpts.activeMethod;
25125
+ const beforeEditFn = editOpts.beforeEditMethod || editOpts.activeMethod;
25126
+ const beforeEditAsyncFn = editOpts.beforeEditAsyncMethod;
25124
25127
  const selectRow = selected.row;
25125
25128
  const selectColumn = selected.column;
25126
25129
  if (operCtxMenu) {
@@ -25348,7 +25351,7 @@ var table_default = (
25348
25351
  $grid: $xeGrid,
25349
25352
  $gantt: $xeGantt
25350
25353
  };
25351
- if (!beforeEditMethod || beforeEditMethod(params)) {
25354
+ const handleEdit = () => {
25352
25355
  if (delMethod) {
25353
25356
  delMethod(params);
25354
25357
  } else {
@@ -25360,6 +25363,20 @@ var table_default = (
25360
25363
  }
25361
25364
  $xeTable.updateFooter();
25362
25365
  dispatchEvent("cell-delete-value", params, evnt);
25366
+ };
25367
+ if (beforeEditFn) {
25368
+ if (beforeEditFn(params)) {
25369
+ handleEdit();
25370
+ }
25371
+ } else if (beforeEditAsyncFn) {
25372
+ Promise.resolve(beforeEditAsyncFn(params)).then((status) => {
25373
+ if (status) {
25374
+ handleEdit();
25375
+ }
25376
+ }).catch(() => {
25377
+ });
25378
+ } else {
25379
+ handleEdit();
25363
25380
  }
25364
25381
  }
25365
25382
  } else if (hasBackspaceKey && hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isBack && isEnableConf(editConfig) && (selectRow || selectColumn)) {
@@ -25379,7 +25396,7 @@ var table_default = (
25379
25396
  $grid: $xeGrid,
25380
25397
  $gantt: $xeGantt
25381
25398
  };
25382
- if (!beforeEditMethod || beforeEditMethod(params)) {
25399
+ const handleEdit = () => {
25383
25400
  if (backMethod) {
25384
25401
  backMethod(params);
25385
25402
  } else {
@@ -25388,6 +25405,20 @@ var table_default = (
25388
25405
  });
25389
25406
  }
25390
25407
  dispatchEvent("cell-backspace-value", params, evnt);
25408
+ };
25409
+ if (beforeEditFn) {
25410
+ if (beforeEditFn(params)) {
25411
+ handleEdit();
25412
+ }
25413
+ } else if (beforeEditAsyncFn) {
25414
+ Promise.resolve(beforeEditAsyncFn(params)).then((status) => {
25415
+ if (status) {
25416
+ handleEdit();
25417
+ }
25418
+ }).catch(() => {
25419
+ });
25420
+ } else {
25421
+ handleEdit();
25391
25422
  }
25392
25423
  }
25393
25424
  }
@@ -25418,7 +25449,6 @@ var table_default = (
25418
25449
  } 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)) {
25419
25450
  const { editMode, editMethod } = keyboardOpts;
25420
25451
  if (selectColumn && selectRow && isEnableConf(selectColumn.editRender)) {
25421
- const beforeEditMethod2 = editOpts.beforeEditMethod || editOpts.activeMethod;
25422
25452
  const params = {
25423
25453
  row: selectRow,
25424
25454
  rowIndex: $xeTable.getRowIndex(selectRow),
@@ -25432,7 +25462,7 @@ var table_default = (
25432
25462
  $grid: $xeGrid,
25433
25463
  $gantt: $xeGantt
25434
25464
  };
25435
- if (!beforeEditMethod2 || beforeEditMethod2(params)) {
25465
+ const handleEdit = () => {
25436
25466
  if (editMethod) {
25437
25467
  editMethod(params);
25438
25468
  } else {
@@ -25444,6 +25474,20 @@ var table_default = (
25444
25474
  isClear: isClearValue
25445
25475
  });
25446
25476
  }
25477
+ };
25478
+ if (beforeEditFn) {
25479
+ if (beforeEditFn(params)) {
25480
+ handleEdit();
25481
+ }
25482
+ } else if (beforeEditAsyncFn) {
25483
+ Promise.resolve(beforeEditAsyncFn(params)).then((status) => {
25484
+ if (status) {
25485
+ handleEdit();
25486
+ }
25487
+ }).catch(() => {
25488
+ });
25489
+ } else {
25490
+ handleEdit();
25447
25491
  }
25448
25492
  }
25449
25493
  }
@@ -31209,6 +31253,7 @@ var table_default = (
31209
31253
  const mouseOpts = computeMouseOpts.value;
31210
31254
  const exportOpts = computeExportOpts.value;
31211
31255
  const importOpts = computeImportOpts.value;
31256
+ const keyboardOpts = computeKeyboardOpts.value;
31212
31257
  const rowDragOpts = computeRowDragOpts.value;
31213
31258
  const areaOpts = computeAreaOpts.value;
31214
31259
  const sortOpts = computeSortOpts.value;
@@ -31367,8 +31412,16 @@ var table_default = (
31367
31412
  if (mouseOpts.area && props.treeConfig && !treeOpts.transform) {
31368
31413
  errLog10("vxe.error.notSupportProp", ["mouse-config.area", "tree-config.transform=false", "tree-config.transform=true"]);
31369
31414
  }
31370
- if (props.editConfig && editOpts.activeMethod) {
31371
- warnLog7("vxe.error.delProp", ["edit-config.activeMethod", "edit-config.beforeEditMethod"]);
31415
+ if (props.editConfig) {
31416
+ if (editOpts.activeMethod) {
31417
+ warnLog7("vxe.error.delProp", ["edit-config.activeMethod", "edit-config.beforeEditMethod"]);
31418
+ }
31419
+ if (editOpts.beforeEditMethod && editOpts.beforeEditAsyncMethod) {
31420
+ errLog10("vxe.error.errConflicts", ["edit-config.beforeEditMethod", "edit-config.beforeEditAsyncMethod"]);
31421
+ }
31422
+ if (keyboardOpts.isEdit && editOpts.beforeEditAsyncMethod) {
31423
+ warnLog7("vxe.error.errConflicts", ["keyboard-config.isEdit", "edit-config.beforeEditAsyncMethod"]);
31424
+ }
31372
31425
  }
31373
31426
  if (checkboxOpts.halfField) {
31374
31427
  warnLog7("vxe.error.delProp", ["checkbox-config.halfField", "checkbox-config.indeterminateField"]);
@@ -32534,14 +32587,6 @@ var grid_default = (
32534
32587
  return funcs;
32535
32588
  };
32536
32589
  const gridExtendTableMethods = extendTableMethods(tableComponentMethodKeys);
32537
- tableComponentMethodKeys.forEach((name) => {
32538
- gridExtendTableMethods[name] = (...args) => {
32539
- const $xeTable = refTable.value;
32540
- if ($xeTable && $xeTable[name]) {
32541
- return $xeTable && $xeTable[name](...args);
32542
- }
32543
- };
32544
- });
32545
32590
  const computeProxyOpts = (0, import_vue25.computed)(() => {
32546
32591
  return import_xe_utils27.default.merge({}, import_xe_utils27.default.clone(getConfig10().grid.proxyConfig, true), props.proxyConfig);
32547
32592
  });