@antv/l7-component 2.9.32-alpha.3 → 2.9.32-alpha.4

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 +53 -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 +191 -0
  6. package/es/control/baseControl/control.d.ts +107 -0
  7. package/es/control/baseControl/control.js +288 -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 +131 -0
  12. package/es/control/baseControl/selectControl.d.ts +46 -0
  13. package/es/control/baseControl/selectControl.js +227 -0
  14. package/es/control/exportImage.d.ts +18 -0
  15. package/es/control/exportImage.js +163 -0
  16. package/es/control/fullscreen.d.ts +19 -0
  17. package/es/control/fullscreen.js +151 -0
  18. package/es/control/geoLocate.d.ts +16 -0
  19. package/es/control/geoLocate.js +139 -0
  20. package/es/control/layerControl.d.ts +21 -0
  21. package/es/control/layerControl.js +172 -0
  22. package/es/control/logo.d.ts +13 -0
  23. package/es/control/logo.js +87 -0
  24. package/es/control/mapTheme.d.ts +10 -0
  25. package/es/control/mapTheme.js +135 -0
  26. package/es/control/mouseLocation.d.ts +15 -0
  27. package/es/control/mouseLocation.js +104 -0
  28. package/es/control/scale.d.ts +34 -0
  29. package/es/control/scale.js +172 -0
  30. package/es/control/zoom.d.ts +34 -0
  31. package/es/control/zoom.js +146 -0
  32. package/es/css/button.less +70 -0
  33. package/es/css/control.less +71 -0
  34. package/es/css/index.css +567 -0
  35. package/es/css/index.less +12 -0
  36. package/es/css/l7.less +60 -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 +169 -0
  42. package/es/css/scale.less +34 -0
  43. package/es/css/select.less +86 -0
  44. package/es/css/variables.less +28 -0
  45. package/es/css/zoom.less +21 -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 +59 -0
  52. package/es/interface.d.ts +18 -0
  53. package/es/interface.js +1 -0
  54. package/es/marker-layer.d.ts +53 -0
  55. package/es/marker-layer.js +363 -0
  56. package/es/marker.d.ts +49 -0
  57. package/es/marker.js +434 -0
  58. package/es/popup/layerPopup.d.ts +78 -0
  59. package/es/popup/layerPopup.js +308 -0
  60. package/es/popup/popup.d.ts +147 -0
  61. package/es/popup/popup.js +636 -0
  62. package/es/utils/anchor.d.ts +22 -0
  63. package/es/utils/anchor.js +35 -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 +286 -0
  68. package/es/utils/screenfull.d.ts +2 -0
  69. package/es/utils/screenfull.js +157 -0
  70. package/lib/assets/iconfont/iconfont.js +39 -0
  71. package/lib/constants/index.js +90 -0
  72. package/lib/control/baseControl/buttonControl.js +118 -0
  73. package/lib/control/baseControl/control.js +172 -0
  74. package/lib/control/baseControl/index.js +22 -0
  75. package/lib/control/baseControl/popperControl.js +108 -0
  76. package/lib/control/baseControl/selectControl.js +153 -0
  77. package/lib/control/exportImage.js +83 -0
  78. package/lib/control/fullscreen.js +109 -0
  79. package/lib/control/geoLocate.js +78 -0
  80. package/lib/control/layerControl.js +136 -0
  81. package/lib/control/logo.js +74 -0
  82. package/lib/control/mapTheme.js +92 -0
  83. package/lib/control/mouseLocation.js +79 -0
  84. package/lib/control/scale.js +136 -0
  85. package/lib/control/zoom.js +119 -0
  86. package/lib/css/button.less +70 -0
  87. package/lib/css/control.less +71 -0
  88. package/lib/css/index.css +567 -0
  89. package/lib/css/index.less +12 -0
  90. package/lib/css/l7.less +60 -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 +169 -0
  96. package/lib/css/scale.less +34 -0
  97. package/lib/css/select.less +86 -0
  98. package/lib/css/variables.less +28 -0
  99. package/lib/css/zoom.less +21 -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 +51 -0
  105. package/lib/interface.js +17 -0
  106. package/lib/marker-layer.js +263 -0
  107. package/lib/marker.js +307 -0
  108. package/lib/popup/layerPopup.js +200 -0
  109. package/lib/popup/popup.js +388 -0
  110. package/lib/utils/anchor.js +63 -0
  111. package/lib/utils/icon.js +37 -0
  112. package/lib/utils/popper.js +209 -0
  113. package/lib/utils/screenfull.js +160 -0
  114. package/package.json +5 -5
