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