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

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 (110) hide show
  1. package/es/assets/iconfont/iconfont.js +52 -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 +113 -0
  7. package/es/control/baseControl/control.js +301 -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 +232 -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 +10 -6
  23. package/es/control/logo.js +41 -11
  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 +20 -10
  29. package/es/control/scale.js +77 -53
  30. package/es/control/zoom.d.ts +21 -10
  31. package/es/control/zoom.js +76 -49
  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/logo.png +0 -0
  47. package/es/images/quanping.svg +12 -0
  48. package/es/index.d.ts +15 -8
  49. package/es/index.js +15 -9
  50. package/es/interface.d.ts +1 -20
  51. package/es/popup/layerPopup.d.ts +78 -0
  52. package/es/popup/layerPopup.js +308 -0
  53. package/es/popup/popup.d.ts +147 -0
  54. package/es/popup/popup.js +636 -0
  55. package/es/utils/icon.d.ts +1 -0
  56. package/es/utils/icon.js +9 -0
  57. package/es/utils/popper.d.ts +75 -0
  58. package/es/utils/popper.js +286 -0
  59. package/es/utils/screenfull.d.ts +2 -0
  60. package/es/utils/screenfull.js +157 -0
  61. package/lib/assets/iconfont/iconfont.js +54 -0
  62. package/lib/constants/index.js +68 -0
  63. package/lib/control/baseControl/buttonControl.js +207 -0
  64. package/lib/control/baseControl/control.js +327 -0
  65. package/lib/control/baseControl/index.js +57 -0
  66. package/lib/control/baseControl/popperControl.js +142 -0
  67. package/lib/control/baseControl/selectControl.js +253 -0
  68. package/lib/control/exportImage.js +177 -0
  69. package/lib/control/fullscreen.js +164 -0
  70. package/lib/control/geoLocate.js +154 -0
  71. package/lib/control/layerControl.js +182 -0
  72. package/lib/control/logo.js +50 -23
  73. package/lib/control/mapTheme.js +151 -0
  74. package/lib/control/mouseLocation.js +120 -0
  75. package/lib/control/scale.js +82 -62
  76. package/lib/control/zoom.js +78 -59
  77. package/lib/css/button.less +70 -0
  78. package/lib/css/control.less +71 -0
  79. package/lib/css/index.css +567 -0
  80. package/lib/css/index.less +12 -0
  81. package/lib/css/l7.less +60 -0
  82. package/lib/css/layerPopup.less +8 -0
  83. package/lib/css/logo.less +18 -0
  84. package/lib/css/mouseLocation.less +9 -0
  85. package/lib/css/popper.less +64 -0
  86. package/lib/css/popup.less +169 -0
  87. package/lib/css/scale.less +34 -0
  88. package/lib/css/select.less +86 -0
  89. package/lib/css/variables.less +28 -0
  90. package/lib/css/zoom.less +21 -0
  91. package/lib/images/logo.png +0 -0
  92. package/lib/images/quanping.svg +12 -0
  93. package/lib/index.js +165 -50
  94. package/lib/popup/layerPopup.js +317 -0
  95. package/lib/popup/popup.js +651 -0
  96. package/lib/utils/icon.js +18 -0
  97. package/lib/utils/popper.js +297 -0
  98. package/lib/utils/screenfull.js +167 -0
  99. package/package.json +8 -5
  100. package/es/control/BaseControl.d.ts +0 -27
  101. package/es/control/BaseControl.js +0 -134
  102. package/es/control/layer.d.ts +0 -38
  103. package/es/control/layer.js +0 -340
  104. package/es/css/l7.css +0 -502
  105. package/es/popup.d.ts +0 -35
  106. package/es/popup.js +0 -300
  107. package/lib/control/BaseControl.js +0 -160
  108. package/lib/control/layer.js +0 -362
  109. package/lib/css/l7.css +0 -502
  110. package/lib/popup.js +0 -317
@@ -2,12 +2,12 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
 
5
- var _typeof = require("@babel/runtime/helpers/typeof");
6
-
7
5
  Object.defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
