@bagelink/vue 0.0.427 → 0.0.435

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 (45) hide show
  1. package/dist/components/Alert.vue.d.ts +4 -1
  2. package/dist/components/Alert.vue.d.ts.map +1 -1
  3. package/dist/components/TableSchema.vue.d.ts +2 -5
  4. package/dist/components/TableSchema.vue.d.ts.map +1 -1
  5. package/dist/components/form/BglField.vue.d.ts.map +1 -1
  6. package/dist/components/form/BglForm.vue.d.ts +4 -1
  7. package/dist/components/form/BglForm.vue.d.ts.map +1 -1
  8. package/dist/components/form/inputs/DatePicker.vue.d.ts +4 -0
  9. package/dist/components/form/inputs/DatePicker.vue.d.ts.map +1 -1
  10. package/dist/components/form/inputs/FileUpload.vue.d.ts +6 -2
  11. package/dist/components/form/inputs/FileUpload.vue.d.ts.map +1 -1
  12. package/dist/components/form/inputs/RadioPillsInput.vue.d.ts.map +1 -1
  13. package/dist/components/form/inputs/SelectInput.vue.d.ts.map +1 -1
  14. package/dist/components/form/inputs/TextInput.vue.d.ts +0 -3
  15. package/dist/components/form/inputs/TextInput.vue.d.ts.map +1 -1
  16. package/dist/components/layout/Tabs.vue.d.ts +6 -2
  17. package/dist/components/layout/Tabs.vue.d.ts.map +1 -1
  18. package/dist/components/layout/TabsNav.vue.d.ts.map +1 -1
  19. package/dist/index.cjs +239 -137
  20. package/dist/index.mjs +240 -138
  21. package/dist/plugins/bagel.d.ts +3 -0
  22. package/dist/plugins/bagel.d.ts.map +1 -1
  23. package/dist/style.css +109 -91
  24. package/dist/utils/BagelFormUtils.d.ts +1 -0
  25. package/dist/utils/BagelFormUtils.d.ts.map +1 -1
  26. package/dist/utils/index.d.ts +1 -0
  27. package/dist/utils/index.d.ts.map +1 -1
  28. package/dist/utils/lang.d.ts +7 -0
  29. package/dist/utils/lang.d.ts.map +1 -0
  30. package/package.json +1 -1
  31. package/src/components/Alert.vue +4 -2
  32. package/src/components/TableSchema.vue +19 -9
  33. package/src/components/form/BglField.vue +5 -3
  34. package/src/components/form/BglForm.vue +13 -9
  35. package/src/components/form/inputs/DatePicker.vue +8 -2
  36. package/src/components/form/inputs/FileUpload.vue +54 -23
  37. package/src/components/form/inputs/RadioPillsInput.vue +9 -9
  38. package/src/components/form/inputs/SelectInput.vue +36 -31
  39. package/src/components/form/inputs/TextInput.vue +1 -1
  40. package/src/components/layout/Tabs.vue +14 -5
  41. package/src/components/layout/TabsNav.vue +34 -14
  42. package/src/plugins/bagel.ts +13 -4
  43. package/src/utils/BagelFormUtils.ts +44 -10
  44. package/src/utils/index.ts +2 -0
  45. package/src/utils/lang.ts +39 -0
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, {
@@ -4813,94 +4826,6 @@ const clickOutside = {
4813
4826
  document.removeEventListener("click", el.clickOutsideEvent);
4814
4827
  }
4815
4828
  };
