pukaad-ui-lib 1.149.0 → 1.151.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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pukaad-ui-lib",
3
3
  "configKey": "pukaadUI",
4
- "version": "1.149.0",
4
+ "version": "1.151.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -8,6 +8,7 @@ export interface DataTableProps {
8
8
  disabledSort?: boolean;
9
9
  disabledPagination?: boolean;
10
10
  totalPage?: number;
11
+ loading?: boolean;
11
12
  }
12
13
  type __VLS_Props = DataTableProps;
13
14
  type __VLS_ModelProps = {
@@ -19,25 +20,25 @@ declare var __VLS_13: {
19
20
  }, __VLS_32: {
20
21
  items: Record<string, any>[];
21
22
  header: TableHeader[];
22
- }, __VLS_48: {
23
+ }, __VLS_65: {
23
24
  item: Record<string, any>;
24
25
  header: TableHeader[];
25
26
  index: number;
26
- }, __VLS_57: `item-${string}`, __VLS_58: {
27
+ }, __VLS_74: `item-${string}`, __VLS_75: {
27
28
  item: Record<string, any>;
28
- }, __VLS_60: {}, __VLS_68: {};
29
+ }, __VLS_77: {}, __VLS_85: {};
29
30
  type __VLS_Slots = {} & {
30
- [K in NonNullable<typeof __VLS_57>]?: (props: typeof __VLS_58) => any;
31
+ [K in NonNullable<typeof __VLS_74>]?: (props: typeof __VLS_75) => any;
31
32
  } & {
32
33
  header?: (props: typeof __VLS_13) => any;
33
34
  } & {
34
35
  body?: (props: typeof __VLS_32) => any;
35
36
  } & {
36
- item?: (props: typeof __VLS_48) => any;
37
+ item?: (props: typeof __VLS_65) => any;
37
38
  } & {
38
- empty?: (props: typeof __VLS_60) => any;
39
+ empty?: (props: typeof __VLS_77) => any;
39
40
  } & {
40
- 'empty-content'?: (props: typeof __VLS_68) => any;
41
+ 'empty-content'?: (props: typeof __VLS_85) => any;
41
42
  };
42
43
  declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
43
44
  "update:page": (value: number) => any;
@@ -61,6 +62,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
61
62
  cellAlinement: TableHeaderAlignment;
62
63
  disabledHeader: boolean;
63
64
  disabledSort: boolean;
65
+ loading: boolean;
64
66
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
65
67
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
66
68
  declare const _default: typeof __VLS_export;
@@ -9,6 +9,7 @@ import {
9
9
  TableCell as ShadTableCell,
10
10
  TableEmpty as ShadTableEmpty
11
11
  } from "@/runtime/components/ui/table";
12
+ import { Skeleton } from "@/runtime/components/ui/skeleton";
12
13
  const emit = defineEmits(["select-page", "change-page", "click-row", "change-item-per-page"]);
