@kengic/vue 0.21.1-beta.1 → 0.21.1-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.
@@ -1,4 +1,3 @@
1
- import { StoreDefinition } from 'pinia';
2
1
  import { IKgEventCb } from '../../consts';
3
2
  import { IKgTableRequestParams } from '../KgTable';
4
3
  /**
@@ -10,6 +9,7 @@ import { IKgTableRequestParams } from '../KgTable';
10
9
  export declare type IKgSearchEvent = 'ready' | 'search' | 'reset';
11
10
  /** 事件监听函数: ready. */
12
11
  export declare type IKgSearchReadyCb = ((param: any) => Promise<boolean>) & IKgEventCb;
12
+ /** 事件监听函数: search. */
13
13
  export declare type IKgSearchSearchCb = ((param: IKgTableRequestParams) => Promise<boolean>) & IKgEventCb;
14
14
  /** 事件监听函数: reset. */
15
15
  export declare type IKgSearchResetCb = ((param: any) => Promise<boolean>) & IKgEventCb;
@@ -19,33 +19,198 @@ export declare type IKgSearchCb = IKgSearchReadyCb | IKgSearchSearchCb | IKgSear
19
19
  export declare type IKgSearchSearchFn = (param?: IKgTableRequestParams) => void;
20
20
  /** 重置方法. */
21
21
  export declare type IKgSearchResetFn = () => void;
