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

refactor(calendar): range logic #1190

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

reme3d2y
Copy link
Contributor

@reme3d2y reme3d2y commented May 2, 2024

Предлагаемые изменения в Calendar

Т.к. основной запрос был на предоставление более удобного апи для выбора периода в компоненте Calendar, то предлагаю следующие изменения:

  1. Не делать мажоррку, либо компонент V2, а только добавить в текущее апи возможность работы с диапазонами дат.
  2. Добавить проп mode?: 'single' | 'range';
  3. По аналогии с UniversalDateInput добавить проп rangeBehavior и избавить пользователя от необходимости самому настраивать хуки usePeriod и usePeriodWithReset.
  4. Изменить тип value на value?: number | { dateFrom?: number; dateTo?: number };
  5. Изменить тип onChange на (date: number, dateTo?: number) => void

Кажется, что данных изменений будет достаточно, чтобы решить основные проблемы с текущим компонентом, а также не сломать обратную совместимость и не заставлять пользователей переезжать на новый компонент.

Copy link

changeset-bot bot commented May 2, 2024

🦋 Changeset detected

Latest commit: b5ecd39

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@alfalab/core-components-calendar Minor
@alfalab/core-components-calendar-input Patch
@alfalab/core-components-calendar-range Patch
@alfalab/core-components-calendar-with-skeleton Patch
@alfalab/core-components-date-range-input Patch
@alfalab/core-components-date-time-input Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@core-ds-bot
Copy link
Collaborator

core-ds-bot commented May 2, 2024

Bundle size report

Entry point Size (minified)
date-time-input/index.js 233.1 (+2.40 KB🔺)
date-time-input/mobile.js 231.8 (+2.40 KB🔺)
calendar/desktop.js 66.7 (+2.20 KB🔺)
calendar/index.js 171.5 (+2.40 KB🔺)
calendar/mobile.js 171.4 (+2.40 KB🔺)
calendar-with-skeleton/index.js 67.8 (+2.20 KB🔺)
calendar-input/desktop.js 137.7 (+2.10 KB🔺)
calendar-input/index.js 234.2 (+2.40 KB🔺)
calendar-input/mobile.js 233.3 (+2.40 KB🔺)

@coveralls
Copy link

coveralls commented May 2, 2024

Pull Request Test Coverage Report for Build 9080530986

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 35 of 52 (67.31%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.1%) to 84.277%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/calendar/src/useRange.ts 21 29 72.41%
packages/calendar/src/components/calendar-mobile/Component.tsx 5 14 35.71%
Totals Coverage Status
Change from base Build 8860391082: -0.1%
Covered Lines: 9550
Relevant Lines: 10461

💛 - Coveralls

@core-ds-bot
Copy link
Collaborator

Собрана новая демка.

@SiebenSieben SiebenSieben requested review from amodanov, vepavlenko, Atcad, fulcanellee and Oladii and removed request for Atcad May 2, 2024 16:01
@amodanov amodanov requested review from amodanov and removed request for amodanov May 6, 2024 14:46
@core-ds-bot
Copy link
Collaborator

Собрана новая демка.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants