@openmrs/ngx-formentry 3.0.1-pre.159 → 3.0.1-pre.169
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 +19 -10
- package/bundles/openmrs-ngx-formentry.umd.js.map +1 -1
- package/components/radio-button/radio.component.d.ts +4 -2
- package/esm2015/components/radio-button/radio.component.js +17 -9
- package/esm2015/form-entry/directives/historical-value.directive.js +3 -2
- package/fesm2015/openmrs-ngx-formentry.js +18 -9
- package/fesm2015/openmrs-ngx-formentry.js.map +1 -1
- package/package.json +1 -1
|
@@ -9328,15 +9328,8 @@
|
|
|
9328
9328
|
this.onTouched = function () { };
|
|
9329
9329
|
}
|
|
9330
9330
|
RadioButtonControlComponent.prototype.ngOnInit = function () {
|
|
9331
|
-
var _this = this;
|
|
9332
9331
|
this.options = this.options.map(function (opt) { return (Object.assign(Object.assign({}, opt), { checked: false })); });
|
|
9333
|
-
|
|
9334
|
-
var maybeOpt = this.options.find(function (opt) { return opt.value === _this.selected; });
|
|
9335
|
-
if (maybeOpt) {
|
|
9336
|
-
Object.assign(maybeOpt, { checked: true });
|
|
9337
|
-
this.value = this.selected;
|
|
9338
|
-
}
|
|
9339
|
-
}
|
|
9332
|
+
this.updateSelectedOption();
|
|
9340
9333
|
};
|
|
9341
9334
|
RadioButtonControlComponent.prototype.writeValue = function (value) {
|
|
9342
9335
|
this.value = value;
|
|
@@ -9381,6 +9374,21 @@
|
|
|
9381
9374
|
}
|
|
9382
9375
|
this.onChange(this.value);
|
|
9383
9376
|
};
|
|
9377
|
+
RadioButtonControlComponent.prototype.ngOnChanges = function (changes) {
|
|
9378
|
+
if (changes.selected) {
|
|
9379
|
+
this.updateSelectedOption();
|
|
9380
|
+
}
|
|
9381
|
+
};
|
|
9382
|
+
RadioButtonControlComponent.prototype.updateSelectedOption = function () {
|
|
9383
|
+
var _this = this;
|
|
9384
|
+
if (this.selected) {
|
|
9385
|
+
var maybeOpt_1 = this.options.find(function (opt) { return opt.value === _this.selected; });
|
|
9386
|
+
if (maybeOpt_1) {
|
|
9387
|
+
this.options.forEach(function (opt) { return opt.checked = opt === maybeOpt_1; });
|
|
9388
|
+
this.value = this.selected;
|
|
9389
|
+
}
|
|
9390
|
+
}
|
|
9391
|
+
};
|
|
9384
9392
|
return RadioButtonControlComponent;
|
|
9385
9393
|
}());
|
|
9386
9394
|
RadioButtonControlComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RadioButtonControlComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
@@ -9390,7 +9398,7 @@
|
|
|
9390
9398
|
useExisting: i0.forwardRef(function () { return RadioButtonControlComponent; }),
|
|
9391
9399
|
multi: true
|
|
9392
9400
|
}
|
|
9393
|
-
], ngImport: i0__namespace, template: "<fieldset class=\"cds--fieldset\">\n <div\n *ngFor=\"let option of options; let i = index\"\n class=\"cds--form-item cds--radio-wrapper\"\n [ngClass]=\"{'inline': orientation === 'horizontal'}\"\n >\n <label class=\"form-control no-border\">\n <input\n type=\"radio\"\n [id]=\"id + '_' + i\"\n [name]=\"id\"\n [checked]=\"option.checked\"\n [value]=\"option.value\"\n (click)=\"handleClick(option)\"\n (change)=\"handleChange(option)\"\n />\n {{ option.label }}\n </label>\n </div>\n</fieldset>\n", styles: [".inline{display:inline-block;padding-right:.5rem}\n"], directives: [{ type: i1__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
9401
|
+
], usesOnChanges: true, ngImport: i0__namespace, template: "<fieldset class=\"cds--fieldset\">\n <div\n *ngFor=\"let option of options; let i = index\"\n class=\"cds--form-item cds--radio-wrapper\"\n [ngClass]=\"{'inline': orientation === 'horizontal'}\"\n >\n <label class=\"form-control no-border\">\n <input\n type=\"radio\"\n [id]=\"id + '_' + i\"\n [name]=\"id\"\n [checked]=\"option.checked\"\n [value]=\"option.value\"\n (click)=\"handleClick(option)\"\n (change)=\"handleChange(option)\"\n />\n {{ option.label }}\n </label>\n </div>\n</fieldset>\n", styles: [".inline{display:inline-block;padding-right:.5rem}\n"], directives: [{ type: i1__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
9394
9402
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RadioButtonControlComponent, decorators: [{
|
|
9395
9403
|
type: i0.Component,
|
|
9396
9404
|
args: [{
|
|
@@ -9692,7 +9700,8 @@
|
|
|
9692
9700
|
var display = { text: '', _date: '' };
|
|
9693
9701
|
if (this._node.question.renderingType === 'select' ||
|
|
9694
9702
|
this._node.question.renderingType === 'multi-select' ||
|
|
9695
|
-
this._node.question.renderingType === 'single-select'
|
|
9703
|
+
this._node.question.renderingType === 'single-select' ||
|
|
9704
|
+
this._node.question.renderingType === 'radio') {
|
|
9696
9705
|
display.text = this.historicalFieldHelper.getDisplayTextFromOptions(this._node.question, 'value', 'label');
|
|
9697
9706
|
display._date = this._node.question.historicalDataValue.valueDate;
|
|
9698
9707
|
this._node.question['historicalDisplay'] = display;
|