Skip to content

Commit c84a864

Browse files
ci: apply automated fixes
1 parent 156153a commit c84a864

12 files changed

Lines changed: 101 additions & 70 deletions

packages/angular-virtual/angular.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,9 @@
2121
"outputPath": "e2e/app/dist/angular-virtual-e2e",
2222
"index": "e2e/app/src/index.html",
2323
"browser": "e2e/app/src/main.ts",
24-
"polyfills": [
25-
"zone.js"
26-
],
24+
"polyfills": ["zone.js"],
2725
"tsConfig": "e2e/app/tsconfig.app.json",
28-
"styles": [
29-
"e2e/app/src/styles.css"
30-
],
26+
"styles": ["e2e/app/src/styles.css"],
3127
"scripts": []
3228
},
3329
"configurations": {

packages/angular-virtual/e2e/app/angular.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,9 @@
2121
"outputPath": "dist/angular-virtual-e2e",
2222
"index": "src/index.html",
2323
"browser": "src/main.ts",
24-
"polyfills": [
25-
"zone.js"
26-
],
24+
"polyfills": ["zone.js"],
2725
"tsConfig": "tsconfig.app.json",
28-
"styles": [
29-
"src/styles.css"
30-
],
26+
"styles": ["src/styles.css"],
3127
"scripts": []
3228
},
3329
"configurations": {

packages/angular-virtual/e2e/app/src/app/app.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ import { RouterLink, RouterLinkActive, RouterOutlet } from '@angular/router'
1212
|
1313
<a routerLink="/smooth-scroll" routerLinkActive="active">Smooth scroll</a>
1414
|
15-
<a routerLink="/measure-element" routerLinkActive="active">Measure element</a>
15+
<a routerLink="/measure-element" routerLinkActive="active"
16+
>Measure element</a
17+
>
1618
|
1719
<a routerLink="/stale-index" routerLinkActive="active">Stale index</a>
1820
</nav>

packages/angular-virtual/e2e/app/src/app/measure-element.component.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ const initialItems: Array<Item> = [
2525
selector: 'app-measure-element',
2626
changeDetection: ChangeDetectionStrategy.OnPush,
2727
template: `
28-
<div #scrollElement id="scroll-container" style="height: 400px; overflow: auto;">
28+
<div
29+
#scrollElement
30+
id="scroll-container"
31+
style="height: 400px; overflow: auto;"
32+
>
2933
<div
3034
style="position: relative; width: 100%;"
3135
[style.height.px]="virtualizer.getTotalSize()"
@@ -39,7 +43,9 @@ const initialItems: Array<Item> = [
3943
style="position: absolute; top: 0; left: 0; width: 100%;"
4044
[style.transform]="'translateY(' + row.start + 'px)'"
4145
>
42-
<div style="display: flex; gap: 8px; align-items: center; padding: 4px;">
46+
<div
47+
style="display: flex; gap: 8px; align-items: center; padding: 4px;"
48+
>
4349
<span>Row {{ item.label }}</span>
4450
<button
4551
[attr.data-testid]="'expand-' + item.id"

packages/angular-virtual/e2e/app/src/app/scroll.component.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,19 @@ const randomHeightForKey = (() => {
4545
>
4646
Scroll to last
4747
</button>
48-
<button id="scroll-to-0" type="button" (click)="virtualizer.scrollToIndex(0)">
48+
<button
49+
id="scroll-to-0"
50+
type="button"
51+
(click)="virtualizer.scrollToIndex(0)"
52+
>
4953
Scroll to 0
5054
</button>
5155
52-
<div #scrollElement id="scroll-container" style="height: 400px; overflow: auto;">
56+
<div
57+
#scrollElement
58+
id="scroll-container"
59+
style="height: 400px; overflow: auto;"
60+
>
5361
<div
5462
style="position: relative; width: 100%;"
5563
[style.height.px]="virtualizer.getTotalSize()"
@@ -62,7 +70,9 @@ const randomHeightForKey = (() => {
6270
style="position: absolute; top: 0; left: 0; width: 100%;"
6371
[style.transform]="'translateY(' + row.start + 'px)'"
6472
>
65-
<div [style.height.px]="randomHeight(row.key)">Row {{ row.index }}</div>
73+
<div [style.height.px]="randomHeight(row.key)">
74+
Row {{ row.index }}
75+
</div>
6676
</div>
6777
}
6878
</div>

packages/angular-virtual/e2e/app/src/app/smooth-scroll.component.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,11 @@ const randomHeightForKey = (() => {
5959
</button>
6060
</div>
6161
62-
<div #scrollElement id="scroll-container" style="height: 400px; overflow: auto;">
62+
<div
63+
#scrollElement
64+
id="scroll-container"
65+
style="height: 400px; overflow: auto;"
66+
>
6367
<div
6468
style="position: relative; width: 100%;"
6569
[style.height.px]="virtualizer.getTotalSize()"
@@ -72,7 +76,9 @@ const randomHeightForKey = (() => {
7276
style="position: absolute; top: 0; left: 0; width: 100%;"
7377
[style.transform]="'translateY(' + row.start + 'px)'"
7478
>
75-
<div [style.height.px]="randomHeight(row.key)">Row {{ row.index }}</div>
79+
<div [style.height.px]="randomHeight(row.key)">
80+
Row {{ row.index }}
81+
</div>
7682
</div>
7783
}
7884
</div>

packages/angular-virtual/e2e/app/src/app/stale-index.component.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,23 @@ function makeItems(count: number): Array<Item> {
2727
changeDetection: ChangeDetectionStrategy.OnPush,
2828
template: `
2929
<div>
30-
<button data-testid="remove-items" type="button" (click)="removeLastFive()">
30+
<button
31+
data-testid="remove-items"
32+
type="button"
33+
(click)="removeLastFive()"
34+
>
3135
Remove last 5
3236
</button>
3337
<div data-testid="item-count">Count: {{ items().length }}</div>
3438
@if (error()) {
3539
<div data-testid="error">{{ error() }}</div>
3640
}
3741
38-
<div #scrollElement data-testid="scroll-container" style="height: 300px; overflow: auto;">
42+
<div
43+
#scrollElement
44+
data-testid="scroll-container"
45+
style="height: 300px; overflow: auto;"
46+
>
3947
<div
4048
style="position: relative; width: 100%;"
4149
[style.height.px]="virtualizer.getTotalSize()"

packages/angular-virtual/e2e/app/tsconfig.app.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
"outDir": "./out-tsc/app",
55
"types": ["node"]
66
},
7-
"files": [
8-
"src/main.ts"
9-
],
10-
"include": [
11-
"src/**/*.d.ts"
12-
]
7+
"files": ["src/main.ts"],
8+
"include": ["src/**/*.d.ts"]
139
}