@@ -0,0 +1,136 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/control/scale.ts
20
+ var scale_exports = {};
21
+ __export(scale_exports, {
22
+ Scale: () => Scale,
23
+ default: () => Scale
24
+ });
25
+ module.exports = __toCommonJS(scale_exports);
26
+ var import_l7_utils = require("@antv/l7-utils");
27
+ var import_baseControl = require("./baseControl");
28
+ var Scale = class extends import_baseControl.Control {
29
+ constructor() {
30
+ super(...arguments);
31
+ this.update = () => {
32
+ const mapsService = this.mapsService;
33
+ const { maxWidth } = this.controlOption;
34
+ const y = mapsService.getSize()[1] / 2;
35
+ const p1 = mapsService.containerToLngLat([0, y]);
36
+ const p2 = mapsService.containerToLngLat([maxWidth, y]);
37
+ const maxMeters = (0, import_l7_utils.lnglatDistance)([p1.lng, p1.lat], [p2.lng, p2.lat]);
38
+ this.updateScales(maxMeters);
39
+ };
40
+ }
41
+ getDefault(option) {
42
+ return {
43
+ ...super.getDefault(option),
44
+ name: "scale",
45
+ position: import_baseControl.PositionType.BOTTOMLEFT,
46
+ maxWidth: 100,
47
+ metric: true,
48
+ updateWhenIdle: false,
49
+ imperial: false,
50
+ lockWidth: true
51
+ };
52
+ }
53
+ onAdd() {
54
+ const className = "l7-control-scale";
55
+ const container = import_l7_utils.DOM.create("div", className);
56
+ this.resetScaleLines(container);
57
+ const { updateWhenIdle } = this.controlOption;
58
+ this.mapsService.on(updateWhenIdle ? "moveend" : "mapmove", this.update);
59
+ this.mapsService.on(updateWhenIdle ? "zoomend" : "zoomchange", this.update);
60
+ return container;
61
+ }
62
+ onRemove() {
63
+ const { updateWhenIdle } = this.controlOption;
64
+ this.mapsService.off(updateWhenIdle ? "zoomend" : "zoomchange", this.update);
65
+ this.mapsService.off(updateWhenIdle ? "moveend" : "mapmove", this.update);
66
+ }
67
+ setOptions(newOption) {
68
+ super.setOptions(newOption);
69
+ if (this.checkUpdateOption(newOption, [
70
+ "lockWidth",
71
+ "maxWidth",
72
+ "metric",
73
+ "updateWhenIdle",
74
+ "imperial"
75
+ ])) {
76
+ this.resetScaleLines(this.container);
77
+ }
78
+ }
79
+ updateScales(maxMeters) {
80
+ const { metric, imperial } = this.controlOption;
81
+ if (metric && maxMeters) {
82
+ this.updateMetric(maxMeters);
83
+ }
84
+ if (imperial && maxMeters) {
85
+ this.updateImperial(maxMeters);
86
+ }
87
+ }
88
+ resetScaleLines(container) {
89
+ import_l7_utils.DOM.clearChildren(container);
90
+ const { metric, imperial, maxWidth, lockWidth } = this.controlOption;
91
+ if (lockWidth) {
92
+ import_l7_utils.DOM.addStyle(container, `width: ${maxWidth}px`);
93
+ }
94
+ if (metric) {
95
+ this.mScale = import_l7_utils.DOM.create("div", "l7-control-scale-line", container);
96
+ }
97
+ if (imperial) {
98
+ this.iScale = import_l7_utils.DOM.create("div", "l7-control-scale-line", container);
99
+ }
100
+ this.update();
101
+ }
102
+ updateScale(scale, text, ratio) {
103
+ const { maxWidth } = this.controlOption;
104
+ scale.style.width = Math.round(maxWidth * ratio) + "px";
105
+ scale.innerHTML = text;
106
+ }
107
+ getRoundNum(num) {
108
+ const pow10 = Math.pow(10, (Math.floor(num) + "").length - 1);
109
+ let d = num / pow10;
110
+ d = d >= 10 ? 10 : d >= 5 ? 5 : d >= 3 ? 3 : d >= 2 ? 2 : 1;
111
+ return pow10 * d;
112
+ }
113
+ updateMetric(maxMeters) {
114
+ const meters = this.getRoundNum(maxMeters);
115
+ const label = meters < 1e3 ? meters + " m" : meters / 1e3 + " km";
116
+ this.updateScale(this.mScale, label, meters / maxMeters);
117
+ }
118
+ updateImperial(maxMeters) {
119
+ const maxFeet = maxMeters * 3.2808399;
120
+ let maxMiles;
121
+ let miles;
122
+ let feet;
123
+ if (maxFeet > 5280) {
124
+ maxMiles = maxFeet / 5280;
125
+ miles = this.getRoundNum(maxMiles);
126
+ this.updateScale(this.iScale, miles + " mi", miles / maxMiles);
127
+ } else {
128
+ feet = this.getRoundNum(maxFeet);
129
+ this.updateScale(this.iScale, feet + " ft", feet / maxFeet);
130
+ }
131
+ }
132
+ };
133
+ // Annotate the CommonJS export names for ESM import in node:
134
+ 0 && (module.exports = {
135
+ Scale
136
+ });
@@ -0,0 +1,119 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/control/zoom.ts
20
+ var zoom_exports = {};
21
+ __export(zoom_exports, {
22
+ Zoom: () => Zoom,
23
+ default: () => Zoom
24
+ });
25
+ module.exports = __toCommonJS(zoom_exports);
26
+ var import_l7_core = require("@antv/l7-core");
27
+ var import_l7_utils = require("@antv/l7-utils");
28
+ var import_icon = require("../utils/icon");
29
+ var import_baseControl = require("./baseControl");
30
+ var Zoom = class extends import_baseControl.Control {
31
+ constructor() {
32
+ super(...arguments);
33
+ this.zoomIn = () => {
34
+ if (!this.disabled && this.mapsService.getZoom() < this.mapsService.getMaxZoom()) {
35
+ this.mapsService.zoomIn();
36
+ }
37
+ };
38
+ this.zoomOut = () => {
39
+ if (!this.disabled && this.mapsService.getZoom() > this.mapsService.getMinZoom()) {
40
+ this.mapsService.zoomOut();
41
+ }
42
+ };
43
+ this.updateDisabled = () => {
44
+ const 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");
49
+ }
50
+ if (this.disabled || mapsService.getZoom() >= mapsService.getMaxZoom()) {
51
+ this.zoomInButton.setAttribute("disabled", "true");
52
+ }
53
+ };
54
+ }
55
+ getDefault(option) {
56
+ return {
57
+ ...super.getDefault(option),
58
+ position: import_l7_core.PositionType.BOTTOMRIGHT,
59
+ name: "zoom",
60
+ zoomInText: (0, import_icon.createL7Icon)("l7-icon-enlarge"),
61
+ zoomInTitle: "Zoom in",
62
+ zoomOutText: (0, import_icon.createL7Icon)("l7-icon-narrow"),
63
+ zoomOutTitle: "Zoom out"
64
+ };
65
+ }
66
+ setOptions(newOptions) {
67
+ super.setOptions(newOptions);
68
+ if (this.checkUpdateOption(newOptions, [
69
+ "zoomInText",
70
+ "zoomInTitle",
71
+ "zoomOutText",
72
+ "zoomOutTitle"
73
+ ])) {
74
+ this.resetButtonGroup(this.container);
75
+ }
76
+ }
77
+ onAdd() {
78
+ const container = import_l7_utils.DOM.create("div", "l7-control-zoom");
79
+ this.resetButtonGroup(container);
80
+ this.mapsService.on("zoomend", this.updateDisabled);
81
+ this.mapsService.on("zoomchange", this.updateDisabled);
82
+ return container;
83
+ }
84
+ onRemove() {
85
+ this.mapsService.off("zoomend", this.updateDisabled);
86
+ this.mapsService.off("zoomchange", this.updateDisabled);
87
+ }
88
+ disable() {
89
+ this.disabled = true;
90
+ this.updateDisabled();
91
+ return this;
92
+ }
93
+ enable() {
94
+ this.disabled = false;
95
+ this.updateDisabled();
96
+ return this;
97
+ }
98
+ resetButtonGroup(container) {
99
+ import_l7_utils.DOM.clearChildren(container);
100
+ this.zoomInButton = this.createButton(this.controlOption.zoomInText, this.controlOption.zoomInTitle, "l7-button-control", container, this.zoomIn);
101
+ this.zoomOutButton = this.createButton(this.controlOption.zoomOutText, this.controlOption.zoomOutTitle, "l7-button-control", container, this.zoomOut);
102
+ this.updateDisabled();
103
+ }
104
+ createButton(html, tile, className, container, fn) {
105
+ const link = import_l7_utils.DOM.create("button", className, container);
106
+ if (typeof html === "string") {
107
+ link.innerHTML = html;
108
+ } else {
109
+ link.append(html);
110
+ }
111
+ link.title = tile;
112
+ link.addEventListener("click", fn);
113
+ return link;
114
+ }
115
+ };
116
+ // Annotate the CommonJS export names for ESM import in node:
117
+ 0 && (module.exports = {
118
+ Zoom
119
+ });
@@ -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: 800;
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: 1000;
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
+ }