@genesislcap/foundation-forms 15.23.1 → 15.23.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.
@@ -2817,6 +2817,31 @@
2817
2817
  "default": "false",
2818
2818
  "description": "`control` is rebuilt from scratch on every JSONForms state change (every\nkeystroke, validation pass, async default-data update), so `controlChanged`\nfires repeatedly throughout the form's life — not just on first paint.\nApplying `activeCategory` each time would yank the user back to the\nconfigured tab mid-edit (and unmount the open panel). This flag ensures the\ninitial tab is applied once; thereafter the user's own navigation wins."
2819
2819
  },
2820
+ {
2821
+ "kind": "field",
2822
+ "name": "lastErrors",
2823
+ "type": {
2824
+ "text": "ErrorObject[] | undefined"
2825
+ },
2826
+ "privacy": "private"
2827
+ },
2828
+ {
2829
+ "kind": "field",
2830
+ "name": "lastAdditionalErrors",
2831
+ "type": {
2832
+ "text": "ErrorObject[] | undefined"
2833
+ },
2834
+ "privacy": "private"
2835
+ },
2836
+ {
2837
+ "kind": "field",
2838
+ "name": "cachedErrorScopes",
2839
+ "type": {
2840
+ "text": "string[]"
2841
+ },
2842
+ "privacy": "private",
2843
+ "default": "[]"
2844
+ },
2820
2845
  {
2821
2846
  "kind": "method",
2822
2847
  "name": "controlChanged"
@@ -2866,6 +2891,25 @@
2866
2891
  }
2867
2892
  }
2868
2893
  ]
2894
+ },
2895
+ {
2896
+ "kind": "method",
2897
+ "name": "getErrorScopes",
2898
+ "privacy": "private",
2899
+ "return": {
2900
+ "type": {
2901
+ "text": "string[]"
2902
+ }
2903
+ },
2904
+ "parameters": [
2905
+ {
2906
+ "name": "core",
2907
+ "type": {
2908
+ "text": "JsonFormsCore"
2909
+ }
2910
+ }
2911
+ ],
2912
+ "description": "`hasCategoryError` is called once per tab per render pass, so recomputing\nscopes N times would repeat the same array-merge + regex work. JSONForms\nkeeps the `errors`/`additionalErrors` array references stable across\nrenders unless validation actually re-runs, so reference-equality caching\nis enough to collapse the per-render cost to a single computation."
2869
2913
  }
2870
2914
  ],
2871
2915
  "superclass": {
@@ -4868,6 +4912,43 @@
4868
4912
  "module": "src/jsonforms/renderers/CategorizationWrapperRenderer.ts"
4869
4913
  }
4870
4914
  },
4915
+ {
4916
+ "kind": "field",
4917
+ "name": "lastErrors",
4918
+ "type": {
4919
+ "text": "ErrorObject[] | undefined"
4920
+ },
4921
+ "privacy": "private",
4922
+ "inheritedFrom": {
4923
+ "name": "CategorizationWrapper",
4924
+ "module": "src/jsonforms/renderers/CategorizationWrapperRenderer.ts"
4925
+ }
4926
+ },
4927
+ {
4928
+ "kind": "field",
4929
+ "name": "lastAdditionalErrors",
4930
+ "type": {
4931
+ "text": "ErrorObject[] | undefined"
4932
+ },
4933
+ "privacy": "private",
4934
+ "inheritedFrom": {
4935
+ "name": "CategorizationWrapper",
4936
+ "module": "src/jsonforms/renderers/CategorizationWrapperRenderer.ts"
4937
+ }
4938
+ },
4939
+ {
4940
+ "kind": "field",
4941
+ "name": "cachedErrorScopes",
4942
+ "type": {
4943
+ "text": "string[]"
4944
+ },
4945
+ "privacy": "private",
4946
+ "default": "[]",
4947
+ "inheritedFrom": {
4948
+ "name": "CategorizationWrapper",
4949
+ "module": "src/jsonforms/renderers/CategorizationWrapperRenderer.ts"
4950
+ }
4951
+ },
4871
4952
  {
4872
4953
  "kind": "method",
4873
4954
  "name": "controlChanged",
@@ -4933,6 +5014,29 @@
4933
5014
  "name": "CategorizationWrapper",
4934
5015
  "module": "src/jsonforms/renderers/CategorizationWrapperRenderer.ts"
4935
5016
  }
