@paprize/react 0.0.11 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +76 -2
- package/dist/paprize-react.d.ts +0 -182
- package/dist/paprize-react.js +355 -403
- package/dist/paprize-react.js.map +1 -1
- package/dist/paprize-react.umd.cjs +2 -2
- package/dist/paprize-react.umd.cjs.map +1 -1
- package/package.json +6 -6
package/dist/paprize-react.js
CHANGED
|
@@ -1,430 +1,382 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { createPortal as
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { ReportBuilder as e, adjustPageSize as t, layoutOptionsToAttributes as n, logger as r, pageBreakAttributeName as i, pageClassName as a, pageMargin as o, previewClassName as s, reportStyles as c, sectionClassName as l } from "@paprize/core";
|
|
2
|
+
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
3
|
+
import { Children as p, createContext as m, isValidElement as h, useContext as g, useEffect as _, useMemo as v, useRef as y, useState as b, useSyncExternalStore as x } from "react";
|
|
4
|
+
import { createPortal as S } from "react-dom";
|
|
5
|
+
//#region src/components/ReportPreview.tsx
|
|
6
|
+
function C({ children: e }) {
|
|
7
|
+
return /* @__PURE__ */ d("div", {
|
|
8
|
+
className: s,
|
|
9
|
+
children: e
|
|
10
|
+
});
|
|
7
11
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return e;
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/internal/useReportBuilder.ts
|
|
14
|
+
var w = m(null);
|
|
15
|
+
function T() {
|
|
16
|
+
let e = g(w);
|
|
17
|
+
if (!e) throw Error("ReportRoot is missing. Please wrap your component tree with ReportRoot component.");
|
|
18
|
+
return e;
|
|
16
19
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/components/ReportRoot.tsx
|
|
22
|
+
function E({ children: t }) {
|
|
23
|
+
let n = v(() => new e(), []);
|
|
24
|
+
return _(() => {
|
|
25
|
+
n.schedulePagination();
|
|
26
|
+
}, [n]), /* @__PURE__ */ d(w, {
|
|
27
|
+
value: n,
|
|
28
|
+
children: t
|
|
29
|
+
});
|
|
22
30
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}, [e, t]), /* @__PURE__ */ r(p, { children: e });
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/components/PageContent.tsx
|
|
33
|
+
function D({ children: e }) {
|
|
34
|
+
let t = T(), n = y(!1);
|
|
35
|
+
return _(() => {
|
|
36
|
+
let e = t.monitor.addEventListener("paginationCycleCompleted", () => {
|
|
37
|
+
n.current = !0;
|
|
38
|
+
});
|
|
39
|
+
return () => e();
|
|
40
|
+
}, [t.monitor]), _(() => {
|
|
41
|
+
n.current && t.schedulePagination();
|
|
42
|
+
}, [e, t]), /* @__PURE__ */ d(u, { children: e });
|
|
36
43
|
}
|
|
37
|
-
|
|
38
|
-
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/components/PageFooter.tsx
|
|
46
|
+
function O({ children: e }) {
|
|
47
|
+
return /* @__PURE__ */ d(u, { children: e });
|
|
39
48
|
}
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region src/components/PageHeader.tsx
|
|
40
51
|
function k({ children: e }) {
|
|
41
|
-
|
|
52
|
+
return /* @__PURE__ */ d(u, { children: e });
|
|
42
53
|
}
|
|
43
|
-
|
|
44
|
-
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/components/SectionFooter.tsx
|
|
56
|
+
function A({ children: e }) {
|
|
57
|
+
return /* @__PURE__ */ d(u, { children: e });
|
|
45
58
|
}
|
|
46
|
-
|
|
47
|
-
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region src/components/SectionHeader.tsx
|
|
61
|
+
function j({ children: e }) {
|
|
62
|
+
return /* @__PURE__ */ d(u, { children: e });
|
|
48
63
|
}
|
|
49
|
-
|
|
50
|
-
|
|
64
|
+
//#endregion
|
|
65
|
+
//#region src/components/PageOverlay.tsx
|
|
66
|
+
function M({ children: e }) {
|
|
67
|
+
return /* @__PURE__ */ d(u, { children: e });
|
|
51
68
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region src/internal/parseSectionChildren.ts
|
|
71
|
+
var N = [
|
|
72
|
+
D,
|
|
73
|
+
k,
|
|
74
|
+
O,
|
|
75
|
+
M,
|
|
76
|
+
j,
|
|
77
|
+
A
|
|
59
78
|
];
|
|
60
|
-
function
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
break;
|
|
92
|
-
case L:
|
|
93
|
-
o.overlay = n;
|
|
94
|
-
break;
|
|
95
|
-
}
|
|
96
|
-
}), !t)
|
|
97
|
-
throw Error("PageContent component is a required child for Section");
|
|
98
|
-
return { ...o, content: t };
|
|
79
|
+
function P(e) {
|
|
80
|
+
let t = null, n = {};
|
|
81
|
+
if (p.forEach(e, (e) => {
|
|
82
|
+
if (!h(e)) throw Error(`Invalid React element found in children: ${e}`, { cause: { child: e } });
|
|
83
|
+
let r = N.find((t) => t === e.type);
|
|
84
|
+
if (!r) throw Error(`Component "${e.type}" is not valid as a child for Section, Expected one of: ${N.map((e) => e.name).join(",")}`);
|
|
85
|
+
switch (r) {
|
|
86
|
+
case j:
|
|
87
|
+
n.sectionHeader = e;
|
|
88
|
+
break;
|
|
89
|
+
case A:
|
|
90
|
+
n.sectionFooter = e;
|
|
91
|
+
break;
|
|
92
|
+
case D:
|
|
93
|
+
t = e;
|
|
94
|
+
break;
|
|
95
|
+
case k:
|
|
96
|
+
n.header = e;
|
|
97
|
+
break;
|
|
98
|
+
case O:
|
|
99
|
+
n.footer = e;
|
|
100
|
+
break;
|
|
101
|
+
case M:
|
|
102
|
+
n.overlay = e;
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
}), !t) throw Error("PageContent component is a required child for Section");
|
|
106
|
+
return {
|
|
107
|
+
...n,
|
|
108
|
+
content: t
|
|
109
|
+
};
|
|
99
110
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
111
|
+
//#endregion
|
|
112
|
+
//#region src/internal/SectionIdContext.ts
|
|
113
|
+
var F = m(""), I = m({
|
|
114
|
+
pageIndex: 0,
|
|
115
|
+
totalPages: 0
|
|
103
116
|
});
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
)
|
|
157
|
-
]
|
|
158
|
-
}
|
|
159
|
-
) });
|
|
117
|
+
//#endregion
|
|
118
|
+
//#region src/components/Page.tsx
|
|
119
|
+
function L({ elements: e, size: t, margin: n, pageIndex: r, totalPages: i, ref: s, sectionHeaderRef: l, sectionFooterRef: u, pageHeaderRef: p, pageFooterRef: m, contentRef: h }) {
|
|
120
|
+
let _ = g(F);
|
|
121
|
+
return /* @__PURE__ */ d(I, {
|
|
122
|
+
value: v(() => ({
|
|
123
|
+
pageIndex: r,
|
|
124
|
+
totalPages: i
|
|
125
|
+
}), [r, i]),
|
|
126
|
+
children: /* @__PURE__ */ f("div", {
|
|
127
|
+
id: `${_}-${r}`,
|
|
128
|
+
className: a,
|
|
129
|
+
ref: s,
|
|
130
|
+
style: c.page(t, n ?? o.None),
|
|
131
|
+
children: [
|
|
132
|
+
e.sectionHeader && r === 0 && /* @__PURE__ */ d("div", {
|
|
133
|
+
style: c.component,
|
|
134
|
+
ref: l,
|
|
135
|
+
children: e.sectionHeader
|
|
136
|
+
}),
|
|
137
|
+
e.header && /* @__PURE__ */ d("div", {
|
|
138
|
+
style: c.component,
|
|
139
|
+
ref: p,
|
|
140
|
+
children: e.header
|
|
141
|
+
}),
|
|
142
|
+
/* @__PURE__ */ d("div", {
|
|
143
|
+
style: c.pageContent,
|
|
144
|
+
ref: h,
|
|
145
|
+
children: e.content
|
|
146
|
+
}),
|
|
147
|
+
e.overlay && /* @__PURE__ */ d("div", {
|
|
148
|
+
style: c.overlay,
|
|
149
|
+
children: e.overlay
|
|
150
|
+
}),
|
|
151
|
+
(e.footer || e.sectionFooter) && /* @__PURE__ */ f("div", {
|
|
152
|
+
style: {
|
|
153
|
+
...c.component,
|
|
154
|
+
marginTop: "auto"
|
|
155
|
+
},
|
|
156
|
+
children: [e.footer && /* @__PURE__ */ d("div", {
|
|
157
|
+
style: c.component,
|
|
158
|
+
ref: m,
|
|
159
|
+
children: e.footer
|
|
160
|
+
}), e.sectionFooter && r === i - 1 && /* @__PURE__ */ d("div", {
|
|
161
|
+
style: c.component,
|
|
162
|
+
ref: u,
|
|
163
|
+
children: e.sectionFooter
|
|
164
|
+
})]
|
|
165
|
+
})
|
|
166
|
+
]
|
|
167
|
+
})
|
|
168
|
+
});
|
|
160
169
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
170
|
+
//#endregion
|
|
171
|
+
//#region src/internal/SectionControllerContext.ts
|
|
172
|
+
var R = m({
|
|
173
|
+
addPlugin: () => {
|
|
174
|
+
throw Error("addPlugin must be used within a Section");
|
|
175
|
+
},
|
|
176
|
+
addSuspense: () => {
|
|
177
|
+
throw Error("addSuspense must be used within a Section");
|
|
178
|
+
}
|
|
168
179
|
});
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
return {
|
|
188
|
-
controllerState: t,
|
|
189
|
-
controllerValue: o
|
|
190
|
-
};
|
|
180
|
+
//#endregion
|
|
181
|
+
//#region src/internal/useSectionControllerState.tsx
|
|
182
|
+
function z(e) {
|
|
183
|
+
let t = v(() => ({
|
|
184
|
+
plugins: e ?? [],
|
|
185
|
+
suspense: []
|
|
186
|
+
}), [e]);
|
|
187
|
+
return {
|
|
188
|
+
controllerState: t,
|
|
189
|
+
controllerValue: v(() => ({
|
|
190
|
+
addPlugin: (e) => {
|
|
191
|
+
t.plugins.push(e);
|
|
192
|
+
},
|
|
193
|
+
addSuspense: (e) => {
|
|
194
|
+
t.suspense.push(e);
|
|
195
|
+
}
|
|
196
|
+
}), [t])
|
|
197
|
+
};
|
|
191
198
|
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
l.pageIndex
|
|
251
|
-
)),
|
|
252
|
-
X(
|
|
253
|
-
/* @__PURE__ */ r("div", { style: c.outOfScreen, children: /* @__PURE__ */ r(
|
|
254
|
-
E,
|
|
255
|
-
{
|
|
256
|
-
elements: e,
|
|
257
|
-
size: C,
|
|
258
|
-
margin: t.margin,
|
|
259
|
-
pageIndex: 0,
|
|
260
|
-
totalPages: 1,
|
|
261
|
-
ref: x,
|
|
262
|
-
sectionHeaderRef: S,
|
|
263
|
-
sectionFooterRef: P,
|
|
264
|
-
pageHeaderRef: y,
|
|
265
|
-
pageFooterRef: v,
|
|
266
|
-
contentRef: f
|
|
267
|
-
}
|
|
268
|
-
) }),
|
|
269
|
-
document.body
|
|
270
|
-
)
|
|
271
|
-
] });
|
|
199
|
+
//#endregion
|
|
200
|
+
//#region src/internal/SectionLayout.tsx
|
|
201
|
+
function B({ elements: e, options: n }) {
|
|
202
|
+
let i = g(F), { controllerState: a, controllerValue: o } = z(n?.plugins), s = T(), l = y(null), u = y(null), p = y(null), m = y(null), h = y(null), x = y(null), C = v(() => t(n.size, n.orientation), [n.orientation, n.size]), [w, E] = b(null);
|
|
203
|
+
return _(() => {
|
|
204
|
+
if (x.current) return s.tryAddSection({
|
|
205
|
+
...n,
|
|
206
|
+
id: i,
|
|
207
|
+
plugins: a.plugins,
|
|
208
|
+
suspense: a.suspense
|
|
209
|
+
}, {
|
|
210
|
+
pageContent: x.current,
|
|
211
|
+
sectionHeader: u.current,
|
|
212
|
+
sectionFooter: p.current,
|
|
213
|
+
pageFooter: h.current,
|
|
214
|
+
pageHeader: m.current
|
|
215
|
+
}, (e) => {
|
|
216
|
+
E(e.pages);
|
|
217
|
+
}).catch((e) => r.error(e)), () => {
|
|
218
|
+
s.removeSection(i);
|
|
219
|
+
};
|
|
220
|
+
}, [
|
|
221
|
+
a.plugins,
|
|
222
|
+
a.suspense,
|
|
223
|
+
n,
|
|
224
|
+
s,
|
|
225
|
+
i
|
|
226
|
+
]), /* @__PURE__ */ f(R, {
|
|
227
|
+
value: o,
|
|
228
|
+
children: [w?.map((t) => /* @__PURE__ */ d(L, {
|
|
229
|
+
elements: {
|
|
230
|
+
...e,
|
|
231
|
+
content: /* @__PURE__ */ d("div", {
|
|
232
|
+
style: { display: "contents" },
|
|
233
|
+
dangerouslySetInnerHTML: { __html: t.pageContentHtml }
|
|
234
|
+
})
|
|
235
|
+
},
|
|
236
|
+
size: C,
|
|
237
|
+
margin: n.margin,
|
|
238
|
+
pageIndex: t.pageIndex,
|
|
239
|
+
totalPages: t.totalPages
|
|
240
|
+
}, t.pageIndex)), S(/* @__PURE__ */ d("div", {
|
|
241
|
+
style: c.outOfScreen,
|
|
242
|
+
children: /* @__PURE__ */ d(L, {
|
|
243
|
+
elements: e,
|
|
244
|
+
size: C,
|
|
245
|
+
margin: n.margin,
|
|
246
|
+
pageIndex: 0,
|
|
247
|
+
totalPages: 1,
|
|
248
|
+
ref: l,
|
|
249
|
+
sectionHeaderRef: u,
|
|
250
|
+
sectionFooterRef: p,
|
|
251
|
+
pageHeaderRef: m,
|
|
252
|
+
pageFooterRef: h,
|
|
253
|
+
contentRef: x
|
|
254
|
+
})
|
|
255
|
+
}), document.body)]
|
|
256
|
+
});
|
|
272
257
|
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
258
|
+
//#endregion
|
|
259
|
+
//#region src/components/Section.tsx
|
|
260
|
+
var V = 1;
|
|
261
|
+
function H({ children: e, id: t, ...n }) {
|
|
262
|
+
let r = v(() => t ?? `__000${V++}`, [t]), i = v(() => P(e), [e]), a = v(() => ({
|
|
263
|
+
...n,
|
|
264
|
+
id: r
|
|
265
|
+
}), [n, r]);
|
|
266
|
+
return /* @__PURE__ */ d("section", {
|
|
267
|
+
className: l,
|
|
268
|
+
id: r,
|
|
269
|
+
style: c.section(r),
|
|
270
|
+
children: /* @__PURE__ */ d(F, {
|
|
271
|
+
value: r,
|
|
272
|
+
children: /* @__PURE__ */ d(B, {
|
|
273
|
+
elements: i,
|
|
274
|
+
options: a
|
|
275
|
+
})
|
|
276
|
+
})
|
|
277
|
+
});
|
|
291
278
|
}
|
|
292
|
-
|
|
293
|
-
|
|
279
|
+
//#endregion
|
|
280
|
+
//#region src/components/PageBreak.tsx
|
|
281
|
+
function U() {
|
|
282
|
+
return /* @__PURE__ */ d("span", { [i]: "true" });
|
|
294
283
|
}
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
);
|
|
284
|
+
//#endregion
|
|
285
|
+
//#region src/components/Layout.tsx
|
|
286
|
+
function W({ children: e, ...t }) {
|
|
287
|
+
return /* @__PURE__ */ d("div", {
|
|
288
|
+
style: { display: "contents" },
|
|
289
|
+
...n(t),
|
|
290
|
+
children: e
|
|
291
|
+
});
|
|
304
292
|
}
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
pageIndex: s.pageIndex,
|
|
334
|
-
totalPages: s.totalPages
|
|
335
|
-
}))
|
|
336
|
-
};
|
|
293
|
+
//#endregion
|
|
294
|
+
//#region src/components/usePageInfo.ts
|
|
295
|
+
var G = () => {
|
|
296
|
+
let e = g(I);
|
|
297
|
+
return {
|
|
298
|
+
pageIndex: e.pageIndex,
|
|
299
|
+
totalPages: e.totalPages
|
|
300
|
+
};
|
|
301
|
+
}, K = () => {
|
|
302
|
+
let e = g(F), t = T(), n = y({
|
|
303
|
+
pages: [],
|
|
304
|
+
isPaginated: !1,
|
|
305
|
+
isSuspended: !1,
|
|
306
|
+
sectionIndex: -1,
|
|
307
|
+
sectionId: e
|
|
308
|
+
}), r = x((r) => t.monitor.addEventListener("sectionCompleted", (t) => {
|
|
309
|
+
t.sectionId === e && (n.current = t, r());
|
|
310
|
+
}), () => n.current);
|
|
311
|
+
return {
|
|
312
|
+
sectionId: e,
|
|
313
|
+
sectionIndex: r.sectionIndex,
|
|
314
|
+
isSuspended: r.isSuspended,
|
|
315
|
+
isPaginated: r.isPaginated,
|
|
316
|
+
pages: r.pages.map((e) => ({
|
|
317
|
+
pageIndex: e.pageIndex,
|
|
318
|
+
totalPages: e.totalPages
|
|
319
|
+
}))
|
|
320
|
+
};
|
|
337
321
|
};
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
322
|
+
//#endregion
|
|
323
|
+
//#region src/internal/eventHelper.ts
|
|
324
|
+
function q(e) {
|
|
325
|
+
return {
|
|
326
|
+
pageIndex: e.pageIndex,
|
|
327
|
+
totalPages: e.totalPages
|
|
328
|
+
};
|
|
343
329
|
}
|
|
344
|
-
function
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
330
|
+
function J(e) {
|
|
331
|
+
return {
|
|
332
|
+
sectionId: e.sectionId,
|
|
333
|
+
sectionIndex: e.sectionIndex,
|
|
334
|
+
isPaginated: e.isPaginated,
|
|
335
|
+
isSuspended: e.isSuspended,
|
|
336
|
+
pages: e.pages.map(q)
|
|
337
|
+
};
|
|
352
338
|
}
|
|
353
|
-
function
|
|
354
|
-
|
|
355
|
-
sections: e.sections.map(oe)
|
|
356
|
-
};
|
|
339
|
+
function Y(e) {
|
|
340
|
+
return { sections: e.sections.map(J) };
|
|
357
341
|
}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
t.current = s, n();
|
|
366
|
-
}
|
|
367
|
-
),
|
|
368
|
-
() => t.current
|
|
369
|
-
);
|
|
370
|
-
return re(o);
|
|
342
|
+
//#endregion
|
|
343
|
+
//#region src/components/useReportInfo.ts
|
|
344
|
+
function X() {
|
|
345
|
+
let e = T(), t = y({ sections: [] });
|
|
346
|
+
return Y(x((n) => e.monitor.addEventListener("paginationCycleCompleted", (e) => {
|
|
347
|
+
t.current = e, n();
|
|
348
|
+
}), () => t.current));
|
|
371
349
|
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
t.current?.(), t.current = null;
|
|
393
|
-
}
|
|
394
|
-
}),
|
|
395
|
-
[o]
|
|
396
|
-
);
|
|
350
|
+
//#endregion
|
|
351
|
+
//#region src/components/useSectionSuspension.ts
|
|
352
|
+
function Z(e) {
|
|
353
|
+
let t = y(null), { addSuspense: n } = g(R);
|
|
354
|
+
return _(() => {
|
|
355
|
+
if (t.current) return;
|
|
356
|
+
let r = e ?? new Promise((e) => {
|
|
357
|
+
t.current = e;
|
|
358
|
+
});
|
|
359
|
+
t.current ||= () => {}, n(r);
|
|
360
|
+
}, [n, e]), v(() => ({
|
|
361
|
+
reset: () => {
|
|
362
|
+
t.current || n(new Promise((e) => {
|
|
363
|
+
t.current = e;
|
|
364
|
+
}));
|
|
365
|
+
},
|
|
366
|
+
release: () => {
|
|
367
|
+
t.current?.(), t.current = null;
|
|
368
|
+
}
|
|
369
|
+
}), [n]);
|
|
397
370
|
}
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
() => t.getJsonData(e),
|
|
406
|
-
[e, t]
|
|
407
|
-
);
|
|
408
|
-
return se(n), d(() => {
|
|
409
|
-
n.then((s) => o.current = s);
|
|
410
|
-
}, [n, o]), o.current ?? e ?? null;
|
|
371
|
+
//#endregion
|
|
372
|
+
//#region src/components/useJsonData.ts
|
|
373
|
+
function Q(e) {
|
|
374
|
+
let t = T(), n = v(() => ({ current: null }), []), r = v(() => t.getJsonData(e), [e, t]);
|
|
375
|
+
return Z(r), _(() => {
|
|
376
|
+
r.then((e) => n.current = e);
|
|
377
|
+
}, [r, n]), n.current ?? e ?? null;
|
|
411
378
|
}
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
H as PageFooter,
|
|
417
|
-
k as PageHeader,
|
|
418
|
-
L as PageOverlay,
|
|
419
|
-
le as ReportPreview,
|
|
420
|
-
de as ReportRoot,
|
|
421
|
-
pe as Section,
|
|
422
|
-
N as SectionFooter,
|
|
423
|
-
z as SectionHeader,
|
|
424
|
-
ye as useJsonData,
|
|
425
|
-
me as usePageInfo,
|
|
426
|
-
Pe as useReportInfo,
|
|
427
|
-
Se as useSectionInfo,
|
|
428
|
-
se as useSectionSuspension
|
|
429
|
-
};
|
|
430
|
-
//# sourceMappingURL=paprize-react.js.map
|
|
379
|
+
//#endregion
|
|
380
|
+
export { W as Layout, U as PageBreak, D as PageContent, O as PageFooter, k as PageHeader, M as PageOverlay, C as ReportPreview, E as ReportRoot, H as Section, A as SectionFooter, j as SectionHeader, Q as useJsonData, G as usePageInfo, X as useReportInfo, K as useSectionInfo, Z as useSectionSuspension };
|
|
381
|
+
|
|
382
|
+
//# sourceMappingURL=paprize-react.js.map
|