Skip to content
Snippets Groups Projects

New: adjusted functionality for the resource view

12 files
+ 22350
143
Compare changes
  • Side-by-side
  • Inline

Files

+ 69
55
@@ -3,49 +3,52 @@
@@ -3,49 +3,52 @@
<b-form-group
<b-form-group
v-bind:class="{ mandatory: checkField(formFieldInformation,'http://www.w3.org/ns/shacl#minCount') && formFieldInformation['http://www.w3.org/ns/shacl#minCount'][0]['value'] >= 1 }"
v-bind:class="{ mandatory: checkField(formFieldInformation,'http://www.w3.org/ns/shacl#minCount') && formFieldInformation['http://www.w3.org/ns/shacl#minCount'][0]['value'] >= 1 }"
:label-for="cssid"
:label-for="cssid"
label-cols-sm="3"
label-cols-sm="4"
label-align-sm="right"
label-align-sm="right"
:label="label"
:label="label"
 
label-class="application-profile-label"
>
>
<b-row>
<b-row>
<b-col>
<b-col>
<multiselect
<multiselect
v-if="checkField(formFieldInformation,'http://www.w3.org/ns/shacl#maxCount') && formFieldInformation['http://www.w3.org/ns/shacl#maxCount'][0]['value'] === 1"
v-if="checkField(formFieldInformation,'http://www.w3.org/ns/shacl#maxCount') && formFieldInformation['http://www.w3.org/ns/shacl#maxCount'][0]['value'] === 1"
:id="cssid"
:id="cssid"
:options="selectableOptions"
:options="selectableOptions"
v-model="selectedOptions"
v-model="selectedOptions"
:multiple="false"
:multiple="false"
:hide-selected="true"
:hide-selected="true"
label="name"
label="name"
track-by="name"
track-by="name"
:required="checkField(formFieldInformation,'http://www.w3.org/ns/shacl#minCount') && formFieldInformation['http://www.w3.org/ns/shacl#minCount'][0]['value'] >= 1"
:placeholder="$t('multiselectPlaceholder')"
:disabled="disabledMode || locked"
:required="checkField(formFieldInformation,'http://www.w3.org/ns/shacl#minCount') && formFieldInformation['http://www.w3.org/ns/shacl#minCount'][0]['value'] >= 1"
@input="input"
:disabled="disabledMode || locked"
@change="input"
@input="input"
></multiselect>
@change="input"
<multiselect
></multiselect>
v-else
<multiselect
:id="cssId"
v-else
:options="selectableOptions"
:id="cssId"
v-model="selectedOptions"
:options="selectableOptions"
:multiple="true"
v-model="selectedOptions"
:hide-selected="true"
:multiple="true"
label="name"
:hide-selected="true"
track-by="name"
label="name"
:max="this.formFieldInformation['http://www.w3.org/ns/shacl#maxCount'] !== undefined && this.formFieldInformation['http://www.w3.org/ns/shacl#maxCount'][0] !== undefined && formFieldInformation['http://www.w3.org/ns/shacl#maxCount'][0]['value'] !== undefined ? parseInt(formFieldInformation['http://www.w3.org/ns/shacl#maxCount'][0]['value']) : maxNumberOfSelectedObjects"
track-by="name"
:disabled="disabledMode || locked"
:placeholder="$t('multiselectPlaceholder')"
:required="checkField(formFieldInformation,'http://www.w3.org/ns/shacl#minCount') && formFieldInformation['http://www.w3.org/ns/shacl#minCount'][0]['value'] >= 1"
:max="this.formFieldInformation['http://www.w3.org/ns/shacl#maxCount'] !== undefined && this.formFieldInformation['http://www.w3.org/ns/shacl#maxCount'][0] !== undefined && formFieldInformation['http://www.w3.org/ns/shacl#maxCount'][0]['value'] !== undefined ? parseInt(formFieldInformation['http://www.w3.org/ns/shacl#maxCount'][0]['value']) : maxNumberOfSelectedObjects"
@input="input"
:disabled="disabledMode || locked"
@change="input"
:required="checkField(formFieldInformation,'http://www.w3.org/ns/shacl#minCount') && formFieldInformation['http://www.w3.org/ns/shacl#minCount'][0]['value'] >= 1"
></multiselect>
@input="input"
</b-col>
@change="input"
<b-col v-if="fixedValueMode" class="lock-colum col-sm-2">
></multiselect>
<b-button :disabled="disabledMode || !checkField(formData,nodeName) || (checkField(formData,nodeName) && formData[nodeName][0]['value'] ==='')" class="lockButton" variant="outline-secondary" @click.prevent="changeLockable()">
</b-col>
<LockIcon v-if="locked"/>
<b-col v-if="fixedValueMode" class="lock-colum col-sm-2">
<LockOpenIcon v-else />
<b-button :disabled="disabledMode || !checkField(formData,nodeName) || (checkField(formData,nodeName) && formData[nodeName][0]['value'] ==='')" class="lockButton" variant="outline-secondary" @click.prevent="changeLockable()">
</b-button>
<LockIcon v-if="locked"/>
</b-col>
<LockOpenIcon v-else />
</b-row>
</b-button>
 
</b-col>
 
</b-row>
</b-form-group>
</b-form-group>
</div>
</div>
</template>
</template>
@@ -65,9 +68,22 @@ import { MetadataApi, defaultOnCatch } from '@coscine/api-connection';
@@ -65,9 +68,22 @@ import { MetadataApi, defaultOnCatch } from '@coscine/api-connection';
import FieldReader from '../util/FieldReader';
import FieldReader from '../util/FieldReader';
 
import locales from '../locale/locales';
 
