@pingux/astro 2.42.0-alpha.0 → 2.42.0-alpha.1
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/lib/cjs/components/TreeView/TreeView.js +5 -10
- package/lib/cjs/components/TreeView/TreeView.stories.js +3 -169
- package/lib/cjs/components/TreeView/TreeView.test.js +9 -130
- package/lib/cjs/components/TreeView/TreeViewRow.js +3 -5
- package/lib/cjs/components/TreeView/TreeViewSection.js +3 -32
- package/lib/components/TreeView/TreeView.js +5 -10
- package/lib/components/TreeView/TreeView.stories.js +1 -161
- package/lib/components/TreeView/TreeView.test.js +9 -130
- package/lib/components/TreeView/TreeViewRow.js +3 -5
- package/lib/components/TreeView/TreeViewSection.js +5 -34
- package/package.json +1 -1
@@ -1,16 +1,13 @@
|
|
1
|
-
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
2
1
|
import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/some";
|
3
2
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
4
3
|
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
5
|
-
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
6
4
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
7
5
|
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
8
|
-
import React, { forwardRef,
|
6
|
+
import React, { forwardRef, useImperativeHandle, useRef } from 'react';
|
9
7
|
import { useOption } from '@react-aria/listbox';
|
10
|
-
import { VisuallyHidden } from '@react-aria/visually-hidden';
|
11
8
|
import PropTypes from 'prop-types';
|
12
9
|
import { useTreeViewContext } from '../../context/TreeViewContext';
|
13
|
-
import { Box,
|
10
|
+
import { Box, TreeViewItem } from '../../index';
|
14
11
|
import InsertionIndicator from './InsertionIndicator';
|
15
12
|
import { SectionOrItemRender } from './TreeView';
|
16
13
|
import { sectionPressHandlers } from './TreeViewKeyboardDelegate';
|
@@ -97,8 +94,6 @@ var TreeViewSection = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
97
94
|
var item = props.item,
|
98
95
|
items = props.items,
|
99
96
|
title = props.title,
|
100
|
-
hasChildren = props.hasChildren,
|
101
|
-
loadingNodes = props.loadingNodes,
|
102
97
|
focusManager = props.focusManager,
|
103
98
|
onKeyDown = props.onKeyDown,
|
104
99
|
level = props.level,
|
@@ -106,7 +101,6 @@ var TreeViewSection = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
106
101
|
setSize = props.setSize;
|
107
102
|
var key = item.key;
|
108
103
|
var treeSectionRef = useRef();
|
109
|
-
|
110
104
|
/* istanbul ignore next */
|
111
105
|
useImperativeHandle(ref, function () {
|
112
106
|
return treeSectionRef.current;
|
@@ -126,17 +120,6 @@ var TreeViewSection = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
126
120
|
isDisabled = _useOption.isDisabled;
|
127
121
|
var isExpanded = state.expandedKeys.has(key);
|
128
122
|
var isDragging = dragState.isDragging(item.key);
|
129
|
-
var _useState = useState(),
|
130
|
-
_useState2 = _slicedToArray(_useState, 2),
|
131
|
-
loaderState = _useState2[0],
|
132
|
-
setLoaderState = _useState2[1];
|
133
|
-
useEffect(function () {
|
134
|
-
if (loadingNodes) {
|
135
|
-
_forEachInstanceProperty(loadingNodes).call(loadingNodes, function (loader) {
|
136
|
-
if (loader.node === title) setLoaderState(loader.loadingState);
|
137
|
-
});
|
138
|
-
}
|
139
|
-
}, [loadingNodes, title]);
|
140
123
|
var onKeyDownFunction = function onKeyDownFunction(e) {
|
141
124
|
onKeyDownSection(e, state, key, tree, isSelected, isExpanded, focusManager, flatKeyArray, refArray, pageLength, true);
|
142
125
|
if (onKeyDown) {
|
@@ -167,8 +150,7 @@ var TreeViewSection = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
167
150
|
items: items,
|
168
151
|
isDragging: isDragging,
|
169
152
|
isExpanded: isExpanded,
|
170
|
-
onKeyDown: onKeyDownFunction
|
171
|
-
hasChildren: hasChildren
|
153
|
+
onKeyDown: onKeyDownFunction
|
172
154
|
}), isExpanded && ___EmotionJSX(Box, {
|
173
155
|
role: "rowgroup",
|
174
156
|
key: "".concat(item.key, " ul"),
|
@@ -178,22 +160,13 @@ var TreeViewSection = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
178
160
|
border: 'none'
|
179
161
|
}
|
180
162
|
}
|
181
|
-
},
|
182
|
-
"aria-live": "polite"
|
183
|
-
}, loaderState === false && (isExpanded && items.length > 0 ? ' Loading successful' : 'Loading unsuccessful')), loaderState ? ___EmotionJSX(Loader, {
|
184
|
-
color: "active",
|
185
|
-
ml: "31px"
|
186
|
-
}) : _mapInstanceProperty(_context3 = _Array$from(items)).call(_context3, function (_item, _index) {
|
163
|
+
}, _mapInstanceProperty(_context3 = _Array$from(items)).call(_context3, function (_item, _index) {
|
187
164
|
var _item$children;
|
188
|
-
return SectionOrItemRender(
|
189
|
-
// _item.value.items?.length > 0 || _item.value.items,
|
190
|
-
((_item$children = _item.children) === null || _item$children === void 0 ? void 0 : _item$children.length) > 0 || _item.value.items, ___EmotionJSX(TreeViewSection, {
|
165
|
+
return SectionOrItemRender(((_item$children = _item.children) === null || _item$children === void 0 ? void 0 : _item$children.length) > 0, ___EmotionJSX(TreeViewSection, {
|
191
166
|
item: _item,
|
192
167
|
items: _item.children,
|
193
168
|
title: _item.value.title,
|
194
169
|
key: _item.value.title,
|
195
|
-
hasChildren: _item.value.items && true,
|
196
|
-
loadingNodes: loadingNodes,
|
197
170
|
focusManager: focusManager,
|
198
171
|
level: level + 1,
|
199
172
|
position: _index,
|
@@ -222,8 +195,6 @@ TreeViewSection.propTypes = {
|
|
222
195
|
key: PropTypes.string
|
223
196
|
}),
|
224
197
|
title: PropTypes.string,
|
225
|
-
hasChildren: PropTypes.bool,
|
226
|
-
loadingNodes: PropTypes.arrayOf(PropTypes.shape({})),
|
227
198
|
focusManager: PropTypes.shape({}),
|
228
199
|
onKeyDown: PropTypes.func,
|
229
200
|
level: PropTypes.number,
|