packages/angular-virtual/e2e/app/tsconfig.json

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,11 @@
1717
"target": "ES2022",
1818
"module": "ES2022",
1919
"useDefineForClassFields": false,
20-
"lib": [
21-
"ES2022",
22-
"dom"
23-
],
20+
"lib": ["ES2022", "dom"],
2421
"baseUrl": ".",
2522
"paths": {
26-
"@tanstack/angular-virtual": [
27-
"../../src/index.ts"
28-
],
29-
"@tanstack/virtual-core": [
30-
"../../../virtual-core/src/index.ts"
31-
]
23+
"@tanstack/angular-virtual": ["../../src/index.ts"],
24+
"@tanstack/virtual-core": ["../../../virtual-core/src/index.ts"]
3225
}
3326
},
3427
"angularCompilerOptions": {

packages/angular-virtual/src/index.ts

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ function injectVirtualizerBase<
7575
options: () => AngularVirtualizerOptions<TScrollElement, TItemElement>,
7676
extensions: AngularExtensionOptions = {},
7777
) {
78-
let injector = extensions.injector;
78+
let injector = extensions.injector
7979
if (!injector) {
8080
assertInInjectionContext(injectVirtualizerBase)
8181
injector = inject(Injector)
@@ -84,7 +84,9 @@ function injectVirtualizerBase<
8484
return runInInjectionContext(injector, () => {
8585
const scheduleDomFlush = injectScheduleDomFlushViaAppRefTick()
8686

87-
const resolvedOptions = computed<VirtualizerOptions<TScrollElement, TItemElement>>(() => {
87+
const resolvedOptions = computed<
88+
VirtualizerOptions<TScrollElement, TItemElement>
89+
>(() => {
8890
const { useApplicationRefTick = true, ..._options } = options()
8991
return {
9092
..._options,
@@ -98,14 +100,19 @@ function injectVirtualizerBase<
98100
}
99101
})
100102

101-
const lazyVirtualizer = computed(() => new Virtualizer(untracked(resolvedOptions)))
103+
const lazyVirtualizer = computed(
104+
() => new Virtualizer(untracked(resolvedOptions)),
105+
)
102106

103-
const reactiveVirtualizer = linkedSignal(() => {
104-
const virtualizer = lazyVirtualizer()
105-
// If setOptions does not call onChange, it's safe to call it here
106-
virtualizer.setOptions(resolvedOptions())
107-
return virtualizer
108-
}, { equal: () => false })
107+
const reactiveVirtualizer = linkedSignal(
108+
() => {
109+
const virtualizer = lazyVirtualizer()
110+
// If setOptions does not call onChange, it's safe to call it here
111+
virtualizer.setOptions(resolvedOptions())
112+
return virtualizer
113+
},
114+
{ equal: () => false },
115+
)
109116

110117
afterRenderEffect((cleanup) => {
111118
cleanup(lazyVirtualizer()._didMount())
@@ -150,10 +157,7 @@ function injectVirtualizerBase<
150157
'indexFromElement',
151158
],
152159
// Zero-arg methods exposed as computed signals
153-
[
154-
'getTotalSize',
155-
'getVirtualItems'
156-
],
160+
['getTotalSize', 'getVirtualItems'],
157161
// The rest is passed as is, and can be accessed or called before initialization
158162
) as unknown as AngularVirtualizer<TScrollElement, TItemElement>
159163
})
@@ -164,7 +168,10 @@ export function injectVirtualizer<
164168
TItemElement extends Element,
165169
>(
166170
options: () => PartialKeys<
167-
Omit<AngularVirtualizerOptions<TScrollElement, TItemElement>, 'getScrollElement'>,
171+
Omit<
172+
AngularVirtualizerOptions<TScrollElement, TItemElement>,
173+
'getScrollElement'
174+
>,
168175
'observeElementRect' | 'observeElementOffset' | 'scrollToFn'
169176
> & {
170177
scrollElement: ElementRef<TScrollElement> | TScrollElement | undefined
@@ -209,8 +216,7 @@ export function injectWindowVirtualizer<TItemElement extends Element>(
209216
observeElementRect: observeWindowRect,
210217
observeElementOffset: observeWindowOffset,
211218
scrollToFn: windowScroll,
212-
initialOffset: () =>
213-
typeof document !== 'undefined' ? window.scrollY : 0,
219+
initialOffset: () => (typeof document !== 'undefined' ? window.scrollY : 0),
214220
...options(),
215221
}))
216222
}

0 commit comments

Comments
 (0)