@piveau/piveau-hub-ui-modules 4.9.4 → 4.9.6
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/dist/datasetDetails/features/DatasetDetailsPages.vue.d.ts +3 -1
- package/dist/datasetDetails/features/DatasetDetailsPages.vue.mjs +370 -230
- package/dist/datasetDetails/features/DatasetDetailsPages.vue.mjs.map +1 -1
- package/dist/datasetDetails/properties/DataserviceDetailsProperties.vue.d.ts +9 -0
- package/dist/datasetDetails/properties/DataserviceDetailsProperties.vue.mjs +9 -9
- package/dist/datasetDetails/properties/DataserviceDetailsProperties.vue.mjs.map +1 -1
- package/dist/datasetDetails/properties/DataserviceDetailsProperty.vue.mjs +4 -4
- package/dist/datasetDetails/properties/DataserviceDetailsProperty.vue.mjs.map +1 -1
- package/dist/datasetDetails/properties/ValuesList.vue.mjs +14 -14
- package/dist/datasetDetails/properties/ValuesList.vue.mjs.map +1 -1
- package/dist/datasetDetails/properties/specification.d.ts +10 -1
- package/dist/datasetDetails/properties/specification.mjs +18 -9
- package/dist/datasetDetails/properties/specification.mjs.map +1 -1
- package/dist/piveau-hub-ui-modules.css +1 -1
- package/dist/store/modules/dataserviceDetailsStore.d.ts +4 -0
- package/dist/store/modules/dataserviceDetailsStore.mjs +59 -51
- package/dist/store/modules/dataserviceDetailsStore.mjs.map +1 -1
- package/dist/utils/helpers.mjs +2 -2
- package/dist/utils/helpers.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -12,6 +12,8 @@ declare const _default: {
|
|
|
12
12
|
access_right: {};
|
|
13
13
|
format: {};
|
|
14
14
|
endpoint_url: never[];
|
|
15
|
+
reference_system: never[];
|
|
16
|
+
topic_category: never[];
|
|
15
17
|
translation_meta: {};
|
|
16
18
|
descriptionHeight: number;
|
|
17
19
|
__raw: null;
|
|
@@ -64,6 +66,8 @@ declare const _default: {
|
|
|
64
66
|
SET_ACCESS_RIGHT(state: any, val: any): void;
|
|
65
67
|
SET_FORMAT(state: any, val: any): void;
|
|
66
68
|
SET_ENDPOINT_URL(state: any, val: any): void;
|
|
69
|
+
SET_REFERENCE_SYSTEM(state: any, val: any): void;
|
|
70
|
+
SET_TOPIC_CATEGORY(state: any, val: any): void;
|
|
67
71
|
SET_TRANSLATION_META(state: any, val: any): void;
|
|
68
72
|
SET_DATASET_DESCRIPTION_HEIGHT(state: any, height: any): void;
|
|
69
73
|
SET_ACTIVE_NAVIGATION_TAB(state: any, idx: any): void;
|
|
@@ -10,19 +10,21 @@ const _ = {
|
|
|
10
10
|
access_right: {},
|
|
11
11
|
format: {},
|
|
12
12
|
endpoint_url: [],
|
|
13
|
+
reference_system: [],
|
|
14
|
+
topic_category: [],
|
|
13
15
|
translation_meta: {},
|
|
14
16
|
descriptionHeight: 0,
|
|
15
17
|
__raw: null
|
|
16
18
|
},
|
|
17
19
|
loading: !1,
|
|
18
20
|
activeNavigationTab: 0
|
|
19
|
-
},
|
|
20
|
-
getProperty: (e) => (
|
|
21
|
+
}, c = {
|
|
22
|
+
getProperty: (e) => (t) => e.dataservice[t],
|
|
21
23
|
getID: (e) => e.dataservice.id,
|
|
22
24
|
getCatalog: (e) => e.dataservice.catalog,
|
|
23
25
|
getCountry: (e) => {
|
|
24
|
-
var
|
|
25
|
-
return (
|
|
26
|
+
var t;
|
|
27
|
+
return (t = e.dataservice.catalog) == null ? void 0 : t.country;
|
|
26
28
|
},
|
|
27
29
|
getLanguages: (e) => e.dataservice.languages || [],
|
|
28
30
|
getKeywords: (e) => e.dataservice.keywords || [],
|
|
@@ -38,84 +40,90 @@ const _ = {
|
|
|
38
40
|
getDatasetDescriptionHeight: (e) => e.dataservice.descriptionHeight,
|
|
39
41
|
getLoading: (e) => e.loading,
|
|
40
42
|
getActiveNavigationTab: (e) => e.activeNavigationTab
|
|
41
|
-
},
|
|
42
|
-
loadDataserviceDetails({ commit: e },
|
|
43
|
+
}, E = {
|
|
44
|
+
loadDataserviceDetails({ commit: e }, t) {
|
|
43
45
|
return new Promise((T, s) => {
|
|
44
46
|
e("SET_LOADING", !0);
|
|
45
|
-
const r = typeof
|
|
47
|
+
const r = typeof t == "string" ? t : t && t.id;
|
|
46
48
|
if (!r)
|
|
47
49
|
return e("SET_LOADING", !1), s(new Error("No id provided"));
|
|
48
50
|
this.$dataserviceService.getSingle(r).then((i) => {
|
|
49
|
-
const
|
|
50
|
-
e("SET_RAW",
|
|
51
|
+
const a = i && i.result ? i.result : i;
|
|
52
|
+
e("SET_RAW", a.__raw || a), e("SET_ID", a.id), e("SET_CATALOG", a.catalog), e("SET_KEYWORDS", a.keywords), e("SET_TITLE", a.title), e("SET_DESCRIPTION", a.description), e("SET_LANGUAGES", a.languages), e("SET_PUBLISHER", a.publisher), e("SET_CONTACT_POINT", a.contact_point), e("SET_ACCESS_RIGHT", a.access_right), e("SET_FORMAT", a.format), e("SET_ENDPOINT_URL", a.endpoint_url), e("SET_REFERENCE_SYSTEM", a.reference_system), e("SET_TOPIC_CATEGORY", a.topic_category), e("SET_TRANSLATION_META", a.translation_meta), e("SET_LOADING", !1), T(a);
|
|
51
53
|
}).catch((i) => {
|
|
52
54
|
e("SET_LOADING", !1), s(i);
|
|
53
55
|
});
|
|
54
56
|
});
|
|
55
57
|
},
|
|
56
|
-
setActiveNavigationTab({ commit: e },
|
|
57
|
-
e("SET_ACTIVE_NAVIGATION_TAB",
|
|
58
|
+
setActiveNavigationTab({ commit: e }, t) {
|
|
59
|
+
e("SET_ACTIVE_NAVIGATION_TAB", t);
|
|
58
60
|
},
|
|
59
|
-
setDatasetDescriptionHeight({ commit: e },
|
|
60
|
-
e("SET_DATASET_DESCRIPTION_HEIGHT",
|
|
61
|
+
setDatasetDescriptionHeight({ commit: e }, t) {
|
|
62
|
+
e("SET_DATASET_DESCRIPTION_HEIGHT", t);
|
|
61
63
|
}
|
|
62
|
-
},
|
|
63
|
-
SET_RAW(e,
|
|
64
|
-
e.dataservice.__raw =
|
|
64
|
+
}, n = {
|
|
65
|
+
SET_RAW(e, t) {
|
|
66
|
+
e.dataservice.__raw = t;
|
|
67
|
+
},
|
|
68
|
+
SET_LOADING(e, t) {
|
|
69
|
+
e.loading = t;
|
|
70
|
+
},
|
|
71
|
+
SET_ID(e, t) {
|
|
72
|
+
e.dataservice.id = t;
|
|
65
73
|
},
|
|
66
|
-
|
|
67
|
-
e.
|
|
74
|
+
SET_CATALOG(e, t) {
|
|
75
|
+
e.dataservice.catalog = t || {};
|
|
68
76
|
},
|
|
69
|
-
|
|
70
|
-
e.dataservice.
|
|
77
|
+
SET_KEYWORDS(e, t) {
|
|
78
|
+
e.dataservice.keywords = t || [];
|
|
71
79
|
},
|
|
72
|
-
|
|
73
|
-
e.dataservice.
|
|
80
|
+
SET_TITLE(e, t) {
|
|
81
|
+
e.dataservice.title = t || {};
|
|
74
82
|
},
|
|
75
|
-
|
|
76
|
-
e.dataservice.
|
|
83
|
+
SET_DESCRIPTION(e, t) {
|
|
84
|
+
e.dataservice.description = t || {};
|
|
77
85
|
},
|
|
78
|
-
|
|
79
|
-
e.dataservice.
|
|
86
|
+
SET_LANGUAGES(e, t) {
|
|
87
|
+
e.dataservice.languages = t || [];
|
|
80
88
|
},
|
|
81
|
-
|
|
82
|
-
e.dataservice.
|
|
89
|
+
SET_PUBLISHER(e, t) {
|
|
90
|
+
e.dataservice.publisher = t || {};
|
|
83
91
|
},
|
|
84
|
-
|
|
85
|
-
e.dataservice.
|
|
92
|
+
SET_CONTACT_POINT(e, t) {
|
|
93
|
+
e.dataservice.contact_point = t || [];
|
|
86
94
|
},
|
|
87
|
-
|
|
88
|
-
e.dataservice.
|
|
95
|
+
SET_ACCESS_RIGHT(e, t) {
|
|
96
|
+
e.dataservice.access_right = t || {};
|
|
89
97
|
},
|
|
90
|
-
|
|
91
|
-
e.dataservice.
|
|
98
|
+
SET_FORMAT(e, t) {
|
|
99
|
+
e.dataservice.format = t || {};
|
|
92
100
|
},
|
|
93
|
-
|
|
94
|
-
e.dataservice.
|
|
101
|
+
SET_ENDPOINT_URL(e, t) {
|
|
102
|
+
e.dataservice.endpoint_url = t || [];
|
|
95
103
|
},
|
|
96
|
-
|
|
97
|
-
e.dataservice.
|
|
104
|
+
SET_REFERENCE_SYSTEM(e, t) {
|
|
105
|
+
e.dataservice.reference_system = t || [];
|
|
98
106
|
},
|
|
99
|
-
|
|
100
|
-
e.dataservice.
|
|
107
|
+
SET_TOPIC_CATEGORY(e, t) {
|
|
108
|
+
e.dataservice.topic_category = t || [];
|
|
101
109
|
},
|
|
102
|
-
SET_TRANSLATION_META(e,
|
|
103
|
-
e.dataservice.translation_meta =
|
|
110
|
+
SET_TRANSLATION_META(e, t) {
|
|
111
|
+
e.dataservice.translation_meta = t || {};
|
|
104
112
|
},
|
|
105
|
-
SET_DATASET_DESCRIPTION_HEIGHT(e,
|
|
106
|
-
e.dataservice.descriptionHeight =
|
|
113
|
+
SET_DATASET_DESCRIPTION_HEIGHT(e, t) {
|
|
114
|
+
e.dataservice.descriptionHeight = t;
|
|
107
115
|
},
|
|
108
|
-
SET_ACTIVE_NAVIGATION_TAB(e,
|
|
109
|
-
e.activeNavigationTab =
|
|
116
|
+
SET_ACTIVE_NAVIGATION_TAB(e, t) {
|
|
117
|
+
e.activeNavigationTab = t;
|
|
110
118
|
}
|
|
111
|
-
},
|
|
119
|
+
}, d = {
|
|
112
120
|
namespaced: !0,
|
|
113
121
|
state: _,
|
|
114
|
-
getters:
|
|
115
|
-
actions:
|
|
116
|
-
mutations:
|
|
122
|
+
getters: c,
|
|
123
|
+
actions: E,
|
|
124
|
+
mutations: n
|
|
117
125
|
};
|
|
118
126
|
export {
|
|
119
|
-
|
|
127
|
+
d as default
|
|
120
128
|
};
|
|
121
129
|
//# sourceMappingURL=dataserviceDetailsStore.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataserviceDetailsStore.mjs","sources":["../../../lib/store/modules/dataserviceDetailsStore.ts"],"sourcesContent":["// @ts-nocheck\n/* Simple dataservice details store modeled after datasetDetailsStore */\n\nconst state = {\n dataservice: {\n id: '',\n catalog: {},\n keywords: [],\n title: {},\n description: {},\n publisher: {},\n contact_point: [],\n access_right: {},\n format: {},\n endpoint_url: [],\n translation_meta: {},\n descriptionHeight: 0,\n __raw: null,\n },\n loading: false,\n activeNavigationTab: 0,\n};\n\nconst getters = {\n getProperty: state => property => state.dataservice[property],\n getID: state => state.dataservice.id,\n getCatalog: state => state.dataservice.catalog,\n getCountry: state => state.dataservice.catalog?.country,\n getLanguages: state => state.dataservice.languages || [],\n getKeywords: state => state.dataservice.keywords || [],\n getTitle: state => state.dataservice.title,\n getDescription: state => state.dataservice.description,\n getPublisher: state => state.dataservice.publisher,\n getContactPoint: state => state.dataservice.contact_point || [],\n getAccessRight: state => state.dataservice.access_right,\n getFormat: state => state.dataservice.format,\n getEndpointUrls: state => state.dataservice.endpoint_url || [],\n getTranslationMeta: state => state.dataservice.translation_meta,\n getRaw: state => state.dataservice.__raw,\n getDatasetDescriptionHeight: state => state.dataservice.descriptionHeight,\n getLoading: state => state.loading,\n getActiveNavigationTab: state => state.activeNavigationTab,\n};\n\nconst actions = {\n loadDataserviceDetails({ commit }, idOrPayload) {\n return new Promise((resolve, reject) => {\n commit('SET_LOADING', true);\n const id = typeof idOrPayload === 'string' ? idOrPayload : (idOrPayload && idOrPayload.id);\n if (!id) {\n commit('SET_LOADING', false);\n return reject(new Error('No id provided'));\n }\n // service may return { status, result } or the object directly\n this.$dataserviceService.getSingle(id)\n .then((response) => {\n const payload = response && response.result ? response.result : response;\n commit('SET_RAW', payload.__raw || payload);\n commit('SET_ID', payload.id);\n commit('SET_CATALOG', payload.catalog);\n commit('SET_KEYWORDS', payload.keywords);\n commit('SET_TITLE', payload.title);\n commit('SET_DESCRIPTION', payload.description);\n commit('SET_LANGUAGES', payload.languages);\n commit('SET_PUBLISHER', payload.publisher);\n commit('SET_CONTACT_POINT', payload.contact_point);\n commit('SET_ACCESS_RIGHT', payload.access_right);\n commit('SET_FORMAT', payload.format);\n commit('SET_ENDPOINT_URL', payload.endpoint_url);\n commit('SET_TRANSLATION_META', payload.translation_meta);\n commit('SET_LOADING', false);\n resolve(payload);\n })\n .catch((err) => {\n commit('SET_LOADING', false);\n reject(err);\n });\n });\n },\n setActiveNavigationTab({ commit }, idx) {\n commit('SET_ACTIVE_NAVIGATION_TAB', idx);\n },\n setDatasetDescriptionHeight({ commit }, height) {\n commit('SET_DATASET_DESCRIPTION_HEIGHT', height);\n }\n};\n\nconst mutations = {\n SET_RAW(state, data) { state.dataservice.__raw = data; },\n SET_LOADING(state, val) { state.loading = val; },\n SET_ID(state, val) { state.dataservice.id = val; },\n SET_CATALOG(state, val) { state.dataservice.catalog = val || {}; },\n SET_KEYWORDS(state, val) { state.dataservice.keywords = val || []; },\n SET_TITLE(state, val) { state.dataservice.title = val || {}; },\n SET_DESCRIPTION(state, val) { state.dataservice.description = val || {}; },\n SET_LANGUAGES(state, languages) { state.dataservice.languages = languages || []; },\n SET_PUBLISHER(state, val) { state.dataservice.publisher = val || {}; },\n SET_CONTACT_POINT(state, val) { state.dataservice.contact_point = val || []; },\n SET_ACCESS_RIGHT(state, val) { state.dataservice.access_right = val || {}; },\n SET_FORMAT(state, val) { state.dataservice.format = val || {}; },\n SET_ENDPOINT_URL(state, val) { state.dataservice.endpoint_url = val || []; },\n SET_TRANSLATION_META(state, val) { state.dataservice.translation_meta = val || {}; },\n SET_DATASET_DESCRIPTION_HEIGHT(state, height) { state.dataservice.descriptionHeight = height; },\n SET_ACTIVE_NAVIGATION_TAB(state, idx) { state.activeNavigationTab = idx; },\n};\n\nexport default {\n namespaced: true,\n state,\n getters,\n actions,\n mutations,\n};\n"],"names":["state","getters","property","_a","actions","commit","idOrPayload","resolve","reject","id","response","payload","err","idx","height","mutations","data","val","languages","dataserviceDetails"],"mappings":"AAGA,MAAMA,IAAQ;AAAA,EACZ,aAAa;AAAA,IACX,IAAI;AAAA,IACJ,SAAS,CAAC;AAAA,IACV,UAAU,CAAC;AAAA,IACX,OAAO,CAAC;AAAA,IACR,aAAa,CAAC;AAAA,IACd,WAAW,CAAC;AAAA,IACZ,eAAe,CAAC;AAAA,IAChB,cAAc,CAAC;AAAA,IACf,QAAQ,CAAC;AAAA,IACT,cAAc,CAAC;AAAA,IACf,kBAAkB,CAAC;AAAA,IACnB,mBAAmB;AAAA,IACnB,OAAO;AAAA,EACT;AAAA,EACA,SAAS;AAAA,EACT,qBAAqB;AACvB,GAEMC,IAAU;AAAA,EACd,aAAa,CAAAD,MAAS,CAAYA,MAAAA,EAAM,YAAYE,CAAQ;AAAA,EAC5D,OAAO,CAAAF,MAASA,EAAM,YAAY;AAAA,EAClC,YAAY,CAAAA,MAASA,EAAM,YAAY;AAAA,EACvC,YAAY,CAAAA,MAASA;
|
|
1
|
+
{"version":3,"file":"dataserviceDetailsStore.mjs","sources":["../../../lib/store/modules/dataserviceDetailsStore.ts"],"sourcesContent":["// @ts-nocheck\n/* Simple dataservice details store modeled after datasetDetailsStore */\n\nconst state = {\n dataservice: {\n id: '',\n catalog: {},\n keywords: [],\n title: {},\n description: {},\n publisher: {},\n contact_point: [],\n access_right: {},\n format: {},\n endpoint_url: [],\n reference_system: [],\n topic_category: [],\n translation_meta: {},\n descriptionHeight: 0,\n __raw: null,\n },\n loading: false,\n activeNavigationTab: 0,\n};\n\nconst getters = {\n getProperty: state => property => state.dataservice[property],\n getID: state => state.dataservice.id,\n getCatalog: state => state.dataservice.catalog,\n getCountry: state => state.dataservice.catalog?.country,\n getLanguages: state => state.dataservice.languages || [],\n getKeywords: state => state.dataservice.keywords || [],\n getTitle: state => state.dataservice.title,\n getDescription: state => state.dataservice.description,\n getPublisher: state => state.dataservice.publisher,\n getContactPoint: state => state.dataservice.contact_point || [],\n getAccessRight: state => state.dataservice.access_right,\n getFormat: state => state.dataservice.format,\n getEndpointUrls: state => state.dataservice.endpoint_url || [],\n getTranslationMeta: state => state.dataservice.translation_meta,\n getRaw: state => state.dataservice.__raw,\n getDatasetDescriptionHeight: state => state.dataservice.descriptionHeight,\n getLoading: state => state.loading,\n getActiveNavigationTab: state => state.activeNavigationTab,\n};\n\nconst actions = {\n loadDataserviceDetails({ commit }, idOrPayload) {\n return new Promise((resolve, reject) => {\n commit('SET_LOADING', true);\n const id = typeof idOrPayload === 'string' ? idOrPayload : (idOrPayload && idOrPayload.id);\n if (!id) {\n commit('SET_LOADING', false);\n return reject(new Error('No id provided'));\n }\n // service may return { status, result } or the object directly\n this.$dataserviceService.getSingle(id)\n .then((response) => {\n const payload = response && response.result ? response.result : response;\n commit('SET_RAW', payload.__raw || payload);\n commit('SET_ID', payload.id);\n commit('SET_CATALOG', payload.catalog);\n commit('SET_KEYWORDS', payload.keywords);\n commit('SET_TITLE', payload.title);\n commit('SET_DESCRIPTION', payload.description);\n commit('SET_LANGUAGES', payload.languages);\n commit('SET_PUBLISHER', payload.publisher);\n commit('SET_CONTACT_POINT', payload.contact_point);\n commit('SET_ACCESS_RIGHT', payload.access_right);\n commit('SET_FORMAT', payload.format);\n commit('SET_ENDPOINT_URL', payload.endpoint_url);\n commit('SET_REFERENCE_SYSTEM', payload.reference_system);\n commit('SET_TOPIC_CATEGORY', payload.topic_category);\n commit('SET_TRANSLATION_META', payload.translation_meta);\n commit('SET_LOADING', false);\n resolve(payload);\n })\n .catch((err) => {\n commit('SET_LOADING', false);\n reject(err);\n });\n });\n },\n setActiveNavigationTab({ commit }, idx) {\n commit('SET_ACTIVE_NAVIGATION_TAB', idx);\n },\n setDatasetDescriptionHeight({ commit }, height) {\n commit('SET_DATASET_DESCRIPTION_HEIGHT', height);\n }\n};\n\nconst mutations = {\n SET_RAW(state, data) { state.dataservice.__raw = data; },\n SET_LOADING(state, val) { state.loading = val; },\n SET_ID(state, val) { state.dataservice.id = val; },\n SET_CATALOG(state, val) { state.dataservice.catalog = val || {}; },\n SET_KEYWORDS(state, val) { state.dataservice.keywords = val || []; },\n SET_TITLE(state, val) { state.dataservice.title = val || {}; },\n SET_DESCRIPTION(state, val) { state.dataservice.description = val || {}; },\n SET_LANGUAGES(state, languages) { state.dataservice.languages = languages || []; },\n SET_PUBLISHER(state, val) { state.dataservice.publisher = val || {}; },\n SET_CONTACT_POINT(state, val) { state.dataservice.contact_point = val || []; },\n SET_ACCESS_RIGHT(state, val) { state.dataservice.access_right = val || {}; },\n SET_FORMAT(state, val) { state.dataservice.format = val || {}; },\n SET_ENDPOINT_URL(state, val) { state.dataservice.endpoint_url = val || []; },\n SET_REFERENCE_SYSTEM(state, val) { state.dataservice.reference_system = val || []; },\n SET_TOPIC_CATEGORY(state, val) { state.dataservice.topic_category = val || []; },\n SET_TRANSLATION_META(state, val) { state.dataservice.translation_meta = val || {}; },\n SET_DATASET_DESCRIPTION_HEIGHT(state, height) { state.dataservice.descriptionHeight = height; },\n SET_ACTIVE_NAVIGATION_TAB(state, idx) { state.activeNavigationTab = idx; },\n};\n\nexport default {\n namespaced: true,\n state,\n getters,\n actions,\n mutations,\n};\n"],"names":["state","getters","property","_a","actions","commit","idOrPayload","resolve","reject","id","response","payload","err","idx","height","mutations","data","val","languages","dataserviceDetails"],"mappings":"AAGA,MAAMA,IAAQ;AAAA,EACZ,aAAa;AAAA,IACX,IAAI;AAAA,IACJ,SAAS,CAAC;AAAA,IACV,UAAU,CAAC;AAAA,IACX,OAAO,CAAC;AAAA,IACR,aAAa,CAAC;AAAA,IACd,WAAW,CAAC;AAAA,IACZ,eAAe,CAAC;AAAA,IAChB,cAAc,CAAC;AAAA,IACf,QAAQ,CAAC;AAAA,IACT,cAAc,CAAC;AAAA,IACf,kBAAkB,CAAC;AAAA,IACnB,gBAAgB,CAAC;AAAA,IACjB,kBAAkB,CAAC;AAAA,IACnB,mBAAmB;AAAA,IACnB,OAAO;AAAA,EACT;AAAA,EACA,SAAS;AAAA,EACT,qBAAqB;AACvB,GAEMC,IAAU;AAAA,EACd,aAAa,CAAAD,MAAS,CAAYA,MAAAA,EAAM,YAAYE,CAAQ;AAAA,EAC5D,OAAO,CAAAF,MAASA,EAAM,YAAY;AAAA,EAClC,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A,EACnF,+BAA+BjB,GAAOc,GAAQ;AAAEd,IAAAA,EAAM,YAAY,oBAAoBc;AAAA,EAAQ;AAAA,EAC9F,0BAA0Bd,GAAOa,GAAK;AAAEb,IAAAA,EAAM,sBAAsBa;AAAA,EAAK;AAC3E,GAEeM,IAAA;AAAA,EACb,YAAY;AAAA,EACZ,OAAAnB;AAAA,EACA,SAAAC;AAAA,EACA,SAAAG;AAAA,EACA,WAAAW;AACF;"}
|
package/dist/utils/helpers.mjs
CHANGED
|
@@ -96,9 +96,9 @@ function _s(s) {
|
|
|
96
96
|
try {
|
|
97
97
|
t = m[`${f}/flags/${s.toLowerCase()}.png`];
|
|
98
98
|
} catch {
|
|
99
|
-
t =
|
|
99
|
+
t = void 0;
|
|
100
100
|
}
|
|
101
|
-
return t.default;
|
|
101
|
+
return t || (t = m[`${f}/flags/eu.png`]), t ? t.default : void 0;
|
|
102
102
|
}
|
|
103
103
|
function Ks(s, t, o) {
|
|
104
104
|
if (!s || u(s) || !$(s) && !l(s))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.mjs","sources":["../../lib/utils/helpers.ts"],"sourcesContent":["// @ts-nocheck\n/* eslint-disable no-restricted-syntax,guard-for-in,no-param-reassign,no-lonely-if */\n/**\n * @created 11.05.2017\n * @description Contains helper functions for general purposes needed in the Application.\n */\n\n/* eslint-disable no-undef */\n/* eslint-disable no-nested-ternary */\nimport {\n has,\n isString,\n isObject,\n isNil,\n isArray,\n} from 'lodash';\nimport { getName, registerLocale } from 'i18n-iso-countries';\n\n// Import all images.\n// eager loading of images is needed for now for better compatibility.\n// See https://vitejs.dev/guide/features.html#glob-import\nconst imageModules = import.meta.globEager('../assets/img/**/*.png');\nconst localeModules = import.meta.globEager('../config/langs/{bg,cs,da,de,el,es,et,fr,hr,hu,it,lt,lv,nl,nb,pl,pt,ro,sk,sl,fi,sv}.json');\nconst RELATIVE_PATH_TO_IMAGES = '../assets/img';\n\n// ga and mt missing, nb for no\nconst languageList = ['bg', 'cs', 'da', 'de', 'el', 'es', 'et', 'fr', 'hr', 'hu', 'it', 'lt', 'lv', 'nl', 'nb', 'pl', 'pt', 'ro', 'sk', 'sl', 'fi', 'sv'];\nlanguageList.forEach( (lang) => {\n const locale = localeModules[`../config/langs/${lang}.json`];\n if (locale) {\n registerLocale(locale.default);\n }\n});\n\n/**\n * @description Returns an array that contains unique values\n * of the given properties in the given array.\n * @param { String } prop - The key of {array} which values will be unique.\n * @param { [Object] } array - The array to take keys from.\n * @returns { [*] } A new Array containing unique values of the {arrays} {key} property\n */\nfunction unique(prop, array) {\n // Filter elements in {array} that do not have a {prop} key.\n return [...new Set(array.filter(\n // Remove duplicates by creating a Set and remove items where {prop} has no value.\n item => Object.prototype.hasOwnProperty.call(item, prop) && !!item[prop],\n )\n // Create a new array containing the {prop} values of each given item.\n .map(item => item[prop]))];\n}\n\n/**\n * @description Abstract function that returns an image from /assets/img\n * @param { String } image - The path to the image from /assets/img without fileending e.g. \"/flags/eu\"\n * @param { String } defaultFallbackImage - The path to the default fallback image from /assets/img without fileending e.g. \"/flags/eu\"\n * @returns { String } An image, represented by its absolute path.\n */\nfunction getImg(image = '', defaultFallbackImage = '') {\n const maybeImageFrontSlash = image.startsWith('/') ? image : `/${image}`;\n const maybeFallbackImageFrontSlash = defaultFallbackImage.startsWith('/') ? defaultFallbackImage : `/${defaultFallbackImage}`;\n let img;\n\n try {\n img = imageModules[`${RELATIVE_PATH_TO_IMAGES}${maybeImageFrontSlash}.png`];\n if (!img) {\n throw new Error('Image not found');\n }\n } catch (err) {\n if (defaultFallbackImage) img = imageModules[`${RELATIVE_PATH_TO_IMAGES}${maybeFallbackImageFrontSlash}.png`];\n else img = imageModules[`${RELATIVE_PATH_TO_IMAGES}/img-not-available.png`];\n }\n\n return img.default;\n}\n\n\n\n/**\n * @description Returns an image of a flag.\n * @param { String } countryId - The ID (example: 'en', 'de', 'fr') of a country to get the flag from.\n * @returns { String } An image, represented by its absolute path.\n */\nfunction getCountryFlagImg(countryId) {\n let img;\n try {\n img = imageModules[`${RELATIVE_PATH_TO_IMAGES}/flags/${countryId.toLowerCase()}.png`];\n } catch (err) {\n img = imageModules[`${RELATIVE_PATH_TO_IMAGES}/flags/eu.png`];\n }\n return img.default;\n}\n\n\nfunction getRepresentativeLocaleOf(prop, userLocale, fallbacks) {\n if (!prop || isNil(prop) || (!isObject(prop) && !isString(prop))) return undefined;\n // Check if prop is only a string without translations\n if (isString(prop)) return prop;\n // Use language setting of user\n if (has(prop, userLocale)) return userLocale;\n // Iterate over given fallback languages\n if (fallbacks && isArray(fallbacks)) {\n const foundLang = fallbacks.find(lang => lang\n && isString(lang)\n && has(prop, lang.toLowerCase()));\n if (foundLang) return foundLang;\n }\n // Use the first language in the given property if none of the languages is present\n const key = Object.keys(prop)[0];\n if (key) return key;\n // Use default text if prop does not have any items\n return undefined;\n}\n\n/**\n * @description Checks if a translation for the given prop parameter is available and returns it in the following priority order:\n * 1. User set locale\n * 2. Given fallback languages\n * 3. Any available language\n * @param { Object } prop - The object that should contain the translations\n * @param { String } userLocale - The currently set locale.\n * @param { [String] } fallbacks - The fallback languages to check for, when given locale is not available in given prop\n * @returns { String } A translated text.\n */\nfunction getTranslationFor(prop, userLocale, fallbacks) {\n const locale = getRepresentativeLocaleOf(prop, userLocale, fallbacks);\n return locale\n ? prop[locale]\n : undefined;\n}\n\n\n/**\n * @description Returns the translation for a facet item\n * @param { String } fieldId\n * @param { String } facetId\n * @param { String } userLocale\n * @param { String } fallback\n * @returns { String } The translated facet item, if available\n */\nfunction getFacetTranslation(fieldId, facetId, userLocale, fallback) {\n if (fieldId === 'country') {\n const locale = userLocale === 'no' ? 'nb' : userLocale;\n const name = getName(facetId, locale);\n // Translation missing because this.$t('message.catalogFacets.euInstitutions') is not working here\n // return isNil(name)\n // ? (fallback === 'EU institutions' ? this.$t('message.catalogFacets.euInstitutions') : fallback)\n // : name;\n return isNil(name)\n ? fallback\n : name;\n }\n if (isObject(fallback)) {\n return has(fallback, userLocale)\n ? fallback[userLocale]\n : has(fallback, 'en')\n ? fallback.en\n : Object.keys(fallback).length > 0\n ? fallback[0]\n : 'No title available';\n }\n return isNil(fallback)\n ? 'No title available'\n : (isString(fallback)\n ? fallback\n : fallback.toString());\n}\n\n\n/**\n * Truncates a String to a maximum character count of maxChars\n * @param text\n * @param maxChars\n * @param noAppend\n */\nfunction truncate(text, maxChars, noAppend) {\n if (!text) return '';\n const trunc = text.substring(0, maxChars);\n if (noAppend || text.length <= maxChars) return trunc;\n return `${trunc}...`;\n}\n\n/**\n * normalizing the dataset id\n * @param str string to be normalized\n */\nfunction normalize(str) {\n const normalized = str.normalize('NFKD');\n return normalized.replace('%', '').replace('\\\\W', '-').replace('-+', '-').toLowerCase();\n}\n\n/**\n * remove mailto or tel\n * @param str string\n */\nfunction removeMailtoOrTel(str) {\n return str.replace(/^(mailto|tel):/, '');\n}\n\nfunction replaceHttp(str) {\n try {\n const url = new URL(str);\n if (url.protocol === 'http:') {\n url.protocol = 'https:';\n }\n return url.href;\n } catch (ex) {\n // Return original string if it is not a valid URL\n return str;\n }\n}\n\n/**\n * Returns a function that takes an object and returns a modified object\n * where for each dstProp in dstProps holds: object.dstProp === object.srcProp\n *\n * This function aims to help maintain stability against DCAT-AP schema changes\n * by providing alternative keys names for access\n *\n * @example\n * const foo = { foo: 'hello world' };\n * const mirrorFooAsBar = mirrorPropertyFn('foo', 'bar');\n * const mirrored = mirrorFooAsBar(foo);\n * log(mirrored.foo) // -> 'hello world'\n * log(mirrored.bar) // -> 'hello world'\n * @param {String} srcProp\n * @param {String | Array<String>} dstProps\n * @returns {Function}\n */\nfunction mirrorPropertyFn(srcProp, dstProps) {\n const dstPropsArray = isArray(dstProps)\n ? dstProps\n : [dstProps];\n\n // Return function that returns a proxy that does the mirroring when\n // accessing dstProps\n return obj => new Proxy({\n // Add preliminary dstProps to object so lodash _.has won't return false\n ...obj,\n ...dstPropsArray.reduce((acc, prop) => {\n // eslint-disable-next-line no-param-reassign\n acc[prop] = obj[srcProp];\n return acc;\n }, {}),\n }, {\n get(target, prop, receiver) {\n // If accessing dstProp, return srcProp value\n const foundTargetProp = dstPropsArray.includes(srcProp);\n const maybeRedirectedProp = foundTargetProp\n ? srcProp\n : prop;\n return Reflect.get(target, maybeRedirectedProp, receiver);\n },\n });\n}\n\n\n/**\n * @description Function for determining of given data is of type object\n * @param {*} data\n * @returns Boolean determining, if data is object\n */\nfunction matchesObjectStructure(data) {\n const dataKeys = Object.keys(data);\n const firstValue = data[dataKeys[0]];\n\n if (typeof firstValue === 'string' || typeof firstValue === 'number') {\n return true;\n }\n return false;\n}\n\n/**\n* @description Function to search for all properties in inputconfiguration which provide a 'source'-property.\n* Each name provided by a 'source'-property is saved inside the propertyNamesArray and returned as an array of property-names.\n* @param {Array} inputConfigArray Array of inputconfiguration containing information about components to render.\n* @param {Array} propertyNamesArray Array of names retrieved from components with a 'source'-property.\n* @returns {Array} Array with all names retireved (popertyNamesArray)\n*/\nfunction findPropertiesWithSources(inputConfigArray, propertyNamesArray) {\n for (const index in inputConfigArray) {\n // only subcomponents without a 'children'-property contain a 'source'-property\n // if there is a 'children'-property the current component isn't a subcomponent so\n // the function needs be called again on this component to get to the subcomponent\n if (Object.keys(inputConfigArray[index]).includes('children')) {\n findPropertiesWithSources(inputConfigArray[index].children, propertyNamesArray);\n } else if (inputConfigArray[index].type === 'conditional-input') {\n const conditionalInputKeys = Object.keys(inputConfigArray[index].data);\n for (const inputKeyIndex in conditionalInputKeys) {\n findPropertiesWithSources(inputConfigArray[index].data[conditionalInputKeys[inputKeyIndex]], propertyNamesArray);\n }\n } else {\n // not all subcomponents contain a 'source'-property\n if (Object.keys(inputConfigArray[index]).includes('source')) {\n // the 'source'-property provides a name which links to further information in the generalconfig-file\n if (!propertyNamesArray.includes(inputConfigArray[index].source.name)) {\n propertyNamesArray.push(inputConfigArray[index].source.name);\n }\n }\n }\n }\n\n return propertyNamesArray;\n}\n\n/**\n*\n* @param {*} dataset\n* @param {*} properties\n* @param {*} translatableProperties\n*/\nfunction setTranslation(dataset, properties, translatableProperties, languageInformation) {\n for (const propertyIndex in properties) {\n const propertyName = properties[propertyIndex];\n const propertyValue = dataset[propertyName];\n\n if (translatableProperties.includes(propertyName)) {\n const translationSelectoren = Object.keys(languageInformation.translation[languageInformation.locale].message.dataupload[propertyName]);\n\n if (propertyValue !== '') {\n if (translationSelectoren.includes(propertyValue)) {\n dataset[propertyName] = languageInformation.translation[languageInformation.locale].message.dataupload[propertyName][propertyValue];\n }\n }\n }\n }\n}\n\n/**\n* @description Appends current locale to an url\n* @param {String} url url\n*/\nfunction appendCurrentLocaleToURL(url) {\n try {\n const urlHost = new URL(url).host;\n const baseUrlHost = new URL(this.$env.api.baseUrl).host;\n const isOurHostname = urlHost === baseUrlHost;\n if (isOurHostname) {\n return `${url}?locale=${this.$route.query.locale}`;\n }\n return url;\n } catch {\n // when there is no hostname then it should link to our website\n return `${url}?locale=${this.$route.query.locale}`;\n }\n}\n\n/**\n* @description Add preceding zero for numbers < 100 (if not already existing)\n* @param {String} value value\n*/\nfunction addPrecedingZero(value) {\n return `${parseInt(value, 10) < 10 ? 0 : ''}${parseInt(value, 10)}`;\n}\n\n/**\n* @description Formatting temporalResolution property into human-readable format\n* @param {String} datetime datetime in temporalResolution format\n*/\nfunction formatDatetime(datetime) {\n let date = datetime.split('T')[0].substr(1,);\n\n const year = date.split('Y')[0];\n date = date.split('Y')[1];\n\n const month = addPrecedingZero(date.split('M')[0]);\n date = date.split('M')[1];\n\n const day = addPrecedingZero(date.split('D')[0]);\n\n let time = datetime.split('T')[1];\n\n const hour = addPrecedingZero(time.split('H')[0]);\n time = time.split('H')[1];\n\n const minute = addPrecedingZero(time.split('M')[0]);\n time = time.split('M')[1];\n\n const second = addPrecedingZero(time.split('S')[0]);\n\n return `${hour}:${minute}:${second} - ${day}.${month}.${year}`;\n}\n\n/**\n * @description Creates a navigation guard that adds a locale to the query if it is not present.\n */\nfunction createStickyLocale(fallbackLocale: string = 'en') {\n return function stickyLocale(to: any, from: any, next: Function) {\n const toLocale = to.query.locale;\n const fromLocale = from.query.locale;\n\n const newLocale = toLocale ?? fromLocale ?? fallbackLocale;\n\n newLocale !== toLocale \n ? next({ ...to, query: { ...to.query, locale: newLocale } })\n : next();\n };\n}\n\n// Export all functions as default export.\nexport {\n unique,\n getImg,\n getCountryFlagImg,\n getFacetTranslation,\n getRepresentativeLocaleOf,\n getTranslationFor,\n truncate,\n normalize,\n removeMailtoOrTel,\n replaceHttp,\n mirrorPropertyFn,\n matchesObjectStructure,\n findPropertiesWithSources,\n setTranslation,\n appendCurrentLocaleToURL,\n addPrecedingZero,\n formatDatetime,\n createStickyLocale,\n};\n"],"names":["imageModules","localeModules","RELATIVE_PATH_TO_IMAGES","languageList","lang","locale","registerLocale","unique","prop","array","item","getImg","image","defaultFallbackImage","maybeImageFrontSlash","maybeFallbackImageFrontSlash","img","getCountryFlagImg","countryId","getRepresentativeLocaleOf","userLocale","fallbacks","isNil","isObject","isString","has","isArray","foundLang","key","getTranslationFor","getFacetTranslation","fieldId","facetId","fallback","name","getName","truncate","text","maxChars","noAppend","trunc","normalize","str","removeMailtoOrTel","replaceHttp","url","mirrorPropertyFn","srcProp","dstProps","dstPropsArray","obj","acc","target","receiver","maybeRedirectedProp","matchesObjectStructure","data","dataKeys","firstValue","findPropertiesWithSources","inputConfigArray","propertyNamesArray","index","conditionalInputKeys","inputKeyIndex","setTranslation","dataset","properties","translatableProperties","languageInformation","propertyIndex","propertyName","propertyValue","translationSelectoren","appendCurrentLocaleToURL","urlHost","baseUrlHost","addPrecedingZero","value","formatDatetime","datetime","date","year","month","day","time","hour","minute","second","createStickyLocale","fallbackLocale","to","from","next","toLocale","fromLocale","newLocale"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAMA,ukDACAC,ktBACAC,IAA0B,iBAG1BC,KAAe,CAAC,MAAM,M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/utils/helpers.ts"],"sourcesContent":["// @ts-nocheck\n/* eslint-disable no-restricted-syntax,guard-for-in,no-param-reassign,no-lonely-if */\n/**\n * @created 11.05.2017\n * @description Contains helper functions for general purposes needed in the Application.\n */\n\n/* eslint-disable no-undef */\n/* eslint-disable no-nested-ternary */\nimport {\n has,\n isString,\n isObject,\n isNil,\n isArray,\n} from 'lodash';\nimport { getName, registerLocale } from 'i18n-iso-countries';\n\n// Import all images.\n// eager loading of images is needed for now for better compatibility.\n// See https://vitejs.dev/guide/features.html#glob-import\nconst imageModules = import.meta.globEager('../assets/img/**/*.png');\nconst localeModules = import.meta.globEager('../config/langs/{bg,cs,da,de,el,es,et,fr,hr,hu,it,lt,lv,nl,nb,pl,pt,ro,sk,sl,fi,sv}.json');\nconst RELATIVE_PATH_TO_IMAGES = '../assets/img';\n\n// ga and mt missing, nb for no\nconst languageList = ['bg', 'cs', 'da', 'de', 'el', 'es', 'et', 'fr', 'hr', 'hu', 'it', 'lt', 'lv', 'nl', 'nb', 'pl', 'pt', 'ro', 'sk', 'sl', 'fi', 'sv'];\nlanguageList.forEach( (lang) => {\n const locale = localeModules[`../config/langs/${lang}.json`];\n if (locale) {\n registerLocale(locale.default);\n }\n});\n\n/**\n * @description Returns an array that contains unique values\n * of the given properties in the given array.\n * @param { String } prop - The key of {array} which values will be unique.\n * @param { [Object] } array - The array to take keys from.\n * @returns { [*] } A new Array containing unique values of the {arrays} {key} property\n */\nfunction unique(prop, array) {\n // Filter elements in {array} that do not have a {prop} key.\n return [...new Set(array.filter(\n // Remove duplicates by creating a Set and remove items where {prop} has no value.\n item => Object.prototype.hasOwnProperty.call(item, prop) && !!item[prop],\n )\n // Create a new array containing the {prop} values of each given item.\n .map(item => item[prop]))];\n}\n\n/**\n * @description Abstract function that returns an image from /assets/img\n * @param { String } image - The path to the image from /assets/img without fileending e.g. \"/flags/eu\"\n * @param { String } defaultFallbackImage - The path to the default fallback image from /assets/img without fileending e.g. \"/flags/eu\"\n * @returns { String } An image, represented by its absolute path.\n */\nfunction getImg(image = '', defaultFallbackImage = '') {\n const maybeImageFrontSlash = image.startsWith('/') ? image : `/${image}`;\n const maybeFallbackImageFrontSlash = defaultFallbackImage.startsWith('/') ? defaultFallbackImage : `/${defaultFallbackImage}`;\n let img;\n\n try {\n img = imageModules[`${RELATIVE_PATH_TO_IMAGES}${maybeImageFrontSlash}.png`];\n if (!img) {\n throw new Error('Image not found');\n }\n } catch (err) {\n if (defaultFallbackImage) img = imageModules[`${RELATIVE_PATH_TO_IMAGES}${maybeFallbackImageFrontSlash}.png`];\n else img = imageModules[`${RELATIVE_PATH_TO_IMAGES}/img-not-available.png`];\n }\n\n return img.default;\n}\n\n\n\n/**\n * @description Returns an image of a flag.\n * @param { String } countryId - The ID (example: 'en', 'de', 'fr') of a country to get the flag from.\n * @returns { String } An image, represented by its absolute path.\n */\nfunction getCountryFlagImg(countryId) {\n let img;\n try {\n img = imageModules[`${RELATIVE_PATH_TO_IMAGES}/flags/${countryId.toLowerCase()}.png`];\n } catch (err) {\n img = undefined;\n }\n if (!img) {\n img = imageModules[`${RELATIVE_PATH_TO_IMAGES}/flags/eu.png`];\n }\n return img ? img.default : undefined;\n}\n\n\nfunction getRepresentativeLocaleOf(prop, userLocale, fallbacks) {\n if (!prop || isNil(prop) || (!isObject(prop) && !isString(prop))) return undefined;\n // Check if prop is only a string without translations\n if (isString(prop)) return prop;\n // Use language setting of user\n if (has(prop, userLocale)) return userLocale;\n // Iterate over given fallback languages\n if (fallbacks && isArray(fallbacks)) {\n const foundLang = fallbacks.find(lang => lang\n && isString(lang)\n && has(prop, lang.toLowerCase()));\n if (foundLang) return foundLang;\n }\n // Use the first language in the given property if none of the languages is present\n const key = Object.keys(prop)[0];\n if (key) return key;\n // Use default text if prop does not have any items\n return undefined;\n}\n\n/**\n * @description Checks if a translation for the given prop parameter is available and returns it in the following priority order:\n * 1. User set locale\n * 2. Given fallback languages\n * 3. Any available language\n * @param { Object } prop - The object that should contain the translations\n * @param { String } userLocale - The currently set locale.\n * @param { [String] } fallbacks - The fallback languages to check for, when given locale is not available in given prop\n * @returns { String } A translated text.\n */\nfunction getTranslationFor(prop, userLocale, fallbacks) {\n const locale = getRepresentativeLocaleOf(prop, userLocale, fallbacks);\n return locale\n ? prop[locale]\n : undefined;\n}\n\n\n/**\n * @description Returns the translation for a facet item\n * @param { String } fieldId\n * @param { String } facetId\n * @param { String } userLocale\n * @param { String } fallback\n * @returns { String } The translated facet item, if available\n */\nfunction getFacetTranslation(fieldId, facetId, userLocale, fallback) {\n if (fieldId === 'country') {\n const locale = userLocale === 'no' ? 'nb' : userLocale;\n const name = getName(facetId, locale);\n // Translation missing because this.$t('message.catalogFacets.euInstitutions') is not working here\n // return isNil(name)\n // ? (fallback === 'EU institutions' ? this.$t('message.catalogFacets.euInstitutions') : fallback)\n // : name;\n return isNil(name)\n ? fallback\n : name;\n }\n if (isObject(fallback)) {\n return has(fallback, userLocale)\n ? fallback[userLocale]\n : has(fallback, 'en')\n ? fallback.en\n : Object.keys(fallback).length > 0\n ? fallback[0]\n : 'No title available';\n }\n return isNil(fallback)\n ? 'No title available'\n : (isString(fallback)\n ? fallback\n : fallback.toString());\n}\n\n\n/**\n * Truncates a String to a maximum character count of maxChars\n * @param text\n * @param maxChars\n * @param noAppend\n */\nfunction truncate(text, maxChars, noAppend) {\n if (!text) return '';\n const trunc = text.substring(0, maxChars);\n if (noAppend || text.length <= maxChars) return trunc;\n return `${trunc}...`;\n}\n\n/**\n * normalizing the dataset id\n * @param str string to be normalized\n */\nfunction normalize(str) {\n const normalized = str.normalize('NFKD');\n return normalized.replace('%', '').replace('\\\\W', '-').replace('-+', '-').toLowerCase();\n}\n\n/**\n * remove mailto or tel\n * @param str string\n */\nfunction removeMailtoOrTel(str) {\n return str.replace(/^(mailto|tel):/, '');\n}\n\nfunction replaceHttp(str) {\n try {\n const url = new URL(str);\n if (url.protocol === 'http:') {\n url.protocol = 'https:';\n }\n return url.href;\n } catch (ex) {\n // Return original string if it is not a valid URL\n return str;\n }\n}\n\n/**\n * Returns a function that takes an object and returns a modified object\n * where for each dstProp in dstProps holds: object.dstProp === object.srcProp\n *\n * This function aims to help maintain stability against DCAT-AP schema changes\n * by providing alternative keys names for access\n *\n * @example\n * const foo = { foo: 'hello world' };\n * const mirrorFooAsBar = mirrorPropertyFn('foo', 'bar');\n * const mirrored = mirrorFooAsBar(foo);\n * log(mirrored.foo) // -> 'hello world'\n * log(mirrored.bar) // -> 'hello world'\n * @param {String} srcProp\n * @param {String | Array<String>} dstProps\n * @returns {Function}\n */\nfunction mirrorPropertyFn(srcProp, dstProps) {\n const dstPropsArray = isArray(dstProps)\n ? dstProps\n : [dstProps];\n\n // Return function that returns a proxy that does the mirroring when\n // accessing dstProps\n return obj => new Proxy({\n // Add preliminary dstProps to object so lodash _.has won't return false\n ...obj,\n ...dstPropsArray.reduce((acc, prop) => {\n // eslint-disable-next-line no-param-reassign\n acc[prop] = obj[srcProp];\n return acc;\n }, {}),\n }, {\n get(target, prop, receiver) {\n // If accessing dstProp, return srcProp value\n const foundTargetProp = dstPropsArray.includes(srcProp);\n const maybeRedirectedProp = foundTargetProp\n ? srcProp\n : prop;\n return Reflect.get(target, maybeRedirectedProp, receiver);\n },\n });\n}\n\n\n/**\n * @description Function for determining of given data is of type object\n * @param {*} data\n * @returns Boolean determining, if data is object\n */\nfunction matchesObjectStructure(data) {\n const dataKeys = Object.keys(data);\n const firstValue = data[dataKeys[0]];\n\n if (typeof firstValue === 'string' || typeof firstValue === 'number') {\n return true;\n }\n return false;\n}\n\n/**\n* @description Function to search for all properties in inputconfiguration which provide a 'source'-property.\n* Each name provided by a 'source'-property is saved inside the propertyNamesArray and returned as an array of property-names.\n* @param {Array} inputConfigArray Array of inputconfiguration containing information about components to render.\n* @param {Array} propertyNamesArray Array of names retrieved from components with a 'source'-property.\n* @returns {Array} Array with all names retireved (popertyNamesArray)\n*/\nfunction findPropertiesWithSources(inputConfigArray, propertyNamesArray) {\n for (const index in inputConfigArray) {\n // only subcomponents without a 'children'-property contain a 'source'-property\n // if there is a 'children'-property the current component isn't a subcomponent so\n // the function needs be called again on this component to get to the subcomponent\n if (Object.keys(inputConfigArray[index]).includes('children')) {\n findPropertiesWithSources(inputConfigArray[index].children, propertyNamesArray);\n } else if (inputConfigArray[index].type === 'conditional-input') {\n const conditionalInputKeys = Object.keys(inputConfigArray[index].data);\n for (const inputKeyIndex in conditionalInputKeys) {\n findPropertiesWithSources(inputConfigArray[index].data[conditionalInputKeys[inputKeyIndex]], propertyNamesArray);\n }\n } else {\n // not all subcomponents contain a 'source'-property\n if (Object.keys(inputConfigArray[index]).includes('source')) {\n // the 'source'-property provides a name which links to further information in the generalconfig-file\n if (!propertyNamesArray.includes(inputConfigArray[index].source.name)) {\n propertyNamesArray.push(inputConfigArray[index].source.name);\n }\n }\n }\n }\n\n return propertyNamesArray;\n}\n\n/**\n*\n* @param {*} dataset\n* @param {*} properties\n* @param {*} translatableProperties\n*/\nfunction setTranslation(dataset, properties, translatableProperties, languageInformation) {\n for (const propertyIndex in properties) {\n const propertyName = properties[propertyIndex];\n const propertyValue = dataset[propertyName];\n\n if (translatableProperties.includes(propertyName)) {\n const translationSelectoren = Object.keys(languageInformation.translation[languageInformation.locale].message.dataupload[propertyName]);\n\n if (propertyValue !== '') {\n if (translationSelectoren.includes(propertyValue)) {\n dataset[propertyName] = languageInformation.translation[languageInformation.locale].message.dataupload[propertyName][propertyValue];\n }\n }\n }\n }\n}\n\n/**\n* @description Appends current locale to an url\n* @param {String} url url\n*/\nfunction appendCurrentLocaleToURL(url) {\n try {\n const urlHost = new URL(url).host;\n const baseUrlHost = new URL(this.$env.api.baseUrl).host;\n const isOurHostname = urlHost === baseUrlHost;\n if (isOurHostname) {\n return `${url}?locale=${this.$route.query.locale}`;\n }\n return url;\n } catch {\n // when there is no hostname then it should link to our website\n return `${url}?locale=${this.$route.query.locale}`;\n }\n}\n\n/**\n* @description Add preceding zero for numbers < 100 (if not already existing)\n* @param {String} value value\n*/\nfunction addPrecedingZero(value) {\n return `${parseInt(value, 10) < 10 ? 0 : ''}${parseInt(value, 10)}`;\n}\n\n/**\n* @description Formatting temporalResolution property into human-readable format\n* @param {String} datetime datetime in temporalResolution format\n*/\nfunction formatDatetime(datetime) {\n let date = datetime.split('T')[0].substr(1,);\n\n const year = date.split('Y')[0];\n date = date.split('Y')[1];\n\n const month = addPrecedingZero(date.split('M')[0]);\n date = date.split('M')[1];\n\n const day = addPrecedingZero(date.split('D')[0]);\n\n let time = datetime.split('T')[1];\n\n const hour = addPrecedingZero(time.split('H')[0]);\n time = time.split('H')[1];\n\n const minute = addPrecedingZero(time.split('M')[0]);\n time = time.split('M')[1];\n\n const second = addPrecedingZero(time.split('S')[0]);\n\n return `${hour}:${minute}:${second} - ${day}.${month}.${year}`;\n}\n\n/**\n * @description Creates a navigation guard that adds a locale to the query if it is not present.\n */\nfunction createStickyLocale(fallbackLocale: string = 'en') {\n return function stickyLocale(to: any, from: any, next: Function) {\n const toLocale = to.query.locale;\n const fromLocale = from.query.locale;\n\n const newLocale = toLocale ?? fromLocale ?? fallbackLocale;\n\n newLocale !== toLocale \n ? next({ ...to, query: { ...to.query, locale: newLocale } })\n : next();\n };\n}\n\n// Export all functions as default export.\nexport {\n unique,\n getImg,\n getCountryFlagImg,\n getFacetTranslation,\n getRepresentativeLocaleOf,\n getTranslationFor,\n truncate,\n normalize,\n removeMailtoOrTel,\n replaceHttp,\n mirrorPropertyFn,\n matchesObjectStructure,\n findPropertiesWithSources,\n setTranslation,\n appendCurrentLocaleToURL,\n addPrecedingZero,\n formatDatetime,\n createStickyLocale,\n};\n"],"names":["imageModules","localeModules","RELATIVE_PATH_TO_IMAGES","languageList","lang","locale","registerLocale","unique","prop","array","item","getImg","image","defaultFallbackImage","maybeImageFrontSlash","maybeFallbackImageFrontSlash","img","getCountryFlagImg","countryId","getRepresentativeLocaleOf","userLocale","fallbacks","isNil","isObject","isString","has","isArray","foundLang","key","getTranslationFor","getFacetTranslation","fieldId","facetId","fallback","name","getName","truncate","text","maxChars","noAppend","trunc","normalize","str","removeMailtoOrTel","replaceHttp","url","mirrorPropertyFn","srcProp","dstProps","dstPropsArray","obj","acc","target","receiver","maybeRedirectedProp","matchesObjectStructure","data","dataKeys","firstValue","findPropertiesWithSources","inputConfigArray","propertyNamesArray","index","conditionalInputKeys","inputKeyIndex","setTranslation","dataset","properties","translatableProperties","languageInformation","propertyIndex","propertyName","propertyValue","translationSelectoren","appendCurrentLocaleToURL","urlHost","baseUrlHost","addPrecedingZero","value","formatDatetime","datetime","date","year","month","day","time","hour","minute","second","createStickyLocale","fallbackLocale","to","from","next","toLocale","fromLocale","newLocale"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAMA,ukDACAC,ktBACAC,IAA0B,iBAG1BC,KAAe,CAAC,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,IAAI;AACxJA,GAAa,QAAS,CAACC,MAAS;AAC9B,QAAMC,IAASJ,GAAc,mBAAmBG,CAAI,OAAO;AAC3D,EAAIC,KACFC,GAAeD,EAAO,OAAO;AAEjC,CAAC;AASD,SAASE,GAAOC,GAAMC,GAAO;AAE3B,SAAO,CAAC,GAAG,IAAI,IAAIA,EAAM;AAAA;AAAA,IAEvB,CAAAC,MAAQ,OAAO,UAAU,eAAe,KAAKA,GAAMF,CAAI,KAAK,CAAC,CAACE,EAAKF,CAAI;AAAA,EAAA,EAGtE,IAAI,CAAAE,MAAQA,EAAKF,CAAI,CAAC,CAAC,CAAC;AAC7B;AAQA,SAASG,GAAOC,IAAQ,IAAIC,IAAuB,IAAI;AACrD,QAAMC,IAAuBF,EAAM,WAAW,GAAG,IAAIA,IAAQ,IAAIA,CAAK,IAChEG,IAA+BF,EAAqB,WAAW,GAA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