@ease-forge/designer 1.0.28 → 1.1.0

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 (150) hide show
  1. package/dist/components/DesignCanvas.vue.d.ts +16 -0
  2. package/dist/components/DesignCanvas.vue.d.ts.map +1 -0
  3. package/dist/components/DragGhost.vue.d.ts +9 -0
  4. package/dist/components/DragGhost.vue.d.ts.map +1 -0
  5. package/dist/components/Workbench.vue.d.ts +14 -0
  6. package/dist/components/Workbench.vue.d.ts.map +1 -0
  7. package/dist/components/panels/MaterialPanel.vue.d.ts +14 -0
  8. package/dist/components/panels/MaterialPanel.vue.d.ts.map +1 -0
  9. package/dist/components/panels/OutlinePanel.vue.d.ts +9 -0
  10. package/dist/components/panels/OutlinePanel.vue.d.ts.map +1 -0
  11. package/dist/components/panels/SetterAdvancedPanel.vue.d.ts +15 -0
  12. package/dist/components/panels/SetterAdvancedPanel.vue.d.ts.map +1 -0
  13. package/dist/components/panels/SetterEventPanel.vue.d.ts +15 -0
  14. package/dist/components/panels/SetterEventPanel.vue.d.ts.map +1 -0
  15. package/dist/components/panels/SetterPropsGroup.vue.d.ts +12 -0
  16. package/dist/components/panels/SetterPropsGroup.vue.d.ts.map +1 -0
  17. package/dist/components/panels/SetterPropsPanel.vue.d.ts +12 -0
  18. package/dist/components/panels/SetterPropsPanel.vue.d.ts.map +1 -0
  19. package/dist/components/panels/SetterStyleGroup.vue.d.ts +12 -0
  20. package/dist/components/panels/SetterStyleGroup.vue.d.ts.map +1 -0
  21. package/dist/components/panels/SetterStylePanel.vue.d.ts +12 -0
  22. package/dist/components/panels/SetterStylePanel.vue.d.ts.map +1 -0
  23. package/dist/components/panels/style/StyleGroups.d.ts +35 -0
  24. package/dist/components/panels/style/StyleGroups.d.ts.map +1 -0
  25. package/dist/components/setter/BoolSetter.vue.d.ts +5 -0
  26. package/dist/components/setter/BoolSetter.vue.d.ts.map +1 -0
  27. package/dist/components/setter/ColorSetter.vue.d.ts +5 -0
  28. package/dist/components/setter/ColorSetter.vue.d.ts.map +1 -0
  29. package/dist/components/setter/DateSetter.vue.d.ts +5 -0
  30. package/dist/components/setter/DateSetter.vue.d.ts.map +1 -0
  31. package/dist/components/setter/EditorSetter.vue.d.ts +5 -0
  32. package/dist/components/setter/EditorSetter.vue.d.ts.map +1 -0
  33. package/dist/components/setter/NumberSetter.vue.d.ts +5 -0
  34. package/dist/components/setter/NumberSetter.vue.d.ts.map +1 -0
  35. package/dist/components/setter/SelectSetter.vue.d.ts +5 -0
  36. package/dist/components/setter/SelectSetter.vue.d.ts.map +1 -0
  37. package/dist/components/setter/StringSetter.vue.d.ts +5 -0
  38. package/dist/components/setter/StringSetter.vue.d.ts.map +1 -0
  39. package/dist/components/setter/TimeSetter.vue.d.ts +5 -0
  40. package/dist/components/setter/TimeSetter.vue.d.ts.map +1 -0
  41. package/dist/core/DesignerDriver.d.ts +36 -0
  42. package/dist/core/DesignerDriver.d.ts.map +1 -0
  43. package/dist/core/DesignerEffect.d.ts +30 -0
  44. package/dist/core/DesignerEffect.d.ts.map +1 -0
  45. package/dist/core/DesignerEngine.d.ts +95 -0
  46. package/dist/core/DesignerEngine.d.ts.map +1 -0
  47. package/dist/core/DesignerModule.d.ts +28 -0
  48. package/dist/core/DesignerModule.d.ts.map +1 -0
  49. package/dist/core/EventBus.d.ts +37 -0
  50. package/dist/core/EventBus.d.ts.map +1 -0
  51. package/dist/drivers/DragDropDriver.d.ts +48 -0
  52. package/dist/drivers/DragDropDriver.d.ts.map +1 -0
  53. package/dist/drivers/KeyboardDriver.d.ts +18 -0
  54. package/dist/drivers/KeyboardDriver.d.ts.map +1 -0
  55. package/dist/drivers/MouseClickDriver.d.ts +14 -0
  56. package/dist/drivers/MouseClickDriver.d.ts.map +1 -0
  57. package/dist/drivers/MouseMoveDriver.d.ts +14 -0
  58. package/dist/drivers/MouseMoveDriver.d.ts.map +1 -0
  59. package/dist/ease-forge-designer.cjs.js +2 -1
  60. package/dist/ease-forge-designer.cjs.js.map +1 -0
  61. package/dist/ease-forge-designer.cjs.prod.js +1 -1
  62. package/dist/ease-forge-designer.css +2 -0
  63. package/dist/ease-forge-designer.esm.js +3433 -0
  64. package/dist/ease-forge-designer.esm.js.map +1 -0
  65. package/dist/ease-forge-designer.esm.prod.js +3432 -1
  66. package/dist/effects/AuxToolEffect.d.ts +52 -0
  67. package/dist/effects/AuxToolEffect.d.ts.map +1 -0
  68. package/dist/effects/CursorEffect.d.ts +29 -0
  69. package/dist/effects/CursorEffect.d.ts.map +1 -0
  70. package/dist/effects/DraggingEffect.d.ts +17 -0
  71. package/dist/effects/DraggingEffect.d.ts.map +1 -0
  72. package/dist/events/DesignerEvent.d.ts +26 -0
  73. package/dist/events/DesignerEvent.d.ts.map +1 -0
  74. package/dist/events/cursor/AbstractCursorEvent.d.ts +22 -0
  75. package/dist/events/cursor/AbstractCursorEvent.d.ts.map +1 -0
  76. package/dist/events/cursor/DragMoveEvent.d.ts +10 -0
  77. package/dist/events/cursor/DragMoveEvent.d.ts.map +1 -0
  78. package/dist/events/cursor/DragStartEvent.d.ts +17 -0
  79. package/dist/events/cursor/DragStartEvent.d.ts.map +1 -0
  80. package/dist/events/cursor/DragStopEvent.d.ts +10 -0
  81. package/dist/events/cursor/DragStopEvent.d.ts.map +1 -0
  82. package/dist/events/cursor/MouseClickEvent.d.ts +10 -0
  83. package/dist/events/cursor/MouseClickEvent.d.ts.map +1 -0
  84. package/dist/events/cursor/MouseDoubleClickEvent.d.ts +10 -0
  85. package/dist/events/cursor/MouseDoubleClickEvent.d.ts.map +1 -0
  86. package/dist/events/cursor/MouseMoveEvent.d.ts +10 -0
  87. package/dist/events/cursor/MouseMoveEvent.d.ts.map +1 -0
  88. package/dist/events/designer/CommandEvent.d.ts +20 -0
  89. package/dist/events/designer/CommandEvent.d.ts.map +1 -0
  90. package/dist/events/designer/DragDropEvent.d.ts +29 -0
  91. package/dist/events/designer/DragDropEvent.d.ts.map +1 -0
  92. package/dist/events/engine/EngineMountEvent.d.ts +21 -0
  93. package/dist/events/engine/EngineMountEvent.d.ts.map +1 -0
  94. package/dist/events/engine/EngineUnmountEvent.d.ts +16 -0
  95. package/dist/events/engine/EngineUnmountEvent.d.ts.map +1 -0
  96. package/dist/events/keyboard/ShortcutKeyEvent.d.ts +32 -0
  97. package/dist/events/keyboard/ShortcutKeyEvent.d.ts.map +1 -0
  98. package/dist/history/Command.d.ts +21 -0
  99. package/dist/history/Command.d.ts.map +1 -0
  100. package/dist/history/CommandStack.d.ts +46 -0
  101. package/dist/history/CommandStack.d.ts.map +1 -0
  102. package/dist/index.d.ts +90 -1
  103. package/dist/index.d.ts.map +1 -0
  104. package/dist/models/Cursor.d.ts +44 -0
  105. package/dist/models/Cursor.d.ts.map +1 -0
  106. package/dist/models/DesignerState.d.ts +76 -0
  107. package/dist/models/DesignerState.d.ts.map +1 -0
  108. package/dist/models/DraggingCmpMetas.d.ts +41 -0
  109. package/dist/models/DraggingCmpMetas.d.ts.map +1 -0
  110. package/dist/models/HoverDashed.d.ts +41 -0
  111. package/dist/models/HoverDashed.d.ts.map +1 -0
  112. package/dist/models/Insertion.d.ts +57 -0
  113. package/dist/models/Insertion.d.ts.map +1 -0
  114. package/dist/models/Selection.d.ts +8 -0
  115. package/dist/models/Selection.d.ts.map +1 -0
  116. package/dist/models/SetterShareState.d.ts +32 -0
  117. package/dist/models/SetterShareState.d.ts.map +1 -0
  118. package/dist/operations/NodeOperationEffect.d.ts +25 -0
  119. package/dist/operations/NodeOperationEffect.d.ts.map +1 -0
  120. package/dist/operations/NodePosition.d.ts +55 -0
  121. package/dist/operations/NodePosition.d.ts.map +1 -0
  122. package/dist/operations/NodeSerialize.d.ts +8 -0
  123. package/dist/operations/NodeSerialize.d.ts.map +1 -0
  124. package/dist/operations/commands/AddNodesCommand.d.ts +34 -0
  125. package/dist/operations/commands/AddNodesCommand.d.ts.map +1 -0
  126. package/dist/operations/commands/MoveNodesCommand.d.ts +42 -0
  127. package/dist/operations/commands/MoveNodesCommand.d.ts.map +1 -0
  128. package/dist/operations/commands/RemoveNodesCommand.d.ts +50 -0
  129. package/dist/operations/commands/RemoveNodesCommand.d.ts.map +1 -0
  130. package/dist/operations/commands/UpdateListenersCommand.d.ts +42 -0
  131. package/dist/operations/commands/UpdateListenersCommand.d.ts.map +1 -0
  132. package/dist/operations/commands/UpdatePropsCommand.d.ts +53 -0
  133. package/dist/operations/commands/UpdatePropsCommand.d.ts.map +1 -0
  134. package/dist/register/RegisterSetter.d.ts +8 -0
  135. package/dist/register/RegisterSetter.d.ts.map +1 -0
  136. package/dist/types/Designer.d.ts +153 -0
  137. package/dist/types/Designer.d.ts.map +1 -0
  138. package/dist/utils/ComponentMetaUtils.d.ts +13 -0
  139. package/dist/utils/ComponentMetaUtils.d.ts.map +1 -0
  140. package/dist/utils/DesignerUtils.d.ts +11 -0
  141. package/dist/utils/DesignerUtils.d.ts.map +1 -0
  142. package/dist/utils/PositionCalc.d.ts +27 -0
  143. package/dist/utils/PositionCalc.d.ts.map +1 -0
  144. package/dist/utils/SetterUtils.d.ts +59 -0
  145. package/dist/utils/SetterUtils.d.ts.map +1 -0
  146. package/dist/utils/StyleUtils.d.ts +34 -0
  147. package/dist/utils/StyleUtils.d.ts.map +1 -0
  148. package/package.json +30 -21
  149. package/dist/types/index.d.ts +0 -0
  150. /package/{index.js → index.cjs} +0 -0
