@bagelink/vue 1.2.93 → 1.2.97

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.
package/dist/index.cjs CHANGED
@@ -15730,8 +15730,8 @@ const _hoisted_12$3 = {
15730
15730
  key: 1,
15731
15731
  class: "bgl-single-preview"
15732
15732
  };
15733
- const _hoisted_13$1 = { class: "position-start m-05 flex opacity-7 z-99 gap-025" };
15734
- const _hoisted_14$1 = {
15733
+ const _hoisted_13$2 = { class: "position-start m-05 flex opacity-7 z-99 gap-025" };
15734
+ const _hoisted_14$2 = {
15735
15735
  key: 0,
15736
15736
  class: "h-100"
15737
15737
  };
@@ -16081,7 +16081,7 @@ const _sfc_main$M = /* @__PURE__ */ vue.defineComponent({
16081
16081
  key: file.id,
16082
16082
  class: vue.normalizeClass(["single-image-item-preview", { "bgl_fill-image": _ctx.fill }])
16083
16083
  }, [
16084
- vue.createElementVNode("div", _hoisted_13$1, [
16084
+ vue.createElementVNode("div", _hoisted_13$2, [
16085
16085
  vue.withDirectives(vue.createVNode(vue.unref(Btn), {
16086
16086
  color: "gray",
16087
16087
  thin: "",
@@ -16111,7 +16111,7 @@ const _sfc_main$M = /* @__PURE__ */ vue.defineComponent({
16111
16111
  [_directive_tooltip, "Download"]
16112
16112
  ])
16113
16113
  ]),
16114
- isImage(file.extension || file.url) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_14$1, [
16114
+ isImage(file.extension || file.url) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_14$2, [
16115
16115
  vue.withDirectives(vue.createVNode(vue.unref(Image$1), {
16116
16116
  class: "single-preview",
16117
16117
  src: file.url,
@@ -27657,6 +27657,108 @@ const files = {
27657
27657
  return axios$1.get("/files_v2/list", { params: { dir_path: dirPath } });
27658
27658
  }
27659
27659
  };
27660
+ function useFileUpload(props2 = {}) {
27661
+ files.setBaseUrl(useBagel().host);
27662
+ const fileQueue = vue.ref([]);
27663
+ const storageFiles = vue.ref([]);
27664
+ const pk = vue.ref([]);
27665
+ const pathKeys = vue.computed(() => {
27666
+ const storagePathKeys = storageFiles.value.map((file) => file.path_key);
27667
+ return [...pk.value, ...storagePathKeys];
27668
+ });
27669
+ const fileToUrl = (file) => URL.createObjectURL(file);
27670
+ const addFile = (file) => {
27671
+ if (!file) return;
27672
+ let filesToAdd = [];
27673
+ if (file instanceof File) {
27674
+ filesToAdd = [file];
27675
+ } else if (file instanceof FileList) {
27676
+ filesToAdd = Array.from(file);
27677
+ } else if (Array.isArray(file)) {
27678
+ filesToAdd = file;
27679
+ }
27680
+ const newQueueFiles = filesToAdd.map((f2) => ({
27681
+ name: f2.name,
27682
+ file: f2,
27683
+ progress: 0
27684
+ }));
27685
+ fileQueue.value.push(...newQueueFiles);
27686
+ };
27687
+ const removeFile = async (pathKeyOrFile) => {
27688
+ if (typeof pathKeyOrFile === "string") {
27689
+ storageFiles.value = storageFiles.value.filter((file) => file.path_key !== pathKeyOrFile);
27690
+ const pathKeyIndex = pk.value.indexOf(pathKeyOrFile);
27691
+ if (pathKeyIndex !== -1) {
27692
+ pk.value.splice(pathKeyIndex, 1);
27693
+ }
27694
+ try {
27695
+ await files.delete(pathKeyOrFile);
27696
+ } catch (error) {
27697
+ console.error("Error deleting file:", error);
27698
+ }
27699
+ } else if (pathKeyOrFile) {
27700
+ const index2 = fileQueue.value.findIndex(({ file }) => file.name === pathKeyOrFile.name);
27701
+ if (index2 !== -1) {
27702
+ fileQueue.value.splice(index2, 1);
27703
+ }
27704
+ }
27705
+ };
27706
+ const flushQueue = async () => {
27707
+ for (const file of fileQueue.value) {
27708
+ file.uploading = true;
27709
+ if (!props2.multiple) {
27710
+ pk.value.splice(0, 1);
27711
+ }
27712
+ try {
27713
+ const { data: data2 } = await files.upload(file.file, {
27714
+ onUploadProgress: (e) => {
27715
+ file.progress = e.loaded / e.total * 100 - 1;
27716
+ },
27717
+ dirPath: props2.dirPath
27718
+ });
27719
+ pk.value.push(data2.path_key);
27720
+ } catch (error) {
27721
+ console.error("Error uploading file:", error);
27722
+ }
27723
+ }
27724
+ fileQueue.value = [];
27725
+ };
27726
+ const browse = (upload = false) => {
27727
+ if (props2.disabled) return;
27728
+ const input = document.createElement("input");
27729
+ input.type = "file";
27730
+ input.multiple = !!props2.multiple;
27731
+ input.accept = props2.accept || "";
27732
+ input.onchange = (e) => {
27733
+ addFile(e.target.files);
27734
+ if (upload) {
27735
+ flushQueue();
27736
+ }
27737
+ };
27738
+ input.click();
27739
+ };
27740
+ vue.onMounted(() => {
27741
+ if (props2.dirPath) {
27742
+ files.list(props2.dirPath).then((response) => {
27743
+ const responseData = Array.isArray(response.data) ? response.data : [response.data];
27744
+ storageFiles.value.push(...responseData);
27745
+ }).catch((error) => {
27746
+ console.error("Error loading files:", error);
27747
+ });
27748
+ }
27749
+ });
27750
+ return {
27751
+ fileQueue,
27752
+ storageFiles,
27753
+ pk,
27754
+ pathKeys,
27755
+ fileToUrl,
27756
+ removeFile,
27757
+ flushQueue,
27758
+ addFile,
27759
+ browse
27760
+ };
27761
+ }
27660
27762
  const _hoisted_1$o = { class: "bagel-input" };
27661
27763
  const _hoisted_2$e = { key: 0 };
27662
27764
  const _hoisted_3$b = {
@@ -27687,8 +27789,8 @@ const _hoisted_12$2 = {
27687
27789
  key: 1,
27688
27790
  class: "bgl-single-preview"
27689
27791
  };
27690
- const _hoisted_13 = { class: "position-start m-05 flex opacity-7 z-99 gap-025" };
27691
- const _hoisted_14 = {
27792
+ const _hoisted_13$1 = { class: "position-start m-05 flex opacity-7 z-99 gap-025" };
27793
+ const _hoisted_14$1 = {
27692
27794
  key: 0,
27693
27795
  class: "h-100"
27694
27796
  };
@@ -27722,111 +27824,61 @@ const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
27722
27824
  setup(__props, { emit: __emit }) {
27723
27825
  const props2 = __props;
27724
27826
  const emit2 = __emit;
27725
- const bagel = useBagel(bagelInjectionKey);
27726
- files.setBaseUrl(bagel.host);
27727
- const fileQueue = vue.ref([]);
27728
- let storageFiles = vue.ref([]);
27729
- const pk = vue.ref([props2.modelValue].flat().filter(Boolean));
27730
- const pathKeys = vue.computed(() => {
27731
- const sf = storageFiles.value.map((file) => file.path_key);
27732
- return [...pk.value, ...sf];
27733
- });
27734
- vue.watch(() => pk.value, (value) => {
27735
- if (props2.multiple) emit2("update:modelValue", value);
27736
- else emit2("update:modelValue", value[0] || void 0);
27737
- }, { deep: true });
27827
+ const {
27828
+ fileQueue,
27829
+ pathKeys,
27830
+ removeFile,
27831
+ flushQueue,
27832
+ fileToUrl,
27833
+ addFile,
27834
+ browse
27835
+ } = useFileUpload({
27836
+ disabled: props2.disabled,
27837
+ dirPath: props2.dirPath,
27838
+ multiple: props2.multiple,
27839
+ accept: props2.accept
27840
+ });
27738
27841
  const isImage = (str) => IMAGE_FORMATS_REGEXP.test(str);
27739
- const fileToUrl = (file) => URL.createObjectURL(file);
27740
27842
  let isDragOver = vue.ref(false);
27741
- async function removeFile(path_key) {
27742
- storageFiles.value = storageFiles.value.filter((file) => file.path_key !== path_key);
27743
- const pki = pk.value.indexOf(path_key);
27744
- if (pki !== -1) pk.value.splice(pki, 1);
27745
- try {
27746
- await files.delete(path_key);
27747
- } catch (error) {
27748
- console.error(error);
27749
- }
27750
- }
27751
- async function flushQueue() {
27752
- emit2("addFileStart");
27753
- for (const file of fileQueue.value) {
27754
- file.uploading = true;
27755
- if (!props2.multiple) pk.value.splice(0, 1);
27756
- try {
27757
- const { data: data2 } = await files.upload(file.file, {
27758
- onUploadProgress: (e) => {
27759
- file.progress = e.loaded / e.total * 100 - 1;
27760
- },
27761
- dirPath: props2.dirPath
27762
- });
27763
- pk.value.push(data2.path_key);
27764
- } catch (error) {
27765
- console.error("error flushing queue", error);
27766
- }
27767
- }
27768
- fileQueue.value.splice(0, fileQueue.value.length);
27769
- }
27770
- function browse() {
27771
- if (props2.disabled) return;
27772
- const input = document.createElement("input");
27773
- input.type = "file";
27774
- input.multiple = props2.multiple;
27775
- input.accept = props2.accept;
27776
- input.onchange = (e) => {
27777
- const files2 = Array.from(e.target.files || []);
27778
- fileQueue.value.push(...files2.map((file) => ({ name: file.name, file, progress: 0 })));
27779
- flushQueue();
27780
- };
27781
- input.click();
27782
- }
27783
27843
  function handleDrag(e, isDragging = false) {
27784
27844
  e.preventDefault();
27785
27845
  e.stopPropagation();
27786
27846
  if (!props2.disabled) isDragOver.value = isDragging;
27787
27847
  }
27788
- function handleDrop(e) {
27848
+ async function handleDrop(e) {
27789
27849
  var _a;
27790
27850
  if (props2.disabled) return;
27791
27851
  e.preventDefault();
27792
27852
  e.stopPropagation();
27793
- if ((_a = e.dataTransfer) == null ? void 0 : _a.files) {
27794
- fileQueue.value.push(...Array.from(e.dataTransfer.files).map((file) => ({ name: file.name, file, progress: 0 })));
27795
- flushQueue();
27796
- }
27853
+ emit2("addFileStart");
27854
+ addFile((_a = e.dataTransfer) == null ? void 0 : _a.files);
27855
+ await flushQueue();
27856
+ emit2("update:modelValue", pathKeys.value);
27797
27857
  isDragOver.value = false;
27798
27858
  }
27799
- if (props2.dirPath) {
27800
- files.list(props2.dirPath).then((response) => storageFiles.value.push(...[response.data].flat())).catch(console.error);
27801
- }
27802
- vue.watch(() => props2.dirPath, () => {
27803
- if (props2.dirPath) {
27804
- files.list(props2.dirPath).then((response) => storageFiles.value.push(...[response.data].flat())).catch(console.error);
27805
- }
27806
- });
27807
27859
  return (_ctx, _cache) => {
27808
27860
  const _directive_tooltip = vue.resolveDirective("tooltip");
27809
27861
  const _directive_lightbox = vue.resolveDirective("lightbox");
27810
27862
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$o, [
27811
27863
  _ctx.label ? (vue.openBlock(), vue.createElementBlock("label", _hoisted_2$e, vue.toDisplayString(_ctx.label), 1)) : vue.createCommentVNode("", true),
27812
- _ctx.required && !pathKeys.value.length ? (vue.openBlock(), vue.createElementBlock("input", _hoisted_3$b)) : vue.createCommentVNode("", true),
27864
+ _ctx.required && !vue.unref(pathKeys).length ? (vue.openBlock(), vue.createElementBlock("input", _hoisted_3$b)) : vue.createCommentVNode("", true),
27813
27865
  _ctx.theme === "basic" ? (vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$13), {
27814
27866
  key: 2,
27815
27867
  outline: "",
27816
27868
  class: "flex p-05 gap-1",
27817
- onDragover: _cache[0] || (_cache[0] = (e) => handleDrag(e, true)),
27869
+ onDragover: _cache[2] || (_cache[2] = (e) => handleDrag(e, true)),
27818
27870
  onDrop: handleDrop
27819
27871
  }, {
27820
27872
  default: vue.withCtx(() => [
27821
- !pathKeys.value.length && !fileQueue.value.length ? (vue.openBlock(), vue.createBlock(vue.unref(Btn), {
27873
+ !vue.unref(pathKeys).length && !vue.unref(fileQueue).length ? (vue.openBlock(), vue.createBlock(vue.unref(Btn), {
27822
27874
  key: 0,
27823
27875
  class: "px-1-5",
27824
27876
  icon: "upload",
27825
27877
  outline: "",
27826
27878
  value: _ctx.btnPlaceholder || "Upload",
27827
- onClick: browse
27879
+ onClick: _cache[0] || (_cache[0] = ($event) => vue.unref(browse)(true))
27828
27880
  }, null, 8, ["value"])) : vue.createCommentVNode("", true),
27829
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(pathKeys.value, (path_key) => {
27881
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(pathKeys), (path_key) => {
27830
27882
  return vue.openBlock(), vue.createElementBlock("div", {
27831
27883
  key: path_key,
27832
27884
  class: "txt-gray txt-12 flex"
@@ -27836,7 +27888,7 @@ const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
27836
27888
  color: "gray",
27837
27889
  thin: "",
27838
27890
  icon: "delete",
27839
- onClick: ($event) => removeFile(path_key)
27891
+ onClick: ($event) => vue.unref(removeFile)(path_key)
27840
27892
  }, null, 8, ["onClick"]), [
27841
27893
  [_directive_tooltip, "Delete"]
27842
27894
  ]),
@@ -27844,7 +27896,7 @@ const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
27844
27896
  color: "gray",
27845
27897
  thin: "",
27846
27898
  icon: "autorenew",
27847
- onClick: browse
27899
+ onClick: _cache[1] || (_cache[1] = ($event) => vue.unref(browse)(true))
27848
27900
  }, null, 512), [
27849
27901
  [_directive_tooltip, "Replace"]
27850
27902
  ]),
@@ -27869,28 +27921,28 @@ const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
27869
27921
  ])
27870
27922
  ]);
27871
27923
  }), 128)),
27872
- !pathKeys.value.length && !fileQueue.value.length ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_7$4, vue.toDisplayString(_ctx.noFilePlaceholder || "No file selected"), 1)) : vue.createCommentVNode("", true)
27924
+ !vue.unref(pathKeys).length && !vue.unref(fileQueue).length ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_7$4, vue.toDisplayString(_ctx.noFilePlaceholder || "No file selected"), 1)) : vue.createCommentVNode("", true)
27873
27925
  ]),
27874
27926
  _: 1
27875
27927
  })) : (vue.openBlock(), vue.createElementBlock("div", {
27876
27928
  key: 3,
27877
27929
  class: vue.normalizeClass(["fileUploadWrap", {
27878
- "fileDropZone": !pathKeys.value.length && !fileQueue.value.length,
27930
+ "fileDropZone": !vue.unref(pathKeys).length && !vue.unref(fileQueue).length,
27879
27931
  "dragover": vue.unref(isDragOver),
27880
27932
  "bgl_oval-upload": _ctx.oval
27881
27933
  }]),
27882
27934
  style: vue.normalizeStyle({ width: _ctx.width, height: _ctx.height }),
27883
- onClick: browse,
27884
- onDragover: _cache[1] || (_cache[1] = (e) => handleDrag(e, true)),
27935
+ onClick: _cache[4] || (_cache[4] = ($event) => vue.unref(browse)(true)),
27936
+ onDragover: _cache[5] || (_cache[5] = (e) => handleDrag(e, true)),
27885
27937
  onDrop: handleDrop,
27886
- onDragleave: _cache[2] || (_cache[2] = (e) => handleDrag(e))
27938
+ onDragleave: _cache[6] || (_cache[6] = (e) => handleDrag(e))
27887
27939
  }, [
27888
27940
  vue.renderSlot(_ctx.$slots, "files", {
27889
- files: pathKeys.value,
27890
- fileQueue: fileQueue.value
27941
+ files: vue.unref(pathKeys),
27942
+ fileQueue: vue.unref(fileQueue)
27891
27943
  }, () => [
27892
27944
  _ctx.multiple ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_8$3, [
27893
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(pathKeys.value, (path_key) => {
27945
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(pathKeys), (path_key) => {
27894
27946
  return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
27895
27947
  key: path_key,
27896
27948
  class: vue.normalizeClass(["multi-image-item-preview", { "bgl_fill-image": _ctx.fill }])
@@ -27910,13 +27962,13 @@ const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
27910
27962
  flat: "",
27911
27963
  icon: "delete",
27912
27964
  color: "red",
27913
- onClick: ($event) => removeFile(path_key)
27965
+ onClick: ($event) => vue.unref(removeFile)(path_key)
27914
27966
  }, null, 8, ["onClick"])
27915
27967
  ], 2)), [
27916
27968
  [_directive_lightbox, { src: vue.unref(pathKeyToURL)(path_key), download: true }]
27917
27969
  ]);
27918
27970
  }), 128)),
27919
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(fileQueue.value, (file) => {
27971
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(fileQueue), (file) => {
27920
27972
  return vue.openBlock(), vue.createElementBlock("div", {
27921
27973
  key: file.name,
27922
27974
  class: vue.normalizeClass(["multi-image-item-preview", { "bgl_fill-image": _ctx.fill }])
@@ -27924,7 +27976,7 @@ const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
27924
27976
  isImage(file.file.type) ? (vue.openBlock(), vue.createBlock(vue.unref(Image$1), {
27925
27977
  key: 0,
27926
27978
  class: "multi-preview",
27927
- src: fileToUrl(file.file),
27979
+ src: vue.unref(fileToUrl)(file.file),
27928
27980
  alt: ""
27929
27981
  }, null, 8, ["src"])) : (vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$u), {
27930
27982
  key: 1,
@@ -27944,18 +27996,18 @@ const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
27944
27996
  ], 6)
27945
27997
  ], 2);
27946
27998
  }), 128))
27947
- ])) : pathKeys.value.length > 0 || fileQueue.value.length > 0 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_12$2, [
27948
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(pathKeys.value, (path_key) => {
27999
+ ])) : vue.unref(pathKeys).length > 0 || vue.unref(fileQueue).length > 0 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_12$2, [
28000
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(pathKeys), (path_key) => {
27949
28001
  return vue.openBlock(), vue.createElementBlock("div", {
27950
28002
  key: path_key,
27951
28003
  class: vue.normalizeClass(["single-image-item-preview", { "bgl_fill-image": _ctx.fill }])
27952
28004
  }, [
27953
- vue.createElementVNode("div", _hoisted_13, [
28005
+ vue.createElementVNode("div", _hoisted_13$1, [
27954
28006
  vue.withDirectives(vue.createVNode(vue.unref(Btn), {
27955
28007
  color: "gray",
27956
28008
  thin: "",
27957
28009
  icon: "delete",
27958
- onClick: ($event) => removeFile(path_key)
28010
+ onClick: ($event) => vue.unref(removeFile)(path_key)
27959
28011
  }, null, 8, ["onClick"]), [
27960
28012
  [_directive_tooltip, "Delete"]
27961
28013
  ]),
@@ -27963,7 +28015,7 @@ const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
27963
28015
  color: "gray",
27964
28016
  thin: "",
27965
28017
  icon: "autorenew",
27966
- onClick: browse
28018
+ onClick: _cache[3] || (_cache[3] = ($event) => vue.unref(browse)(true))
27967
28019
  }, null, 512), [
27968
28020
  [_directive_tooltip, "Replace"]
27969
28021
  ]),
@@ -27977,7 +28029,7 @@ const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
27977
28029
  [_directive_tooltip, "Download"]
27978
28030
  ])
27979
28031
  ]),
27980
- isImage(path_key) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_14, [
28032
+ isImage(path_key) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_14$1, [
27981
28033
  vue.withDirectives(vue.createVNode(vue.unref(Image$1), {
27982
28034
  class: "single-preview",
27983
28035
  pathKey: path_key,
@@ -27996,7 +28048,7 @@ const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
27996
28048
  ])
27997
28049
  ], 2);
27998
28050
  }), 128)),
