@zero-library/common 2.2.13 → 2.3.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.
package/dist/index.d.mts CHANGED
@@ -20,7 +20,7 @@ interface AudioPlayerProps {
20
20
  * 提供基本的音频播放功能
21
21
  * @param props - 组件属性
22
22
  */
23
- declare const _default$p: ({ fileUrl }: AudioPlayerProps) => react_jsx_runtime.JSX.Element;
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$o: ({ fileUrl, scale }: DocxPreviewProps) => react_jsx_runtime.JSX.Element;
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$n: ({ suffix, fontSize }: FileIconProps) => react_jsx_runtime.JSX.Element;
62
+ declare const _default$p: ({ suffix, fontSize }: FileIconProps) => react_jsx_runtime.JSX.Element;
63
63
 
64
64
  /**
65
65
  * 文件预览组件属性接口
@@ -88,14 +88,14 @@ interface FilePreviewProps {
88
88
  /** 文件参数 */
89
89
  fileParams?: ObjectType<string>;
90
90
  /** 密码设置成功回调 */
91
- onSetPassSuccess?: () => void;
91
+ onSetPassword?: () => void;
92
92
  }
93
93
  /**
94
94
  * 文件预览组件
95
95
  * 支持图片、PDF、视频、音频、Markdown等文件格式的预览
96
96
  * @param props - 组件属性
97
97
  */
98
- declare const _default$m: ({ suffix, fileUrl, pdfParams, password, searchValue, emptyProps }: FilePreviewProps) => react_jsx_runtime.JSX.Element;
98
+ declare const _default$o: ({ suffix, fileUrl, pdfParams, password, searchValue, emptyProps, onSetPassword }: FilePreviewProps) => react_jsx_runtime.JSX.Element;
99
99
 
100
100
  /**
101
101
  * 文件预览抽屉组件属性接口
@@ -125,7 +125,7 @@ interface FilePreviewDrawerProps extends FilePreviewProps {
125
125
  * @param props - 组件属性
126
126
  * @returns 文件预览抽屉组件
127
127
  */
128
- declare const _default$l: ({ open, title, onClose, ...props }: FilePreviewDrawerProps) => react_jsx_runtime.JSX.Element;
128
+ declare const _default$n: ({ open, title, onClose, ...props }: FilePreviewDrawerProps) => react_jsx_runtime.JSX.Element;
129
129
 
130
130
  /**
131
131
  * Markdown预览组件属性接口
@@ -141,7 +141,27 @@ interface MarkdownPreviewProps {
141
141
  * 从指定URL获取Markdown内容并渲染显示
142
142
  * @param props - 组件属性
143
143
  */
144
- declare const _default$k: ({ fileUrl, searchValue }: MarkdownPreviewProps) => react_jsx_runtime.JSX.Element;
144
+ declare const _default$m: ({ fileUrl, searchValue }: MarkdownPreviewProps) => react_jsx_runtime.JSX.Element;
145
+
146
+ interface PdfImagePreviewProps {
147
+ /** PDF文件URL地址 */
148
+ fileUrl: string;
149
+ /** 当前页码 */
150
+ pageNo?: number;
151
+ /** 缩放比例,默认为1 */
152
+ scale?: number;
153
+ /** 是否显示缩略图,默认为true */
154
+ isHasThumbnails?: boolean;
155
+ /** 页码变化回调 */
156
+ onSetPageNo?: (pageNo: number) => void;
157
+ }
158
+ /**
159
+ * PDF图片预览组件 模仿pdf预览
160
+ * 支持虚拟滚动、缩放、缩略图导航等功能
161
+ * @param props - 组件属性
162
+ * 适用于大量PDF页面的高效展示
163
+ */
164
+ declare const _default$l: ({ fileUrl, pageNo, scale, isHasThumbnails, onSetPageNo }: PdfImagePreviewProps) => react_jsx_runtime.JSX.Element;
145
165
 
