@cashub/ui 0.19.1 → 0.19.3
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/map/index.js +0 -8
- package/map/subComponent/GoogleMapPopup.js +79 -71
- package/package.json +1 -1
package/map/index.js
CHANGED
|
@@ -3,12 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "DrawControl", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _DrawControl.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
6
|
Object.defineProperty(exports, "GoogleMap", {
|
|
13
7
|
enumerable: true,
|
|
14
8
|
get: function get() {
|
|
@@ -24,8 +18,6 @@ Object.defineProperty(exports, "LeafletMap", {
|
|
|
24
18
|
|
|
25
19
|
var _LeafletMap = _interopRequireDefault(require("./LeafletMap"));
|
|
26
20
|
|
|
27
|
-
var _DrawControl = _interopRequireDefault(require("./DrawControl"));
|
|
28
|
-
|
|
29
21
|
var _GoogleMap = _interopRequireDefault(require("./GoogleMap"));
|
|
30
22
|
|
|
31
23
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -7,12 +7,6 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
9
9
|
|
|
10
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
11
|
-
|
|
12
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
13
|
-
|
|
14
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
15
|
-
|
|
16
10
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
17
11
|
|
|
18
12
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
@@ -29,94 +23,108 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
|
29
23
|
|
|
30
24
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
31
25
|
|
|
26
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
27
|
+
|
|
28
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
29
|
+
|
|
30
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
31
|
+
|
|
32
32
|
// custom popup
|
|
33
33
|
// https://developers.google.com/maps/documentation/javascript/examples/overlay-popup
|
|
34
|
-
var GoogleMapPopup = /*#__PURE__*/function (
|
|
35
|
-
|
|
34
|
+
var GoogleMapPopup = /*#__PURE__*/_createClass(function GoogleMapPopup(options) {
|
|
35
|
+
_classCallCheck(this, GoogleMapPopup);
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
// wrap class to prevent cannot reference maps during bundler / compile stage
|
|
38
|
+
// because google map library will load after render map only
|
|
39
|
+
var MapPopup = /*#__PURE__*/function (_window$google$maps$O) {
|
|
40
|
+
_inherits(MapPopup, _window$google$maps$O);
|
|
38
41
|
|
|
39
|
-
|
|
40
|
-
var _this;
|
|
42
|
+
var _super = _createSuper(MapPopup);
|
|
41
43
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
offset = _ref.offset;
|
|
44
|
+
function MapPopup() {
|
|
45
|
+
var _this;
|
|
45
46
|
|
|
46
|
-
|
|
47
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
48
|
+
maxWidth = _ref.maxWidth,
|
|
49
|
+
offset = _ref.offset;
|
|
47
50
|
|
|
48
|
-
|
|
51
|
+
_classCallCheck(this, MapPopup);
|
|
49
52
|
|
|
50
|
-
|
|
53
|
+
_this = _super.call(this); // This zero-height div is positioned at the bottom of the tip.
|
|
51
54
|
|
|
52
|
-
|
|
55
|
+
_defineProperty(_assertThisInitialized(_this), "position", void 0);
|
|
53
56
|
|
|
54
|
-
|
|
57
|
+
_defineProperty(_assertThisInitialized(_this), "containerDiv", void 0);
|
|
55
58
|
|
|
56
|
-
|
|
59
|
+
_defineProperty(_assertThisInitialized(_this), "offset", 16);
|
|
57
60
|
|
|
58
|
-
|
|
61
|
+
_this.containerDiv = document.createElement('div');
|
|
59
62
|
|
|
60
|
-
|
|
61
|
-
_this.containerDiv.style.maxWidth = "".concat(maxWidth, "px");
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
if (offset) {
|
|
65
|
-
_this.offset = offset;
|
|
66
|
-
} // Optionally stop clicks, etc., from bubbling up to the map.
|
|
63
|
+
_this.containerDiv.classList.add('google-popup-content-wrapper');
|
|
67
64
|
|
|
65
|
+
if (maxWidth) {
|
|
66
|
+
_this.containerDiv.style.maxWidth = "".concat(maxWidth, "px");
|
|
67
|
+
}
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
/** Called when the popup is added to the map. */
|
|
69
|
+
if (offset) {
|
|
70
|
+
_this.offset = offset;
|
|
71
|
+
} // Optionally stop clicks, etc., from bubbling up to the map.
|
|
73
72
|
|
|
74
73
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
value: function onAdd() {
|
|
78
|
-
this.getPanes().floatPane.appendChild(this.containerDiv);
|
|
74
|
+
MapPopup.preventMapHitsAndGesturesFrom(_this.containerDiv);
|
|
75
|
+
return _this;
|
|
79
76
|
}
|
|
80
|
-
/** Called when the popup is
|
|
77
|
+
/** Called when the popup is added to the map. */
|
|
81
78
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
this.
|
|
79
|
+
|
|
80
|
+
_createClass(MapPopup, [{
|
|
81
|
+
key: "onAdd",
|
|
82
|
+
value: function onAdd() {
|
|
83
|
+
this.getPanes().floatPane.appendChild(this.containerDiv);
|
|
87
84
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
this.containerDiv.style.left = "".concat(divPosition.x, "px");
|
|
97
|
-
this.containerDiv.style.top = "".concat(divPosition.y - this.offset, "px");
|
|
85
|
+
/** Called when the popup is removed from the map. */
|
|
86
|
+
|
|
87
|
+
}, {
|
|
88
|
+
key: "onRemove",
|
|
89
|
+
value: function onRemove() {
|
|
90
|
+
if (this.containerDiv.parentElement) {
|
|
91
|
+
this.containerDiv.parentElement.removeChild(this.containerDiv);
|
|
92
|
+
}
|
|
98
93
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
if (_typeof(content) === 'object') {
|
|
111
|
-
this.containerDiv.replaceChildren(content);
|
|
112
|
-
} else {
|
|
113
|
-
this.containerDiv.innerHTML = content;
|
|
94
|
+
/** Called each frame when the popup needs to draw itself. */
|
|
95
|
+
|
|
96
|
+
}, {
|
|
97
|
+
key: "draw",
|
|
98
|
+
value: function draw() {
|
|
99
|
+
if (this.position) {
|
|
100
|
+
var divPosition = this.getProjection().fromLatLngToDivPixel(this.position);
|
|
101
|
+
this.containerDiv.style.left = "".concat(divPosition.x, "px");
|
|
102
|
+
this.containerDiv.style.top = "".concat(divPosition.y - this.offset, "px");
|
|
103
|
+
}
|
|
114
104
|
}
|
|
115
|
-
}
|
|
116
|
-
|
|
105
|
+
}, {
|
|
106
|
+
key: "setPosition",
|
|
107
|
+
value: function setPosition(position) {
|
|
108
|
+
this.position = position;
|
|
109
|
+
}
|
|
110
|
+
}, {
|
|
111
|
+
key: "setContent",
|
|
112
|
+
value: function setContent(content) {
|
|
113
|
+
if (!content) return;
|
|
114
|
+
|
|
115
|
+
if (_typeof(content) === 'object') {
|
|
116
|
+
this.containerDiv.replaceChildren(content);
|
|
117
|
+
} else {
|
|
118
|
+
this.containerDiv.innerHTML = content;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}]);
|
|
122
|
+
|
|
123
|
+
return MapPopup;
|
|
124
|
+
}(window.google.maps.OverlayView);
|
|
117
125
|
|
|
118
|
-
return
|
|
119
|
-
}
|
|
126
|
+
return new MapPopup(options);
|
|
127
|
+
});
|
|
120
128
|
|
|
121
129
|
var _default = GoogleMapPopup;
|
|
122
130
|
exports.default = _default;
|