4816
- const bagelInjectionKey = Symbol("bagel");
4817
- const i18nTInjectionKey = Symbol("bagel");
4818
- function useBagel() {
4819
- const bagel = vue.inject(bagelInjectionKey);
4820
- if (!bagel)
4821
- throw new Error("No bagel provided");
4822
- return bagel;
4823
- }
4824
- function useI18nT() {
4825
- const i18nT = vue.inject(i18nTInjectionKey);
4826
- if (!i18nT)
4827
- throw new Error("No i18nT provided");
4828
- return i18nT;
4829
- }
4830
- const BagelVue = {
4831
- install: (app, options) => {
4832
- const bagel = new Bagel({ host: options.host, onError: options.onError });
4833
- app.directive("click-outside", clickOutside);
4834
- app.use(Gt$1, {
4835
- themes: {
4836
- "bgl-theme": {
4837
- triggers: ["click"],
4838
- autoHide: true,
4839
- placement: "bottom"
4840
- }
4841
- }
4842
- });
4843
- app.config.globalProperties.$bagel = bagel;
4844
- app.provide(bagelInjectionKey, bagel);
4845
- app.config.globalProperties.$i18T = (options == null ? void 0 : options.i18nT) || ((key) => key);
4846
- app.provide(i18nTInjectionKey, (options == null ? void 0 : options.i18nT) || ((key) => key));
4847
- }
4848
- };
4849
- const ModalSymbol = Symbol("modal");
4850
- const useModal = () => {
4851
- const modalApi = vue.inject(ModalSymbol);
4852
- if (!modalApi)
4853
- throw new Error("Modal API not provided");
4854
- return modalApi;
4855
- };
4856
- const ModalPlugin = {
4857
- install: (app) => {
4858
- const modalStack = vue.ref([]);
4859
- const hideModal = (index2) => {
4860
- modalStack.value.splice(index2, 1);
4861
- };
4862
- const modalConfirm = (options) => new Promise((resolve) => {
4863
- if (typeof options === "string")
4864
- options = { title: options, message: "" };
4865
- modalStack.value.push({
4866
- modalOptions: { ...options, resolve },
4867
- modalType: "confirm",
4868
- componentSlots: {}
4869
- });
4870
- });
4871
- const showModal = (modalType, options, slots = {}) => {
4872
- modalStack.value.push({
4873
- modalOptions: options,
4874
- modalType,
4875
- componentSlots: slots
4876
- });
4877
- if (modalType === "modalForm")
4878
- return modalStack.value.at(-1);
4879
- return modalStack.value.at(-1);
4880
- };
4881
- app.provide(ModalSymbol, {
4882
- showModal: (options, slots) => showModal("modal", options, slots),
4883
- showModalForm: (options, slots) => showModal("modalForm", options, slots),
4884
- confirm: (userOptions) => modalConfirm(userOptions),
4885
- hideModal: (index2 = modalStack.value.length - 1) => hideModal(index2)
4886
- // modalOptions,
4887
- });
4888
- const ModalComponent = vue.defineComponent({
4889
- data: () => ({ modalStack: modalStack.value }),
4890
- render() {
4891
- return modalStack.value.map((modal, index2) => {
4892
- const props2 = { ...modal.modalOptions, visible: true, "onUpdate:visible": () => hideModal(index2) };
4893
- if (modal.modalType === "modalForm")
4894
- return vue.h(ModalForm, props2, modal.componentSlots);
4895
- if (modal.modalType === "confirm")
4896
- return vue.h(_sfc_main$n, props2, {});
4897
- return vue.h(_sfc_main$F, props2, modal.componentSlots);
4898
- });
4899
- }
4900
- });
4901
- app.component("ModalContainer", ModalComponent);
4902
- }
4903
- };
4904
4829
  function formatString(str, format2) {
4905
4830
  if (format2 === "titleCase") {
4906
4831
  return str.split("_").map((word) => word[0].toUpperCase() + word.slice(1).toLocaleLowerCase()).join(" ");
@@ -4940,7 +4865,11 @@ function txtField(id, label, options) {
4940
4865
  id,
4941
4866
  label,
4942
4867
  placeholder: options == null ? void 0 : options.placeholder,
4943
- 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
+ }
4944
4873
  };
4945
4874
  }
4946
4875
  function slctField(id, label, options, config) {
@@ -4953,7 +4882,11 @@ function slctField(id, label, options, config) {
4953
4882
  required: config == null ? void 0 : config.required,
4954
4883
  label,
4955
4884
  defaultValue: config == null ? void 0 : config.defaultValue,
4956
- 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
+ }
4957
4890
  };
4958
4891
  }
