@opentiny/tiny-engine-setting-events 2.0.0-alpha.1 → 2.0.0-alpha.3

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