@qynpm/ui 1.0.34 → 1.0.36

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 (126) hide show
  1. package/README.md +91 -56
  2. package/dist/index.cjs +7 -6
  3. package/dist/index.mjs +63 -61
  4. package/dist/qy-action-bar/index.cjs +1 -1
  5. package/dist/qy-action-bar/index.mjs +1 -1
  6. package/dist/qy-dialog/index.cjs +1 -1
  7. package/dist/qy-dialog/index.mjs +1 -1
  8. package/dist/qy-drawer/index.cjs +1 -1
  9. package/dist/qy-drawer/index.mjs +1 -1
  10. package/dist/qy-file-picker/index.cjs +1 -1
  11. package/dist/qy-file-picker/index.mjs +1 -1
  12. package/dist/qy-form-section/index.cjs +1 -1
  13. package/dist/qy-form-section/index.mjs +1 -1
  14. package/dist/qy-iframe/index.cjs +1 -1
  15. package/dist/qy-iframe/index.mjs +1 -1
  16. package/dist/qy-image/index.cjs +1 -1
  17. package/dist/qy-image/index.mjs +1 -1
  18. package/dist/qy-image-preview/index.cjs +1 -1
  19. package/dist/qy-image-preview/index.mjs +2 -2
  20. package/dist/qy-image-upload/index.cjs +1 -1
  21. package/dist/qy-image-upload/index.mjs +1 -1
  22. package/dist/qy-input-number/index.cjs +1 -1
  23. package/dist/qy-input-number/index.mjs +1 -1
  24. package/dist/qy-input-tag/index.cjs +1 -0
  25. package/dist/qy-input-tag/index.mjs +7 -0
  26. package/dist/qy-legacy-selection-dialog/index.cjs +1 -1
  27. package/dist/qy-legacy-selection-dialog/index.mjs +1 -1
  28. package/dist/qy-menu-actions/index.cjs +1 -1
  29. package/dist/qy-menu-actions/index.mjs +1 -1
  30. package/dist/qy-money-input/index.cjs +1 -1
  31. package/dist/qy-money-input/index.mjs +5 -2
  32. package/dist/qy-popover/index.cjs +1 -1
  33. package/dist/qy-popover/index.mjs +1 -1
  34. package/dist/qy-record-quote-search/index.cjs +1 -1
  35. package/dist/qy-record-quote-search/index.mjs +1 -1
  36. package/dist/qy-remark-image/index.cjs +1 -1
  37. package/dist/qy-remark-image/index.mjs +1 -1
  38. package/dist/qy-remote-select/index.cjs +1 -1
  39. package/dist/qy-remote-select/index.mjs +1 -1
  40. package/dist/qy-search-input/index.cjs +1 -1
  41. package/dist/qy-search-input/index.mjs +1 -1
  42. package/dist/qy-selection-dialog/index.cjs +1 -1
  43. package/dist/qy-selection-dialog/index.mjs +1 -1
  44. package/dist/qy-tree-select/index.cjs +1 -1
  45. package/dist/qy-tree-select/index.mjs +1 -1
  46. package/dist/qy-upload/index.cjs +1 -1
  47. package/dist/qy-upload/index.mjs +5 -2
  48. package/dist/shared/{index-IXbvJ9d7.mjs → index-4SkLDBra.mjs} +1 -1
  49. package/dist/shared/index-BYX0biqw.mjs +766 -0
  50. package/dist/shared/{index-n04hARNG.cjs → index-Bli6Gx5d.cjs} +1 -1
  51. package/dist/shared/{index-BBZQowyp.mjs → index-BuUtJrIy.mjs} +9 -9
  52. package/dist/shared/index-BxxwEr52.mjs +107 -0
  53. package/dist/shared/index-C1i-hd-W.cjs +1 -0
  54. package/dist/shared/{index-Dyyp1ix9.cjs → index-C7lRQtzs.cjs} +1 -1
  55. package/dist/shared/{index-C_adKysL.mjs → index-CdnHMuo3.mjs} +1 -1
  56. package/dist/shared/index-D654b42n.mjs +2754 -0
  57. package/dist/shared/{index-D6-K5xSD.cjs → index-DlGwHshu.cjs} +1 -1
  58. package/dist/shared/{index-BeubtXXl.cjs → index-DnHfk7NM.cjs} +1 -1
  59. package/dist/shared/index-DnNIseRJ.cjs +1 -0
  60. package/dist/shared/{index-ccugL1Ie.mjs → index-Dr-Q5krU.mjs} +4 -4
  61. package/dist/shared/index-aIqtIYsu.cjs +1 -0
  62. package/dist/shared/index.vue_vue_type_script_setup_true_lang-BiIgNax-.cjs +1 -0
  63. package/dist/shared/index.vue_vue_type_script_setup_true_lang-CqSJ_8hG.cjs +1 -0
  64. package/dist/shared/index.vue_vue_type_script_setup_true_lang-DIWWHODS.mjs +197 -0
  65. package/dist/shared/index.vue_vue_type_script_setup_true_lang-DwFGEW4B.mjs +143 -0
  66. package/dist/shared/{index.vue_vue_type_script_setup_true_lang-DoL8xnpo.mjs → index.vue_vue_type_script_setup_true_lang-IyZesuKm.mjs} +9 -9
  67. package/dist/shared/index.vue_vue_type_script_setup_true_lang-ccFLNRry.cjs +1 -0
  68. package/dist/shared/index.vue_vue_type_style_index_0_lang-B1FgJZbw.mjs +148 -0
  69. package/dist/shared/index.vue_vue_type_style_index_0_lang-DHK86rdP.cjs +1 -0
  70. package/dist/shared/index.vue_vue_type_style_index_0_lang-DVXf-yUs.cjs +1 -0
  71. package/dist/shared/{index.vue_vue_type_style_index_0_lang-BJXS2dVf.mjs → index.vue_vue_type_style_index_0_lang-DsOg_Rum.mjs} +19 -17
  72. package/dist/shared/utils-BjEXwY3L.cjs +1 -0
  73. package/dist/shared/utils-DoyI5oM8.mjs +148 -0
  74. package/index.d.ts +113 -56
  75. package/package.json +489 -483
  76. package/qy-alert/index.d.ts +64 -64
  77. package/qy-autocomplete/index.d.ts +5 -5
  78. package/qy-avatar/index.d.ts +67 -67
  79. package/qy-badge/index.d.ts +63 -63
  80. package/qy-card/index.d.ts +64 -64
  81. package/qy-cascader/index.d.ts +198 -198
  82. package/qy-collapse/index.d.ts +59 -59
  83. package/qy-collapse-item/index.d.ts +45 -45
  84. package/qy-descriptions/index.d.ts +47 -47
  85. package/qy-descriptions-item/index.d.ts +46 -46
  86. package/qy-dialog/index.d.ts +63 -63
  87. package/qy-divider/index.d.ts +53 -53
  88. package/qy-drawer/index.d.ts +55 -55
  89. package/qy-empty/index.d.ts +51 -51
  90. package/qy-file-picker/index.d.ts +4 -1
  91. package/qy-iframe/index.d.ts +66 -66
  92. package/qy-image/index.d.ts +28 -28
  93. package/qy-image-preview/index.d.ts +20 -20
  94. package/qy-image-upload/index.d.ts +69 -12
  95. package/qy-input/index.d.ts +76 -18
  96. package/qy-input-number/index.d.ts +64 -30
  97. package/qy-input-tag/index.d.ts +69 -0
  98. package/qy-link/index.d.ts +69 -69
  99. package/qy-loading/index.d.ts +25 -25
  100. package/qy-menu-actions/index.d.ts +29 -29
  101. package/qy-money-input/index.d.ts +87 -12
  102. package/qy-progress/index.d.ts +74 -74
  103. package/qy-result/index.d.ts +64 -64
  104. package/qy-scrollbar/index.d.ts +85 -85
  105. package/qy-skeleton/index.d.ts +54 -54
  106. package/qy-skeleton-item/index.d.ts +48 -48
  107. package/qy-step/index.d.ts +55 -55
  108. package/qy-steps/index.d.ts +62 -62
  109. package/qy-tab-pane/index.d.ts +40 -40
  110. package/qy-table-column-settings/index.d.ts +18 -18
  111. package/qy-tabs/index.d.ts +84 -84
  112. package/qy-tree/index.d.ts +132 -132
  113. package/qy-tree-select/index.d.ts +123 -123
  114. package/qy-upload/index.d.ts +99 -5
  115. package/dist/shared/index-BkX9xlbI.cjs +0 -1
  116. package/dist/shared/index-C_1KP3l9.mjs +0 -129
  117. package/dist/shared/index-Dw5upK-A.cjs +0 -1
  118. package/dist/shared/index-fh9l84rU.mjs +0 -3541
  119. package/dist/shared/index.vue_vue_type_script_setup_true_lang-5gku7Zwv.cjs +0 -1
  120. package/dist/shared/index.vue_vue_type_style_index_0_lang-B0CXLnL1.mjs +0 -132
  121. package/dist/shared/index.vue_vue_type_style_index_0_lang-DccRGtZE.cjs +0 -1
  122. package/dist/shared/index.vue_vue_type_style_index_0_lang-M0qKRXd2.cjs +0 -1
  123. package/dist/shared/utils-D2KAQCCB.cjs +0 -1
  124. package/dist/shared/utils-DUntDntI.mjs +0 -112
  125. /package/dist/shared/{index.vue_vue_type_script_setup_true_lang-q37rBg6Z.mjs → index.vue_vue_type_script_setup_true_lang-CGsXVhJy.mjs} +0 -0
  126. /package/dist/shared/{index.vue_vue_type_script_setup_true_lang-CglCPcj-.cjs → index.vue_vue_type_script_setup_true_lang-Dk83TGiU.cjs} +0 -0
