@seniorsistemas/angular-components 17.3.5 → 17.3.6

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.
@@ -8906,8 +8906,15 @@ var SliderFieldComponent = /** @class */ (function (_super) {
8906
8906
  return _this;
8907
8907
  }
8908
8908
  SliderFieldComponent.prototype.ngOnInit = function () {
8909
- var _this = this;
8910
8909
  var _a, _b;
8910
+ var defaultValue = ((_a = this.field) === null || _a === void 0 ? void 0 : _a.range) ? [this.field.min, this.field.max] : this.field.min;
8911
+ if (!this.isValid(this.formControl.value)) {
8912
+ this.formControl.setValue((_b = this.field.defaultValue) !== null && _b !== void 0 ? _b : defaultValue);
8913
+ }
8914
+ this.subscribeToFormControlEvents();
8915
+ };
8916
+ SliderFieldComponent.prototype.subscribeToFormControlEvents = function () {
8917
+ var _this = this;
8911
8918
  this.onChange.pipe(takeUntil(this.ngUnsubscribe))
8912
8919
  .subscribe(function (event) {
8913
8920
  if (_this.field.onChange) {
@@ -8920,8 +8927,24 @@ var SliderFieldComponent = /** @class */ (function (_super) {
8920
8927
  _this.field.onSlideEnd(event);
8921
8928
  }
8922
8929
  });
8923
- var values = ((_a = this.field) === null || _a === void 0 ? void 0 : _a.range) ? [this.field.min, this.field.max] : this.field.min;
8924
- this.formControl.setValue((_b = this.field.defaultValue) !== null && _b !== void 0 ? _b : values);
8930
+ };
8931
+ SliderFieldComponent.prototype.isValid = function (value) {
8932
+ var _a;
8933
+ if ((_a = this.field) === null || _a === void 0 ? void 0 : _a.range) {
8934
+ return Array.isArray(value) && this.isValidRange(value);
8935
+ }
8936
+ else {
8937
+ return Number.isInteger(value) && this.isValidNoRange(value);
8938
+ }
8939
+ };
8940
+ SliderFieldComponent.prototype.isValidRange = function (value) {
8941
+ var _a, _b, _c, _d;
8942
+ var _e = __read(value, 2), startValue = _e[0], endValue = _e[1];
8943
+ return startValue >= ((_a = this.field) === null || _a === void 0 ? void 0 : _a.min) && startValue <= ((_b = this.field) === null || _b === void 0 ? void 0 : _b.max) &&
8944
+ endValue >= ((_c = this.field) === null || _c === void 0 ? void 0 : _c.min) && endValue <= ((_d = this.field) === null || _d === void 0 ? void 0 : _d.max);
8945
+ };
8946
+ SliderFieldComponent.prototype.isValidNoRange = function (value) {
8947
+ return value >= this.field.min && value <= this.field.max;
8925
8948
  };
8926
8949
  SliderFieldComponent.prototype.ngOnDestroy = function () {
8927
8950
  this.ngUnsubscribe.next();