@airpower/web 1.9.5 → 1.9.6

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.
@@ -6,7 +6,6 @@ import { RootEntity } from '../../model/RootEntity';
6
6
  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<{
7
7
  props: __VLS_PrettifyLocal<Pick<Partial<{
8
8
  disabled: boolean;
9
- list: IEnum<number>[];
10
9
  entity: ITransformerConstructor<E>;
11
10
  modelValue: [{
12
11
  type: PropType<E>;
@@ -17,6 +16,7 @@ declare const _default: <E extends RootEntity>(__VLS_props: NonNullable<Awaited<
17
16
  };
18
17
  readonly: boolean;
19
18
  disabledValue: string | number | boolean | unknown[] | Record<string, any>;
19
+ list: IEnum<number>[];
20
20
  tree: (ITree & E)[];
21
21
  }> & Omit<{
22
22
  readonly disabled: boolean;
@@ -30,15 +30,15 @@ declare const _default: <E extends RootEntity>(__VLS_props: NonNullable<Awaited<
30
30
  default: null;
31
31
  }, undefined>;
32
32
  readonly readonly: boolean;
33
- readonly list?: IEnum<number>[] | undefined;
34
33
  readonly disabledValue?: string | number | boolean | unknown[] | Record<string, any> | undefined;
34
+ readonly list?: IEnum<number>[] | undefined;
35
35
  readonly tree?: (ITree & E)[] | undefined;
36
36
  readonly onClear?: (() => any) | undefined;
37
37
  readonly onBlur?: (() => any) | undefined;
38
38
  readonly onChange?: ((value: E) => any) | undefined;
39
39
  readonly "onUpdate:modelValue"?: ((value: E) => any) | undefined;
40
40
  readonly onFocus?: (() => any) | undefined;
41
- } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, "disabled" | "list" | "entity" | "modelValue" | "readonly" | "disabledValue" | "tree">, "onFocus" | "onBlur" | "onChange" | "field" | "onClear" | "onUpdate:modelValue" | ("disabled" | "list" | "entity" | "modelValue" | "readonly" | "disabledValue" | "tree")> & {} & Partial<{}>> & import('vue').PublicProps;
41
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, "disabled" | "entity" | "modelValue" | "readonly" | "disabledValue" | "list" | "tree">, "onFocus" | "onBlur" | "onChange" | "field" | "onClear" | "onUpdate:modelValue" | ("disabled" | "entity" | "modelValue" | "readonly" | "disabledValue" | "list" | "tree")> & {} & Partial<{}>> & import('vue').PublicProps;
42
42
  expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
43
43
  attrs: any;
44
44
  slots: {
@@ -6,12 +6,12 @@ declare const _default: <F extends IFile & RootEntity>(__VLS_props: NonNullable<
6
6
  width: number;
7
7
  placeholder: string;
8
8
  data: IJson<any>;
9
- headers: IJson<any>;
10
9
  clearable: boolean;
11
10
  height: number;
12
11
  entity: ITransformerConstructor<F>;
13
12
  src: string;
14
13
  upload: boolean;
14
+ headers: IJson<any>;
15
15
  showTips: boolean;
16
16
  limit: number;
17
17
  extensions: unknown[];
@@ -20,10 +20,10 @@ declare const _default: <F extends IFile & RootEntity>(__VLS_props: NonNullable<
20
20
  }> & Omit<{
21
21
  readonly width: number;
22
22
  readonly data: IJson<any>;
23
- readonly headers: IJson<any>;
24
23
  readonly clearable: boolean;
25
24
  readonly height: number;
26
25
  readonly upload: boolean;
26
+ readonly headers: IJson<any>;
27
27
  readonly showTips: boolean;
28
28
  readonly limit: number;
29
29
  readonly extensions: unknown[];
@@ -34,7 +34,7 @@ declare const _default: <F extends IFile & RootEntity>(__VLS_props: NonNullable<
34
34
  readonly src?: string | undefined;
35
35
  readonly onUpload?: ((file: F) => any) | undefined;
36
36
  readonly onRemove?: (() => any) | undefined;
37
- } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, "width" | "placeholder" | "data" | "headers" | "clearable" | "height" | "entity" | "src" | "upload" | "showTips" | "limit" | "extensions" | "uploadUrl" | "uploadFileName">, "onUpload" | "onRemove" | ("width" | "placeholder" | "data" | "headers" | "clearable" | "height" | "entity" | "src" | "upload" | "showTips" | "limit" | "extensions" | "uploadUrl" | "uploadFileName")> & {} & Partial<{}>> & import('vue').PublicProps;
37
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, "width" | "placeholder" | "data" | "clearable" | "height" | "entity" | "src" | "upload" | "headers" | "showTips" | "limit" | "extensions" | "uploadUrl" | "uploadFileName">, "onUpload" | "onRemove" | ("width" | "placeholder" | "data" | "clearable" | "height" | "entity" | "src" | "upload" | "headers" | "showTips" | "limit" | "extensions" | "uploadUrl" | "uploadFileName")> & {} & Partial<{}>> & import('vue').PublicProps;
38
38
  expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
39
39
  attrs: any;
40
40
  slots: {};
@@ -6,12 +6,12 @@ declare const _default: <E extends RootEntity, T extends ITree & E, EM extends I
6
6
  props: __VLS_PrettifyLocal<Pick<Partial<{
7
7
  disabled: boolean;
8
8
  placeholder: string;
9
- list: EM[];
10
9
  dateShowFormatter: string;
11
10
  entity: ITransformerConstructor<E>;
12
11
  modelValue: string | number | boolean | unknown[] | Record<string, any>;
13
12
  readonly: boolean;
14
13
  disabledValue: string | number | boolean | unknown[] | Record<string, any>;
14
+ list: EM[];
15
15
  tree: T[];
16
16
  modelModifiers: Record<string, any>;
17
17
  modifier: string;
@@ -24,11 +24,11 @@ declare const _default: <E extends RootEntity, T extends ITree & E, EM extends I
24
24
  readonly modelModifiers: Record<string, any>;
25
25
  readonly showClear: boolean;
26
26
  readonly onSearch: Function;
27
- readonly list?: EM[] | undefined;
28
27
  readonly dateShowFormatter?: string | undefined;
29
28
  readonly entity?: ITransformerConstructor<E> | undefined;
30
29
  readonly modelValue?: string | number | boolean | unknown[] | Record<string, any> | undefined;
31
30
  readonly disabledValue?: string | number | boolean | unknown[] | Record<string, any> | undefined;
31
+ readonly list?: EM[] | undefined;
32
32
  readonly tree?: T[] | undefined;
33
33
  readonly modifier?: string | undefined;
34
34
  readonly onClear?: ((...args: any[]) => any) | undefined;
@@ -36,7 +36,7 @@ declare const _default: <E extends RootEntity, T extends ITree & E, EM extends I
36
36
  readonly onChange?: ((...args: any[]) => any) | undefined;
37
37
  readonly "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
38
38
  readonly onFocus?: ((...args: any[]) => any) | undefined;
39
- } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, "disabled" | "placeholder" | "list" | "dateShowFormatter" | "entity" | "modelValue" | "readonly" | "disabledValue" | "tree" | "modelModifiers" | "modifier" | "showClear" | "onSearch">, "onFocus" | "onBlur" | "onChange" | "onClear" | "onUpdate:modelValue" | ("disabled" | "placeholder" | "list" | "dateShowFormatter" | "entity" | "modelValue" | "readonly" | "disabledValue" | "tree" | "modelModifiers" | "modifier" | "showClear" | "onSearch")> & {} & Partial<{}>> & import('vue').PublicProps;
39
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, "disabled" | "placeholder" | "dateShowFormatter" | "entity" | "modelValue" | "readonly" | "disabledValue" | "list" | "tree" | "modelModifiers" | "modifier" | "showClear" | "onSearch">, "onFocus" | "onBlur" | "onChange" | "onClear" | "onUpdate:modelValue" | ("disabled" | "placeholder" | "dateShowFormatter" | "entity" | "modelValue" | "readonly" | "disabledValue" | "list" | "tree" | "modelModifiers" | "modifier" | "showClear" | "onSearch")> & {} & Partial<{}>> & import('vue').PublicProps;
40
40
  expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
41
41
  attrs: any;
42
42
  slots: Partial<Record<NonNullable<string | number | symbol>, (_: {}) => any>>;
package/dist/main.js CHANGED
@@ -18606,12 +18606,12 @@ class WebValidator {
18606
18606
  }
18607
18607
  /**
18608
18608
  * ### 创建验证器
18609
- * @param service 接口服务对象
18609
+ * @param entityClass 接口服务对象
18610
18610
  * @param rules `可选` 表单验证规则
18611
18611
  */
18612
- static createRules(service, rules = {}) {
18612
+ static createRules(entityClass, rules = {}) {
18613
18613
  const formRules = rules;
18614
- const formFieldList = getFormConfigList(service.entityClass);
18614
+ const formFieldList = getFormConfigList(entityClass);
18615
18615
  for (let i = 0; i < formFieldList.length; i += 1) {
18616
18616
  const config = formFieldList[i];
18617
18617
  const fieldKey = config.key;
@@ -19087,7 +19087,7 @@ class WebValidator {
19087
19087
  function useEditor(props, ServiceClass, option = {}) {
19088
19088
  const result = useDetail(props, ServiceClass, option);
19089
19089
  const title = computed(() => result.formData.value.id ? WebI18n.get().Update : WebI18n.get().Add);
19090
- const rules = WebValidator.createRules(new ServiceClass(), option.customRules || {});
19090
+ const rules = WebValidator.createRules(new ServiceClass().entityClass, option.customRules || {});
19091
19091
  const formRef = ref();
19092
19092
  async function onSubmit() {
19093
19093
  let postData = result.formData.value.copy();
@@ -19455,7 +19455,7 @@ class AbstractCurdService extends AbstractService {
19455
19455
  * @param moreRule `可选` 更多的验证规则
19456
19456
  */
19457
19457
  static createValidator(moreRule = {}) {
19458
- return WebValidator.createRules(new this(), moreRule);
19458
+ return WebValidator.createRules(new this().entityClass, moreRule);
19459
19459
  }
19460
19460
  /**
19461
19461
  * ### 查询分页数据列表
@@ -1,5 +1,5 @@
1
+ import { ITransformerConstructor } from '@airpower/transformer';
1
2
  import { RootEntity } from '../model/RootEntity';
2
- import { AbstractCurdService } from '../service/AbstractCurdService';
3
3
  import { WebValidateRule, WebValidatorCallback, WebValidatorTarget, WebValidatorTrigger, WebValidatorType } from './type';
4
4
  /**
5
5
  * ### 表单验证
@@ -43,10 +43,10 @@ export declare class WebValidator {
43
43
  static create<E extends RootEntity = RootEntity>(rule: WebValidateRule<E>): WebValidateRule<E>;
44
44
  /**
45
45
  * ### 创建验证器
46
- * @param service 接口服务对象
46
+ * @param entityClass 接口服务对象
47
47
  * @param rules `可选` 表单验证规则
48
48
  */
49
- static createRules<E extends RootEntity, S extends AbstractCurdService<E>>(service: S, rules?: WebValidateRule<E>): WebValidateRule<E>;
49
+ static createRules<E extends RootEntity>(entityClass: ITransformerConstructor<E>, rules?: WebValidateRule<E>): WebValidateRule<E>;
50
50
  /**
51
51
  * ### 获取一个验证器
52
52
  * @param configValue 验证器配置的值
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@airpower/web",
3
3
  "type": "module",
4
- "version": "1.9.5",
4
+ "version": "1.9.6",
5
5
  "description": "AirPower-Web",
6
6
  "author": {
7
7
  "name": "Hamm",