@dative-gpi/foundation-shared-components 1.0.130 → 1.0.131-fix-trtf2
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.
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
</template>
|
|
78
78
|
|
|
79
79
|
<script lang="ts">
|
|
80
|
-
import { defineComponent, type PropType, ref } from 'vue';
|
|
80
|
+
import { defineComponent, type PropType, ref, computed, watch } from 'vue';
|
|
81
81
|
|
|
82
82
|
import { useAppLanguages } from "@dative-gpi/foundation-shared-services/composables";
|
|
83
83
|
|
|
@@ -134,18 +134,21 @@ export default defineComponent({
|
|
|
134
134
|
setup(props, { emit }) {
|
|
135
135
|
const { languages } = useAppLanguages();
|
|
136
136
|
|
|
137
|
-
const innerTranslations = ref
|
|
137
|
+
const innerTranslations = ref<{
|
|
138
|
+
languageCode: string;
|
|
139
|
+
[key: string]: string | object | null;
|
|
140
|
+
}[]>([]);
|
|
138
141
|
|
|
139
|
-
const getTranslation = (
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
return emptyLexicalState;
|
|
142
|
+
const getTranslation = computed(() => {
|
|
143
|
+
const translationsMap = new Map(
|
|
144
|
+
innerTranslations.value.map((t) => [t.languageCode, t[props.property]])
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
return (languageCode: string) => {
|
|
148
|
+
return translationsMap.get(languageCode) || emptyLexicalState;
|
|
146
149
|
}
|
|
147
|
-
|
|
148
|
-
};
|
|
150
|
+
|
|
151
|
+
});
|
|
149
152
|
|
|
150
153
|
const setTranslation = (languageCode: string, value: string): void => {
|
|
151
154
|
if (!innerTranslations.value) {
|
|
@@ -178,6 +181,18 @@ export default defineComponent({
|
|
|
178
181
|
emit('update:translationsExpanded', false);
|
|
179
182
|
};
|
|
180
183
|
|
|
184
|
+
watch(() => props.translations, (newTranslations) => {
|
|
185
|
+
innerTranslations.value = newTranslations.map((tranlation) => {
|
|
186
|
+
if(typeof tranlation[props.property] === 'string'){
|
|
187
|
+
return tranlation;
|
|
188
|
+
}
|
|
189
|
+
return {
|
|
190
|
+
...tranlation,
|
|
191
|
+
[props.property]: JSON.stringify(tranlation[props.property])
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
}, { immediate: true });
|
|
195
|
+
|
|
181
196
|
return {
|
|
182
197
|
languages,
|
|
183
198
|
onCancelTranslations,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dative-gpi/foundation-shared-components",
|
|
3
3
|
"sideEffects": false,
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.131-fix-trtf2",
|
|
5
5
|
"description": "",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"author": "",
|
|
11
11
|
"license": "ISC",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@dative-gpi/foundation-shared-domain": "1.0.
|
|
14
|
-
"@dative-gpi/foundation-shared-services": "1.0.
|
|
13
|
+
"@dative-gpi/foundation-shared-domain": "1.0.131-fix-trtf2",
|
|
14
|
+
"@dative-gpi/foundation-shared-services": "1.0.131-fix-trtf2"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
17
|
"@dative-gpi/bones-ui": "^1.0.0",
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"sass": "1.71.1",
|
|
36
36
|
"sass-loader": "13.3.2"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "b2da671b3c2db4b23f6853554d61b3c348705c4e"
|
|
39
39
|
}
|