@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.mjs CHANGED
@@ -4,7 +4,7 @@ var __publicField2 = (obj, key, value) => {
4
4
  __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
5
5
  return value;
6
6
  };
7
- import { pushScopeId, popScopeId, defineComponent, nextTick, openBlock, createBlock, createElementBlock, normalizeClass, renderSlot, normalizeProps, guardReactiveProps, withScopeId, resolveComponent, normalizeStyle, withKeys, createElementVNode, Fragment as Fragment$1, createCommentVNode, mergeProps, withCtx, createVNode, ref, createApp, h as h$2, toDisplayString, inject, unref, renderList, resolveDynamicComponent, useCssVars, useSlots, computed, withModifiers, createTextVNode, watch, onMounted, onUnmounted, mergeModels, useModel, createSlots, Transition, reactive, provide, isRef, withDirectives, vModelCheckbox, toRef, Teleport, render as render$f, onBeforeUpdate, vShow, getCurrentScope, onScopeDispose, TransitionGroup, vModelDynamic, vModelText, vModelRadio, onBeforeUnmount, getCurrentInstance, watchEffect, markRaw, customRef, resolveDirective } from "vue";
7
+ import { pushScopeId, popScopeId, defineComponent, nextTick, openBlock, createBlock, createElementBlock, normalizeClass, renderSlot, normalizeProps, guardReactiveProps, withScopeId, resolveComponent, normalizeStyle, withKeys, createElementVNode, Fragment as Fragment$1, createCommentVNode, mergeProps, withCtx, createVNode, ref, createApp, h as h$2, toDisplayString, reactive, computed, inject, unref, renderList, resolveDynamicComponent, useCssVars, useSlots, withModifiers, createTextVNode, watch, onMounted, onUnmounted, mergeModels, useModel, createSlots, Transition, provide, isRef, withDirectives, vModelCheckbox, toRef, Teleport, render as render$f, onBeforeUpdate, vShow, getCurrentScope, onScopeDispose, TransitionGroup, vModelDynamic, vModelText, vModelRadio, onBeforeUnmount, getCurrentInstance, watchEffect, markRaw, customRef, resolveDirective } from "vue";
8
8
  const sides = ["top", "right", "bottom", "left"];
9
9
  const alignments = ["start", "end"];
10
10
  const placements$1 = /* @__PURE__ */ sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
@@ -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, {
@@ -4811,94 +4824,6 @@ const clickOutside = {
4811
4824
  document.removeEventListener("click", el.clickOutsideEvent);
4812
4825
  }
4813
4826
  };
