raain-app 3.2.2 → 3.2.5

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.
@@ -242,6 +242,9 @@ class RaainMapComponent {
242
242
  }
243
243
  possibleNewDefaultDate = this.defaultDate;
244
244
  }
245
+ if (changes.coordinates && this.mapElement?.mapLeaflet && this.coordinates) {
246
+ this.mapElement.mapLeaflet.setView([this.coordinates.lat, this.coordinates.lng], 10);
247
+ }
245
248
  if (changes.markers && this.mapElement?.markersLayer) {
246
249
  const { allMarkers } = this.buildMarkersConfig();
247
250
  const markersProduced = this.mapElement.updateMarkers(allMarkers);
@@ -787,8 +790,13 @@ class RaainConfigurationComponent {
787
790
  this.minPoint = { x: 0, y: 0 };
788
791
  this.maxPoint = { x: 300, y: 100 };
789
792
  this.logStyle = false;
793
+ this.readonly = false;
794
+ this.createTimer = null;
790
795
  this.onSizeChanged = () => { };
791
796
  this.onDrag = (e) => {
797
+ if (this.readonly) {
798
+ return false;
799
+ }
792
800
  this.changedPoints.emit(this.points);
793
801
  };
794
802
  }
@@ -818,7 +826,7 @@ class RaainConfigurationComponent {
818
826
  return;
819
827
  }
820
828
  this.created = true;
821
- let inputs = new ConfigurationElementInput(this.points, this.minPoint, this.maxPoint, false, [], this.onDrag);
829
+ let inputs = new ConfigurationElementInput(this.points, this.minPoint, this.maxPoint, false, [], this.onDrag, this.readonly);
822
830
  if (this.logStyle) {
823
831
  const confTransparency = 0.3;
824
832
  inputs = new ConfigurationElementInput(this.points, this.minPoint, this.maxPoint, true, [
@@ -887,21 +895,36 @@ class RaainConfigurationComponent {
887
895
  yStart: Math.log10(300),
888
896
  yEnd: Math.log10(500),
889
897
  },
890
- ], this.onDrag);
898
+ ], this.onDrag, this.readonly);
891
899
  }
892
900
  this.ngZone.runOutsideAngular(() => {
893
- setTimeout(() => {
901
+ this.createTimer = setTimeout(() => {
902
+ this.createTimer = null;
894
903
  const factory = new ElementsFactory();
895
904
  this.configurationElement = factory.createConfiguration(this.canvasElement.nativeElement, inputs);
896
905
  }, 10);
897
906
  });
898
907
  }
899
908
  async delete() {
909
+ if (this.createTimer) {
910
+ clearTimeout(this.createTimer);
911
+ this.createTimer = null;
912
+ }
900
913
  this.configurationElement?.chart?.destroy();
901
914
  this.created = false;
902
915
  }
903
916
  async change(changes) {
904
- // console.log('changed', changes);
917
+ // Fast path: update chart data in-place when only points changed
918
+ if (this.configurationElement?.chart &&
919
+ changes.points &&
920
+ Object.keys(changes).length === 1) {
921
+ const chart = this.configurationElement.chart;
922
+ chart.data.datasets.forEach((ds) => {
923
+ ds.data = this.points;
924
+ });
925
+ chart.update('none');
926
+ return;
927
+ }
905
928
  await this.delete();
906
929
  this.create();
907
930
  }
@@ -925,7 +948,7 @@ class RaainConfigurationComponent {
925
948
  }
926
949
  }
927
950
  RaainConfigurationComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: RaainConfigurationComponent, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
