@ecrvs/opencrvs-toolkit 1.8.1-rc.b48c48d → 1.8.1-rc.fb8610c
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 +2 -2
- package/dist/commons/events/field.d.ts +2 -6
- package/dist/conditionals/index.js +8 -23
- package/dist/events/index.js +959 -33
- package/dist/notification/index.js +959 -33
- package/package.json +1 -1
|
@@ -122,7 +122,7 @@ 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
|
-
|
|
125
|
+
isAbbreviation(): JSONSchema;
|
|
126
126
|
/**
|
|
127
127
|
* Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
|
|
128
128
|
* @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
|
|
@@ -168,7 +168,7 @@ export declare function createFieldConditionals(fieldId: string): {
|
|
|
168
168
|
isLessThan: (value: number | FieldReference) => JSONSchema;
|
|
169
169
|
isEqualTo(value: string | boolean | FieldReference): JSONSchema;
|
|
170
170
|
isEqualToSumOf(val1: FieldReference, val2: FieldReference): JSONSchema;
|
|
171
|
-
|
|
171
|
+
isAbbreviation(): JSONSchema;
|
|
172
172
|
/**
|
|
173
173
|
* Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
|
|
174
174
|
* @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
|
|
@@ -100,9 +100,7 @@ export declare function field(fieldId: string, options?: {
|
|
|
100
100
|
}, val2: {
|
|
101
101
|
$$field: string;
|
|
102
102
|
}): import("../conditionals/conditionals").JSONSchema;
|
|
103
|
-
|
|
104
|
-
$$field: string;
|
|
105
|
-
}): import("../conditionals/conditionals").JSONSchema;
|
|
103
|
+
isAbbreviation(): import("../conditionals/conditionals").JSONSchema;
|
|
106
104
|
isFalsy(): import("../conditionals/conditionals").JSONSchema;
|
|
107
105
|
isUndefined(): import("../conditionals/conditionals").JSONSchema;
|
|
108
106
|
inArray: (values: string[]) => import("../conditionals/conditionals").JSONSchema;
|
|
@@ -149,9 +147,7 @@ export declare function field(fieldId: string, options?: {
|
|
|
149
147
|
}, val2: {
|
|
150
148
|
$$field: string;
|
|
151
149
|
}): import("../conditionals/conditionals").JSONSchema;
|
|
152
|
-
|
|
153
|
-
$$field: string;
|
|
154
|
-
}): import("../conditionals/conditionals").JSONSchema;
|
|
150
|
+
isAbbreviation(): import("../conditionals/conditionals").JSONSchema;
|
|
155
151
|
isFalsy(): import("../conditionals/conditionals").JSONSchema;
|
|
156
152
|
isUndefined(): import("../conditionals/conditionals").JSONSchema;
|
|
157
153
|
inArray: (values: string[]) => import("../conditionals/conditionals").JSONSchema;
|
|
@@ -367,34 +367,19 @@ function createFieldConditionals(fieldId) {
|
|
|
367
367
|
},
|
|
368
368
|
required: [fieldId, field1Id, field2Id],
|
|
369
369
|
sumOf: {
|
|
370
|
-
sum:
|
|
371
|
-
field1:
|
|
372
|
-
field2:
|
|
370
|
+
sum: fieldId,
|
|
371
|
+
field1: field1Id,
|
|
372
|
+
field2: field2Id
|
|
373
373
|
}
|
|
374
374
|
});
|
|
375
375
|
},
|
|
376
|
-
|
|
377
|
-
const fieldSchema = { type: "number" };
|
|
378
|
-
const properties = {};
|
|
379
|
-
const required = [fieldId];
|
|
380
|
-
if (typeof value === "number") {
|
|
381
|
-
fieldSchema.minimum = value;
|
|
382
|
-
} else {
|
|
383
|
-
let refField = "";
|
|
384
|
-
if (isFieldReference(value)) {
|
|
385
|
-
refField = value.$$field;
|
|
386
|
-
} else {
|
|
387
|
-
refField = value;
|
|
388
|
-
}
|
|
389
|
-
fieldSchema.minimum = { $data: `/$form/${refField}` };
|
|
390
|
-
properties[refField] = { type: "number" };
|
|
391
|
-
required.push(refField);
|
|
392
|
-
}
|
|
393
|
-
properties[fieldId] = fieldSchema;
|
|
376
|
+
isAbbreviation() {
|
|
394
377
|
return defineFormConditional({
|
|
395
378
|
type: "object",
|
|
396
|
-
properties
|
|
397
|
-
|
|
379
|
+
properties: {
|
|
380
|
+
[fieldId]: { type: "string", isAbbreviation: true }
|
|
381
|
+
},
|
|
382
|
+
required: [fieldId]
|
|
398
383
|
});
|
|
399
384
|
},
|
|
400
385
|
/**
|