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 #7804

Merged
merged 1 commit into from
Jun 20, 2024

Conversation

mdlufy
Copy link
Collaborator

@mdlufy mdlufy commented Jun 17, 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 17, 2024

Failed tests ❌

After <= Diff => Before

dropdown-selection/dropdown-selection.cy.ts/__diff_output__/1-2-dropdown-selection.diff.png
dropdown-selection/dropdown-selection.cy.ts/__diff_output__/1-3-dropdown-selection.diff.png
input/input-table.cy.ts/components/__diff_output__/input_table__2_1.diff.png

(updated for commit 5dc65a2)

Copy link
Contributor

github-actions bot commented Jun 17, 2024

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

https://taiga-ui--pr7804-mdlufy-fix-calendar-esvtn8ul.web.app

(expires Fri, 21 Jun 2024 14:47:42 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 4b5ece1e114386f6a105425ef799091475b249eb

Copy link

bundlemon bot commented Jun 17, 2024

BundleMon

Files added (5)
Status Path Size Limits
demo/browser/main.(hash).js
+392.36KB +10%
demo/browser/vendor.(hash).js
+214.57KB +10%
demo/browser/runtime.(hash).js
+41.32KB +10%
demo/browser/polyfills.(hash).js
+11.25KB +10%
demo/browser/styles.(hash).css
+1.39KB +10%

Total files change +660.9KB

Groups added (1)
Status Path Size Limits
demo/browser/*..js
+2.4MB -

Final result: ✅

View report in BundleMon website ➡️


Current branch size history

@mdlufy mdlufy marked this pull request as draft June 18, 2024 09:50
@mdlufy mdlufy force-pushed the mdlufy/fix-calendar-range branch 2 times, most recently from 858fe1e to e7dfb76 Compare June 18, 2024 10:40
@mdlufy mdlufy changed the title fix(kit): save current active period to distinguish periods with same… fix(kit): save current active period to distinguish periods with same date ranges Jun 18, 2024
@mdlufy mdlufy marked this pull request as ready for review June 18, 2024 10:44
@mdlufy mdlufy force-pushed the mdlufy/fix-calendar-range branch from e7dfb76 to 4d87003 Compare June 18, 2024 10:45
@splincode splincode added the v3 label Jun 18, 2024
@mdlufy mdlufy force-pushed the mdlufy/fix-calendar-range branch from 4d87003 to 5b3ec81 Compare June 18, 2024 14:31
@mdlufy mdlufy changed the title fix(kit): save current active period to distinguish periods with same date ranges fix(kit): CalendarRange should not distinguish ranges with same dates and different names Jun 18, 2024
@mdlufy mdlufy marked this pull request as draft June 19, 2024 14:19
@mdlufy mdlufy force-pushed the mdlufy/fix-calendar-range branch 2 times, most recently from cacdcd0 to 0dc6d1b Compare June 20, 2024 13:20
@mdlufy mdlufy marked this pull request as ready for review June 20, 2024 13:38
@mdlufy mdlufy force-pushed the mdlufy/fix-calendar-range branch from 0dc6d1b to 5dc65a2 Compare June 20, 2024 14:40
@mdlufy mdlufy requested a review from splincode June 20, 2024 14:52
@splincode splincode merged commit f5d60b2 into v3.x Jun 20, 2024
31 of 33 checks passed
@splincode splincode deleted the mdlufy/fix-calendar-range branch June 20, 2024 15:14
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.

3 participants