5017
+ },
5018
+ {
5019
+ "kind": "method",
5020
+ "name": "getErrorScopes",
5021
+ "privacy": "private",
5022
+ "return": {
5023
+ "type": {
5024
+ "text": "string[]"
5025
+ }
5026
+ },
5027
+ "parameters": [
5028
+ {
5029
+ "name": "core",
5030
+ "type": {
5031
+ "text": "JsonFormsCore"
5032
+ }
5033
+ }
5034
+ ],
5035
+ "description": "`hasCategoryError` is called once per tab per render pass, so recomputing\nscopes N times would repeat the same array-merge + regex work. JSONForms\nkeeps the `errors`/`additionalErrors` array references stable across\nrenders unless validation actually re-runs, so reference-equality caching\nis enough to collapse the per-render cost to a single computation.",
5036
+ "inheritedFrom": {
5037
+ "name": "CategorizationWrapper",
5038
+ "module": "src/jsonforms/renderers/CategorizationWrapperRenderer.ts"
5039
+ }
4936
5040
  }
4937
5041
  ],
4938
5042
  "attributes": [
@@ -26,9 +26,20 @@ export declare class CategorizationWrapper extends FASTElement {
26
26
  * initial tab is applied once; thereafter the user's own navigation wins.
27
27
  */
28
28
  private hasAppliedActiveCategory;
29
+ private lastErrors?;
30
+ private lastAdditionalErrors?;
31
+ private cachedErrorScopes;
29
32
  controlChanged(): void;
30
33
  isMounted(index: number): boolean;
31
34
  handleTabChange(event: Event): void;
32
35
  hasCategoryError(categoryIndex: number): boolean;
36
+ /**
37
+ * `hasCategoryError` is called once per tab per render pass, so recomputing
38
+ * scopes N times would repeat the same array-merge + regex work. JSONForms
39
+ * keeps the `errors`/`additionalErrors` array references stable across
40
+ * renders unless validation actually re-runs, so reference-equality caching
41
+ * is enough to collapse the per-render cost to a single computation.
42
+ */
43
+ private getErrorScopes;
33
44
  }
34
45
  //# sourceMappingURL=CategorizationWrapperRenderer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CategorizationWrapperRenderer.d.ts","sourceRoot":"","sources":["../../../../src/jsonforms/renderers/CategorizationWrapperRenderer.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,WAAW,EAIZ,MAAM,yBAAyB,CAAC;AAEjC,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;IAEzC,cAAc;IAUd,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAIjC,eAAe,CAAC,KAAK,EAAE,KAAK;IAQ5B,gBAAgB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO;CAQjD"}
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"}
@@ -103,6 +103,7 @@ let CategorizationWrapper = class CategorizationWrapper extends FASTElement {
103
103
  * initial tab is applied once; thereafter the user's own navigation wins.
104
104
  */
105
105
  this.hasAppliedActiveCategory = false;
106
+ this.cachedErrorScopes = [];
106
107
  }
107
108
  controlChanged() {
108
109
  var _a, _b;
@@ -129,13 +130,32 @@ let CategorizationWrapper = class CategorizationWrapper extends FASTElement {
129
130
  this.mountedTabs = new Set(this.mountedTabs).add(index);
130
131
  }
131
132
  hasCategoryError(categoryIndex) {
132
- var _a, _b, _c, _d, _e;
133
- 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)) {
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;
135
+ if (!elements)
134
136
  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);
138
+ if (errorScopes.length === 0)
139
+ return false;
140
+ return uiSchemaHasAnyError(elements[categoryIndex], errorScopes);
141
+ }
142
+ /**
143
+ * `hasCategoryError` is called once per tab per render pass, so recomputing
144
+ * scopes N times would repeat the same array-merge + regex work. JSONForms
145
+ * keeps the `errors`/`additionalErrors` array references stable across
146
+ * renders unless validation actually re-runs, so reference-equality caching
147
+ * is enough to collapse the per-render cost to a single computation.
148
+ */
149
+ getErrorScopes(core) {
150
+ const errors = core === null || core === void 0 ? void 0 : core.errors;
151
+ const additionalErrors = core === null || core === void 0 ? void 0 : core.additionalErrors;
152
+ if (errors === this.lastErrors && additionalErrors === this.lastAdditionalErrors) {
153
+ return this.cachedErrorScopes;
135
154
  }
136
- const category = this.control.uischema.elements[categoryIndex];
137
- const errorScopes = extractErrorScopes(this.form.jsonforms.core.errors);
138
- return uiSchemaHasAnyError(category, errorScopes);
155
+ this.lastErrors = errors;
156
+ this.lastAdditionalErrors = additionalErrors;
157
+ this.cachedErrorScopes = extractErrorScopes([...(errors !== null && errors !== void 0 ? errors : []), ...(additionalErrors !== null && additionalErrors !== void 0 ? additionalErrors : [])]);
158
+ return this.cachedErrorScopes;
139
159
  }
