@antv/l7-component 2.21.8 → 2.21.9

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.
@@ -99,7 +99,7 @@ export default class LayerPopup extends Popup {
99
99
  return this;
100
100
  }
101
101
  getDefault(option) {
102
- const isHoverTrigger = option.trigger === 'hover';
102
+ const isHoverTrigger = option.trigger !== 'click';
103
103
  return _objectSpread(_objectSpread({}, super.getDefault(option)), {}, {
104
104
  trigger: 'hover',
105
105
  followCursor: isHoverTrigger,
package/es/popup/popup.js CHANGED
@@ -251,8 +251,11 @@ export default class Popup extends EventEmitter {
251
251
  }
252
252
  setOptions(option) {
253
253
  this.show();
254
+ const {
255
+ className: oldClassName
256
+ } = this.popupOption;
254
257
  this.popupOption = _objectSpread(_objectSpread({}, this.popupOption), option);
255
- if (this.checkUpdateOption(option, ['html', 'text', 'title', 'closeButton', 'closeButtonOffsets', 'maxWidth', 'anchor', 'stopPropagation', 'className', 'style', 'lngLat', 'offsets'])) {
258
+ if (this.checkUpdateOption(option, ['html', 'text', 'title', 'closeButton', 'closeButtonOffsets', 'maxWidth', 'anchor', 'stopPropagation', 'lngLat', 'offsets'])) {
256
259
  if (this.container) {
257
260
  DOM.remove(this.container);
258
261
  // @ts-ignore
@@ -281,6 +284,17 @@ export default class Popup extends EventEmitter {
281
284
  } else if (this.checkUpdateOption(option, ['text']) && option.text) {
282
285
  this.setText(option.text);
283
286
  }
287
+ if (this.checkUpdateOption(option, ['className'])) {
288
+ var _option$className;
289
+ if (oldClassName) {
290
+ this.container.classList.remove(oldClassName !== null && oldClassName !== void 0 ? oldClassName : '');
291
+ }
292
+ this.container.classList.add((_option$className = option.className) !== null && _option$className !== void 0 ? _option$className : '');
293
+ }
294
+ if (this.checkUpdateOption(option, ['style'])) {
295
+ var _option$style;
296
+ DOM.addStyle(this.container, (_option$style = option.style) !== null && _option$style !== void 0 ? _option$style : '');
297
+ }
284
298
  if (this.checkUpdateOption(option, ['lngLat']) && option.lngLat) {
285
299
  this.setLnglat(option.lngLat);
286
300
  }
@@ -105,7 +105,7 @@ class LayerPopup extends _popup.default {
105
105
  return this;
106
106
  }
107
107
  getDefault(option) {
108
- const isHoverTrigger = option.trigger === 'hover';
108
+ const isHoverTrigger = option.trigger !== 'click';
109
109
  return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, super.getDefault(option)), {}, {
110
110
  trigger: 'hover',
111
111
  followCursor: isHoverTrigger,
@@ -257,8 +257,11 @@ class Popup extends _eventemitter.EventEmitter {
257
257
  }
258
258
  setOptions(option) {
259
259
  this.show();
260
+ const {
261
+ className: oldClassName
262
+ } = this.popupOption;
260
263
  this.popupOption = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, this.popupOption), option);
261
- if (this.checkUpdateOption(option, ['html', 'text', 'title', 'closeButton', 'closeButtonOffsets', 'maxWidth', 'anchor', 'stopPropagation', 'className', 'style', 'lngLat', 'offsets'])) {
264
+ if (this.checkUpdateOption(option, ['html', 'text', 'title', 'closeButton', 'closeButtonOffsets', 'maxWidth', 'anchor', 'stopPropagation', 'lngLat', 'offsets'])) {
262
265
  if (this.container) {
263
266
  _l7Utils.DOM.remove(this.container);
264
267
  // @ts-ignore
@@ -287,6 +290,17 @@ class Popup extends _eventemitter.EventEmitter {
287
290
  } else if (this.checkUpdateOption(option, ['text']) && option.text) {
288
291
  this.setText(option.text);
289
292
  }
293
+ if (this.checkUpdateOption(option, ['className'])) {
294
+ var _option$className;
295
+ if (oldClassName) {
296
+ this.container.classList.remove(oldClassName !== null && oldClassName !== void 0 ? oldClassName : '');
297
+ }
298
+ this.container.classList.add((_option$className = option.className) !== null && _option$className !== void 0 ? _option$className : '');
299
+ }
300
+ if (this.checkUpdateOption(option, ['style'])) {
301
+ var _option$style;
302
+ _l7Utils.DOM.addStyle(this.container, (_option$style = option.style) !== null && _option$style !== void 0 ? _option$style : '');
303
+ }
290
304
  if (this.checkUpdateOption(option, ['lngLat']) && option.lngLat) {
291
305
  this.setLnglat(option.lngLat);
292
306
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/l7-component",
3
- "version": "2.21.8",
3
+ "version": "2.21.9",
4
4
  "description": "Component for L7",
5
5
  "license": "MIT",
6
6
  "author": "https://github.com/orgs/antvis/people",
@@ -16,13 +16,13 @@
16
16
  "@babel/runtime": "^7.7.7",
17
17
  "eventemitter3": "^4.0.0",
18
18
  "supercluster": "^7.0.0",
19
- "@antv/l7-core": "2.21.8",
20
- "@antv/l7-layers": "2.21.8",
21
- "@antv/l7-utils": "2.21.8"
19
+ "@antv/l7-core": "2.21.9",
20
+ "@antv/l7-layers": "2.21.9",
21
+ "@antv/l7-utils": "2.21.9"
22
22
  },
23
23
  "devDependencies": {
24
24
  "less": "^4.1.3",
25
- "@antv/l7-test-utils": "^2.21.8"
25
+ "@antv/l7-test-utils": "^2.21.9"
26
26
  },
27
27
  "publishConfig": {
28
28
  "access": "public",