146
166
  /**
147
167
  * PDF预览组件属性接口
@@ -167,8 +187,9 @@ interface PdfPreviewProps {
167
187
  * 基于react-pdf-viewer实现的PDF文件预览功能
168
188
  * 支持密码保护、缩略图、缩放、页面导航等功能
169
189
  * @param props - 组件属性
190
+ * TODO 放大缩小会丢失分页
170
191
  */
171
- declare const _default$j: ({ password, fileUrl, pageNo, scale, isHasThumbnails, onSetPassword, onSetPageNo }: PdfPreviewProps) => react_jsx_runtime.JSX.Element;
192
+ declare const _default$k: ({ password, fileUrl, pageNo, scale, isHasThumbnails, onSetPassword, onSetPageNo }: PdfPreviewProps) => react_jsx_runtime.JSX.Element;
172
193
 
173
194
  /**
174
195
  * 视频播放器组件属性接口
@@ -182,7 +203,7 @@ interface VideoPlayerProps {
182
203
  * 提供基本的视频播放功能
183
204
  * @param props - 组件属性
184
205
  */
185
- declare const _default$i: ({ fileUrl }: VideoPlayerProps) => react_jsx_runtime.JSX.Element;
206
+ declare const _default$j: ({ fileUrl }: VideoPlayerProps) => react_jsx_runtime.JSX.Element;
186
207
 
187
208
  /**
188
209
  * Iframe组件属性接口
@@ -204,7 +225,7 @@ interface IframeProps {
204
225
  * 支持加载状态、URL参数处理、防缓存等功能
205
226
  * @param props - 组件属性
206
227
  */
207
- declare const _default$h: react.ForwardRefExoticComponent<IframeProps & react.RefAttributes<HTMLIFrameElement>>;
228
+ declare const _default$i: react.ForwardRefExoticComponent<IframeProps & react.RefAttributes<HTMLIFrameElement>>;
208
229
 
209
230
  /**
210
231
  * 组件映射类型,用于延时加载
@@ -220,6 +241,8 @@ interface LazyComponentProps {
220
241
  type: string;
221
242
  /** 自定义组件映射 */
222
243
  customComponents?: ComponentMapType;
244
+ /** 未知类型时显示的内容,默认为警告提示 */
245
+ unknownContent?: React.ReactNode;
223
246
  /** 其他属性会透传给组件 */
224
247
  [key: string]: any;
225
248
  }
