@kengic/vue 0.6.10-beta.1 → 0.6.10-beta.2

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.
@@ -6,12 +6,14 @@ export declare type IUseKgAppSelect = {
6
6
  /**
7
7
  * 监听事件: 进入某个模块.
8
8
  * @param cb 回调函数.
9
+ * @param once 是否只会触发一次. 默认为 undefined.
9
10
  */
10
- onGotoApp(cb: IKgAppSelectGotoAppCb): IRemoveEventListenerHandler;
11
+ onGotoApp(cb: IKgAppSelectGotoAppCb, once?: boolean): IRemoveEventListenerHandler;
11
12
  /**
12
13
  * 监听事件: 进入某个地址.
13
14
  * @param cb 回调函数.
15
+ * @param once 是否只会触发一次. 默认为 undefined.
14
16
  */
15
- onGotoPath(cb: IKgAppSelectGotoPathCb): IRemoveEventListenerHandler;
17
+ onGotoPath(cb: IKgAppSelectGotoPathCb, once?: boolean): IRemoveEventListenerHandler;
16
18
  };
17
19
  export declare function useKgAppSelect(): IUseKgAppSelect;
@@ -1,5 +1,5 @@
1
1
  import { StoreDefinition } from 'pinia';
2
- import { KG_APP, Menu } from '../../consts';
2
+ import { IKgEventCb, KG_APP, Menu } from '../../consts';
3
3
  /**
4
4
  * 事件类型.
5
5
  * 'gotoApp': 进入某个模块
@@ -10,12 +10,12 @@ export declare type IKgAppSelectEvent = 'gotoApp' | 'gotoPath';
10
10
  export declare type IKgAppSelectGotoAppCbParam = {
11
11
  app: string;
12
12
  };
13
- export declare type IKgAppSelectGotoAppCb = (param: IKgAppSelectGotoAppCbParam) => Promise<boolean>;
13
+ export declare type IKgAppSelectGotoAppCb = ((param: IKgAppSelectGotoAppCbParam) => Promise<boolean>) & IKgEventCb;
14
14
  /** 事件监听函数: gotoPath. */
15
15
  export declare type IKgAppSelectGotoPathCbParam = {
16
16
  path: string;
17
17
  };
18
- export declare type IKgAppSelectGotoPathCb = (param: IKgAppSelectGotoPathCbParam) => Promise<boolean>;
18
+ export declare type IKgAppSelectGotoPathCb = ((param: IKgAppSelectGotoPathCbParam) => Promise<boolean>) & IKgEventCb;
19
19
  export declare type IKgAppSelectCb = IKgAppSelectGotoAppCb | IKgAppSelectGotoPathCb;
