@json-layout/core 0.25.0 → 0.26.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 +1 -1
- package/src/i18n/index.js +3 -1
- package/src/i18n/nl.js +33 -0
- package/src/state/index.js +4 -0
- package/src/state/state-node.js +19 -10
- package/src/state/types.ts +2 -2
- package/src/utils/doc-options.js +5 -5
package/package.json
CHANGED
package/src/i18n/index.js
CHANGED
package/src/i18n/nl.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** @type {import('./types.js').LocaleMessages} */
|
|
2
|
+
export default {
|
|
3
|
+
errorOneOf: 'Kies er een',
|
|
4
|
+
errorRequired: 'benodigde informatie',
|
|
5
|
+
addItem: 'Item toevoegen',
|
|
6
|
+
delete: 'Verwijderen',
|
|
7
|
+
edit: 'Bewerken',
|
|
8
|
+
close: 'Sluiten',
|
|
9
|
+
duplicate: 'Verveelvoudigen',
|
|
10
|
+
sort: 'Sorteren',
|
|
11
|
+
up: 'Omhoog verplaatsen',
|
|
12
|
+
down: 'Omlaag verplaatsen',
|
|
13
|
+
showHelp: 'Toon helpbericht',
|
|
14
|
+
mdeLink1: '[Link titel',
|
|
15
|
+
mdeLink2: '](link url)',
|
|
16
|
+
mdeImg1: '',
|
|
18
|
+
mdeTable1: '',
|
|
19
|
+
mdeTable2: '\n\n| Kolom 1 | Kolom 2 | Kolom 3 |\n| -------- | -------- | -------- |\n| Tekst | Tekst | Tekst |\n\n',
|
|
20
|
+
bold: 'Vet',
|
|
21
|
+
italic: 'Cursief',
|
|
22
|
+
heading: 'Titel',
|
|
23
|
+
quote: 'Citaat',
|
|
24
|
+
unorderedList: 'Ongeordende lijst',
|
|
25
|
+
orderedList: 'Geordende lijst',
|
|
26
|
+
createLink: 'Maak een koppeling',
|
|
27
|
+
insertImage: 'Afbeelding invoegen',
|
|
28
|
+
createTable: 'Tabel aanmaken',
|
|
29
|
+
preview: 'Voorbeeld',
|
|
30
|
+
mdeGuide: 'Documentatie over syntaxis',
|
|
31
|
+
undo: 'Ongedaan maken',
|
|
32
|
+
redo: 'Opnieuw'
|
|
33
|
+
}
|
package/src/state/index.js
CHANGED
|
@@ -295,6 +295,10 @@ export class StatefulLayout {
|
|
|
295
295
|
files: [],
|
|
296
296
|
nodes: []
|
|
297
297
|
}
|
|
298
|
+
|
|
299
|
+
// @ts-ignore
|
|
300
|
+
if (this._options._debugCache) createStateTreeContext._debugCache = this._lastCreateStateTreeContext?._debugCache ?? {}
|
|
301
|
+
|
|
298
302
|
this._stateTree = createStateTree(
|
|
299
303
|
createStateTreeContext,
|
|
300
304
|
this._options,
|
package/src/state/state-node.js
CHANGED
|
@@ -270,11 +270,20 @@ export function createStateNode (
|
|
|
270
270
|
|
|
271
271
|
// NOTE we have to exclude nodes with errors from the cache, because context.errors is unpurely modified
|
|
272
272
|
// TODO: implement a cleaner way to filter context.errors while being able to reuse nodes with errors
|
|
273
|
-
if (skeleton.pure &&
|
|
274
|
-
|
|
275
|
-
|
|
273
|
+
if (skeleton.pure && !reusedNode?.error && !reusedNode?.childError) {
|
|
274
|
+
const validatedCacheKey = validationState.validatedForm || validationState.validatedChildren.includes(fullKey)
|
|
275
|
+
cacheKey = [parentOptions, compiledLayout, fullKey, skeleton, childDefinition, parentDisplay.width, validatedCacheKey, context.activatedItems, context.initial, data]
|
|
276
|
+
if (reusedNode && context.cacheKeys[fullKey] && shallowEqualArray(context.cacheKeys[fullKey], cacheKey)) {
|
|
277
|
+
// @ts-ignore
|
|
278
|
+
if (context._debugCache) context._debugCache[fullKey] = (context._debugCache[fullKey] ?? []).concat(['hit'])
|
|
276
279
|
return reusedNode
|
|
280
|
+
} else {
|
|
281
|
+
// @ts-ignore
|
|
282
|
+
if (context._debugCache) context._debugCache[fullKey] = (context._debugCache[fullKey] ?? []).concat(['miss'])
|
|
277
283
|
}
|
|
284
|
+
} else {
|
|
285
|
+
// @ts-ignore
|
|
286
|
+
if (context._debugCache) context._debugCache[fullKey] = (context._debugCache[fullKey] ?? []).concat(['skip'])
|
|
278
287
|
}
|
|
279
288
|
|
|
280
289
|
const normalizedLayout = childDefinition && childIsCompObject(childDefinition)
|
|
@@ -428,19 +437,19 @@ export function createStateNode (
|
|
|
428
437
|
})
|
|
429
438
|
}
|
|
430
439
|
}
|
|
431
|
-
const validated = validationState.validatedForm ||
|
|
432
|
-
validationState.validatedChildren.includes(fullKey) ||
|
|
433
|
-
(validationState.initialized === false && options.initialValidation === 'always') ||
|
|
434
|
-
(validationState.initialized === false && options.initialValidation === 'withData' && !isDataEmpty(data))
|
|
435
440
|
|
|
436
441
|
let nodeData = data
|
|
437
|
-
|
|
438
442
|
if (nodeData === null && !layout.nullable) nodeData = undefined
|
|
439
443
|
|
|
444
|
+
const validated = validationState.validatedForm ||
|
|
445
|
+
validationState.validatedChildren.includes(fullKey) ||
|
|
446
|
+
(validationState.initialized === false && options.initialValidation === 'always') ||
|
|
447
|
+
(validationState.initialized === false && options.initialValidation === 'withData' && !isDataEmpty(nodeData))
|
|
448
|
+
|
|
440
449
|
/** @type {unknown} */
|
|
441
|
-
if (typeof nodeData === 'object' && !(nodeData instanceof File)) {
|
|
450
|
+
if ((typeof nodeData === 'object' || (nodeData === undefined && children?.length)) && !(nodeData instanceof File)) {
|
|
442
451
|
nodeData = produceStateNodeData(
|
|
443
|
-
/** @type {Record<string, unknown>} */(nodeData ?? {}),
|
|
452
|
+
/** @type {Record<string, unknown>} */(nodeData ?? (typeof children?.[0]?.key === 'number' ? [] : {})),
|
|
444
453
|
dataPath,
|
|
445
454
|
children,
|
|
446
455
|
context.additionalPropertiesErrors,
|
package/src/state/types.ts
CHANGED
|
@@ -76,7 +76,7 @@ export interface FileRef {
|
|
|
76
76
|
dataPath: string
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
// [parentOptions, compiledLayout, fullKey, skeleton, childDefinition, parentWidth,
|
|
79
|
+
// [parentOptions, compiledLayout, fullKey, skeleton, childDefinition, parentWidth, validated, activatedItems, initial, data]
|
|
80
80
|
export type StateNodeCacheKey = [
|
|
81
81
|
StateNodeOptions,
|
|
82
82
|
CompiledLayout,
|
|
@@ -84,7 +84,7 @@ export type StateNodeCacheKey = [
|
|
|
84
84
|
SkeletonNode,
|
|
85
85
|
Child | null,
|
|
86
86
|
number,
|
|
87
|
-
|
|
87
|
+
boolean,
|
|
88
88
|
Record<string, number>,
|
|
89
89
|
boolean,
|
|
90
90
|
unknown
|
package/src/utils/doc-options.js
CHANGED
|
@@ -124,11 +124,6 @@ export const runtimeOptions = [
|
|
|
124
124
|
false: 'Never remove additional properties (alias "none").'
|
|
125
125
|
}
|
|
126
126
|
},
|
|
127
|
-
{
|
|
128
|
-
key: 'autofocus',
|
|
129
|
-
description: 'Activate autofocus. The focus will be given to the first input of the form.',
|
|
130
|
-
default: false
|
|
131
|
-
},
|
|
132
127
|
{
|
|
133
128
|
key: 'readOnlyPropertiesMode',
|
|
134
129
|
description: 'Control the way readOnly properties from the schema are managed.',
|
|
@@ -138,5 +133,10 @@ export const runtimeOptions = [
|
|
|
138
133
|
hide: 'Hide the readOnly properties but keep them in the data.',
|
|
139
134
|
show: 'Show the readOnly properties.'
|
|
140
135
|
}
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
key: 'autofocus',
|
|
139
|
+
description: 'Activate autofocus. The focus will be given to the first input of the form.',
|
|
140
|
+
default: false
|
|
141
141
|
}
|
|
142
142
|
]
|