@@ -229,7 +252,97 @@ interface LazyComponentProps {
229
252
  * 使用示例:<LazyComponent type="renderMarkdown" data={{}} loading={true} />
230
253
  * @param props - 组件属性
231
254
  */
232
- declare const _default$g: ({ type, customComponents, ...rest }: LazyComponentProps) => react_jsx_runtime.JSX.Element;
255
+ declare const _default$h: ({ type, customComponents, unknownContent, ...rest }: LazyComponentProps) => string | number | true | react_jsx_runtime.JSX.Element | Iterable<react.ReactNode>;
256
+
257
+ /**
258
+ * 批注功能配置
259
+ */
260
+ interface AnnotationsProps {
261
+ /** 是否启用批注功能,默认为false */
262
+ enabled: boolean;
263
+ /** 当前用户 */
264
+ user: {
265
+ id: string;
266
+ name: string;
267
+ };
268
+ /** 是否显示批注列表,默认为true */
269
+ showList?: boolean;
270
+ /** 受控属性:批注列表是否可见 */
271
+ visible?: boolean;
272
+ /** 受控属性:批注列表可见性改变回调 */
273
+ onVisibleChange?: (visible: boolean) => void;
274
+ }
275
+
276
+ declare module "@tiptap/core" {
277
+ interface Commands<ReturnType> {
278
+ annotation: {
279
+ selectAnnotation: (id: string) => any;
280
+ moveCursorToAnnotation: (id: string) => any;
281
+ };
282
+ }
283
+ }
284
+
285
+ /**
286
+ * 批注功能配置接口
287
+ */
288
+ interface AnnotationConfig extends AnnotationsProps {
289
+ getContainer?: () => HTMLElement | null;
290
+ }
291
+
292
+ declare const COLLECTION_ATTRS: readonly ["collection-id", "user-name", "user-id", "update-time", "page-no"];
293
+ type CollectionType = {
294
+ text: string;
295
+ from: number;
296
+ to: number;
297
+ pageNo?: string;
298
+ } & {
299
+ [key in (typeof COLLECTION_ATTRS)[number]]: string;
300
+ };
301
+ /**
302
+ * 收录功能配置
303
+ */
304
+ interface CollectionsProps {
305
+ /** 是否启用批注功能,默认为false */
306
+ enabled: boolean;
307
+ /** 当前用户 */
308
+ user: {
309
+ id: string;
310
+ name: string;
311
+ };
312
+ /** 是否显示收录列表,默认为true */
313
+ showList?: boolean;
314
+ /** 受控属性:批注列表是否可见 */
315
+ visible?: boolean;
316
+ /** 受控属性:批注列表可见性改变回调 */
317
+ onVisibleChange?: (visible: boolean) => void;
318
+ /**
319
+ * 创建收录的回调
320
+ * @param data 收录数据
321
+ * @returns 返回收录ID(如果有),返回Promise
322
+ */
323
+ onBeforeCreate?: (data: {
324
+ content: string;
325
+ pageNo?: number;
326
+ }) => Promise<string>;
327
+ /**
328
+ * 自定义渲染收录列表项
329
+ * @param props 列表项数据及操作
330
+ * @returns React节点
331
+ */
332
+ renderItem?: (props: {
333
+ collection: CollectionType;
334
+ isSelected: boolean;
335
+ onSelect: () => void;
336
+ onDelete: () => void;
337
+ }) => React.ReactNode;
338
+ }
339
+
340
+ /**
341
+ * 收录功能配置接口
342
+ */
343
+ interface CollectionConfig extends CollectionsProps {
344
+ getContainer?: () => HTMLElement | null;
345
+ }
233
346
 
234
347
  /**
235
348
  * Markdown编辑器组件属性接口
@@ -243,16 +356,24 @@ interface MarkdownEditorProps {
243
356
  value?: string;
244
357
  /** 内容变化回调 */
245
358
  onChange?: (value: string) => void;
246
- /** 页面滚动回调 */
247
- onScrollPage?: (pageIndex: number) => void;
248
359
  /** 额外导航内容 */
249
360
  extraNav?: ReactNode;
250
361
  /** 是否显示工具栏,默认为true */
251
362
  showToolbar?: boolean;
252
363
  /** 引用文本回调 */
253
- onQuote?: (text: string) => void;
364
+ onQuote?: (text?: string, markdown?: string) => void;
254
365
  /** 文件下载回调 */
255
366
  onDownloadFile?: (fileContent: string, targetFormat?: string) => Promise<void>;
367
+ /** 批注功能配置对象 */
368
+ annotationConfig?: AnnotationConfig;
369
+ /** 收录功能专属配置,不与批注混淆 */
370
+ collectionConfig?: CollectionConfig;
371
+ pageNoConfig?: {
372
+ /** 是否启用分页功能,默认为false */
373
+ enabled: boolean;
374
+ /** 页面滚动回调 */
375
+ onScrollPage?: (pageIndex: number) => void;
376
+ };
256
377
  }
257
378
  /**
258
379
  * Markdown编辑器组件
@@ -260,7 +381,30 @@ interface MarkdownEditorProps {
260
381
  * 提供丰富的编辑功能:格式化、链接、图片、表格、高亮等
261
382
  * @param props - 组件属性
262
383
  */
