@webitel/ui-sdk 0.9.42 → 0.9.43
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/package.json
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import baseFilterMixin from './baseFilterMixin/baseFilterMixin';
|
|
2
|
-
import isEmpty from '../../../scripts/isEmpty';
|
|
3
2
|
|
|
4
3
|
export default {
|
|
5
4
|
mixins: [baseFilterMixin],
|
|
@@ -19,25 +18,6 @@ export default {
|
|
|
19
18
|
closeOnSelect() {
|
|
20
19
|
return this.filterSchema?.storedProp;
|
|
21
20
|
},
|
|
22
|
-
localizedValue() {
|
|
23
|
-
if (isEmpty(this.value)) return this.value;
|
|
24
|
-
if (Array.isArray(this.value)) {
|
|
25
|
-
const valueHasLocale = this.value.length && this.value[0].locale; // just check 1st el
|
|
26
|
-
if (valueHasLocale) {
|
|
27
|
-
return this.value.map((val) => ({
|
|
28
|
-
...val,
|
|
29
|
-
name: Array.isArray(val.locale) ? this.$tc(...val.locale) : this.$t(val.locale),
|
|
30
|
-
}));
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
if (typeof this.value === 'object' && this.value.locale) {
|
|
34
|
-
return {
|
|
35
|
-
...this.value,
|
|
36
|
-
name: Array.isArray(this.value.locale) ? this.$tc(...this.value.locale) : this.$t(this.value.locale),
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
return this.value;
|
|
40
|
-
},
|
|
41
21
|
localizedOptions() {
|
|
42
22
|
const optsHaveLocale = this.options.length && this.options[0].locale; // just check 1st el
|
|
43
23
|
if (optsHaveLocale) {
|
|
@@ -53,11 +33,11 @@ export default {
|
|
|
53
33
|
restoreValue(value) {
|
|
54
34
|
let newValue;
|
|
55
35
|
if (Array.isArray(value)) {
|
|
56
|
-
newValue = this.
|
|
36
|
+
newValue = this.localizedOptions
|
|
57
37
|
.filter((option) => value
|
|
58
38
|
.some((value) => value === option[this.storedProp]));
|
|
59
39
|
} else {
|
|
60
|
-
newValue = this.
|
|
40
|
+
newValue = this.localizedOptions
|
|
61
41
|
.find((option) => value === option[this.storedProp]);
|
|
62
42
|
}
|
|
63
43
|
this.setValue({ filter: this.filterQuery, value: newValue });
|