@hostlink/nuxt-light 1.0.5 → 1.0.7
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-file-manager.vue +22 -12
- package/dist/runtime/components/l-file-upload.vue +114 -0
- package/dist/runtime/components/l-file.vue +39 -20
- package/dist/runtime/components/l-input.vue +5 -8
- package/dist/runtime/components/l-select.vue +48 -35
- 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/FileUpload.vue +31 -0
- 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 +7 -1
- package/dist/runtime/pages/System/test.vue +5 -21
- 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">
|
|
@@ -343,19 +343,29 @@ const onUploadFiles = async () => {
|
|
|
343
343
|
message: "Uploading files...",
|
|
344
344
|
});
|
|
345
345
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
346
|
+
try {
|
|
347
|
+
for (let file of uploadFiles.value) {
|
|
348
|
+
|
|
349
|
+
await m("fsUploadFile", {
|
|
350
|
+
path: path.value,
|
|
351
|
+
file: new VariableType("file")
|
|
352
|
+
}, [{
|
|
353
|
+
__variables: {
|
|
354
|
+
file: {
|
|
355
|
+
type: "Upload!",
|
|
356
|
+
value: file
|
|
357
|
+
}
|
|
356
358
|
}
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
+
}]);
|
|
360
|
+
}
|
|
361
|
+
} catch (e) {
|
|
362
|
+
quasar.dialog({
|
|
363
|
+
title: "Error",
|
|
364
|
+
message: e.message,
|
|
365
|
+
});
|
|
366
|
+
|
|
367
|
+
return;
|
|
368
|
+
|
|
359
369
|
}
|
|
360
370
|
uploadFiles.value = [];
|
|
361
371
|
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { VariableType } from "json-to-graphql-query";
|
|
3
|
+
import { ref, computed, useAttrs } from "vue";
|
|
4
|
+
import { useLight, m } from '#imports';
|
|
5
|
+
import { Loading, Dialog } from "quasar";
|
|
6
|
+
|
|
7
|
+
const light = useLight();
|
|
8
|
+
|
|
9
|
+
export interface LFileProps {
|
|
10
|
+
modelValue?: string;
|
|
11
|
+
label?: string;
|
|
12
|
+
filled?: boolean;
|
|
13
|
+
outlined?: boolean;
|
|
14
|
+
standout?: boolean;
|
|
15
|
+
rounded?: boolean;
|
|
16
|
+
dense?: boolean;
|
|
17
|
+
square?: boolean;
|
|
18
|
+
stackLabel?: boolean;
|
|
19
|
+
path?: string;
|
|
20
|
+
accept?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const props = withDefaults(defineProps<LFileProps>(), {
|
|
24
|
+
filled: undefined,
|
|
25
|
+
outlined: undefined,
|
|
26
|
+
standout: undefined,
|
|
27
|
+
rounded: undefined,
|
|
28
|
+
dense: undefined,
|
|
29
|
+
square: undefined,
|
|
30
|
+
stackLabel: undefined,
|
|
31
|
+
path: "",
|
|
32
|
+
accept: "*",
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const emit = defineEmits(["update:modelValue"]);
|
|
36
|
+
|
|
37
|
+
const show = ref(false);
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
const localValue = computed({
|
|
41
|
+
get: () => props.modelValue,
|
|
42
|
+
set: (value) => emit("update:modelValue", value),
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
const attrs = computed(() => {
|
|
48
|
+
const a = { ...useAttrs, ...props };
|
|
49
|
+
if (props.filled === undefined) a.filled = light.getStyle("inputFilled");
|
|
50
|
+
if (props.outlined === undefined) a.outlined = light.getStyle("inputOutlined");
|
|
51
|
+
if (props.standout === undefined) a.standout = light.getStyle("inputStandout");
|
|
52
|
+
if (props.rounded === undefined) a.rounded = light.getStyle("inputRounded");
|
|
53
|
+
if (props.dense === undefined) a.dense = light.getStyle("inputDense");
|
|
54
|
+
if (props.square === undefined) a.square = light.getStyle("inputSquare");
|
|
55
|
+
if (props.stackLabel === undefined) a.stackLabel = light.getStyle("inputStackLabel");
|
|
56
|
+
return a;
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const uploadFile = ref(null);
|
|
60
|
+
|
|
61
|
+
const onUploadFile = async () => {
|
|
62
|
+
Loading.show({
|
|
63
|
+
message: "Uploading file...",
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
try {
|
|
67
|
+
localValue.value = await m("fsUploadFile", {
|
|
68
|
+
path: props.path,
|
|
69
|
+
file: new VariableType("file"),
|
|
70
|
+
rename: true
|
|
71
|
+
}, [{
|
|
72
|
+
__variables: {
|
|
73
|
+
file: {
|
|
74
|
+
type: "Upload!",
|
|
75
|
+
value: uploadFile.value
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}]);
|
|
79
|
+
Loading.hide();
|
|
80
|
+
|
|
81
|
+
show.value = false;
|
|
82
|
+
uploadFile.value = null;
|
|
83
|
+
return;
|
|
84
|
+
} catch (e: any) {
|
|
85
|
+
Dialog.create({
|
|
86
|
+
title: "Error",
|
|
87
|
+
message: e.message,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
Loading.hide();
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
</script>
|
|
96
|
+
<template>
|
|
97
|
+
<q-input v-bind="attrs" v-model="localValue" hide-bottom-space>
|
|
98
|
+
<q-dialog v-model="show" persistent transition-show="scale" transition-hide="scale">
|
|
99
|
+
<l-card style="width:300px">
|
|
100
|
+
<q-card-section>
|
|
101
|
+
<q-file ref="file" v-model="uploadFile" name="file" label="Files"></q-file>
|
|
102
|
+
</q-card-section>
|
|
103
|
+
|
|
104
|
+
<q-card-actions align="right">
|
|
105
|
+
<q-btn flat label="Cancel" color="primary" v-close-popup></q-btn>
|
|
106
|
+
<q-btn flat label="Upload" color="primary" @click="onUploadFile"></q-btn>
|
|
107
|
+
</q-card-actions>
|
|
108
|
+
</l-card>
|
|
109
|
+
</q-dialog>
|
|
110
|
+
<template v-slot:prepend>
|
|
111
|
+
<q-btn dense flat round icon="sym_o_file_upload" @click="show = true"></q-btn>
|
|
112
|
+
</template>
|
|
113
|
+
</q-input>
|
|
114
|
+
</template>
|
|
@@ -1,20 +1,36 @@
|
|
|
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
5
|
const light = useLight();
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
modelValue
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
export interface LFileProps {
|
|
8
|
+
modelValue?: string;
|
|
9
|
+
label?: string;
|
|
10
|
+
filled?: boolean;
|
|
11
|
+
outlined?: boolean;
|
|
12
|
+
standout?: boolean;
|
|
13
|
+
rounded?: boolean;
|
|
14
|
+
dense?: boolean;
|
|
15
|
+
square?: boolean;
|
|
16
|
+
stackLabel?: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const props = withDefaults(defineProps<LFileProps>(), {
|
|
20
|
+
filled: undefined,
|
|
21
|
+
outlined: undefined,
|
|
22
|
+
standout: undefined,
|
|
23
|
+
rounded: undefined,
|
|
24
|
+
dense: undefined,
|
|
25
|
+
square: undefined,
|
|
26
|
+
stackLabel: undefined,
|
|
11
27
|
});
|
|
12
28
|
|
|
13
29
|
const emit = defineEmits(["update:modelValue"]);
|
|
14
30
|
|
|
15
31
|
const show = ref(false);
|
|
16
32
|
|
|
17
|
-
const onInput = (value) => {
|
|
33
|
+
const onInput = (value: string) => {
|
|
18
34
|
localValue.value = value;
|
|
19
35
|
show.value = false;
|
|
20
36
|
|
|
@@ -25,19 +41,22 @@ const localValue = computed({
|
|
|
25
41
|
set: (value) => emit("update:modelValue", value),
|
|
26
42
|
})
|
|
27
43
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
const attrs = computed(() => {
|
|
47
|
+
const a = { ...useAttrs, ...props };
|
|
48
|
+
if (props.filled === undefined) a.filled = light.getStyle("inputFilled");
|
|
49
|
+
if (props.outlined === undefined) a.outlined = light.getStyle("inputOutlined");
|
|
50
|
+
if (props.standout === undefined) a.standout = light.getStyle("inputStandout");
|
|
51
|
+
if (props.rounded === undefined) a.rounded = light.getStyle("inputRounded");
|
|
52
|
+
if (props.dense === undefined) a.dense = light.getStyle("inputDense");
|
|
53
|
+
if (props.square === undefined) a.square = light.getStyle("inputSquare");
|
|
54
|
+
if (props.stackLabel === undefined) a.stackLabel = light.getStyle("inputStackLabel");
|
|
55
|
+
return a;
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
41
60
|
</script>
|
|
42
61
|
<template>
|
|
43
62
|
<q-input v-bind="attrs" v-model="localValue" hide-bottom-space>
|
|
@@ -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" />
|
|
@@ -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,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>
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
const onBlur = () => {
|
|
17
|
+
if (errorMessage.value) {
|
|
18
|
+
error.value = true
|
|
19
|
+
} else {
|
|
20
|
+
error.value = false
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
</script>
|
|
24
|
+
<template>
|
|
25
|
+
<l-file-upload v-model="value" :label="context.label" v-bind="context.attrs" :error="error" :type="context.inputType"
|
|
26
|
+
:error-message="errorMessage" @blur="onBlur">
|
|
27
|
+
<template v-for="(s, name) in $slots" v-slot:[name]="props" :key="name">
|
|
28
|
+
<slot :name="name" v-bind="props ?? {}"></slot>
|
|
29
|
+
</template>
|
|
30
|
+
</l-file-upload>
|
|
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>
|
|
@@ -11,10 +11,16 @@ import OptionGroupVue from "./OptionGroup.vue";
|
|
|
11
11
|
import FilePickerVue from "./FilePicker.vue";
|
|
12
12
|
import FileVue from "./File.vue";
|
|
13
13
|
import InputXlsxVue from "./InputXlsx.vue";
|
|
14
|
+
import FileUploadVue from "./FileUpload.vue";
|
|
14
15
|
export const createLightPlugin = () => {
|
|
15
16
|
return (node) => {
|
|
16
17
|
let type = node.props.type + "";
|
|
17
18
|
switch (type) {
|
|
19
|
+
case "l-file-upload":
|
|
20
|
+
return node.define({
|
|
21
|
+
type: "input",
|
|
22
|
+
component: FileUploadVue
|
|
23
|
+
});
|
|
18
24
|
case "l-input-xlsx":
|
|
19
25
|
return node.define({
|
|
20
26
|
type: "input",
|
|
@@ -58,7 +64,7 @@ export const createLightPlugin = () => {
|
|
|
58
64
|
case "l-input":
|
|
59
65
|
return node.define({
|
|
60
66
|
type: "input",
|
|
61
|
-
props: ["inputType"],
|
|
67
|
+
props: ["inputType", "number"],
|
|
62
68
|
component: Input
|
|
63
69
|
});
|
|
64
70
|
case "l-select":
|
|
@@ -1,29 +1,13 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { reactive } from 'vue'
|
|
3
|
-
import { m } from "../../"
|
|
4
|
-
const obj = reactive({
|
|
5
|
-
input1: 'test',
|
|
6
|
-
editor: 'test',
|
|
7
|
-
})
|
|
8
|
-
const onSave = async () => {
|
|
9
|
-
console.log(obj)
|
|
10
|
-
|
|
11
|
-
await m("testSystem", {
|
|
12
|
-
data: obj
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
}
|
|
16
2
|
|
|
17
3
|
</script>
|
|
18
4
|
<template>
|
|
19
5
|
<l-page>
|
|
20
|
-
{{ obj }}
|
|
21
|
-
<l-form v-model="obj">
|
|
22
|
-
<l-input v-model="obj.input1" label="Input1" />
|
|
23
|
-
<q-file v-model="obj.file" label="File" accept=".txt" />
|
|
24
|
-
|
|
25
|
-
<q-editor v-model="obj.editor" />
|
|
26
6
|
|
|
27
|
-
|
|
7
|
+
<l-card title="Test">
|
|
8
|
+
<q-card-section>
|
|
9
|
+
</q-card-section>
|
|
10
|
+
</l-card>
|
|
11
|
+
|
|
28
12
|
</l-page>
|
|
29
13
|
</template>
|