@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
@@ -6,11 +6,11 @@ window._iconfont_svg_string_3580659 = '<svg><symbol id="l7-icon-area1" viewBox="
6
6
  a = a.getAttribute('data-disable-injectsvg');
7
7
  if (!a) {
8
8
  var o,
9
- _e,
9
+ e,
10
10
  i,
11
11
  n,
12
12
  m,
13
- c = function c(a, l) {
13
+ c = function (a, l) {
14
14
  l.parentNode.insertBefore(a, l);
15
15
  };
16
16
  if (l && !t.__iconfont__svg__cssinject__) {
@@ -21,13 +21,13 @@ window._iconfont_svg_string_3580659 = '<svg><symbol id="l7-icon-area1" viewBox="
21
21
  console && console.log(a);
22
22
  }
23
23
  }
24
- o = function o() {
24
+ o = function () {
25
25
  var a,
26
26
  l = document.createElement('div');
27
27
  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));
28
- }, document.addEventListener ? ~['complete', 'loaded', 'interactive'].indexOf(document.readyState) ? setTimeout(o, 0) : (_e = function e() {
29
- document.removeEventListener('DOMContentLoaded', _e, !1), o();
30
- }, document.addEventListener('DOMContentLoaded', _e, !1)) : document.attachEvent && (i = o, n = t.document, m = !1, L(), n.onreadystatechange = function () {
28
+ }, document.addEventListener ? ~['complete', 'loaded', 'interactive'].indexOf(document.readyState) ? setTimeout(o, 0) : (e = function () {
29
+ document.removeEventListener('DOMContentLoaded', e, !1), o();
30
+ }, document.addEventListener('DOMContentLoaded', e, !1)) : document.attachEvent && (i = o, n = t.document, m = !1, L(), n.onreadystatechange = function () {
31
31
  'complete' == n.readyState && (n.onreadystatechange = null, d());
32
32
  });
33
33
  }
