@genesislcap/foundation-forms 15.57.0 → 15.58.1-FUI-2629.4
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 +1945 -1875
- package/dist/dts/jsonforms/renderers/CategorizationWrapperRenderer.d.ts +10 -0
- package/dist/dts/jsonforms/renderers/CategorizationWrapperRenderer.d.ts.map +1 -1
- package/dist/dts/jsonforms/renderers/VerticalCategorizationWrapperRenderer.d.ts.map +1 -1
- package/dist/esm/jsonforms/renderers/CategorizationWrapperRenderer.js +47 -5
- package/dist/esm/jsonforms/renderers/VerticalCategorizationWrapperRenderer.js +4 -0
- package/package.json +13 -13
|
@@ -17,6 +17,13 @@ export declare class CategorizationWrapper extends FASTElement {
|
|
|
17
17
|
control: any;
|
|
18
18
|
mountedTabs: Set<number>;
|
|
19
19
|
activeTabIndex: number;
|
|
20
|
+
/**
|
|
21
|
+
* Tabs the user has interacted with (focus left a control inside the panel).
|
|
22
|
+
* Field errors only render once touched or after submit; the tab marker follows
|
|
23
|
+
* the same rule so a pristine form does not open with error icons on its tabs.
|
|
24
|
+
*/
|
|
25
|
+
touchedTabs: Set<number>;
|
|
26
|
+
private submittedObserver?;
|
|
20
27
|
/**
|
|
21
28
|
* `control` is rebuilt from scratch on every JSONForms state change (every
|
|
22
29
|
* keystroke, validation pass, async default-data update), so `controlChanged`
|
|
@@ -30,6 +37,9 @@ export declare class CategorizationWrapper extends FASTElement {
|
|
|
30
37
|
private lastAdditionalErrors?;
|
|
31
38
|
private cachedErrorScopes;
|
|
32
39
|
controlChanged(): void;
|
|
40
|
+
connectedCallback(): void;
|
|
41
|
+
disconnectedCallback(): void;
|
|
42
|
+
markTabTouched(index: number): void;
|
|
33
43
|
isMounted(index: number): boolean;
|
|
34
44
|
handleTabChange(event: Event): void;
|
|
35
45
|
hasCategoryError(categoryIndex: number): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CategorizationWrapperRenderer.d.ts","sourceRoot":"","sources":["../../../../src/jsonforms/renderers/CategorizationWrapperRenderer.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,WAAW,
|
|
1
|
+
{"version":3,"file":"CategorizationWrapperRenderer.d.ts","sourceRoot":"","sources":["../../../../src/jsonforms/renderers/CategorizationWrapperRenderer.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,WAAW,EAMZ,MAAM,yBAAyB,CAAC;AAIjC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG9C;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,cAAc,EAAE,MAAM,GAAG,SAAS,EAClC,QAAQ,EAAE,eAAe,EAAE,GAC1B,MAAM,CAKR;AAED,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,eAAe,EAAE,IAAI,EAAE,GAAG,GAAG,MAAM,CAMrF;AAED,eAAO,MAAM,oBAAoB,iDAKhC,CAAC;AAEF,eAAO,MAAM,qCAAqC,GAChD,eAAe,+EAmEhB,CAAC;AAkBF,qBAQa,qBAAsB,SAAQ,WAAW;IACxC,IAAI,MAAC;IACL,OAAO,MAAC;IACR,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAgB;IACxC,cAAc,EAAE,MAAM,CAAK;IAEvC;;;;OAIG;IACS,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAa;IACjD,OAAO,CAAC,iBAAiB,CAAC,CAAkB;IAE5C;;;;;;;OAOG;IACH,OAAO,CAAC,wBAAwB,CAAS;IACzC,OAAO,CAAC,UAAU,CAAC,CAAgB;IACnC,OAAO,CAAC,oBAAoB,CAAC,CAAgB;IAC7C,OAAO,CAAC,iBAAiB,CAAgB;IAEzC,cAAc;IAUd,iBAAiB;IAejB,oBAAoB;IAMpB,cAAc,CAAC,KAAK,EAAE,MAAM;IAK5B,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAIjC,eAAe,CAAC,KAAK,EAAE,KAAK;IAQ5B,gBAAgB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO;IAShD;;;;;;OAMG;IACH,OAAO,CAAC,cAAc;CAWvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VerticalCategorizationWrapperRenderer.d.ts","sourceRoot":"","sources":["../../../../src/jsonforms/renderers/VerticalCategorizationWrapperRenderer.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,qBAAqB,EAA4B,MAAM,iCAAiC,CAAC;AAElG,eAAO,MAAM,6CAA6C,GACxD,eAAe,
|
|
1
|
+
{"version":3,"file":"VerticalCategorizationWrapperRenderer.d.ts","sourceRoot":"","sources":["../../../../src/jsonforms/renderers/VerticalCategorizationWrapperRenderer.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,qBAAqB,EAA4B,MAAM,iCAAiC,CAAC;AAElG,eAAO,MAAM,6CAA6C,GACxD,eAAe,uFA8EhB,CAAC;AAmEF,qBAQa,6BAA8B,SAAQ,qBAAqB;IAChE,MAAM,EAAE,MAAM,CAAM;IAE1B,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAMjD,iBAAiB;CAIlB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { html, css, observable, customElement, FASTElement, repeat, when, } from '@microsoft/fast-element';
|
|
2
|
+
import { html, css, observable, customElement, FASTElement, repeat, Observable, when, defaultExecutionContext, } from '@microsoft/fast-element';
|
|
3
3
|
import { classNames } from '@microsoft/fast-web-utilities';
|
|
4
4
|
import { extractErrorScopes, uiSchemaHasAnyError } from '../../utils/schema-utils';
|
|
5
5
|
/**
|
|
@@ -50,7 +50,13 @@ export const CategorizationWrapperRendererTemplate = (prefix = 'zero') => html `
|
|
|
50
50
|
</${prefix}-tab>
|
|
51
51
|
`, { positioning: true })}
|
|
52
52
|
${repeat((x) => x.control.uischema.elements, html `
|
|
53
|
-
<${prefix}-tab-panel
|
|
53
|
+
<${prefix}-tab-panel
|
|
54
|
+
class="tab-panel-control"
|
|
55
|
+
@focusout=${(x, ctx) => {
|
|
56
|
+
ctx.parent.markTabTouched(ctx.index);
|
|
57
|
+
return true;
|
|
58
|
+
}}
|
|
59
|
+
>
|
|
54
60
|
${when((x, ctx) => ctx.parent.isMounted(ctx.index), html `
|
|
55
61
|
${repeat((x) => x.options.childElements, html `
|
|
56
62
|
<dispatch-renderer
|
|
@@ -94,6 +100,12 @@ let CategorizationWrapper = class CategorizationWrapper extends FASTElement {
|
|
|
94
100
|
super(...arguments);
|
|
95
101
|
this.mountedTabs = new Set([0]);
|
|
96
102
|
this.activeTabIndex = 0;
|
|
103
|
+
/**
|
|
104
|
+
* Tabs the user has interacted with (focus left a control inside the panel).
|
|
105
|
+
* Field errors only render once touched or after submit; the tab marker follows
|
|
106
|
+
* the same rule so a pristine form does not open with error icons on its tabs.
|
|
107
|
+
*/
|
|
108
|
+
this.touchedTabs = new Set();
|
|
97
109
|
/**
|
|
98
110
|
* `control` is rebuilt from scratch on every JSONForms state change (every
|
|
99
111
|
* keystroke, validation pass, async default-data update), so `controlChanged`
|
|
@@ -117,6 +129,31 @@ let CategorizationWrapper = class CategorizationWrapper extends FASTElement {
|
|
|
117
129
|
this.activeTabIndex = resolveActiveCategoryIndex(activeCategory, (_b = uischema === null || uischema === void 0 ? void 0 : uischema.elements) !== null && _b !== void 0 ? _b : []);
|
|
118
130
|
this.mountedTabs = new Set([this.activeTabIndex]);
|
|
119
131
|
}
|
|
132
|
+
connectedCallback() {
|
|
133
|
+
super.connectedCallback();
|
|
134
|
+
// A form reset clears `submitted` (and every field's `touched`), so clear the
|
|
135
|
+
// tab markers with it.
|
|
136
|
+
const observer = Observable.binding((x) => { var _a; return (_a = x.form) === null || _a === void 0 ? void 0 : _a.submitted; }, {
|
|
137
|
+
handleChange: () => {
|
|
138
|
+
if (!observer.observe(this, defaultExecutionContext)) {
|
|
139
|
+
this.touchedTabs = new Set();
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
this.submittedObserver = observer;
|
|
144
|
+
observer.observe(this, defaultExecutionContext);
|
|
145
|
+
}
|
|
146
|
+
disconnectedCallback() {
|
|
147
|
+
var _a;
|
|
148
|
+
super.disconnectedCallback();
|
|
149
|
+
(_a = this.submittedObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
150
|
+
this.submittedObserver = undefined;
|
|
151
|
+
}
|
|
152
|
+
markTabTouched(index) {
|
|
153
|
+
if (this.touchedTabs.has(index))
|
|
154
|
+
return;
|
|
155
|
+
this.touchedTabs = new Set(this.touchedTabs).add(index);
|
|
156
|
+
}
|
|
120
157
|
isMounted(index) {
|
|
121
158
|
return this.mountedTabs.has(index);
|
|
122
159
|
}
|
|
@@ -130,11 +167,13 @@ let CategorizationWrapper = class CategorizationWrapper extends FASTElement {
|
|
|
130
167
|
this.mountedTabs = new Set(this.mountedTabs).add(index);
|
|
131
168
|
}
|
|
132
169
|
hasCategoryError(categoryIndex) {
|
|
133
|
-
var _a, _b, _c, _d;
|
|
134
|
-
|
|
170
|
+
var _a, _b, _c, _d, _e;
|
|
171
|
+
if (!((_a = this.form) === null || _a === void 0 ? void 0 : _a.submitted) && !this.touchedTabs.has(categoryIndex))
|
|
172
|
+
return false;
|
|
173
|
+
const elements = (_c = (_b = this.control) === null || _b === void 0 ? void 0 : _b.uischema) === null || _c === void 0 ? void 0 : _c.elements;
|
|
135
174
|
if (!elements)
|
|
136
175
|
return false;
|
|
137
|
-
const errorScopes = this.getErrorScopes((
|
|
176
|
+
const errorScopes = this.getErrorScopes((_e = (_d = this.form) === null || _d === void 0 ? void 0 : _d.jsonforms) === null || _e === void 0 ? void 0 : _e.core);
|
|
138
177
|
if (errorScopes.length === 0)
|
|
139
178
|
return false;
|
|
140
179
|
return uiSchemaHasAnyError(elements[categoryIndex], errorScopes);
|
|
@@ -170,6 +209,9 @@ __decorate([
|
|
|
170
209
|
__decorate([
|
|
171
210
|
observable
|
|
172
211
|
], CategorizationWrapper.prototype, "activeTabIndex", void 0);
|
|
212
|
+
__decorate([
|
|
213
|
+
observable
|
|
214
|
+
], CategorizationWrapper.prototype, "touchedTabs", void 0);
|
|
173
215
|
CategorizationWrapper = __decorate([
|
|
174
216
|
customElement({
|
|
175
217
|
name: 'categorization-wrapper',
|
|
@@ -30,6 +30,10 @@ export const VerticalCategorizationWrapperRendererTemplate = (prefix = 'zero') =
|
|
|
30
30
|
`, { positioning: true })}
|
|
31
31
|
${repeat((x) => x.control.uischema.elements, html `
|
|
32
32
|
<${prefix}-tab-panel
|
|
33
|
+
@focusout=${(x, ctx) => {
|
|
34
|
+
ctx.parent.markTabTouched(ctx.index);
|
|
35
|
+
return true;
|
|
36
|
+
}}
|
|
33
37
|
class="${(x, ctx) => {
|
|
34
38
|
var _a, _b, _c;
|
|
35
39
|
const custom = computeCategoryClassName(x, (_c = (_b = (_a = ctx.parent.form) === null || _a === void 0 ? void 0 : _a.jsonforms) === null || _b === void 0 ? void 0 : _b.core) === null || _c === void 0 ? void 0 : _c.data);
|
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.
|
|
4
|
+
"version": "15.58.1-FUI-2629.4",
|
|
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.
|
|
60
|
-
"@genesislcap/genx": "15.
|
|
61
|
-
"@genesislcap/ts-builder": "15.
|
|
62
|
-
"@genesislcap/uvu-playwright-builder": "15.
|
|
63
|
-
"@genesislcap/vite-builder": "15.
|
|
64
|
-
"@genesislcap/webpack-builder": "15.
|
|
59
|
+
"@genesislcap/foundation-testing": "15.58.1-FUI-2629.4",
|
|
60
|
+
"@genesislcap/genx": "15.58.1-FUI-2629.4",
|
|
61
|
+
"@genesislcap/ts-builder": "15.58.1-FUI-2629.4",
|
|
62
|
+
"@genesislcap/uvu-playwright-builder": "15.58.1-FUI-2629.4",
|
|
63
|
+
"@genesislcap/vite-builder": "15.58.1-FUI-2629.4",
|
|
64
|
+
"@genesislcap/webpack-builder": "15.58.1-FUI-2629.4",
|
|
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.
|
|
82
|
-
"@genesislcap/foundation-criteria": "15.
|
|
83
|
-
"@genesislcap/foundation-logger": "15.
|
|
84
|
-
"@genesislcap/foundation-notifications": "15.
|
|
85
|
-
"@genesislcap/foundation-ui": "15.
|
|
86
|
-
"@genesislcap/foundation-utils": "15.
|
|
81
|
+
"@genesislcap/foundation-comms": "15.58.1-FUI-2629.4",
|
|
82
|
+
"@genesislcap/foundation-criteria": "15.58.1-FUI-2629.4",
|
|
83
|
+
"@genesislcap/foundation-logger": "15.58.1-FUI-2629.4",
|
|
84
|
+
"@genesislcap/foundation-notifications": "15.58.1-FUI-2629.4",
|
|
85
|
+
"@genesislcap/foundation-ui": "15.58.1-FUI-2629.4",
|
|
86
|
+
"@genesislcap/foundation-utils": "15.58.1-FUI-2629.4",
|
|
87
87
|
"@json-schema-tools/dereferencer": "^1.6.1",
|
|
88
88
|
"@jsonforms/core": "^3.2.1",
|
|
89
89
|
"@microsoft/fast-components": "2.30.6",
|