import type { FdoItemOverriderV4, FdoMenuV4Item } from "@feedmepos/menu/entity"; import type { TreeChip, TreeNodeWithChildren } from "./fmtree/type"; import { TreeNodeRightLabelVariant } from "./fmtree/type"; import type { TreeQuery } from "./type"; export declare const enum TreeNodeIcon { CATEGORY = "view_list", ITEM = "fastfood", VARIANT = "lunch_dining", GROUP = "database", FOLDER = "folder" } export declare function createCountChip(count: number, label: string): TreeChip | null; export declare function createOrderFromChip(orderFrom: "ALL" | "POS_ONLY" | "NONE"): TreeChip; export declare function addChips(chips: TreeChip[], ...newChips: (TreeChip | null)[]): TreeChip[]; export declare function variantRightLabel(baseItem: FdoMenuV4Item, variantCombination: FdoItemOverriderV4): { label: string; variant: TreeNodeRightLabelVariant; }; interface SearchTreeResult { /** * the subtree that matches the query */ subTree: TreeNodeWithChildren[]; /** * the ids of the nodes that should be expanded to show all the nodes that matches the query */ shouldExpandNodeIds: string[]; } export declare function searchTree(tree: TreeNodeWithChildren[], query: TreeQuery): SearchTreeResult; /** * key1 key2 > key3 key4 > key5 key6 * to: * { * levels: [ * { * query: ["key1", "key2"], * }, * { * query: ["key3", "key4"], * }, * { * query: ["key5", "key6"], * }, * ] * } * seperators can be > or , */ export declare function parseQuery(query: string): TreeQuery; export declare function searchTreeWithString(tree: TreeNodeWithChildren[], query: string | null | undefined): SearchTreeResult; export declare function getNodeById(tree: TreeNodeWithChildren[], id: string): TreeNodeWithChildren | null; /** * Moves an item in an array from one position to another, handling index adjustments correctly. * @param array The original array (will not be modified) * @param fromIndex The index of the item to move * @param toIndex The target index where the item should be placed * @returns A new array with the item moved to the target position */ export declare function moveItemInArray(array: T[], fromIndex: number, toIndex: number): T[]; export declare function formatItemName(name: string, code?: string | null): string; /** * Creates a hashmap for quick lookup of nodes by nodeId or rawId * @param tree The tree structure to build the map from * @returns A Map with node IDs as keys and nodes as values */ export declare function createNodeLookup(tree: TreeNodeWithChildren[]): Map; /** * Creates a hashmap for quick lookup of node indices in a flattened array * @param flattenedItems The flattened array of tree items * @returns A Map with node IDs as keys and their indices as values */ export declare function createIndexLookup(items: T[]): Map; export {};