@fogpipe/forma-core 0.10.2 → 0.10.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.
@@ -4,6 +4,8 @@
4
4
  * Core form logic engines for visibility, validation, calculation, etc.
5
5
  */
6
6
  export { calculate, calculateWithErrors, calculateField, getFormattedValue, } from "./calculate.js";
7
+ export { formatValue, isValidFormat, parseDecimalFormat, SUPPORTED_FORMATS, DECIMAL_FORMAT_PATTERN, } from "../format/index.js";
8
+ export type { FormatOptions, SupportedFormat } from "../format/index.js";
7
9
  export { getVisibility, isFieldVisible, getPageVisibility, } from "./visibility.js";
8
10
  export type { VisibilityOptions, } from "./visibility.js";
9
11
  export { getRequired, isRequired, } from "./required.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/engine/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,cAAc,EACd,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,aAAa,EACb,cAAc,EACd,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EACV,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,WAAW,EACX,UAAU,GACX,MAAM,eAAe,CAAC;AAEvB,YAAY,EACV,eAAe,GAChB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,UAAU,EACV,SAAS,GACV,MAAM,cAAc,CAAC;AAEtB,YAAY,EACV,cAAc,GACf,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,QAAQ,EACR,mBAAmB,GACpB,MAAM,eAAe,CAAC;AAEvB,YAAY,EACV,eAAe,GAChB,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/engine/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,cAAc,EACd,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,oBAAoB,CAAC;AAE5B,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGzE,OAAO,EACL,aAAa,EACb,cAAc,EACd,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EACV,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,WAAW,EACX,UAAU,GACX,MAAM,eAAe,CAAC;AAEvB,YAAY,EACV,eAAe,GAChB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,UAAU,EACV,SAAS,GACV,MAAM,cAAc,CAAC;AAEtB,YAAY,EACV,cAAc,GACf,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,QAAQ,EACR,mBAAmB,GACpB,MAAM,eAAe,CAAC;AAEvB,YAAY,EACV,eAAe,GAChB,MAAM,eAAe,CAAC"}
@@ -1,7 +1,10 @@
1
1
  import {
2
+ DECIMAL_FORMAT_PATTERN,
3
+ SUPPORTED_FORMATS,
2
4
  calculate,
3
5
  calculateField,
4
6
  calculateWithErrors,
7
+ formatValue,
5
8
  getEnabled,
6
9
  getFormattedValue,
7
10
  getPageVisibility,
@@ -10,14 +13,19 @@ import {
10
13
  isEnabled,
11
14
  isFieldVisible,
12
15
  isRequired,
16
+ isValidFormat,
17
+ parseDecimalFormat,
13
18
  validate,
14
19
  validateSingleField
15
- } from "../chunk-KUZ3NPM4.js";
20
+ } from "../chunk-7ANLNW3X.js";
16
21
  import "../chunk-U2OXXFEH.js";
