/**
 * This file is part of the NocoBase (R) project.
 * Copyright (c) 2020-2024 NocoBase Co., Ltd.
 * Authors: NocoBase Team.
 *
 * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
 * For more information, please refer to: https://www.nocobase.com/agreement.
 */
import { ISchema } from '@formily/react';
import _ from 'lodash';
import { CollectionRecord } from '../../../data-source/collection-record/CollectionRecord';
import { PopupContext } from './usePopupContextInActionOrAssociationField';
export interface PopupParams {
    /** popup uid */
    popupuid: string;
    /** record id */
    filterbytk?: string;
    /** source id */
    sourceid?: string;
    /** tab uid */
    tab?: string;
    /** collection name */
    collection?: string;
    /** popup uid */
    puid?: string;
}
export interface PopupContextStorage extends PopupContext {
    schema?: ISchema;
    record?: CollectionRecord;
    parentRecord?: CollectionRecord;
    /** used to refresh data for block */
    service?: any;
    sourceId?: string;
    /** Specifically prepared for the 'Table selected records' variable */
    tableBlockContext?: {
        field: any;
        blockData: any;
        rowKey: any;
        collection: string;
    };
}
export declare const getStoredPopupContext: (popupUid: string) => PopupContextStorage;
/**
 * Used to store the context of the current popup.
 *
 * The context that has already been stored, when displaying the popup,
 * will directly retrieve the context information from the cache instead of making an API request.
 * @param popupUid
 * @param params
 * @param isDefault - Determines whether to store the context as a default value in `defaultPopupsContextStorage`
 */
export declare const storePopupContext: (popupUid: string, params: PopupContextStorage, isDefault?: boolean) => void;
export declare const deletePopupContext: (popupUid: string) => void;
export declare const getBlockService: (popupUid: string) => {
    service: any;
};
/**
 * Used to store the service of the block when rendering the button.
 * @param popupUid
 * @param value
 */
export declare const storeBlockService: (popupUid: string, value: {
    service: any;
}) => void;
export declare const getPopupParamsFromPath: ((path: string) => PopupParams[]) & _.MemoizedFunction;
export declare const getPopupPathFromParams: (params: PopupParams) => string;
/**
 * Note: use this hook in a plugin is not recommended
 * @returns
 */
export declare const usePopupUtils: (options?: {
    /**
     * when the popup does not support opening via URL, you can control the display status of the popup through this method
     * @param visible
     * @returns
     */
    setVisible?: (visible: boolean) => void;
}) => {
    /**
     * used to open popup by changing the url
     */
    openPopup: ({ recordData, parentRecordData, collectionNameUsedInURL, popupUidUsedInURL, customActionSchema, }?: {
        recordData?: Record<string, any>;
        parentRecordData?: Record<string, any>;
        /** if this value exists, it will be saved in the URL */
        collectionNameUsedInURL?: string;
        /** if this value exists, it will be saved in the URL */
        popupUidUsedInURL?: string;
        customActionSchema?: ISchema;
    }) => void;
    /**
     * used to close popup by changing the url
     */
    closePopup: (level?: number) => void;
    savePopupSchemaToSchema: (popupSchema: ISchema, targetSchema: ISchema) => void;
    getPopupSchemaFromSchema: (schema: ISchema) => any;
    context: import("./PagePopups").PopupProps;
    /**
     * @deprecated
     * TODO: remove this
     */
    visibleWithURL: boolean;
    /**
     * @deprecated
     * TODO: remove this
     */
    setVisibleWithURL: ((...args: any[]) => void) | ((value: boolean) => void);
    /**
     * @deprecated
     * TODO: remove this
     */
    popupParams: PopupParams;
    /**
     * @deprecated
     * TODO: remove this
     */
    changeTab: (key: string) => void;
    /**
     * @deprecated
     * TODO: remove this
     */
    getPopupContext: () => PopupContext;
};
export declare function removeLastPopupPath(path: string): string;
export declare function withSearchParams(path: string): string;
/**
 * Prevent problems when "popups" appears in the path
 * @param value
 * @returns
 */
export declare function encodePathValue(value: string): string;
/**
 * Prevent problems when "popups" appears in the path
 * @param value
 * @returns
 */
export declare function decodePathValue(value: string): string;
