@hostlink/nuxt-light 1.6.6 → 1.6.8

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": "1.6.6"
4
+ "version": "1.6.8"
5
5
  }
@@ -1,5 +1,5 @@
1
1
  <script setup>
2
- import { useRoute } from 'vue-router';
2
+ import { useRoute, useRouter } from 'vue-router';
3
3
  import { useLight, q, m } from "#imports";
4
4
  import { useQuasar, Loading, Dialog } from 'quasar';
5
5
  import { useI18n } from 'vue-i18n';
@@ -23,7 +23,7 @@ const tt = await q({
23
23
  "copyrightName",
24
24
  "hasFavorite",
25
25
  { i18nMessages: ["name", "value"] }],
26
- my: ['username', 'first_name', 'last_name', 'roles', "styles", "language", "permissions", { myFavorites: ["my_favorite_id", "label", "path", "icon"] }],
26
+ my: ['username', 'first_name', 'last_name', 'roles', "styles", "language", "permissions", "default_page", { myFavorites: ["my_favorite_id", "label", "path", "icon"] }],
27
27
  })
28
28
 
29
29
  let app = tt.app
@@ -211,6 +211,7 @@ const containerStyle = computed(() => {
211
211
  })
212
212
 
213
213
  const route = useRoute()
214
+ const router = useRouter()
214
215
 
215
216
 
