vxe-table 4.10.10 → 4.10.12

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.
Files changed (52) hide show
  1. package/es/index.css +1 -1
  2. package/es/index.min.css +1 -1
  3. package/es/style.css +1 -1
  4. package/es/style.min.css +1 -1
  5. package/es/table/module/edit/hook.js +7 -8
  6. package/es/table/module/validator/hook.js +11 -0
  7. package/es/table/render/index.js +104 -43
  8. package/es/table/src/header.js +4 -2
  9. package/es/table/src/table.js +28 -26
  10. package/es/table/style.css +10 -2
  11. package/es/table/style.min.css +1 -1
  12. package/es/ui/index.js +1 -1
  13. package/es/ui/src/log.js +1 -1
  14. package/es/vxe-table/style.css +10 -2
  15. package/es/vxe-table/style.min.css +1 -1
  16. package/lib/index.css +1 -1
  17. package/lib/index.min.css +1 -1
  18. package/lib/index.umd.js +176 -89
  19. package/lib/index.umd.min.js +1 -1
  20. package/lib/style.css +1 -1
  21. package/lib/style.min.css +1 -1
  22. package/lib/table/module/edit/hook.js +7 -8
  23. package/lib/table/module/edit/hook.min.js +1 -1
  24. package/lib/table/module/validator/hook.js +16 -0
  25. package/lib/table/module/validator/hook.min.js +1 -1
  26. package/lib/table/render/index.js +109 -41
  27. package/lib/table/render/index.min.js +1 -1
  28. package/lib/table/src/header.js +4 -2
  29. package/lib/table/src/header.min.js +1 -1
  30. package/lib/table/src/table.js +38 -36
  31. package/lib/table/src/table.min.js +1 -1
  32. package/lib/table/style/style.css +10 -2
  33. package/lib/table/style/style.min.css +1 -1
  34. package/lib/ui/index.js +1 -1
  35. package/lib/ui/index.min.js +1 -1
  36. package/lib/ui/src/log.js +1 -1
  37. package/lib/ui/src/log.min.js +1 -1
  38. package/lib/vxe-table/style/style.css +10 -2
  39. package/lib/vxe-table/style/style.min.css +1 -1
  40. package/package.json +2 -2
  41. package/packages/table/module/edit/hook.ts +7 -8
  42. package/packages/table/module/validator/hook.ts +11 -0
  43. package/packages/table/render/index.ts +120 -51
  44. package/packages/table/src/header.ts +4 -2
  45. package/packages/table/src/table.ts +28 -26
  46. package/styles/components/table.scss +10 -2
  47. /package/es/{iconfont.1739161310227.ttf → iconfont.1739237387649.ttf} +0 -0
  48. /package/es/{iconfont.1739161310227.woff → iconfont.1739237387649.woff} +0 -0
  49. /package/es/{iconfont.1739161310227.woff2 → iconfont.1739237387649.woff2} +0 -0
  50. /package/lib/{iconfont.1739161310227.ttf → iconfont.1739237387649.ttf} +0 -0
  51. /package/lib/{iconfont.1739161310227.woff → iconfont.1739237387649.woff} +0 -0
  52. /package/lib/{iconfont.1739161310227.woff2 → iconfont.1739237387649.woff2} +0 -0
