Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • Experimental/Bugfixes
  • Hotfix/1129-fixValidation
  • Hotfix/1140-fixFixedValues
  • Hotfix/1142-fixFixedValues
  • Hotfix/1197-Datepicker
  • Hotfix/1216-fixDateDesign
  • Hotfix/2233-fixMe
  • Hotfix/2258-saveButtonWorksAsExpected
  • Hotfix/2296-selectedValuesNotReturned
  • Hotfix/2417-emptyMetadataValidation
  • Hotfix/2504-formGen
  • Hotfix/2504-formGenerator
  • Hotfix/2681-validationErrors
  • Hotfix/2955-storingFail
  • Hotfix/2957-styleAndUpgrade
  • Hotfix/845-someUIChanges
  • Hotfix/920-multiSelect
  • Hotfix/xxxx-infiniteLoops
  • Hotfix/xxxx-nodePath
  • Hotfix/xxxx-notEmptyFields
  • Issue/1607-dateTimeOffset
  • Issue/1607-newDateTimeOffset
  • Issue/1804-fixedValueFix
  • Issue/1804-fixedValueFixOld
  • Issue/1826-versioning
  • Issue/1938-internalHandling
  • Issue/1987-shIn
  • Issue/2002-migrateResourceCreate
  • Issue/2035-rcv
  • Issue/2117-ProjectandResourceCreateInfoIcons
  • Issue/2139-detailViewing
  • Issue/2262-frontendWorkspace
  • Issue/2309-docs
  • Issue/2318-fixedValuesFix
  • Issue/2341-description
  • Issue/2345-dealWithWeirdLists
  • Issue/2353-dropShapeFix
  • Issue/2408-hasValue
  • Issue/2435-userApi
  • Issue/2516-validationUpdate
  • Issue/2525-fixedFixValues
  • Issue/2551-enhanceSymbolDescriptionsInApplicationProfile
  • Issue/2598-vue3
  • Issue/2703-vocabularyList
  • Issue/2729-fixSlowLoadingOfInstances
  • Issue/2759-showMissingField
  • Issue/2804-templateUI
  • Issue/2805-ignoreTemplatingValues
  • Issue/2851-fixBooleanInFormGenerator
  • Issue/2920-fixRemovingValues
  • Issue/2943-uiFeedback
  • Issue/2960-fixValidationForAP
  • Issue/2960-infiniteLoop
  • Issue/43-saveButton
  • Issue/xxxx-correctTargetClass
  • Issue/xxxx-extensions
  • Issue/xxxx-infiniteLoop
  • Issue/xxxx-instances
  • Issue/xxxx-optimizedBuild
  • Issue/xxxx-reduceBootstrapVueBundle
  • Product/1107-frontendPerformance
  • Product/1210-inheritance
  • Product/1215-gitlabCleanUp
  • Product/1532-formGeneratorFeatures
  • Product/1573-ReadOnlyResources
  • Product/1576-formGeneratorMultiselect
  • Product/510-niceProjectUrl
  • Product/619-clientValidation
  • Product/791-uiAdaptions
  • Product/801-refactorFileMetadata
  • Product/815-cleanupApplicationProfiles
  • Sprint/2020-09
  • Sprint/2020-10
  • Sprint/2020-11
  • Sprint/2020-12
  • Sprint/2020-13
  • Sprint/2020-14
  • Sprint/2020-18
  • Sprint/2020-19
  • Sprint/2021-12
  • Sprint/2021-13
  • Sprint/2021-14
  • Sprint/2021-15
  • Sprint/2021-2022
  • Sprint/2021-22
  • Sprint/2022-01
  • Test/vue-demi
  • Topic/1065-clientValidation
  • Topic/1227-frontendPerformance
  • Topic/1229-inheritance
  • Topic/1533-formGeneratorCleanup
  • Topic/1535-formGeneratorMultiselect
  • Topic/1535-linting
  • Topic/795-uiAdaptions
  • Topic/804-niceProjectUrl
  • Topic/846-cleanupApplicationProfiles
  • Topic/853-refactorFileMetadataFE
  • dev
  • gitkeep
  • gitpod
  • v1.0.0
  • v1.1.0
  • v1.10.0
  • v1.10.1
  • v1.10.2
  • v1.11.0
  • v1.12.0
  • v1.13.0
  • v1.14.0
  • v1.15.0
  • v1.15.1
  • v1.16.0
  • v1.17.0
  • v1.18.0
  • v1.2.0
  • v1.3.0
  • v1.3.1
  • v1.3.2
  • v1.3.3
  • v1.4.0
  • v1.5.0
  • v1.6.0
  • v1.7.0
  • v1.8.0
  • v1.8.1
  • v1.8.2
  • v1.8.3
  • v1.8.4
  • v1.9.0
  • v1.9.1
  • v1.9.2
  • v1.9.3
  • v2.0.0
  • v2.1.0
  • v3.0.0
  • v3.0.1
  • v3.0.10
  • v3.0.11
  • v3.0.12
  • v3.0.2
  • v3.0.3
  • v3.0.4
  • v3.0.5
  • v3.0.6
  • v3.0.7
  • v3.0.8
  • v3.0.9
  • v3.1.0
  • v3.1.1
  • v3.1.2
  • v3.1.3
  • v3.1.4
  • v3.2.0
  • v3.2.1
  • v3.2.2
  • v3.3.0
  • v3.4.0
  • v3.5.0
  • v3.5.1
  • v3.5.2
  • v3.5.3
  • v3.5.4
  • v3.5.5
  • v3.5.6
  • v3.5.7
  • v3.6.0
  • v3.6.1
  • v3.6.2
  • v3.6.3
  • v4.0.0
  • v4.0.1
  • v4.0.2
  • v4.0.3
  • v4.0.4
  • v4.0.5