@@ -1 +1,3432 @@
1
-
1
+ import { RequestIdle as e, Typeof as t, globalThisPolyfill as n } from "@ease-forge/shared";
2
+ import { Fragment as r, Teleport as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, createVNode as d, defineComponent as f, getCurrentInstance as p, h as m, markRaw as h, mergeProps as g, nextTick as _, normalizeClass as v, normalizeStyle as y, onBeforeUnmount as b, onMounted as x, openBlock as S, reactive as C, ref as w, renderList as T, resolveDynamicComponent as ee, shallowReactive as te, shallowRef as E, toDisplayString as D, unref as O, vModelText as ne, vShow as k, watch as re, withCtx as A, withDirectives as j } from "vue";
3
+ import { BlockComponent as ie, DefComponentManage as ae, childSlotName as oe, createFun as se, deepTraverseRuntimeNode as ce, emptyNodeId as le, htmlExtAttr as M, isHtmlTag as ue, materialItem as de, toPropsEventName as fe, useHtmlExtAttr as N } from "@ease-forge/runtime";
4
+ import P from "lodash";
5
+ import { Button as F, Collapse as pe, DatePicker as me, Empty as he, Input as ge, InputNumber as _e, Select as ve, Switch as ye, Tabs as be, Tag as xe, TextArea as Se, TimePicker as Ce, Tooltip as I, Tree as we, message as Te } from "antdv-next";
6
+ import { ClearOutlined as Ee, DeleteOutlined as De, EditOutlined as Oe, EyeOutlined as ke, RedoOutlined as Ae, UndoOutlined as je } from "@antdv-next/icons";
7
+ import { parseStringStyle as Me } from "@vue/shared";
8
+ import Ne from "dayjs";
9
+ //#region src/types/Designer.ts
10
+ var L = /* @__PURE__ */ function(e) {
11
+ return e.Normal = "normal", e.DragStart = "drag_start", e.Dragging = "dragging", e.DragStop = "drag_stop", e;
12
+ }(L || {}), Pe = /* @__PURE__ */ function(e) {
13
+ return e.DragDrop = "dragdrop", e.Selection = "selection", e;
14
+ }(Pe || {}), Fe = /* @__PURE__ */ function(e) {
15
+ return e.PC = "pc", e.Mobile = "mobile", e;
16
+ }(Fe || {}), Ie = /* @__PURE__ */ function(e) {
17
+ return e.Designer = "Designer", e.Code = "Code", e.Preview = "Preview", e;
18
+ }(Ie || {}), R = /* @__PURE__ */ function(e) {
19
+ return e.top = "top", e.bottom = "bottom", e.left = "left", e.right = "right", e;
20
+ }(R || {}), z = /* @__PURE__ */ function(e) {
21
+ return e.leftTop = "leftTop", e.leftBottom = "leftBottom", e.rightTop = "rightTop", e.rightBottom = "rightBottom", e;
22
+ }(z || {}), B = class {
23
+ static eventType = "";
24
+ type;
25
+ data;
26
+ context;
27
+ constructor(e, t) {
28
+ this.type = this.constructor.eventType, this.type || console.warn(`[DesignerEvent] 事件类 "${this.constructor.name}" 未定义静态 eventType 属性`), e !== void 0 && (this.data = e), t !== void 0 && (this.context = t);
29
+ }
30
+ }, Le = class extends B {
31
+ static eventType = "engine:mount";
32
+ }, Re = class extends B {
33
+ static eventType = "engine:unmount";
34
+ }, V = class extends B {
35
+ constructor(e) {
36
+ super(), this.data = ze(e);
37
+ }
38
+ };
39
+ function ze(e) {
40
+ let t = {
41
+ clientX: e.clientX,
42
+ clientY: e.clientY,
43
+ pageX: e.pageX,
44
+ pageY: e.pageY,
45
+ target: e.target,
46
+ view: e.view,
47
+ topClientX: e.clientX,
48
+ topClientY: e.clientY,
49
+ topPageX: e.pageX,
50
+ topPageY: e.pageY
51
+ }, { frameElement: r } = e.view || {};
52
+ if (r && t.view !== n) {
53
+ let e = r.getBoundingClientRect(), n = e.width / r.offsetWidth;
54
+ t.topClientX = t.clientX * n + e.x, t.topClientY = t.clientY * n + e.y, t.topPageX = t.pageX + e.x - t.view.scrollX, t.topPageY = t.pageY + e.y - t.view.scrollY;
55
+ let i = document.elementFromPoint(t.topPageX, t.topClientY);
56
+ i !== r && (t.target = i);
57
+ }
58
+ return t;
59
+ }
60
+ //#endregion
61
+ //#region src/events/cursor/DragStartEvent.ts
62
+ var Be = class extends V {
63
+ static eventType = "cursor:drag-start";
64
+ constructor(e, t) {
65
+ super(e), this.data.componentMetas = t;
66
+ }
67
+ }, Ve = class extends V {
68
+ static eventType = "cursor:drag-move";
69
+ }, He = class extends V {
70
+ static eventType = "cursor:drag-stop";
71
+ }, Ue = class extends V {
72
+ static eventType = "cursor:mouse-click";
73
+ }, We = class extends V {
74
+ static eventType = "cursor:mouse-double-click";
75
+ }, Ge = class extends V {
76
+ static eventType = "cursor:mouse-move";
77
+ }, Ke = class extends B {
78
+ static eventType = "keyboard:shortcut";
79
+ constructor(e, t) {
80
+ super({
81
+ type: e.type,
82
+ key: e.key.toLowerCase(),
83
+ ctrlKey: e.ctrlKey,
84
+ shiftKey: e.shiftKey,
85
+ altKey: e.altKey,
86
+ metaKey: e.metaKey,
87
+ pressedKeys: t,
88
+ rawEvent: e
89
+ });
90
+ }
91
+ }, qe = class extends B {
92
+ static eventType = "designer:drag-drop";
93
+ }, Je = class extends B {
94
+ static eventType = "designer:command";
95
+ }, Ye = class {
96
+ subscribers = /* @__PURE__ */ new Map();
97
+ dispatch(e) {
98
+ let t = this.subscribers.get(e.type);
99
+ if (!t || t.length <= 0) return;
100
+ let n = t.slice();
101
+ for (let t of n) try {
102
+ t.fun(e);
103
+ } catch (t) {
104
+ console.error(`[EventBus] 事件 "${e.type}" 的订阅函数执行异常`, t);
105
+ }
106
+ }
107
+ subscribe(e, t, n = 0) {
108
+ let r = e.eventType;
109
+ if (!r) return console.error(`[EventBus] 订阅的事件类 "${e.name}" 未定义静态 eventType 属性`), () => void 0;
110
+ let i = this.subscribers.get(r);
111
+ i || (i = [], this.subscribers.set(r, i));
112
+ let a = {
113
+ priority: n,
114
+ fun: t
115
+ }, o = i.length;
116
+ for (let e = 0; e < i.length; e++) if (i[e].priority > n) {
117
+ o = e;
118
+ break;
119
+ }
120
+ return i.splice(o, 0, a), () => this.unsubscribe(e, t);
121
+ }
122
+ unsubscribe(e, t) {
123
+ let n = this.subscribers.get(e.eventType);
124
+ if (!n) return;
125
+ let r = n.findIndex((e) => e.fun === t);
126
+ r >= 0 && n.splice(r, 1);
127
+ }
128
+ unsubscribeAll(e) {
129
+ this.subscribers.delete(e.eventType);
130
+ }
131
+ clearAllSubscribe() {
132
+ this.subscribers.clear();
133
+ }
134
+ }, Xe = class {
135
+ designerEngine;
136
+ eventbus;
137
+ componentManage;
138
+ container;
139
+ window;
140
+ constructor(e, t, n) {
141
+ this.designerEngine = e, this.eventbus = e.eventbus, this.componentManage = e.componentManage, this.container = t, this.window = n;
142
+ }
143
+ getContainerCursorStyle() {
144
+ return this.container instanceof Document ? this.container.body.style.cursor : this.container.style.cursor;
145
+ }
146
+ setContainerCursorStyle(e) {
147
+ this.container instanceof Document ? this.container.body.style.cursor = e : this.container.style.cursor = e;
148
+ }
149
+ }, Ze = class extends Xe {
150
+ addEventListener(e, t, n) {
151
+ this.container.addEventListener(e, t, n);
152
+ }
153
+ removeEventListener(e, t, n) {
154
+ this.container.removeEventListener(e, t, n);
155
+ }
156
+ preventDefault = (e) => {
157
+ e.preventDefault();
158
+ };
159
+ }, Qe = class extends Xe {
160
+ actived = !1;
161
+ effect() {
162
+ this.actived || (this.actived = !0, this.onEffect());
163
+ }
164
+ destroy() {
165
+ this.actived && (this.actived = !1, this.onDestroy());
166
+ }
167
+ }, $e = /* @__PURE__ */ new Set(/* @__PURE__ */ "a.abbr.acronym.audio.b.bdi.bdo.big.br.button.canvas.cite.code.data.datalist.del.dfn.em.embed.i.iframe.img.ins.kbd.label.map.mark.meter.noscript.object.output.picture.progress.q.ruby.s.samp.select.slot.small.strong.sub.sup.svg.template.textarea.time.u.tt.var.video.wbr.input.span".split(".")), et = {
168
+ clientX: 0,
169
+ clientY: 0,
170
+ pageX: 0,
171
+ pageY: 0,
172
+ topClientX: 0,
173
+ topClientY: 0,
174
+ topPageX: 0,
175
+ topPageY: 0
176
+ };
177
+ function tt(e, t) {
178
+ return e + parseFloat(t.marginLeft) + parseFloat(t.marginRight) + parseFloat(t.paddingLeft) + parseFloat(t.paddingRight) + parseFloat(t.borderLeftWidth) + parseFloat(t.borderRightWidth);
179
+ }
180
+ function nt(e) {
181
+ if (!e) return !1;
182
+ let t = e.parentElement;
183
+ if (!t) return !1;
184
+ let n = e.tagName.toLowerCase(), r = t.tagName, i = getComputedStyle(e), a = getComputedStyle(t), o = () => {
185
+ let n = e.getBoundingClientRect().width, r = tt(n, i), a = t.getBoundingClientRect().width;
186
+ return r.toFixed(0) < a.toFixed(0);
187
+ };
188
+ return (n === "th" || n === "td") && r === "tr" || a.display === "flex" && a.flexDirection === "row" || a.display === "grid" && o() ? !0 : $e.has(n) ? i.display !== "block" || !(i.float !== "left" && i.float !== "right" || !o()) : i.display.startsWith("inline");
189
+ }
190
+ function H(e, t) {
191
+ let n = e.getBoundingClientRect(), r = t.getBoundingClientRect();
192
+ return {
193
+ height: r.height - 2,
194
+ width: r.width - 2,
195
+ top: r.top - n.top + e.scrollTop + 1,
196
+ left: r.left - n.left + e.scrollLeft + 1,
197
+ isTop: r.top - n.top < 28,
198
+ isBottom: n.top + n.height - r.top - r.height < 28
199
+ };
200
+ }
201
+ function rt(e, t) {
202
+ let n = t.getBoundingClientRect(), r = e.clientY - n.top, i = e.clientY - n.top - n.height, a = e.clientX - n.left, o = e.clientX - n.left - n.width, s = Math.abs(r), c = Math.abs(i), l = Math.abs(a), u = Math.abs(o), d = r >= 0 && i <= 0, f = a >= 0 && o <= 0, p = d && f && n.width > 0 && n.height > 0, m;
203
+ p || (r <= 0 ? m = R.top : i >= 0 ? m = R.bottom : a <= 0 ? m = R.left : o >= 0 && (m = R.right));
204
+ let h = [
205
+ {
206
+ direction: R.top,
207
+ value: s
208
+ },
209
+ {
210
+ direction: R.bottom,
211
+ value: c
212
+ },
213
+ {
214
+ direction: R.left,
215
+ value: l
216
+ },
217
+ {
218
+ direction: R.right,
219
+ value: u
220
+ }
221
+ ];
222
+ m ||= P.minBy(h, (e) => e.value).direction;
223
+ let g = nt(t), _ = !g;
224
+ if (g && [R.top, R.bottom].includes(m) && (m = l >= u ? R.right : R.left), _ && [R.left, R.right].includes(m) && (m = s >= c ? R.bottom : R.top), p) {
225
+ let e = P.minBy(h, (e) => e.value);
226
+ e.value <= 10 && (m = e.direction);
227
+ }
228
+ let v = Math.abs(U(e.clientX, e.clientY, n.left, n.top)), y = Math.abs(U(e.clientX, e.clientY, n.left, n.top + n.height)), b = Math.abs(U(e.clientX, e.clientY, n.left + n.width, n.top)), x = Math.abs(U(e.clientX, e.clientY, n.left + n.width, n.top + n.height)), { point: S } = P.minBy([
229
+ {
230
+ point: z.leftTop,
231
+ value: v
232
+ },
233
+ {
234
+ point: z.leftBottom,
235
+ value: y
236
+ },
237
+ {
238
+ point: z.rightTop,
239
+ value: b
240
+ },
241
+ {
242
+ point: z.rightBottom,
243
+ value: x
244
+ }
245
+ ], (e) => e.value);
246
+ return {
247
+ element: t,
248
+ width: n.width,
249
+ height: n.height,
250
+ top: s,
251
+ bottom: c,
252
+ left: l,
253
+ right: u,
254
+ vInside: d,
255
+ hInside: f,
256
+ bothInside: p,
257
+ direction: m,
258
+ leftTop: v,
259
+ leftBottom: y,
260
+ rightTop: b,
261
+ rightBottom: x,
262
+ point: S,
263
+ rowBlock: _,
264
+ inlineBlock: g
265
+ };
266
+ }
267
+ function U(e, t, n = 0, r = 0) {
268
+ return n ??= 0, r ??= 0, Math.sqrt((e - n) ** 2 + (t - r) ** 2);
269
+ }
270
+ function it(e, n) {
271
+ let r = {};
272
+ for (let i in e) r[i] = t.isValidNumber(e[i]) && t.isValidNumber(n?.[i]) ? e[i] - n[i] : e[i];
273
+ return r;
274
+ }
275
+ //#endregion
276
+ //#region src/models/Cursor.ts
277
+ var at = class {
278
+ _status = w(L.Normal);
279
+ _position = w({ ...et });
280
+ _dragStartPosition = w();
281
+ _dragEndPosition = w();
282
+ _dragAtomDelta = w({ ...et });
283
+ _dragStartToCurrentDelta = a(() => !this._dragStartPosition.value || this._status.value === L.Dragging ? et : it(this._position.value, this._dragStartPosition.value));
284
+ _dragStartToEndDelta = a(() => !this._dragStartPosition.value || !this._dragEndPosition.value ? et : it(this._dragStartPosition.value, this._dragEndPosition.value));
285
+ get status() {
286
+ return this._status.value;
287
+ }
288
+ set status(e) {
289
+ this._status.value = e;
290
+ }
291
+ get position() {
292
+ return this._position.value;
293
+ }
294
+ set position(e) {
295
+ this._dragAtomDelta.value = it(this._position.value, e), this._position.value = { ...e };
296
+ }
297
+ get dragStartPosition() {
298
+ return this._dragStartPosition.value;
299
+ }
300
+ set dragStartPosition(e) {
301
+ this._dragStartPosition.value = e ? { ...e } : void 0;
302
+ }
303
+ get dragEndPosition() {
304
+ return this._dragEndPosition.value;
305
+ }
306
+ set dragEndPosition(e) {
307
+ this._dragEndPosition.value = e ? { ...e } : void 0;
308
+ }
309
+ get dragAtomDelta() {
310
+ return this._dragAtomDelta.value;
311
+ }
312
+ get dragStartToCurrentDelta() {
313
+ return this._dragStartToCurrentDelta.value;
314
+ }
315
+ get dragStartToEndDelta() {
316
+ return this._dragStartToEndDelta.value;
317
+ }
318
+ isDragging() {
319
+ return this._status.value === L.Dragging;
320
+ }
321
+ }, ot = class {
322
+ _nodeIds = E([]);
323
+ _positions = E([]);
324
+ _cmpMetas = E([]);
325
+ _existsCmpMeta = a(() => this._cmpMetas.value.length > 0);
326
+ _onlyOne = a(() => this._cmpMetas.value.length === 1);
327
+ _insertion = E();
328
+ get nodeIds() {
329
+ return this._nodeIds.value;
330
+ }
331
+ set nodeIds(e) {
332
+ this._nodeIds.value = e;
333
+ }
334
+ get positions() {
335
+ return this._positions.value;
336
+ }
337
+ set positions(e) {
338
+ this._positions.value = e;
339
+ }
340
+ get cmpMetas() {
341
+ return this._cmpMetas.value;
342
+ }
343
+ set cmpMetas(e) {
344
+ this._cmpMetas.value = e;
345
+ }
346
+ get existsCmpMeta() {
347
+ return this._existsCmpMeta.value;
348
+ }
349
+ get onlyOne() {
350
+ return this._onlyOne.value;
351
+ }
352
+ get insertion() {
353
+ return this._insertion.value;
354
+ }
355
+ set insertion(e) {
356
+ this._insertion.value = e;
357
+ }
358
+ clear() {
359
+ this._cmpMetas.value = [], this._nodeIds.value = [], this._positions.value = [], this._insertion.value = void 0;
360
+ }
361
+ }, st = class {
362
+ _distance = E();
363
+ _position = E();
364
+ _containerId = w();
365
+ _slotName = w();
366
+ _nodeId = w();
367
+ _placeholder = w();
368
+ _allowDrag = w(!1);
369
+ get distance() {
370
+ return this._distance.value;
371
+ }
372
+ set distance(e) {
373
+ this._distance.value = e;
374
+ }
375
+ get position() {
376
+ return this._position.value;
377
+ }
378
+ set position(e) {
379
+ this._position.value = e;
380
+ }
381
+ get containerId() {
382
+ return this._containerId.value;
383
+ }
384
+ set containerId(e) {
385
+ this._containerId.value = e;
386
+ }
387
+ get slotName() {
388
+ return this._slotName.value;
389
+ }
390
+ set slotName(e) {
391
+ this._slotName.value = e;
392
+ }
393
+ get nodeId() {
394
+ return this._nodeId.value;
395
+ }
396
+ set nodeId(e) {
397
+ this._nodeId.value = e;
398
+ }
399
+ get placeholder() {
400
+ return this._placeholder.value;
401
+ }
402
+ set placeholder(e) {
403
+ this._placeholder.value = e;
404
+ }
405
+ get allowDrag() {
406
+ return this._allowDrag.value;
407
+ }
408
+ set allowDrag(e) {
409
+ this._allowDrag.value = e;
410
+ }
411
+ get direction() {
412
+ return this._distance.value?.direction;
413
+ }
414
+ isBefore() {
415
+ let e = this._distance.value?.direction;
416
+ return e ? [R.top, R.left].includes(e) : !1;
417
+ }
418
+ isHorizontal() {
419
+ let e = this._distance.value?.direction;
420
+ return e ? [R.left, R.right].includes(e) : !1;
421
+ }
422
+ isEmpty() {
423
+ return t.noValue(this._distance.value?.direction);
424
+ }
425
+ getInsertionData() {
426
+ if (!this.isEmpty()) return {
427
+ distance: this.distance,
428
+ position: this.position,
429
+ containerId: this.containerId,
430
+ slotName: this.slotName,
431
+ nodeId: this.nodeId,
432
+ placeholder: this.placeholder,
433
+ allowDrag: this.allowDrag,
434
+ before: this.isBefore()
435
+ };
436
+ }
437
+ clear() {
438
+ this._distance.value = void 0, this._position.value = void 0, this._containerId.value = void 0, this._slotName.value = void 0, this._nodeId.value = void 0, this._placeholder.value = void 0, this._allowDrag.value = !1;
439
+ }
440
+ };
441
+ //#endregion
442
+ //#region src/utils/ComponentMetaUtils.ts
443
+ function ct(e) {
444
+ if (!e) return !1;
445
+ for (let t in e) if (e[t]) return !0;
446
+ return !1;
447
+ }
448
+ //#endregion
449
+ //#region src/models/HoverDashed.ts
450
+ var lt = class {
451
+ designerState;
452
+ _componentMeta = E();
453
+ _parentId = w();
454
+ _nodeId = w();
455
+ _position = E();
456
+ constructor(e) {
457
+ this.designerState = e;
458
+ }
459
+ get componentMeta() {
460
+ return this._componentMeta.value;
461
+ }
462
+ set componentMeta(e) {
463
+ this._componentMeta.value = e;
464
+ }
465
+ get parentId() {
466
+ return this._parentId.value;
467
+ }
468
+ set parentId(e) {
469
+ this._parentId.value = e;
470
+ }
471
+ get nodeId() {
472
+ return this._nodeId.value;
473
+ }
474
+ set nodeId(e) {
475
+ this._nodeId.value = e;
476
+ }
477
+ get position() {
478
+ return this._position.value;
479
+ }
480
+ set position(e) {
481
+ this._position.value = e;
482
+ }
483
+ get isContainer() {
484
+ let e = this._componentMeta.value;
485
+ return e ? ct(e.placeholder) : !1;
486
+ }
487
+ recalcPosition() {
488
+ if (!this._nodeId.value) return;
489
+ let e = this.designerState.designerContainer;
490
+ if (!e) return;
491
+ let t = e.querySelector(`[${M.nodeId}=${this._nodeId.value}]`);
492
+ t ? this._position.value = H(e, t) : this._position.value = void 0;
493
+ }
494
+ clear() {
495
+ this._componentMeta.value = void 0, this._parentId.value = void 0, this._nodeId.value = void 0, this._position.value = void 0;
496
+ }
497
+ }, ut = class extends lt {}, dt = 100, ft = 1e3, pt = class {
498
+ designerState;
499
+ undoStack = te([]);
500
+ redoStack = te([]);
501
+ lastExecuteTime = 0;
502
+ constructor(e) {
503
+ this.designerState = e;
504
+ }
505
+ get canUndo() {
506
+ return this.undoStack.length > 0;
507
+ }
508
+ get canRedo() {
509
+ return this.redoStack.length > 0;
510
+ }
511
+ get size() {
512
+ return this.undoStack.length;
513
+ }
514
+ execute(e) {
515
+ if (!e.execute()) return !1;
516
+ let t = this.undoStack[this.undoStack.length - 1];
517
+ return t?.tryMerge && Date.now() - this.lastExecuteTime <= ft && t.tryMerge(e) ? (this.redoStack.length = 0, this.lastExecuteTime = Date.now(), this.dispatchCommandEvent("execute", e), this.notifyPanelUpdate(), !0) : (this.undoStack.push(e), this.redoStack.length = 0, this.undoStack.length > dt && this.undoStack.splice(0, this.undoStack.length - dt), this.lastExecuteTime = Date.now(), this.dispatchCommandEvent("execute", e), this.notifyPanelUpdate(), !0);
518
+ }
519
+ undo() {
520
+ let e = this.undoStack[this.undoStack.length - 1];
521
+ if (e && e.undo()) return this.undoStack.pop(), this.redoStack.push(e), this.dispatchCommandEvent("undo", e), this.notifyPanelUpdate(), e;
522
+ }
523
+ redo() {
524
+ let e = this.redoStack[this.redoStack.length - 1];
525
+ if (e && e.redo()) return this.redoStack.pop(), this.undoStack.push(e), this.dispatchCommandEvent("redo", e), this.notifyPanelUpdate(), e;
526
+ }
527
+ notifyPanelUpdate() {
528
+ this.designerState.setterShareState.notifyPanelUpdate();
529
+ }
530
+ clear() {
531
+ this.undoStack.length = 0, this.redoStack.length = 0;
532
+ }
533
+ dispatchCommandEvent(e, t) {
534
+ this.designerState.designerEngine.eventbus.dispatch(new Je({
535
+ type: e,
536
+ name: t.name,
537
+ path: this.designerState.designerEngine.activeDesignerPath
538
+ }));
539
+ }
540
+ }, mt = class {
541
+ designerState;
542
+ _expandGroups = w({});
543
+ _panelVersion = w(0);
544
+ constructor(e) {
545
+ this.designerState = e;
546
+ }
547
+ getAllExpandTitles(e) {
548
+ if (!e) return {};
549
+ let t = {
550
+ props: [],
551
+ style: [
552
+ "布局",
553
+ "间距",
554
+ "尺寸",
555
+ "文本",
556
+ "背景与效果"
557
+ ],
558
+ advanced: []
559
+ };
560
+ return e.setter.props && t.props.push(...((e) => {
561
+ let t = [];
562
+ for (let n of e) n.expand !== !1 && t.push(n.title);
563
+ return t;
564
+ })(e.setter.props.groups)), t;
565
+ }
566
+ get expandGroups() {
567
+ return this._expandGroups.value;
568
+ }
569
+ set expandGroups(e) {
570
+ this._expandGroups.value = e;
571
+ }
572
+ recalcExpandGroups() {
573
+ this._expandGroups.value = this.getAllExpandTitles(this.designerState.selectedComponentMeta);
574
+ }
575
+ get panelVersion() {
576
+ return this._panelVersion.value;
577
+ }
578
+ notifyPanelUpdate() {
579
+ this._panelVersion.value++;
580
+ }
581
+ }, ht = class {
582
+ designerEngine;
583
+ _designerContainer = w();
584
+ _designerBlockInstance = w();
585
+ hover;
586
+ commandStack;
587
+ setterShareState;
588
+ selections = te([]);
589
+ _selection = a(() => this.selections[0]);
590
+ _existsSelection = a(() => this.selections.length > 0);
591
+ _singleSelection = a(() => this.selections.length === 1);
592
+ _selectNodes = a(() => {
593
+ let e = [], t = this.blockInstance;
594
+ if (t) for (let n of this.selections) {
595
+ let r = n.nodeId;
596
+ if (!r) continue;
597
+ let i = t.globalContext.allNode[r];
598
+ i && e.push(h(i));
599
+ }
600
+ return e;
601
+ });
602
+ _selectNode = a(() => {
603
+ let e = this.blockInstance;
604
+ if (!e || this.selections.length <= 0) return;
605
+ let t = this.selections[0].nodeId;
606
+ if (t) return e.globalContext.allNode[t];
607
+ });
608
+ _selectedComponentMeta = a(() => this.getCurrentComponentMeta());
609
+ constructor(e) {
610
+ this.designerEngine = e, this.hover = new lt(this), this.commandStack = new pt(this), this.setterShareState = new mt(this);
611
+ }
612
+ getCurrentComponentMeta() {
613
+ if (this.selections.length <= 0) return;
614
+ if (this.selections.length === 1) return this.selections[0].componentMeta;
615
+ let e, t = /* @__PURE__ */ new Set();
616
+ for (let n of this.selections) if (n.componentMeta && (e = n.componentMeta, t.add(e.type), t.size > 1)) return;
617
+ return e;
618
+ }
619
+ get designerContainer() {
620
+ return this._designerContainer?.value;
621
+ }
622
+ set designerContainer(e) {
623
+ this._designerContainer.value = e;
624
+ }
625
+ get designerBlockInstance() {
626
+ return this._designerBlockInstance?.value;
627
+ }
628
+ set designerBlockInstance(e) {
629
+ this._designerBlockInstance.value = e;
630
+ }
631
+ get blockInstance() {
632
+ return this._designerBlockInstance?.value;
633
+ }
634
+ get selection() {
635
+ return this._selection.value;
636
+ }
637
+ get existsSelection() {
638
+ return this._existsSelection.value;
639
+ }
640
+ get singleSelection() {
641
+ return this._singleSelection.value;
642
+ }
643
+ get selectNodes() {
644
+ return this._selectNodes.value;
645
+ }
646
+ get selectNode() {
647
+ return this._selectNode.value;
648
+ }
649
+ get selectedComponentMeta() {
650
+ return this._selectedComponentMeta.value;
651
+ }
652
+ clearSelections() {
653
+ this.selections.length = 0;
654
+ }
655
+ selectNodeByIds(e) {
656
+ _(() => {
657
+ let t = this.blockInstance;
658
+ if (t) {
659
+ this.selections.length = 0;
660
+ for (let n of e) {
661
+ let e = t.globalContext.allNode[n];
662
+ if (!e) continue;
663
+ let r = new ut(this);
664
+ r.nodeId = e.id, r.parentId = t.globalContext.nodeParent[n]?.id, r.componentMeta = this.designerEngine.componentManage.getComponentMeta(e.type);
665
+ let i = this.designerContainer, a = i?.querySelector(`[${M.nodeId}=${n}]`);
666
+ i && a && (r.position = H(i, a)), this.selections.push(r);
667
+ }
668
+ }
669
+ });
670
+ }
671
+ }, gt = {
672
+ componentManage: new ae(),
673
+ drivers: [],
674
+ effects: [],
675
+ designerContent: ".designer-content"
676
+ }, _t = class {
677
+ eventbus = new Ye();
678
+ props;
679
+ drivers = [];
680
+ effects = [];
681
+ cursor = new at();
682
+ draggingCmpMetas = new ot();
683
+ insertion = new st();
684
+ allDesignerState = te({});
685
+ _activeDesignerPath = w();
686
+ _onlyPressedCtrl = w(!1);
687
+ _onlyPressedShift = w(!1);
688
+ mounted = !1;
689
+ constructor(e = {}) {
690
+ this.props = {
691
+ ...gt,
692
+ ...e
693
+ };
694
+ }
695
+ get componentManage() {
696
+ return this.props.componentManage;
697
+ }
698
+ get isMounted() {
699
+ return this.mounted;
700
+ }
701
+ get activeDesignerPath() {
702
+ return this._activeDesignerPath.value;
703
+ }
704
+ set activeDesignerPath(e) {
705
+ e && !this.allDesignerState[e] && (e = void 0), this._activeDesignerPath.value = e;
706
+ }
707
+ get activeDesignerState() {
708
+ let e = this.activeDesignerPath;
709
+ if (e) return this.allDesignerState[e];
710
+ }
711
+ addDesignerState(e) {
712
+ let t = this.allDesignerState[e];
713
+ return t || (t = new ht(this), this.allDesignerState[e] = t), t;
714
+ }
715
+ delDesignerState(e) {
716
+ let t = this.allDesignerState[e];
717
+ return delete this.allDesignerState[e], this.activeDesignerPath === e && (this.activeDesignerPath = void 0), t;
718
+ }
719
+ get onlyPressedCtrl() {
720
+ return this._onlyPressedCtrl.value;
721
+ }
722
+ set onlyPressedCtrl(e) {
723
+ this._onlyPressedCtrl.value = e;
724
+ }
725
+ get onlyPressedShift() {
726
+ return this._onlyPressedShift.value;
727
+ }
728
+ set onlyPressedShift(e) {
729
+ this._onlyPressedShift.value = e;
730
+ }
731
+ mount(e = document, t = globalThis) {
732
+ this.unmount();
733
+ let n = this.props.drivers.map((n) => new n(this, e, t)), r = this.props.effects.map((n) => new n(this, e, t));
734
+ this.drivers.push(...n), this.effects.push(...r), this.effects.forEach((e) => e.effect()), this.drivers.forEach((e) => e.attach()), this.mounted = !0;
735
+ let i = {
736
+ container: e,
737
+ window: t,
738
+ timestamp: Date.now()
739
+ };
740
+ this.eventbus.dispatch(new Le(i));
741
+ }
742
+ unmount() {
743
+ if (!this.mounted) return;
744
+ let e = { timestamp: Date.now() };
745
+ this.eventbus.dispatch(new Re(e)), this.drivers.forEach((e) => e.detach()), this.effects.forEach((e) => e.destroy()), this.eventbus.clearAllSubscribe(), this.drivers.length = 0, this.effects.length = 0, this.mounted = !1;
746
+ }
747
+ }, vt = class extends Ze {
748
+ dragState = this.initDragState();
749
+ componentMetas = /* @__PURE__ */ new Map();
750
+ initDragState() {
751
+ return {
752
+ dragging: !1,
753
+ startDragTime: void 0,
754
+ startEvent: void 0,
755
+ moveEvent: void 0
756
+ };
757
+ }
758
+ attach() {
759
+ this.addEventListener("mousedown", this.onMouseDown, !0);
760
+ }
761
+ detach() {
762
+ this.removeEventListener("mousedown", this.onMouseDown, !0), this.removeEventListener("mouseup", this.onMouseUp), this.removeEventListener("mousemove", this.onMouseMove), this.removeEventListener("mousemove", this.onDistanceChange), this.removeEventListener("dragstart", this.onStartDrag), this.removeEventListener("dragend", this.onMouseUp), this.removeEventListener("dragover", this.onMouseMove), this.removeEventListener("contextmenu", this.preventDefault, !0), this.dragState.dragging = !1, this.componentMetas.clear();
763
+ }
764
+ onMouseDown = (e) => {
765
+ if (e.button !== 0 || e.ctrlKey || e.metaKey) return;
766
+ let t = e.target;
767
+ if (!t?.closest) return;
768
+ this.componentMetas.clear();
769
+ let n = t.closest(de), r = N.componentMeta(n, this.componentManage);
770
+ if (r) this.componentMetas.set(le, r);
771
+ else {
772
+ let e = t.closest(`[${M.componentType}]`);
773
+ e && e.parentElement && N.placeholderName(e) && (e = e.parentElement.closest(`[${M.componentType}]`));
774
+ let n = N.nodeId(e), r = N.componentMeta(e, this.componentManage);
775
+ if (n && r) {
776
+ let e = this.designerEngine.activeDesignerState?.selections;
777
+ e && e.some((e) => n === e.nodeId) ? e.forEach((e) => {
778
+ e.nodeId && e.componentMeta && this.componentMetas.set(e.nodeId, e.componentMeta);
779
+ }) : this.componentMetas.set(n, r);
780
+ }
781
+ }
782
+ this.componentMetas.size <= 0 || (this.dragState.startEvent = e, this.dragState.dragging = !1, this.dragState.startDragTime = Date.now(), this.removeEventListener("mouseup", this.onMouseUp), this.addEventListener("mouseup", this.onMouseUp), this.removeEventListener("mousemove", this.onDistanceChange), this.addEventListener("mousemove", this.onDistanceChange), this.removeEventListener("dragend", this.onMouseUp), this.addEventListener("dragend", this.onMouseUp), this.removeEventListener("dragstart", this.onStartDrag), this.addEventListener("dragstart", this.onStartDrag));
783
+ };
784
+ onMouseUp = (e) => {
785
+ this.dragState.dragging && this.eventbus.dispatch(new He(e)), this.removeEventListener("mouseup", this.onMouseUp), this.removeEventListener("mousemove", this.onMouseMove), this.removeEventListener("mousemove", this.onDistanceChange), this.removeEventListener("dragover", this.onMouseMove), this.removeEventListener("dragend", this.onMouseUp), this.removeEventListener("dragstart", this.onStartDrag), this.removeEventListener("contextmenu", this.preventDefault, !0), this.dragState.dragging = !1;
786
+ };
787
+ onDistanceChange = (e) => {
788
+ let n = this.dragState.startDragTime, r = this.dragState.startEvent;
789
+ if (t.noValue(n) || t.noValue(r)) return;
790
+ let i = U(e.pageX, e.pageY, r.pageX, r.pageY), a = Date.now() - n;
791
+ e !== r && a > 10 && i > 4 && (this.removeEventListener("mousemove", this.onDistanceChange), this.onStartDrag(e));
792
+ };
793
+ onStartDrag = (e) => {
794
+ this.dragState.dragging || (this.dragState.startEvent = this.dragState.startEvent || e, this.removeEventListener("contextmenu", this.preventDefault, !0), this.addEventListener("contextmenu", this.preventDefault, !0), this.removeEventListener("mousemove", this.onMouseMove), this.addEventListener("mousemove", this.onMouseMove), this.removeEventListener("dragover", this.onMouseMove), this.addEventListener("dragover", this.onMouseMove), this.eventbus.dispatch(new Be(this.dragState.startEvent, this.componentMetas)), this.dragState.dragging = !0);
795
+ };
796
+ onMouseMove = (e) => {
797
+ (e.clientX !== this.dragState.moveEvent?.clientX || e.clientY !== this.dragState.moveEvent?.clientY) && (this.eventbus.dispatch(new Ve(e)), this.dragState.moveEvent = e);
798
+ };
799
+ }, yt = class extends Ze {
800
+ pressedKeys = /* @__PURE__ */ new Set();
801
+ attach() {
802
+ this.addEventListener("keydown", this.onKeyEvent), this.addEventListener("keyup", this.onKeyEvent), this.window.addEventListener("blur", this.onBlur);
803
+ }
804
+ detach() {
805
+ this.removeEventListener("keydown", this.onKeyEvent), this.removeEventListener("keyup", this.onKeyEvent), this.window.removeEventListener("blur", this.onBlur), this.resetKeyState();
806
+ }
807
+ onBlur = () => {
808
+ this.resetKeyState();
809
+ };
810
+ resetKeyState() {
811
+ this.pressedKeys.clear(), this.designerEngine.onlyPressedCtrl = !1, this.designerEngine.onlyPressedShift = !1;
812
+ }
813
+ onKeyEvent = (e) => {
814
+ let t = e.key.toLowerCase();
815
+ e.type === "keydown" ? this.pressedKeys.add(t) : this.pressedKeys.delete(t), this.designerEngine.onlyPressedCtrl = this.pressedKeys.size === 1 && this.pressedKeys.has("control"), this.designerEngine.onlyPressedShift = this.pressedKeys.size === 1 && this.pressedKeys.has("shift"), this.eventbus.dispatch(new Ke(e, this.pressedKeys));
816
+ };
817
+ }, bt = class extends Ze {
818
+ attach() {
819
+ this.addEventListener("click", this.onMouseClick), this.addEventListener("dblclick", this.onMouseDoubleClick);
820
+ }
821
+ detach() {
822
+ this.removeEventListener("click", this.onMouseClick), this.removeEventListener("dblclick", this.onMouseDoubleClick);
823
+ }
824
+ onMouseClick = (e) => {
825
+ let t = e.target;
826
+ t?.closest && t.closest(this.designerEngine.props.designerContent) && this.eventbus.dispatch(new Ue(e));
827
+ };
828
+ onMouseDoubleClick = (e) => {
829
+ let t = e.target;
830
+ t?.closest && t.closest(this.designerEngine.props.designerContent) && this.eventbus.dispatch(new We(e));
831
+ };
832
+ }, xt = class extends Ze {
833
+ request = void 0;
834
+ attach() {
835
+ this.addEventListener("mousemove", this.onMouseMove);
836
+ }
837
+ detach() {
838
+ this.removeEventListener("mousemove", this.onMouseMove), this.cancelRequest();
839
+ }
840
+ onMouseMove = (e) => {
841
+ this.cancelRequest(), this.request = requestAnimationFrame(() => {
842
+ this.request = void 0, this.eventbus.dispatch(new Ge(e));
843
+ });
844
+ };
845
+ cancelRequest() {
846
+ this.request !== void 0 && (cancelAnimationFrame(this.request), this.request = void 0);
847
+ }
848
+ }, St = class extends Qe {
849
+ originalCursor = "";
850
+ unsubscribes = [];
851
+ onEffect() {
852
+ this.dragDropCursor(), this.mouseMoveCursor();
853
+ }
854
+ onDestroy() {
855
+ this.unsubscribes.forEach((e) => e()), this.unsubscribes.length = 0, this.originalCursor &&= (this.setContainerCursorStyle(this.originalCursor), "");
856
+ }
857
+ toCursorPosition(e) {
858
+ return {
859
+ clientX: e?.clientX ?? 0,
860
+ clientY: e?.clientY ?? 0,
861
+ pageX: e?.pageX ?? 0,
862
+ pageY: e?.pageY ?? 0,
863
+ topClientX: e?.topClientX ?? 0,
864
+ topClientY: e?.topClientY ?? 0,
865
+ topPageX: e?.topPageX ?? 0,
866
+ topPageY: e?.topPageY ?? 0
867
+ };
868
+ }
869
+ dragDropCursor() {
870
+ this.unsubscribes.push(this.eventbus.subscribe(Be, (e) => {
871
+ this.originalCursor = this.getContainerCursorStyle();
872
+ let t = this.designerEngine.cursor;
873
+ t.status = L.DragStart, t.dragStartPosition = this.toCursorPosition(e.data);
874
+ }), this.eventbus.subscribe(Ve, (t) => {
875
+ let n = this.designerEngine.cursor;
876
+ n.status = L.Dragging, n.position = this.toCursorPosition(t.data), e.requestIdle(() => {
877
+ this.setContainerCursorStyle("move");
878
+ });
879
+ }), this.eventbus.subscribe(He, (t) => {
880
+ let n = this.designerEngine.cursor;
881
+ n.status = L.DragStop, n.dragEndPosition = this.toCursorPosition(t.data), n.dragStartPosition = void 0, n.status = L.Normal, e.requestIdle(() => this.setContainerCursorStyle(this.originalCursor));
882
+ }));
883
+ }
884
+ mouseMoveCursor() {
885
+ this.unsubscribes.push(this.eventbus.subscribe(Ge, (e) => {
886
+ let t = this.designerEngine.cursor;
887
+ [L.Dragging, L.DragStart].includes(t.status) || (t.status = L.Normal), t.status !== L.Dragging && (t.position = this.toCursorPosition(e.data));
888
+ }));
889
+ }
890
+ }, Ct = class extends Qe {
891
+ unsubscribes = [];
892
+ onEffect() {
893
+ this.draggingCmpMetasEffect();
894
+ }
895
+ onDestroy() {
896
+ this.unsubscribes.forEach((e) => e()), this.unsubscribes.length = 0, this.designerEngine.draggingCmpMetas.clear();
897
+ }
898
+ draggingCmpMetasEffect() {
899
+ this.unsubscribes.push(this.eventbus.subscribe(Be, (e) => {
900
+ let t = e.data?.componentMetas;
901
+ if (!t || t.size <= 0) return;
902
+ let n = this.designerEngine.draggingCmpMetas, r = [], i = [], a = [], o = this.designerEngine.activeDesignerState?.designerContainer;
903
+ t.forEach((e, t) => {
904
+ if (r.push(e), i.push(t), o) {
905
+ let e = o.querySelector(`[${M.nodeId}=${t}]`);
906
+ e && a.push(H(o, e));
907
+ }
908
+ }), n.cmpMetas = r, n.nodeIds = i, n.positions = a;
909
+ }, 100), this.eventbus.subscribe(He, (e) => {
910
+ let t = this.designerEngine.draggingCmpMetas;
911
+ t.existsCmpMeta && (this.eventbus.dispatch(new qe({
912
+ componentMetas: [...t.cmpMetas],
913
+ nodeIds: [...t.nodeIds],
914
+ cursor: e.data,
915
+ insertion: t.insertion
916
+ })), t.clear());
917
+ }, 100));
918
+ }
919
+ };
920
+ //#endregion
921
+ //#region src/utils/DesignerUtils.ts
922
+ function wt(e, n, r, i) {
923
+ if (!e.dragDropConfig) return !0;
924
+ let a = n.type, { whiteList: o, blacklist: s, isAllow: c } = e.dragDropConfig;
925
+ return !(t.hasValue(o) && !o.includes(a) || t.hasValue(s) && s.includes(a) || t.isFunction(c) && !c(e, n, r, i));
926
+ }
927
+ //#endregion
928
+ //#region src/effects/AuxToolEffect.ts
929
+ var Tt = class extends Qe {
930
+ minHoverChangeTime = 50;
931
+ lastEventTarget;
932
+ lastMouseMoveTime = 0;
933
+ lastDragStopEventTime = 0;
934
+ unsubscribes = [];
935
+ onEffect() {
936
+ this.hoverDashedEffect(), this.selectionEffect(), this.insertionEffect();
937
+ }
938
+ onDestroy() {
939
+ this.unsubscribes.forEach((e) => e()), this.unsubscribes.length = 0, this.lastEventTarget = void 0;
940
+ }
941
+ getNodeAndDesigner(e, t) {
942
+ if (!t?.closest) return;
943
+ let n = e.designerContainer;
944
+ if (n ||= t.closest(this.designerEngine.props.designerContent), !n) return;
945
+ let r = t.closest(`[${M.nodeRef}]:not([${M.placeholderName}])`);
946
+ if (r) return {
947
+ node: r,
948
+ designer: n
949
+ };
950
+ }
951
+ getVerticalDistance(e) {
952
+ return e.vInside ? -1 : Math.min(e.top, e.bottom);
953
+ }
954
+ getHorizontalDistance(e) {
955
+ return e.hInside ? -1 : Math.min(e.left, e.right);
956
+ }
957
+ setInsertion(e, t, n, r = "") {
958
+ let i = e.designerContainer ?? null;
959
+ if (i ||= n.element.closest(this.designerEngine.props.designerContent), !i) return;
960
+ this.designerEngine.insertion.clear();
961
+ let a = P.trim(r).length > 0, o, s;
962
+ if (a ? (o = t, s = r) : (o = N.nodeId(n.element), s = N.slotName(n.element)), this.nodeIsSelfOrInside(o, this.designerEngine.draggingCmpMetas.nodeIds)) return;
963
+ let c = n.element.closest(`[${M.nodeId}=${t}]`);
964
+ if (!c) return;
965
+ let l = N.componentMeta(c, this.componentManage);
966
+ l && (this.designerEngine.draggingCmpMetas.cmpMetas.some((e) => !wt(e, l, s, c)) || (this.designerEngine.insertion.allowDrag = !0, this.designerEngine.insertion.distance = n, this.designerEngine.insertion.position = H(i, n.element), this.designerEngine.insertion.nodeId = o, this.designerEngine.insertion.containerId = t, this.designerEngine.insertion.slotName = s, this.designerEngine.insertion.placeholder = a));
967
+ }
968
+ nodeIsSelfOrInside(e, t) {
969
+ if (t.includes(e)) return !0;
970
+ let n = this.designerEngine.activeDesignerState?.blockInstance;
971
+ if (n) {
972
+ let r = /* @__PURE__ */ new Set();
973
+ for (let e of t) {
974
+ let t = n.globalContext.allNode[e];
975
+ t && ce(t, (e) => r.add(e.id));
976
+ }
977
+ return r.has(e);
978
+ }
979
+ return !1;
980
+ }
981
+ hoverDashedEffect() {
982
+ this.unsubscribes.push(this.eventbus.subscribe(Ge, (t) => {
983
+ let n = Date.now();
984
+ if (t.data.target === this.lastEventTarget) {
985
+ this.lastMouseMoveTime = n;
986
+ return;
987
+ }
988
+ n - this.lastMouseMoveTime < this.minHoverChangeTime || (this.lastMouseMoveTime = n, e.requestIdle(() => {
989
+ let e = this.designerEngine.activeDesignerState;
990
+ if (!e) return;
991
+ let n = e.hover, r = t.data.target, i = this.getNodeAndDesigner(e, r);
992
+ if (!i) return;
993
+ let a = N.nodeId(i.node);
994
+ if (e.selections.some((e) => e.nodeId === a)) {
995
+ n.clear();
996
+ return;
997
+ }
998
+ n.componentMeta = N.componentMeta(i.node, this.componentManage), n.nodeId = a, n.position = H(i.designer, i.node), this.lastEventTarget = t.data.target;
999
+ }));
1000
+ }));
1001
+ }
1002
+ selectionEffect() {
1003
+ this.unsubscribes.push(this.eventbus.subscribe(Ue, (e) => {
1004
+ if (Date.now() - this.lastDragStopEventTime <= 30) return;
1005
+ let t = this.designerEngine.activeDesignerState;
1006
+ if (!t) return;
1007
+ let n = e.data.target, r = this.getNodeAndDesigner(t, n);
1008
+ if (!r) return;
1009
+ let i = t.hover, a = t.selections, o = new ut(t);
1010
+ o.nodeId = N.nodeId(r.node), o.parentId = N.nodeParentId(r.node), !a.some((e) => e.nodeId === o.nodeId) && (o.componentMeta = N.componentMeta(r.node, this.componentManage), o.position = H(r.designer, r.node), this.designerEngine.onlyPressedCtrl || (a.length = 0), a.push(o), i.nodeId && a.some((e) => e.nodeId === i.nodeId) && i.clear());
1011
+ }));
1012
+ }
1013
+ insertionEffect() {
1014
+ this.unsubscribes.push(this.eventbus.subscribe(Ve, (t) => {
1015
+ if (!this.designerEngine.draggingCmpMetas.existsCmpMeta) return;
1016
+ let n = t.data.target;
1017
+ n && e.requestIdle(() => {
1018
+ if (!n?.closest || !n.closest(this.designerEngine.props.designerContent)) {
1019
+ this.designerEngine.insertion.clear();
1020
+ return;
1021
+ }
1022
+ let e = this.designerEngine.activeDesignerState;
1023
+ if (!e?.designerContainer) return;
1024
+ let r = e.blockInstance;
1025
+ if (!r) return;
1026
+ let i = N.placeholderName(n);
1027
+ if (i) {
1028
+ let n = rt(t.data, t.data.target), r = N.nodeParentId(n.element);
1029
+ if (r) {
1030
+ this.setInsertion(e, r, n, i);
1031
+ return;
1032
+ }
1033
+ }
1034
+ let a = null, o;
1035
+ for (;;) {
1036
+ if (!n || (a = n.closest(`[${M.nodeId}]`), !a) || (o = N.nodeId(a), !o)) return;
1037
+ let e = r.globalContext.allNode[o];
1038
+ if (!e) return;
1039
+ if (ct(e.designExt?.designPlaceholder)) break;
1040
+ n = n === a ? a.parentElement : a;
1041
+ }
1042
+ if (!a || !o) return;
1043
+ if (a === t.data.target) {
1044
+ let n = rt(t.data, a);
1045
+ if (Math.min(n.top, n.bottom, n.left, n.right) <= 12) {
1046
+ let t = N.nodeParentId(n.element);
1047
+ if (t) {
1048
+ this.setInsertion(e, t, n);
1049
+ return;
1050
+ }
1051
+ }
1052
+ }
1053
+ let s = a.querySelectorAll(`[${M.nodeParentId}=${o}]`), c = [];
1054
+ if (s.forEach((e) => c.push(rt(t.data, e))), c.length <= 0) return;
1055
+ let l = P.min(c.map((e) => this.getVerticalDistance(e))), u = c.filter((e) => this.getVerticalDistance(e) <= l), d = P.min(u.map((e) => this.getHorizontalDistance(e))), f = u.filter((e) => this.getHorizontalDistance(e) <= d), p = P.minBy(f, (e) => e.bothInside ? -1 : e.point === z.leftTop ? e.leftTop : e.point === z.leftBottom ? e.leftBottom : e.point === z.rightTop ? e.rightTop : e.point === z.rightBottom ? e.rightBottom : Number.MAX_VALUE);
1056
+ this.setInsertion(e, o, p);
1057
+ });
1058
+ }), this.eventbus.subscribe(He, () => {
1059
+ this.lastDragStopEventTime = Date.now();
1060
+ let t = this.designerEngine.insertion, n = this.designerEngine.draggingCmpMetas;
1061
+ n.insertion = t.getInsertionData(), e.requestIdle(() => t.clear());
1062
+ }));
1063
+ }
1064
+ };
1065
+ //#endregion
1066
+ //#region src/operations/NodePosition.ts
1067
+ function Et(e, n) {
1068
+ if (!e.globalContext.allNode[n]) return;
1069
+ let r = e.globalContext.nodeParent[n];
1070
+ if (!r) return;
1071
+ let i = (e, i) => {
1072
+ let a = e.findIndex((e) => t.isObj(e) && !t.isArray(e) && e.id === n);
1073
+ if (!(a < 0)) {
1074
+ if (a > 0) {
1075
+ let n = e[a - 1];
1076
+ if (t.isObj(n) && !t.isArray(n)) return {
1077
+ parentId: r.id,
1078
+ slotName: i,
1079
+ position: "after",
1080
+ positionId: n.id
1081
+ };
1082
+ }
1083
+ return {
1084
+ parentId: r.id,
1085
+ slotName: i,
1086
+ position: "first"
1087
+ };
1088
+ }
1089
+ }, a = i(r.items, oe);
1090
+ if (a) return a;
1091
+ for (let e in r.slots) {
1092
+ let t = i(r.slots[e], e);
1093
+ if (t) return t;
1094
+ }
1095
+ }
1096
+ function Dt(e, n) {
1097
+ if (!e.globalContext.allNode[n]) return -1;
1098
+ let r = e.globalContext.nodeParent[n];
1099
+ if (!r) return -1;
1100
+ let i = (e) => e.findIndex((e) => t.isObj(e) && !t.isArray(e) && e.id === n), a = i(r.items);
1101
+ if (a >= 0) return a;
1102
+ for (let e in r.slots) {
1103
+ let t = i(r.slots[e]);
1104
+ if (t >= 0) return t;
1105
+ }
1106
+ return -1;
1107
+ }
1108
+ function Ot(e, t) {
1109
+ let { allNode: n } = e.globalContext;
1110
+ return n[t.parentId] ? (t.position === "before" || t.position === "after") && t.positionId && !n[t.positionId] ? {
1111
+ parentId: t.parentId,
1112
+ slotName: t.slotName,
1113
+ position: "last"
1114
+ } : t : null;
1115
+ }
1116
+ function kt(e, t, n) {
1117
+ let r = Ot(e, t);
1118
+ if (!r) return !1;
1119
+ let i = e.opsById;
1120
+ if (n.filter((t) => e.globalContext.allNode[t]).length <= 0) return !1;
1121
+ if (t = r, t.slotName === oe) switch (t.position) {
1122
+ case "before": return t.positionId ? i.moveNodesToItemBeforeById(t.positionId, n) : !1;
1123
+ case "after": return t.positionId ? i.moveNodesToItemAfterById(t.positionId, n) : !1;
1124
+ case "first": return i.moveNodesToItemFirstById(t.parentId, n);
1125
+ case "last": return i.moveNodesToItemLastById(t.parentId, n);
1126
+ }
1127
+ switch (t.position) {
1128
+ case "before": return t.positionId ? i.moveNodesToSlotBeforeById(t.positionId, t.slotName, n) : !1;
1129
+ case "after": return t.positionId ? i.moveNodesToSlotAfterById(t.positionId, t.slotName, n) : !1;
1130
+ case "first": return i.moveNodesToSlotFirstById(t.parentId, t.slotName, n);
1131
+ case "last": return i.moveNodesToSlotLastById(t.parentId, t.slotName, n);
1132
+ }
1133
+ }
1134
+ function At(e, t, n) {
1135
+ let r = Ot(e, t);
1136
+ if (!r) return [];
1137
+ t = r;
1138
+ let i = e.opsById;
1139
+ if (t.slotName === oe) switch (t.position) {
1140
+ case "before": return t.positionId ? i.beforeAddItemsById(t.positionId, n) : [];
1141
+ case "after": return t.positionId ? i.afterAddItemsById(t.positionId, n) : [];
1142
+ case "first": return i.firstAddItemsById(t.parentId, n);
1143
+ case "last": return i.appendItemsById(t.parentId, n);
1144
+ }
1145
+ switch (t.position) {
1146
+ case "before": return t.positionId ? i.beforeAddSlotsById(t.positionId, t.slotName, n) : [];
1147
+ case "after": return t.positionId ? i.afterAddSlotsById(t.positionId, t.slotName, n) : [];
1148
+ case "first": return i.firstAddSlotsById(t.parentId, t.slotName, n);
1149
+ case "last": return i.appendSlotsById(t.parentId, t.slotName, n);
1150
+ }
1151
+ }
1152
+ function jt(e) {
1153
+ return e.placeholder ? {
1154
+ parentId: e.containerId,
1155
+ slotName: e.slotName,
1156
+ position: "first"
1157
+ } : {
1158
+ parentId: e.containerId,
1159
+ slotName: e.slotName,
1160
+ position: e.before ? "before" : "after",
1161
+ positionId: e.nodeId
1162
+ };
1163
+ }
1164
+ function Mt(e) {
1165
+ return e.filter((e) => t.isObj(e) && !t.isArray(e));
1166
+ }
1167
+ //#endregion
1168
+ //#region src/operations/commands/AddNodesCommand.ts
1169
+ var Nt = class {
1170
+ name;
1171
+ designerState;
1172
+ options;
1173
+ addedNodeIds = [];
1174
+ constructor(e, t, n) {
1175
+ this.designerState = e, this.name = t, this.options = n;
1176
+ }
1177
+ execute() {
1178
+ return this.doAdd();
1179
+ }
1180
+ undo() {
1181
+ if (this.addedNodeIds.length <= 0) return !1;
1182
+ let e = this.designerState.blockInstance;
1183
+ return e ? (e.opsById.removeAllById(this.addedNodeIds), this.addedNodeIds = [], !0) : !1;
1184
+ }
1185
+ redo() {
1186
+ return this.doAdd();
1187
+ }
1188
+ doAdd() {
1189
+ let e = this.designerState.blockInstance;
1190
+ if (!e) return !1;
1191
+ let t = Mt(At(e, this.options.target, this.options.nodes));
1192
+ return t.length <= 0 ? !1 : (this.addedNodeIds = t.map((e) => e.id), this.options.onExecute?.(this.addedNodeIds), !0);
1193
+ }
1194
+ }, Pt = class {
1195
+ name;
1196
+ designerState;
1197
+ options;
1198
+ originPositions = [];
1199
+ constructor(e, t, n) {
1200
+ this.designerState = e, this.name = t, this.options = n;
1201
+ }
1202
+ execute() {
1203
+ return this.doMove();
1204
+ }
1205
+ undo() {
1206
+ if (this.originPositions.length <= 0) return !1;
1207
+ let e = this.designerState.blockInstance;
1208
+ if (!e) return !1;
1209
+ let t = [...this.originPositions].sort((e, t) => e.docIndex - t.docIndex), n = !1;
1210
+ for (let r of t) kt(e, r.target, [r.nodeId]) && (n = !0);
1211
+ return n;
1212
+ }
1213
+ redo() {
1214
+ return this.doMove();
1215
+ }
1216
+ doMove() {
1217
+ let e = this.designerState.blockInstance;
1218
+ if (!e) return !1;
1219
+ let t = this.options.nodeIds.filter((t) => e.globalContext.allNode[t]);
1220
+ if (t.length <= 0) return !1;
1221
+ if (this.originPositions.length <= 0) {
1222
+ for (let n of t) {
1223
+ let t = Et(e, n);
1224
+ t && this.originPositions.push({
1225
+ nodeId: n,
1226
+ target: t,
1227
+ docIndex: Dt(e, n)
1228
+ });
1229
+ }
1230
+ if (this.originPositions.length <= 0) return !1;
1231
+ }
1232
+ let n = kt(e, this.options.target, t);
1233
+ return n && this.options.onExecute?.(), n;
1234
+ }
1235
+ }, Ft = /* @__PURE__ */ new Set([
1236
+ M.componentType,
1237
+ M.nodeId,
1238
+ M.nodeRef,
1239
+ M.nodeParentId,
1240
+ M.placeholderName,
1241
+ M.slotName
1242
+ ]);
1243
+ function It(e) {
1244
+ return P.cloneDeepWith(e, (e) => {
1245
+ if (P.isFunction(e)) return e;
1246
+ });
1247
+ }
1248
+ function Lt(e) {
1249
+ let t = {};
1250
+ for (let n in e) Ft.has(n) || (t[n] = e[n]);
1251
+ return t;
1252
+ }
1253
+ function Rt(e) {
1254
+ return e.filter((e) => P.has(e, "type")).map((e) => P.isString(e) ? e : zt(e));
1255
+ }
1256
+ function zt(e) {
1257
+ let t = {
1258
+ type: e.type,
1259
+ ref: e.ref,
1260
+ props: Lt(e.props)
1261
+ };
1262
+ if (e.listeners && Object.keys(e.listeners).length > 0 && (t.listeners = It(e.listeners)), e.directives && Object.keys(e.directives).length > 0 && (t.directives = P.cloneDeep(e.directives)), e.tpl && e.tpl.length > 0 && (t.tpl = [...e.tpl]), e.items && e.items.length > 0 && (t.items = Rt(e.items)), e.slots && Object.keys(e.slots).length > 0) {
1263
+ let n = {};
1264
+ for (let t in e.slots) {
1265
+ let r = e.slots[t];
1266
+ r && r.length > 0 && (n[t] = Rt(r));
1267
+ }
1268
+ Object.keys(n).length > 0 && (t.slots = n);
1269
+ }
1270
+ let n = e;
1271
+ if (n.block) {
1272
+ t.block = !0;
1273
+ for (let e of [
1274
+ "data",
1275
+ "computed",
1276
+ "watch",
1277
+ "methods",
1278
+ "lifeCycles",
1279
+ "meta",
1280
+ "i18n"
1281
+ ]) {
1282
+ let r = n[e];
1283
+ Bt(r) && (t[e] = It(r));
1284
+ }
1285
+ }
1286
+ return t;
1287
+ }
1288
+ function Bt(e) {
1289
+ return typeof e == "object" && !!e && Object.keys(e).length > 0;
1290
+ }
1291
+ //#endregion
1292
+ //#region src/operations/commands/RemoveNodesCommand.ts
1293
+ var Vt = class {
1294
+ name;
1295
+ designerState;
1296
+ options;
1297
+ removedNodes = [];
1298
+ currentNodeIds = [];
1299
+ constructor(e, t, n) {
1300
+ this.designerState = e, this.name = t, this.options = n;
1301
+ }
1302
+ execute() {
1303
+ return this.doRemove();
1304
+ }
1305
+ undo() {
1306
+ if (this.removedNodes.length <= 0) return !1;
1307
+ let e = this.designerState.blockInstance;
1308
+ if (!e) return !1;
1309
+ let t = [...this.removedNodes].sort((e, t) => e.docIndex - t.docIndex), n = /* @__PURE__ */ new Map(), r = [], i = !1;
1310
+ for (let a of t) {
1311
+ let t = Mt(At(e, this.mapInsertTarget(a.target, n), [a.designNode]));
1312
+ t.length > 0 && (i = !0, n.set(a.oldNodeId, t[0].id), r.push(t[0].id));
1313
+ }
1314
+ return i && (this.currentNodeIds = r), i;
1315
+ }
1316
+ redo() {
1317
+ return this.doRemove();
1318
+ }
1319
+ mapInsertTarget(e, t) {
1320
+ let n = t.get(e.positionId);
1321
+ return e.positionId && n ? {
1322
+ ...e,
1323
+ positionId: n
1324
+ } : e;
1325
+ }
1326
+ doRemove() {
1327
+ let e = this.designerState.blockInstance;
1328
+ if (!e) return !1;
1329
+ let t = this.currentNodeIds.length > 0 ? this.currentNodeIds : this.options.nodeIds, n = [];
1330
+ for (let r of t) {
1331
+ let t = e.globalContext.allNode[r];
1332
+ t && e.globalContext.nodeParent[r] && n.push(t);
1333
+ }
1334
+ if (n.length <= 0) return !1;
1335
+ this.removedNodes = n.map((t) => ({
1336
+ designNode: zt(t),
1337
+ target: Et(e, t.id),
1338
+ docIndex: Dt(e, t.id),
1339
+ oldNodeId: t.id
1340
+ })), this.currentNodeIds = n.map((e) => e.id);
1341
+ let r = n.map((e) => this.designerState.designerEngine.componentManage.getComponentMeta(e.type)?.name ?? e.type);
1342
+ return e.opsById.removeAllById(this.currentNodeIds), this.options.onExecute?.(r), !0;
1343
+ }
1344
+ }, Ht = class extends Qe {
1345
+ unsubscribes = [];
1346
+ onEffect() {
1347
+ this.dragDropEffect(), this.shortcutKeyEffect();
1348
+ }
1349
+ onDestroy() {
1350
+ this.unsubscribes.forEach((e) => e()), this.unsubscribes.length = 0;
1351
+ }
1352
+ getActiveState() {
1353
+ return this.designerEngine.activeDesignerState;
1354
+ }
1355
+ dragDropEffect() {
1356
+ this.unsubscribes.push(this.eventbus.subscribe(qe, (e) => {
1357
+ let t = this.getActiveState(), n = e.data, r = n.insertion;
1358
+ if (!r || !r.allowDrag || !t?.blockInstance) return;
1359
+ let i = jt(r), a = n.nodeIds.filter((e) => e !== le);
1360
+ if (a.length > 0) {
1361
+ let e = new Pt(t, `移动 ${a.length} 个组件`, {
1362
+ target: i,
1363
+ nodeIds: a,
1364
+ onExecute: () => t.selectNodeByIds(a)
1365
+ });
1366
+ t.commandStack.execute(e);
1367
+ } else {
1368
+ let e = n.componentMetas.map((e) => ({
1369
+ ...P.cloneDeep(e.defDesignNode ?? {}),
1370
+ type: e.type
1371
+ })), r = new Nt(t, `添加 ${e.length} 个组件`, {
1372
+ target: i,
1373
+ nodes: e,
1374
+ onExecute: (e) => t.selectNodeByIds(e)
1375
+ });
1376
+ t.commandStack.execute(r);
1377
+ }
1378
+ }, 200));
1379
+ }
1380
+ shortcutKeyEffect() {
1381
+ this.unsubscribes.push(this.eventbus.subscribe(Ke, (e) => {
1382
+ let t = e.data;
1383
+ if (t.type !== "keydown") return;
1384
+ let n = this.getActiveState();
1385
+ if (!n) return;
1386
+ let r = t.ctrlKey || t.metaKey, i = t.rawEvent.target, a = !!i && (i.tagName === "INPUT" || i.tagName === "TEXTAREA" || i.isContentEditable);
1387
+ if (r && !t.shiftKey && t.key === "z") {
1388
+ if (a) return;
1389
+ t.rawEvent.preventDefault(), n.commandStack.undo(), n.clearSelections();
1390
+ return;
1391
+ }
1392
+ if (r && (t.key === "y" || t.shiftKey && t.key === "z")) {
1393
+ if (a) return;
1394
+ t.rawEvent.preventDefault(), n.commandStack.redo(), n.clearSelections();
1395
+ return;
1396
+ }
1397
+ if ((t.key === "delete" || t.key === "backspace") && n.existsSelection) {
1398
+ if (a) return;
1399
+ t.rawEvent.preventDefault();
1400
+ let e = n.selections.map((e) => e.nodeId).filter(Boolean);
1401
+ if (e.length <= 0) return;
1402
+ let r = new Vt(n, `删除 ${e.length} 个组件`, {
1403
+ nodeIds: e,
1404
+ onExecute: () => n.clearSelections()
1405
+ });
1406
+ n.commandStack.execute(r);
1407
+ }
1408
+ }));
1409
+ }
1410
+ }, W = class e {
1411
+ name;
1412
+ designerState;
1413
+ options;
1414
+ constructor(e, t, n) {
1415
+ this.designerState = e, this.name = t, this.options = n;
1416
+ }
1417
+ get changes() {
1418
+ return this.options.changes;
1419
+ }
1420
+ execute() {
1421
+ return this.applyChanges(!1);
1422
+ }
1423
+ undo() {
1424
+ return this.applyChanges(!0);
1425
+ }
1426
+ redo() {
1427
+ return this.applyChanges(!1);
1428
+ }
1429
+ applyChanges(e) {
1430
+ let t = this.designerState.blockInstance;
1431
+ if (!t) return !1;
1432
+ let n = [];
1433
+ for (let r of this.options.changes) {
1434
+ let i = t.globalContext.allNode[r.nodeId];
1435
+ i && (r.write(i, e ? r.oldValue : r.newValue), n.push(i));
1436
+ }
1437
+ return n.length <= 0 ? !1 : (this.rerender(n), !0);
1438
+ }
1439
+ rerender(e) {
1440
+ if (this.options.disableReRender) return;
1441
+ let t = this.designerState.blockInstance;
1442
+ t && (t.$forceUpdate(), t.$nextTick(() => {
1443
+ let t = new Set(e.map((e) => e.id));
1444
+ for (let e of this.designerState.selections) e.nodeId && t.has(e.nodeId) && e.recalcPosition();
1445
+ }));
1446
+ }
1447
+ tryMerge(t) {
1448
+ if (!(t instanceof e)) return !1;
1449
+ let n = new Set(this.options.changes.map((e) => `${e.nodeId}@${e.changeKey}`));
1450
+ if (!t.options.changes.some((e) => n.has(`${e.nodeId}@${e.changeKey}`))) return !1;
1451
+ for (let e of t.options.changes) {
1452
+ let t = this.options.changes.find((t) => t.nodeId === e.nodeId && t.changeKey === e.changeKey);
1453
+ t ? t.newValue = e.newValue : this.options.changes.push(e);
1454
+ }
1455
+ return !0;
1456
+ }
1457
+ }, Ut = class e {
1458
+ name;
1459
+ designerState;
1460
+ options;
1461
+ constructor(e, t, n) {
1462
+ this.designerState = e, this.name = t, this.options = n;
1463
+ }
1464
+ execute() {
1465
+ return this.applyChanges(!1);
1466
+ }
1467
+ undo() {
1468
+ return this.applyChanges(!0);
1469
+ }
1470
+ redo() {
1471
+ return this.applyChanges(!1);
1472
+ }
1473
+ applyChanges(e) {
1474
+ let t = this.designerState.blockInstance;
1475
+ if (!t) return !1;
1476
+ let n = t.opsById, r = !1;
1477
+ for (let t of this.options.changes) {
1478
+ let i = e ? t.oldListener : t.newListener;
1479
+ r = i ? n.bindListenerById(t.nodeId, t.event, i) || r : n.removeListenerById(t.nodeId, t.event) || r;
1480
+ }
1481
+ return r;
1482
+ }
1483
+ tryMerge(t) {
1484
+ if (!(t instanceof e)) return !1;
1485
+ let n = new Set(this.options.changes.map((e) => `${e.nodeId}@${e.event}`));
1486
+ if (!t.options.changes.some((e) => n.has(`${e.nodeId}@${e.event}`))) return !1;
1487
+ for (let e of t.options.changes) {
1488
+ let t = this.options.changes.find((t) => t.nodeId === e.nodeId && t.event === e.event);
1489
+ t ? t.newListener = e.newListener : this.options.changes.push(e);
1490
+ }
1491
+ return !0;
1492
+ }
1493
+ }, Wt = {
1494
+ key: 0,
1495
+ class: "design-canvas-selection-name"
1496
+ }, Gt = /*@__PURE__*/ f({
1497
+ name: "DesignCanvas",
1498
+ __name: "DesignCanvas",
1499
+ props: {
1500
+ designerState: {},
1501
+ block: {},
1502
+ autoLoadComponent: {
1503
+ type: Boolean,
1504
+ default: !0
1505
+ }
1506
+ },
1507
+ setup(e) {
1508
+ let t = e, n = w(), i = w(), o, u = t.designerState.designerEngine.componentManage;
1509
+ x(() => {
1510
+ t.designerState.designerContainer = n.value, n.value && typeof ResizeObserver < "u" && (o = new ResizeObserver(() => {
1511
+ t.designerState.hover.recalcPosition();
1512
+ for (let e of t.designerState.selections) e.recalcPosition();
1513
+ }), o.observe(n.value));
1514
+ }), b(() => {
1515
+ o?.disconnect(), o = void 0, t.designerState.designerContainer === n.value && (t.designerState.designerContainer = void 0);
1516
+ }), re(() => i.value?.blockInstance, (e) => {
1517
+ t.designerState.designerBlockInstance = e;
1518
+ }, { immediate: !0 });
1519
+ let f = t.designerState.hover, p = t.designerState.selections, m = t.designerState.designerEngine.insertion, h = a(() => {
1520
+ let e = f.position;
1521
+ return e ? {
1522
+ position: "absolute",
1523
+ top: `${e.top}px`,
1524
+ left: `${e.left}px`,
1525
+ width: `${e.width}px`,
1526
+ height: `${e.height}px`
1527
+ } : { display: "none" };
1528
+ }), g = a(() => p.map((e, t) => {
1529
+ let n = e.position, r = n ? {
1530
+ position: "absolute",
1531
+ top: `${n.top}px`,
1532
+ left: `${n.left}px`,
1533
+ width: `${n.width}px`,
1534
+ height: `${n.height}px`
1535
+ } : { display: "none" };
1536
+ return {
1537
+ key: e.nodeId ?? String(t),
1538
+ style: r,
1539
+ name: e.componentMeta?.name ?? ""
1540
+ };
1541
+ })), _ = a(() => {
1542
+ let e = m.position;
1543
+ return !e || m.isEmpty() ? { display: "none" } : m.isHorizontal() ? {
1544
+ position: "absolute",
1545
+ top: `${m.isBefore() ? e.top : e.top + e.height}px`,
1546
+ left: `${e.left}px`,
1547
+ width: `${e.width}px`,
1548
+ height: "2px"
1549
+ } : {
1550
+ position: "absolute",
1551
+ top: `${e.top}px`,
1552
+ left: `${m.isBefore() ? e.left : e.left + e.width}px`,
1553
+ width: "2px",
1554
+ height: `${e.height}px`
1555
+ };
1556
+ });
1557
+ return (e, a) => (S(), c("div", {
1558
+ ref_key: "containerRef",
1559
+ ref: n,
1560
+ class: "design-canvas designer-content"
1561
+ }, [
1562
+ d(O(ie), {
1563
+ ref_key: "blockComponentRef",
1564
+ ref: i,
1565
+ componentManage: O(u),
1566
+ block: t.block,
1567
+ autoLoadComponent: t.autoLoadComponent,
1568
+ isDesigning: !0
1569
+ }, null, 8, [
1570
+ "componentManage",
1571
+ "block",
1572
+ "autoLoadComponent"
1573
+ ]),
1574
+ O(f).nodeId ? (S(), c("div", {
1575
+ key: 0,
1576
+ class: "design-canvas-hover",
1577
+ style: y(h.value)
1578
+ }, null, 4)) : s("", !0),
1579
+ (S(!0), c(r, null, T(g.value, (e) => (S(), c("div", {
1580
+ key: e.key,
1581
+ class: "design-canvas-selection",
1582
+ style: y(e.style)
1583
+ }, [e.name ? (S(), c("span", Wt, D(e.name), 1)) : s("", !0)], 4))), 128)),
1584
+ l("div", {
1585
+ class: "design-canvas-insertion",
1586
+ style: y(_.value)
1587
+ }, null, 4)
1588
+ ], 512));
1589
+ }
1590
+ }), G = (e, t) => {
1591
+ let n = e.__vccOpts || e;
1592
+ for (let [e, r] of t) n[e] = r;
1593
+ return n;
1594
+ }, Kt = /*#__PURE__*/ G(Gt, [["__scopeId", "data-v-8c34617f"]]), qt = { class: "designer-ghost-name" }, Jt = /*#__PURE__*/ G(/* @__PURE__ */ f({
1595
+ name: "DragGhost",
1596
+ __name: "DragGhost",
1597
+ props: { designerEngine: {} },
1598
+ setup(e) {
1599
+ let n = e, r = w(), u = n.designerEngine.cursor, d = n.designerEngine.draggingCmpMetas, f = a(() => {
1600
+ if (!r.value) return {};
1601
+ let e = u.position;
1602
+ return !t.isNum(e.topClientX) || !t.isNum(e.topClientY) ? {} : { transform: `perspective(1px) translate3d(${e.topClientX - 6}px, ${e.topClientY - 20}px, 0) scale(0.8)` };
1603
+ });
1604
+ return (e, t) => (S(), o(i, { to: "body" }, [O(u).status === O(L).Dragging && O(d).existsCmpMeta ? (S(), c("div", {
1605
+ key: 0,
1606
+ ref_key: "ghost",
1607
+ ref: r,
1608
+ class: "designer-ghost",
1609
+ style: y(f.value)
1610
+ }, [l("span", qt, D(O(d).cmpMetas.map((e) => e.name).join(",")), 1)], 4)) : s("", !0)]));
1611
+ }
1612
+ }), [["__scopeId", "data-v-eab9afd4"]]), Yt = { class: "designer-props-label" }, Xt = { key: 1 }, Zt = { class: "designer-props-control" }, Qt = ["onClick"], $t = /*#__PURE__*/ G(/* @__PURE__ */ f({
1613
+ name: "SetterPropsGroup",
1614
+ __name: "SetterPropsGroup",
1615
+ props: {
1616
+ designerState: {},
1617
+ group: {}
1618
+ },
1619
+ setup(e) {
1620
+ let n = e, i = a(() => n.designerState.selectNodes);
1621
+ function u(e) {
1622
+ return t.isStr(e) && !ue(e) ? n.designerState.designerEngine.componentManage.getComponent(e) : e;
1623
+ }
1624
+ function d(e) {
1625
+ let { cmp: t, cmpProps: r, label: a, labelTips: o, enableBind: s, isHideSetter: c, watchValue: l, ...u } = e;
1626
+ return {
1627
+ designerState: n.designerState,
1628
+ blockInstance: n.designerState.blockInstance,
1629
+ nodes: i.value,
1630
+ ...r,
1631
+ ...u
1632
+ };
1633
+ }
1634
+ function f(e) {
1635
+ let { propsName: n, enableBind: r } = e;
1636
+ if (r === !1 || t.noValue(n)) return !1;
1637
+ let a = i.value, o = /* @__PURE__ */ new Set();
1638
+ for (let e of a) o.add(e.props[n]);
1639
+ if (o.size !== 1) return !1;
1640
+ let s = o.values().next().value;
1641
+ if (!t.isStr(s)) return !1;
1642
+ let c = P.trim(s);
1643
+ return c.startsWith("{{") && c.endsWith("}}");
1644
+ }
1645
+ function p(e) {
1646
+ let { propsName: r } = e;
1647
+ if (t.noValue(r)) return;
1648
+ let a = i.value, o = !f(e);
1649
+ for (let e of a) {
1650
+ let n = e.designExt;
1651
+ if (n.tmpBindProps ||= {}, n.tmpUnbindProps ||= {}, o) P.hasIn(e.props, r) ? n.tmpUnbindProps[r] = e.props[r] : delete n.tmpUnbindProps[r], e.props[r] = n.tmpBindProps[r] ?? "{{ }}";
1652
+ else {
1653
+ let i = e.props[r];
1654
+ if (t.isStr(i)) {
1655
+ let e = P.trim(i);
1656
+ e.startsWith("{{") && e.endsWith("}}") && (n.tmpBindProps[r] = e);
1657
+ }
1658
+ P.hasIn(n.tmpUnbindProps, r) ? n.tmpUnbindProps[r] = e.props[r] : delete e.props[r];
1659
+ }
1660
+ }
1661
+ n.designerState.blockInstance?.$forceUpdate(), n.designerState.setterShareState.notifyPanelUpdate();
1662
+ }
1663
+ return (e, t) => (S(!0), c(r, null, T(n.group.items, (e, t) => (S(), c("div", {
1664
+ key: t,
1665
+ class: "designer-props-item"
1666
+ }, [
1667
+ l("div", Yt, [e.labelTips ? (S(), o(O(I), {
1668
+ key: 0,
1669
+ title: e.labelTips
1670
+ }, {
1671
+ default: A(() => [l("span", null, D(e.label), 1)]),
1672
+ _: 2
1673
+ }, 1032, ["title"])) : (S(), c("span", Xt, D(e.label), 1))]),
1674
+ l("div", Zt, [u(e.cmp) ? (S(), o(ee(u(e.cmp)), g({
1675
+ key: 0,
1676
+ ref_for: !0
1677
+ }, d(e)), null, 16)) : s("", !0)]),
1678
+ e.enableBind !== !1 && e.propsName ? (S(), c("div", {
1679
+ key: 0,
1680
+ class: v(["designer-props-bind", { "designer-props-bind-active": f(e) }]),
1681
+ title: "切换数据绑定(值使用 {{ 表达式 }})",
1682
+ onClick: (t) => p(e)
1683
+ }, D("{ }"), 10, Qt)) : s("", !0)
1684
+ ]))), 128));
1685
+ }
1686
+ }), [["__scopeId", "data-v-da94f8a5"]]), en = { class: "designer-props-node" }, tn = { class: "designer-props-node-name" }, nn = { class: "designer-props-node-type" }, rn = /*#__PURE__*/ G(/* @__PURE__ */ f({
1687
+ name: "SetterPropsPanel",
1688
+ __name: "SetterPropsPanel",
1689
+ props: {
1690
+ designerState: {},
1691
+ propsPanel: {}
1692
+ },
1693
+ setup(e) {
1694
+ let t = e, n = a(() => t.designerState.setterShareState.expandGroups), i = a(() => t.designerState.selectNode ? (t.propsPanel?.groups ?? []).map((e) => {
1695
+ let t = e.items.filter((e) => !s(e));
1696
+ return {
1697
+ ...e,
1698
+ items: t
1699
+ };
1700
+ }).filter((e) => e.items.length > 0) : []);
1701
+ function s(e) {
1702
+ if (!e.isHideSetter) return !1;
1703
+ let n = t.designerState.selectNode;
1704
+ return n ? e.isHideSetter(n, t.designerState.selectNodes, void 0) === !0 : !1;
1705
+ }
1706
+ let u = a(() => i.value.map((e) => ({
1707
+ key: e.title,
1708
+ label: e.title,
1709
+ content: m($t, {
1710
+ designerState: t.designerState,
1711
+ group: e
1712
+ })
1713
+ })));
1714
+ return re(() => t.designerState.selectedComponentMeta, () => {
1715
+ t.designerState.setterShareState.recalcExpandGroups();
1716
+ }, { immediate: !0 }), (e, i) => (S(), c("div", {
1717
+ key: t.designerState.setterShareState.panelVersion,
1718
+ class: "designer-props-panel"
1719
+ }, [t.designerState.existsSelection ? (S(), c(r, { key: 1 }, [l("div", en, [l("span", tn, D(t.designerState.selectedComponentMeta?.name ?? "-"), 1), l("span", nn, D(t.designerState.selectNode?.type), 1)]), d(O(pe), {
1720
+ activeKey: n.value.props,
1721
+ "onUpdate:activeKey": i[0] ||= (e) => n.value.props = e,
1722
+ ghost: "",
1723
+ size: "small",
1724
+ items: u.value
1725
+ }, null, 8, ["activeKey", "items"])], 64)) : (S(), o(O(he), {
1726
+ key: 0,
1727
+ description: "请选择画布中的组件"
1728
+ }))]));
1729
+ }
1730
+ }), [["__scopeId", "data-v-08d0d16e"]]), an = [
1731
+ {
1732
+ title: "布局",
1733
+ disableKey: "disableLayout",
1734
+ items: [
1735
+ {
1736
+ property: "display",
1737
+ label: "显示类型",
1738
+ cmp: "SelectSetter",
1739
+ options: [
1740
+ {
1741
+ value: "block",
1742
+ label: "块级(block)"
1743
+ },
1744
+ {
1745
+ value: "inline-block",
1746
+ label: "行内块(inline-block)"
1747
+ },
1748
+ {
1749
+ value: "inline",
1750
+ label: "行内(inline)"
1751
+ },
1752
+ {
1753
+ value: "flex",
1754
+ label: "弹性(flex)"
1755
+ },
1756
+ {
1757
+ value: "inline-flex",
1758
+ label: "行内弹性(inline-flex)"
1759
+ },
1760
+ {
1761
+ value: "grid",
1762
+ label: "网格(grid)"
1763
+ },
1764
+ {
1765
+ value: "inline-grid",
1766
+ label: "行内网格(inline-grid)"
1767
+ },
1768
+ {
1769
+ value: "none",
1770
+ label: "隐藏(none)"
1771
+ }
1772
+ ]
1773
+ },
1774
+ {
1775
+ property: "flexDirection",
1776
+ label: "主轴方向",
1777
+ cmp: "SelectSetter",
1778
+ options: [
1779
+ {
1780
+ value: "row",
1781
+ label: "水平(row)"
1782
+ },
1783
+ {
1784
+ value: "column",
1785
+ label: "垂直(column)"
1786
+ },
1787
+ {
1788
+ value: "row-reverse",
1789
+ label: "水平反转"
1790
+ },
1791
+ {
1792
+ value: "column-reverse",
1793
+ label: "垂直反转"
1794
+ }
1795
+ ]
1796
+ },
1797
+ {
1798
+ property: "justifyContent",
1799
+ label: "主轴对齐",
1800
+ cmp: "SelectSetter",
1801
+ options: [
1802
+ {
1803
+ value: "flex-start",
1804
+ label: "起始"
1805
+ },
1806
+ {
1807
+ value: "center",
1808
+ label: "居中"
1809
+ },
1810
+ {
1811
+ value: "flex-end",
1812
+ label: "末尾"
1813
+ },
1814
+ {
1815
+ value: "space-between",
1816
+ label: "两端"
1817
+ },
1818
+ {
1819
+ value: "space-around",
1820
+ label: "环绕"
1821
+ },
1822
+ {
1823
+ value: "space-evenly",
1824
+ label: "均分"
1825
+ }
1826
+ ]
1827
+ },
1828
+ {
1829
+ property: "alignItems",
1830
+ label: "交叉对齐",
1831
+ cmp: "SelectSetter",
1832
+ options: [
1833
+ {
1834
+ value: "flex-start",
1835
+ label: "起始"
1836
+ },
1837
+ {
1838
+ value: "center",
1839
+ label: "居中"
1840
+ },
1841
+ {
1842
+ value: "flex-end",
1843
+ label: "末尾"
1844
+ },
1845
+ {
1846
+ value: "stretch",
1847
+ label: "拉伸"
1848
+ },
1849
+ {
1850
+ value: "baseline",
1851
+ label: "基线"
1852
+ }
1853
+ ]
1854
+ },
1855
+ {
1856
+ property: "flexWrap",
1857
+ label: "换行",
1858
+ cmp: "SelectSetter",
1859
+ options: [
1860
+ {
1861
+ value: "nowrap",
1862
+ label: "不换行"
1863
+ },
1864
+ {
1865
+ value: "wrap",
1866
+ label: "换行"
1867
+ },
1868
+ {
1869
+ value: "wrap-reverse",
1870
+ label: "反转换行"
1871
+ }
1872
+ ]
1873
+ },
1874
+ {
1875
+ property: "gap",
1876
+ label: "间距",
1877
+ cmp: "StringSetter"
1878
+ }
1879
+ ]
1880
+ },
1881
+ {
1882
+ title: "网格",
1883
+ visible: (e) => String(e.display ?? "").includes("grid"),
1884
+ items: [
1885
+ {
1886
+ property: "gridTemplateColumns",
1887
+ label: "列模板",
1888
+ cmp: "StringSetter"
1889
+ },
1890
+ {
1891
+ property: "gridTemplateRows",
1892
+ label: "行模板",
1893
+ cmp: "StringSetter"
1894
+ },
1895
+ {
1896
+ property: "gridAutoFlow",
1897
+ label: "排列方向",
1898
+ cmp: "SelectSetter",
1899
+ options: [
1900
+ {
1901
+ value: "row",
1902
+ label: "按行"
1903
+ },
1904
+ {
1905
+ value: "column",
1906
+ label: "按列"
1907
+ },
1908
+ {
1909
+ value: "dense",
1910
+ label: "密集"
1911
+ }
1912
+ ]
1913
+ },
1914
+ {
1915
+ property: "gridGap",
1916
+ label: "网格间距",
1917
+ cmp: "StringSetter"
1918
+ }
1919
+ ]
1920
+ },
1921
+ {
1922
+ title: "间距",
1923
+ disableKey: "disableSpacing",
1924
+ items: [
1925
+ {
1926
+ property: "margin",
1927
+ label: "外边距",
1928
+ cmp: "StringSetter"
1929
+ },
1930
+ {
1931
+ property: "marginTop",
1932
+ label: "外边距(上)",
1933
+ cmp: "StringSetter"
1934
+ },
1935
+ {
1936
+ property: "marginRight",
1937
+ label: "外边距(右)",
1938
+ cmp: "StringSetter"
1939
+ },
1940
+ {
1941
+ property: "marginBottom",
1942
+ label: "外边距(下)",
1943
+ cmp: "StringSetter"
1944
+ },
1945
+ {
1946
+ property: "marginLeft",
1947
+ label: "外边距(左)",
1948
+ cmp: "StringSetter"
1949
+ },
1950
+ {
1951
+ property: "padding",
1952
+ label: "内边距",
1953
+ cmp: "StringSetter"
1954
+ },
1955
+ {
1956
+ property: "paddingTop",
1957
+ label: "内边距(上)",
1958
+ cmp: "StringSetter"
1959
+ },
1960
+ {
1961
+ property: "paddingRight",
1962
+ label: "内边距(右)",
1963
+ cmp: "StringSetter"
1964
+ },
1965
+ {
1966
+ property: "paddingBottom",
1967
+ label: "内边距(下)",
1968
+ cmp: "StringSetter"
1969
+ },
1970
+ {
1971
+ property: "paddingLeft",
1972
+ label: "内边距(左)",
1973
+ cmp: "StringSetter"
1974
+ }
1975
+ ]
1976
+ },
1977
+ {
1978
+ title: "尺寸",
1979
+ disableKey: "disableSize",
1980
+ items: [
1981
+ {
1982
+ property: "width",
1983
+ label: "宽度",
1984
+ cmp: "StringSetter"
1985
+ },
1986
+ {
1987
+ property: "height",
1988
+ label: "高度",
1989
+ cmp: "StringSetter"
1990
+ },
1991
+ {
1992
+ property: "minWidth",
1993
+ label: "最小宽度",
1994
+ cmp: "StringSetter"
1995
+ },
1996
+ {
1997
+ property: "minHeight",
1998
+ label: "最小高度",
1999
+ cmp: "StringSetter"
2000
+ },
2001
+ {
2002
+ property: "maxWidth",
2003
+ label: "最大宽度",
2004
+ cmp: "StringSetter"
2005
+ },
2006
+ {
2007
+ property: "maxHeight",
2008
+ label: "最大高度",
2009
+ cmp: "StringSetter"
2010
+ }
2011
+ ]
2012
+ },
2013
+ {
2014
+ title: "定位",
2015
+ disableKey: "disablePosition",
2016
+ items: [
2017
+ {
2018
+ property: "position",
2019
+ label: "定位方式",
2020
+ cmp: "SelectSetter",
2021
+ options: [
2022
+ {
2023
+ value: "static",
2024
+ label: "静态"
2025
+ },
2026
+ {
2027
+ value: "relative",
2028
+ label: "相对"
2029
+ },
2030
+ {
2031
+ value: "absolute",
2032
+ label: "绝对"
2033
+ },
2034
+ {
2035
+ value: "fixed",
2036
+ label: "固定"
2037
+ },
2038
+ {
2039
+ value: "sticky",
2040
+ label: "粘性"
2041
+ }
2042
+ ]
2043
+ },
2044
+ {
2045
+ property: "top",
2046
+ label: "上偏移",
2047
+ cmp: "StringSetter"
2048
+ },
2049
+ {
2050
+ property: "right",
2051
+ label: "右偏移",
2052
+ cmp: "StringSetter"
2053
+ },
2054
+ {
2055
+ property: "bottom",
2056
+ label: "下偏移",
2057
+ cmp: "StringSetter"
2058
+ },
2059
+ {
2060
+ property: "left",
2061
+ label: "左偏移",
2062
+ cmp: "StringSetter"
2063
+ },
2064
+ {
2065
+ property: "zIndex",
2066
+ label: "层级",
2067
+ cmp: "StringSetter"
2068
+ }
2069
+ ]
2070
+ },
2071
+ {
2072
+ title: "文本",
2073
+ disableKey: "disableFont",
2074
+ items: [
2075
+ {
2076
+ property: "fontSize",
2077
+ label: "字号",
2078
+ cmp: "StringSetter"
2079
+ },
2080
+ {
2081
+ property: "fontWeight",
2082
+ label: "字重",
2083
+ cmp: "SelectSetter",
2084
+ options: [
2085
+ {
2086
+ value: "normal",
2087
+ label: "常规"
2088
+ },
2089
+ {
2090
+ value: "bold",
2091
+ label: "加粗"
2092
+ },
2093
+ {
2094
+ value: "300",
2095
+ label: "细"
2096
+ },
2097
+ {
2098
+ value: "500",
2099
+ label: "中"
2100
+ },
2101
+ {
2102
+ value: "600",
2103
+ label: "半粗"
2104
+ },
2105
+ {
2106
+ value: "800",
2107
+ label: "特粗"
2108
+ }
2109
+ ]
2110
+ },
2111
+ {
2112
+ property: "color",
2113
+ label: "颜色",
2114
+ cmp: "ColorSetter"
2115
+ },
2116
+ {
2117
+ property: "textAlign",
2118
+ label: "对齐",
2119
+ cmp: "SelectSetter",
2120
+ options: [
2121
+ {
2122
+ value: "left",
2123
+ label: "左"
2124
+ },
2125
+ {
2126
+ value: "center",
2127
+ label: "中"
2128
+ },
2129
+ {
2130
+ value: "right",
2131
+ label: "右"
2132
+ },
2133
+ {
2134
+ value: "justify",
2135
+ label: "两端"
2136
+ }
2137
+ ]
2138
+ },
2139
+ {
2140
+ property: "lineHeight",
2141
+ label: "行高",
2142
+ cmp: "StringSetter"
2143
+ },
2144
+ {
2145
+ property: "fontFamily",
2146
+ label: "字体",
2147
+ cmp: "StringSetter"
2148
+ },
2149
+ {
2150
+ property: "textDecoration",
2151
+ label: "修饰",
2152
+ cmp: "SelectSetter",
2153
+ options: [
2154
+ {
2155
+ value: "none",
2156
+ label: "无"
2157
+ },
2158
+ {
2159
+ value: "underline",
2160
+ label: "下划线"
2161
+ },
2162
+ {
2163
+ value: "line-through",
2164
+ label: "删除线"
2165
+ },
2166
+ {
2167
+ value: "overline",
2168
+ label: "上划线"
2169
+ }
2170
+ ]
2171
+ }
2172
+ ]
2173
+ },
2174
+ {
2175
+ title: "边框",
2176
+ disableKey: "disableBorder",
2177
+ items: [
2178
+ {
2179
+ property: "borderWidth",
2180
+ label: "边框宽度",
2181
+ cmp: "StringSetter"
2182
+ },
2183
+ {
2184
+ property: "borderStyle",
2185
+ label: "边框样式",
2186
+ cmp: "SelectSetter",
2187
+ options: [
2188
+ {
2189
+ value: "none",
2190
+ label: "无"
2191
+ },
2192
+ {
2193
+ value: "solid",
2194
+ label: "实线"
2195
+ },
2196
+ {
2197
+ value: "dashed",
2198
+ label: "虚线"
2199
+ },
2200
+ {
2201
+ value: "dotted",
2202
+ label: "点线"
2203
+ },
2204
+ {
2205
+ value: "double",
2206
+ label: "双线"
2207
+ }
2208
+ ]
2209
+ },
2210
+ {
2211
+ property: "borderColor",
2212
+ label: "边框颜色",
2213
+ cmp: "ColorSetter"
2214
+ },
2215
+ {
2216
+ property: "borderRadius",
2217
+ label: "圆角",
2218
+ cmp: "StringSetter"
2219
+ }
2220
+ ]
2221
+ },
2222
+ {
2223
+ title: "背景与效果",
2224
+ disableKey: "disableEffect",
2225
+ items: [
2226
+ {
2227
+ property: "backgroundColor",
2228
+ label: "背景颜色",
2229
+ cmp: "ColorSetter"
2230
+ },
2231
+ {
2232
+ property: "backgroundImage",
2233
+ label: "背景图片",
2234
+ cmp: "StringSetter"
2235
+ },
2236
+ {
2237
+ property: "opacity",
2238
+ label: "不透明度",
2239
+ cmp: "StringSetter"
2240
+ },
2241
+ {
2242
+ property: "boxShadow",
2243
+ label: "阴影",
2244
+ cmp: "StringSetter"
2245
+ },
2246
+ {
2247
+ property: "cursor",
2248
+ label: "光标",
2249
+ cmp: "SelectSetter",
2250
+ options: [
2251
+ {
2252
+ value: "auto",
2253
+ label: "自动"
2254
+ },
2255
+ {
2256
+ value: "pointer",
2257
+ label: "手型"
2258
+ },
2259
+ {
2260
+ value: "not-allowed",
2261
+ label: "禁止"
2262
+ },
2263
+ {
2264
+ value: "move",
2265
+ label: "移动"
2266
+ },
2267
+ {
2268
+ value: "text",
2269
+ label: "文本"
2270
+ }
2271
+ ]
2272
+ },
2273
+ {
2274
+ property: "overflow",
2275
+ label: "溢出",
2276
+ cmp: "SelectSetter",
2277
+ options: [
2278
+ {
2279
+ value: "visible",
2280
+ label: "可见"
2281
+ },
2282
+ {
2283
+ value: "hidden",
2284
+ label: "隐藏"
2285
+ },
2286
+ {
2287
+ value: "auto",
2288
+ label: "自动"
2289
+ },
2290
+ {
2291
+ value: "scroll",
2292
+ label: "滚动"
2293
+ }
2294
+ ]
2295
+ }
2296
+ ]
2297
+ }
2298
+ ], on = 350;
2299
+ function K(e) {
2300
+ if (!t.noValue(e)) {
2301
+ if (t.isStr(e)) try {
2302
+ return Me(e);
2303
+ } catch {
2304
+ return;
2305
+ }
2306
+ if (t.isObj(e)) return e;
2307
+ }
2308
+ }
2309
+ function sn(e, n, r, i) {
2310
+ let { nodes: a } = e;
2311
+ if (!a) return;
2312
+ let o = /* @__PURE__ */ new Set();
2313
+ for (let e of a) {
2314
+ let i, a = K(e.props?.style);
2315
+ if (a && (i = P.get(a, n)), t.isFunction(r) && (i = r(i)), t.noValue(i) && (i = void 0), o.add(i), o.size > 1) break;
2316
+ }
2317
+ if (!(o.size <= 0)) {
2318
+ if (o.size === 1) return o.values().next().value;
2319
+ i?.(!0);
2320
+ }
2321
+ }
2322
+ var q, cn = P.debounce(function() {
2323
+ let e = q;
2324
+ if (q = void 0, !e) return;
2325
+ let { props: n, styleValues: r } = e, i = n.designerState, { nodes: a } = n;
2326
+ if (!a || a.length <= 0) return;
2327
+ let o = [];
2328
+ for (let e of a) {
2329
+ let n = K(e.props?.style) ?? {}, i = {};
2330
+ for (let e in r) i[e] = P.get(n, e);
2331
+ o.push({
2332
+ nodeId: e.id,
2333
+ changeKey: "style",
2334
+ oldValue: i,
2335
+ newValue: { ...r },
2336
+ write: (e, n) => {
2337
+ let r = K(e.props?.style) ?? {};
2338
+ for (let e in n) {
2339
+ let i = n[e];
2340
+ t.noValue(i) || t.isStr(i) && P.trim(i).length <= 0 ? P.unset(r, e) : P.set(r, e, i);
2341
+ }
2342
+ e.props.style = r;
2343
+ }
2344
+ });
2345
+ }
2346
+ o.length <= 0 || i.commandStack.execute(new W(i, "修改样式", { changes: o }));
2347
+ }, 350);
2348
+ function ln(e, t) {
2349
+ (!q || q.props !== e) && (q && cn.flush(), q = {
2350
+ props: e,
2351
+ styleValues: {}
2352
+ }), Object.assign(q.styleValues, t), cn();
2353
+ }
2354
+ function un(e, n) {
2355
+ let { designerState: r, nodes: i } = e;
2356
+ if (!i || i.length <= 0) return;
2357
+ let a = P.trim(n ?? ""), o = [];
2358
+ for (let e of i) {
2359
+ t.noValue(e.designExt.rawPropsClass) && (e.designExt.rawPropsClass = e.props.class ?? "");
2360
+ let n = [P.trim(e.designExt.rawPropsClass), a].filter((e) => e.length > 0).join(" "), r = e.props.class;
2361
+ P.trim(r ?? "") !== n && o.push({
2362
+ nodeId: e.id,
2363
+ changeKey: "class",
2364
+ oldValue: r,
2365
+ newValue: n.length > 0 ? n : void 0,
2366
+ write: (e, t) => {
2367
+ e.props.class = t;
2368
+ }
2369
+ });
2370
+ }
2371
+ o.length <= 0 || r.commandStack.execute(new W(r, "切换主题样式", { changes: o }));
2372
+ }
2373
+ function dn(e, n) {
2374
+ let { nodes: r } = e;
2375
+ if (!r || r.length !== 1) return;
2376
+ let i = r[0];
2377
+ t.noValue(i.designExt.rawPropsClass) && (i.designExt.rawPropsClass = i.props.class ?? "");
2378
+ let a = P.trim(i.designExt.rawPropsClass), o = P.trim(i.props.class?.substring(a.length) ?? "");
2379
+ return n.find((e) => e.class === o)?.class;
2380
+ }
2381
+ //#endregion
2382
+ //#region src/components/panels/SetterStyleGroup.vue?vue&type=script&setup=true&lang.ts
2383
+ var fn = { class: "designer-style-label" }, pn = ["title"], mn = { class: "designer-style-control" }, hn = /*#__PURE__*/ G(/* @__PURE__ */ f({
2384
+ name: "SetterStyleGroup",
2385
+ __name: "SetterStyleGroup",
2386
+ props: {
2387
+ designerState: {},
2388
+ group: {}
2389
+ },
2390
+ setup(e) {
2391
+ let t = e, n = a(() => ({
2392
+ designerState: t.designerState,
2393
+ blockInstance: t.designerState.blockInstance,
2394
+ nodes: t.designerState.selectNodes
2395
+ }));
2396
+ function i(e) {
2397
+ return sn(n.value, e.property);
2398
+ }
2399
+ function u(e, t) {
2400
+ ln(n.value, { [e.property]: t });
2401
+ }
2402
+ function d(e) {
2403
+ return {
2404
+ designerState: t.designerState,
2405
+ blockInstance: t.designerState.blockInstance,
2406
+ nodes: t.designerState.selectNodes,
2407
+ getPropsValue: (t) => i(e),
2408
+ applyPropsValue: (t, n) => (u(e, n), !1),
2409
+ ...e.cmp === "SelectSetter" ? { options: e.options } : {}
2410
+ };
2411
+ }
2412
+ function f(e) {
2413
+ return t.designerState.designerEngine.componentManage.getComponent(e);
2414
+ }
2415
+ return (e, n) => (S(!0), c(r, null, T(t.group.items, (e, t) => (S(), c("div", {
2416
+ key: e.property + t,
2417
+ class: "designer-style-item"
2418
+ }, [l("div", fn, [l("span", { title: e.property }, D(e.label), 9, pn)]), l("div", mn, [f(e.cmp) ? (S(), o(ee(f(e.cmp)), g({
2419
+ key: 0,
2420
+ ref_for: !0
2421
+ }, d(e)), null, 16)) : s("", !0)])]))), 128));
2422
+ }
2423
+ }), [["__scopeId", "data-v-f020ce55"]]), gn = { class: "designer-style-panel" }, _n = {
2424
+ key: 0,
2425
+ class: "designer-style-theme-item"
2426
+ }, vn = { class: "designer-style-theme-control" }, yn = /*#__PURE__*/ G(/* @__PURE__ */ f({
2427
+ name: "SetterStylePanel",
2428
+ __name: "SetterStylePanel",
2429
+ props: {
2430
+ designerState: {},
2431
+ stylePanel: {}
2432
+ },
2433
+ setup(e) {
2434
+ let t = e, n = a(() => ({
2435
+ designerState: t.designerState,
2436
+ blockInstance: t.designerState.blockInstance,
2437
+ nodes: t.designerState.selectNodes
2438
+ })), i = a(() => {
2439
+ let e = t.designerState.selectNode;
2440
+ return e ? K(e.props?.style) ?? {} : {};
2441
+ }), u = a(() => {
2442
+ let e = t.stylePanel ?? {}, n = i.value;
2443
+ return an.filter((t) => !(t.disableKey && e[t.disableKey] || t.visible && !t.visible(n)));
2444
+ }), f = a(() => t.designerState.selectedComponentMeta?.setter.style?.componentStyles?.map((e) => ({
2445
+ value: e.class,
2446
+ label: e.name
2447
+ })) ?? []), p = a(() => dn(n.value, t.designerState.selectedComponentMeta?.setter.style?.componentStyles ?? []));
2448
+ function h(e) {
2449
+ un(n.value, e);
2450
+ }
2451
+ let g = a(() => u.value.map((e) => ({
2452
+ key: e.title,
2453
+ label: e.title,
2454
+ content: m(hn, {
2455
+ designerState: t.designerState,
2456
+ group: e
2457
+ })
2458
+ }))), _ = a({
2459
+ get: () => (t.designerState.setterShareState.expandGroups.style ?? []).slice(),
2460
+ set: (e) => {
2461
+ t.designerState.setterShareState.expandGroups = {
2462
+ ...t.designerState.setterShareState.expandGroups,
2463
+ style: e
2464
+ };
2465
+ }
2466
+ });
2467
+ return re(() => t.designerState.selectedComponentMeta, () => {
2468
+ t.designerState.setterShareState.recalcExpandGroups();
2469
+ }), (e, n) => (S(), c("div", gn, [t.designerState.existsSelection ? (S(), c(r, { key: 1 }, [f.value.length > 0 ? (S(), c("div", _n, [n[1] ||= l("div", { class: "designer-style-theme-label" }, "主题样式", -1), l("div", vn, [d(O(ve), {
2470
+ allowClear: "",
2471
+ placeholder: "选择主题",
2472
+ options: f.value,
2473
+ value: p.value || void 0,
2474
+ onChange: h
2475
+ }, null, 8, ["options", "value"])])])) : s("", !0), d(O(pe), {
2476
+ activeKey: _.value,
2477
+ "onUpdate:activeKey": n[0] ||= (e) => _.value = e,
2478
+ ghost: "",
2479
+ size: "small",
2480
+ items: g.value
2481
+ }, null, 8, ["activeKey", "items"])], 64)) : (S(), o(O(he), {
2482
+ key: 0,
2483
+ description: "请选择画布中的组件"
2484
+ }))]));
2485
+ }
2486
+ }), [["__scopeId", "data-v-abf7f607"]]), bn = { class: "designer-event-group-title" }, xn = { class: "designer-event-name" }, Sn = { class: "designer-event-key" }, Cn = { class: "designer-event-actions" }, wn = {
2487
+ key: 0,
2488
+ class: "designer-event-editor"
2489
+ }, Tn = { class: "designer-event-editor-title" }, En = { class: "designer-event-editor-actions" }, Dn = /*#__PURE__*/ G(/* @__PURE__ */ f({
2490
+ name: "SetterEventPanel",
2491
+ __name: "SetterEventPanel",
2492
+ props: {
2493
+ designerState: {},
2494
+ eventPanel: {}
2495
+ },
2496
+ setup(e) {
2497
+ let n = e, i = [{
2498
+ title: "鼠标事件",
2499
+ items: [
2500
+ {
2501
+ name: "click",
2502
+ description: "单击"
2503
+ },
2504
+ {
2505
+ name: "dblclick",
2506
+ description: "双击"
2507
+ },
2508
+ {
2509
+ name: "mouseenter",
2510
+ description: "移入"
2511
+ },
2512
+ {
2513
+ name: "mouseleave",
2514
+ description: "移出"
2515
+ },
2516
+ {
2517
+ name: "mousedown",
2518
+ description: "按下"
2519
+ },
2520
+ {
2521
+ name: "mouseup",
2522
+ description: "弹起"
2523
+ }
2524
+ ]
2525
+ }, {
2526
+ title: "键盘事件",
2527
+ items: [{
2528
+ name: "keydown",
2529
+ description: "按下"
2530
+ }, {
2531
+ name: "keyup",
2532
+ description: "弹起"
2533
+ }]
2534
+ }], f = a(() => n.designerState.selectNodes), p = a(() => {
2535
+ let e = [], t = n.eventPanel?.groups;
2536
+ t && t.length > 0 && e.push(...t);
2537
+ let r = n.eventPanel?.excludeInnerEvents;
2538
+ if (n.eventPanel?.includeInnerEvents !== !1) for (let t of i) r?.includes(t.title) || e.push(t);
2539
+ return e;
2540
+ }), m = C({
2541
+ event: "",
2542
+ code: "",
2543
+ new: !1
2544
+ });
2545
+ function h(e) {
2546
+ return fe(e);
2547
+ }
2548
+ function g(e) {
2549
+ let t = h(e), n = /* @__PURE__ */ new Set();
2550
+ for (let e of f.value) n.add(e.listeners[t]);
2551
+ if (n.size === 1) return n.values().next().value;
2552
+ }
2553
+ function _(e) {
2554
+ return !!g(e)?.handler;
2555
+ }
2556
+ function v(e) {
2557
+ let n = g(e)?.handler;
2558
+ if (!t.isFun(n)) return "";
2559
+ try {
2560
+ let e = n.toString(), t = e.match(/\{([\s\S]*)\}$/);
2561
+ return t ? t[1].trim() : e;
2562
+ } catch {
2563
+ return "";
2564
+ }
2565
+ }
2566
+ function y(e) {
2567
+ m.event = e, m.code = v(e) || "console.log('事件触发', event)", m.new = !_(e);
2568
+ }
2569
+ function b() {
2570
+ let e = m.event;
2571
+ if (!e) return;
2572
+ let t = n.designerState;
2573
+ if (!t.blockInstance) return;
2574
+ let r = P.trim(m.code), i;
2575
+ try {
2576
+ r.length > 0 && (i = se({ code: r }));
2577
+ } catch (e) {
2578
+ console.warn("[EventPanel] 事件函数解析失败", e);
2579
+ return;
2580
+ }
2581
+ let a = h(e), o = [];
2582
+ for (let t of f.value) {
2583
+ let n = t.listeners[a];
2584
+ i && n?.handler && Function.prototype.toString.call(n.handler) === Function.prototype.toString.call(i) || o.push({
2585
+ nodeId: t.id,
2586
+ event: e,
2587
+ oldListener: n,
2588
+ newListener: i ? { handler: i } : void 0
2589
+ });
2590
+ }
2591
+ m.event = "", o.length > 0 && t.commandStack.execute(new Ut(t, `绑定事件 ${e}`, { changes: o }));
2592
+ }
2593
+ function x(e) {
2594
+ let t = n.designerState;
2595
+ if (!t.blockInstance) return;
2596
+ let r = h(e), i = [];
2597
+ for (let t of f.value) {
2598
+ let n = t.listeners[r];
2599
+ n && i.push({
2600
+ nodeId: t.id,
2601
+ event: e,
2602
+ oldListener: n,
2603
+ newListener: void 0
2604
+ });
2605
+ }
2606
+ i.length > 0 && t.commandStack.execute(new Ut(t, `解绑事件 ${e}`, { changes: i }));
2607
+ }
2608
+ return (e, t) => (S(), c("div", {
2609
+ key: n.designerState.setterShareState.panelVersion,
2610
+ class: "designer-event-panel"
2611
+ }, [n.designerState.existsSelection ? (S(), c(r, { key: 1 }, [(S(!0), c(r, null, T(p.value, (e) => (S(), c("div", {
2612
+ key: e.title,
2613
+ class: "designer-event-group"
2614
+ }, [l("div", bn, D(e.title), 1), (S(!0), c(r, null, T(e.items, (e) => (S(), c("div", {
2615
+ key: e.name,
2616
+ class: "designer-event-item"
2617
+ }, [l("div", xn, [u(D(e.description ?? e.name) + " ", 1), l("span", Sn, D(e.name), 1)]), l("div", Cn, [
2618
+ _(e.name) ? (S(), o(O(xe), {
2619
+ key: 0,
2620
+ color: "blue",
2621
+ class: "designer-event-tag"
2622
+ }, {
2623
+ default: A(() => [...t[2] ||= [u("已绑定", -1)]]),
2624
+ _: 1
2625
+ })) : s("", !0),
2626
+ d(O(F), {
2627
+ size: "small",
2628
+ type: "link",
2629
+ onClick: (t) => y(e.name)
2630
+ }, {
2631
+ default: A(() => [u(D(_(e.name) ? "编辑" : "绑定"), 1)]),
2632
+ _: 2
2633
+ }, 1032, ["onClick"]),
2634
+ _(e.name) ? (S(), o(O(F), {
2635
+ key: 1,
2636
+ size: "small",
2637
+ type: "link",
2638
+ danger: "",
2639
+ onClick: (t) => x(e.name)
2640
+ }, {
2641
+ default: A(() => [...t[3] ||= [u("解绑", -1)]]),
2642
+ _: 1
2643
+ }, 8, ["onClick"])) : s("", !0)
2644
+ ])]))), 128))]))), 128)), m.event ? (S(), c("div", wn, [
2645
+ l("div", Tn, [t[4] ||= u(" 编辑事件函数: ", -1), l("b", null, D(m.event), 1)]),
2646
+ j(l("textarea", {
2647
+ class: "designer-event-textarea",
2648
+ "onUpdate:modelValue": t[0] ||= (e) => m.code = e,
2649
+ placeholder: "函数体字符串(如: console.log('click', event)), 留空清除绑定"
2650
+ }, null, 512), [[ne, m.code]]),
2651
+ l("div", En, [d(O(F), {
2652
+ size: "small",
2653
+ type: "primary",
2654
+ onClick: b
2655
+ }, {
2656
+ default: A(() => [...t[5] ||= [u("保存", -1)]]),
2657
+ _: 1
2658
+ }), d(O(F), {
2659
+ size: "small",
2660
+ onClick: t[1] ||= (e) => m.event = ""
2661
+ }, {
2662
+ default: A(() => [...t[6] ||= [u("取消", -1)]]),
2663
+ _: 1
2664
+ })])
2665
+ ])) : s("", !0)], 64)) : (S(), o(O(he), {
2666
+ key: 0,
2667
+ description: "请选择画布中的组件"
2668
+ }))]));
2669
+ }
2670
+ }), [["__scopeId", "data-v-f03d037b"]]), On = {
2671
+ key: 0,
2672
+ class: "designer-advanced-item"
2673
+ }, kn = { class: "designer-advanced-control" }, An = { class: "designer-advanced-switch" }, jn = ["checked"], Mn = {
2674
+ key: 1,
2675
+ class: "designer-advanced-item designer-advanced-column"
2676
+ }, Nn = { class: "designer-advanced-control" }, Pn = ["value"], Fn = {
2677
+ key: 2,
2678
+ class: "designer-advanced-item designer-advanced-column"
2679
+ }, In = { class: "designer-advanced-control" }, Ln = ["value"], Rn = /*#__PURE__*/ G(/* @__PURE__ */ f({
2680
+ name: "SetterAdvancedPanel",
2681
+ __name: "SetterAdvancedPanel",
2682
+ props: {
2683
+ designerState: {},
2684
+ advancedPanel: {}
2685
+ },
2686
+ setup(e) {
2687
+ let n = e, i = a(() => n.designerState.selectNodes);
2688
+ function u(e) {
2689
+ let t = P.trim(e).match(/^(.+?)\s+in\s+(.+)$/);
2690
+ if (!t) return;
2691
+ let n = P.trim(t[1]).replace(/^\((.+)\)$/, "$1"), r = P.trim(t[2]), i = n.split(",").map((e) => P.trim(e)).filter((e) => e.length > 0);
2692
+ if (!(i.length <= 0 || r.length <= 0)) return {
2693
+ data: r,
2694
+ item: i[0],
2695
+ key: i[1],
2696
+ index: i[2]
2697
+ };
2698
+ }
2699
+ function d(e) {
2700
+ if (t.isStr(e)) return e;
2701
+ if (!t.isObj(e)) return "";
2702
+ let n = [
2703
+ e.item,
2704
+ e.key,
2705
+ e.index
2706
+ ].filter((e) => t.isStr(e) && P.trim(e).length > 0).map((e) => P.trim(e)), r = t.isStr(e.data) ? P.trim(e.data) : "";
2707
+ return n.length <= 0 || r.length <= 0 ? "" : n.length > 1 ? `(${n.join(", ")}) in ${r}` : `${n[0]} in ${r}`;
2708
+ }
2709
+ function f(e) {
2710
+ if (!i.value[0]) return;
2711
+ let n = /* @__PURE__ */ new Set();
2712
+ for (let r of i.value) {
2713
+ let i = r.directives[e];
2714
+ n.add(t.isObj(i) && !t.isStr(i) ? i.value : i);
2715
+ }
2716
+ if (n.size === 1) return n.values().next().value;
2717
+ }
2718
+ let p = a(() => {
2719
+ let e = i.value[0];
2720
+ return !e || (t.isObj(e.props?.style) ? e.props.style : {}).display !== "none";
2721
+ }), m = a(() => t.isStr(f("if")) ? f("if") : String(f("if") ?? "")), h = a(() => d(f("for")));
2722
+ function g(e, t, n) {
2723
+ n.length <= 0 || e.commandStack.execute(new W(e, t, { changes: n }));
2724
+ }
2725
+ function _(e) {
2726
+ let r = n.designerState;
2727
+ if (!r.blockInstance) return;
2728
+ let a = [];
2729
+ for (let n of i.value) {
2730
+ let r = t.isObj(n.props?.style) ? { ...n.props.style } : {}, i = n.props.style;
2731
+ e ? r.display === "none" && delete r.display : r.display = "none", !P.isEqual(i, r) && a.push({
2732
+ nodeId: n.id,
2733
+ changeKey: "style:display",
2734
+ oldValue: i,
2735
+ newValue: r,
2736
+ write: (e, n) => {
2737
+ e.props.style = t.isObj(n) ? n : void 0;
2738
+ }
2739
+ });
2740
+ }
2741
+ g(r, e ? "显示节点" : "隐藏节点", a);
2742
+ }
2743
+ function v(e, r) {
2744
+ let a = n.designerState;
2745
+ if (!a.blockInstance) return;
2746
+ let o = P.trim(String(r ?? "")), s;
2747
+ if (e === "for") {
2748
+ if (o.length > 0 && (s = u(o), !s)) return;
2749
+ } else s = o.length > 0 ? o : void 0;
2750
+ let c = [];
2751
+ for (let n of i.value) {
2752
+ let r = n.directives[e];
2753
+ P.isEqual(r, s) || c.push({
2754
+ nodeId: n.id,
2755
+ changeKey: `directives:${e}`,
2756
+ oldValue: r,
2757
+ newValue: s,
2758
+ write: (n, r) => {
2759
+ t.noValue(r) ? delete n.directives[e] : n.directives[e] = r;
2760
+ }
2761
+ });
2762
+ }
2763
+ g(a, `修改 v-${e} 指令`, c);
2764
+ }
2765
+ return (e, t) => (S(), c("div", {
2766
+ key: n.designerState.setterShareState.panelVersion,
2767
+ class: "designer-advanced-panel"
2768
+ }, [n.designerState.existsSelection ? (S(), c(r, { key: 1 }, [
2769
+ n.advancedPanel?.disableVShow ? s("", !0) : (S(), c("div", On, [t[3] ||= l("div", { class: "designer-advanced-label" }, "显示(v-show)", -1), l("div", kn, [l("label", An, [l("input", {
2770
+ type: "checkbox",
2771
+ checked: p.value,
2772
+ onChange: t[0] ||= (e) => _(e.target.checked)
2773
+ }, null, 40, jn), l("span", null, D(p.value ? "显示" : "隐藏"), 1)])])])),
2774
+ n.advancedPanel?.disableVIf ? s("", !0) : (S(), c("div", Mn, [t[4] ||= l("div", { class: "designer-advanced-label" }, "条件渲染(v-if)", -1), l("div", Nn, [l("textarea", {
2775
+ class: "designer-advanced-textarea",
2776
+ placeholder: "条件表达式, 如: {{ flag }} 或 flag === 1; 留空删除指令",
2777
+ value: m.value,
2778
+ onChange: t[1] ||= (e) => v("if", e.target.value)
2779
+ }, null, 40, Pn)])])),
2780
+ n.advancedPanel?.disableVFor ? s("", !0) : (S(), c("div", Fn, [t[5] ||= l("div", { class: "designer-advanced-label" }, "循环渲染(v-for)", -1), l("div", In, [l("textarea", {
2781
+ class: "designer-advanced-textarea",
2782
+ placeholder: "循环表达式, 如: item in items; 留空删除指令",
2783
+ value: h.value,
2784
+ onChange: t[2] ||= (e) => v("for", e.target.value)
2785
+ }, null, 40, Ln)])]))
2786
+ ], 64)) : (S(), o(O(he), {
2787
+ key: 0,
2788
+ description: "请选择画布中的组件"
2789
+ }))]));
2790
+ }
2791
+ }), [["__scopeId", "data-v-32c36650"]]), zn = { class: "designer-material-panel" }, Bn = { class: "designer-material-search" }, Vn = { key: 0 }, Hn = { class: "designer-material-group-title" }, Un = { class: "designer-material-items" }, Wn = ["data-component-type", "title"], Gn = {
2792
+ key: 1,
2793
+ class: "designer-material-empty"
2794
+ }, Kn = /*#__PURE__*/ G(/* @__PURE__ */ f({
2795
+ name: "MaterialPanel",
2796
+ __name: "MaterialPanel",
2797
+ props: {
2798
+ designerState: {},
2799
+ materialTabs: {},
2800
+ dependence: {}
2801
+ },
2802
+ setup(e) {
2803
+ let t = e, n = w(""), i = w({});
2804
+ x(async () => {
2805
+ let e = /* @__PURE__ */ new Set(), n = (r) => {
2806
+ if (e.has(r)) return;
2807
+ e.add(r);
2808
+ let i = t.dependence?.[r];
2809
+ i && i.forEach((e) => n(e));
2810
+ };
2811
+ for (let e of t.materialTabs ?? []) for (let t of e.groups) for (let e of t.types) n(e);
2812
+ if (!(e.size <= 0)) try {
2813
+ let n = Array.from(e), [r] = await Promise.all([t.designerState.designerEngine.componentManage.loadAsyncComponentMeta(n), t.designerState.designerEngine.componentManage.loadAsyncComponent(n.filter((e) => !ue(e)))]);
2814
+ i.value = r;
2815
+ } catch (e) {
2816
+ console.warn("加载物料元信息失败", e);
2817
+ }
2818
+ });
2819
+ let u = a(() => {
2820
+ let e = (n.value ?? "").trim().toLowerCase();
2821
+ return (t.materialTabs ?? []).map((t) => ({
2822
+ ...t,
2823
+ groups: t.groups.map((e) => ({
2824
+ ...e,
2825
+ metas: e.types.map((e) => i.value[e]).filter(Boolean)
2826
+ })).filter((e) => e.metas.length > 0).map((t) => ({
2827
+ ...t,
2828
+ metas: e.length > 0 ? t.metas.filter((t) => t.name.toLowerCase().includes(e) || t.type.toLowerCase().includes(e)) : t.metas
2829
+ })).filter((e) => e.metas.length > 0)
2830
+ })).filter((e) => e.groups.length > 0);
2831
+ }), f = a(() => u.value.map((e) => ({
2832
+ key: e.title,
2833
+ label: e.title
2834
+ })));
2835
+ return (e, t) => (S(), c("div", zn, [l("div", Bn, [d(O(ge), {
2836
+ value: n.value,
2837
+ "onUpdate:value": t[0] ||= (e) => n.value = e,
2838
+ size: "small",
2839
+ allowClear: "",
2840
+ placeholder: "搜索组件"
2841
+ }, null, 8, ["value"])]), u.value.length > 0 ? (S(), o(O(be), {
2842
+ key: 0,
2843
+ size: "small",
2844
+ class: "designer-material-tabs",
2845
+ items: f.value
2846
+ }, {
2847
+ contentRender: A(({ item: e }) => [(S(!0), c(r, null, T(u.value, (t) => (S(), c(r, { key: t.title }, [t.title === e.key ? (S(), c("div", Vn, [(S(!0), c(r, null, T(t.groups, (e) => (S(), c("div", {
2848
+ key: e.title,
2849
+ class: "designer-material-group"
2850
+ }, [l("div", Hn, D(e.title), 1), l("div", Un, [(S(!0), c(r, null, T(e.metas, (e) => (S(), c("div", {
2851
+ key: e.type,
2852
+ class: "draggable material-item",
2853
+ "data-component-type": e.type,
2854
+ title: e.type
2855
+ }, D(e.name), 9, Wn))), 128))])]))), 128))])) : s("", !0)], 64))), 128))]),
2856
+ _: 1
2857
+ }, 8, ["items"])) : (S(), c("div", Gn, "未配置物料或无匹配组件"))]));
2858
+ }
2859
+ }), [["__scopeId", "data-v-7b3124e5"]]), qn = { class: "designer-outline-panel" }, Jn = /*#__PURE__*/ G(/* @__PURE__ */ f({
2860
+ name: "OutlinePanel",
2861
+ __name: "OutlinePanel",
2862
+ props: { designerState: {} },
2863
+ setup(e) {
2864
+ let n = e;
2865
+ function r(e, i = 0) {
2866
+ if (i > 30) return [];
2867
+ let a = [];
2868
+ for (let o of e) {
2869
+ if (!t.isObj(o) || t.isArray(o)) continue;
2870
+ let e = o, s = n.designerState.designerEngine.componentManage.getComponentMeta(e.type), c = [];
2871
+ c.push(...r(e.items ?? [], i + 1));
2872
+ for (let t in e.slots) {
2873
+ let n = r(e.slots[t] ?? [], i + 1);
2874
+ n.length > 0 && c.push(...n);
2875
+ }
2876
+ a.push({
2877
+ title: s?.name ?? e.type,
2878
+ key: e.id,
2879
+ children: c.length > 0 ? c : void 0
2880
+ });
2881
+ }
2882
+ return a;
2883
+ }
2884
+ let i = a(() => {
2885
+ let e = n.designerState.blockInstance?.globalContext.runtimeBlock;
2886
+ return e ? r(e.items ?? []) : [];
2887
+ }), s = a(() => n.designerState.selections.map((e) => e.nodeId).filter(Boolean));
2888
+ function l(e) {
2889
+ e.length === 1 && n.designerState.selectNodeByIds([e[0]]);
2890
+ }
2891
+ return (e, t) => (S(), c("div", qn, [i.value.length <= 0 ? (S(), o(O(he), {
2892
+ key: 0,
2893
+ description: "画布为空"
2894
+ })) : (S(), o(O(we), {
2895
+ key: 1,
2896
+ "block-node": "",
2897
+ "tree-data": i.value,
2898
+ "selected-keys": s.value,
2899
+ "default-expand-all": "",
2900
+ onSelect: l
2901
+ }, null, 8, ["tree-data", "selected-keys"]))]));
2902
+ }
2903
+ }), [["__scopeId", "data-v-08830f87"]]), Yn = { class: "designer-workbench" }, Xn = { class: "designer-workbench-toolbar" }, Zn = { class: "designer-workbench-toolbar-group" }, Qn = { class: "designer-workbench-toolbar-group" }, $n = { class: "designer-workbench-body" }, er = { class: "designer-workbench-left" }, tr = { class: "designer-workbench-left-content" }, nr = { class: "designer-workbench-center" }, rr = { class: "designer-workbench-right" }, ir = { class: "designer-workbench-right-content" }, ar = /*#__PURE__*/ G(/* @__PURE__ */ f({
2904
+ name: "Workbench",
2905
+ __name: "Workbench",
2906
+ props: {
2907
+ designerState: {},
2908
+ block: {},
2909
+ materialTabs: {}
2910
+ },
2911
+ setup(e) {
2912
+ let t = e, n = a(() => t.designerState.designerEngine), r = w(!1), i = w("material"), s = w("props");
2913
+ function f() {
2914
+ t.designerState.commandStack.undo(), t.designerState.clearSelections();
2915
+ }
2916
+ function p() {
2917
+ t.designerState.commandStack.redo(), t.designerState.clearSelections();
2918
+ }
2919
+ function m() {
2920
+ let e = t.designerState.selections.map((e) => e.nodeId).filter(Boolean);
2921
+ if (e.length <= 0) return;
2922
+ let n = new Vt(t.designerState, `删除 ${e.length} 个组件`, {
2923
+ nodeIds: e,
2924
+ onExecute: () => t.designerState.clearSelections()
2925
+ });
2926
+ t.designerState.commandStack.execute(n);
2927
+ }
2928
+ function h() {
2929
+ let e = t.designerState.blockInstance?.globalContext.runtimeBlock;
2930
+ if (!e) return;
2931
+ let n = (e.items ?? []).filter((e) => !!e && typeof e == "object" && !Array.isArray(e)).map((e) => e.id);
2932
+ if (n.length <= 0) {
2933
+ Te.info("画布已经是空的");
2934
+ return;
2935
+ }
2936
+ let r = new Vt(t.designerState, "清空画布", {
2937
+ nodeIds: n,
2938
+ onExecute: () => t.designerState.clearSelections()
2939
+ });
2940
+ t.designerState.commandStack.execute(r);
2941
+ }
2942
+ let g = a(() => t.designerState.selectedComponentMeta?.setter?.props), _ = a(() => t.designerState.selectedComponentMeta?.setter?.style), v = a(() => t.designerState.selectedComponentMeta?.setter?.events), y = a(() => t.designerState.selectedComponentMeta?.setter?.advanced), b = a(() => {
2943
+ if (!r.value) return;
2944
+ let e = t.designerState.blockInstance?.globalContext.runtimeBlock;
2945
+ return e ? zt(e) : void 0;
2946
+ });
2947
+ return (a, x) => (S(), c("div", Yn, [
2948
+ l("div", Xn, [
2949
+ l("div", Zn, [
2950
+ d(O(I), { title: "撤销 Ctrl+Z" }, {
2951
+ default: A(() => [d(O(F), {
2952
+ size: "small",
2953
+ type: "text",
2954
+ disabled: !e.designerState.commandStack.canUndo || r.value,
2955
+ onClick: f
2956
+ }, {
2957
+ default: A(() => [d(O(je))]),
2958
+ _: 1
2959
+ }, 8, ["disabled"])]),
2960
+ _: 1
2961
+ }),
2962
+ d(O(I), { title: "重做 Ctrl+Y" }, {
2963
+ default: A(() => [d(O(F), {
2964
+ size: "small",
2965
+ type: "text",
2966
+ disabled: !e.designerState.commandStack.canRedo || r.value,
2967
+ onClick: p
2968
+ }, {
2969
+ default: A(() => [d(O(Ae))]),
2970
+ _: 1
2971
+ }, 8, ["disabled"])]),
2972
+ _: 1
2973
+ }),
2974
+ d(O(I), { title: "删除选中 Delete" }, {
2975
+ default: A(() => [d(O(F), {
2976
+ size: "small",
2977
+ type: "text",
2978
+ danger: "",
2979
+ disabled: !e.designerState.existsSelection || r.value,
2980
+ onClick: m
2981
+ }, {
2982
+ default: A(() => [d(O(De))]),
2983
+ _: 1
2984
+ }, 8, ["disabled"])]),
2985
+ _: 1
2986
+ }),
2987
+ d(O(I), { title: "清空画布" }, {
2988
+ default: A(() => [d(O(F), {
2989
+ size: "small",
2990
+ type: "text",
2991
+ danger: "",
2992
+ disabled: r.value,
2993
+ onClick: h
2994
+ }, {
2995
+ default: A(() => [d(O(Ee))]),
2996
+ _: 1
2997
+ }, 8, ["disabled"])]),
2998
+ _: 1
2999
+ })
3000
+ ]),
3001
+ x[3] ||= l("div", { class: "designer-workbench-toolbar-title" }, "可视化页面设计器", -1),
3002
+ l("div", Qn, [d(O(F), {
3003
+ size: "small",
3004
+ type: r.value ? "primary" : "default",
3005
+ onClick: x[0] ||= (e) => r.value = !r.value
3006
+ }, {
3007
+ default: A(() => [r.value ? (S(), o(O(Oe), { key: 1 })) : (S(), o(O(ke), { key: 0 })), u(" " + D(r.value ? "编辑" : "预览"), 1)]),
3008
+ _: 1
3009
+ }, 8, ["type"])])
3010
+ ]),
3011
+ l("div", $n, [
3012
+ l("div", er, [d(O(be), {
3013
+ activeKey: i.value,
3014
+ "onUpdate:activeKey": x[1] ||= (e) => i.value = e,
3015
+ size: "small",
3016
+ class: "designer-workbench-left-tabs",
3017
+ items: [{
3018
+ key: "material",
3019
+ label: "物料"
3020
+ }, {
3021
+ key: "outline",
3022
+ label: "大纲"
3023
+ }]
3024
+ }, null, 8, ["activeKey"]), l("div", tr, [j(d(Kn, {
3025
+ designerState: e.designerState,
3026
+ materialTabs: t.materialTabs
3027
+ }, null, 8, ["designerState", "materialTabs"]), [[k, i.value === "material"]]), j(d(Jn, { designerState: e.designerState }, null, 8, ["designerState"]), [[k, i.value === "outline"]])])]),
3028
+ l("div", nr, [r.value ? (S(), o(O(ie), {
3029
+ key: 1,
3030
+ class: "designer-workbench-preview",
3031
+ componentManage: n.value.componentManage,
3032
+ block: b.value,
3033
+ isDesigning: !1
3034
+ }, null, 8, ["componentManage", "block"])) : (S(), o(Kt, {
3035
+ key: 0,
3036
+ designerState: e.designerState,
3037
+ block: t.block
3038
+ }, null, 8, ["designerState", "block"]))]),
3039
+ l("div", rr, [d(O(be), {
3040
+ activeKey: s.value,
3041
+ "onUpdate:activeKey": x[2] ||= (e) => s.value = e,
3042
+ size: "small",
3043
+ class: "designer-workbench-right-tabs",
3044
+ items: [
3045
+ {
3046
+ key: "props",
3047
+ label: "属性"
3048
+ },
3049
+ {
3050
+ key: "style",
3051
+ label: "样式"
3052
+ },
3053
+ {
3054
+ key: "events",
3055
+ label: "事件"
3056
+ },
3057
+ {
3058
+ key: "advanced",
3059
+ label: "高级"
3060
+ }
3061
+ ]
3062
+ }, null, 8, ["activeKey"]), l("div", ir, [
3063
+ j(d(rn, {
3064
+ designerState: e.designerState,
3065
+ propsPanel: g.value
3066
+ }, null, 8, ["designerState", "propsPanel"]), [[k, s.value === "props"]]),
3067
+ j(d(yn, {
3068
+ designerState: e.designerState,
3069
+ stylePanel: _.value
3070
+ }, null, 8, ["designerState", "stylePanel"]), [[k, s.value === "style"]]),
3071
+ j(d(Dn, {
3072
+ designerState: e.designerState,
3073
+ eventPanel: v.value
3074
+ }, null, 8, ["designerState", "eventPanel"]), [[k, s.value === "events"]]),
3075
+ j(d(Rn, {
3076
+ designerState: e.designerState,
3077
+ advancedPanel: y.value
3078
+ }, null, 8, ["designerState", "advancedPanel"]), [[k, s.value === "advanced"]])
3079
+ ])])
3080
+ ]),
3081
+ d(Jt, { designerEngine: n.value }, null, 8, ["designerEngine"])
3082
+ ]));
3083
+ }
3084
+ }), [["__scopeId", "data-v-f0d077aa"]]), or = "存在多个不同值", sr = (e) => {
3085
+ if (!t.noValue(e)) return h(e);
3086
+ }, J = (e) => P.toString(e), cr = (e) => !!e, lr = (e) => {
3087
+ if (!t.noValue(e)) return e = P.toNumber(e), (e === Infinity || isNaN(e)) && (e = void 0), e;
3088
+ }, ur = (e) => e ? JSON.stringify(e, null, 4) : "";
3089
+ function Y() {
3090
+ return {
3091
+ multipleValues: !1,
3092
+ value: void 0
3093
+ };
3094
+ }
3095
+ function X(e, n, r) {
3096
+ let i = dr(e, n, r);
3097
+ return t.isFunction(r) && (i = r(i)), i;
3098
+ }
3099
+ function dr(e, n, r) {
3100
+ let { nodes: i, propsName: a, getPropsValue: o } = e;
3101
+ if (!i || !a && !t.isFunction(o)) return;
3102
+ let s = /* @__PURE__ */ new Set();
3103
+ for (let n of i) {
3104
+ let i;
3105
+ if (o ? i = o(n.props, n) : a && (i = P.hasIn(n.props, a) ? n.props?.[a] : e.defPropsValue), t.isFunction(r) && (i = r(i)), t.noValue(i) && (i = void 0), s.add(i), s.size > 1) break;
3106
+ }
3107
+ if (!(s.size <= 0)) {
3108
+ if (s.size === 1) return s.values().next().value;
3109
+ n.multipleValues = !0, n.value = void 0;
3110
+ }
3111
+ }
3112
+ function Z(e, n, r, i) {
3113
+ let { designerState: a, blockInstance: o, nodes: s, propsName: c, applyPropsValue: l, disableReRender: u, recalcAuxToolPosition: d, recalcAuxToolPositionDelay: f, updateVNodeKey: p } = e, m = !1;
3114
+ if (!s || !c && !t.isFunction(l)) return m;
3115
+ if (t.isFunction(l)) {
3116
+ for (let e of s) m = l(e.props, i, e, r) !== !1, p && m && (e.designExt.designKey = `__design_key_${Date.now()}_${Math.random().toString(36).slice(2, 12)}`);
3117
+ return m && (n.multipleValues = !1, fr(a, o, s, u, d, f)), m;
3118
+ }
3119
+ if (!c) return m;
3120
+ let h = [];
3121
+ for (let e of s) {
3122
+ if (!e.props) continue;
3123
+ let t = P.hasIn(e.props, c) ? P.cloneDeep(e.props[c]) : void 0;
3124
+ P.isEqual(t, i) || h.push({
3125
+ nodeId: e.id,
3126
+ changeKey: `props:${c}`,
3127
+ oldValue: t,
3128
+ newValue: i,
3129
+ write: (e, t) => {
3130
+ e.props[c] = t, p && (e.designExt.designKey = `__design_key_${Date.now()}_${Math.random().toString(36).slice(2, 12)}`);
3131
+ }
3132
+ });
3133
+ }
3134
+ if (h.length <= 0) return m;
3135
+ let g = new W(a, `修改属性 ${c}`, {
3136
+ changes: h,
3137
+ disableReRender: u
3138
+ });
3139
+ return m = a.commandStack.execute(g), m && (n.multipleValues = !1), m;
3140
+ }
3141
+ function fr(e, t, n, r, i, a) {
3142
+ if (!r && t && (t.$forceUpdate(), i)) {
3143
+ let r = () => {
3144
+ let t = n.map((e) => e.id);
3145
+ for (let n of e.selections) n.nodeId && t.includes(n.nodeId) && n.recalcPosition();
3146
+ };
3147
+ t.$nextTick(() => {
3148
+ (a ?? 0) > 0 ? setTimeout(r, a) : r();
3149
+ });
3150
+ }
3151
+ }
3152
+ function Q(e, t, n) {
3153
+ re(() => e.nodes, () => {
3154
+ t.value = X(e, t, n);
3155
+ });
3156
+ }
3157
+ function $(e, n, r, i) {
3158
+ return {
3159
+ designerState: e.designerState,
3160
+ blockInstance: e.blockInstance,
3161
+ nodes: e.nodes,
3162
+ getValue: () => n.value,
3163
+ setValue: (a) => {
3164
+ t.isFunction(i) && (a = i(a)), n.value = a, Z(e, n, r, a);
3165
+ }
3166
+ };
3167
+ }
3168
+ //#endregion
3169
+ //#region src/components/setter/StringSetter.vue
3170
+ var pr = /* @__PURE__ */ f({
3171
+ name: "StringSetter",
3172
+ __name: "StringSetter",
3173
+ props: {
3174
+ designerState: {},
3175
+ blockInstance: {},
3176
+ nodes: {},
3177
+ watchValue: { type: Boolean },
3178
+ propsName: {},
3179
+ getPropsValue: {},
3180
+ defPropsValue: {},
3181
+ applyPropsValue: {},
3182
+ disableReRender: { type: Boolean },
3183
+ updateVNodeKey: { type: Boolean },
3184
+ recalcAuxToolPosition: { type: Boolean },
3185
+ recalcAuxToolPositionDelay: {}
3186
+ },
3187
+ setup(e, { expose: t }) {
3188
+ let n = p(), r = e, i = C({ ...Y() });
3189
+ return i.value = X(r, i, J), Q(r, i, J), t({ ...$(r, i, n?.proxy, J) }), (e, t) => (S(), o(O(ge), g({
3190
+ placeholder: i.multipleValues ? "存在多个不同值" : "请输入",
3191
+ title: i.multipleValues ? "存在多个不同值" : void 0
3192
+ }, e.$attrs, {
3193
+ value: i.value,
3194
+ "onUpdate:value": t[0] ||= (e) => i.value = e,
3195
+ onChange: t[1] ||= () => O(Z)(r, i, O(n)?.proxy, i.value)
3196
+ }), null, 16, [
3197
+ "placeholder",
3198
+ "title",
3199
+ "value"
3200
+ ]));
3201
+ }
3202
+ }), mr = /*#__PURE__*/ G(/* @__PURE__ */ f({
3203
+ name: "NumberSetter",
3204
+ __name: "NumberSetter",
3205
+ props: {
3206
+ designerState: {},
3207
+ blockInstance: {},
3208
+ nodes: {},
3209
+ watchValue: { type: Boolean },
3210
+ propsName: {},
3211
+ getPropsValue: {},
3212
+ defPropsValue: {},
3213
+ applyPropsValue: {},
3214
+ disableReRender: { type: Boolean },
3215
+ updateVNodeKey: { type: Boolean },
3216
+ recalcAuxToolPosition: { type: Boolean },
3217
+ recalcAuxToolPositionDelay: {}
3218
+ },
3219
+ setup(e, { expose: t }) {
3220
+ let n = p(), r = e, i = C({ ...Y() });
3221
+ return i.value = X(r, i, lr), Q(r, i, lr), t({ ...$(r, i, n?.proxy, lr) }), (e, t) => (S(), o(O(_e), g({
3222
+ class: "designer-setter-full",
3223
+ placeholder: i.multipleValues ? "存在多个不同值" : "请输入"
3224
+ }, e.$attrs, {
3225
+ value: i.value,
3226
+ "onUpdate:value": t[0] ||= (e) => i.value = e,
3227
+ onChange: t[1] ||= (e) => O(Z)(r, i, O(n)?.proxy, e)
3228
+ }), null, 16, ["placeholder", "value"]));
3229
+ }
3230
+ }), [["__scopeId", "data-v-88c57114"]]), hr = /* @__PURE__ */ f({
3231
+ name: "BoolSetter",
3232
+ __name: "BoolSetter",
3233
+ props: {
3234
+ designerState: {},
3235
+ blockInstance: {},
3236
+ nodes: {},
3237
+ watchValue: { type: Boolean },
3238
+ propsName: {},
3239
+ getPropsValue: {},
3240
+ defPropsValue: {},
3241
+ applyPropsValue: {},
3242
+ disableReRender: { type: Boolean },
3243
+ updateVNodeKey: { type: Boolean },
3244
+ recalcAuxToolPosition: { type: Boolean },
3245
+ recalcAuxToolPositionDelay: {}
3246
+ },
3247
+ setup(e, { expose: t }) {
3248
+ let n = p(), r = e, i = C({ ...Y() });
3249
+ return i.value = X(r, i, cr), Q(r, i, cr), t({ ...$(r, i, n?.proxy, cr) }), (e, t) => (S(), o(O(ye), g(e.$attrs, {
3250
+ checked: !!i.value,
3251
+ onChange: t[0] ||= (e) => {
3252
+ i.value = e, O(Z)(r, i, O(n)?.proxy, e);
3253
+ }
3254
+ }), null, 16, ["checked"]));
3255
+ }
3256
+ }), gr = /*#__PURE__*/ G(/* @__PURE__ */ f({
3257
+ name: "SelectSetter",
3258
+ __name: "SelectSetter",
3259
+ props: {
3260
+ designerState: {},
3261
+ blockInstance: {},
3262
+ nodes: {},
3263
+ watchValue: { type: Boolean },
3264
+ propsName: {},
3265
+ getPropsValue: {},
3266
+ defPropsValue: {},
3267
+ applyPropsValue: {},
3268
+ disableReRender: { type: Boolean },
3269
+ updateVNodeKey: { type: Boolean },
3270
+ recalcAuxToolPosition: { type: Boolean },
3271
+ recalcAuxToolPositionDelay: {}
3272
+ },
3273
+ setup(e, { expose: t }) {
3274
+ let n = p(), r = e, i = C({ ...Y() });
3275
+ return i.value = X(r, i, J), Q(r, i, J), t({ ...$(r, i, n?.proxy, J) }), (e, t) => (S(), o(O(ve), g({
3276
+ class: "designer-setter-full",
3277
+ placeholder: i.multipleValues ? "存在多个不同值" : "请选择"
3278
+ }, e.$attrs, {
3279
+ value: i.value,
3280
+ onChange: t[0] ||= (e) => {
3281
+ i.value = e, O(Z)(r, i, O(n)?.proxy, e);
3282
+ }
3283
+ }), null, 16, ["placeholder", "value"]));
3284
+ }
3285
+ }), [["__scopeId", "data-v-1e6d81c2"]]), _r = { class: "designer-color-setter" }, vr = ["value"], yr = { class: "color-text" }, br = /*#__PURE__*/ G(/* @__PURE__ */ f({
3286
+ name: "ColorSetter",
3287
+ __name: "ColorSetter",
3288
+ props: {
3289
+ designerState: {},
3290
+ blockInstance: {},
3291
+ nodes: {},
3292
+ watchValue: { type: Boolean },
3293
+ propsName: {},
3294
+ getPropsValue: {},
3295
+ defPropsValue: {},
3296
+ applyPropsValue: {},
3297
+ disableReRender: { type: Boolean },
3298
+ updateVNodeKey: { type: Boolean },
3299
+ recalcAuxToolPosition: { type: Boolean },
3300
+ recalcAuxToolPositionDelay: {}
3301
+ },
3302
+ setup(e, { expose: t }) {
3303
+ let n = p(), r = e, i = C({ ...Y() });
3304
+ i.value = X(r, i, J), Q(r, i, J);
3305
+ function a() {
3306
+ i.value = void 0, Z(r, i, n?.proxy, void 0);
3307
+ }
3308
+ return t({ ...$(r, i, n?.proxy, J) }), (e, t) => (S(), c("div", _r, [
3309
+ l("input", {
3310
+ class: "color-input",
3311
+ type: "color",
3312
+ value: i.value ?? "#000000",
3313
+ onChange: t[0] ||= (e) => {
3314
+ i.value = e.target.value, O(Z)(r, i, O(n)?.proxy, i.value);
3315
+ }
3316
+ }, null, 40, vr),
3317
+ l("span", yr, D(i.value), 1),
3318
+ j(l("span", {
3319
+ class: "color-clear",
3320
+ title: "清除颜色",
3321
+ onClick: a
3322
+ }, "×", 512), [[k, i.value]])
3323
+ ]));
3324
+ }
3325
+ }), [["__scopeId", "data-v-dc1ec0da"]]), xr = /*#__PURE__*/ G(/* @__PURE__ */ f({
3326
+ name: "DateSetter",
3327
+ __name: "DateSetter",
3328
+ props: {
3329
+ designerState: {},
3330
+ blockInstance: {},
3331
+ nodes: {},
3332
+ watchValue: { type: Boolean },
3333
+ propsName: {},
3334
+ getPropsValue: {},
3335
+ defPropsValue: {},
3336
+ applyPropsValue: {},
3337
+ disableReRender: { type: Boolean },
3338
+ updateVNodeKey: { type: Boolean },
3339
+ recalcAuxToolPosition: { type: Boolean },
3340
+ recalcAuxToolPositionDelay: {}
3341
+ },
3342
+ setup(e, { expose: t }) {
3343
+ let n = p(), r = e, i = C({ ...Y() });
3344
+ i.value = X(r, i, J), Q(r, i, J);
3345
+ function a(e) {
3346
+ return e ? Ne(e) : void 0;
3347
+ }
3348
+ return t({ ...$(r, i, n?.proxy, J) }), (e, t) => (S(), o(O(me), g({
3349
+ class: "designer-setter-full",
3350
+ value: a(i.value)
3351
+ }, e.$attrs, {
3352
+ valueFormat: "YYYY-MM-DD",
3353
+ onChange: t[0] ||= (e, t) => {
3354
+ let a = Array.isArray(t) ? t[0] : t;
3355
+ i.value = a || void 0, O(Z)(r, i, O(n)?.proxy, i.value);
3356
+ }
3357
+ }), null, 16, ["value"]));
3358
+ }
3359
+ }), [["__scopeId", "data-v-bb6b512f"]]), Sr = /*#__PURE__*/ G(/* @__PURE__ */ f({
3360
+ name: "TimeSetter",
3361
+ __name: "TimeSetter",
3362
+ props: {
3363
+ designerState: {},
3364
+ blockInstance: {},
3365
+ nodes: {},
3366
+ watchValue: { type: Boolean },
3367
+ propsName: {},
3368
+ getPropsValue: {},
3369
+ defPropsValue: {},
3370
+ applyPropsValue: {},
3371
+ disableReRender: { type: Boolean },
3372
+ updateVNodeKey: { type: Boolean },
3373
+ recalcAuxToolPosition: { type: Boolean },
3374
+ recalcAuxToolPositionDelay: {}
3375
+ },
3376
+ setup(e, { expose: t }) {
3377
+ let n = p(), r = e, i = C({ ...Y() });
3378
+ i.value = X(r, i, J), Q(r, i, J);
3379
+ function a(e) {
3380
+ return e ? Ne(e, "HH:mm:ss") : void 0;
3381
+ }
3382
+ return t({ ...$(r, i, n?.proxy, J) }), (e, t) => (S(), o(O(Ce), g({
3383
+ class: "designer-setter-full",
3384
+ value: a(i.value)
3385
+ }, e.$attrs, {
3386
+ valueFormat: "HH:mm:ss",
3387
+ onChange: t[0] ||= (e, t) => {
3388
+ let a = Array.isArray(t) ? t[0] : t;
3389
+ i.value = a || void 0, O(Z)(r, i, O(n)?.proxy, i.value);
3390
+ }
3391
+ }), null, 16, ["value"]));
3392
+ }
3393
+ }), [["__scopeId", "data-v-4cba15d0"]]), Cr = /* @__PURE__ */ f({
3394
+ name: "EditorSetter",
3395
+ __name: "EditorSetter",
3396
+ props: {
3397
+ designerState: {},
3398
+ blockInstance: {},
3399
+ nodes: {},
3400
+ watchValue: { type: Boolean },
3401
+ propsName: {},
3402
+ getPropsValue: {},
3403
+ defPropsValue: {},
3404
+ applyPropsValue: {},
3405
+ disableReRender: { type: Boolean },
3406
+ updateVNodeKey: { type: Boolean },
3407
+ recalcAuxToolPosition: { type: Boolean },
3408
+ recalcAuxToolPositionDelay: {}
3409
+ },
3410
+ setup(e, { expose: t }) {
3411
+ let n = p(), r = e, i = C({ ...Y() });
3412
+ return i.value = X(r, i, J), Q(r, i, J), t({ ...$(r, i, n?.proxy, J) }), (e, t) => (S(), o(O(Se), g({ placeholder: i.multipleValues ? "存在多个不同值" : "请输入内容" }, e.$attrs, {
3413
+ value: i.value,
3414
+ "onUpdate:value": t[0] ||= (e) => i.value = e,
3415
+ autoSize: {
3416
+ minRows: 2,
3417
+ maxRows: 12
3418
+ },
3419
+ onChange: t[1] ||= () => O(Z)(r, i, O(n)?.proxy, i.value)
3420
+ }), null, 16, ["placeholder", "value"]));
3421
+ }
3422
+ });
3423
+ //#endregion
3424
+ //#region src/register/RegisterSetter.ts
3425
+ function wr(e) {
3426
+ e.registerComponent("StringSetter", pr), e.registerComponent("NumberSetter", mr), e.registerComponent("BoolSetter", hr), e.registerComponent("SelectSetter", gr), e.registerComponent("ColorSetter", br), e.registerComponent("DateSetter", xr), e.registerComponent("TimeSetter", Sr), e.registerComponent("EditorSetter", Cr);
3427
+ }
3428
+ //#endregion
3429
+ //#region src/index.ts
3430
+ var Tr = "1.1.0", Er = 6;
3431
+ //#endregion
3432
+ export { V as AbstractCursorEvent, Nt as AddNodesCommand, Tt as AuxToolEffect, Je as CommandEvent, pt as CommandStack, at as Cursor, St as CursorEffect, L as CursorStatus, Er as DESIGNER_STAGE, Tr as DESIGNER_VERSION, Kt as DesignCanvas, Pe as DesignerCursorMode, Ze as DesignerDriver, Qe as DesignerEffect, _t as DesignerEngine, B as DesignerEvent, Fe as DesignerLayout, Xe as DesignerModule, ht as DesignerState, Ie as DesignerTab, R as Direction, vt as DragDropDriver, qe as DragDropEvent, Jt as DragGhost, Ve as DragMoveEvent, Be as DragStartEvent, He as DragStopEvent, ot as DraggingCmpMetas, Ct as DraggingEffect, Le as EngineMountEvent, Re as EngineUnmountEvent, Ye as EventBus, lt as HoverDashed, st as Insertion, yt as KeyboardDriver, Kn as MaterialPanel, bt as MouseClickDriver, Ue as MouseClickEvent, We as MouseDoubleClickEvent, xt as MouseMoveDriver, Ge as MouseMoveEvent, Pt as MoveNodesCommand, Ht as NodeOperationEffect, Jn as OutlinePanel, z as PointDirection, Vt as RemoveNodesCommand, ut as Selection, Rn as SetterAdvancedPanel, Dn as SetterEventPanel, rn as SetterPropsPanel, mt as SetterShareState, yn as SetterStylePanel, Ke as ShortcutKeyEvent, Ut as UpdateListenersCommand, W as UpdatePropsCommand, ar as Workbench, At as applyAddNodes, un as applyClass, kt as applyMoveNodes, Z as applySetterValue, ln as applyStyle, on as applyStyleDebounceTime, H as calcAuxToolPosition, U as calcDistance, rt as calcNodeToCursorDistance, it as calcPositionDelta, et as defCursorPosition, ct as existsPlaceholder, fr as forceUpdateBlock, dn as getActiveClass, Y as getDefState, Dt as getNodeDocIndex, Et as getNodeInsertTarget, $ as getSetterExpose, X as getSetterValue, sn as getStyle, jt as insertionToTarget, wt as isAllowDrag, ur as jsonStringify, or as multipleValuesText, wr as registerSetterComponents, zt as runtimeNodeToDesignNode, an as styleGroupDefines, cr as toBool, lr as toNumber, sr as toObj, K as toObjectStyle, Mt as toRuntimeNodes, J as toStr, Q as watchNodes };