react-magma-dom 4.7.0-next.53 → 4.7.0-next.55
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/index.d.ts +1 -0
- package/dist/components/TreeView/useTreeView.d.ts +4 -0
- package/dist/esm/index.js +56 -17
- package/dist/esm/index.js.map +1 -1
- package/dist/properties.json +5 -5
- package/dist/react-magma-dom.cjs.development.js +56 -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": 33651,
|
|
16334
16334
|
"name": "ToggleButtonTextProps"
|
|
16335
16335
|
},
|
|
16336
16336
|
{
|
|
16337
16337
|
"type": "reference",
|
|
16338
|
-
"id":
|
|
16338
|
+
"id": 33929,
|
|
16339
16339
|
"name": "ToggleButtonIconProps"
|
|
16340
16340
|
}
|
|
16341
16341
|
],
|
|
@@ -17091,7 +17091,7 @@
|
|
|
17091
17091
|
"type": {
|
|
17092
17092
|
"name": "MutableRefObject"
|
|
17093
17093
|
},
|
|
17094
|
-
"description": "The ref object that allows TreeView manipulation.\nActions available:\nselectItem({ itemId, checkedStatus }: Pick<TreeViewItemInterface, 'itemId' | 'checkedStatus'>): void - action that allows to change item selection,\nselectAll(): void - action that allows to select all items,\nclearAll(): void - action that allows to unselect all items.",
|
|
17094
|
+
"description": "The ref object that allows TreeView manipulation.\nActions available:\nselectItem({ itemId, checkedStatus }: Pick<TreeViewItemInterface, 'itemId' | 'checkedStatus'>): void - action that allows to change item selection,\nselectAll(): void - action that allows to select all items,\nclearAll(): void - action that allows to unselect all items.\nshowMore(): void - action that gets called when a tree has hidden items and they get expanded.\nshowLess(): void - action that gets called when a tree has hidden items and they get collapsed.",
|
|
17095
17095
|
"deprecated": false
|
|
17096
17096
|
},
|
|
17097
17097
|
"ariaLabel": {
|
|
@@ -17578,7 +17578,7 @@
|
|
|
17578
17578
|
"type": {
|
|
17579
17579
|
"name": "MutableRefObject"
|
|
17580
17580
|
},
|
|
17581
|
-
"description": "The ref object that allows TreeView manipulation.\nActions available:\nselectItem({ itemId, checkedStatus }: Pick<TreeViewItemInterface, 'itemId' | 'checkedStatus'>): void - action that allows to change item selection,\nselectAll(): void - action that allows to select all items,\nclearAll(): void - action that allows to unselect all items.",
|
|
17581
|
+
"description": "The ref object that allows TreeView manipulation.\nActions available:\nselectItem({ itemId, checkedStatus }: Pick<TreeViewItemInterface, 'itemId' | 'checkedStatus'>): void - action that allows to change item selection,\nselectAll(): void - action that allows to select all items,\nclearAll(): void - action that allows to unselect all items.\nshowMore(): void - action that gets called when a tree has hidden items and they get expanded.\nshowLess(): void - action that gets called when a tree has hidden items and they get collapsed.",
|
|
17582
17582
|
"deprecated": false
|
|
17583
17583
|
},
|
|
17584
17584
|
"ariaLabel": {
|
|
@@ -17716,7 +17716,7 @@
|
|
|
17716
17716
|
"type": "query",
|
|
17717
17717
|
"queryType": {
|
|
17718
17718
|
"type": "reference",
|
|
17719
|
-
"id":
|
|
17719
|
+
"id": 33263,
|
|
17720
17720
|
"name": "useTreeView"
|
|
17721
17721
|
}
|
|
17722
17722
|
}
|
|
@@ -16009,7 +16009,7 @@ function useTreeView(props) {
|
|
|
16009
16009
|
}, [items, rawInitialExpandedItems]);
|
|
16010
16010
|
var itemToFocus = React.useMemo(function () {
|
|
16011
16011
|
var enabledItems = items.filter(function (item) {
|
|
16012
|
-
return !
|
|
16012
|
+
return !item.isDisabled;
|
|
16013
16013
|
});
|
|
16014
16014
|
var firstItem = enabledItems[0];
|
|
16015
16015
|
if (selectable === exports.TreeViewSelectable.off) {
|
|
@@ -16028,7 +16028,12 @@ function useTreeView(props) {
|
|
|
16028
16028
|
}, [items]);
|
|
16029
16029
|
var prevSelectedItemsRef = React.useRef(null);
|
|
16030
16030
|
var prevPreselectedItemsRef = React.useRef(preselectedItems);
|
|
16031
|
+
var prevChildrenRef = React.useRef(children);
|
|
16031
16032
|
var initializationRef = React.useRef(true);
|
|
16033
|
+
// Used for showAll button
|
|
16034
|
+
var _React$useState3 = React.useState(null),
|
|
16035
|
+
itemsNeedUpdate = _React$useState3[0],
|
|
16036
|
+
setItemsNeedUpdate = _React$useState3[1];
|
|
16032
16037
|
React.useEffect(function () {
|
|
16033
16038
|
if (isEqualArrays(prevPreselectedItemsRef.current, preselectedItems)) {
|
|
16034
16039
|
return;
|
|
@@ -16135,20 +16140,13 @@ function useTreeView(props) {
|
|
|
16135
16140
|
if ([exports.TreeViewSelectable.single, exports.TreeViewSelectable.single].includes(selectable) || isDisabled) {
|
|
16136
16141
|
return;
|
|
16137
16142
|
}
|
|
16138
|
-
|
|
16139
|
-
return toggleAllMulti({
|
|
16140
|
-
items: items,
|
|
16141
|
-
checkedStatus: exports.IndeterminateCheckboxStatus.checked,
|
|
16142
|
-
checkChildren: checkChildren,
|
|
16143
|
-
checkParents: checkParents
|
|
16144
|
-
});
|
|
16145
|
-
});
|
|
16143
|
+
this.showMore(true);
|
|
16146
16144
|
},
|
|
16147
16145
|
clearAll: function clearAll() {
|
|
16148
16146
|
if (isDisabled) {
|
|
16149
16147
|
return;
|
|
16150
16148
|
}
|
|
16151
|
-
setItems(function (
|
|
16149
|
+
setItems(function () {
|
|
16152
16150
|
return toggleAllMulti({
|
|
16153
16151
|
items: items,
|
|
16154
16152
|
checkedStatus: exports.IndeterminateCheckboxStatus.unchecked,
|
|
@@ -16156,13 +16154,54 @@ function useTreeView(props) {
|
|
|
16156
16154
|
checkParents: checkParents
|
|
16157
16155
|
});
|
|
16158
16156
|
});
|
|
16157
|
+
},
|
|
16158
|
+
showMore: function showMore(fromSelectAll) {
|
|
16159
|
+
if (fromSelectAll === void 0) {
|
|
16160
|
+
fromSelectAll = false;
|
|
16161
|
+
}
|
|
16162
|
+
if (fromSelectAll) {
|
|
16163
|
+
setItems(function () {
|
|
16164
|
+
return toggleAllMulti({
|
|
16165
|
+
items: items,
|
|
16166
|
+
checkedStatus: exports.IndeterminateCheckboxStatus.checked,
|
|
16167
|
+
checkChildren: checkChildren,
|
|
16168
|
+
checkParents: checkParents
|
|
16169
|
+
});
|
|
16170
|
+
});
|
|
16171
|
+
} else {
|
|
16172
|
+
setItemsNeedUpdate(true);
|
|
16173
|
+
}
|
|
16174
|
+
},
|
|
16175
|
+
showLess: function showLess() {
|
|
16176
|
+
setItems(getInitialItems({
|
|
16177
|
+
children: children,
|
|
16178
|
+
preselectedItems: selectedItems,
|
|
16179
|
+
checkParents: checkParents,
|
|
16180
|
+
checkChildren: checkChildren,
|
|
16181
|
+
selectable: selectable,
|
|
16182
|
+
isDisabled: isDisabled
|
|
16183
|
+
}));
|
|
16159
16184
|
}
|
|
16160
16185
|
};
|
|
16161
16186
|
}
|
|
16162
|
-
}, [selectItem, isDisabled]);
|
|
16163
|
-
|
|
16164
|
-
|
|
16165
|
-
|
|
16187
|
+
}, [selectItem, isDisabled, children]);
|
|
16188
|
+
React.useEffect(function () {
|
|
16189
|
+
if (itemsNeedUpdate) {
|
|
16190
|
+
setItems(getInitialItems({
|
|
16191
|
+
children: children,
|
|
16192
|
+
preselectedItems: selectedItems,
|
|
16193
|
+
checkParents: checkParents,
|
|
16194
|
+
checkChildren: checkChildren,
|
|
16195
|
+
selectable: selectable,
|
|
16196
|
+
isDisabled: isDisabled
|
|
16197
|
+
}));
|
|
16198
|
+
prevChildrenRef.current = children;
|
|
16199
|
+
setItemsNeedUpdate(false);
|
|
16200
|
+
}
|
|
16201
|
+
}, [itemsNeedUpdate, children]);
|
|
16202
|
+
var _React$useState4 = React.useState(false),
|
|
16203
|
+
initialExpandedItemsNeedUpdate = _React$useState4[0],
|
|
16204
|
+
setInitialExpandedItemsNeedUpdate = _React$useState4[1];
|
|
16166
16205
|
var _useDescendants = useDescendants(),
|
|
16167
16206
|
treeItemRefArray = _useDescendants[0],
|
|
16168
16207
|
registerTreeItem = _useDescendants[1];
|
|
@@ -16171,9 +16210,9 @@ function useTreeView(props) {
|
|
|
16171
16210
|
setInitialExpandedItemsNeedUpdate(true);
|
|
16172
16211
|
}
|
|
16173
16212
|
}, []);
|
|
16174
|
-
var _React$
|
|
16175
|
-
expandedSet = _React$
|
|
16176
|
-
setExpandedSet = _React$
|
|
16213
|
+
var _React$useState5 = React.useState(new Set(initialExpandedItems)),
|
|
16214
|
+
expandedSet = _React$useState5[0],
|
|
16215
|
+
setExpandedSet = _React$useState5[1];
|
|
16177
16216
|
var handleExpandedChange = function handleExpandedChange(event, itemId) {
|
|
16178
16217
|
setExpandedSet(function (prevExpandedSet) {
|
|
16179
16218
|
var updatedExpandedSet = new Set(prevExpandedSet);
|