@deskhero/dh_ui 1.59.3 → 1.59.5

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/dh_ui.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { reactive, ref, defineComponent, useSlots, toRef, provide, computed, onMounted, onUnmounted, watch, openBlock, createElementBlock, normalizeClass, unref, createVNode, mergeProps, isRef, createSlots, renderList, withCtx, renderSlot, normalizeProps, guardReactiveProps, createBlock, Teleport, createCommentVNode, inject, withKeys, withModifiers, Transition, createElementVNode, Fragment, normalizeStyle, createTextVNode, toDisplayString, resolveDynamicComponent, nextTick, withDirectives, vShow, onBeforeUpdate, getCurrentScope, onScopeDispose, vModelCheckbox, shallowRef, onBeforeUnmount, toRaw, h, isProxy, resolveComponent, pushScopeId, popScopeId, vModelText, useCssVars, onBeforeMount, toRefs, getCurrentInstance, vModelDynamic, onUpdated } from "vue";
1
+ import { reactive, ref, defineComponent, useSlots, toRef, provide, computed, onMounted, onUnmounted, watch, openBlock, createElementBlock, normalizeClass, unref, createVNode, mergeProps, isRef, createSlots, renderList, withCtx, renderSlot, normalizeProps, guardReactiveProps, createBlock, Teleport, createCommentVNode, inject, withKeys, withModifiers, Transition, createElementVNode, Fragment, normalizeStyle, createTextVNode, toDisplayString, resolveDynamicComponent, nextTick, withDirectives, vShow, onBeforeUpdate, getCurrentScope, onScopeDispose, vModelCheckbox, shallowRef, onBeforeUnmount, toRaw, h, isProxy, resolveComponent, pushScopeId, popScopeId, vModelText, useCssVars, toRefs, getCurrentInstance, vModelDynamic, onUpdated } from "vue";
2
2
  var main$1 = "";
3
3
  function toInteger(dirtyNumber) {
4
4
  if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
@@ -23948,7 +23948,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
23948
23948
  "loading-spinner-success": unref(isSuccess),
23949
23949
  "loading-spinner-secondary": unref(isSecondary) || unref(isGhost)
23950
23950
  }),
23951
- iconName: "loader"
23951
+ "icon-name": "loader"
23952
23952
  }, null, 8, ["class"])) : createCommentVNode("", true),
23953
23953
  !__props.loading ? (openBlock(), createElementBlock("div", _hoisted_2$k, [
23954
23954
  renderSlot(_ctx.$slots, "prepend-icon", {}, void 0, true)
@@ -23966,7 +23966,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
23966
23966
  };
23967
23967
  }
23968
23968
  });
