@openmrs/ngx-formentry 3.1.2-pre.186 → 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 +29 -5
- 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/fesm2015/openmrs-ngx-formentry.js +29 -5
- 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);
|
|
@@ -2650,6 +2656,7 @@
|
|
|
2650
2656
|
var disabler = {
|
|
2651
2657
|
toDisable: false,
|
|
2652
2658
|
disableWhenExpression: question.disable,
|
|
2659
|
+
resetValueOnDisable: question.resetValueOnDisable,
|
|
2653
2660
|
reEvaluateDisablingExpression: function () {
|
|
2654
2661
|
var result = runnable.run();
|
|
2655
2662
|
disabler.toDisable = result;
|
|
@@ -10218,7 +10225,9 @@
|
|
|
10218
10225
|
}
|
|
10219
10226
|
};
|
|
10220
10227
|
FormRendererComponent.prototype.hasErrors = function () {
|
|
10221
|
-
return this.node.control.touched &&
|
|
10228
|
+
return (this.node.control.touched &&
|
|
10229
|
+
!this.node.control.valid &&
|
|
10230
|
+
this.node.control.disablers.length === 0);
|
|
10222
10231
|
};
|
|
10223
10232
|
FormRendererComponent.prototype.errors = function () {
|
|
10224
10233
|
return this.getErrors(this.node);
|
|
@@ -13563,7 +13572,8 @@
|
|
|
13563
13572
|
question.renderingType = 'remote-select';
|
|
13564
13573
|
question.validators = this.addValidators(schemaQuestion);
|
|
13565
13574
|
question.extras = schemaQuestion;
|
|
13566
|
-
question.dataSource =
|
|
13575
|
+
question.dataSource =
|
|
13576
|
+
schemaQuestion.questionOptions.dataSource || 'diagnoses';
|
|
13567
13577
|
var mappings = {
|
|
13568
13578
|
label: 'label',
|
|
13569
13579
|
required: 'required',
|
|
@@ -13855,6 +13865,14 @@
|
|
|
13855
13865
|
if (typeof schemaQuestion.disable === 'object') {
|
|
13856
13866
|
question.disable = schemaQuestion.disable.disableWhenExpression;
|
|
13857
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
|
+
}
|
|
13858
13876
|
if (!!schemaQuestion.hide) {
|
|
13859
13877
|
question.hide = schemaQuestion.hide;
|
|
13860
13878
|
}
|
|
@@ -13875,6 +13893,12 @@
|
|
|
13875
13893
|
}
|
|
13876
13894
|
return '_' + s;
|
|
13877
13895
|
};
|
|
13896
|
+
QuestionFactory.prototype.isEmpty = function (value) {
|
|
13897
|
+
if (value === '' || value === null || value === undefined) {
|
|
13898
|
+
return true;
|
|
13899
|
+
}
|
|
13900
|
+
return false;
|
|
13901
|
+
};
|
|
13878
13902
|
return QuestionFactory;
|
|
13879
13903
|
}());
|
|
13880
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 });
|