@zero-library/common 2.1.6 → 2.1.8
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 +42 -12
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.mts +368 -24
- package/dist/index.d.ts +368 -24
- package/dist/index.esm.js +42 -12
- package/dist/index.esm.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -6,136 +6,374 @@ import Decimal from 'decimal.js';
|
|
|
6
6
|
import { AxiosRequestConfig } from 'axios';
|
|
7
7
|
import { ThemeConfig } from 'antd/lib';
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* 音频播放器组件属性接口
|
|
11
|
+
*/
|
|
12
|
+
interface AudioPlayerProps {
|
|
13
|
+
/** 音频文件URL地址 */
|
|
10
14
|
fileUrl: string;
|
|
11
15
|
}
|
|
12
|
-
|
|
16
|
+
/**
|
|
17
|
+
* 音频播放器组件
|
|
18
|
+
* 提供基本的音频播放功能
|
|
19
|
+
* @param props - 组件属性
|
|
20
|
+
*/
|
|
21
|
+
declare const _default$b: ({ fileUrl }: AudioPlayerProps) => react_jsx_runtime.JSX.Element;
|
|
13
22
|
|
|
14
|
-
|
|
23
|
+
/**
|
|
24
|
+
* 文件图标组件属性接口
|
|
25
|
+
*/
|
|
26
|
+
interface FileIconProps {
|
|
27
|
+
/** 文件后缀名,不区分大小写 */
|
|
15
28
|
suffix?: string;
|
|
29
|
+
/** 图标字体大小,默认为22px */
|
|
16
30
|
fontSize?: number;
|
|
17
31
|
}
|
|
18
|
-
|
|
32
|
+
/**
|
|
33
|
+
* 文件图标组件
|
|
34
|
+
* 根据文件后缀名显示对应的图标
|
|
35
|
+
* 支持常见的文件类型:文档、图片、音视频、压缩包等
|
|
36
|
+
*
|
|
37
|
+
* 支持的文件类型:
|
|
38
|
+
* - 文档:PDF, DOC/DOCX, XLS/XLSX, PPT, TXT, MD/MARKDOWN
|
|
39
|
+
* - 图片:JPG, JPEG, PNG, GIF
|
|
40
|
+
* - 音视频:MP3, MP4, MOV, AVI, FLV
|
|
41
|
+
* - 压缩包:ZIP, RAR, 7Z
|
|
42
|
+
* - 其他:显示为默认图标或文件夹图标
|
|
43
|
+
*
|
|
44
|
+
* @param props - 组件属性
|
|
45
|
+
* @returns 对应文件类型的图标
|
|
46
|
+
*/
|
|
47
|
+
declare const _default$a: ({ suffix, fontSize }: FileIconProps) => react_jsx_runtime.JSX.Element;
|
|
19
48
|
|
|
20
|
-
|
|
49
|
+
/**
|
|
50
|
+
* 文件预览组件属性接口
|
|
51
|
+
*/
|
|
52
|
+
interface FilePreviewProps {
|
|
53
|
+
/** 文件URL地址 */
|
|
21
54
|
fileUrl: string;
|
|
55
|
+
/** 文件后缀名 */
|
|
22
56
|
suffix?: string;
|
|
57
|
+
/** PDF文件密码 */
|
|
23
58
|
password?: string;
|
|
59
|
+
/** 搜索关键字 */
|
|
24
60
|
searchValue?: string;
|
|
61
|
+
/** PDF预览参数 */
|
|
25
62
|
pdfParams?: {
|
|
63
|
+
/** 当前页码 */
|
|
26
64
|
pageNo?: number;
|
|
65
|
+
/** 缩放比例 */
|
|
27
66
|
scale?: number;
|
|
67
|
+
/** 是否显示缩略图 */
|
|
28
68
|
isHasThumbnails?: boolean;
|
|
69
|
+
/** 页码变化回调 */
|
|
29
70
|
onSetPageNo?: (pageNo: number) => void;
|
|
30
71
|
};
|
|
72
|
+
/** 文件参数 */
|
|
31
73
|
fileParams?: ObjectType<string>;
|
|
74
|
+
/** 密码设置成功回调 */
|
|
32
75
|
onSetPassSuccess?: () => void;
|
|
33
76
|
}
|
|
34
|
-
|
|
77
|
+
/**
|
|
78
|
+
* 文件预览组件
|
|
79
|
+
* 支持图片、PDF、视频、音频、Markdown等文件格式的预览
|
|
80
|
+
* @param props - 组件属性
|
|
81
|
+
*/
|
|
82
|
+
declare const _default$9: ({ suffix, fileUrl, pdfParams, password, searchValue }: FilePreviewProps) => react_jsx_runtime.JSX.Element;
|
|
35
83
|
|
|
36
|
-
|
|
84
|
+
/**
|
|
85
|
+
* 文件预览抽屉组件属性接口
|
|
86
|
+
*/
|
|
87
|
+
interface FilePreviewDrawerProps {
|
|
88
|
+
/** 是否打开抽屉 */
|
|
37
89
|
open: boolean;
|
|
90
|
+
/** 关闭抽屉的回调函数 */
|
|
38
91
|
onClose: () => void;
|
|
92
|
+
/** 抽屉标题,默认为'文件预览' */
|
|
39
93
|
title?: string;
|
|
94
|
+
/** 文件URL地址 */
|
|
40
95
|
fileUrl: string;
|
|
96
|
+
/** 文件后缀名 */
|
|
41
97
|
suffix?: string;
|
|
98
|
+
/** PDF文件密码 */
|
|
42
99
|
password?: string;
|
|
100
|
+
/** 文件参数 */
|
|
43
101
|
fileParams?: ObjectType<string>;
|
|
102
|
+
/** PDF预览参数 */
|
|
44
103
|
pdfParams?: {
|
|
104
|
+
/** 当前页码 */
|
|
45
105
|
pageNo?: number;
|
|
106
|
+
/** 缩放比例 */
|
|
46
107
|
scale?: number;
|
|
108
|
+
/** 是否显示缩略图 */
|
|
47
109
|
isHasThumbnails?: boolean;
|
|
110
|
+
/** 页码变化回调 */
|
|
48
111
|
onSetPageNo?: (pageNo: number) => void;
|
|
49
112
|
};
|
|
113
|
+
/** 密码设置成功回调 */
|
|
50
114
|
onSetPassSuccess?: () => void;
|
|
51
115
|
}
|
|
52
|
-
|
|
116
|
+
/**
|
|
117
|
+
* 文件预览抽屉组件
|
|
118
|
+
* 在抽屉中显示文件预览,支持各种文件格式
|
|
119
|
+
* 全屏显示,提供更好的文件查看体验
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* <FilePreviewDrawer
|
|
123
|
+
* open={isOpen}
|
|
124
|
+
* fileUrl="https://example.com/file.pdf"
|
|
125
|
+
* suffix="pdf"
|
|
126
|
+
* title="PDF文件预览"
|
|
127
|
+
* onClose={() => setIsOpen(false)}
|
|
128
|
+
* />
|
|
129
|
+
*
|
|
130
|
+
* @param props - 组件属性
|
|
131
|
+
* @returns 文件预览抽屉组件
|
|
132
|
+
*/
|
|
133
|
+
declare const _default$8: ({ open, fileUrl, suffix, title, onClose, password, fileParams, pdfParams, onSetPassSuccess }: FilePreviewDrawerProps) => react_jsx_runtime.JSX.Element;
|
|
53
134
|
|
|
54
|
-
|
|
135
|
+
/**
|
|
136
|
+
* Markdown预览组件属性接口
|
|
137
|
+
*/
|
|
138
|
+
interface MarkdownPreviewProps {
|
|
139
|
+
/** Markdown文件URL地址 */
|
|
55
140
|
fileUrl: string;
|
|
141
|
+
/** 搜索关键字 */
|
|
56
142
|
searchValue?: string;
|
|
57
143
|
}
|
|
58
|
-
|
|
144
|
+
/**
|
|
145
|
+
* Markdown预览组件
|
|
146
|
+
* 从指定URL获取Markdown内容并渲染显示
|
|
147
|
+
* @param props - 组件属性
|
|
148
|
+
*/
|
|
149
|
+
declare const _default$7: ({ fileUrl, searchValue }: MarkdownPreviewProps) => react_jsx_runtime.JSX.Element;
|
|
59
150
|
|
|
60
|
-
|
|
151
|
+
/**
|
|
152
|
+
* PDF预览组件属性接口
|
|
153
|
+
*/
|
|
154
|
+
interface PdfPreviewProps {
|
|
155
|
+
/** PDF文件URL地址 */
|
|
61
156
|
fileUrl: string;
|
|
157
|
+
/** 当前页码,默认为1 */
|
|
62
158
|
pageNo?: number;
|
|
159
|
+
/** 缩放比例,默认为1 */
|
|
63
160
|
scale?: number;
|
|
161
|
+
/** 是否显示缩略图,默认为true */
|
|
64
162
|
isHasThumbnails?: boolean;
|
|
163
|
+
/** PDF文件密码 */
|
|
65
164
|
password?: string;
|
|
165
|
+
/** 密码设置回调 */
|
|
66
166
|
onSetPassword?: (password: string) => void;
|
|
167
|
+
/** 页码变化回调 */
|
|
67
168
|
onSetPageNo?: (pageNo: number) => void;
|
|
68
169
|
}
|
|
69
|
-
|
|
170
|
+
/**
|
|
171
|
+
* PDF预览组件
|
|
172
|
+
* 基于react-pdf-viewer实现的PDF文件预览功能
|
|
173
|
+
* 支持密码保护、缩略图、缩放、页面导航等功能
|
|
174
|
+
* @param props - 组件属性
|
|
175
|
+
*/
|
|
176
|
+
declare const _default$6: ({ password, fileUrl, pageNo, scale, isHasThumbnails, onSetPassword, onSetPageNo }: PdfPreviewProps) => react_jsx_runtime.JSX.Element;
|
|
70
177
|
|
|
71
|
-
|
|
178
|
+
/**
|
|
179
|
+
* 视频播放器组件属性接口
|
|
180
|
+
*/
|
|
181
|
+
interface VideoPlayerProps {
|
|
182
|
+
/** 视频文件URL地址 */
|
|
72
183
|
fileUrl: string;
|
|
73
184
|
}
|
|
74
|
-
|
|
185
|
+
/**
|
|
186
|
+
* 视频播放器组件
|
|
187
|
+
* 提供基本的视频播放功能
|
|
188
|
+
* @param props - 组件属性
|
|
189
|
+
*/
|
|
190
|
+
declare const _default$5: ({ fileUrl }: VideoPlayerProps) => react_jsx_runtime.JSX.Element;
|
|
75
191
|
|
|
192
|
+
/**
|
|
193
|
+
* Iframe组件属性接口
|
|
194
|
+
*/
|
|
76
195
|
interface IframeProps {
|
|
196
|
+
/** iframe ID */
|
|
77
197
|
id?: string;
|
|
198
|
+
/** iframe源地址 */
|
|
78
199
|
src: string;
|
|
200
|
+
/** 自定义类名 */
|
|
79
201
|
className?: string;
|
|
202
|
+
/** 加载完成回调 */
|
|
80
203
|
onLoad?: () => void;
|
|
81
204
|
}
|
|
205
|
+
/**
|
|
206
|
+
* Iframe组件
|
|
207
|
+
* 支持加载状态、URL参数处理、防缓存等功能
|
|
208
|
+
* @param props - 组件属性
|
|
209
|
+
*/
|
|
82
210
|
declare const _default$4: react.ForwardRefExoticComponent<IframeProps & react.RefAttributes<HTMLIFrameElement>>;
|
|
83
211
|
|
|
212
|
+
/**
|
|
213
|
+
* 组件映射类型,用于延时加载
|
|
214
|
+
*/
|
|
84
215
|
type ComponentMapType = Record<string, () => Promise<{
|
|
85
216
|
default: React.ComponentType<any>;
|
|
86
217
|
}>>;
|
|
87
|
-
|
|
218
|
+
/**
|
|
219
|
+
* LazyComponent组件属性接口
|
|
220
|
+
*/
|
|
221
|
+
interface LazyComponentProps {
|
|
222
|
+
/** 组件类型名称 */
|
|
88
223
|
type: string;
|
|
224
|
+
/** 自定义组件映射 */
|
|
89
225
|
customComponents?: ComponentMapType;
|
|
226
|
+
/** 其他属性会透传给组件 */
|
|
90
227
|
[key: string]: any;
|
|
91
|
-
}
|
|
92
|
-
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* 延时加载组件
|
|
231
|
+
* 根据type动态加载对应的组件,支持自定义组件映射
|
|
232
|
+
* 使用示例:<LazyComponent type="renderMarkdown" data={{}} loading={true} />
|
|
233
|
+
* @param props - 组件属性
|
|
234
|
+
*/
|
|
235
|
+
declare const _default$3: ({ type, customComponents, ...rest }: LazyComponentProps) => react_jsx_runtime.JSX.Element;
|
|
93
236
|
|
|
94
|
-
|
|
237
|
+
/**
|
|
238
|
+
* Markdown编辑器组件属性接口
|
|
239
|
+
*/
|
|
240
|
+
interface MarkdownEditorProps {
|
|
241
|
+
/** 是否禁用编辑器 */
|
|
95
242
|
disabled?: boolean;
|
|
243
|
+
/** 搜索关键字 */
|
|
96
244
|
searchValue?: string;
|
|
245
|
+
/** 编辑器内容 */
|
|
97
246
|
value?: string;
|
|
247
|
+
/** 内容变化回调 */
|
|
98
248
|
onChange?: (value: string) => void;
|
|
249
|
+
/** 页面滚动回调 */
|
|
99
250
|
onScrollPage?: (pageIndex: number) => void;
|
|
251
|
+
/** 额外导航内容 */
|
|
100
252
|
extraNav?: ReactNode;
|
|
253
|
+
/** 是否显示工具栏,默认为true */
|
|
101
254
|
showToolbar?: boolean;
|
|
255
|
+
/** 引用文本回调 */
|
|
102
256
|
onQuote?: (text: string) => void;
|
|
257
|
+
/** 文件下载回调 */
|
|
103
258
|
onDownloadFile?: (fileContent: string, targetFormat?: string) => Promise<void>;
|
|
104
259
|
}
|
|
105
|
-
|
|
260
|
+
/**
|
|
261
|
+
* Markdown编辑器组件
|
|
262
|
+
* 基于Tiptap构建的富文本编辑器,支持Markdown语法
|
|
263
|
+
* 提供丰富的编辑功能:格式化、链接、图片、表格、高亮等
|
|
264
|
+
* @param props - 组件属性
|
|
265
|
+
*/
|
|
266
|
+
declare const _default$2: ({ value, onChange, onScrollPage, searchValue, disabled, extraNav, showToolbar, onQuote, onDownloadFile }: MarkdownEditorProps) => react_jsx_runtime.JSX.Element;
|
|
106
267
|
|
|
107
|
-
|
|
268
|
+
/**
|
|
269
|
+
* Markdown渲染组件属性接口
|
|
270
|
+
*/
|
|
271
|
+
interface RenderMarkdownProps {
|
|
272
|
+
/** Markdown内容 */
|
|
108
273
|
content?: string;
|
|
274
|
+
/** 搜索关键字 */
|
|
109
275
|
searchValue?: string;
|
|
276
|
+
/** 自定义组件映射 */
|
|
110
277
|
customComponents?: ComponentMapType;
|
|
278
|
+
/** 内容变化回调 */
|
|
111
279
|
onChange?: (value: string) => void;
|
|
280
|
+
/** 部分内容变化回调 */
|
|
112
281
|
onPartialChange?: (oldValue: string, newValue: string) => void;
|
|
113
282
|
}
|
|
114
|
-
|
|
283
|
+
/**
|
|
284
|
+
* Markdown渲染组件
|
|
285
|
+
* 将Markdown文本转换为HTML并渲染为React组件
|
|
286
|
+
* 支持自定义组件、搜索高亮、内容编辑等功能
|
|
287
|
+
* @param props - 组件属性
|
|
288
|
+
*/
|
|
289
|
+
declare const _default$1: ({ content, searchValue, customComponents, onChange, onPartialChange }: RenderMarkdownProps) => react_jsx_runtime.JSX.Element;
|
|
115
290
|
|
|
291
|
+
/**
|
|
292
|
+
* 渲染控制对象类型
|
|
293
|
+
* 用于控制组件的显示、渲染函数和属性
|
|
294
|
+
*/
|
|
116
295
|
type RenderControlObj<C, P = ObjectType<any>> = {
|
|
296
|
+
/** 是否可见 */
|
|
117
297
|
visible?: boolean;
|
|
298
|
+
/** 渲染函数 */
|
|
118
299
|
render?: (ctx: C) => React.ReactNode;
|
|
300
|
+
/** 传递给组件的属性 */
|
|
119
301
|
props?: P;
|
|
120
302
|
};
|
|
303
|
+
/**
|
|
304
|
+
* 渲染控制类型
|
|
305
|
+
* 支持布尔值或控制对象
|
|
306
|
+
*/
|
|
121
307
|
type RenderControl<C, P = ObjectType<any>> = boolean | RenderControlObj<C, P>;
|
|
308
|
+
/**
|
|
309
|
+
* RenderWrapper组件属性接口
|
|
310
|
+
* @param C - 上下文类型
|
|
311
|
+
* @param P - 属性类型
|
|
312
|
+
*/
|
|
122
313
|
interface RenderWrapperProps<C, P> {
|
|
314
|
+
/** 渲染控制配置 */
|
|
123
315
|
control?: RenderControl<C, P> | null;
|
|
316
|
+
/** 上下文数据 */
|
|
124
317
|
ctx?: C;
|
|
318
|
+
/** 默认组件或渲染函数 */
|
|
125
319
|
DefaultComponent?: React.ReactNode | ((props: P) => React.ReactNode);
|
|
126
320
|
}
|
|
321
|
+
/**
|
|
322
|
+
* 渲染包装器组件
|
|
323
|
+
* 根据控制配置条件性地渲染组件,支持动态渲染函数和属性传递
|
|
324
|
+
*
|
|
325
|
+
* @example
|
|
326
|
+
* // 基本用法
|
|
327
|
+
* <RenderWrapper control={true} DefaultComponent={<div>内容</div>} />
|
|
328
|
+
*
|
|
329
|
+
* // 条件渲染
|
|
330
|
+
* <RenderWrapper control={{ visible: false }} DefaultComponent={<div>不显示</div>} />
|
|
331
|
+
*
|
|
332
|
+
* // 动态渲染
|
|
333
|
+
* <RenderWrapper
|
|
334
|
+
* control={{ render: (ctx) => <div>动态内容: {ctx.value}</div> }}
|
|
335
|
+
* ctx={{ value: 'hello' }}
|
|
336
|
+
* />
|
|
337
|
+
*
|
|
338
|
+
* @param props - 组件属性
|
|
339
|
+
* @returns 渲染的组件或null
|
|
340
|
+
*/
|
|
127
341
|
declare const RenderWrapper: react.ForwardRefExoticComponent<RenderWrapperProps<unknown, unknown> & react.RefAttributes<unknown>>;
|
|
342
|
+
/**
|
|
343
|
+
* 判断是否应该渲染组件
|
|
344
|
+
* @param control - 渲染控制配置
|
|
345
|
+
* @returns 是否应该渲染
|
|
346
|
+
*/
|
|
128
347
|
declare const shouldRender: (control?: RenderControl<any, any> | null) => boolean;
|
|
348
|
+
/**
|
|
349
|
+
* 合并上级传入的props与当前的props
|
|
350
|
+
* 用于智能地合并组件属性
|
|
351
|
+
*
|
|
352
|
+
* @param control - 渲染控制配置
|
|
353
|
+
* @param props - 要合并的属性
|
|
354
|
+
* @returns 合并后的属性对象或null
|
|
355
|
+
*/
|
|
129
356
|
declare function propsMerge(control?: RenderControl<any, any> | null, props?: ObjectType<any>): {
|
|
130
357
|
props: any;
|
|
131
358
|
};
|
|
132
359
|
|
|
133
|
-
|
|
360
|
+
/**
|
|
361
|
+
* 用户头像组件属性接口
|
|
362
|
+
*/
|
|
363
|
+
interface UserAvatarProps {
|
|
364
|
+
/** 头像图片地址 */
|
|
134
365
|
avatarSrc?: string;
|
|
366
|
+
/** 用户名 */
|
|
135
367
|
userName?: string;
|
|
368
|
+
/** 头像尺寸 */
|
|
136
369
|
size?: number;
|
|
137
370
|
}
|
|
138
|
-
|
|
371
|
+
/**
|
|
372
|
+
* 用户头像组件
|
|
373
|
+
* 如果没有头像图片,则显示用户名首字母作为头像
|
|
374
|
+
* @param props - 组件属性
|
|
375
|
+
*/
|
|
376
|
+
declare const _default: ({ size, avatarSrc, userName }: UserAvatarProps) => react_jsx_runtime.JSX.Element;
|
|
139
377
|
|
|
140
378
|
type Params = Record<string, any>;
|
|
141
379
|
/**
|
|
@@ -183,8 +421,20 @@ declare function useDebounce<A extends Array<any>, R = void>(func: (..._args: A)
|
|
|
183
421
|
*/
|
|
184
422
|
declare function useDeepEffect(effect: React.EffectCallback, deps: any[]): void;
|
|
185
423
|
|
|
424
|
+
/**
|
|
425
|
+
* 创建同时具有 ref 和 state 特性的状态
|
|
426
|
+
* @param init - 初始值
|
|
427
|
+
* @returns [state, setState, getState] 元组,包含状态值、设置函数和获取函数
|
|
428
|
+
*/
|
|
186
429
|
declare function useRefState<T>(init: T): readonly [T, (newVal: T) => void, () => T];
|
|
187
430
|
|
|
431
|
+
/**
|
|
432
|
+
* 同步输入框组件和外部状态的 Hook
|
|
433
|
+
* 解决输入中文时因连续渲染关闭中文输入法的问题
|
|
434
|
+
* @param storeValue - 外部存储的值
|
|
435
|
+
* @param setStoreValue - 设置外部存储值的函数
|
|
436
|
+
* @returns 包含 inputValue 和 setInputValue 的对象
|
|
437
|
+
*/
|
|
188
438
|
declare const useSyncInput: <T>(storeValue: T, setStoreValue: (value: T) => void) => {
|
|
189
439
|
inputValue: T;
|
|
190
440
|
setInputValue: (value: T) => void;
|
|
@@ -218,22 +468,70 @@ interface UseWebSocketReturn {
|
|
|
218
468
|
}
|
|
219
469
|
declare const useWebSocket: ({ url, onMessage, onClose, heartbeatInterval, heartbeatMessage, clientHeartbeat, reconnectInterval, maxReconnectAttempts, isReconnect }: UseWebSocketParams) => UseWebSocketReturn;
|
|
220
470
|
|
|
471
|
+
/**
|
|
472
|
+
* 深拷贝函数
|
|
473
|
+
* @param obj - 要拷贝的对象
|
|
474
|
+
* @param isJson - 是否使用 JSON 方式深拷贝,默认为 true
|
|
475
|
+
* @returns 拷贝后的新对象
|
|
476
|
+
*/
|
|
221
477
|
declare const deepCopy: <T>(arg: T, isJson?: boolean) => T;
|
|
478
|
+
/**
|
|
479
|
+
* 深度比较两个对象是否相等
|
|
480
|
+
* 支持 Date、RegExp、Map、Set、Array、Function、Object 等类型
|
|
481
|
+
* @param a - 第一个对象
|
|
482
|
+
* @param b - 第二个对象
|
|
483
|
+
* @returns 是否相等
|
|
484
|
+
*/
|
|
222
485
|
declare function deepEqual(a: any, b: any): boolean;
|
|
486
|
+
/**
|
|
487
|
+
* 深度合并两个对象,对于对象类型进行递归合并
|
|
488
|
+
* @param base - 基础对象
|
|
489
|
+
* @param override - 覆盖对象
|
|
490
|
+
* @returns 合并后的新对象
|
|
491
|
+
*/
|
|
223
492
|
declare const deepMerge: <T extends Record<string, any>>(base: T, override: Partial<T>) => T;
|
|
493
|
+
/**
|
|
494
|
+
* 将键值对象转换为选项数组格式
|
|
495
|
+
* @param obj - 键值对象
|
|
496
|
+
* @returns 选项数组,包含 label 和 value 属性
|
|
497
|
+
*/
|
|
224
498
|
declare const objToOptions: (obj: ObjectType<string>) => {
|
|
225
499
|
label: string;
|
|
226
500
|
value: number;
|
|
227
501
|
}[];
|
|
502
|
+
/**
|
|
503
|
+
* 将数组转换为以指定字段为键的对象
|
|
504
|
+
* @param arr - 要转换的数组
|
|
505
|
+
* @param key - 用作对象键的字段名
|
|
506
|
+
* @returns 转换后的对象
|
|
507
|
+
*/
|
|
228
508
|
declare const arrToObj: <T>(arr: T[], key: string) => {
|
|
229
509
|
[key: string]: T;
|
|
230
510
|
};
|
|
511
|
+
/**
|
|
512
|
+
* 使用 setTimeout 模拟 setInterval,避免 setInterval 的问题
|
|
513
|
+
* @param fn - 要重复执行的函数
|
|
514
|
+
* @param t - 间隔时间(毫秒)
|
|
515
|
+
* @returns 控制对象,包含 isRun 和 cancel 方法
|
|
516
|
+
*/
|
|
231
517
|
interface NsSetIntervalReturnType {
|
|
518
|
+
/** 检查是否正在运行 */
|
|
232
519
|
isRun: () => boolean;
|
|
520
|
+
/** 取消定时器 */
|
|
233
521
|
cancel: () => void;
|
|
234
522
|
}
|
|
235
523
|
declare const nsSetInterval: (fn: () => void, t: number) => NsSetIntervalReturnType;
|
|
524
|
+
/**
|
|
525
|
+
* 生成不重复的唯一ID
|
|
526
|
+
* @returns 唯一ID字符串
|
|
527
|
+
*/
|
|
236
528
|
declare const genNonDuplicateID: () => string;
|
|
529
|
+
/**
|
|
530
|
+
* 复制文本到剪贴板
|
|
531
|
+
* 优先使用 navigator.clipboard API,降级使用 execCommand
|
|
532
|
+
* @param text - 要复制的文本
|
|
533
|
+
* @returns Promise
|
|
534
|
+
*/
|
|
237
535
|
declare const copyText: (text: string) => Promise<void>;
|
|
238
536
|
/**
|
|
239
537
|
* 把后台接口字段,返回的关于金额的数字,转换为千分符号分隔的数字
|
|
@@ -241,8 +539,23 @@ declare const copyText: (text: string) => Promise<void>;
|
|
|
241
539
|
*/
|
|
242
540
|
declare function formatNumberWithCommas(number: number | string): string | number;
|
|
243
541
|
declare const generateRandomNumbers: (min: number, max: number, count: number) => number[];
|
|
542
|
+
/**
|
|
543
|
+
* 从文件路径中提取文件名
|
|
544
|
+
* @param filePath - 文件路径
|
|
545
|
+
* @returns 文件名
|
|
546
|
+
*/
|
|
244
547
|
declare const getFileName: (filePath: string) => string;
|
|
548
|
+
/**
|
|
549
|
+
* 从文件名中获取文件扩展名
|
|
550
|
+
* @param fileName - 文件名
|
|
551
|
+
* @returns 文件扩展名
|
|
552
|
+
*/
|
|
245
553
|
declare const getFileSuffixName: (fileName: string) => string;
|
|
554
|
+
/**
|
|
555
|
+
* 将文本中的换行符转换为 HTML 换行标签
|
|
556
|
+
* @param con - 要转换的文本
|
|
557
|
+
* @returns 转换后的 HTML 字符串
|
|
558
|
+
*/
|
|
246
559
|
declare const textAreaView: (con?: string) => string;
|
|
247
560
|
/**
|
|
248
561
|
* 将对象转换为 URL 查询参数字符串
|
|
@@ -282,11 +595,42 @@ declare const formatDate: (date: Date | number | string, fmt?: string) => string
|
|
|
282
595
|
declare const getTimestamp: (date?: DateType) => number;
|
|
283
596
|
declare const isExpire: (date?: DateType) => boolean;
|
|
284
597
|
|
|
598
|
+
/**
|
|
599
|
+
* 类型判断函数
|
|
600
|
+
* @param val - 要判断的值
|
|
601
|
+
* @param type - 目标类型名
|
|
602
|
+
* @returns 是否为目标类型
|
|
603
|
+
*/
|
|
285
604
|
declare function is(val: unknown, type: string): boolean;
|
|
605
|
+
/**
|
|
606
|
+
* 判断值是否为 undefined
|
|
607
|
+
* @param val - 要判断的值
|
|
608
|
+
* @returns 是否为 undefined
|
|
609
|
+
*/
|
|
286
610
|
declare function isUnDef<T = unknown>(val?: T): val is T;
|
|
611
|
+
/**
|
|
612
|
+
* 判断值是否已定义(非 undefined)
|
|
613
|
+
* @param val - 要判断的值
|
|
614
|
+
* @returns 是否已定义
|
|
615
|
+
*/
|
|
287
616
|
declare function isDef<T = unknown>(val?: T): val is T;
|
|
617
|
+
/**
|
|
618
|
+
* 判断值是否为对象(不包括 FormData 等)
|
|
619
|
+
* @param val - 要判断的值
|
|
620
|
+
* @returns 是否为对象
|
|
621
|
+
*/
|
|
288
622
|
declare function isObject(val: any): val is Record<any, any>;
|
|
623
|
+
/**
|
|
624
|
+
* 判断对象是否为空对象
|
|
625
|
+
* @param val - 要判断的值
|
|
626
|
+
* @returns 是否为空对象
|
|
627
|
+
*/
|
|
289
628
|
declare function isEmptyObj<T = unknown>(val: T): boolean;
|
|
629
|
+
/**
|
|
630
|
+
* 判断值是否为 Date 对象
|
|
631
|
+
* @param val - 要判断的值
|
|
632
|
+
* @returns 是否为 Date 对象
|
|
633
|
+
*/
|
|
290
634
|
declare function isDate(val: unknown): val is Date;
|
|
291
635
|
declare function isNull(val: unknown): val is null;
|
|
292
636
|
declare function isNullOrUnDef(val: unknown): val is null | undefined;
|
|
@@ -370,4 +714,4 @@ declare function getSignPath(): string;
|
|
|
370
714
|
declare const LgPrimaryColor: string;
|
|
371
715
|
declare const themeConfig: ThemeConfig;
|
|
372
716
|
|
|
373
|
-
export { _default$b as AudioPlayer, DateFormatType, DateFormatType2, ERROR, FORBIDDEN, _default$a as FileIcon, _default$9 as FilePreview, _default$8 as FilePreviewDrawer, _default$4 as Iframe, _default$3 as LazyComponent, LgPrimaryColor, MISSING_PARAMETER, _default$2 as MarkdownEditor, _default$7 as MarkdownPreview, NOT_FOUND, type NsSetIntervalReturnType, OK, PERMISSION_DENIED, type Params, _default$6 as PdfPreview, type RenderControl, type RenderControlObj, _default$1 as RenderMarkdown, RenderWrapper, TOKEN_KEY, UNAUTHORIZED, _default as UserAvatar, type UserInfo, _default$5 as VideoPlayer, absVal, addUrlLastSlash, arrToObj, buildUrlParams, calculate, clearCurrentUser, clearToken, compareNum, copyText, createRequest, decimalPlaces, deepCopy, deepEqual, deepMerge, dividedBy, downloadFile, emit, emitToChild, formatDate, formatNumberWithCommas, genNonDuplicateID, generateRandomNumbers, getCurrentUser, getDeviceId, getEndOfTimestamp, getFileName, getFileSuffixName, getSignPath, getStartOfTimestamp, getTimestamp, getToken, getUrlMainSource, getUrlToken, getWebSocketUrl, is, isArray, isBlob, isBoolean, isClient, isDate, isDef, isElement, isEmpty, isEmptyObj, isExpire, isExternal, isFunction, isInteger, isLocalhost, isMap, isNegative, isNull, isNullOrUnDef, isNumber, isNumberNoNaN, isObject, isPromise, isRegExp, isServer, isString, isUnDef, isWindow, minus, nsSetInterval, objToOptions, plus, precision, propsMerge, setCurrentUser, setToken, shouldRender, textAreaView, themeConfig, times, toFixed, useCreateValtioContext, useDebounce, useDeepEffect, useIframeRelayBridge, useRefState, useSyncInput, useThrottle, useWebSocket };
|
|
717
|
+
export { _default$b as AudioPlayer, type AudioPlayerProps, type ComponentMapType, DateFormatType, DateFormatType2, ERROR, FORBIDDEN, _default$a as FileIcon, type FileIconProps, _default$9 as FilePreview, _default$8 as FilePreviewDrawer, type FilePreviewDrawerProps, type FilePreviewProps, _default$4 as Iframe, type IframeProps, _default$3 as LazyComponent, type LazyComponentProps, LgPrimaryColor, MISSING_PARAMETER, _default$2 as MarkdownEditor, type MarkdownEditorProps, _default$7 as MarkdownPreview, type MarkdownPreviewProps, NOT_FOUND, type NsSetIntervalReturnType, OK, PERMISSION_DENIED, type Params, _default$6 as PdfPreview, type PdfPreviewProps, type RenderControl, type RenderControlObj, _default$1 as RenderMarkdown, type RenderMarkdownProps, RenderWrapper, type RenderWrapperProps, TOKEN_KEY, UNAUTHORIZED, _default as UserAvatar, type UserAvatarProps, type UserInfo, _default$5 as VideoPlayer, type VideoPlayerProps, absVal, addUrlLastSlash, arrToObj, buildUrlParams, calculate, clearCurrentUser, clearToken, compareNum, copyText, createRequest, decimalPlaces, deepCopy, deepEqual, deepMerge, dividedBy, downloadFile, emit, emitToChild, formatDate, formatNumberWithCommas, genNonDuplicateID, generateRandomNumbers, getCurrentUser, getDeviceId, getEndOfTimestamp, getFileName, getFileSuffixName, getSignPath, getStartOfTimestamp, getTimestamp, getToken, getUrlMainSource, getUrlToken, getWebSocketUrl, is, isArray, isBlob, isBoolean, isClient, isDate, isDef, isElement, isEmpty, isEmptyObj, isExpire, isExternal, isFunction, isInteger, isLocalhost, isMap, isNegative, isNull, isNullOrUnDef, isNumber, isNumberNoNaN, isObject, isPromise, isRegExp, isServer, isString, isUnDef, isWindow, minus, nsSetInterval, objToOptions, plus, precision, propsMerge, setCurrentUser, setToken, shouldRender, textAreaView, themeConfig, times, toFixed, useCreateValtioContext, useDebounce, useDeepEffect, useIframeRelayBridge, useRefState, useSyncInput, useThrottle, useWebSocket };
|
package/dist/index.esm.js
CHANGED
|
@@ -114,7 +114,7 @@ var FileIcon_default = ({ suffix, fontSize = 22 }) => {
|
|
|
114
114
|
return /* @__PURE__ */ jsx(FileZipOutlined, {});
|
|
115
115
|
case "CATALOG":
|
|
116
116
|
return /* @__PURE__ */ jsx("i", { style: styles, className: "iconfont icon-wenjianjia" });
|
|
117
|
-
//
|
|
117
|
+
// 文件夹图标
|
|
118
118
|
default:
|
|
119
119
|
return /* @__PURE__ */ jsx(FileUnknownOutlined, {});
|
|
120
120
|
}
|
|
@@ -1358,18 +1358,38 @@ var FilePreview_default = ({ suffix, fileUrl, pdfParams, password, searchValue }
|
|
|
1358
1358
|
}, [suffix, fileUrl, pdfParams]);
|
|
1359
1359
|
return /* @__PURE__ */ jsx(Flex, { justify: "center", align: "center", className: "height-full", children: Preview });
|
|
1360
1360
|
};
|
|
1361
|
-
var FilePreviewDrawer_default = ({
|
|
1362
|
-
|
|
1363
|
-
|
|
1361
|
+
var FilePreviewDrawer_default = ({
|
|
1362
|
+
open,
|
|
1363
|
+
fileUrl,
|
|
1364
|
+
suffix,
|
|
1365
|
+
title = "\u6587\u4EF6\u9884\u89C8",
|
|
1366
|
+
onClose,
|
|
1367
|
+
password,
|
|
1368
|
+
fileParams,
|
|
1369
|
+
pdfParams,
|
|
1370
|
+
onSetPassSuccess
|
|
1371
|
+
}) => {
|
|
1372
|
+
return /* @__PURE__ */ jsx(
|
|
1373
|
+
Drawer,
|
|
1364
1374
|
{
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1375
|
+
title,
|
|
1376
|
+
push: false,
|
|
1377
|
+
width: "100%",
|
|
1378
|
+
open,
|
|
1379
|
+
onClose,
|
|
1380
|
+
children: /* @__PURE__ */ jsx(
|
|
1381
|
+
FilePreview_default,
|
|
1382
|
+
{
|
|
1383
|
+
fileUrl,
|
|
1384
|
+
suffix,
|
|
1385
|
+
password,
|
|
1386
|
+
fileParams,
|
|
1387
|
+
pdfParams,
|
|
1388
|
+
onSetPassSuccess
|
|
1389
|
+
}
|
|
1390
|
+
)
|
|
1371
1391
|
}
|
|
1372
|
-
)
|
|
1392
|
+
);
|
|
1373
1393
|
};
|
|
1374
1394
|
|
|
1375
1395
|
// src/components/Iframe/styles.module.less
|
|
@@ -4944,7 +4964,17 @@ var MobileToolbarContent = ({ type, onBack }) => /* @__PURE__ */ jsxs(Fragment,
|
|
|
4944
4964
|
/* @__PURE__ */ jsx(ToolbarSeparator, {}),
|
|
4945
4965
|
type === "highlighter" ? /* @__PURE__ */ jsx(HighlightContent, {}) : /* @__PURE__ */ jsx(LinkContent, {})
|
|
4946
4966
|
] });
|
|
4947
|
-
var MarkdownEditor_default = ({
|
|
4967
|
+
var MarkdownEditor_default = ({
|
|
4968
|
+
value = "",
|
|
4969
|
+
onChange,
|
|
4970
|
+
onScrollPage,
|
|
4971
|
+
searchValue,
|
|
4972
|
+
disabled,
|
|
4973
|
+
extraNav,
|
|
4974
|
+
showToolbar = true,
|
|
4975
|
+
onQuote,
|
|
4976
|
+
onDownloadFile
|
|
4977
|
+
}) => {
|
|
4948
4978
|
const isMobile = useMobile();
|
|
4949
4979
|
const windowSize = useWindowSize();
|
|
4950
4980
|
const lastContentRef = useRef("");
|