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 should not distinguish ranges with same dates and different names #7822

Merged
merged 1 commit into from
Jun 21, 2024

Conversation

mdlufy
Copy link
Collaborator

@mdlufy mdlufy commented Jun 18, 2024

Closes #7781

Problem: on item select, control value hold only range, not considering name/content

onItemSelect(item: TuiDayRangePeriod | string): void {
        if (typeof item !== 'string') {
            this.updateValue(item.range.dayLimit(this.min, this.max));

            return;
        }

        if (this.activePeriod !== null) {
            this.updateValue(null);
        }
}

And when it attemps to get current active period, in finds only by range

private get activePeriod(): TuiDayRangePeriod | null {
        return (
            this.items.find(item =>
                tuiNullableSame<TuiDayRange>(
                    this.value,
                    item.range,
                    (a, b) =>
                        a.from.daySame(b.from.dayLimit(this.min, this.max)) &&
                        a.to.daySame(b.to.dayLimit(this.min, this.max)),
                ),
            ) || null
        );
}

Solutions:

  1. To hold current item index
  2. To hold TuiDayRangePeriod separately
  3. To hold TuiDayRangePeriod in value (breaking change)

Copy link

lumberjack-bot bot commented Jun 18, 2024

Pull request was closed ✔️

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

Copy link
Contributor

Visit the preview URL for this PR (updated for commit 90fbb0f):

https://taiga-previews--pr7822-mdlufy-calendar-rang-nbrz90rk.web.app

(expires Wed, 19 Jun 2024 14:36:50 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 20bbff1ad19772ecf9c5134a84c0641b0d776f4a

Copy link

bundlemon bot commented Jun 18, 2024

BundleMon

Files updated (2)
Status Path Size Limits
demo/browser/main.(hash).js
293.19KB (-27B -0.01%) +10%
demo/browser/runtime.(hash).js
40.52KB (-34B -0.08%) +10%
Unchanged files (3)
Status Path Size Limits
demo/browser/vendor.(hash).js
243.85KB +10%
demo/browser/styles.(hash).css
13.95KB +10%
demo/browser/polyfills.(hash).js
11.21KB +10%

Total files change -61B -0.01%

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

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

@splincode splincode added the v4 4.0 candidate label Jun 18, 2024
@mdlufy mdlufy marked this pull request as draft June 19, 2024 14:19
@mdlufy mdlufy force-pushed the mdlufy/calendar-range branch from 90fbb0f to c81e36d Compare June 20, 2024 13:35
@mdlufy mdlufy marked this pull request as ready for review June 20, 2024 13:38
Copy link
Contributor

github-actions bot commented Jun 20, 2024

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

https://taiga-ui--pr7822-mdlufy-calendar-rang-0x7ixx38.web.app

(expires Fri, 21 Jun 2024 14:44:23 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 4b5ece1e114386f6a105425ef799091475b249eb

@mdlufy mdlufy force-pushed the mdlufy/calendar-range branch from c81e36d to 9a64c94 Compare June 20, 2024 13:59
@mdlufy mdlufy force-pushed the mdlufy/calendar-range branch from 9a64c94 to 8933236 Compare June 20, 2024 14:40
@mdlufy mdlufy requested a review from splincode June 20, 2024 14:52
@splincode splincode merged commit f3533f0 into main Jun 21, 2024
28 checks passed
@splincode splincode deleted the mdlufy/calendar-range branch June 21, 2024 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

🐞 - calendar-range does not mark checked item from range if items with equal range periods
3 participants