@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
|
@@ -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
|
};
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="flex flex-col p-3 bg-white rounded-2xl gap-4"
|
|
4
|
-
>
|
|
5
|
-
<div
|
|
6
|
-
v-if="title || $slots.default"
|
|
7
|
-
:class="customClass?.header"
|
|
8
|
-
class="flex items-center justify-between"
|
|
9
|
-
>
|
|
10
|
-
<h3
|
|
11
|
-
v-if="title"
|
|
12
|
-
:class="customClass?.title"
|
|
13
|
-
class="text-(lg gray-600) font-semibold"
|
|
14
|
-
>
|
|
15
|
-
{{ title }}
|
|
16
|
-
</h3>
|
|
17
|
-
<slot />
|
|
18
|
-
</div>
|
|
19
|
-
<UnCard
|
|
20
|
-
v-for="(item, index) in items"
|
|
21
|
-
:key="index"
|
|
22
|
-
:class="customClass.items"
|
|
23
|
-
:custom-class="customClass.item"
|
|
24
|
-
:item="item"
|
|
25
|
-
:to="to?.(item)"
|
|
26
|
-
/>
|
|
27
|
-
</div>
|
|
2
|
+
<div
|
|
3
|
+
class="flex flex-col p-3 bg-white rounded-2xl gap-4"
|
|
4
|
+
>
|
|
5
|
+
<div
|
|
6
|
+
v-if="title || $slots.default"
|
|
7
|
+
:class="customClass?.header"
|
|
8
|
+
class="flex items-center justify-between"
|
|
9
|
+
>
|
|
10
|
+
<h3
|
|
11
|
+
v-if="title"
|
|
12
|
+
:class="customClass?.title"
|
|
13
|
+
class="text-(lg gray-600) font-semibold"
|
|
14
|
+
>
|
|
15
|
+
{{ title }}
|
|
16
|
+
</h3>
|
|
17
|
+
<slot />
|
|
18
|
+
</div>
|
|
19
|
+
<UnCard
|
|
20
|
+
v-for="(item, index) in items"
|
|
21
|
+
:key="index"
|
|
22
|
+
:class="customClass.items"
|
|
23
|
+
:custom-class="customClass.item"
|
|
24
|
+
:item="item"
|
|
25
|
+
:to="to?.(item)"
|
|
26
|
+
/>
|
|
27
|
+
</div>
|
|
28
28
|
</template>
|
|
29
29
|
|
|
30
30
|
<script setup>
|
|
@@ -1,52 +1,52 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="grow flex flex-col gap-3">
|
|
3
|
-
<div class="flex flex-col items-stretch gap-3 grow-1 p-4">
|
|
4
|
-
<UnCard
|
|
5
|
-
v-for="(item, index) in items.filter((e) => !e.disable)"
|
|
6
|
-
:key="index"
|
|
2
|
+
<div class="grow flex flex-col gap-3">
|
|
3
|
+
<div class="flex flex-col items-stretch gap-3 grow-1 p-4">
|
|
4
|
+
<UnCard
|
|
5
|
+
v-for="(item, index) in items.filter((e) => !e.disable)"
|
|
6
|
+
:key="index"
|
|
7
7
|
:custom-class="_mergeWith(customClass.item, {
|
|
8
8
|
logo: '!w-8 !h-8 !border-none !rounded-0',
|
|
9
9
|
body: '!items-center'
|
|
10
|
-
}, merge)"
|
|
11
|
-
:class="customClass.items"
|
|
12
|
-
:to="item.to"
|
|
13
|
-
:item="item"
|
|
14
|
-
@click="item.handler?.()"
|
|
15
|
-
>
|
|
16
|
-
<template #header>
|
|
17
|
-
<UnNuxtIcon
|
|
18
|
-
:class="customClass.appendIcon"
|
|
19
|
-
:name="item.appendIcon || 'solar:alt-arrow-left-line-duotone'"
|
|
20
|
-
class="text-sm"
|
|
21
|
-
/>
|
|
22
|
-
</template>
|
|
23
|
-
</UnCard>
|
|
24
|
-
</div>
|
|
25
|
-
<div class="grow" />
|
|
26
|
-
<div class="flex flex-col gap-2 text-sm text-center self-stretch">
|
|
27
|
-
<slot>
|
|
28
|
-
<NuxtLink
|
|
29
|
-
v-if="developer"
|
|
30
|
-
:to="developerLink || '#'"
|
|
31
|
-
target="_blank"
|
|
32
|
-
class="flex justify-center gap-1 self-center"
|
|
33
|
-
>طراحی و توسعه توسط <span class="text-blue-6 font-bold">{{ developer }}</span>
|
|
34
|
-
<UnNuxtIcon
|
|
35
|
-
v-if="developerIcon"
|
|
36
|
-
:name="developerIcon"
|
|
37
|
-
class="!text-xl"
|
|
38
|
-
/>
|
|
39
|
-
</NuxtLink>
|
|
40
|
-
<p v-if="owner">
|
|
41
|
-
کلیه حقوق مادی و معنوی این نرمافزار متعلق به شرکت <span class="text-primary-500 font-bold">{{ owner }}</span>
|
|
42
|
-
میباشد.
|
|
43
|
-
</p>
|
|
44
|
-
<p v-if="version">
|
|
45
|
-
V{{ version }}
|
|
46
|
-
</p>
|
|
47
|
-
</slot>
|
|
48
|
-
</div>
|
|
49
|
-
</div>
|
|
10
|
+
}, merge)"
|
|
11
|
+
:class="customClass.items"
|
|
12
|
+
:to="item.to"
|
|
13
|
+
:item="item"
|
|
14
|
+
@click="item.handler?.()"
|
|
15
|
+
>
|
|
16
|
+
<template #header>
|
|
17
|
+
<UnNuxtIcon
|
|
18
|
+
:class="customClass.appendIcon"
|
|
19
|
+
:name="item.appendIcon || 'solar:alt-arrow-left-line-duotone'"
|
|
20
|
+
class="text-sm"
|
|
21
|
+
/>
|
|
22
|
+
</template>
|
|
23
|
+
</UnCard>
|
|
24
|
+
</div>
|
|
25
|
+
<div class="grow" />
|
|
26
|
+
<div class="flex flex-col gap-2 text-sm text-center self-stretch">
|
|
27
|
+
<slot>
|
|
28
|
+
<NuxtLink
|
|
29
|
+
v-if="developer"
|
|
30
|
+
:to="developerLink || '#'"
|
|
31
|
+
target="_blank"
|
|
32
|
+
class="flex justify-center gap-1 self-center"
|
|
33
|
+
>طراحی و توسعه توسط <span class="text-blue-6 font-bold">{{ developer }}</span>
|
|
34
|
+
<UnNuxtIcon
|
|
35
|
+
v-if="developerIcon"
|
|
36
|
+
:name="developerIcon"
|
|
37
|
+
class="!text-xl"
|
|
38
|
+
/>
|
|
39
|
+
</NuxtLink>
|
|
40
|
+
<p v-if="owner">
|
|
41
|
+
کلیه حقوق مادی و معنوی این نرمافزار متعلق به شرکت <span class="text-primary-500 font-bold">{{ owner }}</span>
|
|
42
|
+
میباشد.
|
|
43
|
+
</p>
|
|
44
|
+
<p v-if="version">
|
|
45
|
+
V{{ version }}
|
|
46
|
+
</p>
|
|
47
|
+
</slot>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
50
|
</template>
|
|
51
51
|
|
|
52
52
|
<script setup>
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="relative select-none group px-4 py-3 flex flex-row items-center gap-3 transition duration-300 hover:bg-primary-500/10 border-0 min-w-fit"
|
|
4
|
-
:class="{ 'opacity-50 grayscale': disabled, 'disable': disabled, 'selected': selected }"
|
|
5
|
-
@click.prevent.stop="toggle"
|
|
6
|
-
>
|
|
7
|
-
<div
|
|
8
|
-
name="radio"
|
|
9
|
-
:class="customClass.radio"
|
|
10
|
-
class="group-[.disable]:border-secondary border-(1 solid primary) rounded-1/2 w-4 h-4 flex justify-center items-center"
|
|
11
|
-
>
|
|
12
|
-
<div
|
|
13
|
-
name="radioInside"
|
|
14
|
-
class="bg-primary-500 rounded-1/2 h-10px w-10px transition-opacity duration-200"
|
|
15
|
-
:class="[customClass.radioInside, selected ? 'opacity-full' : 'opacity-0']"
|
|
16
|
-
/>
|
|
17
|
-
</div>
|
|
18
|
-
<UnCard
|
|
19
|
-
:item="item"
|
|
20
|
-
class="!bg-transparent grow-1"
|
|
21
|
-
:class="customClass.card"
|
|
22
|
-
:custom-class="customClass.item"
|
|
23
|
-
:info-icon="infoIcon"
|
|
24
|
-
/>
|
|
25
|
-
</div>
|
|
2
|
+
<div
|
|
3
|
+
class="relative select-none group px-4 py-3 flex flex-row items-center gap-3 transition duration-300 hover:bg-primary-500/10 border-0 min-w-fit"
|
|
4
|
+
:class="{ 'opacity-50 grayscale': disabled, 'disable': disabled, 'selected': selected }"
|
|
5
|
+
@click.prevent.stop="toggle"
|
|
6
|
+
>
|
|
7
|
+
<div
|
|
8
|
+
name="radio"
|
|
9
|
+
:class="customClass.radio"
|
|
10
|
+
class="group-[.disable]:border-secondary border-(1 solid primary) rounded-1/2 w-4 h-4 flex justify-center items-center"
|
|
11
|
+
>
|
|
12
|
+
<div
|
|
13
|
+
name="radioInside"
|
|
14
|
+
class="bg-primary-500 rounded-1/2 h-10px w-10px transition-opacity duration-200"
|
|
15
|
+
:class="[customClass.radioInside, selected ? 'opacity-full' : 'opacity-0']"
|
|
16
|
+
/>
|
|
17
|
+
</div>
|
|
18
|
+
<UnCard
|
|
19
|
+
:item="item"
|
|
20
|
+
class="!bg-transparent grow-1"
|
|
21
|
+
:class="customClass.card"
|
|
22
|
+
:custom-class="customClass.item"
|
|
23
|
+
:info-icon="infoIcon"
|
|
24
|
+
/>
|
|
25
|
+
</div>
|
|
26
26
|
</template>
|
|
27
27
|
|
|
28
28
|
<script setup>
|
|
@@ -1,117 +1,118 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
ref="wrapper"
|
|
4
|
-
class="cursor-pointer relative"
|
|
5
|
-
>
|
|
6
|
-
<div
|
|
7
|
-
v-if="!inline"
|
|
8
|
-
:id
|
|
9
|
-
name="header"
|
|
10
|
-
:class="customClass.header"
|
|
11
|
-
class="bg-white h-12 rounded-2xl flex flex-row gap-1 items-center px-2 py-1 cursor-pointer text-black-1 relative"
|
|
12
|
-
@click="!readonly && !inline ? toggle() : ''"
|
|
13
|
-
>
|
|
14
|
-
<UnNuxtIcon
|
|
15
|
-
v-if="icon"
|
|
16
|
-
:name="icon"
|
|
17
|
-
:class="customClass.icon"
|
|
18
|
-
class="text-xl"
|
|
19
|
-
/>
|
|
20
|
-
<p
|
|
21
|
-
name="label"
|
|
22
|
-
:class="customClass.label"
|
|
23
|
-
class="flex-grow text-sm select-none whitespace-nowrap"
|
|
24
|
-
>
|
|
25
|
-
{{
|
|
26
|
-
(multi && isArray(value) && !value?.length || isNil(value) ? placeholder : multi ? value.map((v) => Label(IsSelected(v))?.title).join(", ") : Label(Selected)?.title) || placeholder
|
|
27
|
-
}}
|
|
28
|
-
</p>
|
|
29
|
-
<UnNuxtIcon
|
|
30
|
-
name="iconsax:arrow-down-bold"
|
|
31
|
-
class="transform transition-transform duration-300 text-xl"
|
|
32
|
-
:class="[customClass.arrowIcon, { 'rotate-180': show }]"
|
|
33
|
-
/>
|
|
34
|
-
</div>
|
|
35
|
-
<Teleport
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
v-on-click-outside="close"
|
|
42
|
-
name="wrapper"
|
|
43
|
-
|
|
44
|
-
|
|
2
|
+
<div
|
|
3
|
+
ref="wrapper"
|
|
4
|
+
class="cursor-pointer relative"
|
|
5
|
+
>
|
|
6
|
+
<div
|
|
7
|
+
v-if="!inline"
|
|
8
|
+
:id
|
|
9
|
+
name="header"
|
|
10
|
+
:class="customClass.header"
|
|
11
|
+
class="bg-white h-12 rounded-2xl flex flex-row gap-1 items-center px-2 py-1 cursor-pointer text-black-1 relative"
|
|
12
|
+
@click="!readonly && !inline ? toggle() : ''"
|
|
13
|
+
>
|
|
14
|
+
<UnNuxtIcon
|
|
15
|
+
v-if="icon"
|
|
16
|
+
:name="icon"
|
|
17
|
+
:class="customClass.icon"
|
|
18
|
+
class="text-xl"
|
|
19
|
+
/>
|
|
20
|
+
<p
|
|
21
|
+
name="label"
|
|
22
|
+
:class="customClass.label"
|
|
23
|
+
class="flex-grow text-sm select-none whitespace-nowrap"
|
|
24
|
+
>
|
|
25
|
+
{{
|
|
26
|
+
(multi && isArray(value) && !value?.length || isNil(value) ? placeholder : multi ? value.map((v) => Label(IsSelected(v))?.title).join(", ") : Label(Selected)?.title) || placeholder
|
|
27
|
+
}}
|
|
28
|
+
</p>
|
|
29
|
+
<UnNuxtIcon
|
|
30
|
+
name="iconsax:arrow-down-bold"
|
|
31
|
+
class="transform transition-transform duration-300 text-xl"
|
|
32
|
+
:class="[customClass.arrowIcon, { 'rotate-180': show }]"
|
|
33
|
+
/>
|
|
34
|
+
</div>
|
|
35
|
+
<Teleport
|
|
36
|
+
:disabled="inline"
|
|
37
|
+
to="body"
|
|
38
|
+
>
|
|
39
|
+
<div
|
|
40
|
+
v-show="show && !readonly || inline"
|
|
41
|
+
v-on-click-outside="close"
|
|
42
|
+
name="wrapper"
|
|
43
|
+
ref="list"
|
|
44
|
+
:style="!isMobile && !inline && dropdownStyles"
|
|
45
|
+
class="z-1000 md:mt-3 rounded-2xl w-auto <md:w-full min-w-fit text-base flex flex-col items-stretch overflow-y-auto scrollbar-thin"
|
|
45
46
|
:class="[
|
|
46
47
|
customClass.wrapper,
|
|
47
48
|
inline ? 'relative' : 'absolute <md:(bg-black/10 fixed inset-0 backdrop-blur-xs justify-end)',
|
|
48
49
|
light ? 'bg-white' : 'bg-border',
|
|
49
50
|
inline ? '' : Searchable ? 'md:max-h-230px' : 'md:max-h-160px'
|
|
50
|
-
]"
|
|
51
|
-
>
|
|
52
|
-
<div
|
|
53
|
-
name="innerWrapper"
|
|
54
|
-
:class="customClass.innerWrapper"
|
|
55
|
-
class="flex flex-col items-stretch min-w-fit <md:(max-h-80dvh bg-white border-(1 solid primary) rounded-t-2xl pb-24)"
|
|
56
|
-
>
|
|
57
|
-
<UnSearch
|
|
58
|
-
v-if="Searchable"
|
|
59
|
-
v-model="search"
|
|
60
|
-
name="search"
|
|
61
|
-
:class="customClass.search"
|
|
62
|
-
class="h-10"
|
|
63
|
-
placeholder="جستجو..."
|
|
64
|
-
/>
|
|
65
|
-
<div
|
|
66
|
-
name="list"
|
|
67
|
-
:class="customClass.list"
|
|
68
|
-
class="min-w-fit divide-(y dashed border) flex flex-col items-stretch overflow-y-auto scrollbar-width-thin !children:b-x-0"
|
|
69
|
-
>
|
|
70
|
-
<template v-if="multi">
|
|
71
|
-
<UnCheckboxItem
|
|
72
|
-
v-for="option in searchedOptions"
|
|
73
|
-
:key="Value(option)"
|
|
74
|
-
:value="Value(option)"
|
|
75
|
-
:item="Label(option)"
|
|
76
|
-
:class="customClass.checkbox"
|
|
77
|
-
:custom-class="customClass.checkboxItem"
|
|
78
|
-
:selected="value?.includes?.(Value(option))"
|
|
79
|
-
:disabled="option.disable"
|
|
80
|
-
@click="handleSelect(option)"
|
|
81
|
-
/>
|
|
82
|
-
<UnButton
|
|
83
|
-
v-if="!inline"
|
|
84
|
-
variant="primary-fill"
|
|
85
|
-
label="تایید"
|
|
86
|
-
class="m-2"
|
|
87
|
-
:class="customClass.checkboxButton"
|
|
88
|
-
@click="close"
|
|
89
|
-
/>
|
|
90
|
-
</template>
|
|
91
|
-
<template v-else>
|
|
92
|
-
<UnRadioItem
|
|
93
|
-
v-for="option in searchedOptions"
|
|
94
|
-
:key="Value(option)"
|
|
95
|
-
:value="Value(option)"
|
|
96
|
-
:item="Label(option)"
|
|
97
|
-
:class="customClass.radio"
|
|
98
|
-
:custom-class="customClass.radioItem"
|
|
99
|
-
:selected="isEqual(Value(option), value)"
|
|
100
|
-
:disabled="option.disable"
|
|
101
|
-
class="!min-w-60"
|
|
102
|
-
@click="handleSelect(option)"
|
|
103
|
-
/>
|
|
104
|
-
</template>
|
|
105
|
-
</div>
|
|
106
|
-
</div>
|
|
107
|
-
</div>
|
|
108
|
-
</Teleport>
|
|
109
|
-
</div>
|
|
51
|
+
]"
|
|
52
|
+
>
|
|
53
|
+
<div
|
|
54
|
+
name="innerWrapper"
|
|
55
|
+
:class="customClass.innerWrapper"
|
|
56
|
+
class="flex flex-col items-stretch min-w-fit <md:(max-h-80dvh bg-white border-(1 solid primary) rounded-t-2xl pb-24)"
|
|
57
|
+
>
|
|
58
|
+
<UnSearch
|
|
59
|
+
v-if="Searchable"
|
|
60
|
+
v-model="search"
|
|
61
|
+
name="search"
|
|
62
|
+
:class="customClass.search"
|
|
63
|
+
class="h-10"
|
|
64
|
+
placeholder="جستجو..."
|
|
65
|
+
/>
|
|
66
|
+
<div
|
|
67
|
+
name="list"
|
|
68
|
+
:class="customClass.list"
|
|
69
|
+
class="min-w-fit divide-(y dashed border) flex flex-col items-stretch overflow-y-auto scrollbar-width-thin !children:b-x-0"
|
|
70
|
+
>
|
|
71
|
+
<template v-if="multi">
|
|
72
|
+
<UnCheckboxItem
|
|
73
|
+
v-for="option in searchedOptions"
|
|
74
|
+
:key="Value(option)"
|
|
75
|
+
:value="Value(option)"
|
|
76
|
+
:item="Label(option)"
|
|
77
|
+
:class="customClass.checkbox"
|
|
78
|
+
:custom-class="customClass.checkboxItem"
|
|
79
|
+
:selected="value?.includes?.(Value(option))"
|
|
80
|
+
:disabled="option.disable"
|
|
81
|
+
@click="handleSelect(option)"
|
|
82
|
+
/>
|
|
83
|
+
<UnButton
|
|
84
|
+
v-if="!inline"
|
|
85
|
+
variant="primary-fill"
|
|
86
|
+
label="تایید"
|
|
87
|
+
class="m-2"
|
|
88
|
+
:class="customClass.checkboxButton"
|
|
89
|
+
@click="close"
|
|
90
|
+
/>
|
|
91
|
+
</template>
|
|
92
|
+
<template v-else>
|
|
93
|
+
<UnRadioItem
|
|
94
|
+
v-for="option in searchedOptions"
|
|
95
|
+
:key="Value(option)"
|
|
96
|
+
:value="Value(option)"
|
|
97
|
+
:item="Label(option)"
|
|
98
|
+
:class="customClass.radio"
|
|
99
|
+
:custom-class="customClass.radioItem"
|
|
100
|
+
:selected="isEqual(Value(option), value)"
|
|
101
|
+
:disabled="option.disable"
|
|
102
|
+
class="!min-w-60"
|
|
103
|
+
@click="handleSelect(option)"
|
|
104
|
+
/>
|
|
105
|
+
</template>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
</Teleport>
|
|
110
|
+
</div>
|
|
110
111
|
</template>
|
|
111
112
|
|
|
112
113
|
<script setup>
|
|
113
114
|
import { vOnClickOutside } from "@vueuse/components";
|
|
114
|
-
import { _get, computed, isArray, isEqual, isNil, nextTick, ref, useDevice, useId, watch } from "#imports";
|
|
115
|
+
import { _get, computed, isArray, isEqual, isNil, nextTick, ref, useDevice, useId, useTemplateRef, watch } from "#imports";
|
|
115
116
|
const { isMobile } = useDevice();
|
|
116
117
|
const { valueKey, items, multi, searchable, customClass = {} } = defineProps({
|
|
117
118
|
placeholder: { type: String, required: false },
|
|
@@ -166,14 +167,19 @@ const handleSelect = (data) => {
|
|
|
166
167
|
value.value = items2;
|
|
167
168
|
};
|
|
168
169
|
const wrapper = ref(null);
|
|
170
|
+
const list = useTemplateRef("list");
|
|
169
171
|
const updateDropdownPosition = () => {
|
|
170
172
|
if (!wrapper.value) return;
|
|
173
|
+
if (!list.value) return;
|
|
171
174
|
const rect = wrapper.value.getBoundingClientRect();
|
|
175
|
+
const mainRect = list.value.getBoundingClientRect();
|
|
176
|
+
console.log(mainRect, rect, window.scrollY, window.innerWidth, window.innerHeight);
|
|
172
177
|
dropdownStyles.value = {
|
|
173
|
-
position:
|
|
174
|
-
top: `${rect.bottom + window.scrollY}px`,
|
|
175
|
-
|
|
176
|
-
width: `${rect.
|
|
178
|
+
// position: 'absolute',
|
|
179
|
+
top: mainRect.height > window.innerHeight - rect.bottom ? "auto" : `${rect.bottom + window.scrollY}px`,
|
|
180
|
+
bottom: mainRect.height > window.innerHeight - rect.bottom ? `${window.innerHeight - rect.top - window.scrollY + 5}px` : "auto",
|
|
181
|
+
right: mainRect.width > rect.right ? `${window.innerWidth - mainRect.width - 5}px` : `${window.innerWidth - rect.right}px`,
|
|
182
|
+
// width: `${rect.width}px`,
|
|
177
183
|
zIndex: "1000"
|
|
178
184
|
};
|
|
179
185
|
};
|
|
@@ -1,79 +1,79 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<tr
|
|
3
|
-
class="children:p-3 <md:children:p-1 text-center border-b-(2 solid border) hover:bg-primary-500/10"
|
|
4
|
-
:class="[trClass?.(item, items), { '!bg-primary-500/20': selected?.[idKey] === item[idKey] }]"
|
|
2
|
+
<tr
|
|
3
|
+
class="children:p-3 <md:children:p-1 text-center border-b-(2 solid border) hover:bg-primary-500/10"
|
|
4
|
+
:class="[trClass?.(item, items), { '!bg-primary-500/20': selected?.[idKey] === item[idKey] }]"
|
|
5
5
|
@click="$emit('click:row', item);
|
|
6
|
-
selected = item"
|
|
7
|
-
@dbclick="$emit('dbclick:row', item)"
|
|
8
|
-
>
|
|
9
|
-
<td
|
|
10
|
-
v-if="parentKey"
|
|
11
|
-
class="!max-w-1 !w-1"
|
|
12
|
-
:style="{ paddingInlineStart: level * 10 + 5 + 'px' }"
|
|
13
|
-
>
|
|
14
|
-
<UnNuxtIcon
|
|
15
|
-
v-if="subItems?.length"
|
|
16
|
-
class="cursor-pointer w-5 h-5"
|
|
17
|
-
:name="open ? 'solar:folder-open-broken' : 'solar:add-folder-broken'"
|
|
18
|
-
@click="open = !open"
|
|
19
|
-
/>
|
|
20
|
-
</td>
|
|
21
|
-
<td
|
|
22
|
-
v-for="col in cols.filter((e) => !e.disabled)"
|
|
23
|
-
:key="col.name + '-td'"
|
|
24
|
-
class="text-gray-400 text-sm text-center first:rounded-l-lg last:rounded-r-lg"
|
|
25
|
-
:style="{ paddingInlineStart: parentKey ? level * 10 + 5 + 'px' : 'unset' }"
|
|
26
|
-
:class="[col.classHandler?.(item, col, items, cols), col.class, { '<md:hidden': col.isDesktop, 'hidden <md:table-cell': col.isMobile }, tdClass]"
|
|
27
|
-
:dir="col.dir"
|
|
28
|
-
>
|
|
29
|
-
<slot
|
|
30
|
-
:name="col.name"
|
|
31
|
-
:col="col"
|
|
32
|
-
:item="item"
|
|
33
|
-
:items="_at(item, col.key)"
|
|
34
|
-
:index="col.name + '-slot'"
|
|
35
|
-
>
|
|
36
|
-
<div class="flex flex-col gap-0.5">
|
|
37
|
-
<p :class="textClass">
|
|
38
|
-
{{ col.handler ? col.handler(_at(item, col.key), item, col, items, cols) : _at(item, col.key).join(" ") }}
|
|
39
|
-
</p>
|
|
40
|
-
<small
|
|
41
|
-
v-if="col.subKey?.length"
|
|
42
|
-
class="font-500 text-gray-600 text-xs"
|
|
43
|
-
>{{ _at(item, col.subKey).join(" ") }}</small>
|
|
44
|
-
</div>
|
|
45
|
-
</slot>
|
|
46
|
-
</td>
|
|
47
|
-
<td
|
|
48
|
-
v-if="parentKey"
|
|
49
|
-
class="!max-w-1 !w-1 !p-1"
|
|
50
|
-
>
|
|
51
|
-
<UnNuxtIcon
|
|
52
|
-
class="cursor-pointer w-5 h-5"
|
|
53
|
-
name="solar:add-circle-broken"
|
|
54
|
-
@click="$emit('add:row', item)"
|
|
55
|
-
/>
|
|
56
|
-
</td>
|
|
57
|
-
</tr>
|
|
58
|
-
<template v-if="parentKey && subItems?.length && open">
|
|
59
|
-
<UnTableRow
|
|
60
|
-
v-for="(i, index) in subItems"
|
|
61
|
-
:key="index"
|
|
62
|
-
v-model="selected"
|
|
63
|
-
:item="i"
|
|
64
|
-
:items
|
|
65
|
-
:cols
|
|
66
|
-
:parent-key
|
|
67
|
-
:level="level + 1"
|
|
68
|
-
:id-key
|
|
69
|
-
:text-class
|
|
70
|
-
:td-class
|
|
71
|
-
:tr-class
|
|
72
|
-
@click:row="$emit('click:row', i)"
|
|
73
|
-
@dbclick:row="$emit('dbclick:row', i)"
|
|
74
|
-
@add:row="$emit('add:row', i)"
|
|
75
|
-
/>
|
|
76
|
-
</template>
|
|
6
|
+
selected = item"
|
|
7
|
+
@dbclick="$emit('dbclick:row', item)"
|
|
8
|
+
>
|
|
9
|
+
<td
|
|
10
|
+
v-if="parentKey"
|
|
11
|
+
class="!max-w-1 !w-1"
|
|
12
|
+
:style="{ paddingInlineStart: level * 10 + 5 + 'px' }"
|
|
13
|
+
>
|
|
14
|
+
<UnNuxtIcon
|
|
15
|
+
v-if="subItems?.length"
|
|
16
|
+
class="cursor-pointer w-5 h-5"
|
|
17
|
+
:name="open ? 'solar:folder-open-broken' : 'solar:add-folder-broken'"
|
|
18
|
+
@click="open = !open"
|
|
19
|
+
/>
|
|
20
|
+
</td>
|
|
21
|
+
<td
|
|
22
|
+
v-for="col in cols.filter((e) => !e.disabled)"
|
|
23
|
+
:key="col.name + '-td'"
|
|
24
|
+
class="text-gray-400 text-sm text-center first:rounded-l-lg last:rounded-r-lg"
|
|
25
|
+
:style="{ paddingInlineStart: parentKey ? level * 10 + 5 + 'px' : 'unset' }"
|
|
26
|
+
:class="[col.classHandler?.(item, col, items, cols), col.class, { '<md:hidden': col.isDesktop, 'hidden <md:table-cell': col.isMobile }, tdClass]"
|
|
27
|
+
:dir="col.dir"
|
|
28
|
+
>
|
|
29
|
+
<slot
|
|
30
|
+
:name="col.name"
|
|
31
|
+
:col="col"
|
|
32
|
+
:item="item"
|
|
33
|
+
:items="_at(item, col.key)"
|
|
34
|
+
:index="col.name + '-slot'"
|
|
35
|
+
>
|
|
36
|
+
<div class="flex flex-col gap-0.5">
|
|
37
|
+
<p :class="textClass">
|
|
38
|
+
{{ col.handler ? col.handler(_at(item, col.key), item, col, items, cols) : _at(item, col.key).join(" ") }}
|
|
39
|
+
</p>
|
|
40
|
+
<small
|
|
41
|
+
v-if="col.subKey?.length"
|
|
42
|
+
class="font-500 text-gray-600 text-xs"
|
|
43
|
+
>{{ _at(item, col.subKey).join(" ") }}</small>
|
|
44
|
+
</div>
|
|
45
|
+
</slot>
|
|
46
|
+
</td>
|
|
47
|
+
<td
|
|
48
|
+
v-if="parentKey"
|
|
49
|
+
class="!max-w-1 !w-1 !p-1"
|
|
50
|
+
>
|
|
51
|
+
<UnNuxtIcon
|
|
52
|
+
class="cursor-pointer w-5 h-5"
|
|
53
|
+
name="solar:add-circle-broken"
|
|
54
|
+
@click="$emit('add:row', item)"
|
|
55
|
+
/>
|
|
56
|
+
</td>
|
|
57
|
+
</tr>
|
|
58
|
+
<template v-if="parentKey && subItems?.length && open">
|
|
59
|
+
<UnTableRow
|
|
60
|
+
v-for="(i, index) in subItems"
|
|
61
|
+
:key="index"
|
|
62
|
+
v-model="selected"
|
|
63
|
+
:item="i"
|
|
64
|
+
:items
|
|
65
|
+
:cols
|
|
66
|
+
:parent-key
|
|
67
|
+
:level="level + 1"
|
|
68
|
+
:id-key
|
|
69
|
+
:text-class
|
|
70
|
+
:td-class
|
|
71
|
+
:tr-class
|
|
72
|
+
@click:row="$emit('click:row', i)"
|
|
73
|
+
@dbclick:row="$emit('dbclick:row', i)"
|
|
74
|
+
@add:row="$emit('add:row', i)"
|
|
75
|
+
/>
|
|
76
|
+
</template>
|
|
77
77
|
</template>
|
|
78
78
|
|
|
79
79
|
<script setup>
|