* feat(plugin-workflow): add form trigger * test(plugin-workflow): add test cases * fix(client): fix component warning * fix(plugin-workflow): fix context data for create and update * fix(plugin-workflow): allow to select any form type workflow in configuration * fix(client): fix tree component value * fix(client): fix value render in component * fix(plugin-workflow): fix context load * fix(client): fix type * fix(client): fix type * fix(plugin-workflow): fix params * fix(plugin-workflow): fix required * fix(plugin): fix context not matching collection error * fix(plugin-workflow): fix test cases * refactor(plugin-workflow): change trigger workflow action config to cascaded * fix(plugin-workflow): remove useless locale * fix(client): adjust locale * fix(client): remove useless locale
76 lines
2.0 KiB
TypeScript
76 lines
2.0 KiB
TypeScript
import { useForm } from '@formily/react';
|
|
import { css, useCollectionFilterOptions } from '@nocobase/client';
|
|
import { NAMESPACE } from '../locale';
|
|
|
|
export const collection = {
|
|
type: 'string',
|
|
title: '{{t("Collection")}}',
|
|
required: true,
|
|
'x-reactions': [],
|
|
'x-decorator': 'FormItem',
|
|
'x-component': 'CollectionSelect',
|
|
'x-component-props': {
|
|
className: 'auto-width',
|
|
},
|
|
};
|
|
|
|
export const values = {
|
|
type: 'object',
|
|
title: '{{t("Fields values")}}',
|
|
'x-decorator': 'FormItem',
|
|
'x-decorator-props': {
|
|
labelAlign: 'left',
|
|
className: css`
|
|
flex-direction: column;
|
|
`,
|
|
},
|
|
'x-component': 'CollectionFieldset',
|
|
description: `{{t("Unassigned fields will be set to default values, and those without default values will be set to null.", { ns: "${NAMESPACE}" })}}`,
|
|
};
|
|
|
|
export const filter = {
|
|
type: 'object',
|
|
title: '{{t("Filter")}}',
|
|
'x-decorator': 'FormItem',
|
|
'x-component': 'Filter',
|
|
'x-component-props': {
|
|
useProps() {
|
|
const { values } = useForm();
|
|
const options = useCollectionFilterOptions(values?.collection);
|
|
return {
|
|
options,
|
|
className: css`
|
|
position: relative;
|
|
width: 100%;
|
|
`,
|
|
};
|
|
},
|
|
dynamicComponent: 'FilterDynamicComponent',
|
|
},
|
|
};
|
|
|
|
export const appends = {
|
|
type: 'array',
|
|
title: `{{t("Preload associations", { ns: "${NAMESPACE}" })}}`,
|
|
description: `{{t("Please select the associated fields that need to be accessed in subsequent nodes. With more than two levels of to-many associations may cause performance issue, please use with caution.", { ns: "${NAMESPACE}" })}}`,
|
|
'x-decorator': 'FormItem',
|
|
'x-component': 'AppendsTreeSelect',
|
|
'x-component-props': {
|
|
multiple: true,
|
|
useCollection() {
|
|
const { values } = useForm();
|
|
return values?.collection;
|
|
},
|
|
},
|
|
'x-reactions': [
|
|
{
|
|
dependencies: ['collection'],
|
|
fulfill: {
|
|
state: {
|
|
visible: '{{!!$deps[0]}}',
|
|
},
|
|
},
|
|
},
|
|
],
|
|
};
|