pukaad-ui-lib 1.39.0 → 1.41.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/assets/json/address/Amphur.json +7346 -0
- package/dist/runtime/assets/json/address/Province.json +762 -0
- package/dist/runtime/assets/json/address/Tambon.json +64775 -0
- package/dist/runtime/assets/json/address/Zipcode.json +17208 -0
- package/dist/runtime/components/button.vue +1 -1
- package/dist/runtime/components/collapse/collapse.vue +1 -1
- package/dist/runtime/components/drawer/drawer.d.vue.ts +1 -1
- package/dist/runtime/components/drawer/drawer.vue +2 -2
- package/dist/runtime/components/drawer/drawer.vue.d.ts +1 -1
- package/dist/runtime/components/input/input-address.d.vue.ts +14 -32
- package/dist/runtime/components/input/input-address.vue +174 -360
- package/dist/runtime/components/input/input-address.vue.d.ts +14 -32
- package/dist/runtime/components/input/input-autocomplete.vue +2 -2
- package/dist/runtime/components/input/input-combobox.d.vue.ts +12 -5
- package/dist/runtime/components/input/input-combobox.vue +143 -121
- package/dist/runtime/components/input/input-combobox.vue.d.ts +12 -5
- package/dist/runtime/components/input/input-file.d.vue.ts +1 -1
- package/dist/runtime/components/input/input-file.vue.d.ts +1 -1
- package/dist/runtime/components/input/input-password.d.vue.ts +1 -1
- package/dist/runtime/components/input/input-password.vue.d.ts +1 -1
- package/dist/runtime/components/input/input-slider.d.vue.ts +1 -1
- package/dist/runtime/components/input/input-slider.vue.d.ts +1 -1
- package/dist/runtime/components/input/input-text-field.d.vue.ts +3 -1
- package/dist/runtime/components/input/input-text-field.vue +8 -2
- package/dist/runtime/components/input/input-text-field.vue.d.ts +3 -1
- package/dist/runtime/components/input/input-textarea.d.vue.ts +1 -1
- package/dist/runtime/components/input/input-textarea.vue.d.ts +1 -1
- package/dist/runtime/components/loading.d.vue.ts +2 -4
- package/dist/runtime/components/loading.vue +4 -8
- package/dist/runtime/components/loading.vue.d.ts +2 -4
- package/dist/runtime/components/modal/modal-share.vue +1 -1
- package/dist/runtime/components/modal/modal.d.vue.ts +2 -1
- package/dist/runtime/components/modal/modal.vue +2 -2
- package/dist/runtime/components/modal/modal.vue.d.ts +2 -1
- package/dist/runtime/components/ui/input-group/InputGroupButton.d.vue.ts +1 -1
- package/dist/runtime/components/ui/input-group/InputGroupButton.vue.d.ts +1 -1
- package/dist/runtime/components/ui/input-group/index.d.ts +1 -1
- package/dist/runtime/components/ui/native-select/NativeSelectOptGroup.d.vue.ts +2 -2
- package/dist/runtime/components/ui/native-select/NativeSelectOptGroup.vue.d.ts +2 -2
- package/dist/runtime/components/ui/native-select/NativeSelectOption.d.vue.ts +2 -2
- package/dist/runtime/components/ui/native-select/NativeSelectOption.vue.d.ts +2 -2
- package/dist/runtime/components/ui/tabs/TabsList.vue +6 -4
- package/dist/runtime/components/ui/tabs/TabsTrigger.vue +6 -4
- package/dist/runtime/composables/useThaiAddress.d.ts +45 -0
- package/dist/runtime/composables/useThaiAddress.js +81 -0
- package/package.json +1 -1
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<Transition name="loading-fade">
|
|
3
3
|
<div
|
|
4
|
-
v-if="
|
|
5
|
-
class="absolute inset-0
|
|
4
|
+
v-if="loading"
|
|
5
|
+
class="absolute inset-0 bg-white/50 flex items-center justify-center z-50"
|
|
6
6
|
>
|
|
7
|
-
<div class="
|
|
8
|
-
<div class="loading-spinner"></div>
|
|
9
|
-
<span v-if="text" class="text-sm text-cloud">{{ text }}</span>
|
|
10
|
-
</div>
|
|
7
|
+
<div class="loading-spinner"></div>
|
|
11
8
|
</div>
|
|
12
9
|
</Transition>
|
|
13
10
|
</template>
|
|
14
11
|
|
|
15
12
|
<script setup>
|
|
16
13
|
defineProps({
|
|
17
|
-
|
|
18
|
-
text: { type: String, required: false, default: "" }
|
|
14
|
+
loading: { type: Boolean, required: false, default: false }
|
|
19
15
|
});
|
|
20
16
|
</script>
|
|
21
17
|
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
export interface LoadingProps {
|
|
2
|
-
|
|
3
|
-
text?: string;
|
|
2
|
+
loading?: boolean;
|
|
4
3
|
}
|
|
5
4
|
declare const __VLS_export: import("vue").DefineComponent<LoadingProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<LoadingProps> & Readonly<{}>, {
|
|
6
|
-
|
|
7
|
-
isLoading: boolean;
|
|
5
|
+
loading: boolean;
|
|
8
6
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
9
7
|
declare const _default: typeof __VLS_export;
|
|
10
8
|
export default _default;
|
|
@@ -5,7 +5,7 @@ export interface ModalProps {
|
|
|
5
5
|
description?: string;
|
|
6
6
|
footer?: string;
|
|
7
7
|
disabledCloseBtn?: boolean;
|
|
8
|
-
|
|
8
|
+
loading?: boolean;
|
|
9
9
|
loadingText?: string;
|
|
10
10
|
}
|
|
11
11
|
type __VLS_Props = ModalProps;
|
|
@@ -39,6 +39,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
39
39
|
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
40
40
|
onClose?: (() => any) | undefined;
|
|
41
41
|
}>, {
|
|
42
|
+
loading: boolean;
|
|
42
43
|
disabledCloseBtn: boolean;
|
|
43
44
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
44
45
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
@submit="onSubmit"
|
|
8
8
|
@close="onClose"
|
|
9
9
|
>
|
|
10
|
-
<Loading :
|
|
10
|
+
<Loading :loading="props.loading" :text="props.loadingText" />
|
|
11
11
|
<ShadDialogHeader>
|
|
12
12
|
<slot name="header">
|
|
13
13
|
<ShadDialogTitle>
|
|
@@ -38,7 +38,7 @@ const props = defineProps({
|
|
|
38
38
|
description: { type: String, required: false },
|
|
39
39
|
footer: { type: String, required: false },
|
|
40
40
|
disabledCloseBtn: { type: Boolean, required: false, default: false },
|
|
41
|
-
|
|
41
|
+
loading: { type: Boolean, required: false, default: false },
|
|
42
42
|
loadingText: { type: String, required: false }
|
|
43
43
|
});
|
|
44
44
|
const isOpen = defineModel({ type: Boolean, ...{
|
|
@@ -5,7 +5,7 @@ export interface ModalProps {
|
|
|
5
5
|
description?: string;
|
|
6
6
|
footer?: string;
|
|
7
7
|
disabledCloseBtn?: boolean;
|
|
8
|
-
|
|
8
|
+
loading?: boolean;
|
|
9
9
|
loadingText?: string;
|
|
10
10
|
}
|
|
11
11
|
type __VLS_Props = ModalProps;
|
|
@@ -39,6 +39,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
39
39
|
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
40
40
|
onClose?: (() => any) | undefined;
|
|
41
41
|
}>, {
|
|
42
|
+
loading: boolean;
|
|
42
43
|
disabledCloseBtn: boolean;
|
|
43
44
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
44
45
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -5,7 +5,7 @@ type __VLS_Slots = {} & {
|
|
|
5
5
|
};
|
|
6
6
|
declare const __VLS_base: import("vue").DefineComponent<InputGroupButtonProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<InputGroupButtonProps> & Readonly<{}>, {
|
|
7
7
|
variant: "default" | "outline" | "ghost" | "link" | "text" | "icon" | null;
|
|
8
|
-
size: "
|
|
8
|
+
size: "sm" | "icon-sm" | "icon-xs" | "xs" | null;
|
|
9
9
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
10
10
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
11
11
|
declare const _default: typeof __VLS_export;
|
|
@@ -5,7 +5,7 @@ type __VLS_Slots = {} & {
|
|
|
5
5
|
};
|
|
6
6
|
declare const __VLS_base: import("vue").DefineComponent<InputGroupButtonProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<InputGroupButtonProps> & Readonly<{}>, {
|
|
7
7
|
variant: "default" | "outline" | "ghost" | "link" | "text" | "icon" | null;
|
|
8
|
-
size: "
|
|
8
|
+
size: "sm" | "icon-sm" | "icon-xs" | "xs" | null;
|
|
9
9
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
10
10
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
11
11
|
declare const _default: typeof __VLS_export;
|
|
@@ -12,7 +12,7 @@ export declare const inputGroupAddonVariants: (props?: ({
|
|
|
12
12
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
13
13
|
export type InputGroupVariants = VariantProps<typeof inputGroupAddonVariants>;
|
|
14
14
|
export declare const inputGroupButtonVariants: (props?: ({
|
|
15
|
-
size?: "
|
|
15
|
+
size?: "sm" | "icon-sm" | "icon-xs" | "xs" | null | undefined;
|
|
16
16
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
17
17
|
export type InputGroupButtonVariants = VariantProps<typeof inputGroupButtonVariants>;
|
|
18
18
|
export interface InputGroupButtonProps {
|
|
@@ -59,7 +59,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
59
59
|
'aria-colindex'?: (string | number) | undefined;
|
|
60
60
|
'aria-colspan'?: (string | number) | undefined;
|
|
61
61
|
'aria-controls'?: string | undefined | undefined;
|
|
62
|
-
'aria-current'?: "time" | "page" | (boolean | "true" | "false") | "
|
|
62
|
+
'aria-current'?: "time" | "page" | (boolean | "true" | "false") | "date" | "step" | "location" | undefined;
|
|
63
63
|
'aria-describedby'?: string | undefined | undefined;
|
|
64
64
|
'aria-details'?: string | undefined | undefined;
|
|
65
65
|
'aria-disabled'?: (boolean | "true" | "false") | undefined;
|
|
@@ -253,7 +253,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
253
253
|
'aria-colindex'?: (string | number) | undefined;
|
|
254
254
|
'aria-colspan'?: (string | number) | undefined;
|
|
255
255
|
'aria-controls'?: string | undefined | undefined;
|
|
256
|
-
'aria-current'?: "time" | "page" | (boolean | "true" | "false") | "
|
|
256
|
+
'aria-current'?: "time" | "page" | (boolean | "true" | "false") | "date" | "step" | "location" | undefined;
|
|
257
257
|
'aria-describedby'?: string | undefined | undefined;
|
|
258
258
|
'aria-details'?: string | undefined | undefined;
|
|
259
259
|
'aria-disabled'?: (boolean | "true" | "false") | undefined;
|
|
@@ -59,7 +59,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
59
59
|
'aria-colindex'?: (string | number) | undefined;
|
|
60
60
|
'aria-colspan'?: (string | number) | undefined;
|
|
61
61
|
'aria-controls'?: string | undefined | undefined;
|
|
62
|
-
'aria-current'?: "time" | "page" | (boolean | "true" | "false") | "
|
|
62
|
+
'aria-current'?: "time" | "page" | (boolean | "true" | "false") | "date" | "step" | "location" | undefined;
|
|
63
63
|
'aria-describedby'?: string | undefined | undefined;
|
|
64
64
|
'aria-details'?: string | undefined | undefined;
|
|
65
65
|
'aria-disabled'?: (boolean | "true" | "false") | undefined;
|
|
@@ -253,7 +253,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
253
253
|
'aria-colindex'?: (string | number) | undefined;
|
|
254
254
|
'aria-colspan'?: (string | number) | undefined;
|
|
255
255
|
'aria-controls'?: string | undefined | undefined;
|
|
256
|
-
'aria-current'?: "time" | "page" | (boolean | "true" | "false") | "
|
|
256
|
+
'aria-current'?: "time" | "page" | (boolean | "true" | "false") | "date" | "step" | "location" | undefined;
|
|
257
257
|
'aria-describedby'?: string | undefined | undefined;
|
|
258
258
|
'aria-details'?: string | undefined | undefined;
|
|
259
259
|
'aria-disabled'?: (boolean | "true" | "false") | undefined;
|
|
@@ -61,7 +61,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
61
61
|
'aria-colindex'?: (string | number) | undefined;
|
|
62
62
|
'aria-colspan'?: (string | number) | undefined;
|
|
63
63
|
'aria-controls'?: string | undefined | undefined;
|
|
64
|
-
'aria-current'?: "time" | "page" | (boolean | "true" | "false") | "
|
|
64
|
+
'aria-current'?: "time" | "page" | (boolean | "true" | "false") | "date" | "step" | "location" | undefined;
|
|
65
65
|
'aria-describedby'?: string | undefined | undefined;
|
|
66
66
|
'aria-details'?: string | undefined | undefined;
|
|
67
67
|
'aria-disabled'?: (boolean | "true" | "false") | undefined;
|
|
@@ -257,7 +257,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
257
257
|
'aria-colindex'?: (string | number) | undefined;
|
|
258
258
|
'aria-colspan'?: (string | number) | undefined;
|
|
259
259
|
'aria-controls'?: string | undefined | undefined;
|
|
260
|
-
'aria-current'?: "time" | "page" | (boolean | "true" | "false") | "
|
|
260
|
+
'aria-current'?: "time" | "page" | (boolean | "true" | "false") | "date" | "step" | "location" | undefined;
|
|
261
261
|
'aria-describedby'?: string | undefined | undefined;
|
|
262
262
|
'aria-details'?: string | undefined | undefined;
|
|
263
263
|
'aria-disabled'?: (boolean | "true" | "false") | undefined;
|
|
@@ -61,7 +61,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
61
61
|
'aria-colindex'?: (string | number) | undefined;
|
|
62
62
|
'aria-colspan'?: (string | number) | undefined;
|
|
63
63
|
'aria-controls'?: string | undefined | undefined;
|
|
64
|
-
'aria-current'?: "time" | "page" | (boolean | "true" | "false") | "
|
|
64
|
+
'aria-current'?: "time" | "page" | (boolean | "true" | "false") | "date" | "step" | "location" | undefined;
|
|
65
65
|
'aria-describedby'?: string | undefined | undefined;
|
|
66
66
|
'aria-details'?: string | undefined | undefined;
|
|
67
67
|
'aria-disabled'?: (boolean | "true" | "false") | undefined;
|
|
@@ -257,7 +257,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
257
257
|
'aria-colindex'?: (string | number) | undefined;
|
|
258
258
|
'aria-colspan'?: (string | number) | undefined;
|
|
259
259
|
'aria-controls'?: string | undefined | undefined;
|
|
260
|
-
'aria-current'?: "time" | "page" | (boolean | "true" | "false") | "
|
|
260
|
+
'aria-current'?: "time" | "page" | (boolean | "true" | "false") | "date" | "step" | "location" | undefined;
|
|
261
261
|
'aria-describedby'?: string | undefined | undefined;
|
|
262
262
|
'aria-details'?: string | undefined | undefined;
|
|
263
263
|
'aria-disabled'?: (boolean | "true" | "false") | undefined;
|
|
@@ -15,10 +15,12 @@ const delegatedProps = reactiveOmit(props, "class");
|
|
|
15
15
|
<TabsList
|
|
16
16
|
data-slot="tabs-list"
|
|
17
17
|
v-bind="delegatedProps"
|
|
18
|
-
:class="
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
:class="
|
|
19
|
+
cn(
|
|
20
|
+
'bg-muted text-body-medium dark:text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]',
|
|
21
|
+
props.class
|
|
22
|
+
)
|
|
23
|
+
"
|
|
22
24
|
>
|
|
23
25
|
<slot />
|
|
24
26
|
</TabsList>
|
|
@@ -16,10 +16,12 @@ const forwardedProps = useForwardProps(delegatedProps);
|
|
|
16
16
|
<template>
|
|
17
17
|
<TabsTrigger
|
|
18
18
|
data-slot="tabs-trigger"
|
|
19
|
-
:class="
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
:class="
|
|
20
|
+
cn(
|
|
21
|
+
'data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-body-medi dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=inactive]:text-gray [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=\'size-\'])]:size-4',
|
|
22
|
+
props.class
|
|
23
|
+
)
|
|
24
|
+
"
|
|
23
25
|
v-bind="forwardedProps"
|
|
24
26
|
>
|
|
25
27
|
<slot />
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export interface Province {
|
|
2
|
+
id: number;
|
|
3
|
+
name_th: string;
|
|
4
|
+
name_en: string;
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
}
|
|
7
|
+
export interface Amphur {
|
|
8
|
+
id: number;
|
|
9
|
+
name_th: string;
|
|
10
|
+
name_en: string;
|
|
11
|
+
province_id: number;
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
}
|
|
14
|
+
export interface Tambon {
|
|
15
|
+
id: number;
|
|
16
|
+
name_th: string;
|
|
17
|
+
name_en: string;
|
|
18
|
+
amphur_id: number;
|
|
19
|
+
zipcode_code: number;
|
|
20
|
+
[key: string]: any;
|
|
21
|
+
}
|
|
22
|
+
export interface Zipcode {
|
|
23
|
+
code: number;
|
|
24
|
+
amphur_ids: number[];
|
|
25
|
+
tambon_ids: number[];
|
|
26
|
+
[key: string]: any;
|
|
27
|
+
}
|
|
28
|
+
export interface SearchResult {
|
|
29
|
+
type: 'province' | 'amphur' | 'tambon';
|
|
30
|
+
id: number;
|
|
31
|
+
name_th: string;
|
|
32
|
+
name_en: string;
|
|
33
|
+
parentId?: number;
|
|
34
|
+
label: string;
|
|
35
|
+
}
|
|
36
|
+
export declare function useThaiAddress(): {
|
|
37
|
+
getProvinces: () => Province[];
|
|
38
|
+
getProvinceById: (id: number) => Province | undefined;
|
|
39
|
+
getAmphursByProvinceId: (provinceId: number) => Amphur[];
|
|
40
|
+
getAmphurById: (id: number) => Amphur | undefined;
|
|
41
|
+
getTambonsByAmphurId: (amphurId: number) => Tambon[];
|
|
42
|
+
getTambonById: (id: number) => Tambon | undefined;
|
|
43
|
+
getZipcodeByTambonId: (tambonId: number) => string | undefined;
|
|
44
|
+
searchAddress: (query: string) => SearchResult[];
|
|
45
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import provincesData from "@/runtime/assets/json/address/Province.json";
|
|
2
|
+
import amphursData from "@/runtime/assets/json/address/Amphur.json";
|
|
3
|
+
import tambonsData from "@/runtime/assets/json/address/Tambon.json";
|
|
4
|
+
export function useThaiAddress() {
|
|
5
|
+
const getProvinces = () => {
|
|
6
|
+
return provincesData;
|
|
7
|
+
};
|
|
8
|
+
const getProvinceById = (id) => {
|
|
9
|
+
return provincesData.find((p) => p.id === id);
|
|
10
|
+
};
|
|
11
|
+
const getAmphursByProvinceId = (provinceId) => {
|
|
12
|
+
return amphursData.filter((a) => a.province_id === provinceId);
|
|
13
|
+
};
|
|
14
|
+
const getAmphurById = (id) => {
|
|
15
|
+
return amphursData.find((a) => a.id === id);
|
|
16
|
+
};
|
|
17
|
+
const getTambonsByAmphurId = (amphurId) => {
|
|
18
|
+
return tambonsData.filter((t) => t.amphur_id === amphurId);
|
|
19
|
+
};
|
|
20
|
+
const getTambonById = (id) => {
|
|
21
|
+
return tambonsData.find((t) => t.id === id);
|
|
22
|
+
};
|
|
23
|
+
const getZipcodeByTambonId = (tambonId) => {
|
|
24
|
+
const tambon = getTambonById(tambonId);
|
|
25
|
+
return tambon?.zipcode_code?.toString();
|
|
26
|
+
};
|
|
27
|
+
const searchAddress = (query) => {
|
|
28
|
+
if (!query || query.length < 2) return [];
|
|
29
|
+
const lowerQuery = query.toLowerCase();
|
|
30
|
+
const results = [];
|
|
31
|
+
provincesData.forEach((p) => {
|
|
32
|
+
if (p.name_th.includes(query) || p.name_en.toLowerCase().includes(lowerQuery)) {
|
|
33
|
+
results.push({
|
|
34
|
+
type: "province",
|
|
35
|
+
id: p.id,
|
|
36
|
+
name_th: p.name_th,
|
|
37
|
+
name_en: p.name_en,
|
|
38
|
+
label: `\u0E08\u0E31\u0E07\u0E2B\u0E27\u0E31\u0E14${p.name_th} (${p.name_en})`
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
amphursData.forEach((a) => {
|
|
43
|
+
if (a.name_th.includes(query) || a.name_en.toLowerCase().includes(lowerQuery)) {
|
|
44
|
+
const province = getProvinceById(a.province_id);
|
|
45
|
+
results.push({
|
|
46
|
+
type: "amphur",
|
|
47
|
+
id: a.id,
|
|
48
|
+
name_th: a.name_th,
|
|
49
|
+
name_en: a.name_en,
|
|
50
|
+
parentId: a.province_id,
|
|
51
|
+
label: `\u0E2D\u0E33\u0E40\u0E20\u0E2D${a.name_th} (${a.name_en}) - ${province?.name_th}`
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
tambonsData.forEach((t) => {
|
|
56
|
+
if (t.name_th.includes(query) || t.name_en.toLowerCase().includes(lowerQuery)) {
|
|
57
|
+
const amphur = getAmphurById(t.amphur_id);
|
|
58
|
+
const province = amphur ? getProvinceById(amphur.province_id) : null;
|
|
59
|
+
results.push({
|
|
60
|
+
type: "tambon",
|
|
61
|
+
id: t.id,
|
|
62
|
+
name_th: t.name_th,
|
|
63
|
+
name_en: t.name_en,
|
|
64
|
+
parentId: t.amphur_id,
|
|
65
|
+
label: `\u0E15\u0E33\u0E1A\u0E25${t.name_th} (${t.name_en}) - ${amphur?.name_th} - ${province?.name_th}`
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
return results;
|
|
70
|
+
};
|
|
71
|
+
return {
|
|
72
|
+
getProvinces,
|
|
73
|
+
getProvinceById,
|
|
74
|
+
getAmphursByProvinceId,
|
|
75
|
+
getAmphurById,
|
|
76
|
+
getTambonsByAmphurId,
|
|
77
|
+
getTambonById,
|
|
78
|
+
getZipcodeByTambonId,
|
|
79
|
+
searchAddress
|
|
80
|
+
};
|
|
81
|
+
}
|