@json-layout/core
Advanced tools
Comparing version 1.1.0 to 1.2.0
{ | ||
"name": "@json-layout/core", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Compilation and state management utilities for JSON Layout.", | ||
@@ -62,3 +62,3 @@ "type": "module", | ||
"dependencies": { | ||
"@json-layout/vocabulary": "~1.1.0", | ||
"@json-layout/vocabulary": "~1.2.0", | ||
"ajv": "^8.12.0", | ||
@@ -65,0 +65,0 @@ "ajv-errors": "^3.0.0", |
@@ -64,2 +64,3 @@ import ajvModule from 'ajv/dist/2019.js' | ||
optionsKeys: [], | ||
useDescription: ['help', 'subtitle'], | ||
...partialOptions, | ||
@@ -66,0 +67,0 @@ locale, |
@@ -67,2 +67,3 @@ // import Debug from 'debug' | ||
options.markdown, | ||
options.useDescription, | ||
options.optionsKeys, | ||
@@ -270,2 +271,3 @@ undefined, | ||
options.markdown, | ||
options.useDescription, | ||
options.optionsKeys, | ||
@@ -331,2 +333,3 @@ 'oneOf', | ||
options.markdown, | ||
options.useDescription, | ||
options.optionsKeys, | ||
@@ -333,0 +336,0 @@ 'patternProperties', |
@@ -39,2 +39,3 @@ import type ajvModule from 'ajv/dist/2019.js' | ||
xI18n: boolean | ||
useDescription: Array<'help' | 'hint' | 'subtitle'> | ||
} | ||
@@ -41,0 +42,0 @@ |
@@ -54,2 +54,3 @@ // eslint-disable-next-line import/no-named-default | ||
const logDataBinding = debug('jl:data-binding') | ||
const logSelectItems = debug('jl:select-items') | ||
@@ -537,4 +538,6 @@ export class StatefulLayout { | ||
rawItems = node.itemsCacheKey | ||
logSelectItems(`${node.fullKey} - raw items from context or schema or getItems expression`, rawItems) | ||
} | ||
if (node.layout.getItems && isGetItemsFetch(node.layout.getItems)) { | ||
logSelectItems(`${node.fullKey} - will fetch raw items from URL`, node.itemsCacheKey) | ||
const url = new URL(node.itemsCacheKey) | ||
@@ -548,2 +551,3 @@ let qSearchParam = node.layout.getItems.qSearchParam | ||
if (qSearchParam) { | ||
logSelectItems(`${node.fullKey} - apply search params`, qSearchParam) | ||
appliedQ = true | ||
@@ -555,2 +559,3 @@ if (q) url.searchParams.set(qSearchParam, q) | ||
rawItems = await (await fetch(url, fetchOptions)).json() | ||
logSelectItems(`${node.fullKey} - raw items URL`, rawItems) | ||
} | ||
@@ -563,2 +568,3 @@ | ||
rawItems = this.evalNodeExpression(node, node.layout.getItems.itemsResults, rawItems) | ||
logSelectItems(`${node.fullKey} - items passed through the getItems.itemsResults expression`, rawItems) | ||
} | ||
@@ -625,2 +631,4 @@ | ||
if (layout.getItems?.itemIcon) item.icon = this.evalNodeExpression(node, layout.getItems?.itemIcon, rawItem) | ||
logSelectItems(`${node.fullKey} - select item after applying itemValue/itemKey/itemTitle/itemIcon expressions`, item) | ||
return /** @type {import('@json-layout/vocabulary').SelectItem} */(item) | ||
@@ -627,0 +635,0 @@ } |
@@ -9,2 +9,3 @@ import { isSwitchStruct, childIsCompObject, isCompositeLayout, isFocusableLayout, isItemsLayout, isGetItemsExpression, isGetItemsFetch, isListLayout } from '@json-layout/vocabulary' | ||
const logStateNode = debug('jl:state-node') | ||
const logValidation = debug('jl:validation') | ||
@@ -555,2 +556,3 @@ /** | ||
if (error) { | ||
logValidation(`${fullKey} capture validation error on node`, error) | ||
context.errors = context.errors?.filter(error => { | ||
@@ -557,0 +559,0 @@ return !matchError(error, skeleton, dataPath, parentDataPath) && !matchChildError(error, skeleton, dataPath, parentDataPath) |
import { produce } from 'immer' | ||
import { createStateNode } from './state-node.js' | ||
import debug from 'debug' | ||
const logValidation = debug('jl:validation') | ||
/** @type {(draft: import('./types.js').StateTree, root: import('./types.js').StateNode, valid: boolean) => any} */ | ||
@@ -51,2 +54,3 @@ const produceStateTree = produce( | ||
if (validate.errors) { | ||
logValidation(`${skeleton.root} validation errors`, validate.errors) | ||
for (const error of validate.errors) { | ||
@@ -53,0 +57,0 @@ if (error.keyword !== 'errorMessage') compiledLayout.localizeErrors([error]) |
@@ -38,2 +38,17 @@ import en from '../i18n/en.js' | ||
values: en | ||
}, | ||
{ | ||
key: 'xI18n', | ||
description: 'Activate x-i18n-* annotation system.', | ||
default: false | ||
}, | ||
{ | ||
key: 'useDescription', | ||
description: 'Define how to use the "description" metadata from the schema.', | ||
default: ['help', 'subtitle'], | ||
values: { | ||
help: 'As a help message shown in a tooltip.', | ||
hint: 'As a hint message blow simple form fields (not applicable to composite components).', | ||
subtitle: 'As a subtitle below the title of a composite component.' | ||
} | ||
} | ||
@@ -40,0 +55,0 @@ ] |
@@ -24,2 +24,3 @@ import type ajvModule from 'ajv/dist/2019.js'; | ||
xI18n: boolean; | ||
useDescription: Array<'help' | 'hint' | 'subtitle'>; | ||
} | ||
@@ -26,0 +27,0 @@ export type PartialCompileOptions = Partial<Omit<CompileOptions, 'messages'>> & { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
180165
4033
+ Added@json-layout/vocabulary@1.2.1(transitive)
- Removed@json-layout/vocabulary@1.1.0(transitive)