@qynpm/ui 1.0.45 → 1.0.46
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 +7 -2
- package/dist/index.cjs +10 -3
- package/dist/index.mjs +258 -92
- package/dist/qy-action-bar/index.cjs +3 -1
- package/dist/qy-action-bar/index.mjs +7 -2
- package/dist/qy-button/index.cjs +1 -1
- package/dist/qy-button/index.mjs +1 -1
- package/dist/qy-cascader/index.cjs +1 -1
- package/dist/qy-cascader/index.mjs +1 -1
- package/dist/qy-checkbox/index.cjs +1 -1
- package/dist/qy-checkbox/index.mjs +1 -1
- package/dist/qy-checkbox-group/index.cjs +1 -1
- package/dist/qy-checkbox-group/index.mjs +1 -1
- package/dist/qy-collapse/index.cjs +1 -1
- package/dist/qy-collapse/index.mjs +1 -1
- package/dist/qy-color-picker/index.cjs +1 -1
- package/dist/qy-color-picker/index.mjs +1 -1
- package/dist/qy-date-picker/index.cjs +1 -1
- package/dist/qy-date-picker/index.mjs +1 -1
- package/dist/qy-dialog/index.cjs +3 -2
- package/dist/qy-dialog/index.mjs +7 -5
- 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 +3 -1
- package/dist/qy-form-section/index.mjs +7 -2
- package/dist/qy-fullscreen/index.cjs +1 -1
- package/dist/qy-fullscreen/index.mjs +1 -1
- package/dist/qy-icon/index.cjs +1 -1
- package/dist/qy-icon/index.mjs +2 -2
- package/dist/qy-icon-picker/index.cjs +1 -1
- package/dist/qy-icon-picker/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.mjs +2 -2
- package/dist/qy-image-upload/index.cjs +3 -1
- package/dist/qy-image-upload/index.mjs +7 -2
- package/dist/qy-input/index.cjs +1 -1
- package/dist/qy-input/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 -1
- package/dist/qy-input-tag/index.mjs +151 -5
- package/dist/qy-legacy-selection-dialog/index.cjs +8 -1
- package/dist/qy-legacy-selection-dialog/index.mjs +12 -2
- package/dist/qy-menu-actions/index.cjs +1 -1
- package/dist/qy-menu-actions/index.mjs +1 -1
- package/dist/qy-pagination/index.cjs +1 -1
- package/dist/qy-pagination/index.mjs +1 -1
- package/dist/qy-popconfirm/index.cjs +1 -1
- package/dist/qy-popconfirm/index.mjs +1 -1
- package/dist/qy-popover/index.cjs +1 -1
- package/dist/qy-popover/index.mjs +1 -1
- package/dist/qy-radio/index.cjs +1 -1
- package/dist/qy-radio/index.mjs +1 -1
- package/dist/qy-radio-group/index.cjs +1 -1
- package/dist/qy-radio-group/index.mjs +1 -1
- package/dist/qy-record-quote-search/index.cjs +4 -1
- package/dist/qy-record-quote-search/index.mjs +8 -2
- package/dist/qy-remark-image/index.cjs +3 -1
- package/dist/qy-remark-image/index.mjs +11 -2
- package/dist/qy-remote-select/index.cjs +3 -1
- package/dist/qy-remote-select/index.mjs +7 -2
- package/dist/qy-result/index.cjs +1 -1
- package/dist/qy-result/index.mjs +1 -1
- package/dist/qy-scrollbar/index.cjs +1 -1
- package/dist/qy-scrollbar/index.mjs +1 -1
- package/dist/qy-search-input/index.cjs +3 -1
- package/dist/qy-search-input/index.mjs +7 -2
- package/dist/qy-select/index.cjs +1 -1
- package/dist/qy-select/index.mjs +1 -1
- package/dist/qy-selection-dialog/index.cjs +7 -1
- package/dist/qy-selection-dialog/index.mjs +11 -2
- package/dist/qy-switch/index.cjs +1 -1
- package/dist/qy-switch/index.mjs +1 -1
- package/dist/qy-table-column-settings/index.cjs +1 -1
- package/dist/qy-table-column-settings/index.mjs +1 -1
- package/dist/qy-tabs/index.cjs +1 -1
- package/dist/qy-tabs/index.mjs +1 -1
- package/dist/qy-tag/index.cjs +1 -1
- package/dist/qy-tag/index.mjs +1 -1
- package/dist/qy-tooltip/index.cjs +1 -1
- package/dist/qy-tooltip/index.mjs +1 -1
- package/dist/qy-tree/index.cjs +1 -1
- package/dist/qy-tree/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-DEoy2IfN.mjs → index-B0CTzdRW.mjs} +1 -1
- package/dist/shared/index-BN4A-O6P.mjs +727 -0
- package/dist/shared/index-BR7tIt2k.mjs +211 -0
- package/dist/shared/index-BaRw7pWi.mjs +156 -0
- package/dist/shared/index-BqzKToOL.cjs +1 -0
- package/dist/shared/{index-DM0zanTb.mjs → index-Bzr2RHi5.mjs} +1 -1
- package/dist/shared/index-C50jpQ11.mjs +295 -0
- package/dist/shared/{index-CsfcDlq4.cjs → index-CIXJwYI-.cjs} +1 -1
- package/dist/shared/index-CKkanVur.cjs +1 -0
- package/dist/shared/index-CLvL8LAM.cjs +1 -0
- package/dist/shared/index-CN2mgT5V.cjs +1 -0
- package/dist/shared/{index-uMEKxoXj.mjs → index-CW4s627w.mjs} +1 -1
- package/dist/shared/{index-8Iwma3ls.mjs → index-CXOCZlps.mjs} +2 -2
- package/dist/shared/{index-CUlhX6fW.cjs → index-CXnL-0Kp.cjs} +1 -1
- package/dist/shared/index-CZs0V4ze.cjs +1 -0
- package/dist/shared/index-Cqr-L0yd.mjs +285 -0
- package/dist/shared/{index-CjImIyvI.mjs → index-Cu6yAwdj.mjs} +1 -1
- package/dist/shared/index-D5HS8M1P.cjs +1 -0
- package/dist/shared/index-D6QwZtYV.mjs +56 -0
- package/dist/shared/index-DCsun70c.cjs +1 -0
- package/dist/shared/{index-D359jZg_.cjs → index-DEzFHeJL.cjs} +1 -1
- package/dist/shared/{index-2D5AFexl.mjs → index-DNMRIYkm.mjs} +1 -1
- package/dist/shared/index-DiN5vXXD.cjs +1 -0
- package/dist/shared/{index-Mj7JZt7y.cjs → index-Duq5XZ5w.cjs} +1 -1
- package/dist/shared/index-DwHM9eYc.cjs +1 -0
- package/dist/shared/{index-DOpfxPDq.cjs → index-FZ5gl2au.cjs} +1 -1
- package/dist/shared/index-PM5yNugz.mjs +573 -0
- package/dist/shared/index-VtM0GmfU.mjs +361 -0
- package/dist/shared/index-ykI9hKtc.mjs +88 -0
- package/dist/shared/{index.vue_vue_type_script_setup_true_lang-qXBKqHCs.mjs → index.vue_vue_type_script_setup_true_lang-4CNzVpgF.mjs} +2 -2
- package/dist/shared/{index.vue_vue_type_script_setup_true_lang-BNKC9382.cjs → index.vue_vue_type_script_setup_true_lang-D3MxDFk1.cjs} +1 -1
- package/dist/shared/{index.vue_vue_type_script_setup_true_lang-Bypkl4Ty.mjs → index.vue_vue_type_script_setup_true_lang-DECgTYqI.mjs} +1 -1
- package/dist/shared/{index.vue_vue_type_script_setup_true_lang-CYaK3oDY.cjs → index.vue_vue_type_script_setup_true_lang-DW2JKXjA.cjs} +1 -1
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-DeFEEJk8.cjs +1 -0
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-GUuWAB0o.mjs +238 -0
- package/dist/shared/{index.vue_vue_type_script_setup_true_lang-Byp7e--Y.mjs → index.vue_vue_type_script_setup_true_lang-mWNAIcqc.mjs} +1 -1
- package/dist/shared/{index.vue_vue_type_style_index_0_lang-D2iiEHqM.mjs → index.vue_vue_type_style_index_0_lang-BLRxKB-e.mjs} +1 -1
- package/dist/shared/{index.vue_vue_type_style_index_0_lang-z2Unl0WQ.mjs → index.vue_vue_type_style_index_0_lang-Ba6d5zw4.mjs} +1 -1
- package/dist/shared/{index.vue_vue_type_style_index_0_lang-OHPkiKBo.cjs → index.vue_vue_type_style_index_0_lang-C4yXFBV_.cjs} +1 -1
- package/dist/shared/{index.vue_vue_type_style_index_0_lang-DbQkbvgb.mjs → index.vue_vue_type_style_index_0_lang-CuTyK1Ey.mjs} +3 -3
- package/dist/shared/{index.vue_vue_type_style_index_0_lang-BI4abIsm.mjs → index.vue_vue_type_style_index_0_lang-CvVl_Y56.mjs} +21 -21
- package/dist/shared/js.cookie-BA-dL3zT.mjs +74 -0
- package/dist/shared/js.cookie-BmJmHEx1.cjs +1 -0
- package/dist/shared/{overlay-stack-CFFRngnU.mjs → overlay-stack-eI-yzYU6.mjs} +2 -2
- package/dist/shared/{utils-CUXINmHY.mjs → utils-DpZkMLkb.mjs} +1 -1
- package/index.d.ts +0 -3
- package/package.json +1 -1
- package/qy-remark-image/index.d.ts +4 -0
- package/dist/shared/index-BvXyRAhX.cjs +0 -1
- package/dist/shared/index-CPW3gKgP.mjs +0 -2429
- package/dist/shared/index-CUwUz-Le.cjs +0 -1
- package/dist/shared/index-DPqFEuPp.mjs +0 -798
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-CPm8gzId.cjs +0 -1
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-DkMm40Ac.mjs +0 -151
- /package/dist/shared/{index-DiEag4sK.cjs → index-5UAiwqdT.cjs} +0 -0
- /package/dist/shared/{index-BhpomD_C.cjs → index-AvNvmJe5.cjs} +0 -0
- /package/dist/shared/{index-_e-HwHF0.mjs → index-B1J7PQMl.mjs} +0 -0
- /package/dist/shared/{index-C5hzCMaD.mjs → index-B7j9BtSm.mjs} +0 -0
- /package/dist/shared/{index-BcDt1tKY.mjs → index-BAOV5iYx.mjs} +0 -0
- /package/dist/shared/{index-B3GsIwhf.mjs → index-BKdw4jD_.mjs} +0 -0
- /package/dist/shared/{index-B25yA5j-.mjs → index-BVaIvVMi.mjs} +0 -0
- /package/dist/shared/{index-HNFq7v-A.cjs → index-Bdlzmh8A.cjs} +0 -0
- /package/dist/shared/{index-MEzLM_rM.cjs → index-BgAP_K2E.cjs} +0 -0
- /package/dist/shared/{index-BfA7ZJnJ.cjs → index-Blgz8PJc.cjs} +0 -0
- /package/dist/shared/{index-Bq9quq2D.cjs → index-BsNtvE6i.cjs} +0 -0
- /package/dist/shared/{index-9G8dxxVx.mjs → index-BuVrLl5B.mjs} +0 -0
- /package/dist/shared/{index-Bfmf0msc.mjs → index-Bv1DrJ32.mjs} +0 -0
- /package/dist/shared/{index-DaUdmOjn.cjs → index-C6G9eVku.cjs} +0 -0
- /package/dist/shared/{index-DWBkjY5O.cjs → index-CB0v25oB.cjs} +0 -0
- /package/dist/shared/{index-B3YHS3Aa.mjs → index-CGH2ROZV.mjs} +0 -0
- /package/dist/shared/{index-BfXhDFFn.cjs → index-CxTyKMEH.cjs} +0 -0
- /package/dist/shared/{index-MyPNS-OR.cjs → index-DY2IXvwl.cjs} +0 -0
- /package/dist/shared/{index-XSV-GmR2.mjs → index-DdGlwebp.mjs} +0 -0
- /package/dist/shared/{index-ByQyMTPg.mjs → index-DvXzDAmi.mjs} +0 -0
- /package/dist/shared/{index-EIFVul2W.cjs → index-O6K0DO_k.cjs} +0 -0
- /package/dist/shared/{index-B3XwO-Lc.mjs → index-QN7-6GpS.mjs} +0 -0
- /package/dist/shared/{index-CVWru9T3.cjs → index-_Bagw0Pj.cjs} +0 -0
- /package/dist/shared/{index.vue_vue_type_script_setup_true_lang-BnIolx5s.cjs → index.vue_vue_type_script_setup_true_lang-2ZOn9XPM.cjs} +0 -0
- /package/dist/shared/{index.vue_vue_type_script_setup_true_lang-wG7OTsWa.mjs → index.vue_vue_type_script_setup_true_lang-DM0MGPZh.mjs} +0 -0
- /package/dist/shared/{index.vue_vue_type_style_index_0_lang-CVdFZeHK.mjs → index.vue_vue_type_style_index_0_lang-90f2jQr7.mjs} +0 -0
- /package/dist/shared/{index.vue_vue_type_style_index_0_lang-Dt19xolk.cjs → index.vue_vue_type_style_index_0_lang-B4fDeQox.cjs} +0 -0
- /package/dist/shared/{index.vue_vue_type_style_index_0_lang-hbNK_h45.cjs → index.vue_vue_type_style_index_0_lang-BNL5vyrU.cjs} +0 -0
- /package/dist/shared/{index.vue_vue_type_style_index_0_lang-gs0YJI91.mjs → index.vue_vue_type_style_index_0_lang-BvBAR8A1.mjs} +0 -0
- /package/dist/shared/{index.vue_vue_type_style_index_0_lang-BZZ8vhEf.cjs → index.vue_vue_type_style_index_0_lang-BzJsAWKD.cjs} +0 -0
- /package/dist/shared/{index.vue_vue_type_style_index_0_lang-C1n-zAZh.mjs → index.vue_vue_type_style_index_0_lang-C7L66EnO.mjs} +0 -0
- /package/dist/shared/{index.vue_vue_type_style_index_0_lang-CYIUfOy9.cjs → index.vue_vue_type_style_index_0_lang-CFp5MK6j.cjs} +0 -0
- /package/dist/shared/{index.vue_vue_type_style_index_0_lang-Tzo8o6M8.mjs → index.vue_vue_type_style_index_0_lang-CN3dJjUV.mjs} +0 -0
- /package/dist/shared/{index.vue_vue_type_style_index_0_lang-CPxbKjvY.mjs → index.vue_vue_type_style_index_0_lang-CNdV3Mnk.mjs} +0 -0
- /package/dist/shared/{index.vue_vue_type_style_index_0_lang-W44zpeKW.cjs → index.vue_vue_type_style_index_0_lang-CVAm3ApY.cjs} +0 -0
- /package/dist/shared/{index.vue_vue_type_style_index_0_lang-B1FgJZbw.mjs → index.vue_vue_type_style_index_0_lang-CgScSrRJ.mjs} +0 -0
- /package/dist/shared/{index.vue_vue_type_style_index_0_lang-DFAaBzkW.cjs → index.vue_vue_type_style_index_0_lang-Clt7QDAK.cjs} +0 -0
- /package/dist/shared/{index.vue_vue_type_style_index_0_lang-WGzoSatU.cjs → index.vue_vue_type_style_index_0_lang-CvlRVqcl.cjs} +0 -0
- /package/dist/shared/{index.vue_vue_type_style_index_0_lang-BNBJu1Mq.cjs → index.vue_vue_type_style_index_0_lang-D-p1u8y8.cjs} +0 -0
- /package/dist/shared/{index.vue_vue_type_style_index_0_lang-DzvboHR2.mjs → index.vue_vue_type_style_index_0_lang-D9T_xdbu.mjs} +0 -0
- /package/dist/shared/{index.vue_vue_type_style_index_0_lang-E92uiH6Q.cjs → index.vue_vue_type_style_index_0_lang-DGV7FQlw.cjs} +0 -0
- /package/dist/shared/{index.vue_vue_type_style_index_0_lang-KHk9wRYT.mjs → index.vue_vue_type_style_index_0_lang-DGt78p3G.mjs} +0 -0
- /package/dist/shared/{index.vue_vue_type_style_index_0_lang-shJS7iXC.mjs → index.vue_vue_type_style_index_0_lang-DZOPXZov.mjs} +0 -0
- /package/dist/shared/{index.vue_vue_type_style_index_0_lang-BXTkWo5P.cjs → index.vue_vue_type_style_index_0_lang-J7wvS2CR.cjs} +0 -0
- /package/dist/shared/{index.vue_vue_type_style_index_0_lang-Bpe6LkvL.mjs → index.vue_vue_type_style_index_0_lang-KXiTSh4t.mjs} +0 -0
- /package/dist/shared/{index.vue_vue_type_style_index_0_lang-DVXf-yUs.cjs → index.vue_vue_type_style_index_0_lang-YEjVWWsy.cjs} +0 -0
- /package/dist/shared/{index.vue_vue_type_style_index_0_lang-D9DraThL.cjs → index.vue_vue_type_style_index_0_lang-nS-EDK4t.cjs} +0 -0
- /package/dist/shared/{index.vue_vue_type_style_index_0_lang-BnPRHCwR.cjs → index.vue_vue_type_style_index_0_lang-yci929so.cjs} +0 -0
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { defineComponent as Z, useAttrs as _, ref as s, computed as w, watch as $, onBeforeUnmount as ee, openBlock as le, createBlock as te, mergeProps as ae, unref as E, createSlots as oe, withCtx as m, renderSlot as p, createCommentVNode as ne, normalizeProps as ue, guardReactiveProps as ie } from "vue";
|
|
2
|
+
import { useFormDisabled as re } from "element-plus";
|
|
3
|
+
import { S as de } from "./index-B7j9BtSm.mjs";
|
|
4
|
+
const me = /* @__PURE__ */ Z({
|
|
5
|
+
name: "QyRemoteSelect",
|
|
6
|
+
inheritAttrs: !1,
|
|
7
|
+
__name: "index",
|
|
8
|
+
props: {
|
|
9
|
+
modelValue: { type: [String, Number, Boolean, Array, null], default: void 0 },
|
|
10
|
+
fetchMethod: {},
|
|
11
|
+
defaultOptions: { default: () => [] },
|
|
12
|
+
labelKey: { default: "label" },
|
|
13
|
+
valueKey: { default: "value" },
|
|
14
|
+
disabledKey: { default: "disabled" },
|
|
15
|
+
placeholder: { default: "请选择" },
|
|
16
|
+
disabled: { type: Boolean, default: void 0 },
|
|
17
|
+
clearable: { type: Boolean, default: !0 },
|
|
18
|
+
multiple: { type: Boolean, default: !1 },
|
|
19
|
+
multipleLimit: { default: 0 },
|
|
20
|
+
validateEvent: { type: Boolean, default: !0 },
|
|
21
|
+
collapseTags: { type: Boolean, default: !1 },
|
|
22
|
+
collapseTagsTooltip: { type: Boolean, default: !1 },
|
|
23
|
+
autoSelectSingle: { type: Boolean, default: !1 },
|
|
24
|
+
size: { default: void 0 },
|
|
25
|
+
teleported: { type: Boolean, default: !0 },
|
|
26
|
+
appendTo: { default: "body" },
|
|
27
|
+
fitInputWidth: { type: Boolean, default: !0 },
|
|
28
|
+
popperClass: { default: "" },
|
|
29
|
+
debounce: { default: 300 },
|
|
30
|
+
minLength: { default: 1 },
|
|
31
|
+
remoteOnFocus: { type: Boolean, default: !1 },
|
|
32
|
+
remoteShowSuffix: { type: Boolean, default: !0 },
|
|
33
|
+
loading: { type: Boolean, default: !1 },
|
|
34
|
+
reserveSelectedOption: { type: Boolean, default: !0 },
|
|
35
|
+
allowCreate: { type: Boolean, default: !1 },
|
|
36
|
+
commitOnBlur: { type: Boolean, default: !1 }
|
|
37
|
+
},
|
|
38
|
+
emits: ["update:modelValue", "change", "clear", "visible-change", "focus", "blur", "options-change", "loading-change", "error"],
|
|
39
|
+
setup(t, { expose: z, emit: A }) {
|
|
40
|
+
const a = t, o = A, L = _(), b = re(), B = s(null), i = s([]), V = s(/* @__PURE__ */ new Map()), O = s(!1), c = s(""), f = s("");
|
|
41
|
+
let d = 0, u = null;
|
|
42
|
+
const M = w(() => a.loading || O.value), S = s(!1), R = w(() => c.value !== ""), r = w(() => {
|
|
43
|
+
if (R.value) return i.value;
|
|
44
|
+
const e = /* @__PURE__ */ new Map(), l = (n) => {
|
|
45
|
+
e.set(C(n), n);
|
|
46
|
+
};
|
|
47
|
+
return a.defaultOptions.forEach(l), a.reserveSelectedOption && V.value.forEach((n) => l(n)), i.value.forEach(l), Array.from(e.values());
|
|
48
|
+
});
|
|
49
|
+
$(
|
|
50
|
+
() => a.defaultOptions,
|
|
51
|
+
(e) => {
|
|
52
|
+
e.forEach(v);
|
|
53
|
+
},
|
|
54
|
+
{ immediate: !0 }
|
|
55
|
+
), $(
|
|
56
|
+
() => a.modelValue,
|
|
57
|
+
() => {
|
|
58
|
+
r.value.forEach(v);
|
|
59
|
+
},
|
|
60
|
+
{ immediate: !0 }
|
|
61
|
+
);
|
|
62
|
+
function C(e) {
|
|
63
|
+
return (e == null ? void 0 : e[a.valueKey]) ?? (e == null ? void 0 : e.value) ?? (e == null ? void 0 : e.label);
|
|
64
|
+
}
|
|
65
|
+
function I(e) {
|
|
66
|
+
return Array.isArray(a.modelValue) ? a.modelValue.includes(e) : a.modelValue === e;
|
|
67
|
+
}
|
|
68
|
+
function v(e) {
|
|
69
|
+
if (!a.reserveSelectedOption) return;
|
|
70
|
+
const l = C(e);
|
|
71
|
+
I(l) && V.value.set(l, e);
|
|
72
|
+
}
|
|
73
|
+
function x(e) {
|
|
74
|
+
return b.value ? !1 : e ? e.length >= a.minLength : a.remoteOnFocus;
|
|
75
|
+
}
|
|
76
|
+
function h(e) {
|
|
77
|
+
O.value !== e && (O.value = e, o("loading-change", e));
|
|
78
|
+
}
|
|
79
|
+
async function g(e) {
|
|
80
|
+
const l = k(e), n = ++d;
|
|
81
|
+
if (F(l), !x(l)) {
|
|
82
|
+
i.value = [], h(!1), o("options-change", r.value);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
h(!0);
|
|
86
|
+
try {
|
|
87
|
+
const y = await a.fetchMethod(l);
|
|
88
|
+
if (n !== d) return;
|
|
89
|
+
i.value = Array.isArray(y) ? y : [], i.value.forEach(v), o("options-change", r.value);
|
|
90
|
+
} catch (y) {
|
|
91
|
+
if (n !== d) return;
|
|
92
|
+
i.value = [], o("error", y), o("options-change", r.value);
|
|
93
|
+
} finally {
|
|
94
|
+
n === d && h(!1);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function T() {
|
|
98
|
+
S.value || (S.value = !0, g(""));
|
|
99
|
+
}
|
|
100
|
+
function P(e) {
|
|
101
|
+
const l = k(e);
|
|
102
|
+
f.value = l, d += 1, F(l), u && (clearTimeout(u), u = null), u = setTimeout(() => {
|
|
103
|
+
g(l);
|
|
104
|
+
}, a.debounce);
|
|
105
|
+
}
|
|
106
|
+
function D() {
|
|
107
|
+
S.value = !0, g("");
|
|
108
|
+
}
|
|
109
|
+
function U() {
|
|
110
|
+
g(c.value);
|
|
111
|
+
}
|
|
112
|
+
function q(e) {
|
|
113
|
+
f.value = "", o("update:modelValue", e);
|
|
114
|
+
}
|
|
115
|
+
function N(e) {
|
|
116
|
+
f.value = "", r.value.forEach(v), o("change", e);
|
|
117
|
+
}
|
|
118
|
+
function W() {
|
|
119
|
+
K(), o("clear");
|
|
120
|
+
}
|
|
121
|
+
function K() {
|
|
122
|
+
d += 1, u && clearTimeout(u), u = null, f.value = "", c.value = "", i.value = [], h(!1), o("options-change", r.value);
|
|
123
|
+
}
|
|
124
|
+
function Q(e) {
|
|
125
|
+
e && a.remoteOnFocus && !c.value && T(), o("visible-change", e);
|
|
126
|
+
}
|
|
127
|
+
function j(e) {
|
|
128
|
+
a.remoteOnFocus && !c.value && T(), o("focus", e);
|
|
129
|
+
}
|
|
130
|
+
function G(e) {
|
|
131
|
+
H(), o("blur", e);
|
|
132
|
+
}
|
|
133
|
+
function H() {
|
|
134
|
+
if (!a.allowCreate || !a.commitOnBlur || b.value) return;
|
|
135
|
+
const e = f.value;
|
|
136
|
+
e.trim() && (f.value = "", o("update:modelValue", e), o("change", e));
|
|
137
|
+
}
|
|
138
|
+
function k(e) {
|
|
139
|
+
return String(e ?? "");
|
|
140
|
+
}
|
|
141
|
+
function F(e) {
|
|
142
|
+
c.value = e, i.value = [], o("options-change", r.value);
|
|
143
|
+
}
|
|
144
|
+
function J() {
|
|
145
|
+
var e, l;
|
|
146
|
+
(l = (e = B.value) == null ? void 0 : e.focus) == null || l.call(e);
|
|
147
|
+
}
|
|
148
|
+
function X() {
|
|
149
|
+
var e, l;
|
|
150
|
+
(l = (e = B.value) == null ? void 0 : e.blur) == null || l.call(e);
|
|
151
|
+
}
|
|
152
|
+
function Y() {
|
|
153
|
+
K(), o("update:modelValue", a.multiple ? [] : ""), o("clear");
|
|
154
|
+
}
|
|
155
|
+
return ee(() => {
|
|
156
|
+
d += 1, u && clearTimeout(u);
|
|
157
|
+
}), z({
|
|
158
|
+
// 暴露远程选择常用控制方法,供弹窗打开后聚焦或请求失败后重试。
|
|
159
|
+
focus: J,
|
|
160
|
+
blur: X,
|
|
161
|
+
clear: Y,
|
|
162
|
+
retryFetch: U,
|
|
163
|
+
fetchDefaultOptions: D
|
|
164
|
+
}), (e, l) => (le(), te(de, ae({
|
|
165
|
+
ref_key: "selectRef",
|
|
166
|
+
ref: B
|
|
167
|
+
}, E(L), {
|
|
168
|
+
"model-value": t.modelValue,
|
|
169
|
+
options: r.value,
|
|
170
|
+
"label-key": t.labelKey,
|
|
171
|
+
"value-key": t.valueKey,
|
|
172
|
+
"disabled-key": t.disabledKey,
|
|
173
|
+
placeholder: t.placeholder,
|
|
174
|
+
disabled: E(b),
|
|
175
|
+
clearable: t.clearable,
|
|
176
|
+
filterable: !0,
|
|
177
|
+
multiple: t.multiple,
|
|
178
|
+
"multiple-limit": t.multipleLimit,
|
|
179
|
+
"validate-event": t.validateEvent,
|
|
180
|
+
"collapse-tags": t.collapseTags,
|
|
181
|
+
"collapse-tags-tooltip": t.collapseTagsTooltip,
|
|
182
|
+
"auto-select-single": t.autoSelectSingle,
|
|
183
|
+
size: t.size,
|
|
184
|
+
teleported: t.teleported,
|
|
185
|
+
"append-to": t.appendTo,
|
|
186
|
+
"fit-input-width": t.fitInputWidth,
|
|
187
|
+
"popper-class": t.popperClass,
|
|
188
|
+
remote: "",
|
|
189
|
+
debounce: 0,
|
|
190
|
+
"remote-show-suffix": t.remoteShowSuffix,
|
|
191
|
+
"remote-method": P,
|
|
192
|
+
loading: M.value,
|
|
193
|
+
"onUpdate:modelValue": q,
|
|
194
|
+
onChange: N,
|
|
195
|
+
onClear: W,
|
|
196
|
+
onVisibleChange: Q,
|
|
197
|
+
onFocus: j,
|
|
198
|
+
onBlur: G
|
|
199
|
+
}), oe({
|
|
200
|
+
default: m(() => [
|
|
201
|
+
e.$slots.default ? p(e.$slots, "default", {}, void 0, void 0, 0) : ne("", !0)
|
|
202
|
+
]),
|
|
203
|
+
_: 2
|
|
204
|
+
}, [
|
|
205
|
+
e.$slots.prefix ? {
|
|
206
|
+
name: "prefix",
|
|
207
|
+
fn: m(() => [
|
|
208
|
+
p(e.$slots, "prefix")
|
|
209
|
+
]),
|
|
210
|
+
key: "0"
|
|
211
|
+
} : void 0,
|
|
212
|
+
e.$slots.empty ? {
|
|
213
|
+
name: "empty",
|
|
214
|
+
fn: m(() => [
|
|
215
|
+
p(e.$slots, "empty")
|
|
216
|
+
]),
|
|
217
|
+
key: "1"
|
|
218
|
+
} : void 0,
|
|
219
|
+
e.$slots.loading ? {
|
|
220
|
+
name: "loading",
|
|
221
|
+
fn: m(() => [
|
|
222
|
+
p(e.$slots, "loading")
|
|
223
|
+
]),
|
|
224
|
+
key: "2"
|
|
225
|
+
} : void 0,
|
|
226
|
+
e.$slots.tag ? {
|
|
227
|
+
name: "tag",
|
|
228
|
+
fn: m((n) => [
|
|
229
|
+
p(e.$slots, "tag", ue(ie(n)))
|
|
230
|
+
]),
|
|
231
|
+
key: "3"
|
|
232
|
+
} : void 0
|
|
233
|
+
]), 1040, ["model-value", "options", "label-key", "value-key", "disabled-key", "placeholder", "disabled", "clearable", "multiple", "multiple-limit", "validate-event", "collapse-tags", "collapse-tags-tooltip", "auto-select-single", "size", "teleported", "append-to", "fit-input-width", "popper-class", "remote-show-suffix", "loading"]));
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
export {
|
|
237
|
+
me as _
|
|
238
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as f, useAttrs as p, computed as b, openBlock as l, createBlock as i, unref as h, mergeProps as x, withCtx as o, renderSlot as g, createElementBlock as C, Fragment as V, renderList as _, createTextVNode as E, toDisplayString as B } from "vue";
|
|
2
2
|
import { ElCheckboxGroup as z } from "element-plus";
|
|
3
|
-
import { C as $ } from "./index-
|
|
3
|
+
import { C as $ } from "./index-B1J7PQMl.mjs";
|
|
4
4
|
const k = /* @__PURE__ */ f({
|
|
5
5
|
name: "QyCheckboxGroup",
|
|
6
6
|
inheritAttrs: !1,
|
|
@@ -2,7 +2,7 @@ import { ElDialog as xe, ElIcon as be } from "element-plus/es";
|
|
|
2
2
|
import { defineComponent as ke, useSlots as _e, ref as r, computed as C, createVNode as z, watchEffect as Ce, watch as ie, h as se, nextTick as M, onMounted as ze, onUnmounted as Be, openBlock as a, createBlock as R, unref as B, withCtx as b, createElementVNode as l, normalizeClass as O, createSlots as Ee, normalizeStyle as Z, createElementBlock as u, createCommentVNode as y, renderSlot as E, toDisplayString as re, withModifiers as d, withDirectives as Se, vShow as Le } from "vue";
|
|
3
3
|
import qe from "clsx";
|
|
4
4
|
import { useZIndex as Me, ElButton as de, ElConfigProvider as Oe } from "element-plus";
|
|
5
|
-
import { r as V,
|
|
5
|
+
import { r as V, i as Ie } from "./overlay-stack-eI-yzYU6.mjs";
|
|
6
6
|
import { Close as $e } from "@element-plus/icons-vue";
|
|
7
7
|
import { useBreakpoints as Te, useDraggable as De } from "@vueuse/core";
|
|
8
8
|
const He = { class: "text-lg flex items-center pt-2 pl-[var(--content-padding)]" }, Fe = { key: 0 }, Ne = { key: 1 }, je = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as M, computed as f, ref as y, getCurrentInstance as Q, useSlots as R, watch as w, onBeforeUnmount as G, onMounted as H, openBlock as k, createBlock as q, unref as J, withCtx as C, renderSlot as X, createElementBlock as Y, Fragment as Z, renderList as x, resolveDynamicComponent as V } from "vue";
|
|
2
2
|
import { ElPopover as _ } from "element-plus";
|
|
3
|
-
import {
|
|
3
|
+
import { a as ee, c as te } from "./overlay-stack-eI-yzYU6.mjs";
|
|
4
4
|
const ne = 1e3, le = /* @__PURE__ */ M({
|
|
5
5
|
name: "QyPopover",
|
|
6
6
|
inheritAttrs: !1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),Q=require("./index-
|
|
1
|
+
"use strict";const e=require("vue"),Q=require("./index-CXnL-0Kp.cjs"),T=require("./index-Bdlzmh8A.cjs"),J=require("../qy-popover/index.cjs"),S=require("./index-_Bagw0Pj.cjs");function X(l,f){const v=f==null?"":String(f),n=l&&v?l.resolve(v):void 0;return Object.freeze({value:v,known:!!n,canonicalName:n==null?void 0:n.name,definition:n})}function Z(l,f,v=""){const n=(l==null?void 0:l.list())??[],c=f===void 0?void 0:new Set(f.map(r=>{var p;return(p=l==null?void 0:l.resolve(r))==null?void 0:p.name}).filter(r=>!!r).map(z)),d=String(v).trim().toLocaleLowerCase();return Object.freeze(n.filter(r=>c&&!c.has(z(r.name))?!1:d?[r.name,r.label,...r.keywords??[]].some(p=>typeof p=="string"&&p.toLocaleLowerCase().includes(d)):!0))}function z(l){return S.normalizeQyIconName(l).toLocaleLowerCase()}const ee={class:"qy-icon-picker"},ae=["onKeydown"],ne={class:"qy-icon-picker__preview","aria-hidden":"true"},oe={key:1,class:"qy-icon-picker__missing","aria-hidden":"true"},te=["id"],le={class:"qy-icon-picker__search","data-testid":"qy-icon-picker-search"},re={key:0,class:"qy-icon-picker__state","data-testid":"qy-icon-picker-loading",role:"status"},ie={key:1,class:"qy-icon-picker__state qy-icon-picker__state--error","data-testid":"qy-icon-picker-error",role:"alert"},ce=["aria-label"],ue=["id","data-qy-icon-option","data-qy-icon-active","aria-selected","tabindex","onClick","onFocus","onKeydown"],se={class:"qy-icon-picker__option-label"},de={key:3,class:"qy-icon-picker__empty"};let pe=0;const fe=e.defineComponent({name:"QyIconPicker",__name:"index",props:{modelValue:{default:""},allowedNames:{},disabled:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},size:{default:"default"},placeholder:{default:"点击选择图标"},searchPlaceholder:{default:"搜索图标名称、标签或关键词"},emptyText:{default:"暂无匹配图标"},panelWidth:{default:540},open:{type:Boolean,default:void 0},id:{},ariaLabel:{}},emits:["update:modelValue","change","clear","update:open","open-change"],setup(l,{expose:f,emit:v}){const n=l,c=v,d=e.inject(S.QY_ICON_REGISTRY_KEY,null),r=e.ref(""),p=e.ref(!1),i=e.ref(-1),w=e.ref([]),m=e.ref(!1),g=e.ref(""),V=e.ref(0);let x=!1;const h=e.ref(null),L=e.ref(null),q=e.ref("pointer"),$=`qy-icon-picker-${++pe}`,y=e.computed(()=>X(d,n.modelValue)),s=e.computed(()=>(V.value,Z(d,n.allowedNames,r.value))),_=e.computed(()=>n.open!==void 0),k=e.computed(()=>_.value?n.open===!0:p.value),M=e.computed(()=>"click"),B=e.computed(()=>`${n.id||$}-panel`);e.watch(k,(a,o)=>{!a||o||(r.value="",i.value=F(),w.value=[],!x&&d&&(x=!0,K(d.load())),q.value==="keyboard"&&e.nextTick(()=>{var t,u;return(u=(t=L.value)==null?void 0:t.focus)==null?void 0:u.call(t)}))});function K(a){m.value=!0,g.value="",a.then(()=>{m.value=!1,V.value++},o=>{m.value=!1,g.value=o instanceof Error?o.message:String(o)})}function A(){!d||m.value||K(d.retry())}e.watch(s,()=>{if(!s.value.length){i.value=-1;return}i.value>=s.value.length&&(i.value=0),i.value<0&&(i.value=0)});function P(){n.disabled||(q.value="keyboard",C("keyboard"))}function D(a){n.disabled||_.value&&n.open!==!1||(a.stopImmediatePropagation(),C("pointer"))}function O(a){I(a)}function U(a){a===k.value&&(_.value||(p.value=a),c("open-change",a),a||e.nextTick(()=>{var o,t;return(t=(o=h.value)==null?void 0:o.focus)==null?void 0:t.call(o)}))}function I(a){a&&n.disabled||a!==k.value&&(_.value||(p.value=a),c("update:open",a))}function C(a="programmatic"){q.value=a,I(!0)}function E(){I(!1),e.nextTick(()=>{var a,o;return(o=(a=h.value)==null?void 0:a.focus)==null?void 0:o.call(a)})}function R(){n.disabled||(c("update:modelValue",""),c("change",""),c("clear"))}function N(a){n.disabled||(c("update:modelValue",a.name),c("change",a.name),E())}function j(a){if(a.key==="Escape"){a.preventDefault(),E();return}if(!s.value.length||!["ArrowDown","ArrowUp","ArrowLeft","ArrowRight"].includes(a.key))return;a.preventDefault();const o=a.key==="ArrowUp"||a.key==="ArrowLeft"?-1:1,t=s.value.length;i.value=(i.value+o+t)%t,e.nextTick(()=>{var u;return(u=w.value[i.value])==null?void 0:u.focus()})}function F(){const a=y.value.canonicalName;if(!a)return s.value.length?0:-1;const o=s.value.findIndex(({name:t})=>t===a);return o>=0?o:s.value.length?0:-1}function Y(a,o){a instanceof HTMLElement&&(w.value[o]=a)}function W(a){return`${B.value}-${encodeURIComponent(a)}`}function G(){var a,o;(o=(a=h.value)==null?void 0:a.focus)==null||o.call(a)}function H(){var a,o;(o=(a=h.value)==null?void 0:a.blur)==null||o.call(a)}return f({focus:G,blur:H,open:C,close:E}),(a,o)=>(e.openBlock(),e.createElementBlock("div",ee,[e.createVNode(e.unref(J.QyPopover),{ref:"popoverRef",class:"qy-icon-picker__popover",open:k.value,trigger:M.value,placement:"bottom-start",width:n.panelWidth,"show-delay":0,"hide-delay":0,disabled:n.disabled||_.value&&n.open===!1,"onUpdate:open":O,onOpenChange:U},{reference:e.withCtx(()=>[e.createElementVNode("div",{class:"qy-icon-picker__trigger","data-testid":"qy-icon-picker-trigger",onClick:D,onKeydown:[e.withKeys(e.withModifiers(P,["prevent"]),["enter"]),e.withKeys(e.withModifiers(P,["prevent"]),["space"])]},[e.createVNode(e.unref(T.QyInput),{ref_key:"triggerRef",ref:h,id:n.id,"model-value":y.value.value,size:n.size,disabled:n.disabled,clearable:n.clearable,readonly:"",placeholder:n.placeholder,"aria-label":n.ariaLabel,"aria-haspopup":"listbox","aria-expanded":k.value?"true":"false","aria-controls":B.value,onClear:R},{prefix:e.withCtx(()=>[e.createElementVNode("span",ne,[y.value.definition?(e.openBlock(),e.createBlock(e.unref(Q.QyIcon),{key:0,name:y.value.definition.name,size:18},null,8,["name"])):(e.openBlock(),e.createElementBlock("span",oe,"?"))])]),suffix:e.withCtx(()=>[n.clearable&&y.value.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"qy-icon-picker__clear","data-testid":"qy-icon-picker-clear","aria-label":"清空图标",onClick:e.withModifiers(R,["stop","prevent"])},[...o[1]||(o[1]=[e.createElementVNode("span",{"aria-hidden":"true"},"×",-1)])])):e.createCommentVNode("",!0)]),_:1},8,["id","model-value","size","disabled","clearable","placeholder","aria-label","aria-expanded","aria-controls"])],40,ae)]),default:e.withCtx(()=>[k.value?(e.openBlock(),e.createElementBlock("div",{key:0,id:B.value,class:"qy-icon-picker__panel",onKeydown:j},[e.createElementVNode("div",le,[e.createVNode(e.unref(T.QyInput),{ref_key:"searchRef",ref:L,modelValue:r.value,"onUpdate:modelValue":o[0]||(o[0]=t=>r.value=t),type:"search",clearable:"",placeholder:n.searchPlaceholder,"aria-label":"搜索图标"},null,8,["modelValue","placeholder"])]),m.value?(e.openBlock(),e.createElementBlock("div",re," 正在加载图标… ")):g.value?(e.openBlock(),e.createElementBlock("div",ie,[e.createElementVNode("span",null,e.toDisplayString(g.value),1),e.createElementVNode("button",{type:"button","data-testid":"qy-icon-picker-retry",onClick:A}," 重试 ")])):s.value.length?(e.openBlock(),e.createElementBlock("div",{key:2,class:"qy-icon-picker__grid",role:"listbox","aria-label":n.ariaLabel||"图标列表"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,(t,u)=>(e.openBlock(),e.createElementBlock("div",{id:W(t.name),key:t.name,ref_for:!0,ref:b=>Y(b,u),class:e.normalizeClass(["qy-icon-picker__option",{"is-active":i.value===u}]),"data-qy-icon-option":t.name,"data-qy-icon-active":i.value===u?"true":void 0,role:"option","aria-selected":y.value.canonicalName===t.name?"true":"false",tabindex:i.value===u?0:-1,onClick:b=>N(t),onFocus:b=>i.value=u,onKeydown:[e.withKeys(e.withModifiers(b=>N(t),["prevent"]),["enter"]),e.withKeys(e.withModifiers(b=>N(t),["prevent"]),["space"])]},[e.createVNode(e.unref(Q.QyIcon),{name:t.name,size:18,"aria-hidden":"true"},null,8,["name"]),e.createElementVNode("span",se,e.toDisplayString(t.label||t.name),1)],42,ue))),128))],8,ce)):(e.openBlock(),e.createElementBlock("div",de,[e.renderSlot(a.$slots,"empty",{},()=>[e.createTextVNode(e.toDisplayString(n.emptyText),1)])]))],40,te)):e.createCommentVNode("",!0)]),_:3},8,["open","trigger","width","disabled"])]))}});exports._sfc_main=fe;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { defineComponent as ue, inject as se, ref as d, computed as b, watch as M, nextTick as Q, openBlock as u, createElementBlock as p, createVNode as R, unref as C, withCtx as z, createElementVNode as h, toDisplayString as S, Fragment as de, renderList as pe, withKeys as K, withModifiers as L, normalizeClass as fe, renderSlot as ve, createTextVNode as ye, createCommentVNode as Y, createBlock as me } from "vue";
|
|
2
|
-
import { Q as W } from "./index-
|
|
3
|
-
import { Q as G } from "./index-
|
|
2
|
+
import { Q as W } from "./index-DNMRIYkm.mjs";
|
|
3
|
+
import { Q as G } from "./index-BKdw4jD_.mjs";
|
|
4
4
|
import { QyPopover as he } from "../qy-popover/index.mjs";
|
|
5
|
-
import { n as _e, Q as ke } from "./index-
|
|
5
|
+
import { n as _e, Q as ke } from "./index-DvXzDAmi.mjs";
|
|
6
6
|
function be(l, y) {
|
|
7
7
|
const m = y == null ? "" : String(y), a = l && m ? l.resolve(m) : void 0;
|
|
8
8
|
return Object.freeze({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent as fe, useAttrs as pe, ref as l, computed as f, getCurrentInstance as me, watch as q, onMounted as ve, onBeforeUnmount as ye, openBlock as A, createElementBlock as X, mergeProps as ge, createVNode as I, unref as N, withCtx as T, createElementVNode as g, normalizeClass as we, renderSlot as R, createBlock as he, resolveDynamicComponent as be, createCommentVNode as Ee, createTextVNode as $, toDisplayString as F } from "vue";
|
|
2
2
|
import { CircleCloseFilled as Le, InfoFilled as ke, WarningFilled as Ce } from "@element-plus/icons-vue";
|
|
3
3
|
import { ElPopover as qe, ElButton as Y } from "element-plus";
|
|
4
|
-
import {
|
|
4
|
+
import { a as Te, c as Se } from "./overlay-stack-eI-yzYU6.mjs";
|
|
5
5
|
const p = [], Be = { class: "qy-popconfirm__message" }, De = {
|
|
6
6
|
key: 0,
|
|
7
7
|
class: "qy-popconfirm__icon",
|
|
@@ -29,7 +29,7 @@ const p = [], Be = { class: "qy-popconfirm__message" }, De = {
|
|
|
29
29
|
},
|
|
30
30
|
emits: ["update:open", "open-change", "confirm", "cancel", "close"],
|
|
31
31
|
setup(o, { emit: Z }) {
|
|
32
|
-
const t = o, s = Z, _ = pe(), w = l(null), S = l(null), W = f(() => t.open !== void 0), B = t.open === !0 && !t.disabled, D = l(B), c = l(B),
|
|
32
|
+
const t = o, s = Z, _ = pe(), w = l(null), S = l(null), W = f(() => t.open !== void 0), B = t.open === !0 && !t.disabled, D = l(B), c = l(B), a = l(B), i = l(null), m = l(!1), h = l(null), b = {}, O = `qy-popconfirm-${me().uid}`, P = /* @__PURE__ */ new WeakSet();
|
|
33
33
|
let d = !1, v, E, L = !1, k = null;
|
|
34
34
|
const V = f(() => t.disabled ? !1 : W.value ? t.open === !0 : D.value), ee = f(() => {
|
|
35
35
|
const e = {};
|
|
@@ -71,37 +71,37 @@ const p = [], Be = { class: "qy-popconfirm__message" }, De = {
|
|
|
71
71
|
const e = V.value;
|
|
72
72
|
c.value !== e && (d = !0, v = e, E = e ? void 0 : i.value ?? (t.disabled ? "disabled" : "external"), c.value = e);
|
|
73
73
|
}
|
|
74
|
-
function
|
|
74
|
+
function r(e, n) {
|
|
75
75
|
e && t.disabled || (!e && n && i.value === null && (i.value = n), W.value ? t.open !== e && s("update:open", e) : D.value !== e && (D.value = e, s("update:open", e)), u());
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function ae() {
|
|
78
78
|
var e;
|
|
79
79
|
return i.value ? i.value : k instanceof Node && ((e = w.value) != null && e.contains(k)) ? "trigger" : "outside";
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function re(e) {
|
|
82
82
|
if (e) {
|
|
83
|
-
H(),
|
|
83
|
+
H(), r(!0);
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
86
|
if (t.confirmLoading) return;
|
|
87
|
-
const n =
|
|
88
|
-
!x() && n !== "external" && n !== "disabled" ||
|
|
87
|
+
const n = ae();
|
|
88
|
+
!x() && n !== "external" && n !== "disabled" || r(!1, n);
|
|
89
89
|
}
|
|
90
90
|
function le(e) {
|
|
91
91
|
var n;
|
|
92
|
-
!(e.target instanceof Node) || !((n = S.value) != null && n.contains(e.target)) || t.confirmLoading || (
|
|
92
|
+
!(e.target instanceof Node) || !((n = S.value) != null && n.contains(e.target)) || t.confirmLoading || (a.value || c.value ? (i.value = "trigger", r(!1, "trigger")) : (H(e), r(!0)));
|
|
93
93
|
}
|
|
94
94
|
function se() {
|
|
95
|
-
t.disabled || t.confirmLoading || m.value || (m.value = !0, s("confirm"), t.closeOnConfirm &&
|
|
95
|
+
t.disabled || t.confirmLoading || m.value || (m.value = !0, s("confirm"), t.closeOnConfirm && r(!1, "confirm"));
|
|
96
96
|
}
|
|
97
97
|
function ce() {
|
|
98
|
-
t.disabled || t.confirmLoading || (s("cancel"),
|
|
98
|
+
t.disabled || t.confirmLoading || (s("cancel"), r(!1, "cancel"));
|
|
99
99
|
}
|
|
100
100
|
function K(e) {
|
|
101
|
-
e.key !== "Escape" && e.code !== "Escape" || e.defaultPrevented || !
|
|
101
|
+
e.key !== "Escape" && e.code !== "Escape" || e.defaultPrevented || !a.value || !x() || Te(document.querySelector(`.${O}`)) && (Se(e), P.add(e));
|
|
102
102
|
}
|
|
103
103
|
function C(e) {
|
|
104
|
-
P.has(e) && (P.delete(e), e.stopPropagation(), !e.defaultPrevented && (e.preventDefault(), e.stopImmediatePropagation(), !t.confirmLoading &&
|
|
104
|
+
P.has(e) && (P.delete(e), e.stopPropagation(), !e.defaultPrevented && (e.preventDefault(), e.stopImmediatePropagation(), !t.confirmLoading && r(!1, "escape")));
|
|
105
105
|
}
|
|
106
106
|
function Q(e) {
|
|
107
107
|
k = e.target;
|
|
@@ -111,31 +111,31 @@ const p = [], Be = { class: "qy-popconfirm__message" }, De = {
|
|
|
111
111
|
}
|
|
112
112
|
function j(e) {
|
|
113
113
|
var n;
|
|
114
|
-
t.confirmLoading || !
|
|
114
|
+
t.confirmLoading || !a.value || !x() || e.target instanceof Node && ((n = w.value) != null && n.contains(e.target) || e.target instanceof Element && e.target.closest(".qy-popconfirm-popper") || r(!1, "outside"));
|
|
115
115
|
}
|
|
116
116
|
function de() {
|
|
117
|
-
!d || v !== !0 || (d = !1, v = void 0,
|
|
117
|
+
!d || v !== !0 || (d = !1, v = void 0, a.value = !0, z(), i.value = null, E = void 0, s("open-change", !0), u());
|
|
118
118
|
}
|
|
119
119
|
function ue() {
|
|
120
|
-
!d || v !== !1 || (d = !1, v = void 0,
|
|
120
|
+
!d || v !== !1 || (d = !1, v = void 0, a.value = !1, M(), s("open-change", !1), s("close", E ?? i.value ?? "external"), i.value = null, E = void 0, m.value = !1, L = !1, ie(), u());
|
|
121
121
|
}
|
|
122
122
|
return q(V, () => u()), q(
|
|
123
123
|
() => t.open,
|
|
124
124
|
(e, n) => {
|
|
125
|
-
e !== n && (e === !1 && (
|
|
125
|
+
e !== n && (e === !1 && (a.value || c.value) && i.value === null && (i.value = "external"), u());
|
|
126
126
|
}
|
|
127
127
|
), q(
|
|
128
128
|
() => t.disabled,
|
|
129
129
|
(e) => {
|
|
130
|
-
e && (
|
|
130
|
+
e && (a.value || c.value) && (i.value = "disabled"), u();
|
|
131
131
|
}
|
|
132
132
|
), q(
|
|
133
133
|
() => t.confirmLoading,
|
|
134
134
|
(e) => {
|
|
135
|
-
e ? L = !0 : L && (L = !1,
|
|
135
|
+
e ? L = !0 : L && (L = !1, a.value && (m.value = !1));
|
|
136
136
|
}
|
|
137
137
|
), ve(() => {
|
|
138
|
-
|
|
138
|
+
a.value && z(), window.addEventListener("keydown", K, !0), document.body.addEventListener("keydown", C), window.addEventListener("keydown", C), document.addEventListener("pointerdown", Q, !0), document.addEventListener("mousedown", U, !0), document.addEventListener("click", j);
|
|
139
139
|
}), ye(() => {
|
|
140
140
|
M(), window.removeEventListener("keydown", K, !0), document.body.removeEventListener("keydown", C), window.removeEventListener("keydown", C), document.removeEventListener("pointerdown", Q, !0), document.removeEventListener("mousedown", U, !0), document.removeEventListener("click", j);
|
|
141
141
|
}), (e, n) => (A(), X("span", ge({
|
|
@@ -151,7 +151,7 @@ const p = [], Be = { class: "qy-popconfirm__message" }, De = {
|
|
|
151
151
|
disabled: o.disabled,
|
|
152
152
|
"popper-style": te.value,
|
|
153
153
|
"popper-class": `qy-popconfirm-popper ${O}`,
|
|
154
|
-
"onUpdate:visible":
|
|
154
|
+
"onUpdate:visible": re,
|
|
155
155
|
onAfterEnter: de,
|
|
156
156
|
onAfterLeave: ue
|
|
157
157
|
}, {
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/*! js-cookie v3.0.8 | MIT */
|
|
2
|
+
function u(r) {
|
|
3
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
4
|
+
var f = arguments[t];
|
|
5
|
+
for (var p in f)
|
|
6
|
+
p !== "__proto__" && (r[p] = f[p]);
|
|
7
|
+
}
|
|
8
|
+
return r;
|
|
9
|
+
}
|
|
10
|
+
var g = {
|
|
11
|
+
read: function(r) {
|
|
12
|
+
return r[0] === '"' && (r = r.slice(1, -1)), r.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
|
|
13
|
+
},
|
|
14
|
+
write: function(r) {
|
|
15
|
+
return encodeURIComponent(r).replace(
|
|
16
|
+
/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
|
|
17
|
+
decodeURIComponent
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
function s(r, t) {
|
|
22
|
+
function f(n, c, e) {
|
|
23
|
+
if (!(typeof document > "u")) {
|
|
24
|
+
e = u({}, t, e), typeof e.expires == "number" && (e.expires = new Date(Date.now() + e.expires * 864e5)), e.expires && (e.expires = e.expires.toUTCString()), n = encodeURIComponent(n).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
|
|
25
|
+
var o = "";
|
|
26
|
+
for (var i in e)
|
|
27
|
+
e[i] && (o += "; " + i, e[i] !== !0 && (o += "=" + e[i].split(";")[0]));
|
|
28
|
+
return document.cookie = n + "=" + r.write(c, n) + o;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function p(n) {
|
|
32
|
+
if (!(typeof document > "u" || arguments.length && !n)) {
|
|
33
|
+
for (var c = document.cookie ? document.cookie.split("; ") : [], e = {}, o = 0; o < c.length; o++) {
|
|
34
|
+
var i = c[o].split("="), v = i.slice(1).join("=");
|
|
35
|
+
try {
|
|
36
|
+
var d = decodeURIComponent(i[0]);
|
|
37
|
+
if (d in e || (e[d] = r.read(v, d)), n === d)
|
|
38
|
+
break;
|
|
39
|
+
} catch {
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return n ? e[n] : e;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return Object.create(
|
|
46
|
+
{
|
|
47
|
+
set: f,
|
|
48
|
+
get: p,
|
|
49
|
+
remove: function(n, c) {
|
|
50
|
+
f(
|
|
51
|
+
n,
|
|
52
|
+
"",
|
|
53
|
+
u({}, c, {
|
|
54
|
+
expires: -1
|
|
55
|
+
})
|
|
56
|
+
);
|
|
57
|
+
},
|
|
58
|
+
withAttributes: function(n) {
|
|
59
|
+
return s(this.converter, u({}, this.attributes, n));
|
|
60
|
+
},
|
|
61
|
+
withConverter: function(n) {
|
|
62
|
+
return s(u({}, this.converter, n), this.attributes);
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
attributes: { value: Object.freeze(t) },
|
|
67
|
+
converter: { value: Object.freeze(r) }
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
var a = s(g, { path: "/" });
|
|
72
|
+
export {
|
|
73
|
+
a
|
|
74
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";/*! js-cookie v3.0.8 | MIT */function u(r){for(var t=1;t<arguments.length;t++){var f=arguments[t];for(var p in f)p!=="__proto__"&&(r[p]=f[p])}return r}var g={read:function(r){return r[0]==='"'&&(r=r.slice(1,-1)),r.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(r){return encodeURIComponent(r).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function s(r,t){function f(n,c,e){if(!(typeof document>"u")){e=u({},t,e),typeof e.expires=="number"&&(e.expires=new Date(Date.now()+e.expires*864e5)),e.expires&&(e.expires=e.expires.toUTCString()),n=encodeURIComponent(n).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o="";for(var i in e)e[i]&&(o+="; "+i,e[i]!==!0&&(o+="="+e[i].split(";")[0]));return document.cookie=n+"="+r.write(c,n)+o}}function p(n){if(!(typeof document>"u"||arguments.length&&!n)){for(var c=document.cookie?document.cookie.split("; "):[],e={},o=0;o<c.length;o++){var i=c[o].split("="),v=i.slice(1).join("=");try{var d=decodeURIComponent(i[0]);if(d in e||(e[d]=r.read(v,d)),n===d)break}catch{}}return n?e[n]:e}}return Object.create({set:f,get:p,remove:function(n,c){f(n,"",u({},c,{expires:-1}))},withAttributes:function(n){return s(this.converter,u({},this.attributes,n))},withConverter:function(n){return s(u({},this.converter,n),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(r)}})}var C=s(g,{path:"/"});exports.api=C;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { h as v, createApp as I } from "vue";
|
|
2
2
|
import { useZIndex as b, ElImageViewer as _ } from "element-plus";
|
|
3
|
-
import { r as R } from "./overlay-stack-
|
|
3
|
+
import { r as R } from "./overlay-stack-eI-yzYU6.mjs";
|
|
4
4
|
let p = 0, w = "";
|
|
5
5
|
function E() {
|
|
6
6
|
if (typeof document > "u") return () => {
|
package/index.d.ts
CHANGED
|
@@ -63,7 +63,6 @@ import type QyAvatarComponent from './qy-avatar'
|
|
|
63
63
|
import type QyTreeComponent from './qy-tree'
|
|
64
64
|
import type QyPaginationComponent from './qy-pagination'
|
|
65
65
|
import type QyInputComponent from './qy-input'
|
|
66
|
-
import type QyInputTagComponent from './qy-input-tag'
|
|
67
66
|
import type QyInputNumberComponent from './qy-input-number'
|
|
68
67
|
import type QyDatePickerComponent from './qy-date-picker'
|
|
69
68
|
import type QyMoneyInputComponent from './qy-money-input'
|
|
@@ -557,7 +556,6 @@ export const QyDialog: typeof QyDialogComponent
|
|
|
557
556
|
export const QyButton: Plugin
|
|
558
557
|
export const QyDropdown: Plugin
|
|
559
558
|
export const QyInput: typeof QyInputComponent
|
|
560
|
-
export const QyInputTag: typeof QyInputTagComponent
|
|
561
559
|
export { QyInputNumber } from './qy-input-number'
|
|
562
560
|
export const QyMoneyInput: typeof QyMoneyInputComponent
|
|
563
561
|
export const QyDatePicker: typeof QyDatePickerComponent
|
|
@@ -652,7 +650,6 @@ declare const _default: Plugin & {
|
|
|
652
650
|
QyButton: typeof QyButton
|
|
653
651
|
QyDropdown: typeof QyDropdown
|
|
654
652
|
QyInput: typeof QyInput
|
|
655
|
-
QyInputTag: typeof QyInputTagComponent
|
|
656
653
|
QyInputNumber: typeof QyInputNumberComponent
|
|
657
654
|
QyMoneyInput: typeof QyMoneyInput
|
|
658
655
|
QyDatePicker: typeof QyDatePickerComponent
|
package/package.json
CHANGED
|
@@ -43,3 +43,7 @@ export interface QyRemarkImageExposed {
|
|
|
43
43
|
}
|
|
44
44
|
declare const QyRemarkImage: DefineComponent<QyRemarkImageProps, QyRemarkImageExposed, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, QyRemarkImageEmits> & Plugin
|
|
45
45
|
export default QyRemarkImage
|
|
46
|
+
|
|
47
|
+
export function parseRemarkText(remarkText: string): { imageUrl: string; text: string }
|
|
48
|
+
export function formatRemarkText(text: string): string
|
|
49
|
+
export function parseRemarkWithImage(text: string, imageUrl?: string): string
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const F=require("element-plus"),n=require("vue"),xe=require("@element-plus/icons-vue"),y=require("element-plus"),Xe=require("./_plugin-vue_export-helper-BHFhmbuH.cjs");/*! js-cookie v3.0.8 | MIT */function L(s){for(var k=1;k<arguments.length;k++){var U=arguments[k];for(var a in U)a!=="__proto__"&&(s[a]=U[a])}return s}var He={read:function(s){return s[0]==='"'&&(s=s.slice(1,-1)),s.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(s){return encodeURIComponent(s).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function G(s,k){function U(u,b,f){if(!(typeof document>"u")){f=L({},k,f),typeof f.expires=="number"&&(f.expires=new Date(Date.now()+f.expires*864e5)),f.expires&&(f.expires=f.expires.toUTCString()),u=encodeURIComponent(u).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var w="";for(var r in f)f[r]&&(w+="; "+r,f[r]!==!0&&(w+="="+f[r].split(";")[0]));return document.cookie=u+"="+s.write(b,u)+w}}function a(u){if(!(typeof document>"u"||arguments.length&&!u)){for(var b=document.cookie?document.cookie.split("; "):[],f={},w=0;w<b.length;w++){var r=b[w].split("="),T=r.slice(1).join("=");try{var B=decodeURIComponent(r[0]);if(B in f||(f[B]=s.read(T,B)),u===B)break}catch{}}return u?f[u]:f}}return Object.create({set:U,get:a,remove:function(u,b){U(u,"",L({},b,{expires:-1}))},withAttributes:function(u){return G(this.converter,L({},this.attributes,u))},withConverter:function(u){return G(L({},this.converter,u),this.attributes)}},{attributes:{value:Object.freeze(k)},converter:{value:Object.freeze(s)}})}var Ve=G(He,{path:"/"});const Je="Admin-Token";function Qe(s=Je){return Ve.get(s)}const Ge=["accept","multiple","disabled"],Ye=["disabled"],Ze={class:"qy-upload__hint"},et=["placeholder","disabled"],tt=["src"],nt={key:1,class:"qy-upload__tip"},lt={class:"error"},ot={class:"error"},at=Object.assign({name:"QyUpload"},{__name:"index",props:{modelValue:{type:[Object,Array,String],default:void 0},selectedFiles:{type:Array,default:()=>[]},autoUpload:{type:Boolean,default:!0},variant:{type:String,default:"media-card"},defaultValue:{type:Object,default:()=>({files:"",text:""})},valueFormat:{type:String,default:"object"},showText:{type:Boolean,default:!0},showPasteInput:{type:Boolean,default:!1},pastePlaceholder:{type:String,default:"输入文字"},multiple:{type:Boolean,default:!0},disabled:{type:Boolean,default:void 0},fileType:{type:Array,default:()=>[]},fileSize:{type:Number,default:10},limit:{type:Number,default:9},isShowTip:{type:Boolean,default:!1},api:{type:String,default:"/permission-api/common/uploads"},name:{type:String,default:"file"},tokenKey:{type:String,default:"Admin-Token"},supportVideo:{type:Boolean,default:!1},size:{type:String,default:"default"},disableDrag:{type:Boolean,default:!1},callBack:{type:Function,default:null},extraData:{type:Object,default:()=>({})},uploadRequest:{type:Function,default:null}},emits:["update:modelValue","update:selectedFiles","selectedFilesChange","change","success","error","remove","invalid"],setup(s,{expose:k,emit:U}){const a=s,u=U,b=n.ref(null),f=n.ref(null),w=n.ref(null),r=n.ref([]),T=n.ref(null),B=n.ref(null),M=new Map,Y=new WeakMap;let P=Date.now(),O=!1;const $=n.ref(!1),K=n.ref([]),Z=n.ref(0),R=n.ref(!1),ee=n.ref(""),te=n.ref(""),j=new Set,N=new Map;function z(e){j.delete(e)&&URL.revokeObjectURL(e)}function ne(){for(const e of j)z(e)}function I(e){const t=N.get(e);t&&(N.delete(e),t.close())}function le(){for(const e of N.keys())I(e)}function oe(e){var t;(t=M.get(e))==null||t()}function ae(){for(const e of M.values())e()}const _=n.ref(!1),x=n.ref(""),W=n.ref(!1);n.onMounted(()=>{a.modelValue!==void 0||!a.autoUpload||ue(a.defaultValue)});const ke=n.computed(()=>({large:"160px",default:"140px",small:"80px"})[a.size]??a.size),h=y.useFormDisabled(),be=n.computed(()=>r.value.some(e=>e.status==="uploading")),Ce=n.computed(()=>a.variant==="file-list"||a.supportVideo?"text":"picture-card"),ie=n.computed(()=>a.supportVideo?1:!a.autoUpload&&!a.multiple?2:a.limit),Ue=n.computed(()=>{var e;return a.isShowTip&&(a.fileSize||((e=V.value)==null?void 0:e.length))}),V=n.computed(()=>{var e;return(e=a.fileType)!=null&&e.length?a.fileType.map(t=>String(t).trim().replace(/^\./,"").toLowerCase()).filter(Boolean):a.variant==="file-list"?[]:a.supportVideo?["mp4","mov","avi"]:["jpg","jpeg","png","gif","webp"]}),E=n.computed(()=>{if(!a.autoUpload&&!a.multiple)return!1;const e=a.supportVideo?1:a.limit;return r.value.length>=e}),re=n.computed(()=>V.value.map(e=>`.${e}`).join(",")),Be=n.computed(()=>({"qy-upload--reached-limit":E.value,"qy-upload--disabled":h.value,"qy-upload--video":a.supportVideo,"qy-upload--without-text":!a.showText&&!a.showPasteInput}));n.watch(x,()=>{O||q()}),n.watch(()=>a.modelValue,e=>{a.autoUpload&&e!==void 0&&ue(e)},{immediate:!0,deep:!0}),n.watch(()=>[a.autoUpload,a.selectedFiles],([e,t])=>{e||(r.value=S(t))},{immediate:!0,deep:!0});function se(e){return Array.isArray(e)?e.filter(Boolean):e?String(e).split(",").filter(Boolean):[]}function Fe(e){return Array.isArray(e)?{files:e,text:""}:typeof e=="string"?{files:se(e),text:""}:e&&typeof e=="object"?{files:se(e.files),text:e.text??""}:{files:[],text:""}}function Me(e=[]){return e.map((t,l)=>({name:String(t).split("/").pop()||`file-${l}`,url:t,status:"success",uid:y.genFileId()}))}function S(e=[]){return e.filter(Boolean).map((t,l)=>{const o=n.toRaw(t);return{name:o.name,raw:o,status:"ready",uid:Re(o,l)}})}function Re(e,t){if(e.uid!=null)return e.uid;const l=Y.get(e);return l??(P+=t+1,Y.set(e,P),P)}function X(e=r.value){return e.map(t=>{const l=t.raw??(t instanceof File?t:null);return l?n.toRaw(l):null}).filter(Boolean)}function A(e){u("update:selectedFiles",e),u("selectedFilesChange",e)}function Ne(e,t){if(a.autoUpload)return;const l=e==null?void 0:e.raw;if(l&&!H(l)){r.value=S(a.selectedFiles);return}const o=X(t);l&&!o.includes(l)&&o.push(l);const i=a.multiple?o:o.slice(-1);r.value=S(i),A(i)}function Se(e){const t=new Set(e.map(o=>o.url)),l=r.value.filter(o=>(o.status==="ready"||o.status==="uploading")&&!t.has(o.url));return[...e,...l]}function ue(e){const t=Fe(e);O=!0,x.value=t.text,r.value=Se(Me(t.files)),n.nextTick(()=>{O=!1})}function de(e){return a.valueFormat==="array"?e.files:a.valueFormat==="string"?e.files.join(","):e}function qe(){var e;(e=T.value)==null||e.focus()}function De(e){e.target.value=""}function q(e){const o={files:(e??r.value).filter(i=>i.status==="success"&&i.url).map(i=>i.url),text:x.value};u("update:modelValue",de(o)),u("change",o),a.callBack&&a.callBack(o)}function Te(e,t){if(I(e.uid),oe(e.uid),z(e.url),!a.autoUpload){const l=X(t);r.value=S(l),A(l),u("remove",e,t);return}q(t),u("remove",e,t)}function ce(e){var l;const t=(e==null?void 0:e.name)||"";return t.includes(".")&&((l=t.split(".").pop())==null?void 0:l.toLowerCase())||""}function pe(e){var i,c,d;const t=((c=(i=e==null?void 0:e.type)==null?void 0:i.toLowerCase)==null?void 0:c.call(i))||"",l={"image/jpeg":["jpg","jpeg"],"image/png":["png"],"image/gif":["gif"],"image/bmp":["bmp"],"image/webp":["webp"],"video/mp4":["mp4"],"video/quicktime":["mov"],"video/x-msvideo":["avi"],"video/webm":["webm"]};if(l[t])return l[t];const o=(d=t.split("/")[1])==null?void 0:d.split("+")[0];return o?[o]:[]}function je(e){if(!V.value.length)return!0;const t=ce(e),l=pe(e);return[t,...l].some(o=>V.value.includes(o))}function H(e){if(a.fileSize>0&&e.size>a.fileSize*1024*1024){const l={code:"size",file:e,message:`文件大小不能超过${a.fileSize}M`};return y.ElMessage.warning(l.message),u("invalid",l),!1}if(!je(e)){const l={code:"extension",file:e,message:`格式不支持,仅允许: ${V.value.join("/")}`};return y.ElMessage.warning(l.message),u("invalid",l),!1}return!0}async function ze(e,t,l,o,i){const c=fe(e),d={close:()=>o.close()};N.set(i,d);const m=()=>N.get(i)===d;try{const p=await a.uploadRequest({file:e,formData:c,api:a.api,name:a.name,tokenKey:a.tokenKey,extraData:a.extraData});if(!m())return;const v=Ie(p);if(!v){const C=new Error("上传失败,未返回文件地址");y.ElMessage.error(C.message),u("error",C),l==null||l(C);return}y.ElMessage.success("上传成功"),t==null||t({...typeof p=="object"&&p?p:{},url:v})}catch(p){if(!m())return;y.ElMessage.error("上传失败"),u("error",p),l==null||l(p)}finally{m()&&I(i)}}function fe(e){const t=new FormData;return t.append(a.name,e),a.extraData&&Object.entries(a.extraData).forEach(([l,o])=>t.append(l,o)),t}function Ie(e){var o,i;if(typeof e=="string")return e;const t=e||{},l=t.urls??t.url??((o=t.data)==null?void 0:o.urls)??((i=t.data)==null?void 0:i.url)??"";return Array.isArray(l)?l[0]||"":l||""}function me(e,t,l,o,i=e.uid){const c=y.ElLoading.service({target:f.value,text:"上传中",background:"rgba(255,255,255,0.7)"});if(a.uploadRequest){ze(e,l,o,c,i);return}const d=a.api.startsWith("http")?a.api:window.location.origin+a.api.replace(/^([^/])/,"/$1"),m=fe(e),p=new XMLHttpRequest;let v=!1;const C=()=>v?!1:(v=!0,M.delete(i),c.close(),!0);M.set(i,()=>{C()&&p.abort()}),p.onabort=C,p.open("POST",d);const we=Qe(a.tokenKey);we&&p.setRequestHeader("Authorization",`Bearer ${we}`),p.upload.onprogress=g=>{!v&&g.total>0&&(t==null||t({percent:g.loaded/g.total*100}))},p.onload=()=>{if(C()){if(p.status<200||p.status>=300){const g=`上传失败 (HTTP ${p.status})`;y.ElMessage.error(g),u("error",{msg:g,status:p.status}),o==null||o(new Error(g));return}try{const g=JSON.parse(p.responseText);g.code===200&&g.urls?(y.ElMessage.success("上传成功"),l==null||l({...g,url:g.urls})):(y.ElMessage.error(g.msg||"上传失败"),u("error",g),o==null||o(g))}catch{y.ElMessage.error("上传失败,响应格式错误"),u("error",new Error("Response parse error")),o==null||o(new Error("Response parse error"))}}},p.onerror=()=>{C()&&(y.ElMessage.error("上传失败,网络异常"),u("error",new Error("Network error")),o==null||o(new Error("Network error")))},p.send(m)}function ve(e){return h.value?!1:H(e)}function _e(e,t){const l=r.value.find(o=>{var i;return o.uid===(e==null?void 0:e.uid)||((i=o.raw)==null?void 0:i.uid)===(e==null?void 0:e.uid)});l&&(l.url=t,l.status="success")}function Ee(e){me(e.file,e.onProgress,t=>{_e(e.file,t.url),e.onSuccess(t),q(),u("success",t)},t=>e.onError(t))}function Ae(e){var o;if(!e.url)return;const t=((o=e.url.split(".").pop())==null?void 0:o.toLowerCase())||"";if(["mp4","mov","avi","webm"].includes(t)){ee.value=e.url,te.value=e.name||"视频预览",R.value=!0;return}const l=r.value.filter(i=>{var c;return i.status==="success"&&i.url&&!["mp4","mov","avi","webm"].includes((c=i.url.split(".").pop())==null?void 0:c.toLowerCase())});K.value=l.map(i=>i.url),Z.value=l.findIndex(i=>i.uid===e.uid)||0,$.value=!0}function Le(){$.value=!1,K.value=[]}function Pe(e,t){if(e.name&&ce(e))return e;const l=pe(e).find(o=>V.value.includes(o));return l?new File([e],`paste-${Date.now()+t}.${l}`,{type:e.type,lastModified:e.lastModified}):e}function J(e){if(!a.autoUpload){const t=X(),l=e.filter(i=>H(i));if(!l.length)return;const o=a.multiple?[...t,...l].slice(0,a.limit):l.slice(-1);r.value=S(o),A(o);return}for(let t=0;t<e.length&&!(r.value.length>=ie.value);t++){const l=Pe(e[t],t);if(!ve(l))continue;const o=y.genFileId(),i=URL.createObjectURL(l);j.add(i),r.value.push({uid:o,name:l.name||`file-${o}`,status:"uploading",percentage:0,url:i}),me(l,c=>{const d=r.value.find(m=>m.uid===o);d&&(d.percentage=c.percent)},c=>{const d=r.value.find(m=>m.uid===o);d&&(d.url!==c.url&&z(d.url),d.status="success",d.url=c.url,q(),u("success",c))},()=>Ke(o),o)}}function Oe(e){const t=e.target,l=Array.from(t.files||[]);if(t.value="",h.value||!l.length)return;const o=a.supportVideo||!a.multiple?l.slice(0,1):l;J(o)}function $e(e){const t=Array.from((e==null?void 0:e.files)||[]).filter(c=>{var d;return(d=c.type)==null?void 0:d.startsWith("image/")});if(t.length)return t;const l=e==null?void 0:e.items;if(!l)return[];const o=[],i=new Set;for(let c=0;c<l.length;c++){const d=l[c];if(d.kind==="file"&&d.type.startsWith("image/")){const m=d.getAsFile();m&&!i.has(m)&&(i.add(m),o.push(m))}}return o}function D(e){if(h.value)return;const t=$e(e.clipboardData);t.length&&(e.preventDefault(),J(t))}function ge(){h.value||a.disableDrag||(_.value=!0)}function ye(){_.value=!1}function he(e){var l;if(_.value=!1,h.value||a.disableDrag||E.value)return;const t=Array.from(((l=e.dataTransfer)==null?void 0:l.files)||[]);t.length&&J(t)}function Ke(e){I(e),oe(e);const t=r.value.findIndex(l=>l.uid===e);t!==-1&&(z(r.value[t].url),r.value.splice(t,1))}n.onBeforeUnmount(()=>{le(),ae(),ne()});function Q(){var e;h.value||E.value||(e=w.value)==null||e.click()}function We(){var e;le(),ae();for(const t of r.value)(e=t.url)!=null&&e.startsWith("blob:")&&j.add(t.url);ne(),r.value=[],x.value="",A([]),a.autoUpload&&q()}return k({openFileDialog:Q,getPathList:()=>r.value.filter(e=>e.status==="success").map(e=>e.url),clearFiles:We,getValue:()=>({files:r.value.filter(e=>e.status==="success"&&e.url).map(e=>e.url),text:x.value}),getModelValue:()=>de({files:r.value.filter(e=>e.status==="success"&&e.url).map(e=>e.url),text:x.value})}),(e,t)=>{var p;const l=F.ElIcon,o=F.ElInput,i=F.ElPopover,c=F.ElUpload,d=F.ElImageViewer,m=F.ElDialog;return n.openBlock(),n.createElementBlock("div",{ref_key:"rootRef",ref:f,class:n.normalizeClass(["qy-upload",Be.value]),style:n.normalizeStyle({"--qy-upload-size":ke.value})},[n.createElementVNode("input",{ref_key:"nativeInputRef",ref:w,class:"qy-upload__native-input",type:"file",accept:re.value,multiple:s.supportVideo?!1:s.multiple,disabled:n.unref(h),onChange:Oe},null,40,Ge),n.createVNode(c,{ref_key:"uploadRef",ref:b,"file-list":r.value,"onUpdate:fileList":t[7]||(t[7]=v=>r.value=v),action:"#",multiple:s.supportVideo?!1:s.multiple,limit:ie.value,"auto-upload":s.autoUpload,"list-type":Ce.value,accept:re.value,disabled:n.unref(h),"http-request":Ee,"before-upload":ve,"on-change":Ne,"on-preview":Ae,"on-remove":Te},n.createSlots({default:n.withCtx(()=>[s.variant!=="file-list"&&!E.value?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["qy-upload__trigger",{"is-dragover":_.value}]),onPaste:D,onDragover:n.withModifiers(ge,["prevent"]),onDragleave:n.withModifiers(ye,["prevent"]),onDrop:n.withModifiers(he,["prevent"])},[n.createVNode(l,{class:"qy-upload__icon"},{default:n.withCtx(()=>[n.createVNode(n.unref(xe.Plus))]),_:1}),s.supportVideo?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[t[10]||(t[10]=n.createElementVNode("span",{class:"qy-upload__label"},"点击上传视频",-1)),n.createElementVNode("span",Ze,"支持 "+n.toDisplayString(V.value.join(" / "))+",不超过 "+n.toDisplayString(s.fileSize)+"MB",1)],64)):n.createCommentVNode("",!0),s.showText?(n.openBlock(),n.createElementBlock("div",{key:1,class:"qy-upload__text",onClick:t[4]||(t[4]=n.withModifiers(()=>{},["stop"])),onPaste:n.withModifiers(D,["stop"])},[n.createVNode(i,{visible:W.value,"onUpdate:visible":t[3]||(t[3]=v=>W.value=v),placement:"bottom-start",width:220,trigger:"click","popper-class":"qy-upload__text-popover",onAfterEnter:qe},{reference:n.withCtx(()=>[n.createElementVNode("div",{class:n.normalizeClass(["qy-upload__text-preview",{"is-placeholder":!x.value}])},n.toDisplayString(x.value||s.pastePlaceholder),3)]),default:n.withCtx(()=>[n.createVNode(o,{ref_key:"inputRef",ref:T,modelValue:x.value,"onUpdate:modelValue":t[1]||(t[1]=v=>x.value=v),type:"textarea",autosize:{minRows:2,maxRows:5},placeholder:s.pastePlaceholder,disabled:n.unref(h),onBlur:t[2]||(t[2]=v=>W.value=!1),onPaste:n.withModifiers(D,["stop"])},null,8,["modelValue","placeholder","disabled"])]),_:1},8,["visible"])],32)):s.showPasteInput?(n.openBlock(),n.createElementBlock("div",{key:2,class:"qy-upload__text",onClick:t[6]||(t[6]=n.withModifiers(()=>{},["stop"])),onPaste:n.withModifiers(D,["stop"])},[n.createElementVNode("input",{ref_key:"pasteInputRef",ref:B,class:"qy-upload__paste-input",placeholder:s.pastePlaceholder,disabled:n.unref(h),onPaste:n.withModifiers(D,["stop"]),onInput:De,onClick:t[5]||(t[5]=n.withModifiers(()=>{},["stop"]))},null,40,et)],32)):n.createCommentVNode("",!0)],34)):n.createCommentVNode("",!0)]),_:2},[s.variant==="file-list"?{name:"trigger",fn:n.withCtx(()=>[n.createElementVNode("div",{class:"qy-upload__file-trigger",onClick:t[0]||(t[0]=n.withModifiers(()=>{},["stop"])),onDragover:n.withModifiers(ge,["prevent"]),onDragleave:n.withModifiers(ye,["prevent"]),onDrop:n.withModifiers(he,["prevent"])},[n.renderSlot(e.$slots,"trigger",{open:Q,disabled:n.unref(h),uploading:be.value},()=>[n.createElementVNode("button",{class:"qy-upload__file-button",type:"button",disabled:n.unref(h),onClick:Q}," 选择文件 ",8,Ye)],!0)],32)]),key:"0"}:void 0]),1032,["file-list","multiple","limit","auto-upload","list-type","accept","disabled"]),$.value?(n.openBlock(),n.createBlock(d,{key:0,"url-list":K.value,"initial-index":Z.value,onClose:Le},null,8,["url-list","initial-index"])):n.createCommentVNode("",!0),n.createVNode(m,{modelValue:R.value,"onUpdate:modelValue":t[8]||(t[8]=v=>R.value=v),title:te.value,width:"640px","append-to-body":"","destroy-on-close":"",onClose:t[9]||(t[9]=v=>R.value=!1)},{default:n.withCtx(()=>[R.value?(n.openBlock(),n.createElementBlock("video",{key:0,src:ee.value,controls:"",autoplay:"",style:{width:"100%","max-height":"400px","border-radius":"4px"}},null,8,tt)):n.createCommentVNode("",!0)]),_:1},8,["modelValue","title"]),Ue.value?(n.openBlock(),n.createElementBlock("div",nt,[n.createVNode(l,null,{default:n.withCtx(()=>[n.createVNode(n.unref(xe.InfoFilled))]),_:1}),n.createElementVNode("span",null,[t[13]||(t[13]=n.createTextVNode(" 请上传 ",-1)),s.fileSize?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[t[11]||(t[11]=n.createTextVNode("大小不超过 ",-1)),n.createElementVNode("b",lt,n.toDisplayString(s.fileSize)+"MB",1)],64)):n.createCommentVNode("",!0),(p=V.value)!=null&&p.length?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[t[12]||(t[12]=n.createTextVNode(",格式为 ",-1)),n.createElementVNode("b",ot,n.toDisplayString(V.value.join("/")),1)],64)):n.createCommentVNode("",!0),t[14]||(t[14]=n.createTextVNode(" 的文件。 ",-1))])])):n.createCommentVNode("",!0)],6)}}}),it=Xe._export_sfc(at,[["__scopeId","data-v-b2517f27"]]);exports.Upload=it;exports.api=Ve;
|