@piveau/piveau-hub-ui-modules 4.6.6 → 4.6.8

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.
Files changed (20) hide show
  1. package/dist/data-provider-interface/components/SimpleSelect.vue.mjs +83 -59
  2. package/dist/data-provider-interface/components/SimpleSelect.vue.mjs.map +1 -1
  3. package/dist/data-provider-interface/composables/useFormSchema.d.ts +5 -1
  4. package/dist/data-provider-interface/composables/useFormSchema.mjs +28 -30
  5. package/dist/data-provider-interface/composables/useFormSchema.mjs.map +1 -1
  6. package/dist/data-provider-interface/utils/translation-helper.mjs +18 -19
  7. package/dist/data-provider-interface/utils/translation-helper.mjs.map +1 -1
  8. package/dist/data-provider-interface/views/InputPage.vue.mjs +60 -59
  9. package/dist/data-provider-interface/views/InputPage.vue.mjs.map +1 -1
  10. package/dist/datasetDetails/distributions/distributionActions/DistributionActions.vue.d.ts +1 -0
  11. package/dist/datasetDetails/distributions/distributionActions/DistributionActions.vue.mjs +45 -35
  12. package/dist/datasetDetails/distributions/distributionActions/DistributionActions.vue.mjs.map +1 -1
  13. package/dist/datasetDetails/distributions/distributionActions/DistributionActions.vue2.mjs +2 -2
  14. package/dist/datasetDetails/distributions/distributionActions/DistributionVisualizeButton.vue.d.ts +35 -0
  15. package/dist/datasetDetails/distributions/distributionActions/DistributionVisualizeButton.vue.mjs +102 -0
  16. package/dist/datasetDetails/distributions/distributionActions/DistributionVisualizeButton.vue.mjs.map +1 -0
  17. package/dist/datasetDetails/distributions/distributionActions/DistributionVisualizeButton.vue2.mjs +5 -0
  18. package/dist/datasetDetails/distributions/distributionActions/DistributionVisualizeButton.vue2.mjs.map +1 -0
  19. package/dist/piveau-hub-ui-modules.css +1 -1
  20. package/package.json +1 -1
@@ -1,84 +1,108 @@
1
- import { computed as c, ref as n, onMounted as _, openBlock as d, createElementBlock as u, createElementVNode as m, toDisplayString as p, createTextVNode as v, createVNode as O, unref as r, isRef as C, withDirectives as j, Fragment as h, renderList as x, createCommentVNode as F, vShow as R } from "vue";
2
- import { useStore as U } from "vuex";
3
- import { getNode as f } from "@formkit/core";
4
- import { onClickOutside as q } from "../../external/@vueuse/core/index";
5
- import A from "axios";
6
- import { useRuntimeEnv as B } from "../../composables/useRuntimeEnv.mjs";
7
- import { has as S, isNil as L } from "lodash-es";
8
- import { FormKit as D } from "@formkit/vue";
1
+ import { computed as r, ref as n, watch as L, onMounted as z, nextTick as S, openBlock as i, createElementBlock as u, createElementVNode as R, toDisplayString as k, createTextVNode as y, withDirectives as E, createVNode as N, unref as O, vShow as $, Fragment as U, renderList as _, createCommentVNode as A } from "vue";
2
+ import { useStore as G } from "vuex";
3
+ import { getNode as H } from "@formkit/core";
4
+ import { onClickOutside as J, useAsyncState as X } from "../../external/@vueuse/core/index";
5
+ import Y from "axios";
6
+ import { useRuntimeEnv as Z } from "../../composables/useRuntimeEnv.mjs";
7
+ import { has as T, isNil as j } from "lodash-es";
8
+ import { FormKit as q } from "@formkit/vue";
9
9
  import "./SimpleSelect.vue2.mjs";
