@visactor/vtable 1.17.3-alpha.1 → 1.17.3-alpha.2

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 (59) hide show
  1. package/cjs/PivotTable.d.ts +5 -0
  2. package/cjs/PivotTable.js +13 -0
  3. package/cjs/PivotTable.js.map +1 -1
  4. package/cjs/core/BaseTable.js +15 -14
  5. package/cjs/core/BaseTable.js.map +1 -1
  6. package/cjs/dataset/dataset.js +6 -4
  7. package/cjs/dataset/dataset.js.map +1 -1
  8. package/cjs/index.d.ts +1 -1
  9. package/cjs/index.js +1 -1
  10. package/cjs/index.js.map +1 -1
  11. package/cjs/layout/pivot-header-layout.js +5 -3
  12. package/cjs/layout/pivot-header-layout.js.map +1 -1
  13. package/cjs/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
  14. package/cjs/scenegraph/graphic/contributions/rect-contribution-render.js +4 -4
  15. package/cjs/scenegraph/graphic/contributions/rect-contribution-render.js.map +1 -1
  16. package/cjs/scenegraph/select/create-select-border.js +13 -2
  17. package/cjs/scenegraph/select/create-select-border.js.map +1 -1
  18. package/cjs/state/state.js +79 -47
  19. package/cjs/state/state.js.map +1 -1
  20. package/cjs/ts-types/base-table.d.ts +1 -0
  21. package/cjs/ts-types/base-table.js.map +1 -1
  22. package/cjs/ts-types/common.d.ts +3 -1
  23. package/cjs/ts-types/common.js.map +1 -1
  24. package/cjs/ts-types/events.d.ts +3 -1
  25. package/cjs/ts-types/events.js.map +1 -1
  26. package/cjs/ts-types/table-engine.d.ts +1 -0
  27. package/cjs/ts-types/table-engine.js.map +1 -1
  28. package/cjs/vrender.js.map +1 -1
  29. package/dist/vtable.js +184 -62
  30. package/dist/vtable.min.js +1 -1
  31. package/es/PivotTable.d.ts +5 -0
  32. package/es/PivotTable.js +13 -0
  33. package/es/PivotTable.js.map +1 -1
  34. package/es/core/BaseTable.js +15 -14
  35. package/es/core/BaseTable.js.map +1 -1
  36. package/es/dataset/dataset.js +6 -4
  37. package/es/dataset/dataset.js.map +1 -1
  38. package/es/index.d.ts +1 -1
  39. package/es/index.js +1 -1
  40. package/es/index.js.map +1 -1
  41. package/es/layout/pivot-header-layout.js +5 -3
  42. package/es/layout/pivot-header-layout.js.map +1 -1
  43. package/es/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
  44. package/es/scenegraph/graphic/contributions/rect-contribution-render.js +4 -4
  45. package/es/scenegraph/graphic/contributions/rect-contribution-render.js.map +1 -1
  46. package/es/scenegraph/select/create-select-border.js +13 -2
  47. package/es/scenegraph/select/create-select-border.js.map +1 -1
  48. package/es/state/state.js +79 -47
  49. package/es/state/state.js.map +1 -1
  50. package/es/ts-types/base-table.d.ts +1 -0
  51. package/es/ts-types/base-table.js.map +1 -1
  52. package/es/ts-types/common.d.ts +3 -1
  53. package/es/ts-types/common.js.map +1 -1
  54. package/es/ts-types/events.d.ts +3 -1
  55. package/es/ts-types/events.js.map +1 -1
  56. package/es/ts-types/table-engine.d.ts +1 -0
  57. package/es/ts-types/table-engine.js.map +1 -1
  58. package/es/vrender.js.map +1 -1
  59. package/package.json +4 -4