27999
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(fileQueue.value, (file) => {
28051
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(fileQueue), (file) => {
28000
28052
  return vue.openBlock(), vue.createElementBlock("div", {
28001
28053
  key: file.name,
28002
28054
  class: vue.normalizeClass(["single-image-item-preview", { "bgl_fill-image": _ctx.fill }])
@@ -28014,20 +28066,20 @@ const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
28014
28066
  isImage(file.file.type) ? vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(Image$1), {
28015
28067
  key: 0,
28016
28068
  class: "single-preview",
28017
- src: fileToUrl(file.file),
28069
+ src: vue.unref(fileToUrl)(file.file),
28018
28070
  alt: ""
28019
28071
  }, null, 8, ["src"])), [
28020
- [_directive_lightbox, { src: fileToUrl(file.file), download: true }]
28072
+ [_directive_lightbox, { src: vue.unref(fileToUrl)(file.file), download: true }]
28021
28073
  ]) : vue.createCommentVNode("", true)
28022
28074
  ], 2);
28023
28075
  }), 128))
28024
28076
  ])) : vue.createCommentVNode("", true)
28025
28077
  ], true),
28026
- !pathKeys.value.length && !fileQueue.value.length || _ctx.multiple ? vue.renderSlot(_ctx.$slots, "placeholder", {
28078
+ !vue.unref(pathKeys).length && !vue.unref(fileQueue).length || _ctx.multiple ? vue.renderSlot(_ctx.$slots, "placeholder", {
28027
28079
  key: 0,
28028
- files: pathKeys.value,
28029
- fileQueue: fileQueue.value,
28030
- browse
28080
+ files: vue.unref(pathKeys),
28081
+ fileQueue: vue.unref(fileQueue),
28082
+ browse: vue.unref(browse)
28031
28083
  }, () => [
28032
28084
  vue.createElementVNode("p", _hoisted_16, [
28033
28085
  vue.createVNode(vue.unref(_sfc_main$u), { icon: "upload_2" }),
@@ -28039,7 +28091,7 @@ const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
28039
28091
  };
28040
28092
  }
28041
28093
  });
28042
- const UploadInput = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["__scopeId", "data-v-d8f3ff01"]]);
28094
+ const UploadInput = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["__scopeId", "data-v-38a4d4a9"]]);
28043
28095
  const FONT_AWESOME_ICONS = [
28044
28096
  "trash-can",
28045
28097
  "message",
@@ -34065,8 +34117,8 @@ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
34065
34117
  },
