@airpower/web 0.2.10 → 0.2.12

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.
@@ -7,5 +7,5 @@ export interface IPayload {
7
7
  /**
8
8
  * ### 获取负载标签
9
9
  */
10
- getLabel: () => string;
10
+ getPayloadLabel: () => string;
11
11
  }
@@ -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 = {}) {
@@ -7893,7 +7896,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
7893
7896
  onClick: _cache[0] || (_cache[0] = ($event) => show())
7894
7897
  }, {
7895
7898
  default: withCtx(() => [
7896
- createTextVNode(toDisplayString(__props.payload.getLabel()), 1)
7899
+ createTextVNode(toDisplayString(__props.payload.getPayloadLabel()), 1)
7897
7900
  ]),
7898
7901
  _: 1
7899
7902
  });
@@ -9132,7 +9135,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
9132
9135
  const result = useModel(__props, "modelValue");
9133
9136
  const label = computed(() => {
9134
9137
  var _a;
9135
- return ((_a = result.value) == null ? void 0 : _a.getLabel()) || props.default;
9138
+ return ((_a = result.value) == null ? void 0 : _a.getPayloadLabel()) || props.default;
9136
9139
  });
9137
9140
  async function onSelect() {
9138
9141
  result.value = await DialogUtil.show(props.selector, props.param);
@@ -12042,6 +12045,7 @@ export {
12042
12045
  getFormConfigList,
12043
12046
  getFormFieldList,
12044
12047
  getModelConfig,
12048
+ getModelName,
12045
12049
  getSearchConfig,
12046
12050
  getSearchConfigList,
12047
12051
  getSearchFieldList,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@airpower/web",
3
3
  "type": "module",
4
- "version": "0.2.10",
4
+ "version": "0.2.12",
5
5
  "description": "AirPower-Web",
6
6
  "author": {
7
7
  "name": "Hamm",