pukaad-ui-lib 1.182.0 → 1.184.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.
Files changed (24) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/runtime/assets/css/main.css +1 -1
  3. package/dist/runtime/components/image/image-cropper.d.vue.ts +2 -2
  4. package/dist/runtime/components/image/image-cropper.vue.d.ts +2 -2
  5. package/dist/runtime/components/input/input-autocomplete.d.vue.ts +15 -1
  6. package/dist/runtime/components/input/input-autocomplete.vue +119 -13
  7. package/dist/runtime/components/input/input-autocomplete.vue.d.ts +15 -1
  8. package/dist/runtime/components/input/input-combobox.d.vue.ts +2 -2
  9. package/dist/runtime/components/input/input-combobox.vue.d.ts +2 -2
  10. package/dist/runtime/components/input/input-file.d.vue.ts +1 -1
  11. package/dist/runtime/components/input/input-file.vue.d.ts +1 -1
  12. package/dist/runtime/components/input/input-password.d.vue.ts +1 -1
  13. package/dist/runtime/components/input/input-password.vue.d.ts +1 -1
  14. package/dist/runtime/components/input/input-slider.d.vue.ts +1 -1
  15. package/dist/runtime/components/input/input-slider.vue.d.ts +1 -1
  16. package/dist/runtime/components/input/input-tag.d.vue.ts +1 -1
  17. package/dist/runtime/components/input/input-tag.vue.d.ts +1 -1
  18. package/dist/runtime/components/input/input-textarea.d.vue.ts +1 -1
  19. package/dist/runtime/components/input/input-textarea.vue.d.ts +1 -1
  20. package/dist/runtime/components/modal/modal-password-confirmed.d.vue.ts +1 -1
  21. package/dist/runtime/components/modal/modal-password-confirmed.vue.d.ts +1 -1
  22. package/dist/runtime/components/modal/modal-password-verify.d.vue.ts +1 -1
  23. package/dist/runtime/components/modal/modal-password-verify.vue.d.ts +1 -1
  24. package/package.json +1 -1
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pukaad-ui-lib",
3
3
  "configKey": "pukaadUI",