23969
- var DhButton = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__scopeId", "data-v-1ec95209"]]);
23969
+ var DhButton = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__scopeId", "data-v-0196b518"]]);
23970
23970
  const _sfc_main$l = defineComponent({
23971
23971
  props: {
23972
23972
  target: { type: String, required: true },
@@ -24438,33 +24438,42 @@ const _hoisted_2$e = {
24438
24438
  const _hoisted_3$a = { class: "file__upload_list_item" };
24439
24439
  const _hoisted_4$8 = { class: "file__upload_list_item_label" };
24440
24440
  const _hoisted_5$4 = ["title"];
24441
- const _hoisted_6$4 = {
24441
+ const _hoisted_6$4 = /* @__PURE__ */ createElementVNode("br", null, null, -1);
24442
+ const _hoisted_7$3 = ["href"];
24443
+ const _hoisted_8$1 = {
24444
+ key: 1,
24445
+ class: "file__upload_items"
24446
+ };
24447
+ const _hoisted_9$1 = { class: "file__upload_list_item" };
24448
+ const _hoisted_10$1 = { class: "file__upload_list_item_label" };
24449
+ const _hoisted_11$1 = ["title"];
24450
+ const _hoisted_12$1 = {
24442
24451
  key: 0,
24443
24452
  class: "label__antivirus"
24444
24453
  };
24445
- const _hoisted_7$3 = {
24454
+ const _hoisted_13$1 = {
24446
24455
  key: 1,
24447
24456
  class: "label__antivirus label__antivirus--failed"
24448
24457
  };
24449
- const _hoisted_8$1 = {
24458
+ const _hoisted_14$1 = {
24450
24459
  key: 2,
24451
24460
  class: "label__antivirus label__antivirus--detected"
24452
24461
  };
24453
- const _hoisted_9$1 = /* @__PURE__ */ createElementVNode("br", null, null, -1);
24454
- const _hoisted_10$1 = { key: 3 };
24455
- const _hoisted_11$1 = { key: 4 };
24456
- const _hoisted_12$1 = { key: 0 };
24457
- const _hoisted_13$1 = ["value"];
24458
- const _hoisted_14$1 = ["href"];
24459
- const _hoisted_15$1 = {
24460
- key: 1,
24462
+ const _hoisted_15$1 = /* @__PURE__ */ createElementVNode("br", null, null, -1);
24463
+ const _hoisted_16$1 = { key: 3 };
24464
+ const _hoisted_17$1 = { key: 4 };
24465
+ const _hoisted_18$1 = { key: 0 };
24466
+ const _hoisted_19$1 = ["value"];
24467
+ const _hoisted_20$1 = ["href"];
24468
+ const _hoisted_21 = {
24469
+ key: 2,
24461
24470
  class: "file__upload_placeholder"
24462
24471
  };
24463
- const _hoisted_16$1 = {
24464
- key: 2,
24472
+ const _hoisted_22 = {
24473
+ key: 3,
24465
24474
  class: "file__upload_action"
24466
24475
  };
24467
- const _hoisted_17$1 = /* @__PURE__ */ createElementVNode("button", { class: "file__upload_action_cancel" }, "Cancel", -1);
24476
+ const _hoisted_23 = /* @__PURE__ */ createElementVNode("button", { class: "file__upload_action_cancel" }, "Cancel", -1);
24468
24477
  const _sfc_main$e = {
24469
24478
  __name: "FileUpload",
24470
24479
  props: {
@@ -24569,6 +24578,7 @@ const _sfc_main$e = {
24569
24578
  const upload = ref(null);
24570
24579
  const fileSelected = ref(false);
24571
24580
  const files = ref([]);
24581
+ const deletedItems = ref([]);
24572
24582
  const standardFormats = ref([
24573
24583
  ".pdf",
24574
24584
  ".csv",
@@ -24589,6 +24599,15 @@ const _sfc_main$e = {
24589
24599
  const i2 = Math.floor(Math.log(bytes) / Math.log(k2));
24590
24600
  return `${parseFloat((bytes / Math.pow(k2, i2)).toFixed(dm))} ${sizes[i2]}`;
24591
24601
  }
24602
+ function formatKilobytes(kilobytes, decimals = 2) {
24603
+ if (!+kilobytes)
24604
+ return "0 KB";
24605
+ const k2 = 1024;
24606
+ const dm = decimals < 0 ? 0 : decimals;
24607
+ const sizes = ["KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
24608
+ const i2 = Math.floor(Math.log(kilobytes) / Math.log(k2));
24609
+ return `${parseFloat((kilobytes / Math.pow(k2, i2)).toFixed(dm))} ${sizes[i2]}`;
24610
+ }
24592
24611
  function iconName(x2) {
24593
24612
  return standardFormats.value.includes(getExtension(x2)) ? getExtension(x2).slice(1) : "unknown";
24594
24613
  }
@@ -24629,6 +24648,15 @@ const _sfc_main$e = {
24629
24648
  removeFile(index);
24630
24649
  }
24631
24650
  }
24651
+ function deleteFileItem(id) {
24652
+ if (window.confirm(props.deleteConfirmationText)) {
24653
+ removeFileItem(id);
24654
+ }
24655
+ }
24656
+ function removeFileItem(id) {
24657
+ deletedItems.value.push(id);
24658
+ saveFile();
24659
+ }
24632
24660
  function removeFile(index) {
24633
24661
  const dt = new DataTransfer();
24634
24662
  for (let i2 = 0; i2 < files.value.length; i2++) {
@@ -24642,10 +24670,7 @@ const _sfc_main$e = {
24642
24670
  }
24643
24671
  }
24644
24672
  function saveFile() {
24645
- if (files.value.length) {
24646
- console.log(files.value);
24647
- emit("save:modelValue", files.value);
24648
- }
24673
+ emit("save:modelValue", files.value, props.fileList, deletedItems.value);
24649
24674
  }
24650
24675
  function generateLink(file) {
24651
24676
  return URL.createObjectURL(file);
@@ -24654,13 +24679,6 @@ const _sfc_main$e = {
24654
24679
  e2.preventDefault();
24655
24680
  emit("reload");
24656
24681
  }
24657
- onBeforeMount(() => {
24658
- if (props.fileList.length) {
24659
- files.value = props.fileList;
24660
- fileSelected.value = true;
24661
- saveFile();
24662
- }
24663
- });
24664
24682
  return (_ctx, _cache) => {
24665
24683
  return openBlock(), createElementBlock("div", {
24666
24684
  class: normalizeClass(["file__upload", {
@@ -24690,7 +24708,48 @@ const _sfc_main$e = {
24690
24708
  onInput: _cache[0] || (_cache[0] = ($event) => uploadFile($event))
24691
24709
  }, null, 544)
24692
24710
  ], 32),
24693
- fileSelected.value ? (openBlock(), createElementBlock("div", _hoisted_2$e, [
24711
+ __props.fileList.length ? (openBlock(), createElementBlock("div", _hoisted_2$e, [
24712
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.fileList, (file) => {
24713
+ return openBlock(), createElementBlock("div", {
24714
+ key: file.id,
24715
+ class: normalizeClass(["file__upload_list", __props.inline ? "" : "file__upload_list_box"])
24716
+ }, [
24717
+ createVNode(DhIcon, {
24718
+ "icon-name": `file-` + iconName(file.label),
24719
+ size: 40
24720
+ }, null, 8, ["icon-name"]),
24721
+ createElementVNode("div", _hoisted_3$a, [
24722
+ createElementVNode("div", _hoisted_4$8, [
24723
+ createElementVNode("div", null, [
24724
+ createElementVNode("span", {
24725
+ title: file.label
24726
+ }, toDisplayString(getName(file.label)) + toDisplayString(getExtension(file.label)), 9, _hoisted_5$4),
24727
+ _hoisted_6$4,
24728
+ createElementVNode("span", null, toDisplayString(formatKilobytes(file.size_kb)), 1)
24729
+ ])
24730
+ ])
24731
+ ]),
24732
+ createElementVNode("a", {
24733
+ class: "file__upload_list_download",
24734
+ download: "",
24735
+ href: file.download_url
24736
+ }, [
24737
+ createVNode(DhIcon, {
24738
+ class: "file__upload_list_download_icon",
24739
+ "icon-name": "download",
24740
+ size: 24
24741
+ })
24742
+ ], 8, _hoisted_7$3),
24743
+ createVNode(DhIcon, {
24744
+ class: "file__upload_list_delete",
24745
+ "icon-name": "delete",
24746
+ size: 24,
24747
+ onClick: ($event) => deleteFileItem(file.id)
24748
+ }, null, 8, ["onClick"])
24749
+ ], 2);
24750
+ }), 128))
24751
+ ])) : createCommentVNode("", true),
24752
+ fileSelected.value ? (openBlock(), createElementBlock("div", _hoisted_8$1, [
24694
24753
  (openBlock(true), createElementBlock(Fragment, null, renderList(files.value, (file, id) => {
24695
24754
  return openBlock(), createElementBlock("div", {
24696
24755
  key: id,
@@ -24729,13 +24788,13 @@ const _sfc_main$e = {
24729
24788
  size: 20,
24730
24789
  style: normalizeStyle({ "z-index": props.zIndex })
24731
24790
  }, null, 8, ["style"])) : createCommentVNode("", true),
24732
- createElementVNode("div", _hoisted_3$a, [
24733
- createElementVNode("div", _hoisted_4$8, [
24791
+ createElementVNode("div", _hoisted_9$1, [
24792
+ createElementVNode("div", _hoisted_10$1, [
24734
24793
  createElementVNode("div", null, [
24735
24794
  createElementVNode("span", {
24736
24795
  title: file.name
24737
- }, toDisplayString(getName(file.name)) + toDisplayString(getExtension(file.name)), 9, _hoisted_5$4),
24738
- props.uploadProgress[id] == 100 && __props.fileSaved && !__props.errorOccurred[id] && __props.virusCheck[id] == "loading" ? (openBlock(), createElementBlock("span", _hoisted_6$4, [
24796
+ }, toDisplayString(getName(file.name)) + toDisplayString(getExtension(file.name)), 9, _hoisted_11$1),
24797
+ props.uploadProgress[id] == 100 && __props.fileSaved && !__props.errorOccurred[id] && __props.virusCheck[id] == "loading" ? (openBlock(), createElementBlock("span", _hoisted_12$1, [
24739
24798
  createTextVNode(toDisplayString(__props.virusCheckText) + " ", 1),
24740
24799
  createVNode(DhIcon, {
24741
24800
  class: "file__upload_list_icon_sub--loading",
@@ -24743,20 +24802,20 @@ const _sfc_main$e = {
24743
24802
  size: 18
24744
24803
  })
24745
24804
  ])) : createCommentVNode("", true),
24746
- props.uploadProgress[id] == 100 && __props.fileSaved && __props.virusCheck[id] == "failed" ? (openBlock(), createElementBlock("span", _hoisted_7$3, toDisplayString(__props.virusCheckFailedText), 1)) : createCommentVNode("", true),
24747
- props.uploadProgress[id] == 100 && __props.fileSaved && __props.virusCheck[id] == "detected" ? (openBlock(), createElementBlock("span", _hoisted_8$1, toDisplayString(__props.virusDetectedText), 1)) : createCommentVNode("", true),
24748
- _hoisted_9$1,
24749
- __props.fileSaved && !__props.errorOccurred[id] || !__props.errorOccurred[id] && __props.virusCheck[id] ? (openBlock(), createElementBlock("span", _hoisted_10$1, toDisplayString(formatBytes(file.size)), 1)) : createCommentVNode("", true),
24750
- __props.fileSaved && __props.errorOccurred[id] ? (openBlock(), createElementBlock("span", _hoisted_11$1, toDisplayString(__props.errorMessage), 1)) : createCommentVNode("", true)
24805
+ props.uploadProgress[id] == 100 && __props.fileSaved && __props.virusCheck[id] == "failed" ? (openBlock(), createElementBlock("span", _hoisted_13$1, toDisplayString(__props.virusCheckFailedText), 1)) : createCommentVNode("", true),
24806
+ props.uploadProgress[id] == 100 && __props.fileSaved && __props.virusCheck[id] == "detected" ? (openBlock(), createElementBlock("span", _hoisted_14$1, toDisplayString(__props.virusDetectedText), 1)) : createCommentVNode("", true),
24807
+ _hoisted_15$1,
24808
+ __props.fileSaved && !__props.errorOccurred[id] || !__props.errorOccurred[id] && __props.virusCheck[id] ? (openBlock(), createElementBlock("span", _hoisted_16$1, toDisplayString(formatBytes(file.size)), 1)) : createCommentVNode("", true),
24809
+ __props.fileSaved && __props.errorOccurred[id] ? (openBlock(), createElementBlock("span", _hoisted_17$1, toDisplayString(__props.errorMessage), 1)) : createCommentVNode("", true)
24751
24810
  ]),
24752
- !__props.fileSaved ? (openBlock(), createElementBlock("span", _hoisted_12$1, toDisplayString(props.uploadProgress[id]) + "%", 1)) : createCommentVNode("", true)
24811
+ !__props.fileSaved ? (openBlock(), createElementBlock("span", _hoisted_18$1, toDisplayString(props.uploadProgress[id]) + "%", 1)) : createCommentVNode("", true)
24753
24812
  ]),
24754
24813
  !__props.fileSaved ? (openBlock(), createElementBlock("progress", {
24755
24814
  key: 0,
24756
24815
  id: "file",
24757
24816
  max: "100",
24758
24817
  value: props.uploadProgress[id]
24759
- }, toDisplayString(props.uploadProgress[id]) + "% ", 9, _hoisted_13$1)) : createCommentVNode("", true)
24818
+ }, toDisplayString(props.uploadProgress[id]) + "% ", 9, _hoisted_19$1)) : createCommentVNode("", true)
24760
24819
  ]),
24761
24820
  __props.fileSaved && !__props.virusCheck[id] && !__props.errorOccurred[id] ? (openBlock(), createElementBlock("a", {
24762
24821
  key: 4,
@@ -24769,7 +24828,7 @@ const _sfc_main$e = {
24769
24828
  "icon-name": "download",
24770
24829
  size: 24
24771
24830
  })
24772
- ], 8, _hoisted_14$1)) : createCommentVNode("", true),
24831
+ ], 8, _hoisted_20$1)) : createCommentVNode("", true),
24773
24832
  __props.fileSaved && __props.errorOccurred[id] ? (openBlock(), createElementBlock("a", {
24774
24833
  key: 5,
24775
24834
  class: "file__upload_list_retry",
@@ -24797,9 +24856,9 @@ const _sfc_main$e = {
24797
24856
  ], 2);
24798
24857
  }), 128))
24799
24858
  ])) : createCommentVNode("", true),
24800
- !fileSelected.value && !__props.inline ? (openBlock(), createElementBlock("div", _hoisted_15$1, " No file selected ")) : createCommentVNode("", true),
24801
- !__props.inline && !__props.fileSaved ? (openBlock(), createElementBlock("div", _hoisted_16$1, [
24802
- _hoisted_17$1,
24859
+ !fileSelected.value && !__props.inline && !__props.fileList.length ? (openBlock(), createElementBlock("div", _hoisted_21, " No file selected ")) : createCommentVNode("", true),
24860
+ !__props.inline && !__props.fileSaved ? (openBlock(), createElementBlock("div", _hoisted_22, [
24861
+ _hoisted_23,
24803
24862
  createElementVNode("button", {
24804
24863
  class: normalizeClass([
24805
24864
  "file__upload_action_done",
@@ -43568,7 +43627,7 @@ class FileTool {
43568
43627
  name.classList.add("file__result_name");
43569
43628
  name.href = fileLink;
43570
43629
  name.innerHTML = fileId.toString();
43571
- name.download = fileId.toString();
43630
+ name.target = "_blank";
43572
43631
  result.appendChild(img);
43573
43632
  result.appendChild(name);
43574
43633
  return result;
@@ -46842,8 +46901,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
46842
46901
  createVNode(DhButton, {
46843
46902
  color: "primary",
46844
46903
  size: "small",
46845
- onClick: _cache[0] || (_cache[0] = withModifiers(($event) => crop2(), ["prevent"])),
46846
- style: { "display": "block", "margin-top": "30px" }
46904
+ style: { "display": "block", "margin-top": "30px" },
46905
+ onClick: _cache[0] || (_cache[0] = withModifiers(($event) => crop2(), ["prevent"]))
46847
46906
  }, {
46848
46907
  default: withCtx(() => [
46849
46908
  _hoisted_2