@kengic/vue 0.6.3-beta.4 → 0.6.4-beta.0
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.
@@ -2,7 +2,7 @@ import { RuleObject } from 'ant-design-vue/es/form';
|
|
2
2
|
import { FormInstance } from 'ant-design-vue/lib/form/Form';
|
3
3
|
import { Ref } from 'vue';
|
4
4
|
import { IRemoveEventListenerHandler, KG_VAR_SUBMIT__DISPLAY_TYPE } from '../../consts';
|
5
|
-
import { IKgSubmitAfterValidateCb, IKgSubmitBeforeOkCb, IKgSubmitBeforeRequestCb, IKgSubmitCloseCb, IKgSubmitOkCb, IKgSubmitOpenCb, IKgSubmitStore } from './index.store';
|
5
|
+
import { IKgSubmitAfterValidateCb, IKgSubmitBeforeOkCb, IKgSubmitBeforeRequestCb, IKgSubmitCloseCb, IKgSubmitErrorCb, IKgSubmitOkCb, IKgSubmitOpenCb, IKgSubmitStore } from './index.store';
|
6
6
|
export declare type IUseKgSubmit = {
|
7
7
|
formID: string;
|
8
8
|
/** 状态数据. */
|
@@ -13,7 +13,7 @@ export declare type IUseKgSubmit = {
|
|
13
13
|
rules: Ref<Record<string, Array<RuleObject>>>;
|
14
14
|
/** 显示方式. */
|
15
15
|
displayType: Ref<KG_VAR_SUBMIT__DISPLAY_TYPE>;
|
16
|
-
/** 监听事件:
|
16
|
+
/** 监听事件: 打开弹窗. */
|
17
17
|
onOpen(cb: IKgSubmitOpenCb): IRemoveEventListenerHandler;
|
18
18
|
/** 监听事件: 点击保存按钮之后, 执行默认逻辑之前. 可以在此时修改表单的值; 可以在此时对表单的值进行验证, 如果返回 true 表示表单验证失败, 不会再执行后面的代码. */
|
19
19
|
onBeforeOk(cb: IKgSubmitBeforeOkCb): IRemoveEventListenerHandler;
|
@@ -21,9 +21,11 @@ export declare type IUseKgSubmit = {
|
|
21
21
|
onAfterValidate(cb: IKgSubmitAfterValidateCb): IRemoveEventListenerHandler;
|
22
22
|
/** 监听事件: 发起请求之前. */
|
23
23
|
onBeforeRequest(cb: IKgSubmitBeforeRequestCb): IRemoveEventListenerHandler;
|
24
|
-
/** 监听事件: 点击保存按钮之后, 执行默认逻辑之后, 调用接口成功,
|
24
|
+
/** 监听事件: 点击保存按钮之后, 执行默认逻辑之后, 调用接口成功, 即将关闭弹窗. */
|
25
25
|
onOk(cb: IKgSubmitOkCb): IRemoveEventListenerHandler;
|
26
|
-
/** 监听事件:
|
26
|
+
/** 监听事件: 请求失败. 请求失败了, 或者请求返回了错误消息. */
|
27
|
+
onError(cb: IKgSubmitErrorCb): IRemoveEventListenerHandler;
|
28
|
+
/** 监听事件: 关闭弹窗. 点击取消或者点击确定并且成功之后, 都会触发. */
|
27
29
|
onClose(cb: IKgSubmitCloseCb): IRemoveEventListenerHandler;
|
28
30
|
};
|
29
31
|
/**
|
@@ -5,14 +5,15 @@ import { Ref } from 'vue';
|
|
5
5
|
import { IKgTableRow } from '../KgTable';
|
6
6
|
/**
|
7
7
|
* 事件类型.
|
8
|
-
* 'open':
|
9
|
-
* 'close': 关闭抽屉
|
8
|
+
* 'open': 打开弹窗
|
10
9
|
* 'beforeOk': 点击保存按钮之后, 执行默认逻辑之前
|
11
10
|
* 'afterValidate': 表单验证成功
|
12
11
|
* 'beforeRequest': 发起请求之前
|
13
|
-
* 'ok': 请求成功,
|
12
|
+
* 'ok': 请求成功, 即将关闭弹窗
|
13
|
+
* 'error': 请求失败. 请求失败了, 或者请求返回了错误消息
|
14
|
+
* 'close': 关闭弹窗
|
14
15
|
*/
|
15
|
-
export declare type IKgSubmitEvent = 'open' | 'close' | 'beforeOk' | 'afterValidate' | 'beforeRequest' | 'ok';
|
16
|
+
export declare type IKgSubmitEvent = 'open' | 'close' | 'beforeOk' | 'afterValidate' | 'beforeRequest' | 'ok' | 'error';
|
16
17
|
/** 事件监听函数: open. */
|
17
18
|
export declare type IKgSubmitOpenCbParam = {
|
18
19
|
isCreating: boolean;
|
@@ -62,7 +63,9 @@ export declare type IKgSubmitBeforeRequestCbParam = {
|
|
62
63
|
export declare type IKgSubmitBeforeRequestCb = (param: IKgSubmitBeforeRequestCbParam) => Promise<boolean>;
|
63
64
|
/** 事件监听函数: ok. */
|
64
65
|
export declare type IKgSubmitOkCb = (param?: any | null) => Promise<boolean>;
|
65
|
-
|
66
|
+
/** 事件监听函数: error. */
|
67
|
+
export declare type IKgSubmitErrorCb = (param: any) => Promise<boolean>;
|
68
|
+
export declare type IKgSubmitCb = IKgSubmitOpenCb | IKgSubmitCloseCb | IKgSubmitBeforeOkCb | IKgSubmitAfterValidateCb | IKgSubmitBeforeRequestCb | IKgSubmitOkCb | IKgSubmitErrorCb;
|
66
69
|
export interface IKgSubmitState {
|
67
70
|
openListenersMap: Map<string, Array<IKgSubmitOpenCb>>;
|
68
71
|
closeListenersMap: Map<string, Array<IKgSubmitCloseCb>>;
|
@@ -70,6 +73,7 @@ export interface IKgSubmitState {
|
|
70
73
|
afterValidateListenersMap: Map<string, Array<IKgSubmitAfterValidateCb>>;
|
71
74
|
beforeRequestListenersMap: Map<string, Array<IKgSubmitBeforeRequestCb>>;
|
72
75
|
okListenersMap: Map<string, Array<IKgSubmitOkCb>>;
|
76
|
+
errorListenersMap: Map<string, Array<IKgSubmitErrorCb>>;
|
73
77
|
isLoadingMap: Map<string, boolean>;
|
74
78
|
/** 表单数据对象. */
|
75
79
|
modelMap: Map<string, Record<string, any>>;
|
@@ -92,9 +96,9 @@ export declare type IKgSubmitStoreDefinition = StoreDefinition<'KgSubmit', IKgSu
|
|
92
96
|
* 触发事件.
|
93
97
|
* @param formID 界面标识.
|
94
98
|
* @param event 事件名称.
|
95
|
-
* @param
|
99
|
+
* @param param 数据.
|
96
100
|
*/
|
97
|
-
emit(formID: string, event: IKgSubmitEvent,
|
101
|
+
emit(formID: string, event: IKgSubmitEvent, param?: any | null): Promise<boolean>;
|
98
102
|
setIsLoading(formID: string, value: boolean): void;
|
99
103
|
setModel(formID: string, model: Record<string, any>): void;
|
100
104
|
}>;
|
@@ -54,6 +54,7 @@ export interface IKgTableCellDisplayTypeProperties {
|
|
54
54
|
*/
|
55
55
|
nilAsFalse?: boolean;
|
56
56
|
};
|
57
|
+
/** @deprecated 请使用 {@link IKgTableCellDisplayTypeProperties.DESC}. */
|
57
58
|
ENUM: Array<{
|
58
59
|
/** 变量名称. */
|
59
60
|
varName: string;
|
@@ -84,10 +85,28 @@ export interface IKgTableCellDisplayTypeProperties {
|
|
84
85
|
};
|
85
86
|
DESC: {
|
86
87
|
/**
|
87
|
-
*
|
88
|
+
* 对应的描述字段的名称.
|
88
89
|
* @default 原字段 + '_dsc'
|
89
90
|
*/
|
90
91
|
dscFieldName?: string;
|
92
|
+
/**
|
93
|
+
* 是否显示为一个 Tag 标签.
|
94
|
+
* @default false
|
95
|
+
*/
|
96
|
+
isTag?: boolean;
|
97
|
+
/**
|
98
|
+
* 如果 {@link IKgTableCellDisplayTypeProperties.DESC.isTag} 为 true,
|
99
|
+
* 则该属性用来定义每个值对应的标签颜色是什么.
|
100
|
+
*/
|
101
|
+
tagColors?: Array<{
|
102
|
+
/** 数据. */
|
103
|
+
value: any;
|
104
|
+
/**
|
105
|
+
* 颜色.
|
106
|
+
* @default 'default'
|
107
|
+
*/
|
108
|
+
color?: string;
|
109
|
+
}>;
|
91
110
|
};
|
92
111
|
}
|
93
112
|
/**
|