@airpower/web 0.1.3 → 0.2.1

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.
Files changed (191) hide show
  1. package/README.md +12 -9
  2. package/dist/base/AbstractService.d.ts +30 -0
  3. package/dist/base/IEntity.d.ts +11 -0
  4. package/dist/base/RootEntity.d.ts +24 -0
  5. package/dist/base/RootModel.d.ts +8 -0
  6. package/dist/base/index.d.ts +4 -0
  7. package/dist/components/button/Button.vue.d.ts +114 -0
  8. package/dist/components/button/index.d.ts +3 -0
  9. package/dist/components/button/type.d.ts +1 -0
  10. package/dist/components/copy/Copy.vue.d.ts +49 -0
  11. package/dist/components/copy/index.d.ts +2 -0
  12. package/dist/components/datetime/DateTime.vue.d.ts +68 -0
  13. package/dist/components/datetime/index.d.ts +2 -0
  14. package/dist/components/desensitize/Desensitize.vue.d.ts +84 -0
  15. package/dist/components/desensitize/index.d.ts +2 -0
  16. package/dist/components/dialog/Dialog.vue.d.ts +342 -0
  17. package/dist/components/dialog/DialogProps.d.ts +191 -0
  18. package/dist/components/dialog/DialogUtil.d.ts +48 -0
  19. package/dist/components/dialog/index.d.ts +3 -0
  20. package/dist/components/empty/Empty.vue.d.ts +18 -0
  21. package/dist/components/empty/index.d.ts +2 -0
  22. package/dist/components/form/FormField.vue.d.ts +54 -0
  23. package/dist/components/form/index.d.ts +2 -0
  24. package/dist/components/frame/Frame.vue.d.ts +32 -0
  25. package/dist/components/frame/index.d.ts +2 -0
  26. package/dist/components/group/Group.vue.d.ts +144 -0
  27. package/dist/components/group/index.d.ts +2 -0
  28. package/dist/components/image/Image.vue.d.ts +48 -0
  29. package/dist/components/image/index.d.ts +2 -0
  30. package/dist/components/index.d.ts +24 -2
  31. package/dist/components/input/DateTimeType.d.ts +27 -0
  32. package/dist/components/input/Input.vue.d.ts +50 -0
  33. package/dist/components/input/index.d.ts +2 -0
  34. package/dist/components/menu/ChildMenu.vue.d.ts +17 -0
  35. package/dist/components/menu/IMenu.d.ts +24 -0
  36. package/dist/components/menu/Menu.vue.d.ts +20 -0
  37. package/dist/components/menu/index.d.ts +3 -0
  38. package/dist/components/money/Money.vue.d.ts +71 -0
  39. package/dist/components/money/index.d.ts +3 -0
  40. package/dist/components/money/type.d.ts +1 -0
  41. package/dist/components/page/Page.vue.d.ts +18 -0
  42. package/dist/components/page/index.d.ts +2 -0
  43. package/dist/components/panel/Panel.vue.d.ts +115 -0
  44. package/dist/components/panel/index.d.ts +2 -0
  45. package/dist/components/payload/IPayload.d.ts +11 -0
  46. package/dist/components/payload/Payload.vue.d.ts +35 -0
  47. package/dist/components/payload/index.d.ts +3 -0
  48. package/dist/components/phone/Call.vue.d.ts +56 -0
  49. package/dist/components/phone/Phone.vue.d.ts +69 -0
  50. package/dist/components/phone/index.d.ts +3 -0
  51. package/dist/components/qrcode/Qrcode.vue.d.ts +34 -0
  52. package/dist/components/qrcode/index.d.ts +2 -0
  53. package/dist/components/select/Select.vue.d.ts +47 -0
  54. package/dist/components/select/Selector.vue.d.ts +107 -0
  55. package/dist/components/select/index.d.ts +3 -0
  56. package/dist/components/tab/Tab.vue.d.ts +35 -0
  57. package/dist/components/tab/Tabs.vue.d.ts +17 -0
  58. package/dist/components/tab/index.d.ts +3 -0
  59. package/dist/components/table/Table.vue.d.ts +157 -0
  60. package/dist/components/table/component/ColumnSelector.vue.d.ts +20 -0
  61. package/dist/components/table/component/CopyColumn.vue.d.ts +18 -0
  62. package/dist/components/table/component/EnumColumn.vue.d.ts +20 -0
  63. package/dist/components/table/component/Export.vue.d.ts +44 -0
  64. package/dist/components/table/component/index.d.ts +5 -0
  65. package/dist/components/table/index.d.ts +2 -0
  66. package/dist/components/table/useTableButton.d.ts +74 -0
  67. package/dist/components/table/useTableColumn.d.ts +36 -0
  68. package/dist/components/table/useTableSelect.d.ts +24 -0
  69. package/dist/components/tree/TreeBox.vue.d.ts +43 -0
  70. package/dist/components/tree/index.d.ts +2 -0
  71. package/dist/components/upload/IUploadProps.d.ts +62 -0
  72. package/dist/components/upload/Upload.vue.d.ts +47 -0
  73. package/dist/components/upload/index.d.ts +3 -0
  74. package/dist/components/user/IUser.d.ts +14 -0
  75. package/dist/components/user/User.vue.d.ts +67 -0
  76. package/dist/components/user/index.d.ts +3 -0
  77. package/dist/config/WebConfig.d.ts +306 -0
  78. package/dist/config/index.d.ts +1 -0
  79. package/dist/curd/AbstractCurdService.d.ts +138 -0
  80. package/dist/curd/index.d.ts +2 -0
  81. package/dist/curd/type.d.ts +8 -0
  82. package/dist/decorator/@Field/Field.d.ts +28 -0
  83. package/dist/decorator/@Field/IFieldConfig.d.ts +18 -0
  84. package/dist/decorator/@Field/index.d.ts +2 -0
  85. package/dist/decorator/@Form/Form.d.ts +24 -0
  86. package/dist/decorator/@Form/FormTrim.d.ts +19 -0
  87. package/dist/decorator/@Form/IFormField.d.ts +224 -0
  88. package/dist/decorator/@Form/index.d.ts +3 -0
  89. package/dist/decorator/@Model/IModelConfig.d.ts +69 -0
  90. package/dist/decorator/@Model/Model.d.ts +12 -0
  91. package/dist/decorator/@Model/index.d.ts +2 -0
  92. package/dist/decorator/@Search/ISearchField.d.ts +29 -0
  93. package/dist/decorator/@Search/Search.d.ts +24 -0
  94. package/dist/decorator/@Search/index.d.ts +2 -0
  95. package/dist/decorator/{@table → @Table}/IElementTableColumn.d.ts +1 -1
  96. package/dist/decorator/@Table/ITableColumn.d.ts +63 -0
  97. package/dist/decorator/{@table → @Table}/Table.d.ts +5 -5
  98. package/dist/decorator/{@table → @Table}/index.d.ts +1 -1
  99. package/dist/decorator/common/IBaseField.d.ts +12 -0
  100. package/dist/decorator/common/index.d.ts +1 -0
  101. package/dist/decorator/index.d.ts +6 -1
  102. package/dist/enum/DisableEnum.d.ts +10 -0
  103. package/dist/enum/IWebEnum.d.ts +13 -0
  104. package/dist/enum/WebColor.d.ts +23 -0
  105. package/dist/enum/WebEnum.d.ts +20 -0
  106. package/dist/enum/index.d.ts +5 -0
  107. package/dist/enum/type.d.ts +8 -0
  108. package/dist/{controller/interface/IDetailControllerOption.d.ts → hooks/detail/IDetailOption.d.ts} +3 -4
  109. package/dist/hooks/detail/IDetailResult.d.ts +30 -0
  110. package/dist/hooks/detail/index.d.ts +3 -0
  111. package/dist/hooks/detail/useDetail.d.ts +13 -0
  112. package/dist/{controller/interface/IUseEditorOption.d.ts → hooks/editor/IEditorOption.d.ts} +13 -5
  113. package/dist/hooks/editor/IEditorResult.d.ts +29 -0
  114. package/dist/hooks/editor/index.d.ts +3 -0
  115. package/dist/hooks/editor/useEditor.d.ts +13 -0
  116. package/dist/hooks/index.d.ts +3 -0
  117. package/dist/{controller/interface/ITableControllerOption.d.ts → hooks/table/base/IBaseTableOption.d.ts} +5 -5
  118. package/dist/hooks/table/base/IBaseTableResult.d.ts +81 -0
  119. package/dist/hooks/table/base/index.d.ts +3 -0
  120. package/dist/hooks/table/base/useBaseTable.d.ts +11 -0
  121. package/dist/hooks/table/index.d.ts +4 -0
  122. package/dist/hooks/table/list/ITableOption.d.ts +8 -0
  123. package/dist/hooks/table/list/ITableResult.d.ts +33 -0
  124. package/dist/hooks/table/list/index.d.ts +3 -0
  125. package/dist/hooks/table/list/useTable.d.ts +11 -0
  126. package/dist/hooks/table/selector/ISelectorOption.d.ts +8 -0
  127. package/dist/hooks/table/selector/ISelectorResult.d.ts +19 -0
  128. package/dist/hooks/table/selector/index.d.ts +3 -0
  129. package/dist/hooks/table/selector/useSelector.d.ts +13 -0
  130. package/dist/{controller/interface/ITableTreeControllerOption.d.ts → hooks/table/tree/ITableTreeOption.d.ts} +5 -5
  131. package/dist/hooks/table/tree/ITableTreeResult.d.ts +13 -0
  132. package/dist/hooks/table/tree/index.d.ts +3 -0
  133. package/dist/hooks/table/tree/useTableTree.d.ts +12 -0
  134. package/dist/i18n/WebI18n.d.ts +52 -3
  135. package/dist/index.d.ts +7 -4
  136. package/dist/main.js +9229 -0
  137. package/dist/model/export/ExportModel.d.ts +24 -0
  138. package/dist/model/export/index.d.ts +1 -0
  139. package/dist/model/index.d.ts +3 -0
  140. package/dist/model/query/QueryPage.d.ts +15 -0
  141. package/dist/model/query/QueryRequest.d.ts +27 -0
  142. package/dist/model/query/QueryRequestPage.d.ts +13 -0
  143. package/dist/model/query/QueryResponsePage.d.ts +30 -0
  144. package/dist/model/query/QuerySort.d.ts +26 -0
  145. package/dist/model/query/index.d.ts +6 -0
  146. package/dist/model/query/type.d.ts +4 -0
  147. package/dist/model/tree/ITree.d.ts +21 -0
  148. package/dist/model/tree/index.d.ts +1 -0
  149. package/dist/type/index.d.ts +1 -0
  150. package/dist/util/feedback/FeedbackUtil.d.ts +97 -0
  151. package/dist/util/feedback/index.d.ts +2 -0
  152. package/dist/util/feedback/type.d.ts +1 -0
  153. package/dist/util/file/IFile.d.ts +10 -0
  154. package/dist/util/file/WebFileUtil.d.ts +11 -0
  155. package/dist/util/file/index.d.ts +1 -0
  156. package/dist/util/http/Http.d.ts +121 -0
  157. package/dist/util/http/HttpResponse.d.ts +19 -0
  158. package/dist/util/http/enum/HttpContentType.d.ts +27 -0
  159. package/dist/util/http/enum/HttpHeader.d.ts +15 -0
  160. package/dist/util/http/enum/HttpMethod.d.ts +12 -0
  161. package/dist/util/http/enum/HttpStatus.d.ts +31 -0
  162. package/dist/util/http/enum/index.d.ts +4 -0
  163. package/dist/util/http/index.d.ts +4 -0
  164. package/dist/util/http/type.d.ts +13 -0
  165. package/dist/util/index.d.ts +5 -1
  166. package/dist/util/permission/PermissionAction.d.ts +42 -0
  167. package/dist/util/permission/PermissionUtil.d.ts +50 -0
  168. package/dist/util/permission/index.d.ts +2 -0
  169. package/dist/util/validator/WebValidator.d.ts +198 -0
  170. package/dist/util/validator/index.d.ts +2 -0
  171. package/dist/util/validator/type.d.ts +24 -0
  172. package/dist/web.css +1531 -0
  173. package/package.json +15 -12
  174. package/dist/airpower.web.js +0 -490
  175. package/dist/components/WebTable.vue.d.ts +0 -22
  176. package/dist/controller/DetailController.d.ts +0 -29
  177. package/dist/controller/EditorController.d.ts +0 -11
  178. package/dist/controller/index.d.ts +0 -4
  179. package/dist/controller/interface/index.d.ts +0 -4
  180. package/dist/controller/table/BaseTableController.d.ts +0 -68
  181. package/dist/controller/table/TableController.d.ts +0 -36
  182. package/dist/controller/table/TableTreeController.d.ts +0 -16
  183. package/dist/controller/table/index.d.ts +0 -3
  184. package/dist/decorator/@table/ITableFieldConfig.d.ts +0 -23
  185. package/dist/http/WebHttp.d.ts +0 -18
  186. package/dist/http/index.d.ts +0 -1
  187. package/dist/service/AbstractWebService.d.ts +0 -27
  188. package/dist/service/index.d.ts +0 -1
  189. package/dist/shared/index.d.ts +0 -1
  190. package/dist/util/WebAccessTokenUtil.d.ts +0 -20
  191. /package/dist/decorator/{@table → @Table}/TableType.d.ts +0 -0
