@ecrvs/opencrvs-toolkit 1.8.1-rc.3059ff8 → 1.8.1-rc.6747688
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/dist/commons/conditionals/abbreviation.d.ts +5 -0
- package/dist/commons/conditionals/conditionals.d.ts +4 -0
- package/dist/commons/conditionals/ill-defined.d.ts +2 -0
- package/dist/commons/events/field.d.ts +8 -0
- package/dist/conditionals/index.js +29 -0
- package/dist/events/index.js +1081 -1
- package/dist/notification/index.js +1081 -1
- package/package.json +1 -1
|
@@ -122,6 +122,8 @@ export declare function createFieldConditionals(fieldId: string): {
|
|
|
122
122
|
isLessThan: (value: number | FieldReference) => JSONSchema;
|
|
123
123
|
isEqualTo(value: string | boolean | FieldReference): JSONSchema;
|
|
124
124
|
isEqualToSumOf(val1: FieldReference, val2: FieldReference): JSONSchema;
|
|
125
|
+
isAbbreviation(): JSONSchema;
|
|
126
|
+
isIllDefined(causesOfDeathFields: FieldReference[], threshold: number): JSONSchema;
|
|
125
127
|
/**
|
|
126
128
|
* Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
|
|
127
129
|
* @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
|
|
@@ -167,6 +169,8 @@ export declare function createFieldConditionals(fieldId: string): {
|
|
|
167
169
|
isLessThan: (value: number | FieldReference) => JSONSchema;
|
|
168
170
|
isEqualTo(value: string | boolean | FieldReference): JSONSchema;
|
|
169
171
|
isEqualToSumOf(val1: FieldReference, val2: FieldReference): JSONSchema;
|
|
172
|
+
isAbbreviation(): JSONSchema;
|
|
173
|
+
isIllDefined(causesOfDeathFields: FieldReference[], threshold: number): JSONSchema;
|
|
170
174
|
/**
|
|
171
175
|
* Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
|
|
172
176
|
* @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
|
|
@@ -100,6 +100,10 @@ export declare function field(fieldId: string, options?: {
|
|
|
100
100
|
}, val2: {
|
|
101
101
|
$$field: string;
|
|
102
102
|
}): import("../conditionals/conditionals").JSONSchema;
|
|
103
|
+
isAbbreviation(): import("../conditionals/conditionals").JSONSchema;
|
|
104
|
+
isIllDefined(causesOfDeathFields: {
|
|
105
|
+
$$field: string;
|
|
106
|
+
}[], threshold: number): import("../conditionals/conditionals").JSONSchema;
|
|
103
107
|
isFalsy(): import("../conditionals/conditionals").JSONSchema;
|
|
104
108
|
isUndefined(): import("../conditionals/conditionals").JSONSchema;
|
|
105
109
|
inArray: (values: string[]) => import("../conditionals/conditionals").JSONSchema;
|
|
@@ -146,6 +150,10 @@ export declare function field(fieldId: string, options?: {
|
|
|
146
150
|
}, val2: {
|
|
147
151
|
$$field: string;
|
|
148
152
|
}): import("../conditionals/conditionals").JSONSchema;
|
|
153
|
+
isAbbreviation(): import("../conditionals/conditionals").JSONSchema;
|
|
154
|
+
isIllDefined(causesOfDeathFields: {
|
|
155
|
+
$$field: string;
|
|
156
|
+
}[], threshold: number): import("../conditionals/conditionals").JSONSchema;
|
|
149
157
|
isFalsy(): import("../conditionals/conditionals").JSONSchema;
|
|
150
158
|
isUndefined(): import("../conditionals/conditionals").JSONSchema;
|
|
151
159
|
inArray: (values: string[]) => import("../conditionals/conditionals").JSONSchema;
|
|
@@ -373,6 +373,35 @@ function createFieldConditionals(fieldId) {
|
|
|
373
373
|
}
|
|
374
374
|
});
|
|
375
375
|
},
|
|
376
|
+
isAbbreviation() {
|
|
377
|
+
return defineFormConditional({
|
|
378
|
+
type: "object",
|
|
379
|
+
properties: {
|
|
380
|
+
[fieldId]: { type: "string", isAbbreviation: true }
|
|
381
|
+
},
|
|
382
|
+
required: [fieldId]
|
|
383
|
+
});
|
|
384
|
+
},
|
|
385
|
+
isIllDefined(causesOfDeathFields, threshold) {
|
|
386
|
+
const fieldIds = causesOfDeathFields.map((field) => field.$$field);
|
|
387
|
+
const properties = fieldIds.reduce(
|
|
388
|
+
(acc, id) => {
|
|
389
|
+
acc[id] = { type: "string" };
|
|
390
|
+
return acc;
|
|
391
|
+
},
|
|
392
|
+
{}
|
|
393
|
+
);
|
|
394
|
+
return defineFormConditional({
|
|
395
|
+
type: "object",
|
|
396
|
+
properties,
|
|
397
|
+
required: fieldIds,
|
|
398
|
+
// Custom keyword or config (if used by your validator)
|
|
399
|
+
isIllDefined: {
|
|
400
|
+
fields: fieldIds,
|
|
401
|
+
threshold
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
},
|
|
376
405
|
/**
|
|
377
406
|
* Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
|
|
378
407
|
* @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
|