@openmrs/ngx-formentry 3.0.1-pre.156 → 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.
@@ -9116,8 +9116,8 @@
9116
9116
  */
9117
9117
  this.maxlength = null;
9118
9118
  /**
9119
- * Sets the min length attribute on the `input` element.
9120
- */
9119
+ * Sets the min length attribute on the `input` element.
9120
+ */
9121
9121
  this.minlength = null;
9122
9122
  /**
9123
9123
  * Sets the amount the number controls increment and decrement by.
@@ -9204,9 +9204,12 @@
9204
9204
  if (this.max === null || val + this.step <= this.max) {
9205
9205
  this.value = parseFloat((val + this.step).toPrecision(this.precision));
9206
9206
  }
9207
- else {
9207
+ if (this.max && this.max > 0 && this.value > this.max) {
9208
9208
  this.value = this.max;
9209
9209
  }
9210
+ if (this.max === undefined || this.max === '') {
9211
+ this.value = val + this.step;
9212
+ }
9210
9213
  this.emitChangeEvent();
9211
9214
  };
9212
9215
  /**
@@ -9217,9 +9220,12 @@
9217
9220
  if (this.min === null || val - this.step >= this.min) {
9218
9221
  this.value = parseFloat((val - this.step).toPrecision(this.precision));
9219
9222
  }
9220
- else {
9223
+ if (this.min && this.min > 0 && this.value < this.min) {
9221
9224
  this.value = this.min;
9222
9225
  }
9226
+ if (this.min === undefined || this.min === '') {
9227
+ this.value = val - this.step;
9228
+ }
9223
9229
  this.emitChangeEvent();
9224
9230
  };
9225
9231
  /**
@@ -9322,15 +9328,8 @@
9322
9328
  this.onTouched = function () { };
9323
9329
  }
9324
9330
  RadioButtonControlComponent.prototype.ngOnInit = function () {
9325
- var _this = this;
9326
9331
  this.options = this.options.map(function (opt) { return (Object.assign(Object.assign({}, opt), { checked: false })); });
9327
- if (Boolean(this.selected)) {
9328
- var maybeOpt = this.options.find(function (opt) { return opt.value === _this.selected; });
9329
- if (maybeOpt) {
9330
- Object.assign(maybeOpt, { checked: true });
9331
- this.value = this.selected;
9332
- }
9333
- }
9332
+ this.updateSelectedOption();
9334
9333
  };
9335
9334
  RadioButtonControlComponent.prototype.writeValue = function (value) {
9336
9335
  this.value = value;
@@ -9375,6 +9374,21 @@
9375
9374
  }
9376
9375
  this.onChange(this.value);
9377
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
+ };
9378
9392
  return RadioButtonControlComponent;
9379
9393
  }());
9380
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 });
@@ -9384,7 +9398,7 @@
9384
9398
  useExisting: i0.forwardRef(function () { return RadioButtonControlComponent; }),
9385
9399
  multi: true
9386
9400
  }
9387
- ], 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"] }] });
9388
9402
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RadioButtonControlComponent, decorators: [{
9389
9403
  type: i0.Component,
9390
9404
  args: [{
@@ -9686,7 +9700,8 @@
9686
9700
  var display = { text: '', _date: '' };
9687
9701
  if (this._node.question.renderingType === 'select' ||
9688
9702
  this._node.question.renderingType === 'multi-select' ||
9689
- this._node.question.renderingType === 'single-select') {
9703
+ this._node.question.renderingType === 'single-select' ||
9704
+ this._node.question.renderingType === 'radio') {
9690
9705
  display.text = this.historicalFieldHelper.getDisplayTextFromOptions(this._node.question, 'value', 'label');
9691
9706
  display._date = this._node.question.historicalDataValue.valueDate;
9692
9707
  this._node.question['historicalDisplay'] = display;