@firestitch/list 18.0.81 → 18.0.82
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.
- package/app/classes/breakpoint-controller.d.ts +66 -0
- package/app/classes/columns-controller.d.ts +52 -10
- package/app/classes/list-controller.d.ts +4 -2
- package/app/classes/selection-controller.d.ts +6 -0
- package/app/components/body/body.component.d.ts +6 -3
- package/app/components/body/row/row.component.d.ts +1 -1
- package/app/components/footer/footer.component.d.ts +1 -1
- package/app/components/head/head.component.d.ts +11 -1
- package/app/components/list/list.component.d.ts +50 -5
- package/app/directives/breakpoint/breakpoint.directive.d.ts +58 -0
- package/app/directives/draggable-list/draggable-list.directive.d.ts +1 -0
- package/app/fs-list.module.d.ts +17 -16
- package/app/interfaces/listconfig.interface.d.ts +21 -0
- package/app/models/column-set.model.d.ts +50 -0
- package/app/models/column.model.d.ts +42 -0
- package/app/models/index.d.ts +1 -0
- package/esm2022/app/classes/breakpoint-controller.mjs +200 -0
- package/esm2022/app/classes/columns-controller.mjs +171 -66
- package/esm2022/app/classes/list-controller.mjs +7 -5
- package/esm2022/app/classes/selection-controller.mjs +9 -1
- package/esm2022/app/components/body/body.component.mjs +9 -4
- package/esm2022/app/components/body/row/row.component.mjs +3 -3
- package/esm2022/app/components/footer/footer-row/footer-row.component.mjs +3 -3
- package/esm2022/app/components/footer/footer.component.mjs +1 -1
- package/esm2022/app/components/head/head-cell/head-cell.component.mjs +3 -3
- package/esm2022/app/components/head/head.component.mjs +18 -3
- package/esm2022/app/components/list/list.component.mjs +111 -19
- package/esm2022/app/components/pagination/pagination.component.mjs +3 -3
- package/esm2022/app/directives/breakpoint/breakpoint.directive.mjs +88 -0
- package/esm2022/app/directives/draggable-list/draggable-list.directive.mjs +8 -1
- package/esm2022/app/fs-list.module.mjs +7 -2
- package/esm2022/app/interfaces/listconfig.interface.mjs +1 -1
- package/esm2022/app/models/column-set.model.mjs +93 -0
- package/esm2022/app/models/column.model.mjs +56 -1
- package/esm2022/app/models/index.mjs +2 -1
- package/esm2022/public_api.mjs +5 -2
- package/fesm2022/firestitch-list.mjs +767 -104
- package/fesm2022/firestitch-list.mjs.map +1 -1
- package/package.json +1 -1
- package/public_api.d.ts +5 -2
- package/styles.scss +22 -8
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { OnDestroy } from '@angular/core';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { FsListBreakpointsConfig } from '../interfaces';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
/**
|
|
6
|
+
* Decides which breakpoint column set is active for one list.
|
|
7
|
+
*
|
|
8
|
+
* Measures the list's own container by default -- a list rendered inside a dialog, drawer
|
|
9
|
+
* or narrow flex column has a viewport width that lies about how much room it actually has.
|
|
10
|
+
* `breakpoints: { container: false }` switches to viewport media queries via the CDK, which
|
|
11
|
+
* costs no JS at all between thresholds.
|
|
12
|
+
*
|
|
13
|
+
* Emits the `maxWidth` of the narrowest matching set, or `null` when the base set applies.
|
|
14
|
+
*/
|
|
15
|
+
export declare class BreakpointController implements OnDestroy {
|
|
16
|
+
private _zone;
|
|
17
|
+
private _breakpointObserver;
|
|
18
|
+
private _active$;
|
|
19
|
+
private _breakpoints;
|
|
20
|
+
private _container;
|
|
21
|
+
private _hysteresis;
|
|
22
|
+
private _resizeObserver;
|
|
23
|
+
private _element;
|
|
24
|
+
private _lastWidth;
|
|
25
|
+
/** Refcount of in-flight drags. While > 0 swaps are held, not dropped. */
|
|
26
|
+
private _suspended;
|
|
27
|
+
private _pending;
|
|
28
|
+
private _hasPending;
|
|
29
|
+
private _observing$;
|
|
30
|
+
private _destroy$;
|
|
31
|
+
/** The `maxWidth` of the active set, or null for the base set. */
|
|
32
|
+
get active(): number | null;
|
|
33
|
+
get active$(): Observable<number | null>;
|
|
34
|
+
get container(): boolean;
|
|
35
|
+
initConfig(config?: FsListBreakpointsConfig): void;
|
|
36
|
+
/**
|
|
37
|
+
* Declare the breakpoints to watch, as `maxWidth` values in px.
|
|
38
|
+
* Re-registering tears down the previous observation.
|
|
39
|
+
*/
|
|
40
|
+
setBreakpoints(breakpoints: number[]): void;
|
|
41
|
+
/** Supply the element to measure in container mode. Ignored in viewport mode. */
|
|
42
|
+
observe(element: HTMLElement): void;
|
|
43
|
+
/**
|
|
44
|
+
* Hold breakpoint swaps. Refcounted, and the latest value is applied on the final
|
|
45
|
+
* `resume()` -- a crossing during a drag is deferred, never lost.
|
|
46
|
+
*
|
|
47
|
+
* Mandatory during a drag: the draggable directive snapshots every row's top/height once
|
|
48
|
+
* at drag start and hit-tests against that frozen cache, so a mid-drag reflow silently
|
|
49
|
+
* produces the wrong drop target.
|
|
50
|
+
*/
|
|
51
|
+
suspend(): void;
|
|
52
|
+
resume(): void;
|
|
53
|
+
ngOnDestroy(): void;
|
|
54
|
+
private _restart;
|
|
55
|
+
private _observeViewport;
|
|
56
|
+
private _observeContainer;
|
|
57
|
+
/**
|
|
58
|
+
* Map a measured width onto a set, with a hysteresis band so a container parked exactly
|
|
59
|
+
* on a threshold cannot oscillate between two sets on sub-pixel reflows.
|
|
60
|
+
*/
|
|
61
|
+
private _applyWidth;
|
|
62
|
+
private _emit;
|
|
63
|
+
private _teardown;
|
|
64
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BreakpointController, never>;
|
|
65
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<BreakpointController>;
|
|
66
|
+
}
|
|
@@ -1,33 +1,58 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
|
+
import { FsListBreakpointDirective } from '../directives/breakpoint/breakpoint.directive';
|
|
2
3
|
import { FsListColumn, FsListColumnChangeFn, FsListColumnConfig } from '../interfaces';
|
|
3
4
|
import { ColumnsColumn } from '../models';
|
|
5
|
+
import { ColumnSet } from '../models/column-set.model';
|
|
4
6
|
import { Column } from '../models/column.model';
|
|
7
|
+
import { BreakpointController } from './breakpoint-controller';
|
|
5
8
|
import { PersistanceController } from './persistance-controller';
|
|
6
9
|
export declare class ColumnsController {
|
|
7
10
|
private _persistance;
|
|
11
|
+
private _breakpoints?;
|
|
8
12
|
private _visibleColumns$;
|
|
9
13
|
private _visibleColumnsShared$;
|
|
10
|
-
|
|
14
|
+
/**
|
|
15
|
+
* The columns the three bands actually render -- the active set's visible columns.
|
|
16
|
+
* Cached in a field, never a getter: AsyncPipe re-subscribes whenever the observable
|
|
17
|
+
* identity changes, and `asObservable()` returns a new instance per call.
|
|
18
|
+
*/
|
|
19
|
+
private _renderedColumns$;
|
|
20
|
+
private _renderedColumnsShared$;
|
|
21
|
+
private _activeSet$;
|
|
22
|
+
private _activeSetShared$;
|
|
23
|
+
private _sets;
|
|
24
|
+
private _base;
|
|
25
|
+
private _active;
|
|
11
26
|
private _loadFn;
|
|
12
27
|
private _changeFn;
|
|
13
28
|
private _initFn;
|
|
14
29
|
private _isConfigured;
|
|
15
30
|
private _columnsFetched;
|
|
16
|
-
private _hasHeader;
|
|
17
|
-
private _hasFooter;
|
|
18
|
-
private _columns;
|
|
19
31
|
private _defaultConfigs;
|
|
32
|
+
private _batching;
|
|
20
33
|
private _columnsUpdated$;
|
|
21
34
|
private _destroy$;
|
|
22
|
-
constructor(_persistance: PersistanceController);
|
|
35
|
+
constructor(_persistance: PersistanceController, _breakpoints?: BreakpointController);
|
|
36
|
+
/**
|
|
37
|
+
* The base (desktop) set. Unchanged meaning: persistence, the customize dialog and the
|
|
38
|
+
* `columns` fetch param all stay viewport-independent because they read this.
|
|
39
|
+
*/
|
|
23
40
|
get columns(): Column[];
|
|
24
41
|
get visibleColumns(): Column[];
|
|
25
42
|
get visibleColumns$(): Observable<Column[]>;
|
|
43
|
+
/** The active set's visible columns -- what `<thead>`/`<tbody>`/`<tfoot>` iterate. */
|
|
44
|
+
get renderedColumns(): Column[];
|
|
45
|
+
get renderedColumns$(): Observable<Column[]>;
|
|
46
|
+
get activeSet(): ColumnSet;
|
|
47
|
+
get activeSet$(): Observable<ColumnSet>;
|
|
48
|
+
/** The `maxWidth` of every declared breakpoint set, ascending. */
|
|
49
|
+
get breakpoints(): number[];
|
|
26
50
|
get columnsForDialog(): ColumnsColumn[];
|
|
27
51
|
get columnsFetched(): boolean;
|
|
28
52
|
get hasHeader(): boolean;
|
|
29
53
|
get hasFooter(): boolean;
|
|
30
|
-
|
|
54
|
+
/** Follows the active set: a breakpoint set that declares no headers is not `has-header`. */
|
|
55
|
+
get theadClass(): "" | "has-header";
|
|
31
56
|
get configured(): boolean;
|
|
32
57
|
get changeFn(): FsListColumnChangeFn;
|
|
33
58
|
get visibleColumnsNames(): string[];
|
|
@@ -39,9 +64,11 @@ export declare class ColumnsController {
|
|
|
39
64
|
initConfig(config: FsListColumnConfig): void;
|
|
40
65
|
/**
|
|
41
66
|
* Base initialization for columns
|
|
42
|
-
*
|
|
67
|
+
*
|
|
68
|
+
* @param templates base (desktop) column directives
|
|
69
|
+
* @param breakpointDirectives `<fs-list-breakpoint>` directives, each declaring one set
|
|
43
70
|
*/
|
|
44
|
-
initializeColumns(templates: any): void;
|
|
71
|
+
initializeColumns(templates: any, breakpointDirectives?: FsListBreakpointDirective[]): void;
|
|
45
72
|
/**
|
|
46
73
|
* Load visiblity config for columns from remote
|
|
47
74
|
*/
|
|
@@ -51,12 +78,27 @@ export declare class ColumnsController {
|
|
|
51
78
|
*/
|
|
52
79
|
updateVisibleColumns(): void;
|
|
53
80
|
/**
|
|
54
|
-
*
|
|
81
|
+
* Switch to the set registered for `maxWidth`, or the base set when null.
|
|
82
|
+
*/
|
|
83
|
+
setActiveBreakpoint(maxWidth: number | null): void;
|
|
84
|
+
/**
|
|
85
|
+
* Update visibility based on passed config.
|
|
86
|
+
*
|
|
87
|
+
* Applies to every set that declares a column of that name, so hiding a column in the
|
|
88
|
+
* customize dialog hides it at every width.
|
|
89
|
+
*
|
|
55
90
|
* @param columnsConfig
|
|
56
91
|
*/
|
|
57
92
|
updateVisibilityForCols(columnsConfig: FsListColumn[]): void;
|
|
58
93
|
updateCustomizableForCols(columnsConfig: FsListColumn[]): void;
|
|
59
94
|
destroy(): void;
|
|
95
|
+
private _buildSet;
|
|
96
|
+
/** Every column of a given name, across every set. */
|
|
97
|
+
private _columnsNamed;
|
|
98
|
+
/**
|
|
99
|
+
* @returns whether the active set actually changed
|
|
100
|
+
*/
|
|
101
|
+
private _applyActiveSet;
|
|
102
|
+
private _listenBreakpointChanges;
|
|
60
103
|
private _listenColumnVisibilityUpdates;
|
|
61
|
-
private _updateColspans;
|
|
62
104
|
}
|
|
@@ -4,6 +4,7 @@ import { ChangeFn, FilterConfig, FsFilterAutoReload, IFilterSavedFiltersConfig }
|
|
|
4
4
|
import { SelectionDialog } from '@firestitch/selection';
|
|
5
5
|
import { Observable } from 'rxjs';
|
|
6
6
|
import { FsListAfterContentInitFn, FsListAfterFetchFn, FsListAfterInitFn, FsListBeforeFetchFn, FsListConfig, FsListEmptyStateConfig, FsListFetchFn, FsListFetchSubscription, FsListNoResultsConfig, FsListPersitance, FsListRestoreConfig, FsListRowAction, FsListRowActionGroup, FsListTrackByFn } from '../interfaces';
|
|
7
|
+
import { BreakpointController } from './breakpoint-controller';
|
|
7
8
|
import { ColumnsController } from './columns-controller';
|
|
8
9
|
import { DataController } from './data-controller';
|
|
9
10
|
import { ExternalParamsController } from './external-params-controller';
|
|
@@ -19,6 +20,7 @@ export declare class List {
|
|
|
19
20
|
private _route;
|
|
20
21
|
private _persistance;
|
|
21
22
|
private _inDialog;
|
|
23
|
+
private _breakpoints?;
|
|
22
24
|
heading: string;
|
|
23
25
|
trackBy: string;
|
|
24
26
|
subheading: string;
|
|
@@ -72,7 +74,7 @@ export declare class List {
|
|
|
72
74
|
private readonly _groupCellConfig;
|
|
73
75
|
private readonly _cellConfig;
|
|
74
76
|
private readonly _footerConfig;
|
|
75
|
-
constructor(_el: ElementRef, _config: FsListConfig, _selectionDialog: SelectionDialog, _route: ActivatedRoute, _persistance: PersistanceController, _inDialog: boolean);
|
|
77
|
+
constructor(_el: ElementRef, _config: FsListConfig, _selectionDialog: SelectionDialog, _route: ActivatedRoute, _persistance: PersistanceController, _inDialog: boolean, _breakpoints?: BreakpointController);
|
|
76
78
|
get loading$(): Observable<boolean>;
|
|
77
79
|
filtersReady(): void;
|
|
78
80
|
get filtersReady$(): Observable<void>;
|
|
@@ -92,7 +94,7 @@ export declare class List {
|
|
|
92
94
|
*
|
|
93
95
|
* @param templates
|
|
94
96
|
*/
|
|
95
|
-
tranformTemplatesToColumns(templates: any): void;
|
|
97
|
+
tranformTemplatesToColumns(templates: any, breakpointDirectives?: any[]): void;
|
|
96
98
|
reload(): Observable<any>;
|
|
97
99
|
/**
|
|
98
100
|
* Watch page changes
|
|
@@ -35,6 +35,12 @@ export declare class SelectionController {
|
|
|
35
35
|
selectable(row: Row, index: number): boolean;
|
|
36
36
|
get enabled$(): Observable<boolean>;
|
|
37
37
|
get selectedAll(): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Whether every currently visible row is selected -- the state of the select-all checkbox
|
|
40
|
+
* in `<thead>`. Exposed so a head band created after the fact (a breakpoint switch back to
|
|
41
|
+
* a set that declares headers) can seed itself instead of starting unchecked.
|
|
42
|
+
*/
|
|
43
|
+
get selectedAllVisible(): boolean;
|
|
38
44
|
get selectionChange$(): Observable<{
|
|
39
45
|
type: SelectionChangeType;
|
|
40
46
|
payload: any;
|
|
@@ -13,7 +13,7 @@ export declare class FsBodyComponent {
|
|
|
13
13
|
rowEvents: {};
|
|
14
14
|
rowClass: any;
|
|
15
15
|
hasRowActions: boolean;
|
|
16
|
-
selection: SelectionController;
|
|
16
|
+
selection: SelectionController | null;
|
|
17
17
|
restoreMode: boolean;
|
|
18
18
|
rowRemoved: EventEmitter<any>;
|
|
19
19
|
activeFiltersCount: number;
|
|
@@ -26,8 +26,11 @@ export declare class FsBodyComponent {
|
|
|
26
26
|
/**
|
|
27
27
|
* Track rows by their underlying record id so that a reload (which creates
|
|
28
28
|
* fresh Row wrapper objects) reuses the existing DOM instead of destroying
|
|
29
|
-
* and recreating every row.
|
|
30
|
-
*
|
|
29
|
+
* and recreating every row. Only a genuine, non-empty id counts as a stable
|
|
30
|
+
* identity: empty string / null / undefined (group & footer rows, id-less
|
|
31
|
+
* records) fall back to the row index, namespaced so it can never collide
|
|
32
|
+
* with a real id. Without the fallback every id-less row keys to the same
|
|
33
|
+
* value and Angular throws NG0955 (duplicate track keys) -> scrambled rows.
|
|
31
34
|
*/
|
|
32
35
|
trackByFn(index: number, row: Row): unknown;
|
|
33
36
|
static ɵfac: i0.ɵɵFactoryDeclaration<FsBodyComponent, never>;
|
|
@@ -17,7 +17,7 @@ export declare class FsRowComponent implements OnInit, AfterViewInit, OnDestroy
|
|
|
17
17
|
restoreMode: boolean;
|
|
18
18
|
rowIndex: number;
|
|
19
19
|
columns: Column[];
|
|
20
|
-
selection: SelectionController;
|
|
20
|
+
selection: SelectionController | null;
|
|
21
21
|
rowRemoved: EventEmitter<any>;
|
|
22
22
|
activeFiltersCount: number;
|
|
23
23
|
reorderEnabled: boolean;
|
|
@@ -5,7 +5,7 @@ import * as i0 from "@angular/core";
|
|
|
5
5
|
export declare class FsFooterComponent {
|
|
6
6
|
hasRowActions: boolean;
|
|
7
7
|
columns: Column[];
|
|
8
|
-
selection: SelectionController;
|
|
8
|
+
selection: SelectionController | null;
|
|
9
9
|
activeFiltersCount: number;
|
|
10
10
|
reorderEnabled: boolean;
|
|
11
11
|
reorderPosition: ReorderPosition | null;
|
|
@@ -9,7 +9,7 @@ export declare class FsHeadComponent implements OnInit, OnDestroy {
|
|
|
9
9
|
sorting: SortingController;
|
|
10
10
|
columns: Column[];
|
|
11
11
|
hasRowActions: boolean;
|
|
12
|
-
selection: SelectionController;
|
|
12
|
+
selection: SelectionController | null;
|
|
13
13
|
activeFiltersCount: number;
|
|
14
14
|
reorderEnabled: boolean;
|
|
15
15
|
reorderPosition: ReorderPosition | null;
|
|
@@ -29,6 +29,16 @@ export declare class FsHeadComponent implements OnInit, OnDestroy {
|
|
|
29
29
|
* @param event
|
|
30
30
|
*/
|
|
31
31
|
selectAll(event: MatCheckboxChange): void;
|
|
32
|
+
/**
|
|
33
|
+
* Sort by the clicked column.
|
|
34
|
+
*
|
|
35
|
+
* Sorting always acts on `sortSource` -- the base column -- so the emitted `order` param
|
|
36
|
+
* is the same at every width. But a breakpoint column that shows no sort control must
|
|
37
|
+
* not sort when clicked either, hence the `sortIndicated` gate.
|
|
38
|
+
*
|
|
39
|
+
* @param column
|
|
40
|
+
*/
|
|
41
|
+
sortBy(column: Column): void;
|
|
32
42
|
/**
|
|
33
43
|
* Track By for improve change detection
|
|
34
44
|
*
|
|
@@ -3,6 +3,8 @@ import { FilterComponent } from '@firestitch/filter';
|
|
|
3
3
|
import { Observable } from 'rxjs';
|
|
4
4
|
import { List } from '../../classes/list-controller';
|
|
5
5
|
import { ReorderController } from '../../classes/reorder-controller';
|
|
6
|
+
import { SelectionController } from '../../classes/selection-controller';
|
|
7
|
+
import { FsListBreakpointDirective } from '../../directives/breakpoint/breakpoint.directive';
|
|
6
8
|
import { FsListColumnDirective } from '../../directives/column/column.directive';
|
|
7
9
|
import { FsListAbstractRow, FsListAction, FsListConfig, FsListSelectionConfig, FsListTrackByFn, FsListTrackByTargetRowFn } from '../../interfaces';
|
|
8
10
|
import { IPaginationState } from '../../interfaces/pagination-state.interface';
|
|
@@ -31,7 +33,7 @@ export declare class FsListComponent<TRow = any> implements OnInit, OnDestroy, A
|
|
|
31
33
|
list: List;
|
|
32
34
|
rowRemoved: EventEmitter<any>;
|
|
33
35
|
firstLoad: boolean;
|
|
34
|
-
private
|
|
36
|
+
private _contentInitialized;
|
|
35
37
|
/** Merged list config (after defaults); used to populate cell `configTyping` when cells omit it. */
|
|
36
38
|
private _mergedListConfig?;
|
|
37
39
|
private _filterRef;
|
|
@@ -46,12 +48,20 @@ export declare class FsListComponent<TRow = any> implements OnInit, OnDestroy, A
|
|
|
46
48
|
private _groupExpandNotifier;
|
|
47
49
|
private _route;
|
|
48
50
|
private _persistance;
|
|
51
|
+
private _breakpoints;
|
|
49
52
|
set filterReference(component: any);
|
|
50
53
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
54
|
+
* Base (desktop) columns. Columns declared inside `<fs-list-breakpoint>` are excluded
|
|
55
|
+
* automatically: this query is `descendants: false`, and Angular only walks up through
|
|
56
|
+
* `<ng-container>` nodes, so a real `<fs-list-breakpoint>` element blocks it.
|
|
57
|
+
*
|
|
58
|
+
* Consumed from `_rebuildColumns()`, never from a setter -- `refreshContentQueries`
|
|
59
|
+
* populates queries in directive-creation order, so `<fs-list>`'s query resolves before
|
|
60
|
+
* `<fs-list-breakpoint>`'s and the breakpoint sets would still be undefined here.
|
|
53
61
|
*/
|
|
54
|
-
|
|
62
|
+
columnTemplates: QueryList<FsListColumnDirective>;
|
|
63
|
+
/** Alternate column sets, each active at its own `maxWidth` and below. */
|
|
64
|
+
breakpointDirectives: QueryList<FsListBreakpointDirective>;
|
|
55
65
|
private set _emptyStateTemplate(value);
|
|
56
66
|
private _dialogRef;
|
|
57
67
|
private _drawerRef;
|
|
@@ -66,6 +76,11 @@ export declare class FsListComponent<TRow = any> implements OnInit, OnDestroy, A
|
|
|
66
76
|
get filtersQuery(): Record<string, unknown>;
|
|
67
77
|
get pagingState(): IPaginationState;
|
|
68
78
|
ngAfterContentInit(): void;
|
|
79
|
+
/**
|
|
80
|
+
* Build every column set from the content queries. Safe to call repeatedly; the only
|
|
81
|
+
* entry point that touches columns.
|
|
82
|
+
*/
|
|
83
|
+
private _rebuildColumns;
|
|
69
84
|
ngOnInit(): void;
|
|
70
85
|
ngOnDestroy(): void;
|
|
71
86
|
nextPage(): void;
|
|
@@ -101,6 +116,31 @@ export declare class FsListComponent<TRow = any> implements OnInit, OnDestroy, A
|
|
|
101
116
|
show: boolean;
|
|
102
117
|
}[]): void;
|
|
103
118
|
get visibleColumns$(): Observable<Column[]>;
|
|
119
|
+
/**
|
|
120
|
+
* The columns actually being rendered -- the active breakpoint set's visible columns.
|
|
121
|
+
* Equal to {@link visibleColumns$} when no `<fs-list-breakpoint>` is declared.
|
|
122
|
+
*/
|
|
123
|
+
get renderedColumns$(): Observable<Column[]>;
|
|
124
|
+
/** `maxWidth` of the active breakpoint set, or null when the base set is active. */
|
|
125
|
+
get activeBreakpoint(): number | null;
|
|
126
|
+
/**
|
|
127
|
+
* Structural cells (selection checkbox, row actions, drag handle) render outside the
|
|
128
|
+
* column loop and must agree across `<thead>`, `<tbody>` and `<tfoot>`, so the active
|
|
129
|
+
* set's overrides are resolved here once and bound to all three bands.
|
|
130
|
+
*/
|
|
131
|
+
get selectionEnabled(): SelectionController | null;
|
|
132
|
+
get rowActionsEnabled(): boolean;
|
|
133
|
+
reorderEnabledFor(enabled: boolean | null): boolean;
|
|
134
|
+
/**
|
|
135
|
+
* The head band follows the active set's declared headers and nothing else: a set whose
|
|
136
|
+
* columns declare no header template and no title renders no `<thead>` at all, matching
|
|
137
|
+
* how `<tfoot>` follows `hasFooter`. An empty header row is worse than none -- it draws a
|
|
138
|
+
* rule and reserves height for labels that do not exist.
|
|
139
|
+
*
|
|
140
|
+
* Structural cells do not keep the band alive. The select-all checkbox lives in the head,
|
|
141
|
+
* so it goes with it; a set that wants select-all has to declare at least one header.
|
|
142
|
+
*/
|
|
143
|
+
get showHead(): boolean;
|
|
104
144
|
private _emitFiltersReadyEvent;
|
|
105
145
|
get inDialog(): boolean;
|
|
106
146
|
/**
|
|
@@ -109,6 +149,11 @@ export declare class FsListComponent<TRow = any> implements OnInit, OnDestroy, A
|
|
|
109
149
|
* @param config
|
|
110
150
|
*/
|
|
111
151
|
private _initWithConfig;
|
|
152
|
+
/**
|
|
153
|
+
* The active set changes which structural cells render and whether `<thead>` has content,
|
|
154
|
+
* and this component is OnPush, so a swap has to mark it.
|
|
155
|
+
*/
|
|
156
|
+
private _listenBreakpointChange;
|
|
112
157
|
/**
|
|
113
158
|
* Find action with customize flag and re-declare click function for CustomizeColsDialog
|
|
114
159
|
*
|
|
@@ -127,5 +172,5 @@ export declare class FsListComponent<TRow = any> implements OnInit, OnDestroy, A
|
|
|
127
172
|
private _propagateCellRowTypeAnchors;
|
|
128
173
|
private _maybeApplyCellTyping;
|
|
129
174
|
static ɵfac: i0.ɵɵFactoryDeclaration<FsListComponent<any>, never>;
|
|
130
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<FsListComponent<any>, "fs-list", never, { "config": { "alias": "config"; "required": false; }; "loaderLines": { "alias": "loaderLines"; "required": false; }; "cellRowType": { "alias": "cellRowType"; "required": false; }; }, { "filtersReady": "filtersReady"; }, ["headingTemplate", "_emptyStateTemplate", "columnTemplates"], ["[fs-list-content]"], true, never>;
|
|
175
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<FsListComponent<any>, "fs-list", never, { "config": { "alias": "config"; "required": false; }; "loaderLines": { "alias": "loaderLines"; "required": false; }; "cellRowType": { "alias": "cellRowType"; "required": false; }; }, { "filtersReady": "filtersReady"; }, ["headingTemplate", "_emptyStateTemplate", "columnTemplates", "breakpointDirectives"], ["[fs-list-content]"], true, never>;
|
|
131
176
|
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { QueryList } from '@angular/core';
|
|
2
|
+
import { FsListColumnDirective } from '../column/column.directive';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* Declares an alternate set of columns that replaces the desktop columns at `maxWidth`
|
|
6
|
+
* and below.
|
|
7
|
+
*
|
|
8
|
+
* ```html
|
|
9
|
+
* <fs-list-breakpoint [maxWidth]="1000">
|
|
10
|
+
* <fs-list-column name="name">
|
|
11
|
+
* <ng-template fs-list-header>Record</ng-template>
|
|
12
|
+
* <ng-template fs-list-cell let-row="row">{{ row.name }}</ng-template>
|
|
13
|
+
* </fs-list-column>
|
|
14
|
+
* </fs-list-breakpoint>
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* Children are ordinary `<fs-list-column>` elements supporting every slot -- header, cell,
|
|
18
|
+
* footer, group-header and group-footer. A column whose `name` matches one in the base set
|
|
19
|
+
* inherits that column's templates for any slot it leaves undeclared, so a breakpoint set
|
|
20
|
+
* only has to declare what differs.
|
|
21
|
+
*
|
|
22
|
+
* The header slot is the exception: it is never inherited. The header row is exactly what
|
|
23
|
+
* the active set declares -- an `<ng-template fs-list-header>` or a `title` attribute on
|
|
24
|
+
* that set's own columns -- so a set that declares neither renders an empty header row
|
|
25
|
+
* (kept only for the select-all checkbox and the other structural cells).
|
|
26
|
+
*
|
|
27
|
+
* Several sets can be stacked; the narrowest matching one wins.
|
|
28
|
+
*
|
|
29
|
+
* This is a real element rather than an attribute so that its columns are excluded from
|
|
30
|
+
* `FsListComponent`'s `@ContentChildren(FsListColumnDirective)` for free -- Angular's
|
|
31
|
+
* `descendants: false` query walks up through `<ng-container>` but stops at an element.
|
|
32
|
+
* It renders no DOM: `<fs-list>` only projects `[fs-list-content]`.
|
|
33
|
+
*/
|
|
34
|
+
export declare class FsListBreakpointDirective {
|
|
35
|
+
columnDirectives: QueryList<FsListColumnDirective>;
|
|
36
|
+
private _maxWidth;
|
|
37
|
+
/** Upper bound in px, inclusive. Accepts `1000`, `'1000'` or `'1000px'`. */
|
|
38
|
+
set maxWidth(value: number | string);
|
|
39
|
+
get maxWidth(): number;
|
|
40
|
+
/**
|
|
41
|
+
* Suppress the selection checkbox cell while this set is active.
|
|
42
|
+
* Leave unset to inherit the list's selection config.
|
|
43
|
+
*/
|
|
44
|
+
selection: boolean | null;
|
|
45
|
+
/**
|
|
46
|
+
* Suppress the row-actions cell while this set is active.
|
|
47
|
+
* Leave unset to inherit the list's row actions.
|
|
48
|
+
*/
|
|
49
|
+
rowActions: boolean | null;
|
|
50
|
+
/**
|
|
51
|
+
* Suppress the drag handle cell while this set is active. Dragging a row is an awkward
|
|
52
|
+
* gesture on a narrow touch device, so `[reorder]="false"` is the common case here.
|
|
53
|
+
* Leave unset to inherit the list's reorder config.
|
|
54
|
+
*/
|
|
55
|
+
reorder: boolean | null;
|
|
56
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FsListBreakpointDirective, never>;
|
|
57
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<FsListBreakpointDirective, "fs-list-breakpoint", never, { "maxWidth": { "alias": "maxWidth"; "required": false; }; "selection": { "alias": "selection"; "required": false; }; "rowActions": { "alias": "rowActions"; "required": false; }; "reorder": { "alias": "reorder"; "required": false; }; }, {}, ["columnDirectives"], never, true, never>;
|
|
58
|
+
}
|
|
@@ -8,6 +8,7 @@ export declare class FsListDraggableListDirective {
|
|
|
8
8
|
private _containerElement;
|
|
9
9
|
private _reorderController;
|
|
10
10
|
private _renderer;
|
|
11
|
+
private _breakpoints;
|
|
11
12
|
private _draggableElement;
|
|
12
13
|
private _draggableElementPreview;
|
|
13
14
|
private _multipleDraggableElementPreview;
|
package/app/fs-list.module.d.ts
CHANGED
|
@@ -17,24 +17,25 @@ import * as i13 from "./components/body/body.component";
|
|
|
17
17
|
import * as i14 from "./components/footer/footer.component";
|
|
18
18
|
import * as i15 from "./components/pagination/pagination.component";
|
|
19
19
|
import * as i16 from "./directives/column/column.directive";
|
|
20
|
-
import * as i17 from "./directives/
|
|
21
|
-
import * as i18 from "./directives/cell/cell
|
|
22
|
-
import * as i19 from "./directives/
|
|
23
|
-
import * as i20 from "./directives/
|
|
24
|
-
import * as i21 from "./directives/
|
|
25
|
-
import * as i22 from "./directives/group-
|
|
26
|
-
import * as i23 from "./directives/group-
|
|
27
|
-
import * as i24 from "./directives/
|
|
28
|
-
import * as i25 from "./directives/draggable-
|
|
29
|
-
import * as i26 from "./directives/
|
|
30
|
-
import * as i27 from "./directives/
|
|
31
|
-
import * as i28 from "./directives/content
|
|
32
|
-
import * as i29 from "./directives/
|
|
33
|
-
import * as i30 from "./
|
|
34
|
-
import * as i31 from "./
|
|
20
|
+
import * as i17 from "./directives/breakpoint/breakpoint.directive";
|
|
21
|
+
import * as i18 from "./directives/cell/cell.directive";
|
|
22
|
+
import * as i19 from "./directives/cell/cell-row-type-scope.directive";
|
|
23
|
+
import * as i20 from "./directives/header/header.directive";
|
|
24
|
+
import * as i21 from "./directives/footer/footer.directive";
|
|
25
|
+
import * as i22 from "./directives/group-header/group-header.directive";
|
|
26
|
+
import * as i23 from "./directives/group-footer/group-footer.directive";
|
|
27
|
+
import * as i24 from "./directives/group-expand-trigger/group-expand-trigger.directive";
|
|
28
|
+
import * as i25 from "./directives/draggable-list/draggable-list.directive";
|
|
29
|
+
import * as i26 from "./directives/draggable-row/draggable-row.directive";
|
|
30
|
+
import * as i27 from "./directives/empty-state/empty-state.directive";
|
|
31
|
+
import * as i28 from "./directives/content/content.directive";
|
|
32
|
+
import * as i29 from "./directives/content-init/content-init.directive";
|
|
33
|
+
import * as i30 from "./directives/heading/heading.directive";
|
|
34
|
+
import * as i31 from "./components/customize-cols/customize-cols.component";
|
|
35
|
+
import * as i32 from "./pipes/action-label";
|
|
35
36
|
export declare class FsListModule {
|
|
36
37
|
static forRoot(config?: FsListConfig): ModuleWithProviders<FsListModule>;
|
|
37
38
|
static ɵfac: i0.ɵɵFactoryDeclaration<FsListModule, never>;
|
|
38
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<FsListModule, never, [typeof i1.FsListComponent, typeof i2.FsRowComponent, typeof i3.FsRowActionsComponent, typeof i4.FsRowInlineActionComponent, typeof i5.FsRowMenuActionComponent, typeof i6.FsCellComponent, typeof i7.FsFooterRowComponent, typeof i8.FsFooterCellComponent, typeof i9.FsStatusComponent, typeof i10.FsListLoaderComponent, typeof i11.FsHeadComponent, typeof i12.FsHeadCellComponent, typeof i13.FsBodyComponent, typeof i14.FsFooterComponent, typeof i15.FsPaginationComponent, typeof i16.FsListColumnDirective, typeof i17.
|
|
39
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<FsListModule, never, [typeof i1.FsListComponent, typeof i2.FsRowComponent, typeof i3.FsRowActionsComponent, typeof i4.FsRowInlineActionComponent, typeof i5.FsRowMenuActionComponent, typeof i6.FsCellComponent, typeof i7.FsFooterRowComponent, typeof i8.FsFooterCellComponent, typeof i9.FsStatusComponent, typeof i10.FsListLoaderComponent, typeof i11.FsHeadComponent, typeof i12.FsHeadCellComponent, typeof i13.FsBodyComponent, typeof i14.FsFooterComponent, typeof i15.FsPaginationComponent, typeof i16.FsListColumnDirective, typeof i17.FsListBreakpointDirective, typeof i18.FsListCellDirective, typeof i19.FsListCellRowTypeScopeDirective, typeof i20.FsListHeaderDirective, typeof i21.FsListFooterDirective, typeof i22.FsListGroupHeaderDirective, typeof i23.FsListGroupFooterDirective, typeof i24.FsListGroupExpandTriggerDirective, typeof i25.FsListDraggableListDirective, typeof i26.FsListDraggableRowDirective, typeof i27.FsListEmptyStateDirective, typeof i28.FsListContentDirective, typeof i29.FsListContentInitDirective, typeof i30.FsListHeadingDirective, typeof i31.CustomizeColsDialogComponent, typeof i32.ActionLabelPipe], [typeof i1.FsListComponent, typeof i2.FsRowComponent, typeof i6.FsCellComponent, typeof i10.FsListLoaderComponent, typeof i16.FsListColumnDirective, typeof i17.FsListBreakpointDirective, typeof i18.FsListCellDirective, typeof i19.FsListCellRowTypeScopeDirective, typeof i20.FsListHeaderDirective, typeof i21.FsListFooterDirective, typeof i22.FsListGroupHeaderDirective, typeof i23.FsListGroupFooterDirective, typeof i24.FsListGroupExpandTriggerDirective, typeof i27.FsListEmptyStateDirective, typeof i28.FsListContentDirective, typeof i30.FsListHeadingDirective, typeof i25.FsListDraggableListDirective]>;
|
|
39
40
|
static ɵinj: i0.ɵɵInjectorDeclaration<FsListModule>;
|
|
40
41
|
}
|
|
@@ -33,6 +33,7 @@ export interface FsListConfig<TRow = any> {
|
|
|
33
33
|
rowHoverHighlight?: boolean;
|
|
34
34
|
chips?: boolean;
|
|
35
35
|
column?: FsListColumnConfig;
|
|
36
|
+
breakpoints?: FsListBreakpointsConfig;
|
|
36
37
|
autoFocus?: boolean;
|
|
37
38
|
queryParam?: boolean;
|
|
38
39
|
paging?: FsPaging | false;
|
|
@@ -234,6 +235,26 @@ export interface FsListColumnConfig {
|
|
|
234
235
|
title?: FsListColumnTitleFn;
|
|
235
236
|
selected?: FsListColumnSelectedFn;
|
|
236
237
|
}
|
|
238
|
+
/**
|
|
239
|
+
* Controls how `<fs-list-breakpoint>` sets decide they are active.
|
|
240
|
+
*/
|
|
241
|
+
export interface FsListBreakpointsConfig {
|
|
242
|
+
/**
|
|
243
|
+
* Measure the list's own container instead of the viewport. Defaults to `true`, which is
|
|
244
|
+
* what you want for a list inside a dialog, drawer or narrow flex column -- the viewport
|
|
245
|
+
* width lies about how much room the table actually has.
|
|
246
|
+
*
|
|
247
|
+
* Set `false` to match on viewport media queries instead, which costs no JS between
|
|
248
|
+
* thresholds and is SSR-safe.
|
|
249
|
+
*/
|
|
250
|
+
container?: boolean;
|
|
251
|
+
/**
|
|
252
|
+
* Dead band in px around each threshold, so a container parked exactly on a breakpoint
|
|
253
|
+
* cannot oscillate between two sets on sub-pixel reflows. Container mode only.
|
|
254
|
+
* Defaults to 24.
|
|
255
|
+
*/
|
|
256
|
+
hysteresis?: number;
|
|
257
|
+
}
|
|
237
258
|
export interface FsListColumn {
|
|
238
259
|
name: string;
|
|
239
260
|
show?: boolean;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Column } from './column.model';
|
|
2
|
+
/**
|
|
3
|
+
* One complete set of columns.
|
|
4
|
+
*
|
|
5
|
+
* A list always has a base set (`maxWidth === null`, the desktop markup) and zero or more
|
|
6
|
+
* breakpoint sets declared inside `<fs-list-breakpoint [maxWidth]="n">`. Exactly one set is
|
|
7
|
+
* active at a time; the active set's `rendered` array is what `<thead>`/`<tbody>`/`<tfoot>`
|
|
8
|
+
* iterate.
|
|
9
|
+
*
|
|
10
|
+
* Every set owns its own `Column` instances, so per-set colspan flags, templates and titles
|
|
11
|
+
* can never leak across sets.
|
|
12
|
+
*/
|
|
13
|
+
export declare class ColumnSet {
|
|
14
|
+
readonly maxWidth: number | null;
|
|
15
|
+
readonly columns: Column[];
|
|
16
|
+
/** `columns` filtered by visibility -- the array the three bands iterate. */
|
|
17
|
+
rendered: Column[];
|
|
18
|
+
hasHeader: boolean;
|
|
19
|
+
hasFooter: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Structural cell overrides. `null` means "inherit whatever the list is configured to do";
|
|
22
|
+
* `false` suppresses that structural cell while this set is active. Only ever set from
|
|
23
|
+
* `<fs-list-breakpoint>` inputs -- the base set always inherits.
|
|
24
|
+
*/
|
|
25
|
+
selection: boolean | null;
|
|
26
|
+
rowActions: boolean | null;
|
|
27
|
+
reorder: boolean | null;
|
|
28
|
+
/**
|
|
29
|
+
* @param maxWidth Upper bound in px this set applies at (inclusive). `null` for the base set.
|
|
30
|
+
*/
|
|
31
|
+
constructor(maxWidth: number | null);
|
|
32
|
+
get isBase(): boolean;
|
|
33
|
+
/** The media query this set activates at, or null for the base set. */
|
|
34
|
+
get media(): string | null;
|
|
35
|
+
/**
|
|
36
|
+
* Resolve everything that depends only on the declared columns, not on visibility.
|
|
37
|
+
* Called once, when the set is built.
|
|
38
|
+
*/
|
|
39
|
+
resolve(): void;
|
|
40
|
+
/** Refresh the rendered array. Called whenever column visibility changes. */
|
|
41
|
+
update(): void;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Mark which columns are spanned over by an earlier column's `colspan`.
|
|
45
|
+
*
|
|
46
|
+
* Resolved over the full declared column list (not the visible subset), which is the
|
|
47
|
+
* behaviour the single-set implementation has always had. Every flag is reset first so
|
|
48
|
+
* the pass is idempotent and a set can be re-resolved safely.
|
|
49
|
+
*/
|
|
50
|
+
export declare function resolveColspans(columns: Column[]): void;
|