4814
- const bagelInjectionKey = Symbol("bagel");
4815
- const i18nTInjectionKey = Symbol("bagel");
4816
- function useBagel() {
4817
- const bagel = inject(bagelInjectionKey);
4818
- if (!bagel)
4819
- throw new Error("No bagel provided");
4820
- return bagel;
4821
- }
4822
- function useI18nT() {
4823
- const i18nT = inject(i18nTInjectionKey);
4824
- if (!i18nT)
4825
- throw new Error("No i18nT provided");
4826
- return i18nT;
4827
- }
4828
- const BagelVue = {
4829
- install: (app, options) => {
4830
- const bagel = new Bagel({ host: options.host, onError: options.onError });
4831
- app.directive("click-outside", clickOutside);
4832
- app.use(Gt$1, {
4833
- themes: {
4834
- "bgl-theme": {
4835
- triggers: ["click"],
4836
- autoHide: true,
4837
- placement: "bottom"
4838
- }
4839
- }
4840
- });
4841
- app.config.globalProperties.$bagel = bagel;
4842
- app.provide(bagelInjectionKey, bagel);
4843
- app.config.globalProperties.$i18T = (options == null ? void 0 : options.i18nT) || ((key) => key);
4844
- app.provide(i18nTInjectionKey, (options == null ? void 0 : options.i18nT) || ((key) => key));
4845
- }
4846
- };
4847
- const ModalSymbol = Symbol("modal");
4848
- const useModal = () => {
4849
- const modalApi = inject(ModalSymbol);
4850
- if (!modalApi)
4851
- throw new Error("Modal API not provided");
4852
- return modalApi;
4853
- };
4854
- const ModalPlugin = {
4855
- install: (app) => {
4856
- const modalStack = ref([]);
4857
- const hideModal = (index2) => {
4858
- modalStack.value.splice(index2, 1);
4859
- };
4860
- const modalConfirm = (options) => new Promise((resolve) => {
4861
- if (typeof options === "string")
4862
- options = { title: options, message: "" };
4863
- modalStack.value.push({
4864
- modalOptions: { ...options, resolve },
4865
- modalType: "confirm",
4866
- componentSlots: {}
4867
- });
4868
- });
4869
- const showModal = (modalType, options, slots = {}) => {
4870
- modalStack.value.push({
4871
- modalOptions: options,
4872
- modalType,
4873
- componentSlots: slots
4874
- });
4875
- if (modalType === "modalForm")
4876
- return modalStack.value.at(-1);
4877
- return modalStack.value.at(-1);
4878
- };
4879
- app.provide(ModalSymbol, {
4880
- showModal: (options, slots) => showModal("modal", options, slots),
4881
- showModalForm: (options, slots) => showModal("modalForm", options, slots),
4882
- confirm: (userOptions) => modalConfirm(userOptions),
4883
- hideModal: (index2 = modalStack.value.length - 1) => hideModal(index2)
4884
- // modalOptions,
4885
- });
4886
- const ModalComponent = defineComponent({
4887
- data: () => ({ modalStack: modalStack.value }),
4888
- render() {
4889
- return modalStack.value.map((modal, index2) => {
4890
- const props2 = { ...modal.modalOptions, visible: true, "onUpdate:visible": () => hideModal(index2) };
4891
- if (modal.modalType === "modalForm")
4892
- return h$2(ModalForm, props2, modal.componentSlots);
4893
- if (modal.modalType === "confirm")
4894
- return h$2(_sfc_main$n, props2, {});
4895
- return h$2(_sfc_main$F, props2, modal.componentSlots);
4896
- });
4897
- }
4898
- });
4899
- app.component("ModalContainer", ModalComponent);
4900
- }
4901
- };
4902
4827
  function formatString(str, format2) {
4903
4828
  if (format2 === "titleCase") {
4904
4829
  return str.split("_").map((word) => word[0].toUpperCase() + word.slice(1).toLocaleLowerCase()).join(" ");
@@ -4938,7 +4863,11 @@ function txtField(id, label, options) {
4938
4863
  id,
4939
4864
  label,
4940
4865
  placeholder: options == null ? void 0 : options.placeholder,
4941
- 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
+ }
4942
4871
  };
4943
4872
  }
4944
4873
  function slctField(id, label, options, config) {
@@ -4951,7 +4880,11 @@ function slctField(id, label, options, config) {
4951
4880
  required: config == null ? void 0 : config.required,
4952
4881
  label,
4953
4882
  defaultValue: config == null ? void 0 : config.defaultValue,
4954
- 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
+ }
4955
4888
  };
4956
4889
  }
4957
4890
  function checkField(id, label, options) {
@@ -4977,7 +4910,7 @@ function numField(id, label, options) {
4977
4910
  function frmRow(...children2) {
4978
4911
  return {
4979
4912
  $el: "div",
4980
- class: "flex gap-1 m_block mt-1",
4913
+ class: "flex gap-1 m_block",
4981
4914
  children: children2
4982
4915
  };
4983
4916
  }
@@ -4990,6 +4923,32 @@ const bagelFormUtils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defi
4990
4923
  slctField,
4991
4924
  txtField
4992
4925
  }, Symbol.toStringTag, { value: "Module" }));
