@ember-eui/core 4.2.2 → 4.2.3

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
@@ -2,6 +2,12 @@
2
2
 
3
3
  ### Master
4
4
 
5
+ ### 4.2.3
6
+ 🐛 Bug / Fixes
7
+ `@ember-eui/core`
8
+ - Cherry pick 1.6.x fix commit hash https://github.com/prysmex/ember-eui/commit/c4b8a4a259f6b86c2be516fd7427f5e48b28cecd
9
+ - Use next for updating the attachTo for `<EuiToolTip />`
10
+
5
11
  ### 4.2.2
6
12
  🐛 Bug / Fixes
7
13
  `@ember-eui/core`
@@ -119,6 +125,11 @@ bump @embroider 1.3.0 regenerating yarn.lock, this finally enables staticCompone
119
125
  💥 Breaking change
120
126
  `@ember-eui/core`
121
127
  - Deprecate `ember-svg-jar` `hbs` strategy for now, just use stock `ember-svg-jar`
128
+
129
+ ### 1.6.10
130
+ 🐛 Bug / Fixes
131
+ `@ember-eui/core`
132
+ - `<EuiComboBox />` fixes to `onCreateOption`
122
133
  ### 1.6.7
123
134
  🐛 Bug / Fixes
124
135
  `@ember-eui/core`
@@ -25,7 +25,7 @@
25
25
  singleSelection=@singleSelection
26
26
  onClose=@removeTag
27
27
  onCreateOption=(if
28
- @onCreateOption (pipe this.onCreateOption @onCreateOption)
28
+ @onCreateOption this.onCreateOption
29
29
  )
30
30
  }}
31
31
  @matcher={{@matcher}}
@@ -75,7 +75,7 @@
75
75
  (component
76
76
  "eui-combo-box/create-option"
77
77
  customOptionText=@customOptionText
78
- onCreateOption=(pipe this.onCreateOption @onCreateOption)
78
+ onCreateOption=this.onCreateOption
79
79
  select=this.select
80
80
  )
81
81
  (component "eui-combo-box/no-matches-message")
@@ -7,6 +7,7 @@ import { isEqual } from '@ember/utils';
7
7
 
8
8
  interface EuiComboBoxArgs {
9
9
  singleSelection: boolean;
10
+ onCreateOption?: (search: string) => boolean | undefined;
10
11
  }
11
12
 
12
13
  interface Select {
@@ -64,9 +65,19 @@ export default class EuiComboBoxComponent extends Component<EuiComboBoxArgs> {
64
65
 
65
66
  @action
66
67
  onCreateOption() {
67
- let search = this.select.searchText;
68
+ let option;
69
+ if (
70
+ this.args.onCreateOption &&
71
+ typeof this.args.onCreateOption === 'function'
72
+ ) {
73
+ // The `onCreateOption` function can be used to sanitize the input or explicitly return `false` to reject the input
74
+ option = this.args.onCreateOption(this.select.searchText);
75
+ if (option === false) {
76
+ return;
77
+ }
78
+ }
79
+ let search = option || this.select.searchText;
68
80
  this.select.actions.search('');
69
- this.select.actions.select(search);
70
81
  this.select.actions.close();
71
82
  return search;
72
83
  }
@@ -5,7 +5,7 @@ import { uniqueId } from '../../helpers/unique-id';
5
5
  import { tracked, cached } from '@glimmer/tracking';
6
6
  import { findPopoverPosition } from '../../utils/popover';
7
7
  import { keys } from '../../utils/keys';
8
- import { later, cancel, scheduleOnce } from '@ember/runloop';
8
+ import { later, cancel, scheduleOnce, next } from '@ember/runloop';
9
9
 
10
10
  export type ToolTipPositions = 'top' | 'right' | 'bottom' | 'left';
11
11
 
@@ -113,9 +113,11 @@ export default class EuiToolTip extends Component<EuiTooltipArgs> {
113
113
  }
114
114
 
115
115
  if (this.args.attachTo && this.args.attachTo !== this._attachTo) {
116
- this.removeAttachToHandlers();
117
- this._attachTo = this.args.attachTo;
118
- this.setupAttachToHandlers();
116
+ next(() => {
117
+ this.removeAttachToHandlers();
118
+ this._attachTo = this.args.attachTo;
119
+ this.setupAttachToHandlers();
120
+ });
119
121
  }
120
122
  }
121
123
 
@@ -246,13 +248,16 @@ export default class EuiToolTip extends Component<EuiTooltipArgs> {
246
248
  }
247
249
  });
248
250
 
249
- const windowWidth = document.documentElement.clientWidth || window.innerWidth;
251
+ const windowWidth =
252
+ document.documentElement.clientWidth || window.innerWidth;
250
253
  const useRightValue = windowWidth / 2 < left;
251
254
 
252
255
  const toolTipStyles: ToolTipStyles = {
253
256
  top: `${top}px`,
254
257
  left: useRightValue ? 'auto' : `${left}px`,
255
- right: useRightValue ? `${windowWidth - left - this.popover.offsetWidth}px` : 'auto'
258
+ right: useRightValue
259
+ ? `${windowWidth - left - this.popover.offsetWidth}px`
260
+ : 'auto'
256
261
  };
257
262
 
258
263
  this.visible = true;
@@ -299,7 +304,8 @@ export default class EuiToolTip extends Component<EuiTooltipArgs> {
299
304
  // left the anchor for a non-child.
300
305
  if (
301
306
  this._anchor === event.relatedTarget ||
302
- (this._anchor != null && !this._anchor.contains(event.relatedTarget as Node))
307
+ (this._anchor != null &&
308
+ !this._anchor.contains(event.relatedTarget as Node))
303
309
  ) {
304
310
  this.hideToolTip();
305
311
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ember-eui/core",
3
- "version": "4.2.2",
3
+ "version": "4.2.3",
4
4
  "description": "Ember Components for Elastic UI",
5
5
  "keywords": [
6
6
  "ember-addon",
@@ -176,5 +176,5 @@
176
176
  "volta": {
177
177
  "extends": "../../package.json"
178
178
  },
179
- "gitHead": "275e6432ca59bbf59d05f0dd4809238c3abaec19"
179
+ "gitHead": "416ebf9ca1d85d3d9404d71badda1af1db82d191"
180
180
  }