From 69dc0d20706ed41e5ecdbb77515066d8a7d7703b Mon Sep 17 00:00:00 2001 From: Zero~Informatique Date: Fri, 19 Jun 2020 22:12:03 +0200 Subject: viewer: code update (no functional change) Types { [x: T]: R } updated to Record Methods in template updated to getters (computed in VueJS), which are reactive and cached Code formatting --- viewer/src/@types/scrollposition.d.ts | 2 +- viewer/src/@types/tag.d.ts | 4 ++-- viewer/src/components/LdAudioViewer.vue | 16 +++++++++------- viewer/src/components/LdCommand.vue | 16 ++++++++-------- viewer/src/components/LdDownload.vue | 11 ++++++----- viewer/src/components/LdGallery.vue | 4 ++-- viewer/src/components/LdPdfViewer.vue | 8 ++++---- viewer/src/components/LdPlainTextViewer.vue | 9 +++++---- viewer/src/components/LdProposition.vue | 2 +- viewer/src/components/LdThumbnail.vue | 8 ++++---- viewer/src/components/LdVideoViewer.vue | 20 ++++++++++++-------- viewer/src/views/GalleryDirectory.vue | 4 ++-- viewer/src/views/GallerySearch.vue | 6 +++--- viewer/src/views/PanelLeft.vue | 4 ++-- 14 files changed, 61 insertions(+), 53 deletions(-) (limited to 'viewer/src') diff --git a/viewer/src/@types/scrollposition.d.ts b/viewer/src/@types/scrollposition.d.ts index b2147fa..cd393b3 100644 --- a/viewer/src/@types/scrollposition.d.ts +++ b/viewer/src/@types/scrollposition.d.ts @@ -17,4 +17,4 @@ -- along with this program. If not, see . */ -type ScrollPosition = { [index: string]: number } +type ScrollPosition = Record diff --git a/viewer/src/@types/tag.d.ts b/viewer/src/@types/tag.d.ts index 76f1207..59ae779 100644 --- a/viewer/src/@types/tag.d.ts +++ b/viewer/src/@types/tag.d.ts @@ -31,8 +31,8 @@ declare namespace Tag { operation: string; // Enum Operation display: string; } - type SearchByOperation = { [index: string]: Tag.Search[] }; - type Index = { [index: string]: Node }; + type SearchByOperation = Record; + type Index = Record; interface Category { tag: string; diff --git a/viewer/src/components/LdAudioViewer.vue b/viewer/src/components/LdAudioViewer.vue index d115a34..739d36a 100644 --- a/viewer/src/components/LdAudioViewer.vue +++ b/viewer/src/components/LdAudioViewer.vue @@ -21,10 +21,11 @@ @@ -33,14 +34,15 @@ import { Component, Prop, Vue } from "vue-property-decorator"; import Navigation from "@/services/navigation"; -@Component export default class LdAudioViewer extends Vue { +@Component +export default class LdAudioViewer extends Vue { @Prop({ required: true }) readonly audioItem!: Gallery.Audio; - itemResourceUrl(): string { + get itemResourceUrl(): string { return this.$galleryStore.resourceRoot + this.audioItem.properties.resource; } - itemFileName(): string { + get itemFileName(): string { return Navigation.getFileName(this.audioItem); } } diff --git a/viewer/src/components/LdCommand.vue b/viewer/src/components/LdCommand.vue index d961519..49d86bb 100644 --- a/viewer/src/components/LdCommand.vue +++ b/viewer/src/components/LdCommand.vue @@ -21,17 +21,17 @@