ngx-mat-table-multi-sort 19.7.1 → 20.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,139 +0,0 @@
1
- import { EventEmitter, InjectionToken, WritableSignal } from "@angular/core";
2
- import { MatSort, MatSortable, MatSortDefaultOptions, Sort, SortDirection } from "@angular/material/sort";
3
- import * as i0 from "@angular/core";
4
- /**
5
- * Injection token for the storage mechanism used to persist sorting state.
6
- *
7
- * This token can be used to provide a custom storage implementation for persisting
8
- * the sorting state of a table. By default, it can be set to use localStorage, sessionStorage,
9
- * or any other storage mechanism that implements the Storage interface.
10
- *
11
- */
12
- export declare const SORT_PERSISTENCE_STORAGE: InjectionToken<Storage>;
13
- /**
14
- * Injection token used to enable or disable the persistence of sorting state.
15
- *
16
- * This token can be provided in the application's dependency injection system
17
- * to control whether the sorting state of a table should be persisted across
18
- * sessions or not.
19
- *
20
- * @example
21
- * // To enable sort persistence:
22
- * providers: [
23
- * { provide: SORT_PERSISTENCE_ENABLED, useValue: true }
24
- * ]
25
- *
26
- * @example
27
- * // To disable sort persistence:
28
- * providers: [
29
- * { provide: SORT_PERSISTENCE_ENABLED, useValue: false }
30
- * ]
31
- */
32
- export declare const SORT_PERSISTENCE_ENABLED: InjectionToken<boolean>;
33
- /**
34
- * Injection token for the key used to persist sorting state.
35
- *
36
- * This token can be used to provide a custom key for storing
37
- * the sorting state in a persistence layer, such as local storage
38
- * or a database.
39
- */
40
- export declare const SORT_PERSISTENCE_KEY: InjectionToken<string>;
41
- export declare class MatMultiSortDirective extends MatSort {
42
- isPersistenceEnabled: boolean;
43
- readonly initialKey: string;
44
- private readonly storage;
45
- /**
46
- * Event emitter that fires when the persistence state changes.
47
- *
48
- * This output emits an array of Sort objects whenever the sorting state
49
- * is persisted or restored from storage. This can be useful for components
50
- * that need to react to changes in the persisted sorting configuration.
51
- *
52
- * @example
53
- * ```html
54
- * <table mat-table [dataSource]="dataSource" matMultiSort
55
- * (persistenceChanged)="onPersistenceChanged($event)">
56
- * ```
57
- *
58
- * @example
59
- * ```typescript
60
- * onPersistenceChanged(sorts: Sort[]): void {
61
- * console.log('Sorting state changed:', sorts);
62
- * // Handle the updated sorting configuration
63
- * }
64
- * ```
65
- */
66
- readonly persistenceChanged: EventEmitter<Sort[]>;
67
- private _key;
68
- /**
69
- * A writable signal that holds an array of Sort objects.
70
- * This signal is used to manage the sorting state of the table.
71
- *
72
- * @readonly
73
- */
74
- readonly _sorts: WritableSignal<Sort[]>;
75
- /**
76
- * Gets the key used for column configuration persistence.
77
- *
78
- * @returns {string} The key used for column configuration persistence.
79
- */
80
- get key(): string;
81
- constructor(isPersistenceEnabled: boolean, initialKey: string, storage: Storage, defaultOptions?: MatSortDefaultOptions | undefined);
82
- /**
83
- * Retrieves the sort direction for a given column ID.
84
- *
85
- * @param id - The ID of the column to get the sort direction for.
86
- * @returns The sort direction ('asc', 'desc', or '') for the specified column ID.
87
- */
88
- getSortDirection(id: string): SortDirection;
89
- /**
90
- * Gets the sort index of the given column ID.
91
- *
92
- * @param id - The ID of the column to get the sort index for.
93
- * @returns The sort index of the column, or -1 if the column is not active.
94
- */
95
- getSortIndex(id: string): number;
96
- sort(sortable: MatSortable): void;
97
- /**
98
- * Removes a sort level by its identifier.
99
- * If the sort level is not found, the method returns without making any changes.
100
- *
101
- * @param id - The identifier of the sort level to be removed.
102
- * @returns void
103
- */
104
- removeSortLevel(id: string): void;
105
- /**
106
- * Reorders the sort level by moving an item in the sort array from a previous index to a current index.
107
- * If the previous index is the same as the current index, the function returns without making any changes.
108
- *
109
- * @param previousIndex - The index of the item to be moved.
110
- * @param currentIndex - The index to which the item should be moved.
111
- */
112
- reorderSortLevel(previousIndex: number, currentIndex: number): void;
113
- /**
114
- * Toggles the sort direction for the given column ID.
115
- *
116
- * @param id - The unique identifier of the column to toggle the sort direction for.
117
- * @returns void
118
- */
119
- toggleSortDirection(id: string): void;
120
- /**
121
- * Clears the current sorting state.
122
- *
123
- * @param id - The unique identifier of the column to toggle the sort direction for.
124
- * @returns void
125
- */
126
- clearSorting(): void;
127
- private persistSortSettings;
128
- /**
129
- * Sets the persistence key for storing sort settings and optionally overwrites the persisted value.
130
- *
131
- * @param key - The key to be used for persisting sort settings.
132
- * @param overwritePersistedValue - If true, the current sort settings will be persisted immediately, overwriting any existing value. Defaults to false.
133
- *
134
- * @returns void
135
- */
136
- setPersistenceKey(key: string, overwritePersistedValue?: boolean): void;
137
- static ɵfac: i0.ɵɵFactoryDeclaration<MatMultiSortDirective, [{ optional: true; }, { optional: true; }, { optional: true; }, { optional: true; }]>;
138
- static ɵdir: i0.ɵɵDirectiveDeclaration<MatMultiSortDirective, "[matMultiSort]", ["matMultiSort"], {}, { "persistenceChanged": "persistenceChanged"; }, never, never, true, never>;
139
- }
@@ -1,51 +0,0 @@
1
- import { CdkDragDrop } from "@angular/cdk/drag-drop";
2
- import { OnDestroy, OnInit } from "@angular/core";
3
- import { TableColumn } from "../mat-table-column-config";
4
- import { MatTableColumnConfigPersistenceService } from "../mat-table-column-config-persistence.service";
5
- import * as i0 from "@angular/core";
6
- export declare class MatTableColumnConfigComponent<T> implements OnInit, OnDestroy {
7
- private readonly persistenceService;
8
- private subscription;
9
- columns: TableColumn<T>[];
10
- constructor(persistenceService: MatTableColumnConfigPersistenceService<T>);
11
- ngOnInit(): void;
12
- ngOnDestroy(): void;
13
- /**
14
- * Handles the event when a dragged column is dropped.
15
- * This method updates the order of columns based on the drag and drop action.
16
- *
17
- * @param event - The event object containing information about the drag and drop action.
18
- */
19
- onColumnDropped(event: CdkDragDrop<T>): void;
20
- /**
21
- * Toggles the visibility of a column based on its identifier.
22
- *
23
- * @param id - The identifier of the column whose visibility is to be changed.
24
- */
25
- onColumnVisibilityChanged(id: keyof T): void;
26
- /**
27
- * Sets all columns in the table to visible and updates the persisted column configuration.
28
- *
29
- * Iterates through the `columns` array, setting each column's `visible` property to `true`.
30
- * Then, updates the `persistenceService.columns` property to reflect the new visibility state.
31
- */
32
- selectAllColumns(): void;
33
- /**
34
- * Deselects all columns by setting their `visible` property to `false`.
35
- * Updates the persisted columns state via the `persistenceService`.
36
- *
37
- * @remarks
38
- * This method iterates through all columns in the `columns` array and hides each one.
39
- * After updating the visibility, it synchronizes the state with the persistence service.
40
- */
41
- deselectAllColumns(): void;
42
- /**
43
- * Inverts the visibility state of all columns in the `columns` array.
44
- * Each column's `visible` property is toggled between `true` and `false`.
45
- * After updating the visibility, the modified columns array is assigned to the persistence service
46
- * to persist the new visibility state.
47
- */
48
- invertColumnSelection(): void;
49
- static ɵfac: i0.ɵɵFactoryDeclaration<MatTableColumnConfigComponent<any>, never>;
50
- static ɵcmp: i0.ɵɵComponentDeclaration<MatTableColumnConfigComponent<any>, "mat-table-column-config", never, {}, {}, never, never, true, never>;
51
- }
@@ -1,49 +0,0 @@
1
- import { Observable } from "rxjs";
2
- import { TableColumn } from "./mat-table-column-config";
3
- import * as i0 from "@angular/core";
4
- export declare class MatTableColumnConfigPersistenceService<T> {
5
- isPersistenceEnabled: boolean;
6
- readonly initialKey: string;
7
- private readonly storage;
8
- private readonly columns$;
9
- private _key;
10
- /**
11
- * Gets the current table columns configuration.
12
- *
13
- * @returns {TableColumn<T>[]} An array of table columns.
14
- */
15
- get columns(): TableColumn<T>[];
16
- /**
17
- * Sets the columns configuration for the table and persists the configuration.
18
- *
19
- * @param value - An array of `TableColumn<T>` representing the new column configuration.
20
- */
21
- set columns(value: TableColumn<T>[]);
22
- /**
23
- * Gets the key used for column configuration persistence.
24
- *
25
- * @returns {string} The key used for column configuration persistence.
26
- */
27
- get key(): string;
28
- constructor(isPersistenceEnabled: boolean, initialKey: string, storage: Storage);
29
- /**
30
- * Retrieves an observable stream of table columns.
31
- *
32
- * @returns {Observable<TableColumn<T>[]>} An observable that emits an array of table columns.
33
- */
34
- getColumns(): Observable<TableColumn<T>[]>;
35
- private persistColumnConfig;
36
- /**
37
- * Sets the persistence key for storing column configurations.
38
- *
39
- * @param key - The key to be used for persistence.
40
- * @param overwritePersistedValue - If true, the current column configuration will be persisted immediately overwriting any exising value stored under the new key.
41
- * If false, the persisted column configuration will be loaded and applied.
42
- * Defaults to false.
43
- *
44
- * @returns void
45
- */
46
- setPersistenceKey(key: string, overwritePersistedValue?: boolean): void;
47
- static ɵfac: i0.ɵɵFactoryDeclaration<MatTableColumnConfigPersistenceService<any>, [{ optional: true; }, { optional: true; }, { optional: true; }]>;
48
- static ɵprov: i0.ɵɵInjectableDeclaration<MatTableColumnConfigPersistenceService<any>>;
49
- }
@@ -1,21 +0,0 @@
1
- import { Overlay } from "@angular/cdk/overlay";
2
- import { ComponentRef, ElementRef, ViewContainerRef } from "@angular/core";
3
- import { MatTableColumnConfigComponent } from "./mat-table-column-config/mat-table-column-config.component";
4
- import * as i0 from "@angular/core";
5
- export declare class MatTableColumnConfigTriggerDirective<T> {
6
- private readonly elementRef;
7
- private readonly overlay;
8
- private readonly viewContainerRef;
9
- private _componentRef;
10
- /**
11
- * Gets the reference to the MatTableColumnConfigComponent.
12
- *
13
- * @returns {ComponentRef<MatTableColumnConfigComponent<T>> | null}
14
- * The reference to the MatTableColumnConfigComponent if it exists, otherwise null.
15
- */
16
- get componentRef(): ComponentRef<MatTableColumnConfigComponent<T>> | null;
17
- constructor(elementRef: ElementRef, overlay: Overlay, viewContainerRef: ViewContainerRef);
18
- onClick(): void;
19
- static ɵfac: i0.ɵɵFactoryDeclaration<MatTableColumnConfigTriggerDirective<any>, never>;
20
- static ɵdir: i0.ɵɵDirectiveDeclaration<MatTableColumnConfigTriggerDirective<any>, "[matTableColumnConfigTrigger]", ["matTableColumnConfigTrigger"], {}, {}, never, never, true, never>;
21
- }
@@ -1,32 +0,0 @@
1
- import { InjectionToken } from "@angular/core";
2
- /**
3
- * Represents the configuration for a table column.
4
- *
5
- * @template T - The type of the data object that the table displays.
6
- */
7
- export interface TableColumn<T> {
8
- id: keyof T;
9
- label: string;
10
- visible: boolean;
11
- }
12
- /**
13
- * Injection token for the storage mechanism used to persist column configuration.
14
- *
15
- * This token can be used to provide a custom storage implementation for saving
16
- * and retrieving the state of table column configurations.
17
- *
18
- */
19
- export declare const COLUMN_CONFIG_PERSISTENCE_STORAGE: InjectionToken<Storage>;
20
- /**
21
- * Injection token used to enable or disable column configuration persistence.
22
- *
23
- * This token can be provided with a boolean value to indicate whether the
24
- * column configurations should be persisted (e.g., in local storage or a database).
25
- *
26
- */
27
- export declare const COLUMN_CONFIG_PERSISTENCE_ENABLED: InjectionToken<boolean>;
28
- /**
29
- * Injection token for the column configuration persistence key.
30
- * This token is used to provide a unique key for persisting column configurations.
31
- */
32
- export declare const COLUMN_CONFIG_PERSISTENCE_KEY: InjectionToken<string>;
package/public-api.d.ts DELETED
@@ -1,8 +0,0 @@
1
- export * from "./lib/mat-table-column-config";
2
- export * from "./lib/mat-multi-sort.directive";
3
- export * from "./lib/mat-table-column-config-trigger.directive";
4
- export * from "./lib/mat-multi-sort-table-data-source";
5
- export * from "./lib/mat-table-column-config-persistence.service";
6
- export * from "./lib/mat-multi-sort-header/mat-multi-sort-header.component";
7
- export * from "./lib/mat-multi-sort-control/mat-multi-sort-control.component";
8
- export * from "./lib/mat-table-column-config/mat-table-column-config.component";