vxe-table 4.10.11 → 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 (48) 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/table.js +28 -26
  9. package/es/table/style.css +10 -2
  10. package/es/table/style.min.css +1 -1
  11. package/es/ui/index.js +1 -1
  12. package/es/ui/src/log.js +1 -1
  13. package/es/vxe-table/style.css +10 -2
  14. package/es/vxe-table/style.min.css +1 -1
  15. package/lib/index.css +1 -1
  16. package/lib/index.min.css +1 -1
  17. package/lib/index.umd.js +172 -87
  18. package/lib/index.umd.min.js +1 -1
  19. package/lib/style.css +1 -1
  20. package/lib/style.min.css +1 -1
  21. package/lib/table/module/edit/hook.js +7 -8
  22. package/lib/table/module/edit/hook.min.js +1 -1
  23. package/lib/table/module/validator/hook.js +16 -0
  24. package/lib/table/module/validator/hook.min.js +1 -1
  25. package/lib/table/render/index.js +109 -41
  26. package/lib/table/render/index.min.js +1 -1
  27. package/lib/table/src/table.js +38 -36
  28. package/lib/table/src/table.min.js +1 -1
  29. package/lib/table/style/style.css +10 -2
  30. package/lib/table/style/style.min.css +1 -1
  31. package/lib/ui/index.js +1 -1
  32. package/lib/ui/index.min.js +1 -1
  33. package/lib/ui/src/log.js +1 -1
  34. package/lib/ui/src/log.min.js +1 -1
  35. package/lib/vxe-table/style/style.css +10 -2
  36. package/lib/vxe-table/style/style.min.css +1 -1
  37. package/package.json +1 -1
  38. package/packages/table/module/edit/hook.ts +7 -8
  39. package/packages/table/module/validator/hook.ts +11 -0
  40. package/packages/table/render/index.ts +120 -51
  41. package/packages/table/src/table.ts +28 -26
  42. package/styles/components/table.scss +10 -2
  43. /package/es/{iconfont.1739164577907.ttf → iconfont.1739237387649.ttf} +0 -0
  44. /package/es/{iconfont.1739164577907.woff → iconfont.1739237387649.woff} +0 -0
  45. /package/es/{iconfont.1739164577907.woff2 → iconfont.1739237387649.woff2} +0 -0
  46. /package/lib/{iconfont.1739164577907.ttf → iconfont.1739237387649.ttf} +0 -0
  47. /package/lib/{iconfont.1739164577907.woff → iconfont.1739237387649.woff} +0 -0
  48. /package/lib/{iconfont.1739164577907.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.11";
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.11"}`;
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
@@ -16535,46 +16535,12 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
16535
16535
  * 如果单元格配置了校验规则,则会进行校验
16536
16536
  */
16537
16537
  updateStatus(slotParams, cellValue) {
16538
- const customVal = !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isUndefined(cellValue);
16539
16538
  return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)().then(() => {
16540
16539
  const {
16541
16540
  editRules
16542
16541
  } = props;
16543
- const {
16544
- validStore
16545
- } = reactData;
16546
- const tableBody = refTableBody.value;
16547
- if (slotParams && tableBody && editRules) {
16548
- const {
16549
- row,
16550
- column
16551
- } = slotParams;
16552
- const type = 'change';
16553
- if ($xeTable.hasCellRules) {
16554
- if ($xeTable.hasCellRules(type, row, column)) {
16555
- const cell = tableMethods.getCellElement(row, column);
16556
- if (cell) {
16557
- return $xeTable.validCellRules(type, row, column, cellValue).then(() => {
16558
- if (customVal && validStore.visible) {
16559
- setCellValue(row, column, cellValue);
16560
- }
16561
- $xeTable.clearValidate(row, column);
16562
- }).catch(({
16563
- rule
16564
- }) => {
16565
- if (customVal) {
16566
- setCellValue(row, column, cellValue);
16567
- }
16568
- $xeTable.showValidTooltip({
16569
- rule,
16570
- row,
16571
- column,
16572
- cell
16573
- });
16574
- });
16575
- }
16576
- }
16577
- }
16542
+ if (slotParams && editRules) {
16543
+ return $xeTable.handleCellRuleUpdateStatus('change', slotParams, cellValue);
16578
16544
  }
16579
16545
  });
16580
16546
  },
@@ -19284,6 +19250,42 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
19284
19250
  $xeTable.handleColumnSortEvent(evnt, column);
19285
19251
  }
