@koumoul/vjsf 3.15.3 → 3.15.4

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.15.3",
3
+ "version": "3.15.4",
4
4
  "description": "Generate forms for the vuetify UI library (vuejs) based on annotated JSON schemas.",
5
5
  "scripts": {
6
6
  "test": "vitest run",
package/src/compat/v2.js CHANGED
@@ -163,6 +163,19 @@ const processFragment = (schema, getJSONRef, schemaId, processed) => {
163
163
  layout.if = '!summary'
164
164
  }
165
165
 
166
+ if (schema.type === 'array' && schema.items) {
167
+ if (!Array.isArray(schema.items)) {
168
+ layout.comp = 'list'
169
+ if (schema['x-itemTitle']) layout.itemTitle = `data["${schema['x-itemTitle']}"]`
170
+ else {
171
+ // vjsf 2 implicitly used a title property as an item title in lists
172
+ if (schema.items.properties?.title || schema.items.allOf?.some((/** @type {any} */ ao) => ao.properties?.title)) {
173
+ layout.itemTitle = 'data.title'
174
+ }
175
+ }
176
+ }
177
+ }
178
+
166
179
  // compact the layout keyword if possible
167
180
  if (Object.keys(layout).length === 1 && 'comp' in layout) {
168
181
  schema.layout = layout.comp
@@ -1 +1 @@
1
- {"version":3,"file":"v2.d.ts","sourceRoot":"","sources":["../../src/compat/v2.js"],"names":[],"mappings":"AA4NA;;;;;;GAMG;AACH,kCALW,MAAM,2CAEN,MAAM,0BAoBhB;sBApPqB,KAAK"}
1
+ {"version":3,"file":"v2.d.ts","sourceRoot":"","sources":["../../src/compat/v2.js"],"names":[],"mappings":"AAyOA;;;;;;GAMG;AACH,kCALW,MAAM,2CAEN,MAAM,0BAoBhB;sBAjQqB,KAAK"}