@antv/l7-component 2.20.10 → 2.20.11

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.
@@ -139,7 +139,7 @@ var LayerSwitch = /*#__PURE__*/function (_SelectControl) {
139
139
  }, {
140
140
  key: "setOptions",
141
141
  value: function setOptions(option) {
142
- var isLayerChange = this.checkUpdateOption(option, ['layers']);
142
+ var isLayerChange = this.checkUpdateOption(option, ['layers', 'multiple']);
143
143
  _get(_getPrototypeOf(LayerSwitch.prototype), "setOptions", this).call(this, option);
144
144
  if (isLayerChange) {
145
145
  this.selectValue = this.getLayerVisible();
@@ -151,12 +151,18 @@ var LayerSwitch = /*#__PURE__*/function (_SelectControl) {
151
151
  key: "onAdd",
152
152
  value: function onAdd() {
153
153
  var _this$controlOption$o;
154
+ // TODO: 单选模式下,目前默认展示第一项,通过用户提供defaultValue展示默认选项的属性待开发
155
+ // 如果是单选模式,则只显示第一个图层
156
+ if (this.controlOption.multiple === false) {
157
+ this.layers.forEach(function (layer, index) {
158
+ index === 0 ? layer.show() : layer.hide();
159
+ });
160
+ }
154
161
  if (!((_this$controlOption$o = this.controlOption.options) !== null && _this$controlOption$o !== void 0 && _this$controlOption$o.length)) {
155
162
  this.controlOption.options = this.getLayerOptions();
156
163
  }
157
164
  if (!this.controlOption.defaultValue) {
158
- var defaultVal = this.controlOption.multiple ? this.getLayerVisible() : this.getLayerVisible()[0];
159
- this.controlOption.defaultValue = defaultVal;
165
+ this.controlOption.defaultValue = this.getLayerVisible();
160
166
  }
161
167
  this.on('selectChange', this.onSelectChange);
162
168
  this.layerService.on('layerChange', this.onLayerChange);
@@ -145,7 +145,7 @@ var LayerSwitch = exports.default = exports.LayerSwitch = /*#__PURE__*/function
145
145
  }, {
146
146
  key: "setOptions",
147
147
  value: function setOptions(option) {
148
- var isLayerChange = this.checkUpdateOption(option, ['layers']);
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
151
  this.selectValue = this.getLayerVisible();
@@ -157,12 +157,18 @@ var LayerSwitch = exports.default = exports.LayerSwitch = /*#__PURE__*/function
157
157
  key: "onAdd",
158
158
  value: function onAdd() {
159
159
  var _this$controlOption$o;
160
+ // TODO: 单选模式下,目前默认展示第一项,通过用户提供defaultValue展示默认选项的属性待开发
161
+ // 如果是单选模式,则只显示第一个图层
162
+ if (this.controlOption.multiple === false) {
163
+ this.layers.forEach(function (layer, index) {
164
+ index === 0 ? layer.show() : layer.hide();
165
+ });
166
+ }
160
167
  if (!((_this$controlOption$o = this.controlOption.options) !== null && _this$controlOption$o !== void 0 && _this$controlOption$o.length)) {
161
168
  this.controlOption.options = this.getLayerOptions();
162
169
  }
163
170
  if (!this.controlOption.defaultValue) {
164
- var defaultVal = this.controlOption.multiple ? this.getLayerVisible() : this.getLayerVisible()[0];
165
- this.controlOption.defaultValue = defaultVal;
171
+ this.controlOption.defaultValue = this.getLayerVisible();
166
172
  }
167
173
  this.on('selectChange', this.onSelectChange);
168
174
  this.layerService.on('layerChange', this.onLayerChange);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/l7-component",
3
- "version": "2.20.10",
3
+ "version": "2.20.11",
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.10",
30
- "@antv/l7-utils": "2.20.10",
29
+ "@antv/l7-core": "2.20.11",
30
+ "@antv/l7-utils": "2.20.11",
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.10",
39
- "@antv/l7-test-utils": "2.20.10",
38
+ "@antv/l7-layers": "2.20.11",
39
+ "@antv/l7-test-utils": "2.20.11",
40
40
  "gcoord": "^0.3.2",
41
41
  "less": "^4.1.3"
42
42
  },
43
- "gitHead": "228c2056e3c5a7ffb334158dff12c79d55ed4ed7",
43
+ "gitHead": "40b9c778934bbcef548f1060bddf6de988b75c00",
44
44
  "publishConfig": {
45
45
  "access": "public"
46
46
  }