@antv/l7-component 2.20.10 → 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;
|
|
@@ -139,24 +139,39 @@ 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
|
+
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;
|
|
167
|
+
if (this.controlOption.multiple === false) {
|
|
168
|
+
this.handleSingleSelectionMode();
|
|
169
|
+
}
|
|
154
170
|
if (!((_this$controlOption$o = this.controlOption.options) !== null && _this$controlOption$o !== void 0 && _this$controlOption$o.length)) {
|
|
155
171
|
this.controlOption.options = this.getLayerOptions();
|
|
156
172
|
}
|
|
157
173
|
if (!this.controlOption.defaultValue) {
|
|
158
|
-
|
|
159
|
-
this.controlOption.defaultValue = defaultVal;
|
|
174
|
+
this.controlOption.defaultValue = this.getLayerVisible();
|
|
160
175
|
}
|
|
161
176
|
this.on('selectChange', this.onSelectChange);
|
|
162
177
|
this.layerService.on('layerChange', this.onLayerChange);
|
|
@@ -145,24 +145,39 @@ 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
|
+
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;
|
|
173
|
+
if (this.controlOption.multiple === false) {
|
|
174
|
+
this.handleSingleSelectionMode();
|
|
175
|
+
}
|
|
160
176
|
if (!((_this$controlOption$o = this.controlOption.options) !== null && _this$controlOption$o !== void 0 && _this$controlOption$o.length)) {
|
|
161
177
|
this.controlOption.options = this.getLayerOptions();
|
|
162
178
|
}
|
|
163
179
|
if (!this.controlOption.defaultValue) {
|
|
164
|
-
|
|
165
|
-
this.controlOption.defaultValue = defaultVal;
|
|
180
|
+
this.controlOption.defaultValue = this.getLayerVisible();
|
|
166
181
|
}
|
|
167
182
|
this.on('selectChange', this.onSelectChange);
|
|
168
183
|
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.
|
|
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.
|
|
30
|
-
"@antv/l7-utils": "2.20.
|
|
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.
|
|
39
|
-
"@antv/l7-test-utils": "2.20.
|
|
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": "
|
|
43
|
+
"gitHead": "82fdda60dd4255ce14405f0a780f235a71d7e0b1",
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"access": "public"
|
|
46
46
|
}
|