operp-print-designer 1.0.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.
- package/LICENSE +21 -0
- package/README.md +280 -0
- package/dist/print-designer.css +1 -0
- package/dist/print-designer.es.js +2964 -0
- package/dist/print-designer.umd.js +46 -0
- package/package.json +58 -0
|
@@ -0,0 +1,2964 @@
|
|
|
1
|
+
import he, { useRef as He, useCallback as K, useState as Ce, useMemo as ee, useEffect as un } from "react";
|
|
2
|
+
import { Typography as fe, App as Be, Space as re, Input as ne, Button as H, Card as me, Select as Z, InputNumber as Q, Radio as Ne, List as $e, Tag as Le, Dropdown as hn, Popconfirm as zt, message as ue, Modal as Ue, Divider as se, Collapse as fn, Empty as jt, ColorPicker as Ve, Table as pn, Form as oe, Switch as We } from "antd";
|
|
3
|
+
import { PlusOutlined as Ke, SaveOutlined as It, DownloadOutlined as gn, UploadOutlined as xn, SettingOutlined as mn, DeleteOutlined as Ge, PrinterOutlined as qe, EyeOutlined as yn, FontSizeOutlined as vn, PictureOutlined as bn, TableOutlined as jn, BarcodeOutlined as Sn, MinusOutlined as wn, DatabaseOutlined as Dt, MoreOutlined as Cn, EditOutlined as Tn, CaretRightOutlined as Rn } from "@ant-design/icons";
|
|
4
|
+
import { useReactToPrint as At } from "react-to-print";
|
|
5
|
+
import { create as En } from "zustand";
|
|
6
|
+
import Pn from "react-grid-layout";
|
|
7
|
+
var Se = { exports: {} }, ge = {};
|
|
8
|
+
/**
|
|
9
|
+
* @license React
|
|
10
|
+
* react-jsx-runtime.production.min.js
|
|
11
|
+
*
|
|
12
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the MIT license found in the
|
|
15
|
+
* LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/
|
|
17
|
+
var St;
|
|
18
|
+
function kn() {
|
|
19
|
+
if (St) return ge;
|
|
20
|
+
St = 1;
|
|
21
|
+
var o = he, d = Symbol.for("react.element"), a = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, s = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
22
|
+
function y(g, c, b) {
|
|
23
|
+
var v, T = {}, p = null, _ = null;
|
|
24
|
+
b !== void 0 && (p = "" + b), c.key !== void 0 && (p = "" + c.key), c.ref !== void 0 && (_ = c.ref);
|
|
25
|
+
for (v in c) r.call(c, v) && !i.hasOwnProperty(v) && (T[v] = c[v]);
|
|
26
|
+
if (g && g.defaultProps) for (v in c = g.defaultProps, c) T[v] === void 0 && (T[v] = c[v]);
|
|
27
|
+
return { $$typeof: d, type: g, key: p, ref: _, props: T, _owner: s.current };
|
|
28
|
+
}
|
|
29
|
+
return ge.Fragment = a, ge.jsx = y, ge.jsxs = y, ge;
|
|
30
|
+
}
|
|
31
|
+
var xe = {}, wt;
|
|
32
|
+
function _n() {
|
|
33
|
+
if (wt) return xe;
|
|
34
|
+
wt = 1;
|
|
35
|
+
var o = {};
|
|
36
|
+
/**
|
|
37
|
+
* @license React
|
|
38
|
+
* react-jsx-runtime.development.js
|
|
39
|
+
*
|
|
40
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
41
|
+
*
|
|
42
|
+
* This source code is licensed under the MIT license found in the
|
|
43
|
+
* LICENSE file in the root directory of this source tree.
|
|
44
|
+
*/
|
|
45
|
+
return o.NODE_ENV !== "production" && (function() {
|
|
46
|
+
var d = he, a = Symbol.for("react.element"), r = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), y = Symbol.for("react.profiler"), g = Symbol.for("react.provider"), c = Symbol.for("react.context"), b = Symbol.for("react.forward_ref"), v = Symbol.for("react.suspense"), T = Symbol.for("react.suspense_list"), p = Symbol.for("react.memo"), _ = Symbol.for("react.lazy"), I = Symbol.for("react.offscreen"), m = Symbol.iterator, P = "@@iterator";
|
|
47
|
+
function n(t) {
|
|
48
|
+
if (t === null || typeof t != "object")
|
|
49
|
+
return null;
|
|
50
|
+
var l = m && t[m] || t[P];
|
|
51
|
+
return typeof l == "function" ? l : null;
|
|
52
|
+
}
|
|
53
|
+
var h = d.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
54
|
+
function x(t) {
|
|
55
|
+
{
|
|
56
|
+
for (var l = arguments.length, f = new Array(l > 1 ? l - 1 : 0), S = 1; S < l; S++)
|
|
57
|
+
f[S - 1] = arguments[S];
|
|
58
|
+
E("error", t, f);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function E(t, l, f) {
|
|
62
|
+
{
|
|
63
|
+
var S = h.ReactDebugCurrentFrame, O = S.getStackAddendum();
|
|
64
|
+
O !== "" && (l += "%s", f = f.concat([O]));
|
|
65
|
+
var F = f.map(function(k) {
|
|
66
|
+
return String(k);
|
|
67
|
+
});
|
|
68
|
+
F.unshift("Warning: " + l), Function.prototype.apply.call(console[t], console, F);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
var u = !1, j = !1, D = !1, N = !1, L = !1, J;
|
|
72
|
+
J = Symbol.for("react.module.reference");
|
|
73
|
+
function $(t) {
|
|
74
|
+
return !!(typeof t == "string" || typeof t == "function" || t === s || t === y || L || t === i || t === v || t === T || N || t === I || u || j || D || typeof t == "object" && t !== null && (t.$$typeof === _ || t.$$typeof === p || t.$$typeof === g || t.$$typeof === c || t.$$typeof === b || // This needs to include all possible module reference object
|
|
75
|
+
// types supported by any Flight configuration anywhere since
|
|
76
|
+
// we don't know which Flight build this will end up being used
|
|
77
|
+
// with.
|
|
78
|
+
t.$$typeof === J || t.getModuleId !== void 0));
|
|
79
|
+
}
|
|
80
|
+
function ae(t, l, f) {
|
|
81
|
+
var S = t.displayName;
|
|
82
|
+
if (S)
|
|
83
|
+
return S;
|
|
84
|
+
var O = l.displayName || l.name || "";
|
|
85
|
+
return O !== "" ? f + "(" + O + ")" : f;
|
|
86
|
+
}
|
|
87
|
+
function le(t) {
|
|
88
|
+
return t.displayName || "Context";
|
|
89
|
+
}
|
|
90
|
+
function M(t) {
|
|
91
|
+
if (t == null)
|
|
92
|
+
return null;
|
|
93
|
+
if (typeof t.tag == "number" && x("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof t == "function")
|
|
94
|
+
return t.displayName || t.name || null;
|
|
95
|
+
if (typeof t == "string")
|
|
96
|
+
return t;
|
|
97
|
+
switch (t) {
|
|
98
|
+
case s:
|
|
99
|
+
return "Fragment";
|
|
100
|
+
case r:
|
|
101
|
+
return "Portal";
|
|
102
|
+
case y:
|
|
103
|
+
return "Profiler";
|
|
104
|
+
case i:
|
|
105
|
+
return "StrictMode";
|
|
106
|
+
case v:
|
|
107
|
+
return "Suspense";
|
|
108
|
+
case T:
|
|
109
|
+
return "SuspenseList";
|
|
110
|
+
}
|
|
111
|
+
if (typeof t == "object")
|
|
112
|
+
switch (t.$$typeof) {
|
|
113
|
+
case c:
|
|
114
|
+
var l = t;
|
|
115
|
+
return le(l) + ".Consumer";
|
|
116
|
+
case g:
|
|
117
|
+
var f = t;
|
|
118
|
+
return le(f._context) + ".Provider";
|
|
119
|
+
case b:
|
|
120
|
+
return ae(t, t.render, "ForwardRef");
|
|
121
|
+
case p:
|
|
122
|
+
var S = t.displayName || null;
|
|
123
|
+
return S !== null ? S : M(t.type) || "Memo";
|
|
124
|
+
case _: {
|
|
125
|
+
var O = t, F = O._payload, k = O._init;
|
|
126
|
+
try {
|
|
127
|
+
return M(k(F));
|
|
128
|
+
} catch {
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
var C = Object.assign, z = 0, Y, q, et, tt, nt, rt, it;
|
|
136
|
+
function ot() {
|
|
137
|
+
}
|
|
138
|
+
ot.__reactDisabledLog = !0;
|
|
139
|
+
function Nt() {
|
|
140
|
+
{
|
|
141
|
+
if (z === 0) {
|
|
142
|
+
Y = console.log, q = console.info, et = console.warn, tt = console.error, nt = console.group, rt = console.groupCollapsed, it = console.groupEnd;
|
|
143
|
+
var t = {
|
|
144
|
+
configurable: !0,
|
|
145
|
+
enumerable: !0,
|
|
146
|
+
value: ot,
|
|
147
|
+
writable: !0
|
|
148
|
+
};
|
|
149
|
+
Object.defineProperties(console, {
|
|
150
|
+
info: t,
|
|
151
|
+
log: t,
|
|
152
|
+
warn: t,
|
|
153
|
+
error: t,
|
|
154
|
+
group: t,
|
|
155
|
+
groupCollapsed: t,
|
|
156
|
+
groupEnd: t
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
z++;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
function $t() {
|
|
163
|
+
{
|
|
164
|
+
if (z--, z === 0) {
|
|
165
|
+
var t = {
|
|
166
|
+
configurable: !0,
|
|
167
|
+
enumerable: !0,
|
|
168
|
+
writable: !0
|
|
169
|
+
};
|
|
170
|
+
Object.defineProperties(console, {
|
|
171
|
+
log: C({}, t, {
|
|
172
|
+
value: Y
|
|
173
|
+
}),
|
|
174
|
+
info: C({}, t, {
|
|
175
|
+
value: q
|
|
176
|
+
}),
|
|
177
|
+
warn: C({}, t, {
|
|
178
|
+
value: et
|
|
179
|
+
}),
|
|
180
|
+
error: C({}, t, {
|
|
181
|
+
value: tt
|
|
182
|
+
}),
|
|
183
|
+
group: C({}, t, {
|
|
184
|
+
value: nt
|
|
185
|
+
}),
|
|
186
|
+
groupCollapsed: C({}, t, {
|
|
187
|
+
value: rt
|
|
188
|
+
}),
|
|
189
|
+
groupEnd: C({}, t, {
|
|
190
|
+
value: it
|
|
191
|
+
})
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
z < 0 && x("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
var ke = h.ReactCurrentDispatcher, _e;
|
|
198
|
+
function ye(t, l, f) {
|
|
199
|
+
{
|
|
200
|
+
if (_e === void 0)
|
|
201
|
+
try {
|
|
202
|
+
throw Error();
|
|
203
|
+
} catch (O) {
|
|
204
|
+
var S = O.stack.trim().match(/\n( *(at )?)/);
|
|
205
|
+
_e = S && S[1] || "";
|
|
206
|
+
}
|
|
207
|
+
return `
|
|
208
|
+
` + _e + t;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
var Oe = !1, ve;
|
|
212
|
+
{
|
|
213
|
+
var Vt = typeof WeakMap == "function" ? WeakMap : Map;
|
|
214
|
+
ve = new Vt();
|
|
215
|
+
}
|
|
216
|
+
function st(t, l) {
|
|
217
|
+
if (!t || Oe)
|
|
218
|
+
return "";
|
|
219
|
+
{
|
|
220
|
+
var f = ve.get(t);
|
|
221
|
+
if (f !== void 0)
|
|
222
|
+
return f;
|
|
223
|
+
}
|
|
224
|
+
var S;
|
|
225
|
+
Oe = !0;
|
|
226
|
+
var O = Error.prepareStackTrace;
|
|
227
|
+
Error.prepareStackTrace = void 0;
|
|
228
|
+
var F;
|
|
229
|
+
F = ke.current, ke.current = null, Nt();
|
|
230
|
+
try {
|
|
231
|
+
if (l) {
|
|
232
|
+
var k = function() {
|
|
233
|
+
throw Error();
|
|
234
|
+
};
|
|
235
|
+
if (Object.defineProperty(k.prototype, "props", {
|
|
236
|
+
set: function() {
|
|
237
|
+
throw Error();
|
|
238
|
+
}
|
|
239
|
+
}), typeof Reflect == "object" && Reflect.construct) {
|
|
240
|
+
try {
|
|
241
|
+
Reflect.construct(k, []);
|
|
242
|
+
} catch (G) {
|
|
243
|
+
S = G;
|
|
244
|
+
}
|
|
245
|
+
Reflect.construct(t, [], k);
|
|
246
|
+
} else {
|
|
247
|
+
try {
|
|
248
|
+
k.call();
|
|
249
|
+
} catch (G) {
|
|
250
|
+
S = G;
|
|
251
|
+
}
|
|
252
|
+
t.call(k.prototype);
|
|
253
|
+
}
|
|
254
|
+
} else {
|
|
255
|
+
try {
|
|
256
|
+
throw Error();
|
|
257
|
+
} catch (G) {
|
|
258
|
+
S = G;
|
|
259
|
+
}
|
|
260
|
+
t();
|
|
261
|
+
}
|
|
262
|
+
} catch (G) {
|
|
263
|
+
if (G && S && typeof G.stack == "string") {
|
|
264
|
+
for (var R = G.stack.split(`
|
|
265
|
+
`), U = S.stack.split(`
|
|
266
|
+
`), V = R.length - 1, W = U.length - 1; V >= 1 && W >= 0 && R[V] !== U[W]; )
|
|
267
|
+
W--;
|
|
268
|
+
for (; V >= 1 && W >= 0; V--, W--)
|
|
269
|
+
if (R[V] !== U[W]) {
|
|
270
|
+
if (V !== 1 || W !== 1)
|
|
271
|
+
do
|
|
272
|
+
if (V--, W--, W < 0 || R[V] !== U[W]) {
|
|
273
|
+
var X = `
|
|
274
|
+
` + R[V].replace(" at new ", " at ");
|
|
275
|
+
return t.displayName && X.includes("<anonymous>") && (X = X.replace("<anonymous>", t.displayName)), typeof t == "function" && ve.set(t, X), X;
|
|
276
|
+
}
|
|
277
|
+
while (V >= 1 && W >= 0);
|
|
278
|
+
break;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
} finally {
|
|
282
|
+
Oe = !1, ke.current = F, $t(), Error.prepareStackTrace = O;
|
|
283
|
+
}
|
|
284
|
+
var ce = t ? t.displayName || t.name : "", ie = ce ? ye(ce) : "";
|
|
285
|
+
return typeof t == "function" && ve.set(t, ie), ie;
|
|
286
|
+
}
|
|
287
|
+
function Wt(t, l, f) {
|
|
288
|
+
return st(t, !1);
|
|
289
|
+
}
|
|
290
|
+
function Bt(t) {
|
|
291
|
+
var l = t.prototype;
|
|
292
|
+
return !!(l && l.isReactComponent);
|
|
293
|
+
}
|
|
294
|
+
function be(t, l, f) {
|
|
295
|
+
if (t == null)
|
|
296
|
+
return "";
|
|
297
|
+
if (typeof t == "function")
|
|
298
|
+
return st(t, Bt(t));
|
|
299
|
+
if (typeof t == "string")
|
|
300
|
+
return ye(t);
|
|
301
|
+
switch (t) {
|
|
302
|
+
case v:
|
|
303
|
+
return ye("Suspense");
|
|
304
|
+
case T:
|
|
305
|
+
return ye("SuspenseList");
|
|
306
|
+
}
|
|
307
|
+
if (typeof t == "object")
|
|
308
|
+
switch (t.$$typeof) {
|
|
309
|
+
case b:
|
|
310
|
+
return Wt(t.render);
|
|
311
|
+
case p:
|
|
312
|
+
return be(t.type, l, f);
|
|
313
|
+
case _: {
|
|
314
|
+
var S = t, O = S._payload, F = S._init;
|
|
315
|
+
try {
|
|
316
|
+
return be(F(O), l, f);
|
|
317
|
+
} catch {
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
return "";
|
|
322
|
+
}
|
|
323
|
+
var pe = Object.prototype.hasOwnProperty, at = {}, lt = h.ReactDebugCurrentFrame;
|
|
324
|
+
function je(t) {
|
|
325
|
+
if (t) {
|
|
326
|
+
var l = t._owner, f = be(t.type, t._source, l ? l.type : null);
|
|
327
|
+
lt.setExtraStackFrame(f);
|
|
328
|
+
} else
|
|
329
|
+
lt.setExtraStackFrame(null);
|
|
330
|
+
}
|
|
331
|
+
function Lt(t, l, f, S, O) {
|
|
332
|
+
{
|
|
333
|
+
var F = Function.call.bind(pe);
|
|
334
|
+
for (var k in t)
|
|
335
|
+
if (F(t, k)) {
|
|
336
|
+
var R = void 0;
|
|
337
|
+
try {
|
|
338
|
+
if (typeof t[k] != "function") {
|
|
339
|
+
var U = Error((S || "React class") + ": " + f + " type `" + k + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof t[k] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
340
|
+
throw U.name = "Invariant Violation", U;
|
|
341
|
+
}
|
|
342
|
+
R = t[k](l, k, S, f, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
343
|
+
} catch (V) {
|
|
344
|
+
R = V;
|
|
345
|
+
}
|
|
346
|
+
R && !(R instanceof Error) && (je(O), x("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", S || "React class", f, k, typeof R), je(null)), R instanceof Error && !(R.message in at) && (at[R.message] = !0, je(O), x("Failed %s type: %s", f, R.message), je(null));
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
var Mt = Array.isArray;
|
|
351
|
+
function ze(t) {
|
|
352
|
+
return Mt(t);
|
|
353
|
+
}
|
|
354
|
+
function Jt(t) {
|
|
355
|
+
{
|
|
356
|
+
var l = typeof Symbol == "function" && Symbol.toStringTag, f = l && t[Symbol.toStringTag] || t.constructor.name || "Object";
|
|
357
|
+
return f;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
function Yt(t) {
|
|
361
|
+
try {
|
|
362
|
+
return dt(t), !1;
|
|
363
|
+
} catch {
|
|
364
|
+
return !0;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
function dt(t) {
|
|
368
|
+
return "" + t;
|
|
369
|
+
}
|
|
370
|
+
function ct(t) {
|
|
371
|
+
if (Yt(t))
|
|
372
|
+
return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Jt(t)), dt(t);
|
|
373
|
+
}
|
|
374
|
+
var ut = h.ReactCurrentOwner, Ht = {
|
|
375
|
+
key: !0,
|
|
376
|
+
ref: !0,
|
|
377
|
+
__self: !0,
|
|
378
|
+
__source: !0
|
|
379
|
+
}, ht, ft;
|
|
380
|
+
function Ut(t) {
|
|
381
|
+
if (pe.call(t, "ref")) {
|
|
382
|
+
var l = Object.getOwnPropertyDescriptor(t, "ref").get;
|
|
383
|
+
if (l && l.isReactWarning)
|
|
384
|
+
return !1;
|
|
385
|
+
}
|
|
386
|
+
return t.ref !== void 0;
|
|
387
|
+
}
|
|
388
|
+
function Kt(t) {
|
|
389
|
+
if (pe.call(t, "key")) {
|
|
390
|
+
var l = Object.getOwnPropertyDescriptor(t, "key").get;
|
|
391
|
+
if (l && l.isReactWarning)
|
|
392
|
+
return !1;
|
|
393
|
+
}
|
|
394
|
+
return t.key !== void 0;
|
|
395
|
+
}
|
|
396
|
+
function Gt(t, l) {
|
|
397
|
+
typeof t.ref == "string" && ut.current;
|
|
398
|
+
}
|
|
399
|
+
function qt(t, l) {
|
|
400
|
+
{
|
|
401
|
+
var f = function() {
|
|
402
|
+
ht || (ht = !0, x("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", l));
|
|
403
|
+
};
|
|
404
|
+
f.isReactWarning = !0, Object.defineProperty(t, "key", {
|
|
405
|
+
get: f,
|
|
406
|
+
configurable: !0
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
function Xt(t, l) {
|
|
411
|
+
{
|
|
412
|
+
var f = function() {
|
|
413
|
+
ft || (ft = !0, x("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", l));
|
|
414
|
+
};
|
|
415
|
+
f.isReactWarning = !0, Object.defineProperty(t, "ref", {
|
|
416
|
+
get: f,
|
|
417
|
+
configurable: !0
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
var Zt = function(t, l, f, S, O, F, k) {
|
|
422
|
+
var R = {
|
|
423
|
+
// This tag allows us to uniquely identify this as a React Element
|
|
424
|
+
$$typeof: a,
|
|
425
|
+
// Built-in properties that belong on the element
|
|
426
|
+
type: t,
|
|
427
|
+
key: l,
|
|
428
|
+
ref: f,
|
|
429
|
+
props: k,
|
|
430
|
+
// Record the component responsible for creating this element.
|
|
431
|
+
_owner: F
|
|
432
|
+
};
|
|
433
|
+
return R._store = {}, Object.defineProperty(R._store, "validated", {
|
|
434
|
+
configurable: !1,
|
|
435
|
+
enumerable: !1,
|
|
436
|
+
writable: !0,
|
|
437
|
+
value: !1
|
|
438
|
+
}), Object.defineProperty(R, "_self", {
|
|
439
|
+
configurable: !1,
|
|
440
|
+
enumerable: !1,
|
|
441
|
+
writable: !1,
|
|
442
|
+
value: S
|
|
443
|
+
}), Object.defineProperty(R, "_source", {
|
|
444
|
+
configurable: !1,
|
|
445
|
+
enumerable: !1,
|
|
446
|
+
writable: !1,
|
|
447
|
+
value: O
|
|
448
|
+
}), Object.freeze && (Object.freeze(R.props), Object.freeze(R)), R;
|
|
449
|
+
};
|
|
450
|
+
function Qt(t, l, f, S, O) {
|
|
451
|
+
{
|
|
452
|
+
var F, k = {}, R = null, U = null;
|
|
453
|
+
f !== void 0 && (ct(f), R = "" + f), Kt(l) && (ct(l.key), R = "" + l.key), Ut(l) && (U = l.ref, Gt(l, O));
|
|
454
|
+
for (F in l)
|
|
455
|
+
pe.call(l, F) && !Ht.hasOwnProperty(F) && (k[F] = l[F]);
|
|
456
|
+
if (t && t.defaultProps) {
|
|
457
|
+
var V = t.defaultProps;
|
|
458
|
+
for (F in V)
|
|
459
|
+
k[F] === void 0 && (k[F] = V[F]);
|
|
460
|
+
}
|
|
461
|
+
if (R || U) {
|
|
462
|
+
var W = typeof t == "function" ? t.displayName || t.name || "Unknown" : t;
|
|
463
|
+
R && qt(k, W), U && Xt(k, W);
|
|
464
|
+
}
|
|
465
|
+
return Zt(t, R, U, O, S, ut.current, k);
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
var Ie = h.ReactCurrentOwner, pt = h.ReactDebugCurrentFrame;
|
|
469
|
+
function de(t) {
|
|
470
|
+
if (t) {
|
|
471
|
+
var l = t._owner, f = be(t.type, t._source, l ? l.type : null);
|
|
472
|
+
pt.setExtraStackFrame(f);
|
|
473
|
+
} else
|
|
474
|
+
pt.setExtraStackFrame(null);
|
|
475
|
+
}
|
|
476
|
+
var De;
|
|
477
|
+
De = !1;
|
|
478
|
+
function Ae(t) {
|
|
479
|
+
return typeof t == "object" && t !== null && t.$$typeof === a;
|
|
480
|
+
}
|
|
481
|
+
function gt() {
|
|
482
|
+
{
|
|
483
|
+
if (Ie.current) {
|
|
484
|
+
var t = M(Ie.current.type);
|
|
485
|
+
if (t)
|
|
486
|
+
return `
|
|
487
|
+
|
|
488
|
+
Check the render method of \`` + t + "`.";
|
|
489
|
+
}
|
|
490
|
+
return "";
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
function en(t) {
|
|
494
|
+
return "";
|
|
495
|
+
}
|
|
496
|
+
var xt = {};
|
|
497
|
+
function tn(t) {
|
|
498
|
+
{
|
|
499
|
+
var l = gt();
|
|
500
|
+
if (!l) {
|
|
501
|
+
var f = typeof t == "string" ? t : t.displayName || t.name;
|
|
502
|
+
f && (l = `
|
|
503
|
+
|
|
504
|
+
Check the top-level render call using <` + f + ">.");
|
|
505
|
+
}
|
|
506
|
+
return l;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
function mt(t, l) {
|
|
510
|
+
{
|
|
511
|
+
if (!t._store || t._store.validated || t.key != null)
|
|
512
|
+
return;
|
|
513
|
+
t._store.validated = !0;
|
|
514
|
+
var f = tn(l);
|
|
515
|
+
if (xt[f])
|
|
516
|
+
return;
|
|
517
|
+
xt[f] = !0;
|
|
518
|
+
var S = "";
|
|
519
|
+
t && t._owner && t._owner !== Ie.current && (S = " It was passed a child from " + M(t._owner.type) + "."), de(t), x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', f, S), de(null);
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
function yt(t, l) {
|
|
523
|
+
{
|
|
524
|
+
if (typeof t != "object")
|
|
525
|
+
return;
|
|
526
|
+
if (ze(t))
|
|
527
|
+
for (var f = 0; f < t.length; f++) {
|
|
528
|
+
var S = t[f];
|
|
529
|
+
Ae(S) && mt(S, l);
|
|
530
|
+
}
|
|
531
|
+
else if (Ae(t))
|
|
532
|
+
t._store && (t._store.validated = !0);
|
|
533
|
+
else if (t) {
|
|
534
|
+
var O = n(t);
|
|
535
|
+
if (typeof O == "function" && O !== t.entries)
|
|
536
|
+
for (var F = O.call(t), k; !(k = F.next()).done; )
|
|
537
|
+
Ae(k.value) && mt(k.value, l);
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
function nn(t) {
|
|
542
|
+
{
|
|
543
|
+
var l = t.type;
|
|
544
|
+
if (l == null || typeof l == "string")
|
|
545
|
+
return;
|
|
546
|
+
var f;
|
|
547
|
+
if (typeof l == "function")
|
|
548
|
+
f = l.propTypes;
|
|
549
|
+
else if (typeof l == "object" && (l.$$typeof === b || // Note: Memo only checks outer props here.
|
|
550
|
+
// Inner props are checked in the reconciler.
|
|
551
|
+
l.$$typeof === p))
|
|
552
|
+
f = l.propTypes;
|
|
553
|
+
else
|
|
554
|
+
return;
|
|
555
|
+
if (f) {
|
|
556
|
+
var S = M(l);
|
|
557
|
+
Lt(f, t.props, "prop", S, t);
|
|
558
|
+
} else if (l.PropTypes !== void 0 && !De) {
|
|
559
|
+
De = !0;
|
|
560
|
+
var O = M(l);
|
|
561
|
+
x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", O || "Unknown");
|
|
562
|
+
}
|
|
563
|
+
typeof l.getDefaultProps == "function" && !l.getDefaultProps.isReactClassApproved && x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
function rn(t) {
|
|
567
|
+
{
|
|
568
|
+
for (var l = Object.keys(t.props), f = 0; f < l.length; f++) {
|
|
569
|
+
var S = l[f];
|
|
570
|
+
if (S !== "children" && S !== "key") {
|
|
571
|
+
de(t), x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", S), de(null);
|
|
572
|
+
break;
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
t.ref !== null && (de(t), x("Invalid attribute `ref` supplied to `React.Fragment`."), de(null));
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
var vt = {};
|
|
579
|
+
function bt(t, l, f, S, O, F) {
|
|
580
|
+
{
|
|
581
|
+
var k = $(t);
|
|
582
|
+
if (!k) {
|
|
583
|
+
var R = "";
|
|
584
|
+
(t === void 0 || typeof t == "object" && t !== null && Object.keys(t).length === 0) && (R += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
585
|
+
var U = en();
|
|
586
|
+
U ? R += U : R += gt();
|
|
587
|
+
var V;
|
|
588
|
+
t === null ? V = "null" : ze(t) ? V = "array" : t !== void 0 && t.$$typeof === a ? (V = "<" + (M(t.type) || "Unknown") + " />", R = " Did you accidentally export a JSX literal instead of a component?") : V = typeof t, x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", V, R);
|
|
589
|
+
}
|
|
590
|
+
var W = Qt(t, l, f, O, F);
|
|
591
|
+
if (W == null)
|
|
592
|
+
return W;
|
|
593
|
+
if (k) {
|
|
594
|
+
var X = l.children;
|
|
595
|
+
if (X !== void 0)
|
|
596
|
+
if (S)
|
|
597
|
+
if (ze(X)) {
|
|
598
|
+
for (var ce = 0; ce < X.length; ce++)
|
|
599
|
+
yt(X[ce], t);
|
|
600
|
+
Object.freeze && Object.freeze(X);
|
|
601
|
+
} else
|
|
602
|
+
x("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
603
|
+
else
|
|
604
|
+
yt(X, t);
|
|
605
|
+
}
|
|
606
|
+
if (pe.call(l, "key")) {
|
|
607
|
+
var ie = M(t), G = Object.keys(l).filter(function(cn) {
|
|
608
|
+
return cn !== "key";
|
|
609
|
+
}), Fe = G.length > 0 ? "{key: someKey, " + G.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
610
|
+
if (!vt[ie + Fe]) {
|
|
611
|
+
var dn = G.length > 0 ? "{" + G.join(": ..., ") + ": ...}" : "{}";
|
|
612
|
+
x(`A props object containing a "key" prop is being spread into JSX:
|
|
613
|
+
let props = %s;
|
|
614
|
+
<%s {...props} />
|
|
615
|
+
React keys must be passed directly to JSX without using spread:
|
|
616
|
+
let props = %s;
|
|
617
|
+
<%s key={someKey} {...props} />`, Fe, ie, dn, ie), vt[ie + Fe] = !0;
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
return t === s ? rn(W) : nn(W), W;
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
function on(t, l, f) {
|
|
624
|
+
return bt(t, l, f, !0);
|
|
625
|
+
}
|
|
626
|
+
function sn(t, l, f) {
|
|
627
|
+
return bt(t, l, f, !1);
|
|
628
|
+
}
|
|
629
|
+
var an = sn, ln = on;
|
|
630
|
+
xe.Fragment = s, xe.jsx = an, xe.jsxs = ln;
|
|
631
|
+
})(), xe;
|
|
632
|
+
}
|
|
633
|
+
var Ct;
|
|
634
|
+
function On() {
|
|
635
|
+
if (Ct) return Se.exports;
|
|
636
|
+
Ct = 1;
|
|
637
|
+
var o = {};
|
|
638
|
+
return o.NODE_ENV === "production" ? Se.exports = kn() : Se.exports = _n(), Se.exports;
|
|
639
|
+
}
|
|
640
|
+
var e = On();
|
|
641
|
+
const Ee = {
|
|
642
|
+
A4: { width: 210, height: 297 },
|
|
643
|
+
A3: { width: 297, height: 420 },
|
|
644
|
+
A5: { width: 148, height: 210 },
|
|
645
|
+
Letter: { width: 215.9, height: 279.4 },
|
|
646
|
+
Legal: { width: 215.9, height: 355.6 }
|
|
647
|
+
}, Tt = {
|
|
648
|
+
paperSize: "A4",
|
|
649
|
+
customWidth: 210,
|
|
650
|
+
customHeight: 297,
|
|
651
|
+
orientation: "portrait",
|
|
652
|
+
marginTop: 10,
|
|
653
|
+
marginRight: 10,
|
|
654
|
+
marginBottom: 10,
|
|
655
|
+
marginLeft: 10,
|
|
656
|
+
showHeader: !1,
|
|
657
|
+
headerContent: "页眉文字",
|
|
658
|
+
showFooter: !1,
|
|
659
|
+
footerContent: "页脚文字",
|
|
660
|
+
showPageNumber: !0,
|
|
661
|
+
pageNumberFormat: "第 {page} 页"
|
|
662
|
+
}, A = 3, Re = {
|
|
663
|
+
cellSize: 1,
|
|
664
|
+
cols: 100
|
|
665
|
+
}, Ft = {
|
|
666
|
+
text: "文本",
|
|
667
|
+
image: "图片",
|
|
668
|
+
table: "表格",
|
|
669
|
+
barcode: "条形码",
|
|
670
|
+
line: "分割线"
|
|
671
|
+
}, zn = {
|
|
672
|
+
text: {
|
|
673
|
+
content: "双击编辑文字",
|
|
674
|
+
fontSize: 14,
|
|
675
|
+
fontWeight: "normal",
|
|
676
|
+
fontStyle: "normal",
|
|
677
|
+
textAlign: "left",
|
|
678
|
+
color: "#000000",
|
|
679
|
+
backgroundColor: "transparent"
|
|
680
|
+
},
|
|
681
|
+
image: {
|
|
682
|
+
src: "",
|
|
683
|
+
fit: "contain",
|
|
684
|
+
content: ""
|
|
685
|
+
},
|
|
686
|
+
table: {
|
|
687
|
+
rows: 3,
|
|
688
|
+
cols: 3,
|
|
689
|
+
borderWidth: 1,
|
|
690
|
+
borderColor: "#000000",
|
|
691
|
+
content: ""
|
|
692
|
+
},
|
|
693
|
+
barcode: {
|
|
694
|
+
value: "1234567890",
|
|
695
|
+
format: "CODE128",
|
|
696
|
+
content: ""
|
|
697
|
+
},
|
|
698
|
+
line: {
|
|
699
|
+
color: "#000000",
|
|
700
|
+
thickness: 1,
|
|
701
|
+
style: "solid",
|
|
702
|
+
content: ""
|
|
703
|
+
}
|
|
704
|
+
};
|
|
705
|
+
let Me = 0, Je = 0;
|
|
706
|
+
function Rt() {
|
|
707
|
+
return `comp_${++Me}`;
|
|
708
|
+
}
|
|
709
|
+
function Et() {
|
|
710
|
+
return `ds_${++Je}`;
|
|
711
|
+
}
|
|
712
|
+
const w = En((o, d) => ({
|
|
713
|
+
components: [],
|
|
714
|
+
selectedId: null,
|
|
715
|
+
pageSettings: { ...Tt },
|
|
716
|
+
gridSettings: { ...Re },
|
|
717
|
+
previewVisible: !1,
|
|
718
|
+
templateName: "未命名模板",
|
|
719
|
+
headerFooterVisible: !1,
|
|
720
|
+
dataSources: [],
|
|
721
|
+
activeDataSourceId: null,
|
|
722
|
+
addComponent: (a, r, s) => {
|
|
723
|
+
const i = Rt(), y = Ft[a] || a, g = { ...zn[a] || {} };
|
|
724
|
+
a === "text" && (g.content = y);
|
|
725
|
+
const c = {
|
|
726
|
+
id: i,
|
|
727
|
+
type: a,
|
|
728
|
+
x: r ?? 0,
|
|
729
|
+
y: s ?? 0,
|
|
730
|
+
w: a === "line" ? 20 : 15,
|
|
731
|
+
h: a === "line" ? 1 : 8,
|
|
732
|
+
props: g,
|
|
733
|
+
...a === "table" ? { tableColumns: [{ title: "列1" }, { title: "列2" }, { title: "列3" }] } : {}
|
|
734
|
+
};
|
|
735
|
+
o((b) => ({
|
|
736
|
+
components: [...b.components, c],
|
|
737
|
+
selectedId: i
|
|
738
|
+
}));
|
|
739
|
+
},
|
|
740
|
+
updateComponent: (a, r) => {
|
|
741
|
+
o((s) => ({
|
|
742
|
+
components: s.components.map(
|
|
743
|
+
(i) => i.id === a ? { ...i, ...r } : i
|
|
744
|
+
)
|
|
745
|
+
}));
|
|
746
|
+
},
|
|
747
|
+
selectComponent: (a) => {
|
|
748
|
+
o({ selectedId: a });
|
|
749
|
+
},
|
|
750
|
+
removeComponent: (a) => {
|
|
751
|
+
o((r) => ({
|
|
752
|
+
components: r.components.filter((s) => s.id !== a),
|
|
753
|
+
selectedId: r.selectedId === a ? null : r.selectedId
|
|
754
|
+
}));
|
|
755
|
+
},
|
|
756
|
+
setComponents: (a) => {
|
|
757
|
+
o({ components: a });
|
|
758
|
+
},
|
|
759
|
+
setPageSettings: (a) => {
|
|
760
|
+
o((r) => ({
|
|
761
|
+
pageSettings: { ...r.pageSettings, ...a }
|
|
762
|
+
}));
|
|
763
|
+
},
|
|
764
|
+
setPreviewVisible: (a) => {
|
|
765
|
+
o({ previewVisible: a });
|
|
766
|
+
},
|
|
767
|
+
setTemplateName: (a) => {
|
|
768
|
+
o({ templateName: a });
|
|
769
|
+
},
|
|
770
|
+
setHeaderFooterVisible: (a) => {
|
|
771
|
+
o({ headerFooterVisible: a });
|
|
772
|
+
},
|
|
773
|
+
// ========== 数据源管理 ==========
|
|
774
|
+
addDataSource: (a, r, s) => {
|
|
775
|
+
const y = {
|
|
776
|
+
id: Et(),
|
|
777
|
+
name: a,
|
|
778
|
+
type: r,
|
|
779
|
+
data: s,
|
|
780
|
+
createdAt: Date.now()
|
|
781
|
+
};
|
|
782
|
+
o((g) => ({
|
|
783
|
+
dataSources: [...g.dataSources, y]
|
|
784
|
+
}));
|
|
785
|
+
},
|
|
786
|
+
updateDataSource: (a, r) => {
|
|
787
|
+
o((s) => ({
|
|
788
|
+
dataSources: s.dataSources.map(
|
|
789
|
+
(i) => i.id === a ? { ...i, ...r } : i
|
|
790
|
+
)
|
|
791
|
+
}));
|
|
792
|
+
},
|
|
793
|
+
removeDataSource: (a) => {
|
|
794
|
+
o((r) => ({
|
|
795
|
+
dataSources: r.dataSources.filter((s) => s.id !== a),
|
|
796
|
+
activeDataSourceId: r.activeDataSourceId === a ? null : r.activeDataSourceId
|
|
797
|
+
}));
|
|
798
|
+
},
|
|
799
|
+
setActiveDataSourceId: (a) => {
|
|
800
|
+
o({ activeDataSourceId: a });
|
|
801
|
+
},
|
|
802
|
+
// ========== 表格列配置管理 ==========
|
|
803
|
+
updateComponentTableColumns: (a, r) => {
|
|
804
|
+
o((s) => ({
|
|
805
|
+
components: s.components.map(
|
|
806
|
+
(i) => i.id === a ? { ...i, tableColumns: r } : i
|
|
807
|
+
)
|
|
808
|
+
}));
|
|
809
|
+
},
|
|
810
|
+
exportJSON: () => {
|
|
811
|
+
const a = d(), r = {
|
|
812
|
+
version: "1.0",
|
|
813
|
+
templateName: a.templateName,
|
|
814
|
+
pageSettings: a.pageSettings,
|
|
815
|
+
components: a.components.map(({ id: s, ...i }) => i),
|
|
816
|
+
dataSources: a.dataSources.map(({ id: s, ...i }) => i)
|
|
817
|
+
};
|
|
818
|
+
return JSON.stringify(r, null, 2);
|
|
819
|
+
},
|
|
820
|
+
importJSON: (a) => {
|
|
821
|
+
try {
|
|
822
|
+
const r = JSON.parse(a);
|
|
823
|
+
if (!r.version || !r.pageSettings || !Array.isArray(r.components))
|
|
824
|
+
return "JSON 格式不正确,缺少必要字段";
|
|
825
|
+
Me = 0, Je = 0;
|
|
826
|
+
const s = r.components.map((y) => ({
|
|
827
|
+
...y,
|
|
828
|
+
id: Rt()
|
|
829
|
+
})), i = (r.dataSources || []).map((y) => ({
|
|
830
|
+
...y,
|
|
831
|
+
id: Et()
|
|
832
|
+
}));
|
|
833
|
+
return o({
|
|
834
|
+
components: s,
|
|
835
|
+
dataSources: i,
|
|
836
|
+
pageSettings: r.pageSettings,
|
|
837
|
+
templateName: r.templateName || "导入的模板",
|
|
838
|
+
selectedId: null,
|
|
839
|
+
activeDataSourceId: null
|
|
840
|
+
}), null;
|
|
841
|
+
} catch {
|
|
842
|
+
return "JSON 解析失败,请检查文件内容";
|
|
843
|
+
}
|
|
844
|
+
},
|
|
845
|
+
reset: () => {
|
|
846
|
+
Me = 0, Je = 0, o({
|
|
847
|
+
components: [],
|
|
848
|
+
selectedId: null,
|
|
849
|
+
pageSettings: { ...Tt },
|
|
850
|
+
gridSettings: { ...Re },
|
|
851
|
+
templateName: "未命名模板",
|
|
852
|
+
headerFooterVisible: !1,
|
|
853
|
+
previewVisible: !1,
|
|
854
|
+
dataSources: [],
|
|
855
|
+
activeDataSourceId: null
|
|
856
|
+
});
|
|
857
|
+
}
|
|
858
|
+
})), { Text: Qn } = fe, In = ({ onCustomSave: o, onCustomPrint: d }) => {
|
|
859
|
+
const a = w((h) => h.templateName), r = w((h) => h.setTemplateName), s = w((h) => h.setPreviewVisible), i = w((h) => h.setHeaderFooterVisible), y = w((h) => h.selectedId), g = w((h) => h.removeComponent), c = w((h) => h.exportJSON), b = w((h) => h.importJSON), v = w((h) => h.reset), T = He(null), { message: p } = Be.useApp(), _ = K(() => {
|
|
860
|
+
y && g(y);
|
|
861
|
+
}, [y, g]), I = K(() => {
|
|
862
|
+
const h = c(), x = new Blob([h], { type: "application/json" }), E = URL.createObjectURL(x), u = document.createElement("a");
|
|
863
|
+
u.href = E, u.download = `${a || "模板"}.json`, u.click(), URL.revokeObjectURL(E), p.success("模板已导出");
|
|
864
|
+
}, [c, a, p]), m = K(() => {
|
|
865
|
+
var h;
|
|
866
|
+
(h = T.current) == null || h.click();
|
|
867
|
+
}, []), P = K(
|
|
868
|
+
(h) => {
|
|
869
|
+
var u;
|
|
870
|
+
const x = (u = h.target.files) == null ? void 0 : u[0];
|
|
871
|
+
if (!x) return;
|
|
872
|
+
const E = new FileReader();
|
|
873
|
+
E.onload = () => {
|
|
874
|
+
const j = b(E.result);
|
|
875
|
+
j ? p.error(j) : p.success("模板已导入");
|
|
876
|
+
}, E.readAsText(x), h.target.value = "";
|
|
877
|
+
},
|
|
878
|
+
[b, p]
|
|
879
|
+
), n = K(() => {
|
|
880
|
+
v(), p.info("已新建空白模板");
|
|
881
|
+
}, [v, p]);
|
|
882
|
+
return /* @__PURE__ */ e.jsxs(
|
|
883
|
+
"div",
|
|
884
|
+
{
|
|
885
|
+
style: {
|
|
886
|
+
height: 48,
|
|
887
|
+
display: "flex",
|
|
888
|
+
alignItems: "center",
|
|
889
|
+
justifyContent: "space-between",
|
|
890
|
+
padding: "0 16px",
|
|
891
|
+
borderBottom: "1px solid #e8e8e8",
|
|
892
|
+
background: "#fff"
|
|
893
|
+
},
|
|
894
|
+
children: [
|
|
895
|
+
/* @__PURE__ */ e.jsx(re, { children: /* @__PURE__ */ e.jsx(
|
|
896
|
+
ne,
|
|
897
|
+
{
|
|
898
|
+
value: a,
|
|
899
|
+
onChange: (h) => r(h.target.value),
|
|
900
|
+
variant: "borderless",
|
|
901
|
+
style: { width: 200, fontSize: 16, fontWeight: 600 },
|
|
902
|
+
placeholder: "模板名称"
|
|
903
|
+
}
|
|
904
|
+
) }),
|
|
905
|
+
/* @__PURE__ */ e.jsxs(re, { children: [
|
|
906
|
+
/* @__PURE__ */ e.jsx(H, { icon: /* @__PURE__ */ e.jsx(Ke, {}), onClick: n, children: "新建" }),
|
|
907
|
+
/* @__PURE__ */ e.jsx(
|
|
908
|
+
"input",
|
|
909
|
+
{
|
|
910
|
+
ref: T,
|
|
911
|
+
type: "file",
|
|
912
|
+
accept: ".json",
|
|
913
|
+
style: { display: "none" },
|
|
914
|
+
onChange: P
|
|
915
|
+
}
|
|
916
|
+
),
|
|
917
|
+
o ? /* @__PURE__ */ e.jsx(H, { icon: /* @__PURE__ */ e.jsx(It, {}), onClick: o, type: "primary", children: "保存" }) : /* @__PURE__ */ e.jsx(H, { icon: /* @__PURE__ */ e.jsx(gn, {}), onClick: I, children: "导出" }),
|
|
918
|
+
/* @__PURE__ */ e.jsx(H, { icon: /* @__PURE__ */ e.jsx(xn, {}), onClick: m, children: "导入" }),
|
|
919
|
+
/* @__PURE__ */ e.jsx(
|
|
920
|
+
H,
|
|
921
|
+
{
|
|
922
|
+
icon: /* @__PURE__ */ e.jsx(mn, {}),
|
|
923
|
+
onClick: () => i(!0),
|
|
924
|
+
children: "页眉页脚"
|
|
925
|
+
}
|
|
926
|
+
),
|
|
927
|
+
/* @__PURE__ */ e.jsx(
|
|
928
|
+
H,
|
|
929
|
+
{
|
|
930
|
+
danger: !0,
|
|
931
|
+
icon: /* @__PURE__ */ e.jsx(Ge, {}),
|
|
932
|
+
disabled: !y,
|
|
933
|
+
onClick: _,
|
|
934
|
+
children: "删除"
|
|
935
|
+
}
|
|
936
|
+
),
|
|
937
|
+
d ? /* @__PURE__ */ e.jsx(
|
|
938
|
+
H,
|
|
939
|
+
{
|
|
940
|
+
type: "primary",
|
|
941
|
+
icon: /* @__PURE__ */ e.jsx(qe, {}),
|
|
942
|
+
onClick: d,
|
|
943
|
+
children: "打印"
|
|
944
|
+
}
|
|
945
|
+
) : /* @__PURE__ */ e.jsx(
|
|
946
|
+
H,
|
|
947
|
+
{
|
|
948
|
+
type: "primary",
|
|
949
|
+
icon: /* @__PURE__ */ e.jsx(yn, {}),
|
|
950
|
+
onClick: () => s(!0),
|
|
951
|
+
children: "预览"
|
|
952
|
+
}
|
|
953
|
+
)
|
|
954
|
+
] })
|
|
955
|
+
]
|
|
956
|
+
}
|
|
957
|
+
);
|
|
958
|
+
}, { Text: te } = fe, Dn = () => {
|
|
959
|
+
const o = w((i) => i.pageSettings), d = w((i) => i.setPageSettings), a = o.paperSize === "custom", r = K(
|
|
960
|
+
(i) => {
|
|
961
|
+
d({ paperSize: i });
|
|
962
|
+
},
|
|
963
|
+
[d]
|
|
964
|
+
), s = K(
|
|
965
|
+
(i) => {
|
|
966
|
+
d({ orientation: i });
|
|
967
|
+
},
|
|
968
|
+
[d]
|
|
969
|
+
);
|
|
970
|
+
return /* @__PURE__ */ e.jsx(
|
|
971
|
+
me,
|
|
972
|
+
{
|
|
973
|
+
title: "页面设置",
|
|
974
|
+
size: "small",
|
|
975
|
+
children: /* @__PURE__ */ e.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
|
|
976
|
+
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
977
|
+
/* @__PURE__ */ e.jsx(te, { style: { fontSize: 12 }, children: "纸张大小" }),
|
|
978
|
+
/* @__PURE__ */ e.jsx(
|
|
979
|
+
Z,
|
|
980
|
+
{
|
|
981
|
+
size: "small",
|
|
982
|
+
style: { width: "100%" },
|
|
983
|
+
value: o.paperSize,
|
|
984
|
+
onChange: r,
|
|
985
|
+
options: [
|
|
986
|
+
...Object.keys(Ee).map((i) => ({ value: i, label: i })),
|
|
987
|
+
{ value: "custom", label: "自定义" }
|
|
988
|
+
]
|
|
989
|
+
}
|
|
990
|
+
)
|
|
991
|
+
] }),
|
|
992
|
+
a && /* @__PURE__ */ e.jsxs("div", { style: { display: "flex", gap: 8 }, children: [
|
|
993
|
+
/* @__PURE__ */ e.jsxs("div", { style: { flex: 1 }, children: [
|
|
994
|
+
/* @__PURE__ */ e.jsx(te, { style: { fontSize: 12 }, children: "宽度 (mm)" }),
|
|
995
|
+
/* @__PURE__ */ e.jsx(
|
|
996
|
+
Q,
|
|
997
|
+
{
|
|
998
|
+
size: "small",
|
|
999
|
+
style: { width: "100%" },
|
|
1000
|
+
value: o.customWidth,
|
|
1001
|
+
min: 10,
|
|
1002
|
+
max: 2e3,
|
|
1003
|
+
onChange: (i) => d({ customWidth: i ?? 210 })
|
|
1004
|
+
}
|
|
1005
|
+
)
|
|
1006
|
+
] }),
|
|
1007
|
+
/* @__PURE__ */ e.jsxs("div", { style: { flex: 1 }, children: [
|
|
1008
|
+
/* @__PURE__ */ e.jsx(te, { style: { fontSize: 12 }, children: "高度 (mm)" }),
|
|
1009
|
+
/* @__PURE__ */ e.jsx(
|
|
1010
|
+
Q,
|
|
1011
|
+
{
|
|
1012
|
+
size: "small",
|
|
1013
|
+
style: { width: "100%" },
|
|
1014
|
+
value: o.customHeight,
|
|
1015
|
+
min: 10,
|
|
1016
|
+
max: 2e3,
|
|
1017
|
+
onChange: (i) => d({ customHeight: i ?? 297 })
|
|
1018
|
+
}
|
|
1019
|
+
)
|
|
1020
|
+
] })
|
|
1021
|
+
] }),
|
|
1022
|
+
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
1023
|
+
/* @__PURE__ */ e.jsx(te, { style: { fontSize: 12 }, children: "方向" }),
|
|
1024
|
+
/* @__PURE__ */ e.jsxs(
|
|
1025
|
+
Ne.Group,
|
|
1026
|
+
{
|
|
1027
|
+
value: o.orientation,
|
|
1028
|
+
onChange: (i) => s(i.target.value),
|
|
1029
|
+
size: "small",
|
|
1030
|
+
style: { width: "100%", display: "flex" },
|
|
1031
|
+
children: [
|
|
1032
|
+
/* @__PURE__ */ e.jsx(Ne.Button, { value: "portrait", style: { flex: 1, textAlign: "center" }, children: "纵向" }),
|
|
1033
|
+
/* @__PURE__ */ e.jsx(Ne.Button, { value: "landscape", style: { flex: 1, textAlign: "center" }, children: "横向" })
|
|
1034
|
+
]
|
|
1035
|
+
}
|
|
1036
|
+
)
|
|
1037
|
+
] }),
|
|
1038
|
+
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
1039
|
+
/* @__PURE__ */ e.jsx(te, { style: { fontSize: 12 }, children: "页边距 (mm)" }),
|
|
1040
|
+
/* @__PURE__ */ e.jsxs("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 8 }, children: [
|
|
1041
|
+
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
1042
|
+
/* @__PURE__ */ e.jsx(te, { style: { fontSize: 11 }, children: "上" }),
|
|
1043
|
+
/* @__PURE__ */ e.jsx(
|
|
1044
|
+
Q,
|
|
1045
|
+
{
|
|
1046
|
+
size: "small",
|
|
1047
|
+
style: { width: "100%" },
|
|
1048
|
+
value: o.marginTop,
|
|
1049
|
+
min: 0,
|
|
1050
|
+
max: 100,
|
|
1051
|
+
onChange: (i) => d({ marginTop: i ?? 10 })
|
|
1052
|
+
}
|
|
1053
|
+
)
|
|
1054
|
+
] }),
|
|
1055
|
+
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
1056
|
+
/* @__PURE__ */ e.jsx(te, { style: { fontSize: 11 }, children: "右" }),
|
|
1057
|
+
/* @__PURE__ */ e.jsx(
|
|
1058
|
+
Q,
|
|
1059
|
+
{
|
|
1060
|
+
size: "small",
|
|
1061
|
+
style: { width: "100%" },
|
|
1062
|
+
value: o.marginRight,
|
|
1063
|
+
min: 0,
|
|
1064
|
+
max: 100,
|
|
1065
|
+
onChange: (i) => d({ marginRight: i ?? 10 })
|
|
1066
|
+
}
|
|
1067
|
+
)
|
|
1068
|
+
] }),
|
|
1069
|
+
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
1070
|
+
/* @__PURE__ */ e.jsx(te, { style: { fontSize: 11 }, children: "下" }),
|
|
1071
|
+
/* @__PURE__ */ e.jsx(
|
|
1072
|
+
Q,
|
|
1073
|
+
{
|
|
1074
|
+
size: "small",
|
|
1075
|
+
style: { width: "100%" },
|
|
1076
|
+
value: o.marginBottom,
|
|
1077
|
+
min: 0,
|
|
1078
|
+
max: 100,
|
|
1079
|
+
onChange: (i) => d({ marginBottom: i ?? 10 })
|
|
1080
|
+
}
|
|
1081
|
+
)
|
|
1082
|
+
] }),
|
|
1083
|
+
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
1084
|
+
/* @__PURE__ */ e.jsx(te, { style: { fontSize: 11 }, children: "左" }),
|
|
1085
|
+
/* @__PURE__ */ e.jsx(
|
|
1086
|
+
Q,
|
|
1087
|
+
{
|
|
1088
|
+
size: "small",
|
|
1089
|
+
style: { width: "100%" },
|
|
1090
|
+
value: o.marginLeft,
|
|
1091
|
+
min: 0,
|
|
1092
|
+
max: 100,
|
|
1093
|
+
onChange: (i) => d({ marginLeft: i ?? 10 })
|
|
1094
|
+
}
|
|
1095
|
+
)
|
|
1096
|
+
] })
|
|
1097
|
+
] })
|
|
1098
|
+
] })
|
|
1099
|
+
] })
|
|
1100
|
+
}
|
|
1101
|
+
);
|
|
1102
|
+
}, { Text: An } = fe, Fn = [
|
|
1103
|
+
{ type: "text", icon: /* @__PURE__ */ e.jsx(vn, {}), label: "文本" },
|
|
1104
|
+
{ type: "image", icon: /* @__PURE__ */ e.jsx(bn, {}), label: "图片" },
|
|
1105
|
+
{ type: "table", icon: /* @__PURE__ */ e.jsx(jn, {}), label: "表格" },
|
|
1106
|
+
{ type: "barcode", icon: /* @__PURE__ */ e.jsx(Sn, {}), label: "条形码" },
|
|
1107
|
+
{ type: "line", icon: /* @__PURE__ */ e.jsx(wn, {}), label: "分割线" }
|
|
1108
|
+
], Nn = () => {
|
|
1109
|
+
const o = w((r) => r.addComponent), d = K(
|
|
1110
|
+
(r, s) => {
|
|
1111
|
+
r.dataTransfer.setData("componentType", s), r.dataTransfer.effectAllowed = "copy";
|
|
1112
|
+
},
|
|
1113
|
+
[]
|
|
1114
|
+
), a = K(
|
|
1115
|
+
(r) => {
|
|
1116
|
+
o(r);
|
|
1117
|
+
},
|
|
1118
|
+
[o]
|
|
1119
|
+
);
|
|
1120
|
+
return /* @__PURE__ */ e.jsx(
|
|
1121
|
+
me,
|
|
1122
|
+
{
|
|
1123
|
+
title: "组件面板",
|
|
1124
|
+
size: "small",
|
|
1125
|
+
children: /* @__PURE__ */ e.jsx(re, { direction: "vertical", style: { width: "100%" }, size: 4, children: Fn.map((r) => /* @__PURE__ */ e.jsxs(
|
|
1126
|
+
"div",
|
|
1127
|
+
{
|
|
1128
|
+
draggable: !0,
|
|
1129
|
+
onDragStart: (s) => d(s, r.type),
|
|
1130
|
+
onClick: () => a(r.type),
|
|
1131
|
+
style: {
|
|
1132
|
+
cursor: "grab",
|
|
1133
|
+
padding: "8px 12px",
|
|
1134
|
+
border: "1px solid #d9d9d9",
|
|
1135
|
+
borderRadius: 6,
|
|
1136
|
+
display: "flex",
|
|
1137
|
+
alignItems: "center",
|
|
1138
|
+
gap: 8,
|
|
1139
|
+
background: "#fafafa",
|
|
1140
|
+
userSelect: "none",
|
|
1141
|
+
transition: "all 0.2s"
|
|
1142
|
+
},
|
|
1143
|
+
onMouseEnter: (s) => {
|
|
1144
|
+
s.currentTarget.style.background = "#e6f4ff", s.currentTarget.style.borderColor = "#1677ff";
|
|
1145
|
+
},
|
|
1146
|
+
onMouseLeave: (s) => {
|
|
1147
|
+
s.currentTarget.style.background = "#fafafa", s.currentTarget.style.borderColor = "#d9d9d9";
|
|
1148
|
+
},
|
|
1149
|
+
children: [
|
|
1150
|
+
r.icon,
|
|
1151
|
+
/* @__PURE__ */ e.jsx(An, { children: r.label })
|
|
1152
|
+
]
|
|
1153
|
+
},
|
|
1154
|
+
r.type
|
|
1155
|
+
)) })
|
|
1156
|
+
}
|
|
1157
|
+
);
|
|
1158
|
+
};
|
|
1159
|
+
function Pe(o) {
|
|
1160
|
+
try {
|
|
1161
|
+
return JSON.parse(o);
|
|
1162
|
+
} catch {
|
|
1163
|
+
return null;
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
function Te(o, d, a) {
|
|
1167
|
+
const r = `${d}Binding`, s = o.props[r];
|
|
1168
|
+
if (s && s.dataSourceId && s.fieldPath) {
|
|
1169
|
+
const y = a.find((g) => g.id === s.dataSourceId);
|
|
1170
|
+
if (y) {
|
|
1171
|
+
const g = Xe(y);
|
|
1172
|
+
if (g) {
|
|
1173
|
+
const c = Ye(g, s.fieldPath);
|
|
1174
|
+
if (c)
|
|
1175
|
+
return c;
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
return o.props[d] || (s == null ? void 0 : s.staticValue) || "";
|
|
1180
|
+
}
|
|
1181
|
+
function Ye(o, d) {
|
|
1182
|
+
if (!o || !d) return "";
|
|
1183
|
+
try {
|
|
1184
|
+
const a = d.split(".");
|
|
1185
|
+
let r = o;
|
|
1186
|
+
for (const s of a) {
|
|
1187
|
+
if (typeof r != "object" || r === null)
|
|
1188
|
+
return "";
|
|
1189
|
+
r = r[s];
|
|
1190
|
+
}
|
|
1191
|
+
return r != null ? String(r) : "";
|
|
1192
|
+
} catch {
|
|
1193
|
+
return "";
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
function Xe(o) {
|
|
1197
|
+
const d = Pe(o.data);
|
|
1198
|
+
return o.type === "object" && d && typeof d == "object" && !Array.isArray(d) ? d : null;
|
|
1199
|
+
}
|
|
1200
|
+
function Ze(o) {
|
|
1201
|
+
const d = Pe(o.data);
|
|
1202
|
+
return o.type === "array" && Array.isArray(d) ? d : null;
|
|
1203
|
+
}
|
|
1204
|
+
const { TextArea: $n } = ne, { Text: we, Title: er } = fe, Pt = JSON.stringify(
|
|
1205
|
+
{
|
|
1206
|
+
name: "张三",
|
|
1207
|
+
age: 28,
|
|
1208
|
+
department: "技术部",
|
|
1209
|
+
email: "zhangsan@example.com"
|
|
1210
|
+
},
|
|
1211
|
+
null,
|
|
1212
|
+
2
|
|
1213
|
+
), Vn = JSON.stringify(
|
|
1214
|
+
[
|
|
1215
|
+
{ id: 1, product: "商品A", quantity: 2, price: 100 },
|
|
1216
|
+
{ id: 2, product: "商品B", quantity: 5, price: 80 },
|
|
1217
|
+
{ id: 3, product: "商品C", quantity: 1, price: 200 }
|
|
1218
|
+
],
|
|
1219
|
+
null,
|
|
1220
|
+
2
|
|
1221
|
+
), Wn = () => {
|
|
1222
|
+
const o = w((p) => p.dataSources), d = w((p) => p.addDataSource), a = w((p) => p.updateDataSource), r = w((p) => p.removeDataSource), [s, i] = Ce(!1), [y, g] = Ce(null), [c, b] = Ce({
|
|
1223
|
+
name: "",
|
|
1224
|
+
type: "object",
|
|
1225
|
+
data: ""
|
|
1226
|
+
}), v = (p) => {
|
|
1227
|
+
p ? (g(p.id), b({ name: p.name, type: p.type, data: p.data })) : (g(null), b({
|
|
1228
|
+
name: "新数据源",
|
|
1229
|
+
type: "object",
|
|
1230
|
+
data: Pt
|
|
1231
|
+
})), i(!0);
|
|
1232
|
+
}, T = () => {
|
|
1233
|
+
const p = Pe(c.data);
|
|
1234
|
+
if (p === null) {
|
|
1235
|
+
ue.error("JSON 格式不正确");
|
|
1236
|
+
return;
|
|
1237
|
+
}
|
|
1238
|
+
if (c.type === "object" && (Array.isArray(p) || typeof p != "object")) {
|
|
1239
|
+
ue.error("对象类型数据源必须为对象格式");
|
|
1240
|
+
return;
|
|
1241
|
+
}
|
|
1242
|
+
if (c.type === "array" && !Array.isArray(p)) {
|
|
1243
|
+
ue.error("数组类型数据源必须为数组格式");
|
|
1244
|
+
return;
|
|
1245
|
+
}
|
|
1246
|
+
y ? (a(y, c), ue.success("数据源已更新")) : (d(c.name, c.type, c.data), ue.success("数据源已添加")), i(!1);
|
|
1247
|
+
};
|
|
1248
|
+
return /* @__PURE__ */ e.jsxs(
|
|
1249
|
+
me,
|
|
1250
|
+
{
|
|
1251
|
+
title: "数据源",
|
|
1252
|
+
size: "small",
|
|
1253
|
+
extra: /* @__PURE__ */ e.jsx(
|
|
1254
|
+
H,
|
|
1255
|
+
{
|
|
1256
|
+
type: "link",
|
|
1257
|
+
size: "small",
|
|
1258
|
+
icon: /* @__PURE__ */ e.jsx(Ke, {}),
|
|
1259
|
+
onClick: () => v(),
|
|
1260
|
+
children: "添加"
|
|
1261
|
+
}
|
|
1262
|
+
),
|
|
1263
|
+
children: [
|
|
1264
|
+
/* @__PURE__ */ e.jsx(
|
|
1265
|
+
$e,
|
|
1266
|
+
{
|
|
1267
|
+
size: "small",
|
|
1268
|
+
dataSource: o,
|
|
1269
|
+
locale: { emptyText: "暂无数据源" },
|
|
1270
|
+
renderItem: (p) => /* @__PURE__ */ e.jsx(
|
|
1271
|
+
$e.Item,
|
|
1272
|
+
{
|
|
1273
|
+
actions: [
|
|
1274
|
+
/* @__PURE__ */ e.jsx(
|
|
1275
|
+
hn,
|
|
1276
|
+
{
|
|
1277
|
+
menu: {
|
|
1278
|
+
items: [
|
|
1279
|
+
{
|
|
1280
|
+
key: "edit",
|
|
1281
|
+
label: "编辑",
|
|
1282
|
+
icon: /* @__PURE__ */ e.jsx(Tn, {}),
|
|
1283
|
+
onClick: () => v(p)
|
|
1284
|
+
},
|
|
1285
|
+
{
|
|
1286
|
+
type: "divider"
|
|
1287
|
+
},
|
|
1288
|
+
{
|
|
1289
|
+
key: "delete",
|
|
1290
|
+
label: /* @__PURE__ */ e.jsx(
|
|
1291
|
+
zt,
|
|
1292
|
+
{
|
|
1293
|
+
title: "确定要删除这个数据源吗?",
|
|
1294
|
+
onConfirm: (_) => {
|
|
1295
|
+
_ == null || _.stopPropagation(), r(p.id), ue.success("已删除");
|
|
1296
|
+
},
|
|
1297
|
+
okText: "确定",
|
|
1298
|
+
cancelText: "取消",
|
|
1299
|
+
onCancel: (_) => _ == null ? void 0 : _.stopPropagation(),
|
|
1300
|
+
children: /* @__PURE__ */ e.jsx("span", { style: { color: "#ff4d4f", cursor: "pointer" }, children: "删除" })
|
|
1301
|
+
}
|
|
1302
|
+
),
|
|
1303
|
+
icon: /* @__PURE__ */ e.jsx(Ge, { style: { color: "#ff4d4f" } })
|
|
1304
|
+
}
|
|
1305
|
+
]
|
|
1306
|
+
},
|
|
1307
|
+
placement: "bottomRight",
|
|
1308
|
+
children: /* @__PURE__ */ e.jsx(H, { type: "text", size: "small", icon: /* @__PURE__ */ e.jsx(Cn, {}) })
|
|
1309
|
+
}
|
|
1310
|
+
)
|
|
1311
|
+
],
|
|
1312
|
+
children: /* @__PURE__ */ e.jsx(
|
|
1313
|
+
$e.Item.Meta,
|
|
1314
|
+
{
|
|
1315
|
+
avatar: /* @__PURE__ */ e.jsx(Dt, {}),
|
|
1316
|
+
title: /* @__PURE__ */ e.jsx(we, { strong: !0, children: p.name }),
|
|
1317
|
+
description: /* @__PURE__ */ e.jsx(re, { size: 4, children: /* @__PURE__ */ e.jsx(Le, { color: p.type === "object" ? "blue" : "green", children: p.type === "object" ? "对象" : "数组" }) })
|
|
1318
|
+
}
|
|
1319
|
+
)
|
|
1320
|
+
}
|
|
1321
|
+
)
|
|
1322
|
+
}
|
|
1323
|
+
),
|
|
1324
|
+
/* @__PURE__ */ e.jsx(
|
|
1325
|
+
Ue,
|
|
1326
|
+
{
|
|
1327
|
+
title: y ? "编辑数据源" : "添加数据源",
|
|
1328
|
+
open: s,
|
|
1329
|
+
onOk: T,
|
|
1330
|
+
onCancel: () => i(!1),
|
|
1331
|
+
okText: "保存",
|
|
1332
|
+
cancelText: "取消",
|
|
1333
|
+
children: /* @__PURE__ */ e.jsxs(re, { direction: "vertical", style: { width: "100%" }, size: "middle", children: [
|
|
1334
|
+
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
1335
|
+
/* @__PURE__ */ e.jsx(we, { strong: !0, style: { display: "block", marginBottom: 4 }, children: "名称" }),
|
|
1336
|
+
/* @__PURE__ */ e.jsx(
|
|
1337
|
+
ne,
|
|
1338
|
+
{
|
|
1339
|
+
placeholder: "请输入数据源名称",
|
|
1340
|
+
value: c.name,
|
|
1341
|
+
onChange: (p) => b({ ...c, name: p.target.value })
|
|
1342
|
+
}
|
|
1343
|
+
)
|
|
1344
|
+
] }),
|
|
1345
|
+
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
1346
|
+
/* @__PURE__ */ e.jsx(we, { strong: !0, style: { display: "block", marginBottom: 4 }, children: "类型" }),
|
|
1347
|
+
/* @__PURE__ */ e.jsx(
|
|
1348
|
+
Z,
|
|
1349
|
+
{
|
|
1350
|
+
options: [
|
|
1351
|
+
{ label: "对象", value: "object" },
|
|
1352
|
+
{ label: "数组", value: "array" }
|
|
1353
|
+
],
|
|
1354
|
+
style: { width: "100%" },
|
|
1355
|
+
value: c.type,
|
|
1356
|
+
onChange: (p) => {
|
|
1357
|
+
b({
|
|
1358
|
+
...c,
|
|
1359
|
+
type: p,
|
|
1360
|
+
data: p === "object" ? Pt : Vn
|
|
1361
|
+
});
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
)
|
|
1365
|
+
] }),
|
|
1366
|
+
/* @__PURE__ */ e.jsx(se, { style: { margin: "8px 0" } }),
|
|
1367
|
+
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
1368
|
+
/* @__PURE__ */ e.jsx(we, { strong: !0, style: { display: "block", marginBottom: 4 }, children: "JSON 数据" }),
|
|
1369
|
+
/* @__PURE__ */ e.jsx(
|
|
1370
|
+
$n,
|
|
1371
|
+
{
|
|
1372
|
+
rows: 12,
|
|
1373
|
+
placeholder: "请输入 JSON 数据",
|
|
1374
|
+
value: c.data,
|
|
1375
|
+
onChange: (p) => b({ ...c, data: p.target.value })
|
|
1376
|
+
}
|
|
1377
|
+
)
|
|
1378
|
+
] })
|
|
1379
|
+
] })
|
|
1380
|
+
}
|
|
1381
|
+
)
|
|
1382
|
+
]
|
|
1383
|
+
}
|
|
1384
|
+
);
|
|
1385
|
+
}, Bn = () => /* @__PURE__ */ e.jsx(
|
|
1386
|
+
fn,
|
|
1387
|
+
{
|
|
1388
|
+
bordered: !1,
|
|
1389
|
+
defaultActiveKey: ["1", "2"],
|
|
1390
|
+
expandIcon: ({ isActive: o }) => /* @__PURE__ */ e.jsx(Rn, { rotate: o ? 90 : 0 }),
|
|
1391
|
+
style: { height: "100%", overflowY: "auto" },
|
|
1392
|
+
items: [
|
|
1393
|
+
{
|
|
1394
|
+
key: "1",
|
|
1395
|
+
label: "页面设置",
|
|
1396
|
+
children: /* @__PURE__ */ e.jsx(Dn, {})
|
|
1397
|
+
},
|
|
1398
|
+
{
|
|
1399
|
+
key: "2",
|
|
1400
|
+
label: "组件",
|
|
1401
|
+
children: /* @__PURE__ */ e.jsx(Nn, {})
|
|
1402
|
+
},
|
|
1403
|
+
{
|
|
1404
|
+
key: "3",
|
|
1405
|
+
label: "数据源",
|
|
1406
|
+
children: /* @__PURE__ */ e.jsx(Wn, {})
|
|
1407
|
+
}
|
|
1408
|
+
]
|
|
1409
|
+
}
|
|
1410
|
+
);
|
|
1411
|
+
function kt(o) {
|
|
1412
|
+
const d = [];
|
|
1413
|
+
d.push(1, 1, 0, 1, 1, 0, 1, 1);
|
|
1414
|
+
for (let a = 0; a < o.length; a++) {
|
|
1415
|
+
const s = (o.charCodeAt(a) % 103).toString(2).padStart(7, "0");
|
|
1416
|
+
for (const i of s)
|
|
1417
|
+
d.push(i === "1" ? 1 : 0);
|
|
1418
|
+
}
|
|
1419
|
+
return d.push(1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1), d;
|
|
1420
|
+
}
|
|
1421
|
+
const Qe = ({ value: o, format: d }) => {
|
|
1422
|
+
const a = ee(() => kt(o), [o, d]);
|
|
1423
|
+
if (!o)
|
|
1424
|
+
return /* @__PURE__ */ e.jsx("div", { style: { fontSize: 11, color: "#999" }, children: "请设置条形码值" });
|
|
1425
|
+
const r = 2, s = 44, i = a.length * r;
|
|
1426
|
+
return /* @__PURE__ */ e.jsxs("div", { style: { textAlign: "center", overflow: "hidden", maxWidth: "100%" }, children: [
|
|
1427
|
+
/* @__PURE__ */ e.jsx(
|
|
1428
|
+
"canvas",
|
|
1429
|
+
{
|
|
1430
|
+
ref: (y) => {
|
|
1431
|
+
if (!y) return;
|
|
1432
|
+
const g = y.getContext("2d");
|
|
1433
|
+
g && (y.width = i, y.height = s, g.clearRect(0, 0, i, s), a.forEach((c, b) => {
|
|
1434
|
+
g.fillStyle = c === 1 ? "#000" : "#fff", g.fillRect(b * r, 0, r, s);
|
|
1435
|
+
}));
|
|
1436
|
+
},
|
|
1437
|
+
style: { width: "100%", maxWidth: i, height: s }
|
|
1438
|
+
}
|
|
1439
|
+
),
|
|
1440
|
+
/* @__PURE__ */ e.jsx("div", { style: { fontSize: 10, marginTop: 1, letterSpacing: 1 }, children: o })
|
|
1441
|
+
] });
|
|
1442
|
+
}, _t = he.memo(
|
|
1443
|
+
({ comp: o, selected: d, isPreview: a = !1, dataSources: r = [] }) => {
|
|
1444
|
+
const s = {
|
|
1445
|
+
width: "100%",
|
|
1446
|
+
height: "100%",
|
|
1447
|
+
overflow: "hidden",
|
|
1448
|
+
boxSizing: "border-box",
|
|
1449
|
+
outline: a ? "none" : d ? "2px solid #1677ff" : "1px dashed #d9d9d9",
|
|
1450
|
+
outlineOffset: -1
|
|
1451
|
+
}, i = (y) => Te(o, y, r);
|
|
1452
|
+
switch (o.type) {
|
|
1453
|
+
case "text":
|
|
1454
|
+
return /* @__PURE__ */ e.jsx(
|
|
1455
|
+
"div",
|
|
1456
|
+
{
|
|
1457
|
+
style: {
|
|
1458
|
+
...s,
|
|
1459
|
+
fontSize: o.props.fontSize || 14,
|
|
1460
|
+
fontWeight: o.props.fontWeight || "normal",
|
|
1461
|
+
fontStyle: o.props.fontStyle || "normal",
|
|
1462
|
+
textAlign: o.props.textAlign || "left",
|
|
1463
|
+
color: o.props.color || "#000",
|
|
1464
|
+
backgroundColor: o.props.backgroundColor || "transparent",
|
|
1465
|
+
padding: 4,
|
|
1466
|
+
whiteSpace: "pre-wrap",
|
|
1467
|
+
wordBreak: "break-word"
|
|
1468
|
+
},
|
|
1469
|
+
children: i("content") || ""
|
|
1470
|
+
}
|
|
1471
|
+
);
|
|
1472
|
+
case "image":
|
|
1473
|
+
const y = i("src") || o.props.src;
|
|
1474
|
+
return /* @__PURE__ */ e.jsx("div", { style: s, children: y ? /* @__PURE__ */ e.jsx(
|
|
1475
|
+
"img",
|
|
1476
|
+
{
|
|
1477
|
+
src: y,
|
|
1478
|
+
style: {
|
|
1479
|
+
width: "100%",
|
|
1480
|
+
height: "100%",
|
|
1481
|
+
objectFit: o.props.fit || "contain"
|
|
1482
|
+
},
|
|
1483
|
+
alt: ""
|
|
1484
|
+
}
|
|
1485
|
+
) : /* @__PURE__ */ e.jsx(
|
|
1486
|
+
"div",
|
|
1487
|
+
{
|
|
1488
|
+
style: {
|
|
1489
|
+
width: "100%",
|
|
1490
|
+
height: "100%",
|
|
1491
|
+
display: "flex",
|
|
1492
|
+
alignItems: "center",
|
|
1493
|
+
justifyContent: "center",
|
|
1494
|
+
color: "#bbb",
|
|
1495
|
+
fontSize: 12
|
|
1496
|
+
},
|
|
1497
|
+
children: "请在属性中设置图片地址"
|
|
1498
|
+
}
|
|
1499
|
+
) });
|
|
1500
|
+
case "table":
|
|
1501
|
+
return /* @__PURE__ */ e.jsx(Ln, { comp: o, style: s, dataSources: r });
|
|
1502
|
+
case "barcode":
|
|
1503
|
+
const g = i("value") || o.props.value || "123456";
|
|
1504
|
+
return /* @__PURE__ */ e.jsx(
|
|
1505
|
+
"div",
|
|
1506
|
+
{
|
|
1507
|
+
style: {
|
|
1508
|
+
...s,
|
|
1509
|
+
display: "flex",
|
|
1510
|
+
alignItems: "center",
|
|
1511
|
+
justifyContent: "center",
|
|
1512
|
+
padding: 4
|
|
1513
|
+
},
|
|
1514
|
+
children: /* @__PURE__ */ e.jsx(
|
|
1515
|
+
Qe,
|
|
1516
|
+
{
|
|
1517
|
+
value: g,
|
|
1518
|
+
format: o.props.format || "CODE128"
|
|
1519
|
+
}
|
|
1520
|
+
)
|
|
1521
|
+
}
|
|
1522
|
+
);
|
|
1523
|
+
case "line":
|
|
1524
|
+
return /* @__PURE__ */ e.jsx(
|
|
1525
|
+
"div",
|
|
1526
|
+
{
|
|
1527
|
+
style: {
|
|
1528
|
+
...s,
|
|
1529
|
+
display: "flex",
|
|
1530
|
+
alignItems: "center",
|
|
1531
|
+
border: "none",
|
|
1532
|
+
outline: d ? "2px solid #1677ff" : "1px dashed transparent"
|
|
1533
|
+
},
|
|
1534
|
+
children: /* @__PURE__ */ e.jsx(
|
|
1535
|
+
"hr",
|
|
1536
|
+
{
|
|
1537
|
+
style: {
|
|
1538
|
+
width: "100%",
|
|
1539
|
+
border: "none",
|
|
1540
|
+
borderTop: `${o.props.thickness || 1}px ${o.props.style || "solid"} ${o.props.color || "#000"}`,
|
|
1541
|
+
margin: 0
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
)
|
|
1545
|
+
}
|
|
1546
|
+
);
|
|
1547
|
+
default:
|
|
1548
|
+
return /* @__PURE__ */ e.jsx("div", { style: s, children: o.type });
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
), Ln = ({ comp: o, style: d, dataSources: a = [] }) => {
|
|
1552
|
+
const r = o.props.borderWidth || 1, s = o.props.borderColor || "#000", i = o.tableColumns || [], y = o.props.tableDataSourceId, g = y ? a.find((T) => T.id === y) : null, c = g ? Ze(g) : null;
|
|
1553
|
+
if (c && c.length > 0)
|
|
1554
|
+
return /* @__PURE__ */ e.jsxs(
|
|
1555
|
+
"table",
|
|
1556
|
+
{
|
|
1557
|
+
style: {
|
|
1558
|
+
...d,
|
|
1559
|
+
borderCollapse: "collapse",
|
|
1560
|
+
width: "100%",
|
|
1561
|
+
height: "100%"
|
|
1562
|
+
},
|
|
1563
|
+
children: [
|
|
1564
|
+
i.length > 0 && /* @__PURE__ */ e.jsx("thead", { children: /* @__PURE__ */ e.jsx("tr", { style: { backgroundColor: "#f5f5f5" }, children: i.map((T, p) => /* @__PURE__ */ e.jsx(
|
|
1565
|
+
"th",
|
|
1566
|
+
{
|
|
1567
|
+
style: {
|
|
1568
|
+
border: `${r}px solid ${s}`,
|
|
1569
|
+
padding: 4,
|
|
1570
|
+
fontSize: 12,
|
|
1571
|
+
fontWeight: "bold",
|
|
1572
|
+
textAlign: "center"
|
|
1573
|
+
},
|
|
1574
|
+
children: T.title
|
|
1575
|
+
},
|
|
1576
|
+
p
|
|
1577
|
+
)) }) }),
|
|
1578
|
+
/* @__PURE__ */ e.jsx("tbody", { children: c.map((T, p) => /* @__PURE__ */ e.jsx("tr", { children: i.map((_, I) => /* @__PURE__ */ e.jsx(
|
|
1579
|
+
"td",
|
|
1580
|
+
{
|
|
1581
|
+
style: {
|
|
1582
|
+
border: `${r}px solid ${s}`,
|
|
1583
|
+
padding: 4,
|
|
1584
|
+
fontSize: 12,
|
|
1585
|
+
textAlign: "center"
|
|
1586
|
+
},
|
|
1587
|
+
children: _.fieldPath ? T[_.fieldPath] : ""
|
|
1588
|
+
},
|
|
1589
|
+
I
|
|
1590
|
+
)) }, p)) })
|
|
1591
|
+
]
|
|
1592
|
+
}
|
|
1593
|
+
);
|
|
1594
|
+
const b = o.props.rows || 3, v = Math.max(o.props.cols || 3, i.length || 3);
|
|
1595
|
+
return /* @__PURE__ */ e.jsx(
|
|
1596
|
+
"table",
|
|
1597
|
+
{
|
|
1598
|
+
style: {
|
|
1599
|
+
...d,
|
|
1600
|
+
borderCollapse: "collapse",
|
|
1601
|
+
width: "100%",
|
|
1602
|
+
height: "100%"
|
|
1603
|
+
},
|
|
1604
|
+
children: /* @__PURE__ */ e.jsx("tbody", { children: Array.from({ length: b }).map((T, p) => /* @__PURE__ */ e.jsx("tr", { children: Array.from({ length: v }).map((_, I) => /* @__PURE__ */ e.jsx(
|
|
1605
|
+
"td",
|
|
1606
|
+
{
|
|
1607
|
+
style: {
|
|
1608
|
+
border: `${r}px solid ${s}`,
|
|
1609
|
+
padding: 2,
|
|
1610
|
+
fontSize: 12,
|
|
1611
|
+
textAlign: "center"
|
|
1612
|
+
},
|
|
1613
|
+
children: " "
|
|
1614
|
+
},
|
|
1615
|
+
I
|
|
1616
|
+
)) }, p)) })
|
|
1617
|
+
}
|
|
1618
|
+
);
|
|
1619
|
+
}, Ot = ({ isPreview: o = !1 }) => {
|
|
1620
|
+
const d = w((n) => n.components), a = w((n) => n.selectedId), r = w((n) => n.pageSettings), s = w((n) => n.selectComponent);
|
|
1621
|
+
w((n) => n.updateComponent);
|
|
1622
|
+
const i = w((n) => n.setComponents), y = w((n) => n.addComponent), g = w((n) => n.gridSettings), c = w((n) => n.dataSources), b = ee(() => {
|
|
1623
|
+
const n = Ee[r.paperSize];
|
|
1624
|
+
if (!n)
|
|
1625
|
+
return {
|
|
1626
|
+
width: r.customWidth * A,
|
|
1627
|
+
height: r.customHeight * A
|
|
1628
|
+
};
|
|
1629
|
+
const h = n.width * A, x = n.height * A;
|
|
1630
|
+
return r.orientation === "landscape" ? { width: x, height: h } : { width: h, height: x };
|
|
1631
|
+
}, [r]), v = ee(
|
|
1632
|
+
() => ({
|
|
1633
|
+
top: r.marginTop * A,
|
|
1634
|
+
right: r.marginRight * A,
|
|
1635
|
+
bottom: r.marginBottom * A,
|
|
1636
|
+
left: r.marginLeft * A
|
|
1637
|
+
}),
|
|
1638
|
+
[r]
|
|
1639
|
+
), T = b.width - v.left - v.right, p = b.height - v.top - v.bottom, _ = ee(
|
|
1640
|
+
() => d.map((n) => ({
|
|
1641
|
+
i: n.id,
|
|
1642
|
+
x: n.x,
|
|
1643
|
+
y: n.y,
|
|
1644
|
+
w: n.w,
|
|
1645
|
+
h: n.h
|
|
1646
|
+
})),
|
|
1647
|
+
[d]
|
|
1648
|
+
), I = K(
|
|
1649
|
+
(n) => {
|
|
1650
|
+
const h = d.map((x, E) => {
|
|
1651
|
+
const u = n[E];
|
|
1652
|
+
return u ? { ...x, x: u.x, y: u.y, w: u.w, h: u.h } : x;
|
|
1653
|
+
});
|
|
1654
|
+
i(h);
|
|
1655
|
+
},
|
|
1656
|
+
[d, i]
|
|
1657
|
+
), m = K(
|
|
1658
|
+
(n, h, x) => {
|
|
1659
|
+
var D, N;
|
|
1660
|
+
const E = x, u = (D = E.dataTransfer) == null ? void 0 : D.getData("componentType");
|
|
1661
|
+
if (!u) return;
|
|
1662
|
+
const j = (N = x.target.closest(".react-grid-layout")) == null ? void 0 : N.getBoundingClientRect();
|
|
1663
|
+
if (j) {
|
|
1664
|
+
const L = Math.floor((E.clientX - j.left) / (T / g.cols)), J = Math.floor((E.clientY - j.top) / (T / g.cols));
|
|
1665
|
+
y(u, Math.max(0, L), Math.max(0, J));
|
|
1666
|
+
} else
|
|
1667
|
+
y(u);
|
|
1668
|
+
},
|
|
1669
|
+
[y, T, g.cols]
|
|
1670
|
+
), P = K(
|
|
1671
|
+
(n) => {
|
|
1672
|
+
s(n === a ? null : n);
|
|
1673
|
+
},
|
|
1674
|
+
[s, a]
|
|
1675
|
+
);
|
|
1676
|
+
return /* @__PURE__ */ e.jsx(
|
|
1677
|
+
"div",
|
|
1678
|
+
{
|
|
1679
|
+
style: {
|
|
1680
|
+
flex: 1,
|
|
1681
|
+
overflow: "auto",
|
|
1682
|
+
background: "#e8e8e8",
|
|
1683
|
+
display: "flex",
|
|
1684
|
+
justifyContent: "center",
|
|
1685
|
+
padding: "24px 0"
|
|
1686
|
+
},
|
|
1687
|
+
children: /* @__PURE__ */ e.jsxs(
|
|
1688
|
+
"div",
|
|
1689
|
+
{
|
|
1690
|
+
id: "print-paper",
|
|
1691
|
+
style: {
|
|
1692
|
+
width: b.width,
|
|
1693
|
+
height: b.height,
|
|
1694
|
+
background: "#fff",
|
|
1695
|
+
boxShadow: "0 2px 12px rgba(0,0,0,0.15)",
|
|
1696
|
+
position: "relative",
|
|
1697
|
+
flexShrink: 0
|
|
1698
|
+
},
|
|
1699
|
+
children: [
|
|
1700
|
+
r.showHeader && /* @__PURE__ */ e.jsx(
|
|
1701
|
+
"div",
|
|
1702
|
+
{
|
|
1703
|
+
style: {
|
|
1704
|
+
position: "absolute",
|
|
1705
|
+
top: 0,
|
|
1706
|
+
left: v.left,
|
|
1707
|
+
right: v.right,
|
|
1708
|
+
height: v.top,
|
|
1709
|
+
display: "flex",
|
|
1710
|
+
alignItems: "center",
|
|
1711
|
+
justifyContent: "center",
|
|
1712
|
+
fontSize: 12,
|
|
1713
|
+
color: "#999",
|
|
1714
|
+
borderBottom: "1px dashed #ddd",
|
|
1715
|
+
overflow: "hidden"
|
|
1716
|
+
},
|
|
1717
|
+
children: r.headerContent
|
|
1718
|
+
}
|
|
1719
|
+
),
|
|
1720
|
+
r.showFooter && /* @__PURE__ */ e.jsxs(
|
|
1721
|
+
"div",
|
|
1722
|
+
{
|
|
1723
|
+
style: {
|
|
1724
|
+
position: "absolute",
|
|
1725
|
+
bottom: 0,
|
|
1726
|
+
left: v.left,
|
|
1727
|
+
right: v.right,
|
|
1728
|
+
height: v.bottom,
|
|
1729
|
+
display: "flex",
|
|
1730
|
+
alignItems: "center",
|
|
1731
|
+
justifyContent: r.showPageNumber ? "space-between" : "center",
|
|
1732
|
+
fontSize: 12,
|
|
1733
|
+
color: "#999",
|
|
1734
|
+
borderTop: "1px dashed #ddd",
|
|
1735
|
+
overflow: "hidden",
|
|
1736
|
+
padding: "0 8px"
|
|
1737
|
+
},
|
|
1738
|
+
children: [
|
|
1739
|
+
/* @__PURE__ */ e.jsx("span", { children: r.footerContent }),
|
|
1740
|
+
r.showPageNumber && /* @__PURE__ */ e.jsx("span", { children: r.pageNumberFormat.replace("{page}", "1") })
|
|
1741
|
+
]
|
|
1742
|
+
}
|
|
1743
|
+
),
|
|
1744
|
+
/* @__PURE__ */ e.jsx(
|
|
1745
|
+
"div",
|
|
1746
|
+
{
|
|
1747
|
+
style: {
|
|
1748
|
+
position: "absolute",
|
|
1749
|
+
top: v.top,
|
|
1750
|
+
left: v.left,
|
|
1751
|
+
width: T,
|
|
1752
|
+
height: p
|
|
1753
|
+
},
|
|
1754
|
+
children: o ? /* @__PURE__ */ e.jsx("div", { style: { width: "100%", height: "100%", position: "relative" }, children: d.map((n) => {
|
|
1755
|
+
const h = T / g.cols, x = T / g.cols, E = {
|
|
1756
|
+
position: "absolute",
|
|
1757
|
+
left: n.x * h,
|
|
1758
|
+
top: n.y * x,
|
|
1759
|
+
width: n.w * h,
|
|
1760
|
+
height: n.h * x
|
|
1761
|
+
};
|
|
1762
|
+
return /* @__PURE__ */ e.jsx("div", { style: E, children: /* @__PURE__ */ e.jsx(_t, { comp: n, selected: !1, isPreview: !0, dataSources: c }) }, n.id);
|
|
1763
|
+
}) }) : /* @__PURE__ */ e.jsx(
|
|
1764
|
+
Pn,
|
|
1765
|
+
{
|
|
1766
|
+
className: "canvas-grid",
|
|
1767
|
+
layout: _,
|
|
1768
|
+
cols: g.cols,
|
|
1769
|
+
rowHeight: T / g.cols,
|
|
1770
|
+
width: T,
|
|
1771
|
+
margin: [0, 0],
|
|
1772
|
+
containerPadding: [0, 0],
|
|
1773
|
+
onLayoutChange: I,
|
|
1774
|
+
onDrop: m,
|
|
1775
|
+
isDroppable: !0,
|
|
1776
|
+
isResizable: !0,
|
|
1777
|
+
isDraggable: !0,
|
|
1778
|
+
compactType: null,
|
|
1779
|
+
preventCollision: !0,
|
|
1780
|
+
draggableHandle: ".grid-item-drag-handle",
|
|
1781
|
+
style: { minHeight: p },
|
|
1782
|
+
children: d.map((n) => /* @__PURE__ */ e.jsx(
|
|
1783
|
+
"div",
|
|
1784
|
+
{
|
|
1785
|
+
className: "grid-item-drag-handle",
|
|
1786
|
+
onClick: () => P(n.id),
|
|
1787
|
+
style: { cursor: "move" },
|
|
1788
|
+
children: /* @__PURE__ */ e.jsx(_t, { comp: n, selected: n.id === a, dataSources: c })
|
|
1789
|
+
},
|
|
1790
|
+
n.id
|
|
1791
|
+
))
|
|
1792
|
+
}
|
|
1793
|
+
)
|
|
1794
|
+
}
|
|
1795
|
+
)
|
|
1796
|
+
]
|
|
1797
|
+
}
|
|
1798
|
+
)
|
|
1799
|
+
}
|
|
1800
|
+
);
|
|
1801
|
+
}, { Text: B, Title: tr } = fe, { TextArea: Mn } = ne, Jn = () => {
|
|
1802
|
+
const o = w((n) => n.components), d = w((n) => n.selectedId), a = w((n) => n.dataSources), r = w((n) => n.updateComponent), s = w((n) => n.updateComponentTableColumns), i = ee(
|
|
1803
|
+
() => o.find((n) => n.id === d) || null,
|
|
1804
|
+
[o, d]
|
|
1805
|
+
), [y, g] = Ce([]), c = ee(
|
|
1806
|
+
() => [
|
|
1807
|
+
{ label: "无(使用静态值)", value: "" },
|
|
1808
|
+
...a.map((n) => ({
|
|
1809
|
+
label: n.name,
|
|
1810
|
+
value: n.id,
|
|
1811
|
+
type: n.type
|
|
1812
|
+
}))
|
|
1813
|
+
],
|
|
1814
|
+
[a]
|
|
1815
|
+
), b = K(
|
|
1816
|
+
(n, h) => {
|
|
1817
|
+
d && r(d, {
|
|
1818
|
+
props: { ...i == null ? void 0 : i.props, [n]: h }
|
|
1819
|
+
});
|
|
1820
|
+
},
|
|
1821
|
+
[d, i, r]
|
|
1822
|
+
), v = K(
|
|
1823
|
+
(n, h, x, E) => {
|
|
1824
|
+
if (!d) return;
|
|
1825
|
+
let u = E;
|
|
1826
|
+
h && x && (u = E);
|
|
1827
|
+
const j = `${n}Binding`;
|
|
1828
|
+
r(d, {
|
|
1829
|
+
props: {
|
|
1830
|
+
...i == null ? void 0 : i.props,
|
|
1831
|
+
[n]: u,
|
|
1832
|
+
[j]: {
|
|
1833
|
+
dataSourceId: h,
|
|
1834
|
+
fieldPath: x,
|
|
1835
|
+
staticValue: E
|
|
1836
|
+
}
|
|
1837
|
+
}
|
|
1838
|
+
});
|
|
1839
|
+
},
|
|
1840
|
+
[d, i, r]
|
|
1841
|
+
), T = K((n) => {
|
|
1842
|
+
const h = i == null ? void 0 : i.props[`${n}Binding`], x = String((i == null ? void 0 : i.props[n]) || "");
|
|
1843
|
+
return h ? {
|
|
1844
|
+
field: n,
|
|
1845
|
+
dataSourceId: h.dataSourceId || null,
|
|
1846
|
+
fieldPath: h.fieldPath || "",
|
|
1847
|
+
staticValue: h.staticValue ?? x
|
|
1848
|
+
} : { field: n, dataSourceId: null, fieldPath: "", staticValue: x };
|
|
1849
|
+
}, [i]);
|
|
1850
|
+
if (!i)
|
|
1851
|
+
return /* @__PURE__ */ e.jsx(
|
|
1852
|
+
me,
|
|
1853
|
+
{
|
|
1854
|
+
title: "属性面板",
|
|
1855
|
+
size: "small",
|
|
1856
|
+
style: { height: "100%", borderRadius: 0, borderLeft: 0 },
|
|
1857
|
+
styles: { body: { padding: 16 } },
|
|
1858
|
+
children: /* @__PURE__ */ e.jsx(jt, { description: "请选择画布中的组件", image: jt.PRESENTED_IMAGE_SIMPLE })
|
|
1859
|
+
}
|
|
1860
|
+
);
|
|
1861
|
+
const p = Ft[i.type] || i.type, _ = /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
1862
|
+
/* @__PURE__ */ e.jsx(B, { type: "secondary", style: { fontSize: 12, display: "block", marginBottom: 8 }, children: "位置和大小" }),
|
|
1863
|
+
/* @__PURE__ */ e.jsxs("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 8 }, children: [
|
|
1864
|
+
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
1865
|
+
/* @__PURE__ */ e.jsx(B, { style: { fontSize: 12 }, children: "X" }),
|
|
1866
|
+
/* @__PURE__ */ e.jsx(
|
|
1867
|
+
Q,
|
|
1868
|
+
{
|
|
1869
|
+
size: "small",
|
|
1870
|
+
style: { width: "100%" },
|
|
1871
|
+
value: i.x,
|
|
1872
|
+
onChange: (n) => r(d, { x: n ?? 0 })
|
|
1873
|
+
}
|
|
1874
|
+
)
|
|
1875
|
+
] }),
|
|
1876
|
+
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
1877
|
+
/* @__PURE__ */ e.jsx(B, { style: { fontSize: 12 }, children: "Y" }),
|
|
1878
|
+
/* @__PURE__ */ e.jsx(
|
|
1879
|
+
Q,
|
|
1880
|
+
{
|
|
1881
|
+
size: "small",
|
|
1882
|
+
style: { width: "100%" },
|
|
1883
|
+
value: i.y,
|
|
1884
|
+
onChange: (n) => r(d, { y: n ?? 0 })
|
|
1885
|
+
}
|
|
1886
|
+
)
|
|
1887
|
+
] }),
|
|
1888
|
+
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
1889
|
+
/* @__PURE__ */ e.jsx(B, { style: { fontSize: 12 }, children: "宽度" }),
|
|
1890
|
+
/* @__PURE__ */ e.jsx(
|
|
1891
|
+
Q,
|
|
1892
|
+
{
|
|
1893
|
+
size: "small",
|
|
1894
|
+
style: { width: "100%" },
|
|
1895
|
+
value: i.w,
|
|
1896
|
+
min: 1,
|
|
1897
|
+
onChange: (n) => r(d, { w: n ?? 1 })
|
|
1898
|
+
}
|
|
1899
|
+
)
|
|
1900
|
+
] }),
|
|
1901
|
+
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
1902
|
+
/* @__PURE__ */ e.jsx(B, { style: { fontSize: 12 }, children: "高度" }),
|
|
1903
|
+
/* @__PURE__ */ e.jsx(
|
|
1904
|
+
Q,
|
|
1905
|
+
{
|
|
1906
|
+
size: "small",
|
|
1907
|
+
style: { width: "100%" },
|
|
1908
|
+
value: i.h,
|
|
1909
|
+
min: 1,
|
|
1910
|
+
onChange: (n) => r(d, { h: n ?? 1 })
|
|
1911
|
+
}
|
|
1912
|
+
)
|
|
1913
|
+
] })
|
|
1914
|
+
] })
|
|
1915
|
+
] }), I = ({
|
|
1916
|
+
field: n,
|
|
1917
|
+
label: h,
|
|
1918
|
+
placeholder: x,
|
|
1919
|
+
isTextarea: E = !1
|
|
1920
|
+
}) => {
|
|
1921
|
+
const u = T(n), j = a.find(($) => $.id === u.dataSourceId), D = j ? Xe(j) : null, N = D ? Object.keys(D) : [], [L, J] = he.useState(u.staticValue);
|
|
1922
|
+
return he.useEffect(() => {
|
|
1923
|
+
J(u.staticValue);
|
|
1924
|
+
}, [u.staticValue, u.dataSourceId]), /* @__PURE__ */ e.jsxs("div", { children: [
|
|
1925
|
+
/* @__PURE__ */ e.jsx(B, { style: { fontSize: 12, display: "block", marginBottom: 4 }, children: h }),
|
|
1926
|
+
/* @__PURE__ */ e.jsx("div", { style: { marginBottom: 4 }, children: /* @__PURE__ */ e.jsx(
|
|
1927
|
+
Z,
|
|
1928
|
+
{
|
|
1929
|
+
size: "small",
|
|
1930
|
+
style: { width: "100%" },
|
|
1931
|
+
placeholder: "选择数据源",
|
|
1932
|
+
value: u.dataSourceId || "",
|
|
1933
|
+
onChange: ($) => {
|
|
1934
|
+
v(
|
|
1935
|
+
n,
|
|
1936
|
+
$ || null,
|
|
1937
|
+
$ && u.fieldPath || "",
|
|
1938
|
+
u.staticValue
|
|
1939
|
+
);
|
|
1940
|
+
},
|
|
1941
|
+
options: c
|
|
1942
|
+
}
|
|
1943
|
+
) }),
|
|
1944
|
+
u.dataSourceId && /* @__PURE__ */ e.jsx("div", { style: { marginBottom: 4 }, children: /* @__PURE__ */ e.jsx(
|
|
1945
|
+
Z,
|
|
1946
|
+
{
|
|
1947
|
+
size: "small",
|
|
1948
|
+
style: { width: "100%" },
|
|
1949
|
+
placeholder: "选择字段",
|
|
1950
|
+
value: u.fieldPath,
|
|
1951
|
+
onChange: ($) => {
|
|
1952
|
+
v(n, u.dataSourceId, $ || "", u.staticValue);
|
|
1953
|
+
},
|
|
1954
|
+
options: [
|
|
1955
|
+
{ label: "请选择字段", value: "" },
|
|
1956
|
+
...N.map(($) => ({ label: $, value: $ }))
|
|
1957
|
+
]
|
|
1958
|
+
}
|
|
1959
|
+
) }),
|
|
1960
|
+
u.dataSourceId ? /* @__PURE__ */ e.jsxs("div", { style: {
|
|
1961
|
+
padding: 6,
|
|
1962
|
+
background: "#f0f5ff",
|
|
1963
|
+
border: "1px solid #adc6ff",
|
|
1964
|
+
borderRadius: 4,
|
|
1965
|
+
fontSize: 12
|
|
1966
|
+
}, children: [
|
|
1967
|
+
/* @__PURE__ */ e.jsx(Dt, { style: { marginRight: 4, color: "#1890ff" } }),
|
|
1968
|
+
/* @__PURE__ */ e.jsx("span", { style: { fontWeight: 500 }, children: "数据绑定已启用" }),
|
|
1969
|
+
j && u.fieldPath && /* @__PURE__ */ e.jsxs("span", { style: { marginLeft: 8 }, children: [
|
|
1970
|
+
/* @__PURE__ */ e.jsx(Le, { color: "blue", children: j.name }),
|
|
1971
|
+
/* @__PURE__ */ e.jsx(Le, { color: "green", children: u.fieldPath })
|
|
1972
|
+
] })
|
|
1973
|
+
] }) : E ? /* @__PURE__ */ e.jsx(
|
|
1974
|
+
Mn,
|
|
1975
|
+
{
|
|
1976
|
+
rows: 3,
|
|
1977
|
+
placeholder: x,
|
|
1978
|
+
value: L,
|
|
1979
|
+
onChange: ($) => J($.target.value),
|
|
1980
|
+
onBlur: () => {
|
|
1981
|
+
v(n, null, "", L);
|
|
1982
|
+
}
|
|
1983
|
+
}
|
|
1984
|
+
) : /* @__PURE__ */ e.jsx(
|
|
1985
|
+
ne,
|
|
1986
|
+
{
|
|
1987
|
+
placeholder: x,
|
|
1988
|
+
value: L,
|
|
1989
|
+
onChange: ($) => J($.target.value),
|
|
1990
|
+
onBlur: () => {
|
|
1991
|
+
v(n, null, "", L);
|
|
1992
|
+
}
|
|
1993
|
+
}
|
|
1994
|
+
)
|
|
1995
|
+
] });
|
|
1996
|
+
}, m = () => {
|
|
1997
|
+
const n = i.tableColumns || [], h = a.filter((C) => C.type === "array"), x = i.props.tableDataSourceId || "", E = h.find((C) => C.id === x), u = y.length > 0 ? y : n, [j, D] = he.useState({}), N = () => {
|
|
1998
|
+
s(d, u);
|
|
1999
|
+
}, L = () => {
|
|
2000
|
+
const C = [...u, { title: `列${u.length + 1}` }];
|
|
2001
|
+
g(C);
|
|
2002
|
+
}, J = (C) => {
|
|
2003
|
+
const z = u.filter((Y, q) => q !== C);
|
|
2004
|
+
g(z);
|
|
2005
|
+
}, $ = (C, z, Y) => {
|
|
2006
|
+
const q = [...u];
|
|
2007
|
+
q[C] = { ...q[C], [z]: Y }, g(q);
|
|
2008
|
+
};
|
|
2009
|
+
let ae = [];
|
|
2010
|
+
if (E) {
|
|
2011
|
+
const C = Pe(E.data);
|
|
2012
|
+
Array.isArray(C) && C.length > 0 && typeof C[0] == "object" && (ae = Object.keys(C[0]));
|
|
2013
|
+
}
|
|
2014
|
+
const le = [
|
|
2015
|
+
{
|
|
2016
|
+
title: "列标题",
|
|
2017
|
+
dataIndex: "title",
|
|
2018
|
+
width: 100,
|
|
2019
|
+
render: (C, z) => {
|
|
2020
|
+
const Y = z.key in j ? j[z.key] : z.title;
|
|
2021
|
+
return /* @__PURE__ */ e.jsx(
|
|
2022
|
+
ne,
|
|
2023
|
+
{
|
|
2024
|
+
size: "small",
|
|
2025
|
+
value: Y,
|
|
2026
|
+
placeholder: "列标题",
|
|
2027
|
+
onChange: (q) => {
|
|
2028
|
+
D({
|
|
2029
|
+
...j,
|
|
2030
|
+
[z.key]: q.target.value
|
|
2031
|
+
});
|
|
2032
|
+
},
|
|
2033
|
+
onBlur: () => {
|
|
2034
|
+
if (z.key in j) {
|
|
2035
|
+
$(Number(z.key), "title", j[z.key]);
|
|
2036
|
+
const q = { ...j };
|
|
2037
|
+
delete q[z.key], D(q), N();
|
|
2038
|
+
}
|
|
2039
|
+
}
|
|
2040
|
+
}
|
|
2041
|
+
);
|
|
2042
|
+
}
|
|
2043
|
+
},
|
|
2044
|
+
{
|
|
2045
|
+
title: "绑定字段",
|
|
2046
|
+
dataIndex: "fieldPath",
|
|
2047
|
+
width: 120,
|
|
2048
|
+
render: (C, z) => /* @__PURE__ */ e.jsx(
|
|
2049
|
+
Z,
|
|
2050
|
+
{
|
|
2051
|
+
size: "small",
|
|
2052
|
+
style: { width: "100%" },
|
|
2053
|
+
value: z.fieldPath || "",
|
|
2054
|
+
placeholder: E ? "绑定字段" : "选择数据源先",
|
|
2055
|
+
disabled: !E,
|
|
2056
|
+
onChange: (Y) => {
|
|
2057
|
+
$(Number(z.key), "fieldPath", Y || ""), N();
|
|
2058
|
+
},
|
|
2059
|
+
options: [
|
|
2060
|
+
{ label: "无绑定", value: "" },
|
|
2061
|
+
...ae.map((Y) => ({ label: Y, value: Y }))
|
|
2062
|
+
]
|
|
2063
|
+
}
|
|
2064
|
+
)
|
|
2065
|
+
},
|
|
2066
|
+
{
|
|
2067
|
+
title: "操作",
|
|
2068
|
+
width: 60,
|
|
2069
|
+
render: (C, z) => /* @__PURE__ */ e.jsx(
|
|
2070
|
+
zt,
|
|
2071
|
+
{
|
|
2072
|
+
title: "确定要删除吗?",
|
|
2073
|
+
onConfirm: () => {
|
|
2074
|
+
J(Number(z.key)), N();
|
|
2075
|
+
},
|
|
2076
|
+
okText: "确定",
|
|
2077
|
+
cancelText: "取消",
|
|
2078
|
+
children: /* @__PURE__ */ e.jsx(H, { type: "text", danger: !0, size: "small", icon: /* @__PURE__ */ e.jsx(Ge, {}) })
|
|
2079
|
+
}
|
|
2080
|
+
)
|
|
2081
|
+
}
|
|
2082
|
+
], M = u.map((C, z) => ({
|
|
2083
|
+
...C,
|
|
2084
|
+
key: String(z)
|
|
2085
|
+
}));
|
|
2086
|
+
return /* @__PURE__ */ e.jsxs("div", { children: [
|
|
2087
|
+
/* @__PURE__ */ e.jsx("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: 8 }, children: /* @__PURE__ */ e.jsx(B, { style: { fontSize: 12 }, children: "表格数据源" }) }),
|
|
2088
|
+
/* @__PURE__ */ e.jsx(
|
|
2089
|
+
Z,
|
|
2090
|
+
{
|
|
2091
|
+
size: "small",
|
|
2092
|
+
style: { width: "100%", marginBottom: 8 },
|
|
2093
|
+
placeholder: "选择数组类型数据源",
|
|
2094
|
+
value: x,
|
|
2095
|
+
onChange: (C) => b("tableDataSourceId", C || ""),
|
|
2096
|
+
options: [
|
|
2097
|
+
{ label: "无(仅静态展示)", value: "" },
|
|
2098
|
+
...h.map((C) => ({ label: C.name, value: C.id }))
|
|
2099
|
+
]
|
|
2100
|
+
}
|
|
2101
|
+
),
|
|
2102
|
+
/* @__PURE__ */ e.jsx(se, {}),
|
|
2103
|
+
/* @__PURE__ */ e.jsxs(re, { style: { marginBottom: 8 }, children: [
|
|
2104
|
+
/* @__PURE__ */ e.jsx(B, { style: { fontSize: 12 }, children: "列配置" }),
|
|
2105
|
+
/* @__PURE__ */ e.jsx(H, { size: "small", type: "dashed", icon: /* @__PURE__ */ e.jsx(Ke, {}), onClick: L }),
|
|
2106
|
+
/* @__PURE__ */ e.jsx(H, { size: "small", type: "primary", onClick: N, icon: /* @__PURE__ */ e.jsx(It, {}) })
|
|
2107
|
+
] }),
|
|
2108
|
+
/* @__PURE__ */ e.jsx(
|
|
2109
|
+
pn,
|
|
2110
|
+
{
|
|
2111
|
+
dataSource: M,
|
|
2112
|
+
columns: le,
|
|
2113
|
+
pagination: !1,
|
|
2114
|
+
size: "small",
|
|
2115
|
+
bordered: !0,
|
|
2116
|
+
rowKey: "key"
|
|
2117
|
+
}
|
|
2118
|
+
)
|
|
2119
|
+
] });
|
|
2120
|
+
}, P = () => {
|
|
2121
|
+
switch (i.type) {
|
|
2122
|
+
case "text":
|
|
2123
|
+
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
2124
|
+
/* @__PURE__ */ e.jsx(
|
|
2125
|
+
I,
|
|
2126
|
+
{
|
|
2127
|
+
field: "content",
|
|
2128
|
+
label: "内容",
|
|
2129
|
+
placeholder: "请输入文本内容",
|
|
2130
|
+
isTextarea: !0
|
|
2131
|
+
}
|
|
2132
|
+
),
|
|
2133
|
+
/* @__PURE__ */ e.jsx(se, { style: { margin: "4px 0" } }),
|
|
2134
|
+
/* @__PURE__ */ e.jsx(B, { type: "secondary", style: { fontSize: 12, display: "block", marginBottom: 4 }, children: "文字样式" }),
|
|
2135
|
+
/* @__PURE__ */ e.jsxs(re, { style: { width: "100%" }, direction: "vertical", size: 4, children: [
|
|
2136
|
+
/* @__PURE__ */ e.jsxs("div", { style: { display: "flex", gap: 8 }, children: [
|
|
2137
|
+
/* @__PURE__ */ e.jsxs("div", { style: { flex: 1 }, children: [
|
|
2138
|
+
/* @__PURE__ */ e.jsx(B, { style: { fontSize: 12 }, children: "字号" }),
|
|
2139
|
+
/* @__PURE__ */ e.jsx(
|
|
2140
|
+
Q,
|
|
2141
|
+
{
|
|
2142
|
+
size: "small",
|
|
2143
|
+
style: { width: "100%" },
|
|
2144
|
+
value: i.props.fontSize || 14,
|
|
2145
|
+
min: 6,
|
|
2146
|
+
max: 200,
|
|
2147
|
+
onChange: (n) => b("fontSize", n ?? 14)
|
|
2148
|
+
}
|
|
2149
|
+
)
|
|
2150
|
+
] }),
|
|
2151
|
+
/* @__PURE__ */ e.jsxs("div", { style: { flex: 1 }, children: [
|
|
2152
|
+
/* @__PURE__ */ e.jsx(B, { style: { fontSize: 12 }, children: "对齐" }),
|
|
2153
|
+
/* @__PURE__ */ e.jsx(
|
|
2154
|
+
Z,
|
|
2155
|
+
{
|
|
2156
|
+
size: "small",
|
|
2157
|
+
style: { width: "100%" },
|
|
2158
|
+
value: i.props.textAlign || "left",
|
|
2159
|
+
onChange: (n) => b("textAlign", n),
|
|
2160
|
+
options: [
|
|
2161
|
+
{ value: "left", label: "左" },
|
|
2162
|
+
{ value: "center", label: "中" },
|
|
2163
|
+
{ value: "right", label: "右" }
|
|
2164
|
+
]
|
|
2165
|
+
}
|
|
2166
|
+
)
|
|
2167
|
+
] })
|
|
2168
|
+
] }),
|
|
2169
|
+
/* @__PURE__ */ e.jsxs("div", { style: { display: "flex", gap: 8 }, children: [
|
|
2170
|
+
/* @__PURE__ */ e.jsxs("div", { style: { flex: 1 }, children: [
|
|
2171
|
+
/* @__PURE__ */ e.jsx(B, { style: { fontSize: 12 }, children: "字重" }),
|
|
2172
|
+
/* @__PURE__ */ e.jsx(
|
|
2173
|
+
Z,
|
|
2174
|
+
{
|
|
2175
|
+
size: "small",
|
|
2176
|
+
style: { width: "100%" },
|
|
2177
|
+
value: i.props.fontWeight || "normal",
|
|
2178
|
+
onChange: (n) => b("fontWeight", n),
|
|
2179
|
+
options: [
|
|
2180
|
+
{ value: "normal", label: "常规" },
|
|
2181
|
+
{ value: "bold", label: "加粗" }
|
|
2182
|
+
]
|
|
2183
|
+
}
|
|
2184
|
+
)
|
|
2185
|
+
] }),
|
|
2186
|
+
/* @__PURE__ */ e.jsxs("div", { style: { flex: 1 }, children: [
|
|
2187
|
+
/* @__PURE__ */ e.jsx(B, { style: { fontSize: 12 }, children: "样式" }),
|
|
2188
|
+
/* @__PURE__ */ e.jsx(
|
|
2189
|
+
Z,
|
|
2190
|
+
{
|
|
2191
|
+
size: "small",
|
|
2192
|
+
style: { width: "100%" },
|
|
2193
|
+
value: i.props.fontStyle || "normal",
|
|
2194
|
+
onChange: (n) => b("fontStyle", n),
|
|
2195
|
+
options: [
|
|
2196
|
+
{ value: "normal", label: "常规" },
|
|
2197
|
+
{ value: "italic", label: "斜体" }
|
|
2198
|
+
]
|
|
2199
|
+
}
|
|
2200
|
+
)
|
|
2201
|
+
] })
|
|
2202
|
+
] }),
|
|
2203
|
+
/* @__PURE__ */ e.jsxs("div", { style: { display: "flex", gap: 8 }, children: [
|
|
2204
|
+
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
2205
|
+
/* @__PURE__ */ e.jsx(B, { style: { fontSize: 12 }, children: "字体颜色" }),
|
|
2206
|
+
/* @__PURE__ */ e.jsx(
|
|
2207
|
+
Ve,
|
|
2208
|
+
{
|
|
2209
|
+
size: "small",
|
|
2210
|
+
value: i.props.color || "#000000",
|
|
2211
|
+
onChange: (n, h) => b("color", h)
|
|
2212
|
+
}
|
|
2213
|
+
)
|
|
2214
|
+
] }),
|
|
2215
|
+
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
2216
|
+
/* @__PURE__ */ e.jsx(B, { style: { fontSize: 12 }, children: "背景色" }),
|
|
2217
|
+
/* @__PURE__ */ e.jsx(
|
|
2218
|
+
Ve,
|
|
2219
|
+
{
|
|
2220
|
+
size: "small",
|
|
2221
|
+
value: i.props.backgroundColor || "transparent",
|
|
2222
|
+
onChange: (n, h) => b("backgroundColor", h)
|
|
2223
|
+
}
|
|
2224
|
+
)
|
|
2225
|
+
] })
|
|
2226
|
+
] })
|
|
2227
|
+
] })
|
|
2228
|
+
] });
|
|
2229
|
+
case "image":
|
|
2230
|
+
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
2231
|
+
/* @__PURE__ */ e.jsx(I, { field: "src", label: "图片地址", placeholder: "输入图片 URL" }),
|
|
2232
|
+
/* @__PURE__ */ e.jsx(se, { style: { margin: "4px 0" } }),
|
|
2233
|
+
/* @__PURE__ */ e.jsx(B, { style: { fontSize: 12, marginTop: 8, display: "block" }, children: "适应方式" }),
|
|
2234
|
+
/* @__PURE__ */ e.jsx(
|
|
2235
|
+
Z,
|
|
2236
|
+
{
|
|
2237
|
+
size: "small",
|
|
2238
|
+
style: { width: "100%" },
|
|
2239
|
+
value: i.props.fit || "contain",
|
|
2240
|
+
onChange: (n) => b("fit", n),
|
|
2241
|
+
options: [
|
|
2242
|
+
{ value: "contain", label: "适应" },
|
|
2243
|
+
{ value: "cover", label: "填充" },
|
|
2244
|
+
{ value: "fill", label: "拉伸" }
|
|
2245
|
+
]
|
|
2246
|
+
}
|
|
2247
|
+
)
|
|
2248
|
+
] });
|
|
2249
|
+
case "table":
|
|
2250
|
+
return /* @__PURE__ */ e.jsx(m, {});
|
|
2251
|
+
case "barcode":
|
|
2252
|
+
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
2253
|
+
/* @__PURE__ */ e.jsx(I, { field: "value", label: "条码值", placeholder: "输入条码内容" }),
|
|
2254
|
+
/* @__PURE__ */ e.jsx(se, { style: { margin: "4px 0" } }),
|
|
2255
|
+
/* @__PURE__ */ e.jsx(B, { style: { fontSize: 12, marginTop: 8, display: "block" }, children: "格式" }),
|
|
2256
|
+
/* @__PURE__ */ e.jsx(
|
|
2257
|
+
Z,
|
|
2258
|
+
{
|
|
2259
|
+
size: "small",
|
|
2260
|
+
style: { width: "100%" },
|
|
2261
|
+
value: i.props.format || "CODE128",
|
|
2262
|
+
onChange: (n) => b("format", n),
|
|
2263
|
+
options: [{ value: "CODE128", label: "CODE128" }]
|
|
2264
|
+
}
|
|
2265
|
+
)
|
|
2266
|
+
] });
|
|
2267
|
+
case "line":
|
|
2268
|
+
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
2269
|
+
/* @__PURE__ */ e.jsxs("div", { style: { display: "flex", gap: 8 }, children: [
|
|
2270
|
+
/* @__PURE__ */ e.jsxs("div", { style: { flex: 1 }, children: [
|
|
2271
|
+
/* @__PURE__ */ e.jsx(B, { style: { fontSize: 12 }, children: "粗细" }),
|
|
2272
|
+
/* @__PURE__ */ e.jsx(
|
|
2273
|
+
Q,
|
|
2274
|
+
{
|
|
2275
|
+
size: "small",
|
|
2276
|
+
style: { width: "100%" },
|
|
2277
|
+
value: i.props.thickness || 1,
|
|
2278
|
+
min: 1,
|
|
2279
|
+
max: 20,
|
|
2280
|
+
onChange: (n) => b("thickness", n ?? 1)
|
|
2281
|
+
}
|
|
2282
|
+
)
|
|
2283
|
+
] }),
|
|
2284
|
+
/* @__PURE__ */ e.jsxs("div", { style: { flex: 1 }, children: [
|
|
2285
|
+
/* @__PURE__ */ e.jsx(B, { style: { fontSize: 12 }, children: "样式" }),
|
|
2286
|
+
/* @__PURE__ */ e.jsx(
|
|
2287
|
+
Z,
|
|
2288
|
+
{
|
|
2289
|
+
size: "small",
|
|
2290
|
+
style: { width: "100%" },
|
|
2291
|
+
value: i.props.style || "solid",
|
|
2292
|
+
onChange: (n) => b("style", n),
|
|
2293
|
+
options: [
|
|
2294
|
+
{ value: "solid", label: "实线" },
|
|
2295
|
+
{ value: "dashed", label: "虚线" },
|
|
2296
|
+
{ value: "dotted", label: "点线" }
|
|
2297
|
+
]
|
|
2298
|
+
}
|
|
2299
|
+
)
|
|
2300
|
+
] })
|
|
2301
|
+
] }),
|
|
2302
|
+
/* @__PURE__ */ e.jsxs("div", { style: { marginTop: 8 }, children: [
|
|
2303
|
+
/* @__PURE__ */ e.jsx(B, { style: { fontSize: 12 }, children: "颜色" }),
|
|
2304
|
+
/* @__PURE__ */ e.jsx(
|
|
2305
|
+
Ve,
|
|
2306
|
+
{
|
|
2307
|
+
size: "small",
|
|
2308
|
+
value: i.props.color || "#000000",
|
|
2309
|
+
onChange: (n, h) => b("color", h)
|
|
2310
|
+
}
|
|
2311
|
+
)
|
|
2312
|
+
] })
|
|
2313
|
+
] });
|
|
2314
|
+
default:
|
|
2315
|
+
return null;
|
|
2316
|
+
}
|
|
2317
|
+
};
|
|
2318
|
+
return /* @__PURE__ */ e.jsx(
|
|
2319
|
+
me,
|
|
2320
|
+
{
|
|
2321
|
+
title: `属性 - ${p}`,
|
|
2322
|
+
size: "small",
|
|
2323
|
+
style: { height: "100%", borderRadius: 0, borderLeft: 0 },
|
|
2324
|
+
styles: { body: { padding: 16, overflowY: "auto" } },
|
|
2325
|
+
children: /* @__PURE__ */ e.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
|
|
2326
|
+
_,
|
|
2327
|
+
/* @__PURE__ */ e.jsx(se, { style: { margin: "4px 0" } }),
|
|
2328
|
+
P()
|
|
2329
|
+
] })
|
|
2330
|
+
}
|
|
2331
|
+
);
|
|
2332
|
+
}, { Text: nr } = fe, Yn = () => {
|
|
2333
|
+
const o = w((m) => m.previewVisible), d = w((m) => m.setPreviewVisible), a = w((m) => m.components), r = w((m) => m.pageSettings), s = w((m) => m.gridSettings) || Re, i = w((m) => m.dataSources), y = He(null), g = ee(() => {
|
|
2334
|
+
const m = Ee[r.paperSize];
|
|
2335
|
+
if (!m)
|
|
2336
|
+
return {
|
|
2337
|
+
width: r.customWidth * A,
|
|
2338
|
+
height: r.customHeight * A
|
|
2339
|
+
};
|
|
2340
|
+
const P = m.width * A, n = m.height * A;
|
|
2341
|
+
return r.orientation === "landscape" ? { width: n, height: P } : { width: P, height: n };
|
|
2342
|
+
}, [r]), c = ee(
|
|
2343
|
+
() => ({
|
|
2344
|
+
top: r.marginTop * A,
|
|
2345
|
+
right: r.marginRight * A,
|
|
2346
|
+
bottom: r.marginBottom * A,
|
|
2347
|
+
left: r.marginLeft * A
|
|
2348
|
+
}),
|
|
2349
|
+
[r]
|
|
2350
|
+
), b = g.width - c.left - c.right, v = b / s.cols, T = At({
|
|
2351
|
+
contentRef: y,
|
|
2352
|
+
documentTitle: "打印模板",
|
|
2353
|
+
pageStyle: `
|
|
2354
|
+
@page {
|
|
2355
|
+
size: ${g.width / A}mm ${g.height / A}mm;
|
|
2356
|
+
margin: ${r.marginTop}mm ${r.marginRight}mm ${r.marginBottom}mm ${r.marginLeft}mm;
|
|
2357
|
+
}
|
|
2358
|
+
@media print {
|
|
2359
|
+
html, body { margin: 0; padding: 0; }
|
|
2360
|
+
}
|
|
2361
|
+
`
|
|
2362
|
+
}), p = (m, P) => {
|
|
2363
|
+
const n = m.props[`${P}Binding`];
|
|
2364
|
+
if (n && n.dataSourceId && n.fieldPath) {
|
|
2365
|
+
const h = i.find((x) => x.id === n.dataSourceId);
|
|
2366
|
+
if (h && h.type === "object") {
|
|
2367
|
+
const x = Xe(h);
|
|
2368
|
+
if (x) {
|
|
2369
|
+
const E = Ye(x, n.fieldPath);
|
|
2370
|
+
if (E !== "")
|
|
2371
|
+
return E;
|
|
2372
|
+
}
|
|
2373
|
+
}
|
|
2374
|
+
}
|
|
2375
|
+
return (n == null ? void 0 : n.staticValue) ?? String(m.props[P] || "");
|
|
2376
|
+
}, _ = (m) => {
|
|
2377
|
+
const P = m.props.tableDataSourceId, n = P ? i.find((D) => D.id === P) : null, h = n ? Ze(n) : null, x = m.tableColumns || [], E = m.props.borderWidth || 1, u = m.props.borderColor || "#000000", j = h || Array.from({ length: m.props.rows || 3 }).map(() => ({}));
|
|
2378
|
+
return /* @__PURE__ */ e.jsxs(
|
|
2379
|
+
"table",
|
|
2380
|
+
{
|
|
2381
|
+
style: {
|
|
2382
|
+
width: "100%",
|
|
2383
|
+
height: "100%",
|
|
2384
|
+
borderCollapse: "collapse"
|
|
2385
|
+
},
|
|
2386
|
+
children: [
|
|
2387
|
+
/* @__PURE__ */ e.jsx("thead", { children: /* @__PURE__ */ e.jsx("tr", { children: x.map((D, N) => /* @__PURE__ */ e.jsx(
|
|
2388
|
+
"th",
|
|
2389
|
+
{
|
|
2390
|
+
style: {
|
|
2391
|
+
border: `${E}px solid ${u}`,
|
|
2392
|
+
padding: 4,
|
|
2393
|
+
textAlign: "center",
|
|
2394
|
+
fontSize: 12,
|
|
2395
|
+
fontWeight: "bold",
|
|
2396
|
+
backgroundColor: "#f5f5f5"
|
|
2397
|
+
},
|
|
2398
|
+
children: D.title || `列${N + 1}`
|
|
2399
|
+
},
|
|
2400
|
+
N
|
|
2401
|
+
)) }) }),
|
|
2402
|
+
/* @__PURE__ */ e.jsx("tbody", { children: j.map((D, N) => /* @__PURE__ */ e.jsx("tr", { children: x.map((L, J) => /* @__PURE__ */ e.jsx(
|
|
2403
|
+
"td",
|
|
2404
|
+
{
|
|
2405
|
+
style: {
|
|
2406
|
+
border: `${E}px solid ${u}`,
|
|
2407
|
+
padding: 4,
|
|
2408
|
+
textAlign: "center",
|
|
2409
|
+
fontSize: 12
|
|
2410
|
+
},
|
|
2411
|
+
children: L.fieldPath ? Ye(D, L.fieldPath) : ""
|
|
2412
|
+
},
|
|
2413
|
+
J
|
|
2414
|
+
)) }, N)) })
|
|
2415
|
+
]
|
|
2416
|
+
}
|
|
2417
|
+
);
|
|
2418
|
+
}, I = (m) => {
|
|
2419
|
+
const P = m.props, n = {
|
|
2420
|
+
position: "absolute",
|
|
2421
|
+
left: m.x * v,
|
|
2422
|
+
top: m.y * v,
|
|
2423
|
+
width: m.w * v,
|
|
2424
|
+
height: m.h * v,
|
|
2425
|
+
overflow: "hidden"
|
|
2426
|
+
}, h = {
|
|
2427
|
+
width: "100%",
|
|
2428
|
+
height: "100%",
|
|
2429
|
+
overflow: "hidden",
|
|
2430
|
+
boxSizing: "border-box"
|
|
2431
|
+
};
|
|
2432
|
+
switch (m.type) {
|
|
2433
|
+
case "text":
|
|
2434
|
+
return /* @__PURE__ */ e.jsx("div", { style: n, children: /* @__PURE__ */ e.jsx(
|
|
2435
|
+
"div",
|
|
2436
|
+
{
|
|
2437
|
+
style: {
|
|
2438
|
+
...h,
|
|
2439
|
+
fontSize: P.fontSize || 14,
|
|
2440
|
+
fontWeight: P.fontWeight || "normal",
|
|
2441
|
+
fontStyle: P.fontStyle || "normal",
|
|
2442
|
+
textAlign: P.textAlign || "left",
|
|
2443
|
+
color: P.color || "#000",
|
|
2444
|
+
backgroundColor: P.backgroundColor || "transparent",
|
|
2445
|
+
padding: 4,
|
|
2446
|
+
whiteSpace: "pre-wrap",
|
|
2447
|
+
wordBreak: "break-word"
|
|
2448
|
+
},
|
|
2449
|
+
children: p(m, "content")
|
|
2450
|
+
}
|
|
2451
|
+
) }, m.id);
|
|
2452
|
+
case "image":
|
|
2453
|
+
return /* @__PURE__ */ e.jsx("div", { style: n, children: /* @__PURE__ */ e.jsx("div", { style: h, children: P.src ? /* @__PURE__ */ e.jsx(
|
|
2454
|
+
"img",
|
|
2455
|
+
{
|
|
2456
|
+
src: p(m, "src"),
|
|
2457
|
+
style: {
|
|
2458
|
+
width: "100%",
|
|
2459
|
+
height: "100%",
|
|
2460
|
+
objectFit: P.fit || "contain"
|
|
2461
|
+
},
|
|
2462
|
+
alt: ""
|
|
2463
|
+
}
|
|
2464
|
+
) : null }) }, m.id);
|
|
2465
|
+
case "table":
|
|
2466
|
+
return /* @__PURE__ */ e.jsx("div", { style: n, children: _(m) }, m.id);
|
|
2467
|
+
case "barcode":
|
|
2468
|
+
return /* @__PURE__ */ e.jsx("div", { style: n, children: /* @__PURE__ */ e.jsx(
|
|
2469
|
+
"div",
|
|
2470
|
+
{
|
|
2471
|
+
style: {
|
|
2472
|
+
...h,
|
|
2473
|
+
display: "flex",
|
|
2474
|
+
alignItems: "center",
|
|
2475
|
+
justifyContent: "center",
|
|
2476
|
+
padding: 4
|
|
2477
|
+
},
|
|
2478
|
+
children: /* @__PURE__ */ e.jsx(
|
|
2479
|
+
Qe,
|
|
2480
|
+
{
|
|
2481
|
+
value: p(m, "value"),
|
|
2482
|
+
format: P.format || "CODE128"
|
|
2483
|
+
}
|
|
2484
|
+
)
|
|
2485
|
+
}
|
|
2486
|
+
) }, m.id);
|
|
2487
|
+
case "line":
|
|
2488
|
+
return /* @__PURE__ */ e.jsx("div", { style: n, children: /* @__PURE__ */ e.jsx(
|
|
2489
|
+
"div",
|
|
2490
|
+
{
|
|
2491
|
+
style: {
|
|
2492
|
+
...h,
|
|
2493
|
+
display: "flex",
|
|
2494
|
+
alignItems: "center",
|
|
2495
|
+
border: "none"
|
|
2496
|
+
},
|
|
2497
|
+
children: /* @__PURE__ */ e.jsx(
|
|
2498
|
+
"hr",
|
|
2499
|
+
{
|
|
2500
|
+
style: {
|
|
2501
|
+
width: "100%",
|
|
2502
|
+
border: "none",
|
|
2503
|
+
borderTop: `${P.thickness || 1}px ${P.style || "solid"} ${P.color || "#000"}`,
|
|
2504
|
+
margin: 0
|
|
2505
|
+
}
|
|
2506
|
+
}
|
|
2507
|
+
)
|
|
2508
|
+
}
|
|
2509
|
+
) }, m.id);
|
|
2510
|
+
default:
|
|
2511
|
+
return null;
|
|
2512
|
+
}
|
|
2513
|
+
};
|
|
2514
|
+
return /* @__PURE__ */ e.jsxs(
|
|
2515
|
+
Ue,
|
|
2516
|
+
{
|
|
2517
|
+
title: "打印预览",
|
|
2518
|
+
open: o,
|
|
2519
|
+
onCancel: () => d(!1),
|
|
2520
|
+
width: g.width + 80,
|
|
2521
|
+
footer: /* @__PURE__ */ e.jsxs(re, { children: [
|
|
2522
|
+
/* @__PURE__ */ e.jsx(H, { onClick: () => d(!1), children: "关闭" }),
|
|
2523
|
+
/* @__PURE__ */ e.jsx(H, { type: "primary", icon: /* @__PURE__ */ e.jsx(qe, {}), onClick: () => T(), children: "打印" })
|
|
2524
|
+
] }),
|
|
2525
|
+
styles: { body: { padding: 16, display: "flex", flexDirection: "column", alignItems: "center" } },
|
|
2526
|
+
children: [
|
|
2527
|
+
/* @__PURE__ */ e.jsx(se, { style: { margin: "4px 0 12px 0" } }),
|
|
2528
|
+
/* @__PURE__ */ e.jsxs(
|
|
2529
|
+
"div",
|
|
2530
|
+
{
|
|
2531
|
+
ref: y,
|
|
2532
|
+
style: {
|
|
2533
|
+
width: g.width,
|
|
2534
|
+
height: g.height,
|
|
2535
|
+
background: "#fff",
|
|
2536
|
+
border: "1px solid #d9d9d9",
|
|
2537
|
+
position: "relative",
|
|
2538
|
+
overflow: "hidden",
|
|
2539
|
+
flexShrink: 0
|
|
2540
|
+
},
|
|
2541
|
+
children: [
|
|
2542
|
+
r.showHeader && /* @__PURE__ */ e.jsx(
|
|
2543
|
+
"div",
|
|
2544
|
+
{
|
|
2545
|
+
style: {
|
|
2546
|
+
position: "absolute",
|
|
2547
|
+
top: 0,
|
|
2548
|
+
left: c.left,
|
|
2549
|
+
right: c.right,
|
|
2550
|
+
height: c.top,
|
|
2551
|
+
display: "flex",
|
|
2552
|
+
alignItems: "center",
|
|
2553
|
+
justifyContent: "center",
|
|
2554
|
+
fontSize: 12,
|
|
2555
|
+
overflow: "hidden"
|
|
2556
|
+
},
|
|
2557
|
+
children: r.headerContent
|
|
2558
|
+
}
|
|
2559
|
+
),
|
|
2560
|
+
r.showFooter && /* @__PURE__ */ e.jsxs(
|
|
2561
|
+
"div",
|
|
2562
|
+
{
|
|
2563
|
+
style: {
|
|
2564
|
+
position: "absolute",
|
|
2565
|
+
bottom: 0,
|
|
2566
|
+
left: c.left,
|
|
2567
|
+
right: c.right,
|
|
2568
|
+
height: c.bottom,
|
|
2569
|
+
display: "flex",
|
|
2570
|
+
alignItems: "center",
|
|
2571
|
+
justifyContent: r.showPageNumber ? "space-between" : "center",
|
|
2572
|
+
fontSize: 12,
|
|
2573
|
+
overflow: "hidden",
|
|
2574
|
+
padding: "0 8px"
|
|
2575
|
+
},
|
|
2576
|
+
children: [
|
|
2577
|
+
/* @__PURE__ */ e.jsx("span", { children: r.footerContent }),
|
|
2578
|
+
r.showPageNumber && /* @__PURE__ */ e.jsx("span", { children: r.pageNumberFormat.replace("{page}", "1") })
|
|
2579
|
+
]
|
|
2580
|
+
}
|
|
2581
|
+
),
|
|
2582
|
+
/* @__PURE__ */ e.jsx(
|
|
2583
|
+
"div",
|
|
2584
|
+
{
|
|
2585
|
+
style: {
|
|
2586
|
+
position: "absolute",
|
|
2587
|
+
top: c.top,
|
|
2588
|
+
left: c.left,
|
|
2589
|
+
width: b,
|
|
2590
|
+
height: g.height - c.top - c.bottom
|
|
2591
|
+
},
|
|
2592
|
+
children: a.map(I)
|
|
2593
|
+
}
|
|
2594
|
+
)
|
|
2595
|
+
]
|
|
2596
|
+
}
|
|
2597
|
+
)
|
|
2598
|
+
]
|
|
2599
|
+
}
|
|
2600
|
+
);
|
|
2601
|
+
}, Hn = () => {
|
|
2602
|
+
const o = w((s) => s.headerFooterVisible), d = w((s) => s.pageSettings), a = w((s) => s.setPageSettings), r = w((s) => s.setHeaderFooterVisible);
|
|
2603
|
+
return /* @__PURE__ */ e.jsx(
|
|
2604
|
+
Ue,
|
|
2605
|
+
{
|
|
2606
|
+
title: "页眉页脚设置",
|
|
2607
|
+
open: o,
|
|
2608
|
+
onCancel: () => r(!1),
|
|
2609
|
+
onOk: () => r(!1),
|
|
2610
|
+
width: 480,
|
|
2611
|
+
children: /* @__PURE__ */ e.jsxs(oe, { layout: "vertical", style: { marginTop: 8 }, children: [
|
|
2612
|
+
/* @__PURE__ */ e.jsx(oe.Item, { label: "显示页眉", children: /* @__PURE__ */ e.jsx(
|
|
2613
|
+
We,
|
|
2614
|
+
{
|
|
2615
|
+
checked: d.showHeader,
|
|
2616
|
+
onChange: (s) => a({ showHeader: s })
|
|
2617
|
+
}
|
|
2618
|
+
) }),
|
|
2619
|
+
d.showHeader && /* @__PURE__ */ e.jsx(oe.Item, { label: "页眉内容", children: /* @__PURE__ */ e.jsx(
|
|
2620
|
+
ne,
|
|
2621
|
+
{
|
|
2622
|
+
value: d.headerContent,
|
|
2623
|
+
onChange: (s) => a({ headerContent: s.target.value })
|
|
2624
|
+
}
|
|
2625
|
+
) }),
|
|
2626
|
+
/* @__PURE__ */ e.jsx(oe.Item, { label: "显示页脚", children: /* @__PURE__ */ e.jsx(
|
|
2627
|
+
We,
|
|
2628
|
+
{
|
|
2629
|
+
checked: d.showFooter,
|
|
2630
|
+
onChange: (s) => a({ showFooter: s })
|
|
2631
|
+
}
|
|
2632
|
+
) }),
|
|
2633
|
+
d.showFooter && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
2634
|
+
/* @__PURE__ */ e.jsx(oe.Item, { label: "页脚内容", children: /* @__PURE__ */ e.jsx(
|
|
2635
|
+
ne,
|
|
2636
|
+
{
|
|
2637
|
+
value: d.footerContent,
|
|
2638
|
+
onChange: (s) => a({ footerContent: s.target.value })
|
|
2639
|
+
}
|
|
2640
|
+
) }),
|
|
2641
|
+
/* @__PURE__ */ e.jsx(oe.Item, { label: "显示页码", children: /* @__PURE__ */ e.jsx(
|
|
2642
|
+
We,
|
|
2643
|
+
{
|
|
2644
|
+
checked: d.showPageNumber,
|
|
2645
|
+
onChange: (s) => a({ showPageNumber: s })
|
|
2646
|
+
}
|
|
2647
|
+
) }),
|
|
2648
|
+
d.showPageNumber && /* @__PURE__ */ e.jsx(oe.Item, { label: "页码格式", children: /* @__PURE__ */ e.jsx(
|
|
2649
|
+
ne,
|
|
2650
|
+
{
|
|
2651
|
+
value: d.pageNumberFormat,
|
|
2652
|
+
onChange: (s) => a({ pageNumberFormat: s.target.value }),
|
|
2653
|
+
placeholder: "第 {page} 页"
|
|
2654
|
+
}
|
|
2655
|
+
) })
|
|
2656
|
+
] })
|
|
2657
|
+
] })
|
|
2658
|
+
}
|
|
2659
|
+
);
|
|
2660
|
+
}, rr = ({
|
|
2661
|
+
isPreview: o = !1,
|
|
2662
|
+
initialTemplateData: d,
|
|
2663
|
+
onSave: a,
|
|
2664
|
+
onPrint: r
|
|
2665
|
+
}) => {
|
|
2666
|
+
const { importJSON: s, exportJSON: i, reset: y, components: g, pageSettings: c, gridSettings: b, dataSources: v } = w(), T = He(null);
|
|
2667
|
+
un(() => {
|
|
2668
|
+
if (d) {
|
|
2669
|
+
const u = JSON.stringify(d), j = s(u);
|
|
2670
|
+
j && (console.error("导入失败:", j), y());
|
|
2671
|
+
}
|
|
2672
|
+
}, [d, s, y]);
|
|
2673
|
+
const p = () => {
|
|
2674
|
+
if (a)
|
|
2675
|
+
try {
|
|
2676
|
+
const u = i();
|
|
2677
|
+
a(JSON.parse(u));
|
|
2678
|
+
} catch (u) {
|
|
2679
|
+
console.error("导出失败:", u);
|
|
2680
|
+
}
|
|
2681
|
+
}, _ = ee(() => {
|
|
2682
|
+
const u = Ee[c.paperSize];
|
|
2683
|
+
if (!u)
|
|
2684
|
+
return {
|
|
2685
|
+
width: c.customWidth * A,
|
|
2686
|
+
height: c.customHeight * A
|
|
2687
|
+
};
|
|
2688
|
+
const j = u.width * A, D = u.height * A;
|
|
2689
|
+
return c.orientation === "landscape" ? { width: D, height: j } : { width: j, height: D };
|
|
2690
|
+
}, [c]), I = ee(
|
|
2691
|
+
() => ({
|
|
2692
|
+
top: c.marginTop * A,
|
|
2693
|
+
right: c.marginRight * A,
|
|
2694
|
+
bottom: c.marginBottom * A,
|
|
2695
|
+
left: c.marginLeft * A
|
|
2696
|
+
}),
|
|
2697
|
+
[c]
|
|
2698
|
+
), m = _.width - I.left - I.right, P = m / ((b == null ? void 0 : b.cols) || Re.cols), n = At({
|
|
2699
|
+
contentRef: T,
|
|
2700
|
+
documentTitle: "打印模板",
|
|
2701
|
+
pageStyle: `
|
|
2702
|
+
@page {
|
|
2703
|
+
size: ${_.width / A}mm ${_.height / A}mm;
|
|
2704
|
+
margin: ${c.marginTop}mm ${c.marginRight}mm ${c.marginBottom}mm ${c.marginLeft}mm;
|
|
2705
|
+
}
|
|
2706
|
+
@media print {
|
|
2707
|
+
html, body { margin: 0; padding: 0; }
|
|
2708
|
+
}
|
|
2709
|
+
`
|
|
2710
|
+
}), h = () => {
|
|
2711
|
+
r ? r() : n();
|
|
2712
|
+
}, x = (u) => {
|
|
2713
|
+
const j = u.props, D = {
|
|
2714
|
+
position: "absolute",
|
|
2715
|
+
left: u.x * P,
|
|
2716
|
+
top: u.y * P,
|
|
2717
|
+
width: u.w * P,
|
|
2718
|
+
height: u.h * P,
|
|
2719
|
+
overflow: "hidden"
|
|
2720
|
+
}, N = {
|
|
2721
|
+
width: "100%",
|
|
2722
|
+
height: "100%",
|
|
2723
|
+
overflow: "hidden",
|
|
2724
|
+
boxSizing: "border-box"
|
|
2725
|
+
};
|
|
2726
|
+
switch (u.type) {
|
|
2727
|
+
case "text":
|
|
2728
|
+
return /* @__PURE__ */ e.jsx("div", { style: D, children: /* @__PURE__ */ e.jsx(
|
|
2729
|
+
"div",
|
|
2730
|
+
{
|
|
2731
|
+
style: {
|
|
2732
|
+
...N,
|
|
2733
|
+
fontSize: j.fontSize || 14,
|
|
2734
|
+
fontWeight: j.fontWeight || "normal",
|
|
2735
|
+
fontStyle: j.fontStyle || "normal",
|
|
2736
|
+
textAlign: j.textAlign || "left",
|
|
2737
|
+
color: j.color || "#000",
|
|
2738
|
+
backgroundColor: j.backgroundColor || "transparent",
|
|
2739
|
+
padding: 4,
|
|
2740
|
+
whiteSpace: "pre-wrap",
|
|
2741
|
+
wordBreak: "break-word"
|
|
2742
|
+
},
|
|
2743
|
+
children: Te(u, "content", v)
|
|
2744
|
+
}
|
|
2745
|
+
) }, u.id);
|
|
2746
|
+
case "image":
|
|
2747
|
+
return /* @__PURE__ */ e.jsx("div", { style: D, children: /* @__PURE__ */ e.jsx("div", { style: N, children: j.src ? /* @__PURE__ */ e.jsx(
|
|
2748
|
+
"img",
|
|
2749
|
+
{
|
|
2750
|
+
src: Te(u, "src", v),
|
|
2751
|
+
style: {
|
|
2752
|
+
width: "100%",
|
|
2753
|
+
height: "100%",
|
|
2754
|
+
objectFit: j.fit || "contain"
|
|
2755
|
+
},
|
|
2756
|
+
alt: ""
|
|
2757
|
+
}
|
|
2758
|
+
) : null }) }, u.id);
|
|
2759
|
+
case "table":
|
|
2760
|
+
return /* @__PURE__ */ e.jsx("div", { style: D, children: E(u) }, u.id);
|
|
2761
|
+
case "barcode":
|
|
2762
|
+
return /* @__PURE__ */ e.jsx("div", { style: D, children: /* @__PURE__ */ e.jsx(
|
|
2763
|
+
"div",
|
|
2764
|
+
{
|
|
2765
|
+
style: {
|
|
2766
|
+
...N,
|
|
2767
|
+
display: "flex",
|
|
2768
|
+
alignItems: "center",
|
|
2769
|
+
justifyContent: "center",
|
|
2770
|
+
padding: 4
|
|
2771
|
+
},
|
|
2772
|
+
children: /* @__PURE__ */ e.jsx(
|
|
2773
|
+
Qe,
|
|
2774
|
+
{
|
|
2775
|
+
value: Te(u, "value", v),
|
|
2776
|
+
format: j.format || "CODE128"
|
|
2777
|
+
}
|
|
2778
|
+
)
|
|
2779
|
+
}
|
|
2780
|
+
) }, u.id);
|
|
2781
|
+
case "line":
|
|
2782
|
+
return /* @__PURE__ */ e.jsx("div", { style: D, children: /* @__PURE__ */ e.jsx(
|
|
2783
|
+
"div",
|
|
2784
|
+
{
|
|
2785
|
+
style: {
|
|
2786
|
+
...N,
|
|
2787
|
+
display: "flex",
|
|
2788
|
+
alignItems: "center",
|
|
2789
|
+
border: "none"
|
|
2790
|
+
},
|
|
2791
|
+
children: /* @__PURE__ */ e.jsx(
|
|
2792
|
+
"hr",
|
|
2793
|
+
{
|
|
2794
|
+
style: {
|
|
2795
|
+
width: "100%",
|
|
2796
|
+
border: "none",
|
|
2797
|
+
borderTop: `${j.thickness || 1}px ${j.style || "solid"} ${j.color || "#000"}`,
|
|
2798
|
+
margin: 0
|
|
2799
|
+
}
|
|
2800
|
+
}
|
|
2801
|
+
)
|
|
2802
|
+
}
|
|
2803
|
+
) }, u.id);
|
|
2804
|
+
default:
|
|
2805
|
+
return null;
|
|
2806
|
+
}
|
|
2807
|
+
}, E = (u) => {
|
|
2808
|
+
const j = u.props.tableDataSourceId, D = j ? v.find((M) => M.id === j) : null, N = D ? Ze(D) : null, L = u.tableColumns || [], J = u.props.borderWidth || 1, $ = u.props.borderColor || "#000000";
|
|
2809
|
+
if (N && N.length > 0)
|
|
2810
|
+
return /* @__PURE__ */ e.jsxs(
|
|
2811
|
+
"table",
|
|
2812
|
+
{
|
|
2813
|
+
style: {
|
|
2814
|
+
width: "100%",
|
|
2815
|
+
height: "100%",
|
|
2816
|
+
borderCollapse: "collapse"
|
|
2817
|
+
},
|
|
2818
|
+
children: [
|
|
2819
|
+
L.length > 0 && /* @__PURE__ */ e.jsx("thead", { children: /* @__PURE__ */ e.jsx("tr", { style: { backgroundColor: "#f5f5f5" }, children: L.map((M, C) => /* @__PURE__ */ e.jsx(
|
|
2820
|
+
"th",
|
|
2821
|
+
{
|
|
2822
|
+
style: {
|
|
2823
|
+
border: `${J}px solid ${$}`,
|
|
2824
|
+
padding: 4,
|
|
2825
|
+
fontSize: 12,
|
|
2826
|
+
fontWeight: "bold",
|
|
2827
|
+
textAlign: "center"
|
|
2828
|
+
},
|
|
2829
|
+
children: M.title
|
|
2830
|
+
},
|
|
2831
|
+
C
|
|
2832
|
+
)) }) }),
|
|
2833
|
+
/* @__PURE__ */ e.jsx("tbody", { children: N.map((M, C) => /* @__PURE__ */ e.jsx("tr", { children: L.map((z, Y) => /* @__PURE__ */ e.jsx(
|
|
2834
|
+
"td",
|
|
2835
|
+
{
|
|
2836
|
+
style: {
|
|
2837
|
+
border: `${J}px solid ${$}`,
|
|
2838
|
+
padding: 4,
|
|
2839
|
+
fontSize: 12,
|
|
2840
|
+
textAlign: "center"
|
|
2841
|
+
},
|
|
2842
|
+
children: z.fieldPath ? M[z.fieldPath] : ""
|
|
2843
|
+
},
|
|
2844
|
+
Y
|
|
2845
|
+
)) }, C)) })
|
|
2846
|
+
]
|
|
2847
|
+
}
|
|
2848
|
+
);
|
|
2849
|
+
const ae = u.props.rows || 3, le = Math.max(u.props.cols || 3, L.length || 3);
|
|
2850
|
+
return /* @__PURE__ */ e.jsx(
|
|
2851
|
+
"table",
|
|
2852
|
+
{
|
|
2853
|
+
style: {
|
|
2854
|
+
width: "100%",
|
|
2855
|
+
height: "100%",
|
|
2856
|
+
borderCollapse: "collapse"
|
|
2857
|
+
},
|
|
2858
|
+
children: /* @__PURE__ */ e.jsx("tbody", { children: Array.from({ length: ae }).map((M, C) => /* @__PURE__ */ e.jsx("tr", { children: Array.from({ length: le }).map((z, Y) => /* @__PURE__ */ e.jsx(
|
|
2859
|
+
"td",
|
|
2860
|
+
{
|
|
2861
|
+
style: {
|
|
2862
|
+
border: `${J}px solid ${$}`,
|
|
2863
|
+
padding: 2,
|
|
2864
|
+
fontSize: 12,
|
|
2865
|
+
textAlign: "center"
|
|
2866
|
+
},
|
|
2867
|
+
children: " "
|
|
2868
|
+
},
|
|
2869
|
+
Y
|
|
2870
|
+
)) }, C)) })
|
|
2871
|
+
}
|
|
2872
|
+
);
|
|
2873
|
+
};
|
|
2874
|
+
return o ? /* @__PURE__ */ e.jsx(Be, { children: /* @__PURE__ */ e.jsxs("div", { style: { width: "100%", height: "100%", display: "flex", flexDirection: "column" }, children: [
|
|
2875
|
+
/* @__PURE__ */ e.jsx("div", { style: { padding: "12px 16px", borderBottom: "1px solid #e8e8e8", background: "#fff" }, children: /* @__PURE__ */ e.jsx(re, { children: /* @__PURE__ */ e.jsx(H, { type: "primary", icon: /* @__PURE__ */ e.jsx(qe, {}), onClick: h, children: "打印" }) }) }),
|
|
2876
|
+
/* @__PURE__ */ e.jsx("div", { style: { flex: 1, display: "flex", justifyContent: "center", alignItems: "flex-start", padding: "16px", boxSizing: "border-box", overflowY: "auto", background: "#e8e8e8" }, children: /* @__PURE__ */ e.jsx("div", { style: { flexShrink: 0 }, children: /* @__PURE__ */ e.jsx(Ot, { isPreview: !0 }) }) }),
|
|
2877
|
+
/* @__PURE__ */ e.jsx("div", { style: { position: "absolute", left: "-9999px", top: "-9999px" }, children: /* @__PURE__ */ e.jsxs(
|
|
2878
|
+
"div",
|
|
2879
|
+
{
|
|
2880
|
+
ref: T,
|
|
2881
|
+
style: {
|
|
2882
|
+
width: _.width,
|
|
2883
|
+
height: _.height,
|
|
2884
|
+
background: "#fff",
|
|
2885
|
+
position: "relative",
|
|
2886
|
+
overflow: "hidden"
|
|
2887
|
+
},
|
|
2888
|
+
children: [
|
|
2889
|
+
c.showHeader && /* @__PURE__ */ e.jsx(
|
|
2890
|
+
"div",
|
|
2891
|
+
{
|
|
2892
|
+
style: {
|
|
2893
|
+
position: "absolute",
|
|
2894
|
+
top: 0,
|
|
2895
|
+
left: I.left,
|
|
2896
|
+
right: I.right,
|
|
2897
|
+
height: I.top,
|
|
2898
|
+
display: "flex",
|
|
2899
|
+
alignItems: "center",
|
|
2900
|
+
justifyContent: "center",
|
|
2901
|
+
fontSize: 12,
|
|
2902
|
+
overflow: "hidden"
|
|
2903
|
+
},
|
|
2904
|
+
children: c.headerContent
|
|
2905
|
+
}
|
|
2906
|
+
),
|
|
2907
|
+
c.showFooter && /* @__PURE__ */ e.jsxs(
|
|
2908
|
+
"div",
|
|
2909
|
+
{
|
|
2910
|
+
style: {
|
|
2911
|
+
position: "absolute",
|
|
2912
|
+
bottom: 0,
|
|
2913
|
+
left: I.left,
|
|
2914
|
+
right: I.right,
|
|
2915
|
+
height: I.bottom,
|
|
2916
|
+
display: "flex",
|
|
2917
|
+
alignItems: "center",
|
|
2918
|
+
justifyContent: c.showPageNumber ? "space-between" : "center",
|
|
2919
|
+
fontSize: 12,
|
|
2920
|
+
overflow: "hidden",
|
|
2921
|
+
padding: "0 8px"
|
|
2922
|
+
},
|
|
2923
|
+
children: [
|
|
2924
|
+
/* @__PURE__ */ e.jsx("span", { children: c.footerContent }),
|
|
2925
|
+
c.showPageNumber && /* @__PURE__ */ e.jsx("span", { children: c.pageNumberFormat.replace("{page}", "1") })
|
|
2926
|
+
]
|
|
2927
|
+
}
|
|
2928
|
+
),
|
|
2929
|
+
/* @__PURE__ */ e.jsx(
|
|
2930
|
+
"div",
|
|
2931
|
+
{
|
|
2932
|
+
style: {
|
|
2933
|
+
position: "absolute",
|
|
2934
|
+
top: I.top,
|
|
2935
|
+
left: I.left,
|
|
2936
|
+
width: m,
|
|
2937
|
+
height: _.height - I.top - I.bottom
|
|
2938
|
+
},
|
|
2939
|
+
children: g.map(x)
|
|
2940
|
+
}
|
|
2941
|
+
)
|
|
2942
|
+
]
|
|
2943
|
+
}
|
|
2944
|
+
) })
|
|
2945
|
+
] }) }) : /* @__PURE__ */ e.jsx(Be, { children: /* @__PURE__ */ e.jsxs("div", { className: "app-container", children: [
|
|
2946
|
+
/* @__PURE__ */ e.jsx(In, { onCustomSave: a ? p : void 0, onCustomPrint: r }),
|
|
2947
|
+
/* @__PURE__ */ e.jsxs("div", { className: "app-body", children: [
|
|
2948
|
+
/* @__PURE__ */ e.jsx("div", { className: "app-left-panel", children: /* @__PURE__ */ e.jsx(Bn, {}) }),
|
|
2949
|
+
/* @__PURE__ */ e.jsx(Ot, {}),
|
|
2950
|
+
/* @__PURE__ */ e.jsx("div", { className: "app-right-panel", children: /* @__PURE__ */ e.jsx(Jn, {}) })
|
|
2951
|
+
] }),
|
|
2952
|
+
/* @__PURE__ */ e.jsx(Yn, {}),
|
|
2953
|
+
/* @__PURE__ */ e.jsx(Hn, {})
|
|
2954
|
+
] }) });
|
|
2955
|
+
};
|
|
2956
|
+
export {
|
|
2957
|
+
rr as PrintDesigner,
|
|
2958
|
+
Ze as getArrayFromDataSource,
|
|
2959
|
+
Xe as getObjectFromDataSource,
|
|
2960
|
+
Te as getRenderValue,
|
|
2961
|
+
Ye as getValueByPath,
|
|
2962
|
+
Pe as safeParseJSON,
|
|
2963
|
+
w as useDesignerStore
|
|
2964
|
+
};
|