mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-20 01:02:22 +00:00
a424450cbe
Summary: A new widget type Forms. For now hidden behind GRIST_EXPERIMENTAL_PLUGINS(). This diff contains all the core moving parts as a serves as a base to extend this functionality further. Test Plan: New test added Reviewers: georgegevoian Reviewed By: georgegevoian Subscribers: paulfitz Differential Revision: https://phab.getgrist.com/D4130
26 lines
679 B
TypeScript
26 lines
679 B
TypeScript
import * as style from './styles';
|
|
import {BoxModel, RenderContext} from 'app/client/components/Forms/Model';
|
|
import {dom} from 'grainjs';
|
|
|
|
/**
|
|
* Component that renders a section of the form.
|
|
*/
|
|
export class SectionModel extends BoxModel {
|
|
public render(context: RenderContext) {
|
|
const children = this.children;
|
|
context.overlay.set(false);
|
|
const view = this.view;
|
|
const box = this;
|
|
|
|
const element = style.cssSection(
|
|
style.cssDrag(),
|
|
dom.forEach(children, (child) =>
|
|
child ? view.renderBox(children, child) : dom('div', 'Empty')
|
|
),
|
|
view.buildDropzone(children, box.placeAfterListChild()),
|
|
);
|
|
|
|
return element;
|
|
}
|
|
}
|