@opentiny/tiny-engine-setting-events 1.0.3 → 1.0.4
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 +489 -483
- package/dist/style.css +1 -1
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
import "./style.css";
|
|
2
|
-
import { ref as
|
|
3
|
-
import { Input as
|
|
4
|
-
import { useLayout as
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { constants as
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
for (const [e,
|
|
15
|
-
|
|
16
|
-
return
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
},
|
|
2
|
+
import { ref as Q, reactive as $, watchEffect as ke, resolveComponent as g, openBlock as y, createBlock as z, withCtx as v, createElementVNode as o, createVNode as d, createTextVNode as w, createElementBlock as B, Fragment as Z, renderList as oe, normalizeClass as q, toDisplayString as L, createCommentVNode as K, nextTick as Me, unref as O, computed as Y, withModifiers as we, withDirectives as ve, vShow as fe, watch as ge } from "vue";
|
|
3
|
+
import { Input as ie, Button as G, Search as Be, Popover as xe, DialogBox as Ve, Switch as Se, Form as Oe, FormItem as _e, Tooltip as Le, Collapse as Te, CollapseItem as he } from "@opentiny/vue";
|
|
4
|
+
import { useLayout as Ie, useCanvas as W, useHistory as Ue, useBlock as ze, useResource as je, useModal as Fe, useProperties as C } from "@opentiny/tiny-engine-controller";
|
|
5
|
+
import Je from "@opentiny/tiny-engine-controller/js/i18n";
|
|
6
|
+
import { VueMonaco as Re, BlockLinkEvent as Xe, SvgButton as qe, MetaSwitch as He, MetaBindVariable as Ke, MetaInput as Ye, MetaCodeEditor as Qe } from "@opentiny/tiny-engine-common";
|
|
7
|
+
import { iconYes as Ze, iconHelpQuery as Ne, iconChevronDown as Ge } from "@opentiny/vue-icon";
|
|
8
|
+
import { theme as We, string2Obj as $e } from "@opentiny/tiny-engine-controller/adapter";
|
|
9
|
+
import { string2Ast as be, ast2String as en } from "@opentiny/tiny-engine-controller/js/ast";
|
|
10
|
+
import { PROP_DATA_TYPE as H } from "@opentiny/tiny-engine-controller/utils";
|
|
11
|
+
import { constants as nn } from "@opentiny/tiny-engine-utils";
|
|
12
|
+
const ee = (p, t) => {
|
|
13
|
+
const E = p.__vccOpts || p;
|
|
14
|
+
for (const [e, a] of t)
|
|
15
|
+
E[e] = a;
|
|
16
|
+
return E;
|
|
17
|
+
}, se = Q(!1), tn = () => {
|
|
18
|
+
se.value = !0;
|
|
19
|
+
}, ye = () => {
|
|
20
|
+
se.value = !1;
|
|
21
|
+
}, Ee = "newMethod", on = /[^0-9a-zA-Z_$]/, sn = /^[a-zA-Z_$][0-9a-zA-Z_$]*$/, X = {
|
|
22
22
|
default: "选择已有方法或者添加新方法(点击 确定 之后将在JS面板中创建一个该名称的新方法)",
|
|
23
23
|
exist: "方法名称已存在",
|
|
24
24
|
ruleInvalid: "请输入有效的方法名,可以由字母、数字、下划线、$ 符号组成,不能以数字开头",
|
|
25
25
|
empty: "方法名称不能为空"
|
|
26
|
-
},
|
|
26
|
+
}, an = {
|
|
27
27
|
components: {
|
|
28
|
-
MonacoEditor:
|
|
29
|
-
TinyInput:
|
|
30
|
-
TinyButton:
|
|
31
|
-
TinySearch:
|
|
32
|
-
TinyPopover:
|
|
33
|
-
TinyDialogBox:
|
|
34
|
-
IconYes:
|
|
35
|
-
IconHelpQuery:
|
|
36
|
-
TinySwitch:
|
|
28
|
+
MonacoEditor: Re,
|
|
29
|
+
TinyInput: ie,
|
|
30
|
+
TinyButton: G,
|
|
31
|
+
TinySearch: Be,
|
|
32
|
+
TinyPopover: xe,
|
|
33
|
+
TinyDialogBox: Ve,
|
|
34
|
+
IconYes: Ze(),
|
|
35
|
+
IconHelpQuery: Ne(),
|
|
36
|
+
TinySwitch: Se
|
|
37
37
|
},
|
|
38
38
|
inheritAttrs: !1,
|
|
39
39
|
props: {
|
|
@@ -42,285 +42,284 @@ const oe = (l, i) => {
|
|
|
42
42
|
default: () => ({})
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
|
-
setup(
|
|
46
|
-
const { PLUGIN_NAME:
|
|
45
|
+
setup(p) {
|
|
46
|
+
const { PLUGIN_NAME: t, getPluginApi: E, activePlugin: e } = Ie(), { pageState: a } = W(), { getMethodNameList: f, getMethods: P, saveMethod: k, highlightMethod: x } = E(t.PageController), V = Q(null), i = $({
|
|
47
47
|
searchValue: "",
|
|
48
48
|
editorContent: "",
|
|
49
49
|
bindMethodInfo: {},
|
|
50
50
|
filterMethodList: [],
|
|
51
|
-
tip:
|
|
51
|
+
tip: X.default,
|
|
52
52
|
tipError: !1,
|
|
53
53
|
enableExtraParams: !1,
|
|
54
54
|
isValidParams: !0
|
|
55
|
-
}),
|
|
55
|
+
}), n = {
|
|
56
56
|
roundedSelection: !0,
|
|
57
57
|
automaticLayout: !0,
|
|
58
58
|
autoIndent: !0,
|
|
59
59
|
language: "json",
|
|
60
60
|
formatOnPaste: !0,
|
|
61
61
|
tabSize: 2,
|
|
62
|
-
theme:
|
|
62
|
+
theme: We(),
|
|
63
63
|
lineNumbers: !1,
|
|
64
64
|
minimap: {
|
|
65
65
|
enabled: !1
|
|
66
66
|
}
|
|
67
|
-
},
|
|
68
|
-
const m = s.map((
|
|
69
|
-
var
|
|
70
|
-
return Number.parseInt((
|
|
71
|
-
}).sort((
|
|
72
|
-
let
|
|
73
|
-
return m > -1 && (
|
|
67
|
+
}, c = (s, r) => {
|
|
68
|
+
const m = s.map((N) => {
|
|
69
|
+
var b;
|
|
70
|
+
return Number.parseInt((b = N.match(/\d+$/)) == null ? void 0 : b[0]) || 0;
|
|
71
|
+
}).sort((N, b) => N - b).pop();
|
|
72
|
+
let M = `${(r == null ? void 0 : r.replace(on, "_")) || ""}New`;
|
|
73
|
+
return m > -1 && (M += `${m + 1}`), M;
|
|
74
74
|
};
|
|
75
|
-
|
|
76
|
-
var
|
|
77
|
-
const s = (
|
|
75
|
+
ke(() => {
|
|
76
|
+
var N, b;
|
|
77
|
+
const s = (N = p.eventBinding) == null ? void 0 : N.eventName, r = (f == null ? void 0 : f().filter((T) => T.indexOf(s) > -1)) || [], _ = {
|
|
78
78
|
title: "添加新方法",
|
|
79
|
-
name:
|
|
80
|
-
type:
|
|
79
|
+
name: c(r, s),
|
|
80
|
+
type: Ee
|
|
81
81
|
};
|
|
82
|
-
(
|
|
83
|
-
name:
|
|
84
|
-
} :
|
|
85
|
-
const
|
|
86
|
-
|
|
82
|
+
(b = p.eventBinding) != null && b.ref ? i.bindMethodInfo = {
|
|
83
|
+
name: p.eventBinding.ref
|
|
84
|
+
} : i.bindMethodInfo = _;
|
|
85
|
+
const M = (f == null ? void 0 : f().filter((T) => T.indexOf(i.searchValue) > -1).map((T) => ({ name: T }))) || [];
|
|
86
|
+
i.filterMethodList = [_, ...M];
|
|
87
87
|
});
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
},
|
|
91
|
-
var
|
|
88
|
+
const u = (s) => {
|
|
89
|
+
i.bindMethodInfo = s;
|
|
90
|
+
}, I = (s) => {
|
|
91
|
+
var N, b;
|
|
92
92
|
if (!s)
|
|
93
93
|
return;
|
|
94
|
-
const r = (
|
|
94
|
+
const r = (N = p.eventBinding) == null ? void 0 : N.eventName;
|
|
95
95
|
if (!r)
|
|
96
96
|
return;
|
|
97
|
-
const m = (
|
|
97
|
+
const m = (b = a == null ? void 0 : a.currentSchema) == null ? void 0 : b.props;
|
|
98
98
|
if (!m)
|
|
99
99
|
return;
|
|
100
|
-
const { name:
|
|
101
|
-
|
|
100
|
+
const { name: _, extra: M } = s;
|
|
101
|
+
p[r] || (m[r] = {
|
|
102
102
|
type: "JSExpression",
|
|
103
103
|
value: ""
|
|
104
|
-
}),
|
|
105
|
-
},
|
|
106
|
-
|
|
107
|
-
}, D = (s) => !s,
|
|
104
|
+
}), M && i.enableExtraParams && (m[r].params = M), m[r].value = `this.${_}`, Ue().addHistory();
|
|
105
|
+
}, l = () => {
|
|
106
|
+
i.tipError = !1, i.tip = X.default;
|
|
107
|
+
}, D = (s) => !s, U = (s) => f == null ? void 0 : f().includes(s), j = (s) => !sn.test(s), ae = (s) => {
|
|
108
108
|
const r = [
|
|
109
|
-
{ validator: D, tip:
|
|
110
|
-
{ validator:
|
|
111
|
-
{ validator:
|
|
109
|
+
{ validator: D, tip: X.empty },
|
|
110
|
+
{ validator: U, tip: X.exist },
|
|
111
|
+
{ validator: j, tip: X.ruleInvalid }
|
|
112
112
|
];
|
|
113
113
|
for (let m = 0; m < r.length; m++) {
|
|
114
|
-
const
|
|
115
|
-
if (
|
|
116
|
-
|
|
114
|
+
const _ = r[m];
|
|
115
|
+
if (_.validator(s)) {
|
|
116
|
+
i.tipError = !0, i.tip = _.tip;
|
|
117
117
|
return;
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
|
-
|
|
121
|
-
},
|
|
120
|
+
i.tipError = !1, i.tip = X.default;
|
|
121
|
+
}, le = () => {
|
|
122
122
|
var r;
|
|
123
123
|
let s = "";
|
|
124
|
-
if (
|
|
124
|
+
if (i.enableExtraParams)
|
|
125
125
|
try {
|
|
126
|
-
const m = (r =
|
|
127
|
-
s = JSON.parse(m),
|
|
126
|
+
const m = (r = V.value) == null ? void 0 : r.getEditor().getValue();
|
|
127
|
+
s = JSON.parse(m), i.isValidParams = Array.isArray(s);
|
|
128
128
|
} catch {
|
|
129
|
-
|
|
129
|
+
i.isValidParams = !1;
|
|
130
130
|
}
|
|
131
131
|
return s;
|
|
132
|
-
},
|
|
133
|
-
var m,
|
|
134
|
-
let s = (
|
|
132
|
+
}, h = (s) => Array.from({ length: s.length }, (r, m) => `args${m}`).join(","), A = () => {
|
|
133
|
+
var m, _, M, N;
|
|
134
|
+
let s = (_ = (m = P()) == null ? void 0 : m[i.bindMethodInfo.name]) == null ? void 0 : _.value, r = "{}";
|
|
135
135
|
if (s) {
|
|
136
|
-
let
|
|
136
|
+
let b = {};
|
|
137
137
|
try {
|
|
138
|
-
|
|
138
|
+
b = be(s);
|
|
139
139
|
} catch {
|
|
140
|
-
s = s.replace("function", `function ${
|
|
140
|
+
s = s.replace("function", `function ${i.bindMethodInfo.name}`), b = be(s);
|
|
141
141
|
}
|
|
142
|
-
(
|
|
142
|
+
(N = (M = b == null ? void 0 : b.program) == null ? void 0 : M.body[0]) != null && N.body && (r = en(b.program.body[0].body));
|
|
143
143
|
}
|
|
144
144
|
return r || `{
|
|
145
145
|
}`;
|
|
146
|
-
},
|
|
147
|
-
e(
|
|
148
|
-
|
|
146
|
+
}, S = () => {
|
|
147
|
+
e(t.PageController).then(() => {
|
|
148
|
+
Me(() => {
|
|
149
149
|
var s;
|
|
150
|
-
|
|
150
|
+
x && x((s = i.bindMethodInfo) == null ? void 0 : s.name);
|
|
151
151
|
});
|
|
152
152
|
});
|
|
153
153
|
};
|
|
154
154
|
return {
|
|
155
|
-
NEW_METHOD_TYPE:
|
|
156
|
-
state:
|
|
157
|
-
editor:
|
|
158
|
-
editorOptions:
|
|
159
|
-
dialogVisible:
|
|
160
|
-
change:
|
|
155
|
+
NEW_METHOD_TYPE: Ee,
|
|
156
|
+
state: i,
|
|
157
|
+
editor: V,
|
|
158
|
+
editorOptions: n,
|
|
159
|
+
dialogVisible: se,
|
|
160
|
+
change: ae,
|
|
161
161
|
confirm: () => {
|
|
162
|
-
if (
|
|
162
|
+
if (i.tipError)
|
|
163
163
|
return;
|
|
164
|
-
let s = "event", r =
|
|
165
|
-
if (!
|
|
164
|
+
let s = "event", r = le(), m = s;
|
|
165
|
+
if (!i.isValidParams)
|
|
166
166
|
return;
|
|
167
|
-
r && (s = r.join(","), m =
|
|
168
|
-
const
|
|
169
|
-
|
|
170
|
-
name:
|
|
171
|
-
content:
|
|
172
|
-
}),
|
|
167
|
+
r && (s = r.join(","), m = h(r)), I({ ...i.bindMethodInfo, params: s, extra: r });
|
|
168
|
+
const _ = A();
|
|
169
|
+
k == null || k({
|
|
170
|
+
name: i.bindMethodInfo.name,
|
|
171
|
+
content: i.enableExtraParams ? `function ${i.bindMethodInfo.name}(eventArgs,${m}) ${_}` : `function ${i.bindMethodInfo.name}(${m}) ${_}`
|
|
172
|
+
}), S(), ye();
|
|
173
173
|
},
|
|
174
174
|
closeDialog: () => {
|
|
175
|
-
|
|
175
|
+
l(), ye();
|
|
176
176
|
},
|
|
177
177
|
openedDialog: () => {
|
|
178
178
|
var s, r, m;
|
|
179
|
-
|
|
179
|
+
i.enableExtraParams = !!((r = (s = p.eventBinding) == null ? void 0 : s.params) != null && r.length), i.editorContent = JSON.stringify(((m = p.eventBinding) == null ? void 0 : m.params) || [], null, 2), l();
|
|
180
180
|
},
|
|
181
|
-
selectMethod:
|
|
181
|
+
selectMethod: u
|
|
182
182
|
};
|
|
183
183
|
}
|
|
184
|
-
},
|
|
184
|
+
}, ln = { class: "bind-event-dialog-content" }, dn = { class: "dialog-content-left" }, rn = { class: "left-list-wrap" }, cn = { class: "left-action-list" }, mn = { class: "action-list-wrap" }, pn = ["onClick"], un = { class: "content-right" }, vn = { class: "new-action-tip" }, fn = { class: "content-right-title" }, gn = { class: "content-right-monaco" }, _n = {
|
|
185
185
|
key: 1,
|
|
186
186
|
class: "mark"
|
|
187
|
-
},
|
|
187
|
+
}, hn = {
|
|
188
188
|
key: 0,
|
|
189
189
|
class: "params-tip"
|
|
190
|
-
},
|
|
191
|
-
function
|
|
192
|
-
const
|
|
193
|
-
return
|
|
190
|
+
}, bn = { class: "bind-dialog-footer" };
|
|
191
|
+
function yn(p, t, E, e, a, f) {
|
|
192
|
+
const P = g("tiny-search"), k = g("icon-yes"), x = g("tiny-input"), V = g("icon-help-query"), i = g("tiny-popover"), n = g("tiny-switch"), c = g("monaco-editor"), u = g("tiny-button"), I = g("tiny-dialog-box");
|
|
193
|
+
return y(), z(I, {
|
|
194
|
+
visible: e.dialogVisible,
|
|
194
195
|
title: "事件绑定",
|
|
195
196
|
width: "50%",
|
|
196
197
|
"append-to-body": !0,
|
|
197
198
|
onClose: e.closeDialog,
|
|
198
199
|
onOpened: e.openedDialog
|
|
199
200
|
}, {
|
|
200
|
-
footer:
|
|
201
|
-
o("div",
|
|
202
|
-
|
|
201
|
+
footer: v(() => [
|
|
202
|
+
o("div", bn, [
|
|
203
|
+
d(u, {
|
|
203
204
|
type: "info",
|
|
204
205
|
onClick: e.confirm
|
|
205
206
|
}, {
|
|
206
|
-
default:
|
|
207
|
-
|
|
208
|
-
]),
|
|
207
|
+
default: v(() => t[10] || (t[10] = [
|
|
208
|
+
w("确 定")
|
|
209
|
+
])),
|
|
209
210
|
_: 1
|
|
210
211
|
}, 8, ["onClick"]),
|
|
211
|
-
|
|
212
|
-
default:
|
|
213
|
-
|
|
214
|
-
]),
|
|
212
|
+
d(u, { onClick: e.closeDialog }, {
|
|
213
|
+
default: v(() => t[11] || (t[11] = [
|
|
214
|
+
w("取 消")
|
|
215
|
+
])),
|
|
215
216
|
_: 1
|
|
216
217
|
}, 8, ["onClick"])
|
|
217
218
|
])
|
|
218
219
|
]),
|
|
219
|
-
default:
|
|
220
|
-
o("div",
|
|
221
|
-
o("div",
|
|
222
|
-
|
|
223
|
-
o("div",
|
|
224
|
-
o("div",
|
|
225
|
-
|
|
220
|
+
default: v(() => [
|
|
221
|
+
o("div", ln, [
|
|
222
|
+
o("div", dn, [
|
|
223
|
+
t[3] || (t[3] = o("div", { class: "left-title" }, "响应方法", -1)),
|
|
224
|
+
o("div", rn, [
|
|
225
|
+
o("div", cn, [
|
|
226
|
+
d(P, {
|
|
226
227
|
modelValue: e.state.searchValue,
|
|
227
|
-
"onUpdate:modelValue":
|
|
228
|
+
"onUpdate:modelValue": t[0] || (t[0] = (l) => e.state.searchValue = l),
|
|
228
229
|
placeholder: "搜索"
|
|
229
230
|
}, null, 8, ["modelValue"]),
|
|
230
|
-
o("ul",
|
|
231
|
-
(
|
|
232
|
-
key:
|
|
233
|
-
onClick: (D) => e.selectMethod(
|
|
231
|
+
o("ul", mn, [
|
|
232
|
+
(y(!0), B(Z, null, oe(e.state.filterMethodList, (l) => (y(), B("li", {
|
|
233
|
+
key: l.name,
|
|
234
|
+
onClick: (D) => e.selectMethod(l)
|
|
234
235
|
}, [
|
|
235
236
|
o("div", {
|
|
236
|
-
class:
|
|
237
|
+
class: q(["action-name", { active: l.name === e.state.bindMethodInfo.name }])
|
|
237
238
|
}, [
|
|
238
|
-
|
|
239
|
-
|
|
239
|
+
w(L(l.title || l.name) + " ", 1),
|
|
240
|
+
l.name === e.state.bindMethodInfo.name ? (y(), z(k, {
|
|
240
241
|
key: 0,
|
|
241
242
|
class: "action-selected-icon"
|
|
242
|
-
})) :
|
|
243
|
+
})) : K("", !0)
|
|
243
244
|
], 2)
|
|
244
|
-
], 8,
|
|
245
|
+
], 8, pn))), 128))
|
|
245
246
|
])
|
|
246
247
|
])
|
|
247
248
|
])
|
|
248
249
|
]),
|
|
249
|
-
o("div",
|
|
250
|
+
o("div", un, [
|
|
250
251
|
o("div", {
|
|
251
|
-
class:
|
|
252
|
+
class: q(["content-right-top", { "tip-error": e.state.tipError }])
|
|
252
253
|
}, [
|
|
253
|
-
|
|
254
|
-
|
|
254
|
+
t[4] || (t[4] = o("div", { class: "content-right-title" }, "方法名称", -1)),
|
|
255
|
+
d(x, {
|
|
255
256
|
modelValue: e.state.bindMethodInfo.name,
|
|
256
257
|
"onUpdate:modelValue": [
|
|
257
|
-
|
|
258
|
+
t[1] || (t[1] = (l) => e.state.bindMethodInfo.name = l),
|
|
258
259
|
e.change
|
|
259
260
|
],
|
|
260
261
|
disabled: e.state.bindMethodInfo.type !== e.NEW_METHOD_TYPE,
|
|
261
|
-
class:
|
|
262
|
+
class: q([{ "status-error": e.state.tipError }]),
|
|
262
263
|
placeholder: "请从左侧选择一个方法进行绑定,或者选择添加新方法,输入自定义方法名称。"
|
|
263
264
|
}, null, 8, ["modelValue", "disabled", "class", "onUpdate:modelValue"]),
|
|
264
|
-
o("div",
|
|
265
|
+
o("div", vn, L(e.state.tip), 1)
|
|
265
266
|
], 2),
|
|
266
267
|
o("div", {
|
|
267
|
-
class:
|
|
268
|
+
class: q(["content-right-bottom", { "tip-error": !e.state.isValidParams }])
|
|
268
269
|
}, [
|
|
269
|
-
o("div",
|
|
270
|
-
|
|
271
|
-
|
|
270
|
+
o("div", fn, [
|
|
271
|
+
t[9] || (t[9] = o("span", { class: "set-params-tip" }, "扩展参数设置", -1)),
|
|
272
|
+
d(i, {
|
|
272
273
|
placement: "top-start",
|
|
273
274
|
width: "350",
|
|
274
275
|
trigger: "hover"
|
|
275
276
|
}, {
|
|
276
|
-
reference:
|
|
277
|
-
|
|
277
|
+
reference: v(() => [
|
|
278
|
+
d(V)
|
|
278
279
|
]),
|
|
279
|
-
default:
|
|
280
|
+
default: v(() => [
|
|
280
281
|
o("p", null, [
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
282
|
+
t[5] || (t[5] = w(" 扩展参数:调用当前事件传入的真实参数,数组格式,追加在原有事件参数之后")),
|
|
283
|
+
t[6] || (t[6] = o("br", null, null, -1)),
|
|
284
|
+
w(" 如: " + L(e.state.bindMethodInfo.name) + "(eventArgs, extParam1, extParam2, ...) ", 1)
|
|
284
285
|
])
|
|
285
286
|
]),
|
|
286
287
|
_: 1
|
|
287
288
|
}),
|
|
288
|
-
|
|
289
|
+
d(n, {
|
|
289
290
|
modelValue: e.state.enableExtraParams,
|
|
290
|
-
"onUpdate:modelValue":
|
|
291
|
+
"onUpdate:modelValue": t[2] || (t[2] = (l) => e.state.enableExtraParams = l),
|
|
291
292
|
class: "set-switch",
|
|
292
293
|
"show-text": !0
|
|
293
294
|
}, {
|
|
294
|
-
open:
|
|
295
|
-
|
|
296
|
-
]),
|
|
297
|
-
close:
|
|
298
|
-
|
|
299
|
-
]),
|
|
295
|
+
open: v(() => t[7] || (t[7] = [
|
|
296
|
+
o("span", null, "开启", -1)
|
|
297
|
+
])),
|
|
298
|
+
close: v(() => t[8] || (t[8] = [
|
|
299
|
+
o("span", null, "关闭", -1)
|
|
300
|
+
])),
|
|
300
301
|
_: 1
|
|
301
302
|
}, 8, ["modelValue"])
|
|
302
303
|
]),
|
|
303
|
-
o("div",
|
|
304
|
-
e.dialogVisible ? (
|
|
304
|
+
o("div", gn, [
|
|
305
|
+
e.dialogVisible ? (y(), z(c, {
|
|
305
306
|
key: 0,
|
|
306
307
|
ref: "editor",
|
|
307
308
|
value: e.state.editorContent,
|
|
308
309
|
options: e.editorOptions,
|
|
309
310
|
class: "monaco-editor"
|
|
310
|
-
}, null, 8, ["value", "options"])) :
|
|
311
|
-
e.state.enableExtraParams ?
|
|
311
|
+
}, null, 8, ["value", "options"])) : K("", !0),
|
|
312
|
+
e.state.enableExtraParams ? K("", !0) : (y(), B("div", _n))
|
|
312
313
|
]),
|
|
313
|
-
!e.state.isValidParams && e.state.enableExtraParams ? (
|
|
314
|
+
!e.state.isValidParams && e.state.enableExtraParams ? (y(), B("div", hn, ' 请输入数组格式的参数,参数可以为表达式。例如:["extParam1", "item.status", 1, "getNames()"] ')) : K("", !0)
|
|
314
315
|
], 2)
|
|
315
316
|
])
|
|
316
317
|
])
|
|
317
318
|
]),
|
|
318
319
|
_: 1
|
|
319
|
-
}, 8, ["onClose", "onOpened"])
|
|
320
|
-
[re, e.dialogVisible]
|
|
321
|
-
]);
|
|
320
|
+
}, 8, ["visible", "onClose", "onOpened"]);
|
|
322
321
|
}
|
|
323
|
-
const
|
|
322
|
+
const En = /* @__PURE__ */ ee(an, [["render", yn], ["__scopeId", "data-v-adba0dca"]]), kn = {
|
|
324
323
|
onClick: {
|
|
325
324
|
label: {
|
|
326
325
|
zh_CN: "鼠标单击时触发"
|
|
@@ -377,7 +376,7 @@ const At = /* @__PURE__ */ oe(ct, [["render", Dt], ["__scopeId", "data-v-6a54279
|
|
|
377
376
|
},
|
|
378
377
|
defaultValue: ""
|
|
379
378
|
}
|
|
380
|
-
},
|
|
379
|
+
}, xn = [
|
|
381
380
|
"onabort",
|
|
382
381
|
"onafterprint",
|
|
383
382
|
"onanimationend",
|
|
@@ -487,11 +486,11 @@ const At = /* @__PURE__ */ oe(ct, [["render", Dt], ["__scopeId", "data-v-6a54279
|
|
|
487
486
|
"onwebkitanimationstart",
|
|
488
487
|
"onwebkittransitionend",
|
|
489
488
|
"onwheel"
|
|
490
|
-
],
|
|
491
|
-
let e =
|
|
492
|
-
return `${
|
|
493
|
-
}).includes(
|
|
494
|
-
const
|
|
489
|
+
], Vn = (p) => !!xn.map((E) => {
|
|
490
|
+
let e = E[2].toUpperCase();
|
|
491
|
+
return `${E.substring(0, 2)}${e}${E.substring(3)}`;
|
|
492
|
+
}).includes(p);
|
|
493
|
+
const In = { class: "footer" }, Nn = {
|
|
495
494
|
__name: "AddEventsDialog",
|
|
496
495
|
props: {
|
|
497
496
|
visible: {
|
|
@@ -504,11 +503,11 @@ const St = { class: "footer" }, Bt = {
|
|
|
504
503
|
}
|
|
505
504
|
},
|
|
506
505
|
emits: ["closeDialog", "addEvent"],
|
|
507
|
-
setup(
|
|
508
|
-
const
|
|
506
|
+
setup(p, { emit: t }) {
|
|
507
|
+
const E = p, e = t, a = $({
|
|
509
508
|
eventDescription: "",
|
|
510
509
|
eventName: ""
|
|
511
|
-
}),
|
|
510
|
+
}), f = Q(null), k = {
|
|
512
511
|
eventDescription: [
|
|
513
512
|
{
|
|
514
513
|
required: !0,
|
|
@@ -518,92 +517,92 @@ const St = { class: "footer" }, Bt = {
|
|
|
518
517
|
eventName: [
|
|
519
518
|
{ required: !0, message: "必填" },
|
|
520
519
|
{
|
|
521
|
-
validator: (
|
|
522
|
-
if (
|
|
523
|
-
|
|
520
|
+
validator: (i, n, c) => {
|
|
521
|
+
if (E.componentEvents[a.eventName]) {
|
|
522
|
+
c(new Error("事件名已存在"));
|
|
524
523
|
return;
|
|
525
524
|
}
|
|
526
|
-
if (!
|
|
527
|
-
|
|
525
|
+
if (!Vn(a.eventName)) {
|
|
526
|
+
c(new Error("请输入正确的浏览器事件名"));
|
|
528
527
|
return;
|
|
529
528
|
}
|
|
530
|
-
|
|
529
|
+
c();
|
|
531
530
|
}
|
|
532
531
|
}
|
|
533
532
|
]
|
|
534
|
-
}, E = () => {
|
|
535
|
-
e("closeDialog");
|
|
536
533
|
}, x = () => {
|
|
537
|
-
|
|
538
|
-
|
|
534
|
+
e("closeDialog");
|
|
535
|
+
}, V = () => {
|
|
536
|
+
f.value && f.value.validate((i) => {
|
|
537
|
+
if (!i)
|
|
539
538
|
return;
|
|
540
|
-
const { eventName:
|
|
541
|
-
e("addEvent", { eventName:
|
|
539
|
+
const { eventName: n, eventDescription: c } = a;
|
|
540
|
+
e("addEvent", { eventName: n, eventDescription: c });
|
|
542
541
|
});
|
|
543
542
|
};
|
|
544
|
-
return (
|
|
545
|
-
visible:
|
|
543
|
+
return (i, n) => (y(), z(O(Ve), {
|
|
544
|
+
visible: p.visible,
|
|
546
545
|
title: "添加自定义事件",
|
|
547
546
|
width: "400px",
|
|
548
547
|
"append-to-body": !0,
|
|
549
548
|
"close-on-click-modal": !1,
|
|
550
|
-
onClose:
|
|
549
|
+
onClose: x
|
|
551
550
|
}, {
|
|
552
|
-
footer:
|
|
553
|
-
o("div",
|
|
554
|
-
|
|
555
|
-
default:
|
|
556
|
-
|
|
557
|
-
]),
|
|
551
|
+
footer: v(() => [
|
|
552
|
+
o("div", In, [
|
|
553
|
+
d(O(G), { onClick: x }, {
|
|
554
|
+
default: v(() => n[2] || (n[2] = [
|
|
555
|
+
w(" 取消")
|
|
556
|
+
])),
|
|
558
557
|
_: 1
|
|
559
558
|
}),
|
|
560
|
-
|
|
559
|
+
d(O(G), {
|
|
561
560
|
type: "primary",
|
|
562
|
-
onClick:
|
|
561
|
+
onClick: V
|
|
563
562
|
}, {
|
|
564
|
-
default:
|
|
565
|
-
|
|
566
|
-
]),
|
|
563
|
+
default: v(() => n[3] || (n[3] = [
|
|
564
|
+
w(" 确定")
|
|
565
|
+
])),
|
|
567
566
|
_: 1
|
|
568
567
|
})
|
|
569
568
|
])
|
|
570
569
|
]),
|
|
571
|
-
default:
|
|
572
|
-
|
|
570
|
+
default: v(() => [
|
|
571
|
+
d(O(Oe), {
|
|
573
572
|
ref_key: "ruleForm",
|
|
574
|
-
ref:
|
|
575
|
-
model:
|
|
576
|
-
rules:
|
|
573
|
+
ref: f,
|
|
574
|
+
model: a,
|
|
575
|
+
rules: k,
|
|
577
576
|
"label-width": "100px",
|
|
578
577
|
"inline-message": !0,
|
|
579
578
|
"validate-type": "text",
|
|
580
579
|
"label-position": "left",
|
|
581
580
|
class: "add-custom-event-form"
|
|
582
581
|
}, {
|
|
583
|
-
default:
|
|
584
|
-
|
|
582
|
+
default: v(() => [
|
|
583
|
+
d(O(_e), {
|
|
585
584
|
label: "事件函数名",
|
|
586
585
|
prop: "eventName",
|
|
587
586
|
required: ""
|
|
588
587
|
}, {
|
|
589
|
-
default:
|
|
590
|
-
|
|
591
|
-
modelValue:
|
|
592
|
-
"onUpdate:modelValue":
|
|
588
|
+
default: v(() => [
|
|
589
|
+
d(O(ie), {
|
|
590
|
+
modelValue: a.eventName,
|
|
591
|
+
"onUpdate:modelValue": n[0] || (n[0] = (c) => a.eventName = c),
|
|
593
592
|
placeholder: "小驼峰格式,如:onDrag"
|
|
594
593
|
}, null, 8, ["modelValue"])
|
|
595
594
|
]),
|
|
596
595
|
_: 1
|
|
597
596
|
}),
|
|
598
|
-
|
|
597
|
+
d(O(_e), {
|
|
599
598
|
label: "事件描述",
|
|
600
599
|
prop: "eventDescription",
|
|
601
600
|
required: ""
|
|
602
601
|
}, {
|
|
603
|
-
default:
|
|
604
|
-
|
|
605
|
-
modelValue:
|
|
606
|
-
"onUpdate:modelValue":
|
|
602
|
+
default: v(() => [
|
|
603
|
+
d(O(ie), {
|
|
604
|
+
modelValue: a.eventDescription,
|
|
605
|
+
"onUpdate:modelValue": n[1] || (n[1] = (c) => a.eventDescription = c)
|
|
607
606
|
}, null, 8, ["modelValue"])
|
|
608
607
|
]),
|
|
609
608
|
_: 1
|
|
@@ -615,90 +614,90 @@ const St = { class: "footer" }, Bt = {
|
|
|
615
614
|
_: 1
|
|
616
615
|
}, 8, ["visible"]));
|
|
617
616
|
}
|
|
618
|
-
},
|
|
619
|
-
const
|
|
617
|
+
}, Cn = /* @__PURE__ */ ee(Nn, [["__scopeId", "data-v-932b189c"]]);
|
|
618
|
+
const Dn = {
|
|
620
619
|
components: {
|
|
621
|
-
BlockLinkEvent:
|
|
622
|
-
BindEventsDialog:
|
|
623
|
-
TinyPopover:
|
|
624
|
-
TinyButton:
|
|
625
|
-
IconHelpQuery:
|
|
626
|
-
IconChevronDown:
|
|
627
|
-
SvgButton:
|
|
628
|
-
AddEventsDialog:
|
|
620
|
+
BlockLinkEvent: Xe,
|
|
621
|
+
BindEventsDialog: En,
|
|
622
|
+
TinyPopover: xe,
|
|
623
|
+
TinyButton: G,
|
|
624
|
+
IconHelpQuery: Ne(),
|
|
625
|
+
IconChevronDown: Ge(),
|
|
626
|
+
SvgButton: qe,
|
|
627
|
+
AddEventsDialog: Cn
|
|
629
628
|
},
|
|
630
629
|
inheritAttrs: !1,
|
|
631
630
|
setup() {
|
|
632
|
-
const { PLUGIN_NAME:
|
|
631
|
+
const { PLUGIN_NAME: p, activePlugin: t, getPluginApi: E } = Ie(), { pageState: e } = W(), { getBlockEvents: a, getCurrentBlock: f, removeEventLink: P } = ze(), { getMaterial: k } = je(), { confirm: x } = Fe(), V = Je.global.locale.value, { highlightMethod: i } = E(p.PageController), n = $({
|
|
633
632
|
eventName: "",
|
|
634
633
|
// 事件名称
|
|
635
634
|
eventBinding: null,
|
|
636
635
|
// 事件绑定的处理方法对象
|
|
637
636
|
componentEvent: {},
|
|
638
|
-
|
|
637
|
+
customEvents: kn,
|
|
639
638
|
bindActions: {},
|
|
640
639
|
showBindEventDialog: !1
|
|
641
|
-
}),
|
|
642
|
-
|
|
643
|
-
var
|
|
644
|
-
const
|
|
645
|
-
n.componentEvent = ((
|
|
646
|
-
const
|
|
647
|
-
n.bindActions = {}, Object.entries(
|
|
648
|
-
var
|
|
649
|
-
if (
|
|
650
|
-
const
|
|
651
|
-
eventName:
|
|
640
|
+
}), c = Y(() => !!e.isBlock), u = Y(() => Object.keys(n.bindActions).length === 0), I = Y(() => ({ ...n.componentEvent, ...n.customEvents }));
|
|
641
|
+
ke(() => {
|
|
642
|
+
var ne, te, s, r, m;
|
|
643
|
+
const h = (ne = e == null ? void 0 : e.currentSchema) == null ? void 0 : ne.componentName, A = k(h);
|
|
644
|
+
n.componentEvent = ((s = (te = A == null ? void 0 : A.content) == null ? void 0 : te.schema) == null ? void 0 : s.events) || ((r = A == null ? void 0 : A.schema) == null ? void 0 : r.events) || {};
|
|
645
|
+
const S = ((m = e == null ? void 0 : e.currentSchema) == null ? void 0 : m.props) || {}, de = Object.keys(S);
|
|
646
|
+
n.bindActions = {}, Object.entries(I.value).forEach(([_, M]) => {
|
|
647
|
+
var N, b, T;
|
|
648
|
+
if (de.indexOf(_) > -1) {
|
|
649
|
+
const Ce = S[_], { value: De, params: re } = Ce, Ae = !re && ((b = (N = De.match(/\((.+)\)$/)) == null ? void 0 : N[1]) == null ? void 0 : b.split(",")) || re, F = {
|
|
650
|
+
eventName: _,
|
|
652
651
|
ref: "",
|
|
653
|
-
event:
|
|
654
|
-
params:
|
|
652
|
+
event: S[_],
|
|
653
|
+
params: Ae
|
|
655
654
|
};
|
|
656
|
-
if (
|
|
657
|
-
|
|
658
|
-
const
|
|
659
|
-
|
|
660
|
-
var
|
|
661
|
-
|
|
655
|
+
if (F.event.type === "JSExpression" && (F.ref = F.event.value.replace("this.", "").replace(/\(.*\)$/, "")), e.isBlock) {
|
|
656
|
+
F.metaEvent = M;
|
|
657
|
+
const ce = a(f()), me = (T = e == null ? void 0 : e.currentSchema) == null ? void 0 : T.id;
|
|
658
|
+
me && ce && Object.entries(ce).forEach(([Pe, J]) => {
|
|
659
|
+
var pe, ue;
|
|
660
|
+
me === ((pe = J == null ? void 0 : J.linked) == null ? void 0 : pe.id) && _ === ((ue = J == null ? void 0 : J.linked) == null ? void 0 : ue.event) && (F.linked = J.linked, F.linkedEventName = Pe);
|
|
662
661
|
});
|
|
663
662
|
}
|
|
664
|
-
n.bindActions[
|
|
663
|
+
n.bindActions[_] = F;
|
|
665
664
|
}
|
|
666
665
|
});
|
|
667
666
|
});
|
|
668
|
-
const
|
|
669
|
-
A && n.bindActions[
|
|
670
|
-
},
|
|
671
|
-
var
|
|
672
|
-
Object.keys(((
|
|
667
|
+
const l = (h, A) => {
|
|
668
|
+
A && n.bindActions[h.eventName] || (n.eventBinding = h, tn());
|
|
669
|
+
}, D = (h) => {
|
|
670
|
+
var S;
|
|
671
|
+
Object.keys(((S = e == null ? void 0 : e.currentSchema) == null ? void 0 : S.props) || {}).indexOf(h.eventName) > -1 && delete e.currentSchema.props[h.eventName];
|
|
673
672
|
};
|
|
674
673
|
return {
|
|
675
674
|
state: n,
|
|
676
|
-
isBlock:
|
|
677
|
-
isEmpty:
|
|
678
|
-
delEvent: (
|
|
679
|
-
|
|
675
|
+
isBlock: c,
|
|
676
|
+
isEmpty: u,
|
|
677
|
+
delEvent: (h) => {
|
|
678
|
+
x({
|
|
680
679
|
title: "提示",
|
|
681
|
-
message: `您确定要删除事件 ${
|
|
680
|
+
message: `您确定要删除事件 ${h.eventName} 吗?`,
|
|
682
681
|
exec() {
|
|
683
|
-
e.isBlock &&
|
|
682
|
+
e.isBlock && P({ linked: h.linked }), D(h);
|
|
684
683
|
}
|
|
685
684
|
});
|
|
686
685
|
},
|
|
687
|
-
openCodePanel: (
|
|
688
|
-
|
|
689
|
-
|
|
686
|
+
openCodePanel: (h) => {
|
|
687
|
+
h && t(p.PageController).then(() => {
|
|
688
|
+
i && i(h.ref);
|
|
690
689
|
});
|
|
691
690
|
},
|
|
692
|
-
openActionDialog:
|
|
693
|
-
handleAddEvent: (
|
|
694
|
-
const { eventName: A, eventDescription:
|
|
695
|
-
Object.assign(n.
|
|
691
|
+
openActionDialog: l,
|
|
692
|
+
handleAddEvent: (h) => {
|
|
693
|
+
const { eventName: A, eventDescription: S } = h;
|
|
694
|
+
Object.assign(n.customEvents, {
|
|
696
695
|
[A]: {
|
|
697
696
|
label: {
|
|
698
|
-
zh_CN:
|
|
697
|
+
zh_CN: S
|
|
699
698
|
},
|
|
700
699
|
description: {
|
|
701
|
-
zh_CN: `${
|
|
700
|
+
zh_CN: `${S}的回调函数`
|
|
702
701
|
},
|
|
703
702
|
type: "event",
|
|
704
703
|
functionInfo: {
|
|
@@ -709,43 +708,41 @@ const Lt = {
|
|
|
709
708
|
}
|
|
710
709
|
}), n.showBindEventDialog = !1;
|
|
711
710
|
},
|
|
712
|
-
handleToggleAddEventDialog: (
|
|
713
|
-
n.showBindEventDialog =
|
|
714
|
-
}
|
|
711
|
+
handleToggleAddEventDialog: (h) => {
|
|
712
|
+
n.showBindEventDialog = h;
|
|
713
|
+
},
|
|
714
|
+
renderEventList: I,
|
|
715
|
+
locale: V
|
|
715
716
|
};
|
|
716
717
|
}
|
|
717
|
-
},
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
], -1));
|
|
726
|
-
function eo(l, i, b, e, c, u) {
|
|
727
|
-
const w = v("icon-help-query"), y = v("tiny-popover"), E = v("tiny-button"), x = v("icon-chevron-down"), n = v("block-link-event"), t = v("svg-button"), a = v("svg-icon"), C = v("bind-events-dialog"), N = v("add-events-dialog");
|
|
728
|
-
return h(), S(G, null, [
|
|
729
|
-
o("div", Tt, [
|
|
730
|
-
o("div", Ut, [
|
|
731
|
-
o("span", zt, [
|
|
732
|
-
p(E, {
|
|
718
|
+
}, An = { class: "bind-action-list" }, Pn = { class: "popover-head" }, Mn = { class: "head-left" }, wn = { class: "bind-event-list" }, Bn = ["onClick"], Sn = { class: "bind-actions" }, On = { class: "action-item bind-action-item" }, Ln = ["onClick"], Tn = { class: "event-bind" }, Un = { class: "action-buttons" }, zn = { class: "empty-action" }, jn = { class: "icon" };
|
|
719
|
+
function Fn(p, t, E, e, a, f) {
|
|
720
|
+
const P = g("icon-help-query"), k = g("tiny-popover"), x = g("tiny-button"), V = g("icon-chevron-down"), i = g("block-link-event"), n = g("svg-button"), c = g("svg-icon"), u = g("bind-events-dialog"), I = g("add-events-dialog");
|
|
721
|
+
return y(), B(Z, null, [
|
|
722
|
+
o("div", An, [
|
|
723
|
+
o("div", Pn, [
|
|
724
|
+
o("span", Mn, [
|
|
725
|
+
d(x, {
|
|
733
726
|
class: "title add-custom-event-button",
|
|
734
727
|
"reset-time": 0,
|
|
735
|
-
onClick:
|
|
728
|
+
onClick: t[0] || (t[0] = we((l) => e.handleToggleAddEventDialog(!0), ["stop"]))
|
|
736
729
|
}, {
|
|
737
|
-
default:
|
|
738
|
-
|
|
739
|
-
|
|
730
|
+
default: v(() => [
|
|
731
|
+
t[3] || (t[3] = o("span", { class: "custom-event-button-text" }, "添加自定义事件", -1)),
|
|
732
|
+
d(k, {
|
|
740
733
|
placement: "bottom-start",
|
|
741
734
|
trigger: "hover",
|
|
742
735
|
popperClass: "setting-advanced-add-custom-event-tip"
|
|
743
736
|
}, {
|
|
744
|
-
reference:
|
|
745
|
-
|
|
737
|
+
reference: v(() => [
|
|
738
|
+
d(P, { class: "icon-help" })
|
|
746
739
|
]),
|
|
747
|
-
default:
|
|
748
|
-
|
|
740
|
+
default: v(() => [
|
|
741
|
+
t[2] || (t[2] = o("div", { class: "add-custom-event-tip" }, [
|
|
742
|
+
w(" 支持添加原生 DOM 事件,添加后点击 "),
|
|
743
|
+
o("span", { class: "event-tip-highlight" }, " 绑定事件 "),
|
|
744
|
+
w(" 为画布中所选元素增加事件 ")
|
|
745
|
+
], -1))
|
|
749
746
|
]),
|
|
750
747
|
_: 1
|
|
751
748
|
})
|
|
@@ -753,278 +750,287 @@ function eo(l, i, b, e, c, u) {
|
|
|
753
750
|
_: 1
|
|
754
751
|
})
|
|
755
752
|
]),
|
|
756
|
-
|
|
753
|
+
d(k, {
|
|
757
754
|
popperClass: "option-popper setting-advanced-bind-event-list",
|
|
758
755
|
placement: "bottom-end",
|
|
759
756
|
trigger: "hover"
|
|
760
757
|
}, {
|
|
761
|
-
reference:
|
|
762
|
-
|
|
763
|
-
default:
|
|
764
|
-
|
|
765
|
-
|
|
758
|
+
reference: v(() => [
|
|
759
|
+
d(x, { class: "bind-event-btn" }, {
|
|
760
|
+
default: v(() => [
|
|
761
|
+
t[4] || (t[4] = o("span", null, "绑定事件", -1)),
|
|
762
|
+
d(V, { class: "icon-chevron-down" })
|
|
766
763
|
]),
|
|
767
764
|
_: 1
|
|
768
765
|
})
|
|
769
766
|
]),
|
|
770
|
-
default:
|
|
771
|
-
o("ul",
|
|
772
|
-
(
|
|
773
|
-
var
|
|
774
|
-
return
|
|
767
|
+
default: v(() => [
|
|
768
|
+
o("ul", wn, [
|
|
769
|
+
(y(!0), B(Z, null, oe(e.renderEventList, (l, D) => {
|
|
770
|
+
var U;
|
|
771
|
+
return y(), B("li", {
|
|
775
772
|
key: D,
|
|
776
|
-
class:
|
|
777
|
-
onClick: (
|
|
773
|
+
class: q(["bind-event-list-item", { "bind-event-list-item-notallow": e.state.bindActions[D] }]),
|
|
774
|
+
onClick: (j) => e.openActionDialog({ eventName: D }, !0)
|
|
778
775
|
}, [
|
|
779
|
-
o("div", null, L(D) + " " + L(((
|
|
780
|
-
], 10,
|
|
776
|
+
o("div", null, L(D) + " " + L(((U = l == null ? void 0 : l.label) == null ? void 0 : U[e.locale]) || D), 1)
|
|
777
|
+
], 10, Bn);
|
|
781
778
|
}), 128))
|
|
782
779
|
])
|
|
783
780
|
]),
|
|
784
781
|
_: 1
|
|
785
782
|
})
|
|
786
783
|
]),
|
|
787
|
-
|
|
788
|
-
(
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
onClick: (D) => e.openActionDialog(d)
|
|
795
|
-
}, [
|
|
796
|
-
o("div", null, [
|
|
797
|
-
M(L(d.eventName), 1),
|
|
798
|
-
o("span", null, L(e.state.componentEvents[d.eventName].label.zh_CN), 1)
|
|
799
|
-
]),
|
|
784
|
+
ve(o("ul", Sn, [
|
|
785
|
+
(y(!0), B(Z, null, oe(e.state.bindActions, (l) => {
|
|
786
|
+
var D, U;
|
|
787
|
+
return y(), B("li", {
|
|
788
|
+
key: l.eventName
|
|
789
|
+
}, [
|
|
790
|
+
o("div", On, [
|
|
800
791
|
o("div", {
|
|
801
|
-
class:
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
792
|
+
class: "binding-name",
|
|
793
|
+
onClick: (j) => e.openActionDialog(l)
|
|
794
|
+
}, [
|
|
795
|
+
o("div", null, [
|
|
796
|
+
w(L(l.eventName), 1),
|
|
797
|
+
o("span", null, L((U = (D = e.renderEventList[l.eventName]) == null ? void 0 : D.label) == null ? void 0 : U[e.locale]), 1)
|
|
798
|
+
]),
|
|
799
|
+
o("div", {
|
|
800
|
+
class: q({ linked: l.linked })
|
|
801
|
+
}, L(l.linkedEventName), 3),
|
|
802
|
+
o("span", Tn, L(l.ref), 1)
|
|
803
|
+
], 8, Ln),
|
|
804
|
+
o("div", Un, [
|
|
805
|
+
e.isBlock ? (y(), z(i, {
|
|
806
|
+
key: 0,
|
|
807
|
+
data: l
|
|
808
|
+
}, null, 8, ["data"])) : K("", !0),
|
|
809
|
+
d(n, {
|
|
810
|
+
name: "plugin-icon-page-schema",
|
|
811
|
+
tips: "定位到代码",
|
|
812
|
+
placement: "top",
|
|
813
|
+
onClick: (j) => e.openCodePanel(l)
|
|
814
|
+
}, null, 8, ["onClick"]),
|
|
815
|
+
d(n, {
|
|
816
|
+
name: "setting",
|
|
817
|
+
tips: "设置",
|
|
818
|
+
placement: "top",
|
|
819
|
+
onClick: (j) => e.openActionDialog(l, !1)
|
|
820
|
+
}, null, 8, ["onClick"]),
|
|
821
|
+
d(n, {
|
|
822
|
+
name: "delete",
|
|
823
|
+
tips: "删除",
|
|
824
|
+
placement: "top",
|
|
825
|
+
onClick: (j) => e.delEvent(l)
|
|
826
|
+
}, null, 8, ["onClick"])
|
|
827
|
+
])
|
|
828
828
|
])
|
|
829
|
-
])
|
|
830
|
-
|
|
829
|
+
]);
|
|
830
|
+
}), 128))
|
|
831
831
|
], 512), [
|
|
832
|
-
[
|
|
832
|
+
[fe, !e.isEmpty]
|
|
833
833
|
]),
|
|
834
|
-
|
|
835
|
-
o("div",
|
|
836
|
-
|
|
834
|
+
ve(o("div", zn, [
|
|
835
|
+
o("div", jn, [
|
|
836
|
+
d(c, {
|
|
837
837
|
name: "empty-action",
|
|
838
838
|
class: "empty-action-icon"
|
|
839
839
|
})
|
|
840
840
|
]),
|
|
841
|
-
|
|
842
|
-
|
|
841
|
+
t[5] || (t[5] = o("div", { class: "center" }, "元素事件绑定", -1)),
|
|
842
|
+
t[6] || (t[6] = o("span", { class: "text" }, [
|
|
843
|
+
w(" 点击 "),
|
|
844
|
+
o("span", { class: "empty-bind-event-tip" }, "绑定事件"),
|
|
845
|
+
w("为画布中所选元素增加事件")
|
|
846
|
+
], -1))
|
|
843
847
|
], 512), [
|
|
844
|
-
[
|
|
848
|
+
[fe, e.isEmpty]
|
|
845
849
|
])
|
|
846
850
|
]),
|
|
847
|
-
|
|
851
|
+
d(u, {
|
|
848
852
|
eventBinding: e.state.eventBinding
|
|
849
853
|
}, null, 8, ["eventBinding"]),
|
|
850
|
-
|
|
854
|
+
d(I, {
|
|
851
855
|
visible: e.state.showBindEventDialog,
|
|
852
|
-
componentEvents: e.
|
|
853
|
-
onCloseDialog:
|
|
856
|
+
componentEvents: e.renderEventList,
|
|
857
|
+
onCloseDialog: t[1] || (t[1] = (l) => e.handleToggleAddEventDialog(!1)),
|
|
854
858
|
onAddEvent: e.handleAddEvent
|
|
855
859
|
}, null, 8, ["visible", "componentEvents", "onAddEvent"])
|
|
856
860
|
], 64);
|
|
857
861
|
}
|
|
858
|
-
const
|
|
859
|
-
const { DEFAULT_LOOP_NAME:
|
|
862
|
+
const Jn = /* @__PURE__ */ ee(Dn, [["render", Fn], ["__scopeId", "data-v-4dee0cb3"]]);
|
|
863
|
+
const { DEFAULT_LOOP_NAME: R } = nn, Rn = {
|
|
860
864
|
components: {
|
|
861
|
-
MetaSwitch:
|
|
862
|
-
TinyTooltip:
|
|
863
|
-
MetaBindVariable:
|
|
864
|
-
MetaInput:
|
|
865
|
-
MetaCodeEditor:
|
|
865
|
+
MetaSwitch: He,
|
|
866
|
+
TinyTooltip: Le,
|
|
867
|
+
MetaBindVariable: Ke,
|
|
868
|
+
MetaInput: Ye,
|
|
869
|
+
MetaCodeEditor: Qe
|
|
866
870
|
},
|
|
867
871
|
inheritAttrs: !1,
|
|
868
872
|
setup() {
|
|
869
|
-
const { pageState:
|
|
870
|
-
var
|
|
871
|
-
return ((
|
|
873
|
+
const { pageState: p } = W(), t = Q(!1), E = Y(() => {
|
|
874
|
+
var n;
|
|
875
|
+
return ((n = t.value) == null ? void 0 : n.type) === H.JSEXPRESSION;
|
|
872
876
|
}), e = () => {
|
|
873
|
-
var
|
|
874
|
-
return ((
|
|
875
|
-
},
|
|
877
|
+
var n, c;
|
|
878
|
+
return ((c = (n = C().getSchema()) == null ? void 0 : n.loopArgs) == null ? void 0 : c[1]) || R.INDEX;
|
|
879
|
+
}, a = $({
|
|
876
880
|
loopData: {
|
|
877
|
-
type:
|
|
881
|
+
type: H.JSEXPRESSION,
|
|
878
882
|
value: "[]"
|
|
879
883
|
},
|
|
880
884
|
loopItem: "item",
|
|
881
885
|
loopIndex: "index",
|
|
882
|
-
isLoop:
|
|
883
|
-
var
|
|
884
|
-
return ((
|
|
886
|
+
isLoop: Y(() => {
|
|
887
|
+
var n;
|
|
888
|
+
return ((n = a.loopData) == null ? void 0 : n.type) === H.JSEXPRESSION;
|
|
885
889
|
}),
|
|
886
890
|
loopKey: "",
|
|
887
891
|
shouldUpdate: !1
|
|
888
892
|
});
|
|
889
|
-
|
|
890
|
-
() => [
|
|
891
|
-
([
|
|
892
|
-
var
|
|
893
|
-
|
|
893
|
+
ge(
|
|
894
|
+
() => [p == null ? void 0 : p.currentSchema, a.shouldUpdate],
|
|
895
|
+
([n]) => {
|
|
896
|
+
var c, u, I, l;
|
|
897
|
+
t.value = (n == null ? void 0 : n.condition) === void 0 ? !0 : n == null ? void 0 : n.condition, a.loopData = n == null ? void 0 : n.loop, a.loopItem = ((c = n == null ? void 0 : n.loopArgs) == null ? void 0 : c[0]) || "", a.loopIndex = ((u = n == null ? void 0 : n.loopArgs) == null ? void 0 : u[1]) || "", a.loopKey = ((l = (I = n == null ? void 0 : n.props) == null ? void 0 : I.key) == null ? void 0 : l.value) || "";
|
|
894
898
|
}
|
|
895
899
|
);
|
|
896
|
-
const
|
|
897
|
-
|
|
898
|
-
const
|
|
899
|
-
if (!
|
|
900
|
+
const f = (n = "") => {
|
|
901
|
+
n = n.replace(/\s*/g, "");
|
|
902
|
+
const c = C().getSchema();
|
|
903
|
+
if (!c)
|
|
900
904
|
return;
|
|
901
|
-
const
|
|
902
|
-
|
|
903
|
-
const
|
|
904
|
-
|
|
905
|
-
type:
|
|
906
|
-
value:
|
|
907
|
-
}),
|
|
908
|
-
type:
|
|
905
|
+
const u = Number(n).toString() !== "NaN";
|
|
906
|
+
c.props = c.props || {};
|
|
907
|
+
const I = c.props;
|
|
908
|
+
n && !u && (I.key = {
|
|
909
|
+
type: H.JSEXPRESSION,
|
|
910
|
+
value: n
|
|
911
|
+
}), n || (a.isLoop ? I.key = {
|
|
912
|
+
type: H.JSEXPRESSION,
|
|
909
913
|
value: e()
|
|
910
|
-
} : delete
|
|
914
|
+
} : delete I.key);
|
|
911
915
|
};
|
|
912
|
-
|
|
913
|
-
!
|
|
916
|
+
ge([() => a.isLoop, () => a.loopIndex], () => {
|
|
917
|
+
!a.loopKey && a.isLoop && f(e()), a.isLoop || f("");
|
|
914
918
|
});
|
|
915
|
-
const
|
|
916
|
-
var
|
|
917
|
-
|
|
918
|
-
},
|
|
919
|
-
|
|
920
|
-
},
|
|
921
|
-
|
|
919
|
+
const P = () => {
|
|
920
|
+
var n;
|
|
921
|
+
a.loopData = (n = C().getSchema()) == null ? void 0 : n.loop;
|
|
922
|
+
}, k = (n) => {
|
|
923
|
+
C().getSchema() && (n === !1 || n != null && n.type ? C().getSchema().condition = n : delete C().getSchema().condition, W().canvasApi.value.updateRect(), t.value = n);
|
|
924
|
+
}, x = (n) => {
|
|
925
|
+
C().getSchema().loopArgs ? C().getSchema().loopArgs[1] = n || R.INDEX : C().getSchema().loopArgs = [R.ITEM, n];
|
|
922
926
|
};
|
|
923
927
|
return {
|
|
924
|
-
condition:
|
|
925
|
-
setConfig:
|
|
926
|
-
isBind:
|
|
927
|
-
state:
|
|
928
|
-
setLoop: (
|
|
929
|
-
|
|
928
|
+
condition: t,
|
|
929
|
+
setConfig: k,
|
|
930
|
+
isBind: E,
|
|
931
|
+
state: a,
|
|
932
|
+
setLoop: (n) => {
|
|
933
|
+
n ? (C().getSchema().loop = n != null && n.type ? n : $e(n), x(R.INDEX)) : (f(), delete C().getSchema().loop, delete C().getSchema().loopArgs), a.shouldUpdate = !a.shouldUpdate;
|
|
930
934
|
},
|
|
931
|
-
setLoopItem: (
|
|
932
|
-
|
|
935
|
+
setLoopItem: (n) => {
|
|
936
|
+
C().getSchema().loopArgs ? C().getSchema().loopArgs[0] = n || R.ITEM : C().getSchema().loopArgs = [n, R.INDEX];
|
|
933
937
|
},
|
|
934
|
-
DEFAULT_LOOP_NAME:
|
|
935
|
-
openEditor:
|
|
936
|
-
setLoopIndex:
|
|
937
|
-
setLoopKey:
|
|
938
|
+
DEFAULT_LOOP_NAME: R,
|
|
939
|
+
openEditor: P,
|
|
940
|
+
setLoopIndex: x,
|
|
941
|
+
setLoopKey: f,
|
|
938
942
|
getIndexName: e
|
|
939
943
|
};
|
|
940
944
|
}
|
|
941
|
-
},
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
o("div", ao, [
|
|
955
|
-
e.isBind ? (h(), S("div", lo, "已绑定:" + L(e.condition.value), 1)) : (h(), U(w, {
|
|
945
|
+
}, Xn = { class: "advanced-config-container" }, qn = { class: "advnce-config" }, Hn = { class: "advanced-config-form-item" }, Kn = ["title"], Yn = { class: "advnce-config" }, Qn = { class: "advanced-config-form-item" }, Zn = ["title"], Gn = { class: "advnce-config" }, Wn = { class: "advanced-config-form-item" }, $n = { class: "advnce-config" }, et = { class: "advanced-config-form-item" }, nt = { class: "advnce-config" }, tt = { class: "advanced-config-form-item" };
|
|
946
|
+
function ot(p, t, E, e, a, f) {
|
|
947
|
+
var n, c;
|
|
948
|
+
const P = g("meta-switch"), k = g("meta-bind-variable"), x = g("meta-code-editor"), V = g("meta-input"), i = g("tiny-tooltip");
|
|
949
|
+
return y(), B("div", Xn, [
|
|
950
|
+
o("div", qn, [
|
|
951
|
+
t[6] || (t[6] = o("label", { class: "text-ellipsis-multiple" }, "是否渲染", -1)),
|
|
952
|
+
o("div", Hn, [
|
|
953
|
+
e.isBind ? (y(), B("div", {
|
|
954
|
+
key: 1,
|
|
955
|
+
class: "binding-state text-ellipsis-multiple",
|
|
956
|
+
title: e.condition.value
|
|
957
|
+
}, " 已绑定:" + L(e.condition.value), 9, Kn)) : (y(), z(P, {
|
|
956
958
|
key: 0,
|
|
957
959
|
modelValue: e.condition,
|
|
958
960
|
"onUpdate:modelValue": e.setConfig
|
|
959
961
|
}, null, 8, ["modelValue", "onUpdate:modelValue"])),
|
|
960
|
-
|
|
962
|
+
d(k, {
|
|
961
963
|
modelValue: e.condition,
|
|
962
964
|
"onUpdate:modelValue": [
|
|
963
|
-
|
|
965
|
+
t[0] || (t[0] = (u) => e.condition = u),
|
|
964
966
|
e.setConfig
|
|
965
967
|
],
|
|
966
968
|
name: "advance"
|
|
967
969
|
}, null, 8, ["modelValue", "onUpdate:modelValue"])
|
|
968
970
|
])
|
|
969
971
|
]),
|
|
970
|
-
o("div",
|
|
971
|
-
|
|
972
|
-
o("div",
|
|
973
|
-
e.state.isLoop ? (
|
|
972
|
+
o("div", Yn, [
|
|
973
|
+
t[7] || (t[7] = o("label", { class: "text-ellipsis-multiple" }, "循环数据", -1)),
|
|
974
|
+
o("div", Qn, [
|
|
975
|
+
e.state.isLoop ? (y(), B("div", {
|
|
976
|
+
key: 1,
|
|
977
|
+
class: "binding-state text-ellipsis-multiple",
|
|
978
|
+
title: (n = e.state.loopData) == null ? void 0 : n.value
|
|
979
|
+
}, " 已绑定:" + L((c = e.state.loopData) == null ? void 0 : c.value), 9, Zn)) : (y(), z(x, {
|
|
974
980
|
key: 0,
|
|
975
981
|
modelValue: e.state.loopData,
|
|
976
982
|
"onUpdate:modelValue": [
|
|
977
|
-
|
|
983
|
+
t[1] || (t[1] = (u) => e.state.loopData = u),
|
|
978
984
|
e.setLoop
|
|
979
985
|
],
|
|
980
986
|
"data-type": "JSExpression",
|
|
981
987
|
onOpen: e.openEditor
|
|
982
988
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "onOpen"])),
|
|
983
|
-
|
|
989
|
+
d(k, {
|
|
984
990
|
modelValue: e.state.loopData,
|
|
985
991
|
"onUpdate:modelValue": [
|
|
986
|
-
|
|
992
|
+
t[2] || (t[2] = (u) => e.state.loopData = u),
|
|
987
993
|
e.setLoop
|
|
988
994
|
],
|
|
989
995
|
name: "advance"
|
|
990
996
|
}, null, 8, ["modelValue", "onUpdate:modelValue"])
|
|
991
997
|
])
|
|
992
998
|
]),
|
|
993
|
-
o("div",
|
|
994
|
-
|
|
995
|
-
o("div",
|
|
996
|
-
|
|
999
|
+
o("div", Gn, [
|
|
1000
|
+
t[8] || (t[8] = o("label", { class: "text-ellipsis-multiple" }, "迭代变量名", -1)),
|
|
1001
|
+
o("div", Wn, [
|
|
1002
|
+
d(V, {
|
|
997
1003
|
modelValue: e.state.loopItem,
|
|
998
1004
|
"onUpdate:modelValue": [
|
|
999
|
-
|
|
1005
|
+
t[3] || (t[3] = (u) => e.state.loopItem = u),
|
|
1000
1006
|
e.setLoopItem
|
|
1001
1007
|
],
|
|
1002
1008
|
placeholder: `默认值为:${e.DEFAULT_LOOP_NAME.ITEM}`
|
|
1003
1009
|
}, null, 8, ["modelValue", "placeholder", "onUpdate:modelValue"])
|
|
1004
1010
|
])
|
|
1005
1011
|
]),
|
|
1006
|
-
o("div",
|
|
1007
|
-
|
|
1008
|
-
o("div",
|
|
1009
|
-
|
|
1012
|
+
o("div", $n, [
|
|
1013
|
+
t[9] || (t[9] = o("label", { class: "text-ellipsis-multiple" }, "索引变量名", -1)),
|
|
1014
|
+
o("div", et, [
|
|
1015
|
+
d(V, {
|
|
1010
1016
|
modelValue: e.state.loopIndex,
|
|
1011
1017
|
"onUpdate:modelValue": [
|
|
1012
|
-
|
|
1018
|
+
t[4] || (t[4] = (u) => e.state.loopIndex = u),
|
|
1013
1019
|
e.setLoopIndex
|
|
1014
1020
|
],
|
|
1015
1021
|
placeholder: `默认值为:${e.DEFAULT_LOOP_NAME.INDEX}`
|
|
1016
1022
|
}, null, 8, ["modelValue", "placeholder", "onUpdate:modelValue"])
|
|
1017
1023
|
])
|
|
1018
1024
|
]),
|
|
1019
|
-
o("div",
|
|
1020
|
-
|
|
1021
|
-
o("div",
|
|
1022
|
-
|
|
1023
|
-
default:
|
|
1024
|
-
|
|
1025
|
+
o("div", nt, [
|
|
1026
|
+
t[10] || (t[10] = o("label", { class: "text-ellipsis-multiple" }, "key", -1)),
|
|
1027
|
+
o("div", tt, [
|
|
1028
|
+
d(i, { content: "建议填写循环项中的唯一值(如item.id),如果填写为数字将不保存" }, {
|
|
1029
|
+
default: v(() => [
|
|
1030
|
+
d(V, {
|
|
1025
1031
|
modelValue: e.state.loopKey,
|
|
1026
1032
|
"onUpdate:modelValue": [
|
|
1027
|
-
|
|
1033
|
+
t[5] || (t[5] = (u) => e.state.loopKey = u),
|
|
1028
1034
|
e.setLoopKey
|
|
1029
1035
|
],
|
|
1030
1036
|
placeholder: `默认为索引名:${e.getIndexName()}`
|
|
@@ -1036,30 +1042,30 @@ function ko(l, i, b, e, c, u) {
|
|
|
1036
1042
|
])
|
|
1037
1043
|
]);
|
|
1038
1044
|
}
|
|
1039
|
-
const
|
|
1045
|
+
const it = /* @__PURE__ */ ee(Rn, [["render", ot], ["__scopeId", "data-v-61c9f6a9"]]), st = {
|
|
1040
1046
|
__name: "Main",
|
|
1041
|
-
setup(
|
|
1042
|
-
const
|
|
1043
|
-
return (
|
|
1044
|
-
modelValue:
|
|
1045
|
-
"onUpdate:modelValue": e[0] || (e[0] = (
|
|
1047
|
+
setup(p) {
|
|
1048
|
+
const t = Q(["bindEvent", "advancedConfig"]);
|
|
1049
|
+
return (E, e) => (y(), z(O(Te), {
|
|
1050
|
+
modelValue: t.value,
|
|
1051
|
+
"onUpdate:modelValue": e[0] || (e[0] = (a) => t.value = a)
|
|
1046
1052
|
}, {
|
|
1047
|
-
default:
|
|
1048
|
-
|
|
1053
|
+
default: v(() => [
|
|
1054
|
+
d(O(he), {
|
|
1049
1055
|
title: "事件绑定",
|
|
1050
1056
|
name: "bindEvent"
|
|
1051
1057
|
}, {
|
|
1052
|
-
default:
|
|
1053
|
-
|
|
1058
|
+
default: v(() => [
|
|
1059
|
+
d(Jn)
|
|
1054
1060
|
]),
|
|
1055
1061
|
_: 1
|
|
1056
1062
|
}),
|
|
1057
|
-
|
|
1063
|
+
d(O(he), {
|
|
1058
1064
|
title: "高级配置",
|
|
1059
1065
|
name: "advancedConfig"
|
|
1060
1066
|
}, {
|
|
1061
|
-
default:
|
|
1062
|
-
|
|
1067
|
+
default: v(() => [
|
|
1068
|
+
d(it)
|
|
1063
1069
|
]),
|
|
1064
1070
|
_: 1
|
|
1065
1071
|
})
|
|
@@ -1067,14 +1073,14 @@ const xo = /* @__PURE__ */ oe(oo, [["render", ko], ["__scopeId", "data-v-ef405cb
|
|
|
1067
1073
|
_: 1
|
|
1068
1074
|
}, 8, ["modelValue"]));
|
|
1069
1075
|
}
|
|
1070
|
-
},
|
|
1076
|
+
}, _t = {
|
|
1071
1077
|
id: "SettingEvents",
|
|
1072
1078
|
name: "event",
|
|
1073
1079
|
title: "高级",
|
|
1074
1080
|
icon: "",
|
|
1075
1081
|
align: "left",
|
|
1076
|
-
component:
|
|
1082
|
+
component: st
|
|
1077
1083
|
};
|
|
1078
1084
|
export {
|
|
1079
|
-
|
|
1085
|
+
_t as default
|
|
1080
1086
|
};
|