@piveau/piveau-hub-ui-modules 4.5.12 → 4.6.0

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 (44) hide show
  1. package/dist/data-provider-interface/CatalogueMQA.vue.mjs +21 -21
  2. package/dist/data-provider-interface/CatalogueMQA.vue.mjs.map +1 -1
  3. package/dist/data-provider-interface/DPIMenu.vue.mjs +5 -5
  4. package/dist/data-provider-interface/DataProviderInterface.vue.d.ts +9 -4
  5. package/dist/data-provider-interface/components/Navigation.vue.mjs +57 -56
  6. package/dist/data-provider-interface/components/Navigation.vue.mjs.map +1 -1
  7. package/dist/data-provider-interface/components/SpatialInput.vue.mjs +23 -22
  8. package/dist/data-provider-interface/components/SpatialInput.vue.mjs.map +1 -1
  9. package/dist/data-provider-interface/components/UniqueIdentifierInput.vue.mjs +13 -13
  10. package/dist/data-provider-interface/components/UniqueIdentifierInput.vue.mjs.map +1 -1
  11. package/dist/data-provider-interface/composables/index.d.ts +1 -0
  12. package/dist/data-provider-interface/composables/useDpiEditMode.mjs +15 -16
  13. package/dist/data-provider-interface/composables/useDpiEditMode.mjs.map +1 -1
  14. package/dist/data-provider-interface/composables/useFormSchema.d.ts +13 -0
  15. package/dist/data-provider-interface/composables/useFormSchema.mjs +59 -0
  16. package/dist/data-provider-interface/composables/useFormSchema.mjs.map +1 -0
  17. package/dist/data-provider-interface/index.d.ts +33 -0
  18. package/dist/data-provider-interface/utils/translation-helper.mjs +23 -23
  19. package/dist/data-provider-interface/utils/translation-helper.mjs.map +1 -1
  20. package/dist/data-provider-interface/views/DistributionOverview.vue.d.ts +1 -1
  21. package/dist/data-provider-interface/views/InputPage.vue.d.ts +9 -4
  22. package/dist/data-provider-interface/views/InputPage.vue.mjs +110 -110
  23. package/dist/data-provider-interface/views/InputPage.vue.mjs.map +1 -1
  24. package/dist/dataProviderInterface.d.ts +1 -0
  25. package/dist/dataProviderInterface.mjs +71 -0
  26. package/dist/dataProviderInterface.mjs.map +1 -0
  27. package/dist/datasetDetails/DatasetDetails.vue.mjs +31 -29
  28. package/dist/datasetDetails/DatasetDetails.vue.mjs.map +1 -1
  29. package/dist/embed/DatasetEmbedModal.vue.d.ts +2 -0
  30. package/dist/embed/DatasetEmbedModal.vue.mjs +126 -88
  31. package/dist/embed/DatasetEmbedModal.vue.mjs.map +1 -1
  32. package/dist/embed/EmbedDataset.vue.mjs +31 -26
  33. package/dist/embed/EmbedDataset.vue.mjs.map +1 -1
  34. package/dist/embed/EmbedDatasetSnippet.vue.mjs +30 -25
  35. package/dist/embed/EmbedDatasetSnippet.vue.mjs.map +1 -1
  36. package/dist/external/@vueuse/core/index +31 -31
  37. package/dist/external/@vueuse/shared/index +66 -63
  38. package/dist/external/@vueuse/shared/index.map +1 -1
  39. package/dist/form/FormKitGroup.vue.mjs.map +1 -1
  40. package/dist/index.mjs +54 -54
  41. package/dist/piveau-hub-ui-modules.css +1 -1
  42. package/package.json +17 -1
  43. package/dist/data-provider-interface/index.mjs +0 -15
  44. package/dist/data-provider-interface/index.mjs.map +0 -1
