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