@ng-native/components 0.29.0 → 0.30.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.
- package/README.md +2 -2
- package/dist/activity-indicator.js +3 -3
- package/dist/animated-style.js +3 -3
- package/dist/animations-web.js +3 -3
- package/dist/animations.js +3 -3
- package/dist/content-container.js +3 -3
- package/dist/context-menu.js +3 -3
- package/dist/drag-and-drop.js +6 -6
- package/dist/gestures-web.js +6 -6
- package/dist/gestures.js +6 -6
- package/dist/gradient-text.d.ts +1 -1
- package/dist/gradient-text.js +4 -4
- package/dist/gradient-text.js.map +1 -1
- package/dist/image-background.js +3 -3
- package/dist/image.js +3 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/input-accessory-view.js +3 -3
- package/dist/keyboard-avoiding-view.js +3 -3
- package/dist/keyboard-dock.js +15 -15
- package/dist/markdown-blocks.d.ts +2 -1
- package/dist/markdown-blocks.js +22 -18
- package/dist/markdown-blocks.js.map +1 -1
- package/dist/markdown-columns.js +3 -3
- package/dist/markdown-stream.js +8 -5
- package/dist/markdown-stream.js.map +1 -1
- package/dist/markdown.js +5 -5
- package/dist/markdown.js.map +1 -1
- package/dist/menu.js +12 -12
- package/dist/modal.js +8 -3
- package/dist/modal.js.map +1 -1
- package/dist/native-button.js +3 -3
- package/dist/native-gesture.js +3 -3
- package/dist/native-ref.js +3 -3
- package/dist/press-menu.d.ts +17 -8
- package/dist/press-menu.js +39 -18
- package/dist/press-menu.js.map +1 -1
- package/dist/pressable.js +12 -12
- package/dist/reanimated-web.js +6 -6
- package/dist/reanimated.js +6 -6
- package/dist/refresh-control.js +3 -3
- package/dist/safe-area-provider.js +3 -3
- package/dist/safe-area-view.js +3 -3
- package/dist/scroll-view-props.js +3 -3
- package/dist/scroll-view.js +3 -3
- package/dist/section-list.d.ts +4 -4
- package/dist/section-list.js +37 -34
- package/dist/section-list.js.map +1 -1
- package/dist/shortcut.js +3 -3
- package/dist/sidebar-item.js +3 -3
- package/dist/sidebar-section.d.ts +12 -5
- package/dist/sidebar-section.js +32 -12
- package/dist/sidebar-section.js.map +1 -1
- package/dist/sidebar.d.ts +11 -3
- package/dist/sidebar.js +16 -7
- package/dist/sidebar.js.map +1 -1
- package/dist/split-view.js +6 -6
- package/dist/stand-ins/animations.js +3 -3
- package/dist/switch.js +3 -3
- package/dist/template-slot.js +3 -3
- package/dist/text-input.js +3 -3
- package/dist/text.js +3 -3
- package/dist/touchable-opacity.js +3 -3
- package/dist/tray-icon.js +3 -3
- package/dist/view-base.d.ts +18 -2
- package/dist/view-base.js +42 -10
- package/dist/view-base.js.map +1 -1
- package/dist/view.js +3 -3
- package/dist/virtual-list-layout.d.ts +5 -0
- package/dist/virtual-list-layout.js.map +1 -1
- package/dist/virtual-list-num-columns.d.ts +8 -4
- package/dist/virtual-list-num-columns.js +13 -5
- package/dist/virtual-list-num-columns.js.map +1 -1
- package/dist/virtual-list-sticky-level.js +3 -3
- package/dist/virtual-list.d.ts +48 -5
- package/dist/virtual-list.js +206 -46
- package/dist/virtual-list.js.map +1 -1
- package/dist/visual-effect.d.ts +37 -0
- package/dist/visual-effect.js +60 -0
- package/dist/visual-effect.js.map +1 -0
- package/dist/worklet-scroll.js +3 -3
- package/dist/worklet-style.js +3 -3
- package/dist/written-props.js +7 -0
- package/dist/written-props.js.map +1 -1
- package/ios/NgNativeComponents.podspec +2 -2
- package/ios/NgNativeKeyboardFocus.h +21 -0
- package/ios/NgNativeKeyboardFocus.mm +28 -0
- package/ios/NgNativeKeyboardFocusModule.mm +203 -0
- package/ios/NgNativeMenus.mm +20 -0
- package/ios/NgNativePressMenu.h +13 -5
- package/ios/NgNativePressMenu.mm +36 -2
- package/ios/NgNativeViewBinder.h +5 -0
- package/ios/NgNativeViewBinder.mm +31 -4
- package/package.json +6 -6
package/dist/virtual-list.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Component, DestroyRef, Directive, ElementRef, TemplateRef, afterEveryRender, booleanAttribute, computed, contentChild, effect, inject, input, linkedSignal, output, signal, untracked, viewChild, } from '@angular/core';
|
|
2
|
-
import { nativePlatform, } from '@ng-native/fabric';
|
|
2
|
+
import { nativePlatform, nextFrame, } from '@ng-native/fabric';
|
|
3
3
|
import { IN_FORM_SHEET } from '@ng-native/device';
|
|
4
4
|
import { HeightIndex } from "./height-index.js";
|
|
5
5
|
import { dismissKeyboardOnTap } from "./keyboard-taps.js";
|
|
@@ -22,10 +22,10 @@ export class VirtualListSeparator {
|
|
|
22
22
|
static ngTemplateContextGuard(_directive, context) {
|
|
23
23
|
return true;
|
|
24
24
|
}
|
|
25
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
26
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.
|
|
25
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: VirtualListSeparator, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
26
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.3.0", type: VirtualListSeparator, isStandalone: true, selector: "ng-template[virtualListSeparator]", ngImport: i0 });
|
|
27
27
|
}
|
|
28
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
28
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: VirtualListSeparator, decorators: [{
|
|
29
29
|
type: Directive,
|
|
30
30
|
args: [{ selector: 'ng-template[virtualListSeparator]' }]
|
|
31
31
|
}] });
|
|
@@ -55,6 +55,22 @@ const HOLD_TOLERANCE = 0.5;
|
|
|
55
55
|
const FILL_BATCH_MS = 50;
|
|
56
56
|
/** How long without a scroll event counts as the scroll having stopped. */
|
|
57
57
|
const PAUSE_MS = 200;
|
|
58
|
+
/**
|
|
59
|
+
* How long a scroll the app makes waits for the render its handler schedules. Angular starts that
|
|
60
|
+
* from a timer of zero or the next frame, whichever is first, so this one is due after it.
|
|
61
|
+
*/
|
|
62
|
+
const ASKED_MS = 50;
|
|
63
|
+
/**
|
|
64
|
+
* Wait until Android has mounted what was rendered in this task. Its views are queued by the time
|
|
65
|
+
* the first frame's callback runs, and each frame mounts them before it runs any callback, so
|
|
66
|
+
* they are mounted by the second's.
|
|
67
|
+
*/
|
|
68
|
+
const framesToMount = async () => {
|
|
69
|
+
await nextFrame();
|
|
70
|
+
await nextFrame();
|
|
71
|
+
};
|
|
72
|
+
/** No row takes a line to itself but the sticky ones. */
|
|
73
|
+
const noFullLine = () => false;
|
|
58
74
|
/**
|
|
59
75
|
* Windowed list: a native scroll view whose content is sized to the full list, with only the
|
|
60
76
|
* visible slice rendered. Commits as `RCTScrollView`.
|
|
@@ -206,6 +222,8 @@ export class VirtualList extends ScrollViewProps {
|
|
|
206
222
|
* after the list has scrolled away from the end and come back.
|
|
207
223
|
*/
|
|
208
224
|
endReached = output();
|
|
225
|
+
/** The content's size changed: the header, the rows and the footer together, as `<scroll-view>` reports its own. */
|
|
226
|
+
contentSizeChange = output();
|
|
209
227
|
/** Which rows are on screen, and what changed since last time. */
|
|
210
228
|
viewableItemsChanged = output();
|
|
211
229
|
viewport = signal(0, /* @ts-ignore */
|
|
@@ -307,21 +325,25 @@ export class VirtualList extends ScrollViewProps {
|
|
|
307
325
|
const columns = this.columns();
|
|
308
326
|
if (columns === 1)
|
|
309
327
|
return null;
|
|
310
|
-
const
|
|
328
|
+
const items = this.items();
|
|
329
|
+
const count = items.length;
|
|
311
330
|
const sticky = this.sticky.rows();
|
|
331
|
+
const fullLine = this.columnLayout?.fullLineOf?.() ?? noFullLine;
|
|
312
332
|
const of = new Int32Array(count);
|
|
333
|
+
const alone = new Uint8Array(count);
|
|
313
334
|
const starts = [];
|
|
314
335
|
let column = columns;
|
|
315
336
|
for (let i = 0; i < count; i++) {
|
|
316
|
-
const
|
|
317
|
-
if (
|
|
337
|
+
const own = sticky.has(i) || fullLine(items[i], i);
|
|
338
|
+
if (own || column === columns) {
|
|
318
339
|
starts.push(i);
|
|
319
340
|
column = 0;
|
|
320
341
|
}
|
|
321
342
|
of[i] = starts.length - 1;
|
|
322
|
-
|
|
343
|
+
alone[i] = own ? 1 : 0;
|
|
344
|
+
column = own ? columns : column + 1;
|
|
323
345
|
}
|
|
324
|
-
return { of, starts };
|
|
346
|
+
return { of, starts, alone };
|
|
325
347
|
}, /* @ts-ignore */
|
|
326
348
|
...(ngDevMode ? [{ debugName: "lines" }] : /* istanbul ignore next */ []));
|
|
327
349
|
/** The props across each column, built once per change of columns, gap or padding. */
|
|
@@ -336,7 +358,7 @@ export class VirtualList extends ScrollViewProps {
|
|
|
336
358
|
/** An item's insets across the axis: its column's, or the whole width's. */
|
|
337
359
|
acrossOf(index) {
|
|
338
360
|
const lines = this.lines();
|
|
339
|
-
if (!lines ||
|
|
361
|
+
if (!lines || lines.alone[index] === 1)
|
|
340
362
|
return this.across();
|
|
341
363
|
return this.columnAcross()[index - lines.starts[lines.of[index]]];
|
|
342
364
|
}
|
|
@@ -528,6 +550,19 @@ export class VirtualList extends ScrollViewProps {
|
|
|
528
550
|
* rows' own space, after the header, or the very start of the list.
|
|
529
551
|
*/
|
|
530
552
|
pendingScroll = null;
|
|
553
|
+
/**
|
|
554
|
+
* The app's last scroll, kept for the render its handler schedules. Native makes the scroll with
|
|
555
|
+
* the rows it has, and that render may be what gives the list its new ones.
|
|
556
|
+
*/
|
|
557
|
+
asked = null;
|
|
558
|
+
askedTimer;
|
|
559
|
+
/** The rows' extent at the last render, and what native is sure to have mounted of it. */
|
|
560
|
+
renderedExtent = 0;
|
|
561
|
+
mountedExtent = 0;
|
|
562
|
+
/** Counts the times the rows got shorter, after which an earlier render's extent is stale. */
|
|
563
|
+
shortened = 0;
|
|
564
|
+
/** Counts the scrolls sent, so one waiting to be made again gives way to what came after it. */
|
|
565
|
+
scrollsSent = 0;
|
|
531
566
|
/** What moves the rows: which items, and where each one is. */
|
|
532
567
|
placement = computed(() => ({
|
|
533
568
|
items: this.items(),
|
|
@@ -621,6 +656,9 @@ export class VirtualList extends ScrollViewProps {
|
|
|
621
656
|
heldIndex(anchor, items) {
|
|
622
657
|
if (items === anchor.items)
|
|
623
658
|
return anchor.index;
|
|
659
|
+
// Already at the offset the app asked for, which is where it wants the new items seen from.
|
|
660
|
+
if (this.asked?.command === 'scrollTo' && !this.asked.animated)
|
|
661
|
+
return -1;
|
|
624
662
|
const hold = this.maintainVisibleContentPosition();
|
|
625
663
|
if (!hold)
|
|
626
664
|
return -1;
|
|
@@ -658,16 +696,54 @@ export class VirtualList extends ScrollViewProps {
|
|
|
658
696
|
}
|
|
659
697
|
return -1;
|
|
660
698
|
}
|
|
661
|
-
/**
|
|
699
|
+
/**
|
|
700
|
+
* Make a queued correction, after the commit that moved the rows has gone to native, and then
|
|
701
|
+
* the app's scroll again when the correction would undo it, or when it was to past the end the
|
|
702
|
+
* new items have. A jump takes the correction's place; an animation starts from it.
|
|
703
|
+
*/
|
|
662
704
|
flushScroll() {
|
|
663
705
|
const pending = this.pendingScroll;
|
|
664
|
-
|
|
706
|
+
const asked = this.asked;
|
|
707
|
+
if (!pending && !asked)
|
|
665
708
|
return;
|
|
666
709
|
this.pendingScroll = null;
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
710
|
+
this.forgetAsked();
|
|
711
|
+
if (pending && (!asked || asked.animated)) {
|
|
712
|
+
// A jump when the app's animation follows, which would replace one to the start.
|
|
713
|
+
if (pending === 'start')
|
|
714
|
+
this.sendScrollTo(0, !asked);
|
|
715
|
+
else
|
|
716
|
+
this.sendScrollTo(this.headerHeight() + pending.offset, false);
|
|
717
|
+
}
|
|
718
|
+
if (asked && (pending || this.endsBefore(asked)))
|
|
719
|
+
asked.send();
|
|
720
|
+
}
|
|
721
|
+
/** Whether the items given since a scroll end before where it was going. */
|
|
722
|
+
endsBefore({ items, landing }) {
|
|
723
|
+
const end = Math.max(0, this.extent() - this.viewport());
|
|
724
|
+
return items !== this.items() && landing > end + HOLD_TOLERANCE;
|
|
725
|
+
}
|
|
726
|
+
/**
|
|
727
|
+
* Keep a scroll the app made, to `offset`, for the next render. A jump is there already, so the
|
|
728
|
+
* list is too. An animation has yet to leave: the rows stay those on screen, and follow it.
|
|
729
|
+
*/
|
|
730
|
+
ask(scroll, offset) {
|
|
731
|
+
this.forgetAsked();
|
|
732
|
+
// Nothing is corrected before the first layout, and native may have no view to scroll.
|
|
733
|
+
if (this.viewport() <= 0)
|
|
734
|
+
return;
|
|
735
|
+
// Only its end stops it: an inset before the rows puts native above zero.
|
|
736
|
+
const landing = Math.min(offset, this.reachable(offset)) - this.headerHeight();
|
|
737
|
+
this.asked = { ...scroll, landing, items: this.items() };
|
|
738
|
+
this.askedTimer = setTimeout(() => this.forgetAsked(), ASKED_MS);
|
|
739
|
+
if (scroll.animated)
|
|
740
|
+
return;
|
|
741
|
+
this.lastOffset = landing;
|
|
742
|
+
this.anchorAt(this.indexAt(landing), landing);
|
|
743
|
+
}
|
|
744
|
+
forgetAsked() {
|
|
745
|
+
clearTimeout(this.askedTimer);
|
|
746
|
+
this.asked = null;
|
|
671
747
|
}
|
|
672
748
|
/** In development, a list with rows that stays at zero size; see `ZeroSizeWarning`. */
|
|
673
749
|
zeroSize = checksZeroSize()
|
|
@@ -677,6 +753,7 @@ export class VirtualList extends ScrollViewProps {
|
|
|
677
753
|
super();
|
|
678
754
|
afterEveryRender(() => {
|
|
679
755
|
this.flushScroll();
|
|
756
|
+
this.trackMounted();
|
|
680
757
|
if (this.sticky.native)
|
|
681
758
|
this.driveStickyRows();
|
|
682
759
|
this.recheckItems();
|
|
@@ -692,6 +769,8 @@ export class VirtualList extends ScrollViewProps {
|
|
|
692
769
|
this.sticky.destroy();
|
|
693
770
|
clearTimeout(this.fillTimer);
|
|
694
771
|
clearTimeout(this.speedTimer);
|
|
772
|
+
this.forgetAsked();
|
|
773
|
+
this.scrollsSent++;
|
|
695
774
|
this.zeroSize?.stop();
|
|
696
775
|
});
|
|
697
776
|
if (this.zeroSize)
|
|
@@ -1194,31 +1273,104 @@ export class VirtualList extends ScrollViewProps {
|
|
|
1194
1273
|
* there at once, and the row is held there while the rows around it are measured.
|
|
1195
1274
|
*/
|
|
1196
1275
|
scrollToIndex(options) {
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1276
|
+
// Untracked, as are the other scrolls: they read the list's state and write what it depends on,
|
|
1277
|
+
// so an effect that called one would depend on that too, and run again without end.
|
|
1278
|
+
untracked(() => {
|
|
1279
|
+
const items = this.items();
|
|
1280
|
+
if (!items.length)
|
|
1281
|
+
return;
|
|
1282
|
+
const index = Math.max(0, Math.min(options.index, items.length - 1));
|
|
1283
|
+
const within = -(options.viewOffset ?? 0);
|
|
1284
|
+
const offset = this.topOf(index) + within;
|
|
1285
|
+
this.lastOffset = offset;
|
|
1286
|
+
this.anchor = { key: this.keyAt(index), within, items, index };
|
|
1287
|
+
this.jumpTo(index);
|
|
1288
|
+
// The start of its line, which is what a scroll event there gives, so the fill keeps its way.
|
|
1289
|
+
this.moveTo(this.lineStart(this.lineOf(index)));
|
|
1290
|
+
// The list is at the row already, so the new items are placed from there.
|
|
1291
|
+
this.forgetAsked();
|
|
1292
|
+
this.sendScrollTo(this.headerHeight() + offset, options.animated ?? true);
|
|
1293
|
+
});
|
|
1209
1294
|
}
|
|
1210
1295
|
/** Scroll to an offset along the list's own axis: x when it is horizontal, y otherwise. */
|
|
1211
1296
|
scrollToOffset(options) {
|
|
1212
1297
|
const { offset, animated = true } = options;
|
|
1298
|
+
const send = () => this.sendScrollTo(offset, animated);
|
|
1299
|
+
untracked(() => {
|
|
1300
|
+
send();
|
|
1301
|
+
this.ask({ command: 'scrollTo', animated, send }, offset);
|
|
1302
|
+
});
|
|
1303
|
+
}
|
|
1304
|
+
scrollToEnd(options = {}) {
|
|
1305
|
+
const animated = options.animated ?? true;
|
|
1306
|
+
const send = () => this.sendScrollToEnd(animated);
|
|
1307
|
+
untracked(() => {
|
|
1308
|
+
send();
|
|
1309
|
+
this.ask({ command: 'scrollToEnd', animated, send }, Infinity);
|
|
1310
|
+
});
|
|
1311
|
+
}
|
|
1312
|
+
sendScrollTo(offset, animated) {
|
|
1213
1313
|
this.jumpTo(this.indexAt(offset - this.headerHeight()));
|
|
1214
1314
|
const [x, y] = this.horizontal() ? [offset, 0] : [0, offset];
|
|
1215
1315
|
this.sticky.jumping(this.reachable(offset), animated);
|
|
1216
|
-
this
|
|
1316
|
+
// In place of a correction queued in this render, which would undo it once that is done.
|
|
1317
|
+
this.pendingScroll = null;
|
|
1318
|
+
// An animation is sent to the offset itself, and stopped by what is mounted as it runs.
|
|
1319
|
+
const short = !animated && this.stopsShort(offset, this.viewport());
|
|
1320
|
+
this.dispatchScroll('scrollTo', [x, y, animated], short);
|
|
1217
1321
|
}
|
|
1218
|
-
|
|
1219
|
-
this.sticky.jumping(this.reachable(Infinity),
|
|
1322
|
+
sendScrollToEnd(animated) {
|
|
1323
|
+
this.sticky.jumping(this.reachable(Infinity), animated);
|
|
1220
1324
|
this.jumpTo(this.items().length - 1);
|
|
1221
|
-
this.
|
|
1325
|
+
this.pendingScroll = null;
|
|
1326
|
+
// An animation is sent to the bottom of the rows, a viewport past where a jump stops.
|
|
1327
|
+
const short = this.stopsShort(Infinity, animated ? 0 : this.viewport());
|
|
1328
|
+
this.dispatchScroll('scrollToEnd', [animated], short);
|
|
1329
|
+
}
|
|
1330
|
+
/** Send a scroll, and again once the rows are mounted if it stops short without them. */
|
|
1331
|
+
dispatchScroll(command, args, short) {
|
|
1332
|
+
this.engine.dispatchCommand(this.node, command, args);
|
|
1333
|
+
const scroll = ++this.scrollsSent;
|
|
1334
|
+
if (!short)
|
|
1335
|
+
return;
|
|
1336
|
+
void framesToMount().then(() => {
|
|
1337
|
+
if (scroll !== this.scrollsSent)
|
|
1338
|
+
return;
|
|
1339
|
+
// Nor is the scroll that reports this one a fling.
|
|
1340
|
+
this.stopSpeed();
|
|
1341
|
+
this.engine.dispatchCommand(this.node, command, args);
|
|
1342
|
+
});
|
|
1343
|
+
}
|
|
1344
|
+
/**
|
|
1345
|
+
* Whether native may stop a scroll to `offset` short, `before` the bottom of the rows it has
|
|
1346
|
+
* mounted. Android runs the commands it has waiting before it mounts the views it has waiting,
|
|
1347
|
+
* so one sent after a render can run on the rows before it. iOS keeps them in order.
|
|
1348
|
+
*/
|
|
1349
|
+
stopsShort(offset, before) {
|
|
1350
|
+
const extent = this.extent();
|
|
1351
|
+
const viewport = this.viewport();
|
|
1352
|
+
if (nativePlatform() !== 'android' || viewport <= 0)
|
|
1353
|
+
return false;
|
|
1354
|
+
const header = this.headerHeight();
|
|
1355
|
+
const end = Math.min(offset, header + extent - viewport);
|
|
1356
|
+
return end > Math.max(0, header + this.mountedExtent - before) + HOLD_TOLERANCE;
|
|
1357
|
+
}
|
|
1358
|
+
/** Follow what native has mounted: less at once, and more once the frames for it have run. */
|
|
1359
|
+
trackMounted() {
|
|
1360
|
+
if (nativePlatform() !== 'android')
|
|
1361
|
+
return;
|
|
1362
|
+
const extent = this.extent();
|
|
1363
|
+
if (extent === this.renderedExtent)
|
|
1364
|
+
return;
|
|
1365
|
+
if (extent < this.renderedExtent)
|
|
1366
|
+
this.shortened++;
|
|
1367
|
+
this.renderedExtent = extent;
|
|
1368
|
+
this.mountedExtent = Math.min(this.mountedExtent, extent);
|
|
1369
|
+
const shortened = this.shortened;
|
|
1370
|
+
void framesToMount().then(() => {
|
|
1371
|
+
if (shortened === this.shortened)
|
|
1372
|
+
this.mountedExtent = extent;
|
|
1373
|
+
});
|
|
1222
1374
|
}
|
|
1223
1375
|
slotStyle(index) {
|
|
1224
1376
|
const start = this.topOf(index);
|
|
@@ -1410,13 +1562,20 @@ export class VirtualList extends ScrollViewProps {
|
|
|
1410
1562
|
const hold = this.maintainVisibleContentPosition();
|
|
1411
1563
|
if (!hold || this.lastOffset <= (hold.autoscrollToTopThreshold ?? 0))
|
|
1412
1564
|
return false;
|
|
1413
|
-
this.
|
|
1565
|
+
this.sendScrollTo(this.headerHeight() + this.lastOffset, false);
|
|
1414
1566
|
return true;
|
|
1415
1567
|
}
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1568
|
+
/**
|
|
1569
|
+
* The content view was laid out: its size is the scroll view's content size, footer and all, as
|
|
1570
|
+
* ScrollView.js reads it. Native sends a scroll view no `contentSizeChange` of its own.
|
|
1571
|
+
*/
|
|
1572
|
+
onContentLayout(event) {
|
|
1573
|
+
const layout = event.nativeEvent?.layout;
|
|
1574
|
+
if (!layout)
|
|
1575
|
+
return;
|
|
1576
|
+
this.contentSize = this.horizontal() ? layout.width : layout.height;
|
|
1419
1577
|
this.contentSizeFor = this.headerHeight() + this.extent();
|
|
1578
|
+
this.contentSizeChange.emit({ width: layout.width, height: layout.height });
|
|
1420
1579
|
this.checkEnd(this.headerHeight() + this.lastOffset);
|
|
1421
1580
|
}
|
|
1422
1581
|
/** The scroll view's content along the axis, header and all. */
|
|
@@ -1427,6 +1586,8 @@ export class VirtualList extends ScrollViewProps {
|
|
|
1427
1586
|
}
|
|
1428
1587
|
/** The user took the scroll over: native's own events move the rows from here. */
|
|
1429
1588
|
onDragBegin() {
|
|
1589
|
+
this.forgetAsked();
|
|
1590
|
+
this.scrollsSent++;
|
|
1430
1591
|
this.sticky.dragged();
|
|
1431
1592
|
}
|
|
1432
1593
|
/** A scroll came to rest: see `StickyRows.rested`. */
|
|
@@ -1463,10 +1624,10 @@ export class VirtualList extends ScrollViewProps {
|
|
|
1463
1624
|
this.endReachedFor = count;
|
|
1464
1625
|
this.endReached.emit({ distanceFromEnd });
|
|
1465
1626
|
}
|
|
1466
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
1467
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.
|
|
1627
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: VirtualList, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1628
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.3.0", type: VirtualList, isStandalone: true, selector: "virtual-list", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: true, transformFunction: null }, itemHeight: { classPropertyName: "itemHeight", publicName: "itemHeight", isSignal: true, isRequired: false, transformFunction: null }, estimatedItemHeight: { classPropertyName: "estimatedItemHeight", publicName: "estimatedItemHeight", isSignal: true, isRequired: false, transformFunction: null }, contentPadding: { classPropertyName: "contentPadding", publicName: "contentPadding", isSignal: true, isRequired: false, transformFunction: null }, rowGap: { classPropertyName: "rowGap", publicName: "rowGap", isSignal: true, isRequired: false, transformFunction: null }, keyExtractor: { classPropertyName: "keyExtractor", publicName: "keyExtractor", isSignal: true, isRequired: false, transformFunction: null }, itemType: { classPropertyName: "itemType", publicName: "itemType", isSignal: true, isRequired: false, transformFunction: null }, maintainVisibleContentPosition: { classPropertyName: "maintainVisibleContentPosition", publicName: "maintainVisibleContentPosition", isSignal: true, isRequired: false, transformFunction: null }, overscan: { classPropertyName: "overscan", publicName: "overscan", isSignal: true, isRequired: false, transformFunction: null }, windowSize: { classPropertyName: "windowSize", publicName: "windowSize", isSignal: true, isRequired: false, transformFunction: null }, velocityLead: { classPropertyName: "velocityLead", publicName: "velocityLead", isSignal: true, isRequired: false, transformFunction: null }, endReachedThreshold: { classPropertyName: "endReachedThreshold", publicName: "endReachedThreshold", isSignal: true, isRequired: false, transformFunction: null }, horizontal: { classPropertyName: "horizontal", publicName: "horizontal", isSignal: true, isRequired: false, transformFunction: null }, inverted: { classPropertyName: "inverted", publicName: "inverted", isSignal: true, isRequired: false, transformFunction: null }, stickyIndices: { classPropertyName: "stickyIndices", publicName: "stickyIndices", isSignal: true, isRequired: false, transformFunction: null }, stickyHeader: { classPropertyName: "stickyHeader", publicName: "stickyHeader", isSignal: true, isRequired: false, transformFunction: null }, keyboardShouldPersistTaps: { classPropertyName: "keyboardShouldPersistTaps", publicName: "keyboardShouldPersistTaps", isSignal: true, isRequired: false, transformFunction: null }, itemVisiblePercentThreshold: { classPropertyName: "itemVisiblePercentThreshold", publicName: "itemVisiblePercentThreshold", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { endReached: "endReached", contentSizeChange: "contentSizeChange", viewableItemsChanged: "viewableItemsChanged" }, host: { listeners: { "scrollBeginDrag": "onDragBegin()", "momentumScrollEnd": "onScrollEnd()", "layout": "onLayout($event)" }, properties: { "flexDirection": "horizontal() ? 'row' : 'column'", "horizontal": "horizontal()", "nestedScrollEnabled": "nestedScroll()", "transform": "flip()", "scrollEventThrottle": "scrollEventThrottle()" } }, queries: [{ propertyName: "separator", first: true, predicate: VirtualListSeparator, descendants: true, isSignal: true }, { propertyName: "refreshControl", first: true, predicate: RefreshControl, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "canvasView", first: true, predicate: ["rows"], descendants: true, read: ElementRef, isSignal: true }, { propertyName: "headerView", first: true, predicate: ["header"], descendants: true, read: ElementRef, isSignal: true }], exportAs: ["virtualList"], usesInheritance: true, ngImport: i0, template: `
|
|
1468
1629
|
<ng-content select="refresh-control" />
|
|
1469
|
-
<view [style]="content()" collapsable="false">
|
|
1630
|
+
<view [style]="content()" collapsable="false" (layout)="onContentLayout($event)">
|
|
1470
1631
|
<view #header [style]="headerStyle()" (layout)="onHeaderLayout($event)"
|
|
1471
1632
|
><ng-content select="[listHeader]"
|
|
1472
1633
|
/></view>
|
|
@@ -1489,7 +1650,7 @@ export class VirtualList extends ScrollViewProps {
|
|
|
1489
1650
|
</view>
|
|
1490
1651
|
`, isInline: true, dependencies: [{ kind: "directive", type: TemplateSlot, selector: "[templateSlot]", inputs: ["templateSlot", "templateSlotContext"] }, { kind: "directive", type: View, selector: "view" }] });
|
|
1491
1652
|
}
|
|
1492
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
1653
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: VirtualList, decorators: [{
|
|
1493
1654
|
type: Component,
|
|
1494
1655
|
args: [{
|
|
1495
1656
|
selector: 'virtual-list',
|
|
@@ -1504,7 +1665,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.0", ngImpor
|
|
|
1504
1665
|
// A refresh control comes first, as the scroll view's own child; see ScrollView.
|
|
1505
1666
|
template: `
|
|
1506
1667
|
<ng-content select="refresh-control" />
|
|
1507
|
-
<view [style]="content()" collapsable="false">
|
|
1668
|
+
<view [style]="content()" collapsable="false" (layout)="onContentLayout($event)">
|
|
1508
1669
|
<view #header [style]="headerStyle()" (layout)="onHeaderLayout($event)"
|
|
1509
1670
|
><ng-content select="[listHeader]"
|
|
1510
1671
|
/></view>
|
|
@@ -1541,10 +1702,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.0", ngImpor
|
|
|
1541
1702
|
'(scrollBeginDrag)': 'onDragBegin()',
|
|
1542
1703
|
'(momentumScrollEnd)': 'onScrollEnd()',
|
|
1543
1704
|
'(layout)': 'onLayout($event)',
|
|
1544
|
-
'(contentSizeChange)': 'onContentSize($event)',
|
|
1545
1705
|
},
|
|
1546
1706
|
}]
|
|
1547
|
-
}], ctorParameters: () => [], propDecorators: { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: true }] }], itemHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemHeight", required: false }] }], estimatedItemHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "estimatedItemHeight", required: false }] }], contentPadding: [{ type: i0.Input, args: [{ isSignal: true, alias: "contentPadding", required: false }] }], rowGap: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowGap", required: false }] }], keyExtractor: [{ type: i0.Input, args: [{ isSignal: true, alias: "keyExtractor", required: false }] }], itemType: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemType", required: false }] }], maintainVisibleContentPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "maintainVisibleContentPosition", required: false }] }], overscan: [{ type: i0.Input, args: [{ isSignal: true, alias: "overscan", required: false }] }], windowSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "windowSize", required: false }] }], velocityLead: [{ type: i0.Input, args: [{ isSignal: true, alias: "velocityLead", required: false }] }], endReachedThreshold: [{ type: i0.Input, args: [{ isSignal: true, alias: "endReachedThreshold", required: false }] }], horizontal: [{ type: i0.Input, args: [{ isSignal: true, alias: "horizontal", required: false }] }], inverted: [{ type: i0.Input, args: [{ isSignal: true, alias: "inverted", required: false }] }], stickyIndices: [{ type: i0.Input, args: [{ isSignal: true, alias: "stickyIndices", required: false }] }], stickyHeader: [{ type: i0.Input, args: [{ isSignal: true, alias: "stickyHeader", required: false }] }], keyboardShouldPersistTaps: [{ type: i0.Input, args: [{ isSignal: true, alias: "keyboardShouldPersistTaps", required: false }] }], itemVisiblePercentThreshold: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemVisiblePercentThreshold", required: false }] }], endReached: [{ type: i0.Output, args: ["endReached"] }], viewableItemsChanged: [{ type: i0.Output, args: ["viewableItemsChanged"] }], separator: [{ type: i0.ContentChild, args: [i0.forwardRef(() => VirtualListSeparator), { isSignal: true }] }], refreshControl: [{ type: i0.ContentChild, args: [i0.forwardRef(() => RefreshControl), { isSignal: true }] }], canvasView: [{ type: i0.ViewChild, args: ['rows', { ...{ read: ElementRef }, isSignal: true }] }], headerView: [{ type: i0.ViewChild, args: ['header', { ...{ read: ElementRef }, isSignal: true }] }] } });
|
|
1707
|
+
}], ctorParameters: () => [], propDecorators: { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: true }] }], itemHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemHeight", required: false }] }], estimatedItemHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "estimatedItemHeight", required: false }] }], contentPadding: [{ type: i0.Input, args: [{ isSignal: true, alias: "contentPadding", required: false }] }], rowGap: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowGap", required: false }] }], keyExtractor: [{ type: i0.Input, args: [{ isSignal: true, alias: "keyExtractor", required: false }] }], itemType: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemType", required: false }] }], maintainVisibleContentPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "maintainVisibleContentPosition", required: false }] }], overscan: [{ type: i0.Input, args: [{ isSignal: true, alias: "overscan", required: false }] }], windowSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "windowSize", required: false }] }], velocityLead: [{ type: i0.Input, args: [{ isSignal: true, alias: "velocityLead", required: false }] }], endReachedThreshold: [{ type: i0.Input, args: [{ isSignal: true, alias: "endReachedThreshold", required: false }] }], horizontal: [{ type: i0.Input, args: [{ isSignal: true, alias: "horizontal", required: false }] }], inverted: [{ type: i0.Input, args: [{ isSignal: true, alias: "inverted", required: false }] }], stickyIndices: [{ type: i0.Input, args: [{ isSignal: true, alias: "stickyIndices", required: false }] }], stickyHeader: [{ type: i0.Input, args: [{ isSignal: true, alias: "stickyHeader", required: false }] }], keyboardShouldPersistTaps: [{ type: i0.Input, args: [{ isSignal: true, alias: "keyboardShouldPersistTaps", required: false }] }], itemVisiblePercentThreshold: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemVisiblePercentThreshold", required: false }] }], endReached: [{ type: i0.Output, args: ["endReached"] }], contentSizeChange: [{ type: i0.Output, args: ["contentSizeChange"] }], viewableItemsChanged: [{ type: i0.Output, args: ["viewableItemsChanged"] }], separator: [{ type: i0.ContentChild, args: [i0.forwardRef(() => VirtualListSeparator), { isSignal: true }] }], refreshControl: [{ type: i0.ContentChild, args: [i0.forwardRef(() => RefreshControl), { isSignal: true }] }], canvasView: [{ type: i0.ViewChild, args: ['rows', { ...{ read: ElementRef }, isSignal: true }] }], headerView: [{ type: i0.ViewChild, args: ['header', { ...{ read: ElementRef }, isSignal: true }] }] } });
|
|
1548
1708
|
/** Whether a cached slot style already has every one of these props. */
|
|
1549
1709
|
function holds(style, props) {
|
|
1550
1710
|
return Object.entries(props).every(([prop, value]) => style[prop] === value);
|
|
@@ -1570,10 +1730,10 @@ export class VirtualListRow {
|
|
|
1570
1730
|
this.layout = event.nativeEvent?.layout ?? this.layout;
|
|
1571
1731
|
this.list.measureRow(this.row(), event.nativeEvent?.layout);
|
|
1572
1732
|
}
|
|
1573
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
1574
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.
|
|
1733
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: VirtualListRow, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1734
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.3.0", type: VirtualListRow, isStandalone: true, selector: "[virtualListRow]", inputs: { row: { classPropertyName: "row", publicName: "virtualListRow", isSignal: true, isRequired: true, transformFunction: null } }, host: { listeners: { "layout": "onLayout($event)" }, properties: { "style": "row().style", "attr.aria-hidden": "row().parked ? true : null" } }, ngImport: i0 });
|
|
1575
1735
|
}
|
|
1576
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
1736
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: VirtualListRow, decorators: [{
|
|
1577
1737
|
type: Directive,
|
|
1578
1738
|
args: [{
|
|
1579
1739
|
selector: '[virtualListRow]',
|