@cecee/document-flip-book 1.0.18 → 1.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/dist/cjs/AccountingBook/assets/active-line.png +0 -0
  2. package/dist/cjs/AccountingBook/assets/default-line.png +0 -0
  3. package/dist/cjs/AccountingBook/assets/filp-bg.png +0 -0
  4. package/dist/cjs/AccountingBook/components/AccountingVoucher/index.d.ts +26 -0
  5. package/dist/cjs/AccountingBook/components/AccountingVoucher/index.js +398 -0
  6. package/dist/cjs/AccountingBook/components/AccountingVoucher/index.less +231 -0
  7. package/dist/cjs/AccountingBook/components/ExportModal.d.ts +10 -0
  8. package/dist/cjs/AccountingBook/components/ExportModal.js +96 -0
  9. package/dist/cjs/AccountingBook/components/FilpPage.d.ts +7 -0
  10. package/dist/cjs/AccountingBook/components/FilpPage.js +39 -0
  11. package/dist/cjs/AccountingBook/components/HeaderBar.d.ts +28 -0
  12. package/dist/cjs/AccountingBook/components/HeaderBar.js +245 -0
  13. package/dist/cjs/AccountingBook/components/ImagePageRenderer.d.ts +11 -0
  14. package/dist/cjs/AccountingBook/components/ImagePageRenderer.js +91 -0
  15. package/dist/cjs/AccountingBook/components/LoadingComponent.d.ts +7 -0
  16. package/dist/cjs/AccountingBook/components/LoadingComponent.js +54 -0
  17. package/dist/cjs/AccountingBook/components/PDFPageRenderer.d.ts +13 -0
  18. package/dist/cjs/AccountingBook/components/PDFPageRenderer.js +259 -0
  19. package/dist/cjs/AccountingBook/components/index.less +6 -0
  20. package/dist/cjs/AccountingBook/constants.d.ts +11 -0
  21. package/dist/cjs/AccountingBook/constants.js +25 -0
  22. package/dist/cjs/AccountingBook/hooks/useAmountSearch.d.ts +24 -0
  23. package/dist/cjs/AccountingBook/hooks/useAmountSearch.js +165 -0
  24. package/dist/cjs/AccountingBook/hooks/usePageFlip.d.ts +15 -0
  25. package/dist/cjs/AccountingBook/hooks/usePageFlip.js +67 -0
  26. package/dist/cjs/AccountingBook/index.d.ts +29 -1
  27. package/dist/cjs/AccountingBook/index.js +1163 -7
  28. package/dist/cjs/AccountingBook/index.less +188 -0
  29. package/dist/cjs/AccountingBook/types.d.ts +84 -0
  30. package/dist/cjs/AccountingBook/types.js +5 -0
  31. package/dist/cjs/AccountingBook/utils/canvasUtils.d.ts +51 -0
  32. package/dist/cjs/AccountingBook/utils/canvasUtils.js +499 -0
  33. package/dist/cjs/AccountingBook/utils/html.d.ts +9 -0
  34. package/dist/cjs/AccountingBook/utils/html.js +97 -0
  35. package/dist/cjs/AccountingBook/utils/utils.d.ts +38 -0
  36. package/dist/cjs/AccountingBook/utils/utils.js +204 -0
  37. package/dist/cjs/DocumentFlipBook/ExportModal.d.ts +1 -1
  38. package/dist/cjs/DocumentFlipBook/ExportModal.js +1 -1
  39. package/dist/cjs/DocumentFlipBook/HeaderBar.d.ts +2 -1
  40. package/dist/cjs/DocumentFlipBook/HeaderBar.js +13 -11
  41. package/dist/cjs/DocumentFlipBook/SideTabs.js +111 -6
  42. package/dist/cjs/DocumentFlipBook/index.d.ts +1 -0
  43. package/dist/cjs/DocumentFlipBook/index.js +9 -6
  44. package/dist/cjs/DocumentFlipBook/index.less +239 -12
  45. package/dist/cjs/declarations.d.ts +21 -0
  46. package/dist/esm/AccountingBook/assets/active-line.png +0 -0
  47. package/dist/esm/AccountingBook/assets/default-line.png +0 -0
  48. package/dist/esm/AccountingBook/assets/filp-bg.png +0 -0
  49. package/dist/esm/AccountingBook/components/AccountingVoucher/index.d.ts +26 -0
  50. package/dist/esm/AccountingBook/components/AccountingVoucher/index.js +391 -0
  51. package/dist/esm/AccountingBook/components/AccountingVoucher/index.less +231 -0
  52. package/dist/esm/AccountingBook/components/ExportModal.d.ts +10 -0
  53. package/dist/esm/AccountingBook/components/ExportModal.js +88 -0
  54. package/dist/esm/AccountingBook/components/FilpPage.d.ts +7 -0
  55. package/dist/esm/AccountingBook/components/FilpPage.js +33 -0
  56. package/dist/esm/AccountingBook/components/HeaderBar.d.ts +28 -0
  57. package/dist/esm/AccountingBook/components/HeaderBar.js +236 -0
  58. package/dist/esm/AccountingBook/components/ImagePageRenderer.d.ts +11 -0
  59. package/dist/esm/AccountingBook/components/ImagePageRenderer.js +85 -0
  60. package/dist/esm/AccountingBook/components/LoadingComponent.d.ts +7 -0
  61. package/dist/esm/AccountingBook/components/LoadingComponent.js +48 -0
  62. package/dist/esm/AccountingBook/components/PDFPageRenderer.d.ts +13 -0
  63. package/dist/esm/AccountingBook/components/PDFPageRenderer.js +252 -0
  64. package/dist/esm/AccountingBook/components/index.less +6 -0
  65. package/dist/esm/AccountingBook/constants.d.ts +11 -0
  66. package/dist/esm/AccountingBook/constants.js +17 -0
  67. package/dist/esm/AccountingBook/hooks/useAmountSearch.d.ts +24 -0
  68. package/dist/esm/AccountingBook/hooks/useAmountSearch.js +158 -0
  69. package/dist/esm/AccountingBook/hooks/usePageFlip.d.ts +15 -0
  70. package/dist/esm/AccountingBook/hooks/usePageFlip.js +61 -0
  71. package/dist/esm/AccountingBook/index.d.ts +29 -1
  72. package/dist/esm/AccountingBook/index.js +1162 -6
  73. package/dist/esm/AccountingBook/index.less +188 -0
  74. package/dist/esm/AccountingBook/types.d.ts +84 -0
  75. package/dist/esm/AccountingBook/types.js +1 -0
  76. package/dist/esm/AccountingBook/utils/canvasUtils.d.ts +51 -0
  77. package/dist/esm/AccountingBook/utils/canvasUtils.js +493 -0
  78. package/dist/esm/AccountingBook/utils/html.d.ts +9 -0
  79. package/dist/esm/AccountingBook/utils/html.js +89 -0
  80. package/dist/esm/AccountingBook/utils/utils.d.ts +38 -0
  81. package/dist/esm/AccountingBook/utils/utils.js +195 -0
  82. package/dist/esm/DocumentFlipBook/ExportModal.d.ts +1 -1
  83. package/dist/esm/DocumentFlipBook/ExportModal.js +1 -1
  84. package/dist/esm/DocumentFlipBook/HeaderBar.d.ts +2 -1
  85. package/dist/esm/DocumentFlipBook/HeaderBar.js +13 -11
  86. package/dist/esm/DocumentFlipBook/SideTabs.js +110 -5
  87. package/dist/esm/DocumentFlipBook/index.d.ts +1 -0
  88. package/dist/esm/DocumentFlipBook/index.js +9 -6
  89. package/dist/esm/DocumentFlipBook/index.less +239 -12
  90. package/dist/esm/declarations.d.ts +21 -0
  91. package/package.json +8 -2
