@hostlink/nuxt-light 1.2.1 → 1.3.0
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 +1 -1
- package/dist/runtime/components/l-app-main.vue +25 -18
- package/dist/runtime/components/l-btn.vue +10 -1
- package/dist/runtime/components/l-card.vue +12 -21
- package/dist/runtime/components/l-customizer.vue +18 -1
- package/dist/runtime/components/l-fav-menu.vue +2 -7
- package/dist/runtime/components/l-file-upload.vue +5 -1
- package/dist/runtime/components/l-icon-picker.vue +3331 -0
- package/dist/runtime/index.d.ts +8 -0
- package/dist/runtime/index.mjs +21 -1
- package/dist/runtime/locales/zh-hk.json +3 -0
- package/dist/runtime/pages/System/setting.vue +96 -57
- package/dist/runtime/pages/User/setting/my_favorite.vue +74 -0
- package/dist/runtime/pages/User/setting.vue +4 -1
- package/dist/runtime/routes.mjs +10 -0
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -3,7 +3,7 @@ import { useRoute } 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';
|
|
6
|
-
import { ref, computed, reactive, provide, watch } from 'vue';
|
|
6
|
+
import { ref, computed, reactive, provide, watch, toRaw } from 'vue';
|
|
7
7
|
import { useRuntimeConfig } from 'nuxt/app';
|
|
8
8
|
|
|
9
9
|
Loading.show()
|
|
@@ -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: ["label", "path"] }],
|
|
26
|
+
my: ['username', 'first_name', 'last_name', 'roles', "styles", "language", "permissions", { myFavorites: ["my_favorite_id", "label", "path", "icon"] }],
|
|
27
27
|
})
|
|
28
28
|
|
|
29
29
|
let app = tt.app
|
|
@@ -34,6 +34,16 @@ light.init(my.styles);
|
|
|
34
34
|
//set permission
|
|
35
35
|
light.setPermissions(my.permissions);
|
|
36
36
|
|
|
37
|
+
light.setMyFavorites(toRaw(my.myFavorites))
|
|
38
|
+
|
|
39
|
+
const myFavorites = computed(() => {
|
|
40
|
+
return light.getMyFavorites();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const myFavoritesCount = computed(() => {
|
|
44
|
+
return light.getMyFavorites().length;
|
|
45
|
+
});
|
|
46
|
+
|
|
37
47
|
quasar.dark.set(light.isDarkMode());
|
|
38
48
|
|
|
39
49
|
const i18n = useI18n();
|
|
@@ -196,17 +206,6 @@ const containerStyle = computed(() => {
|
|
|
196
206
|
|
|
197
207
|
const route = useRoute()
|
|
198
208
|
|
|
199
|
-
const reloadMyFavorites = async () => {
|
|
200
|
-
const data = await q({
|
|
201
|
-
my: {
|
|
202
|
-
myFavorites: {
|
|
203
|
-
label: true,
|
|
204
|
-
path: true,
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
my.myFavorites = data.my.myFavorites;
|
|
209
|
-
}
|
|
210
209
|
|
|
211
210
|
const onToggleFav = async () => {
|
|
212
211
|
|
|
@@ -216,7 +215,8 @@ const onToggleFav = async () => {
|
|
|
216
215
|
})
|
|
217
216
|
|
|
218
217
|
//reload my.myFavorites
|
|
219
|
-
reloadMyFavorites();
|
|
218
|
+
light.reloadMyFavorites();
|
|
219
|
+
|
|
220
220
|
|
|
221
221
|
return;
|
|
222
222
|
}
|
|
@@ -236,7 +236,7 @@ const onToggleFav = async () => {
|
|
|
236
236
|
path: route.fullPath,
|
|
237
237
|
label: data,
|
|
238
238
|
})) {
|
|
239
|
-
reloadMyFavorites();
|
|
239
|
+
light.reloadMyFavorites();
|
|
240
240
|
|
|
241
241
|
}
|
|
242
242
|
})
|
|
@@ -252,6 +252,12 @@ const isFav = computed(() => {
|
|
|
252
252
|
|
|
253
253
|
Loading.hide()
|
|
254
254
|
|
|
255
|
+
const menuWidth = ref(my.styles.menuWidth || 280);
|
|
256
|
+
|
|
257
|
+
watch(menuWidth, () => {
|
|
258
|
+
light.setStyle("menuWidth", menuWidth.value)
|
|
259
|
+
})
|
|
260
|
+
|
|
255
261
|
</script>
|
|
256
262
|
|
|
257
263
|
<template>
|
|
@@ -368,13 +374,14 @@ Loading.hide()
|
|
|
368
374
|
</q-toolbar>
|
|
369
375
|
</q-header>
|
|
370
376
|
|
|
371
|
-
<q-drawer v-model="leftDrawerOpen" bordered show-if-above side="left" :dark="menuDark" :width="
|
|
377
|
+
<q-drawer v-model="leftDrawerOpen" bordered show-if-above side="left" :dark="menuDark" :width="menuWidth"
|
|
372
378
|
:mini-to-overlay="style.miniState" :mini="isMini" @mouseout="isMouseOnDrawer = false"
|
|
373
379
|
@mouseover="isMouseOnDrawer = true">
|
|
374
380
|
<!-- drawer content -->
|
|
375
381
|
<q-scroll-area class="fit">
|
|
382
|
+
|
|
376
383
|
<div class="q-mx-sm">
|
|
377
|
-
<l-fav-menu :value="
|
|
384
|
+
<l-fav-menu :value="myFavorites" :dense="style.dense" v-if="myFavoritesCount > 0" />
|
|
378
385
|
<l-menu v-for=" menu in menus " :value="menu" :dense="style.dense" />
|
|
379
386
|
|
|
380
387
|
</div>
|
|
@@ -387,7 +394,7 @@ Loading.hide()
|
|
|
387
394
|
<q-scroll-area class="fit">
|
|
388
395
|
<l-customizer v-model:color="light.color" v-model:theme="light.theme" v-model:miniState="style.miniState"
|
|
389
396
|
v-model:dense="style.dense" v-model:menuOverlayHeader="style.menuOverlayHeader"
|
|
390
|
-
v-model:footer="style.footer" />
|
|
397
|
+
v-model:footer="style.footer" v-model:menuWidth="menuWidth" />
|
|
391
398
|
</q-scroll-area>
|
|
392
399
|
</q-drawer>
|
|
393
400
|
|
|
@@ -2,17 +2,19 @@
|
|
|
2
2
|
import { type QBtnProps } from "quasar";
|
|
3
3
|
import { computed } from "vue";
|
|
4
4
|
import { useLight } from '#imports';
|
|
5
|
+
import { useI18n } from "vue-i18n";
|
|
5
6
|
|
|
6
7
|
export interface LBtnProps extends QBtnProps {
|
|
7
8
|
permission?: string;
|
|
8
9
|
}
|
|
9
10
|
|
|
11
|
+
const { t } = useI18n();
|
|
10
12
|
const props = defineProps<LBtnProps>();
|
|
11
13
|
|
|
12
14
|
const light = useLight();
|
|
13
15
|
|
|
14
16
|
const attrs = computed(() => {
|
|
15
|
-
|
|
17
|
+
const a = {
|
|
16
18
|
...{
|
|
17
19
|
rounded: light.getStyle("buttonRounded"),
|
|
18
20
|
outline: light.getStyle("buttonOutline"),
|
|
@@ -21,6 +23,13 @@ const attrs = computed(() => {
|
|
|
21
23
|
},
|
|
22
24
|
...props,
|
|
23
25
|
}
|
|
26
|
+
|
|
27
|
+
if (a.label !== undefined) {
|
|
28
|
+
a.label = t(a.label)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return a;
|
|
32
|
+
|
|
24
33
|
});
|
|
25
34
|
|
|
26
35
|
|
|
@@ -89,26 +89,18 @@ if (props.permission && light.isAdmin) {
|
|
|
89
89
|
}));
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
const
|
|
93
|
-
|
|
92
|
+
const onUpdatePermission = async (role: any) => {
|
|
94
93
|
if (role.granted) {
|
|
95
|
-
|
|
94
|
+
await m("addPermission", {
|
|
95
|
+
role: role.name,
|
|
96
|
+
value: props.permission,
|
|
97
|
+
});
|
|
98
|
+
} else {
|
|
96
99
|
//remove permission
|
|
97
|
-
|
|
100
|
+
await m("removePermission", {
|
|
98
101
|
role: role.name,
|
|
99
102
|
value: props.permission,
|
|
100
|
-
})
|
|
101
|
-
role.granted = false;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (await m("addPermission", {
|
|
108
|
-
role: role.name,
|
|
109
|
-
value: props.permission,
|
|
110
|
-
})) {
|
|
111
|
-
role.granted = true;
|
|
103
|
+
})
|
|
112
104
|
}
|
|
113
105
|
}
|
|
114
106
|
|
|
@@ -125,13 +117,12 @@ const onTogglePermission = async (role: any) => {
|
|
|
125
117
|
<q-btn dense flat icon="sym_o_lock" persistent v-if="showSecurity">
|
|
126
118
|
<q-menu>
|
|
127
119
|
<q-list>
|
|
128
|
-
<q-item clickable v-for="role in roles"
|
|
129
|
-
<q-item-section>
|
|
130
|
-
|
|
131
|
-
|
|
120
|
+
<q-item clickable v-for="role in roles">
|
|
121
|
+
<q-item-section>
|
|
122
|
+
<q-checkbox :label="role.name" v-model="role.granted"
|
|
123
|
+
@update:model-value="onUpdatePermission(role)"></q-checkbox>
|
|
132
124
|
</q-item-section>
|
|
133
125
|
</q-item>
|
|
134
|
-
|
|
135
126
|
</q-list>
|
|
136
127
|
</q-menu>
|
|
137
128
|
</q-btn>
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
+
const menuWidth = defineModel('menuWidth', {
|
|
3
|
+
type: Number,
|
|
4
|
+
default: 280
|
|
5
|
+
});
|
|
6
|
+
|
|
2
7
|
const COLORS = [
|
|
3
8
|
'primary',
|
|
4
9
|
'secondary',
|
|
@@ -28,6 +33,8 @@ const COLORS = [
|
|
|
28
33
|
'blue-grey'
|
|
29
34
|
]
|
|
30
35
|
|
|
36
|
+
|
|
37
|
+
|
|
31
38
|
defineEmits(['update:theme', 'update:menuOverlayHeader', 'update:dense', 'update:color', 'update:miniState', 'update:footer'])
|
|
32
39
|
|
|
33
40
|
const props = defineProps({
|
|
@@ -54,7 +61,8 @@ const props = defineProps({
|
|
|
54
61
|
footer: {
|
|
55
62
|
type: Boolean,
|
|
56
63
|
default: false
|
|
57
|
-
}
|
|
64
|
+
},
|
|
65
|
+
|
|
58
66
|
})
|
|
59
67
|
|
|
60
68
|
</script>
|
|
@@ -132,6 +140,15 @@ const props = defineProps({
|
|
|
132
140
|
<q-toggle :model-value="footer" @update:model-value="$emit('update:footer', $event)" />
|
|
133
141
|
</q-item-section>
|
|
134
142
|
</q-item>
|
|
143
|
+
<q-separator />
|
|
144
|
+
<q-item-label header>{{ $t('Menu width') }}</q-item-label>
|
|
145
|
+
<q-item>
|
|
146
|
+
<q-item-section>
|
|
147
|
+
<q-slider v-model="menuWidth" :min="200" :max="360" label :color="$light.color" />
|
|
148
|
+
</q-item-section>
|
|
149
|
+
|
|
150
|
+
</q-item>
|
|
151
|
+
<q-separator />
|
|
135
152
|
|
|
136
153
|
</q-list>
|
|
137
154
|
</template>
|
|
@@ -1,21 +1,16 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
const props = defineProps(["value", "dense"])
|
|
3
|
-
|
|
4
|
-
const onClickRemove = () => {
|
|
5
|
-
console.log("onClickRemove")
|
|
6
|
-
}
|
|
7
|
-
|
|
8
3
|
</script>
|
|
9
4
|
|
|
10
5
|
<style scoped>
|
|
11
6
|
.menu-list .q-item{border-radius:12px 12px 12px 12px}.menu-list .q-router-link--exact-active{background:linear-gradient(118deg,var(--q-primary),rgba(115,103,240,.7));color:#fff}
|
|
12
7
|
</style>
|
|
13
8
|
<template>
|
|
14
|
-
<q-expansion-item :label="$t('My
|
|
9
|
+
<q-expansion-item :label="$t('My favorite')" :dense="dense" ref="expansion" icon="sym_o_favorite">
|
|
15
10
|
<q-list class="q-pl-md menu-list">
|
|
16
11
|
<q-item v-ripple :to="item.path" v-for="item in value">
|
|
17
12
|
<q-item-section avatar>
|
|
18
|
-
<q-icon name="sym_o_link" />
|
|
13
|
+
<q-icon :name="item.icon ?? 'sym_o_link'" />
|
|
19
14
|
</q-item-section>
|
|
20
15
|
<q-item-section>
|
|
21
16
|
<q-item-label v-text="$t(item.label)"></q-item-label>
|
|
@@ -167,7 +167,7 @@ const onUploadFile = async () => {
|
|
|
167
167
|
</q-card-section>
|
|
168
168
|
|
|
169
169
|
<q-card-actions align="right">
|
|
170
|
-
<q-btn flat :label="$t('Cancel')" color="primary" v-close-popup></q-btn>
|
|
170
|
+
<q-btn flat :label="$t('Cancel')" color="primary" @click="uploadFile = null" v-close-popup></q-btn>
|
|
171
171
|
<q-btn flat :label="$t('Upload')" color="primary" @click="onUploadFile"></q-btn>
|
|
172
172
|
</q-card-actions>
|
|
173
173
|
</l-card>
|
|
@@ -175,5 +175,9 @@ const onUploadFile = async () => {
|
|
|
175
175
|
<template v-slot:prepend>
|
|
176
176
|
<q-btn dense flat round icon="sym_o_file_upload" @click="show = true"></q-btn>
|
|
177
177
|
</template>
|
|
178
|
+
|
|
179
|
+
<template v-for="(s, name) in $slots" v-slot:[name]="props" :key="name">
|
|
180
|
+
<slot :name="name" v-bind="props ?? {}"></slot>
|
|
181
|
+
</template>
|
|
178
182
|
</q-input>
|
|
179
183
|
</template>
|