@ng-desktop/platform 0.6.0 → 0.7.1
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/css-style-parser.d.ts +6 -1
- package/fesm2022/css-style-parser.js +6 -6
- package/fesm2022/ecosystem-compat.d.ts +3 -5
- package/fesm2022/ecosystem-compat.js +16 -25
- package/fesm2022/native-directives.d.ts +123 -124
- package/fesm2022/native-directives.js +358 -556
- package/fesm2022/native-renderer.d.ts +1 -0
- package/fesm2022/native-renderer.js +65 -16
- package/fesm2022/platform.d.ts +3 -1
- package/fesm2022/platform.js +10 -0
- package/fesm2022/system-providers.js +2 -1
- package/fesm2022/virtual-grid.component.d.ts +4 -0
- package/fesm2022/virtual-grid.component.js +37 -14
- package/fesm2022/virtual-list.component.d.ts +7 -1
- package/fesm2022/virtual-list.component.js +81 -42
- package/package.json +1 -1
|
@@ -79,6 +79,7 @@ export declare class NativeRendererFactory2 implements RendererFactory2 {
|
|
|
79
79
|
private readonly defaultRenderer;
|
|
80
80
|
private readonly registeredTypeIds;
|
|
81
81
|
private readonly scopedClassesByScope;
|
|
82
|
+
private readonly sharedRootVars;
|
|
82
83
|
private nodeCounter;
|
|
83
84
|
private primaryWindowId;
|
|
84
85
|
private primaryScrollId;
|
|
@@ -214,6 +214,7 @@ function mapNativeEventNames(eventName) {
|
|
|
214
214
|
case 'dragleave':
|
|
215
215
|
return ['dragleave'];
|
|
216
216
|
case 'drop':
|
|
217
|
+
case 'file-drop':
|
|
217
218
|
return ['drop', 'files-dropped'];
|
|
218
219
|
default:
|
|
219
220
|
return [eventName];
|
|
@@ -533,6 +534,15 @@ export class NativeRenderer2 extends Renderer2 {
|
|
|
533
534
|
if (isInternalAngularAttr(name)) {
|
|
534
535
|
return;
|
|
535
536
|
}
|
|
537
|
+
if (name !== 'class' &&
|
|
538
|
+
name !== 'className' &&
|
|
539
|
+
name !== 'src' &&
|
|
540
|
+
name !== 'ngSrc' &&
|
|
541
|
+
name !== 'scroll-to' &&
|
|
542
|
+
name !== 'scroll-anchor' &&
|
|
543
|
+
el.attributes.get(name) === value) {
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
536
546
|
el.attributes.set(name, value);
|
|
537
547
|
if (name === 'class' || name === 'className') {
|
|
538
548
|
this.syncClassList(el, value);
|
|
@@ -551,14 +561,17 @@ export class NativeRenderer2 extends Renderer2 {
|
|
|
551
561
|
this.handleImageSource(el, value);
|
|
552
562
|
return;
|
|
553
563
|
}
|
|
554
|
-
if (name === '
|
|
555
|
-
(
|
|
556
|
-
|
|
557
|
-
el.tag === 'ng-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
564
|
+
if (name === 'label' ||
|
|
565
|
+
(name === 'text' && TEXT_BEARING_TAGS.has(el.tag)) ||
|
|
566
|
+
(name === 'title' &&
|
|
567
|
+
(el.tag === 'ng-window' ||
|
|
568
|
+
el.tag === 'adw-window' ||
|
|
569
|
+
el.tag === 'ng-dialog' ||
|
|
570
|
+
el.tag === 'gtk-dialog' ||
|
|
571
|
+
el.tag === 'adw-dialog' ||
|
|
572
|
+
el.tag === 'ng-header-bar' ||
|
|
573
|
+
el.tag === 'adw-header-bar'))) {
|
|
574
|
+
el.textContent = value;
|
|
562
575
|
this.bridge.setText(el.id, value);
|
|
563
576
|
}
|
|
564
577
|
else {
|
|
@@ -667,7 +680,36 @@ export class NativeRenderer2 extends Renderer2 {
|
|
|
667
680
|
removeStyle(el, style, _flags) {
|
|
668
681
|
el.styles.delete(style);
|
|
669
682
|
if (!el.isVirtual) {
|
|
670
|
-
|
|
683
|
+
const key = style.trim().toLowerCase();
|
|
684
|
+
let nativeAttr = style;
|
|
685
|
+
if (key === 'flex' || key === 'flex-grow' || key === 'width') {
|
|
686
|
+
nativeAttr = 'hexpand';
|
|
687
|
+
}
|
|
688
|
+
else if (key === 'height') {
|
|
689
|
+
nativeAttr = 'vexpand';
|
|
690
|
+
}
|
|
691
|
+
else if (key === 'flex-direction') {
|
|
692
|
+
nativeAttr = 'orientation';
|
|
693
|
+
}
|
|
694
|
+
else if (key === 'gap') {
|
|
695
|
+
nativeAttr = 'spacing';
|
|
696
|
+
}
|
|
697
|
+
else if (key === 'row-gap' || key === 'column-gap') {
|
|
698
|
+
nativeAttr = key.replace('-gap', '-spacing');
|
|
699
|
+
}
|
|
700
|
+
else if (key === 'justify-self') {
|
|
701
|
+
nativeAttr = 'halign';
|
|
702
|
+
}
|
|
703
|
+
else if (key === 'align-self') {
|
|
704
|
+
nativeAttr = 'valign';
|
|
705
|
+
}
|
|
706
|
+
else if (key === 'margin-left') {
|
|
707
|
+
nativeAttr = 'margin-start';
|
|
708
|
+
}
|
|
709
|
+
else if (key === 'margin-right') {
|
|
710
|
+
nativeAttr = 'margin-end';
|
|
711
|
+
}
|
|
712
|
+
this.bridge.setAttribute(el.id, nativeAttr, '');
|
|
671
713
|
}
|
|
672
714
|
}
|
|
673
715
|
setProperty(el, name, value) {
|
|
@@ -798,10 +840,12 @@ export class NativeRenderer2 extends Renderer2 {
|
|
|
798
840
|
};
|
|
799
841
|
}
|
|
800
842
|
if (target.isVirtual) {
|
|
801
|
-
// Built-in virtual containers own their internal <ng-scroll> and expose scrollBottom
|
|
802
|
-
// forwarding
|
|
803
|
-
if ((target.tag === 'ng-virtual-list' || target.tag === 'ng-virtual-grid') &&
|
|
804
|
-
(eventName === 'scrollBottom' || eventName === 'scroll-bottom'))
|
|
843
|
+
// Built-in virtual containers own their internal <ng-scroll> / <ng-list> and expose scrollBottom /
|
|
844
|
+
// rowActivated as Angular outputs; forwarding host DOM listeners would fire them twice with raw payloads.
|
|
845
|
+
if (((target.tag === 'ng-virtual-list' || target.tag === 'ng-virtual-grid') &&
|
|
846
|
+
(eventName === 'scrollBottom' || eventName === 'scroll-bottom')) ||
|
|
847
|
+
(target.tag === 'ng-virtual-list' &&
|
|
848
|
+
(eventName === 'rowActivated' || eventName === 'row-activated'))) {
|
|
805
849
|
return () => { };
|
|
806
850
|
}
|
|
807
851
|
const reg = {
|
|
@@ -1076,6 +1120,11 @@ export class NativeRendererFactory2 {
|
|
|
1076
1120
|
defaultRenderer;
|
|
1077
1121
|
registeredTypeIds = new Set();
|
|
1078
1122
|
scopedClassesByScope = new Map();
|
|
1123
|
+
sharedRootVars = {
|
|
1124
|
+
baseVars: new Map(),
|
|
1125
|
+
lightVars: new Map(),
|
|
1126
|
+
darkVars: new Map(),
|
|
1127
|
+
};
|
|
1079
1128
|
nodeCounter = 1;
|
|
1080
1129
|
primaryWindowId = null;
|
|
1081
1130
|
primaryScrollId = null;
|
|
@@ -1088,7 +1137,7 @@ export class NativeRendererFactory2 {
|
|
|
1088
1137
|
this.primaryWindowId = id;
|
|
1089
1138
|
}
|
|
1090
1139
|
}
|
|
1091
|
-
else if (tag === 'ng-scroll' || tag === '
|
|
1140
|
+
else if (tag === 'ng-scroll' || tag === 'gtk-scrolled-window') {
|
|
1092
1141
|
if (!this.primaryScrollId || !this.nodesById.has(this.primaryScrollId)) {
|
|
1093
1142
|
this.primaryScrollId = id;
|
|
1094
1143
|
}
|
|
@@ -1102,7 +1151,7 @@ export class NativeRendererFactory2 {
|
|
|
1102
1151
|
const typeKey = type.id || '__anonymous__';
|
|
1103
1152
|
if (!this.registeredTypeIds.has(typeKey)) {
|
|
1104
1153
|
this.registeredTypeIds.add(typeKey);
|
|
1105
|
-
registerParsedStyles(this.bridge, type.styles, this.scopedClassesByScope);
|
|
1154
|
+
registerParsedStyles(this.bridge, type.styles, this.scopedClassesByScope, this.sharedRootVars);
|
|
1106
1155
|
}
|
|
1107
1156
|
}
|
|
1108
1157
|
return this.defaultRenderer;
|
|
@@ -1131,7 +1180,7 @@ export class NativeRendererFactory2 {
|
|
|
1131
1180
|
return this.primaryScrollId;
|
|
1132
1181
|
}
|
|
1133
1182
|
for (const node of this.nodesById.values()) {
|
|
1134
|
-
if (!node.isVirtual && (node.tag === 'ng-scroll' || node.tag === '
|
|
1183
|
+
if (!node.isVirtual && (node.tag === 'ng-scroll' || node.tag === 'gtk-scrolled-window')) {
|
|
1135
1184
|
this.primaryScrollId = node.id;
|
|
1136
1185
|
return node.id;
|
|
1137
1186
|
}
|
package/fesm2022/platform.d.ts
CHANGED
|
@@ -6,11 +6,13 @@ import { NgNativeBridge } from './bridge';
|
|
|
6
6
|
* key shortcut plugin, and native error handler).
|
|
7
7
|
*/
|
|
8
8
|
export declare function provideNativePlatform(): EnvironmentProviders;
|
|
9
|
-
export interface NativeBootstrapContext {
|
|
9
|
+
export interface NativeBootstrapContext extends PromiseLike<ApplicationRef> {
|
|
10
10
|
readonly rootComponent: Type<unknown>;
|
|
11
11
|
readonly bridge: NgNativeBridge;
|
|
12
12
|
readonly config: ApplicationConfig;
|
|
13
13
|
readonly appRefPromise?: Promise<ApplicationRef>;
|
|
14
|
+
catch<TResult = never>(onrejected?: ((reason: unknown) => TResult | PromiseLike<TResult>) | null): Promise<ApplicationRef | TResult>;
|
|
15
|
+
finally(onfinally?: (() => void) | null): Promise<ApplicationRef>;
|
|
14
16
|
}
|
|
15
17
|
/**
|
|
16
18
|
* Bootstraps an Angular root component against the Rust `RenderEngine` via `globalThis.__NG_NATIVE__`.
|
package/fesm2022/platform.js
CHANGED
|
@@ -37,10 +37,20 @@ export function bootstrapNativeApplication(rootComponent, appConfig) {
|
|
|
37
37
|
const appRefPromise = isIvyComponent
|
|
38
38
|
? bootstrapApplication(rootComponent, mergedConfig)
|
|
39
39
|
: undefined;
|
|
40
|
+
const resolvedPromise = appRefPromise ?? Promise.resolve(undefined);
|
|
40
41
|
return {
|
|
41
42
|
rootComponent,
|
|
42
43
|
bridge,
|
|
43
44
|
config: mergedConfig,
|
|
44
45
|
...(appRefPromise ? { appRefPromise } : {}),
|
|
46
|
+
then(onfulfilled, onrejected) {
|
|
47
|
+
return resolvedPromise.then(onfulfilled, onrejected);
|
|
48
|
+
},
|
|
49
|
+
catch(onrejected) {
|
|
50
|
+
return resolvedPromise.catch(onrejected);
|
|
51
|
+
},
|
|
52
|
+
finally(onfinally) {
|
|
53
|
+
return resolvedPromise.finally(onfinally);
|
|
54
|
+
},
|
|
45
55
|
};
|
|
46
56
|
}
|
|
@@ -90,7 +90,8 @@ export class NativeKeyEventsPlugin extends EventManagerPlugin {
|
|
|
90
90
|
}
|
|
91
91
|
supports(eventName) {
|
|
92
92
|
const lower = eventName.trim().toLowerCase();
|
|
93
|
-
return (lower.startsWith('keydown.')
|
|
93
|
+
return ((lower.startsWith('keydown.') && lower.length > 8) ||
|
|
94
|
+
(lower.startsWith('keyup.') && lower.length > 6));
|
|
94
95
|
}
|
|
95
96
|
addEventListener(element, eventName, handler) {
|
|
96
97
|
const baseEvent = eventName.trim().toLowerCase().startsWith('keyup.') ? 'keyup' : 'keydown';
|
|
@@ -38,6 +38,8 @@ export declare class NativeVirtualGridComponent<T = unknown> {
|
|
|
38
38
|
readonly projectedTemplate: import("@angular/core").Signal<TemplateRef<NativeVirtualGridItemContext<T>> | undefined>;
|
|
39
39
|
readonly rangeChange: import("@angular/core").OutputEmitterRef<VirtualGridSliceRange>;
|
|
40
40
|
readonly scrollBottom: import("@angular/core").OutputEmitterRef<void>;
|
|
41
|
+
private readonly renderer;
|
|
42
|
+
private readonly scrollHost;
|
|
41
43
|
readonly scrollTop: import("@angular/core").WritableSignal<number>;
|
|
42
44
|
readonly measuredWidth: import("@angular/core").WritableSignal<number | null>;
|
|
43
45
|
readonly measuredHeight: import("@angular/core").WritableSignal<number | null>;
|
|
@@ -48,6 +50,8 @@ export declare class NativeVirtualGridComponent<T = unknown> {
|
|
|
48
50
|
readonly resolvedTemplate: import("@angular/core").Signal<TemplateRef<NativeVirtualGridItemContext<T>> | null>;
|
|
49
51
|
readonly effectiveWidth: import("@angular/core").Signal<number>;
|
|
50
52
|
readonly effectiveHeight: import("@angular/core").Signal<number>;
|
|
53
|
+
/** Builds/updates the Fenwick row-offset tree only when layout geometry or items change, not on scroll. */
|
|
54
|
+
private readonly rowHeightTreeState;
|
|
51
55
|
readonly range: import("@angular/core").Signal<VirtualGridSliceRange>;
|
|
52
56
|
readonly visibleEntries: import("@angular/core").Signal<readonly NativeVirtualGridEntry<T>[]>;
|
|
53
57
|
private lastEmittedRangeKey;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NgTemplateOutlet } from '@angular/common';
|
|
2
|
-
import { Component, computed, contentChild, effect, input, output, signal, TemplateRef, } from '@angular/core';
|
|
2
|
+
import { Component, computed, contentChild, effect, inject, input, output, Renderer2, signal, TemplateRef, viewChild, } from '@angular/core';
|
|
3
3
|
import { NativeContainerDirective, NativeElementDirective, NativeTextWidgetDirective, } from './native-directives.js';
|
|
4
4
|
import { computeVirtualGridSliceRange, FenwickOffsetTree, } from './virtual-layout.js';
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
@@ -39,6 +39,9 @@ export class NativeVirtualGridComponent {
|
|
|
39
39
|
...(ngDevMode ? [{ debugName: "projectedTemplate" }] : /* istanbul ignore next */ []));
|
|
40
40
|
rangeChange = output();
|
|
41
41
|
scrollBottom = output();
|
|
42
|
+
renderer = inject(Renderer2);
|
|
43
|
+
scrollHost = viewChild('scrollHost', /* @ts-ignore */
|
|
44
|
+
...(ngDevMode ? [{ debugName: "scrollHost" }] : /* istanbul ignore next */ []));
|
|
42
45
|
scrollTop = signal(0, /* @ts-ignore */
|
|
43
46
|
...(ngDevMode ? [{ debugName: "scrollTop" }] : /* istanbul ignore next */ []));
|
|
44
47
|
measuredWidth = signal(null, /* @ts-ignore */
|
|
@@ -57,16 +60,17 @@ export class NativeVirtualGridComponent {
|
|
|
57
60
|
...(ngDevMode ? [{ debugName: "effectiveWidth" }] : /* istanbul ignore next */ []));
|
|
58
61
|
effectiveHeight = computed(() => this.measuredHeight() ?? this.viewportHeight(), /* @ts-ignore */
|
|
59
62
|
...(ngDevMode ? [{ debugName: "effectiveHeight" }] : /* istanbul ignore next */ []));
|
|
60
|
-
|
|
63
|
+
/** Builds/updates the Fenwick row-offset tree only when layout geometry or items change, not on scroll. */
|
|
64
|
+
rowHeightTreeState = computed(() => {
|
|
61
65
|
const source = this.items();
|
|
62
66
|
const resolver = this.rowHeightResolver();
|
|
63
67
|
this.measureRevision();
|
|
64
68
|
const baseRowHeight = Math.max(1, this.rowHeight());
|
|
65
69
|
const effWidth = this.effectiveWidth();
|
|
66
70
|
const effHeight = this.effectiveHeight();
|
|
67
|
-
const
|
|
71
|
+
const geometrySlice = computeVirtualGridSliceRange({
|
|
68
72
|
totalItems: source.length,
|
|
69
|
-
scrollTop:
|
|
73
|
+
scrollTop: 0,
|
|
70
74
|
viewportHeight: effHeight,
|
|
71
75
|
viewportWidth: effWidth,
|
|
72
76
|
rowHeight: baseRowHeight,
|
|
@@ -77,9 +81,13 @@ export class NativeVirtualGridComponent {
|
|
|
77
81
|
overscanRows: this.overscanRows(),
|
|
78
82
|
});
|
|
79
83
|
if (resolver === null && this.rowOverrides.size === 0) {
|
|
80
|
-
return
|
|
84
|
+
return {
|
|
85
|
+
tree: null,
|
|
86
|
+
baseRowHeight,
|
|
87
|
+
columns: geometrySlice.columns,
|
|
88
|
+
};
|
|
81
89
|
}
|
|
82
|
-
const totalRows =
|
|
90
|
+
const totalRows = geometrySlice.totalRows;
|
|
83
91
|
const overrides = new Map();
|
|
84
92
|
if (resolver !== null) {
|
|
85
93
|
for (let r = 0; r < totalRows; r += 1) {
|
|
@@ -92,18 +100,24 @@ export class NativeVirtualGridComponent {
|
|
|
92
100
|
}
|
|
93
101
|
}
|
|
94
102
|
this.rowTree.reset(totalRows, baseRowHeight, overrides);
|
|
103
|
+
return { tree: this.rowTree, baseRowHeight, columns: geometrySlice.columns };
|
|
104
|
+
}, /* @ts-ignore */
|
|
105
|
+
...(ngDevMode ? [{ debugName: "rowHeightTreeState" }] : /* istanbul ignore next */ []));
|
|
106
|
+
range = computed(() => {
|
|
107
|
+
const source = this.items();
|
|
108
|
+
const { tree, baseRowHeight, columns } = this.rowHeightTreeState();
|
|
95
109
|
return computeVirtualGridSliceRange({
|
|
96
110
|
totalItems: source.length,
|
|
97
111
|
scrollTop: this.scrollTop(),
|
|
98
|
-
viewportHeight:
|
|
99
|
-
viewportWidth:
|
|
112
|
+
viewportHeight: this.effectiveHeight(),
|
|
113
|
+
viewportWidth: this.effectiveWidth(),
|
|
100
114
|
rowHeight: baseRowHeight,
|
|
101
115
|
minColumnWidth: this.minColumnWidth(),
|
|
102
|
-
columns
|
|
116
|
+
columns,
|
|
103
117
|
rowGap: this.rowGap(),
|
|
104
118
|
columnGap: this.columnGap(),
|
|
105
119
|
overscanRows: this.overscanRows(),
|
|
106
|
-
rowHeights:
|
|
120
|
+
rowHeights: tree ?? undefined,
|
|
107
121
|
});
|
|
108
122
|
}, /* @ts-ignore */
|
|
109
123
|
...(ngDevMode ? [{ debugName: "range" }] : /* istanbul ignore next */ []));
|
|
@@ -166,8 +180,16 @@ export class NativeVirtualGridComponent {
|
|
|
166
180
|
const y = this.rowHeightResolver() !== null || this.rowOverrides.size > 0
|
|
167
181
|
? Math.round(this.rowTree.offsetOf(targetRow) + targetRow * rowGap)
|
|
168
182
|
: Math.round(targetRow * (Math.max(1, this.rowHeight()) + rowGap));
|
|
183
|
+
const coords = `0,${y}`;
|
|
184
|
+
const sameCoords = this.scrollToAttr() === coords;
|
|
169
185
|
this.scrollTop.set(y);
|
|
170
|
-
this.scrollToAttr.set(
|
|
186
|
+
this.scrollToAttr.set(coords);
|
|
187
|
+
if (sameCoords) {
|
|
188
|
+
const hostEl = this.scrollHost()?.nativeElement;
|
|
189
|
+
if (hostEl) {
|
|
190
|
+
this.renderer.setAttribute(hostEl, 'scroll-to', coords);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
171
193
|
}
|
|
172
194
|
onNativeScroll(event) {
|
|
173
195
|
if (!event || typeof event !== 'object') {
|
|
@@ -191,8 +213,9 @@ export class NativeVirtualGridComponent {
|
|
|
191
213
|
}
|
|
192
214
|
}
|
|
193
215
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: NativeVirtualGridComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
194
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.3.0", type: NativeVirtualGridComponent, isStandalone: true, selector: "ng-virtual-grid", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, rowHeight: { classPropertyName: "rowHeight", publicName: "rowHeight", isSignal: true, isRequired: false, transformFunction: null }, minColumnWidth: { classPropertyName: "minColumnWidth", publicName: "minColumnWidth", isSignal: true, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, viewportHeight: { classPropertyName: "viewportHeight", publicName: "viewportHeight", isSignal: true, isRequired: false, transformFunction: null }, viewportWidth: { classPropertyName: "viewportWidth", publicName: "viewportWidth", isSignal: true, isRequired: false, transformFunction: null }, rowGap: { classPropertyName: "rowGap", publicName: "rowGap", isSignal: true, isRequired: false, transformFunction: null }, columnGap: { classPropertyName: "columnGap", publicName: "columnGap", isSignal: true, isRequired: false, transformFunction: null }, overscanRows: { classPropertyName: "overscanRows", publicName: "overscanRows", isSignal: true, isRequired: false, transformFunction: null }, gridClass: { classPropertyName: "gridClass", publicName: "gridClass", isSignal: true, isRequired: false, transformFunction: null }, gridId: { classPropertyName: "gridId", publicName: "gridId", isSignal: true, isRequired: false, transformFunction: null }, rowHeightResolver: { classPropertyName: "rowHeightResolver", publicName: "rowHeightResolver", 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", scrollBottom: "scrollBottom" }, queries: [{ propertyName: "projectedTemplate", first: true, predicate: TemplateRef, descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
216
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.3.0", type: NativeVirtualGridComponent, isStandalone: true, selector: "ng-virtual-grid", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, rowHeight: { classPropertyName: "rowHeight", publicName: "rowHeight", isSignal: true, isRequired: false, transformFunction: null }, minColumnWidth: { classPropertyName: "minColumnWidth", publicName: "minColumnWidth", isSignal: true, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, viewportHeight: { classPropertyName: "viewportHeight", publicName: "viewportHeight", isSignal: true, isRequired: false, transformFunction: null }, viewportWidth: { classPropertyName: "viewportWidth", publicName: "viewportWidth", isSignal: true, isRequired: false, transformFunction: null }, rowGap: { classPropertyName: "rowGap", publicName: "rowGap", isSignal: true, isRequired: false, transformFunction: null }, columnGap: { classPropertyName: "columnGap", publicName: "columnGap", isSignal: true, isRequired: false, transformFunction: null }, overscanRows: { classPropertyName: "overscanRows", publicName: "overscanRows", isSignal: true, isRequired: false, transformFunction: null }, gridClass: { classPropertyName: "gridClass", publicName: "gridClass", isSignal: true, isRequired: false, transformFunction: null }, gridId: { classPropertyName: "gridId", publicName: "gridId", isSignal: true, isRequired: false, transformFunction: null }, rowHeightResolver: { classPropertyName: "rowHeightResolver", publicName: "rowHeightResolver", 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", 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: `
|
|
195
217
|
<ng-scroll
|
|
218
|
+
#scrollHost
|
|
196
219
|
[hexpand]="true"
|
|
197
220
|
[vexpand]="true"
|
|
198
221
|
[min-height]="viewportHeight()"
|
|
@@ -243,7 +266,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImpor
|
|
|
243
266
|
type: Component,
|
|
244
267
|
args: [{
|
|
245
268
|
selector: 'ng-virtual-grid',
|
|
246
|
-
standalone: true,
|
|
247
269
|
imports: [
|
|
248
270
|
NgTemplateOutlet,
|
|
249
271
|
NativeElementDirective,
|
|
@@ -252,6 +274,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImpor
|
|
|
252
274
|
],
|
|
253
275
|
template: `
|
|
254
276
|
<ng-scroll
|
|
277
|
+
#scrollHost
|
|
255
278
|
[hexpand]="true"
|
|
256
279
|
[vexpand]="true"
|
|
257
280
|
[min-height]="viewportHeight()"
|
|
@@ -298,4 +321,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImpor
|
|
|
298
321
|
</ng-scroll>
|
|
299
322
|
`,
|
|
300
323
|
}]
|
|
301
|
-
}], ctorParameters: () => [], propDecorators: { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], rowHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowHeight", required: false }] }], minColumnWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "minColumnWidth", required: false }] }], columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }], viewportHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "viewportHeight", required: false }] }], viewportWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "viewportWidth", required: false }] }], rowGap: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowGap", required: false }] }], columnGap: [{ type: i0.Input, args: [{ isSignal: true, alias: "columnGap", required: false }] }], overscanRows: [{ type: i0.Input, args: [{ isSignal: true, alias: "overscanRows", required: false }] }], gridClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "gridClass", required: false }] }], gridId: [{ type: i0.Input, args: [{ isSignal: true, alias: "gridId", required: false }] }], rowHeightResolver: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowHeightResolver", 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"] }], scrollBottom: [{ type: i0.Output, args: ["scrollBottom"] }] } });
|
|
324
|
+
}], ctorParameters: () => [], propDecorators: { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], rowHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowHeight", required: false }] }], minColumnWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "minColumnWidth", required: false }] }], columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }], viewportHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "viewportHeight", required: false }] }], viewportWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "viewportWidth", required: false }] }], rowGap: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowGap", required: false }] }], columnGap: [{ type: i0.Input, args: [{ isSignal: true, alias: "columnGap", required: false }] }], overscanRows: [{ type: i0.Input, args: [{ isSignal: true, alias: "overscanRows", required: false }] }], gridClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "gridClass", required: false }] }], gridId: [{ type: i0.Input, args: [{ isSignal: true, alias: "gridId", required: false }] }], rowHeightResolver: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowHeightResolver", 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"] }], scrollBottom: [{ type: i0.Output, args: ["scrollBottom"] }], scrollHost: [{ type: i0.ViewChild, args: ['scrollHost', { isSignal: true }] }] } });
|
|
@@ -37,13 +37,19 @@ export declare class NativeVirtualListComponent<T = unknown> {
|
|
|
37
37
|
readonly rangeChange: import("@angular/core").OutputEmitterRef<VirtualSliceRange>;
|
|
38
38
|
readonly rowActivated: import("@angular/core").OutputEmitterRef<NativeVirtualRowActivatedEvent<T>>;
|
|
39
39
|
readonly scrollBottom: import("@angular/core").OutputEmitterRef<void>;
|
|
40
|
+
private readonly renderer;
|
|
41
|
+
private readonly scrollHost;
|
|
40
42
|
readonly scrollTop: import("@angular/core").WritableSignal<number>;
|
|
43
|
+
readonly measuredHeight: import("@angular/core").WritableSignal<number | null>;
|
|
41
44
|
readonly scrollToAttr: import("@angular/core").WritableSignal<string | undefined>;
|
|
42
45
|
private readonly heightTree;
|
|
43
46
|
private readonly measuredOverrides;
|
|
44
47
|
private readonly measureRevision;
|
|
45
48
|
readonly resolvedTemplate: import("@angular/core").Signal<TemplateRef<NativeVirtualItemContext<T>> | null>;
|
|
49
|
+
readonly effectiveHeight: import("@angular/core").Signal<number>;
|
|
46
50
|
readonly isVariableHeight: import("@angular/core").Signal<boolean>;
|
|
51
|
+
/** Builds/updates the Fenwick row-offset tree only when item heights or list contents change. */
|
|
52
|
+
private readonly heightTreeState;
|
|
47
53
|
readonly range: import("@angular/core").Signal<VirtualSliceRange>;
|
|
48
54
|
readonly visibleEntries: import("@angular/core").Signal<readonly NativeVirtualListEntry<T>[]>;
|
|
49
55
|
private lastEmittedRangeKey;
|
|
@@ -59,5 +65,5 @@ export declare class NativeVirtualListComponent<T = unknown> {
|
|
|
59
65
|
onNativeScroll(event: unknown): void;
|
|
60
66
|
onRowActivated(event: unknown): void;
|
|
61
67
|
static ɵfac: i0.ɵɵFactoryDeclaration<NativeVirtualListComponent<any>, never>;
|
|
62
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<NativeVirtualListComponent<any>, "ng-virtual-list", never, { "items": { "alias": "items"; "required": false; "isSignal": true; }; "itemHeight": { "alias": "itemHeight"; "required": false; "isSignal": true; }; "itemHeightResolver": { "alias": "itemHeightResolver"; "required": false; "isSignal": true; }; "viewportHeight": { "alias": "viewportHeight"; "required": false; "isSignal": true; }; "overscan": { "alias": "overscan"; "required": false; "isSignal": true; }; "selectionMode": { "alias": "selectionMode"; "required": false; "isSignal": true; }; "showSeparators": { "alias": "showSeparators"; "required": false; "isSignal": true; }; "trackBy": { "alias": "trackBy"; "required": false; "isSignal": true; }; "itemTemplateInput": { "alias": "itemTemplate"; "required": false; "isSignal": true; }; }, { "rangeChange": "rangeChange"; "rowActivated": "rowActivated"; "scrollBottom": "scrollBottom"; }, ["projectedTemplate"],
|
|
68
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NativeVirtualListComponent<any>, "ng-virtual-list", never, { "items": { "alias": "items"; "required": false; "isSignal": true; }; "itemHeight": { "alias": "itemHeight"; "required": false; "isSignal": true; }; "itemHeightResolver": { "alias": "itemHeightResolver"; "required": false; "isSignal": true; }; "viewportHeight": { "alias": "viewportHeight"; "required": false; "isSignal": true; }; "overscan": { "alias": "overscan"; "required": false; "isSignal": true; }; "selectionMode": { "alias": "selectionMode"; "required": false; "isSignal": true; }; "showSeparators": { "alias": "showSeparators"; "required": false; "isSignal": true; }; "trackBy": { "alias": "trackBy"; "required": false; "isSignal": true; }; "itemTemplateInput": { "alias": "itemTemplate"; "required": false; "isSignal": true; }; }, { "rangeChange": "rangeChange"; "rowActivated": "rowActivated"; "scrollBottom": "scrollBottom"; }, ["projectedTemplate"], ["[ngVirtualEmpty]"], true, never>;
|
|
63
69
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NgTemplateOutlet } from '@angular/common';
|
|
2
|
-
import { Component, computed, contentChild, effect, input, output, signal, TemplateRef, } from '@angular/core';
|
|
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
4
|
import { computeVariableVirtualSliceRange, computeVirtualSliceRange, FenwickOffsetTree, } from './virtual-layout.js';
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
@@ -32,8 +32,13 @@ export class NativeVirtualListComponent {
|
|
|
32
32
|
rangeChange = output();
|
|
33
33
|
rowActivated = output();
|
|
34
34
|
scrollBottom = output();
|
|
35
|
+
renderer = inject(Renderer2);
|
|
36
|
+
scrollHost = viewChild('scrollHost', /* @ts-ignore */
|
|
37
|
+
...(ngDevMode ? [{ debugName: "scrollHost" }] : /* istanbul ignore next */ []));
|
|
35
38
|
scrollTop = signal(0, /* @ts-ignore */
|
|
36
39
|
...(ngDevMode ? [{ debugName: "scrollTop" }] : /* istanbul ignore next */ []));
|
|
40
|
+
measuredHeight = signal(null, /* @ts-ignore */
|
|
41
|
+
...(ngDevMode ? [{ debugName: "measuredHeight" }] : /* istanbul ignore next */ []));
|
|
37
42
|
scrollToAttr = signal(undefined, /* @ts-ignore */
|
|
38
43
|
...(ngDevMode ? [{ debugName: "scrollToAttr" }] : /* istanbul ignore next */ []));
|
|
39
44
|
heightTree = new FenwickOffsetTree(0, 48);
|
|
@@ -42,16 +47,19 @@ export class NativeVirtualListComponent {
|
|
|
42
47
|
...(ngDevMode ? [{ debugName: "measureRevision" }] : /* istanbul ignore next */ []));
|
|
43
48
|
resolvedTemplate = computed(() => this.itemTemplateInput() ?? this.projectedTemplate() ?? null, /* @ts-ignore */
|
|
44
49
|
...(ngDevMode ? [{ debugName: "resolvedTemplate" }] : /* istanbul ignore next */ []));
|
|
50
|
+
effectiveHeight = computed(() => this.measuredHeight() ?? this.viewportHeight(), /* @ts-ignore */
|
|
51
|
+
...(ngDevMode ? [{ debugName: "effectiveHeight" }] : /* istanbul ignore next */ []));
|
|
45
52
|
isVariableHeight = computed(() => this.itemHeightResolver() !== null ||
|
|
46
53
|
(this.measureRevision() >= 0 && this.measuredOverrides.size > 0), /* @ts-ignore */
|
|
47
54
|
...(ngDevMode ? [{ debugName: "isVariableHeight" }] : /* istanbul ignore next */ []));
|
|
48
|
-
|
|
55
|
+
/** Builds/updates the Fenwick row-offset tree only when item heights or list contents change. */
|
|
56
|
+
heightTreeState = computed(() => {
|
|
49
57
|
const source = this.items();
|
|
50
58
|
const resolver = this.itemHeightResolver();
|
|
51
59
|
this.measureRevision();
|
|
52
60
|
const defaultHeight = Math.max(1, this.itemHeight());
|
|
53
61
|
if (resolver === null && this.measuredOverrides.size === 0) {
|
|
54
|
-
return
|
|
62
|
+
return { tree: null, defaultHeight };
|
|
55
63
|
}
|
|
56
64
|
const overrides = new Map();
|
|
57
65
|
if (resolver !== null) {
|
|
@@ -65,7 +73,17 @@ export class NativeVirtualListComponent {
|
|
|
65
73
|
}
|
|
66
74
|
}
|
|
67
75
|
this.heightTree.reset(source.length, defaultHeight, overrides);
|
|
68
|
-
return
|
|
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());
|
|
69
87
|
}, /* @ts-ignore */
|
|
70
88
|
...(ngDevMode ? [{ debugName: "range" }] : /* istanbul ignore next */ []));
|
|
71
89
|
visibleEntries = computed(() => {
|
|
@@ -124,21 +142,33 @@ export class NativeVirtualListComponent {
|
|
|
124
142
|
/** Scrolls the native viewport to bring row `index` into view. */
|
|
125
143
|
scrollToIndex(index) {
|
|
126
144
|
const y = this.offsetForIndex(index);
|
|
145
|
+
const coords = `0,${y}`;
|
|
146
|
+
const sameCoords = this.scrollToAttr() === coords;
|
|
127
147
|
this.scrollTop.set(y);
|
|
128
|
-
this.scrollToAttr.set(
|
|
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
|
+
}
|
|
129
155
|
}
|
|
130
156
|
onNativeScroll(event) {
|
|
131
157
|
if (!event || typeof event !== 'object') {
|
|
132
158
|
return;
|
|
133
159
|
}
|
|
134
160
|
const obj = event;
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
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'];
|
|
139
165
|
if (typeof top === 'number' && Number.isFinite(top)) {
|
|
140
166
|
this.scrollTop.set(Math.max(0, top));
|
|
141
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
|
+
}
|
|
142
172
|
}
|
|
143
173
|
onRowActivated(event) {
|
|
144
174
|
if (!event || typeof event !== 'object') {
|
|
@@ -157,8 +187,9 @@ export class NativeVirtualListComponent {
|
|
|
157
187
|
}
|
|
158
188
|
}
|
|
159
189
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: NativeVirtualListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
160
|
-
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 }], 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: `
|
|
161
191
|
<ng-scroll
|
|
192
|
+
#scrollHost
|
|
162
193
|
[hexpand]="true"
|
|
163
194
|
[vexpand]="true"
|
|
164
195
|
[min-height]="viewportHeight()"
|
|
@@ -170,22 +201,26 @@ export class NativeVirtualListComponent {
|
|
|
170
201
|
@if (range().topSpacerHeight > 0) {
|
|
171
202
|
<ng-box [height]="range().topSpacerHeight"></ng-box>
|
|
172
203
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
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
|
+
}
|
|
186
221
|
}
|
|
187
|
-
|
|
188
|
-
|
|
222
|
+
</ng-list>
|
|
223
|
+
}
|
|
189
224
|
@if (range().bottomSpacerHeight > 0) {
|
|
190
225
|
<ng-box [height]="range().bottomSpacerHeight"></ng-box>
|
|
191
226
|
}
|
|
@@ -197,7 +232,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImpor
|
|
|
197
232
|
type: Component,
|
|
198
233
|
args: [{
|
|
199
234
|
selector: 'ng-virtual-list',
|
|
200
|
-
standalone: true,
|
|
201
235
|
imports: [
|
|
202
236
|
NgTemplateOutlet,
|
|
203
237
|
NativeElementDirective,
|
|
@@ -207,6 +241,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImpor
|
|
|
207
241
|
],
|
|
208
242
|
template: `
|
|
209
243
|
<ng-scroll
|
|
244
|
+
#scrollHost
|
|
210
245
|
[hexpand]="true"
|
|
211
246
|
[vexpand]="true"
|
|
212
247
|
[min-height]="viewportHeight()"
|
|
@@ -218,22 +253,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImpor
|
|
|
218
253
|
@if (range().topSpacerHeight > 0) {
|
|
219
254
|
<ng-box [height]="range().topSpacerHeight"></ng-box>
|
|
220
255
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
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
|
+
}
|
|
234
273
|
}
|
|
235
|
-
|
|
236
|
-
|
|
274
|
+
</ng-list>
|
|
275
|
+
}
|
|
237
276
|
@if (range().bottomSpacerHeight > 0) {
|
|
238
277
|
<ng-box [height]="range().bottomSpacerHeight"></ng-box>
|
|
239
278
|
}
|
|
@@ -241,4 +280,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImpor
|
|
|
241
280
|
</ng-scroll>
|
|
242
281
|
`,
|
|
243
282
|
}]
|
|
244
|
-
}], 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"] }] } });
|
|
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 }] }] } });
|