@kengic/vue 0.27.2-beta.1 → 0.27.2-beta.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/kengic-vue.js +11104 -9169
- package/dist/src/api/WMS/Controllers/VarConfigPossibilityController/ExecuteQuery.d.ts +1 -1
- package/dist/src/api/WMS/Controllers/VarGridMasterController/QueryByID.d.ts +1 -1
- package/dist/src/api/WMS/Controllers/VarProfileMasterController/QueryByID.d.ts +1 -1
- package/dist/src/api/WMS/models.d.ts +14 -0
- package/dist/src/component/KgButton/KgButton.hooks.d.ts +5 -1
- package/dist/src/component/KgForm/KgForm.hooks.d.ts +5 -1
- package/dist/src/component/KgSearch/KgSearch.hooks.d.ts +5 -1
- package/dist/src/component/KgSubmit/KgSubmit.hooks.d.ts +5 -1
- package/dist/src/component/KgTable/KgTable.hooks.d.ts +5 -1
- package/dist/src/component/KgVar/KgVar.hooks.d.ts +5 -1
- package/dist/src/component/KgWarehouse/KgWarehouse.hooks.d.ts +1 -7
- package/dist/src/project/src/components/Application/src/useAppContext.d.ts +9 -0
- package/dist/src/project/src/components/index.d.ts +1 -0
- package/dist/src/project/src/hooks/component/useFormItem.d.ts +2 -0
- package/dist/src/project/src/hooks/component/usePageContext.d.ts +10 -0
- package/dist/src/project/src/hooks/core/onMountedOrActivated.d.ts +1 -0
- package/dist/src/project/src/hooks/core/useAttrs.d.ts +9 -0
- package/dist/src/project/src/hooks/core/useContext.d.ts +11 -0
- package/dist/src/project/src/hooks/core/useRefs.d.ts +2 -0
- package/dist/src/project/src/hooks/core/useTimeout.d.ts +10 -0
- package/dist/src/project/src/hooks/event/useBreakpoint.d.ts +22 -0
- package/dist/src/project/src/hooks/event/useEventListener.d.ts +14 -0
- package/dist/src/project/src/hooks/event/useIntersectionObserver.d.ts +13 -0
- package/dist/src/project/src/hooks/event/useScrollTo.d.ts +10 -0
- package/dist/src/project/src/hooks/event/useWindowSizeFn.d.ts +7 -0
- package/dist/src/project/src/hooks/index.d.ts +20 -0
- package/dist/src/project/src/hooks/jeecg/useAdaptiveWidth.d.ts +18 -0
- package/dist/src/project/src/hooks/web/useAppInject.d.ts +3 -0
- package/dist/src/project/src/hooks/web/useContentHeight.d.ts +24 -0
- package/dist/src/project/src/hooks/web/useCopyToClipboard.d.ts +10 -0
- package/dist/src/project/src/hooks/web/useDesign.d.ts +4 -0
- package/dist/src/project/src/hooks/web/usePage.d.ts +10 -0
- package/dist/src/project/src/hooks/web/usePagination.d.ts +7 -0
- package/dist/src/project/src/hooks/web/useWebSocket.d.ts +18 -0
- package/dist/src/project/src/index.d.ts +3 -8
- package/dist/src/project/src/layouts/default/content/useContentContext.d.ts +9 -0
- package/dist/src/project/src/layouts/default/content/useContentViewHeight.d.ts +7 -0
- package/dist/src/project/src/layouts/index.d.ts +2 -0
- package/dist/src/project/src/router/constant2.d.ts +3 -0
- package/dist/src/project/src/router/index.d.ts +2 -0
- package/dist/src/project/src/settings/index.d.ts +1 -0
- package/dist/src/project/src/settings/projectSetting.d.ts +3 -0
- package/dist/src/project/src/utils/auth/index.d.ts +19 -0
- package/dist/src/project/src/utils/bem.d.ts +15 -0
- package/dist/src/project/src/utils/color.d.ts +29 -0
- package/dist/src/project/src/utils/common/compUtils.d.ts +87 -0
- package/dist/src/project/src/utils/common/functionUtils.d.ts +6 -0
- package/dist/src/project/src/utils/dateUtil.d.ts +4 -0
- package/dist/src/project/src/utils/domUtils.d.ts +28 -0
- package/dist/src/project/src/utils/encryption/signMd5Utils.d.ts +29 -0
- package/dist/src/project/src/utils/event/index.d.ts +3 -0
- package/dist/src/project/src/utils/factory/createAsyncComponent.d.ts +9 -0
- package/dist/src/project/src/utils/file/base64Conver.d.ts +4 -0
- package/dist/src/project/src/utils/file/download.d.ts +9 -0
- package/dist/src/project/src/utils/helper/treeHelper.d.ts +34 -0
- package/dist/src/project/src/utils/helper/tsxHelper.d.ts +13 -0
- package/dist/src/project/src/utils/index.d.ts +26 -0
- package/dist/src/project/src/utils/index.index.d.ts +42 -0
- package/dist/src/project/src/utils/is.d.ts +17 -0
- package/dist/src/project/src/utils/mitt.d.ts +26 -0
- package/dist/src/project/src/utils/props.d.ts +68 -0
- package/dist/src/project/src/utils/uuid.d.ts +2 -0
- package/dist/src/util/event.util.d.ts +15 -0
- package/dist/src/util/index.d.ts +1 -0
- package/package.json +5 -2
@@ -0,0 +1,87 @@
|
|
1
|
+
/**
|
2
|
+
* 获取文件服务访问路径
|
3
|
+
* @param fileUrl 文件路径
|
4
|
+
* @param prefix (默认http) 文件路径前缀 http/https
|
5
|
+
*/
|
6
|
+
export declare const getFileAccessHttpUrl: (fileUrl: any, prefix?: string) => any;
|
7
|
+
/**
|
8
|
+
* 触发 window.resize
|
9
|
+
*/
|
10
|
+
export declare function triggerWindowResizeEvent(): void;
|
11
|
+
/**
|
12
|
+
* 获取随机数
|
13
|
+
* @param length 数字位数
|
14
|
+
*/
|
15
|
+
export declare const getRandom: (length?: number) => string;
|
16
|
+
/**
|
17
|
+
* 随机生成字符串
|
18
|
+
* @param length 字符串的长度
|
19
|
+
* @param chats 可选字符串区间(只会生成传入的字符串中的字符)
|
20
|
+
* @return string 生成的字符串
|
21
|
+
*/
|
22
|
+
export declare function randomString(length: number, chats?: string): string;
|
23
|
+
/**
|
24
|
+
* 将普通列表数据转化为tree结构
|
25
|
+
* @param array tree数据
|
26
|
+
* @param opt 配置参数
|
27
|
+
* @param startPid 父节点
|
28
|
+
*/
|
29
|
+
export declare const listToTree: (array: any, opt: any, startPid: any) => any;
|
30
|
+
/**
|
31
|
+
* 递归构建tree
|
32
|
+
* @param array
|
33
|
+
* @param startPid
|
34
|
+
* @param currentDept
|
35
|
+
* @param opt
|
36
|
+
* @returns {Array}
|
37
|
+
*/
|
38
|
+
export declare const toTree: (array: any, startPid: any, currentDept: any, opt: any) => any;
|
39
|
+
/**
|
40
|
+
* 简单实现防抖方法
|
41
|
+
*
|
42
|
+
* 防抖(debounce)函数在第一次触发给定的函数时,不立即执行函数,而是给出一个期限值(delay),比如100ms。
|
43
|
+
* 如果100ms内再次执行函数,就重新开始计时,直到计时结束后再真正执行函数。
|
44
|
+
* 这样做的好处是如果短时间内大量触发同一事件,只会执行一次函数。
|
45
|
+
*
|
46
|
+
* @param fn 要防抖的函数
|
47
|
+
* @param delay 防抖的毫秒数
|
48
|
+
* @returns {Function}
|
49
|
+
*/
|
50
|
+
export declare function simpleDebounce(fn: any, delay?: number): () => void;
|
51
|
+
/**
|
52
|
+
* 日期格式化
|
53
|
+
* @param date 日期
|
54
|
+
* @param block 格式化字符串
|
55
|
+
*/
|
56
|
+
export declare function dateFormat(date: any, block: any): any;
|
57
|
+
/**
|
58
|
+
* 如果值不存在就 push 进数组,反之不处理
|
59
|
+
* @param array 要操作的数据
|
60
|
+
* @param value 要添加的值
|
61
|
+
* @param key 可空,如果比较的是对象,可能存在地址不一样但值实际上是一样的情况,可以传此字段判断对象中唯一的字段,例如 id。不传则直接比较实际值
|
62
|
+
* @returns {boolean} 成功 push 返回 true,不处理返回 false
|
63
|
+
*/
|
64
|
+
export declare function pushIfNotExist(array: any, value: any, key?: any): boolean;
|
65
|
+
/**
|
66
|
+
* 过滤对象中为空的属性
|
67
|
+
* @param obj
|
68
|
+
* @returns {*}
|
69
|
+
*/
|
70
|
+
export declare function filterObj(obj: any): any;
|
71
|
+
/**
|
72
|
+
* 查找树结构
|
73
|
+
* @param treeList
|
74
|
+
* @param fn 查找方法
|
75
|
+
* @param childrenKey
|
76
|
+
*/
|
77
|
+
export declare function findTree(treeList: any[], fn: Fn, childrenKey?: string): any;
|
78
|
+
/**
|
79
|
+
* 【组件多了可能存在性能问题】获取弹窗div,将下拉框、日期等组件挂载到modal上,解决弹窗遮盖问题
|
80
|
+
* @param node
|
81
|
+
*/
|
82
|
+
export declare function getAutoScrollContainer(node: HTMLElement): HTMLElement | null;
|
83
|
+
/**
|
84
|
+
* 判断子菜单是否全部隐藏
|
85
|
+
* @param menuTreeItem
|
86
|
+
*/
|
87
|
+
export declare function checkChildrenHidden(menuTreeItem: any): any;
|
@@ -0,0 +1,28 @@
|
|
1
|
+
export interface ViewportOffsetResult {
|
2
|
+
left: number;
|
3
|
+
top: number;
|
4
|
+
right: number;
|
5
|
+
bottom: number;
|
6
|
+
rightIncludeBody: number;
|
7
|
+
bottomIncludeBody: number;
|
8
|
+
}
|
9
|
+
export declare function getBoundingClientRect(element: Element): DOMRect | number;
|
10
|
+
export declare function hasClass(el: Element, cls: string): boolean;
|
11
|
+
export declare function addClass(el: Element, cls: string): void;
|
12
|
+
export declare function removeClass(el: Element, cls: string): void;
|
13
|
+
/**
|
14
|
+
* Get the left and top offset of the current element
|
15
|
+
* left: the distance between the leftmost element and the left side of the document
|
16
|
+
* top: the distance from the top of the element to the top of the document
|
17
|
+
* right: the distance from the far right of the element to the right of the document
|
18
|
+
* bottom: the distance from the bottom of the element to the bottom of the document
|
19
|
+
* rightIncludeBody: the distance between the leftmost element and the right side of the document
|
20
|
+
* bottomIncludeBody: the distance from the bottom of the element to the bottom of the document
|
21
|
+
*
|
22
|
+
* @description:
|
23
|
+
*/
|
24
|
+
export declare function getViewportOffset(element: Element): ViewportOffsetResult;
|
25
|
+
export declare function hackCss(attr: string, value: string): any;
|
26
|
+
export declare function on(element: Element | HTMLElement | Document | Window, event: string, handler: EventListenerOrEventListenerObject): void;
|
27
|
+
export declare function off(element: Element | HTMLElement | Document | Window, event: string, handler: Fn): void;
|
28
|
+
export declare function once(el: HTMLElement, event: string, fn: EventListener): void;
|
@@ -0,0 +1,29 @@
|
|
1
|
+
export declare class signMd5Utils {
|
2
|
+
/**
|
3
|
+
* json参数升序
|
4
|
+
* @param jsonObj 发送参数
|
5
|
+
*/
|
6
|
+
static sortAsc(jsonObj: any): {};
|
7
|
+
/**
|
8
|
+
* @param url 请求的url,应该包含请求参数(url的?后面的参数)
|
9
|
+
* @param requestParams 请求参数(POST的JSON参数)
|
10
|
+
* @returns {string} 获取签名
|
11
|
+
*/
|
12
|
+
static getSign(url: any, requestParams: any): string;
|
13
|
+
/**
|
14
|
+
* @param url 请求的url
|
15
|
+
* @returns {{}} 将url中请求参数组装成json对象(url的?后面的参数)
|
16
|
+
*/
|
17
|
+
static parseQueryString(url: any): {};
|
18
|
+
/**
|
19
|
+
* @returns {*} 将两个对象合并成一个
|
20
|
+
*/
|
21
|
+
static mergeObject(objectOne: any, objectTwo: any): any;
|
22
|
+
static urlEncode(param: any, key: any, encode: any): string;
|
23
|
+
/**
|
24
|
+
* 接口签名用 生成header中的时间戳
|
25
|
+
* @returns {number}
|
26
|
+
*/
|
27
|
+
static getTimestamp(): number;
|
28
|
+
static myIsNaN(value: any): boolean;
|
29
|
+
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
interface Options {
|
2
|
+
size?: 'default' | 'small' | 'large';
|
3
|
+
delay?: number;
|
4
|
+
timeout?: number;
|
5
|
+
loading?: boolean;
|
6
|
+
retry?: boolean;
|
7
|
+
}
|
8
|
+
export declare function createAsyncComponent(loader: Fn, options?: Options): new () => import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string>, {}>;
|
9
|
+
export {};
|
@@ -0,0 +1,34 @@
|
|
1
|
+
interface TreeHelperConfig {
|
2
|
+
id: string;
|
3
|
+
children: string;
|
4
|
+
pid: string;
|
5
|
+
}
|
6
|
+
export declare function treeToList<T = any>(tree: any, config?: Partial<TreeHelperConfig>): T;
|
7
|
+
export declare function findNodeAll<T = any>(tree: any, func: Fn, config?: Partial<TreeHelperConfig>): T[];
|
8
|
+
export declare function findPath<T = any>(tree: any, func: Fn, config?: Partial<TreeHelperConfig>): T | T[] | null;
|
9
|
+
export declare function filter<T = any>(tree: T[], func: (n: T) => boolean, config?: Partial<TreeHelperConfig>): T[];
|
10
|
+
export declare function forEach<T = any>(tree: T[], func: (n: T) => any, config?: Partial<TreeHelperConfig>): void;
|
11
|
+
/**
|
12
|
+
* @description: Extract tree specified structure
|
13
|
+
* @description: 提取树指定结构
|
14
|
+
*/
|
15
|
+
export declare function treeMap<T = any>(treeData: T[], opt: {
|
16
|
+
children?: string;
|
17
|
+
conversion: Fn;
|
18
|
+
}): T[];
|
19
|
+
/**
|
20
|
+
* @description: Extract tree specified structure
|
21
|
+
* @description: 提取树指定结构
|
22
|
+
*/
|
23
|
+
export declare function treeMapEach(data: any, { children, conversion }: {
|
24
|
+
children?: string;
|
25
|
+
conversion: Fn;
|
26
|
+
}): any;
|
27
|
+
/**
|
28
|
+
* 递归遍历树结构
|
29
|
+
* @param treeDatas 树
|
30
|
+
* @param callBack 回调
|
31
|
+
* @param parentNode 父节点
|
32
|
+
*/
|
33
|
+
export declare function eachTree(treeDatas: any[], callBack: Fn, parentNode?: {}): void;
|
34
|
+
export {};
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { Slots } from 'vue';
|
2
|
+
/**
|
3
|
+
* @description: Get slot to prevent empty error
|
4
|
+
*/
|
5
|
+
export declare function getSlot(slots: Slots, slot?: string, data?: any): import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
6
|
+
[key: string]: any;
|
7
|
+
}>[] | null;
|
8
|
+
/**
|
9
|
+
* extends slots
|
10
|
+
* @param slots
|
11
|
+
* @param excludeKeys
|
12
|
+
*/
|
13
|
+
export declare function extendSlots(slots: Slots, excludeKeys?: string[]): any;
|
@@ -0,0 +1,26 @@
|
|
1
|
+
export * from './auth';
|
2
|
+
export * from './cache/index';
|
3
|
+
export * from './cache/memory';
|
4
|
+
export * from './cache/persistent';
|
5
|
+
export * from './cache/storageCache';
|
6
|
+
export * from './common/compUtils';
|
7
|
+
export * from './common/functionUtils';
|
8
|
+
export * from './encryption/signMd5Utils';
|
9
|
+
export * from './event';
|
10
|
+
export * from './bem';
|
11
|
+
export * from './cipher';
|
12
|
+
export * from './color';
|
13
|
+
export * from './dateUtil';
|
14
|
+
export * from './domUtils';
|
15
|
+
export * from './env';
|
16
|
+
export * from './index.index';
|
17
|
+
export * from './factory/createAsyncComponent';
|
18
|
+
export * from './file/base64Conver';
|
19
|
+
export * from './file/download';
|
20
|
+
export * from './helper/treeHelper';
|
21
|
+
export * from './helper/tsxHelper';
|
22
|
+
export * from './is';
|
23
|
+
export * from './mitt';
|
24
|
+
export * from './props';
|
25
|
+
export * from './propTypes';
|
26
|
+
export * from './uuid';
|
@@ -0,0 +1,42 @@
|
|
1
|
+
import type { Plugin } from 'vue';
|
2
|
+
import type { RouteLocationNormalized } from 'vue-router';
|
3
|
+
export declare const URL_HASH_TAB = "__AGWE4H__HASH__TAG__PWHRG__";
|
4
|
+
export declare const noop: () => void;
|
5
|
+
/**
|
6
|
+
* @description: Set ui mount node
|
7
|
+
*/
|
8
|
+
export declare function getPopupContainer(node?: HTMLElement): HTMLElement;
|
9
|
+
/**
|
10
|
+
* Add the object as a parameter to the URL
|
11
|
+
* @param baseUrl url
|
12
|
+
* @param obj
|
13
|
+
* @returns {string}
|
14
|
+
* eg:
|
15
|
+
* let obj = {a: '3', b: '4'}
|
16
|
+
* setObjToUrlParams('www.baidu.com', obj)
|
17
|
+
* ==>www.baidu.com?a=3&b=4
|
18
|
+
*/
|
19
|
+
export declare function setObjToUrlParams(baseUrl: string, obj: any): string;
|
20
|
+
export declare function deepMerge<T = any>(src?: any, target?: any): T;
|
21
|
+
export declare function openWindow(url: string, opt?: {
|
22
|
+
target?: TargetContext | string;
|
23
|
+
noopener?: boolean;
|
24
|
+
noreferrer?: boolean;
|
25
|
+
}): void;
|
26
|
+
export declare function getDynamicProps<T, U>(props: T): Partial<U>;
|
27
|
+
/**
|
28
|
+
* 获取表单字段值数据类型
|
29
|
+
* @param props
|
30
|
+
* @param field
|
31
|
+
* @updateBy:zyf
|
32
|
+
*/
|
33
|
+
export declare function getValueType(props: any, field: any): string;
|
34
|
+
export declare function getRawRoute(route: RouteLocationNormalized): RouteLocationNormalized;
|
35
|
+
/**
|
36
|
+
* 深度克隆对象、数组
|
37
|
+
* @param obj 被克隆的对象
|
38
|
+
* @return 克隆后的对象
|
39
|
+
*/
|
40
|
+
export declare function cloneObject(obj: any): any;
|
41
|
+
export declare const withInstall: <T>(component: T, alias?: string) => T & Plugin;
|
42
|
+
export declare function importViewsFile(path: any): Promise<any>;
|
@@ -0,0 +1,17 @@
|
|
1
|
+
export declare function is(val: unknown, type: string): boolean;
|
2
|
+
export declare function isDef<T = unknown>(val?: T): val is T;
|
3
|
+
export declare function isUnDef<T = unknown>(val?: T): val is T;
|
4
|
+
export declare function isObject(val: any): val is Record<any, any>;
|
5
|
+
export declare function isEmpty<T = unknown>(val: T): val is T;
|
6
|
+
export declare function isNull(val: unknown): val is null;
|
7
|
+
export declare function isNullAndUnDef(val: unknown): val is null | undefined;
|
8
|
+
export declare function isNullOrUnDef(val: unknown): val is null | undefined;
|
9
|
+
export declare function isNumber(val: unknown): val is number;
|
10
|
+
export declare function isPromise<T = any>(val: any): val is Promise<T>;
|
11
|
+
export declare function isString(val: unknown): val is string;
|
12
|
+
export declare function isJsonObjectString(val: string): val is string;
|
13
|
+
export declare function isFunction(val: unknown): val is Function;
|
14
|
+
export declare function isBoolean(val: unknown): val is boolean;
|
15
|
+
export declare function isArray(val: any): val is Array<any>;
|
16
|
+
export declare function isMap(val: unknown): val is Map<any, any>;
|
17
|
+
export declare function isUrl(path: string): boolean;
|
@@ -0,0 +1,26 @@
|
|
1
|
+
/**
|
2
|
+
* copy to https://github.com/developit/mitt
|
3
|
+
* Expand clear method
|
4
|
+
*/
|
5
|
+
export declare type EventType = string | symbol;
|
6
|
+
export declare type Handler<T = any> = (event?: T) => void;
|
7
|
+
export declare type WildcardHandler = (type: EventType, event?: any) => void;
|
8
|
+
export declare type EventHandlerList = Array<Handler>;
|
9
|
+
export declare type WildCardEventHandlerList = Array<WildcardHandler>;
|
10
|
+
export declare type EventHandlerMap = Map<EventType, EventHandlerList | WildCardEventHandlerList>;
|
11
|
+
export interface Emitter {
|
12
|
+
all: EventHandlerMap;
|
13
|
+
on<T = any>(type: EventType, handler: Handler<T>): void;
|
14
|
+
on(type: '*', handler: WildcardHandler): void;
|
15
|
+
off<T = any>(type: EventType, handler: Handler<T>): void;
|
16
|
+
off(type: '*', handler: WildcardHandler): void;
|
17
|
+
emit<T = any>(type: EventType, event?: T): void;
|
18
|
+
emit(type: '*', event?: any): void;
|
19
|
+
clear(): void;
|
20
|
+
}
|
21
|
+
/**
|
22
|
+
* Mitt: Tiny (~200b) functional event emitter / pubsub.
|
23
|
+
* @name mitt
|
24
|
+
* @returns {Mitt}
|
25
|
+
*/
|
26
|
+
export declare function mitt(all?: EventHandlerMap): Emitter;
|
@@ -0,0 +1,68 @@
|
|
1
|
+
import { ExtractPropTypes, PropType } from 'vue';
|
2
|
+
declare const wrapperKey: unique symbol;
|
3
|
+
export declare type PropWrapper<T> = {
|
4
|
+
[wrapperKey]: T;
|
5
|
+
};
|
6
|
+
export declare const propKey: unique symbol;
|
7
|
+
declare type ResolveProp<T> = ExtractPropTypes<{
|
8
|
+
key: {
|
9
|
+
type: T;
|
10
|
+
required: true;
|
11
|
+
};
|
12
|
+
}>['key'];
|
13
|
+
declare type ResolvePropType<T> = ResolveProp<T> extends {
|
14
|
+
type: infer V;
|
15
|
+
} ? V : ResolveProp<T>;
|
16
|
+
declare type ResolvePropTypeWithReadonly<T> = Readonly<T> extends Readonly<Array<infer A>> ? ResolvePropType<A[]> : ResolvePropType<T>;
|
17
|
+
declare type IfUnknown<T, V> = [unknown] extends [T] ? V : T;
|
18
|
+
export declare type BuildPropOption<T, D extends BuildPropType<T, V, C>, R, V, C> = {
|
19
|
+
type?: T;
|
20
|
+
values?: readonly V[];
|
21
|
+
required?: R;
|
22
|
+
default?: R extends true ? never : D extends Record<string, unknown> | Array<any> ? () => D : (() => D) | D;
|
23
|
+
validator?: ((val: any) => val is C) | ((val: any) => boolean);
|
24
|
+
};
|
25
|
+
declare type _BuildPropType<T, V, C> = (T extends PropWrapper<unknown> ? T[typeof wrapperKey] : [V] extends [never] ? ResolvePropTypeWithReadonly<T> : never) | V | C;
|
26
|
+
export declare type BuildPropType<T, V, C> = _BuildPropType<IfUnknown<T, never>, IfUnknown<V, never>, IfUnknown<C, never>>;
|
27
|
+
declare type _BuildPropDefault<T, D> = [T] extends [
|
28
|
+
Record<string, unknown> | Array<any> | Function
|
29
|
+
] ? D : D extends () => T ? ReturnType<D> : D;
|
30
|
+
export declare type BuildPropDefault<T, D, R> = R extends true ? {
|
31
|
+
readonly default?: undefined;
|
32
|
+
} : {
|
33
|
+
readonly default: Exclude<D, undefined> extends never ? undefined : Exclude<_BuildPropDefault<T, D>, undefined>;
|
34
|
+
};
|
35
|
+
export declare type BuildPropReturn<T, D, R, V, C> = {
|
36
|
+
readonly type: PropType<BuildPropType<T, V, C>>;
|
37
|
+
readonly required: IfUnknown<R, false>;
|
38
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
39
|
+
[propKey]: true;
|
40
|
+
} & BuildPropDefault<BuildPropType<T, V, C>, IfUnknown<D, never>, IfUnknown<R, false>>;
|
41
|
+
/**
|
42
|
+
* @description Build prop. It can better optimize prop types
|
43
|
+
* @description 生成 prop,能更好地优化类型
|
44
|
+
* @example
|
45
|
+
// limited options
|
46
|
+
// the type will be PropType<'light' | 'dark'>
|
47
|
+
buildProp({
|
48
|
+
type: String,
|
49
|
+
values: ['light', 'dark'],
|
50
|
+
} as const)
|
51
|
+
* @example
|
52
|
+
// limited options and other types
|
53
|
+
// the type will be PropType<'small' | 'medium' | number>
|
54
|
+
buildProp({
|
55
|
+
type: [String, Number],
|
56
|
+
values: ['small', 'medium'],
|
57
|
+
validator: (val: unknown): val is number => typeof val === 'number',
|
58
|
+
} as const)
|
59
|
+
@link see more: https://github.com/element-plus/element-plus/pull/3341
|
60
|
+
*/
|
61
|
+
export declare function buildProp<T = never, D extends BuildPropType<T, V, C> = never, R extends boolean = false, V = never, C = never>(option: BuildPropOption<T, D, R, V, C>, key?: string): BuildPropReturn<T, D, R, V, C>;
|
62
|
+
declare type NativePropType = [((...args: any) => any) | {
|
63
|
+
new (...args: any): any;
|
64
|
+
} | undefined | null];
|
65
|
+
export declare const buildProps: <O extends { [K in keyof O]: O[K] extends BuildPropReturn<any, any, any, any, any> ? O[K] : [O[K]] extends NativePropType ? O[K] : O[K] extends BuildPropOption<infer T, infer D extends BuildPropType<infer T, infer V, infer C>, infer R, infer V, infer C> ? D extends BuildPropType<T, V, C> ? BuildPropOption<T, D, R, V, C> : never : never; }>(props: O) => { [K_1 in keyof O]: O[K_1] extends {
|
66
|
+
[propKey]: boolean;
|
67
|
+
} ? O[K_1] : [O[K_1]] extends NativePropType ? O[K_1] : O[K_1] extends BuildPropOption<infer T_1, infer _D extends BuildPropType<infer T_1, infer V_1, infer C_1>, infer R_1, infer V_1, infer C_1> ? BuildPropReturn<T_1, O[K_1]["default"], R_1, V_1, C_1> : never; };
|
68
|
+
export {};
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { IKgEventListener, IRemoveEventListener } from '@kengic/core.core';
|
2
|
+
/**
|
3
|
+
* <p>构造事件监听.</p>
|
4
|
+
* <p>在 {@link onEventFactory} 的基础上, 支持在组件卸载时自动取消监听.</p>
|
5
|
+
*
|
6
|
+
* @param param.event 事件名称.
|
7
|
+
* @param param.id 唯一标识.
|
8
|
+
* @param param.addEventListener 添加事件监听.
|
9
|
+
* @param param.removeEventListener 移除事件监听.
|
10
|
+
*/
|
11
|
+
export declare function kgOnEventFactory<E extends string, L extends IKgEventListener = any>(param: {
|
12
|
+
event: E;
|
13
|
+
eventListeners: Record<string, Record<E, Array<L>>> | any;
|
14
|
+
id?: string | undefined;
|
15
|
+
}): (listener: L, isOnce?: boolean) => IRemoveEventListener;
|
package/dist/src/util/index.d.ts
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@kengic/vue",
|
3
|
-
"version": "0.27.2-beta.
|
3
|
+
"version": "0.27.2-beta.3",
|
4
4
|
"scripts": {
|
5
5
|
"build": "npm run use-node && rimraf dist && vue-tsc && vite build",
|
6
6
|
"build:dev": "npm run use-node && rimraf dist && vue-tsc && vite build --mode development",
|
@@ -40,13 +40,14 @@
|
|
40
40
|
"@iconify/vue": "4.1.2",
|
41
41
|
"@kengic/core.core": "0.0.1-beta.22",
|
42
42
|
"@kengic/core.react": "0.0.2-beta.5",
|
43
|
-
"@kengic/pont": "1.2.17-beta.
|
43
|
+
"@kengic/pont": "1.2.17-beta.5",
|
44
44
|
"@rys-fe/vite-plugin-theme": "0.8.6",
|
45
45
|
"@thymine/xunee": "0.4.9-beta.8",
|
46
46
|
"@types/crypto-js": "4.1.1",
|
47
47
|
"@types/fs-extra": "9.0.13",
|
48
48
|
"@types/inquirer": "8.2.5",
|
49
49
|
"@types/lodash-es": "4.17.9",
|
50
|
+
"@types/md5": "2.3.5",
|
50
51
|
"@types/node": "18.18.4",
|
51
52
|
"@types/semver": "7.5.3",
|
52
53
|
"@types/store": "2.0.3",
|
@@ -68,9 +69,11 @@
|
|
68
69
|
"inquirer": "8.2.5",
|
69
70
|
"less": "4.1.3",
|
70
71
|
"lodash-es": "4.17.21",
|
72
|
+
"md5": "2.3.0",
|
71
73
|
"picocolors": "1.0.0",
|
72
74
|
"pinia": "2.0.12",
|
73
75
|
"prettier": "3.3.3",
|
76
|
+
"resize-observer-polyfill": "1.5.1",
|
74
77
|
"rimraf": "3.0.2",
|
75
78
|
"rollup": "2.79.1",
|
76
79
|
"rollup-plugin-visualizer": "5.8.3",
|