@koumoul/vjsf 3.0.0-beta.13 → 3.0.0-beta.15

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.13",
3
+ "version": "3.0.0-beta.15",
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.16.2",
78
+ "@json-layout/core": "0.16.3",
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
@@ -84,9 +84,15 @@ const processFragment = (/** @type {import("ajv").SchemaObject} */schema) => {
84
84
 
85
85
  if (schema.oneOf) {
86
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 }
87
+ const constPropertyKey = Object.keys(schema.oneOf[0]?.properties || {})
88
+ .find(key => !!schema.oneOf[0]?.properties[key].const)
89
+ if (constPropertyKey) {
90
+ const constProperty = schema.oneOf[0]?.properties[constPropertyKey]
91
+ if (constProperty?.title) schema.oneOfLayout = { label: constProperty.title }
92
+ if (schema.required && Array.isArray(schema.required)) {
93
+ schema.required = schema.required.filter(key => key !== constPropertyKey)
94
+ }
95
+ }
90
96
  }
91
97
  for (const item of schema.oneOf) processFragment(item)
92
98
  }
@@ -1 +1 @@
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
+ {"version":3,"file":"v2.d.ts","sourceRoot":"","sources":["../../src/compat/v2.js"],"names":[],"mappings":"AAgHA;;;;;;GAMG;AACH,kCALW,MAAM,+CAEN,MAAM,0BAkBhB;sBAtIqB,KAAK"}
@@ -1,13 +1,13 @@
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
- modelValue: any;
5
3
  options: Partial<Omit<import("../types.js").VjsfOptions, "width" | "vjsfSlots">> | null;
4
+ modelValue: any;
5
+ schema: Record<string, any>;
6
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 modelValue?: any;
10
8
  readonly options?: Partial<Omit<import("../types.js").VjsfOptions, "width" | "vjsfSlots">> | null | undefined;
9
+ readonly modelValue?: any;
10
+ readonly schema?: Record<string, any> | undefined;
11
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<{}>>, {}, {}>;