diff --git a/packages/plugins/@hera/plugin-core/src/client/schema-components/association-cascader/AssociationCascader.tsx b/packages/plugins/@hera/plugin-core/src/client/schema-components/association-cascader/AssociationCascader.tsx
index d9737762e..1dace2bc0 100644
--- a/packages/plugins/@hera/plugin-core/src/client/schema-components/association-cascader/AssociationCascader.tsx
+++ b/packages/plugins/@hera/plugin-core/src/client/schema-components/association-cascader/AssociationCascader.tsx
@@ -40,8 +40,41 @@ const AssociationCascader = connect((props) => {
}));
return options;
}, [associationField, joinTitleField, titleField, data?.data]);
- return ;
+ return ;
});
+const SingleValueCascader = (props) => {
+ const { value, options, onChange, fieldNames } = props;
+ const arrayValue = value && options ? [] : undefined;
+ if (arrayValue) {
+ for (const option of options) {
+ if (option[fieldNames.value] === value) {
+ arrayValue.push(option[fieldNames.value]);
+ break;
+ }
+ for (const subOption of option.children) {
+ if (subOption[fieldNames.value] === value) {
+ arrayValue.push(option[fieldNames.value]);
+ arrayValue.push(subOption[fieldNames.value]);
+ break;
+ }
+ }
+ }
+ }
+ const newProps = {
+ ...props,
+ value: arrayValue,
+ onChange: (v) => {
+ if (v) {
+ onChange(v[v.length - 1]);
+ } else {
+ onChange(v);
+ }
+ },
+ };
+ return ;
+};
+
+SingleValueCascader.displayName = 'SingleValueCascader';
AssociationCascader.displayName = 'AssociationCascader';
export default AssociationCascader;