@cecee/document-flip-book 1.0.12 → 1.0.14

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.
@@ -50,7 +50,7 @@ var PdfPage = function PdfPage(_ref2) {
50
50
  var renderTask = null;
51
51
  var render = /*#__PURE__*/function () {
52
52
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
53
- var _renderTask, _page$cleanup2, pdf, page, canvas, _page$cleanup, viewport, scale, dpr, renderViewport, ctx;
53
+ var _renderTask, _page$cleanup2, pdf, page, canvas, _page$cleanup, viewport, scale, calculatedHeight, dpr, renderViewport, ctx;
54
54
  return _regeneratorRuntime().wrap(function _callee$(_context) {
55
55
  while (1) switch (_context.prev = _context.next) {
56
56
  case 0:
@@ -75,42 +75,44 @@ var PdfPage = function PdfPage(_ref2) {
75
75
  viewport = page.getViewport({
76
76
  scale: 1
77
77
  });
78
- scale = _utils.VIEWPORT_WIDTH / viewport.width;
78
+ scale = _utils.VIEWPORT_WIDTH / viewport.width; // 计算自适应高度,确保不拉伸
79
+ calculatedHeight = viewport.height * scale;
79
80
  dpr = window.devicePixelRatio || 1;
80
81
  renderViewport = page.getViewport({
81
82
  scale: scale * dpr
82
83
  });
83
84
  ctx = canvas.getContext('2d');
84
85
  if (ctx) {
85
- _context.next = 19;
86
+ _context.next = 20;
86
87
  break;
87
88
  }
88
89
  throw new Error('Canvas 上下文获取失败');
89
- case 19:
90
+ case 20:
90
91
  canvas.width = renderViewport.width;
91
92
  canvas.height = renderViewport.height;
92
- canvas.style.width = "".concat(_utils.VIEWPORT_WIDTH, "px");
93
- canvas.style.height = "".concat(_utils.HEIGHT, "px");
93
+ canvas.style.width = '100%';
94
+ canvas.style.height = '100%';
95
+ canvas.style.objectFit = 'contain';
94
96
  renderTask = page.render({
95
97
  canvasContext: ctx,
96
98
  viewport: renderViewport
97
99
  });
98
- _context.next = 26;
100
+ _context.next = 28;
99
101
  return (_renderTask = renderTask) === null || _renderTask === void 0 ? void 0 : _renderTask.promise;
100
- case 26:
102
+ case 28:
101
103
  setStatus('ready');
102
104
  (_page$cleanup2 = page.cleanup) === null || _page$cleanup2 === void 0 || _page$cleanup2.call(page);
103
- _context.next = 33;
105
+ _context.next = 35;
104
106
  break;
105
- case 30:
106
- _context.prev = 30;
107
+ case 32:
108
+ _context.prev = 32;
107
109
  _context.t0 = _context["catch"](0);
108
110
  if (!cancelled) setStatus('error');
109
- case 33:
111
+ case 35:
110
112
  case "end":
111
113
  return _context.stop();
112
114
  }
113
- }, _callee, null, [[0, 30]]);
115
+ }, _callee, null, [[0, 32]]);
114
116
  }));
115
117
  return function render() {
116
118
  return _ref3.apply(this, arguments);
@@ -11,7 +11,7 @@ var _antd = require("antd");
11
11
  var _jsxRuntime = require("react/jsx-runtime");
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
13
  var ProjectCover = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
14
- var _user$company, _info$dt, _user$info;
14
+ var _user$company, _info$edr04bs, _info$edr04bs2, _info$edr04bs3, _info$edr04bs4, _info$dt, _user$info;
15
15
  var documentInfo = _ref.documentInfo,
16
16
  _ref$themeColor = _ref.themeColor,
17
17
  themeColor = _ref$themeColor === void 0 ? '#4baae3' : _ref$themeColor;
@@ -27,6 +27,70 @@ var ProjectCover = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
27
27
  lineWidth: 2
28
28
  }
29
29
  };
30
+ var title = (info === null || info === void 0 ? void 0 : info.title) || '高企研发';
31
+ var isFourFlows = title === '四流合一档案';
32
+
33
+ // 定义统计项配置
34
+ var statsConfig = isFourFlows ? [{
35
+ label: '发票',
36
+ checked: !!(info !== null && info !== void 0 && (_info$edr04bs = info.edr04bs) !== null && _info$edr04bs !== void 0 && _info$edr04bs.length),
37
+ count: (info === null || info === void 0 || (_info$edr04bs2 = info.edr04bs) === null || _info$edr04bs2 === void 0 ? void 0 : _info$edr04bs2.length) || '-'
38
+ }, {
39
+ label: '合同',
40
+ checked: false,
41
+ count: '-'
42
+ }, {
43
+ label: '物流',
44
+ checked: false,
45
+ count: '-'
46
+ }, {
47
+ label: '钱流',
48
+ checked: false,
49
+ count: '-'
50
+ }] : [{
51
+ label: '纪要',
52
+ checked: !!(info !== null && info !== void 0 && (_info$edr04bs3 = info.edr04bs) !== null && _info$edr04bs3 !== void 0 && _info$edr04bs3.length),
53
+ count: (info === null || info === void 0 || (_info$edr04bs4 = info.edr04bs) === null || _info$edr04bs4 === void 0 ? void 0 : _info$edr04bs4.length) || '-'
54
+ }, {
55
+ label: '人员',
56
+ checked: false,
57
+ count: '1'
58
+ }, {
59
+ label: '费用',
60
+ checked: false,
61
+ count: '3'
62
+ }, {
63
+ label: '说明书',
64
+ checked: false,
65
+ count: '1'
66
+ }];
67
+
68
+ // 渲染统计行辅助函数
69
+ var renderStatsRow = function renderStatsRow(startIndex) {
70
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
71
+ className: "project-cover-stats-row",
72
+ style: startIndex > 0 ? {
73
+ borderTop: 'none'
74
+ } : {},
75
+ children: statsConfig.slice(startIndex, startIndex + 2).map(function (item, idx) {
76
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_react.default.Fragment, {
77
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
78
+ className: "stat-cell-label",
79
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_antd.ConfigProvider, {
80
+ theme: checkboxTheme,
81
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Checkbox, {
82
+ checked: item.checked,
83
+ disabled: true
84
+ }), " ", item.label]
85
+ })
86
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
87
+ className: "stat-cell-value",
88
+ children: item.count
89
+ })]
90
+ }, item.label);
91
+ })
92
+ });
93
+ };
30
94
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
31
95
  className: "project-cover-container",