34066
34118
  setup(__props) {
34067
34119
  vue.useCssVars((_ctx) => ({
34068
- "dbb738e2": computedBackgroundColor.value,
34069
- "418961aa": cumputedTextColor.value
34120
+ "09d70b6a": computedBackgroundColor.value,
34121
+ "69df9534": cumputedTextColor.value
34070
34122
  }));
34071
34123
  const props2 = __props;
34072
34124
  const slots = vue.useSlots();
@@ -34150,7 +34202,8 @@ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
34150
34202
  vue.createVNode(vue.unref(Btn), vue.mergeProps({
34151
34203
  class: "bgl_pill-btn",
34152
34204
  round: "",
34153
- thin: ""
34205
+ thin: "",
34206
+ flat: ""
34154
34207
  }, _ctx.btnEnd), null, 16)
34155
34208
  ])) : vue.createCommentVNode("", true)
34156
34209
  ]))
@@ -34159,7 +34212,7 @@ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
34159
34212
  };
34160
34213
  }
34161
34214
  });
34162
- const Pill = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-764b6b8b"]]);
34215
+ const Pill = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-ae730ec5"]]);
34163
34216
  const _sfc_main$8 = {};
34164
34217
  function _sfc_render$2(_ctx, _cache) {
34165
34218
  const _component_router_view = vue.resolveComponent("router-view");
@@ -36589,17 +36642,22 @@ const _hoisted_3 = {
36589
36642
  class: "center"
36590
36643
  };
36591
36644
  const _hoisted_4 = { key: 3 };
36592
- const _hoisted_5 = ["src", "title"];
36593
- const _hoisted_6 = {
36645
+ const _hoisted_5 = {
36646
+ key: 2,
36647
+ class: "vw90"
36648
+ };
36649
+ const _hoisted_6 = ["src", "title"];
36650
+ const _hoisted_7 = {
36594
36651
  key: 3,
36595
- class: "file-info txt-white flex m_block align-items-start gap-025"
36652
+ class: "vw90"
36596
36653
  };
36597
- const _hoisted_7 = { class: "txt-start" };
36598
- const _hoisted_8 = { class: "mx-0 light" };
36599
- const _hoisted_9 = { class: "semi word-break-all" };
36600
- const _hoisted_10 = { class: "mx-0" };
36601
- const _hoisted_11 = { class: "semi" };
36602
- const _hoisted_12 = {
36654
+ const _hoisted_8 = { class: "file-info txt-white flex m_block align-items-start gap-025" };
36655
+ const _hoisted_9 = { class: "txt-start" };
36656
+ const _hoisted_10 = { class: "mx-0 light" };
36657
+ const _hoisted_11 = { class: "semi word-break-all" };
36658
+ const _hoisted_12 = { class: "mx-0" };
36659
+ const _hoisted_13 = { class: "semi" };
36660
+ const _hoisted_14 = {
36603
36661
  key: 0,
36604
36662
  class: "flex justify-content-center mt-2 overflow p-1 fixed bottom start end gap-1 m_justify-content-start"
36605
36663
  };
@@ -36654,11 +36712,21 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
36654
36712
  if (zoom.value === 1) close();
36655
36713
  }
36656
36714
  const upgradeHeaders = (url) => url.replace(/http:\/\//, "//");
36715
+ function downloadFile() {
36716
+ const link = document.createElement("a");
36717
+ const src = currentItem.value.src || "";
36718
+ link.target = "_blank";
36719
+ link.href = upgradeHeaders(src);
36720
+ link.download = src ? src.split("/").pop() || "download" : "download";
36721
+ document.body.appendChild(link);
36722
+ link.click();
36723
+ document.body.removeChild(link);
36724
+ }
36657
36725
  __expose({ open, close });
36658
36726
  return (_ctx, _cache) => {
36659
36727
  return vue.openBlock(), vue.createBlock(vue.Transition, { name: "fade" }, {
36660
36728
  default: vue.withCtx(() => {
36661
- var _a, _b, _c, _d, _e2, _f, _g, _h, _i, _j;
36729
+ var _a, _b, _c, _d, _e2, _f, _g, _h, _i;
36662
36730
  return [
36663
36731
  vue.unref(isOpen) ? (vue.openBlock(), vue.createElementBlock("div", {
36664
36732
  key: 0,
@@ -36738,10 +36806,9 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
36738
36806
  flat: "",
36739
36807
  icon: "download",
36740
36808
  value: "Download File",
36741
- href: upgradeHeaders((_h = vue.unref(currentItem)) == null ? void 0 : _h.src),
36742
- download: ""
36743
- }, null, 8, ["href"])) : vue.createCommentVNode("", true),
36744
- !((_i = vue.unref(currentItem)) == null ? void 0 : _i.openFile) && !((_j = vue.unref(currentItem)) == null ? void 0 : _j.download) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4)) : vue.createCommentVNode("", true)
36809
+ onClick: downloadFile
36810
+ })) : vue.createCommentVNode("", true),
36811
+ !((_h = vue.unref(currentItem)) == null ? void 0 : _h.openFile) && !((_i = vue.unref(currentItem)) == null ? void 0 : _i.download) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4)) : vue.createCommentVNode("", true)
36745
36812
  ]),
