/** * PisellTabbar 工具函数 */ import { TabbarDataSource } from '../types'; /** * 默认的特殊项配置 */ export declare const defaultItems: { all: { id: number; shop_id: number; parent_id: number; name: any; slug: string; icon: string; }; search: { id: number; shop_id: number; parent_id: number; name: any; text: any; slug: string; key: string; icon: string; customClick: boolean; }; expand: { id: number; shop_id: number; parent_id: number; key: string; icon: string; name: string; slug: string; customClick: boolean; }; }; /** * 向数据源添加特殊项(如 all、search、expand 按钮) * * @param dataSource - 原始数据源 * @param keys - 要添加的特殊项 key 数组 * @returns 添加了特殊项的新数据源 * * @example * ```tsx * const newData = addDataSourceItemsByKey(categoryData, ['expand', 'all']); * // 返回: [expandItem, allItem, ...categoryData] * ``` */ export declare const addDataSourceItemsByKey: (dataSource: TabbarDataSource[], keys: ('all' | 'search' | 'expand')[]) => TabbarDataSource[]; /** * 获取默认激活的 key 数组 * * @param dataSource - 数据源 * @param rowKey - 用作唯一标识的字段名 * @returns 默认激活的 key 数组(多层级) * * @description * 默认选中第一项,如果第一项有子级,同时选中第一个子级 * * @example * ```tsx * const defaultKeys = getDefaultActiveKey(categoryData, 'id'); * // 返回: [1, 0] (第一层级的第一项ID,第二层级的第一项ID) * ``` */ export declare const getDefaultActiveKey: (dataSource: TabbarDataSource[], rowKey: string) => (string | number)[];