import { OnDestroy, OnInit } from '@angular/core';
import { QdContextService } from '../../../page/shared/services/context.service';
import { QdTableComponent } from '../../../table/table.component';
import * as i0 from "@angular/core";
/**
 * **Context**
 *
 * To configure the context you can inject the QdContextService at any time and initialize it. The context then will automatically be shown depending on the current page types.
 * On pages of type overview and custom, the context is also changeable for the user. If you don't want the contexts to be shown on any page, use the `hideContext` property
 * in the page's configuration to fully hide the context on any page.
 *
 * **Initialize the context**
 *
 * To initialize the context, you can use Angular's APP_INITIALIZER token to setup the context on application startup. To do so simply provide
 *
 * ```ts
 * function initializeContexts(contextService: QdContextService, dialog: QdDialogService) {
 *    contextService.initContexts([
 *        {
 *           id: 'typeOfTraffic',
 *           label: { i18n: 'Verkehrsart' },
 *           type: 'single',
 *           options: [
 *             {
 *               value: 'rail',
 *               label: { i18n: 'Schiene' }
 *             },
 *             {
 *               value: 'air',
 *               label: { i18n: 'Luft' }
 *             }
 *           ]
 *         },
 *         {
 *           id: 'Custom',
 *           label: { i18n: 'Custom Test' },
 *           type: 'custom',
 *           open: () => dialog.open(MyContextDialogComponent, {})
 *         }
 *        ]);
 *    }
 * ```
 * Then add this provider in your app's module with the APP_INITIALIZER token:
 *
 * ```ts
 * {
 *     provide: APP_INITIALIZER,
 *     useFactory: (contextService: QdContextService, dialogService: QdDialogService) => () =>
 *       initializeContexts(contextService, dialogService),
 *     multi: true,
 *     deps: [QdContextService, QdDialogService]
 *   }
 * ```
 *
 * **Context Types**
 *
 * To let your users change the context they are working on, you can confiure a single select and a custom context. The single context's configuration accepts
 * a list of options that the user can later choose from. The custom context allows you to provide a handler that e. g. opens a dialog from where the context
 * change then can happen. Simply set the context in the specific opened dialog via QdContextService:
 *
 * ```ts
 * confirm(): void {
 *    const selection: QdPageSelectedContext = {
 *      value: 'USERS SELECTED CHOICE',
 *      label: {
 *        i18n: 'how the selected choice is shown'
 *      }
 *    };
 *    this.contextService.setValue('Custom', selection);
 *    this.dialogRef.close();
 * }
 * ```
 *
 * **Persist and restore the context**
 *
 * To ensure your users have the selected context when coming back at a later time or after reloading, you can easily persist and restore the context. To do so,
 * you can work with the QdContextService. The following code shows a sample that run at application startup, you can place it in the app component:
 *
 * ```ts
 * const cookie = this.readCookie<QdContextSelection[]>('my_contexts');
 * cookie?.forEach(entry => {
 *   this.contextService.setValue(entry.contextId, entry.value);
 * });
 * this.contextService.values$.subscribe(values => this.bakeCookie('my_contexts', values));
 * ```
 *
 * **Connect the context**
 *
 * The **QdConnectorTableContextDirective** connects a table to the context and enables the used resolver to access the selected context. It helps to then later
 * fetch data with specific filter criteria.
 *
 * This directive should be used in combination with the `QdTable`. It works only when using the Resolver-approach in QdTable.
 *
 * ```html
 * <qd-page [config]="pageConfig">
 *   <qd-section [config]="sectionConfig">
 *     <qd-table [config]="tableConfig" qdConnectToContext></qd-table>
 *   </qd-section>
 * </qd-page>
 * ```
 *
 * Having the context connected to your table allows you to use the context in the resolver to filter data:
 *
 * ```ts
 * @Injectable()
 * export class TableConstellationResolver implements QdTableDataResolver<Constellation> {
 *    resolve({ page, size, sort, context }): Observable<QdTableResolvedData<Constellation>> {
 *      // use context to filter data
 *    }
 * }
 * ```
 */
export declare class QdConnectorTableContextDirective<T extends string> implements OnInit, OnDestroy {
    private tableComponent;
    private contextService;
    private destroyed;
    constructor(tableComponent: QdTableComponent<T>, contextService: QdContextService);
    ngOnInit(): void;
    ngOnDestroy(): void;
    static ɵfac: i0.ɵɵFactoryDeclaration<QdConnectorTableContextDirective<any>, [{ host: true; }, null]>;
    static ɵdir: i0.ɵɵDirectiveDeclaration<QdConnectorTableContextDirective<any>, "qd-table[qdConnectToContext]", never, {}, {}, never, never, false, never>;
}
//# sourceMappingURL=connector-table-context.directive.d.ts.map