@genesislcap/foundation-forms 15.46.3 → 15.46.5
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.
|
@@ -2391,7 +2391,7 @@
|
|
|
2391
2391
|
}
|
|
2392
2392
|
}
|
|
2393
2393
|
],
|
|
2394
|
-
"description": "Returns true when `uiSchema` (or any of its descendants) has a scope that appears\nin `errorScopes`. Walks both `elements` and `options.childElements
|
|
2394
|
+
"description": "Returns true when `uiSchema` (or any of its descendants) has a scope that appears\nin `errorScopes`. Walks both `elements` and `options.childElements`.\n\nA node's own scope is matched too, except when it has children and a more specific\nerror scope under the same path is present. That case is AJV's cascade (e.g. `/FOO`\n`oneOf`/`type` errors emitted on top of a leaf error at `/FOO/BAR`), and matching the\nshared container scope would badge every sibling that merely shares it. A container\nerror with no specific error beneath it still matches, since it cannot be pinned to\none field."
|
|
2395
2395
|
}
|
|
2396
2396
|
],
|
|
2397
2397
|
"exports": [
|
|
@@ -46,6 +46,13 @@ export declare function extractErrorScopes(errors: ErrorObject[]): string[];
|
|
|
46
46
|
/**
|
|
47
47
|
* Returns true when `uiSchema` (or any of its descendants) has a scope that appears
|
|
48
48
|
* in `errorScopes`. Walks both `elements` and `options.childElements`.
|
|
49
|
+
*
|
|
50
|
+
* A node's own scope is matched too, except when it has children and a more specific
|
|
51
|
+
* error scope under the same path is present. That case is AJV's cascade (e.g. `/FOO`
|
|
52
|
+
* `oneOf`/`type` errors emitted on top of a leaf error at `/FOO/BAR`), and matching the
|
|
53
|
+
* shared container scope would badge every sibling that merely shares it. A container
|
|
54
|
+
* error with no specific error beneath it still matches, since it cannot be pinned to
|
|
55
|
+
* one field.
|
|
49
56
|
*/
|
|
50
57
|
export declare function uiSchemaHasAnyError(uiSchema: UiSchemaElement | UiSchema, errorScopes: string[]): boolean;
|
|
51
58
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-utils.d.ts","sourceRoot":"","sources":["../../../src/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Q,GAAG,QAAQ,CAiBzD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAK1D;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,EAAE,CAelE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,eAAe,GAAG,QAAQ,EACpC,WAAW,EAAE,MAAM,EAAE,GACpB,OAAO,CA0BT;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,oBAAoB,CAAC,EAAE,QAAQ,GAAG,IAAI,GAAG,QAAQ,CAoBrF"}
|
|
@@ -103,9 +103,9 @@ export function extractErrorScopes(errors) {
|
|
|
103
103
|
const scopes = new Set();
|
|
104
104
|
for (const error of errors) {
|
|
105
105
|
if (error.keyword === 'required' && ((_a = error.params) === null || _a === void 0 ? void 0 : _a.missingProperty)) {
|
|
106
|
-
const basePath = error.instancePath
|
|
106
|
+
const basePath = error.instancePath ? error.instancePath.replace(/\//g, '/properties/') : '';
|
|
107
107
|
const prop = error.params.missingProperty;
|
|
108
|
-
const fullPath =
|
|
108
|
+
const fullPath = `#${basePath}/properties/${prop}`;
|
|
109
109
|
scopes.add(fullPath);
|
|
110
110
|
}
|
|
111
111
|
else if (error.instancePath) {
|
|
@@ -119,27 +119,41 @@ export function extractErrorScopes(errors) {
|
|
|
119
119
|
/**
|
|
120
120
|
* Returns true when `uiSchema` (or any of its descendants) has a scope that appears
|
|
121
121
|
* in `errorScopes`. Walks both `elements` and `options.childElements`.
|
|
122
|
+
*
|
|
123
|
+
* A node's own scope is matched too, except when it has children and a more specific
|
|
124
|
+
* error scope under the same path is present. That case is AJV's cascade (e.g. `/FOO`
|
|
125
|
+
* `oneOf`/`type` errors emitted on top of a leaf error at `/FOO/BAR`), and matching the
|
|
126
|
+
* shared container scope would badge every sibling that merely shares it. A container
|
|
127
|
+
* error with no specific error beneath it still matches, since it cannot be pinned to
|
|
128
|
+
* one field.
|
|
122
129
|
*/
|
|
123
130
|
export function uiSchemaHasAnyError(uiSchema, errorScopes) {
|
|
124
131
|
var _a;
|
|
125
|
-
if (
|
|
126
|
-
|
|
127
|
-
return true;
|
|
132
|
+
if (!uiSchema) {
|
|
133
|
+
return false;
|
|
128
134
|
}
|
|
129
135
|
const childElements = (_a = uiSchema.options) === null || _a === void 0 ? void 0 : _a.childElements;
|
|
130
|
-
|
|
136
|
+
const elements = uiSchema.elements;
|
|
137
|
+
const hasChildElements = Array.isArray(childElements) && childElements.length > 0;
|
|
138
|
+
const hasElements = Array.isArray(elements) && elements.length > 0;
|
|
139
|
+
if (hasChildElements) {
|
|
131
140
|
for (const child of childElements) {
|
|
132
141
|
if (uiSchemaHasAnyError(child, errorScopes))
|
|
133
142
|
return true;
|
|
134
143
|
}
|
|
135
144
|
}
|
|
136
|
-
if (
|
|
137
|
-
for (const el of
|
|
145
|
+
if (hasElements) {
|
|
146
|
+
for (const el of elements) {
|
|
138
147
|
if (uiSchemaHasAnyError(el, errorScopes))
|
|
139
148
|
return true;
|
|
140
149
|
}
|
|
141
150
|
}
|
|
142
|
-
|
|
151
|
+
const ownScope = uiSchema.scope;
|
|
152
|
+
if (typeof ownScope !== 'string' || !errorScopes.includes(ownScope)) {
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
155
|
+
const hasSpecificErrorBeneath = errorScopes.some((scope) => scope.startsWith(`${ownScope}/`));
|
|
156
|
+
return !((hasChildElements || hasElements) && hasSpecificErrorBeneath);
|
|
143
157
|
}
|
|
144
158
|
/**
|
|
145
159
|
* Generates a UI schema suitable for bulk insert mode with array control.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/foundation-forms",
|
|
3
3
|
"description": "Genesis Foundation Forms",
|
|
4
|
-
"version": "15.46.
|
|
4
|
+
"version": "15.46.5",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "SEE LICENSE IN license.txt",
|
|
7
7
|
"main": "dist/esm/index.js",
|
|
@@ -56,12 +56,12 @@
|
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@genesislcap/foundation-testing": "15.46.
|
|
60
|
-
"@genesislcap/genx": "15.46.
|
|
61
|
-
"@genesislcap/ts-builder": "15.46.
|
|
62
|
-
"@genesislcap/uvu-playwright-builder": "15.46.
|
|
63
|
-
"@genesislcap/vite-builder": "15.46.
|
|
64
|
-
"@genesislcap/webpack-builder": "15.46.
|
|
59
|
+
"@genesislcap/foundation-testing": "15.46.5",
|
|
60
|
+
"@genesislcap/genx": "15.46.5",
|
|
61
|
+
"@genesislcap/ts-builder": "15.46.5",
|
|
62
|
+
"@genesislcap/uvu-playwright-builder": "15.46.5",
|
|
63
|
+
"@genesislcap/vite-builder": "15.46.5",
|
|
64
|
+
"@genesislcap/webpack-builder": "15.46.5",
|
|
65
65
|
"@types/json-schema": "^7.0.11",
|
|
66
66
|
"@types/papaparse": "^5.3.14"
|
|
67
67
|
},
|
|
@@ -78,12 +78,12 @@
|
|
|
78
78
|
}
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
|
-
"@genesislcap/foundation-comms": "15.46.
|
|
82
|
-
"@genesislcap/foundation-criteria": "15.46.
|
|
83
|
-
"@genesislcap/foundation-logger": "15.46.
|
|
84
|
-
"@genesislcap/foundation-notifications": "15.46.
|
|
85
|
-
"@genesislcap/foundation-ui": "15.46.
|
|
86
|
-
"@genesislcap/foundation-utils": "15.46.
|
|
81
|
+
"@genesislcap/foundation-comms": "15.46.5",
|
|
82
|
+
"@genesislcap/foundation-criteria": "15.46.5",
|
|
83
|
+
"@genesislcap/foundation-logger": "15.46.5",
|
|
84
|
+
"@genesislcap/foundation-notifications": "15.46.5",
|
|
85
|
+
"@genesislcap/foundation-ui": "15.46.5",
|
|
86
|
+
"@genesislcap/foundation-utils": "15.46.5",
|
|
87
87
|
"@json-schema-tools/dereferencer": "^1.6.1",
|
|
88
88
|
"@jsonforms/core": "^3.2.1",
|
|
89
89
|
"@microsoft/fast-components": "2.30.6",
|