- exports.default = void 0;
8
+ exports.default = exports.Zoom = void 0;
9
+
10
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
11
 
12
12
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
13
 
@@ -15,19 +15,23 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
15
15
 
16
16
  var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
17
17
 
18
+ var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
19
+
18
20
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
19
21
 
20
22
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
21
23
 
22
24
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
23
25
 
24
- var _l7Utils = require("@antv/l7-utils");
26
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
27
+
28
+ var _l7Core = require("@antv/l7-core");
25
29
 
26
- var _BaseControl = _interopRequireWildcard(require("./BaseControl"));
30
+ var _l7Utils = require("@antv/l7-utils");
27
31
 
28
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
32
+ var _icon = require("../utils/icon");
29
33
 
30
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
34
+ var _baseControl = require("./baseControl");
31
35
 
32
36
  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); }; }
33
37
 
@@ -38,39 +42,73 @@ var Zoom = /*#__PURE__*/function (_Control) {
38
42
 
39
43
  var _super = _createSuper(Zoom);
40
44
 
41
- function Zoom(cfg) {
45
+ function Zoom() {
42
46
  var _this;
43
47
 
44
48
  (0, _classCallCheck2.default)(this, Zoom);
45
- _this = _super.call(this, cfg);
46
- (0, _l7Utils.bindAll)(['updateDisabled', 'zoomIn', 'zoomOut'], (0, _assertThisInitialized2.default)(_this));
49
+
50
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
51
+ args[_key] = arguments[_key];
52
+ }
53
+
54
+ _this = _super.call.apply(_super, [this].concat(args));
55
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "zoomIn", function () {
56
+ if (!_this.disabled && _this.mapsService.getZoom() < _this.mapsService.getMaxZoom()) {
57
+ _this.mapsService.zoomIn();
58
+ }
59
+ });
60
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "zoomOut", function () {
61
+ if (!_this.disabled && _this.mapsService.getZoom() > _this.mapsService.getMinZoom()) {
62
+ _this.mapsService.zoomOut();
63
+ }
64
+ });
65
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "updateDisabled", function () {
66
+ var mapsService = _this.mapsService;
67
+
68
+ _this.zoomInButton.removeAttribute('disabled');
69
+
70
+ _this.zoomOutButton.removeAttribute('disabled');
71
+
72
+ if (_this.disabled || mapsService.getZoom() <= mapsService.getMinZoom()) {
73
+ _this.zoomOutButton.setAttribute('disabled', 'true');
74
+ }
75
+
76
+ if (_this.disabled || mapsService.getZoom() >= mapsService.getMaxZoom()) {
77
+ _this.zoomInButton.setAttribute('disabled', 'true');
78
+ }
79
+ });
47
80
  return _this;
48
81
  }
49
82
 
