From 4c551549c96df0ba972a038c39ce134adcc9cbe1 Mon Sep 17 00:00:00 2001 From: Alexander Popoff Date: Wed, 25 Dec 2024 16:06:54 +0200 Subject: [PATCH] mui-x-tree-view.version=7.23.2 --- .../src/main/kotlin/karakum/mui/Generator.kt | 2 +- .../src/main/kotlin/karakum/mui/KotlinType.kt | 10 ++-- .../kotlin/karakum/mui/adapters/Classes.kt | 11 ++++- gradle.properties | 2 +- .../kotlin/muix/tree/view/TreeItem.classes.kt | 11 ++++- .../kotlin/muix/tree/view/TreeItem.types.kt | 6 ++- .../muix/tree/view/TreeItem2LabelInput.kt | 10 ++++ .../tree/view/TreeItem2LabelInput.types.kt | 22 +++++++++ .../kotlin/muix/tree/view/TreeItemContent.kt | 13 ++++-- .../jsMain/kotlin/muix/tree/view/TreeView.kt | 2 +- package-lock.json | 46 +++++++++++-------- 11 files changed, 101 insertions(+), 34 deletions(-) create mode 100644 mui-kotlin/src/jsMain/kotlin/muix/tree/view/TreeItem2LabelInput.kt create mode 100644 mui-kotlin/src/jsMain/kotlin/muix/tree/view/TreeItem2LabelInput.types.kt diff --git a/buildSrc/src/main/kotlin/karakum/mui/Generator.kt b/buildSrc/src/main/kotlin/karakum/mui/Generator.kt index 1123b9a61..26be23d95 100644 --- a/buildSrc/src/main/kotlin/karakum/mui/Generator.kt +++ b/buildSrc/src/main/kotlin/karakum/mui/Generator.kt @@ -529,7 +529,7 @@ private fun generateTreeViewDeclarations( generate(typesFile, targetDir, Package.treeView) } - "TreeView", "SimpleTreeView", "RichTreeView", "TreeItem2DragAndDropOverlay" -> { + "TreeView", "SimpleTreeView", "RichTreeView", "TreeItem2LabelInput", "TreeItem2DragAndDropOverlay" -> { val typesFile = it.resolve("${it.name}.types.d.ts") generate(typesFile, targetDir, Package.treeView) } diff --git a/buildSrc/src/main/kotlin/karakum/mui/KotlinType.kt b/buildSrc/src/main/kotlin/karakum/mui/KotlinType.kt index 40751a521..7c60c73b9 100644 --- a/buildSrc/src/main/kotlin/karakum/mui/KotlinType.kt +++ b/buildSrc/src/main/kotlin/karakum/mui/KotlinType.kt @@ -198,7 +198,9 @@ private val STANDARD_TYPE_MAP = mapOf( "React.HTMLAttributes" to "react.dom.html.HTMLAttributes", "Partial>" to "react.dom.html.HTMLAttributes", "React.HTMLAttributes" to "react.dom.html.HTMLAttributes", - "MuiCancellableEventHandler>" to "react.dom.events.KeyboardEventHandler", + "TreeViewCancellableEventHandler>" to "react.dom.events.KeyboardEventHandler", + "TreeViewCancellableEventHandler>" to "react.dom.events.KeyboardEventHandler", + "TreeViewCancellableEventHandler>" to "react.dom.events.FocusEventHandler", "NonNullable['tabIndex']>" to "Int", "React.InputHTMLAttributes['type']" to "InputType", @@ -414,13 +416,13 @@ internal fun kotlinType( return when (partialResult) { "TouchRippleProps", "NativeSelectInputProps", - -> DYNAMIC + -> DYNAMIC "StandardInputProps", - -> "InputProps" + -> "InputProps" "SelectProps", - -> "SelectProps<*>" + -> "SelectProps<*>" else -> STANDARD_TYPE_MAP[partialResult] ?: partialResult } diff --git a/buildSrc/src/main/kotlin/karakum/mui/adapters/Classes.kt b/buildSrc/src/main/kotlin/karakum/mui/adapters/Classes.kt index 3999707cf..298c859ee 100644 --- a/buildSrc/src/main/kotlin/karakum/mui/adapters/Classes.kt +++ b/buildSrc/src/main/kotlin/karakum/mui/adapters/Classes.kt @@ -19,12 +19,18 @@ private fun String.cleanupTreeItemContentClasses(): String { focused: string; /** State class applied to the element when disabled. */ disabled: string; - /** Styles applied to the tree item icon and collapse/expand icon. */ + /** Styles applied to the Tree Item icon and collapse/expand icon. */ iconContainer: string; /** Styles applied to the label element. */ label: string; /** Styles applied to the checkbox element. */ checkbox: string; + /** Styles applied to the input element that is visible when editing is enabled. */ + labelInput: string; + /** Styles applied to the content element when editing is enabled. */ + editing: string; + /** Styles applied to the content of the items that are editable. */ + editable: string; }; """, """ @@ -37,6 +43,9 @@ private fun String.cleanupTreeItemContentClasses(): String { iconContainer: string; label: string; checkbox: string; + labelInput: string; + editing: string; + editable: string; }; """, ) diff --git a/gradle.properties b/gradle.properties index e9af711c4..89e962525 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,7 +10,7 @@ mui-base.version=5.0.0-beta.40-0 mui-system.version=5.16.13 mui-lab.version=5.0.0-alpha.175 mui-x-date-pickers.version=5.0.20 -mui-x-tree-view.version=7.12.0 +mui-x-tree-view.version=7.23.2 # Flags org.gradle.jvmargs=-Xms2g -Xmx4g org.gradle.parallel=true diff --git a/mui-kotlin/src/jsMain/kotlin/muix/tree/view/TreeItem.classes.kt b/mui-kotlin/src/jsMain/kotlin/muix/tree/view/TreeItem.classes.kt index 65375ad83..24cc89245 100644 --- a/mui-kotlin/src/jsMain/kotlin/muix/tree/view/TreeItem.classes.kt +++ b/mui-kotlin/src/jsMain/kotlin/muix/tree/view/TreeItem.classes.kt @@ -28,7 +28,7 @@ sealed external interface TreeItemClasses { /** State class applied to the element when disabled. */ val disabled: ClassName - /** Styles applied to the tree item icon. */ + /** Styles applied to the Tree Item icon. */ val iconContainer: ClassName /** Styles applied to the label element. */ @@ -37,6 +37,15 @@ sealed external interface TreeItemClasses { /** Styles applied to the checkbox element. */ val checkbox: ClassName + /** Styles applied to the input element that is visible when editing is enabled. */ + val labelInput: ClassName + + /** Styles applied to the content element when editing is enabled. */ + val editing: ClassName + + /** Styles applied to the content of the items that are editable. */ + val editable: ClassName + /** Styles applied to the drag and drop overlay. */ val dragAndDropOverlay: ClassName } diff --git a/mui-kotlin/src/jsMain/kotlin/muix/tree/view/TreeItem.types.kt b/mui-kotlin/src/jsMain/kotlin/muix/tree/view/TreeItem.types.kt index 769957a44..f9bc39a95 100644 --- a/mui-kotlin/src/jsMain/kotlin/muix/tree/view/TreeItem.types.kt +++ b/mui-kotlin/src/jsMain/kotlin/muix/tree/view/TreeItem.types.kt @@ -37,12 +37,14 @@ external interface TreeItemProps : /** * The component used to render the content of the item. + * @deprecated Consider using the `` component or the `useTreeItem2` hook instead. For more details, see https://mui.com/x/react-tree-view/tree-item-customization/. * @default TreeItemContent */ var ContentComponent: react.ComponentType? /** * Props applied to ContentComponent. + * @deprecated Consider using the `` component or the `useTreeItem2` hook instead. For more details, see https://mui.com/x/react-tree-view/tree-item-customization/. */ var ContentProps: react.Props? /* React.HTMLAttributes & { ref?: React.Ref; } */ @@ -60,7 +62,7 @@ external interface TreeItemProps : override var onFocus: react.dom.events.FocusEventHandler? /** - * The tree item label. + * The Tree Item label. */ var label: react.ReactNode? @@ -97,7 +99,7 @@ external interface TreeItemSlots { var endIcon: react.ElementType<*>? /** - * The icon to display next to the tree item's label. + * The icon to display next to the Tree Item's label. */ var icon: react.ElementType<*>? diff --git a/mui-kotlin/src/jsMain/kotlin/muix/tree/view/TreeItem2LabelInput.kt b/mui-kotlin/src/jsMain/kotlin/muix/tree/view/TreeItem2LabelInput.kt new file mode 100644 index 000000000..7414211e1 --- /dev/null +++ b/mui-kotlin/src/jsMain/kotlin/muix/tree/view/TreeItem2LabelInput.kt @@ -0,0 +1,10 @@ +// Automatically generated - do not modify! + +@file:JsModule("@mui/x-tree-view/TreeItem2LabelInput") + +package muix.tree.view + +/** + * @ignore - internal component. + */ +external val TreeItem2LabelInput: react.FC diff --git a/mui-kotlin/src/jsMain/kotlin/muix/tree/view/TreeItem2LabelInput.types.kt b/mui-kotlin/src/jsMain/kotlin/muix/tree/view/TreeItem2LabelInput.types.kt new file mode 100644 index 000000000..9cb4ca546 --- /dev/null +++ b/mui-kotlin/src/jsMain/kotlin/muix/tree/view/TreeItem2LabelInput.types.kt @@ -0,0 +1,22 @@ +// Automatically generated - do not modify! + +package muix.tree.view + +external interface TreeItem2LabelInputProps : react.Props { + var value: String? + + /** + * Used to determine if the target of keydown or blur events is the input and prevent the event from propagating to the root. + */ + // var `data-element`: mui.system.Union? /* 'labelInput' */ + + var onChange: react.dom.events.ChangeEventHandler? + + var onKeyDown: react.dom.events.KeyboardEventHandler? + + var onBlur: react.dom.events.FocusEventHandler? + + var autoFocus: Boolean? /* true */ + + var type: mui.system.Union? /* 'text' */ +} diff --git a/mui-kotlin/src/jsMain/kotlin/muix/tree/view/TreeItemContent.kt b/mui-kotlin/src/jsMain/kotlin/muix/tree/view/TreeItemContent.kt index c23d59a1f..8b3a088fc 100644 --- a/mui-kotlin/src/jsMain/kotlin/muix/tree/view/TreeItemContent.kt +++ b/mui-kotlin/src/jsMain/kotlin/muix/tree/view/TreeItemContent.kt @@ -25,10 +25,13 @@ external interface TreeItemContentProps : val iconContainer: ClassName val label: ClassName val checkbox: ClassName + val labelInput: ClassName + val editing: ClassName + val editable: ClassName } /** - * The tree item label. + * The Tree Item label. */ var label: react.ReactNode? @@ -38,21 +41,23 @@ external interface TreeItemContentProps : var itemId: String /** - * The icon to display next to the tree item's label. + * The icon to display next to the Tree Item's label. */ var icon: react.ReactNode? /** - * The icon to display next to the tree item's label. Either an expansion or collapse icon. + * The icon to display next to the Tree Item's label. Either an expansion or collapse icon. */ var expansionIcon: react.ReactNode? /** - * The icon to display next to the tree item's label. Either a parent or end icon. + * The icon to display next to the Tree Item's label. Either a parent or end icon. */ var displayIcon: react.ReactNode? var dragAndDropOverlayProps: TreeItem2DragAndDropOverlayProps? + + var labelInputProps: TreeItem2LabelInputProps? } /** diff --git a/mui-kotlin/src/jsMain/kotlin/muix/tree/view/TreeView.kt b/mui-kotlin/src/jsMain/kotlin/muix/tree/view/TreeView.kt index 95abe0a34..d76cf8012 100644 --- a/mui-kotlin/src/jsMain/kotlin/muix/tree/view/TreeView.kt +++ b/mui-kotlin/src/jsMain/kotlin/muix/tree/view/TreeView.kt @@ -5,7 +5,7 @@ package muix.tree.view /** - * This component has been deprecated in favor of the new `SimpleTreeView` component. + * This component has been deprecated in favor of the new Simple Tree View component. * You can have a look at how to migrate to the new component in the v7 [migration guide](https://mui.com/x/migration/migration-tree-view-v6/#use-simpletreeview-instead-of-treeview) * * Demos: diff --git a/package-lock.json b/package-lock.json index 53c0231cc..03051eec3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1248,13 +1248,13 @@ } }, "node_modules/@mui/x-internals": { - "version": "7.12.0", - "resolved": "https://registry.npmjs.org/@mui/x-internals/-/x-internals-7.12.0.tgz", - "integrity": "sha512-zgu/JqSXBflSvtzfFN8lNi5Wxw79czBv6V/crOrXqCCOzxAIsrcup2FZlwvXlzetm3otS7o/Tzfo/O5dE68NkA==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@mui/x-internals/-/x-internals-7.23.0.tgz", + "integrity": "sha512-bPclKpqUiJYIHqmTxSzMVZi6MH51cQsn5U+8jskaTlo3J4QiMeCYJn/gn7YbeR9GOZFp8hetyHjoQoVHKRXCig==", "license": "MIT", "dependencies": { - "@babel/runtime": "^7.25.0", - "@mui/utils": "^5.16.5" + "@babel/runtime": "^7.25.7", + "@mui/utils": "^5.16.6 || ^6.0.0" }, "engines": { "node": ">=14.0.0" @@ -1264,20 +1264,19 @@ "url": "https://opencollective.com/mui-org" }, "peerDependencies": { - "react": "^17.0.0 || ^18.0.0" + "react": "^17.0.0 || ^18.0.0 || ^19.0.0" } }, "node_modules/@mui/x-tree-view": { - "version": "7.12.0", - "resolved": "https://registry.npmjs.org/@mui/x-tree-view/-/x-tree-view-7.12.0.tgz", - "integrity": "sha512-zuj0//1k7Ku8hmKpnzy5zCqZRK8ocDChhD3nCFwEc9jndb0PnDqHMBPSrsZgFnmBiFdLt6bMtTY96d37pxp5Yg==", + "version": "7.23.2", + "resolved": "https://registry.npmjs.org/@mui/x-tree-view/-/x-tree-view-7.23.2.tgz", + "integrity": "sha512-/R/9/GSF311fVLOUCg7r+a/+AScYZezL0SJZPfsTOquL1RDPAFRZei7BZEivUzOSEELJc0cxLGapJyM6QCA7Zg==", "license": "MIT", "dependencies": { - "@babel/runtime": "^7.25.0", - "@mui/system": "^5.16.5", - "@mui/utils": "^5.16.5", - "@mui/x-internals": "7.12.0", - "@types/react-transition-group": "^4.4.10", + "@babel/runtime": "^7.25.7", + "@mui/utils": "^5.16.6 || ^6.0.0", + "@mui/x-internals": "7.23.0", + "@types/react-transition-group": "^4.4.11", "clsx": "^2.1.1", "prop-types": "^15.8.1", "react-transition-group": "^4.4.5" @@ -1292,9 +1291,18 @@ "peerDependencies": { "@emotion/react": "^11.9.0", "@emotion/styled": "^11.8.1", - "@mui/material": "^5.15.14", - "react": "^17.0.0 || ^18.0.0", - "react-dom": "^17.0.0 || ^18.0.0" + "@mui/material": "^5.15.14 || ^6.0.0", + "@mui/system": "^5.15.14 || ^6.0.0", + "react": "^17.0.0 || ^18.0.0 || ^19.0.0", + "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0" + }, + "peerDependenciesMeta": { + "@emotion/react": { + "optional": true + }, + "@emotion/styled": { + "optional": true + } } }, "node_modules/@popperjs/core": { @@ -2692,7 +2700,7 @@ "@mui/material": "5.16.13", "@mui/system": "5.16.13", "@mui/x-date-pickers": "5.0.20", - "@mui/x-tree-view": "7.12.0", + "@mui/x-tree-view": "7.23.2", "@popperjs/core": "^2.11.8", "react": "^19.0.0", "react-dom": "^19.0.0", @@ -2740,7 +2748,7 @@ "@mui/material": "5.16.13", "@mui/system": "5.16.13", "@mui/x-date-pickers": "5.0.20", - "@mui/x-tree-view": "7.12.0", + "@mui/x-tree-view": "7.23.2", "@popperjs/core": "^2.11.8", "react": "^19.0.0", "react-dom": "^19.0.0",