@@ -0,0 +1,24 @@
1
+ import { QueryRequest } from '../query';
2
+ import { Transformer } from '@airpower/transformer';
3
+ /**
4
+ * # 导出的数据模型
5
+ * @author Hamm.cn
6
+ */
7
+ export declare class ExportModel<R extends QueryRequest = QueryRequest> extends Transformer {
8
+ /**
9
+ * ### 创建导出任务的API地址
10
+ */
11
+ createExportTaskUrl: string;
12
+ /**
13
+ * ### 查询导出结果的 `API` 地址
14
+ */
15
+ queryExportUrl: string;
16
+ /**
17
+ * ### 请求的参数
18
+ */
19
+ param: R;
20
+ /**
21
+ * ### 下载导出文件的临时令牌
22
+ */
23
+ fileCode: string;
24
+ }
@@ -0,0 +1 @@
1
+ export * from './ExportModel';
@@ -0,0 +1,3 @@
1
+ export * from './export';
2
+ export * from './query';
3
+ export * from './tree';
@@ -0,0 +1,15 @@
1
+ import { Transformer } from '@airpower/transformer';
2
+ /**
3
+ * # 分页类
4
+ * @author Hamm.cn
5
+ */
6
+ export declare class QueryPage extends Transformer {
7
+ /**
8
+ * ### 分页页数
9
+ */
10
+ pageNum: number;
11
+ /**
12
+ * ### 每页数量
13
+ */
14
+ pageSize: number;
15
+ }
@@ -0,0 +1,27 @@
1
+ import { ITransformerConstructor, Transformer } from '@airpower/transformer';
2
+ import { RootEntity } from '../../base';
3
+ import { QuerySort } from './QuerySort';
4
+ /**
5
+ * # 请求类
6
+ * @author Hamm.cn
7
+ */
8
+ export declare class QueryRequest<E extends RootEntity = RootEntity> extends Transformer {
9
+ /**
10
+ * ### 查询信息
11
+ */
12
+ filter: E;
13
+ /**
14
+ * ### 排序信息
15
+ */
16
+ sort?: QuerySort;
17
+ /**
18
+ * ### 初始化一个请求类
19
+ * @param filterClass 如传入 `filter` 的类 将自动初始化一个空 `filter`
20
+ */
21
+ constructor(filterClass: ITransformerConstructor<E>);
22
+ /**
23
+ * ### 设置排序对象
24
+ * @param sort 排序对象
25
+ */
26
+ setSort(sort: QuerySort): this;
27
+ }
@@ -0,0 +1,13 @@
1
+ import { RootEntity } from '../../base';
2
+ import { QueryPage } from './QueryPage';
3
+ import { QueryRequest } from './QueryRequest';
4
+ /**
5
+ * # 请求分页类
6
+ * @author Hamm.cn
7
+ */
8
+ export declare class QueryRequestPage<E extends RootEntity> extends QueryRequest<E> {
9
+ /**
10
+ * ### 分页信息
11
+ */
12
+ page: QueryPage;
13
+ }
@@ -0,0 +1,30 @@
1
+ import { RootEntity } from '../../base';
2
+ import { Transformer } from '@airpower/transformer';
3
+ import { QueryPage } from './QueryPage';
4
+ import { QuerySort } from './QuerySort';
5
+ /**
6
+ * # 响应分页类
7
+ * @author Hamm.cn
8
+ */
9
+ export declare class QueryResponsePage<E extends RootEntity> extends Transformer {
10
+ /**
11
+ * ### 返回的当前页数据列表
12
+ */
13
+ list: E[];
14
+ /**
15
+ * ### 返回的页码信息
16
+ */
17
+ page: QueryPage;
18
+ /**
19
+ * ### 返回的排序信息
20
+ */
21
+ sort: QuerySort;
22
+ /**
23
+ * ### 返回总条数
24
+ */
25
+ total: number;
26
+ /**
27
+ * ### 返回总页数
28
+ */
29
+ pageCount: number;
30
+ }
@@ -0,0 +1,26 @@
1
+ import { SortType } from './type';
2
+ import { Transformer } from '@airpower/transformer';
3
+ /**
4
+ * # 排序类
5
+ * @author Hamm.cn
6
+ */
7
+ export declare class QuerySort extends Transformer {
8
+ /**
9
+ * ### 排序字段 默认 `id`
10
+ */
11
+ field: string;
12
+ /**
13
+ * ### 排序方式 默认 `desc`
14
+ */
15
+ direction: SortType;
16
+ /**
17
+ * ### 设置排序字段名
18
+ * @param field 字段名
19
+ */
20
+ setField(field: string): this;
21
+ /**
22
+ * ### 设置排序方向
23
+ * @param direction 方向
24
+ */
25
+ setDirection(direction: SortType): this;
26
+ }
@@ -0,0 +1,6 @@
1
+ export * from './QueryPage';
2
+ export * from './QueryRequest';
3
+ export * from './QueryRequestPage';
4
+ export * from './QueryResponsePage';
5
+ export * from './QuerySort';
6
+ export * from './type';
@@ -0,0 +1,4 @@
1
+ /**
2
+ * ### 排序方向
3
+ */
4
+ export type SortType = 'desc' | 'asc';
@@ -0,0 +1,21 @@
1
+ import { IEntity } from '../../base';
2
+ /**
3
+ * # 树形结构
4
+ *
5
+ * @author Hamm.cn
6
+ */
7
+ export interface ITree extends IEntity {
8
+ /**
9
+ * ### 树的子节点
10
+ * 为了成功的数据转换,请注意自行 `@Type`
11
+ */
12
+ children: this[];
13
+ /**
14
+ * ### 父节点 `ID`
15
+ */
16
+ parentId?: number;
17
+ /**
18
+ * ### 名称
19
+ */
20
+ name: string;
21
+ }
@@ -0,0 +1 @@
1
+ export * from './ITree';
@@ -0,0 +1 @@
1
+ export type ClassConstructor<T> = new (...args: unknown[]) => T;
@@ -0,0 +1,97 @@
1
+ import { FeedbackType } from './type';
2
+ /**
3
+ * ### 弹窗工具
4
+ * @author Hamm.cn
5
+ */
6
+ export declare class FeedbackUtil {
7
+ static defaultToastDuration: number;
8
+ /**
9
+ * ### 警告吐司
10
+ * @param message 消息
11
+ */
12
+ static toastWarning(message: string): void;
13
+ /**
14
+ * ### 信息吐司
15
+ * @param message 消息
16
+ */
17
+ static toastInfo(message: string): void;
18
+ /**
19
+ * ### 成功吐司
20
+ * @param message 消息
21
+ */
22
+ static toastSuccess(message: string): void;
23
+ /**
24
+ * ### 错误吐司
25
+ * @param message 错误
26
+ */
27
+ static toastError(message: string): void;
28
+ /**
29
+ * ### 显示吐司
30
+ * @param message 消息
31
+ * @param type 类型
32
+ * @param duration 显示时长
33
+ */
34
+ static showToast(message: string, type?: FeedbackType, duration?: number): void;
35
+ /**
36
+ * ### 显示确认窗
37
+ * @param message 消息
38
+ * @param title 标题
39
+ * @param type 类型
40
+ */
41
+ static showConfirm(message: string, title?: string, type?: FeedbackType): Promise<void>;
42
+ /**
43
+ * ### 显示成功确认
44
+ * @param message 消息
45
+ * @param title 标题
46
+ */
47
+ static confirmSuccess(message: string, title?: string): Promise<void>;
48
+ /**
49
+ * ### 显示错误确认
50
+ * @param message 消息
51
+ * @param title 标题
52
+ */
53
+ static confirmError(message: string, title?: string): Promise<void>;
54
+ /**
55
+ * ### 显示警告确认
56
+ * @param message 消息
57
+ * @param title 标题
58
+ */
59
+ static confirmWarning(message: string, title?: string): Promise<void>;
60
+ /**
61
+ * ### 显示信息确认
62
+ * @param message 消息
63
+ * @param title 标题
64
+ */
65
+ static confirmInfo(message: string, title?: string): Promise<void>;
66
+ /**
67
+ * ### 显示弹窗
68
+ * @param message 消息
69
+ * @param title 标题
70
+ * @param type 类型
71
+ */
72
+ static showAlert(message: string, title?: string, type?: FeedbackType): Promise<void>;
73
+ /**
74
+ * ### 显示弹窗成功
75
+ * @param message 消息
76
+ * @param title 标题
77
+ */
78
+ static alertSuccess(message: string, title?: string): Promise<void>;
79
+ /**
80
+ * ### 显示弹窗错误
81
+ * @param message 消息
82
+ * @param title 标题
83
+ */
84
+ static alertError(message: string, title?: string): Promise<void>;
85
+ /**
86
+ * ### 显示弹窗警告
87
+ * @param message 消息
88
+ * @param title 标题
89
+ */
90
+ static alertWarning(message: string, title?: string): Promise<void>;
91
+ /**
92
+ * ### 显示弹窗信息
93
+ * @param message 消息
94
+ * @param title 标题
95
+ */
96
+ static alertInfo(message: string, title?: string): Promise<void>;
97
+ }
@@ -0,0 +1,2 @@
1
+ export * from './FeedbackUtil';
2
+ export * from './type';
@@ -0,0 +1 @@
1
+ export type FeedbackType = 'info' | 'success' | 'warning' | 'error' | undefined;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * # 文件接口
3
+ * @author Hamm.cn
4
+ */
5
+ export interface IFile {
6
+ /**
7
+ * ### 文件路径
8
+ */
9
+ url: string;
10
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * # 文件助手类
3
+ * @author Hamm.cn
4
+ */
5
+ export declare class WebFileUtil {
6
+ /**
7
+ * ### 获取静态文件的绝对地址
8
+ * @param url 地址
9
+ */
10
+ static getStaticFileUrl(url: string): string;
11
+ }
@@ -0,0 +1 @@
1
+ export * from './IFile';
@@ -0,0 +1,121 @@
1
+ import { IJson, ITransformerConstructor, Transformer } from '@airpower/transformer';
2
+ import { HttpContentType, HttpHeader, HttpMethod } from './enum';
3
+ import { HttpResponse } from './HttpResponse';
4
+ /**
5
+ * # 网络请求类
6
+ *
7
+ * @author Hamm.cn
8
+ */
9
+ export declare class Http {
10
+ /**
11
+ * ### HTTP 请求前缀
12
+ */
13
+ static readonly PREFIX_HTTP = "http://";
14
+ /**
15
+ * ### HTTPS 请求前缀
16
+ */
17
+ static readonly PREFIX_HTTPS = "https://";
18
+ /**
19
+ * ### 请求方法
20
+ */
21
+ private method;
22
+ /**
23
+ * ### URL
24
+ */
25
+ private url;
26
+ /**
27
+ * ### 请求超时时间
28
+ */
29
+ private timeout;
30
+ /**
31
+ * ### 是否携带 `Cookies`
32
+ */
33
+ private widthCookie;
34
+ /**
35
+ * ### 请求头
36
+ */
37
+ private headers;
38
+ /**
39
+ * ### 错误回调
40
+ */
41
+ private errorHandler?;
42
+ /**
43
+ * ### 加载回调
44
+ */
45
+ private loadingHandler?;
46
+ /**
47
+ * ### 是否直接抛出错误
48
+ */
49
+ private isThrowError;
50
+ /**
51
+ * ### 创建一个客户端
52
+ * @param url 请求的 `URL`
53
+ * @param handlers 监听器
54
+ * @param handlers.error 错误
55
+ * @param handlers.loading 加载
56
+ */
57
+ static create(url: string, handlers?: {
58
+ error?: (error: HttpResponse) => void;
59
+ loading?: (loading: boolean) => void;
60
+ }): Http;
61
+ /**
62
+ * ### 设置请求超时时间
63
+ * @param timeout 超时毫秒数
64
+ */
65
+ setTimeout(timeout: number): this;
66
+ /**
67
+ * ### 设置请求头
68
+ * @param header 请求头
69
+ */
70
+ setHttpHeader(header: Record<HttpHeader | string, unknown>): this;
71
+ /**
72
+ * ### 允许携带 `Cookies`
73
+ */
74
+ withCredentials(): this;
75
+ /**
76
+ * ### 添加一个请求头
77
+ * @param key 请求头 `key`
78
+ * @param value 请求头 `value`
79
+ */
80
+ addHttpHeader(key: HttpHeader | string, value: string): this;
81
+ /**
82
+ * ### 设置请求方法
83
+ * @param method 请求方法
84
+ */
85
+ setMethod(method: HttpMethod): this;
86
+ /**
87
+ * ### 设置请求`content-type`
88
+ * @param contentType `content-type`
89
+ */
90
+ setContentType(contentType: HttpContentType): this;
91
+ /**
92
+ * ### 发送请求并获取转换后的模型
93
+ * @param postData 请求的数据
94
+ * @param parseClass 返回的模型
95
+ */
96
+ post<REQ extends Transformer, RES extends Transformer>(postData: REQ | REQ[] | undefined, parseClass: ITransformerConstructor<RES>): Promise<RES>;
97
+ /**
98
+ * ### 发送请求并获取转换后的模型数组
99
+ * @param postData 请求的数据
100
+ * @param parseClass 返回的模型数组
101
+ */
102
+ postArray<REQ extends Transformer, RES extends Transformer>(postData: REQ | REQ[] | undefined, parseClass: ITransformerConstructor<RES>): Promise<RES[]>;
103
+ /**
104
+ * ### 是否直接抛出错误
105
+ * @param isThrowError 是否回调错误
106
+ */
107
+ throwError(isThrowError?: boolean): this;
108
+ /**
109
+ * ### POST 发送模型/模型数组并
110
+ * @param postData 发送的数据模型(数组)
111
+ */
112
+ request<T extends Transformer>(postData?: T | T[]): Promise<IJson | IJson[]>;
113
+ /**
114
+ * ### 发送请求
115
+ *
116
+ * @param body `可选` 请求体
117
+ * @see request() 直接发送 `POST`
118
+ * @see get() 直接发送 `GET`
119
+ */
120
+ private send;
121
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * # Http请求的响应
3
+ *
4
+ * @author Hamm.cn
5
+ */
6
+ export declare class HttpResponse {
7
+ /**
8
+ * ### 业务状态码
9
+ */
10
+ code: number;
11
+ /**
12
+ * ### 返回的数据
13
+ */
14
+ data: unknown;
15
+ /**
16
+ * ### 错误信息
17
+ */
18
+ message: string;
19
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * # ContentType
3
+ *
4
+ * @author Hamm.cn
5
+ */
6
+ export declare enum HttpContentType {
7
+ /**
8
+ * ### JSON
9
+ */
10
+ JSON = "application/json",
11
+ /**
12
+ * ### 表单
13
+ */
14
+ FORM_URLENCODED = "application/x-www-form-urlencoded",
15
+ /**
16
+ * ### 文件上传
17
+ */
18
+ MULTIPART_FORM_DATA = "multipart/form-data",
19
+ /**
20
+ * ### XML
21
+ */
22
+ XML = "application/xml",
23
+ /**
24
+ * ### 纯文本
25
+ */
26
+ PLAIN = "text/plain"
27
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * # 常见请求头
3
+ *
4
+ * @author Hamm.cn
5
+ */
6
+ export declare enum HttpHeader {
7
+ /**
8
+ * ### 请求内容类型
9
+ */
10
+ CONTENT_TYPE = "Content-Type",
11
+ /**
12
+ * ### 请求认证
13
+ */
14
+ AUTHORIZATION = "Authorization"
15
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * # 请求方法
3
+ *
4
+ * @author Hamm.cn
5
+ */
6
+ export declare enum HttpMethod {
7
+ GET = "GET",
8
+ POST = "POST",
9
+ PUT = "PUT",
10
+ DELETE = "DELETE",
11
+ PATCH = "PATCH"
12
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * # HTTP 状态码
3
+ *
4
+ * @author Hamm.cn
5
+ */
6
+ export declare enum HttpStatus {
7
+ /**
8
+ * ### 200 OK
9
+ */
10
+ OK = 200,
11
+ /**
12
+ * ### 400 Bad Request
13
+ */
14
+ BAD_REQUEST = 400,
15
+ /**
16
+ * ### 401 Unauthorized
17
+ */
18
+ UNAUTHORIZED = 401,
19
+ /**
20
+ * ### 403 Forbidden
21
+ */
22
+ FORBIDDEN = 403,
23
+ /**
24
+ * ### 404 Not Found
25
+ */
26
+ NOT_FOUND = 404,
27
+ /**
28
+ * ### 500 Internal Server Error
29
+ */
30
+ INTERNAL_SERVER_ERROR = 500
31
+ }
@@ -0,0 +1,4 @@
1
+ export * from './HttpContentType';
2
+ export * from './HttpHeader';
3
+ export * from './HttpMethod';
4
+ export * from './HttpStatus';
@@ -0,0 +1,4 @@
1
+ export * from './enum';
2
+ export * from './Http';
3
+ export * from './HttpResponse';
4
+ export * from './type';
@@ -0,0 +1,13 @@
1
+ import { HttpHeader, HttpStatus } from './enum';
2
+ /**
3
+ * # 请求头KEY类型
4
+ */
5
+ export type HttpHeaderKey = HttpHeader | string;
6
+ /**
7
+ * # 请求头记录
8
+ */
9
+ export type HttpHeaderRecord = Record<HttpHeaderKey, unknown>;
10
+ /**
11
+ * # 状态码类型
12
+ */
13
+ export type HttpStatusNumber = HttpStatus | number;
@@ -1 +1,5 @@
1
- export * from './WebAccessTokenUtil';
1
+ export * from './feedback';
2
+ export * from './file';
3
+ export * from './http';
4
+ export * from './permission';
5
+ export * from './validator';
@@ -0,0 +1,42 @@
1
+ /**
2
+ * # 常用权限标识枚举
3
+ * @author Hamm.cn
4
+ */
5
+ export declare enum PermissionAction {
6
+ /**
7
+ * ### 添加
8
+ */
9
+ ADD = "add",
10
+ /**
11
+ * ### 修改
12
+ */
13
+ EDIT = "update",
14
+ /**
15
+ * ### 删除
16
+ */
17
+ DELETE = "delete",
18
+ /**
19
+ * ### 详情
20
+ */
21
+ DETAIL = "getDetail",
22
+ /**
23
+ * ### 添加下级数据
24
+ */
25
+ ADD_CHILD = "addChild",
26
+ /**
27
+ * ### 导出
28
+ */
29
+ EXPORT = "export",
30
+ /**
31
+ * ### 导入
32
+ */
33
+ IMPORT = "import",
34
+ /**
35
+ * ### 禁用
36
+ */
37
+ DISABLE = "disable",
38
+ /**
39
+ * ### 启用
40
+ */
41
+ ENABLE = "enable"
42
+ }
@@ -0,0 +1,50 @@
1
+ import { ITransformerConstructor } from '@airpower/transformer';
2
+ import { RootEntity } from '../../base';
3
+ import { PermissionAction } from './PermissionAction';
4
+ /**
5
+ * # 权限标识处理类
6
+ * @author Hamm.cn
7
+ */
8
+ export declare class PermissionUtil {
9
+ /**
10
+ * ### 权限缓存 `Key`
11
+ */
12
+ static permissionKey: string;
13
+ /**
14
+ * ### 权限列表
15
+ */
16
+ private static permissionList;
17
+ /**
18
+ * ### 获取权限标识
19
+ * - 如 `action` 对应装饰的 `xxxPermission` 是空字符串,则表示无需权限,否则:
20
+ * - 使用 `action` 来生成权限,除非手动配置了 `action` 对应装饰的 `xxxPermission`
21
+ * - 如 `permissionPrefix` 装饰了空字符串,则表示无需添加前缀,否则:
22
+ *
23
+ * #### `WebConfig.autoPermissionPrefix=true`
24
+ *
25
+ * - 使用实体类名作为权限前缀,除非 `permissionPrefix` 装饰了非空字符串
26
+ *
27
+ * #### `WebConfig.autoPermissionPrefix=false`
28
+ *
29
+ * - 不自动添加前缀,除非 `permissionPrefix` 装饰了非空字符串
30
+ *
31
+ * @param EntityClass 实体类
32
+ * @param action 权限场景
33
+ * @returns 权限标识
34
+ */
35
+ static get<E extends RootEntity>(EntityClass: ITransformerConstructor<E>, action: PermissionAction | string): string;
36
+ /**
37
+ * ### 保存权限列表
38
+ * @param permissions 权限列表
39
+ */
40
+ static saveList(permissions: string[]): void;
41
+ /**
42
+ * ### 获取缓存的权限列表
43
+ */
44
+ static getList(): string[];
45
+ /**
46
+ * ### 是否有权限
47
+ * @param permission 权限标识
48
+ */
49
+ static has(permission: string): boolean;
50
+ }