4926
+ const state$1 = reactive({
4927
+ defaultLang: "",
4928
+ availableLangs: [],
4929
+ lang: "en"
4930
+ });
4931
+ function useLang() {
4932
+ const lang = computed({
4933
+ get: () => state$1.lang,
4934
+ set: (val) => state$1.lang = val
4935
+ });
4936
+ const $tdb = (langEl) => langEl[state$1.lang] || langEl[state$1.defaultLang] || "";
4937
+ const availableLangs = computed({
4938
+ get: () => state$1.availableLangs,
4939
+ set: (val) => state$1.availableLangs = val
4940
+ });
4941
+ const defaultLang = computed({
4942
+ get: () => state$1.defaultLang,
4943
+ set: (val) => state$1.defaultLang = val
4944
+ });
4945
+ return {
4946
+ lang,
4947
+ $tdb,
4948
+ availableLangs,
4949
+ defaultLang
4950
+ };
4951
+ }
4993
4952
  let timeout;
4994
4953
  const debounce$2 = (fn2, delay = 500) => {
4995
4954
  clearTimeout(timeout);
@@ -5041,6 +5000,101 @@ const iffer = (field, itemData) => {
5041
5000
  return true;
5042
5001
  };
5043
5002
  const denullify = (itemData, fieldID) => fieldID && itemData ? itemData[fieldID] : null;
5003
+ const bagelInjectionKey = Symbol("bagel");
5004
+ const i18nTInjectionKey = Symbol("bagel");
5005
+ function useBagel() {
5006
+ const bagel = inject(bagelInjectionKey);
5007
+ if (!bagel)
5008
+ throw new Error("No bagel provided");
5009
+ return bagel;
5010
+ }
5011
+ function useI18nT() {
5012
+ const i18nT = inject(i18nTInjectionKey);
5013
+ if (!i18nT)
5014
+ throw new Error("No i18nT provided");
5015
+ return i18nT;
5016
+ }
5017
+ const BagelVue = {
5018
+ install: (app, options) => {
5019
+ const bagel = new Bagel({ host: options.host, onError: options.onError });
5020
+ app.directive("click-outside", clickOutside);
5021
+ app.use(Gt$1, {
5022
+ themes: {
5023
+ "bgl-theme": {
5024
+ triggers: ["click"],
5025
+ autoHide: true,
5026
+ placement: "bottom"
5027
+ }
5028
+ }
5029
+ });
5030
+ const { availableLangs, defaultLang, lang } = useLang();
5031
+ if (options.availableLangs)
5032
+ availableLangs.value = options.availableLangs;
5033
+ if (options.defaultLang)
5034
+ defaultLang.value = options.defaultLang;
5035
+ if (options.language)
5036
+ lang.value = options.language;
5037
+ app.config.globalProperties.$bagel = bagel;
5038
+ app.provide(bagelInjectionKey, bagel);
5039
+ app.config.globalProperties.$i18T = (options == null ? void 0 : options.i18nT) || ((key) => key);
5040
+ app.provide(i18nTInjectionKey, (options == null ? void 0 : options.i18nT) || ((key) => key));
5041
+ }
5042
+ };
5043
+ const ModalSymbol = Symbol("modal");
5044
+ const useModal = () => {
5045
+ const modalApi = inject(ModalSymbol);
5046
+ if (!modalApi)
5047
+ throw new Error("Modal API not provided");
5048
+ return modalApi;
5049
+ };
5050
+ const ModalPlugin = {
5051
+ install: (app) => {
5052
+ const modalStack = ref([]);
5053
+ const hideModal = (index2) => {
5054
+ modalStack.value.splice(index2, 1);
5055
+ };
5056
+ const modalConfirm = (options) => new Promise((resolve) => {
5057
+ if (typeof options === "string")
5058
+ options = { title: options, message: "" };
5059
+ modalStack.value.push({
5060
+ modalOptions: { ...options, resolve },
5061
+ modalType: "confirm",
5062
+ componentSlots: {}
5063
+ });
5064
+ });
5065
+ const showModal = (modalType, options, slots = {}) => {
5066
+ modalStack.value.push({
5067
+ modalOptions: options,
5068
+ modalType,
5069
+ componentSlots: slots
5070
+ });
5071
+ if (modalType === "modalForm")
5072
+ return modalStack.value.at(-1);
5073
+ return modalStack.value.at(-1);
5074
+ };
5075
+ app.provide(ModalSymbol, {
5076
+ showModal: (options, slots) => showModal("modal", options, slots),
5077
+ showModalForm: (options, slots) => showModal("modalForm", options, slots),
5078
+ confirm: (userOptions) => modalConfirm(userOptions),
5079
+ hideModal: (index2 = modalStack.value.length - 1) => hideModal(index2)
5080
+ // modalOptions,
5081
+ });
5082
+ const ModalComponent = defineComponent({
5083
+ data: () => ({ modalStack: modalStack.value }),
5084
+ render() {
5085
+ return modalStack.value.map((modal, index2) => {
5086
+ const props2 = { ...modal.modalOptions, visible: true, "onUpdate:visible": () => hideModal(index2) };
5087
+ if (modal.modalType === "modalForm")
5088
+ return h$2(ModalForm, props2, modal.componentSlots);
5089
+ if (modal.modalType === "confirm")
5090
+ return h$2(_sfc_main$n, props2, {});
5091
+ return h$2(_sfc_main$F, props2, modal.componentSlots);
5092
+ });
5093
+ }
5094
+ });
5095
+ app.component("ModalContainer", ModalComponent);
5096
+ }
5097
+ };
5044
5098
  const _sfc_main$I = /* @__PURE__ */ defineComponent({
5045
5099
  __name: "MaterialIcon",
5046
5100
  props: {
@@ -5650,7 +5704,11 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
5650
5704
  if (typeof props2.schema === "function") {
5651
5705
  return props2.schema();
5652
5706
  }
5653
- return props2.schema;
5707
+ if (props2.schema)
5708
+ return props2.schema;
5709
+ const keys4 = [...new Set((props2.data || []).map(Object.keys).flat())];
5710
+ const schema = keys4.map((id) => ({ id, label: keyToLabel(id) }));
5711
+ return schema;
5654
5712
  });
5655
5713
  const emit2 = __emit;
5656
5714
  const selectElement = (item) => emit2("select", item);
@@ -5759,7 +5817,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
5759
5817
  };
5760
5818
  }
