Browse Source

Merge pull request #26396 from abpframework/auto-merge-forward/rel-11.0-to-dev-136

Auto-merge forward rel-11.0 → dev
pull/26399/head
Volosoft Agent 3 weeks ago
committed by GitHub
parent
commit
359ea29598
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 3
      docs/en/package-version-changes.md
  2. 30
      docs/en/release-info/migration-guides/abp-10-7.md
  3. 6
      npm/ng-packs/package.json
  4. 4
      npm/ng-packs/packages/components/extensible/src/lib/components/extensible-table/extensible-table.component.html
  5. 11
      npm/ng-packs/packages/components/extensible/src/lib/components/extensible-table/extensible-table.component.ts
  6. 2
      npm/ng-packs/packages/components/package.json
  7. 9
      npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.ts
  8. 9
      npm/ng-packs/packages/identity/src/lib/components/users/users.component.ts
  9. 9
      npm/ng-packs/packages/tenant-management/src/lib/components/tenants/tenants.component.ts
  10. 4
      npm/ng-packs/packages/theme-shared/package.json
  11. 87
      npm/ng-packs/packages/theme-shared/src/lib/directives/ngx-datatable-default.directive.ts
  12. 88
      npm/ng-packs/packages/theme-shared/src/lib/directives/ngx-datatable-list.directive.ts
  13. 16
      npm/ng-packs/packages/theme-shared/src/lib/directives/set-ngx-datatable-input.ts

3
docs/en/package-version-changes.md

@ -11,6 +11,8 @@
| Package | Old Version | New Version | PR |
|---------|-------------|-------------|-----|
| @ng-bootstrap/ng-bootstrap | ~20.0.0 | ~21.0.0 | #26380 |
| @swimlane/ngx-datatable | ~22.0.0 | ~25.1.0 | #26380, #26381 |
| Devart.Data.Oracle.EFCore | 11.0.0.9 | 11.2.192.10 | #26147 |
| Microsoft.AspNetCore.Authentication.JwtBearer | 10.0.11 | 11.0.0-rc.3.26522.148 | #26147, #26340 |
| Microsoft.AspNetCore.Authentication.OpenIdConnect | 10.0.11 | 11.0.0-rc.3.26522.148 | #26147, #26340 |
@ -73,6 +75,7 @@
| System.Text.Encoding.CodePages | 10.0.11 | 11.0.0-rc.3.26522.148 | #26147, #26340 |
| System.Text.Encodings.Web | 10.0.11 | 11.0.0-rc.3.26522.148 | #26147, #26340 |
| System.Text.Json | 10.0.11 | 11.0.0-rc.3.26522.148 | #26147, #26340 |
| ng-zorro-antd | ~21.3.1 | ~22.1.0 | #26380 |
## 10.8.0-rc.1

30
docs/en/release-info/migration-guides/abp-10-7.md

