@cecee/document-flip-book 1.0.18 → 1.0.20
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/dist/cjs/AccountingBook/assets/active-line.png +0 -0
- package/dist/cjs/AccountingBook/assets/default-line.png +0 -0
- package/dist/cjs/AccountingBook/assets/filp-bg.png +0 -0
- package/dist/cjs/AccountingBook/components/AccountingVoucher/index.d.ts +26 -0
- package/dist/cjs/AccountingBook/components/AccountingVoucher/index.js +398 -0
- package/dist/cjs/AccountingBook/components/AccountingVoucher/index.less +231 -0
- package/dist/cjs/AccountingBook/components/ExportModal.d.ts +10 -0
- package/dist/cjs/AccountingBook/components/ExportModal.js +96 -0
- package/dist/cjs/AccountingBook/components/FilpPage.d.ts +7 -0
- package/dist/cjs/AccountingBook/components/FilpPage.js +39 -0
- package/dist/cjs/AccountingBook/components/HeaderBar.d.ts +28 -0
- package/dist/cjs/AccountingBook/components/HeaderBar.js +245 -0
- package/dist/cjs/AccountingBook/components/ImagePageRenderer.d.ts +11 -0
- package/dist/cjs/AccountingBook/components/ImagePageRenderer.js +91 -0
- package/dist/cjs/AccountingBook/components/LoadingComponent.d.ts +7 -0
- package/dist/cjs/AccountingBook/components/LoadingComponent.js +54 -0
- package/dist/cjs/AccountingBook/components/PDFPageRenderer.d.ts +13 -0
- package/dist/cjs/AccountingBook/components/PDFPageRenderer.js +259 -0
- package/dist/cjs/AccountingBook/components/index.less +6 -0
- package/dist/cjs/AccountingBook/constants.d.ts +11 -0
- package/dist/cjs/AccountingBook/constants.js +25 -0
- package/dist/cjs/AccountingBook/hooks/useAmountSearch.d.ts +24 -0
- package/dist/cjs/AccountingBook/hooks/useAmountSearch.js +165 -0
- package/dist/cjs/AccountingBook/hooks/usePageFlip.d.ts +15 -0
- package/dist/cjs/AccountingBook/hooks/usePageFlip.js +67 -0
- package/dist/cjs/AccountingBook/index.d.ts +29 -1
- package/dist/cjs/AccountingBook/index.js +1163 -7
- package/dist/cjs/AccountingBook/index.less +188 -0
- package/dist/cjs/AccountingBook/types.d.ts +84 -0
- package/dist/cjs/AccountingBook/types.js +5 -0
- package/dist/cjs/AccountingBook/utils/canvasUtils.d.ts +51 -0
- package/dist/cjs/AccountingBook/utils/canvasUtils.js +499 -0
- package/dist/cjs/AccountingBook/utils/html.d.ts +9 -0
- package/dist/cjs/AccountingBook/utils/html.js +97 -0
- package/dist/cjs/AccountingBook/utils/utils.d.ts +38 -0
- package/dist/cjs/AccountingBook/utils/utils.js +204 -0
- package/dist/cjs/DocumentFlipBook/ExportModal.d.ts +1 -1
- package/dist/cjs/DocumentFlipBook/ExportModal.js +1 -1
- package/dist/cjs/DocumentFlipBook/HeaderBar.d.ts +2 -1
- package/dist/cjs/DocumentFlipBook/HeaderBar.js +13 -11
- package/dist/cjs/DocumentFlipBook/SideTabs.js +111 -6
- package/dist/cjs/DocumentFlipBook/index.d.ts +1 -0
- package/dist/cjs/DocumentFlipBook/index.js +9 -6
- package/dist/cjs/DocumentFlipBook/index.less +239 -12
- package/dist/cjs/declarations.d.ts +21 -0
- package/dist/esm/AccountingBook/assets/active-line.png +0 -0
- package/dist/esm/AccountingBook/assets/default-line.png +0 -0
- package/dist/esm/AccountingBook/assets/filp-bg.png +0 -0
- package/dist/esm/AccountingBook/components/AccountingVoucher/index.d.ts +26 -0
- package/dist/esm/AccountingBook/components/AccountingVoucher/index.js +391 -0
- package/dist/esm/AccountingBook/components/AccountingVoucher/index.less +231 -0
- package/dist/esm/AccountingBook/components/ExportModal.d.ts +10 -0
- package/dist/esm/AccountingBook/components/ExportModal.js +88 -0
- package/dist/esm/AccountingBook/components/FilpPage.d.ts +7 -0
- package/dist/esm/AccountingBook/components/FilpPage.js +33 -0
- package/dist/esm/AccountingBook/components/HeaderBar.d.ts +28 -0
- package/dist/esm/AccountingBook/components/HeaderBar.js +236 -0
- package/dist/esm/AccountingBook/components/ImagePageRenderer.d.ts +11 -0
- package/dist/esm/AccountingBook/components/ImagePageRenderer.js +85 -0
- package/dist/esm/AccountingBook/components/LoadingComponent.d.ts +7 -0
- package/dist/esm/AccountingBook/components/LoadingComponent.js +48 -0
- package/dist/esm/AccountingBook/components/PDFPageRenderer.d.ts +13 -0
- package/dist/esm/AccountingBook/components/PDFPageRenderer.js +252 -0
- package/dist/esm/AccountingBook/components/index.less +6 -0
- package/dist/esm/AccountingBook/constants.d.ts +11 -0
- package/dist/esm/AccountingBook/constants.js +17 -0
- package/dist/esm/AccountingBook/hooks/useAmountSearch.d.ts +24 -0
- package/dist/esm/AccountingBook/hooks/useAmountSearch.js +158 -0
- package/dist/esm/AccountingBook/hooks/usePageFlip.d.ts +15 -0
- package/dist/esm/AccountingBook/hooks/usePageFlip.js +61 -0
- package/dist/esm/AccountingBook/index.d.ts +29 -1
- package/dist/esm/AccountingBook/index.js +1162 -6
- package/dist/esm/AccountingBook/index.less +188 -0
- package/dist/esm/AccountingBook/types.d.ts +84 -0
- package/dist/esm/AccountingBook/types.js +1 -0
- package/dist/esm/AccountingBook/utils/canvasUtils.d.ts +51 -0
- package/dist/esm/AccountingBook/utils/canvasUtils.js +493 -0
- package/dist/esm/AccountingBook/utils/html.d.ts +9 -0
- package/dist/esm/AccountingBook/utils/html.js +89 -0
- package/dist/esm/AccountingBook/utils/utils.d.ts +38 -0
- package/dist/esm/AccountingBook/utils/utils.js +195 -0
- package/dist/esm/DocumentFlipBook/ExportModal.d.ts +1 -1
- package/dist/esm/DocumentFlipBook/ExportModal.js +1 -1
- package/dist/esm/DocumentFlipBook/HeaderBar.d.ts +2 -1
- package/dist/esm/DocumentFlipBook/HeaderBar.js +13 -11
- package/dist/esm/DocumentFlipBook/SideTabs.js +110 -5
- package/dist/esm/DocumentFlipBook/index.d.ts +1 -0
- package/dist/esm/DocumentFlipBook/index.js +9 -6
- package/dist/esm/DocumentFlipBook/index.less +239 -12
- package/dist/esm/declarations.d.ts +21 -0
- package/package.json +8 -2
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
.flipbook-container {
|
|
2
|
+
position: relative;
|
|
3
|
+
width: 1100px;
|
|
4
|
+
height: 660px;
|
|
5
|
+
margin: 0 auto;
|
|
6
|
+
overflow: visible;
|
|
7
|
+
border-radius: 24px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.flipbook {
|
|
11
|
+
height: calc(100vh - 182px);
|
|
12
|
+
overflow: auto;
|
|
13
|
+
padding: 28px 220px 36px 140px;
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
background:
|
|
16
|
+
radial-gradient(circle at top left, rgba(214, 186, 145, 0.18), transparent 28%),
|
|
17
|
+
linear-gradient(180deg, #f7f1e7 0%, #f3ecdf 100%);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
.stf__parent canvas {
|
|
22
|
+
position: static !important;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.flip-book {
|
|
26
|
+
width: 998px !important;
|
|
27
|
+
position: absolute !important;
|
|
28
|
+
left: 150px;
|
|
29
|
+
top: 140px;
|
|
30
|
+
z-index: 2;
|
|
31
|
+
border-radius: 8px;
|
|
32
|
+
box-shadow:
|
|
33
|
+
0 20px 32px rgba(122, 84, 48, 0.18),
|
|
34
|
+
0 4px 12px rgba(122, 84, 48, 0.2);
|
|
35
|
+
overflow: hidden;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.page {
|
|
39
|
+
background-color: white;
|
|
40
|
+
position: relative;
|
|
41
|
+
overflow: hidden;
|
|
42
|
+
pointer-events: auto;
|
|
43
|
+
z-index: 1;
|
|
44
|
+
width: 100%;
|
|
45
|
+
height: 100%;
|
|
46
|
+
|
|
47
|
+
.page-content {
|
|
48
|
+
width: 100%;
|
|
49
|
+
height: 100%;
|
|
50
|
+
position: relative;
|
|
51
|
+
z-index: 1;
|
|
52
|
+
background-color: white;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.page-back {
|
|
56
|
+
width: 100%;
|
|
57
|
+
height: 100%;
|
|
58
|
+
position: absolute;
|
|
59
|
+
top: 0;
|
|
60
|
+
left: 0;
|
|
61
|
+
z-index: 0;
|
|
62
|
+
backface-visibility: visible;
|
|
63
|
+
transform: rotateY(180deg);
|
|
64
|
+
background-color: white;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// .page-content {
|
|
69
|
+
// width: 100%;
|
|
70
|
+
// height: 100%;
|
|
71
|
+
// }
|
|
72
|
+
|
|
73
|
+
.controls {
|
|
74
|
+
display: flex;
|
|
75
|
+
align-items: center;
|
|
76
|
+
justify-content: center;
|
|
77
|
+
gap: 20px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.voucher-page {
|
|
81
|
+
width: 100%;
|
|
82
|
+
height: 100%;
|
|
83
|
+
display: flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
justify-content: center;
|
|
86
|
+
background-color: transparent;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.attachment-page {
|
|
90
|
+
width: 100%;
|
|
91
|
+
height: 100%;
|
|
92
|
+
background-color: #fff;
|
|
93
|
+
padding: 0 20px;
|
|
94
|
+
text-align: center;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.placeholder-page {
|
|
98
|
+
width: 100%;
|
|
99
|
+
height: 100%;
|
|
100
|
+
background-color: #fff;
|
|
101
|
+
z-index: 2;
|
|
102
|
+
text-align: center;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.error-page {
|
|
106
|
+
width: 100%;
|
|
107
|
+
height: 100%;
|
|
108
|
+
display: flex;
|
|
109
|
+
align-items: center;
|
|
110
|
+
justify-content: center;
|
|
111
|
+
background-color: transparent;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.empty-page {
|
|
115
|
+
width: 100%;
|
|
116
|
+
height: 100%;
|
|
117
|
+
display: flex;
|
|
118
|
+
align-items: center;
|
|
119
|
+
justify-content: center;
|
|
120
|
+
background-color: transparent;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.fliterBar {
|
|
124
|
+
position: absolute;
|
|
125
|
+
left: calc(100% + 40px);
|
|
126
|
+
top: 25%;
|
|
127
|
+
z-index: 1;
|
|
128
|
+
display: flex;
|
|
129
|
+
flex-direction: column;
|
|
130
|
+
gap: 6px;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
.filter-item {
|
|
135
|
+
width: 100%;
|
|
136
|
+
height: 34px;
|
|
137
|
+
padding: 0 12px 0 18px;
|
|
138
|
+
cursor: pointer;
|
|
139
|
+
font-size: 16px;
|
|
140
|
+
font-weight: 500;
|
|
141
|
+
color: #595959;
|
|
142
|
+
background: #FFF9E1;
|
|
143
|
+
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
144
|
+
box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.05);
|
|
145
|
+
display: flex;
|
|
146
|
+
align-items: center;
|
|
147
|
+
justify-content: center;
|
|
148
|
+
white-space: nowrap;
|
|
149
|
+
position: relative;
|
|
150
|
+
border-radius: 0 4px 4px 0;
|
|
151
|
+
|
|
152
|
+
&::before {
|
|
153
|
+
content: '';
|
|
154
|
+
position: absolute;
|
|
155
|
+
left: 0;
|
|
156
|
+
top: 0;
|
|
157
|
+
bottom: 0;
|
|
158
|
+
width: 4px;
|
|
159
|
+
background: #FFC53D;
|
|
160
|
+
transition: all 0.3s ease;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
&:hover {
|
|
164
|
+
background: #FFF1B8;
|
|
165
|
+
transform: translateX(4px);
|
|
166
|
+
|
|
167
|
+
&::before {
|
|
168
|
+
width: 4px;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
&.active {
|
|
173
|
+
background: #FFE58F;
|
|
174
|
+
color: #262626;
|
|
175
|
+
font-weight: bold;
|
|
176
|
+
transform: translateX(8px);
|
|
177
|
+
box-shadow: 4px 4px 12px rgba(0, 0, 0, 0.08);
|
|
178
|
+
|
|
179
|
+
&::before {
|
|
180
|
+
width: 6px;
|
|
181
|
+
background: #FAAD14;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.filter-text {
|
|
186
|
+
letter-spacing: 1px;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface Attachment {
|
|
3
|
+
id: number;
|
|
4
|
+
path: string;
|
|
5
|
+
}
|
|
6
|
+
export interface StubPageDetail {
|
|
7
|
+
id: number;
|
|
8
|
+
dt: string;
|
|
9
|
+
amount: string;
|
|
10
|
+
code: number;
|
|
11
|
+
remark: string;
|
|
12
|
+
subject: string;
|
|
13
|
+
trade_direction: string;
|
|
14
|
+
stub_id?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface StubPageRaw {
|
|
17
|
+
id: number;
|
|
18
|
+
title: string;
|
|
19
|
+
dt: string;
|
|
20
|
+
amount: string;
|
|
21
|
+
subject?: string | null;
|
|
22
|
+
code: string;
|
|
23
|
+
attachments_count?: number;
|
|
24
|
+
stub_page_id?: number;
|
|
25
|
+
document_number?: string;
|
|
26
|
+
created_at?: string;
|
|
27
|
+
updated_at?: string;
|
|
28
|
+
acc17c_id?: number;
|
|
29
|
+
attachments: Attachment[];
|
|
30
|
+
}
|
|
31
|
+
export interface VoucherItem {
|
|
32
|
+
id: number;
|
|
33
|
+
code: number;
|
|
34
|
+
dt: string;
|
|
35
|
+
remark: string;
|
|
36
|
+
amount: string;
|
|
37
|
+
}
|
|
38
|
+
export interface OriginalDocument {
|
|
39
|
+
id: number;
|
|
40
|
+
title: string;
|
|
41
|
+
amount: string;
|
|
42
|
+
attachments: Attachment[];
|
|
43
|
+
}
|
|
44
|
+
export interface StubPage {
|
|
45
|
+
id: number;
|
|
46
|
+
dt: string;
|
|
47
|
+
code: number;
|
|
48
|
+
remark: string;
|
|
49
|
+
amount: string;
|
|
50
|
+
stub_page_details: StubPageDetail[];
|
|
51
|
+
stub_page_raws: StubPageRaw[];
|
|
52
|
+
}
|
|
53
|
+
export interface SearchOption {
|
|
54
|
+
label: string;
|
|
55
|
+
value: string;
|
|
56
|
+
groupKey: number;
|
|
57
|
+
rawId: number;
|
|
58
|
+
amount: string;
|
|
59
|
+
keywords: string[];
|
|
60
|
+
pageKey?: string;
|
|
61
|
+
title?: string;
|
|
62
|
+
pageLabel?: string;
|
|
63
|
+
}
|
|
64
|
+
export interface VoucherGroup {
|
|
65
|
+
groupKey: number;
|
|
66
|
+
stubPage: StubPage;
|
|
67
|
+
voucherItems: VoucherItem[];
|
|
68
|
+
pages: React.ReactNode[];
|
|
69
|
+
}
|
|
70
|
+
export interface PageRecord {
|
|
71
|
+
pageKey: string;
|
|
72
|
+
page: React.ReactNode;
|
|
73
|
+
groupKey: number;
|
|
74
|
+
pageType: 'voucher' | 'attachment' | 'other';
|
|
75
|
+
title?: string;
|
|
76
|
+
titles: string[];
|
|
77
|
+
amount?: string;
|
|
78
|
+
voucherCode?: number;
|
|
79
|
+
rawId?: number;
|
|
80
|
+
attachmentId?: number;
|
|
81
|
+
documentNumber?: string;
|
|
82
|
+
dt?: string;
|
|
83
|
+
pageLabel: string;
|
|
84
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* 预加载单张图片并转 Base64
|
|
4
|
+
*/
|
|
5
|
+
export declare const preloadAndConvertImage: (url: string) => Promise<string | null>;
|
|
6
|
+
/**
|
|
7
|
+
* 批量预加载图片
|
|
8
|
+
*/
|
|
9
|
+
export declare const batchPreloadImages: (imageUrls: string[]) => Promise<Map<any, any>>;
|
|
10
|
+
/**
|
|
11
|
+
* 从 React 节点提取附件信息
|
|
12
|
+
*/
|
|
13
|
+
export declare const extractAttachmentInfo: (pageElement: React.ReactElement) => {
|
|
14
|
+
type: string;
|
|
15
|
+
src: any;
|
|
16
|
+
alt: any;
|
|
17
|
+
attachmentCount: any;
|
|
18
|
+
amount: any;
|
|
19
|
+
pageNumber?: undefined;
|
|
20
|
+
} | {
|
|
21
|
+
type: string;
|
|
22
|
+
src: any;
|
|
23
|
+
pageNumber: any;
|
|
24
|
+
attachmentCount: any;
|
|
25
|
+
amount: any;
|
|
26
|
+
alt?: undefined;
|
|
27
|
+
} | null;
|
|
28
|
+
/**
|
|
29
|
+
* Base64 转图片元素
|
|
30
|
+
*/
|
|
31
|
+
export declare const createImageElementFromBase64: (base64Data: string) => Promise<HTMLImageElement | null>;
|
|
32
|
+
/**
|
|
33
|
+
* 直接通过 URL 创建图片元素
|
|
34
|
+
*/
|
|
35
|
+
export declare const createImageElementDirect: (imageSrc: string) => Promise<HTMLImageElement | null>;
|
|
36
|
+
/**
|
|
37
|
+
* PDF 页面转图片 Base64
|
|
38
|
+
*/
|
|
39
|
+
export declare const renderPDFPageToImageBase64: (pdfPath: string, pageNumber?: number) => Promise<string | null>;
|
|
40
|
+
/**
|
|
41
|
+
* 创建凭证 Canvas(用于导出)
|
|
42
|
+
*/
|
|
43
|
+
export declare const createVoucherCanvas: (voucherProps: any, baseVoucherInfo: any) => Promise<HTMLCanvasElement | null>;
|
|
44
|
+
/**
|
|
45
|
+
* 创建附件 Canvas
|
|
46
|
+
*/
|
|
47
|
+
export declare const createAttachmentCanvasFixed: (attachmentInfo: any, preloadedImages: Map<string, string>) => Promise<HTMLCanvasElement | null>;
|
|
48
|
+
/**
|
|
49
|
+
* 创建封面 Canvas
|
|
50
|
+
*/
|
|
51
|
+
export declare const createCoverCanvas: (coverData: any, companyName: string) => Promise<HTMLCanvasElement | null>;
|