@cecee/document-flip-book 1.0.17 → 1.0.18

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 (75) hide show
  1. package/LICENSE +15 -0
  2. package/README.md +83 -0
  3. package/dist/cjs/AccountingBook/index.d.ts +3 -0
  4. package/dist/cjs/AccountingBook/index.js +19 -0
  5. package/dist/cjs/{ArchiveCover.js → DocumentFlipBook/ArchiveCover.js} +23 -3
  6. package/dist/cjs/{ExportModal.js → DocumentFlipBook/ExportModal.js} +1 -1
  7. package/dist/cjs/{ProjectCover.js → DocumentFlipBook/ProjectCover.js} +23 -3
  8. package/dist/cjs/{exportHtml.d.ts → DocumentFlipBook/exportHtml.d.ts} +3 -3
  9. package/dist/cjs/{exportHtml.js → DocumentFlipBook/exportHtml.js} +104 -48
  10. package/dist/cjs/{exportPdf.d.ts → DocumentFlipBook/exportPdf.d.ts} +2 -0
  11. package/dist/cjs/{exportPdf.js → DocumentFlipBook/exportPdf.js} +17 -6
  12. package/dist/cjs/{globalCache.d.ts → DocumentFlipBook/globalCache.d.ts} +2 -1
  13. package/dist/cjs/DocumentFlipBook/images/Clip_1.svg +97 -0
  14. package/dist/cjs/DocumentFlipBook/images/Clip_2.svg +1114 -0
  15. package/dist/cjs/DocumentFlipBook/images/Inside.svg +10 -0
  16. package/dist/cjs/DocumentFlipBook/images/book.svg +1 -0
  17. package/dist/cjs/DocumentFlipBook/images/coverSpine.svg +4 -0
  18. package/dist/{esm/DocumentFlipBook.d.ts → cjs/DocumentFlipBook/index.d.ts} +2 -0
  19. package/dist/cjs/{DocumentFlipBook.js → DocumentFlipBook/index.js} +116 -22
  20. package/dist/cjs/{index.less → DocumentFlipBook/index.less} +193 -78
  21. package/dist/cjs/{printPdf.d.ts → DocumentFlipBook/printPdf.d.ts} +1 -0
  22. package/dist/cjs/{utils.d.ts → DocumentFlipBook/utils.d.ts} +2 -1
  23. package/dist/cjs/{utils.js → DocumentFlipBook/utils.js} +4 -1
  24. package/dist/cjs/index.d.ts +3 -3
  25. package/dist/cjs/index.js +10 -3
  26. package/dist/esm/AccountingBook/index.d.ts +3 -0
  27. package/dist/esm/AccountingBook/index.js +13 -0
  28. package/dist/esm/{ArchiveCover.js → DocumentFlipBook/ArchiveCover.js} +23 -3
  29. package/dist/esm/{ExportModal.js → DocumentFlipBook/ExportModal.js} +1 -1
  30. package/dist/esm/{ProjectCover.js → DocumentFlipBook/ProjectCover.js} +23 -3
  31. package/dist/esm/{exportHtml.d.ts → DocumentFlipBook/exportHtml.d.ts} +3 -3
  32. package/dist/esm/{exportHtml.js → DocumentFlipBook/exportHtml.js} +103 -47
  33. package/dist/esm/{exportPdf.d.ts → DocumentFlipBook/exportPdf.d.ts} +2 -0
  34. package/dist/esm/{exportPdf.js → DocumentFlipBook/exportPdf.js} +17 -6
  35. package/dist/esm/{globalCache.d.ts → DocumentFlipBook/globalCache.d.ts} +2 -1
  36. package/dist/esm/DocumentFlipBook/images/Clip_1.svg +97 -0
  37. package/dist/esm/DocumentFlipBook/images/Clip_2.svg +1114 -0
  38. package/dist/esm/DocumentFlipBook/images/Inside.svg +10 -0
  39. package/dist/esm/DocumentFlipBook/images/book.svg +1 -0
  40. package/dist/esm/DocumentFlipBook/images/coverSpine.svg +4 -0
  41. package/dist/{cjs/DocumentFlipBook.d.ts → esm/DocumentFlipBook/index.d.ts} +2 -0
  42. package/dist/esm/{DocumentFlipBook.js → DocumentFlipBook/index.js} +116 -22
  43. package/dist/esm/{index.less → DocumentFlipBook/index.less} +193 -78
  44. package/dist/esm/{printPdf.d.ts → DocumentFlipBook/printPdf.d.ts} +1 -0
  45. package/dist/esm/{utils.d.ts → DocumentFlipBook/utils.d.ts} +2 -1
  46. package/dist/esm/{utils.js → DocumentFlipBook/utils.js} +4 -1
  47. package/dist/esm/index.d.ts +3 -3
  48. package/dist/esm/index.js +5 -3
  49. package/package.json +6 -1
  50. /package/dist/cjs/{ArchiveCover.d.ts → DocumentFlipBook/ArchiveCover.d.ts} +0 -0
  51. /package/dist/cjs/{ExportModal.d.ts → DocumentFlipBook/ExportModal.d.ts} +0 -0
  52. /package/dist/cjs/{HeaderBar.d.ts → DocumentFlipBook/HeaderBar.d.ts} +0 -0
  53. /package/dist/cjs/{HeaderBar.js → DocumentFlipBook/HeaderBar.js} +0 -0
  54. /package/dist/cjs/{PdfPage.d.ts → DocumentFlipBook/PdfPage.d.ts} +0 -0
  55. /package/dist/cjs/{PdfPage.js → DocumentFlipBook/PdfPage.js} +0 -0
  56. /package/dist/cjs/{ProjectCover.d.ts → DocumentFlipBook/ProjectCover.d.ts} +0 -0
  57. /package/dist/cjs/{SideTabs.d.ts → DocumentFlipBook/SideTabs.d.ts} +0 -0
  58. /package/dist/cjs/{SideTabs.js → DocumentFlipBook/SideTabs.js} +0 -0
  59. /package/dist/cjs/{globalCache.js → DocumentFlipBook/globalCache.js} +0 -0
  60. /package/dist/cjs/{printPdf.js → DocumentFlipBook/printPdf.js} +0 -0
  61. /package/dist/cjs/{types.d.ts → DocumentFlipBook/types.d.ts} +0 -0
  62. /package/dist/cjs/{types.js → DocumentFlipBook/types.js} +0 -0
  63. /package/dist/esm/{ArchiveCover.d.ts → DocumentFlipBook/ArchiveCover.d.ts} +0 -0
  64. /package/dist/esm/{ExportModal.d.ts → DocumentFlipBook/ExportModal.d.ts} +0 -0
  65. /package/dist/esm/{HeaderBar.d.ts → DocumentFlipBook/HeaderBar.d.ts} +0 -0
  66. /package/dist/esm/{HeaderBar.js → DocumentFlipBook/HeaderBar.js} +0 -0
  67. /package/dist/esm/{PdfPage.d.ts → DocumentFlipBook/PdfPage.d.ts} +0 -0
  68. /package/dist/esm/{PdfPage.js → DocumentFlipBook/PdfPage.js} +0 -0
  69. /package/dist/esm/{ProjectCover.d.ts → DocumentFlipBook/ProjectCover.d.ts} +0 -0
  70. /package/dist/esm/{SideTabs.d.ts → DocumentFlipBook/SideTabs.d.ts} +0 -0
  71. /package/dist/esm/{SideTabs.js → DocumentFlipBook/SideTabs.js} +0 -0
  72. /package/dist/esm/{globalCache.js → DocumentFlipBook/globalCache.js} +0 -0
  73. /package/dist/esm/{printPdf.js → DocumentFlipBook/printPdf.js} +0 -0
  74. /package/dist/esm/{types.d.ts → DocumentFlipBook/types.d.ts} +0 -0
  75. /package/dist/esm/{types.js → DocumentFlipBook/types.js} +0 -0