package/es/state/state.js CHANGED
@@ -429,82 +429,114 @@ export class StateManager {
429
429
  updateVerticalScrollBar(yRatio) {
430
430
  var _a, _b;
431
431
  const totalHeight = this.table.getAllRowsHeight(), oldVerticalBarPos = this.scroll.verticalBarPos;
432
- this.scroll.verticalBarPos = Math.ceil(yRatio * (totalHeight - this.table.scenegraph.height)),
433
- isValid(this.scroll.verticalBarPos) && !isNaN(this.scroll.verticalBarPos) || (this.scroll.verticalBarPos = 0),
434
- this.table.scenegraph.setY(-this.scroll.verticalBarPos, 1 === yRatio), this.scroll.verticalBarPos -= this.table.scenegraph.proxy.deltaY,
435
- this.table.scenegraph.proxy.deltaY = 0, this.updateHoverPos(-1, -1), this.table.fireListeners(TABLE_EVENT_TYPE.SCROLL, {
432
+ let verticalBarPos = Math.ceil(yRatio * (totalHeight - this.table.scenegraph.height));
433
+ isValid(verticalBarPos) && !isNaN(verticalBarPos) || (verticalBarPos = 0);
434
+ const dy = verticalBarPos - this.table.scenegraph.proxy.deltaY - oldVerticalBarPos;
435
+ if (this.table.fireListeners(TABLE_EVENT_TYPE.SCROLL, {
436
436
  event: void 0,
437
- scrollTop: this.scroll.verticalBarPos,
437
+ scrollTop: verticalBarPos - this.table.scenegraph.proxy.deltaY,
438
438
  scrollLeft: this.scroll.horizontalBarPos,
439
439
  scrollHeight: null === (_a = this.table.theme.scrollStyle) || void 0 === _a ? void 0 : _a.width,
440
440
  scrollWidth: null === (_b = this.table.theme.scrollStyle) || void 0 === _b ? void 0 : _b.width,
441
441
  viewHeight: this.table.tableNoFrameHeight,
442
442
  viewWidth: this.table.tableNoFrameWidth,
443
443
  scrollDirection: "vertical",
444
- scrollRatioY: yRatio
445
- }), oldVerticalBarPos !== this.scroll.verticalBarPos && this.checkVerticalScrollBarEnd();
444
+ scrollRatioY: yRatio,
445
+ dy: dy
446
+ }).some((value => !1 === value))) {
447
+ const yRatio = this.scroll.verticalBarPos / (totalHeight - this.table.scenegraph.height);
448
+ this.table.scenegraph.component.updateVerticalScrollBarPos(yRatio);
449
+ } else this.scroll.verticalBarPos = verticalBarPos, this.table.scenegraph.setY(-this.scroll.verticalBarPos, 1 === yRatio),
450
+ this.scroll.verticalBarPos -= this.table.scenegraph.proxy.deltaY, this.table.scenegraph.proxy.deltaY = 0,
451
+ this.updateHoverPos(-1, -1), oldVerticalBarPos !== this.scroll.verticalBarPos && this.checkVerticalScrollBarEnd();
446
452
  }
447
453
  updateHorizontalScrollBar(xRatio) {
448
454
  var _a, _b;
449
455
  const totalWidth = this.table.getAllColsWidth(), oldHorizontalBarPos = this.scroll.horizontalBarPos;
450
- this.scroll.horizontalBarPos = Math.ceil(xRatio * (totalWidth - this.table.scenegraph.width)),
451
- isValid(this.scroll.horizontalBarPos) && !isNaN(this.scroll.horizontalBarPos) || (this.scroll.horizontalBarPos = 0),
452
- this.table.scenegraph.setX(-this.scroll.horizontalBarPos, 1 === xRatio), this.scroll.horizontalBarPos -= this.table.scenegraph.proxy.deltaX,
453
- this.table.scenegraph.proxy.deltaX = 0, this.updateHoverPos(-1, -1), this.table.fireListeners(TABLE_EVENT_TYPE.SCROLL, {
456
+ let horizontalBarPos = Math.ceil(xRatio * (totalWidth - this.table.scenegraph.width));
457
+ isValid(horizontalBarPos) && !isNaN(horizontalBarPos) || (horizontalBarPos = 0);
458
+ const dx = horizontalBarPos - this.table.scenegraph.proxy.deltaX - oldHorizontalBarPos;
459
+ if (this.table.fireListeners(TABLE_EVENT_TYPE.SCROLL, {
454
460
  event: void 0,
455
461
  scrollTop: this.scroll.verticalBarPos,
456
- scrollLeft: this.scroll.horizontalBarPos,
462
+ scrollLeft: horizontalBarPos - this.table.scenegraph.proxy.deltaX,
457
463
  scrollHeight: null === (_a = this.table.theme.scrollStyle) || void 0 === _a ? void 0 : _a.width,
458
464
  scrollWidth: null === (_b = this.table.theme.scrollStyle) || void 0 === _b ? void 0 : _b.width,
459
465
  viewHeight: this.table.tableNoFrameHeight,
460
466
  viewWidth: this.table.tableNoFrameWidth,
461
467
  scrollDirection: "horizontal",
462
- scrollRatioX: xRatio
463
- }), oldHorizontalBarPos !== this.scroll.horizontalBarPos && this.checkHorizontalScrollBarEnd();
468
+ scrollRatioX: xRatio,
469
+ dx: dx
470
+ }).some((value => !1 === value))) {
471
+ const xRatio = this.scroll.horizontalBarPos / (totalWidth - this.table.scenegraph.width);
472
+ this.table.scenegraph.component.updateHorizontalScrollBarPos(xRatio);
473
+ } else this.scroll.horizontalBarPos = horizontalBarPos, this.table.scenegraph.setX(-this.scroll.horizontalBarPos, 1 === xRatio),
474
+ this.scroll.horizontalBarPos -= this.table.scenegraph.proxy.deltaX, this.table.scenegraph.proxy.deltaX = 0,
475
+ this.updateHoverPos(-1, -1), oldHorizontalBarPos !== this.scroll.horizontalBarPos && this.checkHorizontalScrollBarEnd();
464
476
  }
465
477
  setScrollTop(top, event, triggerEvent = !0) {
466
- var _a, _b, _c;
478
+ var _a, _b, _c, _d, _e;
467
479
  const totalHeight = this.table.getAllRowsHeight(), sizeTolerance = (null === (_a = this.table.options.customConfig) || void 0 === _a ? void 0 : _a._disableColumnAndRowSizeRound) ? 1 : 0;
468
480
  top = Math.max(0, Math.min(top, totalHeight - this.table.scenegraph.height - sizeTolerance)),
469
- ((top = Math.ceil(top)) !== this.scroll.verticalBarPos || this.table.isPivotChart()) && this.updateHoverPos(-1, -1);
470
- const oldVerticalBarPos = this.scroll.verticalBarPos;
481
+ top = Math.ceil(top);
482
+ const oldVerticalBarPos = this.scroll.verticalBarPos, yRatio = top / (totalHeight - this.table.scenegraph.height);
483
+ if ((oldVerticalBarPos !== top || !0 === (null === (_c = null === (_b = this.table.options) || void 0 === _b ? void 0 : _b.customConfig) || void 0 === _c ? void 0 : _c.scrollEventAlwaysTrigger)) && triggerEvent) {
484
+ let verticalBarPos = top;
485
+ isValid(verticalBarPos) && !isNaN(verticalBarPos) || (verticalBarPos = 0);
486
+ const dy = verticalBarPos - oldVerticalBarPos;
487
+ if (this.table.fireListeners(TABLE_EVENT_TYPE.SCROLL, {
488
+ event: null == event ? void 0 : event.nativeEvent,
489
+ scrollTop: verticalBarPos,
490
+ scrollLeft: this.scroll.horizontalBarPos,
491
+ scrollHeight: null === (_d = this.table.theme.scrollStyle) || void 0 === _d ? void 0 : _d.width,
492
+ scrollWidth: null === (_e = this.table.theme.scrollStyle) || void 0 === _e ? void 0 : _e.width,
493
+ viewHeight: this.table.tableNoFrameHeight,
494
+ viewWidth: this.table.tableNoFrameWidth,
495
+ scrollDirection: "vertical",
496
+ scrollRatioY: yRatio,
497
+ dy: dy
498
+ }).some((value => !1 === value))) {
499
+ const yRatio = this.scroll.verticalBarPos / (totalHeight - this.table.scenegraph.height);
500
+ return void this.table.scenegraph.component.updateVerticalScrollBarPos(yRatio);
501
+ }
502
+ }
503
+ (top !== this.scroll.verticalBarPos || this.table.isPivotChart()) && this.updateHoverPos(-1, -1),
471
504
  this.scroll.verticalBarPos = top, isValid(this.scroll.verticalBarPos) && !isNaN(this.scroll.verticalBarPos) || (this.scroll.verticalBarPos = 0),
472
- this.table.scenegraph.setY(-top);
473
- const yRatio = top / (totalHeight - this.table.scenegraph.height);
474
- this.table.scenegraph.component.updateVerticalScrollBarPos(yRatio), oldVerticalBarPos !== top && triggerEvent && (this.table.fireListeners(TABLE_EVENT_TYPE.SCROLL, {
475
- event: null == event ? void 0 : event.nativeEvent,
476
- scrollTop: this.scroll.verticalBarPos,
477
- scrollLeft: this.scroll.horizontalBarPos,
478
- scrollHeight: null === (_b = this.table.theme.scrollStyle) || void 0 === _b ? void 0 : _b.width,
479
- scrollWidth: null === (_c = this.table.theme.scrollStyle) || void 0 === _c ? void 0 : _c.width,
480
- viewHeight: this.table.tableNoFrameHeight,
481
- viewWidth: this.table.tableNoFrameWidth,
482
- scrollDirection: "vertical",
483
- scrollRatioY: yRatio
484
- }), this.checkVerticalScrollBarEnd());
505
+ this.table.scenegraph.setY(-top), this.table.scenegraph.component.updateVerticalScrollBarPos(yRatio),
506
+ oldVerticalBarPos !== top && triggerEvent && this.checkVerticalScrollBarEnd();
485
507
  }
486
508
  setScrollLeft(left, event, triggerEvent = !0) {
487
- var _a, _b, _c;
509
+ var _a, _b, _c, _d, _e;
488
510
  this.table.scrollLeft;
489
511
  const totalWidth = this.table.getAllColsWidth(), sizeTolerance = (this.table.getFrozenColsWidth(),
490
512
  (null === (_a = this.table.options.customConfig) || void 0 === _a ? void 0 : _a._disableColumnAndRowSizeRound) ? 1 : 0);
491
513
  left = Math.max(0, Math.min(left, totalWidth - this.table.scenegraph.width - sizeTolerance)),
492
- (left = Math.ceil(left)) !== this.scroll.horizontalBarPos && this.updateHoverPos(-1, -1);
493
- const oldHorizontalBarPos = this.scroll.horizontalBarPos;
494
- this.scroll.horizontalBarPos = left, isValid(this.scroll.horizontalBarPos) && !isNaN(this.scroll.horizontalBarPos) || (this.scroll.horizontalBarPos = 0),
495
- this.table.scenegraph.setX(-left);
496
- const xRatio = left / (totalWidth - this.table.scenegraph.width);
497
- this.table.scenegraph.component.updateHorizontalScrollBarPos(xRatio), oldHorizontalBarPos !== left && triggerEvent && (this.table.fireListeners(TABLE_EVENT_TYPE.SCROLL, {
498
- event: null == event ? void 0 : event.nativeEvent,
499
- scrollTop: this.scroll.verticalBarPos,
500
- scrollLeft: this.scroll.horizontalBarPos,
501
- scrollHeight: null === (_b = this.table.theme.scrollStyle) || void 0 === _b ? void 0 : _b.width,
502
- scrollWidth: null === (_c = this.table.theme.scrollStyle) || void 0 === _c ? void 0 : _c.width,
503
- viewHeight: this.table.tableNoFrameHeight,
504
- viewWidth: this.table.tableNoFrameWidth,
505
- scrollDirection: "horizontal",
506
- scrollRatioX: xRatio
507
- }), this.checkHorizontalScrollBarEnd());
514
+ left = Math.ceil(left);
515
+ const oldHorizontalBarPos = this.scroll.horizontalBarPos, xRatio = left / (totalWidth - this.table.scenegraph.width);
516
+ if ((oldHorizontalBarPos !== left || !0 === (null === (_c = null === (_b = this.table.options) || void 0 === _b ? void 0 : _b.customConfig) || void 0 === _c ? void 0 : _c.scrollEventAlwaysTrigger)) && triggerEvent) {
517
+ let horizontalBarPos = left;
518
+ isValid(horizontalBarPos) && !isNaN(horizontalBarPos) || (horizontalBarPos = 0);
519
+ const dx = horizontalBarPos - oldHorizontalBarPos;
520
+ if (this.table.fireListeners(TABLE_EVENT_TYPE.SCROLL, {
521
+ event: null == event ? void 0 : event.nativeEvent,
522
+ scrollTop: this.scroll.verticalBarPos,
523
+ scrollLeft: horizontalBarPos,
524
+ scrollHeight: null === (_d = this.table.theme.scrollStyle) || void 0 === _d ? void 0 : _d.width,
525
+ scrollWidth: null === (_e = this.table.theme.scrollStyle) || void 0 === _e ? void 0 : _e.width,
526
+ viewHeight: this.table.tableNoFrameHeight,
527
+ viewWidth: this.table.tableNoFrameWidth,
528
+ scrollDirection: "horizontal",
529
+ scrollRatioX: xRatio,
530
+ dx: dx
531
+ }).some((value => !1 === value))) {
532
+ const xRatio = this.scroll.horizontalBarPos / (totalWidth - this.table.scenegraph.width);
533
+ return void this.table.scenegraph.component.updateHorizontalScrollBarPos(xRatio);
534
+ }
535
+ }
536
+ left !== this.scroll.horizontalBarPos && this.updateHoverPos(-1, -1), this.scroll.horizontalBarPos = left,
537
+ isValid(this.scroll.horizontalBarPos) && !isNaN(this.scroll.horizontalBarPos) || (this.scroll.horizontalBarPos = 0),
538
+ this.table.scenegraph.setX(-left), this.table.scenegraph.component.updateHorizontalScrollBarPos(xRatio),
539
+ oldHorizontalBarPos !== left && triggerEvent && this.checkHorizontalScrollBarEnd();
508
540
  }
509
541
  hideVerticalScrollBar() {
510
542
  this.table.scenegraph.component.hideVerticalScrollBar();