@ng-desktop/platform 0.5.0 → 0.7.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 +0 -1
- package/fesm2022/bridge.d.ts +5 -0
- package/fesm2022/bridge.js +1 -0
- package/fesm2022/css-style-parser.d.ts +16 -3
- package/fesm2022/css-style-parser.js +534 -104
- package/fesm2022/ecosystem-compat.d.ts +3 -5
- package/fesm2022/ecosystem-compat.js +16 -25
- package/fesm2022/index.d.ts +3 -1
- package/fesm2022/index.js +3 -1
- package/fesm2022/native-directives.d.ts +5 -2
- package/fesm2022/native-directives.js +17 -11
- package/fesm2022/native-element.d.ts +2 -0
- package/fesm2022/native-element.js +2 -0
- package/fesm2022/native-renderer.d.ts +4 -1
- package/fesm2022/native-renderer.js +88 -6
- package/fesm2022/system-providers.js +2 -1
- package/fesm2022/virtual-grid.component.d.ts +68 -0
- package/fesm2022/virtual-grid.component.js +324 -0
- package/fesm2022/virtual-layout.d.ts +71 -0
- package/fesm2022/virtual-layout.js +279 -0
- package/fesm2022/virtual-list.component.d.ts +25 -13
- package/fesm2022/virtual-list.component.js +156 -73
- package/package.json +1 -1
|
@@ -1,47 +1,21 @@
|
|
|
1
1
|
import { NgTemplateOutlet } from '@angular/common';
|
|
2
|
-
import {
|
|
2
|
+
import { Component, computed, contentChild, effect, inject, input, output, Renderer2, signal, TemplateRef, viewChild, } from '@angular/core';
|
|
3
3
|
import { NativeContainerDirective, NativeElementDirective, NativeListDirective, NativeTextWidgetDirective, } from './native-directives.js';
|
|
4
|
+
import { computeVariableVirtualSliceRange, computeVirtualSliceRange, FenwickOffsetTree, } from './virtual-layout.js';
|
|
4
5
|
import * as i0 from "@angular/core";
|
|
5
|
-
|
|
6
|
-
* Computes the visible item slice and spacer heights for a fixed-row-height viewport.
|
|
7
|
-
*/
|
|
8
|
-
export function computeVirtualSliceRange(totalItems, scrollTop, viewportHeight, itemHeight, overscan = 4) {
|
|
9
|
-
const safeTotal = Math.max(0, Math.floor(totalItems));
|
|
10
|
-
if (safeTotal === 0) {
|
|
11
|
-
return {
|
|
12
|
-
startIndex: 0,
|
|
13
|
-
endIndex: 0,
|
|
14
|
-
totalItems: 0,
|
|
15
|
-
topSpacerHeight: 0,
|
|
16
|
-
bottomSpacerHeight: 0,
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
const safeItemHeight = Math.max(1, itemHeight);
|
|
20
|
-
const safeViewport = Math.max(safeItemHeight, viewportHeight);
|
|
21
|
-
const safeOverscan = Math.max(0, Math.floor(overscan));
|
|
22
|
-
const maxScrollTop = Math.max(0, safeTotal * safeItemHeight - safeViewport);
|
|
23
|
-
const clampedScrollTop = Math.min(Math.max(0, scrollTop), maxScrollTop);
|
|
24
|
-
const firstVisible = Math.floor(clampedScrollTop / safeItemHeight);
|
|
25
|
-
const visibleCount = Math.ceil(safeViewport / safeItemHeight);
|
|
26
|
-
const startIndex = Math.max(0, firstVisible - safeOverscan);
|
|
27
|
-
const endIndex = Math.min(safeTotal, firstVisible + visibleCount + safeOverscan);
|
|
28
|
-
return {
|
|
29
|
-
startIndex,
|
|
30
|
-
endIndex,
|
|
31
|
-
totalItems: safeTotal,
|
|
32
|
-
topSpacerHeight: startIndex * safeItemHeight,
|
|
33
|
-
bottomSpacerHeight: (safeTotal - endIndex) * safeItemHeight,
|
|
34
|
-
};
|
|
35
|
-
}
|
|
6
|
+
export { computeVirtualSliceRange } from './virtual-layout.js';
|
|
36
7
|
/**
|
|
37
8
|
* Virtualized native desktop list component rendering only the visible viewport slice + overscan
|
|
38
9
|
* inside an `<ng-scroll>` + `<ng-list>` hierarchy to keep native widget counts bounded at scale.
|
|
10
|
+
* Supports fixed row heights as well as O(log n) Fenwick-tree variable/measured row heights.
|
|
39
11
|
*/
|
|
40
12
|
export class NativeVirtualListComponent {
|
|
41
13
|
items = input([], /* @ts-ignore */
|
|
42
14
|
...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
43
15
|
itemHeight = input(48, /* @ts-ignore */
|
|
44
16
|
...(ngDevMode ? [{ debugName: "itemHeight" }] : /* istanbul ignore next */ []));
|
|
17
|
+
itemHeightResolver = input(null, /* @ts-ignore */
|
|
18
|
+
...(ngDevMode ? [{ debugName: "itemHeightResolver" }] : /* istanbul ignore next */ []));
|
|
45
19
|
viewportHeight = input(480, /* @ts-ignore */
|
|
46
20
|
...(ngDevMode ? [{ debugName: "viewportHeight" }] : /* istanbul ignore next */ []));
|
|
47
21
|
overscan = input(4, /* @ts-ignore */
|
|
@@ -57,11 +31,60 @@ export class NativeVirtualListComponent {
|
|
|
57
31
|
...(ngDevMode ? [{ debugName: "projectedTemplate" }] : /* istanbul ignore next */ []));
|
|
58
32
|
rangeChange = output();
|
|
59
33
|
rowActivated = output();
|
|
34
|
+
scrollBottom = output();
|
|
35
|
+
renderer = inject(Renderer2);
|
|
36
|
+
scrollHost = viewChild('scrollHost', /* @ts-ignore */
|
|
37
|
+
...(ngDevMode ? [{ debugName: "scrollHost" }] : /* istanbul ignore next */ []));
|
|
60
38
|
scrollTop = signal(0, /* @ts-ignore */
|
|
61
39
|
...(ngDevMode ? [{ debugName: "scrollTop" }] : /* istanbul ignore next */ []));
|
|
40
|
+
measuredHeight = signal(null, /* @ts-ignore */
|
|
41
|
+
...(ngDevMode ? [{ debugName: "measuredHeight" }] : /* istanbul ignore next */ []));
|
|
42
|
+
scrollToAttr = signal(undefined, /* @ts-ignore */
|
|
43
|
+
...(ngDevMode ? [{ debugName: "scrollToAttr" }] : /* istanbul ignore next */ []));
|
|
44
|
+
heightTree = new FenwickOffsetTree(0, 48);
|
|
45
|
+
measuredOverrides = new Map();
|
|
46
|
+
measureRevision = signal(0, /* @ts-ignore */
|
|
47
|
+
...(ngDevMode ? [{ debugName: "measureRevision" }] : /* istanbul ignore next */ []));
|
|
62
48
|
resolvedTemplate = computed(() => this.itemTemplateInput() ?? this.projectedTemplate() ?? null, /* @ts-ignore */
|
|
63
49
|
...(ngDevMode ? [{ debugName: "resolvedTemplate" }] : /* istanbul ignore next */ []));
|
|
64
|
-
|
|
50
|
+
effectiveHeight = computed(() => this.measuredHeight() ?? this.viewportHeight(), /* @ts-ignore */
|
|
51
|
+
...(ngDevMode ? [{ debugName: "effectiveHeight" }] : /* istanbul ignore next */ []));
|
|
52
|
+
isVariableHeight = computed(() => this.itemHeightResolver() !== null ||
|
|
53
|
+
(this.measureRevision() >= 0 && this.measuredOverrides.size > 0), /* @ts-ignore */
|
|
54
|
+
...(ngDevMode ? [{ debugName: "isVariableHeight" }] : /* istanbul ignore next */ []));
|
|
55
|
+
/** Builds/updates the Fenwick row-offset tree only when item heights or list contents change. */
|
|
56
|
+
heightTreeState = computed(() => {
|
|
57
|
+
const source = this.items();
|
|
58
|
+
const resolver = this.itemHeightResolver();
|
|
59
|
+
this.measureRevision();
|
|
60
|
+
const defaultHeight = Math.max(1, this.itemHeight());
|
|
61
|
+
if (resolver === null && this.measuredOverrides.size === 0) {
|
|
62
|
+
return { tree: null, defaultHeight };
|
|
63
|
+
}
|
|
64
|
+
const overrides = new Map();
|
|
65
|
+
if (resolver !== null) {
|
|
66
|
+
for (let i = 0; i < source.length; i += 1) {
|
|
67
|
+
overrides.set(i, resolver(i, source[i]));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
for (const [idx, h] of this.measuredOverrides) {
|
|
71
|
+
if (idx >= 0 && idx < source.length) {
|
|
72
|
+
overrides.set(idx, h);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
this.heightTree.reset(source.length, defaultHeight, overrides);
|
|
76
|
+
return { tree: this.heightTree, defaultHeight };
|
|
77
|
+
}, /* @ts-ignore */
|
|
78
|
+
...(ngDevMode ? [{ debugName: "heightTreeState" }] : /* istanbul ignore next */ []));
|
|
79
|
+
range = computed(() => {
|
|
80
|
+
const source = this.items();
|
|
81
|
+
const { tree, defaultHeight } = this.heightTreeState();
|
|
82
|
+
const effHeight = this.effectiveHeight();
|
|
83
|
+
if (tree === null) {
|
|
84
|
+
return computeVirtualSliceRange(source.length, this.scrollTop(), effHeight, defaultHeight, this.overscan());
|
|
85
|
+
}
|
|
86
|
+
return computeVariableVirtualSliceRange(tree, this.scrollTop(), effHeight, this.overscan());
|
|
87
|
+
}, /* @ts-ignore */
|
|
65
88
|
...(ngDevMode ? [{ debugName: "range" }] : /* istanbul ignore next */ []));
|
|
66
89
|
visibleEntries = computed(() => {
|
|
67
90
|
const source = this.items();
|
|
@@ -79,25 +102,73 @@ export class NativeVirtualListComponent {
|
|
|
79
102
|
constructor() {
|
|
80
103
|
effect(() => {
|
|
81
104
|
const next = this.range();
|
|
82
|
-
const key = `${next.startIndex}:${next.endIndex}:${next.totalItems}`;
|
|
105
|
+
const key = `${next.startIndex}:${next.endIndex}:${next.totalItems}:${next.topSpacerHeight}:${next.bottomSpacerHeight}`;
|
|
83
106
|
if (key !== this.lastEmittedRangeKey) {
|
|
84
107
|
this.lastEmittedRangeKey = key;
|
|
85
108
|
this.rangeChange.emit(next);
|
|
86
109
|
}
|
|
87
110
|
});
|
|
88
111
|
}
|
|
112
|
+
/** Records a dynamic measured pixel height for row `index` and updates viewport offsets. */
|
|
113
|
+
measureItemHeight(index, height) {
|
|
114
|
+
const idx = Math.floor(index);
|
|
115
|
+
if (!Number.isFinite(index) || idx < 0 || !Number.isFinite(height)) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const clamped = Math.max(1, height);
|
|
119
|
+
if (this.measuredOverrides.get(idx) !== clamped) {
|
|
120
|
+
this.measuredOverrides.set(idx, clamped);
|
|
121
|
+
this.measureRevision.update((rev) => rev + 1);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/** Clears all dynamically measured height overrides. */
|
|
125
|
+
resetMeasuredHeights() {
|
|
126
|
+
if (this.measuredOverrides.size === 0) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
this.measuredOverrides.clear();
|
|
130
|
+
this.measureRevision.update((rev) => rev + 1);
|
|
131
|
+
}
|
|
132
|
+
/** Returns the cumulative Y offset for row `index`. */
|
|
133
|
+
offsetForIndex(index) {
|
|
134
|
+
const source = this.items();
|
|
135
|
+
const idx = Math.max(0, Math.min(source.length, Math.floor(index)));
|
|
136
|
+
this.range();
|
|
137
|
+
if (!this.isVariableHeight()) {
|
|
138
|
+
return idx * Math.max(1, this.itemHeight());
|
|
139
|
+
}
|
|
140
|
+
return Math.round(this.heightTree.offsetOf(idx));
|
|
141
|
+
}
|
|
142
|
+
/** Scrolls the native viewport to bring row `index` into view. */
|
|
143
|
+
scrollToIndex(index) {
|
|
144
|
+
const y = this.offsetForIndex(index);
|
|
145
|
+
const coords = `0,${y}`;
|
|
146
|
+
const sameCoords = this.scrollToAttr() === coords;
|
|
147
|
+
this.scrollTop.set(y);
|
|
148
|
+
this.scrollToAttr.set(coords);
|
|
149
|
+
if (sameCoords) {
|
|
150
|
+
const hostEl = this.scrollHost()?.nativeElement;
|
|
151
|
+
if (hostEl) {
|
|
152
|
+
this.renderer.setAttribute(hostEl, 'scroll-to', coords);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
89
156
|
onNativeScroll(event) {
|
|
90
157
|
if (!event || typeof event !== 'object') {
|
|
91
158
|
return;
|
|
92
159
|
}
|
|
93
160
|
const obj = event;
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
161
|
+
const target = obj['target'] && typeof obj['target'] === 'object'
|
|
162
|
+
? obj['target']
|
|
163
|
+
: undefined;
|
|
164
|
+
const top = typeof obj['scrollTop'] === 'number' ? obj['scrollTop'] : target?.['scrollTop'];
|
|
98
165
|
if (typeof top === 'number' && Number.isFinite(top)) {
|
|
99
166
|
this.scrollTop.set(Math.max(0, top));
|
|
100
167
|
}
|
|
168
|
+
const height = typeof obj['clientHeight'] === 'number' ? obj['clientHeight'] : target?.['clientHeight'];
|
|
169
|
+
if (typeof height === 'number' && Number.isFinite(height) && height > 0) {
|
|
170
|
+
this.measuredHeight.set(height);
|
|
171
|
+
}
|
|
101
172
|
}
|
|
102
173
|
onRowActivated(event) {
|
|
103
174
|
if (!event || typeof event !== 'object') {
|
|
@@ -116,46 +187,51 @@ export class NativeVirtualListComponent {
|
|
|
116
187
|
}
|
|
117
188
|
}
|
|
118
189
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: NativeVirtualListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
119
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.3.0", type: NativeVirtualListComponent, isStandalone: true, selector: "ng-virtual-list", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, itemHeight: { classPropertyName: "itemHeight", publicName: "itemHeight", isSignal: true, isRequired: false, transformFunction: null }, viewportHeight: { classPropertyName: "viewportHeight", publicName: "viewportHeight", isSignal: true, isRequired: false, transformFunction: null }, overscan: { classPropertyName: "overscan", publicName: "overscan", isSignal: true, isRequired: false, transformFunction: null }, selectionMode: { classPropertyName: "selectionMode", publicName: "selectionMode", isSignal: true, isRequired: false, transformFunction: null }, showSeparators: { classPropertyName: "showSeparators", publicName: "showSeparators", isSignal: true, isRequired: false, transformFunction: null }, trackBy: { classPropertyName: "trackBy", publicName: "trackBy", isSignal: true, isRequired: false, transformFunction: null }, itemTemplateInput: { classPropertyName: "itemTemplateInput", publicName: "itemTemplate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { rangeChange: "rangeChange", rowActivated: "rowActivated" }, queries: [{ propertyName: "projectedTemplate", first: true, predicate: TemplateRef, descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
190
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.3.0", type: NativeVirtualListComponent, isStandalone: true, selector: "ng-virtual-list", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, itemHeight: { classPropertyName: "itemHeight", publicName: "itemHeight", isSignal: true, isRequired: false, transformFunction: null }, itemHeightResolver: { classPropertyName: "itemHeightResolver", publicName: "itemHeightResolver", isSignal: true, isRequired: false, transformFunction: null }, viewportHeight: { classPropertyName: "viewportHeight", publicName: "viewportHeight", isSignal: true, isRequired: false, transformFunction: null }, overscan: { classPropertyName: "overscan", publicName: "overscan", isSignal: true, isRequired: false, transformFunction: null }, selectionMode: { classPropertyName: "selectionMode", publicName: "selectionMode", isSignal: true, isRequired: false, transformFunction: null }, showSeparators: { classPropertyName: "showSeparators", publicName: "showSeparators", isSignal: true, isRequired: false, transformFunction: null }, trackBy: { classPropertyName: "trackBy", publicName: "trackBy", isSignal: true, isRequired: false, transformFunction: null }, itemTemplateInput: { classPropertyName: "itemTemplateInput", publicName: "itemTemplate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { rangeChange: "rangeChange", rowActivated: "rowActivated", scrollBottom: "scrollBottom" }, queries: [{ propertyName: "projectedTemplate", first: true, predicate: TemplateRef, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "scrollHost", first: true, predicate: ["scrollHost"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
120
191
|
<ng-scroll
|
|
192
|
+
#scrollHost
|
|
121
193
|
[hexpand]="true"
|
|
122
194
|
[vexpand]="true"
|
|
123
195
|
[min-height]="viewportHeight()"
|
|
196
|
+
[scroll-to]="scrollToAttr()"
|
|
124
197
|
(scroll)="onNativeScroll($event)"
|
|
198
|
+
(scrollBottom)="scrollBottom.emit()"
|
|
125
199
|
>
|
|
126
200
|
<ng-box orientation="vertical" [spacing]="0" [hexpand]="true">
|
|
127
201
|
@if (range().topSpacerHeight > 0) {
|
|
128
202
|
<ng-box [height]="range().topSpacerHeight"></ng-box>
|
|
129
203
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
204
|
+
@if (items().length === 0) {
|
|
205
|
+
<ng-content select="[ngVirtualEmpty]"></ng-content>
|
|
206
|
+
} @else {
|
|
207
|
+
<ng-list
|
|
208
|
+
[selection-mode]="selectionMode()"
|
|
209
|
+
[show-separators]="showSeparators()"
|
|
210
|
+
(rowActivated)="onRowActivated($event)"
|
|
211
|
+
>
|
|
212
|
+
@for (entry of visibleEntries(); track entry.key) {
|
|
213
|
+
@if (resolvedTemplate(); as tpl) {
|
|
214
|
+
<ng-container
|
|
215
|
+
[ngTemplateOutlet]="tpl"
|
|
216
|
+
[ngTemplateOutletContext]="{ $implicit: entry.item, index: entry.index }"
|
|
217
|
+
></ng-container>
|
|
218
|
+
} @else {
|
|
219
|
+
<ng-label [text]="'' + entry.item"></ng-label>
|
|
220
|
+
}
|
|
143
221
|
}
|
|
144
|
-
|
|
145
|
-
|
|
222
|
+
</ng-list>
|
|
223
|
+
}
|
|
146
224
|
@if (range().bottomSpacerHeight > 0) {
|
|
147
225
|
<ng-box [height]="range().bottomSpacerHeight"></ng-box>
|
|
148
226
|
}
|
|
149
227
|
</ng-box>
|
|
150
228
|
</ng-scroll>
|
|
151
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: NativeElementDirective, selector: "ng-window,adw-window,ng-dialog,gtk-dialog,adw-dialog,ng-header-bar,adw-header-bar,gtk-header-bar,ng-scroll,gtk-scrolled-window,ng-box,gtk-box,ng-grid,gtk-grid,ng-separator,gtk-separator,ng-button,gtk-button,ng-label,gtk-label,ng-entry,gtk-entry,ng-switch,gtk-switch,ng-checkbox,ng-check,ng-check-button,gtk-check-button,ng-slider,ng-scale,gtk-scale,ng-select,ng-dropdown,gtk-dropdown,gtk-drop-down,ng-image,adw-image,gtk-picture,ng-picture,ng-level-bar,gtk-level-bar,ng-flow,ng-flow-box,gtk-flow-box,ng-spinner,gtk-spinner,ng-progress-bar,gtk-progress-bar,ng-paned,gtk-paned,ng-stack,gtk-stack,adw-navigation-view,ng-expander,gtk-expander,ng-text-view,gtk-text-view,ng-password-entry,gtk-password-entry,ng-spin-button,gtk-spin-button,ng-search-entry,gtk-search-entry,ng-clamp,adw-clamp,ng-list,ng-table,gtk-list-box,gtk-list-view,ng-popover,gtk-popover,ng-menu,adw-entry-row,adw-password-entry-row,adw-switch-row,adw-combo-row,adw-spin-row", inputs: ["hexpand", "vexpand", "halign", "valign", "width", "height", "min-width", "min-height", "margin", "margin-top", "margin-bottom", "margin-start", "margin-end", "visible", "sensitive", "disabled", "tooltip", "event-mask", "drop-target"] }, { kind: "directive", type: NativeContainerDirective, selector: "ng-box,gtk-box,ng-grid,gtk-grid,ng-flow,ng-flow-box,gtk-flow-box,ng-paned,gtk-paned,ng-scroll,gtk-scrolled-window,ng-stack,gtk-stack,adw-navigation-view,ng-expander,gtk-expander,ng-clamp,adw-clamp,ng-separator,gtk-separator", inputs: ["orientation", "spacing", "gap", "row-spacing", "column-spacing", "min-children", "max-children", "min-per-row", "max-per-row", "homogeneous", "position", "visible-child", "active-page", "transition", "transition-type", "label", "title", "expanded", "open", "max-size", "maximum-size", "scroll-to", "scroll-anchor"] }, { kind: "directive", type: NativeListDirective, selector: "ng-list,ng-table,gtk-list-box,gtk-list-view", inputs: ["selection-mode", "selectionMode", "show-separators", "showSeparators", "separators"] }, { kind: "directive", type: NativeTextWidgetDirective, selector: "ng-button,gtk-button,ng-label,gtk-label", inputs: ["label", "text", "wrap", "selectable", "ellipsize"] }]
|
|
229
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: NativeElementDirective, selector: "ng-window,adw-window,ng-dialog,gtk-dialog,adw-dialog,ng-header-bar,adw-header-bar,gtk-header-bar,ng-scroll,gtk-scrolled-window,ng-box,gtk-box,ng-grid,gtk-grid,ng-separator,gtk-separator,ng-button,gtk-button,ng-label,gtk-label,ng-entry,gtk-entry,ng-switch,gtk-switch,ng-checkbox,ng-check,ng-check-button,gtk-check-button,ng-slider,ng-scale,gtk-scale,ng-select,ng-dropdown,gtk-dropdown,gtk-drop-down,ng-image,adw-image,gtk-picture,ng-picture,ng-level-bar,gtk-level-bar,ng-flow,ng-flow-box,gtk-flow-box,ng-spinner,gtk-spinner,ng-progress-bar,gtk-progress-bar,ng-paned,gtk-paned,ng-stack,gtk-stack,adw-navigation-view,ng-expander,gtk-expander,ng-text-view,gtk-text-view,ng-password-entry,gtk-password-entry,ng-spin-button,gtk-spin-button,ng-search-entry,gtk-search-entry,ng-clamp,adw-clamp,ng-list,ng-table,gtk-list-box,gtk-list-view,ng-popover,gtk-popover,ng-menu,adw-entry-row,adw-password-entry-row,adw-switch-row,adw-combo-row,adw-spin-row", inputs: ["hexpand", "vexpand", "halign", "valign", "width", "height", "min-width", "min-height", "margin", "margin-top", "margin-bottom", "margin-start", "margin-end", "visible", "sensitive", "disabled", "tooltip", "event-mask", "drop-target", "col", "row"] }, { kind: "directive", type: NativeContainerDirective, selector: "ng-box,gtk-box,ng-grid,gtk-grid,ng-flow,ng-flow-box,gtk-flow-box,ng-paned,gtk-paned,ng-scroll,gtk-scrolled-window,ng-stack,gtk-stack,adw-navigation-view,ng-expander,gtk-expander,ng-clamp,adw-clamp,ng-separator,gtk-separator", inputs: ["orientation", "spacing", "gap", "row-spacing", "column-spacing", "min-children", "max-children", "min-per-row", "max-per-row", "columns", "homogeneous", "position", "visible-child", "active-page", "transition", "transition-type", "label", "title", "expanded", "open", "max-size", "maximum-size", "scroll-to", "scroll-anchor"] }, { kind: "directive", type: NativeListDirective, selector: "ng-list,ng-table,gtk-list-box,gtk-list-view", inputs: ["selection-mode", "selectionMode", "show-separators", "showSeparators", "separators"] }, { kind: "directive", type: NativeTextWidgetDirective, selector: "ng-button,gtk-button,ng-label,gtk-label", inputs: ["label", "text", "wrap", "selectable", "ellipsize"] }] });
|
|
152
230
|
}
|
|
153
231
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: NativeVirtualListComponent, decorators: [{
|
|
154
232
|
type: Component,
|
|
155
233
|
args: [{
|
|
156
234
|
selector: 'ng-virtual-list',
|
|
157
|
-
standalone: true,
|
|
158
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
159
235
|
imports: [
|
|
160
236
|
NgTemplateOutlet,
|
|
161
237
|
NativeElementDirective,
|
|
@@ -165,31 +241,38 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImpor
|
|
|
165
241
|
],
|
|
166
242
|
template: `
|
|
167
243
|
<ng-scroll
|
|
244
|
+
#scrollHost
|
|
168
245
|
[hexpand]="true"
|
|
169
246
|
[vexpand]="true"
|
|
170
247
|
[min-height]="viewportHeight()"
|
|
248
|
+
[scroll-to]="scrollToAttr()"
|
|
171
249
|
(scroll)="onNativeScroll($event)"
|
|
250
|
+
(scrollBottom)="scrollBottom.emit()"
|
|
172
251
|
>
|
|
173
252
|
<ng-box orientation="vertical" [spacing]="0" [hexpand]="true">
|
|
174
253
|
@if (range().topSpacerHeight > 0) {
|
|
175
254
|
<ng-box [height]="range().topSpacerHeight"></ng-box>
|
|
176
255
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
256
|
+
@if (items().length === 0) {
|
|
257
|
+
<ng-content select="[ngVirtualEmpty]"></ng-content>
|
|
258
|
+
} @else {
|
|
259
|
+
<ng-list
|
|
260
|
+
[selection-mode]="selectionMode()"
|
|
261
|
+
[show-separators]="showSeparators()"
|
|
262
|
+
(rowActivated)="onRowActivated($event)"
|
|
263
|
+
>
|
|
264
|
+
@for (entry of visibleEntries(); track entry.key) {
|
|
265
|
+
@if (resolvedTemplate(); as tpl) {
|
|
266
|
+
<ng-container
|
|
267
|
+
[ngTemplateOutlet]="tpl"
|
|
268
|
+
[ngTemplateOutletContext]="{ $implicit: entry.item, index: entry.index }"
|
|
269
|
+
></ng-container>
|
|
270
|
+
} @else {
|
|
271
|
+
<ng-label [text]="'' + entry.item"></ng-label>
|
|
272
|
+
}
|
|
190
273
|
}
|
|
191
|
-
|
|
192
|
-
|
|
274
|
+
</ng-list>
|
|
275
|
+
}
|
|
193
276
|
@if (range().bottomSpacerHeight > 0) {
|
|
194
277
|
<ng-box [height]="range().bottomSpacerHeight"></ng-box>
|
|
195
278
|
}
|
|
@@ -197,4 +280,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImpor
|
|
|
197
280
|
</ng-scroll>
|
|
198
281
|
`,
|
|
199
282
|
}]
|
|
200
|
-
}], ctorParameters: () => [], propDecorators: { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], itemHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemHeight", required: false }] }], viewportHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "viewportHeight", required: false }] }], overscan: [{ type: i0.Input, args: [{ isSignal: true, alias: "overscan", required: false }] }], selectionMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectionMode", required: false }] }], showSeparators: [{ type: i0.Input, args: [{ isSignal: true, alias: "showSeparators", required: false }] }], trackBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "trackBy", required: false }] }], itemTemplateInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemTemplate", required: false }] }], projectedTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => TemplateRef), { isSignal: true }] }], rangeChange: [{ type: i0.Output, args: ["rangeChange"] }], rowActivated: [{ type: i0.Output, args: ["rowActivated"] }] } });
|
|
283
|
+
}], ctorParameters: () => [], propDecorators: { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], itemHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemHeight", required: false }] }], itemHeightResolver: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemHeightResolver", required: false }] }], viewportHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "viewportHeight", required: false }] }], overscan: [{ type: i0.Input, args: [{ isSignal: true, alias: "overscan", required: false }] }], selectionMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectionMode", required: false }] }], showSeparators: [{ type: i0.Input, args: [{ isSignal: true, alias: "showSeparators", required: false }] }], trackBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "trackBy", required: false }] }], itemTemplateInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemTemplate", required: false }] }], projectedTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => TemplateRef), { isSignal: true }] }], rangeChange: [{ type: i0.Output, args: ["rangeChange"] }], rowActivated: [{ type: i0.Output, args: ["rowActivated"] }], scrollBottom: [{ type: i0.Output, args: ["scrollBottom"] }], scrollHost: [{ type: i0.ViewChild, args: ['scrollHost', { isSignal: true }] }] } });
|