quasar-ui-danx 0.3.7 → 0.3.9
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/.eslintrc.cjs +37 -0
- package/dist/danx.es.js +5295 -5255
- package/dist/danx.es.js.map +1 -1
- package/dist/danx.umd.js +5 -5
- package/dist/danx.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +2 -1
- package/src/components/ActionTable/Form/RenderedForm.vue +86 -51
- package/src/components/Navigation/NavigationMenu.vue +34 -19
- package/src/components/Utility/Tabs/IndicatorTab.vue +11 -9
- package/src/styles/index.scss +2 -1
- package/src/styles/transitions.scss +15 -0
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "quasar-ui-danx",
|
3
|
-
"version": "0.3.
|
3
|
+
"version": "0.3.9",
|
4
4
|
"author": "Dan <dan@flytedesk.com>",
|
5
5
|
"description": "DanX Vue / Quasar component library",
|
6
6
|
"license": "MIT",
|
@@ -28,6 +28,7 @@
|
|
28
28
|
"core-js": "^3.0.0",
|
29
29
|
"cssnano": "^4.1.10",
|
30
30
|
"eslint": "^8.5.0",
|
31
|
+
"eslint-plugin-import": "^2.29.1",
|
31
32
|
"eslint-plugin-vue": "^9.24.1",
|
32
33
|
"fs-extra": "^8.1.0",
|
33
34
|
"postcss": "^8.4.38",
|
@@ -1,27 +1,45 @@
|
|
1
1
|
<template>
|
2
2
|
<div class="rendered-form">
|
3
|
-
<div
|
4
|
-
|
3
|
+
<div
|
4
|
+
v-if="form.variations > 1"
|
5
|
+
class="mb-4"
|
6
|
+
>
|
7
|
+
<QTabs
|
8
|
+
v-model="currentVariation"
|
9
|
+
class="text-xs"
|
10
|
+
>
|
5
11
|
<QTab
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
12
|
+
v-for="(name, index) in variationNames"
|
13
|
+
:key="name"
|
14
|
+
:name="name"
|
15
|
+
class="p-0"
|
16
|
+
content-class="w-full"
|
11
17
|
>
|
12
18
|
<div class="flex flex-nowrap items-center text-sm w-full">
|
13
|
-
<div
|
14
|
-
|
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
|
+
>
|
15
33
|
<a
|
16
|
-
|
17
|
-
|
34
|
+
class="ml-1 p-1 hover:opacity-100 opacity-20 hover:bg-blue-200 rounded"
|
35
|
+
@click="() => (variationToEdit = name) && (newVariationName = name)"
|
18
36
|
>
|
19
37
|
<EditIcon class="w-3 text-blue-900" />
|
20
38
|
</a>
|
21
39
|
<a
|
22
|
-
|
23
|
-
|
24
|
-
|
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"
|
25
43
|
>
|
26
44
|
<RemoveIcon class="w-3 text-red-900" />
|
27
45
|
</a>
|
@@ -29,63 +47,65 @@
|
|
29
47
|
</div>
|
30
48
|
</QTab>
|
31
49
|
<QTab
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
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"
|
37
55
|
>
|
38
56
|
<template v-if="saving">
|
39
57
|
<QSpinnerBall class="w-4" />
|
40
58
|
</template>
|
41
|
-
<template v-else
|
59
|
+
<template v-else>
|
60
|
+
+ Add Variation
|
61
|
+
</template>
|
42
62
|
</QTab>
|
43
63
|
</QTabs>
|
44
64
|
</div>
|
45
65
|
<div
|
46
|
-
|
47
|
-
|
48
|
-
|
66
|
+
v-for="(field, index) in mappedFields"
|
67
|
+
:key="field.id"
|
68
|
+
:class="{ 'mt-4': index > 0 }"
|
49
69
|
>
|
50
70
|
<Component
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
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
|
+
:disable="disable"
|
79
|
+
:readonly="readonly"
|
80
|
+
@update:model-value="onInput(field.name, $event)"
|
61
81
|
/>
|
62
82
|
</div>
|
63
83
|
<ConfirmDialog
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
84
|
+
v-if="variationToEdit !== false"
|
85
|
+
title="Change variation name"
|
86
|
+
@confirm="onChangeVariationName"
|
87
|
+
@close="variationToEdit = false"
|
68
88
|
>
|
69
89
|
<TextField
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
90
|
+
v-model="newVariationName"
|
91
|
+
label="Enter name"
|
92
|
+
placeholder="Variation Name"
|
93
|
+
input-class="bg-white"
|
74
94
|
/>
|
75
95
|
</ConfirmDialog>
|
76
96
|
<ConfirmDialog
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
97
|
+
v-if="variationToDelete"
|
98
|
+
:title="`Remove variation ${variationToDelete}?`"
|
99
|
+
content="You cannot undo this action. If there was any analytics collected for this variation, it will still be attributed to the ad."
|
100
|
+
confirm-class="bg-red-900 text-white"
|
101
|
+
content-class="w-96"
|
102
|
+
@confirm="onRemoveVariation(variationToDelete)"
|
103
|
+
@close="variationToDelete = ''"
|
84
104
|
/>
|
85
105
|
</div>
|
86
106
|
</template>
|
87
107
|
<script setup>
|
88
|
-
import { PencilIcon as EditIcon } from "@heroicons/vue/solid";
|
108
|
+
import { ExclamationCircleIcon as MissingIcon, PencilIcon as EditIcon } from "@heroicons/vue/solid";
|
89
109
|
import { computed, ref } from "vue";
|
90
110
|
import { FlashMessages, incrementName, replace } from "../../../helpers";
|
91
111
|
import { TrashIcon as RemoveIcon } from "../../../svg";
|
@@ -154,9 +174,9 @@ const variationToEdit = ref(false);
|
|
154
174
|
const variationToDelete = ref("");
|
155
175
|
const canAddVariation = computed(() => props.canModifyVariations && !props.readonly && !props.disable && variationNames.value.length < props.form.variations);
|
156
176
|
|
157
|
-
function getFieldResponse(name) {
|
177
|
+
function getFieldResponse(name, variation) {
|
158
178
|
if (!props.values) return undefined;
|
159
|
-
return props.values.find((v) => v.variation === currentVariation.value && v.name === name);
|
179
|
+
return props.values.find((v) => v.variation === (variation !== undefined ? variation : currentVariation.value) && v.name === name);
|
160
180
|
}
|
161
181
|
function getFieldValue(name) {
|
162
182
|
return getFieldResponse(name)?.value;
|
@@ -224,4 +244,19 @@ function onRemoveVariation(name) {
|
|
224
244
|
}
|
225
245
|
variationToDelete.value = "";
|
226
246
|
}
|
247
|
+
|
248
|
+
function isVariationFormComplete(variation) {
|
249
|
+
const requiredGroups = {};
|
250
|
+
return props.form.fields.filter(r => r.required || r.required_group).every((field) => {
|
251
|
+
const fieldResponse = getFieldResponse(field.name, variation);
|
252
|
+
const hasValue = !!fieldResponse && fieldResponse.value !== null;
|
253
|
+
if (field.required_group) {
|
254
|
+
// This required group has already been satisfied
|
255
|
+
if (requiredGroups[field.required_group]) return true;
|
256
|
+
return requiredGroups[field.required_group] = hasValue;
|
257
|
+
} else {
|
258
|
+
return hasValue;
|
259
|
+
}
|
260
|
+
});
|
261
|
+
}
|
227
262
|
</script>
|
@@ -1,29 +1,46 @@
|
|
1
1
|
<template>
|
2
2
|
<div
|
3
|
-
|
4
|
-
|
3
|
+
class="p-4"
|
4
|
+
:class="{ 'is-collapsed': collapsed }"
|
5
5
|
>
|
6
6
|
<div
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
:class="item.class || itemClass"
|
7
|
+
v-for="item in allowedItems"
|
8
|
+
:key="'nav-item-' + item.label"
|
9
|
+
class="nav-menu-item-box"
|
11
10
|
>
|
12
|
-
<div
|
13
|
-
|
11
|
+
<div
|
12
|
+
class="nav-menu-item flex flex-nowrap"
|
13
|
+
:class="item.class || itemClass"
|
14
|
+
@click="item.onClick"
|
15
|
+
>
|
16
|
+
<div
|
17
|
+
v-if="item.icon"
|
18
|
+
class="flex-shrink-0"
|
19
|
+
>
|
14
20
|
<component
|
15
|
-
|
16
|
-
|
17
|
-
|
21
|
+
:is="item.icon"
|
22
|
+
class="nav-icon"
|
23
|
+
:class="item.iconClass"
|
18
24
|
/>
|
19
25
|
</div>
|
20
|
-
<div
|
21
|
-
|
26
|
+
<div
|
27
|
+
v-if="!collapsed"
|
28
|
+
class="label ml-2"
|
29
|
+
:class="item.labelClass"
|
30
|
+
>
|
31
|
+
{{ item.label }}
|
32
|
+
</div>
|
33
|
+
<QTooltip
|
34
|
+
v-if="collapsed"
|
35
|
+
v-bind="item.tooltip"
|
36
|
+
>
|
37
|
+
{{ item.tooltip?.text || item.label }}
|
38
|
+
</QTooltip>
|
22
39
|
</div>
|
23
40
|
<QSeparator
|
24
|
-
|
25
|
-
|
26
|
-
|
41
|
+
v-if="item.separator"
|
42
|
+
:key="'separator-' + item.label"
|
43
|
+
class="my-2"
|
27
44
|
/>
|
28
45
|
</div>
|
29
46
|
</div>
|
@@ -52,12 +69,10 @@ const allowedItems = computed(() => props.items.filter((item) => !item.hidden));
|
|
52
69
|
|
53
70
|
<style lang="scss">
|
54
71
|
.nav-menu-item {
|
55
|
-
padding:
|
72
|
+
padding: 1em;
|
56
73
|
border-radius: 0.5em;
|
57
74
|
font-weight: bold;
|
58
75
|
font-size: 14px;
|
59
|
-
height: 3.8em;
|
60
|
-
width: 13em;
|
61
76
|
transition: all 150ms, color 0ms;
|
62
77
|
cursor: pointer;
|
63
78
|
|
@@ -1,20 +1,22 @@
|
|
1
1
|
<template>
|
2
2
|
<QTab
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
:name="name"
|
4
|
+
class="w-full"
|
5
|
+
content-class="w-full"
|
6
6
|
>
|
7
7
|
<div class="flex items-center w-full">
|
8
|
-
<div class="flex-grow text-sm">
|
8
|
+
<div class="flex-grow text-sm">
|
9
|
+
{{ label }}
|
10
|
+
</div>
|
9
11
|
<div>
|
10
12
|
<OverdueIcon
|
11
|
-
|
12
|
-
|
13
|
-
|
13
|
+
v-if="overdue"
|
14
|
+
class="w-5 ml-2"
|
15
|
+
:class="isActive ? 'text-white' : 'text-red-400'"
|
14
16
|
/>
|
15
17
|
<WarningIcon
|
16
|
-
|
17
|
-
|
18
|
+
v-else-if="warning"
|
19
|
+
class="text-yellow-600 w-5"
|
18
20
|
/>
|
19
21
|
</div>
|
20
22
|
</div>
|
package/src/styles/index.scss
CHANGED