@unsource/ui 2.9.40 → 2.9.46
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/UnForm.d.vue.ts +19 -6
- package/dist/runtime/components/UnForm.vue +21 -2
- package/dist/runtime/components/UnForm.vue.d.ts +19 -6
- package/dist/runtime/components/UnFormItem.d.vue.ts +18 -1
- package/dist/runtime/components/UnFormItem.vue +21 -7
- package/dist/runtime/components/UnFormItem.vue.d.ts +18 -1
- package/dist/runtime/components/UnFormList.d.vue.ts +18 -1
- package/dist/runtime/components/UnFormList.vue +28 -20
- package/dist/runtime/components/UnFormList.vue.d.ts +18 -1
- package/dist/runtime/components/UnInput.d.vue.ts +4 -2
- package/dist/runtime/components/UnInput.vue +7 -5
- package/dist/runtime/components/UnInput.vue.d.ts +4 -2
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -1,17 +1,30 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
2
|
name: string;
|
|
3
3
|
ctx?: Record<string, any>;
|
|
4
|
+
options?: Record<string, any>;
|
|
4
5
|
};
|
|
5
6
|
type __VLS_ModelProps = {
|
|
6
7
|
modelValue?: any;
|
|
7
8
|
};
|
|
8
9
|
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
9
|
-
declare
|
|
10
|
+
declare var __VLS_13: any, __VLS_14: {
|
|
11
|
+
item: any;
|
|
12
|
+
input: any;
|
|
13
|
+
isError: any;
|
|
14
|
+
option: any;
|
|
15
|
+
options: any;
|
|
16
|
+
};
|
|
17
|
+
type __VLS_Slots = {} & {
|
|
18
|
+
[K in NonNullable<typeof __VLS_13>]?: (props: typeof __VLS_14) => any;
|
|
19
|
+
};
|
|
20
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
10
21
|
validate: () => Promise<any>;
|
|
11
|
-
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
12
|
-
|
|
13
|
-
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
14
|
-
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
15
|
-
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
22
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
23
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
16
24
|
declare const _default: typeof __VLS_export;
|
|
17
25
|
export default _default;
|
|
26
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
27
|
+
new (): {
|
|
28
|
+
$slots: S;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
@@ -5,7 +5,23 @@
|
|
|
5
5
|
v-model="form"
|
|
6
6
|
:items="items?.map((e) => e.value)"
|
|
7
7
|
:errors
|
|
8
|
-
|
|
8
|
+
:options="options"
|
|
9
|
+
@update:key="$emit('update:key', $event)"
|
|
10
|
+
>
|
|
11
|
+
<template
|
|
12
|
+
v-for="i in items?.map((e) => e.value)"
|
|
13
|
+
#[_camelCase(i.input?.key)]="{ item, input, isError, option, options }"
|
|
14
|
+
>
|
|
15
|
+
<slot
|
|
16
|
+
:name="_camelCase(i.input?.key)"
|
|
17
|
+
:item="item"
|
|
18
|
+
:input="input"
|
|
19
|
+
:is-error="isError"
|
|
20
|
+
:option="option"
|
|
21
|
+
:options="options"
|
|
22
|
+
/>
|
|
23
|
+
</template>
|
|
24
|
+
</UnFormList>
|
|
9
25
|
</template>
|
|
10
26
|
|
|
11
27
|
<script setup>
|
|
@@ -13,6 +29,7 @@ import {
|
|
|
13
29
|
getForms,
|
|
14
30
|
formattedAddress,
|
|
15
31
|
_cloneDeep,
|
|
32
|
+
_camelCase,
|
|
16
33
|
ref,
|
|
17
34
|
useAsyncData,
|
|
18
35
|
useNuxtApp,
|
|
@@ -22,10 +39,12 @@ import {
|
|
|
22
39
|
} from "#imports";
|
|
23
40
|
const { name, ctx } = defineProps({
|
|
24
41
|
name: { type: String, required: true },
|
|
25
|
-
ctx: { type: Object, required: false }
|
|
42
|
+
ctx: { type: Object, required: false },
|
|
43
|
+
options: { type: Object, required: false }
|
|
26
44
|
});
|
|
27
45
|
const form = defineModel();
|
|
28
46
|
const schema = ref(null);
|
|
47
|
+
defineEmits(["update:key"]);
|
|
29
48
|
const { data: items } = useAsyncData("get-form", () => getForms(name), {
|
|
30
49
|
transform: (res) => Promise.allSettled(res?.map((e) => setOptions(e, ctx)) || [])
|
|
31
50
|
});
|
|
@@ -1,17 +1,30 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
2
|
name: string;
|
|
3
3
|
ctx?: Record<string, any>;
|
|
4
|
+
options?: Record<string, any>;
|
|
4
5
|
};
|
|
5
6
|
type __VLS_ModelProps = {
|
|
6
7
|
modelValue?: any;
|
|
7
8
|
};
|
|
8
9
|
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
9
|
-
declare
|
|
10
|
+
declare var __VLS_13: any, __VLS_14: {
|
|
11
|
+
item: any;
|
|
12
|
+
input: any;
|
|
13
|
+
isError: any;
|
|
14
|
+
option: any;
|
|
15
|
+
options: any;
|
|
16
|
+
};
|
|
17
|
+
type __VLS_Slots = {} & {
|
|
18
|
+
[K in NonNullable<typeof __VLS_13>]?: (props: typeof __VLS_14) => any;
|
|
19
|
+
};
|
|
20
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
10
21
|
validate: () => Promise<any>;
|
|
11
|
-
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
12
|
-
|
|
13
|
-
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
14
|
-
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
15
|
-
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
22
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
23
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
16
24
|
declare const _default: typeof __VLS_export;
|
|
17
25
|
export default _default;
|
|
26
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
27
|
+
new (): {
|
|
28
|
+
$slots: S;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
@@ -4,11 +4,28 @@ type __VLS_Props = {
|
|
|
4
4
|
options: InputOption[];
|
|
5
5
|
required?: boolean;
|
|
6
6
|
isError?: boolean;
|
|
7
|
+
option?: Record<string, any>;
|
|
7
8
|
};
|
|
8
9
|
type __VLS_ModelProps = {
|
|
9
10
|
modelValue?: any;
|
|
10
11
|
};
|
|
11
12
|
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
12
|
-
declare
|
|
13
|
+
declare var __VLS_64: {
|
|
14
|
+
item: Form;
|
|
15
|
+
input: any;
|
|
16
|
+
isError: boolean;
|
|
17
|
+
option: Record<string, any>;
|
|
18
|
+
options: InputOption[];
|
|
19
|
+
};
|
|
20
|
+
type __VLS_Slots = {} & {
|
|
21
|
+
default?: (props: typeof __VLS_64) => any;
|
|
22
|
+
};
|
|
23
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
24
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
13
25
|
declare const _default: typeof __VLS_export;
|
|
14
26
|
export default _default;
|
|
27
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
28
|
+
new (): {
|
|
29
|
+
$slots: S;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="flex flex-col gap-1 items-stretch text-base">
|
|
3
3
|
<UnLabel
|
|
4
|
-
v-if="Input?.title && Type !== 'switch'"
|
|
4
|
+
v-if="(option.title || Input?.title || '') && Type !== 'switch'"
|
|
5
5
|
:class="{ '!children:text-danger': isError }"
|
|
6
|
-
:header="Input.title + (required ? '*' : '')"
|
|
6
|
+
:header="(option.title || Input.title || '') + (required ? '*' : '')"
|
|
7
7
|
>
|
|
8
|
-
{{ Input?.description }}
|
|
8
|
+
{{ option.description || Input?.description || "" }}
|
|
9
9
|
</UnLabel>
|
|
10
10
|
<UnInput
|
|
11
11
|
v-if="(Type === 'text' || Type === 'number') && !Input?.multiSelect"
|
|
12
12
|
v-model="modelValue"
|
|
13
|
+
:precision="option.precision || Input.precision"
|
|
14
|
+
:append="option.append"
|
|
13
15
|
:Input="Input"
|
|
14
16
|
:Type="Type"
|
|
15
17
|
:disabled="item.disabled"
|
|
@@ -23,6 +25,7 @@
|
|
|
23
25
|
>
|
|
24
26
|
<UnInput
|
|
25
27
|
v-model="modelValue[index]"
|
|
28
|
+
:precision="option.precision || Input.precision"
|
|
26
29
|
:index="index"
|
|
27
30
|
class="grow"
|
|
28
31
|
:Input="Input"
|
|
@@ -96,9 +99,19 @@
|
|
|
96
99
|
:type="Type?.toLowerCase()"
|
|
97
100
|
@append="modelValue = null"
|
|
98
101
|
/>
|
|
99
|
-
<small v-if="Type === 'number' && modelValue">
|
|
100
|
-
{{ word }} {{ Input?.append || "" }}
|
|
102
|
+
<small v-if="Type === 'number' && modelValue && !option.notWord">
|
|
103
|
+
{{ word }} {{ option.append || Input?.append || "" }}
|
|
101
104
|
</small>
|
|
105
|
+
<small v-if="Input?.hint || option.hint">
|
|
106
|
+
{{ option.hint || Input?.hint || "" }}
|
|
107
|
+
</small>
|
|
108
|
+
<slot
|
|
109
|
+
:item="item"
|
|
110
|
+
:input="Input"
|
|
111
|
+
:is-error="isError"
|
|
112
|
+
:option="option"
|
|
113
|
+
:options="options"
|
|
114
|
+
/>
|
|
102
115
|
<UnButton
|
|
103
116
|
v-if="Input?.multiSelect && !['select', 'image'].includes(Type)"
|
|
104
117
|
variant="primary"
|
|
@@ -115,11 +128,12 @@ import PN from "persian-number";
|
|
|
115
128
|
import { computed } from "#imports";
|
|
116
129
|
import UnLocationInput from "./UnLocationInput.vue";
|
|
117
130
|
defineEmits(["update:modelValue"]);
|
|
118
|
-
const { item, options, required, isError } = defineProps({
|
|
131
|
+
const { item, options, required, isError, option = {} } = defineProps({
|
|
119
132
|
item: { type: Object, required: true },
|
|
120
133
|
options: { type: Array, required: true },
|
|
121
134
|
required: { type: Boolean, required: false },
|
|
122
|
-
isError: { type: Boolean, required: false }
|
|
135
|
+
isError: { type: Boolean, required: false },
|
|
136
|
+
option: { type: Object, required: false }
|
|
123
137
|
});
|
|
124
138
|
const Input = computed(() => item.input);
|
|
125
139
|
const Type = computed(() => Input.value?.type);
|
|
@@ -4,11 +4,28 @@ type __VLS_Props = {
|
|
|
4
4
|
options: InputOption[];
|
|
5
5
|
required?: boolean;
|
|
6
6
|
isError?: boolean;
|
|
7
|
+
option?: Record<string, any>;
|
|
7
8
|
};
|
|
8
9
|
type __VLS_ModelProps = {
|
|
9
10
|
modelValue?: any;
|
|
10
11
|
};
|
|
11
12
|
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
12
|
-
declare
|
|
13
|
+
declare var __VLS_64: {
|
|
14
|
+
item: Form;
|
|
15
|
+
input: any;
|
|
16
|
+
isError: boolean;
|
|
17
|
+
option: Record<string, any>;
|
|
18
|
+
options: InputOption[];
|
|
19
|
+
};
|
|
20
|
+
type __VLS_Slots = {} & {
|
|
21
|
+
default?: (props: typeof __VLS_64) => any;
|
|
22
|
+
};
|
|
23
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
24
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
13
25
|
declare const _default: typeof __VLS_export;
|
|
14
26
|
export default _default;
|
|
27
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
28
|
+
new (): {
|
|
29
|
+
$slots: S;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
@@ -2,17 +2,34 @@ import type { Form } from '../types/models.js';
|
|
|
2
2
|
type __VLS_Props = {
|
|
3
3
|
items: Partial<Form>[];
|
|
4
4
|
errors?: string[];
|
|
5
|
+
options?: Record<string, any>;
|
|
5
6
|
};
|
|
6
7
|
type __VLS_ModelProps = {
|
|
7
8
|
modelValue?: any;
|
|
8
9
|
};
|
|
9
10
|
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
10
|
-
declare
|
|
11
|
+
declare var __VLS_11: any, __VLS_12: {
|
|
12
|
+
item: any;
|
|
13
|
+
input: any;
|
|
14
|
+
isError: any;
|
|
15
|
+
option: any;
|
|
16
|
+
options: any;
|
|
17
|
+
};
|
|
18
|
+
type __VLS_Slots = {} & {
|
|
19
|
+
[K in NonNullable<typeof __VLS_11>]?: (props: typeof __VLS_12) => any;
|
|
20
|
+
};
|
|
21
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
11
22
|
schema: import("vue").ComputedRef<{
|
|
12
23
|
type: string;
|
|
13
24
|
properties: Partial<Form>;
|
|
14
25
|
required: string[];
|
|
15
26
|
}>;
|
|
16
27
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
28
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
17
29
|
declare const _default: typeof __VLS_export;
|
|
18
30
|
export default _default;
|
|
31
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
32
|
+
new (): {
|
|
33
|
+
$slots: S;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="flex flex-col gap-3 items-stretch">
|
|
3
|
+
<!-- <TheLog :data="schema"/> -->
|
|
3
4
|
<UnFormItem
|
|
4
5
|
v-for="item in items.filter(isActive)"
|
|
5
6
|
:key="item.id"
|
|
@@ -8,38 +9,45 @@
|
|
|
8
9
|
:item="item"
|
|
9
10
|
:required="inputIsRequire(item)"
|
|
10
11
|
:options="Options(item.input?.options || [])"
|
|
12
|
+
:option="options[_camelCase(item.input?.key)]"
|
|
11
13
|
:is-error="errors?.includes(_camelCase(item.input?.key))"
|
|
12
|
-
@update:model-value="$emit(
|
|
13
|
-
|
|
14
|
+
@update:model-value="$emit('update:key', { key: _camelCase(item.input?.key), value: $event })"
|
|
15
|
+
>
|
|
16
|
+
<template #default="{ item, input, isError, option, options }">
|
|
17
|
+
<slot
|
|
18
|
+
:name="_camelCase(item.input?.key)"
|
|
19
|
+
:item="item"
|
|
20
|
+
:input="input"
|
|
21
|
+
:is-error="isError"
|
|
22
|
+
:option="option"
|
|
23
|
+
:options="options"
|
|
24
|
+
/>
|
|
25
|
+
</template>
|
|
26
|
+
</UnFormItem>
|
|
14
27
|
</div>
|
|
15
28
|
</template>
|
|
16
29
|
|
|
17
30
|
<script setup>
|
|
18
|
-
import { _camelCase, _get, _set, computed } from "#imports";
|
|
19
|
-
const { items } = defineProps({
|
|
31
|
+
import { _camelCase, _get, _set, computed, isNil, isNumber } from "#imports";
|
|
32
|
+
const { items, options = {} } = defineProps({
|
|
20
33
|
items: { type: Array, required: true },
|
|
21
|
-
errors: { type: Array, required: false }
|
|
34
|
+
errors: { type: Array, required: false },
|
|
35
|
+
options: { type: Object, required: false }
|
|
22
36
|
});
|
|
23
|
-
defineEmits(["update:key"]);
|
|
24
37
|
const form = defineModel({ type: null, ...{ default: {} } });
|
|
38
|
+
defineEmits(["update:key"]);
|
|
39
|
+
const Option = (item) => options[_camelCase(item.input?.key)];
|
|
25
40
|
const getter = (key) => (e) => _get(e, key);
|
|
26
|
-
const inputIsRequire = (item) => item.requiredByValues?.length && item.requiredby ? item.requiredByValues.includes(`${form.value[_camelCase(item.requiredby)]}`) : item.activatedByValues?.length && item.requiredby ? item.activatedByValues.includes(`${form.value[_camelCase(item.requiredby)]}`) : item.requiredby ? form.value[_camelCase(item.requiredby)] : item.required;
|
|
27
|
-
const isActive = (item) => item.activatedByValues?.length && item.activatedBy ? item.activatedByValues.includes(`${form.value[_camelCase(item.activatedBy)]}`) : item.activatedBy ? form.value[_camelCase(item.activatedBy)] : true;
|
|
41
|
+
const inputIsRequire = (item) => item.requiredByValues?.length && item.requiredby ? item.requiredByValues.includes(`${form.value[_camelCase(item.requiredby)]}`) : item.activatedByValues?.length && item.requiredby ? item.activatedByValues.includes(`${form.value[_camelCase(item.requiredby)]}`) : item.requiredby ? form.value[_camelCase(item.requiredby)] : !isNil(Option(item)?.required) ? Option(item)?.required : item.required;
|
|
42
|
+
const isActive = (item) => item.activatedByValues?.length && item.activatedBy ? item.activatedByValues.includes(`${form.value[_camelCase(item.activatedBy)]}`) : !isNil(Option(item)?.activatedBy) || item.activatedBy ? form.value[_camelCase(isNil(Option(item)?.activatedBy) ? Option(item)?.activatedBy : item.activatedBy)] : true;
|
|
28
43
|
const Options = (item) => item.filter((e) => e.filteredByKey ? form.value[_camelCase(e.filteredByKey)] === e.filterOptionKey : true);
|
|
29
44
|
const requiredKeys = computed(() => items.filter(inputIsRequire).map(getter("input.key")).map(_camelCase));
|
|
30
45
|
const properties = computed(() => items.reduce((p, c) => {
|
|
31
|
-
if (c.input?.max || c
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
});
|
|
37
|
-
} else {
|
|
38
|
-
_set(p, c.input?.key, {
|
|
39
|
-
maxLength: c.input?.max || void 0,
|
|
40
|
-
minLength: c.input?.min || void 0
|
|
41
|
-
});
|
|
42
|
-
}
|
|
46
|
+
if (isNumber(c.input?.max) || isNumber(Option(c)?.max)) {
|
|
47
|
+
_set(p, [c.input?.key, c.input.type === "number" ? "maximum" : "maxLength"], Option(c)?.max || c.input?.max || 0);
|
|
48
|
+
}
|
|
49
|
+
if (isNumber(c.input?.min) || isNumber(Option(c)?.min)) {
|
|
50
|
+
_set(p, [c.input?.key, c.input.type === "number" ? "minimum" : "minLength"], Option(c)?.min || c.input?.min || 0);
|
|
43
51
|
}
|
|
44
52
|
return p;
|
|
45
53
|
}, {}));
|
|
@@ -2,17 +2,34 @@ import type { Form } from '../types/models.js';
|
|
|
2
2
|
type __VLS_Props = {
|
|
3
3
|
items: Partial<Form>[];
|
|
4
4
|
errors?: string[];
|
|
5
|
+
options?: Record<string, any>;
|
|
5
6
|
};
|
|
6
7
|
type __VLS_ModelProps = {
|
|
7
8
|
modelValue?: any;
|
|
8
9
|
};
|
|
9
10
|
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
10
|
-
declare
|
|
11
|
+
declare var __VLS_11: any, __VLS_12: {
|
|
12
|
+
item: any;
|
|
13
|
+
input: any;
|
|
14
|
+
isError: any;
|
|
15
|
+
option: any;
|
|
16
|
+
options: any;
|
|
17
|
+
};
|
|
18
|
+
type __VLS_Slots = {} & {
|
|
19
|
+
[K in NonNullable<typeof __VLS_11>]?: (props: typeof __VLS_12) => any;
|
|
20
|
+
};
|
|
21
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
11
22
|
schema: import("vue").ComputedRef<{
|
|
12
23
|
type: string;
|
|
13
24
|
properties: Partial<Form>;
|
|
14
25
|
required: string[];
|
|
15
26
|
}>;
|
|
16
27
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
28
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
17
29
|
declare const _default: typeof __VLS_export;
|
|
18
30
|
export default _default;
|
|
31
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
32
|
+
new (): {
|
|
33
|
+
$slots: S;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { Input } from '../types/models.js';
|
|
2
2
|
type __VLS_Props = {
|
|
3
3
|
disabled?: boolean;
|
|
4
|
-
Input?:
|
|
4
|
+
Input?: Input;
|
|
5
5
|
Type?: Input['type'];
|
|
6
6
|
isError?: boolean;
|
|
7
7
|
index?: number;
|
|
8
|
+
append?: string;
|
|
9
|
+
precision?: number;
|
|
8
10
|
};
|
|
9
|
-
declare const Input:
|
|
11
|
+
declare const Input: Input | undefined;
|
|
10
12
|
type __VLS_ModelProps = {
|
|
11
13
|
modelValue?: any;
|
|
12
14
|
};
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
@input="SetText"
|
|
17
17
|
>
|
|
18
18
|
<div
|
|
19
|
-
v-if="Input?.append"
|
|
19
|
+
v-if="append || Input?.append"
|
|
20
20
|
class="flex items-center justify-center text-gray-500"
|
|
21
21
|
>
|
|
22
|
-
{{ Input.append }}
|
|
22
|
+
{{ append || Input.append }}
|
|
23
23
|
</div>
|
|
24
24
|
</div>
|
|
25
25
|
</template>
|
|
@@ -27,14 +27,16 @@
|
|
|
27
27
|
<script setup>
|
|
28
28
|
import { s2n, p2e, computed } from "#imports";
|
|
29
29
|
import numeral from "numeral";
|
|
30
|
-
const { Type, Input } = defineProps({
|
|
30
|
+
const { Type, Input, precision = 0 } = defineProps({
|
|
31
31
|
disabled: { type: Boolean, required: false },
|
|
32
32
|
Input: { type: Object, required: false },
|
|
33
33
|
Type: { type: String, required: false },
|
|
34
34
|
isError: { type: Boolean, required: false },
|
|
35
|
-
index: { type: Number, required: false }
|
|
35
|
+
index: { type: Number, required: false },
|
|
36
|
+
append: { type: String, required: false },
|
|
37
|
+
precision: { type: Number, required: false }
|
|
36
38
|
});
|
|
37
39
|
const modelValue = defineModel({ type: null });
|
|
38
|
-
const Text = computed(() => Type === "number" ? numeral(modelValue.value).format("0,0") : ["numeric", "decimal"].includes(Input?.keyboadType) ? s2n(p2e(modelValue.value + "")) : modelValue.value);
|
|
40
|
+
const Text = computed(() => Type === "number" ? numeral(modelValue.value).format(precision ? `0,0[.][${"0".repeat(precision)}]` : "0,0") : ["numeric", "decimal"].includes(Input?.keyboadType) ? s2n(p2e(modelValue.value + "")) : modelValue.value);
|
|
39
41
|
const SetText = (v) => modelValue.value = Type === "number" ? Number(s2n(p2e(v.target.value || 0))) : v.target.value || "";
|
|
40
42
|
</script>
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { Input } from '../types/models.js';
|
|
2
2
|
type __VLS_Props = {
|
|
3
3
|
disabled?: boolean;
|
|
4
|
-
Input?:
|
|
4
|
+
Input?: Input;
|
|
5
5
|
Type?: Input['type'];
|
|
6
6
|
isError?: boolean;
|
|
7
7
|
index?: number;
|
|
8
|
+
append?: string;
|
|
9
|
+
precision?: number;
|
|
8
10
|
};
|
|
9
|
-
declare const Input:
|
|
11
|
+
declare const Input: Input | undefined;
|
|
10
12
|
type __VLS_ModelProps = {
|
|
11
13
|
modelValue?: any;
|
|
12
14
|
};
|