@json-layout/core 1.2.2 → 1.4.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 +2 -2
- package/src/compile/skeleton-node.js +2 -2
- package/src/state/index.js +20 -4
- package/src/state/state-node.js +27 -15
- package/src/state/state-tree.js +3 -0
- package/src/state/types.ts +4 -1
- package/types/state/index.d.ts.map +1 -1
- package/types/state/state-node.d.ts.map +1 -1
- package/types/state/state-tree.d.ts.map +1 -1
- package/types/state/types.d.ts +3 -1
- package/types/state/types.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@json-layout/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Compilation and state management utilities for JSON Layout.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
},
|
|
60
60
|
"homepage": "https://github.com/json-layout/json-layout#readme",
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@json-layout/vocabulary": "~1.
|
|
62
|
+
"@json-layout/vocabulary": "~1.4.0",
|
|
63
63
|
"ajv": "^8.12.0",
|
|
64
64
|
"ajv-errors": "^3.0.0",
|
|
65
65
|
"ajv-formats": "^2.1.1",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// import Debug from 'debug'
|
|
2
|
-
import { normalizeLayoutFragment, isSwitchStruct, isGetItemsExpression, isGetItemsFetch, isItemsLayout, getSchemaFragmentType, isCompositeLayout,
|
|
2
|
+
import { normalizeLayoutFragment, isSwitchStruct, isGetItemsExpression, isGetItemsFetch, isItemsLayout, getSchemaFragmentType, isCompositeLayout, childIsCompositeCompObject } from '@json-layout/vocabulary'
|
|
3
3
|
import { makeSkeletonTree } from './skeleton-tree.js'
|
|
4
4
|
import { partialResolveRefs } from './utils/resolve-refs.js'
|
|
5
5
|
|
|
@@ -98,7 +98,7 @@ export function makeSkeletonNode (
|
|
|
98
98
|
*/
|
|
99
99
|
const prepareLayoutChild = (child) => {
|
|
100
100
|
if (child.if) pushExpression(expressions, child.if)
|
|
101
|
-
if (
|
|
101
|
+
if (childIsCompositeCompObject(child)) {
|
|
102
102
|
for (const grandChild of child.children) prepareLayoutChild(grandChild)
|
|
103
103
|
}
|
|
104
104
|
}
|
package/src/state/index.js
CHANGED
|
@@ -52,6 +52,9 @@ export const isItemsNode = (node, components) => !!node && isItemsLayout(node.la
|
|
|
52
52
|
|
|
53
53
|
const logDataBinding = debug('jl:data-binding')
|
|
54
54
|
const logSelectItems = debug('jl:select-items')
|
|
55
|
+
const logActivatedItems = debug('jl:activated-items')
|
|
56
|
+
|
|
57
|
+
const pathURL = (/** @type {string} */url) => new URL(url.startsWith('/') ? window.location.origin + url : url)
|
|
55
58
|
|
|
56
59
|
export class StatefulLayout {
|
|
57
60
|
/**
|
|
@@ -230,7 +233,11 @@ export class StatefulLayout {
|
|
|
230
233
|
updateState () {
|
|
231
234
|
this.createStateTree()
|
|
232
235
|
let nbIter = 0
|
|
233
|
-
while (
|
|
236
|
+
while (
|
|
237
|
+
this._data !== (this._stateTree.root.data ?? null) ||
|
|
238
|
+
this._autofocusTarget !== this._lastCreateStateTreeContext.autofocusTarget ||
|
|
239
|
+
(nbIter === 0 && this._lastCreateStateTreeContext.errors?.length)
|
|
240
|
+
) {
|
|
234
241
|
nbIter += 1
|
|
235
242
|
if (nbIter > 100) {
|
|
236
243
|
console.error('too many iterations in updateState, the data is probably not stable', this._data, this._stateTree.root.data)
|
|
@@ -280,7 +287,8 @@ export class StatefulLayout {
|
|
|
280
287
|
cacheKeys: this._lastCreateStateTreeContext?.cacheKeys ?? {},
|
|
281
288
|
rootData: this._data,
|
|
282
289
|
files: [],
|
|
283
|
-
nodes: []
|
|
290
|
+
nodes: [],
|
|
291
|
+
rehydrateErrors: this._lastCreateStateTreeContext?.errors
|
|
284
292
|
}
|
|
285
293
|
|
|
286
294
|
// @ts-ignore
|
|
@@ -306,6 +314,7 @@ export class StatefulLayout {
|
|
|
306
314
|
}
|
|
307
315
|
this.files = shallowProduceArray(this.files, createStateTreeContext.files)
|
|
308
316
|
for (const activatedKey in createStateTreeContext.autoActivatedItems) {
|
|
317
|
+
logActivatedItems('auto-activated item', activatedKey, createStateTreeContext.autoActivatedItems[activatedKey])
|
|
309
318
|
this.activatedItems = produce(this.activatedItems, draft => { draft[activatedKey] = createStateTreeContext.autoActivatedItems[activatedKey] })
|
|
310
319
|
}
|
|
311
320
|
}
|
|
@@ -400,6 +409,7 @@ export class StatefulLayout {
|
|
|
400
409
|
}
|
|
401
410
|
|
|
402
411
|
if (activateKey !== undefined) {
|
|
412
|
+
logActivatedItems('activated item on input', node.fullKey, activateKey)
|
|
403
413
|
this.activatedItems = produce(this.activatedItems, draft => { draft[node.fullKey] = activateKey })
|
|
404
414
|
this._autofocusTarget = node.fullKey + '/' + activateKey
|
|
405
415
|
}
|
|
@@ -538,7 +548,7 @@ export class StatefulLayout {
|
|
|
538
548
|
}
|
|
539
549
|
if (node.layout.getItems && isGetItemsFetch(node.layout.getItems)) {
|
|
540
550
|
logSelectItems(`${node.fullKey} - will fetch raw items from URL`, node.itemsCacheKey)
|
|
541
|
-
const url =
|
|
551
|
+
const url = pathURL(node.itemsCacheKey)
|
|
542
552
|
let qSearchParam = node.layout.getItems.qSearchParam
|
|
543
553
|
if (!qSearchParam) {
|
|
544
554
|
for (const searchParam of url.searchParams.entries()) {
|
|
@@ -638,6 +648,7 @@ export class StatefulLayout {
|
|
|
638
648
|
* @param {number} key
|
|
639
649
|
*/
|
|
640
650
|
activateItem (node, key) {
|
|
651
|
+
logActivatedItems('activate item explicitly', node.fullKey, key)
|
|
641
652
|
this.activatedItems = produce(this.activatedItems, draft => { draft[node.fullKey] = key })
|
|
642
653
|
this._autofocusTarget = node.fullKey + '/' + key
|
|
643
654
|
if (node.key === '$oneOf') {
|
|
@@ -647,6 +658,7 @@ export class StatefulLayout {
|
|
|
647
658
|
if (!parentNode.data || typeof parentNode.data !== 'object') throw new Error(`parent with key "${node.parentFullKey}" is missing data object`)
|
|
648
659
|
/** @type Record<string, any> */
|
|
649
660
|
const newParentData = { ...parentNode.data }
|
|
661
|
+
logActivatedItems('remove properties of previous oneOf activated item', node.fullKey, node.children?.[0].fullKey)
|
|
650
662
|
for (const propertyKey of node.children?.[0].skeleton.propertyKeys) {
|
|
651
663
|
delete newParentData[propertyKey]
|
|
652
664
|
}
|
|
@@ -664,10 +676,14 @@ export class StatefulLayout {
|
|
|
664
676
|
* @param {StateNode} node
|
|
665
677
|
*/
|
|
666
678
|
deactivateItem (node) {
|
|
679
|
+
logActivatedItems('deactivate item explicitly', node.fullKey)
|
|
667
680
|
// also deactivate children oneOf for example
|
|
668
681
|
this.activatedItems = produce(this.activatedItems, draft => {
|
|
669
682
|
for (const key in draft) {
|
|
670
|
-
if (key.startsWith(node.fullKey))
|
|
683
|
+
if (key.startsWith(node.fullKey)) {
|
|
684
|
+
logActivatedItems('item deactivation deletes a key', key)
|
|
685
|
+
delete draft[key]
|
|
686
|
+
}
|
|
671
687
|
}
|
|
672
688
|
})
|
|
673
689
|
this.updateState()
|
package/src/state/state-node.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isSwitchStruct,
|
|
1
|
+
import { isSwitchStruct, childIsCompositeCompObject, childIsSlotCompObject, isCompositeLayout, isFocusableLayout, isItemsLayout, isGetItemsExpression, isGetItemsFetch, isListLayout } from '@json-layout/vocabulary'
|
|
2
2
|
import { produce } from 'immer'
|
|
3
3
|
import debug from 'debug'
|
|
4
4
|
import { getChildDisplay } from './utils/display.js'
|
|
@@ -32,8 +32,8 @@ export const useDefaultData = (data, layout, options) => {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
// use Immer for efficient updating with immutability and no-op detection
|
|
35
|
-
/** @type {(draft: import('./types.js').StateNode, key: string | number, fullKey: string, parentFullKey: string | null, dataPath: string, parentDataPath: string | null, skeleton: import('../index.js').SkeletonNode, layout: import('@json-layout/vocabulary').BaseCompObject, width: number, cols: number, data: unknown, error: string | undefined, validated: boolean, options: import('./types.js').StateNodeOptions, autofocus: boolean, props: import('@json-layout/vocabulary').StateNodePropsLib, itemsCacheKey: any, children: import('../index.js').StateNode[] | undefined) => import('../index.js').StateNode} */
|
|
36
|
-
const produceStateNode = produce((draft, key, fullKey, parentFullKey, dataPath, parentDataPath, skeleton, layout, width, cols, data, error, validated, options, autofocus, props, itemsCacheKey, children) => {
|
|
35
|
+
/** @type {(draft: import('./types.js').StateNode, key: string | number, fullKey: string, parentFullKey: string | null, dataPath: string, parentDataPath: string | null, skeleton: import('../index.js').SkeletonNode, layout: import('@json-layout/vocabulary').BaseCompObject, width: number, cols: number, data: unknown, error: string | undefined, validated: boolean, options: import('./types.js').StateNodeOptions, autofocus: boolean, props: import('@json-layout/vocabulary').StateNodePropsLib, slots: import('@json-layout/vocabulary').Slots | undefined, itemsCacheKey: any, children: import('../index.js').StateNode[] | undefined) => import('../index.js').StateNode} */
|
|
36
|
+
const produceStateNode = produce((draft, key, fullKey, parentFullKey, dataPath, parentDataPath, skeleton, layout, width, cols, data, error, validated, options, autofocus, props, slots, itemsCacheKey, children) => {
|
|
37
37
|
draft.messages = layout.messages ? produceStateNodeMessages(draft.messages || {}, layout.messages, options) : options.messages
|
|
38
38
|
|
|
39
39
|
draft.key = key
|
|
@@ -61,7 +61,7 @@ const produceStateNode = produce((draft, key, fullKey, parentFullKey, dataPath,
|
|
|
61
61
|
else delete draft.autofocusChild
|
|
62
62
|
}
|
|
63
63
|
draft.props = props
|
|
64
|
-
|
|
64
|
+
draft.slots = slots
|
|
65
65
|
draft.children = children
|
|
66
66
|
})
|
|
67
67
|
|
|
@@ -181,8 +181,16 @@ const produceCompositeChildrenOptions = produce((draft, section) => {
|
|
|
181
181
|
*/
|
|
182
182
|
const matchError = (error, skeleton, dataPath, parentDataPath) => {
|
|
183
183
|
const originalError = error.params?.errors?.[0] ?? error
|
|
184
|
-
if (parentDataPath === originalError.instancePath && originalError.params?.missingProperty === skeleton.key)
|
|
185
|
-
|
|
184
|
+
if (parentDataPath === originalError.instancePath && originalError.params?.missingProperty === skeleton.key) {
|
|
185
|
+
return true
|
|
186
|
+
}
|
|
187
|
+
if (
|
|
188
|
+
originalError.instancePath === dataPath &&
|
|
189
|
+
(originalError.schemaPath === skeleton.pointer || originalError.schemaPath === skeleton.refPointer) &&
|
|
190
|
+
!originalError.params?.missingProperty
|
|
191
|
+
) {
|
|
192
|
+
return true
|
|
193
|
+
}
|
|
186
194
|
return false
|
|
187
195
|
}
|
|
188
196
|
|
|
@@ -241,6 +249,7 @@ export function evalExpression (expressions, expression, data, options, display,
|
|
|
241
249
|
}
|
|
242
250
|
}
|
|
243
251
|
|
|
252
|
+
const noneComp = { comp: 'none' }
|
|
244
253
|
/**
|
|
245
254
|
* @param {import('@json-layout/vocabulary').NormalizedLayout} normalizedLayout
|
|
246
255
|
* @param {import('@json-layout/vocabulary').Child | null} childDefinition
|
|
@@ -261,14 +270,14 @@ const getCompObject = (normalizedLayout, childDefinition, options, compiledLayou
|
|
|
261
270
|
}
|
|
262
271
|
} else {
|
|
263
272
|
if (childDefinition?.if && !evalExpression(compiledLayout.expressions, childDefinition.if, data, options, display, normalizedLayout, compiledLayout.validates, rootData, parentContext)) {
|
|
264
|
-
return
|
|
273
|
+
return noneComp
|
|
265
274
|
}
|
|
266
275
|
if (normalizedLayout.if && !evalExpression(compiledLayout.expressions, normalizedLayout.if, data, options, display, normalizedLayout, compiledLayout.validates, rootData, parentContext)) {
|
|
267
|
-
return
|
|
276
|
+
return noneComp
|
|
268
277
|
}
|
|
269
278
|
return normalizedLayout
|
|
270
279
|
}
|
|
271
|
-
return
|
|
280
|
+
return noneComp
|
|
272
281
|
}
|
|
273
282
|
|
|
274
283
|
/**
|
|
@@ -346,11 +355,12 @@ export function createStateNode (
|
|
|
346
355
|
if (context._debugCache) context._debugCache[fullKey] = (context._debugCache[fullKey] ?? []).concat(['skip'])
|
|
347
356
|
}
|
|
348
357
|
|
|
349
|
-
const normalizedLayout = childDefinition &&
|
|
358
|
+
const normalizedLayout = childDefinition && (childIsCompositeCompObject(childDefinition) || childIsSlotCompObject(childDefinition))
|
|
350
359
|
? childDefinition
|
|
351
360
|
: compiledLayout.normalizedLayouts[skeleton.pointer]
|
|
352
361
|
const layout = getCompObject(normalizedLayout, childDefinition, parentOptions, compiledLayout, parentDisplay, data, context.rootData, parentContext)
|
|
353
362
|
const [display, cols] = getChildDisplay(parentDisplay, childDefinition?.cols ?? layout.cols)
|
|
363
|
+
const slots = childDefinition?.slots ?? layout.slots
|
|
354
364
|
|
|
355
365
|
const options = layout.getOptions
|
|
356
366
|
? produceNodeOptions(
|
|
@@ -544,18 +554,19 @@ export function createStateNode (
|
|
|
544
554
|
}
|
|
545
555
|
|
|
546
556
|
let error = context.errors?.find(error => matchError(error, skeleton, dataPath, parentDataPath))
|
|
547
|
-
if (!error) {
|
|
557
|
+
if (!error && context.rehydrate && context.rehydrateErrors) {
|
|
548
558
|
// findLast here is important because we want to keep the error of the highest child (deepest errors are listed first)
|
|
549
|
-
error = context.
|
|
559
|
+
error = context.rehydrateErrors?.findLast(e => matchChildError(e, skeleton, dataPath, parentDataPath))
|
|
550
560
|
}
|
|
551
561
|
|
|
552
562
|
// capture errors so that they are not repeated in parent nodes
|
|
553
563
|
if (layout.comp !== 'none') {
|
|
554
564
|
if (error) {
|
|
555
565
|
logValidation(`${fullKey} capture validation error on node`, error)
|
|
556
|
-
context.errors = context.errors?.filter(
|
|
557
|
-
|
|
558
|
-
|
|
566
|
+
context.errors = context.errors?.filter(e => error !== e)
|
|
567
|
+
if (context.rehydrate && context.rehydrateErrors) {
|
|
568
|
+
context.rehydrateErrors = context.rehydrateErrors?.filter(e => !matchChildError(e, skeleton, dataPath, parentDataPath))
|
|
569
|
+
}
|
|
559
570
|
}
|
|
560
571
|
}
|
|
561
572
|
|
|
@@ -681,6 +692,7 @@ export function createStateNode (
|
|
|
681
692
|
options,
|
|
682
693
|
autofocus,
|
|
683
694
|
props,
|
|
695
|
+
slots,
|
|
684
696
|
itemsCacheKey,
|
|
685
697
|
children && shallowProduceArray(reusedNode?.children, children)
|
|
686
698
|
)
|
package/src/state/state-tree.js
CHANGED
|
@@ -70,6 +70,9 @@ export function createStateTree (
|
|
|
70
70
|
context.additionalPropertiesErrors = validate.errors.filter(error => error.keyword === 'additionalProperties' || error.keyword === 'unevaluatedProperties')
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
+
if (context.rehydrate && context.rehydrateErrors?.length) {
|
|
74
|
+
logValidation(`${skeleton.root} some validation errors were not captured by a leaf property, try to capture on a parent`, context.rehydrateErrors)
|
|
75
|
+
}
|
|
73
76
|
const root = createStateNode(
|
|
74
77
|
context,
|
|
75
78
|
options,
|
package/src/state/types.ts
CHANGED
|
@@ -26,7 +26,8 @@ import {
|
|
|
26
26
|
type FileInput,
|
|
27
27
|
type Card,
|
|
28
28
|
type Child,
|
|
29
|
-
type StateNodePropsLib
|
|
29
|
+
type StateNodePropsLib,
|
|
30
|
+
type Slots
|
|
30
31
|
} from '@json-layout/vocabulary'
|
|
31
32
|
import { type SkeletonTree, type SkeletonNode, type StatefulLayout, type CompiledLayout } from '../index.js'
|
|
32
33
|
import { type LocaleMessages } from '../i18n/types.js'
|
|
@@ -50,6 +51,7 @@ export interface StateNode {
|
|
|
50
51
|
autofocus?: boolean
|
|
51
52
|
autofocusChild?: string | number
|
|
52
53
|
props?: StateNodePropsLib
|
|
54
|
+
slots?: Slots
|
|
53
55
|
itemsCacheKey: any
|
|
54
56
|
children?: StateNode[]
|
|
55
57
|
}
|
|
@@ -62,6 +64,7 @@ export interface StateTree {
|
|
|
62
64
|
export interface CreateStateTreeContext {
|
|
63
65
|
allErrors?: ErrorObject[]
|
|
64
66
|
errors?: ErrorObject[]
|
|
67
|
+
rehydrateErrors?: ErrorObject[]
|
|
65
68
|
additionalPropertiesErrors?: ErrorObject[]
|
|
66
69
|
files: FileRef[]
|
|
67
70
|
activatedItems: Record<string, number>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/state/index.js"],"names":[],"mappings":";;AAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,mEAAmE;AACnE,+BADkB,SAAS,GAAG,SAAS,8CACoC;AAE3E,iLAAiL;AACjL,iCADkB,SAAS,GAAG,SAAS,cAAc,OAAO,MAAM,EAAE,OAAO,yBAAyB,EAAE,aAAa,CAAC,yHACnB;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/state/index.js"],"names":[],"mappings":";;AAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,mEAAmE;AACnE,+BADkB,SAAS,GAAG,SAAS,8CACoC;AAE3E,iLAAiL;AACjL,iCADkB,SAAS,GAAG,SAAS,cAAc,OAAO,MAAM,EAAE,OAAO,yBAAyB,EAAE,aAAa,CAAC,yHACnB;AAQjG;IAiIE;;;;;OAKG;IACH,4BALW,OAAO,aAAa,EAAE,cAAc,gBACpC,OAAO,aAAa,EAAE,YAAY,WAClC,QAAQ,qBAAqB,CAAC,SAC9B,OAAO,EAejB;IAnJD;;;;OAIG;IACH,iCAAe;IACf,mEAAqD;IAErD;;;OAGG;IAEH,mBAAU;IACV,gDAA2C;IAE3C;;;OAGG;IACH,uBAFU,OAAO,aAAa,EAAE,YAAY,CAEhC;IAEZ;;;OAGG;IAEH,iBAAQ;IACR,uBAAuC;IAEvC;;;OAGG;IAEH,yBAAgB;IAQhB;;;OAGG;IACH,+DAOC;IAlBD;;OAEG;IACH,4DAEC;IAeD;;;OAGG;IAEH,iBAAQ;IAKR;;OAEG;IACH,6DAIC;IAXD;;OAEG;IACH,0DAAuC;IAUvC;;;OAGG;IACH,cAAK;IAEL,uBAIC;IALD,oBAAiC;IAOjC;;;OAGG;IACH,sBAAa;IAEb;;;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,YAAY,EAAE,sBAAsB;4BAC3C,OAAO,YAAY,EAAE,aAAa;2BAClC,OAAO,YAAY,EAAE,YAAY;8BACjC,OAAO,YAAY,EAAE,eAAe;yBACpC,OAAO,YAAY,EAAE,UAAU;0BAC/B,OAAO,YAAY,EAAE,WAAW;yBAChC,OAAO,YAAY,EAAE,UAAU;+BAC/B,OAAO,YAAY,EAAE,gBAAgB;6BACrC,OAAO,YAAY,EAAE,cAAc;gCACnC,OAAO,YAAY,EAAE,iBAAiB;8BACtC,OAAO,YAAY,EAAE,eAAe;2BACpC,OAAO,YAAY,EAAE,YAAY;2BACjC,OAAO,YAAY,EAAE,YAAY;yBACjC,OAAO,YAAY,EAAE,UAAU;8BAC/B,OAAO,YAAY,EAAE,eAAe;6BACpC,OAAO,YAAY,EAAE,cAAc;iCACnC,OAAO,YAAY,EAAE,kBAAkB;6BACvC,OAAO,YAAY,EAAE,cAAc;kCACnC,OAAO,YAAY,EAAE,mBAAmB;uBACxC,OAAO,YAAY,EAAE,QAAQ;+BAC7B,OAAO,YAAY,EAAE,gBAAgB;0BACrC,OAAO,YAAY,EAAE,WAAW;8BAChC,OAAO,YAAY,EAAE,eAAe;uBACpC,OAAO,YAAY,EAAE,QAAQ;4BAC7B,OAAO,YAAY,EAAE,aAAa;uBAClC,OAAO,YAAY,EAAE,QAAQ;sBAC7B,OAAO,YAAY,EAAE,OAAO;wBAtCjB,oBAAoB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state-node.d.ts","sourceRoot":"","sources":["../../src/state/state-node.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"state-node.d.ts","sourceRoot":"","sources":["../../src/state/state-node.js"],"names":[],"mappings":"AAyNA;;;;;;;;;;;GAWG;AACH,4CAXW,OAAO,aAAa,EAAE,kBAAkB,EAAE,cAC1C,OAAO,yBAAyB,EAAE,UAAU,QAC5C,GAAG,WACH,OAAO,YAAY,EAAE,gBAAgB,WACrC,OAAO,oBAAoB,EA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|
|
1
|
+
{"version":3,"file":"state-tree.d.ts","sourceRoot":"","sources":["../../src/state/state-tree.js"],"names":[],"mappings":"AA6BA;;;;;;;;;;GAUG;AACH,yCAVW,OAAO,YAAY,EAAE,sBAAsB,WAC3C,OAAO,YAAY,EAAE,qBAAqB,kBAC1C,OAAO,aAAa,EAAE,cAAc,YACpC,OAAO,aAAa,EAAE,YAAY,WAClC,OAAO,oBAAoB,EAAE,OAAO,QACpC,OAAO,mBACP,OAAO,YAAY,EAAE,eAAe,iEAElC,OAAO,YAAY,EAAE,SAAS,CAiE1C"}
|
package/types/state/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ErrorObject } from 'ajv/dist/2019.js';
|
|
2
|
-
import { type BaseCompObject, type Cols, type StateNodeOptionsBase, type TextField, type Textarea, type NumberField, type Slider, type Checkbox, type Switch, type DatePicker, type DateTimePicker, type TimePicker, type ColorPicker, type Section, type OneOfSelect, type Select, type Autocomplete, type Tabs, type VerticalTabs, type ExpansionPanels, type Stepper, type List, type Combobox, type FileInput, type Card, type Child, type StateNodePropsLib } from '@json-layout/vocabulary';
|
|
2
|
+
import { type BaseCompObject, type Cols, type StateNodeOptionsBase, type TextField, type Textarea, type NumberField, type Slider, type Checkbox, type Switch, type DatePicker, type DateTimePicker, type TimePicker, type ColorPicker, type Section, type OneOfSelect, type Select, type Autocomplete, type Tabs, type VerticalTabs, type ExpansionPanels, type Stepper, type List, type Combobox, type FileInput, type Card, type Child, type StateNodePropsLib, type Slots } from '@json-layout/vocabulary';
|
|
3
3
|
import { type SkeletonTree, type SkeletonNode, type StatefulLayout, type CompiledLayout } from '../index.js';
|
|
4
4
|
import { type LocaleMessages } from '../i18n/types.js';
|
|
5
5
|
export interface StateNode {
|
|
@@ -21,6 +21,7 @@ export interface StateNode {
|
|
|
21
21
|
autofocus?: boolean;
|
|
22
22
|
autofocusChild?: string | number;
|
|
23
23
|
props?: StateNodePropsLib;
|
|
24
|
+
slots?: Slots;
|
|
24
25
|
itemsCacheKey: any;
|
|
25
26
|
children?: StateNode[];
|
|
26
27
|
}
|
|
@@ -31,6 +32,7 @@ export interface StateTree {
|
|
|
31
32
|
export interface CreateStateTreeContext {
|
|
32
33
|
allErrors?: ErrorObject[];
|
|
33
34
|
errors?: ErrorObject[];
|
|
35
|
+
rehydrateErrors?: ErrorObject[];
|
|
34
36
|
additionalPropertiesErrors?: ErrorObject[];
|
|
35
37
|
files: FileRef[];
|
|
36
38
|
activatedItems: Record<string, number>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/state/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,IAAI,EACT,KAAK,oBAAoB,EACzB,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,KAAK,MAAM,EACX,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,MAAM,EACX,KAAK,YAAY,EACjB,KAAK,IAAI,EACT,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,OAAO,EACZ,KAAK,IAAI,EACT,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,IAAI,EACT,KAAK,KAAK,EACV,KAAK,iBAAiB,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/state/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,IAAI,EACT,KAAK,oBAAoB,EACzB,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,MAAM,EACX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