Skip to content

Commit

Permalink
fix(vuetify): correction for set empty BasemapSelect text
Browse files Browse the repository at this point in the history
  • Loading branch information
rendrom committed Jun 2, 2020
1 parent fced84c commit 445c6a5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
Expand Up @@ -30,7 +30,8 @@ export class TileAdapter extends BaseAdapter<TileAdapterOptions, Layer> {

showLayer(layer: ImageryLayer) {
layer.show = true;
this.map.imageryLayers.add(layer, this.options.order);
const order = this.options.order ? this.options.order * 1000 : undefined;
this.map.imageryLayers.add(layer, order);
super.showLayer();
}

Expand Down
Expand Up @@ -16,15 +16,17 @@ export interface VueSelectItem {
text: string;
}

const emptyValue = '___empty_value___';

@Component
export class BaseLayersSelect extends Vue {
export class BasemapSelect extends Vue {
@Prop({ type: WebMap }) webMap!: WebMap;
@Prop({ type: Boolean, default: true }) allowEmpty!: boolean;
@Prop({ type: String, default: '---' }) emptyLayerText!: string;

items: VueSelectItem[] = [];

active: string | false = false;
active: string | false = emptyValue;

protected __updateItems?: () => Promise<void>;
protected _layers: Array<LayerAdapter | ResourceAdapter> = [];
Expand Down Expand Up @@ -120,7 +122,7 @@ export class BaseLayersSelect extends Vue {
if (this.allowEmpty) {
items.push({
text: this.emptyLayerText,
value: undefined,
value: emptyValue,
});
}

Expand All @@ -132,8 +134,8 @@ export class BaseLayersSelect extends Vue {
value: baseLayer.id || '',
text: baseLayer.options.name || baseLayer.id || '',
});
if (this.webMap.isLayerVisible(baseLayer)) {
this.active = baseLayer.id || false;
if (baseLayer.id && this.webMap.isLayerVisible(baseLayer)) {
this.active = baseLayer.id;
}
}
});
Expand Down
13 changes: 8 additions & 5 deletions packages/vuetify-ngw-components/src/components/index.ts
Expand Up @@ -2,9 +2,12 @@
* @module vuetify-ngw-components
*/
import { NgwLayersList, VueTreeItem } from './NgwLayersList/NgwLayersList';
import {
BaseLayersSelect,
VueSelectItem,
} from './BaseLayersSelect/BaseLayersSelect';
import { BasemapSelect, VueSelectItem } from './BasemapSelect/BasemapSelect';

export { NgwLayersList, VueTreeItem, BaseLayersSelect, VueSelectItem };
export {
NgwLayersList,
VueTreeItem,
BasemapSelect,
BasemapSelect as BaseLayersSelect,
VueSelectItem,
};

0 comments on commit 445c6a5

Please sign in to comment.