Add jsdoc for Tag type

Does not work properly but is still useful
This commit is contained in:
Mathias Haugsbø 2022-12-27 23:27:23 +01:00
parent 608e3f5582
commit 4d0bdae6bf
2 changed files with 27 additions and 3 deletions

View file

@ -18,9 +18,15 @@
</template> </template>
<script> <script>
/**
* @typedef {import('./TagsManager.vue').Tag} Tag
*/
export default { export default {
props: { props: {
/** Object representing tag */ /** Object representing tag
* @type {Tag}
*/
item: { item: {
type: Object, type: Object,
required: true, required: true,
@ -32,7 +38,7 @@ export default {
}, },
/** /**
* Size of tag * Size of tag
* @values normal, small * @type {"normal" | "small"}
*/ */
size: { size: {
type: String, type: String,

View file

@ -133,13 +133,27 @@ import { useToast } from "vue-toastification";
import Tag from "../components/Tag.vue"; import Tag from "../components/Tag.vue";
const toast = useToast(); const toast = useToast();
/**
* @typedef Tag
* @type {object}
* @property {number | undefined} id
* @property {number | undefined} monitor_id
* @property {number | undefined} tag_id
* @property {string} value
* @property {string} name
* @property {string} color
* @property {boolean | undefined} new
*/
export default { export default {
components: { components: {
Tag, Tag,
VueMultiselect, VueMultiselect,
}, },
props: { props: {
/** Array of tags to be pre-selected */ /** Array of tags to be pre-selected
* @type {Tag[]}
*/
preSelectedTags: { preSelectedTags: {
type: Array, type: Array,
default: () => [], default: () => [],
@ -147,10 +161,14 @@ export default {
}, },
data() { data() {
return { return {
/** @type {Modal | null} */
modal: null, modal: null,
/** @type {Tag[]} */
existingTags: [], existingTags: [],
processing: false, processing: false,
/** @type {Tag[]} */
newTags: [], newTags: [],
/** @type {Tag[]} */
deleteTags: [], deleteTags: [],
newDraftTag: { newDraftTag: {
name: null, name: null,