@tomino/dynamic-form-semantic-ui
Version:
Semantic UI form renderer based on dynamic form generation
15 lines • 857 B
JavaScript
import * as React from 'react';
import { observer } from 'mobx-react';
import { Checkbox } from 'semantic-ui-react';
import { DynamicComponent } from '../wrapper';
import { processControl, getValue } from '../helpers';
const checkboxProps = ['radio', 'slider', 'toggle'];
const CheckboxComponent = props => {
const { source, disabled, controlProps, value, handleChange } = processControl(props);
return (React.createElement(DynamicComponent, Object.assign({}, props, { control: Checkbox, controlProps: checkboxProps, name: source, label: controlProps.text, readOnly: disabled, checked: !!value, onChange: handleChange, disabled: disabled })));
};
export const CheckboxView = {
Component: observer(CheckboxComponent),
toString: (_owner, props, context) => (getValue(props, context) ? 'Yes' : 'No')
};
//# sourceMappingURL=checkbox_view.js.map