diff --git a/packages/plugins/workflow/src/client/components/CollectionFieldset.tsx b/packages/plugins/workflow/src/client/components/CollectionFieldset.tsx index 89d39b8b5..98909b5cf 100644 --- a/packages/plugins/workflow/src/client/components/CollectionFieldset.tsx +++ b/packages/plugins/workflow/src/client/components/CollectionFieldset.tsx @@ -32,14 +32,6 @@ function AssociationInput(props) { return ; } -export function useCollectionUIFields(collection) { - const { getCollectionFields } = useCollectionManager(); - - return getCollectionFields(collection).filter( - (field) => !field.hidden && (field.uiSchema ? !field.uiSchema['x-read-pretty'] : false), - ); -} - // NOTE: observer for watching useProps const CollectionFieldSet = observer( ({ value, disabled, onChange, filter }: any) => { @@ -47,11 +39,11 @@ const CollectionFieldSet = observer( const { t } = useTranslation(); const compile = useCompile(); const form = useForm(); - const { getCollection } = useCollectionManager(); + const { getCollection, getCollectionFields } = useCollectionManager(); const scope = useWorkflowVariableOptions(); const { values: config } = form; const collectionName = config?.collection; - const collectionFields = useCollectionUIFields(collectionName); + const collectionFields = getCollectionFields(collectionName); const fields = filter ? collectionFields.filter(filter.bind(config)) : collectionFields; const unassignedFields = useMemo(() => fields.filter((field) => !value || !(field.name in value)), [fields, value]); diff --git a/packages/plugins/workflow/src/client/nodes/update.tsx b/packages/plugins/workflow/src/client/nodes/update.tsx index a26693722..1e12cec33 100644 --- a/packages/plugins/workflow/src/client/nodes/update.tsx +++ b/packages/plugins/workflow/src/client/nodes/update.tsx @@ -1,20 +1,21 @@ +import { useField, useForm } from '@formily/react'; import React from 'react'; -import { useForm, useField } from '@formily/react'; -import { useCollectionDataSource } from '@nocobase/client'; +import { useCollectionDataSource, useCollectionManager } from '@nocobase/client'; +import CollectionFieldset from '../components/CollectionFieldset'; import { FilterDynamicComponent } from '../components/FilterDynamicComponent'; -import CollectionFieldset, { useCollectionUIFields } from '../components/CollectionFieldset'; -import { isValidFilter } from '../utils'; +import { RadioWithTooltip } from '../components/RadioWithTooltip'; import { NAMESPACE, lang } from '../locale'; import { collection, filter, values } from '../schemas/collection'; -import { RadioWithTooltip } from '../components/RadioWithTooltip'; +import { isValidFilter } from '../utils'; function IndividualHooksRadioWithTooltip({ onChange, ...props }) { + const { getCollectionFields } = useCollectionManager(); const form = useForm(); const { collection } = form.values; - const fields = useCollectionUIFields(collection); + const fields = getCollectionFields(collection); const field = useField(); function onValueChange({ target }) {