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

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 (114) hide show
  1. package/package.json +5 -5
  2. package/es/assets/iconfont/iconfont.js +0 -52
  3. package/es/constants/index.d.ts +0 -60
  4. package/es/constants/index.js +0 -60
  5. package/es/control/baseControl/buttonControl.d.ts +0 -59
  6. package/es/control/baseControl/buttonControl.js +0 -191
  7. package/es/control/baseControl/control.d.ts +0 -113
  8. package/es/control/baseControl/control.js +0 -301
  9. package/es/control/baseControl/index.d.ts +0 -4
  10. package/es/control/baseControl/index.js +0 -4
  11. package/es/control/baseControl/popperControl.d.ts +0 -26
  12. package/es/control/baseControl/popperControl.js +0 -131
  13. package/es/control/baseControl/selectControl.d.ts +0 -46
  14. package/es/control/baseControl/selectControl.js +0 -232
  15. package/es/control/exportImage.d.ts +0 -18
  16. package/es/control/exportImage.js +0 -163
  17. package/es/control/fullscreen.d.ts +0 -19
  18. package/es/control/fullscreen.js +0 -151
  19. package/es/control/geoLocate.d.ts +0 -16
  20. package/es/control/geoLocate.js +0 -139
  21. package/es/control/layerControl.d.ts +0 -21
  22. package/es/control/layerControl.js +0 -172
  23. package/es/control/logo.d.ts +0 -13
  24. package/es/control/logo.js +0 -87
  25. package/es/control/mapTheme.d.ts +0 -10
  26. package/es/control/mapTheme.js +0 -135
  27. package/es/control/mouseLocation.d.ts +0 -15
  28. package/es/control/mouseLocation.js +0 -104
  29. package/es/control/scale.d.ts +0 -34
  30. package/es/control/scale.js +0 -172
  31. package/es/control/zoom.d.ts +0 -35
  32. package/es/control/zoom.js +0 -146
  33. package/es/css/button.less +0 -70
  34. package/es/css/control.less +0 -71
  35. package/es/css/index.css +0 -567
  36. package/es/css/index.less +0 -12
  37. package/es/css/l7.less +0 -60
  38. package/es/css/layerPopup.less +0 -8
  39. package/es/css/logo.less +0 -18
  40. package/es/css/mouseLocation.less +0 -9
  41. package/es/css/popper.less +0 -64
  42. package/es/css/popup.less +0 -169
  43. package/es/css/scale.less +0 -34
  44. package/es/css/select.less +0 -86
  45. package/es/css/variables.less +0 -28
  46. package/es/css/zoom.less +0 -21
  47. package/es/images/layers.png +0 -0
  48. package/es/images/layers.svg +0 -1
  49. package/es/images/logo.png +0 -0
  50. package/es/images/quanping.svg +0 -12
  51. package/es/index.d.ts +0 -18
  52. package/es/index.js +0 -59
  53. package/es/interface.d.ts +0 -18
  54. package/es/interface.js +0 -1
  55. package/es/marker-layer.d.ts +0 -53
  56. package/es/marker-layer.js +0 -363
  57. package/es/marker.d.ts +0 -49
  58. package/es/marker.js +0 -434
  59. package/es/popup/layerPopup.d.ts +0 -78
  60. package/es/popup/layerPopup.js +0 -308
  61. package/es/popup/popup.d.ts +0 -147
  62. package/es/popup/popup.js +0 -636
  63. package/es/utils/anchor.d.ts +0 -22
  64. package/es/utils/anchor.js +0 -35
  65. package/es/utils/icon.d.ts +0 -1
  66. package/es/utils/icon.js +0 -9
  67. package/es/utils/popper.d.ts +0 -75
  68. package/es/utils/popper.js +0 -286
  69. package/es/utils/screenfull.d.ts +0 -2
  70. package/es/utils/screenfull.js +0 -157
  71. package/lib/assets/iconfont/iconfont.js +0 -54
  72. package/lib/constants/index.js +0 -68
  73. package/lib/control/baseControl/buttonControl.js +0 -207
  74. package/lib/control/baseControl/control.js +0 -327
  75. package/lib/control/baseControl/index.js +0 -57
  76. package/lib/control/baseControl/popperControl.js +0 -142
  77. package/lib/control/baseControl/selectControl.js +0 -253
  78. package/lib/control/exportImage.js +0 -177
  79. package/lib/control/fullscreen.js +0 -164
  80. package/lib/control/geoLocate.js +0 -154
  81. package/lib/control/layerControl.js +0 -182
  82. package/lib/control/logo.js +0 -105
  83. package/lib/control/mapTheme.js +0 -151
  84. package/lib/control/mouseLocation.js +0 -120
  85. package/lib/control/scale.js +0 -189
  86. package/lib/control/zoom.js +0 -162
  87. package/lib/css/button.less +0 -70
  88. package/lib/css/control.less +0 -71
  89. package/lib/css/index.css +0 -567
  90. package/lib/css/index.less +0 -12
  91. package/lib/css/l7.less +0 -60
  92. package/lib/css/layerPopup.less +0 -8
  93. package/lib/css/logo.less +0 -18
  94. package/lib/css/mouseLocation.less +0 -9
  95. package/lib/css/popper.less +0 -64
  96. package/lib/css/popup.less +0 -169
  97. package/lib/css/scale.less +0 -34
  98. package/lib/css/select.less +0 -86
  99. package/lib/css/variables.less +0 -28
  100. package/lib/css/zoom.less +0 -21
  101. package/lib/images/layers.png +0 -0
  102. package/lib/images/layers.svg +0 -1
  103. package/lib/images/logo.png +0 -0
  104. package/lib/images/quanping.svg +0 -12
  105. package/lib/index.js +0 -254
  106. package/lib/interface.js +0 -5
  107. package/lib/marker-layer.js +0 -381
  108. package/lib/marker.js +0 -449
  109. package/lib/popup/layerPopup.js +0 -317
  110. package/lib/popup/popup.js +0 -651
  111. package/lib/utils/anchor.js +0 -45
  112. package/lib/utils/icon.js +0 -18
  113. package/lib/utils/popper.js +0 -297
  114. package/lib/utils/screenfull.js +0 -167
