@hostlink/nuxt-light 1.0.4 → 1.0.6
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-banner.vue +43 -0
- package/dist/runtime/components/l-btn.vue +20 -20
- package/dist/runtime/components/l-card.vue +20 -14
- package/dist/runtime/components/l-checkbox.vue +11 -4
- package/dist/runtime/components/l-date-picker.vue +26 -37
- package/dist/runtime/components/l-input.vue +5 -8
- package/dist/runtime/components/l-login.vue +1 -1
- package/dist/runtime/components/l-select.vue +48 -35
- package/dist/runtime/components/l-table.vue +66 -86
- package/dist/runtime/formkit/Checkbox.vue +3 -8
- package/dist/runtime/formkit/DatePicker.vue +3 -4
- package/dist/runtime/formkit/File.vue +3 -5
- package/dist/runtime/formkit/FilePicker.vue +3 -5
- package/dist/runtime/formkit/Input.vue +27 -7
- package/dist/runtime/formkit/Select.vue +3 -6
- package/dist/runtime/formkit/TimePicker.vue +3 -5
- package/dist/runtime/formkit/index.mjs +1 -1
- package/dist/runtime/pages/User/index.vue +2 -0
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { type QBannerProps, type QBannerSlots } from 'quasar'
|
|
3
|
+
import { computed, useSlots } from 'vue'
|
|
4
|
+
|
|
5
|
+
export interface LBannerProps extends QBannerProps {
|
|
6
|
+
icon?: string
|
|
7
|
+
type?: 'primary' | 'secondary' | 'accent' | 'dark' | 'positive' | 'negative' | 'info' | 'warning'
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const props = withDefaults(defineProps<LBannerProps>(), {
|
|
11
|
+
rounded: true,
|
|
12
|
+
type: 'primary'
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const classes = computed(() => {
|
|
16
|
+
return [
|
|
17
|
+
`bg-${props.type}`,
|
|
18
|
+
'text-white'
|
|
19
|
+
]
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const localIcon = computed(() => {
|
|
23
|
+
if (props.icon) return props.icon
|
|
24
|
+
if (props.type === 'info') return 'sym_o_info'
|
|
25
|
+
if (props.type === 'warning') return 'sym_o_warning'
|
|
26
|
+
if (props.type === 'positive') return 'sym_o_check_circle_outline'
|
|
27
|
+
if (props.type === 'negative') return 'sym_o_error'
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const slots = computed(() => useSlots());
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<template>
|
|
34
|
+
<q-banner v-bind="props" :class="classes">
|
|
35
|
+
<template v-slot:avatar v-if="localIcon">
|
|
36
|
+
<q-icon :name="localIcon" />
|
|
37
|
+
</template>
|
|
38
|
+
|
|
39
|
+
<template v-for="(s, name) in slots" v-slot:[name]="props" :key="name">
|
|
40
|
+
<slot :name="name" v-bind="props ?? {}"></slot>
|
|
41
|
+
</template>
|
|
42
|
+
</q-banner>
|
|
43
|
+
</template>
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { type QBtnProps } from "quasar";
|
|
3
|
+
import { ref, computed } from "vue";
|
|
4
|
+
import { q, f, useLight } from '#imports';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const label = ref(props.label);
|
|
8
|
-
if (!label.value) {
|
|
9
|
-
label.value = "";
|
|
6
|
+
export interface LBtnProps extends QBtnProps {
|
|
7
|
+
permission?: string;
|
|
10
8
|
}
|
|
11
9
|
|
|
10
|
+
const props = defineProps<LBtnProps>();
|
|
11
|
+
|
|
12
12
|
const light = useLight();
|
|
13
13
|
|
|
14
14
|
const granted = ref(false);
|
|
@@ -22,22 +22,22 @@ if (props.permission) {
|
|
|
22
22
|
granted.value = true;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
25
|
+
const attrs = computed(() => {
|
|
26
|
+
return {
|
|
27
|
+
...{
|
|
28
|
+
rounded: light.getStyle("buttonRounded"),
|
|
29
|
+
outline: light.getStyle("buttonOutline"),
|
|
30
|
+
unelevated: light.getStyle("buttonUnelevated"),
|
|
31
|
+
dense: light.getStyle("buttonDense"),
|
|
32
|
+
},
|
|
33
|
+
...props,
|
|
34
|
+
}
|
|
35
|
+
});
|
|
35
36
|
|
|
36
37
|
|
|
37
38
|
</script>
|
|
38
39
|
<template>
|
|
39
|
-
<q-btn v-bind="attrs" color="primary" v-if="granted"
|
|
40
|
-
|
|
40
|
+
<q-btn v-bind="attrs" color="primary" v-if="granted">
|
|
41
41
|
<slot></slot>
|
|
42
42
|
</q-btn>
|
|
43
43
|
</template>
|
|
@@ -1,21 +1,27 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { useLight } from '
|
|
3
|
-
import {
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useLight } from '#imports'
|
|
3
|
+
import { ref, computed } from 'vue'
|
|
4
|
+
import { type QCardProps } from 'quasar';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
loading
|
|
7
|
-
title
|
|
8
|
-
}
|
|
6
|
+
export interface LCardProps extends QCardProps {
|
|
7
|
+
loading?: boolean;
|
|
8
|
+
title?: string;
|
|
9
|
+
}
|
|
9
10
|
|
|
10
11
|
const light = useLight();
|
|
12
|
+
const props = withDefaults(defineProps<LCardProps>(), {
|
|
13
|
+
flat: undefined,
|
|
14
|
+
bordered: undefined,
|
|
15
|
+
square: undefined,
|
|
16
|
+
});
|
|
11
17
|
|
|
12
|
-
const attrs = {
|
|
13
|
-
...
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
18
|
+
const attrs = computed(() => {
|
|
19
|
+
const a = { ...props };
|
|
20
|
+
if (props.flat === undefined) a.flat = light.getStyle("cardFlat");
|
|
21
|
+
if (props.bordered === undefined) a.bordered = light.getStyle("cardBordered");
|
|
22
|
+
if (props.square === undefined) a.square = light.getStyle("cardSquare");
|
|
23
|
+
return a;
|
|
24
|
+
});
|
|
19
25
|
|
|
20
26
|
const cl = computed(() => {
|
|
21
27
|
const c = ["text-white"];
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { computed } from "vue"
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from "vue"
|
|
3
|
+
import { type QCheckboxProps } from "quasar"
|
|
4
|
+
|
|
5
|
+
export interface LCheckboxProps extends QCheckboxProps {
|
|
6
|
+
}
|
|
3
7
|
|
|
4
8
|
const emit = defineEmits(["update:modelValue"]);
|
|
5
|
-
|
|
9
|
+
|
|
10
|
+
const props = defineProps<LCheckboxProps>()
|
|
6
11
|
|
|
7
12
|
const localValue = computed({
|
|
8
13
|
get: () => props.modelValue,
|
|
@@ -13,5 +18,7 @@ const localValue = computed({
|
|
|
13
18
|
});
|
|
14
19
|
</script>
|
|
15
20
|
<template>
|
|
16
|
-
<q-checkbox v-model="localValue" :label="$t(label)"
|
|
21
|
+
<q-checkbox v-bind="$props" v-model="localValue" :label="$t($props.label ?? '')">
|
|
22
|
+
<slot></slot>
|
|
23
|
+
</q-checkbox>
|
|
17
24
|
</template>
|
|
@@ -1,29 +1,17 @@
|
|
|
1
|
-
<script setup>
|
|
1
|
+
<script setup lang="ts">
|
|
2
2
|
import { ref, computed, useAttrs } from "vue";
|
|
3
|
-
import { useLight } from '
|
|
3
|
+
import { useLight } from '#imports';
|
|
4
4
|
|
|
5
|
+
import { type QDateProps } from "quasar";
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
export interface LDatePickerProps extends QDateProps {
|
|
8
|
+
label?: string
|
|
9
|
+
required?: boolean
|
|
10
|
+
}
|
|
7
11
|
|
|
8
|
-
const props = defineProps(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
required: false,
|
|
12
|
-
default: null
|
|
13
|
-
},
|
|
14
|
-
range: {
|
|
15
|
-
type: Boolean,
|
|
16
|
-
default: false
|
|
17
|
-
},
|
|
18
|
-
label: {
|
|
19
|
-
type: String,
|
|
20
|
-
default: ""
|
|
21
|
-
},
|
|
22
|
-
required: {
|
|
23
|
-
type: Boolean,
|
|
24
|
-
default: false
|
|
25
|
-
},
|
|
26
|
-
});
|
|
12
|
+
const props = defineProps<LDatePickerProps>()
|
|
13
|
+
|
|
14
|
+
const light = useLight();
|
|
27
15
|
|
|
28
16
|
const emit = defineEmits(["update:modelValue"]);
|
|
29
17
|
const popup = ref(null);
|
|
@@ -37,16 +25,19 @@ const localValue = computed({
|
|
|
37
25
|
return props.modelValue
|
|
38
26
|
},
|
|
39
27
|
set: (value) => {
|
|
40
|
-
popup.value
|
|
28
|
+
if (popup.value) {
|
|
29
|
+
popup.value.hide();
|
|
30
|
+
}
|
|
31
|
+
|
|
41
32
|
emit('update:modelValue', value)
|
|
42
33
|
}
|
|
43
34
|
|
|
44
35
|
});
|
|
45
36
|
|
|
46
|
-
const rules = [];
|
|
37
|
+
const rules: any = [];
|
|
47
38
|
|
|
48
39
|
if (props.required) {
|
|
49
|
-
rules.push((val) => {
|
|
40
|
+
rules.push((val: any) => {
|
|
50
41
|
if (!val) {
|
|
51
42
|
return "Required";
|
|
52
43
|
}
|
|
@@ -54,7 +45,7 @@ if (props.required) {
|
|
|
54
45
|
}
|
|
55
46
|
|
|
56
47
|
if (!props.range) {
|
|
57
|
-
rules.push((val) => {
|
|
48
|
+
rules.push((val: any) => {
|
|
58
49
|
//check val is YYYY-MM-DD
|
|
59
50
|
if (val) {
|
|
60
51
|
if (!val.match(/^\d{4}-\d{2}-\d{2}$/)) {
|
|
@@ -65,23 +56,21 @@ if (!props.range) {
|
|
|
65
56
|
}
|
|
66
57
|
|
|
67
58
|
const attrs = {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
stackLabel: light.getStyle("inputStackLabel")
|
|
76
|
-
},
|
|
77
|
-
...useAttrs(),
|
|
59
|
+
filled: light.getStyle("inputFilled"),
|
|
60
|
+
outlined: light.getStyle("inputOutlined"),
|
|
61
|
+
standout: light.getStyle("inputStandout"),
|
|
62
|
+
rounded: light.getStyle("inputRounded"),
|
|
63
|
+
dense: light.getStyle("inputDense"),
|
|
64
|
+
square: light.getStyle("inputSquare"),
|
|
65
|
+
stackLabel: light.getStyle("inputStackLabel")
|
|
78
66
|
}
|
|
79
67
|
|
|
80
68
|
const mask = props.range ? "####-##-## - ####-##-##" : "####-##-##";
|
|
81
69
|
|
|
82
70
|
</script>
|
|
83
71
|
<template>
|
|
84
|
-
<q-input v-bind="attrs" v-model="localValue" :rules="rules"
|
|
72
|
+
<q-input v-bind="attrs" :label="$t(props.label ?? '')" v-model="localValue" :rules="rules" hide-bottom-space
|
|
73
|
+
:mask="mask">
|
|
85
74
|
<template v-slot:prepend>
|
|
86
75
|
<q-btn icon="sym_o_event" round dense flat>
|
|
87
76
|
<q-popup-proxy cover transition-show="scale" transition-hide="scale" ref="popup">
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed, ref, useAttrs
|
|
2
|
+
import { computed, ref, useAttrs } from "vue";
|
|
3
3
|
import { useI18n } from 'vue-i18n';
|
|
4
4
|
import tc2sc from "../lib/tc2sc";
|
|
5
|
-
import { useLight } from '
|
|
5
|
+
import { useLight } from '#imports';
|
|
6
6
|
|
|
7
7
|
const i18n = useI18n();
|
|
8
8
|
const light = useLight();
|
|
@@ -165,10 +165,6 @@ const attrs = {
|
|
|
165
165
|
...useAttrs(),
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
const ss = Object.entries(useSlots()).map(([key, value]) => {
|
|
169
|
-
return key;
|
|
170
|
-
});
|
|
171
|
-
|
|
172
168
|
</script>
|
|
173
169
|
<template>
|
|
174
170
|
<q-input v-bind="attrs" :label="localLabel" v-model="localValue" :rules="new_rules" hide-bottom-space :type="localType">
|
|
@@ -184,10 +180,11 @@ const ss = Object.entries(useSlots()).map(([key, value]) => {
|
|
|
184
180
|
</q-btn>
|
|
185
181
|
</template>
|
|
186
182
|
|
|
187
|
-
<template v-for="s in
|
|
188
|
-
<slot :name="
|
|
183
|
+
<template v-for="(s, name) in $slots" v-slot:[name]="props" :key="name">
|
|
184
|
+
<slot :name="name" v-bind="props ?? {}"></slot>
|
|
189
185
|
</template>
|
|
190
186
|
|
|
187
|
+
|
|
191
188
|
<template v-if="localShowPassword" v-slot:append>
|
|
192
189
|
<q-icon name="sym_o_visibility" class="cursor-pointer" :color="showPassword ? 'primary' : 'grey-5'"
|
|
193
190
|
@click="isShowPassword = false" v-if="isShowPassword" />
|
|
@@ -180,7 +180,7 @@ onMounted(() => {
|
|
|
180
180
|
</script>
|
|
181
181
|
|
|
182
182
|
<template>
|
|
183
|
-
<q-card bordered flat style="min-width:360px
|
|
183
|
+
<q-card bordered flat style="min-width:360px" class="fixed-center">
|
|
184
184
|
<q-card-section>
|
|
185
185
|
<q-img :src="light.getCompanyLogo()" class="full-width">
|
|
186
186
|
<template v-slot:error>
|
|
@@ -1,31 +1,35 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { computed, ref
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, ref } from "vue";
|
|
3
3
|
import { useLight } from '../';
|
|
4
|
+
import { type QSelectProps } from "quasar";
|
|
5
|
+
|
|
6
|
+
const emits = defineEmits(["update:modelValue"]);
|
|
4
7
|
|
|
5
8
|
const light = useLight();
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
interface LSelectProps extends QSelectProps {
|
|
10
|
+
required?: boolean
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
const props = withDefaults(defineProps<LSelectProps>(), {
|
|
15
|
+
rules: () => {
|
|
16
|
+
return []
|
|
14
17
|
},
|
|
15
|
-
options: {
|
|
16
|
-
|
|
17
|
-
default: () => []
|
|
18
|
+
options: () => {
|
|
19
|
+
return []
|
|
18
20
|
},
|
|
19
|
-
optionLabel: {
|
|
20
|
-
|
|
21
|
-
default: "label"
|
|
21
|
+
optionLabel: () => {
|
|
22
|
+
return "label"
|
|
22
23
|
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
default: ""
|
|
24
|
+
emitValue: () => {
|
|
25
|
+
return true
|
|
26
26
|
},
|
|
27
|
+
mapOptions: () => {
|
|
28
|
+
return true
|
|
29
|
+
}
|
|
27
30
|
})
|
|
28
31
|
|
|
32
|
+
|
|
29
33
|
if (props.required) {
|
|
30
34
|
props.rules.push((val) => {
|
|
31
35
|
if (Number.isInteger(val)) {
|
|
@@ -49,31 +53,40 @@ const filterFn = (val, update, abort) => {
|
|
|
49
53
|
|
|
50
54
|
update(() => {
|
|
51
55
|
const needle = val.toLowerCase();
|
|
56
|
+
|
|
52
57
|
select_options.value = props.options.filter(v => v[props.optionLabel].toLowerCase().indexOf(needle) > -1);
|
|
53
58
|
})
|
|
54
59
|
}
|
|
55
60
|
|
|
56
|
-
|
|
57
|
-
|
|
58
61
|
const clearable = computed(() => {
|
|
59
62
|
return !props.required;
|
|
60
63
|
});
|
|
61
64
|
|
|
62
|
-
const attrs = {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
65
|
+
const attrs = computed(() => {
|
|
66
|
+
return {
|
|
67
|
+
...{
|
|
68
|
+
filled: light.getStyle("inputFilled"),
|
|
69
|
+
outlined: light.getStyle("inputOutlined"),
|
|
70
|
+
standout: light.getStyle("inputStandout"),
|
|
71
|
+
rounded: light.getStyle("inputRounded"),
|
|
72
|
+
dense: light.getStyle("inputDense"),
|
|
73
|
+
square: light.getStyle("inputSquare"),
|
|
74
|
+
stackLabel: light.getStyle("inputStackLabel")
|
|
75
|
+
},
|
|
76
|
+
...{
|
|
77
|
+
emitValue: props.emitValue,
|
|
78
|
+
mapOptions: props.mapOptions
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
const localValue = computed({
|
|
84
|
+
get: () => props.modelValue,
|
|
85
|
+
set: (value) => emits('update:modelValue', value)
|
|
86
|
+
});
|
|
74
87
|
|
|
75
88
|
</script>
|
|
76
89
|
<template>
|
|
77
|
-
<q-select v-bind="attrs" :label="$t(label)"
|
|
78
|
-
:option-label="optionLabel" hide-bottom-space :rules="rules" :clearable="clearable" />
|
|
90
|
+
<q-select v-bind="attrs" v-model="localValue" :label="$t(props.label ?? '')" :options="select_options"
|
|
91
|
+
@filter="filterFn" :option-label="optionLabel" hide-bottom-space :rules="rules" :clearable="clearable" />
|
|
79
92
|
</template>
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { useQuasar, QTable } from 'quasar';
|
|
2
|
+
import { useQuasar, QTable, type QTableColumn, type QTableProps } from 'quasar';
|
|
3
|
+
|
|
3
4
|
import { ref, computed, onMounted, useSlots, useAttrs } from "vue";
|
|
4
5
|
import { t, q, useLight, GQLFieldBuilder, model } from '../';
|
|
5
6
|
import { toQuery } from '@hostlink/light';
|
|
6
|
-
|
|
7
|
+
|
|
7
8
|
|
|
8
9
|
// extends QTableColumn
|
|
9
10
|
export interface LTableColumn extends QTableColumn {
|
|
@@ -17,66 +18,37 @@ export interface LTableColumn extends QTableColumn {
|
|
|
17
18
|
|
|
18
19
|
const errors = ref<InstanceType<any>>([]);
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
rows: {
|
|
42
|
-
type: Array
|
|
43
|
-
},
|
|
44
|
-
rowKey: {
|
|
45
|
-
type: String,
|
|
46
|
-
default: null
|
|
47
|
-
},
|
|
48
|
-
modelName: {
|
|
49
|
-
type: String,
|
|
50
|
-
default: null
|
|
51
|
-
},
|
|
52
|
-
selection: {
|
|
53
|
-
type: String,
|
|
54
|
-
default: "none"
|
|
55
|
-
},
|
|
56
|
-
rowsPerPageOptions: {
|
|
57
|
-
type: Array,
|
|
58
|
-
default: () => [3, 5, 7, 10, 15, 20, 25, 50, 0]
|
|
59
|
-
}, pagination: {
|
|
60
|
-
type: Object,
|
|
61
|
-
default: () => {
|
|
62
|
-
return {
|
|
63
|
-
sortBy: "",
|
|
64
|
-
descending: true,
|
|
65
|
-
page: 1,
|
|
66
|
-
rowsPerPage: 10,
|
|
67
|
-
}
|
|
21
|
+
export interface LTableProps extends QTableProps {
|
|
22
|
+
columns?: Array<LTableColumn>,
|
|
23
|
+
actions?: Array<string>,
|
|
24
|
+
sortBy?: string | null | undefined,
|
|
25
|
+
rowKey?: string,
|
|
26
|
+
modelName?: string | null | undefined,
|
|
27
|
+
searchable?: boolean | null | undefined,
|
|
28
|
+
selected?: Array<any>,
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const props = withDefaults(defineProps<LTableProps>(), {
|
|
32
|
+
actions: () => [],
|
|
33
|
+
rowsPerPageLabel: "Records per page:",
|
|
34
|
+
selection: "none",
|
|
35
|
+
rowsPerPageOptions: () => [3, 5, 7, 10, 15, 20, 25, 50, 0],
|
|
36
|
+
pagination: () => {
|
|
37
|
+
return {
|
|
38
|
+
sortBy: null,
|
|
39
|
+
descending: true,
|
|
40
|
+
page: 1,
|
|
41
|
+
rowsPerPage: 10,
|
|
68
42
|
}
|
|
69
43
|
},
|
|
70
|
-
fullscreen:
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
default: false
|
|
77
|
-
}
|
|
78
|
-
})
|
|
44
|
+
fullscreen: false,
|
|
45
|
+
searchable: false,
|
|
46
|
+
selected: () => [],
|
|
47
|
+
loadingLabel: "Loading...",
|
|
48
|
+
noDataLabel: "No data available",
|
|
49
|
+
});
|
|
79
50
|
|
|
51
|
+
const light = useLight();
|
|
80
52
|
|
|
81
53
|
const pagination = ref(props.pagination);
|
|
82
54
|
|
|
@@ -133,7 +105,8 @@ export interface LTableRequest {
|
|
|
133
105
|
}
|
|
134
106
|
|
|
135
107
|
const emits = defineEmits<{
|
|
136
|
-
request: [p: LTableRequest]
|
|
108
|
+
request: [p: LTableRequest],
|
|
109
|
+
"update:selected": [p: Array<any>]
|
|
137
110
|
}>()
|
|
138
111
|
|
|
139
112
|
const loading = ref(false);
|
|
@@ -181,8 +154,13 @@ const modelName = ref(props.modelName);
|
|
|
181
154
|
|
|
182
155
|
|
|
183
156
|
const validateData = () => {
|
|
157
|
+
if (primaryKey.value == null) return;
|
|
158
|
+
|
|
184
159
|
if (props.actions.includes("edit")) {
|
|
185
160
|
if (rows.value.length > 0) {
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
186
164
|
//get first row
|
|
187
165
|
let row = rows.value[0];
|
|
188
166
|
//check has primary key
|
|
@@ -416,6 +394,7 @@ const ss = Object.entries(slots).map(([key, value]) => {
|
|
|
416
394
|
|
|
417
395
|
const qua = useQuasar();
|
|
418
396
|
const onDelete = async (id: any) => {
|
|
397
|
+
if (modelName.value == null) return;
|
|
419
398
|
|
|
420
399
|
try {
|
|
421
400
|
await model(modelName.value).delete(id);
|
|
@@ -439,7 +418,14 @@ const attrs = {
|
|
|
439
418
|
bordered: light.getStyle("tableBorder"),
|
|
440
419
|
separator: light.getStyle("tableSeparator"),
|
|
441
420
|
},
|
|
442
|
-
...useAttrs()
|
|
421
|
+
...useAttrs(),
|
|
422
|
+
title: props.title,
|
|
423
|
+
loadingLabel: t(props.loadingLabel),
|
|
424
|
+
noDataLabel: t(props.noDataLabel),
|
|
425
|
+
rowsPerPageOptions: props.rowsPerPageOptions,
|
|
426
|
+
rowsPerPageLabel: t(props.rowsPerPageLabel),
|
|
427
|
+
selection: props.selection,
|
|
428
|
+
rowKey: props.rowKey,
|
|
443
429
|
}
|
|
444
430
|
|
|
445
431
|
const filter = ref('');
|
|
@@ -499,6 +485,16 @@ const getCellClass = (col: any, row: any) => {
|
|
|
499
485
|
return cl;
|
|
500
486
|
}
|
|
501
487
|
|
|
488
|
+
const localSelected = computed({
|
|
489
|
+
get() {
|
|
490
|
+
return props.selected;
|
|
491
|
+
},
|
|
492
|
+
set(val) {
|
|
493
|
+
console.log(val)
|
|
494
|
+
emits("update:selected", val);
|
|
495
|
+
}
|
|
496
|
+
});
|
|
497
|
+
|
|
502
498
|
</script>
|
|
503
499
|
|
|
504
500
|
|
|
@@ -509,33 +505,14 @@ const getCellClass = (col: any, row: any) => {
|
|
|
509
505
|
</div>
|
|
510
506
|
</template>
|
|
511
507
|
|
|
512
|
-
<
|
|
513
|
-
|
|
514
|
-
primaryKey:{{ primaryKey }}
|
|
515
|
-
modelName:{{ modelName }}
|
|
516
|
-
filters:{{ filters }}
|
|
517
|
-
pagination:{{ pagination }}
|
|
518
|
-
actionView:{{ actionView }}
|
|
519
|
-
actionDelete:{{ actionDelete }}
|
|
520
|
-
activeEdit:{{ activeEdit }}
|
|
521
|
-
attrs:{{ attrs }}
|
|
522
|
-
$attrs:{{ $attrs }}
|
|
523
|
-
</pre>
|
|
524
|
-
rows:{{ props.rows }}
|
|
525
|
-
</template>
|
|
526
|
-
|
|
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...')">
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
<!-- template v-for="s in ss" v-slot:[s]="props">
|
|
534
|
-
<slot :name="s" v-bind="props"></slot>
|
|
535
|
-
</template -->
|
|
508
|
+
<q-table v-bind="attrs" :loading="loading" :rows="rows" ref="table" @request="onRequest" :columns="columns"
|
|
509
|
+
v-model:pagination="pagination" :filter="filter" v-model:selected="localSelected">
|
|
536
510
|
|
|
537
511
|
<template #header="props">
|
|
538
512
|
<q-tr :props="props">
|
|
513
|
+
<q-td v-if="selection != 'none'" auto-width>
|
|
514
|
+
<q-checkbox v-model="props.selected" />
|
|
515
|
+
</q-td>
|
|
539
516
|
<q-th v-if="hasRowExpand" auto-width></q-th>
|
|
540
517
|
<q-th v-if="hasActions" auto-width></q-th>
|
|
541
518
|
<q-th v-for="col in props.cols" :key="col.name" :props="props">{{ col.label }}</q-th>
|
|
@@ -544,6 +521,9 @@ const getCellClass = (col: any, row: any) => {
|
|
|
544
521
|
|
|
545
522
|
<template #body="props">
|
|
546
523
|
<q-tr :props="props">
|
|
524
|
+
<q-td v-if="selection != 'none'" auto-width>
|
|
525
|
+
<q-checkbox v-model="props.selected" />
|
|
526
|
+
</q-td>
|
|
547
527
|
<q-td v-if="hasRowExpand" auto-width>
|
|
548
528
|
<q-btn :class="{ 'text-grey-8': !isDark }" flat round dense
|
|
549
529
|
:icon="props.expand ? 'sym_o_expand_more' : 'sym_o_expand_less'"
|
|
@@ -551,7 +531,7 @@ const getCellClass = (col: any, row: any) => {
|
|
|
551
531
|
</q-td>
|
|
552
532
|
|
|
553
533
|
<q-td v-if="hasActions" auto-width>
|
|
554
|
-
<div :class="{ 'text-grey-8': !isDark }">
|
|
534
|
+
<div :class="{ 'text-grey-8': !isDark }" v-if="primaryKey">
|
|
555
535
|
|
|
556
536
|
<l-view-btn v-if="actionView && props.row.canView"
|
|
557
537
|
:to="`/${modelName}/${props.row[primaryKey]}/view`" />
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { getErrorMessage } from 'formkit-quasar';
|
|
3
|
-
import { computed
|
|
3
|
+
import { computed } from 'vue'
|
|
4
4
|
const props = defineProps({
|
|
5
5
|
context: Object
|
|
6
6
|
});
|
|
@@ -10,18 +10,13 @@ const value = computed({
|
|
|
10
10
|
set: (val) => props.context.node.input(val)
|
|
11
11
|
})
|
|
12
12
|
|
|
13
|
-
const ss = Object.entries(useSlots()).map(([key, value]) => {
|
|
14
|
-
return key;
|
|
15
|
-
});
|
|
16
|
-
|
|
17
13
|
const { error, errorMessage } = getErrorMessage(props.context.node);
|
|
18
14
|
|
|
19
|
-
|
|
20
15
|
</script>
|
|
21
16
|
<template>
|
|
22
17
|
<l-checkbox v-model="value" :label="context.label" v-bind="context.attrs" :error="error" :error-message="errorMessage">
|
|
23
|
-
<template v-for="s in
|
|
24
|
-
<slot :name="
|
|
18
|
+
<template v-for="(s, name) in $slots" v-slot:[name]="props" :key="name">
|
|
19
|
+
<slot :name="name" v-bind="props ?? {}"></slot>
|
|
25
20
|
</template>
|
|
26
21
|
</l-checkbox>
|
|
27
22
|
</template>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed
|
|
2
|
+
import { computed } from 'vue'
|
|
3
3
|
import { getErrorMessage } from 'formkit-quasar';
|
|
4
4
|
|
|
5
5
|
const props = defineProps({
|
|
@@ -13,13 +13,12 @@ const value = computed({
|
|
|
13
13
|
set: (val) => props.context.node.input(val)
|
|
14
14
|
})
|
|
15
15
|
|
|
16
|
-
const ss = Object.entries(useSlots()).map(([key]) => key);
|
|
17
16
|
</script>
|
|
18
17
|
<template>
|
|
19
18
|
<l-date-picker v-model="value" :label="context.label" v-bind="context.attrs" :error="error" :type="context.inputType"
|
|
20
19
|
:error-message="errorMessage">
|
|
21
|
-
<template v-for="s in
|
|
22
|
-
<slot :name="
|
|
20
|
+
<template v-for="(s, name) in $slots" v-slot:[name]="props" :key="name">
|
|
21
|
+
<slot :name="name" v-bind="props ?? {}"></slot>
|
|
23
22
|
</template>
|
|
24
23
|
</l-date-picker>
|
|
25
24
|
</template>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed
|
|
2
|
+
import { computed } from 'vue'
|
|
3
3
|
import { getErrorMessage } from 'formkit-quasar';
|
|
4
4
|
import { useLight } from '#imports';
|
|
5
5
|
|
|
@@ -15,8 +15,6 @@ const value = computed({
|
|
|
15
15
|
set: (val) => props.context.node.input(val)
|
|
16
16
|
})
|
|
17
17
|
|
|
18
|
-
const ss = Object.entries(useSlots()).map(([key]) => key);
|
|
19
|
-
|
|
20
18
|
const onBlur = () => {
|
|
21
19
|
if (errorMessage.value) {
|
|
22
20
|
error.value = true
|
|
@@ -44,8 +42,8 @@ const attrs = {
|
|
|
44
42
|
<template>
|
|
45
43
|
<q-file v-model="value" :label="context.label" v-bind="attrs" :error="error" :error-message="errorMessage"
|
|
46
44
|
@blur="onBlur">
|
|
47
|
-
<template v-for="s in
|
|
48
|
-
<slot :name="
|
|
45
|
+
<template v-for="(s, name) in $slots" v-slot:[name]="props" :key="name">
|
|
46
|
+
<slot :name="name" v-bind="props ?? {}"></slot>
|
|
49
47
|
</template>
|
|
50
48
|
</q-file>
|
|
51
49
|
</template>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed
|
|
2
|
+
import { computed } from 'vue'
|
|
3
3
|
import { getErrorMessage } from 'formkit-quasar';
|
|
4
4
|
|
|
5
5
|
const props = defineProps({
|
|
@@ -13,8 +13,6 @@ const value = computed({
|
|
|
13
13
|
set: (val) => props.context.node.input(val)
|
|
14
14
|
})
|
|
15
15
|
|
|
16
|
-
const ss = Object.entries(useSlots()).map(([key]) => key);
|
|
17
|
-
|
|
18
16
|
const onBlur = () => {
|
|
19
17
|
if (errorMessage.value) {
|
|
20
18
|
error.value = true
|
|
@@ -26,8 +24,8 @@ const onBlur = () => {
|
|
|
26
24
|
<template>
|
|
27
25
|
<l-file v-model="value" :label="context.label" v-bind="context.attrs" :error="error" :type="context.inputType"
|
|
28
26
|
:error-message="errorMessage" @blur="onBlur">
|
|
29
|
-
<template v-for="s in
|
|
30
|
-
<slot :name="
|
|
27
|
+
<template v-for="(s, name) in $slots" v-slot:[name]="props" :key="name">
|
|
28
|
+
<slot :name="name" v-bind="props ?? {}"></slot>
|
|
31
29
|
</template>
|
|
32
30
|
</l-file>
|
|
33
31
|
</template>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed
|
|
2
|
+
import { computed } from 'vue'
|
|
3
3
|
import { getErrorMessage } from 'formkit-quasar';
|
|
4
4
|
|
|
5
5
|
const props = defineProps({
|
|
@@ -10,10 +10,30 @@ const { error, errorMessage } = getErrorMessage(props.context.node);
|
|
|
10
10
|
|
|
11
11
|
const value = computed({
|
|
12
12
|
get: () => props.context.value,
|
|
13
|
-
set: (val) =>
|
|
14
|
-
|
|
13
|
+
set: (val) => {
|
|
14
|
+
if (props.context.number !== undefined) {
|
|
15
|
+
if (val === "") {
|
|
16
|
+
props.context.node.input(0)
|
|
17
|
+
return
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
let tryprase = parseInt(val)
|
|
21
|
+
if (isNaN(tryprase)) {
|
|
22
|
+
props.context.node.input(val)
|
|
23
|
+
return
|
|
24
|
+
}
|
|
15
25
|
|
|
16
|
-
|
|
26
|
+
if (props.context.number === "integer") {
|
|
27
|
+
props.context.node.input(parseInt(val))
|
|
28
|
+
return
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
props.context.node.input(parseFloat(val))
|
|
32
|
+
} else {
|
|
33
|
+
props.context.node.input(val)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
})
|
|
17
37
|
|
|
18
38
|
const onBlur = () => {
|
|
19
39
|
if (errorMessage.value) {
|
|
@@ -23,13 +43,13 @@ const onBlur = () => {
|
|
|
23
43
|
}
|
|
24
44
|
}
|
|
25
45
|
|
|
26
|
-
|
|
27
46
|
</script>
|
|
28
47
|
<template>
|
|
29
48
|
<l-input v-model="value" :label="context.label" v-bind="context.attrs" :error="error" :type="context.inputType"
|
|
30
49
|
:error-message="errorMessage" @blur="onBlur">
|
|
31
|
-
|
|
32
|
-
|
|
50
|
+
|
|
51
|
+
<template v-for="(s, name) in $slots" v-slot:[name]="props" :key="name">
|
|
52
|
+
<slot :name="name" v-bind="props ?? {}"></slot>
|
|
33
53
|
</template>
|
|
34
54
|
</l-input>
|
|
35
55
|
</template>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { getErrorMessage } from 'formkit-quasar';
|
|
3
|
-
import { computed
|
|
3
|
+
import { computed } from 'vue'
|
|
4
4
|
const props = defineProps({
|
|
5
5
|
context: Object
|
|
6
6
|
});
|
|
@@ -12,9 +12,6 @@ const value = computed({
|
|
|
12
12
|
set: (val) => props.context.node.input(val)
|
|
13
13
|
})
|
|
14
14
|
|
|
15
|
-
const ss = Object.entries(useSlots()).map(([key, value]) => {
|
|
16
|
-
return key;
|
|
17
|
-
});
|
|
18
15
|
|
|
19
16
|
//check required in parsedRules
|
|
20
17
|
let required = false;
|
|
@@ -37,8 +34,8 @@ if (required) { //no clearable
|
|
|
37
34
|
<template>
|
|
38
35
|
<l-select v-model="value" :label="context.label" v-bind="context.attrs" :error="error" :error-message="errorMessage"
|
|
39
36
|
:clearable="clearable">
|
|
40
|
-
<template v-for="s in
|
|
41
|
-
<slot :name="
|
|
37
|
+
<template v-for="(s, name) in $slots" v-slot:[name]="props" :key="name">
|
|
38
|
+
<slot :name="name" v-bind="props ?? {}"></slot>
|
|
42
39
|
</template>
|
|
43
40
|
</l-select>
|
|
44
41
|
</template>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed
|
|
2
|
+
import { computed } from 'vue'
|
|
3
3
|
import { getErrorMessage } from 'formkit-quasar';
|
|
4
4
|
|
|
5
5
|
const props = defineProps({
|
|
@@ -12,14 +12,12 @@ const value = computed({
|
|
|
12
12
|
get: () => props.context.value,
|
|
13
13
|
set: (val) => props.context.node.input(val)
|
|
14
14
|
})
|
|
15
|
-
|
|
16
|
-
const ss = Object.entries(useSlots()).map(([key]) => key);
|
|
17
15
|
</script>
|
|
18
16
|
<template>
|
|
19
17
|
<l-time-picker v-model="value" :label="context.label" v-bind="context.attrs" :error="error" :type="context.inputType"
|
|
20
18
|
:error-message="errorMessage">
|
|
21
|
-
<template v-for="s in
|
|
22
|
-
<slot :name="
|
|
19
|
+
<template v-for="(s, name) in $slots" v-slot:[name]="props" :key="name">
|
|
20
|
+
<slot :name="name" v-bind="props ?? {}"></slot>
|
|
23
21
|
</template>
|
|
24
22
|
</l-time-picker>
|
|
25
23
|
</template>
|
|
@@ -7,11 +7,13 @@ const onRequest = async (request) => {
|
|
|
7
7
|
};
|
|
8
8
|
const columns = model("User").columns(["username", "first_name", "label_name", "email", "phone", "join_date", "status"]);
|
|
9
9
|
const status = ref("0");
|
|
10
|
+
const selected = ref([]);
|
|
10
11
|
</script>
|
|
11
12
|
|
|
12
13
|
<template>
|
|
13
14
|
<l-page>
|
|
14
15
|
|
|
16
|
+
|
|
15
17
|
<l-tabs v-model="status">
|
|
16
18
|
<l-tab label="Active" name="0">
|
|
17
19
|
<l-table row-key="user_id" @request="onRequest" :columns="columns"
|