Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(kit): CalendarRange switch months if any input updated, when date range selected #9665

Merged
merged 1 commit into from
Nov 5, 2024

Conversation

mdlufy
Copy link
Collaborator

@mdlufy mdlufy commented Nov 1, 2024

Fixes #9608

When defaultViewedMonth updated (or other input), it transmit value to directly to the calendar (regardless of ngOnChanges existence and it's logic). For others changing properties need not trigger logic inside ngOnChanges, when value is selected

calendar-range.component.ts

@Input()
public defaultViewedMonth: TuiMonth = TuiMonth.currentLocal();

calendar-range.template.ts

tui-calendar
    ...
    [maxViewedMonth]="items.length ? null : (defaultViewedMonth | tuiMapper: monthOffset : -1)"
    [month]="defaultViewedMonth"
    ...
/>
<tui-calendar
   ...
    [minViewedMonth]="defaultViewedMonth | tuiMapper: monthOffset : 1"
    [month]="defaultViewedMonth | tuiMapper: monthOffset : 1"
   ...
/>

So we need not to update month, if it comes new input and anyone value is selected in calendar:

@Input()
public set defaultViewedMonth(month: TuiMonth) {
    if (!this.value) {
        this.month = month;
    }
}

And for others properties, which may be changed inside ngOnChanges logic, we need not to trigger if value is selected:

public ngOnChanges(): void {
    if (!this.value) {
        this.initDefaultViewedMonth();
    }
}

@mdlufy mdlufy changed the title fix(kit): CalendarRange switch to new defaultViewedMonth when sel… fix(kit): CalendarRange switch to new defaultViewedMonth when selected value Nov 1, 2024
Copy link

lumberjack-bot bot commented Nov 1, 2024

Pull request was closed ✔️

All saved screenshots (for current PR) were deleted 🗑️

Copy link
Contributor

github-actions bot commented Nov 1, 2024

Visit the preview URL for this PR (updated for commit 4c83c59):

https://taiga-previews--pr9665-mdlufy-calendar-swit-drqehfzy.web.app

(expires Sat, 02 Nov 2024 21:55:13 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 20bbff1ad19772ecf9c5134a84c0641b0d776f4a

Copy link

bundlemon bot commented Nov 1, 2024

BundleMon

Files updated (1)
Status Path Size Limits
demo/browser/main.(hash).js
298.49KB (+22B +0.01%) +10%
Unchanged files (4)
Status Path Size Limits
demo/browser/vendor.(hash).js
259.74KB +10%
demo/browser/runtime.(hash).js
43.41KB +10%
demo/browser/styles.(hash).css
19.61KB +10%
demo/browser/polyfills.(hash).js
11.18KB +10%

Total files change +22B 0%

Groups updated (1)
Status Path Size Limits
demo/browser/*..js
7.23MB (+22B 0%) -

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

@mdlufy mdlufy marked this pull request as ready for review November 1, 2024 22:11
@mdlufy mdlufy requested a review from a team as a code owner November 1, 2024 22:11
@mdlufy mdlufy requested review from MarsiBarsi, waterplea, nsbarsukov and vladimirpotekhin and removed request for a team November 1, 2024 22:11
@mdlufy mdlufy changed the title fix(kit): CalendarRange switch to new defaultViewedMonth when selected value fix(kit): CalendarRange switch to new input defaultViewedMonth value when selected date range value Nov 1, 2024
@mdlufy mdlufy changed the title fix(kit): CalendarRange switch to new input defaultViewedMonth value when selected date range value fix(kit): CalendarRange switch months if any input updated, when date range selected Nov 1, 2024
@vladimirpotekhin vladimirpotekhin merged commit f43bc2b into main Nov 5, 2024
28 checks passed
@vladimirpotekhin vladimirpotekhin deleted the mdlufy/calendar-switching branch November 5, 2024 08:23
shiv9604 pushed a commit to shiv9604/taiga-ui that referenced this pull request Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

🐞 - CalendarRange switch months if any input updated, when date range selected
3 participants