@planning-inspectorate/dynamic-forms 3.10.3 → 3.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planning-inspectorate/dynamic-forms",
3
- "version": "3.10.3",
3
+ "version": "3.10.4",
4
4
  "description": "This package is for building GDS forms using a configuration-based approach.",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -20,15 +20,31 @@ import BaseValidator from './base-validator.js';
20
20
  */
21
21
 
22
22
  /**
23
- * @typedef {Object} Field
23
+ * @typedef {Object} FieldBase
24
24
  * @property {string} fieldName
25
- * @property {boolean} required
26
- * @property {string} errorMessage
27
25
  * @property {MinLength} [minLength]
28
26
  * @property {MaxLength} [maxLength]
29
27
  * @property {Regex} [regex]
30
28
  */
31
29
 
30
+ /**
31
+ * @typedef {FieldBase & {
32
+ * required: true,
33
+ * errorMessage: string
34
+ * }} RequiredField
35
+ */
36
+
37
+ /**
38
+ * @typedef {FieldBase & {
39
+ * required?: false,
40
+ * errorMessage?: string
41
+ * }} OptionalField
42
+ */
43
+
44
+ /**
45
+ * @typedef {RequiredField | OptionalField} Field
46
+ */
47
+
32
48
  export class MultiFieldInputValidator extends BaseValidator {
33
49
  /**
34
50
  * @param {Object} params
@@ -14,14 +14,27 @@
14
14
  * @property {String} maxLengthMessage
15
15
  */
16
16
  /**
17
- * @typedef {Object} Field
17
+ * @typedef {Object} FieldBase
18
18
  * @property {string} fieldName
19
- * @property {boolean} required
20
- * @property {string} errorMessage
21
19
  * @property {MinLength} [minLength]
22
20
  * @property {MaxLength} [maxLength]
23
21
  * @property {Regex} [regex]
24
22
  */
23
+ /**
24
+ * @typedef {FieldBase & {
25
+ * required: true,
26
+ * errorMessage: string
27
+ * }} RequiredField
28
+ */
29
+ /**
30
+ * @typedef {FieldBase & {
31
+ * required?: false,
32
+ * errorMessage?: string
33
+ * }} OptionalField
34
+ */
35
+ /**
36
+ * @typedef {RequiredField | OptionalField} Field
37
+ */
25
38
  export class MultiFieldInputValidator extends BaseValidator {
26
39
  /**
27
40
  * @param {Object} params
@@ -59,13 +72,20 @@ export type MaxLength = {
59
72
  maxLength: number;
60
73
  maxLengthMessage: string;
61
74
  };
62
- export type Field = {
75
+ export type FieldBase = {
63
76
  fieldName: string;
64
- required: boolean;
65
- errorMessage: string;
66
77
  minLength?: MinLength | undefined;
67
78
  maxLength?: MaxLength | undefined;
68
79
  regex?: Regex | undefined;
69
80
  };
81
+ export type RequiredField = FieldBase & {
82
+ required: true;
83
+ errorMessage: string;
84
+ };
85
+ export type OptionalField = FieldBase & {
86
+ required?: false;
87
+ errorMessage?: string;
88
+ };
89
+ export type Field = RequiredField | OptionalField;
70
90
  import BaseValidator from './base-validator.js';
71
91
  //# sourceMappingURL=multi-field-input-validator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"multi-field-input-validator.d.ts","sourceRoot":"","sources":["../../../src/validator/multi-field-input-validator.js"],"names":[],"mappings":"AAGA;;;;GAIG;AAEH;;;;GAIG;AAEH;;;;GAIG;AAEH;;;;;;;;GAQG;AAEH;IACC;;;;OAIG;IACH,0CAHG;QAAyB,MAAM;QACP,eAAe;KAAC,EAQ1C;IAFA,gBAAoB;IACpB,wBAAwE;IAGzE;;OAEG;IAEH,0DA8BC;IAED,sBAEC;IACD;;;;OAIG;IACH,gCAHW,MAAM,GACJ,OAAO,CAQnB;CACD;;;WA3Fa,SAAS,MAAM;;;;;;;;;;;;eAkBf,MAAM;cACN,OAAO;kBACP,MAAM;;;;;0BAvBM,qBAAqB"}
1
+ {"version":3,"file":"multi-field-input-validator.d.ts","sourceRoot":"","sources":["../../../src/validator/multi-field-input-validator.js"],"names":[],"mappings":"AAGA;;;;GAIG;AAEH;;;;GAIG;AAEH;;;;GAIG;AAEH;;;;;;GAMG;AAEH;;;;;GAKG;AAEH;;;;;GAKG;AAEH;;GAEG;AAEH;IACC;;;;OAIG;IACH,0CAHG;QAAyB,MAAM;QACP,eAAe;KAAC,EAQ1C;IAFA,gBAAoB;IACpB,wBAAwE;IAGzE;;OAEG;IAEH,0DA8BC;IAED,sBAEC;IACD;;;;OAIG;IACH,gCAHW,MAAM,GACJ,OAAO,CAQnB;CACD;;;WA3Ga,SAAS,MAAM;;;;;;;;;;;;eAkBf,MAAM;;;;;4BAOP,SAAS,GAAG;IACpB,QAAQ,EAAE,IAAI,CAAC;IACf,YAAY,EAAE,MAAM,CAAA;CACrB;4BAIS,SAAS,GAAG;IACpB,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;oBAIS,aAAa,GAAG,aAAa;0BA1ChB,qBAAqB"}