@visactor/vtable 1.13.1-alpha.2 → 1.13.1-alpha.4

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 (57) hide show
  1. package/cjs/ListTable.js +1 -1
  2. package/cjs/ListTable.js.map +1 -1
  3. package/cjs/PivotTable.js +1 -1
  4. package/cjs/PivotTable.js.map +1 -1
  5. package/cjs/core/BaseTable.d.ts +3 -3
  6. package/cjs/core/BaseTable.js +3 -3
  7. package/cjs/core/BaseTable.js.map +1 -1
  8. package/cjs/core/record-helper.js +1 -1
  9. package/cjs/core/record-helper.js.map +1 -1
  10. package/cjs/dataset/dataset-pivot-table.js +2 -1
  11. package/cjs/edit/edit-manager.d.ts +2 -2
  12. package/cjs/edit/edit-manager.js +15 -7
  13. package/cjs/edit/edit-manager.js.map +1 -1
  14. package/cjs/edit/editors.js +1 -2
  15. package/cjs/index.d.ts +1 -1
  16. package/cjs/index.js +1 -1
  17. package/cjs/index.js.map +1 -1
  18. package/cjs/plugins/custom-cell-style.d.ts +1 -1
  19. package/cjs/plugins/custom-cell-style.js +1 -2
  20. package/cjs/plugins/custom-cell-style.js.map +1 -1
  21. package/cjs/tools/update-row.js +5 -5
  22. package/cjs/tools/update-row.js.map +1 -1
  23. package/cjs/ts-types/base-table.d.ts +2 -2
  24. package/cjs/ts-types/base-table.js.map +1 -1
  25. package/cjs/ts-types/table-engine.d.ts +3 -3
  26. package/cjs/ts-types/table-engine.js.map +1 -1
  27. package/cjs/vrender.js.map +1 -1
  28. package/dist/vtable.js +51 -34
  29. package/dist/vtable.min.js +2 -2
  30. package/es/ListTable.js +2 -2
  31. package/es/ListTable.js.map +1 -1
  32. package/es/PivotTable.js +2 -2
  33. package/es/PivotTable.js.map +1 -1
  34. package/es/core/BaseTable.d.ts +3 -3
  35. package/es/core/BaseTable.js +3 -3
  36. package/es/core/BaseTable.js.map +1 -1
  37. package/es/core/record-helper.js +1 -1
  38. package/es/core/record-helper.js.map +1 -1
  39. package/es/dataset/dataset-pivot-table.js +2 -1
  40. package/es/edit/edit-manager.d.ts +2 -2
  41. package/es/edit/edit-manager.js +12 -4
  42. package/es/edit/edit-manager.js.map +1 -1
  43. package/es/edit/editors.js +1 -2
  44. package/es/index.d.ts +1 -1
  45. package/es/index.js +1 -1
  46. package/es/index.js.map +1 -1
  47. package/es/plugins/custom-cell-style.d.ts +1 -1
  48. package/es/plugins/custom-cell-style.js +1 -2
  49. package/es/plugins/custom-cell-style.js.map +1 -1
  50. package/es/tools/update-row.js +5 -5
  51. package/es/tools/update-row.js.map +1 -1
  52. package/es/ts-types/base-table.d.ts +2 -2
  53. package/es/ts-types/base-table.js.map +1 -1
  54. package/es/ts-types/table-engine.d.ts +3 -3
  55. package/es/ts-types/table-engine.js.map +1 -1
  56. package/es/vrender.js.map +1 -1
  57. package/package.json +6 -6
package/dist/vtable.js CHANGED
@@ -12229,10 +12229,7 @@
12229
12229
  const {
12230
12230
  context: context
12231
12231
  } = drawContext;
12232
- context.highPerformanceSave();
12233
- const t1 = graphic.parent.globalTransMatrix,
12234
- t2 = graphic.stage.window.getViewBoxTransform().clone().multiply(t1.a, t1.b, t1.c, t1.d, t1.e, t1.f);
12235
- if (graphic.parent && context.setTransformFromMatrix(t2, !0), drawContribution.dirtyBounds && drawContribution.backupDirtyBounds) {
12232
+ if (context.highPerformanceSave(), context.transformFromMatrix(graphic.transMatrix, !0), drawContribution.dirtyBounds && drawContribution.backupDirtyBounds) {
12236
12233
  tempDirtyBounds.copy(drawContribution.dirtyBounds), tempBackupDirtyBounds.copy(drawContribution.backupDirtyBounds);
12237
12234
  const m = graphic.globalTransMatrix.getInverse();
12238
12235
  drawContribution.dirtyBounds.copy(drawContribution.backupDirtyBounds).transformWithMatrix(m), drawContribution.backupDirtyBounds.copy(drawContribution.dirtyBounds);
@@ -57995,7 +57992,7 @@
57995
57992
  });
