@a2simcode/ui 0.0.36 → 0.0.38
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/core/index.d.ts +1 -0
- package/dist/core/utils/cipher.d.ts +21 -0
- package/dist/core/utils/common.d.ts +72 -0
- package/dist/core/utils/comp.d.ts +27 -0
- package/dist/core/utils/date.d.ts +3 -0
- package/dist/core/utils/dom.d.ts +4 -0
- package/dist/core/utils/eventBus.d.ts +39 -0
- package/dist/core/utils/index.d.ts +10 -0
- package/dist/core/utils/is.d.ts +4 -0
- package/dist/core/utils/map.d.ts +1 -0
- package/dist/core/utils/tree.d.ts +11 -0
- package/dist/core/utils/useSortable.d.ts +5 -0
- package/dist/index.d.ts +1 -3
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './utils';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface Encryption {
|
|
2
|
+
encrypt(plainText: string): string;
|
|
3
|
+
decrypt(cipherText: string): string;
|
|
4
|
+
}
|
|
5
|
+
export interface Hashing {
|
|
6
|
+
hash(data: string): string;
|
|
7
|
+
}
|
|
8
|
+
export interface EncryptionParams {
|
|
9
|
+
key: string;
|
|
10
|
+
iv?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare class EncryptionFactory {
|
|
13
|
+
static createAesEncryption(params: EncryptionParams): Encryption;
|
|
14
|
+
static createBase64Encryption(): Encryption;
|
|
15
|
+
}
|
|
16
|
+
export declare class HashingFactory {
|
|
17
|
+
static createMD5Hashing(): Hashing;
|
|
18
|
+
static createSHA256Hashing(): Hashing;
|
|
19
|
+
static createSHA512Hashing(): Hashing;
|
|
20
|
+
}
|
|
21
|
+
export declare const myAesDecrypt: (cipherText: string, key: string) => string;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 清空对象
|
|
3
|
+
* @param data 清空对象
|
|
4
|
+
*/
|
|
5
|
+
export declare function clearJson(data: Record<string, any>): void;
|
|
6
|
+
/**
|
|
7
|
+
* 获取对象类型
|
|
8
|
+
*/
|
|
9
|
+
export declare function getObjType(obj: any): any;
|
|
10
|
+
/**
|
|
11
|
+
* 对象深拷贝
|
|
12
|
+
*/
|
|
13
|
+
export declare function deepClone(data: any): any;
|
|
14
|
+
/**
|
|
15
|
+
* 对象拷贝
|
|
16
|
+
*/
|
|
17
|
+
export declare function clone(res: Record<string, any>, data: Record<string, any>, notKeys?: string[]): void;
|
|
18
|
+
export declare const buildUUID: () => string;
|
|
19
|
+
export declare function buildShortUUID(prefix?: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* 将字符串转换为函数
|
|
22
|
+
* @param {string} fun - 函数字符串
|
|
23
|
+
* @returns {object} - 返回包含结果状态和函数的对象
|
|
24
|
+
*/
|
|
25
|
+
export declare const getFunction: (fun: string) => {
|
|
26
|
+
res: boolean;
|
|
27
|
+
msg: string;
|
|
28
|
+
fn: any;
|
|
29
|
+
} | {
|
|
30
|
+
res: boolean;
|
|
31
|
+
msg: unknown;
|
|
32
|
+
fn?: undefined;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* 通过路径设置对象属性值
|
|
36
|
+
* @param obj 目标对象
|
|
37
|
+
* @param path 属性路径,支持 'a.b.c' 或 'a[0].b' 或 ['a', 'b', 'c'] 格式
|
|
38
|
+
* @param value 要设置的值
|
|
39
|
+
* @returns 返回对象本身
|
|
40
|
+
*/
|
|
41
|
+
export declare function set(obj: any, path: string | string[], value: any): any;
|
|
42
|
+
export declare const toDecimal: (x: any) => number;
|
|
43
|
+
/**
|
|
44
|
+
* 分页方法
|
|
45
|
+
* @param pageNo
|
|
46
|
+
* @param pageSize
|
|
47
|
+
* @param array
|
|
48
|
+
* @returns
|
|
49
|
+
*/
|
|
50
|
+
export declare const pagination: (pageNo: number, pageSize: number, array: any[]) => any[];
|
|
51
|
+
export declare const paginationEx: (params: Record<string, any>, array: any[]) => {
|
|
52
|
+
rows: any[];
|
|
53
|
+
total: number;
|
|
54
|
+
page: any;
|
|
55
|
+
records: number;
|
|
56
|
+
};
|
|
57
|
+
export declare const uniqueArray: (arr: any[]) => any[];
|
|
58
|
+
export declare const numberToChinese: (num: string) => string;
|
|
59
|
+
export declare const numberToThousandSeparator: (num: string) => string;
|
|
60
|
+
/**
|
|
61
|
+
* 用来获取文字宽度
|
|
62
|
+
* @param text
|
|
63
|
+
* @returns
|
|
64
|
+
*/
|
|
65
|
+
export declare const getTextWidth: (text: string) => number | undefined;
|
|
66
|
+
export declare function upFirst(str: string): string;
|
|
67
|
+
export declare function lowerFirst(str: string, isFlag?: boolean): string;
|
|
68
|
+
/**
|
|
69
|
+
* Object.assign polyfill/wrapper
|
|
70
|
+
* Merges properties from source objects into target object
|
|
71
|
+
*/
|
|
72
|
+
export declare function assign(target: object | null, ...sources: any[]): any;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const getIsInputComp: (type: string) => boolean;
|
|
2
|
+
export declare const getIsTableInputComp: (type: string) => boolean;
|
|
3
|
+
export declare const getCompConfig: (data: {
|
|
4
|
+
config?: Record<string, any>;
|
|
5
|
+
getCompConfig?: any;
|
|
6
|
+
formData: Record<string, any>;
|
|
7
|
+
getTableData?: () => Record<string, any>[];
|
|
8
|
+
row?: Record<string, any>;
|
|
9
|
+
pRowData?: Record<string, any>;
|
|
10
|
+
}) => any;
|
|
11
|
+
export declare const getCompType: (data: {
|
|
12
|
+
type: string;
|
|
13
|
+
getCompType?: any;
|
|
14
|
+
config?: Record<string, any>;
|
|
15
|
+
formData: Record<string, any>;
|
|
16
|
+
getTableData?: () => Record<string, any>[];
|
|
17
|
+
row?: Record<string, any>;
|
|
18
|
+
}) => any;
|
|
19
|
+
export declare const getLabel: (value: any, getLabelFromApp: any, data: {
|
|
20
|
+
type: string;
|
|
21
|
+
getCompType?: any;
|
|
22
|
+
getCompConfig?: any;
|
|
23
|
+
config?: Record<string, any>;
|
|
24
|
+
formData: Record<string, any>;
|
|
25
|
+
getTableData?: () => Record<string, any>[];
|
|
26
|
+
row?: Record<string, any>;
|
|
27
|
+
}) => any;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 简单的事件总线实现
|
|
3
|
+
* 用于组件间通信
|
|
4
|
+
*/
|
|
5
|
+
type EventHandler = (...args: any[]) => any;
|
|
6
|
+
declare class EventBus {
|
|
7
|
+
private events;
|
|
8
|
+
/**
|
|
9
|
+
* 监听事件
|
|
10
|
+
* @param event 事件名称
|
|
11
|
+
* @param handler 事件处理函数
|
|
12
|
+
*/
|
|
13
|
+
on(event: string, handler: EventHandler): void;
|
|
14
|
+
/**
|
|
15
|
+
* 监听一次性事件
|
|
16
|
+
* @param event 事件名称
|
|
17
|
+
* @param handler 事件处理函数
|
|
18
|
+
*/
|
|
19
|
+
once(event: string, handler: EventHandler): void;
|
|
20
|
+
/**
|
|
21
|
+
* 触发事件
|
|
22
|
+
* @param event 事件名称
|
|
23
|
+
* @param args 事件参数
|
|
24
|
+
* @returns 事件处理函数的返回结果
|
|
25
|
+
*/
|
|
26
|
+
emit(event: string, ...args: any[]): any;
|
|
27
|
+
/**
|
|
28
|
+
* 移除事件监听
|
|
29
|
+
* @param event 事件名称
|
|
30
|
+
* @param handler 事件处理函数(可选,不传则移除该事件所有监听)
|
|
31
|
+
*/
|
|
32
|
+
off(event: string, handler?: EventHandler): void;
|
|
33
|
+
/**
|
|
34
|
+
* 清除所有事件监听
|
|
35
|
+
*/
|
|
36
|
+
clear(): void;
|
|
37
|
+
}
|
|
38
|
+
export declare const eventBus: EventBus;
|
|
39
|
+
export { EventBus };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './is';
|
|
2
|
+
export * from './common';
|
|
3
|
+
export * from './comp';
|
|
4
|
+
export * from './date';
|
|
5
|
+
export * from './dom';
|
|
6
|
+
export * from './cipher';
|
|
7
|
+
export * from './tree';
|
|
8
|
+
export * from './useSortable';
|
|
9
|
+
export * from './map';
|
|
10
|
+
export * from './eventBus';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const loadBMap: (ak: string) => Promise<unknown>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*将数组数据转化成树形数据
|
|
3
|
+
*/
|
|
4
|
+
export declare function setGroupMap(data: any[], idKey: string, pidKey: string): {
|
|
5
|
+
group: Record<string, any>;
|
|
6
|
+
map: Record<string, any>;
|
|
7
|
+
};
|
|
8
|
+
export declare function toTree(data: any[], _idKey?: string, pidKey?: string, valueKey?: string, labelKey?: string, filterIds?: any): any[];
|
|
9
|
+
export declare const toArray: (data: any[], filterIds?: string[]) => any[];
|
|
10
|
+
export declare const toSimpleTree: (data: any[], valueKey?: string, labelKey?: string) => any[];
|
|
11
|
+
export declare const toLeafArray: (data: any[], getLabel: (item: any) => string, filterIds?: string[]) => any[];
|
package/dist/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@a2simcode/ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.38",
|
|
4
4
|
"description": "A Vue 3 UI Component Library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/simcode-ui.umd.js",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
],
|
|
20
20
|
"scripts": {
|
|
21
21
|
"dev": "pnpm docs:dev",
|
|
22
|
-
"build": "vite build",
|
|
22
|
+
"build": "vite build && tsx scripts/fix-index-dts.ts",
|
|
23
23
|
"ui:publish": "pnpm build && npm publish --access public",
|
|
24
24
|
"test": "vitest",
|
|
25
25
|
"test:ui": "vitest --ui",
|