import * as i0 from '@angular/core'; import { OnInit, OnDestroy, AfterViewInit, ElementRef, NgZone, InjectionToken, OnChanges, EventEmitter, ChangeDetectorRef } from '@angular/core'; import * as i1 from '@angular/cdk/table'; import { CdkTable, CdkCellDef, CdkHeaderCellDef, CdkFooterCellDef, CdkColumnDef, CdkHeaderCell, CdkFooterCell, CdkCell, CdkHeaderRowDef, CdkFooterRowDef, CdkRowDef, CdkHeaderRow, CdkFooterRow, CdkRow, CdkTextColumn, DataSource } from '@angular/cdk/table'; import * as i1$1 from '@sbb-esta/angular/core'; import { BooleanInput } from '@angular/cdk/coercion'; import { ViewportRuler } from '@angular/cdk/scrolling'; import { Subject, Observable, Subscription, BehaviorSubject } from 'rxjs'; import { FocusMonitor, AriaDescriber } from '@angular/cdk/a11y'; import { SbbPageEvent, SbbPaginator } from '@sbb-esta/angular/pagination'; import { AnimationTriggerMetadata } from '@angular/animations'; /** * Enables the recycle view repeater strategy, which reduces rendering latency. Not compatible with * tables that animate rows. * * @deprecated This directive is a no-op and will be removed. * @breaking-change 23.0.0 */ declare class SbbRecycleRows { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } /** * Wrapper for the CdkTable with Sbb design styles. */ declare class SbbTable extends CdkTable implements OnInit, OnDestroy { /** Overrides the sticky CSS class set by the `CdkTable`. */ protected stickyCssClass: string; /** Overrides the need to add position: sticky on every sticky cell element in `CdkTable`. */ protected needsPositionStickyOnElement: boolean; private _destroyed; private injector; private _viewportRulerSbb; ngOnInit(): void; ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵcmp: i0.ɵɵComponentDeclaration, "sbb-table, table[sbb-table]", ["sbbTable"], {}, {}, never, ["caption", "colgroup, col", "*"], true, never>; } /** * The scroll state of the table. 'none' implies no scrollbar, 'both' indicates * the scrollbar is in the middle of the scroll width and 'left' and 'right' means * that there is an offset at either the left or right end of the scroll container. */ type SbbTableWrapperScrollOffset = 'none' | 'both' | 'left' | 'right'; declare class SbbTableWrapper implements AfterViewInit, OnDestroy { private _elementRef; private _ngZone; private _viewportRuler; private _destroyed; /** Whether the table wrapper is focusable. */ get focusable(): boolean; set focusable(value: BooleanInput); private _focusable; constructor(_elementRef: ElementRef, _ngZone: NgZone, _viewportRuler: ViewportRuler); ngAfterViewInit(): void; /** * Calculate whether the scroll offset is none, left, right or on both sides. */ private _calculateScrollOffset; ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } /** * Cell definition for the sbb-table. * Captures the template of a column's data row cell as well as cell-specific properties. */ declare class SbbCellDef extends CdkCellDef { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } /** * Header cell definition for the sbb-table. * Captures the template of a column's header cell and as well as cell-specific properties. */ declare class SbbHeaderCellDef extends CdkHeaderCellDef { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } /** * Footer cell definition for the sbb-table. * Captures the template of a column's footer cell and as well as cell-specific properties. */ declare class SbbFooterCellDef extends CdkFooterCellDef { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } /** * Column definition for the sbb-table. * Defines a set of cells available for a table column. */ declare class SbbColumnDef extends CdkColumnDef { /** Unique name for this column. */ get name(): string; set name(name: string); /** * Group this column with the next column. * If set to true, the border to the next cell is hidden. */ get groupWithNext(): boolean; set groupWithNext(value: BooleanInput); private _groupWithNext; /** * Add "sbb-column-" prefix in addition to "cdk-column-" prefix. * In the future, this will only add "sbb-column-" and columnCssClassName * will change from type string[] to string. * @docs-private */ protected _updateColumnCssClassName(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } /** Header cell template container that adds the right classes and role. */ declare class SbbHeaderCell extends CdkHeaderCell { readonly _columnDef: SbbColumnDef; constructor(_columnDef: SbbColumnDef, elementRef: ElementRef); static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } /** Footer cell template container that adds the right classes and role. */ declare class SbbFooterCell extends CdkFooterCell { readonly _columnDef: SbbColumnDef; constructor(_columnDef: SbbColumnDef, elementRef: ElementRef); static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } /** Cell template container that adds the right classes and role. */ declare class SbbCell extends CdkCell { readonly _columnDef: SbbColumnDef; constructor(_columnDef: SbbColumnDef, elementRef: ElementRef); static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } /** * Header row definition for the sbb-table. * Captures the header row's template and other header properties such as the columns to display. */ declare class SbbHeaderRowDef extends CdkHeaderRowDef { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; static ngAcceptInputType_sticky: unknown; } /** * Footer row definition for the sbb-table. * Captures the footer row's template and other footer properties such as the columns to display. */ declare class SbbFooterRowDef extends CdkFooterRowDef { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; static ngAcceptInputType_sticky: unknown; } /** * Data row definition for the sbb-table. * Captures the data row's template and other properties such as the columns to display and * a when predicate that describes when this row should be used. */ declare class SbbRowDef extends CdkRowDef { static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵdir: i0.ɵɵDirectiveDeclaration, "[sbbRowDef]", never, { "columns": { "alias": "sbbRowDefColumns"; "required": false; }; "when": { "alias": "sbbRowDefWhen"; "required": false; }; }, {}, never, never, true, never>; } /** Header template container that contains the cell outlet. Adds the right class and role. */ declare class SbbHeaderRow extends CdkHeaderRow { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } /** Footer template container that contains the cell outlet. Adds the right class and role. */ declare class SbbFooterRow extends CdkFooterRow { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } /** Data row template container that contains the cell outlet. Adds the right class and role. */ declare class SbbRow extends CdkRow { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } /** * Column that simply shows text content for the header and row cells. Assumes that the table * is using the native table implementation (``). * * By default, the name of this column will be the header text and data property accessor. * The header text can be overridden with the `headerText` input. Cell values can be overridden with * the `dataAccessor` input. Change the text justification to the start or end using the `justify` * input. */ declare class SbbTextColumn extends CdkTextColumn implements OnInit { /** * Group this column with the next column. * If set to true, the border to the next cell is hidden. */ get groupWithNext(): boolean; set groupWithNext(value: BooleanInput); private _groupWithNext; ngOnInit(): void; /** Synchronizes the column definition groupWithNext with the text column groupWithNext. */ private _syncColumnDefGroupWithNext; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵcmp: i0.ɵɵComponentDeclaration, "sbb-text-column", never, { "groupWithNext": { "alias": "groupWithNext"; "required": false; }; }, {}, never, never, true, never>; } type SbbSortDirection = 'asc' | 'desc' | ''; /** Position of the arrow that displays when sorted. */ type SbbSortHeaderArrowPosition = 'before' | 'after'; /** Interface for a directive that holds sorting state consumed by `SbbSortHeader`. */ interface SbbSortable { /** The id of the column being sorted. */ id: string; /** Starting sort direction. */ start: SbbSortDirection; /** Whether to disable clearing the sorting state. */ disableClear: boolean; } /** The current sort state. */ interface SbbSortState { /** The id of the column being sorted. */ active: string; /** The sort direction. */ direction: SbbSortDirection; } /** Default options for `sbb-sort`. */ interface SbbSortDefaultOptions { /** Whether to disable clearing the sorting state. */ disableClear?: boolean; /** Position of the arrow that displays when sorted. */ arrowPosition?: SbbSortHeaderArrowPosition; } /** Injection token to be used to override the default options for `sbb-sort`. */ declare const SBB_SORT_DEFAULT_OPTIONS: InjectionToken; /** Container for SbbSortables to manage the sort state and provide default sort parameters. */ declare class SbbSort implements OnInit, OnChanges, OnDestroy { private _defaultOptions?; private _initializedStream; /** Collection of all registered sortables that this directive manages. */ sortables: Map; /** Used to notify any child components listening to state changes. */ readonly _stateChanges: Subject; /** The id of the most recently sorted SbbSortable. */ active: string; /** Whether the sort is disabled. */ disabled: boolean; /** * The direction to set when an SbbSortable is initially sorted. * May be overridden by the SbbSortable's sort start. */ start: SbbSortDirection; /** The sort direction of the currently active SbbSortable. */ get direction(): SbbSortDirection; set direction(direction: SbbSortDirection); private _direction; /** * Whether to disable the user from clearing the sort by finishing the sort direction cycle. * May be overriden by the SbbSortable's disable clear input. */ disableClear: boolean; /** Event emitted when the user changes either the active sort or sort direction. */ readonly sortChange: EventEmitter; /** Emits when the paginator is initialized. */ initialized: Observable; constructor(_defaultOptions?: SbbSortDefaultOptions | undefined); /** * Register function to be used by the contained SbbSortables. Adds the SbbSortable to the * collection of SbbSortables. */ register(sortable: SbbSortable): void; /** * Unregister function to be used by the contained SbbSortables. Removes the SbbSortable from the * collection of contained SbbSortables. */ deregister(sortable: SbbSortable): void; /** Sets the active sort id and determines the new sort direction. */ sort(sortable: SbbSortable): void; /** Returns the next sort direction of the active sortable, checking for potential overrides. */ getNextSortDirection(sortable: SbbSortable): SbbSortDirection; ngOnInit(): void; ngOnChanges(): void; ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; static ngAcceptInputType_disabled: unknown; static ngAcceptInputType_disableClear: unknown; } /** * Valid positions for the arrow to be in for its opacity and translation. If the state is a * sort direction, the position of the arrow will be above/below and opacity 0. If the state is * hint, the arrow will be in the center with a slight opacity. Active state means the arrow will * be fully opaque in the center. * * @docs-private */ type SbbArrowViewState = SbbSortDirection | 'hint' | 'active'; /** * States describing the arrow's animated position (animating fromState to toState). * If the fromState is not defined, there will be no animated transition to the toState. * @docs-private */ interface SbbArrowViewStateTransition { fromState?: SbbArrowViewState; toState?: SbbArrowViewState; } /** * Applies sorting behavior (click to change sort) and styles to an element, including an * arrow to display the current sort direction. * * Must be provided with an id and contained within a parent SbbSort. * * If used on header cells in a CdkTable, it will automatically default its id from its containing * column definition. */ declare class SbbSortHeader implements SbbSortable, OnDestroy, OnInit, AfterViewInit { private _changeDetectorRef; private _columnDefCdk; private _focusMonitor; private _elementRef; private _ariaDescriber; private _rerenderSubscription; /** * The element with role="button" inside this component's view. We need this * in order to apply a description with AriaDescriber. */ private _sortButton; protected _sort: SbbSort; private _columnDef; /** * Flag set to true when the indicator should be displayed while the sort is not active. Used to * provide an affordance that the header is sortable by showing on focus and hover. */ _showIndicatorHint: boolean; /** * The view transition state of the arrow (translation/ opacity) - indicates its `from` and `to` * position through the animation. If animations are currently disabled, the fromState is removed * so that there is no animation displayed. */ _viewState: SbbArrowViewStateTransition; /** The direction the arrow should be facing according to the current state. */ _arrowDirection: SbbSortDirection; /** Whether the view state animation should show the transition between the `from` and `to` states. */ _disableViewStateAnimation: boolean; /** * ID of this sort header. If used within the context of a CdkColumnDef, this will default to * the column's name. */ id: string; /** Sets the position of the arrow that displays when sorted. */ arrowPosition: SbbSortHeaderArrowPosition; disabled: boolean; /** Overrides the sort start value of the containing SbbSort for this SbbSortable. */ start: SbbSortDirection; /** * Description applied to SbbSortHeader's button element with aria-describedby. This text should * describe the action that will occur when the user clicks the sort header. */ get sortActionDescription(): string; set sortActionDescription(value: string); private _sortActionDescription; /** Overrides the disable clear value of the containing MatSort for this MatSortable. */ disableClear: boolean; constructor(_changeDetectorRef: ChangeDetectorRef, _columnDefCdk: CdkColumnDef, _focusMonitor: FocusMonitor, _elementRef: ElementRef, _ariaDescriber: AriaDescriber, defaultOptions?: SbbSortDefaultOptions); ngOnInit(): void; ngAfterViewInit(): void; ngOnDestroy(): void; /** * Sets the "hint" state such that the arrow will be semi-transparently displayed as a hint to the * user showing what the active sort will become. If set to false, the arrow will fade away. */ _setIndicatorHintVisible(visible: boolean): void; /** * Sets the animation transition view state for the arrow's position and opacity. If the * `disableViewStateAnimation` flag is set to true, the `fromState` will be ignored so that * no animation appears. */ _setAnimationTransitionState(viewState: SbbArrowViewStateTransition): void; /** Triggers the sort on this sort header and removes the indicator hint. */ _toggleOnInteraction(): void; _handleClick(): void; _handleKeydown(event: KeyboardEvent): void; /** Whether this SbbSortHeader is currently sorted in either ascending or descending order. */ _isSorted(): boolean; /** Returns the animation state for the arrow direction (indicator and pointers). */ _getArrowDirectionState(): string; /** Returns the arrow position state (opacity, translation). */ _getArrowViewState(): string; /** * Updates the direction the arrow should be pointing. If it is not sorted, the arrow should be * facing the start direction. Otherwise if it is sorted, the arrow should point in the currently * active sorted direction. The reason this is updated through a function is because the direction * should only be changed at specific times - when deactivated but the hint is displayed and when * the sort is active and the direction changes. Otherwise the arrow's direction should linger * in cases such as the sort becoming deactivated but we want to animate the arrow away while * preserving its direction, even though the next sort direction is actually different and should * only be changed once the arrow displays again (hint or activation). */ _updateArrowDirection(): void; _isDisabled(): boolean; /** * Gets the aria-sort attribute that should be applied to this sort header. If this header * is not sorted, returns null so that the attribute is removed from the host element. Aria spec * says that the aria-sort property should only be present on one header at a time, so removing * ensures this is true. */ _getAriaSortAttribute(): "none" | "ascending" | "descending"; /** Whether the arrow inside the sort header should be rendered. */ _renderArrow(): boolean; private _updateSortActionDescription; /** Handles changes in the sorting state. */ private _handleStateChanges; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; static ngAcceptInputType_disabled: unknown; static ngAcceptInputType_disableClear: unknown; } declare class SbbTableModule { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } /** * Interface that matches the required API parts of the SbbPaginator. */ interface SbbTableDataSourcePaginator { page: Subject; pageIndex: number; initialized: Observable; pageSize: number; length: number; } /** * TableFilter can be extended to define columns (keys) to filter for in a DataSource. * The '_' property is used for a global filter. If an array is used, entries will be combined with the or-operator. */ interface SbbTableFilter { /** Global filter: filtering all entries */ _?: string | number | string[] | number[] | null; [key: string]: string | number | string[] | number[] | null | undefined; } /** Base class for SbbTableDataSource. */ declare class _SbbTableDataSource extends DataSource { /** Stream that emits when a new data array is set on the data source. */ private readonly _data; /** Stream emitting render data to the table (depends on ordered data changes). */ private readonly _renderData; /** Stream that emits when a new filter string is set on the data source. */ private readonly _filter; /** Used to react to internal changes of the paginator that are made by the data source itself. */ private readonly _internalPageChanges; /** * Subscription to the changes that should trigger an update to the table's rendered rows, such * as filtering, sorting, pagination, or base data changes. */ _renderChangesSubscription: Subscription | null; /** * The filtered set of data that has been matched by the filter string, or all the data if there * is no filter. Useful for knowing the set of data the table represents. * For example, a 'selectAll()' function would likely want to select the set of filtered data * shown to the user rather than all the data. */ filteredData: T[]; /** Array of data that should be rendered by the table, where each object represents one row. */ get data(): T[]; set data(data: T[]); /** * Filter term that should be used to filter out objects from the data array. To override how * data objects match to this filter string, provide a custom function for filterPredicate. */ get filter(): TFilter; set filter(filter: TFilter); /** * Instance of the SbbSort directive used by the table to control its sorting. Sort changes * emitted by the SbbSort will trigger an update to the table's rendered data. */ get sort(): SbbSort | null; set sort(sort: SbbSort | null); private _sort; /** * Instance of the SbbPaginator component used by the table to control what page of the data is * displayed. Page changes emitted by the SbbPaginator will trigger an update to the * table's rendered data. * * Note that the data source uses the paginator's properties to calculate which page of data * should be displayed. If the paginator receives its properties as template inputs, * e.g. `[pageLength]=100` or `[pageIndex]=1`, then be sure that the paginator's view has been * initialized before assigning it to this data source. */ get paginator(): P | null; set paginator(paginator: P | null); private _paginator; /** * Data accessor function that is used for accessing data properties for sorting through * the default sortData function. * This default function assumes that the sort header IDs (which defaults to the column name) * matches the data's properties (e.g. column Xyz represents data['Xyz']). * May be set to a custom function for different behavior. * @param data Data object that is being accessed. * @param sortHeaderId The name of the column that represents the data. */ sortingDataAccessor: (data: T, sortHeaderId: string) => string | number; /** * Gets a sorted copy of the data array based on the state of the SbbSort. Called * after changes are made to the filtered data or when sort changes are emitted from SbbSort. * By default, the function retrieves the active sort and its direction and compares data * by retrieving data using the sortingDataAccessor. May be overridden for a custom implementation * of data ordering. * @param data The array of data that should be sorted. * @param sort The connected SbbSort that holds the current sort state. */ sortData: (data: T[], sort: SbbSort) => T[]; /** * This method can be called by two filter types: string or an Object which extends TableFilter. * * # String variant * Checks if a data object matches the data source's filter string. By default, each data object * is converted to a string of its properties and returns true if the filter has * at least one occurrence in that string. * * # TableFilter variant * Checks if a data object matches the data source's filter object. If several columns are defined, * the and-operator is applied. If a column filter is a list, the or-operator inside the list is applied. * The '_' property of the TableFilter can be used to search globally in all columns * (like the string variant above). * * By default, the filter string has its whitespace trimmed and the match is case-insensitive. * May be overridden for a custom implementation of filter matching. * @param data Data object used to check against the filter. * @param filter Filter string or Object which extends TableFilter that has been set on the data source. * @returns Whether the filter matches against the data */ filterPredicate: (data: T, filter: TFilter) => boolean; constructor(initialData?: T[]); /** * Subscribe to changes that should trigger an update to the table's rendered rows. When the * changes occur, process the current state of the filter, sort, and pagination along with * the provided base data and send it to the table for rendering. */ _updateChangeSubscription(): void; /** * Returns a filtered data array where each filter object contains the filter string within * the result of the filterTermAccessor function. If no filter is set, returns the data array * as provided. */ _filterData(data: T[]): T[]; /** * Returns a sorted copy of the data if SbbSort has a sort applied, otherwise just returns the * data array as provided. Uses the default data accessor for data lookup, unless a * sortDataAccessor function is defined. */ _orderData(data: T[]): T[]; /** * Returns a paged slice of the provided data array according to the provided SbbPaginator's page * index and length. If there is no paginator provided, returns the data array as provided. */ _pageData(data: T[]): T[]; /** * Updates the paginator to reflect the length of the filtered data, and makes sure that the page * index does not exceed the paginator's last page. Values are changed in a resolved promise to * guard against making property changes within a round of change detection. */ _updatePaginator(filteredDataLength: number): void; /** * Used by the SbbTable. Called when it connects to the data source. * @docs-private */ connect(): BehaviorSubject; /** * Used by the SbbTable. Called when it disconnects from the data source. * @docs-private */ disconnect(): void; /** Converts a TableFilter object to a key value object of strings. */ _normalizeTableFilter(tableFilter: SbbTableFilter): { [key: string]: string[]; }; /** Filters properties against tableData and returns true if matching data was found. */ _filterProperties(propertyFilters: { [key: string]: string[]; }, tableData: { [p: string]: any; }): boolean; /** Filters a list of strings against tableData and returns true if matching data was found. */ _filterGlobally(filters: string[], tableData: { [key: string]: any; }): boolean; /** Checks if search string is in data (case insensitive). */ _matchesStringCaseInsensitive(data: string, search: string): boolean; /** Reduces an object to a string. */ _reduceObjectToString(data: Object): string; } /** * Data source that accepts a client-side data array and includes native support of filtering, * sorting (using Sort), and pagination (using Paginator). * * Allows for sort customization by overriding sortingDataAccessor, which defines how data * properties are accessed. Also allows for filter customization by overriding filterTermAccessor, * which defines how row data is converted to a string for filter matching. */ declare class SbbTableDataSource extends _SbbTableDataSource { } /** * Animations used by SbbSort. * @docs-private */ declare const sbbSortAnimations: { readonly indicator: AnimationTriggerMetadata; readonly arrowOpacity: AnimationTriggerMetadata; readonly arrowPosition: AnimationTriggerMetadata; readonly allowChildren: AnimationTriggerMetadata; }; export { SBB_SORT_DEFAULT_OPTIONS, SbbCell, SbbCellDef, SbbColumnDef, SbbFooterCell, SbbFooterCellDef, SbbFooterRow, SbbFooterRowDef, SbbHeaderCell, SbbHeaderCellDef, SbbHeaderRow, SbbHeaderRowDef, SbbRecycleRows, SbbRow, SbbRowDef, SbbSort, SbbSortHeader, SbbTable, SbbTableDataSource, SbbTableModule, SbbTableWrapper, SbbTextColumn, _SbbTableDataSource, sbbSortAnimations }; export type { SbbArrowViewState, SbbArrowViewStateTransition, SbbSortDefaultOptions, SbbSortDirection, SbbSortHeaderArrowPosition, SbbSortState, SbbSortable, SbbTableDataSourcePaginator, SbbTableFilter, SbbTableWrapperScrollOffset };