4
- "version": "1.182.0",
4
+ "version": "1.184.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -1 +1 @@
1
- @import "tailwindcss";@import "tw-animate-css";@import "./system.css";@import "./scroll-bar.css";@import "quill/dist/quill.snow.css";@custom-variant dark (&:is(.dark *));@theme inline{--radius-sm:calc(var(--radius) - 4px);--radius-md:calc(var(--radius) - 2px);--radius-lg:var(--radius);--radius-xl:calc(var(--radius) + 4px);--color-background:var(--background);--color-foreground:var(--foreground);--color-card:var(--card);--color-card-foreground:var(--card-foreground);--color-popover:var(--popover);--color-popover-foreground:var(--popover-foreground);--color-primary-foreground:var(--primary-foreground);--color-secondary-foreground:var(--secondary-foreground);--color-muted:var(--muted);--color-muted-foreground:var(--muted-foreground);--color-accent:var(--accent);--color-accent-foreground:var(--accent-foreground);--color-destructive:var(--destructive);--color-destructive-foreground:var(--destructive-foreground);--color-border:var(--border);--color-input:var(--input);--color-ring:var(--ring);--color-chart-1:var(--chart-1);--color-chart-2:var(--chart-2);--color-chart-3:var(--chart-3);--color-chart-4:var(--chart-4);--color-chart-5:var(--chart-5);--color-sidebar:var(--sidebar);--color-sidebar-foreground:var(--sidebar-foreground);--color-sidebar-primary:var(--sidebar-primary);--color-sidebar-primary-foreground:var(--sidebar-primary-foreground);--color-sidebar-accent:var(--sidebar-accent);--color-sidebar-accent-foreground:var(--sidebar-accent-foreground);--color-sidebar-border:var(--sidebar-border);--color-sidebar-ring:var(--sidebar-ring);--color-red:var(--red);--color-error:var(--error);--color-success:var(--success);--color-green:var(--green);--color-warning:var(--warning);--color-yellow:var(--yellow);--color-pink:var(--pink);--color-primary:var(--primary);--color-secondary:var(--secondary);--color-info:var(--info);--color-black:var(--black);--color-dark:var(--dark);--color-gray:var(--gray);--color-cloud:var(--cloud);--color-mercury:var(--mercury);--color-green-light:var(--green-light);--color-red-light:var(--red-light);--color-yellow-light:var(--yellow-light);--color-bright:var(--bright);--color-silver:var(--silver);--color-smoke:var(--smoke);--z-index-announce-tool:10;--z-index-dropdown:11;--z-index-overlay:12;--z-index-loading:13;--z-index-drawer:14;--z-index-modal:15;--z-index-toast:99998;--z-index-loading-page:99999}:root{--radius:0.625rem;--red:#b71c1c;--success:#43a047;--green:#1b5e20;--warning:#f9a825;--yellow:#fbc02d;--info:#e3f2fd;--black:#212121;--dark:#424242;--gray:#616161;--cloud:#c4c4c4;--mercury:#e0e0e0;--green-light:#e3f5e3;--red-light:#fde3e3;--yellow-light:#fef3c7;--bright:#f5f5f5;--silver:#f7f7f7;--smoke:#fafafa;--white:#fff;--pink:#ffe6f4;--background:var(--white);--foreground:var(--black);--card:var(--background);--card-foreground:var(--foreground);--popover:var(--background);--popover-foreground:var(--foreground);--primary:#1976b8;--primary-foreground:var(--white);--secondary:#22a7ef;--secondary-foreground:var(--white);--muted:oklch(0.97 0 0);--muted-foreground:var(--cloud);--accent:oklch(0.97 0 0);--accent-foreground:oklch(0.205 0 0);--destructive:#d32f2f;--destructive-foreground:var(--white);--border:var(--color-mercury);--input:var(--color-mercury);--ring:var(--mercury);--chart-1:oklch(0.646 0.222 41.116);--chart-2:oklch(0.6 0.118 184.704);--chart-3:oklch(0.398 0.07 227.392);--chart-4:oklch(0.828 0.189 84.429);--chart-5:oklch(0.769 0.188 70.08);--sidebar:oklch(0.985 0 0);--sidebar-foreground:var(--foreground);--sidebar-primary:oklch(0.205 0 0);--sidebar-primary-foreground:oklch(0.985 0 0);--sidebar-accent:oklch(0.97 0 0);--sidebar-accent-foreground:oklch(0.205 0 0);--sidebar-border:var(--color-mercury);--sidebar-ring:var(--color-mercury)}.dark{--background:oklch(0.145 0 0);--foreground:oklch(0.985 0 0);--card:oklch(0.145 0 0);--card-foreground:oklch(0.985 0 0);--popover:oklch(0.145 0 0);--popover-foreground:oklch(0.985 0 0);--primary:oklch(0.985 0 0);--primary-foreground:oklch(0.205 0 0);--secondary:oklch(0.269 0 0);--secondary-foreground:oklch(0.985 0 0);--muted:oklch(0.269 0 0);--muted-foreground:oklch(0.708 0 0);--accent:oklch(0.269 0 0);--accent-foreground:oklch(0.985 0 0);--destructive:oklch(0.396 0.141 25.723);--destructive-foreground:oklch(0.637 0.237 25.331);--border:oklch(0.269 0 0);--input:oklch(0.269 0 0);--ring:oklch(0.439 0 0);--chart-1:oklch(0.488 0.243 264.376);--chart-2:oklch(0.696 0.17 162.48);--chart-3:oklch(0.769 0.188 70.08);--chart-4:oklch(0.627 0.265 303.9);--chart-5:oklch(0.645 0.246 16.439);--sidebar:oklch(0.205 0 0);--sidebar-foreground:oklch(0.985 0 0);--sidebar-primary:oklch(0.488 0.243 264.376);--sidebar-primary-foreground:oklch(0.985 0 0);--sidebar-accent:oklch(0.269 0 0);--sidebar-accent-foreground:oklch(0.985 0 0);--sidebar-border:oklch(0.269 0 0);--sidebar-ring:oklch(0.439 0 0)}@layer base{*{@apply border-border outline-ring/50}body{@apply bg-background text-foreground}}
1
+ @import "tailwindcss";@import "tw-animate-css";@import "./system.css";@import "./scroll-bar.css";@import "quill/dist/quill.snow.css";@custom-variant dark (&:is(.dark *));@theme inline{--radius-sm:calc(var(--radius) - 4px);--radius-md:calc(var(--radius) - 2px);--radius-lg:var(--radius);--radius-xl:calc(var(--radius) + 4px);--color-background:var(--background);--color-foreground:var(--foreground);--color-card:var(--card);--color-card-foreground:var(--card-foreground);--color-popover:var(--popover);--color-popover-foreground:var(--popover-foreground);--color-primary-foreground:var(--primary-foreground);--color-secondary-foreground:var(--secondary-foreground);--color-muted:var(--muted);--color-muted-foreground:var(--muted-foreground);--color-accent:var(--accent);--color-accent-foreground:var(--accent-foreground);--color-destructive:var(--destructive);--color-destructive-foreground:var(--destructive-foreground);--color-border:var(--border);--color-input:var(--input);--color-ring:var(--ring);--color-chart-1:var(--chart-1);--color-chart-2:var(--chart-2);--color-chart-3:var(--chart-3);--color-chart-4:var(--chart-4);--color-chart-5:var(--chart-5);--color-sidebar:var(--sidebar);--color-sidebar-foreground:var(--sidebar-foreground);--color-sidebar-primary:var(--sidebar-primary);--color-sidebar-primary-foreground:var(--sidebar-primary-foreground);--color-sidebar-accent:var(--sidebar-accent);--color-sidebar-accent-foreground:var(--sidebar-accent-foreground);--color-sidebar-border:var(--sidebar-border);--color-sidebar-ring:var(--sidebar-ring);--color-red:var(--red);--color-error:var(--error);--color-success:var(--success);--color-green:var(--green);--color-warning:var(--warning);--color-yellow:var(--yellow);--color-pink:var(--pink);--color-primary:var(--primary);--color-secondary:var(--secondary);--color-info:var(--info);--color-black:var(--black);--color-dark:var(--dark);--color-gray:var(--gray);--color-cloud:var(--cloud);--color-mercury:var(--mercury);--color-green-light:var(--green-light);--color-red-light:var(--red-light);--color-yellow-light:var(--yellow-light);--color-bright:var(--bright);--color-silver:var(--silver);--color-smoke:var(--smoke);--z-index-announce-tool:10;--z-index-navbar:11;--z-index-dropdown:12;--z-index-overlay:13;--z-index-loading:14;--z-index-drawer:15;--z-index-modal:16;--z-index-toast:100;--z-index-loading-page:101}:root{--radius:0.625rem;--red:#b71c1c;--success:#43a047;--green:#1b5e20;--warning:#f9a825;--yellow:#fbc02d;--info:#e3f2fd;--black:#212121;--dark:#424242;--gray:#616161;--cloud:#c4c4c4;--mercury:#e0e0e0;--green-light:#e3f5e3;--red-light:#fde3e3;--yellow-light:#fef3c7;--bright:#f5f5f5;--silver:#f7f7f7;--smoke:#fafafa;--white:#fff;--pink:#ffe6f4;--background:var(--white);--foreground:var(--black);--card:var(--background);--card-foreground:var(--foreground);--popover:var(--background);--popover-foreground:var(--foreground);--primary:#1976b8;--primary-foreground:var(--white);--secondary:#22a7ef;--secondary-foreground:var(--white);--muted:oklch(0.97 0 0);--muted-foreground:var(--cloud);--accent:oklch(0.97 0 0);--accent-foreground:oklch(0.205 0 0);--destructive:#d32f2f;--destructive-foreground:var(--white);--border:var(--color-mercury);--input:var(--color-mercury);--ring:var(--mercury);--chart-1:oklch(0.646 0.222 41.116);--chart-2:oklch(0.6 0.118 184.704);--chart-3:oklch(0.398 0.07 227.392);--chart-4:oklch(0.828 0.189 84.429);--chart-5:oklch(0.769 0.188 70.08);--sidebar:oklch(0.985 0 0);--sidebar-foreground:var(--foreground);--sidebar-primary:oklch(0.205 0 0);--sidebar-primary-foreground:oklch(0.985 0 0);--sidebar-accent:oklch(0.97 0 0);--sidebar-accent-foreground:oklch(0.205 0 0);--sidebar-border:var(--color-mercury);--sidebar-ring:var(--color-mercury)}.dark{--background:oklch(0.145 0 0);--foreground:oklch(0.985 0 0);--card:oklch(0.145 0 0);--card-foreground:oklch(0.985 0 0);--popover:oklch(0.145 0 0);--popover-foreground:oklch(0.985 0 0);--primary:oklch(0.985 0 0);--primary-foreground:oklch(0.205 0 0);--secondary:oklch(0.269 0 0);--secondary-foreground:oklch(0.985 0 0);--muted:oklch(0.269 0 0);--muted-foreground:oklch(0.708 0 0);--accent:oklch(0.269 0 0);--accent-foreground:oklch(0.985 0 0);--destructive:oklch(0.396 0.141 25.723);--destructive-foreground:oklch(0.637 0.237 25.331);--border:oklch(0.269 0 0);--input:oklch(0.269 0 0);--ring:oklch(0.439 0 0);--chart-1:oklch(0.488 0.243 264.376);--chart-2:oklch(0.696 0.17 162.48);--chart-3:oklch(0.769 0.188 70.08);--chart-4:oklch(0.627 0.265 303.9);--chart-5:oklch(0.645 0.246 16.439);--sidebar:oklch(0.205 0 0);--sidebar-foreground:oklch(0.985 0 0);--sidebar-primary:oklch(0.488 0.243 264.376);--sidebar-primary-foreground:oklch(0.985 0 0);--sidebar-accent:oklch(0.269 0 0);--sidebar-accent-foreground:oklch(0.985 0 0);--sidebar-border:oklch(0.269 0 0);--sidebar-ring:oklch(0.439 0 0)}@layer base{*{@apply border-border outline-ring/50}body{@apply bg-background text-foreground}}
@@ -64,15 +64,15 @@ declare const __VLS_export: import("vue").DefineComponent<ImageCropperProps, {
64
64
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ImageCropperProps> & Readonly<{}>, {
65
65
  src: string;
66
66
  center: boolean;
67
+ background: boolean;
68
+ modal: boolean;
67
69
  responsive: boolean;
68
70
  restore: boolean;
69
71
  checkCrossOrigin: boolean;
70
72
  checkOrientation: boolean;
71
73
  crossorigin: "" | "anonymous" | "use-credentials";
72
- modal: boolean;
73
74
  guides: boolean;
74
75
  highlight: boolean;
75
- background: boolean;
76
76
  autoCrop: boolean;
77
77
  movable: boolean;
78
78
  rotatable: boolean;
@@ -64,15 +64,15 @@ declare const __VLS_export: import("vue").DefineComponent<ImageCropperProps, {
64
64
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ImageCropperProps> & Readonly<{}>, {
65
65
  src: string;
66
66
  center: boolean;
67
+ background: boolean;
68
+ modal: boolean;
67
69
  responsive: boolean;
68
70
  restore: boolean;
69
71
  checkCrossOrigin: boolean;
70
72
  checkOrientation: boolean;
71
73
  crossorigin: "" | "anonymous" | "use-credentials";
72
- modal: boolean;
73
74
  guides: boolean;
74
75
  highlight: boolean;
75
- background: boolean;
76
76
  autoCrop: boolean;
77
77
  movable: boolean;
78
78
  rotatable: boolean;
@@ -4,6 +4,13 @@ interface AutocompleteOption {
4
4
  description?: string;
5
5
  value: string | number;
6
6
  }
7
+ interface FetchFnResult {
8
+ data: Record<string, any>[];
9
+ meta: {
10
+ total_pages: number;
11
+ [key: string]: any;
12
+ };
13
+ }
7
14
  interface InputAutocompleteProps {
8
15
  id?: string;
9
16
  name?: string;
@@ -19,6 +26,10 @@ interface InputAutocompleteProps {
19
26
  showCounter?: boolean;
20
27
  limit?: number;
21
28
  returnObject?: boolean;
29
+ fetchFn?: (page: number, pageSize: number, search?: string) => Promise<FetchFnResult>;
30
+ valueKey?: string;
31
+ labelKey?: string;
32
+ pageSize?: number;
22
33
  }
23
34
  type __VLS_Props = InputAutocompleteProps;
24
35
  type __VLS_ModelProps = {
@@ -37,12 +48,15 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
37
48
  name: string;
38
49
  description: string;
39
50
  options: AutocompleteOption[] | string[] | number[];
40
- placeholder: string;
41
51
  limit: number;
52
+ placeholder: string;
42
53
  disabledErrorMessage: boolean;
43
54
  disabledBorder: boolean;
44
55
  showCounter: boolean;
45
56
  returnObject: boolean;
57
+ valueKey: string;
58
+ labelKey: string;
59
+ pageSize: number;
46
60
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
47
61
  declare const _default: typeof __VLS_export;
48
62
  export default _default;
@@ -32,11 +32,15 @@
32
32
  <ShadPopoverContent
33
33
  @openAutoFocus.prevent
34
34
  @closeAutoFocus.prevent
35
+ @scroll="handleListScroll"
35
36
  align="start"
36
37
  class="max-h-[312px] overflow-auto"
38
+ ref="popoverContentRef"
37
39
  >
38
40
  <div
39
- v-if="filteredOptions.length === 0"
41
+ v-if="
42
+ filteredOptions.length === 0 && !(props.fetchFn && paginationState.loading)
43
+ "
40
44
  class="flex flex-col gap-[8px] items-center justify-center h-[192px]"
41
45
  >
42
46
  <Icon name="pukaad:page-not-found" class="w-[77px] h-[64px]" />
@@ -63,13 +67,25 @@
63
67
  size="16"
64
68
  />
65
69
  </div>
70
+
71
+ <!-- Loading Indicator -->
72
+ <div
73
+ v-if="props.fetchFn && paginationState.loading"
74
+ class="flex justify-center p-2"
75
+ >
76
+ <Icon
77
+ name="lucide:loader-2"
78
+ class="animate-spin h-5 w-5 text-primary"
79
+ />
80
+ </div>
66
81
  </div>
67
82
  </ShadPopoverContent>
68
83
  </ShadPopover>
69
84
  </template>
70
85
 
71
86
  <script setup>
72
- import { ref, computed, watch } from "vue";
87
+ import { ref, computed, watch, reactive, onMounted } from "vue";
88
+ import { useDebounceFn, useEventListener } from "@vueuse/core";
73
89
  const props = defineProps({
74
90
  id: { type: String, required: false, default: "input-autocomplete" },
75
91
  name: { type: String, required: false, default: "input-autocompl" },
@@ -84,7 +100,11 @@ const props = defineProps({
84
100
  options: { type: Array, required: false, default: () => [] },
85
101
  showCounter: { type: Boolean, required: false, default: false },
86
102
  limit: { type: Number, required: false, default: 0 },
87
- returnObject: { type: Boolean, required: false, default: false }
103
+ returnObject: { type: Boolean, required: false, default: false },
104
+ fetchFn: { type: Function, required: false },
105
+ valueKey: { type: String, required: false, default: "value" },
106
+ labelKey: { type: String, required: false, default: "label" },
107
+ pageSize: { type: Number, required: false, default: 10 }
88
108
  });
89
109
  const modelValue = defineModel({ type: [String, Number], ...{
90
110
  default: ""
@@ -92,6 +112,48 @@ const modelValue = defineModel({ type: [String, Number], ...{
92
112
  const open = ref(false);
93
113
  const searchText = ref("");
94
114
  const fieldRef = ref();
115
+ const popoverContentRef = ref();
116
+ const paginationState = reactive({
117
+ data: [],
118
+ page: 1,
119
+ hasMore: true,
120
+ loading: false
121
+ });
122
+ const fetchData = async (reset = false) => {
123
+ if (!props.fetchFn) return;
124
+ if (paginationState.loading) return;
125
+ if (!paginationState.hasMore && !reset) return;
126
+ if (reset) {
127
+ paginationState.page = 1;
128
+ paginationState.data = [];
129
+ paginationState.hasMore = true;
130
+ }
131
+ paginationState.loading = true;
132
+ try {
133
+ const res = await props.fetchFn(
134
+ paginationState.page,
135
+ props.pageSize,
136
+ searchText.value || void 0
137
+ );
138
+ if (res && res.data) {
139
+ const mapped = res.data.map((item) => ({
140
+ value: typeof item[props.valueKey] === "number" ? item[props.valueKey] : String(item[props.valueKey]),
141
+ label: String(item[props.labelKey]),
142
+ description: item.description ? String(item.description) : void 0
143
+ }));
144
+ paginationState.data = [...paginationState.data, ...mapped];
145
+ paginationState.page++;
146
+ paginationState.hasMore = paginationState.page <= (res.meta?.total_pages ?? 1);
147
+ } else {
148
+ paginationState.hasMore = false;
149
+ }
150
+ } catch (e) {
151
+ console.error("InputAutocomplete: Failed to fetch data:", e);
152
+ paginationState.hasMore = false;
153
+ } finally {
154
+ paginationState.loading = false;
155
+ }
156
+ };
95
157
  const normalizedOptions = computed(() => {
96
158
  return props.options.map((opt) => {
97
159
  if (typeof opt === "object" && opt !== null) {
@@ -103,24 +165,65 @@ const normalizedOptions = computed(() => {
103
165
  };
104
166
  });
105
167
  });
168
+ const resolvedOptions = computed(() => {
169
+ if (props.fetchFn) {
170
+ return paginationState.data;
171
+ }
172
+ return normalizedOptions.value;
173
+ });
106
174
  const filteredOptions = computed(() => {
175
+ if (props.fetchFn) return resolvedOptions.value;
107
176
  const search = searchText.value.toLowerCase().trim();
108
- if (!search) return normalizedOptions.value;
177
+ if (!search) return resolvedOptions.value;
109
178
  if (modelValue.value) {
110
- const selected = normalizedOptions.value.find(
179
+ const selected = resolvedOptions.value.find(
111
180
  (opt) => opt.value === modelValue.value
112
181
  );
113
182
  if (selected && selected.label.toLowerCase().trim() === search) {
114
- return normalizedOptions.value;
183
+ return resolvedOptions.value;
115
184
  }
116
185
  }
117
- return normalizedOptions.value.filter(
186
+ return resolvedOptions.value.filter(
118
187
  (opt) => opt.label.toLowerCase().includes(search)
119
188
  );
120
189
  });
190
+ const handleListScroll = (e) => {
191
+ if (!props.fetchFn) return;
192
+ const target = e.target;
193
+ if (!target) return;
194
+ const { scrollTop, scrollHeight, clientHeight } = target;
195
+ if (scrollHeight - scrollTop - clientHeight < 50) {
196
+ fetchData();
197
+ }
198
+ };
199
+ watch(
200
+ () => popoverContentRef.value,
201
+ (comp) => {
202
+ const el = comp?.$el || comp?.content || (comp instanceof HTMLElement ? comp : null);
203
+ if (el) {
204
+ useEventListener(el, "scroll", handleListScroll);
205
+ }
206
+ },
207
+ { immediate: true }
208
+ );
209
+ const debouncedFetchSearch = useDebounceFn(() => {
210
+ if (props.fetchFn) {
211
+ fetchData(true);
212
+ }
213
+ }, 300);
214
+ onMounted(() => {
215
+ if (props.fetchFn && modelValue.value) {
216
+ fetchData();
217
+ }
218
+ });
219
+ watch(open, (isOpen) => {
220
+ if (isOpen && props.fetchFn && paginationState.data.length === 0) {
221
+ fetchData();
222
+ }
223
+ });
121
224
  const handleBlur = () => {
122
225
  if (modelValue.value) {
123
- const selected = normalizedOptions.value.find(
226
+ const selected = resolvedOptions.value.find(
124
227
  (opt) => opt.value === modelValue.value
125
228
  );
126
229
  if (selected) {
@@ -141,16 +244,16 @@ const selectOption = (option) => {
141
244
  open.value = true;
142
245
  };
143
246
  watch(
144
- modelValue,
145
- (val) => {
146
- if (val) {
147
- const found = normalizedOptions.value.find((o) => o.value === val);
247
+ [modelValue, resolvedOptions],
248
+ ([newVal, newOpts]) => {
249
+ if (newVal) {
250
+ const found = newOpts.find((o) => o.value === newVal);
148
251
  if (found) {
149
252
  searchText.value = found.label;
150
253
  }
151
254
  }
152
255
  },
153
- { immediate: true }
256
+ { immediate: true, deep: true }
154
257
  );
155
258
  watch(searchText, (val) => {
156
259
  if (!open.value && val) {
@@ -159,6 +262,9 @@ watch(searchText, (val) => {
159
262
  if (val === "") {
160
263
  modelValue.value = "";
161
264
  }
265
+ if (props.fetchFn) {
266
+ debouncedFetchSearch();
267
+ }
162
268
  });
163
269
  const setErrors = (errMsg) => {
164
270
  fieldRef.value?.setErrors(errMsg);
@@ -4,6 +4,13 @@ interface AutocompleteOption {
4
4
  description?: string;
5
5
  value: string | number;
6
6
  }
7
+ interface FetchFnResult {
8
+ data: Record<string, any>[];
9
+ meta: {
10
+ total_pages: number;
11
+ [key: string]: any;
12
+ };
13
+ }
7
14
  interface InputAutocompleteProps {
8
15
  id?: string;
9
16
  name?: string;
@@ -19,6 +26,10 @@ interface InputAutocompleteProps {
19
26
  showCounter?: boolean;
20
27
  limit?: number;
21
28
  returnObject?: boolean;
29
+ fetchFn?: (page: number, pageSize: number, search?: string) => Promise<FetchFnResult>;
30
+ valueKey?: string;
31
+ labelKey?: string;
32
+ pageSize?: number;
22
33
  }
23
34
  type __VLS_Props = InputAutocompleteProps;
24
35
  type __VLS_ModelProps = {
@@ -37,12 +48,15 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
37
48
  name: string;
38
49
  description: string;
39
50
  options: AutocompleteOption[] | string[] | number[];
40
- placeholder: string;
41
51
  limit: number;
52
+ placeholder: string;
42
53
  disabledErrorMessage: boolean;
43
54
  disabledBorder: boolean;
44
55
  showCounter: boolean;
45
56
  returnObject: boolean;
57
+ valueKey: string;
58
+ labelKey: string;
59
+ pageSize: number;
46
60
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
47
61
  declare const _default: typeof __VLS_export;
48
62
  export default _default;
@@ -55,11 +55,11 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
55
55
  }>, {
56
56
  name: string;
57
57
  limit: number;
58
- multiple: boolean;
59
- placeholderSearch: string;
60
58
  valueKey: string;
61
59
  labelKey: string;
62
60
  pageSize: number;
61
+ multiple: boolean;
62
+ placeholderSearch: string;
63
63
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
64
64
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
65
65
  declare const _default: typeof __VLS_export;
@@ -55,11 +55,11 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
55
55
  }>, {
56
56
  name: string;
57
57
  limit: number;
58
- multiple: boolean;
59
- placeholderSearch: string;
60
58
  valueKey: string;
61
59
  labelKey: string;
62
60
  pageSize: number;
61
+ multiple: boolean;
62
+ placeholderSearch: string;
63
63
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
64
64
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
65
65
  declare const _default: typeof __VLS_export;
@@ -31,8 +31,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
31
31
  fullHeight: boolean;
32
32
  name: string;
33
33
  limit: number;
34
- accept: string;
35
34
  disabledErrorMessage: boolean;
35
+ accept: string;
36
36
  labelIcon: string;
37
37
  disabledDrop: boolean;
38
38
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -31,8 +31,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
31
31
  fullHeight: boolean;
32
32
  name: string;
33
33
  limit: number;
34
- accept: string;
35
34
  disabledErrorMessage: boolean;
35
+ accept: string;
36
36
  labelIcon: string;
37
37
  disabledDrop: boolean;
38
38
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -22,8 +22,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
22
22
  }>, {
23
23
  id: string;
24
24
  name: string;
25
- disabledForgotPassword: boolean;
26
25
  new: boolean;
26
+ disabledForgotPassword: boolean;
27
27
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
28
28
  declare const _default: typeof __VLS_export;
29
29
  export default _default;
@@ -22,8 +22,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
22
22
  }>, {
23
23
  id: string;
24
24
  name: string;
25
- disabledForgotPassword: boolean;
26
25
  new: boolean;
26
+ disabledForgotPassword: boolean;
27
27
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
28
28
  declare const _default: typeof __VLS_export;
29
29
  export default _default;
@@ -12,9 +12,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
12
12
  label: string;
13
13
  color: InputSliderColor;
14
14
  fullWidth: boolean;
15
- step: number;
16
15
  max: number;
17
16
  min: number;
17
+ step: number;
18
18
  lineHeight: number | string;
19
19
  appearance: boolean;
20
20
  thumbSize: number | string;
@@ -12,9 +12,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
12
12
  label: string;
13
13
  color: InputSliderColor;
14
14
  fullWidth: boolean;
15
- step: number;
16
15
  max: number;
17
16
  min: number;
17
+ step: number;
18
18
  lineHeight: number | string;
19
19
  appearance: boolean;
20
20
  thumbSize: number | string;
@@ -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
- placeholder: string;
30
29
  limit: number;
30
+ placeholder: string;
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
- placeholder: string;
30
29
  limit: number;
30
+ placeholder: string;
31
31
  ignore: string[];
32
32
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
33
33
  declare const _default: typeof __VLS_export;
@@ -45,10 +45,10 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
45
45
  name: string;
46
46
  disabled: boolean;
47
47
  limit: number;
48
- resize: "none" | "both" | "horizontal" | "vertical";
49
48
  disabledErrorMessage: boolean;
50
49
  disabledBorder: boolean;
51
50
  showCounter: boolean;
51
+ resize: "none" | "both" | "horizontal" | "vertical";
52
52
  readonly: boolean;
53
53
  rows: number;
54
54
  heightScroll: boolean;
@@ -45,10 +45,10 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
45
45
  name: string;
46
46
  disabled: boolean;
47
47
  limit: number;
48
- resize: "none" | "both" | "horizontal" | "vertical";
49
48
  disabledErrorMessage: boolean;
50
49
  disabledBorder: boolean;
51
50
  showCounter: boolean;
51
+ resize: "none" | "both" | "horizontal" | "vertical";
52
52
  readonly: boolean;
53
53
  rows: number;
54
54
  heightScroll: boolean;
@@ -24,8 +24,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
24
24
  onClose?: (() => any) | undefined;
25
25
  }>, {
26
26
  title: string;
27
- confirmText: string;
28
27
  disabledForgotPassword: boolean;
28
+ confirmText: string;
29
29
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
30
30
  declare const _default: typeof __VLS_export;
31
31
  export default _default;
@@ -24,8 +24,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
24
24
  onClose?: (() => any) | undefined;
25
25
  }>, {
26
26
  title: string;
27
- confirmText: string;
28
27
  disabledForgotPassword: boolean;
28
+ confirmText: string;
29
29
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
30
30
  declare const _default: typeof __VLS_export;
31
31
  export default _default;
@@ -28,8 +28,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
28
28
  }>, {
29
29
  title: string;
30
30
  mode: "login" | "secure";
31
- confirmText: string;
32
31
  disabledForgotPassword: boolean;
32
+ confirmText: string;
33
33
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
34
34
  declare const _default: typeof __VLS_export;
35
35
  export default _default;
@@ -28,8 +28,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
28
28
  }>, {
29
29
  title: string;
30
30
  mode: "login" | "secure";
31
- confirmText: string;
32
31
  disabledForgotPassword: boolean;
32
+ confirmText: string;
33
33
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
34
34
  declare const _default: typeof __VLS_export;
35
35
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pukaad-ui-lib",
3
- "version": "1.182.0",
3
+ "version": "1.184.0",
4
4
  "description": "pukaad-ui for MeMSG",
5
5
  "repository": {
6
6
  "type": "git",