Skip to content

Commit 366161e

Browse files
authored
Merge pull request #356 from arturovt/refactor/angular-19
refactor: upgrade to Angular 19
2 parents 632d9aa + 7cb068c commit 366161e

File tree

78 files changed

+26456
-25120
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+26456
-25120
lines changed

README.md

+16-15
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,16 @@ A directive for [Angular](https://angular.io/) framework to provide unlimited bi
88
<p dir="rtl">
99
<sub>can donate? go <b><a href="https://github.com/dhilt/ngx-ui-scroll?sponsor=1">here</a></b></sub><sub> 👉 <br>make open-source world better</sub></p>
1010

11-
- [Compatibility](#compatibility)
1211
- [Motivation](#motivation)
1312
- [Features](#features)
1413
- [Getting](#getting)
1514
- [Usage](#usage)
1615
- [Settings](#settings)
1716
- [Adapter API](#adapter-api)
17+
- [Compatibility](#compatibility)
1818
- [Development](#development)
1919
<br>
2020

21-
<a name="compatibility" id="compatibility"></a>
22-
### Compatibility
23-
24-
The ngx-ui-scroll library has no breaking changes in its API, but there are inevitable changes in how it is built and distributed to the host app depending on the version of the Angular.
25-
26-
|ngx-ui-scroll|Angular|compiled|support|notes|
27-
|:--|:--|:--|:--|:--|
28-
|v1|5-12|View Engine|no|no dependencies (vscroll is not extracted)|
29-
|v2|5-12|View Engine|maintenance|vscroll is a bundle-dependency|
30-
|v3|12+|Ivy|active|vscroll is a peer-dependency|
31-
32-
So if the consumer app is view-engine compatible, you should use ngx-ui-scroll v2 which is in maintenance mode and under [v2-legacy](https://github.com/dhilt/ngx-ui-scroll/tree/v2-legacy) branch.
33-
3421
### Motivation
3522

3623
Scrolling large datasets may cause performance issues. Many DOM elements, many data-bindings, many event listeners... The common way to improve the performance is to render only a small portion of the dataset visible to a user. Other dataset elements that are not visible to a user are virtualized with upward and downward empty padding elements which should provide a consistent viewport with consistent scrollbar parameters.
@@ -229,7 +216,7 @@ Below is the list of invocable methods of the Adapter API with description and l
229216

230217
Along with the documented API there are some undocumented features that can be treated as experimental. They are not tested enough and might change over time. Some of them can be found on the [experimental tab](https://dhilt.github.io/ngx-ui-scroll/#experimental) of the demo app.
231218

232-
All of the Adapter methods are asynchronous, because they work with DOM and may take time to complete. For this purpose the Adapter methods return a Promise resolving at the moment when the Scroller terminates its internal processes, which were triggered by the invocation of the correspondent Adapter method. This is called the [Adapter Return API](https://dhilt.github.io/ngx-ui-scroll/#adapter#return-value). This promise has exactly the same nature as the promise of the [Adapter.relax method](https://dhilt.github.io/ngx-ui-scroll/#experimental#adapter-relax). Both "Relax" and "Return API" are the instruments of the App-Scroller processes normalization. It might be quite important to run some logic after the Scroller finishes its job and relaxes. Below is an example of how an explicit sequence of the Adapter methods can be safely implemented:
219+
All Adapter methods are asynchronous because they interact with the DOM, which can be a time-consuming operation. Each Adapter method returns a Promise that resolves when the Scroller has terminated all internal processes triggered by that specific method call. This is called the [Adapter Return API](https://dhilt.github.io/ngx-ui-scroll/#adapter#return-value). The Promise returned by each Adapter method has exactly the same nature as the promise of the [Adapter.relax method](https://dhilt.github.io/ngx-ui-scroll/#experimental#adapter-relax). Both the "Relax" method and the "Return API" serve as tools for normalizing App-Scroller processes. In many cases, it is crucial to perform certain logic only after the Scroller has finished its work and entered a relaxed state. Below is an example of how to safely implement a sequence of Adapter method calls:
233220

234221
```js
235222
const { adapter } = this.datasource;
@@ -243,6 +230,20 @@ console.log('Two-phase replacement done');
243230
For more information, see [Adapter demo page](https://dhilt.github.io/ngx-ui-scroll/#adapter).
244231

245232

233+
### Compatibility
234+
235+
The ngx-ui-scroll library has no breaking changes in its API, but there are inevitable changes in how it is built and distributed to the host app depending on the version of the Angular. This means that while your code using the library’s API remains compatible across versions, you may need to select the appropriate ngx-ui-scroll package version to match your Angular project’s build system and compatibility requirements.
236+
237+
|ngx-ui-scroll|Angular|compiled|vscroll (core)|support
238+
|:--|:--|:--|:--|:--|
239+
|v1|5-12|View Engine|no dependencies (vscroll is not extracted)|no
240+
|v2|5-12|View Engine|vscroll is a bundle-dependency|maintenance
241+
|v3|12+|Ivy|vscroll is a peer-dependency|maintenance
242+
|v4|17+|Ivy|vscroll is a peer-dependency|active
243+
244+
Note: Starting from v4, the @for block syntax is used instead of *ngFor.
245+
246+
246247
### Development
247248

248249
There are some npm scripts available from package.json:

demo/angular.json

+10-5
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,13 @@
2222
"main": "main.ts",
2323
"polyfills": "polyfills.ts",
2424
"tsConfig": "tsconfig.json",
25-
"assets": ["favicon.ico", "assets"],
26-
"styles": ["styles.css"],
25+
"assets": [
26+
"favicon.ico",
27+
"assets"
28+
],
29+
"styles": [
30+
"styles.css"
31+
],
2732
"scripts": []
2833
},
2934
"configurations": {
@@ -64,10 +69,10 @@
6469
"builder": "@angular-devkit/build-angular:dev-server",
6570
"configurations": {
6671
"production": {
67-
"browserTarget": "demo:build:production"
72+
"buildTarget": "demo:build:production"
6873
},
6974
"development": {
70-
"browserTarget": "demo:build:development"
75+
"buildTarget": "demo:build:development"
7176
}
7277
},
7378
"defaultConfiguration": "development"
@@ -78,4 +83,4 @@
7883
"cli": {
7984
"analytics": false
8085
}
81-
}
86+
}

demo/app/app.component.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import { filter } from 'rxjs/operators';
1010

1111
@Component({
1212
selector: 'app-root',
13-
templateUrl: './app.component.html'
13+
templateUrl: './app.component.html',
14+
standalone: false
1415
})
1516
export class AppComponent implements AfterViewInit, OnDestroy {
1617
hasLayout = true;

demo/app/samples/adapter.component.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { Component } from '@angular/core';
22

33
@Component({
44
selector: 'app-samples-adapter',
5-
templateUrl: './adapter.component.html'
5+
templateUrl: './adapter.component.html',
6+
standalone: false
67
})
78
export class AdapterComponent {
89
constructor() {}

demo/app/samples/adapter/adapter-relax.component.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import { Datasource } from 'ngx-ui-scroll';
77

88
@Component({
99
selector: 'app-adapter-relax',
10-
templateUrl: './adapter-relax.component.html'
10+
templateUrl: './adapter-relax.component.html',
11+
standalone: false
1112
})
1213
export class DemoAdapterRelaxComponent {
1314
demoContext = {

demo/app/samples/adapter/adapter-return-value.component.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import { demos } from '../../routes';
44

55
@Component({
66
selector: 'app-demo-adapter-return-value',
7-
templateUrl: './adapter-return-value.component.html'
7+
templateUrl: './adapter-return-value.component.html',
8+
standalone: false
89
})
910
export class DemoAdapterReturnValueComponent {
1011
demoConfig = demos.adapterMethods.map.returnValue;

demo/app/samples/adapter/append-prepend-sync.component.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import { Datasource } from 'ngx-ui-scroll';
1313

1414
@Component({
1515
selector: 'app-demo-append-prepend-sync',
16-
templateUrl: './append-prepend-sync.component.html'
16+
templateUrl: './append-prepend-sync.component.html',
17+
standalone: false
1718
})
1819
export class DemoAppendPrependSyncComponent {
1920
demoContext: DemoContext = {

demo/app/samples/adapter/append-prepend.component.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import { Datasource } from 'ngx-ui-scroll';
1313

1414
@Component({
1515
selector: 'app-demo-append-prepend',
16-
templateUrl: './append-prepend.component.html'
16+
templateUrl: './append-prepend.component.html',
17+
standalone: false
1718
})
1819
export class DemoAppendPrependComponent {
1920
demoContext: DemoContext = {

demo/app/samples/adapter/bof-eof.component.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ import { Datasource } from 'ngx-ui-scroll';
1414

1515
@Component({
1616
selector: 'app-demo-bof-eof',
17-
templateUrl: './bof-eof.component.html'
17+
templateUrl: './bof-eof.component.html',
18+
standalone: false
1819
})
1920
export class DemoBofEofComponent {
2021
demoContext: DemoContext = {

demo/app/samples/adapter/buffer-info.component.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import { Datasource } from 'ngx-ui-scroll';
1212

1313
@Component({
1414
selector: 'app-demo-buffer-info',
15-
templateUrl: './buffer-info.component.html'
15+
templateUrl: './buffer-info.component.html',
16+
standalone: false
1617
})
1718
export class DemoBufferInfoComponent {
1819
demoContext: DemoContext = {

demo/app/samples/adapter/check-size.component.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import { Datasource } from 'ngx-ui-scroll';
1313

1414
@Component({
1515
selector: 'app-demo-check-size',
16-
templateUrl: './check-size.component.html'
16+
templateUrl: './check-size.component.html',
17+
standalone: false
1718
})
1819
export class DemoCheckSizeComponent {
1920
demoContext: DemoContext = {

demo/app/samples/adapter/clip.component.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import { Datasource } from 'ngx-ui-scroll';
1212

1313
@Component({
1414
selector: 'app-demo-clip',
15-
templateUrl: './clip.component.html'
15+
templateUrl: './clip.component.html',
16+
standalone: false
1617
})
1718
export class DemoClipComponent {
1819
demoContext: DemoContext = {

demo/app/samples/adapter/first-last-visible-items.component.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ import { Datasource } from 'ngx-ui-scroll';
1414

1515
@Component({
1616
selector: 'app-demo-first-last-visible-items',
17-
templateUrl: './first-last-visible-items.component.html'
17+
templateUrl: './first-last-visible-items.component.html',
18+
standalone: false
1819
})
1920
export class DemoFirstLastVisibleItemsComponent {
2021
demoContext: DemoContext = {

demo/app/samples/adapter/init.component.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ import { Datasource } from 'ngx-ui-scroll';
1919
@Component({
2020
selector: 'app-demo-init',
2121
changeDetection: ChangeDetectionStrategy.OnPush,
22-
templateUrl: './init.component.html'
22+
templateUrl: './init.component.html',
23+
standalone: false
2324
})
2425
export class DemoInitComponent {
2526
demoContext: DemoContext = {

demo/app/samples/adapter/insert.component.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import { Datasource } from 'ngx-ui-scroll';
77

88
@Component({
99
selector: 'app-demo-insert',
10-
templateUrl: './insert.component.html'
10+
templateUrl: './insert.component.html',
11+
standalone: false
1112
})
1213
export class DemoInsertComponent {
1314
demoConfig = demos.adapterMethods.map.insert;

demo/app/samples/adapter/is-loading-extended.component.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import { Datasource } from 'ngx-ui-scroll';
1212

1313
@Component({
1414
selector: 'app-demo-is-loading-advanced',
15-
templateUrl: './is-loading-extended.component.html'
15+
templateUrl: './is-loading-extended.component.html',
16+
standalone: false
1617
})
1718
export class DemoIsLoadingExtendedComponent {
1819
demoContext: DemoContext = {

demo/app/samples/adapter/is-loading.component.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import { Datasource } from 'ngx-ui-scroll';
1212

1313
@Component({
1414
selector: 'app-demo-is-loading',
15-
templateUrl: './is-loading.component.html'
15+
templateUrl: './is-loading.component.html',
16+
standalone: false
1617
})
1718
export class DemoIsLoadingComponent {
1819
demoContext: DemoContext = {

demo/app/samples/adapter/items-count.component.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import { Datasource } from 'ngx-ui-scroll';
1212

1313
@Component({
1414
selector: 'app-demo-items-count',
15-
templateUrl: './items-count.component.html'
15+
templateUrl: './items-count.component.html',
16+
standalone: false
1617
})
1718
export class DemoItemsCountComponent {
1819
demoContext: DemoContext = {

demo/app/samples/adapter/package-info.component.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import { Datasource } from 'ngx-ui-scroll';
1212

1313
@Component({
1414
selector: 'app-demo-package-info',
15-
templateUrl: './package-info.component.html'
15+
templateUrl: './package-info.component.html',
16+
standalone: false
1617
})
1718
export class DemoPackageInfoComponent {
1819
demoContext: DemoContext = {

demo/app/samples/adapter/pause-resume.component.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import { Datasource } from 'ngx-ui-scroll';
88

99
@Component({
1010
selector: 'app-demo-pause-resume',
11-
templateUrl: './pause-resume.component.html'
11+
templateUrl: './pause-resume.component.html',
12+
standalone: false
1213
})
1314
export class DemoPauseResumeComponent {
1415
demoContext = {

demo/app/samples/adapter/reload.component.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import { Datasource } from 'ngx-ui-scroll';
1212

1313
@Component({
1414
selector: 'app-demo-reload',
15-
templateUrl: './reload.component.html'
15+
templateUrl: './reload.component.html',
16+
standalone: false
1617
})
1718
export class DemoReloadComponent {
1819
demoContext: DemoContext = {

demo/app/samples/adapter/remove.component.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import { Datasource } from 'ngx-ui-scroll';
1313

1414
@Component({
1515
selector: 'app-demo-remove',
16-
templateUrl: './remove.component.html'
16+
templateUrl: './remove.component.html',
17+
standalone: false
1718
})
1819
export class DemoRemoveComponent {
1920
demoContext: DemoContext = {

demo/app/samples/adapter/replace.component.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ interface MyItem {
1616

1717
@Component({
1818
selector: 'app-demo-replace',
19-
templateUrl: './replace.component.html'
19+
templateUrl: './replace.component.html',
20+
standalone: false
2021
})
2122
export class DemoReplaceComponent {
2223
demoContext: DemoContext = {

demo/app/samples/adapter/reset.component.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import { Datasource } from 'ngx-ui-scroll';
1212

1313
@Component({
1414
selector: 'app-demo-reset',
15-
templateUrl: './reset.component.html'
15+
templateUrl: './reset.component.html',
16+
standalone: false
1617
})
1718
export class DemoResetComponent {
1819
demoContext: DemoContext = {

demo/app/samples/adapter/update.component.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ interface MyItem {
1616

1717
@Component({
1818
selector: 'app-demo-update',
19-
templateUrl: './update.component.html'
19+
templateUrl: './update.component.html',
20+
standalone: false
2021
})
2122
export class DemoUpdateComponent {
2223
demoContext: DemoContext = {

demo/app/samples/common/basic.component.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import { IDatasource } from 'ngx-ui-scroll';
1212

1313
@Component({
1414
selector: 'app-demo-basic',
15-
templateUrl: './basic.component.html'
15+
templateUrl: './basic.component.html',
16+
standalone: false
1617
})
1718
export class DemoBasicComponent {
1819
demoContext: DemoContext = {

demo/app/samples/common/buffer-size.component.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import { IDatasource } from 'ngx-ui-scroll';
1212

1313
@Component({
1414
selector: 'app-demo-buffer-size',
15-
templateUrl: './buffer-size.component.html'
15+
templateUrl: './buffer-size.component.html',
16+
standalone: false
1617
})
1718
export class DemoBufferSizeComponent {
1819
demoContext: DemoContext = {

demo/app/samples/common/different-heights.component.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ interface MyItem {
1414

1515
@Component({
1616
selector: 'app-demo-different-heights',
17-
templateUrl: './different-heights.component.html'
17+
templateUrl: './different-heights.component.html',
18+
standalone: false
1819
})
1920
export class DemoDifferentHeightsComponent {
2021
settingsScope = demos.settings.map;

demo/app/samples/common/horizontal.component.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import { IDatasource } from 'ngx-ui-scroll';
1212

1313
@Component({
1414
selector: 'app-demo-horizontal',
15-
templateUrl: './horizontal.component.html'
15+
templateUrl: './horizontal.component.html',
16+
standalone: false
1617
})
1718
export class DemoHorizontalComponent {
1819
demoContext: DemoContext = {

demo/app/samples/common/infinite.component.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import { IDatasource } from 'ngx-ui-scroll';
1212

1313
@Component({
1414
selector: 'app-demo-infinite',
15-
templateUrl: './infinite.component.html'
15+
templateUrl: './infinite.component.html',
16+
standalone: false
1617
})
1718
export class DemoInfiniteComponent {
1819
demoContext: DemoContext = {

demo/app/samples/common/item-size.component.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import { IDatasource } from 'ngx-ui-scroll';
1212

1313
@Component({
1414
selector: 'app-demo-item-size',
15-
templateUrl: './item-size.component.html'
15+
templateUrl: './item-size.component.html',
16+
standalone: false
1617
})
1718
export class DemoItemSizeComponent {
1819
demoContext: DemoContext = {

demo/app/samples/common/min-max-indexes.component.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import { IDatasource } from 'ngx-ui-scroll';
1212

1313
@Component({
1414
selector: 'app-demo-min-max-indexes',
15-
templateUrl: './min-max-indexes.component.html'
15+
templateUrl: './min-max-indexes.component.html',
16+
standalone: false
1617
})
1718
export class DemoMinMaxIndexesComponent {
1819
demoContext: DemoContext = {

0 commit comments

Comments
 (0)