@coolon/angular-ui-powerups 16.1.0-alpha.331 → 16.1.0-alpha.332
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/esm2022/lib/components/exports.mjs +2 -1
- package/esm2022/lib/components/tables/abstract-table-model.mjs +73 -22
- package/esm2022/lib/components/tables/abstract-table.component.mjs +6 -2
- package/esm2022/lib/components/tables/end-of-rows/end-of-rows-watcher.mjs +191 -0
- package/esm2022/lib/components/tables/end-of-rows/end-of-rows.mjs +48 -0
- package/esm2022/lib/components/tables/filter/cell-search.mjs +1 -1
- package/esm2022/lib/components/tables/filter/server-search-model.mjs +2 -2
- package/esm2022/lib/components/tables/renderer/table-body/table-body.component.mjs +82 -49
- package/esm2022/lib/components/tables/table/table.component.mjs +46 -14
- package/fesm2022/coolon-angular-ui-powerups.mjs +475 -121
- package/fesm2022/coolon-angular-ui-powerups.mjs.map +1 -1
- package/lib/components/exports.d.ts +1 -0
- package/lib/components/tables/abstract-table-model.d.ts +54 -13
- package/lib/components/tables/abstract-table.component.d.ts +2 -0
- package/lib/components/tables/end-of-rows/end-of-rows-watcher.d.ts +104 -0
- package/lib/components/tables/end-of-rows/end-of-rows.d.ts +42 -0
- package/lib/components/tables/filter/cell-search.d.ts +2 -1
- package/lib/components/tables/filter/server-search-model.d.ts +1 -1
- package/lib/components/tables/renderer/table-body/table-body.component.d.ts +25 -10
- package/lib/components/tables/table/table.component.d.ts +18 -6
- package/package.json +1 -1
|
@@ -56,6 +56,7 @@ export * from "./scroll-container/scroll-container.component";
|
|
|
56
56
|
export * from "./section-header/section-header.component";
|
|
57
57
|
export * from "./switch-case/switch-case.component";
|
|
58
58
|
export * from "./tables/abstract-table-model";
|
|
59
|
+
export * from "./tables/end-of-rows/end-of-rows";
|
|
59
60
|
export * from "./tables/abstract-table.component";
|
|
60
61
|
export * from "./tables/column/column-manager";
|
|
61
62
|
export * from "./tables/column/column-model";
|
|
@@ -8,6 +8,7 @@ import type { ColumnTextProperties } from './column/column-text-properties';
|
|
|
8
8
|
import { CustomTemplateColumnModel } from './column/custom-template-column-model';
|
|
9
9
|
import { CustomValueColumnModel } from './column/custom-value-column-model';
|
|
10
10
|
import { ListPropertyColumnModel } from './column/list-propery-column-model';
|
|
11
|
+
import { EndOfRows } from './end-of-rows/end-of-rows';
|
|
11
12
|
import { PropertyColumnModel } from './column/property-column-model';
|
|
12
13
|
import { SelectionColumnModel } from './column/selection-column-model';
|
|
13
14
|
import type { SearchCriteriaPlacement } from './filter/cell-search';
|
|
@@ -18,6 +19,11 @@ import type { CellRenderer } from './renderer/cell-renderer';
|
|
|
18
19
|
import type { MenuBuilder } from './renderer/table-action-column/menu-builder';
|
|
19
20
|
import { TableActionColumnComponent } from './renderer/table-action-column/table-action-column.component';
|
|
20
21
|
import type { TableCustomMoreMenuPopupComponent } from './renderer/table-custom-more-menu/table-custom-more-menu-popup.component';
|
|
22
|
+
/** The row a table shows after its last while more rows are on their way: see {@link AbstractTableModel.showLoadingRowWhile}. */
|
|
23
|
+
export interface LoadingRow {
|
|
24
|
+
readonly loading$: ValueModel<boolean>;
|
|
25
|
+
readonly message: () => string;
|
|
26
|
+
}
|
|
21
27
|
export declare abstract class AbstractTableModel<Row extends object> extends GarbageCollector implements OneTimeBinding {
|
|
22
28
|
/** A proxied table model is a one-time binding: it cannot be read before its input is set. */
|
|
23
29
|
readonly [OneTimeBinding.brand]: true;
|
|
@@ -31,6 +37,8 @@ export declare abstract class AbstractTableModel<Row extends object> extends Gar
|
|
|
31
37
|
readonly selectionColumnModel: SelectionColumnModel<Row>;
|
|
32
38
|
private rowSelectionDisabledOnAllColumns$;
|
|
33
39
|
private readonly rowClickListeners;
|
|
40
|
+
/** The table body, which scrolls when the page asks with {@link scrollToTop}. */
|
|
41
|
+
private readonly scrollToTopListeners;
|
|
34
42
|
readonly firstVisibleColumn$: ValueModel<ColumnModel<Row>>;
|
|
35
43
|
readonly lastVisibleColumn$: ValueModel<ColumnModel<Row>>;
|
|
36
44
|
readonly textSearchPredicate$: ValueModel<TextSearchPredicate<Row>>;
|
|
@@ -40,21 +48,19 @@ export declare abstract class AbstractTableModel<Row extends object> extends Gar
|
|
|
40
48
|
readonly selectableRows$: ListModel<Row>;
|
|
41
49
|
readonly leadSelection$: ValueModel<Row>;
|
|
42
50
|
readonly hasSelection$: BooleanValueModelChain;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
* loads the next step while it is true. Once the rows fill the table and the reader is above their
|
|
48
|
-
* end, it turns false; while they still do not, it stays true, so the page loads again when its step
|
|
49
|
-
* lands. A table that does not scroll, or scrolls virtually, leaves it false.
|
|
50
|
-
*/
|
|
51
|
-
readonly endInView$: ValueModel<boolean>;
|
|
51
|
+
/** The measurements a page asked for with {@link watchEndOfRows}, if it did. */
|
|
52
|
+
private endOfRowsAskedFor;
|
|
53
|
+
/** The loading row a page asked for with {@link showLoadingRowWhile}, if it did. */
|
|
54
|
+
private loadingRowAskedFor;
|
|
52
55
|
readonly footerRowModels: FooterRowModel.Impl[];
|
|
53
56
|
private readonly _viewDependencies;
|
|
54
57
|
/** The table's settled search, once a table with a filter model binds (`useSearch`). */
|
|
55
58
|
private readonly _search$;
|
|
56
|
-
/**
|
|
57
|
-
|
|
59
|
+
/**
|
|
60
|
+
* True once a table has initialised the model: its columns, their search classes, and what it renders. A page sets
|
|
61
|
+
* up what the table searches by and renders before then.
|
|
62
|
+
*/
|
|
63
|
+
private readonly _initialised$;
|
|
58
64
|
/** Counts changes to the models the search classes depend on, so the criteria can depend on one model. */
|
|
59
65
|
private readonly _searchDependencyChanges$;
|
|
60
66
|
private _criteriaPlacement?;
|
|
@@ -137,6 +143,39 @@ export declare abstract class AbstractTableModel<Row extends object> extends Gar
|
|
|
137
143
|
*/
|
|
138
144
|
useDisplayScope(scope$: ValueModel<string | undefined>): this;
|
|
139
145
|
get displayScope$(): ValueModel<string | undefined>;
|
|
146
|
+
/**
|
|
147
|
+
* Shows a row after the last, with a spinner and [message], while the next chunk of rows is on its way: while
|
|
148
|
+
* [loading$] is true and, in a table that watches the end of its rows ({@link watchEndOfRows}), until the table has
|
|
149
|
+
* measured the chunk's rows. A page that loads its rows a chunk at a time sets [loading$] while a chunk is on its
|
|
150
|
+
* way, so a reader at the end of the rows sees that more are coming. Screen readers announce the message as it
|
|
151
|
+
* appears.
|
|
152
|
+
*
|
|
153
|
+
* In a table that watches the end of its rows, [loading$] also tells the table when a chunk is on its way, and the
|
|
154
|
+
* end of the rows does not count as in view meanwhile. The row stays until the table has measured afresh, so it does
|
|
155
|
+
* not drop out between two chunks that follow one another. Every table shows the row except a virtual-scrolling one.
|
|
156
|
+
*
|
|
157
|
+
* Call it once: a second call would replace the first's flag and message. The table reads it as it initialises, in
|
|
158
|
+
* its ngOnInit, so call it where the model is built, not from a directive on the aup-table, which initialises after
|
|
159
|
+
* the table does.
|
|
160
|
+
*/
|
|
161
|
+
showLoadingRowWhile(loading$: ValueModel<boolean>, message: () => string): this;
|
|
162
|
+
/** The row {@link showLoadingRowWhile} shows, if the page asked for one. Read by the table body. */
|
|
163
|
+
get _loadingRow(): LoadingRow | undefined;
|
|
164
|
+
/**
|
|
165
|
+
* Starts measuring whether the end of the rows is in view and how many rows fit, for a page that loads its rows a
|
|
166
|
+
* chunk at a time as the reader scrolls, and returns the measurements. A table that is not asked measures nothing.
|
|
167
|
+
* A table's rows have one end, so asking again returns the same measurements.
|
|
168
|
+
*
|
|
169
|
+
* Only a table that scrolls classically, with enableScrolling and scrollMode="classic", measures. In any other the
|
|
170
|
+
* end of the rows never comes into view, so a page that waits for it loads nothing, and the table warns of it in
|
|
171
|
+
* development. A page that loads its first chunk on its own, as when its search changes, shows rows either way.
|
|
172
|
+
*
|
|
173
|
+
* The table reads it as it initialises, in its ngOnInit, so ask where the model is built, not from a directive on
|
|
174
|
+
* the aup-table, which initialises after the table does.
|
|
175
|
+
*/
|
|
176
|
+
watchEndOfRows(): EndOfRows;
|
|
177
|
+
/** The measurements {@link watchEndOfRows} started, if a page asked for them. Read by the table body. */
|
|
178
|
+
get _endOfRows(): EndOfRows | undefined;
|
|
140
179
|
pluck<P extends Types.ValuePropertiesOf<Row>>(property: P, options?: {
|
|
141
180
|
columnId: string;
|
|
142
181
|
}): PropertyColumnModel<Row, P>;
|
|
@@ -184,7 +223,9 @@ export declare abstract class AbstractTableModel<Row extends object> extends Gar
|
|
|
184
223
|
isCursorEnabledForRow(column: ColumnModel<Row>, row: Row): boolean;
|
|
185
224
|
selectRow(row: Row): void;
|
|
186
225
|
onRowClicked(callback: (row: Row) => void): Disposable;
|
|
187
|
-
/**
|
|
188
|
-
|
|
226
|
+
/** Scrolls the table back to its first row, as a page does when it shows a new list in place of the old one. */
|
|
227
|
+
scrollToTop(): void;
|
|
228
|
+
/** Called by the table body, which scrolls when a page asks with {@link scrollToTop}. */
|
|
229
|
+
_onScrollToTop(scroll: () => void): Disposable;
|
|
189
230
|
_notifyCellClicked(columnModel: ColumnModel<Row>, row: Row): void;
|
|
190
231
|
}
|
|
@@ -87,6 +87,8 @@ export declare class AbstractTableComponent<Row extends object> extends Disposab
|
|
|
87
87
|
readonly trackBy: (index: number, item: Row) => any;
|
|
88
88
|
constructor(injector: Injector);
|
|
89
89
|
identityOf(row: Row): any;
|
|
90
|
+
/** A list without `identifiedBy` identifies each row by the row itself, so its rows have no id. */
|
|
91
|
+
protected hasNoId(row: Row): boolean;
|
|
90
92
|
ngOnInit(): void;
|
|
91
93
|
get visibleRows$(): import("@coolon/pectin").ListModel<Row>;
|
|
92
94
|
protected getModel(): AbstractTableModel<Row>;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { NgZone } from '@angular/core';
|
|
2
|
+
import { ValueModel } from '@coolon/pectin';
|
|
3
|
+
import { EndOfRows } from './end-of-rows';
|
|
4
|
+
/**
|
|
5
|
+
* Measures, for the table body, whether the end of a classic-scrolling table's rows is in view and how many rows fit,
|
|
6
|
+
* and reports both to the table model's {@link EndOfRows}.
|
|
7
|
+
*
|
|
8
|
+
* The body places a marker after the last row, inside the scroll container: the element that scrolls the rows. An
|
|
9
|
+
* IntersectionObserver on the scroll container reports when the marker comes into view or leaves it. It counts the
|
|
10
|
+
* marker as in view from {@link EndOfRowsWatcher.LOOKAHEAD_PIXELS} below the visible bottom, so the next chunk is on
|
|
11
|
+
* its way before the reader reaches the last row. Each report also measures how many rows fit, so a page that loads
|
|
12
|
+
* on the report sizes its chunk from rows that have been drawn.
|
|
13
|
+
*/
|
|
14
|
+
export declare class EndOfRowsWatcher {
|
|
15
|
+
private readonly endOfRows;
|
|
16
|
+
private readonly zone;
|
|
17
|
+
private readonly themeRowHeight;
|
|
18
|
+
/** The marker after the last row, which the observer watches. */
|
|
19
|
+
private marker?;
|
|
20
|
+
/** The element that scrolls the rows, and contains the table and the marker. */
|
|
21
|
+
private scrollContainer?;
|
|
22
|
+
private observer?;
|
|
23
|
+
/** Whether a chunk is on its way, during which the end of the rows does not count as in view: see [pause]. */
|
|
24
|
+
private paused;
|
|
25
|
+
private readonly _awaitingReport$;
|
|
26
|
+
/** Whether the watcher has started a fresh observer, and that observer has not reported yet. */
|
|
27
|
+
readonly awaitingReport$: ValueModel<boolean>;
|
|
28
|
+
constructor(endOfRows: EndOfRows, zone: NgZone, themeRowHeight: () => number);
|
|
29
|
+
/**
|
|
30
|
+
* Watches [marker], in the scroll container that contains it, or stops watching when it is gone, as when the table
|
|
31
|
+
* stops scrolling classically. While a chunk is on its way, it only remembers the marker, and starts watching when
|
|
32
|
+
* the chunk ends.
|
|
33
|
+
*/
|
|
34
|
+
watch(marker: HTMLElement | undefined): void;
|
|
35
|
+
/**
|
|
36
|
+
* Called when a chunk starts loading. Its rows are on their way, so the rows drawn now say nothing about where the
|
|
37
|
+
* end of the rows will be. Were the end left in view, a page that hears the chunk end before its rows are drawn
|
|
38
|
+
* would load another chunk at once. So the end is out of view until [measureAfresh].
|
|
39
|
+
*/
|
|
40
|
+
pause(): void;
|
|
41
|
+
/**
|
|
42
|
+
* Called when a chunk has ended, whether its rows have been drawn yet or not. A fresh observer reports once the
|
|
43
|
+
* browser has laid out the page, so it measures the chunk's rows if they arrived in the same turn as the chunk ended.
|
|
44
|
+
* Returns whether a report is on its way, which it is not while the table does not scroll classically.
|
|
45
|
+
*/
|
|
46
|
+
measureAfresh(): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Called when the table's rows change. The last measurement was taken against the old rows. If it said the end was
|
|
49
|
+
* in view, a page could load another chunk because of it, though the new rows may already fill the table. So the
|
|
50
|
+
* end is reported out of view until the table has drawn the new rows and measured again.
|
|
51
|
+
*
|
|
52
|
+
* An observer reports only when the marker crosses into or out of view. One that last saw the end in view would not
|
|
53
|
+
* report again while the end stays in view, so it is replaced, and a new observer always reports once.
|
|
54
|
+
*
|
|
55
|
+
* A measurement that said the end was out of view cannot load anything, so it is left alone: the observer reports
|
|
56
|
+
* when the end comes into view.
|
|
57
|
+
*
|
|
58
|
+
* The rows can change outside Angular's zone, as when a socket delivers them. The fresh observer is made inside it,
|
|
59
|
+
* and leaving the zone has Angular draw the new rows and check the page's reaction to this report.
|
|
60
|
+
*/
|
|
61
|
+
rowsChanged(): void;
|
|
62
|
+
/** Called when the table changes size, which changes how many rows fit. */
|
|
63
|
+
resized(): void;
|
|
64
|
+
/**
|
|
65
|
+
* Stops watching. Nothing is measured any more, so the end is out of view and the rows that fit are unknown.
|
|
66
|
+
*
|
|
67
|
+
* The table stops watching while Angular is checking it, as when the marker's *ngIf removes it or the table is
|
|
68
|
+
* destroyed. The page has already read the measurements in this check, so changing them now would change what it
|
|
69
|
+
* showed after Angular checked it. So they change once the check is over. A table that is watching again by then,
|
|
70
|
+
* as one switched back to classic scrolling in the same check, keeps its measurements.
|
|
71
|
+
*/
|
|
72
|
+
stop(): void;
|
|
73
|
+
/**
|
|
74
|
+
* Replaces the observer with a fresh one, which always reports once, whether the end is in view or not.
|
|
75
|
+
*
|
|
76
|
+
* An observer reports in the zone it was made in, so it is made inside Angular's zone. Its reports are then checked,
|
|
77
|
+
* so the loading row goes when it should though the report changes nothing. A chunk can arrive outside the zone, as
|
|
78
|
+
* when a socket delivers it, and nothing then draws its rows. Leaving the zone has Angular draw them, before the
|
|
79
|
+
* browser's first report, which comes after its next layout.
|
|
80
|
+
*/
|
|
81
|
+
private observeAfresh;
|
|
82
|
+
/** Whether there is a marker in a scroll container to watch, in a browser that can watch it. */
|
|
83
|
+
private canObserve;
|
|
84
|
+
/**
|
|
85
|
+
* Reports a measurement that differs from the last one. A page reacts by loading and showing that it is loading.
|
|
86
|
+
* A resize, a pause or a stop can come from outside Angular's zone, so the report is brought into the zone, where
|
|
87
|
+
* the page's reaction is checked. Entering the zone from outside checks the whole app, so a measurement that changes
|
|
88
|
+
* nothing is not reported.
|
|
89
|
+
*/
|
|
90
|
+
private reportIfChanged;
|
|
91
|
+
/**
|
|
92
|
+
* How many rows fit between the table's header and footer, at the average height of the rows drawn, or of the
|
|
93
|
+
* theme's row height while there are none. Undefined while the table is hidden, as in a closed tab, where it
|
|
94
|
+
* measures 0px.
|
|
95
|
+
*
|
|
96
|
+
* Every height is read with getBoundingClientRect, not clientHeight. A CSS zoom scales the bounding boxes but not
|
|
97
|
+
* clientHeight, so mixing the two would miscount.
|
|
98
|
+
*/
|
|
99
|
+
private measureRowCountThatFits;
|
|
100
|
+
}
|
|
101
|
+
export declare namespace EndOfRowsWatcher {
|
|
102
|
+
/** How far below the visible bottom the end of the rows counts as in view: about four rows of the theme's height. */
|
|
103
|
+
const LOOKAHEAD_PIXELS = 200;
|
|
104
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ValueModel } from '@coolon/pectin';
|
|
2
|
+
/**
|
|
3
|
+
* What a page needs to load a table's rows a chunk at a time as the reader scrolls: whether the end of the rows is in
|
|
4
|
+
* view, and how many rows fit in view. A page asks for it with `AbstractTableModel.watchEndOfRows`. The table body
|
|
5
|
+
* measures both and reports them here, through an `EndOfRowsWatcher`.
|
|
6
|
+
*
|
|
7
|
+
* Only a classic-scrolling table measures them. In any other table the end of the rows is never in view, and the
|
|
8
|
+
* number of rows that fit is undefined.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const endOfRows = table.watchEndOfRows();
|
|
12
|
+
* // The end comes into view again after each chunk's rows are drawn, while they do not fill the table.
|
|
13
|
+
* when(chain(endOfRows.inView$).map(inView => inView && hasMore$.value && !loading$.value, {dependsOn: [hasMore$, loading$]}))
|
|
14
|
+
* .becomesTruthy(() => loadChunk(Math.max(50, 2 * (endOfRows.rowCountThatFits$.value ?? 0))));
|
|
15
|
+
*/
|
|
16
|
+
export declare class EndOfRows {
|
|
17
|
+
private readonly _inView$;
|
|
18
|
+
/**
|
|
19
|
+
* Whether the reader is within about four rows of the last row, or the rows do not fill the table. A page loads its
|
|
20
|
+
* next chunk when it turns true, so the chunk is on its way before the reader reaches the last row. It is false
|
|
21
|
+
* until the table has measured.
|
|
22
|
+
*
|
|
23
|
+
* It is never true because of rows the table has not drawn yet. When rows arrive while it is true, it turns false
|
|
24
|
+
* until the table has drawn them and measured again. If they still do not fill the table, it then turns true again
|
|
25
|
+
* and the page loads the next chunk. So a page never loads a chunk beyond the one that fills the table.
|
|
26
|
+
*
|
|
27
|
+
* A page that shows a loading row (`showLoadingRowWhile`) tells the table when a chunk is on its way, and it is
|
|
28
|
+
* false for that time. The page may then end loading before or after it sets the chunk's rows. A page without a
|
|
29
|
+
* loading row must set the rows first: as loading ends, the table still measures the rows drawn before the chunk.
|
|
30
|
+
*/
|
|
31
|
+
readonly inView$: ValueModel<boolean>;
|
|
32
|
+
private readonly _rowCountThatFits$;
|
|
33
|
+
/**
|
|
34
|
+
* How many rows fit in the visible part of the table, between its header and its footer, at the average height of
|
|
35
|
+
* the rows drawn, or at the theme's row height while there are none. A page can size each chunk from it. It follows
|
|
36
|
+
* the table's size, so it grows when the window does. It is undefined until the table has measured, and while the
|
|
37
|
+
* table is hidden.
|
|
38
|
+
*/
|
|
39
|
+
readonly rowCountThatFits$: ValueModel<number | undefined>;
|
|
40
|
+
/** Called by the table body's `EndOfRowsWatcher` with what it has measured. */
|
|
41
|
+
_report(inView: boolean, rowCountThatFits: number | undefined): void;
|
|
42
|
+
}
|
|
@@ -15,7 +15,8 @@ import type { TableSearch } from "./table-search";
|
|
|
15
15
|
* nothing matches.
|
|
16
16
|
*
|
|
17
17
|
* @example
|
|
18
|
-
* // The server stores a power's code, not its label, so the search is
|
|
18
|
+
* // The server stores a power's code, not its label, so the search is matched against the labels here and
|
|
19
|
+
* // sent as the powers it found.
|
|
19
20
|
* @Injectable({providedIn: 'root'})
|
|
20
21
|
* export class PowerSearch implements CellSearch<HeroSearchCriteria> {
|
|
21
22
|
* readonly searchCriteriaClass = HeroSearchCriteria;
|
|
@@ -2,7 +2,7 @@ import { Disposable, ListModel, ValueModel } from "@coolon/pectin";
|
|
|
2
2
|
import { TableSearchModel } from "./table-search-model";
|
|
3
3
|
import type { TextSearchPredicate } from "./text-search-predicate";
|
|
4
4
|
/**
|
|
5
|
-
* The search model of a table whose rows the server finds, such as one that loads them a
|
|
5
|
+
* The search model of a table whose rows the server finds, such as one that loads them a chunk at a
|
|
6
6
|
* time. The rows a table holds are what the server found for the search and the filters, so it shows
|
|
7
7
|
* them all. Its settled search ({@link search$}) becomes the server request's criteria through
|
|
8
8
|
* `AbstractTableModel.useCriteria`, and the cells highlight the search text as usual.
|
|
@@ -33,11 +33,27 @@ export declare class TableBodyComponent<Row extends object> extends ResizeAwareC
|
|
|
33
33
|
holdScrollPosition: boolean;
|
|
34
34
|
scrollViewport: CdkVirtualScrollViewport;
|
|
35
35
|
private classicScrollContainer?;
|
|
36
|
-
/**
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Measures whether the end of the rows is in view and how many rows fit, when the page asked for it with
|
|
38
|
+
* `AbstractTableModel.watchEndOfRows`.
|
|
39
|
+
*/
|
|
40
|
+
private endOfRowsWatcher?;
|
|
41
|
+
/** The zone the end-of-rows watcher reports in, so a page that reacts by loading is checked. */
|
|
40
42
|
private readonly zone;
|
|
43
|
+
/**
|
|
44
|
+
* The marker after the last row, which the watcher watches in the classic scroll container that contains it. It is
|
|
45
|
+
* drawn only while the table scrolls classically, so it comes and goes as the scroll mode changes, and the watcher
|
|
46
|
+
* follows.
|
|
47
|
+
*/
|
|
48
|
+
private set endOfRowsMarker(value);
|
|
49
|
+
/** Whether the loading row shows: see `AbstractTableModel.showLoadingRowWhile`. */
|
|
50
|
+
protected loadingRowShown$: ValueModel<boolean>;
|
|
51
|
+
/**
|
|
52
|
+
* Whether the loading row stays after its chunk has ended, until the table has measured the end of the rows afresh.
|
|
53
|
+
* If the chunk's rows still do not fill the table, the page loads the next chunk only once the table has measured
|
|
54
|
+
* them, and the row would otherwise drop out in between.
|
|
55
|
+
*/
|
|
56
|
+
private readonly loadingRowHeldUntilMeasured$;
|
|
41
57
|
columns$: ListModelChain<ColumnModel<Row>>;
|
|
42
58
|
columnIds$: ListModelChain<string>;
|
|
43
59
|
footerRowDefs$: ValueModel<ResolvedFooterRow[]>;
|
|
@@ -106,11 +122,12 @@ export declare class TableBodyComponent<Row extends object> extends ResizeAwareC
|
|
|
106
122
|
private notifyScrollEnded;
|
|
107
123
|
ngOnDestroy(): void;
|
|
108
124
|
/**
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
* below the visible bottom, so a page that loads more has the rows ready by the time they are reached.
|
|
125
|
+
* Sets up what the page asked the table for: measuring the end of the rows (`AbstractTableModel.watchEndOfRows`),
|
|
126
|
+
* the loading row (`AbstractTableModel.showLoadingRowWhile`), or both, which work together.
|
|
112
127
|
*/
|
|
113
|
-
private
|
|
128
|
+
private setUpEndOfRowsAndLoadingRow;
|
|
129
|
+
/** Scrolls back to the first row, in whichever scroll mode the table is in. */
|
|
130
|
+
private scrollToTop;
|
|
114
131
|
private resetAnimationsAfterFrame;
|
|
115
132
|
private clearScrollTimeout;
|
|
116
133
|
static ɵfac: i0.ɵɵFactoryDeclaration<TableBodyComponent<any>, [{ optional: true; }]>;
|
|
@@ -118,8 +135,6 @@ export declare class TableBodyComponent<Row extends object> extends ResizeAwareC
|
|
|
118
135
|
}
|
|
119
136
|
export declare namespace TableBodyComponent {
|
|
120
137
|
type ScrollMode = "none" | "classic" | "virtual";
|
|
121
|
-
/** How far below the visible bottom the end of the rows counts as in view: about four rows. */
|
|
122
|
-
const END_OF_ROWS_MARGIN_PIXELS = 200;
|
|
123
138
|
/** A row in view, by the id it is drawn with, and the top of its box in the viewport. */
|
|
124
139
|
interface RowInView {
|
|
125
140
|
readonly id: string;
|
|
@@ -49,6 +49,7 @@ import * as i0 from "@angular/core";
|
|
|
49
49
|
* --aup-table-row-selected-background-color: rebeccapurple; // defaults to transparent
|
|
50
50
|
* --aup-table-first-column-padding-left: 18px // defaults to --column-gap
|
|
51
51
|
* --aup-table-last-column-padding-right: 18px // defaults to --column-gap
|
|
52
|
+
* --aup-table-loading-row-color: grey; // the row showLoadingRowWhile shows; defaults to the text colour
|
|
52
53
|
* }
|
|
53
54
|
*
|
|
54
55
|
* // per table settings.
|
|
@@ -73,6 +74,14 @@ import * as i0 from "@angular/core";
|
|
|
73
74
|
* }
|
|
74
75
|
* }
|
|
75
76
|
* }
|
|
77
|
+
*
|
|
78
|
+
* Testing hooks
|
|
79
|
+
*
|
|
80
|
+
* Every table marks what a test needs to drive it as a reader would:
|
|
81
|
+
* - the element that contains the rows carries `aup-table-scroller` whatever the scroll mode, so a test can scroll a
|
|
82
|
+
* table that scrolls;
|
|
83
|
+
* - each row carries its id as `aup-row-id`, so a test can find a row where it is drawn;
|
|
84
|
+
* - the row `showLoadingRowWhile` shows carries `aup-loading-row`.
|
|
76
85
|
*/
|
|
77
86
|
export declare class TableComponent<Row extends object> extends AbstractTableComponent<Row> implements OnInit {
|
|
78
87
|
accessor tableModel: TableModel<Row>;
|
|
@@ -88,12 +97,10 @@ export declare class TableComponent<Row extends object> extends AbstractTableCom
|
|
|
88
97
|
/**
|
|
89
98
|
* Set to true to keep the rows in view where they are when rows are inserted, removed or resized above
|
|
90
99
|
* them, so a reader scrolled down the table is not moved. At the top of the table nothing is held, so a
|
|
91
|
-
* row inserted there comes into view.
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
* The element that scrolls the rows, in either scroll mode, carries the attribute `aup-scroll-container`,
|
|
96
|
-
* and each row its id as `aup-row-id`, so a test can scroll the table and find a row where it is drawn.
|
|
100
|
+
* row inserted there comes into view. It applies only while the table scrolls classically, with
|
|
101
|
+
* `enableScrolling` and `scrollMode="classic"`, and only to rows with an identity of their own, a list
|
|
102
|
+
* `identifiedBy` an id, because a row is found again by its id. In development, a table set to hold
|
|
103
|
+
* without either warns in the console.
|
|
97
104
|
*/
|
|
98
105
|
holdScrollPosition: boolean;
|
|
99
106
|
private _footerContentAdded;
|
|
@@ -106,6 +113,11 @@ export declare class TableComponent<Row extends object> extends AbstractTableCom
|
|
|
106
113
|
* table moves the rows the reader is on, or holds the wrong one.
|
|
107
114
|
*/
|
|
108
115
|
private warnWhereHoldingCannotWork;
|
|
116
|
+
/**
|
|
117
|
+
* Warns of a page that watches the end of a table's rows where the table cannot measure it. Nothing fails otherwise:
|
|
118
|
+
* the end of the rows never comes into view, so a page that waits for it loads nothing.
|
|
119
|
+
*/
|
|
120
|
+
private warnWhereEndOfRowsCannotBeWatched;
|
|
109
121
|
protected getModel(): AbstractTableModel<Row>;
|
|
110
122
|
/**
|
|
111
123
|
* True while the filters leave no row and the host gave content for the empty slot. A host that
|