@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
package/dist/module.json
CHANGED
|
@@ -1,30 +1 @@
|
|
|
1
|
-
body {
|
|
2
|
-
font-family: Noto Sans, Noto Sans HK, Noto Sans TC, -apple-system, Helvetica Neue, Helvetica, Arial, sans-serif;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
/* :root {
|
|
6
|
-
--color-primary: 115 103 240;
|
|
7
|
-
--color-secondary: 40 199 111;
|
|
8
|
-
--color-warning: 255 159 67;
|
|
9
|
-
--color-danger: 234 85 85;
|
|
10
|
-
--color-error: 245 108 108;
|
|
11
|
-
--color-info: 0 207 232;
|
|
12
|
-
}
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
.q-card__actions .q-btn--rectangle {
|
|
16
|
-
padding: 4px 16px;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
.q-table--dense .q-table td, .q-table--dense .q-table th{
|
|
21
|
-
padding: 2px 4px;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.q-table--dense .q-table td:first-child, .q-table--dense .q-table th:first-child{
|
|
25
|
-
padding: 2px 4px;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.q-tab-panel{
|
|
29
|
-
padding: 8px;
|
|
30
|
-
}
|
|
1
|
+
body{font-family:Noto Sans,Noto Sans HK,Noto Sans TC,-apple-system,Helvetica Neue,Helvetica,Arial,sans-serif}.q-card__actions .q-btn--rectangle{padding:4px 16px}.q-table--dense .q-table td,.q-table--dense .q-table td:first-child,.q-table--dense .q-table th,.q-table--dense .q-table th:first-child{padding:2px 4px}.q-tab-panel{padding:8px}
|
|
@@ -66,13 +66,13 @@ if (!props.range) {
|
|
|
66
66
|
|
|
67
67
|
const attrs = {
|
|
68
68
|
...{
|
|
69
|
-
filled: light.getStyle("inputFilled"
|
|
70
|
-
outlined: light.getStyle("inputOutlined"
|
|
71
|
-
standout: light.getStyle("inputStandout"
|
|
72
|
-
rounded: light.getStyle("inputRounded"
|
|
73
|
-
dense: light.getStyle("inputDense"
|
|
74
|
-
square: light.getStyle("inputSquare"
|
|
75
|
-
stackLabel: light.getStyle("inputStackLabel"
|
|
69
|
+
filled: light.getStyle("inputFilled"),
|
|
70
|
+
outlined: light.getStyle("inputOutlined"),
|
|
71
|
+
standout: light.getStyle("inputStandout"),
|
|
72
|
+
rounded: light.getStyle("inputRounded"),
|
|
73
|
+
dense: light.getStyle("inputDense"),
|
|
74
|
+
square: light.getStyle("inputSquare"),
|
|
75
|
+
stackLabel: light.getStyle("inputStackLabel")
|
|
76
76
|
},
|
|
77
77
|
...useAttrs(),
|
|
78
78
|
}
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
+
import { useLight, useAttrs } from '#imports';
|
|
2
3
|
const props = defineProps(['label']);
|
|
4
|
+
const light = useLight();
|
|
5
|
+
|
|
6
|
+
const attrs = {
|
|
7
|
+
...{
|
|
8
|
+
outlined: light.getStyle("inputOutlined"),
|
|
9
|
+
},
|
|
10
|
+
...useAttrs()
|
|
11
|
+
}
|
|
3
12
|
</script>
|
|
4
13
|
<template>
|
|
5
|
-
<q-field :label="$t(props.label ?? '')">
|
|
14
|
+
<q-field v-bind="attrs" :label="$t(props.label ?? '')">
|
|
6
15
|
<slot></slot>
|
|
7
16
|
</q-field>
|
|
8
17
|
</template>
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { ref, computed } from "vue";
|
|
2
|
+
import { ref, computed, useAttrs } from "vue";
|
|
3
|
+
import { useLight } from '../';
|
|
4
|
+
|
|
5
|
+
const light = useLight();
|
|
6
|
+
|
|
3
7
|
const props = defineProps({
|
|
4
8
|
modelValue: {
|
|
5
9
|
type: String
|
|
@@ -21,9 +25,22 @@ const localValue = computed({
|
|
|
21
25
|
set: (value) => emit("update:modelValue", value),
|
|
22
26
|
})
|
|
23
27
|
|
|
28
|
+
const attrs = {
|
|
29
|
+
|
|
30
|
+
...{
|
|
31
|
+
filled: light.getStyle("inputFilled"),
|
|
32
|
+
outlined: light.getStyle("inputOutlined"),
|
|
33
|
+
standout: light.getStyle("inputStandout"),
|
|
34
|
+
rounded: light.getStyle("inputRounded"),
|
|
35
|
+
dense: light.getStyle("inputDense"),
|
|
36
|
+
square: light.getStyle("inputSquare"),
|
|
37
|
+
stackLabel: light.getStyle("inputStackLabel")
|
|
38
|
+
},
|
|
39
|
+
...useAttrs(),
|
|
40
|
+
}
|
|
24
41
|
</script>
|
|
25
42
|
<template>
|
|
26
|
-
<q-input v-model="localValue">
|
|
43
|
+
<q-input v-bind="attrs" v-model="localValue">
|
|
27
44
|
<q-dialog v-model="show" full-height full-width>
|
|
28
45
|
<l-file-manager closable @close="show = false" @input="onInput"></l-file-manager>
|
|
29
46
|
</q-dialog>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed, ref, useAttrs } from "vue";
|
|
2
|
+
import { computed, ref, useAttrs, useSlots } from "vue";
|
|
3
3
|
import { useI18n } from 'vue-i18n';
|
|
4
4
|
import tc2sc from "../lib/tc2sc";
|
|
5
5
|
import { useLight } from '../';
|
|
@@ -154,22 +154,27 @@ const onClickTc2Sc = () => {
|
|
|
154
154
|
|
|
155
155
|
const attrs = {
|
|
156
156
|
...{
|
|
157
|
-
filled: light.getStyle("inputFilled"
|
|
158
|
-
outlined: light.getStyle("inputOutlined"
|
|
159
|
-
standout: light.getStyle("inputStandout"
|
|
160
|
-
rounded: light.getStyle("inputRounded"
|
|
161
|
-
dense: light.getStyle("inputDense"
|
|
162
|
-
square: light.getStyle("inputSquare"
|
|
163
|
-
stackLabel: light.getStyle("inputStackLabel"
|
|
157
|
+
filled: light.getStyle("inputFilled"),
|
|
158
|
+
outlined: light.getStyle("inputOutlined"),
|
|
159
|
+
standout: light.getStyle("inputStandout"),
|
|
160
|
+
rounded: light.getStyle("inputRounded"),
|
|
161
|
+
dense: light.getStyle("inputDense"),
|
|
162
|
+
square: light.getStyle("inputSquare"),
|
|
163
|
+
stackLabel: light.getStyle("inputStackLabel")
|
|
164
164
|
},
|
|
165
165
|
...useAttrs(),
|
|
166
166
|
}
|
|
167
|
+
|
|
168
|
+
const ss = Object.entries(useSlots()).map(([key, value]) => {
|
|
169
|
+
return key;
|
|
170
|
+
});
|
|
171
|
+
|
|
167
172
|
</script>
|
|
168
173
|
<template>
|
|
169
174
|
<q-input v-bind="attrs" :label="localLabel" v-model="localValue" :rules="new_rules" hide-bottom-space :type="localType">
|
|
170
175
|
<template v-if="translate" #prepend>
|
|
171
176
|
<q-btn icon="sym_o_translate" flat dense rounded>
|
|
172
|
-
<q-menu
|
|
177
|
+
<q-menu dense>
|
|
173
178
|
<q-list>
|
|
174
179
|
<q-item clickable v-close-popup @click="onClickTc2Sc">
|
|
175
180
|
<q-item-section>繁轉簡</q-item-section>
|
|
@@ -177,7 +182,10 @@ const attrs = {
|
|
|
177
182
|
</q-list>
|
|
178
183
|
</q-menu>
|
|
179
184
|
</q-btn>
|
|
185
|
+
</template>
|
|
180
186
|
|
|
187
|
+
<template v-for="s in ss" v-slot:[s]="props" :key="s">
|
|
188
|
+
<slot :name="s" v-bind="props ?? {}"></slot>
|
|
181
189
|
</template>
|
|
182
190
|
|
|
183
191
|
<template v-if="localShowPassword" v-slot:append>
|
|
@@ -186,9 +186,9 @@ onMounted(() => {
|
|
|
186
186
|
<q-form ref="form1">
|
|
187
187
|
<div class="q-gutter-sm">
|
|
188
188
|
<l-input v-model.trim="data.username" label="Username" :rules="[v => !!v || $t('Username is required')]"
|
|
189
|
-
clearable />
|
|
189
|
+
clearable :outlined="false" />
|
|
190
190
|
<l-input v-model="data.password" label="Password" type="password" clearable show-password
|
|
191
|
-
:rules="[v => !!v || $t('Password is required')]" @keydown.enter.prevent="submit" />
|
|
191
|
+
:rules="[v => !!v || $t('Password is required')]" @keydown.enter.prevent="submit" :outlined="false" />
|
|
192
192
|
<l-input v-if="twoFactorAuthentication" v-model="data.code" label="2FA code" required type="text" clearable>
|
|
193
193
|
</l-input>
|
|
194
194
|
</div>
|
|
@@ -27,17 +27,8 @@ defineExpose({
|
|
|
27
27
|
|
|
28
28
|
</script>
|
|
29
29
|
|
|
30
|
-
<style scoped>
|
|
31
|
-
.menu-list .q-item {
|
|
32
|
-
border-radius: 24px 24px 24px 24px;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.menu-list .q-router-link--exact-active {
|
|
36
|
-
background: linear-gradient(118deg,
|
|
37
|
-
var(--q-primary),
|
|
38
|
-
rgba(115, 103, 240, 0.7));
|
|
39
|
-
color: #fff;
|
|
40
|
-
}
|
|
30
|
+
<style scoped>
|
|
31
|
+
.menu-list .q-item{border-radius:24px 24px 24px 24px}.menu-list .q-router-link--exact-active{background:linear-gradient(118deg,var(--q-primary),rgba(115,103,240,.7));color:#fff}
|
|
41
32
|
</style>
|
|
42
33
|
<template>
|
|
43
34
|
<q-expansion-item v-if="value.children?.length > 0" :label="$t(value.label)" :icon="value.icon" :dense="dense"
|
|
@@ -61,13 +61,13 @@ const clearable = computed(() => {
|
|
|
61
61
|
|
|
62
62
|
const attrs = {
|
|
63
63
|
...{
|
|
64
|
-
filled: light.getStyle("inputFilled"
|
|
65
|
-
outlined: light.getStyle("inputOutlined"
|
|
66
|
-
standout: light.getStyle("inputStandout"
|
|
67
|
-
rounded: light.getStyle("inputRounded"
|
|
68
|
-
dense: light.getStyle("inputDense"
|
|
69
|
-
square: light.getStyle("inputSquare"
|
|
70
|
-
stackLabel: light.getStyle("inputStackLabel"
|
|
64
|
+
filled: light.getStyle("inputFilled"),
|
|
65
|
+
outlined: light.getStyle("inputOutlined"),
|
|
66
|
+
standout: light.getStyle("inputStandout"),
|
|
67
|
+
rounded: light.getStyle("inputRounded"),
|
|
68
|
+
dense: light.getStyle("inputDense"),
|
|
69
|
+
square: light.getStyle("inputSquare"),
|
|
70
|
+
stackLabel: light.getStyle("inputStackLabel")
|
|
71
71
|
},
|
|
72
72
|
...useAttrs(),
|
|
73
73
|
}
|
|
@@ -434,9 +434,10 @@ const onDelete = async (id: any) => {
|
|
|
434
434
|
|
|
435
435
|
const attrs = {
|
|
436
436
|
...{
|
|
437
|
-
dense: light.getStyle("tableDense"
|
|
438
|
-
flat: light.getStyle("tableFlat"
|
|
439
|
-
bordered: light.getStyle("tableBorder"
|
|
437
|
+
dense: light.getStyle("tableDense"),
|
|
438
|
+
flat: light.getStyle("tableFlat"),
|
|
439
|
+
bordered: light.getStyle("tableBorder"),
|
|
440
|
+
separator: light.getStyle("tableSeparator"),
|
|
440
441
|
},
|
|
441
442
|
...useAttrs()
|
|
442
443
|
}
|
|
@@ -523,13 +524,10 @@ const getCellClass = (col: any, row: any) => {
|
|
|
523
524
|
rows:{{ props.rows }}
|
|
524
525
|
</template>
|
|
525
526
|
|
|
526
|
-
<q-table
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
separator="cell" :rows-per-page-label="$t(props.rowsPerPageLabel)" :columns="columns"
|
|
531
|
-
:rows-per-page-options="rowsPerPageOptions" :selection="selection" v-model:pagination="pagination" :filter="filter"
|
|
532
|
-
:no-data-label="$t('No data available')" :loading-label="$t('Loading...')">
|
|
527
|
+
<q-table v-bind="attrs" :row-key="rowKey" :loading="loading" :rows="rows" ref="table" @request="onRequest"
|
|
528
|
+
:rows-per-page-label="$t(props.rowsPerPageLabel)" :columns="columns" :rows-per-page-options="rowsPerPageOptions"
|
|
529
|
+
:selection="selection" v-model:pagination="pagination" :filter="filter" :no-data-label="$t('No data available')"
|
|
530
|
+
:loading-label="$t('Loading...')">
|
|
533
531
|
|
|
534
532
|
|
|
535
533
|
<!-- template v-for="s in ss" v-slot:[s]="props">
|
|
@@ -620,25 +618,25 @@ const getCellClass = (col: any, row: any) => {
|
|
|
620
618
|
<template v-if="col.searchable">
|
|
621
619
|
|
|
622
620
|
<template v-if="col.searchType == 'number'">
|
|
623
|
-
<q-input dense clearable v-model.number="filters[col.name]"
|
|
624
|
-
@clear="onFilters" mask="##########"></q-input>
|
|
621
|
+
<q-input dense clearable filled square v-model.number="filters[col.name]"
|
|
622
|
+
@keydown.enter.prevent="onFilters" @clear="onFilters" mask="##########"></q-input>
|
|
625
623
|
</template>
|
|
626
624
|
|
|
627
625
|
<template v-if="col.searchType == 'select'">
|
|
628
|
-
<q-select dense v-model="filters[col.name]"
|
|
629
|
-
options-dense :options="col.searchOptions" emit-value
|
|
630
|
-
:multiple="col.searchMultiple" />
|
|
626
|
+
<q-select dense clearable filled square v-model="filters[col.name]"
|
|
627
|
+
@update:model-value="onFilters" options-dense :options="col.searchOptions" emit-value
|
|
628
|
+
map-options :multiple="col.searchMultiple" />
|
|
631
629
|
|
|
632
630
|
</template>
|
|
633
631
|
|
|
634
632
|
<template v-if="col.searchType == 'date'">
|
|
635
|
-
<l-date-picker hide-bottom-space
|
|
636
|
-
@update:model-value="onFilters"
|
|
633
|
+
<l-date-picker dense clearable filled square :outlined="false" hide-bottom-space
|
|
634
|
+
v-model="filters[col.name]" @update:model-value="onFilters" range @clear="onFilters" />
|
|
637
635
|
</template>
|
|
638
636
|
|
|
639
637
|
<template v-if="!col.searchType">
|
|
640
|
-
<q-input dense clearable v-model="filters[col.name]"
|
|
641
|
-
@clear="onFilters" enterkeyhint="search"></q-input>
|
|
638
|
+
<q-input dense clearable filled square v-model="filters[col.name]"
|
|
639
|
+
@keydown.enter.prevent="onFilters" @clear="onFilters" enterkeyhint="search"></q-input>
|
|
642
640
|
|
|
643
641
|
</template>
|
|
644
642
|
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed, ref } from "vue";
|
|
2
|
+
import { computed, ref, useAttrs } from "vue";
|
|
3
|
+
import { useLight } from '../';
|
|
4
|
+
const light = useLight();
|
|
5
|
+
|
|
3
6
|
const props = defineProps({
|
|
4
7
|
modelValue: {
|
|
5
8
|
type: [String, Object],
|
|
@@ -35,11 +38,23 @@ if (props.required) {
|
|
|
35
38
|
}
|
|
36
39
|
|
|
37
40
|
|
|
41
|
+
const attrs = {
|
|
42
|
+
...{
|
|
43
|
+
filled: light.getStyle("inputFilled"),
|
|
44
|
+
outlined: light.getStyle("inputOutlined"),
|
|
45
|
+
standout: light.getStyle("inputStandout"),
|
|
46
|
+
rounded: light.getStyle("inputRounded"),
|
|
47
|
+
dense: light.getStyle("inputDense"),
|
|
48
|
+
square: light.getStyle("inputSquare"),
|
|
49
|
+
stackLabel: light.getStyle("inputStackLabel")
|
|
50
|
+
},
|
|
51
|
+
...useAttrs(),
|
|
52
|
+
}
|
|
38
53
|
|
|
39
54
|
|
|
40
55
|
</script>
|
|
41
56
|
<template>
|
|
42
|
-
<q-input v-model="localValue" mask="time" :rules="rules" :label="$t(label)" :hint="$t(hint)">
|
|
57
|
+
<q-input v-bind="attrs" v-model="localValue" mask="time" :rules="rules" :label="$t(label)" :hint="$t(hint)">
|
|
43
58
|
<template v-slot:prepend>
|
|
44
59
|
<q-btn icon="sym_o_access_time" round dense flat>
|
|
45
60
|
<q-popup-proxy cover transition-show="scale" transition-hide="scale" ref="popup">
|
|
@@ -0,0 +1,27 @@
|
|
|
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 value = computed({
|
|
9
|
+
get: () => props.context.value,
|
|
10
|
+
set: (val) => props.context.node.input(val)
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
const ss = Object.entries(useSlots()).map(([key, value]) => {
|
|
14
|
+
return key;
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const { error, errorMessage } = getErrorMessage(props.context.node);
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
</script>
|
|
21
|
+
<template>
|
|
22
|
+
<l-checkbox v-model="value" :label="context.label" v-bind="context.attrs" :error="error" :error-message="errorMessage">
|
|
23
|
+
<template v-for="s in ss" v-slot:[s]="props" :key="s">
|
|
24
|
+
<slot :name="s" v-bind="props ?? {}"></slot>
|
|
25
|
+
</template>
|
|
26
|
+
</l-checkbox>
|
|
27
|
+
</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-date-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-date-picker>
|
|
25
|
+
</template>
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
|
|
18
|
+
const onBlur = () => {
|
|
19
|
+
if (errorMessage.value) {
|
|
20
|
+
error.value = true
|
|
21
|
+
} else {
|
|
22
|
+
error.value = false
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
</script>
|
|
26
|
+
<template>
|
|
27
|
+
<l-file v-model="value" :label="context.label" v-bind="context.attrs" :error="error" :type="context.inputType"
|
|
28
|
+
:error-message="errorMessage" @blur="onBlur">
|
|
29
|
+
<template v-for="s in ss" v-slot:[s]="props" :key="s">
|
|
30
|
+
<slot :name="s" v-bind="props ?? {}"></slot>
|
|
31
|
+
</template>
|
|
32
|
+
</l-file>
|
|
33
|
+
</template>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
import { useRouter, useRoute } from "vue-router";
|
|
4
|
+
import { Dialog } from "quasar";
|
|
5
|
+
import { model } from "@hostlink/light"
|
|
6
|
+
|
|
7
|
+
const route = useRoute();
|
|
8
|
+
const router = useRouter();
|
|
9
|
+
|
|
10
|
+
let props = defineProps({
|
|
11
|
+
context: Object
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
let onSubmit = async () => {
|
|
15
|
+
props.context.handlers.submit(new Event("submit"));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const gutter = props.gutter ?? "md";
|
|
19
|
+
|
|
20
|
+
//check bordered is undefined
|
|
21
|
+
let bordered = true;
|
|
22
|
+
if (props.context.bordered !== undefined) {
|
|
23
|
+
bordered = props.context.bordered;
|
|
24
|
+
}
|
|
25
|
+
const loading = ref(false);
|
|
26
|
+
if (!props.context.onSubmit) {
|
|
27
|
+
props.context.node.props.onSubmit = async function () {
|
|
28
|
+
loading.value = true;
|
|
29
|
+
const [module, id_name] = route.name.split("-");
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
if (route.params[id_name]) {//edit
|
|
33
|
+
if (await model(module).update(parseInt(route.params[id_name]), props.context.value)) {
|
|
34
|
+
router.go(-1);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
} else {
|
|
38
|
+
if (await model(module).add(props.context.value)) {
|
|
39
|
+
router.go(-1);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
} catch (e) {
|
|
44
|
+
Dialog.create({
|
|
45
|
+
title: "Error",
|
|
46
|
+
message: e.message,
|
|
47
|
+
ok: "OK"
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
loading.value = false;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
</script>
|
|
57
|
+
<template>
|
|
58
|
+
<form v-bind="context.attrs">
|
|
59
|
+
<l-card :bordered="bordered">
|
|
60
|
+
<q-card-section>
|
|
61
|
+
<div :class="`q-gutter-${gutter}`">
|
|
62
|
+
<slot v-bind="context"></slot>
|
|
63
|
+
</div>
|
|
64
|
+
</q-card-section>
|
|
65
|
+
|
|
66
|
+
<q-card-actions align="right">
|
|
67
|
+
<l-btn color="primary" icon="sym_o_check" label="Submit" @click="onSubmit" :disabled="!context.state.dirty"
|
|
68
|
+
:loading="loading"></l-btn>
|
|
69
|
+
</q-card-actions>
|
|
70
|
+
</l-card>
|
|
71
|
+
</form>
|
|
72
|
+
</template>
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
|
|
18
|
+
const onBlur = () => {
|
|
19
|
+
if (errorMessage.value) {
|
|
20
|
+
error.value = true
|
|
21
|
+
} else {
|
|
22
|
+
error.value = false
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
</script>
|
|
28
|
+
<template>
|
|
29
|
+
<l-input v-model="value" :label="context.label" v-bind="context.attrs" :error="error" :type="context.inputType"
|
|
30
|
+
:error-message="errorMessage" @blur="onBlur">
|
|
31
|
+
<template v-for="s in ss" v-slot:[s]="props" :key="s">
|
|
32
|
+
<slot :name="s" v-bind="props ?? {}"></slot>
|
|
33
|
+
</template>
|
|
34
|
+
</l-input>
|
|
35
|
+
</template>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } 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
|
+
</script>
|
|
17
|
+
<template>
|
|
18
|
+
<l-field label="Roles" stack-label :label="context.label" :error="error" :error-message="errorMessage">
|
|
19
|
+
<q-option-group type="checkbox" :options="context.options" v-model="value" inline v-bind="context.attrs">
|
|
20
|
+
</q-option-group>
|
|
21
|
+
</l-field>
|
|
22
|
+
</template>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } 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
|
+
</script>
|
|
17
|
+
<template>
|
|
18
|
+
<q-radio v-model="value" :label="context.label" v-bind="context.attrs" :error="error" :type="context.inputType"
|
|
19
|
+
:error-message="errorMessage">
|
|
20
|
+
<slot></slot>
|
|
21
|
+
</q-radio>
|
|
22
|
+
</template>
|