@patternfly/react-core 4.202.23 → 4.202.24

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.
@@ -6482,10 +6482,11 @@
6482
6482
  constructor(props) {
6483
6483
  super(props);
6484
6484
  this.onDocClick = (event) => {
6485
- const { parentRef, menuRef, isOpen, onToggle, onClose } = this.props;
6485
+ const { parentRef, menuRef, footerRef, isOpen, onToggle, onClose } = this.props;
6486
6486
  const clickedOnToggle = parentRef && parentRef.current && parentRef.current.contains(event.target);
6487
6487
  const clickedWithinMenu = menuRef && menuRef.current && menuRef.current.contains && menuRef.current.contains(event.target);
6488
- if (isOpen && !(clickedOnToggle || clickedWithinMenu)) {
6488
+ const clickedWithinFooter = footerRef && footerRef.current && footerRef.current.contains && footerRef.current.contains(event.target);
6489
+ if (isOpen && !(clickedOnToggle || clickedWithinMenu || clickedWithinFooter)) {
6489
6490
  onToggle(false, event);
6490
6491
  onClose();
6491
6492
  }
@@ -10582,25 +10583,6 @@
10582
10583
  this.addSelectedButtonRef = React__namespace.createRef();
10583
10584
  this.removeSelectedButtonRef = React__namespace.createRef();
10584
10585
  this.removeAllButtonRef = React__namespace.createRef();
10585
- this.originalAvailableCopy = JSON.parse(JSON.stringify(this.props.availableOptions));
10586
- this.originalChosenCopy = JSON.parse(JSON.stringify(this.props.chosenOptions));
10587
- // If the DualListSelector uses trees, concat the two initial arrays and merge duplicate folder IDs
10588
- this.mergedCopy = this.props.isTree
10589
- ? Object.values(this.originalAvailableCopy
10590
- .concat(this.originalChosenCopy)
10591
- .reduce((mapObj, item) => {
10592
- const key = item.id;
10593
- if (mapObj[key]) {
10594
- // If map already has an item ID, add the dupe ID's children to the existing map
10595
- mapObj[key].children.push(...item.children);
10596
- }
10597
- else {
10598
- // Else clone the item data
10599
- mapObj[key] = Object.assign({}, item);
10600
- }
10601
- return mapObj;
10602
- }, {}))
10603
- : null;
10604
10586
  this.onFilterUpdate = (newFilteredOptions, paneType, isSearchReset) => {
10605
10587
  const { isTree } = this.props;
10606
10588
  if (paneType === 'available') {
@@ -10675,7 +10657,7 @@
10675
10657
  .filter(item => filterRestTreeItems(item, movedOptions));
10676
10658
  const currChosen = flattenTree(prevState.chosenOptions);
10677
10659
  const nextChosenOptions = currChosen.concat(movedOptions);
10678
- const newChosen = this.mergedCopy
10660
+ const newChosen = this.createMergedCopy()
10679
10661
  .map(opt => Object.assign({}, opt))
10680
10662
  .filter(item => filterTreeItemsWithoutFolders(item, nextChosenOptions));
10681
10663
  this.props.addAll && this.props.addAll(newAvailable, newChosen);
@@ -10722,7 +10704,7 @@
10722
10704
  // Get next chosen options from current + new nodes and remap from base
10723
10705
  const currChosen = flattenTree(prevState.chosenOptions);
10724
10706
  const nextChosenOptions = currChosen.concat(prevState.availableTreeOptionsChecked);
10725
- const newChosen = this.mergedCopy
10707
+ const newChosen = this.createMergedCopy()
10726
10708
  .map(opt => Object.assign({}, opt))
10727
10709
  .filter(item => filterTreeItemsWithoutFolders(item, nextChosenOptions));
10728
10710
  this.props.addSelected && this.props.addSelected(newAvailable, newChosen);
@@ -10768,7 +10750,7 @@
10768
10750
  .filter(item => filterRestTreeItems(item, movedOptions));
10769
10751
  const currAvailable = flattenTree(prevState.availableOptions);
10770
10752
  const nextAvailableOptions = currAvailable.concat(movedOptions);
10771
- const newAvailable = this.mergedCopy
10753
+ const newAvailable = this.createMergedCopy()
10772
10754
  .map(opt => Object.assign({}, opt))
10773
10755
  .filter(item => filterTreeItemsWithoutFolders(item, nextAvailableOptions));
10774
10756
  this.props.removeAll && this.props.removeAll(newAvailable, newChosen);
@@ -10813,7 +10795,7 @@
10813
10795
  // Get next chosen options from current and remap from base
10814
10796
  const currAvailable = flattenTree(prevState.availableOptions);
10815
10797
  const nextAvailableOptions = currAvailable.concat(prevState.chosenTreeOptionsChecked);
10816
- const newAvailable = this.mergedCopy
10798
+ const newAvailable = this.createMergedCopy()
10817
10799
  .map(opt => Object.assign({}, opt))
10818
10800
  .filter(item => filterTreeItemsWithoutFolders(item, nextAvailableOptions));
10819
10801
  this.props.removeSelected && this.props.removeSelected(newAvailable, newChosen);
@@ -10928,6 +10910,27 @@
10928
10910
  chosenTreeOptionsChecked: []
10929
10911
  };
10930
10912
  }
10913
+ // If the DualListSelector uses trees, concat the two initial arrays and merge duplicate folder IDs
10914
+ createMergedCopy() {
10915
+ const copyOfAvailable = JSON.parse(JSON.stringify(this.props.availableOptions));
10916
+ const copyOfChosen = JSON.parse(JSON.stringify(this.props.chosenOptions));
10917
+ return this.props.isTree
10918
+ ? Object.values(copyOfAvailable
10919
+ .concat(copyOfChosen)
10920
+ .reduce((mapObj, item) => {
10921
+ const key = item.id;
10922
+ if (mapObj[key]) {
10923
+ // If map already has an item ID, add the dupe ID's children to the existing map
10924
+ mapObj[key].children.push(...item.children);
10925
+ }
10926
+ else {
10927
+ // Else clone the item data
10928
+ mapObj[key] = Object.assign({}, item);
10929
+ }
10930
+ return mapObj;
10931
+ }, {}))
10932
+ : null;
10933
+ }
10931
10934
  componentDidUpdate() {
10932
10935
  if (JSON.stringify(this.props.availableOptions) !== JSON.stringify(this.state.availableOptions) ||
10933
10936
  JSON.stringify(this.props.chosenOptions) !== JSON.stringify(this.state.chosenOptions)) {