@zero-library/common 2.2.14 → 2.3.1
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.
- package/dist/index.cjs.js +5837 -3014
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +876 -587
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +173 -19
- package/dist/index.d.ts +173 -19
- package/dist/index.esm.js +5777 -2958
- package/dist/index.esm.js.map +1 -1
- package/package.json +28 -22
package/dist/index.d.mts
CHANGED
|
@@ -20,7 +20,7 @@ interface AudioPlayerProps {
|
|
|
20
20
|
* 提供基本的音频播放功能
|
|
21
21
|
* @param props - 组件属性
|
|
22
22
|
*/
|
|
23
|
-
declare const _default$
|
|
23
|
+
declare const _default$r: ({ fileUrl }: AudioPlayerProps) => react_jsx_runtime.JSX.Element;
|
|
24
24
|
|
|
25
25
|
/** Docx文档预览组件的属性接口 */
|
|
26
26
|
interface DocxPreviewProps {
|
|
@@ -33,7 +33,7 @@ interface DocxPreviewProps {
|
|
|
33
33
|
* Docx文档预览组件
|
|
34
34
|
* @param props - 组件属性
|
|
35
35
|
*/
|
|
36
|
-
declare const _default$
|
|
36
|
+
declare const _default$q: ({ fileUrl, scale }: DocxPreviewProps) => react_jsx_runtime.JSX.Element;
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* 文件图标组件属性接口
|
|
@@ -59,7 +59,7 @@ interface FileIconProps {
|
|
|
59
59
|
* @param props - 组件属性
|
|
60
60
|
* @returns 对应文件类型的图标
|
|
61
61
|
*/
|
|
62
|
-
declare const _default$
|
|
62
|
+
declare const _default$p: ({ suffix, fontSize }: FileIconProps) => react_jsx_runtime.JSX.Element;
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
65
|
* 文件预览组件属性接口
|
|
@@ -85,17 +85,15 @@ interface FilePreviewProps {
|
|
|
85
85
|
/** 页码变化回调 */
|
|
86
86
|
onSetPageNo?: (pageNo: number) => void;
|
|
87
87
|
};
|
|
88
|
-
/** 文件参数 */
|
|
89
|
-
fileParams?: ObjectType<string>;
|
|
90
88
|
/** 密码设置成功回调 */
|
|
91
|
-
|
|
89
|
+
onSetPassword?: (password: string) => void;
|
|
92
90
|
}
|
|
93
91
|
/**
|
|
94
92
|
* 文件预览组件
|
|
95
93
|
* 支持图片、PDF、视频、音频、Markdown等文件格式的预览
|
|
96
94
|
* @param props - 组件属性
|
|
97
95
|
*/
|
|
98
|
-
declare const _default$
|
|
96
|
+
declare const _default$o: ({ suffix, fileUrl, pdfParams, password, searchValue, emptyProps, onSetPassword }: FilePreviewProps) => react_jsx_runtime.JSX.Element;
|
|
99
97
|
|
|
100
98
|
/**
|
|
101
99
|
* 文件预览抽屉组件属性接口
|
|
@@ -125,7 +123,7 @@ interface FilePreviewDrawerProps extends FilePreviewProps {
|
|
|
125
123
|
* @param props - 组件属性
|
|
126
124
|
* @returns 文件预览抽屉组件
|
|
127
125
|
*/
|
|
128
|
-
declare const _default$
|
|
126
|
+
declare const _default$n: ({ open, title, onClose, ...props }: FilePreviewDrawerProps) => react_jsx_runtime.JSX.Element;
|
|
129
127
|
|
|
130
128
|
/**
|
|
131
129
|
* Markdown预览组件属性接口
|
|
@@ -141,7 +139,27 @@ interface MarkdownPreviewProps {
|
|
|
141
139
|
* 从指定URL获取Markdown内容并渲染显示
|
|
142
140
|
* @param props - 组件属性
|
|
143
141
|
*/
|
|
144
|
-
declare const _default$
|
|
142
|
+
declare const _default$m: ({ fileUrl, searchValue }: MarkdownPreviewProps) => react_jsx_runtime.JSX.Element;
|
|
143
|
+
|
|
144
|
+
interface PdfImagePreviewProps {
|
|
145
|
+
/** PDF文件URL地址 */
|
|
146
|
+
fileUrl: string;
|
|
147
|
+
/** 当前页码 */
|
|
148
|
+
pageNo?: number;
|
|
149
|
+
/** 缩放比例,默认为1 */
|
|
150
|
+
scale?: number;
|
|
151
|
+
/** 是否显示缩略图,默认为true */
|
|
152
|
+
isHasThumbnails?: boolean;
|
|
153
|
+
/** 页码变化回调 */
|
|
154
|
+
onSetPageNo?: (pageNo: number) => void;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* PDF图片预览组件 模仿pdf预览
|
|
158
|
+
* 支持虚拟滚动、缩放、缩略图导航等功能
|
|
159
|
+
* @param props - 组件属性
|
|
160
|
+
* 适用于大量PDF页面的高效展示
|
|
161
|
+
*/
|
|
162
|
+
declare const _default$l: ({ fileUrl, pageNo, scale, isHasThumbnails, onSetPageNo }: PdfImagePreviewProps) => react_jsx_runtime.JSX.Element;
|
|
145
163
|
|
|
146
164
|
/**
|
|
147
165
|
* PDF预览组件属性接口
|
|
@@ -167,8 +185,9 @@ interface PdfPreviewProps {
|
|
|
167
185
|
* 基于react-pdf-viewer实现的PDF文件预览功能
|
|
168
186
|
* 支持密码保护、缩略图、缩放、页面导航等功能
|
|
169
187
|
* @param props - 组件属性
|
|
188
|
+
* TODO 放大缩小会丢失分页
|
|
170
189
|
*/
|
|
171
|
-
declare const _default$
|
|
190
|
+
declare const _default$k: ({ password, fileUrl, pageNo, scale, isHasThumbnails, onSetPassword, onSetPageNo }: PdfPreviewProps) => react_jsx_runtime.JSX.Element;
|
|
172
191
|
|
|
173
192
|
/**
|
|
174
193
|
* 视频播放器组件属性接口
|
|
@@ -182,7 +201,7 @@ interface VideoPlayerProps {
|
|
|
182
201
|
* 提供基本的视频播放功能
|
|
183
202
|
* @param props - 组件属性
|
|
184
203
|
*/
|
|
185
|
-
declare const _default$
|
|
204
|
+
declare const _default$j: ({ fileUrl }: VideoPlayerProps) => react_jsx_runtime.JSX.Element;
|
|
186
205
|
|
|
187
206
|
/**
|
|
188
207
|
* Iframe组件属性接口
|
|
@@ -204,7 +223,7 @@ interface IframeProps {
|
|
|
204
223
|
* 支持加载状态、URL参数处理、防缓存等功能
|
|
205
224
|
* @param props - 组件属性
|
|
206
225
|
*/
|
|
207
|
-
declare const _default$
|
|
226
|
+
declare const _default$i: react.ForwardRefExoticComponent<IframeProps & react.RefAttributes<HTMLIFrameElement>>;
|
|
208
227
|
|
|
209
228
|
/**
|
|
210
229
|
* 组件映射类型,用于延时加载
|
|
@@ -231,7 +250,93 @@ interface LazyComponentProps {
|
|
|
231
250
|
* 使用示例:<LazyComponent type="renderMarkdown" data={{}} loading={true} />
|
|
232
251
|
* @param props - 组件属性
|
|
233
252
|
*/
|
|
234
|
-
declare const _default$
|
|
253
|
+
declare const _default$h: ({ type, customComponents, unknownContent, ...rest }: LazyComponentProps) => string | number | true | react_jsx_runtime.JSX.Element | Iterable<react.ReactNode>;
|
|
254
|
+
|
|
255
|
+
declare const ANNOTATION_ATTRS: readonly ["annotation-id", "user-name", "user-id", "update-time", "content"];
|
|
256
|
+
/**
|
|
257
|
+
* 批注功能配置
|
|
258
|
+
*/
|
|
259
|
+
interface AnnotationsProps {
|
|
260
|
+
/** 是否启用批注功能,默认为false */
|
|
261
|
+
enabled: boolean;
|
|
262
|
+
/** 当前用户 */
|
|
263
|
+
user: {
|
|
264
|
+
id: string;
|
|
265
|
+
name: string;
|
|
266
|
+
};
|
|
267
|
+
/** 是否显示批注列表,默认为true */
|
|
268
|
+
showList?: boolean;
|
|
269
|
+
/** 受控属性:批注列表是否可见 */
|
|
270
|
+
visible?: boolean;
|
|
271
|
+
/** 受控属性:批注列表可见性改变回调 */
|
|
272
|
+
onVisibleChange?: (visible: boolean) => void;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* 批注功能配置接口
|
|
276
|
+
*/
|
|
277
|
+
interface AnnotationConfig extends AnnotationsProps {
|
|
278
|
+
getContainer?: () => HTMLElement | null;
|
|
279
|
+
}
|
|
280
|
+
type AnnotationType = {
|
|
281
|
+
from: number;
|
|
282
|
+
to: number;
|
|
283
|
+
} & {
|
|
284
|
+
[key in (typeof ANNOTATION_ATTRS)[number]]: string;
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
declare const COLLECTION_ATTRS: readonly ["collection-id", "user-name", "user-id", "update-time", "page-no"];
|
|
288
|
+
type CollectionType = {
|
|
289
|
+
text: string;
|
|
290
|
+
from: number;
|
|
291
|
+
to: number;
|
|
292
|
+
pageNo?: string;
|
|
293
|
+
} & {
|
|
294
|
+
[key in (typeof COLLECTION_ATTRS)[number]]: string;
|
|
295
|
+
};
|
|
296
|
+
/**
|
|
297
|
+
* 收录功能配置
|
|
298
|
+
*/
|
|
299
|
+
interface CollectionsProps {
|
|
300
|
+
/** 是否启用批注功能,默认为false */
|
|
301
|
+
enabled: boolean;
|
|
302
|
+
/** 当前用户 */
|
|
303
|
+
user: {
|
|
304
|
+
id: string;
|
|
305
|
+
name: string;
|
|
306
|
+
};
|
|
307
|
+
/** 是否显示收录列表,默认为true */
|
|
308
|
+
showList?: boolean;
|
|
309
|
+
/** 受控属性:批注列表是否可见 */
|
|
310
|
+
visible?: boolean;
|
|
311
|
+
/** 受控属性:批注列表可见性改变回调 */
|
|
312
|
+
onVisibleChange?: (visible: boolean) => void;
|
|
313
|
+
/**
|
|
314
|
+
* 创建收录的回调
|
|
315
|
+
* @param data 收录数据
|
|
316
|
+
* @returns 返回收录ID(如果有),返回Promise
|
|
317
|
+
*/
|
|
318
|
+
onBeforeCreate?: (data: {
|
|
319
|
+
content: string;
|
|
320
|
+
pageNo?: number;
|
|
321
|
+
}) => Promise<string>;
|
|
322
|
+
/**
|
|
323
|
+
* 自定义渲染收录列表项
|
|
324
|
+
* @param props 列表项数据及操作
|
|
325
|
+
* @returns React节点
|
|
326
|
+
*/
|
|
327
|
+
renderItem?: (props: {
|
|
328
|
+
collection: CollectionType;
|
|
329
|
+
isSelected: boolean;
|
|
330
|
+
onSelect: () => void;
|
|
331
|
+
onDelete: () => void;
|
|
332
|
+
}) => React.ReactNode;
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* 收录功能配置接口
|
|
336
|
+
*/
|
|
337
|
+
interface CollectionConfig extends CollectionsProps {
|
|
338
|
+
getContainer?: () => HTMLElement | null;
|
|
339
|
+
}
|
|
235
340
|
|
|
236
341
|
/**
|
|
237
342
|
* Markdown编辑器组件属性接口
|
|
@@ -245,16 +350,24 @@ interface MarkdownEditorProps {
|
|
|
245
350
|
value?: string;
|
|
246
351
|
/** 内容变化回调 */
|
|
247
352
|
onChange?: (value: string) => void;
|
|
248
|
-
/** 页面滚动回调 */
|
|
249
|
-
onScrollPage?: (pageIndex: number) => void;
|
|
250
353
|
/** 额外导航内容 */
|
|
251
354
|
extraNav?: ReactNode;
|
|
252
355
|
/** 是否显示工具栏,默认为true */
|
|
253
356
|
showToolbar?: boolean;
|
|
254
357
|
/** 引用文本回调 */
|
|
255
|
-
onQuote?: (text
|
|
358
|
+
onQuote?: (text?: string, markdown?: string) => void;
|
|
256
359
|
/** 文件下载回调 */
|
|
257
360
|
onDownloadFile?: (fileContent: string, targetFormat?: string) => Promise<void>;
|
|
361
|
+
/** 批注功能配置对象 */
|
|
362
|
+
annotationConfig?: AnnotationConfig;
|
|
363
|
+
/** 收录功能专属配置,不与批注混淆 */
|
|
364
|
+
collectionConfig?: CollectionConfig;
|
|
365
|
+
pageNoConfig?: {
|
|
366
|
+
/** 是否启用分页功能,默认为false */
|
|
367
|
+
enabled: boolean;
|
|
368
|
+
/** 页面滚动回调 */
|
|
369
|
+
onScrollPage?: (pageIndex: number) => void;
|
|
370
|
+
};
|
|
258
371
|
}
|
|
259
372
|
/**
|
|
260
373
|
* Markdown编辑器组件
|
|
@@ -262,7 +375,30 @@ interface MarkdownEditorProps {
|
|
|
262
375
|
* 提供丰富的编辑功能:格式化、链接、图片、表格、高亮等
|
|
263
376
|
* @param props - 组件属性
|
|
264
377
|
*/
|
|
265
|
-
declare const _default$
|
|
378
|
+
declare const _default$g: ({ value, onChange, searchValue, disabled, extraNav, showToolbar, onQuote, onDownloadFile, annotationConfig, collectionConfig, pageNoConfig }: MarkdownEditorProps) => react_jsx_runtime.JSX.Element;
|
|
379
|
+
|
|
380
|
+
interface Detection {
|
|
381
|
+
bbox: [number, number, number, number];
|
|
382
|
+
score: number;
|
|
383
|
+
}
|
|
384
|
+
interface SizeType {
|
|
385
|
+
width: number;
|
|
386
|
+
height: number;
|
|
387
|
+
}
|
|
388
|
+
interface MarkDrawingProps {
|
|
389
|
+
children: ReactNode;
|
|
390
|
+
detections: Detection[];
|
|
391
|
+
originalSize: SizeType;
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* MarkDrawing组件
|
|
395
|
+
* 在指定内容上绘制检测框,常用于图像标注、物体识别可视化等场景
|
|
396
|
+
* 根据原始尺寸和当前容器尺寸自动计算缩放比例,确保标注框准确显示
|
|
397
|
+
* @param children - 待绘制标注的内容
|
|
398
|
+
* @param detections - 检测结果数组
|
|
399
|
+
* @param originalSize - 原始尺寸信息
|
|
400
|
+
*/
|
|
401
|
+
declare const _default$f: ({ children, detections, originalSize }: MarkDrawingProps) => react_jsx_runtime.JSX.Element;
|
|
266
402
|
|
|
267
403
|
/**
|
|
268
404
|
* Markdown渲染组件属性接口
|
|
@@ -779,7 +915,7 @@ declare const setInterval: (fn: () => void | Promise<void>, t: number) => {
|
|
|
779
915
|
* const id = genNonDuplicateID()
|
|
780
916
|
* console.log(id) // 输出类似: "f8c8e6d2-35a2-4f4d-9d53-994f2b6e1c2d"
|
|
781
917
|
*/
|
|
782
|
-
declare const genNonDuplicateID: () =>
|
|
918
|
+
declare const genNonDuplicateID: () => string;
|
|
783
919
|
/**
|
|
784
920
|
* 复制文本到剪贴板
|
|
785
921
|
*
|
|
@@ -1174,6 +1310,24 @@ declare const formatSize: (value: number | string, options?: FormatSizeOptions)
|
|
|
1174
1310
|
* markdownToText('## 标题\n\n- 列表项1\n- 列表项2 <div>123</div>') // '标题 列表项1 列表项2 123'
|
|
1175
1311
|
*/
|
|
1176
1312
|
declare const markdownToText: (markdown: string) => string;
|
|
1313
|
+
/**
|
|
1314
|
+
* HTML 转 纯文本
|
|
1315
|
+
* @param html - 原始 HTML 内容
|
|
1316
|
+
* @returns 纯文本
|
|
1317
|
+
* @description 使用 'html-to-text' 库进行转换,相比简单的正则替换,能更好地保留结构(如列表、表格等)。
|
|
1318
|
+
* @example
|
|
1319
|
+
* htmlToText('<div>标题</div><p>内容</p>') // '标题\n\n内容'
|
|
1320
|
+
*/
|
|
1321
|
+
declare const htmlToText: (html: string) => string;
|
|
1322
|
+
/**
|
|
1323
|
+
* HTML 转 Markdown
|
|
1324
|
+
* @param html - 原始 HTML 内容
|
|
1325
|
+
* @returns Markdown 内容
|
|
1326
|
+
* @description 使用 'turndown' 库进行转换。
|
|
1327
|
+
* @example
|
|
1328
|
+
* htmlToMarkdown('<h1>标题</h1><p>内容</p>') // '# 标题\n\n内容'
|
|
1329
|
+
*/
|
|
1330
|
+
declare const htmlToMarkdown: (html: string) => string;
|
|
1177
1331
|
interface FindTreeNodesOptions {
|
|
1178
1332
|
/** 树的id字段名,默认 "id" */
|
|
1179
1333
|
id?: string;
|
|
@@ -2315,4 +2469,4 @@ declare function createTokenManager({ key, storage }: TokenManagerProps): {
|
|
|
2315
2469
|
clear: () => void;
|
|
2316
2470
|
};
|
|
2317
2471
|
|
|
2318
|
-
export { _default$
|
|
2472
|
+
export { type AnnotationConfig, type AnnotationType, _default$r as AudioPlayer, type AudioPlayerProps, BusinessCode, type CacheMessage, type CollectionConfig, type CollectionType, type ComponentMapType, DEFAULT_DATE_FORMAT, DEFAULT_DATE_TIME_FORMAT, DEFAULT_YEAR_MONTH_DAY_FORMAT, DEFAULT_YEAR_MONTH_FORMAT, _default$q as DocxPreview, type DocxPreviewProps, _default$p as FileIcon, type FileIconProps, _default$o as FilePreview, _default$n as FilePreviewDrawer, type FilePreviewDrawerProps, type FilePreviewProps, type FindTreeNodesOptions, type FormatSizeOptions, HttpStatus, _default$i as Iframe, type IframeProps, _default$h as LazyComponent, type LazyComponentProps, _default$f as MarkDrawing, _default$g as MarkdownEditor, type MarkdownEditorProps, _default$m as MarkdownPreview, type MarkdownPreviewProps, MultiEmailValidator, _default$l as PdfImagePreview, type PdfImagePreviewProps, _default$k as PdfPreview, type PdfPreviewProps, PhoneOrMobileValidator, RegBankCardNo, RegDetailAddress, RegEmail, RegFixedTelePhone, RegIdentityCardNo, RegMobile, RegNumNo, RegPassword, RegSmsCode, RegTaxNo, RegTelePhone, type RenderControl, _default$e as RenderMarkdown, type RenderMarkdownProps, _default$d as RenderWrapper, type RenderWrapperProps, type RequestConfig, type SecureManagerProps, type SetIntervalType, type SizeUnit, _default$b as SpeechButton, type SpeechPermission, type SpeechProps, ThanNumLengthValidator, ThanNumValidator, type TokenManagerProps, _default$a as UserAvatar, type UserAvatarProps, _default$j as VideoPlayer, type VideoPlayerProps, type WebSocketProps, type WebSocketType, absVal, addUrlLastSlash, aesDecrypt, aesEncrypt, arrToObj, buildUrlParams, cachedMessage, calculate, compareNum, convertCurrency, convertNewlineToBr, copyText, createRequest, createSecureManager, createTokenManager, decimalPlaces, deepCopy, deepEqual, deepMerge, dividedBy, downloadFile, emit, emitToChild, executeScript, findTreeNodesByIds, formatDate, formatNumberWithCommas, formatSize, genNonDuplicateID, generateRandomNumbers, getAllUrlParams, getDeviceId, getEndOfTimestamp, getFileName, getFileSuffixName, getRowSpanCount, getStartOfTimestamp, getTimestamp, getWebSocketUrl, htmlToMarkdown, htmlToText, importThirdPartyFile, is, isArray, isBlob, isBoolean, isDate, isDef, isElement, isEmpty, isEmptyObj, isExpire, isExternal, isFunction, isInteger, isJson, isLocalhost, isMap, isNegative, isNull, isNullOrUnDef, isNumber, isNumberNoNaN, isObject, isPromise, isReferenceType, isRegExp, isScriptSafe, isSet, isString, isUnDef, isWindow, markdownToText, minus, objToOptions, plus, precision, processItemList, propsMerge, setInterval, setUrlMainSource, shouldRender, times, toFixed, transform, transforms, _default$8 as useAutoRefresh, _default$7 as useCountDown, _default$6 as useCreateValtioContext, _default$5 as useDebounce, _default$4 as useDeepEffect, _default$9 as useIframeRelayBridge, _default$3 as useRefState, _default$c as useSpeech, _default$2 as useSyncInput, _default$1 as useThrottle, _default as useWebSocket };
|
package/dist/index.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ interface AudioPlayerProps {
|
|
|
20
20
|
* 提供基本的音频播放功能
|
|
21
21
|
* @param props - 组件属性
|
|
22
22
|
*/
|
|
23
|
-
declare const _default$
|
|
23
|
+
declare const _default$r: ({ fileUrl }: AudioPlayerProps) => react_jsx_runtime.JSX.Element;
|
|
24
24
|
|
|
25
25
|
/** Docx文档预览组件的属性接口 */
|
|
26
26
|
interface DocxPreviewProps {
|
|
@@ -33,7 +33,7 @@ interface DocxPreviewProps {
|
|
|
33
33
|
* Docx文档预览组件
|
|
34
34
|
* @param props - 组件属性
|
|
35
35
|
*/
|
|
36
|
-
declare const _default$
|
|
36
|
+
declare const _default$q: ({ fileUrl, scale }: DocxPreviewProps) => react_jsx_runtime.JSX.Element;
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* 文件图标组件属性接口
|
|
@@ -59,7 +59,7 @@ interface FileIconProps {
|
|
|
59
59
|
* @param props - 组件属性
|
|
60
60
|
* @returns 对应文件类型的图标
|
|
61
61
|
*/
|
|
62
|
-
declare const _default$
|
|
62
|
+
declare const _default$p: ({ suffix, fontSize }: FileIconProps) => react_jsx_runtime.JSX.Element;
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
65
|
* 文件预览组件属性接口
|
|
@@ -85,17 +85,15 @@ interface FilePreviewProps {
|
|
|
85
85
|
/** 页码变化回调 */
|
|
86
86
|
onSetPageNo?: (pageNo: number) => void;
|
|
87
87
|
};
|
|
88
|
-
/** 文件参数 */
|
|
89
|
-
fileParams?: ObjectType<string>;
|
|
90
88
|
/** 密码设置成功回调 */
|
|
91
|
-
|
|
89
|
+
onSetPassword?: (password: string) => void;
|
|
92
90
|
}
|
|
93
91
|
/**
|
|
94
92
|
* 文件预览组件
|
|
95
93
|
* 支持图片、PDF、视频、音频、Markdown等文件格式的预览
|
|
96
94
|
* @param props - 组件属性
|
|
97
95
|
*/
|
|
98
|
-
declare const _default$
|
|
96
|
+
declare const _default$o: ({ suffix, fileUrl, pdfParams, password, searchValue, emptyProps, onSetPassword }: FilePreviewProps) => react_jsx_runtime.JSX.Element;
|
|
99
97
|
|
|
100
98
|
/**
|
|
101
99
|
* 文件预览抽屉组件属性接口
|
|
@@ -125,7 +123,7 @@ interface FilePreviewDrawerProps extends FilePreviewProps {
|
|
|
125
123
|
* @param props - 组件属性
|
|
126
124
|
* @returns 文件预览抽屉组件
|
|
127
125
|
*/
|
|
128
|
-
declare const _default$
|
|
126
|
+
declare const _default$n: ({ open, title, onClose, ...props }: FilePreviewDrawerProps) => react_jsx_runtime.JSX.Element;
|
|
129
127
|
|
|
130
128
|
/**
|
|
131
129
|
* Markdown预览组件属性接口
|
|
@@ -141,7 +139,27 @@ interface MarkdownPreviewProps {
|
|
|
141
139
|
* 从指定URL获取Markdown内容并渲染显示
|
|
142
140
|
* @param props - 组件属性
|
|
143
141
|
*/
|
|
144
|
-
declare const _default$
|
|
142
|
+
declare const _default$m: ({ fileUrl, searchValue }: MarkdownPreviewProps) => react_jsx_runtime.JSX.Element;
|
|
143
|
+
|
|
144
|
+
interface PdfImagePreviewProps {
|
|
145
|
+
/** PDF文件URL地址 */
|
|
146
|
+
fileUrl: string;
|
|
147
|
+
/** 当前页码 */
|
|
148
|
+
pageNo?: number;
|
|
149
|
+
/** 缩放比例,默认为1 */
|
|
150
|
+
scale?: number;
|
|
151
|
+
/** 是否显示缩略图,默认为true */
|
|
152
|
+
isHasThumbnails?: boolean;
|
|
153
|
+
/** 页码变化回调 */
|
|
154
|
+
onSetPageNo?: (pageNo: number) => void;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* PDF图片预览组件 模仿pdf预览
|
|
158
|
+
* 支持虚拟滚动、缩放、缩略图导航等功能
|
|
159
|
+
* @param props - 组件属性
|
|
160
|
+
* 适用于大量PDF页面的高效展示
|
|
161
|
+
*/
|
|
162
|
+
declare const _default$l: ({ fileUrl, pageNo, scale, isHasThumbnails, onSetPageNo }: PdfImagePreviewProps) => react_jsx_runtime.JSX.Element;
|
|
145
163
|
|
|
146
164
|
/**
|
|
147
165
|
* PDF预览组件属性接口
|
|
@@ -167,8 +185,9 @@ interface PdfPreviewProps {
|
|
|
167
185
|
* 基于react-pdf-viewer实现的PDF文件预览功能
|
|
168
186
|
* 支持密码保护、缩略图、缩放、页面导航等功能
|
|
169
187
|
* @param props - 组件属性
|
|
188
|
+
* TODO 放大缩小会丢失分页
|
|
170
189
|
*/
|
|
171
|
-
declare const _default$
|
|
190
|
+
declare const _default$k: ({ password, fileUrl, pageNo, scale, isHasThumbnails, onSetPassword, onSetPageNo }: PdfPreviewProps) => react_jsx_runtime.JSX.Element;
|
|
172
191
|
|
|
173
192
|
/**
|
|
174
193
|
* 视频播放器组件属性接口
|
|
@@ -182,7 +201,7 @@ interface VideoPlayerProps {
|
|
|
182
201
|
* 提供基本的视频播放功能
|
|
183
202
|
* @param props - 组件属性
|
|
184
203
|
*/
|
|
185
|
-
declare const _default$
|
|
204
|
+
declare const _default$j: ({ fileUrl }: VideoPlayerProps) => react_jsx_runtime.JSX.Element;
|
|
186
205
|
|
|
187
206
|
/**
|
|
188
207
|
* Iframe组件属性接口
|
|
@@ -204,7 +223,7 @@ interface IframeProps {
|
|
|
204
223
|
* 支持加载状态、URL参数处理、防缓存等功能
|
|
205
224
|
* @param props - 组件属性
|
|
206
225
|
*/
|
|
207
|
-
declare const _default$
|
|
226
|
+
declare const _default$i: react.ForwardRefExoticComponent<IframeProps & react.RefAttributes<HTMLIFrameElement>>;
|
|
208
227
|
|
|
209
228
|
/**
|
|
210
229
|
* 组件映射类型,用于延时加载
|
|
@@ -231,7 +250,93 @@ interface LazyComponentProps {
|
|
|
231
250
|
* 使用示例:<LazyComponent type="renderMarkdown" data={{}} loading={true} />
|
|
232
251
|
* @param props - 组件属性
|
|
233
252
|
*/
|
|
234
|
-
declare const _default$
|
|
253
|
+
declare const _default$h: ({ type, customComponents, unknownContent, ...rest }: LazyComponentProps) => string | number | true | react_jsx_runtime.JSX.Element | Iterable<react.ReactNode>;
|
|
254
|
+
|
|
255
|
+
declare const ANNOTATION_ATTRS: readonly ["annotation-id", "user-name", "user-id", "update-time", "content"];
|
|
256
|
+
/**
|
|
257
|
+
* 批注功能配置
|
|
258
|
+
*/
|
|
259
|
+
interface AnnotationsProps {
|
|
260
|
+
/** 是否启用批注功能,默认为false */
|
|
261
|
+
enabled: boolean;
|
|
262
|
+
/** 当前用户 */
|
|
263
|
+
user: {
|
|
264
|
+
id: string;
|
|
265
|
+
name: string;
|
|
266
|
+
};
|
|
267
|
+
/** 是否显示批注列表,默认为true */
|
|
268
|
+
showList?: boolean;
|
|
269
|
+
/** 受控属性:批注列表是否可见 */
|
|
270
|
+
visible?: boolean;
|
|
271
|
+
/** 受控属性:批注列表可见性改变回调 */
|
|
272
|
+
onVisibleChange?: (visible: boolean) => void;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* 批注功能配置接口
|
|
276
|
+
*/
|
|
277
|
+
interface AnnotationConfig extends AnnotationsProps {
|
|
278
|
+
getContainer?: () => HTMLElement | null;
|
|
279
|
+
}
|
|
280
|
+
type AnnotationType = {
|
|
281
|
+
from: number;
|
|
282
|
+
to: number;
|
|
283
|
+
} & {
|
|
284
|
+
[key in (typeof ANNOTATION_ATTRS)[number]]: string;
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
declare const COLLECTION_ATTRS: readonly ["collection-id", "user-name", "user-id", "update-time", "page-no"];
|
|
288
|
+
type CollectionType = {
|
|
289
|
+
text: string;
|
|
290
|
+
from: number;
|
|
291
|
+
to: number;
|
|
292
|
+
pageNo?: string;
|
|
293
|
+
} & {
|
|
294
|
+
[key in (typeof COLLECTION_ATTRS)[number]]: string;
|
|
295
|
+
};
|
|
296
|
+
/**
|
|
297
|
+
* 收录功能配置
|
|
298
|
+
*/
|
|
299
|
+
interface CollectionsProps {
|
|
300
|
+
/** 是否启用批注功能,默认为false */
|
|
301
|
+
enabled: boolean;
|
|
302
|
+
/** 当前用户 */
|
|
303
|
+
user: {
|
|
304
|
+
id: string;
|
|
305
|
+
name: string;
|
|
306
|
+
};
|
|
307
|
+
/** 是否显示收录列表,默认为true */
|
|
308
|
+
showList?: boolean;
|
|
309
|
+
/** 受控属性:批注列表是否可见 */
|
|
310
|
+
visible?: boolean;
|
|
311
|
+
/** 受控属性:批注列表可见性改变回调 */
|
|
312
|
+
onVisibleChange?: (visible: boolean) => void;
|
|
313
|
+
/**
|
|
314
|
+
* 创建收录的回调
|
|
315
|
+
* @param data 收录数据
|
|
316
|
+
* @returns 返回收录ID(如果有),返回Promise
|
|
317
|
+
*/
|
|
318
|
+
onBeforeCreate?: (data: {
|
|
319
|
+
content: string;
|
|
320
|
+
pageNo?: number;
|
|
321
|
+
}) => Promise<string>;
|
|
322
|
+
/**
|
|
323
|
+
* 自定义渲染收录列表项
|
|
324
|
+
* @param props 列表项数据及操作
|
|
325
|
+
* @returns React节点
|
|
326
|
+
*/
|
|
327
|
+
renderItem?: (props: {
|
|
328
|
+
collection: CollectionType;
|
|
329
|
+
isSelected: boolean;
|
|
330
|
+
onSelect: () => void;
|
|
331
|
+
onDelete: () => void;
|
|
332
|
+
}) => React.ReactNode;
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* 收录功能配置接口
|
|
336
|
+
*/
|
|
337
|
+
interface CollectionConfig extends CollectionsProps {
|
|
338
|
+
getContainer?: () => HTMLElement | null;
|
|
339
|
+
}
|
|
235
340
|
|
|
236
341
|
/**
|
|
237
342
|
* Markdown编辑器组件属性接口
|
|
@@ -245,16 +350,24 @@ interface MarkdownEditorProps {
|
|
|
245
350
|
value?: string;
|
|
246
351
|
/** 内容变化回调 */
|
|
247
352
|
onChange?: (value: string) => void;
|
|
248
|
-
/** 页面滚动回调 */
|
|
249
|
-
onScrollPage?: (pageIndex: number) => void;
|
|
250
353
|
/** 额外导航内容 */
|
|
251
354
|
extraNav?: ReactNode;
|
|
252
355
|
/** 是否显示工具栏,默认为true */
|
|
253
356
|
showToolbar?: boolean;
|
|
254
357
|
/** 引用文本回调 */
|
|
255
|
-
onQuote?: (text
|
|
358
|
+
onQuote?: (text?: string, markdown?: string) => void;
|
|
256
359
|
/** 文件下载回调 */
|
|
257
360
|
onDownloadFile?: (fileContent: string, targetFormat?: string) => Promise<void>;
|
|
361
|
+
/** 批注功能配置对象 */
|
|
362
|
+
annotationConfig?: AnnotationConfig;
|
|
363
|
+
/** 收录功能专属配置,不与批注混淆 */
|
|
364
|
+
collectionConfig?: CollectionConfig;
|
|
365
|
+
pageNoConfig?: {
|
|
366
|
+
/** 是否启用分页功能,默认为false */
|
|
367
|
+
enabled: boolean;
|
|
368
|
+
/** 页面滚动回调 */
|
|
369
|
+
onScrollPage?: (pageIndex: number) => void;
|
|
370
|
+
};
|
|
258
371
|
}
|
|
259
372
|
/**
|
|
260
373
|
* Markdown编辑器组件
|
|
@@ -262,7 +375,30 @@ interface MarkdownEditorProps {
|
|
|
262
375
|
* 提供丰富的编辑功能:格式化、链接、图片、表格、高亮等
|
|
263
376
|
* @param props - 组件属性
|
|
264
377
|
*/
|
|
265
|
-
declare const _default$
|
|
378
|
+
declare const _default$g: ({ value, onChange, searchValue, disabled, extraNav, showToolbar, onQuote, onDownloadFile, annotationConfig, collectionConfig, pageNoConfig }: MarkdownEditorProps) => react_jsx_runtime.JSX.Element;
|
|
379
|
+
|
|
380
|
+
interface Detection {
|
|
381
|
+
bbox: [number, number, number, number];
|
|
382
|
+
score: number;
|
|
383
|
+
}
|
|
384
|
+
interface SizeType {
|
|
385
|
+
width: number;
|
|
386
|
+
height: number;
|
|
387
|
+
}
|
|
388
|
+
interface MarkDrawingProps {
|
|
389
|
+
children: ReactNode;
|
|
390
|
+
detections: Detection[];
|
|
391
|
+
originalSize: SizeType;
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* MarkDrawing组件
|
|
395
|
+
* 在指定内容上绘制检测框,常用于图像标注、物体识别可视化等场景
|
|
396
|
+
* 根据原始尺寸和当前容器尺寸自动计算缩放比例,确保标注框准确显示
|
|
397
|
+
* @param children - 待绘制标注的内容
|
|
398
|
+
* @param detections - 检测结果数组
|
|
399
|
+
* @param originalSize - 原始尺寸信息
|
|
400
|
+
*/
|
|
401
|
+
declare const _default$f: ({ children, detections, originalSize }: MarkDrawingProps) => react_jsx_runtime.JSX.Element;
|
|
266
402
|
|
|
267
403
|
/**
|
|
268
404
|
* Markdown渲染组件属性接口
|
|
@@ -779,7 +915,7 @@ declare const setInterval: (fn: () => void | Promise<void>, t: number) => {
|
|
|
779
915
|
* const id = genNonDuplicateID()
|
|
780
916
|
* console.log(id) // 输出类似: "f8c8e6d2-35a2-4f4d-9d53-994f2b6e1c2d"
|
|
781
917
|
*/
|
|
782
|
-
declare const genNonDuplicateID: () =>
|
|
918
|
+
declare const genNonDuplicateID: () => string;
|
|
783
919
|
/**
|
|
784
920
|
* 复制文本到剪贴板
|
|
785
921
|
*
|
|
@@ -1174,6 +1310,24 @@ declare const formatSize: (value: number | string, options?: FormatSizeOptions)
|
|
|
1174
1310
|
* markdownToText('## 标题\n\n- 列表项1\n- 列表项2 <div>123</div>') // '标题 列表项1 列表项2 123'
|
|
1175
1311
|
*/
|
|
1176
1312
|
declare const markdownToText: (markdown: string) => string;
|
|
1313
|
+
/**
|
|
1314
|
+
* HTML 转 纯文本
|
|
1315
|
+
* @param html - 原始 HTML 内容
|
|
1316
|
+
* @returns 纯文本
|
|
1317
|
+
* @description 使用 'html-to-text' 库进行转换,相比简单的正则替换,能更好地保留结构(如列表、表格等)。
|
|
1318
|
+
* @example
|
|
1319
|
+
* htmlToText('<div>标题</div><p>内容</p>') // '标题\n\n内容'
|
|
1320
|
+
*/
|
|
1321
|
+
declare const htmlToText: (html: string) => string;
|
|
1322
|
+
/**
|
|
1323
|
+
* HTML 转 Markdown
|
|
1324
|
+
* @param html - 原始 HTML 内容
|
|
1325
|
+
* @returns Markdown 内容
|
|
1326
|
+
* @description 使用 'turndown' 库进行转换。
|
|
1327
|
+
* @example
|
|
1328
|
+
* htmlToMarkdown('<h1>标题</h1><p>内容</p>') // '# 标题\n\n内容'
|
|
1329
|
+
*/
|
|
1330
|
+
declare const htmlToMarkdown: (html: string) => string;
|
|
1177
1331
|
interface FindTreeNodesOptions {
|
|
1178
1332
|
/** 树的id字段名,默认 "id" */
|
|
1179
1333
|
id?: string;
|
|
@@ -2315,4 +2469,4 @@ declare function createTokenManager({ key, storage }: TokenManagerProps): {
|
|
|
2315
2469
|
clear: () => void;
|
|
2316
2470
|
};
|
|
2317
2471
|
|
|
2318
|
-
export { _default$
|
|
2472
|
+
export { type AnnotationConfig, type AnnotationType, _default$r as AudioPlayer, type AudioPlayerProps, BusinessCode, type CacheMessage, type CollectionConfig, type CollectionType, type ComponentMapType, DEFAULT_DATE_FORMAT, DEFAULT_DATE_TIME_FORMAT, DEFAULT_YEAR_MONTH_DAY_FORMAT, DEFAULT_YEAR_MONTH_FORMAT, _default$q as DocxPreview, type DocxPreviewProps, _default$p as FileIcon, type FileIconProps, _default$o as FilePreview, _default$n as FilePreviewDrawer, type FilePreviewDrawerProps, type FilePreviewProps, type FindTreeNodesOptions, type FormatSizeOptions, HttpStatus, _default$i as Iframe, type IframeProps, _default$h as LazyComponent, type LazyComponentProps, _default$f as MarkDrawing, _default$g as MarkdownEditor, type MarkdownEditorProps, _default$m as MarkdownPreview, type MarkdownPreviewProps, MultiEmailValidator, _default$l as PdfImagePreview, type PdfImagePreviewProps, _default$k as PdfPreview, type PdfPreviewProps, PhoneOrMobileValidator, RegBankCardNo, RegDetailAddress, RegEmail, RegFixedTelePhone, RegIdentityCardNo, RegMobile, RegNumNo, RegPassword, RegSmsCode, RegTaxNo, RegTelePhone, type RenderControl, _default$e as RenderMarkdown, type RenderMarkdownProps, _default$d as RenderWrapper, type RenderWrapperProps, type RequestConfig, type SecureManagerProps, type SetIntervalType, type SizeUnit, _default$b as SpeechButton, type SpeechPermission, type SpeechProps, ThanNumLengthValidator, ThanNumValidator, type TokenManagerProps, _default$a as UserAvatar, type UserAvatarProps, _default$j as VideoPlayer, type VideoPlayerProps, type WebSocketProps, type WebSocketType, absVal, addUrlLastSlash, aesDecrypt, aesEncrypt, arrToObj, buildUrlParams, cachedMessage, calculate, compareNum, convertCurrency, convertNewlineToBr, copyText, createRequest, createSecureManager, createTokenManager, decimalPlaces, deepCopy, deepEqual, deepMerge, dividedBy, downloadFile, emit, emitToChild, executeScript, findTreeNodesByIds, formatDate, formatNumberWithCommas, formatSize, genNonDuplicateID, generateRandomNumbers, getAllUrlParams, getDeviceId, getEndOfTimestamp, getFileName, getFileSuffixName, getRowSpanCount, getStartOfTimestamp, getTimestamp, getWebSocketUrl, htmlToMarkdown, htmlToText, importThirdPartyFile, is, isArray, isBlob, isBoolean, isDate, isDef, isElement, isEmpty, isEmptyObj, isExpire, isExternal, isFunction, isInteger, isJson, isLocalhost, isMap, isNegative, isNull, isNullOrUnDef, isNumber, isNumberNoNaN, isObject, isPromise, isReferenceType, isRegExp, isScriptSafe, isSet, isString, isUnDef, isWindow, markdownToText, minus, objToOptions, plus, precision, processItemList, propsMerge, setInterval, setUrlMainSource, shouldRender, times, toFixed, transform, transforms, _default$8 as useAutoRefresh, _default$7 as useCountDown, _default$6 as useCreateValtioContext, _default$5 as useDebounce, _default$4 as useDeepEffect, _default$9 as useIframeRelayBridge, _default$3 as useRefState, _default$c as useSpeech, _default$2 as useSyncInput, _default$1 as useThrottle, _default as useWebSocket };
|