@movk/nuxt 1.1.2 → 1.2.0
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/README.md +5 -29
- package/dist/module.d.mts +3 -1
- package/dist/module.json +3 -3
- package/dist/module.mjs +120 -34
- package/dist/runtime/auto-form/controls.d.ts +221 -0
- package/dist/runtime/auto-form/controls.js +70 -0
- package/dist/runtime/{utils → auto-form}/field-utils.d.ts +4 -20
- package/dist/runtime/{utils → auto-form}/field-utils.js +1 -2
- package/dist/runtime/auto-form/metadata.d.ts +22 -0
- package/dist/runtime/auto-form/metadata.js +53 -0
- package/dist/runtime/auto-form/provider.d.ts +27 -0
- package/dist/runtime/{internal/useAutoFormProvider.js → auto-form/provider.js} +1 -1
- package/dist/runtime/{utils → auto-form}/reactive-utils.d.ts +4 -22
- package/dist/runtime/{utils → auto-form}/schema-introspector.d.ts +3 -9
- package/dist/runtime/{utils → auto-form}/schema-introspector.js +11 -9
- package/dist/runtime/components/AutoForm.d.vue.ts +4 -5
- package/dist/runtime/components/AutoForm.vue +12 -35
- package/dist/runtime/components/AutoForm.vue.d.ts +4 -5
- package/dist/runtime/components/ColorChooser.d.vue.ts +10 -6
- package/dist/runtime/components/ColorChooser.vue +4 -7
- package/dist/runtime/components/ColorChooser.vue.d.ts +10 -6
- package/dist/runtime/components/DatePicker.d.vue.ts +16 -10
- package/dist/runtime/components/DatePicker.vue.d.ts +16 -10
- package/dist/runtime/components/SearchForm.d.vue.ts +171 -0
- package/dist/runtime/components/SearchForm.vue +216 -0
- package/dist/runtime/components/SearchForm.vue.d.ts +171 -0
- package/dist/runtime/components/SlideVerify.d.vue.ts +5 -32
- package/dist/runtime/components/SlideVerify.vue +4 -4
- package/dist/runtime/components/SlideVerify.vue.d.ts +5 -32
- package/dist/runtime/components/StarRating.d.vue.ts +8 -16
- package/dist/runtime/components/StarRating.vue +50 -65
- package/dist/runtime/components/StarRating.vue.d.ts +8 -16
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererArray.d.vue.ts +10 -2
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererArray.vue +16 -23
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererArray.vue.d.ts +10 -2
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererChildren.d.vue.ts +26 -0
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererChildren.vue +50 -0
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererChildren.vue.d.ts +26 -0
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererField.d.vue.ts +8 -2
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererField.vue +2 -2
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererField.vue.d.ts +8 -2
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererLayout.d.vue.ts +8 -2
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererLayout.vue +29 -64
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererLayout.vue.d.ts +8 -2
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererNested.d.vue.ts +8 -2
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererNested.vue +15 -69
- package/dist/runtime/components/auto-form-renderer/AutoFormRendererNested.vue.d.ts +8 -2
- package/dist/runtime/components/input/AsPhoneNumberInput.d.vue.ts +36 -0
- package/dist/runtime/components/input/AsPhoneNumberInput.vue +35 -0
- package/dist/runtime/components/input/AsPhoneNumberInput.vue.d.ts +36 -0
- package/dist/runtime/components/input/WithCharacterLimit.d.vue.ts +17 -9
- package/dist/runtime/components/input/WithCharacterLimit.vue +5 -5
- package/dist/runtime/components/input/WithCharacterLimit.vue.d.ts +17 -9
- package/dist/runtime/components/input/WithClear.d.vue.ts +13 -9
- package/dist/runtime/components/input/WithClear.vue +2 -2
- package/dist/runtime/components/input/WithClear.vue.d.ts +13 -9
- package/dist/runtime/components/input/WithCopy.d.vue.ts +16 -10
- package/dist/runtime/components/input/WithCopy.vue +3 -3
- package/dist/runtime/components/input/WithCopy.vue.d.ts +16 -10
- package/dist/runtime/components/input/WithFloatingLabel.d.vue.ts +36 -0
- package/dist/runtime/components/input/WithFloatingLabel.vue +67 -0
- package/dist/runtime/components/input/WithFloatingLabel.vue.d.ts +36 -0
- package/dist/runtime/components/input/WithPasswordToggle.d.vue.ts +11 -9
- package/dist/runtime/components/input/WithPasswordToggle.vue +3 -3
- package/dist/runtime/components/input/WithPasswordToggle.vue.d.ts +11 -9
- package/dist/runtime/components/theme-picker/ThemePicker.d.vue.ts +1 -1
- package/dist/runtime/components/theme-picker/ThemePicker.vue +19 -25
- package/dist/runtime/components/theme-picker/ThemePicker.vue.d.ts +1 -1
- package/dist/runtime/components/theme-picker/ThemePickerButton.d.vue.ts +1 -7
- package/dist/runtime/components/theme-picker/ThemePickerButton.vue.d.ts +1 -7
- package/dist/runtime/composables/index.d.ts +1 -1
- package/dist/runtime/composables/index.js +1 -1
- package/dist/runtime/composables/useApiFetch.d.ts +17 -14
- package/dist/runtime/composables/useApiFetch.js +3 -28
- package/dist/runtime/composables/useAutoForm.d.ts +14 -98
- package/dist/runtime/composables/useAutoForm.js +37 -157
- package/dist/runtime/composables/useClientApiFetch.d.ts +5 -6
- package/dist/runtime/composables/useDownloadWithProgress.js +5 -6
- package/dist/runtime/composables/useLazyApiFetch.d.ts +18 -0
- package/dist/runtime/composables/useLazyApiFetch.js +4 -0
- package/dist/runtime/composables/useTheme.d.ts +17 -14
- package/dist/runtime/composables/useTheme.js +68 -72
- package/dist/runtime/composables/useUploadWithProgress.d.ts +2 -2
- package/dist/runtime/composables/useUploadWithProgress.js +7 -7
- package/dist/runtime/constants/api-defaults.d.ts +9 -0
- package/dist/runtime/constants/api-defaults.js +32 -0
- package/dist/runtime/constants/auto-form.d.ts +0 -2
- package/dist/runtime/constants/auto-form.js +0 -25
- package/dist/runtime/constants/grid-cols.d.ts +7 -0
- package/dist/runtime/constants/grid-cols.js +44 -0
- package/dist/runtime/plugins/api.factory.js +78 -121
- package/dist/runtime/plugins/theme.js +44 -64
- package/dist/runtime/style.css +1 -1
- package/dist/runtime/types/api.d.ts +277 -146
- package/dist/runtime/types/auto-form.d.ts +122 -411
- package/dist/runtime/types/index.d.ts +2 -2
- package/dist/runtime/types/index.js +2 -2
- package/dist/runtime/types/module.d.ts +70 -13
- package/dist/runtime/types/theme.d.ts +2 -0
- package/dist/runtime/types/zod.d.ts +11 -10
- package/dist/runtime/utils/api-utils.d.ts +27 -48
- package/dist/runtime/utils/api-utils.js +18 -47
- package/dist/runtime/utils/meta.d.ts +7 -0
- package/dist/runtime/utils/meta.js +16 -0
- package/package.json +36 -35
- package/dist/runtime/composables/useApiAuth.d.ts +0 -47
- package/dist/runtime/composables/useApiAuth.js +0 -66
- package/dist/runtime/internal/useAutoFormProvider.d.ts +0 -50
- package/dist/runtime/schemas/api.d.ts +0 -590
- package/dist/runtime/schemas/api.js +0 -228
- package/dist/runtime/server/api/_movk/session.post.d.ts +0 -10
- package/dist/runtime/server/api/_movk/session.post.js +0 -18
- package/dist/runtime/types/auth.d.ts +0 -34
- package/dist/runtime/types/auto-form-renderer.d.ts +0 -22
- package/dist/runtime/types/components.d.ts +0 -43
- package/dist/runtime/types/components.js +0 -0
- package/dist/runtime/utils/auto-form.d.ts +0 -3
- package/dist/runtime/utils/auto-form.js +0 -18
- /package/dist/runtime/{utils → auto-form}/reactive-utils.js +0 -0
- /package/dist/runtime/types/{auto-form-renderer.js → theme.js} +0 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
import { classifyFields } from "../../auto-form/field-utils";
|
|
4
|
+
import AutoFormRendererField from "./AutoFormRendererField.vue";
|
|
5
|
+
import AutoFormRendererArray from "./AutoFormRendererArray.vue";
|
|
6
|
+
import AutoFormRendererLayout from "./AutoFormRendererLayout.vue";
|
|
7
|
+
import AutoFormRendererNested from "./AutoFormRendererNested.vue";
|
|
8
|
+
const { fields, schema, extraProps } = defineProps({
|
|
9
|
+
fields: { type: Array, required: true },
|
|
10
|
+
extraProps: { type: Object, required: false },
|
|
11
|
+
schema: { type: null, required: false }
|
|
12
|
+
});
|
|
13
|
+
const fieldTypeMap = computed(() => {
|
|
14
|
+
const { leafFields, arrayFields, layoutFields } = classifyFields(fields);
|
|
15
|
+
const map = /* @__PURE__ */ new Map();
|
|
16
|
+
for (const f of leafFields) map.set(f, "leaf");
|
|
17
|
+
for (const f of arrayFields) map.set(f, "array");
|
|
18
|
+
for (const f of layoutFields) map.set(f, "layout");
|
|
19
|
+
return map;
|
|
20
|
+
});
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<template v-for="childField in fields" :key="childField.path">
|
|
25
|
+
<AutoFormRendererField
|
|
26
|
+
v-if="fieldTypeMap.get(childField) === 'leaf'"
|
|
27
|
+
:field="childField"
|
|
28
|
+
:schema="schema"
|
|
29
|
+
:extra-props="extraProps"
|
|
30
|
+
/>
|
|
31
|
+
<AutoFormRendererArray
|
|
32
|
+
v-else-if="fieldTypeMap.get(childField) === 'array'"
|
|
33
|
+
:field="childField"
|
|
34
|
+
:schema="schema"
|
|
35
|
+
:extra-props="extraProps"
|
|
36
|
+
/>
|
|
37
|
+
<AutoFormRendererLayout
|
|
38
|
+
v-else-if="fieldTypeMap.get(childField) === 'layout'"
|
|
39
|
+
:field="childField"
|
|
40
|
+
:schema="schema"
|
|
41
|
+
:extra-props="extraProps"
|
|
42
|
+
/>
|
|
43
|
+
<AutoFormRendererNested
|
|
44
|
+
v-else
|
|
45
|
+
:field="childField"
|
|
46
|
+
:schema="schema"
|
|
47
|
+
:extra-props="extraProps"
|
|
48
|
+
/>
|
|
49
|
+
</template>
|
|
50
|
+
</template>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import type { AutoFormField } from '../../types/auto-form.js';
|
|
3
|
+
import type { AnyObject } from '@movk/core';
|
|
4
|
+
import type { AutoFormProps } from '../AutoForm.vue.js';
|
|
5
|
+
export interface AutoFormRendererChildrenProps<S extends z.ZodObject> extends Pick<AutoFormProps<S>, 'schema'> {
|
|
6
|
+
fields: AutoFormField[];
|
|
7
|
+
extraProps?: AnyObject;
|
|
8
|
+
}
|
|
9
|
+
declare const __VLS_export: <S extends z.ZodObject>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
10
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<AutoFormRendererChildrenProps<S>> & (typeof globalThis extends {
|
|
11
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
12
|
+
} ? P : {});
|
|
13
|
+
expose: (exposed: {}) => void;
|
|
14
|
+
attrs: any;
|
|
15
|
+
slots: {};
|
|
16
|
+
emit: {};
|
|
17
|
+
}>) => import("vue").VNode & {
|
|
18
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
19
|
+
};
|
|
20
|
+
declare const _default: typeof __VLS_export;
|
|
21
|
+
export default _default;
|
|
22
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
23
|
+
[K in keyof T]: T[K];
|
|
24
|
+
} : {
|
|
25
|
+
[K in keyof T as K]: T[K];
|
|
26
|
+
}) & {};
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import type { z } from 'zod
|
|
2
|
-
import type {
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import type { AutoFormProps } from '../AutoForm.vue.js';
|
|
3
|
+
import type { AnyObject } from '@movk/core';
|
|
4
|
+
import type { AutoFormField } from '../../types/index.js';
|
|
5
|
+
export interface AutoFormFieldProps<S extends z.ZodObject> extends Pick<AutoFormProps<S>, 'schema'> {
|
|
6
|
+
field: AutoFormField;
|
|
7
|
+
extraProps?: AnyObject;
|
|
8
|
+
}
|
|
3
9
|
declare const __VLS_export: <S extends z.ZodObject>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
4
10
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<AutoFormFieldProps<S>> & (typeof globalThis extends {
|
|
5
11
|
__VLS_PROPS_FALLBACK: infer P;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { UFormField } from "#components";
|
|
3
3
|
import { computed } from "vue";
|
|
4
|
-
import { useAutoFormInjector } from "../../
|
|
5
|
-
import { VNodeRender } from "../../
|
|
4
|
+
import { useAutoFormInjector } from "../../auto-form/provider";
|
|
5
|
+
import { VNodeRender } from "../../auto-form/reactive-utils";
|
|
6
6
|
const { field, extraProps } = defineProps({
|
|
7
7
|
field: { type: Object, required: true },
|
|
8
8
|
extraProps: { type: Object, required: false },
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import type { z } from 'zod
|
|
2
|
-
import type {
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import type { AutoFormProps } from '../AutoForm.vue.js';
|
|
3
|
+
import type { AnyObject } from '@movk/core';
|
|
4
|
+
import type { AutoFormField } from '../../types/index.js';
|
|
5
|
+
export interface AutoFormFieldProps<S extends z.ZodObject> extends Pick<AutoFormProps<S>, 'schema'> {
|
|
6
|
+
field: AutoFormField;
|
|
7
|
+
extraProps?: AnyObject;
|
|
8
|
+
}
|
|
3
9
|
declare const __VLS_export: <S extends z.ZodObject>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
4
10
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<AutoFormFieldProps<S>> & (typeof globalThis extends {
|
|
5
11
|
__VLS_PROPS_FALLBACK: infer P;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import type { z } from 'zod
|
|
2
|
-
import type {
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import type { AutoFormField } from '../../types/auto-form.js';
|
|
3
|
+
import type { AutoFormProps } from '../AutoForm.vue.js';
|
|
4
|
+
import type { AnyObject } from '@movk/core';
|
|
5
|
+
export interface AutoFormRendererLayoutProps<S extends z.ZodObject> extends Pick<AutoFormProps<S>, 'schema'> {
|
|
6
|
+
field: AutoFormField;
|
|
7
|
+
extraProps?: AnyObject;
|
|
8
|
+
}
|
|
3
9
|
declare const __VLS_export: <S extends z.ZodObject>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
4
10
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<AutoFormRendererLayoutProps<S>> & (typeof globalThis extends {
|
|
5
11
|
__VLS_PROPS_FALLBACK: infer P;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed, resolveDynamicComponent } from "vue";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import AutoFormRendererArray from "./AutoFormRendererArray.vue";
|
|
7
|
-
import AutoFormRendererField from "./AutoFormRendererField.vue";
|
|
8
|
-
import AutoFormRendererNested from "./AutoFormRendererNested.vue";
|
|
3
|
+
import { resolveReactiveValue } from "../../auto-form/reactive-utils";
|
|
4
|
+
import { useAutoFormInjector } from "../../auto-form/provider";
|
|
5
|
+
import AutoFormRendererChildren from "./AutoFormRendererChildren.vue";
|
|
9
6
|
const {
|
|
10
7
|
field,
|
|
11
8
|
schema,
|
|
@@ -16,20 +13,14 @@ const {
|
|
|
16
13
|
schema: { type: null, required: false }
|
|
17
14
|
});
|
|
18
15
|
const { createFieldContext, resolveFieldProp } = useAutoFormInjector();
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return field2.path.split(".").pop() || field2.path;
|
|
16
|
+
function getFieldName(f) {
|
|
17
|
+
return f.path.split(".").pop() || f.path;
|
|
22
18
|
}
|
|
23
|
-
const
|
|
24
|
-
if (!field.children?.length) return
|
|
25
|
-
|
|
19
|
+
const visibleFields = computed(() => {
|
|
20
|
+
if (!field.children?.length) return [];
|
|
21
|
+
return field.children.filter(
|
|
26
22
|
(f) => f && (f.meta?.if === void 0 || resolveFieldProp(f, "if") === true)
|
|
27
23
|
);
|
|
28
|
-
const classified = classifyFields(visibleFields);
|
|
29
|
-
return {
|
|
30
|
-
...classified,
|
|
31
|
-
allFields: visibleFields
|
|
32
|
-
};
|
|
33
24
|
});
|
|
34
25
|
const layoutComponent = computed(() => {
|
|
35
26
|
if (!field.meta?.layout?.component) {
|
|
@@ -40,6 +31,7 @@ const layoutComponent = computed(() => {
|
|
|
40
31
|
const layoutProps = computed(() => {
|
|
41
32
|
const config = field.meta.layout;
|
|
42
33
|
if (!config) return {};
|
|
34
|
+
const context = createFieldContext(field);
|
|
43
35
|
return {
|
|
44
36
|
...resolveReactiveValue(config.props, context),
|
|
45
37
|
...config.class && { class: resolveReactiveValue(config.class, context) }
|
|
@@ -48,78 +40,51 @@ const layoutProps = computed(() => {
|
|
|
48
40
|
const layoutSlots = computed(() => {
|
|
49
41
|
const config = field.meta.layout;
|
|
50
42
|
if (!config?.slots) return {};
|
|
43
|
+
const context = createFieldContext(field);
|
|
51
44
|
const resolvedSlots = resolveReactiveValue(config.slots, context);
|
|
52
45
|
return Object.entries(resolvedSlots).reduce((acc, [name, fn]) => {
|
|
53
46
|
if (typeof fn === "function") acc[name] = fn;
|
|
54
47
|
return acc;
|
|
55
48
|
}, {});
|
|
56
49
|
});
|
|
57
|
-
const
|
|
50
|
+
const fieldsBySlot = computed(() => {
|
|
58
51
|
const config = field.meta.layout;
|
|
59
|
-
|
|
60
|
-
|
|
52
|
+
const fields = visibleFields.value;
|
|
53
|
+
if (!config || !fields.length) return /* @__PURE__ */ new Map();
|
|
54
|
+
const context = createFieldContext(field);
|
|
55
|
+
let slotMapping;
|
|
61
56
|
if (config.fieldSlots) {
|
|
62
57
|
const resolved = resolveReactiveValue(config.fieldSlots, context);
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
if (config.fieldSlot) {
|
|
58
|
+
slotMapping = /* @__PURE__ */ new Map();
|
|
59
|
+
for (const [name, slot] of Object.entries(resolved)) {
|
|
60
|
+
if (slot && typeof slot === "string") slotMapping.set(name, slot);
|
|
61
|
+
}
|
|
62
|
+
} else if (config.fieldSlot) {
|
|
69
63
|
const slot = resolveReactiveValue(config.fieldSlot, context);
|
|
70
64
|
if (slot && typeof slot === "string") {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
65
|
+
slotMapping = /* @__PURE__ */ new Map();
|
|
66
|
+
for (const f of fields) {
|
|
67
|
+
slotMapping.set(getFieldName(f), slot);
|
|
68
|
+
}
|
|
74
69
|
}
|
|
75
70
|
}
|
|
76
|
-
return
|
|
77
|
-
|
|
78
|
-
const fieldsBySlot = computed(() => {
|
|
79
|
-
if (!renderData.value) return /* @__PURE__ */ new Map();
|
|
80
|
-
const grouped = renderData.value.allFields.reduce((map, field2) => {
|
|
81
|
-
const slot = fieldSlotMapping.value.get(getFieldName(field2)) || "default";
|
|
71
|
+
return fields.reduce((map, f) => {
|
|
72
|
+
const slot = slotMapping?.get(getFieldName(f)) || "default";
|
|
82
73
|
if (!map.has(slot)) map.set(slot, []);
|
|
83
|
-
map.get(slot).push(
|
|
74
|
+
map.get(slot).push(f);
|
|
84
75
|
return map;
|
|
85
76
|
}, /* @__PURE__ */ new Map());
|
|
86
|
-
return grouped;
|
|
87
77
|
});
|
|
88
78
|
</script>
|
|
89
79
|
|
|
90
80
|
<template>
|
|
91
|
-
<component :is="layoutComponent" v-bind="layoutProps" v-if="
|
|
81
|
+
<component :is="layoutComponent" v-bind="layoutProps" v-if="visibleFields.length">
|
|
92
82
|
<template v-for="(slotFn, slotName) in layoutSlots" :key="`slot-${slotName}`" #[slotName]>
|
|
93
83
|
<component :is="slotFn" />
|
|
94
84
|
</template>
|
|
95
85
|
|
|
96
86
|
<template v-for="[slotName, fields] in fieldsBySlot.entries()" :key="`fields-${slotName}`" #[slotName]>
|
|
97
|
-
<
|
|
98
|
-
<AutoFormRendererField
|
|
99
|
-
v-if="renderData.leafFields.includes(childField)"
|
|
100
|
-
:field="childField"
|
|
101
|
-
:schema="schema"
|
|
102
|
-
:extra-props="extraProps"
|
|
103
|
-
/>
|
|
104
|
-
<AutoFormRendererArray
|
|
105
|
-
v-else-if="renderData.arrayFields.includes(childField)"
|
|
106
|
-
:field="childField"
|
|
107
|
-
:schema="schema"
|
|
108
|
-
:extra-props="extraProps"
|
|
109
|
-
/>
|
|
110
|
-
<AutoFormRendererLayout
|
|
111
|
-
v-else-if="renderData.layoutFields.includes(childField)"
|
|
112
|
-
:field="childField"
|
|
113
|
-
:schema="schema"
|
|
114
|
-
:extra-props="extraProps"
|
|
115
|
-
/>
|
|
116
|
-
<AutoFormRendererNested
|
|
117
|
-
v-else
|
|
118
|
-
:field="childField"
|
|
119
|
-
:schema="schema"
|
|
120
|
-
:extra-props="extraProps"
|
|
121
|
-
/>
|
|
122
|
-
</template>
|
|
87
|
+
<AutoFormRendererChildren :fields="fields" :schema="schema" :extra-props="extraProps" />
|
|
123
88
|
</template>
|
|
124
89
|
</component>
|
|
125
90
|
</template>
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import type { z } from 'zod
|
|
2
|
-
import type {
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import type { AutoFormField } from '../../types/auto-form.js';
|
|
3
|
+
import type { AutoFormProps } from '../AutoForm.vue.js';
|
|
4
|
+
import type { AnyObject } from '@movk/core';
|
|
5
|
+
export interface AutoFormRendererLayoutProps<S extends z.ZodObject> extends Pick<AutoFormProps<S>, 'schema'> {
|
|
6
|
+
field: AutoFormField;
|
|
7
|
+
extraProps?: AnyObject;
|
|
8
|
+
}
|
|
3
9
|
declare const __VLS_export: <S extends z.ZodObject>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
4
10
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<AutoFormRendererLayoutProps<S>> & (typeof globalThis extends {
|
|
5
11
|
__VLS_PROPS_FALLBACK: infer P;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import type { z } from 'zod
|
|
2
|
-
import type {
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import type { AutoFormProps } from '../AutoForm.vue.js';
|
|
3
|
+
import type { AutoFormField } from '../../types/index.js';
|
|
4
|
+
import type { AnyObject } from '@movk/core';
|
|
5
|
+
export interface AutoFormRendererNestedProps<S extends z.ZodObject> extends Pick<AutoFormProps<S>, 'schema'> {
|
|
6
|
+
field: AutoFormField;
|
|
7
|
+
extraProps?: AnyObject;
|
|
8
|
+
}
|
|
3
9
|
declare const __VLS_export: <S extends z.ZodObject>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
4
10
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<AutoFormRendererNestedProps<S>> & (typeof globalThis extends {
|
|
5
11
|
__VLS_PROPS_FALLBACK: infer P;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { UCollapsible } from "#components";
|
|
3
3
|
import { computed } from "vue";
|
|
4
|
-
import { useAutoFormInjector } from "../../
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
4
|
+
import { useAutoFormInjector } from "../../auto-form/provider";
|
|
5
|
+
import { isLeafField } from "../../auto-form/field-utils";
|
|
6
|
+
import { VNodeRender } from "../../auto-form/reactive-utils";
|
|
7
7
|
import AutoFormRendererField from "./AutoFormRendererField.vue";
|
|
8
|
-
import
|
|
8
|
+
import AutoFormRendererChildren from "./AutoFormRendererChildren.vue";
|
|
9
9
|
const {
|
|
10
10
|
field,
|
|
11
11
|
schema,
|
|
@@ -16,18 +16,13 @@ const {
|
|
|
16
16
|
schema: { type: null, required: false }
|
|
17
17
|
});
|
|
18
18
|
const { createSlotResolver, createSlotProps, createCollapsibleEnhancer, resolveFieldProp } = useAutoFormInjector();
|
|
19
|
-
const
|
|
19
|
+
const visibleFields = computed(() => {
|
|
20
20
|
if (isLeafField(field) || !field.children?.length) {
|
|
21
|
-
return
|
|
21
|
+
return [];
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
return field.children.filter(
|
|
24
24
|
(f) => f && (f.meta?.if === void 0 || resolveFieldProp(f, "if") === true)
|
|
25
25
|
);
|
|
26
|
-
const classified = classifyFields(visibleFields);
|
|
27
|
-
return {
|
|
28
|
-
...classified,
|
|
29
|
-
allFields: visibleFields
|
|
30
|
-
};
|
|
31
26
|
});
|
|
32
27
|
const slotResolver = computed(() => createSlotResolver(field, extraProps));
|
|
33
28
|
const { collapsibleConfig, shouldShowCollapsible, isHidden, enhancedField } = createCollapsibleEnhancer(field, extraProps);
|
|
@@ -35,71 +30,22 @@ const slotProps = computed(() => createSlotProps(field, extraProps));
|
|
|
35
30
|
</script>
|
|
36
31
|
|
|
37
32
|
<template>
|
|
38
|
-
<UCollapsible v-if="shouldShowCollapsible &&
|
|
33
|
+
<UCollapsible v-if="shouldShowCollapsible && visibleFields.length" v-show="!isHidden" v-bind="collapsibleConfig || {}">
|
|
39
34
|
<template #default="{ open }">
|
|
40
35
|
<AutoFormRendererField :field="enhancedField" :schema="schema" :extra-props="{ ...extraProps, open }" />
|
|
41
36
|
</template>
|
|
42
37
|
<template #content>
|
|
43
38
|
<VNodeRender v-if="slotResolver.hasSlot('before')" :node="slotResolver.renderSlot('before', slotProps)" />
|
|
44
39
|
<VNodeRender v-if="slotResolver.hasSlot('content')" :node="slotResolver.renderSlot('content', slotProps)" />
|
|
45
|
-
<
|
|
46
|
-
<template v-for="childField in renderData.allFields" :key="childField.path">
|
|
47
|
-
<AutoFormRendererField
|
|
48
|
-
v-if="renderData.leafFields.includes(childField)"
|
|
49
|
-
:field="childField"
|
|
50
|
-
:schema="schema"
|
|
51
|
-
:extra-props="extraProps"
|
|
52
|
-
/>
|
|
53
|
-
<AutoFormRendererArray
|
|
54
|
-
v-else-if="renderData.arrayFields.includes(childField)"
|
|
55
|
-
:field="childField"
|
|
56
|
-
:schema="schema"
|
|
57
|
-
:extra-props="extraProps"
|
|
58
|
-
/>
|
|
59
|
-
<AutoFormRendererLayout
|
|
60
|
-
v-else-if="renderData.layoutFields.includes(childField)"
|
|
61
|
-
:field="childField"
|
|
62
|
-
:schema="schema"
|
|
63
|
-
:extra-props="extraProps"
|
|
64
|
-
/>
|
|
65
|
-
<AutoFormRendererNested
|
|
66
|
-
v-else
|
|
67
|
-
:field="childField"
|
|
68
|
-
:schema="schema"
|
|
69
|
-
:extra-props="extraProps"
|
|
70
|
-
/>
|
|
71
|
-
</template>
|
|
72
|
-
</template>
|
|
40
|
+
<AutoFormRendererChildren v-else :fields="visibleFields" :schema="schema" :extra-props="extraProps" />
|
|
73
41
|
<VNodeRender v-if="slotResolver.hasSlot('after')" :node="slotResolver.renderSlot('after', slotProps)" />
|
|
74
42
|
</template>
|
|
75
43
|
</UCollapsible>
|
|
76
44
|
|
|
77
|
-
<
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
:extra-props="extraProps"
|
|
84
|
-
/>
|
|
85
|
-
<AutoFormRendererArray
|
|
86
|
-
v-else-if="renderData.arrayFields.includes(childField)"
|
|
87
|
-
:field="childField"
|
|
88
|
-
:schema="schema"
|
|
89
|
-
:extra-props="extraProps"
|
|
90
|
-
/>
|
|
91
|
-
<AutoFormRendererLayout
|
|
92
|
-
v-else-if="renderData.layoutFields.includes(childField)"
|
|
93
|
-
:field="childField"
|
|
94
|
-
:schema="schema"
|
|
95
|
-
:extra-props="extraProps"
|
|
96
|
-
/>
|
|
97
|
-
<AutoFormRendererNested
|
|
98
|
-
v-else
|
|
99
|
-
:field="childField"
|
|
100
|
-
:schema="schema"
|
|
101
|
-
:extra-props="extraProps"
|
|
102
|
-
/>
|
|
103
|
-
</template>
|
|
104
|
-
</template>
|
|
45
|
+
<AutoFormRendererChildren
|
|
46
|
+
v-else-if="visibleFields.length"
|
|
47
|
+
:fields="visibleFields"
|
|
48
|
+
:schema="schema"
|
|
49
|
+
:extra-props="extraProps"
|
|
50
|
+
/>
|
|
105
51
|
</template>
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import type { z } from 'zod
|
|
2
|
-
import type {
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import type { AutoFormProps } from '../AutoForm.vue.js';
|
|
3
|
+
import type { AutoFormField } from '../../types/index.js';
|
|
4
|
+
import type { AnyObject } from '@movk/core';
|
|
5
|
+
export interface AutoFormRendererNestedProps<S extends z.ZodObject> extends Pick<AutoFormProps<S>, 'schema'> {
|
|
6
|
+
field: AutoFormField;
|
|
7
|
+
extraProps?: AnyObject;
|
|
8
|
+
}
|
|
3
9
|
declare const __VLS_export: <S extends z.ZodObject>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
4
10
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<AutoFormRendererNestedProps<S>> & (typeof globalThis extends {
|
|
5
11
|
__VLS_PROPS_FALLBACK: infer P;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { OmitByKey } from '@movk/core';
|
|
2
|
+
import type { InputProps, InputSlots, InputValue } from '@nuxt/ui';
|
|
3
|
+
import type { ClassNameValue } from '../../types/index.js';
|
|
4
|
+
export interface AsPhoneNumberInputProps<T extends InputValue = InputValue> extends /** @vue-ignore */ OmitByKey<InputProps<T>, 'type' | 'modelValue'> {
|
|
5
|
+
/**
|
|
6
|
+
* 输入掩码格式,`#` 表示一个数字位。
|
|
7
|
+
* @defaultValue '(###) ###-####'
|
|
8
|
+
*/
|
|
9
|
+
mask?: string;
|
|
10
|
+
/** 区号前缀,例如 `+86`。 */
|
|
11
|
+
dialCode?: string;
|
|
12
|
+
/** 区号前缀的自定义样式类。 */
|
|
13
|
+
dialCodeClass?: ClassNameValue;
|
|
14
|
+
}
|
|
15
|
+
declare const __VLS_export: <T extends InputValue>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
16
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<(AsPhoneNumberInputProps<T> & {
|
|
17
|
+
modelValue?: T;
|
|
18
|
+
}) & {
|
|
19
|
+
[x: `on${Capitalize<string>}`]: ((...args: any) => any) | undefined;
|
|
20
|
+
}> & (typeof globalThis extends {
|
|
21
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
22
|
+
} ? P : {});
|
|
23
|
+
expose: (exposed: {}) => void;
|
|
24
|
+
attrs: any;
|
|
25
|
+
slots: OmitByKey<InputSlots, "leading">;
|
|
26
|
+
emit: any & ((event: "update:modelValue", value: T | undefined) => void);
|
|
27
|
+
}>) => import("vue").VNode & {
|
|
28
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
29
|
+
};
|
|
30
|
+
declare const _default: typeof __VLS_export;
|
|
31
|
+
export default _default;
|
|
32
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
33
|
+
[K in keyof T]: T[K];
|
|
34
|
+
} : {
|
|
35
|
+
[K in keyof T as K]: T[K];
|
|
36
|
+
}) & {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { UInput } from "#components";
|
|
3
|
+
import { vMaska } from "maska/vue";
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
mask: { type: String, required: false, default: "(###) ###-####" },
|
|
6
|
+
dialCode: { type: String, required: false },
|
|
7
|
+
dialCodeClass: { type: [Array, String, null, Number, Boolean], required: false, skipCheck: true }
|
|
8
|
+
});
|
|
9
|
+
const emit = defineEmits(["update:modelValue", "blur", "change"]);
|
|
10
|
+
const slots = defineSlots();
|
|
11
|
+
defineOptions({ inheritAttrs: false });
|
|
12
|
+
const modelValue = defineModel({ type: null });
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<template>
|
|
16
|
+
<UInput
|
|
17
|
+
v-model="modelValue"
|
|
18
|
+
v-maska="props.mask"
|
|
19
|
+
type="tel"
|
|
20
|
+
:placeholder="props.placeholder ?? props.mask.replaceAll('#', '_')"
|
|
21
|
+
:style="props.dialCode ? { '--dial-code-length': `${props.dialCode.length + 1.5}ch` } : void 0"
|
|
22
|
+
:ui="props.dialCode ? { base: 'ps-(--dial-code-length)', leading: 'pointer-events-none text-muted' } : {}"
|
|
23
|
+
v-bind="$attrs"
|
|
24
|
+
@blur="emit('blur', $event)"
|
|
25
|
+
@change="emit('change', $event)"
|
|
26
|
+
>
|
|
27
|
+
<template v-for="(_, slotName) in slots" :key="slotName" #[slotName]="slotProps">
|
|
28
|
+
<slot :name="slotName" v-bind="slotProps ?? {}" />
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<template v-if="props.dialCode" #leading>
|
|
32
|
+
<span :class="props.dialCodeClass">{{ props.dialCode }}</span>
|
|
33
|
+
</template>
|
|
34
|
+
</UInput>
|
|
35
|
+
</template>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { OmitByKey } from '@movk/core';
|
|
2
|
+
import type { InputProps, InputSlots, InputValue } from '@nuxt/ui';
|
|
3
|
+
import type { ClassNameValue } from '../../types/index.js';
|
|
4
|
+
export interface AsPhoneNumberInputProps<T extends InputValue = InputValue> extends /** @vue-ignore */ OmitByKey<InputProps<T>, 'type' | 'modelValue'> {
|
|
5
|
+
/**
|
|
6
|
+
* 输入掩码格式,`#` 表示一个数字位。
|
|
7
|
+
* @defaultValue '(###) ###-####'
|
|
8
|
+
*/
|
|
9
|
+
mask?: string;
|
|
10
|
+
/** 区号前缀,例如 `+86`。 */
|
|
11
|
+
dialCode?: string;
|
|
12
|
+
/** 区号前缀的自定义样式类。 */
|
|
13
|
+
dialCodeClass?: ClassNameValue;
|
|
14
|
+
}
|
|
15
|
+
declare const __VLS_export: <T extends InputValue>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
16
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<(AsPhoneNumberInputProps<T> & {
|
|
17
|
+
modelValue?: T;
|
|
18
|
+
}) & {
|
|
19
|
+
[x: `on${Capitalize<string>}`]: ((...args: any) => any) | undefined;
|
|
20
|
+
}> & (typeof globalThis extends {
|
|
21
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
22
|
+
} ? P : {});
|
|
23
|
+
expose: (exposed: {}) => void;
|
|
24
|
+
attrs: any;
|
|
25
|
+
slots: OmitByKey<InputSlots, "leading">;
|
|
26
|
+
emit: any & ((event: "update:modelValue", value: T | undefined) => void);
|
|
27
|
+
}>) => import("vue").VNode & {
|
|
28
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
29
|
+
};
|
|
30
|
+
declare const _default: typeof __VLS_export;
|
|
31
|
+
export default _default;
|
|
32
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
33
|
+
[K in keyof T]: T[K];
|
|
34
|
+
} : {
|
|
35
|
+
[K in keyof T as K]: T[K];
|
|
36
|
+
}) & {};
|
|
@@ -1,19 +1,27 @@
|
|
|
1
|
-
import type { InputProps, InputValue } from '@nuxt/ui';
|
|
2
|
-
import type {
|
|
1
|
+
import type { InputProps, InputSlots, InputValue } from '@nuxt/ui';
|
|
2
|
+
import type { OmitByKey } from '@movk/core';
|
|
3
|
+
import type { ClassNameValue } from '../../types/index.js';
|
|
4
|
+
export interface WithCharacterLimitProps<T extends InputValue = InputValue> extends /** @vue-ignore */ OmitByKey<InputProps<T>, 'modelValue'> {
|
|
5
|
+
/**
|
|
6
|
+
* 最大允许输入的字符数
|
|
7
|
+
* @defaultValue 50
|
|
8
|
+
*/
|
|
9
|
+
maxLength?: number;
|
|
10
|
+
/** 字符计数器的自定义样式类 */
|
|
11
|
+
counterClass?: ClassNameValue;
|
|
12
|
+
}
|
|
3
13
|
declare const __VLS_export: <T extends InputValue>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
4
|
-
props: import("vue").PublicProps & __VLS_PrettifyLocal<(WithCharacterLimitProps<
|
|
5
|
-
modelValue?:
|
|
14
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<(WithCharacterLimitProps<T> & {
|
|
15
|
+
modelValue?: T;
|
|
6
16
|
}) & {
|
|
7
|
-
|
|
8
|
-
onChange?: ((event: Event) => any) | undefined;
|
|
9
|
-
"onUpdate:modelValue"?: ((value: import("@nuxt/ui/.").AcceptableValue | undefined) => any) | undefined;
|
|
17
|
+
[x: `on${Capitalize<string>}`]: ((...args: any) => any) | undefined;
|
|
10
18
|
}> & (typeof globalThis extends {
|
|
11
19
|
__VLS_PROPS_FALLBACK: infer P;
|
|
12
20
|
} ? P : {});
|
|
13
21
|
expose: (exposed: {}) => void;
|
|
14
22
|
attrs: any;
|
|
15
|
-
slots:
|
|
16
|
-
emit:
|
|
23
|
+
slots: OmitByKey<InputSlots, "trailing">;
|
|
24
|
+
emit: any & ((event: "update:modelValue", value: T | undefined) => void);
|
|
17
25
|
}>) => import("vue").VNode & {
|
|
18
26
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
19
27
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { UInput } from "#components";
|
|
3
3
|
import { computed } from "vue";
|
|
4
|
-
const
|
|
5
|
-
maxLength: { type: Number, required: false },
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
maxLength: { type: Number, required: false, default: 50 },
|
|
6
6
|
counterClass: { type: [Array, String, null, Number, Boolean], required: false, skipCheck: true }
|
|
7
7
|
});
|
|
8
8
|
const emit = defineEmits(["update:modelValue", "blur", "change"]);
|
|
@@ -17,7 +17,7 @@ const currentLength = computed(() => {
|
|
|
17
17
|
<template>
|
|
18
18
|
<UInput
|
|
19
19
|
v-model="modelValue"
|
|
20
|
-
:maxlength="maxLength"
|
|
20
|
+
:maxlength="props.maxLength"
|
|
21
21
|
aria-describedby="character-count"
|
|
22
22
|
:ui="{ trailing: 'pointer-events-none' }"
|
|
23
23
|
v-bind="$attrs"
|
|
@@ -31,11 +31,11 @@ const currentLength = computed(() => {
|
|
|
31
31
|
<template #trailing>
|
|
32
32
|
<div
|
|
33
33
|
id="character-count"
|
|
34
|
-
:class="[counterClass, 'text-xs text-muted tabular-nums']"
|
|
34
|
+
:class="[props.counterClass, 'text-xs text-muted tabular-nums']"
|
|
35
35
|
aria-live="polite"
|
|
36
36
|
role="status"
|
|
37
37
|
>
|
|
38
|
-
{{ currentLength }}/{{ maxLength }}
|
|
38
|
+
{{ currentLength }}/{{ props.maxLength }}
|
|
39
39
|
</div>
|
|
40
40
|
</template>
|
|
41
41
|
</UInput>
|