@opentiny/tiny-engine-setting-events 2.2.0 → 2.3.0
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/dist/index.js +330 -336
- package/dist/style.css +1 -1
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import "./style.css";
|
|
2
|
-
import { ref as
|
|
3
|
-
import {
|
|
4
|
-
import { getMergeMeta as Ne, useLayout as Ae, useCanvas as L, getMetaApi as Z, META_APP as G, getOptions as
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import { iconChevronDown as We
|
|
8
|
-
import { string2Ast as
|
|
9
|
-
import {
|
|
2
|
+
import { ref as F, reactive as Y, provide as Oe, resolveComponent as k, createBlock as w, openBlock as b, withCtx as x, createElementVNode as t, resolveDynamicComponent as fe, createVNode as u, createTextVNode as j, nextTick as Se, unref as B, createElementBlock as A, Fragment as $, withDirectives as ge, renderList as ne, normalizeClass as R, toDisplayString as M, createCommentVNode as H, vShow as _e, computed as K, watchEffect as ke, watch as he, inject as Ve } from "vue";
|
|
3
|
+
import { DialogBox as Ce, Button as q, Form as Te, FormItem as be, Input as oe, Popover as Ue, Tooltip as je, Collapse as ze, CollapseItem as Ee, Checkbox as Re, Search as Fe } from "@opentiny/vue";
|
|
4
|
+
import { getMergeMeta as Ne, useLayout as Ae, useCanvas as L, getMetaApi as Z, META_APP as G, getOptions as Je, useHistory as Xe, useBlock as Ke, useMaterial as $e, useModal as He, useProperties as T } from "@opentiny/tiny-engine-meta-register";
|
|
5
|
+
import qe from "@opentiny/tiny-engine-common/js/i18n";
|
|
6
|
+
import { SvgButton as Ye, BlockLinkEvent as Ze, VueMonaco as Ge } from "@opentiny/tiny-engine-common";
|
|
7
|
+
import { iconChevronDown as We } from "@opentiny/vue-icon";
|
|
8
|
+
import { string2Ast as ye, ast2String as Qe } from "@opentiny/tiny-engine-common/js/ast";
|
|
9
|
+
import { CodeConfigurator as en, InputConfigurator as nn, VariableConfigurator as on, SwitchConfigurator as tn } from "@opentiny/tiny-engine-configurator";
|
|
10
10
|
import { PROP_DATA_TYPE as X } from "@opentiny/tiny-engine-common/js/constants";
|
|
11
|
-
import { constants as
|
|
11
|
+
import { constants as sn, utils as an } from "@opentiny/tiny-engine-utils";
|
|
12
12
|
const te = {
|
|
13
13
|
id: "engine.setting.event",
|
|
14
14
|
title: "高级",
|
|
@@ -16,18 +16,18 @@ const te = {
|
|
|
16
16
|
align: "left",
|
|
17
17
|
name: "event",
|
|
18
18
|
icon: ""
|
|
19
|
-
},
|
|
20
|
-
const r =
|
|
19
|
+
}, J = (v, o) => {
|
|
20
|
+
const r = v.__vccOpts || v;
|
|
21
21
|
for (const [e, d] of o)
|
|
22
22
|
r[e] = d;
|
|
23
23
|
return r;
|
|
24
|
-
}, ie =
|
|
24
|
+
}, ie = F(!1), ln = () => {
|
|
25
25
|
ie.value = !0;
|
|
26
26
|
}, xe = () => {
|
|
27
27
|
ie.value = !1;
|
|
28
|
-
},
|
|
28
|
+
}, dn = {
|
|
29
29
|
components: {
|
|
30
|
-
TinyButton:
|
|
30
|
+
TinyButton: q,
|
|
31
31
|
TinyDialogBox: Ce
|
|
32
32
|
},
|
|
33
33
|
inheritAttrs: !1,
|
|
@@ -37,8 +37,8 @@ const te = {
|
|
|
37
37
|
default: () => ({})
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
|
-
setup(
|
|
41
|
-
const { BindEventsDialogSidebar: o, BindEventsDialogContent: r } = Ne(te.id).components, { PLUGIN_NAME: e, activePlugin: d } = Ae(), { pageState:
|
|
40
|
+
setup(v) {
|
|
41
|
+
const { BindEventsDialogSidebar: o, BindEventsDialogContent: r } = Ne(te.id).components, { PLUGIN_NAME: e, activePlugin: d } = Ae(), { pageState: _ } = L(), { getMethods: h, saveMethod: m, highlightMethod: p } = Z(G.Page), s = Y({
|
|
42
42
|
editorContent: "",
|
|
43
43
|
bindMethodInfo: {},
|
|
44
44
|
tip: "",
|
|
@@ -46,89 +46,89 @@ const te = {
|
|
|
46
46
|
enableExtraParams: !1,
|
|
47
47
|
isValidParams: !0
|
|
48
48
|
});
|
|
49
|
-
Oe("context",
|
|
50
|
-
const
|
|
51
|
-
|
|
49
|
+
Oe("context", s);
|
|
50
|
+
const y = (g) => {
|
|
51
|
+
s.bindMethodInfo = g;
|
|
52
52
|
}, n = (g) => {
|
|
53
53
|
var P, N;
|
|
54
54
|
if (!g)
|
|
55
55
|
return;
|
|
56
|
-
const
|
|
57
|
-
if (!
|
|
56
|
+
const c = (P = v.eventBinding) == null ? void 0 : P.eventName;
|
|
57
|
+
if (!c)
|
|
58
58
|
return;
|
|
59
|
-
const f = (N =
|
|
59
|
+
const f = (N = _ == null ? void 0 : _.currentSchema) == null ? void 0 : N.props;
|
|
60
60
|
if (!f)
|
|
61
61
|
return;
|
|
62
62
|
const { name: V, extra: I } = g;
|
|
63
|
-
|
|
63
|
+
v[c] || (f[c] = {
|
|
64
64
|
type: "JSExpression",
|
|
65
65
|
value: ""
|
|
66
|
-
}), I &&
|
|
66
|
+
}), I && s.enableExtraParams && (f[c].params = I), f[c].value = `this.${V}`, Xe().addHistory();
|
|
67
67
|
}, a = () => {
|
|
68
|
-
|
|
69
|
-
},
|
|
68
|
+
s.tipError = !1, s.tip = "", s.isValidParams = !0;
|
|
69
|
+
}, i = () => {
|
|
70
70
|
let g = "";
|
|
71
|
-
if (
|
|
71
|
+
if (s.enableExtraParams)
|
|
72
72
|
try {
|
|
73
|
-
g = JSON.parse(
|
|
73
|
+
g = JSON.parse(s.editorContent), s.isValidParams = Array.isArray(g);
|
|
74
74
|
} catch {
|
|
75
|
-
|
|
75
|
+
s.isValidParams = !1;
|
|
76
76
|
}
|
|
77
77
|
return g;
|
|
78
|
-
}, l = (g) => Array.from({ length: g.length }, (
|
|
78
|
+
}, l = (g) => Array.from({ length: g.length }, (c, f) => `args${f}`).join(","), E = () => {
|
|
79
79
|
var f, V, I, P;
|
|
80
|
-
let g = (V = (f = h()) == null ? void 0 : f[
|
|
80
|
+
let g = (V = (f = h()) == null ? void 0 : f[s.bindMethodInfo.name]) == null ? void 0 : V.value, c = "{}";
|
|
81
81
|
if (g) {
|
|
82
82
|
let N = {};
|
|
83
83
|
try {
|
|
84
|
-
N =
|
|
84
|
+
N = ye(g);
|
|
85
85
|
} catch {
|
|
86
|
-
g = g.replace("function", `function ${
|
|
86
|
+
g = g.replace("function", `function ${s.bindMethodInfo.name}`), N = ye(g);
|
|
87
87
|
}
|
|
88
|
-
(P = (I = N == null ? void 0 : N.program) == null ? void 0 : I.body[0]) != null && P.body && (
|
|
88
|
+
(P = (I = N == null ? void 0 : N.program) == null ? void 0 : I.body[0]) != null && P.body && (c = Qe(N.program.body[0].body));
|
|
89
89
|
}
|
|
90
|
-
return
|
|
90
|
+
return c || `{
|
|
91
91
|
}`;
|
|
92
92
|
}, C = () => {
|
|
93
93
|
d(e.Page).then(() => {
|
|
94
94
|
Se(() => {
|
|
95
95
|
var g;
|
|
96
|
-
|
|
96
|
+
p && p((g = s.bindMethodInfo) == null ? void 0 : g.name);
|
|
97
97
|
});
|
|
98
98
|
});
|
|
99
99
|
};
|
|
100
100
|
return {
|
|
101
101
|
BindEventsDialogSidebar: o,
|
|
102
102
|
BindEventsDialogContent: r,
|
|
103
|
-
state:
|
|
103
|
+
state: s,
|
|
104
104
|
dialogVisible: ie,
|
|
105
105
|
confirm: async () => {
|
|
106
|
-
if (
|
|
106
|
+
if (s.tipError)
|
|
107
107
|
return;
|
|
108
|
-
let g = "event",
|
|
109
|
-
if (!
|
|
108
|
+
let g = "event", c = i(), f = g;
|
|
109
|
+
if (!s.isValidParams)
|
|
110
110
|
return;
|
|
111
|
-
|
|
112
|
-
const V =
|
|
111
|
+
c && (g = c.join(","), f = l(c)), n({ ...s.bindMethodInfo, extra: c });
|
|
112
|
+
const V = E(), { name: I } = s.bindMethodInfo, P = {
|
|
113
113
|
name: I,
|
|
114
|
-
content:
|
|
115
|
-
}, { beforeSaveMethod: N } =
|
|
116
|
-
typeof N == "function" && await N(P,
|
|
114
|
+
content: s.enableExtraParams ? `function ${I}(eventArgs,${f}) ${V}` : `function ${I}(${f}) ${V}`
|
|
115
|
+
}, { beforeSaveMethod: N } = Je(te.id);
|
|
116
|
+
typeof N == "function" && await N(P, s.bindMethodInfo), m == null || m(P), C(), xe();
|
|
117
117
|
},
|
|
118
118
|
closeDialog: () => {
|
|
119
119
|
a(), xe();
|
|
120
120
|
},
|
|
121
121
|
openedDialog: () => {
|
|
122
|
-
var g,
|
|
123
|
-
|
|
122
|
+
var g, c, f;
|
|
123
|
+
s.enableExtraParams = !!((c = (g = v.eventBinding) == null ? void 0 : g.params) != null && c.length), s.editorContent = JSON.stringify(((f = v.eventBinding) == null ? void 0 : f.params) || [], null, 2), a();
|
|
124
124
|
},
|
|
125
|
-
selectMethod:
|
|
125
|
+
selectMethod: y
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
|
-
},
|
|
129
|
-
function
|
|
130
|
-
const h =
|
|
131
|
-
return
|
|
128
|
+
}, rn = { class: "bind-event-dialog-content" }, cn = { class: "bind-dialog-footer" };
|
|
129
|
+
function mn(v, o, r, e, d, _) {
|
|
130
|
+
const h = k("tiny-button"), m = k("tiny-dialog-box");
|
|
131
|
+
return b(), w(m, {
|
|
132
132
|
visible: e.dialogVisible,
|
|
133
133
|
title: "事件绑定",
|
|
134
134
|
width: "50%",
|
|
@@ -138,39 +138,39 @@ function pn(u, o, r, e, d, b) {
|
|
|
138
138
|
onClose: e.closeDialog,
|
|
139
139
|
onOpened: e.openedDialog
|
|
140
140
|
}, {
|
|
141
|
-
footer:
|
|
142
|
-
t("div",
|
|
143
|
-
|
|
144
|
-
default:
|
|
145
|
-
|
|
141
|
+
footer: x(() => [
|
|
142
|
+
t("div", cn, [
|
|
143
|
+
u(h, { onClick: e.closeDialog }, {
|
|
144
|
+
default: x(() => o[0] || (o[0] = [
|
|
145
|
+
j("取 消")
|
|
146
146
|
])),
|
|
147
147
|
_: 1
|
|
148
148
|
}, 8, ["onClick"]),
|
|
149
|
-
|
|
149
|
+
u(h, {
|
|
150
150
|
type: "info",
|
|
151
151
|
onClick: e.confirm
|
|
152
152
|
}, {
|
|
153
|
-
default:
|
|
154
|
-
|
|
153
|
+
default: x(() => o[1] || (o[1] = [
|
|
154
|
+
j("确 定")
|
|
155
155
|
])),
|
|
156
156
|
_: 1
|
|
157
157
|
}, 8, ["onClick"])
|
|
158
158
|
])
|
|
159
159
|
]),
|
|
160
|
-
default:
|
|
160
|
+
default: x(() => [
|
|
161
161
|
o[2] || (o[2] = t("div", { class: "bind-event-dialog-tip" }, " 选择已有方法或者添加新方法(点击 确定 之后将在JS面板中创建一个该名称的新方法)。 ", -1)),
|
|
162
|
-
t("div",
|
|
163
|
-
(
|
|
162
|
+
t("div", rn, [
|
|
163
|
+
(b(), w(fe(e.BindEventsDialogSidebar), {
|
|
164
164
|
dialogVisible: e.dialogVisible,
|
|
165
165
|
eventBinding: r.eventBinding
|
|
166
166
|
}, null, 8, ["dialogVisible", "eventBinding"])),
|
|
167
|
-
(
|
|
167
|
+
(b(), w(fe(e.BindEventsDialogContent), { dialogVisible: e.dialogVisible }, null, 8, ["dialogVisible"]))
|
|
168
168
|
])
|
|
169
169
|
]),
|
|
170
170
|
_: 1
|
|
171
171
|
}, 8, ["visible", "onClose", "onOpened"]);
|
|
172
172
|
}
|
|
173
|
-
const
|
|
173
|
+
const pn = /* @__PURE__ */ J(dn, [["render", mn], ["__scopeId", "data-v-d7676f4a"]]), un = {
|
|
174
174
|
onClick: {
|
|
175
175
|
label: {
|
|
176
176
|
zh_CN: "点击事件"
|
|
@@ -227,7 +227,7 @@ const un = /* @__PURE__ */ F(rn, [["render", pn], ["__scopeId", "data-v-c1779b8d
|
|
|
227
227
|
},
|
|
228
228
|
defaultValue: ""
|
|
229
229
|
}
|
|
230
|
-
},
|
|
230
|
+
}, vn = [
|
|
231
231
|
"onabort",
|
|
232
232
|
"onafterprint",
|
|
233
233
|
"onanimationend",
|
|
@@ -337,10 +337,10 @@ const un = /* @__PURE__ */ F(rn, [["render", pn], ["__scopeId", "data-v-c1779b8d
|
|
|
337
337
|
"onwebkitanimationstart",
|
|
338
338
|
"onwebkittransitionend",
|
|
339
339
|
"onwheel"
|
|
340
|
-
],
|
|
340
|
+
], fn = (v) => !!vn.map((r) => {
|
|
341
341
|
let e = r[2].toUpperCase();
|
|
342
342
|
return `${r.substring(0, 2)}${e}${r.substring(3)}`;
|
|
343
|
-
}).includes(
|
|
343
|
+
}).includes(v), gn = { class: "footer" }, _n = {
|
|
344
344
|
__name: "AddEventsDialog",
|
|
345
345
|
props: {
|
|
346
346
|
visible: {
|
|
@@ -353,11 +353,11 @@ const un = /* @__PURE__ */ F(rn, [["render", pn], ["__scopeId", "data-v-c1779b8d
|
|
|
353
353
|
}
|
|
354
354
|
},
|
|
355
355
|
emits: ["closeDialog", "addEvent"],
|
|
356
|
-
setup(
|
|
357
|
-
const r =
|
|
356
|
+
setup(v, { emit: o }) {
|
|
357
|
+
const r = v, e = o, d = Y({
|
|
358
358
|
eventDescription: "",
|
|
359
359
|
eventName: ""
|
|
360
|
-
}),
|
|
360
|
+
}), _ = F(null), m = {
|
|
361
361
|
eventDescription: [
|
|
362
362
|
{
|
|
363
363
|
required: !0,
|
|
@@ -367,12 +367,12 @@ const un = /* @__PURE__ */ F(rn, [["render", pn], ["__scopeId", "data-v-c1779b8d
|
|
|
367
367
|
eventName: [
|
|
368
368
|
{ required: !0, message: "必填" },
|
|
369
369
|
{
|
|
370
|
-
validator: (
|
|
370
|
+
validator: (y, n, a) => {
|
|
371
371
|
if (r.componentEvents[d.eventName]) {
|
|
372
372
|
a(new Error("事件名已存在"));
|
|
373
373
|
return;
|
|
374
374
|
}
|
|
375
|
-
if (!
|
|
375
|
+
if (!fn(d.eventName)) {
|
|
376
376
|
a(new Error("请输入正确的浏览器事件名"));
|
|
377
377
|
return;
|
|
378
378
|
}
|
|
@@ -380,63 +380,63 @@ const un = /* @__PURE__ */ F(rn, [["render", pn], ["__scopeId", "data-v-c1779b8d
|
|
|
380
380
|
}
|
|
381
381
|
}
|
|
382
382
|
]
|
|
383
|
-
},
|
|
383
|
+
}, p = () => {
|
|
384
384
|
e("closeDialog");
|
|
385
|
-
},
|
|
386
|
-
|
|
387
|
-
if (!
|
|
385
|
+
}, s = () => {
|
|
386
|
+
_.value && _.value.validate((y) => {
|
|
387
|
+
if (!y)
|
|
388
388
|
return;
|
|
389
389
|
const { eventName: n, eventDescription: a } = d;
|
|
390
390
|
e("addEvent", { eventName: n, eventDescription: a });
|
|
391
391
|
});
|
|
392
392
|
};
|
|
393
|
-
return (
|
|
394
|
-
visible:
|
|
393
|
+
return (y, n) => (b(), w(B(Ce), {
|
|
394
|
+
visible: v.visible,
|
|
395
395
|
title: "添加新事件",
|
|
396
396
|
width: "400px",
|
|
397
397
|
"append-to-body": !0,
|
|
398
398
|
"close-on-click-modal": !1,
|
|
399
|
-
onClose:
|
|
399
|
+
onClose: p
|
|
400
400
|
}, {
|
|
401
|
-
footer:
|
|
402
|
-
t("div",
|
|
403
|
-
|
|
404
|
-
default:
|
|
405
|
-
|
|
401
|
+
footer: x(() => [
|
|
402
|
+
t("div", gn, [
|
|
403
|
+
u(B(q), { onClick: p }, {
|
|
404
|
+
default: x(() => n[2] || (n[2] = [
|
|
405
|
+
j(" 取消")
|
|
406
406
|
])),
|
|
407
407
|
_: 1
|
|
408
408
|
}),
|
|
409
|
-
|
|
409
|
+
u(B(q), {
|
|
410
410
|
type: "primary",
|
|
411
|
-
onClick:
|
|
411
|
+
onClick: s
|
|
412
412
|
}, {
|
|
413
|
-
default:
|
|
414
|
-
|
|
413
|
+
default: x(() => n[3] || (n[3] = [
|
|
414
|
+
j(" 确定")
|
|
415
415
|
])),
|
|
416
416
|
_: 1
|
|
417
417
|
})
|
|
418
418
|
])
|
|
419
419
|
]),
|
|
420
|
-
default:
|
|
421
|
-
|
|
420
|
+
default: x(() => [
|
|
421
|
+
u(B(Te), {
|
|
422
422
|
ref_key: "ruleForm",
|
|
423
|
-
ref:
|
|
423
|
+
ref: _,
|
|
424
424
|
model: d,
|
|
425
|
-
rules:
|
|
425
|
+
rules: m,
|
|
426
426
|
"label-width": "80px",
|
|
427
427
|
"inline-message": !0,
|
|
428
428
|
"validate-type": "text",
|
|
429
429
|
"label-position": "left",
|
|
430
430
|
class: "add-custom-event-form"
|
|
431
431
|
}, {
|
|
432
|
-
default:
|
|
433
|
-
|
|
432
|
+
default: x(() => [
|
|
433
|
+
u(B(be), {
|
|
434
434
|
label: "事件函数名",
|
|
435
435
|
prop: "eventName",
|
|
436
436
|
required: ""
|
|
437
437
|
}, {
|
|
438
|
-
default:
|
|
439
|
-
|
|
438
|
+
default: x(() => [
|
|
439
|
+
u(B(oe), {
|
|
440
440
|
modelValue: d.eventName,
|
|
441
441
|
"onUpdate:modelValue": n[0] || (n[0] = (a) => d.eventName = a),
|
|
442
442
|
placeholder: "小驼峰格式,如:onDrag"
|
|
@@ -444,13 +444,13 @@ const un = /* @__PURE__ */ F(rn, [["render", pn], ["__scopeId", "data-v-c1779b8d
|
|
|
444
444
|
]),
|
|
445
445
|
_: 1
|
|
446
446
|
}),
|
|
447
|
-
|
|
447
|
+
u(B(be), {
|
|
448
448
|
label: "事件描述",
|
|
449
449
|
prop: "eventDescription",
|
|
450
450
|
required: ""
|
|
451
451
|
}, {
|
|
452
|
-
default:
|
|
453
|
-
|
|
452
|
+
default: x(() => [
|
|
453
|
+
u(B(oe), {
|
|
454
454
|
modelValue: d.eventDescription,
|
|
455
455
|
"onUpdate:modelValue": n[1] || (n[1] = (a) => d.eventDescription = a)
|
|
456
456
|
}, null, 8, ["modelValue"])
|
|
@@ -464,81 +464,81 @@ const un = /* @__PURE__ */ F(rn, [["render", pn], ["__scopeId", "data-v-c1779b8d
|
|
|
464
464
|
_: 1
|
|
465
465
|
}, 8, ["visible"]));
|
|
466
466
|
}
|
|
467
|
-
}, hn = /* @__PURE__ */
|
|
467
|
+
}, hn = /* @__PURE__ */ J(_n, [["__scopeId", "data-v-87e15e51"]]), bn = {
|
|
468
468
|
components: {
|
|
469
|
-
BlockLinkEvent:
|
|
470
|
-
BindEventsDialog:
|
|
469
|
+
BlockLinkEvent: Ze,
|
|
470
|
+
BindEventsDialog: pn,
|
|
471
471
|
TinyPopover: Ue,
|
|
472
|
-
TinyButton:
|
|
472
|
+
TinyButton: q,
|
|
473
473
|
IconChevronDown: We(),
|
|
474
|
-
SvgButton:
|
|
474
|
+
SvgButton: Ye,
|
|
475
475
|
AddEventsDialog: hn
|
|
476
476
|
},
|
|
477
477
|
inheritAttrs: !1,
|
|
478
478
|
setup() {
|
|
479
|
-
const { PLUGIN_NAME:
|
|
479
|
+
const { PLUGIN_NAME: v, activePlugin: o } = Ae(), { pageState: r } = L(), { getBlockEvents: e, getCurrentBlock: d, removeEventLink: _ } = Ke(), { getMaterial: h } = $e(), { confirm: m } = He(), p = qe.global.locale.value, { highlightMethod: s } = Z(G.Page), { commonEvents: y = {} } = Ne("engine.setting.event").options, n = Y({
|
|
480
480
|
eventName: "",
|
|
481
481
|
// 事件名称
|
|
482
482
|
eventBinding: null,
|
|
483
483
|
// 事件绑定的处理方法对象
|
|
484
484
|
componentEvent: {},
|
|
485
|
-
customEvents:
|
|
485
|
+
customEvents: y,
|
|
486
486
|
bindActions: {},
|
|
487
487
|
showBindEventDialog: !1
|
|
488
|
-
}), a = K(() => !!r.isBlock),
|
|
488
|
+
}), a = K(() => !!r.isBlock), i = K(() => Object.keys(n.bindActions).length === 0), l = K(() => ({ ...n.componentEvent, ...n.customEvents }));
|
|
489
489
|
ke(() => {
|
|
490
490
|
var P, N, Q, se, ae;
|
|
491
|
-
const
|
|
491
|
+
const c = (P = r == null ? void 0 : r.currentSchema) == null ? void 0 : P.componentName, f = h(c);
|
|
492
492
|
n.componentEvent = ((Q = (N = f == null ? void 0 : f.content) == null ? void 0 : N.schema) == null ? void 0 : Q.events) || ((se = f == null ? void 0 : f.schema) == null ? void 0 : se.events) || {};
|
|
493
493
|
const V = ((ae = r == null ? void 0 : r.currentSchema) == null ? void 0 : ae.props) || {}, I = Object.keys(V);
|
|
494
494
|
n.bindActions = {}, Object.entries(l.value).forEach(([z, Pe]) => {
|
|
495
495
|
var le, de, re;
|
|
496
496
|
if (I.indexOf(z) > -1) {
|
|
497
|
-
const Be = V[z], { value: Me, params: ce } = Be, we = !ce && ((de = (le = Me.match(/\((.+)\)$/)) == null ? void 0 : le[1]) == null ? void 0 : de.split(",")) || ce,
|
|
497
|
+
const Be = V[z], { value: Me, params: ce } = Be, we = !ce && ((de = (le = Me.match(/\((.+)\)$/)) == null ? void 0 : le[1]) == null ? void 0 : de.split(",")) || ce, O = {
|
|
498
498
|
eventName: z,
|
|
499
499
|
ref: "",
|
|
500
500
|
event: V[z],
|
|
501
501
|
params: we
|
|
502
502
|
};
|
|
503
|
-
if (
|
|
504
|
-
|
|
503
|
+
if (O.event.type === "JSExpression" && (O.ref = O.event.value.replace("this.", "").replace(/\(.*\)$/, "")), r.isBlock) {
|
|
504
|
+
O.metaEvent = Pe;
|
|
505
505
|
const me = e(d()), pe = (re = r == null ? void 0 : r.currentSchema) == null ? void 0 : re.id;
|
|
506
|
-
pe && me && Object.entries(me).forEach(([Le,
|
|
506
|
+
pe && me && Object.entries(me).forEach(([Le, S]) => {
|
|
507
507
|
var ue, ve;
|
|
508
|
-
pe === ((ue =
|
|
508
|
+
pe === ((ue = S == null ? void 0 : S.linked) == null ? void 0 : ue.id) && z === ((ve = S == null ? void 0 : S.linked) == null ? void 0 : ve.event) && (O.linked = S.linked, O.linkedEventName = Le);
|
|
509
509
|
});
|
|
510
510
|
}
|
|
511
|
-
n.bindActions[z] =
|
|
511
|
+
n.bindActions[z] = O;
|
|
512
512
|
}
|
|
513
513
|
});
|
|
514
514
|
});
|
|
515
|
-
const
|
|
516
|
-
f && n.bindActions[
|
|
517
|
-
}, C = (
|
|
515
|
+
const E = (c, f) => {
|
|
516
|
+
f && n.bindActions[c.eventName] || (n.eventBinding = c, ln());
|
|
517
|
+
}, C = (c) => {
|
|
518
518
|
var V;
|
|
519
|
-
Object.keys(((V = r == null ? void 0 : r.currentSchema) == null ? void 0 : V.props) || {}).indexOf(
|
|
519
|
+
Object.keys(((V = r == null ? void 0 : r.currentSchema) == null ? void 0 : V.props) || {}).indexOf(c.eventName) > -1 && delete r.currentSchema.props[c.eventName];
|
|
520
520
|
};
|
|
521
521
|
return {
|
|
522
522
|
state: n,
|
|
523
523
|
isBlock: a,
|
|
524
|
-
isEmpty:
|
|
525
|
-
delEvent: (
|
|
526
|
-
|
|
524
|
+
isEmpty: i,
|
|
525
|
+
delEvent: (c) => {
|
|
526
|
+
m({
|
|
527
527
|
title: "提示",
|
|
528
|
-
message: `您确定要删除事件 ${
|
|
528
|
+
message: `您确定要删除事件 ${c.eventName} 吗?`,
|
|
529
529
|
exec() {
|
|
530
|
-
r.isBlock &&
|
|
530
|
+
r.isBlock && _({ linked: c.linked }), C(c);
|
|
531
531
|
}
|
|
532
532
|
});
|
|
533
533
|
},
|
|
534
|
-
openCodePanel: (
|
|
535
|
-
|
|
536
|
-
|
|
534
|
+
openCodePanel: (c) => {
|
|
535
|
+
c && o(v.Page).then(() => {
|
|
536
|
+
s && s(c.ref);
|
|
537
537
|
});
|
|
538
538
|
},
|
|
539
|
-
openActionDialog:
|
|
540
|
-
handleAddEvent: (
|
|
541
|
-
const { eventName: f, eventDescription: V } =
|
|
539
|
+
openActionDialog: E,
|
|
540
|
+
handleAddEvent: (c) => {
|
|
541
|
+
const { eventName: f, eventDescription: V } = c;
|
|
542
542
|
Object.assign(n.customEvents, {
|
|
543
543
|
[f]: {
|
|
544
544
|
label: {
|
|
@@ -556,20 +556,20 @@ const un = /* @__PURE__ */ F(rn, [["render", pn], ["__scopeId", "data-v-c1779b8d
|
|
|
556
556
|
}
|
|
557
557
|
}), n.showBindEventDialog = !1;
|
|
558
558
|
},
|
|
559
|
-
handleToggleAddEventDialog: (
|
|
560
|
-
n.showBindEventDialog =
|
|
559
|
+
handleToggleAddEventDialog: (c) => {
|
|
560
|
+
n.showBindEventDialog = c;
|
|
561
561
|
},
|
|
562
562
|
renderEventList: l,
|
|
563
|
-
locale:
|
|
563
|
+
locale: p
|
|
564
564
|
};
|
|
565
565
|
}
|
|
566
|
-
}, En = { class: "bind-action-list" },
|
|
567
|
-
function
|
|
568
|
-
const h =
|
|
569
|
-
return
|
|
566
|
+
}, En = { class: "bind-action-list" }, yn = { class: "popover-head" }, xn = { class: "bind-event-list" }, kn = ["onClick"], Vn = { class: "bind-actions" }, Cn = { class: "action-item bind-action-item" }, Nn = ["onClick"], An = { class: "event-bind" }, Dn = { class: "action-buttons" }, In = { class: "empty-action" }, Pn = { class: "icon" };
|
|
567
|
+
function Bn(v, o, r, e, d, _) {
|
|
568
|
+
const h = k("icon-chevron-down"), m = k("tiny-button"), p = k("tiny-popover"), s = k("svg-icon"), y = k("block-link-event"), n = k("svg-button"), a = k("bind-events-dialog"), i = k("add-events-dialog");
|
|
569
|
+
return b(), A($, null, [
|
|
570
570
|
t("div", En, [
|
|
571
|
-
t("div",
|
|
572
|
-
p
|
|
571
|
+
t("div", yn, [
|
|
572
|
+
u(p, {
|
|
573
573
|
popperClass: "option-popper setting-advanced-bind-event-list",
|
|
574
574
|
placement: "bottom-start",
|
|
575
575
|
trigger: "hover",
|
|
@@ -577,37 +577,37 @@ function Mn(u, o, r, e, d, b) {
|
|
|
577
577
|
width: "256",
|
|
578
578
|
"visible-arrow": !1
|
|
579
579
|
}, {
|
|
580
|
-
reference:
|
|
581
|
-
|
|
582
|
-
default:
|
|
580
|
+
reference: x(() => [
|
|
581
|
+
u(m, { class: "bind-event-btn" }, {
|
|
582
|
+
default: x(() => [
|
|
583
583
|
o[2] || (o[2] = t("span", null, "绑定事件", -1)),
|
|
584
|
-
|
|
584
|
+
u(h, { class: "icon-chevron-down bind-event-btn-icon" })
|
|
585
585
|
]),
|
|
586
586
|
_: 1
|
|
587
587
|
})
|
|
588
588
|
]),
|
|
589
|
-
default:
|
|
590
|
-
t("ul",
|
|
591
|
-
(
|
|
589
|
+
default: x(() => [
|
|
590
|
+
t("ul", xn, [
|
|
591
|
+
(b(!0), A($, null, ne(e.renderEventList, (l, E) => {
|
|
592
592
|
var C;
|
|
593
|
-
return
|
|
594
|
-
key:
|
|
595
|
-
class: R(["bind-event-list-item", { "bind-event-list-item-notallow": e.state.bindActions[
|
|
596
|
-
onClick: (D) => e.openActionDialog({ eventName:
|
|
593
|
+
return b(), A("li", {
|
|
594
|
+
key: E,
|
|
595
|
+
class: R(["bind-event-list-item", { "bind-event-list-item-notallow": e.state.bindActions[E] }]),
|
|
596
|
+
onClick: (D) => e.openActionDialog({ eventName: E }, !0)
|
|
597
597
|
}, [
|
|
598
|
-
t("div", null, M(
|
|
599
|
-
], 10,
|
|
598
|
+
t("div", null, M(E) + " | " + M(((C = l == null ? void 0 : l.label) == null ? void 0 : C[e.locale]) || E), 1)
|
|
599
|
+
], 10, kn);
|
|
600
600
|
}), 128))
|
|
601
601
|
])
|
|
602
602
|
]),
|
|
603
603
|
_: 1
|
|
604
604
|
}),
|
|
605
|
-
|
|
605
|
+
u(m, {
|
|
606
606
|
class: "title add-custom-event-button bind-action-button-item",
|
|
607
607
|
onClick: o[0] || (o[0] = (l) => e.handleToggleAddEventDialog(!0))
|
|
608
608
|
}, {
|
|
609
|
-
default:
|
|
610
|
-
|
|
609
|
+
default: x(() => [
|
|
610
|
+
u(s, {
|
|
611
611
|
name: "add",
|
|
612
612
|
class: "custom-event-button-icon"
|
|
613
613
|
}),
|
|
@@ -616,47 +616,46 @@ function Mn(u, o, r, e, d, b) {
|
|
|
616
616
|
_: 1
|
|
617
617
|
})
|
|
618
618
|
]),
|
|
619
|
-
ge(t("ul",
|
|
620
|
-
(
|
|
621
|
-
var
|
|
622
|
-
return
|
|
619
|
+
ge(t("ul", Vn, [
|
|
620
|
+
(b(!0), A($, null, ne(e.state.bindActions, (l) => {
|
|
621
|
+
var E, C;
|
|
622
|
+
return b(), A("li", {
|
|
623
623
|
key: l.eventName
|
|
624
624
|
}, [
|
|
625
|
-
t("div",
|
|
625
|
+
t("div", Cn, [
|
|
626
626
|
t("div", {
|
|
627
627
|
class: "binding-name",
|
|
628
628
|
onClick: (D) => e.openActionDialog(l)
|
|
629
629
|
}, [
|
|
630
630
|
t("div", null, [
|
|
631
|
-
|
|
632
|
-
t("span", null, M((C = (
|
|
631
|
+
j(M(l.eventName), 1),
|
|
632
|
+
t("span", null, M((C = (E = e.renderEventList[l.eventName]) == null ? void 0 : E.label) == null ? void 0 : C[e.locale]), 1)
|
|
633
633
|
]),
|
|
634
634
|
t("div", {
|
|
635
635
|
class: R({ linked: l.linked })
|
|
636
636
|
}, M(l.linkedEventName), 3),
|
|
637
|
-
t("span",
|
|
638
|
-
], 8,
|
|
639
|
-
t("div",
|
|
640
|
-
e.isBlock ? (
|
|
637
|
+
t("span", An, M(l.ref), 1)
|
|
638
|
+
], 8, Nn),
|
|
639
|
+
t("div", Dn, [
|
|
640
|
+
e.isBlock ? (b(), w(y, {
|
|
641
641
|
key: 0,
|
|
642
642
|
data: l
|
|
643
643
|
}, null, 8, ["data"])) : H("", !0),
|
|
644
|
-
|
|
644
|
+
u(n, {
|
|
645
645
|
name: "plugin-icon-page-schema",
|
|
646
646
|
tips: "定位到代码",
|
|
647
647
|
placement: "top",
|
|
648
|
+
hoverBgColor: !1,
|
|
648
649
|
onClick: (D) => e.openCodePanel(l)
|
|
649
650
|
}, null, 8, ["onClick"]),
|
|
650
|
-
|
|
651
|
+
u(n, {
|
|
651
652
|
name: "setting",
|
|
652
|
-
|
|
653
|
-
placement: "top",
|
|
653
|
+
hoverBgColor: !1,
|
|
654
654
|
onClick: (D) => e.openActionDialog(l, !1)
|
|
655
655
|
}, null, 8, ["onClick"]),
|
|
656
|
-
|
|
656
|
+
u(n, {
|
|
657
657
|
name: "delete",
|
|
658
|
-
|
|
659
|
-
placement: "top",
|
|
658
|
+
hoverBgColor: !1,
|
|
660
659
|
onClick: (D) => e.delEvent(l)
|
|
661
660
|
}, null, 8, ["onClick"])
|
|
662
661
|
])
|
|
@@ -666,9 +665,9 @@ function Mn(u, o, r, e, d, b) {
|
|
|
666
665
|
], 512), [
|
|
667
666
|
[_e, !e.isEmpty]
|
|
668
667
|
]),
|
|
669
|
-
ge(t("div",
|
|
670
|
-
t("div",
|
|
671
|
-
|
|
668
|
+
ge(t("div", In, [
|
|
669
|
+
t("div", Pn, [
|
|
670
|
+
u(s, {
|
|
672
671
|
name: "empty-action",
|
|
673
672
|
class: "empty-action-icon"
|
|
674
673
|
})
|
|
@@ -678,10 +677,10 @@ function Mn(u, o, r, e, d, b) {
|
|
|
678
677
|
[_e, e.isEmpty]
|
|
679
678
|
])
|
|
680
679
|
]),
|
|
681
|
-
|
|
680
|
+
u(a, {
|
|
682
681
|
eventBinding: e.state.eventBinding
|
|
683
682
|
}, null, 8, ["eventBinding"]),
|
|
684
|
-
|
|
683
|
+
u(i, {
|
|
685
684
|
visible: e.state.showBindEventDialog,
|
|
686
685
|
componentEvents: e.renderEventList,
|
|
687
686
|
onCloseDialog: o[1] || (o[1] = (l) => e.handleToggleAddEventDialog(!1)),
|
|
@@ -689,23 +688,23 @@ function Mn(u, o, r, e, d, b) {
|
|
|
689
688
|
}, null, 8, ["visible", "componentEvents", "onAddEvent"])
|
|
690
689
|
], 64);
|
|
691
690
|
}
|
|
692
|
-
const
|
|
691
|
+
const Mn = /* @__PURE__ */ J(bn, [["render", Bn], ["__scopeId", "data-v-6bf20fbd"]]), { DEFAULT_LOOP_NAME: U } = sn, { string2Obj: wn } = an, Ln = {
|
|
693
692
|
components: {
|
|
694
|
-
SwitchConfigurator:
|
|
693
|
+
SwitchConfigurator: tn,
|
|
695
694
|
TinyTooltip: je,
|
|
696
695
|
VariableConfigurator: on,
|
|
697
|
-
InputConfigurator:
|
|
698
|
-
CodeConfigurator:
|
|
696
|
+
InputConfigurator: nn,
|
|
697
|
+
CodeConfigurator: en
|
|
699
698
|
},
|
|
700
699
|
inheritAttrs: !1,
|
|
701
700
|
setup() {
|
|
702
|
-
const { pageState:
|
|
701
|
+
const { pageState: v } = L(), o = F(!1), r = K(() => {
|
|
703
702
|
var n;
|
|
704
703
|
return ((n = o.value) == null ? void 0 : n.type) === X.JSEXPRESSION;
|
|
705
704
|
}), e = () => {
|
|
706
705
|
var n, a;
|
|
707
|
-
return ((a = (n =
|
|
708
|
-
}, d =
|
|
706
|
+
return ((a = (n = T().getSchema()) == null ? void 0 : n.loopArgs) == null ? void 0 : a[1]) || U.INDEX;
|
|
707
|
+
}, d = Y({
|
|
709
708
|
loopData: {
|
|
710
709
|
type: X.JSEXPRESSION,
|
|
711
710
|
value: "[]"
|
|
@@ -719,131 +718,131 @@ const wn = /* @__PURE__ */ F(yn, [["render", Mn], ["__scopeId", "data-v-d2c5d4fa
|
|
|
719
718
|
loopKey: "",
|
|
720
719
|
shouldUpdate: !1
|
|
721
720
|
});
|
|
722
|
-
|
|
723
|
-
() => [
|
|
721
|
+
he(
|
|
722
|
+
() => [v == null ? void 0 : v.currentSchema, d.shouldUpdate],
|
|
724
723
|
([n]) => {
|
|
725
|
-
var a,
|
|
726
|
-
o.value = (n == null ? void 0 : n.condition) === void 0 ? !0 : n == null ? void 0 : n.condition, d.loopData = n == null ? void 0 : n.loop, d.loopItem = ((a = n == null ? void 0 : n.loopArgs) == null ? void 0 : a[0]) || "", d.loopIndex = ((
|
|
724
|
+
var a, i, l, E;
|
|
725
|
+
o.value = (n == null ? void 0 : n.condition) === void 0 ? !0 : n == null ? void 0 : n.condition, d.loopData = n == null ? void 0 : n.loop, d.loopItem = ((a = n == null ? void 0 : n.loopArgs) == null ? void 0 : a[0]) || "", d.loopIndex = ((i = n == null ? void 0 : n.loopArgs) == null ? void 0 : i[1]) || "", d.loopKey = ((E = (l = n == null ? void 0 : n.props) == null ? void 0 : l.key) == null ? void 0 : E.value) || "";
|
|
727
726
|
}
|
|
728
727
|
);
|
|
729
|
-
const
|
|
728
|
+
const _ = (n = "") => {
|
|
730
729
|
var D;
|
|
731
730
|
n = n.replace(/\s*/g, "");
|
|
732
|
-
const { getSchema: a, setProp:
|
|
731
|
+
const { getSchema: a, setProp: i } = T(), l = a();
|
|
733
732
|
if (!l)
|
|
734
733
|
return;
|
|
735
|
-
const
|
|
734
|
+
const E = Number(n).toString() !== "NaN";
|
|
736
735
|
let C = (D = l.props) == null ? void 0 : D.key;
|
|
737
|
-
n && !
|
|
736
|
+
n && !E && (C = {
|
|
738
737
|
type: X.JSEXPRESSION,
|
|
739
738
|
value: n
|
|
740
739
|
}), n || (d.isLoop ? C = {
|
|
741
740
|
type: X.JSEXPRESSION,
|
|
742
741
|
value: e()
|
|
743
|
-
} : C = ""),
|
|
742
|
+
} : C = ""), i("key", C);
|
|
744
743
|
};
|
|
745
|
-
|
|
746
|
-
!d.loopKey && d.isLoop &&
|
|
744
|
+
he([() => d.isLoop, () => d.loopIndex], () => {
|
|
745
|
+
!d.loopKey && d.isLoop && _(e()), d.isLoop || _("");
|
|
747
746
|
});
|
|
748
747
|
const h = () => {
|
|
749
748
|
var n;
|
|
750
|
-
d.loopData = (n =
|
|
751
|
-
},
|
|
752
|
-
const { getSchema: a } =
|
|
753
|
-
if (!
|
|
749
|
+
d.loopData = (n = T().getSchema()) == null ? void 0 : n.loop;
|
|
750
|
+
}, m = (n) => {
|
|
751
|
+
const { getSchema: a } = T(), i = a();
|
|
752
|
+
if (!i)
|
|
754
753
|
return;
|
|
755
754
|
const { operateNode: l } = L();
|
|
756
755
|
if (n === !1 || n != null && n.type)
|
|
757
|
-
l({ type: "updateAttributes", id:
|
|
756
|
+
l({ type: "updateAttributes", id: i.id, value: { condition: n } });
|
|
758
757
|
else {
|
|
759
|
-
const { condition:
|
|
760
|
-
l({ type: "updateAttributes", id:
|
|
758
|
+
const { condition: E, children: C, ...D } = i;
|
|
759
|
+
l({ type: "updateAttributes", id: i.id, value: { ...D }, overwrite: !0 });
|
|
761
760
|
}
|
|
762
761
|
L().canvasApi.value.updateRect(), o.value = n;
|
|
763
|
-
},
|
|
764
|
-
const a =
|
|
765
|
-
let
|
|
762
|
+
}, p = (n) => {
|
|
763
|
+
const a = T().getSchema();
|
|
764
|
+
let i = a.loopArgs;
|
|
766
765
|
const { operateNode: l } = L();
|
|
767
|
-
|
|
766
|
+
i ? i[1] = n || U.INDEX : i = [U.ITEM, n], l({ type: "updateAttributes", id: a.id, value: { loopArgs: i } });
|
|
768
767
|
};
|
|
769
768
|
return {
|
|
770
769
|
condition: o,
|
|
771
|
-
setConfig:
|
|
770
|
+
setConfig: m,
|
|
772
771
|
isBind: r,
|
|
773
772
|
state: d,
|
|
774
773
|
setLoop: (n) => {
|
|
775
|
-
const { operateNode: a } = L(), { getSchema:
|
|
774
|
+
const { operateNode: a } = L(), { getSchema: i } = T(), l = i();
|
|
776
775
|
if (n) {
|
|
777
|
-
const
|
|
778
|
-
a({ type: "updateAttributes", id: l.id, value: { loop:
|
|
776
|
+
const E = n != null && n.type ? n : wn(n);
|
|
777
|
+
a({ type: "updateAttributes", id: l.id, value: { loop: E } }), p(U.INDEX);
|
|
779
778
|
} else {
|
|
780
|
-
|
|
781
|
-
const { loop:
|
|
779
|
+
_();
|
|
780
|
+
const { loop: E, loopArgs: C, children: D, ...W } = l;
|
|
782
781
|
a({ type: "updateAttributes", id: l.id, value: W, overwrite: !0 });
|
|
783
782
|
}
|
|
784
783
|
d.shouldUpdate = !d.shouldUpdate;
|
|
785
784
|
},
|
|
786
785
|
setLoopItem: (n) => {
|
|
787
|
-
const a =
|
|
788
|
-
let
|
|
786
|
+
const a = T().getSchema();
|
|
787
|
+
let i = a.loopArgs;
|
|
789
788
|
const { operateNode: l } = L();
|
|
790
|
-
|
|
789
|
+
i ? i[0] = n || U.ITEM : i = [n, U.INDEX], l({ type: "updateAttributes", id: a.id, value: { loopArgs: i } });
|
|
791
790
|
},
|
|
792
|
-
DEFAULT_LOOP_NAME:
|
|
791
|
+
DEFAULT_LOOP_NAME: U,
|
|
793
792
|
openEditor: h,
|
|
794
|
-
setLoopIndex:
|
|
795
|
-
setLoopKey:
|
|
793
|
+
setLoopIndex: p,
|
|
794
|
+
setLoopKey: _,
|
|
796
795
|
getIndexName: e
|
|
797
796
|
};
|
|
798
797
|
}
|
|
799
|
-
},
|
|
800
|
-
function qn(
|
|
798
|
+
}, On = { class: "advanced-config-container" }, Sn = { class: "advnce-config" }, Tn = { class: "advanced-config-form-item" }, Un = ["title"], jn = { class: "advnce-config loop-data-item" }, zn = { class: "advanced-config-form-item" }, Rn = ["title"], Fn = { class: "advnce-config" }, Jn = { class: "advanced-config-form-item" }, Xn = { class: "advnce-config" }, Kn = { class: "advanced-config-form-item" }, $n = { class: "advnce-config" }, Hn = { class: "advanced-config-form-item" };
|
|
799
|
+
function qn(v, o, r, e, d, _) {
|
|
801
800
|
var n, a;
|
|
802
|
-
const h =
|
|
803
|
-
return
|
|
804
|
-
t("div",
|
|
801
|
+
const h = k("switch-configurator"), m = k("variable-configurator"), p = k("code-configurator"), s = k("input-configurator"), y = k("tiny-tooltip");
|
|
802
|
+
return b(), A("div", On, [
|
|
803
|
+
t("div", Sn, [
|
|
805
804
|
o[6] || (o[6] = t("label", { class: "text-ellipsis-multiple" }, "是否渲染", -1)),
|
|
806
|
-
t("div",
|
|
807
|
-
e.isBind ? (
|
|
805
|
+
t("div", Tn, [
|
|
806
|
+
e.isBind ? (b(), A("div", {
|
|
808
807
|
key: 1,
|
|
809
808
|
class: "binding-state text-ellipsis-multiple",
|
|
810
809
|
title: e.condition.value
|
|
811
|
-
}, " 已绑定:" + M(e.condition.value), 9,
|
|
810
|
+
}, " 已绑定:" + M(e.condition.value), 9, Un)) : (b(), w(h, {
|
|
812
811
|
key: 0,
|
|
813
812
|
modelValue: e.condition,
|
|
814
813
|
"onUpdate:modelValue": e.setConfig
|
|
815
814
|
}, null, 8, ["modelValue", "onUpdate:modelValue"])),
|
|
816
|
-
|
|
815
|
+
u(m, {
|
|
817
816
|
modelValue: e.condition,
|
|
818
817
|
"onUpdate:modelValue": [
|
|
819
|
-
o[0] || (o[0] = (
|
|
818
|
+
o[0] || (o[0] = (i) => e.condition = i),
|
|
820
819
|
e.setConfig
|
|
821
820
|
],
|
|
822
821
|
name: "advance"
|
|
823
822
|
}, null, 8, ["modelValue", "onUpdate:modelValue"])
|
|
824
823
|
])
|
|
825
824
|
]),
|
|
826
|
-
t("div",
|
|
825
|
+
t("div", jn, [
|
|
827
826
|
o[7] || (o[7] = t("label", { class: "text-ellipsis-multiple" }, "循环数据", -1)),
|
|
828
|
-
t("div",
|
|
829
|
-
e.state.isLoop ? (
|
|
827
|
+
t("div", zn, [
|
|
828
|
+
e.state.isLoop ? (b(), A("div", {
|
|
830
829
|
key: 1,
|
|
831
830
|
class: "binding-state text-ellipsis-multiple",
|
|
832
831
|
title: (n = e.state.loopData) == null ? void 0 : n.value
|
|
833
|
-
}, " 已绑定:" + M((a = e.state.loopData) == null ? void 0 : a.value), 9,
|
|
832
|
+
}, " 已绑定:" + M((a = e.state.loopData) == null ? void 0 : a.value), 9, Rn)) : (b(), w(p, {
|
|
834
833
|
key: 0,
|
|
835
834
|
modelValue: e.state.loopData,
|
|
836
835
|
"onUpdate:modelValue": [
|
|
837
|
-
o[1] || (o[1] = (
|
|
836
|
+
o[1] || (o[1] = (i) => e.state.loopData = i),
|
|
838
837
|
e.setLoop
|
|
839
838
|
],
|
|
840
839
|
"data-type": "JSExpression",
|
|
841
840
|
onOpen: e.openEditor
|
|
842
841
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "onOpen"])),
|
|
843
|
-
|
|
842
|
+
u(m, {
|
|
844
843
|
modelValue: e.state.loopData,
|
|
845
844
|
"onUpdate:modelValue": [
|
|
846
|
-
o[2] || (o[2] = (
|
|
845
|
+
o[2] || (o[2] = (i) => e.state.loopData = i),
|
|
847
846
|
e.setLoop
|
|
848
847
|
],
|
|
849
848
|
name: "advance"
|
|
@@ -852,24 +851,24 @@ function qn(u, o, r, e, d, b) {
|
|
|
852
851
|
]),
|
|
853
852
|
t("div", Fn, [
|
|
854
853
|
o[8] || (o[8] = t("label", { class: "text-ellipsis-multiple" }, "迭代变量名", -1)),
|
|
855
|
-
t("div",
|
|
856
|
-
|
|
854
|
+
t("div", Jn, [
|
|
855
|
+
u(s, {
|
|
857
856
|
modelValue: e.state.loopItem,
|
|
858
857
|
"onUpdate:modelValue": [
|
|
859
|
-
o[3] || (o[3] = (
|
|
858
|
+
o[3] || (o[3] = (i) => e.state.loopItem = i),
|
|
860
859
|
e.setLoopItem
|
|
861
860
|
],
|
|
862
861
|
placeholder: `默认值为:${e.DEFAULT_LOOP_NAME.ITEM}`
|
|
863
862
|
}, null, 8, ["modelValue", "placeholder", "onUpdate:modelValue"])
|
|
864
863
|
])
|
|
865
864
|
]),
|
|
866
|
-
t("div",
|
|
865
|
+
t("div", Xn, [
|
|
867
866
|
o[9] || (o[9] = t("label", { class: "text-ellipsis-multiple" }, "索引变量名", -1)),
|
|
868
|
-
t("div",
|
|
869
|
-
|
|
867
|
+
t("div", Kn, [
|
|
868
|
+
u(s, {
|
|
870
869
|
modelValue: e.state.loopIndex,
|
|
871
870
|
"onUpdate:modelValue": [
|
|
872
|
-
o[4] || (o[4] = (
|
|
871
|
+
o[4] || (o[4] = (i) => e.state.loopIndex = i),
|
|
873
872
|
e.setLoopIndex
|
|
874
873
|
],
|
|
875
874
|
placeholder: `默认值为:${e.DEFAULT_LOOP_NAME.INDEX}`
|
|
@@ -878,13 +877,16 @@ function qn(u, o, r, e, d, b) {
|
|
|
878
877
|
]),
|
|
879
878
|
t("div", $n, [
|
|
880
879
|
o[10] || (o[10] = t("label", { class: "text-ellipsis-multiple" }, "key", -1)),
|
|
881
|
-
t("div",
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
880
|
+
t("div", Hn, [
|
|
881
|
+
u(y, {
|
|
882
|
+
content: "建议填写循环项中的唯一值(如item.id),如果填写为数字将不保存",
|
|
883
|
+
effect: "light"
|
|
884
|
+
}, {
|
|
885
|
+
default: x(() => [
|
|
886
|
+
u(s, {
|
|
885
887
|
modelValue: e.state.loopKey,
|
|
886
888
|
"onUpdate:modelValue": [
|
|
887
|
-
o[5] || (o[5] = (
|
|
889
|
+
o[5] || (o[5] = (i) => e.state.loopKey = i),
|
|
888
890
|
e.setLoopKey
|
|
889
891
|
],
|
|
890
892
|
placeholder: `默认为索引名:${e.getIndexName()}`
|
|
@@ -896,30 +898,30 @@ function qn(u, o, r, e, d, b) {
|
|
|
896
898
|
])
|
|
897
899
|
]);
|
|
898
900
|
}
|
|
899
|
-
const
|
|
901
|
+
const Yn = /* @__PURE__ */ J(Ln, [["render", qn], ["__scopeId", "data-v-2254f006"]]), Zn = {
|
|
900
902
|
__name: "Main",
|
|
901
|
-
setup(
|
|
902
|
-
const o =
|
|
903
|
-
return (r, e) => (
|
|
903
|
+
setup(v) {
|
|
904
|
+
const o = F(["bindEvent", "advancedConfig"]);
|
|
905
|
+
return (r, e) => (b(), w(B(ze), {
|
|
904
906
|
modelValue: o.value,
|
|
905
907
|
"onUpdate:modelValue": e[0] || (e[0] = (d) => o.value = d)
|
|
906
908
|
}, {
|
|
907
|
-
default:
|
|
908
|
-
|
|
909
|
+
default: x(() => [
|
|
910
|
+
u(B(Ee), {
|
|
909
911
|
title: "事件绑定",
|
|
910
912
|
name: "bindEvent"
|
|
911
913
|
}, {
|
|
912
|
-
default:
|
|
913
|
-
|
|
914
|
+
default: x(() => [
|
|
915
|
+
u(Mn)
|
|
914
916
|
]),
|
|
915
917
|
_: 1
|
|
916
918
|
}),
|
|
917
|
-
|
|
919
|
+
u(B(Ee), {
|
|
918
920
|
title: "高级配置",
|
|
919
921
|
name: "advancedConfig"
|
|
920
922
|
}, {
|
|
921
|
-
default:
|
|
922
|
-
|
|
923
|
+
default: x(() => [
|
|
924
|
+
u(Yn)
|
|
923
925
|
]),
|
|
924
926
|
_: 1
|
|
925
927
|
})
|
|
@@ -927,12 +929,11 @@ const Zn = /* @__PURE__ */ F(On, [["render", qn], ["__scopeId", "data-v-f44b8182
|
|
|
927
929
|
_: 1
|
|
928
930
|
}, 8, ["modelValue"]));
|
|
929
931
|
}
|
|
930
|
-
}, De = "newMethod",
|
|
931
|
-
default: "选择已有方法或者添加新方法(点击 确定 之后将在JS面板中创建一个该名称的新方法)",
|
|
932
|
+
}, De = "newMethod", Gn = /[^0-9a-zA-Z_$]/, Wn = /^[a-zA-Z_$][0-9a-zA-Z_$]*$/, ee = {
|
|
932
933
|
exist: "方法名称已存在",
|
|
933
934
|
ruleInvalid: "请输入有效的方法名,可以由字母、数字、下划线、$ 符号组成,不能以数字开头",
|
|
934
935
|
empty: "方法名称不能为空"
|
|
935
|
-
},
|
|
936
|
+
}, Qn = {
|
|
936
937
|
components: {
|
|
937
938
|
MonacoEditor: Ge,
|
|
938
939
|
TinyInput: oe,
|
|
@@ -942,28 +943,28 @@ const Zn = /* @__PURE__ */ F(On, [["render", qn], ["__scopeId", "data-v-f44b8182
|
|
|
942
943
|
dialogVisible: Boolean
|
|
943
944
|
},
|
|
944
945
|
setup() {
|
|
945
|
-
const { getMethodNameList:
|
|
946
|
+
const { getMethodNameList: v } = Z(G.Page), o = Ve("context"), r = {
|
|
946
947
|
language: "json",
|
|
947
948
|
lineNumbers: !1,
|
|
948
949
|
minimap: {
|
|
949
950
|
enabled: !1
|
|
950
951
|
}
|
|
951
|
-
}, e = (
|
|
952
|
-
o.editorContent =
|
|
953
|
-
}, d = (
|
|
952
|
+
}, e = (p) => {
|
|
953
|
+
o.editorContent = p;
|
|
954
|
+
}, d = (p) => !p, _ = (p) => v == null ? void 0 : v().includes(p), h = (p) => !Wn.test(p);
|
|
954
955
|
return {
|
|
955
956
|
NEW_METHOD_TYPE: De,
|
|
956
957
|
context: o,
|
|
957
958
|
editorOptions: r,
|
|
958
|
-
change: (
|
|
959
|
-
const
|
|
959
|
+
change: (p) => {
|
|
960
|
+
const s = [
|
|
960
961
|
{ validator: d, tip: ee.empty },
|
|
961
|
-
{ validator:
|
|
962
|
+
{ validator: _, tip: ee.exist },
|
|
962
963
|
{ validator: h, tip: ee.ruleInvalid }
|
|
963
964
|
];
|
|
964
|
-
for (let
|
|
965
|
-
const n =
|
|
966
|
-
if (n.validator(
|
|
965
|
+
for (let y = 0; y < s.length; y++) {
|
|
966
|
+
const n = s[y];
|
|
967
|
+
if (n.validator(p)) {
|
|
967
968
|
o.tipError = !0, o.tip = n.tip;
|
|
968
969
|
return;
|
|
969
970
|
}
|
|
@@ -973,69 +974,68 @@ const Zn = /* @__PURE__ */ F(On, [["render", qn], ["__scopeId", "data-v-f44b8182
|
|
|
973
974
|
editorContentChange: e
|
|
974
975
|
};
|
|
975
976
|
}
|
|
976
|
-
},
|
|
977
|
+
}, eo = { class: "content-right" }, no = { class: "new-action-tip" }, oo = { class: "content-right-title" }, to = { class: "set-params-tip" }, io = { class: "content-right-monaco" }, so = {
|
|
977
978
|
key: 1,
|
|
978
979
|
class: "mark"
|
|
979
|
-
},
|
|
980
|
+
}, ao = {
|
|
980
981
|
key: 0,
|
|
981
982
|
class: "params-tip"
|
|
982
983
|
};
|
|
983
|
-
function
|
|
984
|
-
const h =
|
|
985
|
-
return
|
|
984
|
+
function lo(v, o, r, e, d, _) {
|
|
985
|
+
const h = k("tiny-input"), m = k("tiny-checkbox"), p = k("monaco-editor");
|
|
986
|
+
return b(), A("div", eo, [
|
|
986
987
|
t("div", {
|
|
987
988
|
class: R(["content-right-top", { "tip-error": e.context.tipError }])
|
|
988
989
|
}, [
|
|
989
990
|
o[2] || (o[2] = t("div", { class: "content-right-title" }, "方法名称", -1)),
|
|
990
|
-
|
|
991
|
+
u(h, {
|
|
991
992
|
modelValue: e.context.bindMethodInfo.name,
|
|
992
993
|
"onUpdate:modelValue": [
|
|
993
|
-
o[0] || (o[0] = (
|
|
994
|
+
o[0] || (o[0] = (s) => e.context.bindMethodInfo.name = s),
|
|
994
995
|
e.change
|
|
995
996
|
],
|
|
996
997
|
disabled: e.context.bindMethodInfo.type !== e.NEW_METHOD_TYPE,
|
|
997
998
|
class: R([{ "status-error": e.context.tipError }]),
|
|
998
999
|
placeholder: "请从左侧选择一个方法进行绑定,或者选择添加新方法,输入自定义方法名称。"
|
|
999
1000
|
}, null, 8, ["modelValue", "disabled", "class", "onUpdate:modelValue"]),
|
|
1000
|
-
t("div",
|
|
1001
|
+
t("div", no, M(e.context.tip), 1)
|
|
1001
1002
|
], 2),
|
|
1002
1003
|
t("div", {
|
|
1003
1004
|
class: R(["content-right-bottom", { "tip-error": !e.context.isValidParams }])
|
|
1004
1005
|
}, [
|
|
1005
|
-
t("div",
|
|
1006
|
-
|
|
1006
|
+
t("div", oo, [
|
|
1007
|
+
u(m, {
|
|
1007
1008
|
modelValue: e.context.enableExtraParams,
|
|
1008
|
-
"onUpdate:modelValue": o[1] || (o[1] = (
|
|
1009
|
+
"onUpdate:modelValue": o[1] || (o[1] = (s) => e.context.enableExtraParams = s),
|
|
1009
1010
|
name: "tiny-checkbox"
|
|
1010
1011
|
}, {
|
|
1011
|
-
default:
|
|
1012
|
-
|
|
1012
|
+
default: x(() => o[3] || (o[3] = [
|
|
1013
|
+
j("扩展参数设置")
|
|
1013
1014
|
])),
|
|
1014
1015
|
_: 1
|
|
1015
1016
|
}, 8, ["modelValue"]),
|
|
1016
|
-
t("div",
|
|
1017
|
+
t("div", to, [
|
|
1017
1018
|
o[4] || (o[4] = t("div", null, "扩展参数:调用当前事件传入的真实参数,数组格式,追加在原有事件参数之后", -1)),
|
|
1018
|
-
|
|
1019
|
+
j(" 如: " + M(e.context.bindMethodInfo.name) + "(eventArgs, extParam1, extParam2, ...) ", 1)
|
|
1019
1020
|
])
|
|
1020
1021
|
]),
|
|
1021
|
-
t("div",
|
|
1022
|
-
r.dialogVisible ? (
|
|
1022
|
+
t("div", io, [
|
|
1023
|
+
r.dialogVisible ? (b(), w(p, {
|
|
1023
1024
|
key: 0,
|
|
1024
1025
|
value: e.context.editorContent,
|
|
1025
1026
|
options: e.editorOptions,
|
|
1026
1027
|
onChange: e.editorContentChange,
|
|
1027
1028
|
class: "monaco-editor"
|
|
1028
1029
|
}, null, 8, ["value", "options", "onChange"])) : H("", !0),
|
|
1029
|
-
e.context.enableExtraParams ? H("", !0) : (
|
|
1030
|
+
e.context.enableExtraParams ? H("", !0) : (b(), A("div", so))
|
|
1030
1031
|
]),
|
|
1031
|
-
!e.context.isValidParams && e.context.enableExtraParams ? (
|
|
1032
|
+
!e.context.isValidParams && e.context.enableExtraParams ? (b(), A("div", ao, ' 请输入数组格式的参数,参数可以为表达式。例如:["extParam1", "item.status", 1, "getNames()"] ')) : H("", !0)
|
|
1032
1033
|
], 2)
|
|
1033
1034
|
]);
|
|
1034
1035
|
}
|
|
1035
|
-
const
|
|
1036
|
+
const ro = /* @__PURE__ */ J(Qn, [["render", lo], ["__scopeId", "data-v-f2c9b5af"]]), co = {
|
|
1036
1037
|
components: {
|
|
1037
|
-
TinySearch:
|
|
1038
|
-
IconYes: Qe()
|
|
1038
|
+
TinySearch: Fe
|
|
1039
1039
|
},
|
|
1040
1040
|
props: {
|
|
1041
1041
|
eventBinding: {
|
|
@@ -1043,27 +1043,27 @@ const co = /* @__PURE__ */ F(eo, [["render", ro], ["__scopeId", "data-v-2807a818
|
|
|
1043
1043
|
default: () => ({})
|
|
1044
1044
|
}
|
|
1045
1045
|
},
|
|
1046
|
-
setup(
|
|
1047
|
-
const { getMethodNameList: o } = Z(G.Page), r =
|
|
1048
|
-
const
|
|
1049
|
-
var
|
|
1050
|
-
return Number.parseInt((
|
|
1051
|
-
}).sort((a,
|
|
1052
|
-
let n = `${(
|
|
1053
|
-
return
|
|
1054
|
-
}, h = (
|
|
1055
|
-
d.bindMethodInfo =
|
|
1046
|
+
setup(v) {
|
|
1047
|
+
const { getMethodNameList: o } = Z(G.Page), r = F(""), e = F([]), d = Ve("context"), _ = (m, p) => {
|
|
1048
|
+
const s = m.map((a) => {
|
|
1049
|
+
var i;
|
|
1050
|
+
return Number.parseInt((i = a.match(/\d+$/)) == null ? void 0 : i[0]) || 0;
|
|
1051
|
+
}).sort((a, i) => a - i).pop();
|
|
1052
|
+
let n = `${(p == null ? void 0 : p.replace(Gn, "_")) || ""}New`;
|
|
1053
|
+
return s > -1 && (n += `${s + 1}`), n;
|
|
1054
|
+
}, h = (m) => {
|
|
1055
|
+
d.bindMethodInfo = m;
|
|
1056
1056
|
};
|
|
1057
1057
|
return ke(() => {
|
|
1058
|
-
var a,
|
|
1059
|
-
const
|
|
1058
|
+
var a, i;
|
|
1059
|
+
const m = (a = v.eventBinding) == null ? void 0 : a.eventName, p = (o == null ? void 0 : o().filter((l) => l.includes(m))) || [], y = {
|
|
1060
1060
|
title: "添加新方法",
|
|
1061
|
-
name:
|
|
1061
|
+
name: _(p, m),
|
|
1062
1062
|
type: De
|
|
1063
1063
|
};
|
|
1064
|
-
(
|
|
1064
|
+
(i = v.eventBinding) != null && i.ref ? h({ name: v.eventBinding.ref }) : h(y);
|
|
1065
1065
|
const n = (o == null ? void 0 : o().filter((l) => l.includes(r.value)).map((l) => ({ name: l }))) || [];
|
|
1066
|
-
e.value = [
|
|
1066
|
+
e.value = [y, ...n];
|
|
1067
1067
|
}), {
|
|
1068
1068
|
context: d,
|
|
1069
1069
|
searchValue: r,
|
|
@@ -1071,49 +1071,43 @@ const co = /* @__PURE__ */ F(eo, [["render", ro], ["__scopeId", "data-v-2807a818
|
|
|
1071
1071
|
selectMethod: h
|
|
1072
1072
|
};
|
|
1073
1073
|
}
|
|
1074
|
-
},
|
|
1075
|
-
function
|
|
1076
|
-
const h =
|
|
1077
|
-
return
|
|
1074
|
+
}, mo = { class: "dialog-content-left" }, po = { class: "left-list-wrap" }, uo = { class: "left-action-list" }, vo = { class: "action-list-wrap" }, fo = ["onClick"];
|
|
1075
|
+
function go(v, o, r, e, d, _) {
|
|
1076
|
+
const h = k("tiny-search");
|
|
1077
|
+
return b(), A("div", mo, [
|
|
1078
1078
|
o[1] || (o[1] = t("div", { class: "left-title" }, "响应方法", -1)),
|
|
1079
|
-
t("div",
|
|
1080
|
-
t("div",
|
|
1081
|
-
|
|
1079
|
+
t("div", po, [
|
|
1080
|
+
t("div", uo, [
|
|
1081
|
+
u(h, {
|
|
1082
1082
|
modelValue: e.searchValue,
|
|
1083
|
-
"onUpdate:modelValue": o[0] || (o[0] = (
|
|
1083
|
+
"onUpdate:modelValue": o[0] || (o[0] = (m) => e.searchValue = m),
|
|
1084
1084
|
placeholder: "搜索"
|
|
1085
1085
|
}, null, 8, ["modelValue"]),
|
|
1086
|
-
t("ul",
|
|
1087
|
-
(
|
|
1088
|
-
key:
|
|
1089
|
-
onClick: (
|
|
1086
|
+
t("ul", vo, [
|
|
1087
|
+
(b(!0), A($, null, ne(e.filteredMethodList, (m) => (b(), A("li", {
|
|
1088
|
+
key: m.name,
|
|
1089
|
+
onClick: (p) => e.selectMethod(m)
|
|
1090
1090
|
}, [
|
|
1091
1091
|
t("div", {
|
|
1092
|
-
class: R(["action-name", { active:
|
|
1093
|
-
},
|
|
1094
|
-
|
|
1095
|
-
c.name === e.context.bindMethodInfo.name ? (_(), w(v, {
|
|
1096
|
-
key: 0,
|
|
1097
|
-
class: "action-selected-icon"
|
|
1098
|
-
})) : H("", !0)
|
|
1099
|
-
], 2)
|
|
1100
|
-
], 8, go))), 128))
|
|
1092
|
+
class: R(["action-name", { active: m.name === e.context.bindMethodInfo.name }])
|
|
1093
|
+
}, M(m.title || m.name), 3)
|
|
1094
|
+
], 8, fo))), 128))
|
|
1101
1095
|
])
|
|
1102
1096
|
])
|
|
1103
1097
|
])
|
|
1104
1098
|
]);
|
|
1105
1099
|
}
|
|
1106
|
-
const
|
|
1100
|
+
const _o = /* @__PURE__ */ J(co, [["render", go], ["__scopeId", "data-v-0859add1"]]), Io = {
|
|
1107
1101
|
...te,
|
|
1108
|
-
entry:
|
|
1102
|
+
entry: Zn,
|
|
1109
1103
|
options: {
|
|
1110
|
-
commonEvents:
|
|
1104
|
+
commonEvents: un
|
|
1111
1105
|
},
|
|
1112
1106
|
components: {
|
|
1113
|
-
BindEventsDialogSidebar:
|
|
1114
|
-
BindEventsDialogContent:
|
|
1107
|
+
BindEventsDialogSidebar: _o,
|
|
1108
|
+
BindEventsDialogContent: ro
|
|
1115
1109
|
}
|
|
1116
1110
|
};
|
|
1117
1111
|
export {
|
|
1118
|
-
|
|
1112
|
+
Io as default
|
|
1119
1113
|
};
|