@mui/x-tree-view 6.0.0-alpha.4 → 6.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,90 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 6.16.0
7
+
8
+ _Sep 29, 2023_
9
+
10
+ We'd like to offer a big thanks to the 9 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🎁 Add a clearable behavior to all the single input pickers and fields (#9095) @noraleonte
13
+
14
+ The pickers and fields now have an out-of-the box implementation for clearing the field value. You can see the documentation for this behavior on the [Date Picker documentation](https://mui.com/x/react-date-pickers/date-picker/#clearing-the-value).
15
+
16
+ <img width="380" alt="Clearable behavior" src="https://github.com/mui/mui-x/assets/72460825/e4a66169-83b5-4579-b9f6-6e15bb528411">
17
+
18
+ - 💫 Add Date Picker customization playground (#9581) @noraleonte
19
+
20
+ You can play around with style customization options on the [Date Picker documentation](https://mui.com/x/react-date-pickers/date-picker/#customization).
21
+
22
+ We are thrilled to hear your feedback about this functionality!
23
+
24
+ - 🚀 Fix header filters menu auto closing on render (#10483) @MBilalShafi
25
+ - 🎯 Fix column headers scroll when theme scoping is used (#10437) @cherniavskii
26
+ - 🌍 Improve Russian (ru-RU) locale on the data grid
27
+ - 🐞 Bugfixes
28
+ - 📚 Documentation improvements
29
+
30
+ ### Data Grid
31
+
32
+ #### `@mui/x-data-grid@6.16.0`
33
+
34
+ - [DataGrid] Fix column headers scroll when theme scoping is used (#10437) @cherniavskii
35
+ - [DataGrid] Rename `global` to `globalScope` due to Jest issue (#10470) @romgrk
36
+ - [l10n] Improve Russian (ru-RU) locale (#10464 and #10407) @NKodos
37
+
38
+ #### `@mui/x-data-grid-pro@6.16.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
39
+
40
+ Same changes as in `@mui/x-data-grid@6.16.0`, plus:
41
+
42
+ - [DataGridPro] Fix header filters menu auto closing on render (#10483) @MBilalShafi
43
+
44
+ #### `@mui/x-data-grid-premium@6.16.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
45
+
46
+ Same changes as in `@mui/x-data-grid-pro@6.16.0`.
47
+
48
+ ### Date Pickers
49
+
50
+ #### `@mui/x-date-pickers@6.16.0`
51
+
52
+ - [pickers] Add warning to `shouldDisableDate` validation (#10502) @michelengelen
53
+ - [pickers] Implement `clearable` field behavior (#9095) @noraleonte
54
+ - [pickers] Refactor `dayOfWeekFormatter` (#10345) @michelengelen
55
+
56
+ #### `@mui/x-date-pickers-pro@6.16.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
57
+
58
+ Same changes as in `@mui/x-date-pickers@6.16.0`.
59
+
60
+ ### Charts / `@mui/x-charts@6.0.0-alpha.13`
61
+
62
+ - [charts] Share upfront future Pro features (#10465) @oliviertassinari
63
+
64
+ ### Tree View / `@mui/x-tree-view@6.0.0-beta.0`
65
+
66
+ - [TreeView] Do not try to focus a collapsed node when re-focusing the TreeView (#10422) @flaviendelangle
67
+ - [TreeView] Fix the typing of the `Multiple` generic (#10478) @flaviendelangle
68
+
69
+ ### Docs
70
+
71
+ - [docs] Correct the typo in data grid api docs (#10477) @MBilalShafi
72
+ - [docs] Add customization playground (#9581) @noraleonte
73
+ - [docs] Fix Tree View product ID (#10428) @oliviertassinari
74
+ - [docs] Fix demo crashing when all rows are deleted (#10438) @cherniavskii
75
+ - [docs] Fix mobile scrollbar column resize (#10455) @oliviertassinari
76
+ - [docs] Fix usage of `GridRenderCellParams` interface (#10435) @cherniavskii
77
+
78
+ ### Core
79
+
80
+ - [core] Fix typo in header data grid quick filter @oliviertassinari
81
+ - [core] Group D3 renovate PRs (#10480) @flaviendelangle
82
+ - [core] Link the priority support page (#10495) @michelengelen
83
+ - [core] Move the pickers describes to the test utils folder (#10490) @flaviendelangle
84
+ - [core] Priority Support casing normalization @oliviertassinari
85
+ - [core] Remove automated DataGrid performance tests (#10414) @romgrk
86
+ - [core] Sync `prism-okaidia.css` with docs-infra @oliviertassinari
87
+ - [core] Update issue actions & templates (#10375) @romgrk
88
+ - [core] Update release guide (#10468) @DanailH
89
+
6
90
  ## 6.15.0
7
91
 
8
92
  _Sep 22, 2023_
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { TreeViewProps } from './TreeView.types';
3
- type TreeViewComponent = (<Multiple extends boolean | undefined>(props: TreeViewProps<Multiple> & React.RefAttributes<HTMLUListElement>) => React.JSX.Element) & {
3
+ type TreeViewComponent = (<Multiple extends boolean | undefined = undefined>(props: TreeViewProps<Multiple> & React.RefAttributes<HTMLUListElement>) => React.JSX.Element) & {
4
4
  propTypes?: any;
5
5
  };
6
6
  /**
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-tree-view v6.0.0-alpha.4
2
+ * @mui/x-tree-view v6.0.0-beta.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -47,8 +47,20 @@ export const useTreeViewFocus = ({
47
47
 
48
48
  // if the event bubbled (which is React specific) we don't want to steal focus
49
49
  if (event.target === event.currentTarget) {
50
- const firstSelected = Array.isArray(models.selected.value) ? models.selected.value[0] : models.selected.value;
51
- instance.focusNode(event, firstSelected || instance.getNavigableChildrenIds(null)[0]);
50
+ const isNodeVisible = nodeId => {
51
+ const node = instance.getNode(nodeId);
52
+ return node && (node.parentId == null || instance.isNodeExpanded(node.parentId));
53
+ };
54
+ let nodeToFocusId;
55
+ if (Array.isArray(models.selected.value)) {
56
+ nodeToFocusId = models.selected.value.find(isNodeVisible);
57
+ } else if (models.selected.value != null && isNodeVisible(models.selected.value)) {
58
+ nodeToFocusId = models.selected.value;
59
+ }
60
+ if (nodeToFocusId == null) {
61
+ nodeToFocusId = instance.getNavigableChildrenIds(null)[0];
62
+ }
63
+ instance.focusNode(event, nodeToFocusId);
52
64
  }
53
65
  };
54
66
  const createHandleBlur = otherHandlers => event => {
@@ -2,6 +2,7 @@ import * as React from 'react';
2
2
  import { TreeViewPluginSignature } from '../../models';
3
3
  import type { UseTreeViewNodesSignature } from '../useTreeViewNodes';
4
4
  import type { UseTreeViewSelectionSignature } from '../useTreeViewSelection';
5
+ import { UseTreeViewExpansionSignature } from '../useTreeViewExpansion';
5
6
  export interface UseTreeViewFocusInstance {
6
7
  isNodeFocused: (nodeId: string) => boolean;
7
8
  focusNode: (event: React.SyntheticEvent, nodeId: string | null) => void;
@@ -21,5 +22,6 @@ export interface UseTreeViewFocusState {
21
22
  }
22
23
  export type UseTreeViewFocusSignature = TreeViewPluginSignature<UseTreeViewFocusParameters, UseTreeViewFocusParameters, UseTreeViewFocusInstance, {}, UseTreeViewFocusState, never, [
23
24
  UseTreeViewNodesSignature,
24
- UseTreeViewSelectionSignature<any>
25
+ UseTreeViewSelectionSignature<any>,
26
+ UseTreeViewExpansionSignature
25
27
  ]>;
package/legacy/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-tree-view v6.0.0-alpha.4
2
+ * @mui/x-tree-view v6.0.0-beta.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -50,8 +50,20 @@ export var useTreeViewFocus = function useTreeViewFocus(_ref) {
50
50
 
51
51
  // if the event bubbled (which is React specific) we don't want to steal focus
52
52
  if (event.target === event.currentTarget) {
53
- var firstSelected = Array.isArray(models.selected.value) ? models.selected.value[0] : models.selected.value;
54
- instance.focusNode(event, firstSelected || instance.getNavigableChildrenIds(null)[0]);
53
+ var isNodeVisible = function isNodeVisible(nodeId) {
54
+ var node = instance.getNode(nodeId);
55
+ return node && (node.parentId == null || instance.isNodeExpanded(node.parentId));
56
+ };
57
+ var nodeToFocusId;
58
+ if (Array.isArray(models.selected.value)) {
59
+ nodeToFocusId = models.selected.value.find(isNodeVisible);
60
+ } else if (models.selected.value != null && isNodeVisible(models.selected.value)) {
61
+ nodeToFocusId = models.selected.value;
62
+ }
63
+ if (nodeToFocusId == null) {
64
+ nodeToFocusId = instance.getNavigableChildrenIds(null)[0];
65
+ }
66
+ instance.focusNode(event, nodeToFocusId);
55
67
  }
56
68
  };
57
69
  };
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-tree-view v6.0.0-alpha.4
2
+ * @mui/x-tree-view v6.0.0-beta.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -46,8 +46,20 @@ export const useTreeViewFocus = ({
46
46
 
47
47
  // if the event bubbled (which is React specific) we don't want to steal focus
48
48
  if (event.target === event.currentTarget) {
49
- const firstSelected = Array.isArray(models.selected.value) ? models.selected.value[0] : models.selected.value;
50
- instance.focusNode(event, firstSelected || instance.getNavigableChildrenIds(null)[0]);
49
+ const isNodeVisible = nodeId => {
50
+ const node = instance.getNode(nodeId);
51
+ return node && (node.parentId == null || instance.isNodeExpanded(node.parentId));
52
+ };
53
+ let nodeToFocusId;
54
+ if (Array.isArray(models.selected.value)) {
55
+ nodeToFocusId = models.selected.value.find(isNodeVisible);
56
+ } else if (models.selected.value != null && isNodeVisible(models.selected.value)) {
57
+ nodeToFocusId = models.selected.value;
58
+ }
59
+ if (nodeToFocusId == null) {
60
+ nodeToFocusId = instance.getNavigableChildrenIds(null)[0];
61
+ }
62
+ instance.focusNode(event, nodeToFocusId);
51
63
  }
52
64
  };
53
65
  const createHandleBlur = otherHandlers => event => {
package/node/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-tree-view v6.0.0-alpha.4
2
+ * @mui/x-tree-view v6.0.0-beta.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -55,8 +55,20 @@ const useTreeViewFocus = ({
55
55
 
56
56
  // if the event bubbled (which is React specific) we don't want to steal focus
57
57
  if (event.target === event.currentTarget) {
58
- const firstSelected = Array.isArray(models.selected.value) ? models.selected.value[0] : models.selected.value;
59
- instance.focusNode(event, firstSelected || instance.getNavigableChildrenIds(null)[0]);
58
+ const isNodeVisible = nodeId => {
59
+ const node = instance.getNode(nodeId);
60
+ return node && (node.parentId == null || instance.isNodeExpanded(node.parentId));
61
+ };
62
+ let nodeToFocusId;
63
+ if (Array.isArray(models.selected.value)) {
64
+ nodeToFocusId = models.selected.value.find(isNodeVisible);
65
+ } else if (models.selected.value != null && isNodeVisible(models.selected.value)) {
66
+ nodeToFocusId = models.selected.value;
67
+ }
68
+ if (nodeToFocusId == null) {
69
+ nodeToFocusId = instance.getNavigableChildrenIds(null)[0];
70
+ }
71
+ instance.focusNode(event, nodeToFocusId);
60
72
  }
61
73
  };
62
74
  const createHandleBlur = otherHandlers => event => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-tree-view",
3
- "version": "6.0.0-alpha.4",
3
+ "version": "6.0.0-beta.0",
4
4
  "description": "The community edition of the tree view components (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./node/index.js",