@hostlink/nuxt-light 1.67.6 → 1.67.8
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/module.mjs +13 -8
- package/dist/runtime/components/L/Table.vue +2 -5
- package/dist/runtime/components/L/TimePicker.d.vue.ts +0 -2
- package/dist/runtime/components/L/TimePicker.vue +0 -4
- package/dist/runtime/components/L/TimePicker.vue.d.ts +0 -2
- package/dist/runtime/formkit/Checkbox.vue +4 -2
- package/dist/runtime/formkit/DatePicker.vue +15 -4
- package/dist/runtime/formkit/Editor.vue +7 -3
- package/dist/runtime/formkit/File.vue +7 -3
- package/dist/runtime/formkit/FilePicker.vue +3 -1
- package/dist/runtime/formkit/FileUpload.vue +7 -3
- package/dist/runtime/formkit/GroupSelect.vue +7 -3
- package/dist/runtime/formkit/Input.vue +2 -7
- package/dist/runtime/formkit/InputSelect.vue +6 -9
- package/dist/runtime/formkit/InputXlsx.vue +7 -3
- package/dist/runtime/formkit/OptionGroup.vue +7 -3
- package/dist/runtime/formkit/Radio.vue +4 -2
- package/dist/runtime/formkit/Select.vue +7 -3
- package/dist/runtime/formkit/Textarea.vue +6 -9
- package/dist/runtime/formkit/TimePicker.vue +15 -4
- package/dist/runtime/formkit/Toggle.vue +3 -1
- package/dist/runtime/formkit/useRequiredLabel.d.ts +1 -0
- package/dist/runtime/formkit/useRequiredLabel.js +10 -0
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -334,16 +334,21 @@ const module$1 = defineNuxtModule({
|
|
|
334
334
|
}, */
|
|
335
335
|
async setup(options, nuxt) {
|
|
336
336
|
const resolver = createResolver(import.meta.url);
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
337
|
+
const runtimeConfig = nuxt.options.runtimeConfig ?? {};
|
|
338
|
+
runtimeConfig.public = runtimeConfig.public ?? {};
|
|
339
|
+
const existingLight = runtimeConfig.public.light;
|
|
340
|
+
runtimeConfig.public = {
|
|
341
|
+
...runtimeConfig.public,
|
|
342
|
+
light: {
|
|
343
|
+
...existingLight,
|
|
344
|
+
tableActionIcons: {
|
|
345
|
+
view: options.tableActionIcons?.view,
|
|
346
|
+
edit: options.tableActionIcons?.edit,
|
|
347
|
+
delete: options.tableActionIcons?.delete
|
|
348
|
+
}
|
|
345
349
|
}
|
|
346
350
|
};
|
|
351
|
+
nuxt.options.runtimeConfig = runtimeConfig;
|
|
347
352
|
extendPages((pages) => {
|
|
348
353
|
for (const route of routes) {
|
|
349
354
|
if (route.children) {
|
|
@@ -597,17 +597,14 @@ const hasFilters = computed(() => {
|
|
|
597
597
|
|
|
598
598
|
<l-action-btn v-if="actionView && props.row.canView"
|
|
599
599
|
:to="`/${modelName}/${props.row[primaryKey]}/view`"
|
|
600
|
-
:icon="light.styles.table.actionIcons.view"
|
|
601
|
-
:tooltip="$t('View')" />
|
|
600
|
+
:icon="light.styles.table.actionIcons.view" />
|
|
602
601
|
|
|
603
602
|
<l-action-btn v-if="activeEdit && props.row.canUpdate"
|
|
604
603
|
:to="`/${modelName}/${props.row[primaryKey]}/edit`"
|
|
605
|
-
:icon="light.styles.table.actionIcons.edit"
|
|
606
|
-
:tooltip="$t('Edit')" />
|
|
604
|
+
:icon="light.styles.table.actionIcons.edit" />
|
|
607
605
|
|
|
608
606
|
<l-delete-btn v-if="actionDelete && props.row.canDelete"
|
|
609
607
|
:icon="light.styles.table.actionIcons.delete"
|
|
610
|
-
:tooltip="$t('Delete')"
|
|
611
608
|
@submit="onDelete(props.row[primaryKey])" size="sm" />
|
|
612
609
|
|
|
613
610
|
<slot name="actions" v-bind="props"></slot>
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export interface LTimePickerProps {
|
|
2
2
|
modelValue?: any;
|
|
3
|
-
required?: boolean;
|
|
4
3
|
label?: string;
|
|
5
4
|
hint?: string;
|
|
6
5
|
nowBtn?: boolean;
|
|
@@ -27,7 +26,6 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
27
26
|
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
28
27
|
}>, {
|
|
29
28
|
format24h: boolean;
|
|
30
|
-
required: boolean;
|
|
31
29
|
hideBottomSpace: boolean;
|
|
32
30
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
33
31
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -7,7 +7,6 @@ const { t } = useI18n();
|
|
|
7
7
|
const modelValue = defineModel({ type: null });
|
|
8
8
|
const props = defineProps({
|
|
9
9
|
modelValue: { type: null, required: false },
|
|
10
|
-
required: { type: Boolean, required: false, default: false },
|
|
11
10
|
label: { type: String, required: false },
|
|
12
11
|
hint: { type: String, required: false },
|
|
13
12
|
nowBtn: { type: Boolean, required: false },
|
|
@@ -30,9 +29,6 @@ const inputProps = computed(() => ({
|
|
|
30
29
|
}));
|
|
31
30
|
const rules = computed(() => {
|
|
32
31
|
const r = [];
|
|
33
|
-
if (props.required) {
|
|
34
|
-
r.push((v) => !!v || t("This field is required"));
|
|
35
|
-
}
|
|
36
32
|
r.push((v) => {
|
|
37
33
|
if (!v) return true;
|
|
38
34
|
const parts = v.split(":");
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export interface LTimePickerProps {
|
|
2
2
|
modelValue?: any;
|
|
3
|
-
required?: boolean;
|
|
4
3
|
label?: string;
|
|
5
4
|
hint?: string;
|
|
6
5
|
nowBtn?: boolean;
|
|
@@ -27,7 +26,6 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
27
26
|
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
28
27
|
}>, {
|
|
29
28
|
format24h: boolean;
|
|
30
|
-
required: boolean;
|
|
31
29
|
hideBottomSpace: boolean;
|
|
32
30
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
33
31
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { useErrorMessage } from "./useErrorMessage";
|
|
3
|
-
import { computed } from "vue";
|
|
3
|
+
import { computed, ref } from "vue";
|
|
4
4
|
const props = defineProps({
|
|
5
5
|
context: Object
|
|
6
6
|
});
|
|
@@ -8,7 +8,9 @@ const value = computed({
|
|
|
8
8
|
get: () => props.context.value,
|
|
9
9
|
set: (val) => props.context.node.input(val)
|
|
10
10
|
});
|
|
11
|
-
const
|
|
11
|
+
const error = ref(false);
|
|
12
|
+
const errorMessage = ref("");
|
|
13
|
+
useErrorMessage(props.context.node, error, errorMessage);
|
|
12
14
|
</script>
|
|
13
15
|
|
|
14
16
|
<template>
|
|
@@ -1,19 +1,30 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed } from "vue";
|
|
2
|
+
import { computed, ref } from "vue";
|
|
3
3
|
import { useErrorMessage } from "./useErrorMessage";
|
|
4
|
+
import { useRequiredLabel } from "./useRequiredLabel";
|
|
4
5
|
const props = defineProps({
|
|
5
6
|
context: Object
|
|
6
7
|
});
|
|
7
|
-
const
|
|
8
|
+
const error = ref(false);
|
|
9
|
+
const errorMessage = ref("");
|
|
10
|
+
useErrorMessage(props.context.node, error, errorMessage);
|
|
11
|
+
const label = useRequiredLabel(props.context);
|
|
8
12
|
const value = computed({
|
|
9
13
|
get: () => props.context.value,
|
|
10
14
|
set: (val) => props.context.node.input(val)
|
|
11
15
|
});
|
|
16
|
+
const onBlur = () => {
|
|
17
|
+
if (errorMessage.value) {
|
|
18
|
+
error.value = true;
|
|
19
|
+
} else {
|
|
20
|
+
error.value = false;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
12
23
|
</script>
|
|
13
24
|
|
|
14
25
|
<template>
|
|
15
|
-
<l-date-picker v-model="value" v-bind="context.attrs" :label="
|
|
16
|
-
:type="context.inputType" :error-message="errorMessage" :disable="context.disabled">
|
|
26
|
+
<l-date-picker v-model="value" v-bind="context.attrs" :label="label" :error="error"
|
|
27
|
+
:type="context.inputType" :error-message="errorMessage" :disable="context.disabled" @blur="onBlur">
|
|
17
28
|
<template v-for="(s, name) in $slots" v-slot:[name]="props" :key="name">
|
|
18
29
|
<slot :name="name" v-bind="props ?? {}"></slot>
|
|
19
30
|
</template>
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed } from "vue";
|
|
2
|
+
import { computed, ref } from "vue";
|
|
3
3
|
import { useErrorMessage } from "./useErrorMessage";
|
|
4
|
+
import { useRequiredLabel } from "./useRequiredLabel";
|
|
4
5
|
const props = defineProps({
|
|
5
6
|
context: Object
|
|
6
7
|
});
|
|
7
|
-
const
|
|
8
|
+
const error = ref(false);
|
|
9
|
+
const errorMessage = ref("");
|
|
10
|
+
useErrorMessage(props.context.node, error, errorMessage);
|
|
11
|
+
const label = useRequiredLabel(props.context);
|
|
8
12
|
const value = computed({
|
|
9
13
|
get: () => props.context.value,
|
|
10
14
|
set: (val) => props.context.node.input(val)
|
|
@@ -12,7 +16,7 @@ const value = computed({
|
|
|
12
16
|
</script>
|
|
13
17
|
|
|
14
18
|
<template>
|
|
15
|
-
<l-editor v-model="value" :label="
|
|
19
|
+
<l-editor v-model="value" :label="label" v-bind="context.attrs" :error="error" :type="context.inputType"
|
|
16
20
|
:error-message="errorMessage">
|
|
17
21
|
<slot></slot>
|
|
18
22
|
<!-- <template v-for="(s, name) in $slots" v-slot:[name]="props" :key="name">
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed } from "vue";
|
|
2
|
+
import { computed, ref } from "vue";
|
|
3
3
|
import { useErrorMessage } from "./useErrorMessage";
|
|
4
|
+
import { useRequiredLabel } from "./useRequiredLabel";
|
|
4
5
|
import { useLight } from "#imports";
|
|
5
6
|
const props = defineProps({
|
|
6
7
|
context: Object
|
|
7
8
|
});
|
|
8
|
-
const
|
|
9
|
+
const error = ref(false);
|
|
10
|
+
const errorMessage = ref("");
|
|
11
|
+
useErrorMessage(props.context.node, error, errorMessage);
|
|
12
|
+
const label = useRequiredLabel(props.context);
|
|
9
13
|
const value = computed({
|
|
10
14
|
get: () => props.context.value,
|
|
11
15
|
set: (val) => props.context.node.input(val)
|
|
@@ -27,7 +31,7 @@ const attrs = computed(() => {
|
|
|
27
31
|
</script>
|
|
28
32
|
|
|
29
33
|
<template>
|
|
30
|
-
<q-file v-model="value" :label="
|
|
34
|
+
<q-file v-model="value" :label="label" v-bind="attrs" :error="error" :error-message="errorMessage"
|
|
31
35
|
@blur="onBlur" hide-bottom-space>
|
|
32
36
|
<template v-for="(s, name) in $slots" v-slot:[name]="props" :key="name">
|
|
33
37
|
<slot :name="name" v-bind="props ?? {}"></slot>
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed, ref } from "vue";
|
|
3
3
|
import { useErrorMessage } from "./useErrorMessage";
|
|
4
|
+
import { useRequiredLabel } from "./useRequiredLabel";
|
|
4
5
|
const props = defineProps({
|
|
5
6
|
context: Object
|
|
6
7
|
});
|
|
7
8
|
const error = ref(false);
|
|
8
9
|
const errorMessage = ref("");
|
|
9
10
|
useErrorMessage(props.context.node, error, errorMessage);
|
|
11
|
+
const label = useRequiredLabel(props.context);
|
|
10
12
|
const value = computed({
|
|
11
13
|
get: () => props.context.value,
|
|
12
14
|
set: (val) => props.context.node.input(val)
|
|
@@ -21,7 +23,7 @@ const onBlur = () => {
|
|
|
21
23
|
</script>
|
|
22
24
|
|
|
23
25
|
<template>
|
|
24
|
-
<l-file v-model="value" :label="
|
|
26
|
+
<l-file v-model="value" :label="label" v-bind="context.attrs" :error="error" :type="context.inputType"
|
|
25
27
|
:error-message="errorMessage" @blur="onBlur">
|
|
26
28
|
<template v-for="(s, name) in $slots" v-slot:[name]="props" :key="name">
|
|
27
29
|
<slot :name="name" v-bind="props ?? {}"></slot>
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed } from "vue";
|
|
2
|
+
import { computed, ref } from "vue";
|
|
3
3
|
import { useErrorMessage } from "./useErrorMessage";
|
|
4
|
+
import { useRequiredLabel } from "./useRequiredLabel";
|
|
4
5
|
const props = defineProps({
|
|
5
6
|
context: Object
|
|
6
7
|
});
|
|
7
|
-
const
|
|
8
|
+
const error = ref(false);
|
|
9
|
+
const errorMessage = ref("");
|
|
10
|
+
useErrorMessage(props.context.node, error, errorMessage);
|
|
11
|
+
const label = useRequiredLabel(props.context);
|
|
8
12
|
const value = computed({
|
|
9
13
|
get: () => props.context.value,
|
|
10
14
|
set: (val) => props.context.node.input(val)
|
|
@@ -19,7 +23,7 @@ const onBlur = () => {
|
|
|
19
23
|
</script>
|
|
20
24
|
|
|
21
25
|
<template>
|
|
22
|
-
<l-file-upload v-bind="context.attrs" v-model="value" :label="
|
|
26
|
+
<l-file-upload v-bind="context.attrs" v-model="value" :label="label" :error="error" :type="context.inputType"
|
|
23
27
|
:error-message="errorMessage" @blur="onBlur">
|
|
24
28
|
<template v-for="(s, name) in $slots" v-slot:[name]="props" :key="name">
|
|
25
29
|
<slot :name="name" v-bind="props ?? {}"></slot>
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { useErrorMessage } from "./useErrorMessage";
|
|
3
|
-
import {
|
|
3
|
+
import { useRequiredLabel } from "./useRequiredLabel";
|
|
4
|
+
import { computed, ref } from "vue";
|
|
4
5
|
const props = defineProps({
|
|
5
6
|
context: Object
|
|
6
7
|
});
|
|
7
|
-
const
|
|
8
|
+
const error = ref(false);
|
|
9
|
+
const errorMessage = ref("");
|
|
10
|
+
useErrorMessage(props.context.node, error, errorMessage);
|
|
11
|
+
const label = useRequiredLabel(props.context);
|
|
8
12
|
const value = computed({
|
|
9
13
|
get: () => props.context.value,
|
|
10
14
|
set: (val) => props.context.node.input(val)
|
|
@@ -18,7 +22,7 @@ if (props.context.state.required) {
|
|
|
18
22
|
</script>
|
|
19
23
|
|
|
20
24
|
<template>
|
|
21
|
-
<l-group-select v-model="value" :label="
|
|
25
|
+
<l-group-select v-model="value" :label="label" v-bind="context.attrs" :error="error"
|
|
22
26
|
:error-message="errorMessage" :required="context.state.required"
|
|
23
27
|
:disable="context.disabled">
|
|
24
28
|
<template v-for="(s, name) in $slots" v-slot:[name]="props" :key="name">
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed, ref } from "vue";
|
|
3
3
|
import { useErrorMessage } from "./useErrorMessage";
|
|
4
|
+
import { useRequiredLabel } from "./useRequiredLabel";
|
|
4
5
|
import { useI18n } from "vue-i18n";
|
|
5
6
|
const props = defineProps({
|
|
6
7
|
context: {
|
|
@@ -42,13 +43,7 @@ const onBlur = () => {
|
|
|
42
43
|
error.value = false;
|
|
43
44
|
}
|
|
44
45
|
};
|
|
45
|
-
const label =
|
|
46
|
-
let l = t(props.context.label);
|
|
47
|
-
if (props.context.state.required) {
|
|
48
|
-
l = "* " + l;
|
|
49
|
-
}
|
|
50
|
-
return l;
|
|
51
|
-
});
|
|
46
|
+
const label = useRequiredLabel(props.context, t);
|
|
52
47
|
</script>
|
|
53
48
|
|
|
54
49
|
<template>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed } from "vue";
|
|
2
|
+
import { computed, ref } from "vue";
|
|
3
3
|
import { useErrorMessage } from "./useErrorMessage";
|
|
4
|
+
import { useRequiredLabel } from "./useRequiredLabel";
|
|
4
5
|
import { useI18n } from "vue-i18n";
|
|
5
6
|
const props = defineProps({
|
|
6
7
|
context: {
|
|
@@ -9,7 +10,9 @@ const props = defineProps({
|
|
|
9
10
|
}
|
|
10
11
|
});
|
|
11
12
|
const { t } = useI18n();
|
|
12
|
-
const
|
|
13
|
+
const error = ref(false);
|
|
14
|
+
const errorMessage = ref("");
|
|
15
|
+
useErrorMessage(props.context.node, error, errorMessage);
|
|
13
16
|
const value = computed({
|
|
14
17
|
get: () => props.context?.value,
|
|
15
18
|
set: (val) => props.context.node.input(val)
|
|
@@ -21,13 +24,7 @@ const onBlur = () => {
|
|
|
21
24
|
error.value = false;
|
|
22
25
|
}
|
|
23
26
|
};
|
|
24
|
-
const label =
|
|
25
|
-
let l = t(props.context.label);
|
|
26
|
-
if (props.context.state.required) {
|
|
27
|
-
l = "* " + l;
|
|
28
|
-
}
|
|
29
|
-
return l;
|
|
30
|
-
});
|
|
27
|
+
const label = useRequiredLabel(props.context, t);
|
|
31
28
|
</script>
|
|
32
29
|
|
|
33
30
|
<template>
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed } from "vue";
|
|
2
|
+
import { computed, ref } from "vue";
|
|
3
3
|
import { useErrorMessage } from "./useErrorMessage";
|
|
4
|
+
import { useRequiredLabel } from "./useRequiredLabel";
|
|
4
5
|
const props = defineProps({
|
|
5
6
|
context: Object
|
|
6
7
|
});
|
|
7
|
-
const
|
|
8
|
+
const error = ref(false);
|
|
9
|
+
const errorMessage = ref("");
|
|
10
|
+
useErrorMessage(props.context.node, error, errorMessage);
|
|
11
|
+
const label = useRequiredLabel(props.context);
|
|
8
12
|
const value = computed({
|
|
9
13
|
get: () => props.context.value,
|
|
10
14
|
set: (val) => props.context.node.input(val)
|
|
@@ -12,7 +16,7 @@ const value = computed({
|
|
|
12
16
|
</script>
|
|
13
17
|
|
|
14
18
|
<template>
|
|
15
|
-
<l-input-xlsx v-model="value" :label="
|
|
19
|
+
<l-input-xlsx v-model="value" :label="label" v-bind="context.attrs" :error="error" :type="context.inputType"
|
|
16
20
|
:error-message="errorMessage">
|
|
17
21
|
<slot></slot>
|
|
18
22
|
</l-input-xlsx>
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { useLight } from "#imports";
|
|
3
|
-
import { computed } from "vue";
|
|
3
|
+
import { computed, ref } from "vue";
|
|
4
4
|
import { useErrorMessage } from "./useErrorMessage";
|
|
5
|
+
import { useRequiredLabel } from "./useRequiredLabel";
|
|
5
6
|
const light = useLight();
|
|
6
7
|
const props = defineProps({
|
|
7
8
|
context: Object
|
|
8
9
|
});
|
|
9
|
-
const
|
|
10
|
+
const error = ref(false);
|
|
11
|
+
const errorMessage = ref("");
|
|
12
|
+
useErrorMessage(props.context.node, error, errorMessage);
|
|
13
|
+
const label = useRequiredLabel(props.context);
|
|
10
14
|
const value = computed({
|
|
11
15
|
get: () => props.context.value,
|
|
12
16
|
set: (val) => props.context.node.input(val)
|
|
@@ -17,7 +21,7 @@ const outlined = computed(() => {
|
|
|
17
21
|
</script>
|
|
18
22
|
|
|
19
23
|
<template>
|
|
20
|
-
<l-field stack-label :label="
|
|
24
|
+
<l-field stack-label :label="label" :error="error" :error-message="errorMessage" :outlined="outlined"
|
|
21
25
|
hide-bottom-space>
|
|
22
26
|
<q-option-group type="checkbox" :options="context.options" v-model="value" inline v-bind="context.attrs">
|
|
23
27
|
</q-option-group>
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed } from "vue";
|
|
2
|
+
import { computed, ref } from "vue";
|
|
3
3
|
import { useErrorMessage } from "./useErrorMessage";
|
|
4
4
|
const props = defineProps({
|
|
5
5
|
context: Object
|
|
6
6
|
});
|
|
7
|
-
const
|
|
7
|
+
const error = ref(false);
|
|
8
|
+
const errorMessage = ref("");
|
|
9
|
+
useErrorMessage(props.context.node, error, errorMessage);
|
|
8
10
|
const value = computed({
|
|
9
11
|
get: () => props.context.value,
|
|
10
12
|
set: (val) => props.context.node.input(val)
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { useErrorMessage } from "./useErrorMessage";
|
|
3
|
-
import {
|
|
3
|
+
import { useRequiredLabel } from "./useRequiredLabel";
|
|
4
|
+
import { computed, ref } from "vue";
|
|
4
5
|
const props = defineProps({
|
|
5
6
|
context: Object
|
|
6
7
|
});
|
|
7
|
-
const
|
|
8
|
+
const error = ref(false);
|
|
9
|
+
const errorMessage = ref("");
|
|
10
|
+
useErrorMessage(props.context.node, error, errorMessage);
|
|
11
|
+
const label = useRequiredLabel(props.context);
|
|
8
12
|
const value = computed({
|
|
9
13
|
get: () => props.context.value,
|
|
10
14
|
set: (val) => props.context.node.input(val)
|
|
@@ -18,7 +22,7 @@ if (props.context.state.required) {
|
|
|
18
22
|
</script>
|
|
19
23
|
|
|
20
24
|
<template>
|
|
21
|
-
<l-select v-model="value" :label="
|
|
25
|
+
<l-select v-model="value" :label="label" v-bind="context.attrs" :error="error" :error-message="errorMessage"
|
|
22
26
|
:clearable="clearable" :disable="context.disabled">
|
|
23
27
|
<template v-for="(s, name) in $slots" v-slot:[name]="props" :key="name">
|
|
24
28
|
<slot :name="name" v-bind="props ?? {}"></slot>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed } from "vue";
|
|
2
|
+
import { computed, ref } from "vue";
|
|
3
3
|
import { useErrorMessage } from "./useErrorMessage";
|
|
4
|
+
import { useRequiredLabel } from "./useRequiredLabel";
|
|
4
5
|
import { useI18n } from "vue-i18n";
|
|
5
6
|
const props = defineProps({
|
|
6
7
|
context: {
|
|
@@ -9,7 +10,9 @@ const props = defineProps({
|
|
|
9
10
|
}
|
|
10
11
|
});
|
|
11
12
|
const { t } = useI18n();
|
|
12
|
-
const
|
|
13
|
+
const error = ref(false);
|
|
14
|
+
const errorMessage = ref("");
|
|
15
|
+
useErrorMessage(props.context.node, error, errorMessage);
|
|
13
16
|
const value = computed({
|
|
14
17
|
get: () => props.context?.value,
|
|
15
18
|
set: (val) => {
|
|
@@ -23,13 +26,7 @@ const onBlur = () => {
|
|
|
23
26
|
error.value = false;
|
|
24
27
|
}
|
|
25
28
|
};
|
|
26
|
-
const label =
|
|
27
|
-
let l = t(props.context.label);
|
|
28
|
-
if (props.context.state.required) {
|
|
29
|
-
l = "* " + l;
|
|
30
|
-
}
|
|
31
|
-
return l;
|
|
32
|
-
});
|
|
29
|
+
const label = useRequiredLabel(props.context, t);
|
|
33
30
|
</script>
|
|
34
31
|
|
|
35
32
|
<template>
|
|
@@ -1,19 +1,30 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed } from "vue";
|
|
2
|
+
import { computed, ref } from "vue";
|
|
3
3
|
import { useErrorMessage } from "./useErrorMessage";
|
|
4
|
+
import { useRequiredLabel } from "./useRequiredLabel";
|
|
4
5
|
const props = defineProps({
|
|
5
6
|
context: Object
|
|
6
7
|
});
|
|
7
|
-
const
|
|
8
|
+
const error = ref(false);
|
|
9
|
+
const errorMessage = ref("");
|
|
10
|
+
useErrorMessage(props.context.node, error, errorMessage);
|
|
11
|
+
const label = useRequiredLabel(props.context);
|
|
8
12
|
const value = computed({
|
|
9
13
|
get: () => props.context.value,
|
|
10
14
|
set: (val) => props.context.node.input(val)
|
|
11
15
|
});
|
|
16
|
+
const onBlur = () => {
|
|
17
|
+
if (errorMessage.value) {
|
|
18
|
+
error.value = true;
|
|
19
|
+
} else {
|
|
20
|
+
error.value = false;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
12
23
|
</script>
|
|
13
24
|
|
|
14
25
|
<template>
|
|
15
|
-
<l-time-picker v-model="value" v-bind="context.attrs" :label="
|
|
16
|
-
:error-message="errorMessage" :disable="context.disabled"
|
|
26
|
+
<l-time-picker v-model="value" v-bind="context.attrs" :label="label" :error="error" :type="context.inputType"
|
|
27
|
+
:error-message="errorMessage" :disable="context.disabled" @blur="onBlur">
|
|
17
28
|
<template v-for="(s, name) in $slots" v-slot:[name]="props" :key="name">
|
|
18
29
|
<slot :name="name" v-bind="props ?? {}"></slot>
|
|
19
30
|
</template>
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed } from "vue";
|
|
3
|
+
import { useRequiredLabel } from "./useRequiredLabel";
|
|
3
4
|
const props = defineProps({
|
|
4
5
|
context: Object
|
|
5
6
|
});
|
|
7
|
+
const label = useRequiredLabel(props.context);
|
|
6
8
|
const value = computed({
|
|
7
9
|
get: () => props.context.value,
|
|
8
10
|
set: (val) => props.context.node.input(val)
|
|
@@ -10,7 +12,7 @@ const value = computed({
|
|
|
10
12
|
</script>
|
|
11
13
|
|
|
12
14
|
<template>
|
|
13
|
-
<q-toggle v-model="value" :label="
|
|
15
|
+
<q-toggle v-model="value" :label="label" :disable="context.disabled" v-bind="context.attrs">
|
|
14
16
|
<slot></slot>
|
|
15
17
|
</q-toggle>
|
|
16
18
|
</template>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useRequiredLabel(context: any, t?: (val: string) => string): import("vue").ComputedRef<any>;
|