UNPKG

@tomino/dynamic-form-semantic-ui

Version:

Semantic UI form renderer based on dynamic form generation

37 lines 1.33 kB
import * as React from 'react'; import { RepeaterView } from './repeater_view'; import { observer } from 'mobx-react'; import { prop, propGroup, boundProp } from '../editor/editor_common'; import { DynamicComponent } from '../wrapper'; import { TemplateEditor } from './template_editor'; const templates = [ { text: 'Component View', value: 'component' }, { text: 'View Template', value: 'view' }, { text: 'Edit Template', value: 'edit' }, { text: 'Add Template', value: 'add' } ]; const RepeaterComponent = (props) => { return (React.createElement(DynamicComponent, Object.assign({}, props), React.createElement(TemplateEditor, Object.assign({}, props, { extra: props.extra, Component: RepeaterView.Component, options: templates })))); }; export const RepeaterEditor = { Component: observer(RepeaterComponent), title: 'Repeater', control: 'Repeater', icon: 'code', bound: true, valueProvider: 'value', props: propGroup('Repeater', { allowAdd: prop({ type: 'boolean' }), allowEdit: prop({ type: 'boolean' }), value: boundProp(), template: prop({ control: 'Select', default: 'component', props: { options: templates } }) }) }; //# sourceMappingURL=repeater_editor.js.map