@koumoul/vjsf 3.15.3 → 3.15.5
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 +1 -1
- package/src/compat/v2.js +14 -1
- package/types/compat/v2.d.ts.map +1 -1
package/package.json
CHANGED
package/src/compat/v2.js
CHANGED
|
@@ -138,7 +138,7 @@ const processFragment = (schema, getJSONRef, schemaId, processed) => {
|
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
if (schema['x-fromUrl']) {
|
|
141
|
-
|
|
141
|
+
layout.comp = layout.comp ?? 'select'
|
|
142
142
|
const url = schema['x-fromUrl']
|
|
143
143
|
layout.getItems = { url: fixExpression(url, 'js-tpl') }
|
|
144
144
|
delete schema['x-fromUrl']
|
|
@@ -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 && !layout.getItems) {
|
|
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
|
package/types/compat/v2.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v2.d.ts","sourceRoot":"","sources":["../../src/compat/v2.js"],"names":[],"mappings":"
|
|
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"}
|