@qynpm/ui 1.0.34 → 1.0.35
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/README.md +28 -28
- package/dist/index.cjs +5 -5
- package/dist/index.mjs +6 -6
- package/dist/qy-action-bar/index.cjs +1 -1
- package/dist/qy-action-bar/index.mjs +1 -1
- package/dist/qy-dialog/index.cjs +1 -1
- package/dist/qy-dialog/index.mjs +1 -1
- package/dist/qy-form-section/index.cjs +1 -1
- package/dist/qy-form-section/index.mjs +1 -1
- package/dist/qy-iframe/index.cjs +1 -1
- package/dist/qy-iframe/index.mjs +1 -1
- package/dist/qy-image/index.cjs +1 -1
- package/dist/qy-image/index.mjs +1 -1
- package/dist/qy-image-preview/index.cjs +1 -1
- package/dist/qy-image-preview/index.mjs +2 -2
- package/dist/qy-image-upload/index.cjs +1 -1
- package/dist/qy-image-upload/index.mjs +1 -1
- package/dist/qy-legacy-selection-dialog/index.cjs +1 -1
- package/dist/qy-legacy-selection-dialog/index.mjs +1 -1
- package/dist/qy-menu-actions/index.cjs +1 -1
- package/dist/qy-menu-actions/index.mjs +1 -1
- package/dist/qy-money-input/index.cjs +1 -1
- package/dist/qy-money-input/index.mjs +1 -1
- package/dist/qy-popover/index.cjs +1 -1
- package/dist/qy-popover/index.mjs +1 -1
- package/dist/qy-record-quote-search/index.cjs +1 -1
- package/dist/qy-record-quote-search/index.mjs +1 -1
- package/dist/qy-remark-image/index.cjs +1 -1
- package/dist/qy-remark-image/index.mjs +1 -1
- package/dist/qy-remote-select/index.cjs +1 -1
- package/dist/qy-remote-select/index.mjs +1 -1
- package/dist/qy-search-input/index.cjs +1 -1
- package/dist/qy-search-input/index.mjs +1 -1
- package/dist/qy-selection-dialog/index.cjs +1 -1
- package/dist/qy-selection-dialog/index.mjs +1 -1
- package/dist/qy-tree-select/index.cjs +1 -1
- package/dist/qy-tree-select/index.mjs +1 -1
- package/dist/qy-upload/index.cjs +1 -1
- package/dist/qy-upload/index.mjs +1 -1
- package/dist/shared/{index-IXbvJ9d7.mjs → index-4SkLDBra.mjs} +1 -1
- package/dist/shared/{index-fh9l84rU.mjs → index-BekN1g_r.mjs} +10 -10
- package/dist/shared/{index-n04hARNG.cjs → index-Bli6Gx5d.cjs} +1 -1
- package/dist/shared/{index-BBZQowyp.mjs → index-BuUtJrIy.mjs} +9 -9
- package/dist/shared/{index-Dyyp1ix9.cjs → index-C7lRQtzs.cjs} +1 -1
- package/dist/shared/{index-C_adKysL.mjs → index-CdnHMuo3.mjs} +1 -1
- package/dist/shared/{index-Dw5upK-A.cjs → index-Ce_hvR--.cjs} +1 -1
- package/dist/shared/{index-D6-K5xSD.cjs → index-DlGwHshu.cjs} +1 -1
- package/dist/shared/{index-BeubtXXl.cjs → index-DnHfk7NM.cjs} +1 -1
- package/dist/shared/{index-ccugL1Ie.mjs → index-Dr-Q5krU.mjs} +4 -4
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-CqSJ_8hG.cjs +1 -0
- 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
- package/dist/shared/index.vue_vue_type_style_index_0_lang-DHK86rdP.cjs +1 -0
- 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
- package/dist/shared/utils-BjEXwY3L.cjs +1 -0
- package/dist/shared/utils-DoyI5oM8.mjs +148 -0
- package/index.d.ts +31 -31
- package/package.json +1 -1
- package/qy-alert/index.d.ts +64 -64
- package/qy-autocomplete/index.d.ts +5 -5
- package/qy-avatar/index.d.ts +67 -67
- package/qy-badge/index.d.ts +63 -63
- package/qy-card/index.d.ts +64 -64
- package/qy-cascader/index.d.ts +198 -198
- package/qy-collapse/index.d.ts +59 -59
- package/qy-collapse-item/index.d.ts +45 -45
- package/qy-descriptions/index.d.ts +47 -47
- package/qy-descriptions-item/index.d.ts +46 -46
- package/qy-dialog/index.d.ts +63 -63
- package/qy-divider/index.d.ts +53 -53
- package/qy-drawer/index.d.ts +55 -55
- package/qy-empty/index.d.ts +51 -51
- package/qy-iframe/index.d.ts +66 -66
- package/qy-image/index.d.ts +28 -28
- package/qy-image-preview/index.d.ts +21 -20
- package/qy-link/index.d.ts +69 -69
- package/qy-loading/index.d.ts +25 -25
- package/qy-menu-actions/index.d.ts +29 -29
- package/qy-progress/index.d.ts +74 -74
- package/qy-result/index.d.ts +64 -64
- package/qy-scrollbar/index.d.ts +85 -85
- package/qy-skeleton/index.d.ts +54 -54
- package/qy-skeleton-item/index.d.ts +48 -48
- package/qy-step/index.d.ts +55 -55
- package/qy-steps/index.d.ts +62 -62
- package/qy-tab-pane/index.d.ts +40 -40
- package/qy-table-column-settings/index.d.ts +18 -18
- package/qy-tabs/index.d.ts +84 -84
- package/qy-tree/index.d.ts +132 -132
- package/qy-tree-select/index.d.ts +123 -123
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-5gku7Zwv.cjs +0 -1
- package/dist/shared/index.vue_vue_type_style_index_0_lang-M0qKRXd2.cjs +0 -1
- package/dist/shared/utils-D2KAQCCB.cjs +0 -1
- package/dist/shared/utils-DUntDntI.mjs +0 -112
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as u, computed as c, watch as m, onBeforeUnmount as f, openBlock as s, createBlock as p, unref as y, createCommentVNode as h } from "vue";
|
|
2
2
|
import { ElImageViewer as v } from "element-plus";
|
|
3
|
-
import { n as w } from "./utils-
|
|
3
|
+
import { n as w } from "./utils-DoyI5oM8.mjs";
|
|
4
4
|
const I = /* @__PURE__ */ u({
|
|
5
5
|
name: "QyImagePreview",
|
|
6
6
|
__name: "index",
|
|
@@ -12,25 +12,25 @@ const I = /* @__PURE__ */ u({
|
|
|
12
12
|
},
|
|
13
13
|
emits: ["update:open", "close"],
|
|
14
14
|
setup(e, { emit: a }) {
|
|
15
|
-
const
|
|
15
|
+
const n = e, l = a;
|
|
16
16
|
let i = "";
|
|
17
17
|
const r = c(
|
|
18
|
-
() =>
|
|
18
|
+
() => n.urlList.map((o) => w(o)).filter(Boolean)
|
|
19
19
|
);
|
|
20
20
|
m(
|
|
21
|
-
() =>
|
|
21
|
+
() => n.open,
|
|
22
22
|
(o) => {
|
|
23
23
|
if (o) {
|
|
24
24
|
i = document.body.style.overflow, document.body.style.overflow = "hidden";
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
t();
|
|
28
28
|
}
|
|
29
|
-
), f(
|
|
29
|
+
), f(t);
|
|
30
30
|
function d() {
|
|
31
|
-
|
|
31
|
+
t(), l("update:open", !1), l("close");
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function t() {
|
|
34
34
|
typeof document > "u" || (document.body.style.overflow = i);
|
|
35
35
|
}
|
|
36
36
|
return (o, k) => e.open && r.value.length ? (s(), p(y(v), {
|
|
@@ -38,7 +38,7 @@ const I = /* @__PURE__ */ u({
|
|
|
38
38
|
"url-list": r.value,
|
|
39
39
|
"initial-index": e.initialIndex,
|
|
40
40
|
"hide-on-click-modal": e.hideOnClickModal,
|
|
41
|
-
|
|
41
|
+
teleported: !0,
|
|
42
42
|
onClose: d
|
|
43
43
|
}, null, 8, ["url-list", "initial-index", "hide-on-click-modal"])) : h("", !0);
|
|
44
44
|
}
|
|
@@ -0,0 +1 @@
|
|
|
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},transition:{type:String,default:void 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,c=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,d=!1,s;const b=t.computed(()=>typeof n.width=="number"?`${n.width}px`:n.width),S=t.computed(()=>({"--qy-popover-width":b.value,"--qy-popover-mobile-gutter":"24px"})),m=t.useSlots(),T=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 q(e){o&&clearTimeout(o),o=setTimeout(()=>{o=void 0,a.value===e&&(a.value=null)},K)}function l(){if(d)return;const e=y.value;u.value!==e&&(d=!0,s=e,u.value=e)}function p(e){if(!(e&&n.disabled)){if(!i.value){if(f.value===e)return;f.value=e,c("update:open",e),l();return}a.value!==e&&(a.value===null&&n.open===e||(a.value=e,e?q(e):o&&(clearTimeout(o),o=void 0),c("update:open",e),l()))}}function g(e){e===u.value&&(!d||s!==e||(d=!1,s=void 0,e!==h.value&&(h.value=e,a.value===e&&w(),c("open-change",e),c(e?"open":"close"),l())))}function C(e){p(e),l()}function L(){g(!0)}function N(){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),d=!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,transition:r.transition,disabled:r.disabled,enterable:!0,"popper-style":S.value,"popper-class":"qy-popover-popper","onUpdate:visible":C,onAfterEnter:L,onAfterLeave:N},{reference:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(T.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","transition","disabled","popper-style"]))}});exports._sfc_main=O;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent as z, computed as d, ref as v, useSlots as F, watch as m, onBeforeUnmount as M, onMounted as Q, openBlock as g, createBlock as
|
|
1
|
+
import { defineComponent as z, computed as d, ref as v, useSlots as F, watch as m, onBeforeUnmount as M, onMounted as Q, openBlock as g, createBlock as T, unref as R, withCtx as B, renderSlot as j, createElementBlock as G, Fragment as H, renderList as J, resolveDynamicComponent as X } from "vue";
|
|
2
2
|
import { ElPopover as Y } from "element-plus";
|
|
3
|
-
const Z = 1e3,
|
|
3
|
+
const Z = 1e3, _ = /* @__PURE__ */ z({
|
|
4
4
|
name: "QyPopover",
|
|
5
5
|
inheritAttrs: !1,
|
|
6
6
|
__name: "index",
|
|
@@ -13,12 +13,13 @@ const Z = 1e3, V = /* @__PURE__ */ z({
|
|
|
13
13
|
showDelay: { type: Number, default: 0 },
|
|
14
14
|
hideDelay: { type: Number, default: 200 },
|
|
15
15
|
showArrow: { type: Boolean, default: !0 },
|
|
16
|
+
transition: { type: String, default: void 0 },
|
|
16
17
|
disabled: { type: Boolean, default: !1 },
|
|
17
18
|
open: { type: Boolean, default: void 0 }
|
|
18
19
|
},
|
|
19
20
|
emits: ["update:open", "open-change", "open", "close"],
|
|
20
|
-
setup(r, { expose:
|
|
21
|
-
const t = r, c =
|
|
21
|
+
setup(r, { expose: L, emit: N }) {
|
|
22
|
+
const t = r, c = N, i = d(() => t.open !== void 0), w = i.value && t.open === !0 && !t.disabled, u = v(w), l = v(w), k = v(w), o = v(null), A = d(() => t.disabled ? !1 : i.value ? t.open === !0 : u.value);
|
|
22
23
|
let n, f = !1, s;
|
|
23
24
|
const C = d(
|
|
24
25
|
() => typeof t.width == "number" ? `${t.width}px` : t.width
|
|
@@ -46,9 +47,9 @@ const Z = 1e3, V = /* @__PURE__ */ z({
|
|
|
46
47
|
}
|
|
47
48
|
function p(e) {
|
|
48
49
|
if (!(e && t.disabled)) {
|
|
49
|
-
if (!
|
|
50
|
-
if (
|
|
51
|
-
|
|
50
|
+
if (!i.value) {
|
|
51
|
+
if (u.value === e) return;
|
|
52
|
+
u.value = e, c("update:open", e), a();
|
|
52
53
|
return;
|
|
53
54
|
}
|
|
54
55
|
o.value !== e && (o.value === null && t.open === e || (o.value = e, e ? I(e) : n && (clearTimeout(n), n = void 0), c("update:open", e), a()));
|
|
@@ -75,12 +76,12 @@ const Z = 1e3, V = /* @__PURE__ */ z({
|
|
|
75
76
|
return m(
|
|
76
77
|
A,
|
|
77
78
|
() => a()
|
|
78
|
-
), m(
|
|
79
|
-
y(), e ?
|
|
79
|
+
), m(i, (e) => {
|
|
80
|
+
y(), e ? u.value = t.open === !0 : u.value = l.value, a();
|
|
80
81
|
}), m(
|
|
81
82
|
() => t.open,
|
|
82
83
|
(e, b) => {
|
|
83
|
-
!
|
|
84
|
+
!i.value || o.value === null || (e === o.value || e !== b) && y();
|
|
84
85
|
}
|
|
85
86
|
), m(
|
|
86
87
|
() => t.disabled,
|
|
@@ -91,7 +92,7 @@ const Z = 1e3, V = /* @__PURE__ */ z({
|
|
|
91
92
|
window.removeEventListener("keydown", E), f = !1, s = void 0, n && clearTimeout(n);
|
|
92
93
|
}), Q(() => {
|
|
93
94
|
window.addEventListener("keydown", E);
|
|
94
|
-
}),
|
|
95
|
+
}), L({ close: U }), (e, b) => (g(), T(R(Y), {
|
|
95
96
|
visible: l.value,
|
|
96
97
|
trigger: r.trigger,
|
|
97
98
|
placement: r.placement,
|
|
@@ -101,6 +102,7 @@ const Z = 1e3, V = /* @__PURE__ */ z({
|
|
|
101
102
|
"show-after": r.showDelay,
|
|
102
103
|
"hide-after": r.hideDelay,
|
|
103
104
|
"show-arrow": r.showArrow,
|
|
105
|
+
transition: r.transition,
|
|
104
106
|
disabled: r.disabled,
|
|
105
107
|
enterable: !0,
|
|
106
108
|
"popper-style": q.value,
|
|
@@ -109,18 +111,18 @@ const Z = 1e3, V = /* @__PURE__ */ z({
|
|
|
109
111
|
onAfterEnter: O,
|
|
110
112
|
onAfterLeave: P
|
|
111
113
|
}, {
|
|
112
|
-
reference:
|
|
113
|
-
(g(!0), G(H, null, J(W.value, (
|
|
114
|
-
key:
|
|
114
|
+
reference: B(() => [
|
|
115
|
+
(g(!0), G(H, null, J(W.value, (S, $) => (g(), T(X(S), {
|
|
116
|
+
key: S.key ?? $
|
|
115
117
|
}))), 128))
|
|
116
118
|
]),
|
|
117
|
-
default:
|
|
119
|
+
default: B(() => [
|
|
118
120
|
j(e.$slots, "default")
|
|
119
121
|
]),
|
|
120
122
|
_: 3
|
|
121
|
-
}, 8, ["visible", "trigger", "placement", "effect", "width", "offset", "show-after", "hide-after", "show-arrow", "disabled", "popper-style"]));
|
|
123
|
+
}, 8, ["visible", "trigger", "placement", "effect", "width", "offset", "show-after", "hide-after", "show-arrow", "transition", "disabled", "popper-style"]));
|
|
122
124
|
}
|
|
123
125
|
});
|
|
124
126
|
export {
|
|
125
|
-
|
|
127
|
+
_
|
|
126
128
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const g=require("vue"),v=require("element-plus"),m=Symbol.for("qynpm.image-preview.runtime");function c(){const e=globalThis;return e[m]||(e[m]={snapshot:null,activeToken:null,activeClose:null,transitionDepth:0}),e[m]}const I={w:200,h:200,q:50};function l(e){const t=String(e||"").trim();return t?t.includes("ys.diansan.com")?t.replace(/^http:\/\//,"https://").replace("ys.diansan.com","admin.qiyinbz.com"):t:""}function b(e,t=!0){const r=String(e||"").trim();if(!r)return"";const n=l(r);if(!t)return n;const o=y(t);return r.includes("ys.diansan.com")?`${n}?small=true&style=image/resize,h_${o.h},w_${o.w}`:`${n}?w=${o.w}`}async function _(e,t={}){const r=l(e);if(!r)throw new Error("图片地址不能为空");const n=t.compressor??!0;if(!n)return{src:r,source:"original"};const o=b(e,n),a=t.loadBlob??P,i=t.compressBlob??T;try{return await a(o),{src:o,source:"thumbnail"}}catch{const u=await a(r);return{src:await i(u,y(n)),source:"fallback"}}}function w(e={}){if(typeof document>"u")return{close(){}};const t=S(e.urlList,e.url);if(!t.length)return{close(){}};const r=globalThis.__QY_IMAGE_PREVIEW_CREATE_APP__??g.createApp,n=document.createElement("div"),o=document.body.style.overflow;let a=!1,i;const u={urlList:[...t],initialIndex:e.initialIndex??0,hideOnClickModal:e.hideOnClickModal??!0},s=c(),h={};s.snapshot=u,s.activeToken=h;const d=()=>{var f;a||(a=!0,s.activeToken===h&&(s.activeToken=null,s.activeClose=null,s.transitionDepth===0&&(s.snapshot=null)),document.body.style.overflow=o,(f=i==null?void 0:i.unmount)==null||f.call(i),n.parentNode&&n.parentNode.removeChild(n))};return document.body.appendChild(n),document.body.style.overflow="hidden",i=r({setup(){return()=>g.h(v.ElImageViewer,{urlList:t,initialIndex:e.initialIndex??0,hideOnClickModal:e.hideOnClickModal??!0,teleported:!0,onClose:d})}}),i.mount(n),s.activeClose=d,{close:d}}function R(){const e=c().snapshot;return e?{...e,urlList:[...e.urlList]}:null}function p(e){const t=c();if(!(!e||t.activeToken))return w(e)}const E={getSnapshot:R,restore:p,beginRendererTransition(){c().transitionDepth+=1},endRendererTransition(){const e=c();if(e.transitionDepth=Math.max(0,e.transitionDepth-1),e.transitionDepth===0&&e.snapshot){const t={...e.snapshot,urlList:[...e.snapshot.urlList]};e.activeClose&&(e.transitionDepth=1,e.activeClose(),e.transitionDepth=0),p(t)}}};globalThis.__QY_IMAGE_PREVIEW_INTERNAL__=E;function y(e){return{...I,...typeof e=="object"?e:{}}}function S(e,t){return(Array.isArray(e)?e:[t]).map(n=>l(n)).filter(Boolean)}async function P(e){const t=await fetch(e,{redirect:"follow"});if(!t.ok)throw new Error(e);return t.blob()}async function T(e,t){if(typeof document>"u"||typeof Image>"u")return D(e);const r=URL.createObjectURL(e);try{const n=await C(r),o=document.createElement("canvas"),a=L(n,t);return o.width=Math.max(1,Math.round(n.naturalWidth*a)),o.height=Math.max(1,Math.round(n.naturalHeight*a)),o.getContext("2d").drawImage(n,0,0,o.width,o.height),o.toDataURL(e.type||"image/jpeg",t.q/100)}finally{URL.revokeObjectURL(r)}}function C(e){return new Promise((t,r)=>{const n=new Image;n.onload=()=>t(n),n.onerror=r,n.src=e})}function L(e,t){const r=t.w?t.w/e.naturalWidth:1,n=t.h?t.h/e.naturalHeight:1;return Math.min(1,r,n)}function D(e){return new Promise((t,r)=>{const n=new FileReader;n.onloadend=()=>t(n.result),n.onerror=r,n.readAsDataURL(e)})}exports.normalizeImageSrc=l;exports.openQyImagePreview=w;exports.resolveQyImageDisplaySrc=_;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { h as g, createApp as y } from "vue";
|
|
2
|
+
import { ElImageViewer as v } from "element-plus";
|
|
3
|
+
const d = Symbol.for("qynpm.image-preview.runtime");
|
|
4
|
+
function c() {
|
|
5
|
+
const e = globalThis;
|
|
6
|
+
return e[d] || (e[d] = {
|
|
7
|
+
snapshot: null,
|
|
8
|
+
activeToken: null,
|
|
9
|
+
activeClose: null,
|
|
10
|
+
transitionDepth: 0
|
|
11
|
+
}), e[d];
|
|
12
|
+
}
|
|
13
|
+
const b = {
|
|
14
|
+
w: 200,
|
|
15
|
+
h: 200,
|
|
16
|
+
q: 50
|
|
17
|
+
};
|
|
18
|
+
function m(e) {
|
|
19
|
+
const t = String(e || "").trim();
|
|
20
|
+
return t ? t.includes("ys.diansan.com") ? t.replace(/^http:\/\//, "https://").replace("ys.diansan.com", "admin.qiyinbz.com") : t : "";
|
|
21
|
+
}
|
|
22
|
+
function I(e, t = !0) {
|
|
23
|
+
const r = String(e || "").trim();
|
|
24
|
+
if (!r) return "";
|
|
25
|
+
const n = m(r);
|
|
26
|
+
if (!t) return n;
|
|
27
|
+
const o = w(t);
|
|
28
|
+
return r.includes("ys.diansan.com") ? `${n}?small=true&style=image/resize,h_${o.h},w_${o.w}` : `${n}?w=${o.w}`;
|
|
29
|
+
}
|
|
30
|
+
async function x(e, t = {}) {
|
|
31
|
+
const r = m(e);
|
|
32
|
+
if (!r) throw new Error("图片地址不能为空");
|
|
33
|
+
const n = t.compressor ?? !0;
|
|
34
|
+
if (!n)
|
|
35
|
+
return {
|
|
36
|
+
src: r,
|
|
37
|
+
source: "original"
|
|
38
|
+
};
|
|
39
|
+
const o = I(e, n), a = t.loadBlob ?? C, i = t.compressBlob ?? S;
|
|
40
|
+
try {
|
|
41
|
+
return await a(o), {
|
|
42
|
+
src: o,
|
|
43
|
+
source: "thumbnail"
|
|
44
|
+
};
|
|
45
|
+
} catch {
|
|
46
|
+
const l = await a(r);
|
|
47
|
+
return {
|
|
48
|
+
src: await i(l, w(n)),
|
|
49
|
+
source: "fallback"
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function _(e = {}) {
|
|
54
|
+
if (typeof document > "u") return { close() {
|
|
55
|
+
} };
|
|
56
|
+
const t = T(e.urlList, e.url);
|
|
57
|
+
if (!t.length) return { close() {
|
|
58
|
+
} };
|
|
59
|
+
const r = globalThis.__QY_IMAGE_PREVIEW_CREATE_APP__ ?? y, n = document.createElement("div"), o = document.body.style.overflow;
|
|
60
|
+
let a = !1, i;
|
|
61
|
+
const l = { urlList: [...t], initialIndex: e.initialIndex ?? 0, hideOnClickModal: e.hideOnClickModal ?? !0 }, s = c(), h = {};
|
|
62
|
+
s.snapshot = l, s.activeToken = h;
|
|
63
|
+
const u = () => {
|
|
64
|
+
var f;
|
|
65
|
+
a || (a = !0, s.activeToken === h && (s.activeToken = null, s.activeClose = null, s.transitionDepth === 0 && (s.snapshot = null)), document.body.style.overflow = o, (f = i == null ? void 0 : i.unmount) == null || f.call(i), n.parentNode && n.parentNode.removeChild(n));
|
|
66
|
+
};
|
|
67
|
+
return document.body.appendChild(n), document.body.style.overflow = "hidden", i = r({
|
|
68
|
+
setup() {
|
|
69
|
+
return () => g(v, {
|
|
70
|
+
urlList: t,
|
|
71
|
+
initialIndex: e.initialIndex ?? 0,
|
|
72
|
+
hideOnClickModal: e.hideOnClickModal ?? !0,
|
|
73
|
+
teleported: !0,
|
|
74
|
+
onClose: u
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}), i.mount(n), s.activeClose = u, { close: u };
|
|
78
|
+
}
|
|
79
|
+
function R() {
|
|
80
|
+
const e = c().snapshot;
|
|
81
|
+
return e ? { ...e, urlList: [...e.urlList] } : null;
|
|
82
|
+
}
|
|
83
|
+
function p(e) {
|
|
84
|
+
const t = c();
|
|
85
|
+
if (!(!e || t.activeToken))
|
|
86
|
+
return _(e);
|
|
87
|
+
}
|
|
88
|
+
const E = {
|
|
89
|
+
getSnapshot: R,
|
|
90
|
+
restore: p,
|
|
91
|
+
beginRendererTransition() {
|
|
92
|
+
c().transitionDepth += 1;
|
|
93
|
+
},
|
|
94
|
+
endRendererTransition() {
|
|
95
|
+
const e = c();
|
|
96
|
+
if (e.transitionDepth = Math.max(0, e.transitionDepth - 1), e.transitionDepth === 0 && e.snapshot) {
|
|
97
|
+
const t = { ...e.snapshot, urlList: [...e.snapshot.urlList] };
|
|
98
|
+
e.activeClose && (e.transitionDepth = 1, e.activeClose(), e.transitionDepth = 0), p(t);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
globalThis.__QY_IMAGE_PREVIEW_INTERNAL__ = E;
|
|
103
|
+
function w(e) {
|
|
104
|
+
return {
|
|
105
|
+
...b,
|
|
106
|
+
...typeof e == "object" ? e : {}
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
function T(e, t) {
|
|
110
|
+
return (Array.isArray(e) ? e : [t]).map((n) => m(n)).filter(Boolean);
|
|
111
|
+
}
|
|
112
|
+
async function C(e) {
|
|
113
|
+
const t = await fetch(e, { redirect: "follow" });
|
|
114
|
+
if (!t.ok) throw new Error(e);
|
|
115
|
+
return t.blob();
|
|
116
|
+
}
|
|
117
|
+
async function S(e, t) {
|
|
118
|
+
if (typeof document > "u" || typeof Image > "u")
|
|
119
|
+
return M(e);
|
|
120
|
+
const r = URL.createObjectURL(e);
|
|
121
|
+
try {
|
|
122
|
+
const n = await L(r), o = document.createElement("canvas"), a = P(n, t);
|
|
123
|
+
return o.width = Math.max(1, Math.round(n.naturalWidth * a)), o.height = Math.max(1, Math.round(n.naturalHeight * a)), o.getContext("2d").drawImage(n, 0, 0, o.width, o.height), o.toDataURL(e.type || "image/jpeg", t.q / 100);
|
|
124
|
+
} finally {
|
|
125
|
+
URL.revokeObjectURL(r);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function L(e) {
|
|
129
|
+
return new Promise((t, r) => {
|
|
130
|
+
const n = new Image();
|
|
131
|
+
n.onload = () => t(n), n.onerror = r, n.src = e;
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
function P(e, t) {
|
|
135
|
+
const r = t.w ? t.w / e.naturalWidth : 1, n = t.h ? t.h / e.naturalHeight : 1;
|
|
136
|
+
return Math.min(1, r, n);
|
|
137
|
+
}
|
|
138
|
+
function M(e) {
|
|
139
|
+
return new Promise((t, r) => {
|
|
140
|
+
const n = new FileReader();
|
|
141
|
+
n.onloadend = () => t(n.result), n.onerror = r, n.readAsDataURL(e);
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
export {
|
|
145
|
+
m as n,
|
|
146
|
+
_ as o,
|
|
147
|
+
x as r
|
|
148
|
+
};
|
package/index.d.ts
CHANGED
|
@@ -31,11 +31,11 @@ import type QyAsideComponent from './qy-aside'
|
|
|
31
31
|
import type QyMainComponent from './qy-main'
|
|
32
32
|
import type QyDescriptionsComponent from './qy-descriptions'
|
|
33
33
|
import type QyDescriptionsItemComponent from './qy-descriptions-item'
|
|
34
|
-
import type QyCollapseComponent from './qy-collapse'
|
|
35
|
-
import type QyCollapseItemComponent from './qy-collapse-item'
|
|
36
|
-
import type QyLinkComponent from './qy-link'
|
|
37
|
-
import type QyIframeComponent from './qy-iframe'
|
|
38
|
-
import type QyDividerComponent from './qy-divider'
|
|
34
|
+
import type QyCollapseComponent from './qy-collapse'
|
|
35
|
+
import type QyCollapseItemComponent from './qy-collapse-item'
|
|
36
|
+
import type QyLinkComponent from './qy-link'
|
|
37
|
+
import type QyIframeComponent from './qy-iframe'
|
|
38
|
+
import type QyDividerComponent from './qy-divider'
|
|
39
39
|
import type QyEmptyComponent from './qy-empty'
|
|
40
40
|
import type QyAlertComponent from './qy-alert'
|
|
41
41
|
import type QyCardComponent from './qy-card'
|
|
@@ -348,22 +348,22 @@ export type {
|
|
|
348
348
|
QyCollapseItemProps,
|
|
349
349
|
QyCollapseItemSlots
|
|
350
350
|
} from './qy-collapse-item'
|
|
351
|
-
export type {
|
|
352
|
-
QyLinkAttrs,
|
|
353
|
-
QyLinkEmits,
|
|
354
|
-
QyLinkProps,
|
|
355
|
-
QyLinkSlots,
|
|
356
|
-
QyLinkType,
|
|
357
|
-
QyLinkUnderline
|
|
358
|
-
} from './qy-link'
|
|
359
|
-
export type {
|
|
360
|
-
QyIframeAttrs,
|
|
361
|
-
QyIframeEmits,
|
|
362
|
-
QyIframeLoading,
|
|
363
|
-
QyIframeProps,
|
|
364
|
-
QyIframeReferrerPolicy
|
|
365
|
-
} from './qy-iframe'
|
|
366
|
-
export type {
|
|
351
|
+
export type {
|
|
352
|
+
QyLinkAttrs,
|
|
353
|
+
QyLinkEmits,
|
|
354
|
+
QyLinkProps,
|
|
355
|
+
QyLinkSlots,
|
|
356
|
+
QyLinkType,
|
|
357
|
+
QyLinkUnderline
|
|
358
|
+
} from './qy-link'
|
|
359
|
+
export type {
|
|
360
|
+
QyIframeAttrs,
|
|
361
|
+
QyIframeEmits,
|
|
362
|
+
QyIframeLoading,
|
|
363
|
+
QyIframeProps,
|
|
364
|
+
QyIframeReferrerPolicy
|
|
365
|
+
} from './qy-iframe'
|
|
366
|
+
export type {
|
|
367
367
|
QyDividerAttrs,
|
|
368
368
|
QyDividerBorderStyle,
|
|
369
369
|
QyDividerContentPosition,
|
|
@@ -529,11 +529,11 @@ export const QyAside: typeof QyAsideComponent
|
|
|
529
529
|
export const QyMain: typeof QyMainComponent
|
|
530
530
|
export const QyDescriptions: typeof QyDescriptionsComponent
|
|
531
531
|
export const QyDescriptionsItem: typeof QyDescriptionsItemComponent
|
|
532
|
-
export const QyCollapse: typeof QyCollapseComponent
|
|
533
|
-
export const QyCollapseItem: typeof QyCollapseItemComponent
|
|
534
|
-
export const QyLink: typeof QyLinkComponent
|
|
535
|
-
export const QyIframe: typeof QyIframeComponent
|
|
536
|
-
export const QyDivider: typeof QyDividerComponent
|
|
532
|
+
export const QyCollapse: typeof QyCollapseComponent
|
|
533
|
+
export const QyCollapseItem: typeof QyCollapseItemComponent
|
|
534
|
+
export const QyLink: typeof QyLinkComponent
|
|
535
|
+
export const QyIframe: typeof QyIframeComponent
|
|
536
|
+
export const QyDivider: typeof QyDividerComponent
|
|
537
537
|
export const QyEmpty: typeof QyEmptyComponent
|
|
538
538
|
export const QyAlert: typeof QyAlertComponent
|
|
539
539
|
export const QyCard: typeof QyCardComponent
|
|
@@ -618,11 +618,11 @@ declare const _default: Plugin & {
|
|
|
618
618
|
QyMain: typeof QyMainComponent
|
|
619
619
|
QyDescriptions: typeof QyDescriptionsComponent
|
|
620
620
|
QyDescriptionsItem: typeof QyDescriptionsItemComponent
|
|
621
|
-
QyCollapse: typeof QyCollapseComponent
|
|
622
|
-
QyCollapseItem: typeof QyCollapseItemComponent
|
|
623
|
-
QyLink: typeof QyLinkComponent
|
|
624
|
-
QyIframe: typeof QyIframeComponent
|
|
625
|
-
QyDivider: typeof QyDividerComponent
|
|
621
|
+
QyCollapse: typeof QyCollapseComponent
|
|
622
|
+
QyCollapseItem: typeof QyCollapseItemComponent
|
|
623
|
+
QyLink: typeof QyLinkComponent
|
|
624
|
+
QyIframe: typeof QyIframeComponent
|
|
625
|
+
QyDivider: typeof QyDividerComponent
|
|
626
626
|
QyEmpty: typeof QyEmptyComponent
|
|
627
627
|
QyAlert: typeof QyAlertComponent
|
|
628
628
|
QyCard: typeof QyCardComponent
|
package/package.json
CHANGED
package/qy-alert/index.d.ts
CHANGED
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
ComponentOptionsMixin,
|
|
3
|
-
DefineComponent,
|
|
4
|
-
Plugin,
|
|
5
|
-
PublicProps,
|
|
6
|
-
SlotsType
|
|
7
|
-
} from 'vue'
|
|
8
|
-
import type { StyleValue } from 'vue'
|
|
9
|
-
|
|
10
|
-
export type QyAlertType = 'primary' | 'success' | 'warning' | 'info' | 'error'
|
|
11
|
-
export type QyAlertEffect = 'light' | 'dark'
|
|
12
|
-
|
|
13
|
-
export interface QyAlertProps {
|
|
14
|
-
title?: string
|
|
15
|
-
description?: string
|
|
16
|
-
type?: QyAlertType
|
|
17
|
-
closable?: boolean
|
|
18
|
-
closeText?: string
|
|
19
|
-
showIcon?: boolean
|
|
20
|
-
center?: boolean
|
|
21
|
-
effect?: QyAlertEffect
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface QyAlertAttrs {
|
|
25
|
-
class?: unknown
|
|
26
|
-
style?: StyleValue
|
|
27
|
-
id?: string
|
|
28
|
-
role?: string
|
|
29
|
-
[key: `data-${string}`]: unknown
|
|
30
|
-
[key: `aria-${string}`]: unknown
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export interface QyAlertSlots {
|
|
34
|
-
icon?: () => unknown
|
|
35
|
-
title?: () => unknown
|
|
36
|
-
default?: () => unknown
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export type QyAlertEmits = {
|
|
40
|
-
close: () => void
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
type QyAlertComponentProps = QyAlertProps & QyAlertAttrs & {
|
|
44
|
-
onClose?: QyAlertEmits['close']
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
declare const QyAlert: DefineComponent<
|
|
48
|
-
QyAlertProps,
|
|
49
|
-
{},
|
|
50
|
-
{},
|
|
51
|
-
{},
|
|
52
|
-
{},
|
|
53
|
-
ComponentOptionsMixin,
|
|
54
|
-
ComponentOptionsMixin,
|
|
55
|
-
QyAlertEmits,
|
|
56
|
-
string,
|
|
57
|
-
PublicProps,
|
|
58
|
-
QyAlertComponentProps,
|
|
59
|
-
{},
|
|
60
|
-
SlotsType<QyAlertSlots>
|
|
61
|
-
> & Plugin
|
|
62
|
-
|
|
63
|
-
export { QyAlert }
|
|
64
|
-
export default QyAlert
|
|
1
|
+
import type {
|
|
2
|
+
ComponentOptionsMixin,
|
|
3
|
+
DefineComponent,
|
|
4
|
+
Plugin,
|
|
5
|
+
PublicProps,
|
|
6
|
+
SlotsType
|
|
7
|
+
} from 'vue'
|
|
8
|
+
import type { StyleValue } from 'vue'
|
|
9
|
+
|
|
10
|
+
export type QyAlertType = 'primary' | 'success' | 'warning' | 'info' | 'error'
|
|
11
|
+
export type QyAlertEffect = 'light' | 'dark'
|
|
12
|
+
|
|
13
|
+
export interface QyAlertProps {
|
|
14
|
+
title?: string
|
|
15
|
+
description?: string
|
|
16
|
+
type?: QyAlertType
|
|
17
|
+
closable?: boolean
|
|
18
|
+
closeText?: string
|
|
19
|
+
showIcon?: boolean
|
|
20
|
+
center?: boolean
|
|
21
|
+
effect?: QyAlertEffect
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface QyAlertAttrs {
|
|
25
|
+
class?: unknown
|
|
26
|
+
style?: StyleValue
|
|
27
|
+
id?: string
|
|
28
|
+
role?: string
|
|
29
|
+
[key: `data-${string}`]: unknown
|
|
30
|
+
[key: `aria-${string}`]: unknown
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface QyAlertSlots {
|
|
34
|
+
icon?: () => unknown
|
|
35
|
+
title?: () => unknown
|
|
36
|
+
default?: () => unknown
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type QyAlertEmits = {
|
|
40
|
+
close: () => void
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
type QyAlertComponentProps = QyAlertProps & QyAlertAttrs & {
|
|
44
|
+
onClose?: QyAlertEmits['close']
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
declare const QyAlert: DefineComponent<
|
|
48
|
+
QyAlertProps,
|
|
49
|
+
{},
|
|
50
|
+
{},
|
|
51
|
+
{},
|
|
52
|
+
{},
|
|
53
|
+
ComponentOptionsMixin,
|
|
54
|
+
ComponentOptionsMixin,
|
|
55
|
+
QyAlertEmits,
|
|
56
|
+
string,
|
|
57
|
+
PublicProps,
|
|
58
|
+
QyAlertComponentProps,
|
|
59
|
+
{},
|
|
60
|
+
SlotsType<QyAlertSlots>
|
|
61
|
+
> & Plugin
|
|
62
|
+
|
|
63
|
+
export { QyAlert }
|
|
64
|
+
export default QyAlert
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { DefineComponent, Plugin } from 'vue'
|
|
2
|
-
|
|
3
|
-
declare const QyAutocomplete: DefineComponent<any, any, any> & Plugin
|
|
4
|
-
|
|
5
|
-
export default QyAutocomplete
|
|
1
|
+
import type { DefineComponent, Plugin } from 'vue'
|
|
2
|
+
|
|
3
|
+
declare const QyAutocomplete: DefineComponent<any, any, any> & Plugin
|
|
4
|
+
|
|
5
|
+
export default QyAutocomplete
|