quasar-ui-danx 0.4.54 → 0.4.56

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.56",
4
4
  "author": "Dan <dan@flytedesk.com>",
5
5
  "description": "DanX Vue / Quasar component library",
6
6
  "license": "MIT",
@@ -21,7 +21,7 @@ interface ActionFormProps {
21
21
  form: Form;
22
22
  noLabel?: boolean;
23
23
  showName?: boolean;
24
- disable?: boolean;
24
+ disabled?: boolean;
25
25
  readonly?: boolean;
26
26
  clearable?: boolean;
27
27
  fieldClass?: string;
@@ -38,7 +38,7 @@ const renderedFormProps = {
38
38
  form: props.form,
39
39
  noLabel: props.noLabel,
40
40
  showName: props.showName,
41
- disable: props.disable,
41
+ disabled: props.disabled,
42
42
  readonly: props.readonly,
43
43
  clearable: props.clearable,
44
44
  fieldClass: props.fieldClass,
@@ -2,7 +2,7 @@
2
2
  <QToggle
3
3
  :data-testid="'boolean-field-' + (name || label)"
4
4
  :model-value="modelValue || (toggleIndeterminate ? modelValue : false)"
5
- :disable="disable || readonly"
5
+ :disable="disabled || readonly"
6
6
  :toggle-indeterminate="toggleIndeterminate"
7
7
  :indeterminate-value="undefined"
8
8
  @update:model-value="$emit('update:model-value', $event)"
@@ -40,7 +40,7 @@ defineProps({
40
40
  },
41
41
  showName: Boolean,
42
42
  toggleIndeterminate: Boolean,
43
- disable: Boolean,
43
+ disabled: Boolean,
44
44
  readonly: Boolean
45
45
  });
46
46
  </script>
@@ -11,7 +11,7 @@
11
11
  />
12
12
 
13
13
  <input
14
- v-if="!disable && !readonly"
14
+ v-if="!disabled && !readonly"
15
15
  ref="file"
16
16
  class="hidden"
17
17
  type="file"
@@ -29,11 +29,11 @@
29
29
  :file="file"
30
30
  :related-files="file.transcodes || uploadedFiles"
31
31
  downloadable
32
- :removable="!readonly && !disable"
32
+ :removable="!readonly && !disabled"
33
33
  @remove="onRemove(file)"
34
34
  />
35
35
  <div
36
- v-if="!disable && !readonly"
36
+ v-if="!disabled && !readonly"
37
37
  class="dx-add-remove-files m-2 flex flex-col flex-nowrap items-center overflow-hidden cursor-pointer"
38
38
  :class="filePreviewClass"
39
39
  :style="styleSize"
@@ -85,7 +85,7 @@ const props = withDefaults(defineProps<{
85
85
  field?: FormField;
86
86
  label?: string;
87
87
  showName?: boolean;
88
- disable?: boolean;
88
+ disabled?: boolean;
89
89
  readonly?: boolean;
90
90
  width?: number | string;
91
91
  height?: number | string;
@@ -14,7 +14,7 @@
14
14
  <ShowHideButton
15
15
  v-if="showEdit"
16
16
  v-model="editing"
17
- :disable="!canEdit"
17
+ :disabled="!canEdit"
18
18
  :label="editText"
19
19
  :class="editClass"
20
20
  :show-icon="EditIcon"
@@ -3,7 +3,7 @@
3
3
  <ShowHideButton
4
4
  v-if="selectable"
5
5
  v-model="isSelecting"
6
- :disable="disable"
6
+ :disabled="disabled"
7
7
  :label="selectText"
8
8
  :saving="loading"
9
9
  :class="selectClass"
@@ -79,9 +79,11 @@
79
79
  :label="editText"
80
80
  :class="editClass"
81
81
  :size="size"
82
+ :disabled="editDisabled"
82
83
  class="opacity-0 group-hover:opacity-100 transition-all"
83
84
  :show-icon="EditIcon"
84
85
  :hide-icon="DoneEditingIcon"
86
+ :tooltip="editDisabled ? 'You are not allowed to edit' : ''"
85
87
  />
86
88
 
87
89
  <QBtn
@@ -132,7 +134,8 @@ withDefaults(defineProps<{
132
134
  deletable?: boolean;
133
135
  nameEditable?: boolean;
134
136
  clearable?: boolean;
135
- disable?: boolean;
137
+ disabled?: boolean;
138
+ editDisabled?: boolean;
136
139
  size?: ActionButtonProps["size"];
137
140
  }>(), {
138
141
  selectText: "",
@@ -13,7 +13,7 @@
13
13
  class="text-sm font-semibold"
14
14
  />
15
15
  <div
16
- v-if="!disable && !readonly"
16
+ v-if="!disabled && !readonly"
17
17
  class="text-sm mt-2"
18
18
  >
19
19
  <a
@@ -39,7 +39,7 @@
39
39
  :class="{'border border-dashed border-blue-600': !uploadedFile, 'mx-auto': !readonly}"
40
40
  :file="uploadedFile || undefined"
41
41
  downloadable
42
- @click="!disable && $refs.file.click()"
42
+ @click="!disabled && $refs.file.click()"
43
43
  />
44
44
  <div
45
45
  v-else-if="readonly"
@@ -63,7 +63,7 @@ const props = defineProps<{
63
63
  label?: string;
64
64
  name?: string;
65
65
  showName?: boolean;
66
- disable?: boolean;
66
+ disabled?: boolean;
67
67
  readonly?: boolean;
68
68
  }>();
69
69
  const { onComplete, onDrop, onFileSelected, uploadedFile, clearUploadedFile } = useSingleFileUpload();
@@ -15,7 +15,7 @@
15
15
  v-else
16
16
  class="mt-2"
17
17
  :api-key="danxOptions.tinyMceApiKey"
18
- :disabled="disable"
18
+ :disabled="disabled"
19
19
  :model-value="modelValue"
20
20
  @update:model-value="$emit('update:model-value', $event)"
21
21
  />
@@ -39,7 +39,7 @@ defineProps({
39
39
  },
40
40
  noLabel: Boolean,
41
41
  showName: Boolean,
42
- disable: Boolean,
42
+ disabled: Boolean,
43
43
  readonly: Boolean
44
44
  });
45
45
  </script>
@@ -27,7 +27,7 @@
27
27
  {{ name || "1" }}
28
28
  </div>
29
29
  <div
30
- v-if="!disable && !readonly && canModifyVariations"
30
+ v-if="!disabled && !readonly && canModifyVariations"
31
31
  class="flex flex-nowrap items-center mr-2"
32
32
  >
33
33
  <a
@@ -86,7 +86,8 @@
86
86
  :no-label="noLabel"
87
87
  :show-name="showName"
88
88
  :clearable="field.clearable || clearable"
89
- :disable="disable"
89
+ :disabled="disabled"
90
+ :disable="disabled"
90
91
  :readonly="readonly"
91
92
  @update:model-value="onInput(field.name, $event)"
92
93
  />
@@ -206,7 +207,8 @@ function getVnodeProps(field) {
206
207
  label: field.label,
207
208
  clearable: field.clearable || props.clearable,
208
209
  readonly: props.readonly,
209
- disable: props.disable,
210
+ disabled: props.disabled,
211
+ disable: props.disabled,
210
212
  showName: props.showName,
211
213
  noLabel: props.noLabel
212
214
  };
@@ -225,7 +227,7 @@ const currentVariation = ref(variationNames.value[0] || "");
225
227
  const newVariationName = ref("");
226
228
  const variationToEdit = ref<boolean | string>(false);
227
229
  const variationToDelete = ref("");
228
- const canAddVariation = computed(() => props.canModifyVariations && !props.readonly && !props.disable && variationNames.value.length < (props.form.variations || 0));
230
+ const canAddVariation = computed(() => props.canModifyVariations && !props.readonly && !props.disabled && variationNames.value.length < (props.form.variations || 0));
229
231
 
230
232
  function getFieldResponse(name: string, variation?: string) {
231
233
  if (!fieldResponses.value) return undefined;
@@ -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
 
@@ -23,7 +23,7 @@
23
23
  :label="doneText"
24
24
  class="dx-dialog-button dx-dialog-button-done"
25
25
  :class="doneClass"
26
- :disable="disable"
26
+ :disable="disabled"
27
27
  @click="onClose"
28
28
  >
29
29
  <slot name="done-text" />
@@ -40,7 +40,7 @@ import DialogLayout from "./DialogLayout";
40
40
  const emit = defineEmits(["update:model-value", "close"]);
41
41
  defineProps({
42
42
  ...DialogLayout.props,
43
- disable: Boolean,
43
+ disabled: Boolean,
44
44
  doneClass: {
45
45
  type: [String, Object],
46
46
  default: ""
@@ -27,7 +27,7 @@ const props = defineProps<{
27
27
  form: Form;
28
28
  noLabel?: boolean;
29
29
  showName?: boolean;
30
- disable?: boolean;
30
+ disabled?: boolean;
31
31
  readonly?: boolean;
32
32
  clearable?: boolean;
33
33
  fieldClass?: string;
@@ -41,7 +41,7 @@ const renderedFormProps = {
41
41
  form: props.form,
42
42
  noLabel: props.noLabel,
43
43
  showName: props.showName,
44
- disable: props.disable,
44
+ disabled: props.disabled,
45
45
  readonly: props.readonly,
46
46
  clearable: props.clearable,
47
47
  fieldClass: props.fieldClass,
@@ -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";
@@ -44,7 +44,7 @@ export interface RenderedFormProps {
44
44
  form: Form;
45
45
  noLabel?: boolean;
46
46
  showName?: boolean;
47
- disable?: boolean;
47
+ disabled?: boolean;
48
48
  readonly?: boolean;
49
49
  saving?: boolean;
50
50
  clearable?: boolean;