22
- export interface IKgSearchState {
23
- /** 是否就绪: 查询字段初始完成, 组件渲染完成. */
22
+ export declare const useKgSearchStore: import("pinia").StoreDefinition<"KgSearch", {
23
+ /**
24
+ * 是否就绪: 查询字段初始完成, 组件渲染完成.
25
+ */
24
26
  isReadyMap: Map<string, boolean>;
25
27
  /** 表单数据对象. */
26
28
  modelMap: Map<string, Record<string, any>>;
27
- /** 高级查询的操作符表单数据对象. */
28
- operatorModelMap: Map<string, Record<string, string>>;
29
29
  /** 事件监听函数列表: ready. */
30
- onReadyListenersMap: Map<string, Array<IKgSearchReadyCb>>;
31
- /** 事件监听函数列表: search. */
32
- onSearchListenersMap: Map<string, Array<IKgSearchSearchCb>>;
30
+ onReadyListenersMap: Map<string, IKgSearchReadyCb[]>;
33
31
  /** 事件监听函数列表: reset. */
34
- onResetListenersMap: Map<string, Array<IKgSearchResetCb>>;
35
- /** 查询方法, 可供外部调用, 用来触发查询操作. */
36
- searchFnMap: Map<string, IKgSearchSearchFn>;
32
+ onResetListenersMap: Map<string, IKgSearchResetCb[]>;
33
+ /** 事件监听函数列表: search. */
34
+ onSearchListenersMap: Map<string, IKgSearchSearchCb[]>;
35
+ /** 高级查询的操作符表单数据对象. */
36
+ operatorModelMap: Map<string, Record<string, string>>;
37
37
  /** 重置方法, 可供外部调用, 用来触发重置操作. */
38
38
  resetFnMap: Map<string, IKgSearchResetFn>;
39
- }
40
- export declare type IKgSearchStoreDefinition = StoreDefinition<'KgSearch', IKgSearchState, {
41
- getIsReady(): (formID: string | null | undefined) => boolean;
42
- getModel(): (formID: string | null | undefined) => Record<string, any> | null;
43
- getOperatorModel(): (formID: string | null | undefined) => Record<string, string> | null;
44
- getSearchFn(): (formID: string | null | undefined) => IKgSearchSearchFn | null;
45
- getResetFn(): (formID: string | null | undefined) => IKgSearchResetFn | null;
39
+ /** 查询方法, 可供外部调用, 用来触发查询操作. */
40
+ searchFnMap: Map<string, IKgSearchSearchFn>;
46
41
  }, {
42
+ getIsReady(state: {
43
+ isReadyMap: Map<string, boolean>;
44
+ modelMap: Map<string, Record<string, any>>;
45
+ onReadyListenersMap: Map<string, IKgSearchReadyCb[]>;
46
+ onResetListenersMap: Map<string, IKgSearchResetCb[]>;
47
+ onSearchListenersMap: Map<string, IKgSearchSearchCb[]>;
48
+ operatorModelMap: Map<string, Record<string, string>>;
49
+ resetFnMap: Map<string, IKgSearchResetFn>;
50
+ searchFnMap: Map<string, IKgSearchSearchFn>;
51
+ } & import("pinia").PiniaCustomStateProperties<{
52
+ /**
53
+ * 是否就绪: 查询字段初始完成, 组件渲染完成.
54
+ */
55
+ isReadyMap: Map<string, boolean>;
56
+ /** 表单数据对象. */
57
+ modelMap: Map<string, Record<string, any>>;
58
+ /** 事件监听函数列表: ready. */
59
+ onReadyListenersMap: Map<string, IKgSearchReadyCb[]>;
60
+ /** 事件监听函数列表: reset. */
61
+ onResetListenersMap: Map<string, IKgSearchResetCb[]>;
62
+ /** 事件监听函数列表: search. */
63
+ onSearchListenersMap: Map<string, IKgSearchSearchCb[]>;
64
+ /** 高级查询的操作符表单数据对象. */
65
+ operatorModelMap: Map<string, Record<string, string>>;
66
+ /** 重置方法, 可供外部调用, 用来触发重置操作. */
67
+ resetFnMap: Map<string, IKgSearchResetFn>;
68
+ /** 查询方法, 可供外部调用, 用来触发查询操作. */
69
+ searchFnMap: Map<string, IKgSearchSearchFn>;
70
+ }>): (formID: string | null | undefined) => boolean;
71
+ getModel(state: {
72
+ isReadyMap: Map<string, boolean>;
73
+ modelMap: Map<string, Record<string, any>>;
74
+ onReadyListenersMap: Map<string, IKgSearchReadyCb[]>;
75
+ onResetListenersMap: Map<string, IKgSearchResetCb[]>;
76
+ onSearchListenersMap: Map<string, IKgSearchSearchCb[]>;
77
+ operatorModelMap: Map<string, Record<string, string>>;
78
+ resetFnMap: Map<string, IKgSearchResetFn>;
79
+ searchFnMap: Map<string, IKgSearchSearchFn>;
80
+ } & import("pinia").PiniaCustomStateProperties<{
81
+ /**
82
+ * 是否就绪: 查询字段初始完成, 组件渲染完成.
83
+ */
84
+ isReadyMap: Map<string, boolean>;
85
+ /** 表单数据对象. */
86
+ modelMap: Map<string, Record<string, any>>;
87
+ /** 事件监听函数列表: ready. */
88
+ onReadyListenersMap: Map<string, IKgSearchReadyCb[]>;
89
+ /** 事件监听函数列表: reset. */
90
+ onResetListenersMap: Map<string, IKgSearchResetCb[]>;
91
+ /** 事件监听函数列表: search. */
92
+ onSearchListenersMap: Map<string, IKgSearchSearchCb[]>;
93
+ /** 高级查询的操作符表单数据对象. */
94
+ operatorModelMap: Map<string, Record<string, string>>;
95
+ /** 重置方法, 可供外部调用, 用来触发重置操作. */
96
+ resetFnMap: Map<string, IKgSearchResetFn>;
97
+ /** 查询方法, 可供外部调用, 用来触发查询操作. */
98
+ searchFnMap: Map<string, IKgSearchSearchFn>;
99
+ }>): (formID: string | null | undefined) => Record<string, any> | null;
100
+ getOperatorModel(state: {
101
+ isReadyMap: Map<string, boolean>;
102
+ modelMap: Map<string, Record<string, any>>;
103
+ onReadyListenersMap: Map<string, IKgSearchReadyCb[]>;
104
+ onResetListenersMap: Map<string, IKgSearchResetCb[]>;
105
+ onSearchListenersMap: Map<string, IKgSearchSearchCb[]>;
106
+ operatorModelMap: Map<string, Record<string, string>>;
107
+ resetFnMap: Map<string, IKgSearchResetFn>;
108
+ searchFnMap: Map<string, IKgSearchSearchFn>;
109
+ } & import("pinia").PiniaCustomStateProperties<{
110
+ /**
111
+ * 是否就绪: 查询字段初始完成, 组件渲染完成.
112
+ */
113
+ isReadyMap: Map<string, boolean>;
114
+ /** 表单数据对象. */
115
+ modelMap: Map<string, Record<string, any>>;
116
+ /** 事件监听函数列表: ready. */
117
+ onReadyListenersMap: Map<string, IKgSearchReadyCb[]>;
118
+ /** 事件监听函数列表: reset. */
119
+ onResetListenersMap: Map<string, IKgSearchResetCb[]>;
120
+ /** 事件监听函数列表: search. */
121
+ onSearchListenersMap: Map<string, IKgSearchSearchCb[]>;
122
+ /** 高级查询的操作符表单数据对象. */
123
+ operatorModelMap: Map<string, Record<string, string>>;
124
+ /** 重置方法, 可供外部调用, 用来触发重置操作. */
125
+ resetFnMap: Map<string, IKgSearchResetFn>;
126
+ /** 查询方法, 可供外部调用, 用来触发查询操作. */
127
+ searchFnMap: Map<string, IKgSearchSearchFn>;
128
+ }>): (formID: string | null | undefined) => Record<string, any> | null;
129
+ /**
130
+ * 根据 formID 获取查询方法.
131
+ * @param state
132
+ */
133
+ getSearchFn(state: {
134
+ isReadyMap: Map<string, boolean>;
135
+ modelMap: Map<string, Record<string, any>>;
136
+ onReadyListenersMap: Map<string, IKgSearchReadyCb[]>;
137
+ onResetListenersMap: Map<string, IKgSearchResetCb[]>;
138
+ onSearchListenersMap: Map<string, IKgSearchSearchCb[]>;
139
+ operatorModelMap: Map<string, Record<string, string>>;
140
+ resetFnMap: Map<string, IKgSearchResetFn>;
141
+ searchFnMap: Map<string, IKgSearchSearchFn>;
142
+ } & import("pinia").PiniaCustomStateProperties<{
143
+ /**
144
+ * 是否就绪: 查询字段初始完成, 组件渲染完成.
145
+ */
146
+ isReadyMap: Map<string, boolean>;
147
+ /** 表单数据对象. */
148
+ modelMap: Map<string, Record<string, any>>;
149
+ /** 事件监听函数列表: ready. */
150
+ onReadyListenersMap: Map<string, IKgSearchReadyCb[]>;
151
+ /** 事件监听函数列表: reset. */
152
+ onResetListenersMap: Map<string, IKgSearchResetCb[]>;
153
+ /** 事件监听函数列表: search. */
154
+ onSearchListenersMap: Map<string, IKgSearchSearchCb[]>;
155
+ /** 高级查询的操作符表单数据对象. */
156
+ operatorModelMap: Map<string, Record<string, string>>;
157
+ /** 重置方法, 可供外部调用, 用来触发重置操作. */
158
+ resetFnMap: Map<string, IKgSearchResetFn>;
159
+ /** 查询方法, 可供外部调用, 用来触发查询操作. */
160
+ searchFnMap: Map<string, IKgSearchSearchFn>;
161
+ }>): (formID: string | null | undefined) => IKgSearchSearchFn | null;
162
+ /**
163
+ * 根据 formID 获取重置方法.
164
+ * @param state
165
+ */
166
+ getResetFn(state: {
167
+ isReadyMap: Map<string, boolean>;
168
+ modelMap: Map<string, Record<string, any>>;
169
+ onReadyListenersMap: Map<string, IKgSearchReadyCb[]>;
170
+ onResetListenersMap: Map<string, IKgSearchResetCb[]>;
171
+ onSearchListenersMap: Map<string, IKgSearchSearchCb[]>;
172
+ operatorModelMap: Map<string, Record<string, string>>;
173
+ resetFnMap: Map<string, IKgSearchResetFn>;
174
+ searchFnMap: Map<string, IKgSearchSearchFn>;
175
+ } & import("pinia").PiniaCustomStateProperties<{
176
+ /**
177
+ * 是否就绪: 查询字段初始完成, 组件渲染完成.
178
+ */
179
+ isReadyMap: Map<string, boolean>;
180
+ /** 表单数据对象. */
181
+ modelMap: Map<string, Record<string, any>>;
182
+ /** 事件监听函数列表: ready. */
183
+ onReadyListenersMap: Map<string, IKgSearchReadyCb[]>;
184
+ /** 事件监听函数列表: reset. */
185
+ onResetListenersMap: Map<string, IKgSearchResetCb[]>;
186
+ /** 事件监听函数列表: search. */
187
+ onSearchListenersMap: Map<string, IKgSearchSearchCb[]>;
188
+ /** 高级查询的操作符表单数据对象. */
189
+ operatorModelMap: Map<string, Record<string, string>>;
190
+ /** 重置方法, 可供外部调用, 用来触发重置操作. */
191
+ resetFnMap: Map<string, IKgSearchResetFn>;
192
+ /** 查询方法, 可供外部调用, 用来触发查询操作. */
193
+ searchFnMap: Map<string, IKgSearchSearchFn>;
194
+ }>): (formID: string | null | undefined) => IKgSearchResetFn | null;
195
+ }, {
196
+ /**
197
+ * 清理数据.
198
+ * @param formID 页面标识.
199
+ */
47
200
  dispose(formID: string | null | undefined): void;
201
+ /**
202
+ * 注册事件监听.
203
+ * @param formID 界面标识.
204
+ * @param event 事件名称.
205
+ * @param cb 回调函数.
206
+ */
48
207
  addEventListener(formID: string, event: IKgSearchEvent, cb: IKgSearchCb): void;
208
+ /**
209
+ * 退订事件监听.
210
+ * @param formID 界面标识.
211
+ * @param event 事件名称.
212
+ * @param cb 回调函数.
213
+ */
49
214
  removeEventListener(formID: string, event: IKgSearchEvent, cb?: IKgSearchCb): void;
50
215
  /**
51
216
  * 触发事件.
@@ -54,28 +219,38 @@ export declare type IKgSearchStoreDefinition = StoreDefinition<'KgSearch', IKgSe
54
219
  * @param param 事件参数.
55
220
  */
56
221
  emit(formID: string, event: IKgSearchEvent, param: IKgSearchCbParam): Promise<boolean>;
222
+ setIsReady(formID: string | null | undefined, ready?: boolean): void;
57
223
  /**
58
- * 设置是否就绪.
224
+ * 设置表单数据.
59
225
  * @param formID 界面标识.
60
- * @param ready 是否就绪.
226
+ * @param model 表单数据.
61
227
  */
62
- setIsReady(formID: string | null | undefined, ready?: boolean): void;
63
- setModel(formID: string, model: Record<string, any>): void;
64
- setOperatorModel(formID: string, model: Record<string, string>): void;
228
+ setModel(formID: string | null | undefined, model?: Record<string, any> | null): void;
229
+ setOperatorModel(formID: string | null | undefined, model?: Record<string, any> | null): void;
230
+ /**
231
+ * 修改查询字段的表单数据的部分属性.
232
+ *
233
+ * @param formID 界面标识.
234
+ * @param properties 要修改的部分属性.
235
+ */
236
+ patchModel(formID: string | null | undefined, properties?: Record<string, any> | null): Promise<void>;
65
237
  /**
66
- * 修改部分查询字段的值.
238
+ * 修改查询字段的高级查询操作符的部分属性.
239
+ *
67
240
  * @param formID 界面标识.
68
- * @param model 要修改的查询字段.
241
+ * @param properties 要修改的部分属性.
69
242
  */
70
- patchModel(formID: string, model: Record<string, any>): Promise<void>;
243
+ patchOperatorModel(formID: string | null | undefined, properties?: Record<string, any> | null): Promise<void>;
71
244
  /**
72
- * 修改部分查询字段的高级查询操作符.
245
+ * 设置查询方法.
73
246
  * @param formID 界面标识.
74
- * @param model 要修改的查询字段.
247
+ * @param fn 查询方法.
75
248
  */
76
- patchOperatorModel(formID: string, model: Record<string, string>): Promise<void>;
77
249
  setSearchFn(formID: string | null | undefined, fn?: IKgSearchSearchFn | null): void;
250
+ /**
251
+ * 设置重置方法.
252
+ * @param formID 界面标识.
253
+ * @param fn 重置方法.
254
+ */
78
255
  setResetFn(formID: string | null | undefined, fn?: IKgSearchResetFn | null): void;
79
256
  }>;
80
- export declare type IKgSearchStore = ReturnType<IKgSearchStoreDefinition>;
81
- export declare const useKgSearchStore: () => IKgSearchStoreDefinition;
@@ -11,15 +11,19 @@ export declare function useKgSubmit(formID?: string | null): {
11
11
  isLoading(): (formID?: string | null | undefined) => boolean;
12
12
  getModel(): (formID: string | null | undefined) => Record<string, any> | null;
13
13
  getFormRef(): (formID?: string | null | undefined) => import("vue").Ref<import("ant-design-vue").FormInstance | null>;
14
- getRules(): (formID?: string | null | undefined) => import("vue").Ref<Record<string, import("ant-design-vue/es/form").RuleObject[]>>;
15
- }, {
16
- dispose(formID?: string | null | undefined): void;
17
- /**
18
- * <p>事件: 请求失败. 请求失败了, 或者请求返回了错误消息.</p>
14
+ getRules(): (formID?: string | null | undefined) => import("vue").Ref<Record<string, import("ant-design-vue/es/form").RuleObject[]>>; /**
15
+ * <p>事件: 关闭提交弹窗. 下面几种场景都会触发此事件:</p>
16
+ * <ul>
17
+ * <li>点击右上角的关闭按钮,</li>
18
+ * <li>点击取消按钮,</li>
19
+ * <li>点击保存按钮之后, 调用接口成功, 关闭弹窗,</li>
20
+ * </ul>
19
21
  * @param cb 回调函数.
20
22
  * @param once 是否只会触发一次. 默认为 undefined.
21
23
  * @return {} 移除事件监听函数.
22
24
  */
25
+ }, {
26
+ dispose(formID?: string | null | undefined): void;
23
27
  addEventListener(formID: string, event: IKgSubmitEvent, cb: import("./index.store").IKgSubmitCb): void;
24
28
  removeEventListener(formID: string, event: IKgSubmitEvent, cb?: import("./index.store").IKgSubmitCb | undefined): void;
25
29
  emit(formID: string, event: IKgSubmitEvent, param: import("./index.store").IKgSubmitCbParam): Promise<boolean>;
@@ -94,7 +98,12 @@ export declare function useKgSubmit(formID?: string | null): {
94
98
  */
95
99
  onError: (cb: IKgSubmitErrorCb, once?: boolean | undefined) => import("../../consts").IRemoveEventListenerHandler;
96
100
  /**
97
- * <p>事件: 关闭提交弹窗. 点击取消或者点击确定并且成功之后, 都会触发.</p>
101
+ * <p>事件: 关闭提交弹窗. 下面几种场景都会触发此事件:</p>
102
+ * <ul>
103
+ * <li>点击右上角的关闭按钮,</li>
104
+ * <li>点击取消按钮,</li>
105
+ * <li>点击保存按钮之后, 调用接口成功, 关闭弹窗,</li>
106
+ * </ul>
98
107
  * @param cb 回调函数.
99
108
  * @param once 是否只会触发一次. 默认为 undefined.
100
109
  * @return {} 移除事件监听函数.
@@ -69,12 +69,22 @@ export declare type IKgSubmitAfterValidateCbParam = {
69
69
  export declare type IKgSubmitAfterValidateCb = ((param: IKgSubmitAfterValidateCbParam) => Promise<boolean>) & IKgEventCb;
70
70
  /** 事件监听函数: beforeRequest. */
71
71
  export declare type IKgSubmitBeforeRequestCbParam = {
72
+ /**
73
+ * <p>请求参数.</p>
74
+ * <p>是一个对象或者列表.</p>
75
+ */
72
76
  data: Ref<Record<string, any> | Array<Record<string, any>>>;
73
77
  isCopying: boolean | null;
74
78
  isCreating: boolean | null;
75
79
  isDeleting: boolean | null;
76
80
  isUpdating: boolean | null;
81
+ /**
82
+ * 表单数据对象.
83
+ */
77
84
  model: Ref<Record<string, any>>;
85
+ /**
86
+ * 请求参数.
87
+ */
78
88
  params: Ref<Record<string, any>>;
79
89
  row: IKgTableRow | null;
80
90
  rows: Array<IKgTableRow> | null;
@@ -12,11 +12,13 @@ export declare type IKgTableRow = {
12
12
  export interface IKgTableRequestParams {
13
13
  /**
14
14
  * 是否查询首页, 否则查询当页.
15
+ *
15
16
  * @default false
16
17
  */
17
18
  isSearchFirstPage?: boolean;
18
19
  /**
19
- * 是否保留行的勾选状态.
20
+ * 重新查询之后, 是否保留行的勾选状态.
21
+ *
20
22
  * @default false
21
23
  */
22
24
  isPreserveSelectedRows?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kengic/vue",
3
- "version": "0.21.1-beta.1",
3
+ "version": "0.21.1-beta.2",
4
4
  "scripts": {
5
5
  "build": "npm run switch-node-version && rimraf dist && vue-tsc && vite build",
6
6
  "build:dev": "npm run switch-node-version && rimraf dist && vue-tsc && vite build --mode development",