@omnitend/dashboard-for-laravel 0.47.5 → 0.48.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.
@@ -1,8 +1,8 @@
1
1
  {
2
- "generated": "2026-10-24T05:02:12.083Z",
2
+ "generated": "2026-10-30T16:19:45.329Z",
3
3
  "package": {
4
4
  "name": "@omnitend/dashboard-for-laravel",
5
- "version": "0.47.5"
5
+ "version": "0.48.0"
6
6
  },
7
7
  "components": {
8
8
  "base": [
@@ -102,24 +102,41 @@
102
102
  "name": "DAutocomplete",
103
103
  "category": "base",
104
104
  "filePath": "resources/js/components/base/DAutocomplete.vue",
105
- "description": "Type-safe wrapper around Bootstrap Vue Next BAutocomplete component. Text input with a filtered dropdown of suggestions (typeahead/combobox). Pass `options` and bind `v-model`; supports `multiple` and a custom `filterFunction`. `null-option` adds an opt-in, pinned \"no selection\" row (see below) so a searchable single-select can always reach \"none\" in-list (#138).",
105
+ "description": "Type-safe wrapper around Bootstrap Vue Next BAutocomplete component. Text input with a filtered dropdown of suggestions (typeahead/combobox). Pass `options` and bind `v-model`; supports `multiple` and a custom `filterFunction`. `null-option` adds an opt-in, pinned \"no selection\" row (see below) so a searchable single-select can always reach \"none\" in-list (#138). `provider` asks a server for the options matching the typed text instead of filtering a preloaded list (0.48.0), for lists too big to download.",
106
106
  "props": [
107
107
  {
108
108
  "name": "options",
109
109
  "type": "AutocompleteOptions",
110
110
  "required": false,
111
- "description": "Options passed straight through to BAutocomplete (see its `options` prop)."
111
+ "default": "undefined",
112
+ "description": "Options passed straight through to BAutocomplete (see its `options` prop).\nWith a `provider`, these are a seed: they stay in the list alongside the\nprovider's results, so a value bound before any search has run can be\nlabelled by passing its option here."
113
+ },
114
+ {
115
+ "name": "provider",
116
+ "type": "AutocompleteProvider",
117
+ "required": false,
118
+ "default": "undefined",
119
+ "description": "Ask a server for the options as the user types (0.48.0), for a list too\nbig to download and filter in the browser. Called with the trimmed text\nonce typing has paused for `provider-debounce` ms; its result replaces\nthe list. Only the latest call's result is applied: an earlier call that\nresolves late is dropped, and its signal was aborted when the newer term\nwas typed. bvn's own substring filter is bypassed, since the server has\nalready filtered. An empty term makes no call and clears the results.\nA rejected promise reads as \"Search failed\" in the list (an abort does\nnot) and is logged; it never throws out of the component.\n\nNamed for DXTable's `provider`, a function that supplies rows; `search`\nis bvn's name for the input's text and stays as it was."
120
+ },
121
+ {
122
+ "name": "providerDebounce",
123
+ "type": "number",
124
+ "required": false,
125
+ "default": "250",
126
+ "description": "Milliseconds of quiet typing before `provider` is called."
112
127
  },
113
128
  {
114
129
  "name": "filterFunction",
115
130
  "type": "FilterFunction",
116
131
  "required": false,
132
+ "default": "undefined",
117
133
  "description": "A custom filter. Composed with `null-option` rather than replaced: when a\nnull option is present it stays pinned and this runs on the rest."
118
134
  },
119
135
  {
120
136
  "name": "nullOption",
121
137
  "type": "union",
122
138
  "required": false,
139
+ "default": "undefined",
123
140
  "description": "Prepend a pinned, never-filtered, selectable \"no selection\" row whose value\nis `null` (#138). `true` → default label \"None\"; a string → that label.\nSelecting it sets the model to `null` (bvn reads that as no selection, so\nthe ✕ hides and the placeholder shows). Off by default — unchanged\nbehaviour. DXTable does NOT use this; it builds its own \"All\" option."
124
141
  }
125
142
  ],
@@ -1,7 +1,7 @@
1
1
  # Documentation Map
2
2
 
3
3
  > Auto-generated hierarchical overview of all documentation
4
- > Last updated: 2026-10-24T05:02:12.151Z
4
+ > Last updated: 2026-10-30T16:19:45.390Z
5
5
 
6
6
  This file provides a complete map of all available documentation for AI agents and developers.
7
7
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnitend/dashboard-for-laravel",
3
- "version": "0.47.5",
3
+ "version": "0.48.0",
4
4
  "description": "Vue 3 dashboard components for Laravel with Bootstrap Vue Next",
5
5
  "type": "module",
6
6
  "main": "./dist/dashboard-for-laravel.umd.cjs",
@@ -7,19 +7,55 @@
7
7
  *
8
8
  * `null-option` adds an opt-in, pinned "no selection" row (see below) so a
9
9
  * searchable single-select can always reach "none" in-list (#138).
10
+ *
11
+ * `provider` asks a server for the options matching the typed text instead
12
+ * of filtering a preloaded list (0.48.0), for lists too big to download.
10
13
  */
11
14
  <script setup lang="ts">
12
- import { computed, ref, useAttrs, watch } from "vue";
15
+ import { computed, onBeforeUnmount, ref, useAttrs, watch } from "vue";
13
16
  import { BAutocomplete } from "bootstrap-vue-next";
14
17
  import type { SelectOption } from "bootstrap-vue-next";
15
18
 
16
19
  // bvn's own `options` prop type — kept identical so this stays a pass-through.
17
20
  type AutocompleteOptions = readonly (object | string | number | boolean)[];
18
21
  type FilterFunction = (options: SelectOption[], search: string) => SelectOption[];
22
+ /**
23
+ * Resolves with the options matching `term`. The signal is aborted when a
24
+ * newer term supersedes this call, so a fetch can be cancelled.
25
+ */
26
+ export type AutocompleteProvider = (
27
+ term: string,
28
+ signal: AbortSignal,
29
+ ) => Promise<AutocompleteOptions>;
30
+
31
+ /** What the list shows when a `provider` has nothing to list. */
32
+ type ProviderState = "idle" | "searching" | "done" | "failed";
19
33
 
20
34
  interface Props {
21
- /** Options passed straight through to BAutocomplete (see its `options` prop). */
35
+ /**
36
+ * Options passed straight through to BAutocomplete (see its `options` prop).
37
+ * With a `provider`, these are a seed: they stay in the list alongside the
38
+ * provider's results, so a value bound before any search has run can be
39
+ * labelled by passing its option here.
40
+ */
22
41
  options?: AutocompleteOptions;
42
+ /**
43
+ * Ask a server for the options as the user types (0.48.0), for a list too
44
+ * big to download and filter in the browser. Called with the trimmed text
45
+ * once typing has paused for `provider-debounce` ms; its result replaces
46
+ * the list. Only the latest call's result is applied: an earlier call that
47
+ * resolves late is dropped, and its signal was aborted when the newer term
48
+ * was typed. bvn's own substring filter is bypassed, since the server has
49
+ * already filtered. An empty term makes no call and clears the results.
50
+ * A rejected promise reads as "Search failed" in the list (an abort does
51
+ * not) and is logged; it never throws out of the component.
52
+ *
53
+ * Named for DXTable's `provider`, a function that supplies rows; `search`
54
+ * is bvn's name for the input's text and stays as it was.
55
+ */
56
+ provider?: AutocompleteProvider;
57
+ /** Milliseconds of quiet typing before `provider` is called. */
58
+ providerDebounce?: number;
23
59
  /**
24
60
  * A custom filter. Composed with `null-option` rather than replaced: when a
25
61
  * null option is present it stays pinned and this runs on the rest.
@@ -35,7 +71,13 @@ interface Props {
35
71
  nullOption?: boolean | string;
36
72
  }
37
73
 
38
- const props = defineProps<Props>();
74
+ const props = withDefaults(defineProps<Props>(), {
75
+ options: undefined,
76
+ filterFunction: undefined,
77
+ nullOption: undefined,
78
+ provider: undefined,
79
+ providerDebounce: 250,
80
+ });
39
81
 
40
82
  defineOptions({
41
83
  inheritAttrs: false,
@@ -48,6 +90,14 @@ const attr = (name: string, hyphenated: string) =>
48
90
 
49
91
  const DEFAULT_NULL_OPTION_LABEL = "None";
50
92
 
93
+ const optionValueAndText = (option: unknown): { value: unknown; text: unknown } => {
94
+ if (option === null || typeof option !== "object") return { value: option, text: option };
95
+ const valueField = (attr("valueField", "value-field") as string | undefined) ?? "value";
96
+ const textField = (attr("textField", "text-field") as string | undefined) ?? "text";
97
+ const record = option as Record<string, unknown>;
98
+ return { value: record[valueField], text: record[textField] };
99
+ };
100
+
51
101
  /*
52
102
  * The null option is a raw option that bvn will normalise through the SAME
53
103
  * `value-field`/`text-field` the consumer configured (default `value`/`text`).
@@ -70,10 +120,30 @@ const consumerOptions = computed<AutocompleteOptions>(() =>
70
120
  Array.isArray(props.options) ? props.options : [],
71
121
  );
72
122
 
123
+ const hasProvider = computed(() => typeof props.provider === "function");
124
+
125
+ /*
126
+ * In provider mode the list is the latest results, then any seed option the
127
+ * results do not already hold (by value), so a seed never duplicates a result
128
+ * and never pushes the results down.
129
+ */
130
+ const providerOptions = ref<AutocompleteOptions>([]);
131
+ const providerState = ref<ProviderState>("idle");
132
+
133
+ const listedOptions = computed<AutocompleteOptions>(() => {
134
+ if (!hasProvider.value) return props.options ?? [];
135
+ const resultValues = providerOptions.value.map((option) => optionValueAndText(option).value);
136
+ const unlistedSeeds = consumerOptions.value.filter((seed) => {
137
+ const seedValue = optionValueAndText(seed).value;
138
+ return !resultValues.some((resultValue) => sameValue(resultValue, seedValue));
139
+ });
140
+ return [...providerOptions.value, ...unlistedSeeds];
141
+ });
142
+
73
143
  const computedOptions = computed<AutocompleteOptions>(() => {
74
144
  const pinned = nullOption.value;
75
- if (!pinned) return props.options ?? [];
76
- return [pinned, ...consumerOptions.value];
145
+ if (!pinned) return listedOptions.value;
146
+ return [pinned, ...listedOptions.value];
77
147
  });
78
148
 
79
149
  const isNullOption = (option: SelectOption) => option?.value === null;
@@ -87,7 +157,10 @@ const isNullOption = (option: SelectOption) => option?.value === null;
87
157
  */
88
158
  const effectiveFilterFunction = computed<FilterFunction | undefined>(() => {
89
159
  const pinned = nullOption.value;
90
- const consumerFilter = props.filterFunction;
160
+ // The provider's results are already the matches for the typed text, so
161
+ // nothing is filtered again here; a seed option is listed whether or not
162
+ // its text contains the term.
163
+ const consumerFilter = hasProvider.value ? (options: SelectOption[]) => options : props.filterFunction;
91
164
  if (!pinned) return consumerFilter;
92
165
 
93
166
  return (options, search) => {
@@ -152,14 +225,6 @@ const boundSearch = computed<string>(() =>
152
225
  consumerOwnsSearch.value ? String(attr("search", "search")) : searchText.value,
153
226
  );
154
227
 
155
- const optionValueAndText = (option: unknown): { value: unknown; text: unknown } => {
156
- if (option === null || typeof option !== "object") return { value: option, text: option };
157
- const valueField = (attr("valueField", "value-field") as string | undefined) ?? "value";
158
- const textField = (attr("textField", "text-field") as string | undefined) ?? "text";
159
- const record = option as Record<string, unknown>;
160
- return { value: record[valueField], text: record[textField] };
161
- };
162
-
163
228
  // The same equality bvn uses to find the selected option (strict, or by key).
164
229
  const sameValue = (optionValue: unknown, modelValue: unknown) => {
165
230
  const by = attr("by", "by");
@@ -196,6 +261,116 @@ const relabelFromOptions = () => {
196
261
  };
197
262
 
198
263
  watch(computedOptions, relabelFromOptions);
264
+
265
+ /*
266
+ * Provider mode (0.48.0). Text the USER types schedules one call after the
267
+ * debounce; a newer term aborts the call in flight and retires its result.
268
+ * The sequence number is what retires it: a call that ignores its signal and
269
+ * resolves late still cannot overwrite a newer result.
270
+ *
271
+ * Only typing is a search. bvn also writes the input's text itself: the
272
+ * selected option's label on selection, on blur and on Escape, and on mount
273
+ * or a model change the label or, with no option to match, the raw value.
274
+ * Those reach `update:search` exactly like typing, so a search keyed on that
275
+ * event asked the server for "79" on mount and for the label after every
276
+ * blur (#242 review). A native `input` event is raised only by the user, so
277
+ * the search is scheduled from that; `update:search` only clears the
278
+ * results when the text is emptied (the ✕, or the user deleting it), and a
279
+ * model change cancels a search still waiting on the debounce, since the
280
+ * user has chosen.
281
+ */
282
+ let providerDebounceTimer: ReturnType<typeof setTimeout> | null = null;
283
+ let providerController: AbortController | null = null;
284
+ let providerSequence = 0;
285
+
286
+ const cancelPendingProviderCall = () => {
287
+ if (providerDebounceTimer !== null) clearTimeout(providerDebounceTimer);
288
+ providerDebounceTimer = null;
289
+ };
290
+
291
+ const retireProviderCall = () => {
292
+ providerSequence += 1;
293
+ providerController?.abort();
294
+ providerController = null;
295
+ };
296
+
297
+ const runProvider = async (term: string) => {
298
+ const provider = props.provider;
299
+ if (!provider) return;
300
+ retireProviderCall();
301
+ const sequence = providerSequence;
302
+ const controller = new AbortController();
303
+ providerController = controller;
304
+ providerState.value = "searching";
305
+ try {
306
+ const result = await provider(term, controller.signal);
307
+ if (sequence !== providerSequence) return;
308
+ providerOptions.value = Array.isArray(result) ? result : [];
309
+ providerState.value = "done";
310
+ } catch (error) {
311
+ if (sequence !== providerSequence || controller.signal.aborted) return;
312
+ providerOptions.value = [];
313
+ providerState.value = "failed";
314
+ console.error("DAutocomplete: the provider rejected", error);
315
+ }
316
+ };
317
+
318
+ const clearProviderResults = () => {
319
+ cancelPendingProviderCall();
320
+ retireProviderCall();
321
+ providerOptions.value = [];
322
+ providerState.value = "idle";
323
+ };
324
+
325
+ const scheduleProvider = (text: string) => {
326
+ cancelPendingProviderCall();
327
+ const term = text.trim();
328
+ if (term === "") {
329
+ clearProviderResults();
330
+ return;
331
+ }
332
+ providerDebounceTimer = setTimeout(() => {
333
+ providerDebounceTimer = null;
334
+ void runProvider(term);
335
+ }, Number(props.providerDebounce));
336
+ };
337
+
338
+ /** The user typed (or cut, pasted, deleted) in the input: a search. */
339
+ const onUserInput = (event: Event) => {
340
+ if (!hasProvider.value) return;
341
+ const target = event.target;
342
+ if (!(target instanceof HTMLInputElement)) return;
343
+ scheduleProvider(target.value);
344
+ };
345
+
346
+ /** bvn's `update:search`: the text as bvn now holds it, however it got there. */
347
+ const onSearchInput = (text: string) => {
348
+ searchText.value = text;
349
+ if (hasProvider.value && text.trim() === "") clearProviderResults();
350
+ };
351
+
352
+ /** The user chose (or the consumer set) a value: a search still waiting is moot. */
353
+ const onModelUpdate = () => {
354
+ if (hasProvider.value) cancelPendingProviderCall();
355
+ };
356
+
357
+ const providerStatusText = computed(() => {
358
+ switch (providerState.value) {
359
+ case "searching":
360
+ return "Searching…";
361
+ case "done":
362
+ return "No matches";
363
+ case "failed":
364
+ return "Search failed";
365
+ default:
366
+ return "Type to search";
367
+ }
368
+ });
369
+
370
+ onBeforeUnmount(() => {
371
+ cancelPendingProviderCall();
372
+ retireProviderCall();
373
+ });
199
374
  </script>
200
375
 
201
376
  <template>
@@ -207,19 +382,31 @@ watch(computedOptions, relabelFromOptions);
207
382
  root, so `[data-v-x] .input-group` matches nothing in a consumer build
208
383
  (#53). A plain element root makes it deterministic.
209
384
  -->
210
- <div ref="rootElement" class="d-autocomplete">
385
+ <div
386
+ ref="rootElement"
387
+ class="d-autocomplete"
388
+ :aria-busy="hasProvider && providerState === 'searching' ? 'true' : undefined"
389
+ @input="onUserInput"
390
+ >
211
391
  <BAutocomplete
212
392
  v-bind="$attrs"
213
393
  :search="boundSearch"
214
394
  :options="computedOptions"
215
395
  :filter-function="effectiveFilterFunction"
216
396
  :no-clear-button="noClearButton"
217
- @update:search="searchText = $event"
397
+ @update:search="onSearchInput"
398
+ @update:model-value="onModelUpdate"
218
399
  >
219
400
  <!-- Dynamically pass through all named slots with their props -->
220
401
  <template v-for="(_, name) in $slots" :key="name" #[name]="slotProps">
221
402
  <slot :name="name" v-bind="slotProps" />
222
403
  </template>
404
+ <!-- What an empty provider list means, unless the consumer says. -->
405
+ <template v-if="hasProvider && !$slots.empty" #empty>
406
+ <div class="d-autocomplete__status text-body-secondary small px-3 py-2">
407
+ {{ providerStatusText }}
408
+ </div>
409
+ </template>
223
410
  </BAutocomplete>
224
411
  </div>
225
412
  </template>
@@ -40,6 +40,7 @@ export { default as DAccordionItem } from "./components/base/DAccordionItem.vue"
40
40
  export { default as DAlert } from "./components/base/DAlert.vue";
41
41
  export { default as DAspect } from "./components/base/DAspect.vue";
42
42
  export { default as DAutocomplete } from "./components/base/DAutocomplete.vue";
43
+ export type { AutocompleteProvider } from "./components/base/DAutocomplete.vue";
43
44
  export { default as DAvatar } from "./components/base/DAvatar.vue";
44
45
  export { default as DBadge } from "./components/base/DBadge.vue";
45
46
  export { default as DBreadcrumb } from "./components/base/DBreadcrumb.vue";