@patternfly/react-table 4.71.7 → 4.71.10

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/CHANGELOG.md CHANGED
@@ -3,6 +3,33 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 4.71.10 (2022-03-29)
7
+
8
+ **Note:** Version bump only for package @patternfly/react-table
9
+
10
+
11
+
12
+
13
+
14
+ ## 4.71.9 (2022-03-28)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * **Select:** view more fixes ([#7107](https://github.com/patternfly/patternfly-react/issues/7107)) ([94f24f6](https://github.com/patternfly/patternfly-react/commit/94f24f65b043a2d3f3ae8fe7247aaf55b05987a7))
20
+
21
+
22
+
23
+
24
+
25
+ ## 4.71.8 (2022-03-28)
26
+
27
+ **Note:** Version bump only for package @patternfly/react-table
28
+
29
+
30
+
31
+
32
+
6
33
  ## 4.71.7 (2022-03-28)
7
34
 
8
35
 
@@ -4993,7 +4993,7 @@
4993
4993
  }, ref: this.ref, type: "button" }), children || value.toString())));
4994
4994
  }
4995
4995
  else if (variant !== SelectVariant.checkbox) {
4996
- return (React__namespace.createElement("li", { id: generatedId, role: "presentation", className: css(isLoading && _default$b.selectListItem, !isLoad && !isLoading && _default$b.selectMenuWrapper, isFavorite && _default$b.modifiers.favorite, isFocused && _default$b.modifiers.focus, isLoading && _default$b.modifiers.loading), ref: this.liRef },
4996
+ return (React__namespace.createElement("li", { id: generatedId, role: "presentation", className: css(isLoading && _default$b.selectListItem, !isLoading && _default$b.selectMenuWrapper, isFavorite && _default$b.modifiers.favorite, isFocused && _default$b.modifiers.focus, isLoading && _default$b.modifiers.loading), ref: this.liRef },
4997
4997
  isLoading && children,
4998
4998
  isLoad && !isGrouped && (React__namespace.createElement("button", Object.assign({}, props, { className: css(_default$b.selectMenuItem, _default$b.modifiers.load, className), onClick: (event) => {
4999
4999
  onViewMoreClick(event);
@@ -5150,9 +5150,18 @@
5150
5150
  let index = hasInlineFilter ? 1 : 0;
5151
5151
  if (isGrouped) {
5152
5152
  return React__namespace.Children.map(children, (group) => {
5153
- if (group.type === SelectOption || group.type === Divider) {
5153
+ if (group.type === Divider) {
5154
5154
  return group;
5155
5155
  }
5156
+ else if (group.type === SelectOption) {
5157
+ return React__namespace.cloneElement(group, {
5158
+ isChecked: this.checkForValue(group.props.value, checked),
5159
+ sendRef,
5160
+ keyHandler,
5161
+ index: index++,
5162
+ isLastOptionBeforeFooter
5163
+ });
5164
+ }
5156
5165
  return React__namespace.cloneElement(group, {
5157
5166
  titleId: group.props.label && group.props.label.replace(/\W/g, '-'),
5158
5167
  children: group.props.children ? (React__namespace.createElement("fieldset", { "aria-labelledby": group.props.label && group.props.label.replace(/\W/g, '-'), className: css(_default$b.selectMenuFieldset) }, React__namespace.Children.map(group.props.children, (option) => option.type === Divider
@@ -5620,7 +5629,9 @@
5620
5629
  this.state.viewMoreNextIndex !== -1 &&
5621
5630
  this.refCollection.length > this.state.viewMoreNextIndex &&
5622
5631
  this.props.loadingVariant !== 'spinner' &&
5623
- this.refCollection[this.state.viewMoreNextIndex][0]) {
5632
+ this.refCollection[this.state.viewMoreNextIndex][0] &&
5633
+ this.props.variant !== 'typeahead' && // do not hard focus newly added items for typeahead variants
5634
+ this.props.variant !== 'typeaheadmulti') {
5624
5635
  this.refCollection[this.state.viewMoreNextIndex][0].focus();
5625
5636
  }
5626
5637
  const hasUpdatedChildren = prevProps.children.length !== this.props.children.length ||
@@ -5822,6 +5833,7 @@
5822
5833
  this.moveFocus = (nextIndex, updateCurrentIndex = true) => {
5823
5834
  const { isCreatable, createText } = this.props;
5824
5835
  const hasDescriptionElm = Boolean(this.refCollection[nextIndex][0] && this.refCollection[nextIndex][0].classList.contains('pf-m-description'));
5836
+ const isLoad = Boolean(this.refCollection[nextIndex][0] && this.refCollection[nextIndex][0].classList.contains('pf-m-load'));
5825
5837
  const optionTextElm = hasDescriptionElm
5826
5838
  ? this.refCollection[nextIndex][0].firstElementChild
5827
5839
  : this.refCollection[nextIndex][0];
@@ -5829,7 +5841,8 @@
5829
5841
  if (isCreatable && optionTextElm.innerText.includes(createText)) {
5830
5842
  typeaheadInputValue = this.state.creatableValue;
5831
5843
  }
5832
- else if (optionTextElm) {
5844
+ else if (optionTextElm && !isLoad) {
5845
+ // !isLoad prevents the view more button text from appearing the typeahead input
5833
5846
  typeaheadInputValue = optionTextElm.innerText;
5834
5847
  }
5835
5848
  this.setState(prevState => ({
@@ -5875,15 +5888,17 @@
5875
5888
  if (typeaheadCurrIndex !== -1 && // do not allow selection without moving to an initial option
5876
5889
  (typeaheadActiveChild || (this.refCollection[0] && this.refCollection[0][0]))) {
5877
5890
  if (typeaheadActiveChild) {
5878
- const hasDescriptionElm = typeaheadActiveChild.childElementCount > 1;
5879
- const typeaheadActiveChildText = hasDescriptionElm
5880
- ? typeaheadActiveChild.firstChild.innerText
5881
- : typeaheadActiveChild.innerText;
5882
- this.setState({
5883
- typeaheadInputValue: typeaheadActiveChildText
5884
- });
5891
+ if (!typeaheadActiveChild.classList.contains('pf-m-load')) {
5892
+ const hasDescriptionElm = typeaheadActiveChild.childElementCount > 1;
5893
+ const typeaheadActiveChildText = hasDescriptionElm
5894
+ ? typeaheadActiveChild.firstChild.innerText
5895
+ : typeaheadActiveChild.innerText;
5896
+ this.setState({
5897
+ typeaheadInputValue: typeaheadActiveChildText
5898
+ });
5899
+ }
5885
5900
  }
5886
- else {
5901
+ else if (this.refCollection[0] && this.refCollection[0][0]) {
5887
5902
  this.setState({
5888
5903
  typeaheadInputValue: this.refCollection[0][0].innerText
5889
5904
  });
@@ -6162,15 +6177,16 @@
6162
6177
  }
6163
6178
  });
6164
6179
  }
6165
- return typeaheadChildren.map((child) => {
6180
+ return typeaheadChildren.map((child, index) => {
6166
6181
  const childElement = child;
6167
6182
  return childElement.type.displayName === 'Divider'
6168
6183
  ? child
6169
6184
  : React__namespace.cloneElement(child, {
6170
- isFocused: typeaheadActiveChild &&
6171
- (typeaheadActiveChild.innerText === child.props.value.toString() ||
6185
+ isFocused: typeaheadActiveChild
6186
+ ? typeaheadActiveChild.innerText === child.props.value.toString() ||
6172
6187
  (this.props.isCreatable &&
6173
- typeaheadActiveChild.innerText === `{createText} "${child.props.value}"`))
6188
+ typeaheadActiveChild.innerText === `{createText} "${child.props.value}"`)
6189
+ : index === typeaheadCurrIndex // fallback for view more + typeahead use cases, when the new expanded list is loaded and refCollection hasn't be updated yet
6174
6190
  });
6175
6191
  });
6176
6192
  }