@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,63 +1,45 @@
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);
1
+ "use strict";
18
2
 
19
- // src/utils/anchor.ts
20
- var anchor_exports = {};
21
- __export(anchor_exports, {
22
- anchorTranslate: () => anchorTranslate,
23
- anchorType: () => anchorType,
24
- applyAnchorClass: () => applyAnchorClass
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
25
5
  });
26
- module.exports = __toCommonJS(anchor_exports);
27
- var anchorType = /* @__PURE__ */ ((anchorType2) => {
28
- anchorType2["CENTER"] = "center";
29
- anchorType2["TOP"] = "top";
30
- anchorType2["TOP-LEFT"] = "top-left";
31
- anchorType2["TOP-RIGHT"] = "top-right";
32
- anchorType2["BOTTOM"] = "bottom";
33
- anchorType2["BOTTOM-LEFT"] = "bottom-left";
34
- anchorType2["LEFT"] = "left";
35
- anchorType2["RIGHT"] = "right";
36
- return anchorType2;
37
- })(anchorType || {});
6
+ exports.anchorType = exports.anchorTranslate = void 0;
7
+ exports.applyAnchorClass = applyAnchorClass;
8
+ var anchorType;
9
+ exports.anchorType = anchorType;
10
+
11
+ (function (anchorType) {
12
+ anchorType["CENTER"] = "center";
13
+ anchorType["TOP"] = "top";
14
+ anchorType["TOP-LEFT"] = "top-left";
15
+ anchorType["TOP-RIGHT"] = "top-right";
16
+ anchorType["BOTTOM"] = "bottom";
17
+ anchorType["BOTTOM-LEFT"] = "bottom-left";
18
+ anchorType["LEFT"] = "left";
19
+ anchorType["RIGHT"] = "right";
20
+ })(anchorType || (exports.anchorType = anchorType = {}));
21
+
38
22
  var anchorTranslate = {
39
- center: "translate(-50%,-50%)",
40
- top: "translate(-50%,0)",
41
- "top-left": "translate(0,0)",
42
- "top-right": "translate(-100%,0)",
43
- bottom: "translate(-50%,-100%)",
44
- "bottom-left": "translate(0,-100%)",
45
- "bottom-right": "translate(-100%,-100%)",
46
- left: "translate(0,-50%)",
47
- right: "translate(-100%,-50%)"
23
+ center: 'translate(-50%,-50%)',
24
+ top: 'translate(-50%,0)',
25
+ 'top-left': 'translate(0,0)',
26
+ 'top-right': 'translate(-100%,0)',
27
+ bottom: 'translate(-50%,-100%)',
28
+ 'bottom-left': 'translate(0,-100%)',
29
+ 'bottom-right': 'translate(-100%,-100%)',
30
+ left: 'translate(0,-50%)',
31
+ right: 'translate(-100%,-50%)'
48
32
  };
33
+ exports.anchorTranslate = anchorTranslate;
34
+
49
35
  function applyAnchorClass(element, anchor, prefix) {
50
- const classList = element.classList;
51
- for (const key in anchorTranslate) {
36
+ var classList = element.classList;
37
+
38
+ for (var key in anchorTranslate) {
52
39
  if (anchorTranslate.hasOwnProperty(key)) {
53
- classList.remove(`l7-${prefix}-anchor-${key}`);
40
+ classList.remove("l7-".concat(prefix, "-anchor-").concat(key));
54
41
  }
55
42
  }
56
- classList.add(`l7-${prefix}-anchor-${anchor}`);
57
- }
58
- // Annotate the CommonJS export names for ESM import in node:
59
- 0 && (module.exports = {
60
- anchorTranslate,
61
- anchorType,
62
- applyAnchorClass
63
- });
43
+
44
+ classList.add("l7-".concat(prefix, "-anchor-").concat(anchor));
45
+ }
package/lib/utils/icon.js CHANGED
@@ -1,37 +1,18 @@
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);
1
+ "use strict";
18
2
 
19
- // src/utils/icon.ts
20
- var icon_exports = {};
21
- __export(icon_exports, {
22
- createL7Icon: () => createL7Icon
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
23
5
  });