4959
4892
  function checkField(id, label, options) {
@@ -4979,7 +4912,7 @@ function numField(id, label, options) {
4979
4912
  function frmRow(...children2) {
4980
4913
  return {
4981
4914
  $el: "div",
4982
- class: "flex gap-1 m_block mt-1",
4915
+ class: "flex gap-1 m_block",
4983
4916
  children: children2
4984
4917
  };
4985
4918
  }
@@ -4992,6 +4925,32 @@ const bagelFormUtils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defi
4992
4925
  slctField,
4993
4926
  txtField
4994
4927
  }, Symbol.toStringTag, { value: "Module" }));
4928
+ const state$1 = vue.reactive({
4929
+ defaultLang: "",
4930
+ availableLangs: [],
4931
+ lang: "en"
4932
+ });
4933
+ function useLang() {
4934
+ const lang = vue.computed({
4935
+ get: () => state$1.lang,
4936
+ set: (val) => state$1.lang = val
4937
+ });
4938
+ const $tdb = (langEl) => langEl[state$1.lang] || langEl[state$1.defaultLang] || "";
4939
+ const availableLangs = vue.computed({
4940
+ get: () => state$1.availableLangs,
4941
+ set: (val) => state$1.availableLangs = val
4942
+ });
4943
+ const defaultLang = vue.computed({
4944
+ get: () => state$1.defaultLang,
4945
+ set: (val) => state$1.defaultLang = val
4946
+ });
4947
+ return {
4948
+ lang,
4949
+ $tdb,
4950
+ availableLangs,
4951
+ defaultLang
4952
+ };
4953
+ }
4995
4954
  let timeout;
