@antv/l7-component 2.9.32-alpha.4 → 2.9.32-alpha.5
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/control/baseControl/buttonControl.d.ts +1 -1
- package/es/control/baseControl/control.d.ts +4 -5
- package/es/control/baseControl/control.js +18 -5
- package/es/control/baseControl/popperControl.d.ts +1 -1
- package/es/control/baseControl/selectControl.d.ts +2 -2
- package/es/control/baseControl/selectControl.js +5 -0
- package/es/control/zoom.d.ts +3 -2
- package/lib/assets/iconfont/iconfont.js +46 -30
- package/lib/constants/index.js +34 -56
- package/lib/control/baseControl/buttonControl.js +194 -105
- package/lib/control/baseControl/control.js +317 -156
- package/lib/control/baseControl/index.js +57 -22
- package/lib/control/baseControl/popperControl.js +136 -102
- package/lib/control/baseControl/selectControl.js +230 -130
- package/lib/control/exportImage.js +175 -81
- package/lib/control/fullscreen.js +157 -102
- package/lib/control/geoLocate.js +143 -67
- package/lib/control/layerControl.js +162 -116
- package/lib/control/logo.js +101 -70
- package/lib/control/mapTheme.js +144 -85
- package/lib/control/mouseLocation.js +112 -71
- package/lib/control/scale.js +180 -127
- package/lib/control/zoom.js +154 -111
- package/lib/index.js +251 -48
- package/lib/interface.js +4 -16
- package/lib/marker-layer.js +367 -249
- package/lib/marker.js +419 -277
- package/lib/popup/layerPopup.js +305 -188
- package/lib/popup/popup.js +602 -339
- package/lib/utils/anchor.js +37 -55
- package/lib/utils/icon.js +13 -32
- package/lib/utils/popper.js +268 -180
- package/lib/utils/screenfull.js +110 -103
- package/package.json +5 -5
|
@@ -1,118 +1,207 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
-
|
|
22
|
-
// src/control/baseControl/buttonControl.ts
|
|
23
|
-
var buttonControl_exports = {};
|
|
24
|
-
__export(buttonControl_exports, {
|
|
25
|
-
ButtonControl: () => ButtonControl,
|
|
26
|
-
default: () => ButtonControl
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
27
7
|
});
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
8
|
+
exports.default = exports.ButtonControl = void 0;
|
|
9
|
+
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
+
|
|
14
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
15
|
+
|
|
16
|
+
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
17
|
+
|
|
18
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
19
|
+
|
|
20
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
21
|
+
|
|
22
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
23
|
+
|
|
24
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
|
+
|
|
26
|
+
var _l7Utils = require("@antv/l7-utils");
|
|
27
|
+
|
|
28
|
+
var _control = _interopRequireDefault(require("./control"));
|
|
29
|
+
|
|
30
|
+
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); }; }
|
|
31
|
+
|
|
32
|
+
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; } }
|
|
33
|
+
|
|
34
|
+
var ButtonControl = /*#__PURE__*/function (_Control) {
|
|
35
|
+
(0, _inherits2.default)(ButtonControl, _Control);
|
|
36
|
+
|
|
37
|
+
var _super = _createSuper(ButtonControl);
|
|
38
|
+
|
|
39
|
+
function ButtonControl() {
|
|
40
|
+
var _this;
|
|
41
|
+
|
|
42
|
+
(0, _classCallCheck2.default)(this, ButtonControl);
|
|
43
|
+
|
|
44
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
45
|
+
args[_key] = arguments[_key];
|
|
43
46
|
}
|
|
47
|
+
|
|
48
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
49
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isDisable", false);
|
|
50
|
+
return _this;
|
|
44
51
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
52
|
+
|
|
53
|
+
(0, _createClass2.default)(ButtonControl, [{
|
|
54
|
+
key: "setIsDisable",
|
|
55
|
+
value:
|
|
56
|
+
/**
|
|
57
|
+
* 设置当前按钮
|
|
58
|
+
* @param newIsDisable
|
|
59
|
+
*/
|
|
60
|
+
function setIsDisable(newIsDisable) {
|
|
61
|
+
this.isDisable = newIsDisable;
|
|
62
|
+
|
|
63
|
+
if (newIsDisable) {
|
|
64
|
+
var _this$button;
|
|
65
|
+
|
|
66
|
+
(_this$button = this.button) === null || _this$button === void 0 ? void 0 : _this$button.setAttribute('disabled', 'true');
|
|
67
|
+
} else {
|
|
68
|
+
var _this$button2;
|
|
69
|
+
|
|
70
|
+
(_this$button2 = this.button) === null || _this$button2 === void 0 ? void 0 : _this$button2.removeAttribute('disabled');
|
|
71
|
+
}
|
|
65
72
|
}
|
|
66
|
-
|
|
67
|
-
|
|
73
|
+
}, {
|
|
74
|
+
key: "createButton",
|
|
75
|
+
value: function createButton() {
|
|
76
|
+
var className = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
77
|
+
return _l7Utils.DOM.create('button', "l7-button-control ".concat(className));
|
|
68
78
|
}
|
|
69
|
-
|
|
79
|
+
}, {
|
|
80
|
+
key: "onAdd",
|
|
81
|
+
value: function onAdd() {
|
|
82
|
+
this.button = this.createButton();
|
|
83
|
+
this.isDisable = false;
|
|
84
|
+
var _this$controlOption = this.controlOption,
|
|
85
|
+
title = _this$controlOption.title,
|
|
86
|
+
btnText = _this$controlOption.btnText,
|
|
87
|
+
btnIcon = _this$controlOption.btnIcon;
|
|
88
|
+
this.setBtnTitle(title);
|
|
70
89
|
this.setBtnText(btnText);
|
|
90
|
+
this.setBtnIcon(btnIcon);
|
|
91
|
+
return this.button;
|
|
71
92
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
setBtnIcon(newIcon) {
|
|
79
|
-
var _a, _b, _c;
|
|
80
|
-
if (this.buttonIcon) {
|
|
81
|
-
import_l7_utils.DOM.remove(this.buttonIcon);
|
|
93
|
+
}, {
|
|
94
|
+
key: "onRemove",
|
|
95
|
+
value: function onRemove() {
|
|
96
|
+
this.button = this.buttonIcon = this.buttonText = undefined;
|
|
97
|
+
this.isDisable = false;
|
|
82
98
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
99
|
+
/**
|
|
100
|
+
* 更新配置方法
|
|
101
|
+
* @param newOptions
|
|
102
|
+
*/
|
|
103
|
+
|
|
104
|
+
}, {
|
|
105
|
+
key: "setOptions",
|
|
106
|
+
value: function setOptions(newOptions) {
|
|
107
|
+
var title = newOptions.title,
|
|
108
|
+
btnText = newOptions.btnText,
|
|
109
|
+
btnIcon = newOptions.btnIcon;
|
|
110
|
+
|
|
111
|
+
if (this.checkUpdateOption(newOptions, ['title'])) {
|
|
112
|
+
this.setBtnTitle(title);
|
|
89
113
|
}
|
|
90
|
-
|
|
114
|
+
|
|
115
|
+
if (this.checkUpdateOption(newOptions, ['btnIcon'])) {
|
|
116
|
+
this.setBtnIcon(btnIcon);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (this.checkUpdateOption(newOptions, ['btnText'])) {
|
|
120
|
+
this.setBtnText(btnText);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
(0, _get2.default)((0, _getPrototypeOf2.default)(ButtonControl.prototype), "setOptions", this).call(this, newOptions);
|
|
91
124
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
125
|
+
/**
|
|
126
|
+
* 设置按钮 title
|
|
127
|
+
* @param title
|
|
128
|
+
*/
|
|
129
|
+
|
|
130
|
+
}, {
|
|
131
|
+
key: "setBtnTitle",
|
|
132
|
+
value: function setBtnTitle(title) {
|
|
133
|
+
var _this$button3;
|
|
134
|
+
|
|
135
|
+
(_this$button3 = this.button) === null || _this$button3 === void 0 ? void 0 : _this$button3.setAttribute('title', title !== null && title !== void 0 ? title : '');
|
|
97
136
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
137
|
+
/**
|
|
138
|
+
* 设置按钮 Icon
|
|
139
|
+
* @param newIcon
|
|
140
|
+
*/
|
|
141
|
+
|
|
142
|
+
}, {
|
|
143
|
+
key: "setBtnIcon",
|
|
144
|
+
value: function setBtnIcon(newIcon) {
|
|
145
|
+
if (this.buttonIcon) {
|
|
146
|
+
_l7Utils.DOM.remove(this.buttonIcon);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (newIcon) {
|
|
150
|
+
var _this$button4;
|
|
151
|
+
|
|
152
|
+
var firstChild = (_this$button4 = this.button) === null || _this$button4 === void 0 ? void 0 : _this$button4.firstChild;
|
|
153
|
+
|
|
154
|
+
if (firstChild) {
|
|
155
|
+
var _this$button5;
|
|
156
|
+
|
|
157
|
+
(_this$button5 = this.button) === null || _this$button5 === void 0 ? void 0 : _this$button5.insertBefore(newIcon, firstChild);
|
|
158
|
+
} else {
|
|
159
|
+
var _this$button6;
|
|
160
|
+
|
|
161
|
+
(_this$button6 = this.button) === null || _this$button6 === void 0 ? void 0 : _this$button6.appendChild(newIcon);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
this.buttonIcon = newIcon;
|
|
106
165
|
}
|
|
107
|
-
btnText.innerText = newText;
|
|
108
|
-
import_l7_utils.DOM.addClass(this.button, this.controlOption.vertical ? "l7-button-control--column" : "l7-button-control--row");
|
|
109
|
-
} else if (!newText && this.buttonText) {
|
|
110
|
-
import_l7_utils.DOM.remove(this.buttonText);
|
|
111
|
-
this.buttonText = void 0;
|
|
112
166
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
167
|
+
/**
|
|
168
|
+
* 设置按钮文本
|
|
169
|
+
* @param newText
|
|
170
|
+
*/
|
|
171
|
+
|
|
172
|
+
}, {
|
|
173
|
+
key: "setBtnText",
|
|
174
|
+
value: function setBtnText(newText) {
|
|
175
|
+
if (!this.button) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
_l7Utils.DOM.removeClass(this.button, 'l7-button-control--row');
|
|
180
|
+
|
|
181
|
+
_l7Utils.DOM.removeClass(this.button, 'l7-button-control--column');
|
|
182
|
+
|
|
183
|
+
if (newText) {
|
|
184
|
+
var btnText = this.buttonText;
|
|
185
|
+
|
|
186
|
+
if (!btnText) {
|
|
187
|
+
var _this$button7;
|
|
188
|
+
|
|
189
|
+
btnText = _l7Utils.DOM.create('div', 'l7-button-control__text');
|
|
190
|
+
(_this$button7 = this.button) === null || _this$button7 === void 0 ? void 0 : _this$button7.appendChild(btnText);
|
|
191
|
+
this.buttonText = btnText;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
btnText.innerText = newText;
|
|
195
|
+
|
|
196
|
+
_l7Utils.DOM.addClass(this.button, this.controlOption.vertical ? 'l7-button-control--column' : 'l7-button-control--row');
|
|
197
|
+
} else if (!newText && this.buttonText) {
|
|
198
|
+
_l7Utils.DOM.remove(this.buttonText);
|
|
199
|
+
|
|
200
|
+
this.buttonText = undefined;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}]);
|
|
204
|
+
return ButtonControl;
|
|
205
|
+
}(_control.default);
|
|
206
|
+
|
|
207
|
+
exports.default = exports.ButtonControl = ButtonControl;
|