@ -78,6 +78,36 @@ Only pass `--resource-api` when the components that consume the `GET` methods ar
> See the [Angular Service Proxies](../../framework/ui/angular/service-proxies.md) document and [#25761](https://github.com/abpframework/abp/pull/25761) for details.
### Angular UI dependencies
**Who is affected**
- Angular applications that pin `@swimlane/ngx-datatable`, `@ng-bootstrap/ng-bootstrap`, `ng-zorro-antd`, or `@angular/aria` below the versions below.
- Applications that bind `(sort)` or `(select)` on `ngx-datatable`, or set datatable inputs from TypeScript (`scrollbarH`, `page.pipe`, `bodyComponent`).
**What changed**
Published Angular packages now require UI libraries that accept Angular 22:
| Package | Old range | New range |
| --- | --- | --- |
| `@swimlane/ngx-datatable` | `~22.0.0` | `~25.1.0` |
| `@ng-bootstrap/ng-bootstrap` | `~20.0.0` | `~21.0.0` |
| `ng-zorro-antd` | `~21.3.1` | `~22.1.0` |
| `@angular/aria` (peer of permission, feature, and setting management) | `~21.2.0` | `~22.0.0` |
ngx-datatable 25 removes the `sort` and `select` outputs. Use `(sortsChange)` and `(selectedChange)`. `sortsChange` emits `SortPropDir[]`, not `{ sorts: [...] }`. Inputs such as `scrollbarH` and `messages` are signals and cannot be assigned. `offset` and `sorts` are models. `bodyComponent` is removed.
List pages that use the `default` and `list` directives do not need a template change. The stylesheet paths in `angular.json` are unchanged. ng-bootstrap 21 changes the accordion change detection strategy to `OnPush`.
**What to do**
Applications that do not pin these libraries and do not customize the datatable API only need to update the ABP packages and reinstall dependencies.
If you pin them, use the new ranges. Replace `(sort)` with `(sortsChange)` and `(select)` with `(selectedChange)`. Stop assigning datatable inputs from code.
> See [#26380](https://github.com/abpframework/abp/issues/26380) and [#26381](https://github.com/abpframework/abp/issues/26381) for details.
### BLOB Encryption and Content Pipeline
**Who is affected**

6
npm/ng-packs/package.json

@ -75,7 +75,7 @@
"@angular/router": "~22.1.0",
"@angular/ssr": "~22.1.0",
"@fortawesome/fontawesome-free": "^6.0.0",
"@ng-bootstrap/ng-bootstrap": "~20.0.0",
"@ng-bootstrap/ng-bootstrap": "~21.0.0",
"@ngneat/spectator": "~19.6.2",
"@ngx-validate/core": "^0.2.0",
"@nx/angular": "~22.7.5",
@ -96,7 +96,7 @@
"@swc/cli": "~0.7.10",
"@swc/core": "~1.15.8",
"@swc/helpers": "~0.5.23",
"@swimlane/ngx-datatable": "~22.0.0",
"@swimlane/ngx-datatable": "~25.1.0",
"@types/express": "~5.0.0",
"@types/jest": "~30.0.0",
"@types/node": "20.19.9",
@ -130,7 +130,7 @@
"lerna": "^4.0.0",
"lint-staged": "^13.0.0",
"ng-packagr": "~22.1.0",
"ng-zorro-antd": "~21.1.0",
"ng-zorro-antd": "~22.1.0",
"nx": "~22.7.5",
"postcss": "^8.0.0",
"postcss-import": "14.1.0",

4
npm/ng-packs/packages/components/extensible/src/lib/components/extensible-table/extensible-table.component.html

@ -7,13 +7,13 @@
[list]="list()"
[selectionType]="selectable() ? selectionType() : undefined"
(activate)="tableActivate.emit($event)"
(select)="onSelect($event)"
(selectedChange)="onSelect($event)"
[selected]="selected()"
(scroll)="onScroll($event)"
[scrollbarV]="infiniteScroll()"
[style.height]="getTableHeight()"
[loadingIndicator]="infiniteScroll() && isLoading()"
[footerHeight]="infiniteScroll() ? false : 50"
[footerHeight]="infiniteScroll() ? 0 : 50"
>
@if (effectiveRowDetailTemplate) {
@let detailRowHeight = effectiveRowDetailRowHeight();

11
npm/ng-packs/packages/components/extensible/src/lib/components/extensible-table/extensible-table.component.ts

@ -325,7 +325,7 @@ export class ExtensibleTableComponent<R = any> implements AfterViewInit, OnDestr
return visibleActions.length > 0;
}
onSelect({ selected }: { selected: any[] }) {
onSelect(selected: any[] = []) {
const selectedValue = this.selected();
selectedValue.splice(0, selectedValue.length);
selectedValue.push(...selected);
@ -338,8 +338,13 @@ export class ExtensibleTableComponent<R = any> implements AfterViewInit, OnDestr
}
const table = this.table();
const viewportHeight = table.bodyHeight;
const scrollHeight = table.bodyComponent.scrollHeight();
const viewportHeight = table.bodyHeight();
const scroller = table.element.querySelector('datatable-scroller');
const scrollHeight = scroller?.scrollHeight ?? 0;
if (!scroller || scrollHeight <= 0) {
return;
}
if (scrollEvent.offsetY + viewportHeight >= scrollHeight - this.scrollThreshold()) {
this.loadMoreSubject.next();

2
npm/ng-packs/packages/components/package.json

@ -12,7 +12,7 @@
},
"dependencies": {
"chart.js": "^3.5.1",
"ng-zorro-antd": "~21.3.1",
"ng-zorro-antd": "~22.1.0",
"@ctrl/tinycolor": "^4.0.0",
"tslib": "^2.0.0"
},

9
npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.ts

@ -148,8 +148,13 @@ export class RolesComponent {
}, 0);
}
sort(data: any) {
const { prop, dir } = data.sorts[0];
sort(data: { sorts?: { prop: string; dir: string }[] } | { prop: string; dir: string }[]) {
const sorts = Array.isArray(data) ? data : data?.sorts;
if (!sorts?.length) {
return;
}
const { prop, dir } = sorts[0];
this.list.sortKey = prop;
this.list.sortOrder = dir;
}

9
npm/ng-packs/packages/identity/src/lib/components/users/users.component.ts

@ -231,8 +231,13 @@ export class UsersComponent {
});
}
sort(data: any) {
const { prop, dir } = data.sorts[0];
sort(data: { sorts?: { prop: string; dir: string }[] } | { prop: string; dir: string }[]) {
const sorts = Array.isArray(data) ? data : data?.sorts;
if (!sorts?.length) {
return;
}
const { prop, dir } = sorts[0];
this.list.sortKey = prop;
this.list.sortOrder = dir;
}

9
npm/ng-packs/packages/tenant-management/src/lib/components/tenants/tenants.component.ts

@ -183,8 +183,13 @@ export class TenantsComponent {
}, 0);
}
sort(data: any) {
const { prop, dir } = data.sorts[0];
sort(data: { sorts?: { prop: string; dir: string }[] } | { prop: string; dir: string }[]) {
const sorts = Array.isArray(data) ? data : data?.sorts;
if (!sorts?.length) {
return;
}
const { prop, dir } = sorts[0];
this.list.sortKey = prop;
this.list.sortOrder = dir;
}

4
npm/ng-packs/packages/theme-shared/package.json

@ -9,10 +9,10 @@
"dependencies": {
"@abp/ng.core": "~11.0.0-rc.1",
"@fortawesome/fontawesome-free": "^6.0.0",
"@ng-bootstrap/ng-bootstrap": "~20.0.0",
"@ng-bootstrap/ng-bootstrap": "~21.0.0",
"@ngx-validate/core": "^0.2.0",
"@popperjs/core": "~2.11.0",
"@swimlane/ngx-datatable": "~22.0.0",
"@swimlane/ngx-datatable": "~25.1.0",
"bootstrap": "^5.0.0",
"tslib": "^2.0.0"
},

87
npm/ng-packs/packages/theme-shared/src/lib/directives/ngx-datatable-default.directive.ts

@ -1,29 +1,14 @@
import { DOCUMENT, isPlatformBrowser } from '@angular/common';
import {
AfterViewInit,
Directive,
HostBinding,
OnDestroy,
inject,
PLATFORM_ID,
input
} from '@angular/core';
import { Directive, HostBinding, inject, input } from '@angular/core';
import { ColumnMode, DatatableComponent } from '@swimlane/ngx-datatable';
import { fromEvent, Subscription } from 'rxjs';
import { debounceTime } from 'rxjs/operators';
import { setNgxDatatableInput } from './set-ngx-datatable-input';
@Directive({
// eslint-disable-next-line @angular-eslint/directive-selector
selector: 'ngx-datatable[default]',
exportAs: 'ngxDatatableDefault',
})
export class NgxDatatableDefaultDirective implements AfterViewInit, OnDestroy {
export class NgxDatatableDefaultDirective {
private table = inject(DatatableComponent);
private document = inject<MockDocument>(DOCUMENT);
private platformId = inject(PLATFORM_ID);
private subscription = new Subscription();
private resizeDiff = 0;
readonly class = input('material bordered');
@ -33,65 +18,11 @@ export class NgxDatatableDefaultDirective implements AfterViewInit, OnDestroy {
}
constructor() {
this.table.columnMode = ColumnMode.force;
this.table.footerHeight = 50;
this.table.headerHeight = 50;
this.table.rowHeight = 'auto';
this.table.scrollbarH = true;
this.table.virtualization = false;
}
private fixHorizontalGap(scroller: any) {
const { body, documentElement } = this.document;
if (isPlatformBrowser(this.platformId)) {
if (documentElement.scrollHeight !== documentElement.clientHeight) {
if (this.resizeDiff === 0) {
this.resizeDiff = window.innerWidth - body.offsetWidth;
scroller.scrollWidth -= this.resizeDiff;
}
} else {
scroller.scrollWidth += this.resizeDiff;
this.resizeDiff = 0;
}
}
}
private fixStyleOnWindowResize() {
if (isPlatformBrowser(this.platformId)) {
const subscription = fromEvent(window, 'resize')
.pipe(debounceTime(500))
.subscribe(() => {
const { scroller } = this.table.bodyComponent;
if (!scroller) return;
this.fixHorizontalGap(scroller);
});
this.subscription.add(subscription);
}
}
ngAfterViewInit() {
this.fixStyleOnWindowResize();
}
ngOnDestroy() {
this.subscription.unsubscribe();
setNgxDatatableInput(this.table.columnMode, ColumnMode.force);
setNgxDatatableInput(this.table.footerHeight, 50);
setNgxDatatableInput(this.table.headerHeight, 50);
setNgxDatatableInput(this.table.rowHeight, 'auto');
setNgxDatatableInput(this.table.scrollbarH, true);
setNgxDatatableInput(this.table.virtualization, false);
}
}
// fix: https://github.com/angular/angular/issues/20351
interface MockDocument {
body: MockBody;
documentElement: MockDocumentElement;
}
interface MockBody {
offsetWidth: number;
}
interface MockDocumentElement {
clientHeight: number;
scrollHeight: number;
}

88
npm/ng-packs/packages/theme-shared/src/lib/directives/ngx-datatable-list.directive.ts

@ -9,9 +9,9 @@ import {
DestroyRef,
ViewContainerRef,
Renderer2,
input
input,
} from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { outputToObservable, takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { distinctUntilChanged } from 'rxjs';
import { DatatableComponent } from '@swimlane/ngx-datatable';
import { ListService, LocalizationService } from '@abp/ng.core';
@ -20,6 +20,7 @@ import {
NGX_DATATABLE_MESSAGES,
} from '../tokens/ngx-datatable-messages.token';
import { SpinnerComponent } from '../components';
import { setNgxDatatableInput } from './set-ngx-datatable-input';
@Directive({
// eslint-disable-next-line @angular-eslint/directive-selector
@ -57,8 +58,8 @@ export class NgxDatatableListDirective implements OnChanges, OnInit, DoCheck {
if (!list.firstChange) return;
const { maxResultCount, page } = list.currentValue;
this.table.limit = maxResultCount;
this.table.offset = page;
setNgxDatatableInput(this.table.limit, maxResultCount);
this.table.offset.set(page);
}
protected subscribeToRequestStatus() {
@ -66,28 +67,28 @@ export class NgxDatatableListDirective implements OnChanges, OnInit, DoCheck {
const { emptyMessage, errorMessage } = this.ngxDatatableMessages || defaultNgxDatatableMessages;
requestStatus$.subscribe(status => {
this.table.loadingIndicator = false;
setNgxDatatableInput(this.table.loadingIndicator, false);
if (status === 'idle') {
return;
}
if (status === 'loading') {
this.table.messages.emptyMessage = undefined;
this.table.loadingIndicator = true;
this.setEmptyMessage(undefined);
setNgxDatatableInput(this.table.loadingIndicator, true);
this.cdRef.detectChanges();
this.updateLoadingIndicator();
return;
}
if (status === 'error') {
this.table.messages.emptyMessage = this.localizationService.instant(errorMessage);
this.setEmptyMessage(this.localizationService.instant(errorMessage));
this.viewContainerRef.clear();
this.cdRef.markForCheck();
}
if (status === 'success') {
this.table.messages.emptyMessage = this.localizationService.instant(emptyMessage);
this.setEmptyMessage(this.localizationService.instant(emptyMessage));
this.viewContainerRef.clear();
}
});
@ -113,7 +114,7 @@ export class NgxDatatableListDirective implements OnChanges, OnInit, DoCheck {
const spinnerElement = spinnerRef.location.nativeElement;
this.renderer.insertBefore(parent, spinnerElement, parent.firstChild);
const placeholderParent = placeholder?.parentNode as Element | null;
if (placeholderParent) {
this.renderer.removeChild(placeholderParent, placeholder);
@ -121,29 +122,37 @@ export class NgxDatatableListDirective implements OnChanges, OnInit, DoCheck {
}
protected setInitialValues() {
this.table.externalPaging = true;
this.table.externalSorting = true;
setNgxDatatableInput(this.table.externalPaging, true);
setNgxDatatableInput(this.table.externalSorting, true);
const { selectedMessage, totalMessage } =
this.ngxDatatableMessages || defaultNgxDatatableMessages;
this.table.messages = {
setNgxDatatableInput(this.table.messages, {
totalMessage: this.localizationService.instant(totalMessage),
selectedMessage: this.localizationService.instant(selectedMessage),
};
});
}
protected subscribeToSort() {
this.table.sort
outputToObservable(this.table.sorts)
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe(({ sorts: [{ prop, dir }] }) => {
.subscribe(sorts => {
if (!sorts.length) {
return;
}
const { prop, dir } = sorts[0];
const list = this.list();
if (prop === list.sortKey && list.sortOrder === 'desc') {
list.sortKey = '';
list.sortOrder = '';
this.table.sorts = [];
this.table.sorts.set([]);
this.cdRef.detectChanges();
} else {
return;
}
if (list.sortKey !== prop || list.sortOrder !== dir) {
list.sortKey = prop;
list.sortOrder = dir;
}
@ -151,33 +160,43 @@ export class NgxDatatableListDirective implements OnChanges, OnInit, DoCheck {
}
protected subscribeToPage() {
this.table.page.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(({ offset }) => {
this.setTablePage(offset);
});
outputToObservable(this.table.page)
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe(({ offset }) => {
this.setTablePage(offset);
});
}
protected subscribeToQuery() {
this.list().query$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => {
const offset = this.list().page;
if (this.table.offset !== offset) this.table.offset = offset;
});
this.list()
.query$.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe(() => {
const offset = this.list().page;
if (this.table.offset() !== offset) {
this.table.offset.set(offset);
}
});
}
protected setTablePage(pageNum: number) {
this.list().page = pageNum;
this.table.offset = pageNum;
this.table.offset.set(pageNum);
}
protected refreshPageIfDataExist() {
if (this.table.rows?.length < 1 && this.table.count > 0) {
let maxPage = Math.floor(Number(this.table.count / this.list().maxResultCount));
const rows = this.table.rows() ?? [];
const count = Number(this.table.count());
if (this.table.count < this.list().maxResultCount) {
if (rows.length < 1 && count > 0) {
const maxResultCount = this.list().maxResultCount;
let maxPage = Math.floor(count / maxResultCount);
if (count < maxResultCount) {
this.setTablePage(0);
return;
}
if (this.table.count % this.list().maxResultCount === 0) {
if (count % maxResultCount === 0) {
maxPage -= 1;
}
@ -189,4 +208,11 @@ export class NgxDatatableListDirective implements OnChanges, OnInit, DoCheck {
this.setTablePage(maxPage);
}
}
}
private setEmptyMessage(emptyMessage: string | undefined) {
setNgxDatatableInput(this.table.messages, {
...this.table.messages(),
emptyMessage,
});
}
}

16
npm/ng-packs/packages/theme-shared/src/lib/directives/set-ngx-datatable-input.ts

@ -0,0 +1,16 @@
import { ɵSIGNAL } from '@angular/core';
/**
* Writes an ngx-datatable signal input without replacing the signal function.
* Template bindings applied after construction still override these defaults.
*/
export function setNgxDatatableInput(inputSignal: object, value: unknown): void {
const node = (inputSignal as { [ɵSIGNAL]: NgxDatatableInputNode })[ɵSIGNAL];
const nextValue = node.transformFn ? node.transformFn(value) : value;
node.applyValueToInputSignal(node, nextValue);
}
interface NgxDatatableInputNode {
transformFn?: (value: unknown) => unknown;
applyValueToInputSignal(node: NgxDatatableInputNode, value: unknown): void;
}
Loading…
Cancel
Save