From d26f32b11948a3060e7840a9844a6b97e8a58ef8 Mon Sep 17 00:00:00 2001 From: Vladimir Potekhin <46284632+vladimirpotekhin@users.noreply.github.com> Date: Thu, 12 Dec 2024 21:42:11 +0300 Subject: [PATCH 1/4] fix(addon-table): fix calculating start page (#9980) --- .../table-pagination/table-pagination.component.ts | 2 +- .../demo/src/modules/components/table-pagination/index.html | 1 + .../demo/src/modules/components/table-pagination/index.ts | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/projects/addon-table/components/table-pagination/table-pagination.component.ts b/projects/addon-table/components/table-pagination/table-pagination.component.ts index c407eb2fbfdc..bf7239d0314b 100644 --- a/projects/addon-table/components/table-pagination/table-pagination.component.ts +++ b/projects/addon-table/components/table-pagination/table-pagination.component.ts @@ -90,7 +90,7 @@ export class TuiTablePagination { } protected get start(): number { - return this.page * this.size; + return Math.min(this.page * this.size, Math.max(this.total - this.size, 0)); } protected get end(): number { diff --git a/projects/demo/src/modules/components/table-pagination/index.html b/projects/demo/src/modules/components/table-pagination/index.html index 746614bc7c0d..576d6d9ec005 100644 --- a/projects/demo/src/modules/components/table-pagination/index.html +++ b/projects/demo/src/modules/components/table-pagination/index.html @@ -59,6 +59,7 @@ documentationPropertyName="total" documentationPropertyType="number" [(documentationPropertyValue)]="total" + (documentationPropertyValueChange)="totalChange($event)" > Total amount of items/lines in the table. diff --git a/projects/demo/src/modules/components/table-pagination/index.ts b/projects/demo/src/modules/components/table-pagination/index.ts index 358bcae20497..c614458f0181 100644 --- a/projects/demo/src/modules/components/table-pagination/index.ts +++ b/projects/demo/src/modules/components/table-pagination/index.ts @@ -27,4 +27,9 @@ export default class Page { this.page = page; this.size = size; } + + protected totalChange(total: number): void { + this.total = total; + this.size = Math.min(this.size, Math.max(total, 1)); + } } From fc2c960da655b57acbc589f2bc46dfd9b61be1eb Mon Sep 17 00:00:00 2001 From: taiga-family-bot <140712314+taiga-family-bot@users.noreply.github.com> Date: Fri, 13 Dec 2024 05:59:15 +0300 Subject: [PATCH 2/4] chore: update w9jds/firebase-action action to v13.29.0 (#9982) --- .github/workflows/after-close-pr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/after-close-pr.yml b/.github/workflows/after-close-pr.yml index 15d468781eac..d6ad0d31c157 100644 --- a/.github/workflows/after-close-pr.yml +++ b/.github/workflows/after-close-pr.yml @@ -28,7 +28,7 @@ jobs: steps: - uses: actions/checkout@v4.2.2 - name: Drop e2e report site - uses: w9jds/firebase-action@v13.28.0 + uses: w9jds/firebase-action@v13.29.0 continue-on-error: true with: args: hosting:channel:delete ${{ env.channel }}-e2e --site taiga-previews-demo-e2e-report -f @@ -36,7 +36,7 @@ jobs: GCP_SA_KEY: ${{ secrets.FIREBASE_TAIGA_PREVIEWS_SA }} PROJECT_ID: taiga-previews - name: Drop preview demo site - uses: w9jds/firebase-action@v13.28.0 + uses: w9jds/firebase-action@v13.29.0 continue-on-error: true with: args: hosting:channel:delete ${{ env.channel }}-demo --site taiga-previews-demo -f From 9d0e6a72b133da6544166152acc4c8b20cb15d6f Mon Sep 17 00:00:00 2001 From: 40oleg <60510512+40oleg@users.noreply.github.com> Date: Fri, 13 Dec 2024 10:19:06 +0300 Subject: [PATCH 3/4] chore(demo): added forgotten import (#9981) --- projects/demo/src/modules/directives/swipe/examples/2/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/demo/src/modules/directives/swipe/examples/2/index.ts b/projects/demo/src/modules/directives/swipe/examples/2/index.ts index a333ebfae1f1..4011f863b622 100644 --- a/projects/demo/src/modules/directives/swipe/examples/2/index.ts +++ b/projects/demo/src/modules/directives/swipe/examples/2/index.ts @@ -2,13 +2,14 @@ import {AsyncPipe} from '@angular/common'; import {Component} from '@angular/core'; import {changeDetection} from '@demo/emulate/change-detection'; import {encapsulation} from '@demo/emulate/encapsulation'; +import {TuiSidebar} from '@taiga-ui/addon-mobile'; import type {TuiSwipeEvent} from '@taiga-ui/cdk'; import {TuiSwipe} from '@taiga-ui/cdk'; import {Subject} from 'rxjs'; @Component({ standalone: true, - imports: [AsyncPipe, TuiSwipe], + imports: [AsyncPipe, TuiSidebar, TuiSwipe], templateUrl: './index.html', styleUrls: ['./index.less'], encapsulation, From f8ea2f2d41351dae33362acee7dd12e99767eea2 Mon Sep 17 00:00:00 2001 From: "Shivprasad Kounsalye (Remote Angular Dev)" Date: Fri, 13 Dec 2024 13:30:23 +0530 Subject: [PATCH 4/4] fix(core): emit tuiDropdownOpenChange on distinct values (#9962) --- .../dropdown/dropdown-open-legacy.directive.ts | 13 ++++++++++--- .../legacy-dropdown-open-monitor.ts | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/projects/core/directives/dropdown/dropdown-open-legacy.directive.ts b/projects/core/directives/dropdown/dropdown-open-legacy.directive.ts index ded45fa8ffd5..1c1c4a98dc16 100644 --- a/projects/core/directives/dropdown/dropdown-open-legacy.directive.ts +++ b/projects/core/directives/dropdown/dropdown-open-legacy.directive.ts @@ -1,5 +1,5 @@ import {Directive, Input, Output} from '@angular/core'; -import {BehaviorSubject} from 'rxjs'; +import {distinctUntilChanged, Subject} from 'rxjs'; /** * @deprecated TODO: remove in v.5 when legacy controls are dropped @@ -10,11 +10,18 @@ import {BehaviorSubject} from 'rxjs'; '[tuiDropdownOpen]:not([tuiDropdown]),[tuiDropdownOpenChange]:not([tuiDropdown])', }) export class TuiDropdownOpenLegacy { + private readonly openStateSub = new Subject(); + @Output() - public readonly tuiDropdownOpenChange = new BehaviorSubject(false); + public readonly tuiDropdownOpenChange = + this.openStateSub.pipe(distinctUntilChanged()); @Input() public set tuiDropdownOpen(open: boolean) { - this.tuiDropdownOpenChange.next(open); + this.emitOpenChange(open); + } + + public emitOpenChange(open: boolean): void { + this.openStateSub.next(open); } } diff --git a/projects/legacy/directives/legacy-dropdown-open-monitor/legacy-dropdown-open-monitor.ts b/projects/legacy/directives/legacy-dropdown-open-monitor/legacy-dropdown-open-monitor.ts index 9fd6cb8fcf88..e0d027a48492 100644 --- a/projects/legacy/directives/legacy-dropdown-open-monitor/legacy-dropdown-open-monitor.ts +++ b/projects/legacy/directives/legacy-dropdown-open-monitor/legacy-dropdown-open-monitor.ts @@ -34,6 +34,6 @@ export class TuiLegacyDropdownOpenMonitorDirective implements AfterViewInit { this.host.driver .pipe(distinctUntilChanged(), takeUntilDestroyed(this.destroyRef)) - .subscribe((open) => this.external?.tuiDropdownOpenChange.next(open)); + .subscribe((open) => this.external?.emitOpenChange(open)); } }