zzz-pc-view 0.0.24 → 0.0.26
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.
- package/package.json +1 -1
- package/src/decorators/CurdKey/CurdApi.d.ts +8 -8
- package/src/decorators/CurdKey/index.d.ts +26 -17
- package/src/index.es.js +7617 -118
- package/src/index.umd.js +7 -2
- package/src/pcViews/components/curd/CurdViewHandler.d.ts +1 -0
- package/src/pcViews/components/curd/FilterView.vue.d.ts +1 -0
- package/src/utils/index.d.ts +1 -0
- package/src/utils/interval/index.d.ts +2 -0
- package/src/utils/interval/useHttpRequestInterval.d.ts +12 -0
- package/src/utils/interval/useInterval.d.ts +11 -0
- package/src/utils/mock/index.d.ts +1 -0
- package/src/utils/mock/useCurd.d.ts +17 -0
- package/src/webUtils/useNavStore.d.ts +1 -2
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosResponse } from 'axios';
|
|
2
|
-
import { httpRequest,
|
|
2
|
+
import { httpRequest, KeyMatch } from '../../utils';
|
|
3
3
|
import { TypeWithPrototype, TypeWithPrototypeWithoutNew } from '../DeclareType';
|
|
4
4
|
import { Reactive } from 'vue';
|
|
5
5
|
/**
|
|
@@ -78,15 +78,15 @@ export interface PaginationResponse<T> {
|
|
|
78
78
|
* 定义分页响应构造函数的接口。
|
|
79
79
|
* @template T - 响应中列表项的类型。
|
|
80
80
|
*/
|
|
81
|
-
export interface PaginationResponseConstructor<T> extends TypeWithPrototypeWithoutNew {
|
|
82
|
-
new (data:
|
|
81
|
+
export interface PaginationResponseConstructor<T, P extends PaginationResponse<T> = PaginationResponse<T>> extends TypeWithPrototypeWithoutNew {
|
|
82
|
+
new (data: any): P;
|
|
83
83
|
}
|
|
84
84
|
/**
|
|
85
85
|
* 定义 CURD(创建、读取、更新、删除)操作的 API 类。
|
|
86
86
|
* @template T - 表示操作的数据类型,默认为 `object`。
|
|
87
87
|
* @template P - 表示分页响应的构造函数类型,默认为 `PaginationResponseConstructor<T>`。
|
|
88
88
|
*/
|
|
89
|
-
export declare class CurdApi<T extends object = object, P extends
|
|
89
|
+
export declare class CurdApi<T extends object = object, P extends PaginationResponse<T> = PaginationResponse<T>> {
|
|
90
90
|
/**
|
|
91
91
|
* 目标类的构造函数。
|
|
92
92
|
* @protected
|
|
@@ -122,7 +122,7 @@ export declare class CurdApi<T extends object = object, P extends PaginationResp
|
|
|
122
122
|
* @protected
|
|
123
123
|
* @type {P}
|
|
124
124
|
*/
|
|
125
|
-
protected readonly PaginationResponseClass?: P
|
|
125
|
+
protected readonly PaginationResponseClass?: PaginationResponseConstructor<T, P>;
|
|
126
126
|
get hasServerPagination(): boolean;
|
|
127
127
|
/**
|
|
128
128
|
* 是否使用文件上传保存数据。
|
|
@@ -144,9 +144,9 @@ export declare class CurdApi<T extends object = object, P extends PaginationResp
|
|
|
144
144
|
* 分页获取列表数据。
|
|
145
145
|
* @param {object} pagination - 分页参数。
|
|
146
146
|
* @param {T | Reactive<T>} [query] - 查询参数。
|
|
147
|
-
* @returns {Promise<
|
|
147
|
+
* @returns {Promise<P>} - 返回一个包含分页数据的 Promise。
|
|
148
148
|
*/
|
|
149
|
-
getListByPage(pagination: object, query?: T | Reactive<T>): httpRequest.HttpRequestPromise<Awaited<
|
|
149
|
+
getListByPage(pagination: object, query?: T | Reactive<T>): httpRequest.HttpRequestPromise<Awaited<P>>;
|
|
150
150
|
/**
|
|
151
151
|
* 获取指定数据的详细信息。
|
|
152
152
|
* 这个方法会根据传入的数据对象的ID,从API获取该数据的详细信息,并将其绑定到目标类。
|
|
@@ -208,7 +208,7 @@ export declare class CurdApi<T extends object = object, P extends PaginationResp
|
|
|
208
208
|
TargetPrototye: T;
|
|
209
209
|
basePath: string;
|
|
210
210
|
treeKey?: CurdApi<T, P>['treeKey'];
|
|
211
|
-
PaginationResponseClass?: P
|
|
211
|
+
PaginationResponseClass?: PaginationResponseConstructor<T, P>;
|
|
212
212
|
saveWithUploadFile?: boolean;
|
|
213
213
|
});
|
|
214
214
|
/**
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CombineClass, CombineInstanceType, KeyMatch, WithoutFirst } from '../../utils';
|
|
2
2
|
import { BasePropertyConfig, ComponentProps, EventHandlerMap, TypeWithPrototype } from '../DeclareType';
|
|
3
3
|
import { FilterHandler } from '../FilterKey';
|
|
4
|
-
import { EditTypeEnum, CurdApi, EditType,
|
|
4
|
+
import { EditTypeEnum, CurdApi, EditType, PaginationResponse } from './CurdApi';
|
|
5
5
|
import { Config as PrimaryKeyConfig } from './../PrimaryKey';
|
|
6
6
|
import { Config as NameKeyConfig } from './../NameKey';
|
|
7
7
|
import { RequestUtilResponse } from '../useRequestUtil';
|
|
8
|
+
import { ZUtils } from '../../index-decorators';
|
|
8
9
|
export * from './CurdApi';
|
|
9
10
|
/**
|
|
10
11
|
* 基础参数接口,用于定义通用的参数属性。
|
|
@@ -131,11 +132,11 @@ interface FormParam extends ComponentParam {
|
|
|
131
132
|
* @property {PaginationRequest} [pagination] - 可选的分页请求。
|
|
132
133
|
* @property {(this: CurdHandler<T>) => { tableParam?: ComponentParam; formParam?: FormParam }} [componentCreator] - 可选的组件创建器函数,用于创建表格和表单的参数。
|
|
133
134
|
*/
|
|
134
|
-
export interface CurdHandlerParam<T extends object = object> {
|
|
135
|
+
export interface CurdHandlerParam<T extends object = object, P extends PaginationResponse<T> = PaginationResponse<T>> {
|
|
135
136
|
label: string;
|
|
136
|
-
api: CurdApi<T>;
|
|
137
|
+
api: CurdApi<T, P>;
|
|
137
138
|
pagination?: PaginationRequest;
|
|
138
|
-
componentCreator?(this: CurdHandler<T>): {
|
|
139
|
+
componentCreator?(this: CurdHandler<T, P>): {
|
|
139
140
|
tableParam?: TableParam;
|
|
140
141
|
formParam?: FormParam;
|
|
141
142
|
};
|
|
@@ -185,11 +186,11 @@ export declare enum CreateTypeEnum {
|
|
|
185
186
|
* @property {new (createType: CreateTypeEnum, ...args: any[]): T} - 一个新的构造函数,接受一个 CreateTypeEnum 类型的参数和任意数量的参数,并返回一个 T 类型的实例。
|
|
186
187
|
* @property {CurdHandler<T>} [classCurdKey] - 一个可选的属性,用于存储 CurdHandler 实例。
|
|
187
188
|
*/
|
|
188
|
-
export interface CurdModelConstructor<T extends object = object> extends TypeWithPrototype, CombineClass {
|
|
189
|
+
export interface CurdModelConstructor<T extends object = object, P extends PaginationResponse<T> = PaginationResponse<T>> extends TypeWithPrototype, CombineClass {
|
|
189
190
|
new (createType: CreateTypeEnum, ...args: any[]): T;
|
|
190
|
-
[classCurdKey]?: CurdHandler<T>;
|
|
191
|
+
[classCurdKey]?: CurdHandler<T, P>;
|
|
191
192
|
}
|
|
192
|
-
export declare abstract class CurdHandler<T extends object = object> extends FilterHandler<T> {
|
|
193
|
+
export declare abstract class CurdHandler<T extends object = object, P extends PaginationResponse<T> = PaginationResponse<T>> extends FilterHandler<T> {
|
|
193
194
|
readonly curdTargetPrototype: T;
|
|
194
195
|
/**
|
|
195
196
|
* 定义一个只读属性,用于存储 CURD 操作的目标模型构造函数。
|
|
@@ -198,7 +199,7 @@ export declare abstract class CurdHandler<T extends object = object> extends Fil
|
|
|
198
199
|
* @description 这个属性是只读的,意味着它不能被直接修改。
|
|
199
200
|
* @description 它会在组件初始化时被设置,并且在组件的整个生命周期中保持不变。
|
|
200
201
|
*/
|
|
201
|
-
protected readonly CurdTarget: CurdModelConstructor<T>;
|
|
202
|
+
protected readonly CurdTarget: CurdModelConstructor<T, P>;
|
|
202
203
|
/**
|
|
203
204
|
* 定义一个只读属性,用于存储表单项的标签。
|
|
204
205
|
* 这个属性将用于在组件中显示表单项的标签。
|
|
@@ -306,7 +307,7 @@ export declare abstract class CurdHandler<T extends object = object> extends Fil
|
|
|
306
307
|
* @description 这个属性是只读的,意味着它不能被直接修改。
|
|
307
308
|
* @description 它会在组件初始化时被设置,并且在组件的整个生命周期中保持不变。
|
|
308
309
|
*/
|
|
309
|
-
protected readonly api: CurdApi<T,
|
|
310
|
+
protected readonly api: CurdApi<T, P>;
|
|
310
311
|
/**
|
|
311
312
|
* 定义一个可选的只读属性,用于存储分页配置。
|
|
312
313
|
* 这个属性将用于在组件中控制分页行为。
|
|
@@ -380,7 +381,7 @@ export declare abstract class CurdHandler<T extends object = object> extends Fil
|
|
|
380
381
|
* @param {T} data - 包含名称的对象。
|
|
381
382
|
* @returns {string} - 数据的名称,如果没有配置名称键,则返回一个空字符串。
|
|
382
383
|
*/
|
|
383
|
-
getDataName(data: T): "" | T[KeyMatch<T,
|
|
384
|
+
getDataName(data: T): "" | T[KeyMatch<T, ZUtils.KeyValType>];
|
|
384
385
|
/**
|
|
385
386
|
* 获取名称键配置。
|
|
386
387
|
* 这个方法返回 nameKeyConfig 属性的值,它包含了名称键的配置信息。
|
|
@@ -533,11 +534,19 @@ export declare abstract class CurdHandler<T extends object = object> extends Fil
|
|
|
533
534
|
*/
|
|
534
535
|
delete(data: T): void;
|
|
535
536
|
/**
|
|
536
|
-
*
|
|
537
|
-
*
|
|
538
|
-
* @
|
|
537
|
+
* 定义一个受保护的只读属性,用于存储导出数据请求工具的响应。
|
|
538
|
+
* 这个属性将用于在组件中处理导出数据请求的加载状态和取消请求。
|
|
539
|
+
* @type {RequestUtilResponse}
|
|
540
|
+
* @description 这个属性是受保护的,意味着它只能在当前类或其子类中访问。
|
|
541
|
+
* @description 它会在组件初始化时被设置,并且在组件的整个生命周期中保持不变。
|
|
542
|
+
*/
|
|
543
|
+
protected exportRequestUtil: RequestUtilResponse;
|
|
544
|
+
/**
|
|
545
|
+
* 执行数据导出操作。
|
|
546
|
+
* 该方法会设置导出请求的加载状态,发起导出请求,处理请求结果,并在请求结束后重置加载状态。
|
|
547
|
+
* @returns {Promise<any>} - 返回一个Promise,表示导出请求的结果。
|
|
539
548
|
*/
|
|
540
|
-
export():
|
|
549
|
+
export(): Promise<void>;
|
|
541
550
|
/**
|
|
542
551
|
* 创建一个浅引用,用于存储当前步骤的索引。
|
|
543
552
|
* 这个引用将用于在组件中存储和更新当前步骤的索引。
|
|
@@ -725,7 +734,7 @@ export declare abstract class CurdHandler<T extends object = object> extends Fil
|
|
|
725
734
|
* @param {CurdHandlerParam<T>} param - 包含API和分页配置的参数对象。
|
|
726
735
|
* @param {...WithoutFirst<ConstructorParameters<typeof FilterHandler<T>>>} args - 传递给父类构造函数的参数。
|
|
727
736
|
*/
|
|
728
|
-
constructor(curdTargetPrototype: T, param: CurdHandlerParam<T>, ...args: WithoutFirst<ConstructorParameters<typeof FilterHandler<T>>>);
|
|
737
|
+
constructor(curdTargetPrototype: T, param: CurdHandlerParam<T, P>, ...args: WithoutFirst<ConstructorParameters<typeof FilterHandler<T>>>);
|
|
729
738
|
/**
|
|
730
739
|
* 根据目标对象的原型获取对应的 CURD 实例。
|
|
731
740
|
* 这个静态方法会通过目标对象的构造函数来获取其原型上的 CURD 实例。
|
|
@@ -733,7 +742,7 @@ export declare abstract class CurdHandler<T extends object = object> extends Fil
|
|
|
733
742
|
* @returns {CurdHandler<T> | undefined} - 返回 CURD 实例,如果不存在则返回 undefined。
|
|
734
743
|
* @template T - 目标对象的类型。
|
|
735
744
|
*/
|
|
736
|
-
static getCurdInstance<T extends object>(curdTargetPrototype: T): CurdHandler<T
|
|
745
|
+
static getCurdInstance<T extends object>(curdTargetPrototype: T): CurdHandler<T, PaginationResponse<T>> | undefined;
|
|
737
746
|
}
|
|
738
747
|
/**
|
|
739
748
|
* 定义一个装饰器,用于设置对象原型的配置。
|