175 results

Target

Select target project
  • coscine/frontend/libraries/form-generator
1 result
Select Git revision
  • Experimental/Bugfixes
  • Hotfix/1129-fixValidation
  • Hotfix/1140-fixFixedValues
  • Hotfix/1142-fixFixedValues
  • Hotfix/1197-Datepicker
  • Hotfix/1216-fixDateDesign
  • Hotfix/2233-fixMe
  • Hotfix/2258-saveButtonWorksAsExpected
  • Hotfix/2296-selectedValuesNotReturned
  • Hotfix/2417-emptyMetadataValidation
  • Hotfix/2504-formGen
  • Hotfix/2504-formGenerator
  • Hotfix/2681-validationErrors
  • Hotfix/2955-storingFail
  • Hotfix/2957-styleAndUpgrade
  • Hotfix/845-someUIChanges
  • Hotfix/920-multiSelect
  • Hotfix/xxxx-infiniteLoops
  • Hotfix/xxxx-nodePath
  • Hotfix/xxxx-notEmptyFields
  • Issue/1607-dateTimeOffset
  • Issue/1607-newDateTimeOffset
  • Issue/1804-fixedValueFix
  • Issue/1804-fixedValueFixOld
  • Issue/1826-versioning
  • Issue/1938-internalHandling
  • Issue/1987-shIn
  • Issue/2002-migrateResourceCreate
  • Issue/2035-rcv
  • Issue/2117-ProjectandResourceCreateInfoIcons
  • Issue/2139-detailViewing
  • Issue/2262-frontendWorkspace
  • Issue/2309-docs
  • Issue/2318-fixedValuesFix
  • Issue/2341-description
  • Issue/2345-dealWithWeirdLists
  • Issue/2353-dropShapeFix
  • Issue/2408-hasValue
  • Issue/2435-userApi
  • Issue/2516-validationUpdate
  • Issue/2525-fixedFixValues
  • Issue/2551-enhanceSymbolDescriptionsInApplicationProfile
  • Issue/2598-vue3
  • Issue/2703-vocabularyList
  • Issue/2729-fixSlowLoadingOfInstances
  • Issue/2759-showMissingField
  • Issue/2804-templateUI
  • Issue/2805-ignoreTemplatingValues
  • Issue/2851-fixBooleanInFormGenerator
  • Issue/2920-fixRemovingValues
  • Issue/2943-uiFeedback
  • Issue/2960-fixValidationForAP
  • Issue/2960-infiniteLoop
  • Issue/43-saveButton
  • Issue/xxxx-correctTargetClass
  • Issue/xxxx-extensions
  • Issue/xxxx-infiniteLoop
  • Issue/xxxx-instances
  • Issue/xxxx-optimizedBuild
  • Issue/xxxx-reduceBootstrapVueBundle
  • Product/1107-frontendPerformance
  • Product/1210-inheritance
  • Product/1215-gitlabCleanUp
  • Product/1532-formGeneratorFeatures
  • Product/1573-ReadOnlyResources
  • Product/1576-formGeneratorMultiselect
  • Product/510-niceProjectUrl
  • Product/619-clientValidation
  • Product/791-uiAdaptions
  • Product/801-refactorFileMetadata
  • Product/815-cleanupApplicationProfiles
  • Sprint/2020-09
  • Sprint/2020-10
  • Sprint/2020-11
  • Sprint/2020-12
  • Sprint/2020-13
  • Sprint/2020-14
  • Sprint/2020-18
  • Sprint/2020-19
  • Sprint/2021-12
  • Sprint/2021-13
  • Sprint/2021-14
  • Sprint/2021-15
  • Sprint/2021-2022
  • Sprint/2021-22
  • Sprint/2022-01
  • Test/vue-demi
  • Topic/1065-clientValidation
  • Topic/1227-frontendPerformance
  • Topic/1229-inheritance
  • Topic/1533-formGeneratorCleanup
  • Topic/1535-formGeneratorMultiselect
  • Topic/1535-linting
  • Topic/795-uiAdaptions
  • Topic/804-niceProjectUrl
  • Topic/846-cleanupApplicationProfiles
  • Topic/853-refactorFileMetadataFE
  • dev
  • gitkeep
  • gitpod
  • v1.0.0
  • v1.1.0
  • v1.10.0
  • v1.10.1
  • v1.10.2
  • v1.11.0
  • v1.12.0
  • v1.13.0
  • v1.14.0
  • v1.15.0
  • v1.15.1
  • v1.16.0
  • v1.17.0
  • v1.18.0
  • v1.2.0
  • v1.3.0
  • v1.3.1
  • v1.3.2
  • v1.3.3
  • v1.4.0
  • v1.5.0
  • v1.6.0
  • v1.7.0
  • v1.8.0
  • v1.8.1
  • v1.8.2
  • v1.8.3
  • v1.8.4
  • v1.9.0
  • v1.9.1
  • v1.9.2
  • v1.9.3
  • v2.0.0
  • v2.1.0
  • v3.0.0
  • v3.0.1
  • v3.0.10
  • v3.0.11
  • v3.0.12
  • v3.0.2
  • v3.0.3
  • v3.0.4
  • v3.0.5
  • v3.0.6
  • v3.0.7
  • v3.0.8
  • v3.0.9
  • v3.1.0
  • v3.1.1
  • v3.1.2
  • v3.1.3
  • v3.1.4
  • v3.2.0
  • v3.2.1
  • v3.2.2
  • v3.3.0
  • v3.4.0
  • v3.5.0
  • v3.5.1
  • v3.5.2
  • v3.5.3
  • v3.5.4
  • v3.5.5
  • v3.5.6
  • v3.5.7
  • v3.6.0
  • v3.6.1
  • v3.6.2
  • v3.6.3
  • v4.0.0
  • v4.0.1
  • v4.0.2
  • v4.0.3
  • v4.0.4
  • v4.0.5
