@paprize/react 0.0.4 → 0.0.6
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 +1 -1
- package/dist/paprize-react.d.ts +98 -164
- package/dist/paprize-react.js +335 -1172
- package/dist/paprize-react.js.map +1 -1
- package/dist/paprize-react.umd.cjs +1 -61
- package/dist/paprize-react.umd.cjs.map +1 -1
- package/package.json +10 -21
package/README.md
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
|
|
3
3
|
Design your report using the full power of JavaScript and CSS, mark the report section by paprize components and then paprize pagination engine will transforming it into a beautiful, professional, print-ready pages.
|
|
4
4
|
|
|
5
|
-

|
package/dist/paprize-react.d.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Context } from 'react';
|
|
2
2
|
import { JSX } from 'react/jsx-runtime';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { PaginationPlugin } from '
|
|
3
|
+
import { LayoutOptions } from '@paprize/core';
|
|
4
|
+
import { PaginationCycleCompleted } from '@paprize/core';
|
|
5
|
+
import { PaginationPlugin } from '@paprize/core';
|
|
6
6
|
import { ReactNode } from 'react';
|
|
7
|
+
import { SectionContext } from '@paprize/core';
|
|
8
|
+
import { SectionOptions } from '@paprize/core';
|
|
7
9
|
|
|
8
10
|
export declare const jsonData: () => Promise<unknown>;
|
|
9
11
|
|
|
10
12
|
export declare function Layout({ children, ...attributes }: LayoutProps): JSX.Element;
|
|
11
13
|
|
|
12
|
-
export declare interface LayoutProps extends
|
|
14
|
+
export declare interface LayoutProps extends LayoutOptions {
|
|
13
15
|
children: React.ReactNode;
|
|
14
16
|
}
|
|
15
17
|
|
|
@@ -19,10 +21,10 @@ export declare function PageContent({ children }: {
|
|
|
19
21
|
children: ReactNode;
|
|
20
22
|
}): JSX.Element;
|
|
21
23
|
|
|
22
|
-
export declare
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
24
|
+
export declare function pageContextToPageInfo(pc: {
|
|
25
|
+
pageIndex: number;
|
|
26
|
+
totalPages: number;
|
|
27
|
+
}): PageInfo;
|
|
26
28
|
|
|
27
29
|
export declare function PageFooter({ children }: {
|
|
28
30
|
children: React.ReactNode;
|
|
@@ -32,147 +34,36 @@ export declare function PageHeader({ children }: {
|
|
|
32
34
|
children: ReactNode;
|
|
33
35
|
}): JSX.Element;
|
|
34
36
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
/**
|
|
38
|
+
* {@inheritDoc @paprize/core!PageContext}
|
|
39
|
+
*/
|
|
40
|
+
export declare interface PageInfo {
|
|
41
|
+
/**
|
|
42
|
+
* {@inheritDoc @paprize/core!PageContext.pageIndex}
|
|
43
|
+
*/
|
|
44
|
+
pageIndex: number;
|
|
45
|
+
/**
|
|
46
|
+
* {@inheritDoc @paprize/core!PageContext.totalPages}
|
|
47
|
+
*/
|
|
48
|
+
totalPages: number;
|
|
40
49
|
}
|
|
41
50
|
|
|
42
|
-
export declare const pageMargin: Record<keyof typeof _pageMargin, PageMargin>;
|
|
43
|
-
|
|
44
|
-
declare const _pageMargin: {
|
|
45
|
-
Normal: {
|
|
46
|
-
top: string;
|
|
47
|
-
right: string;
|
|
48
|
-
bottom: string;
|
|
49
|
-
left: string;
|
|
50
|
-
};
|
|
51
|
-
Narrow: {
|
|
52
|
-
top: string;
|
|
53
|
-
right: string;
|
|
54
|
-
bottom: string;
|
|
55
|
-
left: string;
|
|
56
|
-
};
|
|
57
|
-
Wide: {
|
|
58
|
-
top: string;
|
|
59
|
-
right: string;
|
|
60
|
-
bottom: string;
|
|
61
|
-
left: string;
|
|
62
|
-
};
|
|
63
|
-
None: {
|
|
64
|
-
top: string;
|
|
65
|
-
right: string;
|
|
66
|
-
bottom: string;
|
|
67
|
-
left: string;
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
export declare type PageOrientation = 'portrait' | 'landscape';
|
|
72
|
-
|
|
73
51
|
export declare function PageOverlay({ children }: {
|
|
74
52
|
children: ReactNode;
|
|
75
53
|
}): JSX.Element;
|
|
76
54
|
|
|
77
|
-
export declare
|
|
78
|
-
|
|
79
|
-
declare const _pageSize: {
|
|
80
|
-
A1: {
|
|
81
|
-
height: string;
|
|
82
|
-
width: string;
|
|
83
|
-
};
|
|
84
|
-
A2: {
|
|
85
|
-
height: string;
|
|
86
|
-
width: string;
|
|
87
|
-
};
|
|
88
|
-
A3: {
|
|
89
|
-
height: string;
|
|
90
|
-
width: string;
|
|
91
|
-
};
|
|
92
|
-
A4: {
|
|
93
|
-
height: string;
|
|
94
|
-
width: string;
|
|
95
|
-
};
|
|
96
|
-
A5: {
|
|
97
|
-
height: string;
|
|
98
|
-
width: string;
|
|
99
|
-
};
|
|
100
|
-
A6: {
|
|
101
|
-
height: string;
|
|
102
|
-
width: string;
|
|
103
|
-
};
|
|
104
|
-
B3: {
|
|
105
|
-
height: string;
|
|
106
|
-
width: string;
|
|
107
|
-
};
|
|
108
|
-
B4: {
|
|
109
|
-
height: string;
|
|
110
|
-
width: string;
|
|
111
|
-
};
|
|
112
|
-
B5: {
|
|
113
|
-
height: string;
|
|
114
|
-
width: string;
|
|
115
|
-
};
|
|
116
|
-
Letter: {
|
|
117
|
-
height: string;
|
|
118
|
-
width: string;
|
|
119
|
-
};
|
|
120
|
-
Legal: {
|
|
121
|
-
height: string;
|
|
122
|
-
width: string;
|
|
123
|
-
};
|
|
124
|
-
Tabloid: {
|
|
125
|
-
height: string;
|
|
126
|
-
width: string;
|
|
127
|
-
};
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
export { PaginationConfig }
|
|
131
|
-
|
|
132
|
-
export { PaginationPlugin }
|
|
55
|
+
export declare function paginationCycleToReportInfo(rc: PaginationCycleCompleted): ReportInfo;
|
|
133
56
|
|
|
134
57
|
/**
|
|
135
|
-
*
|
|
58
|
+
* {@inheritDoc @paprize/core!PaginationCycleCompleted}
|
|
136
59
|
*/
|
|
137
60
|
export declare interface ReportInfo {
|
|
138
61
|
/**
|
|
139
|
-
*
|
|
140
|
-
* When isFirstPaginationCompleted is false, this value is 0.
|
|
141
|
-
* When isPaginated is false, this value is not guaranteed to be accurate.
|
|
62
|
+
* {@inheritDoc @paprize/core!PaginationCycleCompleted.sections}
|
|
142
63
|
*/
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Indicates whether the report is ready and all sections are paginated.
|
|
146
|
-
*/
|
|
147
|
-
isPaginated: boolean;
|
|
148
|
-
/**
|
|
149
|
-
* Indicates whether the first pagination process has been completed.
|
|
150
|
-
* This becomes true once at least one section has been paginated.
|
|
151
|
-
*/
|
|
152
|
-
isFirstPaginationCompleted: boolean;
|
|
153
|
-
/**
|
|
154
|
-
* An array of sections in the report, each containing details about the section.
|
|
155
|
-
*/
|
|
156
|
-
sections: {
|
|
157
|
-
/**
|
|
158
|
-
* The id of the section.
|
|
159
|
-
*/
|
|
160
|
-
sectionId: string;
|
|
161
|
-
/**
|
|
162
|
-
* The total number of pages in the section.
|
|
163
|
-
*/
|
|
164
|
-
totalPages: number;
|
|
165
|
-
/**
|
|
166
|
-
* Indicates whether the section is paginated.
|
|
167
|
-
*/
|
|
168
|
-
isPaginated: boolean;
|
|
169
|
-
}[];
|
|
64
|
+
sections: SectionInfo[];
|
|
170
65
|
}
|
|
171
66
|
|
|
172
|
-
/**
|
|
173
|
-
* ReportPreview is a wrapper component that applies styles to its children, mimicking the appearance of the Chrome Print Preview screen.
|
|
174
|
-
* Use this component to render reports or documents with a print-friendly layout and consistent visual formatting in client side application.
|
|
175
|
-
*/
|
|
176
67
|
export declare function ReportPreview({ children }: {
|
|
177
68
|
children: ReactNode;
|
|
178
69
|
}): JSX.Element;
|
|
@@ -183,7 +74,16 @@ export declare interface ReportRootProps {
|
|
|
183
74
|
children: ReactNode;
|
|
184
75
|
}
|
|
185
76
|
|
|
186
|
-
export declare function Section({ children,
|
|
77
|
+
export declare function Section({ children, id, ...options }: SectionProps): JSX.Element;
|
|
78
|
+
|
|
79
|
+
export declare function sectionContextToSectionInfo(sc: SectionContext): SectionInfo;
|
|
80
|
+
|
|
81
|
+
export declare interface SectionController {
|
|
82
|
+
addPlugin: (plugin: PaginationPlugin) => void;
|
|
83
|
+
addSuspense: (suspense: Promise<void>) => void;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export declare const SectionControllerContext: Context<SectionController>;
|
|
187
87
|
|
|
188
88
|
export declare function SectionFooter({ children }: {
|
|
189
89
|
children: React.ReactNode;
|
|
@@ -194,55 +94,89 @@ export declare function SectionHeader({ children }: {
|
|
|
194
94
|
}): JSX.Element;
|
|
195
95
|
|
|
196
96
|
/**
|
|
197
|
-
*
|
|
97
|
+
* {@inheritDoc @paprize/core!SectionContext}
|
|
198
98
|
*/
|
|
199
99
|
export declare interface SectionInfo {
|
|
200
100
|
/**
|
|
201
|
-
*
|
|
202
|
-
* When isPaginated is false, this value is 0.
|
|
101
|
+
* {@inheritDoc @paprize/core!SectionContext.sectionId}
|
|
203
102
|
*/
|
|
204
|
-
|
|
103
|
+
sectionId: string;
|
|
104
|
+
/**
|
|
105
|
+
* {@inheritDoc @paprize/core!SectionContext.sectionIndex}
|
|
106
|
+
*/
|
|
107
|
+
sectionIndex: number;
|
|
205
108
|
/**
|
|
206
|
-
*
|
|
109
|
+
* {@inheritDoc @paprize/core!SectionContext.isPaginated}
|
|
207
110
|
*/
|
|
208
111
|
isPaginated: boolean;
|
|
209
112
|
/**
|
|
210
|
-
*
|
|
113
|
+
* {@inheritDoc @paprize/core!SectionContext.isSuspended}
|
|
211
114
|
*/
|
|
212
|
-
|
|
115
|
+
isSuspended: boolean;
|
|
116
|
+
/**
|
|
117
|
+
* {@inheritDoc @paprize/core!SectionContext.pages}
|
|
118
|
+
*/
|
|
119
|
+
pages: PageInfo[];
|
|
213
120
|
}
|
|
214
121
|
|
|
215
|
-
|
|
122
|
+
/**
|
|
123
|
+
* Configuration options for a section.
|
|
124
|
+
* @inlineType SectionOptions
|
|
125
|
+
*/
|
|
126
|
+
export declare interface SectionProps extends Omit<SectionOptions, 'id' | 'suspense'> {
|
|
216
127
|
children: ReactNode;
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
128
|
+
/**
|
|
129
|
+
* Unique id of the section within the report. If not set, a random id will be used.
|
|
130
|
+
*/
|
|
131
|
+
id?: string;
|
|
221
132
|
}
|
|
222
133
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
134
|
+
/**
|
|
135
|
+
* Controls the section suspension.
|
|
136
|
+
* @inline
|
|
137
|
+
*/
|
|
138
|
+
export declare interface SectionSuspension {
|
|
139
|
+
/**
|
|
140
|
+
* Releases the suspension. The pagination engine will paginate this section immediately.
|
|
141
|
+
*/
|
|
142
|
+
release: () => void;
|
|
143
|
+
/**
|
|
144
|
+
* Marks the suspension as pending again if it was previously resolved.
|
|
145
|
+
* During the next pagination cycle (for example, if pagination is retriggered
|
|
146
|
+
* by changes to the page content), this section will not be paginated
|
|
147
|
+
* until `release` is called again.
|
|
148
|
+
*/
|
|
149
|
+
reset: () => void;
|
|
226
150
|
}
|
|
227
151
|
|
|
228
152
|
export declare function useJsonData<DataModel>(defaultValue?: DataModel): DataModel | undefined;
|
|
229
153
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
154
|
+
/**
|
|
155
|
+
* React hook that returns information about the current page.
|
|
156
|
+
*/
|
|
157
|
+
export declare const usePageInfo: () => PageInfo;
|
|
234
158
|
|
|
159
|
+
/**
|
|
160
|
+
* React hook that returns information about the report.
|
|
161
|
+
*/
|
|
235
162
|
export declare function useReportInfo(): ReportInfo;
|
|
236
163
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
164
|
+
/**
|
|
165
|
+
* React hook that returns information about the current section.
|
|
166
|
+
*/
|
|
167
|
+
export declare const useSectionInfo: () => SectionInfo;
|
|
241
168
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
169
|
+
/**
|
|
170
|
+
* Suspends pagination for this section.
|
|
171
|
+
* @param promise The suspension is tied to this promise. Once the promise is resolved,
|
|
172
|
+
* the suspension is released and the pagination engine will paginate this section.
|
|
173
|
+
*/
|
|
174
|
+
export declare function useSectionSuspension(promise: Promise<void> | Promise<unknown>): void;
|
|
245
175
|
|
|
246
|
-
|
|
176
|
+
/**
|
|
177
|
+
* Suspends pagination for this section. You need to call the `release` method
|
|
178
|
+
* of the returned value; otherwise, the pagination engine will never paginate this section.
|
|
179
|
+
*/
|
|
180
|
+
export declare function useSectionSuspension(): SectionSuspension;
|
|
247
181
|
|
|
248
182
|
export { }
|