@antv/l7-component 2.21.0 → 2.21.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 (83) 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 -393
  16. package/es/control/zoom.js +80 -112
  17. package/es/css/index.css +10 -7
  18. package/es/index.js +667 -1
  19. package/es/marker-layer.js +274 -326
  20. package/es/marker.d.ts +0 -2
  21. package/es/marker.js +394 -453
  22. package/es/popup/layerPopup.js +277 -321
  23. package/es/popup/popup.js +422 -482
  24. package/es/utils/anchor.js +6 -6
  25. package/es/utils/icon.js +4 -4
  26. package/es/utils/popper.js +180 -196
  27. package/es/utils/screenfull.js +29 -51
  28. package/lib/assets/iconfont/iconfont.js +6 -6
  29. package/lib/constants/index.d.ts +60 -0
  30. package/lib/constants/index.js +2 -2
  31. package/lib/control/baseControl/buttonControl.d.ts +60 -0
  32. package/lib/control/baseControl/buttonControl.js +110 -143
  33. package/lib/control/baseControl/control.d.ts +112 -0
  34. package/lib/control/baseControl/control.js +213 -257
  35. package/lib/control/baseControl/index.d.ts +4 -0
  36. package/lib/control/baseControl/index.js +5 -5
  37. package/lib/control/baseControl/popperControl.d.ts +28 -0
  38. package/lib/control/baseControl/popperControl.js +68 -94
  39. package/lib/control/baseControl/selectControl.d.ts +53 -0
  40. package/lib/control/baseControl/selectControl.js +133 -177
  41. package/lib/control/exportImage.d.ts +19 -0
  42. package/lib/control/exportImage.js +60 -141
  43. package/lib/control/fullscreen.d.ts +20 -0
  44. package/lib/control/fullscreen.js +70 -99
  45. package/lib/control/geoLocate.d.ts +17 -0
  46. package/lib/control/geoLocate.js +38 -83
  47. package/lib/control/layerSwitch.d.ts +27 -0
  48. package/lib/control/layerSwitch.js +112 -153
  49. package/lib/control/logo.d.ts +14 -0
  50. package/lib/control/logo.js +44 -69
  51. package/lib/control/mapTheme.d.ts +11 -0
  52. package/lib/control/mapTheme.js +58 -97
  53. package/lib/control/mouseLocation.d.ts +16 -0
  54. package/lib/control/mouseLocation.js +38 -68
  55. package/lib/control/scale.d.ts +35 -0
  56. package/lib/control/scale.js +108 -134
  57. package/lib/control/swipe.d.ts +66 -0
  58. package/lib/control/swipe.js +298 -392
  59. package/lib/control/zoom.d.ts +39 -0
  60. package/lib/control/zoom.js +81 -111
  61. package/lib/css/index.css +10 -7
  62. package/lib/index.d.ts +19 -0
  63. package/lib/index.js +683 -17
  64. package/lib/interface.d.ts +18 -0
  65. package/lib/marker-layer.d.ts +55 -0
  66. package/lib/marker-layer.js +276 -324
  67. package/lib/marker.d.ts +58 -0
  68. package/lib/marker.js +395 -452
  69. package/lib/popup/layerPopup.d.ts +99 -0
  70. package/lib/popup/layerPopup.js +278 -320
  71. package/lib/popup/popup.d.ts +142 -0
  72. package/lib/popup/popup.js +423 -481
  73. package/lib/utils/anchor.d.ts +22 -0
  74. package/lib/utils/anchor.js +6 -6
  75. package/lib/utils/icon.d.ts +1 -0
  76. package/lib/utils/icon.js +6 -5
  77. package/lib/utils/popper.d.ts +76 -0
  78. package/lib/utils/popper.js +184 -196
  79. package/lib/utils/screenfull.d.ts +2 -0
  80. package/lib/utils/screenfull.js +29 -52
  81. package/package.json +16 -20
  82. package/CHANGELOG.md +0 -325
  83. package/LICENSE.md +0 -21