@@ -0,0 +1,59 @@
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({
8
+ schema: {
9
+ datasets: {},
10
+ distributions: {},
11
+ catalogues: {}
12
+ },
13
+ usersCatalogs: {}
14
+ });
15
+ return { state: i, getSchema: (a) => h(() => {
16
+ const u = C(a);
17
+ if (a === "catalogues" || a === "datasets" || a === "distributions")
18
+ return i.value.schema[u];
19
+ }) };
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;
29
+ }
30
+ function d({
31
+ state: t,
32
+ pageProperties: e,
33
+ propertyDefinitions: o,
34
+ property: m,
35
+ page: r
36
+ }) {
37
+ const c = [];
38
+ for (let s = 0; s < e.length; s += 1) {
39
+ const l = e[s];
40
+ try {
41
+ c.push(o[l]);
42
+ } catch {
43
+ console.warn(
44
+ `DCATAP doens't include a property called: ${l}`
45
+ );
46
+ }
47
+ }
48
+ t.schema[m][r] = c;
49
+ }
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];
53
+ }
54
+ return { createSchema: f, translateSchema: S, getSchema: a };
55
+ }
56
+ export {
57
+ y as useFormSchema
58
+ };
59
+ //# sourceMappingURL=useFormSchema.mjs.map
@@ -0,0 +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;AAAA,IACA,eAAe,CAAC;AAAA,EAAA,CACjB;AAmBM,SAAA,EAAE,OAAAD,GAAO,WAVE,CAACE,MAAuCC,EAAS,MAAM;AACjE,UAAAC,IAAYC,EAAQH,CAAQ;AAElC,QAAIA,MAAa,gBAAgBA,MAAa,cAAcA,MAAa;AAChE,aAAAF,EAAM,MAAM,OAAOI,CAA4C;AAAA,EAGjE,CACR;AAGH,CAAC;AAEM,SAASE,IAAgB;AAC9B,QAAMC,IAAaC;AACL,EAAAC,EAAQ,EAAE,UAAU,UAAU;AAC5C,QAAM,EAAE,OAAAT,GAAO,WAAAU,EAAU,IAAIZ,EAAoB,GAE3Ca,IAAYR,EAAS,MAAMI,EAAW,MAAM,aAAa;AAE/D,WAASK,EAAa,EAAE,UAAAV,GAAU,MAAAW,KAA4C;;AAC5E,UAAMC,KAAiBC,IAAAJ,EAAU,MAAM,eAAhB,gBAAAI,EAA6Bb,GAAqDW,IACnGG,KAAsBC,IAAAN,EAAU,MAAM,oBAAhB,gBAAAM,EAAkCf,IAIxDgB,IAAY,KAAK,MAAM,KAAK,UAAUlB,EAAM,KAAK,CAAC;AACxD,IAAAmB,EAAc,EAAE,OAAOD,GAAW,gBAAAJ,GAAgB,qBAAAE,GAAqB,UAAAd,GAAU,MAAAW,GAAM,GAEvFb,EAAM,QAAQkB;AAAA,EAChB;AAEA,WAASC,EAAc;AAAA,IACrB,OAAAnB;AAAAA,IACA,gBAAAc;AAAA,IACA,qBAAAE;AAAA,IACA,UAAAd;AAAA,IACA,MAAAW;AAAA,EAAA,GAOC;AAED,UAAMO,IAAY,CAAA;AAElB,aAASC,IAAQ,GAAGA,IAAQP,EAAe,QAAQO,KAAS,GAAG;AACvD,YAAAC,IAAcR,EAAeO,CAAK;AACpC,UAAA;AACQ,QAAAD,EAAA,KAAKJ,EAAoBM,CAAW,CAAC;AAAA,cACnC;AACJ,gBAAA;AAAA,UACN,6CAA6CA,CAAW;AAAA,QAAA;AAAA,MAE5D;AAAA,IACF;AAEAtB,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,2 +1,35 @@
1
+ import { App } from 'vue';
2
+ import { default as AutocompleteInput } from './components/AutocompleteInput.vue';
3
+ import { default as ConditionalInput } from './components/ConditionalInput.vue';
4
+ import { default as DataFetchingComponent } from './components/DataFetchingComponent.vue';
5
+ import { default as Dropup } from './components/Dropup.vue';
6
+ import { default as FileUpload } from './components/FileUpload.vue';
7
+ import { default as InfoSlot } from './components/InfoSlot.vue';
8
+ import { default as LanguageSelector } from './components/LanguageSelector.vue';
9
+ import { default as Navigation } from './components/Navigation.vue';
10
+ import { default as UniqueIdentifierInput } from './components/UniqueIdentifierInput.vue';
11
+ import { default as inputDefinitions } from '../form/inputDefinitions';
12
+ import { default as CatalogueOverview } from './views/OverviewPage/CatalogueOverview.vue';
13
+ import { default as DatasetOverview } from './views/OverviewPage/DatasetOverview.vue';
14
+ import { default as DistributionOverview } from './views/OverviewPage/DistributionOverview.vue';
15
+ import { default as PropertyEntry } from './views/OverviewPage/PropertyEntry.vue';
16
+ import { default as DistOverview } from './views/DistributionOverview.vue';
17
+ import { default as DraftsPage } from './views/DraftsPage.vue';
18
+ import { default as InputPage } from './views/InputPage.vue';
19
+ import { default as LinkedDataViewer } from './views/LinkedDataViewer.vue';
20
+ import { default as OverviewPage } from './views/OverviewPage.vue';
21
+ import { default as UserCataloguesPage } from './views/UserCataloguesPage.vue';
22
+ import { default as UserProfilePage } from './views/UserProfilePage.vue';
23
+ import { default as DataProviderInterface } from './DataProviderInterface.vue';
24
+ import { default as DpiMenu } from './DPIMenu.vue';
25
+ import { default as store } from './store/dpiStore';
26
+
1
27
  export * from './composables/index';