5761
5819
  });
5762
- const TableSchema = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["__scopeId", "data-v-54d69b8f"]]);
5820
+ const TableSchema = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["__scopeId", "data-v-1d169811"]]);
5763
5821
  const _sfc_main$y = {};
5764
5822
  const _hoisted_1$w = { class: "flex space-between" };
5765
5823
  function _sfc_render$1(_ctx, _cache) {
@@ -5963,7 +6021,8 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
5963
6021
  props: {
5964
6022
  message: {},
5965
6023
  dismissable: { type: Boolean },
5966
- type: { default: "info" }
6024
+ type: { default: "info" },
6025
+ icon: {}
5967
6026
  },
5968
6027
  setup(__props) {
5969
6028
  const isDismissed = ref(false);
@@ -5978,12 +6037,13 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
5978
6037
  class: normalizeClass(["alert", [_ctx.type]]),
5979
6038
  dismissable: _ctx.dismissable
5980
6039
  }, [
5981
- createVNode(unref(_sfc_main$I), {
6040
+ _ctx.icon !== "none" ? (openBlock(), createBlock(unref(_sfc_main$I), {
6041
+ key: 0,
5982
6042
  class: "alert_icon",
5983
- icon: _ctx.type,
6043
+ icon: _ctx.icon || _ctx.type,
5984
6044
  size: 2,
5985
6045
  color: color2[_ctx.type]
5986
- }, null, 8, ["icon", "color"]),
6046
+ }, null, 8, ["icon", "color"])) : createCommentVNode("", true),
5987
6047
  createElementVNode("p", _hoisted_2$o, toDisplayString(_ctx.message), 1),
5988
6048
  createVNode(Btn, {
5989
6049
  onClick: _cache[0] || (_cache[0] = ($event) => isDismissed.value = true),
@@ -5996,7 +6056,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
5996
6056
  };
5997
6057
  }
5998
6058
  });
