@ecrvs/opencrvs-toolkit 1.8.1-rc.3059ff8 → 1.8.1-rc.38c95b8
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 +6 -0
- package/dist/commons/conditionals/ill-defined.d.ts +2 -0
- package/dist/commons/events/field.d.ts +10 -0
- package/dist/conditionals/index.js +40 -0
- package/dist/events/index.js +1359 -1
- package/dist/notification/index.js +1359 -1
- package/package.json +1 -1
|
@@ -122,6 +122,9 @@ 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;
|
|
127
|
+
isValidChildName(): JSONSchema;
|
|
125
128
|
/**
|
|
126
129
|
* Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
|
|
127
130
|
* @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
|
|
@@ -167,6 +170,9 @@ export declare function createFieldConditionals(fieldId: string): {
|
|
|
167
170
|
isLessThan: (value: number | FieldReference) => JSONSchema;
|
|
168
171
|
isEqualTo(value: string | boolean | FieldReference): JSONSchema;
|
|
169
172
|
isEqualToSumOf(val1: FieldReference, val2: FieldReference): JSONSchema;
|
|
173
|
+
isAbbreviation(): JSONSchema;
|
|
174
|
+
isIllDefined(causesOfDeathFields: FieldReference[], threshold: number): JSONSchema;
|
|
175
|
+
isValidChildName(): JSONSchema;
|
|
170
176
|
/**
|
|
171
177
|
* Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
|
|
172
178
|
* @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
|
|
@@ -100,6 +100,11 @@ 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;
|
|
107
|
+
isValidChildName(): import("../conditionals/conditionals").JSONSchema;
|
|
103
108
|
isFalsy(): import("../conditionals/conditionals").JSONSchema;
|
|
104
109
|
isUndefined(): import("../conditionals/conditionals").JSONSchema;
|
|
105
110
|
inArray: (values: string[]) => import("../conditionals/conditionals").JSONSchema;
|
|
@@ -146,6 +151,11 @@ export declare function field(fieldId: string, options?: {
|
|
|
146
151
|
}, val2: {
|
|
147
152
|
$$field: string;
|
|
148
153
|
}): import("../conditionals/conditionals").JSONSchema;
|
|
154
|
+
isAbbreviation(): import("../conditionals/conditionals").JSONSchema;
|
|
155
|
+
isIllDefined(causesOfDeathFields: {
|
|
156
|
+
$$field: string;
|
|
157
|
+
}[], threshold: number): import("../conditionals/conditionals").JSONSchema;
|
|
158
|
+
isValidChildName(): import("../conditionals/conditionals").JSONSchema;
|
|
149
159
|
isFalsy(): import("../conditionals/conditionals").JSONSchema;
|
|
150
160
|
isUndefined(): import("../conditionals/conditionals").JSONSchema;
|
|
151
161
|
inArray: (values: string[]) => import("../conditionals/conditionals").JSONSchema;
|
|
@@ -373,6 +373,46 @@ 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, field) => {
|
|
389
|
+
acc[field] = { 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
|
+
},
|
|
405
|
+
isValidChildName() {
|
|
406
|
+
return defineFormConditional({
|
|
407
|
+
type: "object",
|
|
408
|
+
properties: {
|
|
409
|
+
[fieldId]: {
|
|
410
|
+
type: "string"
|
|
411
|
+
}
|
|
412
|
+
},
|
|
413
|
+
checkChildName: true
|
|
414
|
+
});
|
|
415
|
+
},
|
|
376
416
|
/**
|
|
377
417
|
* Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
|
|
378
418
|
* @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
|