andoncloud-map-widget 1.0.5 → 1.0.6

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/dist/index.css CHANGED
@@ -1,6 +1,20 @@
1
1
  @import '~leaflet/dist/leaflet.css';
2
2
  @import '~leaflet-draw/dist/leaflet.draw.css';
3
3
 
4
+ @keyframes pulse {
5
+ 0% {
6
+ stroke: #155ed1;
7
+ }
8
+
9
+ 70% {
10
+ stroke: transparent;
11
+ }
12
+
13
+ 100% {
14
+ stroke: #155ed1;
15
+ }
16
+ }
17
+
4
18
  .leaflet-container {
5
19
  height: 100%;
6
20
  }
@@ -66,8 +80,15 @@
66
80
  padding: 0.5em 1em;
67
81
  font-weight: 600;
68
82
  color: white;
69
- border-radius: 1em;
70
- background: #333333;
83
+ box-shadow: none;
84
+ text-shadow: 0px 0px 6px rgba(0, 0, 0, 1);
85
+ border: none;
86
+ background: transparent;
87
+ }
88
+
89
+ .leaflet-path-draggable {
90
+ stroke-dasharray: 10;
91
+ animation: pulse 2s infinite;
71
92
  }
72
93
 
73
94
  .leaflet-contextmenu {
@@ -1 +1 @@
1
- {"version":3,"sources":["index.css","leaflet.contextmenu.css"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,6CAA6C;;AAE7C;EACE,YAAY;AACd;;AAEA;EACE,YAAY;AACd;;AAEA;EACE,4BAA4B;EAC5B,cAAc;EACd,sCAAsC;EACtC,sBAAsB;AACxB;;AAEA;EACE,cAAc;EACd,sBAAsB;EACtB,oBAAoB;AACtB;;AAEA;EACE,aAAa;EACb,UAAU;EACV,YAAY;EACZ,mBAAmB;AACrB;;AAEA;EACE,oBAAoB;EACpB,yBAAyB;AAC3B;;AAEA;EACE,aAAa;AACf;;AAEA;EACE,aAAa;EACb,mBAAmB;AACrB;;AAEA;EACE,SAAS;EACT,gBAAgB;EAChB,aAAa;AACf;;AAEA;EACE,oBAAoB;AACtB;;AAEA;EACE,6BAA6B;AAC/B;;AAEA;EACE,gBAAgB;EAChB,6BAA6B;AAC/B;;AAEA;EACE,kBAAkB;EAClB,gBAAgB;EAChB,YAAY;EACZ,kBAAkB;EAClB,mBAAmB;AACrB;;ACtEA;IACI,aAAa;IACb,qCAAqC;IAErC,kBAAkB;IAClB,cAAc;IACd,sBAAsB;IACtB,eAAe;IACf,yBAAyB;IACzB,sBAAsB;IACtB,iBAAiB;AACrB;;AAEA;IACI,cAAc;IACd,WAAW;IACX,eAAe;IACf,iBAAiB;IACjB,qBAAqB;IACrB,eAAe;IACf,iCAAiC;IACjC,oCAAoC;IACpC,eAAe;IACf,aAAa;AACjB;;AAEA;IACI,YAAY;AAChB;;AAEA;IACI,yBAAyB;IACzB,6BAA6B;IAC7B,gCAAgC;AACpC;;AAEA;IACI,yBAAyB;IACzB,iCAAiC;IACjC,oCAAoC;AACxC;;AAEA;IACI,mBAAmB;IACnB,WAAW;IACX,YAAY;IACZ,WAAW;IACX,SAAS;AACb;;AAEA;IACI,6BAA6B;IAC7B,aAAa;AACjB","file":"index.css","sourcesContent":["@import '~leaflet/dist/leaflet.css';\n@import '~leaflet-draw/dist/leaflet.draw.css';\n\n.leaflet-container {\n height: 100%;\n}\n\n.leaflet-touch .leaflet-bar {\n border: none;\n}\n\n.leaflet-bar a {\n line-height: 27px !important;\n color: #333333;\n border: 0.5px solid rgba(0, 0, 0, 0.1);\n background-color: #ccc;\n}\n\n.leaflet-bar a:hover {\n color: #333333;\n background-color: #ccc;\n filter: opacity(0.9);\n}\n\n.leaflet-top {\n display: flex;\n width: 50%;\n height: 50px;\n background: #333333;\n}\n\n.leaflet-right {\n display: inline-flex;\n justify-content: flex-end;\n}\n\n.leaflet-control-attribution.leaflet-control {\n display: none;\n}\n\n.leaflet-draw {\n height: 100vh;\n background: #333333;\n}\n\n.leaflet-draw.leaflet-control {\n margin: 0;\n margin-top: 50px;\n padding: 10px;\n}\n\n.leaflet-control-zoom {\n display: inline-flex;\n}\n\n.leaflet-control-zoom-in {\n border-radius: 2px !important;\n}\n\n.leaflet-control-zoom-out {\n margin-left: 2px;\n border-radius: 2px !important;\n}\n\n.leaflet-tooltip {\n padding: 0.5em 1em;\n font-weight: 600;\n color: white;\n border-radius: 1em;\n background: #333333;\n}\n",".leaflet-contextmenu {\n display: none;\n box-shadow: 0 1px 7px rgba(0,0,0,0.4);\n -webkit-border-radius: 4px;\n border-radius: 4px;\n padding: 4px 0;\n background-color: #fff;\n cursor: default;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n}\n\n.leaflet-contextmenu a.leaflet-contextmenu-item {\n display: block;\n color: #222;\n font-size: 12px;\n line-height: 20px;\n text-decoration: none;\n padding: 0 12px;\n border-top: 1px solid transparent;\n border-bottom: 1px solid transparent;\n cursor: default;\n outline: none;\n}\n\n.leaflet-contextmenu a.leaflet-contextmenu-item-disabled {\n opacity: 0.5;\n}\n\n.leaflet-contextmenu a.leaflet-contextmenu-item.over {\n background-color: #f4f4f4;\n border-top: 1px solid #f0f0f0;\n border-bottom: 1px solid #f0f0f0;\n}\n\n.leaflet-contextmenu a.leaflet-contextmenu-item-disabled.over {\n background-color: inherit;\n border-top: 1px solid transparent;\n border-bottom: 1px solid transparent;\n}\n\n.leaflet-contextmenu-icon {\n margin: 2px 8px 0 0;\n width: 16px;\n height: 16px;\n float: left;\n border: 0;\n}\n\n.leaflet-contextmenu-separator {\n border-bottom: 1px solid #ccc;\n margin: 5px 0;\n}\n"]}
1
+ {"version":3,"sources":["index.css","leaflet.contextmenu.css"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,6CAA6C;;AAE7C;CACC;IACG,eAAe;CAClB;;CAEA;IACG,mBAAmB;CACtB;;CAEA;IACG,eAAe;CAClB;AACD;;AAEA;EACE,YAAY;AACd;;AAEA;EACE,YAAY;AACd;;AAEA;EACE,4BAA4B;EAC5B,cAAc;EACd,sCAAsC;EACtC,sBAAsB;AACxB;;AAEA;EACE,cAAc;EACd,sBAAsB;EACtB,oBAAoB;AACtB;;AAEA;EACE,aAAa;EACb,UAAU;EACV,YAAY;EACZ,mBAAmB;AACrB;;AAEA;EACE,oBAAoB;EACpB,yBAAyB;AAC3B;;AAEA;EACE,aAAa;AACf;;AAEA;EACE,aAAa;EACb,mBAAmB;AACrB;;AAEA;EACE,SAAS;EACT,gBAAgB;EAChB,aAAa;AACf;;AAEA;EACE,oBAAoB;AACtB;;AAEA;EACE,6BAA6B;AAC/B;;AAEA;EACE,gBAAgB;EAChB,6BAA6B;AAC/B;;AAEA;EACE,kBAAkB;EAClB,gBAAgB;EAChB,YAAY;EACZ,gBAAgB;EAChB,yCAAyC;EACzC,YAAY;EACZ,uBAAuB;AACzB;;AAEA;EACE,oBAAoB;EACpB,4BAA4B;AAC9B;;AC3FA;IACI,aAAa;IACb,qCAAqC;IAErC,kBAAkB;IAClB,cAAc;IACd,sBAAsB;IACtB,eAAe;IACf,yBAAyB;IACzB,sBAAsB;IACtB,iBAAiB;AACrB;;AAEA;IACI,cAAc;IACd,WAAW;IACX,eAAe;IACf,iBAAiB;IACjB,qBAAqB;IACrB,eAAe;IACf,iCAAiC;IACjC,oCAAoC;IACpC,eAAe;IACf,aAAa;AACjB;;AAEA;IACI,YAAY;AAChB;;AAEA;IACI,yBAAyB;IACzB,6BAA6B;IAC7B,gCAAgC;AACpC;;AAEA;IACI,yBAAyB;IACzB,iCAAiC;IACjC,oCAAoC;AACxC;;AAEA;IACI,mBAAmB;IACnB,WAAW;IACX,YAAY;IACZ,WAAW;IACX,SAAS;AACb;;AAEA;IACI,6BAA6B;IAC7B,aAAa;AACjB","file":"index.css","sourcesContent":["@import '~leaflet/dist/leaflet.css';\n@import '~leaflet-draw/dist/leaflet.draw.css';\n\n@keyframes pulse {\n\t0% {\n stroke: #155ed1;\n\t}\n\n\t70% {\n stroke: transparent;\n\t}\n\n\t100% {\n stroke: #155ed1;\n\t}\n}\n\n.leaflet-container {\n height: 100%;\n}\n\n.leaflet-touch .leaflet-bar {\n border: none;\n}\n\n.leaflet-bar a {\n line-height: 27px !important;\n color: #333333;\n border: 0.5px solid rgba(0, 0, 0, 0.1);\n background-color: #ccc;\n}\n\n.leaflet-bar a:hover {\n color: #333333;\n background-color: #ccc;\n filter: opacity(0.9);\n}\n\n.leaflet-top {\n display: flex;\n width: 50%;\n height: 50px;\n background: #333333;\n}\n\n.leaflet-right {\n display: inline-flex;\n justify-content: flex-end;\n}\n\n.leaflet-control-attribution.leaflet-control {\n display: none;\n}\n\n.leaflet-draw {\n height: 100vh;\n background: #333333;\n}\n\n.leaflet-draw.leaflet-control {\n margin: 0;\n margin-top: 50px;\n padding: 10px;\n}\n\n.leaflet-control-zoom {\n display: inline-flex;\n}\n\n.leaflet-control-zoom-in {\n border-radius: 2px !important;\n}\n\n.leaflet-control-zoom-out {\n margin-left: 2px;\n border-radius: 2px !important;\n}\n\n.leaflet-tooltip {\n padding: 0.5em 1em;\n font-weight: 600;\n color: white;\n box-shadow: none;\n text-shadow: 0px 0px 6px rgba(0, 0, 0, 1);\n border: none;\n background: transparent;\n}\n\n.leaflet-path-draggable {\n stroke-dasharray: 10;\n animation: pulse 2s infinite;\n}\n",".leaflet-contextmenu {\n display: none;\n box-shadow: 0 1px 7px rgba(0,0,0,0.4);\n -webkit-border-radius: 4px;\n border-radius: 4px;\n padding: 4px 0;\n background-color: #fff;\n cursor: default;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n}\n\n.leaflet-contextmenu a.leaflet-contextmenu-item {\n display: block;\n color: #222;\n font-size: 12px;\n line-height: 20px;\n text-decoration: none;\n padding: 0 12px;\n border-top: 1px solid transparent;\n border-bottom: 1px solid transparent;\n cursor: default;\n outline: none;\n}\n\n.leaflet-contextmenu a.leaflet-contextmenu-item-disabled {\n opacity: 0.5;\n}\n\n.leaflet-contextmenu a.leaflet-contextmenu-item.over {\n background-color: #f4f4f4;\n border-top: 1px solid #f0f0f0;\n border-bottom: 1px solid #f0f0f0;\n}\n\n.leaflet-contextmenu a.leaflet-contextmenu-item-disabled.over {\n background-color: inherit;\n border-top: 1px solid transparent;\n border-bottom: 1px solid transparent;\n}\n\n.leaflet-contextmenu-icon {\n margin: 2px 8px 0 0;\n width: 16px;\n height: 16px;\n float: left;\n border: 0;\n}\n\n.leaflet-contextmenu-separator {\n border-bottom: 1px solid #ccc;\n margin: 5px 0;\n}\n"]}
package/dist/index.js CHANGED
@@ -2294,6 +2294,7 @@ var Interpolator = function () {
2294
2294
  while (match = this.nestingRegexp.exec(str)) {
2295
2295
  var formatters = [];
2296
2296
  clonedOptions = _objectSpread$3({}, options);
2297
+ clonedOptions = clonedOptions.replace && typeof clonedOptions.replace !== 'string' ? clonedOptions.replace : clonedOptions;
2297
2298
  clonedOptions.applyPostProcessor = false;
2298
2299
  delete clonedOptions.defaultValue;
2299
2300
  var doReduce = false;
@@ -3150,7 +3151,14 @@ var I18n = function (_EventEmitter) {
3150
3151
  options.ns = options.ns || fixedT.ns;
3151
3152
  options.keyPrefix = options.keyPrefix || keyPrefix || fixedT.keyPrefix;
3152
3153
  var keySeparator = _this5.options.keySeparator || '.';
3153
- var resultKey = options.keyPrefix ? "".concat(options.keyPrefix).concat(keySeparator).concat(key) : key;
3154
+ var resultKey;
3155
+ if (options.keyPrefix && Array.isArray(key)) {
3156
+ resultKey = key.map(function (k) {
3157
+ return "".concat(options.keyPrefix).concat(keySeparator).concat(k);
3158
+ });
3159
+ } else {
3160
+ resultKey = options.keyPrefix ? "".concat(options.keyPrefix).concat(keySeparator).concat(key) : key;
3161
+ }
3154
3162
  return _this5.t(resultKey, options);
3155
3163
  };
3156
3164
  if (typeof lng === 'string') {
@@ -4320,7 +4328,7 @@ function hasMultilineItems(maybeArray) {
4320
4328
  return maybeArray != null && maybeArray.some(isMultiline);
4321
4329
  }
4322
4330
 
4323
- var LIBRARY_VERSION = '1.0.5';
4331
+ var LIBRARY_VERSION = '1.0.6';
4324
4332
 
4325
4333
  var SettingsFormContent = function SettingsFormContent(_ref) {
4326
4334
  var _data$floorPlans;
@@ -22247,6 +22255,9 @@ var Map$1 = function Map(_ref) {
22247
22255
  var _useState4 = React.useState(null),
22248
22256
  activeLayer = _useState4[0],
22249
22257
  setActiveLayer = _useState4[1];
22258
+ var _useState5 = React.useState(false),
22259
+ viewChanged = _useState5[0],
22260
+ setViewChanged = _useState5[1];
22250
22261
  // use refs to provide current values to callbacks
22251
22262
  var updateFeatureRef = React.useRef();
22252
22263
  var onDrawCreatedRef = React.useRef();
@@ -22256,6 +22267,15 @@ var Map$1 = function Map(_ref) {
22256
22267
  var editModeRef = React.useRef(!!editMode);
22257
22268
  var _useTranslation = useTranslation(),
22258
22269
  t = _useTranslation.t;
22270
+ if (mapRef.current) {
22271
+ var map = mapRef.current;
22272
+ map.on('zoomend', function () {
22273
+ setViewChanged(true);
22274
+ });
22275
+ map.on('moveend', function () {
22276
+ setViewChanged(true);
22277
+ });
22278
+ }
22259
22279
  var createFeature = React.useCallback(function (feature) {
22260
22280
  try {
22261
22281
  var _temp2 = function () {
@@ -22401,7 +22421,10 @@ var Map$1 = function Map(_ref) {
22401
22421
  }, [data == null ? void 0 : data.workplaces]);
22402
22422
  var setControlsDisplay = React.useCallback(function (value) {
22403
22423
  if (featureGroup) {
22404
- document.getElementsByClassName('leaflet-control-container')[0].style['display'] = value ? 'block' : 'none';
22424
+ var containers = document.getElementsByClassName('leaflet-control-container');
22425
+ Array.from(containers).forEach(function (container) {
22426
+ container.style['display'] = value ? 'block' : 'none';
22427
+ });
22405
22428
  }
22406
22429
  }, [featureGroup]);
22407
22430
  var onDrawCreated = React.useCallback(function (layer) {
@@ -22477,15 +22500,9 @@ var Map$1 = function Map(_ref) {
22477
22500
  featureGroup == null ? void 0 : featureGroup.eachLayer(function (layer) {
22478
22501
  var tooltip = layer.getTooltip();
22479
22502
  if (layer === activeLayer) {
22480
- layer.setStyle({
22481
- color: '#155ed1'
22482
- });
22483
22503
  // @ts-ignore no typings
22484
22504
  layer.dragging.enable();
22485
22505
  } else {
22486
- layer.setStyle({
22487
- color: layer.options.fillColor
22488
- });
22489
22506
  // @ts-ignore no typings
22490
22507
  layer.dragging.disable();
22491
22508
  if (tooltip) {
@@ -22617,14 +22634,15 @@ var Map$1 = function Map(_ref) {
22617
22634
  };
22618
22635
  var saveMapView = function saveMapView() {
22619
22636
  try {
22620
- var map = mapRef.current;
22637
+ var _map = mapRef.current;
22621
22638
  var _temp16 = function () {
22622
- if (map && updateSettings) {
22639
+ if (_map && updateSettings) {
22623
22640
  return Promise.resolve(updateSettings({
22624
- zoom: map.getZoom(),
22625
- center: map.getCenter()
22641
+ zoom: _map.getZoom(),
22642
+ center: _map.getCenter()
22626
22643
  })).then(function () {
22627
22644
  setActiveLayer(null);
22645
+ setViewChanged(false);
22628
22646
  });
22629
22647
  }
22630
22648
  }();
@@ -22741,7 +22759,8 @@ var Map$1 = function Map(_ref) {
22741
22759
  color: "primary",
22742
22760
  onClick: function onClick() {
22743
22761
  return saveMapView();
22744
- }
22762
+ },
22763
+ disabled: !viewChanged
22745
22764
  }, React__default["default"].createElement(Trans, {
22746
22765
  t: t
22747
22766
  }, "Freeze")))));
@@ -22832,7 +22851,8 @@ var Widget = function Widget(_ref) {
22832
22851
  data: widgetData,
22833
22852
  WidgetView: WidgetView,
22834
22853
  SettingsFormContent: SettingsFormContent,
22835
- version: LIBRARY_VERSION
22854
+ version: LIBRARY_VERSION,
22855
+ "data-testid": "map-widget"
22836
22856
  }, widgetProps));
22837
22857
  };
22838
22858