@cecee/document-flip-book 1.0.8

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.
Files changed (59) hide show
  1. package/dist/cjs/ArchiveCover.d.ts +9 -0
  2. package/dist/cjs/ArchiveCover.js +142 -0
  3. package/dist/cjs/DocumentFlipBook.d.ts +32 -0
  4. package/dist/cjs/DocumentFlipBook.js +644 -0
  5. package/dist/cjs/ExportModal.d.ts +10 -0
  6. package/dist/cjs/ExportModal.js +96 -0
  7. package/dist/cjs/HeaderBar.d.ts +25 -0
  8. package/dist/cjs/HeaderBar.js +220 -0
  9. package/dist/cjs/PdfPage.d.ts +9 -0
  10. package/dist/cjs/PdfPage.js +143 -0
  11. package/dist/cjs/ProjectCover.d.ts +8 -0
  12. package/dist/cjs/ProjectCover.js +201 -0
  13. package/dist/cjs/SideTabs.d.ts +8 -0
  14. package/dist/cjs/SideTabs.js +34 -0
  15. package/dist/cjs/exportHtml.d.ts +19 -0
  16. package/dist/cjs/exportHtml.js +189 -0
  17. package/dist/cjs/exportPdf.d.ts +27 -0
  18. package/dist/cjs/exportPdf.js +232 -0
  19. package/dist/cjs/globalCache.d.ts +5 -0
  20. package/dist/cjs/globalCache.js +20 -0
  21. package/dist/cjs/index.d.ts +3 -0
  22. package/dist/cjs/index.js +36 -0
  23. package/dist/cjs/index.less +637 -0
  24. package/dist/cjs/printPdf.d.ts +6 -0
  25. package/dist/cjs/printPdf.js +51 -0
  26. package/dist/cjs/types.d.ts +31 -0
  27. package/dist/cjs/types.js +5 -0
  28. package/dist/cjs/utils.d.ts +17 -0
  29. package/dist/cjs/utils.js +220 -0
  30. package/dist/esm/ArchiveCover.d.ts +9 -0
  31. package/dist/esm/ArchiveCover.js +136 -0
  32. package/dist/esm/DocumentFlipBook.d.ts +32 -0
  33. package/dist/esm/DocumentFlipBook.js +630 -0
  34. package/dist/esm/ExportModal.d.ts +10 -0
  35. package/dist/esm/ExportModal.js +88 -0
  36. package/dist/esm/HeaderBar.d.ts +25 -0
  37. package/dist/esm/HeaderBar.js +211 -0
  38. package/dist/esm/PdfPage.d.ts +9 -0
  39. package/dist/esm/PdfPage.js +136 -0
  40. package/dist/esm/ProjectCover.d.ts +8 -0
  41. package/dist/esm/ProjectCover.js +195 -0
  42. package/dist/esm/SideTabs.d.ts +8 -0
  43. package/dist/esm/SideTabs.js +27 -0
  44. package/dist/esm/exportHtml.d.ts +19 -0
  45. package/dist/esm/exportHtml.js +178 -0
  46. package/dist/esm/exportPdf.d.ts +27 -0
  47. package/dist/esm/exportPdf.js +223 -0
  48. package/dist/esm/globalCache.d.ts +5 -0
  49. package/dist/esm/globalCache.js +15 -0
  50. package/dist/esm/index.d.ts +3 -0
  51. package/dist/esm/index.js +3 -0
  52. package/dist/esm/index.less +637 -0
  53. package/dist/esm/printPdf.d.ts +6 -0
  54. package/dist/esm/printPdf.js +45 -0
  55. package/dist/esm/types.d.ts +31 -0
  56. package/dist/esm/types.js +1 -0
  57. package/dist/esm/utils.d.ts +17 -0
  58. package/dist/esm/utils.js +214 -0
  59. package/package.json +57 -0