36746
36813
  vue.createVNode(vue.unref(Carousel), {
36747
36814
  index: vue.unref(currentIndex),
@@ -36777,44 +36844,47 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
36777
36844
  autoplay: "",
36778
36845
  controls: "",
36779
36846
  class: "vw90"
36780
- }, null, 8, ["src"])) : (item == null ? void 0 : item.type) === "pdf" && (item == null ? void 0 : item.src) ? (vue.openBlock(), vue.createElementBlock("embed", {
36781
- key: 2,
36782
- src: vue.unref(normalizeURL)(item == null ? void 0 : item.src),
36783
- type: "application/pdf",
36784
- width: "100%",
36785
- height: "1080",
36786
- title: item == null ? void 0 : item.name,
36787
- class: "vw90"
36788
- }, null, 8, _hoisted_5)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_6, [
36789
- vue.createVNode(vue.unref(_sfc_main$u), {
36790
- class: "m-0 m_none",
36791
- icon: "draft",
36792
- size: 10,
36793
- weight: "12"
36794
- }),
36795
- vue.createVNode(vue.unref(_sfc_main$u), {
36796
- class: "m-0 none m_block m_-mb-1",
36797
- icon: "draft",
36798
- size: 4,
36799
- weight: "2"
36800
- }),
36801
- vue.createElementVNode("div", _hoisted_7, [
36802
- vue.createElementVNode("p", _hoisted_8, [
36803
- _cache[6] || (_cache[6] = vue.createTextVNode(" File: ")),
36804
- vue.createElementVNode("span", _hoisted_9, vue.toDisplayString(item == null ? void 0 : item.name), 1)
36805
- ]),
36806
- vue.createElementVNode("p", _hoisted_10, [
36807
- _cache[7] || (_cache[7] = vue.createTextVNode(" Type: ")),
36808
- vue.createElementVNode("span", _hoisted_11, vue.toDisplayString(item == null ? void 0 : item.type), 1)
36809
- ]),
36810
- vue.createVNode(vue.unref(Btn), {
36811
- href: item == null ? void 0 : item.src,
36812
- target: "_blank",
36813
- round: "",
36814
- thin: "",
36815
- class: "mt-1",
36816
- value: "Open file"
36817
- }, null, 8, ["href"])
36847
+ }, null, 8, ["src"])) : (item == null ? void 0 : item.type) === "pdf" && (item == null ? void 0 : item.src) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5, [
36848
+ vue.createElementVNode("embed", {
36849
+ src: vue.unref(normalizeURL)(item == null ? void 0 : item.src),
36850
+ type: "application/pdf",
36851
+ width: "100%",
36852
+ height: "1080",
36853
+ title: item == null ? void 0 : item.name,
36854
+ class: "vw90"
36855
+ }, null, 8, _hoisted_6)
36856
+ ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_7, [
36857
+ vue.createElementVNode("div", _hoisted_8, [
36858
+ vue.createVNode(vue.unref(_sfc_main$u), {
36859
+ class: "m-0 m_none",
36860
+ icon: "draft",
36861
+ size: 10,
36862
+ weight: "12"
36863
+ }),
36864
+ vue.createVNode(vue.unref(_sfc_main$u), {
36865
+ class: "m-0 none m_block m_-mb-1",
36866
+ icon: "draft",
36867
+ size: 4,
36868
+ weight: "2"
36869
+ }),
36870
+ vue.createElementVNode("div", _hoisted_9, [
36871
+ vue.createElementVNode("p", _hoisted_10, [
36872
+ _cache[6] || (_cache[6] = vue.createTextVNode(" File: ")),
36873
+ vue.createElementVNode("span", _hoisted_11, vue.toDisplayString(item == null ? void 0 : item.name), 1)
36874
+ ]),
36875
+ vue.createElementVNode("p", _hoisted_12, [
36876
+ _cache[7] || (_cache[7] = vue.createTextVNode(" Type: ")),
36877
+ vue.createElementVNode("span", _hoisted_13, vue.toDisplayString(item == null ? void 0 : item.type), 1)
36878
+ ]),
36879
+ vue.createVNode(vue.unref(Btn), {
36880
+ href: item == null ? void 0 : item.src,
36881
+ target: "_blank",
36882
+ round: "",
36883
+ thin: "",
36884
+ class: "mt-1",
36885
+ value: "Open file"
36886
+ }, null, 8, ["href"])
36887
+ ])
36818
36888
  ])
36819
36889
  ]))