@@ -1 +0,0 @@
1
- "use strict";const e=require("vue"),c=require("element-plus"),s=require("./utils-D2KAQCCB.cjs"),m=e.defineComponent({name:"QyImagePreview",__name:"index",props:{open:{type:Boolean,default:!1},urlList:{default:()=>[]},initialIndex:{default:0},hideOnClickModal:{type:Boolean,default:!0}},emits:["update:open","close"],setup(n,{emit:a}){const l=n,i=a;let r="";const u=e.computed(()=>l.urlList.map(o=>s.normalizeImageSrc(o)).filter(Boolean));e.watch(()=>l.open,o=>{if(o){r=document.body.style.overflow,document.body.style.overflow="hidden";return}t()}),e.onBeforeUnmount(t);function d(){t(),i("update:open",!1),i("close")}function t(){typeof document>"u"||(document.body.style.overflow=r)}return(o,f)=>n.open&&u.value.length?(e.openBlock(),e.createBlock(e.unref(c.ElImageViewer),{key:0,"url-list":u.value,"initial-index":n.initialIndex,"hide-on-click-modal":n.hideOnClickModal,teleport:"body",onClose:d},null,8,["url-list","initial-index","hide-on-click-modal"])):e.createCommentVNode("",!0)}});exports._sfc_main=m;
@@ -1,132 +0,0 @@
1
- import { defineComponent as p, useAttrs as x, computed as B, ref as g, openBlock as $, createBlock as k, unref as C, mergeProps as S, createSlots as V, withCtx as l, renderSlot as i } from "vue";
2
- import { ElInputNumber as z } from "element-plus";
3
- const N = /* @__PURE__ */ p({
4
- name: "QyInputNumber",
5
- inheritAttrs: !1,
6
- __name: "index",
7
- props: {
8
- id: {},
9
- step: { default: 1 },
10
- stepStrictly: { type: Boolean, default: !1 },
11
- max: { default: void 0 },
12
- min: { default: void 0 },
13
- readonly: { type: Boolean, default: !1 },
14
- disabled: { type: Boolean, default: !1 },
15
- controls: { type: Boolean, default: !0 },
16
- name: {},
17
- placeholder: { default: "请输入数字" },
18
- precision: { default: void 0 },
19
- validateEvent: { type: Boolean },
20
- ariaLabel: {},
21
- inputmode: {},
22
- align: {},
23
- disabledScientific: { type: Boolean },
24
- formatter: {},
25
- parser: {},
26
- tabindex: {},
27
- modelValue: { default: void 0 },
28
- valueOnClear: { default: null },
29
- controlsPosition: { default: "" },
30
- size: { default: void 0 }
31
- },
32
- emits: ["update:modelValue", "input", "change", "focus", "blur"],
33
- setup(a, { expose: d, emit: s }) {
34
- const n = s, u = x(), r = B(
35
- () => Object.fromEntries(
36
- Object.entries(u).filter(([e]) => !e.startsWith("on"))
37
- )
38
- ), o = g(null);
39
- function c(e) {
40
- n("update:modelValue", e);
41
- }
42
- function f(e) {
43
- n("input", e);
44
- }
45
- function m(e, t) {
46
- n("change", e, t);
47
- }
48
- function b(e) {
49
- n("focus", e);
50
- }
51
- function v(e) {
52
- n("blur", e);
53
- }
54
- function y() {
55
- var e, t;
56
- (t = (e = o.value) == null ? void 0 : e.focus) == null || t.call(e);
57
- }
58
- function h() {
59
- var e, t;
60
- (t = (e = o.value) == null ? void 0 : e.blur) == null || t.call(e);
61
- }
62
- return d({
63
- focus: y,
64
- blur: h
65
- }), (e, t) => ($(), k(C(z), S({
66
- ref_key: "inputNumberRef",
67
- ref: o
68
- }, r.value, {
69
- class: "qy-input-number",
70
- "model-value": a.modelValue,
71
- min: a.min,
72
- max: a.max,
73
- step: a.step,
74
- "step-strictly": a.stepStrictly,
75
- precision: a.precision,
76
- controls: a.controls,
77
- "controls-position": a.controlsPosition,
78
- placeholder: a.placeholder,
79
- disabled: a.disabled,
80
- readonly: a.readonly,
81
- size: a.size,
82
- "value-on-clear": a.valueOnClear,
83
- formatter: a.formatter,
84
- parser: a.parser,
85
- inputmode: a.inputmode,
86
- align: a.align,
87
- "disabled-scientific": a.disabledScientific,
88
- "validate-event": a.validateEvent,
89
- id: a.id,
90
- name: a.name,
91
- "aria-label": a.ariaLabel,
92
- tabindex: a.tabindex,
93
- "onUpdate:modelValue": c,
94
- onInput: f,
95
- onChange: m,
96
- onFocus: b,
97
- onBlur: v
98
- }), V({ _: 2 }, [
99
- e.$slots.prefix ? {
100
- name: "prefix",
101
- fn: l(() => [
102
- i(e.$slots, "prefix")
103
- ]),
104
- key: "0"
105
- } : void 0,
106
- e.$slots.suffix ? {
107
- name: "suffix",
108
- fn: l(() => [
109
- i(e.$slots, "suffix")
110
- ]),
111
- key: "1"
112
- } : void 0,
113
- e.$slots["increase-icon"] ? {
114
- name: "increase-icon",
115
- fn: l(() => [
116
- i(e.$slots, "increase-icon")
117
- ]),
118
- key: "2"
119
- } : void 0,
120
- e.$slots["decrease-icon"] ? {
121
- name: "decrease-icon",
122
- fn: l(() => [
123
- i(e.$slots, "decrease-icon")
124
- ]),
125
- key: "3"
126
- } : void 0
127
- ]), 1040, ["model-value", "min", "max", "step", "step-strictly", "precision", "controls", "controls-position", "placeholder", "disabled", "readonly", "size", "value-on-clear", "formatter", "parser", "inputmode", "align", "disabled-scientific", "validate-event", "id", "name", "aria-label", "tabindex"]));
128
- }
129
- });
130
- export {
131
- N as _
132
- };
@@ -1 +0,0 @@
1
- "use strict";const n=require("vue"),h=require("element-plus"),p=n.defineComponent({name:"QyInputNumber",inheritAttrs:!1,__name:"index",props:{id:{},step:{default:1},stepStrictly:{type:Boolean,default:!1},max:{default:void 0},min:{default:void 0},readonly:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},controls:{type:Boolean,default:!0},name:{},placeholder:{default:"请输入数字"},precision:{default:void 0},validateEvent:{type:Boolean},ariaLabel:{},inputmode:{},align:{},disabledScientific:{type:Boolean},formatter:{},parser:{},tabindex:{},modelValue:{default:void 0},valueOnClear:{default:null},controlsPosition:{default:""},size:{default:void 0}},emits:["update:modelValue","input","change","focus","blur"],setup(t,{expose:o,emit:d}){const l=d,s=n.useAttrs(),r=n.computed(()=>Object.fromEntries(Object.entries(s).filter(([e])=>!e.startsWith("on")))),i=n.ref(null);function u(e){l("update:modelValue",e)}function c(e){l("input",e)}function f(e,a){l("change",e,a)}function m(e){l("focus",e)}function b(e){l("blur",e)}function v(){var e,a;(a=(e=i.value)==null?void 0:e.focus)==null||a.call(e)}function y(){var e,a;(a=(e=i.value)==null?void 0:e.blur)==null||a.call(e)}return o({focus:v,blur:y}),(e,a)=>(n.openBlock(),n.createBlock(n.unref(h.ElInputNumber),n.mergeProps({ref_key:"inputNumberRef",ref:i},r.value,{class:"qy-input-number","model-value":t.modelValue,min:t.min,max:t.max,step:t.step,"step-strictly":t.stepStrictly,precision:t.precision,controls:t.controls,"controls-position":t.controlsPosition,placeholder:t.placeholder,disabled:t.disabled,readonly:t.readonly,size:t.size,"value-on-clear":t.valueOnClear,formatter:t.formatter,parser:t.parser,inputmode:t.inputmode,align:t.align,"disabled-scientific":t.disabledScientific,"validate-event":t.validateEvent,id:t.id,name:t.name,"aria-label":t.ariaLabel,tabindex:t.tabindex,"onUpdate:modelValue":u,onInput:c,onChange:f,onFocus:m,onBlur:b}),n.createSlots({_:2},[e.$slots.prefix?{name:"prefix",fn:n.withCtx(()=>[n.renderSlot(e.$slots,"prefix")]),key:"0"}:void 0,e.$slots.suffix?{name:"suffix",fn:n.withCtx(()=>[n.renderSlot(e.$slots,"suffix")]),key:"1"}:void 0,e.$slots["increase-icon"]?{name:"increase-icon",fn:n.withCtx(()=>[n.renderSlot(e.$slots,"increase-icon")]),key:"2"}:void 0,e.$slots["decrease-icon"]?{name:"decrease-icon",fn:n.withCtx(()=>[n.renderSlot(e.$slots,"decrease-icon")]),key:"3"}:void 0]),1040,["model-value","min","max","step","step-strictly","precision","controls","controls-position","placeholder","disabled","readonly","size","value-on-clear","formatter","parser","inputmode","align","disabled-scientific","validate-event","id","name","aria-label","tabindex"]))}});exports._sfc_main=p;
@@ -1 +0,0 @@
1
- "use strict";const t=require("vue"),P=require("element-plus"),K=1e3,O=t.defineComponent({name:"QyPopover",inheritAttrs:!1,__name:"index",props:{trigger:{type:String,default:"click"},placement:{type:String,default:"bottom"},effect:{type:String,default:"light"},width:{type:[Number,String],default:240},offset:{type:Number,default:12},showDelay:{type:Number,default:0},hideDelay:{type:Number,default:200},showArrow:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},open:{type:Boolean,default:void 0}},emits:["update:open","open-change","open","close"],setup(r,{expose:B,emit:E}){const n=r,d=E,i=t.computed(()=>n.open!==void 0),v=i.value&&n.open===!0&&!n.disabled,f=t.ref(v),u=t.ref(v),h=t.ref(v),a=t.ref(null),y=t.computed(()=>n.disabled?!1:i.value?n.open===!0:f.value);let o,c=!1,s;const b=t.computed(()=>typeof n.width=="number"?`${n.width}px`:n.width),T=t.computed(()=>({"--qy-popover-width":b.value,"--qy-popover-mobile-gutter":"24px"})),m=t.useSlots(),q=t.computed(()=>{var e;return((e=m.reference)==null?void 0:e.call(m))??[]});function w(){o&&(clearTimeout(o),o=void 0),a.value=null}function C(e){o&&clearTimeout(o),o=setTimeout(()=>{o=void 0,a.value===e&&(a.value=null)},K)}function l(){if(c)return;const e=y.value;u.value!==e&&(c=!0,s=e,u.value=e)}function p(e){if(!(e&&n.disabled)){if(!i.value){if(f.value===e)return;f.value=e,d("update:open",e),l();return}a.value!==e&&(a.value===null&&n.open===e||(a.value=e,e?C(e):o&&(clearTimeout(o),o=void 0),d("update:open",e),l()))}}function g(e){e===u.value&&(!c||s!==e||(c=!1,s=void 0,e!==h.value&&(h.value=e,a.value===e&&w(),d("open-change",e),d(e?"open":"close"),l())))}function L(e){p(e),l()}function N(){g(!0)}function S(){g(!1)}function W(){p(!1)}function k(e){e.key!=="Escape"&&e.code!=="Escape"||u.value&&(e.preventDefault(),p(!1),l())}return t.watch(y,()=>l()),t.watch(i,e=>{w(),e?f.value=n.open===!0:f.value=u.value,l()}),t.watch(()=>n.open,(e,A)=>{!i.value||a.value===null||(e===a.value||e!==A)&&w()}),t.watch(()=>n.disabled,e=>{e?p(!1):l()}),t.onBeforeUnmount(()=>{window.removeEventListener("keydown",k),c=!1,s=void 0,o&&clearTimeout(o)}),t.onMounted(()=>{window.addEventListener("keydown",k)}),B({close:W}),(e,A)=>(t.openBlock(),t.createBlock(t.unref(P.ElPopover),{visible:u.value,trigger:r.trigger,placement:r.placement,effect:r.effect,width:r.width,offset:r.offset,"show-after":r.showDelay,"hide-after":r.hideDelay,"show-arrow":r.showArrow,disabled:r.disabled,enterable:!0,"popper-style":T.value,"popper-class":"qy-popover-popper","onUpdate:visible":L,onAfterEnter:N,onAfterLeave:S},{reference:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(q.value,(D,I)=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(D),{key:D.key??I}))),128))]),default:t.withCtx(()=>[t.renderSlot(e.$slots,"default")]),_:3},8,["visible","trigger","placement","effect","width","offset","show-after","hide-after","show-arrow","disabled","popper-style"]))}});exports._sfc_main=O;
@@ -1 +0,0 @@
1
- "use strict";const u=require("vue"),m=require("element-plus"),f={w:200,h:200,q:50};function l(t){const r=String(t||"").trim();return r?r.includes("ys.diansan.com")?r.replace(/^http:\/\//,"https://").replace("ys.diansan.com","admin.qiyinbz.com"):r:""}function h(t,r=!0){const n=String(t||"").trim();if(!n)return"";const e=l(n);if(!r)return e;const o=d(r);return n.includes("ys.diansan.com")?`${e}?small=true&style=image/resize,h_${o.h},w_${o.w}`:`${e}?w=${o.w}`}async function w(t,r={}){const n=l(t);if(!n)throw new Error("图片地址不能为空");const e=r.compressor??!0;if(!e)return{src:n,source:"original"};const o=h(t,e),i=r.loadBlob??b,a=r.compressBlob??I;try{return await i(o),{src:o,source:"thumbnail"}}catch{const c=await i(n);return{src:await a(c,d(e)),source:"fallback"}}}function y(t={}){if(typeof document>"u")return{close(){}};const r=g(t.urlList,t.url);if(!r.length)return{close(){}};const n=globalThis.__QY_IMAGE_PREVIEW_CREATE_APP__??u.createApp,e=document.createElement("div"),o=document.body.style.overflow;let i=!1,a;const c=()=>{var s;i||(i=!0,document.body.style.overflow=o,(s=a==null?void 0:a.unmount)==null||s.call(a),e.parentNode&&e.parentNode.removeChild(e))};return document.body.appendChild(e),document.body.style.overflow="hidden",a=n({setup(){return()=>u.h(m.ElImageViewer,{urlList:r,initialIndex:t.initialIndex??0,hideOnClickModal:t.hideOnClickModal??!0,teleport:"body",onClose:c})}}),a.mount(e),{close:c}}function d(t){return{...f,...typeof t=="object"?t:{}}}function g(t,r){return(Array.isArray(t)?t:[r]).map(e=>l(e)).filter(Boolean)}async function b(t){const r=await fetch(t,{redirect:"follow"});if(!r.ok)throw new Error(t);return r.blob()}async function I(t,r){if(typeof document>"u"||typeof Image>"u")return R(t);const n=URL.createObjectURL(t);try{const e=await p(n),o=document.createElement("canvas"),i=v(e,r);return o.width=Math.max(1,Math.round(e.naturalWidth*i)),o.height=Math.max(1,Math.round(e.naturalHeight*i)),o.getContext("2d").drawImage(e,0,0,o.width,o.height),o.toDataURL(t.type||"image/jpeg",r.q/100)}finally{URL.revokeObjectURL(n)}}function p(t){return new Promise((r,n)=>{const e=new Image;e.onload=()=>r(e),e.onerror=n,e.src=t})}function v(t,r){const n=r.w?r.w/t.naturalWidth:1,e=r.h?r.h/t.naturalHeight:1;return Math.min(1,n,e)}function R(t){return new Promise((r,n)=>{const e=new FileReader;e.onloadend=()=>r(e.result),e.onerror=n,e.readAsDataURL(t)})}exports.normalizeImageSrc=l;exports.openQyImagePreview=y;exports.resolveQyImageDisplaySrc=w;
@@ -1,112 +0,0 @@
1
- import { h as d, createApp as m } from "vue";
2
- import { ElImageViewer as f } from "element-plus";
3
- const h = {
4
- w: 200,
5
- h: 200,
6
- q: 50
7
- };
8
- function l(t) {
9
- const r = String(t || "").trim();
10
- return r ? r.includes("ys.diansan.com") ? r.replace(/^http:\/\//, "https://").replace("ys.diansan.com", "admin.qiyinbz.com") : r : "";
11
- }
12
- function w(t, r = !0) {
13
- const n = String(t || "").trim();
14
- if (!n) return "";
15
- const e = l(n);
16
- if (!r) return e;
17
- const o = u(r);
18
- return n.includes("ys.diansan.com") ? `${e}?small=true&style=image/resize,h_${o.h},w_${o.w}` : `${e}?w=${o.w}`;
19
- }
20
- async function S(t, r = {}) {
21
- const n = l(t);
22
- if (!n) throw new Error("图片地址不能为空");
23
- const e = r.compressor ?? !0;
24
- if (!e)
25
- return {
26
- src: n,
27
- source: "original"
28
- };
29
- const o = w(t, e), i = r.loadBlob ?? g, a = r.compressBlob ?? b;
30
- try {
31
- return await i(o), {
32
- src: o,
33
- source: "thumbnail"
34
- };
35
- } catch {
36
- const c = await i(n);
37
- return {
38
- src: await a(c, u(e)),
39
- source: "fallback"
40
- };
41
- }
42
- }
43
- function _(t = {}) {
44
- if (typeof document > "u") return { close() {
45
- } };
46
- const r = y(t.urlList, t.url);
47
- if (!r.length) return { close() {
48
- } };
49
- const n = globalThis.__QY_IMAGE_PREVIEW_CREATE_APP__ ?? m, e = document.createElement("div"), o = document.body.style.overflow;
50
- let i = !1, a;
51
- const c = () => {
52
- var s;
53
- i || (i = !0, document.body.style.overflow = o, (s = a == null ? void 0 : a.unmount) == null || s.call(a), e.parentNode && e.parentNode.removeChild(e));
54
- };
55
- return document.body.appendChild(e), document.body.style.overflow = "hidden", a = n({
56
- setup() {
57
- return () => d(f, {
58
- urlList: r,
59
- initialIndex: t.initialIndex ?? 0,
60
- hideOnClickModal: t.hideOnClickModal ?? !0,
61
- teleport: "body",
62
- onClose: c
63
- });
64
- }
65
- }), a.mount(e), { close: c };
66
- }
67
- function u(t) {
68
- return {
69
- ...h,
70
- ...typeof t == "object" ? t : {}
71
- };
72
- }
73
- function y(t, r) {
74
- return (Array.isArray(t) ? t : [r]).map((e) => l(e)).filter(Boolean);
75
- }
76
- async function g(t) {
77
- const r = await fetch(t, { redirect: "follow" });
78
- if (!r.ok) throw new Error(t);
79
- return r.blob();
80
- }
81
- async function b(t, r) {
82
- if (typeof document > "u" || typeof Image > "u")
83
- return v(t);
84
- const n = URL.createObjectURL(t);
85
- try {
86
- const e = await p(n), o = document.createElement("canvas"), i = I(e, r);
87
- return o.width = Math.max(1, Math.round(e.naturalWidth * i)), o.height = Math.max(1, Math.round(e.naturalHeight * i)), o.getContext("2d").drawImage(e, 0, 0, o.width, o.height), o.toDataURL(t.type || "image/jpeg", r.q / 100);
88
- } finally {
89
- URL.revokeObjectURL(n);
90
- }
91
- }
92
- function p(t) {
93
- return new Promise((r, n) => {
94
- const e = new Image();
95
- e.onload = () => r(e), e.onerror = n, e.src = t;
96
- });
97
- }
98
- function I(t, r) {
99
- const n = r.w ? r.w / t.naturalWidth : 1, e = r.h ? r.h / t.naturalHeight : 1;
100
- return Math.min(1, n, e);
101
- }
102
- function v(t) {
103
- return new Promise((r, n) => {
104
- const e = new FileReader();
105
- e.onloadend = () => r(e.result), e.onerror = n, e.readAsDataURL(t);
106
- });
107
- }
108
- export {
109
- l as n,
110
- _ as o,
111
- S as r
112
- };