diff options
author | zeroinformatique | 2021-07-03 00:48:53 +0200 |
---|---|---|
committer | GitHub | 2021-07-03 00:48:53 +0200 |
commit | b6605e2c4ee73ac8b994624098344db5e44ac07d (patch) | |
tree | 5ed06cc5ecdabe070f6fdb9bc4f9a8a3b435cbe6 /viewer/src/components | |
parent | 08ac32103fb5f8cca1861267dfd07a7c0d2faf62 (diff) | |
parent | 1f0377c1b4c2959c73fe4e368673f057ef369917 (diff) | |
download | ldgallery-b6605e2c4ee73ac8b994624098344db5e44ac07d.tar.gz |
Merge pull request #302 from ldgallery/oz-types-normalization
viewer: types normalization
Diffstat (limited to 'viewer/src/components')
17 files changed, 59 insertions, 46 deletions
diff --git a/viewer/src/components/LdBreadcrumb.vue b/viewer/src/components/LdBreadcrumb.vue index 618b15a..2c17554 100644 --- a/viewer/src/components/LdBreadcrumb.vue +++ b/viewer/src/components/LdBreadcrumb.vue | |||
@@ -47,13 +47,14 @@ | |||
47 | </template> | 47 | </template> |
48 | 48 | ||
49 | <script lang="ts"> | 49 | <script lang="ts"> |
50 | import { Component, Vue, Ref, Watch, Prop } from "vue-property-decorator"; | 50 | import { Item } from "@/@types/gallery"; |
51 | import DragScrollClickFix from "@/services/dragscrollclickfix"; | 51 | import DragScrollClickFix from "@/services/dragscrollclickfix"; |
52 | import Navigation from "@/services/navigation"; | 52 | import Navigation from "@/services/navigation"; |
53 | import { Component, Prop, Ref, Vue, Watch } from "vue-property-decorator"; | ||
53 | 54 | ||
54 | @Component | 55 | @Component |
55 | export default class LdBreadcrumb extends Vue { | 56 | export default class LdBreadcrumb extends Vue { |
56 | @Prop({ type: Array, required: true }) readonly currentItemPath!: Gallery.Item[]; | 57 | @Prop({ type: Array, required: true }) readonly currentItemPath!: Item[]; |
57 | @Prop(Boolean) readonly searchMode!: boolean; | 58 | @Prop(Boolean) readonly searchMode!: boolean; |
58 | @Ref() readonly breadcrumb!: HTMLUListElement; | 59 | @Ref() readonly breadcrumb!: HTMLUListElement; |
59 | 60 | ||
@@ -82,7 +83,7 @@ export default class LdBreadcrumb extends Vue { | |||
82 | }); | 83 | }); |
83 | } | 84 | } |
84 | 85 | ||
85 | getIcon(item: Gallery.Item) { | 86 | getIcon(item: Item) { |
86 | return Navigation.getIcon(item); | 87 | return Navigation.getIcon(item); |
87 | } | 88 | } |
88 | } | 89 | } |
diff --git a/viewer/src/components/LdCommand.vue b/viewer/src/components/LdCommand.vue index 5ba8266..7ffa670 100644 --- a/viewer/src/components/LdCommand.vue +++ b/viewer/src/components/LdCommand.vue | |||
@@ -40,12 +40,13 @@ | |||
40 | </template> | 40 | </template> |
41 | 41 | ||
42 | <script lang="ts"> | 42 | <script lang="ts"> |
43 | import { Component, Vue, Prop } from "vue-property-decorator"; | 43 | import { Item } from "@/@types/gallery"; |
44 | import { Component, Prop, Vue } from "vue-property-decorator"; | ||
44 | import { RawLocation } from "vue-router"; | 45 | import { RawLocation } from "vue-router"; |
45 | 46 | ||
46 | @Component | 47 | @Component |
47 | export default class LdCommand extends Vue { | 48 | export default class LdCommand extends Vue { |
48 | @Prop({ type: Array, required: true }) readonly currentItemPath!: Gallery.Item[]; | 49 | @Prop({ type: Array, required: true }) readonly currentItemPath!: Item[]; |
49 | 50 | ||
50 | get commandToggleSearchPanelIcon(): string { | 51 | get commandToggleSearchPanelIcon(): string { |
51 | return this.$uiStore.fullWidth ? "search" : "angle-double-left"; | 52 | return this.$uiStore.fullWidth ? "search" : "angle-double-left"; |
diff --git a/viewer/src/components/LdCommandSort.vue b/viewer/src/components/LdCommandSort.vue index 4c246e6..c8a822e 100644 --- a/viewer/src/components/LdCommandSort.vue +++ b/viewer/src/components/LdCommandSort.vue | |||
@@ -32,8 +32,8 @@ | |||
32 | </template> | 32 | </template> |
33 | 33 | ||
34 | <script lang="ts"> | 34 | <script lang="ts"> |
35 | import { Component, Vue, Prop } from "vue-property-decorator"; | ||
36 | import ItemComparators, { ItemSort } from "@/services/itemComparators"; | 35 | import ItemComparators, { ItemSort } from "@/services/itemComparators"; |
36 | import { Component, Vue } from "vue-property-decorator"; | ||
37 | 37 | ||
38 | @Component | 38 | @Component |
39 | export default class LdCommandSort extends Vue { | 39 | export default class LdCommandSort extends Vue { |
diff --git a/viewer/src/components/LdGallery.vue b/viewer/src/components/LdGallery.vue index edd479c..1443927 100644 --- a/viewer/src/components/LdGallery.vue +++ b/viewer/src/components/LdGallery.vue | |||
@@ -27,12 +27,12 @@ | |||
27 | </template> | 27 | </template> |
28 | 28 | ||
29 | <script lang="ts"> | 29 | <script lang="ts"> |
30 | import { Component, Vue, Prop, Model } from "vue-property-decorator"; | 30 | import { Item } from "@/@types/gallery"; |
31 | import DragScrollClickFix from "@/services/dragscrollclickfix"; | 31 | import { Component, Prop, Vue } from "vue-property-decorator"; |
32 | 32 | ||
33 | @Component | 33 | @Component |
34 | export default class LdPicture extends Vue { | 34 | export default class LdPicture extends Vue { |
35 | @Prop({ type: Array, required: true }) readonly items!: Gallery.Item[]; | 35 | @Prop({ type: Array, required: true }) readonly items!: Item[]; |
36 | @Prop(String) readonly noresult?: string; | 36 | @Prop(String) readonly noresult?: string; |
37 | 37 | ||
38 | get sortedItems() { | 38 | get sortedItems() { |
diff --git a/viewer/src/components/LdInformation.vue b/viewer/src/components/LdInformation.vue index 66ccc80..b161485 100644 --- a/viewer/src/components/LdInformation.vue +++ b/viewer/src/components/LdInformation.vue | |||
@@ -26,12 +26,13 @@ | |||
26 | </template> | 26 | </template> |
27 | 27 | ||
28 | <script lang="ts"> | 28 | <script lang="ts"> |
29 | import { Component, Vue, Prop } from "vue-property-decorator"; | 29 | import { Item } from "@/@types/gallery"; |
30 | import marked from "marked"; | 30 | import marked from "marked"; |
31 | import { Component, Prop, Vue } from "vue-property-decorator"; | ||
31 | 32 | ||
32 | @Component | 33 | @Component |
33 | export default class LdInformation extends Vue { | 34 | export default class LdInformation extends Vue { |
34 | @Prop({ required: true }) readonly item!: Gallery.Item; | 35 | @Prop({ required: true }) readonly item!: Item; |
35 | 36 | ||
36 | get formatDate() { | 37 | get formatDate() { |
37 | const date = this.item.datetime.substr(0, 10); | 38 | const date = this.item.datetime.substr(0, 10); |
diff --git a/viewer/src/components/LdKeyPress.vue b/viewer/src/components/LdKeyPress.vue index c507b33..151d6c6 100644 --- a/viewer/src/components/LdKeyPress.vue +++ b/viewer/src/components/LdKeyPress.vue | |||
@@ -18,7 +18,7 @@ | |||
18 | --> | 18 | --> |
19 | 19 | ||
20 | <script lang="ts"> | 20 | <script lang="ts"> |
21 | import { Component, Vue, Prop, Emit } from "vue-property-decorator"; | 21 | import { Component, Emit, Prop, Vue } from "vue-property-decorator"; |
22 | 22 | ||
23 | @Component | 23 | @Component |
24 | export default class LdKeyPress extends Vue { | 24 | export default class LdKeyPress extends Vue { |
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 }); |
diff --git a/viewer/src/components/LdTagInput.vue b/viewer/src/components/LdTagInput.vue index ce83ba8..855813a 100644 --- a/viewer/src/components/LdTagInput.vue +++ b/ |