@unsource/ui 2.9.38 → 2.9.45
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/.vscode/settings.json +3 -3
- package/README.md +84 -84
- package/dist/module.json +1 -1
- package/dist/runtime/components/UnCollapsible.vue +24 -24
- 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 +26 -18
- 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/dist/runtime/components/UnList.vue +26 -26
- package/dist/runtime/components/UnProfile.vue +45 -45
- package/dist/runtime/components/UnRadioItem.vue +24 -24
- package/dist/runtime/components/UnSelect.vue +114 -108
- package/dist/runtime/components/UnTableRow.vue +74 -74
- package/dist/runtime/components/UnWalletActions.vue +25 -25
- package/dist/runtime/server/tsconfig.json +3 -3
- package/package.json +103 -103
package/.vscode/settings.json
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
{
|
|
2
|
-
"eslint.experimental.useFlatConfig": true
|
|
3
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"eslint.experimental.useFlatConfig": true
|
|
3
|
+
}
|
package/README.md
CHANGED
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
Get your module up and running quickly.
|
|
3
|
-
|
|
4
|
-
Find and replace all on all files (CMD+SHIFT+F):
|
|
5
|
-
- Name: My Module
|
|
6
|
-
- Package name: my-module
|
|
7
|
-
- Description: My new Nuxt module
|
|
8
|
-
-->
|
|
9
|
-
|
|
10
|
-
# My Module
|
|
11
|
-
|
|
12
|
-
[![npm version][npm-version-src]][npm-version-href]
|
|
13
|
-
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
14
|
-
[![License][license-src]][license-href]
|
|
15
|
-
[![Nuxt][nuxt-src]][nuxt-href]
|
|
16
|
-
|
|
17
|
-
My new Nuxt module for doing amazing things.
|
|
18
|
-
|
|
19
|
-
- [✨ Release Notes](/CHANGELOG.md)
|
|
20
|
-
<!-- - [🏀 Online playground](https://stackblitz.com/github/your-org/my-module?file=playground%2Fapp.vue) -->
|
|
21
|
-
<!-- - [📖 Documentation](https://example.com) -->
|
|
22
|
-
|
|
23
|
-
## Features
|
|
24
|
-
|
|
25
|
-
<!-- Highlight some of the features your module provide here -->
|
|
26
|
-
- ⛰ Foo
|
|
27
|
-
- 🚠 Bar
|
|
28
|
-
- 🌲 Baz
|
|
29
|
-
|
|
30
|
-
## Quick Setup
|
|
31
|
-
|
|
32
|
-
Install the module to your Nuxt application with one command:
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
npx nuxi module add my-module
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
That's it! You can now use My Module in your Nuxt app ✨
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
## Contribution
|
|
42
|
-
|
|
43
|
-
<details>
|
|
44
|
-
<summary>Local development</summary>
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
# Install dependencies
|
|
48
|
-
npm install
|
|
49
|
-
|
|
50
|
-
# Generate type stubs
|
|
51
|
-
npm run dev:prepare
|
|
52
|
-
|
|
53
|
-
# Develop with the playground
|
|
54
|
-
npm run dev
|
|
55
|
-
|
|
56
|
-
# Build the playground
|
|
57
|
-
npm run dev:build
|
|
58
|
-
|
|
59
|
-
# Run ESLint
|
|
60
|
-
npm run lint
|
|
61
|
-
|
|
62
|
-
# Run Vitest
|
|
63
|
-
npm run test
|
|
64
|
-
npm run test:watch
|
|
65
|
-
|
|
66
|
-
# Release new version
|
|
67
|
-
npm run release
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
</details>
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
<!-- Badges -->
|
|
74
|
-
[npm-version-src]: https://img.shields.io/npm/v/my-module/latest.svg?style=flat&colorA=020420&colorB=00DC82
|
|
75
|
-
[npm-version-href]: https://npmjs.com/package/my-module
|
|
76
|
-
|
|
77
|
-
[npm-downloads-src]: https://img.shields.io/npm/dm/my-module.svg?style=flat&colorA=020420&colorB=00DC82
|
|
78
|
-
[npm-downloads-href]: https://npm.chart.dev/my-module
|
|
79
|
-
|
|
80
|
-
[license-src]: https://img.shields.io/npm/l/my-module.svg?style=flat&colorA=020420&colorB=00DC82
|
|
81
|
-
[license-href]: https://npmjs.com/package/my-module
|
|
82
|
-
|
|
83
|
-
[nuxt-src]: https://img.shields.io/badge/Nuxt-020420?logo=nuxt.js
|
|
84
|
-
[nuxt-href]: https://nuxt.com
|
|
1
|
+
<!--
|
|
2
|
+
Get your module up and running quickly.
|
|
3
|
+
|
|
4
|
+
Find and replace all on all files (CMD+SHIFT+F):
|
|
5
|
+
- Name: My Module
|
|
6
|
+
- Package name: my-module
|
|
7
|
+
- Description: My new Nuxt module
|
|
8
|
+
-->
|
|
9
|
+
|
|
10
|
+
# My Module
|
|
11
|
+
|
|
12
|
+
[![npm version][npm-version-src]][npm-version-href]
|
|
13
|
+
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
14
|
+
[![License][license-src]][license-href]
|
|
15
|
+
[![Nuxt][nuxt-src]][nuxt-href]
|
|
16
|
+
|
|
17
|
+
My new Nuxt module for doing amazing things.
|
|
18
|
+
|
|
19
|
+
- [✨ Release Notes](/CHANGELOG.md)
|
|
20
|
+
<!-- - [🏀 Online playground](https://stackblitz.com/github/your-org/my-module?file=playground%2Fapp.vue) -->
|
|
21
|
+
<!-- - [📖 Documentation](https://example.com) -->
|
|
22
|
+
|
|
23
|
+
## Features
|
|
24
|
+
|
|
25
|
+
<!-- Highlight some of the features your module provide here -->
|
|
26
|
+
- ⛰ Foo
|
|
27
|
+
- 🚠 Bar
|
|
28
|
+
- 🌲 Baz
|
|
29
|
+
|
|
30
|
+
## Quick Setup
|
|
31
|
+
|
|
32
|
+
Install the module to your Nuxt application with one command:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npx nuxi module add my-module
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
That's it! You can now use My Module in your Nuxt app ✨
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
## Contribution
|
|
42
|
+
|
|
43
|
+
<details>
|
|
44
|
+
<summary>Local development</summary>
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# Install dependencies
|
|
48
|
+
npm install
|
|
49
|
+
|
|
50
|
+
# Generate type stubs
|
|
51
|
+
npm run dev:prepare
|
|
52
|
+
|
|
53
|
+
# Develop with the playground
|
|
54
|
+
npm run dev
|
|
55
|
+
|
|
56
|
+
# Build the playground
|
|
57
|
+
npm run dev:build
|
|
58
|
+
|
|
59
|
+
# Run ESLint
|
|
60
|
+
npm run lint
|
|
61
|
+
|
|
62
|
+
# Run Vitest
|
|
63
|
+
npm run test
|
|
64
|
+
npm run test:watch
|
|
65
|
+
|
|
66
|
+
# Release new version
|
|
67
|
+
npm run release
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
</details>
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
<!-- Badges -->
|
|
74
|
+
[npm-version-src]: https://img.shields.io/npm/v/my-module/latest.svg?style=flat&colorA=020420&colorB=00DC82
|
|
75
|
+
[npm-version-href]: https://npmjs.com/package/my-module
|
|
76
|
+
|
|
77
|
+
[npm-downloads-src]: https://img.shields.io/npm/dm/my-module.svg?style=flat&colorA=020420&colorB=00DC82
|
|
78
|
+
[npm-downloads-href]: https://npm.chart.dev/my-module
|
|
79
|
+
|
|
80
|
+
[license-src]: https://img.shields.io/npm/l/my-module.svg?style=flat&colorA=020420&colorB=00DC82
|
|
81
|
+
[license-href]: https://npmjs.com/package/my-module
|
|
82
|
+
|
|
83
|
+
[nuxt-src]: https://img.shields.io/badge/Nuxt-020420?logo=nuxt.js
|
|
84
|
+
[nuxt-href]: https://nuxt.com
|
package/dist/module.json
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="flex flex-col p-3 bg-white rounded-2xl gap-4"
|
|
4
|
-
>
|
|
5
|
-
<div
|
|
6
|
-
:class="customClass?.header"
|
|
7
|
-
class="cursor-pointer flex items-center justify-between"
|
|
8
|
-
@click="show = !show"
|
|
9
|
-
>
|
|
10
|
-
<UnCard
|
|
11
|
-
:item="{ avatar: icon, title, tags, description }"
|
|
12
|
-
:class="customClass.card"
|
|
13
|
-
:custom-class="customClass.cardInside"
|
|
14
|
-
/>
|
|
15
|
-
<UnNuxtIcon
|
|
16
|
-
:class="customClass?.collapsibleIcon"
|
|
17
|
-
:name="collapsibleIcon || 'solar:alt-arrow-down-bold-duotone'"
|
|
18
|
-
class="transition-all duration-300"
|
|
19
|
-
:style="{ rotate: show && !noRotate ? '180deg' : '0deg' }"
|
|
20
|
-
/>
|
|
21
|
-
</div>
|
|
22
|
-
<template v-if="show">
|
|
23
|
-
<slot />
|
|
24
|
-
</template>
|
|
25
|
-
</div>
|
|
2
|
+
<div
|
|
3
|
+
class="flex flex-col p-3 bg-white rounded-2xl gap-4"
|
|
4
|
+
>
|
|
5
|
+
<div
|
|
6
|
+
:class="customClass?.header"
|
|
7
|
+
class="cursor-pointer flex items-center justify-between"
|
|
8
|
+
@click="show = !show"
|
|
9
|
+
>
|
|
10
|
+
<UnCard
|
|
11
|
+
:item="{ avatar: icon, title, tags, description }"
|
|
12
|
+
:class="customClass.card"
|
|
13
|
+
:custom-class="customClass.cardInside"
|
|
14
|
+
/>
|
|
15
|
+
<UnNuxtIcon
|
|
16
|
+
:class="customClass?.collapsibleIcon"
|
|
17
|
+
:name="collapsibleIcon || 'solar:alt-arrow-down-bold-duotone'"
|
|
18
|
+
class="transition-all duration-300"
|
|
19
|
+
:style="{ rotate: show && !noRotate ? '180deg' : '0deg' }"
|
|
20
|
+
/>
|
|
21
|
+
</div>
|
|
22
|
+
<template v-if="show">
|
|
23
|
+
<slot />
|
|
24
|
+
</template>
|
|
25
|
+
</div>
|
|
26
26
|
</template>
|
|
27
27
|
|
|
28
28
|
<script setup>
|
|
@@ -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, 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
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)] : item.required;
|
|
27
42
|
const isActive = (item) => item.activatedByValues?.length && item.activatedBy ? item.activatedByValues.includes(`${form.value[_camelCase(item.activatedBy)]}`) : item.activatedBy ? form.value[_camelCase(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
|
};
|