@piveau/piveau-hub-ui-modules 4.0.25 → 4.0.27
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/DPIMenu.vue.mjs +2 -2
- package/dist/data-provider-interface/DPIMenu.vue.mjs.map +1 -1
- package/dist/data-provider-interface/components/AutocompleteInput.vue.mjs +103 -103
- package/dist/data-provider-interface/components/AutocompleteInput.vue.mjs.map +1 -1
- package/dist/data-provider-interface/components/ConditionalInput.vue.mjs +47 -45
- package/dist/data-provider-interface/components/ConditionalInput.vue.mjs.map +1 -1
- package/dist/data-provider-interface/components/ConditionalInput.vue2.mjs +5 -0
- package/dist/data-provider-interface/components/ConditionalInput.vue2.mjs.map +1 -0
- 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/config/dcatap/vocab-prefixes.mjs +1 -1
- package/dist/data-provider-interface/config/dcatap/vocab-prefixes.mjs.map +1 -1
- package/dist/data-provider-interface/store/modules/autocompleteStore.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/data-provider-interface/views/InputPage.vue.mjs.map +1 -1
- package/dist/piveau-hub-ui-modules.css +1 -1
- package/dist/scss/_dpi-style.scss +1 -1
- package/package.json +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutocompleteInput.vue.mjs","sources":["../../../lib/data-provider-interface/components/AutocompleteInput.vue"],"sourcesContent":["<script setup>\nimport { ref, reactive, watch, computed, onBeforeMount, onMounted, watchEffect } from 'vue';\nimport { useStore } from 'vuex';\nimport { getTranslationFor } from \"../../utils/helpers\";\nimport { getCurrentInstance } from \"vue\";\nimport { getNode } from '@formkit/core'\nimport { onClickOutside } from '@vueuse/core'\n\nimport qs from 'qs';\nimport axios from 'axios';\n\nlet instance = getCurrentInstance().appContext.app.config.globalProperties.$env\n\nconst props = defineProps({\n context: Object\n})\nconst store = useStore();\n\nlet listOfValues = computed(() => {\n return props.context.value;\n})\n\nlet selection;\nlet voc = props.context.attrs.voc;\nlet matches = ref({\n value: { name: '--- Type in anything for a live search of the vocabulary ---' }\n})\nlet activeList = ref()\nlet dropdownList = ref(null)\nlet inputText = ref({})\nlet cacheList = [];\nlet annifList = [];\nlet annifTrigger = ref({\n value: false\n});\nlet initialValues = ref();\nlet annifSelectionList = ref({})\n\nonMounted(async () => {\n inputText.value = \"\"\n});\n\nwatch(matches, async () => { })\nwatch(annifSelectionList, async () => { })\n\nconst requestURIname = async (res) => {\n\n if (res != undefined) {\n let vocMatch =\n voc === \"iana-media-types\" ||\n voc === \"spdx-checksum-algorithm\";\n\n let name;\n\n await store.dispatch('dpiStore/requestResourceName', { voc: voc, uri: res, envs: instance }).then(\n (response) => {\n if (props.context.attrs.property === 'dcatde:politicalGeocodingURI') {\n if (response != undefined) {\n let result = vocMatch\n ? response.data.result.results\n .filter((dataset) => dataset.resource === res)\n .map((dataset) => dataset.alt_label)[0].en\n : getTranslationFor(response.data.result.alt_label, 'en', []);\n name = result;\n }\n } else {\n\n if (response != undefined) {\n let result = vocMatch\n ? response.data.result.results\n .filter((dataset) => dataset.resource === res)\n .map((dataset) => dataset.pref_label)[0].en\n : getTranslationFor(response.data.result.pref_label, 'en', []);\n name = result;\n\n }\n }\n }\n );\n return name\n }\n\n}\n\nwatchEffect(async () => {\n const values = listOfValues.value;\n\n // single URI's\n if (values.hasOwnProperty('name')) {\n if (values.name === values.resource) {\n let uriName;\n if (!props.context.attrs.multiple) {\n uriName = requestURIname(values.resource)\n props.context.node.input({ name: await uriName, resource: values.resource })\n\n }\n }\n }\n // multiple URI's\n if (values.length >= 1) {\n let uriNameList = [];\n for (let index = 0; index < values.length; index++) {\n if (values[index].name === values[index].resource) {\n uriNameList.push({ name: await requestURIname(values[index].resource), resource: values[index].resource })\n props.context.node.input(uriNameList)\n }\n }\n }\n});\nfunction findPropertyToUpdate(trigger) {\n\n let finalPath = { step: '', prop: props.context.node.name }\n let pathToLocalStorage = JSON.parse(localStorage.getItem('dpi_datasets'));\n\n for (let index = 0; index < Object.keys(pathToLocalStorage).length; index++) {\n for (let innerIndex = 0; innerIndex < Object.keys(pathToLocalStorage)[index].length; innerIndex++) {\n let ntry = Object.entries((pathToLocalStorage))\n try {\n Object.keys(ntry[index][innerIndex]).filter(e => {\n if (e === props.context.node.name) {\n finalPath.step = ntry[index][0]\n\n if (trigger === 'erase') {\n\n selection = {}\n pathToLocalStorage[finalPath.step][finalPath.prop] = selection\n }\n if (typeof selection === 'object') {\n\n pathToLocalStorage[finalPath.step][finalPath.prop] = selection\n }\n else pathToLocalStorage[finalPath.step][finalPath.prop] = selection\n localStorage.setItem('dpi_datasets', JSON.stringify(pathToLocalStorage))\n }\n });\n } catch (error) {\n }\n }\n }\n\n window.removeEventListener(\"click\", onClickOutside);\n}\nonClickOutside(dropdownList, event => activeList.value = false)\nlet annifHandlerTheme = async (input, limit) => {\n\n let finalLimit = 10;\n if (limit != undefined) {\n finalLimit = finalLimit + 10\n }\n\n let query = qs.stringify({\n 'text': input,\n 'limit': finalLimit\n });\n\n\n var config = {\n method: 'post',\n url: voc == \"eurovoc\"\n ? instance.content.dataProviderInterface.annifLinkSubject\n : instance.content.dataProviderInterface.annifLinkTheme,\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n 'Accept': 'application/json'\n },\n data: query\n };\n\n let list = []\n\n axios(config)\n .then(async (response) => {\n for (let i = 0; i < response.data.results.length; i++) {\n annifList[i] = { \"name\": response.data.results[i].label, \"resource\": response.data.results[i].uri, \"activeValue\": false }\n }\n let annifCacheList = []\n if (listOfValues.value.length > 0) {\n listOfValues.value.forEach(element => {\n annifCacheList.push({ \"name\": element.name, \"resource\": element.resource, \"activeValue\": true })\n });\n }\n if (response.data.results.length > 9) {\n annifList[annifList.length + 1] = { \"name\": \"...\", \"resource\": \"invalid\", \"activeValue\": false }\n }\n\n annifSelectionList.value = eraseDuplicates(annifCacheList, annifList)\n\n })\n .catch(function (error) {\n console.log(error);\n });\n}\nasync function updateAnnifselection(item) {\n\n if (item.resource === 'invalid') {\n fillAnnifsuggestions(5);\n }\n else {\n setValue({ name: item.name, resource: item.resource })\n fillAnnifsuggestions()\n }\n\n\n}\nfunction eraseDuplicates(array1, array2) {\n\n let mergedArray = array1.concat(array2);\n let filteredArray = [];\n let resourceSet = new Set();\n\n mergedArray.forEach(obj => {\n if (!resourceSet.has(obj.resource)) {\n resourceSet.add(obj.resource);\n if (!obj.activeValue) {\n filteredArray.push(obj);\n }\n }\n });\n\n\n return filteredArray;\n}\nconst fillAnnifsuggestions = async (limitChange) => {\n\n let arr = getNode('Mandatory').value['dct:description']\n for (let i = 0; i < arr.length; i++) {\n if (arr[i]['@language'] === 'en') {\n if (limitChange != undefined) {\n await annifHandlerTheme(arr[i]['@value'], 5)\n }\n else await annifHandlerTheme(arr[i]['@value'])\n }\n }\n\n}\n\n// Need to append the classes to the formkit-outer element\nprops.context.classes.outer += ' autocompleteInput ' + props.context.attrs.identifier\n\nconst setValue = async (e) => {\n if (Object.keys(e).length === 1) {\n return\n }\n if (listOfValues.value.length > 0) {\n\n cacheList = listOfValues.value\n }\n\n // when its a multi input\n if (props.context.attrs.multiple) {\n // check for doubled values\n if (cacheList.length != 0) {\n let filteredProperty = { name: e.name, resource: e.resource };\n let filteredList = cacheList.filter((element) => element.name != e.name);\n filteredList.push(filteredProperty)\n selection = filteredList;\n await props.context.node.input(selection);\n\n }\n else {\n cacheList.push({ name: e.name, resource: e.resource })\n selection = cacheList\n await props.context.node.input(selection);\n }\n\n }\n else if (e.resource === \"invalid\") return\n else if (e === \"erase\") { await props.context.node.input({}); findPropertyToUpdate(e) }\n else {\n selection = { name: e.name, resource: e.resource };\n await props.context.node.input(selection);\n }\n findPropertyToUpdate();\n}\n\nconst getAutocompleteSuggestions = async (e) => {\n let innerText = e.target.value\n\n await store.dispatch('dpiStore/requestAutocompleteSuggestions', { voc: voc, text: innerText, base: instance.api.baseUrl }).then((response) => {\n const results = response.data.result.results.map((r) => ({\n name: getTranslationFor(r.pref_label, 'en', []) + \" (\" + r.id + \")\",\n resource: r.resource,\n }));\n if (results.length === 0) {\n matches.value = { value: { name: '--- No match found ---' } }\n }\n else matches.value = results;\n });\n}\n\nfunction removeProperty(e) {\n props.context.node.input({})\n setValue('erase');\n}\nfunction removeMultipleProperty(e) {\n\n if (instance.content.dataProviderInterface.annifIntegration) {\n fillAnnifsuggestions()\n }\n if (listOfValues.value.length > 0) {\n cacheList = listOfValues.value\n }\n // Get Index in the array where all values of the Span are stored and cut it out of the list of Values\n cacheList.splice(cacheList.findIndex((element) => element.name == e.name), 1)\n selection = cacheList;\n props.context.node.input(selection);\n findPropertyToUpdate();\n}\n</script>\n\n<template>\n\n <div class=\"formkitProperty\">\n <h4>{{ props.context.label }}</h4>\n <div class=\"formkitCmpWrap\">\n <div class=\"formkit-outer\">\n <div class=\"d-flex formkit-inner\" v-if=\"!props.context.attrs.multiple && props.context.value.name\">\n <!-- <div class=\"infoI\">\n <div class=\"tooltipFormkit\">{{ props.context.attrs.info }}</div>\n </div> -->\n <a class=\"autocompleteInputSingleValue \">{{ props.context.value.name }}</a>\n <div class=\"removeX\" @click=\"removeProperty\"></div>\n </div>\n <div v-else>\n <div class=\"d-flex align-items-center justify-content-center formkit-inner mb-2\">\n <!-- <div class=\"infoI\">\n <div class=\"tooltipFormkit\">{{ props.context.attrs.info }}</div>\n </div> -->\n <input class=\"autocompleteInputfield\" :placeholder=\"props.context.attrs.placeholder\" v-model=\"inputText\"\n type=\"text\" v-on:keyup=\"getAutocompleteSuggestions($event)\" @click=\"activeList = !activeList\">\n </div>\n <ul ref=\"dropdownList\" v-show=\"activeList\" class=\"autocompleteResultList\">\n <li v-for=\"match in matches\" :key=\"match\" @click=\"setValue(match); activeList = !activeList \"\n class=\"p-2 border-b border-gray-200 data-[selected=true]:bg-blue-100 choosableItemsAC\">{{ match.name }}\n </li>\n </ul>\n <div v-if=\"instance.content.dataProviderInterface.annifIntegration && props.context.attrs.annifTheme\"\n class=\"d-flex flex-wrap\">\n <div v-for=\"item in listOfValues\" :key=\"item\">\n <div class=\"activeResultsAutocompleteWrapper\">\n <div class=\"d-flex\" @click=\"item.activeValue = !item.activeValue;\">\n <span>{{ item.name }}</span>\n <div class=\"removeX\" @click=\"removeMultipleProperty(item)\"></div>\n </div>\n </div>\n </div>\n <div class=\"w-100 mt-4\">\n <div class=\"d-flex justify-content-between align-items-center flex-wrap\">\n <h3>{{ props.context.label }} Suggestions</h3>\n <span>You can generate suggestions based on the description you provided</span>\n <button class=\"navlikeButton\" type=\"button\"\n @click=\"fillAnnifsuggestions(); annifTrigger.value = true\">Try it</button>\n </div>\n <div class=\"annifresultContainer\" v-if=\"annifTrigger.value\">\n <div v-for=\"item in annifSelectionList\" :key=\"item\" class=\"d-flex \">\n <div class=\"activeResultsAutocompleteWrapper annifResults\"\n :class=\"{ loadMore: item.resource === 'invalid' }\"\n @click=\"item.activeValue = !item.activeValue; updateAnnifselection(item)\">\n <div class=\"d-flex\">\n <span>{{ item.name }}</span>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n </div>\n <div v-else class=\"d-flex flex-wrap\">\n <div class=\"activeResultsAutocompleteWrapper\" v-for=\"item in props.context.value\" :key=\"item\">\n <span>{{ item.name }}</span>\n <div class=\"removeX\" @click=\"removeMultipleProperty(item)\"></div>\n </div>\n </div>\n <div class=\"formkit-wrapper\">\n <div class=\"formkit-help\">{{ props.context.help }}</div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>"],"names":["instance","getCurrentInstance","props","__props","store","useStore","listOfValues","computed","selection","voc","matches","ref","activeList","dropdownList","inputText","cacheList","annifList","annifTrigger","annifSelectionList","onMounted","watch","requestURIname","res","vocMatch","name","response","dataset","getTranslationFor","watchEffect","values","uriName","uriNameList","index","findPropertyToUpdate","trigger","finalPath","pathToLocalStorage","innerIndex","ntry","e","onClickOutside","event","annifHandlerTheme","input","limit","finalLimit","query","qs","config","axios","i","annifCacheList","element","eraseDuplicates","error","updateAnnifselection","item","fillAnnifsuggestions","setValue","array1","array2","mergedArray","filteredArray","resourceSet","obj","limitChange","arr","getNode","filteredProperty","filteredList","getAutocompleteSuggestions","innerText","results","removeProperty","removeMultipleProperty"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAWA,QAAIA,IAAWC,EAAkB,EAAG,WAAW,IAAI,OAAO,iBAAiB;AAE3E,UAAMC,IAAQC,GAGRC,IAAQC,GAAQ;AAEtB,QAAIC,IAAeC,EAAS,MACnBL,EAAM,QAAQ,KACtB,GAEGM,GACAC,IAAMP,EAAM,QAAQ,MAAM,KAC1BQ,IAAUC,EAAI;AAAA,MAChB,OAAO,EAAE,MAAM,+DAAgE;AAAA,IACjF,CAAC,GACGC,IAAaD,EAAK,GAClBE,IAAeF,EAAI,IAAI,GACvBG,IAAYH,EAAI,EAAE,GAClBI,IAAY,CAAA,GACZC,IAAY,CAAA,GACZC,IAAeN,EAAI;AAAA,MACrB,OAAO;AAAA,IACT,CAAC;AACmB,IAAAA,EAAM;AAC1B,QAAIO,IAAqBP,EAAI,EAAE;AAE/B,IAAAQ,EAAU,YAAY;AACpB,MAAAL,EAAU,QAAQ;AAAA,IACpB,CAAC,GAEDM,EAAMV,GAAS,YAAY;AAAA,KAAG,GAC9BU,EAAMF,GAAoB,YAAY;AAAA,KAAG;AAEzC,UAAMG,IAAiB,OAAOC,MAAQ;AAEpC,UAAIA,KAAO,MAAW;AACpB,YAAIC,IACFd,MAAQ,sBACRA,MAAQ,2BAENe;AAEJ,qBAAMpB,EAAM,SAAS,gCAAgC,EAAE,KAAKK,GAAK,KAAKa,GAAK,MAAMt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KAAK,MAAMM,CAAS;AAAA;AAE1C,QAAAyB;;IACF,GAEMqC,IAA6B,OAAO/B,MAAM;AAC9C,UAAIgC,IAAYhC,EAAE,OAAO;AAEzB,YAAMnC,EAAM,SAAS,2CAA2C,EAAE,KAAKK,GAAK,MAAM8D,GAAW,MAAMvE,EAAS,IAAI,QAAS,CAAA,EAAE,KAAK,CAACyB,MAAa;AAC5I,cAAM+C,IAAU/C,EAAS,KAAK,OAAO,QAAQ,IAAI,CAAC,OAAO;AAAA,UACvD,MAAME,EAAkB,EAAE,YAAY,MAAM,CAAE,CAAA,IAAI,OAAO,EAAE,KAAK;AAAA,UAChE,UAAU,EAAE;AAAA,QACb,EAAC;AACF,QAAI6C,EAAQ,WAAW,IACrB9D,EAAQ,QAAQ,EAAE,OAAO,EAAE,MAAM,yBAAwB,EAAI,IAE1DA,EAAQ,QAAQ8D;AAAA,MACzB,CAAG;AAAA,IACH;AAEA,aAASC,EAAelC,GAAG;AACzB,MAAArC,EAAM,QAAQ,KAAK,MAAM,CAAA,CAAE,GAC3BwD,EAAS,OAAO;AAAA,IAClB;AACA,aAASgB,EAAuBnC,GAAG;AAEjC,MAAIvC,EAAS,QAAQ,sBAAsB,oBACzCyD,EAAsB,GAEpBnD,EAAa,MAAM,SAAS,MAC9BS,IAAYT,EAAa,QAG3BS,EAAU,OAAOA,EAAU,UAAU,CAACqC,MAAYA,EAAQ,QAAQb,EAAE,IAAI,GAAG,CAAC,GAC5E/B,IAAYO,GACZb,EAAM,QAAQ,KAAK,MAAMM,CAAS,GAClCyB;IACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"AutocompleteInput.vue.mjs","sources":["../../../lib/data-provider-interface/components/AutocompleteInput.vue"],"sourcesContent":["<template>\n <div class=\"formkitProperty\">\n <!-- need to make a condition for the licence property of the distribution - otherwise the dropdown doesnt work-->\n\n <h4 v-if=\"props.context.attrs.identifier != 'licence'\">{{ props.context.label }}</h4>\n <div class=\"formkitCmpWrap\">\n <div class=\"formkit-outer\">\n <div class=\"d-flex formkit-inner\" v-if=\"!props.context.attrs.multiple && props.context.value.name\">\n\n <!-- <div class=\"infoI\">\n <div class=\"tooltipFormkit\">{{ props.context.attrs.info }}</div>\n </div> -->\n <a class=\"autocompleteInputSingleValue \">{{ props.context.value.name }}</a>\n <div class=\"removeX\" @click=\"removeProperty\"></div>\n </div>\n <div v-else>\n <div class=\"d-flex align-items-center justify-content-center formkit-inner mb-2\">\n <!-- <div class=\"infoI\">\n <div class=\"tooltipFormkit\">{{ props.context.attrs.info }}</div>\n </div> -->\n <input class=\"autocompleteInputfield\" :placeholder=\"props.context.attrs.placeholder\" v-model=\"inputText\"\n type=\"text\" v-on:keyup=\"getAutocompleteSuggestions($event)\" @click=\"activeList = !activeList\">\n </div>\n <ul ref=\"dropdownList\" v-show=\"activeList\" class=\"autocompleteResultList\">\n <li v-for=\"match in matches\" :key=\"match\" @click=\"setValue(match); activeList = !activeList\"\n class=\"p-2 border-b border-gray-200 data-[selected=true]:bg-blue-100 choosableItemsAC\">{{ match.name }}\n </li>\n </ul>\n <div v-if=\"instance.content.dataProviderInterface.annifIntegration && props.context.attrs.annifTheme\"\n class=\"d-flex flex-wrap\">\n <div v-for=\"item in listOfValues\" :key=\"item\">\n <div class=\"activeResultsAutocompleteWrapper\">\n <div class=\"d-flex\" @click=\"item.activeValue = !item.activeValue;\">\n <span>{{ item.name }}</span>\n <div class=\"removeX\" @click=\"removeMultipleProperty(item)\"></div>\n </div>\n </div>\n </div>\n <div class=\"w-100 mt-4\">\n <div class=\"d-flex justify-content-between align-items-center flex-wrap\">\n <h3>{{ props.context.label }} Suggestions</h3>\n <span>You can generate suggestions based on the description you provided</span>\n <button class=\"navlikeButton\" type=\"button\"\n @click=\"fillAnnifsuggestions(); annifTrigger.value = true\">Try it</button>\n </div>\n <div class=\"annifresultContainer\" v-if=\"annifTrigger.value\">\n <div v-for=\"item in annifSelectionList\" :key=\"item\" class=\"d-flex \">\n <div class=\"activeResultsAutocompleteWrapper annifResults\"\n :class=\"{ loadMore: item.resource === 'invalid' }\"\n @click=\"item.activeValue = !item.activeValue; updateAnnifselection(item)\">\n <div class=\"d-flex\">\n <span>{{ item.name }}</span>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n </div>\n <div v-else class=\"d-flex flex-wrap\">\n <div class=\"activeResultsAutocompleteWrapper\" v-for=\"item in props.context.value\" :key=\"item\">\n <span>{{ item.name }}</span>\n <div class=\"removeX\" @click=\"removeMultipleProperty(item)\"></div>\n </div>\n </div>\n <div class=\"formkit-wrapper\">\n <div class=\"formkit-help\">{{ props.context.help }}</div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script setup>\nimport { ref, reactive, watch, computed, onBeforeMount, onMounted, watchEffect } from 'vue';\nimport { useStore } from 'vuex';\nimport { getTranslationFor } from \"../../utils/helpers\";\nimport { getCurrentInstance } from \"vue\";\nimport { getNode } from '@formkit/core'\nimport { onClickOutside } from '@vueuse/core'\n\nimport qs from 'qs';\nimport axios from 'axios';\n\nlet instance = getCurrentInstance().appContext.app.config.globalProperties.$env\n\nconst props = defineProps({\n context: Object\n})\nconst store = useStore();\n\nlet listOfValues = computed(() => {\n return props.context.value;\n})\n\nlet selection;\nlet voc = props.context.attrs.voc;\nlet matches = ref({\n value: { name: '--- Type in anything for a live search of the vocabulary ---' }\n})\nlet activeList = ref()\nlet dropdownList = ref(null)\nlet inputText = ref({})\nlet cacheList = [];\nlet annifList = [];\nlet annifTrigger = ref({\n value: false\n});\nlet initialValues = ref();\nlet annifSelectionList = ref({})\n\nonMounted(async () => {\n inputText.value = \"\"\n});\n\nwatch(matches, async () => { })\nwatch(annifSelectionList, async () => { })\n\nconst requestURIname = async (res) => {\n\n if (res != undefined) {\n let vocMatch =\n voc === \"iana-media-types\" ||\n voc === \"spdx-checksum-algorithm\";\n\n let name;\n\n await store.dispatch('dpiStore/requestResourceName', { voc: voc, uri: res, envs: instance }).then(\n (response) => {\n if (props.context.attrs.property === 'dcatde:politicalGeocodingURI') {\n if (response != undefined) {\n let result = vocMatch\n ? response.data.result.results\n .filter((dataset) => dataset.resource === res)\n .map((dataset) => dataset.alt_label)[0].en\n : getTranslationFor(response.data.result.alt_label, 'en', []);\n name = result;\n }\n } else {\n\n if (response != undefined) {\n let result = vocMatch\n ? response.data.result.results\n .filter((dataset) => dataset.resource === res)\n .map((dataset) => dataset.pref_label)[0].en\n : getTranslationFor(response.data.result.pref_label, 'en', []);\n name = result;\n\n }\n }\n }\n );\n return name\n }\n\n}\n\nwatchEffect(async () => {\n const values = listOfValues.value;\n\n // single URI's\n if (values.hasOwnProperty('name')) {\n if (values.name === values.resource) {\n let uriName;\n if (!props.context.attrs.multiple) {\n uriName = requestURIname(values.resource)\n props.context.node.input({ name: await uriName, resource: values.resource })\n\n }\n }\n }\n // multiple URI's\n if (values.length >= 1) {\n let uriNameList = [];\n for (let index = 0; index < values.length; index++) {\n if (values[index].name === values[index].resource) {\n uriNameList.push({ name: await requestURIname(values[index].resource), resource: values[index].resource })\n props.context.node.input(uriNameList)\n }\n }\n }\n});\nfunction findPropertyToUpdate(trigger) {\n\n let finalPath = { step: '', prop: props.context.node.name }\n let pathToLocalStorage = JSON.parse(localStorage.getItem('dpi_datasets'));\n\n for (let index = 0; index < Object.keys(pathToLocalStorage).length; index++) {\n for (let innerIndex = 0; innerIndex < Object.keys(pathToLocalStorage)[index].length; innerIndex++) {\n let ntry = Object.entries((pathToLocalStorage))\n try {\n Object.keys(ntry[index][innerIndex]).filter(e => {\n if (e === props.context.node.name) {\n finalPath.step = ntry[index][0]\n\n if (trigger === 'erase') {\n\n selection = {}\n pathToLocalStorage[finalPath.step][finalPath.prop] = selection\n }\n if (typeof selection === 'object') {\n\n pathToLocalStorage[finalPath.step][finalPath.prop] = selection\n }\n else pathToLocalStorage[finalPath.step][finalPath.prop] = selection\n localStorage.setItem('dpi_datasets', JSON.stringify(pathToLocalStorage))\n }\n });\n } catch (error) {\n }\n }\n }\n\n window.removeEventListener(\"click\", onClickOutside);\n}\nonClickOutside(dropdownList, event => activeList.value = false)\nlet annifHandlerTheme = async (input, limit) => {\n\n let finalLimit = 10;\n if (limit != undefined) {\n finalLimit = finalLimit + 10\n }\n\n let query = qs.stringify({\n 'text': input,\n 'limit': finalLimit\n });\n\n\n var config = {\n method: 'post',\n url: voc == \"eurovoc\"\n ? instance.content.dataProviderInterface.annifLinkSubject\n : instance.content.dataProviderInterface.annifLinkTheme,\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n 'Accept': 'application/json'\n },\n data: query\n };\n\n let list = []\n\n axios(config)\n .then(async (response) => {\n for (let i = 0; i < response.data.results.length; i++) {\n annifList[i] = { \"name\": response.data.results[i].label, \"resource\": response.data.results[i].uri, \"activeValue\": false }\n }\n let annifCacheList = []\n if (listOfValues.value.length > 0) {\n listOfValues.value.forEach(element => {\n annifCacheList.push({ \"name\": element.name, \"resource\": element.resource, \"activeValue\": true })\n });\n }\n if (response.data.results.length > 9) {\n annifList[annifList.length + 1] = { \"name\": \"...\", \"resource\": \"invalid\", \"activeValue\": false }\n }\n\n annifSelectionList.value = eraseDuplicates(annifCacheList, annifList)\n\n })\n .catch(function (error) {\n console.log(error);\n });\n}\nasync function updateAnnifselection(item) {\n\n if (item.resource === 'invalid') {\n fillAnnifsuggestions(5);\n }\n else {\n setValue({ name: item.name, resource: item.resource })\n fillAnnifsuggestions()\n }\n\n\n}\nfunction eraseDuplicates(array1, array2) {\n\n let mergedArray = array1.concat(array2);\n let filteredArray = [];\n let resourceSet = new Set();\n\n mergedArray.forEach(obj => {\n if (!resourceSet.has(obj.resource)) {\n resourceSet.add(obj.resource);\n if (!obj.activeValue) {\n filteredArray.push(obj);\n }\n }\n });\n\n\n return filteredArray;\n}\nconst fillAnnifsuggestions = async (limitChange) => {\n\n let arr = getNode('Mandatory').value['dct:description']\n for (let i = 0; i < arr.length; i++) {\n if (arr[i]['@language'] === 'en') {\n if (limitChange != undefined) {\n await annifHandlerTheme(arr[i]['@value'], 5)\n }\n else await annifHandlerTheme(arr[i]['@value'])\n }\n }\n\n}\n\n// Need to append the classes to the formkit-outer element\nprops.context.classes.outer += ' autocompleteInput ' + props.context.attrs.identifier\n\nconst setValue = async (e) => {\n if (Object.keys(e).length === 1) {\n return\n }\n if (listOfValues.value.length > 0) {\n\n cacheList = listOfValues.value\n }\n\n // when its a multi input\n if (props.context.attrs.multiple) {\n // check for doubled values\n if (cacheList.length != 0) {\n let filteredProperty = { name: e.name, resource: e.resource };\n let filteredList = cacheList.filter((element) => element.name != e.name);\n filteredList.push(filteredProperty)\n selection = filteredList;\n await props.context.node.input(selection);\n\n }\n else {\n cacheList.push({ name: e.name, resource: e.resource })\n selection = cacheList\n await props.context.node.input(selection);\n }\n\n }\n else if (e.resource === \"invalid\") return\n else if (e === \"erase\") { await props.context.node.input({}); findPropertyToUpdate(e) }\n else {\n selection = { name: e.name, resource: e.resource };\n await props.context.node.input(selection);\n }\n findPropertyToUpdate();\n}\n\nconst getAutocompleteSuggestions = async (e) => {\n let innerText = e.target.value\n\n await store.dispatch('dpiStore/requestAutocompleteSuggestions', { voc: voc, text: innerText, base: instance.api.baseUrl }).then((response) => {\n const results = response.data.result.results.map((r) => ({\n name: getTranslationFor(r.pref_label, 'en', []) + \" (\" + r.id + \")\",\n resource: r.resource,\n }));\n if (results.length === 0) {\n matches.value = { value: { name: '--- No match found ---' } }\n }\n else matches.value = results;\n });\n}\n\nfunction removeProperty(e) {\n props.context.node.input({})\n setValue('erase');\n}\nfunction removeMultipleProperty(e) {\n\n if (instance.content.dataProviderInterface.annifIntegration) {\n fillAnnifsuggestions()\n }\n if (listOfValues.value.length > 0) {\n cacheList = listOfValues.value\n }\n // Get Index in the array where all values of the Span are stored and cut it out of the list of Values\n cacheList.splice(cacheList.findIndex((element) => element.name == e.name), 1)\n selection = cacheList;\n props.context.node.input(selection);\n findPropertyToUpdate();\n}\n</script>"],"names":["instance","getCurrentInstance","props","__props","store","useStore","listOfValues","computed","selection","voc","matches","ref","activeList","dropdownList","inputText","cacheList","annifList","annifTrigger","annifSelectionList","onMounted","watch","requestURIname","res","vocMatch","name","response","dataset","getTranslationFor","watchEffect","values","uriName","uriNameList","index","findPropertyToUpdate","trigger","finalPath","pathToLocalStorage","innerIndex","ntry","e","onClickOutside","event","annifHandlerTheme","input","limit","finalLimit","query","qs","config","axios","i","annifCacheList","element","eraseDuplicates","error","updateAnnifselection","item","fillAnnifsuggestions","setValue","array1","array2","mergedArray","filteredArray","resourceSet","obj","limitChange","arr","getNode","filteredProperty","filteredList","getAutocompleteSuggestions","innerText","results","r","removeProperty","removeMultipleProperty"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAoFA,QAAIA,IAAWC,EAAkB,EAAG,WAAW,IAAI,OAAO,iBAAiB;AAE3E,UAAMC,IAAQC,GAGRC,IAAQC,GAAQ;AAEtB,QAAIC,IAAeC,EAAS,MACnBL,EAAM,QAAQ,KACtB,GAEGM,GACAC,IAAMP,EAAM,QAAQ,MAAM,KAC1BQ,IAAUC,EAAI;AAAA,MAChB,OAAO,EAAE,MAAM,+DAAgE;AAAA,IACjF,CAAC,GACGC,IAAaD,EAAK,GAClBE,IAAeF,EAAI,IAAI,GACvBG,IAAYH,EAAI,EAAE,GAClBI,IAAY,CAAA,GACZC,IAAY,CAAA,GACZC,IAAeN,EAAI;AAAA,MACrB,OAAO;AAAA,IACT,CAAC;AACmB,IAAAA,EAAM;AAC1B,QAAIO,IAAqBP,EAAI,EAAE;AAE/B,IAAAQ,EAAU,YAAY;AACpB,MAAAL,EAAU,QAAQ;AAAA,IACpB,CAAC,GAEDM,EAAMV,GAAS,YAAY;AAAA,KAAG,GAC9BU,EAAMF,GAAoB,YAAY;AAAA,KAAG;AAEzC,UAAMG,IAAiB,OAAOC,MAAQ;AAEpC,UAAIA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;;;;;;;;;;;;;;;"}
|
|
@@ -1,71 +1,73 @@
|
|
|
1
|
-
import { ref as m, resolveComponent as
|
|
2
|
-
import
|
|
3
|
-
import { onClickOutside as
|
|
4
|
-
|
|
1
|
+
import { ref as m, resolveComponent as M, openBlock as o, createElementBlock as a, createElementVNode as s, toDisplayString as y, createTextVNode as v, withDirectives as V, isRef as O, vModelText as j, unref as c, Fragment as _, renderList as x, createCommentVNode as p, createBlock as S, createVNode as I } from "vue";
|
|
2
|
+
import L from "./AutocompleteInput.vue.mjs";
|
|
3
|
+
import { onClickOutside as N } from "../../external/@vueuse/core/index";
|
|
4
|
+
import "./ConditionalInput.vue2.mjs";
|
|
5
|
+
const T = { class: "formkitProperty" }, w = { class: "formkitCmpWrap simpleConditional" }, B = { class: "m-3" }, D = { class: "conditionalSelectDiv" }, F = { key: 0 }, E = { class: "selectListConditional" }, H = { class: "conditionalManual" }, K = {
|
|
5
6
|
key: 0,
|
|
6
7
|
class: "d-flex"
|
|
7
8
|
}, P = {
|
|
8
9
|
key: 0,
|
|
9
10
|
class: "conditionalVocabulary"
|
|
10
|
-
},
|
|
11
|
+
}, q = {
|
|
11
12
|
__name: "ConditionalInput",
|
|
12
13
|
props: {
|
|
13
14
|
context: Object
|
|
14
15
|
},
|
|
15
|
-
setup(
|
|
16
|
-
const e =
|
|
17
|
-
let
|
|
18
|
-
const f = m(null),
|
|
19
|
-
|
|
20
|
-
},
|
|
21
|
-
|
|
16
|
+
setup(k) {
|
|
17
|
+
const e = k;
|
|
18
|
+
let l = m(), t = m(!1), u = m(!1);
|
|
19
|
+
const f = m(null), b = (r) => {
|
|
20
|
+
u.value = !u.value;
|
|
21
|
+
}, h = (r) => {
|
|
22
|
+
l.value = r.target.innerHTML, r.target.innerHTML === "Manually" ? t.value = "manually" : t.value = "vocabulary", e.context.node.reset(), console.log(t.value);
|
|
22
23
|
};
|
|
23
|
-
return
|
|
24
|
-
const C =
|
|
25
|
-
return
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
return N(f, (r) => u.value = !1), Object.keys(e.context.value)[0] === "dct:title" && (l.value = "Manually", t.value = "manually"), Object.keys(e.context.value)[0] === "name" && (l.value = "Vocabulary", t.value = "vocabulary"), (r, i) => {
|
|
25
|
+
const C = M("FormKit");
|
|
26
|
+
return o(), a("div", T, [
|
|
27
|
+
s("h4", null, y(e.context.attrs.identifier), 1),
|
|
28
|
+
v(),
|
|
29
|
+
s("div", w, [
|
|
30
|
+
s("div", B, [
|
|
31
|
+
s("div", D, [
|
|
32
|
+
V(s("input", {
|
|
32
33
|
ref_key: "I1",
|
|
33
34
|
ref: f,
|
|
34
35
|
type: "text",
|
|
35
36
|
class: "conditionalSelect formkit-input formkit-inner",
|
|
36
|
-
onClick:
|
|
37
|
+
onClick: i[0] || (i[0] = (n) => b()),
|
|
37
38
|
placeholder: "Choose input method",
|
|
38
|
-
"onUpdate:modelValue":
|
|
39
|
+
"onUpdate:modelValue": i[1] || (i[1] = (n) => O(l) ? l.value = n : l = n)
|
|
39
40
|
}, null, 512), [
|
|
40
|
-
[
|
|
41
|
+
[j, c(l)]
|
|
41
42
|
]),
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
(
|
|
43
|
+
v(),
|
|
44
|
+
c(u) ? (o(), a("div", F, [
|
|
45
|
+
s("ul", E, [
|
|
46
|
+
(o(!0), a(_, null, x(e.context.attrs.selection, (n, d) => (o(), a("li", {
|
|
46
47
|
class: "p-2 border-b border-gray-200",
|
|
47
|
-
onClick:
|
|
48
|
-
},
|
|
48
|
+
onClick: i[2] || (i[2] = (g) => h(g))
|
|
49
|
+
}, y(n), 1))), 256))
|
|
49
50
|
])
|
|
50
|
-
])) :
|
|
51
|
+
])) : p("", !0)
|
|
51
52
|
]),
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
(
|
|
56
|
-
type:
|
|
57
|
-
placeholder:
|
|
58
|
-
name:
|
|
59
|
-
validation:
|
|
53
|
+
v(),
|
|
54
|
+
s("div", H, [
|
|
55
|
+
c(t) === "manually" || Object.keys(e.context.value).length > 0 && e.context.value["foaf:name"] && c(t) != "vocabulary" ? (o(), a("div", K, [
|
|
56
|
+
(o(!0), a(_, null, x(e.context.attrs.options, (n, d) => (o(), S(C, {
|
|
57
|
+
type: d,
|
|
58
|
+
placeholder: d,
|
|
59
|
+
name: n,
|
|
60
|
+
validation: d,
|
|
61
|
+
class: "w-100"
|
|
60
62
|
}, null, 8, ["type", "placeholder", "name", "validation"]))), 256))
|
|
61
|
-
])) :
|
|
63
|
+
])) : p("", !0)
|
|
62
64
|
]),
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
v(),
|
|
66
|
+
c(t) === "vocabulary" || Object.keys(e.context.value).length > 0 && e.context.value.name && c(t) != "manually" ? (o(), a("div", P, [
|
|
67
|
+
I(L, {
|
|
66
68
|
context: e.context
|
|
67
69
|
}, null, 8, ["context"])
|
|
68
|
-
])) :
|
|
70
|
+
])) : p("", !0)
|
|
69
71
|
])
|
|
70
72
|
])
|
|
71
73
|
]);
|
|
@@ -73,6 +75,6 @@ const j = { class: "formkitProperty" }, B = { class: "formkitCmpWrap simpleCondi
|
|
|
73
75
|
}
|
|
74
76
|
};
|
|
75
77
|
export {
|
|
76
|
-
|
|
78
|
+
q as default
|
|
77
79
|
};
|
|
78
80
|
//# sourceMappingURL=ConditionalInput.vue.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConditionalInput.vue.mjs","sources":["../../../lib/data-provider-interface/components/ConditionalInput.vue"],"sourcesContent":["<
|
|
1
|
+
{"version":3,"file":"ConditionalInput.vue.mjs","sources":["../../../lib/data-provider-interface/components/ConditionalInput.vue"],"sourcesContent":["<template>\n <div class=\"formkitProperty\">\n <h4>{{ props.context.attrs.identifier }}</h4>\n <div class=\"formkitCmpWrap simpleConditional\">\n <div class=\"m-3\">\n <div class=\"conditionalSelectDiv\">\n <input ref=\"I1\" type=\"text\" class=\"conditionalSelect formkit-input formkit-inner\" @click=\"openSelect($event)\"\n placeholder=\"Choose input method\" v-model=\"selectModeVal\">\n <div v-if=\"showSelect\">\n <ul class=\"selectListConditional\">\n <li v-for=\"el, index in props.context.attrs.selection\" class=\"p-2 border-b border-gray-200 \"\n @click=\"selectMode($event)\">{{ el }}</li>\n </ul>\n </div>\n </div>\n <div class=\"conditionalManual\">\n <div class=\"d-flex\" v-if=\"selectedItem === 'manually' ||\n Object.keys(props.context.value).length > 0 && props.context.value['foaf:name']\n && selectedItem != 'vocabulary'\">\n <FormKit v-for=\"el, key in props.context.attrs.options\" :type=\"key\" :placeholder=\"key\" :name=\"el\"\n :validation=\"key\" class=\"w-100\"></FormKit>\n </div>\n </div>\n <div v-if=\"selectedItem === 'vocabulary' || Object.keys(props.context.value).length > 0\n && props.context.value.name && selectedItem != 'manually'\" class=\"conditionalVocabulary\">\n <AutocompleteInput :context=\"props.context\"></AutocompleteInput>\n </div>\n \n \n </div>\n\n </div>\n </div>\n\n</template>\n<script setup>\nimport { ref } from 'vue';\nimport AutocompleteInput from './AutocompleteInput.vue';\nimport { onClickOutside } from '@vueuse/core'\n\nconst props = defineProps({\n context: Object,\n})\nlet selectModeVal = ref()\nlet selectedItem = ref(false)\nlet showSelect = ref(false)\nconst I1 = ref(null)\n\nconst openSelect = (e) => {\n\n showSelect.value = !showSelect.value\n\n}\nconst selectMode = (e) => {\n selectModeVal.value = e.target.innerHTML\n if (e.target.innerHTML === 'Manually') {\n selectedItem.value = \"manually\"\n }\n else selectedItem.value = \"vocabulary\"\n props.context.node.reset()\n console.log(selectedItem.value);\n}\nonClickOutside(I1, event => showSelect.value = false)\n// determine which property is already there\nif (Object.keys(props.context.value)[0] === 'dct:title') {\n selectModeVal.value = 'Manually'\n selectedItem.value = 'manually'\n}\nif (Object.keys(props.context.value)[0] === 'name') {\n selectModeVal.value = 'Vocabulary'\n selectedItem.value = 'vocabulary'\n}\n\n</script>\n<style>\n.conditionalManual{\n .formkit-outer{\n width: 100%;\n }\n}\n</style>"],"names":["props","__props","selectModeVal","ref","selectedItem","showSelect","I1","openSelect","e","selectMode","onClickOutside","event"],"mappings":";;;;;;;;;;;;;;;;AAwCA,UAAMA,IAAQC;AAGd,QAAIC,IAAgBC,EAAK,GACrBC,IAAeD,EAAI,EAAK,GACxBE,IAAaF,EAAI,EAAK;AAC1B,UAAMG,IAAKH,EAAI,IAAI,GAEbI,IAAa,CAACC,MAAM;AAExB,MAAAH,EAAW,QAAQ,CAACA,EAAW;AAAA,IAEjC,GACMI,IAAa,CAACD,MAAM;AACxB,MAAAN,EAAc,QAAQM,EAAE,OAAO,WAC3BA,EAAE,OAAO,cAAc,aACzBJ,EAAa,QAAQ,aAElBA,EAAa,QAAQ,cAC1BJ,EAAM,QAAQ,KAAK,MAAO,GAC1B,QAAQ,IAAII,EAAa,KAAK;AAAA,IAChC;AACA,WAAAM,EAAeJ,GAAI,CAAAK,MAASN,EAAW,QAAQ,EAAK,GAEhD,OAAO,KAAKL,EAAM,QAAQ,KAAK,EAAE,CAAC,MAAM,gBAC1CE,EAAc,QAAQ,YACtBE,EAAa,QAAQ,aAEnB,OAAO,KAAKJ,EAAM,QAAQ,KAAK,EAAE,CAAC,MAAM,WAC1CE,EAAc,QAAQ,cACtBE,EAAa,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConditionalInput.vue2.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -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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,KAAAZ,EAAA,IAAA,EAAA;AAAA,UAAAN,EAAA;AAAA,UA4BmBI,EAAI,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,QAAAxB,EAC5D,KAAA;AAAA,UADgE,MAAMuB,EAAO,QAAC;AAAA,aAClGA,EAAO,QAAC,KAAK,GAhCnB,GAAAhB,EAAA;AAAA,YAAAW,EAAA,IAAA,EAAA;AAAA,MAAAN,EAAA;AAAA,MAiCeI,EAAe,mBAAIA,EAAe,gBAAC,UAA9CR,KAAAC,EAKM,OALN0B,IAKM;AAAA,QAJoCnB,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","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licence: "http://
|
|
2
|
+
licence: "http://publications.europa.eu/resource/authority/licence/",
|
|
3
3
|
// no unified URI!!
|
|
4
4
|
"planned-availability": "http://publications.europa.eu/resource/authority/planned-availability/",
|
|
5
5
|
"dataset-type": "http://publications.europa.eu/resource/authority/dataset-type/",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vocab-prefixes.mjs","sources":["../../../../lib/data-provider-interface/config/dcatap/vocab-prefixes.js"],"sourcesContent":["const vocabPrefixes = {\n \"licence\": \"http://
|
|
1
|
+
{"version":3,"file":"vocab-prefixes.mjs","sources":["../../../../lib/data-provider-interface/config/dcatap/vocab-prefixes.js"],"sourcesContent":["const vocabPrefixes = {\n \"licence\": \"http://publications.europa.eu/resource/authority/licence/\", // no unified URI!!\n \"planned-availability\": \"http://publications.europa.eu/resource/authority/planned-availability/\",\n \"dataset-type\": \"http://publications.europa.eu/resource/authority/dataset-type/\",\n \"eurovoc\": \"http://eurovoc.europa.eu/\",\n \"corporate-body\": \"http://publications.europa.eu/resource/authority/corporate-body/\",\n \"continent\": \"http://publications.europa.eu/resource/authority/continent/\",\n \"country\": \"http://publications.europa.eu/resource/authority/country/\",\n \"place\": \"http://publications.europa.eu/resource/authority/place/\",\n \"data-theme\": \"http://publications.europa.eu/resource/authority/data-theme/\",\n \"access-right\": \"http://publications.europa.eu/resource/authority/access-right/\",\n \"file-type\": \"http://publications.europa.eu/resource/authority/file-type/\",\n \"frequency\": \"http://publications.europa.eu/resource/authority/frequency/\",\n \"language\": \"http://publications.europa.eu/resource/authority/language/\",\n \"notation-type\": \"http://publications.europa.eu/resource/authority/notation-type/\",\n \"iana-media-types\": \"https://www.iana.org/assignments/media-types/\",\n \"spdx-checksum-algorithm\": \"http://spdx.org/rdf/terms#\",\n \"distribution-type\": \"http://publications.europa.eu/resource/authority/distribution-type/\",\n \"dataset-status\": \"http://publications.europa.eu/resource/authority/dataset-status/\",\n};\n\nexport default vocabPrefixes;\n"],"names":["vocabPrefixes"],"mappings":"AAAK,MAACA,IAAgB;AAAA,EAClB,SAAW;AAAA;AAAA,EACX,wBAAwB;AAAA,EACxB,gBAAgB;AAAA,EAChB,SAAW;AAAA,EACX,kBAAkB;AAAA,EAClB,WAAa;AAAA,EACb,SAAW;AAAA,EACX,OAAS;AAAA,EACT,cAAc;AAAA,EACd,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,WAAa;AAAA,EACb,UAAY;AAAA,EACZ,iBAAiB;AAAA,EACjB,oBAAoB;AAAA,EACpB,2BAA2B;AAAA,EAC3B,qBAAqB;AAAA,EACrB,kBAAkB;AACtB;"}
|