@airpower/web 0.2.14 → 0.2.16

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.
@@ -1,3 +1,4 @@
1
+ import { ITransformerConstructor } from '@airpower/transformer';
1
2
  import { RootEntity } from '../../../base';
2
3
  import { ITableColumn } from '../../../curd';
3
4
  declare const _default: <E extends RootEntity>(__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<{
@@ -5,7 +6,7 @@ declare const _default: <E extends RootEntity>(__VLS_props: NonNullable<Awaited<
5
6
  readonly onChanged?: ((args_0: string[]) => any) | undefined;
6
7
  } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onChanged"> & {
7
8
  columnList: Array<ITableColumn>;
8
- entityInstance: E;
9
+ entityClass: ITransformerConstructor<E>;
9
10
  } & Partial<{}>> & import('vue').PublicProps;
10
11
  expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
11
12
  attrs: any;
@@ -1,3 +1,4 @@
1
+ import { ITransformerConstructor } from '@airpower/transformer';
1
2
  import { Ref } from 'vue';
2
3
  import { RootEntity } from '../../base';
3
4
  import { IModelConfig, ITableColumn } from '../../curd';
@@ -8,9 +9,9 @@ import { IModelConfig, ITableColumn } from '../../curd';
8
9
  */
9
10
  export declare function useTableColumn<E extends RootEntity>(params: {
10
11
  /**
11
- * ### 实体实例
12
+ * ### 实体类
12
13
  */
13
- entityInstance: E;
14
+ entityClass: ITransformerConstructor<E>;
14
15
  /**
15
16
  * ### 自定义字段
16
17
  */
@@ -1,5 +1,5 @@
1
1
  import { EnumKey } from '@airpower/enum/dist/enum/type';
2
- import { DecoratorTarget } from '@airpower/transformer';
2
+ import { DecoratorTarget, ITransformerConstructor } from '@airpower/transformer';
3
3
  import { RootModel } from '../../../base';
4
4
  import { WebEnumConstructor } from '../../../util';
5
5
  import { IFieldConfig } from './IFieldConfig';
@@ -12,19 +12,19 @@ export declare function Field<K extends EnumKey = EnumKey>(config?: FieldConfigO
12
12
  /**
13
13
  * ### 获取属性的配置
14
14
  * @returns 配置对象
15
- * @param target 目标类
15
+ * @param TargetClass 目标类
16
16
  * @param key 属性名
17
17
  */
18
- export declare function getFieldConfig<M extends RootModel, K extends EnumKey = EnumKey>(target: M, key: string): IFieldConfig<K>;
18
+ export declare function getFieldConfig<M extends RootModel, K extends EnumKey = EnumKey>(TargetClass: ITransformerConstructor<M>, key: string): IFieldConfig<K>;
19
19
  /**
20
20
  * ### 获取属性的枚举字典
21
- * @param target 目标类
21
+ * @param TargetClass 目标类
22
22
  * @param key 属性名
23
23
  */
24
- export declare function getDictionary<M extends RootModel, K extends EnumKey = EnumKey>(target: M, key: string): WebEnumConstructor<K> | undefined;
24
+ export declare function getDictionary<M extends RootModel, K extends EnumKey = EnumKey>(TargetClass: ITransformerConstructor<M>, key: string): WebEnumConstructor<K> | undefined;
25
25
  /**
26
26
  * ### 获取属性的标题
27
- * @param target 目标类
27
+ * @param TargetClass 目标类
28
28
  * @param key string 属性名
29
29
  */
30
- export declare function getFieldLabel<M extends RootModel>(target: M, key: string): string;
30
+ export declare function getFieldLabel<M extends RootModel>(TargetClass: ITransformerConstructor<M>, key: string): string;
@@ -1,4 +1,4 @@
1
- import { DecoratorTarget } from '@airpower/transformer';
1
+ import { DecoratorTarget, ITransformerConstructor } from '@airpower/transformer';
2
2
  import { RootModel } from '../../../base';
3
3
  import { FieldConfigOptionalKey } from '../@Field';
4
4
  import { IFormField } from './IFormField';
@@ -9,18 +9,18 @@ import { IFormField } from './IFormField';
9
9
  export declare function Form(config?: FieldConfigOptionalKey<IFormField>): (target: DecoratorTarget, key: string) => void;
10
10
  /**
11
11
  * ### 获取对象某个字段标记的表单配置项
12
- * @param target 目标类或对象
12
+ * @param TargetClass 目标类
13
13
  * @param key 属性名
14
14
  */
15
- export declare function getFormConfig<M extends RootModel>(target: M, key: string): IFormField;
15
+ export declare function getFormConfig<M extends RootModel>(TargetClass: ITransformerConstructor<M>, key: string): IFormField;
16
16
  /**
17
17
  * ### 获取标记了表单配置的字段列表
18
- * @param target 目标对象
18
+ * @param TargetClass 目标类
19
19
  */
20
- export declare function getFormFieldList<M extends RootModel>(target: M): string[];
20
+ export declare function getFormFieldList<M extends RootModel>(TargetClass: ITransformerConstructor<M>): string[];
21
21
  /**
22
22
  * ### 获取指定类的表单字段配置项列表
23
- * @param target 目标类或对象
23
+ * @param TargetClass 目标类
24
24
  * @param keyList 选择字段列表
25
25
  */
26
- export declare function getFormConfigList<M extends RootModel>(target: M, keyList?: string[]): IFormField[];
26
+ export declare function getFormConfigList<M extends RootModel>(TargetClass: ITransformerConstructor<M>, keyList?: string[]): IFormField[];
@@ -1,4 +1,4 @@
1
- import { DecoratorTarget, Transformer } from '@airpower/transformer';
1
+ import { DecoratorTarget, ITransformerConstructor, Transformer } from '@airpower/transformer';
2
2
  import { IModelConfig } from './IModelConfig';
3
3
  /**
4
4
  * ### 为模型类标记配置项
@@ -7,11 +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 TargetClass 目标类
11
11
  */
12
- export declare function getModelConfig<E extends Transformer, T extends IModelConfig = IModelConfig>(target: E): T;
12
+ export declare function getModelConfig<E extends Transformer, T extends IModelConfig = IModelConfig>(TargetClass: ITransformerConstructor<E>): T;
13
13
  /**
14
14
  * ### 获取模型类名称
15
- * @param target 实例
15
+ * @param TargetClass 目标类
16
16
  */
17
- export declare function getModelName<E extends Transformer>(target: E): string;
17
+ export declare function getModelName<E extends Transformer>(TargetClass: ITransformerConstructor<E>): string;
@@ -1,4 +1,4 @@
1
- import { DecoratorTarget } from '@airpower/transformer';
1
+ import { DecoratorTarget, ITransformerConstructor } from '@airpower/transformer';
2
2
  import { RootModel } from '../../../base';
3
3
  import { FieldConfigOptionalKey } from '../@Field';
4
4
  import { ISearchField } from './ISearchField';
@@ -9,18 +9,18 @@ import { ISearchField } from './ISearchField';
9
9
  export declare function Search(config?: FieldConfigOptionalKey<ISearchField>): (target: DecoratorTarget, key: string) => void;
10
10
  /**
11
11
  * ### 获取对象某个字段标记的搜索配置项
12
- * @param target 目标类或对象
12
+ * @param TargetClass 目标类
13
13
  * @param key 属性名
14
14
  */
15
- export declare function getSearchConfig<M extends RootModel>(target: M, key: string): ISearchField;
15
+ export declare function getSearchConfig<M extends RootModel>(TargetClass: ITransformerConstructor<M>, key: string): ISearchField;
16
16
  /**
17
17
  * ### 获取标记了搜索配置的字段列表
18
- * @param target 目标对象
18
+ * @param TargetClass 目标类
19
19
  */
20
- export declare function getSearchFieldList<M extends RootModel>(target: M): string[];
20
+ export declare function getSearchFieldList<M extends RootModel>(TargetClass: ITransformerConstructor<M>): string[];
21
21
  /**
22
22
  * ### 获取指定类的搜索字段配置项列表
23
- * @param target 目标类或对象
23
+ * @param TargetClass 目标类
24
24
  * @param keyList 选择字段列表
25
25
  */
26
- export declare function getSearchConfigList<M extends RootModel>(target: M, keyList?: string[]): ISearchField[];
26
+ export declare function getSearchConfigList<M extends RootModel>(TargetClass: ITransformerConstructor<M>, keyList?: string[]): ISearchField[];
@@ -1,4 +1,4 @@
1
- import { DecoratorTarget } from '@airpower/transformer';
1
+ import { DecoratorTarget, ITransformerConstructor } from '@airpower/transformer';
2
2
  import { RootModel } from '../../../base';
3
3
  import { FieldConfigOptionalKey } from '../@Field';
4
4
  import { ITableColumn } from './ITableColumn';
@@ -9,18 +9,18 @@ import { ITableColumn } from './ITableColumn';
9
9
  export declare function Table(config?: FieldConfigOptionalKey<ITableColumn>): (target: DecoratorTarget, key: string) => void;
10
10
  /**
11
11
  * ### 获取对象的属性表格的配置
12
- * @param target 目标对象
12
+ * @param TargetClass 目标类
13
13
  * @param key 属性名
14
14
  */
15
- export declare function getTableConfig<M extends RootModel>(target: M, key: string): ITableColumn;
15
+ export declare function getTableConfig<M extends RootModel>(TargetClass: ITransformerConstructor<M>, key: string): ITableColumn;
16
16
  /**
17
17
  * ### 获取标记了表格配置的字段列表
18
- * @param target 目标对象
18
+ * @param TargetClass 目标类
19
19
  */
20
- export declare function getTableFieldList<M extends RootModel>(target: M): string[];
20
+ export declare function getTableFieldList<M extends RootModel>(TargetClass: ITransformerConstructor<M>): string[];
21
21
  /**
22
22
  * ### 获取字段标记的表格字段配置列表
23
- * @param target 目标实体类
23
+ * @param TargetClass 目标类
24
24
  * @param keyList 字段列表
25
25
  */
26
- export declare function getTableConfigList<M extends RootModel>(target: M, keyList?: string[]): Array<ITableColumn>;
26
+ export declare function getTableConfigList<M extends RootModel>(TargetClass: ITransformerConstructor<M>, keyList?: string[]): Array<ITableColumn>;
package/dist/main.js CHANGED
@@ -1151,16 +1151,16 @@ function Field(config = {}) {
1151
1151
  DecoratorUtil.setFieldConfig(target, key, KEY$4, config);
1152
1152
  };
1153
1153
  }
1154
- function getFieldConfig(target, key) {
1155
- return DecoratorUtil.getFieldConfig(target, key, KEY$4, true) || {};
1154
+ function getFieldConfig(TargetClass, key) {
1155
+ return DecoratorUtil.getFieldConfig(TargetClass, key, KEY$4, true) || {};
1156
1156
  }
1157
- function getDictionary(target, key) {
1157
+ function getDictionary(TargetClass, key) {
1158
1158
  var _a;
1159
- return (_a = getFieldConfig(target, key)) == null ? void 0 : _a.dictionary;
1159
+ return (_a = getFieldConfig(TargetClass, key)) == null ? void 0 : _a.dictionary;
1160
1160
  }
1161
- function getFieldLabel(target, key) {
1161
+ function getFieldLabel(TargetClass, key) {
1162
1162
  var _a;
1163
- return ((_a = getFieldConfig(target, key)) == null ? void 0 : _a.label) || key;
1163
+ return ((_a = getFieldConfig(TargetClass, key)) == null ? void 0 : _a.label) || key;
1164
1164
  }
1165
1165
  const KEY$3 = `${DecoratorUtil.DecoratorKeyPrefix}[Form]`;
1166
1166
  const LIST_KEY$2 = `${DecoratorUtil.DecoratorKeyPrefix}[FormList]`;
@@ -1170,27 +1170,27 @@ function Form(config = {}) {
1170
1170
  DecoratorUtil.setFieldConfig(target, key, KEY$3, config);
1171
1171
  };
1172
1172
  }
1173
- function getFormConfig(target, key) {
1174
- const formConfig = DecoratorUtil.getFieldConfig(target, key, KEY$3, true);
1173
+ function getFormConfig(TargetClass, key) {
1174
+ const formConfig = DecoratorUtil.getFieldConfig(TargetClass, key, KEY$3, true);
1175
1175
  if (!formConfig) {
1176
1176
  return { key };
1177
1177
  }
1178
1178
  if (!formConfig.dictionary) {
1179
- const props = getFieldConfig(target, key);
1179
+ const props = getFieldConfig(TargetClass, key);
1180
1180
  if (props && props.dictionary) {
1181
1181
  formConfig.dictionary = props.dictionary;
1182
1182
  }
1183
1183
  }
1184
1184
  return formConfig;
1185
1185
  }
1186
- function getFormFieldList(target) {
1187
- return DecoratorUtil.getFieldList(target, LIST_KEY$2);
1186
+ function getFormFieldList(TargetClass) {
1187
+ return DecoratorUtil.getFieldList(TargetClass, LIST_KEY$2);
1188
1188
  }
1189
- function getFormConfigList(target, keyList = []) {
1189
+ function getFormConfigList(TargetClass, keyList = []) {
1190
1190
  if (keyList.length === 0) {
1191
- keyList = getFormFieldList(target);
1191
+ keyList = getFormFieldList(TargetClass);
1192
1192
  }
1193
- const list = keyList.map((key) => getFormConfig(target, key));
1193
+ const list = keyList.map((key) => getFormConfig(TargetClass, key));
1194
1194
  return list.filter((item) => !item.hide).sort((a, b) => (b.order || 0) - (a.order || 0));
1195
1195
  }
1196
1196
  var FormTrim = /* @__PURE__ */ ((FormTrim2) => {
@@ -1203,11 +1203,11 @@ const KEY$2 = `${DecoratorUtil.DecoratorKeyPrefix}[MODEL]`;
1203
1203
  function Model(config = {}) {
1204
1204
  return (target) => DecoratorUtil.setClassConfig(target, KEY$2, config);
1205
1205
  }
1206
- function getModelConfig(target) {
1207
- return DecoratorUtil.getClassConfig(target, KEY$2, {}, true);
1206
+ function getModelConfig(TargetClass) {
1207
+ return DecoratorUtil.getClassConfig(TargetClass, KEY$2, {}, true);
1208
1208
  }
1209
- function getModelName(target) {
1210
- return getModelConfig(target).label || target.constructor.name;
1209
+ function getModelName(TargetClass) {
1210
+ return getModelConfig(TargetClass).label || TargetClass.name;
1211
1211
  }
1212
1212
  const KEY$1 = `${DecoratorUtil.DecoratorKeyPrefix}[Search]`;
1213
1213
  const LIST_KEY$1 = `${DecoratorUtil.DecoratorKeyPrefix}[SearchList]`;
@@ -1217,21 +1217,22 @@ function Search(config = {}) {
1217
1217
  DecoratorUtil.setFieldConfig(target, key, KEY$1, config);
1218
1218
  };
1219
1219
  }
1220
- function getSearchConfig(target, key) {
1221
- const formConfig = DecoratorUtil.getFieldConfig(target, key, KEY$1, true);
1220
+ function getSearchConfig(TargetClass, key) {
1221
+ const instance = new TargetClass();
1222
+ const formConfig = DecoratorUtil.getFieldConfig(instance, key, KEY$1, true);
1222
1223
  if (!formConfig) {
1223
1224
  return { key };
1224
1225
  }
1225
1226
  return formConfig;
1226
1227
  }
1227
- function getSearchFieldList(target) {
1228
- return DecoratorUtil.getFieldList(target, LIST_KEY$1);
1228
+ function getSearchFieldList(TargetClass) {
1229
+ return DecoratorUtil.getFieldList(TargetClass, LIST_KEY$1);
1229
1230
  }
1230
- function getSearchConfigList(target, keyList = []) {
1231
+ function getSearchConfigList(TargetClass, keyList = []) {
1231
1232
  if (keyList.length === 0) {
1232
- keyList = getSearchFieldList(target);
1233
+ keyList = getSearchFieldList(TargetClass);
1233
1234
  }
1234
- const list = keyList.map((key) => getSearchConfig(target, key));
1235
+ const list = keyList.map((key) => getSearchConfig(TargetClass, key));
1235
1236
  return list.filter((item) => !item.hide).sort((a, b) => (b.order || 0) - (a.order || 0));
1236
1237
  }
1237
1238
  const KEY = `${DecoratorUtil.DecoratorKeyPrefix}[Table]`;
@@ -1242,21 +1243,22 @@ function Table(config = {}) {
1242
1243
  DecoratorUtil.setFieldConfig(target, key, KEY, config);
1243
1244
  };
1244
1245
  }
1245
- function getTableConfig(target, key) {
1246
- const tableConfig = DecoratorUtil.getFieldConfig(target, key, KEY, true);
1246
+ function getTableConfig(TargetClass, key) {
1247
+ const instance = new TargetClass();
1248
+ const tableConfig = DecoratorUtil.getFieldConfig(instance, key, KEY, true);
1247
1249
  if (!tableConfig) {
1248
1250
  return { key };
1249
1251
  }
1250
1252
  return tableConfig;
1251
1253
  }
1252
- function getTableFieldList(target) {
1253
- return DecoratorUtil.getFieldList(target, LIST_KEY);
1254
+ function getTableFieldList(TargetClass) {
1255
+ return DecoratorUtil.getFieldList(TargetClass, LIST_KEY);
1254
1256
  }
1255
- function getTableConfigList(target, keyList = []) {
1257
+ function getTableConfigList(TargetClass, keyList = []) {
1256
1258
  if (keyList.length === 0) {
1257
- keyList = getTableFieldList(target);
1259
+ keyList = getTableFieldList(TargetClass);
1258
1260
  }
1259
- const list = keyList.map((key) => getTableConfig(target, key));
1261
+ const list = keyList.map((key) => getTableConfig(TargetClass, key));
1260
1262
  return list.sort((a, b) => (b.order || 0) - (a.order || 0));
1261
1263
  }
1262
1264
  function useDetail(props, ServiceClass, option = {}) {
@@ -3638,11 +3640,10 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
3638
3640
  if (!formData) {
3639
3641
  throw new Error("请手动为AFormField绑定v-model或使用 useEditor 创建表单对象(推荐)!!!");
3640
3642
  }
3641
- const entityClass = inject("entityClass") || props.entity;
3642
- if (!entityClass) {
3643
+ const EntityClass = inject("entityClass") || props.entity;
3644
+ if (!EntityClass) {
3643
3645
  throw new Error("请手动传入到AFormField的entity属性或使用 useEditor 创建表单对象(推荐)!!!");
3644
3646
  }
3645
- const entityInstance = computed(() => Transformer.newInstance(entityClass));
3646
3647
  function onChange(val) {
3647
3648
  formData.value[props.field] = val;
3648
3649
  emits("update:modelValue", formData.value);
@@ -3653,7 +3654,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
3653
3654
  }
3654
3655
  return (_ctx, _cache) => {
3655
3656
  return openBlock(), createBlock(unref(ElFormItem), {
3656
- label: unref(getFieldLabel)(entityInstance.value, __props.field),
3657
+ label: unref(getFieldLabel)(unref(EntityClass), __props.field),
3657
3658
  prop: __props.field
3658
3659
  }, {
3659
3660
  default: withCtx(() => [
@@ -3663,7 +3664,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
3663
3664
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(formData)[__props.field] = $event),
3664
3665
  disabled: __props.disabled,
3665
3666
  "disabled-value": __props.disabledValue,
3666
- entity: unref(entityClass),
3667
+ entity: unref(EntityClass),
3667
3668
  list: __props.list,
3668
3669
  "model-modifiers": { field: __props.field },
3669
3670
  modifier: __props.field,
@@ -7084,7 +7085,6 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
7084
7085
  setup(__props, { emit: __emit }) {
7085
7086
  const props = __props;
7086
7087
  const emits = __emit;
7087
- const entityInstance = ref(props.entity ? Transformer.parse({}, props.entity) : void 0);
7088
7088
  const value = ref(props.modelValue);
7089
7089
  function emitChange() {
7090
7090
  emits("change", value.value);
@@ -7229,12 +7229,11 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
7229
7229
  function init() {
7230
7230
  var _a, _b;
7231
7231
  initFieldName();
7232
- console.warn(props.entity, fieldName.value, entityInstance.value);
7233
- if (props.entity && fieldName.value && entityInstance.value) {
7234
- formConfig.value = getFormConfig(entityInstance.value, fieldName.value);
7235
- fieldConfig.value = getFieldConfig(entityInstance.value, fieldName.value);
7232
+ if (props.entity && fieldName.value) {
7233
+ formConfig.value = getFormConfig(props.entity, fieldName.value);
7234
+ fieldConfig.value = getFieldConfig(props.entity, fieldName.value);
7236
7235
  if (!placeholderRef.value) {
7237
- const field = fieldConfig.value.label || getFieldConfig(entityInstance.value, fieldName.value).label || fieldName;
7236
+ const field = fieldConfig.value.label || getFieldConfig(props.entity, fieldName.value).label || fieldName;
7238
7237
  placeholderRef.value = `请输入${field}...`;
7239
7238
  if (formConfig.value) {
7240
7239
  if (dictionary.value || fieldConfig.value.dictionary || props.list || props.tree || formConfig.value.dateType !== void 0) {
@@ -9231,7 +9230,6 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
9231
9230
  onSelected,
9232
9231
  onReloadData
9233
9232
  } = useSelector(props.props, service, hookOptions);
9234
- const entityInstance = Transformer.parse({}, props.entity);
9235
9233
  const dialogTitle = computed(() => {
9236
9234
  if (props.title) {
9237
9235
  return props.title;
@@ -9242,10 +9240,10 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
9242
9240
  if (props.fieldList) {
9243
9241
  return props.fieldList;
9244
9242
  }
9245
- return getTableConfigList(entityInstance);
9243
+ return getTableConfigList(props.entity);
9246
9244
  });
9247
9245
  const searchParamList = computed(() => {
9248
- let list2 = getSearchConfigList(entityInstance);
9246
+ let list2 = getSearchConfigList(props.entity);
9249
9247
  if (props.searchParams) {
9250
9248
  list2 = props.searchParams;
9251
9249
  }
@@ -9382,7 +9380,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
9382
9380
  __name: "ColumnSelector",
9383
9381
  props: {
9384
9382
  columnList: {},
9385
- entityInstance: {}
9383
+ entityClass: { type: Function }
9386
9384
  },
9387
9385
  emits: ["changed"],
9388
9386
  setup(__props, { emit: __emit }) {
@@ -9439,7 +9437,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
9439
9437
  onChange: ($event) => changed($event, item)
9440
9438
  }, {
9441
9439
  default: withCtx(() => [
9442
- createTextVNode(toDisplayString(unref(getFieldLabel)(_ctx.entityInstance, item.key)), 1)
9440
+ createTextVNode(toDisplayString(unref(getFieldLabel)(_ctx.entityClass, item.key)), 1)
9443
9441
  ]),
9444
9442
  _: 2
9445
9443
  }, 1032, ["checked", "class", "disabled", "onChange"]);
@@ -9453,7 +9451,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
9453
9451
  };
9454
9452
  }
9455
9453
  });
9456
- const ColumnSelector = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-cd8bfac9"]]);
9454
+ const ColumnSelector = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-476fd094"]]);
9457
9455
  const _sfc_main$4 = /* @__PURE__ */ defineComponent({
9458
9456
  __name: "CopyColumn",
9459
9457
  props: {
@@ -9574,10 +9572,10 @@ function useTableButton(params) {
9574
9572
  }
9575
9573
  function useTableColumn(params) {
9576
9574
  const {
9577
- entityInstance,
9575
+ entityClass,
9578
9576
  customColumns = [],
9579
9577
  hideColumnSelector = false,
9580
- modelConfig = getModelConfig(entityInstance)
9578
+ modelConfig = getModelConfig(entityClass)
9581
9579
  } = params;
9582
9580
  const selectKeys = ref([]);
9583
9581
  const allColumnList = ref([]);
@@ -9589,7 +9587,7 @@ function useTableColumn(params) {
9589
9587
  return item;
9590
9588
  });
9591
9589
  } else {
9592
- allColumnList.value = getTableConfigList(entityInstance).filter((item) => !item.removed).map((item) => {
9590
+ allColumnList.value = getTableConfigList(entityClass).filter((item) => !item.removed).map((item) => {
9593
9591
  if (item.money && !item.align) {
9594
9592
  item.align = "right";
9595
9593
  }
@@ -10015,14 +10013,14 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
10015
10013
  const airTableRef = ref();
10016
10014
  const tableId = `table_${Math.random()}`;
10017
10015
  const entityInstance = Transformer.newInstance(props.entity);
10018
- const modelConfig = getModelConfig(entityInstance);
10016
+ const modelConfig = getModelConfig(props.entity);
10019
10017
  const {
10020
10018
  allColumnList,
10021
10019
  isColumnSelectorEnabled,
10022
10020
  updateSelectKeys,
10023
10021
  showColumnList
10024
10022
  } = useTableColumn({
10025
- entityInstance,
10023
+ entityClass: props.entity,
10026
10024
  customColumns: props.columnList,
10027
10025
  hideColumnSelector: props.hideColumnSelector,
10028
10026
  modelConfig
@@ -10056,7 +10054,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
10056
10054
  selectable: props.selectable,
10057
10055
  isAddDisabled: props.disableAddRow
10058
10056
  });
10059
- const searchFieldList = computed(() => props.searchParams || getSearchConfigList(entityInstance));
10057
+ const searchFieldList = computed(() => props.searchParams || getSearchConfigList(props.entity));
10060
10058
  function getStringValue(data) {
10061
10059
  if (data === void 0 || data === null) {
10062
10060
  return "";
@@ -10306,20 +10304,20 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
10306
10304
  class: "a-table-toolbar-search-item"
10307
10305
  }, [
10308
10306
  renderSlot(_ctx.$slots, item.key, { data: searchFilter.value }, () => [
10309
- unref(getDictionary)(unref(entityInstance), item.key) ? (openBlock(), createBlock(unref(ElSelect), {
10307
+ unref(getDictionary)(__props.entity, item.key) ? (openBlock(), createBlock(unref(ElSelect), {
10310
10308
  key: 0,
10311
10309
  modelValue: searchFilter.value[item.key],
10312
10310
  "onUpdate:modelValue": ($event) => searchFilter.value[item.key] = $event,
10313
10311
  clearable: item.clearable !== false,
10314
10312
  filterable: item.filterable,
10315
- placeholder: `${unref(getFieldLabel)(unref(entityInstance), item.key)}...`,
10313
+ placeholder: `${unref(getFieldLabel)(__props.entity, item.key)}...`,
10316
10314
  onChange: _cache[2] || (_cache[2] = ($event) => onSearch()),
10317
10315
  onClear: ($event) => searchFilter.value[item.key] = void 0
10318
10316
  }, {
10319
10317
  default: withCtx(() => {
10320
10318
  var _a;
10321
10319
  return [
10322
- (openBlock(true), createElementBlock(Fragment, null, renderList((_a = unref(getDictionary)(unref(entityInstance), item.key)) == null ? void 0 : _a.toArray(), (enumItem) => {
10320
+ (openBlock(true), createElementBlock(Fragment, null, renderList((_a = unref(getDictionary)(__props.entity, item.key)) == null ? void 0 : _a.toArray(), (enumItem) => {
10323
10321
  return openBlock(), createElementBlock(Fragment, null, [
10324
10322
  !enumItem.disabled ? (openBlock(), createBlock(unref(ElOption), {
10325
10323
  key: enumItem.key.toString(),
@@ -10336,7 +10334,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
10336
10334
  modelValue: searchFilter.value[item.key],
10337
10335
  "onUpdate:modelValue": ($event) => searchFilter.value[item.key] = $event,
10338
10336
  clearable: item.clearable !== false,
10339
- placeholder: `${unref(getFieldLabel)(unref(entityInstance), item.key)}...`,
10337
+ placeholder: `${unref(getFieldLabel)(__props.entity, item.key)}...`,
10340
10338
  onBlur: _cache[3] || (_cache[3] = ($event) => onSearch()),
10341
10339
  onClear: onSearch,
10342
10340
  onKeydown: withKeys(onSearch, ["enter"])
@@ -10360,9 +10358,9 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
10360
10358
  unref(isColumnSelectorEnabled) ? (openBlock(), createBlock(unref(ColumnSelector), {
10361
10359
  key: 1,
10362
10360
  "column-list": unref(allColumnList),
10363
- "entity-instance": unref(entityInstance),
10361
+ "entity-class": __props.entity,
10364
10362
  onChanged: _cache[5] || (_cache[5] = ($event) => unref(updateSelectKeys)($event))
10365
- }, null, 8, ["column-list", "entity-instance"])) : createCommentVNode("", true)
10363
+ }, null, 8, ["column-list", "entity-class"])) : createCommentVNode("", true)
10366
10364
  ])
10367
10365
  ]),
10368
10366
  unref(allColumnList) ? (openBlock(), createBlock(unref(ElTable), {
@@ -10409,7 +10407,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
10409
10407
  key: item.key,
10410
10408
  align: item.align,
10411
10409
  fixed: item.fixed,
10412
- label: unref(getFieldLabel)(unref(entityInstance), item.key),
10410
+ label: unref(getFieldLabel)(__props.entity, item.key),
10413
10411
  "min-width": item.minWidth || "auto",
10414
10412
  prop: item.key,
10415
10413
  sortable: item.sortable,
@@ -10422,11 +10420,11 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
10422
10420
  index: scope.$index
10423
10421
  }, () => [
10424
10422
  item.prefixText ? (openBlock(), createElementBlock("span", _hoisted_4$1, toDisplayString(item.prefixText), 1)) : createCommentVNode("", true),
10425
- unref(getDictionary)(unref(entityInstance), item.key) ? (openBlock(), createBlock(unref(EnumColumn), {
10423
+ unref(getDictionary)(__props.entity, item.key) ? (openBlock(), createBlock(unref(EnumColumn), {
10426
10424
  key: 1,
10427
10425
  column: item,
10428
10426
  data: scope.row,
10429
- dictionary: unref(getDictionary)(unref(entityInstance), item.key)
10427
+ dictionary: unref(getDictionary)(__props.entity, item.key)
10430
10428
  }, null, 8, ["column", "data", "dictionary"])) : item.desensitize ? (openBlock(), createBlock(unref(ADesensitize), {
10431
10429
  key: 2,
10432
10430
  content: getValue(scope, item.key),
@@ -11037,7 +11035,7 @@ class PermissionUtil {
11037
11035
  */
11038
11036
  static get(EntityClass, action) {
11039
11037
  let permission;
11040
- const modelConfig = getModelConfig(new EntityClass());
11038
+ const modelConfig = getModelConfig(EntityClass);
11041
11039
  const actionRecord = {
11042
11040
  [PermissionAction.ADD]: modelConfig == null ? void 0 : modelConfig.addPermission,
11043
11041
  [PermissionAction.DELETE]: modelConfig == null ? void 0 : modelConfig.deletePermission,
@@ -11274,8 +11272,7 @@ class WebValidator {
11274
11272
  */
11275
11273
  static createRules(service, rules = {}) {
11276
11274
  const formRules = rules;
11277
- const entity = Transformer.newInstance(service.entityClass);
11278
- const formFieldList = getFormFieldList(entity).map((key) => getFormConfig(entity, key));
11275
+ const formFieldList = getFormFieldList(service.entityClass).map((key) => getFormConfig(service.entityClass, key));
11279
11276
  for (let i = 0; i < formFieldList.length; i += 1) {
11280
11277
  const config = formFieldList[i];
11281
11278
  const fieldKey = config.key;
package/dist/web.css CHANGED
@@ -1233,10 +1233,10 @@ textarea {
1233
1233
  height: 0;
1234
1234
  overflow: hidden;
1235
1235
  overflow-y: auto;
1236
- }.a-field-selector[data-v-cd8bfac9] {
1236
+ }.a-field-selector[data-v-476fd094] {
1237
1237
  position: relative;
1238
1238
  }
1239
- .el-check-tag[data-v-cd8bfac9] {
1239
+ .el-check-tag[data-v-476fd094] {
1240
1240
  font-weight: normal !important;
1241
1241
  user-select: none;
1242
1242
  font-size: 13px;
@@ -1244,7 +1244,7 @@ textarea {
1244
1244
  margin-bottom: 5px;
1245
1245
  padding: 4px 10px;
1246
1246
  }
1247
- .a-field-selector-bg[data-v-cd8bfac9] {
1247
+ .a-field-selector-bg[data-v-476fd094] {
1248
1248
  position: fixed;
1249
1249
  left: 0;
1250
1250
  right: 0;
@@ -1253,7 +1253,7 @@ textarea {
1253
1253
  background-color: rgba(0, 0, 0, 0.1);
1254
1254
  z-index: 9999999;
1255
1255
  }
1256
- .a-field-selector-dialog[data-v-cd8bfac9] {
1256
+ .a-field-selector-dialog[data-v-476fd094] {
1257
1257
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
1258
1258
  position: absolute;
1259
1259
  right: 0;
@@ -1266,13 +1266,13 @@ textarea {
1266
1266
  overflow: hidden;
1267
1267
  z-index: 99999991;
1268
1268
  }
1269
- .a-field-selector-dialog .a-field-selector-title[data-v-cd8bfac9] {
1269
+ .a-field-selector-dialog .a-field-selector-title[data-v-476fd094] {
1270
1270
  margin-bottom: 10px;
1271
1271
  border-bottom: 1px solid var(--el-color-primary-light-9);
1272
1272
  padding: 8px 16px;
1273
1273
  font-size: 15px;
1274
1274
  }
1275
- .a-field-selector-dialog .a-field-selector-list[data-v-cd8bfac9] {
1275
+ .a-field-selector-dialog .a-field-selector-list[data-v-476fd094] {
1276
1276
  padding: 5px 15px 10px 15px;
1277
1277
  display: flex;
1278
1278
  flex-wrap: wrap;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@airpower/web",
3
3
  "type": "module",
4
- "version": "0.2.14",
4
+ "version": "0.2.16",
5
5
  "description": "AirPower-Web",
6
6
  "author": {
7
7
  "name": "Hamm",