@@ -0,0 +1,10 @@
1
+ <svg width="34" height="825" viewBox="0 0 34 825" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M0 0L34 8V817L0 825V0Z" fill="#3AB5EA"/>
3
+ <path d="M0 0L34 8V817L0 825V0Z" fill="url(#paint0_linear_28900_8954)" fill-opacity="0.53" style="mix-blend-mode:multiply"/>
4
+ <defs>
5
+ <linearGradient id="paint0_linear_28900_8954" x1="0" y1="412.5" x2="34" y2="412.5" gradientUnits="userSpaceOnUse">
6
+ <stop offset="0.02" stop-color="#007DB3"/>
7
+ <stop offset="0.995" stop-color="#00354B"/>
8
+ </linearGradient>
9
+ </defs>
10
+ </svg>
@@ -0,0 +1 @@
1
+ <?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1781057525113" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="11598" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M256 0C150 0 64 86 64 192v640c0 106 86 192 192 192h640c35.4 0 64-28.6 64-64s-28.6-64-64-64v-128c35.4 0 64-28.6 64-64V64c0-35.4-28.6-64-64-64H256z m0 768h512v128H256c-35.4 0-64-28.6-64-64s28.6-64 64-64z m64-480c0-17.6 14.4-32 32-32h384c17.6 0 32 14.4 32 32s-14.4 32-32 32H352c-17.6 0-32-14.4-32-32z m32 96h384c17.6 0 32 14.4 32 32s-14.4 32-32 32H352c-17.6 0-32-14.4-32-32s14.4-32 32-32z" p-id="11599" fill="#64c3f5"></path></svg>
@@ -0,0 +1,4 @@
1
+ <svg width="17" height="825" viewBox="0 0 17 825" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M0 30L17 0V825L0 789V30Z" fill="#22A3DA"/>
3
+ <path d="M4 43.8636L13 29.5V802L4 782.364L4 43.8636Z" fill="#DEF0FA"/>
4
+ </svg>
@@ -7,6 +7,7 @@ interface DocumentFlipBookProps {
7
7
  id?: string;
8
8
  themeColor?: string;
9
9
  documentInfo: {
10
+ fd: string;
10
11
  com00cs?: any[];
11
12
  attachments?: any[];
12
13
  edr04bs?: any[];
@@ -27,6 +28,7 @@ interface DocumentFlipBookProps {
27
28
  onSearch?: (v: string) => void;
28
29
  showHeaderBar?: boolean;
29
30
  pdfWorkerSrc?: string;
31
+ printType?: 'A4' | 'A5';
30
32
  }
31
33
  declare const DocumentFlipBook: React.FC<DocumentFlipBookProps>;
32
34
  export default DocumentFlipBook;
@@ -32,7 +32,7 @@ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructur
32
32
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
33
33
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
34
34
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
35
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } // 引入封面组件
35
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
36
36
  var DocumentFlipBook = function DocumentFlipBook(_ref) {
37
37
  var _ref$mode = _ref.mode,
38
38
  initialMode = _ref$mode === void 0 ? 'page' : _ref$mode,
@@ -48,7 +48,9 @@ var DocumentFlipBook = function DocumentFlipBook(_ref) {
48
48
  onSearch = _ref$onSearch === void 0 ? function () {} : _ref$onSearch,
49
49
  _ref$showHeaderBar = _ref.showHeaderBar,
50
50
  showHeaderBar = _ref$showHeaderBar === void 0 ? true : _ref$showHeaderBar,
51
- pdfWorkerSrc = _ref.pdfWorkerSrc;
51
+ pdfWorkerSrc = _ref.pdfWorkerSrc,
52
+ _ref$printType = _ref.printType,
53
+ printType = _ref$printType === void 0 ? 'A4' : _ref$printType;
52
54
  var flipRef = (0, _react.useRef)(null);
53
55
  console.log(documentInfo);
54
56
 
@@ -76,6 +78,10 @@ var DocumentFlipBook = function DocumentFlipBook(_ref) {
76
78
  _useState10 = _slicedToArray(_useState9, 2),
77
79
  mode = _useState10[0],
78
80
  setMode = _useState10[1];
81
+ var _useState11 = (0, _react.useState)(0),
82
+ _useState12 = _slicedToArray(_useState11, 2),
83
+ refreshKey = _useState12[0],
84
+ setRefreshKey = _useState12[1];
79
85
  var isFirstLoadOfDocument = (0, _react.useRef)(true);
80
86
 
81
87
  // 内部处理全屏切换
@@ -96,6 +102,14 @@ var DocumentFlipBook = function DocumentFlipBook(_ref) {
96
102
  window.history.back();
97
103
  }
98
104
  }, [onBack]);
105
+
106
+ // 计算加深的主题色,用于书本右侧阴影
107
+ var themeDarkColor = (0, _react.useMemo)(function () {
108
+ if (!themeColor) return '#8b6d44';
109
+ // 简单的加深逻辑:使用 CSS filter 会更方便,但在 linear-gradient 中需要显式颜色
110
+ // 这里我们直接将变量传给 CSS 变量,让 CSS 处理或在 TS 中简单处理
111
+ return themeColor; // 暂时传递原始色,稍后在 CSS 中通过 mix-blend-mode 处理更佳
112
+ }, [themeColor]);
99
113
  var archiveId = (0, _react.useMemo)(function () {
100
114
  return id || (documentInfo === null || documentInfo === void 0 ? void 0 : documentInfo.id) || (documentInfo === null || documentInfo === void 0 ? void 0 : documentInfo.code);
101
115
  }, [id, documentInfo]);
@@ -301,7 +315,7 @@ var DocumentFlipBook = function DocumentFlipBook(_ref) {
301
315
  return function () {
302
316
  isMounted = false;
303
317
  };
304
- }, [documentInfo, activeTab, id]);
318
+ }, [documentInfo, activeTab, id, refreshKey]);
305
319
  var total = (0, _react.useMemo)(function () {
306
320
  return 1 + pages.length;
307
321
  }, [pages]);
