@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.
- package/cjs/PivotTable.d.ts +5 -0
- package/cjs/PivotTable.js +13 -0
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/core/BaseTable.js +15 -14
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/dataset/dataset.js +6 -4
- package/cjs/dataset/dataset.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/layout/pivot-header-layout.js +5 -3
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/rect-contribution-render.js +4 -4
- package/cjs/scenegraph/graphic/contributions/rect-contribution-render.js.map +1 -1
- package/cjs/scenegraph/select/create-select-border.js +13 -2
- package/cjs/scenegraph/select/create-select-border.js.map +1 -1
- package/cjs/state/state.js +79 -47
- package/cjs/state/state.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +1 -0
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/common.d.ts +3 -1
- package/cjs/ts-types/common.js.map +1 -1
- package/cjs/ts-types/events.d.ts +3 -1
- package/cjs/ts-types/events.js.map +1 -1
- package/cjs/ts-types/table-engine.d.ts +1 -0
- package/cjs/ts-types/table-engine.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +184 -62
- package/dist/vtable.min.js +1 -1
- package/es/PivotTable.d.ts +5 -0
- package/es/PivotTable.js +13 -0
- package/es/PivotTable.js.map +1 -1
- package/es/core/BaseTable.js +15 -14
- package/es/core/BaseTable.js.map +1 -1
- package/es/dataset/dataset.js +6 -4
- package/es/dataset/dataset.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/layout/pivot-header-layout.js +5 -3
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
- package/es/scenegraph/graphic/contributions/rect-contribution-render.js +4 -4
- package/es/scenegraph/graphic/contributions/rect-contribution-render.js.map +1 -1
- package/es/scenegraph/select/create-select-border.js +13 -2
- package/es/scenegraph/select/create-select-border.js.map +1 -1
- package/es/state/state.js +79 -47
- package/es/state/state.js.map +1 -1
- package/es/ts-types/base-table.d.ts +1 -0
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/common.d.ts +3 -1
- package/es/ts-types/common.js.map +1 -1
- package/es/ts-types/events.d.ts +3 -1
- package/es/ts-types/events.js.map +1 -1
- package/es/ts-types/table-engine.d.ts +1 -0
- package/es/ts-types/table-engine.js.map +1 -1
- package/es/vrender.js.map +1 -1
- 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
|
-
|
|
433
|
-
isValid(
|
|
434
|
-
|
|
435
|
-
|
|
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.
|
|
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
|
-
|
|
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
|
-
|
|
451
|
-
isValid(
|
|
452
|
-
|
|
453
|
-
|
|
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.
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
493
|
-
const oldHorizontalBarPos = this.scroll.horizontalBarPos;
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
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();
|