@defra/forms-model 3.0.178 → 3.0.180

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.
Files changed (62) hide show
  1. package/dist/module/components/component-types.js +4 -42
  2. package/dist/module/components/component-types.js.map +1 -1
  3. package/dist/module/components/enums.js +0 -5
  4. package/dist/module/components/enums.js.map +1 -1
  5. package/dist/module/components/helpers.js +57 -0
  6. package/dist/module/components/helpers.js.map +1 -0
  7. package/dist/module/components/index.js +2 -1
  8. package/dist/module/components/index.js.map +1 -1
  9. package/dist/module/components/types.js.map +1 -1
  10. package/dist/module/conditions/condition-field.js +5 -5
  11. package/dist/module/conditions/condition-field.js.map +1 -1
  12. package/dist/module/conditions/condition-operators.js +64 -48
  13. package/dist/module/conditions/condition-operators.js.map +1 -1
  14. package/dist/module/conditions/condition-ref.js.map +1 -1
  15. package/dist/module/conditions/condition-values.js +9 -10
  16. package/dist/module/conditions/condition-values.js.map +1 -1
  17. package/dist/module/conditions/condition.js.map +1 -1
  18. package/dist/module/conditions/enums.js +31 -0
  19. package/dist/module/conditions/enums.js.map +1 -1
  20. package/dist/module/conditions/index.js +2 -2
  21. package/dist/module/conditions/index.js.map +1 -1
  22. package/dist/module/conditions/types.js.map +1 -1
  23. package/dist/types/components/component-types.d.ts +1 -0
  24. package/dist/types/components/component-types.d.ts.map +1 -1
  25. package/dist/types/components/enums.d.ts +1 -6
  26. package/dist/types/components/enums.d.ts.map +1 -1
  27. package/dist/types/components/helpers.d.ts +30 -0
  28. package/dist/types/components/helpers.d.ts.map +1 -0
  29. package/dist/types/components/index.d.ts +2 -1
  30. package/dist/types/components/index.d.ts.map +1 -1
  31. package/dist/types/components/types.d.ts +8 -40
  32. package/dist/types/components/types.d.ts.map +1 -1
  33. package/dist/types/conditions/condition-field.d.ts +6 -6
  34. package/dist/types/conditions/condition-field.d.ts.map +1 -1
  35. package/dist/types/conditions/condition-operators.d.ts +56 -232
  36. package/dist/types/conditions/condition-operators.d.ts.map +1 -1
  37. package/dist/types/conditions/condition-ref.d.ts +3 -3
  38. package/dist/types/conditions/condition-ref.d.ts.map +1 -1
  39. package/dist/types/conditions/condition-values.d.ts +5 -8
  40. package/dist/types/conditions/condition-values.d.ts.map +1 -1
  41. package/dist/types/conditions/condition.d.ts +6 -6
  42. package/dist/types/conditions/condition.d.ts.map +1 -1
  43. package/dist/types/conditions/enums.d.ts +28 -0
  44. package/dist/types/conditions/enums.d.ts.map +1 -1
  45. package/dist/types/conditions/index.d.ts +2 -2
  46. package/dist/types/conditions/index.d.ts.map +1 -1
  47. package/dist/types/conditions/types.d.ts +8 -0
  48. package/dist/types/conditions/types.d.ts.map +1 -1
  49. package/package.json +1 -1
  50. package/src/components/component-types.ts +6 -47
  51. package/src/components/enums.ts +1 -6
  52. package/src/components/helpers.ts +138 -0
  53. package/src/components/index.ts +14 -1
  54. package/src/components/types.ts +49 -58
  55. package/src/conditions/condition-field.ts +25 -11
  56. package/src/conditions/condition-operators.ts +129 -96
  57. package/src/conditions/condition-ref.ts +2 -2
  58. package/src/conditions/condition-values.ts +15 -20
  59. package/src/conditions/condition.ts +5 -5
  60. package/src/conditions/enums.ts +31 -0
  61. package/src/conditions/index.ts +7 -2
  62. package/src/conditions/types.ts +16 -0
