jmash-core 0.0.60 → 0.0.61

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,19 +1,19 @@
1
1
  import type { AxiosPromise } from "axios";
2
- export interface EntityApi {
3
- getKey(model: EntityModel): EntityKey;
4
- findPage?(query: EntityReq): AxiosPromise<EntityPage>;
5
- findList?(query: EntityReq): AxiosPromise<EntityList>;
6
- findById(key: EntityKey): AxiosPromise<EntityModel>;
7
- create(data: EntityCreateReq): AxiosPromise<EntityModel>;
8
- update(data: EntityUpdateReq): AxiosPromise<EntityModel>;
9
- delete?(key: EntityKey): AxiosPromise<EntityModel>;
10
- batchDelete?(keys: EntityKey[]): AxiosPromise<number>;
11
- enable?(key: EntityKey, enabled: boolean): AxiosPromise<boolean>;
12
- move?(key: EntityKey, up: boolean): AxiosPromise<boolean>;
2
+ export interface EntityApi<T> {
3
+ getKey(model: EntityModel<T>): EntityKey<T>;
4
+ findPage?(query: EntityReq<T>): AxiosPromise<EntityPage<T>>;
5
+ findList?(query: EntityReq<T>): AxiosPromise<EntityList<T>>;
6
+ findById(key: EntityKey<T>): AxiosPromise<EntityModel<T>>;
7
+ create(data: EntityCreateReq<T>): AxiosPromise<EntityModel<T>>;
8
+ update(data: EntityUpdateReq<T>): AxiosPromise<EntityModel<T>>;
9
+ delete?(key: EntityKey<T>): AxiosPromise<EntityModel<T>>;
10
+ batchDelete?(keys: EntityKey<T>[]): AxiosPromise<number>;
11
+ enable?(key: EntityKey<T>, enabled: boolean): AxiosPromise<boolean>;
12
+ move?(key: EntityKey<T>, up: boolean): AxiosPromise<boolean>;
13
13
  downloadTemplate?(): AxiosPromise;
14
- exportExcel?(data: EntityExportReq): AxiosPromise;
15
- exportPdf?(data: EntityExportReq): AxiosPromise;
16
- importExcel?(data: EntityImportReq): AxiosPromise<string>;
14
+ exportExcel?(data: EntityExportReq<T>): AxiosPromise;
15
+ exportPdf?(data: EntityExportReq<T>): AxiosPromise;
16
+ importExcel?(data: EntityImportReq<T>): AxiosPromise<string>;
17
17
  }
18
18
  export interface EnumEntryReq {
19
19
  className: string;
@@ -29,54 +29,54 @@ export interface LayEntry {
29
29
  parentId: string;
30
30
  children: LayEntry[];
31
31
  }
32
- export interface EntityExportReq {
32
+ export interface EntityExportReq<T> {
33
33
  type: number;
34
34
  data: any;
35
35
  }
36
- export interface EntityReq {
36
+ export interface EntityReq<T> {
37
37
  curPage?: number;
38
38
  pageSize?: number;
39
39
  orderName?: string;
40
40
  orderAsc?: boolean;
41
41
  }
42
- export interface EntityModel {
42
+ export interface EntityModel<T> {
43
43
  }
44
- export interface EntityList {
45
- results: Array<EntityModel>;
44
+ export interface EntityList<T> {
45
+ results: Array<EntityModel<T>>;
46
46
  }
47
- export interface EntityPage {
48
- results: Array<EntityModel>;
47
+ export interface EntityPage<T> {
48
+ results: Array<EntityModel<T>>;
49
49
  curPage: number;
50
50
  pageSize: number;
51
51
  totalSize: number;
52
- subTotalDto: EntityTotal;
53
- totalDto: EntityTotal;
52
+ subTotalDto: EntityTotal<T>;
53
+ totalDto: EntityTotal<T>;
54
54
  }
55
- export interface EntityTotal {
55
+ export interface EntityTotal<T> {
56
56
  totalSize: number;
57
57
  }
58
- export interface EntityKey {
58
+ export interface EntityKey<T> {
59
59
  }
60
- export interface EntityKeyList {
60
+ export interface EntityKeyList<T> {
61
61
  }
62
- export interface EntityCreateReq {
62
+ export interface EntityCreateReq<T> {
63
63
  tenant?: string;
64
64
  requestId?: string;
65
65
  validateOnly?: boolean;
66
66
  }
67
- export interface EntityUpdateReq {
67
+ export interface EntityUpdateReq<T> {
68
68
  tenant?: string;
69
69
  requestId?: string;
70
70
  validateOnly?: boolean;
71
71
  updateMask: string;
72
72
  }
73
- export type EntityFormReq = EntityCreateReq | EntityUpdateReq;
74
- export interface EntityExportReq {
73
+ export type EntityFormReq<T> = EntityCreateReq<T> | EntityUpdateReq<T>;
74
+ export interface EntityExportReq<T> {
75
75
  title?: string;
76
76
  fileName?: string;
77
- req?: EntityReq;
77
+ req?: EntityReq<T>;
78
78
  }
79
- export interface EntityImportReq {
79
+ export interface EntityImportReq<T> {
80
80
  tenant?: string;
81
81
  requestId: string;
82
82
  fileNames?: string;
@@ -1,27 +1,27 @@
1
1
  import type { EntityApi, EntityReq, EntityModel, EntityTotal, EntityImportReq } from "../api/types";
2
2
  import type { Ref } from "vue";
3
3
  /** use table hooks */
4
- export declare function useTableHooks(t: any, api: EntityApi, query: Ref<EntityReq>): {
5
- tableHooks: TableHooks;
4
+ export declare function useTableHooks<T>(t: any, api: EntityApi<T>, query: Ref<EntityReq<T>>): {
5
+ tableHooks: TableHooks<T>;
6
6
  multipleTableRef: Ref<any>;
7
7
  queryFormRef: Ref<any>;
8
8
  listLoading: Ref<boolean>;
9
- tableData: Ref<EntityModel[]>;
9
+ tableData: Ref<EntityModel<T>[]>;
10
10
  total: Ref<number>;
11
11
  };
12
12
  /** 表格Hooks */
13
- export declare class TableHooks {
13
+ export declare class TableHooks<T> {
14
14
  multipleTableRef: Ref<any>;
15
15
  queryFormRef: Ref<any>;
16
16
  listLoading: Ref<boolean>;
17
- tableData: Ref<EntityModel[]>;
17
+ tableData: Ref<EntityModel<T>[]>;
18
18
  total: Ref<number>;
19
- totalRecord: Ref<EntityTotal>;
20
- selectionRows: Ref<EntityModel[]>;
21
- queryData: Ref<EntityReq>;
22
- api: EntityApi;
19
+ totalRecord: Ref<EntityTotal<T>>;
20
+ selectionRows: Ref<EntityModel<T>[]>;
21
+ queryData: Ref<EntityReq<T>>;
22
+ api: EntityApi<T>;
23
23
  t: any;
24
- constructor(t: any, api: EntityApi, query: Ref<EntityReq>);
24
+ constructor(t: any, api: EntityApi<T>, query: Ref<EntityReq<T>>);
25
25
  /** 获取Page列表数据. */
26
26
  getList(): void;
27
27
  /** 处理查询,如果查询数据中存在当前页数,则重置为第一页. */
@@ -29,13 +29,13 @@ export declare class TableHooks {
29
29
  handleSort(prop: string, order: string | null): void;
30
30
  resetQuery(): void;
31
31
  /** 删除记录 */
32
- deleteRecord(row: EntityModel): void;
32
+ deleteRecord(row: EntityModel<T>): void;
33
33
  /** 删除多项记录 */
34
34
  deleteRecords(): void;
35
- handleMove(row: EntityModel, up: boolean): void;
36
- enableRecord(row: EntityModel, enabled: boolean): void;
35
+ handleMove(row: EntityModel<T>, up: boolean): void;
36
+ enableRecord(row: EntityModel<T>, enabled: boolean): void;
37
37
  handleExport(name: string): void;
38
38
  handleExportPdf(name: string): void;
39
39
  downloadTemplate(name: string): void;
40
- importExcel(val: EntityImportReq): Promise<boolean>;
40
+ importExcel(val: EntityImportReq<T>): Promise<boolean>;
41
41
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jmash-core",
3
- "version": "0.0.60",
3
+ "version": "0.0.61",
4
4
  "private": false,
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dts/src/index.d.ts",