tachybase_todo/packages/plugins/workflow/src/client/schemas/collection.ts
Junyi 188800c018
Refactor: plugin-workflow client (#1077)
* feat(plugin-worklfow): adjust ui

* refactor(plugin-workflow): move locale into plugin

* fix(plugin-workflow): fix executions history loading
2022-11-11 23:37:41 +08:00

61 lines
1.5 KiB
TypeScript

import { css } from "@emotion/css";
import { useForm } from "@formily/react";
import { useCollectionFilterOptions } from "@nocobase/client";
import { NAMESPACE } from "../locale";
export const collection = {
type: 'string',
title: '{{t("Collection")}}',
name: 'config.collection',
required: true,
'x-reactions': ['{{useCollectionDataSource()}}'],
'x-decorator': 'FormItem',
'x-component': 'Select',
'x-component-props': {
placeholder: '{{t("Select collection")}}'
}
};
export const values = {
type: 'object',
title: '{{t("Fields values")}}',
name: 'config.params.values',
'x-decorator': 'FormItem',
'x-decorator-props': {
labelAlign: 'left',
className: css`
flex-direction: column;
`
},
'x-component': 'CollectionFieldset',
description: `{{t("Fields that are not assigned a value will be set to the default value, and those that do not have a default value are set to null.", { ns: "${NAMESPACE}" })}}`,
};
export const filter = {
type: 'object',
title: '{{t("Filter")}}',
name: 'config.params.filter',
'x-decorator': 'FormItem',
'x-decorator-props': {
labelAlign: 'left',
className: css`
flex-direction: column;
`
},
'x-component': 'Filter',
'x-component-props': {
useProps() {
const { values } = useForm();
const options = useCollectionFilterOptions(values.config?.collection);
return {
options,
className: css`
position: relative;
width: 100%;
`
};
},
dynamicComponent: 'VariableComponent'
}
};