@@ -1,20 +1,71 @@
1
1
  "use strict";
2
2
 
3
+ 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); }
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.default = SideTabs;
7
- var _react = _interopRequireDefault(require("react"));
8
+ var _react = _interopRequireWildcard(require("react"));
8
9
  var _jsxRuntime = require("react/jsx-runtime");
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
11
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
12
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
13
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
14
+ 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); }
15
+ 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; }
16
+ 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; } }
17
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
18
+ var MAX_VISIBLE_TABS = 5;
10
19
  function SideTabs(props) {
11
20
  var items = props.items,
12
21
  activeKey = props.activeKey,
13
22
  className = props.className,
14
23
  onSelect = props.onSelect;
15
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
16
- className: ['dfb-sideTabs', className].filter(Boolean).join(' '),
17
- children: items.map(function (it) {
24
+ var _useState = (0, _react.useState)(false),
25
+ _useState2 = _slicedToArray(_useState, 2),
26
+ isDropdownOpen = _useState2[0],
27
+ setIsDropdownOpen = _useState2[1];
28
+ var dropdownRef = (0, _react.useRef)(null);
29
+
30
+ // 根据标签数量动态设置样式类名
31
+ var getContainerClassName = function getContainerClassName() {
32
+ var baseClasses = ['dfb-sideTabs', className].filter(Boolean).join(' ');
33
+ if (items.length > MAX_VISIBLE_TABS) {
34
+ return "".concat(baseClasses, " dfb-sideTabs--dropdown");
35
+ } else if (items.length >= 6) {
36
+ return "".concat(baseClasses, " dfb-sideTabs--overlap");
37
+ }
38
+ return baseClasses;
39
+ };
40
+
41
+ // 显示的标签和折叠的标签
42
+ var visibleItems = items.slice(0, MAX_VISIBLE_TABS);
43
+ var shouldShowDropdown = items.length > MAX_VISIBLE_TABS;
44
+ var isActiveInDropdown = activeKey && !visibleItems.some(function (item) {
45
+ return item.key === activeKey;
46
+ });
47
+ var activeItemInDropdown = isActiveInDropdown ? items.find(function (item) {
48
+ return item.key === activeKey;
49
+ }) : null;
50
+
51
+ // 点击外部关闭下拉菜单
52
+ (0, _react.useEffect)(function () {
53
+ var handleClickOutside = function handleClickOutside(event) {
54
+ if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
55
+ setIsDropdownOpen(false);
56
+ }
57
+ };
58
+ if (isDropdownOpen) {
59
+ document.addEventListener('mousedown', handleClickOutside);
60
+ }
61
+ return function () {
62
+ document.removeEventListener('mousedown', handleClickOutside);
63
+ };
64
+ }, [isDropdownOpen]);
65
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
66
+ className: getContainerClassName(),
67
+ ref: dropdownRef,
68
+ children: [visibleItems.map(function (it) {
18
69
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
19
70
  type: "button",
20
71
  className: ['dfb-sideTab', activeKey === it.key ? 'is-active' : ''].join(' '),
@@ -29,6 +80,60 @@ function SideTabs(props) {
29
80
  children: it.label
30
81
  })
31
82
  }, it.key);
32
- })
83
+ }), shouldShowDropdown && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
84
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
85
+ type: "button",
86
+ className: ['dfb-sideTab', 'dfb-sideTab--more', isActiveInDropdown ? 'is-active' : ''].join(' '),
87
+ style: isActiveInDropdown && activeItemInDropdown ? {
88
+ background: activeItemInDropdown.color
89
+ } : {},
90
+ onClick: function onClick() {
91
+ return setIsDropdownOpen(!isDropdownOpen);
92
+ },
93
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
94
+ className: "dfb-sideTabText",
95
+ children: "\u66F4\u591A"
96
+ })
97
+ }), isDropdownOpen && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
98
+ className: "dfb-sideTabs__dropdown",
99
+ onClick: function onClick(e) {
100
+ return e.stopPropagation();
101
+ },
102
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
103
+ className: "dfb-sideTabs__dropdown-header",
104
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
105
+ children: "\u66F4\u591A\u6807\u7B7E"
106
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
107
+ type: "button",
108
+ className: "dfb-sideTabs__dropdown-close",
109
+ onClick: function onClick() {
110
+ return setIsDropdownOpen(false);
111
+ },
112
+ children: "\u2715"
113
+ })]
114
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
115
+ className: "dfb-sideTabs__dropdown-content",
116
+ children: items.map(function (it) {
117
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
118
+ type: "button",
119
+ className: ['dfb-sideTabs__dropdown-item', activeKey === it.key ? 'is-active' : ''].join(' '),
120
+ onClick: function onClick() {
121
+ onSelect(it);
122
+ setIsDropdownOpen(false);
123
+ },
124
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
125
+ className: "dfb-sideTabs__dropdown-item-color",
126
+ style: {
127
+ background: it.color
128
+ }
129
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
130
+ className: "dfb-sideTabs__dropdown-item-text",
131
+ children: it.label
132
+ })]
133
+ }, it.key);
134
+ })
135
+ })]
136
+ })]
137
+ })]
33
138
  });