5999
- const Alert = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__scopeId", "data-v-4017e821"]]);
6059
+ const Alert = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__scopeId", "data-v-0ec1391d"]]);
6000
6060
  const _sfc_main$q = /* @__PURE__ */ defineComponent({
6001
6061
  __name: "Badge",
6002
6062
  props: {
@@ -6356,7 +6416,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
6356
6416
  formData.value = val;
6357
6417
  emit2("update:modelValue", val);
6358
6418
  },
6359
- get: () => props2.modelValue || formData.value
6419
+ get: () => formData.value
6360
6420
  });
6361
6421
  const form = ref();
6362
6422
  const validateForm = () => {
@@ -6378,7 +6438,8 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
6378
6438
  const isValid2 = validateForm();
6379
6439
  if (!isValid2)
6380
6440
  return;
6381
- emit2("submit", data2.value);
6441
+ emit2("submit", { ...formData.value });
6442
+ isDirty.value = false;
6382
6443
  };
6383
6444
  const i18nT = (val) => val;
6384
6445
  const deleteItem = () => {
@@ -6435,7 +6496,10 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
6435
6496
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(data2) ? data2.value = $event : data2 = $event)
6436
6497
  }, null, 8, ["field", "modelValue"]);
6437
6498
  }), 128)),
6438
- renderSlot(_ctx.$slots, "submit")
6499
+ renderSlot(_ctx.$slots, "submit", {
6500
+ submit: runSubmit,
6501
+ isDirty: unref(isDirty)
6502
+ })
6439
6503
  ], 544)) : createCommentVNode("", true),
6440
6504
  _ctx.status === "success" ? renderSlot(_ctx.$slots, "success", { key: 2 }) : createCommentVNode("", true),
6441
6505
  _ctx.status === "error" ? renderSlot(_ctx.$slots, "error", { key: 3 }) : createCommentVNode("", true)
@@ -15358,7 +15422,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
15358
15422
  };
15359
15423
  const getValue = (option2) => {
15360
15424
  if (!option2)
15361
- return "";
15425
+ return void 0;
15362
15426
  if (typeof option2 === "string")
15363
15427
  return option2;
15364
15428
  if (typeof option2 === "number")
@@ -15366,12 +15430,10 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
15366
15430
  return option2.value;
15367
15431
  };
15368
15432
  const isSelected = (option2) => !!selectedItems.value.find((item) => getValue(option2) === getValue(item));
15369
- const filteredOptions = computed(
15370
- () => props2.options.filter((option2) => {
15371
- const searchTerm = search.value.split(/\s+/).filter(Boolean).map((t) => new RegExp(t, "gi"));
15372
- return Boolean(option2) && (searchTerm.every((s2) => getLabel(option2).match(s2)) || searchTerm.length === 0);
15373
- })
15374
- );
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
+ }));
15375
15437
  const select2 = (option2) => {
15376
15438
  var _a2;
15377
15439
  const existingIndex = selectedItems.value.findIndex(
@@ -15393,9 +15455,8 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
15393
15455
  if (props2.multiselect) {
15394
15456
  emit2("update:modelValue", selectedItems.value.map(getValue).filter(Boolean));
15395
15457
  } else {
15396
- selectedItems.value.splice(1, selectedItems.value.length - 1);
15397
15458
  const [item] = selectedItems.value;
15398
- emit2("update:modelValue", item ? getValue(item) : null);
15459
+ emit2("update:modelValue", getValue(item));
15399
15460
  }
15400
15461
  }
15401
15462
  function compareArrays(arr1, arr2) {
@@ -15512,7 +15573,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
15512
15573
  };
15513
15574
  }
