@ember-eui/core 1.6.9 → 1.6.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
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
singleSelection=@singleSelection
|
|
26
26
|
onClose=@removeTag
|
|
27
27
|
onCreateOption=(if
|
|
28
|
-
@onCreateOption
|
|
28
|
+
@onCreateOption this.onCreateOption
|
|
29
29
|
)
|
|
30
30
|
}}
|
|
31
31
|
@matcher={{@matcher}}
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
(component
|
|
80
80
|
"eui-combo-box/create-option"
|
|
81
81
|
customOptionText=@customOptionText
|
|
82
|
-
onCreateOption=
|
|
82
|
+
onCreateOption=this.onCreateOption
|
|
83
83
|
select=this.select
|
|
84
84
|
)
|
|
85
85
|
(component "eui-combo-box/no-matches-message")
|
|
@@ -88,4 +88,4 @@
|
|
|
88
88
|
as |option i|
|
|
89
89
|
>
|
|
90
90
|
{{yield option i}}
|
|
91
|
-
</PowerSelectMultiple>
|
|
91
|
+
</PowerSelectMultiple>
|
|
@@ -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
|
|
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
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ember-eui/core",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.10",
|
|
4
4
|
"description": "Ember Components for Elastic UI",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon",
|
|
@@ -154,5 +154,5 @@
|
|
|
154
154
|
"volta": {
|
|
155
155
|
"node": "12.22.1"
|
|
156
156
|
},
|
|
157
|
-
"gitHead": "
|
|
157
|
+
"gitHead": "bef5d8048386f9a9e4050409a91241a5b85499eb"
|
|
158
158
|
}
|