@json-layout/core 1.6.0 → 1.7.1
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/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.1",
|
|
4
4
|
"description": "Compilation and state management utilities for JSON Layout.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
},
|
|
59
59
|
"homepage": "https://github.com/json-layout/json-layout#readme",
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"@json-layout/vocabulary": "^2.
|
|
61
|
+
"@json-layout/vocabulary": "^2.1.0"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"ajv": "^8.17.1",
|
package/src/compile/options.js
CHANGED
|
@@ -68,6 +68,7 @@ export const fillOptions = (partialOptions) => {
|
|
|
68
68
|
useName: false,
|
|
69
69
|
useExamples: 'items',
|
|
70
70
|
useDeprecated: false,
|
|
71
|
+
useTitle: 'label',
|
|
71
72
|
...partialOptions,
|
|
72
73
|
locale,
|
|
73
74
|
defaultLocale,
|
|
@@ -80,7 +81,7 @@ export const fillOptions = (partialOptions) => {
|
|
|
80
81
|
// use Immer for efficient updating with immutability and no-op detection
|
|
81
82
|
/** @type {(draft: PartialCompileOptions, newOptions: PartialCompileOptions) => PartialCompileOptions} */
|
|
82
83
|
export const produceCompileOptions = produce((draft, newOptions) => {
|
|
83
|
-
for (const key of ['ajv', 'ajvOptions', 'code', 'markdown', 'markedOptions', 'xI18n', 'locale', 'defaultLocale', 'messages', 'optionsKeys', 'components', 'useDescription', 'useDefault', 'useName', 'useExamples', 'useDeprecated']) {
|
|
84
|
+
for (const key of ['ajv', 'ajvOptions', 'code', 'markdown', 'markedOptions', 'xI18n', 'locale', 'defaultLocale', 'messages', 'optionsKeys', 'components', 'useDescription', 'useDefault', 'useName', 'useExamples', 'useDeprecated', 'useTitle']) {
|
|
84
85
|
// @ts-ignore
|
|
85
86
|
if (key in newOptions) {
|
|
86
87
|
// components is problematic because it is an object with nested objects
|
|
@@ -14,7 +14,9 @@ export const resolveXI18n = (schema, locale, defaultLocale = 'en') => {
|
|
|
14
14
|
delete schema[key]
|
|
15
15
|
} else if (Array.isArray(value)) {
|
|
16
16
|
for (const child of value) {
|
|
17
|
-
|
|
17
|
+
if (typeof child === 'object') {
|
|
18
|
+
resolveXI18n(child, locale, defaultLocale)
|
|
19
|
+
}
|
|
18
20
|
}
|
|
19
21
|
} if (typeof value === 'object') {
|
|
20
22
|
resolveXI18n(value, locale, defaultLocale)
|
package/src/utils/doc-options.js
CHANGED
|
@@ -62,6 +62,16 @@ export const compileOptions = [
|
|
|
62
62
|
hint: 'As a hint message below the form inputs.'
|
|
63
63
|
}
|
|
64
64
|
},
|
|
65
|
+
{
|
|
66
|
+
key: 'useTitle',
|
|
67
|
+
description: 'Define how to use the "title" metadata from the schema.',
|
|
68
|
+
default: 'label',
|
|
69
|
+
values: {
|
|
70
|
+
false: 'Do not use the title.',
|
|
71
|
+
true: 'As a label for the form inputs (alias "label").',
|
|
72
|
+
hint: 'As a hint message below the form inputs.'
|
|
73
|
+
}
|
|
74
|
+
},
|
|
65
75
|
{
|
|
66
76
|
key: 'useName',
|
|
67
77
|
description: 'Use the "name" metadata from the schema (the key of the property in its parent object).',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/compile/options.js"],"names":[],"mappings":"AAqBO,4CAHI,qBAAqB,GACnB,cAAc,
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/compile/options.js"],"names":[],"mappings":"AAqBO,4CAHI,qBAAqB,GACnB,cAAc,CA2D1B;AAGD,yGAAyG;AACzG,oCADW,CAAC,KAAK,EAAE,qBAAqB,EAAE,UAAU,EAAE,qBAAqB,KAAK,qBAAqB,CAiBnG;6BAxFW,OAAO,YAAY,EAAE,cAAc;oCACnC,OAAO,YAAY,EAAE,qBAAqB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"x-i18n.d.ts","sourceRoot":"","sources":["../../../src/compile/utils/x-i18n.js"],"names":[],"mappings":"AAOO,qCAJI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,UACnB,MAAM,kBACN,MAAM,
|
|
1
|
+
{"version":3,"file":"x-i18n.d.ts","sourceRoot":"","sources":["../../../src/compile/utils/x-i18n.js"],"names":[],"mappings":"AAOO,qCAJI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,UACnB,MAAM,kBACN,MAAM,QAmBhB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doc-options.d.ts","sourceRoot":"","sources":["../../src/utils/doc-options.js"],"names":[],"mappings":"AAEA;;GAEG;AAEH,yBAAyB;AACzB,6BADW,UAAU,
|
|
1
|
+
{"version":3,"file":"doc-options.d.ts","sourceRoot":"","sources":["../../src/utils/doc-options.js"],"names":[],"mappings":"AAEA;;GAEG;AAEH,yBAAyB;AACzB,6BADW,UAAU,CAiGpB;AAED,yBAAyB;AACzB,6BADW,UAAU,CAmHpB;yBAzNY;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,GAAG,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAAC,EAAE"}
|