15514
15575
  });
15515
- const SelectInput = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-6b40f812"]]);
15576
+ const SelectInput = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-39ae2ac8"]]);
15516
15577
  /*!
15517
15578
  * vue-draggable-next v2.2.0
15518
15579
  * (c) 2023 Anish George
@@ -18214,7 +18275,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
18214
18275
  autoheight: { type: Boolean },
18215
18276
  code: { type: Boolean },
18216
18277
  lines: {},
18217
- autocomplete: { default: "off" },
18278
+ autocomplete: {},
18218
18279
  autofocus: { type: Boolean }
18219
18280
  },
18220
18281
  emits: ["update:modelValue", "debounce"],
@@ -18346,7 +18407,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
18346
18407
  };
18347
18408
  }
18348
18409
  });
18349
- const TextInput = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-df718b64"]]);
18410
+ const TextInput = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-534ec341"]]);
18350
18411
  const _hoisted_1$j = { class: "primary-checkbox" };
18351
18412
  const _sfc_main$e = /* @__PURE__ */ defineComponent({
18352
18413
  __name: "Checkbox",
@@ -18437,7 +18498,9 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
18437
18498
  id: {},
18438
18499
  options: {},
18439
18500
  showTimeWrap: { type: Boolean },
18440
- modelValue: {}
18501
+ modelValue: {},
18502
+ allowedDates: {},
18503
+ disabledDates: {}
18441
18504
  },
18442
18505
  emits: ["update:modelValue"],
18443
18506
  setup(__props, { emit: __emit }) {
@@ -18464,6 +18527,8 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
18464
18527
  "week-start": "0",
18465
18528
  modelValue: selectedDate.value,
18466
18529
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => selectedDate.value = $event),
18530
+ "allowed-dates": _ctx.allowedDates,
18531
+ "disabled-dates": _ctx.disabledDates,
18467
18532
  "auto-apply": true,
18468
18533
  "highlight-week-days": [6],
18469
18534
  "enable-time-picker": false,
@@ -18472,7 +18537,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
18472
18537
  "action-buttons": withCtx(() => []),
18473
18538
  "action-preview": withCtx(() => []),
18474
18539
  _: 1
18475
- }, 16, ["modelValue"])
18540
+ }, 16, ["modelValue", "allowed-dates", "disabled-dates"])
18476
18541
  ]),
