import * as i0 from '@angular/core'; import { InjectionToken, Type, OnDestroy, OnInit, OnChanges, ChangeDetectorRef, SimpleChanges } from '@angular/core'; import { Subject, Subscription } from 'rxjs'; import { UserSettingsWebService, AuditEvents, AuditEvent, Record } from '@sinequa/core/web-services'; import { ModalService, ModalButton, ModalRef } from '@sinequa/core/modal'; import * as i15 from '@sinequa/components/selection'; import { SelectionService } from '@sinequa/components/selection'; import * as i16 from '@sinequa/components/action'; import { Action } from '@sinequa/components/action'; import { SearchService } from '@sinequa/components/search'; import { Query, AppService } from '@sinequa/core/app-utils'; import * as i8 from '@angular/forms'; import { UntypedFormControl, UntypedFormGroup, UntypedFormBuilder, ValidatorFn } from '@angular/forms'; import * as i9 from '@angular/cdk/drag-drop'; import { CdkDragDrop } from '@angular/cdk/drag-drop'; import { SavedQueriesService } from '@sinequa/components/saved-queries'; import { LoginService } from '@sinequa/core/login'; import { AbstractFacet } from '@sinequa/components/facet'; import * as i7 from '@angular/common'; import * as i10 from '@angular/router'; import * as i11 from '@sinequa/components/modal'; import * as i12 from '@sinequa/core/intl'; import * as i13 from '@sinequa/core/validation'; import * as i14 from '@sinequa/components/utils'; interface Basket { name: string; description?: string; ids?: string[]; } declare const enum BasketEventType { Loaded = "Basket_Loaded", Add = "Basket_Add", Delete = "Basket_Delete", DeleteAll = "Basket_DeleteAll", Update = "Basket_Update", Rename = "Basket_Rename", AddDoc = "Basket_AddDoc", RemoveDoc = "Basket_RemoveDoc", Open = "Basket_Open", ExportCSV = "Basket_ExportCSV", Patched = "Basked_Patched" } declare const BASKET_CHANGE_EVENTS: BasketEventType[]; interface BasketChangeEvent { type: BasketEventType; basket?: Basket; } interface SelectBasketModel { basket: Basket | undefined; basketFilter?: (basket: Basket) => boolean; allowNew?: boolean; } interface ManageBasketsModel { baskets: Basket[]; auditEvents?: AuditEvent[]; } /** * The modal types are unknown to this service. * The module using this service must provide these components * in their forRoot() method * * Example below: * * public static forRoot(): ModuleWithProviders { return { ngModule: BasketsModule, providers: [ { provide: BASKET_COMPONENTS, useValue: { selectBasketModal: SelectBasket, editBasketModal: EditBasket, manageBasketsModal: ManageBaskets } }, BasketsService ] }; } */ interface BasketComponents { selectBasketModal: Type; editBasketModal: Type; manageBasketsModal: Type; } declare const BASKET_COMPONENTS: InjectionToken; declare class BasketsService implements OnDestroy { userSettingsService: UserSettingsWebService; searchService: SearchService; modalService: ModalService; selectionService: SelectionService; basketComponents: BasketComponents; private readonly _events; private readonly _changes; selectedRecordsAction: Action; constructor(userSettingsService: UserSettingsWebService, searchService: SearchService, modalService: ModalService, selectionService: SelectionService, basketComponents: BasketComponents); /** * Returns the list of this user's baskets. * The list is stored in the user settings (this is a redirection). * Using this service creates the list of baskets if it does not already exist. */ get baskets(): Basket[]; /** * Triggers any event among BasketChangeEvent * (use for fine-grained control of baskets workflow) */ get events(): Subject; /** * Triggers when events affect the list of baskets * (use to refresh basket menus) * Cf. CHANGE_EVENTS list */ get changes(): Subject; /** * @returns true if there is at least one basket */ get hasBasket(): boolean; /** * @returns a basket with the given name or null if it does not exist * @param name */ basket(name: string): Basket | undefined; private basketIndex; /** * Creates a new basket unless it already exists. * Emits an Basket event. * Update the data on the server. * @param basket the basket to create * @returns true if basket was created */ createBasket(basket: Basket): boolean; /** * Update the basket at the given index, unless a basket with the same name * already exists in the list of baskets. * Emits a Basket event. * Update the data on the server. * @param basket the basket to update * @param index the index at which to update the basket * @returns true if basket was updated */ updateBasket(basket: Basket, index: number): boolean; /** * Updates the full list of Baskets. * Emits a Basket event. * Update the data on the server. * @param baskets the new list of baskets * @param auditEvents the list of audit events to log */ updateBaskets(baskets: Basket[], auditEvents?: AuditEvents): boolean; /** * Deletes the given Basket (based on its name) * Emits an Basket event. * Update the data on the server. * @param basket * @returns true if basket was deleted */ deleteBasket(basket: Basket): boolean; /** * Adds one or more documents to a basket. * Emits a Basket event. * Update the data on the server. * @param name basket to which to add the document(s) * @param ids id(s) of the document(s) to add to the basket * @param skipPatch if true, will not update the data on the server (use for bulk updates) * @returns true if the document was added */ addToBasket(name: string, ids: string | string[], skipPatch?: boolean): boolean; /** * Removes one or more documents from a basket. * Emits a Basket event. * Update the data on the server. * @param name basket from which to remove the document(s) * @param ids id(s) of the document(s) to remove from the basket * @param skipPatch if true, will not update the data on the server (use for bulk updates) * @returns true if the document was removed */ removeFromBasket(name: string, ids: string | string[], skipPatch?: boolean): boolean; /** * Removes a document from all the baskets * @param id id of the document to remove */ removeFromAllBaskets(id: string): boolean; /** * Updates Baskets in User settings. * @param auditEvents : Audit Events to be triggered * @returns an Observable which can be used to trigger further events */ private patchBaskets; /** * Uses the SearchService to perform a search returning all * the documents in this basket * @param basket * @param path * @returns the search service promise */ searchBasket(basket: Basket, path?: string): Promise; /** * Opens a dialog allowing a user to add one (or more) document(s) * to a basket. * @param ids id(s) of the documents to add to a basket * @param recordBaskets names of the baskets the document already belongs to * @returns a boolean promise resolved when the user closes the dialog * the result is true if the document was added to a basket */ addToBasketModal(ids: string | string[], recordBaskets?: string[]): Promise; /** * Opens a dialog allowing a user to remove one (or more) document(s) * from a basket. * @param ids id(s) of the documents to remove from a basket * @param recordBaskets names of the baskets the document already belongs to * @returns a boolean promise resolved when the user closes the dialog * the result is true if the document was removed from a basket */ removeFromBasketModal(ids: string | string[], recordBaskets?: string[]): Promise; /** * Opens a dialog allowing a user to create new basket. * @param model the initial basket object model * @returns a boolean promise resolved when the user closes the dialog * the result is true if the basket was created. */ createBasketModal(model?: Basket): Promise; /** * Opens a dialog allowing a user to reorganize and edit the * list of baskets. * @returns a boolean promise resolved when the user closes the dialog * the result is true is the list was updated. */ manageBasketsModal(): Promise; private buildBasketsAction; makeQuery(basket: Basket): Query; notifyOpenBasket(basket: Basket): void; ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class BsEditBasket implements OnInit, OnDestroy { model: Basket; private formBuilder; nameControl: UntypedFormControl; form: UntypedFormGroup; formChanges: Subscription; buttons: ModalButton[]; constructor(model: Basket, formBuilder: UntypedFormBuilder); ngOnInit(): void; ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class BsManageBaskets implements OnInit { model: ManageBasketsModel; savedQueryService: SavedQueriesService; basketsService: BasketsService; appService: AppService; reordering: boolean; buttons: ModalButton[]; removeAllButton: ModalButton; nameValidators: ValidatorFn[]; constructor(model: ManageBasketsModel, savedQueryService: SavedQueriesService, basketsService: BasketsService, appService: AppService); ngOnInit(): void; addAuditEvent(auditEvent: AuditEvent): void; reorder(): void; setName(basket: Basket, name: string): void; remove(basket: Basket, index: number): boolean; dropped(drop: CdkDragDrop): void; export(basket: Basket): boolean; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class BsSelectBasket implements OnInit { model: SelectBasketModel; private basketsService; private modalRef; baskets: Basket[]; buttons: ModalButton[]; constructor(model: SelectBasketModel, basketsService: BasketsService, modalRef: ModalRef); ngOnInit(): void; activate(model: any): void; select(basket: Basket): void; newBasket(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } /** * Component representing the add-to-baskets button in one item of the result list view. * */ declare class BsResultBaskets implements OnChanges, OnDestroy { private modalService; private basketsService; private changeDetectorRef; record: Record; rightAligned: boolean; basketsAction: Action; private addToBasketAction; private removeFromBasketAction; private removeFromAllBasketsAction; private baskets; private initialized; private basketsSubscription; constructor(modalService: ModalService, basketsService: BasketsService, changeDetectorRef: ChangeDetectorRef); ngOnChanges(changes: SimpleChanges): void; ngOnDestroy(): void; get isInBaskets(): boolean; private refreshVisualization; private updateRecordBaskets; private buildAddToBasketAction; private buildRemoveFromBasketAction; private buildRemovalFromAllBasketsAction; private buildBasketsAction; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class BsBasketsMenuComponent implements OnInit { loginService: LoginService; basketsService: BasketsService; searchRoute: string; icon: string; autoAdjust: boolean; autoAdjustBreakpoint: string; collapseBreakpoint: string; size: string; menu: Action | undefined; createAction: Action; manageAction: Action; constructor(loginService: LoginService, basketsService: BasketsService); ngOnInit(): void; updateMenu(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class BsFacetBasketsComponent extends AbstractFacet { basketsService: BasketsService; searchRoute: string; maxBaskets: number; enableDelete: boolean; page: number; createBasket: Action; manageBasket: Action; previousPage: Action; nextPage: Action; constructor(basketsService: BasketsService); get maxPage(): number; get startIndex(): number; get endIndex(): number; openBasket(basket: Basket): boolean; get actions(): Action[]; deleteBasket(basket: Basket, event: Event): boolean; getQueryParams(basket: Basket): { query: string; }; getRouterState(basket: Basket): { audit: { type: BasketEventType; detail: { basket: string; }; }; }; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class BsBasketsModule { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } declare const enBaskets: any; declare const frBaskets: any; declare const deBaskets: any; export { BASKET_CHANGE_EVENTS, BASKET_COMPONENTS, BasketEventType, BasketsService, BsBasketsMenuComponent, BsBasketsModule, BsEditBasket, BsFacetBasketsComponent, BsManageBaskets, BsResultBaskets, BsSelectBasket, deBaskets, enBaskets, frBaskets }; export type { Basket, BasketChangeEvent, BasketComponents, ManageBasketsModel, SelectBasketModel };