RelatedProp changes for Event sections

pull/3711/head
Bahadır Sofuoğlu 2023-03-06 16:43:19 +03:00
parent 8453cdb428
commit f1b9207c28
1 changed files with 17 additions and 12 deletions

View File

@ -2,7 +2,7 @@
<DocSectionText :id="id" :label="label" :level="componentLevel"> <DocSectionText :id="id" :label="label" :level="componentLevel">
{{ description || null }} {{ description || null }}
<p v-if="relatedProp" class="inline-block"> <p v-if="relatedProp" class="inline-block">
See <NuxtLink :to="setRelatedPropPath(relatedProp)" class="doc-option-link"> {{ relatedProp }} </NuxtLink> See <NuxtLink :to="setRelatedPropPath(relatedProp)" class="doc-option-link"> {{ relatedPropValue(relatedProp) }} </NuxtLink>
</p> </p>
</DocSectionText> </DocSectionText>
@ -22,8 +22,8 @@
<td v-for="[k, v] in Object.entries(prop)" :key="k" :class="{ 'doc-option-type': k === 'type', 'doc-option-default': k === 'defaultValue' }"> <td v-for="[k, v] in Object.entries(prop)" :key="k" :class="{ 'doc-option-type': k === 'type', 'doc-option-default': k === 'defaultValue' }">
<template v-if="k !== 'readonly' && k !== 'optional' && k !== 'deprecated'"> <template v-if="k !== 'readonly' && k !== 'optional' && k !== 'deprecated'">
<span v-if="k === 'name'" :id="id + '.' + v" class="doc-option-name"> <span v-if="k === 'name'" :id="id + '.' + v" class="doc-option-name">
{{ v }} {{ v
<NuxtLink :to="`/${$router.currentRoute.value.name}/#${id}.${v}`" class="doc-option-link"> }}<NuxtLink :to="`/${$router.currentRoute.value.name}/#${id}.${v}`" class="doc-option-link">
<i class="pi pi-link"></i> <i class="pi pi-link"></i>
</NuxtLink> </NuxtLink>
</span> </span>
@ -87,10 +87,7 @@ export default {
methods: { methods: {
getType(value) { getType(value) {
const newValue = value?.split('|').map((item) => { const newValue = value?.split('|').map((item) => {
return item return item.replace(/(\[|\]|<|>).*$/gm, '').trim();
.replace(/"/g, '')
.replace(/(\[|\]|<|>).*$/gm, '')
.trim();
}); });
return newValue; return newValue;
@ -119,7 +116,19 @@ export default {
return `/${currentRoute}/#api.${componentName}.${definationType}.${value}`; return `/${currentRoute}/#api.${componentName}.${definationType}.${value}`;
}, },
relatedPropValue(value) {
return this.findRelatedProps(value).secondPart;
},
setRelatedPropPath(value) { setRelatedPropPath(value) {
let { firstPart, secondPart } = this.findRelatedProps(value);
const docName = this.$route.name;
firstPart = firstPart.toLowerCase().replace(docName, '');
return this.setLinkPath(secondPart, firstPart);
},
findRelatedProps(value) {
let firstPart = ''; let firstPart = '';
let secondPart = ''; let secondPart = '';
@ -136,11 +145,7 @@ export default {
secondPart = value.slice(start, end).trim(); secondPart = value.slice(start, end).trim();
} }
const docName = this.$route.name; return { firstPart, secondPart };
firstPart = firstPart.toLowerCase().replace(docName, '');
return this.setLinkPath(secondPart, firstPart);
} }
}, },
computed: { computed: {