18477
18542
  _ctx.showTimeWrap ? (openBlock(), createElementBlock("div", _hoisted_3$b, [
18478
18543
  (openBlock(true), createElementBlock(Fragment$1, null, renderList(unref(hours), (hr2) => {
@@ -18506,7 +18571,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
18506
18571
  props: {
18507
18572
  options: {},
18508
18573
  modelValue: { default: "" },
18509
- id: { default: () => `radio-pill-${Math.random().toString(36).substr(2, 9)}` },
18574
+ id: { default: () => `radio-pill-${Math.random().toString(36).substring(2, 9)}` },
18510
18575
  label: { default: "" }
18511
18576
  },
18512
18577
  emits: ["update:modelValue"],
@@ -18527,7 +18592,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
18527
18592
  return option2.value;
18528
18593
  };
18529
18594
  const props2 = __props;
18530
- let selectedValue = ref("");
18595
+ let selectedValue = ref(props2.modelValue);
18531
18596
  function handleSelect(e) {
18532
18597
  var _a2;
18533
18598
  const newVal = (_a2 = e.target) == null ? void 0 : _a2.value;
@@ -18561,7 +18626,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
18561
18626
  id: `${_ctx.id}-${getValue(option2)}`,
18562
18627
  name: _ctx.id,
18563
18628
  value: getValue(option2),
18564
- checked: unref(selectedValue) === getValue(option2),
18629
+ checked: unref(selectedValue) == getValue(option2),
18565
18630
  onChange: handleSelect
18566
18631
  }, null, 40, _hoisted_4$6),
18567
18632
  createElementVNode("label", {
@@ -18574,7 +18639,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
18574
18639
  };
18575
18640
  }
18576
18641
  });
18577
- const RadioPillsInput = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-41859ed6"]]);
18642
+ const RadioPillsInput = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-880c5069"]]);
18578
18643
  const _hoisted_1$f = { class: "bagel-input" };
18579
18644
  const _hoisted_2$c = {
18580
18645
  key: 0,
@@ -18590,7 +18655,7 @@ const _hoisted_7$1 = {
18590
18655
  };
18591
18656
  const _hoisted_8 = ["src"];
18592
18657
  const _hoisted_9 = { class: "previewName" };
18593
- const _hoisted_10 = ["src"];
18658
+ const _hoisted_10 = ["width", "src"];
18594
18659
  const _hoisted_11 = { class: "no-margin" };
18595
18660
  const _hoisted_12 = {
18596
18661
  key: 0,
@@ -18603,7 +18668,8 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
18603
18668
  multiple: { type: Boolean },
18604
18669
  files: {},
18605
18670
  deleteEndpoint: {},
18606
- bindkey: {}
18671
+ bindkey: {},
18672
+ width: {}
18607
18673
  }, {
18608
18674
  "modelValue": {},
18609
18675
  "modelModifiers": {}
@@ -18616,11 +18682,31 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
18616
18682
  const file_bindkeys = useModel(__props, "modelValue");
18617
18683
  const storageFiles = ref([]);
18618
18684
  const compareIds = (v1, v2) => [v1].flat().join(",") === [v2].flat().join(",");
18685
+ onMounted(() => {
18686
+ if (!props2.files && [file_bindkeys.value].flat().length) {
18687
+ const ids = [file_bindkeys.value].flat();
18688
+ if (props2.multiple) {
18689
+ ids.forEach((id) => {
18690
+ void bagel.get(`/files/${id}`).then((file) => {
18691
+ storageFiles.value.push(file);
18692
+ });
18693
+ });
18694
+ } else {
18695
+ void bagel.get(`/files/${ids[0]}`).then((file) => {
18696
+ storageFiles.value.push(file);
18697
+ });
18698
+ }
18699
+ }
18700
+ });
18619
18701
  watch(
18620
18702
  () => props2.files,
18621
18703
  (newFiles) => {
18622
- if (newFiles)
18623
- storageFiles.value.push(...[newFiles].flat());
18704
+ if (newFiles) {
18705
+ const filesToAdd = [newFiles].flat().filter((f2) => !storageFiles.value.find((sf) => sf[bindKey2] === f2[bindKey2]));
18706
+ for (const file of filesToAdd) {
18707
+ storageFiles.value.push(file);
18708
+ }
18709
+ }
18624
18710
  },
18625
18711
  { immediate: true }
18626
18712
  );
@@ -18731,7 +18817,6 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
18731
18817
  createElementVNode("div", _hoisted_4$5, [
18732
18818
  _ctx.multiple ? (openBlock(), createElementBlock("img", {
18733
18819
  key: 0,
18734
- height: "60",
18735
18820
  class: "preview",
18736
18821
  src: file.url,
18737
18822
  alt: ""
@@ -18761,7 +18846,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
18761
18846
  createElementVNode("div", _hoisted_9, [
18762
18847
  _ctx.multiple ? (openBlock(), createElementBlock("img", {
18763
18848
  key: 0,
18764
- height: "60",
18849
+ width: _ctx.width || "220",
18765
18850
  class: "preview",
18766
18851
  src: fileToUrl(fileQ.file),
18767
18852
  alt: ""
@@ -18785,7 +18870,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
18785
18870
  };
18786
18871
  }
18787
18872
  });
18788
- const $el = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-0dbacaa0"]]);
18873
+ const $el = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-4f0a6b20"]]);
18789
18874
  const _withScopeId$1 = (n2) => (pushScopeId("data-v-b87221d6"), n2 = n2(), popScopeId(), n2);
18790
18875
  const _hoisted_1$e = ["title"];
18791
18876
  const _hoisted_2$b = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ createElementVNode("span", { class: "slider round" }, null, -1));
@@ -51017,12 +51102,18 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
51017
51102
  tabs: {},
51018
51103
  modelValue: {}
51019
51104
  },
51020
- setup(__props) {
51105
+ emits: ["update:modelValue"],
51106
+ setup(__props, { emit: __emit }) {
51021
51107
  const props2 = __props;
51022
51108
  const slots = useSlots();
51023
51109
  const group = Math.random().toString(36).substring(7);
51024
51110
  const { currentTab } = useTabs(group);
51025
51111
  const tabValue = (tab) => typeof tab === "string" ? tab : tab.id;
51112
+ const emit2 = __emit;
51113
+ const slctTab = computed({
51114
+ get: () => props2.modelValue || tabValue(props2.tabs[0]),
51115
+ set: (value) => emit2("update:modelValue", value)
51116
+ });
51026
51117
  const tabComponent = defineComponent({
51027
51118
  render() {
51028
51119
  var _a2, _b, _c;
@@ -51030,16 +51121,18 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
51030
51121
  (tab) => tabValue(tab) === currentTab.value
51031
51122
  );
51032
51123
  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;
51033
- return h$2("div", slotChildren == null ? void 0 : slotChildren[currentTabIndex]);
51124
+ return h$2("div", slotChildren[currentTabIndex]);
51034
51125
  }
51035
51126
  });
51036
51127
  return (_ctx, _cache) => {
51037
51128
  return openBlock(), createElementBlock(Fragment$1, null, [
51038
51129
  createVNode(unref(TabsNav), {
51130
+ modelValue: slctTab.value,
51131
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => slctTab.value = $event),
51039
51132
  tabs: _ctx.tabs,
51040
51133
  group: unref(group),
51041
51134
  class: "mb-05"
51042
- }, null, 8, ["tabs", "group"]),
51135
+ }, null, 8, ["modelValue", "tabs", "group"]),
51043
51136
  unref(currentTab) ? (openBlock(), createElementBlock("div", _hoisted_1$3, [
51044
51137
  unref(slots)[unref(currentTab)] ? renderSlot(_ctx.$slots, unref(currentTab), { key: 0 }) : unref(currentTab) ? (openBlock(), createBlock(resolveDynamicComponent(unref(tabComponent)), { key: 1 })) : createCommentVNode("", true)
51045
51138
  ])) : createCommentVNode("", true)
@@ -51078,6 +51171,14 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
51078
51171
  return tab;
51079
51172
  return tab.label;
51080
51173
  };
51174
+ watch(
51175
+ () => props2.modelValue,
51176
+ (value) => {
51177
+ if (value && !isActive2(value))
51178
+ currentTab.value = value;
51179
+ },
51180
+ { immediate: true }
51181
+ );
51081
51182
  return (_ctx, _cache) => {
51082
51183
  return openBlock(), createElementBlock("div", _hoisted_1$2, [
51083
51184
  (openBlock(true), createElementBlock(Fragment$1, null, renderList(_ctx.tabs, (tab, i2) => {
@@ -51098,7 +51199,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
51098
51199
  };
51099
51200
  }
51100
51201
  });
51101
- const TabsNav = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-ca10eb5f"]]);
51202
+ const TabsNav = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-05be4d6e"]]);
51102
51203
  const _hoisted_1$1 = { key: 0 };
51103
51204
  const _sfc_main$1 = /* @__PURE__ */ defineComponent({
51104
51205
  __name: "TabsBody",
@@ -51247,5 +51348,6 @@ export {
51247
51348
  useBagel,
51248
51349
  useEscape,
51249
51350
  useI18nT,
51351
+ useLang,
51250
51352
  useModal
51251
51353
  };