@zero-library/common 3.0.1 → 3.0.2
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 +901 -356
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +52 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +50 -7
- package/dist/index.d.ts +50 -7
- package/dist/index.esm.js +604 -65
- package/dist/index.esm.js.map +1 -1
- package/dist/pdf.worker.min.mjs +28 -0
- package/package.json +5 -2
package/dist/index.d.mts
CHANGED
|
@@ -21,7 +21,7 @@ interface AudioPlayerProps {
|
|
|
21
21
|
* 提供基本的音频播放功能
|
|
22
22
|
* @param props - 组件属性
|
|
23
23
|
*/
|
|
24
|
-
declare const _default$
|
|
24
|
+
declare const _default$u: ({ fileUrl }: AudioPlayerProps) => react_jsx_runtime.JSX.Element;
|
|
25
25
|
|
|
26
26
|
/** Docx文档预览组件的属性接口 */
|
|
27
27
|
interface DocxPreviewProps {
|
|
@@ -34,7 +34,7 @@ interface DocxPreviewProps {
|
|
|
34
34
|
* Docx文档预览组件
|
|
35
35
|
* @param props - 组件属性
|
|
36
36
|
*/
|
|
37
|
-
declare const _default$
|
|
37
|
+
declare const _default$t: ({ fileUrl, scale }: DocxPreviewProps) => react_jsx_runtime.JSX.Element;
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
40
|
* 文件图标组件属性接口
|
|
@@ -60,12 +60,12 @@ interface FileIconProps {
|
|
|
60
60
|
* @param props - 组件属性
|
|
61
61
|
* @returns 对应文件类型的图标
|
|
62
62
|
*/
|
|
63
|
-
declare const _default$
|
|
63
|
+
declare const _default$s: ({ suffix, fontSize }: FileIconProps) => react_jsx_runtime.JSX.Element;
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
66
|
* 文件预览组件属性接口
|
|
67
67
|
*/
|
|
68
|
-
interface FilePreviewProps {
|
|
68
|
+
interface FilePreviewProps$1 {
|
|
69
69
|
emptyProps?: EmptyProps;
|
|
70
70
|
/** 文件URL地址 */
|
|
71
71
|
fileUrl: string;
|
|
@@ -94,12 +94,32 @@ interface FilePreviewProps {
|
|
|
94
94
|
* 支持图片、PDF、视频、音频、Markdown等文件格式的预览
|
|
95
95
|
* @param props - 组件属性
|
|
96
96
|
*/
|
|
97
|
-
declare const _default$
|
|
97
|
+
declare const _default$r: ({ suffix, fileUrl, pdfParams, password, searchValue, emptyProps, onSetPassword }: FilePreviewProps$1) => react_jsx_runtime.JSX.Element;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* 文件预览组件属性接口
|
|
101
|
+
*/
|
|
102
|
+
interface FilePreviewProps {
|
|
103
|
+
/** 空状态组件属性 */
|
|
104
|
+
emptyProps?: EmptyProps;
|
|
105
|
+
/** 文件URL地址 */
|
|
106
|
+
fileUrl: string;
|
|
107
|
+
/** 文件后缀名 */
|
|
108
|
+
suffix?: string;
|
|
109
|
+
/** 文件名称 */
|
|
110
|
+
fileName?: string;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* 文件预览组件
|
|
114
|
+
* 支持图片、PDF、视频、音频、Markdown等文件格式的预览
|
|
115
|
+
* @param props - 组件属性
|
|
116
|
+
*/
|
|
117
|
+
declare const _default$q: ({ suffix, fileUrl, emptyProps, fileName }: FilePreviewProps) => react_jsx_runtime.JSX.Element;
|
|
98
118
|
|
|
99
119
|
/**
|
|
100
120
|
* 文件预览抽屉组件属性接口
|
|
101
121
|
*/
|
|
102
|
-
interface FilePreviewDrawerProps extends FilePreviewProps {
|
|
122
|
+
interface FilePreviewDrawerProps extends FilePreviewProps$1 {
|
|
103
123
|
/** 是否打开抽屉 */
|
|
104
124
|
open: boolean;
|
|
105
125
|
/** 关闭抽屉的回调函数 */
|
|
@@ -1503,6 +1523,29 @@ interface FindTreeNodesOptions {
|
|
|
1503
1523
|
* // => [{ key: 'a', title: 'Node A', subItems: undefined }]
|
|
1504
1524
|
*/
|
|
1505
1525
|
declare const findTreeNodesByIds: <T extends Record<string, any>, R = T>(tree: T[], ids?: T[keyof T][], formatFn?: (node: T) => R | null | undefined, options?: FindTreeNodesOptions) => R[];
|
|
1526
|
+
/**
|
|
1527
|
+
* JSON 安全解析配置
|
|
1528
|
+
*/
|
|
1529
|
+
interface SafeParseJsonOptions {
|
|
1530
|
+
/** 是否在 `JSON.parse` 失败后尝试用 `jsonrepair` 修复后再解析,默认 `false` */
|
|
1531
|
+
repair?: boolean;
|
|
1532
|
+
/** 解析最终失败时的兜底返回值,`raw` 返回原字符串,`null` 返回空值,默认 `raw` */
|
|
1533
|
+
fallback?: 'raw' | 'null';
|
|
1534
|
+
}
|
|
1535
|
+
/**
|
|
1536
|
+
* 安全解析 JSON 字符串
|
|
1537
|
+
*
|
|
1538
|
+
* 处理顺序:
|
|
1539
|
+
* 1. 先直接执行 `JSON.parse`
|
|
1540
|
+
* 2. 若失败且允许修复,则尝试 `jsonrepair(raw)` 后再解析
|
|
1541
|
+
* 3. 若仍失败,则按 `fallback` 返回原字符串或 `null`
|
|
1542
|
+
*
|
|
1543
|
+
* @template T - 期望的解析结果类型
|
|
1544
|
+
* @param raw - 待解析的原始字符串
|
|
1545
|
+
* @param options - 解析配置
|
|
1546
|
+
* @returns 解析成功时返回对象;失败时返回原字符串或 `null`
|
|
1547
|
+
*/
|
|
1548
|
+
declare function safeParseJson<T = any>(raw: string, options?: SafeParseJsonOptions): T | string | null;
|
|
1506
1549
|
|
|
1507
1550
|
type DateType = string | number | Date | dayjs.Dayjs | null;
|
|
1508
1551
|
/** 默认日期时间格式:年-月-日 时:分:秒 */
|
|
@@ -2595,4 +2638,4 @@ declare function createTokenManager({ key, storage }: TokenManagerProps): {
|
|
|
2595
2638
|
clear: () => void;
|
|
2596
2639
|
};
|
|
2597
2640
|
|
|
2598
|
-
export { type AnnotationConfig, type AnnotationType, _default$
|
|
2641
|
+
export { type AnnotationConfig, type AnnotationType, _default$u 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$t as DocxPreview, type DocxPreviewProps, _default$s as FileIcon, type FileIconProps, _default$r as FilePreview, _default$p as FilePreviewDrawer, type FilePreviewDrawerProps, type FilePreviewProps$1 as FilePreviewProps, type FindTreeNodesOptions, type FormatSizeOptions, HttpStatus, _default$h as Iframe, type IframeProps, _default$g as LazyComponent, type LazyComponentProps, _default$q as LuyaFilePreview, _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 SafeParseJsonOptions, 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, safeParseJson, 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
|
@@ -21,7 +21,7 @@ interface AudioPlayerProps {
|
|
|
21
21
|
* 提供基本的音频播放功能
|
|
22
22
|
* @param props - 组件属性
|
|
23
23
|
*/
|
|
24
|
-
declare const _default$
|
|
24
|
+
declare const _default$u: ({ fileUrl }: AudioPlayerProps) => react_jsx_runtime.JSX.Element;
|
|
25
25
|
|
|
26
26
|
/** Docx文档预览组件的属性接口 */
|
|
27
27
|
interface DocxPreviewProps {
|
|
@@ -34,7 +34,7 @@ interface DocxPreviewProps {
|
|
|
34
34
|
* Docx文档预览组件
|
|
35
35
|
* @param props - 组件属性
|
|
36
36
|
*/
|
|
37
|
-
declare const _default$
|
|
37
|
+
declare const _default$t: ({ fileUrl, scale }: DocxPreviewProps) => react_jsx_runtime.JSX.Element;
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
40
|
* 文件图标组件属性接口
|
|
@@ -60,12 +60,12 @@ interface FileIconProps {
|
|
|
60
60
|
* @param props - 组件属性
|
|
61
61
|
* @returns 对应文件类型的图标
|
|
62
62
|
*/
|
|
63
|
-
declare const _default$
|
|
63
|
+
declare const _default$s: ({ suffix, fontSize }: FileIconProps) => react_jsx_runtime.JSX.Element;
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
66
|
* 文件预览组件属性接口
|
|
67
67
|
*/
|
|
68
|
-
interface FilePreviewProps {
|
|
68
|
+
interface FilePreviewProps$1 {
|
|
69
69
|
emptyProps?: EmptyProps;
|
|
70
70
|
/** 文件URL地址 */
|
|
71
71
|
fileUrl: string;
|
|
@@ -94,12 +94,32 @@ interface FilePreviewProps {
|
|
|
94
94
|
* 支持图片、PDF、视频、音频、Markdown等文件格式的预览
|
|
95
95
|
* @param props - 组件属性
|
|
96
96
|
*/
|
|
97
|
-
declare const _default$
|
|
97
|
+
declare const _default$r: ({ suffix, fileUrl, pdfParams, password, searchValue, emptyProps, onSetPassword }: FilePreviewProps$1) => react_jsx_runtime.JSX.Element;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* 文件预览组件属性接口
|
|
101
|
+
*/
|
|
102
|
+
interface FilePreviewProps {
|
|
103
|
+
/** 空状态组件属性 */
|
|
104
|
+
emptyProps?: EmptyProps;
|
|
105
|
+
/** 文件URL地址 */
|
|
106
|
+
fileUrl: string;
|
|
107
|
+
/** 文件后缀名 */
|
|
108
|
+
suffix?: string;
|
|
109
|
+
/** 文件名称 */
|
|
110
|
+
fileName?: string;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* 文件预览组件
|
|
114
|
+
* 支持图片、PDF、视频、音频、Markdown等文件格式的预览
|
|
115
|
+
* @param props - 组件属性
|
|
116
|
+
*/
|
|
117
|
+
declare const _default$q: ({ suffix, fileUrl, emptyProps, fileName }: FilePreviewProps) => react_jsx_runtime.JSX.Element;
|
|
98
118
|
|
|
99
119
|
/**
|
|
100
120
|
* 文件预览抽屉组件属性接口
|
|
101
121
|
*/
|
|
102
|
-
interface FilePreviewDrawerProps extends FilePreviewProps {
|
|
122
|
+
interface FilePreviewDrawerProps extends FilePreviewProps$1 {
|
|
103
123
|
/** 是否打开抽屉 */
|
|
104
124
|
open: boolean;
|
|
105
125
|
/** 关闭抽屉的回调函数 */
|
|
@@ -1503,6 +1523,29 @@ interface FindTreeNodesOptions {
|
|
|
1503
1523
|
* // => [{ key: 'a', title: 'Node A', subItems: undefined }]
|
|
1504
1524
|
*/
|
|
1505
1525
|
declare const findTreeNodesByIds: <T extends Record<string, any>, R = T>(tree: T[], ids?: T[keyof T][], formatFn?: (node: T) => R | null | undefined, options?: FindTreeNodesOptions) => R[];
|
|
1526
|
+
/**
|
|
1527
|
+
* JSON 安全解析配置
|
|
1528
|
+
*/
|
|
1529
|
+
interface SafeParseJsonOptions {
|
|
1530
|
+
/** 是否在 `JSON.parse` 失败后尝试用 `jsonrepair` 修复后再解析,默认 `false` */
|
|
1531
|
+
repair?: boolean;
|
|
1532
|
+
/** 解析最终失败时的兜底返回值,`raw` 返回原字符串,`null` 返回空值,默认 `raw` */
|
|
1533
|
+
fallback?: 'raw' | 'null';
|
|
1534
|
+
}
|
|
1535
|
+
/**
|
|
1536
|
+
* 安全解析 JSON 字符串
|
|
1537
|
+
*
|
|
1538
|
+
* 处理顺序:
|
|
1539
|
+
* 1. 先直接执行 `JSON.parse`
|
|
1540
|
+
* 2. 若失败且允许修复,则尝试 `jsonrepair(raw)` 后再解析
|
|
1541
|
+
* 3. 若仍失败,则按 `fallback` 返回原字符串或 `null`
|
|
1542
|
+
*
|
|
1543
|
+
* @template T - 期望的解析结果类型
|
|
1544
|
+
* @param raw - 待解析的原始字符串
|
|
1545
|
+
* @param options - 解析配置
|
|
1546
|
+
* @returns 解析成功时返回对象;失败时返回原字符串或 `null`
|
|
1547
|
+
*/
|
|
1548
|
+
declare function safeParseJson<T = any>(raw: string, options?: SafeParseJsonOptions): T | string | null;
|
|
1506
1549
|
|
|
1507
1550
|
type DateType = string | number | Date | dayjs.Dayjs | null;
|
|
1508
1551
|
/** 默认日期时间格式:年-月-日 时:分:秒 */
|
|
@@ -2595,4 +2638,4 @@ declare function createTokenManager({ key, storage }: TokenManagerProps): {
|
|
|
2595
2638
|
clear: () => void;
|
|
2596
2639
|
};
|
|
2597
2640
|
|
|
2598
|
-
export { type AnnotationConfig, type AnnotationType, _default$
|
|
2641
|
+
export { type AnnotationConfig, type AnnotationType, _default$u 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$t as DocxPreview, type DocxPreviewProps, _default$s as FileIcon, type FileIconProps, _default$r as FilePreview, _default$p as FilePreviewDrawer, type FilePreviewDrawerProps, type FilePreviewProps$1 as FilePreviewProps, type FindTreeNodesOptions, type FormatSizeOptions, HttpStatus, _default$h as Iframe, type IframeProps, _default$g as LazyComponent, type LazyComponentProps, _default$q as LuyaFilePreview, _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 SafeParseJsonOptions, 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, safeParseJson, 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 };
|