@nice2dev/ui-printing 1.0.28
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 +56 -0
- package/dist/index.cjs +2 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +3085 -0
- package/dist/print-button/NicePrintButton.d.ts +5 -0
- package/dist/print-button/NicePrintButton.d.ts.map +1 -0
- package/dist/print-button/index.d.ts +2 -0
- package/dist/print-button/index.d.ts.map +1 -0
- package/dist/print-preview/NicePrintPreview.d.ts +5 -0
- package/dist/print-preview/NicePrintPreview.d.ts.map +1 -0
- package/dist/print-preview/index.d.ts +2 -0
- package/dist/print-preview/index.d.ts.map +1 -0
- package/dist/print-queue/NicePrintQueue.d.ts +5 -0
- package/dist/print-queue/NicePrintQueue.d.ts.map +1 -0
- package/dist/print-queue/index.d.ts +2 -0
- package/dist/print-queue/index.d.ts.map +1 -0
- package/dist/style.css +1 -0
- package/dist/template-browser/NiceTemplateBrowser.d.ts +5 -0
- package/dist/template-browser/NiceTemplateBrowser.d.ts.map +1 -0
- package/dist/template-browser/index.d.ts +2 -0
- package/dist/template-browser/index.d.ts.map +1 -0
- package/dist/template-editor/NiceTemplateEditor.d.ts +6 -0
- package/dist/template-editor/NiceTemplateEditor.d.ts.map +1 -0
- package/dist/template-editor/index.d.ts +2 -0
- package/dist/template-editor/index.d.ts.map +1 -0
- package/dist/types/printingTypes.d.ts +249 -0
- package/dist/types/printingTypes.d.ts.map +1 -0
- package/package.json +66 -0
- package/src/globals.d.ts +9 -0
- package/src/index.ts +69 -0
- package/src/print-button/NicePrintButton.tsx +182 -0
- package/src/print-button/PrintButton.module.css +167 -0
- package/src/print-button/index.ts +1 -0
- package/src/print-preview/NicePrintPreview.tsx +417 -0
- package/src/print-preview/PrintPreview.module.css +122 -0
- package/src/print-preview/index.ts +1 -0
- package/src/print-queue/NicePrintQueue.tsx +350 -0
- package/src/print-queue/PrintQueue.module.css +203 -0
- package/src/print-queue/index.ts +1 -0
- package/src/template-browser/NiceTemplateBrowser.tsx +221 -0
- package/src/template-browser/TemplateBrowser.module.css +277 -0
- package/src/template-browser/index.ts +1 -0
- package/src/template-editor/NiceTemplateEditor.tsx +2386 -0
- package/src/template-editor/NiceTemplateEditor.tsx.first +1011 -0
- package/src/template-editor/NiceTemplateEditor.tsx.tmp +392 -0
- package/src/template-editor/TemplateEditor.module.css +1462 -0
- package/src/template-editor/index.ts +1 -0
- package/src/types/printingTypes.ts +301 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,3085 @@
|
|
|
1
|
+
import { jsxs as s, jsx as e, Fragment as Y } from "react/jsx-runtime";
|
|
2
|
+
import We, { useReducer as je, useState as M, useCallback as $, useMemo as oe, useEffect as ye, useRef as Fe } from "react";
|
|
3
|
+
import { useNiceTranslation as Oe } from "@nice2dev/ui";
|
|
4
|
+
import { createPortal as Ue } from "react-dom";
|
|
5
|
+
const Ye = "_root_552wg_3", qe = "_dark_552wg_27", Ke = "_toolbar_552wg_39", Ve = "_toolbarGroup_552wg_75", Ze = "_toolbarBtn_552wg_107", Xe = "_toolbarBtnActive_552wg_167", Je = "_toolbarBtnDanger_552wg_191", Qe = "_toolbarSelect_552wg_203", et = "_toolbarSep_552wg_233", tt = "_insertWrapper_552wg_259", at = "_insertBtn_552wg_267", nt = "_insertDropdown_552wg_289", st = "_insertCategory_552wg_329", rt = "_insertItem_552wg_347", lt = "_insertIcon_552wg_391", it = "_zoomSelect_552wg_405", ot = "_saveBtn_552wg_437", ct = "_editorBody_552wg_473", dt = "_leftPanel_552wg_489", pt = "_leftTabs_552wg_519", mt = "_leftTab_552wg_519", ut = "_leftTabActive_552wg_591", ht = "_leftTabIcon_552wg_611", _t = "_leftTabLabel_552wg_619", gt = "_leftContent_552wg_629", yt = "_panelHeader_552wg_643", bt = "_panelHeaderIcon_552wg_667", wt = "_panelHeaderName_552wg_675", vt = "_searchBox_552wg_689", Nt = "_searchInput_552wg_697", ft = "_fieldList_552wg_743", kt = "_fieldItem_552wg_753", St = "_fieldItemIcon_552wg_797", Bt = "_fieldItemInfo_552wg_811", Ct = "_fieldItemLabel_552wg_821", It = "_fieldItemPath_552wg_837", Lt = "_fieldItemType_552wg_853", xt = "_layerList_552wg_873", zt = "_layerItem_552wg_885", Dt = "_layerItemSelected_552wg_919", Tt = "_layerIcon_552wg_937", $t = "_layerName_552wg_949", Rt = "_layerActions_552wg_965", At = "_layerBtn_552wg_987", Pt = "_wmList_552wg_1019", Mt = "_wmItem_552wg_1027", Et = "_wmRow_552wg_1053", Gt = "_wmLabel_552wg_1067", Ht = "_wmInput_552wg_1079", Wt = "_wmInputNum_552wg_1111", jt = "_wmSelect_552wg_1131", Ft = "_wmSlider_552wg_1163", Ot = "_wmValue_552wg_1173", Ut = "_wmUnit_552wg_1187", Yt = "_wmDelete_552wg_1197", qt = "_addBtn_552wg_1229", Kt = "_settingsForm_552wg_1265", Vt = "_settingsRow_552wg_1273", Zt = "_settingsLabel_552wg_1287", Xt = "_settingsInput_552wg_1299", Jt = "_settingsInputNum_552wg_1331", Qt = "_settingsTextarea_552wg_1363", ea = "_settingsDivider_552wg_1397", ta = "_settingsUnit_552wg_1417", aa = "_emptyMsg_552wg_1429", na = "_canvasArea_552wg_1447", sa = "_testDataBar_552wg_1473", ra = "_testDataLabel_552wg_1505", la = "_testDataSelect_552wg_1515", ia = "_rulerWrapper_552wg_1535", oa = "_rulerCorner_552wg_1551", ca = "_ruler_552wg_1535", da = "_ruler_h_552wg_1609", pa = "_ruler_v_552wg_1619", ma = "_rulerTick_552wg_1639", ua = "_rulerTickMajor_552wg_1679", ha = "_rulerLabel_552wg_1699", _a = "_paperScroll_552wg_1737", ga = "_paperShadow_552wg_1755", ya = "_marginGuide_552wg_1779", ba = "_watermark_552wg_1795", wa = "_sectionCanvas_552wg_1821", va = "_sectionCanvasOver_552wg_1835", Na = "_sectionTypeChip_552wg_1843", fa = "_sectionResizeBar_552wg_1875", ka = "_sectionResizeGrip_552wg_1909", Sa = "_fieldImagePlaceholder_552wg_1925", Ba = "_fieldBarcodePlaceholder_552wg_1947", Ca = "_fieldSignaturePlaceholder_552wg_1975", Ia = "_resizeHandle_552wg_2001", La = "_handle_n_552wg_2021", xa = "_handle_s_552wg_2023", za = "_handle_e_552wg_2025", Da = "_handle_w_552wg_2027", Ta = "_handle_ne_552wg_2029", $a = "_handle_nw_552wg_2031", Ra = "_handle_se_552wg_2033", Aa = "_handle_sw_552wg_2035", Pa = "_rightPanel_552wg_2041", Ma = "_rightTabs_552wg_2071", Ea = "_rightTab_552wg_2071", Ga = "_rightTabActive_552wg_2135", Ha = "_propsBody_552wg_2147", Wa = "_propsEmpty_552wg_2159", ja = "_propsEmptyIcon_552wg_2181", Fa = "_propsEmptyText_552wg_2191", Oa = "_posGrid_552wg_2203", Ua = "_posCell_552wg_2217", Ya = "_posLabel_552wg_2229", qa = "_posInput_552wg_2241", Ka = "_posUnit_552wg_2283", Va = "_snapSection_552wg_2295", Za = "_snapTitle_552wg_2303", Xa = "_snapRow_552wg_2321", Ja = "_snapBtn_552wg_2331", Qa = "_styleGroup_552wg_2365", en = "_styleGroupTitle_552wg_2373", tn = "_styleRow_552wg_2403", an = "_styleLabel_552wg_2417", nn = "_styleSelect_552wg_2431", sn = "_styleSelectFull_552wg_2461", rn = "_styleSelectSm_552wg_2493", ln = "_styleSelectXs_552wg_2513", on = "_styleInput_552wg_2545", cn = "_styleInputFull_552wg_2577", dn = "_styleUnit_552wg_2609", pn = "_styleValue_552wg_2621", mn = "_toggleGroup_552wg_2635", un = "_toggleBtn_552wg_2645", hn = "_toggleBtnActive_552wg_2675", _n = "_colorPicker_552wg_2689", gn = "_colorHex_552wg_2707", yn = "_clearBtn_552wg_2741", bn = "_sliderInput_552wg_2773", wn = "_conditionalHint_552wg_2785", vn = "_clearConditionalBtn_552wg_2817", Nn = "_shortcutGrid_552wg_2849", fn = "_shortcutChip_552wg_2863", kn = "_shortcutKeys_552wg_2895", Sn = "_shortcutLabel_552wg_2915", t = {
|
|
6
|
+
root: Ye,
|
|
7
|
+
dark: qe,
|
|
8
|
+
toolbar: Ke,
|
|
9
|
+
toolbarGroup: Ve,
|
|
10
|
+
toolbarBtn: Ze,
|
|
11
|
+
toolbarBtnActive: Xe,
|
|
12
|
+
toolbarBtnDanger: Je,
|
|
13
|
+
toolbarSelect: Qe,
|
|
14
|
+
toolbarSep: et,
|
|
15
|
+
insertWrapper: tt,
|
|
16
|
+
insertBtn: at,
|
|
17
|
+
insertDropdown: nt,
|
|
18
|
+
insertCategory: st,
|
|
19
|
+
insertItem: rt,
|
|
20
|
+
insertIcon: lt,
|
|
21
|
+
zoomSelect: it,
|
|
22
|
+
saveBtn: ot,
|
|
23
|
+
editorBody: ct,
|
|
24
|
+
leftPanel: dt,
|
|
25
|
+
leftTabs: pt,
|
|
26
|
+
leftTab: mt,
|
|
27
|
+
leftTabActive: ut,
|
|
28
|
+
leftTabIcon: ht,
|
|
29
|
+
leftTabLabel: _t,
|
|
30
|
+
leftContent: gt,
|
|
31
|
+
panelHeader: yt,
|
|
32
|
+
panelHeaderIcon: bt,
|
|
33
|
+
panelHeaderName: wt,
|
|
34
|
+
searchBox: vt,
|
|
35
|
+
searchInput: Nt,
|
|
36
|
+
fieldList: ft,
|
|
37
|
+
fieldItem: kt,
|
|
38
|
+
fieldItemIcon: St,
|
|
39
|
+
fieldItemInfo: Bt,
|
|
40
|
+
fieldItemLabel: Ct,
|
|
41
|
+
fieldItemPath: It,
|
|
42
|
+
fieldItemType: Lt,
|
|
43
|
+
layerList: xt,
|
|
44
|
+
layerItem: zt,
|
|
45
|
+
layerItemSelected: Dt,
|
|
46
|
+
layerIcon: Tt,
|
|
47
|
+
layerName: $t,
|
|
48
|
+
layerActions: Rt,
|
|
49
|
+
layerBtn: At,
|
|
50
|
+
wmList: Pt,
|
|
51
|
+
wmItem: Mt,
|
|
52
|
+
wmRow: Et,
|
|
53
|
+
wmLabel: Gt,
|
|
54
|
+
wmInput: Ht,
|
|
55
|
+
wmInputNum: Wt,
|
|
56
|
+
wmSelect: jt,
|
|
57
|
+
wmSlider: Ft,
|
|
58
|
+
wmValue: Ot,
|
|
59
|
+
wmUnit: Ut,
|
|
60
|
+
wmDelete: Yt,
|
|
61
|
+
addBtn: qt,
|
|
62
|
+
settingsForm: Kt,
|
|
63
|
+
settingsRow: Vt,
|
|
64
|
+
settingsLabel: Zt,
|
|
65
|
+
settingsInput: Xt,
|
|
66
|
+
settingsInputNum: Jt,
|
|
67
|
+
settingsTextarea: Qt,
|
|
68
|
+
settingsDivider: ea,
|
|
69
|
+
settingsUnit: ta,
|
|
70
|
+
emptyMsg: aa,
|
|
71
|
+
canvasArea: na,
|
|
72
|
+
testDataBar: sa,
|
|
73
|
+
testDataLabel: ra,
|
|
74
|
+
testDataSelect: la,
|
|
75
|
+
rulerWrapper: ia,
|
|
76
|
+
rulerCorner: oa,
|
|
77
|
+
ruler: ca,
|
|
78
|
+
ruler_h: da,
|
|
79
|
+
ruler_v: pa,
|
|
80
|
+
rulerTick: ma,
|
|
81
|
+
rulerTickMajor: ua,
|
|
82
|
+
rulerLabel: ha,
|
|
83
|
+
paperScroll: _a,
|
|
84
|
+
paperShadow: ga,
|
|
85
|
+
marginGuide: ya,
|
|
86
|
+
watermark: ba,
|
|
87
|
+
sectionCanvas: wa,
|
|
88
|
+
sectionCanvasOver: va,
|
|
89
|
+
sectionTypeChip: Na,
|
|
90
|
+
sectionResizeBar: fa,
|
|
91
|
+
sectionResizeGrip: ka,
|
|
92
|
+
fieldImagePlaceholder: Sa,
|
|
93
|
+
fieldBarcodePlaceholder: Ba,
|
|
94
|
+
fieldSignaturePlaceholder: Ca,
|
|
95
|
+
resizeHandle: Ia,
|
|
96
|
+
handle_n: La,
|
|
97
|
+
handle_s: xa,
|
|
98
|
+
handle_e: za,
|
|
99
|
+
handle_w: Da,
|
|
100
|
+
handle_ne: Ta,
|
|
101
|
+
handle_nw: $a,
|
|
102
|
+
handle_se: Ra,
|
|
103
|
+
handle_sw: Aa,
|
|
104
|
+
rightPanel: Pa,
|
|
105
|
+
rightTabs: Ma,
|
|
106
|
+
rightTab: Ea,
|
|
107
|
+
rightTabActive: Ga,
|
|
108
|
+
propsBody: Ha,
|
|
109
|
+
propsEmpty: Wa,
|
|
110
|
+
propsEmptyIcon: ja,
|
|
111
|
+
propsEmptyText: Fa,
|
|
112
|
+
posGrid: Oa,
|
|
113
|
+
posCell: Ua,
|
|
114
|
+
posLabel: Ya,
|
|
115
|
+
posInput: qa,
|
|
116
|
+
posUnit: Ka,
|
|
117
|
+
snapSection: Va,
|
|
118
|
+
snapTitle: Za,
|
|
119
|
+
snapRow: Xa,
|
|
120
|
+
snapBtn: Ja,
|
|
121
|
+
styleGroup: Qa,
|
|
122
|
+
styleGroupTitle: en,
|
|
123
|
+
styleRow: tn,
|
|
124
|
+
styleLabel: an,
|
|
125
|
+
styleSelect: nn,
|
|
126
|
+
styleSelectFull: sn,
|
|
127
|
+
styleSelectSm: rn,
|
|
128
|
+
styleSelectXs: ln,
|
|
129
|
+
styleInput: on,
|
|
130
|
+
styleInputFull: cn,
|
|
131
|
+
styleUnit: dn,
|
|
132
|
+
styleValue: pn,
|
|
133
|
+
toggleGroup: mn,
|
|
134
|
+
toggleBtn: un,
|
|
135
|
+
toggleBtnActive: hn,
|
|
136
|
+
colorPicker: _n,
|
|
137
|
+
colorHex: gn,
|
|
138
|
+
clearBtn: yn,
|
|
139
|
+
sliderInput: bn,
|
|
140
|
+
conditionalHint: wn,
|
|
141
|
+
clearConditionalBtn: vn,
|
|
142
|
+
shortcutGrid: Nn,
|
|
143
|
+
shortcutChip: fn,
|
|
144
|
+
shortcutKeys: kn,
|
|
145
|
+
shortcutLabel: Sn
|
|
146
|
+
}, F = 3.78, Ne = {
|
|
147
|
+
A3: [297, 420],
|
|
148
|
+
A4: [210, 297],
|
|
149
|
+
A5: [148, 210],
|
|
150
|
+
A6: [105, 148],
|
|
151
|
+
Letter: [216, 279],
|
|
152
|
+
Legal: [216, 356],
|
|
153
|
+
Tabloid: [279, 432],
|
|
154
|
+
custom: [210, 297]
|
|
155
|
+
}, Bn = [
|
|
156
|
+
"sans-serif",
|
|
157
|
+
"serif",
|
|
158
|
+
"monospace",
|
|
159
|
+
"Arial",
|
|
160
|
+
"Times New Roman",
|
|
161
|
+
"Courier New",
|
|
162
|
+
"Georgia",
|
|
163
|
+
"Verdana",
|
|
164
|
+
"Tahoma"
|
|
165
|
+
], fe = [6, 7, 8, 9, 10, 11, 12, 14, 16, 18, 20, 24, 28, 32, 36, 48, 60, 72], ce = {
|
|
166
|
+
text: "📝",
|
|
167
|
+
number: "#",
|
|
168
|
+
currency: "€",
|
|
169
|
+
date: "📅",
|
|
170
|
+
datetime: "🕐",
|
|
171
|
+
boolean: "✓",
|
|
172
|
+
image: "🖼",
|
|
173
|
+
barcode: "▮▌▮",
|
|
174
|
+
qr: "⬛",
|
|
175
|
+
signature: "✍",
|
|
176
|
+
static_text: "T",
|
|
177
|
+
static_image: "🖼",
|
|
178
|
+
line: "─",
|
|
179
|
+
rect: "▭",
|
|
180
|
+
page_number: "#p",
|
|
181
|
+
total_pages: "#pp",
|
|
182
|
+
print_date: "📅"
|
|
183
|
+
}, de = {
|
|
184
|
+
text: "Tekst",
|
|
185
|
+
number: "Liczba",
|
|
186
|
+
currency: "Waluta",
|
|
187
|
+
date: "Data",
|
|
188
|
+
datetime: "Data i czas",
|
|
189
|
+
boolean: "Tak/Nie",
|
|
190
|
+
image: "Obraz",
|
|
191
|
+
barcode: "Kod kreskowy",
|
|
192
|
+
qr: "QR",
|
|
193
|
+
signature: "Podpis",
|
|
194
|
+
static_text: "Tekst stały",
|
|
195
|
+
static_image: "Obraz stały",
|
|
196
|
+
line: "Linia",
|
|
197
|
+
rect: "Prostokąt",
|
|
198
|
+
page_number: "Numer strony",
|
|
199
|
+
total_pages: "Liczba stron",
|
|
200
|
+
print_date: "Data wydruku"
|
|
201
|
+
};
|
|
202
|
+
function Cn(a, i) {
|
|
203
|
+
switch (i.type) {
|
|
204
|
+
case "UPDATE":
|
|
205
|
+
return {
|
|
206
|
+
past: [...a.past.slice(-50), a.present],
|
|
207
|
+
present: i.payload,
|
|
208
|
+
future: []
|
|
209
|
+
};
|
|
210
|
+
case "UNDO":
|
|
211
|
+
return a.past.length ? {
|
|
212
|
+
past: a.past.slice(0, -1),
|
|
213
|
+
present: a.past[a.past.length - 1],
|
|
214
|
+
future: [a.present, ...a.future]
|
|
215
|
+
} : a;
|
|
216
|
+
case "REDO":
|
|
217
|
+
return a.future.length ? {
|
|
218
|
+
past: [...a.past, a.present],
|
|
219
|
+
present: a.future[0],
|
|
220
|
+
future: a.future.slice(1)
|
|
221
|
+
} : a;
|
|
222
|
+
default:
|
|
223
|
+
return a;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
function se() {
|
|
227
|
+
return `f-${Date.now()}-${Math.floor(Math.random() * 1e3)}`;
|
|
228
|
+
}
|
|
229
|
+
function ke(a, i) {
|
|
230
|
+
const p = {
|
|
231
|
+
id: se(),
|
|
232
|
+
name: (i == null ? void 0 : i.label) ?? de[a] ?? a,
|
|
233
|
+
label: (i == null ? void 0 : i.label) ?? de[a] ?? a,
|
|
234
|
+
type: a,
|
|
235
|
+
dataPath: (i == null ? void 0 : i.path) ?? "",
|
|
236
|
+
fallback: a === "static_text" ? "Tekst statyczny" : void 0,
|
|
237
|
+
format: a === "date" || a === "datetime" ? "DD.MM.YYYY" : void 0,
|
|
238
|
+
position: {
|
|
239
|
+
x: 15,
|
|
240
|
+
y: 15,
|
|
241
|
+
width: a === "line" ? 80 : 60,
|
|
242
|
+
height: a === "line" ? 1 : a === "image" ? 30 : 8
|
|
243
|
+
},
|
|
244
|
+
style: { fontSize: 10, color: "var(--nice-text, #000000)", fontFamily: "sans-serif" }
|
|
245
|
+
};
|
|
246
|
+
return a === "rect" && (p.style.backgroundColor = "var(--nice-bg-secondary, #f1f5f9)"), a === "line" && (p.style = { ...p.style, borderWidth: 0.5, borderColor: "var(--nice-text, #000000)", borderStyle: "solid" }), p;
|
|
247
|
+
}
|
|
248
|
+
const Se = ({
|
|
249
|
+
lengthMm: a,
|
|
250
|
+
zoom: i,
|
|
251
|
+
orientation: p
|
|
252
|
+
}) => {
|
|
253
|
+
const l = [], k = i < 0.6 ? 20 : i < 1 ? 10 : 5;
|
|
254
|
+
for (let h = 0; h <= a; h += k) {
|
|
255
|
+
const S = h * i * F, b = h % (k * 2) === 0;
|
|
256
|
+
l.push(
|
|
257
|
+
/* @__PURE__ */ e(
|
|
258
|
+
"div",
|
|
259
|
+
{
|
|
260
|
+
className: `${t.rulerTick} ${b ? t.rulerTickMajor : ""}`,
|
|
261
|
+
style: p === "h" ? { left: S } : { top: S },
|
|
262
|
+
children: b && /* @__PURE__ */ e("span", { className: t.rulerLabel, children: h })
|
|
263
|
+
},
|
|
264
|
+
h
|
|
265
|
+
)
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
return /* @__PURE__ */ e("div", { className: `${t.ruler} ${t[`ruler_${p}`]}`, children: l });
|
|
269
|
+
}, In = ["n", "s", "e", "w", "ne", "nw", "se", "sw"], Ln = ({ onResizeStart: a }) => /* @__PURE__ */ e(Y, { children: In.map((i) => /* @__PURE__ */ e(
|
|
270
|
+
"div",
|
|
271
|
+
{
|
|
272
|
+
className: `${t.resizeHandle} ${t[`handle_${i}`]}`,
|
|
273
|
+
onMouseDown: (p) => {
|
|
274
|
+
p.stopPropagation(), a(i, p);
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
i
|
|
278
|
+
)) });
|
|
279
|
+
function xn(a, i) {
|
|
280
|
+
if (a.type === "static_text")
|
|
281
|
+
return a.fallback ?? "Tekst";
|
|
282
|
+
if (a.type === "page_number")
|
|
283
|
+
return "1";
|
|
284
|
+
if (a.type === "total_pages")
|
|
285
|
+
return "3";
|
|
286
|
+
if (a.type === "print_date")
|
|
287
|
+
return (/* @__PURE__ */ new Date()).toLocaleDateString("pl-PL");
|
|
288
|
+
if (i && a.dataPath) {
|
|
289
|
+
const p = a.dataPath.split(".").reduce(
|
|
290
|
+
(l, k) => l && typeof l == "object" ? l[k] : null,
|
|
291
|
+
i
|
|
292
|
+
);
|
|
293
|
+
if (p != null)
|
|
294
|
+
return String(p);
|
|
295
|
+
}
|
|
296
|
+
return a.label ? `{${a.label}}` : `{${a.dataPath}}`;
|
|
297
|
+
}
|
|
298
|
+
const zn = ({
|
|
299
|
+
field: a,
|
|
300
|
+
zoom: i,
|
|
301
|
+
selected: p,
|
|
302
|
+
sampleData: l,
|
|
303
|
+
onClick: k,
|
|
304
|
+
onDragStart: h,
|
|
305
|
+
onResizeStart: S,
|
|
306
|
+
readOnly: b
|
|
307
|
+
}) => {
|
|
308
|
+
const g = a.position, v = a.style, c = (m) => m * i * F, T = a.type === "line", N = a.type === "rect", r = a.type === "image" || a.type === "static_image", n = a.type === "barcode" || a.type === "qr", u = {
|
|
309
|
+
position: "absolute",
|
|
310
|
+
left: c(g.x),
|
|
311
|
+
top: c(g.y),
|
|
312
|
+
width: c(g.width),
|
|
313
|
+
height: c(g.height),
|
|
314
|
+
zIndex: g.zIndex ?? 1,
|
|
315
|
+
transform: v.rotation ? `rotate(${v.rotation}deg)` : void 0,
|
|
316
|
+
boxSizing: "border-box",
|
|
317
|
+
overflow: "hidden",
|
|
318
|
+
...!T && !N ? {
|
|
319
|
+
fontSize: (v.fontSize ?? 10) * i,
|
|
320
|
+
fontFamily: v.fontFamily ?? "sans-serif",
|
|
321
|
+
fontWeight: v.fontWeight ?? "normal",
|
|
322
|
+
fontStyle: v.fontStyle ?? "normal",
|
|
323
|
+
color: v.color ?? "var(--nice-text, #000)",
|
|
324
|
+
textAlign: v.textAlign ?? "left",
|
|
325
|
+
lineHeight: v.lineHeight ?? 1.4,
|
|
326
|
+
letterSpacing: v.letterSpacing ? `${v.letterSpacing}em` : void 0,
|
|
327
|
+
padding: v.padding ? c(v.padding) : 0
|
|
328
|
+
} : {},
|
|
329
|
+
backgroundColor: v.backgroundColor,
|
|
330
|
+
borderWidth: v.borderWidth ?? 0,
|
|
331
|
+
borderColor: v.borderColor ?? "transparent",
|
|
332
|
+
borderStyle: v.borderStyle ?? "solid",
|
|
333
|
+
borderRadius: v.borderRadius,
|
|
334
|
+
opacity: v.opacity,
|
|
335
|
+
outline: p ? "1.5px solid var(--nice-primary-hover, #2563eb)" : "1px dashed transparent",
|
|
336
|
+
outlineOffset: 1,
|
|
337
|
+
cursor: b ? "default" : "move"
|
|
338
|
+
};
|
|
339
|
+
return /* @__PURE__ */ s("div", { style: u, onClick: k, onMouseDown: b ? void 0 : h, children: [
|
|
340
|
+
T ? /* @__PURE__ */ e(
|
|
341
|
+
"div",
|
|
342
|
+
{
|
|
343
|
+
style: {
|
|
344
|
+
width: "100%",
|
|
345
|
+
borderBottom: `${(v.borderWidth ?? 0.5) * i}px ${v.borderStyle ?? "solid"} ${v.borderColor ?? "var(--nice-text, #000)"}`
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
) : N ? null : r ? /* @__PURE__ */ e("div", { className: t.fieldImagePlaceholder, children: "🖼" }) : n ? /* @__PURE__ */ e("div", { className: t.fieldBarcodePlaceholder, children: a.type === "qr" ? "⬛ QR" : "▮▌▮ Barcode" }) : a.type === "signature" ? /* @__PURE__ */ s("div", { className: t.fieldSignaturePlaceholder, children: [
|
|
349
|
+
"✍ ",
|
|
350
|
+
a.label
|
|
351
|
+
] }) : /* @__PURE__ */ e("span", { style: { display: "block", width: "100%" }, children: xn(a, l) }),
|
|
352
|
+
p && !b && /* @__PURE__ */ e(Ln, { onResizeStart: S })
|
|
353
|
+
] });
|
|
354
|
+
}, Dn = ({
|
|
355
|
+
section: a,
|
|
356
|
+
zoom: i,
|
|
357
|
+
paperWidthMm: p,
|
|
358
|
+
selectedIds: l,
|
|
359
|
+
sampleData: k,
|
|
360
|
+
readOnly: h,
|
|
361
|
+
showGrid: S,
|
|
362
|
+
onFieldClick: b,
|
|
363
|
+
onFieldDragStart: g,
|
|
364
|
+
onResizeStart: v,
|
|
365
|
+
onSectionHeightChange: c,
|
|
366
|
+
onDropField: T
|
|
367
|
+
}) => {
|
|
368
|
+
const N = (a.heightMm ?? (a.type === "body" ? 200 : 40)) * i * F, r = p * i * F, [n, u] = M(!1), m = {
|
|
369
|
+
header: "rgba(219,234,254,0.35)",
|
|
370
|
+
footer: "rgba(220,252,231,0.35)",
|
|
371
|
+
background: "rgba(254,249,195,0.35)",
|
|
372
|
+
body: "transparent"
|
|
373
|
+
};
|
|
374
|
+
return /* @__PURE__ */ s(
|
|
375
|
+
"div",
|
|
376
|
+
{
|
|
377
|
+
className: `${t.sectionCanvas} ${n ? t.sectionCanvasOver : ""}`,
|
|
378
|
+
style: {
|
|
379
|
+
width: r,
|
|
380
|
+
height: N,
|
|
381
|
+
position: "relative",
|
|
382
|
+
background: m[a.type] ?? "transparent",
|
|
383
|
+
backgroundImage: S ? `repeating-linear-gradient(0deg, var(--nice-overlay-15, rgba(148, 163, 184, 0.15)) 0, var(--nice-overlay-15, rgba(148, 163, 184, 0.15)) 1px, transparent 1px, transparent ${5 * i * F}px),
|
|
384
|
+
repeating-linear-gradient(90deg, var(--nice-overlay-15, rgba(148, 163, 184, 0.15)) 0, var(--nice-overlay-15, rgba(148, 163, 184, 0.15)) 1px, transparent 1px, transparent ${5 * i * F}px)` : void 0
|
|
385
|
+
},
|
|
386
|
+
onDragOver: (f) => {
|
|
387
|
+
f.preventDefault(), u(!0);
|
|
388
|
+
},
|
|
389
|
+
onDragLeave: () => u(!1),
|
|
390
|
+
onDrop: (f) => {
|
|
391
|
+
f.preventDefault(), u(!1);
|
|
392
|
+
const D = f.dataTransfer.getData("fieldPath");
|
|
393
|
+
if (!D)
|
|
394
|
+
return;
|
|
395
|
+
const y = f.currentTarget.getBoundingClientRect(), x = (f.clientX - y.left) / (i * F), I = (f.clientY - y.top) / (i * F);
|
|
396
|
+
T(a.id, D, Math.max(0, x), Math.max(0, I));
|
|
397
|
+
},
|
|
398
|
+
children: [
|
|
399
|
+
/* @__PURE__ */ e("div", { className: t.sectionTypeChip, children: a.type }),
|
|
400
|
+
a.fields.map((f) => /* @__PURE__ */ e(
|
|
401
|
+
zn,
|
|
402
|
+
{
|
|
403
|
+
field: f,
|
|
404
|
+
zoom: i,
|
|
405
|
+
selected: l.has(f.id),
|
|
406
|
+
sampleData: k,
|
|
407
|
+
readOnly: h,
|
|
408
|
+
onClick: (D) => b(f.id, D),
|
|
409
|
+
onDragStart: (D) => g(f.id, D),
|
|
410
|
+
onResizeStart: (D, y) => v(f.id, D, y)
|
|
411
|
+
},
|
|
412
|
+
f.id
|
|
413
|
+
)),
|
|
414
|
+
!h && a.type !== "body" && /* @__PURE__ */ e(
|
|
415
|
+
"div",
|
|
416
|
+
{
|
|
417
|
+
className: t.sectionResizeBar,
|
|
418
|
+
onMouseDown: (f) => {
|
|
419
|
+
f.preventDefault();
|
|
420
|
+
const D = f.clientY, y = a.heightMm ?? 40, x = (E) => {
|
|
421
|
+
const W = (E.clientY - D) / (i * F);
|
|
422
|
+
c(a.id, Math.max(10, y + W));
|
|
423
|
+
}, I = () => {
|
|
424
|
+
document.removeEventListener("mousemove", x), document.removeEventListener("mouseup", I);
|
|
425
|
+
};
|
|
426
|
+
document.addEventListener("mousemove", x), document.addEventListener("mouseup", I);
|
|
427
|
+
},
|
|
428
|
+
children: /* @__PURE__ */ e("div", { className: t.sectionResizeGrip })
|
|
429
|
+
}
|
|
430
|
+
)
|
|
431
|
+
]
|
|
432
|
+
}
|
|
433
|
+
);
|
|
434
|
+
}, ne = ({ keys: a, label: i }) => /* @__PURE__ */ s("div", { className: t.shortcutChip, children: [
|
|
435
|
+
/* @__PURE__ */ e("span", { className: t.shortcutKeys, children: a }),
|
|
436
|
+
/* @__PURE__ */ e("span", { className: t.shortcutLabel, children: i })
|
|
437
|
+
] }), Tn = [
|
|
438
|
+
{ id: "fields", icon: "📝", label: "Pola" },
|
|
439
|
+
{ id: "layers", icon: "◧", label: "Warstwy" },
|
|
440
|
+
{ id: "watermarks", icon: "💧", label: "Znaki" },
|
|
441
|
+
{ id: "signatures", icon: "✍", label: "Podpisy" },
|
|
442
|
+
{ id: "settings", icon: "⚙", label: "Ustawienia" }
|
|
443
|
+
], $n = [
|
|
444
|
+
{ id: "position", label: "Pozycja" },
|
|
445
|
+
{ id: "style", label: "Styl" },
|
|
446
|
+
{ id: "data", label: "Dane" },
|
|
447
|
+
{ id: "conditional", label: "Warunki" }
|
|
448
|
+
], Rn = ({
|
|
449
|
+
tpl: a,
|
|
450
|
+
zoom: i,
|
|
451
|
+
canUndo: p,
|
|
452
|
+
canRedo: l,
|
|
453
|
+
showGrid: k,
|
|
454
|
+
showRulers: h,
|
|
455
|
+
readOnly: S,
|
|
456
|
+
selectedCount: b,
|
|
457
|
+
onPaperChange: g,
|
|
458
|
+
onZoom: v,
|
|
459
|
+
onUndo: c,
|
|
460
|
+
onRedo: T,
|
|
461
|
+
onToggleGrid: N,
|
|
462
|
+
onToggleRulers: r,
|
|
463
|
+
onInsert: n,
|
|
464
|
+
onDelete: u,
|
|
465
|
+
onDuplicate: m,
|
|
466
|
+
onAlignH: f,
|
|
467
|
+
onAlignV: D,
|
|
468
|
+
onBringForward: y,
|
|
469
|
+
onSendBackward: x,
|
|
470
|
+
onSave: I
|
|
471
|
+
}) => {
|
|
472
|
+
const [E, W] = M(!1), P = [0.5, 0.75, 1, 1.25, 1.5, 2];
|
|
473
|
+
return /* @__PURE__ */ s("div", { className: t.toolbar, children: [
|
|
474
|
+
/* @__PURE__ */ s("div", { className: t.toolbarGroup, children: [
|
|
475
|
+
/* @__PURE__ */ e(
|
|
476
|
+
"select",
|
|
477
|
+
{
|
|
478
|
+
className: t.toolbarSelect,
|
|
479
|
+
value: a.paperSize,
|
|
480
|
+
onChange: (_) => g(_.target.value, a.orientation),
|
|
481
|
+
children: ["A4", "A5", "A3", "Letter", "Legal", "Tabloid", "custom"].map((_) => /* @__PURE__ */ e("option", { value: _, children: _ }, _))
|
|
482
|
+
}
|
|
483
|
+
),
|
|
484
|
+
/* @__PURE__ */ e(
|
|
485
|
+
"button",
|
|
486
|
+
{
|
|
487
|
+
className: `${t.toolbarBtn} ${a.orientation === "portrait" ? t.toolbarBtnActive : ""}`,
|
|
488
|
+
onClick: () => g(a.paperSize, "portrait"),
|
|
489
|
+
title: "Pion",
|
|
490
|
+
children: "⬜"
|
|
491
|
+
}
|
|
492
|
+
),
|
|
493
|
+
/* @__PURE__ */ e(
|
|
494
|
+
"button",
|
|
495
|
+
{
|
|
496
|
+
className: `${t.toolbarBtn} ${a.orientation === "landscape" ? t.toolbarBtnActive : ""}`,
|
|
497
|
+
onClick: () => g(a.paperSize, "landscape"),
|
|
498
|
+
title: "Poziom",
|
|
499
|
+
children: "▭"
|
|
500
|
+
}
|
|
501
|
+
)
|
|
502
|
+
] }),
|
|
503
|
+
!S && /* @__PURE__ */ s("div", { className: t.toolbarGroup, children: [
|
|
504
|
+
/* @__PURE__ */ e(
|
|
505
|
+
"button",
|
|
506
|
+
{
|
|
507
|
+
className: t.toolbarBtn,
|
|
508
|
+
disabled: !p,
|
|
509
|
+
onClick: c,
|
|
510
|
+
title: "Cofnij (Ctrl+Z)",
|
|
511
|
+
children: "↩"
|
|
512
|
+
}
|
|
513
|
+
),
|
|
514
|
+
/* @__PURE__ */ e(
|
|
515
|
+
"button",
|
|
516
|
+
{
|
|
517
|
+
className: t.toolbarBtn,
|
|
518
|
+
disabled: !l,
|
|
519
|
+
onClick: T,
|
|
520
|
+
title: "Ponów (Ctrl+Y)",
|
|
521
|
+
children: "↪"
|
|
522
|
+
}
|
|
523
|
+
)
|
|
524
|
+
] }),
|
|
525
|
+
!S && /* @__PURE__ */ s("div", { className: t.insertWrapper, children: [
|
|
526
|
+
/* @__PURE__ */ e(
|
|
527
|
+
"button",
|
|
528
|
+
{
|
|
529
|
+
className: `${t.toolbarBtn} ${t.insertBtn}`,
|
|
530
|
+
onClick: () => W((_) => !_),
|
|
531
|
+
children: "+ Wstaw ▾"
|
|
532
|
+
}
|
|
533
|
+
),
|
|
534
|
+
E && /* @__PURE__ */ s("div", { className: t.insertDropdown, onMouseLeave: () => W(!1), children: [
|
|
535
|
+
/* @__PURE__ */ e("div", { className: t.insertCategory, children: "Pola danych" }),
|
|
536
|
+
["text", "number", "currency", "date", "image", "barcode", "qr"].map((_) => /* @__PURE__ */ s(
|
|
537
|
+
"button",
|
|
538
|
+
{
|
|
539
|
+
className: t.insertItem,
|
|
540
|
+
onClick: () => {
|
|
541
|
+
n(_), W(!1);
|
|
542
|
+
},
|
|
543
|
+
children: [
|
|
544
|
+
/* @__PURE__ */ e("span", { className: t.insertIcon, children: ce[_] }),
|
|
545
|
+
de[_]
|
|
546
|
+
]
|
|
547
|
+
},
|
|
548
|
+
_
|
|
549
|
+
)),
|
|
550
|
+
/* @__PURE__ */ e("div", { className: t.insertCategory, children: "Elementy statyczne" }),
|
|
551
|
+
[
|
|
552
|
+
"static_text",
|
|
553
|
+
"static_image",
|
|
554
|
+
"line",
|
|
555
|
+
"rect",
|
|
556
|
+
"page_number",
|
|
557
|
+
"total_pages",
|
|
558
|
+
"print_date"
|
|
559
|
+
].map((_) => /* @__PURE__ */ s(
|
|
560
|
+
"button",
|
|
561
|
+
{
|
|
562
|
+
className: t.insertItem,
|
|
563
|
+
onClick: () => {
|
|
564
|
+
n(_), W(!1);
|
|
565
|
+
},
|
|
566
|
+
children: [
|
|
567
|
+
/* @__PURE__ */ e("span", { className: t.insertIcon, children: ce[_] }),
|
|
568
|
+
de[_]
|
|
569
|
+
]
|
|
570
|
+
},
|
|
571
|
+
_
|
|
572
|
+
)),
|
|
573
|
+
/* @__PURE__ */ e("div", { className: t.insertCategory, children: "Specjalne" }),
|
|
574
|
+
/* @__PURE__ */ s(
|
|
575
|
+
"button",
|
|
576
|
+
{
|
|
577
|
+
className: t.insertItem,
|
|
578
|
+
onClick: () => {
|
|
579
|
+
n("watermark"), W(!1);
|
|
580
|
+
},
|
|
581
|
+
children: [
|
|
582
|
+
/* @__PURE__ */ e("span", { className: t.insertIcon, children: "💧" }),
|
|
583
|
+
"Znak wodny"
|
|
584
|
+
]
|
|
585
|
+
}
|
|
586
|
+
),
|
|
587
|
+
/* @__PURE__ */ s(
|
|
588
|
+
"button",
|
|
589
|
+
{
|
|
590
|
+
className: t.insertItem,
|
|
591
|
+
onClick: () => {
|
|
592
|
+
n("signature"), W(!1);
|
|
593
|
+
},
|
|
594
|
+
children: [
|
|
595
|
+
/* @__PURE__ */ e("span", { className: t.insertIcon, children: "✍" }),
|
|
596
|
+
"Podpis"
|
|
597
|
+
]
|
|
598
|
+
}
|
|
599
|
+
)
|
|
600
|
+
] })
|
|
601
|
+
] }),
|
|
602
|
+
!S && b > 0 && /* @__PURE__ */ s("div", { className: t.toolbarGroup, children: [
|
|
603
|
+
/* @__PURE__ */ e("button", { className: t.toolbarBtn, onClick: m, title: "Duplikuj (Ctrl+D)", children: "⧉" }),
|
|
604
|
+
/* @__PURE__ */ e(
|
|
605
|
+
"button",
|
|
606
|
+
{
|
|
607
|
+
className: `${t.toolbarBtn} ${t.toolbarBtnDanger}`,
|
|
608
|
+
onClick: u,
|
|
609
|
+
title: "Usuń (Del)",
|
|
610
|
+
children: "🗑"
|
|
611
|
+
}
|
|
612
|
+
),
|
|
613
|
+
/* @__PURE__ */ e("span", { className: t.toolbarSep }),
|
|
614
|
+
/* @__PURE__ */ e(
|
|
615
|
+
"button",
|
|
616
|
+
{
|
|
617
|
+
className: t.toolbarBtn,
|
|
618
|
+
onClick: () => f("left"),
|
|
619
|
+
title: "Wyrównaj lewo",
|
|
620
|
+
children: "⬛□□"
|
|
621
|
+
}
|
|
622
|
+
),
|
|
623
|
+
/* @__PURE__ */ e(
|
|
624
|
+
"button",
|
|
625
|
+
{
|
|
626
|
+
className: t.toolbarBtn,
|
|
627
|
+
onClick: () => f("center"),
|
|
628
|
+
title: "Wyśrodkuj",
|
|
629
|
+
children: "□⬛□"
|
|
630
|
+
}
|
|
631
|
+
),
|
|
632
|
+
/* @__PURE__ */ e(
|
|
633
|
+
"button",
|
|
634
|
+
{
|
|
635
|
+
className: t.toolbarBtn,
|
|
636
|
+
onClick: () => f("right"),
|
|
637
|
+
title: "Wyrównaj prawo",
|
|
638
|
+
children: "□□⬛"
|
|
639
|
+
}
|
|
640
|
+
),
|
|
641
|
+
/* @__PURE__ */ e("button", { className: t.toolbarBtn, onClick: () => D("top"), title: "Góra", children: "⊤" }),
|
|
642
|
+
/* @__PURE__ */ e("button", { className: t.toolbarBtn, onClick: () => D("center"), title: "Środek V", children: "⊕" }),
|
|
643
|
+
/* @__PURE__ */ e("button", { className: t.toolbarBtn, onClick: () => D("bottom"), title: "Dół", children: "⊥" }),
|
|
644
|
+
/* @__PURE__ */ e("span", { className: t.toolbarSep }),
|
|
645
|
+
/* @__PURE__ */ e("button", { className: t.toolbarBtn, onClick: y, title: "Do przodu", children: "▲" }),
|
|
646
|
+
/* @__PURE__ */ e("button", { className: t.toolbarBtn, onClick: x, title: "Do tyłu", children: "▼" })
|
|
647
|
+
] }),
|
|
648
|
+
/* @__PURE__ */ s("div", { className: t.toolbarGroup, children: [
|
|
649
|
+
/* @__PURE__ */ e(
|
|
650
|
+
"button",
|
|
651
|
+
{
|
|
652
|
+
className: `${t.toolbarBtn} ${k ? t.toolbarBtnActive : ""}`,
|
|
653
|
+
onClick: N,
|
|
654
|
+
title: "Siatka",
|
|
655
|
+
children: "⊞"
|
|
656
|
+
}
|
|
657
|
+
),
|
|
658
|
+
/* @__PURE__ */ e(
|
|
659
|
+
"button",
|
|
660
|
+
{
|
|
661
|
+
className: `${t.toolbarBtn} ${h ? t.toolbarBtnActive : ""}`,
|
|
662
|
+
onClick: r,
|
|
663
|
+
title: "Linijki",
|
|
664
|
+
children: "⊢"
|
|
665
|
+
}
|
|
666
|
+
)
|
|
667
|
+
] }),
|
|
668
|
+
/* @__PURE__ */ s("div", { className: t.toolbarGroup, children: [
|
|
669
|
+
/* @__PURE__ */ e("button", { className: t.toolbarBtn, onClick: () => v(Math.max(0.25, i - 0.1)), children: "−" }),
|
|
670
|
+
/* @__PURE__ */ e(
|
|
671
|
+
"select",
|
|
672
|
+
{
|
|
673
|
+
className: t.zoomSelect,
|
|
674
|
+
value: P.includes(i) ? i : "",
|
|
675
|
+
onChange: (_) => v(+_.target.value),
|
|
676
|
+
children: P.map((_) => /* @__PURE__ */ s("option", { value: _, children: [
|
|
677
|
+
Math.round(_ * 100),
|
|
678
|
+
"%"
|
|
679
|
+
] }, _))
|
|
680
|
+
}
|
|
681
|
+
),
|
|
682
|
+
/* @__PURE__ */ e("button", { className: t.toolbarBtn, onClick: () => v(Math.min(3, i + 0.1)), children: "+" }),
|
|
683
|
+
/* @__PURE__ */ e("button", { className: t.toolbarBtn, onClick: () => v(1), title: "100%", children: "⊡" })
|
|
684
|
+
] }),
|
|
685
|
+
!S && I && /* @__PURE__ */ e("button", { className: t.saveBtn, onClick: I, children: "💾 Zapisz" })
|
|
686
|
+
] });
|
|
687
|
+
}, An = ({
|
|
688
|
+
activeTab: a,
|
|
689
|
+
onTabChange: i,
|
|
690
|
+
schema: p,
|
|
691
|
+
tpl: l,
|
|
692
|
+
allFields: k,
|
|
693
|
+
selectedIds: h,
|
|
694
|
+
onInsertSchemaField: S,
|
|
695
|
+
onSelectField: b,
|
|
696
|
+
onUpdateTpl: g,
|
|
697
|
+
onReorderField: v
|
|
698
|
+
}) => {
|
|
699
|
+
const [c, T] = M(""), N = p == null ? void 0 : p.fields.filter(
|
|
700
|
+
(r) => r.label.toLowerCase().includes(c.toLowerCase()) || r.path.toLowerCase().includes(c.toLowerCase())
|
|
701
|
+
);
|
|
702
|
+
return /* @__PURE__ */ s("div", { className: t.leftPanel, children: [
|
|
703
|
+
/* @__PURE__ */ e("div", { className: t.leftTabs, children: Tn.map((r) => /* @__PURE__ */ s(
|
|
704
|
+
"button",
|
|
705
|
+
{
|
|
706
|
+
className: `${t.leftTab} ${a === r.id ? t.leftTabActive : ""}`,
|
|
707
|
+
onClick: () => i(r.id),
|
|
708
|
+
title: r.label,
|
|
709
|
+
children: [
|
|
710
|
+
/* @__PURE__ */ e("span", { className: t.leftTabIcon, children: r.icon }),
|
|
711
|
+
/* @__PURE__ */ e("span", { className: t.leftTabLabel, children: r.label })
|
|
712
|
+
]
|
|
713
|
+
},
|
|
714
|
+
r.id
|
|
715
|
+
)) }),
|
|
716
|
+
/* @__PURE__ */ s("div", { className: t.leftContent, children: [
|
|
717
|
+
a === "fields" && /* @__PURE__ */ s(Y, { children: [
|
|
718
|
+
/* @__PURE__ */ e("div", { className: t.panelHeader, children: "Pola danych" }),
|
|
719
|
+
/* @__PURE__ */ e("div", { className: t.searchBox, children: /* @__PURE__ */ e(
|
|
720
|
+
"input",
|
|
721
|
+
{
|
|
722
|
+
className: t.searchInput,
|
|
723
|
+
placeholder: "Szukaj...",
|
|
724
|
+
value: c,
|
|
725
|
+
onChange: (r) => T(r.target.value)
|
|
726
|
+
}
|
|
727
|
+
) }),
|
|
728
|
+
p ? /* @__PURE__ */ s("div", { className: t.fieldList, children: [
|
|
729
|
+
(N ?? []).map((r) => /* @__PURE__ */ s(
|
|
730
|
+
"div",
|
|
731
|
+
{
|
|
732
|
+
className: t.fieldItem,
|
|
733
|
+
draggable: !0,
|
|
734
|
+
onDragStart: (n) => {
|
|
735
|
+
n.dataTransfer.setData("fieldPath", r.path), n.dataTransfer.setData("fieldLabel", r.label), n.dataTransfer.setData("fieldType", r.type);
|
|
736
|
+
},
|
|
737
|
+
onClick: () => S(r),
|
|
738
|
+
children: [
|
|
739
|
+
/* @__PURE__ */ e("span", { className: t.fieldItemIcon, children: ce[r.type] ?? "📝" }),
|
|
740
|
+
/* @__PURE__ */ s("div", { className: t.fieldItemInfo, children: [
|
|
741
|
+
/* @__PURE__ */ e("div", { className: t.fieldItemLabel, children: r.label }),
|
|
742
|
+
/* @__PURE__ */ e("div", { className: t.fieldItemPath, children: r.path })
|
|
743
|
+
] }),
|
|
744
|
+
/* @__PURE__ */ e("span", { className: t.fieldItemType, children: r.type })
|
|
745
|
+
]
|
|
746
|
+
},
|
|
747
|
+
r.path
|
|
748
|
+
)),
|
|
749
|
+
(N == null ? void 0 : N.length) === 0 && /* @__PURE__ */ e("div", { className: t.emptyMsg, children: "Brak wyników" })
|
|
750
|
+
] }) : /* @__PURE__ */ e("div", { className: t.emptyMsg, children: "Brak schematu danych. Przypisz encję w zakładce Ustawienia." })
|
|
751
|
+
] }),
|
|
752
|
+
a === "layers" && /* @__PURE__ */ s(Y, { children: [
|
|
753
|
+
/* @__PURE__ */ s("div", { className: t.panelHeader, children: [
|
|
754
|
+
"Warstwy (",
|
|
755
|
+
k.length,
|
|
756
|
+
")"
|
|
757
|
+
] }),
|
|
758
|
+
/* @__PURE__ */ s("div", { className: t.layerList, children: [
|
|
759
|
+
k.length === 0 && /* @__PURE__ */ e("div", { className: t.emptyMsg, children: "Brak elementów" }),
|
|
760
|
+
k.slice().reverse().map((r) => /* @__PURE__ */ s(
|
|
761
|
+
"div",
|
|
762
|
+
{
|
|
763
|
+
className: `${t.layerItem} ${h.has(r.id) ? t.layerItemSelected : ""}`,
|
|
764
|
+
onClick: () => b(r.id),
|
|
765
|
+
children: [
|
|
766
|
+
/* @__PURE__ */ e("span", { className: t.layerIcon, children: ce[r.type] ?? "📝" }),
|
|
767
|
+
/* @__PURE__ */ e("span", { className: t.layerName, children: r.name || r.label }),
|
|
768
|
+
/* @__PURE__ */ s("div", { className: t.layerActions, children: [
|
|
769
|
+
/* @__PURE__ */ e(
|
|
770
|
+
"button",
|
|
771
|
+
{
|
|
772
|
+
className: t.layerBtn,
|
|
773
|
+
onClick: (n) => {
|
|
774
|
+
n.stopPropagation(), v(r.id, -1);
|
|
775
|
+
},
|
|
776
|
+
title: "Do przodu",
|
|
777
|
+
children: "↑"
|
|
778
|
+
}
|
|
779
|
+
),
|
|
780
|
+
/* @__PURE__ */ e(
|
|
781
|
+
"button",
|
|
782
|
+
{
|
|
783
|
+
className: t.layerBtn,
|
|
784
|
+
onClick: (n) => {
|
|
785
|
+
n.stopPropagation(), v(r.id, 1);
|
|
786
|
+
},
|
|
787
|
+
title: "Do tyłu",
|
|
788
|
+
children: "↓"
|
|
789
|
+
}
|
|
790
|
+
)
|
|
791
|
+
] })
|
|
792
|
+
]
|
|
793
|
+
},
|
|
794
|
+
r.id
|
|
795
|
+
))
|
|
796
|
+
] })
|
|
797
|
+
] }),
|
|
798
|
+
a === "watermarks" && /* @__PURE__ */ s(Y, { children: [
|
|
799
|
+
/* @__PURE__ */ e("div", { className: t.panelHeader, children: "Znaki wodne" }),
|
|
800
|
+
/* @__PURE__ */ s("div", { className: t.wmList, children: [
|
|
801
|
+
(l.watermarks ?? []).map((r) => /* @__PURE__ */ s("div", { className: t.wmItem, children: [
|
|
802
|
+
/* @__PURE__ */ s("div", { className: t.wmRow, children: [
|
|
803
|
+
/* @__PURE__ */ e("span", { className: t.wmLabel, children: "Typ" }),
|
|
804
|
+
/* @__PURE__ */ s(
|
|
805
|
+
"select",
|
|
806
|
+
{
|
|
807
|
+
className: t.wmSelect,
|
|
808
|
+
value: r.type,
|
|
809
|
+
onChange: (n) => {
|
|
810
|
+
var u;
|
|
811
|
+
return g({
|
|
812
|
+
watermarks: (u = l.watermarks) == null ? void 0 : u.map(
|
|
813
|
+
(m) => m.id === r.id ? { ...m, type: n.target.value } : m
|
|
814
|
+
)
|
|
815
|
+
});
|
|
816
|
+
},
|
|
817
|
+
children: [
|
|
818
|
+
/* @__PURE__ */ e("option", { value: "text", children: "Tekst" }),
|
|
819
|
+
/* @__PURE__ */ e("option", { value: "image", children: "Obraz" })
|
|
820
|
+
]
|
|
821
|
+
}
|
|
822
|
+
)
|
|
823
|
+
] }),
|
|
824
|
+
r.type === "text" && /* @__PURE__ */ s("div", { className: t.wmRow, children: [
|
|
825
|
+
/* @__PURE__ */ e("span", { className: t.wmLabel, children: "Tekst" }),
|
|
826
|
+
/* @__PURE__ */ e(
|
|
827
|
+
"input",
|
|
828
|
+
{
|
|
829
|
+
className: t.wmInput,
|
|
830
|
+
value: r.text ?? "",
|
|
831
|
+
onChange: (n) => {
|
|
832
|
+
var u;
|
|
833
|
+
return g({
|
|
834
|
+
watermarks: (u = l.watermarks) == null ? void 0 : u.map(
|
|
835
|
+
(m) => m.id === r.id ? { ...m, text: n.target.value } : m
|
|
836
|
+
)
|
|
837
|
+
});
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
)
|
|
841
|
+
] }),
|
|
842
|
+
/* @__PURE__ */ s("div", { className: t.wmRow, children: [
|
|
843
|
+
/* @__PURE__ */ e("span", { className: t.wmLabel, children: "Krycie" }),
|
|
844
|
+
/* @__PURE__ */ e(
|
|
845
|
+
"input",
|
|
846
|
+
{
|
|
847
|
+
type: "range",
|
|
848
|
+
min: 0.02,
|
|
849
|
+
max: 0.5,
|
|
850
|
+
step: 0.01,
|
|
851
|
+
className: t.wmSlider,
|
|
852
|
+
value: r.opacity,
|
|
853
|
+
onChange: (n) => {
|
|
854
|
+
var u;
|
|
855
|
+
return g({
|
|
856
|
+
watermarks: (u = l.watermarks) == null ? void 0 : u.map(
|
|
857
|
+
(m) => m.id === r.id ? { ...m, opacity: +n.target.value } : m
|
|
858
|
+
)
|
|
859
|
+
});
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
),
|
|
863
|
+
/* @__PURE__ */ s("span", { className: t.wmValue, children: [
|
|
864
|
+
Math.round(r.opacity * 100),
|
|
865
|
+
"%"
|
|
866
|
+
] })
|
|
867
|
+
] }),
|
|
868
|
+
/* @__PURE__ */ s("div", { className: t.wmRow, children: [
|
|
869
|
+
/* @__PURE__ */ e("span", { className: t.wmLabel, children: "Kąt" }),
|
|
870
|
+
/* @__PURE__ */ e(
|
|
871
|
+
"input",
|
|
872
|
+
{
|
|
873
|
+
type: "range",
|
|
874
|
+
min: -90,
|
|
875
|
+
max: 90,
|
|
876
|
+
step: 5,
|
|
877
|
+
className: t.wmSlider,
|
|
878
|
+
value: r.angle,
|
|
879
|
+
onChange: (n) => {
|
|
880
|
+
var u;
|
|
881
|
+
return g({
|
|
882
|
+
watermarks: (u = l.watermarks) == null ? void 0 : u.map(
|
|
883
|
+
(m) => m.id === r.id ? { ...m, angle: +n.target.value } : m
|
|
884
|
+
)
|
|
885
|
+
});
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
),
|
|
889
|
+
/* @__PURE__ */ s("span", { className: t.wmValue, children: [
|
|
890
|
+
r.angle,
|
|
891
|
+
"°"
|
|
892
|
+
] })
|
|
893
|
+
] }),
|
|
894
|
+
/* @__PURE__ */ s("div", { className: t.wmRow, children: [
|
|
895
|
+
/* @__PURE__ */ e("span", { className: t.wmLabel, children: "Rozmiar" }),
|
|
896
|
+
/* @__PURE__ */ e(
|
|
897
|
+
"input",
|
|
898
|
+
{
|
|
899
|
+
type: "number",
|
|
900
|
+
min: 8,
|
|
901
|
+
max: 200,
|
|
902
|
+
className: t.wmInputNum,
|
|
903
|
+
value: r.fontSize ?? 48,
|
|
904
|
+
onChange: (n) => {
|
|
905
|
+
var u;
|
|
906
|
+
return g({
|
|
907
|
+
watermarks: (u = l.watermarks) == null ? void 0 : u.map(
|
|
908
|
+
(m) => m.id === r.id ? { ...m, fontSize: +n.target.value } : m
|
|
909
|
+
)
|
|
910
|
+
});
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
),
|
|
914
|
+
/* @__PURE__ */ e("span", { className: t.wmUnit, children: "pt" })
|
|
915
|
+
] }),
|
|
916
|
+
/* @__PURE__ */ s("div", { className: t.wmRow, children: [
|
|
917
|
+
/* @__PURE__ */ e("span", { className: t.wmLabel, children: "Kolor" }),
|
|
918
|
+
/* @__PURE__ */ e(
|
|
919
|
+
"input",
|
|
920
|
+
{
|
|
921
|
+
type: "color",
|
|
922
|
+
className: t.colorPicker,
|
|
923
|
+
value: r.color ?? "var(--nice-text-muted, #94a3b8)",
|
|
924
|
+
onChange: (n) => {
|
|
925
|
+
var u;
|
|
926
|
+
return g({
|
|
927
|
+
watermarks: (u = l.watermarks) == null ? void 0 : u.map(
|
|
928
|
+
(m) => m.id === r.id ? { ...m, color: n.target.value } : m
|
|
929
|
+
)
|
|
930
|
+
});
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
)
|
|
934
|
+
] }),
|
|
935
|
+
/* @__PURE__ */ e(
|
|
936
|
+
"button",
|
|
937
|
+
{
|
|
938
|
+
className: t.wmDelete,
|
|
939
|
+
onClick: () => {
|
|
940
|
+
var n;
|
|
941
|
+
return g({ watermarks: (n = l.watermarks) == null ? void 0 : n.filter((u) => u.id !== r.id) });
|
|
942
|
+
},
|
|
943
|
+
children: "Usuń"
|
|
944
|
+
}
|
|
945
|
+
)
|
|
946
|
+
] }, r.id)),
|
|
947
|
+
/* @__PURE__ */ e(
|
|
948
|
+
"button",
|
|
949
|
+
{
|
|
950
|
+
className: t.addBtn,
|
|
951
|
+
onClick: () => g({
|
|
952
|
+
watermarks: [
|
|
953
|
+
...l.watermarks ?? [],
|
|
954
|
+
{
|
|
955
|
+
id: se(),
|
|
956
|
+
type: "text",
|
|
957
|
+
text: "KOPIA",
|
|
958
|
+
opacity: 0.12,
|
|
959
|
+
angle: -45,
|
|
960
|
+
fontSize: 60,
|
|
961
|
+
color: "var(--nice-text-muted, #94a3b8)"
|
|
962
|
+
}
|
|
963
|
+
]
|
|
964
|
+
}),
|
|
965
|
+
children: "+ Dodaj znak wodny"
|
|
966
|
+
}
|
|
967
|
+
)
|
|
968
|
+
] })
|
|
969
|
+
] }),
|
|
970
|
+
a === "signatures" && /* @__PURE__ */ s(Y, { children: [
|
|
971
|
+
/* @__PURE__ */ e("div", { className: t.panelHeader, children: "Podpisy" }),
|
|
972
|
+
/* @__PURE__ */ s("div", { className: t.wmList, children: [
|
|
973
|
+
(l.signatures ?? []).map((r) => /* @__PURE__ */ s("div", { className: t.wmItem, children: [
|
|
974
|
+
/* @__PURE__ */ s("div", { className: t.wmRow, children: [
|
|
975
|
+
/* @__PURE__ */ e("span", { className: t.wmLabel, children: "Etykieta" }),
|
|
976
|
+
/* @__PURE__ */ e(
|
|
977
|
+
"input",
|
|
978
|
+
{
|
|
979
|
+
className: t.wmInput,
|
|
980
|
+
value: r.label,
|
|
981
|
+
onChange: (n) => {
|
|
982
|
+
var u;
|
|
983
|
+
return g({
|
|
984
|
+
signatures: (u = l.signatures) == null ? void 0 : u.map(
|
|
985
|
+
(m) => m.id === r.id ? { ...m, label: n.target.value } : m
|
|
986
|
+
)
|
|
987
|
+
});
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
)
|
|
991
|
+
] }),
|
|
992
|
+
/* @__PURE__ */ s("div", { className: t.wmRow, children: [
|
|
993
|
+
/* @__PURE__ */ e("span", { className: t.wmLabel, children: "Nazwisko" }),
|
|
994
|
+
/* @__PURE__ */ e(
|
|
995
|
+
"input",
|
|
996
|
+
{
|
|
997
|
+
className: t.wmInput,
|
|
998
|
+
value: r.signerName ?? "",
|
|
999
|
+
onChange: (n) => {
|
|
1000
|
+
var u;
|
|
1001
|
+
return g({
|
|
1002
|
+
signatures: (u = l.signatures) == null ? void 0 : u.map(
|
|
1003
|
+
(m) => m.id === r.id ? { ...m, signerName: n.target.value } : m
|
|
1004
|
+
)
|
|
1005
|
+
});
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
)
|
|
1009
|
+
] }),
|
|
1010
|
+
/* @__PURE__ */ s("div", { className: t.wmRow, children: [
|
|
1011
|
+
/* @__PURE__ */ e("span", { className: t.wmLabel, children: "Linia" }),
|
|
1012
|
+
/* @__PURE__ */ e(
|
|
1013
|
+
"input",
|
|
1014
|
+
{
|
|
1015
|
+
type: "checkbox",
|
|
1016
|
+
checked: r.showLine ?? !0,
|
|
1017
|
+
onChange: (n) => {
|
|
1018
|
+
var u;
|
|
1019
|
+
return g({
|
|
1020
|
+
signatures: (u = l.signatures) == null ? void 0 : u.map(
|
|
1021
|
+
(m) => m.id === r.id ? { ...m, showLine: n.target.checked } : m
|
|
1022
|
+
)
|
|
1023
|
+
});
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
)
|
|
1027
|
+
] }),
|
|
1028
|
+
/* @__PURE__ */ s("div", { className: t.wmRow, children: [
|
|
1029
|
+
/* @__PURE__ */ e("span", { className: t.wmLabel, children: "Pokaż datę" }),
|
|
1030
|
+
/* @__PURE__ */ e(
|
|
1031
|
+
"input",
|
|
1032
|
+
{
|
|
1033
|
+
type: "checkbox",
|
|
1034
|
+
checked: r.showDate ?? !1,
|
|
1035
|
+
onChange: (n) => {
|
|
1036
|
+
var u;
|
|
1037
|
+
return g({
|
|
1038
|
+
signatures: (u = l.signatures) == null ? void 0 : u.map(
|
|
1039
|
+
(m) => m.id === r.id ? { ...m, showDate: n.target.checked } : m
|
|
1040
|
+
)
|
|
1041
|
+
});
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
)
|
|
1045
|
+
] }),
|
|
1046
|
+
/* @__PURE__ */ e(
|
|
1047
|
+
"button",
|
|
1048
|
+
{
|
|
1049
|
+
className: t.wmDelete,
|
|
1050
|
+
onClick: () => {
|
|
1051
|
+
var n;
|
|
1052
|
+
return g({ signatures: (n = l.signatures) == null ? void 0 : n.filter((u) => u.id !== r.id) });
|
|
1053
|
+
},
|
|
1054
|
+
children: "Usuń"
|
|
1055
|
+
}
|
|
1056
|
+
)
|
|
1057
|
+
] }, r.id)),
|
|
1058
|
+
/* @__PURE__ */ e(
|
|
1059
|
+
"button",
|
|
1060
|
+
{
|
|
1061
|
+
className: t.addBtn,
|
|
1062
|
+
onClick: () => g({
|
|
1063
|
+
signatures: [
|
|
1064
|
+
...l.signatures ?? [],
|
|
1065
|
+
{
|
|
1066
|
+
id: se(),
|
|
1067
|
+
label: "Podpis",
|
|
1068
|
+
position: { x: 10, y: 5, width: 70, height: 22 },
|
|
1069
|
+
showLine: !0,
|
|
1070
|
+
showDate: !1
|
|
1071
|
+
}
|
|
1072
|
+
]
|
|
1073
|
+
}),
|
|
1074
|
+
children: "+ Dodaj podpis"
|
|
1075
|
+
}
|
|
1076
|
+
)
|
|
1077
|
+
] })
|
|
1078
|
+
] }),
|
|
1079
|
+
a === "settings" && /* @__PURE__ */ s(Y, { children: [
|
|
1080
|
+
/* @__PURE__ */ e("div", { className: t.panelHeader, children: "Ustawienia szablonu" }),
|
|
1081
|
+
/* @__PURE__ */ s("div", { className: t.settingsForm, children: [
|
|
1082
|
+
/* @__PURE__ */ s("div", { className: t.settingsRow, children: [
|
|
1083
|
+
/* @__PURE__ */ e("label", { className: t.settingsLabel, children: "Nazwa" }),
|
|
1084
|
+
/* @__PURE__ */ e(
|
|
1085
|
+
"input",
|
|
1086
|
+
{
|
|
1087
|
+
className: t.settingsInput,
|
|
1088
|
+
value: l.name,
|
|
1089
|
+
onChange: (r) => g({ name: r.target.value })
|
|
1090
|
+
}
|
|
1091
|
+
)
|
|
1092
|
+
] }),
|
|
1093
|
+
/* @__PURE__ */ s("div", { className: t.settingsRow, children: [
|
|
1094
|
+
/* @__PURE__ */ e("label", { className: t.settingsLabel, children: "Opis" }),
|
|
1095
|
+
/* @__PURE__ */ e(
|
|
1096
|
+
"textarea",
|
|
1097
|
+
{
|
|
1098
|
+
className: t.settingsTextarea,
|
|
1099
|
+
value: l.description ?? "",
|
|
1100
|
+
onChange: (r) => g({ description: r.target.value }),
|
|
1101
|
+
rows: 2
|
|
1102
|
+
}
|
|
1103
|
+
)
|
|
1104
|
+
] }),
|
|
1105
|
+
/* @__PURE__ */ s("div", { className: t.settingsRow, children: [
|
|
1106
|
+
/* @__PURE__ */ e("label", { className: t.settingsLabel, children: "Kategoria" }),
|
|
1107
|
+
/* @__PURE__ */ e(
|
|
1108
|
+
"input",
|
|
1109
|
+
{
|
|
1110
|
+
className: t.settingsInput,
|
|
1111
|
+
value: l.category ?? "",
|
|
1112
|
+
onChange: (r) => g({ category: r.target.value })
|
|
1113
|
+
}
|
|
1114
|
+
)
|
|
1115
|
+
] }),
|
|
1116
|
+
/* @__PURE__ */ e("div", { className: t.settingsDivider, children: "Marginesy (mm)" }),
|
|
1117
|
+
["top", "right", "bottom", "left"].map((r) => /* @__PURE__ */ s("div", { className: t.settingsRow, children: [
|
|
1118
|
+
/* @__PURE__ */ e("label", { className: t.settingsLabel, children: r === "top" ? "Góra" : r === "right" ? "Prawo" : r === "bottom" ? "Dół" : "Lewo" }),
|
|
1119
|
+
/* @__PURE__ */ e(
|
|
1120
|
+
"input",
|
|
1121
|
+
{
|
|
1122
|
+
type: "number",
|
|
1123
|
+
min: 0,
|
|
1124
|
+
max: 50,
|
|
1125
|
+
step: 1,
|
|
1126
|
+
className: t.settingsInputNum,
|
|
1127
|
+
value: l.margins[r],
|
|
1128
|
+
onChange: (n) => g({ margins: { ...l.margins, [r]: +n.target.value } })
|
|
1129
|
+
}
|
|
1130
|
+
),
|
|
1131
|
+
/* @__PURE__ */ e("span", { className: t.settingsUnit, children: "mm" })
|
|
1132
|
+
] }, r))
|
|
1133
|
+
] })
|
|
1134
|
+
] })
|
|
1135
|
+
] })
|
|
1136
|
+
] });
|
|
1137
|
+
}, Pn = ({
|
|
1138
|
+
field: a,
|
|
1139
|
+
activeTab: i,
|
|
1140
|
+
onTabChange: p,
|
|
1141
|
+
onChange: l,
|
|
1142
|
+
paperWidthMm: k,
|
|
1143
|
+
paperHeightMm: h
|
|
1144
|
+
}) => {
|
|
1145
|
+
var c, T, N, r;
|
|
1146
|
+
const S = $(
|
|
1147
|
+
(n) => a && l({ position: { ...a.position, ...n } }),
|
|
1148
|
+
[a, l]
|
|
1149
|
+
), b = $(
|
|
1150
|
+
(n) => a && l({ style: { ...(a == null ? void 0 : a.style) ?? {}, ...n } }),
|
|
1151
|
+
[a, l]
|
|
1152
|
+
);
|
|
1153
|
+
if (!a)
|
|
1154
|
+
return /* @__PURE__ */ s("div", { className: t.rightPanel, children: [
|
|
1155
|
+
/* @__PURE__ */ e("div", { className: t.panelHeader, children: "Właściwości" }),
|
|
1156
|
+
/* @__PURE__ */ s("div", { className: t.propsEmpty, children: [
|
|
1157
|
+
/* @__PURE__ */ e("div", { className: t.propsEmptyIcon, children: "⬚" }),
|
|
1158
|
+
/* @__PURE__ */ e("div", { className: t.propsEmptyText, children: "Zaznacz element na szablonie" }),
|
|
1159
|
+
/* @__PURE__ */ s("div", { className: t.shortcutGrid, children: [
|
|
1160
|
+
/* @__PURE__ */ e(ne, { keys: "Del", label: "Usuń" }),
|
|
1161
|
+
/* @__PURE__ */ e(ne, { keys: "Ctrl+D", label: "Duplikuj" }),
|
|
1162
|
+
/* @__PURE__ */ e(ne, { keys: "↑↓←→", label: "Przesuń" }),
|
|
1163
|
+
/* @__PURE__ */ e(ne, { keys: "Ctrl+Z", label: "Cofnij" }),
|
|
1164
|
+
/* @__PURE__ */ e(ne, { keys: "Ctrl+A", label: "Zaznacz wszystko" }),
|
|
1165
|
+
/* @__PURE__ */ e(ne, { keys: "Shift+↑", label: "Przesuń 5mm" })
|
|
1166
|
+
] })
|
|
1167
|
+
] })
|
|
1168
|
+
] });
|
|
1169
|
+
const g = !["line", "rect", "image", "static_image", "barcode", "qr", "signature"].includes(
|
|
1170
|
+
a.type
|
|
1171
|
+
), v = ![
|
|
1172
|
+
"static_text",
|
|
1173
|
+
"static_image",
|
|
1174
|
+
"line",
|
|
1175
|
+
"rect",
|
|
1176
|
+
"page_number",
|
|
1177
|
+
"total_pages",
|
|
1178
|
+
"print_date"
|
|
1179
|
+
].includes(a.type);
|
|
1180
|
+
return /* @__PURE__ */ s("div", { className: t.rightPanel, children: [
|
|
1181
|
+
/* @__PURE__ */ s("div", { className: t.panelHeader, children: [
|
|
1182
|
+
/* @__PURE__ */ e("span", { className: t.panelHeaderIcon, children: ce[a.type] }),
|
|
1183
|
+
/* @__PURE__ */ e("span", { className: t.panelHeaderName, children: a.name })
|
|
1184
|
+
] }),
|
|
1185
|
+
/* @__PURE__ */ e("div", { className: t.rightTabs, children: $n.map((n) => n.id === "data" && !v ? null : /* @__PURE__ */ e(
|
|
1186
|
+
"button",
|
|
1187
|
+
{
|
|
1188
|
+
className: `${t.rightTab} ${i === n.id ? t.rightTabActive : ""}`,
|
|
1189
|
+
onClick: () => p(n.id),
|
|
1190
|
+
children: n.label
|
|
1191
|
+
},
|
|
1192
|
+
n.id
|
|
1193
|
+
)) }),
|
|
1194
|
+
/* @__PURE__ */ s("div", { className: t.propsBody, children: [
|
|
1195
|
+
i === "position" && /* @__PURE__ */ s(Y, { children: [
|
|
1196
|
+
/* @__PURE__ */ s("div", { className: t.posGrid, children: [
|
|
1197
|
+
[
|
|
1198
|
+
{ key: "x", label: "X", unit: "mm" },
|
|
1199
|
+
{ key: "y", label: "Y", unit: "mm" },
|
|
1200
|
+
{ key: "width", label: "Szer.", unit: "mm" },
|
|
1201
|
+
{ key: "height", label: "Wys.", unit: "mm" }
|
|
1202
|
+
].map(({ key: n, label: u, unit: m }) => /* @__PURE__ */ s("div", { className: t.posCell, children: [
|
|
1203
|
+
/* @__PURE__ */ e("label", { className: t.posLabel, children: u }),
|
|
1204
|
+
/* @__PURE__ */ e(
|
|
1205
|
+
"input",
|
|
1206
|
+
{
|
|
1207
|
+
type: "number",
|
|
1208
|
+
step: 0.5,
|
|
1209
|
+
className: t.posInput,
|
|
1210
|
+
value: Math.round(a.position[n] * 10) / 10,
|
|
1211
|
+
onChange: (f) => S({ [n]: +f.target.value })
|
|
1212
|
+
}
|
|
1213
|
+
),
|
|
1214
|
+
/* @__PURE__ */ e("span", { className: t.posUnit, children: m })
|
|
1215
|
+
] }, n)),
|
|
1216
|
+
/* @__PURE__ */ s("div", { className: t.posCell, children: [
|
|
1217
|
+
/* @__PURE__ */ e("label", { className: t.posLabel, children: "Obrót" }),
|
|
1218
|
+
/* @__PURE__ */ e(
|
|
1219
|
+
"input",
|
|
1220
|
+
{
|
|
1221
|
+
type: "number",
|
|
1222
|
+
step: 5,
|
|
1223
|
+
className: t.posInput,
|
|
1224
|
+
value: a.style.rotation ?? 0,
|
|
1225
|
+
onChange: (n) => b({ rotation: +n.target.value })
|
|
1226
|
+
}
|
|
1227
|
+
),
|
|
1228
|
+
/* @__PURE__ */ e("span", { className: t.posUnit, children: "°" })
|
|
1229
|
+
] }),
|
|
1230
|
+
/* @__PURE__ */ s("div", { className: t.posCell, children: [
|
|
1231
|
+
/* @__PURE__ */ e("label", { className: t.posLabel, children: "Z-idx" }),
|
|
1232
|
+
/* @__PURE__ */ e(
|
|
1233
|
+
"input",
|
|
1234
|
+
{
|
|
1235
|
+
type: "number",
|
|
1236
|
+
step: 1,
|
|
1237
|
+
min: 1,
|
|
1238
|
+
className: t.posInput,
|
|
1239
|
+
value: a.position.zIndex ?? 1,
|
|
1240
|
+
onChange: (n) => S({ zIndex: +n.target.value })
|
|
1241
|
+
}
|
|
1242
|
+
)
|
|
1243
|
+
] })
|
|
1244
|
+
] }),
|
|
1245
|
+
/* @__PURE__ */ s("div", { className: t.snapSection, children: [
|
|
1246
|
+
/* @__PURE__ */ e("div", { className: t.snapTitle, children: "Wyrównanie do strony" }),
|
|
1247
|
+
/* @__PURE__ */ s("div", { className: t.snapRow, children: [
|
|
1248
|
+
/* @__PURE__ */ e("button", { className: t.snapBtn, onClick: () => S({ x: 0 }), title: "Lewa krawędź", children: "⫷" }),
|
|
1249
|
+
/* @__PURE__ */ e(
|
|
1250
|
+
"button",
|
|
1251
|
+
{
|
|
1252
|
+
className: t.snapBtn,
|
|
1253
|
+
onClick: () => S({ x: (k - a.position.width) / 2 }),
|
|
1254
|
+
title: "Środek poziomy",
|
|
1255
|
+
children: "⊕"
|
|
1256
|
+
}
|
|
1257
|
+
),
|
|
1258
|
+
/* @__PURE__ */ e(
|
|
1259
|
+
"button",
|
|
1260
|
+
{
|
|
1261
|
+
className: t.snapBtn,
|
|
1262
|
+
onClick: () => S({ x: k - a.position.width }),
|
|
1263
|
+
title: "Prawa krawędź",
|
|
1264
|
+
children: "⫸"
|
|
1265
|
+
}
|
|
1266
|
+
)
|
|
1267
|
+
] })
|
|
1268
|
+
] })
|
|
1269
|
+
] }),
|
|
1270
|
+
i === "style" && /* @__PURE__ */ s(Y, { children: [
|
|
1271
|
+
g && /* @__PURE__ */ s("div", { className: t.styleGroup, children: [
|
|
1272
|
+
/* @__PURE__ */ e("div", { className: t.styleGroupTitle, children: "Czcionka" }),
|
|
1273
|
+
/* @__PURE__ */ s("div", { className: t.styleRow, children: [
|
|
1274
|
+
/* @__PURE__ */ e("label", { className: t.styleLabel, children: "Rodzina" }),
|
|
1275
|
+
/* @__PURE__ */ e(
|
|
1276
|
+
"select",
|
|
1277
|
+
{
|
|
1278
|
+
className: t.styleSelectFull,
|
|
1279
|
+
value: a.style.fontFamily ?? "sans-serif",
|
|
1280
|
+
onChange: (n) => b({ fontFamily: n.target.value }),
|
|
1281
|
+
children: Bn.map((n) => /* @__PURE__ */ e("option", { value: n, children: n }, n))
|
|
1282
|
+
}
|
|
1283
|
+
)
|
|
1284
|
+
] }),
|
|
1285
|
+
/* @__PURE__ */ s("div", { className: t.styleRow, children: [
|
|
1286
|
+
/* @__PURE__ */ e("label", { className: t.styleLabel, children: "Rozmiar" }),
|
|
1287
|
+
/* @__PURE__ */ e(
|
|
1288
|
+
"select",
|
|
1289
|
+
{
|
|
1290
|
+
className: t.styleSelectSm,
|
|
1291
|
+
value: fe.includes(a.style.fontSize ?? 10) ? a.style.fontSize ?? 10 : "",
|
|
1292
|
+
onChange: (n) => b({ fontSize: +n.target.value }),
|
|
1293
|
+
children: fe.map((n) => /* @__PURE__ */ e("option", { value: n, children: n }, n))
|
|
1294
|
+
}
|
|
1295
|
+
),
|
|
1296
|
+
/* @__PURE__ */ e(
|
|
1297
|
+
"input",
|
|
1298
|
+
{
|
|
1299
|
+
type: "number",
|
|
1300
|
+
step: 0.5,
|
|
1301
|
+
min: 4,
|
|
1302
|
+
max: 200,
|
|
1303
|
+
className: t.styleInput,
|
|
1304
|
+
value: a.style.fontSize ?? 10,
|
|
1305
|
+
onChange: (n) => b({ fontSize: +n.target.value })
|
|
1306
|
+
}
|
|
1307
|
+
),
|
|
1308
|
+
/* @__PURE__ */ e("span", { className: t.styleUnit, children: "pt" })
|
|
1309
|
+
] }),
|
|
1310
|
+
/* @__PURE__ */ s("div", { className: t.styleRow, children: [
|
|
1311
|
+
/* @__PURE__ */ e("label", { className: t.styleLabel, children: "Kolor" }),
|
|
1312
|
+
/* @__PURE__ */ e(
|
|
1313
|
+
"input",
|
|
1314
|
+
{
|
|
1315
|
+
type: "color",
|
|
1316
|
+
className: t.colorPicker,
|
|
1317
|
+
value: a.style.color ?? "var(--nice-text, #000000)",
|
|
1318
|
+
onChange: (n) => b({ color: n.target.value })
|
|
1319
|
+
}
|
|
1320
|
+
),
|
|
1321
|
+
/* @__PURE__ */ e(
|
|
1322
|
+
"input",
|
|
1323
|
+
{
|
|
1324
|
+
className: t.colorHex,
|
|
1325
|
+
value: a.style.color ?? "var(--nice-text, #000000)",
|
|
1326
|
+
onChange: (n) => b({ color: n.target.value }),
|
|
1327
|
+
maxLength: 7
|
|
1328
|
+
}
|
|
1329
|
+
)
|
|
1330
|
+
] }),
|
|
1331
|
+
/* @__PURE__ */ s("div", { className: t.styleRow, children: [
|
|
1332
|
+
/* @__PURE__ */ e("label", { className: t.styleLabel, children: "Styl" }),
|
|
1333
|
+
/* @__PURE__ */ s("div", { className: t.toggleGroup, children: [
|
|
1334
|
+
/* @__PURE__ */ e(
|
|
1335
|
+
"button",
|
|
1336
|
+
{
|
|
1337
|
+
className: `${t.toggleBtn} ${a.style.fontWeight === "bold" ? t.toggleBtnActive : ""}`,
|
|
1338
|
+
onClick: () => b({ fontWeight: a.style.fontWeight === "bold" ? "normal" : "bold" }),
|
|
1339
|
+
children: /* @__PURE__ */ e("b", { children: "B" })
|
|
1340
|
+
}
|
|
1341
|
+
),
|
|
1342
|
+
/* @__PURE__ */ e(
|
|
1343
|
+
"button",
|
|
1344
|
+
{
|
|
1345
|
+
className: `${t.toggleBtn} ${a.style.fontStyle === "italic" ? t.toggleBtnActive : ""}`,
|
|
1346
|
+
onClick: () => b({ fontStyle: a.style.fontStyle === "italic" ? "normal" : "italic" }),
|
|
1347
|
+
children: /* @__PURE__ */ e("i", { children: "I" })
|
|
1348
|
+
}
|
|
1349
|
+
)
|
|
1350
|
+
] })
|
|
1351
|
+
] }),
|
|
1352
|
+
/* @__PURE__ */ s("div", { className: t.styleRow, children: [
|
|
1353
|
+
/* @__PURE__ */ e("label", { className: t.styleLabel, children: "Wyrówn." }),
|
|
1354
|
+
/* @__PURE__ */ e("div", { className: t.toggleGroup, children: ["left", "center", "right", "justify"].map((n) => /* @__PURE__ */ e(
|
|
1355
|
+
"button",
|
|
1356
|
+
{
|
|
1357
|
+
title: n,
|
|
1358
|
+
className: `${t.toggleBtn} ${(a.style.textAlign ?? "left") === n ? t.toggleBtnActive : ""}`,
|
|
1359
|
+
onClick: () => b({ textAlign: n }),
|
|
1360
|
+
children: n === "left" ? "≡L" : n === "center" ? "≡C" : n === "right" ? "≡R" : "≡J"
|
|
1361
|
+
},
|
|
1362
|
+
n
|
|
1363
|
+
)) })
|
|
1364
|
+
] }),
|
|
1365
|
+
/* @__PURE__ */ s("div", { className: t.styleRow, children: [
|
|
1366
|
+
/* @__PURE__ */ e("label", { className: t.styleLabel, children: "W. linii" }),
|
|
1367
|
+
/* @__PURE__ */ e(
|
|
1368
|
+
"input",
|
|
1369
|
+
{
|
|
1370
|
+
type: "number",
|
|
1371
|
+
step: 0.1,
|
|
1372
|
+
min: 1,
|
|
1373
|
+
max: 4,
|
|
1374
|
+
className: t.styleInput,
|
|
1375
|
+
value: a.style.lineHeight ?? 1.4,
|
|
1376
|
+
onChange: (n) => b({ lineHeight: +n.target.value })
|
|
1377
|
+
}
|
|
1378
|
+
)
|
|
1379
|
+
] }),
|
|
1380
|
+
/* @__PURE__ */ s("div", { className: t.styleRow, children: [
|
|
1381
|
+
/* @__PURE__ */ e("label", { className: t.styleLabel, children: "Odstępy" }),
|
|
1382
|
+
/* @__PURE__ */ e(
|
|
1383
|
+
"input",
|
|
1384
|
+
{
|
|
1385
|
+
type: "number",
|
|
1386
|
+
step: 0.01,
|
|
1387
|
+
min: -0.1,
|
|
1388
|
+
max: 0.5,
|
|
1389
|
+
className: t.styleInput,
|
|
1390
|
+
value: a.style.letterSpacing ?? 0,
|
|
1391
|
+
onChange: (n) => b({ letterSpacing: +n.target.value })
|
|
1392
|
+
}
|
|
1393
|
+
),
|
|
1394
|
+
/* @__PURE__ */ e("span", { className: t.styleUnit, children: "em" })
|
|
1395
|
+
] })
|
|
1396
|
+
] }),
|
|
1397
|
+
/* @__PURE__ */ s("div", { className: t.styleGroup, children: [
|
|
1398
|
+
/* @__PURE__ */ e("div", { className: t.styleGroupTitle, children: "Tło i ramka" }),
|
|
1399
|
+
/* @__PURE__ */ s("div", { className: t.styleRow, children: [
|
|
1400
|
+
/* @__PURE__ */ e("label", { className: t.styleLabel, children: "Tło" }),
|
|
1401
|
+
/* @__PURE__ */ e(
|
|
1402
|
+
"input",
|
|
1403
|
+
{
|
|
1404
|
+
type: "color",
|
|
1405
|
+
className: t.colorPicker,
|
|
1406
|
+
value: a.style.backgroundColor ?? "var(--nice-bg, #fff)",
|
|
1407
|
+
onChange: (n) => b({ backgroundColor: n.target.value })
|
|
1408
|
+
}
|
|
1409
|
+
),
|
|
1410
|
+
/* @__PURE__ */ e(
|
|
1411
|
+
"button",
|
|
1412
|
+
{
|
|
1413
|
+
className: t.clearBtn,
|
|
1414
|
+
onClick: () => b({ backgroundColor: void 0 }),
|
|
1415
|
+
title: "Wyczyść tło",
|
|
1416
|
+
children: "✕"
|
|
1417
|
+
}
|
|
1418
|
+
)
|
|
1419
|
+
] }),
|
|
1420
|
+
/* @__PURE__ */ s("div", { className: t.styleRow, children: [
|
|
1421
|
+
/* @__PURE__ */ e("label", { className: t.styleLabel, children: "Ramka" }),
|
|
1422
|
+
/* @__PURE__ */ e(
|
|
1423
|
+
"input",
|
|
1424
|
+
{
|
|
1425
|
+
type: "number",
|
|
1426
|
+
step: 0.5,
|
|
1427
|
+
min: 0,
|
|
1428
|
+
max: 10,
|
|
1429
|
+
className: t.styleInput,
|
|
1430
|
+
value: a.style.borderWidth ?? 0,
|
|
1431
|
+
onChange: (n) => b({ borderWidth: +n.target.value })
|
|
1432
|
+
}
|
|
1433
|
+
),
|
|
1434
|
+
/* @__PURE__ */ e(
|
|
1435
|
+
"input",
|
|
1436
|
+
{
|
|
1437
|
+
type: "color",
|
|
1438
|
+
className: t.colorPicker,
|
|
1439
|
+
value: a.style.borderColor ?? "var(--nice-text, #000000)",
|
|
1440
|
+
onChange: (n) => b({ borderColor: n.target.value })
|
|
1441
|
+
}
|
|
1442
|
+
),
|
|
1443
|
+
/* @__PURE__ */ s(
|
|
1444
|
+
"select",
|
|
1445
|
+
{
|
|
1446
|
+
className: t.styleSelectXs,
|
|
1447
|
+
value: a.style.borderStyle ?? "solid",
|
|
1448
|
+
onChange: (n) => b({ borderStyle: n.target.value }),
|
|
1449
|
+
children: [
|
|
1450
|
+
/* @__PURE__ */ e("option", { value: "solid", children: "─" }),
|
|
1451
|
+
/* @__PURE__ */ e("option", { value: "dashed", children: "- -" }),
|
|
1452
|
+
/* @__PURE__ */ e("option", { value: "dotted", children: "···" })
|
|
1453
|
+
]
|
|
1454
|
+
}
|
|
1455
|
+
)
|
|
1456
|
+
] }),
|
|
1457
|
+
/* @__PURE__ */ s("div", { className: t.styleRow, children: [
|
|
1458
|
+
/* @__PURE__ */ e("label", { className: t.styleLabel, children: "Zaokr." }),
|
|
1459
|
+
/* @__PURE__ */ e(
|
|
1460
|
+
"input",
|
|
1461
|
+
{
|
|
1462
|
+
type: "number",
|
|
1463
|
+
step: 1,
|
|
1464
|
+
min: 0,
|
|
1465
|
+
max: 50,
|
|
1466
|
+
className: t.styleInput,
|
|
1467
|
+
value: a.style.borderRadius ?? 0,
|
|
1468
|
+
onChange: (n) => b({ borderRadius: +n.target.value })
|
|
1469
|
+
}
|
|
1470
|
+
),
|
|
1471
|
+
/* @__PURE__ */ e("span", { className: t.styleUnit, children: "px" })
|
|
1472
|
+
] }),
|
|
1473
|
+
/* @__PURE__ */ s("div", { className: t.styleRow, children: [
|
|
1474
|
+
/* @__PURE__ */ e("label", { className: t.styleLabel, children: "Padding" }),
|
|
1475
|
+
/* @__PURE__ */ e(
|
|
1476
|
+
"input",
|
|
1477
|
+
{
|
|
1478
|
+
type: "number",
|
|
1479
|
+
step: 0.5,
|
|
1480
|
+
min: 0,
|
|
1481
|
+
max: 20,
|
|
1482
|
+
className: t.styleInput,
|
|
1483
|
+
value: a.style.padding ?? 0,
|
|
1484
|
+
onChange: (n) => b({ padding: +n.target.value })
|
|
1485
|
+
}
|
|
1486
|
+
),
|
|
1487
|
+
/* @__PURE__ */ e("span", { className: t.styleUnit, children: "mm" })
|
|
1488
|
+
] }),
|
|
1489
|
+
/* @__PURE__ */ s("div", { className: t.styleRow, children: [
|
|
1490
|
+
/* @__PURE__ */ e("label", { className: t.styleLabel, children: "Krycie" }),
|
|
1491
|
+
/* @__PURE__ */ e(
|
|
1492
|
+
"input",
|
|
1493
|
+
{
|
|
1494
|
+
type: "range",
|
|
1495
|
+
min: 0.1,
|
|
1496
|
+
max: 1,
|
|
1497
|
+
step: 0.05,
|
|
1498
|
+
className: t.sliderInput,
|
|
1499
|
+
value: a.style.opacity ?? 1,
|
|
1500
|
+
onChange: (n) => b({ opacity: +n.target.value })
|
|
1501
|
+
}
|
|
1502
|
+
),
|
|
1503
|
+
/* @__PURE__ */ s("span", { className: t.styleValue, children: [
|
|
1504
|
+
Math.round((a.style.opacity ?? 1) * 100),
|
|
1505
|
+
"%"
|
|
1506
|
+
] })
|
|
1507
|
+
] })
|
|
1508
|
+
] })
|
|
1509
|
+
] }),
|
|
1510
|
+
i === "data" && v && /* @__PURE__ */ s("div", { className: t.styleGroup, children: [
|
|
1511
|
+
/* @__PURE__ */ e("div", { className: t.styleGroupTitle, children: "Źródło danych" }),
|
|
1512
|
+
/* @__PURE__ */ s("div", { className: t.styleRow, children: [
|
|
1513
|
+
/* @__PURE__ */ e("label", { className: t.styleLabel, children: "Ścieżka" }),
|
|
1514
|
+
/* @__PURE__ */ e(
|
|
1515
|
+
"input",
|
|
1516
|
+
{
|
|
1517
|
+
className: t.styleInputFull,
|
|
1518
|
+
value: a.dataPath,
|
|
1519
|
+
onChange: (n) => l({ dataPath: n.target.value }),
|
|
1520
|
+
placeholder: "np. invoice.number"
|
|
1521
|
+
}
|
|
1522
|
+
)
|
|
1523
|
+
] }),
|
|
1524
|
+
/* @__PURE__ */ s("div", { className: t.styleRow, children: [
|
|
1525
|
+
/* @__PURE__ */ e("label", { className: t.styleLabel, children: "Format" }),
|
|
1526
|
+
/* @__PURE__ */ e(
|
|
1527
|
+
"input",
|
|
1528
|
+
{
|
|
1529
|
+
className: t.styleInputFull,
|
|
1530
|
+
value: a.format ?? "",
|
|
1531
|
+
onChange: (n) => l({ format: n.target.value }),
|
|
1532
|
+
placeholder: "DD.MM.YYYY / #,##0.00"
|
|
1533
|
+
}
|
|
1534
|
+
)
|
|
1535
|
+
] }),
|
|
1536
|
+
/* @__PURE__ */ s("div", { className: t.styleRow, children: [
|
|
1537
|
+
/* @__PURE__ */ e("label", { className: t.styleLabel, children: "Domyślny" }),
|
|
1538
|
+
/* @__PURE__ */ e(
|
|
1539
|
+
"input",
|
|
1540
|
+
{
|
|
1541
|
+
className: t.styleInputFull,
|
|
1542
|
+
value: a.fallback ?? "",
|
|
1543
|
+
onChange: (n) => l({ fallback: n.target.value }),
|
|
1544
|
+
placeholder: "Gdy brak wartości"
|
|
1545
|
+
}
|
|
1546
|
+
)
|
|
1547
|
+
] }),
|
|
1548
|
+
/* @__PURE__ */ s("div", { className: t.styleRow, children: [
|
|
1549
|
+
/* @__PURE__ */ e("label", { className: t.styleLabel, children: "Typ" }),
|
|
1550
|
+
/* @__PURE__ */ e(
|
|
1551
|
+
"select",
|
|
1552
|
+
{
|
|
1553
|
+
className: t.styleSelectFull,
|
|
1554
|
+
value: a.type,
|
|
1555
|
+
onChange: (n) => l({ type: n.target.value }),
|
|
1556
|
+
children: Object.entries(de).map(([n, u]) => /* @__PURE__ */ e("option", { value: n, children: u }, n))
|
|
1557
|
+
}
|
|
1558
|
+
)
|
|
1559
|
+
] }),
|
|
1560
|
+
(a.type === "barcode" || a.type === "qr") && /* @__PURE__ */ s("div", { className: t.styleRow, children: [
|
|
1561
|
+
/* @__PURE__ */ e("label", { className: t.styleLabel, children: "Format kodu" }),
|
|
1562
|
+
/* @__PURE__ */ e(
|
|
1563
|
+
"select",
|
|
1564
|
+
{
|
|
1565
|
+
className: t.styleSelectFull,
|
|
1566
|
+
value: a.barcodeType ?? "code128",
|
|
1567
|
+
onChange: (n) => l({ barcodeType: n.target.value }),
|
|
1568
|
+
children: ["ean13", "ean8", "code128", "code39", "upc", "itf14", "datamatrix"].map((n) => /* @__PURE__ */ e("option", { value: n, children: n.toUpperCase() }, n))
|
|
1569
|
+
}
|
|
1570
|
+
)
|
|
1571
|
+
] })
|
|
1572
|
+
] }),
|
|
1573
|
+
i === "conditional" && /* @__PURE__ */ s("div", { className: t.styleGroup, children: [
|
|
1574
|
+
/* @__PURE__ */ e("div", { className: t.styleGroupTitle, children: "Widoczność warunkowa" }),
|
|
1575
|
+
/* @__PURE__ */ e("div", { className: t.conditionalHint, children: "Element zostanie ukryty gdy warunek nie jest spełniony." }),
|
|
1576
|
+
/* @__PURE__ */ s("div", { className: t.styleRow, children: [
|
|
1577
|
+
/* @__PURE__ */ e("label", { className: t.styleLabel, children: "Pole" }),
|
|
1578
|
+
/* @__PURE__ */ e(
|
|
1579
|
+
"input",
|
|
1580
|
+
{
|
|
1581
|
+
className: t.styleInputFull,
|
|
1582
|
+
value: ((c = a.conditional) == null ? void 0 : c.field) ?? "",
|
|
1583
|
+
onChange: (n) => {
|
|
1584
|
+
var u, m;
|
|
1585
|
+
return l({
|
|
1586
|
+
conditional: {
|
|
1587
|
+
field: n.target.value,
|
|
1588
|
+
operator: ((u = a.conditional) == null ? void 0 : u.operator) ?? "eq",
|
|
1589
|
+
value: (m = a.conditional) == null ? void 0 : m.value
|
|
1590
|
+
}
|
|
1591
|
+
});
|
|
1592
|
+
},
|
|
1593
|
+
placeholder: "np. invoice.isPaid"
|
|
1594
|
+
}
|
|
1595
|
+
)
|
|
1596
|
+
] }),
|
|
1597
|
+
/* @__PURE__ */ s("div", { className: t.styleRow, children: [
|
|
1598
|
+
/* @__PURE__ */ e("label", { className: t.styleLabel, children: "Operator" }),
|
|
1599
|
+
/* @__PURE__ */ s(
|
|
1600
|
+
"select",
|
|
1601
|
+
{
|
|
1602
|
+
className: t.styleSelectFull,
|
|
1603
|
+
value: ((T = a.conditional) == null ? void 0 : T.operator) ?? "eq",
|
|
1604
|
+
onChange: (n) => {
|
|
1605
|
+
var u, m;
|
|
1606
|
+
return l({
|
|
1607
|
+
conditional: {
|
|
1608
|
+
field: ((u = a.conditional) == null ? void 0 : u.field) ?? "",
|
|
1609
|
+
operator: n.target.value,
|
|
1610
|
+
value: (m = a.conditional) == null ? void 0 : m.value
|
|
1611
|
+
}
|
|
1612
|
+
});
|
|
1613
|
+
},
|
|
1614
|
+
children: [
|
|
1615
|
+
/* @__PURE__ */ e("option", { value: "eq", children: "= r�wne" }),
|
|
1616
|
+
/* @__PURE__ */ e("option", { value: "neq", children: "≠ różne" }),
|
|
1617
|
+
/* @__PURE__ */ e("option", { value: "gt", children: "> wieksze" }),
|
|
1618
|
+
/* @__PURE__ */ e("option", { value: "lt", children: "< mniejsze" }),
|
|
1619
|
+
/* @__PURE__ */ e("option", { value: "contains", children: "zawiera" })
|
|
1620
|
+
]
|
|
1621
|
+
}
|
|
1622
|
+
)
|
|
1623
|
+
] }),
|
|
1624
|
+
/* @__PURE__ */ s("div", { className: t.styleRow, children: [
|
|
1625
|
+
/* @__PURE__ */ e("label", { className: t.styleLabel, children: "Wartosc" }),
|
|
1626
|
+
/* @__PURE__ */ e(
|
|
1627
|
+
"input",
|
|
1628
|
+
{
|
|
1629
|
+
className: t.styleInputFull,
|
|
1630
|
+
value: String(((N = a.conditional) == null ? void 0 : N.value) ?? ""),
|
|
1631
|
+
onChange: (n) => {
|
|
1632
|
+
var u, m;
|
|
1633
|
+
return l({
|
|
1634
|
+
conditional: {
|
|
1635
|
+
field: ((u = a.conditional) == null ? void 0 : u.field) ?? "",
|
|
1636
|
+
operator: ((m = a.conditional) == null ? void 0 : m.operator) ?? "eq",
|
|
1637
|
+
value: n.target.value
|
|
1638
|
+
}
|
|
1639
|
+
});
|
|
1640
|
+
},
|
|
1641
|
+
placeholder: 'np. true / "PAID"'
|
|
1642
|
+
}
|
|
1643
|
+
)
|
|
1644
|
+
] }),
|
|
1645
|
+
((r = a.conditional) == null ? void 0 : r.field) && /* @__PURE__ */ e(
|
|
1646
|
+
"button",
|
|
1647
|
+
{
|
|
1648
|
+
className: t.clearConditionalBtn,
|
|
1649
|
+
onClick: () => l({ conditional: void 0 }),
|
|
1650
|
+
children: "Wyczyść warunek"
|
|
1651
|
+
}
|
|
1652
|
+
)
|
|
1653
|
+
] })
|
|
1654
|
+
] })
|
|
1655
|
+
] });
|
|
1656
|
+
};
|
|
1657
|
+
function Mn() {
|
|
1658
|
+
return {
|
|
1659
|
+
id: `tpl-${Date.now()}`,
|
|
1660
|
+
name: "Nowy szablon",
|
|
1661
|
+
description: "",
|
|
1662
|
+
paperSize: "A4",
|
|
1663
|
+
orientation: "portrait",
|
|
1664
|
+
margins: { top: 20, right: 15, bottom: 20, left: 15 },
|
|
1665
|
+
sections: [
|
|
1666
|
+
{ id: "sec-header", type: "header", heightMm: 35, fields: [] },
|
|
1667
|
+
{ id: "sec-body", type: "body", fields: [] },
|
|
1668
|
+
{ id: "sec-footer", type: "footer", heightMm: 20, fields: [] }
|
|
1669
|
+
],
|
|
1670
|
+
watermarks: [],
|
|
1671
|
+
signatures: []
|
|
1672
|
+
};
|
|
1673
|
+
}
|
|
1674
|
+
const Qr = ({
|
|
1675
|
+
template: a,
|
|
1676
|
+
dataSchema: i,
|
|
1677
|
+
sampleData: p = [],
|
|
1678
|
+
onChange: l,
|
|
1679
|
+
onSave: k,
|
|
1680
|
+
readOnly: h = !1,
|
|
1681
|
+
className: S,
|
|
1682
|
+
style: b,
|
|
1683
|
+
theme: g = "light"
|
|
1684
|
+
}) => {
|
|
1685
|
+
const [{ past: v, present: c, future: T }, N] = je(Cn, {
|
|
1686
|
+
past: [],
|
|
1687
|
+
present: a ?? Mn(),
|
|
1688
|
+
future: []
|
|
1689
|
+
}), [r, n] = M(/* @__PURE__ */ new Set()), [u, m] = M("sec-body"), [f, D] = M(1), [y, x] = M(0), [I, E] = M("fields"), [W, P] = M("position"), [_, q] = M(!1), [pe, Ce] = M(!0), R = $(
|
|
1690
|
+
(o) => {
|
|
1691
|
+
const d = { ...c, ...o };
|
|
1692
|
+
N({ type: "UPDATE", payload: d }), l == null || l(d);
|
|
1693
|
+
},
|
|
1694
|
+
[c, l]
|
|
1695
|
+
), [Z, me] = oe(() => {
|
|
1696
|
+
const [o, d] = Ne[c.paperSize] ?? Ne.A4;
|
|
1697
|
+
return c.orientation === "landscape" ? [d, o] : [o, d];
|
|
1698
|
+
}, [c.paperSize, c.orientation]), X = oe(() => c.sections.flatMap((o) => o.fields), [c]), G = oe(
|
|
1699
|
+
() => X.find((o) => r.has(o.id)) ?? null,
|
|
1700
|
+
[X, r]
|
|
1701
|
+
), ue = $(
|
|
1702
|
+
(o, d) => {
|
|
1703
|
+
R({
|
|
1704
|
+
sections: c.sections.map((C) => ({
|
|
1705
|
+
...C,
|
|
1706
|
+
fields: C.fields.map(
|
|
1707
|
+
(B) => B.id === o ? { ...B, ...d, style: { ...B.style, ...d.style ?? {} } } : B
|
|
1708
|
+
)
|
|
1709
|
+
}))
|
|
1710
|
+
});
|
|
1711
|
+
},
|
|
1712
|
+
[c, R]
|
|
1713
|
+
), re = $(
|
|
1714
|
+
(o) => {
|
|
1715
|
+
R({
|
|
1716
|
+
sections: c.sections.map((d) => ({
|
|
1717
|
+
...d,
|
|
1718
|
+
fields: d.fields.map(
|
|
1719
|
+
(C) => r.has(C.id) ? { ...C, ...o, style: { ...C.style, ...o.style ?? {} } } : C
|
|
1720
|
+
)
|
|
1721
|
+
}))
|
|
1722
|
+
});
|
|
1723
|
+
},
|
|
1724
|
+
[c, r, R]
|
|
1725
|
+
), be = $(
|
|
1726
|
+
(o, d) => {
|
|
1727
|
+
if (o === "watermark") {
|
|
1728
|
+
R({
|
|
1729
|
+
watermarks: [
|
|
1730
|
+
...c.watermarks ?? [],
|
|
1731
|
+
{
|
|
1732
|
+
id: se(),
|
|
1733
|
+
type: "text",
|
|
1734
|
+
text: "KOPIA",
|
|
1735
|
+
opacity: 0.12,
|
|
1736
|
+
angle: -45,
|
|
1737
|
+
fontSize: 60,
|
|
1738
|
+
color: "var(--nice-text-muted, #94a3b8)"
|
|
1739
|
+
}
|
|
1740
|
+
]
|
|
1741
|
+
}), E("watermarks");
|
|
1742
|
+
return;
|
|
1743
|
+
}
|
|
1744
|
+
if (o === "signature") {
|
|
1745
|
+
R({
|
|
1746
|
+
signatures: [
|
|
1747
|
+
...c.signatures ?? [],
|
|
1748
|
+
{
|
|
1749
|
+
id: se(),
|
|
1750
|
+
label: "Podpis",
|
|
1751
|
+
position: { x: 10, y: 5, width: 70, height: 22 },
|
|
1752
|
+
showLine: !0,
|
|
1753
|
+
showDate: !1
|
|
1754
|
+
}
|
|
1755
|
+
]
|
|
1756
|
+
}), E("signatures");
|
|
1757
|
+
return;
|
|
1758
|
+
}
|
|
1759
|
+
const C = c.sections.find((H) => H.id === u) ?? c.sections.find((H) => H.type === "body");
|
|
1760
|
+
if (!C)
|
|
1761
|
+
return;
|
|
1762
|
+
const B = ke(o, d), A = {
|
|
1763
|
+
sections: c.sections.map(
|
|
1764
|
+
(H) => H.id === C.id ? { ...H, fields: [...H.fields, B] } : H
|
|
1765
|
+
)
|
|
1766
|
+
};
|
|
1767
|
+
N({ type: "UPDATE", payload: { ...c, ...A } }), l == null || l({ ...c, ...A }), n(/* @__PURE__ */ new Set([B.id]));
|
|
1768
|
+
},
|
|
1769
|
+
[c, u, l]
|
|
1770
|
+
), Ie = $(
|
|
1771
|
+
(o, d, C, B) => {
|
|
1772
|
+
const A = i == null ? void 0 : i.fields.find((O) => O.path === d), H = ke((A == null ? void 0 : A.type) ?? "text", A);
|
|
1773
|
+
H.position.x = Math.round(C * 2) / 2, H.position.y = Math.round(B * 2) / 2;
|
|
1774
|
+
const J = {
|
|
1775
|
+
sections: c.sections.map(
|
|
1776
|
+
(O) => O.id === o ? { ...O, fields: [...O.fields, H] } : O
|
|
1777
|
+
)
|
|
1778
|
+
};
|
|
1779
|
+
N({ type: "UPDATE", payload: { ...c, ...J } }), l == null || l({ ...c, ...J }), n(/* @__PURE__ */ new Set([H.id]));
|
|
1780
|
+
},
|
|
1781
|
+
[c, i, l]
|
|
1782
|
+
), Le = $((o, d) => {
|
|
1783
|
+
d.ctrlKey || d.metaKey ? n((C) => {
|
|
1784
|
+
const B = new Set(C);
|
|
1785
|
+
return B.has(o) ? B.delete(o) : B.add(o), B;
|
|
1786
|
+
}) : d.shiftKey ? n((C) => /* @__PURE__ */ new Set([...C, o])) : n(/* @__PURE__ */ new Set([o]));
|
|
1787
|
+
}, []), xe = $(
|
|
1788
|
+
(o, d) => {
|
|
1789
|
+
if (h)
|
|
1790
|
+
return;
|
|
1791
|
+
d.preventDefault(), r.has(o) || n(/* @__PURE__ */ new Set([o]));
|
|
1792
|
+
const C = d.clientX, B = d.clientY, A = c.sections.map((O) => ({
|
|
1793
|
+
id: O.id,
|
|
1794
|
+
fields: O.fields.map((Q) => ({ id: Q.id, pos: { ...Q.position } }))
|
|
1795
|
+
})), H = (O) => {
|
|
1796
|
+
const Q = (O.clientX - C) / (f * F), te = (O.clientY - B) / (f * F), le = r.has(o) ? r : /* @__PURE__ */ new Set([o]), ie = c.sections.map((ee) => {
|
|
1797
|
+
const K = A.find((U) => U.id === ee.id);
|
|
1798
|
+
return {
|
|
1799
|
+
...ee,
|
|
1800
|
+
fields: ee.fields.map((U) => {
|
|
1801
|
+
var ve;
|
|
1802
|
+
if (!le.has(U.id))
|
|
1803
|
+
return U;
|
|
1804
|
+
const we = ((ve = K == null ? void 0 : K.fields.find((He) => He.id === U.id)) == null ? void 0 : ve.pos) ?? U.position;
|
|
1805
|
+
return {
|
|
1806
|
+
...U,
|
|
1807
|
+
position: {
|
|
1808
|
+
...U.position,
|
|
1809
|
+
x: Math.max(0, Math.round((we.x + Q) * 2) / 2),
|
|
1810
|
+
y: Math.max(0, Math.round((we.y + te) * 2) / 2)
|
|
1811
|
+
}
|
|
1812
|
+
};
|
|
1813
|
+
})
|
|
1814
|
+
};
|
|
1815
|
+
}), ae = { ...c, sections: ie };
|
|
1816
|
+
l == null || l(ae), N({ type: "UPDATE", payload: ae });
|
|
1817
|
+
}, J = () => {
|
|
1818
|
+
document.removeEventListener("mousemove", H), document.removeEventListener("mouseup", J);
|
|
1819
|
+
};
|
|
1820
|
+
document.addEventListener("mousemove", H), document.addEventListener("mouseup", J);
|
|
1821
|
+
},
|
|
1822
|
+
[c, f, r, h, l]
|
|
1823
|
+
), ze = $(
|
|
1824
|
+
(o, d, C) => {
|
|
1825
|
+
if (h)
|
|
1826
|
+
return;
|
|
1827
|
+
C.preventDefault();
|
|
1828
|
+
const B = X.find((te) => te.id === o);
|
|
1829
|
+
if (!B)
|
|
1830
|
+
return;
|
|
1831
|
+
const A = { ...B.position }, H = C.clientX, J = C.clientY, O = (te) => {
|
|
1832
|
+
const le = (te.clientX - H) / (f * F), ie = (te.clientY - J) / (f * F);
|
|
1833
|
+
let { x: ae, y: ee, width: K, height: U } = A;
|
|
1834
|
+
d.includes("e") && (K = Math.max(5, K + le)), d.includes("s") && (U = Math.max(3, U + ie)), d.includes("w") && (ae = ae + le, K = Math.max(5, K - le)), d.includes("n") && (ee = ee + ie, U = Math.max(3, U - ie)), ue(o, {
|
|
1835
|
+
position: {
|
|
1836
|
+
...A,
|
|
1837
|
+
x: Math.round(ae * 2) / 2,
|
|
1838
|
+
y: Math.round(ee * 2) / 2,
|
|
1839
|
+
width: Math.round(K * 2) / 2,
|
|
1840
|
+
height: Math.round(U * 2) / 2
|
|
1841
|
+
}
|
|
1842
|
+
});
|
|
1843
|
+
}, Q = () => {
|
|
1844
|
+
document.removeEventListener("mousemove", O), document.removeEventListener("mouseup", Q);
|
|
1845
|
+
};
|
|
1846
|
+
document.addEventListener("mousemove", O), document.addEventListener("mouseup", Q);
|
|
1847
|
+
},
|
|
1848
|
+
[X, f, h, ue]
|
|
1849
|
+
), he = $(() => {
|
|
1850
|
+
R({
|
|
1851
|
+
sections: c.sections.map((o) => ({
|
|
1852
|
+
...o,
|
|
1853
|
+
fields: o.fields.filter((d) => !r.has(d.id))
|
|
1854
|
+
}))
|
|
1855
|
+
}), n(/* @__PURE__ */ new Set());
|
|
1856
|
+
}, [c, r, R]), _e = $(() => {
|
|
1857
|
+
const o = /* @__PURE__ */ new Set();
|
|
1858
|
+
R({
|
|
1859
|
+
sections: c.sections.map((d) => {
|
|
1860
|
+
const C = d.fields.filter((B) => r.has(B.id)).map((B) => {
|
|
1861
|
+
const A = {
|
|
1862
|
+
...B,
|
|
1863
|
+
id: se(),
|
|
1864
|
+
position: { ...B.position, x: B.position.x + 5, y: B.position.y + 5 }
|
|
1865
|
+
};
|
|
1866
|
+
return o.add(A.id), A;
|
|
1867
|
+
});
|
|
1868
|
+
return { ...d, fields: [...d.fields, ...C] };
|
|
1869
|
+
})
|
|
1870
|
+
}), n(o);
|
|
1871
|
+
}, [c, r, R]), De = $(
|
|
1872
|
+
(o) => {
|
|
1873
|
+
R({
|
|
1874
|
+
sections: c.sections.map((d) => ({
|
|
1875
|
+
...d,
|
|
1876
|
+
fields: d.fields.map((C) => {
|
|
1877
|
+
if (!r.has(C.id))
|
|
1878
|
+
return C;
|
|
1879
|
+
const B = o === "left" ? c.margins.left : o === "right" ? Z - c.margins.right - C.position.width : (Z - C.position.width) / 2;
|
|
1880
|
+
return { ...C, position: { ...C.position, x: B } };
|
|
1881
|
+
})
|
|
1882
|
+
}))
|
|
1883
|
+
});
|
|
1884
|
+
},
|
|
1885
|
+
[c, r, Z, R]
|
|
1886
|
+
), Te = $(
|
|
1887
|
+
(o) => {
|
|
1888
|
+
const d = c.sections.find((B) => B.id === u);
|
|
1889
|
+
if (!d)
|
|
1890
|
+
return;
|
|
1891
|
+
const C = d.heightMm ?? 200;
|
|
1892
|
+
R({
|
|
1893
|
+
sections: c.sections.map((B) => B.id !== u ? B : {
|
|
1894
|
+
...B,
|
|
1895
|
+
fields: B.fields.map((A) => {
|
|
1896
|
+
if (!r.has(A.id))
|
|
1897
|
+
return A;
|
|
1898
|
+
const H = o === "top" ? 0 : o === "bottom" ? C - A.position.height : (C - A.position.height) / 2;
|
|
1899
|
+
return { ...A, position: { ...A.position, y: H } };
|
|
1900
|
+
})
|
|
1901
|
+
})
|
|
1902
|
+
});
|
|
1903
|
+
},
|
|
1904
|
+
[c, r, u, R]
|
|
1905
|
+
), $e = $(() => {
|
|
1906
|
+
R({
|
|
1907
|
+
sections: c.sections.map((o) => ({
|
|
1908
|
+
...o,
|
|
1909
|
+
fields: o.fields.map(
|
|
1910
|
+
(d) => r.has(d.id) ? { ...d, position: { ...d.position, zIndex: (d.position.zIndex ?? 1) + 1 } } : d
|
|
1911
|
+
)
|
|
1912
|
+
}))
|
|
1913
|
+
});
|
|
1914
|
+
}, [c, r, R]), Re = $(() => {
|
|
1915
|
+
R({
|
|
1916
|
+
sections: c.sections.map((o) => ({
|
|
1917
|
+
...o,
|
|
1918
|
+
fields: o.fields.map(
|
|
1919
|
+
(d) => r.has(d.id) ? {
|
|
1920
|
+
...d,
|
|
1921
|
+
position: { ...d.position, zIndex: Math.max(1, (d.position.zIndex ?? 1) - 1) }
|
|
1922
|
+
} : d
|
|
1923
|
+
)
|
|
1924
|
+
}))
|
|
1925
|
+
});
|
|
1926
|
+
}, [c, r, R]), Ae = $(
|
|
1927
|
+
(o, d) => {
|
|
1928
|
+
R({
|
|
1929
|
+
sections: c.sections.map((C) => ({
|
|
1930
|
+
...C,
|
|
1931
|
+
fields: C.fields.map(
|
|
1932
|
+
(B) => B.id === o ? {
|
|
1933
|
+
...B,
|
|
1934
|
+
position: {
|
|
1935
|
+
...B.position,
|
|
1936
|
+
zIndex: Math.max(1, (B.position.zIndex ?? 1) - d)
|
|
1937
|
+
}
|
|
1938
|
+
} : B
|
|
1939
|
+
)
|
|
1940
|
+
}))
|
|
1941
|
+
});
|
|
1942
|
+
},
|
|
1943
|
+
[c, R]
|
|
1944
|
+
);
|
|
1945
|
+
ye(() => {
|
|
1946
|
+
const o = (d) => {
|
|
1947
|
+
const C = d.target.tagName;
|
|
1948
|
+
if (C === "INPUT" || C === "TEXTAREA" || C === "SELECT")
|
|
1949
|
+
return;
|
|
1950
|
+
const B = d.shiftKey ? 5 : 0.5;
|
|
1951
|
+
d.key === "Delete" || d.key === "Backspace" ? r.size && (d.preventDefault(), he()) : d.ctrlKey && d.key === "z" ? (d.preventDefault(), N({ type: "UNDO" })) : d.ctrlKey && (d.key === "y" || d.key === "Y") ? (d.preventDefault(), N({ type: "REDO" })) : d.ctrlKey && (d.key === "d" || d.key === "D") ? (d.preventDefault(), r.size && _e()) : d.ctrlKey && d.key === "a" ? (d.preventDefault(), n(new Set(X.map((A) => A.id)))) : d.key === "ArrowLeft" ? (d.preventDefault(), re({
|
|
1952
|
+
position: { ...G.position, x: ((G == null ? void 0 : G.position.x) ?? 0) - B }
|
|
1953
|
+
})) : d.key === "ArrowRight" ? (d.preventDefault(), re({
|
|
1954
|
+
position: { ...G.position, x: ((G == null ? void 0 : G.position.x) ?? 0) + B }
|
|
1955
|
+
})) : d.key === "ArrowUp" ? (d.preventDefault(), re({
|
|
1956
|
+
position: { ...G.position, y: ((G == null ? void 0 : G.position.y) ?? 0) - B }
|
|
1957
|
+
})) : d.key === "ArrowDown" && (d.preventDefault(), re({
|
|
1958
|
+
position: { ...G.position, y: ((G == null ? void 0 : G.position.y) ?? 0) + B }
|
|
1959
|
+
}));
|
|
1960
|
+
};
|
|
1961
|
+
return window.addEventListener("keydown", o), () => window.removeEventListener("keydown", o);
|
|
1962
|
+
}, [r, X, G, he, _e, re]);
|
|
1963
|
+
const Pe = $(
|
|
1964
|
+
(o, d) => {
|
|
1965
|
+
R({
|
|
1966
|
+
sections: c.sections.map(
|
|
1967
|
+
(C) => C.id === o ? { ...C, heightMm: Math.round(d * 2) / 2 } : C
|
|
1968
|
+
)
|
|
1969
|
+
});
|
|
1970
|
+
},
|
|
1971
|
+
[c, R]
|
|
1972
|
+
), Me = oe(() => {
|
|
1973
|
+
const o = Array.isArray(p) ? p[y] : p;
|
|
1974
|
+
return o ? "data" in o ? o.data : o : {};
|
|
1975
|
+
}, [p, y]), Ee = Z * f * F, Ge = me * f * F;
|
|
1976
|
+
return /* @__PURE__ */ s(
|
|
1977
|
+
"div",
|
|
1978
|
+
{
|
|
1979
|
+
className: `${t.root} ${g === "dark" ? t.dark : ""} ${S ?? ""}`,
|
|
1980
|
+
style: b,
|
|
1981
|
+
onClick: () => n(/* @__PURE__ */ new Set()),
|
|
1982
|
+
children: [
|
|
1983
|
+
/* @__PURE__ */ e(
|
|
1984
|
+
Rn,
|
|
1985
|
+
{
|
|
1986
|
+
tpl: c,
|
|
1987
|
+
zoom: f,
|
|
1988
|
+
canUndo: v.length > 0,
|
|
1989
|
+
canRedo: T.length > 0,
|
|
1990
|
+
showGrid: _,
|
|
1991
|
+
showRulers: pe,
|
|
1992
|
+
readOnly: h,
|
|
1993
|
+
selectedCount: r.size,
|
|
1994
|
+
onPaperChange: (o, d) => R({ paperSize: o, orientation: d }),
|
|
1995
|
+
onZoom: D,
|
|
1996
|
+
onUndo: () => N({ type: "UNDO" }),
|
|
1997
|
+
onRedo: () => N({ type: "REDO" }),
|
|
1998
|
+
onToggleGrid: () => q((o) => !o),
|
|
1999
|
+
onToggleRulers: () => Ce((o) => !o),
|
|
2000
|
+
onInsert: be,
|
|
2001
|
+
onDelete: he,
|
|
2002
|
+
onDuplicate: _e,
|
|
2003
|
+
onAlignH: De,
|
|
2004
|
+
onAlignV: Te,
|
|
2005
|
+
onBringForward: $e,
|
|
2006
|
+
onSendBackward: Re,
|
|
2007
|
+
onSave: k ? () => k(c) : void 0
|
|
2008
|
+
}
|
|
2009
|
+
),
|
|
2010
|
+
/* @__PURE__ */ s("div", { className: t.editorBody, children: [
|
|
2011
|
+
/* @__PURE__ */ e(
|
|
2012
|
+
An,
|
|
2013
|
+
{
|
|
2014
|
+
activeTab: I,
|
|
2015
|
+
onTabChange: E,
|
|
2016
|
+
schema: i,
|
|
2017
|
+
tpl: c,
|
|
2018
|
+
allFields: X,
|
|
2019
|
+
selectedIds: r,
|
|
2020
|
+
onInsertSchemaField: (o) => be(o.type, o),
|
|
2021
|
+
onSelectField: (o) => n(/* @__PURE__ */ new Set([o])),
|
|
2022
|
+
onUpdateTpl: (o) => R(o),
|
|
2023
|
+
onReorderField: Ae
|
|
2024
|
+
}
|
|
2025
|
+
),
|
|
2026
|
+
/* @__PURE__ */ s("div", { className: t.canvasArea, children: [
|
|
2027
|
+
Array.isArray(p) && p.length > 0 && /* @__PURE__ */ s("div", { className: t.testDataBar, children: [
|
|
2028
|
+
/* @__PURE__ */ e("span", { className: t.testDataLabel, children: "Dane testowe:" }),
|
|
2029
|
+
/* @__PURE__ */ e(
|
|
2030
|
+
"select",
|
|
2031
|
+
{
|
|
2032
|
+
className: t.testDataSelect,
|
|
2033
|
+
value: y,
|
|
2034
|
+
onChange: (o) => x(+o.target.value),
|
|
2035
|
+
children: p.map((o, d) => /* @__PURE__ */ s("option", { value: d, children: [
|
|
2036
|
+
"Rekord ",
|
|
2037
|
+
d + 1
|
|
2038
|
+
] }, d))
|
|
2039
|
+
}
|
|
2040
|
+
)
|
|
2041
|
+
] }),
|
|
2042
|
+
pe && /* @__PURE__ */ s("div", { className: t.rulerWrapper, children: [
|
|
2043
|
+
/* @__PURE__ */ e("div", { className: t.rulerCorner }),
|
|
2044
|
+
/* @__PURE__ */ e(Se, { lengthMm: Z, zoom: f, orientation: "h" }),
|
|
2045
|
+
/* @__PURE__ */ e(Se, { lengthMm: me, zoom: f, orientation: "v" })
|
|
2046
|
+
] }),
|
|
2047
|
+
/* @__PURE__ */ e("div", { className: t.paperScroll, onClick: (o) => o.stopPropagation(), children: /* @__PURE__ */ s("div", { className: t.paperShadow, style: { width: Ee, minHeight: Ge }, children: [
|
|
2048
|
+
/* @__PURE__ */ e(
|
|
2049
|
+
"div",
|
|
2050
|
+
{
|
|
2051
|
+
className: t.marginGuide,
|
|
2052
|
+
style: {
|
|
2053
|
+
top: c.margins.top * f * F,
|
|
2054
|
+
right: c.margins.right * f * F,
|
|
2055
|
+
bottom: c.margins.bottom * f * F,
|
|
2056
|
+
left: c.margins.left * f * F
|
|
2057
|
+
}
|
|
2058
|
+
}
|
|
2059
|
+
),
|
|
2060
|
+
(c.watermarks ?? []).map((o) => /* @__PURE__ */ e(
|
|
2061
|
+
"div",
|
|
2062
|
+
{
|
|
2063
|
+
className: t.watermark,
|
|
2064
|
+
style: {
|
|
2065
|
+
fontSize: (o.fontSize ?? 60) * f,
|
|
2066
|
+
color: o.color ?? "var(--nice-text-muted, #94a3b8)",
|
|
2067
|
+
opacity: o.opacity,
|
|
2068
|
+
transform: `translate(-50%, -50%) rotate(${o.angle}deg)`
|
|
2069
|
+
},
|
|
2070
|
+
children: o.type === "text" ? o.text : "??"
|
|
2071
|
+
},
|
|
2072
|
+
o.id
|
|
2073
|
+
)),
|
|
2074
|
+
c.sections.map((o) => /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
|
|
2075
|
+
Dn,
|
|
2076
|
+
{
|
|
2077
|
+
section: o,
|
|
2078
|
+
zoom: f,
|
|
2079
|
+
paperWidthMm: Z,
|
|
2080
|
+
selectedIds: r,
|
|
2081
|
+
sampleData: Me,
|
|
2082
|
+
readOnly: h,
|
|
2083
|
+
showGrid: _,
|
|
2084
|
+
onFieldClick: Le,
|
|
2085
|
+
onFieldDragStart: xe,
|
|
2086
|
+
onResizeStart: ze,
|
|
2087
|
+
onSectionHeightChange: Pe,
|
|
2088
|
+
onDropField: Ie
|
|
2089
|
+
}
|
|
2090
|
+
) }, o.id))
|
|
2091
|
+
] }) })
|
|
2092
|
+
] }),
|
|
2093
|
+
/* @__PURE__ */ e(
|
|
2094
|
+
Pn,
|
|
2095
|
+
{
|
|
2096
|
+
field: G,
|
|
2097
|
+
activeTab: W,
|
|
2098
|
+
onTabChange: P,
|
|
2099
|
+
onChange: (o) => G && ue(G.id, o),
|
|
2100
|
+
paperWidthMm: Z,
|
|
2101
|
+
paperHeightMm: me
|
|
2102
|
+
}
|
|
2103
|
+
)
|
|
2104
|
+
] })
|
|
2105
|
+
]
|
|
2106
|
+
}
|
|
2107
|
+
);
|
|
2108
|
+
}, En = "_root_6hwvk_1", Gn = "_dark_6hwvk_25", Hn = "_topBar_6hwvk_31", Wn = "_searchInput_6hwvk_55", jn = "_actionBtn_6hwvk_83", Fn = "_categoryRow_6hwvk_117", On = "_catChip_6hwvk_141", Un = "_catChipActive_6hwvk_167", Yn = "_grid_6hwvk_181", qn = "_card_6hwvk_203", Kn = "_cardSelected_6hwvk_235", Vn = "_thumbnail_6hwvk_251", Zn = "_thumbnailImg_6hwvk_265", Xn = "_thumbnailPlaceholder_6hwvk_277", Jn = "_paperMini_6hwvk_291", Qn = "_paperLine_6hwvk_315", es = "_cardOverlay_6hwvk_329", ts = "_overlayBtn_6hwvk_349", as = "_overlayBtnDanger_6hwvk_381", ns = "_cardBody_6hwvk_411", ss = "_cardName_6hwvk_415", rs = "_cardDesc_6hwvk_439", ls = "_cardMeta_6hwvk_461", is = "_cardSize_6hwvk_475", os = "_cardCat_6hwvk_491", cs = "_cardTags_6hwvk_507", ds = "_cardTag_6hwvk_507", ps = "_emptyState_6hwvk_531", ms = "_emptyIcon_6hwvk_553", L = {
|
|
2109
|
+
root: En,
|
|
2110
|
+
dark: Gn,
|
|
2111
|
+
topBar: Hn,
|
|
2112
|
+
searchInput: Wn,
|
|
2113
|
+
actionBtn: jn,
|
|
2114
|
+
categoryRow: Fn,
|
|
2115
|
+
catChip: On,
|
|
2116
|
+
catChipActive: Un,
|
|
2117
|
+
grid: Yn,
|
|
2118
|
+
card: qn,
|
|
2119
|
+
cardSelected: Kn,
|
|
2120
|
+
thumbnail: Vn,
|
|
2121
|
+
thumbnailImg: Zn,
|
|
2122
|
+
thumbnailPlaceholder: Xn,
|
|
2123
|
+
paperMini: Jn,
|
|
2124
|
+
paperLine: Qn,
|
|
2125
|
+
cardOverlay: es,
|
|
2126
|
+
overlayBtn: ts,
|
|
2127
|
+
overlayBtnDanger: as,
|
|
2128
|
+
cardBody: ns,
|
|
2129
|
+
cardName: ss,
|
|
2130
|
+
cardDesc: rs,
|
|
2131
|
+
cardMeta: ls,
|
|
2132
|
+
cardSize: is,
|
|
2133
|
+
cardCat: os,
|
|
2134
|
+
cardTags: cs,
|
|
2135
|
+
cardTag: ds,
|
|
2136
|
+
emptyState: ps,
|
|
2137
|
+
emptyIcon: ms
|
|
2138
|
+
}, us = ["Faktury", "Raporty", "Etykiety", "Listy", "Umowy", "Inne"];
|
|
2139
|
+
function hs(a) {
|
|
2140
|
+
return new Promise((i, p) => {
|
|
2141
|
+
const l = new FileReader();
|
|
2142
|
+
l.onload = (k) => {
|
|
2143
|
+
var h;
|
|
2144
|
+
try {
|
|
2145
|
+
i(JSON.parse((h = k.target) == null ? void 0 : h.result));
|
|
2146
|
+
} catch (S) {
|
|
2147
|
+
p(S);
|
|
2148
|
+
}
|
|
2149
|
+
}, l.readAsText(a);
|
|
2150
|
+
});
|
|
2151
|
+
}
|
|
2152
|
+
function _s(a) {
|
|
2153
|
+
const i = new Blob([JSON.stringify(a, null, 2)], { type: "application/json" }), p = URL.createObjectURL(i), l = document.createElement("a");
|
|
2154
|
+
l.href = p, l.download = `${a.name.replace(/\s+/g, "_")}.json`, l.click(), URL.revokeObjectURL(p);
|
|
2155
|
+
}
|
|
2156
|
+
const el = ({
|
|
2157
|
+
templates: a,
|
|
2158
|
+
selectedId: i,
|
|
2159
|
+
onSelect: p,
|
|
2160
|
+
onImport: l,
|
|
2161
|
+
onExport: k,
|
|
2162
|
+
onDelete: h,
|
|
2163
|
+
onNew: S,
|
|
2164
|
+
className: b,
|
|
2165
|
+
style: g,
|
|
2166
|
+
theme: v = "light"
|
|
2167
|
+
}) => {
|
|
2168
|
+
const [c, T] = M(""), [N, r] = M(null), [n, u] = M(null), m = We.useRef(null), f = async (y) => {
|
|
2169
|
+
var I;
|
|
2170
|
+
const x = (I = y.target.files) == null ? void 0 : I[0];
|
|
2171
|
+
if (x) {
|
|
2172
|
+
try {
|
|
2173
|
+
const E = await hs(x);
|
|
2174
|
+
l == null || l(E);
|
|
2175
|
+
} catch {
|
|
2176
|
+
}
|
|
2177
|
+
y.target.value = "";
|
|
2178
|
+
}
|
|
2179
|
+
}, D = a.filter((y) => {
|
|
2180
|
+
const x = !c || y.name.toLowerCase().includes(c.toLowerCase()) || (y.description ?? "").toLowerCase().includes(c.toLowerCase()) || (y.tags ?? []).some((E) => E.toLowerCase().includes(c.toLowerCase())), I = !N || y.category === N;
|
|
2181
|
+
return x && I;
|
|
2182
|
+
});
|
|
2183
|
+
return /* @__PURE__ */ s(
|
|
2184
|
+
"div",
|
|
2185
|
+
{
|
|
2186
|
+
className: `${L.root} ${v === "dark" ? L.dark : ""} ${b ?? ""}`,
|
|
2187
|
+
style: g,
|
|
2188
|
+
children: [
|
|
2189
|
+
/* @__PURE__ */ s("div", { className: L.topBar, children: [
|
|
2190
|
+
/* @__PURE__ */ e(
|
|
2191
|
+
"input",
|
|
2192
|
+
{
|
|
2193
|
+
type: "search",
|
|
2194
|
+
className: L.searchInput,
|
|
2195
|
+
placeholder: "Szukaj szablonów…",
|
|
2196
|
+
value: c,
|
|
2197
|
+
onChange: (y) => T(y.target.value)
|
|
2198
|
+
}
|
|
2199
|
+
),
|
|
2200
|
+
/* @__PURE__ */ e("button", { className: L.actionBtn, onClick: S, title: "Nowy szablon", children: "+ Nowy" }),
|
|
2201
|
+
/* @__PURE__ */ e(
|
|
2202
|
+
"button",
|
|
2203
|
+
{
|
|
2204
|
+
className: L.actionBtn,
|
|
2205
|
+
onClick: () => {
|
|
2206
|
+
var y;
|
|
2207
|
+
return (y = m.current) == null ? void 0 : y.click();
|
|
2208
|
+
},
|
|
2209
|
+
title: "Importuj JSON",
|
|
2210
|
+
children: "⬆ Import"
|
|
2211
|
+
}
|
|
2212
|
+
),
|
|
2213
|
+
/* @__PURE__ */ e("input", { ref: m, type: "file", accept: ".json", hidden: !0, onChange: f })
|
|
2214
|
+
] }),
|
|
2215
|
+
/* @__PURE__ */ s("div", { className: L.categoryRow, children: [
|
|
2216
|
+
/* @__PURE__ */ e(
|
|
2217
|
+
"button",
|
|
2218
|
+
{
|
|
2219
|
+
className: `${L.catChip} ${N ? "" : L.catChipActive}`,
|
|
2220
|
+
onClick: () => r(null),
|
|
2221
|
+
children: "Wszystkie"
|
|
2222
|
+
}
|
|
2223
|
+
),
|
|
2224
|
+
us.map((y) => /* @__PURE__ */ e(
|
|
2225
|
+
"button",
|
|
2226
|
+
{
|
|
2227
|
+
className: `${L.catChip} ${N === y ? L.catChipActive : ""}`,
|
|
2228
|
+
onClick: () => r((x) => x === y ? null : y),
|
|
2229
|
+
children: y
|
|
2230
|
+
},
|
|
2231
|
+
y
|
|
2232
|
+
))
|
|
2233
|
+
] }),
|
|
2234
|
+
/* @__PURE__ */ s("div", { className: L.grid, children: [
|
|
2235
|
+
D.map((y) => /* @__PURE__ */ s(
|
|
2236
|
+
"div",
|
|
2237
|
+
{
|
|
2238
|
+
className: `${L.card} ${i === y.id ? L.cardSelected : ""}`,
|
|
2239
|
+
onClick: () => p == null ? void 0 : p(y),
|
|
2240
|
+
onMouseEnter: () => u(y.id),
|
|
2241
|
+
onMouseLeave: () => u(null),
|
|
2242
|
+
children: [
|
|
2243
|
+
/* @__PURE__ */ s("div", { className: L.thumbnail, children: [
|
|
2244
|
+
y.previewImageUrl ? /* @__PURE__ */ e("img", { src: y.previewImageUrl, alt: y.name, className: L.thumbnailImg }) : /* @__PURE__ */ e("div", { className: L.thumbnailPlaceholder, children: /* @__PURE__ */ s("div", { className: L.paperMini, children: [
|
|
2245
|
+
/* @__PURE__ */ e(
|
|
2246
|
+
"div",
|
|
2247
|
+
{
|
|
2248
|
+
className: L.paperLine,
|
|
2249
|
+
style: { width: "80%" }
|
|
2250
|
+
}
|
|
2251
|
+
),
|
|
2252
|
+
/* @__PURE__ */ e(
|
|
2253
|
+
"div",
|
|
2254
|
+
{
|
|
2255
|
+
className: L.paperLine,
|
|
2256
|
+
style: { width: "60%" }
|
|
2257
|
+
}
|
|
2258
|
+
),
|
|
2259
|
+
/* @__PURE__ */ e(
|
|
2260
|
+
"div",
|
|
2261
|
+
{
|
|
2262
|
+
className: L.paperLine,
|
|
2263
|
+
style: { width: "90%" }
|
|
2264
|
+
}
|
|
2265
|
+
),
|
|
2266
|
+
/* @__PURE__ */ e(
|
|
2267
|
+
"div",
|
|
2268
|
+
{
|
|
2269
|
+
className: L.paperLine,
|
|
2270
|
+
style: { width: "50%" }
|
|
2271
|
+
}
|
|
2272
|
+
)
|
|
2273
|
+
] }) }),
|
|
2274
|
+
n === y.id && /* @__PURE__ */ s("div", { className: L.cardOverlay, children: [
|
|
2275
|
+
/* @__PURE__ */ e(
|
|
2276
|
+
"button",
|
|
2277
|
+
{
|
|
2278
|
+
className: L.overlayBtn,
|
|
2279
|
+
onClick: (x) => {
|
|
2280
|
+
x.stopPropagation(), k == null || k(y), _s(y);
|
|
2281
|
+
},
|
|
2282
|
+
title: "Eksportuj",
|
|
2283
|
+
children: "⬇"
|
|
2284
|
+
}
|
|
2285
|
+
),
|
|
2286
|
+
h && /* @__PURE__ */ e(
|
|
2287
|
+
"button",
|
|
2288
|
+
{
|
|
2289
|
+
className: L.overlayBtnDanger,
|
|
2290
|
+
onClick: (x) => {
|
|
2291
|
+
x.stopPropagation(), h(y.id);
|
|
2292
|
+
},
|
|
2293
|
+
title: "Usuń",
|
|
2294
|
+
children: "✕"
|
|
2295
|
+
}
|
|
2296
|
+
)
|
|
2297
|
+
] })
|
|
2298
|
+
] }),
|
|
2299
|
+
/* @__PURE__ */ s("div", { className: L.cardBody, children: [
|
|
2300
|
+
/* @__PURE__ */ e("div", { className: L.cardName, children: y.name }),
|
|
2301
|
+
y.description && /* @__PURE__ */ e("div", { className: L.cardDesc, children: y.description }),
|
|
2302
|
+
/* @__PURE__ */ s("div", { className: L.cardMeta, children: [
|
|
2303
|
+
/* @__PURE__ */ s("span", { className: L.cardSize, children: [
|
|
2304
|
+
y.paperSize,
|
|
2305
|
+
" ",
|
|
2306
|
+
y.orientation === "landscape" ? "↔" : "↕"
|
|
2307
|
+
] }),
|
|
2308
|
+
y.category && /* @__PURE__ */ e("span", { className: L.cardCat, children: y.category })
|
|
2309
|
+
] }),
|
|
2310
|
+
y.tags && y.tags.length > 0 && /* @__PURE__ */ e("div", { className: L.cardTags, children: y.tags.slice(0, 3).map((x) => /* @__PURE__ */ e("span", { className: L.cardTag, children: x }, x)) })
|
|
2311
|
+
] })
|
|
2312
|
+
]
|
|
2313
|
+
},
|
|
2314
|
+
y.id
|
|
2315
|
+
)),
|
|
2316
|
+
D.length === 0 && /* @__PURE__ */ s("div", { className: L.emptyState, children: [
|
|
2317
|
+
/* @__PURE__ */ e("span", { className: L.emptyIcon, children: "📄" }),
|
|
2318
|
+
/* @__PURE__ */ e("span", { children: c ? `Brak wyników dla "${c}"` : "Brak szablonów. Utwórz pierwszy!" })
|
|
2319
|
+
] })
|
|
2320
|
+
] })
|
|
2321
|
+
]
|
|
2322
|
+
}
|
|
2323
|
+
);
|
|
2324
|
+
}, gs = "_root_1grye_1", ys = "_dark_1grye_19", bs = "_headerBar_1grye_25", ws = "_entityNav_1grye_47", vs = "_navBtn_1grye_49", Ns = "_navLabel_1grye_73", fs = "_sampleBadge_1grye_77", ks = "_zoomBar_1grye_95", Ss = "_zoomBtn_1grye_97", Bs = "_zoomLabel_1grye_119", Cs = "_printBtn_1grye_123", Is = "_canvas_1grye_149", Ls = "_page_1grye_169", xs = "_watermark_1grye_191", zs = "_footerBar_1grye_221", j = {
|
|
2325
|
+
root: gs,
|
|
2326
|
+
dark: ys,
|
|
2327
|
+
headerBar: bs,
|
|
2328
|
+
entityNav: ws,
|
|
2329
|
+
navBtn: vs,
|
|
2330
|
+
navLabel: Ns,
|
|
2331
|
+
sampleBadge: fs,
|
|
2332
|
+
zoomBar: ks,
|
|
2333
|
+
zoomBtn: Ss,
|
|
2334
|
+
zoomLabel: Bs,
|
|
2335
|
+
printBtn: Cs,
|
|
2336
|
+
canvas: Is,
|
|
2337
|
+
page: Ls,
|
|
2338
|
+
watermark: xs,
|
|
2339
|
+
footerBar: zs
|
|
2340
|
+
}, V = 3.78, Be = {
|
|
2341
|
+
A3: [297, 420],
|
|
2342
|
+
A4: [210, 297],
|
|
2343
|
+
A5: [148, 210],
|
|
2344
|
+
A6: [105, 148],
|
|
2345
|
+
Letter: [216, 279],
|
|
2346
|
+
Legal: [216, 356],
|
|
2347
|
+
Tabloid: [279, 432]
|
|
2348
|
+
};
|
|
2349
|
+
function Ds(a, i) {
|
|
2350
|
+
try {
|
|
2351
|
+
return a.split(".").reduce((p, l) => p && typeof p == "object" ? p[l] : null, i);
|
|
2352
|
+
} catch {
|
|
2353
|
+
return null;
|
|
2354
|
+
}
|
|
2355
|
+
}
|
|
2356
|
+
function Ts(a, i, p) {
|
|
2357
|
+
if (a == null)
|
|
2358
|
+
return "";
|
|
2359
|
+
if (i === "date" && p)
|
|
2360
|
+
try {
|
|
2361
|
+
const l = new Date(a);
|
|
2362
|
+
if (p === "DD.MM.YYYY") {
|
|
2363
|
+
const k = String(l.getDate()).padStart(2, "0"), h = String(l.getMonth() + 1).padStart(2, "0");
|
|
2364
|
+
return `${k}.${h}.${l.getFullYear()}`;
|
|
2365
|
+
}
|
|
2366
|
+
return l.toLocaleDateString();
|
|
2367
|
+
} catch {
|
|
2368
|
+
return String(a);
|
|
2369
|
+
}
|
|
2370
|
+
if (i === "currency" && p) {
|
|
2371
|
+
const l = Number(a);
|
|
2372
|
+
if (!isNaN(l))
|
|
2373
|
+
return `${l.toFixed(2)} ${p}`;
|
|
2374
|
+
}
|
|
2375
|
+
return i === "number" && typeof a == "number" ? a.toLocaleString("pl-PL") : String(a);
|
|
2376
|
+
}
|
|
2377
|
+
const $s = ({ field: a, data: i, zoom: p }) => {
|
|
2378
|
+
const l = a.dataPath ? Ds(a.dataPath, i) : null, k = l != null ? Ts(l, a.type, a.format) : a.fallback ?? "", h = (b) => b * p * V, S = {
|
|
2379
|
+
position: "absolute",
|
|
2380
|
+
left: h(a.position.x),
|
|
2381
|
+
top: h(a.position.y),
|
|
2382
|
+
width: h(a.position.width),
|
|
2383
|
+
height: h(a.position.height),
|
|
2384
|
+
fontSize: (a.style.fontSize ?? 10) * p,
|
|
2385
|
+
fontWeight: a.style.fontWeight ?? "normal",
|
|
2386
|
+
fontStyle: a.style.fontStyle ?? "normal",
|
|
2387
|
+
color: a.style.color ?? "var(--text-primary, #0f172a)",
|
|
2388
|
+
textAlign: a.style.textAlign ?? "left",
|
|
2389
|
+
backgroundColor: a.style.backgroundColor,
|
|
2390
|
+
transform: a.style.rotation ? `rotate(${a.style.rotation}deg)` : void 0,
|
|
2391
|
+
overflow: "hidden",
|
|
2392
|
+
display: "flex",
|
|
2393
|
+
alignItems: a.style.verticalAlign === "middle" ? "center" : a.style.verticalAlign === "bottom" ? "flex-end" : "flex-start",
|
|
2394
|
+
lineHeight: a.style.lineHeight ?? 1.4,
|
|
2395
|
+
padding: a.style.padding ? h(a.style.padding) : 0,
|
|
2396
|
+
boxSizing: "border-box",
|
|
2397
|
+
borderWidth: a.style.borderWidth,
|
|
2398
|
+
borderColor: a.style.borderColor,
|
|
2399
|
+
borderStyle: a.style.borderStyle,
|
|
2400
|
+
borderRadius: a.style.borderRadius,
|
|
2401
|
+
zIndex: a.position.zIndex ?? 1
|
|
2402
|
+
};
|
|
2403
|
+
return a.type === "image" && l ? /* @__PURE__ */ e("div", { style: S, children: /* @__PURE__ */ e(
|
|
2404
|
+
"img",
|
|
2405
|
+
{
|
|
2406
|
+
src: String(l),
|
|
2407
|
+
alt: "",
|
|
2408
|
+
style: { width: "100%", height: "100%", objectFit: "contain" }
|
|
2409
|
+
}
|
|
2410
|
+
) }) : a.type === "barcode" || a.type === "qr" ? /* @__PURE__ */ s(
|
|
2411
|
+
"div",
|
|
2412
|
+
{
|
|
2413
|
+
style: {
|
|
2414
|
+
...S,
|
|
2415
|
+
background: "var(--bg-secondary, #f8fafc)",
|
|
2416
|
+
border: "1px dashed var(--border-color, #e2e8f0)",
|
|
2417
|
+
alignItems: "center",
|
|
2418
|
+
justifyContent: "center",
|
|
2419
|
+
fontSize: 10 * p
|
|
2420
|
+
},
|
|
2421
|
+
children: [
|
|
2422
|
+
a.type === "qr" ? "⬛" : "▮▌▮",
|
|
2423
|
+
" ",
|
|
2424
|
+
k
|
|
2425
|
+
]
|
|
2426
|
+
}
|
|
2427
|
+
) : a.type === "signature" ? /* @__PURE__ */ e(
|
|
2428
|
+
"div",
|
|
2429
|
+
{
|
|
2430
|
+
style: {
|
|
2431
|
+
...S,
|
|
2432
|
+
borderBottom: "1px solid var(--text-primary, #0f172a)",
|
|
2433
|
+
alignItems: "flex-end"
|
|
2434
|
+
},
|
|
2435
|
+
children: /* @__PURE__ */ e("span", { style: { fontSize: 8 * p, color: "var(--text-muted, #94a3b8)" }, children: a.label })
|
|
2436
|
+
}
|
|
2437
|
+
) : a.type === "line" ? /* @__PURE__ */ e(
|
|
2438
|
+
"div",
|
|
2439
|
+
{
|
|
2440
|
+
style: {
|
|
2441
|
+
...S,
|
|
2442
|
+
borderBottom: `${a.style.borderWidth ?? 1}px ${a.style.borderStyle ?? "solid"} ${a.style.borderColor ?? "var(--text-primary, #0f172a)"}`
|
|
2443
|
+
}
|
|
2444
|
+
}
|
|
2445
|
+
) : /* @__PURE__ */ e("div", { style: S, children: k });
|
|
2446
|
+
}, Rs = ({ template: a, data: i, zoom: p }) => {
|
|
2447
|
+
var b;
|
|
2448
|
+
const [l, k] = (() => {
|
|
2449
|
+
const [g, v] = Be[a.paperSize] ?? Be.A4;
|
|
2450
|
+
return a.orientation === "landscape" ? [v * V * p, g * V * p] : [g * V * p, v * V * p];
|
|
2451
|
+
})(), h = a.margins, S = a.sections.flatMap((g) => g.fields);
|
|
2452
|
+
return /* @__PURE__ */ s("div", { className: j.page, style: { width: l, minHeight: k }, children: [
|
|
2453
|
+
/* @__PURE__ */ e(
|
|
2454
|
+
"div",
|
|
2455
|
+
{
|
|
2456
|
+
style: {
|
|
2457
|
+
position: "absolute",
|
|
2458
|
+
top: h.top * p * V,
|
|
2459
|
+
left: h.left * p * V,
|
|
2460
|
+
right: h.right * p * V,
|
|
2461
|
+
bottom: h.bottom * p * V
|
|
2462
|
+
},
|
|
2463
|
+
children: S.map((g) => /* @__PURE__ */ e($s, { field: g, data: i, zoom: p }, g.id))
|
|
2464
|
+
}
|
|
2465
|
+
),
|
|
2466
|
+
(b = a.watermarks) == null ? void 0 : b.map((g) => /* @__PURE__ */ e(
|
|
2467
|
+
"div",
|
|
2468
|
+
{
|
|
2469
|
+
className: j.watermark,
|
|
2470
|
+
style: {
|
|
2471
|
+
opacity: g.opacity,
|
|
2472
|
+
transform: `rotate(${g.angle}deg)`,
|
|
2473
|
+
fontSize: (g.fontSize ?? 48) * p
|
|
2474
|
+
},
|
|
2475
|
+
children: g.type === "text" ? g.text : /* @__PURE__ */ e(
|
|
2476
|
+
"img",
|
|
2477
|
+
{
|
|
2478
|
+
src: g.imageUrl,
|
|
2479
|
+
alt: "wm",
|
|
2480
|
+
style: { maxWidth: 200 * p }
|
|
2481
|
+
}
|
|
2482
|
+
)
|
|
2483
|
+
},
|
|
2484
|
+
g.id
|
|
2485
|
+
))
|
|
2486
|
+
] });
|
|
2487
|
+
}, tl = ({
|
|
2488
|
+
template: a,
|
|
2489
|
+
entities: i = [],
|
|
2490
|
+
sampleData: p,
|
|
2491
|
+
onPrint: l,
|
|
2492
|
+
className: k,
|
|
2493
|
+
style: h,
|
|
2494
|
+
theme: S = "light",
|
|
2495
|
+
asPopup: b = !0,
|
|
2496
|
+
open: g,
|
|
2497
|
+
onClose: v
|
|
2498
|
+
}) => {
|
|
2499
|
+
const { t: c } = Oe(), [T, N] = M(0), [r, n] = M(0.8), [u, m] = M(!0), f = g !== void 0, D = f ? g : u, y = () => {
|
|
2500
|
+
f || m(!1), v == null || v();
|
|
2501
|
+
};
|
|
2502
|
+
ye(() => {
|
|
2503
|
+
if (!b || !D)
|
|
2504
|
+
return;
|
|
2505
|
+
const P = (_) => {
|
|
2506
|
+
_.key === "Escape" && y();
|
|
2507
|
+
};
|
|
2508
|
+
return document.addEventListener("keydown", P), document.body.style.overflow = "hidden", () => {
|
|
2509
|
+
document.removeEventListener("keydown", P), document.body.style.overflow = "";
|
|
2510
|
+
};
|
|
2511
|
+
}, [b, D]);
|
|
2512
|
+
const x = oe(() => i.length > 0 ? i : p ? [p.data] : [{}], [i, p]), I = x[T] ?? {};
|
|
2513
|
+
if (b && !D)
|
|
2514
|
+
return null;
|
|
2515
|
+
const E = /* @__PURE__ */ s(
|
|
2516
|
+
"div",
|
|
2517
|
+
{
|
|
2518
|
+
className: `${j.root} ${S === "dark" ? j.dark : ""} ${k ?? ""}`,
|
|
2519
|
+
style: h,
|
|
2520
|
+
children: [
|
|
2521
|
+
/* @__PURE__ */ s("div", { className: j.headerBar, children: [
|
|
2522
|
+
/* @__PURE__ */ s("div", { className: j.entityNav, children: [
|
|
2523
|
+
x.length > 1 && /* @__PURE__ */ s(Y, { children: [
|
|
2524
|
+
/* @__PURE__ */ e(
|
|
2525
|
+
"button",
|
|
2526
|
+
{
|
|
2527
|
+
className: j.navBtn,
|
|
2528
|
+
disabled: T === 0,
|
|
2529
|
+
onClick: () => N((P) => P - 1),
|
|
2530
|
+
children: "‹"
|
|
2531
|
+
}
|
|
2532
|
+
),
|
|
2533
|
+
/* @__PURE__ */ s("span", { className: j.navLabel, children: [
|
|
2534
|
+
T + 1,
|
|
2535
|
+
" / ",
|
|
2536
|
+
x.length
|
|
2537
|
+
] }),
|
|
2538
|
+
/* @__PURE__ */ e(
|
|
2539
|
+
"button",
|
|
2540
|
+
{
|
|
2541
|
+
className: j.navBtn,
|
|
2542
|
+
disabled: T >= x.length - 1,
|
|
2543
|
+
onClick: () => N((P) => P + 1),
|
|
2544
|
+
children: "›"
|
|
2545
|
+
}
|
|
2546
|
+
)
|
|
2547
|
+
] }),
|
|
2548
|
+
i.length === 0 && p && /* @__PURE__ */ e("span", { className: j.sampleBadge, children: "Przykładowe dane" })
|
|
2549
|
+
] }),
|
|
2550
|
+
/* @__PURE__ */ s("div", { className: j.zoomBar, children: [
|
|
2551
|
+
/* @__PURE__ */ e("button", { className: j.zoomBtn, onClick: () => n((P) => Math.max(0.3, P - 0.1)), children: "−" }),
|
|
2552
|
+
/* @__PURE__ */ s("span", { className: j.zoomLabel, children: [
|
|
2553
|
+
Math.round(r * 100),
|
|
2554
|
+
"%"
|
|
2555
|
+
] }),
|
|
2556
|
+
/* @__PURE__ */ e("button", { className: j.zoomBtn, onClick: () => n((P) => Math.min(2.5, P + 0.1)), children: "+" }),
|
|
2557
|
+
/* @__PURE__ */ e("button", { className: j.zoomBtn, onClick: () => n(0.8), title: "Dopasuj", children: "⊡" })
|
|
2558
|
+
] }),
|
|
2559
|
+
/* @__PURE__ */ s("div", { style: { display: "flex", gap: 8 }, children: [
|
|
2560
|
+
/* @__PURE__ */ e(
|
|
2561
|
+
"button",
|
|
2562
|
+
{
|
|
2563
|
+
className: j.printBtn,
|
|
2564
|
+
onClick: () => l == null ? void 0 : l({ copies: 1, printerId: "" }),
|
|
2565
|
+
children: c("printPreview.print", "Drukuj")
|
|
2566
|
+
}
|
|
2567
|
+
),
|
|
2568
|
+
b && /* @__PURE__ */ e(
|
|
2569
|
+
"button",
|
|
2570
|
+
{
|
|
2571
|
+
type: "button",
|
|
2572
|
+
className: j.zoomBtn,
|
|
2573
|
+
onClick: y,
|
|
2574
|
+
"aria-label": c("common.close", "Zamknij"),
|
|
2575
|
+
title: c("common.close", "Zamknij"),
|
|
2576
|
+
children: "✕"
|
|
2577
|
+
}
|
|
2578
|
+
)
|
|
2579
|
+
] })
|
|
2580
|
+
] }),
|
|
2581
|
+
/* @__PURE__ */ e("div", { className: j.canvas, children: /* @__PURE__ */ e(Rs, { template: a, data: I, zoom: r }) }),
|
|
2582
|
+
/* @__PURE__ */ s("div", { className: j.footerBar, children: [
|
|
2583
|
+
/* @__PURE__ */ e("span", { children: a.name }),
|
|
2584
|
+
/* @__PURE__ */ s("span", { children: [
|
|
2585
|
+
a.paperSize,
|
|
2586
|
+
" · ",
|
|
2587
|
+
a.orientation === "portrait" ? "Pion" : "Poziom"
|
|
2588
|
+
] }),
|
|
2589
|
+
a.sections.reduce((P, _) => P + _.fields.length, 0),
|
|
2590
|
+
" pól"
|
|
2591
|
+
] })
|
|
2592
|
+
]
|
|
2593
|
+
}
|
|
2594
|
+
);
|
|
2595
|
+
return b ? Ue(/* @__PURE__ */ e(
|
|
2596
|
+
"div",
|
|
2597
|
+
{
|
|
2598
|
+
style: {
|
|
2599
|
+
position: "fixed",
|
|
2600
|
+
inset: 0,
|
|
2601
|
+
background: "color-mix(in srgb, var(--text-primary, #000) 50%, transparent)",
|
|
2602
|
+
display: "flex",
|
|
2603
|
+
alignItems: "center",
|
|
2604
|
+
justifyContent: "center",
|
|
2605
|
+
zIndex: 1e3,
|
|
2606
|
+
padding: 24
|
|
2607
|
+
},
|
|
2608
|
+
onMouseDown: (P) => {
|
|
2609
|
+
P.target === P.currentTarget && y();
|
|
2610
|
+
},
|
|
2611
|
+
role: "presentation",
|
|
2612
|
+
children: /* @__PURE__ */ e(
|
|
2613
|
+
"div",
|
|
2614
|
+
{
|
|
2615
|
+
role: "dialog",
|
|
2616
|
+
"aria-modal": "true",
|
|
2617
|
+
style: {
|
|
2618
|
+
background: "var(--bg-elevated, var(--bg-primary, #ffffff))",
|
|
2619
|
+
borderRadius: 12,
|
|
2620
|
+
boxShadow: "0 20px 60px color-mix(in srgb, var(--text-primary, #000) 30%, transparent)",
|
|
2621
|
+
maxWidth: "90vw",
|
|
2622
|
+
maxHeight: "90vh",
|
|
2623
|
+
overflow: "auto"
|
|
2624
|
+
},
|
|
2625
|
+
children: E
|
|
2626
|
+
}
|
|
2627
|
+
)
|
|
2628
|
+
}
|
|
2629
|
+
), document.body) : E;
|
|
2630
|
+
}, As = "_root_18ftw_1", Ps = "_dark_18ftw_23", Ms = "_statsBar_18ftw_29", Es = "_stat_18ftw_29", Gs = "_dot_18ftw_51", Hs = "_statPrinting_18ftw_53", Ws = "_statQueued_18ftw_55", js = "_statDone_18ftw_57", Fs = "_statError_18ftw_59", Os = "_toolbar_18ftw_65", Us = "_filterTabs_18ftw_85", Ys = "_filterTab_18ftw_85", qs = "_filterTabActive_18ftw_109", Ks = "_filterCount_18ftw_111", Vs = "_bulkActions_18ftw_123", Zs = "_bulkCount_18ftw_125", Xs = "_bulkBtn_18ftw_127", Js = "_bulkBtnRemove_18ftw_147", Qs = "_jobList_18ftw_155", er = "_listHeader_18ftw_159", tr = "_headerLabel_18ftw_187", ar = "_jobRow_18ftw_193", nr = "_jobRowSelected_18ftw_217", sr = "_jobCheckbox_18ftw_223", rr = "_statusBadge_18ftw_229", lr = "_pulse_18ftw_1", ir = "_jobInfo_18ftw_267", or = "_jobName_18ftw_269", cr = "_jobMeta_18ftw_271", dr = "_jobTime_18ftw_281", pr = "_jobDuration_18ftw_283", mr = "_jobError_18ftw_285", ur = "_progressBar_18ftw_291", hr = "_progressFill_18ftw_305", _r = "_copiesEditor_18ftw_321", gr = "_copiesBtn_18ftw_333", yr = "_copiesValue_18ftw_357", br = "_jobActions_18ftw_363", wr = "_actionBtn_18ftw_365", vr = "_removeBtn_18ftw_387", Nr = "_emptyState_18ftw_395", w = {
|
|
2631
|
+
root: As,
|
|
2632
|
+
dark: Ps,
|
|
2633
|
+
statsBar: Ms,
|
|
2634
|
+
stat: Es,
|
|
2635
|
+
dot: Gs,
|
|
2636
|
+
statPrinting: Hs,
|
|
2637
|
+
statQueued: Ws,
|
|
2638
|
+
statDone: js,
|
|
2639
|
+
statError: Fs,
|
|
2640
|
+
toolbar: Os,
|
|
2641
|
+
filterTabs: Us,
|
|
2642
|
+
filterTab: Ys,
|
|
2643
|
+
filterTabActive: qs,
|
|
2644
|
+
filterCount: Ks,
|
|
2645
|
+
bulkActions: Vs,
|
|
2646
|
+
bulkCount: Zs,
|
|
2647
|
+
bulkBtn: Xs,
|
|
2648
|
+
bulkBtnRemove: Js,
|
|
2649
|
+
jobList: Qs,
|
|
2650
|
+
listHeader: er,
|
|
2651
|
+
headerLabel: tr,
|
|
2652
|
+
jobRow: ar,
|
|
2653
|
+
jobRowSelected: nr,
|
|
2654
|
+
jobCheckbox: sr,
|
|
2655
|
+
statusBadge: rr,
|
|
2656
|
+
"badge-queued": "_badge-queued_18ftw_247",
|
|
2657
|
+
"badge-printing": "_badge-printing_18ftw_249",
|
|
2658
|
+
pulse: lr,
|
|
2659
|
+
"badge-done": "_badge-done_18ftw_251",
|
|
2660
|
+
"badge-error": "_badge-error_18ftw_253",
|
|
2661
|
+
"badge-paused": "_badge-paused_18ftw_255",
|
|
2662
|
+
"badge-cancelled": "_badge-cancelled_18ftw_257",
|
|
2663
|
+
jobInfo: ir,
|
|
2664
|
+
jobName: or,
|
|
2665
|
+
jobMeta: cr,
|
|
2666
|
+
jobTime: dr,
|
|
2667
|
+
jobDuration: pr,
|
|
2668
|
+
jobError: mr,
|
|
2669
|
+
progressBar: ur,
|
|
2670
|
+
progressFill: hr,
|
|
2671
|
+
copiesEditor: _r,
|
|
2672
|
+
copiesBtn: gr,
|
|
2673
|
+
copiesValue: yr,
|
|
2674
|
+
jobActions: br,
|
|
2675
|
+
actionBtn: wr,
|
|
2676
|
+
removeBtn: vr,
|
|
2677
|
+
emptyState: Nr
|
|
2678
|
+
}, ge = {
|
|
2679
|
+
queued: "Kolejka",
|
|
2680
|
+
printing: "Drukowanie",
|
|
2681
|
+
done: "Wydrukowano",
|
|
2682
|
+
error: "Błąd",
|
|
2683
|
+
paused: "Wstrzymano",
|
|
2684
|
+
cancelled: "Anulowano"
|
|
2685
|
+
};
|
|
2686
|
+
function fr(a) {
|
|
2687
|
+
try {
|
|
2688
|
+
return new Date(a).toLocaleTimeString("pl-PL", { hour: "2-digit", minute: "2-digit" });
|
|
2689
|
+
} catch {
|
|
2690
|
+
return a;
|
|
2691
|
+
}
|
|
2692
|
+
}
|
|
2693
|
+
function kr(a) {
|
|
2694
|
+
const i = Date.now() - new Date(a).getTime(), p = Math.floor(i / 1e3);
|
|
2695
|
+
return p < 60 ? `${p}s` : `${Math.floor(p / 60)}m ${p % 60}s`;
|
|
2696
|
+
}
|
|
2697
|
+
const Sr = ({ jobs: a }) => {
|
|
2698
|
+
const i = a.filter((h) => h.status === "printing").length, p = a.filter((h) => h.status === "queued").length, l = a.filter((h) => h.status === "done").length, k = a.filter((h) => h.status === "error").length;
|
|
2699
|
+
return /* @__PURE__ */ s("div", { className: w.statsBar, children: [
|
|
2700
|
+
/* @__PURE__ */ s("span", { className: `${w.stat} ${w.statPrinting}`, children: [
|
|
2701
|
+
/* @__PURE__ */ e("span", { className: w.dot }),
|
|
2702
|
+
"Drukuje: ",
|
|
2703
|
+
/* @__PURE__ */ e("strong", { children: i })
|
|
2704
|
+
] }),
|
|
2705
|
+
/* @__PURE__ */ s("span", { className: `${w.stat} ${w.statQueued}`, children: [
|
|
2706
|
+
/* @__PURE__ */ e("span", { className: w.dot }),
|
|
2707
|
+
"W kolejce: ",
|
|
2708
|
+
/* @__PURE__ */ e("strong", { children: p })
|
|
2709
|
+
] }),
|
|
2710
|
+
/* @__PURE__ */ s("span", { className: `${w.stat} ${w.statDone}`, children: [
|
|
2711
|
+
/* @__PURE__ */ e("span", { className: w.dot }),
|
|
2712
|
+
"Gotowe: ",
|
|
2713
|
+
/* @__PURE__ */ e("strong", { children: l })
|
|
2714
|
+
] }),
|
|
2715
|
+
k > 0 && /* @__PURE__ */ s("span", { className: `${w.stat} ${w.statError}`, children: [
|
|
2716
|
+
/* @__PURE__ */ e("span", { className: w.dot }),
|
|
2717
|
+
"Błędy: ",
|
|
2718
|
+
/* @__PURE__ */ e("strong", { children: k })
|
|
2719
|
+
] })
|
|
2720
|
+
] });
|
|
2721
|
+
}, Br = ({
|
|
2722
|
+
job: a,
|
|
2723
|
+
index: i,
|
|
2724
|
+
total: p,
|
|
2725
|
+
printers: l,
|
|
2726
|
+
selected: k,
|
|
2727
|
+
onSelect: h,
|
|
2728
|
+
onUpdate: S,
|
|
2729
|
+
onRemove: b,
|
|
2730
|
+
onPrint: g,
|
|
2731
|
+
onReorder: v
|
|
2732
|
+
}) => {
|
|
2733
|
+
const c = l.find((r) => r.id === a.options.printerId), T = i > 0 && a.status === "queued", N = i < p - 1 && a.status === "queued";
|
|
2734
|
+
return /* @__PURE__ */ s(
|
|
2735
|
+
"div",
|
|
2736
|
+
{
|
|
2737
|
+
className: `${w.jobRow} ${k ? w.jobRowSelected : ""} ${w[`status-${a.status}`] ?? ""}`,
|
|
2738
|
+
children: [
|
|
2739
|
+
/* @__PURE__ */ e(
|
|
2740
|
+
"input",
|
|
2741
|
+
{
|
|
2742
|
+
type: "checkbox",
|
|
2743
|
+
className: w.jobCheckbox,
|
|
2744
|
+
checked: k,
|
|
2745
|
+
onChange: () => h(a.id)
|
|
2746
|
+
}
|
|
2747
|
+
),
|
|
2748
|
+
/* @__PURE__ */ e("span", { className: `${w.statusBadge} ${w[`badge-${a.status}`]}`, children: ge[a.status] ?? a.status }),
|
|
2749
|
+
/* @__PURE__ */ s("div", { className: w.jobInfo, children: [
|
|
2750
|
+
/* @__PURE__ */ e("div", { className: w.jobName, children: a.templateName ?? a.templateId }),
|
|
2751
|
+
/* @__PURE__ */ s("div", { className: w.jobMeta, children: [
|
|
2752
|
+
a.entityLabel && /* @__PURE__ */ e("span", { children: a.entityLabel }),
|
|
2753
|
+
c && /* @__PURE__ */ s("span", { children: [
|
|
2754
|
+
"🖨 ",
|
|
2755
|
+
c.name
|
|
2756
|
+
] }),
|
|
2757
|
+
/* @__PURE__ */ s("span", { children: [
|
|
2758
|
+
"×",
|
|
2759
|
+
a.options.copies
|
|
2760
|
+
] }),
|
|
2761
|
+
a.createdAt && /* @__PURE__ */ e("span", { className: w.jobTime, children: fr(a.createdAt) }),
|
|
2762
|
+
a.startedAt && a.status !== "done" && /* @__PURE__ */ e("span", { className: w.jobDuration, children: kr(a.startedAt) })
|
|
2763
|
+
] }),
|
|
2764
|
+
a.status === "printing" && a.progress != null && /* @__PURE__ */ e("div", { className: w.progressBar, children: /* @__PURE__ */ e("div", { className: w.progressFill, style: { width: `${a.progress}%` } }) }),
|
|
2765
|
+
a.status === "error" && a.errorMessage && /* @__PURE__ */ e("div", { className: w.jobError, children: a.errorMessage })
|
|
2766
|
+
] }),
|
|
2767
|
+
/* @__PURE__ */ s("div", { className: w.copiesEditor, children: [
|
|
2768
|
+
/* @__PURE__ */ e(
|
|
2769
|
+
"button",
|
|
2770
|
+
{
|
|
2771
|
+
className: w.copiesBtn,
|
|
2772
|
+
disabled: a.options.copies <= 1,
|
|
2773
|
+
onClick: () => S(a.id, { options: { ...a.options, copies: a.options.copies - 1 } }),
|
|
2774
|
+
children: "−"
|
|
2775
|
+
}
|
|
2776
|
+
),
|
|
2777
|
+
/* @__PURE__ */ e("span", { className: w.copiesValue, children: a.options.copies }),
|
|
2778
|
+
/* @__PURE__ */ e(
|
|
2779
|
+
"button",
|
|
2780
|
+
{
|
|
2781
|
+
className: w.copiesBtn,
|
|
2782
|
+
onClick: () => S(a.id, { options: { ...a.options, copies: a.options.copies + 1 } }),
|
|
2783
|
+
children: "+"
|
|
2784
|
+
}
|
|
2785
|
+
)
|
|
2786
|
+
] }),
|
|
2787
|
+
/* @__PURE__ */ s("div", { className: w.jobActions, children: [
|
|
2788
|
+
T && /* @__PURE__ */ e(
|
|
2789
|
+
"button",
|
|
2790
|
+
{
|
|
2791
|
+
className: w.actionBtn,
|
|
2792
|
+
title: "Przesuń wyżej",
|
|
2793
|
+
onClick: () => v(i, i - 1),
|
|
2794
|
+
children: "↑"
|
|
2795
|
+
}
|
|
2796
|
+
),
|
|
2797
|
+
N && /* @__PURE__ */ e(
|
|
2798
|
+
"button",
|
|
2799
|
+
{
|
|
2800
|
+
className: w.actionBtn,
|
|
2801
|
+
title: "Przesuń niżej",
|
|
2802
|
+
onClick: () => v(i, i + 1),
|
|
2803
|
+
children: "↓"
|
|
2804
|
+
}
|
|
2805
|
+
),
|
|
2806
|
+
a.status === "queued" && /* @__PURE__ */ e("button", { className: w.actionBtn, title: "Drukuj teraz", onClick: () => g(a.id), children: "▶" }),
|
|
2807
|
+
a.status === "printing" && /* @__PURE__ */ e(
|
|
2808
|
+
"button",
|
|
2809
|
+
{
|
|
2810
|
+
className: w.actionBtn,
|
|
2811
|
+
title: "Wstrzymaj",
|
|
2812
|
+
onClick: () => S(a.id, { status: "paused" }),
|
|
2813
|
+
children: "⏸"
|
|
2814
|
+
}
|
|
2815
|
+
),
|
|
2816
|
+
a.status === "paused" && /* @__PURE__ */ e(
|
|
2817
|
+
"button",
|
|
2818
|
+
{
|
|
2819
|
+
className: w.actionBtn,
|
|
2820
|
+
title: "Wznów",
|
|
2821
|
+
onClick: () => S(a.id, { status: "queued" }),
|
|
2822
|
+
children: "▶"
|
|
2823
|
+
}
|
|
2824
|
+
),
|
|
2825
|
+
/* @__PURE__ */ e(
|
|
2826
|
+
"button",
|
|
2827
|
+
{
|
|
2828
|
+
className: `${w.actionBtn} ${w.removeBtn}`,
|
|
2829
|
+
title: "Usuń",
|
|
2830
|
+
onClick: () => b(a.id),
|
|
2831
|
+
children: "✕"
|
|
2832
|
+
}
|
|
2833
|
+
)
|
|
2834
|
+
] })
|
|
2835
|
+
]
|
|
2836
|
+
}
|
|
2837
|
+
);
|
|
2838
|
+
}, al = ({
|
|
2839
|
+
jobs: a,
|
|
2840
|
+
printers: i = [],
|
|
2841
|
+
onJobUpdate: p,
|
|
2842
|
+
onJobRemove: l,
|
|
2843
|
+
onJobReorder: k,
|
|
2844
|
+
onJobPrint: h,
|
|
2845
|
+
onBulkRemove: S,
|
|
2846
|
+
onBulkPrint: b,
|
|
2847
|
+
maxHeight: g = 500,
|
|
2848
|
+
className: v,
|
|
2849
|
+
style: c,
|
|
2850
|
+
theme: T = "light"
|
|
2851
|
+
}) => {
|
|
2852
|
+
const [N, r] = M(/* @__PURE__ */ new Set()), [n, u] = M("all"), m = n === "all" ? a : a.filter((I) => I.status === n), f = $((I) => {
|
|
2853
|
+
r((E) => {
|
|
2854
|
+
const W = new Set(E);
|
|
2855
|
+
return W.has(I) ? W.delete(I) : W.add(I), W;
|
|
2856
|
+
});
|
|
2857
|
+
}, []), D = $(() => {
|
|
2858
|
+
N.size === m.length ? r(/* @__PURE__ */ new Set()) : r(new Set(m.map((I) => I.id)));
|
|
2859
|
+
}, [m, N.size]), y = $(() => {
|
|
2860
|
+
S == null || S(Array.from(N)), r(/* @__PURE__ */ new Set());
|
|
2861
|
+
}, [N, S]), x = $(() => {
|
|
2862
|
+
b == null || b(Array.from(N)), r(/* @__PURE__ */ new Set());
|
|
2863
|
+
}, [N, b]);
|
|
2864
|
+
return /* @__PURE__ */ s(
|
|
2865
|
+
"div",
|
|
2866
|
+
{
|
|
2867
|
+
className: `${w.root} ${T === "dark" ? w.dark : ""} ${v ?? ""}`,
|
|
2868
|
+
style: c,
|
|
2869
|
+
children: [
|
|
2870
|
+
/* @__PURE__ */ e(Sr, { jobs: a }),
|
|
2871
|
+
/* @__PURE__ */ s("div", { className: w.toolbar, children: [
|
|
2872
|
+
/* @__PURE__ */ e("div", { className: w.filterTabs, children: ["all", "queued", "printing", "done", "error"].map((I) => /* @__PURE__ */ s(
|
|
2873
|
+
"button",
|
|
2874
|
+
{
|
|
2875
|
+
className: `${w.filterTab} ${n === I ? w.filterTabActive : ""}`,
|
|
2876
|
+
onClick: () => u(I),
|
|
2877
|
+
children: [
|
|
2878
|
+
I === "all" ? "Wszystkie" : ge[I],
|
|
2879
|
+
/* @__PURE__ */ e("span", { className: w.filterCount, children: I === "all" ? a.length : a.filter((E) => E.status === I).length })
|
|
2880
|
+
]
|
|
2881
|
+
},
|
|
2882
|
+
I
|
|
2883
|
+
)) }),
|
|
2884
|
+
N.size > 0 && /* @__PURE__ */ s("div", { className: w.bulkActions, children: [
|
|
2885
|
+
/* @__PURE__ */ s("span", { className: w.bulkCount, children: [
|
|
2886
|
+
N.size,
|
|
2887
|
+
" zaznaczonych"
|
|
2888
|
+
] }),
|
|
2889
|
+
b && /* @__PURE__ */ e("button", { className: w.bulkBtn, onClick: x, children: "▶ Drukuj wybrane" }),
|
|
2890
|
+
S && /* @__PURE__ */ e("button", { className: `${w.bulkBtn} ${w.bulkBtnRemove}`, onClick: y, children: "✕ Usuń wybrane" })
|
|
2891
|
+
] })
|
|
2892
|
+
] }),
|
|
2893
|
+
/* @__PURE__ */ e("div", { className: w.jobList, style: { maxHeight: g }, children: m.length === 0 ? /* @__PURE__ */ e("div", { className: w.emptyState, children: n === "all" ? "Brak zadań w kolejce" : `Brak zadań ze statusem "${ge[n]}"` }) : /* @__PURE__ */ s(Y, { children: [
|
|
2894
|
+
/* @__PURE__ */ s("div", { className: w.listHeader, children: [
|
|
2895
|
+
/* @__PURE__ */ e(
|
|
2896
|
+
"input",
|
|
2897
|
+
{
|
|
2898
|
+
type: "checkbox",
|
|
2899
|
+
onChange: D,
|
|
2900
|
+
checked: N.size === m.length && m.length > 0
|
|
2901
|
+
}
|
|
2902
|
+
),
|
|
2903
|
+
/* @__PURE__ */ e("span", { className: w.headerLabel, children: "Zadanie" }),
|
|
2904
|
+
/* @__PURE__ */ e("span", { className: w.headerLabel, children: "Kopie" }),
|
|
2905
|
+
/* @__PURE__ */ e("span", { className: w.headerLabel, children: "Akcje" })
|
|
2906
|
+
] }),
|
|
2907
|
+
m.map((I, E) => /* @__PURE__ */ e(
|
|
2908
|
+
Br,
|
|
2909
|
+
{
|
|
2910
|
+
job: I,
|
|
2911
|
+
index: a.indexOf(I),
|
|
2912
|
+
total: a.length,
|
|
2913
|
+
printers: i,
|
|
2914
|
+
selected: N.has(I.id),
|
|
2915
|
+
onSelect: f,
|
|
2916
|
+
onUpdate: p,
|
|
2917
|
+
onRemove: l,
|
|
2918
|
+
onPrint: h,
|
|
2919
|
+
onReorder: k
|
|
2920
|
+
},
|
|
2921
|
+
I.id
|
|
2922
|
+
))
|
|
2923
|
+
] }) })
|
|
2924
|
+
]
|
|
2925
|
+
}
|
|
2926
|
+
);
|
|
2927
|
+
}, Cr = "_container_yzbyh_1", Ir = "_buttonGroup_yzbyh_19", Lr = "_trigger_yzbyh_31", xr = "_triggerDisabled_yzbyh_53", zr = "_mainAction_yzbyh_85", Dr = "_dropdownToggle_yzbyh_95", Tr = "_chevron_yzbyh_109", $r = "_chevronUp_yzbyh_111", Rr = "_dropdown_yzbyh_95", Ar = "_dark_yzbyh_141", Pr = "_section_yzbyh_145", Mr = "_sectionLabel_yzbyh_147", Er = "_divider_yzbyh_167", Gr = "_copiesRow_yzbyh_175", Hr = "_copiesBtn_yzbyh_185", Wr = "_copiesValue_yzbyh_209", jr = "_printerSelect_yzbyh_229", Fr = "_printerStatus_yzbyh_255", Or = "_printerDot_yzbyh_269", Ur = "_printerStatusLabel_yzbyh_279", Yr = "_submitBtn_yzbyh_285", qr = "_spinner_yzbyh_317", Kr = "_spin_yzbyh_317", z = {
|
|
2928
|
+
container: Cr,
|
|
2929
|
+
buttonGroup: Ir,
|
|
2930
|
+
trigger: Lr,
|
|
2931
|
+
triggerDisabled: xr,
|
|
2932
|
+
"variant-primary": "_variant-primary_yzbyh_59",
|
|
2933
|
+
"variant-secondary": "_variant-secondary_yzbyh_63",
|
|
2934
|
+
"variant-ghost": "_variant-ghost_yzbyh_67",
|
|
2935
|
+
"size-sm": "_size-sm_yzbyh_75",
|
|
2936
|
+
"size-md": "_size-md_yzbyh_77",
|
|
2937
|
+
"size-lg": "_size-lg_yzbyh_79",
|
|
2938
|
+
mainAction: zr,
|
|
2939
|
+
dropdownToggle: Dr,
|
|
2940
|
+
chevron: Tr,
|
|
2941
|
+
chevronUp: $r,
|
|
2942
|
+
dropdown: Rr,
|
|
2943
|
+
dark: Ar,
|
|
2944
|
+
section: Pr,
|
|
2945
|
+
sectionLabel: Mr,
|
|
2946
|
+
divider: Er,
|
|
2947
|
+
copiesRow: Gr,
|
|
2948
|
+
copiesBtn: Hr,
|
|
2949
|
+
copiesValue: Wr,
|
|
2950
|
+
printerSelect: jr,
|
|
2951
|
+
printerStatus: Fr,
|
|
2952
|
+
printerDot: Or,
|
|
2953
|
+
"dot-ready": "_dot-ready_yzbyh_271",
|
|
2954
|
+
"dot-busy": "_dot-busy_yzbyh_273",
|
|
2955
|
+
"dot-offline": "_dot-offline_yzbyh_275",
|
|
2956
|
+
"dot-error": "_dot-error_yzbyh_277",
|
|
2957
|
+
printerStatusLabel: Ur,
|
|
2958
|
+
submitBtn: Yr,
|
|
2959
|
+
spinner: qr,
|
|
2960
|
+
spin: Kr
|
|
2961
|
+
}, nl = ({
|
|
2962
|
+
onPrint: a,
|
|
2963
|
+
printers: i = [],
|
|
2964
|
+
defaultPrinterId: p,
|
|
2965
|
+
defaultCopies: l = 1,
|
|
2966
|
+
disabled: k = !1,
|
|
2967
|
+
loading: h = !1,
|
|
2968
|
+
variant: S = "primary",
|
|
2969
|
+
size: b = "md",
|
|
2970
|
+
label: g = "Drukuj",
|
|
2971
|
+
className: v,
|
|
2972
|
+
style: c,
|
|
2973
|
+
theme: T = "light"
|
|
2974
|
+
}) => {
|
|
2975
|
+
var P;
|
|
2976
|
+
const [N, r] = M(!1), [n, u] = M(l), [m, f] = M(p ?? ((P = i[0]) == null ? void 0 : P.id) ?? ""), D = Fe(null);
|
|
2977
|
+
ye(() => {
|
|
2978
|
+
if (!N)
|
|
2979
|
+
return;
|
|
2980
|
+
const _ = (q) => {
|
|
2981
|
+
D.current && !D.current.contains(q.target) && r(!1);
|
|
2982
|
+
};
|
|
2983
|
+
return document.addEventListener("mousedown", _), () => document.removeEventListener("mousedown", _);
|
|
2984
|
+
}, [N]);
|
|
2985
|
+
const y = $(() => {
|
|
2986
|
+
a({ copies: n, printerId: m }), r(!1);
|
|
2987
|
+
}, [n, m, a]), x = $(() => u((_) => Math.min(99, _ + 1)), []), I = $(() => u((_) => Math.max(1, _ - 1)), []), E = [z.container, T === "dark" ? z.dark : "", v ?? ""].filter(Boolean).join(" "), W = [
|
|
2988
|
+
z.trigger,
|
|
2989
|
+
z[`variant-${S}`],
|
|
2990
|
+
z[`size-${b}`],
|
|
2991
|
+
k || h ? z.triggerDisabled : ""
|
|
2992
|
+
].filter(Boolean).join(" ");
|
|
2993
|
+
return /* @__PURE__ */ s("div", { ref: D, className: E, style: c, children: [
|
|
2994
|
+
/* @__PURE__ */ s("div", { className: z.buttonGroup, children: [
|
|
2995
|
+
/* @__PURE__ */ s(
|
|
2996
|
+
"button",
|
|
2997
|
+
{
|
|
2998
|
+
className: `${W} ${z.mainAction}`,
|
|
2999
|
+
disabled: k || h,
|
|
3000
|
+
onClick: y,
|
|
3001
|
+
"aria-label": g,
|
|
3002
|
+
children: [
|
|
3003
|
+
h ? /* @__PURE__ */ e("span", { className: z.spinner }) : /* @__PURE__ */ e("span", { children: "🖨" }),
|
|
3004
|
+
/* @__PURE__ */ e("span", { children: g })
|
|
3005
|
+
]
|
|
3006
|
+
}
|
|
3007
|
+
),
|
|
3008
|
+
/* @__PURE__ */ e(
|
|
3009
|
+
"button",
|
|
3010
|
+
{
|
|
3011
|
+
className: `${W} ${z.dropdownToggle}`,
|
|
3012
|
+
disabled: k || h,
|
|
3013
|
+
onClick: () => r((_) => !_),
|
|
3014
|
+
"aria-label": "Opcje druku",
|
|
3015
|
+
"aria-expanded": N,
|
|
3016
|
+
children: /* @__PURE__ */ e("span", { className: `${z.chevron} ${N ? z.chevronUp : ""}`, children: "▾" })
|
|
3017
|
+
}
|
|
3018
|
+
)
|
|
3019
|
+
] }),
|
|
3020
|
+
N && /* @__PURE__ */ s("div", { className: z.dropdown, children: [
|
|
3021
|
+
/* @__PURE__ */ s("div", { className: z.section, children: [
|
|
3022
|
+
/* @__PURE__ */ e("label", { className: z.sectionLabel, children: "Liczba kopii" }),
|
|
3023
|
+
/* @__PURE__ */ s("div", { className: z.copiesRow, children: [
|
|
3024
|
+
/* @__PURE__ */ e("button", { className: z.copiesBtn, onClick: I, disabled: n <= 1, children: "−" }),
|
|
3025
|
+
/* @__PURE__ */ e("span", { className: z.copiesValue, children: n }),
|
|
3026
|
+
/* @__PURE__ */ e("button", { className: z.copiesBtn, onClick: x, disabled: n >= 99, children: "+" })
|
|
3027
|
+
] })
|
|
3028
|
+
] }),
|
|
3029
|
+
/* @__PURE__ */ e("div", { className: z.divider }),
|
|
3030
|
+
i.length > 0 && /* @__PURE__ */ s(Y, { children: [
|
|
3031
|
+
/* @__PURE__ */ s("div", { className: z.section, children: [
|
|
3032
|
+
/* @__PURE__ */ e("label", { className: z.sectionLabel, children: "Drukarka" }),
|
|
3033
|
+
/* @__PURE__ */ e(
|
|
3034
|
+
"select",
|
|
3035
|
+
{
|
|
3036
|
+
className: z.printerSelect,
|
|
3037
|
+
value: m,
|
|
3038
|
+
onChange: (_) => f(_.target.value),
|
|
3039
|
+
children: i.map((_) => /* @__PURE__ */ s(
|
|
3040
|
+
"option",
|
|
3041
|
+
{
|
|
3042
|
+
value: _.id,
|
|
3043
|
+
disabled: _.status === "offline" || !_.isOnline && _.status == null,
|
|
3044
|
+
children: [
|
|
3045
|
+
_.name,
|
|
3046
|
+
" ",
|
|
3047
|
+
_.status === "offline" || !_.isOnline && _.status == null ? "(Offline)" : _.status === "busy" ? "(Zajęta)" : ""
|
|
3048
|
+
]
|
|
3049
|
+
},
|
|
3050
|
+
_.id
|
|
3051
|
+
))
|
|
3052
|
+
}
|
|
3053
|
+
),
|
|
3054
|
+
i.find((_) => _.id === m) && /* @__PURE__ */ e("div", { className: z.printerStatus, children: (() => {
|
|
3055
|
+
const _ = i.find((pe) => pe.id === m), q = _.status ?? (_.isOnline ? "ready" : "offline");
|
|
3056
|
+
return /* @__PURE__ */ s(Y, { children: [
|
|
3057
|
+
/* @__PURE__ */ e("span", { className: `${z.printerDot} ${z[`dot-${q}`]}` }),
|
|
3058
|
+
/* @__PURE__ */ e("span", { className: z.printerStatusLabel, children: q === "ready" ? "Gotowa" : q === "busy" ? "Zajęta" : q === "offline" ? "Offline" : "Błąd" })
|
|
3059
|
+
] });
|
|
3060
|
+
})() })
|
|
3061
|
+
] }),
|
|
3062
|
+
/* @__PURE__ */ e("div", { className: z.divider })
|
|
3063
|
+
] }),
|
|
3064
|
+
/* @__PURE__ */ e("div", { className: z.section, children: /* @__PURE__ */ e(
|
|
3065
|
+
"button",
|
|
3066
|
+
{
|
|
3067
|
+
className: z.submitBtn,
|
|
3068
|
+
onClick: y,
|
|
3069
|
+
disabled: k || h || i.length > 0 && (() => {
|
|
3070
|
+
const _ = i.find((q) => q.id === m);
|
|
3071
|
+
return _ != null && (_.status === "offline" || !_.isOnline && _.status == null);
|
|
3072
|
+
})(),
|
|
3073
|
+
children: h ? "Drukowanie..." : `🖨 Drukuj${n > 1 ? ` (${n} kopie)` : ""}`
|
|
3074
|
+
}
|
|
3075
|
+
) })
|
|
3076
|
+
] })
|
|
3077
|
+
] });
|
|
3078
|
+
};
|
|
3079
|
+
export {
|
|
3080
|
+
nl as NicePrintButton,
|
|
3081
|
+
tl as NicePrintPreview,
|
|
3082
|
+
al as NicePrintQueue,
|
|
3083
|
+
el as NiceTemplateBrowser,
|
|
3084
|
+
Qr as NiceTemplateEditor
|
|
3085
|
+
};
|