19286
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
+ },
19287
19289
  /**
19288
19290
  * 表头单元格按下事件
19289
19291
  */
@@ -23021,11 +23023,8 @@ edit_hook_hooks.add('tableEditModule', {
23021
23023
  $columnIndex: $xeTable.getVMColumnIndex(column)
23022
23024
  }, evnt || null);
23023
23025
  }
23024
- (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)(() => {
23025
- if (mouseConfig && mouseOpts.area && $xeTable.handleRecalculateCellAreas) {
23026
- return $xeTable.handleRecalculateCellAreas();
23027
- }
23028
- });
23026
+ focused.row = null;
23027
+ focused.column = null;
23029
23028
  if (validOpts.autoClear) {
23030
23029
  if (validOpts.msgMode !== 'full' || hook_getConfig().cellVaildMode === 'obsolete') {
23031
23030
  if ($xeTable.clearValidate) {
@@ -23033,9 +23032,11 @@ edit_hook_hooks.add('tableEditModule', {
23033
23032
  }
23034
23033
  }
23035
23034
  }
23036
- focused.row = null;
23037
- focused.column = null;
23038
- 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
+ });
23039
23040
  };
23040
23041
  editMethods = {
23041
23042
  /**
@@ -26178,9 +26179,16 @@ validator_hook_hooks.add('tableValidatorModule', {
26178
26179
  editRules,
26179
26180
  treeConfig
26180
26181
  } = props;
26182
+ const {
26183
+ editStore,
26184
+ pendingRowMaps
26185
+ } = reactData;
26181
26186
  const {
26182
26187
  afterFullData
26183
26188
  } = internalData;
26189
+ const {
26190
+ removeMaps
26191
+ } = editStore;
26184
26192
  const treeOpts = computeTreeOpts.value;
26185
26193
  const childrenField = treeOpts.children || treeOpts.childrenField;
26186
26194
  const validOpts = computeValidOpts.value;
@@ -26209,6 +26217,15 @@ validator_hook_hooks.add('tableValidatorModule', {
26209
26217
  if (editRules) {
26210
26218
  const columns = cols && cols.length ? cols : $xeTable.getColumns();
26211
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
+ }
26212
26229
  if (isFull || !validRuleErr) {
26213
26230
  const colVailds = [];
26214
26231
  columns.forEach(column => {
@@ -27132,12 +27149,17 @@ function getCellLabelVNs(renderOpts, params, cellLabel) {
27132
27149
  * @param modelFunc
27133
27150
  * @param changeFunc
27134
27151
  */
27135
- function getNativeElementOns(renderOpts, params, modelFunc, changeFunc) {
27152
+ function getNativeElementOns(renderOpts, params, eFns) {
27136
27153
  const {
27137
27154
  events
27138
27155
  } = renderOpts;
27139
27156
  const modelEvent = getModelEvent(renderOpts);
27140
27157
  const changeEvent = getChangeEvent(renderOpts);
27158
+ const {
27159
+ model: modelFunc,
27160
+ change: changeFunc,
27161
+ blur: blurFunc
27162
+ } = eFns || {};
27141
27163
  const isSameEvent = changeEvent === modelEvent;
27142
27164
  const ons = {};
27143
27165
  if (events) {
@@ -27159,15 +27181,24 @@ function getNativeElementOns(renderOpts, params, modelFunc, changeFunc) {
27159
27181
  };
27160
27182
  }
27161
27183
  if (!isSameEvent && changeFunc) {
27162
- ons[getOnName(changeEvent)] = function (...args) {
27163
- changeFunc(...args);
27184
+ ons[getOnName(changeEvent)] = function (evnt) {
27185
+ changeFunc(evnt);
27164
27186
  if (events && events[changeEvent]) {
27165
- 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);
27166
27196
  }
27167
27197
  };
27168
27198
  }
27169
27199
  return ons;
27170
27200
  }
27201
+ const blurEvent = 'blur';
27171
27202
  /**
27172
27203
  * 组件事件处理
27173
27204
  * @param renderOpts
@@ -27175,12 +27206,17 @@ function getNativeElementOns(renderOpts, params, modelFunc, changeFunc) {
27175
27206
  * @param modelFunc
27176
27207
  * @param changeFunc
27177
27208
  */
27178
- function getComponentOns(renderOpts, params, modelFunc, changeFunc) {
27209
+ function getComponentOns(renderOpts, params, eFns) {
27179
27210
  const {
27180
27211
  events
27181
27212
  } = renderOpts;
27182
27213
  const modelEvent = getModelEvent(renderOpts);
27183
27214
  const changeEvent = getChangeEvent(renderOpts);
27215
+ const {
27216
+ model: modelFunc,
27217
+ change: changeFunc,
27218
+ blur: blurFunc
27219
+ } = eFns || {};
27184
27220
  const ons = {};
27185
27221
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().objectEach(events, (func, key) => {
27186
27222
  ons[getOnName(key)] = function (...args) {
@@ -27208,6 +27244,14 @@ function getComponentOns(renderOpts, params, modelFunc, changeFunc) {
27208
27244
  }
27209
27245
  };
27210
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
+ }
27211
27255
  return ons;
27212
27256
  }
27213
27257
  function getEditOns(renderOpts, params) {
@@ -27223,31 +27267,47 @@ function getEditOns(renderOpts, params) {
27223
27267
  model
27224
27268
  } = column;
27225
27269
  const isImmediate = isImmediateCell(renderOpts, params);
27226
- return getComponentOns(renderOpts, params, cellValue => {
27227
- // 处理 model 值双向绑定
27228
- model.update = true;
27229
- model.value = cellValue;
27230
- if (isImmediate) {
27231
- setCellValue(row, column, cellValue);
27232
- }
27233
- }, eventParams => {
27234
- // 处理 change 事件相关逻辑
27235
- if (!isImmediate && ['VxeInput', 'VxeNumberInput', 'VxeTextarea', '$input', '$textarea'].includes(name)) {
27236
- const cellValue = eventParams.value;
27270
+ return getComponentOns(renderOpts, params, {
27271
+ model(cellValue) {
27272
+ // 处理 model 值双向绑定
27237
27273
  model.update = true;
27238
27274
  model.value = cellValue;
27239
- $table.updateStatus(params, cellValue);
27240
- } else {
27241
- $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
+ }
27242
27296
  }
27243
27297
  });
27244
27298
  }
27245
27299
  function getFilterOns(renderOpts, params, option) {
27246
- return getComponentOns(renderOpts, params, value => {
27247
- // 处理 model 值双向绑定
27248
- option.data = value;
27249
- }, () => {
27250
- 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
+ }
27251
27311
  });
27252
27312
  }
27253
27313
  function getNativeEditOns(renderOpts, params) {
@@ -27259,27 +27319,52 @@ function getNativeEditOns(renderOpts, params) {
27259
27319
  const {
27260
27320
  model
27261
27321
  } = column;
27262
- return getNativeElementOns(renderOpts, params, evnt => {
27263
- // 处理 model 值双向绑定
27264
- const cellValue = evnt.target.value;
27265
- if (isImmediateCell(renderOpts, params)) {
27266
- setCellValue(row, column, cellValue);
27267
- } else {
27268
- model.update = true;
27269
- 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
+ }
27270
27350
  }
27271
- }, evnt => {
27272
- // 处理 change 事件相关逻辑
27273
- const cellValue = evnt.target.value;
27274
- $table.updateStatus(params, cellValue);
27275
27351
  });
27276
27352
  }
27277
27353
  function getNativeFilterOns(renderOpts, params, option) {
27278
- return getNativeElementOns(renderOpts, params, evnt => {
27279
- // 处理 model 值双向绑定
27280
- option.data = evnt.target.value;
27281
- }, () => {
27282
- 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
+ }
27283
27368
  });
27284
27369
  }
27285
27370
  /**