@canvas-components/print-design-plugin 0.1.7 → 0.1.9
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/README.md +51 -5
- package/dist/index.cjs +1144 -131
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1145 -132
- package/dist/list-table-print.cjs +1687 -302
- package/dist/list-table-print.css +505 -6
- package/dist/list-table-print.d.cts +2 -2
- package/dist/list-table-print.d.ts +2 -2
- package/dist/list-table-print.js +1690 -305
- package/dist/{model-BwhSanYM.d.cts → model-DIvOoRX8.d.cts} +47 -1
- package/dist/{model-BwhSanYM.d.ts → model-DIvOoRX8.d.ts} +47 -1
- package/dist/native.cjs +1144 -131
- package/dist/native.d.cts +2 -2
- package/dist/native.d.ts +2 -2
- package/dist/native.js +1145 -132
- package/dist/react.cjs +4408 -354
- package/dist/react.css +505 -6
- package/dist/react.d.cts +176 -3
- package/dist/react.d.ts +176 -3
- package/dist/react.js +4411 -359
- package/package.json +11 -10
|
@@ -55,7 +55,9 @@ function assertNativePluginDependencies(plugins) {
|
|
|
55
55
|
function validateTextElement(value) {
|
|
56
56
|
if (!value || typeof value !== "object") return false;
|
|
57
57
|
const element = value;
|
|
58
|
-
return element.type === "text" && typeof element.text === "string" && (element.colorMode === void 0 || ["static", "binding"].includes(element.colorMode)) && (element.fontSizeMode === void 0 || ["static", "binding"].includes(element.fontSizeMode)) && (element.colorPath === void 0 || typeof element.colorPath === "string") && (element.fontSizePath === void 0 || typeof element.fontSizePath === "string") && (element.fontSizeBindingUnit === void 0 || ["mm", "cm", "in", "pt", "px"].includes(element.fontSizeBindingUnit)) && (element.heightOverflow === void 0 || ["clip", "flow", "ellipsis"].includes(element.heightOverflow)) && (element.
|
|
58
|
+
return element.type === "text" && typeof element.text === "string" && (element.fontStyle === void 0 || ["normal", "italic"].includes(element.fontStyle)) && (element.colorMode === void 0 || ["static", "binding"].includes(element.colorMode)) && (element.fontSizeMode === void 0 || ["static", "binding"].includes(element.fontSizeMode)) && (element.colorPath === void 0 || typeof element.colorPath === "string") && (element.fontSizePath === void 0 || typeof element.fontSizePath === "string") && (element.fontSizeBindingUnit === void 0 || ["mm", "cm", "in", "pt", "px"].includes(element.fontSizeBindingUnit)) && (element.heightOverflow === void 0 || ["clip", "flow", "ellipsis"].includes(element.heightOverflow)) && (element.indentMode === void 0 || ["none", "firstLine", "hanging"].includes(element.indentMode)) && (element.indentValue === void 0 || Number.isFinite(element.indentValue) && element.indentValue >= 0) && (element.indentUnit === void 0 || ["char", "mm", "cm", "in", "pt", "px"].includes(element.indentUnit)) && (element.prewrappedIndents === void 0 || Array.isArray(element.prewrappedIndents) && element.prewrappedIndents.every(
|
|
59
|
+
(value2) => Number.isFinite(value2) && value2 >= 0
|
|
60
|
+
)) && (element.underlineStyle === void 0 || ["solid", "dashed", "dotted", "wavy"].includes(element.underlineStyle)) && (element.underlineCount === void 0 || Number.isInteger(element.underlineCount) && element.underlineCount >= 0 && element.underlineCount <= 5) && (element.fontSource === void 0 || typeof element.fontSource === "string") && (element.borderWidth === void 0 || Number.isFinite(element.borderWidth) && element.borderWidth >= 0) && (element.borderColor === void 0 || typeof element.borderColor === "string") && (element.fontSizeRules === void 0 || Array.isArray(element.fontSizeRules) && element.fontSizeRules.every(
|
|
59
61
|
(rule) => rule && Number.isInteger(rule.maxChars) && rule.maxChars >= 1 && Number.isFinite(rule.fontSize) && rule.fontSize > 0
|
|
60
62
|
));
|
|
61
63
|
}
|
|
@@ -71,23 +73,36 @@ function graphemes(text) {
|
|
|
71
73
|
function drawVerticalText(ctx, text, box, options) {
|
|
72
74
|
if (box.width <= 0 || box.height <= 0) return;
|
|
73
75
|
const step = Math.max(1, options.fontSize * options.lineHeight);
|
|
74
|
-
const capacity = Math.max(1, Math.floor(box.height / step));
|
|
75
76
|
const paragraphs = text.split(/\r?\n/).map(graphemes);
|
|
76
77
|
const columns = paragraphs.flatMap((chars) => {
|
|
77
|
-
if (!options.wrap || chars.length <= capacity) return [chars];
|
|
78
78
|
const chunks = [];
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
let offset = 0;
|
|
80
|
+
do {
|
|
81
|
+
const indent = options.indentMode === "firstLine" ? chunks.length === 0 ? options.indent ?? 0 : 0 : options.indentMode === "hanging" && chunks.length > 0 ? options.indent ?? 0 : 0;
|
|
82
|
+
const capacity = Math.max(1, Math.floor((box.height - indent) / step));
|
|
83
|
+
chunks.push({
|
|
84
|
+
chars: options.wrap === false ? chars.slice(offset) : chars.slice(offset, offset + capacity),
|
|
85
|
+
indent
|
|
86
|
+
});
|
|
87
|
+
offset += capacity;
|
|
88
|
+
} while (options.wrap !== false && offset < chars.length);
|
|
81
89
|
return chunks;
|
|
82
90
|
});
|
|
83
91
|
const visibleCount = Math.max(1, Math.floor(box.width / step));
|
|
84
92
|
const visible = columns.slice(0, visibleCount);
|
|
85
|
-
const overflowed = columns.length > visibleCount || !options.wrap && visible.some(
|
|
93
|
+
const overflowed = columns.length > visibleCount || !options.wrap && visible.some(
|
|
94
|
+
({ chars, indent }) => chars.length > Math.max(1, Math.floor((box.height - indent) / step))
|
|
95
|
+
);
|
|
86
96
|
if (options.ellipsis && overflowed && visible.length) {
|
|
87
|
-
const
|
|
97
|
+
const previous = visible[visible.length - 1];
|
|
98
|
+
const capacity = Math.max(
|
|
99
|
+
1,
|
|
100
|
+
Math.floor((box.height - previous.indent) / step)
|
|
101
|
+
);
|
|
102
|
+
const last = [...previous.chars];
|
|
88
103
|
last.length = Math.min(last.length, capacity);
|
|
89
104
|
last[Math.max(0, Math.min(last.length, capacity) - 1)] = "\u2026";
|
|
90
|
-
visible[visible.length - 1] = last;
|
|
105
|
+
visible[visible.length - 1] = { ...previous, chars: last };
|
|
91
106
|
}
|
|
92
107
|
const blockWidth = visible.length * step;
|
|
93
108
|
const left = options.align === "left" ? box.x : options.align === "center" ? box.x + (box.width - blockWidth) / 2 : box.x + box.width - blockWidth;
|
|
@@ -97,12 +112,17 @@ function drawVerticalText(ctx, text, box, options) {
|
|
|
97
112
|
ctx.clip();
|
|
98
113
|
ctx.textAlign = "center";
|
|
99
114
|
ctx.textBaseline = "middle";
|
|
100
|
-
visible.forEach((chars, column) => {
|
|
115
|
+
visible.forEach(({ chars, indent }, column) => {
|
|
101
116
|
const textHeight = chars.length * step;
|
|
102
|
-
const
|
|
117
|
+
const availableHeight = Math.max(0, box.height - indent);
|
|
118
|
+
const offset = options.verticalAlign === "bottom" ? Math.max(0, availableHeight - textHeight) : options.verticalAlign === "middle" ? Math.max(0, (availableHeight - textHeight) / 2) : 0;
|
|
103
119
|
const centerX = left + blockWidth - (column + 0.5) * step;
|
|
104
120
|
chars.forEach(
|
|
105
|
-
(char, index) => ctx.fillText(
|
|
121
|
+
(char, index) => ctx.fillText(
|
|
122
|
+
char,
|
|
123
|
+
centerX,
|
|
124
|
+
box.y + indent + offset + (index + 0.5) * step
|
|
125
|
+
)
|
|
106
126
|
);
|
|
107
127
|
});
|
|
108
128
|
ctx.restore();
|
|
@@ -143,15 +163,16 @@ function getTextLayoutCache(ctx) {
|
|
|
143
163
|
}
|
|
144
164
|
return entry;
|
|
145
165
|
}
|
|
146
|
-
function layoutSpacedText(ctx, text, width, prewrapped = false) {
|
|
166
|
+
function layoutSpacedText(ctx, text, width, prewrapped = false, indent) {
|
|
147
167
|
const cache = getTextLayoutCache(ctx);
|
|
148
|
-
const key = `${prewrapped}:${width}\0${text}`;
|
|
168
|
+
const key = `${prewrapped}:${width}:${indent?.mode ?? "none"}:${indent?.value ?? 0}\0${text}`;
|
|
149
169
|
let lines = cache.lines.get(key);
|
|
150
170
|
if (!lines) {
|
|
151
171
|
lines = prewrapped ? text.split("\n").map((text2) => ({ text: text2, last: true })) : layoutAlignedText(
|
|
152
172
|
text,
|
|
153
173
|
width,
|
|
154
|
-
(value) => measureSpacedText(ctx, value)
|
|
174
|
+
(value) => measureSpacedText(ctx, value),
|
|
175
|
+
indent
|
|
155
176
|
);
|
|
156
177
|
if (cache.lines.size >= 128) cache.lines.clear();
|
|
157
178
|
cache.lines.set(key, lines);
|
|
@@ -205,28 +226,30 @@ function drawSpacedText(ctx, text, x, y) {
|
|
|
205
226
|
});
|
|
206
227
|
ctx.textAlign = align;
|
|
207
228
|
}
|
|
208
|
-
function layoutAlignedText(text, width, measure) {
|
|
229
|
+
function layoutAlignedText(text, width, measure, indent) {
|
|
209
230
|
return text.split("\n").flatMap((paragraph) => {
|
|
210
231
|
const lines = [];
|
|
211
232
|
let line = "";
|
|
233
|
+
const indentation = (index) => indent?.mode === "firstLine" ? index === 0 ? indent.value : 0 : indent?.mode === "hanging" && index > 0 ? indent.value : 0;
|
|
212
234
|
const tokens = paragraph.match(
|
|
213
235
|
/[¥¥$€£]?\p{N}+(?:[.,:/-]\p{N}+)*(?:[%%])?|[\p{Script=Latin}\p{N}]+|\s+|[^\p{Script=Latin}\p{N}\s]+/gu
|
|
214
236
|
) ?? [];
|
|
215
237
|
const pieces = tokens.flatMap(
|
|
216
238
|
(token) => /^(?:[¥¥$€£]?\p{N}+(?:[.,:/-]\p{N}+)*(?:[%%])?|[\p{Script=Latin}\p{N}\s]+)$/u.test(
|
|
217
239
|
token
|
|
218
|
-
) && measure(token) <= width ? [token] : graphemes(token)
|
|
240
|
+
) && measure(token) <= Math.max(1, width - Math.max(0, indent?.value ?? 0)) ? [token] : graphemes(token)
|
|
219
241
|
);
|
|
220
242
|
for (const piece of pieces) {
|
|
221
|
-
if (line && measure(line + piece) > width) {
|
|
222
|
-
lines.push(line.trimEnd());
|
|
243
|
+
if (line && measure(line + piece) > Math.max(1, width - indentation(lines.length))) {
|
|
244
|
+
lines.push({ text: line.trimEnd(), indent: indentation(lines.length) });
|
|
223
245
|
line = "";
|
|
224
246
|
}
|
|
225
247
|
if (line || piece.trim()) line += piece;
|
|
226
248
|
}
|
|
227
|
-
lines.push(line.trimEnd());
|
|
249
|
+
lines.push({ text: line.trimEnd(), indent: indentation(lines.length) });
|
|
228
250
|
return lines.map((value, index) => ({
|
|
229
|
-
text: value,
|
|
251
|
+
text: value.text,
|
|
252
|
+
...indent && indent.mode !== "none" && indent.value > 0 ? { indent: value.indent } : {},
|
|
230
253
|
last: index === lines.length - 1
|
|
231
254
|
}));
|
|
232
255
|
});
|
|
@@ -252,13 +275,7 @@ function drawAlignedTextLine(ctx, text, x, y, width, distributed) {
|
|
|
252
275
|
});
|
|
253
276
|
}
|
|
254
277
|
function resolveTextFontFamily(family) {
|
|
255
|
-
|
|
256
|
-
if (!selected) return printDesign.PRINT_DESIGN_DEFAULT_FONT_FAMILY;
|
|
257
|
-
if (/\bPrintDesignNotoSansSC\b/i.test(selected)) return selected;
|
|
258
|
-
if (!/(?:^|,)\s*['"]?Times New Roman['"]?(?:,|$)/i.test(selected) && !/(?:^|,)\s*serif\s*$/i.test(selected))
|
|
259
|
-
return selected;
|
|
260
|
-
const generic = /,\s*(sans-serif|serif|monospace|cursive|fantasy|system-ui)\s*$/i;
|
|
261
|
-
return generic.test(selected) ? selected.replace(generic, ", PrintDesignNotoSansSC, $1") : `${selected}, PrintDesignNotoSansSC`;
|
|
278
|
+
return printDesign.resolvePrintDesignFontFamily(family);
|
|
262
279
|
}
|
|
263
280
|
|
|
264
281
|
// src/plugins/text/layout/measure.ts
|
|
@@ -276,7 +293,7 @@ function createHtmlTextMeasure(element, fontSize, fallback) {
|
|
|
276
293
|
widths = /* @__PURE__ */ new Map();
|
|
277
294
|
widthCaches.set(ownerDocument, widths);
|
|
278
295
|
}
|
|
279
|
-
const font = `${element.fontWeight ?? "400"} ${fontSize}pt ${resolveTextFontFamily(element.fontFamily)}`;
|
|
296
|
+
const font = `${element.fontStyle ?? "normal"} ${element.fontWeight ?? "400"} ${fontSize}pt ${resolveTextFontFamily(element.fontFamily)}`;
|
|
280
297
|
let span;
|
|
281
298
|
return {
|
|
282
299
|
measure: (value) => {
|
|
@@ -307,6 +324,12 @@ function createHtmlTextMeasure(element, fontSize, fallback) {
|
|
|
307
324
|
dispose: () => span?.remove()
|
|
308
325
|
};
|
|
309
326
|
}
|
|
327
|
+
function resolveTextIndentMm(element, fontSizePt) {
|
|
328
|
+
if (!element.indentMode || element.indentMode === "none") return 0;
|
|
329
|
+
const value = Math.max(0, element.indentValue ?? 0);
|
|
330
|
+
if (!Number.isFinite(value)) return 0;
|
|
331
|
+
return element.indentUnit === "char" || !element.indentUnit ? value * fontSizePt * 25.4 / 72 : printDesign.fromDisplayUnit(value, element.indentUnit);
|
|
332
|
+
}
|
|
310
333
|
|
|
311
334
|
// src/plugins/text/rendering/formatting.ts
|
|
312
335
|
function resolveTextFontSize(element, text) {
|
|
@@ -326,15 +349,15 @@ function ellipsizeTextLine(text, maxWidth, measure) {
|
|
|
326
349
|
|
|
327
350
|
// src/plugins/text/rendering/draw.ts
|
|
328
351
|
var loadedFonts = /* @__PURE__ */ new WeakMap();
|
|
329
|
-
var DEFAULT_TEXT_BASELINE_CORRECTION_RATIO = 0.05;
|
|
330
352
|
function prepareTextFont(element, signal) {
|
|
331
353
|
const family = element.fontFamily?.trim();
|
|
332
354
|
const source = element.fontSource?.trim();
|
|
333
355
|
if (!family || !source) return Promise.resolve();
|
|
334
356
|
if (typeof document === "undefined" || typeof FontFace === "undefined")
|
|
335
|
-
return Promise.
|
|
357
|
+
return Promise.resolve();
|
|
336
358
|
signal?.throwIfAborted();
|
|
337
|
-
const ready = ensureTextFont(element, document)
|
|
359
|
+
const ready = ensureTextFont(element, document).catch(() => {
|
|
360
|
+
});
|
|
338
361
|
if (!signal) return ready;
|
|
339
362
|
return new Promise((resolve, reject) => {
|
|
340
363
|
const onAbort = () => reject(signal.reason);
|
|
@@ -401,7 +424,7 @@ var drawTextElement = (element, context) => {
|
|
|
401
424
|
const resolvedFontSize = resolveTextFontSize(element, resolvedText);
|
|
402
425
|
const fontSize = resolvedFontSize * 25.4 * scale / 72;
|
|
403
426
|
ctx.fillStyle = element.color ?? "#1f2937";
|
|
404
|
-
ctx.font = `${element.fontWeight ?? "400"} ${fontSize}px ${resolveTextFontFamily(element.fontFamily)}`;
|
|
427
|
+
ctx.font = `${element.fontStyle ?? "normal"} ${element.fontWeight ?? "400"} ${fontSize}px ${resolveTextFontFamily(element.fontFamily)}`;
|
|
405
428
|
const expanded = element.textAlign === "justify" || element.textAlign === "distributed";
|
|
406
429
|
ctx.textAlign = expanded ? "left" : element.textAlign ?? "left";
|
|
407
430
|
ctx.textBaseline = "alphabetic";
|
|
@@ -416,7 +439,9 @@ var drawTextElement = (element, context) => {
|
|
|
416
439
|
align: element.textAlign === "left" || element.textAlign === "center" ? element.textAlign : "right",
|
|
417
440
|
verticalAlign: element.verticalAlign,
|
|
418
441
|
wrap: true,
|
|
419
|
-
ellipsis: element.heightOverflow === "ellipsis"
|
|
442
|
+
ellipsis: element.heightOverflow === "ellipsis",
|
|
443
|
+
indentMode: element.indentMode,
|
|
444
|
+
indent: resolveTextIndentMm(element, resolvedFontSize) * scale
|
|
420
445
|
}
|
|
421
446
|
);
|
|
422
447
|
return;
|
|
@@ -425,19 +450,31 @@ var drawTextElement = (element, context) => {
|
|
|
425
450
|
const fontMetrics = ctx.measureText?.("Hg");
|
|
426
451
|
const ascent = fontMetrics?.fontBoundingBoxAscent ?? fontSize * 0.8;
|
|
427
452
|
const descent = fontMetrics?.fontBoundingBoxDescent ?? fontSize * 0.2;
|
|
428
|
-
const
|
|
429
|
-
const regularNoto = element.fontFamily?.startsWith("PrintDesignNotoSansSC") && !/^(?:bold|[6-9]00)$/i.test(element.fontWeight ?? "400");
|
|
430
|
-
const baselineOffset = (lineHeight - ascent - descent) / 2 + ascent - (defaultFont || regularNoto ? fontSize * DEFAULT_TEXT_BASELINE_CORRECTION_RATIO : 0);
|
|
453
|
+
const baselineOffset = (lineHeight - ascent - descent) / 2 + ascent;
|
|
431
454
|
const measure = (text) => measureSpacedText(ctx, text);
|
|
432
|
-
|
|
455
|
+
const indentPx = resolveTextIndentMm(element, resolvedFontSize) * scale;
|
|
456
|
+
let lines = layoutSpacedText(ctx, resolvedText, width, element.prewrapped, {
|
|
457
|
+
mode: element.indentMode ?? "none",
|
|
458
|
+
value: indentPx
|
|
459
|
+
});
|
|
460
|
+
if (element.prewrappedIndents)
|
|
461
|
+
lines = lines.map((line, index) => ({
|
|
462
|
+
...line,
|
|
463
|
+
indent: (element.prewrappedIndents?.[index] ?? 0) * scale
|
|
464
|
+
}));
|
|
433
465
|
if (element.heightOverflow) {
|
|
434
466
|
const fit = Math.max(0, Math.floor(height / lineHeight));
|
|
435
467
|
if (lines.length > fit) {
|
|
436
468
|
lines = lines.slice(0, fit);
|
|
437
469
|
if (fit && element.heightOverflow === "ellipsis")
|
|
438
470
|
lines[fit - 1] = {
|
|
439
|
-
text: ellipsizeTextLine(
|
|
440
|
-
|
|
471
|
+
text: ellipsizeTextLine(
|
|
472
|
+
lines[fit - 1].text,
|
|
473
|
+
Math.max(1, width - (lines[fit - 1].indent ?? 0)),
|
|
474
|
+
measure
|
|
475
|
+
),
|
|
476
|
+
last: true,
|
|
477
|
+
indent: lines[fit - 1].indent
|
|
441
478
|
};
|
|
442
479
|
}
|
|
443
480
|
ctx.beginPath();
|
|
@@ -445,16 +482,22 @@ var drawTextElement = (element, context) => {
|
|
|
445
482
|
ctx.clip();
|
|
446
483
|
}
|
|
447
484
|
const verticalOffset = element.verticalAlign === "middle" ? Math.max(0, (height - lines.length * lineHeight) / 2) : element.verticalAlign === "bottom" ? Math.max(0, height - lines.length * lineHeight) : 0;
|
|
448
|
-
const textX = element.textAlign === "center" ? x + width / 2 : element.textAlign === "right" ? x + width : x;
|
|
449
485
|
lines.forEach((line, index) => {
|
|
450
486
|
const lineY = y + verticalOffset + index * lineHeight + baselineOffset;
|
|
487
|
+
const lineIndent = Math.min(
|
|
488
|
+
Math.max(0, line.indent ?? 0),
|
|
489
|
+
Math.max(0, width)
|
|
490
|
+
);
|
|
491
|
+
const lineLeft = x + lineIndent;
|
|
492
|
+
const lineWidth = Math.max(0, width - lineIndent);
|
|
493
|
+
const textX = element.textAlign === "center" ? lineLeft + lineWidth / 2 : element.textAlign === "right" ? x + width : lineLeft;
|
|
451
494
|
if (expanded && (element.textAlign === "distributed" || !line.last)) {
|
|
452
495
|
drawAlignedTextLine(
|
|
453
496
|
ctx,
|
|
454
497
|
line.text,
|
|
455
|
-
|
|
498
|
+
lineLeft,
|
|
456
499
|
lineY,
|
|
457
|
-
|
|
500
|
+
lineWidth,
|
|
458
501
|
element.textAlign === "distributed"
|
|
459
502
|
);
|
|
460
503
|
} else {
|
|
@@ -465,8 +508,8 @@ var drawTextElement = (element, context) => {
|
|
|
465
508
|
Math.max(0, Math.floor(element.underlineCount ?? 0))
|
|
466
509
|
);
|
|
467
510
|
if (!count || !line.text) return;
|
|
468
|
-
const textWidth = Math.min(
|
|
469
|
-
const left = expanded && (element.textAlign === "distributed" || !line.last) ?
|
|
511
|
+
const textWidth = Math.min(lineWidth, measure(line.text));
|
|
512
|
+
const left = expanded && (element.textAlign === "distributed" || !line.last) ? lineLeft : element.textAlign === "center" ? textX - textWidth / 2 : element.textAlign === "right" ? textX - textWidth : textX;
|
|
470
513
|
ctx.save();
|
|
471
514
|
ctx.strokeStyle = element.underlineColor ?? element.color ?? "#1f2937";
|
|
472
515
|
ctx.lineWidth = Math.max(0.5, (element.underlineWidth ?? 0.2) * scale);
|
|
@@ -517,13 +560,24 @@ function textMarkup(text, element, size = 14, color2 = "#1f2937") {
|
|
|
517
560
|
const weight = /^(?:[1-9]00|normal|bold)$/.test(
|
|
518
561
|
textElement?.fontWeight ?? "400"
|
|
519
562
|
) ? textElement?.fontWeight ?? "400" : "400";
|
|
563
|
+
const fontStyle = textElement?.fontStyle === "italic" ? "italic" : "normal";
|
|
520
564
|
const fontSize = textElement ? resolveTextFontSize(textElement, text) : printDesign.cssNumber(size, 14);
|
|
521
|
-
if (textElement?.textDirection === "vertical")
|
|
522
|
-
|
|
565
|
+
if (textElement?.textDirection === "vertical") {
|
|
566
|
+
const indentMm2 = resolveTextIndentMm(textElement, fontSize);
|
|
567
|
+
const paragraphStyle = indentMm2 <= 0 ? "" : textElement.indentMode === "firstLine" ? `text-indent:${printDesign.cssNumber(indentMm2, 0)}mm;` : `padding-top:${printDesign.cssNumber(indentMm2, 0)}mm;text-indent:-${printDesign.cssNumber(indentMm2, 0)}mm;box-sizing:border-box;`;
|
|
568
|
+
const content = indentMm2 > 0 ? text.split("\n").map(
|
|
569
|
+
(paragraph) => `<div style="${paragraphStyle}">${printDesign.escapeHtml(paragraph) || "<br>"}</div>`
|
|
570
|
+
).join("") : printDesign.escapeHtml(text);
|
|
571
|
+
return `<div class="pd-text" style="display:block;font:${fontStyle} ${weight} ${fontSize}pt ${printDesign.escapeHtml(printDesign.cssFont(resolveTextFontFamily(textElement.fontFamily)))};color:${printDesign.cssColor(color2, "#1f2937")};writing-mode:vertical-rl;text-orientation:upright;white-space:pre-wrap;text-align:${vertical === "middle" ? "center" : vertical === "bottom" ? "end" : "start"};line-height:${printDesign.cssNumber(textElement.lineHeight, 1.35)}">${content}</div>`;
|
|
572
|
+
}
|
|
573
|
+
const indentMm = textElement ? resolveTextIndentMm(textElement, fontSize) : 0;
|
|
574
|
+
const indentStyle = (lineIndex) => indentMm > 0 && textElement ? textElement.indentMode === "firstLine" ? lineIndex === 0 ? `text-indent:${printDesign.cssNumber(indentMm, 0)}mm;` : "" : textElement.indentMode === "hanging" ? `padding-left:${printDesign.cssNumber(indentMm, 0)}mm;text-indent:${`-${printDesign.cssNumber(indentMm, 0)}mm` };box-sizing:border-box;` : "" : "";
|
|
523
575
|
const lines = textElement?.prewrapped ? text.split("\n").map(
|
|
524
|
-
(line) => `<div style="white-space:pre;overflow:hidden;flex:none"><span style="${underlineCss(textElement)}">${printDesign.escapeHtml(line) || "<br>"}</span></div>`
|
|
576
|
+
(line, index) => `<div style="white-space:pre;overflow:hidden;flex:none${textElement.prewrappedIndents ? `;box-sizing:border-box;padding-left:${printDesign.cssNumber(textElement.prewrappedIndents[index] ?? 0, 0)}mm` : ""}"><span style="${underlineCss(textElement)}">${printDesign.escapeHtml(line) || "<br>"}</span></div>`
|
|
577
|
+
).join("") : indentMm > 0 ? text.split("\n").map(
|
|
578
|
+
(paragraph) => `<div style="min-width:0;white-space:pre-wrap;overflow-wrap:anywhere;${indentStyle(0)}"><span style="${textElement ? underlineCss(textElement) : ""}">${printDesign.escapeHtml(paragraph) || "<br>"}</span></div>`
|
|
525
579
|
).join("") : `<div style="min-width:0;white-space:pre-wrap;overflow-wrap:anywhere"><span style="${textElement ? underlineCss(textElement) : ""}">${printDesign.escapeHtml(text)}</span></div>`;
|
|
526
|
-
return `<div class="pd-text" style="font:${weight} ${fontSize}pt ${printDesign.escapeHtml(printDesign.cssFont(resolveTextFontFamily(textElement?.fontFamily)))};color:${printDesign.cssColor(color2, "#1f2937")};text-align:${align};line-height:${printDesign.cssNumber(textElement?.lineHeight, 1.35)};justify-content:${vertical === "middle" ? "center" : vertical === "bottom" ? "flex-end" : "flex-start"}">${lines}</div>`;
|
|
580
|
+
return `<div class="pd-text" style="font:${fontStyle} ${weight} ${fontSize}pt ${printDesign.escapeHtml(printDesign.cssFont(resolveTextFontFamily(textElement?.fontFamily)))};color:${printDesign.cssColor(color2, "#1f2937")};text-align:${align};line-height:${printDesign.cssNumber(textElement?.lineHeight, 1.35)};justify-content:${vertical === "middle" ? "center" : vertical === "bottom" ? "flex-end" : "flex-start"}">${lines}</div>`;
|
|
527
581
|
}
|
|
528
582
|
function underlineCss(element) {
|
|
529
583
|
const count = Math.min(
|
|
@@ -558,6 +612,18 @@ function textFontCss(element) {
|
|
|
558
612
|
return `@font-face{font-family:${printDesign.cssFont(element.fontFamily)};src:url("${source}")}`;
|
|
559
613
|
}
|
|
560
614
|
var PT_TO_MM = 25.4 / 72;
|
|
615
|
+
function layoutText(element, text, measure) {
|
|
616
|
+
if (element.prewrapped)
|
|
617
|
+
return text.split("\n").map((line, index) => ({
|
|
618
|
+
text: line,
|
|
619
|
+
last: true,
|
|
620
|
+
indent: element.prewrappedIndents?.[index] ?? 0
|
|
621
|
+
}));
|
|
622
|
+
return layoutAlignedText(text, element.width, measure, {
|
|
623
|
+
mode: element.indentMode ?? "none",
|
|
624
|
+
value: resolveTextIndentMm(element, resolveTextFontSize(element, text))
|
|
625
|
+
});
|
|
626
|
+
}
|
|
561
627
|
function paginateText(element, { data, startPage, startY, top, bottom, pageAt }) {
|
|
562
628
|
const text = element.dataConfig?.mode === "binding" ? element.text : printDesign.resolveDesignText(element.text, data);
|
|
563
629
|
if (element.textDirection === "vertical") {
|
|
@@ -585,9 +651,7 @@ function paginateText(element, { data, startPage, startY, top, bottom, pageAt })
|
|
|
585
651
|
);
|
|
586
652
|
let lines;
|
|
587
653
|
try {
|
|
588
|
-
lines =
|
|
589
|
-
(line) => line.text
|
|
590
|
-
);
|
|
654
|
+
lines = layoutText(element, text, measurement.measure);
|
|
591
655
|
} finally {
|
|
592
656
|
measurement.dispose();
|
|
593
657
|
}
|
|
@@ -616,7 +680,8 @@ function paginateText(element, { data, startPage, startY, top, bottom, pageAt })
|
|
|
616
680
|
previewSourceId: element.previewSourceId ?? element.id,
|
|
617
681
|
y,
|
|
618
682
|
height,
|
|
619
|
-
text: chunk.join("\n"),
|
|
683
|
+
text: chunk.map((line) => line.text).join("\n"),
|
|
684
|
+
...element.indentMode && element.indentMode !== "none" && (element.indentValue ?? 0) > 0 ? { prewrappedIndents: chunk.map((line) => line.indent ?? 0) } : {},
|
|
620
685
|
prewrapped: true,
|
|
621
686
|
verticalAlign: "top",
|
|
622
687
|
dataConfig: void 0
|
|
@@ -644,7 +709,11 @@ function prewrapText(element) {
|
|
|
644
709
|
(value) => estimateTextWidth(value, fontMm)
|
|
645
710
|
);
|
|
646
711
|
try {
|
|
647
|
-
|
|
712
|
+
const lines = layoutText(element, element.text, measurement.measure);
|
|
713
|
+
return {
|
|
714
|
+
text: lines.map((line) => line.text).join("\n"),
|
|
715
|
+
indents: element.indentMode && element.indentMode !== "none" && (element.indentValue ?? 0) > 0 ? lines.map((line) => line.indent ?? 0) : void 0
|
|
716
|
+
};
|
|
648
717
|
} finally {
|
|
649
718
|
measurement.dispose();
|
|
650
719
|
}
|
|
@@ -657,12 +726,12 @@ function estimateTextHeight(element) {
|
|
|
657
726
|
(value) => estimateTextWidth(value, fontMm)
|
|
658
727
|
);
|
|
659
728
|
try {
|
|
660
|
-
return
|
|
729
|
+
return layoutText(element, element.text, measurement.measure).length * fontMm * (element.lineHeight ?? 1.35);
|
|
661
730
|
} finally {
|
|
662
731
|
measurement.dispose();
|
|
663
732
|
}
|
|
664
733
|
}
|
|
665
|
-
function
|
|
734
|
+
function truncateTextLayout(element, height, mode) {
|
|
666
735
|
const fontMm = Math.max(1, (element.fontSize ?? 14) * PT_TO_MM);
|
|
667
736
|
const lineMm = fontMm * (element.lineHeight ?? 1.35);
|
|
668
737
|
const measurement = createHtmlTextMeasure(
|
|
@@ -671,21 +740,21 @@ function truncateText(element, height, mode) {
|
|
|
671
740
|
(value) => estimateTextWidth(value, fontMm)
|
|
672
741
|
);
|
|
673
742
|
try {
|
|
674
|
-
const lines =
|
|
675
|
-
element.text,
|
|
676
|
-
element.width,
|
|
677
|
-
measurement.measure
|
|
678
|
-
);
|
|
743
|
+
const lines = layoutText(element, element.text, measurement.measure);
|
|
679
744
|
const fit = Math.max(0, Math.floor(height / lineMm));
|
|
680
|
-
|
|
681
|
-
const visible =
|
|
745
|
+
const visibleLines = lines.slice(0, fit);
|
|
746
|
+
const visible = visibleLines.map((line) => line.text);
|
|
682
747
|
if (fit && mode === "ellipsis")
|
|
683
748
|
visible[fit - 1] = ellipsizeTextLine(
|
|
684
749
|
visible[fit - 1],
|
|
685
|
-
element.width,
|
|
750
|
+
Math.max(1, element.width - (lines[fit - 1]?.indent ?? 0)),
|
|
686
751
|
measurement.measure
|
|
687
752
|
);
|
|
688
|
-
return
|
|
753
|
+
return {
|
|
754
|
+
text: visible.join("\n"),
|
|
755
|
+
indents: element.indentMode && element.indentMode !== "none" && (element.indentValue ?? 0) > 0 ? visibleLines.map((line) => line.indent ?? 0) : void 0,
|
|
756
|
+
overflowed: lines.length > fit
|
|
757
|
+
};
|
|
689
758
|
} finally {
|
|
690
759
|
measurement.dispose();
|
|
691
760
|
}
|
|
@@ -715,11 +784,13 @@ function prepareTextPagination(element, data) {
|
|
|
715
784
|
};
|
|
716
785
|
if (element.textDirection === "vertical" || element.overflowPolicy === "split" || element.heightOverflow === "flow" && element.overflowPolicy !== "nextPage")
|
|
717
786
|
return prepared;
|
|
718
|
-
const
|
|
787
|
+
const wrapped = element.heightOverflow && element.heightOverflow !== "flow" ? truncateTextLayout(prepared, prepared.height, element.heightOverflow) : prewrapText(prepared);
|
|
788
|
+
return {
|
|
719
789
|
...prepared,
|
|
720
|
-
text:
|
|
721
|
-
|
|
722
|
-
|
|
790
|
+
text: wrapped.text,
|
|
791
|
+
...wrapped.indents ? { prewrappedIndents: wrapped.indents } : {},
|
|
792
|
+
prewrapped: true
|
|
793
|
+
};
|
|
723
794
|
}
|
|
724
795
|
function measureTextFlowHeight(element, data) {
|
|
725
796
|
if (element.heightOverflow && element.heightOverflow !== "flow")
|
|
@@ -728,7 +799,13 @@ function measureTextFlowHeight(element, data) {
|
|
|
728
799
|
return Math.max(prepared.height, estimateTextHeight(prepared));
|
|
729
800
|
}
|
|
730
801
|
function truncateTextOverflow(element, height, mode) {
|
|
731
|
-
|
|
802
|
+
const truncated = truncateTextLayout(element, height, mode);
|
|
803
|
+
return {
|
|
804
|
+
...element,
|
|
805
|
+
text: truncated.text,
|
|
806
|
+
prewrapped: true,
|
|
807
|
+
...truncated.indents ? { prewrappedIndents: truncated.indents } : {}
|
|
808
|
+
};
|
|
732
809
|
}
|
|
733
810
|
function registeredFieldBindingInfo(element, fields) {
|
|
734
811
|
const config = printDesign.getPrintDesignElementDataConfig(element, fields);
|
|
@@ -801,14 +878,14 @@ function resolveTextFontSizeValue(value, defaultUnit = "mm") {
|
|
|
801
878
|
// src/plugins/text/data/binding.ts
|
|
802
879
|
function getTextBindingInfo(element) {
|
|
803
880
|
const content = registeredFieldBindingInfo(element, textDataFields);
|
|
804
|
-
const
|
|
881
|
+
const paths2 = [
|
|
805
882
|
...content.paths,
|
|
806
883
|
element.colorMode === "binding" ? element.colorPath : void 0,
|
|
807
884
|
element.fontSizeMode === "binding" ? element.fontSizePath : void 0
|
|
808
885
|
].filter((path) => !!path?.trim());
|
|
809
886
|
return {
|
|
810
887
|
bound: content.bound || element.colorMode === "binding" || element.fontSizeMode === "binding",
|
|
811
|
-
paths
|
|
888
|
+
paths: paths2
|
|
812
889
|
};
|
|
813
890
|
}
|
|
814
891
|
function missingExpressionPath(expression, data) {
|
|
@@ -868,7 +945,7 @@ function resolveTextData(element, data) {
|
|
|
868
945
|
// src/plugins/text/native.ts
|
|
869
946
|
var textNativePlugin = defineNativePlugin(
|
|
870
947
|
"text",
|
|
871
|
-
"0.1.
|
|
948
|
+
"0.1.38",
|
|
872
949
|
printDesign.definePrintDesignPluginRenderer({
|
|
873
950
|
type: "text",
|
|
874
951
|
dataFields: textDataFields,
|
|
@@ -891,6 +968,268 @@ var textNativePlugin = defineNativePlugin(
|
|
|
891
968
|
inlineTextEditor: textInlineEditor
|
|
892
969
|
})
|
|
893
970
|
);
|
|
971
|
+
|
|
972
|
+
// src/plugins/rich-text/model.ts
|
|
973
|
+
function validateRichTextElement(value) {
|
|
974
|
+
if (!value || typeof value !== "object") return false;
|
|
975
|
+
const element = value;
|
|
976
|
+
return element.type === "richText" && (element.dataConfig === void 0 || element.dataConfig.mode === "static") && Array.isArray(element.runs) && element.runs.length <= 2e3 && element.runs.reduce(
|
|
977
|
+
(length, run) => length + (typeof run?.text === "string" ? run.text.length : 0),
|
|
978
|
+
0
|
|
979
|
+
) <= 1e5 && element.runs.every(
|
|
980
|
+
(run) => run && typeof run.text === "string" && run.text.length > 0 && Object.keys(run).every((key) => key === "text" || key === "style") && (run.style === void 0 || run.style && typeof run.style === "object" && !Array.isArray(run.style) && Object.keys(run.style).every(
|
|
981
|
+
(key) => ["fontFamily", "fontSize", "fontWeight", "fontStyle", "color"].includes(key)
|
|
982
|
+
) && (run.style.fontFamily === void 0 || typeof run.style.fontFamily === "string" && run.style.fontFamily.length <= 200 && /^[\p{L}\p{N}_\s,'"-]+$/u.test(run.style.fontFamily)) && (run.style.fontSize === void 0 || Number.isFinite(run.style.fontSize) && run.style.fontSize > 0 && run.style.fontSize <= 240) && (run.style.fontWeight === void 0 || typeof run.style.fontWeight === "string" && /^(?:[1-9]00|normal|bold)$/.test(run.style.fontWeight)) && (run.style.fontStyle === void 0 || ["normal", "italic"].includes(run.style.fontStyle)) && (run.style.color === void 0 || typeof run.style.color === "string" && /^#[0-9a-fA-F]{3,8}$/.test(run.style.color)))
|
|
983
|
+
) && (element.fontSize === void 0 || Number.isFinite(element.fontSize) && element.fontSize > 0 && element.fontSize <= 240) && (element.fontFamily === void 0 || typeof element.fontFamily === "string" && element.fontFamily.length <= 200 && /^[\p{L}\p{N}_\s,'"-]+$/u.test(element.fontFamily)) && (element.fontWeight === void 0 || typeof element.fontWeight === "string" && /^(?:[1-9]00|normal|bold)$/.test(element.fontWeight)) && (element.fontStyle === void 0 || ["normal", "italic"].includes(element.fontStyle)) && (element.color === void 0 || typeof element.color === "string" && /^#[0-9a-fA-F]{3,8}$/.test(element.color)) && (element.textAlign === void 0 || ["left", "center", "right"].includes(element.textAlign)) && (element.verticalAlign === void 0 || ["top", "middle", "bottom"].includes(element.verticalAlign)) && (element.lineHeight === void 0 || Number.isFinite(element.lineHeight) && element.lineHeight >= 0.5 && element.lineHeight <= 4) && (element.indentMode === void 0 || ["none", "firstLine", "hanging"].includes(element.indentMode)) && (element.indentValue === void 0 || Number.isFinite(element.indentValue) && element.indentValue >= 0) && (element.indentUnit === void 0 || ["char", "mm", "cm", "in", "pt", "px"].includes(element.indentUnit)) && (element.prewrapped === void 0 || typeof element.prewrapped === "boolean") && (element.prewrappedIndents === void 0 || Array.isArray(element.prewrappedIndents) && element.prewrappedIndents.every(
|
|
984
|
+
(indent) => Number.isFinite(indent) && indent >= 0
|
|
985
|
+
));
|
|
986
|
+
}
|
|
987
|
+
function richTextIndentMm(element) {
|
|
988
|
+
if (!element.indentMode || element.indentMode === "none") return 0;
|
|
989
|
+
const value = Math.max(0, element.indentValue ?? 0);
|
|
990
|
+
return element.indentUnit === "char" || !element.indentUnit ? value * (element.fontSize ?? 14) * 25.4 / 72 : printDesign.fromDisplayUnit(value, element.indentUnit);
|
|
991
|
+
}
|
|
992
|
+
function richTextGraphemes(text) {
|
|
993
|
+
const Segmenter = Intl.Segmenter;
|
|
994
|
+
return Segmenter ? Array.from(
|
|
995
|
+
new Segmenter(void 0, { granularity: "grapheme" }).segment(text),
|
|
996
|
+
(part) => part.segment
|
|
997
|
+
) : Array.from(text);
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
// src/plugins/rich-text/rendering.ts
|
|
1001
|
+
function runStyle(element, run) {
|
|
1002
|
+
return {
|
|
1003
|
+
fontFamily: printDesign.resolvePrintDesignFontFamily(
|
|
1004
|
+
run.style?.fontFamily ?? element.fontFamily
|
|
1005
|
+
),
|
|
1006
|
+
fontSize: run.style?.fontSize ?? element.fontSize ?? 14,
|
|
1007
|
+
fontWeight: run.style?.fontWeight ?? element.fontWeight ?? "400",
|
|
1008
|
+
fontStyle: run.style?.fontStyle ?? element.fontStyle ?? "normal",
|
|
1009
|
+
color: run.style?.color ?? element.color ?? "#1f2937"
|
|
1010
|
+
};
|
|
1011
|
+
}
|
|
1012
|
+
function layoutRichTextLines(element, width, scale, measure) {
|
|
1013
|
+
const indent = richTextIndentMm(element) * scale;
|
|
1014
|
+
const lineHeight = element.lineHeight ?? 1.35;
|
|
1015
|
+
const lines = [];
|
|
1016
|
+
let paragraphLine = 0;
|
|
1017
|
+
const addLine = () => {
|
|
1018
|
+
const inset = element.prewrapped ? (element.prewrappedIndents?.[lines.length] ?? 0) * scale : element.indentMode === "firstLine" && paragraphLine === 0 || element.indentMode === "hanging" && paragraphLine > 0 ? indent : 0;
|
|
1019
|
+
lines.push({
|
|
1020
|
+
chars: [],
|
|
1021
|
+
width: 0,
|
|
1022
|
+
indent: inset,
|
|
1023
|
+
height: (element.fontSize ?? 14) * 25.4 / 72 * scale * lineHeight
|
|
1024
|
+
});
|
|
1025
|
+
};
|
|
1026
|
+
addLine();
|
|
1027
|
+
for (const run of element.runs) {
|
|
1028
|
+
const style = runStyle(element, run);
|
|
1029
|
+
const fontSize = style.fontSize * 25.4 / 72 * scale;
|
|
1030
|
+
for (const char of richTextGraphemes(run.text.replace(/\r\n?/g, "\n"))) {
|
|
1031
|
+
if (char === "\n") {
|
|
1032
|
+
paragraphLine = 0;
|
|
1033
|
+
addLine();
|
|
1034
|
+
continue;
|
|
1035
|
+
}
|
|
1036
|
+
const charWidth = measure(char, style, fontSize);
|
|
1037
|
+
let line = lines[lines.length - 1];
|
|
1038
|
+
if (!element.prewrapped && line.chars.length && line.width + charWidth > Math.max(1, width - line.indent)) {
|
|
1039
|
+
paragraphLine++;
|
|
1040
|
+
addLine();
|
|
1041
|
+
line = lines[lines.length - 1];
|
|
1042
|
+
}
|
|
1043
|
+
line.chars.push({ text: char, width: charWidth, style });
|
|
1044
|
+
line.width += charWidth;
|
|
1045
|
+
line.height = Math.max(line.height, fontSize * lineHeight);
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
return lines;
|
|
1049
|
+
}
|
|
1050
|
+
function drawRichTextElement(element, { ctx, scale, x, y, width, height }) {
|
|
1051
|
+
const lineHeight = element.lineHeight ?? 1.35;
|
|
1052
|
+
const lines = layoutRichTextLines(
|
|
1053
|
+
element,
|
|
1054
|
+
width,
|
|
1055
|
+
scale,
|
|
1056
|
+
(char, style, fontSize) => {
|
|
1057
|
+
ctx.font = `${style.fontStyle} ${style.fontWeight} ${fontSize}px ${style.fontFamily}`;
|
|
1058
|
+
return ctx.measureText(char).width;
|
|
1059
|
+
}
|
|
1060
|
+
);
|
|
1061
|
+
const totalHeight = lines.reduce((sum, line) => sum + line.height, 0);
|
|
1062
|
+
let top = y + (element.verticalAlign === "middle" ? Math.max(0, (height - totalHeight) / 2) : element.verticalAlign === "bottom" ? Math.max(0, height - totalHeight) : 0);
|
|
1063
|
+
ctx.save();
|
|
1064
|
+
ctx.beginPath();
|
|
1065
|
+
ctx.rect(x, y, width, height);
|
|
1066
|
+
ctx.clip();
|
|
1067
|
+
ctx.textAlign = "left";
|
|
1068
|
+
ctx.textBaseline = "alphabetic";
|
|
1069
|
+
for (const line of lines) {
|
|
1070
|
+
let left = x + line.indent;
|
|
1071
|
+
const available = Math.max(0, width - line.indent);
|
|
1072
|
+
if (element.textAlign === "center") left += (available - line.width) / 2;
|
|
1073
|
+
if (element.textAlign === "right") left += available - line.width;
|
|
1074
|
+
for (const char of line.chars) {
|
|
1075
|
+
const fontSize = char.style.fontSize * 25.4 / 72 * scale;
|
|
1076
|
+
ctx.font = `${char.style.fontStyle} ${char.style.fontWeight} ${fontSize}px ${char.style.fontFamily}`;
|
|
1077
|
+
ctx.fillStyle = char.style.color;
|
|
1078
|
+
ctx.fillText(
|
|
1079
|
+
char.text,
|
|
1080
|
+
left,
|
|
1081
|
+
top + (line.height - fontSize * lineHeight) / 2 + fontSize
|
|
1082
|
+
);
|
|
1083
|
+
left += char.width;
|
|
1084
|
+
}
|
|
1085
|
+
top += line.height;
|
|
1086
|
+
}
|
|
1087
|
+
ctx.restore();
|
|
1088
|
+
}
|
|
1089
|
+
function renderRichTextHtml(element) {
|
|
1090
|
+
const baseSize = printDesign.cssNumber(element.fontSize, 14);
|
|
1091
|
+
const indent = richTextIndentMm(element);
|
|
1092
|
+
const paragraphs = [""];
|
|
1093
|
+
for (const run of element.runs) {
|
|
1094
|
+
const style = runStyle(element, run);
|
|
1095
|
+
const css = `font-family:${printDesign.escapeHtml(printDesign.cssFont(style.fontFamily))};font-size:${printDesign.cssNumber(style.fontSize, baseSize)}pt;font-weight:${printDesign.escapeHtml(style.fontWeight)};font-style:${style.fontStyle};color:${printDesign.cssColor(style.color, "#1f2937")}`;
|
|
1096
|
+
const chunks = run.text.replace(/\r\n?/g, "\n").split("\n");
|
|
1097
|
+
chunks.forEach((chunk, index) => {
|
|
1098
|
+
if (index) paragraphs.push("");
|
|
1099
|
+
paragraphs[paragraphs.length - 1] += `<span style="${css}">${printDesign.escapeHtml(chunk)}</span>`;
|
|
1100
|
+
});
|
|
1101
|
+
}
|
|
1102
|
+
const paragraphCss = element.indentMode === "firstLine" && indent > 0 ? `text-indent:${printDesign.cssNumber(indent, 0)}mm;` : element.indentMode === "hanging" && indent > 0 ? `padding-left:${printDesign.cssNumber(indent, 0)}mm;text-indent:-${printDesign.cssNumber(indent, 0)}mm;box-sizing:border-box;` : "";
|
|
1103
|
+
const body = paragraphs.map(
|
|
1104
|
+
(paragraph, index) => `<div style="${element.prewrapped ? `white-space:pre;overflow:hidden;flex:none;box-sizing:border-box;padding-left:${printDesign.cssNumber(element.prewrappedIndents?.[index], 0)}mm;` : paragraphCss}">${paragraph || "<br>"}</div>`
|
|
1105
|
+
).join("");
|
|
1106
|
+
return printDesign.renderPrintDesignHtmlFrame(
|
|
1107
|
+
element,
|
|
1108
|
+
`<div style="width:100%;height:100%;overflow:hidden;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-all;text-spacing-trim:space-all;text-autospace:no-autospace;line-height:${printDesign.cssNumber(element.lineHeight, 1.35)};font-family:${printDesign.escapeHtml(printDesign.cssFont(element.fontFamily))};font-size:${baseSize}pt;font-weight:${printDesign.escapeHtml(element.fontWeight ?? "400")};font-style:${element.fontStyle ?? "normal"};color:${printDesign.cssColor(element.color, "#1f2937")};text-align:${element.textAlign ?? "left"};display:flex;flex-direction:column;justify-content:${element.verticalAlign === "middle" ? "center" : element.verticalAlign === "bottom" ? "flex-end" : "flex-start"}">${body}</div>`
|
|
1109
|
+
);
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
// src/plugins/rich-text/pagination.ts
|
|
1113
|
+
function measureLines(element) {
|
|
1114
|
+
const canvas = typeof document !== "undefined" ? document.createElement("canvas") : null;
|
|
1115
|
+
const context = canvas?.getContext("2d");
|
|
1116
|
+
return layoutRichTextLines(element, element.width, 1, (text, style, size) => {
|
|
1117
|
+
if (context) {
|
|
1118
|
+
context.font = `${style.fontStyle} ${style.fontWeight} ${size}px ${style.fontFamily}`;
|
|
1119
|
+
return context.measureText(text).width;
|
|
1120
|
+
}
|
|
1121
|
+
return size * (/[^\p{ASCII}]/u.test(text) ? 1 : 0.55);
|
|
1122
|
+
});
|
|
1123
|
+
}
|
|
1124
|
+
function linesToRuns(lines) {
|
|
1125
|
+
const result = [];
|
|
1126
|
+
for (const [index, line] of lines.entries()) {
|
|
1127
|
+
if (index) result.push({ text: "\n" });
|
|
1128
|
+
for (const char of line.chars) {
|
|
1129
|
+
const previous = result[result.length - 1];
|
|
1130
|
+
const style = char.style;
|
|
1131
|
+
if (previous && JSON.stringify(previous.style) === JSON.stringify(style))
|
|
1132
|
+
previous.text += char.text;
|
|
1133
|
+
else result.push({ text: char.text, style });
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
return result;
|
|
1137
|
+
}
|
|
1138
|
+
function truncateRichTextOverflow(element, height, mode) {
|
|
1139
|
+
const lines = measureLines(element);
|
|
1140
|
+
const visible = [];
|
|
1141
|
+
let used = 0;
|
|
1142
|
+
for (const line of lines) {
|
|
1143
|
+
if (visible.length && used + line.height > height) break;
|
|
1144
|
+
visible.push({ ...line, chars: [...line.chars] });
|
|
1145
|
+
used += line.height;
|
|
1146
|
+
}
|
|
1147
|
+
if (mode === "ellipsis" && visible.length < lines.length && visible.length) {
|
|
1148
|
+
const last = visible[visible.length - 1];
|
|
1149
|
+
const style = last.chars[last.chars.length - 1]?.style ?? {
|
|
1150
|
+
fontFamily: element.fontFamily ?? "Arial, sans-serif",
|
|
1151
|
+
fontSize: element.fontSize ?? 14,
|
|
1152
|
+
fontWeight: element.fontWeight ?? "400",
|
|
1153
|
+
fontStyle: element.fontStyle ?? "normal",
|
|
1154
|
+
color: element.color ?? "#1f2937"
|
|
1155
|
+
};
|
|
1156
|
+
const ellipsisWidth = style.fontSize * 25.4 / 72;
|
|
1157
|
+
while (last.chars.length && last.width + ellipsisWidth > element.width - last.indent) {
|
|
1158
|
+
last.width -= last.chars.pop().width;
|
|
1159
|
+
}
|
|
1160
|
+
last.chars.push({ text: "\u2026", style, width: ellipsisWidth });
|
|
1161
|
+
last.width += ellipsisWidth;
|
|
1162
|
+
}
|
|
1163
|
+
return {
|
|
1164
|
+
...element,
|
|
1165
|
+
runs: linesToRuns(visible),
|
|
1166
|
+
prewrapped: true,
|
|
1167
|
+
prewrappedIndents: visible.map((line) => line.indent),
|
|
1168
|
+
verticalAlign: "top"
|
|
1169
|
+
};
|
|
1170
|
+
}
|
|
1171
|
+
function paginateRichText(element, context) {
|
|
1172
|
+
const lines = measureLines(element);
|
|
1173
|
+
let pageIndex = context.startPage;
|
|
1174
|
+
let y = context.startY;
|
|
1175
|
+
let offset = 0;
|
|
1176
|
+
do {
|
|
1177
|
+
const remaining = () => context.bottom - y;
|
|
1178
|
+
if (remaining() < (lines[offset]?.height ?? 0) && y > context.top) {
|
|
1179
|
+
pageIndex++;
|
|
1180
|
+
y = context.top;
|
|
1181
|
+
}
|
|
1182
|
+
const chunk = [];
|
|
1183
|
+
let height = 0;
|
|
1184
|
+
while (offset < lines.length && (!chunk.length || height + lines[offset].height <= remaining())) {
|
|
1185
|
+
chunk.push(lines[offset]);
|
|
1186
|
+
height += lines[offset].height;
|
|
1187
|
+
offset++;
|
|
1188
|
+
}
|
|
1189
|
+
const continues = offset < lines.length;
|
|
1190
|
+
const finalHeight = continues ? Math.max(0, remaining()) : Math.max(height, element.height);
|
|
1191
|
+
context.pageAt(pageIndex).elements.push({
|
|
1192
|
+
...element,
|
|
1193
|
+
id: `${element.id}:flow:${pageIndex}`,
|
|
1194
|
+
previewSourceId: element.previewSourceId ?? element.id,
|
|
1195
|
+
y,
|
|
1196
|
+
height: Math.min(Math.max(0, remaining()), finalHeight),
|
|
1197
|
+
runs: linesToRuns(chunk),
|
|
1198
|
+
prewrapped: true,
|
|
1199
|
+
prewrappedIndents: chunk.map((line) => line.indent),
|
|
1200
|
+
verticalAlign: "top"
|
|
1201
|
+
});
|
|
1202
|
+
y += Math.min(Math.max(0, remaining()), finalHeight);
|
|
1203
|
+
if (continues) {
|
|
1204
|
+
pageIndex++;
|
|
1205
|
+
y = context.top;
|
|
1206
|
+
}
|
|
1207
|
+
} while (offset < lines.length);
|
|
1208
|
+
return {
|
|
1209
|
+
logicalEnd: pageIndex * (context.bottom - context.top) + (y - context.top)
|
|
1210
|
+
};
|
|
1211
|
+
}
|
|
1212
|
+
function measureRichTextFlowHeight(element) {
|
|
1213
|
+
return Math.max(
|
|
1214
|
+
element.height,
|
|
1215
|
+
measureLines(element).reduce((height, line) => height + line.height, 0)
|
|
1216
|
+
);
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
// src/plugins/rich-text/native.ts
|
|
1220
|
+
var richTextNativePlugin = defineNativePlugin(
|
|
1221
|
+
"richText",
|
|
1222
|
+
"0.1.1",
|
|
1223
|
+
printDesign.definePrintDesignPluginRenderer({
|
|
1224
|
+
type: "richText",
|
|
1225
|
+
validate: validateRichTextElement,
|
|
1226
|
+
drawCanvas: drawRichTextElement,
|
|
1227
|
+
renderHtml: (element) => renderRichTextHtml(element),
|
|
1228
|
+
paginate: paginateRichText,
|
|
1229
|
+
measureFlowHeight: measureRichTextFlowHeight,
|
|
1230
|
+
truncateOverflow: truncateRichTextOverflow
|
|
1231
|
+
})
|
|
1232
|
+
);
|
|
894
1233
|
var drawListElement = (element, context) => {
|
|
895
1234
|
const { ctx, x, y, width, height, scale, data } = context;
|
|
896
1235
|
const row = Math.max(1, element.rowHeight ?? 8) * scale;
|
|
@@ -991,8 +1330,8 @@ function itemPaths(text) {
|
|
|
991
1330
|
return [...text.matchAll(LIST_EXPRESSION)].map((match) => match[1]);
|
|
992
1331
|
}
|
|
993
1332
|
function listBindingInfo(element) {
|
|
994
|
-
const
|
|
995
|
-
return { bound:
|
|
1333
|
+
const paths2 = [...new Set(element.items.flatMap((item) => itemPaths(item.text)))];
|
|
1334
|
+
return { bound: paths2.length > 0, paths: paths2 };
|
|
996
1335
|
}
|
|
997
1336
|
function validateListTemplateData(element, data) {
|
|
998
1337
|
if (!data) return [];
|
|
@@ -1003,13 +1342,45 @@ function validateListTemplateData(element, data) {
|
|
|
1003
1342
|
);
|
|
1004
1343
|
}
|
|
1005
1344
|
|
|
1345
|
+
// src/plugins/list/interaction/commands.ts
|
|
1346
|
+
var listCommands = {
|
|
1347
|
+
execute(element, command, payload) {
|
|
1348
|
+
if (element.locked || !payload || typeof payload !== "object") return;
|
|
1349
|
+
const args = payload;
|
|
1350
|
+
const index = args.index;
|
|
1351
|
+
if (!Number.isInteger(index)) return;
|
|
1352
|
+
const at = index;
|
|
1353
|
+
const items = [...element.items];
|
|
1354
|
+
if (command === "remove-item") {
|
|
1355
|
+
if (at < 0 || at >= items.length) return;
|
|
1356
|
+
items.splice(at, 1);
|
|
1357
|
+
} else if (command === "insert-item") {
|
|
1358
|
+
if (at < 0 || at > items.length || typeof args.text !== "string") return;
|
|
1359
|
+
items.splice(at, 0, { text: args.text, checked: false });
|
|
1360
|
+
} else if (command === "update-item") {
|
|
1361
|
+
if (at < 0 || at >= items.length) return;
|
|
1362
|
+
if (args.text !== void 0 && typeof args.text !== "string") return;
|
|
1363
|
+
if (args.checked !== void 0 && typeof args.checked !== "boolean")
|
|
1364
|
+
return;
|
|
1365
|
+
items[at] = {
|
|
1366
|
+
...items[at],
|
|
1367
|
+
...args.text === void 0 ? {} : { text: args.text },
|
|
1368
|
+
...args.checked === void 0 ? {} : { checked: args.checked }
|
|
1369
|
+
};
|
|
1370
|
+
} else return;
|
|
1371
|
+
const next = { ...element, items };
|
|
1372
|
+
return validateListElement(next) ? next : void 0;
|
|
1373
|
+
}
|
|
1374
|
+
};
|
|
1375
|
+
|
|
1006
1376
|
// src/plugins/list/native.ts
|
|
1007
1377
|
var listNativePlugin = defineNativePlugin(
|
|
1008
1378
|
"list",
|
|
1009
|
-
"0.1.
|
|
1379
|
+
"0.1.9",
|
|
1010
1380
|
printDesign.definePrintDesignPluginRenderer({
|
|
1011
1381
|
type: "list",
|
|
1012
1382
|
validate: validateListElement,
|
|
1383
|
+
commands: listCommands,
|
|
1013
1384
|
bindingInfo: listBindingInfo,
|
|
1014
1385
|
validateTemplateData: validateListTemplateData,
|
|
1015
1386
|
drawCanvas: drawListElement,
|
|
@@ -1075,9 +1446,9 @@ function dateTimeBindingInfo(element) {
|
|
|
1075
1446
|
}
|
|
1076
1447
|
function validateDateTimeTemplateData(element, data) {
|
|
1077
1448
|
if (!data) return [];
|
|
1078
|
-
const { bound, paths } = dateTimeBindingInfo(element);
|
|
1449
|
+
const { bound, paths: paths2 } = dateTimeBindingInfo(element);
|
|
1079
1450
|
if (!bound) return [];
|
|
1080
|
-
const expression =
|
|
1451
|
+
const expression = paths2[0];
|
|
1081
1452
|
if (!expression) return ["\u672A\u914D\u7F6E\u65E5\u671F\u65F6\u95F4\u7ED1\u5B9A\u5B57\u6BB5"];
|
|
1082
1453
|
const value = printDesign.resolvePrintDesignBinding(data, expression);
|
|
1083
1454
|
const text = typeof value === "string" || typeof value === "number" || typeof value === "boolean" ? String(value).trim() : "";
|
|
@@ -1204,9 +1575,9 @@ function moneyUpperBindingInfo(element) {
|
|
|
1204
1575
|
}
|
|
1205
1576
|
function validateMoneyUpperTemplateData(element, data) {
|
|
1206
1577
|
if (!data) return [];
|
|
1207
|
-
const { bound, paths } = moneyUpperBindingInfo(element);
|
|
1578
|
+
const { bound, paths: paths2 } = moneyUpperBindingInfo(element);
|
|
1208
1579
|
if (!bound) return [];
|
|
1209
|
-
const expression =
|
|
1580
|
+
const expression = paths2[0];
|
|
1210
1581
|
if (!expression) return ["\u672A\u914D\u7F6E\u91D1\u989D\u7ED1\u5B9A\u5B57\u6BB5"];
|
|
1211
1582
|
const value = printDesign.resolvePrintDesignBinding(data, expression);
|
|
1212
1583
|
const numeric2 = typeof value === "number" || typeof value === "string" && value.trim() !== "" ? Number(value) : NaN;
|
|
@@ -1286,9 +1657,9 @@ function pageNumberBindingInfo(element) {
|
|
|
1286
1657
|
}
|
|
1287
1658
|
function validatePageNumberTemplateData(element, data) {
|
|
1288
1659
|
if (!data) return [];
|
|
1289
|
-
const { bound, paths } = pageNumberBindingInfo(element);
|
|
1660
|
+
const { bound, paths: paths2 } = pageNumberBindingInfo(element);
|
|
1290
1661
|
if (!bound) return [];
|
|
1291
|
-
const expression =
|
|
1662
|
+
const expression = paths2[0];
|
|
1292
1663
|
if (!expression) return ["\u672A\u914D\u7F6E\u9875\u7801\u524D\u7F00\u7ED1\u5B9A\u5B57\u6BB5"];
|
|
1293
1664
|
const value = printDesign.resolvePrintDesignBinding(data, expression);
|
|
1294
1665
|
return typeof value === "string" && value.trim() !== "" || typeof value === "number" || typeof value === "boolean" ? [] : [`\u7684\u9875\u7801\u524D\u7F00\u5B57\u6BB5\u300C${expression}\u300D\u5728\u5F53\u524D\u6570\u636E\u4E2D\u4E0D\u5B58\u5728`];
|
|
@@ -1390,23 +1761,18 @@ function renderWatermarkHtml(element, data, preciseClip = false) {
|
|
|
1390
1761
|
const text = printDesign.escapeHtml(
|
|
1391
1762
|
element.dataConfig ? element.text : printDesign.resolveDesignText(element.text, data)
|
|
1392
1763
|
);
|
|
1393
|
-
if (!preciseClip) {
|
|
1394
|
-
const fontSize2 = printDesign.cssNumber(element.fontSize, 24);
|
|
1395
|
-
const cell = `<span style="color:${printDesign.cssColor(element.color, "#94a3b8")};font-size:${fontSize2}pt;transform:rotate(${printDesign.cssNumber(element.textRotation, 45)}deg) translateY(-${fontSize2 * DEFAULT_TEXT_BASELINE_CORRECTION_RATIO}pt)">${text}</span>`;
|
|
1396
|
-
const content2 = `<div class="pd-watermark" style="grid-template-columns:repeat(${columns},1fr);grid-template-rows:repeat(${rows},1fr)">${cell.repeat(rows * columns)}</div>`;
|
|
1397
|
-
return printDesign.renderPrintDesignHtmlFrame(element, content2);
|
|
1398
|
-
}
|
|
1399
1764
|
const width = Math.max(0, element.width);
|
|
1400
1765
|
const height = Math.max(0, element.height);
|
|
1401
1766
|
const fontSize = printDesign.cssNumber(element.fontSize, 24) * 25.4 / 72;
|
|
1402
1767
|
const color2 = printDesign.cssColor(element.color, "#94a3b8");
|
|
1403
1768
|
const rotation = printDesign.cssNumber(element.textRotation, 45);
|
|
1769
|
+
const baselineFactor = preciseClip ? 0.3 : 0.39;
|
|
1404
1770
|
const cells = Array.from({ length: rows * columns }, (_, index) => {
|
|
1405
1771
|
const centerX = (index % columns + 0.5) * (width / columns);
|
|
1406
1772
|
const centerY = (Math.floor(index / columns) + 0.5) * (height / rows);
|
|
1407
|
-
return `<text x="${centerX}" y="${centerY + fontSize *
|
|
1773
|
+
return `<text x="${centerX}" y="${centerY + fontSize * baselineFactor}" text-anchor="middle" transform="rotate(${rotation} ${centerX} ${centerY})">${text}</text>`;
|
|
1408
1774
|
}).join("");
|
|
1409
|
-
const content = `<svg class="pd-watermark" viewBox="0 0 ${width} ${height}" preserveAspectRatio="none" font-size="${fontSize}" font-family="${printDesign.escapeHtml(printDesign.PRINT_DESIGN_DEFAULT_FONT_FAMILY)}" fill="${color2}" style="display:block;width:100%;height:100%;overflow:hidden">${cells}</svg>`;
|
|
1775
|
+
const content = `<svg class="pd-watermark" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${width} ${height}" preserveAspectRatio="none" font-size="${fontSize}" font-family="${printDesign.escapeHtml(printDesign.PRINT_DESIGN_DEFAULT_FONT_FAMILY)}" fill="${color2}" style="display:block;width:100%;height:100%;overflow:hidden">${cells}</svg>`;
|
|
1410
1776
|
return printDesign.renderPrintDesignHtmlFrame(element, content);
|
|
1411
1777
|
}
|
|
1412
1778
|
|
|
@@ -1431,9 +1797,9 @@ function watermarkBindingInfo(element) {
|
|
|
1431
1797
|
}
|
|
1432
1798
|
function validateWatermarkTemplateData(element, data) {
|
|
1433
1799
|
if (!data) return [];
|
|
1434
|
-
const { bound, paths } = watermarkBindingInfo(element);
|
|
1800
|
+
const { bound, paths: paths2 } = watermarkBindingInfo(element);
|
|
1435
1801
|
if (!bound) return [];
|
|
1436
|
-
const expression =
|
|
1802
|
+
const expression = paths2[0];
|
|
1437
1803
|
if (!expression) return ["\u672A\u914D\u7F6E\u6C34\u5370\u6587\u5B57\u7ED1\u5B9A\u5B57\u6BB5"];
|
|
1438
1804
|
for (const match of expression.matchAll(
|
|
1439
1805
|
/\{\{\s*([\w.[\]-]+)(?:\|(?:date|dateSlash))?\s*\}\}/g
|
|
@@ -1448,7 +1814,7 @@ function validateWatermarkTemplateData(element, data) {
|
|
|
1448
1814
|
// src/plugins/watermark/native.ts
|
|
1449
1815
|
var watermarkNativePlugin = defineNativePlugin(
|
|
1450
1816
|
"watermark",
|
|
1451
|
-
"0.1.
|
|
1817
|
+
"0.1.10",
|
|
1452
1818
|
printDesign.definePrintDesignPluginRenderer({
|
|
1453
1819
|
type: "watermark",
|
|
1454
1820
|
validate: validateWatermarkElement,
|
|
@@ -1468,8 +1834,7 @@ var watermarkNativePlugin = defineNativePlugin(
|
|
|
1468
1834
|
physical && physical.y + physical.height > context.page.height
|
|
1469
1835
|
)
|
|
1470
1836
|
);
|
|
1471
|
-
}
|
|
1472
|
-
htmlCss: ".pd-watermark{display:grid;overflow:hidden;width:100%;height:100%}.pd-watermark span{display:flex;align-items:center;justify-content:center;white-space:nowrap}"
|
|
1837
|
+
}
|
|
1473
1838
|
}),
|
|
1474
1839
|
[{ id: "builtin.text", minVersion: "0.1.16" }]
|
|
1475
1840
|
);
|
|
@@ -2657,16 +3022,51 @@ function pointToSegmentDistance(point, a, b) {
|
|
|
2657
3022
|
return Math.hypot(point.x - a.x - t * dx, point.y - a.y - t * dy);
|
|
2658
3023
|
}
|
|
2659
3024
|
|
|
3025
|
+
// src/plugins/shape/interaction/commands.ts
|
|
3026
|
+
var validPoints = (value) => Array.isArray(value) && value.every(
|
|
3027
|
+
(point) => point && typeof point === "object" && Number.isFinite(point.x) && Number.isFinite(point.y)
|
|
3028
|
+
);
|
|
3029
|
+
var shapeCommands = {
|
|
3030
|
+
execute(element, command, payload) {
|
|
3031
|
+
if (element.locked || !payload || typeof payload !== "object") return;
|
|
3032
|
+
const args = payload;
|
|
3033
|
+
if (!validPoints(args.points)) return;
|
|
3034
|
+
const points = args.points;
|
|
3035
|
+
let next;
|
|
3036
|
+
if (command === "set-polygon-points") {
|
|
3037
|
+
if (!["triangle", "polygon", "star"].includes(element.shape) || points.length < 3)
|
|
3038
|
+
return;
|
|
3039
|
+
next = { ...element, polygonPoints: points };
|
|
3040
|
+
} else if (command === "set-curve-points") {
|
|
3041
|
+
if (!["curve-quadratic", "curve-cubic", "curve-multi"].includes(
|
|
3042
|
+
element.shape
|
|
3043
|
+
) || points.length < 2)
|
|
3044
|
+
return;
|
|
3045
|
+
next = { ...element, curvePoints: points };
|
|
3046
|
+
} else if (command === "set-path-points") {
|
|
3047
|
+
if (element.shape !== "curve-path") return;
|
|
3048
|
+
if (args.closed !== void 0 && typeof args.closed !== "boolean") return;
|
|
3049
|
+
next = {
|
|
3050
|
+
...element,
|
|
3051
|
+
pathPoints: points,
|
|
3052
|
+
...args.closed === void 0 ? {} : { pathClosed: args.closed }
|
|
3053
|
+
};
|
|
3054
|
+
} else return;
|
|
3055
|
+
return validateShapeElement(next) ? next : void 0;
|
|
3056
|
+
}
|
|
3057
|
+
};
|
|
3058
|
+
|
|
2660
3059
|
// src/plugins/shape/native.ts
|
|
2661
3060
|
var shapeNativePlugin = defineNativePlugin(
|
|
2662
3061
|
"shape",
|
|
2663
|
-
"0.1.
|
|
3062
|
+
"0.1.21",
|
|
2664
3063
|
printDesign.definePrintDesignPluginRenderer({
|
|
2665
3064
|
type: "shape",
|
|
2666
3065
|
dataFields: shapeDataFields,
|
|
2667
3066
|
bindingInfo: (element) => registeredFieldBindingInfo(element, shapeDataFields),
|
|
2668
3067
|
validateTemplateData: (element, data) => validateRegisteredFieldBindings(element, shapeDataFields, data),
|
|
2669
3068
|
validate: validateShapeElement,
|
|
3069
|
+
commands: shapeCommands,
|
|
2670
3070
|
drawCanvas: drawShapeElement,
|
|
2671
3071
|
renderHtml: (element, context) => renderShapeHtml(element, context.data),
|
|
2672
3072
|
hitTest: hitShape,
|
|
@@ -3008,13 +3408,42 @@ var brushPointerStroke = {
|
|
|
3008
3408
|
}
|
|
3009
3409
|
};
|
|
3010
3410
|
|
|
3411
|
+
// src/plugins/brush/interaction/commands.ts
|
|
3412
|
+
var brushCommands = {
|
|
3413
|
+
execute(element, command, payload) {
|
|
3414
|
+
if (element.locked || !payload || typeof payload !== "object") return;
|
|
3415
|
+
const args = payload;
|
|
3416
|
+
if (command === "append-stroke") {
|
|
3417
|
+
if (!Array.isArray(args.points) || args.points.length < 2) return;
|
|
3418
|
+
const next2 = {
|
|
3419
|
+
...element,
|
|
3420
|
+
strokes: [
|
|
3421
|
+
...element.strokes,
|
|
3422
|
+
args.points
|
|
3423
|
+
]
|
|
3424
|
+
};
|
|
3425
|
+
return validateBrushElement(next2) ? next2 : void 0;
|
|
3426
|
+
}
|
|
3427
|
+
if (command !== "remove-stroke" || !Number.isInteger(args.index)) return;
|
|
3428
|
+
const index = args.index;
|
|
3429
|
+
if (index < 0 || index >= element.strokes.length) return;
|
|
3430
|
+
const next = {
|
|
3431
|
+
...element,
|
|
3432
|
+
strokes: element.strokes.filter((_, at) => at !== index),
|
|
3433
|
+
strokeStyles: element.strokeStyles?.filter((_, at) => at !== index)
|
|
3434
|
+
};
|
|
3435
|
+
return validateBrushElement(next) ? next : void 0;
|
|
3436
|
+
}
|
|
3437
|
+
};
|
|
3438
|
+
|
|
3011
3439
|
// src/plugins/brush/native.ts
|
|
3012
3440
|
var brushNativePlugin = defineNativePlugin(
|
|
3013
3441
|
"brush",
|
|
3014
|
-
"0.1.
|
|
3442
|
+
"0.1.5",
|
|
3015
3443
|
printDesign.definePrintDesignPluginRenderer({
|
|
3016
3444
|
type: "brush",
|
|
3017
3445
|
validate: validateBrushElement,
|
|
3446
|
+
commands: brushCommands,
|
|
3018
3447
|
drawCanvas: drawBrushElement,
|
|
3019
3448
|
renderHtml: (element) => renderBrushHtml(element),
|
|
3020
3449
|
hitTest: hitBrush,
|
|
@@ -4010,6 +4439,46 @@ function validateConnectorElement(value) {
|
|
|
4010
4439
|
const validPoint = (point) => !!point && Number.isFinite(point.x) && Number.isFinite(point.y);
|
|
4011
4440
|
return element.type === "connector" && (element.lineType === void 0 || ["straight", "curve", "polyline"].includes(element.lineType)) && (element.polylinePoints === void 0 || Array.isArray(element.polylinePoints) && element.polylinePoints.every(validPoint)) && (element.strokeWidth === void 0 || Number.isFinite(element.strokeWidth) && element.strokeWidth >= 0) && (element.textPosition === void 0 || Number.isFinite(element.textPosition) && element.textPosition >= 0 && element.textPosition <= 1);
|
|
4012
4441
|
}
|
|
4442
|
+
|
|
4443
|
+
// src/plugins/connector/interaction/commands.ts
|
|
4444
|
+
var validEndpoint = (value) => {
|
|
4445
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
4446
|
+
const endpoint2 = value;
|
|
4447
|
+
return (endpoint2.elementId === void 0 || typeof endpoint2.elementId === "string") && (endpoint2.anchor === void 0 || typeof endpoint2.anchor === "string" && ([
|
|
4448
|
+
"auto",
|
|
4449
|
+
"top",
|
|
4450
|
+
"right",
|
|
4451
|
+
"bottom",
|
|
4452
|
+
"left",
|
|
4453
|
+
"top-left",
|
|
4454
|
+
"top-right",
|
|
4455
|
+
"bottom-right",
|
|
4456
|
+
"bottom-left"
|
|
4457
|
+
].includes(endpoint2.anchor) || /^(edge|vertex):\d+$/.test(endpoint2.anchor)));
|
|
4458
|
+
};
|
|
4459
|
+
var connectorCommands = {
|
|
4460
|
+
execute(element, command, payload) {
|
|
4461
|
+
if (element.locked || !payload || typeof payload !== "object") return;
|
|
4462
|
+
const args = payload;
|
|
4463
|
+
if (command === "set-endpoint") {
|
|
4464
|
+
if (args.side !== "start" && args.side !== "end") return;
|
|
4465
|
+
if (!validEndpoint(args.endpoint)) return;
|
|
4466
|
+
const next2 = { ...element, [args.side]: args.endpoint };
|
|
4467
|
+
return validateConnectorElement(next2) ? next2 : void 0;
|
|
4468
|
+
}
|
|
4469
|
+
if (command !== "set-waypoints" || element.lineType !== "polyline")
|
|
4470
|
+
return;
|
|
4471
|
+
if (!Array.isArray(args.points) || !args.points.every(
|
|
4472
|
+
(point) => point && typeof point === "object" && Number.isFinite(point.x) && Number.isFinite(point.y)
|
|
4473
|
+
))
|
|
4474
|
+
return;
|
|
4475
|
+
const next = {
|
|
4476
|
+
...element,
|
|
4477
|
+
polylinePoints: args.points
|
|
4478
|
+
};
|
|
4479
|
+
return validateConnectorElement(next) ? next : void 0;
|
|
4480
|
+
}
|
|
4481
|
+
};
|
|
4013
4482
|
var CONNECTOR_EXPRESSION = /\{\{\s*([\w.[\]-]+)(?:\|(?:date|dateSlash))?\s*\}\}/g;
|
|
4014
4483
|
function labelPaths(element) {
|
|
4015
4484
|
return [...(element.text ?? "").matchAll(CONNECTOR_EXPRESSION)].map(
|
|
@@ -4017,8 +4486,8 @@ function labelPaths(element) {
|
|
|
4017
4486
|
);
|
|
4018
4487
|
}
|
|
4019
4488
|
function connectorBindingInfo(element) {
|
|
4020
|
-
const
|
|
4021
|
-
return { bound:
|
|
4489
|
+
const paths2 = [...new Set(labelPaths(element))];
|
|
4490
|
+
return { bound: paths2.length > 0, paths: paths2 };
|
|
4022
4491
|
}
|
|
4023
4492
|
function validateConnectorTemplateData(element, data) {
|
|
4024
4493
|
if (!data) return [];
|
|
@@ -4030,10 +4499,11 @@ function validateConnectorTemplateData(element, data) {
|
|
|
4030
4499
|
// src/plugins/connector/native.ts
|
|
4031
4500
|
var connectorNativePlugin = defineNativePlugin(
|
|
4032
4501
|
"connector",
|
|
4033
|
-
"0.1.
|
|
4502
|
+
"0.1.32",
|
|
4034
4503
|
printDesign.definePrintDesignPluginRenderer({
|
|
4035
4504
|
type: "connector",
|
|
4036
4505
|
validate: validateConnectorElement,
|
|
4506
|
+
commands: connectorCommands,
|
|
4037
4507
|
bindingInfo: connectorBindingInfo,
|
|
4038
4508
|
validateTemplateData: validateConnectorTemplateData,
|
|
4039
4509
|
allowSignedSize: true,
|
|
@@ -4828,13 +5298,13 @@ function gridMarkup(element, data) {
|
|
|
4828
5298
|
|
|
4829
5299
|
// src/plugins/grid/data/binding.ts
|
|
4830
5300
|
function getGridBindingInfo(element) {
|
|
4831
|
-
const
|
|
5301
|
+
const paths2 = [
|
|
4832
5302
|
element.contentPath,
|
|
4833
5303
|
element.loopsPath,
|
|
4834
5304
|
element.columnLoopsPath,
|
|
4835
5305
|
...(element.cells ?? []).filter((cell) => cell.contentMode === "binding").map((cell) => cell.contentPath)
|
|
4836
5306
|
].map((path) => path?.trim()).filter((path) => !!path);
|
|
4837
|
-
return { bound:
|
|
5307
|
+
return { bound: paths2.length > 0, paths: paths2 };
|
|
4838
5308
|
}
|
|
4839
5309
|
function validateGridTemplateData(element, data) {
|
|
4840
5310
|
if (!data) return [];
|
|
@@ -4921,13 +5391,68 @@ function gridDebugRegions(element, context, hitElement = element) {
|
|
|
4921
5391
|
return [...cells, ...loops, ...columnLoops];
|
|
4922
5392
|
}
|
|
4923
5393
|
|
|
5394
|
+
// src/plugins/grid/interaction/commands.ts
|
|
5395
|
+
function executeGridCommand(element, command, payload, validate) {
|
|
5396
|
+
if (element.locked || !payload || typeof payload !== "object") return;
|
|
5397
|
+
const args = payload;
|
|
5398
|
+
if (command === "resize-grid") {
|
|
5399
|
+
const rows = args.rows;
|
|
5400
|
+
const columns = args.columns;
|
|
5401
|
+
if (!Number.isInteger(rows) || !Number.isInteger(columns)) return;
|
|
5402
|
+
if (rows < 1 || rows > 50 || columns < 1 || columns > 50)
|
|
5403
|
+
return;
|
|
5404
|
+
const cells2 = Array.from(
|
|
5405
|
+
{ length: rows * columns },
|
|
5406
|
+
(_, index2) => {
|
|
5407
|
+
const row = Math.floor(index2 / columns);
|
|
5408
|
+
const column = index2 % columns;
|
|
5409
|
+
return element.cells?.[row * element.columns + column] ?? {};
|
|
5410
|
+
}
|
|
5411
|
+
);
|
|
5412
|
+
const next2 = {
|
|
5413
|
+
...element,
|
|
5414
|
+
rows,
|
|
5415
|
+
columns,
|
|
5416
|
+
cells: cells2
|
|
5417
|
+
};
|
|
5418
|
+
return validate(next2) ? next2 : void 0;
|
|
5419
|
+
}
|
|
5420
|
+
if (command !== "set-cell") return;
|
|
5421
|
+
const rowIndex = args.rowIndex;
|
|
5422
|
+
const columnIndex = args.columnIndex;
|
|
5423
|
+
if (!Number.isInteger(rowIndex) || !Number.isInteger(columnIndex)) return;
|
|
5424
|
+
if (rowIndex < 0 || rowIndex >= element.rows || columnIndex < 0 || columnIndex >= element.columns)
|
|
5425
|
+
return;
|
|
5426
|
+
const cell = args.cell;
|
|
5427
|
+
if (!cell || typeof cell !== "object" || Array.isArray(cell)) return;
|
|
5428
|
+
const index = rowIndex * element.columns + columnIndex;
|
|
5429
|
+
const cells = Array.from(
|
|
5430
|
+
{ length: element.rows * element.columns },
|
|
5431
|
+
(_, at) => ({ ...element.cells?.[at] })
|
|
5432
|
+
);
|
|
5433
|
+
cells[index] = { ...cells[index], ...cell };
|
|
5434
|
+
const next = { ...element, cells };
|
|
5435
|
+
return validate(next) ? next : void 0;
|
|
5436
|
+
}
|
|
5437
|
+
var gridCommands = {
|
|
5438
|
+
execute(element, command, payload) {
|
|
5439
|
+
return executeGridCommand(
|
|
5440
|
+
element,
|
|
5441
|
+
command,
|
|
5442
|
+
payload,
|
|
5443
|
+
(value) => !!value && typeof value === "object" && value.type === "grid" && validateGridSettings(value)
|
|
5444
|
+
);
|
|
5445
|
+
}
|
|
5446
|
+
};
|
|
5447
|
+
|
|
4924
5448
|
// src/plugins/grid/native.ts
|
|
4925
5449
|
var gridNativePlugin = defineNativePlugin(
|
|
4926
5450
|
"grid",
|
|
4927
|
-
"0.1.
|
|
5451
|
+
"0.1.16",
|
|
4928
5452
|
printDesign.definePrintDesignPluginRenderer({
|
|
4929
5453
|
type: "grid",
|
|
4930
5454
|
validate: validateGridElement,
|
|
5455
|
+
commands: gridCommands,
|
|
4931
5456
|
validateTemplateData: validateGridTemplateData,
|
|
4932
5457
|
bindingInfo: getGridBindingInfo,
|
|
4933
5458
|
drawCanvas: drawGridElement,
|
|
@@ -5238,10 +5763,18 @@ function coordinateDebugRegions(element, context) {
|
|
|
5238
5763
|
// src/plugins/coordinate/native.ts
|
|
5239
5764
|
var coordinateNativePlugin = defineNativePlugin(
|
|
5240
5765
|
"coordinate",
|
|
5241
|
-
"0.1.
|
|
5766
|
+
"0.1.16",
|
|
5242
5767
|
printDesign.definePrintDesignPluginRenderer({
|
|
5243
5768
|
type: "coordinate",
|
|
5244
5769
|
validate: validateCoordinateElement,
|
|
5770
|
+
commands: {
|
|
5771
|
+
execute: (element, command, payload) => executeGridCommand(
|
|
5772
|
+
element,
|
|
5773
|
+
command,
|
|
5774
|
+
payload,
|
|
5775
|
+
validateCoordinateElement
|
|
5776
|
+
)
|
|
5777
|
+
},
|
|
5245
5778
|
validateTemplateData: validateGridTemplateData,
|
|
5246
5779
|
bindingInfo: getGridBindingInfo,
|
|
5247
5780
|
drawCanvas: drawCoordinateElement,
|
|
@@ -5738,17 +6271,48 @@ function validateFlowTemplateData(element, data) {
|
|
|
5738
6271
|
return [];
|
|
5739
6272
|
}
|
|
5740
6273
|
|
|
6274
|
+
// src/plugins/flow/interaction/commands.ts
|
|
6275
|
+
var flowCommands = {
|
|
6276
|
+
execute(element, command, payload) {
|
|
6277
|
+
if (element.locked || element.dataMode === "binding" || !payload || typeof payload !== "object")
|
|
6278
|
+
return;
|
|
6279
|
+
const args = payload;
|
|
6280
|
+
const index = args.index;
|
|
6281
|
+
if (!Number.isInteger(index)) return;
|
|
6282
|
+
const at = index;
|
|
6283
|
+
if (command === "remove-item") {
|
|
6284
|
+
if (at < 0 || at >= element.items.length) return;
|
|
6285
|
+
return { ...element, items: element.items.filter((_, i) => i !== at) };
|
|
6286
|
+
}
|
|
6287
|
+
const item = args.item;
|
|
6288
|
+
if (!item || typeof item !== "object" || Array.isArray(item)) return;
|
|
6289
|
+
const items = [...element.items];
|
|
6290
|
+
if (command === "insert-item") {
|
|
6291
|
+
if (at < 0 || at > items.length) return;
|
|
6292
|
+
items.splice(at, 0, item);
|
|
6293
|
+
} else if (command === "update-item") {
|
|
6294
|
+
if (at < 0 || at >= items.length) return;
|
|
6295
|
+
items[at] = { ...items[at], ...item };
|
|
6296
|
+
} else return;
|
|
6297
|
+
const next = { ...element, items };
|
|
6298
|
+
return validateFlowElement(next) ? next : void 0;
|
|
6299
|
+
}
|
|
6300
|
+
};
|
|
6301
|
+
|
|
5741
6302
|
// src/plugins/flow/native.ts
|
|
5742
6303
|
var flowNativePlugin = defineNativePlugin(
|
|
5743
6304
|
"flow",
|
|
5744
|
-
"0.1.
|
|
6305
|
+
"0.1.7",
|
|
5745
6306
|
printDesign.definePrintDesignPluginRenderer({
|
|
5746
6307
|
type: "flow",
|
|
5747
6308
|
validate: validateFlowElement,
|
|
6309
|
+
commands: flowCommands,
|
|
5748
6310
|
validateTemplateData: validateFlowTemplateData,
|
|
5749
6311
|
bindingInfo: (element) => ({
|
|
5750
6312
|
bound: (element.dataMode ?? element.dataConfig?.mode) === "binding",
|
|
5751
|
-
paths: (element.dataMode ?? element.dataConfig?.mode) === "binding" ? [
|
|
6313
|
+
paths: (element.dataMode ?? element.dataConfig?.mode) === "binding" ? [
|
|
6314
|
+
element.dataPath ?? element.dataConfig?.bindings?.items ?? ""
|
|
6315
|
+
].filter(Boolean) : []
|
|
5752
6316
|
}),
|
|
5753
6317
|
drawCanvas: drawFlowElement,
|
|
5754
6318
|
renderHtml: (element, context) => renderFlowHtml(element, context.data)
|
|
@@ -5988,9 +6552,9 @@ function clockBindingInfo(element) {
|
|
|
5988
6552
|
}
|
|
5989
6553
|
function validateClockTemplateData(element, data) {
|
|
5990
6554
|
if (!data) return [];
|
|
5991
|
-
const { bound, paths } = clockBindingInfo(element);
|
|
6555
|
+
const { bound, paths: paths2 } = clockBindingInfo(element);
|
|
5992
6556
|
if (!bound) return [];
|
|
5993
|
-
const expression =
|
|
6557
|
+
const expression = paths2[0];
|
|
5994
6558
|
if (!expression) return ["\u672A\u914D\u7F6E\u65F6\u949F\u65F6\u95F4\u7ED1\u5B9A\u5B57\u6BB5"];
|
|
5995
6559
|
for (const match of expression.matchAll(
|
|
5996
6560
|
/\{\{\s*([\w.[\]-]+)(?:\|(?:date|dateSlash))?\s*\}\}/g
|
|
@@ -6229,9 +6793,9 @@ function imageBindingInfo(element) {
|
|
|
6229
6793
|
}
|
|
6230
6794
|
function validateImageTemplateData(element, data) {
|
|
6231
6795
|
if (!data) return [];
|
|
6232
|
-
const { bound, paths } = imageBindingInfo(element);
|
|
6796
|
+
const { bound, paths: paths2 } = imageBindingInfo(element);
|
|
6233
6797
|
if (!bound) return [];
|
|
6234
|
-
const expression =
|
|
6798
|
+
const expression = paths2[0];
|
|
6235
6799
|
if (!expression) return ["\u672A\u914D\u7F6E\u56FE\u7247\u5730\u5740\u7ED1\u5B9A\u5B57\u6BB5"];
|
|
6236
6800
|
for (const match of expression.matchAll(
|
|
6237
6801
|
/\{\{\s*([\w.[\]-]+)(?:\|(?:date|dateSlash))?\s*\}\}/g
|
|
@@ -6464,6 +7028,19 @@ function fitImageToPage(image, page, current2) {
|
|
|
6464
7028
|
return { x, y, width, height };
|
|
6465
7029
|
}
|
|
6466
7030
|
|
|
7031
|
+
// src/plugins/image/interaction/commands.ts
|
|
7032
|
+
var imageCommands = {
|
|
7033
|
+
execute(element, command, payload) {
|
|
7034
|
+
if (element.locked) return;
|
|
7035
|
+
if (command === "clear-crop") return { ...element, crop: void 0 };
|
|
7036
|
+
if (command !== "set-crop" || !payload || typeof payload !== "object")
|
|
7037
|
+
return;
|
|
7038
|
+
const crop = payload;
|
|
7039
|
+
const next = { ...element, crop };
|
|
7040
|
+
return validateImageElement(next) ? next : void 0;
|
|
7041
|
+
}
|
|
7042
|
+
};
|
|
7043
|
+
|
|
6467
7044
|
// src/plugins/image/native.ts
|
|
6468
7045
|
var componentCropBehavior = {
|
|
6469
7046
|
source: (element) => element.src,
|
|
@@ -6484,7 +7061,7 @@ var componentCropBehavior = {
|
|
|
6484
7061
|
};
|
|
6485
7062
|
var imageNativePlugin = defineNativePlugin(
|
|
6486
7063
|
"image",
|
|
6487
|
-
"0.1.
|
|
7064
|
+
"0.1.17",
|
|
6488
7065
|
printDesign.definePrintDesignPluginRenderer({
|
|
6489
7066
|
type: "image",
|
|
6490
7067
|
dataFields: imageDataFields,
|
|
@@ -6493,6 +7070,7 @@ var imageNativePlugin = defineNativePlugin(
|
|
|
6493
7070
|
replaceResourceUri: (element, uri, replacement) => element.src === uri ? { ...element, src: replacement } : element,
|
|
6494
7071
|
validateTemplateData: validateImageTemplateData,
|
|
6495
7072
|
validate: validateImageElement,
|
|
7073
|
+
commands: imageCommands,
|
|
6496
7074
|
drawCanvas: drawImageElement,
|
|
6497
7075
|
prepareCanvas: (element, { signal }) => prepareImage(element.src, signal),
|
|
6498
7076
|
needsCanvasPreparation: (element) => Boolean(element.src && !getLoadedImageSize(element.src)),
|
|
@@ -6571,9 +7149,9 @@ function barcodeBindingInfo(element) {
|
|
|
6571
7149
|
}
|
|
6572
7150
|
function validateBarcodeTemplateData(element, data) {
|
|
6573
7151
|
if (!data) return [];
|
|
6574
|
-
const { bound, paths } = barcodeBindingInfo(element);
|
|
7152
|
+
const { bound, paths: paths2 } = barcodeBindingInfo(element);
|
|
6575
7153
|
if (!bound) return [];
|
|
6576
|
-
const expression =
|
|
7154
|
+
const expression = paths2[0];
|
|
6577
7155
|
if (!expression) return ["\u672A\u914D\u7F6E\u6761\u5F62\u7801\u5185\u5BB9\u7ED1\u5B9A\u5B57\u6BB5"];
|
|
6578
7156
|
for (const match of expression.matchAll(
|
|
6579
7157
|
/\{\{\s*([\w.[\]-]+)(?:\|(?:date|dateSlash))?\s*\}\}/g
|
|
@@ -6673,9 +7251,9 @@ function qrcodeBindingInfo(element) {
|
|
|
6673
7251
|
}
|
|
6674
7252
|
function validateQrCodeTemplateData(element, data) {
|
|
6675
7253
|
if (!data) return [];
|
|
6676
|
-
const { bound, paths } = qrcodeBindingInfo(element);
|
|
7254
|
+
const { bound, paths: paths2 } = qrcodeBindingInfo(element);
|
|
6677
7255
|
if (!bound) return [];
|
|
6678
|
-
const expression =
|
|
7256
|
+
const expression = paths2[0];
|
|
6679
7257
|
if (!expression) return ["\u672A\u914D\u7F6E\u4E8C\u7EF4\u7801\u5185\u5BB9\u7ED1\u5B9A\u5B57\u6BB5"];
|
|
6680
7258
|
for (const match of expression.matchAll(
|
|
6681
7259
|
/\{\{\s*([\w.[\]-]+)(?:\|(?:date|dateSlash))?\s*\}\}/g
|
|
@@ -6909,13 +7487,58 @@ function renderChartHtml(element, data) {
|
|
|
6909
7487
|
});
|
|
6910
7488
|
}
|
|
6911
7489
|
|
|
7490
|
+
// src/plugins/chart/interaction/commands.ts
|
|
7491
|
+
var chartCommands = {
|
|
7492
|
+
execute(element, command, payload) {
|
|
7493
|
+
if (element.locked || !payload || typeof payload !== "object") return;
|
|
7494
|
+
const args = payload;
|
|
7495
|
+
const chartData = readChartData(element);
|
|
7496
|
+
if (command === "set-categories") {
|
|
7497
|
+
if (!Array.isArray(args.categories) || !args.categories.every((item) => typeof item === "string"))
|
|
7498
|
+
return;
|
|
7499
|
+
const categories = args.categories;
|
|
7500
|
+
const next2 = {
|
|
7501
|
+
...element,
|
|
7502
|
+
chartData: {
|
|
7503
|
+
...chartData,
|
|
7504
|
+
categories,
|
|
7505
|
+
series: chartData.series.map((series2) => ({
|
|
7506
|
+
...series2,
|
|
7507
|
+
values: categories.map((_, index2) => series2.values[index2] ?? 0)
|
|
7508
|
+
}))
|
|
7509
|
+
}
|
|
7510
|
+
};
|
|
7511
|
+
return validateChartElement(next2) ? next2 : void 0;
|
|
7512
|
+
}
|
|
7513
|
+
if (command !== "set-series") return;
|
|
7514
|
+
const index = args.index;
|
|
7515
|
+
if (!Number.isInteger(index) || index < 0 || index > chartData.series.length)
|
|
7516
|
+
return;
|
|
7517
|
+
if (typeof args.name !== "string" || !Array.isArray(args.values) || args.values.length !== chartData.categories.length || !args.values.every(
|
|
7518
|
+
(value) => typeof value === "number" && Number.isFinite(value)
|
|
7519
|
+
))
|
|
7520
|
+
return;
|
|
7521
|
+
if (["pie", "gauge"].includes(element.chartType) && index > 0)
|
|
7522
|
+
return;
|
|
7523
|
+
const series = [...chartData.series];
|
|
7524
|
+
series[index] = {
|
|
7525
|
+
name: args.name,
|
|
7526
|
+
values: args.values,
|
|
7527
|
+
...typeof args.field === "string" ? { field: args.field } : {}
|
|
7528
|
+
};
|
|
7529
|
+
const next = { ...element, chartData: { ...chartData, series } };
|
|
7530
|
+
return validateChartElement(next) ? next : void 0;
|
|
7531
|
+
}
|
|
7532
|
+
};
|
|
7533
|
+
|
|
6912
7534
|
// src/plugins/chart/native.ts
|
|
6913
7535
|
var chartNativePlugin = defineNativePlugin(
|
|
6914
7536
|
"chart",
|
|
6915
|
-
"0.1.
|
|
7537
|
+
"0.1.9",
|
|
6916
7538
|
printDesign.definePrintDesignPluginRenderer({
|
|
6917
7539
|
type: "chart",
|
|
6918
7540
|
validate: validateChartElement,
|
|
7541
|
+
commands: chartCommands,
|
|
6919
7542
|
validateTemplateData: validateChartTemplateData,
|
|
6920
7543
|
bindingInfo: (element) => ({
|
|
6921
7544
|
bound: element.chartData?.mode === "binding",
|
|
@@ -7556,7 +8179,7 @@ function resolveDiagonalCount(count) {
|
|
|
7556
8179
|
function diagonalCellLayout(direction, count, corner) {
|
|
7557
8180
|
const lineCount = resolveDiagonalCount(count);
|
|
7558
8181
|
const activeCorner = lineCount === 1 ? direction === "down" ? "top-left" : "bottom-left" : corner ?? (direction === "down" ? "top-left" : "bottom-left");
|
|
7559
|
-
const
|
|
8182
|
+
const paths2 = {
|
|
7560
8183
|
"top-left": [
|
|
7561
8184
|
[0, 0],
|
|
7562
8185
|
[1, 0],
|
|
@@ -7582,7 +8205,7 @@ function diagonalCellLayout(direction, count, corner) {
|
|
|
7582
8205
|
[0, 1]
|
|
7583
8206
|
]
|
|
7584
8207
|
};
|
|
7585
|
-
const [apex, first, bend, last] =
|
|
8208
|
+
const [apex, first, bend, last] = paths2[activeCorner];
|
|
7586
8209
|
const farPoint = (position) => position <= 1 ? [
|
|
7587
8210
|
first[0] + (bend[0] - first[0]) * position,
|
|
7588
8211
|
first[1] + (bend[1] - first[1]) * position
|
|
@@ -9118,6 +9741,10 @@ function hitTableColumnBoundary(element, point, scale, includeSelector = false,
|
|
|
9118
9741
|
}
|
|
9119
9742
|
return nearest;
|
|
9120
9743
|
}
|
|
9744
|
+
function boundaryHitRadius(height, scale, selector) {
|
|
9745
|
+
const radius = 5 / scale;
|
|
9746
|
+
return selector || height * scale >= 12 ? radius : Math.min(radius, height / 4);
|
|
9747
|
+
}
|
|
9121
9748
|
function unmergedBoundarySegments(element, rowIndex, merges) {
|
|
9122
9749
|
if (!merges.length) return [{ x: element.x + 3, width: element.width - 6 }];
|
|
9123
9750
|
const columns = tableLeafColumns(
|
|
@@ -9159,11 +9786,25 @@ function tableHeaderResizeLayout(element, scale, data = {}) {
|
|
|
9159
9786
|
for (let index = 0; index < depth; index++) {
|
|
9160
9787
|
const edge = element.y + (index + 1) * height;
|
|
9161
9788
|
if (edge > visibleBottom + 1e-9) break;
|
|
9162
|
-
const shared = { rowIndex: index, edge, height
|
|
9163
|
-
|
|
9789
|
+
const shared = { rowIndex: index, edge, height };
|
|
9790
|
+
const selectorRadius = boundaryHitRadius(height, scale, true);
|
|
9791
|
+
regions.push({
|
|
9792
|
+
...shared,
|
|
9793
|
+
x: element.x - 6,
|
|
9794
|
+
width: 6,
|
|
9795
|
+
selector: true,
|
|
9796
|
+
radius: selectorRadius,
|
|
9797
|
+
y: edge - selectorRadius
|
|
9798
|
+
});
|
|
9164
9799
|
if (edge < visibleBottom - 1e-9 && element.width > 6)
|
|
9165
9800
|
for (const segment of unmergedBoundarySegments(element, index, headers))
|
|
9166
|
-
regions.push({
|
|
9801
|
+
regions.push({
|
|
9802
|
+
...shared,
|
|
9803
|
+
...segment,
|
|
9804
|
+
selector: false,
|
|
9805
|
+
radius: boundaryHitRadius(height, scale, false),
|
|
9806
|
+
y: edge - boundaryHitRadius(height, scale, false)
|
|
9807
|
+
});
|
|
9167
9808
|
}
|
|
9168
9809
|
return regions;
|
|
9169
9810
|
}
|
|
@@ -9178,7 +9819,7 @@ function hitTableHeaderBoundary(element, point, scale, data = {}) {
|
|
|
9178
9819
|
-(element.rotation ?? 0) * Math.PI / 180
|
|
9179
9820
|
);
|
|
9180
9821
|
const region = tableHeaderResizeLayout(element, scale, data).filter(
|
|
9181
|
-
(item) => local.x >= item.x && local.x < item.x + item.width && local.y
|
|
9822
|
+
(item) => local.x >= item.x && local.x < item.x + item.width && Math.abs(local.y - item.edge) <= item.radius
|
|
9182
9823
|
).sort((a, b) => Math.abs(local.y - a.edge) - Math.abs(local.y - b.edge))[0];
|
|
9183
9824
|
return region && {
|
|
9184
9825
|
elementId: element.id,
|
|
@@ -9210,13 +9851,26 @@ function tableRowResizeLayout(element, scale, data = {}) {
|
|
|
9210
9851
|
const shared = {
|
|
9211
9852
|
rowIndex: index + (element.sourceRowOffset ?? 0),
|
|
9212
9853
|
edge: boundary,
|
|
9213
|
-
height
|
|
9214
|
-
y: boundary - 5 / scale
|
|
9854
|
+
height
|
|
9215
9855
|
};
|
|
9216
|
-
|
|
9856
|
+
const selectorRadius = boundaryHitRadius(height, scale, true);
|
|
9857
|
+
regions.push({
|
|
9858
|
+
...shared,
|
|
9859
|
+
x: element.x - 6,
|
|
9860
|
+
width: 6,
|
|
9861
|
+
selector: true,
|
|
9862
|
+
radius: selectorRadius,
|
|
9863
|
+
y: boundary - selectorRadius
|
|
9864
|
+
});
|
|
9217
9865
|
if (index < heights.length - 1 && element.width > 6)
|
|
9218
9866
|
for (const segment of unmergedBoundarySegments(element, index, cells))
|
|
9219
|
-
regions.push({
|
|
9867
|
+
regions.push({
|
|
9868
|
+
...shared,
|
|
9869
|
+
...segment,
|
|
9870
|
+
selector: false,
|
|
9871
|
+
radius: boundaryHitRadius(height, scale, false),
|
|
9872
|
+
y: boundary - boundaryHitRadius(height, scale, false)
|
|
9873
|
+
});
|
|
9220
9874
|
}
|
|
9221
9875
|
return regions;
|
|
9222
9876
|
}
|
|
@@ -9231,7 +9885,7 @@ function hitTableRowBoundary(element, point, scale, data = {}) {
|
|
|
9231
9885
|
-(element.rotation ?? 0) * Math.PI / 180
|
|
9232
9886
|
);
|
|
9233
9887
|
const region = tableRowResizeLayout(element, scale, data).filter(
|
|
9234
|
-
(item) => local.x >= item.x && local.x < item.x + item.width && local.y
|
|
9888
|
+
(item) => local.x >= item.x && local.x < item.x + item.width && Math.abs(local.y - item.edge) <= item.radius
|
|
9235
9889
|
).sort((a, b) => Math.abs(local.y - a.edge) - Math.abs(local.y - b.edge))[0];
|
|
9236
9890
|
return region && {
|
|
9237
9891
|
elementId: element.id,
|
|
@@ -9366,12 +10020,12 @@ function tableDebugRegions(table2, context, options = {}) {
|
|
|
9366
10020
|
...owner,
|
|
9367
10021
|
id: `${area}-resize:${index}`,
|
|
9368
10022
|
category: "resize",
|
|
9369
|
-
label: `${area === "header" ? `\u8868\u5934 H${region.rowIndex + 1}` : `\u884C ${region.rowIndex + 1}`} \u5E95\u7EBF \
|
|
10023
|
+
label: `${area === "header" ? `\u8868\u5934 H${region.rowIndex + 1}` : `\u884C ${region.rowIndex + 1}`} \u5E95\u7EBF \xB1${Math.round(region.radius * scale)}px${hit ? " \u547D\u4E2D" : ""}`,
|
|
9370
10024
|
bounds: {
|
|
9371
10025
|
x: region.x,
|
|
9372
10026
|
y: region.y,
|
|
9373
10027
|
width: region.width,
|
|
9374
|
-
height:
|
|
10028
|
+
height: region.radius * 2
|
|
9375
10029
|
},
|
|
9376
10030
|
interactive: true,
|
|
9377
10031
|
hit,
|
|
@@ -10361,37 +11015,253 @@ function emptyTableRow(element) {
|
|
|
10361
11015
|
);
|
|
10362
11016
|
}
|
|
10363
11017
|
|
|
10364
|
-
// src/plugins/table/
|
|
10365
|
-
|
|
10366
|
-
|
|
10367
|
-
|
|
10368
|
-
|
|
10369
|
-
|
|
10370
|
-
|
|
10371
|
-
|
|
10372
|
-
const
|
|
10373
|
-
|
|
10374
|
-
|
|
10375
|
-
|
|
10376
|
-
|
|
10377
|
-
|
|
10378
|
-
|
|
10379
|
-
|
|
10380
|
-
|
|
10381
|
-
|
|
10382
|
-
|
|
10383
|
-
|
|
10384
|
-
|
|
10385
|
-
|
|
10386
|
-
|
|
10387
|
-
|
|
10388
|
-
|
|
10389
|
-
|
|
10390
|
-
|
|
10391
|
-
|
|
10392
|
-
|
|
10393
|
-
|
|
10394
|
-
|
|
11018
|
+
// src/plugins/table/data/packed-report-defaults.ts
|
|
11019
|
+
function fillPackedReportDefaults(columns, rows, current2) {
|
|
11020
|
+
const visible = tableLeafColumns(columns).filter((column) => !column.hidden);
|
|
11021
|
+
const keys2 = visible.map(
|
|
11022
|
+
(column) => typeof column.dataIndex === "string" ? column.dataIndex : ""
|
|
11023
|
+
);
|
|
11024
|
+
const repeats = /* @__PURE__ */ new Map();
|
|
11025
|
+
keys2.forEach((key) => {
|
|
11026
|
+
const match = /^(.+?)([1-9]\d*)$/.exec(key);
|
|
11027
|
+
if (!match) return;
|
|
11028
|
+
const slots = repeats.get(match[1]) ?? /* @__PURE__ */ new Set();
|
|
11029
|
+
slots.add(Number(match[2]));
|
|
11030
|
+
repeats.set(match[1], slots);
|
|
11031
|
+
});
|
|
11032
|
+
const series = [...repeats].filter(
|
|
11033
|
+
([, slots]) => slots.has(1) && slots.has(2)
|
|
11034
|
+
);
|
|
11035
|
+
const itemsPerRow = Math.max(
|
|
11036
|
+
1,
|
|
11037
|
+
...series.map(([, slots]) => Math.max(...slots))
|
|
11038
|
+
);
|
|
11039
|
+
const sample = rows.find((row) => row && typeof row === "object") ?? {};
|
|
11040
|
+
const groupFields = {};
|
|
11041
|
+
keys2.forEach((key, index) => {
|
|
11042
|
+
const repeated = series.some(
|
|
11043
|
+
([prefix, slots]) => [...slots].some((slot) => key === `${prefix}${slot}`)
|
|
11044
|
+
);
|
|
11045
|
+
if (key && !repeated && !visible[index]?.summary && visible[index]?.summaryTitle == null) {
|
|
11046
|
+
groupFields[key] = key in sample ? key : "";
|
|
11047
|
+
}
|
|
11048
|
+
});
|
|
11049
|
+
const itemFields = series.map(([prefix]) => ({
|
|
11050
|
+
prefix,
|
|
11051
|
+
.../^(sequence|seq|index|序号)$/i.test(prefix) ? { mode: "index" } : { mode: "value", path: prefix in sample ? prefix : "" }
|
|
11052
|
+
}));
|
|
11053
|
+
const totals = {};
|
|
11054
|
+
visible.forEach((column, index) => {
|
|
11055
|
+
const key = keys2[index];
|
|
11056
|
+
const summary = column.summary;
|
|
11057
|
+
const type = typeof summary === "object" ? summary.type ?? "sum" : "sum";
|
|
11058
|
+
if (key && summary && type === "sum") {
|
|
11059
|
+
const prefix = series.find(
|
|
11060
|
+
([name, slots]) => [...slots].some((slot) => key === `${name}${slot}`)
|
|
11061
|
+
)?.[0];
|
|
11062
|
+
totals[key] = {
|
|
11063
|
+
sumPath: key in sample ? key : prefix && prefix in sample ? prefix : "",
|
|
11064
|
+
...typeof summary === "object" && summary.precision != null ? { decimals: summary.precision } : {}
|
|
11065
|
+
};
|
|
11066
|
+
}
|
|
11067
|
+
});
|
|
11068
|
+
const subtotalLabelKey = keys2.find(
|
|
11069
|
+
(key) => key && !(key in totals) && !(key in groupFields)
|
|
11070
|
+
);
|
|
11071
|
+
const totalLabelKey = keys2.find((key) => key && !(key in totals));
|
|
11072
|
+
const subtotal = { ...totals };
|
|
11073
|
+
if (subtotalLabelKey) subtotal[subtotalLabelKey] = { text: "\u5C0F\u8BA1" };
|
|
11074
|
+
if (totalLabelKey) totals[totalLabelKey] = { text: "\u603B\u8BA1" };
|
|
11075
|
+
return {
|
|
11076
|
+
groupBy: current2?.groupBy ?? [],
|
|
11077
|
+
itemsPerRow: current2?.itemsPerRow ?? itemsPerRow,
|
|
11078
|
+
groupFields: Object.keys(current2?.groupFields ?? {}).length ? current2.groupFields : groupFields,
|
|
11079
|
+
groupMergeColumns: Object.keys(current2?.groupFields ?? {}).length ? current2.groupMergeColumns : keys2.flatMap(
|
|
11080
|
+
(key, index) => key && key in groupFields ? [index] : []
|
|
11081
|
+
),
|
|
11082
|
+
itemFields: current2?.itemFields?.length ? current2.itemFields : itemFields,
|
|
11083
|
+
subtotal: Object.keys(current2?.subtotal ?? {}).length ? current2.subtotal : subtotal,
|
|
11084
|
+
subtotalMerges: current2?.subtotalMerges ?? [],
|
|
11085
|
+
total: Object.keys(current2?.total ?? {}).length ? current2.total : totals,
|
|
11086
|
+
totalMerges: current2?.totalMerges ?? [],
|
|
11087
|
+
appendRows: current2?.appendRows ?? [],
|
|
11088
|
+
...current2?.footerElementIds ? { footerElementIds: current2.footerElementIds } : {}
|
|
11089
|
+
};
|
|
11090
|
+
}
|
|
11091
|
+
|
|
11092
|
+
// src/plugins/table/interaction/agent-commands.ts
|
|
11093
|
+
function object(input) {
|
|
11094
|
+
if (!input || typeof input !== "object" || Array.isArray(input))
|
|
11095
|
+
throw new TypeError("\u8868\u683C\u547D\u4EE4\u53C2\u6570\u5FC5\u987B\u662F\u5BF9\u8C61\u3002");
|
|
11096
|
+
return input;
|
|
11097
|
+
}
|
|
11098
|
+
function safePart(value) {
|
|
11099
|
+
return !!value.trim() && !value.split(/[.[\]]/).some((part) => ["__proto__", "prototype", "constructor"].includes(part));
|
|
11100
|
+
}
|
|
11101
|
+
function fieldPath(input, label) {
|
|
11102
|
+
if (typeof input === "string" && safePart(input)) return input.trim();
|
|
11103
|
+
if (Array.isArray(input) && input.length > 0 && input.every(
|
|
11104
|
+
(part) => typeof part === "string" && safePart(part) || typeof part === "number" && Number.isInteger(part) && part >= 0
|
|
11105
|
+
))
|
|
11106
|
+
return input;
|
|
11107
|
+
throw new TypeError(`${label} \u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u6BB5\u540D\u6216\u5B57\u6BB5\u8DEF\u5F84\u6570\u7EC4\u3002`);
|
|
11108
|
+
}
|
|
11109
|
+
function paths(input, label) {
|
|
11110
|
+
if (input === void 0) return [];
|
|
11111
|
+
if (!Array.isArray(input)) throw new TypeError(`${label} \u5FC5\u987B\u662F\u6570\u7EC4\u3002`);
|
|
11112
|
+
return input.map((value) => fieldPath(value, label));
|
|
11113
|
+
}
|
|
11114
|
+
function stringPaths(input, label) {
|
|
11115
|
+
if (!Array.isArray(input) || !input.length)
|
|
11116
|
+
throw new TypeError(`${label} \u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u6BB5\u8DEF\u5F84\u6570\u7EC4\u3002`);
|
|
11117
|
+
return input.map((value) => {
|
|
11118
|
+
if (typeof value !== "string" || !safePart(value))
|
|
11119
|
+
throw new TypeError(`${label} \u4E2D\u7684\u5B57\u6BB5\u8DEF\u5F84\u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32\u3002`);
|
|
11120
|
+
return value.trim();
|
|
11121
|
+
});
|
|
11122
|
+
}
|
|
11123
|
+
function configureTableAutoMerge(element, rawPayload) {
|
|
11124
|
+
const payload = object(rawPayload);
|
|
11125
|
+
if (payload.enabled === false) return { ...element, mergeCell: void 0 };
|
|
11126
|
+
const rowKeys = paths(payload.rowKeys, "rowKeys");
|
|
11127
|
+
const rowColumns = paths(payload.rowColumns, "rowColumns");
|
|
11128
|
+
const columnKeys = paths(payload.columnKeys, "columnKeys");
|
|
11129
|
+
if (!rowKeys.length && !columnKeys.length)
|
|
11130
|
+
throw new TypeError(
|
|
11131
|
+
"\u81F3\u5C11\u63D0\u4F9B rowKeys \u6216 columnKeys\uFF1B\u5173\u95ED\u65F6\u4F20 enabled=false\u3002"
|
|
11132
|
+
);
|
|
11133
|
+
if (rowColumns.length && !rowKeys.length)
|
|
11134
|
+
throw new TypeError("\u8BBE\u7F6E rowColumns \u65F6\u5FC5\u987B\u540C\u65F6\u63D0\u4F9B rowKeys\u3002");
|
|
11135
|
+
const visible = tableLeafColumns(element.columns).filter((column) => !column.hidden).map((column) => JSON.stringify(column.dataIndex));
|
|
11136
|
+
for (const path of [
|
|
11137
|
+
...rowColumns.length ? rowColumns : rowKeys,
|
|
11138
|
+
...columnKeys
|
|
11139
|
+
])
|
|
11140
|
+
if (!visible.includes(JSON.stringify(path)))
|
|
11141
|
+
throw new TypeError(`\u5408\u5E76\u76EE\u6807\u5217\u4E0D\u5B58\u5728\uFF1A${JSON.stringify(path)}\u3002`);
|
|
11142
|
+
return {
|
|
11143
|
+
...element,
|
|
11144
|
+
mergeCell: {
|
|
11145
|
+
...rowKeys.length ? {
|
|
11146
|
+
row: {
|
|
11147
|
+
keys: rowKeys,
|
|
11148
|
+
...rowColumns.length ? { columns: rowColumns } : {}
|
|
11149
|
+
}
|
|
11150
|
+
} : {},
|
|
11151
|
+
...columnKeys.length ? { column: { keys: columnKeys } } : {}
|
|
11152
|
+
}
|
|
11153
|
+
};
|
|
11154
|
+
}
|
|
11155
|
+
function configureTableGroupAggregation(element, rawPayload, data) {
|
|
11156
|
+
const payload = object(rawPayload);
|
|
11157
|
+
if (payload.enabled === false) return { ...element, packedReport: void 0 };
|
|
11158
|
+
const groupBy = stringPaths(payload.groupBy, "groupBy");
|
|
11159
|
+
if (payload.itemsPerRow !== void 0 && (!Number.isInteger(payload.itemsPerRow) || Number(payload.itemsPerRow) < 1))
|
|
11160
|
+
throw new TypeError("itemsPerRow \u5FC5\u987B\u662F\u5927\u4E8E\u96F6\u7684\u6574\u6570\u3002");
|
|
11161
|
+
if (payload.sums !== void 0 && !Array.isArray(payload.sums))
|
|
11162
|
+
throw new TypeError("sums \u5FC5\u987B\u662F\u6570\u7EC4\u3002");
|
|
11163
|
+
const source = element.dataMode === "binding" ? resolveTableDataSource(data, element.dataPath) : element.dataSource;
|
|
11164
|
+
const rows = Array.isArray(source) ? source.filter(
|
|
11165
|
+
(row) => !!row && typeof row === "object" && !Array.isArray(row)
|
|
11166
|
+
) : element.dataSource;
|
|
11167
|
+
for (const path of groupBy)
|
|
11168
|
+
if (rows.length && !rows.some((row) => printDesign.resolvePrintDesignDataPath(row, path) !== void 0))
|
|
11169
|
+
throw new TypeError(`\u5206\u7EC4\u5B57\u6BB5\u5728\u6570\u636E\u4E2D\u4E0D\u5B58\u5728\uFF1A${path}\u3002`);
|
|
11170
|
+
const report = fillPackedReportDefaults(
|
|
11171
|
+
element.columns,
|
|
11172
|
+
rows,
|
|
11173
|
+
element.packedReport
|
|
11174
|
+
);
|
|
11175
|
+
const visible = tableLeafColumns(element.columns).filter(
|
|
11176
|
+
(column) => !column.hidden
|
|
11177
|
+
);
|
|
11178
|
+
const groupFields = { ...report.groupFields };
|
|
11179
|
+
const subtotal = { ...report.subtotal };
|
|
11180
|
+
const total = { ...report.total };
|
|
11181
|
+
const sumColumns = /* @__PURE__ */ new Set();
|
|
11182
|
+
for (const raw of payload.sums ?? []) {
|
|
11183
|
+
const sum = object(raw);
|
|
11184
|
+
if (typeof sum.column !== "string" || !safePart(sum.column))
|
|
11185
|
+
throw new TypeError("sums.column \u5FC5\u987B\u662F\u8868\u683C\u5217\u7684 dataIndex \u5B57\u7B26\u4E32\u3002");
|
|
11186
|
+
const column = sum.column.trim();
|
|
11187
|
+
if (!visible.some((item) => item.dataIndex === column))
|
|
11188
|
+
throw new TypeError(`\u6C47\u603B\u5217\u4E0D\u5B58\u5728\uFF1A${column}\u3002`);
|
|
11189
|
+
if (sumColumns.has(column)) throw new TypeError(`\u6C47\u603B\u5217\u91CD\u590D\uFF1A${column}\u3002`);
|
|
11190
|
+
if (typeof sum.path !== "string" || !safePart(sum.path))
|
|
11191
|
+
throw new TypeError("sums.path \u5FC5\u987B\u662F\u539F\u59CB\u6570\u636E\u7684\u975E\u7A7A\u5B57\u6BB5\u8DEF\u5F84\u3002");
|
|
11192
|
+
if (rows.length && !rows.some(
|
|
11193
|
+
(row) => printDesign.resolvePrintDesignDataPath(row, sum.path) !== void 0
|
|
11194
|
+
))
|
|
11195
|
+
throw new TypeError(`\u6C42\u548C\u5B57\u6BB5\u5728\u6570\u636E\u4E2D\u4E0D\u5B58\u5728\uFF1A${sum.path}\u3002`);
|
|
11196
|
+
if (sum.decimals !== void 0 && (!Number.isInteger(sum.decimals) || Number(sum.decimals) < 0 || Number(sum.decimals) > 10))
|
|
11197
|
+
throw new TypeError("sums.decimals \u5FC5\u987B\u662F 0 \u5230 10 \u7684\u6574\u6570\u3002");
|
|
11198
|
+
sumColumns.add(column);
|
|
11199
|
+
delete groupFields[column];
|
|
11200
|
+
const rule = {
|
|
11201
|
+
sumPath: sum.path.trim(),
|
|
11202
|
+
...sum.decimals === void 0 ? {} : { decimals: sum.decimals }
|
|
11203
|
+
};
|
|
11204
|
+
subtotal[column] = rule;
|
|
11205
|
+
total[column] = rule;
|
|
11206
|
+
}
|
|
11207
|
+
if (sumColumns.size && !Object.values(subtotal).some((rule) => rule.text === "\u5C0F\u8BA1")) {
|
|
11208
|
+
const labelColumn = visible.find(
|
|
11209
|
+
(column) => typeof column.dataIndex === "string" && !sumColumns.has(column.dataIndex)
|
|
11210
|
+
);
|
|
11211
|
+
if (typeof labelColumn?.dataIndex === "string")
|
|
11212
|
+
subtotal[labelColumn.dataIndex] = { text: "\u5C0F\u8BA1" };
|
|
11213
|
+
}
|
|
11214
|
+
return {
|
|
11215
|
+
...element,
|
|
11216
|
+
packedReport: {
|
|
11217
|
+
...report,
|
|
11218
|
+
groupBy,
|
|
11219
|
+
...payload.itemsPerRow === void 0 ? {} : { itemsPerRow: payload.itemsPerRow },
|
|
11220
|
+
groupFields,
|
|
11221
|
+
groupMergeColumns: report.groupMergeColumns.filter(
|
|
11222
|
+
(index) => !sumColumns.has(String(visible[index]?.dataIndex ?? ""))
|
|
11223
|
+
),
|
|
11224
|
+
subtotal,
|
|
11225
|
+
total
|
|
11226
|
+
}
|
|
11227
|
+
};
|
|
11228
|
+
}
|
|
11229
|
+
|
|
11230
|
+
// src/plugins/table/interaction/commands.ts
|
|
11231
|
+
var tableCommands = {
|
|
11232
|
+
execute(element, command, rawPayload, context) {
|
|
11233
|
+
if (element.locked) return;
|
|
11234
|
+
if (!rawPayload || typeof rawPayload !== "object") return;
|
|
11235
|
+
if (command === "configure-auto-merge")
|
|
11236
|
+
return configureTableAutoMerge(element, rawPayload);
|
|
11237
|
+
if (command === "configure-group-aggregation")
|
|
11238
|
+
return configureTableGroupAggregation(element, rawPayload, context.data);
|
|
11239
|
+
const payload = rawPayload;
|
|
11240
|
+
const rowIndex = payload.rowIndex ?? 0;
|
|
11241
|
+
const columnIndex = payload.columnIndex ?? 0;
|
|
11242
|
+
const rowSpan = payload.rowSpan ?? 1;
|
|
11243
|
+
const colSpan = payload.colSpan ?? 1;
|
|
11244
|
+
if (!Number.isInteger(rowIndex) || !Number.isInteger(columnIndex) || !Number.isInteger(rowSpan) || !Number.isInteger(colSpan))
|
|
11245
|
+
return;
|
|
11246
|
+
if (command === "merge-body") {
|
|
11247
|
+
const rows = resolveTableRows(element, context.data);
|
|
11248
|
+
const columns = tableLeafColumns(element.columns).filter(
|
|
11249
|
+
(column) => !column.hidden
|
|
11250
|
+
);
|
|
11251
|
+
if (rowIndex < 0 || columnIndex < 0 || rowSpan < 1 || colSpan < 1 || rowIndex + rowSpan > rows.length || columnIndex + colSpan > columns.length)
|
|
11252
|
+
return;
|
|
11253
|
+
const blocked = Array.from(
|
|
11254
|
+
{ length: rowSpan },
|
|
11255
|
+
(_, row) => Array.from(
|
|
11256
|
+
{ length: colSpan },
|
|
11257
|
+
(_2, column) => coveringTableCell(
|
|
11258
|
+
element.cells,
|
|
11259
|
+
rowIndex + row,
|
|
11260
|
+
columnIndex + column
|
|
11261
|
+
)
|
|
11262
|
+
)
|
|
11263
|
+
).flat().some(
|
|
11264
|
+
(cell) => cell && (cell.rowIndex !== rowIndex || cell.columnIndex !== columnIndex) && ((cell.rowSpan ?? 1) > 1 || (cell.colSpan ?? 1) > 1)
|
|
10395
11265
|
);
|
|
10396
11266
|
if (blocked) return;
|
|
10397
11267
|
const previous = element.cells?.find(
|
|
@@ -10760,7 +11630,7 @@ function validateTableTemplateData(element, data) {
|
|
|
10760
11630
|
// src/plugins/table/native.ts
|
|
10761
11631
|
var tableNativePlugin = defineNativePlugin(
|
|
10762
11632
|
"table",
|
|
10763
|
-
"0.1.
|
|
11633
|
+
"0.1.70",
|
|
10764
11634
|
printDesign.definePrintDesignPluginRenderer({
|
|
10765
11635
|
type: "table",
|
|
10766
11636
|
validate: validateTableElement,
|
|
@@ -11093,6 +11963,41 @@ var pivotTableBoundaryResize = {
|
|
|
11093
11963
|
}
|
|
11094
11964
|
};
|
|
11095
11965
|
|
|
11966
|
+
// src/plugins/pivot-table/interaction/commands.ts
|
|
11967
|
+
var areas = ["filter", "column", "row", "value"];
|
|
11968
|
+
var pivotTableCommands = {
|
|
11969
|
+
execute(element, command, payload) {
|
|
11970
|
+
if (element.locked || !payload || typeof payload !== "object") return;
|
|
11971
|
+
const args = payload;
|
|
11972
|
+
const fieldKey = args.fieldKey;
|
|
11973
|
+
if (typeof fieldKey !== "string" || !element.fields.some((field) => field.key === fieldKey))
|
|
11974
|
+
return;
|
|
11975
|
+
if (command === "remove-field")
|
|
11976
|
+
return {
|
|
11977
|
+
...element,
|
|
11978
|
+
layout: removePivotField(element.layout, fieldKey)
|
|
11979
|
+
};
|
|
11980
|
+
if (command !== "move-field" || !areas.includes(args.area))
|
|
11981
|
+
return;
|
|
11982
|
+
const index = args.index;
|
|
11983
|
+
if (index !== void 0 && (!Number.isInteger(index) || index < 0))
|
|
11984
|
+
return;
|
|
11985
|
+
const sourceArea = args.sourceArea;
|
|
11986
|
+
if (sourceArea !== void 0 && !areas.includes(sourceArea))
|
|
11987
|
+
return;
|
|
11988
|
+
return {
|
|
11989
|
+
...element,
|
|
11990
|
+
layout: movePivotField(
|
|
11991
|
+
element.layout,
|
|
11992
|
+
fieldKey,
|
|
11993
|
+
args.area,
|
|
11994
|
+
index,
|
|
11995
|
+
sourceArea
|
|
11996
|
+
)
|
|
11997
|
+
};
|
|
11998
|
+
}
|
|
11999
|
+
};
|
|
12000
|
+
|
|
11096
12001
|
// src/plugins/pivot-table/model.ts
|
|
11097
12002
|
function validatePivotTableElement(value) {
|
|
11098
12003
|
if (!value || typeof value !== "object") return false;
|
|
@@ -11106,11 +12011,12 @@ function validatePivotTableElement(value) {
|
|
|
11106
12011
|
// src/plugins/pivot-table/native.ts
|
|
11107
12012
|
var pivotTableNativePlugin = defineNativePlugin(
|
|
11108
12013
|
"pivotTable",
|
|
11109
|
-
"0.1.
|
|
12014
|
+
"0.1.19",
|
|
11110
12015
|
printDesign.definePrintDesignPluginRenderer({
|
|
11111
12016
|
type: "pivotTable",
|
|
11112
12017
|
htmlCss: tableHtmlCss,
|
|
11113
12018
|
validate: validatePivotTableElement,
|
|
12019
|
+
commands: pivotTableCommands,
|
|
11114
12020
|
validateTemplateData: validatePivotTemplateData,
|
|
11115
12021
|
bindingInfo: (element) => ({
|
|
11116
12022
|
bound: element.dataMode === "binding",
|
|
@@ -11621,13 +12527,49 @@ function ganttMarkup(element, data, pageNumber) {
|
|
|
11621
12527
|
return `<svg class="pd-media" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${width} ${height}" preserveAspectRatio="none"><rect width="${width}" height="${height}" fill="${printDesign.cssColor(theme.backgroundColor, "transparent")}"/>${header > 0 ? `<rect width="${width}" height="${header}" fill="${printDesign.cssColor(theme.headerBackgroundColor, "transparent")}"/>` : ""}${ticks}${taskSplit}${headerEdges}${headerTitle}${maskedDependencies}${bars}${frame}</svg>`;
|
|
11622
12528
|
}
|
|
11623
12529
|
|
|
12530
|
+
// src/plugins/gantt/interaction/commands.ts
|
|
12531
|
+
var ganttCommands = {
|
|
12532
|
+
execute(element, command, payload) {
|
|
12533
|
+
if (element.locked || element.dataMode === "binding" || !payload || typeof payload !== "object")
|
|
12534
|
+
return;
|
|
12535
|
+
const args = payload;
|
|
12536
|
+
const tasks = [...element.tasks];
|
|
12537
|
+
if (command === "insert-task") {
|
|
12538
|
+
const index = args.index;
|
|
12539
|
+
if (!Number.isInteger(index) || index < 0 || index > tasks.length)
|
|
12540
|
+
return;
|
|
12541
|
+
if (!args.task || typeof args.task !== "object" || Array.isArray(args.task))
|
|
12542
|
+
return;
|
|
12543
|
+
const task = args.task;
|
|
12544
|
+
if (tasks.some((existing) => existing.id === task.id)) return;
|
|
12545
|
+
tasks.splice(index, 0, task);
|
|
12546
|
+
} else {
|
|
12547
|
+
const taskId = args.taskId;
|
|
12548
|
+
if (typeof taskId !== "string") return;
|
|
12549
|
+
const index = tasks.findIndex((task) => task.id === taskId);
|
|
12550
|
+
if (index < 0) return;
|
|
12551
|
+
if (command === "remove-task") tasks.splice(index, 1);
|
|
12552
|
+
else if (command === "update-task") {
|
|
12553
|
+
if (!args.patch || typeof args.patch !== "object" || Array.isArray(args.patch))
|
|
12554
|
+
return;
|
|
12555
|
+
const patch = args.patch;
|
|
12556
|
+
if (patch.id !== void 0 || patch.tasks !== void 0) return;
|
|
12557
|
+
tasks[index] = { ...tasks[index], ...patch };
|
|
12558
|
+
} else return;
|
|
12559
|
+
}
|
|
12560
|
+
const next = { ...element, tasks };
|
|
12561
|
+
return validateGanttElement(next) ? next : void 0;
|
|
12562
|
+
}
|
|
12563
|
+
};
|
|
12564
|
+
|
|
11624
12565
|
// src/plugins/gantt/native.ts
|
|
11625
12566
|
var ganttNativePlugin = defineNativePlugin(
|
|
11626
12567
|
"gantt",
|
|
11627
|
-
"0.1.
|
|
12568
|
+
"0.1.7",
|
|
11628
12569
|
printDesign.definePrintDesignPluginRenderer({
|
|
11629
12570
|
type: "gantt",
|
|
11630
12571
|
validate: validateGanttElement,
|
|
12572
|
+
commands: ganttCommands,
|
|
11631
12573
|
validateTemplateData: validateGanttTemplateData,
|
|
11632
12574
|
bindingInfo: (element) => ({
|
|
11633
12575
|
bound: element.dataMode === "binding",
|
|
@@ -11641,6 +12583,7 @@ var ganttNativePlugin = defineNativePlugin(
|
|
|
11641
12583
|
// src/native.ts
|
|
11642
12584
|
var builtinNativeComponentPlugins = [
|
|
11643
12585
|
textNativePlugin,
|
|
12586
|
+
richTextNativePlugin,
|
|
11644
12587
|
listNativePlugin,
|
|
11645
12588
|
dateTimeNativePlugin,
|
|
11646
12589
|
moneyUpperNativePlugin,
|
|
@@ -11903,8 +12846,36 @@ var propertySections = [{
|
|
|
11903
12846
|
visibleWhen: (element) => element.type === "text" && Boolean(element.fontSource),
|
|
11904
12847
|
toPatch: () => ({ fontSource: "" })
|
|
11905
12848
|
},
|
|
11906
|
-
{ path: "fontWeight", label: "\
|
|
11907
|
-
{ path: "
|
|
12849
|
+
{ path: "fontWeight", label: "\u52A0\u7C97", kind: "select", defaultValue: "400", ariaLabel: "\u6587\u672C\u5B57\u91CD", options: FONT_WEIGHT_OPTIONS, fullWidth: false },
|
|
12850
|
+
{ path: "fontStyle", label: "\u503E\u659C", kind: "select", defaultValue: "normal", ariaLabel: "\u6587\u672C\u503E\u659C", fullWidth: false, options: [
|
|
12851
|
+
{ label: "\u5E38\u89C4", value: "normal" },
|
|
12852
|
+
{ label: "\u503E\u659C", value: "italic" }
|
|
12853
|
+
] },
|
|
12854
|
+
{ path: "lineHeight", label: "\u884C\u9AD8\u500D\u6570", kind: "number", defaultValue: 1.35, min: 0.5, max: 4, precision: 2, fullWidth: true, ariaLabel: "\u6587\u672C\u884C\u9AD8\u500D\u6570" },
|
|
12855
|
+
{ path: "indentMode", label: "\u7F29\u8FDB", kind: "select", defaultValue: "none", fullWidth: false, options: [
|
|
12856
|
+
{ label: "\u65E0", value: "none" },
|
|
12857
|
+
{ label: "\u9996\u884C\u7F29\u8FDB", value: "firstLine" },
|
|
12858
|
+
{ label: "\u60AC\u6302\u7F29\u8FDB", value: "hanging" }
|
|
12859
|
+
] },
|
|
12860
|
+
{
|
|
12861
|
+
path: "indentValue",
|
|
12862
|
+
label: "\u7F29\u8FDB\u5EA6\u91CF\u503C",
|
|
12863
|
+
kind: "number",
|
|
12864
|
+
defaultValue: 0,
|
|
12865
|
+
min: 0,
|
|
12866
|
+
max: 1e4,
|
|
12867
|
+
precision: 2,
|
|
12868
|
+
fullWidth: false,
|
|
12869
|
+
unitSelector: { path: "indentUnit", label: "\u7F29\u8FDB\u5355\u4F4D", defaultValue: "char", options: [
|
|
12870
|
+
{ label: "\u5B57\u7B26", value: "char" },
|
|
12871
|
+
{ label: "mm", value: "mm" },
|
|
12872
|
+
{ label: "cm", value: "cm" },
|
|
12873
|
+
{ label: "in", value: "in" },
|
|
12874
|
+
{ label: "pt", value: "pt" },
|
|
12875
|
+
{ label: "px", value: "px" }
|
|
12876
|
+
] },
|
|
12877
|
+
visibleWhen: (element) => element.type === "text" && element.indentMode !== void 0 && element.indentMode !== "none"
|
|
12878
|
+
},
|
|
11908
12879
|
{ path: "heightOverflow", label: "\u8D85\u51FA\u56FA\u5B9A\u9AD8\u5EA6", kind: "select", defaultValue: "flow", ariaLabel: "\u6587\u672C\u8D85\u51FA\u56FA\u5B9A\u9AD8\u5EA6\u5904\u7406\u65B9\u5F0F", options: TEXT_OVERFLOW_OPTIONS },
|
|
11909
12880
|
{ path: "underlineCount", label: "\u4E0B\u5212\u7EBF\u6761\u6570", kind: "number", defaultValue: 0, min: 0, max: 5, precision: 0, ariaLabel: "\u4E0B\u5212\u7EBF\u6761\u6570" },
|
|
11910
12881
|
{ path: "underlineStyle", label: "\u4E0B\u5212\u7EBF\u7EBF\u578B", kind: "select", defaultValue: "solid", ariaLabel: "\u4E0B\u5212\u7EBF\u7EBF\u578B", options: UNDERLINE_STYLE_OPTIONS },
|
|
@@ -11943,11 +12914,178 @@ var textPlugin = defineBuiltinReactPlugin(textNativePlugin, {
|
|
|
11943
12914
|
menuGroups,
|
|
11944
12915
|
propertySections
|
|
11945
12916
|
});
|
|
12917
|
+
function RichTextInlineEditor(props) {
|
|
12918
|
+
const [runs, setRuns] = react.useState(props.element.runs);
|
|
12919
|
+
const runsRef = react.useRef(runs);
|
|
12920
|
+
runsRef.current = runs;
|
|
12921
|
+
const editorRef = react.useRef(null);
|
|
12922
|
+
const overlayRef = react.useRef(null);
|
|
12923
|
+
const finishedRef = react.useRef(false);
|
|
12924
|
+
const finish = (commit) => {
|
|
12925
|
+
if (finishedRef.current) return;
|
|
12926
|
+
finishedRef.current = true;
|
|
12927
|
+
if (commit && JSON.stringify(runsRef.current) !== JSON.stringify(props.element.runs))
|
|
12928
|
+
props.onCommit(runsRef.current);
|
|
12929
|
+
else props.onClose();
|
|
12930
|
+
};
|
|
12931
|
+
react.useEffect(() => {
|
|
12932
|
+
const containsEditorUi = (target) => target instanceof Node && (overlayRef.current?.contains(target) || target instanceof Element && !!target.closest(".canvas-react-rich-text-popup"));
|
|
12933
|
+
const onPointerDown = (event) => {
|
|
12934
|
+
if (!containsEditorUi(event.target)) finish(true);
|
|
12935
|
+
};
|
|
12936
|
+
const onFocusIn = (event) => {
|
|
12937
|
+
if (!containsEditorUi(event.target)) finish(true);
|
|
12938
|
+
};
|
|
12939
|
+
const onKeyDown = (event) => {
|
|
12940
|
+
if (event.key !== "Escape") return;
|
|
12941
|
+
event.preventDefault();
|
|
12942
|
+
event.stopPropagation();
|
|
12943
|
+
finish(false);
|
|
12944
|
+
};
|
|
12945
|
+
document.addEventListener("pointerdown", onPointerDown, true);
|
|
12946
|
+
document.addEventListener("focusin", onFocusIn, true);
|
|
12947
|
+
document.addEventListener("keydown", onKeyDown, true);
|
|
12948
|
+
editorRef.current?.focus();
|
|
12949
|
+
return () => {
|
|
12950
|
+
document.removeEventListener("pointerdown", onPointerDown, true);
|
|
12951
|
+
document.removeEventListener("focusin", onFocusIn, true);
|
|
12952
|
+
document.removeEventListener("keydown", onKeyDown, true);
|
|
12953
|
+
};
|
|
12954
|
+
}, []);
|
|
12955
|
+
const scale = props.element.width > 0 ? props.rect.width / props.element.width : 1;
|
|
12956
|
+
const ptToPx = (size) => `${size * 25.4 / 72 * scale}px`;
|
|
12957
|
+
const indentPx = richTextIndentMm(props.element) * scale;
|
|
12958
|
+
const transform = props.element.transform ? (() => {
|
|
12959
|
+
const matrix = printDesign.elementTransformHomography(props.element);
|
|
12960
|
+
const perspective = `matrix3d(${matrix.a},${matrix.b},0,${matrix.g / scale},${matrix.c},${matrix.d},0,${matrix.h / scale},0,0,1,0,${matrix.e * scale},${matrix.f * scale},0,1)`;
|
|
12961
|
+
const rotation = props.element.rotation ? ` translate(${props.rect.width / 2}px,${props.rect.height / 2}px) rotate(${props.element.rotation}deg) translate(${-props.rect.width / 2}px,${-props.rect.height / 2}px)` : "";
|
|
12962
|
+
return perspective + rotation;
|
|
12963
|
+
})() : `rotate(${props.element.rotation ?? 0}deg)`;
|
|
12964
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
12965
|
+
"div",
|
|
12966
|
+
{
|
|
12967
|
+
ref: overlayRef,
|
|
12968
|
+
className: "cc-print-design-rich-text-overlay",
|
|
12969
|
+
style: {
|
|
12970
|
+
position: "fixed",
|
|
12971
|
+
zIndex: 1e4,
|
|
12972
|
+
left: props.rect.left,
|
|
12973
|
+
top: props.rect.top,
|
|
12974
|
+
width: props.rect.width,
|
|
12975
|
+
height: props.rect.height,
|
|
12976
|
+
background: "transparent",
|
|
12977
|
+
outline: "1px solid #1677ff",
|
|
12978
|
+
transform,
|
|
12979
|
+
transformOrigin: props.element.transform ? "0 0" : "center"
|
|
12980
|
+
},
|
|
12981
|
+
onKeyDownCapture: (event) => {
|
|
12982
|
+
event.stopPropagation();
|
|
12983
|
+
if (event.key === "Escape") {
|
|
12984
|
+
event.preventDefault();
|
|
12985
|
+
finish(false);
|
|
12986
|
+
}
|
|
12987
|
+
},
|
|
12988
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12989
|
+
reactComponents.ReactRichText,
|
|
12990
|
+
{
|
|
12991
|
+
ref: editorRef,
|
|
12992
|
+
value: runs,
|
|
12993
|
+
onChange: setRuns,
|
|
12994
|
+
toolbarPopupZIndex: 10001,
|
|
12995
|
+
fontFamilyOptions: reactPrintDesign.FONT_FAMILY_OPTIONS.map((option) => ({ label: option.label, value: String(option.value) })),
|
|
12996
|
+
defaultStyle: {
|
|
12997
|
+
fontFamily: printDesign.resolvePrintDesignFontFamily(props.element.fontFamily),
|
|
12998
|
+
fontSize: props.element.fontSize ?? 14,
|
|
12999
|
+
fontWeight: props.element.fontWeight ?? "400",
|
|
13000
|
+
fontStyle: props.element.fontStyle ?? "normal",
|
|
13001
|
+
color: props.element.color ?? "#1f2937"
|
|
13002
|
+
},
|
|
13003
|
+
fontSizeCss: ptToPx,
|
|
13004
|
+
editorStyle: {
|
|
13005
|
+
width: "100%",
|
|
13006
|
+
height: "100%",
|
|
13007
|
+
minHeight: 0,
|
|
13008
|
+
overflow: "hidden",
|
|
13009
|
+
backgroundColor: "transparent",
|
|
13010
|
+
lineHeight: props.element.lineHeight ?? 1.35,
|
|
13011
|
+
textAlign: props.element.textAlign ?? "left",
|
|
13012
|
+
textIndent: props.element.indentMode === "firstLine" ? `${indentPx}px` : props.element.indentMode === "hanging" ? `-${indentPx}px` : void 0,
|
|
13013
|
+
paddingLeft: props.element.indentMode === "hanging" ? `${indentPx}px` : void 0
|
|
13014
|
+
}
|
|
13015
|
+
}
|
|
13016
|
+
)
|
|
13017
|
+
}
|
|
13018
|
+
);
|
|
13019
|
+
}
|
|
13020
|
+
|
|
13021
|
+
// src/plugins/rich-text/factory.ts
|
|
13022
|
+
var richTextFactory = {
|
|
13023
|
+
type: "richText",
|
|
13024
|
+
label: "\u5BCC\u6587\u672C",
|
|
13025
|
+
showDataPanel: false,
|
|
13026
|
+
defaultOverflowPolicy: "split",
|
|
13027
|
+
overflowPolicyOptions: [
|
|
13028
|
+
{ label: "\u81EA\u52A8\u6EA2\u51FA\u5230\u7EED\u9875", value: "split" },
|
|
13029
|
+
{ label: "\u6574\u4F53\u653E\u5230\u4E0B\u4E00\u9875", value: "nextPage" },
|
|
13030
|
+
{ label: "\u88C1\u5207", value: "clip" },
|
|
13031
|
+
{ label: "\u8D85\u51FA\u663E\u793A...", value: "ellipsis" }
|
|
13032
|
+
],
|
|
13033
|
+
renderInlineEditor: ({ element, rect, onCommit, onClose }) => react.createElement(RichTextInlineEditor, {
|
|
13034
|
+
element,
|
|
13035
|
+
rect,
|
|
13036
|
+
onCommit: (runs) => onCommit({ runs }),
|
|
13037
|
+
onClose
|
|
13038
|
+
}),
|
|
13039
|
+
create: () => ({
|
|
13040
|
+
...createCommonElementDefaults(),
|
|
13041
|
+
type: "richText",
|
|
13042
|
+
name: "\u5BCC\u6587\u672C",
|
|
13043
|
+
runs: [{ text: "\u53CC\u51FB\u7F16\u8F91\u5BCC\u6587\u672C" }],
|
|
13044
|
+
fontSize: 14,
|
|
13045
|
+
color: "#1f2937"
|
|
13046
|
+
})
|
|
13047
|
+
};
|
|
13048
|
+
var menuGroups2 = [
|
|
13049
|
+
{
|
|
13050
|
+
id: "basic",
|
|
13051
|
+
title: "\u57FA\u7840\u5143\u7D20",
|
|
13052
|
+
order: 0,
|
|
13053
|
+
items: [
|
|
13054
|
+
{
|
|
13055
|
+
id: "richText",
|
|
13056
|
+
type: "richText",
|
|
13057
|
+
label: "\u5BCC\u6587\u672C",
|
|
13058
|
+
icon: react.createElement(reactComponents.ReactFontSizeOutlined, { "aria-hidden": true }),
|
|
13059
|
+
order: 1
|
|
13060
|
+
}
|
|
13061
|
+
]
|
|
13062
|
+
}
|
|
13063
|
+
];
|
|
13064
|
+
|
|
13065
|
+
// src/plugins/rich-text/react.ts
|
|
13066
|
+
var richTextPlugin = defineBuiltinReactPlugin(richTextNativePlugin, {
|
|
13067
|
+
factory: richTextFactory,
|
|
13068
|
+
menuGroups: menuGroups2
|
|
13069
|
+
});
|
|
11946
13070
|
|
|
11947
13071
|
// src/plugins/list/factory.ts
|
|
11948
13072
|
var listFactory = {
|
|
11949
13073
|
type: "list",
|
|
11950
13074
|
label: "\u5217\u8868",
|
|
13075
|
+
agentCommands: [
|
|
13076
|
+
{
|
|
13077
|
+
name: "insert-item",
|
|
13078
|
+
description: "\u5728\u5217\u8868\u6307\u5B9A\u4F4D\u7F6E\u63D2\u5165\u9879\u3002payload: { index: 0 \u8D77\u59CB\u63D2\u5165\u4F4D\u7F6E, text: \u9879\u6587\u5B57 }\u3002"
|
|
13079
|
+
},
|
|
13080
|
+
{
|
|
13081
|
+
name: "update-item",
|
|
13082
|
+
description: "\u4FEE\u6539\u5217\u8868\u9879\u3002payload: { index: 0 \u8D77\u59CB\u9879\u4F4D\u7F6E, text?: \u9879\u6587\u5B57, checked?: \u662F\u5426\u9009\u4E2D }\u3002"
|
|
13083
|
+
},
|
|
13084
|
+
{
|
|
13085
|
+
name: "remove-item",
|
|
13086
|
+
description: "\u79FB\u9664\u5217\u8868\u9879\u3002payload: { index: 0 \u8D77\u59CB\u9879\u4F4D\u7F6E }\u3002"
|
|
13087
|
+
}
|
|
13088
|
+
],
|
|
11951
13089
|
showDataPanel: false,
|
|
11952
13090
|
tourFields: () => [],
|
|
11953
13091
|
acceptsPreset: (preset) => ["ordered", "unordered", "radio", "checkbox"].includes(preset),
|
|
@@ -11979,7 +13117,7 @@ var listFactory = {
|
|
|
11979
13117
|
};
|
|
11980
13118
|
|
|
11981
13119
|
// src/plugins/list/menu.ts
|
|
11982
|
-
var
|
|
13120
|
+
var menuGroups3 = [
|
|
11983
13121
|
{
|
|
11984
13122
|
id: "list",
|
|
11985
13123
|
title: "\u5217\u8868\u7EC4\u4EF6",
|
|
@@ -12081,7 +13219,7 @@ var propertySections2 = [
|
|
|
12081
13219
|
// src/plugins/list/react.ts
|
|
12082
13220
|
var listPlugin = defineBuiltinReactPlugin(listNativePlugin, {
|
|
12083
13221
|
factory: listFactory,
|
|
12084
|
-
menuGroups:
|
|
13222
|
+
menuGroups: menuGroups3,
|
|
12085
13223
|
propertySections: propertySections2
|
|
12086
13224
|
});
|
|
12087
13225
|
|
|
@@ -12104,7 +13242,7 @@ var dateTimeFactory = {
|
|
|
12104
13242
|
};
|
|
12105
13243
|
}
|
|
12106
13244
|
};
|
|
12107
|
-
var
|
|
13245
|
+
var menuGroups4 = [
|
|
12108
13246
|
{
|
|
12109
13247
|
id: "date-time",
|
|
12110
13248
|
title: "\u65E5\u671F\u65F6\u95F4",
|
|
@@ -12145,7 +13283,7 @@ var propertySections3 = [
|
|
|
12145
13283
|
];
|
|
12146
13284
|
var dateTimePlugin = defineBuiltinReactPlugin(dateTimeNativePlugin, {
|
|
12147
13285
|
factory: dateTimeFactory,
|
|
12148
|
-
menuGroups:
|
|
13286
|
+
menuGroups: menuGroups4,
|
|
12149
13287
|
propertySections: propertySections3
|
|
12150
13288
|
});
|
|
12151
13289
|
|
|
@@ -12168,7 +13306,7 @@ var moneyUpperFactory = {
|
|
|
12168
13306
|
};
|
|
12169
13307
|
}
|
|
12170
13308
|
};
|
|
12171
|
-
var
|
|
13309
|
+
var menuGroups5 = [
|
|
12172
13310
|
{
|
|
12173
13311
|
id: "basic",
|
|
12174
13312
|
title: "\u57FA\u7840\u5143\u7D20",
|
|
@@ -12222,7 +13360,7 @@ var propertySections4 = [
|
|
|
12222
13360
|
];
|
|
12223
13361
|
var moneyUpperPlugin = defineBuiltinReactPlugin(
|
|
12224
13362
|
moneyUpperNativePlugin,
|
|
12225
|
-
{ factory: moneyUpperFactory, menuGroups:
|
|
13363
|
+
{ factory: moneyUpperFactory, menuGroups: menuGroups5, propertySections: propertySections4 }
|
|
12226
13364
|
);
|
|
12227
13365
|
|
|
12228
13366
|
// src/plugins/page-number/factory.ts
|
|
@@ -12244,7 +13382,7 @@ var pageNumberFactory = {
|
|
|
12244
13382
|
};
|
|
12245
13383
|
}
|
|
12246
13384
|
};
|
|
12247
|
-
var
|
|
13385
|
+
var menuGroups6 = [
|
|
12248
13386
|
{
|
|
12249
13387
|
id: "basic",
|
|
12250
13388
|
title: "\u57FA\u7840\u5143\u7D20",
|
|
@@ -12293,7 +13431,7 @@ var propertySections5 = [
|
|
|
12293
13431
|
];
|
|
12294
13432
|
var pageNumberPlugin = defineBuiltinReactPlugin(
|
|
12295
13433
|
pageNumberNativePlugin,
|
|
12296
|
-
{ factory: pageNumberFactory, menuGroups:
|
|
13434
|
+
{ factory: pageNumberFactory, menuGroups: menuGroups6, propertySections: propertySections5 }
|
|
12297
13435
|
);
|
|
12298
13436
|
|
|
12299
13437
|
// src/plugins/watermark/factory.ts
|
|
@@ -12333,7 +13471,7 @@ var watermarkFactory = {
|
|
|
12333
13471
|
};
|
|
12334
13472
|
}
|
|
12335
13473
|
};
|
|
12336
|
-
var
|
|
13474
|
+
var menuGroups7 = [
|
|
12337
13475
|
{
|
|
12338
13476
|
id: "basic",
|
|
12339
13477
|
title: "\u57FA\u7840\u5143\u7D20",
|
|
@@ -12387,7 +13525,7 @@ var propertySections6 = [
|
|
|
12387
13525
|
];
|
|
12388
13526
|
var watermarkPlugin = defineBuiltinReactPlugin(watermarkNativePlugin, {
|
|
12389
13527
|
factory: watermarkFactory,
|
|
12390
|
-
menuGroups:
|
|
13528
|
+
menuGroups: menuGroups7,
|
|
12391
13529
|
propertySections: propertySections6
|
|
12392
13530
|
});
|
|
12393
13531
|
|
|
@@ -12395,6 +13533,20 @@ var watermarkPlugin = defineBuiltinReactPlugin(watermarkNativePlugin, {
|
|
|
12395
13533
|
var shapeFactory = {
|
|
12396
13534
|
type: "shape",
|
|
12397
13535
|
label: "\u56FE\u5F62",
|
|
13536
|
+
agentCommands: [
|
|
13537
|
+
{
|
|
13538
|
+
name: "set-polygon-points",
|
|
13539
|
+
description: "\u8BBE\u7F6E\u4E09\u89D2\u5F62\u3001\u591A\u8FB9\u5F62\u6216\u661F\u5F62\u9876\u70B9\u3002payload: { points: \u81F3\u5C11 3 \u4E2A { x, y } \u5F52\u4E00\u5316\u5750\u6807 }\u3002"
|
|
13540
|
+
},
|
|
13541
|
+
{
|
|
13542
|
+
name: "set-curve-points",
|
|
13543
|
+
description: "\u8BBE\u7F6E\u4E8C\u6B21\u3001\u4E09\u6B21\u6216\u591A\u6BB5\u66F2\u7EBF\u63A7\u5236\u70B9\u3002payload: { points: \u81F3\u5C11 2 \u4E2A { x, y } \u5F52\u4E00\u5316\u5750\u6807 }\u3002"
|
|
13544
|
+
},
|
|
13545
|
+
{
|
|
13546
|
+
name: "set-path-points",
|
|
13547
|
+
description: "\u8BBE\u7F6E\u81EA\u5B9A\u4E49\u8DEF\u5F84\u8282\u70B9\u3002payload: { points: { x, y } \u5F52\u4E00\u5316\u5750\u6807\u6570\u7EC4, closed?: \u662F\u5426\u95ED\u5408 }\u3002"
|
|
13548
|
+
}
|
|
13549
|
+
],
|
|
12398
13550
|
acceptsPreset: (preset) => [
|
|
12399
13551
|
"triangle",
|
|
12400
13552
|
"rect",
|
|
@@ -12514,7 +13666,7 @@ var shapeFactory = {
|
|
|
12514
13666
|
};
|
|
12515
13667
|
|
|
12516
13668
|
// src/plugins/shape/menu.ts
|
|
12517
|
-
var
|
|
13669
|
+
var menuGroups8 = [
|
|
12518
13670
|
{
|
|
12519
13671
|
id: "shape",
|
|
12520
13672
|
title: "\u5F62\u72B6\u7EC4\u4EF6",
|
|
@@ -12660,15 +13812,15 @@ var menuGroups7 = [
|
|
|
12660
13812
|
|
|
12661
13813
|
// src/plugins/shape/layout/options.ts
|
|
12662
13814
|
var SHAPE_OPTIONS = [
|
|
12663
|
-
...(
|
|
13815
|
+
...(menuGroups8.find((group) => group.id === "shape")?.items ?? []).map(
|
|
12664
13816
|
({ id, label }) => ({ value: id, label })
|
|
12665
13817
|
),
|
|
12666
13818
|
{ value: "ellipse", label: "\u692D\u5706" },
|
|
12667
13819
|
{ value: "line", label: "\u76F4\u7EBF" },
|
|
12668
|
-
...(
|
|
13820
|
+
...(menuGroups8.find((group) => group.id === "bracket")?.items ?? []).map(
|
|
12669
13821
|
({ id, label }) => ({ value: id, label })
|
|
12670
13822
|
),
|
|
12671
|
-
...(
|
|
13823
|
+
...(menuGroups8.find((group) => group.id === "curve")?.items ?? []).map(
|
|
12672
13824
|
({ id, label }) => ({ value: id, label })
|
|
12673
13825
|
),
|
|
12674
13826
|
{ value: "curve-path", label: "\u8DEF\u5F84" }
|
|
@@ -12886,7 +14038,7 @@ var propertySections7 = [
|
|
|
12886
14038
|
// src/plugins/shape/react.ts
|
|
12887
14039
|
var shapePlugin = defineBuiltinReactPlugin(shapeNativePlugin, {
|
|
12888
14040
|
factory: shapeFactory,
|
|
12889
|
-
menuGroups:
|
|
14041
|
+
menuGroups: menuGroups8,
|
|
12890
14042
|
propertySections: propertySections7
|
|
12891
14043
|
});
|
|
12892
14044
|
|
|
@@ -12917,6 +14069,7 @@ function BrushToolbarButton({
|
|
|
12917
14069
|
title: active ? "\u9000\u51FA\u753B\u7B14\u6A21\u5F0F" : "\u65B0\u5EFA\u753B\u7B14\u56FE\u5C42\u5E76\u7ED8\u5236",
|
|
12918
14070
|
"aria-label": "\u753B\u7B14\u6A21\u5F0F",
|
|
12919
14071
|
"aria-pressed": active,
|
|
14072
|
+
type: active ? "primary" : "default",
|
|
12920
14073
|
disabled: readonly,
|
|
12921
14074
|
icon: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12922
14075
|
"svg",
|
|
@@ -12951,6 +14104,16 @@ function BrushToolbarButton({
|
|
|
12951
14104
|
var brushFactory = {
|
|
12952
14105
|
type: "brush",
|
|
12953
14106
|
label: "\u753B\u7B14",
|
|
14107
|
+
agentCommands: [
|
|
14108
|
+
{
|
|
14109
|
+
name: "append-stroke",
|
|
14110
|
+
description: "\u8FFD\u52A0\u4E00\u7B14\u3002payload: { points: \u81F3\u5C11\u4E24\u4E2A { x, y, pressure?: 0 \u5230 1 } \u5F52\u4E00\u5316\u5750\u6807 }\u3002"
|
|
14111
|
+
},
|
|
14112
|
+
{
|
|
14113
|
+
name: "remove-stroke",
|
|
14114
|
+
description: "\u5220\u9664\u6307\u5B9A\u7B14\u753B\u5E76\u540C\u6B65\u5BF9\u5E94\u6837\u5F0F\u3002payload: { index: 0 \u8D77\u59CB\u7B14\u753B\u4F4D\u7F6E }\u3002"
|
|
14115
|
+
}
|
|
14116
|
+
],
|
|
12954
14117
|
showDataPanel: false,
|
|
12955
14118
|
tourFields: () => [],
|
|
12956
14119
|
create: createBrushElement,
|
|
@@ -12958,7 +14121,7 @@ var brushFactory = {
|
|
|
12958
14121
|
};
|
|
12959
14122
|
|
|
12960
14123
|
// src/plugins/brush/menu.ts
|
|
12961
|
-
var
|
|
14124
|
+
var menuGroups9 = [];
|
|
12962
14125
|
|
|
12963
14126
|
// src/plugins/brush/properties.ts
|
|
12964
14127
|
var propertySections8 = [
|
|
@@ -13042,7 +14205,7 @@ var propertySections8 = [
|
|
|
13042
14205
|
// src/plugins/brush/react.ts
|
|
13043
14206
|
var brushPlugin = defineBuiltinReactPlugin(brushNativePlugin, {
|
|
13044
14207
|
factory: brushFactory,
|
|
13045
|
-
menuGroups:
|
|
14208
|
+
menuGroups: menuGroups9,
|
|
13046
14209
|
propertySections: propertySections8
|
|
13047
14210
|
});
|
|
13048
14211
|
|
|
@@ -13050,6 +14213,16 @@ var brushPlugin = defineBuiltinReactPlugin(brushNativePlugin, {
|
|
|
13050
14213
|
var connectorFactory = {
|
|
13051
14214
|
type: "connector",
|
|
13052
14215
|
label: "\u8FDE\u63A5\u7EBF",
|
|
14216
|
+
agentCommands: [
|
|
14217
|
+
{
|
|
14218
|
+
name: "set-endpoint",
|
|
14219
|
+
description: "\u5C06\u8FDE\u63A5\u7EBF\u8D77\u70B9\u6216\u7EC8\u70B9\u8FDE\u63A5\u5230\u5DF2\u6709\u5143\u7D20\u3002payload: { side: start|end, endpoint: { elementId?: \u76EE\u6807\u5143\u7D20 ID, anchor?: auto|top|right|bottom|left|top-left|top-right|bottom-right|bottom-left|edge:\u7D22\u5F15|vertex:\u7D22\u5F15 } }\u3002"
|
|
14220
|
+
},
|
|
14221
|
+
{
|
|
14222
|
+
name: "set-waypoints",
|
|
14223
|
+
description: "\u8BBE\u7F6E\u6298\u7EBF\u4E2D\u95F4\u8DEF\u5F84\u70B9\uFF0C\u4EC5\u9002\u7528\u4E8E lineType=polyline\u3002payload: { points: \u9875\u9762\u6BEB\u7C73\u5750\u6807\u6570\u7EC4 [{ x, y }] }\u3002"
|
|
14224
|
+
}
|
|
14225
|
+
],
|
|
13053
14226
|
create: (preset = "bar") => {
|
|
13054
14227
|
const common = createCommonElementDefaults();
|
|
13055
14228
|
const type = "connector";
|
|
@@ -13070,7 +14243,7 @@ var connectorFactory = {
|
|
|
13070
14243
|
};
|
|
13071
14244
|
|
|
13072
14245
|
// src/plugins/connector/menu.ts
|
|
13073
|
-
var
|
|
14246
|
+
var menuGroups10 = [
|
|
13074
14247
|
{
|
|
13075
14248
|
id: "connector",
|
|
13076
14249
|
title: "\u8FDE\u63A5\u7EBF",
|
|
@@ -13185,7 +14358,7 @@ var propertySections9 = [
|
|
|
13185
14358
|
// src/plugins/connector/react.ts
|
|
13186
14359
|
var connectorPlugin = defineBuiltinReactPlugin(connectorNativePlugin, {
|
|
13187
14360
|
factory: connectorFactory,
|
|
13188
|
-
menuGroups:
|
|
14361
|
+
menuGroups: menuGroups10,
|
|
13189
14362
|
propertySections: propertySections9
|
|
13190
14363
|
});
|
|
13191
14364
|
|
|
@@ -13210,7 +14383,7 @@ var dividerFactory = {
|
|
|
13210
14383
|
};
|
|
13211
14384
|
}
|
|
13212
14385
|
};
|
|
13213
|
-
var
|
|
14386
|
+
var menuGroups11 = [
|
|
13214
14387
|
{
|
|
13215
14388
|
id: "basic",
|
|
13216
14389
|
title: "\u57FA\u7840\u5143\u7D20",
|
|
@@ -13269,7 +14442,7 @@ var propertySections10 = [
|
|
|
13269
14442
|
// src/plugins/divider/react.ts
|
|
13270
14443
|
var dividerPlugin = defineBuiltinReactPlugin(dividerNativePlugin, {
|
|
13271
14444
|
factory: dividerFactory,
|
|
13272
|
-
menuGroups:
|
|
14445
|
+
menuGroups: menuGroups11,
|
|
13273
14446
|
propertySections: propertySections10
|
|
13274
14447
|
});
|
|
13275
14448
|
|
|
@@ -13306,7 +14479,7 @@ var rulerFactory = {
|
|
|
13306
14479
|
};
|
|
13307
14480
|
|
|
13308
14481
|
// src/plugins/ruler/menu.ts
|
|
13309
|
-
var
|
|
14482
|
+
var menuGroups12 = [
|
|
13310
14483
|
{
|
|
13311
14484
|
id: "ruler",
|
|
13312
14485
|
title: "\u523B\u5EA6\u5C3A\u7EC4\u4EF6",
|
|
@@ -13399,7 +14572,7 @@ var propertySections11 = [
|
|
|
13399
14572
|
// src/plugins/ruler/react.ts
|
|
13400
14573
|
var rulerPlugin = defineBuiltinReactPlugin(rulerNativePlugin, {
|
|
13401
14574
|
factory: rulerFactory,
|
|
13402
|
-
menuGroups:
|
|
14575
|
+
menuGroups: menuGroups12,
|
|
13403
14576
|
propertySections: propertySections11
|
|
13404
14577
|
});
|
|
13405
14578
|
|
|
@@ -13407,6 +14580,16 @@ var rulerPlugin = defineBuiltinReactPlugin(rulerNativePlugin, {
|
|
|
13407
14580
|
var gridFactory = {
|
|
13408
14581
|
type: "grid",
|
|
13409
14582
|
label: "\u7F51\u683C",
|
|
14583
|
+
agentCommands: [
|
|
14584
|
+
{
|
|
14585
|
+
name: "resize-grid",
|
|
14586
|
+
description: "\u8C03\u6574\u7F51\u683C\u884C\u5217\u6570\uFF0C\u4FDD\u7559\u91CD\u53E0\u533A\u57DF\u7684\u5355\u5143\u683C\u3002payload: { rows: 1 \u5230 50 \u7684\u6574\u6570, columns: 1 \u5230 50 \u7684\u6574\u6570 }\u3002"
|
|
14587
|
+
},
|
|
14588
|
+
{
|
|
14589
|
+
name: "set-cell",
|
|
14590
|
+
description: "\u66F4\u65B0\u6307\u5B9A\u7F51\u683C\u5355\u5143\u683C\u3002payload: { rowIndex: 0 \u8D77\u59CB\u884C, columnIndex: 0 \u8D77\u59CB\u5217, cell: { content?: none|x|*, contentMode?: static|binding, contentPath?: \u5B57\u7B26\u4E32, backgroundColor?: \u5B57\u7B26\u4E32 } }\u3002"
|
|
14591
|
+
}
|
|
14592
|
+
],
|
|
13410
14593
|
showDataPanel: false,
|
|
13411
14594
|
tourFields: (element) => element.type === "grid" ? [
|
|
13412
14595
|
{ key: "rows", label: "\u884C\u6570", value: element.rows },
|
|
@@ -13431,7 +14614,7 @@ var gridFactory = {
|
|
|
13431
14614
|
};
|
|
13432
14615
|
}
|
|
13433
14616
|
};
|
|
13434
|
-
var
|
|
14617
|
+
var menuGroups13 = [
|
|
13435
14618
|
{
|
|
13436
14619
|
id: "grid",
|
|
13437
14620
|
title: "\u7F51\u683C\u7EC4\u4EF6",
|
|
@@ -13641,7 +14824,7 @@ var propertySections12 = [
|
|
|
13641
14824
|
// src/plugins/grid/react.ts
|
|
13642
14825
|
var gridPlugin = defineBuiltinReactPlugin(gridNativePlugin, {
|
|
13643
14826
|
factory: gridFactory,
|
|
13644
|
-
menuGroups:
|
|
14827
|
+
menuGroups: menuGroups13,
|
|
13645
14828
|
propertySections: propertySections12
|
|
13646
14829
|
});
|
|
13647
14830
|
|
|
@@ -13649,6 +14832,16 @@ var gridPlugin = defineBuiltinReactPlugin(gridNativePlugin, {
|
|
|
13649
14832
|
var coordinateFactory = {
|
|
13650
14833
|
type: "coordinate",
|
|
13651
14834
|
label: "\u5750\u6807\u7F51\u683C",
|
|
14835
|
+
agentCommands: [
|
|
14836
|
+
{
|
|
14837
|
+
name: "resize-grid",
|
|
14838
|
+
description: "\u8C03\u6574\u5750\u6807\u7F51\u683C\u884C\u5217\u6570\uFF0C\u4FDD\u7559\u91CD\u53E0\u533A\u57DF\u5355\u5143\u683C\u3002payload: { rows: 1 \u5230 50 \u7684\u6574\u6570, columns: 1 \u5230 50 \u7684\u6574\u6570 }\u3002"
|
|
14839
|
+
},
|
|
14840
|
+
{
|
|
14841
|
+
name: "set-cell",
|
|
14842
|
+
description: "\u66F4\u65B0\u5750\u6807\u7F51\u683C\u5355\u5143\u683C\u3002payload: { rowIndex: 0 \u8D77\u59CB\u884C, columnIndex: 0 \u8D77\u59CB\u5217, cell: { content?: none|x|*, contentMode?: static|binding, contentPath?: \u5B57\u7B26\u4E32, backgroundColor?: \u5B57\u7B26\u4E32 } }\u3002"
|
|
14843
|
+
}
|
|
14844
|
+
],
|
|
13652
14845
|
showDataPanel: false,
|
|
13653
14846
|
tourFields: (element) => element.type === "coordinate" ? [
|
|
13654
14847
|
{ key: "rows", label: "\u884C\u6570", value: element.rows },
|
|
@@ -13693,7 +14886,7 @@ var coordinateFactory = {
|
|
|
13693
14886
|
};
|
|
13694
14887
|
}
|
|
13695
14888
|
};
|
|
13696
|
-
var
|
|
14889
|
+
var menuGroups14 = [
|
|
13697
14890
|
{
|
|
13698
14891
|
id: "grid",
|
|
13699
14892
|
title: "\u7F51\u683C\u7EC4\u4EF6",
|
|
@@ -13844,7 +15037,7 @@ var propertySections13 = [
|
|
|
13844
15037
|
// src/plugins/coordinate/react.ts
|
|
13845
15038
|
var coordinatePlugin = defineBuiltinReactPlugin(
|
|
13846
15039
|
coordinateNativePlugin,
|
|
13847
|
-
{ factory: coordinateFactory, menuGroups:
|
|
15040
|
+
{ factory: coordinateFactory, menuGroups: menuGroups14, propertySections: propertySections13 }
|
|
13848
15041
|
);
|
|
13849
15042
|
|
|
13850
15043
|
// src/plugins/progress/factory.ts
|
|
@@ -13879,7 +15072,7 @@ var progressFactory = {
|
|
|
13879
15072
|
};
|
|
13880
15073
|
|
|
13881
15074
|
// src/plugins/progress/menu.ts
|
|
13882
|
-
var
|
|
15075
|
+
var menuGroups15 = [
|
|
13883
15076
|
{
|
|
13884
15077
|
id: "progress",
|
|
13885
15078
|
title: "\u8FDB\u5EA6\u7EC4\u4EF6",
|
|
@@ -14011,7 +15204,7 @@ var propertySections14 = [
|
|
|
14011
15204
|
// src/plugins/progress/react.ts
|
|
14012
15205
|
var progressPlugin = defineBuiltinReactPlugin(progressNativePlugin, {
|
|
14013
15206
|
factory: progressFactory,
|
|
14014
|
-
menuGroups:
|
|
15207
|
+
menuGroups: menuGroups15,
|
|
14015
15208
|
propertySections: propertySections14
|
|
14016
15209
|
});
|
|
14017
15210
|
|
|
@@ -14019,6 +15212,20 @@ var progressPlugin = defineBuiltinReactPlugin(progressNativePlugin, {
|
|
|
14019
15212
|
var flowFactory = {
|
|
14020
15213
|
type: "flow",
|
|
14021
15214
|
label: "\u6D41\u7A0B\u56FE",
|
|
15215
|
+
agentCommands: [
|
|
15216
|
+
{
|
|
15217
|
+
name: "insert-item",
|
|
15218
|
+
description: "\u5728\u9759\u6001\u6D41\u7A0B\u6307\u5B9A\u4F4D\u7F6E\u63D2\u5165\u8282\u70B9\u3002payload: { index: 0 \u8D77\u59CB\u63D2\u5165\u4F4D\u7F6E, item: { content: \u5B57\u7B26\u4E32, title?: \u5B57\u7B26\u4E32, color?: \u5B57\u7B26\u4E32, position?: start|end, loading?: \u5E03\u5C14\u503C, icon?: circle|check|clock|cross } }\u3002"
|
|
15219
|
+
},
|
|
15220
|
+
{
|
|
15221
|
+
name: "update-item",
|
|
15222
|
+
description: "\u4FEE\u6539\u9759\u6001\u6D41\u7A0B\u8282\u70B9\u3002payload: { index: 0 \u8D77\u59CB\u8282\u70B9\u4F4D\u7F6E, item: \u9700\u4FEE\u6539\u7684\u8282\u70B9\u5B57\u6BB5 }\u3002"
|
|
15223
|
+
},
|
|
15224
|
+
{
|
|
15225
|
+
name: "remove-item",
|
|
15226
|
+
description: "\u79FB\u9664\u9759\u6001\u6D41\u7A0B\u8282\u70B9\u3002payload: { index: 0 \u8D77\u59CB\u8282\u70B9\u4F4D\u7F6E }\u3002"
|
|
15227
|
+
}
|
|
15228
|
+
],
|
|
14022
15229
|
showDataPanel: false,
|
|
14023
15230
|
tourFields: () => [],
|
|
14024
15231
|
create: (preset = "bar") => {
|
|
@@ -14047,7 +15254,7 @@ var flowFactory = {
|
|
|
14047
15254
|
};
|
|
14048
15255
|
}
|
|
14049
15256
|
};
|
|
14050
|
-
var
|
|
15257
|
+
var menuGroups16 = [
|
|
14051
15258
|
{
|
|
14052
15259
|
id: "basic",
|
|
14053
15260
|
title: "\u57FA\u7840\u5143\u7D20",
|
|
@@ -14183,7 +15390,7 @@ var propertySections15 = [{
|
|
|
14183
15390
|
// src/plugins/flow/react.ts
|
|
14184
15391
|
var flowPlugin = defineBuiltinReactPlugin(flowNativePlugin, {
|
|
14185
15392
|
factory: flowFactory,
|
|
14186
|
-
menuGroups:
|
|
15393
|
+
menuGroups: menuGroups16,
|
|
14187
15394
|
propertySections: propertySections15
|
|
14188
15395
|
});
|
|
14189
15396
|
|
|
@@ -14225,7 +15432,7 @@ var clockFactory = {
|
|
|
14225
15432
|
};
|
|
14226
15433
|
}
|
|
14227
15434
|
};
|
|
14228
|
-
var
|
|
15435
|
+
var menuGroups17 = [
|
|
14229
15436
|
{
|
|
14230
15437
|
id: "date-time",
|
|
14231
15438
|
title: "\u65E5\u671F\u65F6\u95F4",
|
|
@@ -14324,7 +15531,7 @@ var propertySections16 = [
|
|
|
14324
15531
|
// src/plugins/clock/react.ts
|
|
14325
15532
|
var clockPlugin = defineBuiltinReactPlugin(clockNativePlugin, {
|
|
14326
15533
|
factory: clockFactory,
|
|
14327
|
-
menuGroups:
|
|
15534
|
+
menuGroups: menuGroups17,
|
|
14328
15535
|
propertySections: propertySections16
|
|
14329
15536
|
});
|
|
14330
15537
|
|
|
@@ -14401,6 +15608,16 @@ function placeExternalImage(image, point, page, index = 0) {
|
|
|
14401
15608
|
var imageFactory = {
|
|
14402
15609
|
type: "image",
|
|
14403
15610
|
label: "\u56FE\u7247",
|
|
15611
|
+
agentCommands: [
|
|
15612
|
+
{
|
|
15613
|
+
name: "set-crop",
|
|
15614
|
+
description: "\u8BBE\u7F6E\u56FE\u7247\u88C1\u526A\u533A\u57DF\u3002payload: { x, y, width, height }\uFF0C\u5747\u4E3A\u539F\u56FE\u5BBD\u9AD8\u7684 0 \u5230 1 \u6BD4\u4F8B\uFF0C\u533A\u57DF\u5FC5\u987B\u5728\u539F\u56FE\u5185\uFF1B\u53EF\u9009 sourceWidth\u3001sourceHeight \u4E3A\u539F\u56FE\u50CF\u7D20\u5C3A\u5BF8\u3002"
|
|
15615
|
+
},
|
|
15616
|
+
{
|
|
15617
|
+
name: "clear-crop",
|
|
15618
|
+
description: "\u79FB\u9664\u56FE\u7247\u88C1\u526A\uFF0C\u663E\u793A\u5B8C\u6574\u56FE\u7247\uFF1Bpayload \u4F20\u7A7A\u5BF9\u8C61\u3002"
|
|
15619
|
+
}
|
|
15620
|
+
],
|
|
14404
15621
|
dataFields: imageDataFields,
|
|
14405
15622
|
staticFieldPatch: (_element, key, value) => key === "src" ? { src: String(value), crop: void 0 } : { [key]: value },
|
|
14406
15623
|
externalDrop: {
|
|
@@ -14433,7 +15650,7 @@ var imageFactory = {
|
|
|
14433
15650
|
return { ...common, type, name: "\u56FE\u7247", src: "", fit: "contain" };
|
|
14434
15651
|
}
|
|
14435
15652
|
};
|
|
14436
|
-
var
|
|
15653
|
+
var menuGroups18 = [
|
|
14437
15654
|
{
|
|
14438
15655
|
id: "basic",
|
|
14439
15656
|
title: "\u57FA\u7840\u5143\u7D20",
|
|
@@ -14488,7 +15705,7 @@ var propertySections17 = [
|
|
|
14488
15705
|
// src/plugins/image/react.ts
|
|
14489
15706
|
var imagePlugin = defineBuiltinReactPlugin(imageNativePlugin, {
|
|
14490
15707
|
factory: imageFactory,
|
|
14491
|
-
menuGroups:
|
|
15708
|
+
menuGroups: menuGroups18,
|
|
14492
15709
|
propertySections: propertySections17
|
|
14493
15710
|
});
|
|
14494
15711
|
var barcodeFactory = {
|
|
@@ -14518,7 +15735,7 @@ var barcodeFactory = {
|
|
|
14518
15735
|
};
|
|
14519
15736
|
}
|
|
14520
15737
|
};
|
|
14521
|
-
var
|
|
15738
|
+
var menuGroups19 = [
|
|
14522
15739
|
{
|
|
14523
15740
|
id: "basic",
|
|
14524
15741
|
title: "\u57FA\u7840\u5143\u7D20",
|
|
@@ -14578,7 +15795,7 @@ var propertySections18 = [
|
|
|
14578
15795
|
// src/plugins/barcode/react.ts
|
|
14579
15796
|
var barcodePlugin = defineBuiltinReactPlugin(barcodeNativePlugin, {
|
|
14580
15797
|
factory: barcodeFactory,
|
|
14581
|
-
menuGroups:
|
|
15798
|
+
menuGroups: menuGroups19,
|
|
14582
15799
|
propertySections: propertySections18
|
|
14583
15800
|
});
|
|
14584
15801
|
|
|
@@ -14600,7 +15817,7 @@ var qrcodeFactory = {
|
|
|
14600
15817
|
};
|
|
14601
15818
|
}
|
|
14602
15819
|
};
|
|
14603
|
-
var
|
|
15820
|
+
var menuGroups20 = [
|
|
14604
15821
|
{
|
|
14605
15822
|
id: "basic",
|
|
14606
15823
|
title: "\u57FA\u7840\u5143\u7D20",
|
|
@@ -14759,7 +15976,7 @@ var propertySections19 = [
|
|
|
14759
15976
|
// src/plugins/qrcode/react.ts
|
|
14760
15977
|
var qrcodePlugin = defineBuiltinReactPlugin(qrcodeNativePlugin, {
|
|
14761
15978
|
factory: qrcodeFactory,
|
|
14762
|
-
menuGroups:
|
|
15979
|
+
menuGroups: menuGroups20,
|
|
14763
15980
|
propertySections: propertySections19
|
|
14764
15981
|
});
|
|
14765
15982
|
|
|
@@ -14841,6 +16058,16 @@ function createChartPreset(id) {
|
|
|
14841
16058
|
var chartFactory = {
|
|
14842
16059
|
type: "chart",
|
|
14843
16060
|
label: "\u56FE\u8868",
|
|
16061
|
+
agentCommands: [
|
|
16062
|
+
{
|
|
16063
|
+
name: "set-categories",
|
|
16064
|
+
description: "\u8BBE\u7F6E\u56FE\u8868\u9759\u6001\u5206\u7C7B\u6216\u9ED8\u8BA4\u5206\u7C7B\uFF0C\u5E76\u4F7F\u5404\u7CFB\u5217\u6570\u503C\u957F\u5EA6\u5339\u914D\u3002payload: { categories: \u5B57\u7B26\u4E32\u6570\u7EC4 }\u3002"
|
|
16065
|
+
},
|
|
16066
|
+
{
|
|
16067
|
+
name: "set-series",
|
|
16068
|
+
description: "\u66F4\u65B0\u6307\u5B9A\u6570\u503C\u7CFB\u5217\uFF0C\u4E5F\u53EF\u5728\u672B\u5C3E\u65B0\u589E\u3002payload: { index: 0 \u8D77\u59CB\u7CFB\u5217\u4F4D\u7F6E, name: \u7CFB\u5217\u540D\u79F0, values: \u4E0E categories \u7B49\u957F\u7684\u6709\u9650\u6570\u5B57\u6570\u7EC4, field?: \u7ED1\u5B9A\u5B57\u6BB5\u8DEF\u5F84 }\uFF1B\u997C\u56FE\u548C\u4EEA\u8868\u76D8\u4EC5\u652F\u6301\u7D22\u5F15 0\u3002"
|
|
16069
|
+
}
|
|
16070
|
+
],
|
|
14844
16071
|
showDataPanel: false,
|
|
14845
16072
|
acceptsPreset: (preset) => chartPresets.some((item) => item.id === preset),
|
|
14846
16073
|
create: (preset = "bar") => {
|
|
@@ -14855,7 +16082,7 @@ var chartFactory = {
|
|
|
14855
16082
|
};
|
|
14856
16083
|
}
|
|
14857
16084
|
};
|
|
14858
|
-
var
|
|
16085
|
+
var menuGroups21 = [
|
|
14859
16086
|
{
|
|
14860
16087
|
id: "chart",
|
|
14861
16088
|
title: "\u56FE\u8868\u7EC4\u4EF6",
|
|
@@ -15118,14 +16345,131 @@ var propertySections20 = [{
|
|
|
15118
16345
|
// src/plugins/chart/react.ts
|
|
15119
16346
|
var chartPlugin = defineBuiltinReactPlugin(chartNativePlugin, {
|
|
15120
16347
|
factory: chartFactory,
|
|
15121
|
-
menuGroups:
|
|
16348
|
+
menuGroups: menuGroups21,
|
|
15122
16349
|
propertySections: propertySections20
|
|
15123
16350
|
});
|
|
15124
16351
|
|
|
15125
16352
|
// src/plugins/table/factory.ts
|
|
16353
|
+
var fieldPathSchema = {
|
|
16354
|
+
anyOf: [
|
|
16355
|
+
{ type: "string", minLength: 1 },
|
|
16356
|
+
{
|
|
16357
|
+
type: "array",
|
|
16358
|
+
items: {
|
|
16359
|
+
anyOf: [
|
|
16360
|
+
{ type: "string", minLength: 1 },
|
|
16361
|
+
{ type: "integer", minimum: 0 }
|
|
16362
|
+
]
|
|
16363
|
+
},
|
|
16364
|
+
minItems: 1
|
|
16365
|
+
}
|
|
16366
|
+
]
|
|
16367
|
+
};
|
|
15126
16368
|
var tableFactory = {
|
|
15127
16369
|
type: "table",
|
|
15128
16370
|
label: "\u8868\u683C",
|
|
16371
|
+
agentCommands: [
|
|
16372
|
+
{
|
|
16373
|
+
name: "insert-row",
|
|
16374
|
+
description: "\u5728\u9759\u6001\u8868\u683C\u7684 rowIndex \u884C\u524D\u63D2\u5165\u884C\uFF1Bafter=true \u65F6\u63D2\u5728\u884C\u540E\u3002",
|
|
16375
|
+
parameters: {
|
|
16376
|
+
type: "object",
|
|
16377
|
+
properties: {
|
|
16378
|
+
rowIndex: { type: "integer", minimum: 0 },
|
|
16379
|
+
after: { type: "boolean" }
|
|
16380
|
+
},
|
|
16381
|
+
required: ["rowIndex"],
|
|
16382
|
+
additionalProperties: false
|
|
16383
|
+
}
|
|
16384
|
+
},
|
|
16385
|
+
{
|
|
16386
|
+
name: "insert-column",
|
|
16387
|
+
description: "\u5728 columnIndex \u5217\u524D\u63D2\u5165\u5217\uFF1Bafter=true \u65F6\u63D2\u5728\u5217\u540E\u3002",
|
|
16388
|
+
parameters: {
|
|
16389
|
+
type: "object",
|
|
16390
|
+
properties: {
|
|
16391
|
+
columnIndex: { type: "integer", minimum: 0 },
|
|
16392
|
+
after: { type: "boolean" }
|
|
16393
|
+
},
|
|
16394
|
+
required: ["columnIndex"],
|
|
16395
|
+
additionalProperties: false
|
|
16396
|
+
}
|
|
16397
|
+
},
|
|
16398
|
+
{
|
|
16399
|
+
name: "merge-body",
|
|
16400
|
+
description: "\u5408\u5E76\u8868\u4F53\u5355\u5143\u683C\uFF1B\u4F20 rowIndex\u3001columnIndex\u3001rowSpan\u3001colSpan\u3002",
|
|
16401
|
+
parameters: {
|
|
16402
|
+
type: "object",
|
|
16403
|
+
properties: {
|
|
16404
|
+
rowIndex: { type: "integer", minimum: 0 },
|
|
16405
|
+
columnIndex: { type: "integer", minimum: 0 },
|
|
16406
|
+
rowSpan: { type: "integer", minimum: 1 },
|
|
16407
|
+
colSpan: { type: "integer", minimum: 1 }
|
|
16408
|
+
},
|
|
16409
|
+
required: ["rowIndex", "columnIndex", "rowSpan", "colSpan"],
|
|
16410
|
+
additionalProperties: false
|
|
16411
|
+
}
|
|
16412
|
+
},
|
|
16413
|
+
{
|
|
16414
|
+
name: "merge-header",
|
|
16415
|
+
description: "\u5408\u5E76\u8868\u5934\u5355\u5143\u683C\uFF1B\u4F20 rowIndex\u3001columnIndex\u3001rowSpan\u3001colSpan\u3002",
|
|
16416
|
+
parameters: {
|
|
16417
|
+
type: "object",
|
|
16418
|
+
properties: {
|
|
16419
|
+
rowIndex: { type: "integer", minimum: 0 },
|
|
16420
|
+
columnIndex: { type: "integer", minimum: 0 },
|
|
16421
|
+
rowSpan: { type: "integer", minimum: 1 },
|
|
16422
|
+
colSpan: { type: "integer", minimum: 1 }
|
|
16423
|
+
},
|
|
16424
|
+
required: ["rowIndex", "columnIndex", "rowSpan", "colSpan"],
|
|
16425
|
+
additionalProperties: false
|
|
16426
|
+
}
|
|
16427
|
+
},
|
|
16428
|
+
{
|
|
16429
|
+
name: "configure-auto-merge",
|
|
16430
|
+
description: '\u6309\u6570\u636E\u5B57\u6BB5\u81EA\u52A8\u5408\u5E76\u8FDE\u7EED\u884C\u6216\u540C\u884C\u76F8\u90BB\u5217\u3002payload \u793A\u4F8B\uFF1A{rowKeys:["group"],rowColumns:["group"],columnKeys:["name"]}\uFF1B\u5B57\u6BB5\u53EF\u7528\u975E\u7A7A\u5B57\u7B26\u4E32\u6216\u8DEF\u5F84\u6570\u7EC4\uFF0C\u76EE\u6807\u5217\u987B\u5B58\u5728\u3002\u53EA\u9700\u884C\u5408\u5E76\u6216\u5217\u5408\u5E76\u65F6\u7701\u7565\u53E6\u4E00\u7C7B\u5B57\u6BB5\uFF1B\u4F20 {enabled:false} \u5173\u95ED\u3002\u914D\u7F6E\u4F1A\u6574\u4F53\u66FF\u6362\u539F\u81EA\u52A8\u5408\u5E76\u89C4\u5219\u3002',
|
|
16431
|
+
parameters: {
|
|
16432
|
+
type: "object",
|
|
16433
|
+
properties: {
|
|
16434
|
+
enabled: { type: "boolean" },
|
|
16435
|
+
rowKeys: { type: "array", items: fieldPathSchema },
|
|
16436
|
+
rowColumns: { type: "array", items: fieldPathSchema },
|
|
16437
|
+
columnKeys: { type: "array", items: fieldPathSchema }
|
|
16438
|
+
},
|
|
16439
|
+
additionalProperties: false
|
|
16440
|
+
}
|
|
16441
|
+
},
|
|
16442
|
+
{
|
|
16443
|
+
name: "configure-group-aggregation",
|
|
16444
|
+
description: '\u542F\u7528\u5206\u7EC4\u805A\u5408\u62A5\u8868\u5E76\u81EA\u52A8\u8865\u9F50\u660E\u7EC6\u3001\u5C0F\u8BA1\u548C\u603B\u8BA1\u89C4\u5219\u3002payload \u793A\u4F8B\uFF1A{groupBy:["region"],sums:[{column:"amount",path:"amount",decimals:2}],itemsPerRow:1}\uFF1BgroupBy \u4E3A\u539F\u59CB\u6570\u636E\u5B57\u6BB5\u8DEF\u5F84\uFF0Csums.column \u4E3A\u73B0\u6709\u53EF\u89C1\u5217 dataIndex\uFF0Csums.path \u4E3A\u6C42\u548C\u6E90\u5B57\u6BB5\u3002\u4F20 {enabled:false} \u5173\u95ED\u3002',
|
|
16445
|
+
parameters: {
|
|
16446
|
+
type: "object",
|
|
16447
|
+
properties: {
|
|
16448
|
+
enabled: { type: "boolean" },
|
|
16449
|
+
groupBy: {
|
|
16450
|
+
type: "array",
|
|
16451
|
+
items: { type: "string", minLength: 1 },
|
|
16452
|
+
minItems: 1
|
|
16453
|
+
},
|
|
16454
|
+
sums: {
|
|
16455
|
+
type: "array",
|
|
16456
|
+
items: {
|
|
16457
|
+
type: "object",
|
|
16458
|
+
properties: {
|
|
16459
|
+
column: { type: "string", minLength: 1 },
|
|
16460
|
+
path: { type: "string", minLength: 1 },
|
|
16461
|
+
decimals: { type: "integer", minimum: 0, maximum: 10 }
|
|
16462
|
+
},
|
|
16463
|
+
required: ["column", "path"],
|
|
16464
|
+
additionalProperties: false
|
|
16465
|
+
}
|
|
16466
|
+
},
|
|
16467
|
+
itemsPerRow: { type: "integer", minimum: 1 }
|
|
16468
|
+
},
|
|
16469
|
+
additionalProperties: false
|
|
16470
|
+
}
|
|
16471
|
+
}
|
|
16472
|
+
],
|
|
15129
16473
|
defaultOverflowPolicy: "split",
|
|
15130
16474
|
showDataPanel: false,
|
|
15131
16475
|
tourFields: (element) => {
|
|
@@ -15207,7 +16551,7 @@ var tableFactory = {
|
|
|
15207
16551
|
};
|
|
15208
16552
|
}
|
|
15209
16553
|
};
|
|
15210
|
-
var
|
|
16554
|
+
var menuGroups22 = [
|
|
15211
16555
|
{
|
|
15212
16556
|
id: "table",
|
|
15213
16557
|
title: "\u8868\u683C\u7EC4\u4EF6",
|
|
@@ -17085,6 +18429,7 @@ function TableCellsPanel({
|
|
|
17085
18429
|
title: label,
|
|
17086
18430
|
"aria-label": `${name}\u6587\u672C${label}`,
|
|
17087
18431
|
"aria-pressed": (textStyle.textAlign ?? "center") === value,
|
|
18432
|
+
type: (textStyle.textAlign ?? "center") === value ? "primary" : "default",
|
|
17088
18433
|
onClick: () => updateStyle({ textAlign: value })
|
|
17089
18434
|
},
|
|
17090
18435
|
value
|
|
@@ -17108,6 +18453,7 @@ function TableCellsPanel({
|
|
|
17108
18453
|
title: "\u52A0\u7C97",
|
|
17109
18454
|
"aria-label": `${name}\u6587\u672C\u52A0\u7C97`,
|
|
17110
18455
|
"aria-pressed": textStyle.bold === true,
|
|
18456
|
+
type: textStyle.bold === true ? "primary" : "default",
|
|
17111
18457
|
onClick: () => updateStyle({ bold: !textStyle.bold })
|
|
17112
18458
|
}
|
|
17113
18459
|
),
|
|
@@ -17118,6 +18464,7 @@ function TableCellsPanel({
|
|
|
17118
18464
|
title: "\u503E\u659C",
|
|
17119
18465
|
"aria-label": `${name}\u6587\u672C\u503E\u659C`,
|
|
17120
18466
|
"aria-pressed": textStyle.italic === true,
|
|
18467
|
+
type: textStyle.italic === true ? "primary" : "default",
|
|
17121
18468
|
onClick: () => updateStyle({ italic: !textStyle.italic })
|
|
17122
18469
|
}
|
|
17123
18470
|
)
|
|
@@ -17134,80 +18481,6 @@ function TableCellsPanel({
|
|
|
17134
18481
|
)
|
|
17135
18482
|
] });
|
|
17136
18483
|
}
|
|
17137
|
-
|
|
17138
|
-
// src/plugins/table/data/packed-report-defaults.ts
|
|
17139
|
-
function fillPackedReportDefaults(columns, rows, current2) {
|
|
17140
|
-
const visible = tableLeafColumns(columns).filter((column) => !column.hidden);
|
|
17141
|
-
const keys2 = visible.map(
|
|
17142
|
-
(column) => typeof column.dataIndex === "string" ? column.dataIndex : ""
|
|
17143
|
-
);
|
|
17144
|
-
const repeats = /* @__PURE__ */ new Map();
|
|
17145
|
-
keys2.forEach((key) => {
|
|
17146
|
-
const match = /^(.+?)([1-9]\d*)$/.exec(key);
|
|
17147
|
-
if (!match) return;
|
|
17148
|
-
const slots = repeats.get(match[1]) ?? /* @__PURE__ */ new Set();
|
|
17149
|
-
slots.add(Number(match[2]));
|
|
17150
|
-
repeats.set(match[1], slots);
|
|
17151
|
-
});
|
|
17152
|
-
const series = [...repeats].filter(
|
|
17153
|
-
([, slots]) => slots.has(1) && slots.has(2)
|
|
17154
|
-
);
|
|
17155
|
-
const itemsPerRow = Math.max(
|
|
17156
|
-
1,
|
|
17157
|
-
...series.map(([, slots]) => Math.max(...slots))
|
|
17158
|
-
);
|
|
17159
|
-
const sample = rows.find((row) => row && typeof row === "object") ?? {};
|
|
17160
|
-
const groupFields = {};
|
|
17161
|
-
keys2.forEach((key, index) => {
|
|
17162
|
-
const repeated = series.some(
|
|
17163
|
-
([prefix, slots]) => [...slots].some((slot) => key === `${prefix}${slot}`)
|
|
17164
|
-
);
|
|
17165
|
-
if (key && !repeated && !visible[index]?.summary && visible[index]?.summaryTitle == null) {
|
|
17166
|
-
groupFields[key] = key in sample ? key : "";
|
|
17167
|
-
}
|
|
17168
|
-
});
|
|
17169
|
-
const itemFields = series.map(([prefix]) => ({
|
|
17170
|
-
prefix,
|
|
17171
|
-
.../^(sequence|seq|index|序号)$/i.test(prefix) ? { mode: "index" } : { mode: "value", path: prefix in sample ? prefix : "" }
|
|
17172
|
-
}));
|
|
17173
|
-
const totals = {};
|
|
17174
|
-
visible.forEach((column, index) => {
|
|
17175
|
-
const key = keys2[index];
|
|
17176
|
-
const summary = column.summary;
|
|
17177
|
-
const type = typeof summary === "object" ? summary.type ?? "sum" : "sum";
|
|
17178
|
-
if (key && summary && type === "sum") {
|
|
17179
|
-
const prefix = series.find(
|
|
17180
|
-
([name, slots]) => [...slots].some((slot) => key === `${name}${slot}`)
|
|
17181
|
-
)?.[0];
|
|
17182
|
-
totals[key] = {
|
|
17183
|
-
sumPath: key in sample ? key : prefix && prefix in sample ? prefix : "",
|
|
17184
|
-
...typeof summary === "object" && summary.precision != null ? { decimals: summary.precision } : {}
|
|
17185
|
-
};
|
|
17186
|
-
}
|
|
17187
|
-
});
|
|
17188
|
-
const subtotalLabelKey = keys2.find(
|
|
17189
|
-
(key) => key && !(key in totals) && !(key in groupFields)
|
|
17190
|
-
);
|
|
17191
|
-
const totalLabelKey = keys2.find((key) => key && !(key in totals));
|
|
17192
|
-
const subtotal = { ...totals };
|
|
17193
|
-
if (subtotalLabelKey) subtotal[subtotalLabelKey] = { text: "\u5C0F\u8BA1" };
|
|
17194
|
-
if (totalLabelKey) totals[totalLabelKey] = { text: "\u603B\u8BA1" };
|
|
17195
|
-
return {
|
|
17196
|
-
groupBy: current2?.groupBy ?? [],
|
|
17197
|
-
itemsPerRow: current2?.itemsPerRow ?? itemsPerRow,
|
|
17198
|
-
groupFields: Object.keys(current2?.groupFields ?? {}).length ? current2.groupFields : groupFields,
|
|
17199
|
-
groupMergeColumns: Object.keys(current2?.groupFields ?? {}).length ? current2.groupMergeColumns : keys2.flatMap(
|
|
17200
|
-
(key, index) => key && key in groupFields ? [index] : []
|
|
17201
|
-
),
|
|
17202
|
-
itemFields: current2?.itemFields?.length ? current2.itemFields : itemFields,
|
|
17203
|
-
subtotal: Object.keys(current2?.subtotal ?? {}).length ? current2.subtotal : subtotal,
|
|
17204
|
-
subtotalMerges: current2?.subtotalMerges ?? [],
|
|
17205
|
-
total: Object.keys(current2?.total ?? {}).length ? current2.total : totals,
|
|
17206
|
-
totalMerges: current2?.totalMerges ?? [],
|
|
17207
|
-
appendRows: current2?.appendRows ?? [],
|
|
17208
|
-
...current2?.footerElementIds ? { footerElementIds: current2.footerElementIds } : {}
|
|
17209
|
-
};
|
|
17210
|
-
}
|
|
17211
18484
|
var isTableRows = (value) => Array.isArray(value) && value.every(
|
|
17212
18485
|
(row) => row !== null && typeof row === "object" && !Array.isArray(row)
|
|
17213
18486
|
);
|
|
@@ -18364,7 +19637,7 @@ function PackedReportPanel({
|
|
|
18364
19637
|
] })
|
|
18365
19638
|
] });
|
|
18366
19639
|
}
|
|
18367
|
-
var
|
|
19640
|
+
var fieldPath2 = (value) => Array.isArray(value) ? value.join(".") : String(value);
|
|
18368
19641
|
function TableAutoMergePanel({
|
|
18369
19642
|
element,
|
|
18370
19643
|
samples = [],
|
|
@@ -18417,7 +19690,7 @@ function TableAutoMergePanel({
|
|
|
18417
19690
|
reactPrintDesign.DataPathPicker,
|
|
18418
19691
|
{
|
|
18419
19692
|
label: `${label} ${index + 1}`,
|
|
18420
|
-
value:
|
|
19693
|
+
value: fieldPath2(value),
|
|
18421
19694
|
samples,
|
|
18422
19695
|
onChange: (path) => set(
|
|
18423
19696
|
values.map(
|
|
@@ -19000,16 +20273,19 @@ function TableColumnsPanel({
|
|
|
19000
20273
|
] });
|
|
19001
20274
|
}
|
|
19002
20275
|
function fixedTableWidth(columns) {
|
|
19003
|
-
return tableLeafColumns(columns).filter((column) => !column.hidden).reduce(
|
|
19004
|
-
column
|
|
19005
|
-
|
|
19006
|
-
|
|
20276
|
+
return tableLeafColumns(columns).filter((column) => !column.hidden).reduce(
|
|
20277
|
+
(sum, column) => sum + Math.min(
|
|
20278
|
+
column.maxWidth ?? Number.POSITIVE_INFINITY,
|
|
20279
|
+
Math.max(column.minWidth ?? 1, column.width ?? 100)
|
|
20280
|
+
),
|
|
20281
|
+
0
|
|
20282
|
+
) * 25.4 / 96;
|
|
19007
20283
|
}
|
|
19008
20284
|
function TableColumnsControl(context) {
|
|
19009
20285
|
if (context.element.type !== "table") return null;
|
|
19010
20286
|
const element = context.element;
|
|
19011
20287
|
const page = context.page;
|
|
19012
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
20288
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cc-print-design-column-control cc-print-design-field-full", children: [
|
|
19013
20289
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19014
20290
|
TableColumnsPanel,
|
|
19015
20291
|
{
|
|
@@ -19041,10 +20317,18 @@ function TableColumnsControl(context) {
|
|
|
19041
20317
|
{
|
|
19042
20318
|
icon: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.ReactPlusOutlined, { "aria-hidden": "true" }),
|
|
19043
20319
|
disabled: context.readonly,
|
|
19044
|
-
onClick: () => context.onChange({
|
|
19045
|
-
|
|
19046
|
-
|
|
19047
|
-
|
|
20320
|
+
onClick: () => context.onChange({
|
|
20321
|
+
columns: [
|
|
20322
|
+
...element.columns,
|
|
20323
|
+
{
|
|
20324
|
+
key: crypto.randomUUID(),
|
|
20325
|
+
title: "\u65B0\u5217",
|
|
20326
|
+
dataIndex: `field${element.columns.length + 1}`,
|
|
20327
|
+
cellType: "text",
|
|
20328
|
+
width: 100
|
|
20329
|
+
}
|
|
20330
|
+
]
|
|
20331
|
+
}),
|
|
19048
20332
|
children: "\u6DFB\u52A0\u5217"
|
|
19049
20333
|
}
|
|
19050
20334
|
),
|
|
@@ -19264,7 +20548,7 @@ var propertySections21 = [
|
|
|
19264
20548
|
// src/plugins/table/react.ts
|
|
19265
20549
|
var tablePlugin = defineBuiltinReactPlugin(tableNativePlugin, {
|
|
19266
20550
|
factory: tableFactory,
|
|
19267
|
-
menuGroups:
|
|
20551
|
+
menuGroups: menuGroups22,
|
|
19268
20552
|
contextMenu: tableContextMenu,
|
|
19269
20553
|
propertySections: propertySections21
|
|
19270
20554
|
});
|
|
@@ -19273,6 +20557,16 @@ var tablePlugin = defineBuiltinReactPlugin(tableNativePlugin, {
|
|
|
19273
20557
|
var pivotTableFactory = {
|
|
19274
20558
|
type: "pivotTable",
|
|
19275
20559
|
label: "\u900F\u89C6\u8868",
|
|
20560
|
+
agentCommands: [
|
|
20561
|
+
{
|
|
20562
|
+
name: "move-field",
|
|
20563
|
+
description: "\u79FB\u52A8\u900F\u89C6\u5B57\u6BB5\u3002payload: { fieldKey: \u5DF2\u6709\u5B57\u6BB5 key, area: filter|column|row|value, index?: \u4ECE 0 \u5F00\u59CB\u7684\u76EE\u6807\u4F4D\u7F6E, sourceArea?: \u539F\u533A\u57DF }\u3002"
|
|
20564
|
+
},
|
|
20565
|
+
{
|
|
20566
|
+
name: "remove-field",
|
|
20567
|
+
description: "\u4ECE\u900F\u89C6\u5E03\u5C40\u7684\u6240\u6709\u533A\u57DF\u79FB\u9664\u5B57\u6BB5\uFF0C\u4E0D\u5220\u9664\u5B57\u6BB5\u5B9A\u4E49\u3002payload: { fieldKey: \u5DF2\u6709\u5B57\u6BB5 key }\u3002"
|
|
20568
|
+
}
|
|
20569
|
+
],
|
|
19276
20570
|
defaultOverflowPolicy: "split",
|
|
19277
20571
|
showDataPanel: false,
|
|
19278
20572
|
tourFields: (element) => {
|
|
@@ -19330,7 +20624,7 @@ var pivotTableFactory = {
|
|
|
19330
20624
|
};
|
|
19331
20625
|
}
|
|
19332
20626
|
};
|
|
19333
|
-
var
|
|
20627
|
+
var menuGroups23 = [
|
|
19334
20628
|
{
|
|
19335
20629
|
id: "table",
|
|
19336
20630
|
title: "\u8868\u683C\u7EC4\u4EF6",
|
|
@@ -20035,7 +21329,7 @@ var pivotTablePlugin = defineBuiltinReactPlugin(
|
|
|
20035
21329
|
pivotTableNativePlugin,
|
|
20036
21330
|
{
|
|
20037
21331
|
factory: pivotTableFactory,
|
|
20038
|
-
menuGroups:
|
|
21332
|
+
menuGroups: menuGroups23,
|
|
20039
21333
|
propertySections: propertySections22
|
|
20040
21334
|
}
|
|
20041
21335
|
);
|
|
@@ -20044,6 +21338,20 @@ var pivotTablePlugin = defineBuiltinReactPlugin(
|
|
|
20044
21338
|
var ganttFactory = {
|
|
20045
21339
|
type: "gantt",
|
|
20046
21340
|
label: "\u7518\u7279\u56FE",
|
|
21341
|
+
agentCommands: [
|
|
21342
|
+
{
|
|
21343
|
+
name: "insert-task",
|
|
21344
|
+
description: "\u5728\u9759\u6001\u7518\u7279\u56FE\u9876\u5C42\u4EFB\u52A1\u5217\u8868\u63D2\u5165\u4EFB\u52A1\u3002payload: { index: 0 \u8D77\u59CB\u63D2\u5165\u4F4D\u7F6E, task: { id: \u552F\u4E00\u5B57\u7B26\u4E32, title: \u5B57\u7B26\u4E32, start?: \u65E5\u671F, end?: \u65E5\u671F, progress?: 0 \u5230 100, ... } }\u3002"
|
|
21345
|
+
},
|
|
21346
|
+
{
|
|
21347
|
+
name: "update-task",
|
|
21348
|
+
description: "\u4FEE\u6539\u9876\u5C42\u4EFB\u52A1\uFF0C\u4E0D\u80FD\u4FEE\u6539 id \u6216\u5D4C\u5957 tasks\u3002payload: { taskId: \u4EFB\u52A1 id, patch: { title?, start?, end?, progress?, color?, progressColor?, dependencies? } }\u3002"
|
|
21349
|
+
},
|
|
21350
|
+
{
|
|
21351
|
+
name: "remove-task",
|
|
21352
|
+
description: "\u79FB\u9664\u9759\u6001\u7518\u7279\u56FE\u9876\u5C42\u4EFB\u52A1\u3002payload: { taskId: \u4EFB\u52A1 id }\u3002"
|
|
21353
|
+
}
|
|
21354
|
+
],
|
|
20047
21355
|
showDataPanel: false,
|
|
20048
21356
|
tourFields: (element) => {
|
|
20049
21357
|
if (element.type !== "gantt") return [];
|
|
@@ -20096,7 +21404,7 @@ var ganttFactory = {
|
|
|
20096
21404
|
};
|
|
20097
21405
|
}
|
|
20098
21406
|
};
|
|
20099
|
-
var
|
|
21407
|
+
var menuGroups24 = [
|
|
20100
21408
|
{
|
|
20101
21409
|
id: "table",
|
|
20102
21410
|
title: "\u8868\u683C\u7EC4\u4EF6",
|
|
@@ -20470,7 +21778,7 @@ var propertySections23 = [
|
|
|
20470
21778
|
// src/plugins/gantt/react.ts
|
|
20471
21779
|
var ganttPlugin = defineBuiltinReactPlugin(ganttNativePlugin, {
|
|
20472
21780
|
factory: ganttFactory,
|
|
20473
|
-
menuGroups:
|
|
21781
|
+
menuGroups: menuGroups24,
|
|
20474
21782
|
propertySections: propertySections23
|
|
20475
21783
|
});
|
|
20476
21784
|
function formatTime(value) {
|
|
@@ -21244,6 +22552,7 @@ var pagePropertyPanels = new reactPrintDesign.PrintDesignScopedPropertyRegistry(
|
|
|
21244
22552
|
reactComponents.ReactButton,
|
|
21245
22553
|
{
|
|
21246
22554
|
"aria-pressed": settings?.showGrid ?? false,
|
|
22555
|
+
type: settings?.showGrid ? "primary" : "default",
|
|
21247
22556
|
disabled: readonly,
|
|
21248
22557
|
onClick: () => onSettingsChange?.({
|
|
21249
22558
|
showGrid: !(settings?.showGrid ?? false)
|
|
@@ -21383,9 +22692,9 @@ var themeSettingsSections = [{
|
|
|
21383
22692
|
render: ({ preferences }, readonly, onChange) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "cc-print-design-theme-options", role: "group", "aria-label": "\u7F16\u8F91\u5668\u4E3B\u9898", children: Object.keys(reactPrintDesign.editorThemes).map((key) => {
|
|
21384
22693
|
const theme = reactPrintDesign.editorThemes[key];
|
|
21385
22694
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
21386
|
-
|
|
22695
|
+
reactComponents.ReactButton,
|
|
21387
22696
|
{
|
|
21388
|
-
type: "
|
|
22697
|
+
type: (preferences.theme ?? "light") === key ? "primary" : "default",
|
|
21389
22698
|
className: "cc-print-design-theme-option",
|
|
21390
22699
|
"aria-pressed": (preferences.theme ?? "light") === key,
|
|
21391
22700
|
disabled: readonly,
|
|
@@ -21810,6 +23119,80 @@ var settingsInteractionTool = {
|
|
|
21810
23119
|
sectionId: "interaction",
|
|
21811
23120
|
settingsSections: interactionSettingsSections
|
|
21812
23121
|
};
|
|
23122
|
+
var keyboardMoveSettingsSections = [
|
|
23123
|
+
{
|
|
23124
|
+
sectionId: "keyboard-move",
|
|
23125
|
+
title: "\u952E\u76D8\u79FB\u52A8",
|
|
23126
|
+
fields: [
|
|
23127
|
+
{
|
|
23128
|
+
path: "canvas.keyboardMoveStep",
|
|
23129
|
+
label: "\u65B9\u5411\u952E\u6B65\u957F",
|
|
23130
|
+
kind: "number",
|
|
23131
|
+
persistence: "local",
|
|
23132
|
+
min: 1e-3,
|
|
23133
|
+
read: ({ settings, preferences }) => printDesign.toDisplayUnit(
|
|
23134
|
+
settings.keyboardMoveStep ?? 1,
|
|
23135
|
+
preferences.displayUnit
|
|
23136
|
+
),
|
|
23137
|
+
write: (value, { preferences }) => ({
|
|
23138
|
+
kind: "canvas",
|
|
23139
|
+
patch: {
|
|
23140
|
+
keyboardMoveStep: Math.max(
|
|
23141
|
+
0.01,
|
|
23142
|
+
printDesign.fromDisplayUnit(value, preferences.displayUnit)
|
|
23143
|
+
)
|
|
23144
|
+
}
|
|
23145
|
+
})
|
|
23146
|
+
},
|
|
23147
|
+
{
|
|
23148
|
+
path: "canvas.keyboardMoveAcceleration",
|
|
23149
|
+
label: "\u957F\u6309\u52A0\u901F",
|
|
23150
|
+
kind: "toggle",
|
|
23151
|
+
persistence: "local",
|
|
23152
|
+
onLabel: "\u5F00\u542F",
|
|
23153
|
+
offLabel: "\u5173\u95ED",
|
|
23154
|
+
read: ({ settings }) => settings.keyboardMoveAcceleration ?? false,
|
|
23155
|
+
write: (keyboardMoveAcceleration) => ({
|
|
23156
|
+
kind: "canvas",
|
|
23157
|
+
patch: { keyboardMoveAcceleration }
|
|
23158
|
+
})
|
|
23159
|
+
},
|
|
23160
|
+
{
|
|
23161
|
+
path: "help.keyboardMove",
|
|
23162
|
+
label: "\u64CD\u4F5C\u63D0\u793A",
|
|
23163
|
+
kind: "hint",
|
|
23164
|
+
persistence: "session",
|
|
23165
|
+
read: () => "\u9009\u4E2D\u7EC4\u4EF6\u540E\u7528\u65B9\u5411\u952E\u79FB\u52A8\uFF1B\u6309\u4F4F\u65B9\u5411\u952E\u8FDE\u7EED\u79FB\u52A8\uFF0C\u53EF\u914D\u7F6E\u662F\u5426\u52A0\u901F\uFF1B\u6309\u4F4F Shift \u53EF\u6309\u5341\u500D\u6B65\u957F\u79FB\u52A8\u3002"
|
|
23166
|
+
}
|
|
23167
|
+
]
|
|
23168
|
+
}
|
|
23169
|
+
];
|
|
23170
|
+
|
|
23171
|
+
// src/tools/settings-keyboard-move/react.tsx
|
|
23172
|
+
var settingsKeyboardMoveTool = {
|
|
23173
|
+
toolId: "builtin.settings.keyboard-move",
|
|
23174
|
+
version: "0.1.0",
|
|
23175
|
+
label: "\u952E\u76D8\u79FB\u52A8",
|
|
23176
|
+
order: 60,
|
|
23177
|
+
placement: "section",
|
|
23178
|
+
parentToolId: "builtin.settings",
|
|
23179
|
+
sectionId: "keyboard-move",
|
|
23180
|
+
settingsSections: keyboardMoveSettingsSections,
|
|
23181
|
+
resolveKeyboardMove(event, heldMs, settings) {
|
|
23182
|
+
const direction = {
|
|
23183
|
+
ArrowLeft: { dx: -1, dy: 0 },
|
|
23184
|
+
ArrowRight: { dx: 1, dy: 0 },
|
|
23185
|
+
ArrowUp: { dx: 0, dy: -1 },
|
|
23186
|
+
ArrowDown: { dx: 0, dy: 1 }
|
|
23187
|
+
}[event.key];
|
|
23188
|
+
if (!direction) return null;
|
|
23189
|
+
const configuredStep = settings.keyboardMoveStep ?? 1;
|
|
23190
|
+
const baseStep = Number.isFinite(configuredStep) && configuredStep > 0 ? configuredStep : 1;
|
|
23191
|
+
const acceleration = settings.keyboardMoveAcceleration === true ? heldMs >= 1800 ? 10 : heldMs >= 1e3 ? 5 : heldMs >= 500 ? 2 : 1 : 1;
|
|
23192
|
+
const step = baseStep * acceleration * (event.shiftKey ? 10 : 1);
|
|
23193
|
+
return { dx: direction.dx * step, dy: direction.dy * step };
|
|
23194
|
+
}
|
|
23195
|
+
};
|
|
21813
23196
|
|
|
21814
23197
|
// src/tools/settings-indicators/properties.ts
|
|
21815
23198
|
var indicatorSettingsSections = [{
|
|
@@ -21901,11 +23284,13 @@ var builtinReactTools = [
|
|
|
21901
23284
|
settingsRulersTool,
|
|
21902
23285
|
settingsGuidesTool,
|
|
21903
23286
|
settingsInteractionTool,
|
|
23287
|
+
settingsKeyboardMoveTool,
|
|
21904
23288
|
settingsIndicatorsTool,
|
|
21905
23289
|
pluginmarketTool
|
|
21906
23290
|
];
|
|
21907
23291
|
var builtinReactComponentPlugins = [
|
|
21908
23292
|
textPlugin,
|
|
23293
|
+
richTextPlugin,
|
|
21909
23294
|
listPlugin,
|
|
21910
23295
|
dateTimePlugin,
|
|
21911
23296
|
moneyUpperPlugin,
|
|
@@ -21929,17 +23314,17 @@ var builtinReactComponentPlugins = [
|
|
|
21929
23314
|
pivotTablePlugin,
|
|
21930
23315
|
ganttPlugin
|
|
21931
23316
|
];
|
|
21932
|
-
var
|
|
23317
|
+
var menuGroups25 = /* @__PURE__ */ new Map();
|
|
21933
23318
|
for (const plugin of builtinReactComponentPlugins) {
|
|
21934
23319
|
for (const group of plugin.menuGroups) {
|
|
21935
|
-
const current2 =
|
|
23320
|
+
const current2 = menuGroups25.get(group.id);
|
|
21936
23321
|
if (current2) {
|
|
21937
23322
|
if (current2.title !== group.title || current2.order !== group.order) {
|
|
21938
23323
|
throw new Error(`\u83DC\u5355\u5206\u7EC4\u5B9A\u4E49\u4E0D\u4E00\u81F4\uFF1A${group.id}`);
|
|
21939
23324
|
}
|
|
21940
23325
|
current2.items.push(...group.items);
|
|
21941
23326
|
} else {
|
|
21942
|
-
|
|
23327
|
+
menuGroups25.set(group.id, { ...group, items: [...group.items] });
|
|
21943
23328
|
}
|
|
21944
23329
|
}
|
|
21945
23330
|
}
|
|
@@ -21980,7 +23365,7 @@ var builtinPrintDesignPlugins = Object.freeze({
|
|
|
21980
23365
|
componentFactories: new reactPrintDesign.PrintDesignComponentFactoryRegistry(
|
|
21981
23366
|
builtinReactComponentPlugins.map((plugin) => plugin.factory)
|
|
21982
23367
|
),
|
|
21983
|
-
componentMenu: [...
|
|
23368
|
+
componentMenu: [...menuGroups25.values()].sort((a, b) => a.order - b.order).map((group) => ({
|
|
21984
23369
|
id: group.id,
|
|
21985
23370
|
title: group.title,
|
|
21986
23371
|
items: group.items.sort((a, b) => a.order - b.order)
|