@robot-admin/naive-ui-components 0.22.1 → 0.23.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/README.md +7 -5
- package/README_EN.md +7 -5
- package/dist/C_ActionBar.d.cts +2 -1
- package/dist/C_ActionBar.d.ts +2 -1
- package/dist/C_AntV2.cjs +3 -3
- package/dist/C_AntV2.js +3 -3
- package/dist/C_BatchResult.cjs +1 -0
- package/dist/C_BatchResult.css +32 -0
- package/dist/C_BatchResult.d.cts +2 -0
- package/dist/C_BatchResult.d.ts +2 -0
- package/dist/C_BatchResult.js +1 -0
- package/dist/C_BatchResult2.cjs +1 -0
- package/dist/C_BatchResult2.js +1 -0
- package/dist/C_Breadcrumb.d.cts +2 -2
- package/dist/C_Breadcrumb.d.ts +1 -1
- package/dist/C_Cascade.d.cts +1 -1
- package/dist/C_Cascade.d.ts +1 -1
- package/dist/C_Chat.d.cts +1 -1
- package/dist/C_Chat.d.ts +1 -1
- package/dist/C_City.d.cts +1 -1
- package/dist/C_City.d.ts +1 -1
- package/dist/C_Code.d.cts +1 -1
- package/dist/C_Code.d.ts +1 -1
- package/dist/C_ContextMenu.d.cts +1 -1
- package/dist/C_ContextMenu.d.ts +1 -1
- package/dist/C_DataPicker.cjs +1 -0
- package/dist/C_DataPicker.css +55 -0
- package/dist/C_DataPicker.d.cts +2 -0
- package/dist/C_DataPicker.d.ts +5 -0
- package/dist/C_DataPicker.js +1 -0
- package/dist/C_DataPicker2.cjs +1 -0
- package/dist/C_DataPicker2.js +1 -0
- package/dist/C_Date.d.cts +1 -1
- package/dist/C_Date.d.ts +1 -1
- package/dist/C_Density.cjs +1 -0
- package/dist/C_Density.css +1 -0
- package/dist/C_Density.d.cts +3 -0
- package/dist/C_Density.d.ts +3 -0
- package/dist/C_Density.js +1 -0
- package/dist/C_Density2.cjs +1 -0
- package/dist/C_Density2.js +1 -0
- package/dist/C_Editor.d.cts +1 -1
- package/dist/C_Editor.d.ts +1 -1
- package/dist/C_ErrorSummary.cjs +1 -0
- package/dist/C_ErrorSummary.css +29 -0
- package/dist/C_ErrorSummary.d.cts +3 -0
- package/dist/C_ErrorSummary.d.ts +3 -0
- package/dist/C_ErrorSummary.js +1 -0
- package/dist/C_ErrorSummary2.cjs +1 -0
- package/dist/C_ErrorSummary2.js +1 -0
- package/dist/C_Form.base.css +150 -148
- package/dist/C_Form.css +151 -253
- package/dist/C_Form.d.cts +1 -1
- package/dist/C_Form.d.ts +19 -2
- package/dist/C_FormModal.css +1 -2
- package/dist/C_FormModal.d.cts +1 -1
- package/dist/C_FormModal.d.ts +17 -2
- package/dist/C_FormSearch.cjs +1 -1
- package/dist/C_FormSearch.css +124 -52
- package/dist/C_FormSearch.d.cts +3 -3
- package/dist/C_FormSearch.d.ts +5 -4
- package/dist/C_FormSearch.js +1 -1
- package/dist/C_FormulaEditor.d.cts +1 -1
- package/dist/C_FormulaEditor.d.ts +1 -1
- package/dist/C_Guide.d.cts +1 -1
- package/dist/C_Guide.d.ts +1 -1
- package/dist/C_Icon.d.cts +1 -1
- package/dist/C_Icon.d.ts +1 -1
- package/dist/C_Language.d.cts +1 -1
- package/dist/C_Language.d.ts +1 -1
- package/dist/C_Loading.d.cts +1 -1
- package/dist/C_Loading.d.ts +1 -1
- package/dist/C_Login.d.cts +1 -1
- package/dist/C_Login.d.ts +1 -1
- package/dist/C_Markdown.d.cts +1 -1
- package/dist/C_Markdown.d.ts +1 -1
- package/dist/C_Menu.d.cts +2 -2
- package/dist/C_Menu.d.ts +1 -1
- package/dist/C_OrgChart.d.cts +1 -1
- package/dist/C_OrgChart.d.ts +1 -1
- package/dist/C_Progress.d.cts +1 -1
- package/dist/C_Progress.d.ts +1 -1
- package/dist/C_SectionNav.cjs +1 -0
- package/dist/C_SectionNav.css +46 -0
- package/dist/C_SectionNav.d.cts +2 -0
- package/dist/C_SectionNav.d.ts +2 -0
- package/dist/C_SectionNav.js +1 -0
- package/dist/C_SectionNav2.cjs +1 -0
- package/dist/C_SectionNav2.js +1 -0
- package/dist/C_Skeleton.d.cts +1 -1
- package/dist/C_Skeleton.d.ts +1 -1
- package/dist/C_SplitPane2.cjs +1 -1
- package/dist/C_SplitPane2.js +1 -1
- package/dist/C_Steps.d.cts +1 -1
- package/dist/C_Steps.d.ts +1 -1
- package/dist/C_Table.base.css +258 -256
- package/dist/C_Table.cjs +1 -1
- package/dist/C_Table.css +109 -1283
- package/dist/C_Table.d.cts +2 -1
- package/dist/C_Table.d.ts +9 -8
- package/dist/C_Table.js +1 -1
- package/dist/C_Table2.cjs +3 -0
- package/dist/C_Table2.js +3 -0
- package/dist/C_Tabs.cjs +1 -1
- package/dist/C_Tabs.d.cts +1 -1
- package/dist/C_Tabs.d.ts +1 -1
- package/dist/C_Tabs.js +1 -1
- package/dist/C_TagsView.d.cts +1 -1
- package/dist/C_Theme.d.cts +1 -1
- package/dist/C_Theme.d.ts +1 -1
- package/dist/C_Timeline.d.cts +1 -1
- package/dist/C_Timeline.d.ts +1 -1
- package/dist/C_Transfer.d.cts +1 -1
- package/dist/C_Transfer.d.ts +1 -1
- package/dist/C_Tree.d.cts +1 -1
- package/dist/C_Tree.d.ts +9 -8
- package/dist/C_Upload.d.cts +1 -1
- package/dist/C_Upload.d.ts +1 -1
- package/dist/C_WorkFlow2.cjs +1 -1
- package/dist/C_WorkFlow2.js +1 -1
- package/dist/Card.cjs +1 -1
- package/dist/Card.js +1 -1
- package/dist/Steps.cjs +1 -1
- package/dist/Steps.js +1 -1
- package/dist/Tabs.cjs +1 -1
- package/dist/Tabs.js +1 -1
- package/dist/batchPatch.cjs +1 -0
- package/dist/batchPatch.d.cts +26 -0
- package/dist/batchPatch.d.ts +26 -0
- package/dist/batchPatch.js +1 -0
- package/dist/config.cjs +1 -1
- package/dist/config.d.cts +4 -1
- package/dist/config.d.ts +6 -2
- package/dist/config.js +1 -1
- package/dist/config2.d.ts +1 -1
- package/dist/constants.d.cts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants2.d.cts +402 -173
- package/dist/constants2.d.ts +402 -173
- package/dist/constants3.d.cts +3 -3
- package/dist/constants3.d.ts +3 -3
- package/dist/constants4.d.cts +173 -402
- package/dist/constants4.d.ts +173 -402
- package/dist/contracts.d.ts +24 -0
- package/dist/data.cjs +1 -1
- package/dist/data.d.cts +5 -108
- package/dist/data.d.ts +5 -108
- package/dist/data.js +1 -1
- package/dist/data2.cjs +1 -1
- package/dist/data2.d.cts +108 -0
- package/dist/data2.d.ts +108 -0
- package/dist/data2.js +1 -1
- package/dist/data3.cjs +1 -0
- package/dist/data3.js +1 -0
- package/dist/dateRange.d.cts +108 -13
- package/dist/dateRange.d.ts +110 -14
- package/dist/density.d.ts +15 -0
- package/dist/dictionary.cjs +1 -0
- package/dist/dictionary.d.cts +38 -0
- package/dist/dictionary.d.ts +38 -0
- package/dist/dictionary.js +1 -0
- package/dist/helpers.cjs +1 -1
- package/dist/helpers.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +63 -52
- package/dist/index.d.ts +71 -57
- package/dist/index.js +1 -1
- package/dist/index.vue.d.cts +4 -4
- package/dist/index.vue.d.ts +4 -4
- package/dist/index10.vue.d.cts +37 -80
- package/dist/index10.vue.d.ts +77 -53
- package/dist/index11.vue.d.cts +77 -53
- package/dist/index11.vue.d.ts +1117 -45
- package/dist/index12.vue.d.cts +1117 -45
- package/dist/index12.vue.d.ts +17 -128
- package/dist/index13.vue.d.cts +17 -128
- package/dist/index13.vue.d.ts +57 -53
- package/dist/index14.vue.d.cts +57 -53
- package/dist/index14.vue.d.ts +16 -25
- package/dist/index15.vue.d.cts +16 -25
- package/dist/index15.vue.d.ts +52 -12
- package/dist/index16.vue.d.cts +52 -12
- package/dist/index16.vue.d.ts +13 -129
- package/dist/index17.vue.d.cts +13 -129
- package/dist/index17.vue.d.ts +123 -74
- package/dist/index18.vue.d.cts +123 -74
- package/dist/index18.vue.d.ts +48 -71
- package/dist/index19.vue.d.cts +40 -91
- package/dist/index19.vue.d.ts +36 -96
- package/dist/index2.vue.d.cts +2 -2
- package/dist/index2.vue.d.ts +2 -2
- package/dist/index20.vue.d.cts +38 -47
- package/dist/index20.vue.d.ts +13 -48
- package/dist/index21.vue.d.cts +12 -96
- package/dist/index21.vue.d.ts +25 -95
- package/dist/index22.vue.d.cts +20 -32
- package/dist/index22.vue.d.ts +75 -37
- package/dist/index23.vue.d.cts +77 -13
- package/dist/index23.vue.d.ts +71 -13
- package/dist/index24.vue.d.cts +1 -1
- package/dist/index25.vue.d.cts +116 -90
- package/dist/index25.vue.d.ts +116 -90
- package/dist/index26.vue.d.cts +94 -59
- package/dist/index26.vue.d.ts +94 -59
- package/dist/index27.vue.d.cts +75 -0
- package/dist/index27.vue.d.ts +75 -0
- package/dist/index28.vue.d.cts +103 -0
- package/dist/index28.vue.d.ts +103 -0
- package/dist/index29.vue.d.cts +105 -0
- package/dist/index29.vue.d.ts +105 -0
- package/dist/index3.vue.d.cts +4 -4
- package/dist/index3.vue.d.ts +4 -4
- package/dist/index30.vue.d.cts +28 -0
- package/dist/index30.vue.d.ts +28 -0
- package/dist/index4.vue.d.cts +19 -128
- package/dist/index4.vue.d.ts +17 -34
- package/dist/index5.vue.d.cts +127 -35
- package/dist/index5.vue.d.ts +30 -19
- package/dist/index6.vue.d.cts +30 -19
- package/dist/index6.vue.d.ts +22 -118
- package/dist/index7.vue.d.cts +22 -118
- package/dist/index7.vue.d.ts +112 -18
- package/dist/index8.vue.d.cts +112 -18
- package/dist/index8.vue.d.ts +24 -35
- package/dist/index9.vue.d.cts +24 -35
- package/dist/index9.vue.d.ts +37 -80
- package/dist/numberCodec.cjs +1 -0
- package/dist/numberCodec.d.cts +25 -0
- package/dist/numberCodec.d.ts +25 -0
- package/dist/numberCodec.js +1 -0
- package/dist/observer.cjs +1 -0
- package/dist/observer.js +1 -0
- package/dist/presets.d.cts +2 -65
- package/dist/presets.d.ts +2 -65
- package/dist/resolver.cjs +1 -1
- package/dist/resolver.d.cts +1 -1
- package/dist/resolver.d.ts +1 -1
- package/dist/resolver.js +1 -1
- package/dist/serializeSearch.cjs +1 -0
- package/dist/serializeSearch.js +1 -0
- package/dist/style.css +548 -308
- package/dist/types.d.cts +60 -103
- package/dist/types.d.ts +62 -52
- package/dist/types2.d.cts +104 -51
- package/dist/types2.d.ts +56 -0
- package/dist/types3.d.cts +56 -0
- package/dist/useCollapsePanel.d.cts +3 -3
- package/dist/useCollapsePanel.d.ts +3 -3
- package/dist/useComponentLocale.cjs +1 -1
- package/dist/useComponentLocale.js +1 -1
- package/dist/useCropperCore.d.cts +7 -7
- package/dist/useCropperCore.d.ts +7 -7
- package/dist/useDataResource.cjs +1 -0
- package/dist/useDataResource.js +1 -0
- package/dist/useDictionary.cjs +1 -0
- package/dist/useDictionary.js +1 -0
- package/dist/useDynamicFormState.d.cts +960 -10
- package/dist/useDynamicFormState.d.ts +951 -11
- package/dist/useEdgeInteraction.d.cts +2 -2
- package/dist/useEdgeInteraction.d.ts +2 -2
- package/dist/useFormArray.cjs +1 -0
- package/dist/useFormArray.d.cts +69 -0
- package/dist/useFormArray.d.ts +69 -0
- package/dist/useFormArray.js +1 -0
- package/dist/useFormConfig.d.cts +14 -0
- package/dist/useFormConfig.d.ts +17 -38
- package/dist/useGridWidth.cjs +1 -0
- package/dist/useGridWidth.js +1 -0
- package/dist/useInfiniteScroll.d.cts +1 -1
- package/dist/useInfiniteScroll.d.ts +1 -1
- package/dist/useQRCode.d.cts +4 -4
- package/dist/useQRCode.d.ts +4 -4
- package/dist/useSignatureHistory.d.cts +4 -4
- package/dist/useSignatureHistory.d.ts +4 -4
- package/dist/useSplitResize.d.cts +4 -4
- package/dist/useSplitResize.d.ts +4 -4
- package/dist/useTableGlobalConfig.cjs +1 -0
- package/dist/useTableGlobalConfig.js +1 -0
- package/dist/useTableQuery.cjs +1 -3
- package/dist/useTableQuery.js +1 -3
- package/dist/useWorkflowValidation.d.cts +2 -2
- package/dist/useWorkflowValidation.d.ts +2 -2
- package/dist/validation.cjs +1 -0
- package/dist/validation.d.cts +18 -0
- package/dist/validation.d.ts +18 -0
- package/dist/validation.js +1 -0
- package/dist/verification.d.cts +2 -2
- package/dist/verification.d.ts +3 -3
- package/dist/workflows.cjs +1 -0
- package/dist/workflows.d.cts +2 -0
- package/dist/workflows.d.ts +2 -0
- package/dist/workflows.js +1 -0
- package/docs/components.en.md +13 -1
- package/docs/components.md +13 -1
- package/docs/guides/batch-results.md +47 -0
- package/docs/guides/data-picker.md +65 -0
- package/docs/guides/data-workflows.md +123 -0
- package/docs/guides/form-density.en.md +39 -0
- package/docs/guides/form-density.md +39 -0
- package/docs/guides/search-workflows.md +164 -0
- package/package.json +21 -1
- package/dist/C_FormSearch2.cjs +0 -1
- package/dist/C_FormSearch2.js +0 -1
- package/dist/useTableQuery.d.cts +0 -1957
- package/dist/useTableQuery.d.ts +0 -1946
package/dist/index7.vue.d.ts
CHANGED
|
@@ -1,27 +1,121 @@
|
|
|
1
1
|
import * as vue from "vue";
|
|
2
2
|
|
|
3
|
-
//#region src/components/
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
//#region src/components/C_Chat/types.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* @Description: C_Chat 通用聊天组件 - 类型定义
|
|
6
|
+
*/
|
|
7
|
+
/** 消息类型 */
|
|
8
|
+
type MessageType = 'text' | 'image' | 'file' | 'system';
|
|
9
|
+
/** 消息发送方 */
|
|
10
|
+
type MessageSender = 'self' | 'other' | 'system';
|
|
11
|
+
/** 消息状态 */
|
|
12
|
+
type MessageStatus = 'sending' | 'sent' | 'failed';
|
|
13
|
+
/** 单条消息 */
|
|
14
|
+
interface ChatMessage {
|
|
15
|
+
/** 唯一标识 */
|
|
16
|
+
id: string;
|
|
17
|
+
/** 消息内容(文本 / 图片 URL / 文件信息 JSON) */
|
|
18
|
+
content: string;
|
|
19
|
+
/** 消息类型 */
|
|
20
|
+
type: MessageType;
|
|
21
|
+
/** 发送方 */
|
|
22
|
+
sender: MessageSender;
|
|
23
|
+
/** 发送时间(ISO 字符串 或 时间戳) */
|
|
24
|
+
timestamp: string | number;
|
|
25
|
+
/** 发送者头像 URL */
|
|
26
|
+
avatar?: string;
|
|
27
|
+
/** 发送者用户名 */
|
|
28
|
+
username?: string;
|
|
29
|
+
/** 消息状态 */
|
|
30
|
+
status?: MessageStatus;
|
|
31
|
+
/** 文件名(type = 'file' 时使用) */
|
|
32
|
+
fileName?: string;
|
|
33
|
+
/** 文件大小(字节) */
|
|
34
|
+
fileSize?: number;
|
|
35
|
+
}
|
|
36
|
+
/** 联系人 / 会话 */
|
|
37
|
+
interface ChatContact {
|
|
38
|
+
/** 唯一标识 */
|
|
39
|
+
id: string;
|
|
40
|
+
/** 显示名称 */
|
|
41
|
+
name: string;
|
|
42
|
+
/** 头像 URL */
|
|
43
|
+
avatar?: string;
|
|
44
|
+
/** 最后一条消息摘要 */
|
|
45
|
+
lastMessage?: string;
|
|
46
|
+
/** 最后消息时间 */
|
|
47
|
+
lastTime?: string | number;
|
|
48
|
+
/** 未读数 */
|
|
49
|
+
unread?: number;
|
|
50
|
+
/** 是否在线 */
|
|
51
|
+
online?: boolean;
|
|
52
|
+
}
|
|
53
|
+
interface ChatProps {
|
|
54
|
+
/** 联系人列表 */
|
|
55
|
+
contacts?: ChatContact[];
|
|
56
|
+
/** 消息列表 */
|
|
57
|
+
messages?: ChatMessage[];
|
|
58
|
+
/** 当前选中的联系人 ID */
|
|
59
|
+
currentContactId?: string;
|
|
60
|
+
/** 输入框占位符 */
|
|
6
61
|
placeholder?: string;
|
|
7
|
-
|
|
62
|
+
/** 是否显示联系人侧栏 */
|
|
63
|
+
showContacts?: boolean;
|
|
64
|
+
/** 是否显示消息时间戳 */
|
|
65
|
+
showTimestamp?: boolean;
|
|
66
|
+
/** 当前用户头像 */
|
|
67
|
+
selfAvatar?: string;
|
|
68
|
+
/** 当前用户名 */
|
|
69
|
+
selfName?: string;
|
|
70
|
+
/** 是否显示发送按钮 */
|
|
71
|
+
showSendBtn?: boolean;
|
|
72
|
+
/** 是否正在加载历史消息 */
|
|
73
|
+
loadingHistory?: boolean;
|
|
74
|
+
/** 大列表自动窗口化;false 可保留完整 DOM(消息 200 条、联系人 100 条起)。 */
|
|
75
|
+
virtualScroll?: boolean;
|
|
76
|
+
/** 标题(无联系人模式时显示) */
|
|
77
|
+
title?: string;
|
|
8
78
|
}
|
|
9
|
-
declare
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
79
|
+
declare const DEFAULT_CHAT_PROPS: Required<Pick<ChatProps, 'placeholder' | 'showContacts' | 'showTimestamp' | 'showSendBtn' | 'loadingHistory' | 'title'>>;
|
|
80
|
+
//#endregion
|
|
81
|
+
//#region src/components/C_Chat/index.vue.d.ts
|
|
82
|
+
declare var __VLS_39: {}, __VLS_83: {};
|
|
13
83
|
type __VLS_Slots = {} & {
|
|
14
|
-
|
|
84
|
+
header?: (props: typeof __VLS_39) => any;
|
|
85
|
+
} & {
|
|
86
|
+
'input-actions'?: (props: typeof __VLS_83) => any;
|
|
15
87
|
};
|
|
16
|
-
declare const __VLS_base: vue.DefineComponent<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
88
|
+
declare const __VLS_base: vue.DefineComponent<ChatProps, {
|
|
89
|
+
scrollToBottom: () => void;
|
|
90
|
+
}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {} & {
|
|
91
|
+
"load-more": () => any;
|
|
92
|
+
send: (content: string) => any;
|
|
93
|
+
"select-contact": (id: string) => any;
|
|
94
|
+
"image-preview": (url: string) => any;
|
|
95
|
+
"file-click": (msg: ChatMessage) => any;
|
|
96
|
+
"file-upload": () => any;
|
|
97
|
+
"emoji-click": () => any;
|
|
98
|
+
resend: (msg: ChatMessage) => any;
|
|
99
|
+
}, string, vue.PublicProps, Readonly<ChatProps> & Readonly<{
|
|
100
|
+
"onLoad-more"?: (() => any) | undefined;
|
|
101
|
+
onSend?: ((content: string) => any) | undefined;
|
|
102
|
+
"onSelect-contact"?: ((id: string) => any) | undefined;
|
|
103
|
+
"onImage-preview"?: ((url: string) => any) | undefined;
|
|
104
|
+
"onFile-click"?: ((msg: ChatMessage) => any) | undefined;
|
|
105
|
+
"onFile-upload"?: (() => any) | undefined;
|
|
106
|
+
"onEmoji-click"?: (() => any) | undefined;
|
|
107
|
+
onResend?: ((msg: ChatMessage) => any) | undefined;
|
|
22
108
|
}>, {
|
|
23
|
-
|
|
24
|
-
|
|
109
|
+
virtualScroll: boolean;
|
|
110
|
+
showContacts: boolean;
|
|
111
|
+
showTimestamp: boolean;
|
|
112
|
+
showSendBtn: boolean;
|
|
113
|
+
loadingHistory: boolean;
|
|
114
|
+
contacts: ChatContact[];
|
|
115
|
+
messages: ChatMessage[];
|
|
116
|
+
currentContactId: string;
|
|
117
|
+
selfAvatar: string;
|
|
118
|
+
selfName: string;
|
|
25
119
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
|
26
120
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
27
121
|
declare const _default: typeof __VLS_export;
|
|
@@ -31,4 +125,4 @@ type __VLS_WithSlots<T, S> = T & {
|
|
|
31
125
|
};
|
|
32
126
|
};
|
|
33
127
|
//#endregion
|
|
34
|
-
export { _default as t };
|
|
128
|
+
export { DEFAULT_CHAT_PROPS as a, MessageType as c, ChatProps as i, ChatContact as n, MessageSender as o, ChatMessage as r, MessageStatus as s, _default as t };
|
package/dist/index8.vue.d.cts
CHANGED
|
@@ -1,27 +1,121 @@
|
|
|
1
1
|
import * as vue from "vue";
|
|
2
2
|
|
|
3
|
-
//#region src/components/
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
//#region src/components/C_Chat/types.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* @Description: C_Chat 通用聊天组件 - 类型定义
|
|
6
|
+
*/
|
|
7
|
+
/** 消息类型 */
|
|
8
|
+
type MessageType = 'text' | 'image' | 'file' | 'system';
|
|
9
|
+
/** 消息发送方 */
|
|
10
|
+
type MessageSender = 'self' | 'other' | 'system';
|
|
11
|
+
/** 消息状态 */
|
|
12
|
+
type MessageStatus = 'sending' | 'sent' | 'failed';
|
|
13
|
+
/** 单条消息 */
|
|
14
|
+
interface ChatMessage {
|
|
15
|
+
/** 唯一标识 */
|
|
16
|
+
id: string;
|
|
17
|
+
/** 消息内容(文本 / 图片 URL / 文件信息 JSON) */
|
|
18
|
+
content: string;
|
|
19
|
+
/** 消息类型 */
|
|
20
|
+
type: MessageType;
|
|
21
|
+
/** 发送方 */
|
|
22
|
+
sender: MessageSender;
|
|
23
|
+
/** 发送时间(ISO 字符串 或 时间戳) */
|
|
24
|
+
timestamp: string | number;
|
|
25
|
+
/** 发送者头像 URL */
|
|
26
|
+
avatar?: string;
|
|
27
|
+
/** 发送者用户名 */
|
|
28
|
+
username?: string;
|
|
29
|
+
/** 消息状态 */
|
|
30
|
+
status?: MessageStatus;
|
|
31
|
+
/** 文件名(type = 'file' 时使用) */
|
|
32
|
+
fileName?: string;
|
|
33
|
+
/** 文件大小(字节) */
|
|
34
|
+
fileSize?: number;
|
|
35
|
+
}
|
|
36
|
+
/** 联系人 / 会话 */
|
|
37
|
+
interface ChatContact {
|
|
38
|
+
/** 唯一标识 */
|
|
39
|
+
id: string;
|
|
40
|
+
/** 显示名称 */
|
|
41
|
+
name: string;
|
|
42
|
+
/** 头像 URL */
|
|
43
|
+
avatar?: string;
|
|
44
|
+
/** 最后一条消息摘要 */
|
|
45
|
+
lastMessage?: string;
|
|
46
|
+
/** 最后消息时间 */
|
|
47
|
+
lastTime?: string | number;
|
|
48
|
+
/** 未读数 */
|
|
49
|
+
unread?: number;
|
|
50
|
+
/** 是否在线 */
|
|
51
|
+
online?: boolean;
|
|
52
|
+
}
|
|
53
|
+
interface ChatProps {
|
|
54
|
+
/** 联系人列表 */
|
|
55
|
+
contacts?: ChatContact[];
|
|
56
|
+
/** 消息列表 */
|
|
57
|
+
messages?: ChatMessage[];
|
|
58
|
+
/** 当前选中的联系人 ID */
|
|
59
|
+
currentContactId?: string;
|
|
60
|
+
/** 输入框占位符 */
|
|
6
61
|
placeholder?: string;
|
|
7
|
-
|
|
62
|
+
/** 是否显示联系人侧栏 */
|
|
63
|
+
showContacts?: boolean;
|
|
64
|
+
/** 是否显示消息时间戳 */
|
|
65
|
+
showTimestamp?: boolean;
|
|
66
|
+
/** 当前用户头像 */
|
|
67
|
+
selfAvatar?: string;
|
|
68
|
+
/** 当前用户名 */
|
|
69
|
+
selfName?: string;
|
|
70
|
+
/** 是否显示发送按钮 */
|
|
71
|
+
showSendBtn?: boolean;
|
|
72
|
+
/** 是否正在加载历史消息 */
|
|
73
|
+
loadingHistory?: boolean;
|
|
74
|
+
/** 大列表自动窗口化;false 可保留完整 DOM(消息 200 条、联系人 100 条起)。 */
|
|
75
|
+
virtualScroll?: boolean;
|
|
76
|
+
/** 标题(无联系人模式时显示) */
|
|
77
|
+
title?: string;
|
|
8
78
|
}
|
|
9
|
-
declare
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
79
|
+
declare const DEFAULT_CHAT_PROPS: Required<Pick<ChatProps, 'placeholder' | 'showContacts' | 'showTimestamp' | 'showSendBtn' | 'loadingHistory' | 'title'>>;
|
|
80
|
+
//#endregion
|
|
81
|
+
//#region src/components/C_Chat/index.vue.d.ts
|
|
82
|
+
declare var __VLS_39: {}, __VLS_83: {};
|
|
13
83
|
type __VLS_Slots = {} & {
|
|
14
|
-
|
|
84
|
+
header?: (props: typeof __VLS_39) => any;
|
|
85
|
+
} & {
|
|
86
|
+
'input-actions'?: (props: typeof __VLS_83) => any;
|
|
15
87
|
};
|
|
16
|
-
declare const __VLS_base: vue.DefineComponent<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
88
|
+
declare const __VLS_base: vue.DefineComponent<ChatProps, {
|
|
89
|
+
scrollToBottom: () => void;
|
|
90
|
+
}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {} & {
|
|
91
|
+
"load-more": () => any;
|
|
92
|
+
send: (content: string) => any;
|
|
93
|
+
"select-contact": (id: string) => any;
|
|
94
|
+
"image-preview": (url: string) => any;
|
|
95
|
+
"file-click": (msg: ChatMessage) => any;
|
|
96
|
+
"file-upload": () => any;
|
|
97
|
+
"emoji-click": () => any;
|
|
98
|
+
resend: (msg: ChatMessage) => any;
|
|
99
|
+
}, string, vue.PublicProps, Readonly<ChatProps> & Readonly<{
|
|
100
|
+
"onLoad-more"?: (() => any) | undefined;
|
|
101
|
+
onSend?: ((content: string) => any) | undefined;
|
|
102
|
+
"onSelect-contact"?: ((id: string) => any) | undefined;
|
|
103
|
+
"onImage-preview"?: ((url: string) => any) | undefined;
|
|
104
|
+
"onFile-click"?: ((msg: ChatMessage) => any) | undefined;
|
|
105
|
+
"onFile-upload"?: (() => any) | undefined;
|
|
106
|
+
"onEmoji-click"?: (() => any) | undefined;
|
|
107
|
+
onResend?: ((msg: ChatMessage) => any) | undefined;
|
|
22
108
|
}>, {
|
|
23
|
-
|
|
24
|
-
|
|
109
|
+
virtualScroll: boolean;
|
|
110
|
+
showContacts: boolean;
|
|
111
|
+
showTimestamp: boolean;
|
|
112
|
+
showSendBtn: boolean;
|
|
113
|
+
loadingHistory: boolean;
|
|
114
|
+
contacts: ChatContact[];
|
|
115
|
+
messages: ChatMessage[];
|
|
116
|
+
currentContactId: string;
|
|
117
|
+
selfAvatar: string;
|
|
118
|
+
selfName: string;
|
|
25
119
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
|
26
120
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
27
121
|
declare const _default: typeof __VLS_export;
|
|
@@ -31,4 +125,4 @@ type __VLS_WithSlots<T, S> = T & {
|
|
|
31
125
|
};
|
|
32
126
|
};
|
|
33
127
|
//#endregion
|
|
34
|
-
export { _default as t };
|
|
128
|
+
export { DEFAULT_CHAT_PROPS as a, MessageType as c, ChatProps as i, ChatContact as n, MessageSender as o, ChatMessage as r, MessageStatus as s, _default as t };
|
package/dist/index8.vue.d.ts
CHANGED
|
@@ -1,45 +1,34 @@
|
|
|
1
1
|
import * as vue from "vue";
|
|
2
2
|
|
|
3
|
-
//#region src/components/
|
|
3
|
+
//#region src/components/C_City/index.vue.d.ts
|
|
4
4
|
interface Props {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
showHeader?: boolean;
|
|
9
|
-
showLineNumbers?: boolean;
|
|
10
|
-
wordWrap?: boolean;
|
|
11
|
-
trim?: boolean;
|
|
12
|
-
showFullscreen?: boolean;
|
|
13
|
-
maxHeight?: string | number;
|
|
14
|
-
autoLoadLanguage?: boolean;
|
|
5
|
+
modelValue?: string;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
showLetters?: boolean;
|
|
15
8
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
click: (event: MouseEvent) => any;
|
|
27
|
-
copy: (code: string) => any;
|
|
28
|
-
fullscreen: (isFullscreen: boolean) => any;
|
|
9
|
+
declare var __VLS_9: {
|
|
10
|
+
value: string | undefined;
|
|
11
|
+
visible: boolean;
|
|
12
|
+
};
|
|
13
|
+
type __VLS_Slots = {} & {
|
|
14
|
+
trigger?: (props: typeof __VLS_9) => any;
|
|
15
|
+
};
|
|
16
|
+
declare const __VLS_base: vue.DefineComponent<Props, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {} & {
|
|
17
|
+
"update:modelValue": (value: string) => any;
|
|
18
|
+
change: (value: string) => any;
|
|
29
19
|
}, string, vue.PublicProps, Readonly<Props> & Readonly<{
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
onFullscreen?: ((isFullscreen: boolean) => any) | undefined;
|
|
20
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
21
|
+
onChange?: ((value: string) => any) | undefined;
|
|
33
22
|
}>, {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
language: string;
|
|
37
|
-
showHeader: boolean;
|
|
38
|
-
showLineNumbers: boolean;
|
|
39
|
-
wordWrap: boolean;
|
|
40
|
-
showFullscreen: boolean;
|
|
41
|
-
autoLoadLanguage: boolean;
|
|
23
|
+
placeholder: string;
|
|
24
|
+
showLetters: boolean;
|
|
42
25
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
|
26
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
43
27
|
declare const _default: typeof __VLS_export;
|
|
28
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
29
|
+
new (): {
|
|
30
|
+
$slots: S;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
44
33
|
//#endregion
|
|
45
34
|
export { _default as t };
|
package/dist/index9.vue.d.cts
CHANGED
|
@@ -1,45 +1,34 @@
|
|
|
1
1
|
import * as vue from "vue";
|
|
2
2
|
|
|
3
|
-
//#region src/components/
|
|
3
|
+
//#region src/components/C_City/index.vue.d.ts
|
|
4
4
|
interface Props {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
showHeader?: boolean;
|
|
9
|
-
showLineNumbers?: boolean;
|
|
10
|
-
wordWrap?: boolean;
|
|
11
|
-
trim?: boolean;
|
|
12
|
-
showFullscreen?: boolean;
|
|
13
|
-
maxHeight?: string | number;
|
|
14
|
-
autoLoadLanguage?: boolean;
|
|
5
|
+
modelValue?: string;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
showLetters?: boolean;
|
|
15
8
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
click: (event: MouseEvent) => any;
|
|
27
|
-
copy: (code: string) => any;
|
|
28
|
-
fullscreen: (isFullscreen: boolean) => any;
|
|
9
|
+
declare var __VLS_9: {
|
|
10
|
+
value: string | undefined;
|
|
11
|
+
visible: boolean;
|
|
12
|
+
};
|
|
13
|
+
type __VLS_Slots = {} & {
|
|
14
|
+
trigger?: (props: typeof __VLS_9) => any;
|
|
15
|
+
};
|
|
16
|
+
declare const __VLS_base: vue.DefineComponent<Props, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {} & {
|
|
17
|
+
"update:modelValue": (value: string) => any;
|
|
18
|
+
change: (value: string) => any;
|
|
29
19
|
}, string, vue.PublicProps, Readonly<Props> & Readonly<{
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
onFullscreen?: ((isFullscreen: boolean) => any) | undefined;
|
|
20
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
21
|
+
onChange?: ((value: string) => any) | undefined;
|
|
33
22
|
}>, {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
language: string;
|
|
37
|
-
showHeader: boolean;
|
|
38
|
-
showLineNumbers: boolean;
|
|
39
|
-
wordWrap: boolean;
|
|
40
|
-
showFullscreen: boolean;
|
|
41
|
-
autoLoadLanguage: boolean;
|
|
23
|
+
placeholder: string;
|
|
24
|
+
showLetters: boolean;
|
|
42
25
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
|
26
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
43
27
|
declare const _default: typeof __VLS_export;
|
|
28
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
29
|
+
new (): {
|
|
30
|
+
$slots: S;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
44
33
|
//#endregion
|
|
45
34
|
export { _default as t };
|
package/dist/index9.vue.d.ts
CHANGED
|
@@ -1,88 +1,45 @@
|
|
|
1
1
|
import * as vue from "vue";
|
|
2
2
|
|
|
3
|
-
//#region src/components/
|
|
3
|
+
//#region src/components/C_Code/index.vue.d.ts
|
|
4
|
+
interface Props {
|
|
5
|
+
code: string;
|
|
6
|
+
language?: string;
|
|
7
|
+
title?: string;
|
|
8
|
+
showHeader?: boolean;
|
|
9
|
+
showLineNumbers?: boolean;
|
|
10
|
+
wordWrap?: boolean;
|
|
11
|
+
trim?: boolean;
|
|
12
|
+
showFullscreen?: boolean;
|
|
13
|
+
maxHeight?: string | number;
|
|
14
|
+
autoLoadLanguage?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/** 复制发起时的内容;文本随后变化不会改变已写入剪贴板的事件快照。 */
|
|
17
|
+
declare function copyCode(): Promise<void>;
|
|
4
18
|
/**
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) 2026 by CHENY, All Rights Reserved 😎.
|
|
19
|
+
* 切换全屏显示状态
|
|
7
20
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
/** 是否隐藏 */
|
|
21
|
-
hidden?: boolean;
|
|
22
|
-
/** 分割线(此项渲染为分割线,label 被忽略) */
|
|
23
|
-
divider?: boolean;
|
|
24
|
-
/** 子菜单(支持无限嵌套) */
|
|
25
|
-
children?: ContextMenuItem[];
|
|
26
|
-
/** 自定义样式类 */
|
|
27
|
-
className?: string;
|
|
28
|
-
/** 危险操作(红色高亮) */
|
|
29
|
-
danger?: boolean;
|
|
30
|
-
}
|
|
31
|
-
/** 组件 Props */
|
|
32
|
-
interface ContextMenuProps {
|
|
33
|
-
/** 菜单项列表 */
|
|
34
|
-
items: ContextMenuItem[];
|
|
35
|
-
/** 菜单最小宽度 */
|
|
36
|
-
minWidth?: number;
|
|
37
|
-
/** 菜单最大宽度 */
|
|
38
|
-
maxWidth?: number;
|
|
39
|
-
/** 子菜单展开方向 */
|
|
40
|
-
subMenuPlacement?: 'right' | 'left';
|
|
41
|
-
/** 点击菜单项后是否自动关闭 */
|
|
42
|
-
autoClose?: boolean;
|
|
43
|
-
/** 是否禁用整个菜单 */
|
|
44
|
-
disabled?: boolean;
|
|
45
|
-
/** 自定义 z-index */
|
|
46
|
-
zIndex?: number;
|
|
47
|
-
}
|
|
48
|
-
/** 默认 Props */
|
|
49
|
-
declare const DEFAULT_CONTEXT_MENU_PROPS: {
|
|
50
|
-
minWidth: number;
|
|
51
|
-
maxWidth: number;
|
|
52
|
-
subMenuPlacement: "right";
|
|
53
|
-
autoClose: boolean;
|
|
54
|
-
disabled: boolean;
|
|
55
|
-
zIndex: number;
|
|
56
|
-
};
|
|
57
|
-
//#endregion
|
|
58
|
-
//#region src/components/C_ContextMenu/index.vue.d.ts
|
|
59
|
-
declare const __VLS_export: vue.DefineComponent<ContextMenuProps, {
|
|
60
|
-
/** 在指定坐标打开菜单 */open: (x: number, y: number) => void; /** 关闭菜单 */
|
|
61
|
-
close: () => void; /** 当前是否可见 */
|
|
62
|
-
visible: vue.ComputedRef<boolean>;
|
|
63
|
-
}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {} & {
|
|
64
|
-
close: () => any;
|
|
65
|
-
select: (item: ContextMenuItem) => any;
|
|
66
|
-
open: (position: {
|
|
67
|
-
x: number;
|
|
68
|
-
y: number;
|
|
69
|
-
}) => any;
|
|
70
|
-
}, string, vue.PublicProps, Readonly<ContextMenuProps> & Readonly<{
|
|
71
|
-
onClose?: (() => any) | undefined;
|
|
72
|
-
onSelect?: ((item: ContextMenuItem) => any) | undefined;
|
|
73
|
-
onOpen?: ((position: {
|
|
74
|
-
x: number;
|
|
75
|
-
y: number;
|
|
76
|
-
}) => any) | undefined;
|
|
21
|
+
declare function toggleFullscreen(): void;
|
|
22
|
+
declare const __VLS_export: vue.DefineComponent<Props, {
|
|
23
|
+
copyCode: typeof copyCode;
|
|
24
|
+
toggleFullscreen: typeof toggleFullscreen;
|
|
25
|
+
}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
|
|
26
|
+
fullscreen: (isFullscreen: boolean) => any;
|
|
27
|
+
click: (event: MouseEvent) => any;
|
|
28
|
+
copy: (code: string) => any;
|
|
29
|
+
}, string, vue.PublicProps, Readonly<Props> & Readonly<{
|
|
30
|
+
onFullscreen?: ((isFullscreen: boolean) => any) | undefined;
|
|
31
|
+
onClick?: ((event: MouseEvent) => any) | undefined;
|
|
32
|
+
onCopy?: ((code: string) => any) | undefined;
|
|
77
33
|
}>, {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
34
|
+
trim: boolean;
|
|
35
|
+
showHeader: boolean;
|
|
36
|
+
language: string;
|
|
37
|
+
code: string;
|
|
38
|
+
showLineNumbers: boolean;
|
|
39
|
+
wordWrap: boolean;
|
|
40
|
+
showFullscreen: boolean;
|
|
41
|
+
autoLoadLanguage: boolean;
|
|
85
42
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
|
86
43
|
declare const _default: typeof __VLS_export;
|
|
87
44
|
//#endregion
|
|
88
|
-
export {
|
|
45
|
+
export { _default as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)$/;function t(e){if(!Number.isFinite(e))throw TypeError(`数值必须有限`);let t=String(e);if(!t.includes(`e`))return t;let[n,r]=t.split(`e`),i=n.startsWith(`-`),[a,o=``]=n.replace(/^-/,``).split(`.`),s=a+o,c=a.length+Number(r),l=c<=0?`0.${`0`.repeat(-c)}${s}`:c>=s.length?s+`0`.repeat(c-s.length):`${s.slice(0,c)}.${s.slice(c)}`;return i?`-${l}`:l}function n(e){let t=e.startsWith(`-`),[n=``,r=``]=e.replace(/^[+-]/,``).split(`.`),i=n.replace(/^0+(?=\d)/,``)||`0`,a=r.replace(/0+$/,``),o=i+(a?`.${a}`:``);return t&&o!==`0`?`-${o}`:o}function r(r){if(r==null)return null;if(typeof r!=`number`&&typeof r!=`string`)throw TypeError(`数值必须是十进制文本或有限数字`);let i=typeof r==`number`?t(r):r.trim();if(i===``)return null;if(i.length>1e3||!e.test(i))throw TypeError(`请输入长度不超过 1000 位的普通十进制数`);return n(i)}function i(e,t){let n=e.startsWith(`-`),[r,i=``]=e.replace(/^-/,``).split(`.`),a=i.slice(0,t).padEnd(t,`0`),o=BigInt(r+a);i.length>t&&i[t]>=`5`&&(o+=1n);let s=o.toString().padStart(t+1,`0`),c=t?`${s.slice(0,-t)}.${s.slice(-t)}`:s;return n&&o!==0n?`-${c}`:c}function a(e={}){let t={...e},n=t.fractionDigits;if(n!==void 0&&(!Number.isInteger(n)||n<0||n>100))throw RangeError(`fractionDigits 必须是 0 到 100 的整数`);if(t.storage!==void 0&&![`number`,`decimal-string`].includes(t.storage))throw TypeError(`未知的数值存储类型`);return{parse(e){if(typeof e==`number`&&Number.isInteger(e)&&!Number.isSafeInteger(e))throw RangeError(`精确数值必须传原始文本,不能从不安全的 number 恢复精度`);let n=r(e);if(n===null||t.storage===`decimal-string`)return n;let i=Number(n);if(!Number.isFinite(i)||Number.isInteger(i)&&!Number.isSafeInteger(i)||r(i)!==n)throw RangeError(`数值不能安全转换为 number,请使用 decimal-string`);return i},format(e){let a=r(e);if(a===null)return t.emptyText??`—`;let o=n===void 0?a:i(a,n);if(t.useGrouping){let[e,t]=o.split(`.`);o=e.replace(/\B(?=(\d{3})+(?!\d))/g,`,`)+(t===void 0?``:`.${t}`)}return`${t.prefix??``}${o}${t.suffix??``}`}}}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return a}});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region src/core/numberCodec.d.ts
|
|
2
|
+
/** 数值的编辑/显示边界;不承担业务校验、单位换算或税费计算。 */
|
|
3
|
+
interface ValueCodec<T> {
|
|
4
|
+
parse(input: unknown): T;
|
|
5
|
+
format(value: T): string;
|
|
6
|
+
}
|
|
7
|
+
interface NumberCodecOptions {
|
|
8
|
+
/** 精确小数保留十进制字符串;number 模式拒绝不能往返的数值。 */
|
|
9
|
+
storage?: 'number' | 'decimal-string';
|
|
10
|
+
/** 仅控制显示的 HALF_UP 舍入,不修改存储值;0 是有效精度。 */
|
|
11
|
+
fractionDigits?: number;
|
|
12
|
+
useGrouping?: boolean;
|
|
13
|
+
emptyText?: string;
|
|
14
|
+
prefix?: string;
|
|
15
|
+
suffix?: string;
|
|
16
|
+
}
|
|
17
|
+
declare function createNumberCodec(options: NumberCodecOptions & {
|
|
18
|
+
storage: 'decimal-string';
|
|
19
|
+
}): ValueCodec<string | null>;
|
|
20
|
+
declare function createNumberCodec(options?: NumberCodecOptions & {
|
|
21
|
+
storage?: 'number';
|
|
22
|
+
}): ValueCodec<number | null>;
|
|
23
|
+
declare function createNumberCodec(options: NumberCodecOptions): ValueCodec<number | string | null>;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { ValueCodec as n, createNumberCodec as r, NumberCodecOptions as t };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region src/core/numberCodec.d.ts
|
|
2
|
+
/** 数值的编辑/显示边界;不承担业务校验、单位换算或税费计算。 */
|
|
3
|
+
interface ValueCodec<T> {
|
|
4
|
+
parse(input: unknown): T;
|
|
5
|
+
format(value: T): string;
|
|
6
|
+
}
|
|
7
|
+
interface NumberCodecOptions {
|
|
8
|
+
/** 精确小数保留十进制字符串;number 模式拒绝不能往返的数值。 */
|
|
9
|
+
storage?: 'number' | 'decimal-string';
|
|
10
|
+
/** 仅控制显示的 HALF_UP 舍入,不修改存储值;0 是有效精度。 */
|
|
11
|
+
fractionDigits?: number;
|
|
12
|
+
useGrouping?: boolean;
|
|
13
|
+
emptyText?: string;
|
|
14
|
+
prefix?: string;
|
|
15
|
+
suffix?: string;
|
|
16
|
+
}
|
|
17
|
+
declare function createNumberCodec(options: NumberCodecOptions & {
|
|
18
|
+
storage: 'decimal-string';
|
|
19
|
+
}): ValueCodec<string | null>;
|
|
20
|
+
declare function createNumberCodec(options?: NumberCodecOptions & {
|
|
21
|
+
storage?: 'number';
|
|
22
|
+
}): ValueCodec<number | null>;
|
|
23
|
+
declare function createNumberCodec(options: NumberCodecOptions): ValueCodec<number | string | null>;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { ValueCodec as n, createNumberCodec as r, NumberCodecOptions as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)$/;function t(e){if(!Number.isFinite(e))throw TypeError(`数值必须有限`);let t=String(e);if(!t.includes(`e`))return t;let[n,r]=t.split(`e`),i=n.startsWith(`-`),[a,o=``]=n.replace(/^-/,``).split(`.`),s=a+o,c=a.length+Number(r),l=c<=0?`0.${`0`.repeat(-c)}${s}`:c>=s.length?s+`0`.repeat(c-s.length):`${s.slice(0,c)}.${s.slice(c)}`;return i?`-${l}`:l}function n(e){let t=e.startsWith(`-`),[n=``,r=``]=e.replace(/^[+-]/,``).split(`.`),i=n.replace(/^0+(?=\d)/,``)||`0`,a=r.replace(/0+$/,``),o=i+(a?`.${a}`:``);return t&&o!==`0`?`-${o}`:o}function r(r){if(r==null)return null;if(typeof r!=`number`&&typeof r!=`string`)throw TypeError(`数值必须是十进制文本或有限数字`);let i=typeof r==`number`?t(r):r.trim();if(i===``)return null;if(i.length>1e3||!e.test(i))throw TypeError(`请输入长度不超过 1000 位的普通十进制数`);return n(i)}function i(e,t){let n=e.startsWith(`-`),[r,i=``]=e.replace(/^-/,``).split(`.`),a=i.slice(0,t).padEnd(t,`0`),o=BigInt(r+a);i.length>t&&i[t]>=`5`&&(o+=1n);let s=o.toString().padStart(t+1,`0`),c=t?`${s.slice(0,-t)}.${s.slice(-t)}`:s;return n&&o!==0n?`-${c}`:c}function a(e={}){let t={...e},n=t.fractionDigits;if(n!==void 0&&(!Number.isInteger(n)||n<0||n>100))throw RangeError(`fractionDigits 必须是 0 到 100 的整数`);if(t.storage!==void 0&&![`number`,`decimal-string`].includes(t.storage))throw TypeError(`未知的数值存储类型`);return{parse(e){if(typeof e==`number`&&Number.isInteger(e)&&!Number.isSafeInteger(e))throw RangeError(`精确数值必须传原始文本,不能从不安全的 number 恢复精度`);let n=r(e);if(n===null||t.storage===`decimal-string`)return n;let i=Number(n);if(!Number.isFinite(i)||Number.isInteger(i)&&!Number.isSafeInteger(i)||r(i)!==n)throw RangeError(`数值不能安全转换为 number,请使用 decimal-string`);return i},format(e){let a=r(e);if(a===null)return t.emptyText??`—`;let o=n===void 0?a:i(a,n);if(t.useGrouping){let[e,t]=o.split(`.`);o=e.replace(/\B(?=(\d{3})+(?!\d))/g,`,`)+(t===void 0?``:`.${t}`)}return`${t.prefix??``}${o}${t.suffix??``}`}}}export{a as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){try{Promise.resolve(e()).catch(()=>void 0)}catch{}}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return e}});
|
package/dist/observer.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){try{Promise.resolve(e()).catch(()=>void 0)}catch{}}export{e as t};
|