34
139
  }
@@ -6,6 +6,7 @@ interface DocumentFlipBookProps {
6
6
  title?: string;
7
7
  id?: string;
8
8
  themeColor?: string;
9
+ iconColor?: string;
9
10
  documentInfo: {
10
11
  fd: string;
11
12
  com00cs?: any[];
@@ -40,6 +40,8 @@ var DocumentFlipBook = function DocumentFlipBook(_ref) {
40
40
  id = _ref.id,
41
41
  _ref$themeColor = _ref.themeColor,
42
42
  themeColor = _ref$themeColor === void 0 ? '#9F7D4E' : _ref$themeColor,
43
+ _ref$iconColor = _ref.iconColor,
44
+ iconColor = _ref$iconColor === void 0 ? '#0064ff' : _ref$iconColor,
43
45
  documentInfo = _ref.documentInfo,
44
46
  onBack = _ref.onBack,
45
47
  onRequestFullscreen = _ref.onRequestFullscreen,
@@ -58,6 +60,7 @@ var DocumentFlipBook = function DocumentFlipBook(_ref) {
58
60
  (0, _react.useEffect)(function () {
59
61
  (0, _utils.setupPdfWorker)(pdfWorkerSrc);
60
62
  }, [pdfWorkerSrc]);
63
+ var isFirstLoadOfDocument = (0, _react.useRef)(true);
61
64
  var _useState = (0, _react.useState)([]),
62
65
  _useState2 = _slicedToArray(_useState, 2),
63
66
  pages = _useState2[0],
@@ -82,7 +85,6 @@ var DocumentFlipBook = function DocumentFlipBook(_ref) {
82
85
  _useState12 = _slicedToArray(_useState11, 2),
83
86
  refreshKey = _useState12[0],
84
87
  setRefreshKey = _useState12[1];
85
- var isFirstLoadOfDocument = (0, _react.useRef)(true);
86
88
 
87
89
  // 内部处理全屏切换
88
90
  var handleRequestFullscreen = (0, _react.useCallback)(function () {
@@ -124,10 +126,10 @@ var DocumentFlipBook = function DocumentFlipBook(_ref) {
124
126
  setPages([]); // 立即清空旧页面,防止切换时闪烁旧数据
125
127
  setCurrent(0);
126
128
  setActiveTab('');
127
- if (flipRef.current) {
129
+ if (flipRef !== null && flipRef !== void 0 && flipRef.current) {
128
130
  try {
129
131
  var _flipRef$current;
130
- (_flipRef$current = flipRef.current) === null || _flipRef$current === void 0 || (_flipRef$current = _flipRef$current.pageFlip()) === null || _flipRef$current === void 0 || _flipRef$current.turnToPage(0);
132
+ flipRef === null || flipRef === void 0 || (_flipRef$current = flipRef.current) === null || _flipRef$current === void 0 || (_flipRef$current = _flipRef$current.pageFlip()) === null || _flipRef$current === void 0 || _flipRef$current.turnToPage(0);
131
133
  } catch (e) {
132
134
  console.warn('Reset flipbook failed', e);
133
135
  }
@@ -365,7 +367,7 @@ var DocumentFlipBook = function DocumentFlipBook(_ref) {
365
367
  while (1) switch (_context2.prev = _context2.next) {
366
368
  case 0:
367
369
  type = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : 'pdf';
368
- if (!(type === 'html')) {
370
+ if (!(type === 'epub')) {
369
371
  _context2.next = 9;
370
372
  break;
371
373
  }
@@ -542,7 +544,7 @@ var DocumentFlipBook = function DocumentFlipBook(_ref) {
542
544
  style: {
543
545
  width: '100%',
544
546
  minHeight: _utils.VIEWPORT_HEIGHT,
545
- height: '100%',
547
+ height: _utils.VIEWPORT_HEIGHT,
546
548
  objectFit: 'contain',
547
549
  objectPosition: 'center top'
548
550
  }
@@ -570,7 +572,8 @@ var DocumentFlipBook = function DocumentFlipBook(_ref) {
570
572
  onPrint: handlePrint,
571
573
  onDownload: handleDownload,
572
574
  onRefresh: handleRefresh,
573
- themeColor: themeColor
575
+ themeColor: themeColor,
576
+ iconColor: iconColor
574
577
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
575
578
  className: "dfb-stage",
576
579
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Spin, {
@@ -36,8 +36,7 @@
36
36
  }
37
37
 
38
38
  .book-view {
39
- // box-shadow: 0 0 18px rgba(0, 0, 0, 0.18);
40
- // overflow: hidden;
39
+ overflow: hidden;
41
40
  position: relative;
42
41
  z-index: 10;
43
42
  overflow: visible; // 显式设置为 visible 以显示侧边厚度装饰
@@ -45,6 +44,7 @@
45
44
 
46
45
  // 书本左侧厚度 1
47
46
  .dfb-book-thickness-left-1 {
47
+ overflow: hidden;
48
48
  position: absolute;
49
49
  top: 0;
50
50
  left: -4px;
@@ -101,6 +101,7 @@
101
101
 
102
102
  // 偶数页(第 2, 4, 6... 个子元素,对应 Page 1, 3, 5...)是左页 -> 显示左侧厚度
103
103
  &:nth-child(even) {
104
+
104
105
  .dfb-book-thickness-left-1,
105
106
  .dfb-book-thickness-left-2 {
106
107
  display: block;
@@ -109,6 +110,7 @@
109
110
 
110
111
  // 奇数页(第 1, 3, 5... 个子元素,对应 Page 0, 2, 4...)是右页 -> 显示右侧厚度
111
112
  &:nth-child(odd) {
113
+
112
114
  .dfb-book-thickness-right-1,
113
115
  .dfb-book-thickness-right-2 {
114
116
  display: block;
@@ -118,13 +120,17 @@
118
120
 
119
121
  .header-nav-btn {
120
122
  padding: 0 7px;
123
+
124
+ span {
125
+ color: #434343;
126
+ }
121
127
  }
122
128
 
123
129
  .dfb-HTMLFlipBook {
124
130
  position: relative;
125
131
  z-index: 10;
126
132
  overflow: visible; // 显式设置为 visible 以显示侧边厚度装饰
127
- background: transparent; // 改为透明,避免遮挡背景层或产生白色边框
133
+ background: #fff; // 改为透明,避免遮挡背景层或产生白色边框
128
134
  }
129
135
 
130
136
  .dfb-root {
@@ -308,9 +314,32 @@
308
314
  top: 40px;
309
315
  display: flex;
310
316
  flex-direction: column;
311
- gap: 6px; //
317
+ gap: 6px; // 正常间距
312
318
  z-index: 20;
313
319
  transition: all 0.3s ease;
320
+ max-height: calc(100vh - 140px); // 限制最大高度
321
+ padding: 10px 0; // 移除水平内边距
322
+ box-sizing: border-box;
323
+
324
+ // 当标签超过6个时,调整间距让它们重叠
325
+ &.dfb-sideTabs--overlap {
326
+ gap: -10px; // 让标签重叠
327
+
328
+ .dfb-sideTab {
329
+ min-height: 50px; // 进一步减小高度
330
+ padding: 6px 4px 6px 8px; // 更紧凑的内边距
331
+ }
332
+ }
333
+
334
+ // 当标签超过8个时,显示下拉菜单模式
335
+ &.dfb-sideTabs--dropdown {
336
+ gap: 6px; // 正常间距
337
+
338
+ .dfb-sideTab {
339
+ min-height: 60px; // 恢复正常高度
340
+ padding: 8px 4px 8px 8px; // 恢复正常内边距
341
+ }
342
+ }
314
343
 
315
344
  &.is-on-cover {
316
345
  right: -42px; // 封面是单页模式,标签需要向左移动(进入书壳内部边缘)
@@ -319,15 +348,15 @@
319
348
 
320
349
  .dfb-sideTab {
321
350
  width: 42px;
322
- min-height: 80px;
323
- padding: 12px 6px 12px 10px;
351
+ min-height: 60px; // 减小最小高度以容纳更多标签
352
+ padding: 8px 4px 8px 8px; // 优化内边距
324
353
  border: none;
325
354
  border-radius: 0 6px 6px 0;
326
355
  cursor: pointer;
327
356
  color: #fff;
328
- font-size: 13px;
357
+ font-size: 12px; // 稍微减小字体
329
358
  font-weight: 500;
330
- line-height: 1.2;
359
+ line-height: 1.3;
331
360
  writing-mode: vertical-rl;
332
361
  text-align: center;
333
362
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
@@ -337,6 +366,32 @@
337
366
  display: flex;
338
367
  align-items: center;
339
368
  justify-content: center;
369
+ flex-shrink: 0; // 防止标签被压缩
370
+ z-index: 1; // 确保标签层级正确
371
+
372
+ // "更多"按钮特殊样式
373
+ &.dfb-sideTab--more {
374
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
375
+ font-weight: bold;
376
+ animation: pulse 2s infinite;
377
+
378
+
379
+ @keyframes pulse {
380
+
381
+ 0%,
382
+ 100% {
383
+ transform: scale(1);
384
+ }
385
+
386
+ 50% {
387
+ transform: scale(1.05);
388
+ }
389
+ }
390
+
391
+ &:hover {
392
+ background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
393
+ }
394
+ }
340
395
 
341
396
  // 标签左侧的装饰条(仅在选中态或悬浮态显示,模拟折痕)
342
397
  &::before {
@@ -351,7 +406,11 @@
351
406
  opacity: 0;
352
407
  }
353
408
 
354
-
409
+ &:hover:not(.is-active):not(.dfb-sideTab--more) {
410
+ transform: translateX(-3px);
411
+ box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.15);
412
+ z-index: 10;
413
+ }
355
414
 
356
415
  &.is-active {
357
416
  position: relative;
@@ -360,8 +419,8 @@
360
419
  padding-left: 16px;
361
420
  font-weight: 700;
362
421
  box-shadow: 5px 2px 12px rgba(0, 0, 0, 0.2);
363
- z-index: 12;
364
- font-size: 14px;
422
+ z-index: 12; // 确保选中态在最上层
423
+ font-size: 13px;
365
424
 
366
425
  &::before {
367
426
  width: 8px; // 选中态条纹显示且最宽
@@ -371,11 +430,178 @@
371
430
  }
372
431
 
373
432
  .dfb-sideTabText {
374
- letter-spacing: 2px;
433
+ letter-spacing: 1px; // 减小字间距
375
434
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.1));
376
435
  }
377
436
  }
378
437
 
438
+ // 下拉菜单样式
439
+ .dfb-sideTabs__dropdown {
440
+ position: absolute;
441
+ right: 60px;
442
+ top: 0;
443
+ width: 220px;
444
+ max-height: 360px;
445
+ background: #fff;
446
+ border-radius: 12px;
447
+ box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
448
+ z-index: 1000;
449
+ overflow: hidden;
450
+ display: flex;
451
+ flex-direction: column;
452
+ animation: dropdownSlide 0.3s cubic-bezier(0.4, 0, 0.2, 1);
453
+ backdrop-filter: blur(10px);
454
+
455
+ @keyframes dropdownSlide {
456
+ from {
457
+ opacity: 0;
458
+ transform: translateX(16px) translateY(-8px);
459
+ }
460
+
461
+ to {
462
+ opacity: 1;
463
+ transform: translateX(0) translateY(0);
464
+ }
465
+ }
466
+
467
+ &::before {
468
+ content: "";
469
+ position: absolute;
470
+ right: -8px;
471
+ top: 28px;
472
+ width: 0;
473
+ height: 0;
474
+ border-top: 8px solid transparent;
475
+ border-bottom: 8px solid transparent;
476
+ border-left: 8px solid #fff;
477
+ z-index: 1001;
478
+ filter: drop-shadow(2px 0 3px rgba(0, 0, 0, 0.08));
479
+ }
480
+ }
481
+
482
+ .dfb-sideTabs__dropdown-header {
483
+ display: flex;
484
+ align-items: center;
485
+ justify-content: space-between;
486
+ padding: 8px 10px;
487
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
488
+ color: #fff;
489
+ font-weight: 600;
490
+ font-size: 14px;
491
+ letter-spacing: 0.3px;
492
+ }
493
+
494
+ .dfb-sideTabs__dropdown-close {
495
+ background: rgba(255, 255, 255, 0.18);
496
+ border: none;
497
+ color: #fff;
498
+ width: 24px;
499
+ height: 24px;
500
+ border-radius: 50%;
501
+ cursor: pointer;
502
+ display: flex;
503
+ align-items: center;
504
+ justify-content: center;
505
+ font-size: 12px;
506
+ transition: all 0.2s ease;
507
+
508
+ &:hover {
509
+ background: rgba(255, 255, 255, 0.28);
510
+ transform: rotate(90deg) scale(1.1);
511
+ }
512
+ }
513
+
514
+ .dfb-sideTabs__dropdown-content {
515
+ flex: 1;
516
+ overflow-y: auto;
517
+ padding: 6px 0;
518
+ max-height: 320px;
519
+
520
+ &::-webkit-scrollbar {
521
+ width: 4px;
522
+ }
523
+
524
+ &::-webkit-scrollbar-track {
525
+ background: #f1f1f1;
526
+ border-radius: 2px;
527
+ }
528
+
529
+ &::-webkit-scrollbar-thumb {
530
+ background: #c1c1c1;
531
+ border-radius: 2px;
532
+
533
+ &:hover {
534
+ background: #a1a1a1;
535
+ }
536
+ }
537
+ }
538
+
539
+ .dfb-sideTabs__dropdown-item {
540
+ display: flex;
541
+ align-items: center;
542
+ gap: 10px;
543
+ padding: 10px 16px;
544
+ border: none;
545
+ background: transparent;
546
+ cursor: pointer;
547
+ transition: all 0.2s ease;
548
+ width: 100%;
549
+ text-align: left;
550
+ border-left: 3px solid transparent;
551
+
552
+ &:hover {
553
+ background: #f6f7f8;
554
+ border-left-color: var(--tab-color, #667eea);
555
+ }
556
+
557
+ &.is-active {
558
+ background: rgba(102, 126, 234, 0.06);
559
+ border-left-color: var(--tab-color, #667eea);
560
+
561
+ .dfb-sideTabs__dropdown-item-text {
562
+ color: #1a1a1a;
563
+ font-weight: 600;
564
+ }
565
+
566
+ .dfb-sideTabs__dropdown-item-check {
567
+ display: flex;
568
+ align-items: center;
569
+ justify-content: center;
570
+ width: 18px;
571
+ height: 18px;
572
+ background: var(--tab-color, #667eea);
573
+ border-radius: 50%;
574
+ color: #fff;
575
+ font-size: 10px;
576
+ }
577
+ }
578
+ }
579
+
580
+ .dfb-sideTabs__dropdown-item-color {
581
+ width: 28px;
582
+ height: 28px;
583
+ border-radius: 6px;
584
+ flex-shrink: 0;
585
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
586
+ transition: transform 0.2s ease;
587
+
588
+ &:hover {
589
+ transform: scale(1.08);
590
+ }
591
+ }
592
+
593
+ .dfb-sideTabs__dropdown-item-text {
594
+ flex: 1;
595
+ font-size: 13px;
596
+ color: #333;
597
+ font-weight: 500;
598
+ }
599
+
600
+ .dfb-sideTabs__dropdown-item-check {
601
+ display: none;
602
+ font-size: 12px;
603
+ font-weight: bold;
604
+ }
379
605
  }
380
606
 
381
607
  .is-on-activeTab {
@@ -387,6 +613,7 @@
387
613
  margin: auto; // 关键:在 flex 容器中使用 margin: auto 实现完美居中且溢出时可滚动到顶部
388
614
  position: relative;
389
615
  min-width: 300px;
616
+ overflow: hidden;
390
617
  }
391
618
 
392
619
  // 方法三:背景层样式
@@ -0,0 +1,21 @@
1
+ declare module '*.png' {
2
+ const value: string;
3
+ export default value;
4
+ }
5
+
6
+ declare module '*.jpg' {
7
+ const value: string;
8
+ export default value;
9
+ }
10
+
11
+ declare module '*.jpeg' {
12
+ const value: string;
13
+ export default value;
14
+ }
15
+
16
+ declare module '*.svg' {
17
+ const value: string;
18
+ export default value;
19
+ }
20
+
21
+ declare module 'react-image-magnifiers';
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ interface VoucherEntry {
4
+ summary: string;
5
+ account: string;
6
+ debit: string;
7
+ credit: string;
8
+ trade_direction?: '借' | '贷';
9
+ amount?: string;
10
+ isTotal?: boolean;
11
+ checked?: boolean;
12
+ }
13
+ interface VoucherProps {
14
+ date?: string;
15
+ company?: string;
16
+ voucherNo?: string;
17
+ entries?: VoucherEntry[];
18
+ accountant?: string;
19
+ recorder?: string;
20
+ maker?: string;
21
+ showTotal?: boolean;
22
+ totalDebit?: string;
23
+ totalCredit?: string;
24
+ }
25
+ declare const AccountingVoucher: React.FC<VoucherProps>;
26
+ export default AccountingVoucher;