package/lib/index.umd.js CHANGED
@@ -3138,7 +3138,7 @@ function eqEmptyValue(cellValue) {
3138
3138
  ;// ./packages/ui/index.ts
3139
3139
 
3140
3140
 
3141
- const version = "4.10.10";
3141
+ const version = "4.10.12";
3142
3142
  core_.VxeUI.version = version;
3143
3143
  core_.VxeUI.tableVersion = version;
3144
3144
  core_.VxeUI.setConfig({
@@ -3585,7 +3585,7 @@ var esnext_iterator_some = __webpack_require__(7550);
3585
3585
  const {
3586
3586
  log: log_log
3587
3587
  } = core_.VxeUI;
3588
- const log_version = `table v${"4.10.10"}`;
3588
+ const log_version = `table v${"4.10.12"}`;
3589
3589
  const warnLog = log_log.create('warn', log_version);
3590
3590
  const errLog = log_log.create('error', log_version);
3591
3591
  ;// ./packages/table/src/columnInfo.ts
@@ -7229,8 +7229,10 @@ const header_renderType = 'header';
7229
7229
  const showResizable = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(column.resizable) ? column.resizable : columnOpts.resizable || allResizable;
7230
7230
  const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
7231
7231
  let isVNPreEmptyStatus = false;
7232
- if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
7233
- isVNPreEmptyStatus = true;
7232
+ if (!isGroup) {
7233
+ if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
7234
+ isVNPreEmptyStatus = true;
7235
+ }
7234
7236
  }
7235
7237
  const tcStyle = {};
7236
7238
  if (hasEllipsis) {
@@ -16533,46 +16535,12 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
16533
16535
  * 如果单元格配置了校验规则,则会进行校验
16534
16536
  */
16535
16537
  updateStatus(slotParams, cellValue) {
16536
- const customVal = !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isUndefined(cellValue);
16537
16538
  return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)().then(() => {
16538
16539
  const {
16539
16540
  editRules
16540
16541
  } = props;
16541
- const {
16542
- validStore
16543
- } = reactData;
16544
- const tableBody = refTableBody.value;
16545
- if (slotParams && tableBody && editRules) {
16546
- const {
16547
- row,
16548
- column
16549
- } = slotParams;
16550
- const type = 'change';
16551
- if ($xeTable.hasCellRules) {
16552
- if ($xeTable.hasCellRules(type, row, column)) {
16553
- const cell = tableMethods.getCellElement(row, column);
16554
- if (cell) {
16555
- return $xeTable.validCellRules(type, row, column, cellValue).then(() => {
16556
- if (customVal && validStore.visible) {
16557
- setCellValue(row, column, cellValue);
16558
- }
16559
- $xeTable.clearValidate(row, column);
16560
- }).catch(({
16561
- rule
16562
- }) => {
16563
- if (customVal) {
16564
- setCellValue(row, column, cellValue);
16565
- }
16566
- $xeTable.showValidTooltip({
16567
- rule,
16568
- row,
16569
- column,
16570
- cell
16571
- });
16572
- });
16573
- }
16574
- }
16575
- }
16542
+ if (slotParams && editRules) {
16543
+ return $xeTable.handleCellRuleUpdateStatus('change', slotParams, cellValue);
16576
16544
  }
16577
16545
  });
16578
16546
  },
@@ -19282,6 +19250,42 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
19282
19250
  $xeTable.handleColumnSortEvent(evnt, column);
19283
19251
  }
19284
19252
  },
19253
+ handleCellRuleUpdateStatus(type, cellParams, cellValue) {
19254
+ const {
19255
+ validStore
19256
+ } = reactData;
19257
+ const {
19258
+ row,
19259
+ column
19260
+ } = cellParams;
19261
+ if ($xeTable.hasCellRules) {
19262
+ if ($xeTable.hasCellRules(type, row, column)) {
19263
+ const cell = $xeTable.getCellElement(row, column);
19264
+ if (cell) {
19265
+ const customVal = !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isUndefined(cellValue);
19266
+ return $xeTable.validCellRules(type, row, column, cellValue).then(() => {
19267
+ if (customVal && validStore.visible) {
19268
+ setCellValue(row, column, cellValue);
19269
+ }
19270
+ $xeTable.clearValidate(row, column);
19271
+ }).catch(({
19272
+ rule
19273
+ }) => {
19274
+ if (customVal) {
19275
+ setCellValue(row, column, cellValue);
19276
+ }
19277
+ $xeTable.showValidTooltip({
19278
+ rule,
19279
+ row,
19280
+ column,
19281
+ cell
19282
+ });
19283
+ });
19284
+ }
19285
+ }
19286
+ }
19287
+ return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
19288
+ },
19285
19289
  /**
19286
19290
  * 表头单元格按下事件
19287
19291
  */
@@ -23019,11 +23023,8 @@ edit_hook_hooks.add('tableEditModule', {
23019
23023
  $columnIndex: $xeTable.getVMColumnIndex(column)
23020
23024
  }, evnt || null);
23021
23025
  }
