pukaad-ui-lib 1.5.0 → 1.7.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 +1 -1
- package/dist/runtime/components/input/input-select-province.vue +38 -20
- package/dist/runtime/components/pagination.vue +4 -16
- package/dist/runtime/components/ui/carousel/CarouselNext.vue +1 -1
- package/dist/runtime/components/ui/carousel/CarouselPrevious.vue +1 -1
- package/dist/runtime/components/ui/command/Command.vue +13 -6
- package/dist/runtime/components/ui/command/CommandList.vue +1 -6
- package/dist/runtime/components/ui/command/index.d.ts +6 -0
- package/dist/runtime/components/ui/table/TableEmpty.vue +6 -1
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<Icon name="lucide:chevron-down" />
|
|
7
7
|
</div>
|
|
8
8
|
</ShadPopoverTrigger>
|
|
9
|
-
<ShadPopoverContent class="flex p-[24px] w-[425px]">
|
|
9
|
+
<ShadPopoverContent class="flex p-[24px] w-[425px] h-full">
|
|
10
10
|
<ShadCommand>
|
|
11
11
|
<div class="space-y-[22px]">
|
|
12
12
|
<div class="font-title-medium-prominent">เลือกจังหวัด</div>
|
|
@@ -16,26 +16,44 @@
|
|
|
16
16
|
<Icon name="lucide:search" />
|
|
17
17
|
</template>
|
|
18
18
|
</InputTextField>
|
|
19
|
-
<ShadCommandList>
|
|
19
|
+
<ShadCommandList class="h-[550px]">
|
|
20
20
|
<div class="flex flex-col gap-[16px]">
|
|
21
21
|
<div class="flex flex-col gap-[8px]">
|
|
22
22
|
<div>ปลายทางยอดนิยม</div>
|
|
23
|
-
<
|
|
24
|
-
<
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
23
|
+
<div class="relative">
|
|
24
|
+
<ShadCarousel>
|
|
25
|
+
<ShadCarouselContent>
|
|
26
|
+
<ShadCarouselItem
|
|
27
|
+
v-for="province in provinces"
|
|
28
|
+
:key="province.value"
|
|
29
|
+
class="flex cursor-pointer basis-1/3.5"
|
|
30
|
+
@click="selectProvince(province.value)"
|
|
31
|
+
>
|
|
32
|
+
<Card
|
|
33
|
+
class="flex flex-col bg-mercury w-[140px] h-[180px]"
|
|
34
|
+
>
|
|
35
|
+
<div class="font-medium">
|
|
36
|
+
{{ province.label }}
|
|
37
|
+
</div>
|
|
38
|
+
<div
|
|
39
|
+
v-if="province.image_cover_url === null"
|
|
40
|
+
class="flex flex-col items-center h-full justify-center"
|
|
41
|
+
>
|
|
42
|
+
<Icon name="lucide:image" size="28" />
|
|
43
|
+
<div class="text-gray">ไม่มีรูป</div>
|
|
44
|
+
</div>
|
|
45
|
+
<img
|
|
46
|
+
v-else
|
|
47
|
+
:src="province.image_cover_url || ''"
|
|
48
|
+
class="w-full object-cover"
|
|
49
|
+
/>
|
|
50
|
+
</Card>
|
|
51
|
+
</ShadCarouselItem>
|
|
52
|
+
</ShadCarouselContent>
|
|
53
|
+
<ShadCarouselPrevious class="left-0" />
|
|
54
|
+
<ShadCarouselNext class="right-0" />
|
|
55
|
+
</ShadCarousel>
|
|
56
|
+
</div>
|
|
39
57
|
</div>
|
|
40
58
|
<ShadCommandGroup>
|
|
41
59
|
<ShadCommandItem
|
|
@@ -80,10 +98,10 @@ const fetchProvinces = async () => {
|
|
|
80
98
|
);
|
|
81
99
|
const data = response.data ?? response;
|
|
82
100
|
if (data && Array.isArray(data)) {
|
|
83
|
-
provinces.value = data.map((p) => ({
|
|
101
|
+
provinces.value = data.filter((p) => p.is_active === true).map((p) => ({
|
|
84
102
|
value: String(p.id),
|
|
85
103
|
label: p.name_th,
|
|
86
|
-
image_cover_url: p.image_cover_url ??
|
|
104
|
+
image_cover_url: p.image_cover_url ?? null
|
|
87
105
|
}));
|
|
88
106
|
}
|
|
89
107
|
} catch (error) {
|
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<ShadPagination
|
|
3
|
-
v-slot="{ page }"
|
|
4
|
-
:items-per-page="itemPerPage"
|
|
5
|
-
:total="props.totalPage"
|
|
6
|
-
v-model:page="pageModel"
|
|
7
|
-
>
|
|
2
|
+
<ShadPagination v-slot="{ page }" :items-per-page="itemPerPage" :total="props.totalPage" v-model:page="pageModel">
|
|
8
3
|
<ShadPaginationContent v-slot="{ items }">
|
|
9
4
|
<ShadPaginationFirst />
|
|
10
5
|
<ShadPaginationPrevious />
|
|
11
6
|
<template v-for="(item, index) in items" :key="index">
|
|
12
|
-
<ShadPaginationItem
|
|
13
|
-
v-if="item.type === 'page'"
|
|
14
|
-
:value="item.value"
|
|
15
|
-
:is-active="item.value === page"
|
|
16
|
-
>
|
|
7
|
+
<ShadPaginationItem v-if="item.type === 'page'" :value="item.value" :is-active="item.value === page">
|
|
17
8
|
{{ item.value }}
|
|
18
9
|
</ShadPaginationItem>
|
|
19
10
|
</template>
|
|
@@ -31,11 +22,7 @@
|
|
|
31
22
|
</Button>
|
|
32
23
|
</ShadDropdownMenuTrigger>
|
|
33
24
|
<ShadDropdownMenuContent class="max-h-96">
|
|
34
|
-
<ShadDropdownMenuItem
|
|
35
|
-
v-for="n in [10, 50, 100]"
|
|
36
|
-
:key="n"
|
|
37
|
-
@click="onSlectItemPerPage(n)"
|
|
38
|
-
>
|
|
25
|
+
<ShadDropdownMenuItem v-for="n in [10, 50, 100]" :key="n" @click="onSlectItemPerPage(n)">
|
|
39
26
|
{{ n }} / หน้า
|
|
40
27
|
</ShadDropdownMenuItem>
|
|
41
28
|
</ShadDropdownMenuContent>
|
|
@@ -56,5 +43,6 @@ const pageModel = defineModel({ type: Number, ...{
|
|
|
56
43
|
const itemPerPage = ref(10);
|
|
57
44
|
const onSlectItemPerPage = (value) => {
|
|
58
45
|
itemPerPage.value = value;
|
|
46
|
+
emits("change-item-per-page", value);
|
|
59
47
|
};
|
|
60
48
|
</script>
|
|
@@ -16,7 +16,7 @@ const { orientation, canScrollNext, scrollNext } = useCarousel();
|
|
|
16
16
|
:disabled="!canScrollNext"
|
|
17
17
|
:class="
|
|
18
18
|
cn(
|
|
19
|
-
'absolute size-8 rounded-full',
|
|
19
|
+
'absolute size-8 rounded-full bg-white text-primary shadow-lg',
|
|
20
20
|
orientation === 'horizontal' ? 'top-1/2 -right-12 -translate-y-1/2' : '-bottom-12 left-1/2 -translate-x-1/2 rotate-90',
|
|
21
21
|
props.class
|
|
22
22
|
)
|
|
@@ -16,7 +16,7 @@ const { orientation, canScrollPrev, scrollPrev } = useCarousel();
|
|
|
16
16
|
:disabled="!canScrollPrev"
|
|
17
17
|
:class="
|
|
18
18
|
cn(
|
|
19
|
-
'absolute size-8 rounded-full',
|
|
19
|
+
'absolute size-8 rounded-full bg-white text-primary shadow-lg',
|
|
20
20
|
orientation === 'horizontal' ? 'top-1/2 -left-12 -translate-y-1/2' : '-top-12 left-1/2 -translate-x-1/2 rotate-90',
|
|
21
21
|
props.class
|
|
22
22
|
)
|
|
@@ -47,8 +47,7 @@ function filterItems() {
|
|
|
47
47
|
for (const [id, value] of allItems.value) {
|
|
48
48
|
const score = contains(value, filterState.search);
|
|
49
49
|
filterState.filtered.items.set(id, score ? 1 : 0);
|
|
50
|
-
if (score)
|
|
51
|
-
itemCount++;
|
|
50
|
+
if (score) itemCount++;
|
|
52
51
|
}
|
|
53
52
|
for (const [groupId, group] of allGroups.value) {
|
|
54
53
|
for (const itemId of group) {
|
|
@@ -60,9 +59,12 @@ function filterItems() {
|
|
|
60
59
|
}
|
|
61
60
|
filterState.filtered.count = itemCount;
|
|
62
61
|
}
|
|
63
|
-
watch(
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
watch(
|
|
63
|
+
() => filterState.search,
|
|
64
|
+
() => {
|
|
65
|
+
filterItems();
|
|
66
|
+
}
|
|
67
|
+
);
|
|
66
68
|
provideCommandContext({
|
|
67
69
|
allItems,
|
|
68
70
|
allGroups,
|
|
@@ -74,7 +76,12 @@ provideCommandContext({
|
|
|
74
76
|
<ListboxRoot
|
|
75
77
|
data-slot="command"
|
|
76
78
|
v-bind="forwarded"
|
|
77
|
-
:class="
|
|
79
|
+
:class="
|
|
80
|
+
cn(
|
|
81
|
+
'bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md',
|
|
82
|
+
props.class
|
|
83
|
+
)
|
|
84
|
+
"
|
|
78
85
|
>
|
|
79
86
|
<slot />
|
|
80
87
|
</ListboxRoot>
|
|
@@ -15,12 +15,7 @@ const forwarded = useForwardProps(delegatedProps);
|
|
|
15
15
|
<ListboxContent
|
|
16
16
|
data-slot="command-list"
|
|
17
17
|
v-bind="forwarded"
|
|
18
|
-
:class="
|
|
19
|
-
cn(
|
|
20
|
-
'max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto',
|
|
21
|
-
props.class
|
|
22
|
-
)
|
|
23
|
-
"
|
|
18
|
+
:class="cn('scroll-py-1 overflow-x-hidden overflow-y-auto', props.class)"
|
|
24
19
|
>
|
|
25
20
|
<div role="presentation">
|
|
26
21
|
<slot />
|
|
@@ -19,6 +19,7 @@ export declare const useCommand: <T extends {
|
|
|
19
19
|
groups: Set<string>;
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
|
+
modelValue: Ref<unknown>;
|
|
22
23
|
} | null | undefined = {
|
|
23
24
|
allItems: Ref<Map<string, string>>;
|
|
24
25
|
allGroups: Ref<Map<string, Set<string>>>;
|
|
@@ -30,6 +31,7 @@ export declare const useCommand: <T extends {
|
|
|
30
31
|
groups: Set<string>;
|
|
31
32
|
};
|
|
32
33
|
};
|
|
34
|
+
modelValue: Ref<unknown>;
|
|
33
35
|
}>(fallback?: T | undefined) => T extends null ? {
|
|
34
36
|
allItems: Ref<Map<string, string>>;
|
|
35
37
|
allGroups: Ref<Map<string, Set<string>>>;
|
|
@@ -41,6 +43,7 @@ export declare const useCommand: <T extends {
|
|
|
41
43
|
groups: Set<string>;
|
|
42
44
|
};
|
|
43
45
|
};
|
|
46
|
+
modelValue: Ref<unknown>;
|
|
44
47
|
} | null : {
|
|
45
48
|
allItems: Ref<Map<string, string>>;
|
|
46
49
|
allGroups: Ref<Map<string, Set<string>>>;
|
|
@@ -52,6 +55,7 @@ export declare const useCommand: <T extends {
|
|
|
52
55
|
groups: Set<string>;
|
|
53
56
|
};
|
|
54
57
|
};
|
|
58
|
+
modelValue: Ref<unknown>;
|
|
55
59
|
}, provideCommandContext: (contextValue: {
|
|
56
60
|
allItems: Ref<Map<string, string>>;
|
|
57
61
|
allGroups: Ref<Map<string, Set<string>>>;
|
|
@@ -63,6 +67,7 @@ export declare const useCommand: <T extends {
|
|
|
63
67
|
groups: Set<string>;
|
|
64
68
|
};
|
|
65
69
|
};
|
|
70
|
+
modelValue: Ref<unknown>;
|
|
66
71
|
}) => {
|
|
67
72
|
allItems: Ref<Map<string, string>>;
|
|
68
73
|
allGroups: Ref<Map<string, Set<string>>>;
|
|
@@ -74,6 +79,7 @@ export declare const useCommand: <T extends {
|
|
|
74
79
|
groups: Set<string>;
|
|
75
80
|
};
|
|
76
81
|
};
|
|
82
|
+
modelValue: Ref<unknown>;
|
|
77
83
|
};
|
|
78
84
|
export declare const useCommandGroup: <T extends {
|
|
79
85
|
id?: string;
|
|
@@ -21,8 +21,13 @@ const delegatedProps = reactiveOmit(props, "class");
|
|
|
21
21
|
"
|
|
22
22
|
v-bind="delegatedProps"
|
|
23
23
|
>
|
|
24
|
-
<div
|
|
24
|
+
<div
|
|
25
|
+
class="flex flex-col items-center justify-center h-[500px] gap-[8px]"
|
|
26
|
+
>
|
|
25
27
|
<slot />
|
|
28
|
+
|
|
29
|
+
<Icon name="pukaad:empty-document" class="w-[218px] h-[200px]" />
|
|
30
|
+
<div class="text-gray font-body-large-prominent">ไม่มีข้อมูลในระบบ</div>
|
|
26
31
|
</div>
|
|
27
32
|
</TableCell>
|
|
28
33
|
</TableRow>
|