@coolon/angular-ui-powerups 16.1.0-alpha.332 → 16.1.0-alpha.334
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 +34 -7
- package/esm2022/lib/components/tables/end-of-rows/end-of-rows-watcher.mjs +4 -2
- package/esm2022/lib/components/tables/renderer/table-body/table-body.component.mjs +56 -4
- package/esm2022/lib/components/tables/top-of-rows/top-of-rows.mjs +29 -0
- package/fesm2022/coolon-angular-ui-powerups.mjs +119 -11
- 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 +25 -6
- package/lib/components/tables/renderer/table-body/table-body.component.d.ts +15 -0
- package/lib/components/tables/top-of-rows/top-of-rows.d.ts +26 -0
- package/package.json +1 -1
|
@@ -57,6 +57,7 @@ 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
59
|
export * from "./tables/end-of-rows/end-of-rows";
|
|
60
|
+
export * from "./tables/top-of-rows/top-of-rows";
|
|
60
61
|
export * from "./tables/abstract-table.component";
|
|
61
62
|
export * from "./tables/column/column-manager";
|
|
62
63
|
export * from "./tables/column/column-model";
|
|
@@ -9,6 +9,7 @@ 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
11
|
import { EndOfRows } from './end-of-rows/end-of-rows';
|
|
12
|
+
import { TopOfRows } from './top-of-rows/top-of-rows';
|
|
12
13
|
import { PropertyColumnModel } from './column/property-column-model';
|
|
13
14
|
import { SelectionColumnModel } from './column/selection-column-model';
|
|
14
15
|
import type { SearchCriteriaPlacement } from './filter/cell-search';
|
|
@@ -50,6 +51,8 @@ export declare abstract class AbstractTableModel<Row extends object> extends Gar
|
|
|
50
51
|
readonly hasSelection$: BooleanValueModelChain;
|
|
51
52
|
/** The measurements a page asked for with {@link watchEndOfRows}, if it did. */
|
|
52
53
|
private endOfRowsAskedFor;
|
|
54
|
+
/** What a page asked for with {@link watchTopOfRows}, if it did. */
|
|
55
|
+
private topOfRowsAskedFor;
|
|
53
56
|
/** The loading row a page asked for with {@link showLoadingRowWhile}, if it did. */
|
|
54
57
|
private loadingRowAskedFor;
|
|
55
58
|
readonly footerRowModels: FooterRowModel.Impl[];
|
|
@@ -144,15 +147,16 @@ export declare abstract class AbstractTableModel<Row extends object> extends Gar
|
|
|
144
147
|
useDisplayScope(scope$: ValueModel<string | undefined>): this;
|
|
145
148
|
get displayScope$(): ValueModel<string | undefined>;
|
|
146
149
|
/**
|
|
147
|
-
* Shows a row
|
|
148
|
-
* [loading$] is true and, in a table that watches the end of its rows ({@link watchEndOfRows}), until
|
|
149
|
-
* measured the chunk's rows. A page that loads its rows a chunk at a time sets [loading$] while a chunk
|
|
150
|
-
*
|
|
151
|
-
* appears.
|
|
150
|
+
* Shows a row with a spinner and [message], pinned to the bottom of the table, while the next chunk of rows is on
|
|
151
|
+
* its way: while [loading$] is true and, in a table that watches the end of its rows ({@link watchEndOfRows}), until
|
|
152
|
+
* the table has measured the chunk's rows. A page that loads its rows a chunk at a time sets [loading$] while a chunk
|
|
153
|
+
* is on its way. The row is pinned, so the reader sees that more are coming wherever they have scrolled to. Screen
|
|
154
|
+
* readers announce the message as it appears.
|
|
152
155
|
*
|
|
153
156
|
* 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
157
|
* 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.
|
|
158
|
+
* not drop out between two chunks that follow one another. The row sits above any other footer row
|
|
159
|
+
* ({@link addFooterRow}).
|
|
156
160
|
*
|
|
157
161
|
* Call it once: a second call would replace the first's flag and message. The table reads it as it initialises, in
|
|
158
162
|
* its ngOnInit, so call it where the model is built, not from a directive on the aup-table, which initialises after
|
|
@@ -176,6 +180,21 @@ export declare abstract class AbstractTableModel<Row extends object> extends Gar
|
|
|
176
180
|
watchEndOfRows(): EndOfRows;
|
|
177
181
|
/** The measurements {@link watchEndOfRows} started, if a page asked for them. Read by the table body. */
|
|
178
182
|
get _endOfRows(): EndOfRows | undefined;
|
|
183
|
+
/**
|
|
184
|
+
* Starts telling the page whether the reader is at the top of the rows, and returns what it is told. A page that
|
|
185
|
+
* finds it has missed rows can then load them again at once while the reader is at the top, where loading again
|
|
186
|
+
* moves nothing, and offer to further down. A table that is not asked watches nothing. A table's rows have one top,
|
|
187
|
+
* so asking again returns the same.
|
|
188
|
+
*
|
|
189
|
+
* Only a table that scrolls classically, with enableScrolling and scrollMode="classic", tells. In any other the
|
|
190
|
+
* reader never counts as at the top.
|
|
191
|
+
*
|
|
192
|
+
* The table reads it as it initialises, in its ngOnInit, so ask where the model is built, not from a directive on
|
|
193
|
+
* the aup-table, which initialises after the table does.
|
|
194
|
+
*/
|
|
195
|
+
watchTopOfRows(): TopOfRows;
|
|
196
|
+
/** What {@link watchTopOfRows} started, if a page asked for it. Read by the table body. */
|
|
197
|
+
get _topOfRows(): TopOfRows | undefined;
|
|
179
198
|
pluck<P extends Types.ValuePropertiesOf<Row>>(property: P, options?: {
|
|
180
199
|
columnId: string;
|
|
181
200
|
}): PropertyColumnModel<Row, P>;
|
|
@@ -33,6 +33,13 @@ export declare class TableBodyComponent<Row extends object> extends ResizeAwareC
|
|
|
33
33
|
holdScrollPosition: boolean;
|
|
34
34
|
scrollViewport: CdkVirtualScrollViewport;
|
|
35
35
|
private classicScrollContainer?;
|
|
36
|
+
/**
|
|
37
|
+
* The container that contains the rows unless the table scrolls virtually. It comes and goes as the scroll mode
|
|
38
|
+
* changes, and the top of the rows is watched in whichever is drawn.
|
|
39
|
+
*/
|
|
40
|
+
private set classicScrollContainerRef(value);
|
|
41
|
+
/** Stops listening to the last container's scrolling, for `AbstractTableModel.watchTopOfRows`. */
|
|
42
|
+
private topOfRowsListening?;
|
|
36
43
|
/**
|
|
37
44
|
* Measures whether the end of the rows is in view and how many rows fit, when the page asked for it with
|
|
38
45
|
* `AbstractTableModel.watchEndOfRows`.
|
|
@@ -126,6 +133,14 @@ export declare class TableBodyComponent<Row extends object> extends ResizeAwareC
|
|
|
126
133
|
* the loading row (`AbstractTableModel.showLoadingRowWhile`), or both, which work together.
|
|
127
134
|
*/
|
|
128
135
|
private setUpEndOfRowsAndLoadingRow;
|
|
136
|
+
/**
|
|
137
|
+
* Tells the page whether the reader is at the top of the rows, when it asked with `AbstractTableModel.watchTopOfRows`:
|
|
138
|
+
* each time the reader scrolls [container], and once it is drawn. Scroll events come many to a second, so they are
|
|
139
|
+
* heard outside Angular's zone. A change is reported inside it, so a page that reacts is checked.
|
|
140
|
+
*/
|
|
141
|
+
private watchTopOfRowsIn;
|
|
142
|
+
/** Reports whether the reader is at the top of the rows: see `TopOfRows.inView$`. */
|
|
143
|
+
private reportTopOfRows;
|
|
129
144
|
/** Scrolls back to the first row, in whichever scroll mode the table is in. */
|
|
130
145
|
private scrollToTop;
|
|
131
146
|
private resetAnimationsAfterFrame;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ValueModel } from '@coolon/pectin';
|
|
2
|
+
/**
|
|
3
|
+
* Whether the reader is at the top of a table's rows, which a page asks for with `AbstractTableModel.watchTopOfRows`.
|
|
4
|
+
* At the top, nothing is scrolled out of view, so a page can load its rows again without moving the reader. Further
|
|
5
|
+
* down, it can only offer to, since loading again returns the reader to the top. The table body reports it here.
|
|
6
|
+
*
|
|
7
|
+
* Only a classic-scrolling table reports it. In any other table the reader never counts as at the top, because a page
|
|
8
|
+
* that cannot tell must not load the rows again under a reader who may be reading them.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const topOfRows = table.watchTopOfRows();
|
|
12
|
+
* // Rows the page missed are loaded again at once when the reader is at the top, and offered further down.
|
|
13
|
+
* when(chain(missed$).map(missed => missed > 0 && topOfRows.inView$.value, {dependsOn: topOfRows.inView$}))
|
|
14
|
+
* .becomesTruthy(() => reload());
|
|
15
|
+
*/
|
|
16
|
+
export declare class TopOfRows {
|
|
17
|
+
private readonly _inView$;
|
|
18
|
+
/**
|
|
19
|
+
* Whether the table is scrolled all the way up, so no row is above the visible part. It follows the reader as they
|
|
20
|
+
* scroll, and is false until the table has drawn. This is the rule `TableComponent.holdScrollPosition` uses too: at
|
|
21
|
+
* the top the table holds nothing, and rows that join above the first push the others down.
|
|
22
|
+
*/
|
|
23
|
+
readonly inView$: ValueModel<boolean>;
|
|
24
|
+
/** Called by the table body with what it has measured. */
|
|
25
|
+
_report(inView: boolean): void;
|
|
26
|
+
}
|