epic-designer-gold 1.0.27 → 1.0.29

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.
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue"),U=require("./axios-tuVKNgv9.cjs"),b=require("./index-BoL2PSBk.cjs"),j=require("element-plus"),Z=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),W=a.defineComponent({__name:"selectPage",props:{modelValue:[String,Number],placeholder:String,requestFn:{type:Function,default:()=>{}},valueKey:{type:String,default:"value"},labelKey:{type:String,default:"label"},pageSize:{type:Number,default:20},defaultData:{type:Object,default:()=>{}},componentSchema:{type:Object,default:()=>{}},sourceDateUrl:{type:String,default:""}},emits:["update:modelValue","update:modelValueLabel"],setup(D,{emit:A}){const _=`paginated-select-dropdown-${Math.random().toString(36).slice(2,8)}`,l=D,O=A,v=a.ref(l.modelValue);a.watch(()=>l.modelValue,e=>{v.value=e}),a.watch(v,e=>{O("update:modelValue",e);let t=u.value.find(o=>o.value===e);O("update:modelValueLabel",{label:t.label||l.defaultData.label,value:t.value||l.defaultData.value})});const u=a.ref(l.defaultData&&Object.keys(l.defaultData).length?[l.defaultData]:[]),p=a.ref(!1),f=a.ref(0),c=a.ref(1),x=a.ref(""),m=a.ref(!1),d=a.ref(null),h=a.ref(null);function B(){u.value=[],f.value=0,c.value=1,m.value=!1}function N(e=window.location.href){const t={},o=e.split("?")[1];return o&&o.split("&").forEach(r=>{const[i,g]=r.split("=");i&&(t[i]=decodeURIComponent(g||""))}),t}async function y(){var t,o,r,i,g,T,q,z,E,C;if(p.value||m.value)return;const e=N(n.value.url);console.log("%c [ urlParams ]-93","font-size:13px; background:pink; color:#bf2c9f;",e),p.value=!0;try{const s=await U.axios({url:n.value.url.split("?")[0],method:n.value.method,data:n.value.body?JSON.parse(n.value.body):{},params:n.value.params?{...e,...JSON.parse(n.value.params),[`${(o=(t=l==null?void 0:l.componentSchema)==null?void 0:t.componentProps)==null?void 0:o.pageKey}`]:c.value,[`${(i=(r=l==null?void 0:l.componentSchema)==null?void 0:r.componentProps)==null?void 0:i.searchKey}`]:x.value}:{...e},headers:{...JSON.parse(n.value.headers),Authorization:"Bearer "+b.api.get("Admin-Token"),lang:b.api.get("saas-locale")||"zh-CN",zone:Intl.DateTimeFormat().resolvedOptions().timeZone}});if(n.value&&n.value.dataPath){const J=((g=n.value)==null?void 0:g.dataPath.split(".")).reduce((P,k)=>P[k],s.data),K=(T=n.value)==null?void 0:T.dataPath.split(".");K.pop();const R=K.reduce((P,k)=>P[k],s.data);let L=S(J,n.value.dataKey,n.value.dataValue);c.value===1?u.value=L:u.value=u.value.concat(L),f.value=R[(z=(q=l==null?void 0:l.componentSchema)==null?void 0:q.componentProps)==null?void 0:z.pageTotalKey]}else{let V=S(s.data,n.value.dataKey,n.value.dataValue);c.value===1?u.value=V:u.value=u.value.concat(V),f.value=s.data[(C=(E=l==null?void 0:l.componentSchema)==null?void 0:E.componentProps)==null?void 0:C.pageTotalKey],console.log("%c [ ]-130","font-size:13px; background:pink; color:#bf2c9f;",u.value)}u.value.length>=f.value&&(m.value=!0)}catch(s){console.error("fetch error:",s)}finally{p.value=!1}}const n=a.ref();function S(e,t,o){return e&&Object.prototype.toString.call(e)==="[object Array]"?e.map(r=>r.children&&r.children.length?{label:r[t],value:r[o]+"",children:S(r.children,t,o)}:{label:r[t],value:r[o]+""}):[]}async function F(){var t,o;let e=await U.axios({url:l.sourceDateUrl,method:"get",params:{id:(o=(t=l==null?void 0:l.componentSchema)==null?void 0:t.componentProps)==null?void 0:o.dynamicId},headers:{Authorization:"Bearer "+b.api.get("Admin-Token"),lang:b.api.get("saas-locale")||"zh-CN",zone:Intl.DateTimeFormat().resolvedOptions().timeZone}});e.data.code===200&&(n.value=e.data.data)}a.watch(()=>l.sourceDateUrl,()=>{l.sourceDateUrl&&F()},{immediate:!0});function I(e){x.value=e,c.value=1,B(),y()}function M(e){e?(B(),y(),a.nextTick(()=>setTimeout($,0))):H()}function $(){const e=document.querySelector(`.${_} .el-select-dropdown__wrap`);e?(d.value=e,e.addEventListener("scroll",w)):(h.value=new MutationObserver(()=>{const t=document.querySelector(".paginated-select-dropdown .el-select-dropdown__wrap");t&&(d.value=t,t.addEventListener("scroll",w),h.value.disconnect())}),h.value.observe(document.body,{childList:!0,subtree:!0}))}function H(){var e;d.value&&d.value.removeEventListener("scroll",w),(e=h.value)==null||e.disconnect()}function w(){const e=d.value;if(!e||p.value||m.value)return;e.scrollTop+e.clientHeight>=e.scrollHeight-10&&(c.value++,y())}return(e,t)=>(a.openBlock(),a.createBlock(a.unref(j.ElSelect),{modelValue:v.value,"onUpdate:modelValue":t[0]||(t[0]=o=>v.value=o),filterable:"",remote:"",clearable:"",placeholder:D.placeholder,"remote-method":I,loading:!1,teleported:!0,onVisibleChange:M,"popper-class":_,style:{width:"100%"}},{default:a.withCtx(()=>[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(u.value,o=>(a.openBlock(),a.createBlock(a.unref(j.ElOption),{key:o.value,label:o.label,value:o.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]))}}),G=Z._export_sfc(W,[["__scopeId","data-v-177ce516"]]);exports.default=G;
@@ -0,0 +1,177 @@
1
+ import { defineComponent as Q, ref as u, watch as _, openBlock as k, createBlock as j, unref as F, withCtx as X, createElementBlock as Y, Fragment as ee, renderList as ae, nextTick as le } from "vue";
2
+ import { a as q } from "./axios-CXDYiOMX.js";
3
+ import { a as b } from "./index-B1s67XDZ.js";
4
+ import { ElSelect as te, ElOption as oe } from "element-plus";
5
+ import { _ as ne } from "./_plugin-vue_export-helper-CHgC5LLL.js";
6
+ const re = /* @__PURE__ */ Q({
7
+ __name: "selectPage",
8
+ props: {
9
+ modelValue: [String, Number],
10
+ placeholder: String,
11
+ requestFn: { type: Function, default: () => {
12
+ } },
13
+ // 可自定义请求函数
14
+ valueKey: { type: String, default: "value" },
15
+ labelKey: { type: String, default: "label" },
16
+ pageSize: { type: Number, default: 20 },
17
+ defaultData: { type: Object, default: () => {
18
+ } },
19
+ componentSchema: { type: Object, default: () => {
20
+ } },
21
+ sourceDateUrl: { type: String, default: "" }
22
+ },
23
+ emits: ["update:modelValue", "update:modelValueLabel"],
24
+ setup(O, { emit: I }) {
25
+ const T = `paginated-select-dropdown-${Math.random().toString(36).slice(2, 8)}`, a = O, z = I, v = u(a.modelValue);
26
+ _(
27
+ () => a.modelValue,
28
+ (e) => {
29
+ v.value = e;
30
+ }
31
+ ), _(v, (e) => {
32
+ z("update:modelValue", e);
33
+ let l = r.value.find((t) => t.value === e);
34
+ z("update:modelValueLabel", {
35
+ label: l.label || a.defaultData.label,
36
+ value: l.value || a.defaultData.value
37
+ });
38
+ });
39
+ const r = u(a.defaultData && Object.keys(a.defaultData).length ? [a.defaultData] : []), m = u(!1), p = u(0), c = u(1), E = u(""), f = u(!1), d = u(null), h = u(null);
40
+ function x() {
41
+ r.value = [], p.value = 0, c.value = 1, f.value = !1;
42
+ }
43
+ function $(e = window.location.href) {
44
+ const l = {}, t = e.split("?")[1];
45
+ return t && t.split("&").forEach((n) => {
46
+ const [i, g] = n.split("=");
47
+ i && (l[i] = decodeURIComponent(g || ""));
48
+ }), l;
49
+ }
50
+ async function y() {
51
+ var l, t, n, i, g, B, C, K, L, U;
52
+ if (m.value || f.value) return;
53
+ const e = $(o.value.url);
54
+ console.log("%c [ urlParams ]-93", "font-size:13px; background:pink; color:#bf2c9f;", e), m.value = !0;
55
+ try {
56
+ const s = await q({
57
+ url: o.value.url.split("?")[0],
58
+ method: o.value.method,
59
+ data: o.value.body ? JSON.parse(o.value.body) : {},
60
+ params: o.value.params ? {
61
+ ...e,
62
+ ...JSON.parse(o.value.params),
63
+ [`${(t = (l = a == null ? void 0 : a.componentSchema) == null ? void 0 : l.componentProps) == null ? void 0 : t.pageKey}`]: c.value,
64
+ [`${(i = (n = a == null ? void 0 : a.componentSchema) == null ? void 0 : n.componentProps) == null ? void 0 : i.searchKey}`]: E.value
65
+ } : { ...e },
66
+ headers: {
67
+ ...JSON.parse(o.value.headers),
68
+ Authorization: "Bearer " + b.get("Admin-Token"),
69
+ lang: b.get("saas-locale") || "zh-CN",
70
+ //语言
71
+ zone: Intl.DateTimeFormat().resolvedOptions().timeZone
72
+ //时区
73
+ }
74
+ });
75
+ if (o.value && o.value.dataPath) {
76
+ const W = ((g = o.value) == null ? void 0 : g.dataPath.split(".")).reduce((D, P) => D[P], s.data), A = (B = o.value) == null ? void 0 : B.dataPath.split(".");
77
+ A.pop();
78
+ const G = A.reduce((D, P) => D[P], s.data);
79
+ let N = S(W, o.value.dataKey, o.value.dataValue);
80
+ c.value === 1 ? r.value = N : r.value = r.value.concat(N), p.value = G[(K = (C = a == null ? void 0 : a.componentSchema) == null ? void 0 : C.componentProps) == null ? void 0 : K.pageTotalKey];
81
+ } else {
82
+ let V = S(s.data, o.value.dataKey, o.value.dataValue);
83
+ c.value === 1 ? r.value = V : r.value = r.value.concat(V), p.value = s.data[(U = (L = a == null ? void 0 : a.componentSchema) == null ? void 0 : L.componentProps) == null ? void 0 : U.pageTotalKey], console.log("%c [ ]-130", "font-size:13px; background:pink; color:#bf2c9f;", r.value);
84
+ }
85
+ r.value.length >= p.value && (f.value = !0);
86
+ } catch (s) {
87
+ console.error("fetch error:", s);
88
+ } finally {
89
+ m.value = !1;
90
+ }
91
+ }
92
+ const o = u();
93
+ function S(e, l, t) {
94
+ return e && Object.prototype.toString.call(e) === "[object Array]" ? e.map((n) => n.children && n.children.length ? {
95
+ label: n[l],
96
+ value: n[t] + "",
97
+ children: S(n.children, l, t)
98
+ } : {
99
+ label: n[l],
100
+ value: n[t] + ""
101
+ }) : [];
102
+ }
103
+ async function J() {
104
+ var l, t;
105
+ let e = await q({
106
+ url: a.sourceDateUrl,
107
+ method: "get",
108
+ params: {
109
+ id: (t = (l = a == null ? void 0 : a.componentSchema) == null ? void 0 : l.componentProps) == null ? void 0 : t.dynamicId
110
+ },
111
+ headers: {
112
+ Authorization: "Bearer " + b.get("Admin-Token"),
113
+ lang: b.get("saas-locale") || "zh-CN",
114
+ //语言
115
+ zone: Intl.DateTimeFormat().resolvedOptions().timeZone
116
+ //时区
117
+ }
118
+ });
119
+ e.data.code === 200 && (o.value = e.data.data);
120
+ }
121
+ _(
122
+ () => a.sourceDateUrl,
123
+ () => {
124
+ a.sourceDateUrl && J();
125
+ },
126
+ { immediate: !0 }
127
+ );
128
+ function M(e) {
129
+ E.value = e, c.value = 1, x(), y();
130
+ }
131
+ function H(e) {
132
+ e ? (x(), y(), le(() => setTimeout(R, 0))) : Z();
133
+ }
134
+ function R() {
135
+ const e = document.querySelector(`.${T} .el-select-dropdown__wrap`);
136
+ e ? (d.value = e, e.addEventListener("scroll", w)) : (h.value = new MutationObserver(() => {
137
+ const l = document.querySelector(".paginated-select-dropdown .el-select-dropdown__wrap");
138
+ l && (d.value = l, l.addEventListener("scroll", w), h.value.disconnect());
139
+ }), h.value.observe(document.body, { childList: !0, subtree: !0 }));
140
+ }
141
+ function Z() {
142
+ var e;
143
+ d.value && d.value.removeEventListener("scroll", w), (e = h.value) == null || e.disconnect();
144
+ }
145
+ function w() {
146
+ const e = d.value;
147
+ if (!e || m.value || f.value) return;
148
+ e.scrollTop + e.clientHeight >= e.scrollHeight - 10 && (c.value++, y());
149
+ }
150
+ return (e, l) => (k(), j(F(te), {
151
+ modelValue: v.value,
152
+ "onUpdate:modelValue": l[0] || (l[0] = (t) => v.value = t),
153
+ filterable: "",
154
+ remote: "",
155
+ clearable: "",
156
+ placeholder: O.placeholder,
157
+ "remote-method": M,
158
+ loading: !1,
159
+ teleported: !0,
160
+ onVisibleChange: H,
161
+ "popper-class": T,
162
+ style: { width: "100%" }
163
+ }, {
164
+ default: X(() => [
165
+ (k(!0), Y(ee, null, ae(r.value, (t) => (k(), j(F(oe), {
166
+ key: t.value,
167
+ label: t.label,
168
+ value: t.value
169
+ }, null, 8, ["label", "value"]))), 128))
170
+ ]),
171
+ _: 1
172
+ }, 8, ["modelValue", "placeholder"]));
173
+ }
174
+ }), me = /* @__PURE__ */ ne(re, [["__scopeId", "data-v-177ce516"]]);
175
+ export {
176
+ me as default
177
+ };