eru-grid 0.0.39 → 0.0.40

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.
@@ -6563,7 +6563,24 @@ class ProgressComponent {
6563
6563
  if (!Array.isArray(ranges) || ranges.length === 0)
6564
6564
  return null;
6565
6565
  const v = this.displayValue();
6566
- const match = ranges.find((r) => v >= Number(r?.from) && v <= Number(r?.to));
6566
+ // A blank/absent bound is open-ended data-model bands are authored that
6567
+ // way (e.g. "80 and above"), and coercing null to 0 would make such a band
6568
+ // never match. Bands are checked in order; the first hit wins.
6569
+ const bound = (raw) => {
6570
+ if (raw === null || raw === undefined || raw === '')
6571
+ return null;
6572
+ const n = Number(raw);
6573
+ return isNaN(n) ? null : n;
6574
+ };
6575
+ const match = ranges.find((r) => {
6576
+ const from = bound(r?.from);
6577
+ const to = bound(r?.to);
6578
+ if (from !== null && v < from)
6579
+ return false;
6580
+ if (to !== null && v > to)
6581
+ return false;
6582
+ return true;
6583
+ });
6567
6584
  return match?.color || null;
6568
6585
  }, ...(ngDevMode ? [{ debugName: "barColor" }] : []));
6569
6586
  constructor() {
@@ -10902,28 +10919,37 @@ class ColumnDesignPanelComponent {
10902
10919
  this.patch(key, items);
10903
10920
  }
10904
10921
  // ── Range-colour-list control (value ranges -> colour, e.g. progress) ──
10922
+ // A blank bound means open-ended and is preserved as null rather than coerced
10923
+ // to 0 — bands authored on the data-model field ("80 and above") come through
10924
+ // here for display, and 0 would both read wrong and change their meaning.
10925
+ rangeBound(raw) {
10926
+ if (raw === null || raw === undefined || raw === '')
10927
+ return null;
10928
+ const n = Number(raw);
10929
+ return isNaN(n) ? null : n;
10930
+ }
10905
10931
  rangeListItems(key) {
10906
10932
  const arr = this.field()?.[key];
10907
10933
  if (!Array.isArray(arr))
10908
10934
  return [];
10909
10935
  return arr.map(it => ({
10910
- from: Number(it?.from) || 0,
10911
- to: Number(it?.to) || 0,
10936
+ from: this.rangeBound(it?.from),
10937
+ to: this.rangeBound(it?.to),
10912
10938
  color: it?.color ?? '#22C55E',
10913
10939
  }));
10914
10940
  }
10915
10941
  addRangeItem(key) {
10916
10942
  const items = this.rangeListItems(key);
10917
- const lastTo = items.length ? items[items.length - 1].to : -1;
10918
- const from = Math.min(100, lastTo + 1);
10943
+ const lastTo = items.length ? items[items.length - 1].to : null;
10944
+ const from = lastTo === null ? 0 : Math.min(100, lastTo + 1);
10919
10945
  this.patch(key, [...items, { from, to: 100, color: '#22C55E' }]);
10920
10946
  }
10921
10947
  removeRangeItem(key, index) {
10922
10948
  this.patch(key, this.rangeListItems(key).filter((_, i) => i !== index));
10923
10949
  }
10924
10950
  onRangeChange(key, index, prop, value) {
10925
- const num = value === '' ? 0 : Number(value);
10926
- const items = this.rangeListItems(key).map((it, i) => i === index ? { ...it, [prop]: num } : it);
10951
+ const bound = this.rangeBound(value);
10952
+ const items = this.rangeListItems(key).map((it, i) => i === index ? { ...it, [prop]: bound } : it);
10927
10953
  this.patch(key, items);
10928
10954
  }
10929
10955
  onRangeColorChange(key, index, color) {