@airpower/web 0.2.29 → 0.2.30

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.
@@ -13,14 +13,8 @@ export declare function Form<M extends RootModel>(config?: FieldConfigOptionalKe
13
13
  * @param field 属性名
14
14
  */
15
15
  export declare function getFormConfig<M extends RootModel>(Class: ITransformerConstructor<M>, field: TransformerField<M>): IFormField;
16
- /**
17
- * ### 获取标记了表单配置的字段列表
18
- * @param Class 目标类
19
- */
20
- export declare function getFormFieldList<M extends RootModel>(Class: ITransformerConstructor<M>): Array<TransformerField<M>>;
21
16
  /**
22
17
  * ### 获取指定类的表单字段配置项列表
23
18
  * @param Class 目标类
24
- * @param fieldList 选择字段列表
25
19
  */
26
- export declare function getFormConfigList<M extends RootModel>(Class: ITransformerConstructor<M>, fieldList?: Array<TransformerField<M>>): IFormField[];
20
+ export declare function getFormConfigList<M extends RootModel>(Class: ITransformerConstructor<M>): IFormField[];
@@ -13,14 +13,8 @@ export declare function Search<M extends RootModel>(config?: FieldConfigOptional
13
13
  * @param field 属性名
14
14
  */
15
15
  export declare function getSearchConfig<M extends RootModel>(Class: ITransformerConstructor<M>, field: TransformerField<M>): ISearchField;
16
- /**
17
- * ### 获取标记了搜索配置的字段列表
18
- * @param Class 目标类
19
- */
20
- export declare function getSearchFieldList<M extends RootModel>(Class: ITransformerConstructor<M>): Array<TransformerField<M>>;
21
16
  /**
22
17
  * ### 获取指定类的搜索字段配置项列表
23
18
  * @param Class 目标类
24
- * @param fieldList 选择字段列表
25
19
  */
26
- export declare function getSearchConfigList<M extends RootModel>(Class: ITransformerConstructor<M>, fieldList?: Array<TransformerField<M>>): ISearchField[];
20
+ export declare function getSearchConfigList<M extends RootModel>(Class: ITransformerConstructor<M>): ISearchField[];
@@ -13,14 +13,8 @@ export declare function Table<M extends RootModel>(config?: FieldConfigOptionalK
13
13
  * @param field 属性名
14
14
  */
15
15
  export declare function getTableConfig<M extends RootModel>(Class: ITransformerConstructor<M>, field: TransformerField<M>): ITableColumn;
16
- /**
17
- * ### 获取标记了表格配置的字段列表
18
- * @param Class 目标类
19
- */
20
- export declare function getTableFieldList<M extends RootModel>(Class: ITransformerConstructor<M>): Array<TransformerField<M>>;
21
16
  /**
22
17
  * ### 获取字段标记的表格字段配置列表
23
18
  * @param Class 目标类
24
- * @param fieldList 字段列表
25
19
  */
26
- export declare function getTableConfigList<M extends RootModel>(Class: ITransformerConstructor<M>, fieldList?: Array<TransformerField<M>>): Array<ITableColumn>;
20
+ export declare function getTableConfigList<M extends RootModel>(Class: ITransformerConstructor<M>): Array<ITableColumn>;
package/dist/main.js CHANGED
@@ -730,12 +730,8 @@ class DecoratorUtil {
730
730
  * @param field 属性
731
731
  * @param fieldConfigKey 配置项索引键值
732
732
  * @param fieldConfig 配置的参数
733
- * @param fieldListKey `可选` 类配置项列表索引值
734
733
  */
735
- static setFieldConfig(instance, field, fieldConfigKey, fieldConfig, fieldListKey) {
736
- if (fieldListKey) {
737
- this.addFieldDecoratorKey(instance, field, fieldListKey);
738
- }
734
+ static setFieldConfig(instance, field, fieldConfigKey, fieldConfig) {
739
735
  this.setProperty(instance, `${fieldConfigKey}[${field.toString()}]`, fieldConfig);
740
736
  }
741
737
  /**
@@ -795,17 +791,6 @@ class DecoratorUtil {
795
791
  configurable: true
796
792
  });
797
793
  }
798
- /**
799
- * ### 设置一个属性的包含装饰器索引
800
- * @param instance 目标类
801
- * @param field 属性
802
- * @param propertyKey 类配置项列表索引值
803
- */
804
- static addFieldDecoratorKey(instance, field, propertyKey) {
805
- const list = Reflect.get(instance, propertyKey) || [];
806
- list.push(field);
807
- this.setProperty(instance, propertyKey, list);
808
- }
809
794
  }
810
795
  class Transformer {
811
796
  /**
@@ -13633,17 +13618,16 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
13633
13618
  }
13634
13619
  });
13635
13620
  const KEY$2 = "[Form]";
13636
- const LIST_KEY$2 = "[FormList]";
13637
13621
  function Form(config = {}) {
13638
13622
  return (instance, key) => {
13639
13623
  config.key = key.toString();
13640
- DecoratorUtil.setFieldConfig(instance, key, KEY$2, config, LIST_KEY$2);
13624
+ DecoratorUtil.setFieldConfig(instance, key, KEY$2, config);
13641
13625
  };
13642
13626
  }
13643
13627
  function getFormConfig(Class, field) {
13644
13628
  const formConfig = DecoratorUtil.getFieldConfig(Class, field.toString(), KEY$2, true);
13645
13629
  if (!formConfig) {
13646
- return { key: field.toString() };
13630
+ return { key: "" };
13647
13631
  }
13648
13632
  if (!formConfig.dictionary) {
13649
13633
  const props = getFieldConfig(Class, field);
@@ -13653,14 +13637,9 @@ function getFormConfig(Class, field) {
13653
13637
  }
13654
13638
  return formConfig;
13655
13639
  }
13656
- function getFormFieldList(Class) {
13657
- return DecoratorUtil.getFieldList(Class, LIST_KEY$2);
13658
- }
13659
- function getFormConfigList(Class, fieldList = []) {
13660
- if (fieldList.length === 0) {
13661
- fieldList = getFormFieldList(Class);
13662
- }
13663
- const list = fieldList.map((field) => getFormConfig(Class, field));
13640
+ function getFormConfigList(Class) {
13641
+ const fieldList = Object.keys(Class.prototype);
13642
+ const list = fieldList.map((field) => getFormConfig(Class, field)).filter((item) => !!item.key);
13664
13643
  return list.filter((item) => !item.hide).sort((a, b) => (b.order || 0) - (a.order || 0));
13665
13644
  }
13666
13645
  var FormTrim = /* @__PURE__ */ ((FormTrim2) => {
@@ -16757,53 +16736,41 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
16757
16736
  }
16758
16737
  });
16759
16738
  const KEY$1 = "[Search]";
16760
- const LIST_KEY$1 = "[SearchList]";
16761
16739
  function Search(config = {}) {
16762
16740
  return (instance, field) => {
16763
16741
  config.key = field.toString();
16764
- DecoratorUtil.setFieldConfig(instance, field, KEY$1, config, LIST_KEY$1);
16742
+ DecoratorUtil.setFieldConfig(instance, field, KEY$1, config);
16765
16743
  };
16766
16744
  }
16767
16745
  function getSearchConfig(Class, field) {
16768
16746
  const formConfig = DecoratorUtil.getFieldConfig(Class, field.toString(), KEY$1, true);
16769
16747
  if (!formConfig) {
16770
- return { key: field.toString() };
16748
+ return { key: "" };
16771
16749
  }
16772
16750
  return formConfig;
16773
16751
  }
16774
- function getSearchFieldList(Class) {
16775
- return DecoratorUtil.getFieldList(Class, LIST_KEY$1);
16776
- }
16777
- function getSearchConfigList(Class, fieldList = []) {
16778
- if (fieldList.length === 0) {
16779
- fieldList = getSearchFieldList(Class);
16780
- }
16752
+ function getSearchConfigList(Class) {
16753
+ const fieldList = Object.keys(Class.prototype);
16781
16754
  const list = fieldList.map((field) => getSearchConfig(Class, field));
16782
16755
  return list.filter((item) => !item.hide).sort((a, b) => (b.order || 0) - (a.order || 0));
16783
16756
  }
16784
16757
  const KEY = "[Table]";
16785
- const LIST_KEY = "[TableList]";
16786
16758
  function Table(config = {}) {
16787
16759
  return (instance, field) => {
16788
16760
  config.key = field.toString();
16789
- DecoratorUtil.setFieldConfig(instance, field, KEY, config, LIST_KEY);
16761
+ DecoratorUtil.setFieldConfig(instance, field, KEY, config);
16790
16762
  };
16791
16763
  }
16792
16764
  function getTableConfig(Class, field) {
16793
16765
  const tableConfig = DecoratorUtil.getFieldConfig(Class, field, KEY, true);
16794
16766
  if (!tableConfig) {
16795
- return { key: field.toString() };
16767
+ return { key: "" };
16796
16768
  }
16797
16769
  return tableConfig;
16798
16770
  }
16799
- function getTableFieldList(Class) {
16800
- return DecoratorUtil.getFieldList(Class, LIST_KEY);
16801
- }
16802
- function getTableConfigList(Class, fieldList = []) {
16803
- if (fieldList.length === 0) {
16804
- fieldList = getTableFieldList(Class);
16805
- }
16806
- const list = fieldList.map((field) => getTableConfig(Class, field));
16771
+ function getTableConfigList(Class) {
16772
+ const fieldList = Object.keys(Class.prototype);
16773
+ const list = fieldList.map((field) => getTableConfig(Class, field)).filter((item) => !!item.key);
16807
16774
  return list.sort((a, b) => (b.order || 0) - (a.order || 0));
16808
16775
  }
16809
16776
  var __defProp$2 = Object.defineProperty;
@@ -18727,7 +18694,7 @@ class WebValidator {
18727
18694
  */
18728
18695
  static createRules(service, rules = {}) {
18729
18696
  const formRules = rules;
18730
- const formFieldList = getFormFieldList(service.entityClass).map((key) => getFormConfig(service.entityClass, key));
18697
+ const formFieldList = getFormConfigList(service.entityClass);
18731
18698
  for (let i = 0; i < formFieldList.length; i += 1) {
18732
18699
  const config = formFieldList[i];
18733
18700
  const fieldKey = config.key;
@@ -19780,17 +19747,14 @@ export {
19780
19747
  getFieldLabel,
19781
19748
  getFormConfig,
19782
19749
  getFormConfigList,
19783
- getFormFieldList,
19784
19750
  getIgnorePrefix,
19785
19751
  getModelConfig,
19786
19752
  getModelName,
19787
19753
  getPrefix,
19788
19754
  getSearchConfig,
19789
19755
  getSearchConfigList,
19790
- getSearchFieldList,
19791
19756
  getTableConfig,
19792
19757
  getTableConfigList,
19793
- getTableFieldList,
19794
19758
  getToClass,
19795
19759
  getToJson,
19796
19760
  getType,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@airpower/web",
3
3
  "type": "module",
4
- "version": "0.2.29",
4
+ "version": "0.2.30",
5
5
  "description": "AirPower-Web",
6
6
  "author": {
7
7
  "name": "Hamm",
@@ -41,7 +41,7 @@
41
41
  "dependencies": {
42
42
  "@airpower/enum": "^0.0.10",
43
43
  "@airpower/i18n": "^0.0.4",
44
- "@airpower/transformer": "^0.1.6",
44
+ "@airpower/transformer": "^0.1.7",
45
45
  "@airpower/util": "^0.1.3",
46
46
  "@element-plus/icons-vue": "^2.3.1",
47
47
  "axios": "^1.8.4",