inertia-bootstrap-forms 1.0.91 → 1.0.92

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.
@@ -5,7 +5,7 @@ var et = (i) => {
5
5
  var ct = (i, e, t) => e in i ? pt(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
6
6
  var y = (i, e, t) => ct(i, typeof e != "symbol" ? e + "" : e, t), G = (i, e, t) => e.has(i) || et("Cannot " + t);
7
7
  var r = (i, e, t) => (G(i, e, "read from private field"), t ? t.call(i) : e.get(i)), m = (i, e, t) => e.has(i) ? et("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, t), c = (i, e, t, s) => (G(i, e, "write to private field"), s ? s.call(i, t) : e.set(i, t), t), g = (i, e, t) => (G(i, e, "access private method"), t);
8
- import { T as mt } from "./index-k3x7dkKf.js";
8
+ import { T as mt } from "./index-kihjHjls.js";
9
9
  class K extends Error {
10
10
  constructor(t, s = null) {
11
11
  super("This looks like a network error, the endpoint might be blocked by an internet provider or a firewall.");
@@ -6490,7 +6490,7 @@ var Og = function(t) {
6490
6490
  }()
6491
6491
  );
6492
6492
  const $g = te({
6493
- emits: ["update:modelValue", "search", "change", "selected"],
6493
+ emits: ["update:modelValue", "search", "searching", "change", "selected"],
6494
6494
  props: {
6495
6495
  name: {
6496
6496
  type: String,
@@ -6595,9 +6595,11 @@ const $g = te({
6595
6595
  this.$refs.input.removeEventListener("search", this.searchHandle), this.choices.destroy();
6596
6596
  },
6597
6597
  searchHandle(t) {
6598
- this.doSearch(t.detail.value);
6598
+ this.$emit("search", t), clearTimeout(this.searchDebounceTimer), this.showLoading(), this.searchDebounceTimer = setTimeout(() => {
6599
+ this.doSearch(t.detail.value);
6600
+ }, 400);
6599
6601
  },
6600
- async setLoading() {
6602
+ async showLoading() {
6601
6603
  this.loading = !0, await this.choices.setChoices(
6602
6604
  [{ value: "", label: this.localeTranslates[this.currentLocale].searchingPlaceholder || "Searching...", disabled: !0 }],
6603
6605
  "value",
@@ -6608,8 +6610,8 @@ const $g = te({
6608
6610
  },
6609
6611
  async doSearch(t) {
6610
6612
  var e;
6611
- if ((e = this.search) != null && e.url) {
6612
- await this.setLoading(), this.searchController && this.searchController.abort(), this.searchController = new AbortController();
6613
+ if (this.$emit("searching", t), !!((e = this.search) != null && e.url)) {
6614
+ this.searchController && this.searchController.abort(), this.searchController = new AbortController();
6613
6615
  try {
6614
6616
  const n = await (await fetch(this.search.url + "?query=" + encodeURIComponent(t), {
6615
6617
  method: "POST",
@@ -6617,15 +6619,15 @@ const $g = te({
6617
6619
  })).json();
6618
6620
  await this.choices.setChoices(
6619
6621
  n.map((r) => ({
6620
- value: r.id,
6621
- label: r.name || r.label || r.value
6622
+ value: (this.key ? r[this.key] : (r == null ? void 0 : r.name) ?? (r == null ? void 0 : r.label) ?? (r == null ? void 0 : r.value)) ?? r,
6623
+ label: (this.label ? r[this.label] : (r == null ? void 0 : r.name) ?? (r == null ? void 0 : r.label) ?? (r == null ? void 0 : r.value)) ?? r
6622
6624
  })),
6623
6625
  "value",
6624
6626
  "label",
6625
6627
  !0
6626
6628
  ), this.loading = !1;
6627
6629
  } catch (i) {
6628
- this.loading = !1, i.name !== "AbortError" && (console.error(i), await this.choices.setChoices([], "value", "label", !0));
6630
+ i.name !== "AbortError" && (this.loading = !1, console.error(i), await this.choices.setChoices([], "value", "label", !0));
6629
6631
  }
6630
6632
  }
6631
6633
  }
@@ -6640,6 +6642,7 @@ const $g = te({
6640
6642
  return {
6641
6643
  choices: null,
6642
6644
  loading: !1,
6645
+ searchDebounceTimer: null,
6643
6646
  searchController: null,
6644
6647
  currentLocale: this.locale,
6645
6648
  localeTranslates: {
@@ -13157,7 +13160,7 @@ const Wv = {
13157
13160
  b === !0 && y === !1 && g();
13158
13161
  }), on(() => {
13159
13162
  var b, y, w, O, T, M, V, F;
13160
- i.useXHR && import("./index-CoG5BgVi.js").then((z) => {
13163
+ i.useXHR && import("./index-FBOpgX9_.js").then((z) => {
13161
13164
  const X = z.default;
13162
13165
  s.value.use(X, {
13163
13166
  method: "POST",
@@ -1,4 +1,4 @@
1
- import { A as n, C as s, a as p, b as u, c as e, _ as o, d as I, E as i, F as r, f as l, l as c, G as m, L as b, M as C, h as x, g as S, P as d, Q as g, R as h, k, S as F, j as P, i as T, m as y, n as A, o as E, e as L } from "./index-k3x7dkKf.js";
1
+ import { A as n, C as s, a as p, b as u, c as e, _ as o, d as I, E as i, F as r, f as l, l as c, G as m, L as b, M as C, h as x, g as S, P as d, Q as g, R as h, k, S as F, j as P, i as T, m as y, n as A, o as E, e as L } from "./index-kihjHjls.js";
2
2
  export {
3
3
  n as AmountInput,
4
4
  s as CaptchaInput,