@hostlink/nuxt-light 0.0.113 → 0.0.115
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/assets/main.css +1 -30
- package/dist/runtime/components/l-date-picker.vue +7 -7
- package/dist/runtime/components/l-field.vue +10 -1
- package/dist/runtime/components/l-file-manager.vue +2 -4
- package/dist/runtime/components/l-file.vue +19 -2
- package/dist/runtime/components/l-input.vue +17 -9
- package/dist/runtime/components/l-login.vue +2 -2
- package/dist/runtime/components/l-menu.vue +2 -11
- package/dist/runtime/components/l-select.vue +7 -7
- package/dist/runtime/components/l-table.vue +17 -19
- package/dist/runtime/components/l-time-picker.vue +17 -2
- package/dist/runtime/formkit/Checkbox.vue +27 -0
- package/dist/runtime/formkit/DatePicker.vue +25 -0
- package/dist/runtime/formkit/FilePicker.vue +33 -0
- package/dist/runtime/formkit/Form.vue +72 -0
- package/dist/runtime/formkit/Input.vue +35 -0
- package/dist/runtime/formkit/OptionGroup.vue +22 -0
- package/dist/runtime/formkit/Radio.vue +22 -0
- package/dist/runtime/formkit/Repeater.vue +107 -0
- package/dist/runtime/formkit/Select.vue +25 -0
- package/dist/runtime/formkit/TimePicker.vue +25 -0
- package/dist/runtime/formkit/index.d.ts +2 -0
- package/dist/runtime/formkit/index.mjs +79 -0
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.mjs +12 -2
- package/dist/runtime/pages/Role/add.vue +8 -12
- package/dist/runtime/pages/User/_user_id/change-password.vue +9 -17
- package/dist/runtime/pages/User/_user_id/update-role.vue +7 -8
- package/dist/runtime/pages/User/add.vue +66 -43
- package/dist/runtime/pages/User/setting/index.vue +19 -9
- package/dist/runtime/pages/User/setting/information.vue +19 -18
- package/dist/runtime/pages/User/setting/open_id.vue +4 -1
- package/dist/runtime/pages/User/setting/password.vue +26 -23
- package/dist/runtime/pages/User/setting/style.vue +2 -2
- package/dist/runtime/plugin.mjs +15 -0
- package/dist/types.d.mts +3 -2
- package/dist/types.d.ts +3 -2
- package/package.json +2 -1
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref, computed } from 'vue'
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
context: Object
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
const node = props.context.node;
|
|
9
|
+
const min = props.context.node.props.min ?? 1;
|
|
10
|
+
const max = props.context.node.props.max ?? Infinity;
|
|
11
|
+
|
|
12
|
+
const localValue = ref(props.context.value)
|
|
13
|
+
|
|
14
|
+
if (localValue.value.length < min) {
|
|
15
|
+
for (let i = localValue.value.length; i < min; i++) {
|
|
16
|
+
localValue.value.push({})
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (localValue.value.length > max) {
|
|
21
|
+
localValue.value = localValue.value.slice(0, max)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const onAdd = () => {
|
|
25
|
+
if (localValue.value.length >= max) return;
|
|
26
|
+
localValue.value.push({})
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const onRemove = (index) => {
|
|
30
|
+
if (localValue.value.length <= min) return;
|
|
31
|
+
localValue.value.splice(index, 1)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const onMoveUp = (index) => {
|
|
35
|
+
if (index > 0) {
|
|
36
|
+
let temp = localValue.value[index - 1]
|
|
37
|
+
localValue.value[index - 1] = localValue.value[index]
|
|
38
|
+
localValue.value[index] = temp
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const onMoveDown = (index) => {
|
|
43
|
+
if (index < localValue.value.length - 1) {
|
|
44
|
+
let temp = localValue.value[index + 1]
|
|
45
|
+
localValue.value[index + 1] = localValue.value[index]
|
|
46
|
+
localValue.value[index] = temp
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const isAllowRemove = computed(() => {
|
|
51
|
+
return localValue.value.length > min
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
const isAllowMoveUp = (index) => {
|
|
55
|
+
return index > 0
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const isAllowMoveDown = (index) => {
|
|
59
|
+
return index < localValue.value.length - 1
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
</script>
|
|
65
|
+
|
|
66
|
+
<template>
|
|
67
|
+
<FormKit type="list" v-model="localValue" dynamic #default="{ items, node, value }">
|
|
68
|
+
|
|
69
|
+
<FormKit type="group" v-for="(item, index) in items " :index="index" :key="item">
|
|
70
|
+
|
|
71
|
+
<q-card class="q-mb-sm" flat>
|
|
72
|
+
<q-card-section>
|
|
73
|
+
<div class="row q-col-gutter-md">
|
|
74
|
+
|
|
75
|
+
<div class="col-shrink">
|
|
76
|
+
<div class="q-mb-sm">
|
|
77
|
+
<!-- up -->
|
|
78
|
+
<q-btn type="button" @click="onMoveUp(index)" icon="sym_o_arrow_upward" color="primary"
|
|
79
|
+
dense unelevated :disable="!isAllowMoveUp(index)"/>
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
<div class="q-mb-sm">
|
|
83
|
+
<q-btn type="button" @click="onRemove" icon="sym_o_remove" color="primary" dense unelevated
|
|
84
|
+
:disable="!isAllowRemove" />
|
|
85
|
+
</div>
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
<div class="q-mb-sm">
|
|
89
|
+
<!-- down -->
|
|
90
|
+
<q-btn type="button" @click="onMoveDown(index)" icon="sym_o_arrow_downward" color="primary"
|
|
91
|
+
dense unelevated :disable="!isAllowMoveDown(index)"/>
|
|
92
|
+
</div>
|
|
93
|
+
|
|
94
|
+
</div>
|
|
95
|
+
|
|
96
|
+
<div class="col">
|
|
97
|
+
<slot></slot>
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
</q-card-section>
|
|
101
|
+
</q-card>
|
|
102
|
+
</FormKit>
|
|
103
|
+
|
|
104
|
+
<q-btn color="primary" @click="onAdd" icon="sym_o_add" label="Add" :disable="localValue.length >= max"
|
|
105
|
+
unelevated></q-btn>
|
|
106
|
+
</FormKit>
|
|
107
|
+
</template>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { getErrorMessage } from 'formkit-quasar';
|
|
3
|
+
import { computed, useSlots } from 'vue'
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
context: Object
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
const { error, errorMessage } = getErrorMessage(props.context.node);
|
|
9
|
+
|
|
10
|
+
const value = computed({
|
|
11
|
+
get: () => props.context.value,
|
|
12
|
+
set: (val) => props.context.node.input(val)
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
const ss = Object.entries(useSlots()).map(([key, value]) => {
|
|
16
|
+
return key;
|
|
17
|
+
});
|
|
18
|
+
</script>
|
|
19
|
+
<template>
|
|
20
|
+
<l-select v-model="value" :label="context.label" v-bind="context.attrs" :error="error" :error-message="errorMessage">
|
|
21
|
+
<template v-for="s in ss" v-slot:[s]="props" :key="s">
|
|
22
|
+
<slot :name="s" v-bind="props ?? {}"></slot>
|
|
23
|
+
</template>
|
|
24
|
+
</l-select>
|
|
25
|
+
</template>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, useSlots } from 'vue'
|
|
3
|
+
import { getErrorMessage } from 'formkit-quasar';
|
|
4
|
+
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
context: Object
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const { error, errorMessage } = getErrorMessage(props.context.node);
|
|
10
|
+
|
|
11
|
+
const value = computed({
|
|
12
|
+
get: () => props.context.value,
|
|
13
|
+
set: (val) => props.context.node.input(val)
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
const ss = Object.entries(useSlots()).map(([key]) => key);
|
|
17
|
+
</script>
|
|
18
|
+
<template>
|
|
19
|
+
<l-time-picker v-model="value" :label="context.label" v-bind="context.attrs" :error="error" :type="context.inputType"
|
|
20
|
+
:error-message="errorMessage">
|
|
21
|
+
<template v-for="s in ss" v-slot:[s]="props" :key="s">
|
|
22
|
+
<slot :name="s" v-bind="props ?? {}"></slot>
|
|
23
|
+
</template>
|
|
24
|
+
</l-time-picker>
|
|
25
|
+
</template>
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { forms, disablesChildren } from "@formkit/inputs";
|
|
2
|
+
import Input from "./Input.vue";
|
|
3
|
+
import SelectVue from "./Select.vue";
|
|
4
|
+
import RepeaterVue from "./Repeater.vue";
|
|
5
|
+
import FormVue from "./Form.vue";
|
|
6
|
+
import CheckboxVue from "./Checkbox.vue";
|
|
7
|
+
import RadioVue from "./Radio.vue";
|
|
8
|
+
import DatePickerVue from "./DatePicker.vue";
|
|
9
|
+
import TimePickerVue from "./TimePicker.vue";
|
|
10
|
+
import OptionGroupVue from "./OptionGroup.vue";
|
|
11
|
+
import FilePickerVue from "./FilePicker.vue";
|
|
12
|
+
export const createLightPlugin = () => {
|
|
13
|
+
return (node) => {
|
|
14
|
+
let type = node.props.type + "";
|
|
15
|
+
switch (type) {
|
|
16
|
+
case "l-file-picker":
|
|
17
|
+
return node.define({
|
|
18
|
+
type: "input",
|
|
19
|
+
component: FilePickerVue
|
|
20
|
+
});
|
|
21
|
+
case "l-option-group":
|
|
22
|
+
return node.define({
|
|
23
|
+
type: "input",
|
|
24
|
+
component: OptionGroupVue
|
|
25
|
+
});
|
|
26
|
+
case "l-time-picker":
|
|
27
|
+
return node.define({
|
|
28
|
+
type: "input",
|
|
29
|
+
component: TimePickerVue
|
|
30
|
+
});
|
|
31
|
+
case "l-date-picker":
|
|
32
|
+
return node.define({
|
|
33
|
+
type: "input",
|
|
34
|
+
component: DatePickerVue
|
|
35
|
+
});
|
|
36
|
+
case "l-radio":
|
|
37
|
+
return node.define({
|
|
38
|
+
type: "input",
|
|
39
|
+
component: RadioVue
|
|
40
|
+
});
|
|
41
|
+
case "l-checkbox":
|
|
42
|
+
return node.define({
|
|
43
|
+
type: "input",
|
|
44
|
+
component: CheckboxVue
|
|
45
|
+
});
|
|
46
|
+
case "l-input":
|
|
47
|
+
return node.define({
|
|
48
|
+
type: "input",
|
|
49
|
+
props: ["inputType"],
|
|
50
|
+
component: Input
|
|
51
|
+
});
|
|
52
|
+
case "l-select":
|
|
53
|
+
return node.define({
|
|
54
|
+
type: "input",
|
|
55
|
+
component: SelectVue
|
|
56
|
+
});
|
|
57
|
+
case "l-repeater":
|
|
58
|
+
return node.define({
|
|
59
|
+
type: "list",
|
|
60
|
+
props: ["min", "max"],
|
|
61
|
+
component: RepeaterVue
|
|
62
|
+
});
|
|
63
|
+
case "l-form":
|
|
64
|
+
return node.define({
|
|
65
|
+
type: "group",
|
|
66
|
+
component: FormVue,
|
|
67
|
+
props: [
|
|
68
|
+
"submitLabel",
|
|
69
|
+
"submit",
|
|
70
|
+
"actions",
|
|
71
|
+
"onSubmit",
|
|
72
|
+
"gutter",
|
|
73
|
+
"bordered"
|
|
74
|
+
],
|
|
75
|
+
features: [forms, disablesChildren]
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
};
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare const useLight: () => {
|
|
|
12
12
|
addError: (error: String) => void;
|
|
13
13
|
getErrors: () => String[];
|
|
14
14
|
removeError: (error: String) => void;
|
|
15
|
-
getStyle: (name: String
|
|
15
|
+
getStyle: (name: String) => any;
|
|
16
16
|
setStyles: (s: Object) => void;
|
|
17
17
|
getStyles: () => {
|
|
18
18
|
theme?: String | undefined;
|
package/dist/runtime/index.mjs
CHANGED
|
@@ -3,6 +3,13 @@ import { watch, reactive } from "vue";
|
|
|
3
3
|
import { m } from "./lib/index.mjs";
|
|
4
4
|
const errors = [];
|
|
5
5
|
let styles = {};
|
|
6
|
+
let defaultStyle = {
|
|
7
|
+
inputOutlined: true,
|
|
8
|
+
inputStackLabel: true,
|
|
9
|
+
tableFlat: true,
|
|
10
|
+
tableBorder: true,
|
|
11
|
+
tableSeparator: "cell"
|
|
12
|
+
};
|
|
6
13
|
const app = reactive({
|
|
7
14
|
company: "",
|
|
8
15
|
companyLogo: "",
|
|
@@ -38,9 +45,12 @@ const app = reactive({
|
|
|
38
45
|
errors.splice(index, 1);
|
|
39
46
|
}
|
|
40
47
|
},
|
|
41
|
-
getStyle(name
|
|
48
|
+
getStyle(name) {
|
|
42
49
|
if (styles[name] === void 0) {
|
|
43
|
-
|
|
50
|
+
if (defaultStyle[name] !== void 0) {
|
|
51
|
+
return defaultStyle[name];
|
|
52
|
+
}
|
|
53
|
+
return false;
|
|
44
54
|
}
|
|
45
55
|
return styles[name];
|
|
46
56
|
},
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { reactive } from 'vue'
|
|
3
2
|
import { q } from '../../'
|
|
4
|
-
const obj = reactive({
|
|
5
|
-
childs: ["Users"],
|
|
6
|
-
})
|
|
7
3
|
|
|
8
4
|
let roles = await q("listRole", ["name"]);
|
|
9
5
|
roles = roles.map((role) => {
|
|
@@ -13,18 +9,18 @@ roles = roles.map((role) => {
|
|
|
13
9
|
};
|
|
14
10
|
});
|
|
15
11
|
|
|
12
|
+
const onSubmit = (e) => {
|
|
13
|
+
e.preventDefault();
|
|
14
|
+
console.log("submit");
|
|
15
|
+
}
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
18
|
<template>
|
|
19
19
|
<l-page>
|
|
20
|
-
<l-form
|
|
21
|
-
<l-input
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
</q-option-group>
|
|
25
|
-
</q-field>
|
|
26
|
-
|
|
27
|
-
</l-form>
|
|
20
|
+
<FormKit type="l-form" :value="{ childs: ['Users'] }" >
|
|
21
|
+
<FormKit type="l-input" name="name" label="Name" validation="required" />
|
|
22
|
+
<FormKit type="l-option-group" :options="roles" name="childs" label="Child" />
|
|
23
|
+
</FormKit>
|
|
28
24
|
|
|
29
25
|
</l-page>
|
|
30
26
|
</template>
|
|
@@ -1,31 +1,23 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { q, m } from '../../../'
|
|
3
|
-
import { useRouter
|
|
4
|
-
import { reactive } from "vue"
|
|
3
|
+
import { useRouter } from "vue-router"
|
|
5
4
|
const system = await q("system", ["passwordPolicy"]);
|
|
6
5
|
const router = useRouter();
|
|
7
|
-
const route = useRoute();
|
|
8
6
|
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
const onUpdatePassword = async () => {
|
|
14
|
-
if (await m("updateUserPassword", {
|
|
7
|
+
const onSubmit = async (data, form) => {
|
|
8
|
+
return await m("updateUserPassword", {
|
|
15
9
|
id: route.params.user_id,
|
|
16
|
-
password:
|
|
17
|
-
})) {
|
|
10
|
+
password: data.password
|
|
11
|
+
}).then(() => {
|
|
18
12
|
router.push("/User");
|
|
19
|
-
}
|
|
13
|
+
});
|
|
20
14
|
}
|
|
21
15
|
|
|
22
16
|
</script>
|
|
23
17
|
<template>
|
|
24
18
|
<l-page>
|
|
25
|
-
<l-form @
|
|
26
|
-
<l-input
|
|
27
|
-
|
|
28
|
-
</l-form>
|
|
29
|
-
|
|
19
|
+
<FormKit type="l-form" @submit="onSubmit">
|
|
20
|
+
<FormKit type="l-input" name="password" :validation="system.passwordPolicy" label="Password" input-type="password"></FormKit>
|
|
21
|
+
</FormKit>
|
|
30
22
|
</l-page>
|
|
31
23
|
</template>
|
|
@@ -18,11 +18,11 @@ roles = roles.map((role) => {
|
|
|
18
18
|
};
|
|
19
19
|
});
|
|
20
20
|
|
|
21
|
-
const submit = async () => {
|
|
21
|
+
const submit = async (data, form) => {
|
|
22
22
|
|
|
23
23
|
if (await m("updateUserRole", {
|
|
24
24
|
user_id: obj.user_id,
|
|
25
|
-
roles:
|
|
25
|
+
roles: data.roles
|
|
26
26
|
})) {
|
|
27
27
|
//show success message
|
|
28
28
|
|
|
@@ -41,12 +41,11 @@ const submit = async () => {
|
|
|
41
41
|
</script>
|
|
42
42
|
<template>
|
|
43
43
|
<l-page>
|
|
44
|
-
<l-form @submit="submit">
|
|
45
|
-
<l-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
</l-form>
|
|
44
|
+
<FormKit type="l-form" @submit="submit" :value="{ roles: obj.roles }">
|
|
45
|
+
<FormKit type="l-option-group" :options="roles" name="roles">
|
|
46
|
+
</FormKit>
|
|
47
|
+
</FormKit>
|
|
48
|
+
|
|
50
49
|
|
|
51
50
|
</l-page>
|
|
52
51
|
</template>
|
|
@@ -1,71 +1,94 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { reactive } from "vue"
|
|
3
|
+
import { useRouter } from "vue-router";
|
|
4
|
+
import { model } from "@hostlink/light";
|
|
3
5
|
import { q } from '../../'
|
|
6
|
+
const router = useRouter()
|
|
4
7
|
const obj = reactive({
|
|
5
|
-
|
|
8
|
+
username: null,
|
|
9
|
+
password: null,
|
|
10
|
+
first_name: null,
|
|
11
|
+
last_name: null,
|
|
12
|
+
email: null,
|
|
13
|
+
phone: null,
|
|
14
|
+
addr1: null,
|
|
15
|
+
addr2: null,
|
|
16
|
+
addr3: null,
|
|
17
|
+
join_date: new Date().toISOString().substring(0, 10), //YYYY-MM-DD (today)
|
|
18
|
+
expiry_date: null,
|
|
6
19
|
status: 0,
|
|
7
20
|
language: "en",
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
21
|
+
default_page: null,
|
|
22
|
+
roles: ['Users'],
|
|
11
23
|
})
|
|
12
24
|
|
|
13
|
-
let
|
|
14
|
-
|
|
25
|
+
let { system, listRole } = await q({
|
|
26
|
+
system: {
|
|
27
|
+
passwordPolicy: true,
|
|
28
|
+
},
|
|
29
|
+
listRole: {
|
|
30
|
+
name: true,
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
const roles = listRole.map((role) => {
|
|
15
34
|
return {
|
|
16
35
|
label: role.name,
|
|
17
36
|
value: role.name,
|
|
18
37
|
};
|
|
19
38
|
});
|
|
20
39
|
|
|
21
|
-
|
|
40
|
+
|
|
41
|
+
const options = [
|
|
42
|
+
{ label: 'Active', value: 0 },
|
|
43
|
+
{ label: 'Inactive', value: 1 }
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
const languages = [
|
|
47
|
+
{ label: 'English', value: 'en' },
|
|
48
|
+
{ label: '中文', value: 'zh-hk' }
|
|
49
|
+
]
|
|
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
|
+
|
|
22
59
|
</script>
|
|
23
60
|
<template>
|
|
24
61
|
<l-page>
|
|
25
|
-
<l-form
|
|
62
|
+
<FormKit type="l-form" :value="obj" @submit="onSubmit">
|
|
26
63
|
<l-row>
|
|
27
64
|
<l-col md="6" gutter="md">
|
|
28
|
-
<l-input label="Username"
|
|
29
|
-
<l-input label="Password"
|
|
30
|
-
|
|
31
|
-
<l-input label="First name"
|
|
32
|
-
<l-input label="Last name"
|
|
33
|
-
<l-input label="Email"
|
|
65
|
+
<FormKit type="l-input" label="Username" name="username" validation="required" />
|
|
66
|
+
<FormKit type="l-input" label="Password" name="password" :validation="system.passwordPolicy"
|
|
67
|
+
input-type="password" />
|
|
68
|
+
<FormKit type="l-input" label="First name" name="first_name" validation="required" />
|
|
69
|
+
<FormKit type="l-input" label="Last name" name="last_name" />
|
|
70
|
+
<FormKit type="l-input" label="Email" name="email" validation="required|email" />
|
|
34
71
|
</l-col>
|
|
72
|
+
|
|
35
73
|
<l-col md="6" gutter="md">
|
|
36
|
-
<l-input label="Phone"
|
|
37
|
-
<l-input label="Address1"
|
|
38
|
-
<l-input label="Address2"
|
|
39
|
-
<l-input label="Address3"
|
|
74
|
+
<FormKit type="l-input" label="Phone" name="phone" />
|
|
75
|
+
<FormKit type="l-input" label="Address1" name="addr1" />
|
|
76
|
+
<FormKit type="l-input" label="Address2" name="addr2" />
|
|
77
|
+
<FormKit type="l-input" label="Address3" name="addr3" />
|
|
40
78
|
</l-col>
|
|
41
|
-
<l-col gutter="md">
|
|
42
|
-
<l-date-picker label="Join date" v-model="obj.join_date" required />
|
|
43
|
-
<l-date-picker label="Expiry date" v-model="obj.expiry_date" />
|
|
44
|
-
|
|
45
|
-
<l-select label="Status" :options="[{
|
|
46
|
-
label: 'Active',
|
|
47
|
-
value: 0
|
|
48
|
-
}, {
|
|
49
|
-
label: 'Inactive',
|
|
50
|
-
value: 1
|
|
51
|
-
}]" v-model="obj.status" required></l-select>
|
|
52
|
-
|
|
53
|
-
<l-select label="Language" :options="[{
|
|
54
|
-
label: 'English',
|
|
55
|
-
value: 'en'
|
|
56
|
-
}, {
|
|
57
|
-
label: '中文',
|
|
58
|
-
value: 'zh-hk'
|
|
59
|
-
}]" v-model="obj.language" emit-value map-options required></l-select>
|
|
60
79
|
|
|
61
|
-
|
|
80
|
+
<l-col gutter="md">
|
|
81
|
+
<FormKit type="l-date-picker" label="Join date" name="join_date" validation="required" />
|
|
82
|
+
<FormKit type="l-date-picker" label="Expiry date" name="expiry_date" />
|
|
83
|
+
<FormKit type="l-select" label="Status" name="status" :options="options" validation="required" />
|
|
84
|
+
<FormKit type="l-select" label="Language" name="language" :options="languages" validation="required" />
|
|
85
|
+
<FormKit type="l-input" label="Default page" name="default_page" />
|
|
62
86
|
|
|
63
|
-
<l-
|
|
64
|
-
<q-option-group type="checkbox" :options="roles" v-model="obj.roles" inline>
|
|
65
|
-
</q-option-group>
|
|
66
|
-
</l-field>
|
|
87
|
+
<FormKit type="l-option-group" label="Roles" name="roles" :options="roles ?? []" />
|
|
67
88
|
</l-col>
|
|
68
89
|
</l-row>
|
|
69
|
-
|
|
90
|
+
|
|
91
|
+
</FormKit>
|
|
92
|
+
|
|
70
93
|
</l-page>
|
|
71
94
|
</template>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { reactive } from "vue"
|
|
3
|
+
import { reset } from "@formkit/core"
|
|
3
4
|
import { q, m, notify } from '../../../'
|
|
4
5
|
|
|
5
6
|
const obj = reactive(await q("my", ["username", "email", "first_name", "last_name"]))
|
|
@@ -18,16 +19,25 @@ const save = async () => {
|
|
|
18
19
|
} catch (e) {
|
|
19
20
|
notify(e.message, "red")
|
|
20
21
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
}
|
|
23
|
+
const onSubmit = async (data, form) => {
|
|
24
|
+
return await m("updateMy", {
|
|
25
|
+
data: {
|
|
26
|
+
email: data.email,
|
|
27
|
+
first_name: data.first_name,
|
|
28
|
+
last_name: data.last_name
|
|
29
|
+
}
|
|
30
|
+
}).then(() => {
|
|
31
|
+
notify("Your profile has been updated")
|
|
32
|
+
reset(form, data)
|
|
33
|
+
});
|
|
24
34
|
}
|
|
25
35
|
</script>
|
|
26
36
|
<template>
|
|
27
|
-
<l-form
|
|
28
|
-
<l-input label="Username"
|
|
29
|
-
<l-input label="Email"
|
|
30
|
-
<l-input label="First name"
|
|
31
|
-
<l-input label="Last name"
|
|
32
|
-
</
|
|
37
|
+
<FormKit type="l-form" :value="obj" :bordered="false" @submit="onSubmit">
|
|
38
|
+
<FormKit type="l-input" label="Username" name="username" readonly></FormKit>
|
|
39
|
+
<FormKit type="l-input" label="Email" name="email" validation="required|email"></FormKit>
|
|
40
|
+
<FormKit type="l-input" label="First name" name="first_name" validation="required"></FormKit>
|
|
41
|
+
<FormKit type="l-input" label="Last name" name="last_name"></FormKit>
|
|
42
|
+
</FormKit>
|
|
33
43
|
</template>
|
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import {
|
|
2
|
+
import { reset } from "@formkit/core"
|
|
3
3
|
import { q, m, notify } from '../../../'
|
|
4
|
-
const obj =
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
const obj = await q("my", ["phone", "addr1", "addr2", "addr3"])
|
|
5
|
+
const onSubmit = (data, form) => {
|
|
6
|
+
return m("updateMy", {
|
|
7
|
+
data: {
|
|
8
|
+
phone: data.phone,
|
|
9
|
+
addr1: data.addr1,
|
|
10
|
+
addr2: data.addr2,
|
|
11
|
+
addr3: data.addr3
|
|
12
|
+
}
|
|
13
|
+
}).then(() => {
|
|
10
14
|
notify("Your information has been updated")
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
notify(e.message, "red")
|
|
14
|
-
}
|
|
15
|
+
reset(form, data)
|
|
16
|
+
});
|
|
15
17
|
}
|
|
16
18
|
</script>
|
|
17
19
|
<template>
|
|
18
|
-
<l-form
|
|
19
|
-
<l-input label="Phone"
|
|
20
|
-
<l-input label="Address1"
|
|
21
|
-
<l-input label="Address2"
|
|
22
|
-
<l-input label="Address3"
|
|
23
|
-
|
|
24
|
-
</l-form>
|
|
20
|
+
<FormKit type="l-form" :value="obj" :bordered="false" @submit="onSubmit">
|
|
21
|
+
<FormKit type="l-input" label="Phone" name="phone"></FormKit>
|
|
22
|
+
<FormKit type="l-input" label="Address1" name="addr1"></FormKit>
|
|
23
|
+
<FormKit type="l-input" label="Address2" name="addr2"></FormKit>
|
|
24
|
+
<FormKit type="l-input" label="Address3" name="addr3"></FormKit>
|
|
25
|
+
</FormKit>
|
|
25
26
|
</template>
|