23022
- (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)(() => {
23023
- if (mouseConfig && mouseOpts.area && $xeTable.handleRecalculateCellAreas) {
23024
- return $xeTable.handleRecalculateCellAreas();
23025
- }
23026
- });
23026
+ focused.row = null;
23027
+ focused.column = null;
23027
23028
  if (validOpts.autoClear) {
23028
23029
  if (validOpts.msgMode !== 'full' || hook_getConfig().cellVaildMode === 'obsolete') {
23029
23030
  if ($xeTable.clearValidate) {
@@ -23031,9 +23032,11 @@ edit_hook_hooks.add('tableEditModule', {
23031
23032
  }
23032
23033
  }
23033
23034
  }
23034
- focused.row = null;
23035
- focused.column = null;
23036
- return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
23035
+ return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)().then(() => {
23036
+ if (mouseConfig && mouseOpts.area && $xeTable.handleRecalculateCellAreas) {
23037
+ return $xeTable.handleRecalculateCellAreas();
23038
+ }
23039
+ });
23037
23040
  };
23038
23041
  editMethods = {
23039
23042
  /**
@@ -26176,9 +26179,16 @@ validator_hook_hooks.add('tableValidatorModule', {
26176
26179
  editRules,
26177
26180
  treeConfig
26178
26181
  } = props;
26182
+ const {
26183
+ editStore,
26184
+ pendingRowMaps
26185
+ } = reactData;
26179
26186
  const {
26180
26187
  afterFullData
26181
26188
  } = internalData;
26189
+ const {
26190
+ removeMaps
26191
+ } = editStore;
26182
26192
  const treeOpts = computeTreeOpts.value;
26183
26193
  const childrenField = treeOpts.children || treeOpts.childrenField;
26184
26194
  const validOpts = computeValidOpts.value;
@@ -26207,6 +26217,15 @@ validator_hook_hooks.add('tableValidatorModule', {
26207
26217
  if (editRules) {
26208
26218
  const columns = cols && cols.length ? cols : $xeTable.getColumns();
26209
26219
  const handleVaild = row => {
26220
+ const rowid = getRowid($xeTable, row);
26221
+ // 是否删除
26222
+ if (removeMaps[rowid]) {
26223
+ return;
26224
+ }
26225
+ // 是否标记删除
26226
+ if (pendingRowMaps[rowid]) {
26227
+ return;
26228
+ }
26210
26229
  if (isFull || !validRuleErr) {
26211
26230
  const colVailds = [];
26212
26231
  columns.forEach(column => {
@@ -27130,12 +27149,17 @@ function getCellLabelVNs(renderOpts, params, cellLabel) {
27130
27149
  * @param modelFunc
27131
27150
  * @param changeFunc
27132
27151
  */
27133
- function getNativeElementOns(renderOpts, params, modelFunc, changeFunc) {
27152
+ function getNativeElementOns(renderOpts, params, eFns) {
27134
27153
  const {
27135
27154
  events
27136
27155
  } = renderOpts;
27137
27156
  const modelEvent = getModelEvent(renderOpts);
27138
27157
  const changeEvent = getChangeEvent(renderOpts);
27158
+ const {
27159
+ model: modelFunc,
27160
+ change: changeFunc,
27161
+ blur: blurFunc
27162
+ } = eFns || {};
27139
27163
  const isSameEvent = changeEvent === modelEvent;
27140
27164
  const ons = {};
27141
27165
  if (events) {
@@ -27157,15 +27181,24 @@ function getNativeElementOns(renderOpts, params, modelFunc, changeFunc) {
27157
27181
  };
27158
27182
  }
27159
27183
  if (!isSameEvent && changeFunc) {
27160
- ons[getOnName(changeEvent)] = function (...args) {
27161
- changeFunc(...args);
27184
+ ons[getOnName(changeEvent)] = function (evnt) {
27185
+ changeFunc(evnt);
27162
27186
  if (events && events[changeEvent]) {
27163
- events[changeEvent](params, ...args);
27187
+ events[changeEvent](params, evnt);
27188
+ }
27189
+ };
27190
+ }
27191
+ if (blurFunc) {
27192
+ ons[getOnName(blurEvent)] = function (evnt) {
27193
+ blurFunc(evnt);
27194
+ if (events && events[blurEvent]) {
27195
+ events[blurEvent](params, evnt);
27164
27196
  }
27165
27197
  };
27166
27198
  }
27167
27199
  return ons;
27168
27200
  }
27201
+ const blurEvent = 'blur';
27169
27202
  /**
27170
27203
  * 组件事件处理
27171
27204
  * @param renderOpts
@@ -27173,12 +27206,17 @@ function getNativeElementOns(renderOpts, params, modelFunc, changeFunc) {
27173
27206
  * @param modelFunc
27174
27207
  * @param changeFunc
27175
27208
  */
27176
- function getComponentOns(renderOpts, params, modelFunc, changeFunc) {
27209
+ function getComponentOns(renderOpts, params, eFns) {
27177
27210
  const {
27178
27211
  events
27179
27212
  } = renderOpts;
27180
27213
  const modelEvent = getModelEvent(renderOpts);
27181
27214
  const changeEvent = getChangeEvent(renderOpts);
27215
+ const {
27216
+ model: modelFunc,
27217
+ change: changeFunc,
27218
+ blur: blurFunc
27219
+ } = eFns || {};
27182
27220
  const ons = {};
27183
27221
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().objectEach(events, (func, key) => {
27184
27222
  ons[getOnName(key)] = function (...args) {
@@ -27206,6 +27244,14 @@ function getComponentOns(renderOpts, params, modelFunc, changeFunc) {
27206
27244
  }
27207
27245
  };
27208
27246
  }
27247
+ if (blurFunc) {
27248
+ ons[getOnName(blurEvent)] = function (...args) {
27249
+ blurFunc(...args);
27250
+ if (events && events[blurEvent]) {
27251
+ events[blurEvent](params, ...args);
27252
+ }
27253
+ };
27254
+ }
27209
27255
  return ons;
27210
27256
  }
27211
27257
  function getEditOns(renderOpts, params) {
@@ -27221,31 +27267,47 @@ function getEditOns(renderOpts, params) {
27221
27267
  model
27222
27268
  } = column;
27223
27269
  const isImmediate = isImmediateCell(renderOpts, params);
27224
- return getComponentOns(renderOpts, params, cellValue => {
27225
- // 处理 model 值双向绑定
27226
- model.update = true;
27227
- model.value = cellValue;
27228
- if (isImmediate) {
27229
- setCellValue(row, column, cellValue);
27230
- }
27231
- }, eventParams => {
27232
- // 处理 change 事件相关逻辑
27233
- if (!isImmediate && ['VxeInput', 'VxeNumberInput', 'VxeTextarea', '$input', '$textarea'].includes(name)) {
27234
- const cellValue = eventParams.value;
27270
+ return getComponentOns(renderOpts, params, {
27271
+ model(cellValue) {
27272
+ // 处理 model 值双向绑定
27235
27273
  model.update = true;
27236
27274
  model.value = cellValue;
27237
- $table.updateStatus(params, cellValue);
27238
- } else {
27239
- $table.updateStatus(params);
27275
+ if (isImmediate) {
27276
+ setCellValue(row, column, cellValue);
27277
+ }
27278
+ },
27279
+ change(eventParams) {
27280
+ // 处理 change 事件相关逻辑
27281
+ if (!isImmediate && name && ['VxeInput', 'VxeNumberInput', 'VxeTextarea', '$input', '$textarea'].includes(name)) {
27282
+ const cellValue = eventParams.value;
27283
+ model.update = true;
27284
+ model.value = cellValue;
27285
+ $table.updateStatus(params, cellValue);
27286
+ } else {
27287
+ $table.updateStatus(params);
27288
+ }
27289
+ },
27290
+ blur() {
27291
+ if (isImmediate) {
27292
+ $table.handleCellRuleUpdateStatus('blur', params);
27293
+ } else {
27294
+ $table.handleCellRuleUpdateStatus('blur', params, model.value);
27295
+ }
27240
27296
  }
27241
27297
  });
27242
27298
  }
27243
27299
  function getFilterOns(renderOpts, params, option) {
27244
- return getComponentOns(renderOpts, params, value => {
27245
- // 处理 model 值双向绑定
27246
- option.data = value;
27247
- }, () => {
27248
- handleConfirmFilter(params, !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(option.data), option);
27300
+ return getComponentOns(renderOpts, params, {
27301
+ model(value) {
27302
+ // 处理 model 值双向绑定
27303
+ option.data = value;
27304
+ },
27305
+ change() {
27306
+ handleConfirmFilter(params, !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(option.data), option);
27307
+ },
27308
+ blur() {
27309
+ handleConfirmFilter(params, !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(option.data), option);
27310
+ }
27249
27311
  });
27250
27312
  }
27251
27313
  function getNativeEditOns(renderOpts, params) {
@@ -27257,27 +27319,52 @@ function getNativeEditOns(renderOpts, params) {
27257
27319
  const {
27258
27320
  model
27259
27321
  } = column;
27260
- return getNativeElementOns(renderOpts, params, evnt => {
27261
- // 处理 model 值双向绑定
27262
- const cellValue = evnt.target.value;
27263
- if (isImmediateCell(renderOpts, params)) {
27264
- setCellValue(row, column, cellValue);
27265
- } else {
27266
- model.update = true;
27267
- model.value = cellValue;
27322
+ return getNativeElementOns(renderOpts, params, {
27323
+ model(evnt) {
27324
+ // 处理 model 值双向绑定
27325
+ const targetEl = evnt.target;
27326
+ if (targetEl) {
27327
+ const cellValue = targetEl.value;
27328
+ if (isImmediateCell(renderOpts, params)) {
27329
+ setCellValue(row, column, cellValue);
27330
+ } else {
27331
+ model.update = true;
27332
+ model.value = cellValue;
27333
+ }
27334
+ }
27335
+ },
27336
+ change(evnt) {
27337
+ // 处理 change 事件相关逻辑
27338
+ const targetEl = evnt.target;
27339
+ if (targetEl) {
27340
+ const cellValue = targetEl.value;
27341
+ $table.updateStatus(params, cellValue);
27342
+ }
27343
+ },
27344
+ blur(evnt) {
27345
+ const targetEl = evnt.target;
27346
+ if (targetEl) {
27347
+ const cellValue = targetEl.value;
27348
+ $table.updateStatus(params, cellValue);
27349
+ }
27268
27350
  }
27269
- }, evnt => {
27270
- // 处理 change 事件相关逻辑
27271
- const cellValue = evnt.target.value;
27272
- $table.updateStatus(params, cellValue);
27273
27351
  });
27274
27352
  }
27275
27353
  function getNativeFilterOns(renderOpts, params, option) {
27276
- return getNativeElementOns(renderOpts, params, evnt => {
27277
- // 处理 model 值双向绑定
27278
- option.data = evnt.target.value;
27279
- }, () => {
27280
- handleConfirmFilter(params, !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(option.data), option);
27354
+ return getNativeElementOns(renderOpts, params, {
27355
+ model(evnt) {
27356
+ // 处理 model 值双向绑定
27357
+ const targetEl = evnt.target;
27358
+ if (targetEl) {
27359
+ option.data = targetEl.value;
27360
+ }
27361
+ },
27362
+ change() {
27363
+ handleConfirmFilter(params, !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(option.data), option);
27364
+ },
27365
+ blur() {
27366
+ handleConfirmFilter(params, !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(option.data), option);
27367
+ }
27281
27368
  });
27282
27369
  }
27283
27370
  /**