@antv/l7-component 2.18.2 → 2.18.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 (114) hide show
  1. package/es/assets/iconfont/iconfont.js +46 -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 +177 -0
  6. package/es/control/baseControl/control.d.ts +112 -0
  7. package/es/control/baseControl/control.js +302 -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 +120 -0
  12. package/es/control/baseControl/selectControl.d.ts +46 -0
  13. package/es/control/baseControl/selectControl.js +204 -0
  14. package/es/control/exportImage.d.ts +18 -0
  15. package/es/control/exportImage.js +159 -0
  16. package/es/control/fullscreen.d.ts +19 -0
  17. package/es/control/fullscreen.js +119 -0
  18. package/es/control/geoLocate.d.ts +16 -0
  19. package/es/control/geoLocate.js +107 -0
  20. package/es/control/layerSwitch.d.ts +19 -0
  21. package/es/control/layerSwitch.js +141 -0
  22. package/es/control/logo.d.ts +13 -0
  23. package/es/control/logo.js +75 -0
  24. package/es/control/mapTheme.d.ts +10 -0
  25. package/es/control/mapTheme.js +110 -0
  26. package/es/control/mouseLocation.d.ts +15 -0
  27. package/es/control/mouseLocation.js +83 -0
  28. package/es/control/scale.d.ts +34 -0
  29. package/es/control/scale.js +149 -0
  30. package/es/control/zoom.d.ts +38 -0
  31. package/es/control/zoom.js +132 -0
  32. package/es/css/button.less +70 -0
  33. package/es/css/control.less +71 -0
  34. package/es/css/index.css +594 -0
  35. package/es/css/index.less +12 -0
  36. package/es/css/l7.less +62 -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 +185 -0
  42. package/es/css/scale.less +34 -0
  43. package/es/css/select.less +86 -0
  44. package/es/css/variables.less +30 -0
  45. package/es/css/zoom.less +29 -0
  46. package/es/images/layers.png +0 -0
  47. package/es/images/layers.svg +1 -0
  48. package/es/images/logo.png +0 -0
  49. package/es/images/quanping.svg +12 -0
  50. package/es/index.d.ts +18 -0
  51. package/es/index.js +49 -0
  52. package/es/interface.d.ts +18 -0
  53. package/es/interface.js +1 -0
  54. package/es/marker-layer.d.ts +54 -0
  55. package/es/marker-layer.js +343 -0
  56. package/es/marker.d.ts +55 -0
  57. package/es/marker.js +410 -0
  58. package/es/popup/layerPopup.d.ts +86 -0
  59. package/es/popup/layerPopup.js +312 -0
  60. package/es/popup/popup.d.ts +139 -0
  61. package/es/popup/popup.js +567 -0
  62. package/es/utils/anchor.d.ts +22 -0
  63. package/es/utils/anchor.js +31 -0
  64. package/es/utils/icon.d.ts +1 -0
  65. package/es/utils/icon.js +9 -0
  66. package/es/utils/popper.d.ts +75 -0
  67. package/es/utils/popper.js +259 -0
  68. package/es/utils/screenfull.d.ts +2 -0
  69. package/es/utils/screenfull.js +128 -0
  70. package/lib/assets/iconfont/iconfont.js +48 -0
  71. package/lib/constants/index.js +68 -0
  72. package/lib/control/baseControl/buttonControl.js +183 -0
  73. package/lib/control/baseControl/control.js +314 -0
  74. package/lib/control/baseControl/index.js +39 -0
  75. package/lib/control/baseControl/popperControl.js +126 -0
  76. package/lib/control/baseControl/selectControl.js +210 -0
  77. package/lib/control/exportImage.js +165 -0
  78. package/lib/control/fullscreen.js +125 -0
  79. package/lib/control/geoLocate.js +113 -0
  80. package/lib/control/layerSwitch.js +147 -0
  81. package/lib/control/logo.js +81 -0
  82. package/lib/control/mapTheme.js +116 -0
  83. package/lib/control/mouseLocation.js +89 -0
  84. package/lib/control/scale.js +155 -0
  85. package/lib/control/zoom.js +138 -0
  86. package/lib/css/button.less +70 -0
  87. package/lib/css/control.less +71 -0
  88. package/lib/css/index.css +594 -0
  89. package/lib/css/index.less +12 -0
  90. package/lib/css/l7.less +62 -0
  91. package/lib/css/layerPopup.less +8 -0
  92. package/lib/css/logo.less +18 -0
  93. package/lib/css/mouseLocation.less +9 -0
  94. package/lib/css/popper.less +64 -0
  95. package/lib/css/popup.less +185 -0
  96. package/lib/css/scale.less +34 -0
  97. package/lib/css/select.less +86 -0
  98. package/lib/css/variables.less +30 -0
  99. package/lib/css/zoom.less +29 -0
  100. package/lib/images/layers.png +0 -0
  101. package/lib/images/layers.svg +1 -0
  102. package/lib/images/logo.png +0 -0
  103. package/lib/images/quanping.svg +12 -0
  104. package/lib/index.js +169 -0
  105. package/lib/interface.js +5 -0
  106. package/lib/marker-layer.js +349 -0
  107. package/lib/marker.js +417 -0
  108. package/lib/popup/layerPopup.js +317 -0
  109. package/lib/popup/popup.js +573 -0
  110. package/lib/utils/anchor.js +40 -0
  111. package/lib/utils/icon.js +16 -0
  112. package/lib/utils/popper.js +263 -0
  113. package/lib/utils/screenfull.js +136 -0
  114. package/package.json +6 -6
