@antv/l7-component 2.21.1 → 2.21.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/es/assets/iconfont/iconfont.js +6 -6
- package/es/constants/index.js +2 -2
- package/es/control/baseControl/buttonControl.js +109 -144
- package/es/control/baseControl/control.js +212 -258
- package/es/control/baseControl/popperControl.js +67 -95
- package/es/control/baseControl/selectControl.js +132 -178
- package/es/control/exportImage.js +59 -142
- package/es/control/fullscreen.js +69 -100
- package/es/control/geoLocate.js +37 -84
- package/es/control/layerSwitch.js +111 -154
- package/es/control/logo.js +43 -69
- package/es/control/mapTheme.js +57 -98
- package/es/control/mouseLocation.js +37 -69
- package/es/control/scale.js +107 -135
- package/es/control/swipe.js +297 -389
- package/es/control/zoom.js +80 -112
- package/es/css/index.css +10 -7
- package/es/index.js +675 -1
- package/es/marker-layer.js +275 -326
- package/es/marker.js +394 -446
- package/es/popup/layerPopup.js +277 -321
- package/es/popup/popup.js +422 -482
- package/es/utils/anchor.js +6 -6
- package/es/utils/icon.js +4 -4
- package/es/utils/popper.js +180 -196
- package/es/utils/screenfull.js +29 -51
- package/lib/assets/iconfont/iconfont.js +6 -6
- package/lib/constants/index.d.ts +60 -0
- package/lib/constants/index.js +2 -2
- package/lib/control/baseControl/buttonControl.d.ts +60 -0
- package/lib/control/baseControl/buttonControl.js +110 -143
- package/lib/control/baseControl/control.d.ts +112 -0
- package/lib/control/baseControl/control.js +213 -257
- package/lib/control/baseControl/index.d.ts +4 -0
- package/lib/control/baseControl/index.js +5 -5
- package/lib/control/baseControl/popperControl.d.ts +28 -0
- package/lib/control/baseControl/popperControl.js +68 -94
- package/lib/control/baseControl/selectControl.d.ts +53 -0
- package/lib/control/baseControl/selectControl.js +133 -177
- package/lib/control/exportImage.d.ts +19 -0
- package/lib/control/exportImage.js +60 -141
- package/lib/control/fullscreen.d.ts +20 -0
- package/lib/control/fullscreen.js +70 -99
- package/lib/control/geoLocate.d.ts +17 -0
- package/lib/control/geoLocate.js +38 -83
- package/lib/control/layerSwitch.d.ts +27 -0
- package/lib/control/layerSwitch.js +112 -153
- package/lib/control/logo.d.ts +14 -0
- package/lib/control/logo.js +44 -69
- package/lib/control/mapTheme.d.ts +11 -0
- package/lib/control/mapTheme.js +58 -97
- package/lib/control/mouseLocation.d.ts +16 -0
- package/lib/control/mouseLocation.js +38 -68
- package/lib/control/scale.d.ts +35 -0
- package/lib/control/scale.js +108 -134
- package/lib/control/swipe.d.ts +66 -0
- package/lib/control/swipe.js +298 -388
- package/lib/control/zoom.d.ts +39 -0
- package/lib/control/zoom.js +81 -111
- package/lib/css/index.css +10 -7
- package/lib/index.d.ts +19 -0
- package/lib/index.js +691 -17
- package/lib/interface.d.ts +18 -0
- package/lib/marker-layer.d.ts +55 -0
- package/lib/marker-layer.js +277 -324
- package/lib/marker.d.ts +58 -0
- package/lib/marker.js +395 -445
- package/lib/popup/layerPopup.d.ts +99 -0
- package/lib/popup/layerPopup.js +278 -320
- package/lib/popup/popup.d.ts +142 -0
- package/lib/popup/popup.js +423 -481
- package/lib/utils/anchor.d.ts +22 -0
- package/lib/utils/anchor.js +6 -6
- package/lib/utils/icon.d.ts +1 -0
- package/lib/utils/icon.js +6 -5
- package/lib/utils/popper.d.ts +76 -0
- package/lib/utils/popper.js +184 -196
- package/lib/utils/screenfull.d.ts +2 -0
- package/lib/utils/screenfull.js +29 -52
- package/package.json +16 -20
|
@@ -6,11 +6,11 @@ window._iconfont_svg_string_3580659 = '<svg><symbol id="l7-icon-area1" viewBox="
|
|
|
6
6
|
a = a.getAttribute('data-disable-injectsvg');
|
|
7
7
|
if (!a) {
|
|
8
8
|
var o,
|
|
9
|
-
|
|
9
|
+
e,
|
|
10
10
|
i,
|
|
11
11
|
n,
|
|
12
12
|
m,
|
|
13
|
-
c = function
|
|
13
|
+
c = function (a, l) {
|
|
14
14
|
l.parentNode.insertBefore(a, l);
|
|
15
15
|
};
|
|
16
16
|
if (l && !t.__iconfont__svg__cssinject__) {
|
|
@@ -21,13 +21,13 @@ window._iconfont_svg_string_3580659 = '<svg><symbol id="l7-icon-area1" viewBox="
|
|
|
21
21
|
console && console.log(a);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
o = function
|
|
24
|
+
o = function () {
|
|
25
25
|
var a,
|
|
26
26
|
l = document.createElement('div');
|
|
27
27
|
l.innerHTML = t._iconfont_svg_string_3580659, (l = l.getElementsByTagName('svg')[0]) && (l.setAttribute('aria-hidden', 'true'), l.style.position = 'absolute', l.style.width = 0, l.style.height = 0, l.style.overflow = 'hidden', l = l, (a = document.body).firstChild ? c(l, a.firstChild) : a.appendChild(l));
|
|
28
|
-
}, document.addEventListener ? ~['complete', 'loaded', 'interactive'].indexOf(document.readyState) ? setTimeout(o, 0) : (
|
|
29
|
-
document.removeEventListener('DOMContentLoaded',
|
|
30
|
-
}, document.addEventListener('DOMContentLoaded',
|
|
28
|
+
}, document.addEventListener ? ~['complete', 'loaded', 'interactive'].indexOf(document.readyState) ? setTimeout(o, 0) : (e = function () {
|
|
29
|
+
document.removeEventListener('DOMContentLoaded', e, !1), o();
|
|
30
|
+
}, document.addEventListener('DOMContentLoaded', e, !1)) : document.attachEvent && (i = o, n = t.document, m = !1, L(), n.onreadystatechange = function () {
|
|
31
31
|
'complete' == n.readyState && (n.onreadystatechange = null, d());
|
|
32
32
|
});
|
|
33
33
|
}
|
package/es/constants/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export const GaodeMapStyleConfig = {
|
|
2
2
|
normal: {
|
|
3
3
|
text: '标准',
|
|
4
4
|
img: 'https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*qdFDSbvIalgAAAAAAAAAAAAADmJ7AQ/original'
|
|
@@ -36,7 +36,7 @@ export var GaodeMapStyleConfig = {
|
|
|
36
36
|
img: 'https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*orY0T7QL-lwAAAAAAAAAAAAADmJ7AQ/original'
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
|
-
export
|
|
39
|
+
export const MapboxMapStyleConfig = {
|
|
40
40
|
normal: {
|
|
41
41
|
text: '标准',
|
|
42
42
|
img: 'https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*kIyZTok4Uk0AAAAAAAAAAAAADmJ7AQ/original'
|
|
@@ -1,177 +1,142 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
-
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
4
|
-
import _get from "@babel/runtime/helpers/esm/get";
|
|
5
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
6
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
7
|
-
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
8
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
9
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
10
|
-
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; } }
|
|
11
2
|
import { DOM } from '@antv/l7-utils';
|
|
12
3
|
import Control from "./control";
|
|
13
4
|
export { ButtonControl };
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
function ButtonControl() {
|
|
18
|
-
var _this;
|
|
19
|
-
_classCallCheck(this, ButtonControl);
|
|
20
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
21
|
-
args[_key] = arguments[_key];
|
|
22
|
-
}
|
|
23
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
5
|
+
export default class ButtonControl extends Control {
|
|
6
|
+
constructor(...args) {
|
|
7
|
+
super(...args);
|
|
24
8
|
/**
|
|
25
9
|
* 当前按钮是否禁用
|
|
26
10
|
* @protected
|
|
27
11
|
*/
|
|
28
|
-
_defineProperty(
|
|
29
|
-
return _this;
|
|
30
|
-
}
|
|
31
|
-
_createClass(ButtonControl, [{
|
|
32
|
-
key: "setIsDisable",
|
|
33
|
-
value:
|
|
12
|
+
_defineProperty(this, "isDisable", false);
|
|
34
13
|
/**
|
|
35
14
|
* 按钮的 DOM
|
|
36
15
|
* @protected
|
|
37
16
|
*/
|
|
38
|
-
|
|
17
|
+
_defineProperty(this, "button", void 0);
|
|
39
18
|
/**
|
|
40
19
|
* 按钮中文本对应的 DOM
|
|
41
20
|
* @protected
|
|
42
21
|
*/
|
|
43
|
-
|
|
22
|
+
_defineProperty(this, "buttonText", void 0);
|
|
44
23
|
/**
|
|
45
24
|
* 按钮中图标对应的 DOM
|
|
46
25
|
* @protected
|
|
47
26
|
*/
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
}, {
|
|
64
|
-
key: "createButton",
|
|
65
|
-
value: function createButton() {
|
|
66
|
-
var className = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
67
|
-
return DOM.create('button', "l7-button-control ".concat(className));
|
|
27
|
+
_defineProperty(this, "buttonIcon", void 0);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* 设置当前按钮
|
|
31
|
+
* @param newIsDisable
|
|
32
|
+
*/
|
|
33
|
+
setIsDisable(newIsDisable) {
|
|
34
|
+
this.isDisable = newIsDisable;
|
|
35
|
+
if (newIsDisable) {
|
|
36
|
+
var _this$button;
|
|
37
|
+
(_this$button = this.button) === null || _this$button === void 0 || _this$button.setAttribute('disabled', 'true');
|
|
38
|
+
} else {
|
|
39
|
+
var _this$button2;
|
|
40
|
+
(_this$button2 = this.button) === null || _this$button2 === void 0 || _this$button2.removeAttribute('disabled');
|
|
68
41
|
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
42
|
+
}
|
|
43
|
+
createButton(className = '') {
|
|
44
|
+
return DOM.create('button', `l7-button-control ${className}`);
|
|
45
|
+
}
|
|
46
|
+
onAdd() {
|
|
47
|
+
this.button = this.createButton();
|
|
48
|
+
this.isDisable = false;
|
|
49
|
+
const {
|
|
50
|
+
title,
|
|
51
|
+
btnText,
|
|
52
|
+
btnIcon
|
|
53
|
+
} = this.controlOption;
|
|
54
|
+
this.setBtnTitle(title);
|
|
55
|
+
this.setBtnText(btnText);
|
|
56
|
+
this.setBtnIcon(btnIcon);
|
|
57
|
+
return this.button;
|
|
58
|
+
}
|
|
59
|
+
onRemove() {
|
|
60
|
+
this.button = this.buttonIcon = this.buttonText = undefined;
|
|
61
|
+
this.isDisable = false;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* 更新配置方法
|
|
66
|
+
* @param newOptions
|
|
67
|
+
*/
|
|
68
|
+
setOptions(newOptions) {
|
|
69
|
+
const {
|
|
70
|
+
title,
|
|
71
|
+
btnText,
|
|
72
|
+
btnIcon
|
|
73
|
+
} = newOptions;
|
|
74
|
+
if (this.checkUpdateOption(newOptions, ['title'])) {
|
|
78
75
|
this.setBtnTitle(title);
|
|
79
|
-
|
|
76
|
+
}
|
|
77
|
+
if (this.checkUpdateOption(newOptions, ['btnIcon'])) {
|
|
80
78
|
this.setBtnIcon(btnIcon);
|
|
81
|
-
return this.button;
|
|
82
79
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
value: function onRemove() {
|
|
86
|
-
this.button = this.buttonIcon = this.buttonText = undefined;
|
|
87
|
-
this.isDisable = false;
|
|
80
|
+
if (this.checkUpdateOption(newOptions, ['btnText'])) {
|
|
81
|
+
this.setBtnText(btnText);
|
|
88
82
|
}
|
|
83
|
+
super.setOptions(newOptions);
|
|
84
|
+
}
|
|
89
85
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
btnText = newOptions.btnText,
|
|
99
|
-
btnIcon = newOptions.btnIcon;
|
|
100
|
-
if (this.checkUpdateOption(newOptions, ['title'])) {
|
|
101
|
-
this.setBtnTitle(title);
|
|
102
|
-
}
|
|
103
|
-
if (this.checkUpdateOption(newOptions, ['btnIcon'])) {
|
|
104
|
-
this.setBtnIcon(btnIcon);
|
|
105
|
-
}
|
|
106
|
-
if (this.checkUpdateOption(newOptions, ['btnText'])) {
|
|
107
|
-
this.setBtnText(btnText);
|
|
108
|
-
}
|
|
109
|
-
_get(_getPrototypeOf(ButtonControl.prototype), "setOptions", this).call(this, newOptions);
|
|
110
|
-
}
|
|
86
|
+
/**
|
|
87
|
+
* 设置按钮 title
|
|
88
|
+
* @param title
|
|
89
|
+
*/
|
|
90
|
+
setBtnTitle(title) {
|
|
91
|
+
var _this$button3;
|
|
92
|
+
(_this$button3 = this.button) === null || _this$button3 === void 0 || _this$button3.setAttribute('title', title !== null && title !== void 0 ? title : '');
|
|
93
|
+
}
|
|
111
94
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
var _this$button3;
|
|
120
|
-
(_this$button3 = this.button) === null || _this$button3 === void 0 || _this$button3.setAttribute('title', title !== null && title !== void 0 ? title : '');
|
|
95
|
+
/**
|
|
96
|
+
* 设置按钮 Icon
|
|
97
|
+
* @param newIcon
|
|
98
|
+
*/
|
|
99
|
+
setBtnIcon(newIcon) {
|
|
100
|
+
if (this.buttonIcon) {
|
|
101
|
+
DOM.remove(this.buttonIcon);
|
|
121
102
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
DOM.remove(this.buttonIcon);
|
|
132
|
-
}
|
|
133
|
-
if (newIcon) {
|
|
134
|
-
var _this$button4;
|
|
135
|
-
var firstChild = (_this$button4 = this.button) === null || _this$button4 === void 0 ? void 0 : _this$button4.firstChild;
|
|
136
|
-
if (firstChild) {
|
|
137
|
-
var _this$button5;
|
|
138
|
-
(_this$button5 = this.button) === null || _this$button5 === void 0 || _this$button5.insertBefore(newIcon, firstChild);
|
|
139
|
-
} else {
|
|
140
|
-
var _this$button6;
|
|
141
|
-
(_this$button6 = this.button) === null || _this$button6 === void 0 || _this$button6.appendChild(newIcon);
|
|
142
|
-
}
|
|
143
|
-
this.buttonIcon = newIcon;
|
|
103
|
+
if (newIcon) {
|
|
104
|
+
var _this$button4;
|
|
105
|
+
const firstChild = (_this$button4 = this.button) === null || _this$button4 === void 0 ? void 0 : _this$button4.firstChild;
|
|
106
|
+
if (firstChild) {
|
|
107
|
+
var _this$button5;
|
|
108
|
+
(_this$button5 = this.button) === null || _this$button5 === void 0 || _this$button5.insertBefore(newIcon, firstChild);
|
|
109
|
+
} else {
|
|
110
|
+
var _this$button6;
|
|
111
|
+
(_this$button6 = this.button) === null || _this$button6 === void 0 || _this$button6.appendChild(newIcon);
|
|
144
112
|
}
|
|
113
|
+
this.buttonIcon = newIcon;
|
|
145
114
|
}
|
|
115
|
+
}
|
|
146
116
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
if (
|
|
160
|
-
var
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
(_this$button7 = this.button) === null || _this$button7 === void 0 || _this$button7.appendChild(btnText);
|
|
165
|
-
this.buttonText = btnText;
|
|
166
|
-
}
|
|
167
|
-
btnText.innerText = newText;
|
|
168
|
-
DOM.addClass(this.button, this.controlOption.vertical ? 'l7-button-control--column' : 'l7-button-control--row');
|
|
169
|
-
} else if (!newText && this.buttonText) {
|
|
170
|
-
DOM.remove(this.buttonText);
|
|
171
|
-
this.buttonText = undefined;
|
|
117
|
+
/**
|
|
118
|
+
* 设置按钮文本
|
|
119
|
+
* @param newText
|
|
120
|
+
*/
|
|
121
|
+
setBtnText(newText) {
|
|
122
|
+
if (!this.button) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
DOM.removeClass(this.button, 'l7-button-control--row');
|
|
126
|
+
DOM.removeClass(this.button, 'l7-button-control--column');
|
|
127
|
+
if (newText) {
|
|
128
|
+
let btnText = this.buttonText;
|
|
129
|
+
if (!btnText) {
|
|
130
|
+
var _this$button7;
|
|
131
|
+
btnText = DOM.create('div', 'l7-button-control__text');
|
|
132
|
+
(_this$button7 = this.button) === null || _this$button7 === void 0 || _this$button7.appendChild(btnText);
|
|
133
|
+
this.buttonText = btnText;
|
|
172
134
|
}
|
|
135
|
+
btnText.innerText = newText;
|
|
136
|
+
DOM.addClass(this.button, this.controlOption.vertical ? 'l7-button-control--column' : 'l7-button-control--row');
|
|
137
|
+
} else if (!newText && this.buttonText) {
|
|
138
|
+
DOM.remove(this.buttonText);
|
|
139
|
+
this.buttonText = undefined;
|
|
173
140
|
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
}(Control);
|
|
177
|
-
export { ButtonControl as default };
|
|
141
|
+
}
|
|
142
|
+
}
|