react-magma-dom 4.7.0-next.50 → 4.7.0-next.51
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/dist/components/TreeView/utils.d.ts +0 -1
- package/dist/esm/index.js +32 -17
- package/dist/esm/index.js.map +1 -1
- package/dist/properties.json +2 -2
- package/dist/react-magma-dom.cjs.development.js +31 -17
- package/dist/react-magma-dom.cjs.development.js.map +1 -1
- package/dist/react-magma-dom.cjs.production.min.js +1 -1
- package/dist/react-magma-dom.cjs.production.min.js.map +1 -1
- package/package.json +1 -1
package/dist/properties.json
CHANGED
|
@@ -16330,12 +16330,12 @@
|
|
|
16330
16330
|
"typeArguments": [
|
|
16331
16331
|
{
|
|
16332
16332
|
"type": "reference",
|
|
16333
|
-
"id":
|
|
16333
|
+
"id": 33645,
|
|
16334
16334
|
"name": "ToggleButtonTextProps"
|
|
16335
16335
|
},
|
|
16336
16336
|
{
|
|
16337
16337
|
"type": "reference",
|
|
16338
|
-
"id":
|
|
16338
|
+
"id": 33923,
|
|
16339
16339
|
"name": "ToggleButtonIconProps"
|
|
16340
16340
|
}
|
|
16341
16341
|
],
|
|
@@ -15521,21 +15521,6 @@ function getChildrenItemIdsFlat(children) {
|
|
|
15521
15521
|
});
|
|
15522
15522
|
return itemIds;
|
|
15523
15523
|
}
|
|
15524
|
-
// Return an array of objects where all children are items are nested in the parents
|
|
15525
|
-
function getChildrenItemIdsInTree(children) {
|
|
15526
|
-
var itemIds = [];
|
|
15527
|
-
React__default.Children.forEach(children, function (child) {
|
|
15528
|
-
var _child$props7, _child$props8;
|
|
15529
|
-
if ((_child$props7 = child.props) != null && _child$props7.itemId && !((_child$props8 = child.props) != null && _child$props8.isDisabled)) {
|
|
15530
|
-
var _child$props9, _child$props10;
|
|
15531
|
-
itemIds.push({
|
|
15532
|
-
itemId: (_child$props9 = child.props) == null ? void 0 : _child$props9.itemId,
|
|
15533
|
-
children: getChildrenItemIdsInTree((_child$props10 = child.props) == null ? void 0 : _child$props10.children)
|
|
15534
|
-
});
|
|
15535
|
-
}
|
|
15536
|
-
});
|
|
15537
|
-
return itemIds;
|
|
15538
|
-
}
|
|
15539
15524
|
// Return a treeItemRefArray object with no null children
|
|
15540
15525
|
function filterNullEntries(obj) {
|
|
15541
15526
|
if (Array.isArray(obj.current)) {
|
|
@@ -15569,6 +15554,36 @@ var getIsDisabled = function getIsDisabled(_ref) {
|
|
|
15569
15554
|
}
|
|
15570
15555
|
return isParentDisabled || isDisabled;
|
|
15571
15556
|
};
|
|
15557
|
+
/* Returns a boolean indicating whether at least one child is valid.
|
|
15558
|
+
A child is considered valid if it can be counted as an item that would make the parent expandable.
|
|
15559
|
+
This is used to set `hasOwnTreeItems` which manages visibility of the expandable arrow.
|
|
15560
|
+
*/
|
|
15561
|
+
var areChildrenValid = function areChildrenValid(children) {
|
|
15562
|
+
if (!children) {
|
|
15563
|
+
return false;
|
|
15564
|
+
} else if (!children.length && children.type !== TreeItem) {
|
|
15565
|
+
return false;
|
|
15566
|
+
}
|
|
15567
|
+
var hasValidChild = true;
|
|
15568
|
+
for (var i = 0; i < children.length; i++) {
|
|
15569
|
+
var child = children[i];
|
|
15570
|
+
if (typeof child === 'string') {
|
|
15571
|
+
return false; // Return false if a child is a string
|
|
15572
|
+
}
|
|
15573
|
+
if (child.type !== TreeItem) {
|
|
15574
|
+
return hasValidChild;
|
|
15575
|
+
}
|
|
15576
|
+
// Recursively check the validity of nested children
|
|
15577
|
+
if (child.props.children) {
|
|
15578
|
+
var nestedChildren = Array.isArray(child.props.children) ? child.props.children : [child.props.children];
|
|
15579
|
+
if (areChildrenValid(nestedChildren)) {
|
|
15580
|
+
hasValidChild = true;
|
|
15581
|
+
return hasValidChild;
|
|
15582
|
+
}
|
|
15583
|
+
}
|
|
15584
|
+
}
|
|
15585
|
+
return hasValidChild;
|
|
15586
|
+
};
|
|
15572
15587
|
var getTreeViewData = function getTreeViewData(_ref2) {
|
|
15573
15588
|
var children = _ref2.children,
|
|
15574
15589
|
selectable = _ref2.selectable,
|
|
@@ -15595,7 +15610,7 @@ var getTreeViewData = function getTreeViewData(_ref2) {
|
|
|
15595
15610
|
itemId: props.itemId,
|
|
15596
15611
|
parentId: parentId,
|
|
15597
15612
|
icon: props.icon,
|
|
15598
|
-
hasOwnTreeItems:
|
|
15613
|
+
hasOwnTreeItems: areChildrenValid(props.children),
|
|
15599
15614
|
isDisabled: isDisabled
|
|
15600
15615
|
}].concat(props.children ? getTreeViewData({
|
|
15601
15616
|
children: props.children,
|
|
@@ -16613,7 +16628,6 @@ exports.filterNullEntries = filterNullEntries;
|
|
|
16613
16628
|
exports.getChildrenIds = getChildrenIds;
|
|
16614
16629
|
exports.getChildrenItemIds = getChildrenItemIds;
|
|
16615
16630
|
exports.getChildrenItemIdsFlat = getChildrenItemIdsFlat;
|
|
16616
|
-
exports.getChildrenItemIdsInTree = getChildrenItemIdsInTree;
|
|
16617
16631
|
exports.getDateFromString = getDateFromString;
|
|
16618
16632
|
exports.getIconSizes = getIconSizes;
|
|
16619
16633
|
exports.getInitialExpandedIds = getInitialExpandedIds;
|