@@ -324,6 +338,10 @@ var DocumentFlipBook = function DocumentFlipBook(_ref) {
324
338
  }, [total]);
325
339
  var handleRefresh = (0, _react.useCallback)(function () {
326
340
  isFirstLoadOfDocument.current = true; // 标记为首次加载,使 init 逻辑停留在封面 (第 0 页)
341
+ _globalCache.globalPdfCache.clearAll(); // 清理所有 PDF 缓存
342
+ setRefreshKey(function (prev) {
343
+ return prev + 1;
344
+ }); // 增加 refreshKey 以触发 useEffect 重新执行初始化
327
345
  setActiveTab('');
328
346
  setCurrent(0);
329
347
  if (flipRef.current) {
@@ -337,7 +355,7 @@ var DocumentFlipBook = function DocumentFlipBook(_ref) {
337
355
  var handleDownload = (0, _react.useCallback)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
338
356
  var type,
339
357
  _yield$import,
340
- exportArchivePagesToHtml,
358
+ exportArchivePagesToEpub,
341
359
  hide,
342
360
  filename,
343
361
  _yield$import2,
@@ -357,12 +375,12 @@ var DocumentFlipBook = function DocumentFlipBook(_ref) {
357
375
  });
358
376
  case 4:
359
377
  _yield$import = _context2.sent;
360
- exportArchivePagesToHtml = _yield$import.exportArchivePagesToHtml;
378
+ exportArchivePagesToEpub = _yield$import.exportArchivePagesToEpub;
361
379
  _context2.next = 8;
362
- return exportArchivePagesToHtml({
380
+ return exportArchivePagesToEpub({
363
381
  pages: pages,
364
- filename: "\u6863\u6848\u7FFB\u4E66-".concat(new Date().toISOString().slice(0, 10)),
365
- title: title || '档案翻书',
382
+ filename: "".concat((documentInfo === null || documentInfo === void 0 ? void 0 : documentInfo.fd) || '电子档案书', ".epub"),
383
+ title: (documentInfo === null || documentInfo === void 0 ? void 0 : documentInfo.fd) || '电子档案书',
366
384
  getDocument: _globalCache.globalPdfCache.getDocument,
367
385
  coverInfo: {
368
386
  data: documentInfo === null || documentInfo === void 0 ? void 0 : documentInfo.acc51c,
@@ -390,7 +408,8 @@ var DocumentFlipBook = function DocumentFlipBook(_ref) {
390
408
  pages: pages,
391
409
  getDocument: _globalCache.globalPdfCache.getDocument,
392
410
  filename: filename,
393
- scale: 2
411
+ scale: 2,
412
+ printType: printType
394
413
  });
395
414
  case 18:
396
415
  _antd.message.success('已开始下载');
@@ -409,7 +428,7 @@ var DocumentFlipBook = function DocumentFlipBook(_ref) {
409
428
  return _context2.stop();
410
429
  }
411
430
  }, _callee2, null, [[10, 21, 24, 27]]);
412
- })), [pages, title]);
431
+ })), [pages, title, printType]);
413
432
  var handlePrint = (0, _react.useCallback)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