@@ -1,4 +1,4 @@
1
- export var GaodeMapStyleConfig = {
1
+ export const GaodeMapStyleConfig = {
2
2
  normal: {
3
3
  text: '标准',
4
4
  img: 'https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*qdFDSbvIalgAAAAAAAAAAAAADmJ7AQ/original'
@@ -36,7 +36,7 @@ export var GaodeMapStyleConfig = {
36
36
  img: 'https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*orY0T7QL-lwAAAAAAAAAAAAADmJ7AQ/original'
37
37
  }
38
38
  };
39
- export var MapboxMapStyleConfig = {
39
+ export const MapboxMapStyleConfig = {
40
40
  normal: {
41
41
  text: '标准',
42
42
  img: 'https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*kIyZTok4Uk0AAAAAAAAAAAAADmJ7AQ/original'
@@ -1,177 +1,142 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
4
- import _get from "@babel/runtime/helpers/esm/get";
5
- import _inherits from "@babel/runtime/helpers/esm/inherits";
6
- import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
7
- import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
8
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
9
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
10
- 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; } }
11
2
  import { DOM } from '@antv/l7-utils';
12
3
  import Control from "./control";
13
4
  export { ButtonControl };
14
- var ButtonControl = /*#__PURE__*/function (_Control) {
15
- _inherits(ButtonControl, _Control);
16
- var _super = _createSuper(ButtonControl);
17
- function ButtonControl() {
18
- var _this;
19
- _classCallCheck(this, ButtonControl);
20
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
21
- args[_key] = arguments[_key];
22
- }
23
- _this = _super.call.apply(_super, [this].concat(args));
5
+ export default class ButtonControl extends Control {
6
+ constructor(...args) {
7
+ super(...args);
24
8
  /**
25
9
  * 当前按钮是否禁用
26
10
  * @protected
27
11
  */
28
- _defineProperty(_assertThisInitialized(_this), "isDisable", false);
29
- return _this;
30
- }
31
- _createClass(ButtonControl, [{
32
- key: "setIsDisable",
33
- value:
12
+ _defineProperty(this, "isDisable", false);
34
13
  /**
35
14
  * 按钮的 DOM
36
15
  * @protected
37
16
  */
38
-
17
+ _defineProperty(this, "button", void 0);
39
18
  /**
40
19
  * 按钮中文本对应的 DOM
41
20
  * @protected
42
21
  */
43
-
22
+ _defineProperty(this, "buttonText", void 0);
44
23
  /**
45
24
  * 按钮中图标对应的 DOM
46
25
  * @protected
47
26
  */
48
-
49
- /**
50
- * 设置当前按钮
51
- * @param newIsDisable
52
- */
53
- function setIsDisable(newIsDisable) {
54
- this.isDisable = newIsDisable;
55
- if (newIsDisable) {
56
- var _this$button;
57
- (_this$button = this.button) === null || _this$button === void 0 || _this$button.setAttribute('disabled', 'true');
58
- } else {
59
- var _this$button2;
60
- (_this$button2 = this.button) === null || _this$button2 === void 0 || _this$button2.removeAttribute('disabled');
61
- }
62
- }
63
- }, {
64
- key: "createButton",
65
- value: function createButton() {
66
- var className = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
67
- return DOM.create('button', "l7-button-control ".concat(className));
27
+ _defineProperty(this, "buttonIcon", void 0);
28
+ }
29
+ /**
30
+ * 设置当前按钮
31
+ * @param newIsDisable
32
+ */
33
+ setIsDisable(newIsDisable) {
34
+ this.isDisable = newIsDisable;
35
+ if (newIsDisable) {
36
+ var _this$button;
37
+ (_this$button = this.button) === null || _this$button === void 0 || _this$button.setAttribute('disabled', 'true');
38
+ } else {
39
+ var _this$button2;
40
+ (_this$button2 = this.button) === null || _this$button2 === void 0 || _this$button2.removeAttribute('disabled');
68
41
  }
69
- }, {
70
- key: "onAdd",
71
- value: function onAdd() {
72
- this.button = this.createButton();
73
- this.isDisable = false;
74
- var _this$controlOption = this.controlOption,
75
- title = _this$controlOption.title,
76
- btnText = _this$controlOption.btnText,
77
- btnIcon = _this$controlOption.btnIcon;
42
+ }
43
+ createButton(className = '') {
44
+ return DOM.create('button', `l7-button-control ${className}`);
45
+ }
46
+ onAdd() {
47
+ this.button = this.createButton();
48
+ this.isDisable = false;
49
+ const {
50
+ title,
51
+ btnText,
52
+ btnIcon
53
+ } = this.controlOption;
54
+ this.setBtnTitle(title);
55
+ this.setBtnText(btnText);
56
+ this.setBtnIcon(btnIcon);
57
+ return this.button;
58
+ }
59
+ onRemove() {
60
+ this.button = this.buttonIcon = this.buttonText = undefined;
61
+ this.isDisable = false;
62
+ }
63
+
64
+ /**
65
+ * 更新配置方法
66
+ * @param newOptions
67
+ */
68
+ setOptions(newOptions) {
69
+ const {
70
+ title,
71
+ btnText,
72
+ btnIcon
73
+ } = newOptions;
74
+ if (this.checkUpdateOption(newOptions, ['title'])) {
78
75
  this.setBtnTitle(title);
79
- this.setBtnText(btnText);
76
+ }
77
+ if (this.checkUpdateOption(newOptions, ['btnIcon'])) {
80
78
  this.setBtnIcon(btnIcon);
81
- return this.button;
82
79
  }
83
- }, {
84
- key: "onRemove",
85
- value: function onRemove() {
86
- this.button = this.buttonIcon = this.buttonText = undefined;
87
- this.isDisable = false;
80
+ if (this.checkUpdateOption(newOptions, ['btnText'])) {
81
+ this.setBtnText(btnText);
88
82
  }
83
+ super.setOptions(newOptions);
84
+ }
89
85
 
90
- /**
91
- * 更新配置方法
92
- * @param newOptions
93
- */
94
- }, {
95
- key: "setOptions",
96
- value: function setOptions(newOptions) {
97
- var title = newOptions.title,
98
- btnText = newOptions.btnText,
99
- btnIcon = newOptions.btnIcon;
100
- if (this.checkUpdateOption(newOptions, ['title'])) {
101
- this.setBtnTitle(title);
102
- }
103
- if (this.checkUpdateOption(newOptions, ['btnIcon'])) {
104
- this.setBtnIcon(btnIcon);
105
- }
106
- if (this.checkUpdateOption(newOptions, ['btnText'])) {
107
- this.setBtnText(btnText);
108
- }
109
- _get(_getPrototypeOf(ButtonControl.prototype), "setOptions", this).call(this, newOptions);
110
- }
86
+ /**
87
+ * 设置按钮 title
88
+ * @param title
89
+ */
90
+ setBtnTitle(title) {
91
+ var _this$button3;
92
+ (_this$button3 = this.button) === null || _this$button3 === void 0 || _this$button3.setAttribute('title', title !== null && title !== void 0 ? title : '');
93
+ }
111
94
 
112
- /**
113
- * 设置按钮 title
114
- * @param title
115
- */
116
- }, {
117
- key: "setBtnTitle",
118
- value: function setBtnTitle(title) {
119
- var _this$button3;
120
- (_this$button3 = this.button) === null || _this$button3 === void 0 || _this$button3.setAttribute('title', title !== null && title !== void 0 ? title : '');
95
+ /**
96
+ * 设置按钮 Icon
97
+ * @param newIcon
98
+ */
99
+ setBtnIcon(newIcon) {
100
+ if (this.buttonIcon) {
101
+ DOM.remove(this.buttonIcon);
121
102
  }
122
-
123
- /**
124
- * 设置按钮 Icon
125
- * @param newIcon
126
- */
127
- }, {
128
- key: "setBtnIcon",
129
- value: function setBtnIcon(newIcon) {
130
- if (this.buttonIcon) {
131
- DOM.remove(this.buttonIcon);
132
- }
133
- if (newIcon) {
134
- var _this$button4;
135
- var firstChild = (_this$button4 = this.button) === null || _this$button4 === void 0 ? void 0 : _this$button4.firstChild;
136
- if (firstChild) {
137
- var _this$button5;
138
- (_this$button5 = this.button) === null || _this$button5 === void 0 || _this$button5.insertBefore(newIcon, firstChild);
139
- } else {
140
- var _this$button6;
141
- (_this$button6 = this.button) === null || _this$button6 === void 0 || _this$button6.appendChild(newIcon);
142
- }
143
- this.buttonIcon = newIcon;
103
+ if (newIcon) {
104
+ var _this$button4;
105
+ const firstChild = (_this$button4 = this.button) === null || _this$button4 === void 0 ? void 0 : _this$button4.firstChild;
106
+ if (firstChild) {
107
+ var _this$button5;
108
+ (_this$button5 = this.button) === null || _this$button5 === void 0 || _this$button5.insertBefore(newIcon, firstChild);
109
+ } else {
110
+ var _this$button6;
111
+ (_this$button6 = this.button) === null || _this$button6 === void 0 || _this$button6.appendChild(newIcon);
144
112
  }
113
+ this.buttonIcon = newIcon;
145
114
  }
115
+ }
146
116
 
147
- /**
148
- * 设置按钮文本
149
- * @param newText
150
- */
151
- }, {
152
- key: "setBtnText",
153
- value: function setBtnText(newText) {
154
- if (!this.button) {
155
- return;
156
- }
157
- DOM.removeClass(this.button, 'l7-button-control--row');
158
- DOM.removeClass(this.button, 'l7-button-control--column');
159
- if (newText) {
160
- var btnText = this.buttonText;
161
- if (!btnText) {
162
- var _this$button7;
163
- btnText = DOM.create('div', 'l7-button-control__text');
164
- (_this$button7 = this.button) === null || _this$button7 === void 0 || _this$button7.appendChild(btnText);
165
- this.buttonText = btnText;
166
- }
167
- btnText.innerText = newText;
168
- DOM.addClass(this.button, this.controlOption.vertical ? 'l7-button-control--column' : 'l7-button-control--row');
169
- } else if (!newText && this.buttonText) {
170
- DOM.remove(this.buttonText);
171
- this.buttonText = undefined;
117
+ /**
118
+ * 设置按钮文本
119
+ * @param newText
120
+ */
121
+ setBtnText(newText) {
122
+ if (!this.button) {
123
+ return;
124
+ }
125
+ DOM.removeClass(this.button, 'l7-button-control--row');
126
+ DOM.removeClass(this.button, 'l7-button-control--column');
127
+ if (newText) {
128
+ let btnText = this.buttonText;
129
+ if (!btnText) {
130
+ var _this$button7;
131
+ btnText = DOM.create('div', 'l7-button-control__text');
132
+ (_this$button7 = this.button) === null || _this$button7 === void 0 || _this$button7.appendChild(btnText);
133
+ this.buttonText = btnText;
172
134
  }
135
+ btnText.innerText = newText;
136
+ DOM.addClass(this.button, this.controlOption.vertical ? 'l7-button-control--column' : 'l7-button-control--row');
137
+ } else if (!newText && this.buttonText) {
138
+ DOM.remove(this.buttonText);
139
+ this.buttonText = undefined;
173
140
  }
174
- }]);
175
- return ButtonControl;
176
- }(Control);
177
- export { ButtonControl as default };
141
+ }
142
+ }