@ks-web/use 0.0.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/LICENSE +10 -0
- package/README.md +16 -0
- package/dist/index.cjs.js +5398 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.esm.mjs +5405 -0
- package/dist/onMountedOrActivated/index.d.ts +1 -0
- package/dist/useClickAway/index.d.ts +5 -0
- package/dist/useCountDown/index.d.ts +20 -0
- package/dist/useCustomFieldValue/index.d.ts +8 -0
- package/dist/useDebounceThrottle/index.d.ts +10 -0
- package/dist/useError/errorClient.d.ts +16 -0
- package/dist/useError/index.d.ts +2 -0
- package/dist/useError/types.d.ts +15 -0
- package/dist/useEventListener/index.d.ts +10 -0
- package/dist/useHttp/http/config.d.ts +25 -0
- package/dist/useHttp/http/http.d.ts +60 -0
- package/dist/useHttp/http/index.d.ts +19 -0
- package/dist/useHttp/http/types.d.ts +58 -0
- package/dist/useHttp/http/utils.d.ts +19 -0
- package/dist/useHttp/index.d.ts +3 -0
- package/dist/useHttp/openApi.d.ts +11 -0
- package/dist/useMd5/index.d.ts +2 -0
- package/dist/usePageVisibility/index.d.ts +4 -0
- package/dist/useRect/index.d.ts +2 -0
- package/dist/useRelation/index.d.ts +2 -0
- package/dist/useRelation/useChildren.d.ts +9 -0
- package/dist/useRelation/useParent.d.ts +15 -0
- package/dist/useScrollParent/index.d.ts +5 -0
- package/dist/useToggle/index.d.ts +1 -0
- package/dist/useType/index.d.ts +43 -0
- package/dist/useWaterMark/index.d.ts +8 -0
- package/dist/useWindowSize/index.d.ts +5 -0
- package/dist/utils.d.ts +5 -0
- package/package.json +57 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function onMountedOrActivated(hook: () => any): void;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
export type UseClickAwayOptions = {
|
|
3
|
+
eventName?: string;
|
|
4
|
+
};
|
|
5
|
+
export declare function useClickAway(target: Element | Ref<Element | undefined> | Array<Element | Ref<Element | undefined>>, listener: EventListener, options?: UseClickAwayOptions): void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type CurrentTime = {
|
|
2
|
+
days: number;
|
|
3
|
+
hours: number;
|
|
4
|
+
total: number;
|
|
5
|
+
minutes: number;
|
|
6
|
+
seconds: number;
|
|
7
|
+
milliseconds: number;
|
|
8
|
+
};
|
|
9
|
+
export type UseCountDownOptions = {
|
|
10
|
+
time: number;
|
|
11
|
+
millisecond?: boolean;
|
|
12
|
+
onChange?: (current: CurrentTime) => void;
|
|
13
|
+
onFinish?: () => void;
|
|
14
|
+
};
|
|
15
|
+
export declare function useCountDown(options: UseCountDownOptions): {
|
|
16
|
+
start: () => void;
|
|
17
|
+
pause: () => void;
|
|
18
|
+
reset: (totalTime?: number) => void;
|
|
19
|
+
current: import("vue").ComputedRef<CurrentTime>;
|
|
20
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { InjectionKey, Ref } from 'vue';
|
|
2
|
+
export type CustomFieldInjectionValue = {
|
|
3
|
+
customValue: Ref<(() => unknown) | undefined>;
|
|
4
|
+
resetValidation: () => void;
|
|
5
|
+
validateWithTrigger: (trigger: 'onBlur' | 'onChange' | 'onSubmit') => void;
|
|
6
|
+
};
|
|
7
|
+
export declare const CUSTOM_FIELD_INJECTION_KEY: InjectionKey<CustomFieldInjectionValue>;
|
|
8
|
+
export declare function useCustomFieldValue(customValue: () => unknown): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const debounce: (func: (...arg: any) => void, wait: number, options?: any) => {
|
|
2
|
+
(this: any): any;
|
|
3
|
+
cancel: () => void;
|
|
4
|
+
flush: () => any;
|
|
5
|
+
};
|
|
6
|
+
export declare function throttle(func: (...arg: any) => void, wait: number, options?: any): {
|
|
7
|
+
(this: any): any;
|
|
8
|
+
cancel: () => void;
|
|
9
|
+
flush: () => any;
|
|
10
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ErrorOptions, ReportOptions } from './types';
|
|
2
|
+
export declare class errorClient implements ErrorOptions {
|
|
3
|
+
user?: Object | undefined;
|
|
4
|
+
menu?: String | undefined;
|
|
5
|
+
type: String | undefined;
|
|
6
|
+
platform?: String | undefined;
|
|
7
|
+
constructor(errorOptions: ErrorOptions);
|
|
8
|
+
addEvent(): void;
|
|
9
|
+
windowErrorHandler(e: any): void;
|
|
10
|
+
vueErrorHandler(app: any): void;
|
|
11
|
+
reactErrorHandler(error: any, info: any): void;
|
|
12
|
+
handleError(error: any, option: any): void;
|
|
13
|
+
report(data: ReportOptions): void;
|
|
14
|
+
}
|
|
15
|
+
declare const _default: (errorOptions: ErrorOptions) => errorClient;
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface ErrorOptions {
|
|
2
|
+
user?: Object | undefined;
|
|
3
|
+
menu?: String | undefined;
|
|
4
|
+
type: String | undefined;
|
|
5
|
+
platform?: String | undefined;
|
|
6
|
+
}
|
|
7
|
+
export interface ReportOptions {
|
|
8
|
+
userId: String | undefined;
|
|
9
|
+
option: Object;
|
|
10
|
+
userName: String | undefined;
|
|
11
|
+
menuId: Number | undefined;
|
|
12
|
+
menuName: String | undefined;
|
|
13
|
+
platform: String | undefined;
|
|
14
|
+
error: unknown;
|
|
15
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
type TargetRef = EventTarget | Ref<EventTarget | undefined>;
|
|
3
|
+
export type UseEventListenerOptions = {
|
|
4
|
+
target?: TargetRef;
|
|
5
|
+
capture?: boolean;
|
|
6
|
+
passive?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare function useEventListener<K extends keyof DocumentEventMap>(type: K, listener: (event: DocumentEventMap[K]) => void, options?: UseEventListenerOptions): void;
|
|
9
|
+
export declare function useEventListener(type: string, listener: EventListener, options?: UseEventListenerOptions): void;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { HttpOptions } from './types';
|
|
2
|
+
export declare const EMPTY_FUNC: () => void;
|
|
3
|
+
export declare const EMPTY_ARRAY: never[];
|
|
4
|
+
export declare const EMPTY_OBJECT: {};
|
|
5
|
+
export declare const REQUEST_METHOD: {
|
|
6
|
+
get: string;
|
|
7
|
+
post: string;
|
|
8
|
+
put: string;
|
|
9
|
+
patch: string;
|
|
10
|
+
del: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const DEFAULT_REQUEST_OPTIONS: HttpOptions;
|
|
13
|
+
export declare const responseResultText: {
|
|
14
|
+
code: string;
|
|
15
|
+
success: string;
|
|
16
|
+
data: string;
|
|
17
|
+
message: string;
|
|
18
|
+
};
|
|
19
|
+
export declare const CONTENT_TYPE: {
|
|
20
|
+
encoded: string;
|
|
21
|
+
json: string;
|
|
22
|
+
form: string;
|
|
23
|
+
html: string;
|
|
24
|
+
};
|
|
25
|
+
export declare const KUASHENG_TOKEN_KEY = "ks_token";
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { HttpClient } from '.';
|
|
2
|
+
import type { HttpOptions, httpInstance, HttpInterceptorMap, HttpInterceptorRequest, Params, RequestOptions, HttpConfig, HttpInterceptorResponse, HttpInterceptorReject } from './types';
|
|
3
|
+
import type { CancelToken, AxiosRequestTransformer, AxiosResponseTransformer } from 'axios';
|
|
4
|
+
export declare const getInstance: (options: HttpOptions) => httpInstance;
|
|
5
|
+
export declare function getRequest(httpInstance: HttpClient, url: string, method: string, param?: Params, config?: RequestOptions): Promise<unknown>;
|
|
6
|
+
type HandleParam = {
|
|
7
|
+
_param: Params;
|
|
8
|
+
_config: HttpConfig;
|
|
9
|
+
};
|
|
10
|
+
export declare function handleParam(param?: Params, config?: RequestOptions): HandleParam;
|
|
11
|
+
export declare function handleOptions(httpInstance: HttpClient, url: string, method: string, param: Params, config: HttpConfig): {
|
|
12
|
+
url: string;
|
|
13
|
+
method: string;
|
|
14
|
+
baseURL?: string | undefined;
|
|
15
|
+
transformRequest?: AxiosRequestTransformer | AxiosRequestTransformer[] | undefined;
|
|
16
|
+
transformResponse?: AxiosResponseTransformer | AxiosResponseTransformer[] | undefined;
|
|
17
|
+
headers: {};
|
|
18
|
+
params?: any;
|
|
19
|
+
paramsSerializer?: import("axios").ParamsSerializerOptions | undefined;
|
|
20
|
+
data?: any;
|
|
21
|
+
timeout?: number | undefined;
|
|
22
|
+
timeoutErrorMessage?: string | undefined;
|
|
23
|
+
withCredentials?: boolean | undefined;
|
|
24
|
+
adapter?: (string | import("axios").AxiosAdapter) | (string | import("axios").AxiosAdapter)[] | undefined;
|
|
25
|
+
auth?: import("axios").AxiosBasicCredentials | undefined;
|
|
26
|
+
responseType?: import("axios").ResponseType | undefined;
|
|
27
|
+
responseEncoding?: string | undefined;
|
|
28
|
+
xsrfCookieName?: string | undefined;
|
|
29
|
+
xsrfHeaderName?: string | undefined;
|
|
30
|
+
onUploadProgress?: ((progressEvent: import("axios").AxiosProgressEvent) => void) | undefined;
|
|
31
|
+
onDownloadProgress?: ((progressEvent: import("axios").AxiosProgressEvent) => void) | undefined;
|
|
32
|
+
maxContentLength?: number | undefined;
|
|
33
|
+
validateStatus?: ((status: number) => boolean) | null | undefined;
|
|
34
|
+
maxBodyLength?: number | undefined;
|
|
35
|
+
maxRedirects?: number | undefined;
|
|
36
|
+
maxRate?: number | [number, number] | undefined;
|
|
37
|
+
beforeRedirect?: ((options: Record<string, any>, responseDetails: {
|
|
38
|
+
headers: Record<string, string>;
|
|
39
|
+
}) => void) | undefined;
|
|
40
|
+
socketPath?: string | null | undefined;
|
|
41
|
+
httpAgent?: any;
|
|
42
|
+
httpsAgent?: any;
|
|
43
|
+
proxy?: false | import("axios").AxiosProxyConfig | undefined;
|
|
44
|
+
cancelToken?: CancelToken | undefined;
|
|
45
|
+
decompress?: boolean | undefined;
|
|
46
|
+
transitional?: import("axios").TransitionalOptions | undefined;
|
|
47
|
+
signal?: import("axios").GenericAbortSignal | undefined;
|
|
48
|
+
insecureHTTPParser?: boolean | undefined;
|
|
49
|
+
env?: {
|
|
50
|
+
FormData?: (new (...args: any[]) => object) | undefined;
|
|
51
|
+
} | undefined;
|
|
52
|
+
formSerializer?: import("axios").FormSerializerOptions | undefined;
|
|
53
|
+
};
|
|
54
|
+
type InterceptorList = Array<{
|
|
55
|
+
type: 'request' | 'response' | 'rejectRequest' | 'rejectResponse';
|
|
56
|
+
callback: HttpInterceptorRequest | HttpInterceptorResponse | HttpInterceptorReject;
|
|
57
|
+
}>;
|
|
58
|
+
export declare function mergeInterceptor(httpOptions: HttpOptions, httpInterceptorMap?: HttpInterceptorMap): InterceptorList;
|
|
59
|
+
export declare function runRetry(err: any): Promise<void>;
|
|
60
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { AxiosInstance } from 'axios';
|
|
2
|
+
import type { Params, HttpOptions, RequestOptions, CancelTokenMap } from './types';
|
|
3
|
+
export declare class HttpClient {
|
|
4
|
+
baseURL: string | undefined;
|
|
5
|
+
httpOptions: HttpOptions | undefined;
|
|
6
|
+
http: AxiosInstance;
|
|
7
|
+
source?: CancelTokenMap;
|
|
8
|
+
request: (url: string, method: string, param?: Params, requestOptions?: RequestOptions) => Promise<any>;
|
|
9
|
+
constructor(httpOptions?: HttpOptions);
|
|
10
|
+
createCancelToken(): CancelTokenMap;
|
|
11
|
+
get: (url: string, param?: Params, requestOptions?: RequestOptions) => Promise<any>;
|
|
12
|
+
post: (url: string, param?: Params, requestOptions?: RequestOptions) => Promise<any>;
|
|
13
|
+
put: (url: string, param?: Params, requestOptions?: RequestOptions) => Promise<any>;
|
|
14
|
+
patch: (url: string, param?: Params, requestOptions?: RequestOptions) => Promise<any>;
|
|
15
|
+
del: (url: string, param?: Params, requestOptions?: RequestOptions) => Promise<any>;
|
|
16
|
+
cancel: (message: string) => void;
|
|
17
|
+
}
|
|
18
|
+
declare const _default: (httpOptions: HttpOptions) => HttpClient;
|
|
19
|
+
export default _default;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { AxiosRequestTransformer, AxiosResponseTransformer, AxiosAdapter, AxiosRequestConfig, AxiosInstance, CancelToken, CancelTokenSource, Canceler, AxiosResponse } from 'axios';
|
|
2
|
+
export interface HttpOptions {
|
|
3
|
+
baseURL?: string;
|
|
4
|
+
headers?: Record<string, any>;
|
|
5
|
+
timeout?: number;
|
|
6
|
+
adapter?: AxiosAdapter;
|
|
7
|
+
transformRequest?: AxiosRequestTransformer;
|
|
8
|
+
transformResponse?: AxiosResponseTransformer;
|
|
9
|
+
validateStatus?: (status: number) => boolean;
|
|
10
|
+
interceptors?: HttpInterceptorMap;
|
|
11
|
+
loadingOptions?: {
|
|
12
|
+
show?: () => void;
|
|
13
|
+
hide?: () => void;
|
|
14
|
+
};
|
|
15
|
+
loading?: boolean;
|
|
16
|
+
origin?: boolean;
|
|
17
|
+
casToken?: boolean;
|
|
18
|
+
appKey?: string | number;
|
|
19
|
+
}
|
|
20
|
+
export interface RequestOptions {
|
|
21
|
+
baseURL?: string;
|
|
22
|
+
headers?: Record<string, any>;
|
|
23
|
+
cancelToken?: CancelToken | CancelTokenSource;
|
|
24
|
+
ksAdapter?: boolean;
|
|
25
|
+
failToast?: boolean;
|
|
26
|
+
loading?: boolean;
|
|
27
|
+
customHeaders?: boolean;
|
|
28
|
+
onUploadProgress?: (progressEvent: any) => void;
|
|
29
|
+
onDownloadProgress?: (progressEvent: any) => void;
|
|
30
|
+
options?: Record<string, any>;
|
|
31
|
+
origin?: boolean;
|
|
32
|
+
appKey?: string | number;
|
|
33
|
+
}
|
|
34
|
+
export type HttpConfig = RequestOptions & HttpOptions;
|
|
35
|
+
export interface HttpInterceptorMap {
|
|
36
|
+
request?: HttpInterceptorRequest | Array<HttpInterceptorRequest>;
|
|
37
|
+
response?: HttpInterceptorResponse | Array<HttpInterceptorResponse>;
|
|
38
|
+
rejectRequest?: HttpInterceptorReject | Array<HttpInterceptorReject>;
|
|
39
|
+
rejectResponse?: HttpInterceptorReject | Array<HttpInterceptorReject>;
|
|
40
|
+
}
|
|
41
|
+
export type httpInstance = AxiosInstance & {
|
|
42
|
+
showLoading?: () => void;
|
|
43
|
+
hideLoading?: () => void;
|
|
44
|
+
};
|
|
45
|
+
export type HttpInterceptorRequest = (value: AxiosRequestConfig) => any;
|
|
46
|
+
export type HttpInterceptorResponse = (value: AxiosResponse) => any;
|
|
47
|
+
export type HttpInterceptorReject = (error: any) => any;
|
|
48
|
+
export interface MergeInterceptorMap {
|
|
49
|
+
request: Array<HttpInterceptorRequest>;
|
|
50
|
+
rejectRequest: Array<HttpInterceptorReject>;
|
|
51
|
+
rejectResponse: Array<HttpInterceptorReject>;
|
|
52
|
+
response: Array<HttpInterceptorResponse>;
|
|
53
|
+
}
|
|
54
|
+
export type Params<D = any> = Record<string, D>;
|
|
55
|
+
export interface CancelTokenMap {
|
|
56
|
+
cancel: Canceler;
|
|
57
|
+
source: CancelToken;
|
|
58
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { AxiosResponse, InternalAxiosRequestConfig, AxiosPromise } from 'axios';
|
|
2
|
+
interface CasHeadersTransformOptions {
|
|
3
|
+
url: string;
|
|
4
|
+
appkey?: string | number;
|
|
5
|
+
data?: any;
|
|
6
|
+
}
|
|
7
|
+
export declare const isKuaShengClient: boolean;
|
|
8
|
+
export declare function createCasHeaders(opt: CasHeadersTransformOptions): {
|
|
9
|
+
method: string;
|
|
10
|
+
appkey: string | number | undefined;
|
|
11
|
+
token: string;
|
|
12
|
+
sign: string;
|
|
13
|
+
format: string;
|
|
14
|
+
timestamp: number;
|
|
15
|
+
'x-webtrace-id': string;
|
|
16
|
+
};
|
|
17
|
+
export declare function casInterceptorResponse(response: AxiosResponse): AxiosResponse<any, any>;
|
|
18
|
+
export declare function createKuaShengAdapter(config: InternalAxiosRequestConfig): AxiosPromise;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { RequestOptions } from './http/types';
|
|
2
|
+
export declare function useHttp(): {
|
|
3
|
+
cancel: (message: string) => void;
|
|
4
|
+
createCancelToken: () => import("./http/types").CancelTokenMap;
|
|
5
|
+
$get: (url: string, appKey: string | number, data: any, config?: RequestOptions | undefined) => Promise<any>;
|
|
6
|
+
$put: (url: string, appKey: string | number, data: any, config?: RequestOptions | undefined) => Promise<any>;
|
|
7
|
+
$del: (url: string, appKey: string | number, data: any, config?: RequestOptions | undefined) => Promise<any>;
|
|
8
|
+
$patch: (url: string, appKey: string | number, data: any, config?: RequestOptions | undefined) => Promise<any>;
|
|
9
|
+
$post: (url: string, appKey: string | number, data: any, config?: RequestOptions | undefined) => Promise<any>;
|
|
10
|
+
$http: (url: string, appKey: string | number, data: any, config?: RequestOptions | undefined) => Promise<any>;
|
|
11
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { VNode, InjectionKey, VNodeNormalizedChildren, ComponentPublicInstance, ComponentInternalInstance } from 'vue';
|
|
2
|
+
export declare function flattenVNodes(children: VNodeNormalizedChildren): VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
}>[];
|
|
5
|
+
export declare function sortChildren(parent: ComponentInternalInstance, publicChildren: ComponentPublicInstance[], internalChildren: ComponentInternalInstance[]): void;
|
|
6
|
+
export declare function useChildren<Child extends ComponentPublicInstance = ComponentPublicInstance<{}, any>, ProvideValue = never>(key: InjectionKey<ProvideValue>): {
|
|
7
|
+
children: Child[];
|
|
8
|
+
linkChildren: (value?: ProvideValue) => void;
|
|
9
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { InjectionKey, ComponentPublicInstance, ComponentInternalInstance } from 'vue';
|
|
2
|
+
type ParentProvide<T> = T & {
|
|
3
|
+
link(child: ComponentInternalInstance): void;
|
|
4
|
+
unlink(child: ComponentInternalInstance): void;
|
|
5
|
+
children: ComponentPublicInstance[];
|
|
6
|
+
internalChildren: ComponentInternalInstance[];
|
|
7
|
+
};
|
|
8
|
+
export declare function useParent<T>(key: InjectionKey<ParentProvide<T>>): {
|
|
9
|
+
parent: ParentProvide<T>;
|
|
10
|
+
index: import("vue").ComputedRef<number>;
|
|
11
|
+
} | {
|
|
12
|
+
parent: null;
|
|
13
|
+
index: import("vue").Ref<number>;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
type ScrollElement = HTMLElement | Window;
|
|
3
|
+
export declare function getScrollParent(el: Element, root?: ScrollElement | undefined): Window | Element | undefined;
|
|
4
|
+
export declare function useScrollParent(el: Ref<Element | undefined>, root?: ScrollElement | undefined): Ref<Window | Element | undefined>;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useToggle(defaultValue?: boolean): readonly [import("vue").Ref<boolean>, (value?: boolean) => void];
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export declare const toString: () => string;
|
|
2
|
+
/**
|
|
3
|
+
* @method 检测当前类型是否为字符串
|
|
4
|
+
* @param item 检测当前类型
|
|
5
|
+
* @returns { Boolean } 如果是字符串则返回true、否则返回false
|
|
6
|
+
*/
|
|
7
|
+
export declare const isString: (item: unknown) => boolean;
|
|
8
|
+
/**
|
|
9
|
+
* @method 检测当前类型是否为函数
|
|
10
|
+
* @param item 检测当前类型
|
|
11
|
+
* @returns { Boolean } 如果是函数则返回true、否则返回false
|
|
12
|
+
*/
|
|
13
|
+
export declare const isFunction: (item: unknown) => boolean;
|
|
14
|
+
/**
|
|
15
|
+
* @method 检测当前类型是否为空函数
|
|
16
|
+
* @param item 检测当前类型
|
|
17
|
+
* @returns { Boolean } 如果是空函数则返回true、否则返回false
|
|
18
|
+
*/
|
|
19
|
+
export declare const isEmptyFunction: (item: () => void | unknown) => boolean;
|
|
20
|
+
/**
|
|
21
|
+
* @method 检测当前类型是否是数组
|
|
22
|
+
* @param item 检测当前类型
|
|
23
|
+
* @returns { Boolean } 如果是数组则返回true、否则返回false
|
|
24
|
+
*/
|
|
25
|
+
export declare const isArray: (item: Array<unknown> | unknown) => boolean;
|
|
26
|
+
/**
|
|
27
|
+
* @method 检测当前类型是否是空数组
|
|
28
|
+
* @param item 检测当前类型
|
|
29
|
+
* @returns { Boolean } 如果为空数组则返回true、否则返回false
|
|
30
|
+
*/
|
|
31
|
+
export declare const isEmptyArray: (item: Array<unknown> | unknown) => boolean;
|
|
32
|
+
/**
|
|
33
|
+
* @method 检测当前类型是否是对象
|
|
34
|
+
* @param item 检测当前类型
|
|
35
|
+
* @returns { Boolean } 如果是对象则返回true、否则返回false
|
|
36
|
+
*/
|
|
37
|
+
export declare const isObject: (item: unknown) => boolean;
|
|
38
|
+
/**
|
|
39
|
+
* @method 检测当前类型是否是空对象
|
|
40
|
+
* @param item 检测当前类型
|
|
41
|
+
* @returns { Boolean } 如果为空的对象则返回true、否则返回false
|
|
42
|
+
*/
|
|
43
|
+
export declare const isEmptyObject: (item: unknown) => boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const customWatermark: (text?: string | any[], el?: string, color?: string, rotate?: number) => void;
|
|
2
|
+
/**
|
|
3
|
+
* 添加水印方法
|
|
4
|
+
* @param {string} employeeNumber 工号
|
|
5
|
+
* @param {sting} el css选择器
|
|
6
|
+
* @param {string} color 水印文字颜色(格式rgba)
|
|
7
|
+
*/
|
|
8
|
+
export declare function useWaterMark(employeeNumber: string, el?: string, color?: string): void;
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const inBrowser: boolean;
|
|
2
|
+
export declare const supportsPassive = true;
|
|
3
|
+
export declare function raf(fn: FrameRequestCallback): number;
|
|
4
|
+
export declare function cancelRaf(id: number): void;
|
|
5
|
+
export declare function doubleRaf(fn: FrameRequestCallback): void;
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ks-web/use",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Vant Composition API",
|
|
5
|
+
"main": "dist/index.cjs.js",
|
|
6
|
+
"module": "dist/index.esm.mjs",
|
|
7
|
+
"typings": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.esm.mjs",
|
|
11
|
+
"require": "./dist/index.cjs.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"sideEffects": false,
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"clean": "rimraf ./dist",
|
|
20
|
+
"dev": "node ./build.js -w",
|
|
21
|
+
"build:types": "tsc -p ./tsconfig.json --emitDeclarationOnly",
|
|
22
|
+
"build:bundle": "node ./build.js",
|
|
23
|
+
"build": "pnpm clean && pnpm build:bundle && pnpm build:types",
|
|
24
|
+
"release": "pnpm build && release-it",
|
|
25
|
+
"prepare": "pnpm build"
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public",
|
|
29
|
+
"registry": "https://registry.npmjs.org/"
|
|
30
|
+
},
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "https://github.com/vant-ui/vant.git",
|
|
34
|
+
"directory": "packages/vant-use"
|
|
35
|
+
},
|
|
36
|
+
"bugs": "https://github.com/vant-ui/vant/issues",
|
|
37
|
+
"author": "chenjiahan",
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@types/js-md5": "0.7.0",
|
|
41
|
+
"@types/qs": "6.9.7",
|
|
42
|
+
"axios": "1.3.3",
|
|
43
|
+
"esbuild": "0.16.10",
|
|
44
|
+
"js-md5": "0.7.3",
|
|
45
|
+
"qs": "6.11.0",
|
|
46
|
+
"release-it": "^15.4.1",
|
|
47
|
+
"rimraf": "^4.0.4",
|
|
48
|
+
"typescript": "^4.8.2",
|
|
49
|
+
"vue": "^3.2.45"
|
|
50
|
+
},
|
|
51
|
+
"release-it": {
|
|
52
|
+
"git": {
|
|
53
|
+
"tag": false,
|
|
54
|
+
"commitMessage": "release: @vant/use ${version}"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|