@airpower/web 0.0.43 → 0.1.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.
- package/README.md +1 -1
- package/dist/airpower.web.js +26 -19
- package/dist/components/WebTable.vue.d.ts +2 -2
- package/dist/controller/DetailController.d.ts +2 -2
- package/dist/controller/EditorController.d.ts +2 -2
- package/dist/controller/interface/IDetailControllerOption.d.ts +2 -2
- package/dist/controller/interface/ITableControllerOption.d.ts +2 -2
- package/dist/controller/interface/ITableTreeControllerOption.d.ts +2 -2
- package/dist/controller/interface/IUseEditorOption.d.ts +2 -2
- package/dist/controller/table/BaseTableController.d.ts +2 -2
- package/dist/controller/table/TableController.d.ts +2 -2
- package/dist/controller/table/TableTreeController.d.ts +2 -2
- package/dist/decorator/@table/ITableFieldConfig.d.ts +2 -2
- package/dist/decorator/@table/Table.d.ts +5 -5
- package/dist/i18n/WebI18n.d.ts +2 -2
- package/dist/index.d.ts +1 -2
- package/dist/service/AbstractWebService.d.ts +2 -2
- package/dist/{helper/WebAccessToken.d.ts → util/WebAccessTokenUtil.d.ts} +1 -1
- package/dist/util/index.d.ts +1 -0
- package/package.json +2 -2
- package/dist/helper/index.d.ts +0 -1
- package/dist/type/WebType.d.ts +0 -1
- package/dist/type/index.d.ts +0 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<img src="https://svg.hamm.cn?key=Lang&value=TypeScript&bg=green"/>
|
|
7
7
|
<img src="https://svg.hamm.cn?key=Build&value=Vite"/>
|
|
8
8
|
<img src="https://svg.hamm.cn?key=Base&value=Vue3"/>
|
|
9
|
-
<img src="https://svg.hamm.cn?key=UI&value=
|
|
9
|
+
<img src="https://svg.hamm.cn?key=UI&value=ElementPlus"/>
|
|
10
10
|
</p>
|
|
11
11
|
|
|
12
12
|
<p align="center">
|
package/dist/airpower.web.js
CHANGED
|
@@ -2,36 +2,43 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
import { defineComponent, computed, createBlock, openBlock, unref, mergeProps, toHandlers, withCtx, createElementBlock, Fragment, renderList, ref } from "vue";
|
|
5
|
-
import {
|
|
5
|
+
import { DecoratorUtil, getFieldConfig, ClassTransformer, I18n, QueryPageResponse, QueryPageRequest, Page, HttpConfig, AbstractHttp, HttpResponse, HttpStatus, AbstractEntityService } from "@airpower/core";
|
|
6
6
|
export * from "@airpower/core";
|
|
7
7
|
import { ElTable, ElTableColumn, ElMessageBox, ElMessage } from "element-plus";
|
|
8
8
|
import axios from "axios";
|
|
9
9
|
const FIELD_CONFIG_KEY = "Table";
|
|
10
10
|
const FIELD_LIST_KEY = "TableList";
|
|
11
11
|
function Table(config = {}) {
|
|
12
|
-
config.dictionary = AirDecorator.getDictionary(config.dictionary);
|
|
13
12
|
return (target, key) => {
|
|
14
13
|
config.key = key;
|
|
15
|
-
return
|
|
14
|
+
return DecoratorUtil.setFieldConfig(target, key, FIELD_CONFIG_KEY, config, FIELD_LIST_KEY);
|
|
16
15
|
};
|
|
17
16
|
}
|
|
18
17
|
function getTableConfig(target, key) {
|
|
19
|
-
const formConfig =
|
|
20
|
-
if (!formConfig
|
|
18
|
+
const formConfig = DecoratorUtil.getFieldConfig(target, key, FIELD_CONFIG_KEY, true);
|
|
19
|
+
if (!formConfig) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
if (!formConfig.enums) {
|
|
21
23
|
const props = getFieldConfig(target, key);
|
|
22
|
-
|
|
24
|
+
if (props && props.enums) {
|
|
25
|
+
formConfig.enums = props.enums;
|
|
26
|
+
}
|
|
23
27
|
}
|
|
24
28
|
return formConfig;
|
|
25
29
|
}
|
|
26
30
|
function getTableFieldList(target) {
|
|
27
|
-
return
|
|
31
|
+
return DecoratorUtil.getFieldList(target, FIELD_LIST_KEY);
|
|
28
32
|
}
|
|
29
33
|
function getTableConfigList(target, keyList) {
|
|
30
|
-
return
|
|
34
|
+
return DecoratorUtil.getFieldConfigList(target, FIELD_LIST_KEY, FIELD_CONFIG_KEY, keyList).sort((a, b) => (b.orderNumber || 0) - (a.orderNumber || 0)).map((item) => {
|
|
31
35
|
const props = getFieldConfig(target, item.key);
|
|
32
36
|
item.label = item.label || props.label || item.key;
|
|
33
|
-
if (!item.
|
|
34
|
-
|
|
37
|
+
if (!item.enums) {
|
|
38
|
+
const fieldConfig = getFieldConfig(target, item.key);
|
|
39
|
+
if (fieldConfig && fieldConfig.enums) {
|
|
40
|
+
item.enums = fieldConfig.enums;
|
|
41
|
+
}
|
|
35
42
|
}
|
|
36
43
|
return item;
|
|
37
44
|
});
|
|
@@ -74,7 +81,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
74
81
|
if (props.columns && props.columns.length > 0) {
|
|
75
82
|
return props.columns;
|
|
76
83
|
}
|
|
77
|
-
const instance =
|
|
84
|
+
const instance = ClassTransformer.newInstance(props.clazz);
|
|
78
85
|
return getTableConfigList(instance, []);
|
|
79
86
|
});
|
|
80
87
|
return (_ctx, _cache) => {
|
|
@@ -96,7 +103,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
96
103
|
};
|
|
97
104
|
}
|
|
98
105
|
});
|
|
99
|
-
class WebI18n extends
|
|
106
|
+
class WebI18n extends I18n {
|
|
100
107
|
constructor() {
|
|
101
108
|
super(...arguments);
|
|
102
109
|
__publicField(this, "Detail", "详情");
|
|
@@ -129,10 +136,10 @@ class DetailController {
|
|
|
129
136
|
__publicField(this, "title", ref(WebI18n.get().Detail));
|
|
130
137
|
__publicField(this, "service");
|
|
131
138
|
__publicField(this, "option", {});
|
|
132
|
-
this.service =
|
|
139
|
+
this.service = ClassTransformer.newInstance(ServiceClass);
|
|
133
140
|
this.service.setLoading(this.isLoading);
|
|
134
141
|
this.option = option;
|
|
135
|
-
this.formData = ref(props.param ? props.param.copy() :
|
|
142
|
+
this.formData = ref(props.param ? props.param.copy() : ClassTransformer.newInstance(this.service.entityClass));
|
|
136
143
|
this.getDetail();
|
|
137
144
|
}
|
|
138
145
|
/**
|
|
@@ -169,7 +176,7 @@ class BaseTableController {
|
|
|
169
176
|
__publicField(this, "isLoading", ref(false));
|
|
170
177
|
__publicField(this, "service");
|
|
171
178
|
__publicField(this, "option", {});
|
|
172
|
-
this.service =
|
|
179
|
+
this.service = ClassTransformer.newInstance(ServiceClass);
|
|
173
180
|
this.request = ref(new QueryPageRequest(this.service.entityClass));
|
|
174
181
|
this.service.setLoading(this.isLoading);
|
|
175
182
|
this.getList();
|
|
@@ -347,7 +354,7 @@ class TableTreeController extends TableController {
|
|
|
347
354
|
return;
|
|
348
355
|
}
|
|
349
356
|
try {
|
|
350
|
-
let param =
|
|
357
|
+
let param = ClassTransformer.newInstance(this.service.entityClass);
|
|
351
358
|
param.parentId = row.id;
|
|
352
359
|
if (this.option.beforeAddRow) {
|
|
353
360
|
const result = this.option.beforeAddRow(param, row);
|
|
@@ -361,7 +368,7 @@ class TableTreeController extends TableController {
|
|
|
361
368
|
}
|
|
362
369
|
}
|
|
363
370
|
}
|
|
364
|
-
class
|
|
371
|
+
class WebAccessTokenUtil {
|
|
365
372
|
/**
|
|
366
373
|
* ### 获取AccessToken
|
|
367
374
|
*/
|
|
@@ -422,7 +429,7 @@ class WebHttp extends AbstractHttp {
|
|
|
422
429
|
* # 获取AccessToken
|
|
423
430
|
*/
|
|
424
431
|
getAccessToken() {
|
|
425
|
-
return
|
|
432
|
+
return WebAccessTokenUtil.getAccessToken();
|
|
426
433
|
}
|
|
427
434
|
startLoading() {
|
|
428
435
|
this.loading.value = true;
|
|
@@ -473,7 +480,7 @@ export {
|
|
|
473
480
|
Table,
|
|
474
481
|
TableController,
|
|
475
482
|
TableTreeController,
|
|
476
|
-
|
|
483
|
+
WebAccessTokenUtil,
|
|
477
484
|
WebHttp,
|
|
478
485
|
WebI18n,
|
|
479
486
|
_sfc_main as WebTable,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ClassConstructor, Entity } from '@airpower/core';
|
|
2
2
|
import { ITableFieldConfig } from '../decorator';
|
|
3
|
-
declare const _default: <E extends
|
|
3
|
+
declare const _default: <E extends Entity>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
4
4
|
props: __VLS_PrettifyLocal<Pick<Partial<{
|
|
5
5
|
tableId: string;
|
|
6
6
|
}> & Omit<{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Entity, IJson } from '@airpower/core';
|
|
2
2
|
import { Ref } from 'vue';
|
|
3
3
|
import { AbstractWebService } from '../service';
|
|
4
4
|
import { IDetailControllerOption } from './interface';
|
|
@@ -7,7 +7,7 @@ import { IDetailControllerOption } from './interface';
|
|
|
7
7
|
*
|
|
8
8
|
* @author Hamm.cn
|
|
9
9
|
*/
|
|
10
|
-
export declare class DetailController<E extends
|
|
10
|
+
export declare class DetailController<E extends Entity, S extends AbstractWebService<E>, O extends IDetailControllerOption<E> = IDetailControllerOption<E>> {
|
|
11
11
|
isLoading: Ref<boolean, boolean>;
|
|
12
12
|
formData: Ref<E>;
|
|
13
13
|
title: Ref<string, string>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Entity } from '@airpower/core';
|
|
2
2
|
import { AbstractWebService } from '../service';
|
|
3
3
|
import { DetailController } from './DetailController';
|
|
4
4
|
/**
|
|
@@ -6,6 +6,6 @@ import { DetailController } from './DetailController';
|
|
|
6
6
|
*
|
|
7
7
|
* @author Hamm.cn
|
|
8
8
|
*/
|
|
9
|
-
export declare class EditorController<E extends
|
|
9
|
+
export declare class EditorController<E extends Entity, S extends AbstractWebService<E>> extends DetailController<E, S> {
|
|
10
10
|
getDetail(): Promise<void>;
|
|
11
11
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Entity } from '@airpower/core';
|
|
2
2
|
/**
|
|
3
3
|
* # 详情控制器配置项
|
|
4
4
|
*
|
|
5
5
|
* @author Hamm.cn
|
|
6
6
|
*/
|
|
7
|
-
export interface IDetailControllerOption<E extends
|
|
7
|
+
export interface IDetailControllerOption<E extends Entity> {
|
|
8
8
|
/**
|
|
9
9
|
* ### 查到详情后的事件
|
|
10
10
|
* 参数为响应的数据,请处理后返回
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Entity, QueryPageRequest } from '@airpower/core';
|
|
2
2
|
import { Component } from 'vue';
|
|
3
3
|
/**
|
|
4
4
|
* # 表格控制器配置项
|
|
5
5
|
*
|
|
6
6
|
* @author Hamm.cn
|
|
7
7
|
*/
|
|
8
|
-
export interface ITableControllerOption<E extends
|
|
8
|
+
export interface ITableControllerOption<E extends Entity> {
|
|
9
9
|
/**
|
|
10
10
|
* ### 不分页
|
|
11
11
|
* 默认请求分页接口 如配置了 `treeList` 则此项自动失效
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Entity, ITree } from '@airpower/core';
|
|
2
2
|
import { ITableControllerOption } from './ITableControllerOption';
|
|
3
3
|
/**
|
|
4
4
|
* # 表格树控制器配置项
|
|
5
5
|
*
|
|
6
6
|
* @author Hamm.cn
|
|
7
7
|
*/
|
|
8
|
-
export interface ITableTreeControllerOption<T extends ITree &
|
|
8
|
+
export interface ITableTreeControllerOption<T extends ITree & Entity> extends ITableControllerOption<T> {
|
|
9
9
|
/**
|
|
10
10
|
* ### 添加行的子项的前置拦截方法
|
|
11
11
|
* 参数为发起请求的数据,请处理后返回 `param`
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Entity } from '@airpower/core';
|
|
2
2
|
import { IDetailControllerOption } from './IDetailControllerOption';
|
|
3
3
|
/**
|
|
4
4
|
* # 编辑控制器的可选配置
|
|
5
5
|
*
|
|
6
6
|
* @author Hamm.cn
|
|
7
7
|
*/
|
|
8
|
-
export interface IUseEditorOption<E extends
|
|
8
|
+
export interface IUseEditorOption<E extends Entity> extends IDetailControllerOption<E> {
|
|
9
9
|
/**
|
|
10
10
|
* ### 编辑成功的提示消息
|
|
11
11
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Entity, QuerySort, Page, QueryPageRequest, QueryPageResponse } from '@airpower/core';
|
|
2
2
|
import { Ref } from 'vue';
|
|
3
3
|
import { AbstractWebService } from '../../service';
|
|
4
4
|
import { ITableControllerOption } from '../interface';
|
|
@@ -7,7 +7,7 @@ import { ITableControllerOption } from '../interface';
|
|
|
7
7
|
*
|
|
8
8
|
* @author Hamm.cn
|
|
9
9
|
*/
|
|
10
|
-
export declare class BaseTableController<E extends
|
|
10
|
+
export declare class BaseTableController<E extends Entity, S extends AbstractWebService<E>, O extends ITableControllerOption<E> = ITableControllerOption<E>> {
|
|
11
11
|
request: Ref<QueryPageRequest<E>>;
|
|
12
12
|
response: Ref<QueryPageResponse<E>>;
|
|
13
13
|
list: Ref<E[]>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Entity } from '@airpower/core';
|
|
2
2
|
import { AbstractWebService } from '../../service';
|
|
3
3
|
import { ITableControllerOption } from '../interface';
|
|
4
4
|
import { BaseTableController } from './BaseTableController';
|
|
@@ -7,7 +7,7 @@ import { BaseTableController } from './BaseTableController';
|
|
|
7
7
|
*
|
|
8
8
|
* @author Hamm.cn
|
|
9
9
|
*/
|
|
10
|
-
export declare class TableController<E extends
|
|
10
|
+
export declare class TableController<E extends Entity, S extends AbstractWebService<E>, O extends ITableControllerOption<E> = ITableControllerOption<E>> extends BaseTableController<E, S, O> {
|
|
11
11
|
/**
|
|
12
12
|
* ### 表格行编辑事件
|
|
13
13
|
* @param row 行数据
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Entity, ITree } from '@airpower/core';
|
|
2
2
|
import { AbstractWebService } from '../../service';
|
|
3
3
|
import { ITableTreeControllerOption } from '../interface';
|
|
4
4
|
import { TableController } from './TableController';
|
|
@@ -7,7 +7,7 @@ import { TableController } from './TableController';
|
|
|
7
7
|
*
|
|
8
8
|
* @author Hamm.cn
|
|
9
9
|
*/
|
|
10
|
-
export declare class TableTreeController<E extends ITree &
|
|
10
|
+
export declare class TableTreeController<E extends ITree & Entity, S extends AbstractWebService<E>> extends TableController<E, S, ITableTreeControllerOption<E>> {
|
|
11
11
|
/**
|
|
12
12
|
* ### 树表格添加子项事件
|
|
13
13
|
* @param row 行数据
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EnumConstructor, IField } from '@airpower/core';
|
|
2
2
|
import { IElementTableColumn } from './IElementTableColumn';
|
|
3
3
|
/**
|
|
4
4
|
* # 表格的字段配置接口
|
|
@@ -9,7 +9,7 @@ export interface ITableFieldConfig extends IField, IElementTableColumn {
|
|
|
9
9
|
/**
|
|
10
10
|
* ### 字典
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
enums?: EnumConstructor;
|
|
13
13
|
key?: string;
|
|
14
14
|
/**
|
|
15
15
|
* ### 列排序
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DecoratorTarget } from '@airpower/core';
|
|
2
2
|
import { ITableFieldConfig } from './ITableFieldConfig';
|
|
3
3
|
/**
|
|
4
4
|
* ### 为属性标记是表格字段
|
|
5
5
|
* @param config 表格列的配置
|
|
6
6
|
*/
|
|
7
|
-
export declare function Table(config?: ITableFieldConfig): (target:
|
|
7
|
+
export declare function Table(config?: ITableFieldConfig): (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:
|
|
13
|
+
export declare function getTableConfig(target: DecoratorTarget, key: string): ITableFieldConfig | null;
|
|
14
14
|
/**
|
|
15
15
|
* ### 获取标记了表格配置的字段列表
|
|
16
16
|
* @param target 目标对象
|
|
17
17
|
*/
|
|
18
|
-
export declare function getTableFieldList(target:
|
|
18
|
+
export declare function getTableFieldList(target: DecoratorTarget): string[];
|
|
19
19
|
/**
|
|
20
20
|
* ### 获取字段标记的表格字段配置列表
|
|
21
21
|
* @param target 目标实体类
|
|
22
22
|
* @param keyList 字段列表
|
|
23
23
|
*/
|
|
24
|
-
export declare function getTableConfigList(target:
|
|
24
|
+
export declare function getTableConfigList(target: DecoratorTarget, keyList: string[]): ITableFieldConfig[];
|
package/dist/i18n/WebI18n.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { I18n } from '@airpower/core';
|
|
2
2
|
/**
|
|
3
3
|
* # Web端默认语言包
|
|
4
4
|
*
|
|
5
5
|
* @author Hamm.cn
|
|
6
6
|
*/
|
|
7
|
-
export declare class WebI18n extends
|
|
7
|
+
export declare class WebI18n extends I18n {
|
|
8
8
|
Detail: string;
|
|
9
9
|
Edit: string;
|
|
10
10
|
Add: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
export * from './components';
|
|
2
2
|
export * from './controller';
|
|
3
3
|
export * from './decorator';
|
|
4
|
-
export * from './helper';
|
|
5
4
|
export * from './http';
|
|
6
5
|
export * from './i18n';
|
|
7
6
|
export * from './service';
|
|
8
7
|
export * from './shared';
|
|
9
|
-
export * from './
|
|
8
|
+
export * from './util';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AbstractHttp,
|
|
1
|
+
import { AbstractHttp, Entity, AbstractEntityService } from '@airpower/core';
|
|
2
2
|
import { Ref } from 'vue';
|
|
3
3
|
/**
|
|
4
4
|
* # 实体 `API` 服务超类
|
|
@@ -7,7 +7,7 @@ import { Ref } from 'vue';
|
|
|
7
7
|
* @param E 泛型实体类
|
|
8
8
|
* @author Hamm.cn
|
|
9
9
|
*/
|
|
10
|
-
export declare abstract class AbstractWebService<E extends
|
|
10
|
+
export declare abstract class AbstractWebService<E extends Entity> extends AbstractEntityService<E> {
|
|
11
11
|
/**
|
|
12
12
|
* ### 是否正在加载中
|
|
13
13
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './WebAccessTokenUtil';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@airpower/web",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.1.2",
|
|
5
5
|
"description": "AirPower-Web",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Hamm",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"vue": "^3.5.13"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@airpower/core": "^0.1
|
|
47
|
+
"@airpower/core": "^1.0.1",
|
|
48
48
|
"axios": "^1.8.4",
|
|
49
49
|
"element-plus": "^2.9.7",
|
|
50
50
|
"vue": "^3.5.13"
|
package/dist/helper/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './WebAccessToken';
|
package/dist/type/WebType.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type MoneyDirection = 'up' | 'down';
|
package/dist/type/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './WebType';
|