diff options
Diffstat (limited to 'viewer/src/components')
-rw-r--r-- | viewer/src/components/LdProposition.vue | 9 | ||||
-rw-r--r-- | viewer/src/components/LdTagInput.vue | 11 |
2 files changed, 11 insertions, 9 deletions
diff --git a/viewer/src/components/LdProposition.vue b/viewer/src/components/LdProposition.vue index 2396d1f..088e249 100644 --- a/viewer/src/components/LdProposition.vue +++ b/viewer/src/components/LdProposition.vue | |||
@@ -56,15 +56,16 @@ | |||
56 | <script lang="ts"> | 56 | <script lang="ts"> |
57 | import { Item, RawTag } from "@/@types/gallery"; | 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"; | ||
59 | import { Component, Prop, PropSync, Vue, Watch } from "vue-property-decorator"; | 60 | import { Component, Prop, PropSync, Vue, Watch } from "vue-property-decorator"; |
60 | 61 | ||
61 | @Component | 62 | @Component |
62 | export default class LdProposition extends Vue { | 63 | export default class LdProposition extends Vue { |
63 | @Prop() readonly category?: Tag.Node; | 64 | @Prop() readonly category?: TagNode; |
64 | @Prop({ type: Boolean, required: true }) readonly showCategory!: boolean; | 65 | @Prop({ type: Boolean, required: true }) readonly showCategory!: boolean; |
65 | @Prop({ type: Array, required: true }) readonly currentTags!: string[]; | 66 | @Prop({ type: Array, required: true }) readonly currentTags!: string[]; |
66 | @Prop({ required: true }) readonly tagsIndex!: Tag.Index; | 67 | @Prop({ required: true }) readonly tagsIndex!: TagIndex; |
67 | @PropSync("searchFilters", { type: Array, required: true }) model!: Tag.Search[]; | 68 | @PropSync("searchFilters", { type: Array, required: true }) model!: TagSearch[]; |
68 | 69 | ||
69 | readonly INITIAL_TAG_DISPLAY_LIMIT = this.getInitialTagDisplayLimit(); | 70 | readonly INITIAL_TAG_DISPLAY_LIMIT = this.getInitialTagDisplayLimit(); |
70 | 71 | ||
@@ -119,7 +120,7 @@ export default class LdProposition extends Vue { | |||
119 | return this.category?.tag ?? this.$t("panelLeft.propositions.other"); | 120 | return this.category?.tag ?? this.$t("panelLeft.propositions.other"); |
120 | } | 121 | } |
121 | 122 | ||
122 | extractDistinctItems(currentTags: Tag.Search[]): Item[] { | 123 | extractDistinctItems(currentTags: TagSearch[]): Item[] { |
123 | return [...new Set(currentTags.flatMap(tag => tag.items))]; | 124 | return [...new Set(currentTags.flatMap(tag => tag.items))]; |
124 | } | 125 | } |
125 | 126 | ||
diff --git a/viewer/src/components/LdTagInput.vue b/viewer/src/components/LdTagInput.vue index ef585f0..855813a 100644 --- a/viewer/src/components/LdTagInput.vue +++ b/viewer/src/components/LdTagInput.vue | |||
@@ -40,22 +40,23 @@ | |||
40 | </template> | 40 | </template> |
41 | 41 | ||
42 | <script lang="ts"> | 42 | <script lang="ts"> |
43 | import { TagIndex, TagSearch } from "@/@types/tag"; | ||
43 | import IndexFactory from "@/services/indexfactory"; | 44 | import IndexFactory from "@/services/indexfactory"; |
44 | import { Component, Emit, Prop, PropSync, Vue } from "vue-property-decorator"; | 45 | import { Component, Emit, Prop, PropSync, Vue } from "vue-property-decorator"; |
45 | 46 | ||
46 | @Component | 47 | @Component |
47 | export default class LdTagInput extends Vue { | 48 | export default class LdTagInput extends Vue { |
48 | @Prop({ required: true }) readonly tagsIndex!: Tag.Index; | 49 | @Prop({ required: true }) readonly tagsIndex!: TagIndex; |
49 | @PropSync("searchFilters", { type: Array, required: true }) model!: Tag.Search[]; | 50 | @PropSync("searchFilters", { type: Array, required: true }) model!: TagSearch[]; |
50 | 51 | ||
51 | currentFilter: string = ""; | 52 | currentFilter: string = ""; |
52 | filteredTags: Tag.Search[] = []; | 53 | filteredTags: TagSearch[] = []; |
53 | 54 | ||
54 | displayOption(option: Tag.Search): string { | 55 | displayOption(option: TagSearch): string { |
55 | return `${option.display} (${option.items.length})`; | 56 | return `${option.display} (${option.items.length})`; |
56 | } | 57 | } |
57 | 58 | ||
58 | filterAlreadyPresent(newSearch: Tag.Search) { | 59 | filterAlreadyPresent(newSearch: TagSearch) { |
59 | return !this.model.find( | 60 | return !this.model.find( |
60 | currentSearch => | 61 | currentSearch => |
61 | currentSearch.tag === newSearch.tag && (!currentSearch.parent || currentSearch.parent === newSearch.parent) | 62 | currentSearch.tag === newSearch.tag && (!currentSearch.parent || currentSearch.parent === newSearch.parent) |