@genesislcap/foundation-forms 14.334.0 → 14.336.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/dist/custom-elements.json +51 -1
- package/dist/dts/jsonforms/renderers/ControlWrapperRenderer.d.ts +1 -0
- package/dist/dts/jsonforms/renderers/ControlWrapperRenderer.d.ts.map +1 -1
- package/dist/dts/utils/validation.d.ts +5 -0
- package/dist/dts/utils/validation.d.ts.map +1 -1
- package/dist/esm/jsonforms/renderers/ControlWrapperRenderer.js +13 -3
- package/dist/esm/utils/validation.js +85 -0
- package/dist/foundation-forms.api.json +94 -0
- package/dist/foundation-forms.d.ts +6 -0
- package/docs/api/foundation-forms.getanyoferrormessage.md +96 -0
- package/docs/api/foundation-forms.md +11 -0
- package/docs/api-report.md.api.md +3 -0
- package/package.json +15 -15
|
@@ -1251,6 +1251,43 @@
|
|
|
1251
1251
|
}
|
|
1252
1252
|
},
|
|
1253
1253
|
"privacy": "public"
|
|
1254
|
+
},
|
|
1255
|
+
{
|
|
1256
|
+
"kind": "function",
|
|
1257
|
+
"name": "getAnyOfErrorMessage",
|
|
1258
|
+
"return": {
|
|
1259
|
+
"type": {
|
|
1260
|
+
"text": "string"
|
|
1261
|
+
}
|
|
1262
|
+
},
|
|
1263
|
+
"parameters": [
|
|
1264
|
+
{
|
|
1265
|
+
"name": "errors",
|
|
1266
|
+
"type": {
|
|
1267
|
+
"text": "Array<any> | undefined"
|
|
1268
|
+
}
|
|
1269
|
+
},
|
|
1270
|
+
{
|
|
1271
|
+
"name": "schema",
|
|
1272
|
+
"type": {
|
|
1273
|
+
"text": "any"
|
|
1274
|
+
}
|
|
1275
|
+
},
|
|
1276
|
+
{
|
|
1277
|
+
"name": "controlPath",
|
|
1278
|
+
"type": {
|
|
1279
|
+
"text": "string | undefined"
|
|
1280
|
+
}
|
|
1281
|
+
},
|
|
1282
|
+
{
|
|
1283
|
+
"name": "uiCustomMsg",
|
|
1284
|
+
"optional": true,
|
|
1285
|
+
"type": {
|
|
1286
|
+
"text": "string"
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
],
|
|
1290
|
+
"description": "Computes a human-friendly anyOf error message for a given control path.\nPrefers UI schema custom message, then JSON schema errorMessage.anyOf, then a constructed fallback."
|
|
1254
1291
|
}
|
|
1255
1292
|
],
|
|
1256
1293
|
"exports": [
|
|
@@ -1261,6 +1298,14 @@
|
|
|
1261
1298
|
"name": "mustMatch",
|
|
1262
1299
|
"module": "src/utils/validation.ts"
|
|
1263
1300
|
}
|
|
1301
|
+
},
|
|
1302
|
+
{
|
|
1303
|
+
"kind": "js",
|
|
1304
|
+
"name": "getAnyOfErrorMessage",
|
|
1305
|
+
"declaration": {
|
|
1306
|
+
"name": "getAnyOfErrorMessage",
|
|
1307
|
+
"module": "src/utils/validation.ts"
|
|
1308
|
+
}
|
|
1264
1309
|
}
|
|
1265
1310
|
]
|
|
1266
1311
|
},
|
|
@@ -1580,7 +1625,7 @@
|
|
|
1580
1625
|
{
|
|
1581
1626
|
"kind": "variable",
|
|
1582
1627
|
"name": "ControlWrapperRendererTemplate",
|
|
1583
|
-
"default": "html`\n <template>\n ${when(\n (x) => x.control?.visible,\n html`\n <div\n class=${(x) =>\n classNames(\n ['wrapperRoot', true],\n ['labelLeft', x.jsonForms?.core?.uischema?.options?.labelPlacement === 'left'],\n )}\n id=${(x) => x.control.path + '-wrapper'}\n data-test-id=${(x) => x.control.path + '-wrapper'}\n >\n ${when(\n (x) => !x.hideLabel,\n html`\n <div for=\"${(x) => x.control.path + '-wrapper'}\" class=\"label\">\n <span>\n ${(x) => x.computedLabel}${when(\n (x) => x.control.uischema?.options?.tooltip,\n (x) => x.getPrefixedTooltip,\n )}\n </span>\n </div>\n `,\n )}\n\n <div class=\"wrapper\">\n <slot></slot>\n </div>\n <div
|
|
1628
|
+
"default": "html`\n <template>\n ${when(\n (x) => x.control?.visible,\n html`\n <div\n class=${(x) =>\n classNames(\n ['wrapperRoot', true],\n ['labelLeft', x.jsonForms?.core?.uischema?.options?.labelPlacement === 'left'],\n )}\n id=${(x) => x.control.path + '-wrapper'}\n data-test-id=${(x) => x.control.path + '-wrapper'}\n >\n ${when(\n (x) => !x.hideLabel,\n html`\n <div for=\"${(x) => x.control.path + '-wrapper'}\" class=\"label\">\n <span>\n ${(x) => x.computedLabel}${when(\n (x) => x.control.uischema?.options?.tooltip,\n (x) => x.getPrefixedTooltip,\n )}\n </span>\n </div>\n `,\n )}\n\n <div class=\"wrapper\">\n <slot></slot>\n </div>\n <div\n class=\"${(x) =>\n (x.control.errors || x.anyOfError) && x.touched ? 'error' : 'description'}\"\n >\n ${(x) =>\n x.touched && (x.control.errors || x.anyOfError)\n ? [x.control.errors, x.anyOfError].filter(Boolean).join(' ')\n : x.showDescription\n ? x.control.description\n : ''}\n </div>\n </div>\n `,\n )}\n </template>\n`"
|
|
1584
1629
|
},
|
|
1585
1630
|
{
|
|
1586
1631
|
"kind": "class",
|
|
@@ -1631,6 +1676,11 @@
|
|
|
1631
1676
|
"kind": "field",
|
|
1632
1677
|
"name": "getPrefixedTooltip",
|
|
1633
1678
|
"readonly": true
|
|
1679
|
+
},
|
|
1680
|
+
{
|
|
1681
|
+
"kind": "field",
|
|
1682
|
+
"name": "anyOfError",
|
|
1683
|
+
"readonly": true
|
|
1634
1684
|
}
|
|
1635
1685
|
],
|
|
1636
1686
|
"attributes": [
|
|
@@ -9,5 +9,6 @@ export declare class ControlWrapper extends FASTElement {
|
|
|
9
9
|
get showDescription(): boolean;
|
|
10
10
|
get computedLabel(): string;
|
|
11
11
|
get getPrefixedTooltip(): import("@microsoft/fast-element").ViewTemplate<any, any>;
|
|
12
|
+
get anyOfError(): string;
|
|
12
13
|
}
|
|
13
14
|
//# sourceMappingURL=ControlWrapperRenderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ControlWrapperRenderer.d.ts","sourceRoot":"","sources":["../../../../src/jsonforms/renderers/ControlWrapperRenderer.ts"],"names":[],"mappings":"AACA,OAAO,EAML,WAAW,EAGZ,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"ControlWrapperRenderer.d.ts","sourceRoot":"","sources":["../../../../src/jsonforms/renderers/ControlWrapperRenderer.ts"],"names":[],"mappings":"AACA,OAAO,EAML,WAAW,EAGZ,MAAM,yBAAyB,CAAC;AAIjC,eAAO,MAAM,8BAA8B,0DA8C1C,CAAC;AAqDF,qBAKa,cAAe,SAAQ,WAAW;IACjC,OAAO,MAAC;IACR,SAAS,MAAC;IACV,OAAO,EAAE,OAAO,CAAC;IACuB,SAAS,EAAE,OAAO,CAAS;IACzE,MAAM,EAAE,MAAM,CAAC;IAErB,IACI,eAAe,YAOlB;IAED,IACI,aAAa,WAMhB;IAED,IACI,kBAAkB,6DAGrB;IAED,IACI,UAAU,WAOb;CACF"}
|
|
@@ -11,4 +11,9 @@ export declare const mustMatch: (target: string) => (data: any, path: any, label
|
|
|
11
11
|
keyword: string;
|
|
12
12
|
params: {};
|
|
13
13
|
}[];
|
|
14
|
+
/**
|
|
15
|
+
* Computes a human-friendly anyOf error message for a given control path.
|
|
16
|
+
* Prefers UI schema custom message, then JSON schema errorMessage.anyOf, then a constructed fallback.
|
|
17
|
+
*/
|
|
18
|
+
export declare const getAnyOfErrorMessage: (errors: Array<any> | undefined, schema: any, controlPath: string | undefined, uiCustomMsg?: string) => string;
|
|
14
19
|
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/utils/validation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,SAAS,GAAI,QAAQ,MAAM,MAC9B,SAAI,EAAE,SAAI,EAAE,UAAK;;;;;;GAkB1B,CAAC"}
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/utils/validation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,SAAS,GAAI,QAAQ,MAAM,MAC9B,SAAI,EAAE,SAAI,EAAE,UAAK;;;;;;GAkB1B,CAAC;AAmBF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,GAC/B,QAAQ,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS,EAC9B,QAAQ,GAAG,EACX,aAAa,MAAM,GAAG,SAAS,EAC/B,cAAc,MAAM,KACnB,MAoEF,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { __decorate } from "tslib";
|
|
|
2
2
|
import { computeLabel, isDescriptionHidden } from '@jsonforms/core';
|
|
3
3
|
import { html, css, when, observable, customElement, FASTElement, volatile, attr, } from '@microsoft/fast-element';
|
|
4
4
|
import { classNames } from '@microsoft/fast-web-utilities';
|
|
5
|
+
import { getAnyOfErrorMessage } from '../../utils/validation';
|
|
5
6
|
export const ControlWrapperRendererTemplate = html `
|
|
6
7
|
<template>
|
|
7
8
|
${when((x) => { var _a; return (_a = x.control) === null || _a === void 0 ? void 0 : _a.visible; }, html `
|
|
@@ -24,9 +25,11 @@ export const ControlWrapperRendererTemplate = html `
|
|
|
24
25
|
<div class="wrapper">
|
|
25
26
|
<slot></slot>
|
|
26
27
|
</div>
|
|
27
|
-
<div
|
|
28
|
-
${(x) => x.control.errors && x.touched
|
|
29
|
-
|
|
28
|
+
<div
|
|
29
|
+
class="${(x) => (x.control.errors || x.anyOfError) && x.touched ? 'error' : 'description'}"
|
|
30
|
+
>
|
|
31
|
+
${(x) => x.touched && (x.control.errors || x.anyOfError)
|
|
32
|
+
? [x.control.errors, x.anyOfError].filter(Boolean).join(' ')
|
|
30
33
|
: x.showDescription
|
|
31
34
|
? x.control.description
|
|
32
35
|
: ''}
|
|
@@ -101,6 +104,10 @@ let ControlWrapper = class ControlWrapper extends FASTElement {
|
|
|
101
104
|
return html `
|
|
102
105
|
<${this.prefix}-icon tooltip="${(_b = (_a = this.control.uischema) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.tooltip}" tooltip-id="${this.control.path + '-tooltip'}"></${this.prefix}-icon>`;
|
|
103
106
|
}
|
|
107
|
+
get anyOfError() {
|
|
108
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
109
|
+
return getAnyOfErrorMessage((_b = (_a = this.jsonForms) === null || _a === void 0 ? void 0 : _a.core) === null || _b === void 0 ? void 0 : _b.errors, (_d = (_c = this.jsonForms) === null || _c === void 0 ? void 0 : _c.core) === null || _d === void 0 ? void 0 : _d.schema, (_e = this.control) === null || _e === void 0 ? void 0 : _e.path, (_h = (_g = (_f = this.control) === null || _f === void 0 ? void 0 : _f.uischema) === null || _g === void 0 ? void 0 : _g.options) === null || _h === void 0 ? void 0 : _h.anyOfErrorMessage);
|
|
110
|
+
}
|
|
104
111
|
};
|
|
105
112
|
__decorate([
|
|
106
113
|
observable
|
|
@@ -126,6 +133,9 @@ __decorate([
|
|
|
126
133
|
__decorate([
|
|
127
134
|
volatile
|
|
128
135
|
], ControlWrapper.prototype, "getPrefixedTooltip", null);
|
|
136
|
+
__decorate([
|
|
137
|
+
volatile
|
|
138
|
+
], ControlWrapper.prototype, "anyOfError", null);
|
|
129
139
|
ControlWrapper = __decorate([
|
|
130
140
|
customElement({
|
|
131
141
|
name: 'control-wrapper',
|
|
@@ -23,3 +23,88 @@ export const mustMatch = (target) => {
|
|
|
23
23
|
];
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
|
+
const describeError = (prop, parentProps) => {
|
|
27
|
+
const pSchema = parentProps[prop] || {};
|
|
28
|
+
const constraints = ['required'];
|
|
29
|
+
if (typeof pSchema.minLength === 'number')
|
|
30
|
+
constraints.push('minLength');
|
|
31
|
+
if (typeof pSchema.maxLength === 'number')
|
|
32
|
+
constraints.push('maxLength');
|
|
33
|
+
if (typeof pSchema.minimum === 'number')
|
|
34
|
+
constraints.push('minimum');
|
|
35
|
+
if (typeof pSchema.maximum === 'number')
|
|
36
|
+
constraints.push('maximum');
|
|
37
|
+
if (typeof pSchema.exclusiveMinimum === 'number' || pSchema.exclusiveMinimum === true)
|
|
38
|
+
constraints.push('exclusiveMinimum');
|
|
39
|
+
if (typeof pSchema.exclusiveMaximum === 'number' || pSchema.exclusiveMaximum === true)
|
|
40
|
+
constraints.push('exclusiveMaximum');
|
|
41
|
+
if (typeof pSchema.pattern === 'string')
|
|
42
|
+
constraints.push('pattern');
|
|
43
|
+
if (pSchema.type)
|
|
44
|
+
constraints.push(`type:${pSchema.type}`);
|
|
45
|
+
const suffix = constraints.length > 1 ? ` (${constraints.join(', ')})` : '';
|
|
46
|
+
return `${prop}${suffix}`;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Computes a human-friendly anyOf error message for a given control path.
|
|
50
|
+
* Prefers UI schema custom message, then JSON schema errorMessage.anyOf, then a constructed fallback.
|
|
51
|
+
*/
|
|
52
|
+
export const getAnyOfErrorMessage = (errors, schema, controlPath, uiCustomMsg) => {
|
|
53
|
+
var _a, _b, _c;
|
|
54
|
+
if (!errors || !controlPath) {
|
|
55
|
+
return '';
|
|
56
|
+
}
|
|
57
|
+
// Find all anyOf errors
|
|
58
|
+
const anyOfErrors = errors.filter((e) => e && e.keyword === 'anyOf');
|
|
59
|
+
if (anyOfErrors.length === 0) {
|
|
60
|
+
return '';
|
|
61
|
+
}
|
|
62
|
+
const schemaCustomMsg = (_a = schema === null || schema === void 0 ? void 0 : schema.errorMessage) === null || _a === void 0 ? void 0 : _a.anyOf;
|
|
63
|
+
const preferredCustomMsg = uiCustomMsg || schemaCustomMsg;
|
|
64
|
+
// Convert control path to JSON pointer (e.g., "users.0.email" -> "/users/0/email")
|
|
65
|
+
const pointer = '/' + controlPath.replace(/\./g, '/');
|
|
66
|
+
const matchingAnyOfError = anyOfErrors.find((e) => {
|
|
67
|
+
const instancePath = e.instancePath || '';
|
|
68
|
+
const errorSchema = e.schema;
|
|
69
|
+
if (instancePath === pointer)
|
|
70
|
+
return true;
|
|
71
|
+
if (Array.isArray(errorSchema)) {
|
|
72
|
+
const errorPointers = errorSchema.flatMap((g) => instancePath + '/' + Object.keys(g).flatMap((key) => g[key]));
|
|
73
|
+
return errorPointers.includes(pointer);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
if (matchingAnyOfError) {
|
|
80
|
+
// Extract anyOf constraints from the error's schema or parentSchema
|
|
81
|
+
const anyOfSchema = matchingAnyOfError.schema || ((_b = matchingAnyOfError.parentSchema) === null || _b === void 0 ? void 0 : _b.anyOf);
|
|
82
|
+
if (Array.isArray(anyOfSchema)) {
|
|
83
|
+
const requiredCandidates = new Set();
|
|
84
|
+
anyOfSchema.forEach((branch) => {
|
|
85
|
+
const req = branch && Array.isArray(branch.required) ? branch.required : [];
|
|
86
|
+
req.forEach((r) => requiredCandidates.add(r));
|
|
87
|
+
});
|
|
88
|
+
const currentProp = controlPath.split('.').pop();
|
|
89
|
+
if (!currentProp || !requiredCandidates.has(currentProp)) {
|
|
90
|
+
return '';
|
|
91
|
+
}
|
|
92
|
+
// Get properties schema for constraint enrichment
|
|
93
|
+
const parentProps = ((_c = matchingAnyOfError.parentSchema) === null || _c === void 0 ? void 0 : _c.properties) || {};
|
|
94
|
+
const list = Array.from(requiredCandidates);
|
|
95
|
+
const described = list.map((prop) => describeError(prop, parentProps));
|
|
96
|
+
if (described.length === 1) {
|
|
97
|
+
return preferredCustomMsg || `Field ${described[0]} is required.`;
|
|
98
|
+
}
|
|
99
|
+
const humanList = described.length === 2
|
|
100
|
+
? `${described[0]} or ${described[1]}`
|
|
101
|
+
: `${described.slice(0, -1).join(', ')}, or ${described[described.length - 1]}`;
|
|
102
|
+
return preferredCustomMsg || `One of ${humanList} must be provided.`;
|
|
103
|
+
}
|
|
104
|
+
// If no anyOf schema found in error, return custom message or error message
|
|
105
|
+
return preferredCustomMsg || matchingAnyOfError.message || '';
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
return '';
|
|
109
|
+
}
|
|
110
|
+
};
|
|
@@ -1332,6 +1332,100 @@
|
|
|
1332
1332
|
},
|
|
1333
1333
|
"implementsTokenRanges": []
|
|
1334
1334
|
},
|
|
1335
|
+
{
|
|
1336
|
+
"kind": "Function",
|
|
1337
|
+
"canonicalReference": "@genesislcap/foundation-forms!getAnyOfErrorMessage:function(1)",
|
|
1338
|
+
"docComment": "/**\n * Computes a human-friendly anyOf error message for a given control path. Prefers UI schema custom message, then JSON schema errorMessage.anyOf, then a constructed fallback.\n */\n",
|
|
1339
|
+
"excerptTokens": [
|
|
1340
|
+
{
|
|
1341
|
+
"kind": "Content",
|
|
1342
|
+
"text": "getAnyOfErrorMessage: (errors: "
|
|
1343
|
+
},
|
|
1344
|
+
{
|
|
1345
|
+
"kind": "Reference",
|
|
1346
|
+
"text": "Array",
|
|
1347
|
+
"canonicalReference": "!Array:interface"
|
|
1348
|
+
},
|
|
1349
|
+
{
|
|
1350
|
+
"kind": "Content",
|
|
1351
|
+
"text": "<any> | undefined"
|
|
1352
|
+
},
|
|
1353
|
+
{
|
|
1354
|
+
"kind": "Content",
|
|
1355
|
+
"text": ", schema: "
|
|
1356
|
+
},
|
|
1357
|
+
{
|
|
1358
|
+
"kind": "Content",
|
|
1359
|
+
"text": "any"
|
|
1360
|
+
},
|
|
1361
|
+
{
|
|
1362
|
+
"kind": "Content",
|
|
1363
|
+
"text": ", controlPath: "
|
|
1364
|
+
},
|
|
1365
|
+
{
|
|
1366
|
+
"kind": "Content",
|
|
1367
|
+
"text": "string | undefined"
|
|
1368
|
+
},
|
|
1369
|
+
{
|
|
1370
|
+
"kind": "Content",
|
|
1371
|
+
"text": ", uiCustomMsg?: "
|
|
1372
|
+
},
|
|
1373
|
+
{
|
|
1374
|
+
"kind": "Content",
|
|
1375
|
+
"text": "string"
|
|
1376
|
+
},
|
|
1377
|
+
{
|
|
1378
|
+
"kind": "Content",
|
|
1379
|
+
"text": ") => "
|
|
1380
|
+
},
|
|
1381
|
+
{
|
|
1382
|
+
"kind": "Content",
|
|
1383
|
+
"text": "string"
|
|
1384
|
+
}
|
|
1385
|
+
],
|
|
1386
|
+
"fileUrlPath": "src/utils/validation.ts",
|
|
1387
|
+
"returnTypeTokenRange": {
|
|
1388
|
+
"startIndex": 10,
|
|
1389
|
+
"endIndex": 11
|
|
1390
|
+
},
|
|
1391
|
+
"releaseTag": "Public",
|
|
1392
|
+
"overloadIndex": 1,
|
|
1393
|
+
"parameters": [
|
|
1394
|
+
{
|
|
1395
|
+
"parameterName": "errors",
|
|
1396
|
+
"parameterTypeTokenRange": {
|
|
1397
|
+
"startIndex": 1,
|
|
1398
|
+
"endIndex": 3
|
|
1399
|
+
},
|
|
1400
|
+
"isOptional": false
|
|
1401
|
+
},
|
|
1402
|
+
{
|
|
1403
|
+
"parameterName": "schema",
|
|
1404
|
+
"parameterTypeTokenRange": {
|
|
1405
|
+
"startIndex": 4,
|
|
1406
|
+
"endIndex": 5
|
|
1407
|
+
},
|
|
1408
|
+
"isOptional": false
|
|
1409
|
+
},
|
|
1410
|
+
{
|
|
1411
|
+
"parameterName": "controlPath",
|
|
1412
|
+
"parameterTypeTokenRange": {
|
|
1413
|
+
"startIndex": 6,
|
|
1414
|
+
"endIndex": 7
|
|
1415
|
+
},
|
|
1416
|
+
"isOptional": false
|
|
1417
|
+
},
|
|
1418
|
+
{
|
|
1419
|
+
"parameterName": "uiCustomMsg",
|
|
1420
|
+
"parameterTypeTokenRange": {
|
|
1421
|
+
"startIndex": 8,
|
|
1422
|
+
"endIndex": 9
|
|
1423
|
+
},
|
|
1424
|
+
"isOptional": true
|
|
1425
|
+
}
|
|
1426
|
+
],
|
|
1427
|
+
"name": "getAnyOfErrorMessage"
|
|
1428
|
+
},
|
|
1335
1429
|
{
|
|
1336
1430
|
"kind": "TypeAlias",
|
|
1337
1431
|
"canonicalReference": "@genesislcap/foundation-forms!GroupRendererOptions:type",
|
|
@@ -870,6 +870,12 @@ export declare enum GenesisType {
|
|
|
870
870
|
RAW = "RAW"
|
|
871
871
|
}
|
|
872
872
|
|
|
873
|
+
/**
|
|
874
|
+
* Computes a human-friendly anyOf error message for a given control path.
|
|
875
|
+
* Prefers UI schema custom message, then JSON schema errorMessage.anyOf, then a constructed fallback.
|
|
876
|
+
*/
|
|
877
|
+
export declare const getAnyOfErrorMessage: (errors: Array<any> | undefined, schema: any, controlPath: string | undefined, uiCustomMsg?: string) => string;
|
|
878
|
+
|
|
873
879
|
/** @internal */
|
|
874
880
|
export declare const getPrefixedForm: (prefix: any) => ViewTemplate<Form, any>;
|
|
875
881
|
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-forms](./foundation-forms.md) > [getAnyOfErrorMessage](./foundation-forms.getanyoferrormessage.md)
|
|
4
|
+
|
|
5
|
+
## getAnyOfErrorMessage() function
|
|
6
|
+
|
|
7
|
+
Computes a human-friendly anyOf error message for a given control path. Prefers UI schema custom message, then JSON schema errorMessage.anyOf, then a constructed fallback.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
getAnyOfErrorMessage: (errors: Array<any> | undefined, schema: any, controlPath: string | undefined, uiCustomMsg?: string) => string
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
<table><thead><tr><th>
|
|
18
|
+
|
|
19
|
+
Parameter
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
</th><th>
|
|
23
|
+
|
|
24
|
+
Type
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
</th><th>
|
|
28
|
+
|
|
29
|
+
Description
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
</th></tr></thead>
|
|
33
|
+
<tbody><tr><td>
|
|
34
|
+
|
|
35
|
+
errors
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
</td><td>
|
|
39
|
+
|
|
40
|
+
Array<any> \| undefined
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
</td><td>
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
</td></tr>
|
|
47
|
+
<tr><td>
|
|
48
|
+
|
|
49
|
+
schema
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
</td><td>
|
|
53
|
+
|
|
54
|
+
any
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
</td><td>
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
</td></tr>
|
|
61
|
+
<tr><td>
|
|
62
|
+
|
|
63
|
+
controlPath
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
</td><td>
|
|
67
|
+
|
|
68
|
+
string \| undefined
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
</td><td>
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
</td></tr>
|
|
75
|
+
<tr><td>
|
|
76
|
+
|
|
77
|
+
uiCustomMsg
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
</td><td>
|
|
81
|
+
|
|
82
|
+
string
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
</td><td>
|
|
86
|
+
|
|
87
|
+
_(Optional)_
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
</td></tr>
|
|
91
|
+
</tbody></table>
|
|
92
|
+
|
|
93
|
+
**Returns:**
|
|
94
|
+
|
|
95
|
+
string
|
|
96
|
+
|
|
@@ -56,6 +56,17 @@ Description
|
|
|
56
56
|
</th></tr></thead>
|
|
57
57
|
<tbody><tr><td>
|
|
58
58
|
|
|
59
|
+
[getAnyOfErrorMessage(errors, schema, controlPath, uiCustomMsg)](./foundation-forms.getanyoferrormessage.md)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
</td><td>
|
|
63
|
+
|
|
64
|
+
Computes a human-friendly anyOf error message for a given control path. Prefers UI schema custom message, then JSON schema errorMessage.anyOf, then a constructed fallback.
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
</td></tr>
|
|
68
|
+
<tr><td>
|
|
69
|
+
|
|
59
70
|
[mustMatch(target)](./foundation-forms.mustmatch.md)
|
|
60
71
|
|
|
61
72
|
|
|
@@ -195,6 +195,9 @@ export enum GenesisType {
|
|
|
195
195
|
STRING = "STRING"
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
+
// @public
|
|
199
|
+
export const getAnyOfErrorMessage: (errors: Array<any> | undefined, schema: any, controlPath: string | undefined, uiCustomMsg?: string) => string;
|
|
200
|
+
|
|
198
201
|
// Warning: (ae-internal-missing-underscore) The name "getPrefixedForm" should be prefixed with an underscore because the declaration is marked as @internal
|
|
199
202
|
//
|
|
200
203
|
// @internal (undocumented)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/foundation-forms",
|
|
3
3
|
"description": "Genesis Foundation Forms",
|
|
4
|
-
"version": "14.
|
|
4
|
+
"version": "14.336.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "SEE LICENSE IN license.txt",
|
|
7
7
|
"main": "dist/esm/index.js",
|
|
@@ -48,22 +48,22 @@
|
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@genesislcap/foundation-testing": "14.
|
|
52
|
-
"@genesislcap/genx": "14.
|
|
53
|
-
"@genesislcap/rollup-builder": "14.
|
|
54
|
-
"@genesislcap/ts-builder": "14.
|
|
55
|
-
"@genesislcap/uvu-playwright-builder": "14.
|
|
56
|
-
"@genesislcap/vite-builder": "14.
|
|
57
|
-
"@genesislcap/webpack-builder": "14.
|
|
51
|
+
"@genesislcap/foundation-testing": "14.336.0",
|
|
52
|
+
"@genesislcap/genx": "14.336.0",
|
|
53
|
+
"@genesislcap/rollup-builder": "14.336.0",
|
|
54
|
+
"@genesislcap/ts-builder": "14.336.0",
|
|
55
|
+
"@genesislcap/uvu-playwright-builder": "14.336.0",
|
|
56
|
+
"@genesislcap/vite-builder": "14.336.0",
|
|
57
|
+
"@genesislcap/webpack-builder": "14.336.0",
|
|
58
58
|
"@types/json-schema": "^7.0.11"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@genesislcap/foundation-comms": "14.
|
|
62
|
-
"@genesislcap/foundation-criteria": "14.
|
|
63
|
-
"@genesislcap/foundation-logger": "14.
|
|
64
|
-
"@genesislcap/foundation-notifications": "14.
|
|
65
|
-
"@genesislcap/foundation-ui": "14.
|
|
66
|
-
"@genesislcap/foundation-utils": "14.
|
|
61
|
+
"@genesislcap/foundation-comms": "14.336.0",
|
|
62
|
+
"@genesislcap/foundation-criteria": "14.336.0",
|
|
63
|
+
"@genesislcap/foundation-logger": "14.336.0",
|
|
64
|
+
"@genesislcap/foundation-notifications": "14.336.0",
|
|
65
|
+
"@genesislcap/foundation-ui": "14.336.0",
|
|
66
|
+
"@genesislcap/foundation-utils": "14.336.0",
|
|
67
67
|
"@json-schema-tools/dereferencer": "^1.6.1",
|
|
68
68
|
"@jsonforms/core": "^3.2.1",
|
|
69
69
|
"@microsoft/fast-components": "2.30.6",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"access": "public"
|
|
85
85
|
},
|
|
86
86
|
"customElements": "dist/custom-elements.json",
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "09f36f4cc7b33807ee13f6584b59a757d79ec800"
|
|
88
88
|
}
|