@jetbrains/ring-ui 4.2.13 → 4.2.14

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.
@@ -78,7 +78,7 @@ export default class QueryAssist extends Component {
78
78
  /**
79
79
  * Open suggestions popup during the initial render
80
80
  */
81
- autoOpen: PropTypes.bool,
81
+ autoOpen: PropTypes.oneOf([true, false, 'force']),
82
82
  /**
83
83
  * Initial caret position
84
84
  */
@@ -203,7 +203,7 @@ export default class QueryAssist extends Component {
203
203
 
204
204
  this.setupRequestHandler(this.props.delay);
205
205
 
206
- if (this.props.autoOpen && query.length > 0) {
206
+ if (this.props.autoOpen === 'force' || this.props.autoOpen && query.length > 0) {
207
207
  this.requestHandler().
208
208
  catch(noop);
209
209
  } else {
@@ -246,7 +246,7 @@ export default class QueryAssist extends Component {
246
246
  if (typeof query === 'string' && queryChanged && query !== this.immediateState.query) {
247
247
  this.immediateState.query = query;
248
248
 
249
- if (query && prevProps.autoOpen && query.length > 0) {
249
+ if (query && (this.props.autoOpen === 'force' || prevProps.autoOpen && query.length > 0)) {
250
250
  this.requestData();
251
251
  } else if (query) {
252
252
  this.requestStyleRanges();
@@ -373,7 +373,7 @@ export default class QueryAssist extends Component {
373
373
 
374
374
  this.immediateState = props;
375
375
  this.props.onChange(props);
376
- if (props.query.length > 0) {
376
+ if (this.props.autoOpen === 'force' || props.query.length > 0) {
377
377
  this.requestData();
378
378
  }
379
379
  };
@@ -463,12 +463,12 @@ export default class QueryAssist extends Component {
463
463
  if (!this.props.disabled && (caret !== this.immediateState.caret || popupHidden)) {
464
464
  this.immediateState.caret = caret;
465
465
  this.scrollInput();
466
- if (this.immediateState.query.length > 0) {
466
+ if (this.props.autoOpen === 'force' || this.immediateState.query.length > 0) {
467
467
  this.requestData();
468
468
  }
469
469
  }
470
470
 
471
- if (this.immediateState.query.length < 1) {
471
+ if (this.props.autoOpen !== 'force' && this.immediateState.query.length < 1) {
472
472
  this.setState({showPopup: false});
473
473
  }
474
474
  };
@@ -497,7 +497,7 @@ export default class QueryAssist extends Component {
497
497
  placeholderEnabled: !query,
498
498
  query,
499
499
  suggestions,
500
- showPopup: !!suggestions.length && !afterCompletion
500
+ showPopup: !!suggestions.length && (this.props.autoOpen === 'force' || !afterCompletion)
501
501
  };
502
502
 
503
503
  this.immediateState.suggestionsQuery = query;
@@ -233,7 +233,7 @@ class QueryAssist extends Component {
233
233
  this.immediateState = props;
234
234
  this.props.onChange(props);
235
235
 
236
- if (props.query.length > 0) {
236
+ if (this.props.autoOpen === 'force' || props.query.length > 0) {
237
237
  this.requestData();
238
238
  }
239
239
  });
@@ -314,12 +314,12 @@ class QueryAssist extends Component {
314
314
  this.immediateState.caret = caret;
315
315
  this.scrollInput();
316
316
 
317
- if (this.immediateState.query.length > 0) {
317
+ if (this.props.autoOpen === 'force' || this.immediateState.query.length > 0) {
318
318
  this.requestData();
319
319
  }
320
320
  }
321
321
 
322
- if (this.immediateState.query.length < 1) {
322
+ if (this.props.autoOpen !== 'force' && this.immediateState.query.length < 1) {
323
323
  this.setState({
324
324
  showPopup: false
325
325
  });
@@ -355,7 +355,7 @@ class QueryAssist extends Component {
355
355
  placeholderEnabled: !query,
356
356
  query,
357
357
  suggestions,
358
- showPopup: !!suggestions.length && !afterCompletion
358
+ showPopup: !!suggestions.length && (_this.props.autoOpen === 'force' || !afterCompletion)
359
359
  };
360
360
  _this.immediateState.suggestionsQuery = query; // Do not update deep equal styleRanges to simplify shouldComponentUpdate check
361
361
 
@@ -585,7 +585,7 @@ class QueryAssist extends Component {
585
585
  };
586
586
  this.setupRequestHandler(this.props.delay);
587
587
 
588
- if (this.props.autoOpen && query.length > 0) {
588
+ if (this.props.autoOpen === 'force' || this.props.autoOpen && query.length > 0) {
589
589
  this.requestHandler().catch(noop);
590
590
  } else {
591
591
  this.requestStyleRanges().catch(noop);
@@ -618,7 +618,7 @@ class QueryAssist extends Component {
618
618
  if (typeof query === 'string' && queryChanged && query !== this.immediateState.query) {
619
619
  this.immediateState.query = query;
620
620
 
621
- if (query && prevProps.autoOpen && query.length > 0) {
621
+ if (query && (this.props.autoOpen === 'force' || prevProps.autoOpen && query.length > 0)) {
622
622
  this.requestData();
623
623
  } else if (query) {
624
624
  this.requestStyleRanges();
@@ -972,7 +972,7 @@ _defineProperty(QueryAssist, "propTypes", {
972
972
  /**
973
973
  * Open suggestions popup during the initial render
974
974
  */
975
- autoOpen: PropTypes.bool,
975
+ autoOpen: PropTypes.oneOf([true, false, 'force']),
976
976
 
977
977
  /**
978
978
  * Initial caret position
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetbrains/ring-ui",
3
- "version": "4.2.13",
3
+ "version": "4.2.14",
4
4
  "description": "JetBrains UI library",
5
5
  "author": "JetBrains",
6
6
  "license": "Apache-2.0",
@@ -221,5 +221,5 @@
221
221
  "node": ">=7.4",
222
222
  "npm": ">=6.0.0"
223
223
  },
224
- "gitHead": "fdcafb6267f5633a02b2c3c3cbe75ddb85ad298f"
224
+ "gitHead": "d437ea6bd53fa3a0157bca3c8a5c9ed46bb514a7"
225
225
  }