@@ -0,0 +1,39 @@
1
+ import { PositionType } from '@antv/l7-core';
2
+ import { DOM } from '@antv/l7-utils';
3
+ import type { IControlOption } from './baseControl';
4
+ import { Control } from './baseControl';
5
+ export interface IZoomControlOption extends IControlOption {
6
+ zoomInText: DOM.ELType | string;
7
+ zoomInTitle: string;
8
+ zoomOutText: DOM.ELType | string;
9
+ zoomOutTitle: string;
10
+ showZoom: boolean;
11
+ }
12
+ export { Zoom };
13
+ export default class Zoom extends Control<IZoomControlOption> {
14
+ private disabled;
15
+ private zoomInButton;
16
+ private zoomOutButton;
17
+ private zoomNumDiv;
18
+ getDefault(option: Partial<IZoomControlOption>): {
19
+ position: PositionType;
20
+ name: string;
21
+ zoomInText: SVGSVGElement;
22
+ zoomInTitle: string;
23
+ zoomOutText: SVGSVGElement;
24
+ zoomOutTitle: string;
25
+ showZoom: boolean;
26
+ className?: string | undefined;
27
+ style?: string | undefined;
28
+ };
29
+ setOptions(newOptions: Partial<IZoomControlOption>): void;
30
+ onAdd(): HTMLElement;
31
+ onRemove(): void;
32
+ disable(): this;
33
+ enable(): this;
34
+ zoomIn: () => void;
35
+ zoomOut: () => void;
36
+ private resetButtonGroup;
37
+ private createButton;
38
+ private updateDisabled;
39
+ }
@@ -6,132 +6,102 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = exports.Zoom = void 0;
8
8
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
10
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
11
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
12
- var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
13
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
14
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
15
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
16
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
17
10
  var _l7Core = require("@antv/l7-core");
18
11
  var _l7Utils = require("@antv/l7-utils");
19
12
  var _icon = require("../utils/icon");
20
13
  var _baseControl = require("./baseControl");
