form-imagining 0.0.90-52-beta42 → 0.0.90-52-beta44

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 (93) hide show
  1. package/dist/App-Ct1o7jCs.js +32 -0
  2. package/dist/Area-DiY4lpVe.js +4 -0
  3. package/dist/Bar-DhVb8ncv.js +4 -0
  4. package/dist/CDrag-Bd__XCcH.js +216 -0
  5. package/dist/CRuler-Dk7dMRjy.js +343 -0
  6. package/dist/CTable copy-cxI_MWPW.js +585 -0
  7. package/dist/CTable-DqdWMqPn.js +587 -0
  8. package/dist/ChartsArea-CqZk3-tN.js +4 -0
  9. package/dist/ChartsBar-CQJrvMIl.js +4 -0
  10. package/dist/ChartsPie-DsFLOZVw.js +4 -0
  11. package/dist/CheckBoxModel-B3w4BJYD.js +4 -0
  12. package/dist/CheckBoxModel.vue_vue_type_script_setup_true_lang-4NckcA-4.js +46 -0
  13. package/dist/Col-CRKLx7ZS.js +4 -0
  14. package/dist/Collapse-BkvE-7vq.js +4 -0
  15. package/dist/CommonText copy-WNlqP0XV.js +209 -0
  16. package/dist/CommonText-ZeOoqkKa.js +223 -0
  17. package/dist/{Demo-D2gBh0uJ.js → Demo-BgBz6xzl.js} +1 -1
  18. package/dist/{Demo-Bp-b8cm4.js → Demo-Cy4KUhg4.js} +24 -24
  19. package/dist/FView-SeZhm99E.js +4 -0
  20. package/dist/FX-xKGaKeNy.js +4 -0
  21. package/dist/{FormGridCopy-BWuiuQwr.js → FormGridCopy-Casuz8pp.js} +24 -24
  22. package/dist/{FormImagining-DbG99MOv.js → FormImagining-CRuH2NjR.js} +1 -1
  23. package/dist/GenerateForm-jGB8trY-.js +4 -0
  24. package/dist/GenerateReport-Dg-EzVtx.js +4 -0
  25. package/dist/{HelloWorld-rT0HoIpb.js → HelloWorld-6fzb6U-G.js} +1 -1
  26. package/dist/Input-/345/210/240/351/231/{244-Cq4v096L.js → 244-By1XJCqN.js} +1 -1
  27. package/dist/Label-/345/210/240/351/231/{244-2KuvijP3.js → 244-BVnRMQ3X.js} +4 -4
  28. package/dist/LabelModel-CvYNYCmq.js +4 -0
  29. package/dist/LabelModel.vue_vue_type_script_setup_true_lang-D8Aw2TYs.js +44 -0
  30. package/dist/{Login-DHzu94eH.js → Login-CEtHGIaK.js} +1 -1
  31. package/dist/Pie-zHyK2C26.js +4 -0
  32. package/dist/PropertyIndex-Cs6taDzv.js +4 -0
  33. package/dist/PropertyIndex.vue_vue_type_script_setup_true_lang-BfItwvif.js +60 -0
  34. package/dist/RView-lDCduBIE.js +4 -0
  35. package/dist/SmallDashOutlined-73SDwdL8.js +292 -0
  36. package/dist/SqlModule-BH6MWNAi.js +4 -0
  37. package/dist/{SvgIconCopy-CicaZw9b.js → SvgIconCopy-B0B8-MJ6.js} +1 -1
  38. package/dist/TableBtnModal-BRyACoIX.js +4 -0
  39. package/dist/TableModel-RP67dZgJ.js +4 -0
  40. package/dist/TableModel.vue_vue_type_script_setup_true_lang-Ds4uWjYq.js +238 -0
  41. package/dist/TextModel-D1S-3ddL.js +9 -0
  42. package/dist/ViewPdf-ww6u86Oq.js +40 -0
  43. package/dist/childForm-BLQpkcjI.js +4 -0
  44. package/dist/{cssMode-FbhcNeH5.js → cssMode-ilBOWiq_.js} +1 -1
  45. package/dist/form-imagining.js +3 -3
  46. package/dist/form-imagining.umd.cjs +329 -321
  47. package/dist/{formTest-DlpXx2xT.js → formTest-C7xHWo1d.js} +5 -5
  48. package/dist/{freemarker2-DGyGVyR2.js → freemarker2-DsSXYDZq.js} +1 -1
  49. package/dist/{handlebars-iOuiw_s6.js → handlebars-BI6QMAEe.js} +7 -7
  50. package/dist/{html-DNCfTSi7.js → html-BzzAnZox.js} +1 -1
  51. package/dist/{htmlMode-CjwPqLzx.js → htmlMode-buEPAdZd.js} +19 -19
  52. package/dist/{index-DV6eSx0B.js → index-Bgo1HpCv.js} +1602 -1499
  53. package/dist/index-CDz48Ke1.js +36 -0
  54. package/dist/{index-B_TzhTrb.js → index-CMVfwxdq.js} +1 -1
  55. package/dist/index-CXDrYWGB.js +11 -0
  56. package/dist/index-DoTm9A03.js +4 -0
  57. package/dist/index-Dp_dvngB.js +76 -0
  58. package/dist/index-DseqCXSK.js +643 -0
  59. package/dist/index-EMmUhS9V.js +320 -0
  60. package/dist/index.vue_vue_type_script_setup_true_lang-Brd49ge9.js +112 -0
  61. package/dist/{javascript-TjVsMTrm.js → javascript-BS-cSfpo.js} +1 -1
  62. package/dist/{jsonMode-CUsGxNWh.js → jsonMode-CoGWXM4p.js} +1 -1
  63. package/dist/{liquid-BSkMrmzJ.js → liquid-BK903mPF.js} +1 -1
  64. package/dist/{mdx-ABzfEkLA.js → mdx-IrQkFxpM.js} +1 -1
  65. package/dist/{python-7rkFA2xE.js → python-C95ZPlK3.js} +1 -1
  66. package/dist/{razor-By3UnGst.js → razor-C9l8Lzew.js} +1 -1
  67. package/dist/style.css +1 -1
  68. package/dist/{tableSelectDemo-JHtLbVQK.js → tableSelectDemo-Beh9tPc3.js} +11 -11
  69. package/dist/{tableSelectDemo2-3BYy8itH.js → tableSelectDemo2-Bky9jgX6.js} +5 -5
  70. package/dist/test.pdf +59 -0
  71. package/dist/{tsMode-De1fSq_H.js → tsMode-DgaB7-Wp.js} +1 -1
  72. package/dist/{typescript-Vx3hjz3C.js → typescript-BcairAGn.js} +3 -3
  73. package/dist/{xml-DU3Ixiy-.js → xml-DvuEZUZc.js} +7 -7
  74. package/dist/{yaml-D1x_E0aW.js → yaml-g_WAfA9x.js} +1 -1
  75. package/package.json +2 -1
  76. package/dist/App-C4-DAF7F.js +0 -23
  77. package/dist/Area-DgIJ7TOf.js +0 -4
  78. package/dist/Bar-DP4UOaxO.js +0 -4
  79. package/dist/ChartsArea-CkT_XzEa.js +0 -4
  80. package/dist/ChartsBar-BEybvVIq.js +0 -4
  81. package/dist/ChartsPie-BvEkhKUC.js +0 -4
  82. package/dist/Col-Dt1tV-tp.js +0 -4
  83. package/dist/Collapse-D23gxk8N.js +0 -4
  84. package/dist/FView-niUJ5Ksv.js +0 -4
  85. package/dist/FX-HaYEyqHc.js +0 -4
  86. package/dist/GenerateForm-BhMaAhJR.js +0 -4
  87. package/dist/GenerateReport-BHSNv0MQ.js +0 -4
  88. package/dist/Pie-DAujBVGx.js +0 -4
  89. package/dist/RView-DBmu_xVp.js +0 -4
  90. package/dist/SqlModule-D-EnI0ze.js +0 -4
  91. package/dist/TableBtnModal-Dn2ifyB5.js +0 -4
  92. package/dist/childForm-CKCAFydq.js +0 -4
  93. package/dist/index-Bwbfi-D0.js +0 -9
