diff --git a/packages/plugins/workflow/src/client/components/CollectionFieldSelect.tsx b/packages/plugins/workflow/src/client/components/CollectionFieldSelect.tsx
new file mode 100644
index 000000000..835bde95d
--- /dev/null
+++ b/packages/plugins/workflow/src/client/components/CollectionFieldSelect.tsx
@@ -0,0 +1,29 @@
+import React from "react";
+import { Cascader } from 'antd';
+import { useTranslation } from 'react-i18next';
+
+import { useCollectionFilterOptions, useCompile } from "@nocobase/client";
+
+
+
+export default function (props) {
+ const { collection, value, onChange } = props;
+ const { t } = useTranslation();
+ const compile = useCompile();
+ const fields = useCollectionFilterOptions(collection);
+
+ return (
+
+ );
+}
diff --git a/packages/plugins/workflow/src/client/nodes/create.tsx b/packages/plugins/workflow/src/client/nodes/create.tsx
index 8d21ff915..b9760d214 100644
--- a/packages/plugins/workflow/src/client/nodes/create.tsx
+++ b/packages/plugins/workflow/src/client/nodes/create.tsx
@@ -5,6 +5,7 @@ import { useCollectionDataSource, useCollectionManager, useCompile } from '@noco
import { BaseTypeSet, CollectionFieldset } from '../calculators';
import { collection, values } from '../schemas/collection';
import { useFlowContext } from '../WorkflowCanvas';
+import CollectionFieldSelect from '../components/CollectionFieldSelect';
@@ -38,24 +39,20 @@ export default {
components: {
CollectionFieldset
},
- getter({ type, options, onChange }) {
- const { t } = useTranslation();
- const compile = useCompile();
- const { collections = [] } = useCollectionManager();
+ getter(props) {
+ const { type, options, onChange } = props;
const { nodes } = useFlowContext();
const { config } = nodes.find(n => n.id == options.nodeId);
- const collection = collections.find(item => item.name === config.collection) ?? { fields: [] };
+ const value = options?.path;
return (
-
+ {
+ onChange({ type, options: { ...options, path: value?.join('.') } });
+ }}
+ />
);
}
};
diff --git a/packages/plugins/workflow/src/client/nodes/query.tsx b/packages/plugins/workflow/src/client/nodes/query.tsx
index 0a97eaf3e..2667dbef9 100644
--- a/packages/plugins/workflow/src/client/nodes/query.tsx
+++ b/packages/plugins/workflow/src/client/nodes/query.tsx
@@ -1,12 +1,11 @@
import React from 'react';
-import { Select } from 'antd';
-import { useTranslation } from 'react-i18next';
import { useCollectionDataSource, useCollectionManager, useCompile } from '@nocobase/client';
import { useFlowContext } from '../WorkflowCanvas';
-import { BaseTypeSet, VariableComponent } from '../calculators';
+import { VariableComponent } from '../calculators';
import { collection, filter } from '../schemas/collection';
+import CollectionFieldSelect from '../components/CollectionFieldSelect';
@@ -45,24 +44,20 @@ export default {
components: {
VariableComponent
},
- getter({ type, options, onChange }) {
- const { t } = useTranslation();
- const compile = useCompile();
- const { collections = [] } = useCollectionManager();
+ getter(props) {
+ const { type, options, onChange } = props;
const { nodes } = useFlowContext();
const { config } = nodes.find(n => n.id == options.nodeId);
- const collection = collections.find(item => item.name === config.collection) ?? { fields: [] };
+ const value = options?.path;
return (
-
+ {
+ onChange({ type, options: { ...options, path: value?.join('.') } });
+ }}
+ />
);
}
};
diff --git a/packages/plugins/workflow/src/client/triggers/collection.tsx b/packages/plugins/workflow/src/client/triggers/collection.tsx
index 3c084a06b..3ac7cfed4 100644
--- a/packages/plugins/workflow/src/client/triggers/collection.tsx
+++ b/packages/plugins/workflow/src/client/triggers/collection.tsx
@@ -5,11 +5,10 @@ import { observer, useForm, useFormEffects } from '@formily/react';
import { useCollectionDataSource, useCollectionManager, useCompile } from '@nocobase/client';
import { useFlowContext } from '../WorkflowCanvas';
-import { BaseTypeSet } from '../calculators';
import { collection, filter } from '../schemas/collection';
-import { useTranslation } from 'react-i18next';
import { css } from '@emotion/css';
import { onFieldValueChange } from '@formily/core';
+import CollectionFieldSelect from '../components/CollectionFieldSelect';
const FieldsSelect = observer((props) => {
const compile = useCompile();
@@ -42,6 +41,8 @@ const FieldsSelect = observer((props) => {
);
});
+
+
export default {
title: '{{t("Collection event")}}',
type: 'collection',
@@ -127,27 +128,19 @@ export default {
components: {
FieldsSelect
},
- getter({ type, options, onChange }) {
- const { t } = useTranslation();
- const compile = useCompile();
- const { collections = [] } = useCollectionManager();
+ getter(props) {
+ const { type, options, onChange } = props;
const { workflow } = useFlowContext();
- const collection = collections.find(item => item.name === workflow.config.collection) ?? { fields: [] };
+ const value = options?.path?.replace(/^data\./, '');
return (
-
+ />
);
}
};