@unsource/ui 2.3.2 → 2.4.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/dist/module.json
CHANGED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
cols?: {
|
|
3
|
+
title: string;
|
|
4
|
+
name: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
key?: string | string[];
|
|
7
|
+
subKey?: string | string[];
|
|
8
|
+
class?: string;
|
|
9
|
+
dir?: string;
|
|
10
|
+
isDesktop?: boolean;
|
|
11
|
+
isMobile?: boolean;
|
|
12
|
+
}[];
|
|
13
|
+
items?: Record<string, unknown>[];
|
|
14
|
+
thClass?: string;
|
|
15
|
+
tdClass?: string;
|
|
16
|
+
textClass?: string;
|
|
17
|
+
boxMode?: boolean;
|
|
18
|
+
};
|
|
19
|
+
declare var __VLS_2: any, __VLS_3: {
|
|
20
|
+
col: any;
|
|
21
|
+
item: any;
|
|
22
|
+
items: any;
|
|
23
|
+
index: any;
|
|
24
|
+
}, __VLS_6: any, __VLS_7: {
|
|
25
|
+
col: any;
|
|
26
|
+
item: any;
|
|
27
|
+
items: any;
|
|
28
|
+
index: any;
|
|
29
|
+
};
|
|
30
|
+
type __VLS_Slots = {} & {
|
|
31
|
+
[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
|
+
};
|
|
35
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
36
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
37
|
+
declare const _default: typeof __VLS_export;
|
|
38
|
+
export default _default;
|
|
39
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
40
|
+
new (): {
|
|
41
|
+
$slots: S;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex flex-col justify-start min-h-50 <md:(max-w-screen overflow-x-auto)">
|
|
3
|
+
<div
|
|
4
|
+
v-if="boxMode"
|
|
5
|
+
class="flex flex-col gap-2 h-full"
|
|
6
|
+
>
|
|
7
|
+
<div
|
|
8
|
+
v-for="(item, index) in items"
|
|
9
|
+
:key="index"
|
|
10
|
+
class="flex flex-col gap-1 pb-2 border-b-(1 solid gray-400)"
|
|
11
|
+
@click="$emit('click:row', item)"
|
|
12
|
+
>
|
|
13
|
+
<div
|
|
14
|
+
v-for="col in cols.filter((e) => !e.disabled)"
|
|
15
|
+
:key="col.name"
|
|
16
|
+
class="flex items-center gap-2"
|
|
17
|
+
>
|
|
18
|
+
<div class="text-xs text-gray-600 font-medium text-left">
|
|
19
|
+
{{ col.title }}
|
|
20
|
+
</div>
|
|
21
|
+
<div class="border-t-(dashed gray-600 1) grow" />
|
|
22
|
+
<div class="text-gray-400 text-sm text-right">
|
|
23
|
+
<slot
|
|
24
|
+
:name="col.name"
|
|
25
|
+
:col="col"
|
|
26
|
+
:item="item"
|
|
27
|
+
:items="_at(item, col.key)"
|
|
28
|
+
:index="index"
|
|
29
|
+
>
|
|
30
|
+
<div class="flex flex-col gap-0.5">
|
|
31
|
+
<p :class="textClass">
|
|
32
|
+
{{ _at(item, col.key).join(" ") }}
|
|
33
|
+
</p>
|
|
34
|
+
<small
|
|
35
|
+
v-if="col.subKey?.length"
|
|
36
|
+
class="font-500 text-gray-600 text-xs"
|
|
37
|
+
>{{ _at(item, col.subKey).join(" ") }}</small>
|
|
38
|
+
</div>
|
|
39
|
+
</slot>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
<table
|
|
45
|
+
v-else
|
|
46
|
+
class="border-spacing-x-0 border-spacing-y-1"
|
|
47
|
+
>
|
|
48
|
+
<thead>
|
|
49
|
+
<tr class="border-b-2 children:(text-center p-4) rounded-lg <md:children:p-1 ">
|
|
50
|
+
<th
|
|
51
|
+
v-for="col in cols.filter((e) => !e.disabled)"
|
|
52
|
+
:key="col.name + '-th'"
|
|
53
|
+
:class="[{ '<md:hidden': col.isDesktop, 'hidden <md:table-cell': col.isMobile }, `w-${cols.length}`, thClass, 'sticky top-0']"
|
|
54
|
+
class="text-xs text-gray-600 font-medium text-center first:rounded-l-lg last:rounded-r-lg"
|
|
55
|
+
>
|
|
56
|
+
{{ col.title }}
|
|
57
|
+
</th>
|
|
58
|
+
</tr>
|
|
59
|
+
</thead>
|
|
60
|
+
<tbody>
|
|
61
|
+
<tr
|
|
62
|
+
v-for="(item, index) in items"
|
|
63
|
+
:key="index"
|
|
64
|
+
class="children:p-3 <md:children:p-1 text-center children:(border-b border-gray-100)"
|
|
65
|
+
@click="$emit('click:row', item)"
|
|
66
|
+
>
|
|
67
|
+
<td
|
|
68
|
+
v-for="col in cols.filter((e) => !e.disabled)"
|
|
69
|
+
:key="col.name + '-td'"
|
|
70
|
+
class="text-gray-400 text-sm text-center first:rounded-l-lg last:rounded-r-lg"
|
|
71
|
+
:class="[col.class, { '<md:hidden': col.isDesktop, 'hidden <md:table-cell': col.isMobile }, tdClass]"
|
|
72
|
+
:dir="col.dir"
|
|
73
|
+
>
|
|
74
|
+
<slot
|
|
75
|
+
:name="col.name"
|
|
76
|
+
:col="col"
|
|
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>
|
|
93
|
+
</tbody>
|
|
94
|
+
</table>
|
|
95
|
+
<div
|
|
96
|
+
v-if="!items?.length"
|
|
97
|
+
class="flex grow justify-center items-center font-bold text-sm text-text"
|
|
98
|
+
>
|
|
99
|
+
{{ $t("Empty") }}
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
</template>
|
|
103
|
+
|
|
104
|
+
<script setup>
|
|
105
|
+
import { _at, useDevice } from "#imports";
|
|
106
|
+
const { cols = [], items = [], thClass = "bg-gray-100 border-gray-100", tdClass = "bg-gray-250", textClass = "text-gray-800 font-700 text-xs" } = defineProps({
|
|
107
|
+
cols: { type: Array, required: false },
|
|
108
|
+
items: { type: Array, required: false },
|
|
109
|
+
thClass: { type: String, required: false },
|
|
110
|
+
tdClass: { type: String, required: false },
|
|
111
|
+
textClass: { type: String, required: false },
|
|
112
|
+
boxMode: { type: Boolean, required: false }
|
|
113
|
+
});
|
|
114
|
+
const { isDesktop, isMobile } = useDevice();
|
|
115
|
+
</script>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
cols?: {
|
|
3
|
+
title: string;
|
|
4
|
+
name: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
key?: string | string[];
|
|
7
|
+
subKey?: string | string[];
|
|
8
|
+
class?: string;
|
|
9
|
+
dir?: string;
|
|
10
|
+
isDesktop?: boolean;
|
|
11
|
+
isMobile?: boolean;
|
|
12
|
+
}[];
|
|
13
|
+
items?: Record<string, unknown>[];
|
|
14
|
+
thClass?: string;
|
|
15
|
+
tdClass?: string;
|
|
16
|
+
textClass?: string;
|
|
17
|
+
boxMode?: boolean;
|
|
18
|
+
};
|
|
19
|
+
declare var __VLS_2: any, __VLS_3: {
|
|
20
|
+
col: any;
|
|
21
|
+
item: any;
|
|
22
|
+
items: any;
|
|
23
|
+
index: any;
|
|
24
|
+
}, __VLS_6: any, __VLS_7: {
|
|
25
|
+
col: any;
|
|
26
|
+
item: any;
|
|
27
|
+
items: any;
|
|
28
|
+
index: any;
|
|
29
|
+
};
|
|
30
|
+
type __VLS_Slots = {} & {
|
|
31
|
+
[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
|
+
};
|
|
35
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
36
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
37
|
+
declare const _default: typeof __VLS_export;
|
|
38
|
+
export default _default;
|
|
39
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
40
|
+
new (): {
|
|
41
|
+
$slots: S;
|
|
42
|
+
};
|
|
43
|
+
};
|