@hostlink/nuxt-light 0.0.15 → 0.0.16

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/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "light",
3
3
  "configKey": "light",
4
- "version": "0.0.15"
4
+ "version": "0.0.16"
5
5
  }
@@ -37,8 +37,6 @@ if (user.value && user.value.roles.indexOf('Administrators') != -1) {
37
37
  showViewAs = true;
38
38
  }
39
39
 
40
- //const menus = (await queryContent("/menus").findOne()).menus;
41
- const menus = [];
42
40
 
43
41
  const menuOverlayHeader = ref(false)
44
42
  const layoutView = computed(() => {
@@ -178,7 +176,6 @@ const errors = computed(() => {
178
176
  <!-- drawer content -->
179
177
  <q-scroll-area class="fit">
180
178
  <l-menu v-for="menu in app.menus" :value="menu" v-if="isAdmin" :dense="style.dense" />
181
- <l-menu v-for="menu in menus" :value="menu" />
182
179
  </q-scroll-area>
183
180
  </q-drawer>
184
181
 
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
 
3
- defineProps(["value","dense"])
3
+ defineProps(["value", "dense"])
4
4
 
5
5
  </script>
6
6
 
@@ -19,9 +19,9 @@ defineProps(["value","dense"])
19
19
  </style>
20
20
 
21
21
  <template>
22
- <q-expansion-item v-if="value.menus" :label="value.label" :icon="value.icon" :dense="dense">
22
+ <q-expansion-item v-if="value.children?.length > 0" :label="value.label" :icon="value.icon" :dense="dense">
23
23
  <q-list class="q-pl-md">
24
- <l-menu :value="menu" v-for="menu in value.menus" :dense="dense"></l-menu>
24
+ <l-menu :value="menu" v-for="menu in value.children" :dense="dense"></l-menu>
25
25
  </q-list>
26
26
  </q-expansion-item>
27
27
  <q-list v-else class="menu-list" :dense="dense">
@@ -151,9 +151,31 @@ const onMoveToRoot = () => {
151
151
  menus.value.push(newNode);
152
152
 
153
153
  showMove.value = false;
154
+ }
154
155
 
156
+ const getParentNode = (node) => {
157
+ if (!node.parent) return menus.value;
158
+ return tree1.value.getNodeByKey(node.parent);
159
+ }
155
160
 
161
+ const onMoveUp = (node) => {
162
+ const parent = getParentNode(node);
163
+ const index = parent.children.findIndex((item) => item.uuid === node.uuid);
164
+ if (index > 0) {
165
+ const temp = parent.children[index - 1];
166
+ parent.children[index - 1] = node;
167
+ parent.children[index] = temp;
168
+ }
169
+ }
156
170
 
171
+ const onMoveDown = (node) => {
172
+ const parent = getParentNode(node);
173
+ const index = parent.children.findIndex((item) => item.uuid === node.uuid);
174
+ if (index < parent.children.length - 1) {
175
+ const temp = parent.children[index + 1];
176
+ parent.children[index + 1] = node;
177
+ parent.children[index] = temp;
178
+ }
157
179
  }
158
180
  </script>
159
181
 
@@ -199,6 +221,11 @@ const onMoveToRoot = () => {
199
221
  <q-btn outline rounded color="primary" @click="onMove(selectedNode)" label="Move"
200
222
  icon="sym_o_move" />
201
223
 
224
+ <q-btn outline rounded color="primary" @click="onMoveUp(selectedNode)" label="Up"
225
+ icon="sym_o_arrow_upward" />
226
+
227
+ <q-btn outline rounded color="primary" @click="onMoveDown(selectedNode)" label="Up"
228
+ icon="sym_o_arrow_downward" />
202
229
  </q-card-section>
203
230
 
204
231
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostlink/nuxt-light",
3
- "version": "0.0.15",
3
+ "version": "0.0.16",
4
4
  "description": "HostLink Nuxt Light Framework",
5
5
  "repository": "@hostlink/nuxt-light",
6
6
  "license": "MIT",