@opentiny/tiny-engine-setting-events 1.0.1
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 +1051 -0
- package/dist/style.css +1 -0
- package/package.json +28 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1051 @@
|
|
|
1
|
+
import "./style.css";
|
|
2
|
+
import { ref as $, reactive as de, watchEffect as Ne, resolveComponent as u, withDirectives as ie, openBlock as y, createBlock as j, withCtx as _, createElementVNode as o, createVNode as l, createTextVNode as P, createElementBlock as M, Fragment as ee, renderList as se, normalizeClass as X, toDisplayString as O, createCommentVNode as Y, vShow as ae, nextTick as Ue, pushScopeId as ce, popScopeId as re, computed as te, watch as le, withModifiers as Ee, unref as ne } from "vue";
|
|
3
|
+
import { Input as Ce, Button as De, Search as Te, Popover as we, DialogBox as ze, Switch as Fe, Form as je, FormItem as Je, Tooltip as Re, Collapse as He, CollapseItem as ke } from "@opentiny/vue";
|
|
4
|
+
import { useLayout as Ae, useCanvas as me, useHistory as Xe, useNotify as Pe, useBlock as qe, useResource as Ke, useModal as Ye, useProperties as C } from "@opentiny/tiny-engine-controller";
|
|
5
|
+
import { VueMonaco as $e, BlockLinkEvent as Qe, SvgButton as Ze, MetaSwitch as Ge, MetaBindVariable as We, MetaInput as et, MetaCodeEditor as tt } from "@opentiny/tiny-engine-common";
|
|
6
|
+
import { iconYes as ot, iconHelpQuery as Me, iconChevronDown as nt } from "@opentiny/vue-icon";
|
|
7
|
+
import { theme as it, string2Obj as st } from "@opentiny/tiny-engine-controller/adapter";
|
|
8
|
+
import { string2Ast as Ve, ast2String as at } from "@opentiny/tiny-engine-common/js/ast";
|
|
9
|
+
import { PROP_DATA_TYPE as K } from "@opentiny/tiny-engine-controller/utils";
|
|
10
|
+
import { updateRect as lt } from "@opentiny/tiny-engine-canvas";
|
|
11
|
+
import { constants as dt } from "@opentiny/tiny-engine-utils";
|
|
12
|
+
const pe = (d, i) => {
|
|
13
|
+
const k = d.__vccOpts || d;
|
|
14
|
+
for (const [e, m] of i)
|
|
15
|
+
k[e] = m;
|
|
16
|
+
return k;
|
|
17
|
+
}, _e = $(!1), ct = () => {
|
|
18
|
+
_e.value = !0;
|
|
19
|
+
}, Ie = () => {
|
|
20
|
+
_e.value = !1;
|
|
21
|
+
}, xe = "newMethod", rt = /[^0-9a-zA-Z_$]/, mt = /^[a-zA-Z_$][0-9a-zA-Z_$]*$/, H = {
|
|
22
|
+
default: "选择已有方法或者添加新方法(点击 确定 之后将在JS面板中创建一个该名称的新方法)",
|
|
23
|
+
exist: "方法名称已存在",
|
|
24
|
+
ruleInvalid: "请输入有效的方法名,可以由字母、数字、下划线、$ 符号组成,不能以数字开头",
|
|
25
|
+
empty: "方法名称不能为空"
|
|
26
|
+
}, pt = {
|
|
27
|
+
components: {
|
|
28
|
+
MonacoEditor: $e,
|
|
29
|
+
TinyInput: Ce,
|
|
30
|
+
TinyButton: De,
|
|
31
|
+
TinySearch: Te,
|
|
32
|
+
TinyPopover: we,
|
|
33
|
+
TinyDialogBox: ze,
|
|
34
|
+
IconYes: ot(),
|
|
35
|
+
IconHelpQuery: Me(),
|
|
36
|
+
TinySwitch: Fe
|
|
37
|
+
},
|
|
38
|
+
inheritAttrs: !1,
|
|
39
|
+
props: {
|
|
40
|
+
eventBinding: {
|
|
41
|
+
type: Object,
|
|
42
|
+
default: () => ({})
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
setup(d) {
|
|
46
|
+
const { PLUGIN_NAME: i, getPluginApi: k, activePlugin: e } = Ae(), { pageState: m } = me(), { getMethodNameList: g, getMethods: S, saveMethod: V, highlightMethod: I } = k(i.PageController), N = $(null), a = de({
|
|
47
|
+
searchValue: "",
|
|
48
|
+
editorContent: "",
|
|
49
|
+
bindMethodInfo: {},
|
|
50
|
+
filterMethodList: [],
|
|
51
|
+
tip: H.default,
|
|
52
|
+
tipError: !1,
|
|
53
|
+
enableExtraParams: !1,
|
|
54
|
+
isValidParams: !0
|
|
55
|
+
}), t = {
|
|
56
|
+
roundedSelection: !0,
|
|
57
|
+
automaticLayout: !0,
|
|
58
|
+
autoIndent: !0,
|
|
59
|
+
language: "json",
|
|
60
|
+
formatOnPaste: !0,
|
|
61
|
+
tabSize: 2,
|
|
62
|
+
theme: it(),
|
|
63
|
+
lineNumbers: !1,
|
|
64
|
+
minimap: {
|
|
65
|
+
enabled: !1
|
|
66
|
+
}
|
|
67
|
+
}, n = (s, c) => {
|
|
68
|
+
const r = s.map((D) => {
|
|
69
|
+
var v;
|
|
70
|
+
return Number.parseInt((v = D.match(/\d+$/)) == null ? void 0 : v[0]) || 0;
|
|
71
|
+
}).sort((D, v) => D - v).pop();
|
|
72
|
+
let E = `${(c == null ? void 0 : c.replace(rt, "_")) || ""}New`;
|
|
73
|
+
return r > -1 && (E += `${r + 1}`), E;
|
|
74
|
+
};
|
|
75
|
+
Ne(() => {
|
|
76
|
+
var D, v;
|
|
77
|
+
const s = (D = d.eventBinding) == null ? void 0 : D.eventName, c = (g == null ? void 0 : g().filter((L) => L.indexOf(s) > -1)) || [], b = {
|
|
78
|
+
title: "添加新方法",
|
|
79
|
+
name: n(c, s),
|
|
80
|
+
type: xe
|
|
81
|
+
};
|
|
82
|
+
(v = d.eventBinding) != null && v.ref ? a.bindMethodInfo = {
|
|
83
|
+
name: d.eventBinding.ref
|
|
84
|
+
} : a.bindMethodInfo = b;
|
|
85
|
+
const E = (g == null ? void 0 : g().filter((L) => L.indexOf(a.searchValue) > -1).map((L) => ({ name: L }))) || [];
|
|
86
|
+
a.filterMethodList = [b, ...E];
|
|
87
|
+
});
|
|
88
|
+
const w = (s) => {
|
|
89
|
+
a.bindMethodInfo = s;
|
|
90
|
+
}, x = (s) => {
|
|
91
|
+
var D, v;
|
|
92
|
+
if (!s)
|
|
93
|
+
return;
|
|
94
|
+
const c = (D = d.eventBinding) == null ? void 0 : D.eventName;
|
|
95
|
+
if (!c)
|
|
96
|
+
return;
|
|
97
|
+
const r = (v = m == null ? void 0 : m.currentSchema) == null ? void 0 : v.props;
|
|
98
|
+
if (!r)
|
|
99
|
+
return;
|
|
100
|
+
const { name: b, extra: E } = s;
|
|
101
|
+
d[c] || (r[c] = {
|
|
102
|
+
type: "JSExpression",
|
|
103
|
+
value: ""
|
|
104
|
+
}), E && a.enableExtraParams && (r[c].params = E), r[c].value = `this.${b}`, Xe().addHistory();
|
|
105
|
+
}, f = () => {
|
|
106
|
+
a.tipError = !1, a.tip = H.default;
|
|
107
|
+
}, J = (s) => !s, p = (s) => g == null ? void 0 : g().includes(s), A = (s) => !mt.test(s), R = (s) => {
|
|
108
|
+
const c = [
|
|
109
|
+
{ validator: J, tip: H.empty },
|
|
110
|
+
{ validator: p, tip: H.exist },
|
|
111
|
+
{ validator: A, tip: H.ruleInvalid }
|
|
112
|
+
];
|
|
113
|
+
for (let r = 0; r < c.length; r++) {
|
|
114
|
+
const b = c[r];
|
|
115
|
+
if (b.validator(s)) {
|
|
116
|
+
a.tipError = !0, a.tip = b.tip;
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
a.tipError = !1, a.tip = H.default;
|
|
121
|
+
}, G = () => {
|
|
122
|
+
var c;
|
|
123
|
+
let s = "";
|
|
124
|
+
if (a.enableExtraParams)
|
|
125
|
+
try {
|
|
126
|
+
const r = (c = N.value) == null ? void 0 : c.getEditor().getValue();
|
|
127
|
+
s = JSON.parse(r), a.isValidParams = Array.isArray(s);
|
|
128
|
+
} catch {
|
|
129
|
+
a.isValidParams = !1;
|
|
130
|
+
}
|
|
131
|
+
return s;
|
|
132
|
+
}, W = (s) => Array.from({ length: s.length }, (c, r) => `args${r}`).join(","), h = () => {
|
|
133
|
+
var r, b, E, D;
|
|
134
|
+
let s = (b = (r = S()) == null ? void 0 : r[a.bindMethodInfo.name]) == null ? void 0 : b.value, c = "{}";
|
|
135
|
+
if (s) {
|
|
136
|
+
let v = {};
|
|
137
|
+
try {
|
|
138
|
+
v = Ve(s);
|
|
139
|
+
} catch {
|
|
140
|
+
s = s.replace("function", `function ${a.bindMethodInfo.name}`), v = Ve(s);
|
|
141
|
+
}
|
|
142
|
+
(D = (E = v == null ? void 0 : v.program) == null ? void 0 : E.body[0]) != null && D.body && (c = at(v.program.body[0].body));
|
|
143
|
+
}
|
|
144
|
+
return c || `{
|
|
145
|
+
}`;
|
|
146
|
+
}, B = () => {
|
|
147
|
+
e(i.PageController).then(() => {
|
|
148
|
+
Ue(() => {
|
|
149
|
+
var s;
|
|
150
|
+
I && I((s = a.bindMethodInfo) == null ? void 0 : s.name);
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
};
|
|
154
|
+
return {
|
|
155
|
+
NEW_METHOD_TYPE: xe,
|
|
156
|
+
state: a,
|
|
157
|
+
editor: N,
|
|
158
|
+
editorOptions: t,
|
|
159
|
+
dialogVisible: _e,
|
|
160
|
+
change: R,
|
|
161
|
+
confirm: () => {
|
|
162
|
+
if (a.tipError)
|
|
163
|
+
return;
|
|
164
|
+
let s = "event", c = G(), r = s;
|
|
165
|
+
if (!a.isValidParams)
|
|
166
|
+
return;
|
|
167
|
+
c && (s = c.join(","), r = W(c)), x({ ...a.bindMethodInfo, params: s, extra: c });
|
|
168
|
+
const b = h();
|
|
169
|
+
V == null || V({
|
|
170
|
+
name: a.bindMethodInfo.name,
|
|
171
|
+
content: a.enableExtraParams ? `function (eventArgs,${r}) ${b}` : `function (${r}) ${b}`
|
|
172
|
+
}), B(), Ie();
|
|
173
|
+
},
|
|
174
|
+
closeDialog: () => {
|
|
175
|
+
f(), Ie();
|
|
176
|
+
},
|
|
177
|
+
openedDialog: () => {
|
|
178
|
+
var s, c, r;
|
|
179
|
+
a.enableExtraParams = !!((c = (s = d.eventBinding) == null ? void 0 : s.params) != null && c.length), a.editorContent = JSON.stringify(((r = d.eventBinding) == null ? void 0 : r.params) || [], null, 2), f();
|
|
180
|
+
},
|
|
181
|
+
selectMethod: w
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
}, q = (d) => (ce("data-v-6a54279c"), d = d(), re(), d), _t = { class: "bind-event-dialog-content" }, ut = { class: "dialog-content-left" }, ft = /* @__PURE__ */ q(() => /* @__PURE__ */ o("div", { class: "left-title" }, "响应方法", -1)), ht = { class: "left-list-wrap" }, vt = { class: "left-action-list" }, gt = { class: "action-list-wrap" }, yt = ["onClick"], bt = { class: "content-right" }, Et = /* @__PURE__ */ q(() => /* @__PURE__ */ o("div", { class: "content-right-title" }, "方法名称", -1)), kt = { class: "new-action-tip" }, Vt = { class: "content-right-title" }, It = /* @__PURE__ */ q(() => /* @__PURE__ */ o("span", { class: "set-params-tip" }, "扩展参数设置", -1)), xt = /* @__PURE__ */ q(() => /* @__PURE__ */ o("br", null, null, -1)), Nt = /* @__PURE__ */ q(() => /* @__PURE__ */ o("span", null, "开启", -1)), Ct = /* @__PURE__ */ q(() => /* @__PURE__ */ o("span", null, "关闭", -1)), Dt = { class: "content-right-monaco" }, wt = {
|
|
185
|
+
key: 1,
|
|
186
|
+
class: "mark"
|
|
187
|
+
}, At = {
|
|
188
|
+
key: 0,
|
|
189
|
+
class: "params-tip"
|
|
190
|
+
}, Pt = { class: "bind-dialog-footer" };
|
|
191
|
+
function Mt(d, i, k, e, m, g) {
|
|
192
|
+
const S = u("tiny-search"), V = u("icon-yes"), I = u("tiny-input"), N = u("icon-help-query"), a = u("tiny-popover"), t = u("tiny-switch"), n = u("monaco-editor"), w = u("tiny-button"), x = u("tiny-dialog-box");
|
|
193
|
+
return ie((y(), j(x, {
|
|
194
|
+
title: "事件绑定",
|
|
195
|
+
width: "50%",
|
|
196
|
+
"append-to-body": !0,
|
|
197
|
+
onClose: e.closeDialog,
|
|
198
|
+
onOpened: e.openedDialog
|
|
199
|
+
}, {
|
|
200
|
+
footer: _(() => [
|
|
201
|
+
o("div", Pt, [
|
|
202
|
+
l(w, {
|
|
203
|
+
type: "info",
|
|
204
|
+
onClick: e.confirm
|
|
205
|
+
}, {
|
|
206
|
+
default: _(() => [
|
|
207
|
+
P("确 定")
|
|
208
|
+
]),
|
|
209
|
+
_: 1
|
|
210
|
+
}, 8, ["onClick"]),
|
|
211
|
+
l(w, { onClick: e.closeDialog }, {
|
|
212
|
+
default: _(() => [
|
|
213
|
+
P("取 消")
|
|
214
|
+
]),
|
|
215
|
+
_: 1
|
|
216
|
+
}, 8, ["onClick"])
|
|
217
|
+
])
|
|
218
|
+
]),
|
|
219
|
+
default: _(() => [
|
|
220
|
+
o("div", _t, [
|
|
221
|
+
o("div", ut, [
|
|
222
|
+
ft,
|
|
223
|
+
o("div", ht, [
|
|
224
|
+
o("div", vt, [
|
|
225
|
+
l(S, {
|
|
226
|
+
modelValue: e.state.searchValue,
|
|
227
|
+
"onUpdate:modelValue": i[0] || (i[0] = (f) => e.state.searchValue = f),
|
|
228
|
+
placeholder: "搜索"
|
|
229
|
+
}, null, 8, ["modelValue"]),
|
|
230
|
+
o("ul", gt, [
|
|
231
|
+
(y(!0), M(ee, null, se(e.state.filterMethodList, (f) => (y(), M("li", {
|
|
232
|
+
key: f.name,
|
|
233
|
+
onClick: (J) => e.selectMethod(f)
|
|
234
|
+
}, [
|
|
235
|
+
o("div", {
|
|
236
|
+
class: X(["action-name", { active: f.name === e.state.bindMethodInfo.name }])
|
|
237
|
+
}, [
|
|
238
|
+
P(O(f.title || f.name) + " ", 1),
|
|
239
|
+
f.name === e.state.bindMethodInfo.name ? (y(), j(V, {
|
|
240
|
+
key: 0,
|
|
241
|
+
class: "action-selected-icon"
|
|
242
|
+
})) : Y("", !0)
|
|
243
|
+
], 2)
|
|
244
|
+
], 8, yt))), 128))
|
|
245
|
+
])
|
|
246
|
+
])
|
|
247
|
+
])
|
|
248
|
+
]),
|
|
249
|
+
o("div", bt, [
|
|
250
|
+
o("div", {
|
|
251
|
+
class: X(["content-right-top", { "tip-error": e.state.tipError }])
|
|
252
|
+
}, [
|
|
253
|
+
Et,
|
|
254
|
+
l(I, {
|
|
255
|
+
modelValue: e.state.bindMethodInfo.name,
|
|
256
|
+
"onUpdate:modelValue": [
|
|
257
|
+
i[1] || (i[1] = (f) => e.state.bindMethodInfo.name = f),
|
|
258
|
+
e.change
|
|
259
|
+
],
|
|
260
|
+
disabled: e.state.bindMethodInfo.type !== e.NEW_METHOD_TYPE,
|
|
261
|
+
class: X([{ "status-error": e.state.tipError }]),
|
|
262
|
+
placeholder: "请从左侧选择一个方法进行绑定,或者选择添加新方法,输入自定义方法名称。"
|
|
263
|
+
}, null, 8, ["modelValue", "disabled", "class", "onUpdate:modelValue"]),
|
|
264
|
+
o("div", kt, O(e.state.tip), 1)
|
|
265
|
+
], 2),
|
|
266
|
+
o("div", {
|
|
267
|
+
class: X(["content-right-bottom", { "tip-error": !e.state.isValidParams }])
|
|
268
|
+
}, [
|
|
269
|
+
o("div", Vt, [
|
|
270
|
+
It,
|
|
271
|
+
l(a, {
|
|
272
|
+
placement: "top-start",
|
|
273
|
+
width: "350",
|
|
274
|
+
trigger: "hover"
|
|
275
|
+
}, {
|
|
276
|
+
reference: _(() => [
|
|
277
|
+
l(N)
|
|
278
|
+
]),
|
|
279
|
+
default: _(() => [
|
|
280
|
+
o("p", null, [
|
|
281
|
+
P(" 扩展参数:调用当前事件传入的真实参数,数组格式,追加在原有事件参数之后"),
|
|
282
|
+
xt,
|
|
283
|
+
P(" 如: " + O(e.state.bindMethodInfo.name) + "(eventArgs, extParam1, extParam2, ...) ", 1)
|
|
284
|
+
])
|
|
285
|
+
]),
|
|
286
|
+
_: 1
|
|
287
|
+
}),
|
|
288
|
+
l(t, {
|
|
289
|
+
modelValue: e.state.enableExtraParams,
|
|
290
|
+
"onUpdate:modelValue": i[2] || (i[2] = (f) => e.state.enableExtraParams = f),
|
|
291
|
+
class: "set-switch",
|
|
292
|
+
"show-text": !0
|
|
293
|
+
}, {
|
|
294
|
+
open: _(() => [
|
|
295
|
+
Nt
|
|
296
|
+
]),
|
|
297
|
+
close: _(() => [
|
|
298
|
+
Ct
|
|
299
|
+
]),
|
|
300
|
+
_: 1
|
|
301
|
+
}, 8, ["modelValue"])
|
|
302
|
+
]),
|
|
303
|
+
o("div", Dt, [
|
|
304
|
+
e.dialogVisible ? (y(), j(n, {
|
|
305
|
+
key: 0,
|
|
306
|
+
ref: "editor",
|
|
307
|
+
value: e.state.editorContent,
|
|
308
|
+
options: e.editorOptions,
|
|
309
|
+
class: "monaco-editor"
|
|
310
|
+
}, null, 8, ["value", "options"])) : Y("", !0),
|
|
311
|
+
e.state.enableExtraParams ? Y("", !0) : (y(), M("div", wt))
|
|
312
|
+
]),
|
|
313
|
+
!e.state.isValidParams && e.state.enableExtraParams ? (y(), M("div", At, ' 请输入数组格式的参数,参数可以为表达式。例如:["extParam1", "item.status", 1, "getNames()"] ')) : Y("", !0)
|
|
314
|
+
], 2)
|
|
315
|
+
])
|
|
316
|
+
])
|
|
317
|
+
]),
|
|
318
|
+
_: 1
|
|
319
|
+
}, 8, ["onClose", "onOpened"])), [
|
|
320
|
+
[ae, e.dialogVisible]
|
|
321
|
+
]);
|
|
322
|
+
}
|
|
323
|
+
const St = /* @__PURE__ */ pe(pt, [["render", Mt], ["__scopeId", "data-v-6a54279c"]]), Bt = {
|
|
324
|
+
onClick: {
|
|
325
|
+
label: {
|
|
326
|
+
zh_CN: "鼠标单击时触发"
|
|
327
|
+
},
|
|
328
|
+
description: {
|
|
329
|
+
zh_CN: "鼠标单击时触发的回调函数"
|
|
330
|
+
},
|
|
331
|
+
type: "event",
|
|
332
|
+
functionInfo: {
|
|
333
|
+
params: [],
|
|
334
|
+
returns: {}
|
|
335
|
+
},
|
|
336
|
+
defaultValue: ""
|
|
337
|
+
},
|
|
338
|
+
onChange: {
|
|
339
|
+
label: {
|
|
340
|
+
zh_CN: "值被改变时触发"
|
|
341
|
+
},
|
|
342
|
+
description: {
|
|
343
|
+
zh_CN: "当用户更改 <input>、<select> 和 <textarea> 元素的值时,被触发的回调函数,"
|
|
344
|
+
},
|
|
345
|
+
type: "event",
|
|
346
|
+
functionInfo: {
|
|
347
|
+
params: [],
|
|
348
|
+
returns: {}
|
|
349
|
+
},
|
|
350
|
+
defaultValue: ""
|
|
351
|
+
},
|
|
352
|
+
onFocus: {
|
|
353
|
+
label: {
|
|
354
|
+
zh_CN: "元素获得焦点"
|
|
355
|
+
},
|
|
356
|
+
description: {
|
|
357
|
+
zh_CN: "元素获得焦点时触发的回调函数"
|
|
358
|
+
},
|
|
359
|
+
type: "event",
|
|
360
|
+
functionInfo: {
|
|
361
|
+
params: [],
|
|
362
|
+
returns: {}
|
|
363
|
+
},
|
|
364
|
+
defaultValue: ""
|
|
365
|
+
},
|
|
366
|
+
onMousemove: {
|
|
367
|
+
label: {
|
|
368
|
+
zh_CN: "鼠标移动时触发"
|
|
369
|
+
},
|
|
370
|
+
description: {
|
|
371
|
+
zh_CN: "鼠标移动时触发的回调函数"
|
|
372
|
+
},
|
|
373
|
+
type: "event",
|
|
374
|
+
functionInfo: {
|
|
375
|
+
params: [],
|
|
376
|
+
returns: {}
|
|
377
|
+
},
|
|
378
|
+
defaultValue: ""
|
|
379
|
+
}
|
|
380
|
+
}, Ot = [
|
|
381
|
+
"onabort",
|
|
382
|
+
"onafterprint",
|
|
383
|
+
"onanimationend",
|
|
384
|
+
"onanimationiteration",
|
|
385
|
+
"onanimationstart",
|
|
386
|
+
"onappinstalled",
|
|
387
|
+
"onauxclick",
|
|
388
|
+
"onbeforeinstallprompt",
|
|
389
|
+
"onbeforeprint",
|
|
390
|
+
"onbeforeunload",
|
|
391
|
+
"onbeforexrselect",
|
|
392
|
+
"onblur",
|
|
393
|
+
"oncancel",
|
|
394
|
+
"oncanplay",
|
|
395
|
+
"oncanplaythrough",
|
|
396
|
+
"onchange",
|
|
397
|
+
"onclick",
|
|
398
|
+
"onclose",
|
|
399
|
+
"oncontextlost",
|
|
400
|
+
"oncontextmenu",
|
|
401
|
+
"oncontextrestored",
|
|
402
|
+
"oncuechange",
|
|
403
|
+
"ondblclick",
|
|
404
|
+
"ondrag",
|
|
405
|
+
"ondragend",
|
|
406
|
+
"ondragenter",
|
|
407
|
+
"ondragleave",
|
|
408
|
+
"ondragover",
|
|
409
|
+
"ondragstart",
|
|
410
|
+
"ondrop",
|
|
411
|
+
"ondurationchange",
|
|
412
|
+
"onemptied",
|
|
413
|
+
"onended",
|
|
414
|
+
"onerror",
|
|
415
|
+
"onfocus",
|
|
416
|
+
"onformdata",
|
|
417
|
+
"ongotpointercapture",
|
|
418
|
+
"onhashchange",
|
|
419
|
+
"oninput",
|
|
420
|
+
"oninvalid",
|
|
421
|
+
"onkeydown",
|
|
422
|
+
"onkeypress",
|
|
423
|
+
"onkeyup",
|
|
424
|
+
"onlanguagechange",
|
|
425
|
+
"onload",
|
|
426
|
+
"onloadeddata",
|
|
427
|
+
"onloadedmetadata",
|
|
428
|
+
"onloadstart",
|
|
429
|
+
"onlostpointercapture",
|
|
430
|
+
"onmessage",
|
|
431
|
+
"onmessageerror",
|
|
432
|
+
"onmousedown",
|
|
433
|
+
"onmouseenter",
|
|
434
|
+
"onmouseleave",
|
|
435
|
+
"onmousemove",
|
|
436
|
+
"onmouseout",
|
|
437
|
+
"onmouseover",
|
|
438
|
+
"onmouseup",
|
|
439
|
+
"onmousewheel",
|
|
440
|
+
"onoffline",
|
|
441
|
+
"ononline",
|
|
442
|
+
"onpagehide",
|
|
443
|
+
"onpageshow",
|
|
444
|
+
"onpause",
|
|
445
|
+
"onplay",
|
|
446
|
+
"onplaying",
|
|
447
|
+
"onpointercancel",
|
|
448
|
+
"onpointerdown",
|
|
449
|
+
"onpointerenter",
|
|
450
|
+
"onpointerleave",
|
|
451
|
+
"onpointermove",
|
|
452
|
+
"onpointerout",
|
|
453
|
+
"onpointerover",
|
|
454
|
+
"onpointerrawupdate",
|
|
455
|
+
"onpointerup",
|
|
456
|
+
"onpopstate",
|
|
457
|
+
"onprogress",
|
|
458
|
+
"onratechange",
|
|
459
|
+
"onrejectionhandled",
|
|
460
|
+
"onreset",
|
|
461
|
+
"onresize",
|
|
462
|
+
"onscroll",
|
|
463
|
+
"onsearch",
|
|
464
|
+
"onsecuritypolicyviolation",
|
|
465
|
+
"onseeked",
|
|
466
|
+
"onseeking",
|
|
467
|
+
"onselect",
|
|
468
|
+
"onselectionchange",
|
|
469
|
+
"onselectstart",
|
|
470
|
+
"onslotchange",
|
|
471
|
+
"onstalled",
|
|
472
|
+
"onstorage",
|
|
473
|
+
"onsubmit",
|
|
474
|
+
"onsuspend",
|
|
475
|
+
"ontimeupdate",
|
|
476
|
+
"ontoggle",
|
|
477
|
+
"ontransitioncancel",
|
|
478
|
+
"ontransitionend",
|
|
479
|
+
"ontransitionrun",
|
|
480
|
+
"ontransitionstart",
|
|
481
|
+
"onunhandledrejection",
|
|
482
|
+
"onunload",
|
|
483
|
+
"onvolumechange",
|
|
484
|
+
"onwaiting",
|
|
485
|
+
"onwebkitanimationend",
|
|
486
|
+
"onwebkitanimationiteration",
|
|
487
|
+
"onwebkitanimationstart",
|
|
488
|
+
"onwebkittransitionend",
|
|
489
|
+
"onwheel"
|
|
490
|
+
], Lt = (d) => Ot.map((k) => {
|
|
491
|
+
let e = k[2].toUpperCase();
|
|
492
|
+
return `${k.substring(0, 2)}${e}${k.substring(3)}`;
|
|
493
|
+
}).includes(d) ? !0 : (Pe({
|
|
494
|
+
type: "error",
|
|
495
|
+
message: "请输入正确的浏览器事件"
|
|
496
|
+
}), !1);
|
|
497
|
+
const Ut = {
|
|
498
|
+
components: {
|
|
499
|
+
BlockLinkEvent: Qe,
|
|
500
|
+
BindEventsDialog: St,
|
|
501
|
+
TinyPopover: we,
|
|
502
|
+
TinyForm: je,
|
|
503
|
+
TinyFormItem: Je,
|
|
504
|
+
TinyInput: Ce,
|
|
505
|
+
TinyButton: De,
|
|
506
|
+
IconHelpQuery: Me(),
|
|
507
|
+
IconChevronDown: nt(),
|
|
508
|
+
SvgButton: Ze
|
|
509
|
+
},
|
|
510
|
+
inheritAttrs: !1,
|
|
511
|
+
setup() {
|
|
512
|
+
const { PLUGIN_NAME: d, activePlugin: i, getPluginApi: k } = Ae(), { pageState: e } = me(), { getBlockEvents: m, getCurrentBlock: g, removeEventLink: S } = qe(), { getMaterial: V } = Ke(), { confirm: I } = Ye(), { highlightMethod: N } = k(d.PageController), a = {
|
|
513
|
+
methodDescription: [{ required: !0, message: "必填", trigger: "blur" }],
|
|
514
|
+
methodName: [{ required: !0, message: "必填", trigger: "blur" }]
|
|
515
|
+
}, t = $(null), n = de({
|
|
516
|
+
eventName: "",
|
|
517
|
+
// 事件名称
|
|
518
|
+
eventBinding: null,
|
|
519
|
+
// 事件绑定的处理方法对象
|
|
520
|
+
componentEvent: {},
|
|
521
|
+
componentEvents: Bt,
|
|
522
|
+
bindActions: {},
|
|
523
|
+
formData: {
|
|
524
|
+
methodDescription: "",
|
|
525
|
+
methodName: ""
|
|
526
|
+
},
|
|
527
|
+
showEventAdditive: !1
|
|
528
|
+
}), w = te(() => !!e.isBlock), x = te(() => Object.keys(n.bindActions).length === 0);
|
|
529
|
+
Ne(() => {
|
|
530
|
+
var oe, s, c, r, b;
|
|
531
|
+
const h = (oe = e == null ? void 0 : e.currentSchema) == null ? void 0 : oe.componentName, B = V(h);
|
|
532
|
+
n.componentEvent = ((c = (s = B == null ? void 0 : B.content) == null ? void 0 : s.schema) == null ? void 0 : c.events) || ((r = B == null ? void 0 : B.schema) == null ? void 0 : r.events) || {}, Object.assign(n.componentEvents, n.componentEvent);
|
|
533
|
+
const U = ((b = e == null ? void 0 : e.currentSchema) == null ? void 0 : b.props) || {}, ue = Object.keys(U);
|
|
534
|
+
n.bindActions = {}, Object.entries(n.componentEvents).forEach(([E, D]) => {
|
|
535
|
+
var v, L, fe;
|
|
536
|
+
if (ue.indexOf(E) > -1) {
|
|
537
|
+
const Se = U[E], { value: Be, params: he } = Se, Oe = !he && ((L = (v = Be.match(/\((.+)\)$/)) == null ? void 0 : v[1]) == null ? void 0 : L.split(",")) || he, T = {
|
|
538
|
+
eventName: E,
|
|
539
|
+
ref: "",
|
|
540
|
+
event: U[E],
|
|
541
|
+
params: Oe
|
|
542
|
+
};
|
|
543
|
+
if (T.event.type === "JSExpression" && (T.ref = T.event.value.replace("this.", "").replace(/\(.*\)$/, "")), e.isBlock) {
|
|
544
|
+
T.metaEvent = D;
|
|
545
|
+
const ve = m(g()), ge = (fe = e == null ? void 0 : e.currentSchema) == null ? void 0 : fe.id;
|
|
546
|
+
ge && ve && Object.entries(ve).forEach(([Le, z]) => {
|
|
547
|
+
var ye, be;
|
|
548
|
+
ge === ((ye = z == null ? void 0 : z.linked) == null ? void 0 : ye.id) && E === ((be = z == null ? void 0 : z.linked) == null ? void 0 : be.event) && (T.linked = z.linked, T.linkedEventName = Le);
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
n.bindActions[E] = T;
|
|
552
|
+
}
|
|
553
|
+
});
|
|
554
|
+
});
|
|
555
|
+
const f = (h, B) => {
|
|
556
|
+
B && n.bindActions[h.eventName] || (n.eventBinding = h, ct());
|
|
557
|
+
}, J = (h) => {
|
|
558
|
+
var U;
|
|
559
|
+
Object.keys(((U = e == null ? void 0 : e.currentSchema) == null ? void 0 : U.props) || {}).indexOf(h.eventName) > -1 && delete e.currentSchema.props[h.eventName];
|
|
560
|
+
}, p = (h) => {
|
|
561
|
+
I({
|
|
562
|
+
title: "提示",
|
|
563
|
+
message: `您确定要删除事件 ${h.eventName} 吗?`,
|
|
564
|
+
exec() {
|
|
565
|
+
e.isBlock && S({ linked: h.linked }), J(h);
|
|
566
|
+
}
|
|
567
|
+
});
|
|
568
|
+
}, A = (h) => {
|
|
569
|
+
h && i(d.PageController).then(() => {
|
|
570
|
+
N && N(h.ref);
|
|
571
|
+
});
|
|
572
|
+
}, R = () => {
|
|
573
|
+
if (n.componentEvents[n.formData.methodName])
|
|
574
|
+
return Pe({
|
|
575
|
+
type: "error",
|
|
576
|
+
message: `${n.formData.methodName}事件函数名已存在`
|
|
577
|
+
}), !1;
|
|
578
|
+
Lt(n.formData.methodName) && (Object.assign(n.componentEvents, {
|
|
579
|
+
[n.formData.methodName]: {
|
|
580
|
+
label: {
|
|
581
|
+
zh_CN: n.formData.methodDescription
|
|
582
|
+
},
|
|
583
|
+
description: {
|
|
584
|
+
zh_CN: `${n.formData.methodDescription}的回调函数`
|
|
585
|
+
},
|
|
586
|
+
type: "event",
|
|
587
|
+
functionInfo: {
|
|
588
|
+
params: [],
|
|
589
|
+
returns: {}
|
|
590
|
+
},
|
|
591
|
+
defaultValue: ""
|
|
592
|
+
}
|
|
593
|
+
}), n.showEventAdditive = !n.showEventAdditive);
|
|
594
|
+
}, G = () => {
|
|
595
|
+
var h;
|
|
596
|
+
(h = t.value) == null || h.resetFields();
|
|
597
|
+
}, W = () => {
|
|
598
|
+
n.showEventAdditive = !1;
|
|
599
|
+
};
|
|
600
|
+
return le(
|
|
601
|
+
() => n.showEventAdditive,
|
|
602
|
+
(h) => {
|
|
603
|
+
h ? window.addEventListener("click", W) : window.removeEventListener("click", W);
|
|
604
|
+
}
|
|
605
|
+
), {
|
|
606
|
+
state: n,
|
|
607
|
+
isBlock: w,
|
|
608
|
+
isEmpty: x,
|
|
609
|
+
delEvent: p,
|
|
610
|
+
openCodePanel: A,
|
|
611
|
+
openActionDialog: f,
|
|
612
|
+
rules: a,
|
|
613
|
+
addMethod: R,
|
|
614
|
+
clearFromData: G,
|
|
615
|
+
ruleForm: t
|
|
616
|
+
};
|
|
617
|
+
}
|
|
618
|
+
}, Q = (d) => (ce("data-v-42d30341"), d = d(), re(), d), Tt = { class: "bind-action-list" }, zt = { class: "popover-head" }, Ft = { class: "head-left" }, jt = /* @__PURE__ */ Q(() => /* @__PURE__ */ o("span", { class: "custom-event-button-text" }, "添加自定义事件", -1)), Jt = /* @__PURE__ */ Q(() => /* @__PURE__ */ o("div", { class: "add-custom-event-tip" }, [
|
|
619
|
+
/* @__PURE__ */ P(" 支持添加原生 DOM 事件,添加后点击 "),
|
|
620
|
+
/* @__PURE__ */ o("span", { class: "event-tip-highlight" }, " 绑定事件 "),
|
|
621
|
+
/* @__PURE__ */ P(" 为画布中所选元素增加事件 ")
|
|
622
|
+
], -1)), Rt = /* @__PURE__ */ Q(() => /* @__PURE__ */ o("span", null, "绑定事件", -1)), Ht = { class: "bind-event-list" }, Xt = ["onClick"], qt = { class: "bind-actions" }, Kt = { class: "action-item bind-action-item" }, Yt = ["onClick"], $t = { class: "event-bind" }, Qt = { class: "action-buttons" }, Zt = { class: "empty-action" }, Gt = { class: "icon" }, Wt = /* @__PURE__ */ Q(() => /* @__PURE__ */ o("div", { class: "center" }, "元素事件绑定", -1)), eo = /* @__PURE__ */ Q(() => /* @__PURE__ */ o("span", { class: "text" }, [
|
|
623
|
+
/* @__PURE__ */ P(" 点击 "),
|
|
624
|
+
/* @__PURE__ */ o("span", { class: "empty-bind-event-tip" }, "绑定事件"),
|
|
625
|
+
/* @__PURE__ */ P("为画布中所选元素增加事件")
|
|
626
|
+
], -1));
|
|
627
|
+
function to(d, i, k, e, m, g) {
|
|
628
|
+
const S = u("icon-help-query"), V = u("tiny-popover"), I = u("tiny-button"), N = u("tiny-input"), a = u("tiny-form-item"), t = u("tiny-form"), n = u("icon-chevron-down"), w = u("block-link-event"), x = u("svg-button"), f = u("svg-icon"), J = u("bind-events-dialog");
|
|
629
|
+
return y(), M(ee, null, [
|
|
630
|
+
o("div", Tt, [
|
|
631
|
+
o("div", zt, [
|
|
632
|
+
o("span", Ft, [
|
|
633
|
+
l(V, {
|
|
634
|
+
modelValue: e.state.showEventAdditive,
|
|
635
|
+
"onUpdate:modelValue": i[5] || (i[5] = (p) => e.state.showEventAdditive = p),
|
|
636
|
+
popperClass: "option-popper",
|
|
637
|
+
placement: "bottom-end",
|
|
638
|
+
trigger: "manual",
|
|
639
|
+
onHide: e.clearFromData
|
|
640
|
+
}, {
|
|
641
|
+
reference: _(() => [
|
|
642
|
+
l(I, {
|
|
643
|
+
class: "title add-custom-event-button",
|
|
644
|
+
"reset-time": 0,
|
|
645
|
+
onClick: i[0] || (i[0] = Ee((p) => e.state.showEventAdditive = !e.state.showEventAdditive, ["stop"]))
|
|
646
|
+
}, {
|
|
647
|
+
default: _(() => [
|
|
648
|
+
jt,
|
|
649
|
+
l(V, {
|
|
650
|
+
placement: "bottom-start",
|
|
651
|
+
trigger: "hover",
|
|
652
|
+
popperClass: "setting-advanced-add-custom-event-tip"
|
|
653
|
+
}, {
|
|
654
|
+
reference: _(() => [
|
|
655
|
+
l(S, { class: "icon-help" })
|
|
656
|
+
]),
|
|
657
|
+
default: _(() => [
|
|
658
|
+
Jt
|
|
659
|
+
]),
|
|
660
|
+
_: 1
|
|
661
|
+
})
|
|
662
|
+
]),
|
|
663
|
+
_: 1
|
|
664
|
+
})
|
|
665
|
+
]),
|
|
666
|
+
default: _(() => [
|
|
667
|
+
o("div", {
|
|
668
|
+
class: "custom-event",
|
|
669
|
+
onClick: i[4] || (i[4] = Ee(() => {
|
|
670
|
+
}, ["stop"]))
|
|
671
|
+
}, [
|
|
672
|
+
l(t, {
|
|
673
|
+
ref: "ruleForm",
|
|
674
|
+
model: e.state.formData,
|
|
675
|
+
rules: e.rules,
|
|
676
|
+
"label-width": "100px",
|
|
677
|
+
"inline-message": !0,
|
|
678
|
+
"validate-type": "text",
|
|
679
|
+
"label-position": "left"
|
|
680
|
+
}, {
|
|
681
|
+
default: _(() => [
|
|
682
|
+
l(a, {
|
|
683
|
+
label: "事件函数名",
|
|
684
|
+
prop: "methodName",
|
|
685
|
+
required: ""
|
|
686
|
+
}, {
|
|
687
|
+
default: _(() => [
|
|
688
|
+
l(N, {
|
|
689
|
+
modelValue: e.state.formData.methodName,
|
|
690
|
+
"onUpdate:modelValue": i[1] || (i[1] = (p) => e.state.formData.methodName = p),
|
|
691
|
+
placeholder: "小驼峰格式,如:onDrag"
|
|
692
|
+
}, null, 8, ["modelValue"])
|
|
693
|
+
]),
|
|
694
|
+
_: 1
|
|
695
|
+
}),
|
|
696
|
+
l(a, {
|
|
697
|
+
label: "事件描述",
|
|
698
|
+
prop: "methodDescription",
|
|
699
|
+
required: ""
|
|
700
|
+
}, {
|
|
701
|
+
default: _(() => [
|
|
702
|
+
l(N, {
|
|
703
|
+
modelValue: e.state.formData.methodDescription,
|
|
704
|
+
"onUpdate:modelValue": i[2] || (i[2] = (p) => e.state.formData.methodDescription = p)
|
|
705
|
+
}, null, 8, ["modelValue"])
|
|
706
|
+
]),
|
|
707
|
+
_: 1
|
|
708
|
+
}),
|
|
709
|
+
o("footer", null, [
|
|
710
|
+
l(I, { onClick: e.addMethod }, {
|
|
711
|
+
default: _(() => [
|
|
712
|
+
P(" 确定")
|
|
713
|
+
]),
|
|
714
|
+
_: 1
|
|
715
|
+
}, 8, ["onClick"]),
|
|
716
|
+
l(I, {
|
|
717
|
+
onClick: i[3] || (i[3] = (p) => e.state.showEventAdditive = !e.state.showEventAdditive)
|
|
718
|
+
}, {
|
|
719
|
+
default: _(() => [
|
|
720
|
+
P(" 取消")
|
|
721
|
+
]),
|
|
722
|
+
_: 1
|
|
723
|
+
})
|
|
724
|
+
])
|
|
725
|
+
]),
|
|
726
|
+
_: 1
|
|
727
|
+
}, 8, ["model", "rules"])
|
|
728
|
+
])
|
|
729
|
+
]),
|
|
730
|
+
_: 1
|
|
731
|
+
}, 8, ["modelValue", "onHide"])
|
|
732
|
+
]),
|
|
733
|
+
l(V, {
|
|
734
|
+
popperClass: "option-popper setting-advanced-bind-event-list",
|
|
735
|
+
placement: "bottom-end",
|
|
736
|
+
trigger: "hover"
|
|
737
|
+
}, {
|
|
738
|
+
reference: _(() => [
|
|
739
|
+
l(I, { class: "bind-event-btn" }, {
|
|
740
|
+
default: _(() => [
|
|
741
|
+
Rt,
|
|
742
|
+
l(n, { class: "icon-chevron-down" })
|
|
743
|
+
]),
|
|
744
|
+
_: 1
|
|
745
|
+
})
|
|
746
|
+
]),
|
|
747
|
+
default: _(() => [
|
|
748
|
+
o("ul", Ht, [
|
|
749
|
+
(y(!0), M(ee, null, se(e.state.componentEvents, (p, A) => {
|
|
750
|
+
var R;
|
|
751
|
+
return y(), M("li", {
|
|
752
|
+
key: A,
|
|
753
|
+
class: X(["bind-event-list-item", { "bind-event-list-item-notallow": e.state.bindActions[A] }]),
|
|
754
|
+
onClick: (G) => e.openActionDialog({ eventName: A }, !0)
|
|
755
|
+
}, [
|
|
756
|
+
o("div", null, O(A) + " " + O(((R = p == null ? void 0 : p.label) == null ? void 0 : R.zh_CN) || A), 1)
|
|
757
|
+
], 10, Xt);
|
|
758
|
+
}), 128))
|
|
759
|
+
])
|
|
760
|
+
]),
|
|
761
|
+
_: 1
|
|
762
|
+
})
|
|
763
|
+
]),
|
|
764
|
+
ie(o("ul", qt, [
|
|
765
|
+
(y(!0), M(ee, null, se(e.state.bindActions, (p) => (y(), M("li", {
|
|
766
|
+
key: p.eventName
|
|
767
|
+
}, [
|
|
768
|
+
o("div", Kt, [
|
|
769
|
+
o("div", {
|
|
770
|
+
class: "binding-name",
|
|
771
|
+
onClick: (A) => e.openActionDialog(p)
|
|
772
|
+
}, [
|
|
773
|
+
o("div", null, [
|
|
774
|
+
P(O(p.eventName), 1),
|
|
775
|
+
o("span", null, O(e.state.componentEvents[p.eventName].label.zh_CN), 1)
|
|
776
|
+
]),
|
|
777
|
+
o("div", {
|
|
778
|
+
class: X({ linked: p.linked })
|
|
779
|
+
}, O(p.linkedEventName), 3),
|
|
780
|
+
o("span", $t, O(p.ref), 1)
|
|
781
|
+
], 8, Yt),
|
|
782
|
+
o("div", Qt, [
|
|
783
|
+
e.isBlock ? (y(), j(w, {
|
|
784
|
+
key: 0,
|
|
785
|
+
data: p
|
|
786
|
+
}, null, 8, ["data"])) : Y("", !0),
|
|
787
|
+
l(x, {
|
|
788
|
+
name: "icon-code",
|
|
789
|
+
tips: "定位到代码",
|
|
790
|
+
placement: "top",
|
|
791
|
+
onClick: (A) => e.openCodePanel(p)
|
|
792
|
+
}, null, 8, ["onClick"]),
|
|
793
|
+
l(x, {
|
|
794
|
+
name: "icon-setting",
|
|
795
|
+
tips: "设置",
|
|
796
|
+
placement: "top",
|
|
797
|
+
onClick: (A) => e.openActionDialog(p, !1)
|
|
798
|
+
}, null, 8, ["onClick"]),
|
|
799
|
+
l(x, {
|
|
800
|
+
name: "icon-del",
|
|
801
|
+
tips: "删除",
|
|
802
|
+
placement: "top",
|
|
803
|
+
onClick: (A) => e.delEvent(p)
|
|
804
|
+
}, null, 8, ["onClick"])
|
|
805
|
+
])
|
|
806
|
+
])
|
|
807
|
+
]))), 128))
|
|
808
|
+
], 512), [
|
|
809
|
+
[ae, !e.isEmpty]
|
|
810
|
+
]),
|
|
811
|
+
ie(o("div", Zt, [
|
|
812
|
+
o("div", Gt, [
|
|
813
|
+
l(f, {
|
|
814
|
+
name: "empty-action",
|
|
815
|
+
class: "empty-action-icon"
|
|
816
|
+
})
|
|
817
|
+
]),
|
|
818
|
+
Wt,
|
|
819
|
+
eo
|
|
820
|
+
], 512), [
|
|
821
|
+
[ae, e.isEmpty]
|
|
822
|
+
])
|
|
823
|
+
]),
|
|
824
|
+
l(J, {
|
|
825
|
+
eventBinding: e.state.eventBinding
|
|
826
|
+
}, null, 8, ["eventBinding"])
|
|
827
|
+
], 64);
|
|
828
|
+
}
|
|
829
|
+
const oo = /* @__PURE__ */ pe(Ut, [["render", to], ["__scopeId", "data-v-42d30341"]]);
|
|
830
|
+
const { DEFAULT_LOOP_NAME: F } = dt, no = {
|
|
831
|
+
components: {
|
|
832
|
+
MetaSwitch: Ge,
|
|
833
|
+
TinyTooltip: Re,
|
|
834
|
+
MetaBindVariable: We,
|
|
835
|
+
MetaInput: et,
|
|
836
|
+
MetaCodeEditor: tt
|
|
837
|
+
},
|
|
838
|
+
inheritAttrs: !1,
|
|
839
|
+
setup() {
|
|
840
|
+
const { pageState: d } = me(), i = $(!1), k = te(() => {
|
|
841
|
+
var t;
|
|
842
|
+
return ((t = i.value) == null ? void 0 : t.type) === K.JSEXPRESSION;
|
|
843
|
+
}), e = () => {
|
|
844
|
+
var t, n;
|
|
845
|
+
return ((n = (t = C().getSchema()) == null ? void 0 : t.loopArgs) == null ? void 0 : n[1]) || F.INDEX;
|
|
846
|
+
}, m = de({
|
|
847
|
+
loopData: {
|
|
848
|
+
type: K.JSEXPRESSION,
|
|
849
|
+
value: "[]"
|
|
850
|
+
},
|
|
851
|
+
loopItem: "item",
|
|
852
|
+
loopIndex: "index",
|
|
853
|
+
isLoop: te(() => {
|
|
854
|
+
var t;
|
|
855
|
+
return ((t = m.loopData) == null ? void 0 : t.type) === K.JSEXPRESSION;
|
|
856
|
+
}),
|
|
857
|
+
loopKey: "",
|
|
858
|
+
shouldUpdate: !1
|
|
859
|
+
});
|
|
860
|
+
le(
|
|
861
|
+
() => [d == null ? void 0 : d.currentSchema, m.shouldUpdate],
|
|
862
|
+
([t]) => {
|
|
863
|
+
var n, w, x, f;
|
|
864
|
+
i.value = (t == null ? void 0 : t.condition) === void 0 ? !0 : t == null ? void 0 : t.condition, m.loopData = t == null ? void 0 : t.loop, m.loopItem = ((n = t == null ? void 0 : t.loopArgs) == null ? void 0 : n[0]) || "", m.loopIndex = ((w = t == null ? void 0 : t.loopArgs) == null ? void 0 : w[1]) || "", m.loopKey = ((f = (x = t == null ? void 0 : t.props) == null ? void 0 : x.key) == null ? void 0 : f.value) || "";
|
|
865
|
+
}
|
|
866
|
+
);
|
|
867
|
+
const g = (t = "") => {
|
|
868
|
+
t = t.replace(/\s*/g, "");
|
|
869
|
+
const n = C().getSchema();
|
|
870
|
+
if (!n)
|
|
871
|
+
return;
|
|
872
|
+
const w = Number(t).toString() !== "NaN";
|
|
873
|
+
n.props = n.props || {};
|
|
874
|
+
const x = n.props;
|
|
875
|
+
t && !w && (x.key = {
|
|
876
|
+
type: K.JSEXPRESSION,
|
|
877
|
+
value: t
|
|
878
|
+
}), t || (m.isLoop ? x.key = {
|
|
879
|
+
type: K.JSEXPRESSION,
|
|
880
|
+
value: e()
|
|
881
|
+
} : delete x.key);
|
|
882
|
+
};
|
|
883
|
+
le([() => m.isLoop, () => m.loopIndex], () => {
|
|
884
|
+
!m.loopKey && m.isLoop && g(e()), m.isLoop || g("");
|
|
885
|
+
});
|
|
886
|
+
const S = () => {
|
|
887
|
+
var t;
|
|
888
|
+
m.loopData = (t = C().getSchema()) == null ? void 0 : t.loop;
|
|
889
|
+
}, V = (t) => {
|
|
890
|
+
C().getSchema() && (t === !1 || t != null && t.type ? C().getSchema().condition = t : delete C().getSchema().condition, lt(), i.value = t);
|
|
891
|
+
}, I = (t) => {
|
|
892
|
+
C().getSchema().loopArgs ? C().getSchema().loopArgs[1] = t || F.INDEX : C().getSchema().loopArgs = [F.ITEM, t];
|
|
893
|
+
};
|
|
894
|
+
return {
|
|
895
|
+
condition: i,
|
|
896
|
+
setConfig: V,
|
|
897
|
+
isBind: k,
|
|
898
|
+
state: m,
|
|
899
|
+
setLoop: (t) => {
|
|
900
|
+
t ? (C().getSchema().loop = t != null && t.type ? t : st(t), I(F.INDEX)) : (g(), delete C().getSchema().loop, delete C().getSchema().loopArgs), m.shouldUpdate = !m.shouldUpdate;
|
|
901
|
+
},
|
|
902
|
+
setLoopItem: (t) => {
|
|
903
|
+
C().getSchema().loopArgs ? C().getSchema().loopArgs[0] = t || F.ITEM : C().getSchema().loopArgs = [t, F.INDEX];
|
|
904
|
+
},
|
|
905
|
+
DEFAULT_LOOP_NAME: F,
|
|
906
|
+
openEditor: S,
|
|
907
|
+
setLoopIndex: I,
|
|
908
|
+
setLoopKey: g,
|
|
909
|
+
getIndexName: e
|
|
910
|
+
};
|
|
911
|
+
}
|
|
912
|
+
}, Z = (d) => (ce("data-v-ef405cbc"), d = d(), re(), d), io = { class: "advanced-config-container" }, so = { class: "advnce-config" }, ao = /* @__PURE__ */ Z(() => /* @__PURE__ */ o("label", { class: "text-ellipsis-multiple" }, "是否渲染", -1)), lo = { class: "advanced-config-form-item" }, co = {
|
|
913
|
+
key: 1,
|
|
914
|
+
class: "binding-state"
|
|
915
|
+
}, ro = { class: "advnce-config" }, mo = /* @__PURE__ */ Z(() => /* @__PURE__ */ o("label", { class: "text-ellipsis-multiple" }, "循环数据", -1)), po = { class: "advanced-config-form-item" }, _o = {
|
|
916
|
+
key: 1,
|
|
917
|
+
class: "binding-state text-ellipsis-multiple"
|
|
918
|
+
}, uo = { class: "advnce-config" }, fo = /* @__PURE__ */ Z(() => /* @__PURE__ */ o("label", { class: "text-ellipsis-multiple" }, "迭代变量名", -1)), ho = { class: "advanced-config-form-item" }, vo = { class: "advnce-config" }, go = /* @__PURE__ */ Z(() => /* @__PURE__ */ o("label", { class: "text-ellipsis-multiple" }, "索引变量名", -1)), yo = { class: "advanced-config-form-item" }, bo = { class: "advnce-config" }, Eo = /* @__PURE__ */ Z(() => /* @__PURE__ */ o("label", { class: "text-ellipsis-multiple" }, "key", -1)), ko = { class: "advanced-config-form-item" };
|
|
919
|
+
function Vo(d, i, k, e, m, g) {
|
|
920
|
+
var t;
|
|
921
|
+
const S = u("meta-switch"), V = u("meta-bind-variable"), I = u("meta-code-editor"), N = u("meta-input"), a = u("tiny-tooltip");
|
|
922
|
+
return y(), M("div", io, [
|
|
923
|
+
o("div", so, [
|
|
924
|
+
ao,
|
|
925
|
+
o("div", lo, [
|
|
926
|
+
e.isBind ? (y(), M("div", co, "已绑定:" + O(e.condition.value), 1)) : (y(), j(S, {
|
|
927
|
+
key: 0,
|
|
928
|
+
modelValue: e.condition,
|
|
929
|
+
"onUpdate:modelValue": e.setConfig
|
|
930
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"])),
|
|
931
|
+
l(V, {
|
|
932
|
+
modelValue: e.condition,
|
|
933
|
+
"onUpdate:modelValue": [
|
|
934
|
+
i[0] || (i[0] = (n) => e.condition = n),
|
|
935
|
+
e.setConfig
|
|
936
|
+
],
|
|
937
|
+
name: "advance"
|
|
938
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"])
|
|
939
|
+
])
|
|
940
|
+
]),
|
|
941
|
+
o("div", ro, [
|
|
942
|
+
mo,
|
|
943
|
+
o("div", po, [
|
|
944
|
+
e.state.isLoop ? (y(), M("div", _o, "已绑定:" + O((t = e.state.loopData) == null ? void 0 : t.value), 1)) : (y(), j(I, {
|
|
945
|
+
key: 0,
|
|
946
|
+
modelValue: e.state.loopData,
|
|
947
|
+
"onUpdate:modelValue": [
|
|
948
|
+
i[1] || (i[1] = (n) => e.state.loopData = n),
|
|
949
|
+
e.setLoop
|
|
950
|
+
],
|
|
951
|
+
"data-type": "JSExpression",
|
|
952
|
+
onOpen: e.openEditor
|
|
953
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "onOpen"])),
|
|
954
|
+
l(V, {
|
|
955
|
+
modelValue: e.state.loopData,
|
|
956
|
+
"onUpdate:modelValue": [
|
|
957
|
+
i[2] || (i[2] = (n) => e.state.loopData = n),
|
|
958
|
+
e.setLoop
|
|
959
|
+
],
|
|
960
|
+
name: "advance"
|
|
961
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"])
|
|
962
|
+
])
|
|
963
|
+
]),
|
|
964
|
+
o("div", uo, [
|
|
965
|
+
fo,
|
|
966
|
+
o("div", ho, [
|
|
967
|
+
l(N, {
|
|
968
|
+
modelValue: e.state.loopItem,
|
|
969
|
+
"onUpdate:modelValue": [
|
|
970
|
+
i[3] || (i[3] = (n) => e.state.loopItem = n),
|
|
971
|
+
e.setLoopItem
|
|
972
|
+
],
|
|
973
|
+
placeholder: `默认值为:${e.DEFAULT_LOOP_NAME.ITEM}`
|
|
974
|
+
}, null, 8, ["modelValue", "placeholder", "onUpdate:modelValue"])
|
|
975
|
+
])
|
|
976
|
+
]),
|
|
977
|
+
o("div", vo, [
|
|
978
|
+
go,
|
|
979
|
+
o("div", yo, [
|
|
980
|
+
l(N, {
|
|
981
|
+
modelValue: e.state.loopIndex,
|
|
982
|
+
"onUpdate:modelValue": [
|
|
983
|
+
i[4] || (i[4] = (n) => e.state.loopIndex = n),
|
|
984
|
+
e.setLoopIndex
|
|
985
|
+
],
|
|
986
|
+
placeholder: `默认值为:${e.DEFAULT_LOOP_NAME.INDEX}`
|
|
987
|
+
}, null, 8, ["modelValue", "placeholder", "onUpdate:modelValue"])
|
|
988
|
+
])
|
|
989
|
+
]),
|
|
990
|
+
o("div", bo, [
|
|
991
|
+
Eo,
|
|
992
|
+
o("div", ko, [
|
|
993
|
+
l(a, { content: "建议填写循环项中的唯一值(如item.id),如果填写为数字将不保存" }, {
|
|
994
|
+
default: _(() => [
|
|
995
|
+
l(N, {
|
|
996
|
+
modelValue: e.state.loopKey,
|
|
997
|
+
"onUpdate:modelValue": [
|
|
998
|
+
i[5] || (i[5] = (n) => e.state.loopKey = n),
|
|
999
|
+
e.setLoopKey
|
|
1000
|
+
],
|
|
1001
|
+
placeholder: `默认为索引名:${e.getIndexName()}`
|
|
1002
|
+
}, null, 8, ["modelValue", "placeholder", "onUpdate:modelValue"])
|
|
1003
|
+
]),
|
|
1004
|
+
_: 1
|
|
1005
|
+
})
|
|
1006
|
+
])
|
|
1007
|
+
])
|
|
1008
|
+
]);
|
|
1009
|
+
}
|
|
1010
|
+
const Io = /* @__PURE__ */ pe(no, [["render", Vo], ["__scopeId", "data-v-ef405cbc"]]), xo = {
|
|
1011
|
+
__name: "Main",
|
|
1012
|
+
setup(d) {
|
|
1013
|
+
const i = $(["bindEvent", "advancedConfig"]);
|
|
1014
|
+
return (k, e) => (y(), j(ne(He), {
|
|
1015
|
+
modelValue: i.value,
|
|
1016
|
+
"onUpdate:modelValue": e[0] || (e[0] = (m) => i.value = m)
|
|
1017
|
+
}, {
|
|
1018
|
+
default: _(() => [
|
|
1019
|
+
l(ne(ke), {
|
|
1020
|
+
title: "事件绑定",
|
|
1021
|
+
name: "bindEvent"
|
|
1022
|
+
}, {
|
|
1023
|
+
default: _(() => [
|
|
1024
|
+
l(oo)
|
|
1025
|
+
]),
|
|
1026
|
+
_: 1
|
|
1027
|
+
}),
|
|
1028
|
+
l(ne(ke), {
|
|
1029
|
+
title: "高级配置",
|
|
1030
|
+
name: "advancedConfig"
|
|
1031
|
+
}, {
|
|
1032
|
+
default: _(() => [
|
|
1033
|
+
l(Io)
|
|
1034
|
+
]),
|
|
1035
|
+
_: 1
|
|
1036
|
+
})
|
|
1037
|
+
]),
|
|
1038
|
+
_: 1
|
|
1039
|
+
}, 8, ["modelValue"]));
|
|
1040
|
+
}
|
|
1041
|
+
}, Uo = {
|
|
1042
|
+
id: "SettingEvents",
|
|
1043
|
+
name: "event",
|
|
1044
|
+
title: "高级",
|
|
1045
|
+
icon: "",
|
|
1046
|
+
align: "left",
|
|
1047
|
+
component: xo
|
|
1048
|
+
};
|
|
1049
|
+
export {
|
|
1050
|
+
Uo as default
|
|
1051
|
+
};
|
package/dist/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.bind-event-dialog-content[data-v-6a54279c]{display:flex;min-width:700px}.bind-event-dialog-content .dialog-content-left[data-v-6a54279c]{margin-right:30px;width:30%;display:flex;flex-direction:column}.bind-event-dialog-content .dialog-content-left .left-title[data-v-6a54279c]{font-weight:600}.bind-event-dialog-content .dialog-content-left .left-list-wrap[data-v-6a54279c]{border:1px solid var(--ti-lowcode-bind-event-dialog-content-left-border-color);border-radius:4px;height:300px;margin-top:12px;display:flex;flex:1}.bind-event-dialog-content .dialog-content-left .left-list-wrap .left-action-list[data-v-6a54279c]{flex:1;padding:12px}.bind-event-dialog-content .dialog-content-left .left-list-wrap .left-action-list .action-list-wrap[data-v-6a54279c]{height:250px;margin-top:8px;overflow:auto}.bind-event-dialog-content .dialog-content-left .left-list-wrap .left-action-list .action-name[data-v-6a54279c]{display:flex;justify-content:space-between;padding:8px 12px;cursor:pointer}.bind-event-dialog-content .dialog-content-left .left-list-wrap .left-action-list .action-name.active[data-v-6a54279c]{background:var(--ti-lowcode-bind-event-dialog-content-left-list-item-active-bg-color)}.bind-event-dialog-content .dialog-content-left .left-list-wrap .left-action-list .action-name .action-selected-icon[data-v-6a54279c]{font-size:14px;color:var(--ti-lowcode-bind-event-dialog-action-selected-icon-color)}.bind-event-dialog-content .content-right[data-v-6a54279c]{width:68%}.bind-event-dialog-content .content-right .content-right-top .new-action-tip[data-v-6a54279c]{margin:8px 0;color:var(--ti-lowcode-bind-event-dialog-new-action-tip-color)}.bind-event-dialog-content .content-right .content-right-bottom .content-right-monaco[data-v-6a54279c]{border:1px solid var(--ti-lowcode-bind-event-dialog-content-right-monaco-border-color);overflow:hidden;position:relative}.bind-event-dialog-content .content-right .content-right-bottom .content-right-monaco .monaco-editor[data-v-6a54279c]{width:100%;height:216px;padding:12px 8px;color:var(--ti-lowcode-toolbar-breadcrumb-color)}.bind-event-dialog-content .content-right .content-right-bottom .content-right-monaco .mark[data-v-6a54279c]{width:100%;height:216px;position:absolute;z-index:1;top:0;background-color:var(--ti-lowcode-bind-event-dialog-mark-bg-color)}.bind-event-dialog-content .content-right .content-right-bottom .params-tip[data-v-6a54279c]{margin:8px 0;color:var(--ti-lowcode-error-tip-color)}.bind-event-dialog-content .content-right .content-right-top .content-right-title[data-v-6a54279c],.bind-event-dialog-content .content-right .content-right-bottom .content-right-title[data-v-6a54279c]{font-weight:600;margin-bottom:12px}.bind-event-dialog-content .content-right .content-right-top .content-right-title .set-params-tip[data-v-6a54279c],.bind-event-dialog-content .content-right .content-right-bottom .content-right-title .set-params-tip[data-v-6a54279c]{margin-right:3px}.bind-event-dialog-content .content-right .content-right-top .content-right-title .set-switch[data-v-6a54279c],.bind-event-dialog-content .content-right .content-right-bottom .content-right-title .set-switch[data-v-6a54279c]{width:60px;margin-left:10px}.bind-event-dialog-content .content-right .tip-error .content-right-monaco[data-v-6a54279c]{border:1px solid var(--ti-lowcode-error-tip-color)}.bind-event-dialog-content .content-right .tip-error .params-tip[data-v-6a54279c],.bind-event-dialog-content .content-right .tip-error .new-action-tip[data-v-6a54279c]{color:var(--ti-lowcode-error-tip-color)}.custom-event[data-v-42d30341]{padding:10px 20px 10px 10px}.custom-event footer[data-v-42d30341]{text-align:center}.bind-action-list .bind-actions[data-v-42d30341]{margin-top:20px}.bind-action-list .bind-actions .binding-name[data-v-42d30341]{word-break:break-all}.bind-action-list .bind-actions .action-buttons[data-v-42d30341]{display:flex;align-items:center;justify-content:center}.bind-action-list .bind-actions .action-buttons .item[data-v-42d30341]{margin-right:10px}.bind-action-list .bind-actions .event-bind[data-v-42d30341]{color:var(--ti-lowcode-events-event-bind-color)}.bind-action-list .bind-actions .bind-action-item[data-v-42d30341]{display:flex;justify-content:space-between;padding:8px 12px;cursor:pointer;color:var(--ti-lowcode-events-bind-action-item-color);border-bottom:1px solid var(--ti-lowcode-events-bind-action-item-border-color)}.bind-action-list .bind-actions .bind-action-item[data-v-42d30341]:first-child{border-top:1px solid var(--ti-lowcode-events-bind-action-item-border-color)}.bind-action-list .bind-actions .bind-action-item[data-v-42d30341]:hover{background:var(--ti-lowcode-events-bind-action-item-hover-bg-color)}.bind-action-list .bind-actions .bind-action-item .linked[data-v-42d30341]{background-color:var(--ti-lowcode-events-bind-action-item-linked-bg-color);color:var(--ti-lowcode-events-bind-action-item-linked-color)}.bind-action-list .popover-head[data-v-42d30341]{display:flex;justify-content:space-between;margin-top:12px}.bind-action-list .popover-head .head-left[data-v-42d30341]{margin-right:8px}.bind-action-list .popover-head .head-left .add-custom-event-button[data-v-42d30341]{padding:0 16px;font-size:12px}.bind-action-list .popover-head .head-left .add-custom-event-button .custom-event-button-text[data-v-42d30341]{margin-right:4px}.bind-action-list .popover-head .bind-event-btn[data-v-42d30341]{padding:0 16px;font-size:12px}.bind-action-list .empty-action[data-v-42d30341]{display:flex;flex-direction:column;align-items:center;color:var(--ti-lowcode-events-empty-action-color)}.bind-action-list .empty-action .empty-action-icon[data-v-42d30341]{margin-top:20px;font-size:48px}.bind-action-list .empty-action .icon[data-v-42d30341]{text-align:center;opacity:.4}.bind-action-list .empty-action .center[data-v-42d30341]{margin-top:4px}.bind-action-list .empty-action .text[data-v-42d30341]{margin-top:12px}.bind-action-list .empty-action .empty-bind-event-tip[data-v-42d30341]{color:var(--ti-lowcode-events-empty-action-tips-strong-color)}.bind-event-list[data-v-42d30341]{color:var(--ti-lowcode-events-bind-event-list-color)}.bind-event-list-item-notallow[data-v-42d30341]{cursor:not-allowed;pointer-events:none;color:var(--ti-lowcode-events-bind-event-list-item-disabled-color)}.bind-event-list-item[data-v-42d30341]{padding:8px 12px}.bind-event-list-item[data-v-42d30341]:hover{cursor:pointer;background:var(--lowcode-events-bind-event-list-item-hover-bg-color)}.add-custom-event-tip[data-v-42d30341]{color:var(--ti-lowcode-events-add-custom-event-tips-color)}.add-custom-event-tip .event-tip-highlight[data-v-42d30341]{color:var(--ti-lowcode-event-add-custom-event-tips-highlight-color)}.advanced-config-container .advnce-config[data-v-ef405cbc]{padding:10px;align-items:center;display:flex;column-gap:12px;color:var(--ti-lowcode-events-advanced-config-color)}.advanced-config-container .advnce-config label[data-v-ef405cbc]{width:80px;word-break:keep-all;color:var(--ti-lowcode-events-advanced-label-color);flex-shrink:0}.advanced-config-container .advnce-config .advanced-config-form-item[data-v-ef405cbc]{display:grid;grid-template-columns:1fr auto}.advanced-config-container .advnce-config .binding-state[data-v-ef405cbc]{box-sizing:border-box;background:var(--ti-lowcode-events-advanced-binding-state-bg-color);color:var(--ti-lowcode-events-advanced-binding-state-color);font-size:12px;height:30px;line-height:22px;padding:4px 8px;--ellipsis-line: 1;border-radius:6px}.advanced-config-container .advnce-config .advance-config-loop-wrap .advance-item[data-v-ef405cbc]{width:100%}
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@opentiny/tiny-engine-setting-events",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "vite build"
|
|
9
|
+
},
|
|
10
|
+
"main": "dist/index.js",
|
|
11
|
+
"module": "dist/index.js",
|
|
12
|
+
"files": [
|
|
13
|
+
"dist"
|
|
14
|
+
],
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@opentiny/tiny-engine-canvas": "^1.0.0",
|
|
17
|
+
"@opentiny/tiny-engine-common": "^1.0.0",
|
|
18
|
+
"@opentiny/tiny-engine-controller": "^1.0.0",
|
|
19
|
+
"@opentiny/tiny-engine-http": "^1.0.0",
|
|
20
|
+
"@opentiny/vue": "^3.8.0",
|
|
21
|
+
"vue": "3.2.45"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@vitejs/plugin-vue": "^4.2.3",
|
|
25
|
+
"@vitejs/plugin-vue-jsx": "^1.3.10",
|
|
26
|
+
"vite": "^4.3.7"
|
|
27
|
+
}
|
|
28
|
+
}
|