fix(client): fix mistaken changed api (#3598)

This commit is contained in:
Junyi 2024-03-04 16:45:10 +08:00 committed by GitHub
parent 488616f7fe
commit 87ed436f8c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 7 additions and 7 deletions

View File

@ -12,7 +12,7 @@ export type AppendsTreeSelectProps = {
multiple?: boolean; multiple?: boolean;
filter?(field): boolean; filter?(field): boolean;
collection?: string; collection?: string;
useCollection_deprecated?(props: Pick<AppendsTreeSelectProps, 'collection'>): string; useCollection?(props: Pick<AppendsTreeSelectProps, 'collection'>): string;
rootOption?: { rootOption?: {
label: string; label: string;
value: string; value: string;
@ -78,7 +78,7 @@ export const AppendsTreeSelect: React.FC<TreeSelectProps & AppendsTreeSelectProp
value: propsValue, value: propsValue,
onChange, onChange,
collection, collection,
useCollection_deprecated = usePropsCollection, useCollection = usePropsCollection,
filter = trueFilter, filter = trueFilter,
rootOption, rootOption,
loadData: propsLoadData, loadData: propsLoadData,
@ -88,7 +88,7 @@ export const AppendsTreeSelect: React.FC<TreeSelectProps & AppendsTreeSelectProp
const compile = useCompile(); const compile = useCompile();
const { t } = useTranslation(); const { t } = useTranslation();
const [optionsMap, setOptionsMap] = useState({}); const [optionsMap, setOptionsMap] = useState({});
const baseCollection = useCollection_deprecated({ collection }); const baseCollection = useCollection({ collection });
const treeData = Object.values(optionsMap); const treeData = Object.values(optionsMap);
const value: string | DefaultOptionType[] = useMemo(() => { const value: string | DefaultOptionType[] = useMemo(() => {
if (props.multiple) { if (props.multiple) {
@ -99,7 +99,7 @@ export const AppendsTreeSelect: React.FC<TreeSelectProps & AppendsTreeSelectProp
const loadData = useCallback( const loadData = useCallback(
async (option) => { async (option) => {
if (propsLoadData !== null) { if (propsLoadData != null) {
return propsLoadData(option); return propsLoadData(option);
} }
if (!option.isLeaf && option.loadChildren) { if (!option.isLeaf && option.loadChildren) {

View File

@ -176,7 +176,7 @@ export class SnapshotFieldInterface extends CollectionFieldInterface {
'x-component': 'AppendsTreeSelect', 'x-component': 'AppendsTreeSelect',
'x-component-props': { 'x-component-props': {
multiple: true, multiple: true,
useCollection_deprecated: useRecordCollection, useCollection: useRecordCollection,
}, },
'x-reactions': [ 'x-reactions': [
{ {

View File

@ -44,7 +44,7 @@ export default class extends Trigger {
'x-component-props': { 'x-component-props': {
title: 'Preload associations', title: 'Preload associations',
multiple: true, multiple: true,
useCollection_deprecated() { useCollection() {
const { values } = useForm(); const { values } = useForm();
return values?.collection; return values?.collection;
}, },

View File

@ -174,7 +174,7 @@ export const appends = {
'x-component-props': { 'x-component-props': {
title: 'Preload associations', title: 'Preload associations',
multiple: true, multiple: true,
useCollection_deprecated() { useCollection() {
const { values } = useForm(); const { values } = useForm();
return values?.collection; return values?.collection;
}, },