@airpower/web 0.1.2 → 0.2.0
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/README.md +14 -13
- package/dist/base/AbstractService.d.ts +30 -0
- package/dist/base/IEntity.d.ts +11 -0
- package/dist/base/RootEntity.d.ts +24 -0
- package/dist/base/RootModel.d.ts +8 -0
- package/dist/base/index.d.ts +4 -0
- package/dist/components/button/Button.vue.d.ts +114 -0
- package/dist/components/button/index.d.ts +3 -0
- package/dist/components/button/type.d.ts +1 -0
- package/dist/components/copy/Copy.vue.d.ts +49 -0
- package/dist/components/copy/index.d.ts +2 -0
- package/dist/components/datetime/DateTime.vue.d.ts +68 -0
- package/dist/components/datetime/index.d.ts +2 -0
- package/dist/components/desensitize/Desensitize.vue.d.ts +84 -0
- package/dist/components/desensitize/index.d.ts +2 -0
- package/dist/components/dialog/Dialog.vue.d.ts +342 -0
- package/dist/components/dialog/DialogProps.d.ts +191 -0
- package/dist/components/dialog/DialogUtil.d.ts +48 -0
- package/dist/components/dialog/index.d.ts +3 -0
- package/dist/components/empty/Empty.vue.d.ts +18 -0
- package/dist/components/empty/index.d.ts +2 -0
- package/dist/components/form/FormField.vue.d.ts +54 -0
- package/dist/components/form/index.d.ts +2 -0
- package/dist/components/frame/Frame.vue.d.ts +32 -0
- package/dist/components/frame/index.d.ts +2 -0
- package/dist/components/group/Group.vue.d.ts +144 -0
- package/dist/components/group/index.d.ts +2 -0
- package/dist/components/image/Image.vue.d.ts +48 -0
- package/dist/components/image/index.d.ts +2 -0
- package/dist/components/index.d.ts +24 -2
- package/dist/components/input/DateTimeType.d.ts +27 -0
- package/dist/components/input/Input.vue.d.ts +50 -0
- package/dist/components/input/index.d.ts +2 -0
- package/dist/components/menu/ChildMenu.vue.d.ts +17 -0
- package/dist/components/menu/IMenu.d.ts +24 -0
- package/dist/components/menu/Menu.vue.d.ts +20 -0
- package/dist/components/menu/index.d.ts +3 -0
- package/dist/components/money/Money.vue.d.ts +71 -0
- package/dist/components/money/index.d.ts +3 -0
- package/dist/components/money/type.d.ts +1 -0
- package/dist/components/page/Page.vue.d.ts +18 -0
- package/dist/components/page/index.d.ts +2 -0
- package/dist/components/panel/Panel.vue.d.ts +115 -0
- package/dist/components/panel/index.d.ts +2 -0
- package/dist/components/payload/IPayload.d.ts +11 -0
- package/dist/components/payload/Payload.vue.d.ts +35 -0
- package/dist/components/payload/index.d.ts +3 -0
- package/dist/components/phone/Call.vue.d.ts +56 -0
- package/dist/components/phone/Phone.vue.d.ts +69 -0
- package/dist/components/phone/index.d.ts +3 -0
- package/dist/components/qrcode/Qrcode.vue.d.ts +34 -0
- package/dist/components/qrcode/index.d.ts +2 -0
- package/dist/components/select/Select.vue.d.ts +47 -0
- package/dist/components/select/Selector.vue.d.ts +107 -0
- package/dist/components/select/index.d.ts +3 -0
- package/dist/components/tab/Tab.vue.d.ts +35 -0
- package/dist/components/tab/Tabs.vue.d.ts +17 -0
- package/dist/components/tab/index.d.ts +3 -0
- package/dist/components/table/Table.vue.d.ts +157 -0
- package/dist/components/table/component/ColumnSelector.vue.d.ts +20 -0
- package/dist/components/table/component/CopyColumn.vue.d.ts +18 -0
- package/dist/components/table/component/EnumColumn.vue.d.ts +20 -0
- package/dist/components/table/component/Export.vue.d.ts +44 -0
- package/dist/components/table/component/index.d.ts +5 -0
- package/dist/components/table/index.d.ts +2 -0
- package/dist/components/table/useTableButton.d.ts +74 -0
- package/dist/components/table/useTableColumn.d.ts +36 -0
- package/dist/components/table/useTableSelect.d.ts +24 -0
- package/dist/components/tree/TreeBox.vue.d.ts +43 -0
- package/dist/components/tree/index.d.ts +2 -0
- package/dist/components/upload/IUploadProps.d.ts +62 -0
- package/dist/components/upload/Upload.vue.d.ts +47 -0
- package/dist/components/upload/index.d.ts +3 -0
- package/dist/components/user/IUser.d.ts +14 -0
- package/dist/components/user/User.vue.d.ts +67 -0
- package/dist/components/user/index.d.ts +3 -0
- package/dist/config/WebConfig.d.ts +306 -0
- package/dist/config/index.d.ts +1 -0
- package/dist/curd/AbstractCurdService.d.ts +138 -0
- package/dist/curd/index.d.ts +2 -0
- package/dist/curd/type.d.ts +8 -0
- package/dist/decorator/@Field/Field.d.ts +28 -0
- package/dist/decorator/@Field/IFieldConfig.d.ts +18 -0
- package/dist/decorator/@Field/index.d.ts +2 -0
- package/dist/decorator/@Form/Form.d.ts +24 -0
- package/dist/decorator/@Form/FormTrim.d.ts +19 -0
- package/dist/decorator/@Form/IFormField.d.ts +224 -0
- package/dist/decorator/@Form/index.d.ts +3 -0
- package/dist/decorator/@Model/IModelConfig.d.ts +69 -0
- package/dist/decorator/@Model/Model.d.ts +12 -0
- package/dist/decorator/@Model/index.d.ts +2 -0
- package/dist/decorator/@Search/ISearchField.d.ts +29 -0
- package/dist/decorator/@Search/Search.d.ts +24 -0
- package/dist/decorator/@Search/index.d.ts +2 -0
- package/dist/decorator/{@table → @Table}/IElementTableColumn.d.ts +1 -1
- package/dist/decorator/@Table/ITableColumn.d.ts +63 -0
- package/dist/decorator/{@table → @Table}/Table.d.ts +5 -5
- package/dist/decorator/{@table → @Table}/index.d.ts +1 -1
- package/dist/decorator/common/IBaseField.d.ts +12 -0
- package/dist/decorator/common/index.d.ts +1 -0
- package/dist/decorator/index.d.ts +6 -1
- package/dist/enum/DisableEnum.d.ts +10 -0
- package/dist/enum/IWebEnum.d.ts +13 -0
- package/dist/enum/WebColor.d.ts +23 -0
- package/dist/enum/WebEnum.d.ts +20 -0
- package/dist/enum/index.d.ts +5 -0
- package/dist/enum/type.d.ts +8 -0
- package/dist/{controller/interface/IDetailControllerOption.d.ts → hooks/detail/IDetailOption.d.ts} +3 -4
- package/dist/hooks/detail/IDetailResult.d.ts +30 -0
- package/dist/hooks/detail/index.d.ts +3 -0
- package/dist/hooks/detail/useDetail.d.ts +13 -0
- package/dist/{controller/interface/IUseEditorOption.d.ts → hooks/editor/IEditorOption.d.ts} +13 -5
- package/dist/hooks/editor/IEditorResult.d.ts +29 -0
- package/dist/hooks/editor/index.d.ts +3 -0
- package/dist/hooks/editor/useEditor.d.ts +13 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/{controller/interface/ITableControllerOption.d.ts → hooks/table/base/IBaseTableOption.d.ts} +5 -5
- package/dist/hooks/table/base/IBaseTableResult.d.ts +81 -0
- package/dist/hooks/table/base/index.d.ts +3 -0
- package/dist/hooks/table/base/useBaseTable.d.ts +11 -0
- package/dist/hooks/table/index.d.ts +4 -0
- package/dist/hooks/table/list/ITableOption.d.ts +8 -0
- package/dist/hooks/table/list/ITableResult.d.ts +33 -0
- package/dist/hooks/table/list/index.d.ts +3 -0
- package/dist/hooks/table/list/useTable.d.ts +11 -0
- package/dist/hooks/table/selector/ISelectorOption.d.ts +8 -0
- package/dist/hooks/table/selector/ISelectorResult.d.ts +19 -0
- package/dist/hooks/table/selector/index.d.ts +3 -0
- package/dist/hooks/table/selector/useSelector.d.ts +13 -0
- package/dist/{controller/interface/ITableTreeControllerOption.d.ts → hooks/table/tree/ITableTreeOption.d.ts} +5 -5
- package/dist/hooks/table/tree/ITableTreeResult.d.ts +13 -0
- package/dist/hooks/table/tree/index.d.ts +3 -0
- package/dist/hooks/table/tree/useTableTree.d.ts +12 -0
- package/dist/i18n/WebI18n.d.ts +52 -3
- package/dist/index.d.ts +7 -4
- package/dist/main.js +9229 -0
- package/dist/model/export/ExportModel.d.ts +24 -0
- package/dist/model/export/index.d.ts +1 -0
- package/dist/model/index.d.ts +3 -0
- package/dist/model/query/QueryPage.d.ts +15 -0
- package/dist/model/query/QueryRequest.d.ts +27 -0
- package/dist/model/query/QueryRequestPage.d.ts +13 -0
- package/dist/model/query/QueryResponsePage.d.ts +30 -0
- package/dist/model/query/QuerySort.d.ts +26 -0
- package/dist/model/query/index.d.ts +6 -0
- package/dist/model/query/type.d.ts +4 -0
- package/dist/model/tree/ITree.d.ts +21 -0
- package/dist/model/tree/index.d.ts +1 -0
- package/dist/type/index.d.ts +1 -0
- package/dist/util/feedback/FeedbackUtil.d.ts +97 -0
- package/dist/util/feedback/index.d.ts +2 -0
- package/dist/util/feedback/type.d.ts +1 -0
- package/dist/util/file/IFile.d.ts +10 -0
- package/dist/util/file/WebFileUtil.d.ts +11 -0
- package/dist/util/file/index.d.ts +1 -0
- package/dist/util/http/Http.d.ts +121 -0
- package/dist/util/http/HttpResponse.d.ts +19 -0
- package/dist/util/http/enum/HttpContentType.d.ts +27 -0
- package/dist/util/http/enum/HttpHeader.d.ts +15 -0
- package/dist/util/http/enum/HttpMethod.d.ts +12 -0
- package/dist/util/http/enum/HttpStatus.d.ts +31 -0
- package/dist/util/http/enum/index.d.ts +4 -0
- package/dist/util/http/index.d.ts +4 -0
- package/dist/util/http/type.d.ts +13 -0
- package/dist/util/index.d.ts +5 -1
- package/dist/util/permission/PermissionAction.d.ts +42 -0
- package/dist/util/permission/PermissionUtil.d.ts +50 -0
- package/dist/util/permission/index.d.ts +2 -0
- package/dist/util/validator/WebValidator.d.ts +198 -0
- package/dist/util/validator/index.d.ts +2 -0
- package/dist/util/validator/type.d.ts +24 -0
- package/dist/web.css +1531 -0
- package/package.json +15 -12
- package/dist/airpower.web.js +0 -490
- package/dist/components/WebTable.vue.d.ts +0 -22
- package/dist/controller/DetailController.d.ts +0 -29
- package/dist/controller/EditorController.d.ts +0 -11
- package/dist/controller/index.d.ts +0 -4
- package/dist/controller/interface/index.d.ts +0 -4
- package/dist/controller/table/BaseTableController.d.ts +0 -68
- package/dist/controller/table/TableController.d.ts +0 -36
- package/dist/controller/table/TableTreeController.d.ts +0 -16
- package/dist/controller/table/index.d.ts +0 -3
- package/dist/decorator/@table/ITableFieldConfig.d.ts +0 -23
- package/dist/http/WebHttp.d.ts +0 -18
- package/dist/http/index.d.ts +0 -1
- package/dist/service/AbstractWebService.d.ts +0 -27
- package/dist/service/index.d.ts +0 -1
- package/dist/shared/index.d.ts +0 -1
- package/dist/util/WebAccessTokenUtil.d.ts +0 -20
- /package/dist/decorator/{@table → @Table}/TableType.d.ts +0 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { DateTimeFormatter, DesensitizeType } from '@airpower/util';
|
|
2
|
+
import { IBaseField } from '../common';
|
|
3
|
+
import { IElementTableColumn } from './IElementTableColumn';
|
|
4
|
+
/**
|
|
5
|
+
* # 表格的字段配置接口
|
|
6
|
+
*
|
|
7
|
+
* @author Hamm.cn
|
|
8
|
+
*/
|
|
9
|
+
export interface ITableColumn extends IBaseField, IElementTableColumn {
|
|
10
|
+
/**
|
|
11
|
+
* ### 是否是金额
|
|
12
|
+
*/
|
|
13
|
+
money?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* ### 列排序
|
|
16
|
+
* 越大越靠前
|
|
17
|
+
*/
|
|
18
|
+
order?: number;
|
|
19
|
+
/**
|
|
20
|
+
* ### 是否隐藏
|
|
21
|
+
*/
|
|
22
|
+
hide?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* ### 是否强制显示
|
|
25
|
+
*/
|
|
26
|
+
force?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* ### 是否强制不换行
|
|
29
|
+
*/
|
|
30
|
+
nowrap?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* ### 删除列
|
|
33
|
+
*/
|
|
34
|
+
removed?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* ### 空值显示
|
|
37
|
+
*/
|
|
38
|
+
emptyValue?: string;
|
|
39
|
+
/**
|
|
40
|
+
* ### 后缀文本
|
|
41
|
+
*/
|
|
42
|
+
suffixText?: string;
|
|
43
|
+
/**
|
|
44
|
+
* ### 是否可复制
|
|
45
|
+
*/
|
|
46
|
+
copy?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* ### 前缀文本
|
|
49
|
+
*/
|
|
50
|
+
prefixText?: string;
|
|
51
|
+
/**
|
|
52
|
+
* ### 是否显示颜色状态灯
|
|
53
|
+
*/
|
|
54
|
+
color?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* ### 脱敏类型
|
|
57
|
+
*/
|
|
58
|
+
desensitize?: DesensitizeType;
|
|
59
|
+
/**
|
|
60
|
+
* ### 是否是日期时间
|
|
61
|
+
*/
|
|
62
|
+
datetime?: boolean | DateTimeFormatter;
|
|
63
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { DecoratorTarget } from '@airpower/
|
|
2
|
-
import {
|
|
1
|
+
import { DecoratorTarget } from '@airpower/transformer';
|
|
2
|
+
import { ITableColumn } from './ITableColumn';
|
|
3
3
|
/**
|
|
4
4
|
* ### 为属性标记是表格字段
|
|
5
5
|
* @param config 表格列的配置
|
|
6
6
|
*/
|
|
7
|
-
export declare function Table(config?:
|
|
7
|
+
export declare function Table(config?: ITableColumn): (target: DecoratorTarget, key: string) => void;
|
|
8
8
|
/**
|
|
9
9
|
* ### 获取对象的属性表格的配置
|
|
10
10
|
* @param target 目标对象
|
|
11
11
|
* @param key 属性名
|
|
12
12
|
*/
|
|
13
|
-
export declare function getTableConfig(target: DecoratorTarget, key: string):
|
|
13
|
+
export declare function getTableConfig(target: DecoratorTarget, key: string): ITableColumn;
|
|
14
14
|
/**
|
|
15
15
|
* ### 获取标记了表格配置的字段列表
|
|
16
16
|
* @param target 目标对象
|
|
@@ -21,4 +21,4 @@ export declare function getTableFieldList(target: DecoratorTarget): string[];
|
|
|
21
21
|
* @param target 目标实体类
|
|
22
22
|
* @param keyList 字段列表
|
|
23
23
|
*/
|
|
24
|
-
export declare function getTableConfigList(target: DecoratorTarget, keyList
|
|
24
|
+
export declare function getTableConfigList(target: DecoratorTarget, keyList?: string[]): Array<ITableColumn>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './IBaseField';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IEnum } from '@airpower/enum';
|
|
2
|
+
import { EnumKey } from '@airpower/enum/dist/enum/type';
|
|
3
|
+
import { WebColorString } from './type';
|
|
4
|
+
export interface IWebEnum<K extends EnumKey = number> extends IEnum<K> {
|
|
5
|
+
/**
|
|
6
|
+
* ### 颜色
|
|
7
|
+
*/
|
|
8
|
+
color?: WebColorString;
|
|
9
|
+
/**
|
|
10
|
+
* ### 是否禁用
|
|
11
|
+
*/
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* # 标准颜色值
|
|
3
|
+
*
|
|
4
|
+
* @author Hamm.cn
|
|
5
|
+
*/
|
|
6
|
+
export declare enum WebColor {
|
|
7
|
+
/**
|
|
8
|
+
* ### 绿色正常状态
|
|
9
|
+
*/
|
|
10
|
+
SUCCESS = "#67C23A",
|
|
11
|
+
/**
|
|
12
|
+
* ### 橙色警告状态
|
|
13
|
+
*/
|
|
14
|
+
WARNING = "#E6A23C",
|
|
15
|
+
/**
|
|
16
|
+
* ### 红色错误状态
|
|
17
|
+
*/
|
|
18
|
+
DANGER = "#F56C6C",
|
|
19
|
+
/**
|
|
20
|
+
* ### 灰色未知状态
|
|
21
|
+
*/
|
|
22
|
+
NORMAL = "#909399"
|
|
23
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { EnumKey, Enum } from '@airpower/enum';
|
|
2
|
+
import { IWebEnum } from './IWebEnum';
|
|
3
|
+
import { WebColorString } from './type';
|
|
4
|
+
/**
|
|
5
|
+
* ### 网页枚举封装
|
|
6
|
+
*
|
|
7
|
+
* @author Hamm.cn
|
|
8
|
+
*/
|
|
9
|
+
export declare class WebEnum<K extends EnumKey = number> extends Enum<K> implements IWebEnum<K> {
|
|
10
|
+
color?: WebColorString;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* ### 设置颜色
|
|
14
|
+
*/
|
|
15
|
+
setColor(color: WebColorString): this;
|
|
16
|
+
/**
|
|
17
|
+
* ### 设置禁用
|
|
18
|
+
*/
|
|
19
|
+
setDisabled(disabled?: boolean): this;
|
|
20
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { EnumConstructor, EnumKey } from '@airpower/enum';
|
|
2
|
+
import { WebColor } from './WebColor';
|
|
3
|
+
import { WebEnum } from './WebEnum';
|
|
4
|
+
/**
|
|
5
|
+
* ### 颜色值
|
|
6
|
+
*/
|
|
7
|
+
export type WebColorString = WebColor | string;
|
|
8
|
+
export type WebEnumConstructor<K extends EnumKey = EnumKey, E extends WebEnum<K> = WebEnum<K>> = typeof WebEnum<K> & EnumConstructor<K, E>;
|
package/dist/{controller/interface/IDetailControllerOption.d.ts → hooks/detail/IDetailOption.d.ts}
RENAMED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RootEntity } from '../../base';
|
|
2
2
|
/**
|
|
3
|
-
* #
|
|
4
|
-
*
|
|
3
|
+
* # `Detail` 的 `Hook` 可选配置
|
|
5
4
|
* @author Hamm.cn
|
|
6
5
|
*/
|
|
7
|
-
export interface
|
|
6
|
+
export interface IDetailOption<E extends RootEntity> {
|
|
8
7
|
/**
|
|
9
8
|
* ### 查到详情后的事件
|
|
10
9
|
* 参数为响应的数据,请处理后返回
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { RootEntity } from '../../base';
|
|
3
|
+
import { AbstractCurdService } from '../../curd';
|
|
4
|
+
/**
|
|
5
|
+
* # 详情的 `Hook` 标准返回
|
|
6
|
+
* @author Hamm.cn
|
|
7
|
+
*/
|
|
8
|
+
export interface IDetailResult<E extends RootEntity, S extends AbstractCurdService<E>> {
|
|
9
|
+
/**
|
|
10
|
+
* ### 对话框显示的标题
|
|
11
|
+
*/
|
|
12
|
+
title: Ref<string>;
|
|
13
|
+
/**
|
|
14
|
+
* ### 表单或详情数据
|
|
15
|
+
*/
|
|
16
|
+
formData: Ref<E>;
|
|
17
|
+
/**
|
|
18
|
+
* ### 当前绑定的 `Loading` 状态
|
|
19
|
+
* 请随意 `v-loading` 到你需要的地方
|
|
20
|
+
*/
|
|
21
|
+
isLoading: Ref<boolean>;
|
|
22
|
+
/**
|
|
23
|
+
* ### 当前 `Hook` 使用的 `Service` 实例
|
|
24
|
+
*/
|
|
25
|
+
service: S;
|
|
26
|
+
/**
|
|
27
|
+
* ### 查询详情
|
|
28
|
+
*/
|
|
29
|
+
getDetail: () => void;
|
|
30
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IJson } from '@airpower/transformer';
|
|
2
|
+
import { RootEntity } from '../../base';
|
|
3
|
+
import { AbstractCurdService, CurdServiceConstructor } from '../../curd';
|
|
4
|
+
import { IDetailOption } from './IDetailOption';
|
|
5
|
+
import { IDetailResult } from './IDetailResult';
|
|
6
|
+
/**
|
|
7
|
+
* # 引入详情的`Hook`
|
|
8
|
+
* @param props `defineProps` 的返回值
|
|
9
|
+
* @param serviceClass 详情使用的 `Service`
|
|
10
|
+
* @param option `可选` 更多的配置
|
|
11
|
+
* @author Hamm.cn
|
|
12
|
+
*/
|
|
13
|
+
export declare function useDetail<E extends RootEntity, S extends AbstractCurdService<E>>(props: IJson, serviceClass: CurdServiceConstructor<E, S>, option?: IDetailOption<E>): IDetailResult<E, S>;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { RootEntity } from '../../base';
|
|
2
|
+
import { WebValidateRule } from '../../util';
|
|
3
|
+
import { IDetailOption } from '../detail';
|
|
3
4
|
/**
|
|
4
|
-
* #
|
|
5
|
-
*
|
|
5
|
+
* # `Editor` 的 `Hook` 可选配置
|
|
6
6
|
* @author Hamm.cn
|
|
7
7
|
*/
|
|
8
|
-
export interface
|
|
8
|
+
export interface IEditorOption<E extends RootEntity> extends IDetailOption<E> {
|
|
9
|
+
/**
|
|
10
|
+
* ### 自定义验证
|
|
11
|
+
*/
|
|
12
|
+
customRules?: WebValidateRule<E>;
|
|
9
13
|
/**
|
|
10
14
|
* ### 编辑成功的提示消息
|
|
11
15
|
*/
|
|
@@ -17,6 +21,10 @@ export interface IUseEditorOption<E extends Entity> extends IDetailControllerOpt
|
|
|
17
21
|
* @param submitData 实体
|
|
18
22
|
*/
|
|
19
23
|
beforeSubmit?: (submitData: E) => E | null;
|
|
24
|
+
/**
|
|
25
|
+
* ### 请求要求继续操作
|
|
26
|
+
*/
|
|
27
|
+
successAndContinue?: (data: E) => void;
|
|
20
28
|
/**
|
|
21
29
|
* ### 请求添加的URL
|
|
22
30
|
*
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { FormInstance } from 'element-plus';
|
|
2
|
+
import { Ref } from 'vue';
|
|
3
|
+
import { RootEntity } from '../../base';
|
|
4
|
+
import { AbstractCurdService } from '../../curd';
|
|
5
|
+
import { WebValidateRule } from '../../util';
|
|
6
|
+
import { IDetailResult } from '../detail';
|
|
7
|
+
/**
|
|
8
|
+
* # `Editor` 的 `Hook` 标准返回
|
|
9
|
+
* @author Hamm.cn
|
|
10
|
+
*/
|
|
11
|
+
export interface IEditorResult<E extends RootEntity, S extends AbstractCurdService<E>> extends IDetailResult<E, S> {
|
|
12
|
+
/**
|
|
13
|
+
* ### 表单的 `Ref` 对象
|
|
14
|
+
* 你可以绑定到组件中, 它将自动为你验证
|
|
15
|
+
* - `ADialog` 的 `:form-ref`
|
|
16
|
+
* - `el-form` 的 `ref`
|
|
17
|
+
*/
|
|
18
|
+
formRef: Ref<FormInstance>;
|
|
19
|
+
/**
|
|
20
|
+
* ### 表单的验证规则
|
|
21
|
+
* 你可以绑定到 `el-form` 的 `:rules` 上
|
|
22
|
+
*/
|
|
23
|
+
rules: WebValidateRule<E>;
|
|
24
|
+
/**
|
|
25
|
+
* ### 表单提交的方法
|
|
26
|
+
* 你可以使用 `beforeSubmit` 方法来拦截请求的数据
|
|
27
|
+
*/
|
|
28
|
+
onSubmit: () => void;
|
|
29
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IJson } from '@airpower/transformer';
|
|
2
|
+
import { RootEntity } from '../../base';
|
|
3
|
+
import { AbstractCurdService, CurdServiceConstructor } from '../../curd';
|
|
4
|
+
import { IEditorOption } from './IEditorOption';
|
|
5
|
+
import { IEditorResult } from './IEditorResult';
|
|
6
|
+
/**
|
|
7
|
+
* # 引入`Editor`的`Hook`
|
|
8
|
+
* @param props `defineProps`的返回值
|
|
9
|
+
* @param serviceClass `Editor`使用的`Service`
|
|
10
|
+
* @param option `可选` 更多的配置
|
|
11
|
+
* @author Hamm.cn
|
|
12
|
+
*/
|
|
13
|
+
export declare function useEditor<E extends RootEntity, S extends AbstractCurdService<E>>(props: IJson, serviceClass: CurdServiceConstructor<E, S>, option?: IEditorOption<E>): IEditorResult<E, S>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Entity, QueryPageRequest } from '@airpower/core';
|
|
2
1
|
import { Component } from 'vue';
|
|
2
|
+
import { RootEntity } from '../../../base';
|
|
3
|
+
import { QueryRequestPage } from '../../../model';
|
|
3
4
|
/**
|
|
4
|
-
* #
|
|
5
|
-
*
|
|
5
|
+
* # 表格相关的根级配置项
|
|
6
6
|
* @author Hamm.cn
|
|
7
7
|
*/
|
|
8
|
-
export interface
|
|
8
|
+
export interface IBaseTableOption<E extends RootEntity> {
|
|
9
9
|
/**
|
|
10
10
|
* ### 不分页
|
|
11
11
|
* 默认请求分页接口 如配置了 `treeList` 则此项自动失效
|
|
@@ -39,5 +39,5 @@ export interface ITableControllerOption<E extends Entity> {
|
|
|
39
39
|
*
|
|
40
40
|
* @param requestData 请求对象
|
|
41
41
|
*/
|
|
42
|
-
beforeSearch?: (requestData:
|
|
42
|
+
beforeSearch?: (requestData: QueryRequestPage<E>) => QueryRequestPage<E> | void;
|
|
43
43
|
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { RootEntity } from '../../../base';
|
|
3
|
+
import { AbstractCurdService } from '../../../curd';
|
|
4
|
+
import { QueryPage, QueryRequestPage, QueryResponsePage, QuerySort } from '../../../model';
|
|
5
|
+
/**
|
|
6
|
+
* # `TableHook` 的基础返回结构
|
|
7
|
+
* @author Hamm.cn
|
|
8
|
+
*/
|
|
9
|
+
export interface IBaseTableResult<E extends RootEntity, S extends AbstractCurdService<E>> {
|
|
10
|
+
/**
|
|
11
|
+
* ### 当前绑定的 `Loading` 状态
|
|
12
|
+
* 请随意 `v-loading` 到你需要的地方
|
|
13
|
+
*/
|
|
14
|
+
isLoading: Ref<boolean>;
|
|
15
|
+
/**
|
|
16
|
+
* ### 响应数据
|
|
17
|
+
*/
|
|
18
|
+
response: Ref<QueryResponsePage<E>>;
|
|
19
|
+
/**
|
|
20
|
+
* ### 请求数据
|
|
21
|
+
*/
|
|
22
|
+
request: Ref<QueryRequestPage<E>>;
|
|
23
|
+
/**
|
|
24
|
+
* ### 返回的单页数据列表
|
|
25
|
+
*/
|
|
26
|
+
list: Ref<E[]>;
|
|
27
|
+
/**
|
|
28
|
+
* ### 选中的数据列表
|
|
29
|
+
*/
|
|
30
|
+
selectList: Ref<E[]>;
|
|
31
|
+
/**
|
|
32
|
+
* ### 实体的实例
|
|
33
|
+
*/
|
|
34
|
+
entity: E;
|
|
35
|
+
/**
|
|
36
|
+
* ### `Service`的实例
|
|
37
|
+
*/
|
|
38
|
+
service: S;
|
|
39
|
+
/**
|
|
40
|
+
* ### 刷新数据 返回第一页
|
|
41
|
+
*/
|
|
42
|
+
onReloadData: () => void;
|
|
43
|
+
/**
|
|
44
|
+
* ### 搜索事件
|
|
45
|
+
*
|
|
46
|
+
* @param request 请求对象
|
|
47
|
+
*/
|
|
48
|
+
onSearch: (request: QueryRequestPage<E>) => void;
|
|
49
|
+
/**
|
|
50
|
+
* ### 分页变更事件
|
|
51
|
+
*
|
|
52
|
+
* @param page 分页对象
|
|
53
|
+
*/
|
|
54
|
+
onPageChanged: (page: QueryPage) => void;
|
|
55
|
+
/**
|
|
56
|
+
* ### 详情事件
|
|
57
|
+
*
|
|
58
|
+
* @param row 选择的行
|
|
59
|
+
*/
|
|
60
|
+
onDetail: (row: E) => void;
|
|
61
|
+
/**
|
|
62
|
+
* ### 添加事件
|
|
63
|
+
*/
|
|
64
|
+
onAdd: () => void;
|
|
65
|
+
/**
|
|
66
|
+
* ### 排序变更事件
|
|
67
|
+
*
|
|
68
|
+
* @param sort 排序对象
|
|
69
|
+
*/
|
|
70
|
+
onSortChanged: (sort?: QuerySort) => void | Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* ### 多选事件
|
|
73
|
+
*
|
|
74
|
+
* @param list 选择的行列表
|
|
75
|
+
*/
|
|
76
|
+
onSelected: (list: E[]) => void;
|
|
77
|
+
/**
|
|
78
|
+
* ### 刷新数据 保持留在当页
|
|
79
|
+
*/
|
|
80
|
+
onGetList: () => void;
|
|
81
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { RootEntity } from '../../../base';
|
|
2
|
+
import { AbstractCurdService, CurdServiceConstructor } from '../../../curd';
|
|
3
|
+
import { IBaseTableOption } from './IBaseTableOption';
|
|
4
|
+
import { IBaseTableResult } from './IBaseTableResult';
|
|
5
|
+
/**
|
|
6
|
+
* # 表格基础`Hook`
|
|
7
|
+
* @param serviceClass 表格使用的 `Service` 类
|
|
8
|
+
* @param option `可选` 更多配置
|
|
9
|
+
* @author Hamm.cn
|
|
10
|
+
*/
|
|
11
|
+
export declare function useBaseTable<E extends RootEntity, S extends AbstractCurdService<E>>(serviceClass: CurdServiceConstructor<E, S>, option?: IBaseTableOption<E>): IBaseTableResult<E, S>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { RootEntity } from '../../../base';
|
|
2
|
+
import { AbstractCurdService } from '../../../curd';
|
|
3
|
+
import { IBaseTableResult } from '../base';
|
|
4
|
+
/**
|
|
5
|
+
* # 表格的 `Hook` 标准返回
|
|
6
|
+
* @author Hamm.cn
|
|
7
|
+
*/
|
|
8
|
+
export interface ITableResult<E extends RootEntity, S extends AbstractCurdService<E>> extends IBaseTableResult<E, S> {
|
|
9
|
+
/**
|
|
10
|
+
* ### 编辑事件
|
|
11
|
+
*
|
|
12
|
+
* @param row 选择的行
|
|
13
|
+
*/
|
|
14
|
+
onEdit: (row: E) => void;
|
|
15
|
+
/**
|
|
16
|
+
* ### 删除事件
|
|
17
|
+
*
|
|
18
|
+
* @param row 选择的行
|
|
19
|
+
*/
|
|
20
|
+
onDelete: (row: E) => void;
|
|
21
|
+
/**
|
|
22
|
+
* ### 禁用事件
|
|
23
|
+
*
|
|
24
|
+
* @param row 选择的行
|
|
25
|
+
*/
|
|
26
|
+
onDisable: (row: E) => void;
|
|
27
|
+
/**
|
|
28
|
+
* ### 启用事件
|
|
29
|
+
*
|
|
30
|
+
* @param row 选择的行
|
|
31
|
+
*/
|
|
32
|
+
onEnable: (row: E) => void;
|
|
33
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { RootEntity } from '../../../base';
|
|
2
|
+
import { AbstractCurdService, CurdServiceConstructor } from '../../../curd';
|
|
3
|
+
import { ITableOption } from './ITableOption';
|
|
4
|
+
import { ITableResult } from './ITableResult';
|
|
5
|
+
/**
|
|
6
|
+
* # 引入表格使用的`Hook`
|
|
7
|
+
* @param serviceClass 表格使用的`Service`类
|
|
8
|
+
* @param option `可选` 更多配置
|
|
9
|
+
* @author Hamm.cn
|
|
10
|
+
*/
|
|
11
|
+
export declare function useTable<E extends RootEntity, S extends AbstractCurdService<E>>(serviceClass: CurdServiceConstructor<E, S>, option?: ITableOption<E>): ITableResult<E, S>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { RootEntity } from '../../../base';
|
|
3
|
+
import { AbstractCurdService } from '../../../curd';
|
|
4
|
+
import { IBaseTableResult } from '../base';
|
|
5
|
+
/**
|
|
6
|
+
* # 选择器 `Hook` 的标准返回
|
|
7
|
+
* @author Hamm.cn
|
|
8
|
+
*/
|
|
9
|
+
export interface ISelectorResult<E extends RootEntity, S extends AbstractCurdService<E>> extends IBaseTableResult<E, S> {
|
|
10
|
+
/**
|
|
11
|
+
* ### `Selector` 的标题
|
|
12
|
+
*/
|
|
13
|
+
title: Ref<string>;
|
|
14
|
+
/**
|
|
15
|
+
* ### 是否禁用确认按钮
|
|
16
|
+
* 多选时当没有选择任何数据时将禁用确认按钮
|
|
17
|
+
*/
|
|
18
|
+
disableConfirm: Ref<boolean>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IJson } from '@airpower/transformer';
|
|
2
|
+
import { RootEntity } from '../../../base';
|
|
3
|
+
import { AbstractCurdService, CurdServiceConstructor } from '../../../curd';
|
|
4
|
+
import { ISelectorOption } from './ISelectorOption';
|
|
5
|
+
import { ISelectorResult } from './ISelectorResult';
|
|
6
|
+
/**
|
|
7
|
+
* # 引入`Selector`使用的`Hook`
|
|
8
|
+
* @param props `defineProps`的返回值
|
|
9
|
+
* @param serviceClass `Selector`使用的`Service`类
|
|
10
|
+
* @param option `可选` 更多配置
|
|
11
|
+
* @author Hamm.cn
|
|
12
|
+
*/
|
|
13
|
+
export declare function useSelector<E extends RootEntity, S extends AbstractCurdService<E>>(props: IJson, serviceClass: CurdServiceConstructor<E, S>, option?: ISelectorOption<E>): ISelectorResult<E, S>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { RootEntity } from '../../../base';
|
|
2
|
+
import { ITree } from '../../../model';
|
|
3
|
+
import { ITableOption } from '../list';
|
|
3
4
|
/**
|
|
4
|
-
* #
|
|
5
|
-
*
|
|
5
|
+
* # `TableTreeList` 的 `Hook` 可选配置
|
|
6
6
|
* @author Hamm.cn
|
|
7
7
|
*/
|
|
8
|
-
export interface
|
|
8
|
+
export interface ITableTreeOption<T extends ITree & RootEntity> extends ITableOption<T> {
|
|
9
9
|
/**
|
|
10
10
|
* ### 添加行的子项的前置拦截方法
|
|
11
11
|
* 参数为发起请求的数据,请处理后返回 `param`
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { RootEntity } from '../../../base';
|
|
2
|
+
import { AbstractCurdService } from '../../../curd';
|
|
3
|
+
import { ITableResult } from '../list';
|
|
4
|
+
/**
|
|
5
|
+
* # 树表格的 `Hook` 标准返回
|
|
6
|
+
* @author Hamm.cn
|
|
7
|
+
*/
|
|
8
|
+
export interface ITableTreeResult<E extends RootEntity, S extends AbstractCurdService<E>> extends ITableResult<E, S> {
|
|
9
|
+
/**
|
|
10
|
+
* ### 表格行的添加按钮点击事件
|
|
11
|
+
*/
|
|
12
|
+
onAddRow: (row: E) => void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RootEntity } from '../../../base';
|
|
2
|
+
import { AbstractCurdService, CurdServiceConstructor } from '../../../curd';
|
|
3
|
+
import { ITree } from '../../../model';
|
|
4
|
+
import { ITableTreeOption } from './ITableTreeOption';
|
|
5
|
+
import { ITableTreeResult } from './ITableTreeResult';
|
|
6
|
+
/**
|
|
7
|
+
* # 引入表格树使用的`Hook`
|
|
8
|
+
* @param serviceClass 表格使用的`Service`类
|
|
9
|
+
* @param option `可选` 更多配置
|
|
10
|
+
* @author Hamm.cn
|
|
11
|
+
*/
|
|
12
|
+
export declare function useTableTree<E extends ITree & RootEntity, S extends AbstractCurdService<E>>(serviceClass: CurdServiceConstructor<E, S>, option?: ITableTreeOption<E>): ITableTreeResult<E, S>;
|