@piveau/piveau-hub-ui-modules 4.1.3 → 4.1.5
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/DPIMenu.vue.mjs +74 -68
- package/dist/data-provider-interface/DPIMenu.vue.mjs.map +1 -1
- package/dist/data-provider-interface/components/ConditionalInput.vue.mjs +182 -48
- package/dist/data-provider-interface/components/ConditionalInput.vue.mjs.map +1 -1
- package/dist/data-provider-interface/components/DistributionStepper.vue.mjs +33 -32
- package/dist/data-provider-interface/components/DistributionStepper.vue.mjs.map +1 -1
- package/dist/data-provider-interface/components/FileUpload.vue.d.ts +3 -0
- package/dist/data-provider-interface/components/FileUpload.vue.mjs +146 -139
- package/dist/data-provider-interface/components/FileUpload.vue.mjs.map +1 -1
- package/dist/data-provider-interface/components/SimpleSelect.vue.mjs +55 -44
- package/dist/data-provider-interface/components/SimpleSelect.vue.mjs.map +1 -1
- package/dist/data-provider-interface/config/dcatap/format-types.mjs +3 -3
- package/dist/data-provider-interface/config/dcatap/format-types.mjs.map +1 -1
- package/dist/data-provider-interface/config/dcatap/input-definition.mjs +108 -86
- package/dist/data-provider-interface/config/dcatap/input-definition.mjs.map +1 -1
- package/dist/data-provider-interface/config/dcatapde/input-definition.mjs +3 -3
- package/dist/data-provider-interface/config/dcatapde/input-definition.mjs.map +1 -1
- package/dist/data-provider-interface/views/DraftsPage.vue.d.ts +13 -1
- package/dist/data-provider-interface/views/DraftsPage.vue.mjs +154 -111
- package/dist/data-provider-interface/views/DraftsPage.vue.mjs.map +1 -1
- package/dist/data-provider-interface/views/InputPage.vue.mjs +1 -1
- package/dist/data-provider-interface/views/InputPage.vue.mjs.map +1 -1
- package/dist/data-provider-interface/views/OverviewPage/CatalogueOverview.vue.mjs +27 -24
- package/dist/data-provider-interface/views/OverviewPage/CatalogueOverview.vue.mjs.map +1 -1
- package/dist/form/Repeatable.vue.mjs +33 -33
- package/dist/form/Repeatable.vue.mjs.map +1 -1
- package/dist/form/inputDefinitions.mjs.map +1 -1
- package/dist/piveau-hub-ui-modules.css +1 -1
- package/dist/scss/_dpi-style.scss +17 -3
- package/dist/store/modules/authStore.d.ts +9 -0
- package/dist/store/modules/authStore.mjs +32 -24
- package/dist/store/modules/authStore.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { mapGetters as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { getNode as
|
|
5
|
-
import { reactive as
|
|
6
|
-
import { onClickOutside as
|
|
7
|
-
import { useRuntimeEnv as
|
|
1
|
+
import { mapGetters as x, mapActions as F } from "vuex";
|
|
2
|
+
import C from "axios";
|
|
3
|
+
import V from "../utils/general-helper.mjs";
|
|
4
|
+
import { getNode as E } from "@formkit/core";
|
|
5
|
+
import { reactive as S, ref as O, resolveComponent as T, openBlock as n, createElementBlock as r, Fragment as y, createElementVNode as c, createVNode as L, createTextVNode as d, createCommentVNode as u, mergeProps as A, withDirectives as P, vModelText as q, toDisplayString as v, renderList as G, pushScopeId as D, popScopeId as M } from "vue";
|
|
6
|
+
import { onClickOutside as _ } from "../../external/@vueuse/core/index";
|
|
7
|
+
import { useRuntimeEnv as N } from "../../composables/useRuntimeEnv.mjs";
|
|
8
|
+
import "@formkit/vue";
|
|
8
9
|
import "./FileUpload.vue2.mjs";
|
|
9
10
|
import B from "../../_virtual/_plugin-vue_export-helper.mjs";
|
|
10
|
-
const
|
|
11
|
+
const H = {
|
|
11
12
|
props: {
|
|
12
13
|
context: {
|
|
13
14
|
type: Object,
|
|
@@ -15,8 +16,9 @@ const N = {
|
|
|
15
16
|
}
|
|
16
17
|
},
|
|
17
18
|
data() {
|
|
18
|
-
var
|
|
19
|
+
var i;
|
|
19
20
|
return {
|
|
21
|
+
inputChoice: "",
|
|
20
22
|
error: "",
|
|
21
23
|
URLValue: "",
|
|
22
24
|
uploadURL: !1,
|
|
@@ -25,45 +27,45 @@ const N = {
|
|
|
25
27
|
isLoading: !1,
|
|
26
28
|
success: !1,
|
|
27
29
|
fail: !1,
|
|
28
|
-
validExtensions: ((
|
|
30
|
+
validExtensions: ((i = this.$env.content.dataProviderInterface.uploadFileTypes) == null ? void 0 : i.split(",")) || []
|
|
29
31
|
};
|
|
30
32
|
},
|
|
31
33
|
computed: {
|
|
32
|
-
...
|
|
34
|
+
...x("auth", [
|
|
33
35
|
"getUserData",
|
|
34
36
|
"getIsEditMode"
|
|
35
37
|
]),
|
|
36
|
-
...
|
|
38
|
+
...x("dpiStore", [
|
|
37
39
|
"getData"
|
|
38
40
|
]),
|
|
39
41
|
getCatalogue() {
|
|
40
|
-
return
|
|
42
|
+
return E("dcat:catalog").value;
|
|
41
43
|
}
|
|
42
44
|
},
|
|
43
45
|
methods: {
|
|
44
|
-
...
|
|
46
|
+
...F("dpiStore", [
|
|
45
47
|
"saveLocalstorageValues"
|
|
46
48
|
]),
|
|
47
49
|
toggleUploadUrl() {
|
|
48
|
-
this.uploadURL && (this.uploadURL = !this.uploadURL);
|
|
50
|
+
this.inputChoice = "Upload a file", this.uploadURL && (this.uploadURL = !this.uploadURL);
|
|
49
51
|
},
|
|
50
52
|
toggleUploadFileSwitch() {
|
|
51
|
-
this.uploadFileSwitch && (this.uploadFileSwitch = !this.uploadFileSwitch);
|
|
53
|
+
this.inputChoice = "Provide an URL", this.uploadFileSwitch && (this.uploadFileSwitch = !this.uploadFileSwitch);
|
|
52
54
|
},
|
|
53
|
-
validateFile(
|
|
54
|
-
const
|
|
55
|
-
this.validExtensions && this.validExtensions.length ? this.validExtensions.includes(
|
|
55
|
+
validateFile(i) {
|
|
56
|
+
const l = "." + i.target.files[0].name.split(".").pop().toLowerCase();
|
|
57
|
+
this.validExtensions && this.validExtensions.length ? this.validExtensions.includes(l) ? this.uploadOrReplaceFile({ file: i.target.files[0] }) : console.log("Wrong filetype") : (this.error = "", this.uploadOrReplaceFile({ file: i.target.files[0] }));
|
|
56
58
|
},
|
|
57
59
|
async saveUrl() {
|
|
58
|
-
this.URLValue.includes("http://") || this.URLValue.includes("https://") ? await this.context.node.input({ "@id": this.URLValue }) : await this.context.node.input({ "@id": "https://" + this.URLValue });
|
|
60
|
+
this.URLValue.includes("http://") || this.URLValue.includes("https://") ? await this.context.node.input({ "@id": this.URLValue, mode: this.inputChoice }) : await this.context.node.input({ "@id": "https://" + this.URLValue, mode: this.inputChoice });
|
|
59
61
|
},
|
|
60
62
|
checkIfPresent() {
|
|
61
63
|
if (this.context.value["@id"])
|
|
62
64
|
return this.URLValue = this.context.value["@id"], !0;
|
|
63
65
|
},
|
|
64
66
|
// finds the parent input group of a given element.
|
|
65
|
-
findParentInputGroupOfElement(
|
|
66
|
-
let e =
|
|
67
|
+
findParentInputGroupOfElement(i) {
|
|
68
|
+
let e = i;
|
|
67
69
|
for (; e; ) {
|
|
68
70
|
if (e.classList.contains("formkit-input-group-repeatable"))
|
|
69
71
|
return e;
|
|
@@ -73,98 +75,97 @@ const N = {
|
|
|
73
75
|
},
|
|
74
76
|
// finds the index of the distribution access URL based on the root of this component.
|
|
75
77
|
findDistributionAccessUrlIndex() {
|
|
76
|
-
const
|
|
78
|
+
const i = this.$refs.fileupload, e = this.findParentInputGroupOfElement(i);
|
|
77
79
|
if (!e)
|
|
78
80
|
return null;
|
|
79
|
-
const
|
|
80
|
-
return Array.from(
|
|
81
|
+
const s = e.parentElement.querySelectorAll(".formkit-input-group-repeatable");
|
|
82
|
+
return Array.from(s).indexOf(e);
|
|
81
83
|
},
|
|
82
|
-
async uploadOrReplaceFile({ file:
|
|
83
|
-
var
|
|
84
|
-
const e = ((
|
|
85
|
-
if (e &&
|
|
86
|
-
const
|
|
87
|
-
if (
|
|
88
|
-
const R = this.$env.api.fileUploadUrl,
|
|
89
|
-
return await this.uploadFile(
|
|
84
|
+
async uploadOrReplaceFile({ file: i }) {
|
|
85
|
+
var s, t, a, p, o, h, g;
|
|
86
|
+
const e = ((a = (t = (s = this.$env) == null ? void 0 : s.content) == null ? void 0 : t.dataProviderInterface) == null ? void 0 : a.enableFileUploadReplace) || !1, l = ((p = this.$route.query) == null ? void 0 : p.edit) ?? !1;
|
|
87
|
+
if (e && l) {
|
|
88
|
+
const k = (o = this.$route.query) == null ? void 0 : o.edit, I = this.findDistributionAccessUrlIndex(), f = (h = this.getData("distributions")) == null ? void 0 : h[k], m = (g = f == null ? void 0 : f["dcat:accessURL"]) == null ? void 0 : g[I], U = m == null ? void 0 : m["@id"];
|
|
89
|
+
if (U) {
|
|
90
|
+
const R = this.$env.api.fileUploadUrl, b = V.getFileIdByAccessUrl({ accessUrl: U, fileUploadUrl: R });
|
|
91
|
+
return await this.uploadFile(i, {
|
|
90
92
|
method: "PUT",
|
|
91
|
-
url: `${this.$env.api.fileUploadUrl}data/${
|
|
93
|
+
url: `${this.$env.api.fileUploadUrl}data/${b}?catalog=${this.getCatalogue}`
|
|
92
94
|
});
|
|
93
95
|
}
|
|
94
96
|
}
|
|
95
|
-
return await this.uploadFile(
|
|
97
|
+
return await this.uploadFile(i);
|
|
96
98
|
},
|
|
97
|
-
async uploadFile(
|
|
99
|
+
async uploadFile(i, e = {}) {
|
|
98
100
|
this.isLoading = !0;
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
const
|
|
101
|
+
const l = new FormData();
|
|
102
|
+
l.append("file", i);
|
|
103
|
+
const s = this.getCatalogue, t = this.getUserData.rtpToken, a = {
|
|
102
104
|
method: "POST",
|
|
103
|
-
url: `${this.$env.api.fileUploadUrl}data?catalog=${
|
|
105
|
+
url: `${this.$env.api.fileUploadUrl}data?catalog=${s}`,
|
|
104
106
|
...e
|
|
105
|
-
},
|
|
106
|
-
method:
|
|
107
|
-
url:
|
|
107
|
+
}, p = {
|
|
108
|
+
method: a.method,
|
|
109
|
+
url: a.url,
|
|
108
110
|
headers: {
|
|
109
111
|
"Content-Type": "multipart/form-data",
|
|
110
|
-
Authorization: `Bearer ${
|
|
112
|
+
Authorization: `Bearer ${t}`
|
|
111
113
|
},
|
|
112
|
-
data:
|
|
114
|
+
data: l
|
|
113
115
|
};
|
|
114
116
|
try {
|
|
115
|
-
const
|
|
116
|
-
this.context.model = `${this.$env.api.fileUploadUrl}${
|
|
117
|
-
} catch (
|
|
118
|
-
this.isLoading = !1, this.fail = !0, console.error(
|
|
117
|
+
const o = await C.request(p), h = o.data.result.location.substring(o.data.result.location.indexOf("/") + 1);
|
|
118
|
+
this.context.model = `${this.$env.api.fileUploadUrl}${h}`, this.isLoading = !1, this.success = !0, await this.context.node.input({ "@id": `${this.$env.api.fileUploadUrl}${h}` });
|
|
119
|
+
} catch (o) {
|
|
120
|
+
this.isLoading = !1, this.fail = !0, console.error(o);
|
|
119
121
|
}
|
|
120
122
|
}
|
|
121
123
|
},
|
|
122
124
|
mounted() {
|
|
123
125
|
this.$nextTick(function() {
|
|
124
126
|
if (this.context.value["@id"])
|
|
125
|
-
return this.uploadURL = !0, this.URLValue = this.context.value["@id"], !0;
|
|
127
|
+
return this.uploadURL = !0, this.URLValue = this.context.value["@id"], this.inputChoice = "Provide an URL", !0;
|
|
126
128
|
});
|
|
127
129
|
},
|
|
128
130
|
setup() {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
+
N();
|
|
132
|
+
let i = "This property is required", e = "Choose between fileupload and providing a URL";
|
|
133
|
+
var l = S({
|
|
131
134
|
active: !1
|
|
132
135
|
});
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
136
|
+
const s = O("fload");
|
|
137
|
+
_(s, (a) => {
|
|
138
|
+
l.active = !1;
|
|
139
|
+
});
|
|
140
|
+
function t(a) {
|
|
141
|
+
l.active = !l.active;
|
|
137
142
|
}
|
|
138
143
|
return {
|
|
139
|
-
drop:
|
|
140
|
-
onClickOutside:
|
|
141
|
-
triggerDropdown:
|
|
144
|
+
drop: l,
|
|
145
|
+
onClickOutside: _,
|
|
146
|
+
triggerDropdown: t,
|
|
147
|
+
validationMessage: i,
|
|
148
|
+
placeholderMessage: e
|
|
142
149
|
};
|
|
143
150
|
}
|
|
144
|
-
},
|
|
151
|
+
}, w = (i) => (D("data-v-5ce35777"), i = i(), M(), i), K = { class: "position-relative w-100" }, W = {
|
|
145
152
|
key: 0,
|
|
146
153
|
ref: "fLoad",
|
|
147
154
|
class: "selectListUpload"
|
|
148
|
-
},
|
|
155
|
+
}, j = {
|
|
149
156
|
key: 0,
|
|
150
|
-
class: "w-100
|
|
151
|
-
},
|
|
152
|
-
class: "formkit-label w-100",
|
|
153
|
-
for: "aUrlLink"
|
|
154
|
-
}, "Provide an URL", -1)), z = ["data-type"], J = { class: "file-div position-relative" }, K = /* @__PURE__ */ h(() => /* @__PURE__ */ s("label", {
|
|
155
|
-
class: "formkit-label",
|
|
156
|
-
for: "aUrlFL"
|
|
157
|
-
}, "Upload a file", -1)), Q = ["accept"], X = {
|
|
157
|
+
class: "w-100 position-relative"
|
|
158
|
+
}, z = ["data-type"], J = { class: "file-div position-relative" }, Q = ["accept"], X = {
|
|
158
159
|
class: "upload-feedback position-absolute d-flex",
|
|
159
160
|
style: { right: "0" }
|
|
160
161
|
}, Y = {
|
|
161
162
|
key: 0,
|
|
162
163
|
class: "lds-ring"
|
|
163
|
-
}, Z = { key: 1 }, $ = /* @__PURE__ */
|
|
164
|
+
}, Z = { key: 1 }, $ = /* @__PURE__ */ w(() => /* @__PURE__ */ c("i", { class: "material-icons d-flex check-icon" }, "check_circle", -1)), ee = [
|
|
164
165
|
$
|
|
165
|
-
], te = { key: 2 }, ie = /* @__PURE__ */
|
|
166
|
+
], te = { key: 2 }, ie = /* @__PURE__ */ w(() => /* @__PURE__ */ c("i", { class: "material-icons d-flex close-icon" }, "error", -1)), oe = [
|
|
166
167
|
ie
|
|
167
|
-
],
|
|
168
|
+
], le = {
|
|
168
169
|
key: 0,
|
|
169
170
|
class: "dURLText my-3"
|
|
170
171
|
}, se = ["href"], ae = {
|
|
@@ -174,109 +175,115 @@ const N = {
|
|
|
174
175
|
key: 0,
|
|
175
176
|
class: "errorSub my-3 d-flex"
|
|
176
177
|
}, re = { class: "d-flex flex-wrap w-100" };
|
|
177
|
-
function de(
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
178
|
+
function de(i, e, l, s, t, a) {
|
|
179
|
+
const p = T("FormKit");
|
|
180
|
+
return n(), r(y, null, [
|
|
181
|
+
c("div", K, [
|
|
182
|
+
L(p, {
|
|
183
|
+
name: "mode",
|
|
184
|
+
validation: "required",
|
|
181
185
|
type: "text",
|
|
182
186
|
class: "selectInputField formkit-inner",
|
|
183
187
|
readonly: "readonly",
|
|
184
|
-
onClick: e[0] || (e[0] = (
|
|
185
|
-
placeholder:
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
188
|
+
onClick: e[0] || (e[0] = (o) => s.triggerDropdown()),
|
|
189
|
+
placeholder: s.placeholderMessage,
|
|
190
|
+
modelValue: t.inputChoice,
|
|
191
|
+
"onUpdate:modelValue": e[1] || (e[1] = (o) => t.inputChoice = o),
|
|
192
|
+
"validation-messages": {
|
|
193
|
+
required: s.validationMessage
|
|
194
|
+
}
|
|
195
|
+
}, null, 8, ["placeholder", "modelValue", "validation-messages"]),
|
|
196
|
+
d(),
|
|
197
|
+
s.drop.active ? (n(), r("ul", W, [
|
|
198
|
+
c("li", {
|
|
199
|
+
onClick: e[2] || (e[2] = (o) => {
|
|
200
|
+
t.uploadFileSwitch = !0, a.toggleUploadUrl();
|
|
192
201
|
}),
|
|
193
202
|
class: "p-2 border-b border-gray-200 data-[selected=true]:bg-blue-100 choosableItemsAC"
|
|
194
203
|
}, "Upload a file"),
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
onClick: e[
|
|
198
|
-
|
|
204
|
+
d(),
|
|
205
|
+
c("li", {
|
|
206
|
+
onClick: e[3] || (e[3] = (o) => {
|
|
207
|
+
t.uploadURL = !0, a.toggleUploadFileSwitch();
|
|
199
208
|
}),
|
|
200
209
|
class: "p-2 border-b border-gray-200 data-[selected=true]:bg-blue-100 choosableItemsAC"
|
|
201
210
|
}, "Provide an URL")
|
|
202
211
|
], 512)) : u("", !0)
|
|
203
212
|
]),
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
a(),
|
|
208
|
-
_(s("input", {
|
|
213
|
+
d(),
|
|
214
|
+
t.uploadURL && !t.uploadFileSwitch ? (n(), r("div", j, [
|
|
215
|
+
L(p, {
|
|
209
216
|
id: "aUrlLink",
|
|
210
|
-
|
|
217
|
+
modelValue: t.URLValue,
|
|
218
|
+
"onUpdate:modelValue": e[4] || (e[4] = (o) => t.URLValue = o),
|
|
211
219
|
class: "selectInputField formkit-inner",
|
|
212
220
|
type: "url",
|
|
213
221
|
name: "@id",
|
|
214
|
-
onInput:
|
|
215
|
-
validation: "
|
|
216
|
-
"validation-visibility": "live"
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
222
|
+
onInput: a.saveUrl,
|
|
223
|
+
validation: "required|url",
|
|
224
|
+
"validation-visibility": "live",
|
|
225
|
+
"validation-messages": {
|
|
226
|
+
required: s.validationMessage
|
|
227
|
+
}
|
|
228
|
+
}, null, 8, ["modelValue", "onInput", "validation-messages"])
|
|
220
229
|
])) : u("", !0),
|
|
221
|
-
|
|
222
|
-
|
|
230
|
+
d(),
|
|
231
|
+
t.uploadFileSwitch ? (n(), r("div", A({
|
|
223
232
|
key: 1,
|
|
224
233
|
ref: "fileupload",
|
|
225
|
-
class: ["p-3 w-100", `formkit-input-element formkit-input-element--${
|
|
226
|
-
"data-type":
|
|
227
|
-
},
|
|
228
|
-
|
|
234
|
+
class: ["p-3 w-100", `formkit-input-element formkit-input-element--${l.context.type}`],
|
|
235
|
+
"data-type": l.context.type
|
|
236
|
+
}, i.$attrs), [
|
|
237
|
+
P(c("input", {
|
|
229
238
|
type: "text",
|
|
230
|
-
"onUpdate:modelValue": e[5] || (e[5] = (
|
|
231
|
-
onBlur: e[6] || (e[6] = (...
|
|
239
|
+
"onUpdate:modelValue": e[5] || (e[5] = (o) => l.context.model = o),
|
|
240
|
+
onBlur: e[6] || (e[6] = (...o) => l.context.blurHandler && l.context.blurHandler(...o)),
|
|
232
241
|
hidden: ""
|
|
233
242
|
}, null, 544), [
|
|
234
|
-
[
|
|
243
|
+
[q, l.context.model]
|
|
235
244
|
]),
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
a(),
|
|
240
|
-
s("input", {
|
|
245
|
+
d(),
|
|
246
|
+
c("div", J, [
|
|
247
|
+
c("input", {
|
|
241
248
|
class: "mt-3",
|
|
242
249
|
type: "file",
|
|
243
250
|
id: "aUrlFL",
|
|
244
251
|
name: "fileUpload",
|
|
245
|
-
onChange: e[7] || (e[7] = (
|
|
246
|
-
accept:
|
|
252
|
+
onChange: e[7] || (e[7] = (o) => a.validateFile(o)),
|
|
253
|
+
accept: t.validExtensions
|
|
247
254
|
}, null, 40, Q),
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
+
d(),
|
|
256
|
+
c("div", X, [
|
|
257
|
+
t.isLoading ? (n(), r("div", Y)) : u("", !0),
|
|
258
|
+
d(),
|
|
259
|
+
t.success ? (n(), r("div", Z, ee)) : u("", !0),
|
|
260
|
+
d(),
|
|
261
|
+
t.fail ? (n(), r("div", te, oe)) : u("", !0)
|
|
255
262
|
])
|
|
256
263
|
]),
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
href:
|
|
262
|
-
},
|
|
264
|
+
d(),
|
|
265
|
+
t.success ? (n(), r("p", le, [
|
|
266
|
+
d(v(i.$t("message.metadata.downloadUrl")) + ": ", 1),
|
|
267
|
+
c("a", {
|
|
268
|
+
href: l.context.model
|
|
269
|
+
}, v(l.context.model), 9, se)
|
|
263
270
|
])) : u("", !0),
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
(
|
|
270
|
-
key:
|
|
271
|
+
d(),
|
|
272
|
+
t.validExtensions && t.validExtensions.length ? (n(), r("div", ae, [
|
|
273
|
+
t.success ? u("", !0) : (n(), r("p", ne, "Allowed types: ")),
|
|
274
|
+
d(),
|
|
275
|
+
c("div", re, [
|
|
276
|
+
(n(!0), r(y, null, G(t.validExtensions, (o) => (n(), r("span", {
|
|
277
|
+
key: o,
|
|
271
278
|
class: "mr-1 mb-1 allowedFTypes"
|
|
272
|
-
},
|
|
279
|
+
}, v(o), 1))), 128))
|
|
273
280
|
])
|
|
274
281
|
])) : u("", !0)
|
|
275
282
|
], 16, z)) : u("", !0)
|
|
276
283
|
], 64);
|
|
277
284
|
}
|
|
278
|
-
const
|
|
285
|
+
const ye = /* @__PURE__ */ B(H, [["render", de], ["__scopeId", "data-v-5ce35777"]]);
|
|
279
286
|
export {
|
|
280
|
-
|
|
287
|
+
ye as default
|
|
281
288
|
};
|
|
282
289
|
//# 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 <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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,QAAfR,EAAA,GAAAC,EAA4E,OA5BpFsB,IAAAC,EAAA,KAAAd,EAAA,IAAA,EAAA;AAAA;;MAAAN,EAAA;AAAA,MA+BmCI,EAAO,WAAtCR,KAAAC,EAC0B,KAD1BwB,IAC0B;AAAA,QAhC9BrB,EA+B+CsB,EAAAV,EAAA,sCAAqC,MAAE,CAAA;AAAA,QAAAzB,EAC5D,KAAA;AAAA,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
|
+
{"version":3,"file":"FileUpload.vue.mjs","sources":["../../../lib/data-provider-interface/components/FileUpload.vue"],"sourcesContent":["<template>\n \n <div class=\"position-relative w-100 \">\n <FormKit name=\"mode\" validation=\"required\" type=\"text\" class=\"selectInputField formkit-inner \" readonly=\"readonly\"\n @click=\"triggerDropdown()\" :placeholder=\"placeholderMessage\" v-model=\"inputChoice\" :validation-messages=\"{\n required: validationMessage,\n }\" />\n <ul ref=\"fLoad\" v-if=\"drop.active\" class=\"selectListUpload\">\n <li @click=\"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=\"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 position-relative\" v-if=\"uploadURL && !uploadFileSwitch\">\n\n <FormKit id=\"aUrlLink\" v-model=\"URLValue\" class=\"selectInputField formkit-inner\" type=\"url\" name=\"@id\" @input=\"saveUrl\"\n validation=\"required|url\" validation-visibility=\"live\" :validation-messages=\"{\n required: validationMessage,\n }\" />\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 <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 { useRuntimeEnv } from \"../../composables/useRuntimeEnv.ts\";\nimport { FormKit } from '@formkit/vue';\n\nexport default {\n props: {\n context: {\n type: Object,\n required: true,\n },\n },\n\n data() {\n return {\n inputChoice: '',\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 this.inputChoice = \"Upload a file\"\n if (this.uploadURL) { this.uploadURL = !this.uploadURL }\n },\n toggleUploadFileSwitch() {\n this.inputChoice = \"Provide an URL\"\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 , 'mode': this.inputChoice})\n }\n else await this.context.node.input({ '@id': 'https://' + this.URLValue , 'mode': this.inputChoice})\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 this.inputChoice = \"Provide an URL\"\n return true\n }\n else false\n })\n },\n setup() {\n const env = useRuntimeEnv();\n let validationMessage = 'This property is required'\n let placeholderMessage = 'Choose between fileupload and providing a URL'\n\n var drop = reactive({\n active: false,\n })\n\n\n const fLoad = ref('fload');\n\n onClickOutside(fLoad, event => {\n drop.active = false\n })\n function triggerDropdown(e) {\n drop.active = !drop.active\n }\n\n return {\n drop,\n onClickOutside,\n triggerDropdown,\n validationMessage,\n placeholderMessage\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\n.accessUrl {\n .formkit-outer {}\n}\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","validationMessage","placeholderMessage","drop","reactive","fLoad","ref","onClickOutside","triggerDropdown","e","_hoisted_1","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_10","_withScopeId","_createElementVNode","_hoisted_13","_hoisted_16","_hoisted_19","_openBlock","_createElementBlock","_Fragment","_createVNode","_component_FormKit","$setup","$data","_cache","$event","_createTextVNode","_hoisted_2","$options","_createCommentVNode","_hoisted_3","_mergeProps","$props","_ctx","args","_vModelText","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_11","_hoisted_12","_hoisted_14","_hoisted_15","_toDisplayString","_hoisted_17","_hoisted_18","_renderList","types"],"mappings":";;;;;;;;;;AAgEA,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,aAAa;AAAA,MACb,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,WAAK,cAAc,iBACf,KAAK,cAAa,KAAK,YAAY,CAAC,KAAK;AAAA,IAC9C;AAAA,IACD,yBAAyB;AACvB,WAAK,cAAc,kBACf,KAAK,qBAAoB,KAAK,mBAAmB,CAAC,KAAK;AAAA,IAC5D;AAAA,IACD,aAAaC,GAAO;AAElB,YAAMC,IAAgB,MADTD,EAAM,OAAO,MAAM,CAAC,EACA,KAAK,MAAM,GAAG,EAAE,MAAM;AACvD,MAAI,KAAK,mBAAmB,KAAK,gBAAgB,SAC1C,KAAK,gBAAgB,S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