@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.
Files changed (80) hide show
  1. package/es/assets/iconfont/iconfont.js +6 -6
  2. package/es/constants/index.js +2 -2
  3. package/es/control/baseControl/buttonControl.js +109 -144
  4. package/es/control/baseControl/control.js +212 -258
  5. package/es/control/baseControl/popperControl.js +67 -95
  6. package/es/control/baseControl/selectControl.js +132 -178
  7. package/es/control/exportImage.js +59 -142
  8. package/es/control/fullscreen.js +69 -100
  9. package/es/control/geoLocate.js +37 -84
  10. package/es/control/layerSwitch.js +111 -154
  11. package/es/control/logo.js +43 -69
  12. package/es/control/mapTheme.js +57 -98
  13. package/es/control/mouseLocation.js +37 -69
  14. package/es/control/scale.js +107 -135
  15. package/es/control/swipe.js +297 -389
  16. package/es/control/zoom.js +80 -112
  17. package/es/css/index.css +10 -7
  18. package/es/index.js +675 -1
  19. package/es/marker-layer.js +275 -326
  20. package/es/marker.js +394 -446
  21. package/es/popup/layerPopup.js +277 -321
  22. package/es/popup/popup.js +422 -482
  23. package/es/utils/anchor.js +6 -6
  24. package/es/utils/icon.js +4 -4
  25. package/es/utils/popper.js +180 -196
  26. package/es/utils/screenfull.js +29 -51
  27. package/lib/assets/iconfont/iconfont.js +6 -6
  28. package/lib/constants/index.d.ts +60 -0
  29. package/lib/constants/index.js +2 -2
  30. package/lib/control/baseControl/buttonControl.d.ts +60 -0
  31. package/lib/control/baseControl/buttonControl.js +110 -143
  32. package/lib/control/baseControl/control.d.ts +112 -0
  33. package/lib/control/baseControl/control.js +213 -257
  34. package/lib/control/baseControl/index.d.ts +4 -0
  35. package/lib/control/baseControl/index.js +5 -5
  36. package/lib/control/baseControl/popperControl.d.ts +28 -0
  37. package/lib/control/baseControl/popperControl.js +68 -94
  38. package/lib/control/baseControl/selectControl.d.ts +53 -0
  39. package/lib/control/baseControl/selectControl.js +133 -177
  40. package/lib/control/exportImage.d.ts +19 -0
  41. package/lib/control/exportImage.js +60 -141
  42. package/lib/control/fullscreen.d.ts +20 -0
  43. package/lib/control/fullscreen.js +70 -99
  44. package/lib/control/geoLocate.d.ts +17 -0
  45. package/lib/control/geoLocate.js +38 -83
  46. package/lib/control/layerSwitch.d.ts +27 -0
  47. package/lib/control/layerSwitch.js +112 -153
  48. package/lib/control/logo.d.ts +14 -0
  49. package/lib/control/logo.js +44 -69
  50. package/lib/control/mapTheme.d.ts +11 -0
  51. package/lib/control/mapTheme.js +58 -97
  52. package/lib/control/mouseLocation.d.ts +16 -0
  53. package/lib/control/mouseLocation.js +38 -68
  54. package/lib/control/scale.d.ts +35 -0
  55. package/lib/control/scale.js +108 -134
  56. package/lib/control/swipe.d.ts +66 -0
  57. package/lib/control/swipe.js +298 -388
  58. package/lib/control/zoom.d.ts +39 -0
  59. package/lib/control/zoom.js +81 -111
  60. package/lib/css/index.css +10 -7
  61. package/lib/index.d.ts +19 -0
  62. package/lib/index.js +691 -17
  63. package/lib/interface.d.ts +18 -0
  64. package/lib/marker-layer.d.ts +55 -0
  65. package/lib/marker-layer.js +277 -324
  66. package/lib/marker.d.ts +58 -0
  67. package/lib/marker.js +395 -445
  68. package/lib/popup/layerPopup.d.ts +99 -0
  69. package/lib/popup/layerPopup.js +278 -320
  70. package/lib/popup/popup.d.ts +142 -0
  71. package/lib/popup/popup.js +423 -481
  72. package/lib/utils/anchor.d.ts +22 -0
  73. package/lib/utils/anchor.js +6 -6
  74. package/lib/utils/icon.d.ts +1 -0
  75. package/lib/utils/icon.js +6 -5
  76. package/lib/utils/popper.d.ts +76 -0
  77. package/lib/utils/popper.js +184 -196
  78. package/lib/utils/screenfull.d.ts +2 -0
  79. package/lib/utils/screenfull.js +29 -52
  80. package/package.json +16 -20