263
- declare const _default$f: ({ value, onChange, onScrollPage, searchValue, disabled, extraNav, showToolbar, onQuote, onDownloadFile }: MarkdownEditorProps) => react_jsx_runtime.JSX.Element;
384
+ declare const _default$g: ({ value, onChange, searchValue, disabled, extraNav, showToolbar, onQuote, onDownloadFile, annotationConfig, collectionConfig, pageNoConfig }: MarkdownEditorProps) => react_jsx_runtime.JSX.Element;
385
+
386
+ interface Detection {
387
+ bbox: [number, number, number, number];
388
+ score: number;
389
+ }
390
+ interface SizeType {
391
+ width: number;
392
+ height: number;
393
+ }
394
+ interface MarkDrawingProps {
395
+ children: ReactNode;
396
+ detections: Detection[];
397
+ originalSize: SizeType;
398
+ }
399
+ /**
400
+ * MarkDrawing组件
401
+ * 在指定内容上绘制检测框,常用于图像标注、物体识别可视化等场景
402
+ * 根据原始尺寸和当前容器尺寸自动计算缩放比例,确保标注框准确显示
403
+ * @param children - 待绘制标注的内容
404
+ * @param detections - 检测结果数组
405
+ * @param originalSize - 原始尺寸信息
406
+ */
407
+ declare const _default$f: ({ children, detections, originalSize }: MarkDrawingProps) => react_jsx_runtime.JSX.Element;
264
408
 
265
409
  /**
266
410
  * Markdown渲染组件属性接口
@@ -777,7 +921,7 @@ declare const setInterval: (fn: () => void | Promise<void>, t: number) => {
777
921
  * const id = genNonDuplicateID()
778
922
  * console.log(id) // 输出类似: "f8c8e6d2-35a2-4f4d-9d53-994f2b6e1c2d"
779
923
  */
780
- declare const genNonDuplicateID: () => `${string}-${string}-${string}-${string}-${string}`;
924
+ declare const genNonDuplicateID: () => string;
781
925
  /**
782
926
  * 复制文本到剪贴板
783
927
  *
@@ -1172,6 +1316,24 @@ declare const formatSize: (value: number | string, options?: FormatSizeOptions)
1172
1316
  * markdownToText('## 标题\n\n- 列表项1\n- 列表项2 <div>123</div>') // '标题 列表项1 列表项2 123'
1173
1317
  */
1174
1318
  declare const markdownToText: (markdown: string) => string;
