@genesislcap/foundation-forms 15.58.1 → 15.59.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.
@@ -2813,6 +2813,23 @@
2813
2813
  },
2814
2814
  "default": "0"
2815
2815
  },
2816
+ {
2817
+ "kind": "field",
2818
+ "name": "touchedTabs",
2819
+ "type": {
2820
+ "text": "Set<number>"
2821
+ },
2822
+ "default": "new Set()",
2823
+ "description": "Tabs the user has interacted with (focus left a control inside the panel).\nField errors only render once touched or after submit; the tab marker follows\nthe same rule so a pristine form does not open with error icons on its tabs."
2824
+ },
2825
+ {
2826
+ "kind": "field",
2827
+ "name": "submittedObserver",
2828
+ "type": {
2829
+ "text": "BindingObserver | undefined"
2830
+ },
2831
+ "privacy": "private"
2832
+ },
2816
2833
  {
2817
2834
  "kind": "field",
2818
2835
  "name": "hasAppliedActiveCategory",
@@ -2852,6 +2869,18 @@
2852
2869
  "kind": "method",
2853
2870
  "name": "controlChanged"
2854
2871
  },
2872
+ {
2873
+ "kind": "method",
2874
+ "name": "markTabTouched",
2875
+ "parameters": [
2876
+ {
2877
+ "name": "index",
2878
+ "type": {
2879
+ "text": "number"
2880
+ }
2881
+ }
2882
+ ]
2883
+ },
2855
2884
  {
2856
2885
  "kind": "method",
2857
2886
  "name": "isMounted",
@@ -4941,6 +4970,31 @@
4941
4970
  "module": "src/jsonforms/renderers/CategorizationWrapperRenderer.ts"
4942
4971
  }
4943
4972
  },
4973
+ {
4974
+ "kind": "field",
4975
+ "name": "touchedTabs",
4976
+ "type": {
4977
+ "text": "Set<number>"
4978
+ },
4979
+ "default": "new Set()",
4980
+ "description": "Tabs the user has interacted with (focus left a control inside the panel).\nField errors only render once touched or after submit; the tab marker follows\nthe same rule so a pristine form does not open with error icons on its tabs.",
4981
+ "inheritedFrom": {
4982
+ "name": "CategorizationWrapper",
4983
+ "module": "src/jsonforms/renderers/CategorizationWrapperRenderer.ts"
4984
+ }
4985
+ },
4986
+ {
4987
+ "kind": "field",
4988
+ "name": "submittedObserver",
4989
+ "type": {
4990
+ "text": "BindingObserver | undefined"
4991
+ },
4992
+ "privacy": "private",
4993
+ "inheritedFrom": {
4994
+ "name": "CategorizationWrapper",
4995
+ "module": "src/jsonforms/renderers/CategorizationWrapperRenderer.ts"
4996
+ }
4997
+ },
4944
4998
  {
4945
4999
  "kind": "field",
4946
5000
  "name": "hasAppliedActiveCategory",
@@ -5000,6 +5054,22 @@
5000
5054
  "module": "src/jsonforms/renderers/CategorizationWrapperRenderer.ts"
5001
5055
  }
5002
5056
  },
5057
+ {
5058
+ "kind": "method",
5059
+ "name": "markTabTouched",
5060
+ "parameters": [
5061
+ {
5062
+ "name": "index",
5063
+ "type": {
5064
+ "text": "number"
5065
+ }
5066
+ }
5067
+ ],
5068
+ "inheritedFrom": {
5069
+ "name": "CategorizationWrapper",
5070
+ "module": "src/jsonforms/renderers/CategorizationWrapperRenderer.ts"
5071
+ }
5072
+ },
5003
5073
  {
5004
5074
  "kind": "method",
5005
5075
  "name": "isMounted",
@@ -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,EAIZ,MAAM,yBAAyB,CAAC;AAGjC,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,+EA6DhB,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;;;;;;;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,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAIjC,eAAe,CAAC,KAAK,EAAE,KAAK;IAQ5B,gBAAgB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO;IAQhD;;;;;;OAMG;IACH,OAAO,CAAC,cAAc;CAWvB"}
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,uFA0EhB,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
+ {"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 class="tab-panel-control">
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
- const elements = (_b = (_a = this.control) === null || _a === void 0 ? void 0 : _a.uischema) === null || _b === void 0 ? void 0 : _b.elements;
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((_d = (_c = this.form) === null || _c === void 0 ? void 0 : _c.jsonforms) === null || _d === void 0 ? void 0 : _d.core);
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.58.1",
4
+ "version": "15.59.0",
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.58.1",
60
- "@genesislcap/genx": "15.58.1",
61
- "@genesislcap/ts-builder": "15.58.1",
62
- "@genesislcap/uvu-playwright-builder": "15.58.1",
63
- "@genesislcap/vite-builder": "15.58.1",
64
- "@genesislcap/webpack-builder": "15.58.1",
59
+ "@genesislcap/foundation-testing": "15.59.0",
60
+ "@genesislcap/genx": "15.59.0",
61
+ "@genesislcap/ts-builder": "15.59.0",
62
+ "@genesislcap/uvu-playwright-builder": "15.59.0",
63
+ "@genesislcap/vite-builder": "15.59.0",
64
+ "@genesislcap/webpack-builder": "15.59.0",
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.58.1",
82
- "@genesislcap/foundation-criteria": "15.58.1",
83
- "@genesislcap/foundation-logger": "15.58.1",
84
- "@genesislcap/foundation-notifications": "15.58.1",
85
- "@genesislcap/foundation-ui": "15.58.1",
86
- "@genesislcap/foundation-utils": "15.58.1",
81
+ "@genesislcap/foundation-comms": "15.59.0",
82
+ "@genesislcap/foundation-criteria": "15.59.0",
83
+ "@genesislcap/foundation-logger": "15.59.0",
84
+ "@genesislcap/foundation-notifications": "15.59.0",
85
+ "@genesislcap/foundation-ui": "15.59.0",
86
+ "@genesislcap/foundation-utils": "15.59.0",
87
87
  "@json-schema-tools/dereferencer": "^1.6.1",
88
88
  "@jsonforms/core": "^3.2.1",
89
89
  "@microsoft/fast-components": "2.30.6",