@@ -8,11 +8,11 @@ window._iconfont_svg_string_3580659 = '<svg><symbol id="l7-icon-area1" viewBox="
8
8
  a = a.getAttribute('data-disable-injectsvg');
9
9
  if (!a) {
10
10
  var o,
11
- _e,
11
+ e,
12
12
  i,
13
13
  n,
14
14
  m,
15
- c = function c(a, l) {
15
+ c = function (a, l) {
16
16
  l.parentNode.insertBefore(a, l);
17
17
  };
18
18
  if (l && !t.__iconfont__svg__cssinject__) {
@@ -23,13 +23,13 @@ window._iconfont_svg_string_3580659 = '<svg><symbol id="l7-icon-area1" viewBox="
23
23
  console && console.log(a);
24
24
  }
25
25
  }
26
- o = function o() {
26
+ o = function () {
27
27
  var a,
28
28
  l = document.createElement('div');
29
29
  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));
30
- }, document.addEventListener ? ~['complete', 'loaded', 'interactive'].indexOf(document.readyState) ? setTimeout(o, 0) : (_e = function e() {
31
- document.removeEventListener('DOMContentLoaded', _e, !1), o();
32
- }, document.addEventListener('DOMContentLoaded', _e, !1)) : document.attachEvent && (i = o, n = t.document, m = !1, L(), n.onreadystatechange = function () {
30
+ }, document.addEventListener ? ~['complete', 'loaded', 'interactive'].indexOf(document.readyState) ? setTimeout(o, 0) : (e = function () {
31
+ document.removeEventListener('DOMContentLoaded', e, !1), o();
32
+ }, document.addEventListener('DOMContentLoaded', e, !1)) : document.attachEvent && (i = o, n = t.document, m = !1, L(), n.onreadystatechange = function () {
33
33
  'complete' == n.readyState && (n.onreadystatechange = null, d());
34
34
  });
35
35
  }
