diff --git a/packages/plugins/@hera/plugin-core/src/client/components/index.ts b/packages/plugins/@hera/plugin-core/src/client/components/index.ts index 56e48fca7..0311cb70d 100644 --- a/packages/plugins/@hera/plugin-core/src/client/components/index.ts +++ b/packages/plugins/@hera/plugin-core/src/client/components/index.ts @@ -1,4 +1,4 @@ -export * from './GroupBlockConfigure/GroupBlockConfigure'; +export * from '../schema-components/blocks/GroupBlockConfigure/GroupBlockConfigure'; export * from './PDFViewer'; export * from './Sheet'; export * from './SignatureInput'; diff --git a/packages/plugins/@hera/plugin-core/src/client/schema-components/AutoComplete/AutoComplete.tsx b/packages/plugins/@hera/plugin-core/src/client/schema-components/auto-complete/AutoComplete.tsx similarity index 100% rename from packages/plugins/@hera/plugin-core/src/client/schema-components/AutoComplete/AutoComplete.tsx rename to packages/plugins/@hera/plugin-core/src/client/schema-components/auto-complete/AutoComplete.tsx diff --git a/packages/plugins/@hera/plugin-core/src/client/schema-components/GroupBlock.tsx b/packages/plugins/@hera/plugin-core/src/client/schema-components/blocks/GroupBlock.tsx similarity index 96% rename from packages/plugins/@hera/plugin-core/src/client/schema-components/GroupBlock.tsx rename to packages/plugins/@hera/plugin-core/src/client/schema-components/blocks/GroupBlock.tsx index 6cfea2605..a06d491e4 100644 --- a/packages/plugins/@hera/plugin-core/src/client/schema-components/GroupBlock.tsx +++ b/packages/plugins/@hera/plugin-core/src/client/schema-components/blocks/GroupBlock.tsx @@ -1,8 +1,8 @@ import { useField, useFieldSchema } from '@formily/react'; import { findFilterTargets, useAPIClient, useBlockRequestContext, useFilterBlock } from '@nocobase/client'; import { Descriptions, DescriptionsProps, Spin } from 'antd'; -import { transformers } from '../components/GroupBlockConfigure/transformers'; -import React, { useEffect, useState } from 'react'; +import { transformers } from './GroupBlockConfigure/transformers'; +import React, { useState } from 'react'; import { useAsyncEffect } from 'ahooks'; type DataItem = { diff --git a/packages/plugins/@hera/plugin-core/src/client/components/GroupBlockConfigure/GroupBlockConfigure.tsx b/packages/plugins/@hera/plugin-core/src/client/schema-components/blocks/GroupBlockConfigure/GroupBlockConfigure.tsx similarity index 77% rename from packages/plugins/@hera/plugin-core/src/client/components/GroupBlockConfigure/GroupBlockConfigure.tsx rename to packages/plugins/@hera/plugin-core/src/client/schema-components/blocks/GroupBlockConfigure/GroupBlockConfigure.tsx index f20917878..7c4fcd866 100644 --- a/packages/plugins/@hera/plugin-core/src/client/components/GroupBlockConfigure/GroupBlockConfigure.tsx +++ b/packages/plugins/@hera/plugin-core/src/client/schema-components/blocks/GroupBlockConfigure/GroupBlockConfigure.tsx @@ -1,8 +1,8 @@ import { SchemaSettingsItem } from '@nocobase/client'; import React, { useContext } from 'react'; -import { useTranslation } from '../../locale'; +import { useTranslation } from '../../../locale'; import { Modal } from 'antd'; -import { GroupBlockContext } from '../../schema-initializer/blocks/GroupBlockInitializer'; +import { GroupBlockContext } from '../../../schema-initializer/blocks/GroupBlockInitializer'; export const GroupBlockConfigure = (props) => { const { t } = useTranslation(); diff --git a/packages/plugins/@hera/plugin-core/src/client/components/GroupBlockConfigure/GroupConfigure.tsx b/packages/plugins/@hera/plugin-core/src/client/schema-components/blocks/GroupBlockConfigure/GroupConfigure.tsx similarity index 98% rename from packages/plugins/@hera/plugin-core/src/client/components/GroupBlockConfigure/GroupConfigure.tsx rename to packages/plugins/@hera/plugin-core/src/client/schema-components/blocks/GroupBlockConfigure/GroupConfigure.tsx index 7c143cdd2..3f7a3f391 100644 --- a/packages/plugins/@hera/plugin-core/src/client/components/GroupBlockConfigure/GroupConfigure.tsx +++ b/packages/plugins/@hera/plugin-core/src/client/schema-components/blocks/GroupBlockConfigure/GroupConfigure.tsx @@ -2,8 +2,8 @@ import { useField, useFieldSchema } from '@formily/react'; import { useDesignable, useFieldNames, useFilterBlock } from '@nocobase/client'; import { App, Button, Flex, Input, Modal, Select } from 'antd'; import React, { useContext, useEffect, useState } from 'react'; -import { useTranslation } from '../../locale'; -import { GroupBlockContext } from '../../schema-initializer/blocks/GroupBlockInitializer'; +import { useTranslation } from '../../../locale'; +import { GroupBlockContext } from '../../../schema-initializer/blocks/GroupBlockInitializer'; import { transformers } from './transformers'; import { DeleteOutlined, PullRequestOutlined } from '@ant-design/icons'; import { uid } from '@formily/shared'; diff --git a/packages/plugins/@hera/plugin-core/src/client/components/GroupBlockConfigure/transformers.tsx b/packages/plugins/@hera/plugin-core/src/client/schema-components/blocks/GroupBlockConfigure/transformers.tsx similarity index 100% rename from packages/plugins/@hera/plugin-core/src/client/components/GroupBlockConfigure/transformers.tsx rename to packages/plugins/@hera/plugin-core/src/client/schema-components/blocks/GroupBlockConfigure/transformers.tsx diff --git a/packages/plugins/@hera/plugin-core/src/client/schema-components/PDFViewer.tsx b/packages/plugins/@hera/plugin-core/src/client/schema-components/blocks/PDFViewer.tsx similarity index 89% rename from packages/plugins/@hera/plugin-core/src/client/schema-components/PDFViewer.tsx rename to packages/plugins/@hera/plugin-core/src/client/schema-components/blocks/PDFViewer.tsx index 87e300e39..0bd3222c9 100644 --- a/packages/plugins/@hera/plugin-core/src/client/schema-components/PDFViewer.tsx +++ b/packages/plugins/@hera/plugin-core/src/client/schema-components/blocks/PDFViewer.tsx @@ -1,8 +1,8 @@ import React, { useEffect, useRef, useState } from 'react'; -import { PDFViewer } from '../components/PDFViewer'; +import { PDFViewer } from '../../components/PDFViewer'; import { Space } from 'antd'; import { css } from '@nocobase/client'; -import { usePDFViewerRef } from '../schema-initializer/blocks/PDFVIewerBlockInitializer'; +import { usePDFViewerRef } from '../../schema-initializer/blocks/PDFVIewerBlockInitializer'; export const InternalPDFViewer = (props) => { const { usePdfPath: useMaybePdfPath } = props; diff --git a/packages/plugins/@hera/plugin-core/src/client/schema-components/index.ts b/packages/plugins/@hera/plugin-core/src/client/schema-components/index.ts index abff9c2e8..5d363e12e 100644 --- a/packages/plugins/@hera/plugin-core/src/client/schema-components/index.ts +++ b/packages/plugins/@hera/plugin-core/src/client/schema-components/index.ts @@ -1,6 +1,6 @@ -export * from './AutoComplete/AutoComplete'; -export * from './GroupBlock'; -export * from './PDFViewer'; +export * from './auto-complete/AutoComplete'; +export * from './blocks/GroupBlock'; +export * from './blocks/PDFViewer'; export * from './date-picker'; export * from './deprecated/ExtendedMenuDesigner'; export * from './remote-select'; diff --git a/packages/plugins/@hera/plugin-core/src/client/schema-initializer/blocks/GroupBlockInitializer.tsx b/packages/plugins/@hera/plugin-core/src/client/schema-initializer/blocks/GroupBlockInitializer.tsx index 840a2406c..cd17dceab 100644 --- a/packages/plugins/@hera/plugin-core/src/client/schema-initializer/blocks/GroupBlockInitializer.tsx +++ b/packages/plugins/@hera/plugin-core/src/client/schema-initializer/blocks/GroupBlockInitializer.tsx @@ -16,8 +16,8 @@ import { import React, { createContext, useState } from 'react'; import { uid } from '@nocobase/utils/client'; import { Checkbox, Spin } from 'antd'; -import { GroupBlockConfigure } from '../../components/GroupBlockConfigure/GroupBlockConfigure'; -import { GroupConfigure } from '../../components/GroupBlockConfigure/GroupConfigure'; +import { GroupBlockConfigure } from '../../schema-components/blocks/GroupBlockConfigure/GroupBlockConfigure'; +import { GroupConfigure } from '../../schema-components/blocks/GroupBlockConfigure/GroupConfigure'; export const GroupBlockContext = createContext({}); diff --git a/packages/plugins/@hera/plugin-core/src/client/schema-initializer/index.ts b/packages/plugins/@hera/plugin-core/src/client/schema-initializer/index.ts index deae60716..ba2bfdfd0 100644 --- a/packages/plugins/@hera/plugin-core/src/client/schema-initializer/index.ts +++ b/packages/plugins/@hera/plugin-core/src/client/schema-initializer/index.ts @@ -1,4 +1,4 @@ -export * from './CustomFilterFormItemInitializer'; +export * from './items/CustomFilterFormItemInitializer'; export * from './blocks/PDFVIewerBlockInitializer'; export * from './actions/OutboundLinkActionInitializer'; export * from './actions/CreateSubmitActionInitializer'; diff --git a/packages/plugins/@hera/plugin-core/src/client/schema-initializer/CustomFilterFormItemInitializer.tsx b/packages/plugins/@hera/plugin-core/src/client/schema-initializer/items/CustomFilterFormItemInitializer.tsx similarity index 96% rename from packages/plugins/@hera/plugin-core/src/client/schema-initializer/CustomFilterFormItemInitializer.tsx rename to packages/plugins/@hera/plugin-core/src/client/schema-initializer/items/CustomFilterFormItemInitializer.tsx index 50af055fb..69e37f6a4 100644 --- a/packages/plugins/@hera/plugin-core/src/client/schema-initializer/CustomFilterFormItemInitializer.tsx +++ b/packages/plugins/@hera/plugin-core/src/client/schema-initializer/items/CustomFilterFormItemInitializer.tsx @@ -37,10 +37,10 @@ import { EditTitleField, SchemaSettingCollection, SchemaSettingComponent, -} from '../schema-settings'; +} from '../../schema-settings'; import _ from 'lodash'; -import { SchemaSettingsRemove } from '../components/FormFilter/SchemaSettingsRemove'; -import { tval, useTranslation } from '../locale'; +import { SchemaSettingsRemove } from '../../components/FormFilter/SchemaSettingsRemove'; +import { tval, useTranslation } from '../../locale'; import { ContractsController } from 'packages/plugins/@hera/plugin-rental/dist/server/actions'; const FieldComponentProps: React.FC = observer( @@ -221,13 +221,14 @@ export const FilterCustomItemInitializer: React.FC<{ title: tval('Association field'), 'x-decorator': 'FormItem', 'x-component': 'Select', + 'x-visible': false, + required: true, 'x-reactions': [ { dependencies: ['collection', 'component'], - when: "{{$deps[1] === 'AssociationCascader'}}", fulfill: { schema: { - 'x-visible': '{{$deps[0] ? true : false}}', + 'x-visible': "{{$deps[0] && $deps[1] === 'AssociationCascader'}}", enum: '{{ useAssociationFields($deps[0]) }}', }, }, @@ -278,14 +279,8 @@ export const FilterCustomItemInitializer: React.FC<{ }, }); const { title, component, collection, associationField } = values; - console.log('=-=======', associationField); const defaultSchema = getInterface(component)?.default?.uiSchema || {}; - let name; - if (component === 'Select' || component === 'AutoComplete') { - name = collection; - } else { - name = component + uid(); - } + const name = uid(); insert( gridRowColWrap({ 'x-component': component, diff --git a/packages/plugins/@hera/plugin-core/src/locale/en-US.json b/packages/plugins/@hera/plugin-core/src/locale/en-US.json index 2628fa9b5..3dffb172d 100644 --- a/packages/plugins/@hera/plugin-core/src/locale/en-US.json +++ b/packages/plugins/@hera/plugin-core/src/locale/en-US.json @@ -17,5 +17,6 @@ "Signature input": "Signature input", "Pick a data entry for viewing and editing": "Pick a data entry for viewing and editing", "Please select": "Please select", + "Association field": "Association field", "HomePage Config": "HomePage Config" } diff --git a/packages/plugins/@hera/plugin-core/src/locale/zh-CN.json b/packages/plugins/@hera/plugin-core/src/locale/zh-CN.json index 9d4bc4396..de2bf6ca6 100644 --- a/packages/plugins/@hera/plugin-core/src/locale/zh-CN.json +++ b/packages/plugins/@hera/plugin-core/src/locale/zh-CN.json @@ -17,5 +17,6 @@ "Signature input": "手写签名", "Pick a data entry for viewing and editing": "选择一条数据用于查看与编辑", "Please select": "请选择", + "Association field": "关联字段", "HomePage Config": "主页配置" }