@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-list-layout.js","sourceRoot":"","sources":["../src/virtual-list-layout.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,cAAc,EAAe,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"virtual-list-layout.js","sourceRoot":"","sources":["../src/virtual-list-layout.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,cAAc,EAAe,MAAM,eAAe,CAAC;AAmB5D,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,cAAc,CACnD,kCAAkC,CACnC,CAAC","sourcesContent":["/**\n * How `<virtual-list>` lays items out across its width, when a directive on the list says so.\n *\n * The list places items along its axis and windows them; how many share a line and where each\n * sits across it is a separate decision, and a list that never makes it carries none of its code.\n * A directive on the list's own element provides this, as `[contextMenu]` provides `CONTEXT_MENU`\n * to `<pressable>`, and the list reads it with `{ self: true, optional: true }`.\n */\nimport { InjectionToken, type Signal } from '@angular/core';\n\nexport interface VirtualListLayout {\n /** How many items go on a line. One is a plain list. */\n readonly columns: Signal<number>;\n /**\n * The props that place the item in `column` across a line, given the list's own insets on its\n * left and right. Column 0 is at the start of the line, so the props are logical sides, which\n * layout resolves by direction as React Native resolves the list's own left and right. Every\n * column's props name the same keys, so moving between columns overwrites them all.\n */\n across(column: number, left: number, right: number): Record<string, unknown>;\n /**\n * What says a row takes a line to itself, as a sticky row does, such as a section's header or\n * footer across a grid of its items, or null when nothing does.\n */\n readonly fullLineOf?: Signal<((item: unknown, index: number) => boolean) | null>;\n}\n\nexport const VIRTUAL_LIST_LAYOUT = new InjectionToken<VirtualListLayout>(\n 'angular-native.virtualListLayout',\n);\n"]}
|
|
@@ -17,7 +17,8 @@ import * as i0 from "@angular/core";
|
|
|
17
17
|
* is the same as a plain list's. Items fill a line left to right, right to left in a
|
|
18
18
|
* right-to-left layout, and every column is the same width. A line is as tall as its tallest item,
|
|
19
19
|
* and its items stretch to it, as they do in FlatList's row. A sticky row takes a line to itself,
|
|
20
|
-
* so a month's header pins across the whole grid.
|
|
20
|
+
* so a month's header pins across the whole grid. A row `virtualListFullLine` picks takes one too,
|
|
21
|
+
* such as a section's header that scrolls with the rest.
|
|
21
22
|
*
|
|
22
23
|
* Columns are for vertical lists with `itemHeight`, as FlatList's `numColumns` is vertical only.
|
|
23
24
|
*
|
|
@@ -27,13 +28,16 @@ import * as i0 from "@angular/core";
|
|
|
27
28
|
* last line's, with the next line's first item as its `trailingItem`, where FlatList draws one a
|
|
28
29
|
* line.
|
|
29
30
|
*/
|
|
30
|
-
export declare class VirtualListNumColumns implements VirtualListLayout {
|
|
31
|
+
export declare class VirtualListNumColumns<T = unknown> implements VirtualListLayout {
|
|
31
32
|
/** Items to a line, as FlatList's `numColumns`. */
|
|
32
33
|
readonly numColumns: import("@angular/core").InputSignalWithTransform<number, unknown>;
|
|
33
34
|
/** Space between one column and the next. `rowGap` on the list spaces the lines. */
|
|
34
35
|
readonly columnGap: import("@angular/core").InputSignalWithTransform<number, unknown>;
|
|
36
|
+
/** Whether a row takes a line to itself, given each item and its index. */
|
|
37
|
+
readonly fullLine: import("@angular/core").InputSignal<((item: T, index: number) => boolean) | null | undefined>;
|
|
35
38
|
private readonly injector;
|
|
36
39
|
readonly columns: import("@angular/core").Signal<number>;
|
|
40
|
+
readonly fullLineOf: import("@angular/core").Signal<((item: unknown, index: number) => boolean) | null>;
|
|
37
41
|
constructor();
|
|
38
42
|
/**
|
|
39
43
|
* Each column is an equal share of the width, as a percentage, so the line needs no width to
|
|
@@ -42,6 +46,6 @@ export declare class VirtualListNumColumns implements VirtualListLayout {
|
|
|
42
46
|
* puts the gaps between the columns rather than inside them.
|
|
43
47
|
*/
|
|
44
48
|
across(column: number, left: number, right: number): Record<string, unknown>;
|
|
45
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<VirtualListNumColumns
|
|
46
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<VirtualListNumColumns
|
|
49
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<VirtualListNumColumns<any>, never>;
|
|
50
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<VirtualListNumColumns<any>, "virtual-list[virtualListNumColumns]", never, { "numColumns": { "alias": "virtualListNumColumns"; "required": false; "isSignal": true; }; "columnGap": { "alias": "virtualListColumnGap"; "required": false; "isSignal": true; }; "fullLine": { "alias": "virtualListFullLine"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
47
51
|
}
|
|
@@ -20,7 +20,8 @@ import * as i0 from "@angular/core";
|
|
|
20
20
|
* is the same as a plain list's. Items fill a line left to right, right to left in a
|
|
21
21
|
* right-to-left layout, and every column is the same width. A line is as tall as its tallest item,
|
|
22
22
|
* and its items stretch to it, as they do in FlatList's row. A sticky row takes a line to itself,
|
|
23
|
-
* so a month's header pins across the whole grid.
|
|
23
|
+
* so a month's header pins across the whole grid. A row `virtualListFullLine` picks takes one too,
|
|
24
|
+
* such as a section's header that scrolls with the rest.
|
|
24
25
|
*
|
|
25
26
|
* Columns are for vertical lists with `itemHeight`, as FlatList's `numColumns` is vertical only.
|
|
26
27
|
*
|
|
@@ -35,6 +36,8 @@ export class VirtualListNumColumns {
|
|
|
35
36
|
numColumns = input(1, { ...(ngDevMode ? { debugName: "numColumns" } : /* istanbul ignore next */ {}), alias: 'virtualListNumColumns', transform: numberOr(1) });
|
|
36
37
|
/** Space between one column and the next. `rowGap` on the list spaces the lines. */
|
|
37
38
|
columnGap = input(0, { ...(ngDevMode ? { debugName: "columnGap" } : /* istanbul ignore next */ {}), alias: 'virtualListColumnGap', transform: numberOr(0) });
|
|
39
|
+
/** Whether a row takes a line to itself, given each item and its index. */
|
|
40
|
+
fullLine = input(undefined, { ...(ngDevMode ? { debugName: "fullLine" } : /* istanbul ignore next */ {}), alias: 'virtualListFullLine' });
|
|
38
41
|
// Looked up once the list exists: the list injects this directive while it is being made.
|
|
39
42
|
injector = inject(Injector);
|
|
40
43
|
columns = computed(() => {
|
|
@@ -42,6 +45,11 @@ export class VirtualListNumColumns {
|
|
|
42
45
|
return Number.isFinite(columns) ? Math.max(1, Math.floor(columns)) : 1;
|
|
43
46
|
}, /* @ts-ignore */
|
|
44
47
|
...(ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []));
|
|
48
|
+
fullLineOf = computed(() => {
|
|
49
|
+
const fullLine = this.fullLine();
|
|
50
|
+
return fullLine ? (item, index) => fullLine(item, index) : null;
|
|
51
|
+
}, /* @ts-ignore */
|
|
52
|
+
...(ngDevMode ? [{ debugName: "fullLineOf" }] : /* istanbul ignore next */ []));
|
|
45
53
|
constructor() {
|
|
46
54
|
if (typeof ngDevMode === 'undefined' || !ngDevMode)
|
|
47
55
|
return;
|
|
@@ -80,12 +88,12 @@ export class VirtualListNumColumns {
|
|
|
80
88
|
marginEnd: spare - marginStart,
|
|
81
89
|
};
|
|
82
90
|
}
|
|
83
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
84
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.
|
|
91
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: VirtualListNumColumns, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
92
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.3.0", type: VirtualListNumColumns, isStandalone: true, selector: "virtual-list[virtualListNumColumns]", inputs: { numColumns: { classPropertyName: "numColumns", publicName: "virtualListNumColumns", isSignal: true, isRequired: false, transformFunction: null }, columnGap: { classPropertyName: "columnGap", publicName: "virtualListColumnGap", isSignal: true, isRequired: false, transformFunction: null }, fullLine: { classPropertyName: "fullLine", publicName: "virtualListFullLine", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
85
93
|
{ provide: VIRTUAL_LIST_LAYOUT, useExisting: forwardRef(() => VirtualListNumColumns) },
|
|
86
94
|
], ngImport: i0 });
|
|
87
95
|
}
|
|
88
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
96
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: VirtualListNumColumns, decorators: [{
|
|
89
97
|
type: Directive,
|
|
90
98
|
args: [{
|
|
91
99
|
selector: 'virtual-list[virtualListNumColumns]',
|
|
@@ -93,5 +101,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.0", ngImpor
|
|
|
93
101
|
{ provide: VIRTUAL_LIST_LAYOUT, useExisting: forwardRef(() => VirtualListNumColumns) },
|
|
94
102
|
],
|
|
95
103
|
}]
|
|
96
|
-
}], ctorParameters: () => [], propDecorators: { numColumns: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualListNumColumns", required: false }] }], columnGap: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualListColumnGap", required: false }] }] } });
|
|
104
|
+
}], ctorParameters: () => [], propDecorators: { numColumns: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualListNumColumns", required: false }] }], columnGap: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualListColumnGap", required: false }] }], fullLine: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualListFullLine", required: false }] }] } });
|
|
97
105
|
//# sourceMappingURL=virtual-list-num-columns.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-list-num-columns.js","sourceRoot":"","sources":["../src/virtual-list-num-columns.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACjG,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAA0B,MAAM,0BAA0B,CAAC;;AAEvF
|
|
1
|
+
{"version":3,"file":"virtual-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AK,GAAG,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC;QACrE,OAAO;YACL,KAAK,EAAE,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,GAAG,OAAO,GAAG;YACrC,GAAG,EAAE,GAAG,CAAC,CAAC,OAAO,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,GAAG,CAAC,GAAG,OAAO,GAAG;YACnD,WAAW;YACX,SAAS,EAAE,KAAK,GAAG,WAAW;SAC/B,CAAC;IACJ,CAAC;uGA3DU,qBAAqB;2FAArB,qBAAqB,2gBAJrB;YACT,EAAE,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,qBAAqB,CAAC,EAAE;SACvF;;2FAEU,qBAAqB;kBANjC,SAAS;mBAAC;oBACT,QAAQ,EAAE,qCAAqC;oBAC/C,SAAS,EAAE;wBACT,EAAE,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,sBAAsB,CAAC,EAAE;qBACvF;iBACF","sourcesContent":["import { Directive, Injector, computed, effect, forwardRef, inject, input } from '@angular/core';\nimport { numberOr } from './transforms.ts';\nimport { VirtualList } from './virtual-list.ts';\nimport { VIRTUAL_LIST_LAYOUT, type VirtualListLayout } from './virtual-list-layout.ts';\n\n/**\n * FlatList's `numColumns`, on `<virtual-list>` itself: a photo grid or a shop's products, windowed\n * a line at a time.\n *\n * ```html\n * <virtual-list #list [items]=\"photos\" [itemHeight]=\"120\" [rowGap]=\"2\"\n * [virtualListNumColumns]=\"3\" [virtualListColumnGap]=\"2\">\n * @for (row of list.window(); track row.slot) {\n * <image [virtualListRow]=\"row\" [source]=\"row.item.uri\" />\n * }\n * </virtual-list>\n * ```\n *\n * Each item is still one row of the window, with its own slot, key and recycling, so the `@for`\n * is the same as a plain list's. Items fill a line left to right, right to left in a\n * right-to-left layout, and every column is the same width. A line is as tall as its tallest item,\n * and its items stretch to it, as they do in FlatList's row. A sticky row takes a line to itself,\n * so a month's header pins across the whole grid. A row `virtualListFullLine` picks takes one too,\n * such as a section's header that scrolls with the rest.\n *\n * Columns are for vertical lists with `itemHeight`, as FlatList's `numColumns` is vertical only.\n *\n * ponytail: rows that size themselves stay one to a line, with a warning in development, since a\n * line's height would wait on every item in it measuring. FlatList's `columnWrapperStyle` has no\n * equivalent: there is no view per line to style. A separator is drawn under each item but the\n * last line's, with the next line's first item as its `trailingItem`, where FlatList draws one a\n * line.\n */\n@Directive({\n selector: 'virtual-list[virtualListNumColumns]',\n providers: [\n { provide: VIRTUAL_LIST_LAYOUT, useExisting: forwardRef(() => VirtualListNumColumns) },\n ],\n})\nexport class VirtualListNumColumns<T = unknown> implements VirtualListLayout {\n /** Items to a line, as FlatList's `numColumns`. */\n readonly numColumns = input(1, { alias: 'virtualListNumColumns', transform: numberOr(1) });\n /** Space between one column and the next. `rowGap` on the list spaces the lines. */\n readonly columnGap = input(0, { alias: 'virtualListColumnGap', transform: numberOr(0) });\n /** Whether a row takes a line to itself, given each item and its index. */\n readonly fullLine = input<((item: T, index: number) => boolean) | null | undefined>(undefined, {\n alias: 'virtualListFullLine',\n });\n\n // Looked up once the list exists: the list injects this directive while it is being made.\n private readonly injector = inject(Injector);\n\n readonly columns = computed(() => {\n const columns = this.numColumns();\n return Number.isFinite(columns) ? Math.max(1, Math.floor(columns)) : 1;\n });\n\n readonly fullLineOf = computed(() => {\n const fullLine = this.fullLine();\n return fullLine ? (item: unknown, index: number) => fullLine(item as T, index) : null;\n });\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || !ngDevMode) return;\n const unsupported = effect(() => {\n if (this.columns() === 1) return;\n const list = this.injector.get(VirtualList, null, { self: true });\n const why = list?.horizontal()\n ? 'a horizontal list'\n : list?.measuring()\n ? 'rows without itemHeight'\n : null;\n if (!why) return;\n unsupported.destroy();\n console.warn(\n `[angular-native] virtualListNumColumns lays out one item a line on ${why}: columns ` +\n `are for a vertical list with itemHeight, as FlatList's numColumns is vertical only.`,\n );\n });\n }\n\n /**\n * Each column is an equal share of the width, as a percentage, so the line needs no width to\n * be laid out and follows a rotation without one. The padding and gaps are then taken out by\n * margins: every column gives up the same amount, and how much of it is on which side is what\n * puts the gaps between the columns rather than inside them.\n */\n across(column: number, left: number, right: number): Record<string, unknown> {\n const columns = this.columns();\n const gap = this.columnGap();\n const spare = (left + right + (columns - 1) * gap) / columns;\n const marginStart = left - (column * (left + right - gap)) / columns;\n return {\n start: `${(column * 100) / columns}%`,\n end: `${((columns - 1 - column) * 100) / columns}%`,\n marginStart,\n marginEnd: spare - marginStart,\n };\n }\n}\n\ndeclare const ngDevMode: unknown;\n"]}
|
|
@@ -41,12 +41,12 @@ export class VirtualListStickyLevel {
|
|
|
41
41
|
};
|
|
42
42
|
}, /* @ts-ignore */
|
|
43
43
|
...(ngDevMode ? [{ debugName: "levelOf" }] : /* istanbul ignore next */ []));
|
|
44
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
45
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.
|
|
44
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: VirtualListStickyLevel, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
45
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.3.0", type: VirtualListStickyLevel, isStandalone: true, selector: "virtual-list[virtualListStickyLevel]", inputs: { level: { classPropertyName: "level", publicName: "virtualListStickyLevel", isSignal: true, isRequired: false, transformFunction: null }, maxLevels: { classPropertyName: "maxLevels", publicName: "virtualListMaxStickyLevels", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
46
46
|
{ provide: VIRTUAL_LIST_STICKY, useExisting: forwardRef(() => VirtualListStickyLevel) },
|
|
47
47
|
], ngImport: i0 });
|
|
48
48
|
}
|
|
49
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
49
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: VirtualListStickyLevel, decorators: [{
|
|
50
50
|
type: Directive,
|
|
51
51
|
args: [{
|
|
52
52
|
selector: 'virtual-list[virtualListStickyLevel]',
|
package/dist/virtual-list.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TemplateRef } from '@angular/core';
|
|
2
2
|
import { type NativeSyntheticEvent } from '@ng-native/fabric';
|
|
3
|
+
import type { Size } from './events.ts';
|
|
3
4
|
import { type KeyboardShouldPersistTaps } from './keyboard-taps.ts';
|
|
4
5
|
import { ScrollViewProps } from './scroll-view-props.ts';
|
|
5
6
|
import * as i0 from "@angular/core";
|
|
@@ -220,6 +221,8 @@ export declare class VirtualList<T> extends ScrollViewProps {
|
|
|
220
221
|
readonly endReached: import("@angular/core").OutputEmitterRef<{
|
|
221
222
|
distanceFromEnd: number;
|
|
222
223
|
}>;
|
|
224
|
+
/** The content's size changed: the header, the rows and the footer together, as `<scroll-view>` reports its own. */
|
|
225
|
+
readonly contentSizeChange: import("@angular/core").OutputEmitterRef<Size>;
|
|
223
226
|
/** Which rows are on screen, and what changed since last time. */
|
|
224
227
|
readonly viewableItemsChanged: import("@angular/core").OutputEmitterRef<{
|
|
225
228
|
viewable: readonly VirtualRow<T>[];
|
|
@@ -357,6 +360,19 @@ export declare class VirtualList<T> extends ScrollViewProps {
|
|
|
357
360
|
* rows' own space, after the header, or the very start of the list.
|
|
358
361
|
*/
|
|
359
362
|
private pendingScroll;
|
|
363
|
+
/**
|
|
364
|
+
* The app's last scroll, kept for the render its handler schedules. Native makes the scroll with
|
|
365
|
+
* the rows it has, and that render may be what gives the list its new ones.
|
|
366
|
+
*/
|
|
367
|
+
private asked;
|
|
368
|
+
private askedTimer;
|
|
369
|
+
/** The rows' extent at the last render, and what native is sure to have mounted of it. */
|
|
370
|
+
private renderedExtent;
|
|
371
|
+
private mountedExtent;
|
|
372
|
+
/** Counts the times the rows got shorter, after which an earlier render's extent is stale. */
|
|
373
|
+
private shortened;
|
|
374
|
+
/** Counts the scrolls sent, so one waiting to be made again gives way to what came after it. */
|
|
375
|
+
private scrollsSent;
|
|
360
376
|
/** What moves the rows: which items, and where each one is. */
|
|
361
377
|
private readonly placement;
|
|
362
378
|
/**
|
|
@@ -399,8 +415,20 @@ export declare class VirtualList<T> extends ScrollViewProps {
|
|
|
399
415
|
* on, and holding it by something off screen would be holding it by nothing the user saw.
|
|
400
416
|
*/
|
|
401
417
|
private successorOf;
|
|
402
|
-
/**
|
|
418
|
+
/**
|
|
419
|
+
* Make a queued correction, after the commit that moved the rows has gone to native, and then
|
|
420
|
+
* the app's scroll again when the correction would undo it, or when it was to past the end the
|
|
421
|
+
* new items have. A jump takes the correction's place; an animation starts from it.
|
|
422
|
+
*/
|
|
403
423
|
private flushScroll;
|
|
424
|
+
/** Whether the items given since a scroll end before where it was going. */
|
|
425
|
+
private endsBefore;
|
|
426
|
+
/**
|
|
427
|
+
* Keep a scroll the app made, to `offset`, for the next render. A jump is there already, so the
|
|
428
|
+
* list is too. An animation has yet to leave: the rows stay those on screen, and follow it.
|
|
429
|
+
*/
|
|
430
|
+
private ask;
|
|
431
|
+
private forgetAsked;
|
|
404
432
|
/** In development, a list with rows that stays at zero size; see `ZeroSizeWarning`. */
|
|
405
433
|
private readonly zeroSize;
|
|
406
434
|
constructor();
|
|
@@ -575,6 +603,18 @@ export declare class VirtualList<T> extends ScrollViewProps {
|
|
|
575
603
|
scrollToEnd(options?: {
|
|
576
604
|
animated?: boolean;
|
|
577
605
|
}): void;
|
|
606
|
+
private sendScrollTo;
|
|
607
|
+
private sendScrollToEnd;
|
|
608
|
+
/** Send a scroll, and again once the rows are mounted if it stops short without them. */
|
|
609
|
+
private dispatchScroll;
|
|
610
|
+
/**
|
|
611
|
+
* Whether native may stop a scroll to `offset` short, `before` the bottom of the rows it has
|
|
612
|
+
* mounted. Android runs the commands it has waiting before it mounts the views it has waiting,
|
|
613
|
+
* so one sent after a render can run on the rows before it. iOS keeps them in order.
|
|
614
|
+
*/
|
|
615
|
+
private stopsShort;
|
|
616
|
+
/** Follow what native has mounted: less at once, and more once the frames for it have run. */
|
|
617
|
+
private trackMounted;
|
|
578
618
|
private slotStyle;
|
|
579
619
|
protected onScroll(event: NativeSyntheticEvent<{
|
|
580
620
|
contentOffset?: {
|
|
@@ -650,9 +690,12 @@ export declare class VirtualList<T> extends ScrollViewProps {
|
|
|
650
690
|
* outside change detection and nothing else may be about to render.
|
|
651
691
|
*/
|
|
652
692
|
private holdPastHeader;
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
693
|
+
/**
|
|
694
|
+
* The content view was laid out: its size is the scroll view's content size, footer and all, as
|
|
695
|
+
* ScrollView.js reads it. Native sends a scroll view no `contentSizeChange` of its own.
|
|
696
|
+
*/
|
|
697
|
+
protected onContentLayout(event: NativeSyntheticEvent<{
|
|
698
|
+
layout?: Size;
|
|
656
699
|
}>): void;
|
|
657
700
|
/** The scroll view's content along the axis, header and all. */
|
|
658
701
|
private contentExtent;
|
|
@@ -667,7 +710,7 @@ export declare class VirtualList<T> extends ScrollViewProps {
|
|
|
667
710
|
private reachable;
|
|
668
711
|
private checkEnd;
|
|
669
712
|
static ɵfac: i0.ɵɵFactoryDeclaration<VirtualList<any>, never>;
|
|
670
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<VirtualList<any>, "virtual-list", ["virtualList"], { "items": { "alias": "items"; "required": true; "isSignal": true; }; "itemHeight": { "alias": "itemHeight"; "required": false; "isSignal": true; }; "estimatedItemHeight": { "alias": "estimatedItemHeight"; "required": false; "isSignal": true; }; "contentPadding": { "alias": "contentPadding"; "required": false; "isSignal": true; }; "rowGap": { "alias": "rowGap"; "required": false; "isSignal": true; }; "keyExtractor": { "alias": "keyExtractor"; "required": false; "isSignal": true; }; "itemType": { "alias": "itemType"; "required": false; "isSignal": true; }; "maintainVisibleContentPosition": { "alias": "maintainVisibleContentPosition"; "required": false; "isSignal": true; }; "overscan": { "alias": "overscan"; "required": false; "isSignal": true; }; "windowSize": { "alias": "windowSize"; "required": false; "isSignal": true; }; "velocityLead": { "alias": "velocityLead"; "required": false; "isSignal": true; }; "endReachedThreshold": { "alias": "endReachedThreshold"; "required": false; "isSignal": true; }; "horizontal": { "alias": "horizontal"; "required": false; "isSignal": true; }; "inverted": { "alias": "inverted"; "required": false; "isSignal": true; }; "stickyIndices": { "alias": "stickyIndices"; "required": false; "isSignal": true; }; "stickyHeader": { "alias": "stickyHeader"; "required": false; "isSignal": true; }; "keyboardShouldPersistTaps": { "alias": "keyboardShouldPersistTaps"; "required": false; "isSignal": true; }; "itemVisiblePercentThreshold": { "alias": "itemVisiblePercentThreshold"; "required": false; "isSignal": true; }; }, { "endReached": "endReached"; "viewableItemsChanged": "viewableItemsChanged"; }, ["separator", "refreshControl"], ["refresh-control", "[listHeader]", "*", "[listFooter]"], true, never>;
|
|
713
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<VirtualList<any>, "virtual-list", ["virtualList"], { "items": { "alias": "items"; "required": true; "isSignal": true; }; "itemHeight": { "alias": "itemHeight"; "required": false; "isSignal": true; }; "estimatedItemHeight": { "alias": "estimatedItemHeight"; "required": false; "isSignal": true; }; "contentPadding": { "alias": "contentPadding"; "required": false; "isSignal": true; }; "rowGap": { "alias": "rowGap"; "required": false; "isSignal": true; }; "keyExtractor": { "alias": "keyExtractor"; "required": false; "isSignal": true; }; "itemType": { "alias": "itemType"; "required": false; "isSignal": true; }; "maintainVisibleContentPosition": { "alias": "maintainVisibleContentPosition"; "required": false; "isSignal": true; }; "overscan": { "alias": "overscan"; "required": false; "isSignal": true; }; "windowSize": { "alias": "windowSize"; "required": false; "isSignal": true; }; "velocityLead": { "alias": "velocityLead"; "required": false; "isSignal": true; }; "endReachedThreshold": { "alias": "endReachedThreshold"; "required": false; "isSignal": true; }; "horizontal": { "alias": "horizontal"; "required": false; "isSignal": true; }; "inverted": { "alias": "inverted"; "required": false; "isSignal": true; }; "stickyIndices": { "alias": "stickyIndices"; "required": false; "isSignal": true; }; "stickyHeader": { "alias": "stickyHeader"; "required": false; "isSignal": true; }; "keyboardShouldPersistTaps": { "alias": "keyboardShouldPersistTaps"; "required": false; "isSignal": true; }; "itemVisiblePercentThreshold": { "alias": "itemVisiblePercentThreshold"; "required": false; "isSignal": true; }; }, { "endReached": "endReached"; "contentSizeChange": "contentSizeChange"; "viewableItemsChanged": "viewableItemsChanged"; }, ["separator", "refreshControl"], ["refresh-control", "[listHeader]", "*", "[listFooter]"], true, never>;
|
|
671
714
|
}
|
|
672
715
|
/**
|
|
673
716
|
* Put on each row's view: `<view [virtualListRow]="row">`. Applies the row's style, and reports
|