quasar-ui-danx 0.3.26 → 0.3.27

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.3.26",
3
+ "version": "0.3.27",
4
4
  "author": "Dan <dan@flytedesk.com>",
5
5
  "description": "DanX Vue / Quasar component library",
6
6
  "license": "MIT",
@@ -1,109 +1,109 @@
1
1
  <template>
2
- <div class="rendered-form">
3
- <div
4
- v-if="form.variations > 1"
5
- class="mb-4"
6
- >
7
- <QTabs
8
- v-model="currentVariation"
9
- class="text-xs"
10
- >
11
- <QTab
12
- v-for="(name, index) in variationNames"
13
- :key="name"
14
- :name="name"
15
- class="p-0"
16
- content-class="w-full"
17
- >
18
- <div class="flex flex-nowrap items-center text-sm w-full">
19
- <div
20
- v-if="!isVariationFormComplete(name)"
21
- class="variation-missing-icon pl-1"
22
- >
23
- <MissingIcon class="text-red-400 w-4" />
24
- <QTooltip>Creative Form Incomplete</QTooltip>
25
- </div>
26
- <div class="flex-grow">
27
- {{ name || "1" }}
28
- </div>
29
- <div
30
- v-if="!disable && !readonly && canModifyVariations"
31
- class="flex flex-nowrap items-center mr-2"
32
- >
33
- <a
34
- class="ml-1 p-1 hover:opacity-100 opacity-20 hover:bg-blue-200 rounded"
35
- @click="() => (variationToEdit = name) && (newVariationName = name)"
36
- >
37
- <EditIcon class="w-3 text-blue-900" />
38
- </a>
39
- <a
40
- v-if="index > 0"
41
- class="ml-1 p-1 hover:opacity-100 opacity-20 hover:bg-red-200 rounded"
42
- @click="variationToDelete = name"
43
- >
44
- <RemoveIcon class="w-3 text-red-900" />
45
- </a>
46
- </div>
47
- </div>
48
- </QTab>
49
- <QTab
50
- v-if="canAddVariation"
51
- key="add-new-variation"
52
- name="add"
53
- class="bg-blue-600 rounded-t-lg !text-white"
54
- @click="onAddVariation"
55
- >
56
- <template v-if="saving">
57
- <QSpinnerBall class="w-4" />
58
- </template>
59
- <template v-else>
60
- + Add Variation
61
- </template>
62
- </QTab>
63
- </QTabs>
64
- </div>
65
- <div
66
- v-for="(field, index) in mappedFields"
67
- :key="field.id"
68
- :class="{ 'mt-4': index > 0 }"
69
- >
70
- <Component
71
- :is="field.component"
72
- :key="field.name + '-' + currentVariation"
73
- :model-value="getFieldValue(field.name)"
74
- :field="field"
75
- :label="field.label || undefined"
76
- :no-label="noLabel"
77
- :show-name="showName"
78
- :clearable="field.clearable || clearable"
79
- :disable="disable"
80
- :readonly="readonly"
81
- @update:model-value="onInput(field.name, $event)"
82
- />
83
- </div>
84
- <ConfirmDialog
85
- v-if="variationToEdit !== false"
86
- title="Change variation name"
87
- @confirm="onChangeVariationName"
88
- @close="variationToEdit = false"
89
- >
90
- <TextField
91
- v-model="newVariationName"
92
- label="Enter name"
93
- placeholder="Variation Name"
94
- input-class="bg-white"
95
- />
96
- </ConfirmDialog>
97
- <ConfirmDialog
98
- v-if="variationToDelete"
99
- :title="`Remove variation ${variationToDelete}?`"
100
- content="You cannot undo this action. If there was any analytics collected for this variation, it will still be attributed to the ad."
101
- confirm-class="bg-red-900 text-white"
102
- content-class="w-96"
103
- @confirm="onRemoveVariation(variationToDelete)"
104
- @close="variationToDelete = ''"
105
- />
106
- </div>
2
+ <div class="rendered-form">
3
+ <div
4
+ v-if="form.variations > 1"
5
+ class="mb-4"
6
+ >
7
+ <QTabs
8
+ v-model="currentVariation"
9
+ class="text-xs"
10
+ >
11
+ <QTab
12
+ v-for="(name, index) in variationNames"
13
+ :key="name"
14
+ :name="name"
15
+ class="p-0"
16
+ content-class="w-full"
17
+ >
18
+ <div class="flex flex-nowrap items-center text-sm w-full">
19
+ <div
20
+ v-if="!isVariationFormComplete(name)"
21
+ class="variation-missing-icon pl-1"
22
+ >
23
+ <MissingIcon class="text-red-400 w-4" />
24
+ <QTooltip>Creative Form Incomplete</QTooltip>
25
+ </div>
26
+ <div class="flex-grow">
27
+ {{ name || "1" }}
28
+ </div>
29
+ <div
30
+ v-if="!disable && !readonly && canModifyVariations"
31
+ class="flex flex-nowrap items-center mr-2"
32
+ >
33
+ <a
34
+ class="ml-1 p-1 hover:opacity-100 opacity-20 hover:bg-blue-200 rounded"
35
+ @click="() => (variationToEdit = name) && (newVariationName = name)"
36
+ >
37
+ <EditIcon class="w-3 text-blue-900" />
38
+ </a>
39
+ <a
40
+ v-if="index > 0"
41
+ class="ml-1 p-1 hover:opacity-100 opacity-20 hover:bg-red-200 rounded"
42
+ @click="variationToDelete = name"
43
+ >
44
+ <RemoveIcon class="w-3 text-red-900" />
45
+ </a>
46
+ </div>
47
+ </div>
48
+ </QTab>
49
+ <QTab
50
+ v-if="canAddVariation"
51
+ key="add-new-variation"
52
+ name="add"
53
+ class="bg-blue-600 rounded-t-lg !text-white"
54
+ @click="onAddVariation"
55
+ >
56
+ <template v-if="saving">
57
+ <QSpinnerBall class="w-4" />
58
+ </template>
59
+ <template v-else>
60
+ + Add Variation
61
+ </template>
62
+ </QTab>
63
+ </QTabs>
64
+ </div>
65
+ <div
66
+ v-for="(field, index) in mappedFields"
67
+ :key="field.id"
68
+ :class="{ 'mt-4': index > 0 }"
69
+ >
70
+ <Component
71
+ :is="field.component"
72
+ :key="field.name + '-' + currentVariation"
73
+ :model-value="getFieldValue(field.name)"
74
+ :field="field"
75
+ :label="field.label || undefined"
76
+ :no-label="noLabel"
77
+ :show-name="showName"
78
+ :clearable="field.clearable || clearable"
79
+ :disable="disable"
80
+ :readonly="readonly"
81
+ @update:model-value="onInput(field.name, $event)"
82
+ />
83
+ </div>
84
+ <ConfirmDialog
85
+ v-if="variationToEdit !== false"
86
+ title="Change variation name"
87
+ @confirm="onChangeVariationName"
88
+ @close="variationToEdit = false"
89
+ >
90
+ <TextField
91
+ v-model="newVariationName"
92
+ label="Enter name"
93
+ placeholder="Variation Name"
94
+ input-class="bg-white"
95
+ />
96
+ </ConfirmDialog>
97
+ <ConfirmDialog
98
+ v-if="variationToDelete"
99
+ :title="`Remove variation ${variationToDelete}?`"
100
+ content="You cannot undo this action. If there was any analytics collected for this variation, it will still be attributed to the ad."
101
+ confirm-class="bg-red-900 text-white"
102
+ content-class="w-96"
103
+ @confirm="onRemoveVariation(variationToDelete)"
104
+ @close="variationToDelete = ''"
105
+ />
106
+ </div>
107
107
  </template>
108
108
  <script setup>
109
109
  import { ExclamationCircleIcon as MissingIcon, PencilIcon as EditIcon } from "@heroicons/vue/solid";
@@ -161,8 +161,7 @@ const FORM_FIELD_MAP = {
161
161
  const mappedFields = props.form.fields.map((field) => ({
162
162
  placeholder: `Enter ${field.label}`,
163
163
  ...field,
164
- component: FORM_FIELD_MAP[field.type],
165
- default: field.type === "BOOLEAN" ? false : ""
164
+ component: FORM_FIELD_MAP[field.type]
166
165
  }));
167
166
 
168
167
  const variationNames = computed(() => {
@@ -202,7 +201,7 @@ function createVariation(variation) {
202
201
  return props.form.fields.map((field) => ({
203
202
  variation,
204
203
  name: field.name,
205
- value: field.type === "BOOLEAN" ? false : null
204
+ value: field.default_value === undefined ? null : field.default_value
206
205
  }));
207
206
  }
208
207