@paprize/react 0.0.4 → 0.0.5

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.
@@ -1,9 +1,14 @@
1
- import { ConfigAttribute } from '../../@paprize/core';
1
+ import { ConfigAttribute } from '@paprize/core';
2
+ import { Context } from 'react';
2
3
  import { JSX } from 'react/jsx-runtime';
3
- import { PaginationConfig } from '../@paprize/core';
4
- import { PaginationConfig as PaginationConfig_2 } from '../../@paprize/core';
5
- import { PaginationPlugin } from '../@paprize/core';
4
+ import { PageDimension } from '@paprize/core';
5
+ import { PageMargin } from '@paprize/core';
6
+ import { PageOrientation } from '@paprize/core';
7
+ import { PaginationConfig } from '@paprize/core';
8
+ import { PaginationCycleCompleted } from '@paprize/core';
9
+ import { PaginationPlugin } from '@paprize/core';
6
10
  import { ReactNode } from 'react';
11
+ import { SectionContext } from '@paprize/core';
7
12
 
8
13
  export declare const jsonData: () => Promise<unknown>;
9
14
 
@@ -19,10 +24,10 @@ export declare function PageContent({ children }: {
19
24
  children: ReactNode;
20
25
  }): JSX.Element;
21
26
 
22
- export declare interface PageDimension {
23
- height: string;
24
- width: string;
25
- }
27
+ export declare function pageContextToPageInfo(pc: {
28
+ index: number;
29
+ totalPages: number;
30
+ }): PageInfo;
26
31
 
27
32
  export declare function PageFooter({ children }: {
28
33
  children: React.ReactNode;
@@ -32,141 +37,23 @@ export declare function PageHeader({ children }: {
32
37
  children: ReactNode;
33
38
  }): JSX.Element;
34
39
 
35
- export declare interface PageMargin {
36
- top: string;
37
- right: string;
38
- bottom: string;
39
- left: string;
40
+ export declare interface PageInfo {
41
+ pageIndex: number;
42
+ totalPages: number;
40
43
  }
41
44
 
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
45
  export declare function PageOverlay({ children }: {
74
46
  children: ReactNode;
75
47
  }): JSX.Element;
76
48
 
77
- export declare const pageSize: Record<keyof typeof _pageSize, PageDimension>;
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
49
  export { PaginationConfig }
131
50
 
51
+ export declare function paginationCycleToReportInfo(rc: PaginationCycleCompleted): ReportInfo;
52
+
132
53
  export { PaginationPlugin }
133
54
 
134
- /**
135
- * Represents information about a report, including its sections and pagination details.
136
- */
137
55
  export declare interface ReportInfo {
138
- /**
139
- * The total number of sections in the report.
140
- * When isFirstPaginationCompleted is false, this value is 0.
141
- * When isPaginated is false, this value is not guaranteed to be accurate.
142
- */
143
- totalSections: number;
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
- }[];
56
+ sections: SectionInfo[];
170
57
  }
171
58
 
172
59
  /**
@@ -183,7 +70,16 @@ export declare interface ReportRootProps {
183
70
  children: ReactNode;
184
71
  }
185
72
 
186
- export declare function Section({ children, dimension, orientation, margin, config, }: SectionProps): JSX.Element;
73
+ export declare function Section({ children, id, dimension, orientation, margin, config, }: SectionProps): JSX.Element;
74
+
75
+ export declare function sectionContextToSectionInfo(sc: SectionContext): SectionInfo;
76
+
77
+ export declare interface SectionController {
78
+ addPlugin: (plugin: PaginationPlugin) => void;
79
+ addSuspense: (suspense: Promise<void>) => void;
80
+ }
81
+
82
+ export declare const SectionControllerContext: Context<SectionController>;
187
83
 
188
84
  export declare function SectionFooter({ children }: {
189
85
  children: React.ReactNode;
@@ -193,56 +89,39 @@ export declare function SectionHeader({ children }: {
193
89
  children: React.ReactNode;
194
90
  }): JSX.Element;
195
91
 
196
- /**
197
- * Represents information about a section, including pagination details and pending suspensions.
198
- */
199
92
  export declare interface SectionInfo {
200
- /**
201
- * The total number of pages in the section.
202
- * When isPaginated is false, this value is 0.
203
- */
204
- totalPages: number;
205
- /**
206
- * Indicates whether the section is paginated.
207
- */
93
+ sectionId: string;
94
+ sectionIndex: number;
208
95
  isPaginated: boolean;
209
- /**
210
- * The number of pending suspensions in the section.
211
- */
212
- pendingSuspensions: number;
96
+ isSuspended: boolean;
97
+ pages: PageInfo[];
213
98
  }
214
99
 
215
100
  export declare interface SectionProps {
216
101
  children: ReactNode;
102
+ id?: string;
217
103
  dimension: PageDimension;
218
104
  orientation?: PageOrientation;
219
105
  margin?: PageMargin;
220
- config?: Partial<PaginationConfig_2>;
221
- }
222
-
223
- export declare interface State<T> {
224
- state: 'loading' | 'hasData' | 'hasError';
225
- value?: T;
106
+ config?: Partial<PaginationConfig>;
226
107
  }
227
108
 
228
109
  export declare function useJsonData<DataModel>(defaultValue?: DataModel): DataModel | undefined;
229
110
 
230
111
  export declare const usePageInfo: () => {
231
- pageNumber: number;
112
+ pageIndex: number;
232
113
  totalPages: number;
233
114
  };
234
115
 
235
116
  export declare function useReportInfo(): ReportInfo;
236
117
 
237
- export declare const useSectionInfo: () => {
238
- sectionId: string;
239
- totalPages: number;
240
- };
118
+ export declare const useSectionInfo: () => SectionInfo;
119
+
120
+ export declare function useSectionSuspension(promise: Promise<void> | Promise<unknown>): void;
241
121
 
242
- export declare function useSectionSuspension(sectionId: string, suspend?: boolean): {
122
+ export declare function useSectionSuspension(): {
243
123
  release: () => void;
124
+ reset: () => void;
244
125
  };
245
126
 
246
- export declare function useSuspenseForPromise<T>(promise: Promise<T>, defaultValue?: T): T | undefined;
247
-
248
127
  export { }