@opentiny/tiny-engine-setting-events 1.0.4-alpha.0 → 1.0.5

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 CHANGED
@@ -1,39 +1,39 @@
1
1
  import "./style.css";
2
- import { ref as K, reactive as te, watchEffect as Ce, resolveComponent as f, withDirectives as de, openBlock as h, createBlock as U, withCtx as _, createElementVNode as o, createVNode as p, createTextVNode as M, createElementBlock as S, Fragment as G, renderList as ce, normalizeClass as J, toDisplayString as L, createCommentVNode as H, vShow as re, nextTick as Be, pushScopeId as me, popScopeId as _e, unref as O, computed as W, withModifiers as Oe, watch as Ee } from "vue";
3
- import { Input as pe, Button as ee, Search as Le, Popover as De, DialogBox as Ae, Switch as Te, Form as Ue, FormItem as ke, Tooltip as ze, Collapse as je, CollapseItem as xe } from "@opentiny/vue";
4
- import { useLayout as Pe, useCanvas as ue, useHistory as $e, useBlock as Fe, useResource as Je, useModal as Re, useProperties as I } from "@opentiny/tiny-engine-controller";
5
- import { VueMonaco as Xe, BlockLinkEvent as qe, SvgButton as He, MetaSwitch as Ke, MetaBindVariable as Ye, MetaInput as Qe, MetaCodeEditor as Ze } from "@opentiny/tiny-engine-common";
6
- import { iconYes as Ge, iconHelpQuery as we, iconChevronDown as We } from "@opentiny/vue-icon";
7
- import { theme as et, string2Obj as tt } from "@opentiny/tiny-engine-controller/adapter";
8
- import { string2Ast as Ve, ast2String as ot } from "@opentiny/tiny-engine-controller/js/ast";
9
- import { PROP_DATA_TYPE as q } from "@opentiny/tiny-engine-controller/utils";
10
- import { updateRect as nt } from "@opentiny/tiny-engine-canvas";
11
- import { constants as it } from "@opentiny/tiny-engine-utils";
12
- const oe = (l, i) => {
13
- const b = l.__vccOpts || l;
14
- for (const [e, d] of i)
15
- b[e] = d;
16
- return b;
17
- }, fe = K(!1), st = () => {
18
- fe.value = !0;
19
- }, Ie = () => {
20
- fe.value = !1;
21
- }, Ne = "newMethod", at = /[^0-9a-zA-Z_$]/, lt = /^[a-zA-Z_$][0-9a-zA-Z_$]*$/, F = {
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
- }, dt = {
26
+ }, an = {
27
27
  components: {
28
- MonacoEditor: Xe,
29
- TinyInput: pe,
30
- TinyButton: ee,
31
- TinySearch: Le,
32
- TinyPopover: De,
33
- TinyDialogBox: Ae,
34
- IconYes: Ge(),
35
- IconHelpQuery: we(),
36
- TinySwitch: Te
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(l) {
46
- const { PLUGIN_NAME: i, getPluginApi: b, activePlugin: e } = Pe(), { pageState: d } = ue(), { getMethodNameList: u, getMethods: w, saveMethod: y, highlightMethod: E } = b(i.PageController), x = K(null), n = te({
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: F.default,
51
+ tip: X.default,
52
52
  tipError: !1,
53
53
  enableExtraParams: !1,
54
54
  isValidParams: !0
55
- }), t = {
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: et(),
62
+ theme: We(),
63
63
  lineNumbers: !1,
64
64
  minimap: {
65
65
  enabled: !1
66
66
  }
67
- }, a = (s, r) => {
68
- const m = s.map((V) => {
69
- var g;
70
- return Number.parseInt((g = V.match(/\d+$/)) == null ? void 0 : g[0]) || 0;
71
- }).sort((V, g) => V - g).pop();
72
- let P = `${(r == null ? void 0 : r.replace(at, "_")) || ""}New`;
73
- return m > -1 && (P += `${m + 1}`), P;
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
- Ce(() => {
76
- var V, g;
77
- const s = (V = l.eventBinding) == null ? void 0 : V.eventName, r = (u == null ? void 0 : u().filter((T) => T.indexOf(s) > -1)) || [], k = {
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: a(r, s),
80
- type: Ne
79
+ name: c(r, s),
80
+ type: Ee
81
81
  };
82
- (g = l.eventBinding) != null && g.ref ? n.bindMethodInfo = {
83
- name: l.eventBinding.ref
84
- } : n.bindMethodInfo = k;
85
- const P = (u == null ? void 0 : u().filter((T) => T.indexOf(n.searchValue) > -1).map((T) => ({ name: T }))) || [];
86
- n.filterMethodList = [k, ...P];
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 C = (s) => {
89
- n.bindMethodInfo = s;
90
- }, N = (s) => {
91
- var V, g;
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 = (V = l.eventBinding) == null ? void 0 : V.eventName;
94
+ const r = (N = p.eventBinding) == null ? void 0 : N.eventName;
95
95
  if (!r)
96
96
  return;
97
- const m = (g = d == null ? void 0 : d.currentSchema) == null ? void 0 : g.props;
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: k, extra: P } = s;
101
- l[r] || (m[r] = {
100
+ const { name: _, extra: M } = s;
101
+ p[r] || (m[r] = {
102
102
  type: "JSExpression",
103
103
  value: ""
104
- }), P && n.enableExtraParams && (m[r].params = P), m[r].value = `this.${k}`, $e().addHistory();
105
- }, c = () => {
106
- n.tipError = !1, n.tip = F.default;
107
- }, D = (s) => !s, X = (s) => u == null ? void 0 : u().includes(s), ne = (s) => !lt.test(s), v = (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: F.empty },
110
- { validator: X, tip: F.exist },
111
- { validator: ne, tip: F.ruleInvalid }
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 k = r[m];
115
- if (k.validator(s)) {
116
- n.tipError = !0, n.tip = k.tip;
114
+ const _ = r[m];
115
+ if (_.validator(s)) {
116
+ i.tipError = !0, i.tip = _.tip;
117
117
  return;
118
118
  }
119
119
  }
120
- n.tipError = !1, n.tip = F.default;
121
- }, A = () => {
120
+ i.tipError = !1, i.tip = X.default;
121
+ }, le = () => {
122
122
  var r;
123
123
  let s = "";
124
- if (n.enableExtraParams)
124
+ if (i.enableExtraParams)
125
125
  try {
126
- const m = (r = x.value) == null ? void 0 : r.getEditor().getValue();
127
- s = JSON.parse(m), n.isValidParams = Array.isArray(s);
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
- n.isValidParams = !1;
129
+ i.isValidParams = !1;
130
130
  }
131
131
  return s;
132
- }, B = (s) => Array.from({ length: s.length }, (r, m) => `args${m}`).join(","), ie = () => {
133
- var m, k, P, V;
134
- let s = (k = (m = w()) == null ? void 0 : m[n.bindMethodInfo.name]) == null ? void 0 : k.value, r = "{}";
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 g = {};
136
+ let b = {};
137
137
  try {
138
- g = Ve(s);
138
+ b = be(s);
139
139
  } catch {
140
- s = s.replace("function", `function ${n.bindMethodInfo.name}`), g = Ve(s);
140
+ s = s.replace("function", `function ${i.bindMethodInfo.name}`), b = be(s);
141
141
  }
142
- (V = (P = g == null ? void 0 : g.program) == null ? void 0 : P.body[0]) != null && V.body && (r = ot(g.program.body[0].body));
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
- }, Z = () => {
147
- e(i.PageController).then(() => {
148
- Be(() => {
146
+ }, S = () => {
147
+ e(t.PageController).then(() => {
148
+ Me(() => {
149
149
  var s;
150
- E && E((s = n.bindMethodInfo) == null ? void 0 : s.name);
150
+ x && x((s = i.bindMethodInfo) == null ? void 0 : s.name);
151
151
  });
152
152
  });
153
153
  };
154
154
  return {
155
- NEW_METHOD_TYPE: Ne,
156
- state: n,
157
- editor: x,
158
- editorOptions: t,
159
- dialogVisible: fe,
160
- change: v,
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 (n.tipError)
162
+ if (i.tipError)
163
163
  return;
164
- let s = "event", r = A(), m = s;
165
- if (!n.isValidParams)
164
+ let s = "event", r = le(), m = s;
165
+ if (!i.isValidParams)
166
166
  return;
167
- r && (s = r.join(","), m = B(r)), N({ ...n.bindMethodInfo, params: s, extra: r });
168
- const k = ie();
169
- y == null || y({
170
- name: n.bindMethodInfo.name,
171
- content: n.enableExtraParams ? `function (eventArgs,${m}) ${k}` : `function (${m}) ${k}`
172
- }), Z(), Ie();
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
- c(), Ie();
175
+ l(), ye();
176
176
  },
177
177
  openedDialog: () => {
178
178
  var s, r, m;
179
- n.enableExtraParams = !!((r = (s = l.eventBinding) == null ? void 0 : s.params) != null && r.length), n.editorContent = JSON.stringify(((m = l.eventBinding) == null ? void 0 : m.params) || [], null, 2), c();
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: C
181
+ selectMethod: u
182
182
  };
183
183
  }
184
- }, R = (l) => (me("data-v-937af0d2"), l = l(), _e(), l), ct = { class: "bind-event-dialog-content" }, rt = { class: "dialog-content-left" }, pt = /* @__PURE__ */ R(() => /* @__PURE__ */ o("div", { class: "left-title" }, "响应方法", -1)), mt = { class: "left-list-wrap" }, _t = { class: "left-action-list" }, ut = { class: "action-list-wrap" }, ft = ["onClick"], vt = { class: "content-right" }, ht = /* @__PURE__ */ R(() => /* @__PURE__ */ o("div", { class: "content-right-title" }, "方法名称", -1)), gt = { class: "new-action-tip" }, bt = { class: "content-right-title" }, yt = /* @__PURE__ */ R(() => /* @__PURE__ */ o("span", { class: "set-params-tip" }, "扩展参数设置", -1)), Et = /* @__PURE__ */ R(() => /* @__PURE__ */ o("br", null, null, -1)), kt = /* @__PURE__ */ R(() => /* @__PURE__ */ o("span", null, "开启", -1)), xt = /* @__PURE__ */ R(() => /* @__PURE__ */ o("span", null, "关闭", -1)), Vt = { class: "content-right-monaco" }, It = {
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
- }, Nt = {
187
+ }, hn = {
188
188
  key: 0,
189
189
  class: "params-tip"
190
- }, Ct = { class: "bind-dialog-footer" };
191
- function Dt(l, i, b, e, d, u) {
192
- const w = f("tiny-search"), y = f("icon-yes"), E = f("tiny-input"), x = f("icon-help-query"), n = f("tiny-popover"), t = f("tiny-switch"), a = f("monaco-editor"), C = f("tiny-button"), N = f("tiny-dialog-box");
193
- return de((h(), U(N, {
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", Ct, [
202
- p(C, {
201
+ footer: v(() => [
202
+ o("div", bn, [
203
+ d(u, {
203
204
  type: "info",
204
205
  onClick: e.confirm
205
206
  }, {
206
- default: _(() => [
207
- M("确 定")
208
- ]),
207
+ default: v(() => t[10] || (t[10] = [
208
+ w("确 定")
209
+ ])),
209
210
  _: 1
210
211
  }, 8, ["onClick"]),
211
- p(C, { onClick: e.closeDialog }, {
212
- default: _(() => [
213
- M("取 消")
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", ct, [
221
- o("div", rt, [
222
- pt,
223
- o("div", mt, [
224
- o("div", _t, [
225
- p(w, {
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": i[0] || (i[0] = (c) => e.state.searchValue = c),
228
+ "onUpdate:modelValue": t[0] || (t[0] = (l) => e.state.searchValue = l),
228
229
  placeholder: "搜索"
229
230
  }, null, 8, ["modelValue"]),
230
- o("ul", ut, [
231
- (h(!0), S(G, null, ce(e.state.filterMethodList, (c) => (h(), S("li", {
232
- key: c.name,
233
- onClick: (D) => e.selectMethod(c)
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: J(["action-name", { active: c.name === e.state.bindMethodInfo.name }])
237
+ class: q(["action-name", { active: l.name === e.state.bindMethodInfo.name }])
237
238
  }, [
238
- M(L(c.title || c.name) + " ", 1),
239
- c.name === e.state.bindMethodInfo.name ? (h(), U(y, {
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
- })) : H("", !0)
243
+ })) : K("", !0)
243
244
  ], 2)
244
- ], 8, ft))), 128))
245
+ ], 8, pn))), 128))
245
246
  ])
246
247
  ])
247
248
  ])
248
249
  ]),
249
- o("div", vt, [
250
+ o("div", un, [
250
251
  o("div", {
251
- class: J(["content-right-top", { "tip-error": e.state.tipError }])
252
+ class: q(["content-right-top", { "tip-error": e.state.tipError }])
252
253
  }, [
253
- ht,
254
- p(E, {
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
- i[1] || (i[1] = (c) => e.state.bindMethodInfo.name = c),
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: J([{ "status-error": e.state.tipError }]),
262
+ class: q([{ "status-error": e.state.tipError }]),
262
263
  placeholder: "请从左侧选择一个方法进行绑定,或者选择添加新方法,输入自定义方法名称。"
263
264
  }, null, 8, ["modelValue", "disabled", "class", "onUpdate:modelValue"]),
264
- o("div", gt, L(e.state.tip), 1)
265
+ o("div", vn, L(e.state.tip), 1)
265
266
  ], 2),
266
267
  o("div", {
267
- class: J(["content-right-bottom", { "tip-error": !e.state.isValidParams }])
268
+ class: q(["content-right-bottom", { "tip-error": !e.state.isValidParams }])
268
269
  }, [
269
- o("div", bt, [
270
- yt,
271
- p(n, {
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
- p(x)
277
+ reference: v(() => [
278
+ d(V)
278
279
  ]),
279
- default: _(() => [
280
+ default: v(() => [
280
281
  o("p", null, [
281
- M(" 扩展参数:调用当前事件传入的真实参数,数组格式,追加在原有事件参数之后"),
282
- Et,
283
- M(" 如: " + L(e.state.bindMethodInfo.name) + "(eventArgs, extParam1, extParam2, ...) ", 1)
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
- p(t, {
289
+ d(n, {
289
290
  modelValue: e.state.enableExtraParams,
290
- "onUpdate:modelValue": i[2] || (i[2] = (c) => e.state.enableExtraParams = c),
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
- kt
296
- ]),
297
- close: _(() => [
298
- xt
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", Vt, [
304
- e.dialogVisible ? (h(), U(a, {
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"])) : H("", !0),
311
- e.state.enableExtraParams ? H("", !0) : (h(), S("div", It))
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 ? (h(), S("div", Nt, ' 请输入数组格式的参数,参数可以为表达式。例如:["extParam1", "item.status", 1, "getNames()"] ')) : H("", !0)
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 At = /* @__PURE__ */ oe(dt, [["render", Dt], ["__scopeId", "data-v-937af0d2"]]), Pt = {
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(dt, [["render", Dt], ["__scopeId", "data-v-937af0d
377
376
  },
378
377
  defaultValue: ""
379
378
  }
380
- }, wt = [
379
+ }, xn = [
381
380
  "onabort",
382
381
  "onafterprint",
383
382
  "onanimationend",
@@ -487,11 +486,11 @@ const At = /* @__PURE__ */ oe(dt, [["render", Dt], ["__scopeId", "data-v-937af0d
487
486
  "onwebkitanimationstart",
488
487
  "onwebkittransitionend",
489
488
  "onwheel"
490
- ], Mt = (l) => !!wt.map((b) => {
491
- let e = b[2].toUpperCase();
492
- return `${b.substring(0, 2)}${e}${b.substring(3)}`;
493
- }).includes(l);
494
- const St = { class: "footer" }, Bt = {
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(l, { emit: i }) {
508
- const b = l, e = i, d = te({
506
+ setup(p, { emit: t }) {
507
+ const E = p, e = t, a = $({
509
508
  eventDescription: "",
510
509
  eventName: ""
511
- }), u = K(null), y = {
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: (n, t, a) => {
522
- if (b.componentEvents[d.eventName]) {
523
- a(new Error("事件名已存在"));
520
+ validator: (i, n, c) => {
521
+ if (E.componentEvents[a.eventName]) {
522
+ c(new Error("事件名已存在"));
524
523
  return;
525
524
  }
526
- if (!Mt(d.eventName)) {
527
- a(new Error("请输入正确的浏览器事件名"));
525
+ if (!Vn(a.eventName)) {
526
+ c(new Error("请输入正确的浏览器事件名"));
528
527
  return;
529
528
  }
530
- a();
529
+ c();
531
530
  }
532
531
  }
533
532
  ]
534
- }, E = () => {
535
- e("closeDialog");
536
533
  }, x = () => {
537
- u.value && u.value.validate((n) => {
538
- if (!n)
534
+ e("closeDialog");
535
+ }, V = () => {
536
+ f.value && f.value.validate((i) => {
537
+ if (!i)
539
538
  return;
540
- const { eventName: t, eventDescription: a } = d;
541
- e("addEvent", { eventName: t, eventDescription: a });
539
+ const { eventName: n, eventDescription: c } = a;
540
+ e("addEvent", { eventName: n, eventDescription: c });
542
541
  });
543
542
  };
544
- return (n, t) => (h(), U(O(Ae), {
545
- visible: l.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: E
549
+ onClose: x
551
550
  }, {
552
- footer: _(() => [
553
- o("div", St, [
554
- p(O(ee), { onClick: E }, {
555
- default: _(() => [
556
- M(" 取消")
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
- p(O(ee), {
559
+ d(O(G), {
561
560
  type: "primary",
562
- onClick: x
561
+ onClick: V
563
562
  }, {
564
- default: _(() => [
565
- M(" 确定")
566
- ]),
563
+ default: v(() => n[3] || (n[3] = [
564
+ w(" 确定")
565
+ ])),
567
566
  _: 1
568
567
  })
569
568
  ])
570
569
  ]),
571
- default: _(() => [
572
- p(O(Ue), {
570
+ default: v(() => [
571
+ d(O(Oe), {
573
572
  ref_key: "ruleForm",
574
- ref: u,
575
- model: d,
576
- rules: y,
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
- p(O(ke), {
582
+ default: v(() => [
583
+ d(O(_e), {
585
584
  label: "事件函数名",
586
585
  prop: "eventName",
587
586
  required: ""
588
587
  }, {
589
- default: _(() => [
590
- p(O(pe), {
591
- modelValue: d.eventName,
592
- "onUpdate:modelValue": t[0] || (t[0] = (a) => d.eventName = a),
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
- p(O(ke), {
597
+ d(O(_e), {
599
598
  label: "事件描述",
600
599
  prop: "eventDescription",
601
600
  required: ""
602
601
  }, {
603
- default: _(() => [
604
- p(O(pe), {
605
- modelValue: d.eventDescription,
606
- "onUpdate:modelValue": t[1] || (t[1] = (a) => d.eventDescription = a)
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
- }, Ot = /* @__PURE__ */ oe(Bt, [["__scopeId", "data-v-932b189c"]]);
619
- const Lt = {
617
+ }, Cn = /* @__PURE__ */ ee(Nn, [["__scopeId", "data-v-932b189c"]]);
618
+ const Dn = {
620
619
  components: {
621
- BlockLinkEvent: qe,
622
- BindEventsDialog: At,
623
- TinyPopover: De,
624
- TinyButton: ee,
625
- IconHelpQuery: we(),
626
- IconChevronDown: We(),
627
- SvgButton: He,
628
- AddEventsDialog: Ot
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: l, activePlugin: i, getPluginApi: b } = Pe(), { pageState: e } = ue(), { getBlockEvents: d, getCurrentBlock: u, removeEventLink: w } = Fe(), { getMaterial: y } = Je(), { confirm: E } = Re(), { highlightMethod: x } = b(l.PageController), n = te({
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
- componentEvents: Pt,
637
+ customEvents: kn,
639
638
  bindActions: {},
640
639
  showBindEventDialog: !1
641
- }), t = W(() => !!e.isBlock), a = W(() => Object.keys(n.bindActions).length === 0);
642
- Ce(() => {
643
- var Z, se, ae, le, s;
644
- const v = (Z = e == null ? void 0 : e.currentSchema) == null ? void 0 : Z.componentName, A = y(v);
645
- n.componentEvent = ((ae = (se = A == null ? void 0 : A.content) == null ? void 0 : se.schema) == null ? void 0 : ae.events) || ((le = A == null ? void 0 : A.schema) == null ? void 0 : le.events) || {}, Object.assign(n.componentEvents, n.componentEvent);
646
- const B = ((s = e == null ? void 0 : e.currentSchema) == null ? void 0 : s.props) || {}, ie = Object.keys(B);
647
- n.bindActions = {}, Object.entries(n.componentEvents).forEach(([r, m]) => {
648
- var k, P, V;
649
- if (ie.indexOf(r) > -1) {
650
- const g = B[r], { value: T, params: ve } = g, Me = !ve && ((P = (k = T.match(/\((.+)\)$/)) == null ? void 0 : k[1]) == null ? void 0 : P.split(",")) || ve, z = {
651
- eventName: r,
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: B[r],
654
- params: Me
652
+ event: S[_],
653
+ params: Ae
655
654
  };
656
- if (z.event.type === "JSExpression" && (z.ref = z.event.value.replace("this.", "").replace(/\(.*\)$/, "")), e.isBlock) {
657
- z.metaEvent = m;
658
- const he = d(u()), ge = (V = e == null ? void 0 : e.currentSchema) == null ? void 0 : V.id;
659
- ge && he && Object.entries(he).forEach(([Se, j]) => {
660
- var be, ye;
661
- ge === ((be = j == null ? void 0 : j.linked) == null ? void 0 : be.id) && r === ((ye = j == null ? void 0 : j.linked) == null ? void 0 : ye.event) && (z.linked = j.linked, z.linkedEventName = Se);
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[r] = z;
663
+ n.bindActions[_] = F;
665
664
  }
666
665
  });
667
666
  });
668
- const C = (v, A) => {
669
- A && n.bindActions[v.eventName] || (n.eventBinding = v, st());
670
- }, N = (v) => {
671
- var B;
672
- Object.keys(((B = e == null ? void 0 : e.currentSchema) == null ? void 0 : B.props) || {}).indexOf(v.eventName) > -1 && delete e.currentSchema.props[v.eventName];
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: t,
677
- isEmpty: a,
678
- delEvent: (v) => {
679
- E({
675
+ isBlock: c,
676
+ isEmpty: u,
677
+ delEvent: (h) => {
678
+ x({
680
679
  title: "提示",
681
- message: `您确定要删除事件 ${v.eventName} 吗?`,
680
+ message: `您确定要删除事件 ${h.eventName} 吗?`,
682
681
  exec() {
683
- e.isBlock && w({ linked: v.linked }), N(v);
682
+ e.isBlock && P({ linked: h.linked }), D(h);
684
683
  }
685
684
  });
686
685
  },
687
- openCodePanel: (v) => {
688
- v && i(l.PageController).then(() => {
689
- x && x(v.ref);
686
+ openCodePanel: (h) => {
687
+ h && t(p.PageController).then(() => {
688
+ i && i(h.ref);
690
689
  });
691
690
  },
692
- openActionDialog: C,
693
- handleAddEvent: (v) => {
694
- const { eventName: A, eventDescription: B } = v;
695
- Object.assign(n.componentEvents, {
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: B
697
+ zh_CN: S
699
698
  },
700
699
  description: {
701
- zh_CN: `${B}的回调函数`
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: (v) => {
713
- n.showBindEventDialog = v;
714
- }
711
+ handleToggleAddEventDialog: (h) => {
712
+ n.showBindEventDialog = h;
713
+ },
714
+ renderEventList: I,
715
+ locale: V
715
716
  };
716
717
  }
717
- }, Y = (l) => (me("data-v-e09a30b7"), l = l(), _e(), l), Tt = { class: "bind-action-list" }, Ut = { class: "popover-head" }, zt = { class: "head-left" }, jt = /* @__PURE__ */ Y(() => /* @__PURE__ */ o("span", { class: "custom-event-button-text" }, "添加自定义事件", -1)), $t = /* @__PURE__ */ Y(() => /* @__PURE__ */ o("div", { class: "add-custom-event-tip" }, [
718
- /* @__PURE__ */ M(" 支持添加原生 DOM 事件,添加后点击 "),
719
- /* @__PURE__ */ o("span", { class: "event-tip-highlight" }, " 绑定事件 "),
720
- /* @__PURE__ */ M(" 为画布中所选元素增加事件 ")
721
- ], -1)), Ft = /* @__PURE__ */ Y(() => /* @__PURE__ */ o("span", null, "绑定事件", -1)), Jt = { class: "bind-event-list" }, Rt = ["onClick"], Xt = { class: "bind-actions" }, qt = { class: "action-item bind-action-item" }, Ht = ["onClick"], Kt = { class: "event-bind" }, Yt = { class: "action-buttons" }, Qt = { class: "empty-action" }, Zt = { class: "icon" }, Gt = /* @__PURE__ */ Y(() => /* @__PURE__ */ o("div", { class: "center" }, "元素事件绑定", -1)), Wt = /* @__PURE__ */ Y(() => /* @__PURE__ */ o("span", { class: "text" }, [
722
- /* @__PURE__ */ M(" 点击 "),
723
- /* @__PURE__ */ o("span", { class: "empty-bind-event-tip" }, "绑定事件"),
724
- /* @__PURE__ */ M("为画布中所选元素增加事件")
725
- ], -1));
726
- function eo(l, i, b, e, d, u) {
727
- const w = f("icon-help-query"), y = f("tiny-popover"), E = f("tiny-button"), x = f("icon-chevron-down"), n = f("block-link-event"), t = f("svg-button"), a = f("svg-icon"), C = f("bind-events-dialog"), N = f("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: i[0] || (i[0] = Oe((c) => e.handleToggleAddEventDialog(!0), ["stop"]))
728
+ onClick: t[0] || (t[0] = we((l) => e.handleToggleAddEventDialog(!0), ["stop"]))
736
729
  }, {
737
- default: _(() => [
738
- jt,
739
- p(y, {
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
- p(w, { class: "icon-help" })
737
+ reference: v(() => [
738
+ d(P, { class: "icon-help" })
746
739
  ]),
747
- default: _(() => [
748
- $t
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, d, u) {
753
750
  _: 1
754
751
  })
755
752
  ]),
756
- p(y, {
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
- p(E, { class: "bind-event-btn" }, {
763
- default: _(() => [
764
- Ft,
765
- p(x, { class: "icon-chevron-down" })
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", Jt, [
772
- (h(!0), S(G, null, ce(e.state.componentEvents, (c, D) => {
773
- var X;
774
- return h(), S("li", {
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: J(["bind-event-list-item", { "bind-event-list-item-notallow": e.state.bindActions[D] }]),
777
- onClick: (ne) => e.openActionDialog({ eventName: D }, !0)
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(((X = c == null ? void 0 : c.label) == null ? void 0 : X.zh_CN) || D), 1)
780
- ], 10, Rt);
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
- de(o("ul", Xt, [
788
- (h(!0), S(G, null, ce(e.state.bindActions, (c) => (h(), S("li", {
789
- key: c.eventName
790
- }, [
791
- o("div", qt, [
792
- o("div", {
793
- class: "binding-name",
794
- onClick: (D) => e.openActionDialog(c)
795
- }, [
796
- o("div", null, [
797
- M(L(c.eventName), 1),
798
- o("span", null, L(e.state.componentEvents[c.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: J({ linked: c.linked })
802
- }, L(c.linkedEventName), 3),
803
- o("span", Kt, L(c.ref), 1)
804
- ], 8, Ht),
805
- o("div", Yt, [
806
- e.isBlock ? (h(), U(n, {
807
- key: 0,
808
- data: c
809
- }, null, 8, ["data"])) : H("", !0),
810
- p(t, {
811
- name: "plugin-icon-page-schema",
812
- tips: "定位到代码",
813
- placement: "top",
814
- onClick: (D) => e.openCodePanel(c)
815
- }, null, 8, ["onClick"]),
816
- p(t, {
817
- name: "setting",
818
- tips: "设置",
819
- placement: "top",
820
- onClick: (D) => e.openActionDialog(c, !1)
821
- }, null, 8, ["onClick"]),
822
- p(t, {
823
- name: "delete",
824
- tips: "删除",
825
- placement: "top",
826
- onClick: (D) => e.delEvent(c)
827
- }, null, 8, ["onClick"])
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
- ]))), 128))
829
+ ]);
830
+ }), 128))
831
831
  ], 512), [
832
- [re, !e.isEmpty]
832
+ [fe, !e.isEmpty]
833
833
  ]),
834
- de(o("div", Qt, [
835
- o("div", Zt, [
836
- p(a, {
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
- Gt,
842
- Wt
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
- [re, e.isEmpty]
848
+ [fe, e.isEmpty]
845
849
  ])
846
850
  ]),
847
- p(C, {
851
+ d(u, {
848
852
  eventBinding: e.state.eventBinding
849
853
  }, null, 8, ["eventBinding"]),
850
- p(N, {
854
+ d(I, {
851
855
  visible: e.state.showBindEventDialog,
852
- componentEvents: e.state.componentEvents,
853
- onCloseDialog: i[1] || (i[1] = (c) => e.handleToggleAddEventDialog(!1)),
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 to = /* @__PURE__ */ oe(Lt, [["render", eo], ["__scopeId", "data-v-e09a30b7"]]);
859
- const { DEFAULT_LOOP_NAME: $ } = it, oo = {
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: Ke,
862
- TinyTooltip: ze,
863
- MetaBindVariable: Ye,
864
- MetaInput: Qe,
865
- MetaCodeEditor: Ze
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: l } = ue(), i = K(!1), b = W(() => {
870
- var t;
871
- return ((t = i.value) == null ? void 0 : t.type) === q.JSEXPRESSION;
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 t, a;
874
- return ((a = (t = I().getSchema()) == null ? void 0 : t.loopArgs) == null ? void 0 : a[1]) || $.INDEX;
875
- }, d = te({
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: q.JSEXPRESSION,
881
+ type: H.JSEXPRESSION,
878
882
  value: "[]"
879
883
  },
880
884
  loopItem: "item",
881
885
  loopIndex: "index",
882
- isLoop: W(() => {
883
- var t;
884
- return ((t = d.loopData) == null ? void 0 : t.type) === q.JSEXPRESSION;
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
- Ee(
890
- () => [l == null ? void 0 : l.currentSchema, d.shouldUpdate],
891
- ([t]) => {
892
- var a, C, N, c;
893
- i.value = (t == null ? void 0 : t.condition) === void 0 ? !0 : t == null ? void 0 : t.condition, d.loopData = t == null ? void 0 : t.loop, d.loopItem = ((a = t == null ? void 0 : t.loopArgs) == null ? void 0 : a[0]) || "", d.loopIndex = ((C = t == null ? void 0 : t.loopArgs) == null ? void 0 : C[1]) || "", d.loopKey = ((c = (N = t == null ? void 0 : t.props) == null ? void 0 : N.key) == null ? void 0 : c.value) || "";
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 u = (t = "") => {
897
- t = t.replace(/\s*/g, "");
898
- const a = I().getSchema();
899
- if (!a)
900
+ const f = (n = "") => {
901
+ n = n.replace(/\s*/g, "");
902
+ const c = C().getSchema();
903
+ if (!c)
900
904
  return;
901
- const C = Number(t).toString() !== "NaN";
902
- a.props = a.props || {};
903
- const N = a.props;
904
- t && !C && (N.key = {
905
- type: q.JSEXPRESSION,
906
- value: t
907
- }), t || (d.isLoop ? N.key = {
908
- type: q.JSEXPRESSION,
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 N.key);
914
+ } : delete I.key);
911
915
  };
912
- Ee([() => d.isLoop, () => d.loopIndex], () => {
913
- !d.loopKey && d.isLoop && u(e()), d.isLoop || u("");
916
+ ge([() => a.isLoop, () => a.loopIndex], () => {
917
+ !a.loopKey && a.isLoop && f(e()), a.isLoop || f("");
914
918
  });
915
- const w = () => {
916
- var t;
917
- d.loopData = (t = I().getSchema()) == null ? void 0 : t.loop;
918
- }, y = (t) => {
919
- I().getSchema() && (t === !1 || t != null && t.type ? I().getSchema().condition = t : delete I().getSchema().condition, nt(), i.value = t);
920
- }, E = (t) => {
921
- I().getSchema().loopArgs ? I().getSchema().loopArgs[1] = t || $.INDEX : I().getSchema().loopArgs = [$.ITEM, t];
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: i,
925
- setConfig: y,
926
- isBind: b,
927
- state: d,
928
- setLoop: (t) => {
929
- t ? (I().getSchema().loop = t != null && t.type ? t : tt(t), E($.INDEX)) : (u(), delete I().getSchema().loop, delete I().getSchema().loopArgs), d.shouldUpdate = !d.shouldUpdate;
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: (t) => {
932
- I().getSchema().loopArgs ? I().getSchema().loopArgs[0] = t || $.ITEM : I().getSchema().loopArgs = [t, $.INDEX];
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: w,
936
- setLoopIndex: E,
937
- setLoopKey: u,
938
+ DEFAULT_LOOP_NAME: R,
939
+ openEditor: P,
940
+ setLoopIndex: x,
941
+ setLoopKey: f,
938
942
  getIndexName: e
939
943
  };
940
944
  }
941
- }, Q = (l) => (me("data-v-ef405cbc"), l = l(), _e(), l), no = { class: "advanced-config-container" }, io = { class: "advnce-config" }, so = /* @__PURE__ */ Q(() => /* @__PURE__ */ o("label", { class: "text-ellipsis-multiple" }, "是否渲染", -1)), ao = { class: "advanced-config-form-item" }, lo = {
942
- key: 1,
943
- class: "binding-state"
944
- }, co = { class: "advnce-config" }, ro = /* @__PURE__ */ Q(() => /* @__PURE__ */ o("label", { class: "text-ellipsis-multiple" }, "循环数据", -1)), po = { class: "advanced-config-form-item" }, mo = {
945
- key: 1,
946
- class: "binding-state text-ellipsis-multiple"
947
- }, _o = { class: "advnce-config" }, uo = /* @__PURE__ */ Q(() => /* @__PURE__ */ o("label", { class: "text-ellipsis-multiple" }, "迭代变量名", -1)), fo = { class: "advanced-config-form-item" }, vo = { class: "advnce-config" }, ho = /* @__PURE__ */ Q(() => /* @__PURE__ */ o("label", { class: "text-ellipsis-multiple" }, "索引变量名", -1)), go = { class: "advanced-config-form-item" }, bo = { class: "advnce-config" }, yo = /* @__PURE__ */ Q(() => /* @__PURE__ */ o("label", { class: "text-ellipsis-multiple" }, "key", -1)), Eo = { class: "advanced-config-form-item" };
948
- function ko(l, i, b, e, d, u) {
949
- var t;
950
- const w = f("meta-switch"), y = f("meta-bind-variable"), E = f("meta-code-editor"), x = f("meta-input"), n = f("tiny-tooltip");
951
- return h(), S("div", no, [
952
- o("div", io, [
953
- so,
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
- p(y, {
962
+ d(k, {
961
963
  modelValue: e.condition,
962
964
  "onUpdate:modelValue": [
963
- i[0] || (i[0] = (a) => e.condition = a),
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", co, [
971
- ro,
972
- o("div", po, [
973
- e.state.isLoop ? (h(), S("div", mo, "已绑定:" + L((t = e.state.loopData) == null ? void 0 : t.value), 1)) : (h(), U(E, {
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
- i[1] || (i[1] = (a) => e.state.loopData = a),
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
- p(y, {
989
+ d(k, {
984
990
  modelValue: e.state.loopData,
985
991
  "onUpdate:modelValue": [
986
- i[2] || (i[2] = (a) => e.state.loopData = a),
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", _o, [
994
- uo,
995
- o("div", fo, [
996
- p(x, {
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
- i[3] || (i[3] = (a) => e.state.loopItem = a),
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", vo, [
1007
- ho,
1008
- o("div", go, [
1009
- p(x, {
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
- i[4] || (i[4] = (a) => e.state.loopIndex = a),
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", bo, [
1020
- yo,
1021
- o("div", Eo, [
1022
- p(n, { content: "建议填写循环项中的唯一值(如item.id),如果填写为数字将不保存" }, {
1023
- default: _(() => [
1024
- p(x, {
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
- i[5] || (i[5] = (a) => e.state.loopKey = a),
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, d, u) {
1036
1042
  ])
1037
1043
  ]);
1038
1044
  }
1039
- const xo = /* @__PURE__ */ oe(oo, [["render", ko], ["__scopeId", "data-v-ef405cbc"]]), Vo = {
1045
+ const it = /* @__PURE__ */ ee(Rn, [["render", ot], ["__scopeId", "data-v-61c9f6a9"]]), st = {
1040
1046
  __name: "Main",
1041
- setup(l) {
1042
- const i = K(["bindEvent", "advancedConfig"]);
1043
- return (b, e) => (h(), U(O(je), {
1044
- modelValue: i.value,
1045
- "onUpdate:modelValue": e[0] || (e[0] = (d) => i.value = d)
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
- p(O(xe), {
1053
+ default: v(() => [
1054
+ d(O(he), {
1049
1055
  title: "事件绑定",
1050
1056
  name: "bindEvent"
1051
1057
  }, {
1052
- default: _(() => [
1053
- p(to)
1058
+ default: v(() => [
1059
+ d(Jn)
1054
1060
  ]),
1055
1061
  _: 1
1056
1062
  }),
1057
- p(O(xe), {
1063
+ d(O(he), {
1058
1064
  title: "高级配置",
1059
1065
  name: "advancedConfig"
1060
1066
  }, {
1061
- default: _(() => [
1062
- p(xo)
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
- }, Lo = {
1076
+ }, _t = {
1071
1077
  id: "SettingEvents",
1072
1078
  name: "event",
1073
1079
  title: "高级",
1074
1080
  icon: "",
1075
1081
  align: "left",
1076
- component: Vo
1082
+ component: st
1077
1083
  };
1078
1084
  export {
1079
- Lo as default
1085
+ _t as default
1080
1086
  };