@harbor-design/proform 1.1.9 → 1.1.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.
@@ -1,4 +1,4 @@
1
1
  export { default as ProForm } from "./src/form/index";
2
2
  export { useForm } from "./src/interactions/useForm";
3
- export { useFormRenderer } from "./src/interactions/useFormRenderer";
3
+ export { useFormPresetConfigurer } from "./src/interactions/useFormPresetConfigurer";
4
4
  export { useModifiers } from "./src/interactions/useModifiers";
@@ -0,0 +1,2 @@
1
+ import { FormPresets } from "../types";
2
+ export declare function useFormPresetConfigurer(presets: FormPresets): void;
@@ -0,0 +1,4 @@
1
+ import { FormPresets } from "../../types";
2
+ export default class Context {
3
+ static presets: FormPresets;
4
+ }
@@ -1,5 +1,5 @@
1
- import { AnyFunction } from "../types";
2
- import { TrackEffectMeta } from "../types/effectTypes";
1
+ import { AnyFunction } from "../../types";
2
+ import { TrackEffectMeta } from "../../types/effectTypes";
3
3
  export default class Effect {
4
4
  effects: Set<Function>;
5
5
  constructor();
@@ -1,5 +1,5 @@
1
- import { AnyObject, FormCustomization } from "../types";
2
- import { RuntimeCore } from "./index";
1
+ import { AnyObject, FormCustomization } from "../../types";
2
+ import { RuntimeCore } from "../index";
3
3
  export default class FormCustomizer {
4
4
  formCustomization: FormCustomization;
5
5
  runtimeCore: RuntimeCore;
@@ -0,0 +1,3 @@
1
+ import { AdaptedInterfacePreset } from "../../types";
2
+ declare const AdapterPreset: AdaptedInterfacePreset;
3
+ export default AdapterPreset;
@@ -1,5 +1,5 @@
1
- import { AnyObject, ItemSchema } from "../types";
2
- export default class Preset {
1
+ import { AnyObject, ItemSchema } from "../../types";
2
+ export default class RuntimePreset {
3
3
  static schemaPreset: Record<keyof ItemSchema, any> & {
4
4
  children: any;
5
5
  };
@@ -0,0 +1,14 @@
1
+ declare const _default: {
2
+ adapters: {
3
+ [x: string & {}]: import("../../types").AdaptedInterface;
4
+ ArcoVue: import("../../types").AdaptedInterface;
5
+ NutUI: import("../../types").AdaptedInterface;
6
+ NaiveUI: import("../../types").AdaptedInterface;
7
+ };
8
+ schemaPreset: Record<keyof import("../../types").ItemSchema, any> & {
9
+ children: any;
10
+ };
11
+ componentPropsPreset: import("../../types").AnyObject;
12
+ placeholderPresetByComponentName: {};
13
+ };
14
+ export default _default;
@@ -1,7 +1,7 @@
1
1
  import { Ref } from "vue";
2
- import { AnyObject, Schema, ProxyedSchema, AnyFunction, ObjectParserRoot } from "../types";
3
- import { RuntimeCore } from ".";
4
- import Effect from "./Effect";
2
+ import { AnyObject, Schema, ProxyedSchema, AnyFunction, ObjectParserRoot } from "../../types";
3
+ import { RuntimeCore } from "..";
4
+ import Effect from "../Effect";
5
5
  /**
6
6
  * 基本描述
7
7
  * 对于函数的命名,如果是动词相关,代表对过程的处理,如果是名词,代表一个处理器
@@ -0,0 +1,10 @@
1
+ import { AnyObject } from "../../types";
2
+ export default class RuntimeAdpter {
3
+ ui: string;
4
+ constructor(ui: string);
5
+ getRuntimeField(runtimeArgs: AnyObject): any;
6
+ getRuntimeRequired(runtimeArgs: AnyObject): any;
7
+ getFormModelPropName(): any;
8
+ formComponentRenderer(runtimeArgs: AnyObject): any;
9
+ clearValidate(runtimeArgs: AnyObject): any;
10
+ }
@@ -0,0 +1,9 @@
1
+ import { RuntimeOptions } from "../../types";
2
+ export default class RuntimeContainer {
3
+ static getFormContainer({ ui }?: RuntimeOptions): import("../../types").DomType;
4
+ static getFormItemContainer({ ui }?: RuntimeOptions): import("../../types").DomType;
5
+ static getItemContainer({ ui }?: RuntimeOptions): import("../../types").DomType;
6
+ static getGroupContainer({ ui }?: RuntimeOptions): import("../../types").DomType;
7
+ static getListContainer({ ui }?: RuntimeOptions): import("../../types").DomType;
8
+ static getListItemContainer({ ui }?: RuntimeOptions): import("../../types").DomType;
9
+ }
@@ -1,7 +1,8 @@
1
1
  import { Ref } from "vue";
2
- import { Setup, Schema, AnyObject, ItemSchema, GroupSchema, ListSchema, ProcessorBySchemaType, RuntimeSetters, NativeCustomizationOptions } from "../types";
3
- import Processor from "./Processor";
4
- import Effect from "./Effect";
2
+ import { Setup, Schema, AnyObject, ItemSchema, GroupSchema, ListSchema, ProcessorBySchemaType, runtime, NativeCustomizationOptions } from "../../types";
3
+ import Processor from "../Processor";
4
+ import Effect from "../Effect";
5
+ import RuntimeAdpter from "./RuntimeAdapter";
5
6
  export default class RuntimeCore {
6
7
  setup: Setup;
7
8
  processor: Processor;
@@ -11,12 +12,14 @@ export default class RuntimeCore {
11
12
  formRef: Ref<AnyObject>;
12
13
  hydrateEffect: Effect;
13
14
  native: NativeCustomizationOptions;
14
- gridProps: {};
15
- runtimeSetters: RuntimeSetters;
15
+ grid: {};
16
+ runtime: runtime;
16
17
  globalNativeFormOverride: {
17
18
  props: {};
18
19
  slots: {};
19
20
  };
21
+ ui: string;
22
+ runtimeAdapter: RuntimeAdpter;
20
23
  constructor(setup: Setup);
21
24
  getRuntimeMeta(): {
22
25
  model: AnyObject;
@@ -0,0 +1,9 @@
1
+ import { AnyFunction } from ".";
2
+ export interface AdaptedInterface {
3
+ getRuntimeField: AnyFunction;
4
+ getRuntimeRequired: AnyFunction;
5
+ getFormModelPropName: AnyFunction;
6
+ formComponentRenderer: AnyFunction;
7
+ validateForm: AnyFunction;
8
+ clearValidate: AnyFunction;
9
+ }
@@ -1,12 +1,22 @@
1
+ import { AdaptedInterface } from ".";
1
2
  import { AnyObject } from "./utilTypes";
2
3
  export type DomType = new (...args: any) => AnyObject & {
3
4
  $props: AnyObject;
4
5
  };
5
- export interface RuntimeDomCustomizer {
6
- Form: DomType;
7
- FormItem: DomType;
8
- Item: DomType;
9
- List: DomType;
10
- ListItem: DomType;
11
- Group: DomType;
6
+ export interface FormPreset {
7
+ container: {
8
+ Form: DomType;
9
+ FormItem: DomType;
10
+ Item: DomType;
11
+ List: DomType;
12
+ ListItem: DomType;
13
+ Group: DomType;
14
+ };
15
+ adapter?: AdaptedInterface;
12
16
  }
17
+ export type UIName = "ArcoVue" | "NutUI" | "NaiveUI" | (string & {});
18
+ export type AdaptedInterfacePreset = Record<UIName, AdaptedInterface>;
19
+ export type FormPresets = {
20
+ ui: UIName;
21
+ uiPresets: Partial<Record<UIName, FormPreset>>;
22
+ };
@@ -1,4 +1,4 @@
1
- import { AnyObject, DomType } from "./index";
1
+ import { AnyObject, DomType, UIName } from "./index";
2
2
  export type SchemaType = "item" | "list" | "group";
3
3
  export type FieldRule<T = any> = {
4
4
  type?: "string" | "number" | "boolean" | "array" | "object" | "email" | "url" | "ip";
@@ -59,8 +59,8 @@ export interface ItemSchema {
59
59
  required?: boolean;
60
60
  placeholder?: string;
61
61
  native?: NativeCustomizationOptions;
62
- gridProps?: GridStyle;
63
- label: string;
62
+ grid?: GridStyle;
63
+ label?: string;
64
64
  field: string;
65
65
  component: DomType;
66
66
  componentProps?: AnyObject;
@@ -70,15 +70,15 @@ export interface GroupSchema {
70
70
  type: "group";
71
71
  label: string;
72
72
  children: ProxyedSchema[];
73
- gridProps?: GridStyle;
73
+ grid?: GridStyle;
74
74
  }
75
75
  export interface ListSchema {
76
76
  type: "list";
77
77
  field: string;
78
78
  label: string;
79
79
  children: ProxyedSchema[];
80
- gridProps?: GridStyle;
81
- runtimeSetters?: RuntimeSetters;
80
+ grid?: GridStyle;
81
+ runtime?: runtime;
82
82
  }
83
83
  export type Schema = ItemSchema | GroupSchema | ListSchema;
84
84
  export interface runtimeMeta {
@@ -89,13 +89,14 @@ export type ProFormProxy<T> = {
89
89
  [K in keyof T]: ProFormProxyRule<T[K]>;
90
90
  };
91
91
  export type ProxyedSchema = ProFormProxy<ItemSchema | GroupSchema | ListSchema>;
92
- export interface RuntimeSetters {
93
- listItemLabelSetter?: (rawLabel: string, rawIndex: number) => any;
92
+ export interface runtime {
93
+ customizeItemLabel?: (rawLabel: string, rawIndex: number) => any;
94
94
  }
95
95
  export interface FormCustomization {
96
- gridProps?: GridStyle;
96
+ ui?: UIName;
97
+ grid?: GridStyle;
97
98
  native?: NativeCustomizationOptions;
98
- runtimeSetters?: RuntimeSetters;
99
+ runtime?: runtime;
99
100
  schemas: ProxyedSchema[];
100
101
  }
101
102
  export type NativeCustomizationOptions = {
@@ -4,3 +4,4 @@ export * from "./formCustomizerTypes";
4
4
  export * from "./utilTypes";
5
5
  export * from "./runtimeTypes";
6
6
  export * from "./processorTypes";
7
+ export * from "./adapter";
@@ -4,3 +4,6 @@ export interface ProcessorBySchemaType {
4
4
  group: (schema: GroupSchema) => any;
5
5
  list: (schema: ListSchema) => any;
6
6
  }
7
+ export interface RuntimeOptions {
8
+ ui?: string;
9
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harbor-design/proform",
3
- "version": "1.1.9",
3
+ "version": "1.1.12",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -1,4 +0,0 @@
1
- import { RuntimeDomCustomizer } from "../types";
2
- export declare function useFormRenderer(runtimeDomCustomizer: RuntimeDomCustomizer): {
3
- install(): void;
4
- };
@@ -1,4 +0,0 @@
1
- import { RuntimeDomCustomizer } from "../types";
2
- export default class Context {
3
- static runtimeDoms: RuntimeDomCustomizer;
4
- }