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