32
96
  style: {
@@ -41,66 +105,9 @@ var ProjectCover = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
41
105
  className: "project-cover-header",
42
106
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("h1", {
43
107
  className: "project-cover-title",
44
- children: (info === null || info === void 0 ? void 0 : info.title) || '高企研发'
108
+ children: title
45
109
  })
46
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
47
- className: "project-cover-stats-row",
48
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
49
- className: "stat-cell-label",
50
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_antd.ConfigProvider, {
51
- theme: checkboxTheme,
52
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Checkbox, {
53
- checked: !!(info !== null && info !== void 0 && info.edr04bs && info.edr04bs.length > 0),
54
- disabled: true
55
- }), " \u7EAA\u8981"]
56
- })
57
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
58
- className: "stat-cell-value",
59
- children: info !== null && info !== void 0 && info.edr04bs && info.edr04bs.length > 0 ? info.edr04bs.length : '-'
60
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
61
- className: "stat-cell-label",
62
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_antd.ConfigProvider, {
63
- theme: checkboxTheme,
64
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Checkbox, {
65
- checked: false,
66
- disabled: true
67
- }), " \u4EBA\u5458"]
68
- })
69
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
70
- className: "stat-cell-value",
71
- children: "1"
72
- })]
73
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
74
- className: "project-cover-stats-row",
75
- style: {
76
- borderTop: 'none'
77
- },
78
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
79
- className: "stat-cell-label",
80
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_antd.ConfigProvider, {
81
- theme: checkboxTheme,
82
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Checkbox, {
83
- checked: false,
84
- disabled: true
85
- }), " \u8D39\u7528"]
86
- })
87
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
88
- className: "stat-cell-value",
89
- children: "3"
90
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
91
- className: "stat-cell-label",
92
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_antd.ConfigProvider, {
93
- theme: checkboxTheme,
94
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Checkbox, {
95
- checked: false,
96
- disabled: true
97
- }), " \u8BF4\u660E\u4E66"]
98
- })
99
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
100
- className: "stat-cell-value",
101
- children: "1"
102
- })]
103
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
110
+ }), renderStatsRow(0), renderStatsRow(2), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
104
111
  className: "project-cover-details",
105
112
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
106
113
  className: "detail-row",
@@ -19,7 +19,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
19
19
  */
