quasar-ui-danx 0.4.6 → 0.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quasar-ui-danx",
3
- "version": "0.4.6",
3
+ "version": "0.4.8",
4
4
  "author": "Dan <dan@flytedesk.com>",
5
5
  "description": "DanX Vue / Quasar component library",
6
6
  "license": "MIT",
@@ -12,8 +12,8 @@
12
12
  </template>
13
13
 
14
14
  <script setup lang="ts">
15
- import { FormField } from "src/types";
16
15
  import { computed } from "vue";
16
+ import { FormField } from "../../../../types";
17
17
 
18
18
  const props = defineProps<{
19
19
  field?: FormField;
@@ -26,9 +26,8 @@
26
26
  v-for="file in uploadedFiles"
27
27
  :key="'file-upload-' + file.id"
28
28
  class="w-32 h-32 m-2 cursor-pointer bg-gray-200"
29
- :class="{'border border-dashed border-blue-600': !uploadedFiles.length}"
30
29
  :file="file"
31
- :related-files="uploadedFiles"
30
+ :related-files="file.transcodes || uploadedFiles"
32
31
  downloadable
33
32
  :removable="!readonly && !disable"
34
33
  @remove="onRemove(file)"
@@ -74,7 +74,7 @@ function isVideo(file) {
74
74
  }
75
75
 
76
76
  function getPreviewUrl(file) {
77
- return file.transcodes?.compress?.url || file.blobUrl || file.url;
77
+ return file.optimized?.url || file.blobUrl || file.url;
78
78
  }
79
79
 
80
80
  function getThumbUrl(file) {
@@ -107,7 +107,7 @@
107
107
  <FullScreenCarouselDialog
108
108
  v-if="showPreview && !disabled"
109
109
  :files="relatedFiles || [computedImage]"
110
- :default-slide="computedImage?.id || ''"
110
+ :default-slide="relatedFiles ? relatedFiles[0].id : (computedImage?.id || '')"
111
111
  @close="showPreview = false"
112
112
  />
113
113
  </div>
@@ -115,10 +115,10 @@
115
115
 
116
116
  <script setup lang="ts">
117
117
  import { DocumentTextIcon as TextFileIcon, DownloadIcon, PlayIcon } from "@heroicons/vue/outline";
118
- import { UploadedFile } from "src/types";
119
118
  import { computed, ComputedRef, ref } from "vue";
120
119
  import { download } from "../../../helpers";
121
120
  import { ImageIcon, PdfIcon, TrashIcon as RemoveIcon } from "../../../svg";
121
+ import { UploadedFile } from "../../../types";
122
122
  import { FullScreenCarouselDialog } from "../Dialogs";
123
123
 
124
124
  export interface FilePreviewProps {
@@ -171,10 +171,10 @@ const isImage = computed(() => !!mimeType.value.match(/^image\//));
171
171
  const isVideo = computed(() => !!mimeType.value.match(/^video\//));
172
172
  const isPdf = computed(() => !!mimeType.value.match(/^application\/pdf/));
173
173
  const previewUrl = computed(
174
- () => computedImage.value?.transcodes?.compress?.url || computedImage.value?.blobUrl || computedImage.value?.url
174
+ () => computedImage.value?.optimized?.url || computedImage.value?.blobUrl || computedImage.value?.url
175
175
  );
176
176
  const thumbUrl = computed(() => {
177
- return computedImage.value?.transcodes?.thumb?.url;
177
+ return computedImage.value?.thumb?.url;
178
178
  });
179
179
  const isPreviewable = computed(() => {
180
180
  return !!thumbUrl.value || isVideo.value || isImage.value;
@@ -55,9 +55,10 @@ export const request: RequestApi = {
55
55
 
56
56
  if (response.status === 401) {
57
57
  const onUnauthorized = danxOptions.value.request?.onUnauthorized;
58
- return onUnauthorized ? onUnauthorized(response) : {
58
+ return onUnauthorized ? onUnauthorized(result, response) : {
59
59
  error: true,
60
- message: "Unauthorized"
60
+ message: "Unauthorized",
61
+ ...result
61
62
  };
62
63
  }
63
64
 
@@ -0,0 +1,5 @@
1
+ .q-carousel {
2
+ .q-carousel__thumbnail--active {
3
+ @apply outline-1 outline-sky-800;
4
+ }
5
+ }
@@ -1,5 +1,6 @@
1
1
  @import "action-table";
2
2
  @import "buttons";
3
+ @import "carousels";
3
4
  @import "dialogs";
4
5
  @import "forms";
5
6
  @import "panels";
@@ -24,6 +24,9 @@ export interface UploadedFile {
24
24
  location?: string;
25
25
  blobUrl?: string;
26
26
  url?: string;
27
+ thumb?: UploadedFile;
28
+ optimized?: UploadedFile;
29
+ transcodes?: UploadedFile[];
27
30
  }
28
31
 
29
32
  export interface FileUploadCompleteCallbackParams {
@@ -1,4 +1,4 @@
1
- import { AnyObject } from "src/types/shared";
1
+ import { AnyObject } from "./shared";
2
2
 
3
3
  export interface RequestApi {
4
4
  abortControllers: { [key: string]: { abort: AbortController, timestamp: number } };
@@ -23,7 +23,7 @@ export interface HttpResponse {
23
23
  export interface RequestOptions {
24
24
  baseUrl?: string;
25
25
  headers?: AnyObject;
26
- onUnauthorized?: (response) => object;
26
+ onUnauthorized?: (result: any, response: Response) => object;
27
27
  onAppVersionMismatch?: (version) => void;
28
28
  }
29
29