react-magma-dom 4.7.0-next.52 → 4.7.0-next.54

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.
@@ -7745,7 +7745,7 @@
7745
7745
  "type": {
7746
7746
  "name": "CSSProperties"
7747
7747
  },
7748
- "description": "Style properties for the component container element",
7748
+ "description": "Style properties for the component container element.\nThis div is a direct child of the div with the inputWrapperStyle, so the second from the top.",
7749
7749
  "deprecated": false
7750
7750
  },
7751
7751
  "hasCharacterCounter": {
@@ -7838,7 +7838,7 @@
7838
7838
  "type": {
7839
7839
  "name": "CSSProperties"
7840
7840
  },
7841
- "description": "Style properties for input wrapper element",
7841
+ "description": "Style properties for input wrapper element. This is the outermost div.",
7842
7842
  "deprecated": false
7843
7843
  },
7844
7844
  "isClearable": {
@@ -8003,7 +8003,7 @@
8003
8003
  "type": {
8004
8004
  "name": "CSSProperties"
8005
8005
  },
8006
- "description": "Style properties for the component container element",
8006
+ "description": "Style properties for the component container element.\nThis div is a direct child of the div with the inputWrapperStyle, so the second from the top.",
8007
8007
  "deprecated": false
8008
8008
  },
8009
8009
  "hasCharacterCounter": {
@@ -8096,7 +8096,7 @@
8096
8096
  "type": {
8097
8097
  "name": "CSSProperties"
8098
8098
  },
8099
- "description": "Style properties for input wrapper element",
8099
+ "description": "Style properties for input wrapper element. This is the outermost div.",
8100
8100
  "deprecated": false
8101
8101
  },
8102
8102
  "isClearable": {
@@ -10867,7 +10867,7 @@
10867
10867
  "type": {
10868
10868
  "name": "CSSProperties"
10869
10869
  },
10870
- "description": "Style properties for input wrapper element",
10870
+ "description": "Style properties for input wrapper element. This is the outermost div.",
10871
10871
  "deprecated": false
10872
10872
  },
10873
10873
  "isClearable": {
@@ -16330,12 +16330,12 @@
16330
16330
  "typeArguments": [
16331
16331
  {
16332
16332
  "type": "reference",
16333
- "id": 33645,
16333
+ "id": 33651,
16334
16334
  "name": "ToggleButtonTextProps"
16335
16335
  },
16336
16336
  {
16337
16337
  "type": "reference",
16338
- "id": 33923,
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": 33259,
17719
+ "id": 33263,
17720
17720
  "name": "useTreeView"
17721
17721
  }
17722
17722
  }
@@ -15997,6 +15997,7 @@ function useTreeView(props) {
15997
15997
  }),
15998
15998
  hasIcons = _React$useState2[0];
