@openmrs/ngx-formentry 3.1.2-pre.183 → 3.1.2-pre.189
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/bundles/openmrs-ngx-formentry.umd.js +39 -7
- package/bundles/openmrs-ngx-formentry.umd.js.map +1 -1
- package/esm2015/abstract-controls-extension/afe-form-array.js +4 -2
- package/esm2015/abstract-controls-extension/afe-form-control.js +4 -2
- package/esm2015/abstract-controls-extension/afe-form-group.js +4 -2
- package/esm2015/form-entry/control-hiders-disablers/can-disable.js +1 -1
- package/esm2015/form-entry/form-factory/hiders-disablers.factory.js +2 -1
- package/esm2015/form-entry/form-factory/question.factory.js +17 -2
- package/esm2015/form-entry/form-renderer/form-renderer.component.js +4 -2
- package/esm2015/form-entry/question-models/interfaces/base-options.js +1 -1
- package/esm2015/form-entry/question-models/question-base.js +1 -1
- package/esm2015/form-entry/validators/max.validator.js +6 -2
- package/esm2015/form-entry/validators/min.validator.js +6 -2
- package/fesm2015/openmrs-ngx-formentry.js +39 -7
- package/fesm2015/openmrs-ngx-formentry.js.map +1 -1
- package/form-entry/control-hiders-disablers/can-disable.d.ts +1 -0
- package/form-entry/form-factory/question.factory.d.ts +1 -0
- package/form-entry/question-models/interfaces/base-options.d.ts +1 -0
- package/form-entry/question-models/question-base.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1358,7 +1358,9 @@
|
|
|
1358
1358
|
});
|
|
1359
1359
|
AfeFormControl.prototype.disable = function (param) {
|
|
1360
1360
|
_super.prototype.disable.call(this, param);
|
|
1361
|
-
|
|
1361
|
+
if (this.disablers.some(function (disabler) { return disabler.resetValueOnDisable === true; })) {
|
|
1362
|
+
_super.prototype.setValue.call(this, '');
|
|
1363
|
+
}
|
|
1362
1364
|
};
|
|
1363
1365
|
AfeFormControl.prototype.hide = function () {
|
|
1364
1366
|
this.hiderHelper.hideControl(this);
|
|
@@ -1445,7 +1447,9 @@
|
|
|
1445
1447
|
};
|
|
1446
1448
|
AfeFormGroup.prototype.disable = function (param) {
|
|
1447
1449
|
_super.prototype.disable.call(this, param);
|
|
1448
|
-
|
|
1450
|
+
if (this.disablers.some(function (disabler) { return disabler.resetValueOnDisable === true; })) {
|
|
1451
|
+
_super.prototype.setValue.call(this, {});
|
|
1452
|
+
}
|
|
1449
1453
|
};
|
|
1450
1454
|
AfeFormGroup.prototype.setHidingFn = function (newHider) {
|
|
1451
1455
|
this.hiderHelper.setHiderForControl(this, newHider);
|
|
@@ -1524,7 +1528,9 @@
|
|
|
1524
1528
|
};
|
|
1525
1529
|
AfeFormArray.prototype.disable = function (param) {
|
|
1526
1530
|
_super.prototype.disable.call(this, param);
|
|
1527
|
-
|
|
1531
|
+
if (this.disablers.some(function (disabler) { return disabler.resetValueOnDisable === true; })) {
|
|
1532
|
+
_super.prototype.setValue.call(this, []);
|
|
1533
|
+
}
|
|
1528
1534
|
};
|
|
1529
1535
|
AfeFormArray.prototype.setHidingFn = function (newHider) {
|
|
1530
1536
|
this.hiderHelper.setHiderForControl(this, newHider);
|
|
@@ -2267,7 +2273,11 @@
|
|
|
2267
2273
|
if (control.hidden) {
|
|
2268
2274
|
return null;
|
|
2269
2275
|
}
|
|
2270
|
-
|
|
2276
|
+
// Case 1: control.value is a number
|
|
2277
|
+
// all the numbers should be passed for validation
|
|
2278
|
+
// Case 2: control.value is not a number:
|
|
2279
|
+
// if its empty string or null or undefined it will return false else it will pass through for validation
|
|
2280
|
+
if (typeof control.value === 'number' || control.value) {
|
|
2271
2281
|
var v = control.value;
|
|
2272
2282
|
return v >= min
|
|
2273
2283
|
? null
|
|
@@ -2287,7 +2297,11 @@
|
|
|
2287
2297
|
if (control.hidden) {
|
|
2288
2298
|
return null;
|
|
2289
2299
|
}
|
|
2290
|
-
|
|
2300
|
+
// Case 1: control.value is a number
|
|
2301
|
+
// all the numbers should be passed for validation
|
|
2302
|
+
// Case 2: control.value is not a number:
|
|
2303
|
+
// if its empty string or null or undefined it will return false else it will pass through for validation
|
|
2304
|
+
if (typeof control.value === 'number' || control.value) {
|
|
2291
2305
|
var v = control.value;
|
|
2292
2306
|
return v <= max
|
|
2293
2307
|
? null
|
|
@@ -2642,6 +2656,7 @@
|
|
|
2642
2656
|
var disabler = {
|
|
2643
2657
|
toDisable: false,
|
|
2644
2658
|
disableWhenExpression: question.disable,
|
|
2659
|
+
resetValueOnDisable: question.resetValueOnDisable,
|
|
2645
2660
|
reEvaluateDisablingExpression: function () {
|
|
2646
2661
|
var result = runnable.run();
|
|
2647
2662
|
disabler.toDisable = result;
|
|
@@ -10210,7 +10225,9 @@
|
|
|
10210
10225
|
}
|
|
10211
10226
|
};
|
|
10212
10227
|
FormRendererComponent.prototype.hasErrors = function () {
|
|
10213
|
-
return this.node.control.touched &&
|
|
10228
|
+
return (this.node.control.touched &&
|
|
10229
|
+
!this.node.control.valid &&
|
|
10230
|
+
this.node.control.disablers.length === 0);
|
|
10214
10231
|
};
|
|
10215
10232
|
FormRendererComponent.prototype.errors = function () {
|
|
10216
10233
|
return this.getErrors(this.node);
|
|
@@ -13555,7 +13572,8 @@
|
|
|
13555
13572
|
question.renderingType = 'remote-select';
|
|
13556
13573
|
question.validators = this.addValidators(schemaQuestion);
|
|
13557
13574
|
question.extras = schemaQuestion;
|
|
13558
|
-
question.dataSource =
|
|
13575
|
+
question.dataSource =
|
|
13576
|
+
schemaQuestion.questionOptions.dataSource || 'diagnoses';
|
|
13559
13577
|
var mappings = {
|
|
13560
13578
|
label: 'label',
|
|
13561
13579
|
required: 'required',
|
|
@@ -13847,6 +13865,14 @@
|
|
|
13847
13865
|
if (typeof schemaQuestion.disable === 'object') {
|
|
13848
13866
|
question.disable = schemaQuestion.disable.disableWhenExpression;
|
|
13849
13867
|
}
|
|
13868
|
+
if (schemaQuestion.disable) {
|
|
13869
|
+
//if resetValueOnDisable doesn't exist on the config or no value is provided the default value will be passed (true)
|
|
13870
|
+
question.resetValueOnDisable =
|
|
13871
|
+
!schemaQuestion.hasOwnProperty('resetValueOnDisable') ||
|
|
13872
|
+
this.isEmpty(schemaQuestion.resetValueOnDisable)
|
|
13873
|
+
? true
|
|
13874
|
+
: schemaQuestion.resetValueOnDisable;
|
|
13875
|
+
}
|
|
13850
13876
|
if (!!schemaQuestion.hide) {
|
|
13851
13877
|
question.hide = schemaQuestion.hide;
|
|
13852
13878
|
}
|
|
@@ -13867,6 +13893,12 @@
|
|
|
13867
13893
|
}
|
|
13868
13894
|
return '_' + s;
|
|
13869
13895
|
};
|
|
13896
|
+
QuestionFactory.prototype.isEmpty = function (value) {
|
|
13897
|
+
if (value === '' || value === null || value === undefined) {
|
|
13898
|
+
return true;
|
|
13899
|
+
}
|
|
13900
|
+
return false;
|
|
13901
|
+
};
|
|
13870
13902
|
return QuestionFactory;
|
|
13871
13903
|
}());
|
|
13872
13904
|
QuestionFactory.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: QuestionFactory, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|