@xn-lib/base 0.0.19 → 0.0.20

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@xn-lib/base",
4
- "version": "0.0.19",
4
+ "version": "0.0.20",
5
5
  "description": "",
6
6
  "main": "./dist/index.cjs",
7
7
  "module": "./dist/index.mjs",
@@ -1,261 +0,0 @@
1
- /**
2
- * 复制文本到剪贴板(兼容旧版浏览器)
3
- * @param text 要复制的文本
4
- */
5
- export declare function copy(text: string): void;
6
- /**
7
- * 复制文本到剪贴板
8
- * @param text 要复制的文本
9
- */
10
- export declare function copyToClipboard(text: string): void;
11
- /**
12
- * 获取剪贴板内容
13
- * @returns Promise<string>
14
- */
15
- export declare function getPasteContent(): Promise<string>;
16
- /**
17
- * 判断数据是否可用(不为 null/undefined 且不为空字符串)
18
- * @param data 要判断的数据
19
- * @returns boolean
20
- */
21
- export declare const isAvailableData: (data: any) => boolean;
22
- /**
23
- * 判断数组是否有内容
24
- * @param data 要判断的数据
25
- * @returns boolean
26
- */
27
- export declare const hasContentArray: (data: any) => boolean;
28
- /**
29
- * 判断是否为复杂数据类型(数组或对象)
30
- * @param data 要判断的数据
31
- * @returns boolean
32
- */
33
- export declare const isComplexData: (data: any) => boolean;
34
- /**
35
- * 从对象中筛选出有效数据
36
- * @param data 原始对象
37
- * @returns 筛选后的对象
38
- */
39
- export declare const pickAvailableData: <T extends Record<string, any>>(data: T) => Partial<T>;
40
- /**
41
- * 将列表转换为 Map 结构
42
- * @param key 作为 key 的字段名
43
- * @param list 数据列表
44
- * @param valueKey 作为 value 的字段名或函数
45
- * @returns 转换后的对象
46
- */
47
- export declare const listToMapWith: <T extends Record<string, any>, K extends keyof T>(key: K, list?: T[], valueKey?: string | ((item: T) => any)) => Record<string, any>;
48
- /**
49
- * 执行函数,如果函数不存在则返回默认值
50
- * @param fun 要执行的函数
51
- * @param defaultReturn 默认返回值
52
- * @param args 函数参数
53
- * @returns 函数执行结果或默认值
54
- */
55
- export declare function runFun<T = any, R = any>(fun: ((...args: any[]) => R) | null | undefined, defaultReturn?: T | null, ...args: any[]): T | R | null;
56
- /**
57
- * 值策略函数
58
- * @param map 映射对象
59
- * @param defaultValue 默认值
60
- * @returns 返回一个函数,根据 key 获取对应的值或默认值
61
- */
62
- export declare const valueStrategy: <T = any>(map?: Record<string, T>, defaultValue?: T) => (key: string) => T | undefined;
63
- /**
64
- * 条件判断函数
65
- * @param caseList 条件列表,每个元素为 [条件, 效果] 的元组
66
- * @param defaultValue 默认值
67
- * @returns 返回一个函数,根据条件执行对应的效果
68
- */
69
- export declare const cond: <T = any>(caseList?: Array<[((...args: any[]) => boolean) | Array<(...args: any[]) => boolean>, (...args: any[]) => T]>, defaultValue?: T | null) => (...args: any[]) => T | null;
70
- /**
71
- * 函数策略
72
- * @param map 函数映射对象
73
- * @returns 返回一个函数,根据 key 执行对应的函数
74
- */
75
- export declare const functionStrategy: <T = any>(map?: Record<string, ((...args: any[]) => T) | undefined>) => (key: string, args?: any[], defaultReturn?: T) => T | undefined;
76
- /**
77
- * 对象转换为数组
78
- * @param obj 原始对象
79
- * @param options 配置选项
80
- * @returns 转换后的数组
81
- */
82
- export declare const objToArray: <T = any>(obj?: Record<string, T>, options?: {
83
- labelKey?: string;
84
- valueKey?: string;
85
- }) => Array<Record<string, any>>;
86
- /**
87
- * Map 转换为 JSON 对象
88
- * @param map Map 对象
89
- * @returns 转换后的对象
90
- */
91
- export declare const mapToJson: <K extends string | number | symbol, V>(map: Map<K, V>) => Record<string, V>;
92
- /**
93
- * 转换为数组
94
- * @param data 要转换的数据
95
- * @returns 数组
96
- */
97
- export declare const toArray: <T>(data: T | T[] | null | undefined) => T[];
98
- /**
99
- * 函数包装器,返回一个返回固定值的函数
100
- * @param data 要返回的数据
101
- * @returns 返回该数据的函数
102
- */
103
- export declare const funWrap: <T>(data: T) => () => T;
104
- /**
105
- * 组合函数(类似 Koa 中间件)
106
- * @param fns 函数列表
107
- * @returns 组合后的函数
108
- */
109
- export declare const compose: (...fns: Array<(ctx: any, next: () => Promise<any>) => Promise<any>>) => (ctx: any, next?: (() => Promise<any>) | null) => Promise<any>;
110
- /**
111
- * 条件分支函数
112
- * @param predictFn 判断函数
113
- * @param successFn 成功时执行的函数
114
- * @param failFn 失败时执行的函数
115
- * @returns 返回一个函数,根据判断结果执行对应的函数
116
- */
117
- export declare const ifElse: <T = any>(predictFn: ((...params: any[]) => boolean) | null | undefined, successFn: ((...params: any[]) => T) | null | undefined, failFn: ((...params: any[]) => T) | null | undefined) => (...params: any[]) => T | null;
118
- /**
119
- * 延迟函数
120
- * @param time 延迟时间(毫秒)
121
- * @returns Promise
122
- */
123
- export declare const sleep: (time: number) => Promise<void>;
124
- /**
125
- * 从元组中转为对象(已废弃,使用 tupleToObj)
126
- * @deprecated 使用 tupleToObj 代替
127
- */
128
- export declare const markNameFromTuple: (names?: string[], arr?: any[]) => Record<string, any>;
129
- /**
130
- * 元组转换为对象
131
- * @param names 属性名数组
132
- * @param tuple 元组数据
133
- * @returns 转换后的对象
134
- */
135
- export declare const tupleToObj: (names?: string[], tuple?: any[]) => Record<string, any>;
136
- /**
137
- * 元组列表转换为对象数组
138
- * @param names 属性名数组
139
- * @param tupleList 元组列表
140
- * @returns 转换后的对象数组
141
- */
142
- export declare const tupleListToArray: (names?: string[], tupleList?: any[][]) => Record<string, any>[];
143
- /**
144
- * 根据数组创建选项列表
145
- * @param arr 原始数组
146
- * @returns 选项数组,每个选项包含 label 和 value
147
- */
148
- export declare const createOptionByArray: <T = string | number>(arr?: T[]) => Array<{
149
- label: T;
150
- value: T;
151
- }>;
152
- /**
153
- * 可能是函数,如果是函数则执行,否则返回原值
154
- * @param data 可能是函数的值
155
- * @param args 函数参数
156
- * @returns 执行结果或原值
157
- */
158
- export declare const maybeFun: <T = any>(data: T | ((...args: any[]) => T), ...args: any[]) => T;
159
- /**
160
- * 获取数据类型
161
- * @param value 要判断的值
162
- * @returns 数据类型字符串
163
- */
164
- export declare const getDataType: (value: any) => string | undefined;
165
- /**
166
- * 遍历复杂数据的回调函数类型
167
- */
168
- export interface EachComplexDataCallback {
169
- (info: {
170
- key: string;
171
- value: any;
172
- dataType: string | undefined;
173
- dataPath: string[];
174
- parent: any;
175
- }): void;
176
- }
177
- /**
178
- * 遍历复杂数据
179
- * @param json 要遍历的数据
180
- * @param fn 回调函数
181
- */
182
- export declare const eachComplexData: (json: any, fn?: EachComplexDataCallback) => void;
183
- /**
184
- * 根据字段映射从数组中提取数据
185
- * @param array 原始数组
186
- * @param fieldMaps 字段映射数组,每个元素为 [旧字段名, 新字段名] 的元组
187
- * @returns 提取后的数组
188
- */
189
- export declare const pickDataByArray: <T extends Record<string, any>>(array?: T[], fieldMaps?: Array<[string, string]>) => Array<Record<string, any>>;
190
- /**
191
- * 重试函数配置
192
- */
193
- export interface RetryOptions {
194
- maxCount?: number;
195
- retryTime?: number;
196
- }
197
- /**
198
- * 创建重试函数
199
- * @param fn 要执行的函数
200
- * @param count 重试次数
201
- * @param options 重试配置
202
- * @returns 返回一个支持重试的函数
203
- */
204
- export declare function createRetryFun<T extends (...args: any[]) => Promise<any>>(fn: T, count: number, { maxCount, retryTime }?: RetryOptions): T;
205
- /**
206
- * 判断两个数组是否不同
207
- * @param arr1 数组1
208
- * @param arr2 数组2
209
- * @returns boolean
210
- */
211
- export declare const isDiffArray: <T = any>(arr1: T[], arr2: T[]) => boolean;
212
- /**
213
- * 判断是否为有效的JSON或对象
214
- * @param value 要判断的值
215
- * @returns boolean
216
- */
217
- export declare const isJsonOrObject: (value: any) => boolean;
218
- /**
219
- * 下载文件配置选项
220
- */
221
- export interface DownloadOptions {
222
- /** 文件名 */
223
- filename?: string;
224
- /** MIME 类型 */
225
- mimeType?: string;
226
- /** 是否在新窗口打开(用于 URL 下载) */
227
- openInNewWindow?: boolean;
228
- }
229
- /**
230
- * 创建临时链接下载选项
231
- */
232
- export interface CreateDownloadLinkOptions {
233
- /** 文件名 */
234
- filename?: string;
235
- /** 链接地址 */
236
- href: string;
237
- /** 是否在新窗口打开 */
238
- target?: string;
239
- /** 下载完成后是否自动清理 URL(仅用于 Blob URL) */
240
- revokeUrl?: boolean;
241
- }
242
- /**
243
- * 创建临时链接并触发下载
244
- * @param options 下载链接配置选项
245
- * @returns void
246
- */
247
- export declare function createDownloadLink(options: CreateDownloadLinkOptions): void;
248
- /**
249
- * 点击下载文件(支持 Blob 和 URL)
250
- * @param data 要下载的数据,可以是 Blob、File、URL 字符串或数据 URL
251
- * @param options 下载配置选项
252
- * @returns Promise<void>
253
- */
254
- export declare function downloadFile(data: Blob | File | string, options?: DownloadOptions): Promise<void>;
255
- /**
256
- * 从 URL 下载文件
257
- * @param url 文件 URL
258
- * @param filename 文件名
259
- * @returns Promise<void>
260
- */
261
- export declare function downloadFileFromUrl(url: string, filename?: string): Promise<void>;
@@ -1,196 +0,0 @@
1
- /**
2
- * 两个数相乘
3
- * @param a 数字a
4
- * @param b 数字b
5
- * @param [fractionDigits] 截取的小数位数
6
- * */
7
- export declare function abMultiply(a: number, b: number, fractionDigits?: number | false): string | number;
8
- /**
9
- * 两个数相除
10
- * @param a 分子
11
- * @param b 分母
12
- * @param percentage 是否为百分比的数值,是则乘以100
13
- * @param fractionDigits 截取的小数位数,默认2,为false时不截取,为true时截取1位
14
- * */
15
- export declare function abDivide(a: number, b: number, percentage?: boolean, fractionDigits?: number | false): string | number;
16
- /**
17
- * 金额转元,需要除以 ÷ 1000
18
- * */
19
- export declare function amountToYuan(price: string | number): number;
20
- /**
21
- * 金额转元,并且格式化(用于展示)。
22
- * @param price 原始金额(厘)
23
- * @param fractionDigits 保留小数的位数,默认2
24
- * */
25
- export declare function formatAmountToYuan(price: number, fractionDigits?: number): string;
26
- /**
27
- * 元转金额,需要乘以 × 1000
28
- * */
29
- export declare function yuanToAmount(price: string | number): number;
30
- /**
31
- * 百分比率转数字(× 100,用于整数值的存储)例如:0.1 -> 100
32
- * */
33
- export declare function rateToNumber(rate: string | number): string | number;
34
- /**
35
- * 数字转百分比率(÷ 100,用于展示),例如:100 -> 0.1
36
- * */
37
- export declare function numberToRate(number: string | number): number;
38
- /**
39
- * 比率转百分比(× 100,用于“新”比率的展示、编辑,默认保留 4 位小数)例如:0.010086 -> 1.0086
40
- * */
41
- export declare function rateToPercentage(rate: string | number, fractionDigits?: number): number;
42
- /**
43
- * 百分比转比率(÷ 100,用于“新”比率的存储)例如:1.0086 -> 0.010086
44
- * */
45
- export declare function percentageToRate(rate: string | number): number;
46
- /**
47
- * 百分比率格式化,(× 100,保留2位小数,加%,用于展示)例如:0.01 -> 1.00%
48
- * */
49
- export declare function formatRate(rate: string | number): string;
50
- /**
51
- * 替换字符串文本的值
52
- * @param content - 原始内容,如果是数字类型则先转为字符串
53
- * @param searchValue - 被替换的内容,可以是正则
54
- * @param replaceValue - 新的内容
55
- */
56
- export declare function replaceText(content: any, searchValue?: string | RegExp, replaceValue?: string): string;
57
- /**
58
- * 转换文件大小
59
- * -- 按单位转换,例如:字节数(bytes) / 1024 返回为 KB
60
- * @param size 原始数值,例如字节
61
- * @param units 单位
62
- * @param fractionDigits 截取位数
63
- * @param emptyValue 默认值
64
- * */
65
- export declare function transformFileSize(size?: number, units?: number, fractionDigits?: number, emptyValue?: string): string;
66
- /**
67
- * 驼峰字符串转换为下划线
68
- * @param {string} str 原始字符串
69
- * @return {string}
70
- * */
71
- export declare function convertToLowerCase(str: string): string;
72
- /**
73
- * 下划线字符串转为换驼峰
74
- * @param {string} str 原始字符串
75
- * @return {string}
76
- * */
77
- export declare function convertToUpperCase(str: string): string;
78
- /**
79
- * 获取某个对象属性的值,支持多级查找
80
- * @param obj 被查找的对象
81
- * @param _keys 要查找的属性名称,列如:1, 'a.b', 'b.0.a', ['a', 'b']
82
- * @param defaultValue 找不属性时的默认值
83
- * @return {any}
84
- * */
85
- export declare function getValue(obj: Record<string, any>, _keys: number | string | string[], defaultValue?: any): any;
86
- /**
87
- * 根据已有的值,查找所有父级的值列表
88
- * @param data 数据列表
89
- * @param value 当前值
90
- * @param key 值的属性名,默认`id`
91
- * @param parentKey 父级的属性名,默认`parentId`
92
- * @return V[] 返回值列表
93
- * */
94
- export declare function getValuesForTree<T extends Record<any, any>, V>(data: T[], value: V, key?: string, parentKey?: string): V[];
95
- /**
96
- * 查找对象列表中对应的某一项的值
97
- * @param list 对象列表
98
- * @param key 匹配的属性名
99
- * @param value 当前值
100
- * @param useKey 读取指定的属性(成功匹配后,直接返回其属性值)
101
- * @return 匹配项的值 或 原始值
102
- * */
103
- export declare function findItemValue<T extends Record<any, any>>(list: T[], key: string, value: any, useKey?: string): any;
104
- /**
105
- * 移除对象列表中的某一项(匹配的属性值)
106
- * @param list 对象列表
107
- * @param key 匹配的属性名
108
- * @param value 当前值
109
- * */
110
- export declare function removeItem<T extends Record<any, any>>(list: T[], key: string, value: any): void;
111
- /**
112
- * 移除列表中的某个值
113
- * @param list 值列表
114
- * @param value 当前值
115
- * */
116
- export declare function removeValue<T>(list: T[], value: T): void;
117
- /**
118
- * 获取静态字典列表中某项的标题
119
- * @param list 数据列表
120
- * @param value 当前值
121
- * @param defaultValue 默认值
122
- * */
123
- export declare function getDictLabel(list: Record<any, any>[], value: any, defaultValue?: string): string;
124
- /**
125
- * 根据属性名查找数组中所有重复项
126
- * @param list 原始数组
127
- * @param props 需要要校验的属性,可以是多个(值的匹配方式为"且")
128
- * @return {[]} 重复项的数组
129
- * */
130
- export declare function findRepeatedItems<T extends Record<string, any>>(list: T[], props: string | string[]): T[];
131
- export declare function parseJsonStr(text: any): any;
132
- export declare function toJsonString(data: any, notEmpty?: boolean): string;
133
- /**
134
- * 修剪字符串类型的数据,清除两端空格
135
- * 如果是 Object,其所有属性 JSON 类型的字符串也会被修剪
136
- * @param {any} data 原始数据
137
- * @return any
138
- * */
139
- export declare function trimDataValues(data: any): any;
140
- export declare function removeEmptyString(value: string): string;
141
- /**
142
- * 针对 GET 请求时,过滤空值的条件
143
- * @param params 原始对象
144
- * @param isTrim 是否需要剔除`字符串类型的值`两端的空格
145
- * */
146
- export declare function removeEmptyProps(params: any, isTrim?: boolean): any;
147
- /**
148
- * 数字四舍五入
149
- * @param number 原始数值
150
- * @param precision 精度,默认0
151
- * */
152
- export declare function round(number: number, precision?: number): number;
153
- /**
154
- * 截取浮点数字的小数
155
- * @param number 原始数值
156
- * @param fractionDigits 截取的位数,默认2(普通的四舍五入)
157
- * */
158
- export declare function toFixed(number: number, fractionDigits?: number): string;
159
- /**
160
- * 数字格式化
161
- * 例如:888888.88 -> 888,888.88
162
- * @param value 数值
163
- * @param p 分隔开的位数,默认3
164
- * */
165
- export declare function formatNumber(value: number | string, p?: number): string;
166
- /**
167
- * 拆分字符串为数组
168
- * @param str 原始字符串
169
- * @param separator 分隔符
170
- * */
171
- export declare function splitString(str: string, separator: string | RegExp): string[];
172
- /**
173
- * 拆分字符串形式的数据为数组
174
- * @param str 原始字符串
175
- * */
176
- export declare function splitStringData(str: string): string[];
177
- /**
178
- * 补充24个小时段的数据
179
- * @param hoursData 已存在的小时段数据
180
- * @param padData 填充的数据
181
- * @param needPadAfter 是否需要补充当前小时段之后的数据(例如:今日数据的当前时段)
182
- * */
183
- export declare function paddingHoursData<T extends Record<any, any>>(hoursData: T[], padData: T, needPadAfter?: boolean): T[];
184
- export declare function getNumberValue(value: any, defaultValue?: number): number | undefined;
185
- /**
186
- * 格式化字符串列表
187
- * @param str 原始字符串
188
- * @description 将中文逗号转为英文逗号,空格转为英文逗号,过滤空值,最后用英文逗号连接
189
- */
190
- export declare function formatStringList(str: string): string;
191
- /**
192
- * 格式化金额显示
193
- * @param value 金额值
194
- * @param defaultValue 默认值
195
- */
196
- export declare function formatAmount(value: number | string, defaultValue?: string): string;
@@ -1,157 +0,0 @@
1
- import { Dayjs } from 'dayjs';
2
- export type DateParam = number | string | Date | null;
3
- export type DateInput = number | string | Date | Dayjs | null | undefined;
4
- /**
5
- * 路由查询参数类型
6
- */
7
- export interface LocationQuery {
8
- startDate?: string | string[];
9
- endDate?: string | string[];
10
- [key: string]: string | string[] | undefined;
11
- }
12
- /**
13
- * 请求参数类型
14
- */
15
- export interface RequestParams {
16
- rptDtBegin?: string;
17
- rptDtEnd?: string;
18
- [key: string]: any;
19
- }
20
- /**
21
- * 日期快捷选项类型
22
- */
23
- export interface DatePickerShortcut {
24
- text: string;
25
- value: () => [string, string];
26
- }
27
- /**
28
- * 创建一个日期对象
29
- * @param time 可用的日期参数
30
- * @returns Date 对象
31
- */
32
- export declare function newDate(time: DateParam): Date;
33
- /**
34
- * 获取当前页面的默认`范围日期`
35
- * - 首先,尝试读取路由中的参数
36
- * - 其次,创建当前日期
37
- * @param query 路由 query 对象。为 null 时表示使用当前时间
38
- * @param fmt 自定义格式。传入字符串格式时作用于开始和结束、数组时对应开始和结束、固定格式类型(例如需要查询 `daily`每日 或 `hour`小时 的数据)
39
- * @returns 日期范围数组 [开始日期, 结束日期]
40
- */
41
- export declare function getDefaultDates(query: LocationQuery | null, fmt?: 'daily' | 'hour' | string | string[]): string[];
42
- /**
43
- * 设置接口请求的范围日期
44
- * - 为结束日期增加 1个月 或 1天 或 1小时
45
- * @param params 请求参数的对象
46
- * @param type 增加的类型
47
- * @param fmt 处理后的日期格式
48
- * @returns 处理后的请求参数对象
49
- */
50
- export declare function setRequestDates(params: RequestParams, type: 'month' | 'daily' | 'hour', fmt?: string): RequestParams;
51
- /**
52
- * 判断两个日期是否为同一天
53
- * @param start 开始日期
54
- * @param end 结束日期
55
- * @returns boolean
56
- */
57
- export declare function isSameDate(start: DateParam, end: DateParam): boolean;
58
- /**
59
- * 获取两个日期的间隔时间(天数)
60
- * @param start 开始日期
61
- * @param end 结束日期
62
- * @returns 间隔天数
63
- */
64
- export declare function getRangeDays(start: DateParam, end: DateParam): number;
65
- /**
66
- * 格式化日期为 YYYY-MM-DD 格式
67
- * @param time 可用的日期
68
- * @returns 格式化后的日期字符串
69
- */
70
- export declare function formatDateToYMD(time?: DateParam): string;
71
- /**
72
- * 格式化日期为 YYYY-MM 格式
73
- * @param time 可用的日期
74
- * @returns 格式化后的日期字符串
75
- */
76
- export declare function formatDateToYM(time?: DateParam): string;
77
- /**
78
- * 格式化日期
79
- * @param time 可用的日期
80
- * @param fmt 格式,默认 YYYY-MM-DD HH:mm:ss
81
- * @param padZero 是否`月日时分秒`小于10时填充0,默认填充(可传入字符串指定)。例如 06-01 09:02
82
- * @returns 格式化后的日期字符串
83
- */
84
- export declare function formatDate(time: DateParam, fmt?: string, padZero?: string | boolean): string;
85
- /**
86
- * 设置某个日期的月份
87
- * @param time 可用的日期
88
- * @param months 需要增加的月数,默认0(支持负数,例如:上个月`-1`)
89
- * @param fmt 格式,请查看 formatDate()
90
- * @param dayValue 从 1 到 31 之间的整数,月份中的第几天(JavaScript 1.3 版本之前),默认 1
91
- * @returns 格式化后的日期字符串
92
- */
93
- export declare function setMonths(time: DateParam, months?: number, fmt?: string, dayValue?: number): string;
94
- /**
95
- * 为某个日期增加 n 天
96
- * @param time 可用的日期
97
- * @param days 需要增加的天数,默认1
98
- * @param fmt 格式,请查看 formatDate()
99
- * @returns 格式化后的日期字符串或 Date 对象
100
- */
101
- export declare function addDays(time: DateParam, days?: number, fmt?: string): string | Date;
102
- /**
103
- * 为某个日期增加 n 小时 -- 适用于精确到小时的范围日期
104
- * @param time 可用的日期
105
- * @param hours 需要增加的小时,默认1
106
- * @param fmt 格式,请查看 formatDate()
107
- * @returns 格式化后的日期字符串或 Date 对象
108
- */
109
- export declare function addHours(time: DateParam, hours?: number, fmt?: string): string | Date;
110
- /**
111
- * 为某个日期增加秒数
112
- * @param time 可用的日期
113
- * @param seconds 需要增加的秒数
114
- * @param fmt 格式,请查看 formatDate()
115
- * @returns 格式化后的日期字符串或 Date 对象
116
- */
117
- export declare function addSeconds(time: DateParam, seconds: number, fmt?: string): string | Date;
118
- /**
119
- * 获取范围日期的快捷选取的配置
120
- * @param configs 快捷选项配置数组,每个元素为 [天数, 文本] 的元组
121
- * @returns 日期快捷选项数组
122
- */
123
- export declare function getPickerShortcuts(configs?: [number, string][]): DatePickerShortcut[];
124
- /**
125
- * 校验两个日期的天数是否超出范围(默认最大 93 天)
126
- * @param begin 开始日期
127
- * @param end 结束日期
128
- * @param maxDays 最大天数,默认 93
129
- * @returns 错误信息字符串,如果未超出范围则返回 undefined
130
- */
131
- export declare function validateDatesRange(begin: string, end: string, maxDays?: number): string | undefined;
132
- /**
133
- * 判断是否为 10 位数字的秒级 unix 时间戳
134
- * @param v 日期输入
135
- * @returns boolean
136
- */
137
- export declare function isUnix(v: DateInput): boolean;
138
- /**
139
- * 将任意输入标准化为 Dayjs 对象
140
- * @param v 日期输入
141
- * @returns Dayjs 对象
142
- */
143
- export declare const standardTime: (v: DateInput) => Dayjs;
144
- /**
145
- * 格式化时间,默认 'YYYY-MM-DD HH:mm:ss'
146
- * 返回 undefined/null 时原样返回
147
- * @param v 日期输入
148
- * @param format 日期格式,默认 'YYYY-MM-DD HH:mm:ss'
149
- * @returns 格式化后的日期字符串,或 undefined/null
150
- */
151
- export declare const formatTime: (v: DateInput, format?: string) => string | undefined | null;
152
- /**
153
- * 转为 unix 时间戳(秒)
154
- * @param date 日期输入
155
- * @returns Unix 时间戳(秒)
156
- */
157
- export declare function toUnix(date: DateInput): number;
@@ -1,6 +0,0 @@
1
- export * from './md5.utils';
2
- export * from './data.utils';
3
- export * from './validate.utils';
4
- export * from './base.utils';
5
- export * from './tree.utils';
6
- export * from './date.utils';
@@ -1,2 +0,0 @@
1
- export declare function createJsonMd5(json?: {}): string | null;
2
- export declare function createMd5(content?: string): string;