17
22
  export {
23
+ DECIMAL_FORMAT_PATTERN,
24
+ SUPPORTED_FORMATS,
18
25
  calculate,
19
26
  calculateField,
20
27
  calculateWithErrors,
28
+ formatValue,
21
29
  getEnabled,
22
30
  getFormattedValue,
23
31
  getPageVisibility,
@@ -26,6 +34,8 @@ export {
26
34
  isEnabled,
27
35
  isFieldVisible,
28
36
  isRequired,
37
+ isValidFormat,
38
+ parseDecimalFormat,
29
39
  validate,
30
40
  validateSingleField
31
41
  };
@@ -1 +1 @@
1
- {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/engine/validate.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EACV,KAAK,EAIL,gBAAgB,EAChB,UAAU,EAEX,MAAM,aAAa,CAAC;AASrB,MAAM,WAAW,eAAe;IAC9B,qCAAqC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,gCAAgC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,mDAAmD;IACnD,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,QAAQ,CACtB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,IAAI,EAAE,KAAK,EACX,OAAO,GAAE,eAAoB,GAC5B,gBAAgB,CA6ClB;AA2fD;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,IAAI,EAAE,KAAK,GACV,UAAU,EAAE,CAqBd"}
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/engine/validate.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EACV,KAAK,EAIL,gBAAgB,EAChB,UAAU,EAEX,MAAM,aAAa,CAAC;AASrB,MAAM,WAAW,eAAe;IAC9B,qCAAqC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,gCAAgC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,mDAAmD;IACnD,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,QAAQ,CACtB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,IAAI,EAAE,KAAK,EACX,OAAO,GAAE,eAAoB,GAC5B,gBAAgB,CA6ClB;AAkiBD;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,IAAI,EAAE,KAAK,GACV,UAAU,EAAE,CAqBd"}
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Format utilities for computed field values
3
+ *
4
+ * Provides constants, validation helpers, and formatting functions
5
+ * for computed field format specifications.
6
+ */
7
+ /**
8
+ * Supported format specifiers (excluding decimal which uses pattern)
9
+ */
10
+ export declare const SUPPORTED_FORMATS: readonly ["currency", "percent", "date", "datetime"];
11
+ /**
12
+ * Pattern for decimal format: decimal(N) where N is number of decimal places
13
+ */
14
+ export declare const DECIMAL_FORMAT_PATTERN: RegExp;
15
+ /**
16
+ * Supported format type (excluding decimal pattern)
17
+ */
18
+ export type SupportedFormat = (typeof SUPPORTED_FORMATS)[number];
19
+ /**
20
+ * Options for value formatting
21
+ */
22
+ export interface FormatOptions {
23
+ /** Locale for number/date formatting (default: "en-US") */
24
+ locale?: string;
25
+ /** Currency code for currency format (default: "USD") */
26
+ currency?: string;
27
+ /** String to display for null/undefined values (default: returns String(value)) */
28
+ nullDisplay?: string;
29
+ }
30
+ /**
31
+ * Check if a format string is valid
32
+ *
33
+ * Valid formats:
34
+ * - "currency"
35
+ * - "percent"
36
+ * - "date"
37
+ * - "datetime"
38
+ * - "decimal(N)" where N is a non-negative integer
39
+ *
40
+ * @param format - Format string to validate
41
+ * @returns True if format is valid
42
+ */
43
+ export declare function isValidFormat(format: string): boolean;
44
+ /**
45
+ * Parse decimal format and extract precision
46
+ *
47
+ * @param format - Format string (e.g., "decimal(2)")
48
+ * @returns Number of decimal places, or null if not a decimal format
49
+ */
50
+ export declare function parseDecimalFormat(format: string): number | null;
51
+ /**
52
+ * Format a value according to a format specification
53
+ *
54
+ * Supported formats:
55
+ * - decimal(n) - Number with n decimal places
56
+ * - currency - Number formatted as currency
57
+ * - percent - Number formatted as percentage
58
+ * - date - Date formatted as local date string
59
+ * - datetime - Date formatted as local date/time string
60
+ * - (none/unknown) - Default string conversion
61
+ *
62
+ * @param value - Value to format
63
+ * @param format - Format specification
64
+ * @param options - Formatting options
65
+ * @returns Formatted string
66
+ *
67
+ * @example
68
+ * formatValue(1234.567, "decimal(2)") // "1234.57"
69
+ * formatValue(1234.5, "currency") // "$1,234.50"
70
+ * formatValue(0.156, "percent") // "15.6%"
71
+ * formatValue(null, undefined, { nullDisplay: "—" }) // "—"
72
+ */
73
+ export declare function formatValue(value: unknown, format?: string, options?: FormatOptions): string;
74
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/format/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;GAEG;AACH,eAAO,MAAM,iBAAiB,sDAKpB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,sBAAsB,QAAuB,CAAC;AAM3D;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,2DAA2D;IAC3D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yDAAyD;IACzD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mFAAmF;IACnF,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAMD;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAKrD;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAMhE;AAMD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,OAAO,EACd,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,aAAa,GACtB,MAAM,CAgER"}
package/dist/index.cjs CHANGED
@@ -20,6 +20,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
+ DECIMAL_FORMAT_PATTERN: () => DECIMAL_FORMAT_PATTERN,
24
+ SUPPORTED_FORMATS: () => SUPPORTED_FORMATS,
23
25
  calculate: () => calculate,
24
26
  calculateField: () => calculateField,
25
27
  calculateWithErrors: () => calculateWithErrors,
@@ -28,6 +30,7 @@ __export(index_exports, {
28
30
  evaluateBooleanBatch: () => evaluateBooleanBatch,
29
31
  evaluateNumber: () => evaluateNumber,
30
32
  evaluateString: () => evaluateString,
33
+ formatValue: () => formatValue,
31
34
  getEnabled: () => getEnabled,
32
35
  getFormattedValue: () => getFormattedValue,
33
36
  getPageVisibility: () => getPageVisibility,
@@ -37,6 +40,8 @@ __export(index_exports, {
37
40
  isFieldVisible: () => isFieldVisible,
38
41
  isRequired: () => isRequired,
39
42
  isValidExpression: () => isValidExpression,
43
+ isValidFormat: () => isValidFormat,
44
+ parseDecimalFormat: () => parseDecimalFormat,
40
45
  validate: () => validate,
41
46
  validateExpression: () => validateExpression,
42
47
  validateSingleField: () => validateSingleField
@@ -172,6 +177,69 @@ function validateExpression(expression) {
172
177
  }
173
178
  }
174
179
 
180
+ // src/format/index.ts
181
+ var SUPPORTED_FORMATS = [
182
+ "currency",
183
+ "percent",
184
+ "date",
185
+ "datetime"
186
+ ];
187
+ var DECIMAL_FORMAT_PATTERN = /^decimal\((\d+)\)$/;
188
+ function isValidFormat(format) {
189
+ if (SUPPORTED_FORMATS.includes(format)) {
190
+ return true;
191
+ }
192
+ return DECIMAL_FORMAT_PATTERN.test(format);
193
+ }
194
+ function parseDecimalFormat(format) {
195
+ const match = format.match(DECIMAL_FORMAT_PATTERN);
196
+ if (match) {
197
+ return parseInt(match[1], 10);
198
+ }
199
+ return null;
200
+ }
201
+ function formatValue(value, format, options) {
202
+ const { locale = "en-US", currency = "USD", nullDisplay } = options ?? {};
203
+ if (value === null || value === void 0) {
204
+ if (nullDisplay !== void 0) {
205
+ return nullDisplay;
206
+ }
207
+ return String(value);
208
+ }
209
+ if (!format) {
210
+ return String(value);
211
+ }
212
+ const decimals = parseDecimalFormat(format);
213
+ if (decimals !== null) {
214
+ return typeof value === "number" ? value.toFixed(decimals) : String(value);
215
+ }
216
+ if (format === "currency") {
217
+ return typeof value === "number" ? new Intl.NumberFormat(locale, {
218
+ style: "currency",
219
+ currency
220
+ }).format(value) : String(value);
221
+ }
222
+ if (format === "percent") {
223
+ return typeof value === "number" ? new Intl.NumberFormat(locale, {
224
+ style: "percent",
225
+ minimumFractionDigits: 0,
226
+ maximumFractionDigits: 2
227
+ }).format(value) : String(value);
228
+ }
229
+ if (format === "date") {
230
+ const date = value instanceof Date ? value : new Date(String(value));
231
+ return !isNaN(date.getTime()) ? new Intl.DateTimeFormat(locale).format(date) : String(value);
232
+ }
233
+ if (format === "datetime") {
234
+ const date = value instanceof Date ? value : new Date(String(value));
235
+ return !isNaN(date.getTime()) ? new Intl.DateTimeFormat(locale, {
236
+ dateStyle: "short",
237
+ timeStyle: "short"
238
+ }).format(date) : String(value);
239
+ }
240
+ return String(value);
241
+ }
242
+
175
243
  // src/engine/calculate.ts
176
244
  function calculate(data, spec) {
177
245
  const result = calculateWithErrors(data, spec);
@@ -294,7 +362,7 @@ function findComputedDependencies(expression, availableFields) {
294
362
  }
295
363
  return deps;
296
364
  }
297
- function getFormattedValue(fieldName, data, spec) {
365
+ function getFormattedValue(fieldName, data, spec, options) {
298
366
  var _a;
299
367
  if (!((_a = spec.computed) == null ? void 0 : _a[fieldName])) {
300
368
  return null;
@@ -303,32 +371,12 @@ function getFormattedValue(fieldName, data, spec) {
303
371
  const computed = calculate(data, spec);
304
372
  const value = computed[fieldName];
305
373
  if (value === null || value === void 0) {
374
+ if ((options == null ? void 0 : options.nullDisplay) !== void 0) {
375
+ return formatValue(value, fieldDef.format, options);
376
+ }
306
377
  return null;
307
378
  }
308
- return formatValue(value, fieldDef.format);
309
- }
310
- function formatValue(value, format) {
311
- if (!format) {
312
- return String(value);
313
- }
314
- const decimalMatch = format.match(/^decimal\((\d+)\)$/);
315
- if (decimalMatch) {
316
- const decimals = parseInt(decimalMatch[1], 10);
317
- return typeof value === "number" ? value.toFixed(decimals) : String(value);
318
- }
319
- if (format === "currency") {
320
- return typeof value === "number" ? new Intl.NumberFormat("en-US", {
321
- style: "currency",
322
- currency: "USD"
323
- }).format(value) : String(value);
324
- }
325
- if (format === "percent") {
326
- return typeof value === "number" ? new Intl.NumberFormat("en-US", {
327
- style: "percent",
328
- minimumFractionDigits: 1
329
- }).format(value) : String(value);
330
- }
331
- return String(value);
379
+ return formatValue(value, fieldDef.format, options);
332
380
  }
333
381
  function calculateField(fieldName, data, spec) {
334
382
  const computed = calculate(data, spec);
@@ -607,11 +655,12 @@ function validateField(path, value, fieldDef, schemaProperty, spec, data, comput
607
655
  const customErrors = validateCustomRules(path, fieldDef.validations, context);
608
656
  errors.push(...customErrors);
609
657
  }
610
- if (Array.isArray(value) && fieldDef.itemFields) {
658
+ if (Array.isArray(value)) {
611
659
  const arrayErrors = validateArray(
612
660
  path,
613
661
  value,
614
662
  fieldDef,
663
+ schemaProperty,
615
664
  spec,
616
665
  data,
617
666
  computed,
@@ -865,24 +914,28 @@ function validateCustomRules(path, rules, context) {
865
914
  }
866
915
  return errors;
867
916
  }
868
- function validateArray(path, value, fieldDef, spec, data, computed, visibility, onlyVisible) {
917
+ function validateArray(path, value, fieldDef, schemaProperty, spec, data, computed, visibility, onlyVisible) {
869
918
  const errors = [];
870
919
  const label = fieldDef.label ?? path;
871
- if (fieldDef.minItems !== void 0 && value.length < fieldDef.minItems) {
920
+ const arraySchema = (schemaProperty == null ? void 0 : schemaProperty.type) === "array" ? schemaProperty : void 0;
921
+ const minItems = fieldDef.minItems ?? (arraySchema == null ? void 0 : arraySchema.minItems);
922
+ const maxItems = fieldDef.maxItems ?? (arraySchema == null ? void 0 : arraySchema.maxItems);
923
+ if (minItems !== void 0 && value.length < minItems) {
872
924
  errors.push({
873
925
  field: path,
874
- message: `${label} must have at least ${fieldDef.minItems} items`,
926
+ message: `${label} must have at least ${minItems} items`,
875
927
  severity: "error"
876
928
  });
877
929
  }
878
- if (fieldDef.maxItems !== void 0 && value.length > fieldDef.maxItems) {
930
+ if (maxItems !== void 0 && value.length > maxItems) {
879
931
  errors.push({
880
932
  field: path,
881
- message: `${label} must have no more than ${fieldDef.maxItems} items`,
933
+ message: `${label} must have no more than ${maxItems} items`,
882
934
  severity: "error"
883
935
  });
884
936
  }
885
- if (fieldDef.itemFields) {
937
+ const itemSchema = arraySchema == null ? void 0 : arraySchema.items;
938
+ if (fieldDef.itemFields || itemSchema) {
886
939
  for (let i = 0; i < value.length; i++) {
887
940
  const item = value[i];
888
941
  const itemErrors = validateArrayItem(
@@ -890,6 +943,7 @@ function validateArray(path, value, fieldDef, spec, data, computed, visibility,
890
943
  i,
891
944
  item,
892
945
  fieldDef.itemFields,
946
+ itemSchema,
893
947
  spec,
894
948
  data,
895
949
  computed,
@@ -901,9 +955,18 @@ function validateArray(path, value, fieldDef, spec, data, computed, visibility,
901
955
  }
902
956
  return errors;
903
957
  }
904
- function validateArrayItem(arrayPath, index, item, itemFields, spec, data, computed, visibility, onlyVisible) {
958
+ function validateArrayItem(arrayPath, index, item, itemFields, itemSchema, spec, data, computed, visibility, onlyVisible) {
905
959
  const errors = [];
906
- for (const [fieldName, fieldDef] of Object.entries(itemFields)) {
960
+ const objectSchema = (itemSchema == null ? void 0 : itemSchema.type) === "object" ? itemSchema : void 0;
961
+ const schemaProperties = (objectSchema == null ? void 0 : objectSchema.properties) ?? {};
962
+ const schemaRequired = new Set((objectSchema == null ? void 0 : objectSchema.required) ?? []);
963
+ const allFieldNames = /* @__PURE__ */ new Set([
964
+ ...Object.keys(itemFields ?? {}),
965
+ ...Object.keys(schemaProperties)
966
+ ]);
967
+ for (const fieldName of allFieldNames) {
968
+ const fieldDef = itemFields == null ? void 0 : itemFields[fieldName];
969
+ const fieldSchema = schemaProperties[fieldName];
907
970
  const itemFieldPath = `${arrayPath}[${index}].${fieldName}`;
908
971
  if (onlyVisible && visibility[itemFieldPath] === false) {
909
972
  continue;
@@ -917,15 +980,26 @@ function validateArrayItem(arrayPath, index, item, itemFields, spec, data, compu
917
980
  itemIndex: index,
918
981
  value
919
982
  };
920
- const isRequired2 = fieldDef.requiredWhen ? evaluateBoolean(fieldDef.requiredWhen, context) : false;
983
+ const isRequired2 = (fieldDef == null ? void 0 : fieldDef.requiredWhen) ? evaluateBoolean(fieldDef.requiredWhen, context) : schemaRequired.has(fieldName);
921
984
  if (isRequired2 && isEmpty(value)) {
922
985
  errors.push({
923
986
  field: itemFieldPath,
924
- message: fieldDef.label ? `${fieldDef.label} is required` : "This field is required",
987
+ message: (fieldDef == null ? void 0 : fieldDef.label) ? `${fieldDef.label} is required` : "This field is required",
925
988
  severity: "error"
926
989
  });
927
990
  }
928
- if (fieldDef.validations && !isEmpty(value)) {
991
+ if (!isEmpty(value) && fieldSchema) {
992
+ const typeError = validateType(
993
+ itemFieldPath,
994
+ value,
995
+ fieldSchema,
996
+ fieldDef ?? { label: fieldName }
997
+ );
998
+ if (typeError) {
999
+ errors.push(typeError);
1000
+ }
1001
+ }
1002
+ if ((fieldDef == null ? void 0 : fieldDef.validations) && !isEmpty(value)) {
929
1003
  const customErrors = validateCustomRules(itemFieldPath, fieldDef.validations, context);
930
1004
  errors.push(...customErrors);
931
1005
  }
@@ -954,6 +1028,8 @@ function validateSingleField(fieldPath, data, spec) {
954
1028
  }
955
1029
  // Annotate the CommonJS export names for ESM import in node:
956
1030
  0 && (module.exports = {
1031
+ DECIMAL_FORMAT_PATTERN,
1032
+ SUPPORTED_FORMATS,
957
1033
  calculate,
958
1034
  calculateField,
959
1035
  calculateWithErrors,
@@ -962,6 +1038,7 @@ function validateSingleField(fieldPath, data, spec) {
962
1038
  evaluateBooleanBatch,
963
1039
  evaluateNumber,
964
1040
  evaluateString,
1041
+ formatValue,
965
1042
  getEnabled,
966
1043
  getFormattedValue,
967
1044
  getPageVisibility,
@@ -971,6 +1048,8 @@ function validateSingleField(fieldPath, data, spec) {
971
1048
  isFieldVisible,
972
1049
  isRequired,
973
1050
  isValidExpression,
1051
+ isValidFormat,
1052
+ parseDecimalFormat,
974
1053
  validate,
975
1054
  validateExpression,
976
1055
  validateSingleField