@paprize/react 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/dist/paprize-react.d.ts +247 -0
- package/dist/paprize-react.js +2022 -0
- package/dist/paprize-react.umd.cjs +55 -0
- package/package.json +72 -0
package/README.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# Paprize
|
|
2
|
+
|
|
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
|
+
|
|
5
|
+

|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { ConfigAttribute } from '@paprize/core/src';
|
|
2
|
+
import { defaultPlugins } from '@paprize/core/src';
|
|
3
|
+
import { JSX } from 'react/jsx-runtime';
|
|
4
|
+
import { PaginationConfig } from '@paprize/core/src';
|
|
5
|
+
import { PaginationPlugin } from '@paprize/core/src';
|
|
6
|
+
import { ReactNode } from 'react';
|
|
7
|
+
|
|
8
|
+
export { defaultPlugins }
|
|
9
|
+
|
|
10
|
+
export declare const jsonData: () => Promise<unknown>;
|
|
11
|
+
|
|
12
|
+
export declare function Layout({ children, ...attributes }: LayoutProps): JSX.Element;
|
|
13
|
+
|
|
14
|
+
export declare interface LayoutProps extends ConfigAttribute {
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export declare function PageBreak(): JSX.Element;
|
|
19
|
+
|
|
20
|
+
export declare function PageContent({ children }: {
|
|
21
|
+
children: ReactNode;
|
|
22
|
+
}): JSX.Element;
|
|
23
|
+
|
|
24
|
+
export declare interface PageDimension {
|
|
25
|
+
height: string;
|
|
26
|
+
width: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export declare function PageFooter({ children }: {
|
|
30
|
+
children: React.ReactNode;
|
|
31
|
+
}): JSX.Element;
|
|
32
|
+
|
|
33
|
+
export declare function PageHeader({ children }: {
|
|
34
|
+
children: ReactNode;
|
|
35
|
+
}): JSX.Element;
|
|
36
|
+
|
|
37
|
+
export declare interface PageMargin {
|
|
38
|
+
top: string;
|
|
39
|
+
right: string;
|
|
40
|
+
bottom: string;
|
|
41
|
+
left: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export declare const pageMargin: Record<keyof typeof _pageMargin, PageMargin>;
|
|
45
|
+
|
|
46
|
+
declare const _pageMargin: {
|
|
47
|
+
Normal: {
|
|
48
|
+
top: string;
|
|
49
|
+
right: string;
|
|
50
|
+
bottom: string;
|
|
51
|
+
left: string;
|
|
52
|
+
};
|
|
53
|
+
Narrow: {
|
|
54
|
+
top: string;
|
|
55
|
+
right: string;
|
|
56
|
+
bottom: string;
|
|
57
|
+
left: string;
|
|
58
|
+
};
|
|
59
|
+
Wide: {
|
|
60
|
+
top: string;
|
|
61
|
+
right: string;
|
|
62
|
+
bottom: string;
|
|
63
|
+
left: string;
|
|
64
|
+
};
|
|
65
|
+
None: {
|
|
66
|
+
top: string;
|
|
67
|
+
right: string;
|
|
68
|
+
bottom: string;
|
|
69
|
+
left: string;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export declare type PageOrientation = 'portrait' | 'landscape';
|
|
74
|
+
|
|
75
|
+
export declare const pageSize: Record<keyof typeof _pageSize, PageDimension>;
|
|
76
|
+
|
|
77
|
+
declare const _pageSize: {
|
|
78
|
+
A1: {
|
|
79
|
+
height: string;
|
|
80
|
+
width: string;
|
|
81
|
+
};
|
|
82
|
+
A2: {
|
|
83
|
+
height: string;
|
|
84
|
+
width: string;
|
|
85
|
+
};
|
|
86
|
+
A3: {
|
|
87
|
+
height: string;
|
|
88
|
+
width: string;
|
|
89
|
+
};
|
|
90
|
+
A4: {
|
|
91
|
+
height: string;
|
|
92
|
+
width: string;
|
|
93
|
+
};
|
|
94
|
+
A5: {
|
|
95
|
+
height: string;
|
|
96
|
+
width: string;
|
|
97
|
+
};
|
|
98
|
+
A6: {
|
|
99
|
+
height: string;
|
|
100
|
+
width: string;
|
|
101
|
+
};
|
|
102
|
+
B3: {
|
|
103
|
+
height: string;
|
|
104
|
+
width: string;
|
|
105
|
+
};
|
|
106
|
+
B4: {
|
|
107
|
+
height: string;
|
|
108
|
+
width: string;
|
|
109
|
+
};
|
|
110
|
+
B5: {
|
|
111
|
+
height: string;
|
|
112
|
+
width: string;
|
|
113
|
+
};
|
|
114
|
+
Letter: {
|
|
115
|
+
height: string;
|
|
116
|
+
width: string;
|
|
117
|
+
};
|
|
118
|
+
Legal: {
|
|
119
|
+
height: string;
|
|
120
|
+
width: string;
|
|
121
|
+
};
|
|
122
|
+
Tabloid: {
|
|
123
|
+
height: string;
|
|
124
|
+
width: string;
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
export { PaginationConfig }
|
|
129
|
+
|
|
130
|
+
export { PaginationPlugin }
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Represents information about a report, including its sections and pagination details.
|
|
134
|
+
*/
|
|
135
|
+
export declare interface ReportInfo {
|
|
136
|
+
/**
|
|
137
|
+
* The total number of sections in the report.
|
|
138
|
+
* When isFirstPaginationCompleted is false, this value is 0.
|
|
139
|
+
* When isPaginated is false, this value is not guaranteed to be accurate.
|
|
140
|
+
*/
|
|
141
|
+
totalSections: number;
|
|
142
|
+
/**
|
|
143
|
+
* Indicates whether the report is ready and all sections are paginated.
|
|
144
|
+
*/
|
|
145
|
+
isPaginated: boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Indicates whether the first pagination process has been completed.
|
|
148
|
+
* This becomes true once at least one section has been paginated.
|
|
149
|
+
*/
|
|
150
|
+
isFirstPaginationCompleted: boolean;
|
|
151
|
+
/**
|
|
152
|
+
* An array of sections in the report, each containing details about the section.
|
|
153
|
+
*/
|
|
154
|
+
sections: {
|
|
155
|
+
/**
|
|
156
|
+
* The name of the section.
|
|
157
|
+
*/
|
|
158
|
+
sectionName: string;
|
|
159
|
+
/**
|
|
160
|
+
* The total number of pages in the section.
|
|
161
|
+
*/
|
|
162
|
+
totalPages: number;
|
|
163
|
+
/**
|
|
164
|
+
* Indicates whether the section is paginated.
|
|
165
|
+
*/
|
|
166
|
+
isPaginated: boolean;
|
|
167
|
+
}[];
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* ReportPreview is a wrapper component that applies styles to its children, mimicking the appearance of the Chrome Print Preview screen.
|
|
172
|
+
* Use this component to render reports or documents with a print-friendly layout and consistent visual formatting in client side application.
|
|
173
|
+
*/
|
|
174
|
+
export declare function ReportPreview({ children }: {
|
|
175
|
+
children: ReactNode;
|
|
176
|
+
}): JSX.Element;
|
|
177
|
+
|
|
178
|
+
export declare function ReportRoot({ children }: ReportRootProps): JSX.Element;
|
|
179
|
+
|
|
180
|
+
export declare interface ReportRootProps {
|
|
181
|
+
children: ReactNode;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export declare function Section({ children, dimension, orientation, margin, config, name, }: SectionProps): JSX.Element;
|
|
185
|
+
|
|
186
|
+
export declare function SectionFooter({ children }: {
|
|
187
|
+
children: React.ReactNode;
|
|
188
|
+
}): JSX.Element;
|
|
189
|
+
|
|
190
|
+
export declare function SectionHeader({ children }: {
|
|
191
|
+
children: React.ReactNode;
|
|
192
|
+
}): JSX.Element;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Represents information about a section, including pagination details and pending suspensions.
|
|
196
|
+
*/
|
|
197
|
+
export declare interface SectionInfo {
|
|
198
|
+
/**
|
|
199
|
+
* The total number of pages in the section.
|
|
200
|
+
* When isPaginated is false, this value is 0.
|
|
201
|
+
*/
|
|
202
|
+
totalPages: number;
|
|
203
|
+
/**
|
|
204
|
+
* Indicates whether the section is paginated.
|
|
205
|
+
*/
|
|
206
|
+
isPaginated: boolean;
|
|
207
|
+
/**
|
|
208
|
+
* The number of pending suspensions in the section.
|
|
209
|
+
*/
|
|
210
|
+
pendingSuspensions: number;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export declare interface SectionProps {
|
|
214
|
+
children: ReactNode;
|
|
215
|
+
dimension: PageDimension;
|
|
216
|
+
orientation?: PageOrientation;
|
|
217
|
+
margin?: PageMargin;
|
|
218
|
+
config?: PaginationConfig;
|
|
219
|
+
name?: string;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export declare interface State<T> {
|
|
223
|
+
state: 'loading' | 'hasData' | 'hasError';
|
|
224
|
+
value?: T;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export declare function useJsonData<DataModel>(defaultValue?: DataModel): DataModel | undefined;
|
|
228
|
+
|
|
229
|
+
export declare const usePageInfo: () => {
|
|
230
|
+
pageNumber: number;
|
|
231
|
+
totalPages: number;
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
export declare function useReportInfo(): ReportInfo;
|
|
235
|
+
|
|
236
|
+
export declare const useSectionInfo: () => {
|
|
237
|
+
sectionName: string;
|
|
238
|
+
totalPages: number;
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
export declare function useSectionSuspension(sectionName: string, suspend?: boolean): {
|
|
242
|
+
release: () => void;
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
export declare function useSuspenseForPromise<T>(promise: Promise<T>, defaultValue?: T): T | undefined;
|
|
246
|
+
|
|
247
|
+
export { }
|