15999
15999
  var selectedItems = React.useMemo(function () {
16000
+ console.log(items);
16000
16001
  return items.filter(function (item) {
16001
16002
  return item.checkedStatus === exports.IndeterminateCheckboxStatus.checked;
16002
16003
  });
@@ -16028,7 +16029,12 @@ function useTreeView(props) {
16028
16029
  }, [items]);
16029
16030
  var prevSelectedItemsRef = React.useRef(null);
16030
16031
  var prevPreselectedItemsRef = React.useRef(preselectedItems);
16032
+ var prevChildrenRef = React.useRef(children);
16031
16033
  var initializationRef = React.useRef(true);
16034
+ // Used for showAll button
16035
+ var _React$useState3 = React.useState(null),
16036
+ itemsNeedUpdate = _React$useState3[0],
16037
+ setItemsNeedUpdate = _React$useState3[1];
16032
16038
  React.useEffect(function () {
16033
16039
  if (isEqualArrays(prevPreselectedItemsRef.current, preselectedItems)) {
16034
16040
  return;
@@ -16135,20 +16141,13 @@ function useTreeView(props) {
16135
16141
  if ([exports.TreeViewSelectable.single, exports.TreeViewSelectable.single].includes(selectable) || isDisabled) {
16136
16142
  return;
16137
16143
  }
16138
- setItems(function (prevItems) {
16139
- return toggleAllMulti({
16140
- items: items,
16141
- checkedStatus: exports.IndeterminateCheckboxStatus.checked,
16142
- checkChildren: checkChildren,
16143
- checkParents: checkParents
16144
- });
16145
- });
16144
+ this.showMore(true);
16146
16145
  },
16147
16146
  clearAll: function clearAll() {
16148
16147
  if (isDisabled) {
16149
16148
  return;
16150
16149
  }
16151
- setItems(function (prevItems) {
16150
+ setItems(function () {
16152
16151
  return toggleAllMulti({
16153
16152
  items: items,
16154
16153
  checkedStatus: exports.IndeterminateCheckboxStatus.unchecked,
@@ -16156,13 +16155,54 @@ function useTreeView(props) {
16156
16155
  checkParents: checkParents
16157
16156
  });
16158
16157
  });
16158
+ },
16159
+ showMore: function showMore(fromSelectAll) {
16160
+ if (fromSelectAll === void 0) {
16161
+ fromSelectAll = false;
16162
+ }
16163
+ if (fromSelectAll) {
16164
+ setItems(function () {
16165
+ return toggleAllMulti({
16166
+ items: items,
16167
+ checkedStatus: exports.IndeterminateCheckboxStatus.checked,
16168
+ checkChildren: checkChildren,
16169
+ checkParents: checkParents
16170
+ });
16171
+ });
16172
+ } else {
16173
+ setItemsNeedUpdate(true);
16174
+ }
16175
+ },
16176
+ showLess: function showLess() {
16177
+ setItems(getInitialItems({
16178
+ children: children,
16179
+ preselectedItems: selectedItems,
16180
+ checkParents: checkParents,
16181
+ checkChildren: checkChildren,
16182
+ selectable: selectable,
16183
+ isDisabled: isDisabled
16184
+ }));
16159
16185
  }
16160
16186
  };
16161
16187
  }
16162
- }, [selectItem, isDisabled]);
16163
- var _React$useState3 = React.useState(false),
16164
- initialExpandedItemsNeedUpdate = _React$useState3[0],
16165
- setInitialExpandedItemsNeedUpdate = _React$useState3[1];
16188
+ }, [selectItem, isDisabled, children]);
16189
+ React.useEffect(function () {
16190
+ if (itemsNeedUpdate) {
16191
+ setItems(getInitialItems({
16192
+ children: children,
16193
+ preselectedItems: selectedItems,
16194
+ checkParents: checkParents,
16195
+ checkChildren: checkChildren,
16196
+ selectable: selectable,
16197
+ isDisabled: isDisabled
16198
+ }));
16199
+ prevChildrenRef.current = children;
16200
+ setItemsNeedUpdate(false);
16201
+ }
16202
+ }, [itemsNeedUpdate, children]);
16203
+ var _React$useState4 = React.useState(false),
16204
+ initialExpandedItemsNeedUpdate = _React$useState4[0],
16205
+ setInitialExpandedItemsNeedUpdate = _React$useState4[1];
16166
16206
  var _useDescendants = useDescendants(),
16167
16207
  treeItemRefArray = _useDescendants[0],
16168
16208
  registerTreeItem = _useDescendants[1];
@@ -16171,9 +16211,9 @@ function useTreeView(props) {
16171
16211
  setInitialExpandedItemsNeedUpdate(true);
16172
16212
  }
16173
16213
  }, []);
16174
- var _React$useState4 = React.useState(new Set(initialExpandedItems)),
16175
- expandedSet = _React$useState4[0],
16176
- setExpandedSet = _React$useState4[1];
16214
+ var _React$useState5 = React.useState(new Set(initialExpandedItems)),
16215
+ expandedSet = _React$useState5[0],
16216
+ setExpandedSet = _React$useState5[1];
16177
16217
  var handleExpandedChange = function handleExpandedChange(event, itemId) {
16178
16218
  setExpandedSet(function (prevExpandedSet) {
16179
16219
  var updatedExpandedSet = new Set(prevExpandedSet);