414
433
  var hide, _yield$import3, printArchiveAsPdf;
415
434
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
@@ -428,7 +447,8 @@ var DocumentFlipBook = function DocumentFlipBook(_ref) {
428
447
  return printArchiveAsPdf({
429
448
  pages: pages,
430
449
  getDocument: _globalCache.globalPdfCache.getDocument,
431
- scale: 2
450
+ scale: 2,
451
+ printType: printType
432
452
  });
433
453
  case 8:
434
454
  _context3.next = 13;
@@ -446,7 +466,7 @@ var DocumentFlipBook = function DocumentFlipBook(_ref) {
446
466
  return _context3.stop();
447
467
  }
448
468
  }, _callee3, null, [[1, 10, 13, 16]]);
449
- })), [pages]);
469
+ })), [pages, printType]);
450
470
 
451
471
  // 提取为独立的渲染函数,增加懒加载逻辑
452
472
  var renderContent = (0, _react.useCallback)(function (idx) {
@@ -531,6 +551,10 @@ var DocumentFlipBook = function DocumentFlipBook(_ref) {
531
551
  }, [pages, documentInfo, current, themeColor]);
532
552
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
533
553
  className: "dfb-root ".concat(mode === 'modal' ? 'is-fullscreen-modal' : ''),
554
+ style: {
555
+ '--dfb-theme-color': themeColor,
556
+ '--dfb-theme-dark-color': themeDarkColor
557
+ },
534
558
  children: [showHeaderBar && /*#__PURE__*/(0, _jsxRuntime.jsx)(_HeaderBar.default, {
535
559
  mode: mode,
536
560
  title: title,
@@ -552,19 +576,63 @@ var DocumentFlipBook = function DocumentFlipBook(_ref) {
552
576
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Spin, {
553
577
  size: "large",
554
578
  spinning: loading,
555
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
579
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
556
580
  className: "dfb-book-wrapper",
557
581
  style: {
558
582
  minHeight: _utils.VIEWPORT_HEIGHT + 40
559
583
  },
560
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
561
- className: current === 0 && !activeTab ? 'dfb-bookShell1' : 'dfb-bookShell',
584
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
585
+ className: "dfb-book-background-layer",
562
586
  style: {
563
- backgroundColor: current === 0 && !activeTab ? 'transparent' : themeColor
564
- },
565
- children: [(current > 0 || activeTab) && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
587
+ opacity: current === 0 && !activeTab ? 0 : 1
588
+ }
589
+ }), (current > 0 || activeTab) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
590
+ className: "dfb-spine-decoration-layer",
591
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
592
+ className: "dfb-inside-spine",
593
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("svg", {
594
+ width: "100%",
595
+ height: "100%",
596
+ viewBox: "0 0 34 825",
597
+ preserveAspectRatio: "none",
598
+ fill: "none",
599
+ xmlns: "http://www.w3.org/2000/svg",
600
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
601
+ d: "M0 0L34 8V817L0 825V0Z",
602
+ fill: themeColor
603
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
604
+ d: "M0 0L34 8V817L0 825V0Z",
605
+ fill: "url(#paint0_linear_inside)",
606
+ fillOpacity: "0.53",
607
+ style: {
608
+ mixBlendMode: 'multiply'
609
+ }
610
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("defs", {
611
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("linearGradient", {
612
+ id: "paint0_linear_inside",
613
+ x1: "0",
614
+ y1: "412.5",
615
+ x2: "34",
616
+ y2: "412.5",
617
+ gradientUnits: "userSpaceOnUse",
618
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("stop", {
619
+ offset: "0.02",
620
+ stopColor: "#000",
621
+ stopOpacity: "0.6"
622
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("stop", {
623
+ offset: "0.995",
624
+ stopColor: "#000",
625
+ stopOpacity: "0.2"
626
+ })]
627
+ })
628
+ })]
629
+ })
630
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
566
631
  className: "dfb-book-spine"
567
- }), (pages === null || pages === void 0 ? void 0 : pages.length) > 0 && tabItems.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_SideTabs.default, {
632
+ })]
633
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
634
+ className: current === 0 ? '' : 'dfb-book-content-layer',
635
+ children: [(pages === null || pages === void 0 ? void 0 : pages.length) > 0 && tabItems.length > 0 && !loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_SideTabs.default, {
568
636
  items: tabItems,
569
637
  activeKey: activeTab,
570
638
  className: current === 0 ? 'is-on-cover' : !activeTab ? 'is-on-activeTab' : '',
@@ -623,7 +691,22 @@ var DocumentFlipBook = function DocumentFlipBook(_ref) {
623
691
  height: '100%',
624
692
  background: '#fff'
625
693
  },
626
- children: renderContent(i)
694
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
695
+ style: {
696
+ position: 'relative',
697
+ width: '100%',
698
+ height: '100%'
699
+ },
700
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
701
+ className: "dfb-book-thickness-left-1"
702
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
703
+ className: "dfb-book-thickness-left-2"
704
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
705
+ className: "dfb-book-thickness-right-1"
706
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
707
+ className: "dfb-book-thickness-right-2"
708
+ }), renderContent(i)]
709
+ })
627
710
  }, i);
