aboutsummaryrefslogtreecommitdiff
path: root/viewer/src/components/LdProposition.vue
diff options
context:
space:
mode:
authorZero~Informatique2021-07-02 22:53:16 +0200
committerZero~Informatique2021-07-03 00:05:22 +0200
commit9165cc1efcf7791f78b61b2c51a9de651b1b09aa (patch)
tree111cfdc74ddaf7b19ff27508f16ab84694b27670 /viewer/src/components/LdProposition.vue
parent08ac32103fb5f8cca1861267dfd07a7c0d2faf62 (diff)
downloadldgallery-9165cc1efcf7791f78b61b2c51a9de651b1b09aa.tar.gz
viewer: types normalization - gallery.d.ts
GitHub: closes #301
Diffstat (limited to 'viewer/src/components/LdProposition.vue')
-rw-r--r--viewer/src/components/LdProposition.vue9
1 files changed, 5 insertions, 4 deletions
diff --git a/viewer/src/components/LdProposition.vue b/viewer/src/components/LdProposition.vue
index aa44943..2396d1f 100644
--- a/viewer/src/components/LdProposition.vue
+++ b/viewer/src/components/LdProposition.vue
@@ -54,8 +54,9 @@
54</template> 54</template>
55 55
56<script lang="ts"> 56<script lang="ts">
57import { Component, Vue, Prop, PropSync, Watch } from "vue-property-decorator"; 57import { Item, RawTag } from "@/@types/gallery";
58import { Operation } from "@/@types/Operation"; 58import { Operation } from "@/@types/Operation";
59import { Component, Prop, PropSync, Vue, Watch } from "vue-property-decorator";
59 60
60@Component 61@Component
61export default class LdProposition extends Vue { 62export default class LdProposition extends Vue {
@@ -118,16 +119,16 @@ export default class LdProposition extends Vue {
118 return this.category?.tag ?? this.$t("panelLeft.propositions.other"); 119 return this.category?.tag ?? this.$t("panelLeft.propositions.other");
119 } 120 }
120 121
121 extractDistinctItems(currentTags: Tag.Search[]): Gallery.Item[] { 122 extractDistinctItems(currentTags: Tag.Search[]): Item[] {
122 return [...new Set(currentTags.flatMap(tag => tag.items))]; 123 return [...new Set(currentTags.flatMap(tag => tag.items))];
123 } 124 }
124 125
125 rightmost(tag: Gallery.RawTag): Gallery.RawTag { 126 rightmost(tag: RawTag): RawTag {
126 const dot = tag.lastIndexOf(":"); 127 const dot = tag.lastIndexOf(":");
127 return dot <= 0 ? tag : tag.substr(dot + 1); 128 return dot <= 0 ? tag : tag.substr(dot + 1);
128 } 129 }
129 130
130 add(operation: Operation, rawTag: Gallery.RawTag) { 131 add(operation: Operation, rawTag: RawTag) {
131 const node = this.tagsIndex[rawTag]; 132 const node = this.tagsIndex[rawTag];
132 const display = this.category ? `${operation}${this.category.tag}:${node.tag}` : `${operation}${node.tag}`; 133 const display = this.category ? `${operation}${this.category.tag}:${node.tag}` : `${operation}${node.tag}`;
133 this.model.push({ ...node, parent: this.category, operation, display }); 134 this.model.push({ ...node, parent: this.category, operation, display });