@antv/l7-component 2.18.2 → 2.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/es/assets/iconfont/iconfont.js +46 -0
- package/es/constants/index.d.ts +60 -0
- package/es/constants/index.js +60 -0
- package/es/control/baseControl/buttonControl.d.ts +59 -0
- package/es/control/baseControl/buttonControl.js +177 -0
- package/es/control/baseControl/control.d.ts +112 -0
- package/es/control/baseControl/control.js +302 -0
- package/es/control/baseControl/index.d.ts +4 -0
- package/es/control/baseControl/index.js +4 -0
- package/es/control/baseControl/popperControl.d.ts +26 -0
- package/es/control/baseControl/popperControl.js +120 -0
- package/es/control/baseControl/selectControl.d.ts +46 -0
- package/es/control/baseControl/selectControl.js +204 -0
- package/es/control/exportImage.d.ts +18 -0
- package/es/control/exportImage.js +159 -0
- package/es/control/fullscreen.d.ts +19 -0
- package/es/control/fullscreen.js +119 -0
- package/es/control/geoLocate.d.ts +16 -0
- package/es/control/geoLocate.js +107 -0
- package/es/control/layerSwitch.d.ts +19 -0
- package/es/control/layerSwitch.js +141 -0
- package/es/control/logo.d.ts +13 -0
- package/es/control/logo.js +75 -0
- package/es/control/mapTheme.d.ts +10 -0
- package/es/control/mapTheme.js +110 -0
- package/es/control/mouseLocation.d.ts +15 -0
- package/es/control/mouseLocation.js +83 -0
- package/es/control/scale.d.ts +34 -0
- package/es/control/scale.js +149 -0
- package/es/control/zoom.d.ts +38 -0
- package/es/control/zoom.js +132 -0
- package/es/css/button.less +70 -0
- package/es/css/control.less +71 -0
- package/es/css/index.css +594 -0
- package/es/css/index.less +12 -0
- package/es/css/l7.less +62 -0
- package/es/css/layerPopup.less +8 -0
- package/es/css/logo.less +18 -0
- package/es/css/mouseLocation.less +9 -0
- package/es/css/popper.less +64 -0
- package/es/css/popup.less +185 -0
- package/es/css/scale.less +34 -0
- package/es/css/select.less +86 -0
- package/es/css/variables.less +30 -0
- package/es/css/zoom.less +29 -0
- package/es/images/layers.png +0 -0
- package/es/images/layers.svg +1 -0
- package/es/images/logo.png +0 -0
- package/es/images/quanping.svg +12 -0
- package/es/index.d.ts +18 -0
- package/es/index.js +49 -0
- package/es/interface.d.ts +18 -0
- package/es/interface.js +1 -0
- package/es/marker-layer.d.ts +54 -0
- package/es/marker-layer.js +343 -0
- package/es/marker.d.ts +55 -0
- package/es/marker.js +410 -0
- package/es/popup/layerPopup.d.ts +95 -0
- package/es/popup/layerPopup.js +343 -0
- package/es/popup/popup.d.ts +139 -0
- package/es/popup/popup.js +575 -0
- package/es/utils/anchor.d.ts +22 -0
- package/es/utils/anchor.js +31 -0
- package/es/utils/icon.d.ts +1 -0
- package/es/utils/icon.js +9 -0
- package/es/utils/popper.d.ts +76 -0
- package/es/utils/popper.js +266 -0
- package/es/utils/screenfull.d.ts +2 -0
- package/es/utils/screenfull.js +128 -0
- package/lib/assets/iconfont/iconfont.js +48 -0
- package/lib/constants/index.js +68 -0
- package/lib/control/baseControl/buttonControl.js +183 -0
- package/lib/control/baseControl/control.js +314 -0
- package/lib/control/baseControl/index.js +39 -0
- package/lib/control/baseControl/popperControl.js +126 -0
- package/lib/control/baseControl/selectControl.js +210 -0
- package/lib/control/exportImage.js +165 -0
- package/lib/control/fullscreen.js +125 -0
- package/lib/control/geoLocate.js +113 -0
- package/lib/control/layerSwitch.js +147 -0
- package/lib/control/logo.js +81 -0
- package/lib/control/mapTheme.js +116 -0
- package/lib/control/mouseLocation.js +89 -0
- package/lib/control/scale.js +155 -0
- package/lib/control/zoom.js +138 -0
- package/lib/css/button.less +70 -0
- package/lib/css/control.less +71 -0
- package/lib/css/index.css +594 -0
- package/lib/css/index.less +12 -0
- package/lib/css/l7.less +62 -0
- package/lib/css/layerPopup.less +8 -0
- package/lib/css/logo.less +18 -0
- package/lib/css/mouseLocation.less +9 -0
- package/lib/css/popper.less +64 -0
- package/lib/css/popup.less +185 -0
- package/lib/css/scale.less +34 -0
- package/lib/css/select.less +86 -0
- package/lib/css/variables.less +30 -0
- package/lib/css/zoom.less +29 -0
- package/lib/images/layers.png +0 -0
- package/lib/images/layers.svg +1 -0
- package/lib/images/logo.png +0 -0
- package/lib/images/quanping.svg +12 -0
- package/lib/index.js +169 -0
- package/lib/interface.js +5 -0
- package/lib/marker-layer.js +349 -0
- package/lib/marker.js +417 -0
- package/lib/popup/layerPopup.js +349 -0
- package/lib/popup/popup.js +581 -0
- package/lib/utils/anchor.js +40 -0
- package/lib/utils/icon.js +16 -0
- package/lib/utils/popper.js +270 -0
- package/lib/utils/screenfull.js +136 -0
- package/package.json +6 -6
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.Popper = void 0;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
12
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
14
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
15
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
|
+
var _l7Utils = require("@antv/l7-utils");
|
|
17
|
+
var _eventemitter = require("eventemitter3");
|
|
18
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
19
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
20
|
+
/**
|
|
21
|
+
* 气泡位置枚举
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* 气泡触发类型,当前支持 click 和 hover 两种类型
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* 气泡内容类型
|
|
28
|
+
*/
|
|
29
|
+
var Popper = /*#__PURE__*/function (_EventEmitter) {
|
|
30
|
+
(0, _inherits2.default)(Popper, _EventEmitter);
|
|
31
|
+
var _super = _createSuper(Popper);
|
|
32
|
+
function Popper(button, option) {
|
|
33
|
+
var _this;
|
|
34
|
+
(0, _classCallCheck2.default)(this, Popper);
|
|
35
|
+
_this = _super.call(this);
|
|
36
|
+
/**
|
|
37
|
+
* 当前是否展示
|
|
38
|
+
* @protected
|
|
39
|
+
*/
|
|
40
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isShow", false);
|
|
41
|
+
/**
|
|
42
|
+
* 关闭气泡的定时器
|
|
43
|
+
* @protected
|
|
44
|
+
*/
|
|
45
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "timeout", null);
|
|
46
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "show", function () {
|
|
47
|
+
if (_this.isShow || !_this.contentDOM.innerHTML) {
|
|
48
|
+
return (0, _assertThisInitialized2.default)(_this);
|
|
49
|
+
}
|
|
50
|
+
_this.resetPopperPosition();
|
|
51
|
+
_l7Utils.DOM.removeClass(_this.popperDOM, 'l7-popper-hide');
|
|
52
|
+
_this.isShow = true;
|
|
53
|
+
if (_this.option.unique) {
|
|
54
|
+
// console.log(Popper.conflictPopperList.length);
|
|
55
|
+
Popper.conflictPopperList.forEach(function (popper) {
|
|
56
|
+
if (popper !== (0, _assertThisInitialized2.default)(_this) && popper.isShow) {
|
|
57
|
+
popper.hide();
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
_this.emit('show');
|
|
62
|
+
window.addEventListener('pointerdown', _this.onPopperUnClick);
|
|
63
|
+
return (0, _assertThisInitialized2.default)(_this);
|
|
64
|
+
});
|
|
65
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "hide", function () {
|
|
66
|
+
if (!_this.isShow) {
|
|
67
|
+
return (0, _assertThisInitialized2.default)(_this);
|
|
68
|
+
}
|
|
69
|
+
_l7Utils.DOM.addClass(_this.popperDOM, 'l7-popper-hide');
|
|
70
|
+
_this.isShow = false;
|
|
71
|
+
_this.emit('hide');
|
|
72
|
+
window.removeEventListener('pointerdown', _this.onPopperUnClick);
|
|
73
|
+
return (0, _assertThisInitialized2.default)(_this);
|
|
74
|
+
});
|
|
75
|
+
/**
|
|
76
|
+
* 设置隐藏气泡的定时器
|
|
77
|
+
*/
|
|
78
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "setHideTimeout", function () {
|
|
79
|
+
if (_this.timeout) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
_this.timeout = window.setTimeout(function () {
|
|
83
|
+
if (!_this.isShow) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
_this.hide();
|
|
87
|
+
_this.timeout = null;
|
|
88
|
+
}, 300);
|
|
89
|
+
});
|
|
90
|
+
/**
|
|
91
|
+
* 销毁隐藏气泡的定时器
|
|
92
|
+
*/
|
|
93
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "clearHideTimeout", function () {
|
|
94
|
+
if (_this.timeout) {
|
|
95
|
+
window.clearTimeout(_this.timeout);
|
|
96
|
+
_this.timeout = null;
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onBtnClick", function () {
|
|
100
|
+
if (_this.isShow) {
|
|
101
|
+
_this.hide();
|
|
102
|
+
} else {
|
|
103
|
+
_this.show();
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onPopperUnClick", function (e) {
|
|
107
|
+
if (!_l7Utils.DOM.findParentElement(e.target, ['.l7-button-control', '.l7-popper-content'])) {
|
|
108
|
+
_this.hide();
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onBtnMouseLeave", function () {
|
|
112
|
+
_this.setHideTimeout();
|
|
113
|
+
});
|
|
114
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onBtnMouseMove", function () {
|
|
115
|
+
_this.clearHideTimeout();
|
|
116
|
+
if (_this.isShow) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
_this.show();
|
|
120
|
+
});
|
|
121
|
+
_this.button = button;
|
|
122
|
+
_this.option = option;
|
|
123
|
+
_this.init();
|
|
124
|
+
if (option.unique) {
|
|
125
|
+
Popper.conflictPopperList.push((0, _assertThisInitialized2.default)(_this));
|
|
126
|
+
}
|
|
127
|
+
return _this;
|
|
128
|
+
}
|
|
129
|
+
(0, _createClass2.default)(Popper, [{
|
|
130
|
+
key: "buttonRect",
|
|
131
|
+
get: function get() {
|
|
132
|
+
return this.button.getBoundingClientRect();
|
|
133
|
+
}
|
|
134
|
+
}, {
|
|
135
|
+
key: "getPopperDOM",
|
|
136
|
+
value: function getPopperDOM() {
|
|
137
|
+
return this.popperDOM;
|
|
138
|
+
}
|
|
139
|
+
}, {
|
|
140
|
+
key: "getIsShow",
|
|
141
|
+
value: function getIsShow() {
|
|
142
|
+
return this.isShow;
|
|
143
|
+
}
|
|
144
|
+
}, {
|
|
145
|
+
key: "getContent",
|
|
146
|
+
value: function getContent() {
|
|
147
|
+
return this.content;
|
|
148
|
+
}
|
|
149
|
+
}, {
|
|
150
|
+
key: "setContent",
|
|
151
|
+
value: function setContent(content) {
|
|
152
|
+
if (typeof content === 'string') {
|
|
153
|
+
this.contentDOM.innerHTML = content;
|
|
154
|
+
} else if (content instanceof HTMLElement) {
|
|
155
|
+
_l7Utils.DOM.clearChildren(this.contentDOM);
|
|
156
|
+
this.contentDOM.appendChild(content);
|
|
157
|
+
}
|
|
158
|
+
this.content = content;
|
|
159
|
+
}
|
|
160
|
+
}, {
|
|
161
|
+
key: "init",
|
|
162
|
+
value: function init() {
|
|
163
|
+
var trigger = this.option.trigger;
|
|
164
|
+
this.popperDOM = this.createPopper();
|
|
165
|
+
if (trigger === 'click') {
|
|
166
|
+
this.button.addEventListener('click', this.onBtnClick);
|
|
167
|
+
} else {
|
|
168
|
+
this.button.addEventListener('mousemove', this.onBtnMouseMove);
|
|
169
|
+
this.button.addEventListener('mouseleave', this.onBtnMouseLeave);
|
|
170
|
+
this.popperDOM.addEventListener('mousemove', this.onBtnMouseMove);
|
|
171
|
+
this.popperDOM.addEventListener('mouseleave', this.onBtnMouseLeave);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}, {
|
|
175
|
+
key: "destroy",
|
|
176
|
+
value: function destroy() {
|
|
177
|
+
this.button.removeEventListener('click', this.onBtnClick);
|
|
178
|
+
this.button.removeEventListener('mousemove', this.onBtnMouseMove);
|
|
179
|
+
this.button.removeEventListener('mousemove', this.onBtnMouseLeave);
|
|
180
|
+
this.popperDOM.removeEventListener('mousemove', this.onBtnMouseMove);
|
|
181
|
+
this.popperDOM.removeEventListener('mouseleave', this.onBtnMouseLeave);
|
|
182
|
+
_l7Utils.DOM.remove(this.popperDOM);
|
|
183
|
+
}
|
|
184
|
+
}, {
|
|
185
|
+
key: "resetPopperPosition",
|
|
186
|
+
value: function resetPopperPosition() {
|
|
187
|
+
var popperStyleObj = {};
|
|
188
|
+
var _this$option = this.option,
|
|
189
|
+
container = _this$option.container,
|
|
190
|
+
_this$option$offset = _this$option.offset,
|
|
191
|
+
offset = _this$option$offset === void 0 ? [0, 0] : _this$option$offset,
|
|
192
|
+
placement = _this$option.placement;
|
|
193
|
+
var _offset = (0, _slicedToArray2.default)(offset, 2),
|
|
194
|
+
offsetX = _offset[0],
|
|
195
|
+
offsetY = _offset[1];
|
|
196
|
+
var buttonRect = this.button.getBoundingClientRect();
|
|
197
|
+
var containerRect = container.getBoundingClientRect();
|
|
198
|
+
var _DOM$getDiffRect = _l7Utils.DOM.getDiffRect(buttonRect, containerRect),
|
|
199
|
+
left = _DOM$getDiffRect.left,
|
|
200
|
+
right = _DOM$getDiffRect.right,
|
|
201
|
+
top = _DOM$getDiffRect.top,
|
|
202
|
+
bottom = _DOM$getDiffRect.bottom;
|
|
203
|
+
var isTransformX = false;
|
|
204
|
+
var isTransformY = false;
|
|
205
|
+
if (/^(left|right)/.test(placement)) {
|
|
206
|
+
if (placement.includes('left')) {
|
|
207
|
+
popperStyleObj.right = "".concat(buttonRect.width + right, "px");
|
|
208
|
+
} else if (placement.includes('right')) {
|
|
209
|
+
popperStyleObj.left = "".concat(buttonRect.width + left, "px");
|
|
210
|
+
}
|
|
211
|
+
if (placement.includes('start')) {
|
|
212
|
+
popperStyleObj.top = "".concat(top, "px");
|
|
213
|
+
} else if (placement.includes('end')) {
|
|
214
|
+
popperStyleObj.bottom = "".concat(bottom, "px");
|
|
215
|
+
} else {
|
|
216
|
+
popperStyleObj.top = "".concat(top + buttonRect.height / 2, "px");
|
|
217
|
+
isTransformY = true;
|
|
218
|
+
popperStyleObj.transform = "translate(".concat(offsetX, "px, calc(").concat(offsetY, "px - 50%))");
|
|
219
|
+
}
|
|
220
|
+
} else if (/^(top|bottom)/.test(placement)) {
|
|
221
|
+
if (placement.includes('top')) {
|
|
222
|
+
popperStyleObj.bottom = "".concat(buttonRect.height + bottom, "px");
|
|
223
|
+
} else if (placement.includes('bottom')) {
|
|
224
|
+
popperStyleObj.top = "".concat(buttonRect.height + top, "px");
|
|
225
|
+
}
|
|
226
|
+
if (placement.includes('start')) {
|
|
227
|
+
popperStyleObj.left = "".concat(left, "px");
|
|
228
|
+
} else if (placement.includes('end')) {
|
|
229
|
+
popperStyleObj.right = "".concat(right, "px");
|
|
230
|
+
} else {
|
|
231
|
+
popperStyleObj.left = "".concat(left + buttonRect.width / 2, "px");
|
|
232
|
+
isTransformX = true;
|
|
233
|
+
popperStyleObj.transform = "translate(calc(".concat(offsetX, "px - 50%), ").concat(offsetY, "px)");
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
popperStyleObj.transform = "translate(calc(".concat(offsetX, "px - ").concat(isTransformX ? '50%' : '0%', "), calc(").concat(offsetY, "px - ").concat(isTransformY ? '50%' : '0%', ")");
|
|
237
|
+
var posList = placement.split('-');
|
|
238
|
+
if (posList.length) {
|
|
239
|
+
_l7Utils.DOM.addClass(this.popperDOM, posList.map(function (pos) {
|
|
240
|
+
return "l7-popper-".concat(pos);
|
|
241
|
+
}).join(' '));
|
|
242
|
+
}
|
|
243
|
+
_l7Utils.DOM.addStyle(this.popperDOM, _l7Utils.DOM.css2Style(popperStyleObj));
|
|
244
|
+
}
|
|
245
|
+
}, {
|
|
246
|
+
key: "createPopper",
|
|
247
|
+
value: function createPopper() {
|
|
248
|
+
var _this$option2 = this.option,
|
|
249
|
+
container = _this$option2.container,
|
|
250
|
+
_this$option2$classNa = _this$option2.className,
|
|
251
|
+
className = _this$option2$classNa === void 0 ? '' : _this$option2$classNa,
|
|
252
|
+
content = _this$option2.content;
|
|
253
|
+
var popper = _l7Utils.DOM.create('div', "l7-popper l7-popper-hide ".concat(className));
|
|
254
|
+
var popperContent = _l7Utils.DOM.create('div', 'l7-popper-content');
|
|
255
|
+
var popperArrow = _l7Utils.DOM.create('div', 'l7-popper-arrow');
|
|
256
|
+
popper.appendChild(popperContent);
|
|
257
|
+
popper.appendChild(popperArrow);
|
|
258
|
+
container.appendChild(popper);
|
|
259
|
+
this.popperDOM = popper;
|
|
260
|
+
this.contentDOM = popperContent;
|
|
261
|
+
if (content) {
|
|
262
|
+
this.setContent(content);
|
|
263
|
+
}
|
|
264
|
+
return popper;
|
|
265
|
+
}
|
|
266
|
+
}]);
|
|
267
|
+
return Popper;
|
|
268
|
+
}(_eventemitter.EventEmitter);
|
|
269
|
+
exports.Popper = Popper;
|
|
270
|
+
(0, _defineProperty2.default)(Popper, "conflictPopperList", []);
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
10
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
11
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
12
|
+
// @ts-nocheck
|
|
13
|
+
|
|
14
|
+
var methodMap = [['requestFullscreen', 'exitFullscreen', 'fullscreenElement', 'fullscreenEnabled', 'fullscreenchange', 'fullscreenerror'],
|
|
15
|
+
// New WebKit
|
|
16
|
+
['webkitRequestFullscreen', 'webkitExitFullscreen', 'webkitFullscreenElement', 'webkitFullscreenEnabled', 'webkitfullscreenchange', 'webkitfullscreenerror'],
|
|
17
|
+
// Old WebKit
|
|
18
|
+
['webkitRequestFullScreen', 'webkitCancelFullScreen', 'webkitCurrentFullScreenElement', 'webkitCancelFullScreen', 'webkitfullscreenchange', 'webkitfullscreenerror'], ['mozRequestFullScreen', 'mozCancelFullScreen', 'mozFullScreenElement', 'mozFullScreenEnabled', 'mozfullscreenchange', 'mozfullscreenerror'], ['msRequestFullscreen', 'msExitFullscreen', 'msFullscreenElement', 'msFullscreenEnabled', 'MSFullscreenChange', 'MSFullscreenError']];
|
|
19
|
+
var nativeAPI = function () {
|
|
20
|
+
if (typeof document === 'undefined') {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
var unprefixedMethods = methodMap[0];
|
|
24
|
+
var returnValue = {};
|
|
25
|
+
for (var _i = 0, _methodMap = methodMap; _i < _methodMap.length; _i++) {
|
|
26
|
+
var methodList = _methodMap[_i];
|
|
27
|
+
var exitFullscreenMethod = methodList === null || methodList === void 0 ? void 0 : methodList[1];
|
|
28
|
+
if (exitFullscreenMethod in document) {
|
|
29
|
+
var _iterator = _createForOfIteratorHelper(methodList.entries()),
|
|
30
|
+
_step;
|
|
31
|
+
try {
|
|
32
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
33
|
+
var _step$value = (0, _slicedToArray2.default)(_step.value, 2),
|
|
34
|
+
index = _step$value[0],
|
|
35
|
+
method = _step$value[1];
|
|
36
|
+
returnValue[unprefixedMethods[index]] = method;
|
|
37
|
+
}
|
|
38
|
+
} catch (err) {
|
|
39
|
+
_iterator.e(err);
|
|
40
|
+
} finally {
|
|
41
|
+
_iterator.f();
|
|
42
|
+
}
|
|
43
|
+
return returnValue;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return false;
|
|
47
|
+
}();
|
|
48
|
+
var eventNameMap = {
|
|
49
|
+
change: nativeAPI.fullscreenchange,
|
|
50
|
+
error: nativeAPI.fullscreenerror
|
|
51
|
+
};
|
|
52
|
+
var screenfull = {
|
|
53
|
+
// eslint-disable-next-line default-param-last
|
|
54
|
+
request: function request() {
|
|
55
|
+
var element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.documentElement;
|
|
56
|
+
var options = arguments.length > 1 ? arguments[1] : undefined;
|
|
57
|
+
return new Promise(function (resolve, reject) {
|
|
58
|
+
var onFullScreenEntered = function onFullScreenEntered() {
|
|
59
|
+
screenfull.off('change', onFullScreenEntered);
|
|
60
|
+
resolve();
|
|
61
|
+
};
|
|
62
|
+
screenfull.on('change', onFullScreenEntered);
|
|
63
|
+
var returnPromise = element[nativeAPI.requestFullscreen](options);
|
|
64
|
+
if (returnPromise instanceof Promise) {
|
|
65
|
+
returnPromise.then(onFullScreenEntered).catch(reject);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
},
|
|
69
|
+
exit: function exit() {
|
|
70
|
+
return new Promise(function (resolve, reject) {
|
|
71
|
+
if (!screenfull.isFullscreen) {
|
|
72
|
+
resolve();
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
var onFullScreenExit = function onFullScreenExit() {
|
|
76
|
+
screenfull.off('change', onFullScreenExit);
|
|
77
|
+
resolve();
|
|
78
|
+
};
|
|
79
|
+
screenfull.on('change', onFullScreenExit);
|
|
80
|
+
var returnPromise = document[nativeAPI.exitFullscreen]();
|
|
81
|
+
if (returnPromise instanceof Promise) {
|
|
82
|
+
returnPromise.then(onFullScreenExit).catch(reject);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
},
|
|
86
|
+
toggle: function toggle(element, options) {
|
|
87
|
+
return screenfull.isFullscreen ? screenfull.exit() : screenfull.request(element, options);
|
|
88
|
+
},
|
|
89
|
+
onchange: function onchange(callback) {
|
|
90
|
+
screenfull.on('change', callback);
|
|
91
|
+
},
|
|
92
|
+
onerror: function onerror(callback) {
|
|
93
|
+
screenfull.on('error', callback);
|
|
94
|
+
},
|
|
95
|
+
on: function on(event, callback) {
|
|
96
|
+
var eventName = eventNameMap[event];
|
|
97
|
+
if (eventName) {
|
|
98
|
+
document.addEventListener(eventName, callback, false);
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
off: function off(event, callback) {
|
|
102
|
+
var eventName = eventNameMap[event];
|
|
103
|
+
if (eventName) {
|
|
104
|
+
document.removeEventListener(eventName, callback, false);
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
raw: nativeAPI
|
|
108
|
+
};
|
|
109
|
+
Object.defineProperties(screenfull, {
|
|
110
|
+
isFullscreen: {
|
|
111
|
+
get: function get() {
|
|
112
|
+
return Boolean(document[nativeAPI.fullscreenElement]);
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
element: {
|
|
116
|
+
enumerable: true,
|
|
117
|
+
get: function get() {
|
|
118
|
+
var _document$nativeAPI$f;
|
|
119
|
+
return (_document$nativeAPI$f = document[nativeAPI.fullscreenElement]) !== null && _document$nativeAPI$f !== void 0 ? _document$nativeAPI$f : undefined;
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
isEnabled: {
|
|
123
|
+
enumerable: true,
|
|
124
|
+
// Coerce to boolean in case of old WebKit.
|
|
125
|
+
get: function get() {
|
|
126
|
+
return Boolean(document[nativeAPI.fullscreenEnabled]);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
if (!nativeAPI) {
|
|
131
|
+
screenfull = {
|
|
132
|
+
isEnabled: false
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
var _default = screenfull;
|
|
136
|
+
exports.default = _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/l7-component",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.19.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"author": "lzxue",
|
|
27
27
|
"license": "ISC",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@antv/l7-core": "
|
|
30
|
-
"@antv/l7-utils": "
|
|
29
|
+
"@antv/l7-core": "2.19.0",
|
|
30
|
+
"@antv/l7-utils": "2.19.0",
|
|
31
31
|
"@babel/runtime": "^7.7.7",
|
|
32
32
|
"eventemitter3": "^4.0.0",
|
|
33
33
|
"inversify": "^5.0.1",
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
"supercluster": "^7.0.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@antv/l7-layers": "
|
|
39
|
-
"@antv/l7-test-utils": "
|
|
38
|
+
"@antv/l7-layers": "2.19.0",
|
|
39
|
+
"@antv/l7-test-utils": "2.19.0",
|
|
40
40
|
"gcoord": "^0.3.2",
|
|
41
41
|
"less": "^4.1.3"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "7f08eaafe2a25e986ba52c625acf5511f1184b82",
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"access": "public"
|
|
46
46
|
}
|