@koumoul/vjsf 3.0.0-beta.11 → 3.0.0-beta.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koumoul/vjsf",
3
- "version": "3.0.0-beta.11",
3
+ "version": "3.0.0-beta.12",
4
4
  "description": "Generate forms for the vuetify UI library (vuejs) based on annotated JSON schemas.",
5
5
  "scripts": {
6
6
  "test": "vitest",
@@ -75,7 +75,7 @@
75
75
  "vuetify": "^3.4.9"
76
76
  },
77
77
  "dependencies": {
78
- "@json-layout/core": "0.15.1",
78
+ "@json-layout/core": "0.16.0",
79
79
  "@vueuse/core": "^10.5.0",
80
80
  "debug": "^4.3.4",
81
81
  "ejs": "^3.1.9"
package/src/compat/v2.js CHANGED
@@ -72,21 +72,27 @@ const processFragment = (/** @type {import("ajv").SchemaObject} */schema) => {
72
72
  }
73
73
  }
74
74
 
75
- if (schema.type === 'object') {
76
- if (schema.properties) {
77
- for (const propertyKey of Object.keys(schema.properties)) {
78
- processFragment(schema.properties[propertyKey])
79
- }
80
- }
81
- if (schema.allOf) {
82
- for (const item of schema.allOf) processFragment(item)
83
- }
84
- if (schema.oneOf) {
85
- for (const item of schema.oneOf) processFragment(item)
75
+ if (schema.properties) {
76
+ for (const propertyKey of Object.keys(schema.properties)) {
77
+ processFragment(schema.properties[propertyKey])
86
78
  }
87
- if (schema.anyOf) {
88
- for (const item of schema.anyOf) processFragment(item)
79
+ }
80
+
81
+ if (schema.allOf) {
82
+ for (const item of schema.allOf) processFragment(item)
83
+ }
84
+
85
+ if (schema.oneOf) {
86
+ if (!schema.oneOfLayout) {
87
+ const constProperty = Object.values(schema.oneOf[0]?.properties || {})
88
+ .find(prop => !!prop.const)
89
+ if (constProperty?.title) schema.oneOfLayout = { label: constProperty.title }
89
90
  }
91
+ for (const item of schema.oneOf) processFragment(item)
92
+ }
93
+
94
+ if (schema.anyOf) {
95
+ for (const item of schema.anyOf) processFragment(item)
90
96
  }
91
97
 
92
98
  if (schema.type === 'array' && schema.items) {
@@ -42,7 +42,9 @@ const onChange = (/** @type import('@json-layout/core').SkeletonTree */childTree
42
42
  :items="modelValue.skeleton.childrenTrees"
43
43
  item-title="title"
44
44
  return-object
45
+ :label="modelValue.layout.label"
45
46
  :error-messages="modelValue.validated ? modelValue.error : null"
47
+ :density="modelValue.options.density"
46
48
  @update:model-value="onChange"
47
49
  />
48
50
  <v-row v-if="modelValue.children?.[0]">
@@ -1 +1 @@
1
- {"version":3,"file":"v2.d.ts","sourceRoot":"","sources":["../../src/compat/v2.js"],"names":[],"mappings":"AAoGA;;;;;;GAMG;AACH,kCALW,MAAM,+CAEN,MAAM,0BAkBhB;sBA1HqB,KAAK"}
1
+ {"version":3,"file":"v2.d.ts","sourceRoot":"","sources":["../../src/compat/v2.js"],"names":[],"mappings":"AA0GA;;;;;;GAMG;AACH,kCALW,MAAM,+CAEN,MAAM,0BAkBhB;sBAhIqB,KAAK"}
@@ -1,10 +1,10 @@
1
1
  declare const _default: import("vue").DefineComponent<{}, {
2
2
  multiple: boolean;
3
- item: import("../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem;
3
+ item: import("../../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem;
4
4
  itemProps: Record<string, any>;
5
5
  $props: {
6
6
  readonly multiple?: boolean | undefined;
7
- readonly item?: import("../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem | undefined;
7
+ readonly item?: import("../../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem | undefined;
8
8
  readonly itemProps?: Record<string, any> | undefined;
9
9
  };
10
10
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
@@ -1,10 +1,10 @@
1
1
  declare const _default: import("vue").DefineComponent<{}, {
2
2
  multiple: boolean;
3
- item: import("../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem;
3
+ item: import("../../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem;
4
4
  last: boolean;
5
5
  $props: {
6
6
  readonly multiple?: boolean | undefined;
7
- readonly item?: import("../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem | undefined;
7
+ readonly item?: import("../../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem | undefined;
8
8
  readonly last?: boolean | undefined;
9
9
  };
10
10
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
@@ -1,8 +1,8 @@
1
1
  declare const _default: import("vue").DefineComponent<{}, {
2
- modelValue: import("../../node_modules/@json-layout/core/types/state/types.js").StateTree;
2
+ modelValue: import("../../../node_modules/@json-layout/core/types/state/types.js").StateTree;
3
3
  statefulLayout: import("../types.js").VjsfStatefulLayout;
4
4
  $props: {
5
- readonly modelValue?: import("../../node_modules/@json-layout/core/types/state/types.js").StateTree | undefined;
5
+ readonly modelValue?: import("../../../node_modules/@json-layout/core/types/state/types.js").StateTree | undefined;
6
6
  readonly statefulLayout?: import("../types.js").VjsfStatefulLayout | undefined;
7
7
  };
8
8
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
@@ -1,14 +1,14 @@
1
1
  declare const _default: import("vue").DefineComponent<{}, {
2
2
  $emit: ((event: "update:modelValue", data: any) => void) & ((event: "update:state", state: import("../types.js").VjsfStatefulLayout) => void);
3
- schema: Record<string, any>;
4
- precompiledLayout: import("../../node_modules/@json-layout/core/types/compile/types.js").CompiledLayout;
5
3
  modelValue: any;
6
4
  options: Partial<Omit<import("../types.js").VjsfOptions, "width" | "vjsfSlots">> | null;
5
+ schema: Record<string, any>;
6
+ precompiledLayout: import("../../../node_modules/@json-layout/core/types/compile/types.js").CompiledLayout;
7
7
  $props: {
8
- readonly schema?: Record<string, any> | undefined;
9
- readonly precompiledLayout?: import("../../node_modules/@json-layout/core/types/compile/types.js").CompiledLayout | undefined;
10
8
  readonly modelValue?: any;
11
9
  readonly options?: Partial<Omit<import("../types.js").VjsfOptions, "width" | "vjsfSlots">> | null | undefined;
10
+ readonly schema?: Record<string, any> | undefined;
11
+ readonly precompiledLayout?: import("../../../node_modules/@json-layout/core/types/compile/types.js").CompiledLayout | undefined;
12
12
  };
13
13
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
14
14
  export default _default;
@@ -8,9 +8,9 @@ export const emits: {
8
8
  */
9
9
  'update:state': (state: import('../types.js').VjsfStatefulLayout) => boolean;
10
10
  };
11
- export function useVjsf(schema: import('vue').Ref<Object>, modelValue: import('vue').Ref<any>, options: import('vue').Ref<import("../types.js").PartialVjsfOptions | null>, nodeComponents: Record<string, import('vue').Component>, emit: any, compile?: typeof import("@json-layout/core").compile | undefined, precompiledLayout?: import("vue").Ref<import("../../node_modules/@json-layout/core/types/compile/types.js").CompiledLayout> | undefined): {
11
+ export function useVjsf(schema: import('vue').Ref<Object>, modelValue: import('vue').Ref<any>, options: import('vue').Ref<import("../types.js").PartialVjsfOptions | null>, nodeComponents: Record<string, import('vue').Component>, emit: any, compile?: typeof import("@json-layout/core").compile | undefined, precompiledLayout?: import("vue").Ref<import("../../../node_modules/@json-layout/core/types/compile/types.js").CompiledLayout> | undefined): {
12
12
  el: import("vue").Ref<null>;
13
13
  statefulLayout: import("vue").ShallowRef<import("../types.js").VjsfStatefulLayout | null>;
14
- stateTree: import("vue").ShallowRef<import("../../node_modules/@json-layout/core/types/state/types.js").StateTree | null>;
14
+ stateTree: import("vue").ShallowRef<import("../../../node_modules/@json-layout/core/types/state/types.js").StateTree | null>;
15
15
  };
16
16
  //# sourceMappingURL=use-vjsf.d.ts.map