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

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 (34) hide show
  1. package/es/control/baseControl/buttonControl.d.ts +1 -1
  2. package/es/control/baseControl/control.d.ts +4 -5
  3. package/es/control/baseControl/control.js +18 -5
  4. package/es/control/baseControl/popperControl.d.ts +1 -1
  5. package/es/control/baseControl/selectControl.d.ts +2 -2
  6. package/es/control/baseControl/selectControl.js +5 -0
  7. package/es/control/zoom.d.ts +3 -2
  8. package/lib/assets/iconfont/iconfont.js +46 -30
  9. package/lib/constants/index.js +34 -56
  10. package/lib/control/baseControl/buttonControl.js +194 -105
  11. package/lib/control/baseControl/control.js +317 -156
  12. package/lib/control/baseControl/index.js +57 -22
  13. package/lib/control/baseControl/popperControl.js +136 -102
  14. package/lib/control/baseControl/selectControl.js +230 -130
  15. package/lib/control/exportImage.js +175 -81
  16. package/lib/control/fullscreen.js +157 -102
  17. package/lib/control/geoLocate.js +143 -67
  18. package/lib/control/layerControl.js +162 -116
  19. package/lib/control/logo.js +101 -70
  20. package/lib/control/mapTheme.js +144 -85
  21. package/lib/control/mouseLocation.js +112 -71
  22. package/lib/control/scale.js +180 -127
  23. package/lib/control/zoom.js +154 -111
  24. package/lib/index.js +251 -48
  25. package/lib/interface.js +4 -16
  26. package/lib/marker-layer.js +367 -249
  27. package/lib/marker.js +419 -277
  28. package/lib/popup/layerPopup.js +305 -188
  29. package/lib/popup/popup.js +602 -339
  30. package/lib/utils/anchor.js +37 -55
  31. package/lib/utils/icon.js +13 -32
  32. package/lib/utils/popper.js +268 -180
  33. package/lib/utils/screenfull.js +110 -103
  34. package/package.json +5 -5
@@ -1,118 +1,207 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
-
22
- // src/control/baseControl/buttonControl.ts
23
- var buttonControl_exports = {};
24
- __export(buttonControl_exports, {
25
- ButtonControl: () => ButtonControl,
26
- default: () => ButtonControl
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
27
7
  });
28
- module.exports = __toCommonJS(buttonControl_exports);
29
- var import_l7_utils = require("@antv/l7-utils");
30
- var import_control = __toESM(require("./control"));
31
- var ButtonControl = class extends import_control.default {
32
- constructor() {
33
- super(...arguments);
34
- this.isDisable = false;
35
- }
36
- setIsDisable(newIsDisable) {
37
- var _a, _b;
38
- this.isDisable = newIsDisable;
39
- if (newIsDisable) {
40
- (_a = this.button) == null ? void 0 : _a.setAttribute("disabled", "true");
41
- } else {
42
- (_b = this.button) == null ? void 0 : _b.removeAttribute("disabled");
8
+ exports.default = exports.ButtonControl = void 0;
9
+
10
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
+
12
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
+
14
+ var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
15
+
16
+ var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
17
+
18
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
19
+
20
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
21
+
22
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
23
+
24
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
25
+
26
+ var _l7Utils = require("@antv/l7-utils");
27
+
28
+ var _control = _interopRequireDefault(require("./control"));
29
+
30
+ 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); }; }
31
+
32
+ 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; } }
33
+
34
+ var ButtonControl = /*#__PURE__*/function (_Control) {
35
+ (0, _inherits2.default)(ButtonControl, _Control);
36
+
37
+ var _super = _createSuper(ButtonControl);
38
+
39
+ function ButtonControl() {
40
+ var _this;
41
+
42
+ (0, _classCallCheck2.default)(this, ButtonControl);
43
+
44
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
45
+ args[_key] = arguments[_key];
43
46
  }
47
+
48
+ _this = _super.call.apply(_super, [this].concat(args));
49
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isDisable", false);
50
+ return _this;
44
51
  }
