@hostlink/nuxt-light 0.0.75 → 0.0.77
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 +6 -15
- package/dist/runtime/components/l-card.vue +15 -6
- package/dist/runtime/components/l-customizer.vue +28 -8
- package/dist/runtime/components/l-page.vue +1 -5
- package/dist/runtime/components/l-tabs.vue +5 -1
- package/dist/runtime/pages/User/setting/open_id.vue +93 -0
- package/dist/runtime/pages/User/setting.vue +2 -0
- package/dist/runtime/routes.mjs +10 -0
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -5,12 +5,10 @@ import { useLight, q, getCurrentUser, m, f } from '../';
|
|
|
5
5
|
import { ref, computed, reactive, provide, watch } from 'vue';
|
|
6
6
|
import { useRuntimeConfig } from 'nuxt/app';
|
|
7
7
|
|
|
8
|
-
|
|
9
8
|
const config = useRuntimeConfig();
|
|
10
9
|
|
|
11
10
|
const appVersion = config.public.appVersion ?? '0.0.1';
|
|
12
11
|
|
|
13
|
-
|
|
14
12
|
const quasar = useQuasar();
|
|
15
13
|
quasar.dark.set(false);
|
|
16
14
|
const light = useLight();
|
|
@@ -36,6 +34,7 @@ if (my.granted_storage) {
|
|
|
36
34
|
|
|
37
35
|
light.setStyles(my.styles);
|
|
38
36
|
|
|
37
|
+
|
|
39
38
|
const menus = ref(app.menus)
|
|
40
39
|
|
|
41
40
|
const i18n = useI18n();
|
|
@@ -62,15 +61,11 @@ const toggleRightDrawer = () => {
|
|
|
62
61
|
rightDrawerOpen.value = !rightDrawerOpen.value
|
|
63
62
|
}
|
|
64
63
|
|
|
65
|
-
|
|
66
|
-
let isAdmin = false;
|
|
67
64
|
let showViewAs = false;
|
|
68
65
|
if (user.value && user.value.roles.indexOf('Administrators') != -1) {
|
|
69
|
-
isAdmin = true;
|
|
70
66
|
showViewAs = true;
|
|
71
67
|
}
|
|
72
68
|
|
|
73
|
-
|
|
74
69
|
const menuOverlayHeader = ref(false)
|
|
75
70
|
const layoutView = computed(() => {
|
|
76
71
|
let s = ''
|
|
@@ -86,10 +81,8 @@ const style = reactive({
|
|
|
86
81
|
dense: my.styles?.dense || false
|
|
87
82
|
});
|
|
88
83
|
|
|
89
|
-
|
|
90
84
|
const isMouseOnDrawer = ref(false)
|
|
91
85
|
|
|
92
|
-
|
|
93
86
|
const isMini = computed(() => {
|
|
94
87
|
if (isMouseOnDrawer.value) {
|
|
95
88
|
return false
|
|
@@ -144,6 +137,9 @@ watch(() => style.color, async (value) => {
|
|
|
144
137
|
name: "color",
|
|
145
138
|
value: value
|
|
146
139
|
})
|
|
140
|
+
|
|
141
|
+
my.styles["color"] = value;
|
|
142
|
+
light.setStyles(my.styles);
|
|
147
143
|
})
|
|
148
144
|
|
|
149
145
|
watch(() => style.theme, async (value) => {
|
|
@@ -165,7 +161,6 @@ const exitViewAs = async () => {
|
|
|
165
161
|
window.location.reload();
|
|
166
162
|
}
|
|
167
163
|
|
|
168
|
-
|
|
169
164
|
const storageColor = computed(() => {
|
|
170
165
|
if (system) {
|
|
171
166
|
if (system.diskFreeSpacePercent < 0.05) {
|
|
@@ -196,12 +191,11 @@ const storageUsagePercent = computed(() => {
|
|
|
196
191
|
return 0;
|
|
197
192
|
})
|
|
198
193
|
|
|
199
|
-
|
|
200
194
|
</script>
|
|
201
195
|
|
|
202
196
|
<template>
|
|
203
197
|
<q-layout :view="layoutView">
|
|
204
|
-
<q-header bordered class="text-white" :class="style.color">
|
|
198
|
+
<q-header bordered class="text-white" :class="`bg-${style.color}`">
|
|
205
199
|
<q-toolbar>
|
|
206
200
|
<q-btn dense flat round icon="menu" class="q-mr-sm" @click="toggleLeftDrawer" />
|
|
207
201
|
|
|
@@ -247,13 +241,10 @@ const storageUsagePercent = computed(() => {
|
|
|
247
241
|
</div>
|
|
248
242
|
|
|
249
243
|
<div class="text-right">
|
|
250
|
-
{{ user.roles
|
|
244
|
+
{{ user.roles[0] }}
|
|
251
245
|
</div>
|
|
252
246
|
</div>
|
|
253
247
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
248
|
<q-btn flat round dense icon="sym_o_person" class="q-mr-sm">
|
|
258
249
|
<q-menu max-width="250px">
|
|
259
250
|
<q-list>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { useLight } from '../'
|
|
3
|
-
import { useAttrs } from 'vue'
|
|
3
|
+
import { useAttrs, ref } from 'vue'
|
|
4
4
|
|
|
5
5
|
defineProps({
|
|
6
6
|
loading: Boolean,
|
|
@@ -16,16 +16,25 @@ const attrs = {
|
|
|
16
16
|
bordered: light.getStyle("cardBordered", true),
|
|
17
17
|
square: light.getStyle("cardSquare", false),
|
|
18
18
|
}, ...useAttrs()
|
|
19
|
-
|
|
20
19
|
}
|
|
21
20
|
|
|
21
|
+
const color = light.getStyle("color", 'primary');
|
|
22
|
+
|
|
23
|
+
const cl = ["text-white", `bg-${color}`];
|
|
24
|
+
|
|
25
|
+
const minimize = ref(true);
|
|
22
26
|
</script>
|
|
23
27
|
<template>
|
|
24
28
|
<q-card v-bind="attrs">
|
|
25
|
-
<q-
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
<q-bar :class="cl" v-if="title">
|
|
30
|
+
<div>{{ title }}</div>
|
|
31
|
+
<q-space />
|
|
32
|
+
<q-btn dense flat icon="sym_o_remove" @click="minimize = !minimize" />
|
|
33
|
+
</q-bar>
|
|
34
|
+
<template v-if="minimize">
|
|
35
|
+
<slot></slot>
|
|
36
|
+
</template>
|
|
37
|
+
|
|
29
38
|
|
|
30
39
|
<q-inner-loading :showing="loading" label="Please wait..." label-class="text-primary" />
|
|
31
40
|
</q-card>
|
|
@@ -1,12 +1,32 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
const COLORS = [
|
|
3
|
-
'
|
|
4
|
-
'
|
|
5
|
-
'
|
|
6
|
-
'
|
|
7
|
-
'
|
|
8
|
-
'
|
|
9
|
-
'
|
|
3
|
+
'primary',
|
|
4
|
+
'secondary',
|
|
5
|
+
'positive',
|
|
6
|
+
'negative',
|
|
7
|
+
'info',
|
|
8
|
+
'warning',
|
|
9
|
+
'dark',
|
|
10
|
+
'red',
|
|
11
|
+
'pink',
|
|
12
|
+
'purple',
|
|
13
|
+
'deep-purple',
|
|
14
|
+
'indigo',
|
|
15
|
+
'blue',
|
|
16
|
+
'light-blue',
|
|
17
|
+
'cyan',
|
|
18
|
+
'teal',
|
|
19
|
+
'green',
|
|
20
|
+
'light-green',
|
|
21
|
+
'lime',
|
|
22
|
+
'yellow',
|
|
23
|
+
'amber',
|
|
24
|
+
'orange',
|
|
25
|
+
'deep-orange',
|
|
26
|
+
'brown',
|
|
27
|
+
'grey',
|
|
28
|
+
'blue-grey'
|
|
29
|
+
|
|
10
30
|
]
|
|
11
31
|
|
|
12
32
|
defineEmits(['update:theme', 'update:menuOverlayHeader', 'update:dense', 'update:headerColor', 'update:miniState'])
|
|
@@ -62,7 +82,7 @@ const props = defineProps({
|
|
|
62
82
|
<q-item-section>
|
|
63
83
|
<q-item-label>Header color</q-item-label>
|
|
64
84
|
<div class="row">
|
|
65
|
-
<div v-for="c in COLORS" :key="c" :class="c" style="width: 1.5rem; height: 1.5rem;"
|
|
85
|
+
<div v-for="c in COLORS" :key="c" :class="`bg-${c}`" style="width: 1.5rem; height: 1.5rem;"
|
|
66
86
|
class="q-ma-xs cursor-pointer rounded-borders" @click="$emit('update:headerColor', c)" />
|
|
67
87
|
</div>
|
|
68
88
|
</q-item-section>
|
|
@@ -71,11 +71,7 @@ if (props.addBtn) {
|
|
|
71
71
|
showAddBtn = true
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
//title split by Capital letter, but if Captial letter is followed by another Capital letter, it is not split
|
|
77
|
-
const title = props.title || route.path.split("/")[1].replace(/([A-Z])(?=[A-Z])/g, '$1 ').replace(/([a-z])(?=[A-Z])/g, '$1 ');
|
|
78
|
-
|
|
74
|
+
const title = props.title || route.path.split("/")[1].replace(/([a-z])(?=[A-Z])/g, '$1 ').replace(/([A-Z]*)(?=[A-Z][a-z])/g, '$1 ')
|
|
79
75
|
const module = route.path.split("/")[1];
|
|
80
76
|
const onDelete = async () => {
|
|
81
77
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
+
import { useLight } from '../'
|
|
2
3
|
import { useSlots, computed, ref } from 'vue';
|
|
3
4
|
|
|
5
|
+
const light = useLight();
|
|
4
6
|
const props = defineProps(["modelValue"])
|
|
5
7
|
const emit = defineEmits(["update:modelValue"])
|
|
6
8
|
const slots = useSlots();
|
|
@@ -30,11 +32,13 @@ const localValue = computed({
|
|
|
30
32
|
}
|
|
31
33
|
})
|
|
32
34
|
|
|
35
|
+
const color = light.getStyle("color", 'primary');
|
|
36
|
+
|
|
33
37
|
</script>
|
|
34
38
|
|
|
35
39
|
<template>
|
|
36
40
|
<l-card>
|
|
37
|
-
<q-tabs class="text-grey" active-color="
|
|
41
|
+
<q-tabs class="text-grey" :active-color="color" :indicator-color="color" align="justify" v-model="localValue">
|
|
38
42
|
<q-tab v-for="tab in tabContents" :label="$t(tab.label)" :name="tab.name"></q-tab>
|
|
39
43
|
</q-tabs>
|
|
40
44
|
<q-tab-panels v-model="localValue">
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { reactive, onMounted } from "vue"
|
|
3
|
+
import { Notify } from "quasar";
|
|
4
|
+
import { q, m } from '../../../'
|
|
5
|
+
let { app, my } = await q({ app: ['googleClientId'], my: ["gmail"] })
|
|
6
|
+
|
|
7
|
+
my = reactive(my);
|
|
8
|
+
|
|
9
|
+
const handleGoogleCredentialResponse = async (response) => {
|
|
10
|
+
try {
|
|
11
|
+
await m("googleRegister", { credential: response.credential })
|
|
12
|
+
|
|
13
|
+
const resp = await q("my", ["gmail"]);
|
|
14
|
+
my.gmail = resp.gmail;
|
|
15
|
+
|
|
16
|
+
Notify.create({
|
|
17
|
+
message: "Google account linked",
|
|
18
|
+
color: "positive",
|
|
19
|
+
position: "top",
|
|
20
|
+
timeout: 2000
|
|
21
|
+
});
|
|
22
|
+
} catch (e) {
|
|
23
|
+
console.log(e)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
onMounted(() => {
|
|
28
|
+
if (app.googleClientId) {
|
|
29
|
+
if (!window.google) {
|
|
30
|
+
Notify.create({
|
|
31
|
+
message: "Google login is not available", //set script https://accounts.google.com/gsi/client in nuuxt.config.js
|
|
32
|
+
color: "negative",
|
|
33
|
+
icon: "sym_o_error",
|
|
34
|
+
position: "top",
|
|
35
|
+
timeout: 2000
|
|
36
|
+
});
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
//google
|
|
42
|
+
google.accounts.id.initialize({
|
|
43
|
+
client_id: app.googleClientId,
|
|
44
|
+
callback: handleGoogleCredentialResponse,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
google.accounts.id.renderButton(
|
|
48
|
+
document.getElementById('g_id_signin'),
|
|
49
|
+
{
|
|
50
|
+
type: 'profile',
|
|
51
|
+
shape: 'pill',
|
|
52
|
+
theme: 'outline',
|
|
53
|
+
text: 'signin_with',
|
|
54
|
+
size: 'large',
|
|
55
|
+
logo_alignment: 'left'
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const unlink = async () => {
|
|
62
|
+
await m("unlinkGoogle");
|
|
63
|
+
my.gmail = null;
|
|
64
|
+
window.location.reload();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
</script>
|
|
68
|
+
<template>
|
|
69
|
+
<l-card :bordered="false">
|
|
70
|
+
|
|
71
|
+
<template v-if="app.googleClientId">
|
|
72
|
+
<q-card-section v-if="my.gmail">
|
|
73
|
+
You have already linked your Google account.<br />
|
|
74
|
+
|
|
75
|
+
Your gmail is {{ my.gmail }}
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
<l-btn label="Unlink" @click="unlink" icon="sym_o_delete"></l-btn>
|
|
80
|
+
</q-card-section>
|
|
81
|
+
|
|
82
|
+
<q-card-section v-else>
|
|
83
|
+
Click the button below to link your Google account.
|
|
84
|
+
<div id="g_id_signin"></div>
|
|
85
|
+
</q-card-section>
|
|
86
|
+
</template>
|
|
87
|
+
|
|
88
|
+
<q-card-section v-else>
|
|
89
|
+
Google login is not available. Please set GOOGLE_CLIENT_ID in server settings.
|
|
90
|
+
</q-card-section>
|
|
91
|
+
|
|
92
|
+
</l-card>
|
|
93
|
+
</template>
|
|
@@ -23,6 +23,8 @@ const route = useRoute()
|
|
|
23
23
|
replace />
|
|
24
24
|
<q-route-tab name="bio" icon="sym_o_fingerprint" :label="$t('Bio')" to="/User/setting/bio-auth"
|
|
25
25
|
exact replace />
|
|
26
|
+
<q-route-tab name="openid" icon="sym_o_key" :label="$t('Open ID')" to="/User/setting/open_id" exact replace />
|
|
27
|
+
|
|
26
28
|
</q-tabs>
|
|
27
29
|
</template>
|
|
28
30
|
|
package/dist/runtime/routes.mjs
CHANGED
|
@@ -121,6 +121,11 @@ function User_setting_information() {
|
|
|
121
121
|
/* webpackChunkName: "User-setting-information" */ './pages/User/setting/information.vue'
|
|
122
122
|
)
|
|
123
123
|
}
|
|
124
|
+
function User_setting_open_id() {
|
|
125
|
+
return import(
|
|
126
|
+
/* webpackChunkName: "User-setting-open_id" */ './pages/User/setting/open_id.vue'
|
|
127
|
+
)
|
|
128
|
+
}
|
|
124
129
|
function User_setting_password() {
|
|
125
130
|
return import(
|
|
126
131
|
/* webpackChunkName: "User-setting-password" */ './pages/User/setting/password.vue'
|
|
@@ -317,6 +322,11 @@ export default [
|
|
|
317
322
|
path: 'information',
|
|
318
323
|
component: User_setting_information,
|
|
319
324
|
},
|
|
325
|
+
{
|
|
326
|
+
name: 'User-setting-open_id',
|
|
327
|
+
path: 'open_id',
|
|
328
|
+
component: User_setting_open_id,
|
|
329
|
+
},
|
|
320
330
|
{
|
|
321
331
|
name: 'User-setting-password',
|
|
322
332
|
path: 'password',
|