1319
+ /**
1320
+ * HTML 转 纯文本
1321
+ * @param html - 原始 HTML 内容
1322
+ * @returns 纯文本
1323
+ * @description 使用 'html-to-text' 库进行转换,相比简单的正则替换,能更好地保留结构(如列表、表格等)。
1324
+ * @example
1325
+ * htmlToText('<div>标题</div><p>内容</p>') // '标题\n\n内容'
1326
+ */
1327
+ declare const htmlToText: (html: string) => string;
1328
+ /**
1329
+ * HTML 转 Markdown
1330
+ * @param html - 原始 HTML 内容
1331
+ * @returns Markdown 内容
1332
+ * @description 使用 'turndown' 库进行转换。
1333
+ * @example
1334
+ * htmlToMarkdown('<h1>标题</h1><p>内容</p>') // '# 标题\n\n内容'
1335
+ */
1336
+ declare const htmlToMarkdown: (html: string) => string;
1175
1337
  interface FindTreeNodesOptions {
1176
1338
  /** 树的id字段名,默认 "id" */
1177
1339
  id?: string;
@@ -2313,4 +2475,4 @@ declare function createTokenManager({ key, storage }: TokenManagerProps): {
2313
2475
  clear: () => void;
2314
2476
  };
2315
2477
 
2316
- export { _default$p as AudioPlayer, type AudioPlayerProps, BusinessCode, type CacheMessage, type ComponentMapType, DEFAULT_DATE_FORMAT, DEFAULT_DATE_TIME_FORMAT, DEFAULT_YEAR_MONTH_DAY_FORMAT, DEFAULT_YEAR_MONTH_FORMAT, _default$o as DocxPreview, type DocxPreviewProps, _default$n as FileIcon, type FileIconProps, _default$m as FilePreview, _default$l as FilePreviewDrawer, type FilePreviewDrawerProps, type FilePreviewProps, type FindTreeNodesOptions, type FormatSizeOptions, HttpStatus, _default$h as Iframe, type IframeProps, _default$g as LazyComponent, type LazyComponentProps, _default$f as MarkdownEditor, type MarkdownEditorProps, _default$k as MarkdownPreview, type MarkdownPreviewProps, MultiEmailValidator, _default$j 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$i 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, 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 };
2478
+ export { _default$r as AudioPlayer, type AudioPlayerProps, BusinessCode, type CacheMessage, 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$p: ({ fileUrl }: AudioPlayerProps) => react_jsx_runtime.JSX.Element;
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$o: ({ fileUrl, scale }: DocxPreviewProps) => react_jsx_runtime.JSX.Element;
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$n: ({ suffix, fontSize }: FileIconProps) => react_jsx_runtime.JSX.Element;
62
+ declare const _default$p: ({ suffix, fontSize }: FileIconProps) => react_jsx_runtime.JSX.Element;
63
63
 
64
64
  /**
65
65
  * 文件预览组件属性接口
@@ -88,14 +88,14 @@ interface FilePreviewProps {
88
88
  /** 文件参数 */
89
89
  fileParams?: ObjectType<string>;
90
90
  /** 密码设置成功回调 */
91
- onSetPassSuccess?: () => void;
91
+ onSetPassword?: () => void;
92
92
  }
93
93
  /**
94
94
  * 文件预览组件
95
95
  * 支持图片、PDF、视频、音频、Markdown等文件格式的预览
96
96
  * @param props - 组件属性
97
97
  */
98
- declare const _default$m: ({ suffix, fileUrl, pdfParams, password, searchValue, emptyProps }: FilePreviewProps) => react_jsx_runtime.JSX.Element;
98
+ declare const _default$o: ({ suffix, fileUrl, pdfParams, password, searchValue, emptyProps, onSetPassword }: FilePreviewProps) => react_jsx_runtime.JSX.Element;
99
99
 
100
100
  /**
101
101
  * 文件预览抽屉组件属性接口
@@ -125,7 +125,7 @@ interface FilePreviewDrawerProps extends FilePreviewProps {
125
125
  * @param props - 组件属性
126
126
  * @returns 文件预览抽屉组件
127
127
  */
128
- declare const _default$l: ({ open, title, onClose, ...props }: FilePreviewDrawerProps) => react_jsx_runtime.JSX.Element;
128
+ declare const _default$n: ({ open, title, onClose, ...props }: FilePreviewDrawerProps) => react_jsx_runtime.JSX.Element;
129
129
 
130
130
  /**
131
131
  * Markdown预览组件属性接口
@@ -141,7 +141,27 @@ interface MarkdownPreviewProps {
141
141
  * 从指定URL获取Markdown内容并渲染显示
142
142
  * @param props - 组件属性
143
143
  */
144
- declare const _default$k: ({ fileUrl, searchValue }: MarkdownPreviewProps) => react_jsx_runtime.JSX.Element;
144
+ declare const _default$m: ({ fileUrl, searchValue }: MarkdownPreviewProps) => react_jsx_runtime.JSX.Element;
145
+
146
+ interface PdfImagePreviewProps {
147
+ /** PDF文件URL地址 */
148
+ fileUrl: string;
149
+ /** 当前页码 */
150
+ pageNo?: number;
151
+ /** 缩放比例,默认为1 */
152
+ scale?: number;
153
+ /** 是否显示缩略图,默认为true */
154
+ isHasThumbnails?: boolean;
155
+ /** 页码变化回调 */
156
+ onSetPageNo?: (pageNo: number) => void;
157
+ }
158
+ /**
159
+ * PDF图片预览组件 模仿pdf预览
160
+ * 支持虚拟滚动、缩放、缩略图导航等功能
161
+ * @param props - 组件属性
162
+ * 适用于大量PDF页面的高效展示
163
+ */
164
+ declare const _default$l: ({ fileUrl, pageNo, scale, isHasThumbnails, onSetPageNo }: PdfImagePreviewProps) => react_jsx_runtime.JSX.Element;
145
165
 
146
166
  /**
147
167
  * PDF预览组件属性接口
@@ -167,8 +187,9 @@ interface PdfPreviewProps {
167
187
  * 基于react-pdf-viewer实现的PDF文件预览功能
168
188
  * 支持密码保护、缩略图、缩放、页面导航等功能
169
189
  * @param props - 组件属性
190
+ * TODO 放大缩小会丢失分页
170
191
  */
171
- declare const _default$j: ({ password, fileUrl, pageNo, scale, isHasThumbnails, onSetPassword, onSetPageNo }: PdfPreviewProps) => react_jsx_runtime.JSX.Element;
192
+ declare const _default$k: ({ password, fileUrl, pageNo, scale, isHasThumbnails, onSetPassword, onSetPageNo }: PdfPreviewProps) => react_jsx_runtime.JSX.Element;
172
193
 
173
194
  /**
174
195
  * 视频播放器组件属性接口
@@ -182,7 +203,7 @@ interface VideoPlayerProps {
182
203
  * 提供基本的视频播放功能
183
204
  * @param props - 组件属性
184
205
  */
185
- declare const _default$i: ({ fileUrl }: VideoPlayerProps) => react_jsx_runtime.JSX.Element;
206
+ declare const _default$j: ({ fileUrl }: VideoPlayerProps) => react_jsx_runtime.JSX.Element;
186
207
 
187
208
  /**
188
209
  * Iframe组件属性接口
@@ -204,7 +225,7 @@ interface IframeProps {
204
225
  * 支持加载状态、URL参数处理、防缓存等功能
205
226
  * @param props - 组件属性
206
227
  */
207
- declare const _default$h: react.ForwardRefExoticComponent<IframeProps & react.RefAttributes<HTMLIFrameElement>>;
228
+ declare const _default$i: react.ForwardRefExoticComponent<IframeProps & react.RefAttributes<HTMLIFrameElement>>;
208
229
 
209
230
  /**
210
231
  * 组件映射类型,用于延时加载
@@ -220,6 +241,8 @@ interface LazyComponentProps {
220
241
  type: string;
221
242
  /** 自定义组件映射 */
222
243
  customComponents?: ComponentMapType;
244
+ /** 未知类型时显示的内容,默认为警告提示 */
245
+ unknownContent?: React.ReactNode;
223
246
  /** 其他属性会透传给组件 */
224
247
  [key: string]: any;
225
248
  }
