fix(client): fix mistaken changed api (#3598)
This commit is contained in:
		
							parent
							
								
									488616f7fe
								
							
						
					
					
						commit
						87ed436f8c
					
				@ -12,7 +12,7 @@ export type AppendsTreeSelectProps = {
 | 
			
		||||
  multiple?: boolean;
 | 
			
		||||
  filter?(field): boolean;
 | 
			
		||||
  collection?: string;
 | 
			
		||||
  useCollection_deprecated?(props: Pick<AppendsTreeSelectProps, 'collection'>): string;
 | 
			
		||||
  useCollection?(props: Pick<AppendsTreeSelectProps, 'collection'>): string;
 | 
			
		||||
  rootOption?: {
 | 
			
		||||
    label: string;
 | 
			
		||||
    value: string;
 | 
			
		||||
@ -78,7 +78,7 @@ export const AppendsTreeSelect: React.FC<TreeSelectProps & AppendsTreeSelectProp
 | 
			
		||||
    value: propsValue,
 | 
			
		||||
    onChange,
 | 
			
		||||
    collection,
 | 
			
		||||
    useCollection_deprecated = usePropsCollection,
 | 
			
		||||
    useCollection = usePropsCollection,
 | 
			
		||||
    filter = trueFilter,
 | 
			
		||||
    rootOption,
 | 
			
		||||
    loadData: propsLoadData,
 | 
			
		||||
@ -88,7 +88,7 @@ export const AppendsTreeSelect: React.FC<TreeSelectProps & AppendsTreeSelectProp
 | 
			
		||||
  const compile = useCompile();
 | 
			
		||||
  const { t } = useTranslation();
 | 
			
		||||
  const [optionsMap, setOptionsMap] = useState({});
 | 
			
		||||
  const baseCollection = useCollection_deprecated({ collection });
 | 
			
		||||
  const baseCollection = useCollection({ collection });
 | 
			
		||||
  const treeData = Object.values(optionsMap);
 | 
			
		||||
  const value: string | DefaultOptionType[] = useMemo(() => {
 | 
			
		||||
    if (props.multiple) {
 | 
			
		||||
@ -99,7 +99,7 @@ export const AppendsTreeSelect: React.FC<TreeSelectProps & AppendsTreeSelectProp
 | 
			
		||||
 | 
			
		||||
  const loadData = useCallback(
 | 
			
		||||
    async (option) => {
 | 
			
		||||
      if (propsLoadData !== null) {
 | 
			
		||||
      if (propsLoadData != null) {
 | 
			
		||||
        return propsLoadData(option);
 | 
			
		||||
      }
 | 
			
		||||
      if (!option.isLeaf && option.loadChildren) {
 | 
			
		||||
 | 
			
		||||
@ -176,7 +176,7 @@ export class SnapshotFieldInterface extends CollectionFieldInterface {
 | 
			
		||||
      'x-component': 'AppendsTreeSelect',
 | 
			
		||||
      'x-component-props': {
 | 
			
		||||
        multiple: true,
 | 
			
		||||
        useCollection_deprecated: useRecordCollection,
 | 
			
		||||
        useCollection: useRecordCollection,
 | 
			
		||||
      },
 | 
			
		||||
      'x-reactions': [
 | 
			
		||||
        {
 | 
			
		||||
 | 
			
		||||
@ -44,7 +44,7 @@ export default class extends Trigger {
 | 
			
		||||
      'x-component-props': {
 | 
			
		||||
        title: 'Preload associations',
 | 
			
		||||
        multiple: true,
 | 
			
		||||
        useCollection_deprecated() {
 | 
			
		||||
        useCollection() {
 | 
			
		||||
          const { values } = useForm();
 | 
			
		||||
          return values?.collection;
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
@ -174,7 +174,7 @@ export const appends = {
 | 
			
		||||
  'x-component-props': {
 | 
			
		||||
    title: 'Preload associations',
 | 
			
		||||
    multiple: true,
 | 
			
		||||
    useCollection_deprecated() {
 | 
			
		||||
    useCollection() {
 | 
			
		||||
      const { values } = useForm();
 | 
			
		||||
      return values?.collection;
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user