bee-front-components 1.0.0

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 (92) hide show
  1. package/config/config.ts +28 -0
  2. package/lib/assets/images/empty.png +0 -0
  3. package/lib/components/BaseModal/index.d.ts +41 -0
  4. package/lib/components/BaseModal/index.js +133 -0
  5. package/lib/components/BaseModal/index.module.less +66 -0
  6. package/lib/components/Buttons/Button.d.ts +17 -0
  7. package/lib/components/Buttons/Button.js +34 -0
  8. package/lib/components/Buttons/ButtonPermission.d.ts +18 -0
  9. package/lib/components/Buttons/ButtonPermission.js +34 -0
  10. package/lib/components/Buttons/index.d.ts +3 -0
  11. package/lib/components/Buttons/index.js +3 -0
  12. package/lib/components/Buttons/index.module.less +21 -0
  13. package/lib/components/ContentHeader/index.d.ts +17 -0
  14. package/lib/components/ContentHeader/index.js +22 -0
  15. package/lib/components/ContentHeader/index.module.less +14 -0
  16. package/lib/components/Empty/index.d.ts +17 -0
  17. package/lib/components/Empty/index.js +23 -0
  18. package/lib/components/Empty/index.module.less +15 -0
  19. package/lib/components/ExcelExport/index.d.ts +28 -0
  20. package/lib/components/ExcelExport/index.js +60 -0
  21. package/lib/components/ExcelExport/index.module.less +61 -0
  22. package/lib/components/Modal/index.d.ts +26 -0
  23. package/lib/components/Modal/index.js +191 -0
  24. package/lib/components/Modal/index.module.less +79 -0
  25. package/lib/components/PageHeader/index.d.ts +43 -0
  26. package/lib/components/PageHeader/index.js +72 -0
  27. package/lib/components/PageHeader/index.module.less +38 -0
  28. package/lib/components/PdfViewer/index.d.ts +49 -0
  29. package/lib/components/PdfViewer/index.js +699 -0
  30. package/lib/components/QueryBar/TableQueryBar.d.ts +32 -0
  31. package/lib/components/QueryBar/TableQueryBar.js +115 -0
  32. package/lib/components/QueryBar/index.d.ts +25 -0
  33. package/lib/components/QueryBar/index.js +102 -0
  34. package/lib/components/QueryBar/index.module.less +58 -0
  35. package/lib/components/RemainDay/index.d.ts +22 -0
  36. package/lib/components/RemainDay/index.js +47 -0
  37. package/lib/components/RemainDay/index.module.less +42 -0
  38. package/lib/components/Scanner/hooks/useKeyboardScanner.d.ts +14 -0
  39. package/lib/components/Scanner/hooks/useKeyboardScanner.js +95 -0
  40. package/lib/components/Scanner/index.d.ts +60 -0
  41. package/lib/components/Scanner/index.js +318 -0
  42. package/lib/components/Scanner/index.module.less +264 -0
  43. package/lib/components/Scanner/utils/device.d.ts +2 -0
  44. package/lib/components/Scanner/utils/device.js +18 -0
  45. package/lib/components/StatusTab/index.d.ts +36 -0
  46. package/lib/components/StatusTab/index.js +118 -0
  47. package/lib/components/StatusTab/index.module.less +20 -0
  48. package/lib/components/StatusTag/index.d.ts +32 -0
  49. package/lib/components/StatusTag/index.js +142 -0
  50. package/lib/components/StatusTag/index.module.less +37 -0
  51. package/lib/components/StepProgress/index.d.ts +36 -0
  52. package/lib/components/StepProgress/index.js +84 -0
  53. package/lib/components/StepProgress/index.module.less +180 -0
  54. package/lib/components/Table/index.d.ts +44 -0
  55. package/lib/components/Table/index.js +135 -0
  56. package/lib/components/Table/index.module.less +24 -0
  57. package/lib/components/TableOperationColumn/index.d.ts +45 -0
  58. package/lib/components/TableOperationColumn/index.js +205 -0
  59. package/lib/components/TableOperationColumn/index.module.less +22 -0
  60. package/lib/components/Tabs/TabGroup.d.ts +9 -0
  61. package/lib/components/Tabs/TabGroup.js +12 -0
  62. package/lib/components/Tabs/TabPane.d.ts +9 -0
  63. package/lib/components/Tabs/TabPane.js +12 -0
  64. package/lib/components/Tabs/Tabs.d.ts +23 -0
  65. package/lib/components/Tabs/Tabs.js +42 -0
  66. package/lib/components/Tabs/index.d.ts +4 -0
  67. package/lib/components/Tabs/index.js +4 -0
  68. package/lib/components/Tabs/index.module.less +20 -0
  69. package/lib/components/Upload/BatchUpload/index.d.ts +42 -0
  70. package/lib/components/Upload/BatchUpload/index.js +140 -0
  71. package/lib/components/Upload/BatchUpload/index.module.less +10 -0
  72. package/lib/components/Upload/DraggerUpload/index.d.ts +42 -0
  73. package/lib/components/Upload/DraggerUpload/index.js +142 -0
  74. package/lib/components/Upload/DraggerUpload/index.module.less +30 -0
  75. package/lib/components/Upload/FileUpload.d.ts +36 -0
  76. package/lib/components/Upload/FileUpload.js +122 -0
  77. package/lib/components/Upload/index.d.ts +4 -0
  78. package/lib/components/Upload/index.js +4 -0
  79. package/lib/components/VipFlag/index.d.ts +10 -0
  80. package/lib/components/VipFlag/index.js +23 -0
  81. package/lib/components/VipFlag/index.module.less +20 -0
  82. package/lib/typings/blank.d.ts +0 -0
  83. package/lib/typings.d.ts +3 -0
  84. package/lib/utils/const.d.ts +21 -0
  85. package/lib/utils/const.js +22 -0
  86. package/lib/utils/index.d.ts +95 -0
  87. package/lib/utils/index.js +319 -0
  88. package/lib/utils/menuTab.d.ts +60 -0
  89. package/lib/utils/menuTab.js +122 -0
  90. package/lib/utils/utils.d.ts +61 -0
  91. package/lib/utils/utils.js +270 -0
  92. package/package.json +41 -0