@@ -229,7 +252,97 @@ interface LazyComponentProps {
229
252
  * 使用示例:<LazyComponent type="renderMarkdown" data={{}} loading={true} />
230
253
  * @param props - 组件属性
231
254
  */
232
- declare const _default$g: ({ type, customComponents, ...rest }: LazyComponentProps) => react_jsx_runtime.JSX.Element;
255
+ declare const _default$h: ({ type, customComponents, unknownContent, ...rest }: LazyComponentProps) => string | number | true | react_jsx_runtime.JSX.Element | Iterable<react.ReactNode>;
256
+
257
+ /**
258
+ * 批注功能配置
259
+ */
260
+ interface AnnotationsProps {
261
+ /** 是否启用批注功能,默认为false */
262
+ enabled: boolean;
263
+ /** 当前用户 */
264
+ user: {
265
+ id: string;
266
+ name: string;
267
+ };
268
+ /** 是否显示批注列表,默认为true */
269
+ showList?: boolean;
270
+ /** 受控属性:批注列表是否可见 */
271
+ visible?: boolean;
272
+ /** 受控属性:批注列表可见性改变回调 */
273
+ onVisibleChange?: (visible: boolean) => void;
274
+ }
275
+
276
+ declare module "@tiptap/core" {
277
+ interface Commands<ReturnType> {
278
+ annotation: {
279
+ selectAnnotation: (id: string) => any;
280
+ moveCursorToAnnotation: (id: string) => any;
281
+ };
282
+ }
283
+ }
284
+
285
+ /**
286
+ * 批注功能配置接口
287
+ */
288
+ interface AnnotationConfig extends AnnotationsProps {
289
+ getContainer?: () => HTMLElement | null;
290
+ }
291
+
292
+ declare const COLLECTION_ATTRS: readonly ["collection-id", "user-name", "user-id", "update-time", "page-no"];
293
+ type CollectionType = {
294
+ text: string;
295
+ from: number;
296
+ to: number;
297
+ pageNo?: string;
298
+ } & {
299
+ [key in (typeof COLLECTION_ATTRS)[number]]: string;
300
+ };
301
+ /**
302
+ * 收录功能配置
303
+ */
304
+ interface CollectionsProps {
305
+ /** 是否启用批注功能,默认为false */
306
+ enabled: boolean;
307
+ /** 当前用户 */
308
+ user: {
309
+ id: string;
310
+ name: string;
311
+ };
312
+ /** 是否显示收录列表,默认为true */
313
+ showList?: boolean;
314
+ /** 受控属性:批注列表是否可见 */
315
+ visible?: boolean;
316
+ /** 受控属性:批注列表可见性改变回调 */
317
+ onVisibleChange?: (visible: boolean) => void;
318
+ /**
319
+ * 创建收录的回调
320
+ * @param data 收录数据
321
+ * @returns 返回收录ID(如果有),返回Promise
322
+ */
323
+ onBeforeCreate?: (data: {
324
+ content: string;
325
+ pageNo?: number;
326
+ }) => Promise<string>;
327
+ /**
328
+ * 自定义渲染收录列表项
329
+ * @param props 列表项数据及操作
330
+ * @returns React节点
331
+ */
332
+ renderItem?: (props: {
333
+ collection: CollectionType;
334
+ isSelected: boolean;
335
+ onSelect: () => void;
336
+ onDelete: () => void;
337
+ }) => React.ReactNode;
338
+ }
339
+
340
+ /**
341
+ * 收录功能配置接口
342
+ */
343
+ interface CollectionConfig extends CollectionsProps {
344
+ getContainer?: () => HTMLElement | null;
345
+ }
233
346
 
234
347
  /**
235
348
  * Markdown编辑器组件属性接口
@@ -243,16 +356,24 @@ interface MarkdownEditorProps {
243
356
  value?: string;
244
357
  /** 内容变化回调 */
245
358
  onChange?: (value: string) => void;
246
- /** 页面滚动回调 */
247
- onScrollPage?: (pageIndex: number) => void;
248
359
  /** 额外导航内容 */
249
360
  extraNav?: ReactNode;
250
361
  /** 是否显示工具栏,默认为true */
251
362
  showToolbar?: boolean;
252
363
  /** 引用文本回调 */
253
- onQuote?: (text: string) => void;
364
+ onQuote?: (text?: string, markdown?: string) => void;
254
365
  /** 文件下载回调 */
255
366
  onDownloadFile?: (fileContent: string, targetFormat?: string) => Promise<void>;
367
+ /** 批注功能配置对象 */
368
+ annotationConfig?: AnnotationConfig;
369
+ /** 收录功能专属配置,不与批注混淆 */
370
+ collectionConfig?: CollectionConfig;
371
+ pageNoConfig?: {
372
+ /** 是否启用分页功能,默认为false */
373
+ enabled: boolean;
374
+ /** 页面滚动回调 */
375
+ onScrollPage?: (pageIndex: number) => void;
376
+ };
256
377
  }