@@ -1,249 +1,73 @@
1
- import { ComponentType } from '../components/enums.js';
2
- import { type ComponentDef } from '../components/types.js';
3
- import { type ConditionValueAbstract } from '../conditions/condition-value-abstract.js';
1
+ import { type ConditionalComponentType } from '../components/types.js';
2
+ import { ConditionValue, RelativeTimeValue } from '../conditions/condition-values.js';
3
+ import { OperatorName } from '../conditions/enums.js';
4
+ import { type OperatorDefinition } from '../conditions/types.js';
4
5
  export declare const customOperators: {
5
- CheckboxesField: {
6
- contains: {
7
- expression: (field: ComponentDef, value: any) => string;
8
- };
9
- 'does not contain': {
10
- expression: (field: ComponentDef, value: any) => string;
11
- };
6
+ readonly CheckboxesField: {
7
+ readonly contains: OperatorDefinition;
8
+ readonly "does not contain": OperatorDefinition;
12
9
  };
13
- NumberField: {
14
- 'is at least': {
15
- expression: (field: ComponentDef, value: any) => string;
16
- };
17
- 'is at most': {
18
- expression: (field: ComponentDef, value: any) => string;
19
- };
20
- 'is less than': {
21
- expression: (field: ComponentDef, value: any) => string;
22
- };
23
- 'is more than': {
24
- expression: (field: ComponentDef, value: any) => string;
25
- };
10
+ readonly NumberField: {
11
+ "is at least": OperatorDefinition;
12
+ "is at most": OperatorDefinition;
13
+ "is less than": OperatorDefinition;
14
+ "is more than": OperatorDefinition;
26
15
  } & {
27
- is: {
28
- expression: (field: ComponentDef, value: any) => string;
29
- };
30
- 'is not': {
31
- expression: (field: ComponentDef, value: any) => string;
32
- };
16
+ is: OperatorDefinition;
17
+ "is not": OperatorDefinition;
33
18
  };
34
- DateField: {
35
- is: {
36
- expression: (field: ComponentDef, value: any) => string;
37
- };
38
- 'is not': {
39
- expression: (field: ComponentDef, value: any) => string;
40
- };
41
- 'is before': {
42
- expression: (field: ComponentDef, value: any) => string;
43
- };
44
- 'is after': {
45
- expression: (field: ComponentDef, value: any) => string;
46
- };
47
- } & {
48
- 'is at least': {
49
- units: any;
50
- expression: (field: ComponentDef, value: any) => string;
51
- };
52
- 'is at most': {
53
- units: any;
54
- expression: (field: ComponentDef, value: any) => string;
55
- };
56
- 'is less than': {
57
- units: any;
58
- expression: (field: ComponentDef, value: any) => string;
59
- };
60
- 'is more than': {
61
- units: any;
62
- expression: (field: ComponentDef, value: any) => string;
63
- };
64
- };
65
- TimeField: {
66
- is: {
67
- expression: (field: ComponentDef, value: any) => string;
68
- };
69
- 'is not': {
70
- expression: (field: ComponentDef, value: any) => string;
71
- };
72
- 'is before': {
73
- expression: (field: ComponentDef, value: any) => string;
74
- };
75
- 'is after': {
76
- expression: (field: ComponentDef, value: any) => string;
77
- };
78
- } & {
79
- 'is at least': {
80
- units: any;
81
- expression: (field: ComponentDef, value: any) => string;
82
- };
83
- 'is at most': {
84
- units: any;
85
- expression: (field: ComponentDef, value: any) => string;
86
- };
87
- 'is less than': {
88
- units: any;
89
- expression: (field: ComponentDef, value: any) => string;
90
- };
91
- 'is more than': {
92
- units: any;
93
- expression: (field: ComponentDef, value: any) => string;
94
- };
19
+ readonly TimeField: {
20
+ readonly "is at least": OperatorDefinition;
21
+ readonly "is at most": OperatorDefinition;
22
+ readonly "is less than": OperatorDefinition;
23
+ readonly "is more than": OperatorDefinition;
24
+ readonly is: OperatorDefinition;
25
+ readonly "is not": OperatorDefinition;
26
+ readonly "is before": OperatorDefinition;
27
+ readonly "is after": OperatorDefinition;
95
28
  };
96
- DatePartsField: {
97
- is: {
98
- expression: (field: ComponentDef, value: any) => string;
99
- };
100
- 'is not': {
101
- expression: (field: ComponentDef, value: any) => string;
102
- };
103
- 'is before': {
104
- expression: (field: ComponentDef, value: any) => string;
105
- };
106
- 'is after': {
107
- expression: (field: ComponentDef, value: any) => string;
108
- };
109
- } & {
110
- 'is at least': {
111
- units: any;
112
- expression: (field: ComponentDef, value: any) => string;
113
- };
114
- 'is at most': {
115
- units: any;
116
- expression: (field: ComponentDef, value: any) => string;
117
- };
118
- 'is less than': {
119
- units: any;
120
- expression: (field: ComponentDef, value: any) => string;
121
- };
122
- 'is more than': {
123
- units: any;
124
- expression: (field: ComponentDef, value: any) => string;
125
- };
29
+ readonly DatePartsField: {
30
+ readonly "is at least": OperatorDefinition;
31
+ readonly "is at most": OperatorDefinition;
32
+ readonly "is less than": OperatorDefinition;
33
+ readonly "is more than": OperatorDefinition;
34
+ readonly is: OperatorDefinition;
35
+ readonly "is not": OperatorDefinition;
36
+ readonly "is before": OperatorDefinition;
37
+ readonly "is after": OperatorDefinition;
126
38
  };
127
- DateTimeField: {
128
- is: {
129
- expression: (field: ComponentDef, value: any) => string;
130
- };
131
- 'is not': {
132
- expression: (field: ComponentDef, value: any) => string;
133
- };
134
- 'is before': {
135
- expression: (field: ComponentDef, value: any) => string;
136
- };
137
- 'is after': {
138
- expression: (field: ComponentDef, value: any) => string;
139
- };
39
+ readonly TextField: {
40
+ "is longer than": OperatorDefinition;
41
+ "is shorter than": OperatorDefinition;
42
+ "has length": OperatorDefinition;
140
43
  } & {
141
- 'is at least': {
142
- units: any;
143
- expression: (field: ComponentDef, value: any) => string;
144
- };
145
- 'is at most': {
146
- units: any;
147
- expression: (field: ComponentDef, value: any) => string;
148
- };
149
- 'is less than': {
150
- units: any;
151
- expression: (field: ComponentDef, value: any) => string;
152
- };
153
- 'is more than': {
154
- units: any;
155
- expression: (field: ComponentDef, value: any) => string;
156
- };
44
+ is: OperatorDefinition;
45
+ "is not": OperatorDefinition;
157
46
  };
158
- DateTimePartsField: {
159
- is: {
160
- expression: (field: ComponentDef, value: any) => string;
161
- };
162
- 'is not': {
163
- expression: (field: ComponentDef, value: any) => string;
164
- };
165
- 'is before': {
166
- expression: (field: ComponentDef, value: any) => string;
167
- };
168
- 'is after': {
169
- expression: (field: ComponentDef, value: any) => string;
170
- };
47
+ readonly MultilineTextField: {
48
+ "is longer than": OperatorDefinition;
49
+ "is shorter than": OperatorDefinition;
50
+ "has length": OperatorDefinition;
171
51
  } & {
172
- 'is at least': {
173
- units: any;
174
- expression: (field: ComponentDef, value: any) => string;
175
- };
176
- 'is at most': {
177
- units: any;
178
- expression: (field: ComponentDef, value: any) => string;
179
- };
180
- 'is less than': {
181
- units: any;
182
- expression: (field: ComponentDef, value: any) => string;
183
- };
184
- 'is more than': {
185
- units: any;
186
- expression: (field: ComponentDef, value: any) => string;
187
- };
52
+ is: OperatorDefinition;
53
+ "is not": OperatorDefinition;
188
54
  };
189
- TextField: {
190
- 'is longer than': {
191
- expression: (field: ComponentDef, value: any) => string;
192
- };
193
- 'is shorter than': {
194
- expression: (field: ComponentDef, value: any) => string;
195
- };
196
- 'has length': {
197
- expression: (field: ComponentDef, value: any) => string;
198
- };
55
+ readonly EmailAddressField: {
56
+ "is longer than": OperatorDefinition;
57
+ "is shorter than": OperatorDefinition;
58
+ "has length": OperatorDefinition;
199
59
  } & {
200
- is: {
201
- expression: (field: ComponentDef, value: any) => string;
202
- };
203
- 'is not': {
204
- expression: (field: ComponentDef, value: any) => string;
205
- };
60
+ is: OperatorDefinition;
61
+ "is not": OperatorDefinition;
206
62
  };
207
- MultilineTextField: {
208
- 'is longer than': {
209
- expression: (field: ComponentDef, value: any) => string;
210
- };
211
- 'is shorter than': {
212
- expression: (field: ComponentDef, value: any) => string;
213
- };
214
- 'has length': {
215
- expression: (field: ComponentDef, value: any) => string;
216
- };
217
- } & {
218
- is: {
219
- expression: (field: ComponentDef, value: any) => string;
220
- };
221
- 'is not': {
222
- expression: (field: ComponentDef, value: any) => string;
223
- };
224
- };
225
- EmailAddressField: {
226
- 'is longer than': {
227
- expression: (field: ComponentDef, value: any) => string;
228
- };
229
- 'is shorter than': {
230
- expression: (field: ComponentDef, value: any) => string;
231
- };
232
- 'has length': {
233
- expression: (field: ComponentDef, value: any) => string;
234
- };
235
- } & {
236
- is: {
237
- expression: (field: ComponentDef, value: any) => string;
238
- };
239
- 'is not': {
240
- expression: (field: ComponentDef, value: any) => string;
241
- };
63
+ readonly YesNoField: {
64
+ is: OperatorDefinition;
65
+ "is not": OperatorDefinition;
242
66
  };
243
67
  };
244
- export declare function getOperatorNames(fieldType: any): string[];
245
- export declare function getExpression(fieldType: ComponentType, fieldName: string, operator: string, value: ConditionValueAbstract): any;
246
- export declare function getOperatorConfig(fieldType: ComponentType, operator: any): any;
68
+ export declare function getOperatorNames(fieldType: ConditionalComponentType): string[];
69
+ export declare function getExpression(fieldType: ConditionalComponentType, fieldName: string, operator: OperatorName, value: ConditionValue | RelativeTimeValue): string | undefined;
70
+ export declare function getOperatorConfig(fieldType: ConditionalComponentType, operator: OperatorName): OperatorDefinition | undefined;
247
71
  export declare const absoluteDateOrTimeOperatorNames: string[];
248
72
  export declare const relativeDateOrTimeOperatorNames: string[];
249
73
  //# sourceMappingURL=condition-operators.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"condition-operators.d.ts","sourceRoot":"","sources":["../../../src/conditions/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AE3C,CAAA"}
@@ -1,12 +1,12 @@
1
1
  import { ConditionAbstract } from '../conditions/condition-abstract.js';
2
2
  import { type Coordinator } from '../conditions/enums.js';
3
3
  export declare class ConditionRef extends ConditionAbstract {
4
- conditionName: string;
5
- conditionDisplayName: string;
4
+ conditionName: any;
5
+ conditionDisplayName: any;
6
6
  constructor(conditionName: string, conditionDisplayName: string, coordinator: Coordinator | undefined);
7
7
  asFirstCondition(): this;
8
8
  conditionString(): string;
9
- conditionExpression(): string;
9
+ conditionExpression(): any;
10
10
  clone(): ConditionRef;
11
11
  }
12
12
  //# sourceMappingURL=condition-ref.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"condition-ref.d.ts","sourceRoot":"","sources":["../../../src/conditions/condition-ref.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAA;AAC1E,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAE5D,qBAAa,YAAa,SAAQ,iBAAiB;IACjD,aAAa,EAAE,MAAM,CAAA;IACrB,oBAAoB,EAAE,MAAM,CAAA;gBAG1B,aAAa,EAAE,MAAM,EACrB,oBAAoB,EAAE,MAAM,EAC5B,WAAW,EAAE,WAAW,GAAG,SAAS;IAkBtC,gBAAgB;IAKhB,eAAe;IAIf,mBAAmB;IAInB,KAAK;CAON"}
1
+ {"version":3,"file":"condition-ref.d.ts","sourceRoot":"","sources":["../../../src/conditions/condition-ref.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAA;AAC1E,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAE5D,qBAAa,YAAa,SAAQ,iBAAiB;IACjD,aAAa,MAAA;IACb,oBAAoB,MAAA;gBAGlB,aAAa,EAAE,MAAM,EACrB,oBAAoB,EAAE,MAAM,EAC5B,WAAW,EAAE,WAAW,GAAG,SAAS;IAkBtC,gBAAgB;IAKhB,eAAe;IAIf,mBAAmB;IAInB,KAAK;CAON"}
@@ -1,7 +1,8 @@
1
1
  import { ConditionValueAbstract } from '../conditions/condition-value-abstract.js';
2
+ import { ConditionType, DateDirections } from '../conditions/enums.js';
2
3
  import { type DateTimeUnitValues, type DateUnits, type TimeUnits } from '../conditions/types.js';
3
4
  export declare class ConditionValue extends ConditionValueAbstract implements ConditionValueFrom {
4
- type: 'Value';
5
+ type: ConditionType.Value;
5
6
  value: string;
6
7
  display: string;
7
8
  constructor(value: string, display?: string);
@@ -14,15 +15,11 @@ export interface ConditionValueFrom {
14
15
  value: string;
15
16
  display?: string;
16
17
  }
17
- export declare enum DateDirections {
18
- FUTURE = "in the future",
19
- PAST = "in the past"
20
- }
21
18
  export declare const dateUnits: DateUnits;
22
19
  export declare const timeUnits: TimeUnits;
23
20
  export declare const dateTimeUnits: DateUnits & TimeUnits;
24
21
  export declare class RelativeTimeValue extends ConditionValueAbstract implements RelativeTimeValueFrom {
25
- type: 'RelativeTime';
22
+ type: ConditionType.RelativeTime;
26
23
  timePeriod: string;
27
24
  timeUnit: DateTimeUnitValues;
28
25
  direction: DateDirections;
@@ -40,8 +37,8 @@ export interface RelativeTimeValueFrom {
40
37
  timeOnly: boolean;
41
38
  }
42
39
  export declare function conditionValueFrom(obj: ConditionValue | RelativeTimeValue | ({
43
- type: 'Value';
40
+ type: ConditionType.Value;
44
41
  } & ConditionValueFrom) | ({
45
- type: 'RelativeTime';
42
+ type: ConditionType.RelativeTime;
46
43
  } & RelativeTimeValueFrom)): ConditionValue | RelativeTimeValue;
47
44
  //# sourceMappingURL=condition-values.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"condition-values.d.ts","sourceRoot":"","sources":["../../../src/conditions/condition-values.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAA;AACrF,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,2BAA2B,CA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AAE,MAAM,EAClB,QAAQ,EAAE,kBAAkB,EAC5B,SAAS,EAAE,cAAc,EACzB,QAAQ,UAAQ;IA+BlB,oBAAoB;IAIpB,YAAY,IAAI,MAAM;IAUtB,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,iBAAiB,GAAG,qBAAqB;IAS1D,KAAK;CAGN;AAED,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,kBAAkB,CAAA;IAC5B,SAAS,EAAE,cAAc,CAAA;IACzB,QAAQ,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,kBAAkB,CAChC,GAAG,EACC,cAAc,GACd,iBAAiB,GACjB,CAAC;IAAE,IAAI,EAAE,aAAa,CAAC,KAAK,CAAA;CAAE,GAAG,kBAAkB,CAAC,GACpD,CAAC;IAAE,IAAI,EAAE,aAAa,CAAC,YAAY,CAAA;CAAE,GAAG,qBAAqB,CAAC,sCASnE"}
@@ -1,15 +1,15 @@
1
1
  import { ConditionAbstract } from '../conditions/condition-abstract.js';
2
2
  import { ConditionField } from '../conditions/condition-field.js';
3
3
  import { type ConditionValue, type RelativeTimeValue } from '../conditions/condition-values.js';
4
- import { type Coordinator } from '../conditions/enums.js';
4
+ import { type Coordinator, type OperatorName } from '../conditions/enums.js';
5
5
  export declare class Condition extends ConditionAbstract {
6
- field: ConditionField;
7
- operator: string;
8
- value: ConditionValue | RelativeTimeValue;
9
- constructor(field?: ConditionField, operator?: string, value?: ConditionValue | RelativeTimeValue, coordinator?: Coordinator);
6
+ field: any;
7
+ operator: any;
8
+ value: any;
9
+ constructor(field?: ConditionField, operator?: OperatorName, value?: ConditionValue | RelativeTimeValue, coordinator?: Coordinator);
10
10
  asFirstCondition(): this;
11
11
  conditionString(): string;
12
- conditionExpression(): any;
12
+ conditionExpression(): string | undefined;
13
13
  clone(): Condition;
14
14
  }
15
15
  //# sourceMappingURL=condition.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"condition.d.ts","sourceRoot":"","sources":["../../../src/conditions/condition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAA;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAA;AAGpE,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACvB,MAAM,sCAAsC,CAAA;AAC7C,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAE5D,qBAAa,SAAU,SAAQ,iBAAiB;IAC9C,KAAK,EAAE,cAAc,CAAA;IACrB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,cAAc,GAAG,iBAAiB,CAAA;gBAGvC,KAAK,CAAC,EAAE,cAAc,EACtB,QAAQ,CAAC,EAAE,MAAM,EACjB,KAAK,CAAC,EAAE,cAAc,GAAG,iBAAiB,EAC1C,WAAW,CAAC,EAAE,WAAW;IAqB3B,gBAAgB;IAKhB,eAAe;IAMf,mBAAmB;IASnB,KAAK;CAQN"}
1
+ {"version":3,"file":"condition.d.ts","sourceRoot":"","sources":["../../../src/conditions/condition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAA;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAA;AAGpE,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACvB,MAAM,sCAAsC,CAAA;AAC7C,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAE/E,qBAAa,SAAU,SAAQ,iBAAiB;IAC9C,KAAK,MAAA;IACL,QAAQ,MAAA;IACR,KAAK,MAAA;gBAGH,KAAK,CAAC,EAAE,cAAc,EACtB,QAAQ,CAAC,EAAE,YAAY,EACvB,KAAK,CAAC,EAAE,cAAc,GAAG,iBAAiB,EAC1C,WAAW,CAAC,EAAE,WAAW;IAqB3B,gBAAgB;IAKhB,eAAe;IAMf,mBAAmB;IASnB,KAAK;CAQN"}
@@ -6,4 +6,32 @@ export declare enum Coordinator {
6
6
  AND = "and",
7
7
  OR = "or"
8
8
  }
9
+ export declare enum Operator {
10
+ Is = "==",
11
+ IsNot = "!=",
12
+ Contains = "in",
13
+ IsAtLeast = ">=",
14
+ IsAtMost = "<=",
15
+ IsLessThan = "<",
16
+ IsMoreThan = ">"
17
+ }
18
+ export declare enum OperatorName {
19
+ Is = "is",
20
+ IsNot = "is not",
21
+ IsLongerThan = "is longer than",
22
+ IsShorterThan = "is shorter than",
23
+ HasLength = "has length",
24
+ Contains = "contains",
25
+ DoesNotContain = "does not contain",
26
+ IsAtLeast = "is at least",
27
+ IsAtMost = "is at most",
28
+ IsLessThan = "is less than",
29
+ IsMoreThan = "is more than",
30
+ IsBefore = "is before",
31
+ IsAfter = "is after"
32
+ }
33
+ export declare enum DateDirections {
34
+ FUTURE = "in the future",
35
+ PAST = "in the past"
36
+ }
9
37
  //# sourceMappingURL=enums.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../../src/conditions/enums.ts"],"names":[],"mappings":"AAAA,oBAAY,aAAa;IACvB,KAAK,UAAU;IACf,YAAY,iBAAiB;CAC9B;AAED,oBAAY,WAAW;IACrB,GAAG,QAAQ;IACX,EAAE,OAAO;CACV"}
1
+ {"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../../src/conditions/enums.ts"],"names":[],"mappings":"AAAA,oBAAY,aAAa;IACvB,KAAK,UAAU;IACf,YAAY,iBAAiB;CAC9B;AAED,oBAAY,WAAW;IACrB,GAAG,QAAQ;IACX,EAAE,OAAO;CACV;AAED,oBAAY,QAAQ;IAClB,EAAE,OAAO;IACT,KAAK,OAAO;IACZ,QAAQ,OAAO;IACf,SAAS,OAAO;IAChB,QAAQ,OAAO;IACf,UAAU,MAAM;IAChB,UAAU,MAAM;CACjB;AAED,oBAAY,YAAY;IACtB,EAAE,OAAO;IACT,KAAK,WAAW;IAChB,YAAY,mBAAmB;IAC/B,aAAa,oBAAoB;IACjC,SAAS,eAAe;IACxB,QAAQ,aAAa;IACrB,cAAc,qBAAqB;IACnC,SAAS,gBAAgB;IACzB,QAAQ,eAAe;IACvB,UAAU,iBAAiB;IAC3B,UAAU,iBAAiB;IAC3B,QAAQ,cAAc;IACtB,OAAO,aAAa;CACrB;AAED,oBAAY,cAAc;IACxB,MAAM,kBAAkB;IACxB,IAAI,gBAAgB;CACrB"}
@@ -1,5 +1,5 @@
1
1
  export { getExpression, getOperatorConfig, getOperatorNames, absoluteDateOrTimeOperatorNames, relativeDateOrTimeOperatorNames } from '../conditions/condition-operators.js';
2
- export { timeUnits, dateUnits, dateTimeUnits, ConditionValue, DateDirections, RelativeTimeValue, conditionValueFrom } from '../conditions/condition-values.js';
2
+ export { timeUnits, dateUnits, dateTimeUnits, ConditionValue, RelativeTimeValue, conditionValueFrom } from '../conditions/condition-values.js';
3
3
  export { ConditionField } from '../conditions/condition-field.js';
4
4
  export { Condition } from '../conditions/condition.js';
5
5
  export { ConditionRef } from '../conditions/condition-ref.js';
@@ -7,5 +7,5 @@ export { ConditionGroup } from '../conditions/condition-group.js';
7
7
  export { ConditionsModel } from '../conditions/condition-model.js';
8
8
  export { ConditionGroupDef } from '../conditions/condition-group-def.js';
9
9
  export { toExpression, toPresentationString } from '../conditions/helpers.js';
10
- export { ConditionType, Coordinator } from '../conditions/enums.js';
10
+ export { ConditionType, Coordinator, DateDirections, Operator, OperatorName } from '../conditions/enums.js';
11
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/conditions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,+BAA+B,EAC/B,+BAA+B,EAChC,MAAM,yCAAyC,CAAA;AAEhD,OAAO,EACL,SAAS,EACT,SAAS,EACT,aAAa,EACb,cAAc,EACd,cAAc,E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M,2BAA2B,CAAA"}
@@ -1,6 +1,9 @@
1
+ import { type ConditionalComponentsDef } from '../components/types.js';
1
2
  import { type ConditionGroup } from '../conditions/condition-group.js';
2
3
  import { type ConditionRef } from '../conditions/condition-ref.js';
4
+ import { type ConditionValue, type RelativeTimeValue } from '../conditions/condition-values.js';
3
5
  import { type Condition } from '../conditions/condition.js';
6
+ import { type OperatorName } from '../conditions/enums.js';
4
7
  export type ConditionsArray = (Condition | ConditionGroup | ConditionRef)[];
5
8
  export type DateTimeUnitValues = 'years' | 'months' | 'days' | 'hours' | 'minutes' | 'seconds';
6
9
  export interface DateUnits {
@@ -31,4 +34,9 @@ export interface TimeUnits {
31
34
  value: 'seconds';
32
35
  };
33
36
  }
37
+ export interface OperatorDefinition {
38
+ units?: DateUnits | TimeUnits;
39
+ expression: (component: Pick<ConditionalComponentsDef, 'type' | 'name'>, conditionValue: ConditionValue | RelativeTimeValue) => string;
40
+ }
41
+ export type Conditionals = Record<OperatorName, OperatorDefinition>;
34
42
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/conditions/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,qCAAqC,CAAA;AACzE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,mCAAmC,CAAA;AACrE,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,+BAA+B,CAAA;AAE9D,MAAM,MAAM,eAAe,GAAG,CAAC,SAAS,GAAG,cAAc,GAAG,YAAY,CAAC,EAAE,CAAA;AAE3E,MAAM,MAAM,kBAAkB,GAC1B,OAAO,GACP,QAAQ,GACR,MAAM,GACN,OAAO,GACP,SAAS,GACT,SAAS,CAAA;AAEb,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE;QAAE,OAAO,EAAE,SAAS,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,CAAA;IAC7C,MAAM,EAAE;QAAE,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OAAO,EAAE,UAAU,CAAC;QAAC,KAAK,EAAE,QAAQ,CAAA;KAAE,CAAA;IAChD,IAAI,EAAE;QAAE,OAAO,EAAE,QAAQ,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;CAC3C;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE;QAAE,OAAO,EAAE,SAAS,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,CAAA;IAC7C,OAAO,EAAE;QAAE,OAAO,EAAE,WAAW,CAAC;QAAC,KAAK,EAAE,SAAS,CAAA;KAAE,CAAA;IACnD,OAAO,EAAE;QAAE,OAAO,EAAE,WAAW,CAAC;QAAC,KAAK,EAAE,SAAS,CAAA;KAAE,CAAA;CACpD;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;IAC7B,UAAU,EAAE,CACV,SAAS,EAAE,IAAI,CAAC,wBAAwB,EAAE,MAAM,GAAG,MAAM,CAAC,EAC1D,cAAc,EAAE,cAAc,GAAG,iBAAiB,KAC/C,MAAM,CAAA;CACZ;AAED,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,YAAY,EAAE,kBAAkB,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defra/forms-model",
3
- "version": "3.0.178",
3
+ "version": "3.0.180",
4
4
  "description": "A hapi plugin providing the model for Defra forms",
5
5
  "homepage": "https://github.com/DEFRA/forms-designer/tree/main/model#readme",
6
6
  "repository": {
@@ -1,4 +1,5 @@
1
1
  import { ComponentSubType, ComponentType } from '~/src/components/enums.js'
2
+ import { hasConditionSupport } from '~/src/components/helpers.js'
2
3
  import { type ComponentDef } from '~/src/components/types.js'
3
4
 
4
5
  export const ComponentTypes: ComponentDef[] = [
@@ -29,15 +30,6 @@ export const ComponentTypes: ComponentDef[] = [
29
30
  options: {},
30
31
  schema: {}
31
32
  },
32
- {
33
- name: 'DateField',
34
- type: ComponentType.DateField,
35
- title: 'Date field',
36
- subType: ComponentSubType.Field,
37
- hint: '',
38
- options: {},
39
- schema: {}
40
- },
41
33
  {
42
34
  name: 'TimeField',
43
35
  type: ComponentType.TimeField,
@@ -47,28 +39,10 @@ export const ComponentTypes: ComponentDef[] = [
47
39
  options: {},
48
40
  schema: {}
49
41
  },
50
- {
51
- name: 'DateTimeField',
52
- type: ComponentType.DateTimeField,
53
- title: 'Date time field',
54
- subType: ComponentSubType.Field,
55
- hint: '',
56
- options: {},
57
- schema: {}
58
- },
59
42
  {
60
43
  name: 'DatePartsField',
61
44
  type: ComponentType.DatePartsField,
62
- title: 'Date parts field',
63
- subType: ComponentSubType.Field,
64
- hint: '',
65
- options: {},
66
- schema: {}
67
- },
68
- {
69
- name: 'DateTimePartsField',
70
- type: ComponentType.DateTimePartsField,
71
- title: 'Date time parts field',
45
+ title: 'Date field',
72
46
  subType: ComponentSubType.Field,
73
47
  hint: '',
74
48
  options: {},
@@ -77,7 +51,7 @@ export const ComponentTypes: ComponentDef[] = [
77
51
  {
78
52
  name: 'MonthYearField',
79
53
  type: ComponentType.MonthYearField,
80
- title: 'Month year field',
54
+ title: 'Month & year field',
81
55
  subType: ComponentSubType.Field,
82
56
  hint: '',
83
57
  options: {},
@@ -155,15 +129,6 @@ export const ComponentTypes: ComponentDef[] = [
155
129
  options: {},
156
130
  schema: {}
157
131
  },
158
- {
159
- name: 'FileUploadField',
160
- type: ComponentType.FileUploadField,
161
- title: 'File upload field',
162
- subType: ComponentSubType.Field,
163
- hint: '',
164
- options: {},
165
- schema: {}
166
- },
167
132
  {
168
133
  name: 'Html',
169
134
  type: ComponentType.Html,
@@ -199,14 +164,8 @@ export const ComponentTypes: ComponentDef[] = [
199
164
  options: {},
200
165
  schema: {},
201
166
  list: ''
202
- },
203
- {
204
- name: 'WebsiteField',
205
- type: ComponentType.WebsiteField,
206
- title: 'Website field',
207
- subType: ComponentSubType.Field,
208
- hint: '',
209
- options: {},
210
- schema: {}
211
167
  }
212
168
  ]
169
+
170
+ export const ConditionalComponentTypes =
171
+ ComponentTypes.filter(hasConditionSupport)
@@ -2,12 +2,9 @@ export enum ComponentType {
2
2
  TextField = 'TextField',
3
3
  MultilineTextField = 'MultilineTextField',
4
4
  YesNoField = 'YesNoField',
5
- DateField = 'DateField',
6
5
  TimeField = 'TimeField',
7
- DateTimeField = 'DateTimeField',
8
6
  DatePartsField = 'DatePartsField',
9
7
  MonthYearField = 'MonthYearField',
10
- DateTimePartsField = 'DateTimePartsField',
11
8
  SelectField = 'SelectField',
12
9
  AutocompleteField = 'AutocompleteField',
13
10
  RadiosField = 'RadiosField',
@@ -16,12 +13,10 @@ export enum ComponentType {
16
13
  UkAddressField = 'UkAddressField',
17
14
  TelephoneNumberField = 'TelephoneNumberField',
18
15
  EmailAddressField = 'EmailAddressField',
19
- FileUploadField = 'FileUploadField',
20
16
  Html = 'Html',
21
17
  InsetText = 'InsetText',
22
18
  Details = 'Details',
23
- List = 'List',
24
- WebsiteField = 'WebsiteField'
19
+ List = 'List'
25
20
  }
26
21
 
27
22
  export enum ComponentSubType {