mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
fix insert ordering in scrollable splitview (#2392)
This commit is contained in:
@@ -140,6 +140,7 @@ export class ScrollableSplitView extends HeightMap implements IDisposable {
|
|||||||
this.state = State.Busy;
|
this.state = State.Busy;
|
||||||
|
|
||||||
for (let i = 0; i < views.length; i++) {
|
for (let i = 0; i < views.length; i++) {
|
||||||
|
let viewIndex = index + i;
|
||||||
let view = views[i], size = sizes[i];
|
let view = views[i], size = sizes[i];
|
||||||
|
|
||||||
// Add view
|
// Add view
|
||||||
@@ -165,9 +166,9 @@ export class ScrollableSplitView extends HeightMap implements IDisposable {
|
|||||||
|
|
||||||
size = Math.round(size);
|
size = Math.round(size);
|
||||||
const item: IViewItem = { view, container, size, layout, disposable, height: size, top: 0, width: 0 };
|
const item: IViewItem = { view, container, size, layout, disposable, height: size, top: 0, width: 0 };
|
||||||
this.viewItems.splice(index, 0, item);
|
this.viewItems.splice(viewIndex, 0, item);
|
||||||
|
|
||||||
this.onInsertItems(new ArrayIterator([item]), index > 0 ? this.viewItems[index - 1].view.id : undefined);
|
this.onInsertItems(new ArrayIterator([item]), viewIndex > 0 ? this.viewItems[viewIndex - 1].view.id : undefined);
|
||||||
|
|
||||||
// Add sash
|
// Add sash
|
||||||
if (this.options.enableResizing && this.viewItems.length > 1) {
|
if (this.options.enableResizing && this.viewItems.length > 1) {
|
||||||
@@ -190,13 +191,13 @@ export class ScrollableSplitView extends HeightMap implements IDisposable {
|
|||||||
const disposable = combinedDisposable([onStartDisposable, onSashChangeDisposable, onEndDisposable, onDidResetDisposable, sash]);
|
const disposable = combinedDisposable([onStartDisposable, onSashChangeDisposable, onEndDisposable, onDidResetDisposable, sash]);
|
||||||
const sashItem: ISashItem = { sash, disposable };
|
const sashItem: ISashItem = { sash, disposable };
|
||||||
|
|
||||||
this.sashItems.splice(index - 1, 0, sashItem);
|
this.sashItems.splice(viewIndex - 1, 0, sashItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
view.render(container, this.orientation);
|
view.render(container, this.orientation);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.relayout(index);
|
this.relayout();
|
||||||
this.state = State.Idle;
|
this.state = State.Idle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -158,6 +158,8 @@ export class GridPanel extends ViewletPanel {
|
|||||||
tables.push(table);
|
tables.push(table);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// possible to need a sort?
|
||||||
|
|
||||||
if (isUndefinedOrNull(this.maximizedGrid)) {
|
if (isUndefinedOrNull(this.maximizedGrid)) {
|
||||||
this.splitView.addViews(tables, tables.map(i => i.minimumSize), this.splitView.length);
|
this.splitView.addViews(tables, tables.map(i => i.minimumSize), this.splitView.length);
|
||||||
}
|
}
|
||||||
@@ -207,6 +209,8 @@ export class GridPanel extends ViewletPanel {
|
|||||||
class GridTable<T> extends Disposable implements IView {
|
class GridTable<T> extends Disposable implements IView {
|
||||||
private static BOTTOMPADDING = 5;
|
private static BOTTOMPADDING = 5;
|
||||||
private static ACTIONBAR_WIDTH = 26;
|
private static ACTIONBAR_WIDTH = 26;
|
||||||
|
// this is the min height for grids
|
||||||
|
private static MIN_GRID_HEIGHT = (minGridHeightInRows * rowHeight) + columnHeight + estimatedScrollBarHeight + GridTable.BOTTOMPADDING;
|
||||||
private table: Table<T>;
|
private table: Table<T>;
|
||||||
private actionBar: ActionBar;
|
private actionBar: ActionBar;
|
||||||
private container = document.createElement('div');
|
private container = document.createElement('div');
|
||||||
@@ -322,9 +326,9 @@ class GridTable<T> extends Disposable implements IView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public get minimumSize(): number {
|
public get minimumSize(): number {
|
||||||
|
// this handles if the row count is small, like 4-5 rows
|
||||||
let smallestRows = ((this.resultSet.rowCount) * rowHeight) + columnHeight + estimatedScrollBarHeight + GridTable.BOTTOMPADDING;
|
let smallestRows = ((this.resultSet.rowCount) * rowHeight) + columnHeight + estimatedScrollBarHeight + GridTable.BOTTOMPADDING;
|
||||||
let smallestSize = (minGridHeightInRows * rowHeight) + columnHeight + estimatedScrollBarHeight + GridTable.BOTTOMPADDING;
|
return Math.min(smallestRows, GridTable.MIN_GRID_HEIGHT);
|
||||||
return Math.min(smallestRows, smallestSize);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public get maximumSize(): number {
|
public get maximumSize(): number {
|
||||||
|
|||||||
Reference in New Issue
Block a user