quasar-ui-danx 0.3.1 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +2 -1
- package/danx-local.sh +1 -0
- package/dist/danx.es.js +4084 -4008
- 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 +1 -1
- package/src/components/ActionTable/Filters/FilterListToggle.vue +5 -1
- package/src/components/ActionTable/Form/Fields/SelectDrawer.vue +1 -0
- package/src/components/ActionTable/Form/RenderedForm.vue +29 -16
- package/src/components/Navigation/NavigationMenu.vue +85 -0
- package/src/components/Navigation/index.ts +1 -0
- package/src/components/index.ts +1 -0
- package/src/styles/general.scss +18 -0
- package/src/styles/index.scss +1 -0
@@ -39,10 +39,14 @@ const activeCount = computed(() => Object.keys(props.filter).filter(key => props
|
|
39
39
|
</script>
|
40
40
|
<style lang="scss" scoped>
|
41
41
|
.btn-blue-highlight {
|
42
|
-
@apply rounded-lg border border-solid;
|
42
|
+
@apply rounded-lg border border-solid p-3 whitespace-nowrap;
|
43
43
|
|
44
44
|
&.highlighted {
|
45
45
|
box-shadow: 0 0 0 3px #B8E1FF;
|
46
46
|
}
|
47
|
+
|
48
|
+
:deep(.q-btn__content) {
|
49
|
+
@apply flex items-center flex-nowrap;
|
50
|
+
}
|
47
51
|
}
|
48
52
|
</style>
|
@@ -7,10 +7,11 @@
|
|
7
7
|
:key="name"
|
8
8
|
:name="name"
|
9
9
|
class="p-0"
|
10
|
+
content-class="w-full"
|
10
11
|
>
|
11
|
-
<div class="flex flex-nowrap items-center text-sm">
|
12
|
-
<div>{{ name || "
|
13
|
-
<
|
12
|
+
<div class="flex flex-nowrap items-center text-sm w-full">
|
13
|
+
<div class="flex-grow">{{ name || "1" }}</div>
|
14
|
+
<div v-if="!disable && !readonly && canModifyVariations" class="flex flex-nowrap items-center mr-2">
|
14
15
|
<a
|
15
16
|
@click="() => (variationToEdit = name) && (newVariationName = name)"
|
16
17
|
class="ml-1 p-1 hover:opacity-100 opacity-20 hover:bg-blue-200 rounded"
|
@@ -24,7 +25,7 @@
|
|
24
25
|
>
|
25
26
|
<RemoveIcon class="w-3 text-red-900" />
|
26
27
|
</a>
|
27
|
-
</
|
28
|
+
</div>
|
28
29
|
</div>
|
29
30
|
</QTab>
|
30
31
|
<QTab
|
@@ -115,7 +116,8 @@ const props = defineProps({
|
|
115
116
|
showName: Boolean,
|
116
117
|
disable: Boolean,
|
117
118
|
readonly: Boolean,
|
118
|
-
saving: Boolean
|
119
|
+
saving: Boolean,
|
120
|
+
canModifyVariations: Boolean
|
119
121
|
});
|
120
122
|
|
121
123
|
const FORM_FIELD_MAP = {
|
@@ -138,14 +140,19 @@ const mappedFields = props.form.fields.map((field) => ({
|
|
138
140
|
}));
|
139
141
|
|
140
142
|
const variationNames = computed(() => {
|
141
|
-
|
143
|
+
const names = [...new Set(props.values.map(v => v.variation))].sort();
|
144
|
+
// Always guarantee that we show the default variation
|
145
|
+
if (names.length === 0) {
|
146
|
+
names.push("");
|
147
|
+
}
|
148
|
+
return names;
|
142
149
|
});
|
143
150
|
|
144
151
|
const currentVariation = ref(variationNames.value[0] || "");
|
145
152
|
const newVariationName = ref("");
|
146
153
|
const variationToEdit = ref(false);
|
147
154
|
const variationToDelete = ref("");
|
148
|
-
const canAddVariation = computed(() =>
|
155
|
+
const canAddVariation = computed(() => props.canModifyVariations && !props.readonly && !props.disable && variationNames.value.length < props.form.variations);
|
149
156
|
|
150
157
|
function getFieldResponse(name) {
|
151
158
|
if (!props.values) return undefined;
|
@@ -165,19 +172,25 @@ function onInput(name, value) {
|
|
165
172
|
emit("update:values", newValues);
|
166
173
|
}
|
167
174
|
|
175
|
+
function createVariation(variation) {
|
176
|
+
return props.form.fields.map((field) => ({
|
177
|
+
variation,
|
178
|
+
name: field.name,
|
179
|
+
value: field.type === "BOOLEAN" ? false : null
|
180
|
+
}));
|
181
|
+
}
|
182
|
+
|
168
183
|
function onAddVariation() {
|
169
184
|
if (props.saving) return;
|
185
|
+
let newValues = [...props.values];
|
170
186
|
|
187
|
+
if (newValues.length === 0) {
|
188
|
+
newValues = createVariation("");
|
189
|
+
}
|
171
190
|
const previousName = variationNames.value[variationNames.value.length - 1];
|
172
|
-
const newName = incrementName(!previousName ? "
|
173
|
-
|
174
|
-
|
175
|
-
variation: newName,
|
176
|
-
name: field.name,
|
177
|
-
value: field.type === "BOOLEAN" ? false : null
|
178
|
-
}));
|
179
|
-
const newValues = [...props.values, ...newVariation];
|
180
|
-
emit("update:values", newValues);
|
191
|
+
const newName = incrementName(!previousName ? "1" : previousName);
|
192
|
+
const newVariation = createVariation(newName);
|
193
|
+
emit("update:values", [...newValues, ...newVariation]);
|
181
194
|
currentVariation.value = newName;
|
182
195
|
}
|
183
196
|
|
@@ -0,0 +1,85 @@
|
|
1
|
+
<template>
|
2
|
+
<div
|
3
|
+
class="p-4"
|
4
|
+
:class="{ 'is-collapsed': collapsed }"
|
5
|
+
>
|
6
|
+
<div
|
7
|
+
v-for="item in allowedItems"
|
8
|
+
:key="'nav-item-' + item.label"
|
9
|
+
>
|
10
|
+
<a class="nav-link" @click="item.onClick">
|
11
|
+
<component
|
12
|
+
:is="item.icon"
|
13
|
+
class="nav-icon"
|
14
|
+
/>
|
15
|
+
<div class="label ml-2">{{ item.label }}</div>
|
16
|
+
<QTooltip v-if="collapsed">{{ item.label }}</QTooltip>
|
17
|
+
</a>
|
18
|
+
<QSeparator
|
19
|
+
v-if="item.separator"
|
20
|
+
:key="'separator-' + item.label"
|
21
|
+
class="my-2"
|
22
|
+
/>
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
</template>
|
26
|
+
<script setup>
|
27
|
+
import { computed } from "vue";
|
28
|
+
|
29
|
+
const props = defineProps({
|
30
|
+
collapsed: Boolean,
|
31
|
+
items: {
|
32
|
+
type: Array,
|
33
|
+
required: true
|
34
|
+
}
|
35
|
+
});
|
36
|
+
|
37
|
+
const allowedItems = computed(() => props.items.filter((item) => !item.hidden));
|
38
|
+
</script>
|
39
|
+
|
40
|
+
<style lang="scss">
|
41
|
+
.nav-link {
|
42
|
+
display: block !important;
|
43
|
+
padding: 1.2em;
|
44
|
+
border-radius: 0.5em;
|
45
|
+
font-weight: bold;
|
46
|
+
font-size: 14px;
|
47
|
+
color: black;
|
48
|
+
height: 3.8em;
|
49
|
+
width: 13em;
|
50
|
+
transition: all 150ms;
|
51
|
+
|
52
|
+
&:hover {
|
53
|
+
@apply bg-gray-200;
|
54
|
+
.nav-icon {
|
55
|
+
@apply text-gray-700;
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
&.is-active {
|
60
|
+
@apply bg-blue-100;
|
61
|
+
}
|
62
|
+
|
63
|
+
&.is-disabled {
|
64
|
+
@apply bg-inherit;
|
65
|
+
}
|
66
|
+
|
67
|
+
.label {
|
68
|
+
@apply transition-all;
|
69
|
+
}
|
70
|
+
|
71
|
+
.nav-icon {
|
72
|
+
@apply w-5 h-5 flex-shrink-0 text-black;
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
.is-collapsed {
|
77
|
+
.nav-link {
|
78
|
+
width: 3.8em;
|
79
|
+
}
|
80
|
+
|
81
|
+
.label {
|
82
|
+
@apply opacity-0;
|
83
|
+
}
|
84
|
+
}
|
85
|
+
</style>
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default as NavigationMenu } from "./NavigationMenu.vue";
|
package/src/components/index.ts
CHANGED
package/src/styles/index.scss
CHANGED