mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-20 17:14:11 +00:00
418681915e
Summary: - Forms now have a reset button. - Choice and Reference fields in forms now have an improved select menu. - Formula and attachments column types are no longer mappable or visible in forms. - Fields in a form widget are now removed if their column is deleted. - The preview button in a published form widget has been replaced with a view button. It now opens the published form in a new tab. - A new share menu for published form widgets, with options to copy a link or embed code. - Forms can now have multiple sections. - Form widgets now indicate when publishing is unavailable (e.g. in forks or unsaved documents). - General improvements to form styling. Test Plan: Browser tests. Reviewers: jarek Reviewed By: jarek Subscribers: paulfitz Differential Revision: https://phab.getgrist.com/D4203
28 lines
1.0 KiB
TypeScript
28 lines
1.0 KiB
TypeScript
import {FormLayoutNode, FormLayoutNodeType} from 'app/client/components/FormRenderer';
|
|
import {Columns, Placeholder} from 'app/client/components/Forms/Columns';
|
|
import {Paragraph} from 'app/client/components/Forms/Paragraph';
|
|
import {Section} from 'app/client/components/Forms/Section';
|
|
import {v4 as uuidv4} from 'uuid';
|
|
/**
|
|
* Add any other element you whish to use in the form here.
|
|
* FormView will look for any exported BoxModel derived class in format `type` + `Model`, and use It
|
|
* to render and manage the element.
|
|
*/
|
|
export * from "./Paragraph";
|
|
export * from "./Section";
|
|
export * from './Field';
|
|
export * from './Columns';
|
|
export * from './Submit';
|
|
export * from './Label';
|
|
|
|
export function defaultElement(type: FormLayoutNodeType): FormLayoutNode {
|
|
switch(type) {
|
|
case 'Columns': return Columns();
|
|
case 'Placeholder': return Placeholder();
|
|
case 'Separator': return Paragraph('---');
|
|
case 'Header': return Paragraph('## **Header**', 'center');
|
|
case 'Section': return Section();
|
|
default: return {id: uuidv4(), type};
|
|
}
|
|
}
|