@json-layout/vocabulary 0.6.0 → 0.8.0

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": "@json-layout/vocabulary",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "description": "Main JSON Layout vocabulary as JSON schemas and Typescript types. Also contains some small utility functions to validate and normalize annotations.",
5
5
  "type": "module",
6
6
  "exports": {
package/src/normalize.js CHANGED
@@ -294,9 +294,13 @@ function getCompObject (layoutKeyword, schemaFragment, schemaPath, markdown, arr
294
294
 
295
295
  if (partial.if) partial.if = normalizeExpression(partial.if)
296
296
 
297
- if (partial.defaultData) partial.defaultData = normalizeExpression(partial.defaultData)
298
- if (partial.constData) partial.constData = normalizeExpression(partial.constData)
299
- if (partial.transformData) partial.transformData = normalizeExpression(partial.transformData)
297
+ if (!partial.defaultData && schemaFragment.type === 'string' && schemaPath.split('#').pop() === '') {
298
+ partial.defaultData = '""'
299
+ }
300
+
301
+ if (partial.defaultData !== undefined) partial.defaultData = normalizeExpression(partial.defaultData)
302
+ if (partial.constData !== undefined) partial.constData = normalizeExpression(partial.constData)
303
+ if (partial.transformData !== undefined) partial.transformData = normalizeExpression(partial.transformData)
300
304
 
301
305
  if (partial.getItems && isPartialGetItemsExpr(partial.getItems)) partial.getItems = normalizeExpression(partial.getItems)
302
306
  if (partial.getItems && isPartialGetItemsObj(partial.getItems)) {
@@ -33,6 +33,7 @@ import schema from './schema.js'
33
33
  * @typedef {import('./types.js').Stepper} Stepper
34
34
  * @typedef {import('./types.js').List} List
35
35
  * @typedef {import('./types.js').Combobox} Combobox
36
+ * @typedef {import('./types.js').Markdown} Markdown
36
37
  * @typedef {import('./types.js').FileInput} FileInput
37
38
  * @typedef {import('./types.js').Cols} Cols
38
39
  * @typedef {import('./types.js').ColsObj} ColsObj
@@ -884,11 +884,15 @@ export default {
884
884
  "one-of-select": {
885
885
  "type": "object",
886
886
  "required": [
887
- "comp"
887
+ "comp",
888
+ "label"
888
889
  ],
889
890
  "properties": {
890
891
  "comp": {
891
892
  "const": "one-of-select"
893
+ },
894
+ "label": {
895
+ "type": "string"
892
896
  }
893
897
  }
894
898
  },
@@ -402,9 +402,10 @@
402
402
  },
403
403
  "one-of-select": {
404
404
  "type": "object",
405
- "required": ["comp"],
405
+ "required": ["comp", "label"],
406
406
  "properties": {
407
- "comp": {"const": "one-of-select"}
407
+ "comp": {"const": "one-of-select"},
408
+ "label": {"type": "string"}
408
409
  }
409
410
  },
410
411
  "expression": {
@@ -269,6 +269,7 @@ export interface Autocomplete {
269
269
  }
270
270
  export interface OneOfSelect {
271
271
  comp: "one-of-select";
272
+ label: string;
272
273
  [k: string]: unknown;
273
274
  }
274
275
  export interface Section {