36820
36890
  ], 64);
@@ -36822,7 +36892,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
36822
36892
  ]),
36823
36893
  _: 1
36824
36894
  }, 8, ["index", "class", "freeDrag"]),
36825
- vue.unref(group) && vue.unref(group).length > 1 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_12, [
36895
+ vue.unref(group) && vue.unref(group).length > 1 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_14, [
36826
36896
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(group), (item, index2) => {
36827
36897
  return vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: index2 }, [
36828
36898
  item.type === "image" ? (vue.openBlock(), vue.createBlock(vue.unref(Image$1), {
@@ -36849,7 +36919,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
36849
36919
  };
36850
36920
  }
36851
36921
  });
36852
- const Lightbox = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-fb2d5763"]]);
36922
+ const Lightbox = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-4789af69"]]);
36853
36923
  const groups = {};
36854
36924
  let clickHandler = (_e2) => void 0;
36855
36925
  const lightboxDirective = {
@@ -38111,6 +38181,7 @@ exports.useDebounceFn = useDebounceFn;
38111
38181
  exports.useDevice = useDevice;
38112
38182
  exports.useDraggable = useDraggable;
38113
38183
  exports.useEscape = useEscape;
38184
+ exports.useFileUpload = useFileUpload;
38114
38185
  exports.useForm = useForm;
38115
38186
  exports.useI18nT = useI18nT;
38116
38187
  exports.useLang = useLang;