@@ -0,0 +1,61 @@
1
+ // 批量导出组件相关样式
2
+ .exportBtn {
3
+ .flex;
4
+ gap: 0.04rem;
5
+ transition: none;
6
+ .btnIcon {
7
+ font-size: @fontSize;
8
+ }
9
+ }
10
+
11
+ // 导出弹窗头部样式
12
+ .modalHeader {
13
+ position: relative;
14
+ width: 100%;
15
+ .headerTitle {
16
+ width: 100%;
17
+ font-size: @fontSize18;
18
+ // 遮挡标题底部空白区域
19
+ &::before {
20
+ z-index: 5;
21
+ .position(absolute, unset, -0.16rem, -0.15rem, -0.16rem);
22
+ content: "";
23
+ height: 0.15rem; // 标题的下内边距为0.16rem 需要去掉分割线的0.01rem的高度空间
24
+ background-color: @white;
25
+ }
26
+ // 标题底部分割线
27
+ &::after {
28
+ .position(absolute, unset, -0.16rem, -0.16rem, -0.16rem);
29
+ content: "";
30
+ height: 0.01rem;
31
+ background-color: @borderColor;
32
+ }
33
+ }
34
+ }
35
+
36
+ .modalContent {
37
+ width: 5.2rem;
38
+ :global {
39
+ .c7n-pro-modal-content.c7n-pro-modal-content {
40
+ .c7n-pro-modal-body.c7n-pro-modal-body {
41
+ padding: 0 0.16rem;
42
+ .c7n-card.c7n-card {
43
+ margin: 0;
44
+ .c7n-card-head,
45
+ .c7n-card-body {
46
+ margin: 0;
47
+ }
48
+ }
49
+ }
50
+ .c7n-pro-modal-footer.c7n-pro-modal-footer {
51
+ border-top: 0.01rem solid @borderColor;
52
+ }
53
+ }
54
+ }
55
+ }
56
+
57
+ .cancelBtn,
58
+ .okBtn {
59
+ .flex;
60
+ flex: 1;
61
+ }
@@ -0,0 +1,26 @@
1
+ /// <reference types="react" />
2
+ /// <reference types="react" />
3
+ /// <reference types="trusted-types" />
4
+ /// <reference types="prop-types" />
5
+ import type { ModalProps } from "choerodon-ui/pro/lib/modal/Modal";
6
+ interface IConfig extends ModalProps {
7
+ /** 弹窗宽度 */
8
+ width?: number | string;
9
+ /** 标题位置 */
10
+ titlePosition?: "top" | "center";
11
+ /** 是否显示icon图标 */
12
+ iconVisible?: boolean;
13
+ /** icon图标类别名称 icon-xxx */
14
+ iconName?: string;
15
+ /** icon图标自定义样式类名 */
16
+ iconClass?: string;
17
+ /** 主体区域内容 */
18
+ content?: React.ReactNode;
19
+ }
20
+ declare const Modal: {
21
+ open: (e?: IConfig) => void;
22
+ confirm: (e?: Omit<IConfig, "header">) => void;
23
+ error: (e?: Omit<IConfig, "header">) => void;
24
+ warning: (e?: Omit<IConfig, "header">) => void;
25
+ };
26
+ export { Modal };
@@ -0,0 +1,191 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _Modal from "@hzero-front-ui/c7n-ui/lib/ModalPro";
3
+ import React from "react";
4
+ /**
5
+ * @name 通用Modal组件
6
+ * @description 基于 choerodon-ui/pro Modal组件二次封装 应用于不同场景的样式呈现
7
+ * @author lichen
8
+ */
9
+ import classNames from "classnames";
10
+ import { ButtonColor, FuncType } from "choerodon-ui/pro/lib/button/enum";
11
+ import styles from "./index.module.less?modules";
12
+
13
+ // 页脚区域参数
14
+
15
+ // 头部区域参数
16
+
17
+ // 弹窗对外暴露函数入参
18
+
19
+ // 公共配置项
20
+ const COMMON_CONFIG = {
21
+ width: "6rem",
22
+ autoCenter: true,
23
+ okText: "确定",
24
+ cancelText: "取消",
25
+ closable: true,
26
+ maskClosable: false,
27
+ okProps: {
28
+ className: styles.okBtn,
29
+ color: "primary",
30
+ funcType: "raised"
31
+ },
32
+ cancelProps: {
33
+ className: styles.cancelBtn,
34
+ color: "default",
35
+ funcType: "raised"
36
+ }
37
+ };
38
+
39
+ // 自定义头部样式
40
+ const ModalHeader = e => /*#__PURE__*/React.createElement("div", {
41
+ className: styles.modalHeader
42
+ }, (e === null || e === void 0 ? void 0 : e.titlePosition) === "top" && /*#__PURE__*/React.createElement("div", {
43
+ className: styles.headerTitle
44
+ }, e === null || e === void 0 ? void 0 : e.title), !!(e !== null && e !== void 0 && e.closable) && /*#__PURE__*/React.createElement("div", {
45
+ className: styles.closeIcon
46
+ }, e === null || e === void 0 ? void 0 : e.closeBtn));
47
+
48
+ // 自定义主体区域内容样式
49
+ const ModalContent = e => /*#__PURE__*/React.createElement("div", {
50
+ className: classNames(styles.modalContent, {
51
+ [styles.contentHasTitle]: (e === null || e === void 0 ? void 0 : e.titlePosition) === "center"
52
+ })
53
+ }, (e === null || e === void 0 ? void 0 : e.iconVisible) && /*#__PURE__*/React.createElement("i", {
54
+ className: classNames("iconfont", e === null || e === void 0 ? void 0 : e.iconName, styles.icon, e === null || e === void 0 ? void 0 : e.iconClass)
55
+ }), (e === null || e === void 0 ? void 0 : e.titlePosition) === "center" && (e === null || e === void 0 ? void 0 : e.title) && /*#__PURE__*/React.createElement("div", {
56
+ className: styles.title
57
+ }, e.title), (e === null || e === void 0 ? void 0 : e.content) && /*#__PURE__*/React.createElement("div", {
58
+ className: styles.content
59
+ }, e.content));
60
+
61
+ // 自定义页脚区域内容样式
62
+ const ModalFooter = e => {
63
+ const okButton = e === null || e === void 0 ? void 0 : e.okButton,
64
+ cancelButton = e === null || e === void 0 ? void 0 : e.cancelButton;
65
+ if (okButton === false && cancelButton === false) {
66
+ return null;
67
+ }
68
+ return /*#__PURE__*/React.createElement("div", {
69
+ className: styles.modalFooter
70
+ }, cancelButton !== false && (e === null || e === void 0 ? void 0 : e.cancelBtn), okButton !== false && (e === null || e === void 0 ? void 0 : e.okBtn));
71
+ };
72
+
73
+ // 判断非未定义字段即显示某元素 node --- 需要判断的元素 defNode --- 判断元素不符合条件时展示的默认元素
74
+ function checkNodeNotUndefined(node, defNode) {
75
+ if (node !== undefined) {
76
+ return node;
77
+ }
78
+ return defNode;
79
+ }
80
+
81
+ // 合并弹窗配置属性
82
+ function mergeModalConfig(e) {
83
+ const style = {
84
+ width: (e === null || e === void 0 ? void 0 : e.width) || COMMON_CONFIG.width
85
+ };
86
+ const config = {
87
+ ...COMMON_CONFIG,
88
+ ...e,
89
+ style: {
90
+ ...style,
91
+ ...(e === null || e === void 0 ? void 0 : e.style)
92
+ }
93
+ };
94
+ return config;
95
+ }
96
+
97
+ // 自定义弹窗对象
98
+ const Modal = {
99
+ // 普通打开函数
100
+ open: e => {
101
+ const mergeConfig = mergeModalConfig({
102
+ titlePosition: "top",
103
+ ...e
104
+ });
105
+ _Modal.open({
106
+ header: checkNodeNotUndefined(e === null || e === void 0 ? void 0 : e.header, (mergeConfig === null || mergeConfig === void 0 ? void 0 : mergeConfig.titlePosition) === "top" ? (title, closeBtn) => /*#__PURE__*/React.createElement(ModalHeader, _extends({
107
+ title: title,
108
+ closeBtn: closeBtn
109
+ }, mergeConfig)) : null),
110
+ children: checkNodeNotUndefined(e === null || e === void 0 ? void 0 : e.children, /*#__PURE__*/React.createElement(ModalContent, mergeConfig)),
111
+ footer: checkNodeNotUndefined(e === null || e === void 0 ? void 0 : e.footer, (okBtn, cancelBtn) => /*#__PURE__*/React.createElement(ModalFooter, _extends({
112
+ okBtn: okBtn,
113
+ cancelBtn: cancelBtn
114
+ }, mergeConfig))),
115
+ ...mergeConfig
116
+ });
117
+ },
118
+ // 通用确认函数
119
+ confirm: e => {
120
+ const mergeConfig = mergeModalConfig({
121
+ width: "4.8rem",
122
+ ...e
123
+ });
124
+ _Modal.open({
125
+ header: (_title, closeBtn) => /*#__PURE__*/React.createElement(ModalHeader, _extends({
126
+ closeBtn: closeBtn
127
+ }, mergeConfig)),
128
+ children: checkNodeNotUndefined(e === null || e === void 0 ? void 0 : e.children, /*#__PURE__*/React.createElement(ModalContent, _extends({
129
+ iconVisible: true,
130
+ iconName: "icon-jingshi"
131
+ }, mergeConfig, {
132
+ titlePosition: "center",
133
+ iconClass: styles.confirmIcon
134
+ }))),
135
+ footer: checkNodeNotUndefined(e === null || e === void 0 ? void 0 : e.footer, (okBtn, cancelBtn) => /*#__PURE__*/React.createElement(ModalFooter, _extends({
136
+ okBtn: okBtn,
137
+ cancelBtn: cancelBtn
138
+ }, mergeConfig))),
139
+ ...mergeConfig
140
+ });
141
+ },
142
+ // 通用错误提示函数
143
+ error: e => {
144
+ const mergeConfig = mergeModalConfig({
145
+ width: "4.8rem",
146
+ ...e
147
+ });
148
+ _Modal.open({
149
+ header: (_title, closeBtn) => /*#__PURE__*/React.createElement(ModalHeader, _extends({
150
+ closeBtn: closeBtn
151
+ }, mergeConfig)),
152
+ children: checkNodeNotUndefined(e === null || e === void 0 ? void 0 : e.children, /*#__PURE__*/React.createElement(ModalContent, _extends({
153
+ iconVisible: true,
154
+ iconName: "icon-shibai"
155
+ }, mergeConfig, {
156
+ titlePosition: "center",
157
+ iconClass: styles.errorIcon
158
+ }))),
159
+ footer: checkNodeNotUndefined(e === null || e === void 0 ? void 0 : e.footer, (okBtn, cancelBtn) => /*#__PURE__*/React.createElement(ModalFooter, _extends({
160
+ okBtn: okBtn,
161
+ cancelBtn: cancelBtn
162
+ }, mergeConfig))),
163
+ ...mergeConfig
164
+ });
165
+ },
166
+ // 通用告警函数
167
+ warning: e => {
168
+ const mergeConfig = mergeModalConfig({
169
+ width: "4.8rem",
170
+ ...e
171
+ });
172
+ _Modal.open({
173
+ header: (_title, closeBtn) => /*#__PURE__*/React.createElement(ModalHeader, _extends({
174
+ closeBtn: closeBtn
175
+ }, mergeConfig)),
176
+ children: checkNodeNotUndefined(e === null || e === void 0 ? void 0 : e.children, /*#__PURE__*/React.createElement(ModalContent, _extends({
177
+ iconVisible: true,
178
+ iconName: "icon-jingshi"
179
+ }, mergeConfig, {
180
+ titlePosition: "center",
181
+ iconClass: styles.warningIcon
182
+ }))),
183
+ footer: checkNodeNotUndefined(e === null || e === void 0 ? void 0 : e.footer, (okBtn, cancelBtn) => /*#__PURE__*/React.createElement(ModalFooter, _extends({
184
+ okBtn: okBtn,
185
+ cancelBtn: cancelBtn
186
+ }, mergeConfig))),
187
+ ...mergeConfig
188
+ });
189
+ }
190
+ };
191
+ export { Modal };
@@ -0,0 +1,79 @@
1
+ // Modal弹窗通用样式
2
+ .modalHeader {
3
+ position: relative;
4
+ width: 100%;
5
+ .headerTitle {
6
+ .flex;
7
+ width: 100%;
8
+ font-size: @fontSize20;
9
+ // 遮挡标题底部空白区域
10
+ &::before {
11
+ z-index: 5;
12
+ .position(absolute, unset, -0.16rem, -0.15rem, -0.16rem);
13
+ content: "";
14
+ height: 0.15rem; // 标题的下内边距为0.16rem 需要去掉分割线的0.01rem的高度空间
15
+ background-color: @white;
16
+ }
17
+ // 标题底部分割线
18
+ &::after {
19
+ .position(absolute, unset, -0.16rem, -0.16rem, -0.16rem);
20
+ content: "";
21
+ height: 0.01rem;
22
+ background-color: @borderColor;
23
+ }
24
+ }
25
+ .closeIcon {
26
+ .position(absolute, 0, 0);
27
+ :global {
28
+ .c7n-pro-modal-header-button {
29
+ width: auto;
30
+ }
31
+ .icon-close {
32
+ font-size: @mediumFont;
33
+ color: @minorWord;
34
+ }
35
+ }
36
+ }
37
+ }
38
+
39
+ .modalContent {
40
+ width: 100%;
41
+ padding: 0 0.16rem;
42
+ &.contentHasTitle {
43
+ .flex(column, flex-start);
44
+ gap: 0.24rem;
45
+ }
46
+ .content {
47
+ width: 100%;
48
+ }
49
+ .icon {
50
+ line-height: normal;
51
+ font-size: @superHugeFont;
52
+ &.confirmIcon {
53
+ color: @primaryColor;
54
+ }
55
+ &.errorIcon {
56
+ color: @errorColor;
57
+ }
58
+ &.warningIcon {
59
+ color: @warnColor;
60
+ }
61
+ }
62
+
63
+ .title {
64
+ font-size: @fontSize20;
65
+ font-weight: 500;
66
+ }
67
+ }
68
+
69
+ .modalFooter {
70
+ .flex(@justify: space-between);
71
+ width: 100%;
72
+ padding: 0.08rem 0.16rem 0.16rem;
73
+ gap: 0.14rem;
74
+ .cancelBtn,
75
+ .okBtn {
76
+ .flex;
77
+ flex: 1;
78
+ }
79
+ }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * @name HeaderContainer - 页面通用头部容器
3
+ * @description 支持左侧返回按钮、居中标题、右侧自定义内容区域,适用于列表/表单等页面的统一头部布局。
4
+ * @param {string} title 标题
5
+ * @param {boolean} backVisible 是否显示返回按钮
6
+ * @param {string} backPath 返回目标页面路径
7
+ * @param {string} backTitle 返回目标页面页签标题
8
+ * @param {ReactNode} leftChildren 左侧区域自定义内容
9
+ * @param {ReactNode} leftChildren 右侧区域自定义内容
10
+ * @param {function} onBack 自定义返回函数
11
+ * @param {function} backCallback 执行默认返回操作之后的其他回调操作函数
12
+ * @example
13
+ * ```tsx
14
+ * <PageHeader
15
+ * title="委托报告"
16
+ * onClose={() => refreshTab()}
17
+ * rightChildren={<Button>导出</Button>}
18
+ * />
19
+ * ```
20
+ */
21
+ import React from "react";
22
+ interface IPageHeaderProps {
23
+ /** 标题 */
24
+ title?: string;
25
+ /** 是否显示返回按钮 */
26
+ backVisible?: boolean;
27
+ /** 是否刷新当前标签页 */
28
+ isBackRefresh?: boolean;
29
+ /** 返回按钮路径 */
30
+ backPath?: string;
31
+ /** 返回按钮路径 */
32
+ backTitle?: string;
33
+ /** 左侧区域自定义内容 */
34
+ leftChildren?: React.ReactNode;
35
+ /** 右侧区域自定义内容 */
36
+ rightChildren?: React.ReactNode;
37
+ /** 自定义返回函数 */
38
+ onBack?: () => void;
39
+ /** 执行默认返回操作之后的其他回调操作函数 */
40
+ backCallback?: () => void;
41
+ }
42
+ declare const PageHeader: React.FC<IPageHeaderProps>;
43
+ export default PageHeader;
@@ -0,0 +1,72 @@
1
+ /**
2
+ * @name HeaderContainer - 页面通用头部容器
3
+ * @description 支持左侧返回按钮、居中标题、右侧自定义内容区域,适用于列表/表单等页面的统一头部布局。
4
+ * @param {string} title 标题
5
+ * @param {boolean} backVisible 是否显示返回按钮
6
+ * @param {string} backPath 返回目标页面路径
7
+ * @param {string} backTitle 返回目标页面页签标题
8
+ * @param {ReactNode} leftChildren 左侧区域自定义内容
9
+ * @param {ReactNode} leftChildren 右侧区域自定义内容
10
+ * @param {function} onBack 自定义返回函数
11
+ * @param {function} backCallback 执行默认返回操作之后的其他回调操作函数
12
+ * @example
13
+ * ```tsx
14
+ * <PageHeader
15
+ * title="委托报告"
16
+ * onClose={() => refreshTab()}
17
+ * rightChildren={<Button>导出</Button>}
18
+ * />
19
+ * ```
20
+ */
21
+ import React from "react";
22
+ import { FuncType } from "choerodon-ui/pro/lib/button/enum";
23
+ import { backTab } from "../../utils/menuTab";
24
+ import { Button } from "../Buttons";
25
+ import styles from "./index.module.less?modules";
26
+ const PageHeader = props => {
27
+ const title = props.title,
28
+ _props$backVisible = props.backVisible,
29
+ backVisible = _props$backVisible === void 0 ? true : _props$backVisible,
30
+ _props$isBackRefresh = props.isBackRefresh,
31
+ isBackRefresh = _props$isBackRefresh === void 0 ? false : _props$isBackRefresh,
32
+ backPath = props.backPath,
33
+ backTitle = props.backTitle,
34
+ leftChildren = props.leftChildren,
35
+ rightChildren = props.rightChildren,
36
+ onBack = props.onBack,
37
+ backCallback = props.backCallback;
38
+
39
+ // 点击返回按钮
40
+ function handleBack() {
41
+ // 先判断是否有自定义返回操作
42
+ if (typeof onBack === "function") {
43
+ onBack();
44
+ return;
45
+ }
46
+ // 执行默认返回操作 关闭当前标签页
47
+ backTab(backPath ? {
48
+ title: backTitle || "",
49
+ path: backPath,
50
+ isRefresh: isBackRefresh
51
+ } : undefined);
52
+ if (typeof backCallback === "function") {
53
+ backCallback();
54
+ }
55
+ }
56
+ return /*#__PURE__*/React.createElement("div", {
57
+ className: styles.header
58
+ }, /*#__PURE__*/React.createElement("div", {
59
+ className: styles.headerLeft
60
+ }, backVisible && /*#__PURE__*/React.createElement(Button, {
61
+ icon: "icon-fanhui",
62
+ funcType: "raised",
63
+ onClick: handleBack
64
+ }, "\u8FD4\u56DE"), leftChildren), /*#__PURE__*/React.createElement("div", {
65
+ className: styles.titleContainer
66
+ }, /*#__PURE__*/React.createElement("div", {
67
+ className: styles.title
68
+ }, title)), /*#__PURE__*/React.createElement("div", {
69
+ className: styles.headerRight
70
+ }, rightChildren));
71
+ };
72
+ export default PageHeader;
@@ -0,0 +1,38 @@
1
+ .header {
2
+ position: relative;
3
+ height: 0.68rem;
4
+ padding: 0 0.24rem;
5
+ border-bottom: 0.01rem solid @borderColor;
6
+ .flex(@justify: space-between, @wrap: nowrap);
7
+ .backBtnContent {
8
+ .flex(@align: center, @wrap: nowrap);
9
+ .backIcon {
10
+ width: 0.24rem;
11
+ height: 0.24rem;
12
+ margin-right: 0.08rem;
13
+ }
14
+ }
15
+ .titleContainer {
16
+ padding: 0.08rem 0.2rem;
17
+ border-radius: 0.08rem;
18
+ width: 5.2rem;
19
+ overflow: hidden;
20
+ text-align: center;
21
+ position: absolute;
22
+ left: 50%;
23
+ transform: translateX(-50%); /* 精准水平居中 */
24
+ .title {
25
+ font-size: 0.24rem;
26
+ font-weight: 500;
27
+ color: @primaryWord;
28
+ line-height: 0.24rem;
29
+ overflow: hidden;
30
+ text-overflow: ellipsis;
31
+ white-space: nowrap;
32
+ }
33
+ }
34
+ .headerLeft,
35
+ .headerRight {
36
+ .flex(@align: center, @wrap: nowrap);
37
+ }
38
+ }
@@ -0,0 +1,49 @@
1
+ /**
2
+ * @name PdfViewer 轻量 PDF 预览组件(基于 pdfjs-dist)
3
+ * @description
4
+ * - 多实例:每个实例独立 getDocument,各自拥有独立 worker,可左右分屏对比多份文档
5
+ * - 懒加载:IntersectionObserver 仅渲染可视区页面(可提前 rootMargin 预渲染),滚动顺滑
6
+ * - 文档级 LRU 缓存:同批次/委托单多份文档来回切换时秒开,LRU 上限避免 90+ 份大单场景内存爆炸
7
+ * - 联动:暴露 scrollToPage / onVisiblePageChange,可做多实例同步滚动
8
+ * - 缩放:右下角工具栏按钮(缩放/比例显示),或 Ctrl/Cmd + 滚轮 / 双指捏合(替代浏览器默认缩放),按锚点保持缩放前后内容位置
9
+ * - 定位:url 携带 #page=N 片段(如 xxx.pdf#page=3)时,文档加载完成后自动滚动到对应页
10
+ *
11
+ * @note worker 部署
12
+ * pdf.js 解析运行在 Web Worker 中,需要加载 pdf.worker.min.js:
13
+ * 请将 node_modules/pdfjs-dist/build/pdf.worker.min.js 复制到应用静态根目录(dist/),
14
+ * 或通过 <PdfViewer workerSrc="..." /> 指定可访问地址。
15
+ * 若 worker 加载失败,pdf.js 会自动降级为 fake worker(主线程解析),功能可用但会阻塞 UI。
16
+ */
17
+ import React from "react";
18
+ export declare function configurePdfWorker(src: string): void;
19
+ export interface PdfViewerProps {
20
+ /** PDF 文件地址 */
21
+ url: string | undefined;
22
+ /** pdf.js worker 地址,默认同源 /pdf.worker.min.js */
23
+ workerSrc?: string;
24
+ /** 初始缩放(物理像素倍率),默认 1;挂载后由 Ctrl/Cmd+滚轮 / 双指捏合接管 */
25
+ scale?: number;
26
+ /** 滚动容器高度,默认 100% */
27
+ height?: number | string;
28
+ /** 页面间距,默认 8 */
29
+ gap?: number;
30
+ /** 是否懒加载(仅渲染可视页),默认 true */
31
+ lazy?: boolean;
32
+ /** 文档加载完成回调 */
33
+ onLoad?: (doc: any) => void;
34
+ /** 文档加载失败回调 */
35
+ onError?: (err: any) => void;
36
+ /** 当前可见页变化回调(用于多实例联动/同步滚动) */
37
+ onVisiblePageChange?: (pageNum: number) => void;
38
+ className?: string;
39
+ }
40
+ export interface PdfViewerRef {
41
+ /** 滚动到指定页(1 起) */
42
+ scrollToPage: (pageNum: number) => void;
43
+ /** 当前可见页(1 起) */
44
+ getCurrentPage: () => number;
45
+ /** 内部 PDFDocumentProxy */
46
+ getDocument: () => any;
47
+ }
48
+ declare const PdfViewer: React.ForwardRefExoticComponent<PdfViewerProps & React.RefAttributes<PdfViewerRef>>;
49
+ export default PdfViewer;