@antv/l7-component 2.16.0 → 2.16.1
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 +17 -10
- package/es/control/baseControl/buttonControl.js +42 -9
- package/es/control/baseControl/control.js +54 -25
- package/es/control/baseControl/popperControl.js +24 -10
- package/es/control/baseControl/selectControl.js +45 -6
- package/es/control/exportImage.js +116 -76
- package/es/control/fullscreen.js +53 -20
- package/es/control/geoLocate.js +66 -36
- package/es/control/layerSwitch.js +31 -0
- package/es/control/logo.js +14 -2
- package/es/control/mapTheme.js +32 -7
- package/es/control/mouseLocation.js +23 -2
- package/es/control/scale.js +29 -6
- package/es/control/zoom.js +23 -0
- package/es/index.js +12 -2
- package/es/marker-layer.js +75 -41
- package/es/marker.js +83 -29
- package/es/popup/layerPopup.js +82 -31
- package/es/popup/popup.js +127 -48
- package/es/utils/anchor.js +7 -3
- package/es/utils/popper.js +64 -15
- package/es/utils/screenfull.js +52 -23
- package/lib/assets/iconfont/iconfont.js +17 -10
- package/lib/control/baseControl/buttonControl.js +52 -9
- package/lib/control/baseControl/control.js +69 -25
- package/lib/control/baseControl/index.js +8 -0
- package/lib/control/baseControl/popperControl.js +29 -10
- package/lib/control/baseControl/selectControl.js +60 -6
- package/lib/control/exportImage.js +125 -76
- package/lib/control/fullscreen.js +60 -20
- package/lib/control/geoLocate.js +75 -36
- package/lib/control/layerSwitch.js +36 -0
- package/lib/control/logo.js +26 -2
- package/lib/control/mapTheme.js +42 -7
- package/lib/control/mouseLocation.js +33 -2
- package/lib/control/scale.js +40 -6
- package/lib/control/zoom.js +33 -0
- package/lib/index.js +41 -0
- package/lib/marker-layer.js +86 -39
- package/lib/marker.js +91 -29
- package/lib/popup/layerPopup.js +94 -29
- package/lib/popup/popup.js +139 -48
- package/lib/utils/anchor.js +9 -4
- package/lib/utils/icon.js +2 -0
- package/lib/utils/popper.js +71 -14
- package/lib/utils/screenfull.js +54 -23
- package/package.json +6 -6
|
@@ -1,35 +1,55 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.default = exports.ButtonControl = void 0;
|
|
9
|
+
|
|
8
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
|
|
9
12
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
+
|
|
10
14
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
15
|
+
|
|
11
16
|
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
17
|
+
|
|
12
18
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
19
|
+
|
|
13
20
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
21
|
+
|
|
14
22
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
23
|
+
|
|
15
24
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
|
+
|
|
16
26
|
var _l7Utils = require("@antv/l7-utils");
|
|
27
|
+
|
|
17
28
|
var _control = _interopRequireDefault(require("./control"));
|
|
29
|
+
|
|
18
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
|
+
|
|
19
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
|
+
|
|
20
34
|
var ButtonControl = /*#__PURE__*/function (_Control) {
|
|
21
35
|
(0, _inherits2.default)(ButtonControl, _Control);
|
|
36
|
+
|
|
22
37
|
var _super = _createSuper(ButtonControl);
|
|
38
|
+
|
|
23
39
|
function ButtonControl() {
|
|
24
40
|
var _this;
|
|
41
|
+
|
|
25
42
|
(0, _classCallCheck2.default)(this, ButtonControl);
|
|
43
|
+
|
|
26
44
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
27
45
|
args[_key] = arguments[_key];
|
|
28
46
|
}
|
|
47
|
+
|
|
29
48
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
30
49
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isDisable", false);
|
|
31
50
|
return _this;
|
|
32
51
|
}
|
|
52
|
+
|
|
33
53
|
(0, _createClass2.default)(ButtonControl, [{
|
|
34
54
|
key: "setIsDisable",
|
|
35
55
|
value:
|
|
@@ -39,11 +59,14 @@ var ButtonControl = /*#__PURE__*/function (_Control) {
|
|
|
39
59
|
*/
|
|
40
60
|
function setIsDisable(newIsDisable) {
|
|
41
61
|
this.isDisable = newIsDisable;
|
|
62
|
+
|
|
42
63
|
if (newIsDisable) {
|
|
43
64
|
var _this$button;
|
|
65
|
+
|
|
44
66
|
(_this$button = this.button) === null || _this$button === void 0 ? void 0 : _this$button.setAttribute('disabled', 'true');
|
|
45
67
|
} else {
|
|
46
68
|
var _this$button2;
|
|
69
|
+
|
|
47
70
|
(_this$button2 = this.button) === null || _this$button2 === void 0 ? void 0 : _this$button2.removeAttribute('disabled');
|
|
48
71
|
}
|
|
49
72
|
}
|
|
@@ -59,9 +82,9 @@ var ButtonControl = /*#__PURE__*/function (_Control) {
|
|
|
59
82
|
this.button = this.createButton();
|
|
60
83
|
this.isDisable = false;
|
|
61
84
|
var _this$controlOption = this.controlOption,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
85
|
+
title = _this$controlOption.title,
|
|
86
|
+
btnText = _this$controlOption.btnText,
|
|
87
|
+
btnIcon = _this$controlOption.btnIcon;
|
|
65
88
|
this.setBtnTitle(title);
|
|
66
89
|
this.setBtnText(btnText);
|
|
67
90
|
this.setBtnIcon(btnIcon);
|
|
@@ -73,92 +96,112 @@ var ButtonControl = /*#__PURE__*/function (_Control) {
|
|
|
73
96
|
this.button = this.buttonIcon = this.buttonText = undefined;
|
|
74
97
|
this.isDisable = false;
|
|
75
98
|
}
|
|
76
|
-
|
|
77
99
|
/**
|
|
78
100
|
* 更新配置方法
|
|
79
101
|
* @param newOptions
|
|
80
102
|
*/
|
|
103
|
+
|
|
81
104
|
}, {
|
|
82
105
|
key: "setOptions",
|
|
83
106
|
value: function setOptions(newOptions) {
|
|
84
107
|
var title = newOptions.title,
|
|
85
|
-
|
|
86
|
-
|
|
108
|
+
btnText = newOptions.btnText,
|
|
109
|
+
btnIcon = newOptions.btnIcon;
|
|
110
|
+
|
|
87
111
|
if (this.checkUpdateOption(newOptions, ['title'])) {
|
|
88
112
|
this.setBtnTitle(title);
|
|
89
113
|
}
|
|
114
|
+
|
|
90
115
|
if (this.checkUpdateOption(newOptions, ['btnIcon'])) {
|
|
91
116
|
this.setBtnIcon(btnIcon);
|
|
92
117
|
}
|
|
118
|
+
|
|
93
119
|
if (this.checkUpdateOption(newOptions, ['btnText'])) {
|
|
94
120
|
this.setBtnText(btnText);
|
|
95
121
|
}
|
|
122
|
+
|
|
96
123
|
(0, _get2.default)((0, _getPrototypeOf2.default)(ButtonControl.prototype), "setOptions", this).call(this, newOptions);
|
|
97
124
|
}
|
|
98
|
-
|
|
99
125
|
/**
|
|
100
126
|
* 设置按钮 title
|
|
101
127
|
* @param title
|
|
102
128
|
*/
|
|
129
|
+
|
|
103
130
|
}, {
|
|
104
131
|
key: "setBtnTitle",
|
|
105
132
|
value: function setBtnTitle(title) {
|
|
106
133
|
var _this$button3;
|
|
134
|
+
|
|
107
135
|
(_this$button3 = this.button) === null || _this$button3 === void 0 ? void 0 : _this$button3.setAttribute('title', title !== null && title !== void 0 ? title : '');
|
|
108
136
|
}
|
|
109
|
-
|
|
110
137
|
/**
|
|
111
138
|
* 设置按钮 Icon
|
|
112
139
|
* @param newIcon
|
|
113
140
|
*/
|
|
141
|
+
|
|
114
142
|
}, {
|
|
115
143
|
key: "setBtnIcon",
|
|
116
144
|
value: function setBtnIcon(newIcon) {
|
|
117
145
|
if (this.buttonIcon) {
|
|
118
146
|
_l7Utils.DOM.remove(this.buttonIcon);
|
|
119
147
|
}
|
|
148
|
+
|
|
120
149
|
if (newIcon) {
|
|
121
150
|
var _this$button4;
|
|
151
|
+
|
|
122
152
|
var firstChild = (_this$button4 = this.button) === null || _this$button4 === void 0 ? void 0 : _this$button4.firstChild;
|
|
153
|
+
|
|
123
154
|
if (firstChild) {
|
|
124
155
|
var _this$button5;
|
|
156
|
+
|
|
125
157
|
(_this$button5 = this.button) === null || _this$button5 === void 0 ? void 0 : _this$button5.insertBefore(newIcon, firstChild);
|
|
126
158
|
} else {
|
|
127
159
|
var _this$button6;
|
|
160
|
+
|
|
128
161
|
(_this$button6 = this.button) === null || _this$button6 === void 0 ? void 0 : _this$button6.appendChild(newIcon);
|
|
129
162
|
}
|
|
163
|
+
|
|
130
164
|
this.buttonIcon = newIcon;
|
|
131
165
|
}
|
|
132
166
|
}
|
|
133
|
-
|
|
134
167
|
/**
|
|
135
168
|
* 设置按钮文本
|
|
136
169
|
* @param newText
|
|
137
170
|
*/
|
|
171
|
+
|
|
138
172
|
}, {
|
|
139
173
|
key: "setBtnText",
|
|
140
174
|
value: function setBtnText(newText) {
|
|
141
175
|
if (!this.button) {
|
|
142
176
|
return;
|
|
143
177
|
}
|
|
178
|
+
|
|
144
179
|
_l7Utils.DOM.removeClass(this.button, 'l7-button-control--row');
|
|
180
|
+
|
|
145
181
|
_l7Utils.DOM.removeClass(this.button, 'l7-button-control--column');
|
|
182
|
+
|
|
146
183
|
if (newText) {
|
|
147
184
|
var btnText = this.buttonText;
|
|
185
|
+
|
|
148
186
|
if (!btnText) {
|
|
149
187
|
var _this$button7;
|
|
188
|
+
|
|
150
189
|
btnText = _l7Utils.DOM.create('div', 'l7-button-control__text');
|
|
151
190
|
(_this$button7 = this.button) === null || _this$button7 === void 0 ? void 0 : _this$button7.appendChild(btnText);
|
|
152
191
|
this.buttonText = btnText;
|
|
153
192
|
}
|
|
193
|
+
|
|
154
194
|
btnText.innerText = newText;
|
|
195
|
+
|
|
155
196
|
_l7Utils.DOM.addClass(this.button, this.controlOption.vertical ? 'l7-button-control--column' : 'l7-button-control--row');
|
|
156
197
|
} else if (!newText && this.buttonText) {
|
|
157
198
|
_l7Utils.DOM.remove(this.buttonText);
|
|
199
|
+
|
|
158
200
|
this.buttonText = undefined;
|
|
159
201
|
}
|
|
160
202
|
}
|
|
161
203
|
}]);
|
|
162
204
|
return ButtonControl;
|
|
163
205
|
}(_control.default);
|
|
206
|
+
|
|
164
207
|
exports.default = exports.ButtonControl = ButtonControl;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
@@ -12,73 +13,95 @@ Object.defineProperty(exports, "PositionType", {
|
|
|
12
13
|
}
|
|
13
14
|
});
|
|
14
15
|
exports.default = void 0;
|
|
16
|
+
|
|
15
17
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
18
|
+
|
|
16
19
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
20
|
+
|
|
17
21
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
22
|
+
|
|
18
23
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
24
|
+
|
|
19
25
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
26
|
+
|
|
20
27
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
28
|
+
|
|
21
29
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
30
|
+
|
|
22
31
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
32
|
+
|
|
23
33
|
var _l7Core = require("@antv/l7-core");
|
|
34
|
+
|
|
24
35
|
var _l7Utils = require("@antv/l7-utils");
|
|
36
|
+
|
|
25
37
|
var _eventemitter = _interopRequireDefault(require("eventemitter3"));
|
|
38
|
+
|
|
26
39
|
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); }; }
|
|
40
|
+
|
|
27
41
|
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; } }
|
|
42
|
+
|
|
28
43
|
var Control = /*#__PURE__*/function (_ref) {
|
|
29
44
|
(0, _inherits2.default)(Control, _ref);
|
|
45
|
+
|
|
30
46
|
var _super = _createSuper(Control);
|
|
47
|
+
|
|
31
48
|
/**
|
|
32
49
|
* 当前类型控件实例个数
|
|
33
50
|
* @protected
|
|
34
51
|
*/
|
|
35
|
-
|
|
36
52
|
function Control(option) {
|
|
37
53
|
var _this;
|
|
54
|
+
|
|
38
55
|
(0, _classCallCheck2.default)(this, Control);
|
|
39
56
|
_this = _super.call(this);
|
|
40
57
|
Control.controlCount++;
|
|
41
58
|
_this.controlOption = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, _this.getDefault(option)), option || {});
|
|
42
59
|
return _this;
|
|
43
60
|
}
|
|
61
|
+
|
|
44
62
|
(0, _createClass2.default)(Control, [{
|
|
45
63
|
key: "getOptions",
|
|
46
64
|
value: function getOptions() {
|
|
47
65
|
return this.controlOption;
|
|
48
66
|
}
|
|
49
|
-
|
|
50
67
|
/**
|
|
51
68
|
* 更新配置的方法,子类如果有自己的配置,也需要重写该方法
|
|
52
69
|
* @param newOptions
|
|
53
70
|
*/
|
|
71
|
+
|
|
54
72
|
}, {
|
|
55
73
|
key: "setOptions",
|
|
56
74
|
value: function setOptions(newOptions) {
|
|
57
75
|
var defaultOptions = this.getDefault(newOptions);
|
|
58
76
|
Object.entries(newOptions).forEach(function (_ref2) {
|
|
59
77
|
var _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
|
|
60
|
-
|
|
61
|
-
|
|
78
|
+
key = _ref3[0],
|
|
79
|
+
value = _ref3[1];
|
|
80
|
+
|
|
62
81
|
if (value === undefined) {
|
|
63
82
|
newOptions[key] = defaultOptions[key];
|
|
64
83
|
}
|
|
65
84
|
});
|
|
85
|
+
|
|
66
86
|
if ('position' in newOptions) {
|
|
67
87
|
this.setPosition(newOptions.position);
|
|
68
88
|
}
|
|
89
|
+
|
|
69
90
|
if ('className' in newOptions) {
|
|
70
91
|
this.setClassName(newOptions.className);
|
|
71
92
|
}
|
|
93
|
+
|
|
72
94
|
if ('style' in newOptions) {
|
|
73
95
|
this.setStyle(newOptions.style);
|
|
74
96
|
}
|
|
97
|
+
|
|
75
98
|
this.controlOption = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, this.controlOption), newOptions);
|
|
76
99
|
}
|
|
77
|
-
|
|
78
100
|
/**
|
|
79
101
|
* 当 Control 被添加至 Scene 中,被 controlService 调用的方法
|
|
80
102
|
* @param sceneContainer
|
|
81
103
|
*/
|
|
104
|
+
|
|
82
105
|
}, {
|
|
83
106
|
key: "addTo",
|
|
84
107
|
value: function addTo(sceneContainer) {
|
|
@@ -90,85 +113,95 @@ var Control = /*#__PURE__*/function (_ref) {
|
|
|
90
113
|
this.configService = sceneContainer.get(_l7Core.TYPES.IGlobalConfigService);
|
|
91
114
|
this.scene = sceneContainer.get(_l7Core.TYPES.ISceneService);
|
|
92
115
|
this.sceneContainer = sceneContainer;
|
|
93
|
-
this.isShow = true;
|
|
116
|
+
this.isShow = true; // 初始化 container
|
|
94
117
|
|
|
95
|
-
// 初始化 container
|
|
96
118
|
this.container = this.onAdd();
|
|
119
|
+
|
|
97
120
|
_l7Utils.DOM.addClass(this.container, 'l7-control');
|
|
121
|
+
|
|
98
122
|
var _this$controlOption = this.controlOption,
|
|
99
|
-
|
|
100
|
-
|
|
123
|
+
className = _this$controlOption.className,
|
|
124
|
+
style = _this$controlOption.style;
|
|
125
|
+
|
|
101
126
|
if (className) {
|
|
102
127
|
this.setClassName(className);
|
|
103
128
|
}
|
|
129
|
+
|
|
104
130
|
if (style) {
|
|
105
131
|
this.setStyle(style);
|
|
106
|
-
}
|
|
107
|
-
|
|
132
|
+
} // 将 container 插入容器中
|
|
133
|
+
|
|
134
|
+
|
|
108
135
|
this.insertContainer();
|
|
109
136
|
this.emit('add', this);
|
|
110
137
|
return this;
|
|
111
138
|
}
|
|
112
|
-
|
|
113
139
|
/**
|
|
114
140
|
* 将控件移除时触发
|
|
115
141
|
*/
|
|
142
|
+
|
|
116
143
|
}, {
|
|
117
144
|
key: "remove",
|
|
118
145
|
value: function remove() {
|
|
119
146
|
if (!this.mapsService) {
|
|
120
147
|
return this;
|
|
121
148
|
}
|
|
149
|
+
|
|
122
150
|
_l7Utils.DOM.remove(this.container);
|
|
151
|
+
|
|
123
152
|
this.onRemove();
|
|
124
153
|
this.emit('remove', this);
|
|
125
154
|
}
|
|
126
|
-
|
|
127
155
|
/**
|
|
128
156
|
* Control 被添加的时候被调用,返回 Control 对应的 DOM 容器
|
|
129
157
|
*/
|
|
158
|
+
|
|
130
159
|
}, {
|
|
131
160
|
key: "onAdd",
|
|
132
161
|
value: function onAdd() {
|
|
133
162
|
return _l7Utils.DOM.create('div');
|
|
134
163
|
}
|
|
135
|
-
|
|
136
164
|
/**
|
|
137
165
|
* Control 被移除时调用
|
|
138
166
|
*/
|
|
139
167
|
// tslint:disable-next-line:no-empty
|
|
168
|
+
|
|
140
169
|
}, {
|
|
141
170
|
key: "onRemove",
|
|
142
171
|
value: function onRemove() {}
|
|
143
|
-
|
|
144
172
|
/**
|
|
145
173
|
* 显示控件时触发
|
|
146
174
|
*/
|
|
175
|
+
|
|
147
176
|
}, {
|
|
148
177
|
key: "show",
|
|
149
178
|
value: function show() {
|
|
150
179
|
var container = this.container;
|
|
180
|
+
|
|
151
181
|
_l7Utils.DOM.removeClass(container, 'l7-control--hide');
|
|
182
|
+
|
|
152
183
|
this.isShow = true;
|
|
153
184
|
this.emit('show', this);
|
|
154
185
|
}
|
|
155
|
-
|
|
156
186
|
/**
|
|
157
187
|
* 隐藏控件时触发
|
|
158
188
|
*/
|
|
189
|
+
|
|
159
190
|
}, {
|
|
160
191
|
key: "hide",
|
|
161
192
|
value: function hide() {
|
|
162
193
|
var container = this.container;
|
|
194
|
+
|
|
163
195
|
_l7Utils.DOM.addClass(container, 'l7-control--hide');
|
|
196
|
+
|
|
164
197
|
this.isShow = false;
|
|
165
198
|
this.emit('hide', this);
|
|
166
199
|
}
|
|
167
|
-
|
|
168
200
|
/**
|
|
169
201
|
* 获取默认构造器参数
|
|
170
202
|
*/
|
|
171
203
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
204
|
+
|
|
172
205
|
}, {
|
|
173
206
|
key: "getDefault",
|
|
174
207
|
value: function getDefault(option) {
|
|
@@ -178,19 +211,19 @@ var Control = /*#__PURE__*/function (_ref) {
|
|
|
178
211
|
name: "".concat(Control.controlCount)
|
|
179
212
|
};
|
|
180
213
|
}
|
|
181
|
-
|
|
182
214
|
/**
|
|
183
215
|
* 获取当前控件对应的 DOM 容器
|
|
184
216
|
*/
|
|
217
|
+
|
|
185
218
|
}, {
|
|
186
219
|
key: "getContainer",
|
|
187
220
|
value: function getContainer() {
|
|
188
221
|
return this.container;
|
|
189
222
|
}
|
|
190
|
-
|
|
191
223
|
/**
|
|
192
224
|
* 获取当前 Control 是否展示
|
|
193
225
|
*/
|
|
226
|
+
|
|
194
227
|
}, {
|
|
195
228
|
key: "getIsShow",
|
|
196
229
|
value: function getIsShow() {
|
|
@@ -202,91 +235,101 @@ var Control = /*#__PURE__*/function (_ref) {
|
|
|
202
235
|
// if map exists and event is not a keyboard event
|
|
203
236
|
if (this.mapsService && e && e.screenX > 0 && e.screenY > 0) {
|
|
204
237
|
var container = this.mapsService.getContainer();
|
|
238
|
+
|
|
205
239
|
if (container !== null) {
|
|
206
240
|
container.focus();
|
|
207
241
|
}
|
|
208
242
|
}
|
|
209
243
|
}
|
|
210
|
-
|
|
211
244
|
/**
|
|
212
245
|
* 设置当前控件位置
|
|
213
246
|
* @param position
|
|
214
247
|
*/
|
|
248
|
+
|
|
215
249
|
}, {
|
|
216
250
|
key: "setPosition",
|
|
217
251
|
value: function setPosition() {
|
|
218
252
|
var position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _l7Core.PositionType.TOPLEFT;
|
|
219
253
|
// 考虑组件的自动布局,需要销毁重建
|
|
220
254
|
var controlService = this.controlService;
|
|
255
|
+
|
|
221
256
|
if (controlService) {
|
|
222
257
|
controlService.removeControl(this);
|
|
223
258
|
}
|
|
259
|
+
|
|
224
260
|
this.controlOption.position = position;
|
|
261
|
+
|
|
225
262
|
if (controlService) {
|
|
226
263
|
controlService.addControl(this, this.sceneContainer);
|
|
227
264
|
}
|
|
265
|
+
|
|
228
266
|
return this;
|
|
229
267
|
}
|
|
230
|
-
|
|
231
268
|
/**
|
|
232
269
|
* 设置容器 container 的样式相关位置,包含 className
|
|
233
270
|
* @param className
|
|
234
271
|
*/
|
|
272
|
+
|
|
235
273
|
}, {
|
|
236
274
|
key: "setClassName",
|
|
237
275
|
value: function setClassName(className) {
|
|
238
276
|
var container = this.container;
|
|
239
277
|
var oldClassName = this.controlOption.className;
|
|
278
|
+
|
|
240
279
|
if (oldClassName) {
|
|
241
280
|
_l7Utils.DOM.removeClass(container, oldClassName);
|
|
242
281
|
}
|
|
282
|
+
|
|
243
283
|
if (className) {
|
|
244
284
|
_l7Utils.DOM.addClass(container, className);
|
|
245
285
|
}
|
|
246
286
|
}
|
|
247
|
-
|
|
248
287
|
/**
|
|
249
288
|
* 设置容器 container 的样式相关位置,包含 style
|
|
250
289
|
* @param style
|
|
251
290
|
*/
|
|
291
|
+
|
|
252
292
|
}, {
|
|
253
293
|
key: "setStyle",
|
|
254
294
|
value: function setStyle(style) {
|
|
255
295
|
var container = this.container;
|
|
296
|
+
|
|
256
297
|
if (style) {
|
|
257
298
|
container.setAttribute('style', style);
|
|
258
299
|
} else {
|
|
259
300
|
container.removeAttribute('style');
|
|
260
301
|
}
|
|
261
302
|
}
|
|
262
|
-
|
|
263
303
|
/**
|
|
264
304
|
* 将控件 DOM 插入到对应 position 的容器中
|
|
265
305
|
* @protected
|
|
266
306
|
*/
|
|
307
|
+
|
|
267
308
|
}, {
|
|
268
309
|
key: "insertContainer",
|
|
269
310
|
value: function insertContainer() {
|
|
270
311
|
var position = this.controlOption.position;
|
|
271
312
|
var container = this.container;
|
|
313
|
+
|
|
272
314
|
if (position instanceof Element) {
|
|
273
315
|
position.appendChild(container);
|
|
274
316
|
} else {
|
|
275
317
|
var corner = this.controlService.controlCorners[position];
|
|
276
|
-
|
|
318
|
+
|
|
319
|
+
if (['bottomleft', 'bottomright', 'righttop', 'rightbottom'].includes(position)) {
|
|
277
320
|
corner.insertBefore(container, corner.firstChild);
|
|
278
321
|
} else {
|
|
279
322
|
corner.appendChild(container);
|
|
280
323
|
}
|
|
281
324
|
}
|
|
282
325
|
}
|
|
283
|
-
|
|
284
326
|
/**
|
|
285
327
|
* 检查当前传入 option 是否包含 keys 字段
|
|
286
328
|
* @param option
|
|
287
329
|
* @param keys
|
|
288
330
|
* @protected
|
|
289
331
|
*/
|
|
332
|
+
|
|
290
333
|
}, {
|
|
291
334
|
key: "checkUpdateOption",
|
|
292
335
|
value: function checkUpdateOption(option, keys) {
|
|
@@ -297,5 +340,6 @@ var Control = /*#__PURE__*/function (_ref) {
|
|
|
297
340
|
}]);
|
|
298
341
|
return Control;
|
|
299
342
|
}(_eventemitter.default);
|
|
343
|
+
|
|
300
344
|
exports.default = exports.Control = Control;
|
|
301
345
|
(0, _defineProperty2.default)(Control, "controlCount", 0);
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
|
|
6
7
|
var _buttonControl = require("./buttonControl");
|
|
8
|
+
|
|
7
9
|
Object.keys(_buttonControl).forEach(function (key) {
|
|
8
10
|
if (key === "default" || key === "__esModule") return;
|
|
9
11
|
if (key in exports && exports[key] === _buttonControl[key]) return;
|
|
@@ -14,7 +16,9 @@ Object.keys(_buttonControl).forEach(function (key) {
|
|
|
14
16
|
}
|
|
15
17
|
});
|
|
16
18
|
});
|
|
19
|
+
|
|
17
20
|
var _control = require("./control");
|
|
21
|
+
|
|
18
22
|
Object.keys(_control).forEach(function (key) {
|
|
19
23
|
if (key === "default" || key === "__esModule") return;
|
|
20
24
|
if (key in exports && exports[key] === _control[key]) return;
|
|
@@ -25,7 +29,9 @@ Object.keys(_control).forEach(function (key) {
|
|
|
25
29
|
}
|
|
26
30
|
});
|
|
27
31
|
});
|
|
32
|
+
|
|
28
33
|
var _popperControl = require("./popperControl");
|
|
34
|
+
|
|
29
35
|
Object.keys(_popperControl).forEach(function (key) {
|
|
30
36
|
if (key === "default" || key === "__esModule") return;
|
|
31
37
|
if (key in exports && exports[key] === _popperControl[key]) return;
|
|
@@ -36,7 +42,9 @@ Object.keys(_popperControl).forEach(function (key) {
|
|
|
36
42
|
}
|
|
37
43
|
});
|
|
38
44
|
});
|
|
45
|
+
|
|
39
46
|
var _selectControl = require("./selectControl");
|
|
47
|
+
|
|
40
48
|
Object.keys(_selectControl).forEach(function (key) {
|
|
41
49
|
if (key === "default" || key === "__esModule") return;
|
|
42
50
|
if (key in exports && exports[key] === _selectControl[key]) return;
|