@piveau/piveau-hub-ui-modules 4.0.25 → 4.0.26
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/configurations/configureModules.mjs +3 -3
- package/dist/configurations/configureModules.mjs.map +1 -1
- package/dist/data-provider-interface/components/FileUpload.vue.mjs +43 -41
- package/dist/data-provider-interface/components/FileUpload.vue.mjs.map +1 -1
- package/dist/data-provider-interface/utils/general-helper.mjs +63 -62
- package/dist/data-provider-interface/utils/general-helper.mjs.map +1 -1
- package/dist/data-provider-interface/utils/translation-helper.mjs +12 -12
- package/dist/data-provider-interface/utils/translation-helper.mjs.map +1 -1
- package/dist/piveau-hub-ui-modules.css +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { configureServices as i } from "./configureServices.mjs";
|
|
2
2
|
import { configureComponents as m } from "./configureComponents.mjs";
|
|
3
|
-
function
|
|
4
|
-
o && (i(r, o.serviceParams), m(e, o.components));
|
|
3
|
+
function f(e, r, o) {
|
|
4
|
+
r.$app = e, o && (i(r, o.serviceParams), m(e, o.components));
|
|
5
5
|
}
|
|
6
6
|
export {
|
|
7
|
-
|
|
7
|
+
f as configureModules
|
|
8
8
|
};
|
|
9
9
|
//# sourceMappingURL=configureModules.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configureModules.mjs","sources":["../../lib/configurations/configureModules.ts"],"sourcesContent":["import { configureServices } from \"./configureServices\";\nimport { ComponentMap, configureComponents } from \"./configureComponents\";\n\ntype ModulesConfig = {\n components: ComponentMap,\n serviceParams: {[key: string]: unknown},\n};\n\nexport function configureModules(app: any, store: any, config?: ModulesConfig) {\n if (config) {\n configureServices(store, config.serviceParams);\n configureComponents(app, config.components);\n }\n}"],"names":["configureModules","app","store","config","configureServices","configureComponents"],"mappings":";;AAQgB,SAAAA,EAAiBC,GAAUC,GAAYC,GAAwB;AAC7E,
|
|
1
|
+
{"version":3,"file":"configureModules.mjs","sources":["../../lib/configurations/configureModules.ts"],"sourcesContent":["import { configureServices } from \"./configureServices\";\nimport { ComponentMap, configureComponents } from \"./configureComponents\";\n\ntype ModulesConfig = {\n components: ComponentMap,\n serviceParams: {[key: string]: unknown},\n};\n\nexport function configureModules(app: any, store: any, config?: ModulesConfig) {\n store.$app = app;\n if (config) {\n configureServices(store, config.serviceParams);\n configureComponents(app, config.components);\n }\n}\n"],"names":["configureModules","app","store","config","configureServices","configureComponents"],"mappings":";;AAQgB,SAAAA,EAAiBC,GAAUC,GAAYC,GAAwB;AAC7E,EAAAD,EAAM,OAAOD,GACTE,MACgBC,EAAAF,GAAOC,EAAO,aAAa,GACzBE,EAAAJ,GAAKE,EAAO,UAAU;AAE9C;"}
|
|
@@ -2,7 +2,7 @@ import { mapGetters as y, mapActions as E } from "vuex";
|
|
|
2
2
|
import S from "axios";
|
|
3
3
|
import O from "../utils/general-helper.mjs";
|
|
4
4
|
import { getNode as V } from "@formkit/core";
|
|
5
|
-
import { reactive as A, ref as C, openBlock as d, createElementBlock as c, Fragment as L, createElementVNode as
|
|
5
|
+
import { reactive as A, ref as C, openBlock as d, createElementBlock as c, Fragment as L, createElementVNode as s, createTextVNode as a, createCommentVNode as u, withDirectives as _, vModelText as w, mergeProps as T, toDisplayString as U, renderList as D, pushScopeId as P, popScopeId as G } from "vue";
|
|
6
6
|
import { onClickOutside as k } from "../../external/@vueuse/core/index";
|
|
7
7
|
import { useRuntimeEnv as q } from "../../composables/useRuntimeEnv.mjs";
|
|
8
8
|
import "./FileUpload.vue2.mjs";
|
|
@@ -83,7 +83,7 @@ const N = {
|
|
|
83
83
|
var n, i, r, l, p, f, g;
|
|
84
84
|
const e = ((r = (i = (n = this.$env) == null ? void 0 : n.content) == null ? void 0 : i.dataProviderInterface) == null ? void 0 : r.enableFileUploadReplace) || !1, o = ((l = this.$route.query) == null ? void 0 : l.edit) ?? !1;
|
|
85
85
|
if (e && o) {
|
|
86
|
-
const
|
|
86
|
+
const b = (p = this.$route.query) == null ? void 0 : p.edit, I = this.findDistributionAccessUrlIndex(), m = (f = this.getData("distributions")) == null ? void 0 : f[b], v = (g = m == null ? void 0 : m["dcat:accessURL"]) == null ? void 0 : g[I], x = v == null ? void 0 : v["@id"];
|
|
87
87
|
if (x) {
|
|
88
88
|
const R = this.$env.api.fileUploadUrl, F = O.getFileIdByAccessUrl({ accessUrl: x, fileUploadUrl: R });
|
|
89
89
|
return await this.uploadFile(t, {
|
|
@@ -141,17 +141,17 @@ const N = {
|
|
|
141
141
|
triggerDropdown: o
|
|
142
142
|
};
|
|
143
143
|
}
|
|
144
|
-
}, h = (t) => (P("data-v-
|
|
144
|
+
}, h = (t) => (P("data-v-cc0a83a3"), t = t(), G(), t), H = { class: "position-relative w-100 p-3" }, M = {
|
|
145
145
|
key: 0,
|
|
146
146
|
ref: "fLoad",
|
|
147
147
|
class: "selectListUpload"
|
|
148
148
|
}, W = {
|
|
149
149
|
key: 0,
|
|
150
150
|
class: "w-100 p-3 position-relative"
|
|
151
|
-
}, j = /* @__PURE__ */ h(() => /* @__PURE__ */
|
|
151
|
+
}, j = /* @__PURE__ */ h(() => /* @__PURE__ */ s("label", {
|
|
152
152
|
class: "formkit-label w-100",
|
|
153
153
|
for: "aUrlLink"
|
|
154
|
-
}, "Provide an URL", -1)), z = ["data-type"], J = { class: "file-div position-relative" }, K = /* @__PURE__ */ h(() => /* @__PURE__ */
|
|
154
|
+
}, "Provide an URL", -1)), z = ["data-type"], J = { class: "file-div position-relative" }, K = /* @__PURE__ */ h(() => /* @__PURE__ */ s("label", {
|
|
155
155
|
class: "formkit-label",
|
|
156
156
|
for: "aUrlFL"
|
|
157
157
|
}, "Upload a file", -1)), Q = ["accept"], X = {
|
|
@@ -160,9 +160,9 @@ const N = {
|
|
|
160
160
|
}, Y = {
|
|
161
161
|
key: 0,
|
|
162
162
|
class: "lds-ring"
|
|
163
|
-
}, Z = { key: 1 }, $ = /* @__PURE__ */ h(() => /* @__PURE__ */
|
|
163
|
+
}, Z = { key: 1 }, $ = /* @__PURE__ */ h(() => /* @__PURE__ */ s("i", { class: "material-icons d-flex check-icon" }, "check_circle", -1)), ee = [
|
|
164
164
|
$
|
|
165
|
-
], te = { key: 2 }, ie = /* @__PURE__ */ h(() => /* @__PURE__ */
|
|
165
|
+
], te = { key: 2 }, ie = /* @__PURE__ */ h(() => /* @__PURE__ */ s("i", { class: "material-icons d-flex close-icon" }, "error", -1)), le = [
|
|
166
166
|
ie
|
|
167
167
|
], oe = {
|
|
168
168
|
key: 0,
|
|
@@ -173,27 +173,27 @@ const N = {
|
|
|
173
173
|
}, ne = {
|
|
174
174
|
key: 0,
|
|
175
175
|
class: "errorSub my-3 d-flex"
|
|
176
|
-
};
|
|
177
|
-
function
|
|
176
|
+
}, re = { class: "d-flex flex-wrap w-100" };
|
|
177
|
+
function de(t, e, o, n, i, r) {
|
|
178
178
|
return d(), c(L, null, [
|
|
179
|
-
|
|
180
|
-
|
|
179
|
+
s("div", H, [
|
|
180
|
+
s("input", {
|
|
181
181
|
type: "text",
|
|
182
182
|
class: "selectInputField formkit-inner",
|
|
183
183
|
readonly: "readonly",
|
|
184
184
|
onClick: e[0] || (e[0] = (l) => n.triggerDropdown()),
|
|
185
185
|
placeholder: "Choose between fileupload and providing a URL"
|
|
186
186
|
}),
|
|
187
|
-
|
|
187
|
+
a(),
|
|
188
188
|
n.drop.active ? (d(), c("ul", M, [
|
|
189
|
-
|
|
189
|
+
s("li", {
|
|
190
190
|
onClick: e[1] || (e[1] = (l) => {
|
|
191
191
|
n.triggerDropdown(), i.uploadFileSwitch = !0, r.toggleUploadUrl();
|
|
192
192
|
}),
|
|
193
193
|
class: "p-2 border-b border-gray-200 data-[selected=true]:bg-blue-100 choosableItemsAC"
|
|
194
194
|
}, "Upload a file"),
|
|
195
|
-
|
|
196
|
-
|
|
195
|
+
a(),
|
|
196
|
+
s("li", {
|
|
197
197
|
onClick: e[2] || (e[2] = (l) => {
|
|
198
198
|
n.triggerDropdown(), i.uploadURL = !0, r.toggleUploadFileSwitch();
|
|
199
199
|
}),
|
|
@@ -201,11 +201,11 @@ function re(t, e, o, n, i, r) {
|
|
|
201
201
|
}, "Provide an URL")
|
|
202
202
|
], 512)) : u("", !0)
|
|
203
203
|
]),
|
|
204
|
-
|
|
204
|
+
a(),
|
|
205
205
|
i.uploadURL && !i.uploadFileSwitch ? (d(), c("div", W, [
|
|
206
206
|
j,
|
|
207
|
-
|
|
208
|
-
|
|
207
|
+
a(),
|
|
208
|
+
_(s("input", {
|
|
209
209
|
id: "aUrlLink",
|
|
210
210
|
"onUpdate:modelValue": e[3] || (e[3] = (l) => i.URLValue = l),
|
|
211
211
|
class: "selectInputField formkit-inner",
|
|
@@ -215,29 +215,29 @@ function re(t, e, o, n, i, r) {
|
|
|
215
215
|
validation: "alpha_spaces:latin",
|
|
216
216
|
"validation-visibility": "live"
|
|
217
217
|
}, null, 544), [
|
|
218
|
-
[
|
|
218
|
+
[w, i.URLValue]
|
|
219
219
|
])
|
|
220
220
|
])) : u("", !0),
|
|
221
|
-
|
|
221
|
+
a(),
|
|
222
222
|
i.uploadFileSwitch ? (d(), c("div", T({
|
|
223
223
|
key: 1,
|
|
224
224
|
ref: "fileupload",
|
|
225
225
|
class: ["p-3 w-100", `formkit-input-element formkit-input-element--${o.context.type}`],
|
|
226
226
|
"data-type": o.context.type
|
|
227
227
|
}, t.$attrs), [
|
|
228
|
-
|
|
228
|
+
_(s("input", {
|
|
229
229
|
type: "text",
|
|
230
230
|
"onUpdate:modelValue": e[5] || (e[5] = (l) => o.context.model = l),
|
|
231
231
|
onBlur: e[6] || (e[6] = (...l) => o.context.blurHandler && o.context.blurHandler(...l)),
|
|
232
232
|
hidden: ""
|
|
233
233
|
}, null, 544), [
|
|
234
|
-
[
|
|
234
|
+
[w, o.context.model]
|
|
235
235
|
]),
|
|
236
|
-
|
|
237
|
-
|
|
236
|
+
a(),
|
|
237
|
+
s("div", J, [
|
|
238
238
|
K,
|
|
239
|
-
|
|
240
|
-
|
|
239
|
+
a(),
|
|
240
|
+
s("input", {
|
|
241
241
|
class: "mt-3",
|
|
242
242
|
type: "file",
|
|
243
243
|
id: "aUrlFL",
|
|
@@ -245,36 +245,38 @@ function re(t, e, o, n, i, r) {
|
|
|
245
245
|
onChange: e[7] || (e[7] = (l) => r.validateFile(l)),
|
|
246
246
|
accept: i.validExtensions
|
|
247
247
|
}, null, 40, Q),
|
|
248
|
-
|
|
249
|
-
|
|
248
|
+
a(),
|
|
249
|
+
s("div", X, [
|
|
250
250
|
i.isLoading ? (d(), c("div", Y)) : u("", !0),
|
|
251
|
-
|
|
251
|
+
a(),
|
|
252
252
|
i.success ? (d(), c("div", Z, ee)) : u("", !0),
|
|
253
|
-
|
|
253
|
+
a(),
|
|
254
254
|
i.fail ? (d(), c("div", te, le)) : u("", !0)
|
|
255
255
|
])
|
|
256
256
|
]),
|
|
257
|
-
|
|
257
|
+
a(),
|
|
258
258
|
i.success ? (d(), c("p", oe, [
|
|
259
|
-
|
|
260
|
-
|
|
259
|
+
a(U(t.$t("message.metadata.downloadUrl")) + ": ", 1),
|
|
260
|
+
s("a", {
|
|
261
261
|
href: o.context.model
|
|
262
262
|
}, U(o.context.model), 9, se)
|
|
263
263
|
])) : u("", !0),
|
|
264
|
-
|
|
264
|
+
a(),
|
|
265
265
|
i.validExtensions && i.validExtensions.length ? (d(), c("div", ae, [
|
|
266
266
|
i.success ? u("", !0) : (d(), c("p", ne, "Allowed types: ")),
|
|
267
|
-
|
|
268
|
-
(
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
267
|
+
a(),
|
|
268
|
+
s("div", re, [
|
|
269
|
+
(d(!0), c(L, null, D(i.validExtensions, (l) => (d(), c("span", {
|
|
270
|
+
key: l,
|
|
271
|
+
class: "mr-1 mb-1 allowedFTypes"
|
|
272
|
+
}, U(l), 1))), 128))
|
|
273
|
+
])
|
|
272
274
|
])) : u("", !0)
|
|
273
275
|
], 16, z)) : u("", !0)
|
|
274
276
|
], 64);
|
|
275
277
|
}
|
|
276
|
-
const
|
|
278
|
+
const xe = /* @__PURE__ */ B(N, [["render", de], ["__scopeId", "data-v-cc0a83a3"]]);
|
|
277
279
|
export {
|
|
278
|
-
|
|
280
|
+
xe as default
|
|
279
281
|
};
|
|
280
282
|
//# sourceMappingURL=FileUpload.vue.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileUpload.vue.mjs","sources":["../../../lib/data-provider-interface/components/FileUpload.vue"],"sourcesContent":["<template>\n <div class=\"position-relative w-100 p-3 \">\n <input type=\"text\" class=\"selectInputField formkit-inner\" readonly=\"readonly\" @click=\"triggerDropdown()\"\n placeholder=\"Choose between fileupload and providing a URL\">\n <ul ref=\"fLoad\" v-if=\"drop.active\" class=\"selectListUpload\">\n <li @click=\"triggerDropdown(); uploadFileSwitch = true; toggleUploadUrl()\"\n class=\"p-2 border-b border-gray-200 data-[selected=true]:bg-blue-100 choosableItemsAC\">Upload a file</li>\n <li @click=\"triggerDropdown(); uploadURL = true; toggleUploadFileSwitch()\"\n class=\"p-2 border-b border-gray-200 data-[selected=true]:bg-blue-100 choosableItemsAC\">Provide an URL</li>\n </ul>\n </div>\n <div class=\"w-100 p-3 position-relative\" v-if=\"uploadURL && !uploadFileSwitch\">\n <label class=\" formkit-label w-100\" for=\"aUrlLink\">Provide an URL</label>\n <input id=\"aUrlLink\" v-model=\"URLValue\" class=\"selectInputField formkit-inner\" type=\"url\" name=\"@id\"\n @input=\"saveUrl\" validation=\"alpha_spaces:latin\" validation-visibility=\"live\">\n\n </div>\n <div v-if=\"uploadFileSwitch\" ref=\"fileupload\" class=\"p-3 w-100\"\n :class=\"`formkit-input-element formkit-input-element--${context.type}`\" :data-type=\"context.type\" v-bind=\"$attrs\">\n <input type=\"text\" v-model=\"context.model\" @blur=\"context.blurHandler\" hidden />\n <div class=\"file-div position-relative\">\n <label class=\"formkit-label\" for=\"aUrlFL\">Upload a file</label>\n <input class=\"mt-3\" type=\"file\" id=\"aUrlFL\" name=\"fileUpload\" @change=\"validateFile($event)\"\n :accept=\"validExtensions\">\n <div class=\"upload-feedback position-absolute d-flex\" style=\"right: 0\">\n <div v-if=\"isLoading\" class=\"lds-ring\">\n </div>\n <div v-if=\"success\"><i class=\"material-icons d-flex check-icon\">check_circle</i></div>\n <div v-if=\"fail\"><i class=\"material-icons d-flex close-icon\">error</i></div>\n </div>\n </div>\n <p class=\"dURLText my-3\" v-if=\"success\">{{ $t('message.metadata.downloadUrl') }}: <a :href=\"context.model\">{{\n context.model }}</a></p>\n <div v-if=\"validExtensions && validExtensions.length\" class=\"allowedTypesWrapper\">\n <p class=\"errorSub my-3 d-flex \" v-if=\"!success\">Allowed types: </p>\n <span v-for=\"types in validExtensions\" :key=\"types\" class=\"mr-1 mb-1 allowedFTypes \">\n {{ types }}\n </span>\n </div>\n\n\n </div>\n\n</template>\n\n<script>\n/* eslint-disable consistent-return, no-unused-vars */\nimport { mapGetters, mapActions } from 'vuex';\nimport axios from 'axios';\nimport helper from '../utils/general-helper'\nimport { getNode } from '@formkit/core'\n\nimport { reactive, ref, onMounted, computed } from 'vue';\nimport { onClickOutside } from '@vueuse/core'\nimport { getCurrentInstance } from \"vue\";\nimport {useRuntimeEnv} from \"../../composables/useRuntimeEnv.ts\";\n\nexport default {\n props: {\n context: {\n type: Object,\n required: true,\n },\n },\n\n data() {\n return {\n error: '',\n URLValue: '',\n uploadURL: false,\n uploadFileSwitch: false,\n checkifSet: false,\n isLoading: false,\n success: false,\n fail: false,\n validExtensions: this.$env.content.dataProviderInterface.uploadFileTypes?.split(',') || []\n };\n },\n computed: {\n\n ...mapGetters('auth', [\n 'getUserData',\n 'getIsEditMode'\n ]),\n ...mapGetters('dpiStore', [\n 'getData',\n ]),\n getCatalogue() {\n return getNode('dcat:catalog').value;\n }\n },\n methods: {\n ...mapActions('dpiStore', [\n 'saveLocalstorageValues',\n ]),\n toggleUploadUrl() {\n if (this.uploadURL) { this.uploadURL = !this.uploadURL }\n },\n toggleUploadFileSwitch() {\n if (this.uploadFileSwitch) { this.uploadFileSwitch = !this.uploadFileSwitch }\n },\n validateFile(event) {\n const file = event.target.files[0];\n const fileExtension = '.' + file.name.split('.').pop().toLowerCase();\n if (this.validExtensions && this.validExtensions.length) {\n if (!this.validExtensions.includes(fileExtension)) {\n console.log('Wrong filetype');\n } else {\n this.uploadOrReplaceFile({ file: event.target.files[0] })\n }\n } else {\n this.error = \"\"\n this.uploadOrReplaceFile({ file: event.target.files[0] })\n }\n },\n async saveUrl() {\n\n if (this.URLValue.includes('http://') || this.URLValue.includes('https://')) {\n await this.context.node.input({ '@id': this.URLValue })\n }\n else await this.context.node.input({ '@id': 'https://' + this.URLValue })\n\n },\n checkIfPresent() {\n // console.log(this.context.value['@id']);\n if (this.context.value['@id']) {\n // console.log(this.context.value['@id']);\n this.URLValue = this.context.value['@id']\n return true\n }\n else false\n },\n // finds the parent input group of a given element.\n findParentInputGroupOfElement(element) {\n // Start with the given element.\n let currentElement = element;\n\n // Traverse the DOM tree upwards.\n while (currentElement) {\n // If the current element is an input group, return it.\n if (currentElement.classList.contains('formkit-input-group-repeatable')) {\n return currentElement;\n }\n // If not, move to the parent element.\n currentElement = currentElement.parentElement;\n }\n\n // If no input group was found, return null.\n return null;\n },\n // finds the index of the distribution access URL based on the root of this component.\n findDistributionAccessUrlIndex() {\n // todo: find a more stable way to find the index of the distribution access URL.\n // this way uses the DOM tree, which is not stable.\n\n // Start at the root of this component.\n const rootElement = this.$refs.fileupload;\n\n // Find the parent input group of the root element.\n const parentInputGroup = this.findParentInputGroupOfElement(rootElement);\n if (!parentInputGroup) return null;\n\n // Get the parent element of all input groups.\n const parentOfAllInputGroups = parentInputGroup.parentElement;\n const allInputGroupsNodeList = parentOfAllInputGroups.querySelectorAll('.formkit-input-group-repeatable');\n const allInputGroupsArray = Array.from(allInputGroupsNodeList);\n\n // Find the index of the parent input group within the array of all input groups.\n const indexOfParentInputGroup = allInputGroupsArray.indexOf(parentInputGroup);\n\n return indexOfParentInputGroup;\n },\n async uploadOrReplaceFile({ file }) {\n\n const replaceEnabled = this.$env?.content?.dataProviderInterface?.enableFileUploadReplace || false;\n const wantsToReplace = this.$route.query?.edit ?? false;\n\n if (replaceEnabled && wantsToReplace) {\n const distributionIndexToReplace = this.$route.query?.edit;\n const fileIndexToReplace = this.findDistributionAccessUrlIndex();\n\n const targetDistribution = this.getData('distributions')?.[distributionIndexToReplace];\n const targetFile = targetDistribution?.['dcat:accessURL']?.[fileIndexToReplace];\n const accessUrl = targetFile?.['@id'];\n if (accessUrl) {\n const fileUploadUrl = this.$env.api.fileUploadUrl;\n\n const fileId = helper.getFileIdByAccessUrl({ accessUrl, fileUploadUrl })\n\n return await this.uploadFile(file, {\n method: 'PUT',\n url: `${this.$env.api.fileUploadUrl}data/${fileId}?catalog=${this.getCatalogue}`,\n });\n }\n\n }\n\n return await this.uploadFile(file);\n },\n async uploadFile(file, options = {}) {\n\n this.isLoading = true;\n\n const form = new FormData();\n form.append('file', file);\n\n const catalog = this.getCatalogue;\n const token = this.getUserData.rtpToken;\n\n const resolvedOptions = {\n method: 'POST',\n url: `${this.$env.api.fileUploadUrl}data?catalog=${catalog}`,\n ...options,\n };\n\n const requestOptions = {\n method: resolvedOptions.method,\n url: resolvedOptions.url,\n headers: {\n 'Content-Type': 'multipart/form-data',\n Authorization: `Bearer ${token}`,\n },\n data: form,\n };\n\n try {\n\n const result = await axios.request(requestOptions);\n const path = result.data.result.location.substring(result.data.result.location.indexOf('/') + 1);\n this.context.model = `${this.$env.api.fileUploadUrl}${path}`;\n this.isLoading = false;\n this.success = true;\n await this.context.node.input({ '@id': `${this.$env.api.fileUploadUrl}${path}` })\n // this.context.rootEmit('change');\n\n } catch (err) {\n\n this.isLoading = false;\n this.fail = true;\n console.error(err); // eslint-disable-line\n }\n },\n },\n mounted() {\n\n this.$nextTick(function () {\n\n if (this.context.value['@id']) {\n this.uploadURL = true\n this.URLValue = this.context.value['@id']\n return true\n }\n else false\n })\n },\n setup() {\n\n// let instance = getCurrentInstance().appContext.app.config.globalProperties.$env\n const env = useRuntimeEnv();\n\n var drop = reactive({\n active: false,\n })\n\n const fLoad = ref(null);\n\n onClickOutside(fLoad, event => drop.active = false)\n function triggerDropdown(e) {\n drop.active = !drop.active\n }\n\n return {\n drop,\n onClickOutside,\n triggerDropdown,\n };\n }\n};\n</script>\n\n<style lang=\"scss\" scoped>\n// @import '../../../styles/bootstrap_theme';\n// @import '../../../styles/utils/css-animations';\n.dURLText {}\n\n.file-div {\n display: flex;\n align-items: center;\n}\n\n.upload-feedback {\n padding: 10px;\n}\n\n/*** MATERIAL ICONS ***/\n%modal-icon {\n font-size: 20px;\n cursor: default;\n}\n\n.check-icon {\n @extend %modal-icon;\n color: #28a745;\n}\n\n.close-icon {\n @extend %modal-icon;\n color: red;\n}\n\n.lds-ring {\n display: inline-block;\n position: relative;\n width: 30px;\n height: 30px;\n}\n\n.lds-ring div {\n box-sizing: border-box;\n display: block;\n position: absolute;\n right: 0;\n width: 30px;\n height: 30px;\n border: 8px solid lightgray;\n border-radius: 50%;\n animation: lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;\n border-color: lightgray transparent transparent transparent;\n}\n\n.lds-ring div:nth-child(1) {\n animation-delay: -0.45s;\n}\n\n.lds-ring div:nth-child(2) {\n animation-delay: -0.3s;\n}\n\n.lds-ring div:nth-child(3) {\n animation-delay: -0.15s;\n}\n\n.error {\n color: red;\n}\n\n.errorSub {\n color: black;\n}\n\n@keyframes lds-ring {\n 0% {\n transform: rotate(0deg);\n }\n\n 100% {\n transform: rotate(360deg);\n }\n}\n\n.allowedFTypes {\n padding: 0.5rem;\n border-radius: 5px;\n border: 1px solid lightgrey;\n}\n\n.allowedTypesWrapper {\n max-width: 100%;\n display: flex;\n flex-wrap: wrap;\n}\n</style>\n"],"names":["_sfc_main","_a","mapGetters","getNode","mapActions","event","fileExtension","element","currentElement","rootElement","parentInputGroup","allInputGroupsNodeList","file","replaceEnabled","_c","_b","wantsToReplace","_d","distributionIndexToReplace","_e","fileIndexToReplace","targetDistribution","_f","targetFile","_g","accessUrl","fileUploadUrl","fileId","helper","options","form","catalog","token","resolvedOptions","requestOptions","result","axios","path","err","useRuntimeEnv","drop","reactive","fLoad","ref","onClickOutside","triggerDropdown","e","_hoisted_1","_createElementVNode","_hoisted_5","_hoisted_6","_hoisted_8","_hoisted_12","_withScopeId","_hoisted_15","_hoisted_18","_openBlock","_createElementBlock","_Fragment","$setup","_createTextVNode","_hoisted_2","_cache","$event","$data","$options","_createCommentVNode","_hoisted_3","_hoisted_4","args","_mergeProps","$props","_ctx","_vModelText","_hoisted_7","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_13","_hoisted_14","_hoisted_16","_hoisted_17","_toDisplayString","_hoisted_19","_hoisted_20","_renderList","types"],"mappings":";;;;;;;;;AAyDA,MAAKA,IAAU;AAAA,EACb,OAAO;AAAA,IACL,SAAS;AAAA,MACP,MAAM;AAAA,MACN,UAAU;AAAA,IACX;AAAA,EACF;AAAA,EAED,OAAO;;AACL,WAAO;AAAA,MACL,OAAO;AAAA,MACP,UAAU;AAAA,MACV,WAAW;AAAA,MACX,kBAAkB;AAAA,MAClB,YAAY;AAAA,MACZ,WAAW;AAAA,MACX,SAAS;AAAA,MACT,MAAM;AAAA,MACN,mBAAiBC,IAAA,KAAK,KAAK,QAAQ,sBAAsB,oBAAxC,gBAAAA,EAAyD,MAAM,SAAQ,CAAC;AAAA;EAE5F;AAAA,EACD,UAAU;AAAA,IAER,GAAGC,EAAW,QAAQ;AAAA,MACpB;AAAA,MACA;AAAA,IACF,CAAC;AAAA,IACD,GAAGA,EAAW,YAAY;AAAA,MACxB;AAAA,IACF,CAAC;AAAA,IACD,eAAe;AACb,aAAOC,EAAQ,cAAc,EAAE;AAAA,IACjC;AAAA,EACD;AAAA,EACD,SAAS;AAAA,IACP,GAAGC,EAAW,YAAY;AAAA,MACxB;AAAA,IACF,CAAC;AAAA,IACD,kBAAkB;AAChB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CnB,EAAO,UAlCrDE,EAAA,IAAA,EAAA,UAkCMT,EAAoE,KAApE2B,IAAiD,iBAAe;AAAA,QAlCtExB,EAAA;AAAA,SAmCMJ,EAAA,EAAA,GAAAC,EAEOC,GArCb,MAAA2B,EAmC4BrB,EAAe,iBAnC3C,CAmCmBsB,YAAb7B,EAEO,QAAA;AAAA,UAFiC,KAAK6B;AAAA,UAAO,OAAM;AAAA,aACrDA,CAAK,GAAA,CAAA;YApChBpB,EAAA,IAAA,EAAA;AAAA,IAAA,GAAA,IAAAjB,CAAA,KAAAiB,EAAA,IAAA,EAAA;AAAA;;;"}
|
|
1
|
+
{"version":3,"file":"FileUpload.vue.mjs","sources":["../../../lib/data-provider-interface/components/FileUpload.vue"],"sourcesContent":["<template>\n <div class=\"position-relative w-100 p-3 \">\n <input type=\"text\" class=\"selectInputField formkit-inner\" readonly=\"readonly\" @click=\"triggerDropdown()\"\n placeholder=\"Choose between fileupload and providing a URL\">\n <ul ref=\"fLoad\" v-if=\"drop.active\" class=\"selectListUpload\">\n <li @click=\"triggerDropdown(); uploadFileSwitch = true; toggleUploadUrl()\"\n class=\"p-2 border-b border-gray-200 data-[selected=true]:bg-blue-100 choosableItemsAC\">Upload a file</li>\n <li @click=\"triggerDropdown(); uploadURL = true; toggleUploadFileSwitch()\"\n class=\"p-2 border-b border-gray-200 data-[selected=true]:bg-blue-100 choosableItemsAC\">Provide an URL</li>\n </ul>\n </div>\n <div class=\"w-100 p-3 position-relative\" v-if=\"uploadURL && !uploadFileSwitch\">\n <label class=\" formkit-label w-100\" for=\"aUrlLink\">Provide an URL</label>\n <input id=\"aUrlLink\" v-model=\"URLValue\" class=\"selectInputField formkit-inner\" type=\"url\" name=\"@id\"\n @input=\"saveUrl\" validation=\"alpha_spaces:latin\" validation-visibility=\"live\">\n\n </div>\n <div v-if=\"uploadFileSwitch\" ref=\"fileupload\" class=\"p-3 w-100\"\n :class=\"`formkit-input-element formkit-input-element--${context.type}`\" :data-type=\"context.type\" v-bind=\"$attrs\">\n <input type=\"text\" v-model=\"context.model\" @blur=\"context.blurHandler\" hidden />\n <div class=\"file-div position-relative\">\n <label class=\"formkit-label\" for=\"aUrlFL\">Upload a file</label>\n <input class=\"mt-3\" type=\"file\" id=\"aUrlFL\" name=\"fileUpload\" @change=\"validateFile($event)\"\n :accept=\"validExtensions\">\n <div class=\"upload-feedback position-absolute d-flex\" style=\"right: 0\">\n <div v-if=\"isLoading\" class=\"lds-ring\">\n </div>\n <div v-if=\"success\"><i class=\"material-icons d-flex check-icon\">check_circle</i></div>\n <div v-if=\"fail\"><i class=\"material-icons d-flex close-icon\">error</i></div>\n </div>\n </div>\n <p class=\"dURLText my-3\" v-if=\"success\">{{ $t('message.metadata.downloadUrl') }}: <a :href=\"context.model\">{{\n context.model }}</a></p>\n <div v-if=\"validExtensions && validExtensions.length\" class=\"allowedTypesWrapper\">\n <p class=\"errorSub my-3 d-flex \" v-if=\"!success\">Allowed types: </p>\n <div class=\"d-flex flex-wrap w-100\">\n <span v-for=\"types in validExtensions\" :key=\"types\" class=\"mr-1 mb-1 allowedFTypes \">\n {{ types }}\n </span>\n </div>\n\n </div>\n\n\n </div>\n\n</template>\n\n<script>\n/* eslint-disable consistent-return, no-unused-vars */\nimport { mapGetters, mapActions } from 'vuex';\nimport axios from 'axios';\nimport helper from '../utils/general-helper'\nimport { getNode } from '@formkit/core'\n\nimport { reactive, ref, onMounted, computed } from 'vue';\nimport { onClickOutside } from '@vueuse/core'\nimport { getCurrentInstance } from \"vue\";\nimport { useRuntimeEnv } from \"../../composables/useRuntimeEnv.ts\";\n\nexport default {\n props: {\n context: {\n type: Object,\n required: true,\n },\n },\n\n data() {\n return {\n error: '',\n URLValue: '',\n uploadURL: false,\n uploadFileSwitch: false,\n checkifSet: false,\n isLoading: false,\n success: false,\n fail: false,\n validExtensions: this.$env.content.dataProviderInterface.uploadFileTypes?.split(',') || []\n };\n },\n computed: {\n\n ...mapGetters('auth', [\n 'getUserData',\n 'getIsEditMode'\n ]),\n ...mapGetters('dpiStore', [\n 'getData',\n ]),\n getCatalogue() {\n return getNode('dcat:catalog').value;\n }\n },\n methods: {\n ...mapActions('dpiStore', [\n 'saveLocalstorageValues',\n ]),\n toggleUploadUrl() {\n if (this.uploadURL) { this.uploadURL = !this.uploadURL }\n },\n toggleUploadFileSwitch() {\n if (this.uploadFileSwitch) { this.uploadFileSwitch = !this.uploadFileSwitch }\n },\n validateFile(event) {\n const file = event.target.files[0];\n const fileExtension = '.' + file.name.split('.').pop().toLowerCase();\n if (this.validExtensions && this.validExtensions.length) {\n if (!this.validExtensions.includes(fileExtension)) {\n console.log('Wrong filetype');\n } else {\n this.uploadOrReplaceFile({ file: event.target.files[0] })\n }\n } else {\n this.error = \"\"\n this.uploadOrReplaceFile({ file: event.target.files[0] })\n }\n },\n async saveUrl() {\n\n if (this.URLValue.includes('http://') || this.URLValue.includes('https://')) {\n await this.context.node.input({ '@id': this.URLValue })\n }\n else await this.context.node.input({ '@id': 'https://' + this.URLValue })\n\n },\n checkIfPresent() {\n // console.log(this.context.value['@id']);\n if (this.context.value['@id']) {\n // console.log(this.context.value['@id']);\n this.URLValue = this.context.value['@id']\n return true\n }\n else false\n },\n // finds the parent input group of a given element.\n findParentInputGroupOfElement(element) {\n // Start with the given element.\n let currentElement = element;\n\n // Traverse the DOM tree upwards.\n while (currentElement) {\n // If the current element is an input group, return it.\n if (currentElement.classList.contains('formkit-input-group-repeatable')) {\n return currentElement;\n }\n // If not, move to the parent element.\n currentElement = currentElement.parentElement;\n }\n\n // If no input group was found, return null.\n return null;\n },\n // finds the index of the distribution access URL based on the root of this component.\n findDistributionAccessUrlIndex() {\n // todo: find a more stable way to find the index of the distribution access URL.\n // this way uses the DOM tree, which is not stable.\n\n // Start at the root of this component.\n const rootElement = this.$refs.fileupload;\n\n // Find the parent input group of the root element.\n const parentInputGroup = this.findParentInputGroupOfElement(rootElement);\n if (!parentInputGroup) return null;\n\n // Get the parent element of all input groups.\n const parentOfAllInputGroups = parentInputGroup.parentElement;\n const allInputGroupsNodeList = parentOfAllInputGroups.querySelectorAll('.formkit-input-group-repeatable');\n const allInputGroupsArray = Array.from(allInputGroupsNodeList);\n\n // Find the index of the parent input group within the array of all input groups.\n const indexOfParentInputGroup = allInputGroupsArray.indexOf(parentInputGroup);\n\n return indexOfParentInputGroup;\n },\n async uploadOrReplaceFile({ file }) {\n\n const replaceEnabled = this.$env?.content?.dataProviderInterface?.enableFileUploadReplace || false;\n const wantsToReplace = this.$route.query?.edit ?? false;\n\n if (replaceEnabled && wantsToReplace) {\n const distributionIndexToReplace = this.$route.query?.edit;\n const fileIndexToReplace = this.findDistributionAccessUrlIndex();\n\n const targetDistribution = this.getData('distributions')?.[distributionIndexToReplace];\n const targetFile = targetDistribution?.['dcat:accessURL']?.[fileIndexToReplace];\n const accessUrl = targetFile?.['@id'];\n if (accessUrl) {\n const fileUploadUrl = this.$env.api.fileUploadUrl;\n\n const fileId = helper.getFileIdByAccessUrl({ accessUrl, fileUploadUrl })\n\n return await this.uploadFile(file, {\n method: 'PUT',\n url: `${this.$env.api.fileUploadUrl}data/${fileId}?catalog=${this.getCatalogue}`,\n });\n }\n\n }\n\n return await this.uploadFile(file);\n },\n async uploadFile(file, options = {}) {\n\n this.isLoading = true;\n\n const form = new FormData();\n form.append('file', file);\n\n const catalog = this.getCatalogue;\n const token = this.getUserData.rtpToken;\n\n const resolvedOptions = {\n method: 'POST',\n url: `${this.$env.api.fileUploadUrl}data?catalog=${catalog}`,\n ...options,\n };\n\n const requestOptions = {\n method: resolvedOptions.method,\n url: resolvedOptions.url,\n headers: {\n 'Content-Type': 'multipart/form-data',\n Authorization: `Bearer ${token}`,\n },\n data: form,\n };\n\n try {\n\n const result = await axios.request(requestOptions);\n const path = result.data.result.location.substring(result.data.result.location.indexOf('/') + 1);\n this.context.model = `${this.$env.api.fileUploadUrl}${path}`;\n this.isLoading = false;\n this.success = true;\n await this.context.node.input({ '@id': `${this.$env.api.fileUploadUrl}${path}` })\n // this.context.rootEmit('change');\n\n } catch (err) {\n\n this.isLoading = false;\n this.fail = true;\n console.error(err); // eslint-disable-line\n }\n },\n },\n mounted() {\n\n this.$nextTick(function () {\n\n if (this.context.value['@id']) {\n this.uploadURL = true\n this.URLValue = this.context.value['@id']\n return true\n }\n else false\n })\n },\n setup() {\n\n // let instance = getCurrentInstance().appContext.app.config.globalProperties.$env\n const env = useRuntimeEnv();\n\n var drop = reactive({\n active: false,\n })\n\n const fLoad = ref(null);\n\n onClickOutside(fLoad, event => drop.active = false)\n function triggerDropdown(e) {\n drop.active = !drop.active\n }\n\n return {\n drop,\n onClickOutside,\n triggerDropdown,\n };\n }\n};\n</script>\n\n<style lang=\"scss\" scoped>\n// @import '../../../styles/bootstrap_theme';\n// @import '../../../styles/utils/css-animations';\n.dURLText {}\n\n.file-div {\n display: flex;\n align-items: center;\n}\n\n.upload-feedback {\n padding: 10px;\n}\n\n/*** MATERIAL ICONS ***/\n%modal-icon {\n font-size: 20px;\n cursor: default;\n}\n\n.check-icon {\n @extend %modal-icon;\n color: #28a745;\n}\n\n.close-icon {\n @extend %modal-icon;\n color: red;\n}\n\n.lds-ring {\n display: inline-block;\n position: relative;\n width: 30px;\n height: 30px;\n}\n\n.lds-ring div {\n box-sizing: border-box;\n display: block;\n position: absolute;\n right: 0;\n width: 30px;\n height: 30px;\n border: 8px solid lightgray;\n border-radius: 50%;\n animation: lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;\n border-color: lightgray transparent transparent transparent;\n}\n\n.lds-ring div:nth-child(1) {\n animation-delay: -0.45s;\n}\n\n.lds-ring div:nth-child(2) {\n animation-delay: -0.3s;\n}\n\n.lds-ring div:nth-child(3) {\n animation-delay: -0.15s;\n}\n\n.error {\n color: red;\n}\n\n.errorSub {\n color: black;\n}\n\n@keyframes lds-ring {\n 0% {\n transform: rotate(0deg);\n }\n\n 100% {\n transform: rotate(360deg);\n }\n}\n\n.allowedFTypes {\n padding: 0.5rem;\n border-radius: 5px;\n border: 1px solid lightgrey;\n}\n\n.allowedTypesWrapper {\n max-width: 100%;\n display: flex;\n flex-wrap: wrap;\n}\n</style>\n"],"names":["_sfc_main","_a","mapGetters","getNode","mapActions","event","fileExtension","element","currentElement","rootElement","parentInputGroup","allInputGroupsNodeList","file","replaceEnabled","_c","_b","wantsToReplace","_d","distributionIndexToReplace","_e","fileIndexToReplace","targetDistribution","_f","targetFile","_g","accessUrl","fileUploadUrl","fileId","helper","options","form","catalog","token","resolvedOptions","requestOptions","result","axios","path","err","useRuntimeEnv","drop","reactive","fLoad","ref","onClickOutside","triggerDropdown","e","_hoisted_1","_createElementVNode","_hoisted_5","_hoisted_6","_hoisted_8","_hoisted_12","_withScopeId","_hoisted_15","_hoisted_18","_hoisted_21","_openBlock","_createElementBlock","_Fragment","$setup","_createTextVNode","_hoisted_2","_cache","$event","$data","$options","_createCommentVNode","_hoisted_3","_hoisted_4","args","_mergeProps","$props","_ctx","_vModelText","_hoisted_7","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_13","_hoisted_14","_hoisted_16","_hoisted_17","_toDisplayString","_hoisted_19","_hoisted_20","_renderList","types"],"mappings":";;;;;;;;;AA4DA,MAAKA,IAAU;AAAA,EACb,OAAO;AAAA,IACL,SAAS;AAAA,MACP,MAAM;AAAA,MACN,UAAU;AAAA,IACX;AAAA,EACF;AAAA,EAED,OAAO;;AACL,WAAO;AAAA,MACL,OAAO;AAAA,MACP,UAAU;AAAA,MACV,WAAW;AAAA,MACX,kBAAkB;AAAA,MAClB,YAAY;AAAA,MACZ,WAAW;AAAA,MACX,SAAS;AAAA,MACT,MAAM;AAAA,MACN,mBAAiBC,IAAA,KAAK,KAAK,QAAQ,sBAAsB,oBAAxC,gBAAAA,EAAyD,MAAM,SAAQ,CAAC;AAAA;EAE5F;AAAA,EACD,UAAU;AAAA,IAER,GAAGC,EAAW,QAAQ;AAAA,MACpB;AAAA,MACA;AAAA,IACF,CAAC;AAAA,IACD,GAAGA,EAAW,YAAY;AAAA,MAC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UADgE,MAAMwB,EAAO,QAAC;AAAA,aAClGA,EAAO,QAAC,KAAK,GAhCnB,GAAAjB,EAAA;AAAA,YAAAY,EAAA,IAAA,EAAA;AAAA,MAAAN,EAAA;AAAA,MAiCeI,EAAe,mBAAIA,EAAe,gBAAC,UAA9CR,KAAAC,EAQM,OARN0B,IAQM;AAAA,QAPoCnB,EAAO,UAlCrDE,EAAA,IAAA,EAAA,UAkCMT,EAAoE,KAApE2B,IAAiD,iBAAe;AAAA,QAlCtExB,EAAA;AAAA,QAmCMb,EAIM,OAJNQ,IAIM;AAAA,WAHJC,EAAA,EAAA,GAAAC,EAEOC,GAtCf,MAAA2B,EAoC8BrB,EAAe,iBApC7C,CAoCqBsB,YAAb7B,EAEO,QAAA;AAAA,YAFiC,KAAK6B;AAAA,YAAO,OAAM;AAAA,eACrDA,CAAK,GAAA,CAAA;;YArClBpB,EAAA,IAAA,EAAA;AAAA,IAAA,GAAA,IAAAlB,CAAA,KAAAkB,EAAA,IAAA,EAAA;AAAA;;;"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { isEmpty as u, isNil as h,
|
|
1
|
+
import { isEmpty as u, isNil as h, cloneDeep as p, has as b } from "lodash-es";
|
|
2
2
|
import y from "axios";
|
|
3
|
-
import { getTranslationFor as
|
|
4
|
-
function
|
|
3
|
+
import { getTranslationFor as x } from "../../utils/helpers.mjs";
|
|
4
|
+
function g(e) {
|
|
5
5
|
let t = {};
|
|
6
6
|
for (const r in e)
|
|
7
7
|
t = Object.assign(t, e[r]);
|
|
8
8
|
return t;
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function v(e, t) {
|
|
11
11
|
let r;
|
|
12
12
|
const s = e.indexOf(":");
|
|
13
13
|
if (s !== -1) {
|
|
@@ -17,24 +17,24 @@ function g(e, t) {
|
|
|
17
17
|
r = e;
|
|
18
18
|
return r;
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function d(e, t) {
|
|
21
21
|
let r;
|
|
22
22
|
e.includes("#") ? r = e.lastIndexOf("#") : r = e.lastIndexOf("/");
|
|
23
23
|
const s = e.substr(r + 1), n = e.substr(0, r + 1);
|
|
24
|
-
return `${Object.keys(t.prefixes).find((
|
|
24
|
+
return `${Object.keys(t.prefixes).find((a) => t.prefixes[a] === n)}:${s}`;
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function N(e, t) {
|
|
27
27
|
const r = [];
|
|
28
28
|
for (let s of e)
|
|
29
|
-
r.push(
|
|
29
|
+
r.push(d(s.predicate.value, t));
|
|
30
30
|
return r;
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function O(e) {
|
|
33
33
|
for (var t = "", r = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", s = r.length, n = 0; n < e; n++)
|
|
34
34
|
t += r.charAt(Math.floor(Math.random() * s));
|
|
35
35
|
return t;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function P(e) {
|
|
38
38
|
let t;
|
|
39
39
|
try {
|
|
40
40
|
t = new URL(e);
|
|
@@ -43,7 +43,7 @@ function O(e) {
|
|
|
43
43
|
}
|
|
44
44
|
return t.protocol === "http:" || t.protocol === "https:";
|
|
45
45
|
}
|
|
46
|
-
async function
|
|
46
|
+
async function $(e, t) {
|
|
47
47
|
let r, s;
|
|
48
48
|
t !== "" ? s = {
|
|
49
49
|
method: "GET",
|
|
@@ -57,20 +57,20 @@ async function P(e, t) {
|
|
|
57
57
|
};
|
|
58
58
|
try {
|
|
59
59
|
r = fetch(e, s).then((n) => {
|
|
60
|
-
var
|
|
61
|
-
const c = (
|
|
60
|
+
var a;
|
|
61
|
+
const c = (a = n == null ? void 0 : n.body) == null ? void 0 : a.getReader();
|
|
62
62
|
return new ReadableStream({
|
|
63
|
-
start(
|
|
64
|
-
function
|
|
65
|
-
c == null || c.read().then(({ done:
|
|
66
|
-
if (
|
|
67
|
-
|
|
63
|
+
start(l) {
|
|
64
|
+
function o() {
|
|
65
|
+
c == null || c.read().then(({ done: i, value: m }) => {
|
|
66
|
+
if (i) {
|
|
67
|
+
l.close();
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
|
-
|
|
70
|
+
l.enqueue(m), o();
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
|
-
|
|
73
|
+
o();
|
|
74
74
|
}
|
|
75
75
|
});
|
|
76
76
|
}).then(
|
|
@@ -81,7 +81,7 @@ async function P(e, t) {
|
|
|
81
81
|
}
|
|
82
82
|
return r;
|
|
83
83
|
}
|
|
84
|
-
function
|
|
84
|
+
function I(e, t, r) {
|
|
85
85
|
const s = {
|
|
86
86
|
datasets: {},
|
|
87
87
|
distributions: {},
|
|
@@ -90,14 +90,14 @@ function $(e, t, r) {
|
|
|
90
90
|
for (let n in r[e]) {
|
|
91
91
|
s[e][n] = [];
|
|
92
92
|
const c = r[e][n];
|
|
93
|
-
for (let
|
|
94
|
-
const
|
|
95
|
-
|
|
93
|
+
for (let a = 0; a < c.length; a++) {
|
|
94
|
+
const l = c[a], o = t[e][l].name;
|
|
95
|
+
o !== void 0 && s[e][n].push(o);
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
return s;
|
|
99
99
|
}
|
|
100
|
-
function
|
|
100
|
+
function j({ accessUrl: e, fileUploadUrl: t }) {
|
|
101
101
|
const r = e.endsWith("/") ? e : `${e}/`, s = t.endsWith("/") ? t : `${t}/`;
|
|
102
102
|
if (r.startsWith(s)) {
|
|
103
103
|
const n = r.split("/");
|
|
@@ -108,27 +108,28 @@ function I({ accessUrl: e, fileUploadUrl: t }) {
|
|
|
108
108
|
function T(e, t, r, s) {
|
|
109
109
|
s[t][r].push(e);
|
|
110
110
|
}
|
|
111
|
-
function
|
|
111
|
+
function k(e, t, r, s) {
|
|
112
112
|
s[t][r].splice(s[t][r].indexOf(e), 1);
|
|
113
113
|
}
|
|
114
114
|
function f(e) {
|
|
115
115
|
let t = !1;
|
|
116
116
|
if (!h(e) && !u(e)) {
|
|
117
|
-
p(e
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
117
|
+
let r = p(e);
|
|
118
|
+
b(r, "@language") && delete r["@language"];
|
|
119
|
+
const s = Object.values(r).filter((n) => n);
|
|
120
|
+
if (!u(s))
|
|
121
|
+
for (let n = 0; n < s.length; n++) {
|
|
122
|
+
const c = s[n];
|
|
123
|
+
if (Array.isArray(c))
|
|
124
|
+
for (let a = 0; a < c.length; a++)
|
|
125
|
+
f(c[a]) && (t = !0);
|
|
125
126
|
else
|
|
126
|
-
typeof
|
|
127
|
+
typeof c == "object" ? f(c) && (t = !0) : t = !0;
|
|
127
128
|
}
|
|
128
129
|
}
|
|
129
130
|
return t;
|
|
130
131
|
}
|
|
131
|
-
function
|
|
132
|
+
function A(e) {
|
|
132
133
|
let t = !1;
|
|
133
134
|
if (e !== void 0 && e !== "" && !u(e) && !h(e))
|
|
134
135
|
if (Array.isArray(e)) {
|
|
@@ -141,7 +142,7 @@ function k(e) {
|
|
|
141
142
|
typeof e == "object" ? t = f(e) : t = !0;
|
|
142
143
|
return t;
|
|
143
144
|
}
|
|
144
|
-
async function
|
|
145
|
+
async function w(e, t, r) {
|
|
145
146
|
const s = Object.keys(t.vocabPrefixes).find((n) => e.includes(t.vocabPrefixes[n]));
|
|
146
147
|
try {
|
|
147
148
|
let n;
|
|
@@ -151,42 +152,42 @@ async function A(e, t, r) {
|
|
|
151
152
|
const c = e.replace(t.vocabPrefixes[s], "");
|
|
152
153
|
n = `${r.api.baseUrl}vocabularies/${s}/${c}`;
|
|
153
154
|
}
|
|
154
|
-
return new Promise((c,
|
|
155
|
-
y.get(n).then((
|
|
156
|
-
c(
|
|
157
|
-
}).catch((
|
|
158
|
-
l
|
|
155
|
+
return new Promise((c, a) => {
|
|
156
|
+
y.get(n).then((l) => {
|
|
157
|
+
c(l);
|
|
158
|
+
}).catch((l) => {
|
|
159
|
+
a(l);
|
|
159
160
|
});
|
|
160
161
|
});
|
|
161
162
|
} catch {
|
|
162
163
|
}
|
|
163
164
|
}
|
|
164
|
-
async function
|
|
165
|
+
async function U(e, t, r, s) {
|
|
165
166
|
let n;
|
|
166
|
-
const c = Object.keys(t.vocabPrefixes).find((
|
|
167
|
-
let
|
|
168
|
-
return await
|
|
169
|
-
(
|
|
170
|
-
n =
|
|
167
|
+
const c = Object.keys(t.vocabPrefixes).find((l) => e.includes(t.vocabPrefixes[l]));
|
|
168
|
+
let a = c === "iana-media-types" || c === "spdx-checksum-algorithm";
|
|
169
|
+
return await w(e, t, s).then(
|
|
170
|
+
(l) => {
|
|
171
|
+
n = a ? l.data.result.results.filter((i) => i.resource === e).map((i) => i.pref_label)[0].en : x(l.data.result.pref_label, r, []);
|
|
171
172
|
}
|
|
172
173
|
), n;
|
|
173
174
|
}
|
|
174
|
-
const
|
|
175
|
-
mergeNestedObjects:
|
|
176
|
-
addNamespace:
|
|
177
|
-
makeId:
|
|
178
|
-
isUrl:
|
|
179
|
-
fetchLinkedData:
|
|
180
|
-
getPagePrefixedNames:
|
|
181
|
-
getNestedKeys:
|
|
182
|
-
removeNamespace:
|
|
183
|
-
getFileIdByAccessUrl:
|
|
175
|
+
const R = {
|
|
176
|
+
mergeNestedObjects: g,
|
|
177
|
+
addNamespace: v,
|
|
178
|
+
makeId: O,
|
|
179
|
+
isUrl: P,
|
|
180
|
+
fetchLinkedData: $,
|
|
181
|
+
getPagePrefixedNames: I,
|
|
182
|
+
getNestedKeys: N,
|
|
183
|
+
removeNamespace: d,
|
|
184
|
+
getFileIdByAccessUrl: j,
|
|
184
185
|
addKeyToFormatType: T,
|
|
185
|
-
removeKeyFromFormatType:
|
|
186
|
-
propertyHasValue:
|
|
187
|
-
getUriLabel:
|
|
186
|
+
removeKeyFromFormatType: k,
|
|
187
|
+
propertyHasValue: A,
|
|
188
|
+
getUriLabel: U
|
|
188
189
|
};
|
|
189
190
|
export {
|
|
190
|
-
|
|
191
|
+
R as default
|
|
191
192
|
};
|
|
192
193
|
//# sourceMappingURL=general-helper.mjs.map
|