@antv/l7-component 2.20.11 → 2.20.12

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.
@@ -17,6 +17,7 @@ export default class LayerSwitch extends SelectControl<ILayerSwitchOption> {
17
17
  getLayerVisible(): string[];
18
18
  getLayerOptions(): ControlOptionItem[];
19
19
  setOptions(option: Partial<ILayerSwitchOption>): void;
20
+ private handleSingleSelectionMode;
20
21
  onAdd(): HTMLElement;
21
22
  onRemove(): void;
22
23
  protected onLayerChange: () => void;
@@ -142,21 +142,30 @@ var LayerSwitch = /*#__PURE__*/function (_SelectControl) {
142
142
  var isLayerChange = this.checkUpdateOption(option, ['layers', 'multiple']);
143
143
  _get(_getPrototypeOf(LayerSwitch.prototype), "setOptions", this).call(this, option);
144
144
  if (isLayerChange) {
145
+ if (this.controlOption.multiple === false) {
146
+ this.handleSingleSelectionMode();
147
+ }
145
148
  this.selectValue = this.getLayerVisible();
146
149
  this.controlOption.options = this.getLayerOptions();
147
150
  this.popper.setContent(this.getPopperContent(this.controlOption.options));
148
151
  }
149
152
  }
153
+
154
+ // TODO: 单选模式下,目前默认展示第一项,通过用户提供defaultValue展示默认选项的属性待开发
155
+ // 如果是单选模式,则只显示第一个图层
156
+ }, {
157
+ key: "handleSingleSelectionMode",
158
+ value: function handleSingleSelectionMode() {
159
+ this.layers.forEach(function (layer, index) {
160
+ index === 0 ? layer.show() : layer.hide();
161
+ });
162
+ }
150
163
  }, {
151
164
  key: "onAdd",
152
165
  value: function onAdd() {
153
166
  var _this$controlOption$o;
154
- // TODO: 单选模式下,目前默认展示第一项,通过用户提供defaultValue展示默认选项的属性待开发
155
- // 如果是单选模式,则只显示第一个图层
156
167
  if (this.controlOption.multiple === false) {
157
- this.layers.forEach(function (layer, index) {
158
- index === 0 ? layer.show() : layer.hide();
159
- });
168
+ this.handleSingleSelectionMode();
160
169
  }
161
170
  if (!((_this$controlOption$o = this.controlOption.options) !== null && _this$controlOption$o !== void 0 && _this$controlOption$o.length)) {
162
171
  this.controlOption.options = this.getLayerOptions();
@@ -148,21 +148,30 @@ var LayerSwitch = exports.default = exports.LayerSwitch = /*#__PURE__*/function
148
148
  var isLayerChange = this.checkUpdateOption(option, ['layers', 'multiple']);
149
149
  (0, _get2.default)((0, _getPrototypeOf2.default)(LayerSwitch.prototype), "setOptions", this).call(this, option);
150
150
  if (isLayerChange) {
151
+ if (this.controlOption.multiple === false) {
152
+ this.handleSingleSelectionMode();
153
+ }
151
154
  this.selectValue = this.getLayerVisible();
152
155
  this.controlOption.options = this.getLayerOptions();
153
156
  this.popper.setContent(this.getPopperContent(this.controlOption.options));
154
157
  }
155
158
  }
159
+
160
+ // TODO: 单选模式下,目前默认展示第一项,通过用户提供defaultValue展示默认选项的属性待开发
161
+ // 如果是单选模式,则只显示第一个图层
162
+ }, {
163
+ key: "handleSingleSelectionMode",
164
+ value: function handleSingleSelectionMode() {
165
+ this.layers.forEach(function (layer, index) {
166
+ index === 0 ? layer.show() : layer.hide();
167
+ });
168
+ }
156
169
  }, {
157
170
  key: "onAdd",
158
171
  value: function onAdd() {
159
172
  var _this$controlOption$o;
160
- // TODO: 单选模式下,目前默认展示第一项,通过用户提供defaultValue展示默认选项的属性待开发
161
- // 如果是单选模式,则只显示第一个图层
162
173
  if (this.controlOption.multiple === false) {
163
- this.layers.forEach(function (layer, index) {
164
- index === 0 ? layer.show() : layer.hide();
165
- });
174
+ this.handleSingleSelectionMode();
166
175
  }
167
176
  if (!((_this$controlOption$o = this.controlOption.options) !== null && _this$controlOption$o !== void 0 && _this$controlOption$o.length)) {
168
177
  this.controlOption.options = this.getLayerOptions();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/l7-component",
3
- "version": "2.20.11",
3
+ "version": "2.20.12",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -26,8 +26,8 @@
26
26
  "author": "lzxue",
27
27
  "license": "ISC",
28
28
  "dependencies": {
29
- "@antv/l7-core": "2.20.11",
30
- "@antv/l7-utils": "2.20.11",
29
+ "@antv/l7-core": "2.20.12",
30
+ "@antv/l7-utils": "2.20.12",
31
31
  "@babel/runtime": "^7.7.7",
32
32
  "eventemitter3": "^4.0.0",
33
33
  "inversify": "^5.0.1",
@@ -35,12 +35,12 @@
35
35
  "supercluster": "^7.0.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@antv/l7-layers": "2.20.11",
39
- "@antv/l7-test-utils": "2.20.11",
38
+ "@antv/l7-layers": "2.20.12",
39
+ "@antv/l7-test-utils": "2.20.12",
40
40
  "gcoord": "^0.3.2",
41
41
  "less": "^4.1.3"
42
42
  },
43
- "gitHead": "40b9c778934bbcef548f1060bddf6de988b75c00",
43
+ "gitHead": "82fdda60dd4255ce14405f0a780f235a71d7e0b1",
44
44
  "publishConfig": {
45
45
  "access": "public"
46
46
  }