50
83
  (0, _createClass2.default)(Zoom, [{
51
84
  key: "getDefault",
52
- value: function getDefault() {
53
- return {
54
- position: _BaseControl.PositionType.TOPLEFT,
55
- zoomInText: '+',
85
+ value: function getDefault(option) {
86
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _get2.default)((0, _getPrototypeOf2.default)(Zoom.prototype), "getDefault", this).call(this, option)), {}, {
87
+ position: _l7Core.PositionType.BOTTOMRIGHT,
88
+ name: 'zoom',
89
+ zoomInText: (0, _icon.createL7Icon)('l7-icon-enlarge'),
56
90
  zoomInTitle: 'Zoom in',
57
- zoomOutText: '&#x2212;',
58
- zoomOutTitle: 'Zoom out',
59
- name: 'zoom'
60
- };
91
+ zoomOutText: (0, _icon.createL7Icon)('l7-icon-narrow'),
92
+ zoomOutTitle: 'Zoom out'
93
+ });
94
+ }
95
+ }, {
96
+ key: "setOptions",
97
+ value: function setOptions(newOptions) {
98
+ (0, _get2.default)((0, _getPrototypeOf2.default)(Zoom.prototype), "setOptions", this).call(this, newOptions);
99
+
100
+ if (this.checkUpdateOption(newOptions, ['zoomInText', 'zoomInTitle', 'zoomOutText', 'zoomOutTitle'])) {
101
+ this.resetButtonGroup(this.container);
102
+ }
61
103
  }
62
104
  }, {
63
105
  key: "onAdd",
64
106
  value: function onAdd() {
65
- var zoomName = 'l7-control-zoom';
66
-
67
- var container = _l7Utils.DOM.create('div', zoomName + ' l7-bar');
107
+ var container = _l7Utils.DOM.create('div', 'l7-control-zoom');
68
108
 
69
- this.zoomInButton = this.createButton(this.controlOption.zoomInText, this.controlOption.zoomInTitle, zoomName + '-in', container, this.zoomIn);
70
- this.zoomOutButton = this.createButton(this.controlOption.zoomOutText, this.controlOption.zoomOutTitle, zoomName + '-out', container, this.zoomOut);
109
+ this.resetButtonGroup(container);
71
110
  this.mapsService.on('zoomend', this.updateDisabled);
72
111
  this.mapsService.on('zoomchange', this.updateDisabled);
73
- this.updateDisabled();
74
112
  return container;
75
113
  }
76
114
  }, {
@@ -94,50 +132,31 @@ var Zoom = /*#__PURE__*/function (_Control) {
94
132
  return this;
95
133
  }
96
134
  }, {
97
- key: "zoomIn",
98
- value: function zoomIn() {
99
- if (!this.disabled && this.mapsService.getZoom() < this.mapsService.getMaxZoom()) {
100
- this.mapsService.zoomIn();
101
- }
102
- }
103
- }, {
104
- key: "zoomOut",
105
- value: function zoomOut() {
106
- if (!this.disabled && this.mapsService.getZoom() > this.mapsService.getMinZoom()) {
107
- this.mapsService.zoomOut();
108
- }
135
+ key: "resetButtonGroup",
136
+ value: function resetButtonGroup(container) {
137
+ _l7Utils.DOM.clearChildren(container);
138
+
139
+ this.zoomInButton = this.createButton(this.controlOption.zoomInText, this.controlOption.zoomInTitle, 'l7-button-control', container, this.zoomIn);
140
+ this.zoomOutButton = this.createButton(this.controlOption.zoomOutText, this.controlOption.zoomOutTitle, 'l7-button-control', container, this.zoomOut);
141
+ this.updateDisabled();
109
142
  }
110
143
  }, {
111
144
  key: "createButton",
112
145
  value: function createButton(html, tile, className, container, fn) {
113
- var link = _l7Utils.DOM.create('a', className, container);
146
+ var link = _l7Utils.DOM.create('button', className, container);
147
+
148
+ if (typeof html === 'string') {
149
+ link.innerHTML = html;
150
+ } else {
151
+ link.append(html);
152
+ }
114
153
 
115
- link.innerHTML = html;
116
154
  link.title = tile;
117
- link.href = 'javascript:void(0)';
118
155
  link.addEventListener('click', fn);
119
156
  return link;
120
157
  }
121
- }, {
122
- key: "updateDisabled",
123
- value: function updateDisabled() {
124
- var mapsService = this.mapsService;
125
- var className = 'l7-disabled';
126
-
127
- _l7Utils.DOM.removeClass(this.zoomInButton, className);
128
-
129
- _l7Utils.DOM.removeClass(this.zoomOutButton, className);
130
-
131
- if (this.disabled || mapsService.getZoom() <= mapsService.getMinZoom()) {
132
- _l7Utils.DOM.addClass(this.zoomOutButton, className);
133
- }
134
-
135
- if (this.disabled || mapsService.getZoom() >= mapsService.getMaxZoom()) {
136
- _l7Utils.DOM.addClass(this.zoomInButton, className);
137
- }
138
- }
139
158
  }]);
140
159
  return Zoom;
141
- }(_BaseControl.default);
160
+ }(_baseControl.Control);
142
161
 
143
- exports.default = Zoom;
162
+ exports.default = exports.Zoom = Zoom;
@@ -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
+ }