import { StoreDefinition } from 'pinia'; /** * @typedef {Object} ViewCriterion * @property {number} id - Unique identifier for the criterion. * @property {Object} property - The property to search on. * @property {boolean} negation - Whether the criterion is negated. * @property {string} operator - The search operator (e.g., 'exact', 'contains', 'range'). * @property {*} value - The search value. * @property {*|null} value_end - The end value for range searches. */ /** * @typedef {Object} ViewLocation * @property {number} id - Unique identifier for the location. * @property {'Site'|'Folder'|null} type - The type of location. * @property {string} value - The value for the location (e.g., site ID or nodeRef). * @property {boolean} negation - Whether the location is excluded (true) or included (false). * @property {string} label - Human-readable label for the location. */ /** * @typedef {Object} CriteriaGroup * @property {string} id - Unique identifier for the group. * @property {'AND'|'OR'} operator - Operator between criteria within the group. * @property {ViewCriterion[]} criteria - The list of search criteria in the group. */ /** * @typedef {Object} CriteriaGroups * @property {'AND'|'OR'} rootOperator - Operator between groups. * @property {CriteriaGroup[]} groups - The list of criteria groups. */ /** * @typedef {Object} SavedView * @property {string} id - Unique identifier for the saved view. * @property {string} name - The name of the saved view. * @property {string} [description] - An optional description for the view. * @property {'user'|'global'} scope - The scope of the view. * @property {boolean} [isFavorite] - Whether the view is marked as a favorite. * @property {Object} config - The view configuration. * @property {ViewLocation[]} config.locations - The location criteria (array). * @property {CriteriaGroups} [config.criteriaGroups] - The grouped criteria (new format). * @property {ViewCriterion[]} [config.criteria] - The list of search criteria (legacy flat format). */ /** * Pinia store for managing the state of the user view feature. */ export const useUserViewStore: StoreDefinition<"userView", { locations: ViewLocation[]; criteriaGroups: CriteriaGroups; loadedView: SavedView | null; favoritesNeedReload: boolean; }, { /** * Checks if a saved view is currently loaded. * @param {Object} state - The store's state. * @returns {boolean} - True if a view is loaded, false otherwise. */ isSavedViewLoaded(state: any): boolean; /** * Backward-compatible getter: returns the first location or a default empty object. * @param {Object} state - The store's state. * @returns {ViewLocation|{type: null, value: string}} */ location(state: any): ViewLocation | { type: null; value: string; }; /** * Backward-compatible getter: flattens all criteria from all groups. * @param {Object} state - The store's state. * @returns {ViewCriterion[]} */ allCriteria(state: any): ViewCriterion[]; /** * Backward-compatible alias for allCriteria (used by AdvancedSearchPanel). * @param {Object} state - The store's state. * @returns {ViewCriterion[]} */ criteria(state: any): ViewCriterion[]; }, { /** * Loads a saved view into the store, updating locations, criteria, and the loaded view reference. * Supports both old single-location format (config.location) and new multi-location format (config.locations). * @param {SavedView} savedView - The saved view object to load. */ loadView(savedView: SavedView): void; /** * Adds a new location to the locations list. * @param {ViewLocation} loc - The location to add. */ addLocation(loc: ViewLocation): void; /** * Removes a location from the locations list by its index. * @param {number} index - The index of the location to remove. */ removeLocation(index: number): void; /** * Sets the location for the user view (backward-compatible). * Replaces all locations with a single one. * @param {ViewLocation} newLocation - The new location object. */ setLocation(newLocation: ViewLocation): void; /** * Sets the criteria for the user view (legacy, wraps into single group). * This action also resets the currently loaded view. * @param {ViewCriterion[]} newCriteria - The new array of criteria. */ setCriteria(newCriteria: ViewCriterion[]): void; /** * Adds a new empty criteria group. * @param {'AND'|'OR'} [operator='AND'] - The operator for criteria within the group. */ addGroup(operator?: "AND" | "OR"): void; /** * Removes a criteria group by index. * @param {number} groupIndex - The index of the group to remove. */ removeGroup(groupIndex: number): void; /** * Adds a criterion to a specific group. * @param {number} groupIndex - The index of the group. * @param {ViewCriterion} criterion - The criterion to add. */ addCriterionToGroup(groupIndex: number, criterion: ViewCriterion): void; /** * Removes a criterion from a specific group. * @param {number} groupIndex - The index of the group. * @param {number} criterionIndex - The index of the criterion within the group. */ removeCriterionFromGroup(groupIndex: number, criterionIndex: number): void; /** * Updates a criterion in a specific group. * @param {number} groupIndex - The index of the group. * @param {number} criterionIndex - The index of the criterion within the group. * @param {ViewCriterion} updated - The updated criterion. */ updateCriterionInGroup(groupIndex: number, criterionIndex: number, updated: ViewCriterion): void; /** * Backward-compatible: adds a criterion to the first group (creates one if needed). * Used by AdvancedSearchPanel (legacy). * @param {ViewCriterion} criterion - The criterion to add. */ addCriterion(criterion: ViewCriterion): void; /** * Backward-compatible: removes a criterion by flat index across all groups. * Used by AdvancedSearchPanel (legacy). * @param {number} index - The flat index of the criterion to remove. */ removeCriterion(index: number): void; /** * Resets the entire user view state to its default values. */ resetUserView(): void; /** * Saves the current view configuration as a new personal or global view. * @param {SavedView} viewToSave - The view object to save. */ saveCurrentView(viewToSave: SavedView): Promise; /** * Updates an existing saved view with the current configuration. * @param {SavedView} viewToUpdate - The view object with updated information. */ updateCurrentView(viewToUpdate: SavedView): Promise; /** * Deletes the currently loaded saved view. * @returns {Promise} */ deleteCurrentView(): Promise; /** * Toggles the favorite status of a given view. * @param {SavedView} view - The view to toggle. * @returns {Promise} */ toggleViewFavorite(view: SavedView): Promise; /** * Fetches all personal and global favorite views and formats them for menu display. */ fetchFavoriteViews(): Promise; fetchSavedViews(): Promise; }>; export type ViewCriterion = { /** * - Unique identifier for the criterion. */ id: number; /** * - The property to search on. */ property: any; /** * - Whether the criterion is negated. */ negation: boolean; /** * - The search operator (e.g., 'exact', 'contains', 'range'). */ operator: string; /** * - The search value. */ value: any; /** * - The end value for range searches. */ value_end: any | null; }; export type ViewLocation = { /** * - Unique identifier for the location. */ id: number; /** * - The type of location. */ type: "Site" | "Folder" | null; /** * - The value for the location (e.g., site ID or nodeRef). */ value: string; /** * - Whether the location is excluded (true) or included (false). */ negation: boolean; /** * - Human-readable label for the location. */ label: string; }; export type CriteriaGroup = { /** * - Unique identifier for the group. */ id: string; /** * - Operator between criteria within the group. */ operator: "AND" | "OR"; /** * - The list of search criteria in the group. */ criteria: ViewCriterion[]; }; export type CriteriaGroups = { /** * - Operator between groups. */ rootOperator: "AND" | "OR"; /** * - The list of criteria groups. */ groups: CriteriaGroup[]; }; export type SavedView = { /** * - Unique identifier for the saved view. */ id: string; /** * - The name of the saved view. */ name: string; /** * - An optional description for the view. */ description?: string; /** * - The scope of the view. */ scope: "user" | "global"; /** * - Whether the view is marked as a favorite. */ isFavorite?: boolean; /** * - The view configuration. */ config: { locations: ViewLocation[]; criteriaGroups?: CriteriaGroups; criteria?: ViewCriterion[]; }; }; //# sourceMappingURL=userView.d.ts.map