@genesislcap/foundation-forms 14.328.0 → 14.329.0-notifications-icon.2
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 +17 -0
- package/dist/dts/jsonforms/renderers/CategorizationWrapperRenderer.d.ts +1 -0
- package/dist/dts/jsonforms/renderers/CategorizationWrapperRenderer.d.ts.map +1 -1
- package/dist/esm/jsonforms/renderers/CategorizationWrapperRenderer.js +66 -2
- package/package.json +15 -15
|
@@ -1429,6 +1429,23 @@
|
|
|
1429
1429
|
{
|
|
1430
1430
|
"kind": "field",
|
|
1431
1431
|
"name": "control"
|
|
1432
|
+
},
|
|
1433
|
+
{
|
|
1434
|
+
"kind": "method",
|
|
1435
|
+
"name": "hasCategoryError",
|
|
1436
|
+
"return": {
|
|
1437
|
+
"type": {
|
|
1438
|
+
"text": "boolean"
|
|
1439
|
+
}
|
|
1440
|
+
},
|
|
1441
|
+
"parameters": [
|
|
1442
|
+
{
|
|
1443
|
+
"name": "categoryIndex",
|
|
1444
|
+
"type": {
|
|
1445
|
+
"text": "number"
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1448
|
+
]
|
|
1432
1449
|
}
|
|
1433
1450
|
],
|
|
1434
1451
|
"superclass": {
|
|
@@ -3,5 +3,6 @@ export declare const CategorizationWrapperRendererTemplate: (prefix?: string) =>
|
|
|
3
3
|
export declare class CategorizationWrapper extends FASTElement {
|
|
4
4
|
form: any;
|
|
5
5
|
control: any;
|
|
6
|
+
hasCategoryError(categoryIndex: number): boolean;
|
|
6
7
|
}
|
|
7
8
|
//# sourceMappingURL=CategorizationWrapperRenderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CategorizationWrapperRenderer.d.ts","sourceRoot":"","sources":["../../../../src/jsonforms/renderers/CategorizationWrapperRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"CategorizationWrapperRenderer.d.ts","sourceRoot":"","sources":["../../../../src/jsonforms/renderers/CategorizationWrapperRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,WAAW,EAIZ,MAAM,yBAAyB,CAAC;AAIjC,eAAO,MAAM,qCAAqC,GAAI,eAAe,6DA8CpE,CAAC;AAsBF,qBAOa,qBAAsB,SAAQ,WAAW;IACxC,IAAI,MAAC;IACL,OAAO,MAAC;IAEpB,gBAAgB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO;CAQjD"}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { html, css, observable, customElement, FASTElement, repeat } from '@microsoft/fast-element';
|
|
2
|
+
import { html, css, observable, customElement, FASTElement, repeat, when, } from '@microsoft/fast-element';
|
|
3
3
|
export const CategorizationWrapperRendererTemplate = (prefix = 'zero') => html `
|
|
4
4
|
<template>
|
|
5
5
|
<${prefix}-tabs class="tabs-container">
|
|
6
6
|
${repeat((x) => x.control.uischema.elements, html `
|
|
7
|
-
<${prefix}-tab class="tab-control"
|
|
7
|
+
<${prefix}-tab class="tab-control">
|
|
8
|
+
${(x, ctx) => { var _a; return (_a = x.label) !== null && _a !== void 0 ? _a : `Category ${ctx.index + 1}`; }}
|
|
9
|
+
${when((x, ctx) => ctx.parent.hasCategoryError(ctx.index), html `
|
|
10
|
+
<${prefix}-icon class="tab-control-icon" name="circle-exclamation"></${prefix}-icon>
|
|
11
|
+
`)}
|
|
12
|
+
</${prefix}-tab>
|
|
8
13
|
`, { positioning: true })}
|
|
9
14
|
${repeat((x) => x.control.uischema.elements, html `
|
|
10
15
|
<${prefix}-tab-panel class="tab-panel-control">
|
|
@@ -36,6 +41,11 @@ const styles = css `
|
|
|
36
41
|
|
|
37
42
|
.tab-control {
|
|
38
43
|
box-shadow: none;
|
|
44
|
+
|
|
45
|
+
.tab-control-icon {
|
|
46
|
+
margin-left: 3px;
|
|
47
|
+
color: #f9644d;
|
|
48
|
+
}
|
|
39
49
|
}
|
|
40
50
|
|
|
41
51
|
.tab-panel-control {
|
|
@@ -43,6 +53,15 @@ const styles = css `
|
|
|
43
53
|
}
|
|
44
54
|
`;
|
|
45
55
|
let CategorizationWrapper = class CategorizationWrapper extends FASTElement {
|
|
56
|
+
hasCategoryError(categoryIndex) {
|
|
57
|
+
var _a, _b, _c, _d, _e;
|
|
58
|
+
if (!((_c = (_b = (_a = this.form) === null || _a === void 0 ? void 0 : _a.jsonforms) === null || _b === void 0 ? void 0 : _b.core) === null || _c === void 0 ? void 0 : _c.errors) || !((_e = (_d = this.control) === null || _d === void 0 ? void 0 : _d.uischema) === null || _e === void 0 ? void 0 : _e.elements)) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
const category = this.control.uischema.elements[categoryIndex];
|
|
62
|
+
const errorScopes = extractErrorScopes(this.form.jsonforms.core.errors);
|
|
63
|
+
return uiSchemaHasAnyError(category, errorScopes);
|
|
64
|
+
}
|
|
46
65
|
};
|
|
47
66
|
__decorate([
|
|
48
67
|
observable
|
|
@@ -60,3 +79,48 @@ CategorizationWrapper = __decorate([
|
|
|
60
79
|
})
|
|
61
80
|
], CategorizationWrapper);
|
|
62
81
|
export { CategorizationWrapper };
|
|
82
|
+
function uiSchemaHasAnyError(uiSchema, errorScopes) {
|
|
83
|
+
// Direct scope match
|
|
84
|
+
if (typeof uiSchema.scope === 'string' &&
|
|
85
|
+
errorScopes.includes(uiSchema.scope)) {
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
// Check composite children via options.childElements
|
|
89
|
+
const options = uiSchema.options;
|
|
90
|
+
const childElements = options === null || options === void 0 ? void 0 : options.childElements;
|
|
91
|
+
if (Array.isArray(childElements)) {
|
|
92
|
+
for (const child of childElements) {
|
|
93
|
+
if (uiSchemaHasAnyError(child, errorScopes)) {
|
|
94
|
+
return true;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
// Check layout children (elements)
|
|
99
|
+
if (Array.isArray(uiSchema.elements)) {
|
|
100
|
+
for (const el of uiSchema.elements) {
|
|
101
|
+
if (uiSchemaHasAnyError(el, errorScopes)) {
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
function extractErrorScopes(errors) {
|
|
109
|
+
var _a;
|
|
110
|
+
const scopes = new Set();
|
|
111
|
+
for (const error of errors) {
|
|
112
|
+
if (error.keyword === 'required' && ((_a = error.params) === null || _a === void 0 ? void 0 : _a.missingProperty)) {
|
|
113
|
+
const basePath = error.instancePath || '';
|
|
114
|
+
const prop = error.params.missingProperty;
|
|
115
|
+
// Normalize the base path
|
|
116
|
+
const fullPath = basePath === '' ? `#/properties/${prop}` : `#${basePath}/properties/${prop}`;
|
|
117
|
+
scopes.add(fullPath);
|
|
118
|
+
}
|
|
119
|
+
else if (error.instancePath) {
|
|
120
|
+
// Remove leading slash and convert to JSON Pointer path
|
|
121
|
+
const instancePath = `#${error.instancePath.replace(/\//g, '/properties/')}`;
|
|
122
|
+
scopes.add(instancePath);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return Array.from(scopes);
|
|
126
|
+
}
|
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.329.0-notifications-icon.2",
|
|
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.329.0-notifications-icon.2",
|
|
52
|
+
"@genesislcap/genx": "14.329.0-notifications-icon.2",
|
|
53
|
+
"@genesislcap/rollup-builder": "14.329.0-notifications-icon.2",
|
|
54
|
+
"@genesislcap/ts-builder": "14.329.0-notifications-icon.2",
|
|
55
|
+
"@genesislcap/uvu-playwright-builder": "14.329.0-notifications-icon.2",
|
|
56
|
+
"@genesislcap/vite-builder": "14.329.0-notifications-icon.2",
|
|
57
|
+
"@genesislcap/webpack-builder": "14.329.0-notifications-icon.2",
|
|
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.329.0-notifications-icon.2",
|
|
62
|
+
"@genesislcap/foundation-criteria": "14.329.0-notifications-icon.2",
|
|
63
|
+
"@genesislcap/foundation-logger": "14.329.0-notifications-icon.2",
|
|
64
|
+
"@genesislcap/foundation-notifications": "14.329.0-notifications-icon.2",
|
|
65
|
+
"@genesislcap/foundation-ui": "14.329.0-notifications-icon.2",
|
|
66
|
+
"@genesislcap/foundation-utils": "14.329.0-notifications-icon.2",
|
|
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": "d40801bd2aa1571f1b118511c5437c2267b6e211"
|
|
88
88
|
}
|