mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-20 01:02:22 +00:00
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;
|
||
|
}
|
||
|
}
|