@hankchen/canvas-editor-react 0.0.0-stage → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +157 -2
- package/dist/DropdownMenu-CCvv55NI.js +967 -0
- package/dist/PanelIcon-cQ-hx-Ky.js +87 -0
- package/dist/Tooltip-BAFJN0xP.js +815 -0
- package/dist/canvas/AlignFloatBar.d.ts +6 -0
- package/dist/canvas/CanvasSurface.d.ts +13 -0
- package/dist/canvas/ContextMenu.d.ts +14 -0
- package/dist/canvas/EditOverlayToolbar.d.ts +30 -0
- package/dist/canvas/FindBar.d.ts +13 -0
- package/dist/canvas/GuidesOverlay.d.ts +19 -0
- package/dist/canvas/Ruler.d.ts +32 -0
- package/dist/canvas/TextEditingOverlay.d.ts +22 -0
- package/dist/canvas/createBand.d.ts +6 -0
- package/dist/canvas/findHighlight.d.ts +12 -0
- package/dist/canvas/gizmo.d.ts +24 -0
- package/dist/canvas/guideSnap.d.ts +5 -0
- package/dist/canvas/index.d.ts +24 -0
- package/dist/canvas/resizeHandles.d.ts +3 -0
- package/dist/canvas/scheduler.d.ts +2 -0
- package/dist/canvas/useDpr.d.ts +9 -0
- package/dist/canvas/useFindSession.d.ts +12 -0
- package/dist/canvas/useTextEditing.d.ts +90 -0
- package/dist/canvas-jJ7OaUvZ.js +2171 -0
- package/dist/canvas.js +2 -0
- package/dist/chevron-down-D0_YGxvV.js +359 -0
- package/dist/createLucideIcon-CLd1sc0f.js +140 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +16 -0
- package/dist/layer-panel/LayerPanel.d.ts +6 -0
- package/dist/layer-panel/TemplateTableForm.d.ts +10 -0
- package/dist/layer-panel/addMenu.d.ts +68 -0
- package/dist/layer-panel/index.d.ts +11 -0
- package/dist/layer-panel/useLayerPanel.d.ts +12 -0
- package/dist/layer-panel-DIfOb40N.js +779 -0
- package/dist/layer-panel.js +2 -0
- package/dist/mergeKey--xr8gdWl.js +694 -0
- package/dist/property-panel/PropertyField.d.ts +39 -0
- package/dist/property-panel/PropertyPanel.d.ts +5 -0
- package/dist/property-panel/controlStyles.d.ts +17 -0
- package/dist/property-panel/controls.d.ts +42 -0
- package/dist/property-panel/fieldSchema.d.ts +142 -0
- package/dist/property-panel/fields/AlignField.d.ts +3 -0
- package/dist/property-panel/fields/AnchorDisclosureField.d.ts +3 -0
- package/dist/property-panel/fields/BooleanField.d.ts +3 -0
- package/dist/property-panel/fields/BorderField.d.ts +3 -0
- package/dist/property-panel/fields/BorderWidthInput.d.ts +9 -0
- package/dist/property-panel/fields/ColorField.d.ts +3 -0
- package/dist/property-panel/fields/FontField.d.ts +3 -0
- package/dist/property-panel/fields/ImageSrcField.d.ts +3 -0
- package/dist/property-panel/fields/NumberField.d.ts +3 -0
- package/dist/property-panel/fields/PaddingField.d.ts +3 -0
- package/dist/property-panel/fields/PairField.d.ts +3 -0
- package/dist/property-panel/fields/ResourceValueField.d.ts +3 -0
- package/dist/property-panel/fields/RowsPathField.d.ts +3 -0
- package/dist/property-panel/fields/SelectField.d.ts +3 -0
- package/dist/property-panel/fields/ShorthandModeButton.d.ts +7 -0
- package/dist/property-panel/fields/TextField.d.ts +3 -0
- package/dist/property-panel/fields/TextareaField.d.ts +3 -0
- package/dist/property-panel/fields/ValueTypeSegmented.d.ts +8 -0
- package/dist/property-panel/fields/index.d.ts +18 -0
- package/dist/property-panel/fields/intrinsicSize.d.ts +9 -0
- package/dist/property-panel/imageUpload.d.ts +11 -0
- package/dist/property-panel/index.d.ts +14 -0
- package/dist/property-panel/shorthand.d.ts +28 -0
- package/dist/property-panel/usePropertyPanel.d.ts +67 -0
- package/dist/property-panel/useShorthandMode.d.ts +17 -0
- package/dist/property-panel-DD45Myee.js +1861 -0
- package/dist/property-panel.js +3 -0
- package/dist/resourceTemplate-B4QRWGq7.js +33 -0
- package/dist/shared/DropdownMenu.d.ts +18 -0
- package/dist/shared/ExpressionCompletionPopup.d.ts +11 -0
- package/dist/shared/ExpressionPathPicker.d.ts +23 -0
- package/dist/shared/HelpDialog.d.ts +10 -0
- package/dist/shared/PanelIcon.d.ts +11 -0
- package/dist/shared/Tooltip.d.ts +11 -0
- package/dist/shared/completion.d.ts +73 -0
- package/dist/shared/completionAnchor.d.ts +28 -0
- package/dist/shared/editableTarget.d.ts +14 -0
- package/dist/shared/expressionContext.d.ts +22 -0
- package/dist/shared/fontPicker.d.ts +13 -0
- package/dist/shared/index.d.ts +42 -0
- package/dist/shared/mergeKey.d.ts +2 -0
- package/dist/shared/pathPickerModel.d.ts +24 -0
- package/dist/shared/popupPosition.d.ts +41 -0
- package/dist/shared/resourceTemplate.d.ts +7 -0
- package/dist/shared/rowsPathPickerSource.d.ts +15 -0
- package/dist/shared/shortcutsHelp.d.ts +30 -0
- package/dist/shared/uploadFile.d.ts +2 -0
- package/dist/shared/useCnTheme.d.ts +11 -0
- package/dist/shared/useDataSourceSchema.d.ts +10 -0
- package/dist/shared/useDoc.d.ts +2 -0
- package/dist/shared/useDocumentExchange.d.ts +21 -0
- package/dist/shared/useDropdownMenu.d.ts +163 -0
- package/dist/shared/useExpressionCompletion.d.ts +35 -0
- package/dist/shared/useExpressionDiagnostics.d.ts +29 -0
- package/dist/shared/useHistory.d.ts +6 -0
- package/dist/shared/useSelection.d.ts +2 -0
- package/dist/shared/useShortcuts.d.ts +2 -0
- package/dist/shared/useShortcutsHelp.d.ts +8 -0
- package/dist/shared/useTransientFeedback.d.ts +9 -0
- package/dist/shared/useViewport.d.ts +2 -0
- package/dist/shared-QI04Xk-a.js +236 -0
- package/dist/shared.js +9 -0
- package/dist/status-bar/StatusBar.d.ts +14 -0
- package/dist/status-bar/index.d.ts +9 -0
- package/dist/status-bar/layerGeometryLabel.d.ts +13 -0
- package/dist/status-bar/layerPathLabel.d.ts +2 -0
- package/dist/status-bar-Bt3TonDm.js +181 -0
- package/dist/status-bar.js +2 -0
- package/dist/style.css +2 -0
- package/dist/theme.css +420 -0
- package/dist/useDoc-B2LXNJV7.js +32 -0
- package/dist/useViewport-DXtOHYgJ.js +18 -0
- package/package.json +83 -3
|
@@ -0,0 +1,779 @@
|
|
|
1
|
+
import { a as e, i as t, n, t as r } from "./PanelIcon-cQ-hx-Ky.js";
|
|
2
|
+
import { n as i, p as a, s as o, t as s } from "./Tooltip-BAFJN0xP.js";
|
|
3
|
+
import { f as c, i as l, l as u, o as d, r as ee, t as te, u as f } from "./DropdownMenu-CCvv55NI.js";
|
|
4
|
+
import { t as p } from "./createLucideIcon-CLd1sc0f.js";
|
|
5
|
+
import { useCallback as m, useEffect as ne, useMemo as h, useRef as g, useState as _, useSyncExternalStore as v } from "react";
|
|
6
|
+
import { jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
7
|
+
//#region ../canvas-editor/src/editing/layerPanel.ts
|
|
8
|
+
function x(e) {
|
|
9
|
+
switch (e.type) {
|
|
10
|
+
case "TableLayer": return e.template === null ? [{
|
|
11
|
+
key: "rows",
|
|
12
|
+
layers: e.rows
|
|
13
|
+
}] : [{
|
|
14
|
+
key: "template",
|
|
15
|
+
layers: [e.template]
|
|
16
|
+
}];
|
|
17
|
+
case "TableRowLayer": return [{
|
|
18
|
+
key: "cells",
|
|
19
|
+
layers: e.cells
|
|
20
|
+
}];
|
|
21
|
+
case "TableCellLayer": return e.content ? [{
|
|
22
|
+
key: "content",
|
|
23
|
+
layers: [e.content]
|
|
24
|
+
}] : [];
|
|
25
|
+
case "ImageLayer":
|
|
26
|
+
case "TextLayer":
|
|
27
|
+
case "QrCodeLayer": return [];
|
|
28
|
+
case "TableRowTemplate": return [{
|
|
29
|
+
key: "cells",
|
|
30
|
+
layers: e.cells
|
|
31
|
+
}];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function S(e) {
|
|
35
|
+
switch (e.type) {
|
|
36
|
+
case "TextLayer":
|
|
37
|
+
case "ImageLayer":
|
|
38
|
+
case "QrCodeLayer": return e.expression;
|
|
39
|
+
default: return null;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
var C = "{{…}}";
|
|
43
|
+
function w(e) {
|
|
44
|
+
let t = S(e);
|
|
45
|
+
if (t === null) return "";
|
|
46
|
+
let n = a(t).parts.flatMap((e) => e.kind === "fragment" && e.expr !== "" ? [e.expr] : []);
|
|
47
|
+
return n.length === 0 ? C : n.map((e) => `{{${e}}}`).join(" ");
|
|
48
|
+
}
|
|
49
|
+
function T(e, t, r, i) {
|
|
50
|
+
let a = [];
|
|
51
|
+
for (let { key: n, layers: r } of x(e)) for (let e = 0; e < r.length; e += 1) {
|
|
52
|
+
let o = n === "rows" ? "row" : n === "cells" ? "cell" : n === "template" ? "templateRow" : "content", s = n === "content" ? [...t, "content"] : n === "template" ? [...t, "template"] : [
|
|
53
|
+
...t,
|
|
54
|
+
n,
|
|
55
|
+
e
|
|
56
|
+
];
|
|
57
|
+
a.push(T(r[e], s, o, i));
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
type: e.type,
|
|
61
|
+
path: t,
|
|
62
|
+
role: r,
|
|
63
|
+
name: e.name,
|
|
64
|
+
visible: e.visible,
|
|
65
|
+
locked: n(t, i),
|
|
66
|
+
expressionPrefix: w(e),
|
|
67
|
+
...e.type === "TableLayer" ? { templated: e.template !== null } : null,
|
|
68
|
+
children: a
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function E(e, t = []) {
|
|
72
|
+
let n = [];
|
|
73
|
+
for (let r = e.layers.length - 1; r >= 0; --r) n.push(T(e.layers[r], ["layers", r], "root", t));
|
|
74
|
+
return n;
|
|
75
|
+
}
|
|
76
|
+
var D = [
|
|
77
|
+
{
|
|
78
|
+
id: "heading",
|
|
79
|
+
fontSize: 40
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
id: "subheading",
|
|
83
|
+
fontSize: 28
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
id: "body",
|
|
87
|
+
fontSize: 16
|
|
88
|
+
}
|
|
89
|
+
], O = [
|
|
90
|
+
{
|
|
91
|
+
id: "free",
|
|
92
|
+
ratio: null
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
id: "1:1",
|
|
96
|
+
ratio: {
|
|
97
|
+
w: 1,
|
|
98
|
+
h: 1
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
id: "4:3",
|
|
103
|
+
ratio: {
|
|
104
|
+
w: 4,
|
|
105
|
+
h: 3
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
id: "3:4",
|
|
110
|
+
ratio: {
|
|
111
|
+
w: 3,
|
|
112
|
+
h: 4
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
id: "16:9",
|
|
117
|
+
ratio: {
|
|
118
|
+
w: 16,
|
|
119
|
+
h: 9
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
id: "9:16",
|
|
124
|
+
ratio: {
|
|
125
|
+
w: 9,
|
|
126
|
+
h: 16
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
], k = {
|
|
130
|
+
name: "eye-off",
|
|
131
|
+
size: 24,
|
|
132
|
+
node: [
|
|
133
|
+
["path", {
|
|
134
|
+
d: "M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",
|
|
135
|
+
key: "ct8e1f"
|
|
136
|
+
}],
|
|
137
|
+
["path", {
|
|
138
|
+
d: "M14.084 14.158a3 3 0 0 1-4.242-4.242",
|
|
139
|
+
key: "151rxh"
|
|
140
|
+
}],
|
|
141
|
+
["path", {
|
|
142
|
+
d: "M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",
|
|
143
|
+
key: "13bj9a"
|
|
144
|
+
}],
|
|
145
|
+
["path", {
|
|
146
|
+
d: "m2 2 20 20",
|
|
147
|
+
key: "1ooewy"
|
|
148
|
+
}]
|
|
149
|
+
]
|
|
150
|
+
};
|
|
151
|
+
k.node;
|
|
152
|
+
var re = p(k), A = {
|
|
153
|
+
name: "eye",
|
|
154
|
+
size: 24,
|
|
155
|
+
node: [["path", {
|
|
156
|
+
d: "M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",
|
|
157
|
+
key: "1nclc0"
|
|
158
|
+
}], ["circle", {
|
|
159
|
+
cx: "12",
|
|
160
|
+
cy: "12",
|
|
161
|
+
r: "3",
|
|
162
|
+
key: "1v7zrd"
|
|
163
|
+
}]]
|
|
164
|
+
};
|
|
165
|
+
A.node;
|
|
166
|
+
var ie = p(A), j = {
|
|
167
|
+
name: "grip-vertical",
|
|
168
|
+
size: 24,
|
|
169
|
+
node: [
|
|
170
|
+
["circle", {
|
|
171
|
+
cx: "9",
|
|
172
|
+
cy: "12",
|
|
173
|
+
r: "1",
|
|
174
|
+
key: "1vctgf"
|
|
175
|
+
}],
|
|
176
|
+
["circle", {
|
|
177
|
+
cx: "9",
|
|
178
|
+
cy: "5",
|
|
179
|
+
r: "1",
|
|
180
|
+
key: "hp0tcf"
|
|
181
|
+
}],
|
|
182
|
+
["circle", {
|
|
183
|
+
cx: "9",
|
|
184
|
+
cy: "19",
|
|
185
|
+
r: "1",
|
|
186
|
+
key: "fkjjf6"
|
|
187
|
+
}],
|
|
188
|
+
["circle", {
|
|
189
|
+
cx: "15",
|
|
190
|
+
cy: "12",
|
|
191
|
+
r: "1",
|
|
192
|
+
key: "1tmaij"
|
|
193
|
+
}],
|
|
194
|
+
["circle", {
|
|
195
|
+
cx: "15",
|
|
196
|
+
cy: "5",
|
|
197
|
+
r: "1",
|
|
198
|
+
key: "19l28e"
|
|
199
|
+
}],
|
|
200
|
+
["circle", {
|
|
201
|
+
cx: "15",
|
|
202
|
+
cy: "19",
|
|
203
|
+
r: "1",
|
|
204
|
+
key: "f4zoj3"
|
|
205
|
+
}]
|
|
206
|
+
]
|
|
207
|
+
};
|
|
208
|
+
j.node;
|
|
209
|
+
var ae = p(j), M = {
|
|
210
|
+
name: "lock-open",
|
|
211
|
+
size: 24,
|
|
212
|
+
node: [["rect", {
|
|
213
|
+
width: "18",
|
|
214
|
+
height: "11",
|
|
215
|
+
x: "3",
|
|
216
|
+
y: "11",
|
|
217
|
+
rx: "2",
|
|
218
|
+
ry: "2",
|
|
219
|
+
key: "1w4ew1"
|
|
220
|
+
}], ["path", {
|
|
221
|
+
d: "M7 11V7a5 5 0 0 1 9.9-1",
|
|
222
|
+
key: "1mm8w8"
|
|
223
|
+
}]],
|
|
224
|
+
aliases: ["unlock"]
|
|
225
|
+
};
|
|
226
|
+
M.node;
|
|
227
|
+
var oe = p(M), N = {
|
|
228
|
+
name: "lock",
|
|
229
|
+
size: 24,
|
|
230
|
+
node: [["rect", {
|
|
231
|
+
width: "18",
|
|
232
|
+
height: "11",
|
|
233
|
+
x: "3",
|
|
234
|
+
y: "11",
|
|
235
|
+
rx: "2",
|
|
236
|
+
ry: "2",
|
|
237
|
+
key: "1w4ew1"
|
|
238
|
+
}], ["path", {
|
|
239
|
+
d: "M7 11V7a5 5 0 0 1 10 0v4",
|
|
240
|
+
key: "fwvmzm"
|
|
241
|
+
}]]
|
|
242
|
+
};
|
|
243
|
+
N.node;
|
|
244
|
+
var se = p(N), P = {
|
|
245
|
+
name: "pencil",
|
|
246
|
+
size: 24,
|
|
247
|
+
node: [["path", {
|
|
248
|
+
d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",
|
|
249
|
+
key: "1a8usu"
|
|
250
|
+
}], ["path", {
|
|
251
|
+
d: "m15 5 4 4",
|
|
252
|
+
key: "1mk7zo"
|
|
253
|
+
}]]
|
|
254
|
+
};
|
|
255
|
+
P.node;
|
|
256
|
+
var ce = p(P), F = [
|
|
257
|
+
{
|
|
258
|
+
kind: "layer",
|
|
259
|
+
type: "TextLayer",
|
|
260
|
+
label: "文本层",
|
|
261
|
+
title: "画拉建文本层(点击后在画布拖拽定落位与尺寸,Esc 取消)"
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
kind: "layer",
|
|
265
|
+
type: "ImageLayer",
|
|
266
|
+
label: "图片层",
|
|
267
|
+
title: "画拉建图片层(点击后在画布拖拽定落位与尺寸,Esc 取消)"
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
kind: "layer",
|
|
271
|
+
type: "QrCodeLayer",
|
|
272
|
+
label: "二维码层",
|
|
273
|
+
title: "画拉建二维码层(点击后在画布拖拽定落位与尺寸,恒方形,Esc 取消)"
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
kind: "layer",
|
|
277
|
+
type: "TableLayer",
|
|
278
|
+
label: "表格",
|
|
279
|
+
title: "画拉建表格(点击后在画布拖拽定落位与尺寸,Esc 取消)"
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
kind: "template-table",
|
|
283
|
+
label: "模板表",
|
|
284
|
+
title: "新增模板表(行模板 + 数据行展开)"
|
|
285
|
+
}
|
|
286
|
+
], I = {
|
|
287
|
+
heading: "标题",
|
|
288
|
+
subheading: "副标题",
|
|
289
|
+
body: "正文"
|
|
290
|
+
}, L = D.map(({ id: e, fontSize: t }) => ({
|
|
291
|
+
kind: "text-preset",
|
|
292
|
+
preset: e,
|
|
293
|
+
label: I[e],
|
|
294
|
+
shortcut: `${t}号`,
|
|
295
|
+
title: `画拉建${I[e]}文本层(字号 ${t},点击后在画布拖拽定落位与尺寸,Esc 取消)`
|
|
296
|
+
}));
|
|
297
|
+
function R(e) {
|
|
298
|
+
return e === null ? "任意宽高" : e.w === e.h ? "正方形" : e.w > e.h ? "横向" : "纵向";
|
|
299
|
+
}
|
|
300
|
+
var z = O.flatMap(({ id: e, ratio: t }) => e === "free" ? [] : [{
|
|
301
|
+
kind: "ratio-preset",
|
|
302
|
+
preset: e,
|
|
303
|
+
label: e,
|
|
304
|
+
shortcut: R(t),
|
|
305
|
+
title: `画拉建 ${e} 图片层(${R(t)},画拉中按住 Shift 临时自由;点击后在画布拖拽定落位与尺寸,Esc 取消)`
|
|
306
|
+
}]), B = F.map((e) => e.kind === "layer" ? e.type === "TextLayer" ? {
|
|
307
|
+
...e,
|
|
308
|
+
children: L
|
|
309
|
+
} : e.type === "ImageLayer" ? {
|
|
310
|
+
...e,
|
|
311
|
+
children: z
|
|
312
|
+
} : e : e), V = F;
|
|
313
|
+
function le(e, t) {
|
|
314
|
+
return `画拉建${e}(${t}),${d}`;
|
|
315
|
+
}
|
|
316
|
+
//#endregion
|
|
317
|
+
//#region src/layer-panel/TemplateTableForm.tsx
|
|
318
|
+
function H({ editor: e, onConfirm: t, onCancel: n }) {
|
|
319
|
+
let [r, a] = _("");
|
|
320
|
+
function s() {
|
|
321
|
+
r !== "" && t(r);
|
|
322
|
+
}
|
|
323
|
+
let c = l(e), u = h(() => o(c), [c]);
|
|
324
|
+
return /* @__PURE__ */ b("div", { children: [
|
|
325
|
+
/* @__PURE__ */ y("p", {
|
|
326
|
+
className: "px-2 pt-1 text-[11px] leading-4 text-cn-muted",
|
|
327
|
+
children: "模板行按取行路径展开成表"
|
|
328
|
+
}),
|
|
329
|
+
/* @__PURE__ */ y("div", {
|
|
330
|
+
"data-template-rows-path": "",
|
|
331
|
+
className: "mx-1 my-1",
|
|
332
|
+
children: /* @__PURE__ */ y(i, {
|
|
333
|
+
modelValue: r,
|
|
334
|
+
onPick: a,
|
|
335
|
+
mode: "rowsPath",
|
|
336
|
+
source: u,
|
|
337
|
+
ariaLabel: "取行路径",
|
|
338
|
+
placeholder: "未选择行路径"
|
|
339
|
+
})
|
|
340
|
+
}),
|
|
341
|
+
/* @__PURE__ */ b("div", {
|
|
342
|
+
className: "flex gap-1 p-1",
|
|
343
|
+
children: [/* @__PURE__ */ y("button", {
|
|
344
|
+
type: "button",
|
|
345
|
+
"data-template-confirm": "",
|
|
346
|
+
disabled: r === "",
|
|
347
|
+
className: "flex-1 rounded bg-cn-accent/20 px-2 py-1 text-[12px] text-cn-accent hover:bg-cn-accent/30 disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-cn-accent/20",
|
|
348
|
+
onClick: s,
|
|
349
|
+
children: "创建"
|
|
350
|
+
}), /* @__PURE__ */ y("button", {
|
|
351
|
+
type: "button",
|
|
352
|
+
"data-template-cancel": "",
|
|
353
|
+
className: "flex-1 rounded px-2 py-1 text-[12px] text-cn-muted hover:text-cn-fg",
|
|
354
|
+
onClick: n,
|
|
355
|
+
children: "取消"
|
|
356
|
+
})]
|
|
357
|
+
})
|
|
358
|
+
] });
|
|
359
|
+
}
|
|
360
|
+
//#endregion
|
|
361
|
+
//#region src/layer-panel/useLayerPanel.ts
|
|
362
|
+
var U = (e) => e.scope === "doc", W = (e) => e.scope === "doc" || e.scope === "ui" && e.branch === "selection", G = (e) => e.scope === "doc" || e.scope === "ui" && e.branch === "hovered", K = (e) => e.scope === "doc" || e.scope === "ui" && e.branch === "renaming", q = (e) => e.scope === "doc" || e.scope === "ui" && e.branch === "lockedPaths";
|
|
363
|
+
function J(e, t, n) {
|
|
364
|
+
let r = m((t) => e.subscribe((e) => {
|
|
365
|
+
n(e) && t();
|
|
366
|
+
}), [e, n]), i = m(t, [e, t]);
|
|
367
|
+
return v(r, i);
|
|
368
|
+
}
|
|
369
|
+
function Y(e) {
|
|
370
|
+
let t = J(e, () => e.store.doc, U), n = J(e, () => e.store.ui.selection, W), r = J(e, () => e.store.ui.hovered, G), i = J(e, () => e.store.ui.renaming, K), a = J(e, () => e.store.ui.lockedPaths, q);
|
|
371
|
+
return {
|
|
372
|
+
outline: h(() => t === null ? [] : E(t, a), [t, a]),
|
|
373
|
+
selection: n,
|
|
374
|
+
hovered: r,
|
|
375
|
+
renaming: i
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
function X(e, t) {
|
|
379
|
+
return t > 0 && e < t / 2;
|
|
380
|
+
}
|
|
381
|
+
//#endregion
|
|
382
|
+
//#region src/layer-panel/LayerPanel.tsx
|
|
383
|
+
var ue = `解锁图层(${f("toggleLayerLock", u())})`, de = `图层已锁定(${f("toggleLayerLock", u())} 解锁后可删除)`;
|
|
384
|
+
function fe(e, t) {
|
|
385
|
+
switch (e.role) {
|
|
386
|
+
case "root": return e.name === "" ? `${e.type} ${t}` : e.name;
|
|
387
|
+
case "row": return `行 ${Number(e.path[e.path.length - 1]) + 1}`;
|
|
388
|
+
case "templateRow": return "⌗ 行模板";
|
|
389
|
+
case "cell": return `格 ${Number(e.path[e.path.length - 1]) + 1}`;
|
|
390
|
+
case "content": return e.type;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
function Z({ editor: n }) {
|
|
394
|
+
let i = Y(n), a = l(n), o = c(), [u, f] = _(!1), p = h(() => u ? [] : B.map((e) => {
|
|
395
|
+
if (e.kind === "template-table") {
|
|
396
|
+
let t = a === null;
|
|
397
|
+
return {
|
|
398
|
+
label: e.label,
|
|
399
|
+
title: t ? ee : e.title,
|
|
400
|
+
disabled: t,
|
|
401
|
+
dataAttrs: { "data-add-layer": "template-table" },
|
|
402
|
+
keepsOpen: !0,
|
|
403
|
+
run: () => {
|
|
404
|
+
f(!0);
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
let t = { "data-add-layer": e.type }, r = () => {
|
|
409
|
+
n.armLayerCreate(e.type), o.show(d);
|
|
410
|
+
};
|
|
411
|
+
return e.children === void 0 ? {
|
|
412
|
+
label: e.label,
|
|
413
|
+
title: e.title,
|
|
414
|
+
dataAttrs: t,
|
|
415
|
+
run: r
|
|
416
|
+
} : {
|
|
417
|
+
kind: "submenu",
|
|
418
|
+
label: e.label,
|
|
419
|
+
title: e.title,
|
|
420
|
+
dataAttrs: t,
|
|
421
|
+
run: r,
|
|
422
|
+
children: e.children.map((t) => ({
|
|
423
|
+
label: t.label,
|
|
424
|
+
title: t.title,
|
|
425
|
+
shortcut: t.shortcut,
|
|
426
|
+
dataAttrs: {
|
|
427
|
+
"data-add-layer": e.type,
|
|
428
|
+
...t.kind === "text-preset" ? { "data-text-preset": t.preset } : { "data-ratio-preset": t.preset }
|
|
429
|
+
},
|
|
430
|
+
run: () => {
|
|
431
|
+
n.armLayerCreate(e.type, t.preset), o.show(le(e.label, t.label));
|
|
432
|
+
}
|
|
433
|
+
}))
|
|
434
|
+
};
|
|
435
|
+
}), [
|
|
436
|
+
n,
|
|
437
|
+
a,
|
|
438
|
+
u
|
|
439
|
+
]);
|
|
440
|
+
function m(e, t) {
|
|
441
|
+
n.armTemplateTableCreate(e), o.show(d), t();
|
|
442
|
+
}
|
|
443
|
+
function v(e) {
|
|
444
|
+
f(!1), e();
|
|
445
|
+
}
|
|
446
|
+
function x() {
|
|
447
|
+
f(!1);
|
|
448
|
+
}
|
|
449
|
+
let S = h(() => {
|
|
450
|
+
let e = [], n = /* @__PURE__ */ new Map();
|
|
451
|
+
function r(i, a, o, s) {
|
|
452
|
+
let c = i.role === "row" ? i.path.slice(0, -2) : i.role === "templateRow" ? i.path.slice(0, -1) : s, l = 0;
|
|
453
|
+
i.role === "root" && (l = (n.get(i.type) ?? 0) + 1, n.set(i.type, l)), e.push({
|
|
454
|
+
key: i.path.join("."),
|
|
455
|
+
node: i,
|
|
456
|
+
indentLevel: a,
|
|
457
|
+
label: fe(i, l),
|
|
458
|
+
indexInGroup: o,
|
|
459
|
+
tablePath: c,
|
|
460
|
+
inTemplate: t(i.path),
|
|
461
|
+
draggable: i.role === "root" || i.role === "row" || i.role === "cell"
|
|
462
|
+
}), i.children.forEach((e, t) => r(e, a + 1, t, c));
|
|
463
|
+
}
|
|
464
|
+
return i.outline.forEach((e, t) => r(e, 0, t, null)), e;
|
|
465
|
+
}, [i.outline]), C = S.length > 0;
|
|
466
|
+
function w(e) {
|
|
467
|
+
n.setSelection(e.node.path);
|
|
468
|
+
}
|
|
469
|
+
function T(e) {
|
|
470
|
+
n.setHovered(e === null ? null : e.node.path);
|
|
471
|
+
}
|
|
472
|
+
function E(e) {
|
|
473
|
+
n.addTableRow(e.node.path);
|
|
474
|
+
}
|
|
475
|
+
function D(e) {
|
|
476
|
+
n.addTableCell(e.node.path);
|
|
477
|
+
}
|
|
478
|
+
function O(e) {
|
|
479
|
+
n.addTemplateCell(e.node.path.slice(0, -1));
|
|
480
|
+
}
|
|
481
|
+
function k(e) {
|
|
482
|
+
n.deleteLayer(e.node.path);
|
|
483
|
+
}
|
|
484
|
+
function A(e) {
|
|
485
|
+
n.toggleLayerVisibility(e.node.path);
|
|
486
|
+
}
|
|
487
|
+
function j(e) {
|
|
488
|
+
n.toggleLayerLock(e.node.path);
|
|
489
|
+
}
|
|
490
|
+
let M = g(null), [N, P] = _(null);
|
|
491
|
+
function F(n) {
|
|
492
|
+
let r = M.current;
|
|
493
|
+
if (r === null) return !1;
|
|
494
|
+
if (r.kind === "root") return n.node.role === "root";
|
|
495
|
+
if (r.kind === "row") return n.node.role === "row";
|
|
496
|
+
if (n.node.role !== "cell") return !1;
|
|
497
|
+
let i = t(r.cellPath);
|
|
498
|
+
return i === n.inTemplate ? !i || e(r.cellPath.slice(0, -2), n.node.path.slice(0, -2)) : !1;
|
|
499
|
+
}
|
|
500
|
+
function I(e) {
|
|
501
|
+
return e.node.role === "root";
|
|
502
|
+
}
|
|
503
|
+
function L(e, t) {
|
|
504
|
+
e.draggable !== !1 && (M.current = e.node.role === "root" ? {
|
|
505
|
+
kind: "root",
|
|
506
|
+
from: e.indexInGroup
|
|
507
|
+
} : e.node.role === "row" ? {
|
|
508
|
+
kind: "row",
|
|
509
|
+
from: e.indexInGroup,
|
|
510
|
+
tablePath: e.tablePath ?? [],
|
|
511
|
+
rowPath: e.node.path
|
|
512
|
+
} : {
|
|
513
|
+
kind: "cell",
|
|
514
|
+
from: e.indexInGroup,
|
|
515
|
+
cellPath: e.node.path
|
|
516
|
+
}, t.dataTransfer?.setData("text/plain", e.key), t.dataTransfer !== null && t.dataTransfer !== void 0 && (t.dataTransfer.effectAllowed = "move"));
|
|
517
|
+
}
|
|
518
|
+
function R(e, t) {
|
|
519
|
+
I(e) || L(e, t);
|
|
520
|
+
}
|
|
521
|
+
function z(e) {
|
|
522
|
+
if (!I(e)) return e.draggable === !0 || void 0;
|
|
523
|
+
}
|
|
524
|
+
function V(e, t) {
|
|
525
|
+
if (F(e) === !1) return;
|
|
526
|
+
let n = t.currentTarget;
|
|
527
|
+
if (!(n instanceof HTMLElement)) return;
|
|
528
|
+
let r = n.getBoundingClientRect(), i = X(t.clientY - r.top, r.height);
|
|
529
|
+
t.preventDefault(), P({
|
|
530
|
+
key: e.key,
|
|
531
|
+
edge: i ? "before" : "after"
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
function U(e, t) {
|
|
535
|
+
if (F(e) === !1) return;
|
|
536
|
+
let r = N, i = M.current;
|
|
537
|
+
if (i === null || r === null || r.key !== e.key) return;
|
|
538
|
+
t.preventDefault();
|
|
539
|
+
let a = r.edge === "before" ? e.indexInGroup : e.indexInGroup + 1;
|
|
540
|
+
i.kind === "root" ? n.moveRootLayer(i.from, a) : i.kind === "row" ? e.tablePath !== null && e.tablePath.join(".") === i.tablePath.join(".") ? n.moveTableRow(i.tablePath, i.from, a) : n.moveTableRowToTable(i.rowPath, e.tablePath ?? [], a) : n.moveTableCellToRow(i.cellPath, e.node.path.slice(0, -2), a), M.current = null, P(null);
|
|
541
|
+
}
|
|
542
|
+
function W() {
|
|
543
|
+
M.current = null, P(null);
|
|
544
|
+
}
|
|
545
|
+
function G(t) {
|
|
546
|
+
return e(i.selection, t.node.path);
|
|
547
|
+
}
|
|
548
|
+
function K(t) {
|
|
549
|
+
return e(i.hovered, t.node.path);
|
|
550
|
+
}
|
|
551
|
+
let [q, J] = _(""), Z = g(null), Q = g(null);
|
|
552
|
+
function pe(t) {
|
|
553
|
+
return e(i.renaming, t.node.path);
|
|
554
|
+
}
|
|
555
|
+
function $(e) {
|
|
556
|
+
I(e) !== !1 && n.beginRename(e.node.path);
|
|
557
|
+
}
|
|
558
|
+
function me() {
|
|
559
|
+
let e = q.trim(), t = Z.current;
|
|
560
|
+
if (t !== null && e === t.trim()) {
|
|
561
|
+
n.cancelRename();
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
564
|
+
n.commitRename(e);
|
|
565
|
+
}
|
|
566
|
+
function he() {
|
|
567
|
+
n.cancelRename();
|
|
568
|
+
}
|
|
569
|
+
return ne(() => {
|
|
570
|
+
let t = i.renaming;
|
|
571
|
+
if (t === null) {
|
|
572
|
+
Z.current = null;
|
|
573
|
+
return;
|
|
574
|
+
}
|
|
575
|
+
let n = S.find((n) => e(n.node.path, t))?.label ?? "";
|
|
576
|
+
J(n), Z.current = n;
|
|
577
|
+
let r = Q.current;
|
|
578
|
+
r !== null && (r.focus({ preventScroll: !0 }), r.select());
|
|
579
|
+
}, [i.renaming, S]), /* @__PURE__ */ b("aside", {
|
|
580
|
+
className: "cn-props flex w-[232px] shrink-0 flex-col overflow-y-auto rounded-xl border border-cn-line bg-cn-bg text-cn-fg shadow-(--cn-shadow-md)",
|
|
581
|
+
children: [
|
|
582
|
+
/* @__PURE__ */ b("header", {
|
|
583
|
+
className: "sticky top-0 z-10 flex items-center justify-between border-b border-cn-line bg-cn-bg-elevated/95 px-3.5 py-2.5",
|
|
584
|
+
children: [/* @__PURE__ */ y("span", {
|
|
585
|
+
className: "text-[12px] font-medium tracking-wide text-cn-fg/90",
|
|
586
|
+
children: "图层"
|
|
587
|
+
}), /* @__PURE__ */ y("div", {
|
|
588
|
+
className: "flex items-center gap-1",
|
|
589
|
+
children: /* @__PURE__ */ y(te, {
|
|
590
|
+
label: "新增图层",
|
|
591
|
+
items: p,
|
|
592
|
+
onClosed: x,
|
|
593
|
+
trigger: (e) => /* @__PURE__ */ y("button", {
|
|
594
|
+
ref: (t) => {
|
|
595
|
+
e.triggerRef(t);
|
|
596
|
+
},
|
|
597
|
+
type: "button",
|
|
598
|
+
"data-add-menu": "",
|
|
599
|
+
"aria-expanded": e.open,
|
|
600
|
+
"aria-haspopup": "menu",
|
|
601
|
+
title: "新增图层",
|
|
602
|
+
className: "flex size-6 items-center justify-center rounded border border-cn-field-line bg-cn-field text-[13px] leading-none text-cn-fg/80 hover:border-cn-accent/40 hover:text-cn-accent",
|
|
603
|
+
onClick: () => e.toggle(),
|
|
604
|
+
onKeyDown: (t) => e.onKeydown(t),
|
|
605
|
+
children: "+"
|
|
606
|
+
}),
|
|
607
|
+
body: (e) => u ? /* @__PURE__ */ y(H, {
|
|
608
|
+
editor: n,
|
|
609
|
+
onConfirm: (t) => m(t, e.closeMenu),
|
|
610
|
+
onCancel: () => v(e.closeMenu)
|
|
611
|
+
}) : null
|
|
612
|
+
})
|
|
613
|
+
})]
|
|
614
|
+
}),
|
|
615
|
+
C === !1 && /* @__PURE__ */ y("p", {
|
|
616
|
+
className: "mx-3.5 my-4 rounded-lg border border-dashed border-cn-line px-3 py-6 text-center text-[11px] leading-5 text-cn-muted",
|
|
617
|
+
children: "画布还没有图层,用上方按钮新增"
|
|
618
|
+
}),
|
|
619
|
+
/* @__PURE__ */ y("ul", {
|
|
620
|
+
className: "cn-layers__tree flex flex-col gap-0.5 px-1.5 py-1",
|
|
621
|
+
onDragEnd: W,
|
|
622
|
+
children: S.map((e) => /* @__PURE__ */ b("li", {
|
|
623
|
+
"data-key": e.key,
|
|
624
|
+
draggable: z(e),
|
|
625
|
+
className: [
|
|
626
|
+
"cn-layers__row group flex cursor-default select-none items-center gap-1 py-1 pr-1 text-[12px]",
|
|
627
|
+
G(e) ? "cn-layers__row--selected" : "",
|
|
628
|
+
K(e) && G(e) === !1 ? "cn-layers__row--hovered" : "",
|
|
629
|
+
I(e) && e.node.visible === !1 ? "cn-layers__row--hidden" : "",
|
|
630
|
+
e.inTemplate ? "cn-layers__row--template" : "",
|
|
631
|
+
e.draggable && I(e) === !1 ? "cursor-grab" : "",
|
|
632
|
+
N?.key === e.key && N?.edge === "before" ? "cn-layers__row--drop-before" : "",
|
|
633
|
+
N?.key === e.key && N?.edge === "after" ? "cn-layers__row--drop-after" : ""
|
|
634
|
+
].filter((e) => e !== "").join(" "),
|
|
635
|
+
style: { paddingLeft: `${4 + e.indentLevel * 14}px` },
|
|
636
|
+
onClick: () => w(e),
|
|
637
|
+
onMouseEnter: () => T(e),
|
|
638
|
+
onMouseLeave: () => T(null),
|
|
639
|
+
onDragStart: (t) => R(e, t),
|
|
640
|
+
onDragOver: (t) => V(e, t),
|
|
641
|
+
onDrop: (t) => U(e, t),
|
|
642
|
+
children: [
|
|
643
|
+
I(e) && /* @__PURE__ */ y("span", {
|
|
644
|
+
"data-drag-handle": "",
|
|
645
|
+
draggable: !0,
|
|
646
|
+
title: "拖动排序",
|
|
647
|
+
className: "cn-layers__handle shrink-0",
|
|
648
|
+
onDragStart: (t) => L(e, t),
|
|
649
|
+
children: /* @__PURE__ */ y(r, {
|
|
650
|
+
icon: ae,
|
|
651
|
+
size: 12,
|
|
652
|
+
strokeWidth: 2.5
|
|
653
|
+
})
|
|
654
|
+
}),
|
|
655
|
+
e.node.expressionPrefix !== "" && /* @__PURE__ */ y("span", {
|
|
656
|
+
className: "cn-layers__prefix",
|
|
657
|
+
title: e.node.expressionPrefix,
|
|
658
|
+
children: e.node.expressionPrefix
|
|
659
|
+
}),
|
|
660
|
+
pe(e) ? /* @__PURE__ */ y("input", {
|
|
661
|
+
ref: Q,
|
|
662
|
+
value: q,
|
|
663
|
+
"data-rename-input": "",
|
|
664
|
+
"aria-label": "图层重命名",
|
|
665
|
+
className: "cn-layers__rename-input min-w-0 flex-1",
|
|
666
|
+
onClick: (e) => e.stopPropagation(),
|
|
667
|
+
onDoubleClick: (e) => e.stopPropagation(),
|
|
668
|
+
onKeyDown: (e) => {
|
|
669
|
+
e.key === "Enter" ? (e.preventDefault(), me()) : e.key === "Escape" && (e.preventDefault(), he());
|
|
670
|
+
},
|
|
671
|
+
onChange: (e) => J(e.target.value),
|
|
672
|
+
onBlur: me
|
|
673
|
+
}) : /* @__PURE__ */ y("span", {
|
|
674
|
+
className: "cn-layers__label min-w-0 flex-1 truncate font-mono text-[11px] leading-4",
|
|
675
|
+
onDoubleClick: () => $(e),
|
|
676
|
+
children: e.label
|
|
677
|
+
}),
|
|
678
|
+
I(e) && /* @__PURE__ */ y(s, {
|
|
679
|
+
label: e.node.visible ? "隐藏图层(最终输出不含该层)" : "显示图层",
|
|
680
|
+
className: e.node.visible ? "shrink-0 hidden! group-hover:flex!" : "shrink-0 flex!",
|
|
681
|
+
children: /* @__PURE__ */ y("button", {
|
|
682
|
+
type: "button",
|
|
683
|
+
"data-visibility": "",
|
|
684
|
+
className: "cn-layers__eye size-5 shrink-0 items-center justify-center rounded text-cn-muted hover:bg-cn-accent/15 hover:text-cn-accent",
|
|
685
|
+
"aria-pressed": e.node.visible === !1,
|
|
686
|
+
onClick: (t) => {
|
|
687
|
+
t.stopPropagation(), A(e);
|
|
688
|
+
},
|
|
689
|
+
children: /* @__PURE__ */ y(r, {
|
|
690
|
+
icon: e.node.visible ? ie : re,
|
|
691
|
+
size: 11,
|
|
692
|
+
strokeWidth: 2
|
|
693
|
+
})
|
|
694
|
+
})
|
|
695
|
+
}),
|
|
696
|
+
I(e) && /* @__PURE__ */ y(s, {
|
|
697
|
+
label: e.node.locked ? ue : "锁定图层(画布不可点选/拖动/删除,渲染照常)",
|
|
698
|
+
className: e.node.locked ? "shrink-0 flex!" : "shrink-0 hidden! group-hover:flex!",
|
|
699
|
+
children: /* @__PURE__ */ y("button", {
|
|
700
|
+
type: "button",
|
|
701
|
+
"data-lock": "",
|
|
702
|
+
className: "cn-layers__lock size-5 shrink-0 items-center justify-center rounded text-cn-muted hover:bg-cn-accent/15 hover:text-cn-accent",
|
|
703
|
+
"aria-pressed": e.node.locked,
|
|
704
|
+
onClick: (t) => {
|
|
705
|
+
t.stopPropagation(), j(e);
|
|
706
|
+
},
|
|
707
|
+
children: /* @__PURE__ */ y(r, {
|
|
708
|
+
icon: e.node.locked ? se : oe,
|
|
709
|
+
size: 11,
|
|
710
|
+
strokeWidth: 2
|
|
711
|
+
})
|
|
712
|
+
})
|
|
713
|
+
}),
|
|
714
|
+
I(e) && /* @__PURE__ */ y(s, {
|
|
715
|
+
label: "重命名(双击名称或 F2)",
|
|
716
|
+
className: "hidden! group-hover:flex! shrink-0",
|
|
717
|
+
children: /* @__PURE__ */ y("button", {
|
|
718
|
+
type: "button",
|
|
719
|
+
"data-rename": "",
|
|
720
|
+
className: "cn-layers__delete hidden size-5 shrink-0 items-center justify-center rounded text-cn-muted hover:bg-cn-accent/15 hover:text-cn-accent group-hover:flex",
|
|
721
|
+
onClick: (t) => {
|
|
722
|
+
t.stopPropagation(), $(e);
|
|
723
|
+
},
|
|
724
|
+
children: /* @__PURE__ */ y(r, {
|
|
725
|
+
icon: ce,
|
|
726
|
+
size: 11,
|
|
727
|
+
strokeWidth: 2
|
|
728
|
+
})
|
|
729
|
+
})
|
|
730
|
+
}),
|
|
731
|
+
e.node.role === "root" && e.node.type === "TableLayer" && /* @__PURE__ */ y("button", {
|
|
732
|
+
type: "button",
|
|
733
|
+
"data-add-row": "",
|
|
734
|
+
className: "cn-layers__delete hidden size-5 shrink-0 items-center justify-center rounded text-[10px] leading-none text-cn-muted hover:bg-cn-accent/15 hover:text-cn-accent group-hover:flex disabled:cursor-not-allowed disabled:text-cn-muted/50 disabled:hover:bg-transparent",
|
|
735
|
+
disabled: e.node.templated === !0,
|
|
736
|
+
title: e.node.templated === !0 ? "模板态不可加行——行由数据展开" : "加行(缺省行 + 缺省格与文本,行宽=表宽)",
|
|
737
|
+
onClick: (t) => {
|
|
738
|
+
t.stopPropagation(), E(e);
|
|
739
|
+
},
|
|
740
|
+
children: "+行"
|
|
741
|
+
}),
|
|
742
|
+
e.node.role === "row" && /* @__PURE__ */ y("button", {
|
|
743
|
+
type: "button",
|
|
744
|
+
"data-add-cell": "",
|
|
745
|
+
className: "cn-layers__delete hidden size-5 shrink-0 items-center justify-center rounded text-[10px] leading-none text-cn-muted hover:bg-cn-accent/15 hover:text-cn-accent group-hover:flex",
|
|
746
|
+
title: "加格(缺省格 + 文本内容,行高取最高格)",
|
|
747
|
+
onClick: (t) => {
|
|
748
|
+
t.stopPropagation(), D(e);
|
|
749
|
+
},
|
|
750
|
+
children: "+格"
|
|
751
|
+
}),
|
|
752
|
+
e.node.role === "templateRow" && /* @__PURE__ */ y("button", {
|
|
753
|
+
type: "button",
|
|
754
|
+
"data-add-template-cell": "",
|
|
755
|
+
className: "cn-layers__delete hidden size-5 shrink-0 items-center justify-center rounded text-[10px] leading-none text-cn-muted hover:bg-cn-accent/15 hover:text-cn-accent group-hover:flex",
|
|
756
|
+
title: "加格(缺省格 + 文本内容,零高度耦合——行高由数据展开定稿)",
|
|
757
|
+
onClick: (t) => {
|
|
758
|
+
t.stopPropagation(), O(e);
|
|
759
|
+
},
|
|
760
|
+
children: "+格"
|
|
761
|
+
}),
|
|
762
|
+
/* @__PURE__ */ y("button", {
|
|
763
|
+
type: "button",
|
|
764
|
+
className: "cn-layers__delete hidden size-5 shrink-0 items-center justify-center rounded text-[10px] leading-none text-cn-muted hover:bg-cn-danger/15 hover:text-cn-danger group-hover:flex disabled:cursor-not-allowed disabled:text-cn-muted/50 disabled:hover:bg-transparent disabled:hover:text-cn-muted/50",
|
|
765
|
+
disabled: e.node.role === "templateRow" || e.node.locked,
|
|
766
|
+
title: e.node.role === "templateRow" ? "行模板由表持有——转换回普通表请用 V2 转换入口" : e.node.locked === !0 ? de : "删除(含子层)",
|
|
767
|
+
onClick: (t) => {
|
|
768
|
+
t.stopPropagation(), k(e);
|
|
769
|
+
},
|
|
770
|
+
children: "✕"
|
|
771
|
+
})
|
|
772
|
+
]
|
|
773
|
+
}, e.key))
|
|
774
|
+
})
|
|
775
|
+
]
|
|
776
|
+
});
|
|
777
|
+
}
|
|
778
|
+
//#endregion
|
|
779
|
+
export { V as a, L as c, H as i, B as l, X as n, F as o, Y as r, z as s, Z as t };
|