@seniorsistemas/angular-components 17.3.4 → 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.
@@ -9052,8 +9052,15 @@
9052
9052
  return _this;
9053
9053
  }
9054
9054
  SliderFieldComponent.prototype.ngOnInit = function () {
9055
- var _this = this;
9056
9055
  var _a, _b;
9056
+ var defaultValue = ((_a = this.field) === null || _a === void 0 ? void 0 : _a.range) ? [this.field.min, this.field.max] : this.field.min;
9057
+ if (!this.isValid(this.formControl.value)) {
9058
+ this.formControl.setValue((_b = this.field.defaultValue) !== null && _b !== void 0 ? _b : defaultValue);
9059
+ }
9060
+ this.subscribeToFormControlEvents();
9061
+ };
9062
+ SliderFieldComponent.prototype.subscribeToFormControlEvents = function () {
9063
+ var _this = this;
9057
9064
  this.onChange.pipe(operators.takeUntil(this.ngUnsubscribe))
9058
9065
  .subscribe(function (event) {
9059
9066
  if (_this.field.onChange) {
@@ -9066,8 +9073,24 @@
9066
9073
  _this.field.onSlideEnd(event);
9067
9074
  }
9068
9075
  });
9069
- var values = ((_a = this.field) === null || _a === void 0 ? void 0 : _a.range) ? [this.field.min, this.field.max] : this.field.min;
9070
- this.formControl.setValue((_b = this.field.defaultValue) !== null && _b !== void 0 ? _b : values);
9076
+ };
9077
+ SliderFieldComponent.prototype.isValid = function (value) {
9078
+ var _a;
9079
+ if ((_a = this.field) === null || _a === void 0 ? void 0 : _a.range) {
9080
+ return Array.isArray(value) && this.isValidRange(value);
9081
+ }
9082
+ else {
9083
+ return Number.isInteger(value) && this.isValidNoRange(value);
9084
+ }
9085
+ };
9086
+ SliderFieldComponent.prototype.isValidRange = function (value) {
9087
+ var _a, _b, _c, _d;
9088
+ var _e = __read(value, 2), startValue = _e[0], endValue = _e[1];
9089
+ 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) &&
9090
+ endValue >= ((_c = this.field) === null || _c === void 0 ? void 0 : _c.min) && endValue <= ((_d = this.field) === null || _d === void 0 ? void 0 : _d.max);
9091
+ };
9092
+ SliderFieldComponent.prototype.isValidNoRange = function (value) {
9093
+ return value >= this.field.min && value <= this.field.max;
9071
9094
  };
9072
9095
  SliderFieldComponent.prototype.ngOnDestroy = function () {
9073
9096
  this.ngUnsubscribe.next();
@@ -15836,7 +15859,6 @@
15836
15859
  core.NgModule({
15837
15860
  imports: [
15838
15861
  common.CommonModule,
15839
- platformBrowser.BrowserModule,
15840
15862
  ],
15841
15863
  declarations: [
15842
15864
  TieredMenuDirective,