Skip to content

feat(Calendar): add prop overrideDayProps #8471

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

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

Conversation

EldarMuhamethanov
Copy link
Contributor


  • Unit-тесты
  • Release notes

Описание

Добавил свойство overrideDayProps, которое позволяет переопределять свойства ячейки календаря. Это можно использовать для более гибкой кастомизации и для добавления различных обработчиков

Release notes

Улучшения

  • Calendar: добавлено свойство overrideDayProps для переопределения свойств ячейки календаря
  • CalendarRange: добавлено свойство overrideDayProps для переопределения свойств ячейки календаря
  • DateInput: добавлено свойство overrideDayProps для переопределения свойств ячейки календаря
  • DateRangeInput: добавлено свойство overrideDayProps для переопределения свойств ячейки календаря

@EldarMuhamethanov EldarMuhamethanov requested a review from a team as a code owner April 14, 2025 15:07
Copy link
Contributor

github-actions bot commented Apr 14, 2025

size-limit report 📦

Path Size
JS 409.62 KB (+0.1% 🔺)
JS (gzip) 121.47 KB (+0.09% 🔺)
JS (brotli) 99.56 KB (+0.16% 🔺)
JS import Div (tree shaking) 1.56 KB (0%)
CSS 348.94 KB (0%)
CSS (gzip) 43.22 KB (0%)
CSS (brotli) 34.51 KB (0%)

Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Copy link
Contributor

e2e tests

⚠️ Some screenshots were failed. See Playwright Report.

Playwright Report

Copy link
Contributor

github-actions bot commented Apr 14, 2025

👀 Docs deployed

📦 Package ✅

yarn add @vkontakte/vkui@https://vkui-screenshot.hb.bizmrg.com/pull/8471/db4423f1171e7baee9e93231c391f27d8fac1575/pkg/@vkontakte/vkui/_pkg.tgz

Commit db4423f

Copy link
Contributor

@andrey-medvedev-vk andrey-medvedev-vk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Классная задумка 💯

@andrey-medvedev-vk
Copy link
Contributor

Конфликты появились

# Conflicts:
#	packages/vkui/src/components/Calendar/Calendar.test.tsx
#	packages/vkui/src/components/CalendarDays/CalendarDays.tsx
Copy link

codecov bot commented Apr 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.60%. Comparing base (2ab8533) to head (db4423f).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #8471   +/-   ##
=======================================
  Coverage   95.60%   95.60%           
=======================================
  Files         414      414           
  Lines       11824    11830    +6     
  Branches     3917     3920    +3     
=======================================
+ Hits        11304    11310    +6     
  Misses        520      520           
Flag Coverage Δ
unittests 95.60% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@andrey-medvedev-vk andrey-medvedev-vk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥇

* })
* ```
*/
overrideDayProps?: (value: Date) => Partial<Omit<CalendarDayProps, 'day' | 'renderDayContent'>>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Может расширим dayProps, чтобы можно было функцию передать? Новый проп звучит излишне

В любом случае, пока не совсем понял практического смысла в issue #7690 🤔 Если брать пример из jsdoc, то disabled конкретного дня можно достичь через shouldDisableDate, onChange у <Calendar /> и так будет вызван с нужным днём, а className для кастомизации не одобряем

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В любом случае, пока не совсем понял практического смысла в issue #7690

Вообще у CalendarDay есть много свойств, которые нельзя переопределить снаружи. НО возможно эти свойства и не нужно переопределять снаружи. Сложно придумать кейс, как это применить. Возможно стоит пока отложить это issue до еще запросов

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.

[Feature]: DateInput - добавить свойство для прокидывания props в CalendarDay
3 participants