20
20
  export interface KgAppSelectState {
21
21
  currentApp: KG_APP | null;
@@ -15,28 +15,33 @@ export declare type IUseKgButton = {
15
15
  /**
16
16
  * 监听事件: 点击按钮.
17
17
  * @param cb 回调函数.
18
+ * @param once 是否只会触发一次. 默认为 undefined.
18
19
  */
19
- onClick(cb: IKgButtonClickCb): IRemoveEventListenerHandler;
20
+ onClick(cb: IKgButtonClickCb, once?: boolean): IRemoveEventListenerHandler;
20
21
  /**
21
22
  * 监听事件: 点击更新按钮之后, 执行默认逻辑之前. 如果返回 Promise.resolve(true), 则不再执行后续的默认逻辑.
22
23
  * @param cb 回调函数.
24
+ * @param once 是否只会触发一次. 默认为 undefined.
23
25
  */
24
- onUpdateBeforeClick(cb: IKgButtonUpdateBeforeClickCb): IRemoveEventListenerHandler;
26
+ onUpdateBeforeClick(cb: IKgButtonUpdateBeforeClickCb, once?: boolean): IRemoveEventListenerHandler;
25
27
  /**
26
28
  * 监听事件: 删除成功, 删除接口调用成功.
27
29
  * @param cb 回调函数.
30
+ * @param once 是否只会触发一次. 默认为 undefined.
28
31
  */
29
- onDeleteOk(cb: IKgButtonDeleteOkCb): IRemoveEventListenerHandler;
32
+ onDeleteOk(cb: IKgButtonDeleteOkCb, once?: boolean): IRemoveEventListenerHandler;
30
33
  /**
31
34
  * 监听事件: 表格内编辑时, 点击保存按钮.
32
35
  * @param cb 回调函数.
36
+ * @param once 是否只会触发一次. 默认为 undefined.
33
37
  */
34
- onSubmitSave(cb: IKgButtonSubmitSaveCb): IRemoveEventListenerHandler;
38
+ onSubmitSave(cb: IKgButtonSubmitSaveCb, once?: boolean): IRemoveEventListenerHandler;
35
39
  /**
36
40
  * 监听事件: 表格内编辑时, 点击取消按钮.
37
41
  * @param cb 回调函数.
42
+ * @param once 是否只会触发一次. 默认为 undefined.
38
43
  */
39
- onSubmitCancel(cb: IKgButtonSubmitCancelCb): IRemoveEventListenerHandler;
44
+ onSubmitCancel(cb: IKgButtonSubmitCancelCb, once?: boolean): IRemoveEventListenerHandler;
40
45
  };
41
46
  /**
42
47
  * @param formID 界面标识.
@@ -1,6 +1,6 @@
1
1
  import { StoreDefinition } from 'pinia';
2
2
  import { VarButton } from '../../apis/WMS/models';
3
- import { KG_BUTTON_TYPE } from '../../consts';
3
+ import { IKgEventCb, KG_BUTTON_TYPE } from '../../consts';
4
4
  import { IKgTableRow } from '../KgTable';
5
5
  /**
6
6
  * 事件类型.
@@ -12,19 +12,19 @@ import { IKgTableRow } from '../KgTable';
12
12
  */
13
13
  export declare type IKgButtonEvent = 'click' | 'updateBeforeClick' | 'deleteOk' | 'submitSave' | 'submitCancel';
14
14
  /** 事件监听函数: click. */
15
- export declare type IKgButtonClickCb = (button: VarButton) => Promise<boolean>;
15
+ export declare type IKgButtonClickCb = ((button: VarButton) => Promise<boolean>) & IKgEventCb;
16
16
  /** 事件监听函数: updateBeforeClick. */
17
17
  export declare type IKgButtonUpdateBeforeClickCbParam = {
18
18
  button?: VarButton | null;
19
19
  row?: IKgTableRow | null;
20
20
  };
21
- export declare type IKgButtonUpdateBeforeClickCb = (args: IKgButtonUpdateBeforeClickCbParam) => Promise<boolean>;
21
+ export declare type IKgButtonUpdateBeforeClickCb = ((args: IKgButtonUpdateBeforeClickCbParam) => Promise<boolean>) & IKgEventCb;
22
22
  /** 事件监听函数: deleteOk. */
23
- export declare type IKgButtonDeleteOkCb = () => Promise<boolean>;
23
+ export declare type IKgButtonDeleteOkCb = (() => Promise<boolean>) & IKgEventCb;
24
24
  /** 事件监听函数: submitSave. */
25
- export declare type IKgButtonSubmitSaveCb = () => Promise<boolean>;
25
+ export declare type IKgButtonSubmitSaveCb = (() => Promise<boolean>) & IKgEventCb;
26
26
  /** 事件监听函数: submitCancel. */
27
- export declare type IKgButtonSubmitCancelCb = () => Promise<boolean>;
27
+ export declare type IKgButtonSubmitCancelCb = (() => Promise<boolean>) & IKgEventCb;
28
28
  export declare type IKgButtonCb = IKgButtonClickCb | IKgButtonUpdateBeforeClickCb | IKgButtonDeleteOkCb | IKgButtonSubmitSaveCb | IKgButtonSubmitCancelCb;
29
29
  export interface IKgButtonState {
30
30
  clickListenersMap: Map<string, Array<IKgButtonClickCb>>;
@@ -7,13 +7,15 @@ export declare type IUseKgForm = {
7
7
  /**
8
8
  * 监听事件: 查找弹窗点击确定之前. 如果返回 true 则查找弹窗不会触发 kgOk 事件.
9
9
  * @param cb 回调函数.
10
+ * @param once 是否只会触发一次. 默认为 undefined.
10
11
  */
11
- onLookupBeforeOk(cb: IKgFormLookupBeforeOkCb): IRemoveEventListenerHandler;
12
+ onLookupBeforeOk(cb: IKgFormLookupBeforeOkCb, once?: boolean): IRemoveEventListenerHandler;
12
13
  /**
13
14
  * 监听事件: 查找弹窗点击确定.
14
15
  * @param cb 回调函数.
16
+ * @param once 是否只会触发一次. 默认为 undefined.
15
17
  */
16
- onLookupOk(cb: IKgFormLookupOkCb): IRemoveEventListenerHandler;
18
+ onLookupOk(cb: IKgFormLookupOkCb, once?: boolean): IRemoveEventListenerHandler;
17
19
  };
18
20
  /**
19
21
  * @param formID 界面标识.
@@ -1,4 +1,5 @@
1
1
  import { StoreDefinition } from 'pinia';
2
+ import { IKgEventCb } from '../../consts';
2
3
  import { IKgTableRow } from '../KgTable';
3
4
  /**
4
5
  * 事件类型.
@@ -21,7 +22,7 @@ export declare type IKgFormLookupBeforeOkCbParam = {
21
22
  /** 多选时, 勾选的所有行. */
22
23
  rows?: Array<IKgTableRow> | null;
23
24
  };
24
- export declare type IKgFormLookupBeforeOkCb = (param: IKgFormLookupBeforeOkCbParam) => Promise<boolean>;
25
+ export declare type IKgFormLookupBeforeOkCb = ((param: IKgFormLookupBeforeOkCbParam) => Promise<boolean>) & IKgEventCb;
25
26
  /** 事件监听函数: lookupOk. */
26
27
  export declare type IKgFormLookupOkCbParam = {
27
28
  /** 变量. */
@@ -37,7 +38,7 @@ export declare type IKgFormLookupOkCbParam = {
37
38
  /** 多选时, 勾选的所有行. */
38
39
  rows?: Array<IKgTableRow> | null;
39
40
  };
40
- export declare type IKgFormLookupOkCb = (param: IKgFormLookupOkCbParam) => Promise<boolean>;
41
+ export declare type IKgFormLookupOkCb = ((param: IKgFormLookupOkCbParam) => Promise<boolean>) & IKgEventCb;
41
42
  export declare type IKgFormCb = IKgFormLookupBeforeOkCb | IKgFormLookupOkCb;
42
43
  export declare type IKgFormCbParam = IKgFormLookupBeforeOkCbParam | IKgFormLookupOkCbParam;
43
44
  export interface IKgFormState {
@@ -9,24 +9,29 @@ export declare type IUseKgSearch = {
9
9
  isReady: ComputedRef<ReturnType<IKgSearchStore['getIsReady']>>;
10
10
  /** 表单数据对象. */
11
11
  model: ComputedRef<ReturnType<IKgSearchStore['getModel']>>;
12
- /** 执行查询. */
13
- search: ComputedRef<ReturnType<IKgSearchStore['getSearchFn']>>;
12
+ /**
13
+ * 执行查询.
14
+ * @param resetPageIndex 是否从第一页开始查询.
15
+ */
16
+ search(resetPageIndex?: boolean): void;
14
17
  /** 执行重置. */
15
- reset: ComputedRef<ReturnType<IKgSearchStore['getResetFn']>>;
18
+ reset(): void;
16
19
  /**
17
20
  * 监听事件: search, 点击查询按钮, 并且表单验证通过.
18
21
  * @param cb 回调函数.
22
+ * @param once 是否只会触发一次. 默认为 undefined.
19
23
  */
20
- onSearch(cb: IKgSearchSearchCb): IRemoveEventListenerHandler;
24
+ onSearch(cb: IKgSearchSearchCb, once?: boolean): IRemoveEventListenerHandler;
21
25
  /**
22
26
  * 监听事件: reset, 点击重置按钮.
23
27
  * @param cb 回调函数.
28
+ * @param once 是否只会触发一次. 默认为 undefined.
24
29
  */
25
- onReset(cb: IKgSearchResetCb): IRemoveEventListenerHandler;
30
+ onReset(cb: IKgSearchResetCb, once?: boolean): IRemoveEventListenerHandler;
26
31
  /**
27
32
  * 监听事件: ready, 查询字段初始完成, 查询组件渲染完成.
28
33
  * @param cb 回调函数.
29
- * @param once 是否只会触发一次.
34
+ * @param once 是否只会触发一次. 默认为 undefined.
30
35
  * */
31
36
  onReady(cb: IKgSearchReadyCb, once?: boolean): IRemoveEventListenerHandler;
32
37
  };
@@ -1,4 +1,5 @@
1
1
  import { StoreDefinition } from 'pinia';
2
+ import { IKgEventCb } from '../../consts';
2
3
  /**
3
4
  * 事件类型.
4
5
  * 'search': 点击查询按钮, 并且表单验证通过
@@ -12,16 +13,11 @@ export declare type IKgSearchEventParam = {
12
13
  resetPageIndex?: boolean;
13
14
  };
14
15
  /** 事件监听函数: search. */
15
- export declare type IKgSearchSearchCb = (resetPageIndex?: boolean) => void;
16
+ export declare type IKgSearchSearchCb = ((resetPageIndex?: boolean) => void) & IKgEventCb;
16
17
  /** 事件监听函数: 'reset'. */
17
- export declare type IKgSearchResetCb = () => void;
18
+ export declare type IKgSearchResetCb = ((param: any) => void) & IKgEventCb;
18
19
  /** 事件监听函数: 'ready'. */
19
- export declare type IKgSearchReadyCb = (() => void) & {
20
- /** 是否只会触发一次. */
21
- once?: boolean;
22
- /** 是否已经触发过一次了. */
23
- invoked?: boolean;
24
- };
20
+ export declare type IKgSearchReadyCb = ((param: any) => void) & IKgEventCb;
25
21
  export declare type IKgSearchCb = IKgSearchSearchCb | IKgSearchResetCb | IKgSearchReadyCb;
26
22
  /** 查询方法. */
27
23
  export declare type IKgSearchSearchFn = (resetPageIndex?: boolean) => void;
@@ -72,7 +68,7 @@ export declare type IKgSearchStoreDefinition = StoreDefinition<'KgSearch', IKgSe
72
68
  * @param formID 界面标识.
73
69
  * @param model 要修改的查询字段和值.
74
70
  */
75
- patchModel(formID: string, model: Record<string, any>): void;
71
+ patchModel(formID: string, model: Record<string, any>): Promise<void>;
76
72
  setSearchFn(formID?: string | null, fn?: IKgSearchSearchFn | null): void;
77
73
  setResetFn(formID?: string | null, fn?: IKgSearchResetFn | null): void;
78
74
  }>;
@@ -13,22 +13,40 @@ export declare type IUseKgSubmit = {
13
13
  rules: Ref<Record<string, Array<RuleObject>>>;
14
14
  /** 显示方式. */
15
15
  displayType: Ref<KG_VAR_SUBMIT__DISPLAY_TYPE>;
16
- /** 监听事件: 打开弹窗. */
17
- onOpen(cb: IKgSubmitOpenCb): IRemoveEventListenerHandler;
18
- /** 监听事件: 点击保存按钮之后, 执行默认逻辑之前. 可以在此时修改表单的值; 可以在此时对表单的值进行验证, 如果返回 true 表示表单验证失败, 不会再执行后面的代码. */
19
- onBeforeOk(cb: IKgSubmitBeforeOkCb): IRemoveEventListenerHandler;
20
- /** 监听事件: 点击保存按钮之后, 表单验证成功. 如果返回 true, 不会再执行后面的代码. */
21
- onAfterValidate(cb: IKgSubmitAfterValidateCb): IRemoveEventListenerHandler;
22
- /** 监听事件: 发起请求之前. */
23
- onBeforeRequest(cb: IKgSubmitBeforeRequestCb): IRemoveEventListenerHandler;
24
- /** 监听事件: 点击保存按钮之后, 执行默认逻辑之后, 调用接口成功, 即将关闭弹窗. */
25
- onOk(cb: IKgSubmitOkCb): IRemoveEventListenerHandler;
26
- /** 监听事件: 请求失败. 请求失败了, 或者请求返回了错误消息. */
27
- onError(cb: IKgSubmitErrorCb): IRemoveEventListenerHandler;
28
- /** 监听事件: 关闭弹窗. 点击取消或者点击确定并且成功之后, 都会触发. */
29
- onClose(cb: IKgSubmitCloseCb): IRemoveEventListenerHandler;
30
- /** 监听事件: 查找弹窗点击确定. */
31
- onLookupOk(cb: IKgSubmitLookupOkCb): IRemoveEventListenerHandler;
16
+ /**
17
+ * 监听事件: 打开弹窗.
18
+ * @param once 是否只会触发一次. 默认为 undefined.
19
+ * */
20
+ onOpen(cb: IKgSubmitOpenCb, once?: boolean): IRemoveEventListenerHandler;
21
+ /**
22
+ * 监听事件: 点击保存按钮之后, 执行默认逻辑之前. 可以在此时修改表单的值; 可以在此时对表单的值进行验证, 如果返回 true 表示表单验证失败, 不会再执行后面的代码.
23
+ * @param once 是否只会触发一次. 默认为 undefined.
24
+ */
25
+ onBeforeOk(cb: IKgSubmitBeforeOkCb, once?: boolean): IRemoveEventListenerHandler;
26
+ /** 监听事件: 点击保存按钮之后, 表单验证成功. 如果返回 true, 不会再执行后面的代码.
27
+ * @param once 是否只会触发一次. 默认为 undefined.
28
+ */
29
+ onAfterValidate(cb: IKgSubmitAfterValidateCb, once?: boolean): IRemoveEventListenerHandler;
30
+ /** 监听事件: 发起请求之前.
31
+ * @param once 是否只会触发一次. 默认为 undefined.
32
+ */
33
+ onBeforeRequest(cb: IKgSubmitBeforeRequestCb, once?: boolean): IRemoveEventListenerHandler;
34
+ /** 监听事件: 点击保存按钮之后, 执行默认逻辑之后, 调用接口成功, 即将关闭弹窗.
35
+ * @param once 是否只会触发一次. 默认为 undefined.
36
+ */
37
+ onOk(cb: IKgSubmitOkCb, once?: boolean): IRemoveEventListenerHandler;
38
+ /** 监听事件: 请求失败. 请求失败了, 或者请求返回了错误消息.
39
+ * @param once 是否只会触发一次. 默认为 undefined.
40
+ */
41
+ onError(cb: IKgSubmitErrorCb, once?: boolean): IRemoveEventListenerHandler;
42
+ /** 监听事件: 关闭弹窗. 点击取消或者点击确定并且成功之后, 都会触发.
43
+ * @param once 是否只会触发一次. 默认为 undefined.
44
+ */
45
+ onClose(cb: IKgSubmitCloseCb, once?: boolean): IRemoveEventListenerHandler;
46
+ /** 监听事件: 查找弹窗点击确定.
47
+ * @param once 是否只会触发一次. 默认为 undefined.
48
+ */
49
+ onLookupOk(cb: IKgSubmitLookupOkCb, once?: boolean): IRemoveEventListenerHandler;
32
50
  };
33
51
  /**
34
52
  * @param formID 界面标识.
@@ -2,6 +2,7 @@ import { RuleObject } from 'ant-design-vue/es/form';
2
2
  import { FormInstance } from 'ant-design-vue/lib/form/Form';
3
3
  import { StoreDefinition } from 'pinia';
4
4
  import { Ref } from 'vue';
5
+ import { IKgEventCb } from '../../consts';
5
6
  import { IKgTableRow } from '../KgTable';
6
7
  /**
7
8
  * 事件类型.
@@ -18,55 +19,63 @@ import { IKgTableRow } from '../KgTable';
18
19
  export declare type IKgSubmitEvent = 'open' | 'beforeOk' | 'afterValidate' | 'beforeRequest' | 'ok' | 'error' | 'close' | 'lookupBeforeOk' | 'lookupOk';
19
20
  /** 事件监听函数: open. */
20
21
  export declare type IKgSubmitOpenCbParam = {
21
- isCreating: boolean;
22
- isUpdating: boolean;
23
- isCopying: boolean;
24
- isDeleting: boolean;
22
+ isCreating: boolean | null;
23
+ isUpdating: boolean | null;
24
+ isCopying: boolean | null;
25
+ isDeleting: boolean | null;
25
26
  row: IKgTableRow | null;
26
27
  model: Ref<Record<string, any>>;
27
28
  };
28
- export declare type IKgSubmitOpenCb = (param: IKgSubmitOpenCbParam) => Promise<boolean>;
29
+ export declare type IKgSubmitOpenCb = ((param: IKgSubmitOpenCbParam) => Promise<boolean>) & IKgEventCb;
29
30
  /** 事件监听函数: beforeOk. */
30
31
  export declare type IKgSubmitBeforeOkCbParam = {
31
- isCreating: boolean;
32
- isUpdating: boolean;
33
- isCopying: boolean;
34
- isDeleting: boolean;
32
+ isCreating: boolean | null;
33
+ isUpdating: boolean | null;
34
+ isCopying: boolean | null;
35
+ isDeleting: boolean | null;
35
36
  row: IKgTableRow | null;
36
37
  rules: Ref<Record<string, RuleObject[]>>;
37
38
  model: Ref<Record<string, any>>;
38
39
  };
39
- export declare type IKgSubmitBeforeOkCb = (param: IKgSubmitBeforeOkCbParam) => Promise<boolean>;
40
+ export declare type IKgSubmitBeforeOkCb = ((param: IKgSubmitBeforeOkCbParam) => Promise<boolean>) & IKgEventCb;
40
41
  /** 事件监听函数: afterValidate. */
41
42
  export declare type IKgSubmitAfterValidateCbParam = {
42
- isCreating: boolean;
43
- isUpdating: boolean;
44
- isCopying: boolean;
45
- isDeleting: boolean;
43
+ isCreating: boolean | null;
44
+ isUpdating: boolean | null;
45
+ isCopying: boolean | null;
46
+ isDeleting: boolean | null;
46
47
  row: IKgTableRow | null;
47
48
  rows: Array<IKgTableRow> | null;
48
49
  model: Ref<Record<string, any>>;
49
50
  };
50
- export declare type IKgSubmitAfterValidateCb = (param: IKgSubmitAfterValidateCbParam) => Promise<boolean>;
51
+ export declare type IKgSubmitAfterValidateCb = ((param: IKgSubmitAfterValidateCbParam) => Promise<boolean>) & IKgEventCb;
51
52
  /** 事件监听函数: beforeRequest. */
52
53
  export declare type IKgSubmitBeforeRequestCbParam = {
53
- isCreating: boolean;
54
- isUpdating: boolean;
55
- isCopying: boolean;
56
- isDeleting: boolean;
54
+ isCreating: boolean | null;
55
+ isUpdating: boolean | null;
56
+ isCopying: boolean | null;
57
+ isDeleting: boolean | null;
57
58
  row: IKgTableRow | null;
58
59
  rows: Array<IKgTableRow> | null;
59
60
  model: Ref<Record<string, any>>;
60
61
  params: Ref<Record<string, any>>;
61
62
  data: Ref<Record<string, any>>;
62
63
  };
63
- export declare type IKgSubmitBeforeRequestCb = (param: IKgSubmitBeforeRequestCbParam) => Promise<boolean>;
64
+ export declare type IKgSubmitBeforeRequestCb = ((param: IKgSubmitBeforeRequestCbParam) => Promise<boolean>) & IKgEventCb;
64
65
  /** 事件监听函数: ok. */
65
- export declare type IKgSubmitOkCb = (param?: any | null) => Promise<boolean>;
66
+ export declare type IKgSubmitOkCbParam = {
67
+ isCreating: boolean | null;
68
+ isUpdating: boolean | null;
69
+ isCopying: boolean | null;
70
+ isDeleting: boolean | null;
71
+ row: IKgTableRow | null;
72
+ model: Ref<Record<string, any>>;
73
+ };
74
+ export declare type IKgSubmitOkCb = ((param: IKgSubmitOkCbParam) => Promise<boolean>) & IKgEventCb;
66
75
  /** 事件监听函数: error. */
67
- export declare type IKgSubmitErrorCb = (param: any) => Promise<boolean>;
76
+ export declare type IKgSubmitErrorCb = ((param: any) => Promise<boolean>) & IKgEventCb;
68
77
  /** 事件监听函数: close. */
69
- export declare type IKgSubmitCloseCb = (param?: any | null) => Promise<boolean>;
78
+ export declare type IKgSubmitCloseCb = ((param?: any | null) => Promise<boolean>) & IKgEventCb;
70
79
  /** 事件监听函数: lookupOk. */
71
80
  export declare type IKgSubmitLookupOkCbParam = {
72
81
  /** 变量. */
@@ -76,7 +85,8 @@ export declare type IKgSubmitLookupOkCbParam = {
76
85
  /** 多选时, 勾选的所有行. */
77
86
  rows: Array<IKgTableRow> | null;
78
87
  };
79
- export declare type IKgSubmitLookupOkCb = (param: IKgSubmitLookupOkCbParam) => Promise<boolean>;
88
+ export declare type IKgSubmitLookupOkCb = ((param: IKgSubmitLookupOkCbParam) => Promise<boolean>) & IKgEventCb;
89
+ export declare type IKgSubmitCbParam = IKgSubmitOpenCbParam | IKgSubmitBeforeOkCbParam | IKgSubmitAfterValidateCbParam | IKgSubmitBeforeRequestCbParam | IKgSubmitOkCbParam | IKgSubmitLookupOkCbParam | null;
80
90
  export declare type IKgSubmitCb = IKgSubmitOpenCb | IKgSubmitBeforeOkCb | IKgSubmitAfterValidateCb | IKgSubmitBeforeRequestCb | IKgSubmitOkCb | IKgSubmitErrorCb | IKgSubmitCloseCb | IKgSubmitLookupOkCb;
81
91
  export interface IKgSubmitState {
82
92
  openListenersMap: Map<string, Array<IKgSubmitOpenCb>>;
@@ -111,7 +121,7 @@ export declare type IKgSubmitStoreDefinition = StoreDefinition<'KgSubmit', IKgSu
111
121
  * @param event 事件名称.
112
122
  * @param param 数据.
113
123
  */
114
- emit(formID: string, event: IKgSubmitEvent, param?: any | null): Promise<boolean>;
124
+ emit(formID: string, event: IKgSubmitEvent, param: IKgSubmitCbParam): Promise<boolean>;
115
125
  setIsLoading(formID: string, value: boolean): void;
116
126
  setModel(formID: string, model: Record<string, any>): void;
117
127
  }>;
@@ -29,12 +29,20 @@ export declare type IUseKgTable = {
29
29
  pageSizeOption: Ref<number>;
30
30
  /** 查询条件的界面标识. */
31
31
  profileFormID: Ref<string>;
32
- /** 监听事件: 双击某行. */
33
- onRowDoubleClick(cb: IKgTableRowDoubleClickCb): IRemoveEventListenerHandler;
34
- /** 监听事件: 即将发起查询请求. */
35
- onBeforeRetrieve(cb: IKgTableBeforeRetrieveCb): IRemoveEventListenerHandler;
36
- /** 监听事件: 查询数据成功. */
37
- onRetrieve(cb: IKgTableRetrieveCb): IRemoveEventListenerHandler;
32
+ /** 监听事件: 双击某行.
33
+ * @param once 是否只会触发一次. 默认为 undefined.
34
+ */
35
+ onRowDoubleClick(cb: IKgTableRowDoubleClickCb, once?: boolean): IRemoveEventListenerHandler;
36
+ /** 监听事件: 即将发起查询请求.
37
+ * @param once 是否只会触发一次. 默认为 undefined.
38
+ */
39
+ onBeforeRetrieve(cb: IKgTableBeforeRetrieveCb, once?: boolean): IRemoveEventListenerHandler;
40
+ /**
41
+ * 监听事件: 查询数据成功.
42
+ * @param cb 回调函数.
43
+ * @param once 是否只会触发一次. 默认为 undefined.
44
+ */
45
+ onRetrieve(cb: IKgTableRetrieveCb, once?: boolean): IRemoveEventListenerHandler;
38
46
  };
39
47
  /**
40
48
  * @param formID 界面标识.
@@ -1,6 +1,8 @@
1
+ import { Key } from 'ant-design-vue/lib/_util/type';
1
2
  import { StoreDefinition } from 'pinia';
2
3
  import { Ref } from 'vue';
3
4
  import { IPage } from '../../apis/WMS/models';
5
+ import { IKgEventCb } from '../../consts';
4
6
  import { IKgTableRow } from './index.vm';
5
7
  /**
6
8
  * 事件类型.
@@ -10,15 +12,11 @@ import { IKgTableRow } from './index.vm';
10
12
  */
11
13
  export declare type IKgTableEvent = 'rowDoubleClick' | 'beforeRetrieve' | 'retrieve';
12
14
  /** 事件监听函数: rowDoubleClick. */
13
- export declare type IKgTableRowDoubleClickCb = (record: IKgTableRow) => Promise<boolean>;
14
- /** 事件监听函数: retrieve. */
15
- export declare type IKgTableRetrieveCbParam = {
16
- /** 接口返回的分页数据. */
17
- page: IPage<IKgTableRow> | undefined | null;
18
- /** 经过处理之后的列表数据. */
19
- datas: Ref<Array<IKgTableRow>>;
15
+ export declare type IKgTableRowDoubleClickParam = {
16
+ /** 双击的行. */
17
+ row: IKgTableRow;
20
18
  };
21
- export declare type IKgTableRetrieveCb = (param: IKgTableRetrieveCbParam) => Promise<boolean>;
19
+ export declare type IKgTableRowDoubleClickCb = ((param: IKgTableRowDoubleClickParam) => Promise<boolean>) & IKgEventCb;
22
20
  /** 事件监听函数: beforeRetrieve. */
23
21
  export declare type IKgTableBeforeRetrieveCbParam = {
24
22
  /** 查询接口请求参数. */
@@ -26,9 +24,20 @@ export declare type IKgTableBeforeRetrieveCbParam = {
26
24
  /** 查询接口返回的数据, 调用者可以直接修改该数据, 从而实现手动提供表格数据. */
27
25
  response: Ref;
28
26
  };
29
- export declare type IKgTableBeforeRetrieveCb = (param: IKgTableBeforeRetrieveCbParam) => Promise<boolean>;
27
+ export declare type IKgTableBeforeRetrieveCb = ((param: IKgTableBeforeRetrieveCbParam) => Promise<boolean>) & IKgEventCb;
28
+ /** 事件监听函数: retrieve. */
29
+ export declare type IKgTableRetrieveCbParam = {
30
+ /** 接口返回的分页数据. */
31
+ page: IPage<IKgTableRow> | undefined | null;
32
+ /** 经过处理之后的列表数据. */
33
+ datas: Ref<Array<IKgTableRow>>;
34
+ };
35
+ export declare type IKgTableRetrieveCb = ((param: IKgTableRetrieveCbParam) => Promise<boolean>) & IKgEventCb;
36
+ export declare type IKgTableCbParam = IKgTableRowDoubleClickParam | IKgTableBeforeRetrieveCbParam | IKgTableRetrieveCbParam;
30
37
  export declare type IKgTableCb = IKgTableRowDoubleClickCb | IKgTableBeforeRetrieveCb | IKgTableRetrieveCb;
31
38
  export interface IKgTableState {
39
+ /** 勾选的行的主键. */
40
+ selectedRowKeysMap: Map<string, Ref<Array<Key>>>;
32
41
  /** 勾选的行. */
33
42
  selectedRowsMap: Map<string, Array<IKgTableRow>>;
34
43
  /**
@@ -47,6 +56,8 @@ export interface IKgTableState {
47
56
  retrieveListenersMap: Map<string, Array<IKgTableRetrieveCb>>;
48
57
  }
49
58
  export declare type IKgTableStoreDefinition = StoreDefinition<'KgTable', IKgTableState, {
59
+ /** 当前勾选的所有行的主键. */
60
+ getSelectedRowKeys(): (formID?: string | null) => Ref<Array<Key>> | null;
50
61
  /** 当前勾选的所有行. */
51
62
  getSelectedRows(): (formID?: string | null) => Array<IKgTableRow> | null;
52
63
  /** 当前勾选的第一行. */
@@ -60,7 +71,7 @@ export declare type IKgTableStoreDefinition = StoreDefinition<'KgTable', IKgTabl
60
71
  dispose(formID?: string | null): void;
61
72
  addEventListener(formID: string, event: IKgTableEvent, cb: IKgTableCb): void;
62
73
  removeEventListener(formID: string, event: IKgTableEvent, cb?: IKgTableCb): void;
63
- emit(formID: string, event: IKgTableEvent, param?: any | null): Promise<boolean>;
74
+ emit(formID: string, event: IKgTableEvent, param: IKgTableCbParam): Promise<boolean>;
64
75
  setSelectedRows(formID: string, selectedRows: Array<IKgTableRow>): void;
65
76
  /**
66
77
  * 设置某行的勾选状态.
@@ -68,7 +79,7 @@ export declare type IKgTableStoreDefinition = StoreDefinition<'KgTable', IKgTabl
68
79
  * @param row 行.
69
80
  * @param selected 是否勾选.
70
81
  */
71
- setSelecte(formID: string, row: IKgTableRow, selected: boolean): void;
82
+ setRowSelect(formID: string, row: IKgTableRow, selected: boolean): void;
72
83
  setIsRetrieved(formID: string, value: boolean): void;
73
84
  setIsRetrieving(formID: string, value: boolean): void;
74
85
  setTableWidth(formID: string, value: number): void;
@@ -66,8 +66,9 @@ export declare type IUseKgVar = {
66
66
  /**
67
67
  * 监听事件: retrieve, 变量配置查询完成.
68
68
  * @param cb 回调函数.
69
+ * @param once 是否只会触发一次. 默认为 undefined.
69
70
  */
70
- onRetrieve(cb: IKgVarRetrieveCb): IRemoveEventListenerHandler;
71
+ onRetrieve(cb: IKgVarRetrieveCb, once?: boolean): IRemoveEventListenerHandler;
71
72
  /** 翻译变量. */
72
73
  t: (var_nam?: string | null) => ComputedRef<string>;
73
74
  };
@@ -1,12 +1,13 @@
1
1
  import { type StoreDefinition } from 'pinia';
2
2
  import { VarButton, VarButtonConfig, VarCatalog, VarGridConfig, VarGridDetail, VarGridDTO, VarGridMasterDTO, VarLookup, VarPossibility, VarProfileConfig, VarProfileDetail, VarProfileDTO, VarProfileMasterDTO, VarSubmitConfig, VarSubmitField, VarVariableConfig, VarVariableInput } from '../../apis/WMS/models';
3
+ import { IKgEventCb } from '../../consts';
3
4
  /**
4
5
  * 事件类型.
5
6
  * 'retrieve': 变量配置查询完成
6
7
  */
7
8
  export declare type IKgVarEvent = 'retrieve';
8
9
  /** 事件监听函数: 'retrieve'. */
9
- export declare type IKgVarRetrieveCb = () => void;
10
+ export declare type IKgVarRetrieveCb = (() => void) & IKgEventCb;
10
11
  export declare type IKgVarCb = IKgVarRetrieveCb;
11
12
  export declare type IFormID = {
12
13
  formID: string;
@@ -11,8 +11,9 @@ export declare type IUseKgWarehouse = {
11
11
  /**
12
12
  * 监听事件: 组件加载完成.
13
13
  * @param cb 回调函数.
14
+ * @param once 是否只会触发一次. 默认为 undefined.
14
15
  */
15
- onMounted(cb: IKgWarehouseMountedCb): IRemoveEventListenerHandler;
16
+ onMounted(cb: IKgWarehouseMountedCb, once?: boolean): IRemoveEventListenerHandler;
16
17
  };
17
18
  /**
18
19
  * 在某些地方调用时(比如在路由守卫中), pinia 尚未设置, 此时需要手动传入 pinia 实例.
@@ -1,12 +1,13 @@
1
1
  import { Pinia, StoreDefinition } from 'pinia';
2
2
  import { WhDTO } from '../../apis/WMS/models';
3
+ import { IKgEventCb } from '../../consts';
3
4
  /**
4
5
  * 事件类型.
5
6
  * 'mounted': 组件加载完成
6
7
  */
7
8
  export declare type IKgWarehouseEvent = 'mounted';
8
9
  /** 事件监听函数: mounted. */
9
- export declare type IKgWarehouseMountedCb = () => void;
10
+ export declare type IKgWarehouseMountedCb = (() => void) & IKgEventCb;
10
11
  export declare type IKgWarehouseCb = IKgWarehouseMountedCb;
11
12
  export interface IKgWarehouseState {
12
13
  /** 弹窗是否显示. */
@@ -1,10 +1,9 @@
1
- import { IRemoveEventListenerHandler } from '../consts';
1
+ import { IKgEventCb, IRemoveEventListenerHandler } from '../consts';
2
2
  /**
3
3
  * 构造事件监听.
4
4
  * @param frm_id 界面标识.
5
5
  * @param store 状态管理.
6
6
  * @param event 事件名称.
7
- * @param once 是否只会触发一次.
8
7
  */
9
8
  export declare function onEventFactory<S extends {
10
9
  addEventListener(frm_id: string, event: E, cb: C): void;
@@ -12,4 +11,4 @@ export declare function onEventFactory<S extends {
12
11
  } | {
13
12
  addEventListener(event: E, cb: C): void;
14
13
  removeEventListener(event: E, cb?: C): void;
15
- } = any, E = any, C = any>(frm_id: string | null, store: S, event: E, once?: boolean): (cb: C) => IRemoveEventListenerHandler;
14
+ } = any, E = any, C extends IKgEventCb = any>(frm_id: string | null, store: S, event: E): (cb: C) => IRemoveEventListenerHandler;
@@ -1,5 +1,11 @@
1
1
  /** 移除事件监听函数. */
2
2
  export declare type IRemoveEventListenerHandler = () => void;
3
+ export declare type IKgEventCb = {
4
+ /** 是否只会触发一次. */
5
+ once?: boolean;
6
+ /** 是否已经触发过一次了. */
7
+ invoked?: boolean;
8
+ };
3
9
  /** 菜单. */
4
10
  export interface Menu {
5
11
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kengic/vue",
3
- "version": "0.6.10-beta.1",
3
+ "version": "0.6.10-beta.2",
4
4
  "scripts": {
5
5
  "build": "rimraf dist && vue-tsc && vite build",
6
6
  "build:dev": "rimraf dist && vue-tsc && vite build --mode development",