@tomino/dynamic-form-semantic-ui
Version:
Semantic UI form renderer based on dynamic form generation
47 lines • 1.71 kB
JavaScript
import * as React from 'react';
import { observer } from 'mobx-react';
import { prop, propGroup, boundProp } from '../editor/editor_common';
import { IfView } from './if_view';
import { DynamicComponent } from '../wrapper';
import { TemplateEditor } from './template_editor';
const templates = [
{ text: 'Component View', value: '' },
{ text: 'True Template', value: 'true' },
{ text: 'False Template', value: 'false' }
];
const IfEditorComponent = (props) => {
return (React.createElement(DynamicComponent, Object.assign({}, props),
React.createElement(TemplateEditor, Object.assign({}, props, { extra: props.extra, Component: IfView, options: templates }))));
};
export const IfEditor = {
Component: observer(IfEditorComponent),
title: 'If',
control: 'If',
icon: 'question',
bound: false,
props: {
...propGroup('Condition', {
template: prop({
control: 'Select',
default: 'view',
props: {
options: templates
}
}),
value: boundProp({}),
exists: prop({ type: 'boolean' }),
notExists: prop({ type: 'boolean' }),
equal: prop({ type: 'string' }),
notEqual: prop({ type: 'string' }),
biggerThan: prop({ type: 'number' }),
biggerOrEqualThan: prop({ type: 'number' }),
smallerThan: prop({ type: 'number' }),
smallerOrEqualThan: prop({ type: 'number' }),
expression: prop({
control: 'Textarea',
props: { text: 'Expression' }
})
})
}
};
//# sourceMappingURL=if_editor.js.map