@sumaris-net/ngx-components 1.23.43 → 1.23.44

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.
@@ -21687,10 +21687,6 @@
21687
21687
  return null;
21688
21688
  return new Color([+parts[0], +parts[1], +parts[2]], parts.length === 4 && +parts[3] || 1, 'custom');
21689
21689
  };
21690
- Color.parseHexa = function (hexColor) {
21691
- var split = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hexColor);
21692
- return new Color(split ? split.slice(1, 4).map(function (i) { return parseInt(i, 16); }) : [0, 0, 0]);
21693
- };
21694
21690
  Object.defineProperty(Color.prototype, "name", {
21695
21691
  get: function () {
21696
21692
  return this._name;
@@ -21751,14 +21747,13 @@
21751
21747
  // @dynamic
21752
21748
  var ColorScale = /** @class */ (function () {
21753
21749
  function ColorScale(colorArray, options) {
21754
- this.colorArray = colorArray;
21755
21750
  options = options || {};
21756
21751
  // reserved last colors for value > max
21757
21752
  var nbIntervalBeforeUpper = !options.upperMax ? colorArray.length : (colorArray.length - 1);
21758
21753
  this._min = options.min || 0;
21759
21754
  this._max = options.max || nbIntervalBeforeUpper;
21760
21755
  this._rangeSize = Math.round((this._max - this._min) / nbIntervalBeforeUpper);
21761
- this._legendItems = this.computeLegend();
21756
+ this._legendItems = this.computeLegendItems(colorArray);
21762
21757
  }
21763
21758
  ColorScale.default = function () {
21764
21759
  return ColorScale.custom(25);
@@ -21793,17 +21788,20 @@
21793
21788
  enumerable: false,
21794
21789
  configurable: true
21795
21790
  });
21796
- ColorScale.prototype.getValueColor = function (value) {
21797
- var index = Math.floor(value * (this.colorArray.length - 1) / this._max);
21798
- return this.colorArray[index];
21791
+ ColorScale.prototype.getLegendForValue = function (value) {
21792
+ var index = Math.floor(value * (this._legendItems.length - 1) / this._max);
21793
+ return this._legendItems[index];
21794
+ };
21795
+ ColorScale.prototype.getLegendAtIndex = function (index) {
21796
+ return this._legendItems[index];
21799
21797
  };
21800
- ColorScale.prototype.computeLegend = function () {
21798
+ ColorScale.prototype.computeLegendItems = function (colorArray) {
21801
21799
  var _this = this;
21802
- return this.colorArray.map(function (color, index) {
21800
+ return colorArray.map(function (color, index) {
21803
21801
  var start = index * _this._rangeSize;
21804
21802
  var end = start + _this._rangeSize;
21805
21803
  return {
21806
- color: color,
21804
+ color: new Color(color),
21807
21805
  label: (end < _this._max) ? start.toLocaleString() + " - " + end.toLocaleString() : " >= " + start
21808
21806
  };
21809
21807
  });
@@ -21813,12 +21811,10 @@
21813
21811
  ColorScale.custom = function (count, options) {
21814
21812
  options = options || {};
21815
21813
  return new ColorScale(linearColorGradientWithIntermediate(count, {
21816
- opacity: options.opacity,
21817
21814
  startColor: options.startColor || undefined,
21818
21815
  mainColor: options.mainColor || undefined,
21819
21816
  mainColorIndex: isNotNil(options.mainColorIndex) ? options.mainColorIndex : undefined,
21820
- endColor: options.endColor || undefined,
21821
- format: options.format
21817
+ endColor: options.endColor || undefined
21822
21818
  }), options);
21823
21819
  };
21824
21820
  // Fill colorsMap
@@ -21826,29 +21822,6 @@
21826
21822
  .forEach(function (key) {
21827
21823
  colorsMap[key] = new Color(rgbArrayMap[key], 1, key);
21828
21824
  });
21829
- // Internal function
21830
- function state2side(state) {
21831
- switch (state) {
21832
- case 0:
21833
- return 0;
21834
- case 1:
21835
- return -1;
21836
- case 2:
21837
- return 0;
21838
- case 3:
21839
- return 1;
21840
- }
21841
- }
21842
- var ɵ0$b = function (defaultStateSize) { return [
21843
- Math.round((rgbArrayMap.red[0] - 50) / defaultStateSize),
21844
- Math.round((255 - rgbArrayMap.red[1]) / defaultStateSize),
21845
- Math.round((255 - rgbArrayMap.red[2]) / defaultStateSize)
21846
- ]; };
21847
- var SCALE_OPTIONS_DEFAULT = {
21848
- startColor: rgbArrayMap.red,
21849
- startStates: [0, 2, 3],
21850
- startStepsFn: ɵ0$b
21851
- };
21852
21825
  /**
21853
21826
  * Internal function, that create a colors scale, using iteration
21854
21827
  *
@@ -21861,34 +21834,26 @@
21861
21834
  function linearColorGradientWithIntermediate(count, options) {
21862
21835
  options = options || {};
21863
21836
  // From [0,1]
21864
- options.opacity = (options.opacity > 0 && options.opacity < 1) ? options.opacity : 1;
21865
21837
  options.startColor = options.startColor || [255, 255, 190]; // default start = creme
21866
21838
  options.mainColorIndex = options.mainColorIndex && options.mainColorIndex < count - 1 ? options.mainColorIndex : count - 1;
21867
21839
  options.endColor = options.endColor || [255, 0, 0]; // default main = red
21868
- options.format = options.format || 'rgb';
21869
21840
  if (!options.mainColor) {
21870
21841
  return linearColorGradient(count, {
21871
- opacity: options.opacity,
21872
21842
  startColor: options.startColor,
21873
- endColor: options.endColor,
21874
- format: options.format
21843
+ endColor: options.endColor
21875
21844
  });
21876
21845
  }
21877
21846
  else {
21878
21847
  // Step 1: startColor -> mainColor
21879
21848
  var result = linearColorGradient(options.mainColorIndex + 1, {
21880
- opacity: options.opacity,
21881
21849
  startColor: options.startColor,
21882
- endColor: options.mainColor,
21883
- format: options.format
21850
+ endColor: options.mainColor
21884
21851
  });
21885
21852
  // Step 2: mainColor -> endColor
21886
21853
  if (options.mainColorIndex < count - 1) {
21887
21854
  return result.concat(linearColorGradient(count - options.mainColorIndex, {
21888
- opacity: options.opacity,
21889
21855
  startColor: options.mainColor,
21890
- endColor: options.endColor,
21891
- format: options.format
21856
+ endColor: options.endColor
21892
21857
  }));
21893
21858
  }
21894
21859
  else {
@@ -21899,10 +21864,8 @@
21899
21864
  function linearColorGradient(count, options) {
21900
21865
  options = options || {};
21901
21866
  // From [0,1]
21902
- options.opacity = (options.opacity > 0 && options.opacity < 1) ? options.opacity : 1;
21903
21867
  options.startColor = options.startColor || [255, 255, 255]; // default start = white
21904
21868
  options.endColor = options.endColor || [255, 0, 0]; // default end = red
21905
- options.format = options.format || 'rgb';
21906
21869
  var result = [];
21907
21870
  var color = options.startColor.slice(); // copy the start color
21908
21871
  var delta = [
@@ -21919,23 +21882,6 @@
21919
21882
  // Force last color = end color
21920
21883
  result.push(options.endColor.slice());
21921
21884
  // Output as array
21922
- if (options.format === 'array') {
21923
- return result;
21924
- }
21925
- // Output as rgb(r,g,b) string
21926
- if (options.format === 'rgb') {
21927
- if (options.opacity >= 1) {
21928
- return result.map(function (color) { return 'rgb(' + color.join(',') + ')'; });
21929
- }
21930
- else {
21931
- return result.map(function (color) { return 'rgba(' + color.concat(options.opacity).join(',') + ')'; });
21932
- }
21933
- }
21934
- // Output as hex
21935
- // TODO
21936
- // return result.map(color => {
21937
- // return "rgb(" + color.join(',') + ")";
21938
- // });
21939
21885
  return result;
21940
21886
  }
21941
21887
 
@@ -33109,7 +33055,7 @@
33109
33055
  ];
33110
33056
  AdminModule.ctorParameters = function () { return []; };
33111
33057
 
33112
- var ɵ0$c = {
33058
+ var ɵ0$b = {
33113
33059
  profile: 'ADMIN'
33114
33060
  };
33115
33061
  var routes = [
@@ -33119,7 +33065,7 @@
33119
33065
  component: UsersPage,
33120
33066
  canActivate: [AuthGuardService],
33121
33067
  canDeactivate: [ComponentDirtyGuard],
33122
- data: ɵ0$c
33068
+ data: ɵ0$b
33123
33069
  }
33124
33070
  ];
33125
33071
  var AdminRoutingModule = /** @class */ (function () {