57996
57993
  this.table.scenegraph.updateNextFrame();
57997
57994
  }
57998
- arrangeCustomCellStyle(cellPos, customStyleId) {
57995
+ arrangeCustomCellStyle(cellPos, customStyleId, forceFastUpdate) {
57999
57996
  const index = this.customCellStyleArrangement.findIndex(style => {
58000
57997
  if (style.cellPosition.range && cellPos.range) {
58001
57998
  return (style.cellPosition.range.start.col === cellPos.range.start.col &&
@@ -58028,7 +58025,6 @@
58028
58025
  this.customCellStyleArrangement.splice(index, 1);
58029
58026
  }
58030
58027
  const style = this.getCustomCellStyleOption(customStyleId)?.style;
58031
- let forceFastUpdate;
58032
58028
  if (style) {
58033
58029
  forceFastUpdate = true;
58034
58030
  for (const key in style) {
@@ -58340,7 +58336,7 @@
58340
58336
  return TABLE_EVENT_TYPE;
58341
58337
  }
58342
58338
  options;
58343
- version = "1.13.1-alpha.2";
58339
+ version = "1.13.1-alpha.4";
58344
58340
  pagination;
58345
58341
  id = `VTable${Date.now()}`;
58346
58342
  headerStyleCache;
@@ -60904,8 +60900,8 @@
60904
60900
  registerCustomCellStyle(customStyleId, customStyle) {
60905
60901
  this.customCellStylePlugin?.registerCustomCellStyle(customStyleId, customStyle);
60906
60902
  }
60907
- arrangeCustomCellStyle(cellPos, customStyleId) {
60908
- this.customCellStylePlugin?.arrangeCustomCellStyle(cellPos, customStyleId);
60903
+ arrangeCustomCellStyle(cellPos, customStyleId, forceFastUpdate) {
60904
+ this.customCellStylePlugin?.arrangeCustomCellStyle(cellPos, customStyleId, forceFastUpdate);
60909
60905
  }
60910
60906
  isSeriesNumber(col, row) {
60911
60907
  return this.internalProps.layoutMap.isSeriesNumber(col, row);
@@ -63405,7 +63401,7 @@
63405
63401
  }
63406
63402
  }
63407
63403
 
63408
- class EditManeger {
63404
+ class EditManager {
63409
63405
  table;
63410
63406
  editingEditor;
63411
63407
  isValidatingValue = false;
@@ -63500,19 +63496,14 @@
63500
63496
  if (!this.editingEditor.getValue) ;
63501
63497
  if (this.editingEditor.validateValue) {
63502
63498
  this.isValidatingValue = true;
63503
- const maybePromiseOrValue = this.editingEditor.validateValue?.();
63499
+ const newValue = this.editingEditor.getValue();
63500
+ const oldValue = this.table.getCellOriginValue(this.editCell.col, this.editCell.row);
63501
+ const maybePromiseOrValue = this.editingEditor.validateValue?.(newValue, oldValue, this.editCell, this.table);
63504
63502
  if (isPromise(maybePromiseOrValue)) {
63505
63503
  return new Promise((resolve, reject) => {
63506
63504
  maybePromiseOrValue
63507
63505
  .then(result => {
63508
- if (result) {
63509
- this.doExit();
63510
- resolve(true);
63511
- }
63512
- else {
63513
- this.isValidatingValue = false;
63514
- resolve(false);
63515
- }
63506
+ dealWithValidateValue(result, this, oldValue, resolve);
63516
63507
  })
63517
63508
  .catch((err) => {
63518
63509
  this.isValidatingValue = false;
@@ -63520,11 +63511,7 @@
63520
63511
  });
63521
63512
  });
63522
63513
  }
63523
- else if (maybePromiseOrValue) {
63524
- this.doExit();
63525
- return true;
63526
- }
63527
- return false;
63514
+ return dealWithValidateValue(maybePromiseOrValue, this, oldValue);
63528
63515
  }
63529
63516
  this.doExit();
63530
63517
  return true;
@@ -63555,6 +63542,35 @@
63555
63542
  }
63556
63543
  }
63557
63544
  }
63545
+ function dealWithValidateValue(validateValue, editManager, oldValue, resolve) {
63546
+ editManager.isValidatingValue = false;
63547
+ if (validateValue === 'validate-return') {
63548
+ editManager.doExit();
63549
+ resolve?.(true);
63550
+ return true;
63551
+ }
63552
+ else if (validateValue === 'invalidate-return') {
63553
+ editManager.editingEditor.setValue(oldValue);
63554
+ editManager.doExit();
63555
+ resolve?.(true);
63556
+ return true;
63557
+ }
63558
+ else if (validateValue === 'validate-not-return') {
63559
+ resolve?.(false);
63560
+ return false;
63561
+ }
63562
+ else if (validateValue === 'invalidate-not-return') {
63563
+ resolve?.(false);
63564
+ return false;
63565
+ }
63566
+ else if (validateValue === true) {
63567
+ editManager.doExit();
63568
+ resolve?.(true);
63569
+ return true;
63570
+ }
63571
+ resolve?.(false);
63572
+ return false;
63573
+ }
63558
63574
 
63559
63575
  function getGroupByDataConfig(groupByOption) {
63560
63576
  if (isString$2(groupByOption)) {
@@ -63695,7 +63711,10 @@
63695
63711
  isCanChange = true;
63696
63712
  }
63697
63713
  else {
63698
- isCanChange = maybePromiseOrValue;
63714
+ isCanChange =
63715
+ maybePromiseOrValue === true ||
63716
+ maybePromiseOrValue === 'validate-return' ||
63717
+ maybePromiseOrValue === 'invalidate-return';
63699
63718
  }
63700
63719
  }
63701
63720
  }
@@ -64249,8 +64268,8 @@
64249
64268
  const removeCells = [];
64250
64269
  const { addCellPositions, removeCellPositions } = diffPositions;
64251
64270
  const proxy = table.scenegraph.proxy;
64252
- const { rowStart, rowLimit } = proxy;
64253
- let { rowEnd, bodyBottomRow } = proxy;
64271
+ const { rowStart, rowLimit, bodyBottomRow } = proxy;
64272
+ let { rowEnd } = proxy;
64254
64273
  let updateRow = Infinity;
64255
64274
  for (let i = 0; i < addCellPositions.length; i++) {
64256
64275
  const { row: cellRow } = addCellPositions[i];
@@ -64268,20 +64287,18 @@
64268
64287
  }
64269
64288
  }
64270
64289
  for (let i = 0; i < removeCellPositions.length; i++) {
64271
- const { row: cellRow } = removeCellPositions[removeCellPositions.length - i - 1];
64290
+ const { row: cellRow } = removeCellPositions[i];
64272
64291
  if (cellRow < rowStart || cellRow > rowEnd) {
64273
- bodyBottomRow--;
64292
+ continue;
64274
64293
  }
64275
64294
  else if (rowEnd === bodyBottomRow) {
64276
64295
  removeCells.push({
64277
64296
  col,
64278
64297
  row: cellRow
64279
64298
  });
64280
- updateRow--;
64281
64299
  }
64282
64300
  else {
64283
64301
  updateRow = Math.min(updateRow, cellRow);
64284
- bodyBottomRow--;
64285
64302
  }
64286
64303
  }
64287
64304
  if (updateRow !== Infinity) {
@@ -64335,7 +64352,7 @@
64335
64352
  this.showHeader = options.showHeader ?? true;
64336
64353
  this.transpose = options.transpose ?? false;
64337
64354
  if (Env.mode !== 'node') {
64338
- this.editorManager = new EditManeger(this);
64355
+ this.editorManager = new EditManager(this);
64339
64356
  }
64340
64357
  this.refreshHeader();
64341
64358
  this.internalProps.useOneRowHeightFillAll = false;
@@ -75780,7 +75797,7 @@
75780
75797
  this.pivotSortState = options.pivotSortState;
75781
75798
  }
75782
75799
  if (Env.mode !== 'node') {
75783
- this.editorManager = new EditManeger(this);
75800
+ this.editorManager = new EditManager(this);
75784
75801
  }
75785
75802
  this.refreshHeader();
75786
75803
  this.internalProps.useOneRowHeightFillAll = false;
@@ -78816,7 +78833,7 @@
78816
78833
  }
78817
78834
 
78818
78835
  registerForVrender();
78819
- const version = "1.13.1-alpha.2";
78836
+ const version = "1.13.1-alpha.4";
78820
78837
  function getIcons() {
78821
78838
  return get$2();
78822
78839
  }