45
- createButton(className = "") {
46
- return import_l7_utils.DOM.create("button", `l7-button-control ${className}`);
47
- }
48
- onAdd() {
49
- this.button = this.createButton();
50
- this.isDisable = false;
51
- const { title, btnText, btnIcon } = this.controlOption;
52
- this.setBtnTitle(title);
53
- this.setBtnText(btnText);
54
- this.setBtnIcon(btnIcon);
55
- return this.button;
56
- }
57
- onRemove() {
58
- this.button = this.buttonIcon = this.buttonText = void 0;
59
- this.isDisable = false;
60
- }
61
- setOptions(newOptions) {
62
- const { title, btnText, btnIcon } = newOptions;
63
- if (this.checkUpdateOption(newOptions, ["title"])) {
64
- this.setBtnTitle(title);
52
+
53
+ (0, _createClass2.default)(ButtonControl, [{
54
+ key: "setIsDisable",
55
+ value:
56
+ /**
57
+ * 设置当前按钮
58
+ * @param newIsDisable
59
+ */
60
+ function setIsDisable(newIsDisable) {
61
+ this.isDisable = newIsDisable;
62
+
63
+ if (newIsDisable) {
64
+ var _this$button;
65
+
66
+ (_this$button = this.button) === null || _this$button === void 0 ? void 0 : _this$button.setAttribute('disabled', 'true');
67
+ } else {
68
+ var _this$button2;
69
+
70
+ (_this$button2 = this.button) === null || _this$button2 === void 0 ? void 0 : _this$button2.removeAttribute('disabled');
71
+ }
65
72
  }
66
- if (this.checkUpdateOption(newOptions, ["btnIcon"])) {
67
- this.setBtnIcon(btnIcon);
73
+ }, {
74
+ key: "createButton",
75
+ value: function createButton() {
76
+ var className = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
77
+ return _l7Utils.DOM.create('button', "l7-button-control ".concat(className));
68
78
  }
69
- if (this.checkUpdateOption(newOptions, ["btnText"])) {
79
+ }, {
80
+ key: "onAdd",
81
+ value: function onAdd() {
82
+ this.button = this.createButton();
83
+ this.isDisable = false;
84
+ var _this$controlOption = this.controlOption,
85
+ title = _this$controlOption.title,
86
+ btnText = _this$controlOption.btnText,
87
+ btnIcon = _this$controlOption.btnIcon;
88
+ this.setBtnTitle(title);
70
89
  this.setBtnText(btnText);
90
+ this.setBtnIcon(btnIcon);
91
+ return this.button;
71
92
  }
72
- super.setOptions(newOptions);
73
- }
74
- setBtnTitle(title) {
75
- var _a;
76
- (_a = this.button) == null ? void 0 : _a.setAttribute("title", title ?? "");
77
- }
78
- setBtnIcon(newIcon) {
79
- var _a, _b, _c;
80
- if (this.buttonIcon) {
81
- import_l7_utils.DOM.remove(this.buttonIcon);
93
+ }, {
94
+ key: "onRemove",
95
+ value: function onRemove() {
96
+ this.button = this.buttonIcon = this.buttonText = undefined;
97
+ this.isDisable = false;
82
98
  }
83
- if (newIcon) {
84
- const firstChild = (_a = this.button) == null ? void 0 : _a.firstChild;
85
- if (firstChild) {
86
- (_b = this.button) == null ? void 0 : _b.insertBefore(newIcon, firstChild);
87
- } else {
88
- (_c = this.button) == null ? void 0 : _c.appendChild(newIcon);
99
+ /**
100
+ * 更新配置方法
101
+ * @param newOptions
102
+ */
103
+
104
+ }, {
105
+ key: "setOptions",
106
+ value: function setOptions(newOptions) {
107
+ var title = newOptions.title,
108
+ btnText = newOptions.btnText,
109
+ btnIcon = newOptions.btnIcon;
110
+
111
+ if (this.checkUpdateOption(newOptions, ['title'])) {
112
+ this.setBtnTitle(title);
89
113
  }
90
- this.buttonIcon = newIcon;
114
+
115
+ if (this.checkUpdateOption(newOptions, ['btnIcon'])) {
116
+ this.setBtnIcon(btnIcon);
117
+ }
118
+
119
+ if (this.checkUpdateOption(newOptions, ['btnText'])) {
120
+ this.setBtnText(btnText);
121
+ }
122
+
123
+ (0, _get2.default)((0, _getPrototypeOf2.default)(ButtonControl.prototype), "setOptions", this).call(this, newOptions);
91
124
  }
92
- }
93
- setBtnText(newText) {
94
- var _a;
95
- if (!this.button) {
96
- return;
125
+ /**
126
+ * 设置按钮 title
127
+ * @param title
128
+ */
129
+
130
+ }, {
131
+ key: "setBtnTitle",
132
+ value: function setBtnTitle(title) {
133
+ var _this$button3;
134
+
135
+ (_this$button3 = this.button) === null || _this$button3 === void 0 ? void 0 : _this$button3.setAttribute('title', title !== null && title !== void 0 ? title : '');
97
136
  }
98
- import_l7_utils.DOM.removeClass(this.button, "l7-button-control--row");
99
- import_l7_utils.DOM.removeClass(this.button, "l7-button-control--column");
100
- if (newText) {
101
- let btnText = this.buttonText;
102
- if (!btnText) {
103
- btnText = import_l7_utils.DOM.create("div", "l7-button-control__text");
104
- (_a = this.button) == null ? void 0 : _a.appendChild(btnText);
105
- this.buttonText = btnText;
137
+ /**
138
+ * 设置按钮 Icon
139
+ * @param newIcon
140
+ */
141
+
142
+ }, {
143
+ key: "setBtnIcon",
144
+ value: function setBtnIcon(newIcon) {
145
+ if (this.buttonIcon) {
146
+ _l7Utils.DOM.remove(this.buttonIcon);
147
+ }
148
+
149
+ if (newIcon) {
150
+ var _this$button4;
151
+
152
+ var firstChild = (_this$button4 = this.button) === null || _this$button4 === void 0 ? void 0 : _this$button4.firstChild;
153
+
154
+ if (firstChild) {
155
+ var _this$button5;
156
+
157
+ (_this$button5 = this.button) === null || _this$button5 === void 0 ? void 0 : _this$button5.insertBefore(newIcon, firstChild);
158
+ } else {
159
+ var _this$button6;
160
+
161
+ (_this$button6 = this.button) === null || _this$button6 === void 0 ? void 0 : _this$button6.appendChild(newIcon);
162
+ }
163
+
164
+ this.buttonIcon = newIcon;
106
165
  }
107
- btnText.innerText = newText;
108
- import_l7_utils.DOM.addClass(this.button, this.controlOption.vertical ? "l7-button-control--column" : "l7-button-control--row");
109
- } else if (!newText && this.buttonText) {
110
- import_l7_utils.DOM.remove(this.buttonText);
111
- this.buttonText = void 0;
112
166
  }
113
- }
114
- };
115
- // Annotate the CommonJS export names for ESM import in node:
116
- 0 && (module.exports = {
117
- ButtonControl
118
- });
167
+ /**
168
+ * 设置按钮文本
169
+ * @param newText
170
+ */
171
+
172
+ }, {
173
+ key: "setBtnText",
174
+ value: function setBtnText(newText) {
175
+ if (!this.button) {
176
+ return;
177
+ }
178
+
179
+ _l7Utils.DOM.removeClass(this.button, 'l7-button-control--row');
180
+
181
+ _l7Utils.DOM.removeClass(this.button, 'l7-button-control--column');
182
+
183
+ if (newText) {
184
+ var btnText = this.buttonText;
185
+
186
+ if (!btnText) {
187
+ var _this$button7;
188
+
189
+ btnText = _l7Utils.DOM.create('div', 'l7-button-control__text');
190
+ (_this$button7 = this.button) === null || _this$button7 === void 0 ? void 0 : _this$button7.appendChild(btnText);
191
+ this.buttonText = btnText;
192
+ }
193
+
194
+ btnText.innerText = newText;
195
+
196
+ _l7Utils.DOM.addClass(this.button, this.controlOption.vertical ? 'l7-button-control--column' : 'l7-button-control--row');
197
+ } else if (!newText && this.buttonText) {
198
+ _l7Utils.DOM.remove(this.buttonText);
199
+
200
+ this.buttonText = undefined;
201
+ }
202
+ }
203
+ }]);
204
+ return ButtonControl;
205
+ }(_control.default);
206
+
207
+ exports.default = exports.ButtonControl = ButtonControl;