@jetbrains/ring-ui 5.1.7 → 5.1.8

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.
@@ -17,6 +17,7 @@ export interface FocusChange {
17
17
  }
18
18
  export interface QueryAssistChange {
19
19
  query: string;
20
+ prevCaret?: number | null;
20
21
  caret: number;
21
22
  focus?: boolean;
22
23
  selection?: Position | number | null;
@@ -239,6 +239,7 @@ export default class QueryAssist extends Component {
239
239
  this.setupRequestHandler(delay);
240
240
  const shouldSetCaret = typeof caret === 'number' && caret !== prevProps.caret;
241
241
  if (shouldSetCaret) {
242
+ this.immediateState.prevCaret = prevProps.caret;
242
243
  this.immediateState.caret = caret;
243
244
  }
244
245
  if (typeof query === 'string' && queryChanged && query !== this.immediateState.query) {
@@ -447,6 +448,7 @@ export default class QueryAssist extends Component {
447
448
  : currentCaret?.position ?? 0;
448
449
  const popupHidden = (!this.state.showPopup) && e.type === 'click';
449
450
  if (!this.props.disabled && (caret !== this.immediateState.caret || popupHidden)) {
451
+ this.immediateState.prevCaret = this.immediateState.caret;
450
452
  this.immediateState.caret = caret;
451
453
  this.scrollInput();
452
454
  if (this.immediateState.query.length > 0) {
@@ -506,6 +508,7 @@ export default class QueryAssist extends Component {
506
508
  const prefix = suggestion.prefix || '';
507
509
  const suffix = suggestion.suffix || '';
508
510
  const state = {
511
+ prevCaret: currentCaret,
509
512
  caret: suggestion.caret ?? 0,
510
513
  selection: suggestion.caret ?? 0,
511
514
  query: query.substr(0, suggestion.completionStart) + prefix + suggestion.option + suffix
@@ -17,6 +17,7 @@ export interface FocusChange {
17
17
  }
18
18
  export interface QueryAssistChange {
19
19
  query: string;
20
+ prevCaret?: number | null;
20
21
  caret: number;
21
22
  focus?: boolean;
22
23
  selection?: Position | number | null;
@@ -342,6 +342,7 @@ var QueryAssist = /*#__PURE__*/function (_Component) {
342
342
  var caret = typeof currentCaret === 'number' ? currentCaret : (_currentCaret$positio2 = currentCaret === null || currentCaret === void 0 ? void 0 : currentCaret.position) !== null && _currentCaret$positio2 !== void 0 ? _currentCaret$positio2 : 0;
343
343
  var popupHidden = !_this.state.showPopup && e.type === 'click';
344
344
  if (!_this.props.disabled && (caret !== _this.immediateState.caret || popupHidden)) {
345
+ _this.immediateState.prevCaret = _this.immediateState.caret;
345
346
  _this.immediateState.caret = caret;
346
347
  _this.scrollInput();
347
348
  if (_this.immediateState.query.length > 0) {
@@ -421,6 +422,7 @@ var QueryAssist = /*#__PURE__*/function (_Component) {
421
422
  var prefix = suggestion.prefix || '';
422
423
  var suffix = suggestion.suffix || '';
423
424
  var state = {
425
+ prevCaret: currentCaret,
424
426
  caret: (_suggestion$caret = suggestion.caret) !== null && _suggestion$caret !== void 0 ? _suggestion$caret : 0,
425
427
  selection: (_suggestion$caret2 = suggestion.caret) !== null && _suggestion$caret2 !== void 0 ? _suggestion$caret2 : 0,
426
428
  query: query.substr(0, suggestion.completionStart) + prefix + suggestion.option + suffix
@@ -608,6 +610,7 @@ var QueryAssist = /*#__PURE__*/function (_Component) {
608
610
  this.setupRequestHandler(delay);
609
611
  var shouldSetCaret = typeof caret === 'number' && caret !== prevProps.caret;
610
612
  if (shouldSetCaret) {
613
+ this.immediateState.prevCaret = prevProps.caret;
611
614
  this.immediateState.caret = caret;
612
615
  }
613
616
  if (typeof query === 'string' && queryChanged && query !== this.immediateState.query) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetbrains/ring-ui",
3
- "version": "5.1.7",
3
+ "version": "5.1.8",
4
4
  "description": "JetBrains UI library",
5
5
  "author": "JetBrains",
6
6
  "license": "Apache-2.0",
@@ -119,7 +119,7 @@
119
119
  "babel-plugin-react-docgen": "^4.2.1",
120
120
  "babel-plugin-require-context-hook": "^1.0.0",
121
121
  "caniuse-lite": "^1.0.30001540",
122
- "chai": "^4.3.8",
122
+ "chai": "^4.3.9",
123
123
  "chai-as-promised": "^7.1.1",
124
124
  "chai-dom": "^1.10.0",
125
125
  "chai-enzyme": "1.0.0-beta.1",