quasar-ui-danx 0.4.54 → 0.4.55

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.54",
3
+ "version": "0.4.55",
4
4
  "author": "Dan <dan@flytedesk.com>",
5
5
  "description": "DanX Vue / Quasar component library",
6
6
  "license": "MIT",
@@ -10,7 +10,7 @@
10
10
  <component
11
11
  :is="icon || typeOptions.icon"
12
12
  class="transition-all"
13
- :class="iconClass + ' ' + typeOptions.iconClass"
13
+ :class="resolvedIconClass"
14
14
  />
15
15
  <slot>
16
16
  <div
@@ -60,6 +60,8 @@ import {
60
60
  FaSolidCircleCheck as ConfirmIcon,
61
61
  FaSolidCircleXmark as CancelIcon,
62
62
  FaSolidCopy as CopyIcon,
63
+ FaSolidFileExport as ExportIcon,
64
+ FaSolidFileImport as ImportIcon,
63
65
  FaSolidPause as PauseIcon,
64
66
  FaSolidPencil as EditIcon,
65
67
  FaSolidPlay as PlayIcon,
@@ -71,7 +73,7 @@ import { computed, ref } from "vue";
71
73
  import { ActionTarget, ResourceAction } from "../../../types";
72
74
 
73
75
  export interface ActionButtonProps {
74
- type?: "trash" | "trash-red" | "create" | "edit" | "copy" | "play" | "stop" | "pause" | "refresh" | "confirm" | "cancel";
76
+ type?: "trash" | "trash-red" | "create" | "edit" | "copy" | "play" | "stop" | "pause" | "refresh" | "confirm" | "cancel" | "export" | "import";
75
77
  color?: "red" | "blue" | "sky" | "sky-invert" | "green" | "green-invert" | "lime" | "white" | "gray";
76
78
  size?: "xxs" | "xs" | "sm" | "md" | "lg";
77
79
  icon?: object | string;
@@ -160,64 +162,37 @@ const colorClass = computed(() => {
160
162
  return "";
161
163
  }
162
164
  });
165
+
166
+ const resolvedIconClass = computed(() => props.iconClass + " " + mappedSizeClass[props.size].icon);
167
+
163
168
  const typeOptions = computed(() => {
164
- const iconClass = mappedSizeClass[props.size].icon;
165
169
  switch (props.type) {
166
170
  case "trash":
167
- return {
168
- icon: TrashIcon,
169
- iconClass
170
- };
171
+ return { icon: TrashIcon };
172
+ case "export":
173
+ return { icon: ExportIcon };
174
+ case "import":
175
+ return { icon: ImportIcon };
171
176
  case "create":
172
- return {
173
- icon: CreateIcon,
174
- iconClass
175
- };
177
+ return { icon: CreateIcon };
176
178
  case "confirm":
177
- return {
178
- icon: ConfirmIcon,
179
- iconClass
180
- };
179
+ return { icon: ConfirmIcon };
181
180
  case "cancel":
182
- return {
183
- icon: CancelIcon,
184
- iconClass
185
- };
181
+ return { icon: CancelIcon };
186
182
  case "edit":
187
- return {
188
- icon: EditIcon,
189
- iconClass
190
- };
183
+ return { icon: EditIcon };
191
184
  case "copy":
192
- return {
193
- icon: CopyIcon,
194
- iconClass
195
- };
185
+ return { icon: CopyIcon };
196
186
  case "play":
197
- return {
198
- icon: PlayIcon,
199
- iconClass
200
- };
187
+ return { icon: PlayIcon };
201
188
  case "stop":
202
- return {
203
- icon: StopIcon,
204
- iconClass
205
- };
189
+ return { icon: StopIcon };
206
190
  case "pause":
207
- return {
208
- icon: PauseIcon,
209
- iconClass
210
- };
191
+ return { icon: PauseIcon };
211
192
  case "refresh":
212
- return {
213
- icon: RefreshIcon,
214
- iconClass
215
- };
193
+ return { icon: RefreshIcon };
216
194
  default:
217
- return {
218
- icon: EditIcon,
219
- iconClass
220
- };
195
+ return { icon: EditIcon };
221
196
  }
222
197
  });
223
198
 
@@ -1,5 +1,6 @@
1
1
  import { uid } from "quasar";
2
2
  import { danxOptions } from "../config";
3
+ import { DateTime, parseDateTime } from "../helpers/formats";
3
4
  import {
4
5
  FileUploadAllCompleteCallback,
5
6
  FileUploadCompleteCallback,
@@ -278,11 +279,15 @@ export class FileUpload {
278
279
  */
279
280
  isTranscoding(file: UploadedFile) {
280
281
  const metaTranscodes = file?.meta?.transcodes || [];
281
-
282
282
  for (const transcodeName of Object.keys(metaTranscodes)) {
283
283
  const transcode = metaTranscodes[transcodeName];
284
+
284
285
  if (transcode.status === "Pending" || transcode.status === "In Progress") {
285
- return true;
286
+ const startedAt = parseDateTime(transcode.started_at);
287
+ const duration = startedAt && DateTime.now().diff(startedAt, "minutes");
288
+ if (!duration?.minutes || duration.minutes < 30) {
289
+ return true;
290
+ }
286
291
  }
287
292
  }
288
293
  return false;
@@ -0,0 +1,20 @@
1
+ import { AnyObject } from "../types";
2
+
3
+ export function importJson(file: File): Promise<AnyObject> {
4
+ return new Promise((resolve, reject) => {
5
+ const reader = new FileReader();
6
+ let jsonData = null;
7
+
8
+ reader.onload = async (e) => {
9
+ try {
10
+ jsonData = JSON.parse(e.target?.result as string);
11
+ resolve(jsonData);
12
+ } catch (error) {
13
+ console.error("Invalid JSON file:", error);
14
+ reject(error);
15
+ }
16
+ };
17
+
18
+ reader.readAsText(file);
19
+ });
20
+ }
@@ -10,6 +10,7 @@ export * from "./FileUpload";
10
10
  export * from "./FlashMessages";
11
11
  export * from "./formats";
12
12
  export * from "./hotkeys";
13
+ export * from "./importFile";
13
14
  export * from "./multiFileUpload";
14
15
  export * from "./objectStore";
15
16
  export * from "./request";