@@ -0,0 +1,60 @@
1
+ export declare const GaodeMapStyleConfig: {
2
+ normal: {
3
+ text: string;
4
+ img: string;
5
+ };
6
+ light: {
7
+ text: string;
8
+ img: string;
9
+ };
10
+ dark: {
11
+ text: string;
12
+ img: string;
13
+ };
14
+ fresh: {
15
+ text: string;
16
+ img: string;
17
+ };
18
+ grey: {
19
+ text: string;
20
+ img: string;
21
+ };
22
+ graffiti: {
23
+ text: string;
24
+ img: string;
25
+ };
26
+ macaron: {
27
+ text: string;
28
+ img: string;
29
+ };
30
+ darkblue: {
31
+ text: string;
32
+ img: string;
33
+ };
34
+ wine: {
35
+ text: string;
36
+ img: string;
37
+ };
38
+ };
39
+ export declare const MapboxMapStyleConfig: {
40
+ normal: {
41
+ text: string;
42
+ img: string;
43
+ };
44
+ light: {
45
+ text: string;
46
+ img: string;
47
+ };
48
+ dark: {
49
+ text: string;
50
+ img: string;
51
+ };
52
+ satellite: {
53
+ text: string;
54
+ img: string;
55
+ };
56
+ outdoors: {
57
+ text: string;
58
+ img: string;
59
+ };
60
+ };
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.MapboxMapStyleConfig = exports.GaodeMapStyleConfig = void 0;
7
- var GaodeMapStyleConfig = exports.GaodeMapStyleConfig = {
7
+ const GaodeMapStyleConfig = exports.GaodeMapStyleConfig = {
8
8
  normal: {
9
9
  text: '标准',
10
10
  img: 'https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*qdFDSbvIalgAAAAAAAAAAAAADmJ7AQ/original'
@@ -42,7 +42,7 @@ var GaodeMapStyleConfig = exports.GaodeMapStyleConfig = {
42
42
  img: 'https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*orY0T7QL-lwAAAAAAAAAAAAADmJ7AQ/original'
43
43
  }
44
44
  };
45
- var MapboxMapStyleConfig = exports.MapboxMapStyleConfig = {
45
+ const MapboxMapStyleConfig = exports.MapboxMapStyleConfig = {
46
46
  normal: {
47
47
  text: '标准',
48
48
  img: 'https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*kIyZTok4Uk0AAAAAAAAAAAAADmJ7AQ/original'
@@ -0,0 +1,60 @@
1
+ import { DOM } from '@antv/l7-utils';
2
+ import type { IControlOption } from './control';
3
+ import Control from './control';
4
+ export { ButtonControl };
5
+ export interface IButtonControlOption extends IControlOption {
6
+ btnIcon?: DOM.ELType | DocumentFragment;
7
+ btnText?: string;
8
+ title?: string;
9
+ vertical?: boolean;
10
+ }
11
+ export default class ButtonControl<O extends IButtonControlOption = IButtonControlOption> extends Control<O> {
12
+ /**
13
+ * 当前按钮是否禁用
14
+ * @protected
15
+ */
16
+ protected isDisable: boolean;
17
+ /**
18
+ * 按钮的 DOM
19
+ * @protected
20
+ */
21
+ protected button?: HTMLElement;
22
+ /**
23
+ * 按钮中文本对应的 DOM
24
+ * @protected
25
+ */
26
+ protected buttonText?: HTMLElement;
27
+ /**
28
+ * 按钮中图标对应的 DOM
29
+ * @protected
30
+ */
31
+ protected buttonIcon?: DOM.ELType | DocumentFragment;
32
+ /**
33
+ * 设置当前按钮
34
+ * @param newIsDisable
35
+ */
36
+ setIsDisable(newIsDisable: boolean): void;
37
+ createButton(className?: string): HTMLElement;
38
+ onAdd(): HTMLElement;
39
+ onRemove(): void;
40
+ /**
41
+ * 更新配置方法
42
+ * @param newOptions
43
+ */
44
+ setOptions(newOptions: Partial<O>): void;
45
+ /**
46
+ * 设置按钮 title
47
+ * @param title
48
+ */
49
+ setBtnTitle(title: O['title']): void;
50
+ /**
51
+ * 设置按钮 Icon
52
+ * @param newIcon
53
+ */
54
+ setBtnIcon(newIcon: O['btnIcon']): void;
55
+ /**
56
+ * 设置按钮文本
57
+ * @param newText
58
+ */
59
+ setBtnText(newText: O['btnText']): void;
60
+ }
@@ -5,178 +5,145 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = exports.ButtonControl = void 0;
8
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
11
- var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
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
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
16
9
  var _l7Utils = require("@antv/l7-utils");
17
10
  var _control = _interopRequireDefault(require("./control"));
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
- var ButtonControl = exports.default = exports.ButtonControl = /*#__PURE__*/function (_Control) {
21
- (0, _inherits2.default)(ButtonControl, _Control);
22
- var _super = _createSuper(ButtonControl);
23
- function ButtonControl() {
24
- var _this;
25
- (0, _classCallCheck2.default)(this, ButtonControl);
26
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
27
- args[_key] = arguments[_key];
28
- }
29
- _this = _super.call.apply(_super, [this].concat(args));
11
+ class ButtonControl extends _control.default {
12
+ constructor(...args) {
13
+ super(...args);
30
14
  /**
31
15
  * 当前按钮是否禁用
32
16
  * @protected
33
17
  */
34
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isDisable", false);
35
- return _this;
36
- }
37
- (0, _createClass2.default)(ButtonControl, [{
38
- key: "setIsDisable",
39
- value:
18
+ (0, _defineProperty2.default)(this, "isDisable", false);
40
19
  /**
41
20
  * 按钮的 DOM
42
21
  * @protected
43
22
  */
44
-
23
+ (0, _defineProperty2.default)(this, "button", void 0);
45
24
  /**
46
25
  * 按钮中文本对应的 DOM
47
26
  * @protected
48
27
  */
49
-
28
+ (0, _defineProperty2.default)(this, "buttonText", void 0);
50
29
  /**
51
30
  * 按钮中图标对应的 DOM
52
31
  * @protected
53
32
  */
54
-
55
- /**
56
- * 设置当前按钮
57
- * @param newIsDisable
58
- */
59
- function setIsDisable(newIsDisable) {
60
- this.isDisable = newIsDisable;
61
- if (newIsDisable) {
62
- var _this$button;
63
- (_this$button = this.button) === null || _this$button === void 0 || _this$button.setAttribute('disabled', 'true');
64
- } else {
65
- var _this$button2;
66
- (_this$button2 = this.button) === null || _this$button2 === void 0 || _this$button2.removeAttribute('disabled');
67
- }
68
- }
69
- }, {
70
- key: "createButton",
71
- value: function createButton() {
72
- var className = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
73
- return _l7Utils.DOM.create('button', "l7-button-control ".concat(className));
33
+ (0, _defineProperty2.default)(this, "buttonIcon", void 0);
34
+ }
35
+ /**
36
+ * 设置当前按钮
37
+ * @param newIsDisable
38
+ */
39
+ setIsDisable(newIsDisable) {
40
+ this.isDisable = newIsDisable;
41
+ if (newIsDisable) {
42
+ var _this$button;
43
+ (_this$button = this.button) === null || _this$button === void 0 || _this$button.setAttribute('disabled', 'true');
44
+ } else {
45
+ var _this$button2;
46
+ (_this$button2 = this.button) === null || _this$button2 === void 0 || _this$button2.removeAttribute('disabled');
74
47
  }
75
- }, {
76
- key: "onAdd",
77
- value: function onAdd() {
78
- this.button = this.createButton();
79
- this.isDisable = false;
80
- var _this$controlOption = this.controlOption,
81
- title = _this$controlOption.title,
82
- btnText = _this$controlOption.btnText,
83
- btnIcon = _this$controlOption.btnIcon;
48
+ }
49
+ createButton(className = '') {
50
+ return _l7Utils.DOM.create('button', `l7-button-control ${className}`);
51
+ }
52
+ onAdd() {
53
+ this.button = this.createButton();
54
+ this.isDisable = false;
55
+ const {
56
+ title,
57
+ btnText,
58
+ btnIcon
59
+ } = this.controlOption;
60
+ this.setBtnTitle(title);
61
+ this.setBtnText(btnText);
62
+ this.setBtnIcon(btnIcon);
63
+ return this.button;
64
+ }
65
+ onRemove() {
66
+ this.button = this.buttonIcon = this.buttonText = undefined;
67
+ this.isDisable = false;
68
+ }
69
+
70
+ /**
71
+ * 更新配置方法
72
+ * @param newOptions
73
+ */
74
+ setOptions(newOptions) {
75
+ const {
76
+ title,
77
+ btnText,
78
+ btnIcon
79
+ } = newOptions;
80
+ if (this.checkUpdateOption(newOptions, ['title'])) {
84
81
  this.setBtnTitle(title);
85
- this.setBtnText(btnText);
82
+ }
83
+ if (this.checkUpdateOption(newOptions, ['btnIcon'])) {
86
84
  this.setBtnIcon(btnIcon);
87
- return this.button;
88
85
  }
89
- }, {
90
- key: "onRemove",
91
- value: function onRemove() {
92
- this.button = this.buttonIcon = this.buttonText = undefined;
93
- this.isDisable = false;
86
+ if (this.checkUpdateOption(newOptions, ['btnText'])) {
87
+ this.setBtnText(btnText);
94
88
  }
89
+ super.setOptions(newOptions);
90
+ }
95
91
 
96
- /**
97
- * 更新配置方法
98
- * @param newOptions
99
- */
100
- }, {
101
- key: "setOptions",
102
- value: function setOptions(newOptions) {
103
- var title = newOptions.title,
104
- btnText = newOptions.btnText,
105
- btnIcon = newOptions.btnIcon;
106
- if (this.checkUpdateOption(newOptions, ['title'])) {
107
- this.setBtnTitle(title);
108
- }
109
- if (this.checkUpdateOption(newOptions, ['btnIcon'])) {
110
- this.setBtnIcon(btnIcon);
111
- }
112
- if (this.checkUpdateOption(newOptions, ['btnText'])) {
113
- this.setBtnText(btnText);
114
- }
115
- (0, _get2.default)((0, _getPrototypeOf2.default)(ButtonControl.prototype), "setOptions", this).call(this, newOptions);
116
- }
92
+ /**
93
+ * 设置按钮 title
94
+ * @param title
95
+ */
96
+ setBtnTitle(title) {
97
+ var _this$button3;
98
+ (_this$button3 = this.button) === null || _this$button3 === void 0 || _this$button3.setAttribute('title', title !== null && title !== void 0 ? title : '');
99
+ }
117
100
 
118
- /**
119
- * 设置按钮 title
120
- * @param title
121
- */
122
- }, {
123
- key: "setBtnTitle",
124
- value: function setBtnTitle(title) {
125
- var _this$button3;
126
- (_this$button3 = this.button) === null || _this$button3 === void 0 || _this$button3.setAttribute('title', title !== null && title !== void 0 ? title : '');
101
+ /**
102
+ * 设置按钮 Icon
103
+ * @param newIcon
104
+ */
105
+ setBtnIcon(newIcon) {
106
+ if (this.buttonIcon) {
107
+ _l7Utils.DOM.remove(this.buttonIcon);
127
108
  }
128
-
129
- /**
130
- * 设置按钮 Icon
131
- * @param newIcon
132
- */
133
- }, {
134
- key: "setBtnIcon",
135
- value: function setBtnIcon(newIcon) {
136
- if (this.buttonIcon) {
137
- _l7Utils.DOM.remove(this.buttonIcon);
138
- }
139
- if (newIcon) {
140
- var _this$button4;
141
- var firstChild = (_this$button4 = this.button) === null || _this$button4 === void 0 ? void 0 : _this$button4.firstChild;
142
- if (firstChild) {
143
- var _this$button5;
144
- (_this$button5 = this.button) === null || _this$button5 === void 0 || _this$button5.insertBefore(newIcon, firstChild);
145
- } else {
146
- var _this$button6;
147
- (_this$button6 = this.button) === null || _this$button6 === void 0 || _this$button6.appendChild(newIcon);
148
- }
149
- this.buttonIcon = newIcon;
109
+ if (newIcon) {
110
+ var _this$button4;
111
+ const firstChild = (_this$button4 = this.button) === null || _this$button4 === void 0 ? void 0 : _this$button4.firstChild;
112
+ if (firstChild) {
113
+ var _this$button5;
114
+ (_this$button5 = this.button) === null || _this$button5 === void 0 || _this$button5.insertBefore(newIcon, firstChild);
115
+ } else {
116
+ var _this$button6;
117
+ (_this$button6 = this.button) === null || _this$button6 === void 0 || _this$button6.appendChild(newIcon);
150
118
  }
119
+ this.buttonIcon = newIcon;
151
120
  }
121
+ }
152
122
 
153
- /**
154
- * 设置按钮文本
155
- * @param newText
156
- */
157
- }, {
158
- key: "setBtnText",
159
- value: function setBtnText(newText) {
160
- if (!this.button) {
161
- return;
162
- }
163
- _l7Utils.DOM.removeClass(this.button, 'l7-button-control--row');
164
- _l7Utils.DOM.removeClass(this.button, 'l7-button-control--column');
165
- if (newText) {
166
- var btnText = this.buttonText;
167
- if (!btnText) {
168
- var _this$button7;
169
- btnText = _l7Utils.DOM.create('div', 'l7-button-control__text');
170
- (_this$button7 = this.button) === null || _this$button7 === void 0 || _this$button7.appendChild(btnText);
171
- this.buttonText = btnText;
172
- }
173
- btnText.innerText = newText;
174
- _l7Utils.DOM.addClass(this.button, this.controlOption.vertical ? 'l7-button-control--column' : 'l7-button-control--row');
175
- } else if (!newText && this.buttonText) {
176
- _l7Utils.DOM.remove(this.buttonText);
177
- this.buttonText = undefined;
123
+ /**
124
+ * 设置按钮文本
125
+ * @param newText
126
+ */
127
+ setBtnText(newText) {
128
+ if (!this.button) {
129
+ return;
130
+ }
131
+ _l7Utils.DOM.removeClass(this.button, 'l7-button-control--row');
132
+ _l7Utils.DOM.removeClass(this.button, 'l7-button-control--column');
133
+ if (newText) {
134
+ let btnText = this.buttonText;
135
+ if (!btnText) {
136
+ var _this$button7;
137
+ btnText = _l7Utils.DOM.create('div', 'l7-button-control__text');
138
+ (_this$button7 = this.button) === null || _this$button7 === void 0 || _this$button7.appendChild(btnText);
139
+ this.buttonText = btnText;
178
140
  }
141
+ btnText.innerText = newText;
142
+ _l7Utils.DOM.addClass(this.button, this.controlOption.vertical ? 'l7-button-control--column' : 'l7-button-control--row');
143
+ } else if (!newText && this.buttonText) {
144
+ _l7Utils.DOM.remove(this.buttonText);
145
+ this.buttonText = undefined;
179
146
  }
180
- }]);
181
- return ButtonControl;
182
- }(_control.default);
147
+ }
148
+ }
149
+ exports.default = exports.ButtonControl = ButtonControl;
@@ -0,0 +1,112 @@
1
+ import type { IControl, IControlService, IGlobalConfigService, ILayerService, IMapService, IRendererService, ISceneService, L7Container, PositionName } from '@antv/l7-core';
2
+ import { PositionType } from '@antv/l7-core';
3
+ import EventEmitter from 'eventemitter3';
4
+ import type { ControlEvent } from '../../interface';
5
+ export { PositionType } from '@antv/l7-core';
6
+ export { Control };
7
+ export interface IControlOption {
8
+ name: string;
9
+ position: PositionName | Element;
10
+ className?: string;
11
+ style?: string;
12
+ }
13
+ export default class Control<O extends IControlOption = IControlOption> extends EventEmitter<ControlEvent> implements IControl<O> {
14
+ /**
15
+ * 当前类型控件实例个数
16
+ * @protected
17
+ */
18
+ protected static controlCount: number;
19
+ /**
20
+ * 当前控件实例配置
21
+ */
22
+ controlOption: O;
23
+ /**
24
+ * 控件的 DOM 容器
25
+ * @protected
26
+ */
27
+ protected container: HTMLElement;
28
+ /**
29
+ * 当前控件是否显示
30
+ * @protected
31
+ */
32
+ protected isShow: boolean;
33
+ protected sceneContainer: L7Container;
34
+ protected scene: ISceneService;
35
+ protected mapsService: IMapService;
36
+ protected renderService: IRendererService;
37
+ protected layerService: ILayerService;
38
+ protected controlService: IControlService;
39
+ protected configService: IGlobalConfigService;
40
+ constructor(option?: Partial<O>);
41
+ getOptions(): O;
42
+ /**
43
+ * 更新配置的方法,子类如果有自己的配置,也需要重写该方法
44
+ * @param newOptions
45
+ */
46
+ setOptions(newOptions: Partial<O>): void;
47
+ /**
48
+ * 当 Control 被添加至 Scene 中,被 controlService 调用的方法
49
+ * @param sceneContainer
50
+ */
51
+ addTo(sceneContainer: L7Container): this;
52
+ /**
53
+ * 将控件移除时触发
54
+ */
55
+ remove(): this | undefined;
56
+ /**
57
+ * Control 被添加的时候被调用,返回 Control 对应的 DOM 容器
58
+ */
59
+ onAdd(): HTMLElement;
60
+ /**
61
+ * Control 被移除时调用
62
+ */
63
+ onRemove(): void;
64
+ /**
65
+ * 显示控件时触发
66
+ */
67
+ show(): void;
68
+ /**
69
+ * 隐藏控件时触发
70
+ */
71
+ hide(): void;
72
+ /**
73
+ * 获取默认构造器参数
74
+ */
75
+ getDefault(option?: Partial<O>): O;
76
+ /**
77
+ * 获取当前控件对应的 DOM 容器
78
+ */
79
+ getContainer(): HTMLElement;
80
+ /**
81
+ * 获取当前 Control 是否展示
82
+ */
83
+ getIsShow(): boolean;
84
+ _refocusOnMap(e: MouseEvent): void;
85
+ /**
86
+ * 设置当前控件位置
87
+ * @param position
88
+ */
89
+ setPosition(position?: PositionType | IControlOption['position']): this;
90
+ /**
91
+ * 设置容器 container 的样式相关位置,包含 className
92
+ * @param className
93
+ */
94
+ setClassName(className?: string | null): void;
95
+ /**
96
+ * 设置容器 container 的样式相关位置,包含 style
97
+ * @param style
98
+ */
99
+ setStyle(style?: string | null): void;
100
+ /**
101
+ * 将控件 DOM 插入到对应 position 的容器中
102
+ * @protected
103
+ */
104
+ protected insertContainer(): void;
105
+ /**
106
+ * 检查当前传入 option 是否包含 keys 字段
107
+ * @param option
108
+ * @param keys
109
+ * @protected
110
+ */
111
+ protected checkUpdateOption(option: Partial<O>, keys: Array<keyof O>): boolean;
112
+ }