Skip to content

Commit fe8700b

Browse files
authored
Merge branch 'VisActor:develop' into fix/3975
2 parents 836d2d8 + 19e9583 commit fe8700b

9 files changed

Lines changed: 74 additions & 10 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@visactor/vtable",
5+
"comment": "fix: fix node-canvas range in PivotChart #3997",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@visactor/vtable"
10+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"changes": [
3+
{
4+
"comment": "fix: when pointer up set isDown false\n\n",
5+
"type": "none",
6+
"packageName": "@visactor/vtable"
7+
}
8+
],
9+
"packageName": "@visactor/vtable",
10+
"email": "892739385@qq.com"
11+
}

packages/vtable/src/components/menu/dom/logic/MenuElement.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -572,8 +572,13 @@ export class MenuElement {
572572
const rootElement = this._rootElement;
573573
// const element = table.getElement();
574574
const element = table.internalProps.menu.parentElement ?? table.getElement();
575-
const { width: containerWidth, left: containerLeft, top: containerTop } = element.getBoundingClientRect();
576-
const { x: rootLeft, y: rootTop, width: rootWidth } = rootElement.getBoundingClientRect();
575+
const {
576+
width: containerWidth,
577+
height: containerHeight,
578+
left: containerLeft,
579+
top: containerTop
580+
} = element.getBoundingClientRect();
581+
const { x: rootLeft, y: rootTop, width: rootWidth, height: rootHeight } = rootElement.getBoundingClientRect();
577582

578583
if (secondElement) {
579584
// if (secondElement.parentElement !== rootElement) {
@@ -589,12 +594,20 @@ export class MenuElement {
589594
secondElement.style.maxWidth = `${maxWidth}px`;
590595
//计算弹出框的宽度
591596
const secondElementWidth = secondElement.clientWidth;
592-
// const secondElementHeight = secondElement.clientHeight;
597+
const secondElementHeight = secondElement.clientHeight;
593598

594599
const secondElementTop = y - 4 - containerTop;
595600
const secondElementLeft = x - containerLeft;
596601

597-
secondElement.style.top = `${secondElementTop}px`;
602+
let topStyle = secondElementTop;
603+
// 判断如果超出下范围则靠上边显示
604+
if (topStyle + secondElementHeight > containerHeight) {
605+
const secondElementItem = secondElement.firstElementChild;
606+
topStyle = topStyle - secondElementHeight + secondElementItem.clientHeight + 4;
607+
}
608+
609+
secondElement.style.top = `${topStyle}px`;
610+
598611
let leftStyle = secondElementLeft;
599612

600613
// 判断如果超出右范围则靠左边显示

packages/vtable/src/core/BaseTable.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4260,8 +4260,24 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI {
42604260
this.render();
42614261
const stage = this.scenegraph.stage;
42624262
if (stage) {
4263-
const contentWidth = this.tableX + this.getAllColsWidth();
4264-
const contentHeight = this.tableY + this.getAllRowsHeight();
4263+
let contentWidth = this.tableX + this.getAllColsWidth();
4264+
let contentHeight = this.tableY + this.getAllRowsHeight();
4265+
if (this.internalProps.legends) {
4266+
this.internalProps.legends.forEach(legend => {
4267+
if (legend.orient === 'right') {
4268+
contentWidth = Math.max(contentWidth, legend.legendComponent.globalAABBBounds.x2);
4269+
} else if (legend.orient === 'bottom') {
4270+
contentHeight = Math.max(contentHeight, legend.legendComponent.globalAABBBounds.y2);
4271+
}
4272+
});
4273+
}
4274+
if (this.internalProps.title) {
4275+
if (this.internalProps.title._titleOption.orient === 'right') {
4276+
contentWidth = Math.max(contentWidth, this.internalProps.title.getComponentGraphic().globalAABBBounds.x2);
4277+
} else if (this.internalProps.title._titleOption.orient === 'bottom') {
4278+
contentHeight = Math.max(contentHeight, this.internalProps.title.getComponentGraphic().globalAABBBounds.y2);
4279+
}
4280+
}
42654281
if (contentWidth >= this.canvasWidth && contentHeight >= this.canvasHeight) {
42664282
stage.render();
42674283
const buffer = stage.window.getImageBuffer(type);

packages/vtable/src/data/DataSource.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,6 +1209,9 @@ export class DataSource extends EventTarget implements DataSourceAPI {
12091209
this._sourceLength = this._source?.length || 0;
12101210
this.sortedIndexMap.clear();
12111211
this.currentIndexedData = Array.from({ length: this._sourceLength }, (_, i) => i);
1212+
if (this.rowHierarchyType === 'tree') {
1213+
this.initTreeHierarchyState();
1214+
}
12121215
if (!this.userPagination) {
12131216
this.pagination.perPageCount = this._sourceLength;
12141217
this.pagination.totalCount = this._sourceLength;

packages/vtable/src/event/listener/container-dom.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,7 @@ export function bindContainerDomListener(eventManager: EventManager) {
705705
});
706706
}
707707
}
708+
stateManager.updateInteractionState(InteractionState.default);
708709
};
709710
eventManager.globalEventListeners.push({
710711
name: 'pointerup',

packages/vtable/src/event/listener/table-group.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,7 @@ export function bindTableGroupListener(eventManager: EventManager) {
635635
}
636636
}
637637
setTimeout(() => {
638+
eventManager.isDown = false;
638639
eventManager.isTouchdown = false;
639640
eventManager.isTouchMove = false;
640641
eventManager.isDraging = false;

packages/vtable/src/event/scroll.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ export function handleWhell(event: FederatedWheelEvent, state: StateManager, isW
2222
state.updateInteractionState(InteractionState.scrolling);
2323
}
2424
}
25-
25+
const autoHide = state.table.options.theme?.scrollStyle?.visible === 'scrolling';
2626
if (optimizedDeltaX) {
2727
state.setScrollLeft(state.scroll.horizontalBarPos + optimizedDeltaX, event);
28-
state.showHorizontalScrollBar(true);
28+
state.showHorizontalScrollBar(autoHide);
2929
}
3030
if (optimizedDeltaY) {
3131
state.setScrollTop(state.scroll.verticalBarPos + optimizedDeltaY, event);
32-
state.showVerticalScrollBar(true);
32+
state.showVerticalScrollBar(autoHide);
3333
}
3434
isWheelEvent && state.resetInteractionState(state.interactionStateBeforeScroll);
3535
if (

packages/vtable/src/event/self-event-listener/base-table/right-button-click.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,16 @@ export function rightButtonClickEvent(table: BaseTableAPI) {
1010
if (ranges.length > 0) {
1111
for (let i = 0; i < ranges.length; i++) {
1212
const range = ranges[i];
13-
if (col >= range.start.col && col <= range.end.col && row >= range.start.row && row <= range.end.row) {
13+
const startCol = range.start.col;
14+
const endCol = range.end.col;
15+
const startRow = range.start.row;
16+
const endRow = range.end.row;
17+
if (
18+
(col >= startCol && col <= endCol && row >= startRow && row <= endRow) || // 左上向右下选择
19+
(col >= endCol && col <= startCol && row >= endRow && row <= startRow) || // 右下向左上选择
20+
(col >= startCol && col <= endCol && row >= endRow && row <= startRow) || // 左下向右上选择
21+
(col >= endCol && col <= startCol && row >= startRow && row <= endRow) // 右上向左下选择
22+
) {
1423
cellInRange = true;
1524
break;
1625
}

0 commit comments

Comments
 (0)