Reviewed-on: daoyoucloud/tachybase#866 Co-authored-by: wjh <wwwjh0710@163.com> Co-committed-by: wjh <wwwjh0710@163.com>
This commit is contained in:
parent
022c315523
commit
6f625b7ad8
@ -17,7 +17,7 @@ import { useTranslation } from 'react-i18next';
|
||||
import { CustomCascader, SchemaComponent } from '../..';
|
||||
import { css, useAPIClient } from '../../..';
|
||||
import { mergeFilter } from '../../../filter-provider/utils';
|
||||
import { useAssociationFieldContext } from './hooks';
|
||||
import useServiceOptions, { useAssociationFieldContext } from './hooks';
|
||||
|
||||
const SchemaField = createSchemaField({
|
||||
components: {
|
||||
@ -55,7 +55,6 @@ const Cascade = connect((props) => {
|
||||
});
|
||||
setSelectedOptions(defaultData);
|
||||
}
|
||||
onDropdownVisibleChange('true');
|
||||
}, [fieldSchema['x-component-props'].value]);
|
||||
const handleGetOptions = async () => {
|
||||
const response = await resource.list({
|
||||
@ -97,6 +96,8 @@ const Cascade = connect((props) => {
|
||||
}
|
||||
});
|
||||
onChange?.(options);
|
||||
} else {
|
||||
onChange?.([]);
|
||||
}
|
||||
};
|
||||
const cascadeOption = (option) => {
|
||||
@ -164,6 +165,7 @@ export const InternalCascader = observer(
|
||||
const { t } = useTranslation();
|
||||
const field: any = useField();
|
||||
const fieldSchema = useFieldSchema();
|
||||
const service = useServiceOptions(props);
|
||||
useEffect(() => {
|
||||
const id = uid();
|
||||
selectForm.addEffects(id, () => {
|
||||
@ -253,6 +255,7 @@ export const InternalCascader = observer(
|
||||
'x-component': AssociationCascadeSelect,
|
||||
'x-component-props': {
|
||||
...props,
|
||||
service,
|
||||
style: { width: '100%' },
|
||||
},
|
||||
'x-read-pretty': false,
|
||||
@ -264,7 +267,7 @@ export const InternalCascader = observer(
|
||||
</FormProvider>
|
||||
);
|
||||
},
|
||||
{ displayName: 'InternalCascade' },
|
||||
{ displayName: 'InternalCascader' },
|
||||
);
|
||||
|
||||
function extractLastNonNullValueObjects(data, flag?) {
|
||||
|
Loading…
Reference in New Issue
Block a user