quasar-ui-danx 0.3.1 → 0.3.3

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.
@@ -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>
@@ -14,6 +14,7 @@
14
14
  @click="toggleSelect(option)"
15
15
  >
16
16
  <QCheckbox
17
+ @click.stop="toggleSelect(option)"
17
18
  :model-value="isSelected(option)"
18
19
  class="mr-2"
19
20
  />
@@ -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 || "(Default)" }}</div>
13
- <template v-if="!disable && !readonly">
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
- </template>
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
- return [...new Set(props.values.map(v => v.variation))].sort();
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(() => variationNames.value.length < props.form.variations && !props.readonly && !props.disable);
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 ? "Variation 1" : previousName);
173
-
174
- const newVariation = props.form.fields.map((field) => ({
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";
@@ -1,5 +1,6 @@
1
1
  export * from "./ActionTable";
2
2
  export * from "./AuditHistory";
3
3
  export * from "./DragAndDrop";
4
+ export * from "./Navigation";
4
5
  export * from "./PanelsDrawer";
5
6
  export * from "./Utility";
@@ -0,0 +1,18 @@
1
+ body {
2
+ height: 100vh;
3
+
4
+ #app,
5
+ #main-layout,
6
+ main {
7
+ height: 100%;
8
+ }
9
+ }
10
+
11
+ a {
12
+ cursor: pointer;
13
+
14
+ &.is-disabled {
15
+ opacity: 0.5;
16
+ cursor: not-allowed;
17
+ }
18
+ }
@@ -3,3 +3,4 @@
3
3
  @tailwind utilities;
4
4
 
5
5
  @import 'quasar-reset';
6
+ @import "general";