257
378
  /**
258
379
  * Markdown编辑器组件
@@ -260,7 +381,30 @@ interface MarkdownEditorProps {
260
381
  * 提供丰富的编辑功能:格式化、链接、图片、表格、高亮等
261
382
  * @param props - 组件属性
262
383
  */
263
- declare const _default$f: ({ value, onChange, onScrollPage, searchValue, disabled, extraNav, showToolbar, onQuote, onDownloadFile }: MarkdownEditorProps) => react_jsx_runtime.JSX.Element;
384
+ declare const _default$g: ({ value, onChange, searchValue, disabled, extraNav, showToolbar, onQuote, onDownloadFile, annotationConfig, collectionConfig, pageNoConfig }: MarkdownEditorProps) => react_jsx_runtime.JSX.Element;
385
+
386
+ interface Detection {
387
+ bbox: [number, number, number, number];
388
+ score: number;
389
+ }
390
+ interface SizeType {
391
+ width: number;
392
+ height: number;
393
+ }
394
+ interface MarkDrawingProps {
395
+ children: ReactNode;
396
+ detections: Detection[];
397
+ originalSize: SizeType;
398
+ }
399
+ /**
400
+ * MarkDrawing组件
401
+ * 在指定内容上绘制检测框,常用于图像标注、物体识别可视化等场景
402
+ * 根据原始尺寸和当前容器尺寸自动计算缩放比例,确保标注框准确显示
403
+ * @param children - 待绘制标注的内容
404
+ * @param detections - 检测结果数组
405
+ * @param originalSize - 原始尺寸信息
406
+ */
407
+ declare const _default$f: ({ children, detections, originalSize }: MarkDrawingProps) => react_jsx_runtime.JSX.Element;
264
408
 
