@antv/l7-component 2.9.36 → 2.9.37-alpha.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.
Files changed (110) hide show
  1. package/es/assets/iconfont/iconfont.js +52 -0
  2. package/es/constants/index.d.ts +60 -0
  3. package/es/constants/index.js +60 -0
  4. package/es/control/baseControl/buttonControl.d.ts +59 -0
  5. package/es/control/baseControl/buttonControl.js +191 -0
  6. package/es/control/baseControl/control.d.ts +113 -0
  7. package/es/control/baseControl/control.js +301 -0
  8. package/es/control/baseControl/index.d.ts +4 -0
  9. package/es/control/baseControl/index.js +4 -0
  10. package/es/control/baseControl/popperControl.d.ts +26 -0
  11. package/es/control/baseControl/popperControl.js +131 -0
  12. package/es/control/baseControl/selectControl.d.ts +46 -0
  13. package/es/control/baseControl/selectControl.js +232 -0
  14. package/es/control/exportImage.d.ts +18 -0
  15. package/es/control/exportImage.js +163 -0
  16. package/es/control/fullscreen.d.ts +19 -0
  17. package/es/control/fullscreen.js +151 -0
  18. package/es/control/geoLocate.d.ts +16 -0
  19. package/es/control/geoLocate.js +139 -0
  20. package/es/control/layerControl.d.ts +21 -0
  21. package/es/control/layerControl.js +172 -0
  22. package/es/control/logo.d.ts +10 -6
  23. package/es/control/logo.js +41 -11
  24. package/es/control/mapTheme.d.ts +10 -0
  25. package/es/control/mapTheme.js +135 -0
  26. package/es/control/mouseLocation.d.ts +15 -0
  27. package/es/control/mouseLocation.js +104 -0
  28. package/es/control/scale.d.ts +20 -10
  29. package/es/control/scale.js +77 -53
  30. package/es/control/zoom.d.ts +21 -10
  31. package/es/control/zoom.js +76 -49
  32. package/es/css/button.less +70 -0
  33. package/es/css/control.less +71 -0
  34. package/es/css/index.css +567 -0
  35. package/es/css/index.less +12 -0
  36. package/es/css/l7.less +60 -0
  37. package/es/css/layerPopup.less +8 -0
  38. package/es/css/logo.less +18 -0
  39. package/es/css/mouseLocation.less +9 -0
  40. package/es/css/popper.less +64 -0
  41. package/es/css/popup.less +169 -0
  42. package/es/css/scale.less +34 -0
  43. package/es/css/select.less +86 -0
  44. package/es/css/variables.less +28 -0
  45. package/es/css/zoom.less +21 -0
  46. package/es/images/logo.png +0 -0
  47. package/es/images/quanping.svg +12 -0
  48. package/es/index.d.ts +15 -8
  49. package/es/index.js +15 -9
  50. package/es/interface.d.ts +1 -20
  51. package/es/popup/layerPopup.d.ts +78 -0
  52. package/es/popup/layerPopup.js +308 -0
  53. package/es/popup/popup.d.ts +147 -0
  54. package/es/popup/popup.js +636 -0
  55. package/es/utils/icon.d.ts +1 -0
  56. package/es/utils/icon.js +9 -0
  57. package/es/utils/popper.d.ts +75 -0
  58. package/es/utils/popper.js +286 -0
  59. package/es/utils/screenfull.d.ts +2 -0
  60. package/es/utils/screenfull.js +157 -0
  61. package/lib/assets/iconfont/iconfont.js +54 -0
  62. package/lib/constants/index.js +68 -0
  63. package/lib/control/baseControl/buttonControl.js +207 -0
  64. package/lib/control/baseControl/control.js +327 -0
  65. package/lib/control/baseControl/index.js +57 -0
  66. package/lib/control/baseControl/popperControl.js +142 -0
  67. package/lib/control/baseControl/selectControl.js +253 -0
  68. package/lib/control/exportImage.js +177 -0
  69. package/lib/control/fullscreen.js +164 -0
  70. package/lib/control/geoLocate.js +154 -0
  71. package/lib/control/layerControl.js +182 -0
  72. package/lib/control/logo.js +50 -23
  73. package/lib/control/mapTheme.js +151 -0
  74. package/lib/control/mouseLocation.js +120 -0
  75. package/lib/control/scale.js +82 -62
  76. package/lib/control/zoom.js +78 -59
  77. package/lib/css/button.less +70 -0
  78. package/lib/css/control.less +71 -0
  79. package/lib/css/index.css +567 -0
  80. package/lib/css/index.less +12 -0
  81. package/lib/css/l7.less +60 -0
  82. package/lib/css/layerPopup.less +8 -0
  83. package/lib/css/logo.less +18 -0
  84. package/lib/css/mouseLocation.less +9 -0
  85. package/lib/css/popper.less +64 -0
  86. package/lib/css/popup.less +169 -0
  87. package/lib/css/scale.less +34 -0
  88. package/lib/css/select.less +86 -0
  89. package/lib/css/variables.less +28 -0
  90. package/lib/css/zoom.less +21 -0
  91. package/lib/images/logo.png +0 -0
  92. package/lib/images/quanping.svg +12 -0
  93. package/lib/index.js +165 -50
  94. package/lib/popup/layerPopup.js +317 -0
  95. package/lib/popup/popup.js +651 -0
  96. package/lib/utils/icon.js +18 -0
  97. package/lib/utils/popper.js +297 -0
  98. package/lib/utils/screenfull.js +167 -0
  99. package/package.json +8 -5
  100. package/es/control/BaseControl.d.ts +0 -27
  101. package/es/control/BaseControl.js +0 -134
  102. package/es/control/layer.d.ts +0 -38
  103. package/es/control/layer.js +0 -340
  104. package/es/css/l7.css +0 -502
  105. package/es/popup.d.ts +0 -35
  106. package/es/popup.js +0 -300
  107. package/lib/control/BaseControl.js +0 -160
  108. package/lib/control/layer.js +0 -362
  109. package/lib/css/l7.css +0 -502
  110. package/lib/popup.js +0 -317
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.MapboxMapStyleConfig = exports.GaodeMapStyleConfig = void 0;
7
+ var GaodeMapStyleConfig = {
8
+ normal: {
9
+ text: '标准',
10
+ img: 'https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*-nqiT6Vu948AAAAAAAAAAAAAARQnAQ'
11
+ },
12
+ light: {
13
+ text: '月光银',
14
+ img: 'https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*J_wYQL_PaUEAAAAAAAAAAAAAARQnAQ'
15
+ },
16
+ dark: {
17
+ text: '幻影黑',
18
+ img: 'https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*U7M9QI1yat4AAAAAAAAAAAAAARQnAQ'
19
+ },
20
+ fresh: {
21
+ text: '草色青',
22
+ img: 'https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*T-oBT4hB5ucAAAAAAAAAAAAAARQnAQ'
23
+ },
24
+ grey: {
25
+ text: '雅士灰',
26
+ img: 'https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*OREXQ4vgQRIAAAAAAAAAAAAAARQnAQ'
27
+ },
28
+ graffiti: {
29
+ text: '涂鸦',
30
+ img: 'https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*4UApTKmeiy4AAAAAAAAAAAAAARQnAQ'
31
+ },
32
+ macaron: {
33
+ text: '马卡龙',
34
+ img: 'https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*0GrCQLtDjNcAAAAAAAAAAAAAARQnAQ'
35
+ },
36
+ darkblue: {
37
+ text: '极夜蓝',
38
+ img: 'https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*uWxqSZQlPkkAAAAAAAAAAAAAARQnAQ'
39
+ },
40
+ wine: {
41
+ text: '酱籽',
42
+ img: 'https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*OFPrTbg3an0AAAAAAAAAAAAAARQnAQ'
43
+ }
44
+ };
45
+ exports.GaodeMapStyleConfig = GaodeMapStyleConfig;
46
+ var MapboxMapStyleConfig = {
47
+ normal: {
48
+ text: '标准',
49
+ img: 'https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*AnfJTbIBJOkAAAAAAAAAAAAAARQnAQ'
50
+ },
51
+ light: {
52
+ text: '亮',
53
+ img: 'https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*gnuiQIok9qIAAAAAAAAAAAAAARQnAQ'
54
+ },
55
+ dark: {
56
+ text: '暗',
57
+ img: 'https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*NwG-TbOlBH0AAAAAAAAAAAAAARQnAQ'
58
+ },
59
+ satellite: {
60
+ text: '卫星',
61
+ img: 'https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*2X5EQLKul3IAAAAAAAAAAAAAARQnAQ'
62
+ },
63
+ outdoors: {
64
+ text: '户外',
65
+ img: 'https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*gXFLRIaBUI0AAAAAAAAAAAAAARQnAQ'
66
+ }
67
+ };
68
+ exports.MapboxMapStyleConfig = MapboxMapStyleConfig;
@@ -0,0 +1,207 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
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];
46
+ }
47
+
48
+ _this = _super.call.apply(_super, [this].concat(args));
49
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isDisable", false);
50
+ return _this;
51
+ }
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
+ }
72
+ }
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));
78
+ }
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);
89
+ this.setBtnText(btnText);
90
+ this.setBtnIcon(btnIcon);
91
+ return this.button;
92
+ }
93
+ }, {
94
+ key: "onRemove",
95
+ value: function onRemove() {
96
+ this.button = this.buttonIcon = this.buttonText = undefined;
97
+ this.isDisable = false;
98
+ }
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);
113
+ }
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);
124
+ }
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 : '');
136
+ }
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;
165
+ }
166
+ }
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;
@@ -0,0 +1,327 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.Control = void 0;
9
+ Object.defineProperty(exports, "PositionType", {
10
+ enumerable: true,
11
+ get: function get() {
12
+ return _l7Core.PositionType;
13
+ }
14
+ });
15
+ exports.default = void 0;
16
+
17
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
18
+
19
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
20
+
21
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
22
+
23
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
24
+
25
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
26
+
27
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
28
+
29
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
30
+
31
+ var _l7Core = require("@antv/l7-core");
32
+
33
+ var _l7Utils = require("@antv/l7-utils");
34
+
35
+ var _eventemitter = _interopRequireDefault(require("eventemitter3"));
36
+
37
+ 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); }; }
38
+
39
+ 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; } }
40
+
41
+ var Control = /*#__PURE__*/function (_ref) {
42
+ (0, _inherits2.default)(Control, _ref);
43
+
44
+ var _super = _createSuper(Control);
45
+
46
+ /**
47
+ * 当前类型控件实例个数
48
+ * @protected
49
+ */
50
+ function Control(option) {
51
+ var _this;
52
+
53
+ (0, _classCallCheck2.default)(this, Control);
54
+ _this = _super.call(this);
55
+ Control.controlCount++;
56
+ _this.controlOption = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, _this.getDefault(option)), option || {});
57
+ return _this;
58
+ }
59
+
60
+ (0, _createClass2.default)(Control, [{
61
+ key: "getOptions",
62
+ value: function getOptions() {
63
+ return this.controlOption;
64
+ }
65
+ /**
66
+ * 更新配置的方法,子类如果有自己的配置,也需要重写该方法
67
+ * @param newOptions
68
+ */
69
+
70
+ }, {
71
+ key: "setOptions",
72
+ value: function setOptions(newOptions) {
73
+ if ('position' in newOptions) {
74
+ this.setPosition(newOptions.position);
75
+ }
76
+
77
+ if ('className' in newOptions) {
78
+ this.setClassName(newOptions.className);
79
+ }
80
+
81
+ if ('style' in newOptions) {
82
+ this.setStyle(newOptions.style);
83
+ }
84
+
85
+ this.controlOption = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, this.controlOption), newOptions);
86
+ }
87
+ /**
88
+ * 当 Control 被添加至 Scene 中,被 controlService 调用的方法
89
+ * @param sceneContainer
90
+ */
91
+
92
+ }, {
93
+ key: "addTo",
94
+ value: function addTo(sceneContainer) {
95
+ // 初始化各个 Service 实例
96
+ this.mapsService = sceneContainer.get(_l7Core.TYPES.IMapService);
97
+ this.renderService = sceneContainer.get(_l7Core.TYPES.IRendererService);
98
+ this.layerService = sceneContainer.get(_l7Core.TYPES.ILayerService);
99
+ this.controlService = sceneContainer.get(_l7Core.TYPES.IControlService);
100
+ this.configService = sceneContainer.get(_l7Core.TYPES.IGlobalConfigService);
101
+ this.scene = sceneContainer.get(_l7Core.TYPES.ISceneService);
102
+ this.sceneContainer = sceneContainer;
103
+ this.isShow = true; // 初始化 container
104
+
105
+ this.container = this.onAdd();
106
+
107
+ _l7Utils.DOM.addClass(this.container, 'l7-control');
108
+
109
+ var _this$controlOption = this.controlOption,
110
+ className = _this$controlOption.className,
111
+ style = _this$controlOption.style;
112
+
113
+ if (className) {
114
+ this.setClassName(className);
115
+ }
116
+
117
+ if (style) {
118
+ this.setStyle(style);
119
+ } // 将 container 插入容器中
120
+
121
+
122
+ this.insertContainer();
123
+ this.emit('add', this);
124
+ return this;
125
+ }
126
+ /**
127
+ * 将控件移除时触发
128
+ */
129
+
130
+ }, {
131
+ key: "remove",
132
+ value: function remove() {
133
+ if (!this.mapsService) {
134
+ return this;
135
+ }
136
+
137
+ _l7Utils.DOM.remove(this.container);
138
+
139
+ this.onRemove();
140
+ this.emit('remove', this);
141
+ }
142
+ /**
143
+ * Control 被添加的时候被调用,返回 Control 对应的 DOM 容器
144
+ */
145
+
146
+ }, {
147
+ key: "onAdd",
148
+ value: function onAdd() {
149
+ return _l7Utils.DOM.create('div');
150
+ }
151
+ /**
152
+ * Control 被移除时调用
153
+ */
154
+ // tslint:disable-next-line:no-empty
155
+
156
+ }, {
157
+ key: "onRemove",
158
+ value: function onRemove() {}
159
+ /**
160
+ * 显示控件时触发
161
+ */
162
+
163
+ }, {
164
+ key: "show",
165
+ value: function show() {
166
+ var container = this.container;
167
+
168
+ _l7Utils.DOM.removeClass(container, 'l7-control--hide');
169
+
170
+ this.isShow = true;
171
+ this.emit('show', this);
172
+ }
173
+ /**
174
+ * 隐藏控件时触发
175
+ */
176
+
177
+ }, {
178
+ key: "hide",
179
+ value: function hide() {
180
+ var container = this.container;
181
+
182
+ _l7Utils.DOM.addClass(container, 'l7-control--hide');
183
+
184
+ this.isShow = false;
185
+ this.emit('hide', this);
186
+ }
187
+ /**
188
+ * 获取默认构造器参数
189
+ */
190
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
191
+
192
+ }, {
193
+ key: "getDefault",
194
+ value: function getDefault(option) {
195
+ // tslint:disable-next-line:no-object-literal-type-assertion
196
+ return {
197
+ position: _l7Core.PositionType.TOPRIGHT,
198
+ name: "".concat(Control.controlCount)
199
+ };
200
+ }
201
+ /**
202
+ * 获取当前控件对应的 DOM 容器
203
+ */
204
+
205
+ }, {
206
+ key: "getContainer",
207
+ value: function getContainer() {
208
+ return this.container;
209
+ }
210
+ /**
211
+ * 获取当前 Control 是否展示
212
+ */
213
+
214
+ }, {
215
+ key: "getIsShow",
216
+ value: function getIsShow() {
217
+ return this.isShow;
218
+ }
219
+ }, {
220
+ key: "_refocusOnMap",
221
+ value: function _refocusOnMap(e) {
222
+ // if map exists and event is not a keyboard event
223
+ if (this.mapsService && e && e.screenX > 0 && e.screenY > 0) {
224
+ var container = this.mapsService.getContainer();
225
+
226
+ if (container !== null) {
227
+ container.focus();
228
+ }
229
+ }
230
+ }
231
+ /**
232
+ * 设置当前控件位置
233
+ * @param position
234
+ */
235
+
236
+ }, {
237
+ key: "setPosition",
238
+ value: function setPosition() {
239
+ var position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _l7Core.PositionType.TOPLEFT;
240
+ // 考虑组件的自动布局,需要销毁重建
241
+ var controlService = this.controlService;
242
+
243
+ if (controlService) {
244
+ controlService.removeControl(this);
245
+ }
246
+
247
+ this.controlOption.position = position;
248
+
249
+ if (controlService) {
250
+ controlService.addControl(this, this.sceneContainer);
251
+ }
252
+
253
+ return this;
254
+ }
255
+ /**
256
+ * 设置容器 container 的样式相关位置,包含 className
257
+ * @param className
258
+ */
259
+
260
+ }, {
261
+ key: "setClassName",
262
+ value: function setClassName(className) {
263
+ var container = this.container;
264
+ var oldClassName = this.controlOption.className;
265
+
266
+ if (oldClassName) {
267
+ _l7Utils.DOM.removeClass(container, oldClassName);
268
+ }
269
+
270
+ if (className) {
271
+ _l7Utils.DOM.addClass(container, className);
272
+ }
273
+ }
274
+ /**
275
+ * 设置容器 container 的样式相关位置,包含 style
276
+ * @param style
277
+ */
278
+
279
+ }, {
280
+ key: "setStyle",
281
+ value: function setStyle(style) {
282
+ var container = this.container;
283
+
284
+ if (style) {
285
+ container.setAttribute('style', style);
286
+ } else {
287
+ container.removeAttribute('style');
288
+ }
289
+ }
290
+ /**
291
+ * 将控件 DOM 插入到对应 position 的容器中
292
+ * @protected
293
+ */
294
+
295
+ }, {
296
+ key: "insertContainer",
297
+ value: function insertContainer() {
298
+ var container = this.container;
299
+ var position = this.controlOption.position;
300
+ var corner = this.controlService.controlCorners[position];
301
+
302
+ if (position.indexOf('bottom') !== -1) {
303
+ corner.insertBefore(container, corner.firstChild);
304
+ } else {
305
+ corner.appendChild(container);
306
+ }
307
+ }
308
+ /**
309
+ * 检查当前传入 option 是否包含 keys 字段
310
+ * @param option
311
+ * @param keys
312
+ * @protected
313
+ */
314
+
315
+ }, {
316
+ key: "checkUpdateOption",
317
+ value: function checkUpdateOption(option, keys) {
318
+ return keys.some(function (key) {
319
+ return key in option;
320
+ });
321
+ }
322
+ }]);
323
+ return Control;
324
+ }(_eventemitter.default);
325
+
326
+ exports.default = exports.Control = Control;
327
+ (0, _defineProperty2.default)(Control, "controlCount", 0);
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _control = require("./control");
8
+
9
+ Object.keys(_control).forEach(function (key) {
10
+ if (key === "default" || key === "__esModule") return;
11
+ if (key in exports && exports[key] === _control[key]) return;
12
+ Object.defineProperty(exports, key, {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _control[key];
16
+ }
17
+ });
18
+ });
19
+
20
+ var _buttonControl = require("./buttonControl");
21
+
22
+ Object.keys(_buttonControl).forEach(function (key) {
23
+ if (key === "default" || key === "__esModule") return;
24
+ if (key in exports && exports[key] === _buttonControl[key]) return;
25
+ Object.defineProperty(exports, key, {
26
+ enumerable: true,
27
+ get: function get() {
28
+ return _buttonControl[key];
29
+ }
30
+ });
31
+ });
32
+
33
+ var _popperControl = require("./popperControl");
34
+
35
+ Object.keys(_popperControl).forEach(function (key) {
36
+ if (key === "default" || key === "__esModule") return;
37
+ if (key in exports && exports[key] === _popperControl[key]) return;
38
+ Object.defineProperty(exports, key, {
39
+ enumerable: true,
40
+ get: function get() {
41
+ return _popperControl[key];
42
+ }
43
+ });
44
+ });
45
+
46
+ var _selectControl = require("./selectControl");
47
+
48
+ Object.keys(_selectControl).forEach(function (key) {
49
+ if (key === "default" || key === "__esModule") return;
50
+ if (key in exports && exports[key] === _selectControl[key]) return;
51
+ Object.defineProperty(exports, key, {
52
+ enumerable: true,
53
+ get: function get() {
54
+ return _selectControl[key];
55
+ }
56
+ });
57
+ });