@abgov/jsonforms-components 2.80.0 → 2.81.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/index.esm.js CHANGED
@@ -21169,6 +21169,21 @@ const FullNameDobControl = props => {
21169
21169
  function escapeRegExp(s) {
21170
21170
  return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
21171
21171
  }
21172
+ const NUMERIC_STRING = /^[-+]?(\d+\.?\d*|\.\d+)(e[-+]?\d+)?$/i;
21173
+ /**
21174
+ * A referenced value as a finite number, or undefined. Computed fields store their result as a numeric string, so
21175
+ * those are read as numbers to let one computed field reference another.
21176
+ */
21177
+ function toFiniteNumber(value) {
21178
+ if (typeof value === 'number') {
21179
+ return Number.isFinite(value) ? value : undefined;
21180
+ }
21181
+ if (typeof value === 'string' && NUMERIC_STRING.test(value.trim())) {
21182
+ const parsed = Number(value.trim());
21183
+ return Number.isFinite(parsed) ? parsed : undefined;
21184
+ }
21185
+ return undefined;
21186
+ }
21172
21187
  /**
21173
21188
  * Resolve a JSON Pointer–style scope like "#/properties/x" or "#/properties/arr/c3"
21174
21189
  */
@@ -21237,9 +21252,10 @@ function evaluateSum(scope, data, opts) {
21237
21252
  for (const row of cur) {
21238
21253
  if (row == null || typeof row !== 'object') continue;
21239
21254
  const v = row[colKey];
21240
- if (typeof v === 'number' && Number.isFinite(v)) {
21255
+ const num = toFiniteNumber(v);
21256
+ if (num !== undefined) {
21241
21257
  anyValue = true;
21242
- sum += v;
21258
+ sum += num;
21243
21259
  } else if (v !== undefined && v !== null) {
21244
21260
  anyMissing = true;
21245
21261
  }
@@ -21299,8 +21315,8 @@ function evaluateExpression(expression, data, opts) {
21299
21315
  let anyValuePresent = false;
21300
21316
  uniqueScopes.forEach((scope, idx) => {
21301
21317
  const normalized = scope.replace(/^#\/(properties\/)?/, '#/properties/');
21302
- const val = resolveScope(scope, data);
21303
- if (typeof val === 'number' && Number.isFinite(val)) {
21318
+ const val = toFiniteNumber(resolveScope(scope, data));
21319
+ if (val !== undefined) {
21304
21320
  anyValuePresent = true;
21305
21321
  const varName = `v${idx}`;
21306
21322
  vars[varName] = val;
@@ -21396,7 +21412,9 @@ const GoACalculation = props => {
21396
21412
  });
21397
21413
  useEffect(() => {
21398
21414
  if (computedValue !== undefined && typeof handleChange === 'function' && path) {
21399
- handleChange(path, computedValue);
21415
+ // Computed fields are declared as strings (the tester requires it), so a number would fail validation and the
21416
+ // page could never be completed or submitted.
21417
+ handleChange(path, String(computedValue));
21400
21418
  }
21401
21419
  }, [computedValue, handleChange, path]);
21402
21420
  const isConfigError = !!error && (error.toLowerCase().includes('invalid scope') || error.toLowerCase().includes('expression syntax'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "2.80.0",
3
+ "version": "2.81.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Government of Alberta - React renderers for JSON Forms based on the design system.",
6
6
  "repository": "https://github.com/GovAlta/adsp-monorepo",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": "1.0.0",
3
- "generatedAt": "2026-10-29T22:19:01.705Z",
4
- "sourceCommit": "b812ba1920ec643624ffce4c38c6bd71bf5ef933",
3
+ "generatedAt": "2026-10-29T22:49:15.258Z",
4
+ "sourceCommit": "9af2e48b5da50c3da9f7c86a79bcdcecee35ce31",
5
5
  "sourcePath": "libs/jsonforms-components/src/index.ts",
6
6
  "rendererCount": 23,
7
7
  "renderers": [