4996
4955
  const debounce$2 = (fn2, delay = 500) => {
4997
4956
  clearTimeout(timeout);
@@ -5043,6 +5002,101 @@ const iffer = (field, itemData) => {
5043
5002
  return true;
5044
5003
  };
5045
5004
  const denullify = (itemData, fieldID) => fieldID && itemData ? itemData[fieldID] : null;
5005
+ const bagelInjectionKey = Symbol("bagel");
5006
+ const i18nTInjectionKey = Symbol("bagel");
5007
+ function useBagel() {
5008
+ const bagel = vue.inject(bagelInjectionKey);
5009
+ if (!bagel)
5010
+ throw new Error("No bagel provided");
5011
+ return bagel;
5012
+ }
5013
+ function useI18nT() {
5014
+ const i18nT = vue.inject(i18nTInjectionKey);
5015
+ if (!i18nT)
5016
+ throw new Error("No i18nT provided");
5017
+ return i18nT;
5018
+ }
5019
+ const BagelVue = {
5020
+ install: (app, options) => {
5021
+ const bagel = new Bagel({ host: options.host, onError: options.onError });
5022
+ app.directive("click-outside", clickOutside);
5023
+ app.use(Gt$1, {
5024
+ themes: {
5025
+ "bgl-theme": {
5026
+ triggers: ["click"],
5027
+ autoHide: true,
5028
+ placement: "bottom"
5029
+ }
5030
+ }
5031
+ });
5032
+ const { availableLangs, defaultLang, lang } = useLang();
5033
+ if (options.availableLangs)
5034
+ availableLangs.value = options.availableLangs;
5035
+ if (options.defaultLang)
5036
+ defaultLang.value = options.defaultLang;
5037
+ if (options.language)
5038
+ lang.value = options.language;
5039
+ app.config.globalProperties.$bagel = bagel;
5040
+ app.provide(bagelInjectionKey, bagel);
5041
+ app.config.globalProperties.$i18T = (options == null ? void 0 : options.i18nT) || ((key) => key);
5042
+ app.provide(i18nTInjectionKey, (options == null ? void 0 : options.i18nT) || ((key) => key));
5043
+ }
5044
+ };
5045
+ const ModalSymbol = Symbol("modal");
5046
+ const useModal = () => {
5047
+ const modalApi = vue.inject(ModalSymbol);
5048
+ if (!modalApi)
5049
+ throw new Error("Modal API not provided");
5050
+ return modalApi;
5051
+ };
5052
+ const ModalPlugin = {
5053
+ install: (app) => {
5054
+ const modalStack = vue.ref([]);
5055
+ const hideModal = (index2) => {
5056
+ modalStack.value.splice(index2, 1);
5057
+ };
5058
+ const modalConfirm = (options) => new Promise((resolve) => {
5059
+ if (typeof options === "string")
5060
+ options = { title: options, message: "" };
5061
+ modalStack.value.push({
5062
+ modalOptions: { ...options, resolve },
5063
+ modalType: "confirm",
5064
+ componentSlots: {}
5065
+ });
5066
+ });
5067
+ const showModal = (modalType, options, slots = {}) => {
5068
+ modalStack.value.push({
5069
+ modalOptions: options,
5070
+ modalType,
5071
+ componentSlots: slots
5072
+ });
5073
+ if (modalType === "modalForm")
5074
+ return modalStack.value.at(-1);
5075
+ return modalStack.value.at(-1);
5076
+ };
5077
+ app.provide(ModalSymbol, {
5078
+ showModal: (options, slots) => showModal("modal", options, slots),
5079
+ showModalForm: (options, slots) => showModal("modalForm", options, slots),
5080
+ confirm: (userOptions) => modalConfirm(userOptions),
5081
+ hideModal: (index2 = modalStack.value.length - 1) => hideModal(index2)
5082
+ // modalOptions,
5083
+ });
5084
+ const ModalComponent = vue.defineComponent({
5085
+ data: () => ({ modalStack: modalStack.value }),
5086
+ render() {
5087
+ return modalStack.value.map((modal, index2) => {
5088
+ const props2 = { ...modal.modalOptions, visible: true, "onUpdate:visible": () => hideModal(index2) };
5089
+ if (modal.modalType === "modalForm")
5090
+ return vue.h(ModalForm, props2, modal.componentSlots);
5091
+ if (modal.modalType === "confirm")
5092
+ return vue.h(_sfc_main$n, props2, {});
5093
+ return vue.h(_sfc_main$F, props2, modal.componentSlots);
5094
+ });
5095
+ }
5096
+ });
5097
+ app.component("ModalContainer", ModalComponent);
5098
+ }
5099
+ };
5046
5100
  const _sfc_main$I = /* @__PURE__ */ vue.defineComponent({
5047
5101
  __name: "MaterialIcon",
5048
5102
  props: {
@@ -5652,7 +5706,11 @@ const _sfc_main$z = /* @__PURE__ */ vue.defineComponent({
5652
5706
  if (typeof props2.schema === "function") {
5653
5707
  return props2.schema();
5654
5708
  }
5655
- return props2.schema;
5709
+ if (props2.schema)
5710
+ return props2.schema;
5711
+ const keys4 = [...new Set((props2.data || []).map(Object.keys).flat())];
5712
+ const schema = keys4.map((id) => ({ id, label: keyToLabel(id) }));
5713
+ return schema;
5656
5714
  });
5657
5715
  const emit2 = __emit;
5658
5716
  const selectElement = (item) => emit2("select", item);
@@ -5761,7 +5819,7 @@ const _sfc_main$z = /* @__PURE__ */ vue.defineComponent({
5761
5819
  };
5762
5820
  }
5763
5821
  });
5764
- const TableSchema = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["__scopeId", "data-v-54d69b8f"]]);
5822
+ const TableSchema = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["__scopeId", "data-v-1d169811"]]);
5765
5823
  const _sfc_main$y = {};
5766
5824
  const _hoisted_1$w = { class: "flex space-between" };
5767
5825
  function _sfc_render$1(_ctx, _cache) {
@@ -5965,7 +6023,8 @@ const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
5965
6023
  props: {
5966
6024
  message: {},
5967
6025
  dismissable: { type: Boolean },
5968
- type: { default: "info" }
6026
+ type: { default: "info" },
6027
+ icon: {}
5969
6028
  },
5970
6029
  setup(__props) {
5971
6030
  const isDismissed = vue.ref(false);
@@ -5980,12 +6039,13 @@ const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
5980
6039
  class: vue.normalizeClass(["alert", [_ctx.type]]),
5981
6040
  dismissable: _ctx.dismissable
5982
6041
  }, [
5983
- vue.createVNode(vue.unref(_sfc_main$I), {
6042
+ _ctx.icon !== "none" ? (vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$I), {
6043
+ key: 0,
5984
6044
  class: "alert_icon",
5985
- icon: _ctx.type,
6045
+ icon: _ctx.icon || _ctx.type,
5986
6046
  size: 2,
5987
6047
  color: color2[_ctx.type]
5988
- }, null, 8, ["icon", "color"]),
6048
+ }, null, 8, ["icon", "color"])) : vue.createCommentVNode("", true),
5989
6049
  vue.createElementVNode("p", _hoisted_2$o, vue.toDisplayString(_ctx.message), 1),