628
711
  })
629
712
  }, "".concat(archiveId, "-").concat(activeTab)), !loading && pages.length === 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
@@ -634,10 +717,21 @@ var DocumentFlipBook = function DocumentFlipBook(_ref) {
634
717
  margin: 'auto',
635
718
  background: '#fff'
636
719
  },
637
- children: renderContent(0)
720
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
721
+ style: {
722
+ position: 'relative',
723
+ width: '100%',
724
+ height: '100%'
725
+ },
726
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
727
+ className: "dfb-book-thickness-right-1"
728
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
729
+ className: "dfb-book-thickness-right-2"
730
+ }), renderContent(0)]
731
+ })
638
732
  })]
639
733
  })]
640
- })
734
+ })]
641
735
  })
642
736
  })
643
737
  })]
@@ -31,42 +31,88 @@
31
31
  .book-page {
32
32
  width: 100%;
33
33
  height: 100%;
34
- background: #9F7D4E;
34
+ background: var(--dfb-theme-color, #9F7D4E);
35
35
  padding: 22px;
36
36
  }
37
37
 
38
38
  .book-view {
39
- box-shadow: 0 0 18px rgba(0, 0, 0, 0.18);
39
+ // box-shadow: 0 0 18px rgba(0, 0, 0, 0.18);
40
+ // overflow: hidden;
40
41
  position: relative;
41
- overflow: hidden;
42
+ z-index: 10;
43
+ overflow: visible; // 显式设置为 visible 以显示侧边厚度装饰
44
+ background: transparent; // 改为透明,避免遮挡背景层或产生白色边框
42
45
 
43
- // 页面内侧阴影(靠近中缝处的深度感)
44
- &::before {
45
- content: "";
46
+ // 书本左侧厚度 1
47
+ .dfb-book-thickness-left-1 {
46
48
  position: absolute;
47
49
  top: 0;
48
- bottom: 0;
50
+ left: -4px;
51
+ width: 8px;
52
+ height: 100%;
53
+ background: linear-gradient(to right, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.5) 50%, rgba(255, 255, 255, 0.3));
54
+ border-radius: 2px;
55
+ z-index: 20;
56
+ box-shadow: rgba(255, 255, 255, 0.6) 0px 0px 6px inset;
57
+ pointer-events: none;
58
+ display: none; // 默认隐藏,由 nth-child 控制显示
59
+ }
60
+
61
+ // 书本左侧厚度 2
62
+ .dfb-book-thickness-left-2 {
63
+ position: absolute;
64
+ top: 0;
65
+ left: -10px;
49
66
  width: 20px;
50
- z-index: 5;
67
+ height: 100%;
68
+ background: linear-gradient(to right, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.4) 50%, rgba(255, 255, 255, 0.2));
69
+ z-index: 14;
51
70
  pointer-events: none;
52
- transition: opacity 0.3s ease;
71
+ display: none; // 默认隐藏
53
72
  }
54
73
 
55
- // 偶数页(通常是右页)阴影在左侧
56
- &:nth-child(even)::before {
57
- left: 0;
58
- background: linear-gradient(to right, rgba(0, 0, 0, 0.12) 0%, rgba(0, 0, 0, 0.05) 40%, transparent 100%);
74
+ // 书本右侧厚度 1
75
+ .dfb-book-thickness-right-1 {
76
+ position: absolute;
77
+ top: 0;
78
+ right: -4px;
79
+ width: 8px;
80
+ height: 100%;
81
+ background: linear-gradient(to right, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.5) 50%, rgba(255, 255, 255, 0.3));
82
+ border-radius: 2px;
83
+ z-index: 15;
84
+ box-shadow: rgba(255, 255, 255, 0.6) 0px 0px 6px inset;
85
+ pointer-events: none;
86
+ display: none; // 默认隐藏
59
87
  }
60
88
 
61
- // 奇数页(通常是左页)阴影在右侧
62
- &:nth-child(odd)::before {
63
- right: 0;
64
- background: linear-gradient(to left, rgba(0, 0, 0, 0.12) 0%, rgba(0, 0, 0, 0.05) 40%, transparent 100%);
89
+ // 书本右侧厚度 2
90
+ .dfb-book-thickness-right-2 {
91
+ position: absolute;
92
+ top: 0;
93
+ right: -10px;
94
+ width: 20px;
95
+ height: 100%;
96
+ background: linear-gradient(to left, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.4) 50%, rgba(255, 255, 255, 0.2));
97
+ z-index: 14;
98
+ pointer-events: none;
99
+ display: none; // 默认隐藏
65
100
  }
66
101
 
67
- // 封面页(第一页)通常不需要这种内部阴影,或者阴影较弱
68
- &:first-child::before {
69
- opacity: 0.3;
102
+ // 偶数页(第 2, 4, 6... 个子元素,对应 Page 1, 3, 5...)是左页 -> 显示左侧厚度
103
+ &:nth-child(even) {
104
+ .dfb-book-thickness-left-1,
105
+ .dfb-book-thickness-left-2 {
106
+ display: block;
107
+ }
108
+ }
109
+
110
+ // 奇数页(第 1, 3, 5... 个子元素,对应 Page 0, 2, 4...)是右页 -> 显示右侧厚度
111
+ &:nth-child(odd) {
112
+ .dfb-book-thickness-right-1,
113
+ .dfb-book-thickness-right-2 {
114
+ display: block;
115
+ }
70
116
  }
71
117
  }
72
118
 
@@ -75,8 +121,10 @@
75
121
  }
