99 <q-option-group
1010 inline
1111 type =" radio"
12- v-bind:error =" false"
13- v-bind:error-message =" ''"
1412 v-bind:model-value =" type"
1513 v-bind:options =" typeOptions"
1614 v-on:update:modelValue =" $emit('updateType', 'type', $event)"
3028 outlined
3129 standout
3230 dense
33- v-bind:error =" false"
34- v-bind:error-message =" ''"
31+ v-bind:class =" identifierValueErrors.length > 0 ? 'has-error' : ''"
32+ v-bind:error =" identifierValueErrors.length > 0"
33+ v-bind:error-message =" identifierValueErrors.join(', ')"
3534 v-bind:model-value =" value"
3635 v-on:update:modelValue =" $emit('updateValue', 'value', $event)"
3736 ref =" valueRef"
5049 outlined
5150 standout
5251 dense
53- v-bind:error =" false"
54- v-bind:error-message =" ''"
5552 v-bind:model-value =" description"
5653 v-on:update:modelValue =" $emit('updateDescription', 'description', $event)"
5754 />
9390
9491<script lang="ts">
9592import { IdentifierTypeType } from ' ../types'
96- import { computed , defineComponent , PropType , ref } from ' vue'
93+ import { computed , defineComponent , PropType } from ' vue'
9794import SchemaGuideLink from ' src/components/SchemaGuideLink.vue'
95+ import { byError , identifierValueQueries } from ' src/error-filtering'
96+ import { useValidation } from ' src/store/validation'
9897
9998export default defineComponent ({
10099 name: ' IdentifierCardEditing' ,
@@ -124,6 +123,7 @@ export default defineComponent({
124123 SchemaGuideLink
125124 },
126125 setup (props ) {
126+ const { errors } = useValidation ()
127127 const linkInfo = {
128128 doi: { label: ' DOI' , anchor: ' #definitionsdoi' },
129129 url: { label: ' URL' , anchor: ' #definitionsurl' },
@@ -133,17 +133,21 @@ export default defineComponent({
133133 },
134134 other: { label: ' identifier' , anchor: ' #definitionsidentifier' }
135135 }
136- const valueRef = ref <HTMLElement | null >(null )
136+ const identifierValueErrors = computed (() => {
137+ return identifierValueQueries (props .index , [' doi' , ' url' , ' swh' , ' other' ].indexOf (props .type ))
138+ .filter (byError (errors .value ))
139+ .map (query => query .replace .message )
140+ })
137141 return {
138- valueRef ,
139142 typeOptions: [
140143 { label: ' DOI' , value: ' doi' },
141144 { label: ' URL' , value: ' url' },
142145 { label: ' Software Heritage' , value: ' swh' },
143146 { label: ' Other' , value: ' other' }
144147 ],
145148 label: computed (() => linkInfo [props .type ].label ),
146- anchor: computed (() => linkInfo [props .type ].anchor )
149+ anchor: computed (() => linkInfo [props .type ].anchor ),
150+ identifierValueErrors
147151 }
148152 },
149153 emits: [
0 commit comments