@hostlink/nuxt-light 0.0.117 → 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/pages/User/_user_id/edit.vue +31 -25
- package/dist/runtime/pages/User/add.vue +1 -8
- package/package.json +1 -1
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>
|
|
@@ -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" />
|