10
- const J = { class: "formkitProperty" }, K = { class: "position-relative formkitCmpWrap" }, $ = ["onClick"], M = ["onClick"], Z = {
10
+ const ee = { class: "formkitProperty" }, te = {
11
+ key: 0,
12
+ class: "position-relative formkitCmpWrap"
13
+ }, le = ["onClick"], ae = ["onClick"], pe = {
11
14
  __name: "SimpleSelect",
12
15
  props: {
13
16
  context: Object
14
17
  },
15
- setup(N) {
16
- const i = N;
17
- c(() => localStorage.getItem("dpi_duplicate"));
18
- const g = c(() => b.getters["auth/getUserCatalogIds"]);
19
- let o = n();
20
- const b = U(), k = n(null), V = n();
21
- n(!0), V.value = c(() => b.getters["auth/getIsEditMode"]);
22
- let s = n([]), w = B(), a = n();
23
- a = f("dcat:catalog").value, q(k, (l) => o.value = !1);
24
- const y = async (l) => {
25
- l.id ? (i.context.node.input(l.id), o.value = !o.value, f("dcat:catalog").value = l.id, a = l.name) : (i.context.node.input(l), o.value = !o.value, f("dcat:catalog").value = l, a = l);
26
- };
27
- let E = async () => {
28
- let l;
29
- await A.get(w.api.baseUrl + "search?filter=catalogue&limit=1000").then((e) => l = e).catch((e) => {
30
- reject(e);
31
- }), l.data.result.results.forEach((e) => {
32
- S(e, "title") && !L(e.title) && S(e, "id") && !L(e.id) && s.value.push({ title: Object.values(e.title)[0], id: e.id });
33
- }), s.value = await s.value.filter((e) => g.value.includes(e.id)).map((e) => ({ id: e.id, name: e.title }));
34
- let t = JSON.parse(JSON.stringify(s.value));
35
- t.length === 1 && (a = t[0].id);
36
- };
37
- return _(async () => {
38
- E();
39
- }), (l, t) => (d(), u("div", J, [
40
- m("h4", null, p(i.context.label), 1),
41
- t[4] || (t[4] = v()),
42
- m("div", K, [
43
- O(r(D), {
18
+ setup(B) {
19
+ const d = B;
20
+ r(() => localStorage.getItem("dpi_duplicate"));
21
+ const C = r(() => x.getters["auth/getUserCatalogIds"]), m = n(!1), x = G(), V = n(null), K = n();
22
+ n(!0), K.value = r(() => x.getters["auth/getIsEditMode"]);
23
+ const M = Z(), p = n(""), v = n(""), w = n(!1);
24
+ J(V, (l) => m.value = !1);
25
+ const f = async (l) => {
26
+ l.id ? (v.value = l.id, p.value = l.name) : (v.value = l, p.value = l), m.value = !1;
27
+ }, { execute: Q, state: s, isReady: D, error: h } = X(async () => await Y.get(M.api.baseUrl + "search?filter=catalogue&limit=1000"), { data: { result: { results: [] } } }, { immediate: !1 }), P = r(() => w.value && !!s.value && D.value);
28
+ L(h, () => {
29
+ console.error(h.value);
30
+ });
31
+ const F = r(() => {
32
+ var l, e, t, a;
33
+ return ((a = (t = (e = (l = s == null ? void 0 : s.value) == null ? void 0 : l.data) == null ? void 0 : e.result) == null ? void 0 : t.results) == null ? void 0 : a.length) > 0;
34
+ }), W = r(() => {
35
+ var l, e, t, a;
36
+ return F && ((a = (t = (e = (l = s == null ? void 0 : s.value) == null ? void 0 : l.data) == null ? void 0 : e.result) == null ? void 0 : t.results) == null ? void 0 : a.length) === 1;
37
+ }), b = r(() => {
38
+ var a, c, g, I;
39
+ return F ? ((I = (g = (c = (a = s.value) == null ? void 0 : a.data) == null ? void 0 : c.result) == null ? void 0 : g.results) == null ? void 0 : I.map((o) => {
40
+ if (T(o, "title") && !j(o.title) && T(o, "id") && !j(o.id))
41
+ return { title: Object.values(o.title)[0], id: o.id };
42
+ })).filter((o) => C.value.includes(o.id)).map((o) => ({ id: o.id, name: o.title })) : [];
43
+ });
44
+ return L(W, (l) => {
45
+ if (l) {
46
+ const e = s.value.data.result.results[0];
47
+ f({ id: e.id, name: e.name });
48
+ }
49
+ }, { immediate: !0 }), z(async () => {
50
+ var t, a, c;
51
+ await Q(), await S();
52
+ const l = ((a = (t = H) == null ? void 0 : t("dcat:catalog")) == null ? void 0 : a.value) || void 0, e = (c = b.value) == null ? void 0 : c.find((g) => g.id === l);
53
+ e && f({ id: e.id, name: e.name }), await S(), w.value = !0;
54
+ }), (l, e) => (i(), u("div", ee, [
55
+ R("h4", null, k(d.context.label), 1),
56
+ e[6] || (e[6] = y()),
57
+ P.value ? (i(), u("div", te, [
58
+ E(N(O(q), {
59
+ modelValue: v.value,
60
+ "onUpdate:modelValue": e[0] || (e[0] = (t) => v.value = t),
61
+ name: `${d.context.node.name}`,
62
+ type: "text"
63
+ }, null, 8, ["modelValue", "name"]), [
64
+ [$, !1]
65
+ ]),
66
+ e[4] || (e[4] = y()),
67
+ N(O(q), {
44
68
  class: "autocompleteInputfield",
45
- modelValue: r(a),
46
- "onUpdate:modelValue": t[0] || (t[0] = (e) => C(a) ? a.value = e : a = e),
47
- placeholder: i.context.attrs.placeholder,
69
+ modelValue: p.value,
70
+ "onUpdate:modelValue": e[1] || (e[1] = (t) => p.value = t),
71
+ placeholder: d.context.attrs.placeholder,
48
72
  type: "text",
49
- onClick: t[1] || (t[1] = (e) => C(o) ? o.value = !r(o) : o = !r(o)),
73
+ onClick: e[2] || (e[2] = (t) => m.value = !m.value),
50
74
  validation: "required",
51
75
  mandatory: "true",
52
76
  "validation-messages": {
53
- required: i.context.attrs.placeholder
77
+ required: d.context.attrs.placeholder
54
78
  },
55
- name: i.context.node.name
79
+ name: `${d.context.node.name}__displayedValue`
56
80
  }, null, 8, ["modelValue", "placeholder", "validation-messages", "name"]),
57
- t[3] || (t[3] = v()),
58
- j(m("ul", {
81
+ e[5] || (e[5] = y()),
82
+ E(R("ul", {
59
83
  ref_key: "dropdownList",
60
- ref: k,
84
+ ref: V,
61
85
  class: "autocompleteResultList selectListFK catSelectList"
62
86
  }, [
63
- (d(!0), u(h, null, x(r(s), (e) => (d(), u("li", {
64
- key: e,
65
- onClick: (I) => y(e),
87
+ (i(!0), u(U, null, _(b.value, (t) => (i(), u("li", {
88
+ key: t,
89
+ onClick: (a) => f(t),
66
90
  class: "p-2 border-b border-gray-200 data-[selected=true]:bg-blue-100 choosableItemsAC"
67
- }, p(e.name), 9, $))), 128)),
68
- t[2] || (t[2] = v()),
69
- r(s).length === 0 ? (d(!0), u(h, { key: 0 }, x(g.value, (e) => (d(), u("li", {
70
- key: e,
71
- onClick: (I) => y(e),
91
+ }, k(t.name), 9, le))), 128)),
92
+ e[3] || (e[3] = y()),
93
+ b.value.length === 0 ? (i(!0), u(U, { key: 0 }, _(C.value, (t) => (i(), u("li", {
94
+ key: t,
95
+ onClick: (a) => f(t),
72
96
  class: "p-2 border-b border-gray-200 data-[selected=true]:bg-blue-100 choosableItemsAC"
73
- }, p(e), 9, M))), 128)) : F("", !0)
97
+ }, k(t), 9, ae))), 128)) : A("", !0)
74
98
  ], 512), [
75
- [R, r(o)]
99
+ [$, m.value]
76
100
  ])
77
- ])
101
+ ])) : A("", !0)
78
102
  ]));
79
103
  }
80
104
  };
81
105
  export {
82
- Z as default
106
+ pe as default
83
107
  };
84
108
  //# sourceMappingURL=SimpleSelect.vue.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"SimpleSelect.vue.mjs","sources":["../../../lib/data-provider-interface/components/SimpleSelect.vue"],"sourcesContent":["<template>\n <div class=\"formkitProperty\">\n <h4>{{ props.context.label }}</h4>\n <div class=\"position-relative formkitCmpWrap\">\n \n \n <FormKit class=\"autocompleteInputfield\" v-model=\"catVal\"\n :placeholder=\"props.context.attrs.placeholder\" type=\"text\" @click=\"showList = !showList\"\n validation=\"required\" mandatory=\"true\" :validation-messages=\"{\n required: props.context.attrs.placeholder,\n }\" :name=\"props.context.node.name\" />\n\n <ul ref=\"dropdownList\" v-show=\"showList\" class=\"autocompleteResultList selectListFK catSelectList\">\n\n <li v-for=\"match in filteredCatalogs\" :key=\"match\" @click=\"setvalue(match)\"\n class=\"p-2 border-b border-gray-200 data-[selected=true]:bg-blue-100 choosableItemsAC\">{{\n match.name }}\n </li>\n <li v-if=\"filteredCatalogs.length === 0\" v-for=\"idMatch in userCats\" :key=\"idMatch\"\n @click=\"setvalue(idMatch)\"\n class=\"p-2 border-b border-gray-200 data-[selected=true]:bg-blue-100 choosableItemsAC\">{{\n idMatch }}\n </li>\n </ul>\n </div>\n </div>\n\n</template>\n<script setup>\nimport { ref, computed, onMounted } from 'vue';\nimport { useStore } from 'vuex';\nimport { getNode } from '@formkit/core'\nimport { onClickOutside } from '@vueuse/core'\nimport axios from 'axios'\nimport { useRuntimeEnv } from \"../../composables/useRuntimeEnv.ts\";\nimport {\n has,\n isNil,\n} from 'lodash-es';\nimport { FormKit } from '@formkit/vue';\n\nconst props = defineProps({\n context: Object\n})\n\n\n\nconst isDuplicate = computed(()=> localStorage.getItem('dpi_duplicate'))\nconst userCats = computed(() => store.getters['auth/getUserCatalogIds']);\nlet showList = ref()\nconst store = useStore()\nconst dropdownList = ref(null)\nconst isEditMode = ref()\nlet validationTrigger = ref(true)\nisEditMode.value = computed(() => store.getters['auth/getIsEditMode']);\nlet filteredCatalogs = ref([])\nlet env = useRuntimeEnv()\nlet catVal = ref()\n\ncatVal = getNode('dcat:catalog').value\n\nonClickOutside(dropdownList, event => showList.value = false)\n\nconst setvalue = async (e) => {\n \n validationTrigger = false\n if (e.id) {\n props.context.node.input(e.id)\n showList.value = !showList.value;\n getNode('dcat:catalog').value = e.id\n catVal = e.name\n } else {\n props.context.node.input(e)\n showList.value = !showList.value;\n getNode('dcat:catalog').value = e\n catVal = e\n }\n\n}\nlet filterCatList = async () => {\n let cache;\n await axios\n .get(env.api.baseUrl + 'search?filter=catalogue&limit=1000')\n .then(response => (cache = response))\n .catch((err) => {\n reject(err);\n });\n\n \n cache.data.result.results.forEach((e) => {\n // console.log(cache);\n \n if (has(e, 'title') && !isNil(e.title) && has(e, 'id') && !isNil(e.id)) filteredCatalogs.value.push({ title: Object.values(e.title)[0], id: e.id })\n });\n\n filteredCatalogs.value = await filteredCatalogs.value\n .filter(item => userCats.value.includes(item.id))\n .map(item => ({ id: item.id, name: item.title }));\n\n // Check if theres only one catalog and set it directly\n\n let clone = JSON.parse(JSON.stringify(filteredCatalogs.value))\n if (clone.length === 1) {\n catVal = clone[0].id\n }\n}\n\n\nonMounted(async () => {\n filterCatList();\n});\n\n</script>\n<style>\n.catSelectList {\n width: 97.3% !important;\n margin: 0 1rem;\n}\n\n.selectListFK {\n\n max-height: 20rem;\n overflow: overlay;\n overflow-x: hidden;\n}\n</style>"],"names":["props","__props","computed","userCats","store","showList","ref","useStore","dropdownList","isEditMode","filteredCatalogs","env","useRuntimeEnv","catVal","getNode","onClickOutside","event","setvalue","e","filterCatList","cache","axios","response","err","has","isNil","item","clone","onMounted"],"mappings":";;;;;;;;;;;;;;;AAyCA,UAAMA,IAAQC;AAMM,IAAAC,EAAS,MAAK,aAAa,QAAQ,eAAe,CAAC;AACvE,UAAMC,IAAWD,EAAS,MAAME,EAAM,QAAQ,wBAAwB,CAAC;AACvE,QAAIC,IAAWC,EAAI;AACnB,UAAMF,IAAQG,EAAS,GACjBC,IAAeF,EAAI,IAAI,GACvBG,IAAaH,EAAI;AACC,IAAAA,EAAI,EAAI,GAChCG,EAAW,QAAQP,EAAS,MAAME,EAAM,QAAQ,oBAAoB,CAAC;AACrE,QAAIM,IAAmBJ,EAAI,EAA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,MACjBd,IAASc,EAAM,CAAC,EAAE;AAAA,IAE1B;AAGA,WAAAC,EAAU,YAAY;AAClB,MAAAT;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"SimpleSelect.vue.mjs","sources":["../../../lib/data-provider-interface/components/SimpleSelect.vue"],"sourcesContent":["<template>\n <div class=\"formkitProperty\">\n <h4>{{ props.context.label }}</h4>\n <div v-if=\"isReady\" class=\"position-relative formkitCmpWrap\">\n\n <FormKit v-show=\"false\" v-model=\"catId\" :name=\"`${props.context.node.name}`\" type=\"text\" />\n <FormKit class=\"autocompleteInputfield\" v-model=\"catVal\" :placeholder=\"props.context.attrs.placeholder\"\n type=\"text\" @click=\"showList = !showList\" validation=\"required\" mandatory=\"true\" :validation-messages=\"{\n required: props.context.attrs.placeholder,\n }\" :name=\"`${props.context.node.name}__displayedValue`\" />\n\n <ul ref=\"dropdownList\" v-show=\"showList\" class=\"autocompleteResultList selectListFK catSelectList\">\n\n <li v-for=\"match in filteredCatalogs\" :key=\"match\" @click=\"setvalue(match)\"\n class=\"p-2 border-b border-gray-200 data-[selected=true]:bg-blue-100 choosableItemsAC\">{{\n match.name }}\n </li>\n <li v-if=\"filteredCatalogs.length === 0\" v-for=\"idMatch in userCats\" :key=\"idMatch\" @click=\"setvalue(idMatch)\"\n class=\"p-2 border-b border-gray-200 data-[selected=true]:bg-blue-100 choosableItemsAC\">{{\n idMatch }}\n </li>\n </ul>\n </div>\n </div>\n\n</template>\n<script setup>\nimport { ref, computed, onMounted, watch, nextTick } from 'vue';\nimport { useStore } from 'vuex';\nimport { getNode } from '@formkit/core'\nimport { onClickOutside } from '@vueuse/core'\nimport axios from 'axios'\nimport { useRuntimeEnv } from \"../../composables/useRuntimeEnv.ts\";\nimport {\n has,\n isNil,\n} from 'lodash-es';\nimport { useAsyncState } from '@vueuse/core';\nimport { FormKit } from '@formkit/vue';\n\nconst props = defineProps({\n context: Object\n})\n\n\n\nconst isDuplicate = computed(() => localStorage.getItem('dpi_duplicate'))\nconst userCats = computed(() => store.getters['auth/getUserCatalogIds']);\nconst showList = ref(false)\nconst store = useStore()\nconst dropdownList = ref(null)\nconst isEditMode = ref()\nconst validationTrigger = ref(true)\nisEditMode.value = computed(() => store.getters['auth/getIsEditMode']);\nconst env = useRuntimeEnv()\nconst catVal = ref('')\nconst catId = ref('')\nconst hasMounted = ref(false)\n\nonClickOutside(dropdownList, event => showList.value = false)\n\nconst setvalue = async (e) => {\n validationTrigger = false\n if (e.id) {\n catId.value = e.id\n catVal.value = e.name\n } else {\n catId.value = e\n catVal.value = e\n }\n\n showList.value = false\n}\n\nconst { execute: filterCatList, state: catalogListData, isReady: isQueryReady, error } = useAsyncState(async () => {\n const catalogListData = await axios.get(env.api.baseUrl + 'search?filter=catalogue&limit=1000')\n return catalogListData\n}, { data: { result: { results: [] } } }, { immediate: false })\n\nconst isReady = computed(() => hasMounted.value && !!catalogListData.value && isQueryReady.value)\n\nwatch(error, () => {\n console.error(error.value)\n})\n\nconst hasResults = computed(() => {\n return catalogListData?.value?.data?.result?.results?.length > 0\n})\n\nconst hasOneResultOnly = computed(() => {\n return hasResults && catalogListData?.value?.data?.result?.results?.length === 1\n})\n\nconst filteredCatalogs = computed(() => {\n if (!hasResults) return []\n const mapped = catalogListData.value?.data?.result?.results?.map((e) => {\n if (has(e, 'title') && !isNil(e.title) && has(e, 'id') && !isNil(e.id)) return { title: Object.values(e.title)[0], id: e.id }\n });\n const filtered = mapped.filter(item => userCats.value.includes(item.id))\n const mappedFiltered = filtered.map(item => ({ id: item.id, name: item.title }))\n return mappedFiltered\n})\n\nwatch(hasOneResultOnly, (yes) => {\n if (yes) {\n const result = catalogListData.value.data.result.results[0]\n setvalue({ id: result.id, name: result.name })\n }\n}, { immediate: true })\n\nonMounted(async () => {\n await filterCatList()\n await nextTick()\n const catalogIdToLoadForEdit = getNode?.('dcat:catalog')?.value || undefined\n const maybeFoundCatalogFromQuery = filteredCatalogs.value?.find(item => item.id === catalogIdToLoadForEdit)\n if (maybeFoundCatalogFromQuery) {\n setvalue({ id: maybeFoundCatalogFromQuery.id, name: maybeFoundCatalogFromQuery.name })\n }\n await nextTick()\n hasMounted.value = true\n});\n\n</script>\n<style>\n.catSelectList {\n width: 97.3% !important;\n margin: 0 1rem;\n}\n\n.selectListFK {\n\n max-height: 20rem;\n overflow: overlay;\n overflow-x: hidden;\n}\n</style>"],"names":["props","__props","computed","userCats","store","showList","ref","useStore","dropdownList","isEditMode","env","useRuntimeEnv","catVal","catId","hasMounted","onClickOutside","event","setvalue","e","filterCatList","catalogListData","isQueryReady","error","useAsyncState","axios","isReady","watch","hasResults","_d","_c","_b","_a","hasOneResultOnly","filteredCatalogs","has","isNil","item","yes","result","onMounted","nextTick","catalogIdToLoadForEdit","getNode","maybeFoundCatalogFromQuery"],"mappings":";;;;;;;;;;;;;;;;;;AAwCA,UAAMA,IAAQC;AAMM,IAAAC,EAAS,MAAM,aAAa,QAAQ,eAAe,CAAC;AACxE,UAAMC,IAAWD,EAAS,MAAME,EAAM,QAAQ,wBAAwB,CAAC,GACjEC,IAAWC,EAAI,EAAK,GACpBF,IAAQG,EAAS,GACjBC,IAAeF,EAAI,IAAI,GACvBG,IAAaH,EAAI;AACG,IAAAA,EAAI,EAAI,GAClCG,EAAW,QAAQP,EAAS,MAAME,EAAM,QAAQ,oBAAoB,CAAC;AACrE,UAAMM,IAAMC,EAAc,GACpBC,IAASN,EAAI,EAAE,GACfO,IAAQP,EAAI,EAAE,GACdQ,IAAaR,EAAI,EAAK;AAE5B,IAAAS,EAAeP,GAAc,CAAAQ,MAASX,EAAS,QAAQ,EAAK;AAE5D,UAAMY,IAAW,OAAOC,MAAM;AAE5B,MAAIA,EAAE,MACJL,EAAM,QAAQK,EAAE,IAChBN,EAAO,QAAQM,EAAE,SAEjBL,EAAM,QAAQK,GACdN,EAAO,QAAQM,IAGjBb,EAAS,QAAQ;AAAA,IACnB,GAEM,EAAE,SAASc,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AQjC,EAAS,MAAM,SAASiC,EAAK,EAAE,CAAC,EACvC,IAAI,CAAAA,OAAS,EAAE,IAAIA,EAAK,IAAI,MAAMA,EAAK,MAAO,EAAC,IALvD,CAAC;AAAA,IAO3B,CAAC;AAED,WAAAV,EAAMM,GAAkB,CAACK,MAAQ;AAC/B,UAAIA,GAAK;AACP,cAAMC,IAASlB,EAAgB,MAAM,KAAK,OAAO,QAAQ,CAAC;AAC1D,QAAAH,EAAS,EAAE,IAAIqB,EAAO,IAAI,MAAMA,EAAO,MAAM;AAAA,MAC/C;AAAA,IACF,GAAG,EAAE,WAAW,IAAM,GAEtBC,EAAU,YAAY;;AACpB,YAAMpB,EAAc,GACpB,MAAMqB,EAAS;AACf,YAAMC,MAAyBX,KAAAC,IAAAW,MAAA,gBAAAX,EAAU,oBAAV,gBAAAD,EAA2B,UAAS,QAC7Da,KAA6Bd,IAAAI,EAAiB,UAAjB,gBAAAJ,EAAwB,KAAK,CAAAO,MAAQA,EAAK,OAAOK;AACpF,MAAIE,KACF1B,EAAS,EAAE,IAAI0B,EAA2B,IAAI,MAAMA,EAA2B,MAAM,GAEvF,MAAMH,EAAS,GACf1B,EAAW,QAAQ;AAAA,IACrB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,6 +1,10 @@
1
1
  import { MaybeRefOrGetter } from 'vue';
2
2
 
3
- export declare function useFormSchema(): {
3
+ export interface UseFormSchemaOptions {
4
+ t?: (key: string) => string;
5
+ te?: (key: string) => boolean;
6
+ }
7
+ export declare function useFormSchema(options?: UseFormSchemaOptions): {
4
8
  createSchema: ({ property, page }: {
5
9
  property: string;
6
10
  page: string;
@@ -1,10 +1,10 @@
1
- import { computed as h, ref as v, toValue as C } from "vue";
2
- import { useDpiContext as g } from "./useDpiContext.mjs";
3
- import { useI18n as p } from "vue-i18n";
4
- import b from "../utils/translation-helper.mjs";
5
- import { createSharedComposable as x } from "../../external/@vueuse/shared/index";
6
- const D = x(() => {
7
- const i = v({
1
+ import { computed as d, ref as p, toValue as b } from "vue";
2
+ import { useDpiContext as x } from "./useDpiContext.mjs";
3
+ import { useI18n as D } from "vue-i18n";
4
+ import w from "../utils/translation-helper.mjs";
5
+ import { createSharedComposable as A } from "../../external/@vueuse/shared/index";
6
+ const F = A(() => {
7
+ const c = p({
8
8
  schema: {
9
9
  datasets: {},
10
10
  distributions: {},
@@ -12,48 +12,46 @@ const D = x(() => {
12
12
  },
13
13
  usersCatalogs: {}
14
14
  });
15
- return { state: i, getSchema: (a) => h(() => {
16
- const u = C(a);
15
+ return { state: c, getSchema: (a) => d(() => {
16
+ const r = b(a);
17
17
  if (a === "catalogues" || a === "datasets" || a === "distributions")
18
- return i.value.schema[u];
18
+ return c.value.schema[r];
19
19
  }) };
20
20
  });
21
- function y() {
22
- const i = g();
23
- p({ useScope: "global" });
24
- const { state: n, getSchema: a } = D(), u = h(() => i.value.specification);
25
- function f({ property: t, page: e }) {
26
- var c, s;
27
- const o = (c = u.value.pageConent) == null ? void 0 : c[t][e], m = (s = u.value.inputDefinition) == null ? void 0 : s[t], r = JSON.parse(JSON.stringify(n.value));
28
- d({ state: r, pageProperties: o, propertyDefinitions: m, property: t, page: e }), n.value = r;
21
+ function K(c) {
22
+ const l = x(), { t: a, te: r } = c || D({ useScope: "global" }), { state: i, getSchema: S } = F(), h = d(() => l.value.specification);
23
+ function v({ property: t, page: e }) {
24
+ var n, s;
25
+ const o = (n = h.value.pageConent) == null ? void 0 : n[t][e], m = (s = h.value.inputDefinition) == null ? void 0 : s[t], u = JSON.parse(JSON.stringify(i.value));
26
+ C({ state: u, pageProperties: o, propertyDefinitions: m, property: t, page: e }), i.value = u;
29
27
  }
30
- function d({
28
+ function C({
31
29
  state: t,
32
30
  pageProperties: e,
33
31
  propertyDefinitions: o,
34
32
  property: m,
35
- page: r
33
+ page: u
36
34
  }) {
37
- const c = [];
35
+ const n = [];
38
36
  for (let s = 0; s < e.length; s += 1) {
39
- const l = e[s];
37
+ const f = e[s];
40
38
  try {
41
- c.push(o[l]);
39
+ n.push(o[f]);
42
40
  } catch {
43
41
  console.warn(
44
- `DCATAP doens't include a property called: ${l}`
42
+ `DCATAP doens't include a property called: ${f}`
45
43
  );
46
44
  }
47
45
  }
48
- t.schema[m][r] = c;
46
+ t.schema[m][u] = n;
49
47
  }
50
- function S({ property: t, page: e }) {
51
- const o = { ...n.value.schema };
52
- b(o[t][e], t), n.value.schema[t][e] = o[t][e];
48
+ function g({ property: t, page: e }) {
49
+ const o = { ...i.value.schema };
50
+ w(o[t][e], t, a, r), i.value.schema[t][e] = o[t][e];
53
51
  }
54
- return { createSchema: f, translateSchema: S, getSchema: a };
52
+ return { createSchema: v, translateSchema: g, getSchema: S };
55
53
  }
56
54
  export {
57
- y as useFormSchema
55
+ K as useFormSchema
58
56
  };
59
57
  //# sourceMappingURL=useFormSchema.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useFormSchema.mjs","sources":["../../../lib/data-provider-interface/composables/useFormSchema.ts"],"sourcesContent":["import { createSharedComposable } from '@vueuse/core'\nimport { computed, MaybeRefOrGetter, ref, toValue, watch } from 'vue'\nimport { useDpiContext } from './useDpiContext'\nimport { useI18n } from 'vue-i18n'\nimport translate from '../utils/translation-helper'\n\nconst useFormSchemaGlobal = createSharedComposable(() => {\n const state = ref({\n schema: {\n datasets: {},\n distributions: {},\n catalogues: {}\n },\n usersCatalogs: {}\n })\n\n /**\n * Retrieves the schema for a given property.\n *\n * @param property - The property whose schema should be retrieved.\n * Can be a string or a ref to a string.\n * @returns A computed ref to the schema of the given property.\n */\n const getSchema = (property: MaybeRefOrGetter<string>) => computed(() => {\n const _property = toValue(property)\n\n if (property === 'catalogues' || property === 'datasets' || property === 'distributions') {\n return state.value.schema[_property as keyof typeof state.value.schema]\n }\n\n return undefined\n })\n\n return { state, getSchema }\n})\n\nexport function useFormSchema() {\n const dpiContext = useDpiContext()\n const { t } = useI18n({ useScope: 'global' })\n const { state, getSchema } = useFormSchemaGlobal()\n\n const dpiConfig = computed(() => dpiContext.value.specification)\n\n function createSchema({ property, page }: { property: string, page: string }) {\n const pageProperties = dpiConfig.value.pageConent?.[property as keyof typeof dpiConfig.value.pageConent][page] as unknown as string[]\n const propertyDefinitions = dpiConfig.value.inputDefinition?.[property as keyof typeof dpiConfig.value.inputDefinition]\n\n // Create copy of state because extractSchema does in-place modifications.\n // Just to be safe.\n const stateCopy = JSON.parse(JSON.stringify(state.value))\n extractSchema({ state: stateCopy, pageProperties, propertyDefinitions, property, page })\n\n state.value = stateCopy\n }\n\n function extractSchema({\n state,\n pageProperties,\n propertyDefinitions,\n property,\n page,\n }: {\n state: any\n pageProperties: string[]\n propertyDefinitions: any\n property: string\n page: string\n }) {\n // important: create new empty schema each time so already existing schema will be overwritten on route/view-change\n const newSchema = [];\n\n for (let index = 0; index < pageProperties.length; index += 1) {\n const propertyKey = pageProperties[index];\n try {\n newSchema.push(propertyDefinitions[propertyKey]);\n } catch (err) {\n console.warn(\n `DCATAP doens't include a property called: ${propertyKey}`\n );\n }\n }\n\n state.schema[property][page] = newSchema;\n }\n\n function translateSchema({ property, page }: { property: string, page: string }) {\n const schemaCopy = { ...state.value.schema }\n // @ts-ignore\n translate(schemaCopy[property][page], property);\n\n // Update the global state with the new schema\n // @ts-ignore\n state.value.schema[property][page] = schemaCopy[property][page]\n }\n\n return { createSchema, translateSchema, getSchema }\n\n}"],"names":["useFormSchemaGlobal","createSharedComposable","state","ref","property","computed","_property","toValue","useFormSchema","dpiContext","useDpiContext","useI18n","getSchema","dpiConfig","createSchema","page","pageProperties","_a","propertyDefinitions","_b","stateCopy","extractSchema","newSchema","index","propertyKey","translateSchema","schemaCopy","translate"],"mappings":";;;;;AAMA,MAAMA,IAAsBC,EAAuB,MAAM;AACvD,QAAMC,IAAQC,EAAI;AAAA,IAChB,QAAQ;AAAA,MACN,UAAU,CAAC;AAAA,MACX,eAAe,CAAC;AAAA,MAChB,YAAY,CAAC;AAAA,IACf;AA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B,IAAAA,EAAM,OAAOE,CAAQ,EAAEW,CAAI,IAAIO;AAAA,EACjC;AAEA,WAASG,EAAgB,EAAE,UAAArB,GAAU,MAAAW,KAA4C;AAC/E,UAAMW,IAAa,EAAE,GAAGxB,EAAM,MAAM,OAAO;AAE3C,IAAAyB,EAAUD,EAAWtB,CAAQ,EAAEW,CAAI,GAAGX,CAAQ,GAIxCF,EAAA,MAAM,OAAOE,CAAQ,EAAEW,CAAI,IAAIW,EAAWtB,CAAQ,EAAEW,CAAI;AAAA,EAChE;AAEO,SAAA,EAAE,cAAAD,GAAc,iBAAAW,GAAiB,WAAAb;AAE1C;"}
1
+ {"version":3,"file":"useFormSchema.mjs","sources":["../../../lib/data-provider-interface/composables/useFormSchema.ts"],"sourcesContent":["import { createSharedComposable } from '@vueuse/core'\nimport { computed, MaybeRefOrGetter, ref, toValue, watch } from 'vue'\nimport { useDpiContext } from './useDpiContext'\nimport { useI18n } from 'vue-i18n'\nimport translate from '../utils/translation-helper'\n\nconst useFormSchemaGlobal = createSharedComposable(() => {\n const state = ref({\n schema: {\n datasets: {},\n distributions: {},\n catalogues: {}\n },\n usersCatalogs: {}\n })\n\n /**\n * Retrieves the schema for a given property.\n *\n * @param property - The property whose schema should be retrieved.\n * Can be a string or a ref to a string.\n * @returns A computed ref to the schema of the given property.\n */\n const getSchema = (property: MaybeRefOrGetter<string>) => computed(() => {\n const _property = toValue(property)\n\n if (property === 'catalogues' || property === 'datasets' || property === 'distributions') {\n return state.value.schema[_property as keyof typeof state.value.schema]\n }\n\n return undefined\n })\n\n return { state, getSchema }\n})\n\nexport interface UseFormSchemaOptions {\n t?: (key: string) => string\n te?: (key: string) => boolean\n}\n\nexport function useFormSchema(options?: UseFormSchemaOptions) {\n const dpiContext = useDpiContext()\n const { t, te } = options || useI18n({ useScope: 'global' })\n const { state, getSchema } = useFormSchemaGlobal()\n\n const dpiConfig = computed(() => dpiContext.value.specification)\n\n function createSchema({ property, page }: { property: string, page: string }) {\n const pageProperties = dpiConfig.value.pageConent?.[property as keyof typeof dpiConfig.value.pageConent][page] as unknown as string[]\n const propertyDefinitions = dpiConfig.value.inputDefinition?.[property as keyof typeof dpiConfig.value.inputDefinition]\n\n // Create copy of state because extractSchema does in-place modifications.\n // Just to be safe.\n const stateCopy = JSON.parse(JSON.stringify(state.value))\n extractSchema({ state: stateCopy, pageProperties, propertyDefinitions, property, page })\n\n state.value = stateCopy\n }\n\n function extractSchema({\n state,\n pageProperties,\n propertyDefinitions,\n property,\n page,\n }: {\n state: any\n pageProperties: string[]\n propertyDefinitions: any\n property: string\n page: string\n }) {\n // important: create new empty schema each time so already existing schema will be overwritten on route/view-change\n const newSchema = [];\n\n for (let index = 0; index < pageProperties.length; index += 1) {\n const propertyKey = pageProperties[index];\n try {\n newSchema.push(propertyDefinitions[propertyKey]);\n } catch (err) {\n console.warn(\n `DCATAP doens't include a property called: ${propertyKey}`\n );\n }\n }\n\n state.schema[property][page] = newSchema;\n }\n\n function translateSchema({ property, page }: { property: string, page: string }) {\n const schemaCopy = { ...state.value.schema }\n // @ts-ignore\n translate(schemaCopy[property][page], property, t, te);\n\n // Update the global state with the new schema\n // @ts-ignore\n state.value.schema[property][page] = schemaCopy[property][page]\n }\n\n return { createSchema, translateSchema, getSchema }\n\n}"],"names":["useFormSchemaGlobal","createSharedComposable","state","ref","property","computed","_property","toValue","useFormSchema","options","dpiContext","useDpiContext","t","te","useI18n","getSchema","dpiConfig","createSchema","page","pageProperties","_a","propertyDefinitions","_b","stateCopy","extractSchema","newSchema","index","propertyKey","translateSchema","schemaCopy","translate"],"mappings":";;;;;AAMA,MAAMA,IAAsBC,EAAuB,MAAM;AACvD,QAAMC,IAAQC,EAAI;AAAA,IAChB,QAAQ;AAAA,MACN,UAAU,CAAC;AAAA,MACX,eAAe,CAAC;AAAA,MAChB,YAAY,CAAC;AAAA,IACf;AAAA,IACA,eAAe,CAAC;AAAA,EAAA,CACjB;AAmBM,SAAA,EAAE,OAAAD,GAAO,WAVE,CAACE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,CAAI,IAAIO;AAAA,EACjC;AAEA,WAASG,EAAgB,EAAE,UAAAxB,GAAU,MAAAc,KAA4C;AAC/E,UAAMW,IAAa,EAAE,GAAG3B,EAAM,MAAM,OAAO;AAE3C,IAAA4B,EAAUD,EAAWzB,CAAQ,EAAEc,CAAI,GAAGd,GAAUQ,GAAGC,CAAE,GAI/CX,EAAA,MAAM,OAAOE,CAAQ,EAAEc,CAAI,IAAIW,EAAWzB,CAAQ,EAAEc,CAAI;AAAA,EAChE;AAEO,SAAA,EAAE,cAAAD,GAAc,iBAAAW,GAAiB,WAAAb;AAE1C;"}
@@ -1,30 +1,29 @@
1
1
  import { has as m, isObject as h } from "lodash-es";
2
- import { useI18n as r } from "vue-i18n";
3
- function u(s, a) {
4
- const { t: o, te: e } = r({ useScope: "global" });
2
+ import "vue-i18n";
3
+ function u(s, l, o, n) {
5
4
  if (m(s, "identifier")) {
6
- const d = ["label", "info", "help", "placeholder", "add-label"], l = s.identifier;
5
+ const d = ["label", "info", "help", "placeholder", "add-label"], a = s.identifier;
7
6
  for (let c = 0; c < d.length; c += 1) {
8
- let n = l;
9
- const t = d[c], f = e(`message.dataupload.${a}.${l}.${t}`), C = e(`message.dataupload.${a}.${l}.${t}`, "en");
10
- m(a, t) || (f ? n = o(`message.dataupload.${a}.${l}.${t}`) : C ? n = o(`message.dataupload.${a}.${l}.${t}`, "en") : n = t, !!s.$cmp && !s.$formkit && h(s.props) && s.$cmp === "SelectControlledGroup" ? s.props[t] = n : s[t] = n), s.mandatory && t === "label" && (s[t] = `${n}*`);
7
+ let t = a;
8
+ const e = d[c], C = n(`message.dataupload.${l}.${a}.${e}`), f = n(`message.dataupload.${l}.${a}.${e}`, "en");
9
+ m(l, e) || (C ? t = o(`message.dataupload.${l}.${a}.${e}`) : f ? t = o(`message.dataupload.${l}.${a}.${e}`, "en") : t = e, !!s.$cmp && !s.$formkit && h(s.props) && s.$cmp === "SelectControlledGroup" ? s.props[e] = t : s[e] = t), s.mandatory && e === "label" && (s[e] = `${t}*`);
11
10
  }
12
11
  }
13
12
  }
14
- function $(s, a) {
15
- for (let o = 0; o < s.length; o += 1) {
16
- const e = s[o];
17
- if (m(e, "children"))
18
- u(e, a), $(e.children, a);
19
- else if (m(e, "data")) {
20
- u(e, a);
21
- const d = Object.keys(e.data);
22
- for (let l = 0; l < d.length; l += 1) {
23
- const c = d[l];
24
- $(e.data[c], a);
13
+ function $(s, l, o, n) {
14
+ for (let d = 0; d < s.length; d += 1) {
15
+ const a = s[d];
16
+ if (m(a, "children"))
17
+ u(a, l, o, n), $(a.children, l, o, n);
18
+ else if (m(a, "data")) {
19
+ u(a, l, o, n);
20
+ const c = Object.keys(a.data);
21
+ for (let t = 0; t < c.length; t += 1) {
22
+ const e = c[t];
23
+ $(a.data[e], l, o, n);
25
24
  }
26
25
  } else
27
- u(e, a);
26
+ u(a, l, o, n);
28
27
  }
29
28
  }
30
29
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"translation-helper.mjs","sources":["../../../lib/data-provider-interface/utils/translation-helper.js"],"sourcesContent":["import { has, isObject } from 'lodash-es';\nimport { useI18n } from 'vue-i18n';\n\n/**\n * Translation of each translatable parameter within the given structure if a translation is available\n * @param {*} propertyDefinition Object containing parameters defining the form and their content\n * @param {String} property String defining which property translation should be used\n */\n\nfunction translateProperty(propertyDefinition, property) {\n const { t, te } = useI18n({ useScope: 'global' });\n\n if (has(propertyDefinition, 'identifier')) { // hidden fields don't need a label and have no identifier\n const translatableParameters = ['label', 'info', 'help', 'placeholder', 'add-label'];\n const propertyName = propertyDefinition.identifier;\n\n for (let valueIndex = 0; valueIndex < translatableParameters.length; valueIndex += 1) {\n let translation = propertyName;\n const parameter = translatableParameters[valueIndex];\n\n const translationExsists = te(`message.dataupload.${property}.${propertyName}.${parameter}`);\n const translationExsistsEN = te(`message.dataupload.${property}.${propertyName}.${parameter}`, 'en');\n\n // Check if translation exists\n if (!has(property, parameter)) {\n if (translationExsists) {\n translation = t(`message.dataupload.${property}.${propertyName}.${parameter}`);\n } else if (translationExsistsEN) {\n translation = t(`message.dataupload.${property}.${propertyName}.${parameter}`, 'en');\n } else {\n translation = parameter;\n }\n\n const isCustomComponentWithProps = !!propertyDefinition.$cmp\n && !propertyDefinition.$formkit\n && isObject(propertyDefinition.props);\n\n const isSelectControlledGroupCustomComponent = isCustomComponentWithProps\n && propertyDefinition.$cmp === 'SelectControlledGroup';\n\n if (isSelectControlledGroupCustomComponent) {\n propertyDefinition.props[parameter] = translation;\n } else {\n propertyDefinition[parameter] = translation;\n }\n\n // if (parameter === \"info\") {\n\n // propertyDefinition['sections-schema'] = { prefix: { $el: 'div', attrs: { class: 'infoI', }, children: [{ $el: 'div', children: translation, attrs: { class: 'tooltipFormkit' } }] } }\n // }\n }\n\n // Highlight mandatory fields\n if (propertyDefinition.mandatory && parameter === \"label\") propertyDefinition[parameter] = `${translation}*`\n }\n }\n}\n\n/**\n * Recursive translation of propertie parameters including recursive translation of nested properties\n * @param {Object} schema Object containing the forms schema\n * @param {String} property String defining which property translation should be used (datasets/ distribution/ catalogues)\n */\nfunction translate(schema, property) {\n for (let index = 0; index < schema.length; index += 1) {\n const schemaPropertyValues = schema[index];\n\n // translation of group forms and their nested properties\n if (has(schemaPropertyValues, 'children')) {\n // group attributes should be translated too\n translateProperty(schemaPropertyValues, property);\n // translated nested properties\n translate(schemaPropertyValues.children, property);\n // translation of conditional forms and their nested properties\n } else if (has(schemaPropertyValues, 'data')) {\n // group attributes should be translated too\n translateProperty(schemaPropertyValues, property);\n // translate nested data\n const dataKeys = Object.keys(schemaPropertyValues.data);\n for (let keyIndex = 0; keyIndex < dataKeys.length; keyIndex += 1) {\n const currentKey = dataKeys[keyIndex];\n translate(schemaPropertyValues.data[currentKey], property);\n }\n // translation of 'normal' singular form properties\n } else {\n translateProperty(schemaPropertyValues, property);\n }\n }\n}\n\nexport default translate;\n"],"names":["translateProperty","propertyDefinition","property","t","te","useI18n","has","translatableParameters","propertyName","valueIndex","translation","parameter","translationExsists","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BhB,CAAQ,GAEhDa,EAAUG,EAAqB,UAAUhB,CAAQ;AAAA,aAE1CI,EAAIY,GAAsB,MAAM,GAAG;AAE1C,MAAAlB,EAAkBkB,GAAsBhB,CAAQ;AAEhD,YAAMiB,IAAW,OAAO,KAAKD,EAAqB,IAAI;AACtD,eAASE,IAAW,GAAGA,IAAWD,EAAS,QAAQC,KAAY,GAAG;AAC9D,cAAMC,IAAaF,EAASC,CAAQ;AACpC,QAAAL,EAAUG,EAAqB,KAAKG,CAAU,GAAGnB,CAAQ;AAAA,MAC5D;AAAA,IAEb;AACY,MAAAF,EAAkBkB,GAAsBhB,CAAQ;AAAA,EAEvD;AACL;"}
1
+ {"version":3,"file":"translation-helper.mjs","sources":["../../../lib/data-provider-interface/utils/translation-helper.js"],"sourcesContent":["import { has, isObject } from 'lodash-es';\nimport { useI18n } from 'vue-i18n';\n\n/**\n * Translation of each translatable parameter within the given structure if a translation is available\n * @param {*} propertyDefinition Object containing parameters defining the form and their content\n * @param {String} property String defining which property translation should be used\n */\n\nfunction translateProperty(propertyDefinition, property, t, te) {\n\n if (has(propertyDefinition, 'identifier')) { // hidden fields don't need a label and have no identifier\n const translatableParameters = ['label', 'info', 'help', 'placeholder', 'add-label'];\n const propertyName = propertyDefinition.identifier;\n\n for (let valueIndex = 0; valueIndex < translatableParameters.length; valueIndex += 1) {\n let translation = propertyName;\n const parameter = translatableParameters[valueIndex];\n\n const translationExsists = te(`message.dataupload.${property}.${propertyName}.${parameter}`);\n const translationExsistsEN = te(`message.dataupload.${property}.${propertyName}.${parameter}`, 'en');\n\n // Check if translation exists\n if (!has(property, parameter)) {\n if (translationExsists) {\n translation = t(`message.dataupload.${property}.${propertyName}.${parameter}`);\n } else if (translationExsistsEN) {\n translation = t(`message.dataupload.${property}.${propertyName}.${parameter}`, 'en');\n } else {\n translation = parameter;\n }\n\n const isCustomComponentWithProps = !!propertyDefinition.$cmp\n && !propertyDefinition.$formkit\n && isObject(propertyDefinition.props);\n\n const isSelectControlledGroupCustomComponent = isCustomComponentWithProps\n && propertyDefinition.$cmp === 'SelectControlledGroup';\n\n if (isSelectControlledGroupCustomComponent) {\n propertyDefinition.props[parameter] = translation;\n } else {\n propertyDefinition[parameter] = translation;\n }\n\n // if (parameter === \"info\") {\n\n // propertyDefinition['sections-schema'] = { prefix: { $el: 'div', attrs: { class: 'infoI', }, children: [{ $el: 'div', children: translation, attrs: { class: 'tooltipFormkit' } }] } }\n // }\n }\n\n // Highlight mandatory fields\n if (propertyDefinition.mandatory && parameter === \"label\") propertyDefinition[parameter] = `${translation}*`\n }\n }\n}\n\n/**\n * Recursive translation of propertie parameters including recursive translation of nested properties\n * @param {Object} schema Object containing the forms schema\n * @param {String} property String defining which property translation should be used (datasets/ distribution/ catalogues)\n */\nfunction translate(schema, property, t, te) {\n for (let index = 0; index < schema.length; index += 1) {\n const schemaPropertyValues = schema[index];\n\n // translation of group forms and their nested properties\n if (has(schemaPropertyValues, 'children')) {\n // group attributes should be translated too\n translateProperty(schemaPropertyValues, property, t, te);\n // translated nested properties\n translate(schemaPropertyValues.children, property, t, te);\n // translation of conditional forms and their nested properties\n } else if (has(schemaPropertyValues, 'data')) {\n // group attributes should be translated too\n translateProperty(schemaPropertyValues, property, t, te);\n // translate nested data\n const dataKeys = Object.keys(schemaPropertyValues.data);\n for (let keyIndex = 0; keyIndex < dataKeys.length; keyIndex += 1) {\n const currentKey = dataKeys[keyIndex];\n translate(schemaPropertyValues.data[currentKey], property, t, te);\n }\n // translation of 'normal' singular form properties\n } else {\n translateProperty(schemaPropertyValues, property, t, te);\n }\n }\n}\n\nexport default translate;\n"],"names":["translateProperty","propertyDefinition","property","t","te","has","translatableParameters","propertyName","valueIndex","translation","parameter","translationExsists","translationExsistsEN","isObject","translate","schema","index","schemaPropertyValues","dataKeys","keyIndex","currentKey"],"mappings":";;AASA,SAASA,EAAkBC,GAAoBC,GAAUC,GAAGC,GAAI;AAE5D,MAAIC,EAAIJ,GAAoB,YAAY,GAAG;AACvC,UA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