@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.
- package/README.md +91 -56
- package/dist/index.cjs +7 -6
- package/dist/index.mjs +63 -61
- 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-drawer/index.cjs +1 -1
- package/dist/qy-drawer/index.mjs +1 -1
- package/dist/qy-file-picker/index.cjs +1 -1
- package/dist/qy-file-picker/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-input-number/index.cjs +1 -1
- package/dist/qy-input-number/index.mjs +1 -1
- package/dist/qy-input-tag/index.cjs +1 -0
- package/dist/qy-input-tag/index.mjs +7 -0
- 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 +5 -2
- 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 +5 -2
- package/dist/shared/{index-IXbvJ9d7.mjs → index-4SkLDBra.mjs} +1 -1
- package/dist/shared/index-BYX0biqw.mjs +766 -0
- 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-BxxwEr52.mjs +107 -0
- package/dist/shared/index-C1i-hd-W.cjs +1 -0
- 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-D654b42n.mjs +2754 -0
- 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-DnNIseRJ.cjs +1 -0
- package/dist/shared/{index-ccugL1Ie.mjs → index-Dr-Q5krU.mjs} +4 -4
- package/dist/shared/index-aIqtIYsu.cjs +1 -0
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-BiIgNax-.cjs +1 -0
- 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-DIWWHODS.mjs +197 -0
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-DwFGEW4B.mjs +143 -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_script_setup_true_lang-ccFLNRry.cjs +1 -0
- package/dist/shared/index.vue_vue_type_style_index_0_lang-B1FgJZbw.mjs +148 -0
- 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-DVXf-yUs.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 +113 -56
- package/package.json +489 -483
- 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-file-picker/index.d.ts +4 -1
- package/qy-iframe/index.d.ts +66 -66
- package/qy-image/index.d.ts +28 -28
- package/qy-image-preview/index.d.ts +20 -20
- package/qy-image-upload/index.d.ts +69 -12
- package/qy-input/index.d.ts +76 -18
- package/qy-input-number/index.d.ts +64 -30
- package/qy-input-tag/index.d.ts +69 -0
- 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-money-input/index.d.ts +87 -12
- 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/qy-upload/index.d.ts +99 -5
- package/dist/shared/index-BkX9xlbI.cjs +0 -1
- package/dist/shared/index-C_1KP3l9.mjs +0 -129
- package/dist/shared/index-Dw5upK-A.cjs +0 -1
- package/dist/shared/index-fh9l84rU.mjs +0 -3541
- 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-B0CXLnL1.mjs +0 -132
- package/dist/shared/index.vue_vue_type_style_index_0_lang-DccRGtZE.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
- /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
- /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,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"),q=require("element-plus"),E=t.defineComponent({name:"QyMoneyInput",inheritAttrs:!1,__name:"index",props:{modelValue:{default:""},precision:{default:2},min:{default:void 0},max:{default:void 0},allowNegative:{type:Boolean,default:!1},formatTrigger:{default:"blur"},emptyValue:{default:""},placeholder:{default:void 0},clearable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},size:{default:void 0},name:{default:void 0},id:{default:void 0},autocomplete:{default:void 0},autofocus:{type:Boolean,default:!1},maxlength:{default:void 0},minlength:{default:void 0},tabindex:{default:void 0},ariaLabel:{default:void 0}},emits:["update:modelValue","input","change","focus","blur","clear","enter"],setup(l,{expose:g,emit:y}){const a=l,i=y,V=t.useAttrs(),d=t.ref(null),s=t.ref(u(a.modelValue)),N=t.computed(()=>u(a.modelValue));t.watch(()=>a.modelValue,e=>{s.value=u(e)});function u(e){return e==null?"":String(e)}function b(e){return Number.isFinite(e)?Math.max(0,Math.floor(e)):2}function m(e){const n=u(e);let r="",c=!1,x=!1;const h=b(a.precision);for(let f=0;f<n.length;f+=1){const o=n[f];if(o>="0"&&o<="9"){r+=o;continue}if(o==="."&&h>0&&!c){r+=o,c=!0;continue}o==="-"&&a.allowNegative&&f===0&&!x&&(r+=o,x=!0)}if(h>0&&c){const[f,o=""]=r.split(".");return`${f}.${o.slice(0,h)}`}return r}function $(e){let n=e;return typeof a.min=="number"&&Number.isFinite(a.min)&&(n=Math.max(n,a.min)),typeof a.max=="number"&&Number.isFinite(a.max)&&(n=Math.min(n,a.max)),n}function v(e){const n=m(e);if(!n||n==="-"||n===".")return u(a.emptyValue);const r=Number(n);if(Number.isNaN(r))return u(a.emptyValue);const c=b(a.precision);return $(r).toFixed(c)}function p(e){s.value=e,i("update:modelValue",e)}function w(e){const n=m(e);p(n)}function B(e){const n=m(e);s.value=n,i("input",n)}function C(e){const n=a.formatTrigger==="change"?v(e):m(e);n!==u(a.modelValue)&&p(n),i("change",n)}function M(e){i("focus",e)}function k(e){if(a.formatTrigger==="blur"){const n=v(s.value);n!==u(a.modelValue)&&p(n)}i("blur",e)}function z(){const e=u(a.emptyValue);s.value=e,i("update:modelValue",e),i("clear")}function F(e){i("enter",e)}function I(){var e,n;(n=(e=d.value)==null?void 0:e.focus)==null||n.call(e)}function S(){var e,n;(n=(e=d.value)==null?void 0:e.blur)==null||n.call(e)}function A(){var e,n;(n=(e=d.value)==null?void 0:e.select)==null||n.call(e)}function P(){var e,n;(n=(e=d.value)==null?void 0:e.clear)==null||n.call(e)}function T(){var e;return((e=d.value)==null?void 0:e.input)||null}return g({focus:I,blur:S,select:A,clear:P,getNativeInput:T}),(e,n)=>(t.openBlock(),t.createBlock(t.unref(q.ElInput),t.mergeProps({ref_key:"inputRef",ref:d},t.unref(V),{"model-value":N.value,inputmode:"decimal",placeholder:l.placeholder,clearable:l.clearable,disabled:l.disabled,readonly:l.readonly,size:l.size,name:l.name,id:l.id,autocomplete:l.autocomplete,autofocus:l.autofocus,maxlength:l.maxlength,minlength:l.minlength,tabindex:l.tabindex,"aria-label":l.ariaLabel,"onUpdate:modelValue":w,onInput:B,onChange:C,onFocus:M,onBlur:k,onClear:z,onKeydown:t.withKeys(F,["enter"])}),t.createSlots({_:2},[e.$slots.prefix?{name:"prefix",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"prefix")]),key:"0"}:void 0,e.$slots.suffix?{name:"suffix",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"suffix")]),key:"1"}:void 0,e.$slots.prepend?{name:"prepend",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"prepend")]),key:"2"}:void 0,e.$slots.append?{name:"append",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"append")]),key:"3"}:void 0]),1040,["model-value","placeholder","clearable","disabled","readonly","size","name","id","autocomplete","autofocus","maxlength","minlength","tabindex","aria-label"]))}});exports._sfc_main=E;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { defineComponent as I, useAttrs as L, computed as P, ref as c, onMounted as z, onBeforeUnmount as M, openBlock as N, createBlock as S, unref as k, mergeProps as A, createSlots as T, withCtx as s, renderSlot as d } from "vue";
|
|
2
|
+
import { ElInputNumber as U } from "element-plus";
|
|
3
|
+
const F = /* @__PURE__ */ I({
|
|
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
|
+
modelValue: { default: void 0 },
|
|
14
|
+
readonly: { type: Boolean, default: !1 },
|
|
15
|
+
disabled: { type: Boolean, default: !1 },
|
|
16
|
+
size: { default: void 0 },
|
|
17
|
+
controls: { type: Boolean, default: !0 },
|
|
18
|
+
controlsPosition: { default: "" },
|
|
19
|
+
valueOnClear: { default: null },
|
|
20
|
+
name: {},
|
|
21
|
+
placeholder: { default: "请输入数字" },
|
|
22
|
+
precision: { default: void 0 },
|
|
23
|
+
validateEvent: { type: Boolean },
|
|
24
|
+
ariaLabel: {}
|
|
25
|
+
},
|
|
26
|
+
emits: ["update:modelValue", "input", "change", "focus", "blur"],
|
|
27
|
+
setup(n, { expose: p, emit: b }) {
|
|
28
|
+
const t = n, o = b, h = L(), y = P(
|
|
29
|
+
() => Object.fromEntries(
|
|
30
|
+
Object.entries(h).filter(
|
|
31
|
+
([e]) => e === "class" || e === "style" || e === "title" || e === "role" || e.startsWith("data-") || e.startsWith("aria-")
|
|
32
|
+
)
|
|
33
|
+
)
|
|
34
|
+
), i = c(null), l = c(!1), f = c(t.modelValue);
|
|
35
|
+
function g() {
|
|
36
|
+
return t.valueOnClear === "min" ? t.min : t.valueOnClear === "max" ? t.max : t.valueOnClear;
|
|
37
|
+
}
|
|
38
|
+
function u(e = !1) {
|
|
39
|
+
var r, v;
|
|
40
|
+
if (!l.value) return;
|
|
41
|
+
l.value = !1;
|
|
42
|
+
const a = g();
|
|
43
|
+
o("update:modelValue", a), o("change", a, f.value), e && ((v = (r = i.value) == null ? void 0 : r.blur) == null || v.call(r));
|
|
44
|
+
}
|
|
45
|
+
function C(e) {
|
|
46
|
+
e === null && t.valueOnClear !== null && (l.value = !0, f.value = t.modelValue), o("update:modelValue", e);
|
|
47
|
+
}
|
|
48
|
+
function V(e) {
|
|
49
|
+
o("input", e);
|
|
50
|
+
}
|
|
51
|
+
function B(e, a) {
|
|
52
|
+
if (l.value && e === null) {
|
|
53
|
+
u();
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
l.value = !1, o("change", e, a);
|
|
57
|
+
}
|
|
58
|
+
function O(e) {
|
|
59
|
+
o("focus", e);
|
|
60
|
+
}
|
|
61
|
+
function x(e) {
|
|
62
|
+
l.value && e.target instanceof HTMLInputElement && e.target.value === "" && u(), o("blur", e);
|
|
63
|
+
}
|
|
64
|
+
function E(e) {
|
|
65
|
+
l.value && e.key === "Tab" && e.target instanceof HTMLInputElement && e.target.value === "" && u(!0);
|
|
66
|
+
}
|
|
67
|
+
function m(e) {
|
|
68
|
+
const a = e.target;
|
|
69
|
+
l.value && a instanceof Element && !a.closest(".qy-input-number") && u(!0);
|
|
70
|
+
}
|
|
71
|
+
function $() {
|
|
72
|
+
var e, a;
|
|
73
|
+
(a = (e = i.value) == null ? void 0 : e.focus) == null || a.call(e);
|
|
74
|
+
}
|
|
75
|
+
function w() {
|
|
76
|
+
var e, a;
|
|
77
|
+
(a = (e = i.value) == null ? void 0 : e.blur) == null || a.call(e);
|
|
78
|
+
}
|
|
79
|
+
return p({
|
|
80
|
+
focus: $,
|
|
81
|
+
blur: w
|
|
82
|
+
}), z(() => {
|
|
83
|
+
document.addEventListener("pointerdown", m, !0);
|
|
84
|
+
}), M(() => {
|
|
85
|
+
document.removeEventListener("pointerdown", m, !0);
|
|
86
|
+
}), (e, a) => (N(), S(k(U), A({
|
|
87
|
+
ref_key: "inputNumberRef",
|
|
88
|
+
ref: i
|
|
89
|
+
}, y.value, {
|
|
90
|
+
class: "qy-input-number",
|
|
91
|
+
"model-value": n.modelValue,
|
|
92
|
+
min: n.min,
|
|
93
|
+
max: n.max,
|
|
94
|
+
step: n.step,
|
|
95
|
+
"step-strictly": n.stepStrictly,
|
|
96
|
+
precision: n.precision,
|
|
97
|
+
controls: n.controls,
|
|
98
|
+
"controls-position": n.controlsPosition,
|
|
99
|
+
placeholder: n.placeholder,
|
|
100
|
+
disabled: n.disabled,
|
|
101
|
+
readonly: n.readonly,
|
|
102
|
+
size: n.size,
|
|
103
|
+
"value-on-clear": n.valueOnClear,
|
|
104
|
+
"validate-event": n.validateEvent,
|
|
105
|
+
id: n.id,
|
|
106
|
+
name: n.name,
|
|
107
|
+
"aria-label": n.ariaLabel,
|
|
108
|
+
"onUpdate:modelValue": C,
|
|
109
|
+
onInput: V,
|
|
110
|
+
onChange: B,
|
|
111
|
+
onFocus: O,
|
|
112
|
+
onBlur: x,
|
|
113
|
+
onKeydownCapture: E
|
|
114
|
+
}), T({ _: 2 }, [
|
|
115
|
+
e.$slots.prefix ? {
|
|
116
|
+
name: "prefix",
|
|
117
|
+
fn: s(() => [
|
|
118
|
+
d(e.$slots, "prefix")
|
|
119
|
+
]),
|
|
120
|
+
key: "0"
|
|
121
|
+
} : void 0,
|
|
122
|
+
e.$slots.suffix ? {
|
|
123
|
+
name: "suffix",
|
|
124
|
+
fn: s(() => [
|
|
125
|
+
d(e.$slots, "suffix")
|
|
126
|
+
]),
|
|
127
|
+
key: "1"
|
|
128
|
+
} : void 0,
|
|
129
|
+
e.$slots["increase-icon"] ? {
|
|
130
|
+
name: "increase-icon",
|
|
131
|
+
fn: s(() => [
|
|
132
|
+
d(e.$slots, "increase-icon")
|
|
133
|
+
]),
|
|
134
|
+
key: "2"
|
|
135
|
+
} : void 0,
|
|
136
|
+
e.$slots["decrease-icon"] ? {
|
|
137
|
+
name: "decrease-icon",
|
|
138
|
+
fn: s(() => [
|
|
139
|
+
d(e.$slots, "decrease-icon")
|
|
140
|
+
]),
|
|
141
|
+
key: "3"
|
|
142
|
+
} : void 0
|
|
143
|
+
]), 1040, ["model-value", "min", "max", "step", "step-strictly", "precision", "controls", "controls-position", "placeholder", "disabled", "readonly", "size", "value-on-clear", "validate-event", "id", "name", "aria-label"]));
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
export {
|
|
147
|
+
F as _
|
|
148
|
+
};
|
|
@@ -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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const n=require("vue"),E=require("element-plus"),$=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},modelValue:{default:void 0},readonly:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},size:{default:void 0},controls:{type:Boolean,default:!0},controlsPosition:{default:""},valueOnClear:{default:null},name:{},placeholder:{default:"请输入数字"},precision:{default:void 0},validateEvent:{type:Boolean},ariaLabel:{}},emits:["update:modelValue","input","change","focus","blur"],setup(t,{expose:m,emit:v}){const a=t,i=v,p=n.useAttrs(),h=n.computed(()=>Object.fromEntries(Object.entries(p).filter(([e])=>e==="class"||e==="style"||e==="title"||e==="role"||e.startsWith("data-")||e.startsWith("aria-")))),u=n.ref(null),o=n.ref(!1),d=n.ref(a.modelValue);function b(){return a.valueOnClear==="min"?a.min:a.valueOnClear==="max"?a.max:a.valueOnClear}function r(e=!1){var s,f;if(!o.value)return;o.value=!1;const l=b();i("update:modelValue",l),i("change",l,d.value),e&&((f=(s=u.value)==null?void 0:s.blur)==null||f.call(s))}function y(e){e===null&&a.valueOnClear!==null&&(o.value=!0,d.value=a.modelValue),i("update:modelValue",e)}function C(e){i("input",e)}function g(e,l){if(o.value&&e===null){r();return}o.value=!1,i("change",e,l)}function x(e){i("focus",e)}function V(e){o.value&&e.target instanceof HTMLInputElement&&e.target.value===""&&r(),i("blur",e)}function B(e){o.value&&e.key==="Tab"&&e.target instanceof HTMLInputElement&&e.target.value===""&&r(!0)}function c(e){const l=e.target;o.value&&l instanceof Element&&!l.closest(".qy-input-number")&&r(!0)}function O(){var e,l;(l=(e=u.value)==null?void 0:e.focus)==null||l.call(e)}function w(){var e,l;(l=(e=u.value)==null?void 0:e.blur)==null||l.call(e)}return m({focus:O,blur:w}),n.onMounted(()=>{document.addEventListener("pointerdown",c,!0)}),n.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",c,!0)}),(e,l)=>(n.openBlock(),n.createBlock(n.unref(E.ElInputNumber),n.mergeProps({ref_key:"inputNumberRef",ref:u},h.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,"validate-event":t.validateEvent,id:t.id,name:t.name,"aria-label":t.ariaLabel,"onUpdate:modelValue":y,onInput:C,onChange:g,onFocus:x,onBlur:V,onKeydownCapture: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","validate-event","id","name","aria-label"]))}});exports._sfc_main=$;
|
|
@@ -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
|
+
};
|