@opentiny/tiny-engine-setting-events 2.0.0-alpha.2 → 2.0.0-alpha.4

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