@unsource/ui 2.4.0 → 2.4.5
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/UnMultiUploader.vue +1 -0
- package/dist/runtime/components/UnTable.d.vue.ts +12 -8
- package/dist/runtime/components/UnTable.vue +22 -32
- package/dist/runtime/components/UnTable.vue.d.ts +12 -8
- package/dist/runtime/components/UnTableRow.d.vue.ts +31 -0
- package/dist/runtime/components/UnTableRow.vue +89 -0
- package/dist/runtime/components/UnTableRow.vue.d.ts +31 -0
- package/package.json +1 -1
- package/dist/runtime/components/UnTableCard.d.vue.ts +0 -22
- package/dist/runtime/components/UnTableCard.vue +0 -46
- package/dist/runtime/components/UnTableCard.vue.d.ts +0 -22
package/dist/module.json
CHANGED
|
@@ -15,24 +15,28 @@ type __VLS_Props = {
|
|
|
15
15
|
tdClass?: string;
|
|
16
16
|
textClass?: string;
|
|
17
17
|
boxMode?: boolean;
|
|
18
|
+
parentKey?: string;
|
|
19
|
+
idKey?: string;
|
|
20
|
+
selectable?: boolean;
|
|
18
21
|
};
|
|
22
|
+
type __VLS_ModelProps = {
|
|
23
|
+
modelValue?: any;
|
|
24
|
+
};
|
|
25
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
19
26
|
declare var __VLS_2: any, __VLS_3: {
|
|
20
27
|
col: any;
|
|
21
28
|
item: any;
|
|
22
29
|
items: any;
|
|
23
30
|
index: any;
|
|
24
|
-
}, __VLS_6: any, __VLS_7: {
|
|
25
|
-
col: any;
|
|
26
|
-
item: any;
|
|
27
|
-
items: any;
|
|
28
|
-
index: any;
|
|
29
31
|
};
|
|
30
32
|
type __VLS_Slots = {} & {
|
|
31
33
|
[K in NonNullable<typeof __VLS_2>]?: (props: typeof __VLS_3) => any;
|
|
32
|
-
} & {
|
|
33
|
-
[K in NonNullable<typeof __VLS_6>]?: (props: typeof __VLS_7) => any;
|
|
34
34
|
};
|
|
35
|
-
declare const __VLS_base: import("vue").DefineComponent<
|
|
35
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
36
|
+
"update:modelValue": (value: any) => any;
|
|
37
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
38
|
+
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
39
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
36
40
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
37
41
|
declare const _default: typeof __VLS_export;
|
|
38
42
|
export default _default;
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
>
|
|
48
48
|
<thead>
|
|
49
49
|
<tr class="border-b-2 children:(text-center p-4) rounded-lg <md:children:p-1 ">
|
|
50
|
+
<th v-if="parentKey" />
|
|
50
51
|
<th
|
|
51
52
|
v-for="col in cols.filter((e) => !e.disabled)"
|
|
52
53
|
:key="col.name + '-th'"
|
|
@@ -55,41 +56,26 @@
|
|
|
55
56
|
>
|
|
56
57
|
{{ col.title }}
|
|
57
58
|
</th>
|
|
59
|
+
<th v-if="parentKey" />
|
|
58
60
|
</tr>
|
|
59
61
|
</thead>
|
|
60
62
|
<tbody>
|
|
61
|
-
<
|
|
62
|
-
v-for="(item, index) in items"
|
|
63
|
+
<UnTableRow
|
|
64
|
+
v-for="(item, index) in items?.filter((e) => !parentKey || !e[parentKey])"
|
|
63
65
|
:key="index"
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
:item="item"
|
|
78
|
-
:items="_at(item, col.key)"
|
|
79
|
-
:index="index"
|
|
80
|
-
>
|
|
81
|
-
<div class="flex flex-col gap-0.5">
|
|
82
|
-
<p :class="textClass">
|
|
83
|
-
{{ _at(item, col.key).join(" ") }}
|
|
84
|
-
</p>
|
|
85
|
-
<small
|
|
86
|
-
v-if="col.subKey?.length"
|
|
87
|
-
class="font-500 text-gray-600 text-xs"
|
|
88
|
-
>{{ _at(item, col.subKey).join(" ") }}</small>
|
|
89
|
-
</div>
|
|
90
|
-
</slot>
|
|
91
|
-
</td>
|
|
92
|
-
</tr>
|
|
66
|
+
v-model="selected"
|
|
67
|
+
:item="item"
|
|
68
|
+
:items
|
|
69
|
+
:cols="cols"
|
|
70
|
+
:td-class
|
|
71
|
+
:text-class
|
|
72
|
+
:parent-key
|
|
73
|
+
:id-key
|
|
74
|
+
@click:row="$emit('click:row', item);
|
|
75
|
+
selected = item"
|
|
76
|
+
@dbclick:row="$emit('dbclick:row', item)"
|
|
77
|
+
@add:row="$emit('add:row', item)"
|
|
78
|
+
/>
|
|
93
79
|
</tbody>
|
|
94
80
|
</table>
|
|
95
81
|
<div
|
|
@@ -109,7 +95,11 @@ const { cols = [], items = [], thClass = "bg-gray-100 border-gray-100", tdClass
|
|
|
109
95
|
thClass: { type: String, required: false },
|
|
110
96
|
tdClass: { type: String, required: false },
|
|
111
97
|
textClass: { type: String, required: false },
|
|
112
|
-
boxMode: { type: Boolean, required: false }
|
|
98
|
+
boxMode: { type: Boolean, required: false },
|
|
99
|
+
parentKey: { type: String, required: false },
|
|
100
|
+
idKey: { type: String, required: false },
|
|
101
|
+
selectable: { type: Boolean, required: false }
|
|
113
102
|
});
|
|
114
103
|
const { isDesktop, isMobile } = useDevice();
|
|
104
|
+
const selected = defineModel();
|
|
115
105
|
</script>
|
|
@@ -15,24 +15,28 @@ type __VLS_Props = {
|
|
|
15
15
|
tdClass?: string;
|
|
16
16
|
textClass?: string;
|
|
17
17
|
boxMode?: boolean;
|
|
18
|
+
parentKey?: string;
|
|
19
|
+
idKey?: string;
|
|
20
|
+
selectable?: boolean;
|
|
18
21
|
};
|
|
22
|
+
type __VLS_ModelProps = {
|
|
23
|
+
modelValue?: any;
|
|
24
|
+
};
|
|
25
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
19
26
|
declare var __VLS_2: any, __VLS_3: {
|
|
20
27
|
col: any;
|
|
21
28
|
item: any;
|
|
22
29
|
items: any;
|
|
23
30
|
index: any;
|
|
24
|
-
}, __VLS_6: any, __VLS_7: {
|
|
25
|
-
col: any;
|
|
26
|
-
item: any;
|
|
27
|
-
items: any;
|
|
28
|
-
index: any;
|
|
29
31
|
};
|
|
30
32
|
type __VLS_Slots = {} & {
|
|
31
33
|
[K in NonNullable<typeof __VLS_2>]?: (props: typeof __VLS_3) => any;
|
|
32
|
-
} & {
|
|
33
|
-
[K in NonNullable<typeof __VLS_6>]?: (props: typeof __VLS_7) => any;
|
|
34
34
|
};
|
|
35
|
-
declare const __VLS_base: import("vue").DefineComponent<
|
|
35
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
36
|
+
"update:modelValue": (value: any) => any;
|
|
37
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
38
|
+
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
39
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
36
40
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
37
41
|
declare const _default: typeof __VLS_export;
|
|
38
42
|
export default _default;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
item?: unknown;
|
|
3
|
+
items?: unknown[];
|
|
4
|
+
cols: unknown[];
|
|
5
|
+
textClass?: string;
|
|
6
|
+
parentKey?: string;
|
|
7
|
+
idKey?: string;
|
|
8
|
+
tdClass?: string;
|
|
9
|
+
};
|
|
10
|
+
type __VLS_ModelProps = {
|
|
11
|
+
modelValue?: any;
|
|
12
|
+
};
|
|
13
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
14
|
+
declare var __VLS_10: any, __VLS_11: {
|
|
15
|
+
col: any;
|
|
16
|
+
item: unknown;
|
|
17
|
+
items: any;
|
|
18
|
+
index: string;
|
|
19
|
+
};
|
|
20
|
+
type __VLS_Slots = {} & {
|
|
21
|
+
[K in NonNullable<typeof __VLS_10>]?: (props: typeof __VLS_11) => 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>;
|
|
25
|
+
declare const _default: typeof __VLS_export;
|
|
26
|
+
export default _default;
|
|
27
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
28
|
+
new (): {
|
|
29
|
+
$slots: S;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<tr
|
|
3
|
+
class="children:p-3 <md:children:p-1 text-center children:(border-b border-gray-100)"
|
|
4
|
+
:class="{ 'bg-primary/10': selected?.id === item.id }"
|
|
5
|
+
@click="$emit('click:row', item)"
|
|
6
|
+
@dbclick="$emit('dbclick:row', item)"
|
|
7
|
+
>
|
|
8
|
+
<td
|
|
9
|
+
v-if="parentKey"
|
|
10
|
+
class="!max-w-1 !w-1 !p-1"
|
|
11
|
+
>
|
|
12
|
+
<UnNuxtIcon
|
|
13
|
+
v-if="subItems?.length"
|
|
14
|
+
class="cursor-pointer w-5 h-5"
|
|
15
|
+
:name="open ? 'solar:folder-open-broken' : 'solar:add-folder-broken'"
|
|
16
|
+
@click="open = !open"
|
|
17
|
+
/>
|
|
18
|
+
</td>
|
|
19
|
+
<td
|
|
20
|
+
v-for="col in cols.filter((e) => !e.disabled)"
|
|
21
|
+
:key="col.name + '-td'"
|
|
22
|
+
class="text-gray-400 text-sm text-center first:rounded-l-lg last:rounded-r-lg"
|
|
23
|
+
:class="[col.class, { '<md:hidden': col.isDesktop, 'hidden <md:table-cell': col.isMobile }, tdClass]"
|
|
24
|
+
:dir="col.dir"
|
|
25
|
+
>
|
|
26
|
+
<slot
|
|
27
|
+
:name="col.name"
|
|
28
|
+
:col="col"
|
|
29
|
+
:item="item"
|
|
30
|
+
:items="_at(item, col.key)"
|
|
31
|
+
:index="col.name + '-slot'"
|
|
32
|
+
>
|
|
33
|
+
<div class="flex flex-col gap-0.5">
|
|
34
|
+
<p :class="textClass">
|
|
35
|
+
{{ _at(item, col.key).join(" ") }}
|
|
36
|
+
</p>
|
|
37
|
+
<small
|
|
38
|
+
v-if="col.subKey?.length"
|
|
39
|
+
class="font-500 text-gray-600 text-xs"
|
|
40
|
+
>{{ _at(item, col.subKey).join(" ") }}</small>
|
|
41
|
+
</div>
|
|
42
|
+
</slot>
|
|
43
|
+
</td>
|
|
44
|
+
<td
|
|
45
|
+
v-if="parentKey"
|
|
46
|
+
class="!max-w-1 !w-1 !p-1"
|
|
47
|
+
>
|
|
48
|
+
<UnNuxtIcon
|
|
49
|
+
class="cursor-pointer w-5 h-5"
|
|
50
|
+
name="solar:add-circle-broken"
|
|
51
|
+
@click="$emit('add:row', item)"
|
|
52
|
+
/>
|
|
53
|
+
</td>
|
|
54
|
+
</tr>
|
|
55
|
+
<template v-if="parentKey && subItems?.length && open">
|
|
56
|
+
<UnTableRow
|
|
57
|
+
v-for="(i, index) in subItems"
|
|
58
|
+
:key="index"
|
|
59
|
+
:item="i"
|
|
60
|
+
:items
|
|
61
|
+
:cols
|
|
62
|
+
:parent-key
|
|
63
|
+
:id-key
|
|
64
|
+
:text-class
|
|
65
|
+
:td-class
|
|
66
|
+
@click:row="$emit('click:row', i);
|
|
67
|
+
selected = i"
|
|
68
|
+
@dbclick:row="$emit('dbclick:row', i)"
|
|
69
|
+
@add:row="$emit('add:row', i)"
|
|
70
|
+
/>
|
|
71
|
+
</template>
|
|
72
|
+
</template>
|
|
73
|
+
|
|
74
|
+
<script setup>
|
|
75
|
+
import { _at, ref } from "#imports";
|
|
76
|
+
defineEmits(["click:row", "dbclick:row"]);
|
|
77
|
+
const { parentKey, idKey = "id", item = {}, items = [] } = defineProps({
|
|
78
|
+
item: { type: null, required: false },
|
|
79
|
+
items: { type: Array, required: false },
|
|
80
|
+
cols: { type: Array, required: true },
|
|
81
|
+
textClass: { type: String, required: false },
|
|
82
|
+
parentKey: { type: String, required: false },
|
|
83
|
+
idKey: { type: String, required: false },
|
|
84
|
+
tdClass: { type: String, required: false }
|
|
85
|
+
});
|
|
86
|
+
const open = ref(false);
|
|
87
|
+
const selected = defineModel();
|
|
88
|
+
const subItems = computed(() => items?.filter((e) => e[parentKey] === item[idKey]));
|
|
89
|
+
</script>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
item?: unknown;
|
|
3
|
+
items?: unknown[];
|
|
4
|
+
cols: unknown[];
|
|
5
|
+
textClass?: string;
|
|
6
|
+
parentKey?: string;
|
|
7
|
+
idKey?: string;
|
|
8
|
+
tdClass?: string;
|
|
9
|
+
};
|
|
10
|
+
type __VLS_ModelProps = {
|
|
11
|
+
modelValue?: any;
|
|
12
|
+
};
|
|
13
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
14
|
+
declare var __VLS_10: any, __VLS_11: {
|
|
15
|
+
col: any;
|
|
16
|
+
item: unknown;
|
|
17
|
+
items: any;
|
|
18
|
+
index: string;
|
|
19
|
+
};
|
|
20
|
+
type __VLS_Slots = {} & {
|
|
21
|
+
[K in NonNullable<typeof __VLS_10>]?: (props: typeof __VLS_11) => 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>;
|
|
25
|
+
declare const _default: typeof __VLS_export;
|
|
26
|
+
export default _default;
|
|
27
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
28
|
+
new (): {
|
|
29
|
+
$slots: S;
|
|
30
|
+
};
|
|
31
|
+
};
|
package/package.json
CHANGED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
declare const _default: typeof __VLS_export;
|
|
2
|
-
export default _default;
|
|
3
|
-
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
4
|
-
type __VLS_WithSlots<T, S> = T & (new () => {
|
|
5
|
-
$slots: S;
|
|
6
|
-
});
|
|
7
|
-
declare const __VLS_base: import("vue").DefineComponent<{}, {
|
|
8
|
-
$props: Partial<typeof __VLS_props>;
|
|
9
|
-
items: unknown[];
|
|
10
|
-
cols: unknown[];
|
|
11
|
-
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
12
|
-
type __VLS_Slots = {
|
|
13
|
-
[x: string]: ((props: {
|
|
14
|
-
col: any;
|
|
15
|
-
item: any;
|
|
16
|
-
items: any;
|
|
17
|
-
}) => any) | undefined;
|
|
18
|
-
};
|
|
19
|
-
declare const __VLS_props: {
|
|
20
|
-
readonly items: unknown[];
|
|
21
|
-
readonly cols: unknown[];
|
|
22
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="flex flex-col children:(p-4)">
|
|
3
|
-
<table class="flex-grow">
|
|
4
|
-
<thead>
|
|
5
|
-
<tr class="border-b-2 border-gray-100 children:(text-center p-4) rounded-2xl <md:children:p-1">
|
|
6
|
-
<th v-for="col in cols"
|
|
7
|
-
:class="{'<md:hidden':col.isDesktop,'hidden <md:table-cell':col.isMobile}"
|
|
8
|
-
class="text-xs text-gray-400 font-medium first:text-right last:text-left">
|
|
9
|
-
{{ col.title }}
|
|
10
|
-
</th>
|
|
11
|
-
</tr>
|
|
12
|
-
</thead>
|
|
13
|
-
<tbody >
|
|
14
|
-
<tr v-for="item in items"
|
|
15
|
-
@click="$emit('click:row',item)"
|
|
16
|
-
class="children:p-3 <md:children:p-1 text-center children:(border-b border-gray-100) hover:children:(bg-gray-100)">
|
|
17
|
-
<td v-for="col in cols"
|
|
18
|
-
class="text-gray-400 text-sm first:text-right last:text-left text-center first:rounded-r-lg last:rounded-l-lg"
|
|
19
|
-
:class="[col.class,{'<md:hidden':col.isDesktop,'hidden <md:table-cell':col.isMobile}]" :dir="col.dir">
|
|
20
|
-
<slot :name="col.name" :col="col" :item="item" :items="_at(item,col.key)">
|
|
21
|
-
{{ _at(item, col.key).join(' ') }}
|
|
22
|
-
</slot>
|
|
23
|
-
</td>
|
|
24
|
-
</tr>
|
|
25
|
-
</tbody>
|
|
26
|
-
</table>
|
|
27
|
-
<div v-if="!items.length" class="flex justify-center items-center p-24 font-bold text-sm text-text">
|
|
28
|
-
{{ $t('هیچ موردی برای این جستجو یافت نشد') }}
|
|
29
|
-
</div>
|
|
30
|
-
|
|
31
|
-
</div>
|
|
32
|
-
</template>
|
|
33
|
-
|
|
34
|
-
<script setup>
|
|
35
|
-
defineProps({
|
|
36
|
-
cols: {
|
|
37
|
-
type: Array,
|
|
38
|
-
default: () => []
|
|
39
|
-
},
|
|
40
|
-
items: {
|
|
41
|
-
type: Array,
|
|
42
|
-
default: () => []
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
const { isDesktop, isMobile } = useDevice();
|
|
46
|
-
</script>
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
declare const _default: typeof __VLS_export;
|
|
2
|
-
export default _default;
|
|
3
|
-
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
4
|
-
type __VLS_WithSlots<T, S> = T & (new () => {
|
|
5
|
-
$slots: S;
|
|
6
|
-
});
|
|
7
|
-
declare const __VLS_base: import("vue").DefineComponent<{}, {
|
|
8
|
-
$props: Partial<typeof __VLS_props>;
|
|
9
|
-
items: unknown[];
|
|
10
|
-
cols: unknown[];
|
|
11
|
-
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
12
|
-
type __VLS_Slots = {
|
|
13
|
-
[x: string]: ((props: {
|
|
14
|
-
col: any;
|
|
15
|
-
item: any;
|
|
16
|
-
items: any;
|
|
17
|
-
}) => any) | undefined;
|
|
18
|
-
};
|
|
19
|
-
declare const __VLS_props: {
|
|
20
|
-
readonly items: unknown[];
|
|
21
|
-
readonly cols: unknown[];
|
|
22
|
-
};
|