@kengic/vue 0.10.7-beta.0 → 0.10.7

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.
@@ -5,7 +5,7 @@ export declare type IUseKgSearch = {
5
5
  formID: string;
6
6
  /** 状态数据. */
7
7
  store: IKgSearchStore;
8
- /** 是否准备就绪. 即查询条件是否已经初始化完成了. */
8
+ /** 是否就绪: 查询字段初始完成, 组件渲染完成. */
9
9
  isReady: ComputedRef<ReturnType<IKgSearchStore['getIsReady']>>;
10
10
  /** 表单数据对象. */
11
11
  model: ComputedRef<ReturnType<IKgSearchStore['getModel']>>;
@@ -18,6 +18,12 @@ export declare type IUseKgSearch = {
18
18
  search(resetPageIndex?: boolean): void;
19
19
  /** 执行重置. */
20
20
  reset(): void;
21
+ /**
22
+ * 监听事件: ready, 查询字段初始完成, 组件渲染完成.
23
+ * @param cb 回调函数.
24
+ * @param once 是否只会触发一次. 默认为 undefined.
25
+ * */
26
+ onReady(cb: IKgSearchReadyCb, once?: boolean): IRemoveEventListenerHandler;
21
27
  /**
22
28
  * 监听事件: search, 点击查询按钮, 并且表单验证通过.
23
29
  * @param cb 回调函数.
@@ -30,12 +36,6 @@ export declare type IUseKgSearch = {
30
36
  * @param once 是否只会触发一次. 默认为 undefined.
31
37
  */
32
38
  onReset(cb: IKgSearchResetCb, once?: boolean): IRemoveEventListenerHandler;
33
- /**
34
- * 监听事件: ready, 查询字段初始完成, 查询组件渲染完成.
35
- * @param cb 回调函数.
36
- * @param once 是否只会触发一次. 默认为 undefined.
37
- * */
38
- onReady(cb: IKgSearchReadyCb, once?: boolean): IRemoveEventListenerHandler;
39
39
  };
40
40
  /**
41
41
  * @param formID 界面标识.
@@ -2,11 +2,13 @@ import { StoreDefinition } from 'pinia';
2
2
  import { IKgEventCb } from '../../consts';
3
3
  /**
4
4
  * 事件类型.
5
+ * 'ready': 就绪, 查询字段初始完成, 组件渲染完成
5
6
  * 'search': 点击查询按钮, 并且表单验证通过
6
7
  * 'reset': 点击重置按钮
7
- * 'ready': 查询字段初始完成, 查询组件渲染完成
8
8
  */
9
- export declare type IKgSearchEvent = 'search' | 'reset' | 'ready';
9
+ export declare type IKgSearchEvent = 'ready' | 'search' | 'reset';
10
+ /** 事件监听函数: ready. */
11
+ export declare type IKgSearchReadyCb = ((param: any) => Promise<boolean>) & IKgEventCb;
10
12
  /** 事件监听函数: search. */
11
13
  export declare type IKgSearchSearchCbParam = {
12
14
  /** 是否从第一页开始查询. */
@@ -15,27 +17,25 @@ export declare type IKgSearchSearchCbParam = {
15
17
  export declare type IKgSearchSearchCb = ((param: IKgSearchSearchCbParam) => Promise<boolean>) & IKgEventCb;
16
18
  /** 事件监听函数: reset. */
17
19
  export declare type IKgSearchResetCb = ((param: any) => Promise<boolean>) & IKgEventCb;
18
- /** 事件监听函数: ready. */
19
- export declare type IKgSearchReadyCb = ((param: any) => Promise<boolean>) & IKgEventCb;
20
20
  export declare type IKgSearchCbParam = IKgSearchSearchCbParam;
21
- export declare type IKgSearchCb = IKgSearchSearchCb | IKgSearchResetCb | IKgSearchReadyCb;
21
+ export declare type IKgSearchCb = IKgSearchReadyCb | IKgSearchSearchCb | IKgSearchResetCb;
22
22
  /** 查询方法. */
23
23
  export declare type IKgSearchSearchFn = (resetPageIndex?: boolean) => void;
24
24
  /** 重置方法. */
25
25
  export declare type IKgSearchResetFn = () => void;
26
26
  export interface IKgSearchState {
27
- /** 是否准备就绪: 查询字段初始完成, 查询组件渲染完成. */
27
+ /** 是否就绪: 查询字段初始完成, 组件渲染完成. */
28
28
  isReadyMap: Map<string, boolean>;
29
29
  /** 表单数据对象. */
30
30
  modelMap: Map<string, Record<string, any>>;
31
31
  /** 高级查询的操作符表单数据对象. */
32
32
  operatorModelMap: Map<string, Record<string, string>>;
33
+ /** 事件监听函数列表: ready. */
34
+ onReadyListenersMap: Map<string, Array<IKgSearchReadyCb>>;
33
35
  /** 事件监听函数列表: search. */
34
36
  onSearchListenersMap: Map<string, Array<IKgSearchSearchCb>>;
35
37
  /** 事件监听函数列表: reset. */
36
38
  onResetListenersMap: Map<string, Array<IKgSearchResetCb>>;
37
- /** 事件监听函数列表: ready. */
38
- onReadyListenersMap: Map<string, Array<IKgSearchReadyCb>>;
39
39
  /** 查询方法, 可供外部调用, 用来触发查询操作. */
40
40
  searchFnMap: Map<string, IKgSearchSearchFn>;
41
41
  /** 重置方法, 可供外部调用, 用来触发重置操作. */
@@ -43,13 +43,17 @@ export interface IKgSearchState {
43
43
  }
44
44
  export declare type IKgSearchStoreDefinition = StoreDefinition<'KgSearch', IKgSearchState, {
45
45
  /** 是否就绪. */
46
- getIsReady(): (formID?: string | null) => boolean;
47
- getModel(): (formID?: string | null) => Record<string, any> | null;
48
- getOperatorModel(): (formID?: string | null) => Record<string, string> | null;
49
- getSearchFn(): (formID?: string | null) => IKgSearchSearchFn | null;
50
- getResetFn(): (formID?: string | null) => IKgSearchResetFn | null;
46
+ getIsReady(): (formID: string | null | undefined) => boolean;
47
+ getModel(): (formID: string | null | undefined) => Record<string, any> | null;
48
+ getOperatorModel(): (formID: string | null | undefined) => Record<string, string> | null;
49
+ getSearchFn(): (formID: string | null | undefined) => IKgSearchSearchFn | null;
50
+ getResetFn(): (formID: string | null | undefined) => IKgSearchResetFn | null;
51
51
  }, {
52
- dispose(formID?: string | null): void;
52
+ /**
53
+ * 清理数据.
54
+ * @param formID 页面标识.
55
+ */
56
+ dispose(formID: string | null | undefined): void;
53
57
  addEventListener(formID: string, event: IKgSearchEvent, cb: IKgSearchCb): void;
54
58
  removeEventListener(formID: string, event: IKgSearchEvent, cb?: IKgSearchCb): void;
55
59
  /**
@@ -64,7 +68,7 @@ export declare type IKgSearchStoreDefinition = StoreDefinition<'KgSearch', IKgSe
64
68
  * @param formID 界面标识.
65
69
  * @param ready 是否就绪.
66
70
  */
67
- setIsReady(formID?: string | null, ready?: boolean): void;
71
+ setIsReady(formID: string | null | undefined, ready?: boolean): void;
68
72
  setModel(formID: string, model: Record<string, any>): void;
69
73
  setOperatorModel(formID: string, model: Record<string, string>): void;
70
74
  /**
@@ -79,8 +83,8 @@ export declare type IKgSearchStoreDefinition = StoreDefinition<'KgSearch', IKgSe
79
83
  * @param model 要修改的查询字段.
80
84
  */
81
85
  patchOperatorModel(formID: string, model: Record<string, string>): Promise<void>;
82
- setSearchFn(formID?: string | null, fn?: IKgSearchSearchFn | null): void;
83
- setResetFn(formID?: string | null, fn?: IKgSearchResetFn | null): void;
86
+ setSearchFn(formID: string | null | undefined, fn?: IKgSearchSearchFn | null): void;
87
+ setResetFn(formID: string | null | undefined, fn?: IKgSearchResetFn | null): void;
84
88
  }>;
85
89
  export declare type IKgSearchStore = ReturnType<IKgSearchStoreDefinition>;
86
90
  export declare const useKgSearchStore: () => IKgSearchStoreDefinition;
@@ -1,10 +1,12 @@
1
1
  import { ComputedRef, Ref } from 'vue';
2
2
  import { IRemoveEventListenerHandler } from '../../consts';
3
- import { IKgTableBeforeRetrieveCb, IKgTableBeforeSetDatasCb, IKgTableRetrieveCb, IKgTableRowDoubleClickCb, IKgTableStore } from './index.store';
3
+ import { IKgTableBeforeRetrieveCb, IKgTableBeforeSetDatasCb, IKgTableReadyCb, IKgTableRetrieveCb, IKgTableRowDoubleClickCb, IKgTableStore } from './index.store';
4
4
  export declare type IUseKgTable = {
5
5
  formID: string;
6
6
  /** 状态数据. */
7
7
  store: IKgTableStore;
8
+ /** 是否就绪: 配置初始完成, 组件渲染完成. */
9
+ isReady: ComputedRef<ReturnType<IKgTableStore['getIsReady']>>;
8
10
  /** 是否正在查询. */
9
11
  isRetrieving: ComputedRef<ReturnType<IKgTableStore['getIsRetrieving']>>;
10
12
  /** 当前勾选的第一行. */
@@ -29,6 +31,12 @@ export declare type IUseKgTable = {
29
31
  pageSizeOption: Ref<number>;
30
32
  /** 查询条件的界面标识. */
31
33
  profileFormID: Ref<string>;
34
+ /**
35
+ * 监听事件: ready, 配置初始完成, 组件渲染完成.
36
+ * @param cb 回调函数.
37
+ * @param once 是否只会触发一次. 默认为 undefined.
38
+ * */
39
+ onReady(cb: IKgTableReadyCb, once?: boolean): IRemoveEventListenerHandler;
32
40
  /**
33
41
  * 监听事件: 双击某行.
34
42
  * @param cb 回调函数.
@@ -6,12 +6,16 @@ import { IKgEventCb } from '../../consts';
6
6
  import { IKgTableRow } from './index.vm';
7
7
  /**
8
8
  * 事件类型.
9
+ * 'ready': 就绪, 配置初始完成, 组件渲染完成
9
10
  * 'rowDoubleClick': 双击某行.
10
11
  * 'beforeRetrieve': 即将发起查询请求.
11
12
  * 'beforeSetDatas': 查询请求成功, 表格数据尚未赋值. 此处可以对返回的列表数据作处理.
12
13
  * 'retrieve': 查询请求成功, 表格数据已经赋值.
13
14
  */
14
- export declare type IKgTableEvent = 'rowDoubleClick' | 'beforeRetrieve' | 'beforeSetDatas' | 'retrieve';
15
+ export declare type IKgTableEvent = 'ready' | 'rowDoubleClick' | 'beforeRetrieve' | 'beforeSetDatas' | 'retrieve';
16
+ /** 事件监听函数: ready. */
17
+ export declare type IKgTableReadyParam = {};
18
+ export declare type IKgTableReadyCb = ((param: IKgTableReadyParam) => Promise<boolean>) & IKgEventCb;
15
19
  /** 事件监听函数: rowDoubleClick. */
16
20
  export declare type IKgTableRowDoubleClickParam = {
17
21
  /** 双击的行. */
@@ -46,9 +50,11 @@ export declare type IKgTableRetrieveCbParam = {
46
50
  setDatas(datas: Array<IKgTableRow>): void;
47
51
  };
48
52
  export declare type IKgTableRetrieveCb = ((param: IKgTableRetrieveCbParam) => Promise<boolean>) & IKgEventCb;
49
- export declare type IKgTableCbParam = IKgTableRowDoubleClickParam | IKgTableBeforeRetrieveCbParam | IKgTableBeforeSetDatasCbParam | IKgTableRetrieveCbParam;
50
- export declare type IKgTableCb = IKgTableRowDoubleClickCb | IKgTableBeforeRetrieveCb | IKgTableBeforeSetDatasCb | IKgTableRetrieveCb;
53
+ export declare type IKgTableCbParam = IKgTableReadyParam | IKgTableRowDoubleClickParam | IKgTableBeforeRetrieveCbParam | IKgTableBeforeSetDatasCbParam | IKgTableRetrieveCbParam;
54
+ export declare type IKgTableCb = IKgTableReadyCb | IKgTableRowDoubleClickCb | IKgTableBeforeRetrieveCb | IKgTableBeforeSetDatasCb | IKgTableRetrieveCb;
51
55
  export interface IKgTableState {
56
+ /** 是否就绪: 配置初始完成, 组件渲染完成. */
57
+ isReadyMap: Map<string, boolean>;
52
58
  /** 列表数据. */
53
59
  datasMap: Map<String, Array<IKgTableRow>>;
54
60
  /** 勾选的行的主键. */
@@ -65,6 +71,8 @@ export interface IKgTableState {
65
71
  isRetrievingMap: Map<string, boolean>;
66
72
  /** 表格宽度. */
67
73
  tableWidthMap: Map<string, number>;
74
+ /** 事件监听函数列表: ready. */
75
+ onReadyListenersMap: Map<string, Array<IKgTableReadyCb>>;
68
76
  /** '双击某行'事件监听函数列表. */
69
77
  rowDoubleClickListenersMap: Map<string, Array<IKgTableRowDoubleClickCb>>;
70
78
  beforeRetrieveListenersMap: Map<string, Array<IKgTableBeforeRetrieveCb>>;
@@ -72,6 +80,8 @@ export interface IKgTableState {
72
80
  retrieveListenersMap: Map<string, Array<IKgTableRetrieveCb>>;
73
81
  }
74
82
  export declare type IKgTableStoreDefinition = StoreDefinition<'KgTable', IKgTableState, {
83
+ /** 是否就绪. */
84
+ getIsReady(): (formID: string | null | undefined) => boolean;
75
85
  /** 列表数据. */
76
86
  getDatas(): (formID: string | null | undefined) => Array<IKgTableRow>;
77
87
  /** 当前勾选的所有行的主键. */
@@ -94,6 +104,12 @@ export declare type IKgTableStoreDefinition = StoreDefinition<'KgTable', IKgTabl
94
104
  addEventListener(formID: string | null | undefined, event: IKgTableEvent, cb: IKgTableCb): void;
95
105
  removeEventListener(formID: string | null | undefined, event: IKgTableEvent, cb?: IKgTableCb): void;
96
106
  emit(formID: string | null | undefined, event: IKgTableEvent, param: IKgTableCbParam): Promise<boolean>;
107
+ /**
108
+ * 设置是否就绪.
109
+ * @param formID 界面标识.
110
+ * @param ready 是否就绪.
111
+ */
112
+ setIsReady(formID: string | null | undefined, ready?: boolean): void;
97
113
  /**
98
114
  * 设置列表数据.
99
115
  * @param formID 界面标识.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kengic/vue",
3
- "version": "0.10.7-beta.0",
3
+ "version": "0.10.7",
4
4
  "scripts": {
5
5
  "build": "rimraf dist && vue-tsc && vite build",
6
6
  "build:dev": "rimraf dist && vue-tsc && vite build --mode development",