@antv/l7-component 2.9.36-alpha.1 → 2.9.37

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