@json-layout/core
Advanced tools
Comparing version 1.3.0 to 1.4.0
{ | ||
"name": "@json-layout/core", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "Compilation and state management utilities for JSON Layout.", | ||
@@ -62,3 +62,3 @@ "type": "module", | ||
"dependencies": { | ||
"@json-layout/vocabulary": "~1.3.0", | ||
"@json-layout/vocabulary": "~1.4.0", | ||
"ajv": "^8.12.0", | ||
@@ -65,0 +65,0 @@ "ajv-errors": "^3.0.0", |
@@ -55,3 +55,6 @@ // eslint-disable-next-line import/no-named-default | ||
const logSelectItems = debug('jl:select-items') | ||
const logActivatedItems = debug('jl:activated-items') | ||
const pathURL = (/** @type {string} */url) => new URL(url.startsWith('/') ? window.location.origin + url : url) | ||
export class StatefulLayout { | ||
@@ -315,2 +318,3 @@ /** | ||
for (const activatedKey in createStateTreeContext.autoActivatedItems) { | ||
logActivatedItems('auto-activated item', activatedKey, createStateTreeContext.autoActivatedItems[activatedKey]) | ||
this.activatedItems = produce(this.activatedItems, draft => { draft[activatedKey] = createStateTreeContext.autoActivatedItems[activatedKey] }) | ||
@@ -410,2 +414,3 @@ } | ||
if (activateKey !== undefined) { | ||
logActivatedItems('activated item on input', node.fullKey, activateKey) | ||
this.activatedItems = produce(this.activatedItems, draft => { draft[node.fullKey] = activateKey }) | ||
@@ -549,3 +554,3 @@ this._autofocusTarget = node.fullKey + '/' + activateKey | ||
logSelectItems(`${node.fullKey} - will fetch raw items from URL`, node.itemsCacheKey) | ||
const url = new URL(node.itemsCacheKey) | ||
const url = pathURL(node.itemsCacheKey) | ||
let qSearchParam = node.layout.getItems.qSearchParam | ||
@@ -650,2 +655,3 @@ if (!qSearchParam) { | ||
activateItem (node, key) { | ||
logActivatedItems('activate item explicitly', node.fullKey, key) | ||
this.activatedItems = produce(this.activatedItems, draft => { draft[node.fullKey] = key }) | ||
@@ -660,2 +666,3 @@ this._autofocusTarget = node.fullKey + '/' + key | ||
const newParentData = { ...parentNode.data } | ||
logActivatedItems('remove properties of previous oneOf activated item', node.fullKey, node.children?.[0].fullKey) | ||
for (const propertyKey of node.children?.[0].skeleton.propertyKeys) { | ||
@@ -678,6 +685,10 @@ delete newParentData[propertyKey] | ||
deactivateItem (node) { | ||
logActivatedItems('deactivate item explicitly', node.fullKey) | ||
// also deactivate children oneOf for example | ||
this.activatedItems = produce(this.activatedItems, draft => { | ||
for (const key in draft) { | ||
if (key.startsWith(node.fullKey)) delete draft[key] | ||
if (key.startsWith(node.fullKey)) { | ||
logActivatedItems('item deactivation deletes a key', key) | ||
delete draft[key] | ||
} | ||
} | ||
@@ -684,0 +695,0 @@ }) |
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
181934
4069
+ Added@json-layout/vocabulary@1.4.1(transitive)
- Removed@json-layout/vocabulary@1.3.0(transitive)