5990
6050
  vue.createVNode(Btn, {
5991
6051
  onClick: _cache[0] || (_cache[0] = ($event) => isDismissed.value = true),
@@ -5998,7 +6058,7 @@ const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
5998
6058
  };
5999
6059
  }
6000
6060
  });
6001
- const Alert = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__scopeId", "data-v-4017e821"]]);
6061
+ const Alert = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__scopeId", "data-v-0ec1391d"]]);
6002
6062
  const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
6003
6063
  __name: "Badge",
6004
6064
  props: {
@@ -6358,7 +6418,7 @@ const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
6358
6418
  formData.value = val;
6359
6419
  emit2("update:modelValue", val);
6360
6420
  },
6361
- get: () => props2.modelValue || formData.value
6421
+ get: () => formData.value
6362
6422
  });
6363
6423
  const form = vue.ref();
6364
6424
  const validateForm = () => {
@@ -6380,7 +6440,8 @@ const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
6380
6440
  const isValid2 = validateForm();
6381
6441
  if (!isValid2)
6382
6442
  return;
6383
- emit2("submit", data2.value);
6443
+ emit2("submit", { ...formData.value });
6444
+ isDirty.value = false;
6384
6445
  };
6385
6446
  const i18nT = (val) => val;
6386
6447
  const deleteItem = () => {
@@ -6437,7 +6498,10 @@ const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
6437
6498
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => vue.isRef(data2) ? data2.value = $event : data2 = $event)
6438
6499
  }, null, 8, ["field", "modelValue"]);
6439
6500
  }), 128)),
6440
- vue.renderSlot(_ctx.$slots, "submit")
6501
+ vue.renderSlot(_ctx.$slots, "submit", {
6502
+ submit: runSubmit,
6503
+ isDirty: vue.unref(isDirty)
6504
+ })
6441
6505
  ], 544)) : vue.createCommentVNode("", true),
6442
6506
  _ctx.status === "success" ? vue.renderSlot(_ctx.$slots, "success", { key: 2 }) : vue.createCommentVNode("", true),
6443
6507
  _ctx.status === "error" ? vue.renderSlot(_ctx.$slots, "error", { key: 3 }) : vue.createCommentVNode("", true)
@@ -15360,7 +15424,7 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
15360
15424
  };
15361
15425
  const getValue = (option2) => {
15362
15426
  if (!option2)
15363
- return "";
15427
+ return void 0;
15364
15428
  if (typeof option2 === "string")
15365
15429
  return option2;
15366
15430
  if (typeof option2 === "number")
@@ -15368,12 +15432,10 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
15368
15432
  return option2.value;
15369
15433
  };
15370
15434
  const isSelected = (option2) => !!selectedItems.value.find((item) => getValue(option2) === getValue(item));
15371
- const filteredOptions = vue.computed(
15372
- () => props2.options.filter((option2) => {
15373
- const searchTerm = search.value.split(/\s+/).filter(Boolean).map((t) => new RegExp(t, "gi"));
15374
- return Boolean(option2) && (searchTerm.every((s2) => getLabel(option2).match(s2)) || searchTerm.length === 0);
15375
- })
15376
- );
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
+ }));
15377
15439
  const select2 = (option2) => {
15378
15440
  var _a2;
15379
15441
  const existingIndex = selectedItems.value.findIndex(
@@ -15395,9 +15457,8 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
15395
15457
  if (props2.multiselect) {
15396
15458
  emit2("update:modelValue", selectedItems.value.map(getValue).filter(Boolean));
15397
15459
  } else {
15398
- selectedItems.value.splice(1, selectedItems.value.length - 1);
15399
15460
  const [item] = selectedItems.value;
15400
- emit2("update:modelValue", item ? getValue(item) : null);
15461
+ emit2("update:modelValue", getValue(item));
15401
15462
  }
15402
15463
  }
15403
15464
  function compareArrays(arr1, arr2) {
@@ -15514,7 +15575,7 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
15514
15575
  };
15515
15576
  }
