mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 06:55:50 +00:00
refactor(plugin-workflow): allow system values to be assigned in create and update node (#2345)
This commit is contained in:
parent
493965f848
commit
1125ff76a0
@ -32,14 +32,6 @@ function AssociationInput(props) {
|
||||
return <Input {...props} value={value} onChange={onChange} />;
|
||||
}
|
||||
|
||||
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]);
|
||||
|
@ -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<any>();
|
||||
|
||||
function onValueChange({ target }) {
|
||||
|
Loading…
Reference in New Issue
Block a user