928
- RaainConfigurationComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: RaainConfigurationComponent, selector: "raain-configuration", inputs: { points: "points", currentHeight: "currentHeight", currentWidth: "currentWidth", minPoint: "minPoint", maxPoint: "maxPoint", logStyle: "logStyle" }, outputs: { changedPoints: "changedPoints" }, host: { listeners: { "window:resize": "onResize($event)" } }, viewQueries: [{ propertyName: "canvasElement", first: true, predicate: ["canvasElement"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<ion-grid>\n <ion-row>\n <ion-col id=\"col-container\" size-xs=\"10\">\n <div [style.height.px]=\"currentHeight\" id=\"canvas-container\">\n <canvas #canvasElement></canvas>\n </div>\n </ion-col>\n <ion-col size-xs=\"2\">\n <ion-button (click)=\"reset(2)\" color=\"light\" shape=\"round\" size=\"small\">2</ion-button>\n <br>\n <ion-button (click)=\"reset(4)\" color=\"light\" shape=\"round\" size=\"small\">4</ion-button>\n <br>\n <ion-button (click)=\"reset(6)\" color=\"light\" shape=\"round\" size=\"small\">6</ion-button>\n <br>\n </ion-col>\n </ion-row>\n</ion-grid>\n", styles: ["#canvas-container{position:relative;width:100%;height:100%}\n"], dependencies: [{ kind: "component", type: i4.IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }, { kind: "component", type: i4.IonCol, selector: "ion-col", inputs: ["offset", "offsetLg", "offsetMd", "offsetSm", "offsetXl", "offsetXs", "pull", "pullLg", "pullMd", "pullSm", "pullXl", "pullXs", "push", "pushLg", "pushMd", "pushSm", "pushXl", "pushXs", "size", "sizeLg", "sizeMd", "sizeSm", "sizeXl", "sizeXs"] }, { kind: "component", type: i4.IonGrid, selector: "ion-grid", inputs: ["fixed"] }, { kind: "component", type: i4.IonRow, selector: "ion-row" }] });
951
+ RaainConfigurationComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: RaainConfigurationComponent, selector: "raain-configuration", inputs: { points: "points", currentHeight: "currentHeight", currentWidth: "currentWidth", minPoint: "minPoint", maxPoint: "maxPoint", logStyle: "logStyle", readonly: "readonly" }, outputs: { changedPoints: "changedPoints" }, host: { listeners: { "window:resize": "onResize($event)" } }, viewQueries: [{ propertyName: "canvasElement", first: true, predicate: ["canvasElement"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<ion-grid>\n <ion-row>\n <ion-col id=\"col-container\" size-xs=\"10\">\n <div [style.height.px]=\"currentHeight\" id=\"canvas-container\">\n <canvas #canvasElement></canvas>\n </div>\n </ion-col>\n <ion-col size-xs=\"2\">\n <ion-button (click)=\"reset(2)\" color=\"light\" shape=\"round\" size=\"small\">2</ion-button>\n <br>\n <ion-button (click)=\"reset(4)\" color=\"light\" shape=\"round\" size=\"small\">4</ion-button>\n <br>\n <ion-button (click)=\"reset(6)\" color=\"light\" shape=\"round\" size=\"small\">6</ion-button>\n <br>\n </ion-col>\n </ion-row>\n</ion-grid>\n", styles: ["#canvas-container{position:relative;width:100%;height:100%}\n"], dependencies: [{ kind: "component", type: i4.IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }, { kind: "component", type: i4.IonCol, selector: "ion-col", inputs: ["offset", "offsetLg", "offsetMd", "offsetSm", "offsetXl", "offsetXs", "pull", "pullLg", "pullMd", "pullSm", "pullXl", "pullXs", "push", "pushLg", "pushMd", "pushSm", "pushXl", "pushXs", "size", "sizeLg", "sizeMd", "sizeSm", "sizeXl", "sizeXs"] }, { kind: "component", type: i4.IonGrid, selector: "ion-grid", inputs: ["fixed"] }, { kind: "component", type: i4.IonRow, selector: "ion-row" }] });
929
952
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: RaainConfigurationComponent, decorators: [{
930
953
  type: Component,
931
954
  args: [{ selector: 'raain-configuration', template: "<ion-grid>\n <ion-row>\n <ion-col id=\"col-container\" size-xs=\"10\">\n <div [style.height.px]=\"currentHeight\" id=\"canvas-container\">\n <canvas #canvasElement></canvas>\n </div>\n </ion-col>\n <ion-col size-xs=\"2\">\n <ion-button (click)=\"reset(2)\" color=\"light\" shape=\"round\" size=\"small\">2</ion-button>\n <br>\n <ion-button (click)=\"reset(4)\" color=\"light\" shape=\"round\" size=\"small\">4</ion-button>\n <br>\n <ion-button (click)=\"reset(6)\" color=\"light\" shape=\"round\" size=\"small\">6</ion-button>\n <br>\n </ion-col>\n </ion-row>\n</ion-grid>\n", styles: ["#canvas-container{position:relative;width:100%;height:100%}\n"] }]
@@ -943,6 +966,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
943
966
  type: Input
944
967
  }], logStyle: [{
945
968
  type: Input
969
+ }], readonly: [{
970
+ type: Input
946
971
  }], canvasElement: [{
947
972
  type: ViewChild,
948
973
  args: ['canvasElement']