140
160
  };
141
161
  __decorate([
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.23.1",
4
+ "version": "15.23.2",
5
5
  "sideEffects": false,
6
6
  "license": "SEE LICENSE IN license.txt",
7
7
  "main": "dist/esm/index.js",
@@ -59,13 +59,13 @@
59
59
  }
60
60
  },
61
61
  "devDependencies": {
62
- "@genesislcap/foundation-testing": "15.23.1",
63
- "@genesislcap/genx": "15.23.1",
64
- "@genesislcap/rollup-builder": "15.23.1",
65
- "@genesislcap/ts-builder": "15.23.1",
66
- "@genesislcap/uvu-playwright-builder": "15.23.1",
67
- "@genesislcap/vite-builder": "15.23.1",
68
- "@genesislcap/webpack-builder": "15.23.1",
62
+ "@genesislcap/foundation-testing": "15.23.2",
63
+ "@genesislcap/genx": "15.23.2",
64
+ "@genesislcap/rollup-builder": "15.23.2",
65
+ "@genesislcap/ts-builder": "15.23.2",
66
+ "@genesislcap/uvu-playwright-builder": "15.23.2",
67
+ "@genesislcap/vite-builder": "15.23.2",
68
+ "@genesislcap/webpack-builder": "15.23.2",
69
69
  "@types/json-schema": "^7.0.11",
70
70
  "@types/papaparse": "^5.3.14"
71
71
  },
@@ -82,12 +82,12 @@
82
82
  }
83
83
  },
84
84
  "dependencies": {
85
- "@genesislcap/foundation-comms": "15.23.1",
86
- "@genesislcap/foundation-criteria": "15.23.1",
87
- "@genesislcap/foundation-logger": "15.23.1",
88
- "@genesislcap/foundation-notifications": "15.23.1",
89
- "@genesislcap/foundation-ui": "15.23.1",
90
- "@genesislcap/foundation-utils": "15.23.1",
85
+ "@genesislcap/foundation-comms": "15.23.2",
86
+ "@genesislcap/foundation-criteria": "15.23.2",
87
+ "@genesislcap/foundation-logger": "15.23.2",
88
+ "@genesislcap/foundation-notifications": "15.23.2",
89
+ "@genesislcap/foundation-ui": "15.23.2",
90
+ "@genesislcap/foundation-utils": "15.23.2",
91
91
  "@json-schema-tools/dereferencer": "^1.6.1",
92
92
  "@jsonforms/core": "^3.2.1",
93
93
  "@microsoft/fast-components": "2.30.6",