@@ -0,0 +1,132 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
4
+ import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
5
+ import _get from "@babel/runtime/helpers/esm/get";
6
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
7
+ import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
8
+ import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
9
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
10
+ 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); }; }
11
+ 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; } }
12
+ import { PositionType } from '@antv/l7-core';
13
+ import { DOM } from '@antv/l7-utils';
14
+ import { createL7Icon } from "../utils/icon";
15
+ import { Control } from "./baseControl";
16
+ export { Zoom };
17
+ var Zoom = /*#__PURE__*/function (_Control) {
18
+ _inherits(Zoom, _Control);
19
+ var _super = _createSuper(Zoom);
20
+ function Zoom() {
21
+ var _this;
22
+ _classCallCheck(this, Zoom);
23
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
24
+ args[_key] = arguments[_key];
25
+ }
26
+ _this = _super.call.apply(_super, [this].concat(args));
27
+ _defineProperty(_assertThisInitialized(_this), "zoomIn", function () {
28
+ if (!_this.disabled && _this.mapsService.getZoom() < _this.mapsService.getMaxZoom()) {
29
+ _this.mapsService.zoomIn();
30
+ }
31
+ });
32
+ _defineProperty(_assertThisInitialized(_this), "zoomOut", function () {
33
+ if (!_this.disabled && _this.mapsService.getZoom() > _this.mapsService.getMinZoom()) {
34
+ _this.mapsService.zoomOut();
35
+ }
36
+ });
37
+ _defineProperty(_assertThisInitialized(_this), "updateDisabled", function () {
38
+ var mapsService = _this.mapsService;
39
+ _this.zoomInButton.removeAttribute('disabled');
40
+ _this.zoomOutButton.removeAttribute('disabled');
41
+ if (_this.disabled || mapsService.getZoom() <= mapsService.getMinZoom()) {
42
+ _this.zoomOutButton.setAttribute('disabled', 'true');
43
+ }
44
+ if (_this.controlOption.showZoom && _this.zoomNumDiv) {
45
+ _this.zoomNumDiv.innerText = String(Math.floor(mapsService.getZoom()));
46
+ }
47
+ if (_this.disabled || mapsService.getZoom() >= mapsService.getMaxZoom()) {
48
+ _this.zoomInButton.setAttribute('disabled', 'true');
49
+ }
50
+ });
51
+ return _this;
52
+ }
53
+ _createClass(Zoom, [{
54
+ key: "getDefault",
55
+ value: function getDefault(option) {
56
+ return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(Zoom.prototype), "getDefault", this).call(this, option)), {}, {
57
+ position: PositionType.BOTTOMRIGHT,
58
+ name: 'zoom',
59
+ zoomInText: createL7Icon('l7-icon-enlarge'),
60
+ zoomInTitle: 'Zoom in',
61
+ zoomOutText: createL7Icon('l7-icon-narrow'),
62
+ zoomOutTitle: 'Zoom out',
63
+ showZoom: false
64
+ });
65
+ }
66
+ }, {
67
+ key: "setOptions",
68
+ value: function setOptions(newOptions) {
69
+ _get(_getPrototypeOf(Zoom.prototype), "setOptions", this).call(this, newOptions);
70
+ if (this.checkUpdateOption(newOptions, ['zoomInText', 'zoomInTitle', 'zoomOutText', 'zoomOutTitle', 'showZoom'])) {
71
+ this.resetButtonGroup(this.container);
72
+ }
73
+ }
74
+ }, {
75
+ key: "onAdd",
76
+ value: function onAdd() {
77
+ var container = DOM.create('div', 'l7-control-zoom');
78
+ this.resetButtonGroup(container);
79
+ this.mapsService.on('zoomend', this.updateDisabled);
80
+ this.mapsService.on('zoomchange', this.updateDisabled);
81
+ return container;
82
+ }
83
+ }, {
84
+ key: "onRemove",
85
+ value: function onRemove() {
86
+ this.mapsService.off('zoomend', this.updateDisabled);
87
+ this.mapsService.off('zoomchange', this.updateDisabled);
88
+ }
89
+ }, {
90
+ key: "disable",
91
+ value: function disable() {
92
+ this.disabled = true;
93
+ this.updateDisabled();
94
+ return this;
95
+ }
96
+ }, {
97
+ key: "enable",
98
+ value: function enable() {
99
+ this.disabled = false;
100
+ this.updateDisabled();
101
+ return this;
102
+ }
103
+ }, {
104
+ key: "resetButtonGroup",
105
+ value: function resetButtonGroup(container) {
106
+ DOM.clearChildren(container);
107
+ this.zoomInButton = this.createButton(this.controlOption.zoomInText, this.controlOption.zoomInTitle, 'l7-button-control', container, this.zoomIn);
108
+ if (this.controlOption.showZoom) {
109
+ this.zoomNumDiv = this.createButton('0', '', 'l7-button-control l7-control-zoom__number', container);
110
+ }
111
+ this.zoomOutButton = this.createButton(this.controlOption.zoomOutText, this.controlOption.zoomOutTitle, 'l7-button-control', container, this.zoomOut);
112
+ this.updateDisabled();
113
+ }
114
+ }, {
115
+ key: "createButton",
116
+ value: function createButton(html, tile, className, container, fn) {
117
+ var link = DOM.create('button', className, container);
118
+ if (typeof html === 'string') {
119
+ link.innerHTML = html;
120
+ } else {
121
+ link.append(html);
122
+ }
123
+ link.title = tile;
124
+ if (fn) {
125
+ link.addEventListener('click', fn);
126
+ }
127
+ return link;
128
+ }
129
+ }]);
130
+ return Zoom;
131
+ }(Control);
132
+ export { Zoom as default };
@@ -0,0 +1,70 @@
1
+ @import 'variables.less';
2
+
3
+ .l7-button-control {
4
+ min-width: @l7-btn-control-size;
5
+ height: @l7-btn-control-size;
6
+ background-color: @l7-control-bg-color;
7
+ border-width: 0;
8
+ border-radius: @l7-btn-control-border-radius;
9
+ outline: 0;
10
+ cursor: pointer;
11
+ transition: all 0.2s;
12
+ display: flex;
13
+ justify-content: center;
14
+ align-items: center;
15
+ padding: 0 ((@l7-btn-control-size - @l7-btn-icon-size) / 2);
16
+ box-shadow: @l7-control-shadow;
17
+ line-height: 16px;
18
+
19
+ .l7-iconfont {
20
+ fill: @l7-control-font-color;
21
+ color: @l7-control-font-color;
22
+ width: @l7-btn-icon-size;
23
+ height: @l7-btn-icon-size;
24
+ }
25
+
26
+ &.l7-button-control--row {
27
+ padding: 0 16px 0 13px;
28
+
29
+ * + .l7-button-control__text {
30
+ margin-left: 8px;
31
+ }
32
+ }
33
+
34
+ &.l7-button-control--column {
35
+ height: @l7-btn-column-height;
36
+ flex-direction: column;
37
+ .l7-iconfont {
38
+ margin-top: 3px;
39
+ }
40
+ .l7-button-control__text {
41
+ margin-top: 3px;
42
+ font-size: 10px;
43
+ transform: scale(0.83333);
44
+ }
45
+ }
46
+
47
+ &:not(:disabled) {
48
+ &:hover {
49
+ background-color: @l7-btn-control-bg-hover-color;
50
+ }
51
+ &:active {
52
+ background-color: @l7-btn-control-bg-active-color;
53
+ }
54
+ }
55
+ &:disabled {
56
+ background-color: @l7-btn-control-disabled-bg-color;
57
+ color: @l7-btn-control-disabled-font-color;
58
+ cursor: not-allowed;
59
+ .l7-iconfont {
60
+ fill: @l7-btn-control-disabled-font-color;
61
+ color: @l7-btn-control-disabled-font-color;
62
+ }
63
+ &:hover {
64
+ background-color: @l7-btn-control-disabled-bg-color;
65
+ }
66
+ &:active {
67
+ background-color: @l7-btn-control-disabled-bg-color;
68
+ }
69
+ }
70
+ }
@@ -0,0 +1,71 @@
1
+ @import 'variables.less';
2
+
3
+ .l7-control-container {
4
+ font: 12px/1.5 'Helvetica Neue', Arial, Helvetica, sans-serif;
5
+
6
+ .l7-control {
7
+ position: relative;
8
+ z-index: @l7-control-z-index;
9
+ float: left;
10
+ clear: both;
11
+ color: @l7-control-font-color;
12
+ font-size: @l7-control-font-size;
13
+ pointer-events: visiblePainted; /* IE 9-10 doesn't have auto */
14
+ pointer-events: auto;
15
+
16
+ &.l7-control--hide {
17
+ display: none;
18
+ }
19
+ }
20
+
21
+ each(@position-list,{
22
+ .l7-@{value} {
23
+ @{value}: 0;
24
+ display: flex;
25
+ position: absolute;
26
+ z-index: @l7-control-z-index;
27
+ pointer-events: none;
28
+ .l7-control:not(.l7-control--hide) {
29
+ margin-@{value}: @l7-control-space;
30
+ }
31
+ }
32
+ });
33
+
34
+ .l7-center {
35
+ position: absolute;
36
+ display: flex;
37
+ justify-content: center;
38
+ &.l7-top,
39
+ &.l7-bottom {
40
+ width: 100%;
41
+ }
42
+ &.l7-left,
43
+ &.l7-right {
44
+ height: 100%;
45
+ }
46
+ .l7-control {
47
+ margin-right: @l7-control-space;
48
+ margin-bottom: @l7-control-space;
49
+ }
50
+ }
51
+
52
+ .l7-row {
53
+ flex-direction: row;
54
+ &.l7-top {
55
+ align-items: flex-start;
56
+ }
57
+ &.l7-bottom {
58
+ align-items: flex-end;
59
+ }
60
+ }
61
+
62
+ .l7-column {
63
+ flex-direction: column;
64
+ &.l7-left {
65
+ align-items: flex-start;
66
+ }
67
+ &.l7-right {
68
+ align-items: flex-end;
69
+ }
70
+ }
71
+ }