added dropdown and form layout to model view (#1269)

* added dropdown and form layout to model view
This commit is contained in:
Leila Lali
2018-04-27 15:43:23 -07:00
committed by GitHub
parent 26b27a616a
commit 886717d330
13 changed files with 569 additions and 45 deletions

View File

@@ -20,23 +20,30 @@ declare module 'sqlops' {
flexContainer(): FlexBuilder;
card(): ComponentBuilder<CardComponent>;
inputBox(): ComponentBuilder<InputBoxComponent>;
button(): ComponentBuilder<ButtonComponent>;
dropDown(): ComponentBuilder<DropDownComponent>;
dashboardWidget(widgetId: string): ComponentBuilder<WidgetComponent>;
dashboardWebview(webviewId: string): ComponentBuilder<WebviewComponent>;
formContainer(): FormBuilder;
}
export interface ComponentBuilder<T extends Component> {
component(): T;
withProperties<U>(properties: U): ComponentBuilder<T>;
}
export interface ContainerBuilder<T extends Component, TLayout,TItemLayout> extends ComponentBuilder<T> {
export interface ContainerBuilder<T extends Component, TLayout, TItemLayout> extends ComponentBuilder<T> {
withLayout(layout: TLayout): ContainerBuilder<T, TLayout, TItemLayout>;
withItems(components: Array<Component>, itemLayout ?: TItemLayout): ContainerBuilder<T, TLayout, TItemLayout>;
withItems(components: Array<Component>, itemLayout?: TItemLayout): ContainerBuilder<T, TLayout, TItemLayout>;
}
export interface FlexBuilder extends ContainerBuilder<FlexContainer, FlexLayout, FlexItemLayout> {
}
export interface FormBuilder extends ContainerBuilder<FormContainer, FormLayout, FormItemLayout> {
withFormItems(components: FormComponent[], itemLayout?: FormItemLayout): ContainerBuilder<FormContainer, FormLayout, FormItemLayout>;
}
export interface Component {
readonly id: string;
@@ -50,10 +57,16 @@ declare module 'sqlops' {
updateProperties(properties: { [key: string]: any }): Thenable<boolean>;
}
export interface FormComponent {
component: Component;
title: string;
actions?: Component[];
}
/**
* A component that contains other components
*/
export interface Container<TLayout,TItemLayout> extends Component {
export interface Container<TLayout, TItemLayout> extends Component {
/**
* A copy of the child items array. This cannot be added to directly -
* components must be created using the create methods instead
@@ -70,7 +83,7 @@ declare module 'sqlops' {
* @param itemConfigs the definitions
* @param {*} [itemLayout] Optional layout for the child items
*/
addItems(itemConfigs: Array<Component>, itemLayout ?: TItemLayout): void;
addItems(itemConfigs: Array<Component>, itemLayout?: TItemLayout): void;
/**
* Creates a child component and adds it to this container.
@@ -78,7 +91,7 @@ declare module 'sqlops' {
* @param {Component} component the component to be added
* @param {*} [itemLayout] Optional layout for this child item
*/
addItem(component: Component, itemLayout ?: TItemLayout): void;
addItem(component: Component, itemLayout?: TItemLayout): void;
/**
* Defines the layout for this container
@@ -130,9 +143,21 @@ declare module 'sqlops' {
flex?: string;
}
export interface FormItemLayout {
}
export interface FormLayout {
}
export interface FlexContainer extends Container<FlexLayout, FlexItemLayout> {
}
export interface FormContainer extends Container<FormLayout, FormItemLayout> {
}
/**
* Describes an action to be shown in the UI, with a user-readable label
* and a callback to execute the action
@@ -153,16 +178,25 @@ declare module 'sqlops' {
* Properties representing the card component, can be used
* when using ModelBuilder to create the component
*/
export interface CardProperties {
export interface CardProperties {
label: string;
value?: string;
actions?: ActionDescriptor[];
}
export interface InputBoxProperties {
export interface InputBoxProperties {
value?: string;
}
export interface DropDownProperties {
value?: string;
values?: string[];
}
export interface ButtonProperties {
label?: string;
}
export interface CardComponent extends Component {
label: string;
value: string;
@@ -174,6 +208,17 @@ declare module 'sqlops' {
onTextChanged: vscode.Event<any>;
}
export interface DropDownComponent extends Component {
value: string;
values: string[];
onValueChanged: vscode.Event<any>;
}
export interface ButtonComponent extends Component {
label: string;
onDidClick: vscode.Event<any>;
}
export interface WidgetComponent extends Component {
widgetId: string;
}