15516
15577
  });
15517
- const SelectInput = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-6b40f812"]]);
15578
+ const SelectInput = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-39ae2ac8"]]);
15518
15579
  /*!
15519
15580
  * vue-draggable-next v2.2.0
15520
15581
  * (c) 2023 Anish George
@@ -18216,7 +18277,7 @@ const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
18216
18277
  autoheight: { type: Boolean },
18217
18278
  code: { type: Boolean },
18218
18279
  lines: {},
18219
- autocomplete: { default: "off" },
18280
+ autocomplete: {},
18220
18281
  autofocus: { type: Boolean }
18221
18282
  },
18222
18283
  emits: ["update:modelValue", "debounce"],
@@ -18348,7 +18409,7 @@ const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
18348
18409
  };
18349
18410
  }
18350
18411
  });
18351
- const TextInput = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-df718b64"]]);
18412
+ const TextInput = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-534ec341"]]);
18352
18413
  const _hoisted_1$j = { class: "primary-checkbox" };
18353
18414
  const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
18354
18415
  __name: "Checkbox",
@@ -18439,7 +18500,9 @@ const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
18439
18500
  id: {},
18440
18501
  options: {},
18441
18502
  showTimeWrap: { type: Boolean },
18442
- modelValue: {}
18503
+ modelValue: {},
18504
+ allowedDates: {},
18505
+ disabledDates: {}
18443
18506
  },
18444
18507
  emits: ["update:modelValue"],
18445
18508
  setup(__props, { emit: __emit }) {
@@ -18466,6 +18529,8 @@ const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
18466
18529
  "week-start": "0",
18467
18530
  modelValue: selectedDate.value,
18468
18531
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => selectedDate.value = $event),
18532
+ "allowed-dates": _ctx.allowedDates,
18533
+ "disabled-dates": _ctx.disabledDates,
18469
18534
  "auto-apply": true,
18470
18535
  "highlight-week-days": [6],
18471
18536
  "enable-time-picker": false,
@@ -18474,7 +18539,7 @@ const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
18474
18539
  "action-buttons": vue.withCtx(() => []),
18475
18540
  "action-preview": vue.withCtx(() => []),
18476
18541
  _: 1
18477
- }, 16, ["modelValue"])
18542
+ }, 16, ["modelValue", "allowed-dates", "disabled-dates"])
18478
18543
  ]),
18479
18544
  _ctx.showTimeWrap ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$b, [
18480
18545
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(hours), (hr2) => {
@@ -18508,7 +18573,7 @@ const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
18508
18573
  props: {
18509
18574
  options: {},
18510
18575
  modelValue: { default: "" },
18511
- id: { default: () => `radio-pill-${Math.random().toString(36).substr(2, 9)}` },
18576
+ id: { default: () => `radio-pill-${Math.random().toString(36).substring(2, 9)}` },
18512
18577
  label: { default: "" }
18513
18578
  },
18514
18579
  emits: ["update:modelValue"],
@@ -18529,7 +18594,7 @@ const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
18529
18594
  return option2.value;
18530
18595
  };
18531
18596
  const props2 = __props;
18532
- let selectedValue = vue.ref("");
18597
+ let selectedValue = vue.ref(props2.modelValue);
18533
18598
  function handleSelect(e) {
18534
18599
  var _a2;
18535
18600
  const newVal = (_a2 = e.target) == null ? void 0 : _a2.value;
@@ -18563,7 +18628,7 @@ const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
18563
18628
  id: `${_ctx.id}-${getValue(option2)}`,
18564
18629
  name: _ctx.id,
18565
18630
  value: getValue(option2),
18566
- checked: vue.unref(selectedValue) === getValue(option2),
18631
+ checked: vue.unref(selectedValue) == getValue(option2),
18567
18632
  onChange: handleSelect
18568
18633
  }, null, 40, _hoisted_4$6),
18569
18634
  vue.createElementVNode("label", {
@@ -18576,7 +18641,7 @@ const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
18576
18641
  };
18577
18642
  }
18578
18643
  });
18579
- const RadioPillsInput = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-41859ed6"]]);
18644
+ const RadioPillsInput = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-880c5069"]]);
18580
18645
  const _hoisted_1$f = { class: "bagel-input" };
18581
18646
  const _hoisted_2$c = {
18582
18647
  key: 0,
@@ -18592,7 +18657,7 @@ const _hoisted_7$1 = {
18592
18657
  };
18593
18658
  const _hoisted_8 = ["src"];
18594
18659
  const _hoisted_9 = { class: "previewName" };
18595
- const _hoisted_10 = ["src"];
18660
+ const _hoisted_10 = ["width", "src"];
18596
18661
  const _hoisted_11 = { class: "no-margin" };
18597
18662
  const _hoisted_12 = {
18598
18663
  key: 0,
@@ -18605,7 +18670,8 @@ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
18605
18670
  multiple: { type: Boolean },
18606
18671
  files: {},
18607
18672
  deleteEndpoint: {},
18608
- bindkey: {}
18673
+ bindkey: {},
18674
+ width: {}
18609
18675
  }, {
18610
18676
  "modelValue": {},
18611
18677
  "modelModifiers": {}
@@ -18618,11 +18684,31 @@ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
18618
18684
  const file_bindkeys = vue.useModel(__props, "modelValue");
18619
18685
  const storageFiles = vue.ref([]);
18620
18686
  const compareIds = (v1, v2) => [v1].flat().join(",") === [v2].flat().join(",");
18687
+ vue.onMounted(() => {
18688
+ if (!props2.files && [file_bindkeys.value].flat().length) {
18689
+ const ids = [file_bindkeys.value].flat();
18690
+ if (props2.multiple) {
18691
+ ids.forEach((id) => {
18692
+ void bagel.get(`/files/${id}`).then((file) => {
18693
+ storageFiles.value.push(file);
18694
+ });
18695
+ });
18696
+ } else {
18697
+ void bagel.get(`/files/${ids[0]}`).then((file) => {
18698
+ storageFiles.value.push(file);
18699
+ });
18700
+ }
18701
+ }
18702
+ });
18621
18703
  vue.watch(
18622
18704
  () => props2.files,
18623
18705
  (newFiles) => {
18624
- if (newFiles)
18625
- storageFiles.value.push(...[newFiles].flat());
18706
+ if (newFiles) {
18707
+ const filesToAdd = [newFiles].flat().filter((f2) => !storageFiles.value.find((sf) => sf[bindKey2] === f2[bindKey2]));
18708
+ for (const file of filesToAdd) {
18709
+ storageFiles.value.push(file);
18710
+ }
18711
+ }
18626
18712
  },
18627
18713
  { immediate: true }
18628
18714
  );
@@ -18733,7 +18819,6 @@ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
18733
18819
  vue.createElementVNode("div", _hoisted_4$5, [
18734
18820
  _ctx.multiple ? (vue.openBlock(), vue.createElementBlock("img", {
18735
18821
  key: 0,
18736
- height: "60",
18737
18822
  class: "preview",
18738
18823
  src: file.url,
18739
18824
  alt: ""
@@ -18763,7 +18848,7 @@ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
18763
18848
  vue.createElementVNode("div", _hoisted_9, [
18764
18849
  _ctx.multiple ? (vue.openBlock(), vue.createElementBlock("img", {
18765
18850
  key: 0,
18766
- height: "60",
18851
+ width: _ctx.width || "220",
18767
18852
  class: "preview",
18768
18853
  src: fileToUrl(fileQ.file),
18769
18854
  alt: ""
@@ -18787,7 +18872,7 @@ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
18787
18872
  };
18788
18873
  }
18789
18874
  });
18790
- const $el = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-0dbacaa0"]]);
18875
+ const $el = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-4f0a6b20"]]);
18791
18876
  const _withScopeId$1 = (n2) => (vue.pushScopeId("data-v-b87221d6"), n2 = n2(), vue.popScopeId(), n2);
18792
18877
  const _hoisted_1$e = ["title"];
18793
18878
  const _hoisted_2$b = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ vue.createElementVNode("span", { class: "slider round" }, null, -1));
@@ -51019,12 +51104,18 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
51019
51104
  tabs: {},
51020
51105
  modelValue: {}
51021
51106
  },
51022
- setup(__props) {
51107
+ emits: ["update:modelValue"],
51108
+ setup(__props, { emit: __emit }) {
51023
51109
  const props2 = __props;
51024
51110
  const slots = vue.useSlots();
51025
51111
  const group = Math.random().toString(36).substring(7);
51026
51112
  const { currentTab } = useTabs(group);
51027
51113
  const tabValue = (tab) => typeof tab === "string" ? tab : tab.id;
51114
+ const emit2 = __emit;
51115
+ const slctTab = vue.computed({
51116
+ get: () => props2.modelValue || tabValue(props2.tabs[0]),
51117
+ set: (value) => emit2("update:modelValue", value)
51118
+ });
51028
51119
  const tabComponent = vue.defineComponent({
51029
51120
  render() {
51030
51121
  var _a2, _b, _c;
@@ -51032,16 +51123,18 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
51032
51123
  (tab) => tabValue(tab) === currentTab.value
51033
51124
  );
51034
51125
  const slotChildren = (_c = (_b = (_a2 = slots == null ? void 0 : slots.default) == null ? void 0 : _a2.call(slots)) == null ? void 0 : _b[1]) == null ? void 0 : _c.children;
51035
- return vue.h("div", slotChildren == null ? void 0 : slotChildren[currentTabIndex]);
51126
+ return vue.h("div", slotChildren[currentTabIndex]);
51036
51127
  }
51037
51128
  });
51038
51129
  return (_ctx, _cache) => {
51039
51130
  return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
51040
51131
  vue.createVNode(vue.unref(TabsNav), {
51132
+ modelValue: slctTab.value,
51133
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => slctTab.value = $event),
51041
51134
  tabs: _ctx.tabs,
51042
51135
  group: vue.unref(group),
51043
51136
  class: "mb-05"
51044
- }, null, 8, ["tabs", "group"]),
51137
+ }, null, 8, ["modelValue", "tabs", "group"]),
51045
51138
  vue.unref(currentTab) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, [
51046
51139
  vue.unref(slots)[vue.unref(currentTab)] ? vue.renderSlot(_ctx.$slots, vue.unref(currentTab), { key: 0 }) : vue.unref(currentTab) ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(tabComponent)), { key: 1 })) : vue.createCommentVNode("", true)
51047
51140
  ])) : vue.createCommentVNode("", true)
@@ -51080,6 +51173,14 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
51080
51173
  return tab;
51081
51174
  return tab.label;
51082
51175
  };
51176
+ vue.watch(
51177
+ () => props2.modelValue,
51178
+ (value) => {
51179
+ if (value && !isActive2(value))
51180
+ currentTab.value = value;
51181
+ },
51182
+ { immediate: true }
51183
+ );
51083
51184
  return (_ctx, _cache) => {
51084
51185
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$2, [
51085
51186
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.tabs, (tab, i2) => {
@@ -51100,7 +51201,7 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
51100
51201
  };
51101
51202
  }
51102
51203
  });
51103
- const TabsNav = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-ca10eb5f"]]);
51204
+ const TabsNav = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-05be4d6e"]]);
51104
51205
  const _hoisted_1$1 = { key: 0 };
51105
51206
  const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
51106
51207
  __name: "TabsBody",
@@ -51248,4 +51349,5 @@ exports.keyToLabel = keyToLabel;
51248
51349
  exports.useBagel = useBagel;
51249
51350
  exports.useEscape = useEscape;
51250
51351
  exports.useI18nT = useI18nT;
51352
+ exports.useLang = useLang;
51251
51353
  exports.useModal = useModal;