175 results
Show changes
Commits on Source (8)
...@@ -9,16 +9,18 @@ tasks: ...@@ -9,16 +9,18 @@ tasks:
init: | init: |
yarn install yarn install
yarn build yarn build
yarn link
gp sync-done bundle gp sync-done bundle
command: yarn dev command: yarn dev
- name: frontend - name: frontend
before: cd ../frontend before: cd ../frontend
init: | init: |
gp sync-await bundle gp sync-await bundle
yarn link "@coscine/form-generator" yarn link ../form-generator
yarn install yarn install
command: yarn dev command: yarn dev
vscode: vscode:
extensions: extensions:
- lukashass.volar - arcanis.vscode-zipfs
- dbaeumer.vscode-eslint
- esbenp.prettier-vscode
- vue.volar
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
"recommendations": [ "recommendations": [
"arcanis.vscode-zipfs", "arcanis.vscode-zipfs",
"dbaeumer.vscode-eslint", "dbaeumer.vscode-eslint",
"esbenp.prettier-vscode" "esbenp.prettier-vscode",
"vue.volar"
] ]
} }
...@@ -6,6 +6,8 @@ This repository contains the [SHACL](https://www.w3.org/TR/shacl/) form-generato ...@@ -6,6 +6,8 @@ This repository contains the [SHACL](https://www.w3.org/TR/shacl/) form-generato
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://git.rwth-aachen.de/coscine/frontend/libraries/form-generator) [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://git.rwth-aachen.de/coscine/frontend/libraries/form-generator)
(For a specific branch, build such a URL: `https://gitpod.io/#https://git.rwth-aachen.de/coscine/frontend/libraries/form-generator/tree/{branch}`)
## Project setup ## Project setup
``` ```
yarn install yarn install
......
{ {
"name": "@coscine/form-generator", "name": "@coscine/form-generator",
"version": "3.0.12", "version": "3.1.0",
"main": "dist/index.umd.js", "main": "dist/index.umd.js",
"module": "dist/index.mjs", "module": "dist/index.mjs",
"browser": "dist/index.js", "browser": "dist/index.js",
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
"rdf-parse": "^1.8.0", "rdf-parse": "^1.8.0",
"rdf-validate-shacl": "^0.4.4", "rdf-validate-shacl": "^0.4.4",
"stream-browserify": "^3.0.0", "stream-browserify": "^3.0.0",
"uuid": "^9.0.0",
"vue-demi": "^0.13.11", "vue-demi": "^0.13.11",
"vue-i18n": "^8.22.2", "vue-i18n": "^8.22.2",
"vue-material-design-icons": "^5.1.2", "vue-material-design-icons": "^5.1.2",
...@@ -60,6 +61,7 @@ ...@@ -60,6 +61,7 @@
"@types/rdf-ext": "^1.3.11", "@types/rdf-ext": "^1.3.11",
"@types/rdf-js": "^4.0.1", "@types/rdf-js": "^4.0.1",
"@types/rdf-validate-shacl": "^0.4.0", "@types/rdf-validate-shacl": "^0.4.0",
"@types/uuid": "^9.0.0",
"@typescript-eslint/eslint-plugin": "^5.38.0", "@typescript-eslint/eslint-plugin": "^5.38.0",
"@typescript-eslint/parser": "^5.38.0", "@typescript-eslint/parser": "^5.38.0",
"@vitejs/plugin-vue2": "^1.1.2", "@vitejs/plugin-vue2": "^1.1.2",
...@@ -98,5 +100,5 @@ ...@@ -98,5 +100,5 @@
"url": "https://git.rwth-aachen.de/coscine/frontend/libraries/form-generator.git" "url": "https://git.rwth-aachen.de/coscine/frontend/libraries/form-generator.git"
}, },
"license": "MIT", "license": "MIT",
"packageManager": "yarn@3.3.0" "packageManager": "yarn@3.3.1"
} }
...@@ -8,6 +8,7 @@ import Multiselect from '@/plugins/deprecated/Multiselect.vue'; ...@@ -8,6 +8,7 @@ import Multiselect from '@/plugins/deprecated/Multiselect.vue';
import FormGenerator from '@/FormGenerator.vue'; import FormGenerator from '@/FormGenerator.vue';
import { listApplicationProfile } from '@/data/example/applicationProfile'; import { listApplicationProfile } from '@/data/example/applicationProfile';
import { listFixedValues } from '@/data/example/fixedValues';
import { listMetadata } from '@/data/example/metadata'; import { listMetadata } from '@/data/example/metadata';
function sleep(ms: number) { function sleep(ms: number) {
...@@ -20,15 +21,87 @@ const localVue = createLocalVue(); ...@@ -20,15 +21,87 @@ const localVue = createLocalVue();
describe('FormGenerator.vue', () => { describe('FormGenerator.vue', () => {
localVue.component('MultiSelect', Multiselect); localVue.component('MultiSelect', Multiselect);
const defaultDisplayName = 'Tester Testington';
/* Checks for correct functionality of lists */ /* Checks for correct functionality of lists */
test('list', async () => { test('listWithoutMetadata', async () => {
const wrapper = mount(FormGenerator, { const wrapper = mount(FormGenerator, {
propsData: { propsData: {
fixedValues: listFixedValues,
selectedShape: 'https://aims-projekt.de/ap/person/',
shapes: listApplicationProfile,
shapesMimeType: 'text/turtle',
userReceiver: () => {
return {
displayName: defaultDisplayName,
};
},
},
});
await wrapper.vm.$nextTick();
// Wait for 1 second until everything is set up
await sleep(1000);
expect(wrapper.emitted('isValid')).toBeTruthy();
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
expect(wrapper.emitted('isValid')!.length).toBe(1);
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
expect(wrapper.emitted('isValid')![0][0].conforms).toBeFalsy();
const allTextFields = wrapper.findAllComponents({ name: 'InputTextField' });
expect(allTextFields.length).toBe(5);
// Default value has been set
const defaultUserField = allTextFields.wrappers.filter(
(entry) => entry.vm?.$data?.object?.value === defaultDisplayName
);
expect(defaultUserField.length).toBe(1);
// Fixed value has been set
const fixedUserField = allTextFields.wrappers.filter(
(entry) => entry.vm?.$data?.object?.value === 'NichtMustermann'
);
expect(fixedUserField.length).toBe(1);
const email = allTextFields.wrappers.find(
(component) =>
component.vm.$props?.nodeName === 'http://xmlns.com/foaf/0.1/mbox'
);
if (email) {
const textInput = email.find('input[type="text"]');
await textInput.setValue('example@example.com');
}
await wrapper.vm.$nextTick();
// Wait for 1 second until validation has been done
await sleep(1000);
expect(
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
wrapper.emitted('isValid')![wrapper.emitted('isValid')!.length - 1][0]
.conforms
).toBeTruthy();
});
/* Checks for correct functionality of lists */
test('listWithMetadata', async () => {
const wrapper = mount(FormGenerator, {
propsData: {
fixedValues: listFixedValues,
formData: listMetadata, formData: listMetadata,
formDataMimeType: 'text/turtle', formDataMimeType: 'text/turtle',
selectedShape: 'https://aims-projekt.de/ap/person/', selectedShape: 'https://aims-projekt.de/ap/person/',
shapes: listApplicationProfile, shapes: listApplicationProfile,
shapesMimeType: 'text/turtle', shapesMimeType: 'text/turtle',
userReceiver: () => {
return {
displayName: defaultDisplayName,
};
},
}, },
}); });
...@@ -43,7 +116,24 @@ describe('FormGenerator.vue', () => { ...@@ -43,7 +116,24 @@ describe('FormGenerator.vue', () => {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
expect(wrapper.emitted('isValid')![0][0].conforms).toBeTruthy(); expect(wrapper.emitted('isValid')![0][0].conforms).toBeTruthy();
expect(wrapper.find('.InputList .multiselect__single').exists()).toBe(true); const allTextFields = wrapper.findAllComponents({ name: 'InputTextField' });
expect(allTextFields.length).toBe(5);
// Default value has been set
const defaultUserField = allTextFields.wrappers.filter(
(entry) => entry.vm?.$data?.object?.value === 'Max'
);
expect(defaultUserField.length).toBe(1);
// Fixed value has been set
const fixedUserField = allTextFields.wrappers.filter(
(entry) => entry.vm?.$data?.object?.value === 'Mustermann'
);
expect(fixedUserField.length).toBe(1);
expect(
wrapper.find('.InputList .multiselect__single').exists()
).toBeTruthy();
expect(wrapper.get('.InputList .multiselect__single').text()).toBe( expect(wrapper.get('.InputList .multiselect__single').text()).toBe(
'Banana' 'Banana'
); );
......
...@@ -61,6 +61,10 @@ export default defineComponent({ ...@@ -61,6 +61,10 @@ export default defineComponent({
default: false, default: false,
type: Boolean, type: Boolean,
}, },
nodeName: {
default: '',
type: String,
},
disabledMode: { disabledMode: {
default: false, default: false,
type: Boolean, type: Boolean,
......
...@@ -10,11 +10,31 @@ ...@@ -10,11 +10,31 @@
}" }"
label-cols-sm="3" label-cols-sm="3"
label-align-sm="right" label-align-sm="right"
:label="label"
:label-class=" :label-class="
'application-profile-label' + (required ? ' mandatory' : '') 'application-profile-label' + (required ? ' mandatory' : '')
" "
> >
<!-- Label Template -->
<template #label>
<!-- Label -->
<span>{{ label }}</span>
<div v-if="description" class="d-inline ml-1">
<!-- Information Circle Icon -->
<b-icon :id="labelFor" icon="info-circle" />
<!-- Popover -->
<b-popover
over
:target="labelFor"
triggers="hover focus"
placement="bottom"
>
{{ description }}
</b-popover>
</div>
</template>
<b-button-toolbar v-for="(entry, entryIndex) in values" :key="entryIndex"> <b-button-toolbar v-for="(entry, entryIndex) in values" :key="entryIndex">
<component <component
:is="componentDefinition" :is="componentDefinition"
...@@ -34,6 +54,7 @@ ...@@ -34,6 +54,7 @@
:attached-metadata="attachedMetadata[entryIndex]" :attached-metadata="attachedMetadata[entryIndex]"
:dataset="dataset" :dataset="dataset"
:node-import="nodeImport" :node-import="nodeImport"
:node-name="nodeName"
:class-receiver="classReceiver" :class-receiver="classReceiver"
:user-receiver="userReceiver" :user-receiver="userReceiver"
@input="inputValue(entryIndex, $event)" @input="inputValue(entryIndex, $event)"
...@@ -122,6 +143,8 @@ import { ...@@ -122,6 +143,8 @@ import {
BFormGroup, BFormGroup,
} from 'bootstrap-vue'; } from 'bootstrap-vue';
import { v4 as uuidv4 } from 'uuid';
import InputCombobox from './InputCombobox.vue'; import InputCombobox from './InputCombobox.vue';
import InputTextField from './InputTextField.vue'; import InputTextField from './InputTextField.vue';
import InputDatePicker from './InputDatePicker.vue'; import InputDatePicker from './InputDatePicker.vue';
...@@ -229,8 +252,9 @@ export default defineComponent({ ...@@ -229,8 +252,9 @@ export default defineComponent({
}, },
data() { data() {
return { return {
locked: false,
invisible: false, invisible: false,
labelFor: uuidv4(),
locked: false,
values: [] as Quad_Object[], values: [] as Quad_Object[],
}; };
}, },
...@@ -321,6 +345,18 @@ export default defineComponent({ ...@@ -321,6 +345,18 @@ export default defineComponent({
} }
return undefined; return undefined;
}, },
description(): string | undefined {
const descriptions = getObject(
this.property,
factory.namedNode(prefixes.sh + 'description'),
this.dataset,
this.languageLocale
);
for (const description of descriptions) {
return description.object.value;
}
return undefined;
},
fieldCanBeInvisible(): boolean { fieldCanBeInvisible(): boolean {
return ( return (
(this.required && (this.required &&
...@@ -484,8 +520,8 @@ export default defineComponent({ ...@@ -484,8 +520,8 @@ export default defineComponent({
this.initFixedValues(); this.initFixedValues();
}, },
metadata() { metadata() {
this.initMetadata();
this.setValuesFromMetadataValues(); this.setValuesFromMetadataValues();
this.fillMetadata();
}, },
}, },
beforeMount() { beforeMount() {
...@@ -508,10 +544,20 @@ export default defineComponent({ ...@@ -508,10 +544,20 @@ export default defineComponent({
} }
this.setFixedValues(this.values); this.setFixedValues(this.values);
}, },
fillMetadata() {
// Set values if they don't exist
if (!this.values.length) {
const numberOfNewFields = this.isNode ? 0 : 1;
// Setting more than one will not work since a dataset does not support multiple triples
// which are the same ?s ?p ?o
this.insertNewFields(numberOfNewFields);
}
},
initDefaultValues() { initDefaultValues() {
if ( if (
!this.values.length || (!this.values.length ||
this.values.every((entry) => entry.value === '') this.values.every((entry) => entry.value === '')) &&
!this.locked
) { ) {
const fixedValueObject = this.fixedValues[this.nodeName]; const fixedValueObject = this.fixedValues[this.nodeName];
const datasetMatches = this.dataset.match( const datasetMatches = this.dataset.match(
...@@ -561,13 +607,7 @@ export default defineComponent({ ...@@ -561,13 +607,7 @@ export default defineComponent({
}, },
initMetadata() { initMetadata() {
this.values = [...this.metadataValues]; this.values = [...this.metadataValues];
// Set values if they don't exist this.fillMetadata();
if (!this.values.length) {
const numberOfNewFields = this.isNode ? 0 : 1;
// Setting more than one will not work since a dataset does not support multiple triples
// which are the same ?s ?p ?o
this.insertNewFields(numberOfNewFields);
}
}, },
input(values: Quad_Object[], fixedValueTransfer = true) { input(values: Quad_Object[], fixedValueTransfer = true) {
this.$emit('input', this.nodeName, values); this.$emit('input', this.nodeName, values);
...@@ -638,16 +678,49 @@ export default defineComponent({ ...@@ -638,16 +678,49 @@ export default defineComponent({
this.inputFixedValues(currentFixedValueObject); this.inputFixedValues(currentFixedValueObject);
}, },
setValuesFromMetadataValues() { setValuesFromMetadataValues() {
this.values = this.values.filter((entry) => // What values will be kept from this.values
const keptValues = this.values.map((entry) =>
this.metadataValues.some( this.metadataValues.some(
(metadataEntry) => entry.value === metadataEntry.value (metadataEntry) => entry.value === metadataEntry.value
) )
? entry
: false
); );
// What values are new in this.metadataValues
const newValues = this.metadataValues.filter( const newValues = this.metadataValues.filter(
(metadataEntry) => (metadataEntry) =>
!this.values.some((entry) => entry.value === metadataEntry.value) !keptValues.some(
(entry) => entry !== false && entry.value === metadataEntry.value
)
); );
this.values = [...this.values, ...newValues];
let currentAddKey = 0;
const removeKeys: number[] = [];
// Update every value which is not kept with a new value
for (let i = 0; i < this.values.length; i++) {
if (keptValues[i] === false) {
if (currentAddKey < newValues.length) {
this.values[i] = newValues[currentAddKey];
currentAddKey++;
} else {
removeKeys.push(i);
}
}
}
// Add values which have not been added
for (let i = currentAddKey; i < newValues.length; i++) {
this.values.push(newValues[i]);
}
// Create a list with every to keep and new value
const setNewValues: Quad_Object[] = [];
for (let i = 0; i < this.values.length; i++) {
if (!removeKeys.includes(i)) {
setNewValues.push(this.values[i]);
}
}
this.values = setNewValues;
}, },
triggerValidation() { triggerValidation() {
this.$emit('triggerValidation'); this.$emit('triggerValidation');
......
...@@ -19,12 +19,14 @@ export const listApplicationProfile = `@prefix dcterms: <http://purl.org/dc/term ...@@ -19,12 +19,14 @@ export const listApplicationProfile = `@prefix dcterms: <http://purl.org/dc/term
sh:datatype xsd:string ; sh:datatype xsd:string ;
sh:minCount 1 ; sh:minCount 1 ;
sh:name "First Name"@en, "Vorname"@de ; sh:name "First Name"@en, "Vorname"@de ;
sh:defaultValue "{ME}" ;
sh:order 1 ; sh:order 1 ;
sh:path foaf:firstName ; sh:path foaf:firstName ;
], [ ], [
sh:datatype xsd:string ; sh:datatype xsd:string ;
sh:minCount 1 ; sh:minCount 1 ;
sh:name "Last Name"@en, "Nachname"@de ; sh:name "Last Name"@en, "Nachname"@de ;
sh:defaultValue "{ME}" ;
sh:order 2 ; sh:order 2 ;
sh:path foaf:lastName ; sh:path foaf:lastName ;
], [ ], [
......
export const listFixedValues = {
'http://example.org/fruits': {
'https://purl.org/coscine/defaultValue': [
{
value: 'Orange',
type: 'literal',
},
],
'https://purl.org/coscine/invisible': [
{
value: '0',
type: 'literal',
},
],
},
'http://xmlns.com/foaf/0.1/firstName': {
'https://purl.org/coscine/defaultValue': [
{
value: '{ME}',
type: 'literal',
},
],
'https://purl.org/coscine/invisible': [
{
value: '0',
type: 'literal',
},
],
},
'http://xmlns.com/foaf/0.1/lastName': {
'https://purl.org/coscine/fixedValue': [
{
value: 'NichtMustermann',
type: 'literal',
},
],
'https://purl.org/coscine/invisible': [
{
value: '0',
type: 'literal',
},
],
},
};
...@@ -342,6 +342,7 @@ __metadata: ...@@ -342,6 +342,7 @@ __metadata:
"@types/rdf-ext": ^1.3.11 "@types/rdf-ext": ^1.3.11
"@types/rdf-js": ^4.0.1 "@types/rdf-js": ^4.0.1
"@types/rdf-validate-shacl": ^0.4.0 "@types/rdf-validate-shacl": ^0.4.0
"@types/uuid": ^9.0.0
"@typescript-eslint/eslint-plugin": ^5.38.0 "@typescript-eslint/eslint-plugin": ^5.38.0
"@typescript-eslint/parser": ^5.38.0 "@typescript-eslint/parser": ^5.38.0
"@vitejs/plugin-vue2": ^1.1.2 "@vitejs/plugin-vue2": ^1.1.2
...@@ -374,6 +375,7 @@ __metadata: ...@@ -374,6 +375,7 @@ __metadata:
semantic-release: ^19.0.5 semantic-release: ^19.0.5
stream-browserify: ^3.0.0 stream-browserify: ^3.0.0
typescript: ^4.8.3 typescript: ^4.8.3
uuid: ^9.0.0
vite: ^3.2.4 vite: ^3.2.4
vitest: ^0.25.3 vitest: ^0.25.3
vue: ^2.7.10 vue: ^2.7.10
...@@ -1547,6 +1549,13 @@ __metadata: ...@@ -1547,6 +1549,13 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@types/uuid@npm:^9.0.0":
version: 9.0.0
resolution: "@types/uuid@npm:9.0.0"
checksum: 59ae56d9547c8758588659da2a2b4c97cce79c2aae1798c892bb29452ef08e87859dea2ec3a66bfa88d0d2153147520be2b1893be920f9f0bc9c53a3207ea6aa
languageName: node
linkType: hard
"@typescript-eslint/eslint-plugin@npm:^5.0.0, @typescript-eslint/eslint-plugin@npm:^5.38.0": "@typescript-eslint/eslint-plugin@npm:^5.0.0, @typescript-eslint/eslint-plugin@npm:^5.38.0":
version: 5.43.0 version: 5.43.0
resolution: "@typescript-eslint/eslint-plugin@npm:5.43.0" resolution: "@typescript-eslint/eslint-plugin@npm:5.43.0"
...@@ -9720,6 +9729,15 @@ __metadata: ...@@ -9720,6 +9729,15 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"uuid@npm:^9.0.0":
version: 9.0.0
resolution: "uuid@npm:9.0.0"
bin:
uuid: dist/bin/uuid
checksum: 8dd2c83c43ddc7e1c71e36b60aea40030a6505139af6bee0f382ebcd1a56f6cd3028f7f06ffb07f8cf6ced320b76aea275284b224b002b289f89fe89c389b028
languageName: node
linkType: hard
"v8-to-istanbul@npm:^9.0.0": "v8-to-istanbul@npm:^9.0.0":
version: 9.0.1 version: 9.0.1
resolution: "v8-to-istanbul@npm:9.0.1" resolution: "v8-to-istanbul@npm:9.0.1"
......