13
14
  const props = defineProps({
14
15
  items: { type: Array, required: false, default: () => [] },
@@ -18,13 +19,15 @@ const props = defineProps({
18
19
  disabledHeader: { type: Boolean, required: false, default: false },
19
20
  disabledSort: { type: Boolean, required: false, default: false },
20
21
  disabledPagination: { type: Boolean, required: false, default: false },
21
- totalPage: { type: Number, required: false, default: 1 }
22
+ totalPage: { type: Number, required: false, default: 1 },
23
+ loading: { type: Boolean, required: false, default: false }
22
24
  });
23
25
  const page = defineModel("page", { type: Number, ...{
24
26
  default: 1
25
27
  } });
26
28
  const sortkey = ref("");
27
29
  const sortDesc = ref(false);
30
+ const itemPerPage = ref(10);
28
31
  const itemHeaders = computed(() => {
29
32
  if (props.itemHeader.length > 0) return props.itemHeader;
30
33
  if (props.items.length === 0) return [];
@@ -120,7 +123,20 @@ const getJustifyClass = (alignment = "start") => {
120
123
  <!-- Body -->
121
124
  <slot name="body" :items="sortedItems" :header="itemHeaders">
122
125
  <ShadTableBody>
123
- <template v-if="sortedItems.length > 0">
126
+ <!-- Loading Skeleton -->
127
+ <template v-if="props.loading">
128
+ <ShadTableRow v-for="row in itemPerPage" :key="`skeleton-${row}`">
129
+ <ShadTableCell
130
+ v-for="(header, i_header) in itemHeaders"
131
+ :key="`skeleton-cell-${row}-${i_header}`"
132
+ >
133
+ <Skeleton class="h-4 w-full" />
134
+ </ShadTableCell>
135
+ </ShadTableRow>
136
+ </template>
137
+
138
+ <!-- Data Rows -->
139
+ <template v-else-if="sortedItems.length > 0">
124
140
  <ShadTableRow
125
141
  v-for="(item, i_body) in sortedItems"
126
142
  :key="i_body"
@@ -170,7 +186,10 @@ const getJustifyClass = (alignment = "start") => {
170
186
  :totalPage="props.totalPage"
171
187
  v-model="page"
172
188
  @change-item-per-page="
173
- (val) => emit('change-item-per-page', val)
189
+ (val) => {
190
+ itemPerPage = val;
191
+ emit('change-item-per-page', val);
192
+ }
174
193
  "
175
194
  />
176
195
  </div>
@@ -8,6 +8,7 @@ export interface DataTableProps {
8
8
  disabledSort?: boolean;
9
9
  disabledPagination?: boolean;
10
10
  totalPage?: number;
11
+ loading?: boolean;
11
12
  }
12
13
  type __VLS_Props = DataTableProps;
13
14
  type __VLS_ModelProps = {
@@ -19,25 +20,25 @@ declare var __VLS_13: {
19
20
  }, __VLS_32: {
20
21
  items: Record<string, any>[];
21
22
  header: TableHeader[];
22
- }, __VLS_48: {
23
+ }, __VLS_65: {
23
24
  item: Record<string, any>;
24
25
  header: TableHeader[];
25
26
  index: number;
26
- }, __VLS_57: `item-${string}`, __VLS_58: {
27
+ }, __VLS_74: `item-${string}`, __VLS_75: {
27
28
  item: Record<string, any>;
28
- }, __VLS_60: {}, __VLS_68: {};
29
+ }, __VLS_77: {}, __VLS_85: {};
29
30
  type __VLS_Slots = {} & {
30
- [K in NonNullable<typeof __VLS_57>]?: (props: typeof __VLS_58) => any;
31
+ [K in NonNullable<typeof __VLS_74>]?: (props: typeof __VLS_75) => any;
31
32
  } & {
32
33
  header?: (props: typeof __VLS_13) => any;
33
34
  } & {
34
35
  body?: (props: typeof __VLS_32) => any;
35
36
  } & {
36
- item?: (props: typeof __VLS_48) => any;
37
+ item?: (props: typeof __VLS_65) => any;
37
38
  } & {
38
- empty?: (props: typeof __VLS_60) => any;
39
+ empty?: (props: typeof __VLS_77) => any;
39
40
  } & {
40
- 'empty-content'?: (props: typeof __VLS_68) => any;
41
+ 'empty-content'?: (props: typeof __VLS_85) => any;
41
42
  };
42
43
  declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
43
44
  "update:page": (value: number) => any;
@@ -61,6 +62,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
61
62
  cellAlinement: TableHeaderAlignment;
62
63
  disabledHeader: boolean;
63
64
  disabledSort: boolean;
65
+ loading: boolean;
64
66
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
65
67
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
66
68
  declare const _default: typeof __VLS_export;
@@ -33,11 +33,11 @@
33
33
  :limit="5"
34
34
  />
35
35
 
36
- <InputCheckbox
36
+ <!-- <InputCheckbox
37
37
  name="disableComment"
38
38
  label="ไม่อนุญาตให้แสดงความคิดเห็น"
39
39
  v-model="form.disableComment"
40
- />
40
+ /> -->
41
41
 
42
42
  <div class="flex flex-col gap-[8px]">
43
43
  <div class="text-gray font-body-large">ภาพหน้าปก</div>
@@ -36,9 +36,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
36
36
  id: string;
37
37
  name: string;
38
38
  description: string;
39
- limit: number;
40
39
  options: AutocompleteOption[] | string[] | number[];
41
40
  placeholder: string;
41
+ limit: number;
42
42
  disabledErrorMessage: boolean;
43
43
  disabledBorder: boolean;
44
44
  showCounter: boolean;
@@ -36,9 +36,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
36
36
  id: string;
37
37
  name: string;
38
38
  description: string;
39
- limit: number;
40
39
  options: AutocompleteOption[] | string[] | number[];
41
40
  placeholder: string;
41
+ limit: number;
42
42
  disabledErrorMessage: boolean;
43
43
  disabledBorder: boolean;
44
44
  showCounter: boolean;
@@ -26,8 +26,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
26
26
  }>, {
27
27
  name: string;
28
28
  state: "user" | "admin";
29
- limit: number;
30
29
  placeholder: string;
30
+ limit: number;
31
31
  ignore: string[];
32
32
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
33
33
  declare const _default: typeof __VLS_export;
@@ -26,8 +26,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
26
26
  }>, {
27
27
  name: string;
28
28
  state: "user" | "admin";
29
- limit: number;
30
29
  placeholder: string;
30
+ limit: number;
31
31
  ignore: string[];
32
32
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
33
33
  declare const _default: typeof __VLS_export;
@@ -0,0 +1,7 @@
1
+ import type { HTMLAttributes } from "vue";
2
+ type __VLS_Props = {
3
+ class?: HTMLAttributes["class"];
4
+ };
5
+ declare const __VLS_export: 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>;
6
+ declare const _default: typeof __VLS_export;
7
+ export default _default;
@@ -0,0 +1,13 @@
1
+ <script setup>
2
+ import { cn } from "@/runtime/plugins/shadcn";
3
+ const props = defineProps({
4
+ class: { type: null, required: false }
5
+ });
6
+ </script>
7
+
8
+ <template>
9
+ <div
10
+ data-slot="skeleton"
11
+ :class="cn('animate-pulse rounded-md bg-gray-200', props.class)"
12
+ />
13
+ </template>
@@ -0,0 +1,7 @@
1
+ import type { HTMLAttributes } from "vue";
2
+ type __VLS_Props = {
3
+ class?: HTMLAttributes["class"];
4
+ };
5
+ declare const __VLS_export: 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>;
6
+ declare const _default: typeof __VLS_export;
7
+ export default _default;
@@ -0,0 +1 @@
1
+ export { default as Skeleton } from "./Skeleton.vue.js";
@@ -0,0 +1 @@
1
+ export { default as Skeleton } from "./Skeleton.vue";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pukaad-ui-lib",
3
- "version": "1.149.0",
3
+ "version": "1.151.0",
4
4
  "description": "pukaad-ui for MeMSG",
5
5
  "repository": {
6
6
  "type": "git",