@piveau/piveau-hub-ui-modules 4.6.20 → 4.6.22
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/data-provider-interface/CatalogueMQA.vue.mjs +115 -123
- package/dist/data-provider-interface/CatalogueMQA.vue.mjs.map +1 -1
- package/dist/data-provider-interface/DataProviderInterface.vue.d.ts +1 -1
- package/dist/data-provider-interface/DataProviderInterface.vue.mjs.map +1 -1
- package/dist/data-provider-interface/DataProviderInterface.vue2.mjs +7 -6
- package/dist/data-provider-interface/DataProviderInterface.vue2.mjs.map +1 -1
- package/dist/data-provider-interface/components/Navigation.vue.d.ts +1 -1
- package/dist/data-provider-interface/components/Navigation.vue.mjs +63 -59
- package/dist/data-provider-interface/components/Navigation.vue.mjs.map +1 -1
- package/dist/data-provider-interface/components/SimpleSelect.vue.mjs +74 -74
- package/dist/data-provider-interface/components/SimpleSelect.vue.mjs.map +1 -1
- package/dist/data-provider-interface/composables/useDpiContext.d.ts +1 -0
- package/dist/data-provider-interface/composables/useDpiContext.mjs.map +1 -1
- package/dist/data-provider-interface/config/dcatapde/input-definition.mjs +3 -2
- package/dist/data-provider-interface/config/dcatapde/input-definition.mjs.map +1 -1
- package/dist/data-provider-interface/utils/RDFconverter.mjs +70 -76
- package/dist/data-provider-interface/utils/RDFconverter.mjs.map +1 -1
- package/dist/data-provider-interface/views/InputPage.vue.d.ts +1 -1
- package/dist/piveau-hub-ui-modules.css +1 -1
- package/package.json +1 -1
|
@@ -1,116 +1,116 @@
|
|
|
1
|
-
import { computed as
|
|
2
|
-
import { useStore as
|
|
3
|
-
import { getNode as
|
|
4
|
-
import { onClickOutside as
|
|
5
|
-
import
|
|
6
|
-
import { useRuntimeEnv as
|
|
7
|
-
import { useI18n as
|
|
8
|
-
import { FormKit as
|
|
1
|
+
import { computed as u, ref as y, watch as E, onMounted as Z, nextTick as N, openBlock as a, createElementBlock as d, createElementVNode as V, toDisplayString as w, createTextVNode as x, withDirectives as O, createVNode as $, unref as T, vShow as U, Fragment as j, renderList as A, createCommentVNode as M } from "vue";
|
|
2
|
+
import { useStore as g } from "vuex";
|
|
3
|
+
import { getNode as I } from "@formkit/core";
|
|
4
|
+
import { onClickOutside as ee, useAsyncState as te } from "../../external/@vueuse/core/index";
|
|
5
|
+
import se from "axios";
|
|
6
|
+
import { useRuntimeEnv as le } from "../../composables/useRuntimeEnv.mjs";
|
|
7
|
+
import { useI18n as oe } from "vue-i18n";
|
|
8
|
+
import { FormKit as q } from "@formkit/vue";
|
|
9
9
|
import { useDpiContext as re } from "../composables/useDpiContext.mjs";
|
|
10
10
|
import "./SimpleSelect.vue2.mjs";
|
|
11
|
-
const
|
|
11
|
+
const ne = { class: "formkitProperty" }, ie = { class: "position-relative formkitCmpWrap" }, ue = { key: 0 }, ae = ["onClick"], de = ["onClick"], he = {
|
|
12
12
|
__name: "SimpleSelect",
|
|
13
13
|
props: {
|
|
14
14
|
context: Object
|
|
15
15
|
},
|
|
16
|
-
setup(
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
l.id ? (
|
|
21
|
-
}, { execute:
|
|
22
|
-
_
|
|
23
|
-
console.error(
|
|
16
|
+
setup(B) {
|
|
17
|
+
const m = B, L = re(), { locale: K, fallbackLocale: Q } = oe({ useScope: "global" }), S = u(() => P.getters["auth/getUserCatalogIds"]), v = y(!1), P = g(), R = y(null), W = le(), C = y(""), b = y(""), D = y(!1);
|
|
18
|
+
ee(R, (l) => v.value = !1);
|
|
19
|
+
const k = async (l) => {
|
|
20
|
+
l.id ? (b.value = l.id, C.value = (l == null ? void 0 : l.name) || l.id) : (b.value = l, C.value = l), v.value = !1;
|
|
21
|
+
}, { execute: G, state: n, isReady: F, error: _ } = te(async () => await se.get(W.api.baseUrl + "search?filter=catalogue&limit=1000"), { data: { result: { results: [] } } }, { immediate: !1 }), H = u(() => D.value && !!n.value && F.value);
|
|
22
|
+
E(_, () => {
|
|
23
|
+
console.error(_.value);
|
|
24
24
|
});
|
|
25
|
-
const
|
|
26
|
-
var l, e, s,
|
|
27
|
-
return ((
|
|
28
|
-
}),
|
|
29
|
-
var l, e, s,
|
|
30
|
-
return
|
|
31
|
-
}),
|
|
32
|
-
var
|
|
33
|
-
return !
|
|
34
|
-
var
|
|
35
|
-
return (
|
|
25
|
+
const z = u(() => {
|
|
26
|
+
var l, e, s, o;
|
|
27
|
+
return ((o = (s = (e = (l = n == null ? void 0 : n.value) == null ? void 0 : l.data) == null ? void 0 : e.result) == null ? void 0 : s.results) == null ? void 0 : o.length) > 0;
|
|
28
|
+
}), J = u(() => {
|
|
29
|
+
var l, e, s, o;
|
|
30
|
+
return z && ((o = (s = (e = (l = n == null ? void 0 : n.value) == null ? void 0 : l.data) == null ? void 0 : e.result) == null ? void 0 : s.results) == null ? void 0 : o.length) === 1;
|
|
31
|
+
}), h = u(() => {
|
|
32
|
+
var o, p, f;
|
|
33
|
+
return !z.value || !F.value ? [] : (((f = (p = (o = n.value) == null ? void 0 : o.data) == null ? void 0 : p.result) == null ? void 0 : f.results) || []).filter((t) => {
|
|
34
|
+
var r;
|
|
35
|
+
return (r = S.value) == null ? void 0 : r.includes(t.id);
|
|
36
36
|
}).map((t) => {
|
|
37
|
-
var
|
|
38
|
-
const
|
|
39
|
-
let
|
|
40
|
-
return t != null && t.title ? typeof (t == null ? void 0 : t.title) == "string" ?
|
|
37
|
+
var c;
|
|
38
|
+
const r = (t == null ? void 0 : t.id) || "";
|
|
39
|
+
let i = "";
|
|
40
|
+
return t != null && t.title ? typeof (t == null ? void 0 : t.title) == "string" ? i = t == null ? void 0 : t.title : typeof (t == null ? void 0 : t.title) == "object" && (i = (t == null ? void 0 : t.title[K.value]) || (t == null ? void 0 : t.title[Q.value]) || ((c = Object.values(t == null ? void 0 : t.title)) == null ? void 0 : c[0]) || r) : i = r, { id: r, name: i || r };
|
|
41
41
|
});
|
|
42
42
|
});
|
|
43
|
-
|
|
43
|
+
E(J, (l) => {
|
|
44
44
|
if (l) {
|
|
45
|
-
const e =
|
|
46
|
-
|
|
45
|
+
const e = n.value.data.result.results[0];
|
|
46
|
+
k({ id: e.id, name: e.name });
|
|
47
47
|
}
|
|
48
|
-
}, { immediate: !0 }),
|
|
49
|
-
var s, r,
|
|
50
|
-
await
|
|
51
|
-
const l = ((
|
|
52
|
-
e &&
|
|
48
|
+
}, { immediate: !0 }), Z(async () => {
|
|
49
|
+
var s, o, p, f, t, r, i, c;
|
|
50
|
+
await G(), await N();
|
|
51
|
+
const l = ((s = L.value.edit) == null ? void 0 : s.catalog) || ((p = (o = I) == null ? void 0 : o("catalog")) == null ? void 0 : p.value) || ((t = (f = I) == null ? void 0 : f("dcat:catalog")) == null ? void 0 : t.value) || ((i = (r = I) == null ? void 0 : r("dct:catalog")) == null ? void 0 : i.value) || void 0, e = (c = h.value) == null ? void 0 : c.find((Y) => Y.id === l);
|
|
52
|
+
e && k({ id: e.id, name: e.name }), await N(), D.value = !0;
|
|
53
53
|
});
|
|
54
|
-
const
|
|
54
|
+
const X = u(() => {
|
|
55
55
|
var s;
|
|
56
|
-
const l = (s =
|
|
56
|
+
const l = (s = L.value.edit) == null ? void 0 : s.enabled, e = localStorage == null ? void 0 : localStorage.getItem("dpi_duplicate");
|
|
57
57
|
return l && !e;
|
|
58
58
|
});
|
|
59
|
-
return (l, e) => (
|
|
60
|
-
|
|
61
|
-
e[6] || (e[6] =
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
modelValue:
|
|
66
|
-
"onUpdate:modelValue": e[0] || (e[0] = (s) =>
|
|
67
|
-
name: `${
|
|
59
|
+
return (l, e) => (a(), d("div", ne, [
|
|
60
|
+
V("h4", null, w(m.context.label), 1),
|
|
61
|
+
e[6] || (e[6] = x()),
|
|
62
|
+
V("div", ie, [
|
|
63
|
+
H.value ? (a(), d("div", ue, [
|
|
64
|
+
O($(T(q), {
|
|
65
|
+
modelValue: b.value,
|
|
66
|
+
"onUpdate:modelValue": e[0] || (e[0] = (s) => b.value = s),
|
|
67
|
+
name: `${m.context.node.name}`,
|
|
68
68
|
type: "text"
|
|
69
69
|
}, null, 8, ["modelValue", "name"]), [
|
|
70
|
-
[
|
|
70
|
+
[U, !1]
|
|
71
71
|
]),
|
|
72
|
-
e[4] || (e[4] =
|
|
73
|
-
|
|
72
|
+
e[4] || (e[4] = x()),
|
|
73
|
+
$(T(q), {
|
|
74
74
|
class: "autocompleteInputfield",
|
|
75
|
-
modelValue:
|
|
76
|
-
"onUpdate:modelValue": e[1] || (e[1] = (s) =>
|
|
77
|
-
placeholder:
|
|
75
|
+
modelValue: C.value,
|
|
76
|
+
"onUpdate:modelValue": e[1] || (e[1] = (s) => C.value = s),
|
|
77
|
+
placeholder: m.context.attrs.placeholder,
|
|
78
78
|
type: "text",
|
|
79
79
|
validation: "required",
|
|
80
80
|
mandatory: "true",
|
|
81
81
|
"validation-messages": {
|
|
82
|
-
required:
|
|
82
|
+
required: m.context.attrs.placeholder
|
|
83
83
|
},
|
|
84
|
-
name: `${
|
|
85
|
-
disabled:
|
|
86
|
-
onClick: e[2] || (e[2] = (s) =>
|
|
84
|
+
name: `${m.context.node.name}__displayedValue`,
|
|
85
|
+
disabled: X.value,
|
|
86
|
+
onClick: e[2] || (e[2] = (s) => v.value = !v.value)
|
|
87
87
|
}, null, 8, ["modelValue", "placeholder", "validation-messages", "name", "disabled"]),
|
|
88
|
-
e[5] || (e[5] =
|
|
89
|
-
|
|
88
|
+
e[5] || (e[5] = x()),
|
|
89
|
+
O(V("ul", {
|
|
90
90
|
ref_key: "dropdownList",
|
|
91
|
-
ref:
|
|
91
|
+
ref: R,
|
|
92
92
|
class: "autocompleteResultList selectListFK catSelectList"
|
|
93
93
|
}, [
|
|
94
|
-
(
|
|
94
|
+
(a(!0), d(j, null, A(h.value, (s) => (a(), d("li", {
|
|
95
95
|
key: s,
|
|
96
|
-
onClick: (
|
|
96
|
+
onClick: (o) => k(s),
|
|
97
97
|
class: "p-2 border-b border-gray-200 data-[selected=true]:bg-blue-100 choosableItemsAC"
|
|
98
|
-
},
|
|
99
|
-
e[3] || (e[3] =
|
|
100
|
-
|
|
98
|
+
}, w(s.name), 9, ae))), 128)),
|
|
99
|
+
e[3] || (e[3] = x()),
|
|
100
|
+
h.value.length === 0 ? (a(!0), d(j, { key: 0 }, A(S.value, (s) => (a(), d("li", {
|
|
101
101
|
key: s,
|
|
102
|
-
onClick: (
|
|
102
|
+
onClick: (o) => k(s),
|
|
103
103
|
class: "p-2 border-b border-gray-200 data-[selected=true]:bg-blue-100 choosableItemsAC"
|
|
104
|
-
},
|
|
104
|
+
}, w(s), 9, de))), 128)) : M("", !0)
|
|
105
105
|
], 512), [
|
|
106
|
-
[
|
|
106
|
+
[U, v.value]
|
|
107
107
|
])
|
|
108
|
-
])) :
|
|
108
|
+
])) : M("", !0)
|
|
109
109
|
])
|
|
110
110
|
]));
|
|
111
111
|
}
|
|
112
112
|
};
|
|
113
113
|
export {
|
|
114
|
-
|
|
114
|
+
he as default
|
|
115
115
|
};
|
|
116
116
|
//# 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 <div v-if=\"isReady\">\n\n <!-- Hidden input that contains the actual catalog id. We rely on that to pass the catalog id to backend later -->\n <FormKit v-show=\"false\" v-model=\"selectedCatalogId\" :name=\"`${props.context.node.name}`\" type=\"text\" />\n\n <!-- User-facing input that displays the name of the selected catalog -->\n <FormKit\n class=\"autocompleteInputfield\"\n v-model=\"selectedCatalogTitle\"\n :placeholder=\"props.context.attrs.placeholder\"\n type=\"text\" \n validation=\"required\"\n mandatory=\"true\"\n :validation-messages=\"{\n required: props.context.attrs.placeholder,\n }\" :name=\"`${props.context.node.name}__displayedValue`\"\n :disabled=\"isDisabled\"\n @click=\"showList = !showList\"\n />\n <ul ref=\"dropdownList\" v-show=\"showList\" class=\"autocompleteResultList selectListFK catSelectList\">\n <li v-for=\"match in authorizedCatalogs\" :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=\"authorizedCatalogs.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 </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 { useI18n } from 'vue-i18n';\nimport { useAsyncState } from '@vueuse/core';\nimport { FormKit } from '@formkit/vue';\nimport { useDpiContext } from '../composables/useDpiContext';\n\nconst props = defineProps({\n context: Object\n})\n\nconst dpiContext = useDpiContext()\nconst { locale, fallbackLocale } = useI18n({ useScope: 'global' })\n\nconst userCats = computed(() => store.getters['auth/getUserCatalogIds']);\nconst showList = ref(false)\nconst store = useStore()\nconst dropdownList = ref(null)\nconst env = useRuntimeEnv()\nconst selectedCatalogTitle = ref('')\nconst selectedCatalogId = ref('')\nconst hasMounted = ref(false)\n\nonClickOutside(dropdownList, event => showList.value = false)\n\nconst setvalue = async (e) => {\n if (e.id) {\n selectedCatalogId.value = e.id\n selectedCatalogTitle.value = e?.name || e.id\n } else {\n selectedCatalogId.value = e\n selectedCatalogTitle.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\n// Wait until everything mounted and loaded tu ensure that the catalog list is available and selected catalog from edit mode is available\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\n/**\n * Computes list of users' authorized catalogs in { id: string; name: string } format\n */\nconst authorizedCatalogs = computed(() => {\n if (!hasResults.value || !isQueryReady.value) return []\n\n const allCatalogs = catalogListData.value?.data?.result?.results || []\n const authorizedCatalogs = allCatalogs.filter(catalog => userCats.value?.includes(catalog.id))\n\n // map to { id: string; name: string } pairs\n const authorizedCatalogsDataModel = authorizedCatalogs.map((catalog) => {\n const id = catalog?.id || ''\n let title = ''\n\n if (!catalog?.title) title = id\n else if (typeof catalog?.title === 'string') title = catalog?.title\n else if (typeof catalog?.title === 'object') title =\n catalog?.title[locale.value]\n || catalog?.title[fallbackLocale.value]\n || Object.values(catalog?.title)?.[0]\n || id\n\n return { id, name: title || id }\n });\n return authorizedCatalogsDataModel\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 // When editing, we can restore the selected catalog id immediately, but we rely on fetching from hub-search for its catalog title.\n // So we need to wait until everything is fetched before proceeding further.\n await filterCatList()\n await nextTick()\n // todo: can this be made more robust by using dpiContext.value.edit?.id?\n const catalogIdToLoadForEdit = getNode?.('dcat:catalog')?.value || undefined\n const maybeFoundCatalogFromQuery = authorizedCatalogs.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// Disable select option if in edit mode\n// Note: Decision is made due to a backend limitation that causes dataset duplicates to occur when changing a catalog\nconst isDisabled = computed(() => {\n const isInEditMode = dpiContext.value.edit?.enabled\n\n // If duplicate, do not disable select option so that they can duplicate datasets into different catalogs\n // todo: code debt due to code replication; usage of localStorage kind of weird here -> see DraftsPage for more on this.\n // We use localStorage to track if the intent is to duplicate or not\n const isDuplicate = localStorage?.getItem('dpi_duplicate')\n\n return isInEditMode && !isDuplicate\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>\n"],"names":["props","__props","dpiContext","useDpiContext","locale","fallbackLocale","useI18n","userCats","computed","store","showList","ref","useStore","dropdownList","env","useRuntimeEnv","selectedCatalogTitle","selectedCatalogId","hasMounted","onClickOutside","event","setvalue","e","filterCatList","catalogListData","isQueryReady","error","useAsyncState","axios","isReady","watch","hasResults","_d","_c","_b","_a","hasOneResultOnly","authorizedCatalogs","catalog","id","title","yes","result","onMounted","nextTick","catalogIdToLoadForEdit","getNode","maybeFoundCatalogFromQuery","item","isDisabled","isInEditMode","isDuplicate"],"mappings":";;;;;;;;;;;;;;;;AAmDA,UAAMA,IAAQC,GAIRC,IAAaC,GAAc,GAC3B,EAAE,QAAAC,GAAQ,gBAAAC,EAAgB,IAAGC,GAAQ,EAAE,UAAU,UAAU,GAE3DC,IAAWC,EAAS,MAAMC,EAAM,QAAQ,wBAAwB,CAAC,GACjEC,IAAWC,EAAI,EAAK,GACpBF,IAAQG,EAAS,GACjBC,IAAeF,EAAI,IAAI,GACvBG,IAAMC,GAAc,GACpBC,IAAuBL,EAAI,EAAE,GAC7BM,IAAoBN,EAAI,EAAE,GAC1BO,IAAaP,EAAI,EAAK;AAE5B,IAAAQ,EAAeN,GAAc,CAAAO,MAASV,EAAS,QAAQ,EAAK;AAE5D,UAAMW,IAAW,OAAOC,MAAM;AA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AAAjC,EAAW,MAAM,SAAjB,gBAAAiC,EAAuB,SAKtCgB,IAAc,6CAAc,QAAQ;AAE1C,aAAOD,KAAgB,CAACC;AAAA,IAC1B,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 class=\"position-relative formkitCmpWrap\">\n\n <div v-if=\"isReady\">\n\n <!-- Hidden input that contains the actual catalog id. We rely on that to pass the catalog id to backend later -->\n <FormKit v-show=\"false\" v-model=\"selectedCatalogId\" :name=\"`${props.context.node.name}`\" type=\"text\" />\n\n <!-- User-facing input that displays the name of the selected catalog -->\n <FormKit\n class=\"autocompleteInputfield\"\n v-model=\"selectedCatalogTitle\"\n :placeholder=\"props.context.attrs.placeholder\"\n type=\"text\" \n validation=\"required\"\n mandatory=\"true\"\n :validation-messages=\"{\n required: props.context.attrs.placeholder,\n }\" :name=\"`${props.context.node.name}__displayedValue`\"\n :disabled=\"isDisabled\"\n @click=\"showList = !showList\"\n />\n <ul ref=\"dropdownList\" v-show=\"showList\" class=\"autocompleteResultList selectListFK catSelectList\">\n <li v-for=\"match in authorizedCatalogs\" :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=\"authorizedCatalogs.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 </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 { useI18n } from 'vue-i18n';\nimport { useAsyncState } from '@vueuse/core';\nimport { FormKit } from '@formkit/vue';\nimport { useDpiContext } from '../composables/useDpiContext';\n\nconst props = defineProps({\n context: Object\n})\n\nconst dpiContext = useDpiContext()\nconst { locale, fallbackLocale } = useI18n({ useScope: 'global' })\n\nconst userCats = computed(() => store.getters['auth/getUserCatalogIds']);\nconst showList = ref(false)\nconst store = useStore()\nconst dropdownList = ref(null)\nconst env = useRuntimeEnv()\nconst selectedCatalogTitle = ref('')\nconst selectedCatalogId = ref('')\nconst hasMounted = ref(false)\n\nonClickOutside(dropdownList, event => showList.value = false)\n\nconst setvalue = async (e) => {\n if (e.id) {\n selectedCatalogId.value = e.id\n selectedCatalogTitle.value = e?.name || e.id\n } else {\n selectedCatalogId.value = e\n selectedCatalogTitle.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\n// Wait until everything mounted and loaded tu ensure that the catalog list is available and selected catalog from edit mode is available\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\n/**\n * Computes list of users' authorized catalogs in { id: string; name: string } format\n */\nconst authorizedCatalogs = computed(() => {\n if (!hasResults.value || !isQueryReady.value) return []\n\n const allCatalogs = catalogListData.value?.data?.result?.results || []\n const authorizedCatalogs = allCatalogs.filter(catalog => userCats.value?.includes(catalog.id))\n\n // map to { id: string; name: string } pairs\n const authorizedCatalogsDataModel = authorizedCatalogs.map((catalog) => {\n const id = catalog?.id || ''\n let title = ''\n\n if (!catalog?.title) title = id\n else if (typeof catalog?.title === 'string') title = catalog?.title\n else if (typeof catalog?.title === 'object') title =\n catalog?.title[locale.value]\n || catalog?.title[fallbackLocale.value]\n || Object.values(catalog?.title)?.[0]\n || id\n\n return { id, name: title || id }\n });\n return authorizedCatalogsDataModel\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 // When editing, we can restore the selected catalog id immediately, but we rely on fetching from hub-search for its catalog title.\n // So we need to wait until everything is fetched before proceeding further.\n await filterCatList()\n await nextTick()\n const catalogIdToLoadForEdit =\n dpiContext.value.edit?.catalog\n || getNode?.('catalog')?.value\n || getNode?.('dcat:catalog')?.value\n || getNode?.('dct:catalog')?.value\n || undefined\n const maybeFoundCatalogFromQuery = authorizedCatalogs.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// Disable select option if in edit mode\n// Note: Decision is made due to a backend limitation that causes dataset duplicates to occur when changing a catalog\nconst isDisabled = computed(() => {\n const isInEditMode = dpiContext.value.edit?.enabled\n\n // If duplicate, do not disable select option so that they can duplicate datasets into different catalogs\n // todo: code debt due to code replication; usage of localStorage kind of weird here -> see DraftsPage for more on this.\n // We use localStorage to track if the intent is to duplicate or not\n const isDuplicate = localStorage?.getItem('dpi_duplicate')\n\n return isInEditMode && !isDuplicate\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>\n"],"names":["props","__props","dpiContext","useDpiContext","locale","fallbackLocale","useI18n","userCats","computed","store","showList","ref","useStore","dropdownList","env","useRuntimeEnv","selectedCatalogTitle","selectedCatalogId","hasMounted","onClickOutside","event","setvalue","e","filterCatList","catalogListData","isQueryReady","error","useAsyncState","axios","isReady","watch","hasResults","_d","_c","_b","_a","hasOneResultOnly","authorizedCatalogs","catalog","id","title","yes","result","onMounted","nextTick","catalogIdToLoadForEdit","getNode","_e","_g","_f","maybeFoundCatalogFromQuery","_h","item","isDisabled","isInEditMode","isDuplicate"],"mappings":";;;;;;;;;;;;;;;;AAmDA,UAAMA,IAAQC,GAIRC,IAAaC,GAAc,GAC3B,EAAE,QAAAC,GAAQ,gBAAAC,EAAgB,IAAGC,GAAQ,EAAE,UAAU,UAAU,GAE3DC,IAAWC,EAAS,MAAMC,EAAM,QAAQ,wBAAwB,CAAC,GACjEC,IAAWC,EAAI,EAAK,GACpBF,IAAQG,EAAS,GACjBC,IAAeF,EAAI,IAAI,GACvBG,IAAMC,GAAc,GACpBC,IAAuBL,EAAI,EAAE,GAC7BM,IAAoBN,EAAI,EAAE,GAC1BO,IAAaP,EAAI,EAAK;AAE5B,IAAAQ,GAAeN,GAAc,CAAAO,MAASV,EAAS,QAAQ,EAAK;AAE5D,UAAMW,IAAW,OAAOC,MAAM;AAC5B,MAAIA,EAAE,MACJL,EAAkB,QAAQK,EAAE,IAC5BN,EAAqB,SAAQM,KAAA,gBAAAA,EAAG,SAAQA,EAAE,OAE1CL,EAAkB,QAAQK,GAC1BN,EAAqB,QAAQM,IAG/BZ,EAAS,QAAQ;AAAA,IACnB,GAEM,EAAE,SAASa,GAAe,OAAOC,GAAiB,SAASC,GAAc,OAAAC,MAAUC,GAAc,YAC7E,MAAMC,GAAM,IAAId,EAAI,IAAI,UAAU,oCAAoC,GAE7F,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,GAAI,EAAA,KAAM,EAAE,WAAW,IAAO,GAGxDe,IAAUrB,EAAS,MAAMU,EAAW,SAAS,CAAC,CAACM,EAAgB,SAASC,EAAa,KA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"],"sourcesContent":["import { FormKitLibrary } from \"@formkit/core\"\nimport { computed, ComputedRef, getCurrentInstance, inject, InjectionKey, MaybeRefOrGetter, provide, toValue } from \"vue\"\n\nexport interface DpiSpecification {\n pageConent?: object\n inputDefinition: object\n prefixes: object\n formatTypes: object\n vocabPrefixes: object\n}\n\nexport interface DpiContext {\n specification: DpiSpecification\n specificationName: string\n edit?: {\n enabled?: boolean\n id?: string\n fromDraft?: boolean\n }\n}\n\nexport type ComputedDpiContext = ComputedRef<DpiContext>\n\nexport const dpiContextKey: InjectionKey<ComputedDpiContext> = Symbol('dpiContext')\n\nexport function useDpiContext(): ComputedDpiContext {\n const dpiContext = inject(dpiContextKey)\n\n if (!dpiContext) {\n throw new Error('[useDpiContext] DPI Context not found. Did you forget to inject it?')\n }\n\n return dpiContext\n}\n\nexport function setupDpiContext(context: MaybeRefOrGetter<DpiContext>) {\n provide(dpiContextKey, computed(() => toValue(context)))\n}"],"names":["dpiContextKey","useDpiContext","dpiContext","inject","setupDpiContext","context","provide","computed","toValue"],"mappings":";
|
|
1
|
+
{"version":3,"file":"useDpiContext.mjs","sources":["../../../lib/data-provider-interface/composables/useDpiContext.ts"],"sourcesContent":["import { FormKitLibrary } from \"@formkit/core\"\nimport { computed, ComputedRef, getCurrentInstance, inject, InjectionKey, MaybeRefOrGetter, provide, toValue } from \"vue\"\n\nexport interface DpiSpecification {\n pageConent?: object\n inputDefinition: object\n prefixes: object\n formatTypes: object\n vocabPrefixes: object\n}\n\nexport interface DpiContext {\n specification: DpiSpecification\n specificationName: string\n edit?: {\n enabled?: boolean\n catalog?: string\n id?: string\n fromDraft?: boolean\n }\n}\n\nexport type ComputedDpiContext = ComputedRef<DpiContext>\n\nexport const dpiContextKey: InjectionKey<ComputedDpiContext> = Symbol('dpiContext')\n\nexport function useDpiContext(): ComputedDpiContext {\n const dpiContext = inject(dpiContextKey)\n\n if (!dpiContext) {\n throw new Error('[useDpiContext] DPI Context not found. Did you forget to inject it?')\n }\n\n return dpiContext\n}\n\nexport function setupDpiContext(context: MaybeRefOrGetter<DpiContext>) {\n provide(dpiContextKey, computed(() => toValue(context)))\n}"],"names":["dpiContextKey","useDpiContext","dpiContext","inject","setupDpiContext","context","provide","computed","toValue"],"mappings":";AAwBa,MAAAA,IAAkD,OAAO,YAAY;AAE3E,SAASC,IAAoC;AAC5C,QAAAC,IAAaC,EAAOH,CAAa;AAEvC,MAAI,CAACE;AACG,UAAA,IAAI,MAAM,qEAAqE;AAGhF,SAAAA;AACT;AAEO,SAASE,EAAgBC,GAAuC;AACrE,EAAAC,EAAQN,GAAeO,EAAS,MAAMC,EAAQH,CAAO,CAAC,CAAC;AACzD;"}
|
|
@@ -1220,8 +1220,9 @@ const t = {
|
|
|
1220
1220
|
catalog: {
|
|
1221
1221
|
identifier: "catalog",
|
|
1222
1222
|
$formkit: "simpleSelect",
|
|
1223
|
-
|
|
1224
|
-
|
|
1223
|
+
// Intentionally not setting something like dcat:catalog here
|
|
1224
|
+
// Because we don't neeed catalog to be part of the payload
|
|
1225
|
+
name: "catalog",
|
|
1225
1226
|
class: "property mandatory",
|
|
1226
1227
|
options: {},
|
|
1227
1228
|
classes: { outer: "formkitProperty formkitCmpWrap mx-0 my-3 p-3" }
|