diff options
Diffstat (limited to 'viewer/src/components/LdProposition.vue')
-rw-r--r-- | viewer/src/components/LdProposition.vue | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/viewer/src/components/LdProposition.vue b/viewer/src/components/LdProposition.vue index aa44943..088e249 100644 --- a/viewer/src/components/LdProposition.vue +++ b/viewer/src/components/LdProposition.vue | |||
@@ -54,16 +54,18 @@ | |||
54 | </template> | 54 | </template> |
55 | 55 | ||
56 | <script lang="ts"> | 56 | <script lang="ts"> |
57 | import { Component, Vue, Prop, PropSync, Watch } from "vue-property-decorator"; | 57 | import { Item, RawTag } from "@/@types/gallery"; |
58 | import { Operation } from "@/@types/Operation"; | 58 | import { Operation } from "@/@types/Operation"; |
59 | import { TagIndex, TagNode, TagSearch } from "@/@types/tag"; | ||
60 | import { Component, Prop, PropSync, Vue, Watch } from "vue-property-decorator"; | ||
59 | 61 | ||
60 | @Component | 62 | @Component |
61 | export default class LdProposition extends Vue { | 63 | export default class LdProposition extends Vue { |
62 | @Prop() readonly category?: Tag.Node; | 64 | @Prop() readonly category?: TagNode; |
63 | @Prop({ type: Boolean, required: true }) readonly showCategory!: boolean; | 65 | @Prop({ type: Boolean, required: true }) readonly showCategory!: boolean; |
64 | @Prop({ type: Array, required: true }) readonly currentTags!: string[]; | 66 | @Prop({ type: Array, required: true }) readonly currentTags!: string[]; |
65 | @Prop({ required: true }) readonly tagsIndex!: Tag.Index; | 67 | @Prop({ required: true }) readonly tagsIndex!: TagIndex; |
66 | @PropSync("searchFilters", { type: Array, required: true }) model!: Tag.Search[]; | 68 | @PropSync("searchFilters", { type: Array, required: true }) model!: TagSearch[]; |
67 | 69 | ||
68 | readonly INITIAL_TAG_DISPLAY_LIMIT = this.getInitialTagDisplayLimit(); | 70 | readonly INITIAL_TAG_DISPLAY_LIMIT = this.getInitialTagDisplayLimit(); |
69 | 71 | ||
@@ -118,16 +120,16 @@ export default class LdProposition extends Vue { | |||
118 | return this.category?.tag ?? this.$t("panelLeft.propositions.other"); | 120 | return this.category?.tag ?? this.$t("panelLeft.propositions.other"); |
119 | } | 121 | } |
120 | 122 | ||
121 | extractDistinctItems(currentTags: Tag.Search[]): Gallery.Item[] { | 123 | extractDistinctItems(currentTags: TagSearch[]): Item[] { |
122 | return [...new Set(currentTags.flatMap(tag => tag.items))]; | 124 | return [...new Set(currentTags.flatMap(tag => tag.items))]; |
123 | } | 125 | } |
124 | 126 | ||
125 | rightmost(tag: Gallery.RawTag): Gallery.RawTag { | 127 | rightmost(tag: RawTag): RawTag { |
126 | const dot = tag.lastIndexOf(":"); | 128 | const dot = tag.lastIndexOf(":"); |
127 | return dot <= 0 ? tag : tag.substr(dot + 1); | 129 | return dot <= 0 ? tag : tag.substr(dot + 1); |
128 | } | 130 | } |
129 | 131 | ||
130 | add(operation: Operation, rawTag: Gallery.RawTag) { | 132 | add(operation: Operation, rawTag: RawTag) { |
131 | const node = this.tagsIndex[rawTag]; | 133 | const node = this.tagsIndex[rawTag]; |
132 | const display = this.category ? `${operation}${this.category.tag}:${node.tag}` : `${operation}${node.tag}`; | 134 | const display = this.category ? `${operation}${this.category.tag}:${node.tag}` : `${operation}${node.tag}`; |
133 | this.model.push({ ...node, parent: this.category, operation, display }); | 135 | this.model.push({ ...node, parent: this.category, operation, display }); |