76
122
 
77
123
  .dfb-HTMLFlipBook {
78
- overflow: hidden;
79
- background: #fff;
124
+ position: relative;
125
+ z-index: 10;
126
+ overflow: visible; // 显式设置为 visible 以显示侧边厚度装饰
127
+ background: transparent; // 改为透明,避免遮挡背景层或产生白色边框
80
128
  }
81
129
 
82
130
  .dfb-root {
@@ -261,7 +309,7 @@
261
309
  display: flex;
262
310
  flex-direction: column;
263
311
  gap: 6px; //
264
- z-index: 10;
312
+ z-index: 20;
265
313
  transition: all 0.3s ease;
266
314
 
267
315
  &.is-on-cover {
@@ -341,55 +389,105 @@
341
389
  min-width: 300px;
342
390
  }
343
391
 
344
- .dfb-bookShell1 {
345
- position: relative;
346
- padding: 18px 0 18px 54px;
347
- background: transparent;
348
- transition: background-color 0.3s ease;
392
+ // 方法三:背景层样式
393
+ .dfb-book-background-layer {
394
+ position: absolute;
395
+ top: 0;
396
+ left: 0;
397
+ right: 0;
398
+ bottom: 0;
399
+ padding: 18px 54px;
400
+ z-index: 1;
401
+ transition: all 0.3s ease;
402
+ pointer-events: none;
403
+ overflow: hidden;
404
+ /* 确保伪元素不会超出容器 */
405
+ }
406
+
407
+ /* 左侧较高的背景块 */
408
+ .dfb-book-background-layer::before {
409
+ content: "";
410
+ position: absolute;
411
+ top: 2px;
412
+ left: -16px;
413
+ width: 50%;
414
+ /* 占据左半边 */
415
+ height: 100%;
416
+ /* 高度为100%,显得更高 */
417
+ background-color: var(--dfb-theme-color, #9F7D4E);
418
+ transition: all 0.3s ease;
419
+ }
420
+
421
+ /* 右侧较低的背景块 */
422
+ .dfb-book-background-layer::after {
423
+ content: "";
424
+ position: absolute;
425
+ top: 9px;
426
+ right: -16px;
427
+ width: 50%;
428
+ /* 占据右半边 */
429
+ height: calc(100% - 15px);
430
+ /* 高度减去顶部偏移量 */
431
+ background-color: var(--dfb-theme-color, #9F7D4E);
432
+ filter: brightness(0.85); // 自动加深,不再依赖额外的变量
433
+ opacity: 0.9;
434
+ transition: all 0.3s ease;
349
435
  }
350
436
 
351
- .dfb-bookShell {
437
+ // 方法三:内容层样式
438
+ .dfb-book-content-layer {
352
439
  position: relative;
353
- padding: 18px 54px;
354
- background: #9F7D4E;
355
- transition: background-color 0.3s ease;
440
+ z-index: 10; // 位于背景之上
441
+ padding: 18px 54px; // 保持与背景层一致的内边距
442
+ }
356
443
 
357
- &::after {
444
+ // 书脊内侧装饰 (Inside.svg)
445
+ .dfb-inside-spine {
446
+ position: absolute;
447
+ left: 50%;
448
+ top: 2px;
449
+ height: calc(100% - 1px);
450
+ bottom: 18px;
451
+ width: 34px; // 恢复为原始 SVG 宽度
452
+ transform: translateX(-50%);
453
+ z-index: 5; // 提高层级,确保在 .dfb-book-background-layer 的 linear-gradient 之上
454
+ pointer-events: none;
455
+ opacity: 1; // 增加不透明度使其更清晰
456
+ }
457
+
458
+ // 中缝装饰层(确保在中缝位置且高于内容层)
459
+ // .dfb-spine-decoration-layer {
460
+ // position: absolute;
461
+ // left: 50%;
462
+ // top: 0;
463
+ // bottom: 0;
464
+ // width: 0; // 仅作为定位参考
465
+ // z-index: 20; // 必须高于内容层 (10) 才能看到
466
+ // pointer-events: none;
467
+ // }
468
+
469
+ // 书本中缝分割线
470
+ .dfb-book-spine {
471
+ position: absolute;
472
+ left: 50%;
473
+ top: 17px;
474
+ bottom: 18px;
475
+ width: 2px;
476
+ transform: translateX(-50%);
477
+ background: rgba(0, 0, 0, 0.2);
478
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
479
+ z-index: 20;
480
+ pointer-events: none;
481
+ transition: opacity 0.3s ease;
482
+
483
+ &::before {
358
484
  content: "";
359
485
  position: absolute;
486
+ left: -4px;
360
487
  top: 0;
361
- left: 0;
362
- right: 0;
363
488
  bottom: 0;
364
- background-image: url("https://www.transparenttextures.com/patterns/leather.png");
365
- opacity: 0.1;
366
- pointer-events: none;
367
- border-radius: 8px;
368
- }
369
-
370
- // 书本中缝分割线
371
- .dfb-book-spine {
372
- position: absolute;
373
- left: 50%;
374
- top: 18px;
375
- bottom: 18px;
376
- width: 2px;
377
- transform: translateX(-50%);
378
- background: rgba(0, 0, 0, 0.2);
379
- box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
380
- z-index: 5;
381
- pointer-events: none;
382
- transition: opacity 0.3s ease;
383
-
384
- &::before {
385
- content: "";
386
- position: absolute;
387
- left: -4px;
388
- top: 0;
389
- bottom: 0;
390
- width: 10px;
391
- background: linear-gradient(to right, transparent, rgba(0, 0, 0, 0.15), transparent);
392
- }
489
+ width: 10px;
490
+ background: linear-gradient(to right, transparent, rgba(0, 0, 0, 0.15), transparent);
393
491
  }
394
492
  }
395
493
 
@@ -398,7 +496,7 @@
398
496
  height: 100%;
399
497
  display: grid;
400
498
  place-items: center;
401
- background: #9F7D4E;
499
+ background: var(--dfb-theme-color, #9F7D4E);
402
500
  color: #111;
403
501
  font-size: 46px;
404
502
  font-weight: 800;
@@ -425,14 +523,24 @@
425
523
  .archive-cover {
426
524
  width: 100%;
427
525
  height: 100%;
428
- background: #9F7D4E; // 棕黄色背景
429
526
  display: flex;
430
527
  align-items: center;
431
528
  justify-content: center;
432
529
  color: #000;
433
530
  font-family: "SimSun", "STSong", serif;
434
- padding: 40px;
531
+ padding: 40px 40px 40px 57px; // 增加左侧内边距,给背脊留出空间
435
532
  box-sizing: border-box;
533
+ position: relative; // 确保子元素绝对定位
534
+
535
+ .archive-spine {
536
+ background-color: #fff;
537
+ position: absolute;
538
+ left: 0;
539
+ top: 0;
540
+ bottom: 0;
541
+ width: 25px; // 稍微放宽一点,效果更好
542
+ z-index: 10;
543
+ }
436
544
 
437
545
  &__outer-border {
438
546
  border: 5px solid #000;
@@ -459,7 +567,7 @@
459
567
  font-size: 26px;
460
568
  font-weight: bold;
461
569
  margin-top: 10px;
462
- margin-bottom: 30px;
570
+ margin-bottom: 10px;
463
571
  letter-spacing: 4px;
464
572
  text-align: center;
465
573
  }
@@ -533,10 +641,7 @@
533
641
 
534
642
  // 项目模式封面样式
535
643
  .project-cover-container {
536
- // position: absolute;
537
- // left: 15px;
538
- // top: 0px;
539
- // width: calc(100% - 15px);
644
+ position: relative; // 确保子元素绝对定位
540
645
  width: 100%;
541
646
  height: 100%;
542
647
  z-index: 20;
@@ -544,7 +649,17 @@
544
649
  display: flex;
545
650
  flex-direction: column;
546
651
  font-family: "SimSun", "STSong", serif;
547
- padding: 30px;
652
+ padding: 30px 30px 30px 47px; // 增加左侧内边距,给背脊留出空间
653
+
654
+ .archive-spine {
655
+ background-color: #fff;
656
+ position: absolute;
657
+ left: 0;
658
+ top: 0;
659
+ bottom: 0;
660
+ width: 25px;
661
+ z-index: 10;
662
+ }
548
663
 
549
664
  // 移除 react-pageflip 默认添加的样式影响
550
665
  &.stf__item {
@@ -574,7 +689,7 @@
574
689
  box-sizing: border-box;
575
690
  }
576
691
 
577
- .project-cover-header {
692
+ .project-cover-header {
578
693
  text-align: center;
579
694
  color: #000;
580
695
  // padding: 8px 0;
@@ -599,8 +714,8 @@
599
714
  .stat-cell-label {
600
715
  flex: 1;
601
716
  text-align: center;
602
- height: 52px;
603
- line-height: 52px;
717
+ height: 42px;
718
+ line-height: 42px;
604
719
  // padding: 8px;
605
720
  border-right: 1px solid #000;
606
721
  display: flex;
@@ -612,8 +727,8 @@
612
727
  .stat-cell-value {
613
728
  flex: 1;
614
729
  text-align: center;
615
- height: 52px;
616
- line-height: 52px;
730
+ height: 42px;
731
+ line-height: 42px;
617
732
  border-right: 1px solid #000;
618
733
  font-family: "Times New Roman", serif;
619
734
  font-size: 18px;
@@ -3,4 +3,5 @@ export declare function printArchiveAsPdf(params: {
3
3
  pages: BuiltPage[];
4
4
  getDocument: (path: string) => Promise<PdfDocumentLike>;
5
5
  scale?: number;
6
+ printType?: 'A4' | 'A5';
6
7
  }): Promise<void>;