@opengeoweb/webmap 4.18.0 → 4.19.0

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.
package/index.esm.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { debounce, throttle } from 'throttle-debounce';
2
2
  import { compact } from 'lodash';
3
+ import { dateUtils } from '@opengeoweb/shared';
3
4
  import moment from 'moment';
4
5
  import proj4 from 'proj4';
5
6
 
@@ -2133,8 +2134,8 @@ var WMJSAnimate = /*#__PURE__*/function () {
2133
2134
  }
2134
2135
 
2135
2136
  _createClass(WMJSAnimate, [{
2136
- key: "_isCurrentAnimationTimeCloseToWallClockTime",
2137
- value: function _isCurrentAnimationTimeCloseToWallClockTime() {
2137
+ key: "isCurrentAnimationTimeCloseToWallClockTime",
2138
+ value: function isCurrentAnimationTimeCloseToWallClockTime() {
2138
2139
  if (this.isNextTimeCloseToWallClockTime) {
2139
2140
  this.isNextTimeCloseToWallClockTime = false;
2140
2141
  return true;
@@ -2142,13 +2143,13 @@ var WMJSAnimate = /*#__PURE__*/function () {
2142
2143
 
2143
2144
  var currentAnimationStep = this._map.animationList[this._map.currentAnimationStep];
2144
2145
  var nextAnimationStep = this._map.animationList[this._map.currentAnimationStep + 1 >= this._map.animationList.length ? 0 : this._map.currentAnimationStep + 1];
2145
- var wallClockTime = moment.utc();
2146
- var currentAnimationTime = moment.utc(currentAnimationStep.value);
2147
- var nextAnimationTime = moment.utc(nextAnimationStep.value);
2146
+ var wallClockTime = new Date();
2147
+ var currentAnimationTime = new Date(currentAnimationStep.value);
2148
+ var nextAnimationTime = new Date(nextAnimationStep.value);
2148
2149
 
2149
- if (wallClockTime.isBetween(currentAnimationTime, nextAnimationTime, undefined, '[)')) {
2150
- var timeDiff1 = moment.duration(currentAnimationTime.clone().diff(wallClockTime)).asMinutes();
2151
- var timeDiff2 = moment.duration(nextAnimationTime.clone().diff(wallClockTime)).asMinutes();
2150
+ if (dateUtils.isBetween(wallClockTime, currentAnimationTime, nextAnimationTime)) {
2151
+ var timeDiff1 = dateUtils.differenceInMinutes(currentAnimationTime, wallClockTime);
2152
+ var timeDiff2 = dateUtils.differenceInMinutes(nextAnimationTime, wallClockTime);
2152
2153
 
2153
2154
  if (Math.abs(timeDiff1) < Math.abs(timeDiff2)) {
2154
2155
  // Wall clock time is closer to current animation step time than to the next animation step time
@@ -2204,7 +2205,7 @@ var WMJSAnimate = /*#__PURE__*/function () {
2204
2205
  animationDelay *= 3;
2205
2206
  } else if (this._map.currentAnimationStep === this._map.animationList.length - 1) {
2206
2207
  animationDelay *= 5;
2207
- } else if (this._isCurrentAnimationTimeCloseToWallClockTime()) {
2208
+ } else if (this.isCurrentAnimationTimeCloseToWallClockTime()) {
2208
2209
  animationDelay *= 5;
2209
2210
  }
2210
2211
 
@@ -3526,15 +3527,17 @@ var WMJSDimension = /*#__PURE__*/function () {
3526
3527
  /* 1. Get the last value in the list of the referencetime */
3527
3528
 
3528
3529
 
3529
- var lastRefTimeAsMoment = moment.utc(referenceTimeDim.getLastValue());
3530
+ var lastRefTime = new Date(referenceTimeDim.getLastValue());
3530
3531
  /* 2. Get the original last value of the time dimension, we cannot use this.getLastValue(), as we are changing this. */
3531
3532
 
3532
- var timeLastValueAsMoment = moment.utc(this.values.split('/')[1]);
3533
+ var orgLastDimTime = new Date(this.values.split('/')[1]);
3533
3534
  /* 3. Now calculate the run length */
3534
3535
 
3535
- var runLengthAsHour = moment.duration(timeLastValueAsMoment.clone().diff(lastRefTimeAsMoment)).asHours();
3536
- var newStartValueTimeAsMoment = moment.utc(referenceTimeValueToSet);
3537
- var newEndValueTimeAsMoment = newStartValueTimeAsMoment.clone().add(runLengthAsHour, 'h');
3536
+ var runLengthAsHour = dateUtils.differenceInHours(orgLastDimTime, lastRefTime);
3537
+ var newStartValueTime = new Date(referenceTimeValueToSet);
3538
+ var newEndValueTime = dateUtils.add(new Date(newStartValueTime.getTime()), {
3539
+ hours: runLengthAsHour
3540
+ });
3538
3541
 
3539
3542
  if (this._type === 'timestartstopres') {
3540
3543
  /* Compose a new dataString interval and re-initialize the time dimension */
@@ -3542,14 +3545,14 @@ var WMJSDimension = /*#__PURE__*/function () {
3542
3545
  return value.trim();
3543
3546
  });
3544
3547
  var dateStringInterval = dateStringItems[2];
3545
- var newValue = "".concat(newStartValueTimeAsMoment.toISOString(), "/").concat(newEndValueTimeAsMoment.toISOString(), "/").concat(dateStringInterval);
3546
- this.defaultValue = newEndValueTimeAsMoment.toISOString();
3548
+ var newValue = "".concat(newStartValueTime.toISOString(), "/").concat(newEndValueTime.toISOString(), "/").concat(dateStringInterval);
3549
+ this.defaultValue = newEndValueTime.toISOString();
3547
3550
  this.reInitializeValues(newValue, true);
3548
3551
  } else if (this._type === 'timevalues') {
3549
3552
  /* Filter all dates from the array which are lower than given start value */
3550
3553
 
3551
3554
  /* TODO: Maarten Plieger 2020-06-10: Make this also work for WMS times advertised as a comma separated list */
3552
- var _newValue2 = parseISO8601DateToDate(newStartValueTimeAsMoment.toISOString());
3555
+ var _newValue2 = parseISO8601DateToDate(newStartValueTime.toISOString());
3553
3556
 
3554
3557
  var newArray = this._allDates.filter(function (x) {
3555
3558
  return x >= _newValue2;
package/index.umd.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('throttle-debounce'), require('lodash'), require('moment'), require('proj4')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'throttle-debounce', 'lodash', 'moment', 'proj4'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Webmap = {}, global.throttleDebounce, global.lodash, global.moment, global.proj4));
5
- })(this, (function (exports, throttleDebounce, lodash, moment, proj4) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('throttle-debounce'), require('lodash'), require('@opengeoweb/shared'), require('moment'), require('proj4')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'throttle-debounce', 'lodash', '@opengeoweb/shared', 'moment', 'proj4'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Webmap = {}, global.throttleDebounce, global.lodash, global.shared, global.moment, global.proj4));
5
+ })(this, (function (exports, throttleDebounce, lodash, shared, moment, proj4) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -2108,7 +2108,7 @@
2108
2108
  _map.checkAnimation = this.checkAnimation;
2109
2109
  }
2110
2110
 
2111
- WMJSAnimate.prototype._isCurrentAnimationTimeCloseToWallClockTime = function () {
2111
+ WMJSAnimate.prototype.isCurrentAnimationTimeCloseToWallClockTime = function () {
2112
2112
  if (this.isNextTimeCloseToWallClockTime) {
2113
2113
  this.isNextTimeCloseToWallClockTime = false;
2114
2114
  return true;
@@ -2116,13 +2116,13 @@
2116
2116
 
2117
2117
  var currentAnimationStep = this._map.animationList[this._map.currentAnimationStep];
2118
2118
  var nextAnimationStep = this._map.animationList[this._map.currentAnimationStep + 1 >= this._map.animationList.length ? 0 : this._map.currentAnimationStep + 1];
2119
- var wallClockTime = moment__default["default"].utc();
2120
- var currentAnimationTime = moment__default["default"].utc(currentAnimationStep.value);
2121
- var nextAnimationTime = moment__default["default"].utc(nextAnimationStep.value);
2119
+ var wallClockTime = new Date();
2120
+ var currentAnimationTime = new Date(currentAnimationStep.value);
2121
+ var nextAnimationTime = new Date(nextAnimationStep.value);
2122
2122
 
2123
- if (wallClockTime.isBetween(currentAnimationTime, nextAnimationTime, undefined, '[)')) {
2124
- var timeDiff1 = moment__default["default"].duration(currentAnimationTime.clone().diff(wallClockTime)).asMinutes();
2125
- var timeDiff2 = moment__default["default"].duration(nextAnimationTime.clone().diff(wallClockTime)).asMinutes();
2123
+ if (shared.dateUtils.isBetween(wallClockTime, currentAnimationTime, nextAnimationTime)) {
2124
+ var timeDiff1 = shared.dateUtils.differenceInMinutes(currentAnimationTime, wallClockTime);
2125
+ var timeDiff2 = shared.dateUtils.differenceInMinutes(nextAnimationTime, wallClockTime);
2126
2126
 
2127
2127
  if (Math.abs(timeDiff1) < Math.abs(timeDiff2)) {
2128
2128
  // Wall clock time is closer to current animation step time than to the next animation step time
@@ -2176,7 +2176,7 @@
2176
2176
  animationDelay *= 3;
2177
2177
  } else if (this._map.currentAnimationStep === this._map.animationList.length - 1) {
2178
2178
  animationDelay *= 5;
2179
- } else if (this._isCurrentAnimationTimeCloseToWallClockTime()) {
2179
+ } else if (this.isCurrentAnimationTimeCloseToWallClockTime()) {
2180
2180
  animationDelay *= 5;
2181
2181
  }
2182
2182
 
@@ -3531,15 +3531,17 @@
3531
3531
  /* 1. Get the last value in the list of the referencetime */
3532
3532
 
3533
3533
 
3534
- var lastRefTimeAsMoment = moment__default["default"].utc(referenceTimeDim.getLastValue());
3534
+ var lastRefTime = new Date(referenceTimeDim.getLastValue());
3535
3535
  /* 2. Get the original last value of the time dimension, we cannot use this.getLastValue(), as we are changing this. */
3536
3536
 
3537
- var timeLastValueAsMoment = moment__default["default"].utc(this.values.split('/')[1]);
3537
+ var orgLastDimTime = new Date(this.values.split('/')[1]);
3538
3538
  /* 3. Now calculate the run length */
3539
3539
 
3540
- var runLengthAsHour = moment__default["default"].duration(timeLastValueAsMoment.clone().diff(lastRefTimeAsMoment)).asHours();
3541
- var newStartValueTimeAsMoment = moment__default["default"].utc(referenceTimeValueToSet);
3542
- var newEndValueTimeAsMoment = newStartValueTimeAsMoment.clone().add(runLengthAsHour, 'h');
3540
+ var runLengthAsHour = shared.dateUtils.differenceInHours(orgLastDimTime, lastRefTime);
3541
+ var newStartValueTime = new Date(referenceTimeValueToSet);
3542
+ var newEndValueTime = shared.dateUtils.add(new Date(newStartValueTime.getTime()), {
3543
+ hours: runLengthAsHour
3544
+ });
3543
3545
 
3544
3546
  if (this._type === 'timestartstopres') {
3545
3547
  /* Compose a new dataString interval and re-initialize the time dimension */
@@ -3547,14 +3549,14 @@
3547
3549
  return value.trim();
3548
3550
  });
3549
3551
  var dateStringInterval = dateStringItems[2];
3550
- var newValue = newStartValueTimeAsMoment.toISOString() + "/" + newEndValueTimeAsMoment.toISOString() + "/" + dateStringInterval;
3551
- this.defaultValue = newEndValueTimeAsMoment.toISOString();
3552
+ var newValue = newStartValueTime.toISOString() + "/" + newEndValueTime.toISOString() + "/" + dateStringInterval;
3553
+ this.defaultValue = newEndValueTime.toISOString();
3552
3554
  this.reInitializeValues(newValue, true);
3553
3555
  } else if (this._type === 'timevalues') {
3554
3556
  /* Filter all dates from the array which are lower than given start value */
3555
3557
 
3556
3558
  /* TODO: Maarten Plieger 2020-06-10: Make this also work for WMS times advertised as a comma separated list */
3557
- var newValue_1 = parseISO8601DateToDate(newStartValueTimeAsMoment.toISOString());
3559
+ var newValue_1 = parseISO8601DateToDate(newStartValueTime.toISOString());
3558
3560
 
3559
3561
  var newArray = this._allDates.filter(function (x) {
3560
3562
  return x >= newValue_1;
@@ -6,7 +6,7 @@ export default class WMJSAnimate {
6
6
  private _imageStore;
7
7
  private isNextTimeCloseToWallClockTime;
8
8
  constructor(_map: WMJSMap);
9
- _isCurrentAnimationTimeCloseToWallClockTime(): boolean;
9
+ isCurrentAnimationTimeCloseToWallClockTime(): boolean;
10
10
  _animate(): void;
11
11
  _animateLoop(): void;
12
12
  checkAnimation(): void;
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/webmap",
3
- "version": "4.18.0",
3
+ "version": "4.19.0",
4
4
  "description": "GeoWeb webmap library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -12,9 +12,20 @@
12
12
  "typings": "./index.d.ts",
13
13
  "dependencies": {},
14
14
  "peerDependencies": {
15
- "moment": "^2.29.0",
15
+ "@opengeoweb/shared": "4.19.0",
16
+ "react": "^18.2.0",
17
+ "@mui/material": "^5.12.0",
18
+ "@opengeoweb/theme": "4.19.0",
19
+ "@mui/x-date-pickers": "^6.2.1",
20
+ "react-draggable": "^4.4.5",
21
+ "re-resizable": "^6.9.0",
22
+ "@redux-eggs/core": "^2.2.0",
23
+ "react-redux": "^8.0.4",
24
+ "lodash": "^4.17.20",
25
+ "axios": "^0.25.0",
26
+ "date-fns": "^2.29.3",
16
27
  "throttle-debounce": "^3.0.1",
17
- "proj4": "^2.6.2",
18
- "lodash": "^4.17.20"
28
+ "moment": "^2.29.0",
29
+ "proj4": "^2.6.2"
19
30
  }
20
31
  }