@bagelink/vue 0.0.431 → 0.0.437

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 +1 @@
1
- {"version":3,"file":"BglField.vue.d.ts","sourceRoot":"","sources":["../../../src/components/form/BglField.vue"],"names":[],"mappings":"AAyBA;AAEA,OAAO,EACN,KAAK,KAAK,EAQV,MAAM,eAAe,CAAC;;WA6Id,KAAK;gBACA,OAAO,MAAM,EAAE,GAAG,CAAC;;;;;;WADxB,KAAK;gBACA,OAAO,MAAM,EAAE,GAAG,CAAC;;;;;;gBAAnB,OAAO,MAAM,EAAE,GAAG,CAAC;;AAPjC,wBAUG;AACH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,KAAK,6BAA6B,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CAAE,CAAC;AAC9M,KAAK,kBAAkB,CAAC,CAAC,EAAE,CAAC,IAAI;KAE1B,CAAC,IAAI,MAAM,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG;QACxE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;KACb,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACT,CAAC;AACN,KAAK,cAAc,CAAC,CAA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AM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
@@ -37,7 +37,10 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__
37
37
  }, {
38
38
  modelValue: Record<string, any>;
39
39
  }, {}>, {
40
- submit?(_: {}): any;
40
+ submit?(_: {
41
+ submit: () => void;
42
+ isDirty: import('@vue-macros/reactivity-transform/macros.js').ReactiveVariable<false> | import('@vue-macros/reactivity-transform/macros.js').ReactiveVariable<true>;
43
+ }): any;
41
44
  success?(_: {}): any;
42
45
  error?(_: {}): any;
43
46
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"BglForm.vue.d.ts","sourceRoot":"","sources":["../../../src/components/form/BglForm.vue"],"names":[],"mappings":"AAuBA;AAKA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AA6CpD,KAAK,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2N3D,wBAAwG;AACxG,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,KAAK,6BAA6B,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CAAE,CAAC;AAC9M,KAAK,kBAAkB,CAAC,CAAC,EAAE,CAAC,IAAI;KAE1B,CAAC,IAAI,MAAM,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uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAAE,QAAO;QAClD,MAAM,EAAE,CAAC,CAAC;KACT,CAAA;CAAE,CAAC"}
package/dist/index.cjs CHANGED
@@ -4584,10 +4584,7 @@ class DataRequest {
4584
4584
  async post(item) {
4585
4585
  if (!this.data_table)
4586
4586
  throw new Error("Data table not set");
4587
- const { data: data2 } = await axios.post(
4588
- `/data/${this.data_table}`,
4589
- item
4590
- );
4587
+ const { data: data2 } = await axios.post(`/data/${this.data_table}`, item);
4591
4588
  return data2;
4592
4589
  }
4593
4590
  filter(filter3) {
@@ -4649,7 +4646,9 @@ class BagelAuth {
4649
4646
  }
4650
4647
  async validateUser() {
4651
4648
  try {
4652
- const { data: usr } = await axios.get("/users/me", { withCredentials: true });
4649
+ const { data: usr } = await axios.get("/users/me", {
4650
+ withCredentials: true
4651
+ });
4653
4652
  this.user = usr;
4654
4653
  return usr;
4655
4654
  } catch (err) {
@@ -4721,8 +4720,11 @@ class Bagel {
4721
4720
  __publicField(this, "read_table", null);
4722
4721
  __publicField(this, "auth", new BagelAuth(this));
4723
4722
  this.host = host == null ? void 0 : host.replace(/\/$/, "");
4724
- if (!this.host)
4725
- throw new Error("you probably need to set VITE_BAGEL_BASE_URL in the .env file");
4723
+ if (!this.host) {
4724
+ throw new Error(
4725
+ "you probably need to set VITE_BAGEL_BASE_URL in the .env file"
4726
+ );
4727
+ }
4726
4728
  axios.defaults.baseURL = this.host;
4727
4729
  this.onError = onError;
4728
4730
  }
@@ -4741,6 +4743,7 @@ class Bagel {
4741
4743
  return axios.get(`/api/${endpoint}`).then(({ data: data2 }) => data2);
4742
4744
  }
4743
4745
  async get(endpoint, query) {
4746
+ this._setAuthorization();
4744
4747
  endpoint = this._endpointCleaner(endpoint);
4745
4748
  if (endpoint.match(/undefined|null/))
4746
4749
  throw new Error("Invalid endpoint");
@@ -4757,6 +4760,7 @@ class Bagel {
4757
4760
  });
4758
4761
  }
4759
4762
  async delete(endpoint) {
4763
+ this._setAuthorization();
4760
4764
  endpoint = this._endpointCleaner(endpoint);
4761
4765
  return axios.delete(`/${endpoint}`).then(({ data: data2 }) => data2).catch((err) => {
4762
4766
  var _a2;
@@ -4766,6 +4770,7 @@ class Bagel {
4766
4770
  }
4767
4771
  async put(endpoint, payload) {
4768
4772
  endpoint = this._endpointCleaner(endpoint);
4773
+ this._setAuthorization();
4769
4774
  return axios.put(`/${endpoint}`, payload).then(({ data: data2 }) => data2).catch((err) => {
4770
4775
  var _a2;
4771
4776
  (_a2 = this.onError) == null ? void 0 : _a2.call(this, err);
@@ -4780,7 +4785,14 @@ class Bagel {
4780
4785
  throw err;
4781
4786
  });
4782
4787
  }
4788
+ _setAuthorization() {
4789
+ const Authorization = localStorage.getItem("access_token");
4790
+ if (Authorization) {
4791
+ axios.defaults.headers.common.Authorization = `Bearer ${Authorization}`;
4792
+ }
4793
+ }
4783
4794
  async post(endpoint, payload = {}) {
4795
+ this._setAuthorization();
4784
4796
  endpoint = this._endpointCleaner(endpoint);
4785
4797
  return axios.post(`/${endpoint}`, payload).then(({ data: data2 }) => data2).catch((err) => {
4786
4798
  var _a2;
@@ -4789,6 +4801,7 @@ class Bagel {
4789
4801
  });
4790
4802
  }
4791
4803
  async uploadFile(file, options) {
4804
+ this._setAuthorization();
4792
4805
  const formData = new FormData();
4793
4806
  formData.append("file", file);
4794
4807
  const { data: data2 } = await axios.post("/static_files/upload", formData, {
@@ -4852,7 +4865,11 @@ function txtField(id, label, options) {
4852
4865
  id,
4853
4866
  label,
4854
4867
  placeholder: options == null ? void 0 : options.placeholder,
4855
- attrs: { type: options == null ? void 0 : options.type, pattern: options == null ? void 0 : options.pattern, multiline: options == null ? void 0 : options.multiline }
4868
+ attrs: {
4869
+ type: options == null ? void 0 : options.type,
4870
+ pattern: options == null ? void 0 : options.pattern,
4871
+ multiline: options == null ? void 0 : options.multiline
4872
+ }
4856
4873
  };
4857
4874
  }
4858
4875
  function slctField(id, label, options, config) {
@@ -4865,7 +4882,11 @@ function slctField(id, label, options, config) {
4865
4882
  required: config == null ? void 0 : config.required,
4866
4883
  label,
4867
4884
  defaultValue: config == null ? void 0 : config.defaultValue,
4868
- attrs: { disabled: config == null ? void 0 : config.disabled, searchable: config == null ? void 0 : config.searchable, multiselect: config == null ? void 0 : config.multiselect }
4885
+ attrs: {
4886
+ disabled: config == null ? void 0 : config.disabled,
4887
+ searchable: config == null ? void 0 : config.searchable,
4888
+ multiselect: config == null ? void 0 : config.multiselect
4889
+ }
4869
4890
  };
4870
4891
  }
4871
4892
  function checkField(id, label, options) {
@@ -4891,7 +4912,7 @@ function numField(id, label, options) {
4891
4912
  function frmRow(...children2) {
4892
4913
  return {
4893
4914
  $el: "div",
4894
- class: "flex gap-1 m_block mt-1",
4915
+ class: "flex gap-1 m_block",
4895
4916
  children: children2
4896
4917
  };
4897
4918
  }
@@ -6397,7 +6418,7 @@ const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
6397
6418
  formData.value = val;
6398
6419
  emit2("update:modelValue", val);
6399
6420
  },
6400
- get: () => props2.modelValue || formData.value
6421
+ get: () => formData.value
6401
6422
  });
6402
6423
  const form = vue.ref();
6403
6424
  const validateForm = () => {
@@ -6419,7 +6440,8 @@ const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
6419
6440
  const isValid2 = validateForm();
6420
6441
  if (!isValid2)
6421
6442
  return;
6422
- emit2("submit", data2.value);
6443
+ emit2("submit", { ...formData.value });
6444
+ isDirty.value = false;
6423
6445
  };
6424
6446
  const i18nT = (val) => val;
6425
6447
  const deleteItem = () => {
@@ -6476,7 +6498,10 @@ const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
6476
6498
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => vue.isRef(data2) ? data2.value = $event : data2 = $event)
6477
6499
  }, null, 8, ["field", "modelValue"]);
6478
6500
  }), 128)),
6479
- vue.renderSlot(_ctx.$slots, "submit")
6501
+ vue.renderSlot(_ctx.$slots, "submit", {
6502
+ submit: runSubmit,
6503
+ isDirty: vue.unref(isDirty)
6504
+ })
6480
6505
  ], 544)) : vue.createCommentVNode("", true),