20
20
  var renderCoverToImage = /*#__PURE__*/function () {
21
21
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
22
- var data, archiveInfo, _options$themeColor, themeColor, _options$companyName, companyName, _options$isProjectMod, isProjectMode, acc51c, div, html, _info$user, info, coverData, _archiveInfo$nsp24c, _coverData, canvas;
22
+ var data, archiveInfo, _options$themeColor, themeColor, _options$companyName, companyName, _options$isProjectMod, isProjectMode, acc51c, div, html, _info$edr04bs, _info$edr04bs2, _info$edr04bs3, _info$edr04bs4, _info$user, info, title, isFourFlows, stats, coverData, renderHtmlStatsRow, _archiveInfo$nsp24c, _coverData, canvas;
23
23
  return _regeneratorRuntime().wrap(function _callee$(_context) {
24
24
  while (1) switch (_context.prev = _context.next) {
25
25
  case 0:
@@ -35,6 +35,41 @@ var renderCoverToImage = /*#__PURE__*/function () {
35
35
  html = '';
36
36
  if (isProjectMode) {
37
37
  info = archiveInfo || {};
38
+ title = (info === null || info === void 0 ? void 0 : info.title) || '高企研发';
39
+ isFourFlows = title === '四流合一档案';
40
+ stats = isFourFlows ? [{
41
+ label: '发票',
42
+ checked: !!(info !== null && info !== void 0 && (_info$edr04bs = info.edr04bs) !== null && _info$edr04bs !== void 0 && _info$edr04bs.length),
43
+ count: (info === null || info === void 0 || (_info$edr04bs2 = info.edr04bs) === null || _info$edr04bs2 === void 0 ? void 0 : _info$edr04bs2.length) || '-'
44
+ }, {
45
+ label: '合同',
46
+ checked: false,
47
+ count: '-'
48
+ }, {
49
+ label: '物流',
50
+ checked: false,
51
+ count: '-'
52
+ }, {
53
+ label: '钱流',
54
+ checked: false,
55
+ count: '-'
56
+ }] : [{
57
+ label: '纪要',
58
+ checked: !!(info !== null && info !== void 0 && (_info$edr04bs3 = info.edr04bs) !== null && _info$edr04bs3 !== void 0 && _info$edr04bs3.length),
59
+ count: (info === null || info === void 0 || (_info$edr04bs4 = info.edr04bs) === null || _info$edr04bs4 === void 0 ? void 0 : _info$edr04bs4.length) || '-'
60
+ }, {
61
+ label: '人员',
62
+ checked: false,
63
+ count: '1'
64
+ }, {
65
+ label: '费用',
66
+ checked: false,
67
+ count: '3'
68
+ }, {
69
+ label: '说明书',
70
+ checked: false,
71
+ count: '1'
72
+ }];
38
73
  coverData = {
39
74
  year: info !== null && info !== void 0 && info.dt ? info.dt.slice(0, 4) : (0, _dayjs.default)().format('YYYY'),
40
75
  archiveNo: (info === null || info === void 0 ? void 0 : info.code) || '-',
@@ -45,10 +80,15 @@ var renderCoverToImage = /*#__PURE__*/function () {
45
80
  creator: (info === null || info === void 0 ? void 0 : info.full_name) || (info === null || info === void 0 || (_info$user = info.user) === null || _info$user === void 0 || (_info$user = _info$user.info) === null || _info$user === void 0 ? void 0 : _info$user.name) || '管理员',
46
81
  totalVolumes: (info === null || info === void 0 ? void 0 : info.totalVolumes) || '',
47
82
  volumeNumber: (info === null || info === void 0 ? void 0 : info.volumeNumber) || '',
48
- edr04bs: (info === null || info === void 0 ? void 0 : info.edr04bs) || [],
49
- title: (info === null || info === void 0 ? void 0 : info.title) || '高企研发'
83
+ title: title
50
84
  };
51
- html = "\n <div style=\"width: 600px; height: 800px; background-color: ".concat(themeColor, "; display: flex; flex-direction: column; padding: 30px; box-sizing: border-box; font-family: SimSun, STSong, serif;\">\n <div style=\"border: 5px solid #000; padding: 5px; height: 100%; box-sizing: border-box;\">\n <div style=\"border: 2px solid #000; height: 100%; display: flex; flex-direction: column; box-sizing: border-box;\">\n <div style=\"text-align: center; color: #000; padding: 8px 0;\">\n <h1 style=\"font-size: 54px; margin: 0; font-weight: 900; letter-spacing: 8px;\">").concat(coverData.title, "</h1>\n </div>\n\n <div style=\"display: flex; border-top: 1px solid #000; border-bottom: 1px solid #000;\">\n <div style=\"flex: 1; text-align: center; padding: 8px; border-right: 1px solid #000; font-weight: bold; display: flex; align-items: center; justify-content: center; gap: 8px;\">").concat(coverData.edr04bs.length > 0 ? '☑' : '☐', " \u7EAA\u8981</div>\n <div style=\"flex: 1; text-align: center; padding: 8px; border-right: 1px solid #000; font-family: 'Times New Roman'; font-size: 18px; font-weight: bold;\">").concat(coverData.edr04bs.length > 0 ? coverData.edr04bs.length : '-', "</div>\n <div style=\"flex: 1; text-align: center; padding: 8px; border-right: 1px solid #000; font-weight: bold; display: flex; align-items: center; justify-content: center; gap: 8px;\">\u2610 \u4EBA\u5458</div>\n <div style=\"flex: 1; text-align: center; padding: 8px; font-family: 'Times New Roman'; font-size: 18px; font-weight: bold;\">1</div>\n </div>\n <div style=\"display: flex; border-bottom: 1px solid #000;\">\n <div style=\"flex: 1; text-align: center; padding: 8px; border-right: 1px solid #000; font-weight: bold; display: flex; align-items: center; justify-content: center; gap: 8px;\">\u2610 \u8D39\u7528</div>\n <div style=\"flex: 1; text-align: center; padding: 8px; border-right: 1px solid #000; font-family: 'Times New Roman'; font-size: 18px; font-weight: bold;\">3</div>\n <div style=\"flex: 1; text-align: center; padding: 8px; border-right: 1px solid #000; font-weight: bold; display: flex; align-items: center; justify-content: center; gap: 8px;\">\u2610 \u8BF4\u660E\u4E66</div>\n <div style=\"flex: 1; text-align: center; padding: 8px; font-family: 'Times New Roman'; font-size: 18px; font-weight: bold;\">1</div>\n </div>\n\n <div style=\" display: flex; flex-direction: column;\">\n <div style=\"display: flex; border-bottom: 1px solid #000;\"><div style=\"width: 100px; padding: 8px; font-weight: bold; border-right: 1px solid #000;\">\u5E74\u5EA6</div><div style=\"flex: 1; padding: 8px; font-weight: 600;\">").concat(coverData.year, "</div></div>\n <div style=\"display: flex; border-bottom: 1px solid #000;\"><div style=\"width: 100px; padding: 8px; font-weight: bold; border-right: 1px solid #000;\">\u6863\u6848\u53F7</div><div style=\"flex: 1; padding: 8px; font-weight: 600;\">").concat(coverData.archiveNo, "</div></div>\n <div style=\"display: flex; border-bottom: 1px solid #000;\"><div style=\"width: 100px; padding: 8px; font-weight: bold; border-right: 1px solid #000;\">\u9879\u76EE\u540D\u79F0</div><div style=\"flex: 1; padding: 8px; font-weight: 600;\">").concat(coverData.projectName, "</div></div>\n <div style=\"display: flex; border-bottom: 1px solid #000;\"><div style=\"width: 100px; padding: 8px; font-weight: bold; border-right: 1px solid #000;\">\u9879\u76EE\u7F16\u53F7</div><div style=\"flex: 1; padding: 8px; font-weight: 600;\">").concat(coverData.projectNo, "</div></div>\n <div style=\"display: flex; border-bottom: 1px solid #000;\"><div style=\"width: 100px; padding: 8px; font-weight: bold; border-right: 1px solid #000;\">\u7F16\u5236\u5355\u4F4D</div><div style=\"flex: 1; padding: 8px; font-weight: 600;\">").concat(coverData.company, "</div></div>\n <div style=\"display: flex; border-bottom: 1px solid #000;\"><div style=\"width: 100px; padding: 8px; font-weight: bold; border-right: 1px solid #000;\">\u7F16\u5236\u65E5\u671F</div><div style=\"flex: 1; padding: 8px; font-weight: 600;\">").concat(coverData.date, "</div></div>\n <div style=\"display: flex; border-bottom: 1px solid #000;\"><div style=\"width: 100px; padding: 8px; font-weight: bold; border-right: 1px solid #000;\">\u7F16\u5236\u4EBA</div><div style=\"flex: 1; padding: 8px; font-weight: 600;\">").concat(coverData.creator, "</div></div>\n </div>\n\n <div style=\"display: flex; border-bottom: 1px solid #000;\">\n <div style=\"flex: 1; text-align: center; padding: 10px; border-right: 1px solid #000; font-weight: bold; display: flex; align-items: center; justify-content: center; font-size: 16px;\">\u51ED\u8BC1</div>\n <div style=\"flex: 1; text-align: center; padding: 10px; border-right: 1px solid #000; font-weight: bold; display: flex; align-items: center; justify-content: center; font-size: 16px;\">\u5F20\u9644\u4EF6</div>\n <div style=\"flex: 1; text-align: center; padding: 10px; font-weight: bold; display: flex; align-items: center; justify-content: center; font-size: 16px;\">\u5F20</div>\n </div>\n <div style=\"display: flex; border-bottom: 1px solid #000;\">\n <div style=\"flex: 1; text-align: center; padding: 10px; border-right: 1px solid #000; font-weight: bold; display: flex; align-items: center; justify-content: center; font-size: 16px;\">\u5171</div>\n <div style=\"flex: 1; text-align: center; padding: 10px; border-right: 1px solid #000; font-weight: bold; display: flex; align-items: center; justify-content: center; font-size: 16px;\">").concat(coverData.totalVolumes, "\u518C\u7B2C</div>\n <div style=\"flex: 1; text-align: center; padding: 10px; font-weight: bold; display: flex; align-items: center; justify-content: center; font-size: 16px;\">").concat(coverData.volumeNumber, "\u518C</div>\n </div>\n </div>\n </div>\n </div>\n ");
85
+ renderHtmlStatsRow = function renderHtmlStatsRow(startIndex) {
86
+ var rowStats = stats.slice(startIndex, startIndex + 2);
87
+ return "\n <div style=\"display: flex; border-bottom: 1px solid #000; ".concat(startIndex === 0 ? 'border-top: 1px solid #000;' : '', "\">\n ").concat(rowStats.map(function (s, i) {
88
+ return "\n <div style=\"flex: 1; text-align: center; padding: 8px; border-right: 1px solid #000; font-weight: bold; display: flex; align-items: center; justify-content: center; gap: 8px;\">\n ".concat(s.checked ? '☑' : '☐', " ").concat(s.label, "\n </div>\n <div style=\"flex: 1; text-align: center; padding: 8px; ").concat(i === 0 ? 'border-right: 1px solid #000;' : '', " font-family: 'Times New Roman'; font-size: 18px; font-weight: bold;\">\n ").concat(s.count, "\n </div>\n ");
89
+ }).join(''), "\n </div>\n ");
90
+ };
91
+ html = "\n <div style=\"width: 600px; height: 800px; background-color: ".concat(themeColor, "; display: flex; flex-direction: column; padding: 30px; box-sizing: border-box; font-family: SimSun, STSong, serif;\">\n <div style=\"border: 5px solid #000; padding: 5px; height: 100%; box-sizing: border-box;\">\n <div style=\"border: 2px solid #000; height: 100%; display: flex; flex-direction: column; box-sizing: border-box;\">\n <div style=\"text-align: center; color: #000; padding: 8px 0;\">\n <h1 style=\"font-size: 54px; margin: 0; font-weight: 900; letter-spacing: 8px;padding: 14px 0;\">").concat(coverData.title, "</h1>\n </div>\n\n ").concat(renderHtmlStatsRow(0), "\n ").concat(renderHtmlStatsRow(2), "\n\n <div style=\" display: flex; flex-direction: column;\">\n <div style=\"display: flex; border-bottom: 1px solid #000;\"><div style=\"width: 100px; padding: 8px; font-weight: bold; border-right: 1px solid #000;\">\u5E74\u5EA6</div><div style=\"flex: 1; padding: 8px; font-weight: 600;\">").concat(coverData.year, "</div></div>\n <div style=\"display: flex; border-bottom: 1px solid #000;\"><div style=\"width: 100px; padding: 8px; font-weight: bold; border-right: 1px solid #000;\">\u6863\u6848\u53F7</div><div style=\"flex: 1; padding: 8px; font-weight: 600;\">").concat(coverData.archiveNo, "</div></div>\n <div style=\"display: flex; border-bottom: 1px solid #000;\"><div style=\"width: 100px; padding: 8px; font-weight: bold; border-right: 1px solid #000;\">\u9879\u76EE\u540D\u79F0</div><div style=\"flex: 1; padding: 8px; font-weight: 600;\">").concat(coverData.projectName, "</div></div>\n <div style=\"display: flex; border-bottom: 1px solid #000;\"><div style=\"width: 100px; padding: 8px; font-weight: bold; border-right: 1px solid #000;\">\u9879\u76EE\u7F16\u53F7</div><div style=\"flex: 1; padding: 8px; font-weight: 600;\">").concat(coverData.projectNo, "</div></div>\n <div style=\"display: flex; border-bottom: 1px solid #000;\"><div style=\"width: 100px; padding: 8px; font-weight: bold; border-right: 1px solid #000;\">\u7F16\u5236\u5355\u4F4D</div><div style=\"flex: 1; padding: 8px; font-weight: 600;\">").concat(coverData.company, "</div></div>\n <div style=\"display: flex; border-bottom: 1px solid #000;\"><div style=\"width: 100px; padding: 8px; font-weight: bold; border-right: 1px solid #000;\">\u7F16\u5236\u65E5\u671F</div><div style=\"flex: 1; padding: 8px; font-weight: 600;\">").concat(coverData.date, "</div></div>\n <div style=\"display: flex; border-bottom: 1px solid #000;\"><div style=\"width: 100px; padding: 8px; font-weight: bold; border-right: 1px solid #000;\">\u7F16\u5236\u4EBA</div><div style=\"flex: 1; padding: 8px; font-weight: 600;\">").concat(coverData.creator, "</div></div>\n </div>\n\n <div style=\"display: flex; border-bottom: 1px solid #000;\">\n <div style=\"flex: 1; text-align: center; padding: 10px; border-right: 1px solid #000; font-weight: bold; display: flex; align-items: center; justify-content: center; font-size: 16px;\">\u51ED\u8BC1</div>\n <div style=\"flex: 1; text-align: center; padding: 10px; border-right: 1px solid #000; font-weight: bold; display: flex; align-items: center; justify-content: center; font-size: 16px;\">\u5F20\u9644\u4EF6</div>\n <div style=\"flex: 1; text-align: center; padding: 10px; font-weight: bold; display: flex; align-items: center; justify-content: center; font-size: 16px;\">\u5F20</div>\n </div>\n <div style=\"display: flex; border-bottom: 1px solid #000;\">\n <div style=\"flex: 1; text-align: center; padding: 10px; border-right: 1px solid #000; font-weight: bold; display: flex; align-items: center; justify-content: center; font-size: 16px;\">\u5171</div>\n <div style=\"flex: 1; text-align: center; padding: 10px; border-right: 1px solid #000; font-weight: bold; display: flex; align-items: center; justify-content: center; font-size: 16px;\">").concat(coverData.totalVolumes, "\u518C\u7B2C</div>\n <div style=\"flex: 1; text-align: center; padding: 10px; font-weight: bold; display: flex; align-items: center; justify-content: center; font-size: 16px;\">").concat(coverData.volumeNumber, "\u518C</div>\n </div>\n </div>\n </div>\n </div>\n ");
52
92
  } else {
53
93
  _coverData = {
54
94
  company: companyName,
@@ -256,7 +256,7 @@
256
256
 
257
257
  .dfb-sideTabs {
258
258
  position: absolute;
259
- right: -18px; // 调整位置,使其紧贴书本边缘
259
+ right: 2px; // 调整位置,使其紧贴书本边缘
260
260
  top: 40px;
261
261
  display: flex;
262
262
  flex-direction: column;
@@ -265,7 +265,7 @@
265
265
  transition: all 0.3s ease;
266
266
 
267
267
  &.is-on-cover {
268
- right: -40px; // 封面是单页模式,标签需要向左移动(进入书壳内部边缘)
268
+ right: -42px; // 封面是单页模式,标签需要向左移动(进入书壳内部边缘)
269
269
  top: 40px;
270
270
  }
271
271
 
@@ -307,7 +307,7 @@
307
307
 
308
308
  &.is-active {
309
309
  position: relative;
310
- left: -8px;
310
+ left: -10px;
311
311
  width: 52px; // 选中态更长
312
312
  padding-left: 16px;
313
313
  font-weight: 700;
@@ -331,7 +331,7 @@
331
331
  }
332
332
 
333
333
  .is-on-activeTab {
334
- right: -8px !important;
334
+ right:12px !important;
335
335
  }
336
336
 
337
337
  .dfb-book-wrapper {
@@ -343,14 +343,14 @@
343
343
 
344
344
  .dfb-bookShell1 {
345
345
  position: relative;
346
- padding: 18px 0 18px 34px;
346
+ padding: 18px 0 18px 54px;
347
347
  background: transparent;
348
348
  transition: background-color 0.3s ease;
349
349
  }
350
350
 
351
351
  .dfb-bookShell {
352
352
  position: relative;
353
- padding: 18px 34px;
353
+ padding: 18px 54px;
354
354
  background: #9F7D4E;
355
355
  transition: background-color 0.3s ease;
356
356
 
@@ -579,6 +579,7 @@
579
579
  margin: 0;
580
580
  font-weight: 900;
581
581
  letter-spacing: 8px;
582
+ padding: 14px 0;
582
583
  }
583
584
  }
584
585
 
@@ -2,7 +2,7 @@ import { AttachmentItem, BuiltPage, PdfDocumentLike } from './types';
2
2
  export declare const setupPdfWorker: (customSrc?: string) => void;
3
3
  export declare const PDF_OPTIONS: {};
4
4
  export declare const PDF_PRELOAD_TIMEOUT = 60000;
5
- export declare const VIEWPORT_WIDTH = 570;
5
+ export declare const VIEWPORT_WIDTH = 580;
6
6
  export declare const VIEWPORT_HEIGHT = 670;
7
7
  export declare const HEIGHT = "100%";
8
8
  export declare const isPdfFile: (path: string) => boolean;
package/dist/cjs/utils.js CHANGED
@@ -27,7 +27,7 @@ var setupPdfWorker = exports.setupPdfWorker = function setupPdfWorker(customSrc)
27
27
  setupPdfWorker();
28
28
  var PDF_OPTIONS = exports.PDF_OPTIONS = {};
29
29
  var PDF_PRELOAD_TIMEOUT = exports.PDF_PRELOAD_TIMEOUT = 60000; // 增加到 60 秒,适配超大文件或慢速网络
30
- var VIEWPORT_WIDTH = exports.VIEWPORT_WIDTH = 570;
30
+ var VIEWPORT_WIDTH = exports.VIEWPORT_WIDTH = 580;
31
31
  var VIEWPORT_HEIGHT = exports.VIEWPORT_HEIGHT = 670;
32
32
  var HEIGHT = exports.HEIGHT = '100%';
33
33
 
@@ -43,7 +43,7 @@ var PdfPage = function PdfPage(_ref2) {
43
43
  var renderTask = null;
44
44
  var render = /*#__PURE__*/function () {
45
45
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
46
- var _renderTask, _page$cleanup2, pdf, page, canvas, _page$cleanup, viewport, scale, dpr, renderViewport, ctx;
46
+ var _renderTask, _page$cleanup2, pdf, page, canvas, _page$cleanup, viewport, scale, calculatedHeight, dpr, renderViewport, ctx;
47
47
  return _regeneratorRuntime().wrap(function _callee$(_context) {
48
48
  while (1) switch (_context.prev = _context.next) {
49
49
  case 0:
@@ -68,42 +68,44 @@ var PdfPage = function PdfPage(_ref2) {
68
68
  viewport = page.getViewport({
69
69
  scale: 1
70
70
  });
71
- scale = VIEWPORT_WIDTH / viewport.width;
71
+ scale = VIEWPORT_WIDTH / viewport.width; // 计算自适应高度,确保不拉伸
72
+ calculatedHeight = viewport.height * scale;
72
73
  dpr = window.devicePixelRatio || 1;
73
74
  renderViewport = page.getViewport({
74
75
  scale: scale * dpr
75
76
  });
76
77
  ctx = canvas.getContext('2d');
77
78
  if (ctx) {
78
- _context.next = 19;
79
+ _context.next = 20;
79
80
  break;
80
81
  }
81
82
  throw new Error('Canvas 上下文获取失败');
82
- case 19:
83
+ case 20:
83
84
  canvas.width = renderViewport.width;
84
85
  canvas.height = renderViewport.height;
85
- canvas.style.width = "".concat(VIEWPORT_WIDTH, "px");
86
- canvas.style.height = "".concat(HEIGHT, "px");
86
+ canvas.style.width = '100%';
87
+ canvas.style.height = '100%';
88
+ canvas.style.objectFit = 'contain';
87
89
  renderTask = page.render({
88
90
  canvasContext: ctx,
89
91
  viewport: renderViewport
90
92
  });
91
- _context.next = 26;
93
+ _context.next = 28;
92
94
  return (_renderTask = renderTask) === null || _renderTask === void 0 ? void 0 : _renderTask.promise;
93
- case 26:
95
+ case 28:
94
96
  setStatus('ready');
95
97
  (_page$cleanup2 = page.cleanup) === null || _page$cleanup2 === void 0 || _page$cleanup2.call(page);
96
- _context.next = 33;
98
+ _context.next = 35;
97
99
  break;
98
- case 30:
99
- _context.prev = 30;
100
+ case 32:
101
+ _context.prev = 32;
100
102
  _context.t0 = _context["catch"](0);
101
103
  if (!cancelled) setStatus('error');
102
- case 33:
104
+ case 35:
103
105
  case "end":
104
106
  return _context.stop();
105
107
  }
106
- }, _callee, null, [[0, 30]]);
108
+ }, _callee, null, [[0, 32]]);
107
109
  }));
108
110
  return function render() {
109
111
  return _ref3.apply(this, arguments);
@@ -5,7 +5,7 @@ import { Checkbox, ConfigProvider } from 'antd';
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
6
  import { jsxs as _jsxs } from "react/jsx-runtime";
7
7
  var ProjectCover = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
8
- var _user$company, _info$dt, _user$info;
8
+ var _user$company, _info$edr04bs, _info$edr04bs2, _info$edr04bs3, _info$edr04bs4, _info$dt, _user$info;
9
9
  var documentInfo = _ref.documentInfo,
10
10
  _ref$themeColor = _ref.themeColor,
11
11
  themeColor = _ref$themeColor === void 0 ? '#4baae3' : _ref$themeColor;
@@ -21,6 +21,70 @@ var ProjectCover = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
21
21
  lineWidth: 2
22
22
  }
23
23
  };
24
+ var title = (info === null || info === void 0 ? void 0 : info.title) || '高企研发';
25
+ var isFourFlows = title === '四流合一档案';
26
+
27
+ // 定义统计项配置
28
+ var statsConfig = isFourFlows ? [{
29
+ label: '发票',
30
+ checked: !!(info !== null && info !== void 0 && (_info$edr04bs = info.edr04bs) !== null && _info$edr04bs !== void 0 && _info$edr04bs.length),
31
+ count: (info === null || info === void 0 || (_info$edr04bs2 = info.edr04bs) === null || _info$edr04bs2 === void 0 ? void 0 : _info$edr04bs2.length) || '-'
32
+ }, {
33
+ label: '合同',
34
+ checked: false,
35
+ count: '-'
36
+ }, {
37
+ label: '物流',
38
+ checked: false,
39
+ count: '-'
40
+ }, {
41
+ label: '钱流',
42
+ checked: false,
43
+ count: '-'
44
+ }] : [{
45
+ label: '纪要',
46
+ checked: !!(info !== null && info !== void 0 && (_info$edr04bs3 = info.edr04bs) !== null && _info$edr04bs3 !== void 0 && _info$edr04bs3.length),
47
+ count: (info === null || info === void 0 || (_info$edr04bs4 = info.edr04bs) === null || _info$edr04bs4 === void 0 ? void 0 : _info$edr04bs4.length) || '-'
48
+ }, {
49
+ label: '人员',
50
+ checked: false,
51
+ count: '1'
52
+ }, {
53
+ label: '费用',
54
+ checked: false,
55
+ count: '3'
56
+ }, {
57
+ label: '说明书',
58
+ checked: false,
59
+ count: '1'
60
+ }];
61
+
62
+ // 渲染统计行辅助函数
63
+ var renderStatsRow = function renderStatsRow(startIndex) {
64
+ return /*#__PURE__*/_jsx("div", {
65
+ className: "project-cover-stats-row",
66
+ style: startIndex > 0 ? {
67
+ borderTop: 'none'
68
+ } : {},
69
+ children: statsConfig.slice(startIndex, startIndex + 2).map(function (item, idx) {
70
+ return /*#__PURE__*/_jsxs(React.Fragment, {
71
+ children: [/*#__PURE__*/_jsx("div", {
72
+ className: "stat-cell-label",
73
+ children: /*#__PURE__*/_jsxs(ConfigProvider, {
74
+ theme: checkboxTheme,
75
+ children: [/*#__PURE__*/_jsx(Checkbox, {
76
+ checked: item.checked,
77
+ disabled: true
78
+ }), " ", item.label]
79
+ })
80
+ }), /*#__PURE__*/_jsx("div", {
81
+ className: "stat-cell-value",
82
+ children: item.count
83
+ })]
84
+ }, item.label);
85
+ })
86
+ });
87
+ };
24
88
  return /*#__PURE__*/_jsx("div", {
25
89
  className: "project-cover-container",
26
90
  style: {
@@ -35,66 +99,9 @@ var ProjectCover = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
35
99
  className: "project-cover-header",
36
100
  children: /*#__PURE__*/_jsx("h1", {
37
101
  className: "project-cover-title",
38
- children: (info === null || info === void 0 ? void 0 : info.title) || '高企研发'
102
+ children: title
39
103
  })
40
- }), /*#__PURE__*/_jsxs("div", {
41
- className: "project-cover-stats-row",
42
- children: [/*#__PURE__*/_jsx("div", {
43
- className: "stat-cell-label",
44
- children: /*#__PURE__*/_jsxs(ConfigProvider, {
45
- theme: checkboxTheme,
46
- children: [/*#__PURE__*/_jsx(Checkbox, {
47
- checked: !!(info !== null && info !== void 0 && info.edr04bs && info.edr04bs.length > 0),
48
- disabled: true
49
- }), " \u7EAA\u8981"]
50
- })
51
- }), /*#__PURE__*/_jsx("div", {
52
- className: "stat-cell-value",
53
- children: info !== null && info !== void 0 && info.edr04bs && info.edr04bs.length > 0 ? info.edr04bs.length : '-'
54
- }), /*#__PURE__*/_jsx("div", {
55
- className: "stat-cell-label",
56
- children: /*#__PURE__*/_jsxs(ConfigProvider, {
57
- theme: checkboxTheme,
58
- children: [/*#__PURE__*/_jsx(Checkbox, {
59
- checked: false,
60
- disabled: true
61
- }), " \u4EBA\u5458"]
62
- })
63
- }), /*#__PURE__*/_jsx("div", {
64
- className: "stat-cell-value",
65
- children: "1"
66
- })]
67
- }), /*#__PURE__*/_jsxs("div", {
68
- className: "project-cover-stats-row",
69
- style: {
70
- borderTop: 'none'
71
- },
72
- children: [/*#__PURE__*/_jsx("div", {
73
- className: "stat-cell-label",
74
- children: /*#__PURE__*/_jsxs(ConfigProvider, {
75
- theme: checkboxTheme,
76
- children: [/*#__PURE__*/_jsx(Checkbox, {
77
- checked: false,
78
- disabled: true
79
- }), " \u8D39\u7528"]
80
- })
81
- }), /*#__PURE__*/_jsx("div", {
82
- className: "stat-cell-value",
83
- children: "3"
84
- }), /*#__PURE__*/_jsx("div", {
85
- className: "stat-cell-label",
86
- children: /*#__PURE__*/_jsxs(ConfigProvider, {
87
- theme: checkboxTheme,
88
- children: [/*#__PURE__*/_jsx(Checkbox, {
89
- checked: false,
90
- disabled: true
91
- }), " \u8BF4\u660E\u4E66"]
92
- })
93
- }), /*#__PURE__*/_jsx("div", {
94
- className: "stat-cell-value",
95
- children: "1"
96
- })]
97
- }), /*#__PURE__*/_jsxs("div", {
104
+ }), renderStatsRow(0), renderStatsRow(2), /*#__PURE__*/_jsxs("div", {
98
105
  className: "project-cover-details",
99
106
  children: [/*#__PURE__*/_jsxs("div", {
100
107
  className: "detail-row",
@@ -10,7 +10,7 @@ import { renderPdfPageToDataUrl, renderImageToDataUrl } from "./exportPdf";
10
10
  */
11
11
  var renderCoverToImage = /*#__PURE__*/function () {
12
12
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
13
- var data, archiveInfo, _options$themeColor, themeColor, _options$companyName, companyName, _options$isProjectMod, isProjectMode, acc51c, div, html, _info$user, info, coverData, _archiveInfo$nsp24c, _coverData, canvas;
13
+ var data, archiveInfo, _options$themeColor, themeColor, _options$companyName, companyName, _options$isProjectMod, isProjectMode, acc51c, div, html, _info$edr04bs, _info$edr04bs2, _info$edr04bs3, _info$edr04bs4, _info$user, info, title, isFourFlows, stats, coverData, renderHtmlStatsRow, _archiveInfo$nsp24c, _coverData, canvas;
14
14
  return _regeneratorRuntime().wrap(function _callee$(_context) {
15
15
  while (1) switch (_context.prev = _context.next) {
16
16
  case 0:
@@ -26,6 +26,41 @@ var renderCoverToImage = /*#__PURE__*/function () {
26
26
  html = '';
27
27
  if (isProjectMode) {
28
28
  info = archiveInfo || {};
29
+ title = (info === null || info === void 0 ? void 0 : info.title) || '高企研发';
30
+ isFourFlows = title === '四流合一档案';
31
+ stats = isFourFlows ? [{
32
+ label: '发票',
33
+ checked: !!(info !== null && info !== void 0 && (_info$edr04bs = info.edr04bs) !== null && _info$edr04bs !== void 0 && _info$edr04bs.length),
34
+ count: (info === null || info === void 0 || (_info$edr04bs2 = info.edr04bs) === null || _info$edr04bs2 === void 0 ? void 0 : _info$edr04bs2.length) || '-'
35
+ }, {
36
+ label: '合同',
37
+ checked: false,
38
+ count: '-'
39
+ }, {
40
+ label: '物流',
41
+ checked: false,
42
+ count: '-'
43
+ }, {
44
+ label: '钱流',
45
+ checked: false,
46
+ count: '-'
47
+ }] : [{
48
+ label: '纪要',
49
+ checked: !!(info !== null && info !== void 0 && (_info$edr04bs3 = info.edr04bs) !== null && _info$edr04bs3 !== void 0 && _info$edr04bs3.length),
50
+ count: (info === null || info === void 0 || (_info$edr04bs4 = info.edr04bs) === null || _info$edr04bs4 === void 0 ? void 0 : _info$edr04bs4.length) || '-'
51
+ }, {
52
+ label: '人员',
53
+ checked: false,
54
+ count: '1'
55
+ }, {
56
+ label: '费用',
57
+ checked: false,
58
+ count: '3'
59
+ }, {
60
+ label: '说明书',
61
+ checked: false,
62
+ count: '1'
63
+ }];
29
64
  coverData = {
30
65
  year: info !== null && info !== void 0 && info.dt ? info.dt.slice(0, 4) : dayjs().format('YYYY'),
31
66
  archiveNo: (info === null || info === void 0 ? void 0 : info.code) || '-',
@@ -36,10 +71,15 @@ var renderCoverToImage = /*#__PURE__*/function () {
36
71
  creator: (info === null || info === void 0 ? void 0 : info.full_name) || (info === null || info === void 0 || (_info$user = info.user) === null || _info$user === void 0 || (_info$user = _info$user.info) === null || _info$user === void 0 ? void 0 : _info$user.name) || '管理员',
37
72
  totalVolumes: (info === null || info === void 0 ? void 0 : info.totalVolumes) || '',
38
73
  volumeNumber: (info === null || info === void 0 ? void 0 : info.volumeNumber) || '',
39
- edr04bs: (info === null || info === void 0 ? void 0 : info.edr04bs) || [],
40
- title: (info === null || info === void 0 ? void 0 : info.title) || '高企研发'
74
+ title: title
41
75
  };
42
- html = "\n <div style=\"width: 600px; height: 800px; background-color: ".concat(themeColor, "; display: flex; flex-direction: column; padding: 30px; box-sizing: border-box; font-family: SimSun, STSong, serif;\">\n <div style=\"border: 5px solid #000; padding: 5px; height: 100%; box-sizing: border-box;\">\n <div style=\"border: 2px solid #000; height: 100%; display: flex; flex-direction: column; box-sizing: border-box;\">\n <div style=\"text-align: center; color: #000; padding: 8px 0;\">\n <h1 style=\"font-size: 54px; margin: 0; font-weight: 900; letter-spacing: 8px;\">").concat(coverData.title, "</h1>\n </div>\n\n <div style=\"display: flex; border-top: 1px solid #000; border-bottom: 1px solid #000;\">\n <div style=\"flex: 1; text-align: center; padding: 8px; border-right: 1px solid #000; font-weight: bold; display: flex; align-items: center; justify-content: center; gap: 8px;\">").concat(coverData.edr04bs.length > 0 ? '☑' : '☐', " \u7EAA\u8981</div>\n <div style=\"flex: 1; text-align: center; padding: 8px; border-right: 1px solid #000; font-family: 'Times New Roman'; font-size: 18px; font-weight: bold;\">").concat(coverData.edr04bs.length > 0 ? coverData.edr04bs.length : '-', "</div>\n <div style=\"flex: 1; text-align: center; padding: 8px; border-right: 1px solid #000; font-weight: bold; display: flex; align-items: center; justify-content: center; gap: 8px;\">\u2610 \u4EBA\u5458</div>\n <div style=\"flex: 1; text-align: center; padding: 8px; font-family: 'Times New Roman'; font-size: 18px; font-weight: bold;\">1</div>\n </div>\n <div style=\"display: flex; border-bottom: 1px solid #000;\">\n <div style=\"flex: 1; text-align: center; padding: 8px; border-right: 1px solid #000; font-weight: bold; display: flex; align-items: center; justify-content: center; gap: 8px;\">\u2610 \u8D39\u7528</div>\n <div style=\"flex: 1; text-align: center; padding: 8px; border-right: 1px solid #000; font-family: 'Times New Roman'; font-size: 18px; font-weight: bold;\">3</div>\n <div style=\"flex: 1; text-align: center; padding: 8px; border-right: 1px solid #000; font-weight: bold; display: flex; align-items: center; justify-content: center; gap: 8px;\">\u2610 \u8BF4\u660E\u4E66</div>\n <div style=\"flex: 1; text-align: center; padding: 8px; font-family: 'Times New Roman'; font-size: 18px; font-weight: bold;\">1</div>\n </div>\n\n <div style=\" display: flex; flex-direction: column;\">\n <div style=\"display: flex; border-bottom: 1px solid #000;\"><div style=\"width: 100px; padding: 8px; font-weight: bold; border-right: 1px solid #000;\">\u5E74\u5EA6</div><div style=\"flex: 1; padding: 8px; font-weight: 600;\">").concat(coverData.year, "</div></div>\n <div style=\"display: flex; border-bottom: 1px solid #000;\"><div style=\"width: 100px; padding: 8px; font-weight: bold; border-right: 1px solid #000;\">\u6863\u6848\u53F7</div><div style=\"flex: 1; padding: 8px; font-weight: 600;\">").concat(coverData.archiveNo, "</div></div>\n <div style=\"display: flex; border-bottom: 1px solid #000;\"><div style=\"width: 100px; padding: 8px; font-weight: bold; border-right: 1px solid #000;\">\u9879\u76EE\u540D\u79F0</div><div style=\"flex: 1; padding: 8px; font-weight: 600;\">").concat(coverData.projectName, "</div></div>\n <div style=\"display: flex; border-bottom: 1px solid #000;\"><div style=\"width: 100px; padding: 8px; font-weight: bold; border-right: 1px solid #000;\">\u9879\u76EE\u7F16\u53F7</div><div style=\"flex: 1; padding: 8px; font-weight: 600;\">").concat(coverData.projectNo, "</div></div>\n <div style=\"display: flex; border-bottom: 1px solid #000;\"><div style=\"width: 100px; padding: 8px; font-weight: bold; border-right: 1px solid #000;\">\u7F16\u5236\u5355\u4F4D</div><div style=\"flex: 1; padding: 8px; font-weight: 600;\">").concat(coverData.company, "</div></div>\n <div style=\"display: flex; border-bottom: 1px solid #000;\"><div style=\"width: 100px; padding: 8px; font-weight: bold; border-right: 1px solid #000;\">\u7F16\u5236\u65E5\u671F</div><div style=\"flex: 1; padding: 8px; font-weight: 600;\">").concat(coverData.date, "</div></div>\n <div style=\"display: flex; border-bottom: 1px solid #000;\"><div style=\"width: 100px; padding: 8px; font-weight: bold; border-right: 1px solid #000;\">\u7F16\u5236\u4EBA</div><div style=\"flex: 1; padding: 8px; font-weight: 600;\">").concat(coverData.creator, "</div></div>\n </div>\n\n <div style=\"display: flex; border-bottom: 1px solid #000;\">\n <div style=\"flex: 1; text-align: center; padding: 10px; border-right: 1px solid #000; font-weight: bold; display: flex; align-items: center; justify-content: center; font-size: 16px;\">\u51ED\u8BC1</div>\n <div style=\"flex: 1; text-align: center; padding: 10px; border-right: 1px solid #000; font-weight: bold; display: flex; align-items: center; justify-content: center; font-size: 16px;\">\u5F20\u9644\u4EF6</div>\n <div style=\"flex: 1; text-align: center; padding: 10px; font-weight: bold; display: flex; align-items: center; justify-content: center; font-size: 16px;\">\u5F20</div>\n </div>\n <div style=\"display: flex; border-bottom: 1px solid #000;\">\n <div style=\"flex: 1; text-align: center; padding: 10px; border-right: 1px solid #000; font-weight: bold; display: flex; align-items: center; justify-content: center; font-size: 16px;\">\u5171</div>\n <div style=\"flex: 1; text-align: center; padding: 10px; border-right: 1px solid #000; font-weight: bold; display: flex; align-items: center; justify-content: center; font-size: 16px;\">").concat(coverData.totalVolumes, "\u518C\u7B2C</div>\n <div style=\"flex: 1; text-align: center; padding: 10px; font-weight: bold; display: flex; align-items: center; justify-content: center; font-size: 16px;\">").concat(coverData.volumeNumber, "\u518C</div>\n </div>\n </div>\n </div>\n </div>\n ");
76
+ renderHtmlStatsRow = function renderHtmlStatsRow(startIndex) {
77
+ var rowStats = stats.slice(startIndex, startIndex + 2);
78
+ return "\n <div style=\"display: flex; border-bottom: 1px solid #000; ".concat(startIndex === 0 ? 'border-top: 1px solid #000;' : '', "\">\n ").concat(rowStats.map(function (s, i) {
79
+ return "\n <div style=\"flex: 1; text-align: center; padding: 8px; border-right: 1px solid #000; font-weight: bold; display: flex; align-items: center; justify-content: center; gap: 8px;\">\n ".concat(s.checked ? '☑' : '☐', " ").concat(s.label, "\n </div>\n <div style=\"flex: 1; text-align: center; padding: 8px; ").concat(i === 0 ? 'border-right: 1px solid #000;' : '', " font-family: 'Times New Roman'; font-size: 18px; font-weight: bold;\">\n ").concat(s.count, "\n </div>\n ");
80
+ }).join(''), "\n </div>\n ");
81
+ };
82
+ html = "\n <div style=\"width: 600px; height: 800px; background-color: ".concat(themeColor, "; display: flex; flex-direction: column; padding: 30px; box-sizing: border-box; font-family: SimSun, STSong, serif;\">\n <div style=\"border: 5px solid #000; padding: 5px; height: 100%; box-sizing: border-box;\">\n <div style=\"border: 2px solid #000; height: 100%; display: flex; flex-direction: column; box-sizing: border-box;\">\n <div style=\"text-align: center; color: #000; padding: 8px 0;\">\n <h1 style=\"font-size: 54px; margin: 0; font-weight: 900; letter-spacing: 8px;padding: 14px 0;\">").concat(coverData.title, "</h1>\n </div>\n\n ").concat(renderHtmlStatsRow(0), "\n ").concat(renderHtmlStatsRow(2), "\n\n <div style=\" display: flex; flex-direction: column;\">\n <div style=\"display: flex; border-bottom: 1px solid #000;\"><div style=\"width: 100px; padding: 8px; font-weight: bold; border-right: 1px solid #000;\">\u5E74\u5EA6</div><div style=\"flex: 1; padding: 8px; font-weight: 600;\">").concat(coverData.year, "</div></div>\n <div style=\"display: flex; border-bottom: 1px solid #000;\"><div style=\"width: 100px; padding: 8px; font-weight: bold; border-right: 1px solid #000;\">\u6863\u6848\u53F7</div><div style=\"flex: 1; padding: 8px; font-weight: 600;\">").concat(coverData.archiveNo, "</div></div>\n <div style=\"display: flex; border-bottom: 1px solid #000;\"><div style=\"width: 100px; padding: 8px; font-weight: bold; border-right: 1px solid #000;\">\u9879\u76EE\u540D\u79F0</div><div style=\"flex: 1; padding: 8px; font-weight: 600;\">").concat(coverData.projectName, "</div></div>\n <div style=\"display: flex; border-bottom: 1px solid #000;\"><div style=\"width: 100px; padding: 8px; font-weight: bold; border-right: 1px solid #000;\">\u9879\u76EE\u7F16\u53F7</div><div style=\"flex: 1; padding: 8px; font-weight: 600;\">").concat(coverData.projectNo, "</div></div>\n <div style=\"display: flex; border-bottom: 1px solid #000;\"><div style=\"width: 100px; padding: 8px; font-weight: bold; border-right: 1px solid #000;\">\u7F16\u5236\u5355\u4F4D</div><div style=\"flex: 1; padding: 8px; font-weight: 600;\">").concat(coverData.company, "</div></div>\n <div style=\"display: flex; border-bottom: 1px solid #000;\"><div style=\"width: 100px; padding: 8px; font-weight: bold; border-right: 1px solid #000;\">\u7F16\u5236\u65E5\u671F</div><div style=\"flex: 1; padding: 8px; font-weight: 600;\">").concat(coverData.date, "</div></div>\n <div style=\"display: flex; border-bottom: 1px solid #000;\"><div style=\"width: 100px; padding: 8px; font-weight: bold; border-right: 1px solid #000;\">\u7F16\u5236\u4EBA</div><div style=\"flex: 1; padding: 8px; font-weight: 600;\">").concat(coverData.creator, "</div></div>\n </div>\n\n <div style=\"display: flex; border-bottom: 1px solid #000;\">\n <div style=\"flex: 1; text-align: center; padding: 10px; border-right: 1px solid #000; font-weight: bold; display: flex; align-items: center; justify-content: center; font-size: 16px;\">\u51ED\u8BC1</div>\n <div style=\"flex: 1; text-align: center; padding: 10px; border-right: 1px solid #000; font-weight: bold; display: flex; align-items: center; justify-content: center; font-size: 16px;\">\u5F20\u9644\u4EF6</div>\n <div style=\"flex: 1; text-align: center; padding: 10px; font-weight: bold; display: flex; align-items: center; justify-content: center; font-size: 16px;\">\u5F20</div>\n </div>\n <div style=\"display: flex; border-bottom: 1px solid #000;\">\n <div style=\"flex: 1; text-align: center; padding: 10px; border-right: 1px solid #000; font-weight: bold; display: flex; align-items: center; justify-content: center; font-size: 16px;\">\u5171</div>\n <div style=\"flex: 1; text-align: center; padding: 10px; border-right: 1px solid #000; font-weight: bold; display: flex; align-items: center; justify-content: center; font-size: 16px;\">").concat(coverData.totalVolumes, "\u518C\u7B2C</div>\n <div style=\"flex: 1; text-align: center; padding: 10px; font-weight: bold; display: flex; align-items: center; justify-content: center; font-size: 16px;\">").concat(coverData.volumeNumber, "\u518C</div>\n </div>\n </div>\n </div>\n </div>\n ");
43
83
  } else {
44
84
  _coverData = {
45
85
  company: companyName,
@@ -256,7 +256,7 @@
256
256
 
257
257
  .dfb-sideTabs {
258
258
  position: absolute;
259
- right: -18px; // 调整位置,使其紧贴书本边缘
259
+ right: 2px; // 调整位置,使其紧贴书本边缘
260
260
  top: 40px;
261
261
  display: flex;
262
262
  flex-direction: column;
@@ -265,7 +265,7 @@
265
265
  transition: all 0.3s ease;
266
266
 
267
267
  &.is-on-cover {
268
- right: -40px; // 封面是单页模式,标签需要向左移动(进入书壳内部边缘)
268
+ right: -42px; // 封面是单页模式,标签需要向左移动(进入书壳内部边缘)
269
269
  top: 40px;
270
270
  }
271
271
 
@@ -307,7 +307,7 @@
307
307
 
308
308
  &.is-active {
309
309
  position: relative;
310
- left: -8px;
310
+ left: -10px;
311
311
  width: 52px; // 选中态更长
312
312
  padding-left: 16px;
313
313
  font-weight: 700;
@@ -331,7 +331,7 @@
331
331
  }
332
332
 
333
333
  .is-on-activeTab {
334
- right: -8px !important;
334
+ right:12px !important;
335
335
  }
336
336
 
337
337
  .dfb-book-wrapper {
@@ -343,14 +343,14 @@
343
343
 
344
344
  .dfb-bookShell1 {
345
345
  position: relative;
346
- padding: 18px 0 18px 34px;
346
+ padding: 18px 0 18px 54px;
347
347
  background: transparent;
348
348
  transition: background-color 0.3s ease;
349
349
  }
350
350
 
351
351
  .dfb-bookShell {
352
352
  position: relative;
353
- padding: 18px 34px;
353
+ padding: 18px 54px;
354
354
  background: #9F7D4E;
355
355
  transition: background-color 0.3s ease;
356
356
 
@@ -579,6 +579,7 @@
579
579
  margin: 0;
580
580
  font-weight: 900;
581
581
  letter-spacing: 8px;
582
+ padding: 14px 0;
582
583
  }
583
584
  }
584
585
 
@@ -2,7 +2,7 @@ import { AttachmentItem, BuiltPage, PdfDocumentLike } from './types';
2
2
  export declare const setupPdfWorker: (customSrc?: string) => void;
3
3
  export declare const PDF_OPTIONS: {};
4
4
  export declare const PDF_PRELOAD_TIMEOUT = 60000;
5
- export declare const VIEWPORT_WIDTH = 570;
5
+ export declare const VIEWPORT_WIDTH = 580;
6
6
  export declare const VIEWPORT_HEIGHT = 670;
7
7
  export declare const HEIGHT = "100%";
8
8
  export declare const isPdfFile: (path: string) => boolean;
package/dist/esm/utils.js CHANGED
@@ -21,7 +21,7 @@ export var setupPdfWorker = function setupPdfWorker(customSrc) {
21
21
  setupPdfWorker();
22
22
  export var PDF_OPTIONS = {};
23
23
  export var PDF_PRELOAD_TIMEOUT = 60000; // 增加到 60 秒,适配超大文件或慢速网络
24
- export var VIEWPORT_WIDTH = 570;
24
+ export var VIEWPORT_WIDTH = 580;
25
25
  export var VIEWPORT_HEIGHT = 670;
26
26
  export var HEIGHT = '100%';
27
27
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cecee/document-flip-book",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "description": "A high-performance document flipbook component based on React and Ant Design.",
5
5
  "publishConfig": {
6
6
  "access": "public"