24
- module.exports = __toCommonJS(icon_exports);
25
- var createL7Icon = (className) => {
26
- const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
27
- svg.classList.add("l7-iconfont");
28
- svg.setAttribute("aria-hidden", "true");
29
- const use = document.createElementNS("http://www.w3.org/2000/svg", "use");
30
- use.setAttributeNS("http://www.w3.org/1999/xlink", "href", `#${className}`);
6
+ exports.createL7Icon = void 0;
7
+
8
+ var createL7Icon = function createL7Icon(className) {
9
+ var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
10
+ svg.classList.add('l7-iconfont');
11
+ svg.setAttribute('aria-hidden', 'true');
12
+ var use = document.createElementNS('http://www.w3.org/2000/svg', 'use');
13
+ use.setAttributeNS('http://www.w3.org/1999/xlink', 'href', "#".concat(className));
31
14
  svg.appendChild(use);
32
15
  return svg;
33
16
  };
34
- // Annotate the CommonJS export names for ESM import in node:
35
- 0 && (module.exports = {
36
- createL7Icon
37
- });
17
+
18
+ exports.createL7Icon = createL7Icon;
@@ -1,209 +1,297 @@
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/utils/popper.ts
20
- var popper_exports = {};
21
- __export(popper_exports, {
22
- Popper: () => Popper
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
23
7
  });
24
- module.exports = __toCommonJS(popper_exports);
25
- var import_l7_utils = require("@antv/l7-utils");
26
- var import_eventemitter3 = require("eventemitter3");
27
- var _Popper = class extends import_eventemitter3.EventEmitter {
28
- constructor(button, option) {
29
- super();
30
- this.isShow = false;
31
- this.timeout = null;
32
- this.show = () => {
33
- if (this.isShow || !this.contentDOM.innerHTML) {
34
- return this;
8
+ exports.Popper = void 0;
9
+
10
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
+
12
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
+
14
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
+
16
+ var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
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 _eventemitter = require("eventemitter3");
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 Popper = /*#__PURE__*/function (_EventEmitter) {
35
+ (0, _inherits2.default)(Popper, _EventEmitter);
36
+
37
+ var _super = _createSuper(Popper);
38
+
39
+ function Popper(button, option) {
40
+ var _this;
41
+
42
+ (0, _classCallCheck2.default)(this, Popper);
43
+ _this = _super.call(this);
44
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isShow", false);
45
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "timeout", null);
46
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "show", function () {
47
+ if (_this.isShow || !_this.contentDOM.innerHTML) {
48
+ return (0, _assertThisInitialized2.default)(_this);
35
49
  }
36
- this.resetPopperPosition();
37
- import_l7_utils.DOM.removeClass(this.popperDOM, "l7-popper-hide");
38
- this.isShow = true;
39
- if (this.option.unique) {
40
- _Popper.conflictPopperList.forEach((popper) => {
41
- if (popper !== this && popper.isShow) {
50
+
51
+ _this.resetPopperPosition();
52
+
53
+ _l7Utils.DOM.removeClass(_this.popperDOM, 'l7-popper-hide');
54
+
55
+ _this.isShow = true;
56
+
57
+ if (_this.option.unique) {
58
+ // console.log(Popper.conflictPopperList.length);
59
+ Popper.conflictPopperList.forEach(function (popper) {
60
+ if (popper !== (0, _assertThisInitialized2.default)(_this) && popper.isShow) {
42
61
  popper.hide();
43
62
  }
44
63
  });
45
64
  }
46
- this.emit("show");
47
- return this;
48
- };
49
- this.hide = () => {
50
- if (!this.isShow) {
51
- return this;
65
+
66
+ _this.emit('show');
67
+
68
+ return (0, _assertThisInitialized2.default)(_this);
69
+ });
70
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "hide", function () {
71
+ if (!_this.isShow) {
72
+ return (0, _assertThisInitialized2.default)(_this);
52
73
  }
53
- import_l7_utils.DOM.addClass(this.popperDOM, "l7-popper-hide");
54
- this.isShow = false;
55
- this.emit("hide");
56
- return this;
57
- };
58
- this.setHideTimeout = () => {
59
- if (this.timeout) {
74
+
75
+ _l7Utils.DOM.addClass(_this.popperDOM, 'l7-popper-hide');
76
+
77
+ _this.isShow = false;
78
+
79
+ _this.emit('hide');
80
+
81
+ return (0, _assertThisInitialized2.default)(_this);
82
+ });
83
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "setHideTimeout", function () {
84
+ if (_this.timeout) {
60
85
  return;
61
86
  }
62
- this.timeout = window.setTimeout(() => {
63
- if (!this.isShow) {
87
+
88
+ _this.timeout = window.setTimeout(function () {
89
+ if (!_this.isShow) {
64
90
  return;
65
91
  }
66
- this.hide();
67
- this.timeout = null;
92
+
93
+ _this.hide();
94
+
95
+ _this.timeout = null;
68
96
  }, 300);
69
- };
70
- this.clearHideTimeout = () => {
71
- if (this.timeout) {
72
- window.clearTimeout(this.timeout);
73
- this.timeout = null;
97
+ });
98
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "clearHideTimeout", function () {
99
+ if (_this.timeout) {
100
+ window.clearTimeout(_this.timeout);
101
+ _this.timeout = null;
74
102
  }
75
- };
76
- this.onBtnClick = () => {
77
- if (this.isShow) {
78
- this.hide();
103
+ });
104
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onBtnClick", function () {
105
+ if (_this.isShow) {
106
+ _this.hide();
79
107
  } else {
80
- this.show();
108
+ _this.show();
81
109
  }
82
- };
83
- this.onBtnMouseLeave = () => {
84
- this.setHideTimeout();
85
- };
86
- this.onBtnMouseMove = () => {
87
- this.clearHideTimeout();
88
- if (this.isShow) {
110
+ });
111
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onBtnMouseLeave", function () {
112
+ _this.setHideTimeout();
113
+ });
114
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onBtnMouseMove", function () {
115
+ _this.clearHideTimeout();
116
+
117
+ if (_this.isShow) {
89
118
  return;
90
119
  }
91
- this.show();
92
- };
93
- this.button = button;
94
- this.option = option;
95
- this.init();
120
+
121
+ _this.show();
122
+ });
123
+ _this.button = button;
124
+ _this.option = option;
125
+
126
+ _this.init();
127
+
96
128
  if (option.unique) {
97
- _Popper.conflictPopperList.push(this);
129
+ Popper.conflictPopperList.push((0, _assertThisInitialized2.default)(_this));
98
130
  }
131
+
132
+ return _this;
99
133
  }
100
- get buttonRect() {
101
- return this.button.getBoundingClientRect();
102
- }
103
- getPopperDOM() {
104
- return this.popperDOM;
105
- }
106
- getIsShow() {
107
- return this.isShow;
108
- }
109
- getContent() {
110
- return this.content;
111
- }
112
- setContent(content) {
113
- if (typeof content === "string") {
114
- this.contentDOM.innerHTML = content;
115
- } else if (content instanceof HTMLElement) {
116
- import_l7_utils.DOM.clearChildren(this.contentDOM);
117
- this.contentDOM.appendChild(content);
134
+
135
+ (0, _createClass2.default)(Popper, [{
136
+ key: "buttonRect",
137
+ get: function get() {
138
+ return this.button.getBoundingClientRect();
118
139
  }
119
- this.content = content;
120
- }
121
- init() {
122
- const { trigger } = this.option;
123
- this.popperDOM = this.createPopper();
124
- if (trigger === "click") {
125
- this.button.addEventListener("click", this.onBtnClick);
126
- } else {
127
- this.button.addEventListener("mousemove", this.onBtnMouseMove);
128
- this.button.addEventListener("mouseleave", this.onBtnMouseLeave);
129
- this.popperDOM.addEventListener("mousemove", this.onBtnMouseMove);
130
- this.popperDOM.addEventListener("mouseleave", this.onBtnMouseLeave);
140
+ }, {
141
+ key: "getPopperDOM",
142
+ value: function getPopperDOM() {
143
+ return this.popperDOM;
131
144
  }
132
- }
133
- destroy() {
134
- this.button.removeEventListener("click", this.onBtnClick);
135
- this.button.removeEventListener("mousemove", this.onBtnMouseMove);
136
- this.button.removeEventListener("mousemove", this.onBtnMouseLeave);
137
- this.popperDOM.removeEventListener("mousemove", this.onBtnMouseMove);
138
- this.popperDOM.removeEventListener("mouseleave", this.onBtnMouseLeave);
139
- import_l7_utils.DOM.remove(this.popperDOM);
140
- }
141
- resetPopperPosition() {
142
- const popperStyleObj = {};
143
- const { container, offset = [0, 0], placement } = this.option;
144
- const [offsetX, offsetY] = offset;
145
- const buttonRect = this.button.getBoundingClientRect();
146
- const containerRect = container.getBoundingClientRect();
147
- const { left, right, top, bottom } = import_l7_utils.DOM.getDiffRect(buttonRect, containerRect);
148
- let isTransformX = false;
149
- let isTransformY = false;
150
- if (/^(left|right)/.test(placement)) {
151
- if (placement.includes("left")) {
152
- popperStyleObj.right = `${buttonRect.width + right}px`;
153
- } else if (placement.includes("right")) {
154
- popperStyleObj.left = `${buttonRect.width + left}px`;
145
+ }, {
146
+ key: "getIsShow",
147
+ value: function getIsShow() {
148
+ return this.isShow;
149
+ }
150
+ }, {
151
+ key: "getContent",
152
+ value: function getContent() {
153
+ return this.content;
154
+ }
155
+ }, {
156
+ key: "setContent",
157
+ value: function setContent(content) {
158
+ if (typeof content === 'string') {
159
+ this.contentDOM.innerHTML = content;
160
+ } else if (content instanceof HTMLElement) {
161
+ _l7Utils.DOM.clearChildren(this.contentDOM);
162
+
163
+ this.contentDOM.appendChild(content);
155
164
  }
156
- if (placement.includes("start")) {
157
- popperStyleObj.top = `${top}px`;
158
- } else if (placement.includes("end")) {
159
- popperStyleObj.bottom = `${bottom}px`;
165
+
166
+ this.content = content;
167
+ }
168
+ }, {
169
+ key: "init",
170
+ value: function init() {
171
+ var trigger = this.option.trigger;
172
+ this.popperDOM = this.createPopper();
173
+
174
+ if (trigger === 'click') {
175
+ this.button.addEventListener('click', this.onBtnClick);
160
176
  } else {
161
- popperStyleObj.top = `${top + buttonRect.height / 2}px`;
162
- isTransformY = true;
163
- popperStyleObj.transform = `translate(${offsetX}px, calc(${offsetY}px - 50%))`;
177
+ this.button.addEventListener('mousemove', this.onBtnMouseMove);
178
+ this.button.addEventListener('mouseleave', this.onBtnMouseLeave);
179
+ this.popperDOM.addEventListener('mousemove', this.onBtnMouseMove);
180
+ this.popperDOM.addEventListener('mouseleave', this.onBtnMouseLeave);
164
181
  }
165
- } else if (/^(top|bottom)/.test(placement)) {
166
- if (placement.includes("top")) {
167
- popperStyleObj.bottom = `${buttonRect.height + bottom}px`;
168
- } else if (placement.includes("bottom")) {
169
- popperStyleObj.top = `${buttonRect.height + top}px`;
182
+ }
183
+ }, {
184
+ key: "destroy",
185
+ value: function destroy() {
186
+ this.button.removeEventListener('click', this.onBtnClick);
187
+ this.button.removeEventListener('mousemove', this.onBtnMouseMove);
188
+ this.button.removeEventListener('mousemove', this.onBtnMouseLeave);
189
+ this.popperDOM.removeEventListener('mousemove', this.onBtnMouseMove);
190
+ this.popperDOM.removeEventListener('mouseleave', this.onBtnMouseLeave);
191
+
192
+ _l7Utils.DOM.remove(this.popperDOM);
193
+ }
194
+ }, {
195
+ key: "resetPopperPosition",
196
+ value: function resetPopperPosition() {
197
+ var popperStyleObj = {};
198
+ var _this$option = this.option,
199
+ container = _this$option.container,
200
+ _this$option$offset = _this$option.offset,
201
+ offset = _this$option$offset === void 0 ? [0, 0] : _this$option$offset,
202
+ placement = _this$option.placement;
203
+
204
+ var _offset = (0, _slicedToArray2.default)(offset, 2),
205
+ offsetX = _offset[0],
206
+ offsetY = _offset[1];
207
+
208
+ var buttonRect = this.button.getBoundingClientRect();
209
+ var containerRect = container.getBoundingClientRect();
210
+
211
+ var _DOM$getDiffRect = _l7Utils.DOM.getDiffRect(buttonRect, containerRect),
212
+ left = _DOM$getDiffRect.left,
213
+ right = _DOM$getDiffRect.right,
214
+ top = _DOM$getDiffRect.top,
215
+ bottom = _DOM$getDiffRect.bottom;
216
+
217
+ var isTransformX = false;
218
+ var isTransformY = false;
219
+
220
+ if (/^(left|right)/.test(placement)) {
221
+ if (placement.includes('left')) {
222
+ popperStyleObj.right = "".concat(buttonRect.width + right, "px");
223
+ } else if (placement.includes('right')) {
224
+ popperStyleObj.left = "".concat(buttonRect.width + left, "px");
225
+ }
226
+
227
+ if (placement.includes('start')) {
228
+ popperStyleObj.top = "".concat(top, "px");
229
+ } else if (placement.includes('end')) {
230
+ popperStyleObj.bottom = "".concat(bottom, "px");
231
+ } else {
232
+ popperStyleObj.top = "".concat(top + buttonRect.height / 2, "px");
233
+ isTransformY = true;
234
+ popperStyleObj.transform = "translate(".concat(offsetX, "px, calc(").concat(offsetY, "px - 50%))");
235
+ }
236
+ } else if (/^(top|bottom)/.test(placement)) {
237
+ if (placement.includes('top')) {
238
+ popperStyleObj.bottom = "".concat(buttonRect.height + bottom, "px");
239
+ } else if (placement.includes('bottom')) {
240
+ popperStyleObj.top = "".concat(buttonRect.height + top, "px");
241
+ }
242
+
243
+ if (placement.includes('start')) {
244
+ popperStyleObj.left = "".concat(left, "px");
245
+ } else if (placement.includes('end')) {
246
+ popperStyleObj.right = "".concat(right, "px");
247
+ } else {
248
+ popperStyleObj.left = "".concat(left + buttonRect.width / 2, "px");
249
+ isTransformX = true;
250
+ popperStyleObj.transform = "translate(calc(".concat(offsetX, "px - 50%), ").concat(offsetY, "px)");
251
+ }
170
252
  }
171
- if (placement.includes("start")) {
172
- popperStyleObj.left = `${left}px`;
173
- } else if (placement.includes("end")) {
174
- popperStyleObj.right = `${right}px`;
175
- } else {
176
- popperStyleObj.left = `${left + buttonRect.width / 2}px`;
177
- isTransformX = true;
178
- popperStyleObj.transform = `translate(calc(${offsetX}px - 50%), ${offsetY}px)`;
253
+
254
+ popperStyleObj.transform = "translate(calc(".concat(offsetX, "px - ").concat(isTransformX ? '50%' : '0%', "), calc(").concat(offsetY, "px - ").concat(isTransformY ? '50%' : '0%', ")");
255
+ var posList = placement.split('-');
256
+
257
+ if (posList.length) {
258
+ _l7Utils.DOM.addClass(this.popperDOM, posList.map(function (pos) {
259
+ return "l7-popper-".concat(pos);
260
+ }).join(' '));
179
261
  }
262
+
263
+ _l7Utils.DOM.addStyle(this.popperDOM, _l7Utils.DOM.css2Style(popperStyleObj));
180
264
  }
181
- popperStyleObj.transform = `translate(calc(${offsetX}px - ${isTransformX ? "50%" : "0%"}), calc(${offsetY}px - ${isTransformY ? "50%" : "0%"})`;
182
- const posList = placement.split("-");
183
- if (posList.length) {
184
- import_l7_utils.DOM.addClass(this.popperDOM, posList.map((pos) => `l7-popper-${pos}`).join(" "));
185
- }
186
- import_l7_utils.DOM.addStyle(this.popperDOM, import_l7_utils.DOM.css2Style(popperStyleObj));
187
- }
188
- createPopper() {
189
- const { container, className = "", content } = this.option;
190
- const popper = import_l7_utils.DOM.create("div", `l7-popper l7-popper-hide ${className}`);
191
- const popperContent = import_l7_utils.DOM.create("div", "l7-popper-content");
192
- const popperArrow = import_l7_utils.DOM.create("div", "l7-popper-arrow");
193
- popper.appendChild(popperContent);
194
- popper.appendChild(popperArrow);
195
- container.appendChild(popper);
196
- this.popperDOM = popper;
197
- this.contentDOM = popperContent;
198
- if (content) {
199
- this.setContent(content);
265
+ }, {
266
+ key: "createPopper",
267
+ value: function createPopper() {
268
+ var _this$option2 = this.option,
269
+ container = _this$option2.container,
270
+ _this$option2$classNa = _this$option2.className,
271
+ className = _this$option2$classNa === void 0 ? '' : _this$option2$classNa,
272
+ content = _this$option2.content;
273
+
274
+ var popper = _l7Utils.DOM.create('div', "l7-popper l7-popper-hide ".concat(className));
275
+
276
+ var popperContent = _l7Utils.DOM.create('div', 'l7-popper-content');
277
+
278
+ var popperArrow = _l7Utils.DOM.create('div', 'l7-popper-arrow');
279
+
280
+ popper.appendChild(popperContent);
281
+ popper.appendChild(popperArrow);
282
+ container.appendChild(popper);
283
+ this.popperDOM = popper;
284
+ this.contentDOM = popperContent;
285
+
286
+ if (content) {
287
+ this.setContent(content);
288
+ }
289
+
290
+ return popper;
200
291
  }
201
- return popper;
202
- }
203
- };
204
- var Popper = _Popper;
205
- Popper.conflictPopperList = [];
206
- // Annotate the CommonJS export names for ESM import in node:
207
- 0 && (module.exports = {
208
- Popper
209
- });
292
+ }]);
293
+ return Popper;
294
+ }(_eventemitter.EventEmitter);
295
+
296
+ exports.Popper = Popper;
297
+ (0, _defineProperty2.default)(Popper, "conflictPopperList", []);