6481
6506
  _ctx.status === "success" ? vue.renderSlot(_ctx.$slots, "success", { key: 2 }) : vue.createCommentVNode("", true),
6482
6507
  _ctx.status === "error" ? vue.renderSlot(_ctx.$slots, "error", { key: 3 }) : vue.createCommentVNode("", true)
@@ -15399,7 +15424,7 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
15399
15424
  };
15400
15425
  const getValue = (option2) => {
15401
15426
  if (!option2)
15402
- return "";
15427
+ return void 0;
15403
15428
  if (typeof option2 === "string")
15404
15429
  return option2;
15405
15430
  if (typeof option2 === "number")
@@ -15407,12 +15432,10 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
15407
15432
  return option2.value;
15408
15433
  };
15409
15434
  const isSelected = (option2) => !!selectedItems.value.find((item) => getValue(option2) === getValue(item));
15410
- const filteredOptions = vue.computed(
15411
- () => props2.options.filter((option2) => {
15412
- const searchTerm = search.value.split(/\s+/).filter(Boolean).map((t) => new RegExp(t, "gi"));
15413
- return Boolean(option2) && (searchTerm.every((s2) => getLabel(option2).match(s2)) || searchTerm.length === 0);
15414
- })
15415
- );
15435
+ const filteredOptions = vue.computed(() => props2.options.filter((option2) => {
15436
+ const searchTerm = search.value.split(/\s+/).filter(Boolean).map((t) => new RegExp(t, "gi"));
15437
+ return Boolean(option2) && (searchTerm.every((s2) => getLabel(option2).match(s2)) || searchTerm.length === 0);
15438
+ }));
15416
15439
  const select2 = (option2) => {
15417
15440
  var _a2;
15418
15441
  const existingIndex = selectedItems.value.findIndex(
@@ -15434,9 +15457,8 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
15434
15457
  if (props2.multiselect) {
15435
15458
  emit2("update:modelValue", selectedItems.value.map(getValue).filter(Boolean));
15436
15459
  } else {
15437
- selectedItems.value.splice(1, selectedItems.value.length - 1);
15438
15460
  const [item] = selectedItems.value;
15439
- emit2("update:modelValue", item ? getValue(item) : null);
15461
+ emit2("update:modelValue", getValue(item));
15440
15462
  }
15441
15463
  }
15442
15464
  function compareArrays(arr1, arr2) {
@@ -15553,7 +15575,7 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
15553
15575
  };
15554
15576
  }
