From 0230d0b44464e001208d0accaf5117efc48a48fd Mon Sep 17 00:00:00 2001 From: niuxiaoguang Date: Tue, 23 Nov 2021 10:46:40 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=20=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E5=AD=90=E8=A1=A8=E5=8D=95=20=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../formFields/importSubform/index.less | 33 ++++++++++ .../formFields/importSubform/index.tsx | 61 +++++++++++++++++++ src/components/formFields/index.tsx | 4 +- 3 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 src/components/formFields/importSubform/index.less create mode 100644 src/components/formFields/importSubform/index.tsx diff --git a/src/components/formFields/importSubform/index.less b/src/components/formFields/importSubform/index.less new file mode 100644 index 0000000..f465c35 --- /dev/null +++ b/src/components/formFields/importSubform/index.less @@ -0,0 +1,33 @@ +.ccms-antd-mini-form-import_subform, .ccms-antd-mini-form-group { + margin-bottom: 0 !important; + + &>:global(.ant-form-item-label) { + width: calc(100% + 16px) !important; + max-width: calc(100% + 16px) !important; + margin-left: -8px !important; + padding: 2px 8px !important; + flex: 0 0 auto !important; + background-color: #00000008 !important; + } + &>:global(.ant-form-item-control) { + margin-left: -8px !important; + margin-right: -8px !important; + padding: 8px !important; + max-width: calc(100% + 16px) !important; + background-color: #00000004 !important; + } + &>:global(.ant-form-item-control):first-child { + padding-top: 0 !important; + background-color: #00000000 !important; + } +} + +.ccms-antd-mini-form-form, .ccms-antd-mini-form-object { + &>:global(.ant-form-item-control) { + &>:global(.ant-form-item-control-input) { + &>:global(.ant-form-item-control-input-content) { + min-height: 24px !important; + } + } + } +} \ No newline at end of file diff --git a/src/components/formFields/importSubform/index.tsx b/src/components/formFields/importSubform/index.tsx new file mode 100644 index 0000000..488cb73 --- /dev/null +++ b/src/components/formFields/importSubform/index.tsx @@ -0,0 +1,61 @@ +import React from "react"; +import { ImportSubformField } from 'ccms'; +import { IImportSubformField, ImportSubformFieldConfig } from "ccms/dist/src/components/formFields/importSubform"; +import { IFormItem } from "ccms/dist/src/steps/form"; +import { Form } from "antd" +import { FormItemProps } from "antd/lib/form"; +import getALLComponents from '../' +import styles from './index.less' +import InterfaceHelper from "../../../util/interface"; + +export const PropsType = (props: ImportSubformFieldConfig) => { }; + +export default class ImportSubformFieldComponent extends ImportSubformField { + getALLComponents = (type: any) => getALLComponents[type] + + interfaceHelper = new InterfaceHelper() + + renderComponent = (props: IImportSubformField) => { + const { + children + } = props + return ( +
+ {children} +
+ ) + } + + renderItemComponent = (props: IFormItem) => { + const { + label, + visitable, + status, + message, + fieldType, + children + } = props + + const formItemLayout: FormItemProps = { labelAlign: 'left' } + if (fieldType === 'form' || fieldType === 'group' || fieldType === 'object' || fieldType === 'import_subform') { + formItemLayout.labelCol = { span: 24 } + formItemLayout.wrapperCol = { span: 24 } + } else { + formItemLayout.labelCol = { span: 6 } + formItemLayout.wrapperCol = { span: 18 } + } + + return ( + + {children} + + ) + } +} \ No newline at end of file diff --git a/src/components/formFields/index.tsx b/src/components/formFields/index.tsx index c75524d..c68c04e 100644 --- a/src/components/formFields/index.tsx +++ b/src/components/formFields/index.tsx @@ -17,6 +17,7 @@ import HiddenField from './hidden' import TabsField from './tabs' import MultipleTextField from './multipleText' import CustomField from './custom' +import ImportSubformField from './importSubform' export default { text: TextField, @@ -37,5 +38,6 @@ export default { hidden: HiddenField, tabs: TabsField, multiple_text: MultipleTextField, - custom: CustomField + custom: CustomField, + import_subform: ImportSubformField } -- Gitee