@utogether/utils 1.15.13 → 1.15.14
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/types/cookie.d.ts +28 -0
- package/dist/types/device.d.ts +7 -0
- package/dist/types/element.d.ts +9 -0
- package/dist/types/formatData.d.ts +26 -0
- package/dist/types/http/index.d.ts +28 -0
- package/dist/types/http/types.d.ts +53 -0
- package/dist/types/message.d.ts +5 -0
- package/dist/types/progress.d.ts +2 -0
- package/dist/types/render.d.ts +5 -0
- package/dist/types/resize.d.ts +2 -0
- package/dist/types/storage.d.ts +20 -0
- package/dist/types/useGlobal.d.ts +15 -0
- package/dist/types/useRender.d.ts +162 -0
- package/dist/types/useTree.d.ts +24 -0
- package/dist/types/useWatermark.d.ts +10 -0
- package/dist/types/uuid.d.ts +6 -0
- package/package.json +3 -2
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
declare class Cookies {
|
|
2
|
+
constructor();
|
|
3
|
+
/**
|
|
4
|
+
* 存储 cookie 值
|
|
5
|
+
* @param name
|
|
6
|
+
* @param value
|
|
7
|
+
* @param cookieSetting
|
|
8
|
+
*/
|
|
9
|
+
set(name?: string, value?: string): void;
|
|
10
|
+
/**
|
|
11
|
+
* 拿到 cookie 值
|
|
12
|
+
* @param name
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
get(name?: string): string | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* 拿到 cookie 全部的值
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
getAll(): string | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* 删除 cookie
|
|
23
|
+
* @param name
|
|
24
|
+
*/
|
|
25
|
+
remove(name?: string): void;
|
|
26
|
+
}
|
|
27
|
+
export declare const cookies: Cookies;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare type FunctionArgs<Args extends any[] = any[], Return = void> = (...args: Args) => Return;
|
|
2
|
+
declare type RefType<T> = T | null;
|
|
3
|
+
export declare const hasClass: (ele: RefType<any>, cls: string) => any;
|
|
4
|
+
export declare const addClass: (ele: RefType<any>, cls: string, extracls?: string) => any;
|
|
5
|
+
export declare const removeClass: (ele: RefType<any>, cls: string, extracls?: string) => any;
|
|
6
|
+
export declare const toggleClass: (flag: boolean, clsName: string, target?: RefType<any>) => any;
|
|
7
|
+
export declare function useRafThrottle<T extends FunctionArgs>(fn: T): T;
|
|
8
|
+
export declare const openLink: <T>(link: T) => void;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description: col数据国际化
|
|
3
|
+
* @param {*} columns col
|
|
4
|
+
* @return {*} 标准化后的col
|
|
5
|
+
*/
|
|
6
|
+
export declare const i18nColums: (columns: any) => any;
|
|
7
|
+
/**
|
|
8
|
+
* @description: form item数据标准化
|
|
9
|
+
* @param {*} items item
|
|
10
|
+
* @param {*} status 状态
|
|
11
|
+
* @return {*} form item数据标准化后的数据
|
|
12
|
+
*/
|
|
13
|
+
export declare const formatItems: (items: any, status: any, span?: number) => any;
|
|
14
|
+
/**
|
|
15
|
+
* @description: grid 查询item格式化
|
|
16
|
+
* @param {*} array items
|
|
17
|
+
* @return {*} items
|
|
18
|
+
*/
|
|
19
|
+
export declare const formatGridItems: (array: any) => any;
|
|
20
|
+
/**
|
|
21
|
+
* @description: 标准化必填数据
|
|
22
|
+
* @param {*} records 数据列表
|
|
23
|
+
* @param {*} t i18n对象
|
|
24
|
+
* @return {*} rule数据
|
|
25
|
+
*/
|
|
26
|
+
export declare const formatRules: (records: any, t: any) => {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { AxiosRequestConfig } from "axios";
|
|
2
|
+
import { RequestMethods, SuHttpRequestConfig } from "./types.d";
|
|
3
|
+
declare class SuHttp {
|
|
4
|
+
constructor();
|
|
5
|
+
router: undefined;
|
|
6
|
+
baseUrl: null;
|
|
7
|
+
setRouter(router: any): void;
|
|
8
|
+
setBaseUrl(baseUrl: any): void;
|
|
9
|
+
private static initConfig;
|
|
10
|
+
private static axiosInstance;
|
|
11
|
+
private httpInterceptorsRequest;
|
|
12
|
+
/**
|
|
13
|
+
* @description: 缓存新的token
|
|
14
|
+
* @param {*} token token 信息
|
|
15
|
+
* @return {*}
|
|
16
|
+
*/
|
|
17
|
+
private setToken;
|
|
18
|
+
private httpInterceptorsResponse;
|
|
19
|
+
private transformConfigByMethod;
|
|
20
|
+
request<T>(method: RequestMethods, url: string, param?: AxiosRequestConfig, axiosConfig?: SuHttpRequestConfig): Promise<T>;
|
|
21
|
+
post<T, P>(url: string, params?: any, config?: SuHttpRequestConfig): Promise<P>;
|
|
22
|
+
delete<T, P>(url: string, params?: any, config?: SuHttpRequestConfig): Promise<P>;
|
|
23
|
+
put<T, P>(url: string, params?: any, config?: SuHttpRequestConfig): Promise<P>;
|
|
24
|
+
get<T, P>(url: string, params?: any, config?: SuHttpRequestConfig): Promise<P>;
|
|
25
|
+
postRouter<T>(params?: any): Promise<T>;
|
|
26
|
+
}
|
|
27
|
+
export declare const http: SuHttp;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: wei.li
|
|
3
|
+
* @Date: 2022-03-08 15:17:39
|
|
4
|
+
* @LastEditors: wei.li
|
|
5
|
+
* @LastEditTime: 2022-10-21 09:56:55
|
|
6
|
+
* @Description: SuHttp Axios 类型定义文件
|
|
7
|
+
*/
|
|
8
|
+
import Axios, {
|
|
9
|
+
Method,
|
|
10
|
+
AxiosError,
|
|
11
|
+
AxiosResponse,
|
|
12
|
+
AxiosRequestConfig,
|
|
13
|
+
} from "axios";
|
|
14
|
+
|
|
15
|
+
export type resultType = {
|
|
16
|
+
access_Token: string;
|
|
17
|
+
refresh_token: string;
|
|
18
|
+
expires_in: number;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type RequestMethods = Extract<
|
|
22
|
+
Method,
|
|
23
|
+
"get" | "post" | "put" | "delete" | "patch" | "option" | "head"
|
|
24
|
+
>;
|
|
25
|
+
|
|
26
|
+
export interface SuHttpError extends AxiosError {
|
|
27
|
+
isCancelRequest?: boolean;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface SuHttpResponse extends AxiosResponse {
|
|
31
|
+
config: SuHttpRequestConfig;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface SuHttpRequestConfig extends AxiosRequestConfig {
|
|
35
|
+
beforeRequestCallback?: (request: SuHttpRequestConfig) => void;
|
|
36
|
+
beforeResponseCallback?: (response: SuHttpResponse) => void;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export default class SuHttp {
|
|
40
|
+
request<T>(
|
|
41
|
+
method: RequestMethods,
|
|
42
|
+
url: string,
|
|
43
|
+
param?: AxiosRequestConfig,
|
|
44
|
+
axiosConfig?: SuHttpRequestConfig
|
|
45
|
+
): Promise<T>;
|
|
46
|
+
post<T, P>(url: string, params?: T, config?: SuHttpRequestConfig): Promise<P>;
|
|
47
|
+
postRouter<T, P>(
|
|
48
|
+
url: string,
|
|
49
|
+
params?: T,
|
|
50
|
+
config?: SuHttpRequestConfig
|
|
51
|
+
): Promise<P>;
|
|
52
|
+
get<T, P>(url: string, params?: T, config?: SuHttpRequestConfig): Promise<P>;
|
|
53
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
declare const showMessage: (content: string, status: any, iconStatus: string) => any;
|
|
2
|
+
declare const successMessage: (content: string) => any;
|
|
3
|
+
declare const warnMessage: (content: string) => any;
|
|
4
|
+
export declare const errorMessage: (content: any) => Promise<import("vxe-table").ModalEventTypes>;
|
|
5
|
+
export { showMessage, successMessage, warnMessage };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
interface ProxyStorage {
|
|
2
|
+
getItem(key: string): any;
|
|
3
|
+
setItem(Key: string, value: string): void;
|
|
4
|
+
removeItem(key: string): void;
|
|
5
|
+
clear(): void;
|
|
6
|
+
}
|
|
7
|
+
declare class sessionStorageProxy implements ProxyStorage {
|
|
8
|
+
protected storage: ProxyStorage;
|
|
9
|
+
constructor(storageModel: ProxyStorage);
|
|
10
|
+
setItem(key: string, value: any): void;
|
|
11
|
+
getItem(key: string): any;
|
|
12
|
+
removeItem(key: string): void;
|
|
13
|
+
clear(): void;
|
|
14
|
+
}
|
|
15
|
+
declare class localStorageProxy extends sessionStorageProxy implements ProxyStorage {
|
|
16
|
+
constructor(localStorage: ProxyStorage);
|
|
17
|
+
}
|
|
18
|
+
export declare const storageSession: sessionStorageProxy;
|
|
19
|
+
export declare const storageLocal: localStorageProxy;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const useGlobal: () => {
|
|
2
|
+
$global: {};
|
|
3
|
+
$storage: {};
|
|
4
|
+
$config: {};
|
|
5
|
+
$serviceApi?: undefined;
|
|
6
|
+
$hasAuthority?: undefined;
|
|
7
|
+
$printPlugin?: undefined;
|
|
8
|
+
} | {
|
|
9
|
+
$global: Record<string, any>;
|
|
10
|
+
$storage: any;
|
|
11
|
+
$config: any;
|
|
12
|
+
$serviceApi: any;
|
|
13
|
+
$hasAuthority: any;
|
|
14
|
+
$printPlugin: any;
|
|
15
|
+
};
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
interface IAttrs {
|
|
2
|
+
disabled?: boolean;
|
|
3
|
+
defaultValue?: string;
|
|
4
|
+
code?: undefined;
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
}
|
|
7
|
+
export declare const useRender: (cb?: any) => {
|
|
8
|
+
renderDict: (attrs: IAttrs | string, methods?: any) => {
|
|
9
|
+
name: string;
|
|
10
|
+
optionProps: {
|
|
11
|
+
value: string;
|
|
12
|
+
label: string;
|
|
13
|
+
};
|
|
14
|
+
options: any;
|
|
15
|
+
props: {
|
|
16
|
+
clearable: boolean;
|
|
17
|
+
disabled: boolean;
|
|
18
|
+
};
|
|
19
|
+
defaultValue: any;
|
|
20
|
+
events: any;
|
|
21
|
+
};
|
|
22
|
+
renderSelect: (attrs: any, callBack?: any) => {
|
|
23
|
+
name: string;
|
|
24
|
+
optionProps: any;
|
|
25
|
+
props: any;
|
|
26
|
+
options: any;
|
|
27
|
+
events: {
|
|
28
|
+
change: (e: any, v: any, i: any, field: any) => any;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
renderInput: (attrs?: any, methods?: any) => {
|
|
32
|
+
name: string;
|
|
33
|
+
props: any;
|
|
34
|
+
defaultValue: any;
|
|
35
|
+
events: any;
|
|
36
|
+
};
|
|
37
|
+
renderTextarea: (attrs?: any, methods?: any) => {
|
|
38
|
+
name: string;
|
|
39
|
+
props: any;
|
|
40
|
+
defaultValue: any;
|
|
41
|
+
events: any;
|
|
42
|
+
};
|
|
43
|
+
renderCheckBox: (attrs: any, methods: any) => {
|
|
44
|
+
name: string;
|
|
45
|
+
defaultValue: any;
|
|
46
|
+
options: any;
|
|
47
|
+
props: {
|
|
48
|
+
disabled: boolean;
|
|
49
|
+
};
|
|
50
|
+
events: any;
|
|
51
|
+
};
|
|
52
|
+
renderRadio: (attrs: string | IAttrs, methods: any) => {
|
|
53
|
+
name: string;
|
|
54
|
+
defaultValue: any;
|
|
55
|
+
options: any;
|
|
56
|
+
props: {
|
|
57
|
+
disabled: boolean;
|
|
58
|
+
};
|
|
59
|
+
events: any;
|
|
60
|
+
};
|
|
61
|
+
renderUser: (attr?: any, callback?: any) => {
|
|
62
|
+
name: string;
|
|
63
|
+
optionProps: any;
|
|
64
|
+
props: any;
|
|
65
|
+
options: any;
|
|
66
|
+
events: {
|
|
67
|
+
change: (e: any, v: any, i: any, field: any) => any;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
renderSysUser: (opt?: any) => {
|
|
71
|
+
name: string;
|
|
72
|
+
optionProps: any;
|
|
73
|
+
props: any;
|
|
74
|
+
options: any;
|
|
75
|
+
events: {
|
|
76
|
+
change: (e: any, v: any, i: any, field: any) => any;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
renderInvOrg: (attrs?: any, methods?: any) => {
|
|
80
|
+
name: string;
|
|
81
|
+
props: {
|
|
82
|
+
fieldMap: {};
|
|
83
|
+
extParam: any;
|
|
84
|
+
url: string;
|
|
85
|
+
fetchField: string;
|
|
86
|
+
};
|
|
87
|
+
optionProps: {
|
|
88
|
+
label: string;
|
|
89
|
+
value: any;
|
|
90
|
+
};
|
|
91
|
+
options: never[];
|
|
92
|
+
methods: any;
|
|
93
|
+
};
|
|
94
|
+
renderBU: (attrs?: any, methods?: any) => {
|
|
95
|
+
name: string;
|
|
96
|
+
props: {
|
|
97
|
+
fieldMap: {};
|
|
98
|
+
extParam: any;
|
|
99
|
+
url: string;
|
|
100
|
+
fetchField: string;
|
|
101
|
+
};
|
|
102
|
+
optionProps: {
|
|
103
|
+
label: string;
|
|
104
|
+
value: any;
|
|
105
|
+
};
|
|
106
|
+
options: never[];
|
|
107
|
+
methods: any;
|
|
108
|
+
};
|
|
109
|
+
renderNumber: (attrs?: any, methods?: any) => {
|
|
110
|
+
name: string;
|
|
111
|
+
props: any;
|
|
112
|
+
events: any;
|
|
113
|
+
};
|
|
114
|
+
renderLov: (attrs: any, methods?: any) => {
|
|
115
|
+
name: string;
|
|
116
|
+
props: any;
|
|
117
|
+
events: any;
|
|
118
|
+
};
|
|
119
|
+
renderSelectLocal: (attrs: any, methods?: any) => {
|
|
120
|
+
name: string;
|
|
121
|
+
optionProps: any;
|
|
122
|
+
options: any;
|
|
123
|
+
props: any;
|
|
124
|
+
events: any;
|
|
125
|
+
};
|
|
126
|
+
renderDate: (attrs?: any, methods?: any) => {
|
|
127
|
+
name: string;
|
|
128
|
+
props: any;
|
|
129
|
+
defaultValue: any;
|
|
130
|
+
events: any;
|
|
131
|
+
};
|
|
132
|
+
renderSwitch: (attrs?: IAttrs, methods?: any) => {
|
|
133
|
+
name: string;
|
|
134
|
+
props: {
|
|
135
|
+
openLabel: string;
|
|
136
|
+
closeLabel: string;
|
|
137
|
+
openValue: string;
|
|
138
|
+
closeValue: string;
|
|
139
|
+
};
|
|
140
|
+
defaultValue: string;
|
|
141
|
+
events: any;
|
|
142
|
+
};
|
|
143
|
+
renderCellTag: (code: any, tagMap: any) => {
|
|
144
|
+
name: string;
|
|
145
|
+
props: {
|
|
146
|
+
code: any;
|
|
147
|
+
tagMap: any;
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
renderEnabled: (methods?: any) => {
|
|
151
|
+
name: string;
|
|
152
|
+
props: {
|
|
153
|
+
openLabel: string;
|
|
154
|
+
closeLabel: string;
|
|
155
|
+
openValue: string;
|
|
156
|
+
closeValue: string;
|
|
157
|
+
};
|
|
158
|
+
defaultValue: string;
|
|
159
|
+
events: any;
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare function extractPathList(menuTree: any): any;
|
|
2
|
+
/**
|
|
3
|
+
* 如果父级下children的length为1,删除children并自动组建唯一uniqueId
|
|
4
|
+
* @param {Array} {menuTree 菜单树}
|
|
5
|
+
* @param {Array} {pathList 每一项的id组成的数组}
|
|
6
|
+
* @param {return}}
|
|
7
|
+
*/
|
|
8
|
+
export declare function deleteTreeChildren(menuTree: any, pathList?: never[]): any[] | undefined;
|
|
9
|
+
export declare function buildHierarchyTree(menuTree: any, pathList?: never[]): any[] | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* 广度优先遍历算法,找当前节点
|
|
12
|
+
* @param {Array} tree 原始树,数组
|
|
13
|
+
* @param {Number|String} uniqueId 唯一uniqueId
|
|
14
|
+
* @return {Object} node
|
|
15
|
+
*/
|
|
16
|
+
export declare function getNodeByUniqueId(menuTree: any, uniqueId: any): any;
|
|
17
|
+
/**
|
|
18
|
+
* 向当前唯一uniqueId节点追加字段
|
|
19
|
+
* @param {Array} {menuTree 菜单树}
|
|
20
|
+
* @param {Number|String} uniqueId 唯一uniqueId
|
|
21
|
+
* @param {Object} fields 唯一uniqueId
|
|
22
|
+
* @return {menuTree} 追加字段后的树
|
|
23
|
+
*/
|
|
24
|
+
export declare function appendFieldByUniqueId(menuTree: Array<any>, uniqueId: Number | String, fields: Object): {} | undefined;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Ref } from "vue";
|
|
2
|
+
declare type attr = {
|
|
3
|
+
font?: string;
|
|
4
|
+
fillStyle?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function useWatermark(appendEl?: Ref<HTMLElement | null>): {
|
|
7
|
+
setWatermark: (str: string, attr?: attr | undefined) => void;
|
|
8
|
+
clear: () => void;
|
|
9
|
+
};
|
|
10
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@utogether/utils",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.15.
|
|
4
|
+
"version": "1.15.14",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "dist/utils.umd.js",
|
|
7
7
|
"module": "dist/utils.umd.js",
|
|
8
8
|
"files": [
|
|
9
9
|
"dist/utils.umd.js",
|
|
10
10
|
"dist/style.css",
|
|
11
|
-
"dist/index.d.ts"
|
|
11
|
+
"dist/index.d.ts",
|
|
12
|
+
"dist/types"
|
|
12
13
|
],
|
|
13
14
|
"typings": "dist/index.d.ts",
|
|
14
15
|
"keywords": [],
|