@zero-library/common 2.4.4 → 3.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.
package/dist/index.d.mts CHANGED
@@ -2,6 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { EmptyProps } from 'antd';
3
3
  import * as react from 'react';
4
4
  import { ReactNode } from 'react';
5
+ import { Editor, FocusPosition, Content, InsertContentOptions, InsertContentAtOptions } from '@tiptap/core';
5
6
  import dayjs from 'dayjs';
6
7
  import Decimal from 'decimal.js';
7
8
  import { RuleObject } from 'antd/es/form';
@@ -20,7 +21,7 @@ interface AudioPlayerProps {
20
21
  * 提供基本的音频播放功能
21
22
  * @param props - 组件属性
22
23
  */
23
- declare const _default$q: ({ fileUrl }: AudioPlayerProps) => react_jsx_runtime.JSX.Element;
24
+ declare const _default$t: ({ fileUrl }: AudioPlayerProps) => react_jsx_runtime.JSX.Element;
24
25
 
25
26
  /** Docx文档预览组件的属性接口 */
26
27
  interface DocxPreviewProps {
@@ -33,7 +34,7 @@ interface DocxPreviewProps {
33
34
  * Docx文档预览组件
34
35
  * @param props - 组件属性
35
36
  */
36
- declare const _default$p: ({ fileUrl, scale }: DocxPreviewProps) => react_jsx_runtime.JSX.Element;
37
+ declare const _default$s: ({ fileUrl, scale }: DocxPreviewProps) => react_jsx_runtime.JSX.Element;
37
38
 
38
39
  /**
39
40
  * 文件图标组件属性接口
@@ -59,7 +60,7 @@ interface FileIconProps {
59
60
  * @param props - 组件属性
60
61
  * @returns 对应文件类型的图标
61
62
  */
62
- declare const _default$o: ({ suffix, fontSize }: FileIconProps) => react_jsx_runtime.JSX.Element;
63
+ declare const _default$r: ({ suffix, fontSize }: FileIconProps) => react_jsx_runtime.JSX.Element;
63
64
 
64
65
  /**
65
66
  * 文件预览组件属性接口
@@ -93,7 +94,7 @@ interface FilePreviewProps {
93
94
  * 支持图片、PDF、视频、音频、Markdown等文件格式的预览
94
95
  * @param props - 组件属性
95
96
  */
96
- declare const _default$n: ({ suffix, fileUrl, pdfParams, password, searchValue, emptyProps, onSetPassword }: FilePreviewProps) => react_jsx_runtime.JSX.Element;
97
+ declare const _default$q: ({ suffix, fileUrl, pdfParams, password, searchValue, emptyProps, onSetPassword }: FilePreviewProps) => react_jsx_runtime.JSX.Element;
97
98
 
98
99
  /**
99
100
  * 文件预览抽屉组件属性接口
@@ -123,7 +124,7 @@ interface FilePreviewDrawerProps extends FilePreviewProps {
123
124
  * @param props - 组件属性
124
125
  * @returns 文件预览抽屉组件
125
126
  */
126
- declare const _default$m: ({ open, title, onClose, ...props }: FilePreviewDrawerProps) => react_jsx_runtime.JSX.Element;
127
+ declare const _default$p: ({ open, title, onClose, ...props }: FilePreviewDrawerProps) => react_jsx_runtime.JSX.Element;
127
128
 
128
129
  /**
129
130
  * Markdown | txt 预览组件属性接口
@@ -141,7 +142,7 @@ interface MarkdownPreviewProps {
141
142
  * 从指定URL获取Markdown或txt内容并渲染显示
142
143
  * @param props - 组件属性
143
144
  */
144
- declare const _default$l: ({ fileUrl, searchValue, asPlainText }: MarkdownPreviewProps) => react_jsx_runtime.JSX.Element;
145
+ declare const _default$o: ({ fileUrl, searchValue, asPlainText }: MarkdownPreviewProps) => react_jsx_runtime.JSX.Element;
145
146
 
146
147
  interface PdfImagePreviewProps {
147
148
  /** PDF文件URL地址 */
@@ -161,7 +162,7 @@ interface PdfImagePreviewProps {
161
162
  * @param props - 组件属性
162
163
  * 适用于大量PDF页面的高效展示
163
164
  */
164
- declare const _default$k: ({ fileUrl, pageNo, scale, isHasThumbnails, onSetPageNo }: PdfImagePreviewProps) => react_jsx_runtime.JSX.Element;
165
+ declare const _default$n: ({ fileUrl, pageNo, scale, isHasThumbnails, onSetPageNo }: PdfImagePreviewProps) => react_jsx_runtime.JSX.Element;
165
166
 
166
167
  /**
167
168
  * PDF预览组件属性接口
@@ -189,7 +190,7 @@ interface PdfPreviewProps {
189
190
  * @param props - 组件属性
190
191
  * TODO 放大缩小会丢失分页
191
192
  */
192
- declare const _default$j: ({ password, fileUrl, pageNo, scale, isHasThumbnails, onSetPassword, onSetPageNo }: PdfPreviewProps) => react_jsx_runtime.JSX.Element;
193
+ declare const _default$m: ({ password, fileUrl, pageNo, scale, isHasThumbnails, onSetPassword, onSetPageNo }: PdfPreviewProps) => react_jsx_runtime.JSX.Element;
193
194
 
194
195
  /**
195
196
  * 视频播放器组件属性接口
@@ -203,7 +204,48 @@ interface VideoPlayerProps {
203
204
  * 提供基本的视频播放功能
204
205
  * @param props - 组件属性
205
206
  */
206
- declare const _default$i: ({ fileUrl }: VideoPlayerProps) => react_jsx_runtime.JSX.Element;
207
+ declare const _default$l: ({ fileUrl }: VideoPlayerProps) => react_jsx_runtime.JSX.Element;
208
+
209
+ interface MicroAppProps {
210
+ /** 应用名称(micro-app 必须唯一) */
211
+ name: string;
212
+ /** 应用地址 */
213
+ url: string;
214
+ /** 自定义类名 */
215
+ className?: string;
216
+ /** 加载完成 */
217
+ onMounted?: () => void;
218
+ /** 加载出错 */
219
+ onError?: (e?: any) => void;
220
+ /** 传递给子应用的数据 */
221
+ data?: Record<string, any>;
222
+ /** 其他 micro-app 支持的属性 (如 keep-alive, destroy 等) */
223
+ [key: string]: any;
224
+ }
225
+ /**
226
+ * MicroApp 封装组件(类 iframe)
227
+ */
228
+ declare const _default$k: ({ name, url, className, onMounted, onError, data, ...rest }: MicroAppProps) => react_jsx_runtime.JSX.Element;
229
+
230
+ interface Props$1 {
231
+ name: string;
232
+ }
233
+ interface PodOpenProps {
234
+ name?: string;
235
+ title: string | false;
236
+ url: string;
237
+ }
238
+ declare const _default$j: ({ name: podName }: Props$1) => react_jsx_runtime.JSX.Element;
239
+
240
+ interface Props {
241
+ defaultUrl: string;
242
+ name: string;
243
+ }
244
+ interface WindowOpenProps {
245
+ name?: string;
246
+ url: string;
247
+ }
248
+ declare const _default$i: ({ defaultUrl, name: appName }: Props) => react_jsx_runtime.JSX.Element;
207
249
 
208
250
  /**
209
251
  * Iframe组件属性接口
@@ -395,13 +437,44 @@ interface MarkdownEditorProps {
395
437
  collectionConfig?: CollectionConfig;
396
438
  pageNoConfig?: PageNoConfig;
397
439
  }
440
+ /**
441
+ * MarkdownEditor 暴露给父组件的实例方法集合
442
+ * 通常通过 ref 获取,用于访问底层编辑器实例或进行插入/聚焦等操作
443
+ */
444
+ interface MarkdownEditorHandle {
445
+ /** 获取底层 Tiptap Editor 实例 */
446
+ getEditor: () => Editor;
447
+ /** 获取当前编辑器的 Markdown 文本 */
448
+ getMarkdown: () => string;
449
+ /**
450
+ * 聚焦编辑器
451
+ * @param pos - 可选的聚焦位置
452
+ */
453
+ focus: (pos?: FocusPosition) => void;
454
+ /**
455
+ * 在当前光标位置插入内容
456
+ * @param value - 待插入的内容
457
+ * @param options - 插入选项
458
+ */
459
+ insertContent: (value: Content, options?: InsertContentOptions) => void;
460
+ /**
461
+ * 在指定位置范围内插入内容
462
+ * @param position - 插入位置;number 表示单点位置,{from,to} 表示范围
463
+ * @param value - 待插入的内容
464
+ * @param options - 插入选项
465
+ */
466
+ insertContentAt: (position: number | {
467
+ from: number;
468
+ to: number;
469
+ }, value: Content, options?: InsertContentAtOptions) => void;
470
+ }
398
471
  /**
399
472
  * Markdown编辑器组件
400
473
  * 基于Tiptap构建的富文本编辑器,支持Markdown语法
401
474
  * 提供丰富的编辑功能:格式化、链接、图片、表格、高亮等
402
475
  * @param props - 组件属性
403
476
  */
404
- declare const _default$f: ({ value, onChange, searchValue, disabled, extraNav, fixedToolbar, floatToolbar, onQuote, onDownloadFile, annotationConfig, collectionConfig, pageNoConfig }: MarkdownEditorProps) => react_jsx_runtime.JSX.Element;
477
+ declare const _default$f: react.ForwardRefExoticComponent<MarkdownEditorProps & react.RefAttributes<MarkdownEditorHandle>>;
405
478
 
406
479
  interface Detection {
407
480
  bbox: [number, number, number, number];
@@ -543,12 +616,20 @@ declare const _default$b: ({ size, avatarSrc, userName }: UserAvatarProps) => re
543
616
  */
544
617
  type Params = Record<string, any>;
545
618
  /**
546
- * 向父页面或顶级窗口发送消息
619
+ * iframe 消息目标类型
620
+ * 定义跨iframe通信时的消息目标方向
621
+ */
622
+ type ToType = 'parent' | 'top' | 'nearest' | 'broadcast' | 'sibling';
623
+ /**
624
+ * 向父页面、顶级窗口或同级窗口发送消息
547
625
  * @param type - 消息类型
548
626
  * @param data - 消息数据
549
- * @param to - 发送目标,默认为'top'
627
+ * @param to - 发送目标,默认为'top'
628
+ * 'nearest'表示最近的监听者,
629
+ * 'broadcast'表示向上广播给所有监听者,
630
+ * 'sibling'表示通知当前窗口内的其他组件(不跨iframe)。
550
631
  */
551
- declare function emit(type: string, data?: Params, to?: 'parent' | 'top'): void;
632
+ declare function emit(type: string, data?: Params, to?: ToType): void;
552
633
  /**
553
634
  * 向子iframe发送消息
554
635
  * @param iframeWindow - 目标iframe的contentWindow
@@ -750,16 +831,9 @@ declare const _default$1: <A extends Array<any>, R = void>(func: (..._args: A) =
750
831
  cancel: () => void;
751
832
  };
752
833
 
753
- /**
754
- * useWebSocket Hook 参数类型定义
755
- */
756
- interface WebSocketProps {
834
+ interface WebSocketManagerOptions {
757
835
  /** WebSocket 服务器地址 */
758
836
  url: string;
759
- /** 接收到消息时的回调函数 */
760
- onMessage: (message: any) => void;
761
- /** 连接关闭时的回调函数(可选) */
762
- onClose?: () => void;
763
837
  /** 心跳间隔时间,单位毫秒,默认 30000ms */
764
838
  heartbeatInterval?: number;
765
839
  /** 心跳消息内容,默认 'ping' */
@@ -773,6 +847,16 @@ interface WebSocketProps {
773
847
  /** 是否开启重连机制,默认 true */
774
848
  isReconnect?: boolean;
775
849
  }
850
+
851
+ /**
852
+ * useWebSocket Hook 参数类型定义
853
+ */
854
+ interface WebSocketProps extends WebSocketManagerOptions {
855
+ /** 接收到消息时的回调函数 */
856
+ onMessage: (message: any) => void;
857
+ /** 连接关闭时的回调函数(可选) */
858
+ onClose?: () => void;
859
+ }
776
860
  /**
777
861
  * useWebSocket Hook 返回值类型定义
778
862
  */
@@ -791,6 +875,14 @@ interface WebSocketType {
791
875
  * - 页面可见性监听
792
876
  * - 连接状态管理
793
877
  * - 消息发送与接收
878
+ * - 多组件共享连接(相同 url 多次调用只会创建一个连接)
879
+ *
880
+ * 使用说明:
881
+ * - 相同 `url` 的多个组件会复用同一个 `WebSocketManager` 和底层连接
882
+ * - 断线重连时会重新创建底层 `WebSocket`,但已注册的组件监听器会继续保留
883
+ * - `onMessage` 和 `onClose` 通过 `ref` 持有最新引用,组件重渲染后无需重新建立连接
884
+ * - 当前 Hook 仅在 `url` 变化时重新订阅;同一 `url` 下修改心跳、重连等配置不会立即更新已存在的管理器实例
885
+ * - 组件卸载或 `url` 变化时会移除当前监听器;当某个 `url` 没有任何订阅者后,连接会在短暂缓冲后销毁
794
886
  *
795
887
  * @example
796
888
  * ```tsx
@@ -2503,4 +2595,4 @@ declare function createTokenManager({ key, storage }: TokenManagerProps): {
2503
2595
  clear: () => void;
2504
2596
  };
2505
2597
 
2506
- export { type AnnotationConfig, type AnnotationType, _default$q 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$p as DocxPreview, type DocxPreviewProps, _default$o as FileIcon, type FileIconProps, _default$n as FilePreview, _default$m as FilePreviewDrawer, type FilePreviewDrawerProps, type FilePreviewProps, type FindTreeNodesOptions, type FormatSizeOptions, HttpStatus, _default$h as Iframe, type IframeProps, _default$g as LazyComponent, type LazyComponentProps, _default$e as MarkDrawing, type MarkDrawingProps, _default$f as MarkdownEditor, type MarkdownEditorProps, _default$l as MarkdownPreview, type MarkdownPreviewProps, MultiEmailValidator, type PageNoConfig, _default$k as PdfImagePreview, type PdfImagePreviewProps, _default$j as PdfPreview, type PdfPreviewProps, PhoneOrMobileValidator, RegBankCardNo, RegDetailAddress, RegEmail, RegFixedTelePhone, RegIdentityCardNo, RegMobile, RegNumNo, RegPassword, RegSmsCode, RegTaxNo, RegTelePhone, type RenderControl, _default$d as RenderMarkdown, type RenderMarkdownProps, _default$c as RenderWrapper, type RenderWrapperProps, type RequestConfig, type SecureManagerProps, type SetIntervalType, type SizeUnit, ThanNumLengthValidator, ThanNumValidator, type TokenManagerProps, _default$b 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, 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$9 as useAsyncQueue, _default$8 as useAutoRefresh, _default$7 as useCountDown, _default$6 as useCreateValtioContext, _default$5 as useDebounce, _default$4 as useDeepEffect, _default$a as useIframeRelayBridge, _default$3 as useRefState, _default$2 as useSyncInput, _default$1 as useThrottle, _default as useWebSocket };
2598
+ export { type AnnotationConfig, type AnnotationType, _default$t 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$s as DocxPreview, type DocxPreviewProps, _default$r as FileIcon, type FileIconProps, _default$q as FilePreview, _default$p as FilePreviewDrawer, type FilePreviewDrawerProps, type FilePreviewProps, type FindTreeNodesOptions, type FormatSizeOptions, HttpStatus, _default$h as Iframe, type IframeProps, _default$g as LazyComponent, type LazyComponentProps, _default$e as MarkDrawing, type MarkDrawingProps, _default$f as MarkdownEditor, type MarkdownEditorHandle, type MarkdownEditorProps, _default$o as MarkdownPreview, type MarkdownPreviewProps, _default$k as MicroApp, _default$j as MicroAppDrawer, type MicroAppProps, _default$i as MicroAppWindow, MultiEmailValidator, type PageNoConfig, _default$n as PdfImagePreview, type PdfImagePreviewProps, _default$m as PdfPreview, type PdfPreviewProps, PhoneOrMobileValidator, type PodOpenProps, RegBankCardNo, RegDetailAddress, RegEmail, RegFixedTelePhone, RegIdentityCardNo, RegMobile, RegNumNo, RegPassword, RegSmsCode, RegTaxNo, RegTelePhone, type RenderControl, _default$d as RenderMarkdown, type RenderMarkdownProps, _default$c as RenderWrapper, type RenderWrapperProps, type RequestConfig, type SecureManagerProps, type SetIntervalType, type SizeUnit, ThanNumLengthValidator, ThanNumValidator, type TokenManagerProps, _default$b as UserAvatar, type UserAvatarProps, _default$l as VideoPlayer, type VideoPlayerProps, type WebSocketProps, type WebSocketType, type WindowOpenProps, 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$9 as useAsyncQueue, _default$8 as useAutoRefresh, _default$7 as useCountDown, _default$6 as useCreateValtioContext, _default$5 as useDebounce, _default$4 as useDeepEffect, _default$a as useIframeRelayBridge, _default$3 as useRefState, _default$2 as useSyncInput, _default$1 as useThrottle, _default as useWebSocket };
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { EmptyProps } from 'antd';
3
3
  import * as react from 'react';
4
4
  import { ReactNode } from 'react';
5
+ import { Editor, FocusPosition, Content, InsertContentOptions, InsertContentAtOptions } from '@tiptap/core';
5
6
  import dayjs from 'dayjs';
6
7
  import Decimal from 'decimal.js';
7
8
  import { RuleObject } from 'antd/es/form';
@@ -20,7 +21,7 @@ interface AudioPlayerProps {
20
21
  * 提供基本的音频播放功能
21
22
  * @param props - 组件属性
22
23
  */
23
- declare const _default$q: ({ fileUrl }: AudioPlayerProps) => react_jsx_runtime.JSX.Element;
24
+ declare const _default$t: ({ fileUrl }: AudioPlayerProps) => react_jsx_runtime.JSX.Element;
24
25
 
25
26
  /** Docx文档预览组件的属性接口 */
26
27
  interface DocxPreviewProps {
@@ -33,7 +34,7 @@ interface DocxPreviewProps {
33
34
  * Docx文档预览组件
34
35
  * @param props - 组件属性
35
36
  */
36
- declare const _default$p: ({ fileUrl, scale }: DocxPreviewProps) => react_jsx_runtime.JSX.Element;
37
+ declare const _default$s: ({ fileUrl, scale }: DocxPreviewProps) => react_jsx_runtime.JSX.Element;
37
38
 
38
39
  /**
39
40
  * 文件图标组件属性接口
@@ -59,7 +60,7 @@ interface FileIconProps {
59
60
  * @param props - 组件属性
60
61
  * @returns 对应文件类型的图标
61
62
  */
62
- declare const _default$o: ({ suffix, fontSize }: FileIconProps) => react_jsx_runtime.JSX.Element;
63
+ declare const _default$r: ({ suffix, fontSize }: FileIconProps) => react_jsx_runtime.JSX.Element;
63
64
 
64
65
  /**
65
66
  * 文件预览组件属性接口
@@ -93,7 +94,7 @@ interface FilePreviewProps {
93
94
  * 支持图片、PDF、视频、音频、Markdown等文件格式的预览
94
95
  * @param props - 组件属性
95
96
  */
96
- declare const _default$n: ({ suffix, fileUrl, pdfParams, password, searchValue, emptyProps, onSetPassword }: FilePreviewProps) => react_jsx_runtime.JSX.Element;
97
+ declare const _default$q: ({ suffix, fileUrl, pdfParams, password, searchValue, emptyProps, onSetPassword }: FilePreviewProps) => react_jsx_runtime.JSX.Element;
97
98
 
98
99
  /**
99
100
  * 文件预览抽屉组件属性接口
@@ -123,7 +124,7 @@ interface FilePreviewDrawerProps extends FilePreviewProps {
123
124
  * @param props - 组件属性
124
125
  * @returns 文件预览抽屉组件
125
126
  */
126
- declare const _default$m: ({ open, title, onClose, ...props }: FilePreviewDrawerProps) => react_jsx_runtime.JSX.Element;
127
+ declare const _default$p: ({ open, title, onClose, ...props }: FilePreviewDrawerProps) => react_jsx_runtime.JSX.Element;
127
128
 
128
129
  /**
129
130
  * Markdown | txt 预览组件属性接口
@@ -141,7 +142,7 @@ interface MarkdownPreviewProps {
141
142
  * 从指定URL获取Markdown或txt内容并渲染显示
142
143
  * @param props - 组件属性
143
144
  */
144
- declare const _default$l: ({ fileUrl, searchValue, asPlainText }: MarkdownPreviewProps) => react_jsx_runtime.JSX.Element;
145
+ declare const _default$o: ({ fileUrl, searchValue, asPlainText }: MarkdownPreviewProps) => react_jsx_runtime.JSX.Element;
145
146
 
146
147
  interface PdfImagePreviewProps {
147
148
  /** PDF文件URL地址 */
@@ -161,7 +162,7 @@ interface PdfImagePreviewProps {
161
162
  * @param props - 组件属性
162
163
  * 适用于大量PDF页面的高效展示
163
164
  */
164
- declare const _default$k: ({ fileUrl, pageNo, scale, isHasThumbnails, onSetPageNo }: PdfImagePreviewProps) => react_jsx_runtime.JSX.Element;
165
+ declare const _default$n: ({ fileUrl, pageNo, scale, isHasThumbnails, onSetPageNo }: PdfImagePreviewProps) => react_jsx_runtime.JSX.Element;
165
166
 
166
167
  /**
167
168
  * PDF预览组件属性接口
@@ -189,7 +190,7 @@ interface PdfPreviewProps {
189
190
  * @param props - 组件属性
190
191
  * TODO 放大缩小会丢失分页
191
192
  */
192
- declare const _default$j: ({ password, fileUrl, pageNo, scale, isHasThumbnails, onSetPassword, onSetPageNo }: PdfPreviewProps) => react_jsx_runtime.JSX.Element;
193
+ declare const _default$m: ({ password, fileUrl, pageNo, scale, isHasThumbnails, onSetPassword, onSetPageNo }: PdfPreviewProps) => react_jsx_runtime.JSX.Element;
193
194
 
194
195
  /**
195
196
  * 视频播放器组件属性接口
@@ -203,7 +204,48 @@ interface VideoPlayerProps {
203
204
  * 提供基本的视频播放功能
204
205
  * @param props - 组件属性
205
206
  */
206
- declare const _default$i: ({ fileUrl }: VideoPlayerProps) => react_jsx_runtime.JSX.Element;
207
+ declare const _default$l: ({ fileUrl }: VideoPlayerProps) => react_jsx_runtime.JSX.Element;
208
+
209
+ interface MicroAppProps {
210
+ /** 应用名称(micro-app 必须唯一) */
211
+ name: string;
212
+ /** 应用地址 */
213
+ url: string;
214
+ /** 自定义类名 */
215
+ className?: string;
216
+ /** 加载完成 */
217
+ onMounted?: () => void;
218
+ /** 加载出错 */
219
+ onError?: (e?: any) => void;
220
+ /** 传递给子应用的数据 */
221
+ data?: Record<string, any>;
222
+ /** 其他 micro-app 支持的属性 (如 keep-alive, destroy 等) */
223
+ [key: string]: any;
224
+ }
225
+ /**
226
+ * MicroApp 封装组件(类 iframe)
227
+ */
228
+ declare const _default$k: ({ name, url, className, onMounted, onError, data, ...rest }: MicroAppProps) => react_jsx_runtime.JSX.Element;
229
+
230
+ interface Props$1 {
231
+ name: string;
232
+ }
233
+ interface PodOpenProps {
234
+ name?: string;
235
+ title: string | false;
236
+ url: string;
237
+ }
238
+ declare const _default$j: ({ name: podName }: Props$1) => react_jsx_runtime.JSX.Element;
239
+
240
+ interface Props {
241
+ defaultUrl: string;
242
+ name: string;
243
+ }
244
+ interface WindowOpenProps {
245
+ name?: string;
246
+ url: string;
247
+ }
248
+ declare const _default$i: ({ defaultUrl, name: appName }: Props) => react_jsx_runtime.JSX.Element;
207
249
 
208
250
  /**
209
251
  * Iframe组件属性接口
@@ -395,13 +437,44 @@ interface MarkdownEditorProps {
395
437
  collectionConfig?: CollectionConfig;
396
438
  pageNoConfig?: PageNoConfig;
397
439
  }
440
+ /**
441
+ * MarkdownEditor 暴露给父组件的实例方法集合
442
+ * 通常通过 ref 获取,用于访问底层编辑器实例或进行插入/聚焦等操作
443
+ */
444
+ interface MarkdownEditorHandle {
445
+ /** 获取底层 Tiptap Editor 实例 */
446
+ getEditor: () => Editor;
447
+ /** 获取当前编辑器的 Markdown 文本 */
448
+ getMarkdown: () => string;
449
+ /**
450
+ * 聚焦编辑器
451
+ * @param pos - 可选的聚焦位置
452
+ */
453
+ focus: (pos?: FocusPosition) => void;
454
+ /**
455
+ * 在当前光标位置插入内容
456
+ * @param value - 待插入的内容
457
+ * @param options - 插入选项
458
+ */
459
+ insertContent: (value: Content, options?: InsertContentOptions) => void;
460
+ /**
461
+ * 在指定位置范围内插入内容
462
+ * @param position - 插入位置;number 表示单点位置,{from,to} 表示范围
463
+ * @param value - 待插入的内容
464
+ * @param options - 插入选项
465
+ */
466
+ insertContentAt: (position: number | {
467
+ from: number;
468
+ to: number;
469
+ }, value: Content, options?: InsertContentAtOptions) => void;
470
+ }
398
471
  /**
399
472
  * Markdown编辑器组件
400
473
  * 基于Tiptap构建的富文本编辑器,支持Markdown语法
401
474
  * 提供丰富的编辑功能:格式化、链接、图片、表格、高亮等
402
475
  * @param props - 组件属性
403
476
  */
404
- declare const _default$f: ({ value, onChange, searchValue, disabled, extraNav, fixedToolbar, floatToolbar, onQuote, onDownloadFile, annotationConfig, collectionConfig, pageNoConfig }: MarkdownEditorProps) => react_jsx_runtime.JSX.Element;
477
+ declare const _default$f: react.ForwardRefExoticComponent<MarkdownEditorProps & react.RefAttributes<MarkdownEditorHandle>>;
405
478
 
406
479
  interface Detection {
407
480
  bbox: [number, number, number, number];
@@ -543,12 +616,20 @@ declare const _default$b: ({ size, avatarSrc, userName }: UserAvatarProps) => re
543
616
  */
544
617
  type Params = Record<string, any>;
545
618
  /**
546
- * 向父页面或顶级窗口发送消息
619
+ * iframe 消息目标类型
620
+ * 定义跨iframe通信时的消息目标方向
621
+ */
622
+ type ToType = 'parent' | 'top' | 'nearest' | 'broadcast' | 'sibling';
623
+ /**
624
+ * 向父页面、顶级窗口或同级窗口发送消息
547
625
  * @param type - 消息类型
548
626
  * @param data - 消息数据
549
- * @param to - 发送目标,默认为'top'
627
+ * @param to - 发送目标,默认为'top'
628
+ * 'nearest'表示最近的监听者,
629
+ * 'broadcast'表示向上广播给所有监听者,
630
+ * 'sibling'表示通知当前窗口内的其他组件(不跨iframe)。
550
631
  */
551
- declare function emit(type: string, data?: Params, to?: 'parent' | 'top'): void;
632
+ declare function emit(type: string, data?: Params, to?: ToType): void;
552
633
  /**
553
634
  * 向子iframe发送消息
554
635
  * @param iframeWindow - 目标iframe的contentWindow
@@ -750,16 +831,9 @@ declare const _default$1: <A extends Array<any>, R = void>(func: (..._args: A) =
750
831
  cancel: () => void;
751
832
  };
752
833
 
753
- /**
754
- * useWebSocket Hook 参数类型定义
755
- */
756
- interface WebSocketProps {
834
+ interface WebSocketManagerOptions {
757
835
  /** WebSocket 服务器地址 */
758
836
  url: string;
759
- /** 接收到消息时的回调函数 */
760
- onMessage: (message: any) => void;
761
- /** 连接关闭时的回调函数(可选) */
762
- onClose?: () => void;
763
837
  /** 心跳间隔时间,单位毫秒,默认 30000ms */
764
838
  heartbeatInterval?: number;
765
839
  /** 心跳消息内容,默认 'ping' */
@@ -773,6 +847,16 @@ interface WebSocketProps {
773
847
  /** 是否开启重连机制,默认 true */
774
848
  isReconnect?: boolean;
775
849
  }
850
+
851
+ /**
852
+ * useWebSocket Hook 参数类型定义
853
+ */
854
+ interface WebSocketProps extends WebSocketManagerOptions {
855
+ /** 接收到消息时的回调函数 */
856
+ onMessage: (message: any) => void;
857
+ /** 连接关闭时的回调函数(可选) */
858
+ onClose?: () => void;
859
+ }
776
860
  /**
777
861
  * useWebSocket Hook 返回值类型定义
778
862
  */
@@ -791,6 +875,14 @@ interface WebSocketType {
791
875
  * - 页面可见性监听
792
876
  * - 连接状态管理
793
877
  * - 消息发送与接收
878
+ * - 多组件共享连接(相同 url 多次调用只会创建一个连接)
879
+ *
880
+ * 使用说明:
881
+ * - 相同 `url` 的多个组件会复用同一个 `WebSocketManager` 和底层连接
882
+ * - 断线重连时会重新创建底层 `WebSocket`,但已注册的组件监听器会继续保留
883
+ * - `onMessage` 和 `onClose` 通过 `ref` 持有最新引用,组件重渲染后无需重新建立连接
884
+ * - 当前 Hook 仅在 `url` 变化时重新订阅;同一 `url` 下修改心跳、重连等配置不会立即更新已存在的管理器实例
885
+ * - 组件卸载或 `url` 变化时会移除当前监听器;当某个 `url` 没有任何订阅者后,连接会在短暂缓冲后销毁
794
886
  *
795
887
  * @example
796
888
  * ```tsx
@@ -2503,4 +2595,4 @@ declare function createTokenManager({ key, storage }: TokenManagerProps): {
2503
2595
  clear: () => void;
2504
2596
  };
2505
2597
 
2506
- export { type AnnotationConfig, type AnnotationType, _default$q 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$p as DocxPreview, type DocxPreviewProps, _default$o as FileIcon, type FileIconProps, _default$n as FilePreview, _default$m as FilePreviewDrawer, type FilePreviewDrawerProps, type FilePreviewProps, type FindTreeNodesOptions, type FormatSizeOptions, HttpStatus, _default$h as Iframe, type IframeProps, _default$g as LazyComponent, type LazyComponentProps, _default$e as MarkDrawing, type MarkDrawingProps, _default$f as MarkdownEditor, type MarkdownEditorProps, _default$l as MarkdownPreview, type MarkdownPreviewProps, MultiEmailValidator, type PageNoConfig, _default$k as PdfImagePreview, type PdfImagePreviewProps, _default$j as PdfPreview, type PdfPreviewProps, PhoneOrMobileValidator, RegBankCardNo, RegDetailAddress, RegEmail, RegFixedTelePhone, RegIdentityCardNo, RegMobile, RegNumNo, RegPassword, RegSmsCode, RegTaxNo, RegTelePhone, type RenderControl, _default$d as RenderMarkdown, type RenderMarkdownProps, _default$c as RenderWrapper, type RenderWrapperProps, type RequestConfig, type SecureManagerProps, type SetIntervalType, type SizeUnit, ThanNumLengthValidator, ThanNumValidator, type TokenManagerProps, _default$b 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, 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$9 as useAsyncQueue, _default$8 as useAutoRefresh, _default$7 as useCountDown, _default$6 as useCreateValtioContext, _default$5 as useDebounce, _default$4 as useDeepEffect, _default$a as useIframeRelayBridge, _default$3 as useRefState, _default$2 as useSyncInput, _default$1 as useThrottle, _default as useWebSocket };
2598
+ export { type AnnotationConfig, type AnnotationType, _default$t 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$s as DocxPreview, type DocxPreviewProps, _default$r as FileIcon, type FileIconProps, _default$q as FilePreview, _default$p as FilePreviewDrawer, type FilePreviewDrawerProps, type FilePreviewProps, type FindTreeNodesOptions, type FormatSizeOptions, HttpStatus, _default$h as Iframe, type IframeProps, _default$g as LazyComponent, type LazyComponentProps, _default$e as MarkDrawing, type MarkDrawingProps, _default$f as MarkdownEditor, type MarkdownEditorHandle, type MarkdownEditorProps, _default$o as MarkdownPreview, type MarkdownPreviewProps, _default$k as MicroApp, _default$j as MicroAppDrawer, type MicroAppProps, _default$i as MicroAppWindow, MultiEmailValidator, type PageNoConfig, _default$n as PdfImagePreview, type PdfImagePreviewProps, _default$m as PdfPreview, type PdfPreviewProps, PhoneOrMobileValidator, type PodOpenProps, RegBankCardNo, RegDetailAddress, RegEmail, RegFixedTelePhone, RegIdentityCardNo, RegMobile, RegNumNo, RegPassword, RegSmsCode, RegTaxNo, RegTelePhone, type RenderControl, _default$d as RenderMarkdown, type RenderMarkdownProps, _default$c as RenderWrapper, type RenderWrapperProps, type RequestConfig, type SecureManagerProps, type SetIntervalType, type SizeUnit, ThanNumLengthValidator, ThanNumValidator, type TokenManagerProps, _default$b as UserAvatar, type UserAvatarProps, _default$l as VideoPlayer, type VideoPlayerProps, type WebSocketProps, type WebSocketType, type WindowOpenProps, 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$9 as useAsyncQueue, _default$8 as useAutoRefresh, _default$7 as useCountDown, _default$6 as useCreateValtioContext, _default$5 as useDebounce, _default$4 as useDeepEffect, _default$a as useIframeRelayBridge, _default$3 as useRefState, _default$2 as useSyncInput, _default$1 as useThrottle, _default as useWebSocket };