@@ -0,0 +1,637 @@
1
+ .book-page {
2
+ width: 100%;
3
+ height: 100%;
4
+ background: #9F7D4E;
5
+ padding: 22px;
6
+ }
7
+
8
+ .book-view {
9
+ box-shadow: 0 0 18px rgba(0, 0, 0, 0.18);
10
+ position: relative;
11
+ overflow: hidden;
12
+
13
+ // 页面内侧阴影(靠近中缝处的深度感)
14
+ &::before {
15
+ content: "";
16
+ position: absolute;
17
+ top: 0;
18
+ bottom: 0;
19
+ width: 20px;
20
+ z-index: 5;
21
+ pointer-events: none;
22
+ transition: opacity 0.3s ease;
23
+ }
24
+
25
+ // 偶数页(通常是右页)阴影在左侧
26
+ &:nth-child(even)::before {
27
+ left: 0;
28
+ background: linear-gradient(to right, rgba(0, 0, 0, 0.12) 0%, rgba(0, 0, 0, 0.05) 40%, transparent 100%);
29
+ }
30
+
31
+ // 奇数页(通常是左页)阴影在右侧
32
+ &:nth-child(odd)::before {
33
+ right: 0;
34
+ background: linear-gradient(to left, rgba(0, 0, 0, 0.12) 0%, rgba(0, 0, 0, 0.05) 40%, transparent 100%);
35
+ }
36
+
37
+ // 封面页(第一页)通常不需要这种内部阴影,或者阴影较弱
38
+ &:first-child::before {
39
+ opacity: 0.3;
40
+ }
41
+ }
42
+
43
+ .header-nav-btn {
44
+ padding: 0 7px;
45
+ }
46
+
47
+ .dfb-HTMLFlipBook {
48
+ overflow: hidden;
49
+ background: #fff;
50
+ }
51
+
52
+ .dfb-root {
53
+ display: flex;
54
+ flex-direction: column;
55
+ height: 100%;
56
+ min-width: 1000px;
57
+ overflow: hidden;
58
+ background: #fff;
59
+
60
+ &.is-fullscreen-modal {
61
+ position: fixed;
62
+ top: 0;
63
+ left: 0;
64
+ width: 100vw;
65
+ height: 100vh;
66
+ z-index: 1001;
67
+ background: #fff;
68
+ animation: dfb-fade-in 0.3s ease;
69
+ }
70
+ }
71
+
72
+ @keyframes dfb-fade-in {
73
+ from {
74
+ opacity: 0;
75
+ transform: scale(0.95);
76
+ }
77
+
78
+ to {
79
+ opacity: 1;
80
+ transform: scale(1);
81
+ }
82
+ }
83
+
84
+ .dfb-header {
85
+ display: flex;
86
+ align-items: center;
87
+ justify-content: space-between;
88
+ height: 55px;
89
+ padding: 10px 10px;
90
+ background: #fff;
91
+ border-bottom: 1px solid #f0f0f0;
92
+
93
+ .dfb-search-btn {
94
+ height: 30px;
95
+ }
96
+
97
+ &-left-group {
98
+ display: flex;
99
+ align-items: center;
100
+ gap: 4px;
101
+ }
102
+
103
+ &-right-group {
104
+ display: flex;
105
+ align-items: center;
106
+ gap: 16px;
107
+ }
108
+
109
+ .dfb-divider {
110
+ height: 18px;
111
+ background: #e8e8e8;
112
+ margin: 0 8px;
113
+ }
114
+
115
+ .ant-btn-link {
116
+ color: #000;
117
+ font-size: 14px;
118
+ padding: 0 8px;
119
+ height: auto;
120
+
121
+ &:hover {
122
+ color: #1677ff;
123
+ }
124
+
125
+ &:disabled {
126
+ color: #d9d9d9;
127
+ cursor: not-allowed;
128
+ }
129
+ }
130
+
131
+ // 搜索框样式
132
+ &-search-wrap {
133
+ display: flex;
134
+ align-items: center;
135
+ gap: 8px;
136
+ }
137
+
138
+ &-search-input {
139
+ width: 220px;
140
+ height: 36px;
141
+ border-radius: 6px;
142
+
143
+ &:hover,
144
+ &:focus {
145
+ border-color: #4096ff;
146
+ }
147
+ }
148
+
149
+ &-search-btn {
150
+ height: 36px;
151
+ border-radius: 6px;
152
+ padding: 0 16px;
153
+ }
154
+ }
155
+
156
+ .dfb-headerTitle {
157
+ font-size: 18px;
158
+ font-weight: 600;
159
+ color: #111827;
160
+ }
161
+
162
+ .dfb-headerLeftActions {
163
+ display: flex;
164
+ align-items: center;
165
+ gap: 6px;
166
+ }
167
+
168
+ .dfb-headerCenter {
169
+ display: flex;
170
+ align-items: center;
171
+ gap: 4px;
172
+ color: #111827;
173
+ }
174
+
175
+ .dfb-pageIndicator {
176
+ display: inline-flex;
177
+ align-items: center;
178
+ justify-content: center;
179
+ min-width: 66px;
180
+ font-weight: 600;
181
+ color: #111827;
182
+ }
183
+
184
+ .dfb-headerRight {
185
+ display: flex;
186
+ align-items: center;
187
+ gap: 10px;
188
+ }
189
+
190
+ .dfb-searchWrap {
191
+ display: flex;
192
+ align-items: center;
193
+ gap: 8px;
194
+ }
195
+
196
+ .dfb-searchInput {
197
+ width: 280px;
198
+ }
199
+
200
+ .dfb-searchBtn {
201
+ padding: 0 14px;
202
+ }
203
+
204
+ .dfb-stage {
205
+ flex: 1;
206
+ display: flex;
207
+ overflow: auto;
208
+ padding: 20px;
209
+ position: relative;
210
+ justify-content: center;
211
+ min-width: 100px;
212
+
213
+ // 解决 AntD Spin 嵌套导致的布局问题
214
+ .ant-spin-nested-loading {
215
+ width: 100%;
216
+ height: 100%;
217
+
218
+ .ant-spin-container {
219
+ width: 100%;
220
+ height: 100%;
221
+ display: flex;
222
+ flex-direction: column;
223
+ }
224
+ }
225
+ }
226
+
227
+ .dfb-sideTabs {
228
+ position: absolute;
229
+ right: -18px; // 调整位置,使其紧贴书本边缘
230
+ top: 40px;
231
+ display: flex;
232
+ flex-direction: column;
233
+ gap: 6px; //
234
+ z-index: 10;
235
+ transition: all 0.3s ease;
236
+
237
+ &.is-on-cover {
238
+ right: -40px; // 封面是单页模式,标签需要向左移动(进入书壳内部边缘)
239
+ top: 40px;
240
+ }
241
+
242
+ .dfb-sideTab {
243
+ width: 42px;
244
+ min-height: 80px;
245
+ padding: 12px 6px 12px 10px;
246
+ border: none;
247
+ border-radius: 0 6px 6px 0;
248
+ cursor: pointer;
249
+ color: #fff;
250
+ font-size: 13px;
251
+ font-weight: 500;
252
+ line-height: 1.2;
253
+ writing-mode: vertical-rl;
254
+ text-align: center;
255
+ transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
256
+ box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.1);
257
+ position: relative;
258
+ overflow: hidden;
259
+ display: flex;
260
+ align-items: center;
261
+ justify-content: center;
262
+
263
+ // 标签左侧的装饰条(仅在选中态或悬浮态显示,模拟折痕)
264
+ &::before {
265
+ content: "";
266
+ position: absolute;
267
+ left: 0;
268
+ top: 0;
269
+ bottom: 0;
270
+ width: 0; // 默认宽度为 0
271
+ background: rgba(255, 255, 255, 0.35);
272
+ transition: all 0.2s ease;
273
+ opacity: 0;
274
+ }
275
+
276
+
277
+
278
+ &.is-active {
279
+ position: relative;
280
+ left: -8px;
281
+ width: 52px; // 选中态更长
282
+ padding-left: 16px;
283
+ font-weight: 700;
284
+ box-shadow: 5px 2px 12px rgba(0, 0, 0, 0.2);
285
+ z-index: 12;
286
+ font-size: 14px;
287
+
288
+ &::before {
289
+ width: 8px; // 选中态条纹显示且最宽
290
+ opacity: 1;
291
+ background: rgba(255, 255, 255, 0.4);
292
+ }
293
+ }
294
+
295
+ .dfb-sideTabText {
296
+ letter-spacing: 2px;
297
+ filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.1));
298
+ }
299
+ }
300
+
301
+ }
302
+
303
+ .is-on-activeTab {
304
+ right: -8px !important;
305
+ }
306
+
307
+ .dfb-book-wrapper {
308
+ display: block;
309
+ margin: auto; // 关键:在 flex 容器中使用 margin: auto 实现完美居中且溢出时可滚动到顶部
310
+ position: relative;
311
+ min-width: 300px;
312
+ }
313
+
314
+ .dfb-bookShell1 {
315
+ position: relative;
316
+ padding: 18px 0 18px 34px;
317
+ background: transparent;
318
+ transition: background-color 0.3s ease;
319
+ }
320
+
321
+ .dfb-bookShell {
322
+ position: relative;
323
+ padding: 18px 34px;
324
+ background: #9F7D4E;
325
+ transition: background-color 0.3s ease;
326
+
327
+ &::after {
328
+ content: "";
329
+ position: absolute;
330
+ top: 0;
331
+ left: 0;
332
+ right: 0;
333
+ bottom: 0;
334
+ background-image: url("https://www.transparenttextures.com/patterns/leather.png");
335
+ opacity: 0.1;
336
+ pointer-events: none;
337
+ border-radius: 8px;
338
+ }
339
+
340
+ // 书本中缝分割线
341
+ .dfb-book-spine {
342
+ position: absolute;
343
+ left: 50%;
344
+ top: 18px;
345
+ bottom: 18px;
346
+ width: 2px;
347
+ transform: translateX(-50%);
348
+ background: rgba(0, 0, 0, 0.2);
349
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
350
+ z-index: 5;
351
+ pointer-events: none;
352
+ transition: opacity 0.3s ease;
353
+
354
+ &::before {
355
+ content: "";
356
+ position: absolute;
357
+ left: -4px;
358
+ top: 0;
359
+ bottom: 0;
360
+ width: 10px;
361
+ background: linear-gradient(to right, transparent, rgba(0, 0, 0, 0.15), transparent);
362
+ }
363
+ }
364
+ }
365
+
366
+ .dfb-cover {
367
+ width: 100%;
368
+ height: 100%;
369
+ display: grid;
370
+ place-items: center;
371
+ background: #9F7D4E;
372
+ color: #111;
373
+ font-size: 46px;
374
+ font-weight: 800;
375
+ letter-spacing: 8px;
376
+ border: 3px solid rgba(0, 0, 0, 0.55);
377
+ }
378
+
379
+
380
+
381
+
382
+ .export-modal {
383
+ .ant-modal-content {
384
+ border-radius: 8px;
385
+ padding: 24px;
386
+ }
387
+ .export-radio {
388
+ .ant-radio-wrapper {
389
+ padding: 8px 0;
390
+ }
391
+ }
392
+ }
393
+
394
+ .archive-cover {
395
+ width: 100%;
396
+ height: 100%;
397
+ background: #9F7D4E; // 棕黄色背景
398
+ display: flex;
399
+ align-items: center;
400
+ justify-content: center;
401
+ color: #000;
402
+ font-family: "SimSun", "STSong", serif;
403
+ padding: 40px;
404
+ box-sizing: border-box;
405
+
406
+ &__outer-border {
407
+ border: 5px solid #000;
408
+ width: 100%;
409
+ height: 100%;
410
+ padding: 4px;
411
+ box-sizing: border-box;
412
+ display: flex;
413
+ }
414
+
415
+ &__inner {
416
+ border: 1px solid #000;
417
+ width: 100%;
418
+ height: 100%;
419
+ padding: 20px 20px;
420
+ box-sizing: border-box;
421
+ display: flex;
422
+ flex-direction: column;
423
+ align-items: center;
424
+ background: transparent;
425
+ }
426
+
427
+ &__company {
428
+ font-size: 26px;
429
+ font-weight: bold;
430
+ margin-top: 10px;
431
+ margin-bottom: 30px;
432
+ letter-spacing: 4px;
433
+ text-align: center;
434
+ }
435
+
436
+ &__title {
437
+ font-size: 42px;
438
+ font-weight: 900;
439
+ margin-bottom: 22px;
440
+ letter-spacing: 16px;
441
+ text-align: center;
442
+ line-height: 1;
443
+ }
444
+
445
+ &__table {
446
+ width: 100%;
447
+ border-collapse: collapse;
448
+ border: 2px solid #000;
449
+ margin-bottom: 10px;
450
+
451
+ td {
452
+ border: 1.5px solid #000;
453
+ height: 30px;
454
+ padding: 4px 12px;
455
+ vertical-align: middle;
456
+ text-align: center;
457
+ font-size: 16px;
458
+ font-weight: 600;
459
+
460
+ &.label {
461
+ width: 120px;
462
+ background: rgba(0, 0, 0, 0.04);
463
+ font-weight: 900;
464
+ }
465
+
466
+ &.value {
467
+ text-align: center;
468
+ }
469
+
470
+ &.tall-row {
471
+ height: 100px;
472
+ line-height: 1.4;
473
+ padding: 10px 15px;
474
+ }
475
+ }
476
+ }
477
+
478
+ &__stats-row {
479
+ height: 54px !important;
480
+
481
+ .stats-content {
482
+ display: flex;
483
+ justify-content: center;
484
+ align-items: center;
485
+ width: 100%;
486
+ font-size: 20px;
487
+ font-weight: 700;
488
+ gap: 30px;
489
+
490
+ .num {
491
+ font-family: "Times New Roman", serif;
492
+ font-size: 24px;
493
+ margin: 0 5px;
494
+ min-width: 30px;
495
+ display: inline-block;
496
+ text-align: center;
497
+ border-bottom: none; // 如果需要下划线可以加,但图片里没有
498
+ }
499
+ }
500
+ }
501
+ }
502
+
503
+ // 项目模式封面样式
504
+ .project-cover-container {
505
+ // position: absolute;
506
+ // left: 15px;
507
+ // top: 0px;
508
+ // width: calc(100% - 15px);
509
+ width: 100%;
510
+ height: 100%;
511
+ z-index: 20;
512
+ box-sizing: border-box;
513
+ display: flex;
514
+ flex-direction: column;
515
+ font-family: "SimSun", "STSong", serif;
516
+ padding: 30px;
517
+
518
+ // 移除 react-pageflip 默认添加的样式影响
519
+ &.stf__item {
520
+ background-color: transparent !important;
521
+ box-shadow: none !important;
522
+ &.--hard, &.--soft, &.--simple, &.--right {
523
+ background-color: transparent !important;
524
+ }
525
+ }
526
+
527
+ .project-cover-border-outer {
528
+ border: 5px solid #000;
529
+ padding: 5px;
530
+ height: 100%;
531
+ box-sizing: border-box;
532
+ }
533
+
534
+ .project-cover-border-inner {
535
+ border: 2px solid #000;
536
+ height: 100%;
537
+ display: flex;
538
+ flex-direction: column;
539
+ box-sizing: border-box;
540
+ }
541
+
542
+ .project-cover-header {
543
+ text-align: center;
544
+ color: #000;
545
+ padding: 8px 0;
546
+
547
+ .project-cover-title {
548
+ font-size: 54px;
549
+ margin: 0;
550
+ font-weight: 900;
551
+ letter-spacing: 8px;
552
+ }
553
+ }
554
+
555
+ .project-cover-stats-row {
556
+ display: flex;
557
+ border-bottom: 1px solid #000;
558
+ border-top: 1px solid #000;
559
+ margin-top: -1px;
560
+
561
+ .stat-cell-label {
562
+ flex: 1;
563
+ text-align: center;
564
+ padding: 8px;
565
+ border-right: 1px solid #000;
566
+ display: flex;
567
+ align-items: center;
568
+ justify-content: center;
569
+ gap: 8px;
570
+ }
571
+
572
+ .stat-cell-value {
573
+ flex: 1;
574
+ text-align: center;
575
+ padding: 8px;
576
+ border-right: 1px solid #000;
577
+ font-family: "Times New Roman", serif;
578
+ font-size: 18px;
579
+ font-weight: bold;
580
+
581
+ &:last-child {
582
+ border-right: none;
583
+ }
584
+ }
585
+ }
586
+
587
+ .project-cover-details {
588
+ // flex: 1;
589
+ display: flex;
590
+ flex-direction: column;
591
+
592
+ .detail-row {
593
+ display: flex;
594
+ border-bottom: 1px solid #000;
595
+
596
+ .detail-label {
597
+ width: 100px;
598
+ padding: 8px;
599
+ font-weight: bold;
600
+ border-right: 1px solid #000;
601
+ }
602
+
603
+ .detail-value {
604
+ flex: 1;
605
+ padding: 8px;
606
+ font-weight: 600;
607
+ }
608
+ }
609
+ }
610
+
611
+ .project-cover-footer {
612
+ .footer-row {
613
+ display: flex;
614
+ border-bottom: 1px solid #000;
615
+
616
+ .footer-cell {
617
+ flex: 1;
618
+ text-align: center;
619
+ padding: 10px;
620
+ border-right: 1px solid #000;
621
+ font-weight: bold;
622
+ display: flex;
623
+ align-items: center;
624
+ justify-content: center;
625
+ font-size: 16px;
626
+
627
+ &:last-child {
628
+ border-right: none;
629
+ }
630
+ }
631
+
632
+ &.no-bottom-border {
633
+ border-bottom: none;
634
+ }
635
+ }
636
+ }
637
+ }
@@ -0,0 +1,6 @@
1
+ import type { BuiltPage, PdfDocumentLike } from './types';
2
+ export declare function printArchiveAsPdf(params: {
3
+ pages: BuiltPage[];
4
+ getDocument: (path: string) => Promise<PdfDocumentLike>;
5
+ scale?: number;
6
+ }): Promise<void>;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.printArchiveAsPdf = printArchiveAsPdf;
7
+ var _exportPdf = require("./exportPdf");
8
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
9
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
10
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
11
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
12
+ function printArchiveAsPdf(_x) {
13
+ return _printArchiveAsPdf.apply(this, arguments);
14
+ }
15
+ function _printArchiveAsPdf() {
16
+ _printArchiveAsPdf = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
17
+ var blob, url, iframe;
18
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
19
+ while (1) switch (_context.prev = _context.next) {
20
+ case 0:
21
+ _context.next = 2;
22
+ return (0, _exportPdf.buildArchivePdfBlob)(params);
23
+ case 2:
24
+ blob = _context.sent;
25
+ url = URL.createObjectURL(blob);
26
+ iframe = document.createElement('iframe');
27
+ iframe.style.position = 'fixed';
28
+ iframe.style.right = '0';
29
+ iframe.style.bottom = '0';
30
+ iframe.style.width = '0';
31
+ iframe.style.height = '0';
32
+ iframe.style.border = '0';
33
+ iframe.src = url;
34
+ document.body.appendChild(iframe);
35
+ iframe.onload = function () {
36
+ var _iframe$contentWindow, _iframe$contentWindow2;
37
+ (_iframe$contentWindow = iframe.contentWindow) === null || _iframe$contentWindow === void 0 || _iframe$contentWindow.focus();
38
+ (_iframe$contentWindow2 = iframe.contentWindow) === null || _iframe$contentWindow2 === void 0 || _iframe$contentWindow2.print();
39
+ setTimeout(function () {
40
+ URL.revokeObjectURL(url);
41
+ iframe.remove();
42
+ }, 1000);
43
+ };
44
+ case 14:
45
+ case "end":
46
+ return _context.stop();
47
+ }
48
+ }, _callee);
49
+ }));
50
+ return _printArchiveAsPdf.apply(this, arguments);
51
+ }