@@ -1,139 +0,0 @@
1
- import _objectSpread from "@babel/runtime/helpers/objectSpread2";
2
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
- import _createClass from "@babel/runtime/helpers/createClass";
5
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
6
- import _get from "@babel/runtime/helpers/get";
7
- import _inherits from "@babel/runtime/helpers/inherits";
8
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
9
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
10
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
11
- import _regeneratorRuntime from "@babel/runtime/regenerator";
12
-
13
- 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); }; }
14
-
15
- 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; } }
16
-
17
- import { isNaN } from 'lodash';
18
- import { createL7Icon } from "../utils/icon";
19
- import ButtonControl from "./baseControl/buttonControl";
20
- export { GeoLocate };
21
-
22
- var GeoLocate = /*#__PURE__*/function (_ButtonControl) {
23
- _inherits(GeoLocate, _ButtonControl);
24
-
25
- var _super = _createSuper(GeoLocate);
26
-
27
- function GeoLocate(option) {
28
- var _this;
29
-
30
- _classCallCheck(this, GeoLocate);
31
-
32
- _this = _super.call(this, option);
33
-
34
- _defineProperty(_assertThisInitialized(_this), "getGeoLocation", function () {
35
- return new Promise(function (resolve, reject) {
36
- window.navigator.geolocation.getCurrentPosition(function (_ref) {
37
- var coords = _ref.coords;
38
-
39
- var _ref2 = coords !== null && coords !== void 0 ? coords : {},
40
- longitude = _ref2.longitude,
41
- latitude = _ref2.latitude;
42
-
43
- if (!isNaN(longitude) && !isNaN(latitude)) {
44
- resolve([longitude, latitude]);
45
- } else {
46
- reject();
47
- }
48
- }, function (e) {
49
- reject(e);
50
- });
51
- });
52
- });
53
-
54
- _defineProperty(_assertThisInitialized(_this), "onClick", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
55
- var transform, position, currentZoom;
56
- return _regeneratorRuntime.wrap(function _callee$(_context) {
57
- while (1) {
58
- switch (_context.prev = _context.next) {
59
- case 0:
60
- if (window.navigator.geolocation) {
61
- _context.next = 2;
62
- break;
63
- }
64
-
65
- return _context.abrupt("return");
66
-
67
- case 2:
68
- transform = _this.controlOption.transform;
69
- _context.next = 5;
70
- return _this.getGeoLocation();
71
-
72
- case 5:
73
- position = _context.sent;
74
- currentZoom = _this.mapsService.getZoom();
75
- _context.t0 = _this.mapsService;
76
- _context.t1 = currentZoom > 15 ? currentZoom : 15;
77
-
78
- if (!transform) {
79
- _context.next = 15;
80
- break;
81
- }
82
-
83
- _context.next = 12;
84
- return transform(position);
85
-
86
- case 12:
87
- _context.t2 = _context.sent;
88
- _context.next = 16;
89
- break;
90
-
91
- case 15:
92
- _context.t2 = position;
93
-
94
- case 16:
95
- _context.t3 = _context.t2;
96
-
97
- _context.t0.setZoomAndCenter.call(_context.t0, _context.t1, _context.t3);
98
-
99
- case 18:
100
- case "end":
101
- return _context.stop();
102
- }
103
- }
104
- }, _callee);
105
- })));
106
-
107
- if (!window.navigator.geolocation) {
108
- console.warn('当前浏览器环境不支持获取地理定位');
109
- }
110
-
111
- return _this;
112
- }
113
-
114
- _createClass(GeoLocate, [{
115
- key: "getDefault",
116
- value: function getDefault(option) {
117
- return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(GeoLocate.prototype), "getDefault", this).call(this, option)), {}, {
118
- title: '定位',
119
- btnIcon: createL7Icon('l7-icon-reposition')
120
- });
121
- }
122
- }, {
123
- key: "onAdd",
124
- value: function onAdd() {
125
- var button = _get(_getPrototypeOf(GeoLocate.prototype), "onAdd", this).call(this);
126
-
127
- button.addEventListener('click', this.onClick);
128
- return button;
129
- }
130
- /**
131
- * 通过浏览器 API 获取当前所在经纬度
132
- */
133
-
134
- }]);
135
-
136
- return GeoLocate;
137
- }(ButtonControl);
138
-
139
- export { GeoLocate as default };
@@ -1,21 +0,0 @@
1
- import { ILayer } from '@antv/l7-core';
2
- import SelectControl, { ISelectControlOption, ControlOptionItem } from './baseControl/selectControl';
3
- export interface ILayerControlOption extends ISelectControlOption {
4
- layers: ILayer[];
5
- }
6
- export { LayerControl };
7
- export default class LayerControl extends SelectControl<ILayerControlOption> {
8
- protected get layers(): ILayer[];
9
- getDefault(option?: Partial<ILayerControlOption>): ILayerControlOption;
10
- getLayerVisible(): string[];
11
- getLayerOptions(): ControlOptionItem[];
12
- setOptions(option: Partial<ILayerControlOption>): void;
13
- onAdd(): HTMLElement;
14
- bindLayerVisibleCallback: () => void;
15
- unbindLayerVisibleCallback: () => void;
16
- onRemove(): void;
17
- protected onLayerChange: () => void;
18
- protected onLayerVisibleChane: () => void;
19
- protected onSelectChange: () => void;
20
- protected getIsMultiple(): boolean;
21
- }
@@ -1,172 +0,0 @@
1
- import _objectSpread from "@babel/runtime/helpers/objectSpread2";
2
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
- import _createClass from "@babel/runtime/helpers/createClass";
4
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
5
- import _get from "@babel/runtime/helpers/get";
6
- import _inherits from "@babel/runtime/helpers/inherits";
7
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
8
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
9
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
10
-
11
- 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); }; }
12
-
13
- 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; } }
14
-
15
- import { createL7Icon } from "../utils/icon";
16
- import SelectControl from "./baseControl/selectControl";
17
- export { LayerControl };
18
-
19
- var LayerControl = /*#__PURE__*/function (_SelectControl) {
20
- _inherits(LayerControl, _SelectControl);
21
-
22
- var _super = _createSuper(LayerControl);
23
-
24
- function LayerControl() {
25
- var _this;
26
-
27
- _classCallCheck(this, LayerControl);
28
-
29
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
30
- args[_key] = arguments[_key];
31
- }
32
-
33
- _this = _super.call.apply(_super, [this].concat(args));
34
-
35
- _defineProperty(_assertThisInitialized(_this), "bindLayerVisibleCallback", function () {
36
- _this.layers.forEach(function (layer) {
37
- layer.on('show', _this.onLayerVisibleChane);
38
- layer.on('hide', _this.onLayerVisibleChane);
39
- });
40
- });
41
-
42
- _defineProperty(_assertThisInitialized(_this), "unbindLayerVisibleCallback", function () {
43
- _this.layers.forEach(function (layer) {
44
- layer.off('show', _this.onLayerVisibleChane);
45
- layer.off('hide', _this.onLayerVisibleChane);
46
- });
47
- });
48
-
49
- _defineProperty(_assertThisInitialized(_this), "onLayerChange", function () {
50
- var _this$controlOption$l;
51
-
52
- if ((_this$controlOption$l = _this.controlOption.layers) !== null && _this$controlOption$l !== void 0 && _this$controlOption$l.length) {
53
- return;
54
- }
55
-
56
- _this.selectValue = _this.getLayerVisible();
57
-
58
- _this.setOptions({
59
- options: _this.getLayerOptions()
60
- });
61
- });
62
-
63
- _defineProperty(_assertThisInitialized(_this), "onLayerVisibleChane", function () {
64
- _this.setSelectValue(_this.getLayerVisible());
65
- });
66
-
67
- _defineProperty(_assertThisInitialized(_this), "onSelectChange", function () {
68
- _this.layers.forEach(function (layer) {
69
- var needShow = _this.selectValue.includes(layer.name);
70
-
71
- var isShow = layer.isVisible();
72
-
73
- if (needShow && !isShow) {
74
- layer.show();
75
- }
76
-
77
- if (!needShow && isShow) {
78
- layer.hide();
79
- }
80
- });
81
- });
82
-
83
- return _this;
84
- }
85
-
86
- _createClass(LayerControl, [{
87
- key: "layers",
88
- get: function get() {
89
- return this.controlOption.layers || this.layerService.getLayers() || [];
90
- }
91
- }, {
92
- key: "getDefault",
93
- value: function getDefault(option) {
94
- return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(LayerControl.prototype), "getDefault", this).call(this, option)), {}, {
95
- title: '图层控制',
96
- btnIcon: createL7Icon('l7-icon-layer'),
97
- options: []
98
- });
99
- }
100
- }, {
101
- key: "getLayerVisible",
102
- value: function getLayerVisible() {
103
- return this.layers.filter(function (layer) {
104
- return layer.isVisible();
105
- }).map(function (layer) {
106
- return layer.name;
107
- });
108
- }
109
- }, {
110
- key: "getLayerOptions",
111
- value: function getLayerOptions() {
112
- return this.layers.map(function (layer) {
113
- return {
114
- text: layer.name,
115
- value: layer.name
116
- };
117
- });
118
- }
119
- }, {
120
- key: "setOptions",
121
- value: function setOptions(option) {
122
- var isLayerChange = this.checkUpdateOption(option, ['layers']);
123
-
124
- if (isLayerChange) {
125
- this.unbindLayerVisibleCallback();
126
- }
127
-
128
- _get(_getPrototypeOf(LayerControl.prototype), "setOptions", this).call(this, option);
129
-
130
- if (isLayerChange) {
131
- this.bindLayerVisibleCallback();
132
- this.selectValue = this.getLayerVisible();
133
- this.controlOption.options = this.getLayerOptions();
134
- this.popper.setContent(this.getPopperContent(this.controlOption.options));
135
- }
136
- }
137
- }, {
138
- key: "onAdd",
139
- value: function onAdd() {
140
- var _this$controlOption$o;
141
-
142
- if (!((_this$controlOption$o = this.controlOption.options) !== null && _this$controlOption$o !== void 0 && _this$controlOption$o.length)) {
143
- this.controlOption.options = this.getLayerOptions();
144
- }
145
-
146
- if (!this.controlOption.defaultValue) {
147
- this.controlOption.defaultValue = this.getLayerVisible();
148
- }
149
-
150
- this.on('selectChange', this.onSelectChange);
151
- this.layerService.on('layerChange', this.onLayerChange);
152
- this.bindLayerVisibleCallback();
153
- return _get(_getPrototypeOf(LayerControl.prototype), "onAdd", this).call(this);
154
- }
155
- }, {
156
- key: "onRemove",
157
- value: function onRemove() {
158
- this.off('selectChange', this.onSelectChange);
159
- this.layerService.off('layerChange', this.onLayerChange);
160
- this.unbindLayerVisibleCallback();
161
- }
162
- }, {
163
- key: "getIsMultiple",
164
- value: function getIsMultiple() {
165
- return true;
166
- }
167
- }]);
168
-
169
- return LayerControl;
170
- }(SelectControl);
171
-
172
- export { LayerControl as default };
@@ -1,13 +0,0 @@
1
- import { Control, IControlOption } from './baseControl';
2
- export interface ILogoControlOption extends IControlOption {
3
- img: string;
4
- href?: string | null;
5
- }
6
- export { Logo };
7
- export default class Logo extends Control<ILogoControlOption> {
8
- getDefault(): ILogoControlOption;
9
- onAdd(): any;
10
- onRemove(): null;
11
- setOptions(option: Partial<ILogoControlOption>): void;
12
- protected setLogoContent(container: HTMLElement): void;
13
- }
@@ -1,87 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/createClass";
3
- import _get from "@babel/runtime/helpers/get";
4
- import _inherits from "@babel/runtime/helpers/inherits";
5
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
-
8
- 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); }; }
9
-
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
-
12
- import { DOM } from '@antv/l7-utils';
13
- import { Control, PositionType } from "./baseControl";
14
- export { Logo };
15
-
16
- var Logo = /*#__PURE__*/function (_Control) {
17
- _inherits(Logo, _Control);
18
-
19
- var _super = _createSuper(Logo);
20
-
21
- function Logo() {
22
- _classCallCheck(this, Logo);
23
-
24
- return _super.apply(this, arguments);
25
- }
26
-
27
- _createClass(Logo, [{
28
- key: "getDefault",
29
- value: function getDefault() {
30
- return {
31
- position: PositionType.BOTTOMLEFT,
32
- name: 'logo',
33
- href: 'https://l7.antv.vision/',
34
- img: 'https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*GRb1TKp4HcMAAAAAAAAAAAAAARQnAQ'
35
- };
36
- }
37
- }, {
38
- key: "onAdd",
39
- value: function onAdd() {
40
- var container = DOM.create('div', 'l7-control-logo');
41
- this.setLogoContent(container);
42
- return container;
43
- }
44
- }, {
45
- key: "onRemove",
46
- value: function onRemove() {
47
- return null;
48
- }
49
- }, {
50
- key: "setOptions",
51
- value: function setOptions(option) {
52
- _get(_getPrototypeOf(Logo.prototype), "setOptions", this).call(this, option);
53
-
54
- if (this.checkUpdateOption(option, ['img', 'href'])) {
55
- DOM.clearChildren(this.container);
56
- this.setLogoContent(this.container);
57
- }
58
- }
59
- }, {
60
- key: "setLogoContent",
61
- value: function setLogoContent(container) {
62
- var _this$controlOption = this.controlOption,
63
- href = _this$controlOption.href,
64
- img = _this$controlOption.img;
65
- var imgDOM = DOM.create('img');
66
- imgDOM.setAttribute('src', img);
67
- imgDOM.setAttribute('aria-label', 'AntV logo');
68
- DOM.setUnDraggable(imgDOM);
69
-
70
- if (href) {
71
- var anchorDOM = DOM.create('a', 'l7-control-logo-link');
72
- anchorDOM.target = '_blank';
73
- anchorDOM.href = href;
74
- anchorDOM.rel = 'noopener nofollow';
75
- anchorDOM.setAttribute('rel', 'noopener nofollow');
76
- anchorDOM.appendChild(imgDOM);
77
- container.appendChild(anchorDOM);
78
- } else {
79
- container.appendChild(imgDOM);
80
- }
81
- }
82
- }]);
83
-
84
- return Logo;
85
- }(Control);
86
-
87
- export { Logo as default };
@@ -1,10 +0,0 @@
1
- import SelectControl, { ControlOptionItem, ISelectControlOption } from './baseControl/selectControl';
2
- export { MapTheme };
3
- export default class MapTheme extends SelectControl<ISelectControlOption> {
4
- getDefault(option?: Partial<ISelectControlOption>): ISelectControlOption;
5
- getStyleOptions(): ControlOptionItem[];
6
- getMapStyle(): any;
7
- onAdd(): HTMLElement;
8
- protected onMapThemeChange: () => void;
9
- protected getIsMultiple(): boolean;
10
- }
@@ -1,135 +0,0 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import _objectSpread from "@babel/runtime/helpers/objectSpread2";
3
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
- import _createClass from "@babel/runtime/helpers/createClass";
5
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
6
- import _get from "@babel/runtime/helpers/get";
7
- import _inherits from "@babel/runtime/helpers/inherits";
8
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
9
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
10
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
11
-
12
- 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); }; }
13
-
14
- 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; } }
15
-
16
- import { GaodeMapStyleConfig, MapboxMapStyleConfig } from "../constants";
17
- import { createL7Icon } from "../utils/icon";
18
- import SelectControl from "./baseControl/selectControl";
19
- export { MapTheme };
20
-
21
- var MapTheme = /*#__PURE__*/function (_SelectControl) {
22
- _inherits(MapTheme, _SelectControl);
23
-
24
- var _super = _createSuper(MapTheme);
25
-
26
- function MapTheme() {
27
- var _this;
28
-
29
- _classCallCheck(this, MapTheme);
30
-
31
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
32
- args[_key] = arguments[_key];
33
- }
34
-
35
- _this = _super.call.apply(_super, [this].concat(args));
36
-
37
- _defineProperty(_assertThisInitialized(_this), "onMapThemeChange", function () {
38
- _this.mapsService.setMapStyle(_this.selectValue[0]);
39
- });
40
-
41
- return _this;
42
- }
43
-
44
- _createClass(MapTheme, [{
45
- key: "getDefault",
46
- value: function getDefault(option) {
47
- return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(MapTheme.prototype), "getDefault", this).call(this, option)), {}, {
48
- title: '地图样式',
49
- btnIcon: createL7Icon('l7-icon-color'),
50
- options: []
51
- });
52
- }
53
- }, {
54
- key: "getStyleOptions",
55
- value: function getStyleOptions() {
56
- var mapStyleConfig = this.mapsService.getType() === 'mapbox' ? MapboxMapStyleConfig : GaodeMapStyleConfig;
57
- return Object.entries(this.mapsService.getMapStyleConfig()).filter(function (_ref) {
58
- var _ref2 = _slicedToArray(_ref, 2),
59
- key = _ref2[0],
60
- value = _ref2[1];
61
-
62
- return typeof value === 'string' && key !== 'blank';
63
- }).map(function (_ref3) {
64
- var _mapStyleConfig$key;
65
-
66
- var _ref4 = _slicedToArray(_ref3, 2),
67
- key = _ref4[0],
68
- value = _ref4[1];
69
-
70
- // @ts-ignore
71
- var _ref5 = (_mapStyleConfig$key = mapStyleConfig[key]) !== null && _mapStyleConfig$key !== void 0 ? _mapStyleConfig$key : {},
72
- text = _ref5.text,
73
- img = _ref5.img;
74
-
75
- return {
76
- text: text !== null && text !== void 0 ? text : key,
77
- value: value,
78
- img: img,
79
- key: key
80
- };
81
- });
82
- }
83
- }, {
84
- key: "getMapStyle",
85
- value: function getMapStyle() {
86
- return this.mapsService.getMapStyle();
87
- }
88
- }, {
89
- key: "onAdd",
90
- value: function onAdd() {
91
- var _this$controlOption$o,
92
- _this2 = this;
93
-
94
- if (!((_this$controlOption$o = this.controlOption.options) !== null && _this$controlOption$o !== void 0 && _this$controlOption$o.length)) {
95
- this.controlOption.options = this.getStyleOptions();
96
- }
97
-
98
- if (this.controlOption.defaultValue) {
99
- var _this$controlOption$o2, _this$controlOption$o3;
100
-
101
- var defaultValue = this.controlOption.defaultValue;
102
- this.controlOption.defaultValue = (_this$controlOption$o2 = (_this$controlOption$o3 = this.controlOption.options.find(function (item) {
103
- return item.key === defaultValue;
104
- })) === null || _this$controlOption$o3 === void 0 ? void 0 : _this$controlOption$o3.value) !== null && _this$controlOption$o2 !== void 0 ? _this$controlOption$o2 : defaultValue;
105
- } else {
106
- var defaultStyle = this.getMapStyle();
107
-
108
- if (defaultStyle) {
109
- this.controlOption.defaultValue = defaultStyle;
110
- } else {
111
- // @ts-ignore
112
- this.mapsService.map.once('styledata', function () {
113
- var mapboxStyle = _this2.mapsService.getMapStyle();
114
-
115
- _this2.controlOption.defaultValue = mapboxStyle;
116
-
117
- _this2.setSelectValue(mapboxStyle, false);
118
- });
119
- }
120
- }
121
-
122
- this.on('selectChange', this.onMapThemeChange);
123
- return _get(_getPrototypeOf(MapTheme.prototype), "onAdd", this).call(this);
124
- }
125
- }, {
126
- key: "getIsMultiple",
127
- value: function getIsMultiple() {
128
- return false;
129
- }
130
- }]);
131
-
132
- return MapTheme;
133
- }(SelectControl);
134
-
135
- export { MapTheme as default };
@@ -1,15 +0,0 @@
1
- import { Position } from '@antv/l7-core';
2
- import Control, { IControlOption } from './baseControl/control';
3
- export interface IMouseLocationControlOption extends IControlOption {
4
- transform: (position: Position) => Position;
5
- }
6
- export { MouseLocation };
7
- export default class MouseLocation extends Control<IMouseLocationControlOption> {
8
- protected location: Position;
9
- getLocation(): Position;
10
- getDefault(option?: Partial<IMouseLocationControlOption>): IMouseLocationControlOption;
11
- onAdd(): HTMLElement;
12
- onRemove(): void;
13
- protected onMouseMove: (e: any) => void;
14
- protected insertLocation2HTML(position: Position): void;
15
- }