mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-20 17:22:51 -05:00
8
src/sql/azdata.proposed.d.ts
vendored
8
src/sql/azdata.proposed.d.ts
vendored
@@ -803,4 +803,12 @@ declare module 'azdata' {
|
||||
*/
|
||||
headerFilter?: boolean,
|
||||
}
|
||||
|
||||
export interface TableComponent {
|
||||
|
||||
/**
|
||||
* Append data to an exsiting table data.
|
||||
*/
|
||||
appendData(data: any[][]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,8 @@ export enum ComponentEventType {
|
||||
* Actions that can be handled by ModelView components
|
||||
*/
|
||||
export enum ModelViewAction {
|
||||
SelectTab = 'selectTab'
|
||||
SelectTab = 'selectTab',
|
||||
AppendData = 'appendData'
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1427,7 +1427,9 @@ class TableComponentWrapper extends ComponentWrapper implements azdata.TableComp
|
||||
return emitter && emitter.event;
|
||||
}
|
||||
|
||||
|
||||
public appendData(v: any[][]): void {
|
||||
this.doAction(ModelViewAction.AppendData, v);
|
||||
}
|
||||
}
|
||||
|
||||
class DropDownWrapper extends ComponentWrapper implements azdata.DropDownComponent {
|
||||
|
||||
@@ -181,7 +181,8 @@ export enum ModelComponentTypes {
|
||||
}
|
||||
|
||||
export enum ModelViewAction {
|
||||
SelectTab = 'selectTab'
|
||||
SelectTab = 'selectTab',
|
||||
AppendData = 'appendData'
|
||||
}
|
||||
|
||||
export enum ColumnSizingMode {
|
||||
|
||||
@@ -25,7 +25,7 @@ import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
|
||||
import { slickGridDataItemColumnValueWithNoData, textFormatter } from 'sql/base/browser/ui/table/formatters';
|
||||
import { isUndefinedOrNull } from 'vs/base/common/types';
|
||||
import { IComponent, IComponentDescriptor, IModelStore, ComponentEventType } from 'sql/platform/dashboard/browser/interfaces';
|
||||
import { IComponent, IComponentDescriptor, IModelStore, ComponentEventType, ModelViewAction } from 'sql/platform/dashboard/browser/interfaces';
|
||||
import { convertSizeToNumber } from 'sql/base/browser/dom';
|
||||
import { ButtonColumn, ButtonClickEventArgs } from 'sql/base/browser/ui/table/plugins/buttonColumn.plugin';
|
||||
import { createIconCssClass } from 'sql/workbench/browser/modelComponents/iconUtils';
|
||||
@@ -489,4 +489,16 @@ export default class TableComponent extends ComponentBase<azdata.TableComponentP
|
||||
public get headerFilter(): boolean {
|
||||
return this.getPropertyOrDefault<boolean>((props) => props.headerFilter, false);
|
||||
}
|
||||
|
||||
public doAction(action: string, ...args: any[]): void {
|
||||
switch (action) {
|
||||
case ModelViewAction.AppendData:
|
||||
this.appendData(args[0]);
|
||||
}
|
||||
}
|
||||
private appendData(data: any[][]) {
|
||||
this._tableData.push(TableComponent.transformData(data, this.columns));
|
||||
this.data = this._tableData.getItems().map(dataObject => Object.values(dataObject));
|
||||
this.layoutTable();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user