@ardium-ui/ui 5.0.0-alpha.34 → 5.0.0-alpha.35

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.
@@ -10088,18 +10088,29 @@ class _AbstractSlider extends _NgModelComponentBase {
10088
10088
  return newArr.map(v => `${v}%`);
10089
10089
  });
10090
10090
  //! labels
10091
+ this._transformLabelInput = (labels) => {
10092
+ if (!isDefined(labels)) {
10093
+ return [];
10094
+ }
10095
+ if (typeof labels === 'string') {
10096
+ labels = coerceArrayProperty(labels).map(Number);
10097
+ }
10098
+ if (labels[0] && typeof labels[0] === 'number') {
10099
+ return labels.map(label => ({ label, value: label }));
10100
+ }
10101
+ return labels;
10102
+ };
10091
10103
  this.labelPosition = input(this._DEFAULTS.labelPosition);
10092
- this.labels = input(this._DEFAULTS.labels);
10104
+ this.labels = input(this._transformLabelInput(this._DEFAULTS.labels), { transform: v => this._transformLabelInput(v) });
10093
10105
  this.labelObjects = computed(() => {
10094
10106
  const v = this.labels();
10095
10107
  if (!isDefined(v) || v.length === 0) {
10096
10108
  return [];
10097
10109
  }
10098
10110
  return v.map(label => {
10099
- const obj = isObject(label) ? label : { label, for: label };
10100
- const v = this._clampValue(obj.for);
10111
+ const v = this._clampValue(label.value);
10101
10112
  return {
10102
- label: String(obj.label),
10113
+ label: String(label.label),
10103
10114
  positionPercent: `${this._valueToPercent(v) * 100}%`,
10104
10115
  };
10105
10116
  });
@@ -10145,7 +10156,10 @@ class _AbstractSlider extends _NgModelComponentBase {
10145
10156
  this.renderer.removeClass(this.document.body, 'ard-body-slider-handle-grabbed');
10146
10157
  }
10147
10158
  });
10148
- this.handlePositionsPercent = computed(() => [this._handlePositions()[0] * 100 + '%', this._handlePositions()[1] * 100 + '%']);
10159
+ this.handlePositionsPercent = computed(() => [
10160
+ this._handlePositions()[0] * 100 + '%',
10161
+ this._handlePositions()[1] * 100 + '%',
10162
+ ]);
10149
10163
  }
10150
10164
  set value(newValue) {
10151
10165
  this.writeValue(newValue);