21
- 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); }; }
22
- 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; } }
23
- var Zoom = exports.default = exports.Zoom = /*#__PURE__*/function (_Control) {
24
- (0, _inherits2.default)(Zoom, _Control);
25
- var _super = _createSuper(Zoom);
26
- function Zoom() {
27
- var _this;
28
- (0, _classCallCheck2.default)(this, Zoom);
29
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
30
- args[_key] = arguments[_key];
31
- }
32
- _this = _super.call.apply(_super, [this].concat(args));
33
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "zoomIn", function () {
34
- if (!_this.disabled && _this.mapsService.getZoom() < _this.mapsService.getMaxZoom()) {
35
- _this.mapsService.zoomIn();
14
+ class Zoom extends _baseControl.Control {
15
+ constructor(...args) {
16
+ super(...args);
17
+ (0, _defineProperty2.default)(this, "disabled", void 0);
18
+ (0, _defineProperty2.default)(this, "zoomInButton", void 0);
19
+ (0, _defineProperty2.default)(this, "zoomOutButton", void 0);
20
+ (0, _defineProperty2.default)(this, "zoomNumDiv", void 0);
21
+ (0, _defineProperty2.default)(this, "zoomIn", () => {
22
+ if (!this.disabled && this.mapsService.getZoom() < this.mapsService.getMaxZoom()) {
23
+ this.mapsService.zoomIn();
36
24
  }
37
25
  });
38
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "zoomOut", function () {
39
- if (!_this.disabled && _this.mapsService.getZoom() > _this.mapsService.getMinZoom()) {
40
- _this.mapsService.zoomOut();
26
+ (0, _defineProperty2.default)(this, "zoomOut", () => {
27
+ if (!this.disabled && this.mapsService.getZoom() > this.mapsService.getMinZoom()) {
28
+ this.mapsService.zoomOut();
41
29
  }
42
30
  });
43
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "updateDisabled", function () {
44
- var mapsService = _this.mapsService;
45
- _this.zoomInButton.removeAttribute('disabled');
46
- _this.zoomOutButton.removeAttribute('disabled');
47
- if (_this.disabled || mapsService.getZoom() <= mapsService.getMinZoom()) {
48
- _this.zoomOutButton.setAttribute('disabled', 'true');
31
+ (0, _defineProperty2.default)(this, "updateDisabled", () => {
32
+ const mapsService = this.mapsService;
33
+ this.zoomInButton.removeAttribute('disabled');
34
+ this.zoomOutButton.removeAttribute('disabled');
35
+ if (this.disabled || mapsService.getZoom() <= mapsService.getMinZoom()) {
36
+ this.zoomOutButton.setAttribute('disabled', 'true');
49
37
  }
50
- if (_this.controlOption.showZoom && _this.zoomNumDiv) {
51
- _this.zoomNumDiv.innerText = String(Math.floor(mapsService.getZoom()));
38
+ if (this.controlOption.showZoom && this.zoomNumDiv) {
39
+ this.zoomNumDiv.innerText = String(Math.floor(mapsService.getZoom()));
52
40
  }
53
- if (_this.disabled || mapsService.getZoom() >= mapsService.getMaxZoom()) {
54
- _this.zoomInButton.setAttribute('disabled', 'true');
41
+ if (this.disabled || mapsService.getZoom() >= mapsService.getMaxZoom()) {
42
+ this.zoomInButton.setAttribute('disabled', 'true');
55
43
  }
56
44
  });
57
- return _this;
58
45
  }
59
- (0, _createClass2.default)(Zoom, [{
60
- key: "getDefault",
61
- value: function getDefault(option) {
62
- return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _get2.default)((0, _getPrototypeOf2.default)(Zoom.prototype), "getDefault", this).call(this, option)), {}, {
63
- position: _l7Core.PositionType.BOTTOMRIGHT,
64
- name: 'zoom',
65
- zoomInText: (0, _icon.createL7Icon)('l7-icon-enlarge'),
66
- zoomInTitle: 'Zoom in',
67
- zoomOutText: (0, _icon.createL7Icon)('l7-icon-narrow'),
68
- zoomOutTitle: 'Zoom out',
69
- showZoom: false
70
- });
71
- }
72
- }, {
73
- key: "setOptions",
74
- value: function setOptions(newOptions) {
75
- (0, _get2.default)((0, _getPrototypeOf2.default)(Zoom.prototype), "setOptions", this).call(this, newOptions);
76
- if (this.checkUpdateOption(newOptions, ['zoomInText', 'zoomInTitle', 'zoomOutText', 'zoomOutTitle', 'showZoom'])) {
77
- this.resetButtonGroup(this.container);
78
- }
79
- }
80
- }, {
81
- key: "onAdd",
82
- value: function onAdd() {
83
- var container = _l7Utils.DOM.create('div', 'l7-control-zoom');
84
- this.resetButtonGroup(container);
85
- this.mapsService.on('zoomend', this.updateDisabled);
86
- this.mapsService.on('zoomchange', this.updateDisabled);
87
- return container;
88
- }
89
- }, {
90
- key: "onRemove",
91
- value: function onRemove() {
92
- this.mapsService.off('zoomend', this.updateDisabled);
93
- this.mapsService.off('zoomchange', this.updateDisabled);
94
- }
95
- }, {
96
- key: "disable",
97
- value: function disable() {
98
- this.disabled = true;
99
- this.updateDisabled();
100
- return this;
46
+ getDefault(option) {
47
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, super.getDefault(option)), {}, {
48
+ position: _l7Core.PositionType.BOTTOMRIGHT,
49
+ name: 'zoom',
50
+ zoomInText: (0, _icon.createL7Icon)('l7-icon-enlarge'),
51
+ zoomInTitle: 'Zoom in',
52
+ zoomOutText: (0, _icon.createL7Icon)('l7-icon-narrow'),
53
+ zoomOutTitle: 'Zoom out',
54
+ showZoom: false
55
+ });
56
+ }
57
+ setOptions(newOptions) {
58
+ super.setOptions(newOptions);
59
+ if (this.checkUpdateOption(newOptions, ['zoomInText', 'zoomInTitle', 'zoomOutText', 'zoomOutTitle', 'showZoom'])) {
60
+ this.resetButtonGroup(this.container);
101
61
  }
102
- }, {
103
- key: "enable",
104
- value: function enable() {
105
- this.disabled = false;
106
- this.updateDisabled();
107
- return this;
62
+ }
63
+ onAdd() {
64
+ const container = _l7Utils.DOM.create('div', 'l7-control-zoom');
65
+ this.resetButtonGroup(container);
66
+ this.mapsService.on('zoomend', this.updateDisabled);
67
+ this.mapsService.on('zoomchange', this.updateDisabled);
68
+ return container;
69
+ }
70
+ onRemove() {
71
+ this.mapsService.off('zoomend', this.updateDisabled);
72
+ this.mapsService.off('zoomchange', this.updateDisabled);
73
+ }
74
+ disable() {
75
+ this.disabled = true;
76
+ this.updateDisabled();
77
+ return this;
78
+ }
79
+ enable() {
80
+ this.disabled = false;
81
+ this.updateDisabled();
82
+ return this;
83
+ }
84
+ resetButtonGroup(container) {
85
+ _l7Utils.DOM.clearChildren(container);
86
+ this.zoomInButton = this.createButton(this.controlOption.zoomInText, this.controlOption.zoomInTitle, 'l7-button-control', container, this.zoomIn);
87
+ if (this.controlOption.showZoom) {
88
+ this.zoomNumDiv = this.createButton('0', '', 'l7-button-control l7-control-zoom__number', container);
108
89
  }
109
- }, {
110
- key: "resetButtonGroup",
111
- value: function resetButtonGroup(container) {
112
- _l7Utils.DOM.clearChildren(container);
113
- this.zoomInButton = this.createButton(this.controlOption.zoomInText, this.controlOption.zoomInTitle, 'l7-button-control', container, this.zoomIn);
114
- if (this.controlOption.showZoom) {
115
- this.zoomNumDiv = this.createButton('0', '', 'l7-button-control l7-control-zoom__number', container);
116
- }
117
- this.zoomOutButton = this.createButton(this.controlOption.zoomOutText, this.controlOption.zoomOutTitle, 'l7-button-control', container, this.zoomOut);
118
- this.updateDisabled();
90
+ this.zoomOutButton = this.createButton(this.controlOption.zoomOutText, this.controlOption.zoomOutTitle, 'l7-button-control', container, this.zoomOut);
91
+ this.updateDisabled();
92
+ }
93
+ createButton(html, tile, className, container, fn) {
94
+ const link = _l7Utils.DOM.create('button', className, container);
95
+ if (typeof html === 'string') {
96
+ link.innerHTML = html;
97
+ } else {
98
+ link.append(html);
119
99
  }
120
- }, {
121
- key: "createButton",
122
- value: function createButton(html, tile, className, container, fn) {
123
- var link = _l7Utils.DOM.create('button', className, container);
124
- if (typeof html === 'string') {
125
- link.innerHTML = html;
126
- } else {
127
- link.append(html);
128
- }
129
- link.title = tile;
130
- if (fn) {
131
- link.addEventListener('click', fn);
132
- }
133
- return link;
100
+ link.title = tile;
101
+ if (fn) {
102
+ link.addEventListener('click', fn);
134
103
  }
135
- }]);
136
- return Zoom;
137
- }(_baseControl.Control);
104
+ return link;
105
+ }
106
+ }
107
+ exports.default = exports.Zoom = Zoom;
package/lib/css/index.css CHANGED
@@ -23,7 +23,11 @@
23
23
  height: 30px;
24
24
  margin-top: 5px;
25
25
  margin-left: 5px;
26
- font: 12px 'Helvetica Neue', Arial, Helvetica, sans-serif;
26
+ font:
27
+ 12px 'Helvetica Neue',
28
+ Arial,
29
+ Helvetica,
30
+ sans-serif;
27
31
  text-align: center;
28
32
  background-color: rgba(110, 204, 57, 0.6);
29
33
  border-radius: 15px;
@@ -53,7 +57,11 @@
53
57
  box-sizing: border-box;
54
58
  }
55
59
  .l7-control-container {
56
- font: 12px/1.5 'Helvetica Neue', Arial, Helvetica, sans-serif;
60
+ font:
61
+ 12px/1.5 'Helvetica Neue',
62
+ Arial,
63
+ Helvetica,
64
+ sans-serif;
57
65
  }
58
66
  .l7-control-container .l7-control {
59
67
  position: relative;
@@ -322,11 +330,6 @@
322
330
  top: 0;
323
331
  right: 0;
324
332
  }
325
- .l7-select-control--image .l7-select-control-item input[type='radio'] {
326
- position: absolute;
327
- top: 0;
328
- right: 0;
329
- }
330
333
  .l7-select-control--image .l7-select-control-item .l7-select-control-item-row {
331
334
  display: flex;
332
335
  align-items: center;
package/lib/index.d.ts ADDED
@@ -0,0 +1,19 @@
1
+ import Marker from './marker';
2
+ import MarkerLayer from './marker-layer';
3
+ import './assets/iconfont/iconfont.js';
4
+ import './css/index.css';
5
+ export * from './control/baseControl';
6
+ export { ExportImage, type IExportImageControlOption, } from './control/exportImage';
7
+ export { Fullscreen, type IFullscreenControlOption, } from './control/fullscreen';
8
+ export { GeoLocate, type IGeoLocateOption } from './control/geoLocate';
9
+ export { LayerSwitch, type ILayerSwitchOption } from './control/layerSwitch';
10
+ export { Logo, type ILogoControlOption } from './control/logo';
11
+ export { MapTheme } from './control/mapTheme';
12
+ export { MouseLocation, type IMouseLocationControlOption, } from './control/mouseLocation';
13
+ export { Scale, type IScaleControlOption } from './control/scale';
14
+ export { Swipe, type ISwipeControlOption } from './control/swipe';
15
+ export { Zoom, type IZoomControlOption } from './control/zoom';
16
+ export * from './interface';
17
+ export { LayerPopup, type ILayerPopupOption, type LayerField, type LayerPopupConfigItem, } from './popup/layerPopup';
18
+ export { Popup } from './popup/popup';
19
+ export { Marker, MarkerLayer };