15555
15577
  });
15556
- const SelectInput = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-9b751fe0"]]);
15578
+ const SelectInput = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-39ae2ac8"]]);
15557
15579
  /*!
15558
15580
  * vue-draggable-next v2.2.0
15559
15581
  * (c) 2023 Anish George
@@ -18572,7 +18594,7 @@ const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
18572
18594
  return option2.value;
18573
18595
  };
18574
18596
  const props2 = __props;
18575
- let selectedValue = vue.ref("");
18597
+ let selectedValue = vue.ref(props2.modelValue);
18576
18598
  function handleSelect(e) {
18577
18599
  var _a2;
18578
18600
  const newVal = (_a2 = e.target) == null ? void 0 : _a2.value;
@@ -18606,7 +18628,7 @@ const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
18606
18628
  id: `${_ctx.id}-${getValue(option2)}`,
18607
18629
  name: _ctx.id,
18608
18630
  value: getValue(option2),
18609
- checked: vue.unref(selectedValue) === getValue(option2),
18631
+ checked: vue.unref(selectedValue) == getValue(option2),
18610
18632
  onChange: handleSelect
18611
18633
  }, null, 40, _hoisted_4$6),
18612
18634
  vue.createElementVNode("label", {
@@ -18619,7 +18641,7 @@ const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
18619
18641
  };
18620
18642
  }
18621
18643
  });
18622
- const RadioPillsInput = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-ad2e40f3"]]);
18644
+ const RadioPillsInput = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-880c5069"]]);
18623
18645
  const _hoisted_1$f = { class: "bagel-input" };
18624
18646
  const _hoisted_2$c = {
18625
18647
  key: 0,
package/dist/index.mjs CHANGED
@@ -4582,10 +4582,7 @@ class DataRequest {
4582
4582
  async post(item) {
4583
4583
  if (!this.data_table)
4584
4584
  throw new Error("Data table not set");
4585
- const { data: data2 } = await axios.post(
4586
- `/data/${this.data_table}`,
4587
- item
4588
- );
4585
+ const { data: data2 } = await axios.post(`/data/${this.data_table}`, item);
4589
4586
  return data2;
4590
4587
  }
4591
4588
  filter(filter3) {
@@ -4647,7 +4644,9 @@ class BagelAuth {
4647
4644
  }
4648
4645
  async validateUser() {
4649
4646
  try {
4650
- const { data: usr } = await axios.get("/users/me", { withCredentials: true });
4647
+ const { data: usr } = await axios.get("/users/me", {
4648
+ withCredentials: true
4649
+ });
4651
4650
  this.user = usr;
4652
4651
  return usr;
4653
4652
  } catch (err) {
@@ -4719,8 +4718,11 @@ class Bagel {
4719
4718
  __publicField(this, "read_table", null);
4720
4719
  __publicField(this, "auth", new BagelAuth(this));
4721
4720
  this.host = host == null ? void 0 : host.replace(/\/$/, "");
4722
- if (!this.host)
4723
- throw new Error("you probably need to set VITE_BAGEL_BASE_URL in the .env file");
4721
+ if (!this.host) {
4722
+ throw new Error(
4723
+ "you probably need to set VITE_BAGEL_BASE_URL in the .env file"
4724
+ );
4725
+ }
4724
4726
  axios.defaults.baseURL = this.host;
4725
4727
  this.onError = onError;
4726
4728
  }
@@ -4739,6 +4741,7 @@ class Bagel {
4739
4741
  return axios.get(`/api/${endpoint}`).then(({ data: data2 }) => data2);
4740
4742
  }
4741
4743
  async get(endpoint, query) {
4744
+ this._setAuthorization();
4742
4745
  endpoint = this._endpointCleaner(endpoint);
4743
4746
  if (endpoint.match(/undefined|null/))
4744
4747
  throw new Error("Invalid endpoint");
@@ -4755,6 +4758,7 @@ class Bagel {
4755
4758
  });
4756
4759
  }
4757
4760
  async delete(endpoint) {
4761
+ this._setAuthorization();
4758
4762
  endpoint = this._endpointCleaner(endpoint);
4759
4763
  return axios.delete(`/${endpoint}`).then(({ data: data2 }) => data2).catch((err) => {
4760
4764
  var _a2;
@@ -4764,6 +4768,7 @@ class Bagel {
4764
4768
  }
4765
4769
  async put(endpoint, payload) {
4766
4770
  endpoint = this._endpointCleaner(endpoint);
4771
+ this._setAuthorization();
4767
4772
  return axios.put(`/${endpoint}`, payload).then(({ data: data2 }) => data2).catch((err) => {
4768
4773
  var _a2;
4769
4774
  (_a2 = this.onError) == null ? void 0 : _a2.call(this, err);
@@ -4778,7 +4783,14 @@ class Bagel {
4778
4783
  throw err;
4779
4784
  });
4780
4785
  }
4786
+ _setAuthorization() {
4787
+ const Authorization = localStorage.getItem("access_token");
4788
+ if (Authorization) {
4789
+ axios.defaults.headers.common.Authorization = `Bearer ${Authorization}`;
4790
+ }
4791
+ }
4781
4792
  async post(endpoint, payload = {}) {
4793
+ this._setAuthorization();
4782
4794
  endpoint = this._endpointCleaner(endpoint);
4783
4795
  return axios.post(`/${endpoint}`, payload).then(({ data: data2 }) => data2).catch((err) => {
4784
4796
  var _a2;
@@ -4787,6 +4799,7 @@ class Bagel {
4787
4799
  });
4788
4800
  }
4789
4801
  async uploadFile(file, options) {
4802
+ this._setAuthorization();
4790
4803
  const formData = new FormData();
4791
4804
  formData.append("file", file);
4792
4805
  const { data: data2 } = await axios.post("/static_files/upload", formData, {
@@ -4850,7 +4863,11 @@ function txtField(id, label, options) {
4850
4863
  id,
4851
4864
  label,
4852
4865
  placeholder: options == null ? void 0 : options.placeholder,
4853
- attrs: { type: options == null ? void 0 : options.type, pattern: options == null ? void 0 : options.pattern, multiline: options == null ? void 0 : options.multiline }
4866
+ attrs: {
4867
+ type: options == null ? void 0 : options.type,
4868
+ pattern: options == null ? void 0 : options.pattern,
4869
+ multiline: options == null ? void 0 : options.multiline
4870
+ }
4854
4871
  };
4855
4872
  }
4856
4873
  function slctField(id, label, options, config) {
@@ -4863,7 +4880,11 @@ function slctField(id, label, options, config) {
4863
4880
  required: config == null ? void 0 : config.required,
4864
4881
  label,
4865
4882
  defaultValue: config == null ? void 0 : config.defaultValue,
4866
- attrs: { disabled: config == null ? void 0 : config.disabled, searchable: config == null ? void 0 : config.searchable, multiselect: config == null ? void 0 : config.multiselect }
4883
+ attrs: {
4884
+ disabled: config == null ? void 0 : config.disabled,
4885
+ searchable: config == null ? void 0 : config.searchable,
4886
+ multiselect: config == null ? void 0 : config.multiselect
4887
+ }
4867
4888
  };
4868
4889
  }
4869
4890
  function checkField(id, label, options) {
@@ -4889,7 +4910,7 @@ function numField(id, label, options) {
4889
4910
  function frmRow(...children2) {
4890
4911
  return {
4891
4912
  $el: "div",
4892
- class: "flex gap-1 m_block mt-1",
4913
+ class: "flex gap-1 m_block",
4893
4914
  children: children2
4894
4915
  };
4895
4916
  }
@@ -6395,7 +6416,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
6395
6416
  formData.value = val;
6396
6417
  emit2("update:modelValue", val);
6397
6418
  },
6398
- get: () => props2.modelValue || formData.value
6419
+ get: () => formData.value
6399
6420
  });
6400
6421
  const form = ref();
6401
6422
  const validateForm = () => {
@@ -6417,7 +6438,8 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
6417
6438
  const isValid2 = validateForm();
6418
6439
  if (!isValid2)
6419
6440
  return;
6420
- emit2("submit", data2.value);
6441
+ emit2("submit", { ...formData.value });
6442
+ isDirty.value = false;
6421
6443
  };
6422
6444
  const i18nT = (val) => val;
6423
6445
  const deleteItem = () => {
@@ -6474,7 +6496,10 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
6474
6496
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(data2) ? data2.value = $event : data2 = $event)
6475
6497
  }, null, 8, ["field", "modelValue"]);
6476
6498
  }), 128)),
6477
- renderSlot(_ctx.$slots, "submit")
6499
+ renderSlot(_ctx.$slots, "submit", {
6500
+ submit: runSubmit,
6501
+ isDirty: unref(isDirty)
6502
+ })
6478
6503
  ], 544)) : createCommentVNode("", true),
6479
6504
  _ctx.status === "success" ? renderSlot(_ctx.$slots, "success", { key: 2 }) : createCommentVNode("", true),
6480
6505
  _ctx.status === "error" ? renderSlot(_ctx.$slots, "error", { key: 3 }) : createCommentVNode("", true)
@@ -15397,7 +15422,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
15397
15422
  };
15398
15423
  const getValue = (option2) => {
15399
15424
  if (!option2)
15400
- return "";
15425
+ return void 0;
15401
15426
  if (typeof option2 === "string")
15402
15427
  return option2;
15403
15428
  if (typeof option2 === "number")
@@ -15405,12 +15430,10 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
15405
15430
  return option2.value;
15406
15431
  };
15407
15432
  const isSelected = (option2) => !!selectedItems.value.find((item) => getValue(option2) === getValue(item));
15408
- const filteredOptions = computed(
15409
- () => props2.options.filter((option2) => {
15410
- const searchTerm = search.value.split(/\s+/).filter(Boolean).map((t) => new RegExp(t, "gi"));
15411
- return Boolean(option2) && (searchTerm.every((s2) => getLabel(option2).match(s2)) || searchTerm.length === 0);
15412
- })
15413
- );
15433
+ const filteredOptions = computed(() => props2.options.filter((option2) => {
15434
+ const searchTerm = search.value.split(/\s+/).filter(Boolean).map((t) => new RegExp(t, "gi"));
15435
+ return Boolean(option2) && (searchTerm.every((s2) => getLabel(option2).match(s2)) || searchTerm.length === 0);
15436
+ }));
15414
15437
  const select2 = (option2) => {
15415
15438
  var _a2;
15416
15439
  const existingIndex = selectedItems.value.findIndex(
@@ -15432,9 +15455,8 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
15432
15455
  if (props2.multiselect) {
15433
15456
  emit2("update:modelValue", selectedItems.value.map(getValue).filter(Boolean));
15434
15457
  } else {
15435
- selectedItems.value.splice(1, selectedItems.value.length - 1);
15436
15458
  const [item] = selectedItems.value;
15437
- emit2("update:modelValue", item ? getValue(item) : null);
15459
+ emit2("update:modelValue", getValue(item));
15438
15460
  }
15439
15461
  }
15440
15462
  function compareArrays(arr1, arr2) {
@@ -15551,7 +15573,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
15551
15573
  };
15552
15574
  }
15553
15575
  });
15554
- const SelectInput = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-9b751fe0"]]);
15576
+ const SelectInput = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-39ae2ac8"]]);
15555
15577
  /*!
15556
15578
  * vue-draggable-next v2.2.0
15557
15579
  * (c) 2023 Anish George
@@ -18570,7 +18592,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
18570
18592
  return option2.value;
18571
18593
  };
18572
18594
  const props2 = __props;
18573
- let selectedValue = ref("");
18595
+ let selectedValue = ref(props2.modelValue);
18574
18596
  function handleSelect(e) {
18575
18597
  var _a2;
18576
18598
  const newVal = (_a2 = e.target) == null ? void 0 : _a2.value;
@@ -18604,7 +18626,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
18604
18626
  id: `${_ctx.id}-${getValue(option2)}`,
18605
18627
  name: _ctx.id,
18606
18628
  value: getValue(option2),
18607
- checked: unref(selectedValue) === getValue(option2),
18629
+ checked: unref(selectedValue) == getValue(option2),
18608
18630
  onChange: handleSelect
18609
18631
  }, null, 40, _hoisted_4$6),
18610
18632
  createElementVNode("label", {
@@ -18617,7 +18639,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
18617
18639
  };
18618
18640
  }
18619
18641
  });
18620
- const RadioPillsInput = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-ad2e40f3"]]);
18642
+ const RadioPillsInput = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-880c5069"]]);
18621
18643
  const _hoisted_1$f = { class: "bagel-input" };
18622
18644
  const _hoisted_2$c = {
18623
18645
  key: 0,