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

[TreeView] Clean label editing code #14264

Merged
merged 7 commits into from
Sep 2, 2024

Conversation

flaviendelangle
Copy link
Member

@flaviendelangle flaviendelangle commented Aug 19, 2024

No description provided.

@flaviendelangle flaviendelangle added the component: tree view TreeView, TreeItem. This is the name of the generic UI component, not the React module! label Aug 19, 2024
@flaviendelangle flaviendelangle self-assigned this Aug 19, 2024
@mui-bot
Copy link

mui-bot commented Aug 19, 2024

Deploy preview: https://deploy-preview-14264--material-ui-x.netlify.app/

Generated by 🚫 dangerJS against 3cb705c

@@ -1,8 +1,12 @@
export interface TreeItem2LabelInputProps extends React.InputHTMLAttributes<HTMLInputElement> {
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 should avoid to add props we don't actually use to the typing of our slots.
That way people implementing custom slots only need to support the props we actually need and not all the props we could theoretically use on our default slot component.

UseTreeViewLabelSignature,
} from './useTreeViewLabel.types';

export const isAndroid = () => navigator.userAgent.toLowerCase().includes('android');
Copy link
Member Author

Choose a reason for hiding this comment

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

Never used

@@ -76,5 +76,10 @@ export type UseTreeViewLabelSignature = TreeViewPluginSignature<{
experimentalFeatures: 'labelEditing';
dependencies: [UseTreeViewItemsSignature];
}>;
export interface UseTreeItem2LabelInputSlotPropsFromItemsReordering
Copy link
Member Author

Choose a reason for hiding this comment

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

Typo in the name and the props were never added to the typing of UseTreeItem2LabelInputSlotProps

const editable = instance.isItemEditable(itemId);

if (!editable) {
return {};
}

const handleKeydown = (
Copy link
Member Author

Choose a reason for hiding this comment

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

Move those two callbacks here, that way useTreeItem2 is totally agnostic of anything regarding this prop
We have some infos about label editing in other slots but nothing too important

@flaviendelangle flaviendelangle changed the title Label input cleanup [TreeView] Clean label editing code Aug 19, 2024
@flaviendelangle flaviendelangle marked this pull request as ready for review August 19, 2024 16:52
Copy link
Contributor

@noraleonte noraleonte left a comment

Choose a reason for hiding this comment

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

Thanks for taking care of this! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: tree view TreeView, TreeItem. 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.

3 participants