@hostlink/nuxt-light 0.0.116 → 0.0.118
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-file.vue +1 -1
- package/dist/runtime/formkit/Form.vue +12 -2
- package/dist/runtime/formkit/Select.vue +20 -1
- package/dist/runtime/formkit/index.mjs +1 -0
- package/dist/runtime/pages/SystemValue/_systemvalue_id/edit.vue +6 -8
- package/dist/runtime/pages/SystemValue/add.vue +4 -11
- package/dist/runtime/pages/User/_user_id/edit.vue +31 -25
- package/dist/runtime/pages/User/add.vue +1 -8
- package/dist/runtime/pages/User/profile.vue +2 -2
- package/dist/runtime/routes.mjs +0 -10
- package/package.json +1 -1
- package/dist/runtime/pages/User/update-password.vue +0 -44
package/dist/module.json
CHANGED
|
@@ -40,7 +40,7 @@ const attrs = {
|
|
|
40
40
|
}
|
|
41
41
|
</script>
|
|
42
42
|
<template>
|
|
43
|
-
<q-input v-bind="attrs" v-model="localValue">
|
|
43
|
+
<q-input v-bind="attrs" v-model="localValue" hide-bottom-space>
|
|
44
44
|
<q-dialog v-model="show" full-height full-width>
|
|
45
45
|
<l-file-manager closable @close="show = false" @input="onInput"></l-file-manager>
|
|
46
46
|
</q-dialog>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { ref } from 'vue'
|
|
3
3
|
import { useRouter, useRoute } from "vue-router";
|
|
4
|
-
import { Dialog } from "quasar";
|
|
4
|
+
import { Dialog, Notify } from "quasar";
|
|
5
5
|
import { model } from "@hostlink/light"
|
|
6
6
|
|
|
7
7
|
const route = useRoute();
|
|
@@ -40,11 +40,21 @@ if (!props.context.onSubmit) {
|
|
|
40
40
|
try {
|
|
41
41
|
if (route.params[id_name]) {//edit
|
|
42
42
|
if (await model(module).update(parseInt(route.params[id_name]), v)) {
|
|
43
|
+
Notify.create({
|
|
44
|
+
message: "Updated successfully",
|
|
45
|
+
color: "positive",
|
|
46
|
+
icon: "sym_o_check"
|
|
47
|
+
});
|
|
43
48
|
router.go(-1);
|
|
44
49
|
return;
|
|
45
50
|
}
|
|
46
51
|
} else {
|
|
47
52
|
if (await model(module).add(v)) {
|
|
53
|
+
Notify.create({
|
|
54
|
+
message: "Added successfully",
|
|
55
|
+
color: "positive",
|
|
56
|
+
icon: "sym_o_check"
|
|
57
|
+
});
|
|
48
58
|
router.go(-1);
|
|
49
59
|
return;
|
|
50
60
|
}
|
|
@@ -67,7 +77,7 @@ if (!props.context.onSubmit) {
|
|
|
67
77
|
<form v-bind="context.attrs">
|
|
68
78
|
<l-card :bordered="bordered">
|
|
69
79
|
<q-card-section>
|
|
70
|
-
<div :class="`q-gutter-${gutter}`">
|
|
80
|
+
<div :class="`q-col-gutter-${gutter}`">
|
|
71
81
|
<slot v-bind="context"></slot>
|
|
72
82
|
</div>
|
|
73
83
|
</q-card-section>
|
|
@@ -15,9 +15,28 @@ const value = computed({
|
|
|
15
15
|
const ss = Object.entries(useSlots()).map(([key, value]) => {
|
|
16
16
|
return key;
|
|
17
17
|
});
|
|
18
|
+
|
|
19
|
+
//check required in parsedRules
|
|
20
|
+
let required = false;
|
|
21
|
+
for (let rule of props.context.node.props.parsedRules ?? []) {
|
|
22
|
+
if (rule.name === "required") {
|
|
23
|
+
required = true;
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
let clearable = false;
|
|
29
|
+
if (required) { //no clearable
|
|
30
|
+
clearable = false;
|
|
31
|
+
} else {
|
|
32
|
+
clearable = true;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
18
36
|
</script>
|
|
19
37
|
<template>
|
|
20
|
-
<l-select v-model="value" :label="context.label" v-bind="context.attrs" :error="error" :error-message="errorMessage"
|
|
38
|
+
<l-select v-model="value" :label="context.label" v-bind="context.attrs" :error="error" :error-message="errorMessage"
|
|
39
|
+
:clearable="clearable">
|
|
21
40
|
<template v-for="s in ss" v-slot:[s]="props" :key="s">
|
|
22
41
|
<slot :name="s" v-bind="props ?? {}"></slot>
|
|
23
42
|
</template>
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
const obj = reactive(await getObject(["name", "value"]))
|
|
2
|
+
import { getObject } from '#imports'
|
|
3
|
+
const obj = await getObject(["name", "value"])
|
|
5
4
|
</script>
|
|
6
5
|
|
|
7
6
|
<template>
|
|
8
7
|
<l-page>
|
|
9
|
-
<l-form
|
|
10
|
-
<l-input label="Name"
|
|
11
|
-
<l-input label="Value"
|
|
12
|
-
</
|
|
13
|
-
|
|
8
|
+
<FormKit type="l-form" :value="obj">
|
|
9
|
+
<FormKit type="l-input" label="Name" name="name" validation="required" />
|
|
10
|
+
<FormKit type="l-input" label="Value" name="value" validation="required" input-type="textarea" />
|
|
11
|
+
</FormKit>
|
|
14
12
|
</l-page>
|
|
15
13
|
</template>
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { reactive } from 'vue'
|
|
3
|
-
|
|
4
|
-
const obj = reactive({})
|
|
5
|
-
</script>
|
|
6
|
-
|
|
7
1
|
<template>
|
|
8
2
|
<l-page>
|
|
9
|
-
<l-form
|
|
10
|
-
<l-input label="Name"
|
|
11
|
-
<l-input label="Value"
|
|
12
|
-
</
|
|
13
|
-
|
|
3
|
+
<FormKit type="l-form">
|
|
4
|
+
<FormKit type="l-input" label="Name" name="name" validation="required" />
|
|
5
|
+
<FormKit type="l-input" label="Value" name="value" validation="required" input-type="textarea" />
|
|
6
|
+
</FormKit>
|
|
14
7
|
</l-page>
|
|
15
8
|
</template>
|
|
@@ -4,44 +4,50 @@ import { getObject } from '../../../'
|
|
|
4
4
|
const obj = reactive(await getObject(["username", "first_name", "last_name", "email", "phone",
|
|
5
5
|
"addr1", "addr2", "addr3", "join_date", "expiry_date", "status", "language", "default_page"
|
|
6
6
|
]))
|
|
7
|
+
|
|
8
|
+
const options = [
|
|
9
|
+
{ label: 'Active', value: 0 },
|
|
10
|
+
{ label: 'Inactive', value: 1 }
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
const languages = [
|
|
14
|
+
{ label: 'English', value: 'en' },
|
|
15
|
+
{ label: '中文', value: 'zh-hk' }
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
|
|
7
19
|
</script>
|
|
8
20
|
|
|
9
21
|
<template>
|
|
10
22
|
<l-page>
|
|
11
|
-
<l-form
|
|
23
|
+
<FormKit type="l-form" :value="obj">
|
|
12
24
|
<l-row>
|
|
13
25
|
<l-col md="6" gutter="md">
|
|
14
|
-
<l-input label="Username"
|
|
15
|
-
<l-input label="First name"
|
|
16
|
-
<l-input label="Last name"
|
|
17
|
-
<l-input label="Email"
|
|
26
|
+
<FormKit type="l-input" label="Username" name="username" validation="required" />
|
|
27
|
+
<FormKit type="l-input" label="First name" name="first_name" validation="required" />
|
|
28
|
+
<FormKit type="l-input" label="Last name" name="last_name" />
|
|
29
|
+
<FormKit type="l-input" label="Email" name="email" validation="required|email" />
|
|
18
30
|
</l-col>
|
|
31
|
+
|
|
19
32
|
<l-col md="6" gutter="md">
|
|
20
|
-
<l-input label="Phone"
|
|
21
|
-
<l-input label="Address1"
|
|
22
|
-
<l-input label="Address2"
|
|
23
|
-
<l-input label="Address3"
|
|
33
|
+
<FormKit type="l-input" label="Phone" name="phone" />
|
|
34
|
+
<FormKit type="l-input" label="Address1" name="addr1" />
|
|
35
|
+
<FormKit type="l-input" label="Address2" name="addr2" />
|
|
36
|
+
<FormKit type="l-input" label="Address3" name="addr3" />
|
|
24
37
|
</l-col>
|
|
25
|
-
<l-col gutter="md">
|
|
26
|
-
<l-date-picker label="Join date" v-model="obj.join_date" required />
|
|
27
|
-
<l-date-picker label="Expiry date" v-model="obj.expiry_date" />
|
|
28
38
|
|
|
29
|
-
|
|
30
|
-
|
|
39
|
+
<l-col gutter="md">
|
|
40
|
+
<FormKit type="l-date-picker" label="Join date" name="join_date" validation="required" />
|
|
41
|
+
<FormKit type="l-date-picker" label="Expiry date" name="expiry_date" />
|
|
42
|
+
<FormKit type="l-select" label="Status" name="status" :options="options" validation="required" />
|
|
43
|
+
<FormKit type="l-select" label="Language" name="language" :options="languages" validation="required" />
|
|
44
|
+
<FormKit type="l-input" label="Default page" name="default_page" />
|
|
31
45
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
value: 'en'
|
|
35
|
-
}, {
|
|
36
|
-
label: '中文',
|
|
37
|
-
value: 'zh-hk'
|
|
38
|
-
}]" v-model="obj.language" required></l-select>
|
|
46
|
+
</l-col>
|
|
47
|
+
</l-row>
|
|
39
48
|
|
|
40
|
-
|
|
49
|
+
</FormKit>
|
|
41
50
|
|
|
42
51
|
|
|
43
|
-
</l-col>
|
|
44
|
-
</l-row>
|
|
45
|
-
</l-form>
|
|
46
52
|
</l-page>
|
|
47
53
|
</template>
|
|
@@ -48,18 +48,11 @@ const languages = [
|
|
|
48
48
|
{ label: '中文', value: 'zh-hk' }
|
|
49
49
|
]
|
|
50
50
|
|
|
51
|
-
const onSubmit = async (data) => {
|
|
52
|
-
return model("User").add(data).then((res) => {
|
|
53
|
-
router.push("/User");
|
|
54
|
-
}).catch((err) => {
|
|
55
|
-
console.log(err)
|
|
56
|
-
})
|
|
57
|
-
}
|
|
58
51
|
|
|
59
52
|
</script>
|
|
60
53
|
<template>
|
|
61
54
|
<l-page>
|
|
62
|
-
<FormKit type="l-form" :value="obj"
|
|
55
|
+
<FormKit type="l-form" :value="obj">
|
|
63
56
|
<l-row>
|
|
64
57
|
<l-col md="6" gutter="md">
|
|
65
58
|
<FormKit type="l-input" label="Username" name="username" validation="required" />
|
|
@@ -48,8 +48,8 @@ eventLogCols.forEach(col => {
|
|
|
48
48
|
<template>
|
|
49
49
|
<l-page title="User profile">
|
|
50
50
|
<template #header>
|
|
51
|
-
<l-btn icon="
|
|
52
|
-
<l-btn icon="sym_o_key" to="two-factor-auth" label="Two factor auth" />
|
|
51
|
+
<l-btn icon="sym_o_password" to="setting/password" label="Update password" />
|
|
52
|
+
<l-btn icon="sym_o_key" to="setting/two-factor-auth" label="Two factor auth" />
|
|
53
53
|
</template>
|
|
54
54
|
<div class="q-gutter-md q-mt-md">
|
|
55
55
|
<l-card>
|
package/dist/runtime/routes.mjs
CHANGED
|
@@ -151,11 +151,6 @@ function User_setting_two_factor_auth() {
|
|
|
151
151
|
/* webpackChunkName: "User-setting-two-factor-auth" */ './pages/User/setting/two-factor-auth.vue'
|
|
152
152
|
)
|
|
153
153
|
}
|
|
154
|
-
function User_update_password() {
|
|
155
|
-
return import(
|
|
156
|
-
/* webpackChunkName: "User-update-password" */ './pages/User/update-password.vue'
|
|
157
|
-
)
|
|
158
|
-
}
|
|
159
154
|
function System_database_backup() {
|
|
160
155
|
return import(
|
|
161
156
|
/* webpackChunkName: "System-database-backup" */ './pages/System/database/backup.vue'
|
|
@@ -369,11 +364,6 @@ export default [
|
|
|
369
364
|
},
|
|
370
365
|
],
|
|
371
366
|
},
|
|
372
|
-
{
|
|
373
|
-
name: 'User-update-password',
|
|
374
|
-
path: '/User/update-password',
|
|
375
|
-
component: User_update_password,
|
|
376
|
-
},
|
|
377
367
|
{
|
|
378
368
|
name: 'System-database-backup',
|
|
379
369
|
path: '/System/database/backup',
|
package/package.json
CHANGED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { useQuasar } from 'quasar';
|
|
3
|
-
import { updatePassword } from '@hostlink/light';
|
|
4
|
-
|
|
5
|
-
const obj = reactive({
|
|
6
|
-
old_password: "",
|
|
7
|
-
new_password: "",
|
|
8
|
-
confirm_password: ""
|
|
9
|
-
})
|
|
10
|
-
|
|
11
|
-
const qua = useQuasar();
|
|
12
|
-
const router = useRouter();
|
|
13
|
-
|
|
14
|
-
const onSave = async () => {
|
|
15
|
-
if (await updatePassword(obj.old_password, obj.new_password)) {
|
|
16
|
-
//back
|
|
17
|
-
router.back();
|
|
18
|
-
} else {
|
|
19
|
-
//show error
|
|
20
|
-
qua.notify({
|
|
21
|
-
message: "Invalid old password",
|
|
22
|
-
color: "negative",
|
|
23
|
-
icon: "sym_o_error",
|
|
24
|
-
position: "top",
|
|
25
|
-
timeout: 2000
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
</script>
|
|
31
|
-
<template>
|
|
32
|
-
<l-page>
|
|
33
|
-
<l-form @save="onSave">
|
|
34
|
-
<l-input label="Old password" v-model="obj.old_password" type="password"
|
|
35
|
-
:rules="[v => !!v || 'Old password is required']" />
|
|
36
|
-
<l-input label="New password" v-model="obj.new_password" type="password"
|
|
37
|
-
:rules="[v => !!v || 'New password is required']" />
|
|
38
|
-
<l-input label="Confirm password" v-model="obj.confirm_password" type="password" :rules="[
|
|
39
|
-
v => !!v || 'Confirm password is required',
|
|
40
|
-
v => v == obj.new_password || 'Confirm password does not match'
|
|
41
|
-
]" />
|
|
42
|
-
</l-form>
|
|
43
|
-
</l-page>
|
|
44
|
-
</template>
|