@@ -0,0 +1,32 @@
1
+ import { defineComponent as c, onMounted as p, resolveComponent as i, createBlock as e, openBlock as o, unref as n, withCtx as t, createVNode as f, KeepAlive as u, resolveDynamicComponent as _ } from "vue";
2
+ import { l as m, R as s } from "./index-Bgo1HpCv.js";
3
+ const x = /* @__PURE__ */ c({
4
+ __name: "App",
5
+ setup(d) {
6
+ return p(() => {
7
+ }), (v, h) => {
8
+ const r = i("a-config-provider");
9
+ return o(), e(r, {
10
+ locale: n(m),
11
+ theme: { token: { fontSize: 13, borderRadius: 5, colorPrimary: "#1890ff" } }
12
+ }, {
13
+ default: t(() => [
14
+ f(n(s), null, {
15
+ default: t(({ Component: l, route: a }) => [
16
+ (o(), e(u, null, [
17
+ (o(), e(_(l), {
18
+ key: a.fullPath
19
+ }))
20
+ ], 1024))
21
+ ]),
22
+ _: 1
23
+ })
24
+ ]),
25
+ _: 1
26
+ }, 8, ["locale"]);
27
+ };
28
+ }
29
+ });
30
+ export {
31
+ x as default
32
+ };
@@ -0,0 +1,4 @@
1
+ import { v as f } from "./index-Bgo1HpCv.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,4 @@
1
+ import { w as f } from "./index-Bgo1HpCv.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,216 @@
1
+ import { defineComponent as Z, ref as W, computed as k, onMounted as _, watch as ee, onBeforeUnmount as te, createElementBlock as x, createCommentVNode as M, openBlock as R, normalizeStyle as le, normalizeClass as ae, renderSlot as ne, withModifiers as z } from "vue";
2
+ import { _ as re } from "./index-Bgo1HpCv.js";
3
+ const ie = /* @__PURE__ */ Z({
4
+ __name: "CDrag",
5
+ props: {
6
+ element: {},
7
+ rulerRef: {},
8
+ selected: { type: Boolean }
9
+ },
10
+ emits: ["update:element", "select"],
11
+ setup($, { emit: q }) {
12
+ var P, B, S, T;
13
+ const t = $, X = q, d = W(!1), y = W(!1), v = W(!!t.selected), u = W(null), Y = W({ x: 0, y: 0 }), f = W({
14
+ element: null,
15
+ startX: 0,
16
+ startY: 0,
17
+ startWidth: 0,
18
+ startHeight: 0,
19
+ direction: null
20
+ });
21
+ t.rulerRef && ((B = (P = t.rulerRef).getCanvasWidth) != null && B.call(P), (T = (S = t.rulerRef).getCanvasHeight) != null && T.call(S));
22
+ const n = W(null), A = k(() => {
23
+ var a;
24
+ return n.value && y.value ? n.value.width : ((a = t.element) == null ? void 0 : a.width) || 0;
25
+ }), G = k(() => {
26
+ var a;
27
+ return n.value && y.value ? n.value.height : ((a = t.element) == null ? void 0 : a.height) || 0;
28
+ }), J = k(() => {
29
+ var a;
30
+ return d.value && u.value ? u.value.x : n.value && y.value ? n.value.x : ((a = t.element) == null ? void 0 : a.x) || 0;
31
+ }), K = k(() => {
32
+ var a;
33
+ return d.value && u.value ? u.value.y : n.value && y.value ? n.value.y : ((a = t.element) == null ? void 0 : a.y) || 0;
34
+ });
35
+ k(() => {
36
+ var a;
37
+ return n.value && y.value ? n.value.color : (a = t.element) == null ? void 0 : a.color;
38
+ });
39
+ function O(a, e) {
40
+ a.preventDefault(), a.stopPropagation(), X("select", e), d.value = !0, u.value = e, Y.value = {
41
+ x: a.clientX - e.x,
42
+ y: a.clientY - e.y
43
+ }, t.rulerRef && t.rulerRef.startDrag(e.id, e.x, e.y, e.width, e.height), document.addEventListener("mousemove", L), document.addEventListener("mouseup", D);
44
+ }
45
+ function L(a) {
46
+ var o, s, h, m;
47
+ if (!d.value || !u.value) return;
48
+ let e = a.clientX - Y.value.x, l = a.clientY - Y.value.y, p = 800, c = 600;
49
+ t.rulerRef && (p = ((s = (o = t.rulerRef).getCanvasWidth) == null ? void 0 : s.call(o)) || 800, c = ((m = (h = t.rulerRef).getCanvasHeight) == null ? void 0 : m.call(h)) || 600);
50
+ const r = u.value.width, i = u.value.height;
51
+ if (e = Math.max(0, e), l = Math.max(0, l), e = Math.min(e, p - r), l = Math.min(l, c - i), e = Math.max(0, e), l = Math.max(0, l), t.rulerRef) {
52
+ const w = t.rulerRef.updateDragPosition(e, l);
53
+ w.snapX !== null && (e = w.snapX), w.snapY !== null && (l = w.snapY);
54
+ }
55
+ e = Math.max(0, e), l = Math.max(0, l), u.value.x = Number(e.toFixed(2)), u.value.y = Number(l.toFixed(2));
56
+ }
57
+ function D() {
58
+ t.rulerRef && t.rulerRef.endDrag(), u.value && t.element && (t.element.x = Number(u.value.x.toFixed(2)), t.element.y = Number(u.value.y.toFixed(2))), u.value && X("update:element", u.value), d.value = !1, document.removeEventListener("mousemove", L), document.removeEventListener("mouseup", D), u.value = null;
59
+ }
60
+ function b(a, e, l) {
61
+ a.preventDefault(), a.stopPropagation(), X("select", e), y.value = !0, n.value = { ...e }, f.value = {
62
+ element: e,
63
+ startX: a.clientX,
64
+ startY: a.clientY,
65
+ startWidth: e.width,
66
+ startHeight: e.height,
67
+ direction: l
68
+ }, t.rulerRef && t.rulerRef.startResize(e.id, e.x, e.y, e.width, e.height), document.addEventListener("mousemove", N), document.addEventListener("mouseup", F);
69
+ }
70
+ function N(a) {
71
+ var I, U, j, V;
72
+ const e = f.value;
73
+ if (!y.value || !e.element || !e.direction || !n.value) return;
74
+ const l = e.element, p = a.clientX - e.startX, c = a.clientY - e.startY;
75
+ let r = e.startWidth, i = e.startHeight, o = l.x, s = l.y;
76
+ const h = 20, m = 20;
77
+ switch (e.direction) {
78
+ case "bottom-right":
79
+ r = Math.max(h, e.startWidth + p), i = Math.max(m, e.startHeight + c);
80
+ break;
81
+ case "bottom-left":
82
+ r = Math.max(h, e.startWidth - p), i = Math.max(m, e.startHeight + c), o = l.x + (e.startWidth - r);
83
+ break;
84
+ case "top-right":
85
+ r = Math.max(h, e.startWidth + p), i = Math.max(m, e.startHeight - c), s = l.y + (e.startHeight - i);
86
+ break;
87
+ case "top-left":
88
+ r = Math.max(h, e.startWidth - p), i = Math.max(m, e.startHeight - c), o = l.x + (e.startWidth - r), s = l.y + (e.startHeight - i);
89
+ break;
90
+ case "bottom":
91
+ i = Math.max(m, e.startHeight + c);
92
+ break;
93
+ case "right":
94
+ r = Math.max(h, e.startWidth + p);
95
+ break;
96
+ case "top":
97
+ i = Math.max(m, e.startHeight - c), s = l.y + (e.startHeight - i);
98
+ break;
99
+ case "left":
100
+ r = Math.max(h, e.startWidth - p), o = l.x + (e.startWidth - r);
101
+ break;
102
+ }
103
+ if (t.rulerRef) {
104
+ const g = t.rulerRef.updateResizePosition(o, s, r, i);
105
+ if (g) {
106
+ if (g.snapX !== null && (e.direction === "left" || e.direction === "top-left" || e.direction === "bottom-left")) {
107
+ const H = g.snapX, E = o - H;
108
+ o = H, r = r + E;
109
+ }
110
+ if (g.snapY !== null && (e.direction === "top" || e.direction === "top-left" || e.direction === "top-right")) {
111
+ const H = g.snapY, E = s - H;
112
+ s = H, i = i + E;
113
+ }
114
+ }
115
+ }
116
+ let w = 800, C = 600;
117
+ if (t.rulerRef && (w = ((U = (I = t.rulerRef).getCanvasWidth) == null ? void 0 : U.call(I)) || 800, C = ((V = (j = t.rulerRef).getCanvasHeight) == null ? void 0 : V.call(j)) || 600), r < h)
118
+ if (e.direction === "left" || e.direction === "top-left" || e.direction === "bottom-left") {
119
+ const g = l.x + e.startWidth;
120
+ r = h, o = g - h;
121
+ } else
122
+ r = h;
123
+ if (r = Math.min(r, w), i < m)
124
+ if (e.direction === "top" || e.direction === "top-left" || e.direction === "top-right") {
125
+ const g = l.y + e.startHeight;
126
+ i = m, s = g - m;
127
+ } else
128
+ i = m;
129
+ i = Math.min(i, C), o = Math.max(0, o), s = Math.max(0, s), o = Math.min(o, w - r), s = Math.min(s, C - i), n.value.x = Number(o.toFixed(2)), n.value.y = Number(s.toFixed(2)), n.value.width = Math.round(r), n.value.height = Math.round(i);
130
+ }
131
+ function F() {
132
+ f.value.element && n.value && (f.value.element.x = Number(n.value.x.toFixed(2)), f.value.element.y = Number(n.value.y.toFixed(2)), f.value.element.width = Math.round(n.value.width), f.value.element.height = Math.round(n.value.height)), f.value.element && X("update:element", f.value.element), y.value = !1, n.value = null, f.value = {
133
+ element: null,
134
+ startX: 0,
135
+ startY: 0,
136
+ startWidth: 0,
137
+ startHeight: 0,
138
+ direction: null
139
+ }, t.rulerRef && t.rulerRef.endResize(), document.removeEventListener("mousemove", N), document.removeEventListener("mouseup", F);
140
+ }
141
+ _(() => {
142
+ t.rulerRef && t.element && t.rulerRef.addDraggableElement(t.element);
143
+ }), ee(
144
+ () => t.selected,
145
+ (a) => {
146
+ v.value = !!a;
147
+ },
148
+ { immediate: !0 }
149
+ ), te(() => {
150
+ });
151
+ function Q() {
152
+ var a, e;
153
+ return t.rulerRef && ((e = (a = t.rulerRef).getCanvasWidth) == null ? void 0 : e.call(a)) || 800;
154
+ }
155
+ return (a, e) => t.element ? (R(), x("div", {
156
+ key: 0,
157
+ class: ae(["draggable-element", { selected: v.value }]),
158
+ style: le({
159
+ width: A.value + "px",
160
+ maxWidth: Q() + "px",
161
+ height: G.value + "px",
162
+ left: J.value + "px",
163
+ top: K.value + "px",
164
+ position: "absolute",
165
+ display: "flex",
166
+ justifyContent: "flex-start"
167
+ }),
168
+ onMousedown: e[8] || (e[8] = (l) => O(l, t.element))
169
+ }, [
170
+ ne(a.$slots, "default", {}, void 0, !0),
171
+ v.value && !d.value ? (R(), x("div", {
172
+ key: 0,
173
+ class: "resize-handle resize-handle-bottom-right",
174
+ onMousedown: e[0] || (e[0] = z((l) => b(l, t.element, "bottom-right"), ["stop"]))
175
+ }, null, 32)) : M("", !0),
176
+ v.value && !d.value ? (R(), x("div", {
177
+ key: 1,
178
+ class: "resize-handle resize-handle-bottom-left",
179
+ onMousedown: e[1] || (e[1] = z((l) => b(l, t.element, "bottom-left"), ["stop"]))
180
+ }, null, 32)) : M("", !0),
181
+ v.value && !d.value ? (R(), x("div", {
182
+ key: 2,
183
+ class: "resize-handle resize-handle-top-right",
184
+ onMousedown: e[2] || (e[2] = z((l) => b(l, t.element, "top-right"), ["stop"]))
185
+ }, null, 32)) : M("", !0),
186
+ v.value && !d.value ? (R(), x("div", {
187
+ key: 3,
188
+ class: "resize-handle resize-handle-top-left",
189
+ onMousedown: e[3] || (e[3] = z((l) => b(l, t.element, "top-left"), ["stop"]))
190
+ }, null, 32)) : M("", !0),
191
+ v.value && !d.value ? (R(), x("div", {
192
+ key: 4,
193
+ class: "resize-handle resize-handle-bottom",
194
+ onMousedown: e[4] || (e[4] = z((l) => b(l, t.element, "bottom"), ["stop"]))
195
+ }, null, 32)) : M("", !0),
196
+ v.value && !d.value ? (R(), x("div", {
197
+ key: 5,
198
+ class: "resize-handle resize-handle-right",
199
+ onMousedown: e[5] || (e[5] = z((l) => b(l, t.element, "right"), ["stop"]))
200
+ }, null, 32)) : M("", !0),
201
+ v.value && !d.value ? (R(), x("div", {
202
+ key: 6,
203
+ class: "resize-handle resize-handle-top",
204
+ onMousedown: e[6] || (e[6] = z((l) => b(l, t.element, "top"), ["stop"]))
205
+ }, null, 32)) : M("", !0),
206
+ v.value && !d.value ? (R(), x("div", {
207
+ key: 7,
208
+ class: "resize-handle resize-handle-left",
209
+ onMousedown: e[7] || (e[7] = z((l) => b(l, t.element, "left"), ["stop"]))
210
+ }, null, 32)) : M("", !0)
211
+ ], 38)) : M("", !0);
212
+ }
213
+ }), se = /* @__PURE__ */ re(ie, [["__scopeId", "data-v-25a8f0a8"]]);
214
+ export {
215
+ se as default
216
+ };
@@ -0,0 +1,343 @@
1
+ import { defineComponent as gt, ref as y, computed as k, onMounted as vt, watch as A, createElementBlock as R, openBlock as z, createElementVNode as S, normalizeStyle as b, renderSlot as mt, Fragment as G, renderList as J, normalizeClass as pt, nextTick as Pt } from "vue";
2
+ import { _ as Ct } from "./index-Bgo1HpCv.js";
3
+ const Mt = ["width"], yt = ["width", "height"], xt = ["width", "height"], wt = { class: "alignment-lines-container" }, bt = 25.4, kt = 96, Rt = /* @__PURE__ */ gt({
4
+ __name: "CRuler",
5
+ props: {
6
+ width: { default: 500 },
7
+ height: { default: 300 },
8
+ scale: { default: 1 },
9
+ scrollXmm: { default: 0 },
10
+ scrollYmm: { default: 0 },
11
+ thick: { default: 30 },
12
+ longTickColor: { default: "#555" },
13
+ shortTickColor: { default: "#ccc" },
14
+ rulerWidth: { default: void 0 },
15
+ rulerHeight: { default: void 0 },
16
+ alignmentLineColor: { default: "#1890ff" },
17
+ alignmentThreshold: { default: 5 },
18
+ margin: { default: [10, 10, 10, 10] }
19
+ },
20
+ emits: ["update:pageCount"],
21
+ setup(u, { expose: K, emit: O }) {
22
+ const $ = y([]), h = y([]), r = y(null), B = kt / bt, i = u, v = k(() => B * i.scale), m = k(() => i.rulerWidth || Math.round(i.width * v.value)), T = k(() => i.rulerHeight || Math.round(i.height * v.value)), x = y(1), L = k(() => Math.round(T.value - (i.margin[0] + i.margin[2]))), p = k(() => x.value === 1 ? Math.round(T.value) : Math.round(T.value + L.value * (x.value - 1))), Q = O, Y = y(null), W = y(null), Z = y(null);
23
+ function _() {
24
+ let t = 0;
25
+ for (const n of h.value) {
26
+ const e = n.y + n.height;
27
+ e > t && (t = e);
28
+ }
29
+ if (r.value) {
30
+ const n = r.value.y + r.value.height;
31
+ n > t && (t = n);
32
+ }
33
+ return t;
34
+ }
35
+ function w() {
36
+ const t = _(), n = T.value - (i.margin[0] + i.margin[2]);
37
+ if (n <= 0)
38
+ return;
39
+ const e = Math.max(1, Math.ceil(t / n));
40
+ e !== x.value && (x.value = e, Q("update:pageCount", e));
41
+ }
42
+ vt(() => {
43
+ w();
44
+ });
45
+ function V(t, n) {
46
+ const e = t, o = e + n;
47
+ return {
48
+ startMm: Math.floor(e) - 1,
49
+ // 起始位置提前1mm,确保0刻度完全显示
50
+ endMm: Math.ceil(o)
51
+ };
52
+ }
53
+ function tt(t, n, e, o, a, s, c, P) {
54
+ const l = window.devicePixelRatio || 1, g = B * e;
55
+ t.clearRect(0, 0, n * l, a * l), t.save(), t.scale(l, l), t.font = '11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif', t.lineWidth = 1;
56
+ const { startMm: E, endMm: I } = V(o, s), X = n;
57
+ for (let d = E; d <= I; d++) {
58
+ const f = (d - o) * g;
59
+ if (f < -10 || f > X + 10) continue;
60
+ const C = d % 10 === 0, M = C ? a * 0.5 : a * 0.2;
61
+ t.strokeStyle = C ? c : P, t.beginPath(), t.moveTo(f, a), t.lineTo(f, a - M), t.stroke(), C && (t.fillStyle = c, d === 0 ? (t.textAlign = "left", t.fillText((d / 10).toString(), f + 2, a - M - 3)) : (t.textAlign = "center", t.fillText((d / 10).toString(), f, a - M - 3)));
62
+ }
63
+ t.restore();
64
+ }
65
+ function et(t, n, e, o, a, s, c, P) {
66
+ const l = window.devicePixelRatio || 1, g = B * e;
67
+ t.clearRect(0, 0, a * l, n * l), t.save(), t.scale(l, l), t.font = '11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif', t.textAlign = "right", t.textBaseline = "middle", t.lineWidth = 1;
68
+ const { startMm: E, endMm: I } = V(o, s), X = n;
69
+ for (let d = E; d <= I; d++) {
70
+ const f = (d - o) * g;
71
+ if (f < -10 || f > X + 10) continue;
72
+ const C = d % 10 === 0, M = C ? a * 0.5 : a * 0.2;
73
+ t.strokeStyle = C ? c : P, t.beginPath(), t.moveTo(a, f), t.lineTo(a - M, f), t.stroke(), C && (t.fillStyle = c, d === 0 ? (t.textBaseline = "top", t.fillText((d / 10).toString(), a - M - 4, f + 2)) : (t.textBaseline = "middle", t.fillText((d / 10).toString(), a - M - 4, f)));
74
+ }
75
+ t.restore();
76
+ }
77
+ function D() {
78
+ const t = Y.value;
79
+ if (!t) return;
80
+ const n = t.getContext("2d");
81
+ if (!n) return;
82
+ const e = window.devicePixelRatio || 1, o = m.value, a = i.thick;
83
+ t.width = o * e, t.height = a * e, tt(
84
+ n,
85
+ o,
86
+ i.scale,
87
+ i.scrollXmm,
88
+ a,
89
+ i.width,
90
+ i.longTickColor,
91
+ i.shortTickColor
92
+ );
93
+ }
94
+ function F() {
95
+ const t = W.value;
96
+ if (!t) return;
97
+ const n = t.getContext("2d");
98
+ if (!n) return;
99
+ const e = window.devicePixelRatio || 1, o = p.value, a = i.thick;
100
+ t.width = a * e, t.height = o * e, et(
101
+ n,
102
+ o,
103
+ i.scale,
104
+ i.scrollYmm,
105
+ a,
106
+ i.height * x.value,
107
+ i.longTickColor,
108
+ i.shortTickColor
109
+ );
110
+ }
111
+ async function nt() {
112
+ await Pt(), D(), F();
113
+ }
114
+ A(
115
+ () => [i.scale, i.width, i.height, m.value, p.value],
116
+ () => {
117
+ nt();
118
+ },
119
+ { immediate: !0 }
120
+ ), A(
121
+ () => [i.scrollXmm],
122
+ () => D()
123
+ ), A(
124
+ () => [i.scrollYmm],
125
+ () => F()
126
+ );
127
+ function H(t) {
128
+ return {
129
+ left: t.x,
130
+ top: t.y,
131
+ right: t.x + t.width,
132
+ bottom: t.y + t.height
133
+ // centerX: element.x + element.width / 2,
134
+ // centerY: element.y + element.height / 2
135
+ };
136
+ }
137
+ function it(t, n, e) {
138
+ const o = H(t);
139
+ n.forEach((a) => {
140
+ if (a.id === t.id) return;
141
+ const s = H(a), c = [
142
+ { draggedPos: o.left, otherPos: s.left },
143
+ { draggedPos: o.left, otherPos: s.right },
144
+ { draggedPos: o.right, otherPos: s.left },
145
+ { draggedPos: o.right, otherPos: s.right }
146
+ ], P = [
147
+ { draggedPos: o.top, otherPos: s.top },
148
+ { draggedPos: o.top, otherPos: s.bottom },
149
+ { draggedPos: o.bottom, otherPos: s.top },
150
+ { draggedPos: o.bottom, otherPos: s.bottom }
151
+ ];
152
+ c.forEach((l) => {
153
+ Math.abs(l.draggedPos - l.otherPos) <= i.alignmentThreshold && (e.snapX || (e.snapX = t.x + (l.otherPos - l.draggedPos)), e.lines.push({
154
+ position: l.otherPos,
155
+ type: "vertical",
156
+ color: i.alignmentLineColor,
157
+ thickness: 1
158
+ }));
159
+ }), P.forEach((l) => {
160
+ Math.abs(l.draggedPos - l.otherPos) <= i.alignmentThreshold && (e.snapY || (e.snapY = t.y + (l.otherPos - l.draggedPos)), e.lines.push({
161
+ position: l.otherPos,
162
+ type: "horizontal",
163
+ color: i.alignmentLineColor,
164
+ thickness: 1
165
+ }));
166
+ });
167
+ });
168
+ }
169
+ function ot(t, n) {
170
+ const e = H(t);
171
+ [
172
+ e.left,
173
+ // 左边缘
174
+ e.right
175
+ // 右边缘
176
+ ].forEach((a) => {
177
+ const s = a / v.value + i.scrollXmm, c = Math.round(s);
178
+ if (Math.abs(s - c) * v.value <= i.alignmentThreshold) {
179
+ const g = (c - i.scrollXmm) * v.value;
180
+ n.snapX || (n.snapX = t.x + (g - a)), n.lines.push({
181
+ position: g,
182
+ type: "vertical",
183
+ color: i.alignmentLineColor,
184
+ thickness: 1
185
+ });
186
+ }
187
+ });
188
+ }
189
+ function at(t, n) {
190
+ const e = H(t);
191
+ [
192
+ e.top,
193
+ // 上边缘
194
+ e.bottom
195
+ // 下边缘
196
+ ].forEach((a) => {
197
+ const s = a / v.value + i.scrollYmm, c = Math.round(s);
198
+ if (Math.abs(s - c) * v.value <= i.alignmentThreshold) {
199
+ const g = (c - i.scrollYmm) * v.value;
200
+ n.snapY || (n.snapY = t.y + (g - a)), n.lines.push({
201
+ position: g,
202
+ type: "horizontal",
203
+ color: i.alignmentLineColor,
204
+ thickness: 1
205
+ });
206
+ }
207
+ });
208
+ }
209
+ function N(t, n) {
210
+ const e = {
211
+ snapX: null,
212
+ snapY: null,
213
+ lines: []
214
+ };
215
+ return it(t, n, e), ot(t, e), at(t, e), e;
216
+ }
217
+ function U(t, n, e, o, a) {
218
+ r.value = {
219
+ id: t,
220
+ x: n,
221
+ y: e,
222
+ width: o,
223
+ height: a
224
+ };
225
+ const s = h.value.findIndex((c) => c.id === t);
226
+ s >= 0 && h.value.splice(s, 1);
227
+ }
228
+ function q() {
229
+ if (!r.value) return;
230
+ const t = h.value.findIndex((n) => n.id === r.value.id);
231
+ t >= 0 ? h.value[t] = r.value : h.value.push(r.value), w(), $.value = [], r.value = null;
232
+ }
233
+ function lt(t, n, e, o, a) {
234
+ U(t, n, e, o, a);
235
+ }
236
+ function st(t, n) {
237
+ if (!r.value) return;
238
+ r.value.x = t, r.value.y = n;
239
+ const e = N(r.value, h.value);
240
+ return j(e), w(), e;
241
+ }
242
+ function j(t) {
243
+ const n = m.value - i.margin[1] - i.margin[3], e = p.value;
244
+ $.value = t.lines.filter((o) => o.type === "vertical" ? o.position >= 0 && o.position <= n : o.position >= 0 && o.position <= e);
245
+ }
246
+ function rt() {
247
+ q();
248
+ }
249
+ function ut(t) {
250
+ const n = h.value.findIndex((e) => e.id === t.id);
251
+ n >= 0 ? h.value[n] = t : h.value.push(t), w();
252
+ }
253
+ function ct(t) {
254
+ const n = h.value.findIndex((e) => e.id === t);
255
+ n >= 0 && (h.value.splice(n, 1), w());
256
+ }
257
+ function dt(t, n, e, o, a) {
258
+ U(t, n, e, o, a);
259
+ }
260
+ function ht(t, n, e, o) {
261
+ if (!r.value) return;
262
+ r.value.x = t, r.value.y = n, r.value.width = e, r.value.height = o;
263
+ const a = N(r.value, h.value);
264
+ return j(a), w(), a;
265
+ }
266
+ function ft() {
267
+ q();
268
+ }
269
+ return K({
270
+ startDrag: lt,
271
+ updateDragPosition: st,
272
+ endDrag: rt,
273
+ addDraggableElement: ut,
274
+ removeDraggableElement: ct,
275
+ startResize: dt,
276
+ updateResizePosition: ht,
277
+ endResize: ft,
278
+ getCanvasWidth: () => m.value - i.margin[1] - i.margin[3],
279
+ getCanvasHeight: () => p.value
280
+ }), (t, n) => (z(), R("div", {
281
+ class: "ruler-container",
282
+ width: `${m.value + 30}`
283
+ }, [
284
+ S("div", {
285
+ class: "corner",
286
+ style: b({ width: u.thick + "px", height: u.thick + "px" })
287
+ }, null, 4),
288
+ S("canvas", {
289
+ ref_key: "horizontalCanvas",
290
+ ref: Y,
291
+ class: "ruler horizontal",
292
+ width: m.value,
293
+ height: u.thick,
294
+ style: b({ width: m.value + "px", height: u.thick + "px" })
295
+ }, null, 12, yt),
296
+ S("canvas", {
297
+ ref_key: "verticalCanvas",
298
+ ref: W,
299
+ class: "ruler vertical",
300
+ width: u.thick,
301
+ height: p.value,
302
+ style: b({ width: u.thick + "px", height: p.value + "px" })
303
+ }, null, 12, xt),
304
+ S("div", {
305
+ class: "ruler-content",
306
+ ref_key: "rulerContentRef",
307
+ ref: Z,
308
+ style: b({
309
+ width: `${m.value - u.margin[1] - u.margin[3]}px`,
310
+ minHeight: `${p.value - u.margin[0] - u.margin[2]}px`,
311
+ height: `${p.value - u.margin[0] - u.margin[2]}px`,
312
+ margin: `${u.margin[0]}px ${u.margin[1]}px ${u.margin[2]}px ${u.margin[3]}px`,
313
+ overflow: "visible",
314
+ position: "relative"
315
+ })
316
+ }, [
317
+ S("div", wt, [
318
+ (z(!0), R(G, null, J($.value, (e, o) => (z(), R("div", {
319
+ key: o,
320
+ class: pt(["alignment-line", { horizontal: e.type === "horizontal", vertical: e.type === "vertical" }]),
321
+ style: b({
322
+ [e.type === "horizontal" ? "top" : "left"]: `${e.position}px`,
323
+ backgroundColor: e.color || u.alignmentLineColor,
324
+ width: e.type === "horizontal" ? "100%" : `${e.thickness || 1}px`,
325
+ height: e.type === "horizontal" ? `${e.thickness || 1}px` : "100%"
326
+ })
327
+ }, null, 6))), 128))
328
+ ]),
329
+ (z(!0), R(G, null, J(x.value - 1, (e) => (z(), R("div", {
330
+ key: `page-break-${e}`,
331
+ class: "page-break",
332
+ style: b({
333
+ top: `${e * L.value}px`
334
+ })
335
+ }, null, 4))), 128)),
336
+ mt(t.$slots, "default", {}, void 0, !0)
337
+ ], 4)
338
+ ], 8, Mt));
339
+ }
340
+ }), Tt = /* @__PURE__ */ Ct(Rt, [["__scopeId", "data-v-4d95338a"]]);
341
+ export {
342
+ Tt as default
343
+ };