import VueI18n from 'vue-i18n';
 
Vue.use(VueI18n);
 
 
const i18n = new VueI18n({
 
locale: 'en', // set locale
 
messages: locales, // set locale messages
 
silentFallbackWarn: true,
 
});
 
export default Vue.extend({
export default Vue.extend({
 
i18n,
name: 'InputCombobox',
name: 'InputCombobox',
beforeMount() {
beforeMount() {
 
i18n.locale = LanguageUtil.getLanguage();
 
this.label = FieldReader.getLocalizedField(
this.label = FieldReader.getLocalizedField(
this.formFieldInformation,
this.formFieldInformation,
this.languageCode,
this.languageCode,
@@ -93,6 +109,10 @@ export default Vue.extend({
@@ -93,6 +109,10 @@ export default Vue.extend({
if (this.checkField(this.formFieldInformation,'http://www.w3.org/ns/shacl#defaultValue')) {
if (this.checkField(this.formFieldInformation,'http://www.w3.org/ns/shacl#defaultValue')) {
this.$set(this.formData,this.nodeName, [{'value': this.formFieldInformation['http://www.w3.org/ns/shacl#defaultValue'][0].value}]);
this.$set(this.formData,this.nodeName, [{'value': this.formFieldInformation['http://www.w3.org/ns/shacl#defaultValue'][0].value}]);
}
}
 
// take the default value from the alt provided values of the ap
 
if (this.checkField(this.formFieldInformation,'https://purl.org/coscine/defaultValue')) {
 
this.$set(this.formData,this.nodeName, [{'value': this.formFieldInformation['https://purl.org/coscine/defaultValue'][0].value}]);
 
}
// take the default value from the provided values
// take the default value from the provided values
if (this.checkField(this.fixedValues[this.formFieldInformation['idForFixedValues']],'https://purl.org/coscine/defaultValue')) {
if (this.checkField(this.fixedValues[this.formFieldInformation['idForFixedValues']],'https://purl.org/coscine/defaultValue')) {
this.$set(this.formData,this.nodeName, [{'value': this.fixedValues[this.formFieldInformation['idForFixedValues']]['https://purl.org/coscine/defaultValue'][0].value}]);
this.$set(this.formData,this.nodeName, [{'value': this.fixedValues[this.formFieldInformation['idForFixedValues']]['https://purl.org/coscine/defaultValue'][0].value}]);
@@ -109,7 +129,9 @@ export default Vue.extend({
@@ -109,7 +129,9 @@ export default Vue.extend({
// set the datatype
// set the datatype
this.$set(this.formData[this.nodeName][0],'type', 'uri');
this.$set(this.formData[this.nodeName][0],'type', 'uri');
this.updateFixedValues();
if (this.fixedValueMode) {
 
this.updateFixedValues();
 
}
},
},
mounted() {
mounted() {
MetadataApi.getVocabulary(
MetadataApi.getVocabulary(
@@ -129,7 +151,9 @@ export default Vue.extend({
@@ -129,7 +151,9 @@ export default Vue.extend({
},
},
defaultOnCatch,
defaultOnCatch,
);
);
this.updateFixedValues();
if (this.fixedValueMode) {
 
this.updateFixedValues();
 
}
},
},
data() {
data() {
return {
return {
@@ -190,7 +214,7 @@ export default Vue.extend({
@@ -190,7 +214,7 @@ export default Vue.extend({
}
}
this.removeEmptyEntry();
this.removeEmptyEntry();
},
},
changeLockable() {
changeLockable() {
if(this.fixedValues[this.formFieldInformation['idForFixedValues']] === undefined || this.fixedValues[this.formFieldInformation['idForFixedValues']]['https://purl.org/coscine/fixedValue'] === undefined){
if(this.fixedValues[this.formFieldInformation['idForFixedValues']] === undefined || this.fixedValues[this.formFieldInformation['idForFixedValues']]['https://purl.org/coscine/fixedValue'] === undefined){
this.$set(this.fixedValues,this.formFieldInformation['idForFixedValues'], {'https://purl.org/coscine/fixedValue': [{'value':this.formData[this.nodeName][0]['value'],'type': 'uri'}]});
this.$set(this.fixedValues,this.formFieldInformation['idForFixedValues'], {'https://purl.org/coscine/fixedValue': [{'value':this.formData[this.nodeName][0]['value'],'type': 'uri'}]});
this.locked = true;
this.locked = true;
@@ -204,7 +228,7 @@ export default Vue.extend({
@@ -204,7 +228,7 @@ export default Vue.extend({
props: {
props: {
formFieldInformation: Object,
formFieldInformation: Object,
formData: Object,
formData: Object,
resourceId: String,
resourceId: String,
fixedValues: Object,
fixedValues: Object,
fixedValueMode: Boolean,
fixedValueMode: Boolean,
projectId: String,
projectId: String,
@@ -220,7 +244,7 @@ export default Vue.extend({
@@ -220,7 +244,7 @@ export default Vue.extend({
<style>
<style>
.multiselect {
.multiselect {
height: calc(1.4em + 0.75rem + 2px);
height: auto;
}
}
.multiselect__input {
.multiselect__input {
border: 0px !important;
border: 0px !important;
@@ -261,14 +285,4 @@ export default Vue.extend({
@@ -261,14 +285,4 @@ export default Vue.extend({
<!-- Add "scoped" attribute to limit CSS to this component only -->
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
<style scoped>
.multiselect {
height: calc(1.4em + 0.75rem + 2px);
}
.multiselect__input {
border: 0px;
height: calc(1.4em + 0.75rem + 2px);
}
.multiselect__tags {
border-radius: 0px;
}
</style>
</style>
Loading