@airpower/web 0.2.11 → 0.2.13

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.
@@ -303,11 +303,16 @@ export declare class WebConfig {
303
303
  */
304
304
  static product: string;
305
305
  /**
306
- * ### 获取 `AccessToken`
306
+ * ### 获取身份令牌
307
307
  */
308
308
  static getAccessToken(): string;
309
309
  /**
310
- * ### 移除 `AccessToken`
310
+ * ### 移除身份令牌
311
311
  */
312
312
  static removeAccessToken(): void;
313
+ /**
314
+ * ### 设置身份令牌
315
+ * @param accessToken 身份令牌
316
+ */
317
+ static saveAccessToken(accessToken: string): void;
313
318
  }
@@ -1,5 +1,6 @@
1
1
  import { EnumKey } from '@airpower/enum/dist/enum/type';
2
2
  import { DecoratorTarget } from '@airpower/transformer';
3
+ import { RootModel } from '../../../base';
3
4
  import { WebEnumConstructor } from '../../../util';
4
5
  import { IFieldConfig } from './IFieldConfig';
5
6
  /**
@@ -13,16 +14,16 @@ export declare function Field<K extends EnumKey = EnumKey>(config?: IFieldConfig
13
14
  * @param target 目标类
14
15
  * @param key 属性名
15
16
  */
16
- export declare function getFieldConfig<K extends EnumKey = EnumKey>(target: DecoratorTarget, key: string): IFieldConfig<K>;
17
+ export declare function getFieldConfig<M extends RootModel, K extends EnumKey = EnumKey>(target: M, key: string): IFieldConfig<K>;
17
18
  /**
18
19
  * ### 获取属性的枚举字典
19
20
  * @param target 目标类
20
21
  * @param key 属性名
21
22
  */
22
- export declare function getDictionary<K extends EnumKey = EnumKey>(target: DecoratorTarget, key: string): WebEnumConstructor<K> | undefined;
23
+ export declare function getDictionary<M extends RootModel, K extends EnumKey = EnumKey>(target: M, key: string): WebEnumConstructor<K> | undefined;
23
24
  /**
24
25
  * ### 获取属性的标题
25
26
  * @param target 目标类
26
27
  * @param key string 属性名
27
28
  */
28
- export declare function getFieldLabel(target: DecoratorTarget, key: string): string;
29
+ export declare function getFieldLabel<M extends RootModel>(target: M, key: string): string;
@@ -1,4 +1,5 @@
1
1
  import { DecoratorTarget } from '@airpower/transformer';
2
+ import { RootModel } from '../../../base';
2
3
  import { IFormField } from './IFormField';
3
4
  /**
4
5
  * ### 标记该字段可用于表单配置
@@ -10,15 +11,15 @@ export declare function Form(config?: IFormField): (target: DecoratorTarget, key
10
11
  * @param target 目标类或对象
11
12
  * @param key 属性名
12
13
  */
13
- export declare function getFormConfig(target: DecoratorTarget, key: string): IFormField;
14
+ export declare function getFormConfig<M extends RootModel>(target: M, key: string): IFormField;
14
15
  /**
15
16
  * ### 获取标记了表单配置的字段列表
16
17
  * @param target 目标对象
17
18
  */
18
- export declare function getFormFieldList(target: DecoratorTarget): string[];
19
+ export declare function getFormFieldList<M extends RootModel>(target: M): string[];
19
20
  /**
20
21
  * ### 获取指定类的表单字段配置项列表
21
22
  * @param target 目标类或对象
22
23
  * @param keyList 选择字段列表
23
24
  */
24
- export declare function getFormConfigList(target: DecoratorTarget, keyList?: string[]): IFormField[];
25
+ export declare function getFormConfigList<M extends RootModel>(target: M, keyList?: string[]): IFormField[];
@@ -1,4 +1,4 @@
1
- import { DecoratorTarget } from '@airpower/transformer';
1
+ import { DecoratorTarget, Transformer } from '@airpower/transformer';
2
2
  import { IModelConfig } from './IModelConfig';
3
3
  /**
4
4
  * ### 为模型类标记配置项
@@ -7,6 +7,11 @@ import { IModelConfig } from './IModelConfig';
7
7
  export declare function Model<T extends IModelConfig = IModelConfig>(config?: T): (target: DecoratorTarget) => void;
8
8
  /**
9
9
  * ### 获取模型类配置项
10
- * @param target 目标类
10
+ * @param target 实例
11
11
  */
12
- export declare function getModelConfig<T extends IModelConfig = IModelConfig>(target: DecoratorTarget): T;
12
+ export declare function getModelConfig<E extends Transformer, T extends IModelConfig = IModelConfig>(target: E): T;
13
+ /**
14
+ * ### 获取模型类名称
15
+ * @param target 实例
16
+ */
17
+ export declare function getModelName<E extends Transformer>(target: E): string;
@@ -1,4 +1,5 @@
1
1
  import { DecoratorTarget } from '@airpower/transformer';