265
409
  /**
266
410
  * Markdown渲染组件属性接口
@@ -777,7 +921,7 @@ declare const setInterval: (fn: () => void | Promise<void>, t: number) => {
777
921
  * const id = genNonDuplicateID()
778
922
  * console.log(id) // 输出类似: "f8c8e6d2-35a2-4f4d-9d53-994f2b6e1c2d"
779
923
  */
780
- declare const genNonDuplicateID: () => `${string}-${string}-${string}-${string}-${string}`;
924
+ declare const genNonDuplicateID: () => string;
781
925
  /**
782
926
  * 复制文本到剪贴板
783
927
  *
@@ -1172,6 +1316,24 @@ declare const formatSize: (value: number | string, options?: FormatSizeOptions)
1172
1316
  * markdownToText('## 标题\n\n- 列表项1\n- 列表项2 <div>123</div>') // '标题 列表项1 列表项2 123'
1173
1317
  */
1174
1318
  declare const markdownToText: (markdown: string) => string;
1319
+ /**
1320
+ * HTML 转 纯文本
1321
+ * @param html - 原始 HTML 内容
1322
+ * @returns 纯文本
1323
+ * @description 使用 'html-to-text' 库进行转换,相比简单的正则替换,能更好地保留结构(如列表、表格等)。
1324
+ * @example
1325
+ * htmlToText('<div>标题</div><p>内容</p>') // '标题\n\n内容'
1326
+ */
1327
+ declare const htmlToText: (html: string) => string;
1328
+ /**
1329
+ * HTML 转 Markdown
1330
+ * @param html - 原始 HTML 内容
1331
+ * @returns Markdown 内容
1332
+ * @description 使用 'turndown' 库进行转换。
1333
+ * @example
1334
+ * htmlToMarkdown('<h1>标题</h1><p>内容</p>') // '# 标题\n\n内容'
1335
+ */
1336
+ declare const htmlToMarkdown: (html: string) => string;
1175
1337
  interface FindTreeNodesOptions {
1176
1338
  /** 树的id字段名,默认 "id" */
1177
1339
  id?: string;
@@ -2313,4 +2475,4 @@ declare function createTokenManager({ key, storage }: TokenManagerProps): {
2313
2475
  clear: () => void;
2314
2476
  };
2315
2477
 
2316
- export { _default$p as AudioPlayer, type AudioPlayerProps, BusinessCode, type CacheMessage, type ComponentMapType, DEFAULT_DATE_FORMAT, DEFAULT_DATE_TIME_FORMAT, DEFAULT_YEAR_MONTH_DAY_FORMAT, DEFAULT_YEAR_MONTH_FORMAT, _default$o as DocxPreview, type DocxPreviewProps, _default$n as FileIcon, type FileIconProps, _default$m as FilePreview, _default$l as FilePreviewDrawer, type FilePreviewDrawerProps, type FilePreviewProps, type FindTreeNodesOptions, type FormatSizeOptions, HttpStatus, _default$h as Iframe, type IframeProps, _default$g as LazyComponent, type LazyComponentProps, _default$f as MarkdownEditor, type MarkdownEditorProps, _default$k as MarkdownPreview, type MarkdownPreviewProps, MultiEmailValidator, _default$j 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$i 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, 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 };
2478
+ export { _default$r as AudioPlayer, type AudioPlayerProps, BusinessCode, type CacheMessage, 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 };