Add grouping feature for model view forms (#1853)

This commit is contained in:
Matt Irvine
2018-07-05 11:36:29 -07:00
committed by GitHub
parent cb060cb5db
commit 9c4580fe40
5 changed files with 141 additions and 23 deletions

View File

@@ -82,7 +82,7 @@ declare module 'sqlops' {
}
export interface FormBuilder extends ContainerBuilder<FormContainer, FormLayout, FormItemLayout> {
withFormItems(components: FormComponent[], itemLayout?: FormItemLayout): ContainerBuilder<FormContainer, FormLayout, FormItemLayout>;
withFormItems(components: (FormComponent | FormComponentGroup)[], itemLayout?: FormItemLayout): FormBuilder;
/**
* Creates a collection of child components and adds them all to this container
@@ -90,7 +90,7 @@ declare module 'sqlops' {
* @param formComponents the definitions
* @param {*} [itemLayout] Optional layout for the child items
*/
addFormItems(formComponents: Array<FormComponent>, itemLayout?: FormItemLayout): void;
addFormItems(formComponents: Array<FormComponent | FormComponentGroup>, itemLayout?: FormItemLayout): void;
/**
* Creates a child component and adds it to this container.
@@ -98,7 +98,7 @@ declare module 'sqlops' {
* @param formComponent the component to be added
* @param {*} [itemLayout] Optional layout for this child item
*/
addFormItem(formComponent: FormComponent, itemLayout?: FormItemLayout): void;
addFormItem(formComponent: FormComponent | FormComponentGroup, itemLayout?: FormItemLayout): void;
}
export interface Component {
@@ -137,6 +137,21 @@ declare module 'sqlops' {
required?: boolean;
}
/**
* Used to create a group of components in a form layout
*/
export interface FormComponentGroup {
/**
* The form components to display in the group along with optional layouts for each item
*/
components: (FormComponent & { layout?: FormItemLayout })[];
/**
* The title of the group, displayed above its components
*/
title: string;
}
export interface ToolbarComponent {
component: Component;
title?: string;