@ember-eui/core 7.1.2 → 7.1.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.
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
2
|
import { action } from '@ember/object';
|
|
3
3
|
import { tracked, cached } from '@glimmer/tracking';
|
|
4
|
-
//@ts-ignore
|
|
5
4
|
import { emberPowerSelectIsGroup } from 'ember-power-select/helpers/ember-power-select-is-group';
|
|
6
5
|
import { isEqual } from '@ember/utils';
|
|
7
6
|
|
|
@@ -23,16 +22,17 @@ interface Select {
|
|
|
23
22
|
};
|
|
24
23
|
}
|
|
25
24
|
|
|
26
|
-
interface
|
|
27
|
-
|
|
25
|
+
interface Sliceable<T> {
|
|
26
|
+
slice(): T[];
|
|
28
27
|
}
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
|
|
29
|
+
const isSliceable = <T>(coll: any): coll is Sliceable<T> => {
|
|
30
|
+
return typeof coll.slice === 'function' && typeof coll.sort === 'function';
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
const toPlainArray = <T>(collection: T[] |
|
|
34
|
-
if (
|
|
35
|
-
return collection.
|
|
33
|
+
export const toPlainArray = <T>(collection: T[] | Sliceable<T>): T[] => {
|
|
34
|
+
if (isSliceable<T>(collection)) {
|
|
35
|
+
return collection.slice();
|
|
36
36
|
} else {
|
|
37
37
|
return collection;
|
|
38
38
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import EmberPowerSelectOptions from 'ember-power-select/components/power-select/options';
|
|
2
2
|
import { emberPowerSelectIsGroup } from 'ember-power-select/helpers/ember-power-select-is-group';
|
|
3
3
|
import config from 'ember-get-config';
|
|
4
|
+
import { toPlainArray } from '..';
|
|
4
5
|
|
|
5
6
|
export default class EuiComboBoxOptionsComponent extends EmberPowerSelectOptions {
|
|
6
7
|
_optionsCache = [];
|
|
@@ -22,7 +23,7 @@ export default class EuiComboBoxOptionsComponent extends EmberPowerSelectOptions
|
|
|
22
23
|
|
|
23
24
|
_optionFromIndex(index) {
|
|
24
25
|
let parts = index.split('.');
|
|
25
|
-
let option = this.flattedOptions
|
|
26
|
+
let option = toPlainArray(this.flattedOptions).at?.(parseInt(parts[0], 10));
|
|
26
27
|
for (let i = 1; i < parts.length; i++) {
|
|
27
28
|
option = option.options[parseInt(parts[i], 10)];
|
|
28
29
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ember-eui/core",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.3",
|
|
4
4
|
"description": "Ember Components for Elastic UI",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon",
|
|
@@ -186,5 +186,5 @@
|
|
|
186
186
|
"volta": {
|
|
187
187
|
"extends": "../../package.json"
|
|
188
188
|
},
|
|
189
|
-
"gitHead": "
|
|
189
|
+
"gitHead": "b31eb2bf6cd5c5c15a271a88b7d7386df271ed4d"
|
|
190
190
|
}
|