|
@@ -0,0 +1,84 @@
|
|
|
+import React from 'react'
|
|
|
+import { Select as FormilySelect } from '@formily/antd'
|
|
|
+import { createBehavior, createResource } from '@designable/core'
|
|
|
+import { DnFC } from '@designable/react'
|
|
|
+import { createFieldSchema } from '../Field'
|
|
|
+import { AllSchemas } from '../../schemas'
|
|
|
+import { AllLocales } from '../../locales'
|
|
|
+
|
|
|
+export const Select: DnFC<React.ComponentProps<typeof FormilySelect>> = FormilySelect
|
|
|
+
|
|
|
+Select.Behavior = createBehavior(
|
|
|
+ {
|
|
|
+ name: 'Select',
|
|
|
+ extends: ['Field'],
|
|
|
+ selector: node => node.props['name'] === 'linkPID',
|
|
|
+ designerProps: {
|
|
|
+ propsSchema: createFieldSchema(AllSchemas.Select)
|
|
|
+ },
|
|
|
+ designerLocales: { 'zh-CN': { ...AllLocales.Select['zh-CN'], title: '关联项目' } }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'Select',
|
|
|
+ extends: ['Field'],
|
|
|
+ selector: node => node.props['name'] === 'gcType',
|
|
|
+ designerProps: {
|
|
|
+ propsSchema: createFieldSchema(AllSchemas.Select)
|
|
|
+ },
|
|
|
+ designerLocales: { 'zh-CN': { ...AllLocales.Select['zh-CN'], title: '工程类型' } }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'Select',
|
|
|
+ extends: ['Field'],
|
|
|
+ selector: node => node.props['name'] === 'pType',
|
|
|
+ designerProps: {
|
|
|
+ propsSchema: createFieldSchema(AllSchemas.Select)
|
|
|
+ },
|
|
|
+ designerLocales: { 'zh-CN': { ...AllLocales.Select['zh-CN'], title: '项目类型' } }
|
|
|
+ }
|
|
|
+)
|
|
|
+
|
|
|
+Select.Resource = createResource(
|
|
|
+ {
|
|
|
+ icon: 'SelectSource',
|
|
|
+ elements: [
|
|
|
+ {
|
|
|
+ componentName: 'Field',
|
|
|
+ props: {
|
|
|
+ title: '关联项目',
|
|
|
+ name: 'linkPID',
|
|
|
+ 'x-decorator': 'FormItem',
|
|
|
+ 'x-component': 'Select'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ icon: 'SelectSource',
|
|
|
+ elements: [
|
|
|
+ {
|
|
|
+ componentName: 'Field',
|
|
|
+ props: {
|
|
|
+ title: '工程类型',
|
|
|
+ name: 'gcType',
|
|
|
+ 'x-decorator': 'FormItem',
|
|
|
+ 'x-component': 'Select'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ icon: 'SelectSource',
|
|
|
+ elements: [
|
|
|
+ {
|
|
|
+ componentName: 'Field',
|
|
|
+ props: {
|
|
|
+ title: '项目类型',
|
|
|
+ name: 'pType',
|
|
|
+ 'x-decorator': 'FormItem',
|
|
|
+ 'x-component': 'Select'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+)
|