Skip to content

Commit

Permalink
Merge branch 'main' into splincode/deep-change
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode authored Dec 13, 2024
2 parents ba6713a + f8ea2f2 commit 3148f6c
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/after-close-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ jobs:
steps:
- uses: actions/[email protected]
- 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
env:
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -10,11 +10,18 @@ import {BehaviorSubject} from 'rxjs';
'[tuiDropdownOpen]:not([tuiDropdown]),[tuiDropdownOpenChange]:not([tuiDropdown])',
})
export class TuiDropdownOpenLegacy {
private readonly openStateSub = new Subject<boolean>();

@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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
documentationPropertyName="total"
documentationPropertyType="number"
[(documentationPropertyValue)]="total"
(documentationPropertyValueChange)="totalChange($event)"
>
Total amount of items/lines in the table.
</ng-template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}

0 comments on commit 3148f6c

Please sign in to comment.