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

[pickers] Move the adapters interfaces to our repository #8412

Merged
merged 8 commits into from Apr 3, 2023

Conversation

flaviendelangle
Copy link
Member

@flaviendelangle flaviendelangle commented Mar 28, 2023

This is the 1st part of migrating the adapters inside our repository.

  • Stop using the IUtils from @date-io
  • Add all the methods and properties from IUtils on MuiPickersAdapter
  • Move MuiPickersAdapter in @mui/x-date-pickers/models
  • Add proper JSDoc to all the adapter methods (:sleepy:)
  • Deprecate the methods we are not using

@flaviendelangle flaviendelangle added the component: pickers This is the name of the generic UI component, not the React module! label Mar 28, 2023
@flaviendelangle flaviendelangle self-assigned this Mar 28, 2023
@mui-bot
Copy link

mui-bot commented Mar 28, 2023

Netlify deploy preview

Netlify deploy preview: https://deploy-preview-8412--material-ui-x.netlify.app/

Updated pages

No updates.

These are the results for the performance tests:

Test case Unit Min Max Median Mean σ
Filter 100k rows ms 677.6 1,433.8 1,433.8 986.78 264.171
Sort 100k rows ms 655.5 1,458.6 1,271.4 1,136.24 276.633
Select 100k rows ms 279.5 363.3 303.4 310.04 29.58
Deselect 100k rows ms 191 348.5 255.9 260.06 51.939

Generated by 🚫 dangerJS against ba1a40c

@@ -120,7 +120,6 @@ export type {
BaseNonStaticPickerProps,
} from './models/props/basePickerProps';
export type { BaseToolbarProps, ExportedBaseToolbarProps } from './models/props/toolbar';
export type { MuiPickersAdapter } from './models/muiPickersAdapter';
Copy link
Member

Choose a reason for hiding this comment

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

Just an idea: yes, it is our internals and we do not endorse using them externally as well as do not guarantee its API stability, but still, this could impact users, who have built their custom adapters. 🤔
Maybe releasing it (or keeping PR open until we see the need for a minor) with at least a minor bump would make more sense? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

Which part of this PR is impacting people who build their own adapter or use our adapters externally ?

If it's just the import path of the model MuiPickersAdapter, then it's in internals so I don't think we should care 👼

Copy link
Member

Choose a reason for hiding this comment

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

Well, yes, only the export location changes, it's internals, so, shouldn't be a big deal, but was just nitpicking that, as per semver suggestions, such change should be released at least as a minor. If not for the exclusion of internal export, then for the addition of new imports.
But in any case, it's just food for thought and just to consider, I'm not saying that we shouldn't or can't do whatever we see best. 👌

Copy link
Member Author

Choose a reason for hiding this comment

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

We can merge this PR for v6.1, with the 1st real feature that the pickers or the grid has 👍

packages/x-date-pickers/src/models/adapters.ts Outdated Show resolved Hide resolved
packages/x-date-pickers/src/models/adapters.ts Outdated Show resolved Hide resolved
packages/x-date-pickers/src/models/adapters.ts Outdated Show resolved Hide resolved
* @param {TDate} value The given date.
* @returns {number} The date of the given date.
*/
getDate(value: TDate): number;
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick: This method name always puzzled me... Why date, when it's working with day... 🤷 🙈
We can't change the method name now, but maybe we could at least provide a correct JSDoc? 🤔

P.S. Dayjs also has this confusing difference, but at least their doc specifies the correct output.

Copy link
Member Author

Choose a reason for hiding this comment

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

date comes from new Date().getDate() (which is not a great naming imho).

We can rename to a more explicit naming in v7 (getMonthDay for example).

Copy link
Member

@LukasTy LukasTy Mar 28, 2023

Choose a reason for hiding this comment

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

date comes from new Date().getDate() (which is not a great naming imho).

Well, it just proves that naming things is hard. 😆

IMHO, I'd be in favor of 🙈

  • getDay;
  • getDayOfWeek, getDayOfTheWeek, or getWeekDay;

packages/x-date-pickers/src/models/adapters.ts Outdated Show resolved Hide resolved
Copy link
Member

@LukasTy LukasTy left a comment

Choose a reason for hiding this comment

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

Great job improving the JSDoc descriptions! 👍 🥳

packages/x-date-pickers/src/models/adapters.ts Outdated Show resolved Hide resolved
packages/x-date-pickers/src/models/adapters.ts Outdated Show resolved Hide resolved
packages/x-date-pickers/src/models/adapters.ts Outdated Show resolved Hide resolved
packages/x-date-pickers/src/models/adapters.ts Outdated Show resolved Hide resolved
packages/x-date-pickers/src/models/adapters.ts Outdated Show resolved Hide resolved
packages/x-date-pickers/src/models/adapters.ts Outdated Show resolved Hide resolved
packages/x-date-pickers/src/models/adapters.ts Outdated Show resolved Hide resolved
packages/x-date-pickers/src/models/adapters.ts Outdated Show resolved Hide resolved
@flaviendelangle flaviendelangle merged commit d5a7530 into mui:master Apr 3, 2023
16 checks passed
@flaviendelangle flaviendelangle deleted the adapter-typing branch April 3, 2023 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: pickers This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants