+
+
+ {({ loading, data }) => {
+ if (!loading || data) {
+ const {
+ edges,
+ pageInfo: { totalCount }
+ } = data;
+ const isEdgesNotIncludeValue = value && edges && !edges.find(({ id }) => id === value.id);
+ const renderOptions = () => {
+ const defaultValue = `Select ${pascalize(schema.name)}`;
+ const defaultOption =
+ parseInt(formattedValue.key) === 0
+ ? [
+
+ ]
+ : [];
+ return edges
+ ? edges.reduce((acc, opt) => {
+ acc.push(
+
+ );
+ return acc;
+ }, defaultOption)
+ : defaultOption;
+ };
+
+ const getSearchProps = () => {
+ return {
+ filterOption: false,
+ value: isEdgesNotIncludeValue && dirty ? { key: `${edges[0].id}` } : formattedValue
+ };
+ };
+
+ const getChildrenProps = () => {
+ return {
+ optionFilterProp: 'children',
+ filterOption: (input, { props: { children } }) =>
+ children.toLowerCase().includes(input.toLowerCase()),
+ value: formattedValue
+ };
+ };
+
+ const basicProps = {
+ allowClear: formType !== 'form' ? true : optional,
+ showSearch: true,
+ labelInValue: true,
+ dropdownMatchSelectWidth: false,
+ style,
+ onSearch: this.search,
+ onChange: this.handleChange(edges || null),
+ onBlur: this.handleBlur
+ };
+ const filterProps = totalCount > LIMIT ? getSearchProps() : getChildrenProps();
+ const props = { ...basicProps, ...filterProps };
+ return ;
+ } else {
+ return ;
+ }
+ }}
+
+
+
+ );
+ }
+}
diff --git a/modules/look/client-react/ui-antd/components/RenderSwitch.jsx b/modules/look/client-react/ui-antd/components/RenderSwitch.jsx
new file mode 100644
index 0000000000..679ddb4f26
--- /dev/null
+++ b/modules/look/client-react/ui-antd/components/RenderSwitch.jsx
@@ -0,0 +1,45 @@
+import React from 'react';
+import PropTypes from 'prop-types';
+import { FormItem, Switch } from './index';
+
+export default class RenderSwitch extends React.Component {
+ static propTypes = {
+ input: PropTypes.object,
+ setFieldValue: PropTypes.func.isRequired,
+ setFieldTouched: PropTypes.func.isRequired,
+ label: PropTypes.string,
+ type: PropTypes.string,
+ formItemLayout: PropTypes.object,
+ meta: PropTypes.object
+ };
+
+ handleChange = value => {
+ const {
+ input: { name },
+ setFieldValue
+ } = this.props;
+ setFieldValue(name, value);
+ };
+
+ render() {
+ const {
+ input: { value },
+ label,
+ formItemLayout,
+ meta: { touched, error }
+ } = this.props;
+
+ return (
+