216
217
  const onToggleFav = async () => {
@@ -268,6 +269,11 @@ const c1 = computed(() => {
268
269
  return light.getColorValue(light.color)
269
270
  })
270
271
 
272
+ if (route.fullPath == "/" && my.default_page) {
273
+ router.push(my.default_page);
274
+
275
+ }
276
+
271
277
  </script>
272
278
 
273
279
  <style scoped>
@@ -289,12 +295,15 @@ const c1 = computed(() => {
289
295
 
290
296
  <q-space />
291
297
 
292
- <q-btn :icon="isFav ? 'favorite' : 'sym_o_favorite'" round flat dense class="q-mr-xs" @click="onToggleFav"
293
- v-if="app.hasFavorite">
298
+ <q-btn :icon="isFav ? 'favorite' : 'sym_o_favorite'" round flat dense class="q-mr-xs"
299
+ @click="onToggleFav" v-if="app.hasFavorite">
294
300
  </q-btn>
295
301
 
296
- <q-btn :icon="$q.fullscreen.isActive ? 'fullscreen_exit' : 'fullscreen'" round flat dense class="q-mr-xs"
297
- @click="$q.fullscreen.toggle()">
302
+ <q-btn :icon="$q.fullscreen.isActive ? 'fullscreen_exit' : 'fullscreen'" round flat dense
303
+ class="q-mr-xs" @click="$q.fullscreen.toggle()">
304
+ <q-tooltip>
305
+ {{ $q.fullscreen.isActive ? $t('Exit Fullscreen') : $t('Fullscreen') }}
306
+ </q-tooltip>
298
307
  </q-btn>
299
308
 
300
309
  <q-btn v-if="languages.length > 1" round flat icon="language" class="q-mr-xs">
@@ -406,23 +415,24 @@ const c1 = computed(() => {
406
415
  <q-drawer overlay v-model="rightDrawerOpen" side="right" bordered>
407
416
  <!-- drawer content -->
408
417
  <q-scroll-area class="fit">
409
- <l-customizer v-model:color="light.color" v-model:theme="light.theme" v-model:miniState="style.miniState"
410
- v-model:dense="style.dense" v-model:menuOverlayHeader="style.menuOverlayHeader"
411
- v-model:footer="style.footer" v-model:menuWidth="menuWidth" :time="system.time" />
418
+ <l-customizer v-model:color="light.color" v-model:theme="light.theme"
419
+ v-model:miniState="style.miniState" v-model:dense="style.dense"
420
+ v-model:menuOverlayHeader="style.menuOverlayHeader" v-model:footer="style.footer"
421
+ v-model:menuWidth="menuWidth" :time="system.time" />
412
422
  </q-scroll-area>
413
423
  </q-drawer>
414
424
 
415
- <q-page-container :class="containerClass" :style="containerStyle">
416
-
417
- <!-- Error message -->
425
+ <q-page-container :class="containerClass" :style="containerStyle"> <!-- Error message -->
418
426
  <q-banner dense inline-actions class="bg-grey-4 q-ma-md" v-for=" error in errors " rounded>
419
427
  {{ error }}
428
+
420
429
  <template v-slot:action>
421
430
  <q-btn flat icon="sym_o_close" round dense @click="light.removeError(error)" />
422
431
  </template>
423
432
  </q-banner>
424
433
 
425
434
  <router-view v-slot="{ Component }">
435
+
426
436
  <template v-if="Component">
427
437
  <suspense>
428
438
  <component :is="Component" :reloadMenu="reloadMenu"></component>
@@ -437,12 +447,12 @@ const c1 = computed(() => {
437
447
  <q-footer bordered v-if="style.footer">
438
448
  <q-item>
439
449
  <q-item-section>
440
- {{ light.getCompany() }} {{ appVersion }} - Copyright {{ app.copyrightYear }} {{ app.copyrightName }}.
450
+ {{ light.getCompany() }} {{ appVersion }} - Copyright {{ app.copyrightYear }} {{ app.copyrightName
451
+ }}.
441
452
  Build {{
442
- light.getVersion() }}
453
+ light.getVersion() }}
443
454
  </q-item-section>
444
455
  </q-item>
445
456
  </q-footer>
446
457
  </q-layout>
447
458
  </template>
448
-
@@ -1,15 +1,25 @@
1
1
  <script setup>
2
2
  import { ref, computed } from 'vue'
3
+ import { useDragAndDrop } from "@formkit/drag-and-drop/vue";
4
+ import { animations } from "@formkit/drag-and-drop";
3
5
 
4
6
  const props = defineProps({
5
7
  context: Object
8
+
6
9
  });
7
10
 
8
11
  const node = props.context.node;
12
+ console.log(node);
9
13
  const min = props.context.node.props.min ?? 1;
10
14
  const max = props.context.node.props.max ?? Infinity;
15
+ const sortable = (props.context.node.props.sortable !== undefined) ? props.context.node.props.sortable : true;
16
+
17
+ console.log(sortable);
18
+ const [parent, localValue] = useDragAndDrop(props.context.value, {
19
+ dragHandle: ".l-repeater-handle",
20
+ plugins: [animations()]
21
+ })
11
22
 
12
- const localValue = ref(props.context.value)
13
23
 
14
24
  if (localValue.value.length < min) {
15
25
  for (let i = localValue.value.length; i < min; i++) {
@@ -63,44 +73,47 @@ const isAllowMoveDown = (index) => {
63
73
 
64
74
  <template>
65
75
  <FormKit type="list" v-model="localValue" dynamic #default="{ items, node, value }" :name="node.name">
66
-
67
-
68
- <FormKit type="group" v-for="(item, index) in items " :index="index" :key="item">
69
-
70
- <q-card class="q-mb-sm" flat>
71
- <q-card-section>
72
- <div class="row q-col-gutter-md">
73
-
74
- <div class="col-shrink">
75
- <div class="q-mb-sm">
76
- <!-- up -->
77
- <q-btn type="button" @click="onMoveUp(index)" icon="sym_o_arrow_upward" :color="$light.color"
78
- dense unelevated :disable="!isAllowMoveUp(index)" />
79
- </div>
80
76
 
81
- <div class="q-mb-sm">
82
- <q-btn type="button" @click="onRemove" icon="sym_o_remove" :color="$light.color" dense unelevated
83
- :disable="!isAllowRemove" />
77
+ <div ref="parent">
78
+ <FormKit type="group" v-for="(item, index) in items" :index="index" :key="item">
79
+ <q-card class="q-mb-sm" flat>
80
+ <q-card-section>
81
+ <div class="row q-col-gutter-md">
82
+ <div class="col-shrink">
83
+ <div class="q-mb-sm" v-if="sortable">
84
+ <q-btn icon="sym_o_drag_handle" dense unelevated :color="$light.color"
85
+ style="cursor: grab;" class="l-repeater-handle">
86
+ </q-btn>
87
+ </div>
88
+ <div class="q-mb-sm" v-if="sortable">
89
+ <!-- up -->
90
+ <q-btn type="button" @click="onMoveUp(index)" icon="sym_o_arrow_upward"
91
+ :color="$light.color" dense unelevated :disable="!isAllowMoveUp(index)" />
92
+ </div>
93
+
94
+ <div class="q-mb-sm">
95
+ <q-btn type="button" @click="onRemove" icon="sym_o_remove" :color="$light.color"
96
+ dense unelevated :disable="!isAllowRemove" />
97
+ </div>
98
+ <div class="q-mb-sm" v-if="sortable">
99
+ <!-- down -->
100
+ <q-btn type="button" @click="onMoveDown(index)" icon="sym_o_arrow_downward"
101
+ :color="$light.color" dense unelevated :disable="!isAllowMoveDown(index)" />
102
+ </div>
84
103
  </div>
85
104
 
86
-
87
- <div class="q-mb-sm">
88
- <!-- down -->
89
- <q-btn type="button" @click="onMoveDown(index)" icon="sym_o_arrow_downward" :color="$light.color"
90
- dense unelevated :disable="!isAllowMoveDown(index)" />
105
+ <div class="col">
106
+ <slot v-bind="{ value: localValue[index] }"></slot>
91
107
  </div>
92
-
93
108
  </div>
94
-
95
- <div class="col">
96
- <slot v-bind="{ value: localValue[index] }"></slot>
97
- </div>
98
- </div>
99
- </q-card-section>
100
- </q-card>
101
- </FormKit>
102
-
103
- <q-btn :color="$light.color" @click="onAdd" icon="sym_o_add" :label="$t('Add')" :disable="localValue.length >= max"
104
- unelevated></q-btn>
109
+ </q-card-section>
110
+ </q-card>
111
+ </FormKit>
112
+ </div>
113
+
114
+ <q-toolbar>
115
+ <q-btn :color="$light.color" @click="onAdd" icon="sym_o_add" :label="$t('Add')"
116
+ :disable="localValue.length >= max" unelevated></q-btn>
117
+ </q-toolbar>
105
118
  </FormKit>
106
119
  </template>
@@ -81,7 +81,7 @@ export const createLightPlugin = () => {
81
81
  case "l-repeater":
82
82
  return node.define({
83
83
  type: "input",
84
- props: ["min", "max"],
84
+ props: ["min", "max", "sortable"],
85
85
  component: RepeaterVue
86
86
  });
87
87
  case "l-form":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostlink/nuxt-light",
3
- "version": "1.6.6",
3
+ "version": "1.6.8",
4
4
  "description": "HostLink Nuxt Light Framework",
5
5
  "repository": "@hostlink/nuxt-light",
6
6
  "license": "MIT",
@@ -34,6 +34,7 @@
34
34
  "route-gen": "node route-generate.mjs"
35
35
  },
36
36
  "dependencies": {
37
+ "@formkit/drag-and-drop": "^0.0.24",
37
38
  "@hostlink/light": "^1.2.1",
38
39
  "@nuxt/kit": "^3.7.4",
39
40
  "@nuxt/module-builder": "^0.5.2",