2
28
  export { config as dpiSpecConfig } from './config/dpi-spec-config';
29
+ export declare function registerComponents(app: App): void;
30
+ export { AutocompleteInput, ConditionalInput, DataFetchingComponent, Dropup, FileUpload, InfoSlot, LanguageSelector, Navigation, UniqueIdentifierInput };
31
+ export { CatalogueOverview, DatasetOverview, DistributionOverview, PropertyEntry };
32
+ export { DistOverview, DraftsPage, InputPage, LinkedDataViewer, OverviewPage, UserCataloguesPage, UserProfilePage };
33
+ export { DataProviderInterface, DpiMenu };
34
+ export { inputDefinitions, store };
35
+ export { injectionKey as injectionKeyRuntimeConfig } from '../services/runtimeConfigurationService';
@@ -1,33 +1,33 @@
1
- import { has as c, isObject as i } from "lodash-es";
2
- import r from "../../store/index.mjs";
3
- function m(a, s) {
4
- const l = r.$app.config.globalProperties.i18n.global;
5
- if (c(a, "identifier")) {
6
- const e = ["label", "info", "help", "placeholder", "add-label"], o = a.identifier;
7
- for (let d = 0; d < e.length; d += 1) {
8
- let n = o;
9
- const t = e[d], $ = l.te(`message.dataupload.${s}.${o}.${t}`), f = l.te(`message.dataupload.${s}.${o}.${t}`, "en");
10
- c(s, t) || ($ ? n = l.t(`message.dataupload.${s}.${o}.${t}`) : f ? n = l.t(`message.dataupload.${s}.${o}.${t}`, "en") : n = t, !!a.$cmp && !a.$formkit && i(a.props) && a.$cmp === "SelectControlledGroup" ? a.props[t] = n : a[t] = n), a.mandatory && t === "label" && (a[t] = `${n}*`);
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" });
5
+ if (m(s, "identifier")) {
6
+ const d = ["label", "info", "help", "placeholder", "add-label"], l = s.identifier;
7
+ 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}*`);
11
11
  }
12
12
  }
13
13
  }
14
- function u(a, s) {
15
- for (let l = 0; l < a.length; l += 1) {
16
- const e = a[l];
17
- if (c(e, "children"))
18
- m(e, s), u(e.children, s);
19
- else if (c(e, "data")) {
20
- m(e, s);
21
- const o = Object.keys(e.data);
22
- for (let d = 0; d < o.length; d += 1) {
23
- const n = o[d];
24
- u(e.data[n], s);
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);
25
25
  }
26
26
  } else
27
- m(e, s);
27
+ u(e, a);
28
28
  }
29
29
  }
30
30
  export {
31
- u as default
31
+ $ as default
32
32
  };
33
33
  //# sourceMappingURL=translation-helper.mjs.map
@@ -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 store from '../../store';\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\n const i18n = store.$app.config.globalProperties.i18n.global;\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 = i18n.te(`message.dataupload.${property}.${propertyName}.${parameter}`);\n const translationExsistsEN = i18n.te(`message.dataupload.${property}.${propertyName}.${parameter}`, 'en');\n\n // Check if translation exists\n if (!has(property, parameter)) {\n if (translationExsists) {\n translation = i18n.t(`message.dataupload.${property}.${propertyName}.${parameter}`);\n } else if (translationExsistsEN) {\n translation = i18n.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","i18n","store","has","translatableParameters","propertyName","valueIndex","translation","parameter","translationExsists","translationExsistsEN","isObject","translate","schema","index","schemaPropertyValues","dataKeys","keyIndex","currentKey"],"mappings":";;AASA,SAASA,EAAkBC,GAAoBC,GAAU;AAErD,QAAMC,IAAOC,EAAM,KAAK,OAAO,iBAAiB,KAAK;AACrD,MAAIC,EAAIJ,GAAoB,YAAY,GAAG;AACvC,UAAMK,IAAyB,CAAC,SAAS,QAAQ,QAAQ,eAAe,WAAW,GAC7EC,IAAeN,EAAmB;AAExC,aAASO,IAAa,GAAGA,IAAaF,EAAuB,QAAQE,KAAc,GAAG;AAClF,UAAIC,IAAcF;AAClB,YAAMG,IAAYJ,EAAuBE,CAAU,GAE7CG,IAAqBR,EAAK,GAAG,sBAAsBD,CAAQ,IAAIK,CAAY,IAAIG,CAAS,EAAE,GAC1FE,IAAuBT,EAAK,GAAG,sBAAsBD,CAAQ,IAAIK,CAAY,IAAIG,CAAS,IAAI,IAAI;AAGxG,MAAKL,EAAIH,GAAUQ,CAAS,MACpBC,IACAF,IAAcN,EAAK,EAAE,sBAAsBD,CAAQ,IAAIK,CAAY,IAAIG,CAAS,EAAE,IAC3EE,IACPH,IAAcN,EAAK,EAAE,sBAAsBD,CAAQ,IAAIK,CAAY,IAAIG,CAAS,IAAI,IAAI,IAExFD,IAAcC,GAGiB,CAAC,CAACT,EAAmB,QACjD,CAACA,EAAmB,YACpBY,EAASZ,EAAmB,KAAK,KAGjCA,EAAmB,SAAS,0BAG/BA,EAAmB,MAAMS,CAAS,IAAID,IAEtCR,EAAmBS,CAAS,IAAID,IAUpCR,EAAmB,aAAaS,MAAc,YAAST,EAAmBS,CAAS,IAAI,GAAGD,CAAW;AAAA,IAC5G;AAAA,EACJ;AACL;AAOA,SAASK,EAAUC,GAAQb,GAAU;AACjC,WAASc,IAAQ,GAAGA,IAAQD,EAAO,QAAQC,KAAS,GAAG;AACnD,UAAMC,IAAuBF,EAAOC,CAAK;AAGzC,QAAIX,EAAIY,GAAsB,UAAU;AAEpC,MAAAjB,EAAkBiB,GAAsBf,CAAQ,GAEhDY,EAAUG,EAAqB,UAAUf,CAAQ;AAAA,aAE1CG,EAAIY,GAAsB,MAAM,GAAG;AAE1C,MAAAjB,EAAkBiB,GAAsBf,CAAQ;AAEhD,YAAMgB,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,GAAGlB,CAAQ;AAAA,MAC5D;AAAA,IAEb;AACY,MAAAF,EAAkBiB,GAAsBf,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) {\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","translationExsistsEN","isObject","translate","schema","index","schemaPropertyValues","dataKeys","keyIndex","currentKey"],"mappings":";;AASA,SAASA,EAAkBC,GAAoBC,GAAU;AACrD,QAAM,EAAE,GAAAC,GAAG,IAAAC,EAAI,IAAGC,EAAQ,EAAE,UAAU,SAAQ,CAAE;AAEhD,MAAIC,EAAIL,GAAoB,YAAY,GAAG;AACvC,UAAMM,IAAyB,CAAC,SAAS,QAAQ,QAAQ,eAAe,WAAW,GAC7EC,IAAeP,EAAmB;AAExC,aAASQ,IAAa,GAAGA,IAAaF,EAAuB,QAAQE,KAAc,GAAG;AAClF,UAAIC,IAAcF;AAClB,YAAMG,IAAYJ,EAAuBE,CAAU,GAE7CG,IAAqBR,EAAG,sBAAsBF,CAAQ,IAAIM,CAAY,IAAIG,CAAS,EAAE,GACrFE,IAAuBT,EAAG,sBAAsBF,CAAQ,IAAIM,CAAY,IAAIG,CAAS,IAAI,IAAI;AAGnG,MAAKL,EAAIJ,GAAUS,CAAS,MACpBC,IACAF,IAAcP,EAAE,sBAAsBD,CAAQ,IAAIM,CAAY,IAAIG,CAAS,EAAE,IACtEE,IACPH,IAAcP,EAAE,sBAAsBD,CAAQ,IAAIM,CAAY,IAAIG,CAAS,IAAI,IAAI,IAEnFD,IAAcC,GAGiB,CAAC,CAACV,EAAmB,QACjD,CAACA,EAAmB,YACpBa,EAASb,EAAmB,KAAK,KAGjCA,EAAmB,SAAS,0BAG/BA,EAAmB,MAAMU,CAAS,IAAID,IAEtCT,EAAmBU,CAAS,IAAID,IAUpCT,EAAmB,aAAaU,MAAc,YAASV,EAAmBU,CAAS,IAAI,GAAGD,CAAW;AAAA,IAC5G;AAAA,EACJ;AACL;AAOA,SAASK,EAAUC,GAAQd,GAAU;AACjC,WAASe,IAAQ,GAAGA,IAAQD,EAAO,QAAQC,KAAS,GAAG;AACnD,UAAMC,IAAuBF,EAAOC,CAAK;AAGzC,QAAIX,EAAIY,GAAsB,UAAU;AAEpC,MAAAlB,EAAkBkB,GAAsBhB,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;"}
@@ -19,8 +19,8 @@ declare const _default: import('vue').DefineComponent<{
19
19
  descriptionExists(data: any): boolean;
20
20
  accessExists(data: any): boolean;
21
21
  saveLocalstorageValues: import('vuex').ActionMethod;
22
- deleteDistribution: import('vuex').ActionMethod;
23
22
  addDistribution: import('vuex').ActionMethod;
23
+ deleteDistribution: import('vuex').ActionMethod;
24
24
  setDeleteDistributionInline: import('vuex').ActionMethod;
25
25
  }, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
26
26
  distributionOverviewPage?: any;
@@ -1207,6 +1207,15 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
1207
1207
  }, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
1208
1208
  }>;
1209
1209
  isEditMode: import('vue').ComputedRef<boolean>;
1210
+ translateSchema: ({ property, page }: {
1211
+ property: string;
1212
+ page: string;
1213
+ }) => void;
1214
+ createSchema: ({ property, page }: {
1215
+ property: string;
1216
+ page: string;
1217
+ }) => void;
1218
+ getSchema: (property: import('vue').MaybeRefOrGetter<string>) => import('vue').ComputedRef<{} | undefined>;
1210
1219
  }, {
1211
1220
  heightActiveSec: string;
1212
1221
  formValues: {};
@@ -1221,7 +1230,6 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
1221
1230
  createIDFromTitle(): any;
1222
1231
  getFirstTitleFromForm(): any;
1223
1232
  isInput(): boolean;
1224
- getSchema: import('vuex').Computed;
1225
1233
  getNavSteps: import('vuex').Computed;
1226
1234
  getDeleteDistributionInline: import('vuex').Computed;
1227
1235
  getIsEditMode: import('vuex').Computed;
@@ -1235,11 +1243,8 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
1235
1243
  createDatasetID(): void;
1236
1244
  generateandTranslateSchema(property: any): void;
1237
1245
  clearAll: import('vuex').ActionMethod;
1238
- createSchema: import('vuex').ActionMethod;
1239
- translateSchema: import('vuex').ActionMethod;
1240
1246
  saveFormValues: import('vuex').ActionMethod;
1241
1247
  saveLocalstorageValues: import('vuex').ActionMethod;
1242
- addCatalogOptions: import('vuex').ActionMethod;
1243
1248
  setIsEditMode: import('vuex').ActionMethod;
1244
1249
  setIsDraft: import('vuex').ActionMethod;
1245
1250
  }, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{