2
+ import { RootModel } from '../../../base';
2
3
  import { ISearchField } from './ISearchField';
3
4
  /**
4
5
  * ### 标记该字段可用于表单配置
@@ -10,15 +11,15 @@ export declare function Search(config?: ISearchField): (target: DecoratorTarget,
10
11
  * @param target 目标类或对象
11
12
  * @param key 属性名
12
13
  */
13
- export declare function getSearchConfig(target: DecoratorTarget, key: string): ISearchField;
14
+ export declare function getSearchConfig<M extends RootModel>(target: M, key: string): ISearchField;
14
15
  /**
15
16
  * ### 获取标记了搜索配置的字段列表
16
17
  * @param target 目标对象
17
18
  */
18
- export declare function getSearchFieldList(target: DecoratorTarget): string[];
19
+ export declare function getSearchFieldList<M extends RootModel>(target: M): string[];
19
20
  /**
20
21
  * ### 获取指定类的搜索字段配置项列表
21
22
  * @param target 目标类或对象
22
23
  * @param keyList 选择字段列表
23
24
  */
24
- export declare function getSearchConfigList(target: DecoratorTarget, keyList?: string[]): ISearchField[];
25
+ export declare function getSearchConfigList<M extends RootModel>(target: M, keyList?: string[]): ISearchField[];
@@ -1,4 +1,5 @@
1
1
  import { DecoratorTarget } from '@airpower/transformer';
2
+ import { RootModel } from '../../../base';
2
3
  import { ITableColumn } from './ITableColumn';
3
4
  /**
4
5
  * ### 为属性标记是表格字段
@@ -10,15 +11,15 @@ export declare function Table(config?: ITableColumn): (target: DecoratorTarget,
10
11
  * @param target 目标对象
11
12
  * @param key 属性名
12
13
  */
13
- export declare function getTableConfig(target: DecoratorTarget, key: string): ITableColumn;
14
+ export declare function getTableConfig<M extends RootModel>(target: M, key: string): ITableColumn;
14
15
  /**
15
16
  * ### 获取标记了表格配置的字段列表
16
17
  * @param target 目标对象
17
18
  */
18
- export declare function getTableFieldList(target: DecoratorTarget): string[];
19
+ export declare function getTableFieldList<M extends RootModel>(target: M): string[];
19
20
  /**
20
21
  * ### 获取字段标记的表格字段配置列表
21
22
  * @param target 目标实体类
22
23
  * @param keyList 字段列表
23
24
  */
24
- export declare function getTableConfigList(target: DecoratorTarget, keyList?: string[]): Array<ITableColumn>;
25
+ export declare function getTableConfigList<M extends RootModel>(target: M, keyList?: string[]): Array<ITableColumn>;
package/dist/main.js CHANGED
@@ -1205,6 +1205,9 @@ function Model(config = {}) {
1205
1205
  function getModelConfig(target) {
1206
1206
  return DecoratorUtil.getClassConfig(target, KEY$2, {}, true);
1207
1207
  }
1208
+ function getModelName(target) {
1209
+ return getModelConfig(target).label || target.constructor.name;
1210
+ }
1208
1211
  const KEY$1 = `${DecoratorUtil.DecoratorKeyPrefix}[Search]`;
1209
1212
  const LIST_KEY$1 = `${DecoratorUtil.DecoratorKeyPrefix}[SearchList]`;
1210
1213
  function Search(config = {}) {
@@ -11746,17 +11749,24 @@ class WebValidator {
11746
11749
  }
11747
11750
  class WebConfig {
11748
11751
  /**
11749
- * ### 获取 `AccessToken`
11752
+ * ### 获取身份令牌
11750
11753
  */
11751
11754
  static getAccessToken() {
11752
11755
  return localStorage.getItem(this.authorizationHeaderKey) || "";
11753
11756
  }
11754
11757
  /**
11755
- * ### 移除 `AccessToken`
11758
+ * ### 移除身份令牌
11756
11759
  */
11757
11760
  static removeAccessToken() {
11758
11761
  localStorage.removeItem(this.authorizationHeaderKey);
11759
11762
  }
11763
+ /**
11764
+ * ### 设置身份令牌
11765
+ * @param accessToken 身份令牌
11766
+ */
11767
+ static saveAccessToken(accessToken) {
11768
+ localStorage.setItem(this.authorizationHeaderKey, accessToken);
11769
+ }
11760
11770
  }
11761
11771
  /**
11762
11772
  * ### 应用标识
@@ -12042,6 +12052,7 @@ export {
12042
12052
  getFormConfigList,
12043
12053
  getFormFieldList,
12044
12054
  getModelConfig,
12055
+ getModelName,
12045
12056
  getSearchConfig,
12046
12057
  getSearchConfigList,
12047
12058
  getSearchFieldList,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@airpower/web",
3
3
  "type": "module",
4
- "version": "0.2.11",
4
+ "version": "0.2.13",
5
5
  "description": "AirPower-Web",
6
6
  "author": {
7
7
  "name": "Hamm",