@hostlink/nuxt-light 1.18.2 → 1.18.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.
- package/dist/module.json +1 -1
- package/dist/runtime/components/L/ForgetPasswordDialog.vue +11 -13
- package/dist/runtime/components/L/System/Setting/modules.vue +1 -1
- package/dist/runtime/components/l-app-main.vue +10 -13
- package/dist/runtime/components/l-app.vue +0 -2
- package/dist/runtime/components/l-edit-btn.vue +1 -1
- package/dist/runtime/components/l-form-dialog.vue +1 -2
- package/dist/runtime/components/l-input.vue +14 -9
- package/dist/runtime/components/l-login.vue +11 -8
- package/dist/runtime/components/l-tab.vue +4 -1
- package/dist/runtime/components/l-tabs.vue +2 -4
- package/dist/runtime/index.d.ts +1 -92
- package/dist/runtime/index.js +1 -197
- package/dist/runtime/lib/index.d.ts +1 -1
- package/dist/runtime/light.d.ts +1224 -0
- package/dist/runtime/light.js +242 -0
- package/dist/runtime/locales/zh-hk.json +29 -1
- package/dist/runtime/pages/System/database/table.vue +8 -10
- package/dist/runtime/pages/System/setting.vue +1 -1
- package/dist/runtime/pages/System/view_as.vue +3 -3
- package/dist/runtime/pages/User/_user_id/view.vue +6 -20
- package/dist/runtime/pages/User/setting/bio-auth.vue +34 -15
- package/dist/runtime/pages/User/setting/my_favorite.vue +2 -5
- package/dist/runtime/pages/User/setting/open_id.vue +35 -20
- package/dist/runtime/pages/User/setting/two-factor-auth.vue +2 -3
- package/dist/runtime/plugin.js +4 -1
- package/package.json +1 -1
- package/dist/runtime/components/L/ForgetPasswordResetDialog.vue +0 -34
package/dist/module.json
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
import { ref } from 'vue'
|
|
3
3
|
import { useQuasar, useDialogPluginComponent } from 'quasar'
|
|
4
4
|
import { m, api } from '#imports';
|
|
5
|
+
import { useI18n } from 'vue-i18n';
|
|
6
|
+
const { t } = useI18n();
|
|
5
7
|
const $q = useQuasar()
|
|
6
8
|
|
|
7
|
-
|
|
8
9
|
const { dialogRef, onDialogHide, onDialogOK, onDialogCancel } = useDialogPluginComponent()
|
|
9
10
|
|
|
10
11
|
const username = ref('')
|
|
@@ -13,7 +14,7 @@ const onOKClick = async () => {
|
|
|
13
14
|
if (username.value == '' || email.value == '') {
|
|
14
15
|
$q.notify({
|
|
15
16
|
type: 'negative',
|
|
16
|
-
message: 'Username and Email is required'
|
|
17
|
+
message: t('Username and Email is required')
|
|
17
18
|
})
|
|
18
19
|
return;
|
|
19
20
|
}
|
|
@@ -34,34 +35,31 @@ const onOKClick = async () => {
|
|
|
34
35
|
} finally {
|
|
35
36
|
$q.loading.hide();
|
|
36
37
|
}
|
|
37
|
-
|
|
38
38
|
}
|
|
39
|
-
|
|
40
39
|
</script>
|
|
41
|
-
|
|
42
40
|
<template>
|
|
43
41
|
<q-dialog ref="dialogRef">
|
|
44
42
|
<q-card class="q-dialog-plugin">
|
|
45
43
|
|
|
46
44
|
<q-card-section class="q-dialog__title">
|
|
47
|
-
Forget
|
|
45
|
+
{{ t('Forget password') }}
|
|
48
46
|
</q-card-section>
|
|
49
47
|
|
|
50
48
|
<q-card-section class="q-dialog__message">
|
|
51
|
-
Please enter your username and email address, we will send you a code to reset your password
|
|
49
|
+
{{ t('Please enter your username and email address, we will send you a code to reset your password') }}
|
|
52
50
|
</q-card-section>
|
|
53
51
|
|
|
54
52
|
<q-card-section>
|
|
55
|
-
<q-input v-model="username" label="Username" stack-label
|
|
56
|
-
:rules="[val => !!val || 'Username is required']" hide-bottom-space />
|
|
57
|
-
<q-input v-model="email" label="Email" stack-label type="email" hide-bottom-space
|
|
58
|
-
:rules="[val => !!val || 'Email is required']" />
|
|
53
|
+
<q-input v-model="username" :label="$t('Username')" stack-label
|
|
54
|
+
:rules="[val => !!val || $t('Username is required')]" hide-bottom-space />
|
|
55
|
+
<q-input v-model="email" :label="$t('Email')" stack-label type="email" hide-bottom-space
|
|
56
|
+
:rules="[val => !!val || $t('Email is required')]" />
|
|
59
57
|
</q-card-section>
|
|
60
58
|
|
|
61
59
|
|
|
62
60
|
<q-card-actions align="right">
|
|
63
|
-
<q-btn label="Cancel" @click="onDialogCancel" flat color="primary" />
|
|
64
|
-
<q-btn label="OK" @click="onOKClick" flat color="primary" />
|
|
61
|
+
<q-btn :label="$t('Cancel')" @click="onDialogCancel" flat color="primary" />
|
|
62
|
+
<q-btn :label="$t('OK')" @click="onOKClick" flat color="primary" />
|
|
65
63
|
</q-card-actions>
|
|
66
64
|
</q-card>
|
|
67
65
|
</q-dialog>
|
|
@@ -39,7 +39,7 @@ const onSubmit = async (d, form) => {
|
|
|
39
39
|
file_manager: modelValue.file_manager,
|
|
40
40
|
revision: modelValue.revision
|
|
41
41
|
}" @submit="onSubmit">
|
|
42
|
-
<q-field label="File
|
|
42
|
+
<q-field :label="$t('File Manager')" stack-label>
|
|
43
43
|
<FormKit type="l-checkbox" label="Show" name="file_manager" true-value="1" false-value="0" />
|
|
44
44
|
</q-field>
|
|
45
45
|
|
|
@@ -7,6 +7,8 @@ import { ref, computed, reactive, provide, watch, toRaw } from 'vue';
|
|
|
7
7
|
import { useRuntimeConfig } from 'nuxt/app';
|
|
8
8
|
import { api } from '#imports';
|
|
9
9
|
|
|
10
|
+
const { t } = useI18n();
|
|
11
|
+
|
|
10
12
|
const emits = defineEmits(["logout"]);
|
|
11
13
|
const $q = useQuasar();
|
|
12
14
|
$q.loading.show()
|
|
@@ -59,9 +61,8 @@ const tt = await q({
|
|
|
59
61
|
let app = tt.app
|
|
60
62
|
let my = reactive(tt.my)
|
|
61
63
|
|
|
62
|
-
const light = useLight(
|
|
63
|
-
|
|
64
|
-
});
|
|
64
|
+
const light = useLight();
|
|
65
|
+
|
|
65
66
|
light.init(my.styles);
|
|
66
67
|
|
|
67
68
|
//set permission
|
|
@@ -158,9 +159,6 @@ const onChangeLocale = async (locale) => {
|
|
|
158
159
|
window.location.reload();
|
|
159
160
|
}
|
|
160
161
|
|
|
161
|
-
const errors = computed(() => {
|
|
162
|
-
return light.getErrors();
|
|
163
|
-
})
|
|
164
162
|
|
|
165
163
|
const reloadMenu = async () => {
|
|
166
164
|
//menus.value = app.menus;
|
|
@@ -231,23 +229,22 @@ const onToggleFav = async () => {
|
|
|
231
229
|
return;
|
|
232
230
|
}
|
|
233
231
|
|
|
234
|
-
|
|
232
|
+
light.dialog({
|
|
235
233
|
title: 'Add to favorite',
|
|
236
234
|
message: 'Enter favorite label',
|
|
237
235
|
prompt: {
|
|
238
236
|
//get window title, remove - and replace with space
|
|
239
237
|
model: route.name.replace(/-/g, ' '),
|
|
238
|
+
isValid: (val) => val !== '',
|
|
240
239
|
},
|
|
241
240
|
cancel: true,
|
|
242
241
|
persistent: true,
|
|
243
242
|
}).onOk(async (data) => {
|
|
244
|
-
if (data === '') return;
|
|
245
243
|
if (await m("addMyFavorite", {
|
|
246
244
|
path: route.fullPath,
|
|
247
245
|
label: data,
|
|
248
246
|
})) {
|
|
249
247
|
light.reloadMyFavorites();
|
|
250
|
-
|
|
251
248
|
}
|
|
252
249
|
})
|
|
253
250
|
}
|
|
@@ -424,8 +421,8 @@ const onLogout = async () => {
|
|
|
424
421
|
|
|
425
422
|
<q-page-container :class="containerClass" :style="containerStyle"> <!-- Error message -->
|
|
426
423
|
<slot name="header"></slot>
|
|
427
|
-
<div class="q-gutter-sm q-pa-sm" v-if="errors.length > 0">
|
|
428
|
-
<q-banner dense inline-actions class="bg-grey-4" v-for=" error in errors " rounded>
|
|
424
|
+
<div class="q-gutter-sm q-pa-sm" v-if="$light.errors.length > 0">
|
|
425
|
+
<q-banner dense inline-actions class="bg-grey-4" v-for=" error in $light.errors " rounded>
|
|
429
426
|
{{ error }}
|
|
430
427
|
<template v-slot:action>
|
|
431
428
|
<q-btn flat label="Detail" @click="$q.dialog({
|
|
@@ -433,7 +430,7 @@ const onLogout = async () => {
|
|
|
433
430
|
message: error.stack,
|
|
434
431
|
fullWidth: true,
|
|
435
432
|
})"></q-btn>
|
|
436
|
-
<q-btn flat icon="sym_o_close" round dense @click="light.removeError(error)" />
|
|
433
|
+
<q-btn flat icon="sym_o_close" round dense @click="$light.removeError(error)" />
|
|
437
434
|
</template>
|
|
438
435
|
</q-banner>
|
|
439
436
|
|
|
@@ -461,7 +458,7 @@ const onLogout = async () => {
|
|
|
461
458
|
<q-item-section>
|
|
462
459
|
{{ light.company }} {{ appVersion }} - Copyright {{ app.copyrightYear }} {{ app.copyrightName
|
|
463
460
|
}}. Build
|
|
464
|
-
{{ light.
|
|
461
|
+
{{ light.version }}
|
|
465
462
|
</q-item-section>
|
|
466
463
|
</q-item>
|
|
467
464
|
</q-footer>
|
|
@@ -82,8 +82,7 @@ const onCancel = async () => {
|
|
|
82
82
|
<template>
|
|
83
83
|
<q-dialog ref="dialogRef">
|
|
84
84
|
|
|
85
|
-
<q-card :style="{ width }" :loading="loading">
|
|
86
|
-
|
|
85
|
+
<q-card :style="{ width }" :loading="loading" class="q-dialog-plugin">
|
|
87
86
|
<q-toolbar>
|
|
88
87
|
<q-toolbar-title v-if="title">
|
|
89
88
|
{{ title }}
|
|
@@ -11,7 +11,7 @@ export interface LInputProps extends QInputProps {
|
|
|
11
11
|
required?: boolean;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
const
|
|
14
|
+
const { t } = useI18n();
|
|
15
15
|
const light = useLight();
|
|
16
16
|
|
|
17
17
|
const props = withDefaults(defineProps<LInputProps>(), {
|
|
@@ -37,13 +37,13 @@ const new_rules = props.rules || [];
|
|
|
37
37
|
|
|
38
38
|
//has required prop (in properties)
|
|
39
39
|
if (props.required) {
|
|
40
|
-
new_rules.push(val => !!val ||
|
|
40
|
+
new_rules.push(val => !!val || t('input_required', [t(props.label ?? "")]));
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
if (props.type == "email") {
|
|
44
44
|
new_rules.push(val => {
|
|
45
45
|
if (val && !val.match(/^[^\s@]+@[^\s@]+\.[^\s@]+$/)) {
|
|
46
|
-
return
|
|
46
|
+
return t("Invalid email format");
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
49
|
}
|
|
@@ -51,7 +51,7 @@ if (props.type == "email") {
|
|
|
51
51
|
if (new_rules.indexOf("containUpper") >= 0) {
|
|
52
52
|
new_rules.push(val => {
|
|
53
53
|
if (val && !val.match(/[A-Z]/)) {
|
|
54
|
-
return
|
|
54
|
+
return t("Must contain at least one uppercase letter");
|
|
55
55
|
}
|
|
56
56
|
});
|
|
57
57
|
}
|
|
@@ -59,7 +59,7 @@ if (new_rules.indexOf("containUpper") >= 0) {
|
|
|
59
59
|
if (new_rules.indexOf("containLower") >= 0) {
|
|
60
60
|
new_rules.push(val => {
|
|
61
61
|
if (val && !val.match(/[a-z]/)) {
|
|
62
|
-
return
|
|
62
|
+
return t("Must contain at least one lowercase letter");
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
65
|
}
|
|
@@ -67,7 +67,7 @@ if (new_rules.indexOf("containLower") >= 0) {
|
|
|
67
67
|
if (new_rules.indexOf("containNumber") >= 0) {
|
|
68
68
|
new_rules.push(val => {
|
|
69
69
|
if (val && !val.match(/[0-9]/)) {
|
|
70
|
-
return
|
|
70
|
+
return t("Must contain at least one number");
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
73
|
}
|
|
@@ -75,7 +75,7 @@ if (new_rules.indexOf("containNumber") >= 0) {
|
|
|
75
75
|
if (new_rules.indexOf("containSpecial") >= 0) {
|
|
76
76
|
new_rules.push(val => {
|
|
77
77
|
if (val && !val.match(/[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/)) {
|
|
78
|
-
return
|
|
78
|
+
return t("Must contain at least one symbol");
|
|
79
79
|
}
|
|
80
80
|
});
|
|
81
81
|
}
|
|
@@ -90,7 +90,7 @@ if (minLength) {
|
|
|
90
90
|
const min = parseInt(minLength.replace("minLength:", ""));
|
|
91
91
|
new_rules.push(val => {
|
|
92
92
|
if (val && val.length < min) {
|
|
93
|
-
return
|
|
93
|
+
return t("input_min", [min]);
|
|
94
94
|
}
|
|
95
95
|
});
|
|
96
96
|
}
|
|
@@ -139,7 +139,7 @@ const attrs = computed(() => {
|
|
|
139
139
|
if (props.stackLabel === undefined) a.stackLabel = light.getStyle("inputStackLabel");
|
|
140
140
|
|
|
141
141
|
if (props.label) {
|
|
142
|
-
a.label =
|
|
142
|
+
a.label = t(props.label);
|
|
143
143
|
|
|
144
144
|
if (props.required) {
|
|
145
145
|
a.label = "* " + a.label;
|
|
@@ -147,6 +147,11 @@ const attrs = computed(() => {
|
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
if (props.color === undefined) a.color = light.color
|
|
150
|
+
|
|
151
|
+
if (props.hint) {
|
|
152
|
+
a.hint = t(props.hint);
|
|
153
|
+
}
|
|
154
|
+
|
|
150
155
|
return a;
|
|
151
156
|
})
|
|
152
157
|
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
import { ref, reactive, onMounted } from 'vue'
|
|
3
3
|
import { useQuasar } from 'quasar';
|
|
4
4
|
import { api, useHead } from '#imports';
|
|
5
|
+
import { useI18n } from 'vue-i18n';
|
|
6
|
+
|
|
7
|
+
const { t } = useI18n();
|
|
5
8
|
|
|
6
9
|
const emits = defineEmits(["login"]);
|
|
7
10
|
|
|
@@ -26,8 +29,8 @@ const $q = useQuasar()
|
|
|
26
29
|
|
|
27
30
|
const loginWithCode = (username, password) => {
|
|
28
31
|
$q.dialog({
|
|
29
|
-
title: "Enter your code",
|
|
30
|
-
message: "Please enter your two factor authentication code (If you lost your authenticator, please contact your administrator)",
|
|
32
|
+
title: t("Enter your code"),
|
|
33
|
+
message: t("Please enter your two factor authentication code (If you lost your authenticator, please contact your administrator)"),
|
|
31
34
|
prompt: {
|
|
32
35
|
type: "text",
|
|
33
36
|
required: true
|
|
@@ -73,8 +76,8 @@ const submit = async () => {
|
|
|
73
76
|
|
|
74
77
|
const resetPassword = (username, code) => {
|
|
75
78
|
$q.dialog({
|
|
76
|
-
title: "Reset password",
|
|
77
|
-
message: "Please enter your new password",
|
|
79
|
+
title: t("Reset password"),
|
|
80
|
+
message: t("Please enter your new password"),
|
|
78
81
|
prompt: {
|
|
79
82
|
model: "",
|
|
80
83
|
type: "password",
|
|
@@ -88,7 +91,7 @@ const resetPassword = (username, code) => {
|
|
|
88
91
|
try {
|
|
89
92
|
await api.auth.resetPassword(username, password, code);
|
|
90
93
|
$q.notify({
|
|
91
|
-
message: "Your password has been reset successfully",
|
|
94
|
+
message: t("Your password has been reset successfully"),
|
|
92
95
|
color: "positive",
|
|
93
96
|
icon: "sym_o_check",
|
|
94
97
|
});
|
|
@@ -110,8 +113,8 @@ const forgetPassword = async () => {
|
|
|
110
113
|
component: resolveComponent("l-forget-password-dialog"),
|
|
111
114
|
}).onOk(async (data) => {
|
|
112
115
|
$q.dialog({
|
|
113
|
-
title: "Enter your code",
|
|
114
|
-
message: "Please enter the code sent to your email, your code will expire in 10 minutes",
|
|
116
|
+
title: t("Enter your code"),
|
|
117
|
+
message: t("Please enter the code sent to your email, your code will expire in 10 minutes"),
|
|
115
118
|
prompt: {
|
|
116
119
|
type: "text",
|
|
117
120
|
required: true
|
|
@@ -123,7 +126,7 @@ const forgetPassword = async () => {
|
|
|
123
126
|
resetPassword(data.username, code);
|
|
124
127
|
} else {
|
|
125
128
|
$q.notify({
|
|
126
|
-
message: "Your code is invalid",
|
|
129
|
+
message: t("Your code is invalid or expired"),
|
|
127
130
|
color: "negative",
|
|
128
131
|
icon: "sym_o_error",
|
|
129
132
|
});
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import type { QTabPanelProps, QTabProps } from 'quasar';
|
|
3
3
|
import { getCurrentInstance } from 'vue';
|
|
4
|
+
import { useI18n } from 'vue-i18n';
|
|
5
|
+
|
|
6
|
+
const { t } = useI18n();
|
|
4
7
|
|
|
5
8
|
const instance = getCurrentInstance();
|
|
6
9
|
defineProps<QTabPanelProps | QTabProps>()
|
|
@@ -17,7 +20,7 @@ const parent_type = instance?.parent?.type.name
|
|
|
17
20
|
</template>
|
|
18
21
|
|
|
19
22
|
<template v-if="parent_type == 'QTabs'">
|
|
20
|
-
<q-tab v-bind="$props">
|
|
23
|
+
<q-tab v-bind="$props" :label="$t($props.label ?? '')">
|
|
21
24
|
</q-tab>
|
|
22
25
|
</template>
|
|
23
26
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import type { QTabsProps } from 'quasar';
|
|
3
|
-
import {
|
|
3
|
+
import { useSlots } from '#imports';
|
|
4
4
|
const model = defineModel<string | number | null | undefined>()
|
|
5
|
-
export interface LTabsProps extends
|
|
5
|
+
export interface LTabsProps extends QTabsProps {
|
|
6
6
|
}
|
|
7
7
|
defineProps<LTabsProps>();
|
|
8
8
|
const slots = useSlots()
|
|
@@ -16,12 +16,10 @@ if (model.value === undefined) {
|
|
|
16
16
|
<l-card>
|
|
17
17
|
<q-tabs class="text-grey" :active-color="$light.color" :indicator-color="$light.color" align="justify"
|
|
18
18
|
v-model="model">
|
|
19
|
-
|
|
20
19
|
<slot></slot>
|
|
21
20
|
</q-tabs>
|
|
22
21
|
<q-tab-panels v-model="model">
|
|
23
22
|
<slot></slot>
|
|
24
|
-
<!-- component v-for="tab in tabContents" :key="tab.name" :is="tab.content?.default" :name="tab.name" /-->
|
|
25
23
|
</q-tab-panels>
|
|
26
24
|
</l-card>
|
|
27
25
|
</template>
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -1,56 +1,4 @@
|
|
|
1
1
|
import { type FormKitInputs } from '@formkit/inputs';
|
|
2
|
-
export interface User {
|
|
3
|
-
user_id?: number;
|
|
4
|
-
username: string;
|
|
5
|
-
password: string;
|
|
6
|
-
first_name: string;
|
|
7
|
-
last_name?: string;
|
|
8
|
-
email: string;
|
|
9
|
-
language?: string;
|
|
10
|
-
}
|
|
11
|
-
declare const app: {
|
|
12
|
-
company: string;
|
|
13
|
-
companyLogo: string;
|
|
14
|
-
color: string;
|
|
15
|
-
theme: string;
|
|
16
|
-
isAdmin: boolean;
|
|
17
|
-
permissions: string[];
|
|
18
|
-
myFavorites: any[];
|
|
19
|
-
users: {
|
|
20
|
-
create: (user: User) => Promise<User>;
|
|
21
|
-
del: (user_id: number) => Promise<any>;
|
|
22
|
-
update: (id: number, user: User) => Promise<any>;
|
|
23
|
-
list: (args: any) => Promise<any>;
|
|
24
|
-
};
|
|
25
|
-
roles: {
|
|
26
|
-
list: () => Promise<any>;
|
|
27
|
-
};
|
|
28
|
-
getColorValue: () => string;
|
|
29
|
-
setMyFavorites: (favorites: Array<any>) => void;
|
|
30
|
-
reloadMyFavorites: () => Promise<void>;
|
|
31
|
-
getMyFavorites: () => any[];
|
|
32
|
-
isDarkMode: () => boolean;
|
|
33
|
-
getVersion: () => string;
|
|
34
|
-
addError: (err: Error) => void;
|
|
35
|
-
getErrors: () => Error[];
|
|
36
|
-
removeError: (error: Error) => void;
|
|
37
|
-
getStyle: (name: string) => any;
|
|
38
|
-
setStyles: (s: Object) => void;
|
|
39
|
-
getStyles: () => {
|
|
40
|
-
[key: string]: any;
|
|
41
|
-
};
|
|
42
|
-
setStyle: (name: string, value: any) => Promise<void>;
|
|
43
|
-
setCurrentRoute: (to: any) => void;
|
|
44
|
-
getID: () => number | null;
|
|
45
|
-
init: (styles: any) => void;
|
|
46
|
-
isGranted: (right?: string) => boolean;
|
|
47
|
-
setPermissions: (permissions: Array<string>) => void;
|
|
48
|
-
};
|
|
49
|
-
declare module 'vue' {
|
|
50
|
-
interface ComponentCustomProperties {
|
|
51
|
-
$light: typeof app;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
2
|
declare module '@formkit/inputs' {
|
|
55
3
|
interface FormKitInputProps<Props extends FormKitInputs<Props>> {
|
|
56
4
|
lInput: {
|
|
@@ -86,44 +34,5 @@ declare module '@formkit/inputs' {
|
|
|
86
34
|
};
|
|
87
35
|
}
|
|
88
36
|
}
|
|
89
|
-
export
|
|
90
|
-
color?: string;
|
|
91
|
-
}) => {
|
|
92
|
-
company: string;
|
|
93
|
-
companyLogo: string;
|
|
94
|
-
color: string;
|
|
95
|
-
theme: string;
|
|
96
|
-
isAdmin: boolean;
|
|
97
|
-
permissions: string[];
|
|
98
|
-
myFavorites: any[];
|
|
99
|
-
users: {
|
|
100
|
-
create: (user: User) => Promise<User>;
|
|
101
|
-
del: (user_id: number) => Promise<any>;
|
|
102
|
-
update: (id: number, user: User) => Promise<any>;
|
|
103
|
-
list: (args: any) => Promise<any>;
|
|
104
|
-
};
|
|
105
|
-
roles: {
|
|
106
|
-
list: () => Promise<any>;
|
|
107
|
-
};
|
|
108
|
-
getColorValue: () => string;
|
|
109
|
-
setMyFavorites: (favorites: Array<any>) => void;
|
|
110
|
-
reloadMyFavorites: () => Promise<void>;
|
|
111
|
-
getMyFavorites: () => any[];
|
|
112
|
-
isDarkMode: () => boolean;
|
|
113
|
-
getVersion: () => string;
|
|
114
|
-
addError: (err: Error) => void;
|
|
115
|
-
getErrors: () => Error[];
|
|
116
|
-
removeError: (error: Error) => void;
|
|
117
|
-
getStyle: (name: string) => any;
|
|
118
|
-
setStyles: (s: Object) => void;
|
|
119
|
-
getStyles: () => {
|
|
120
|
-
[key: string]: any;
|
|
121
|
-
};
|
|
122
|
-
setStyle: (name: string, value: any) => Promise<void>;
|
|
123
|
-
setCurrentRoute: (to: any) => void;
|
|
124
|
-
getID: () => number | null;
|
|
125
|
-
init: (styles: any) => void;
|
|
126
|
-
isGranted: (right?: string) => boolean;
|
|
127
|
-
setPermissions: (permissions: Array<string>) => void;
|
|
128
|
-
};
|
|
37
|
+
export { useLight } from "./light.js";
|
|
129
38
|
export * from "./lib/index.js";
|
package/dist/runtime/index.js
CHANGED
|
@@ -1,198 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { watch, reactive, toRaw } from "vue";
|
|
3
|
-
import { m, q } from "./lib/index.js";
|
|
4
|
-
const errors = reactive([]);
|
|
5
|
-
let styles = {};
|
|
6
|
-
const COLOR_CODE = {
|
|
7
|
-
red: "#f44336",
|
|
8
|
-
pink: "#e91e63",
|
|
9
|
-
purple: "#9c27b0",
|
|
10
|
-
"deep-purple": "#673ab7",
|
|
11
|
-
indigo: "#3f51b5",
|
|
12
|
-
blue: "#2196f3",
|
|
13
|
-
"light-blue": "#03a9f4",
|
|
14
|
-
cyan: "#00bcd4",
|
|
15
|
-
teal: "#009688",
|
|
16
|
-
green: "#4caf50",
|
|
17
|
-
"light-green": "#8bc34a",
|
|
18
|
-
lime: "#cddc39",
|
|
19
|
-
yellow: "#ffeb3b",
|
|
20
|
-
amber: "#ffc107",
|
|
21
|
-
orange: "#ff9800",
|
|
22
|
-
"deep-orange": "#ff5722",
|
|
23
|
-
brown: "#795548",
|
|
24
|
-
grey: "#9e9e9e",
|
|
25
|
-
"blue-grey": "#607d8b",
|
|
26
|
-
primary: "#7367f0",
|
|
27
|
-
secondary: "#82868b",
|
|
28
|
-
accent: "#9C27B0",
|
|
29
|
-
positive: "#28c76f",
|
|
30
|
-
negative: "#ea5455",
|
|
31
|
-
info: "#00cfe8",
|
|
32
|
-
warning: "#ff9f43",
|
|
33
|
-
dark: "#4b4b4b"
|
|
34
|
-
};
|
|
35
|
-
let defaultStyle = {
|
|
36
|
-
inputOutlined: true,
|
|
37
|
-
inputStackLabel: true,
|
|
38
|
-
tableFlat: true,
|
|
39
|
-
tableBorder: true,
|
|
40
|
-
tableSeparator: "cell"
|
|
41
|
-
};
|
|
42
|
-
const app = reactive({
|
|
43
|
-
company: "",
|
|
44
|
-
companyLogo: "",
|
|
45
|
-
color: "",
|
|
46
|
-
theme: "light",
|
|
47
|
-
isAdmin: false,
|
|
48
|
-
permissions: Array(),
|
|
49
|
-
myFavorites: Array(),
|
|
50
|
-
users: {
|
|
51
|
-
create: async (user) => {
|
|
52
|
-
const u = await m("addUser", { data: user });
|
|
53
|
-
user.user_id = u;
|
|
54
|
-
return user;
|
|
55
|
-
},
|
|
56
|
-
del: async (user_id) => {
|
|
57
|
-
return await m("deleteUser", { id: user_id });
|
|
58
|
-
},
|
|
59
|
-
update: async (id, user) => {
|
|
60
|
-
return await m("updateUser", {
|
|
61
|
-
id,
|
|
62
|
-
data: user
|
|
63
|
-
});
|
|
64
|
-
},
|
|
65
|
-
list: async (args) => {
|
|
66
|
-
const { listUser } = await q({
|
|
67
|
-
listUser: {
|
|
68
|
-
data: {
|
|
69
|
-
__args: args,
|
|
70
|
-
user_id: true,
|
|
71
|
-
name: true
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
return listUser.data;
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
roles: {
|
|
79
|
-
list: async () => {
|
|
80
|
-
const { listRole } = await q({
|
|
81
|
-
listRole: {
|
|
82
|
-
name: true
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
return listRole;
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
getColorValue: () => {
|
|
89
|
-
return COLOR_CODE[app.color];
|
|
90
|
-
},
|
|
91
|
-
setMyFavorites: (favorites) => {
|
|
92
|
-
app.myFavorites = favorites;
|
|
93
|
-
},
|
|
94
|
-
reloadMyFavorites: async () => {
|
|
95
|
-
const data = await q({
|
|
96
|
-
my: {
|
|
97
|
-
myFavorites: {
|
|
98
|
-
my_favorite_id: true,
|
|
99
|
-
label: true,
|
|
100
|
-
path: true,
|
|
101
|
-
icon: true
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
app.myFavorites = data.my.myFavorites;
|
|
106
|
-
},
|
|
107
|
-
getMyFavorites: () => {
|
|
108
|
-
return app.myFavorites;
|
|
109
|
-
},
|
|
110
|
-
isDarkMode: () => {
|
|
111
|
-
return app.theme == "dark";
|
|
112
|
-
},
|
|
113
|
-
getVersion: () => {
|
|
114
|
-
return packageJson.version;
|
|
115
|
-
},
|
|
116
|
-
addError: (err) => {
|
|
117
|
-
errors.push(err);
|
|
118
|
-
},
|
|
119
|
-
getErrors: () => {
|
|
120
|
-
return errors;
|
|
121
|
-
},
|
|
122
|
-
removeError: (error) => {
|
|
123
|
-
const index = errors.indexOf(error);
|
|
124
|
-
if (index > -1) {
|
|
125
|
-
errors.splice(index, 1);
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
getStyle(name) {
|
|
129
|
-
if (styles[name] === void 0) {
|
|
130
|
-
if (defaultStyle[name] !== void 0) {
|
|
131
|
-
return defaultStyle[name];
|
|
132
|
-
}
|
|
133
|
-
return false;
|
|
134
|
-
}
|
|
135
|
-
return styles[name];
|
|
136
|
-
},
|
|
137
|
-
setStyles(s) {
|
|
138
|
-
styles = s;
|
|
139
|
-
},
|
|
140
|
-
getStyles() {
|
|
141
|
-
return styles;
|
|
142
|
-
},
|
|
143
|
-
async setStyle(name, value) {
|
|
144
|
-
await m("updateMyStyle", {
|
|
145
|
-
name,
|
|
146
|
-
value
|
|
147
|
-
});
|
|
148
|
-
styles[name] = value;
|
|
149
|
-
},
|
|
150
|
-
setCurrentRoute(to) {
|
|
151
|
-
currentRoute = to;
|
|
152
|
-
},
|
|
153
|
-
getID() {
|
|
154
|
-
if (currentRoute == null) return null;
|
|
155
|
-
let name = currentRoute.name?.toString();
|
|
156
|
-
if (name == void 0) return 0;
|
|
157
|
-
let parts = name.split("-");
|
|
158
|
-
const keyname = parts[1];
|
|
159
|
-
return parseInt(currentRoute.params[keyname]);
|
|
160
|
-
},
|
|
161
|
-
init(styles2) {
|
|
162
|
-
app.color = styles2.color || "primary";
|
|
163
|
-
app.theme = styles2.theme || "semi-dark";
|
|
164
|
-
app.setStyles(styles2);
|
|
165
|
-
watch(() => app.theme, async () => {
|
|
166
|
-
await app.setStyle("theme", app.theme);
|
|
167
|
-
});
|
|
168
|
-
},
|
|
169
|
-
isGranted(right) {
|
|
170
|
-
if (right === void 0) return true;
|
|
171
|
-
if (app.permissions.includes("*")) return true;
|
|
172
|
-
if (app.permissions.includes(right)) return true;
|
|
173
|
-
const parts = right.split(".");
|
|
174
|
-
parts.pop();
|
|
175
|
-
do {
|
|
176
|
-
if (app.permissions.includes(parts.join(".") + ".*")) return true;
|
|
177
|
-
parts.pop();
|
|
178
|
-
} while (parts.length > 0);
|
|
179
|
-
return false;
|
|
180
|
-
},
|
|
181
|
-
setPermissions(permissions) {
|
|
182
|
-
this.permissions = permissions;
|
|
183
|
-
}
|
|
184
|
-
});
|
|
185
|
-
let currentRoute = null;
|
|
186
|
-
watch(() => app.color, async () => {
|
|
187
|
-
await m("updateMyStyle", {
|
|
188
|
-
name: "color",
|
|
189
|
-
value: app.color
|
|
190
|
-
});
|
|
191
|
-
});
|
|
192
|
-
export const useLight = (options = {}) => {
|
|
193
|
-
if (options.color !== void 0) {
|
|
194
|
-
toRaw(app).color = options.color;
|
|
195
|
-
}
|
|
196
|
-
return app;
|
|
197
|
-
};
|
|
1
|
+
export { useLight } from "./light.js";
|
|
198
2
|
export * from "./lib/index.js";
|