Skip to content

Commit

Permalink
remove v-t-placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
Raruto committed Sep 26, 2024
1 parent 59966c9 commit 36091eb
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 81 deletions.
67 changes: 23 additions & 44 deletions src/components/MapControlGeocoding.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
id = "gcd-input-query"
autocomplete = "off"
class = "gcd-txt-input"
v-t-placeholder = "placeholder"
@keyup = "onQuery"
@input = "onValue"
:placeholder = "placeholder"
/>

<!-- RESET SEARCH -->
Expand Down Expand Up @@ -124,7 +124,7 @@
<!-- NO RESULTS -->
<span
v-else-if = "item.__no_results"
v-t = "noresults"
v-t = "'mapcontrols.geocoding.noresults'"
></span>
<!-- NO RESULTS -->
<template v-else>
Expand Down Expand Up @@ -193,6 +193,8 @@ import { convertSingleMultiGeometry } from 'utils/convertSingleMultiGeometry';
import { getCatalogLayerById } from 'utils/getCatalogLayerById';
import { getCatalogLayers } from 'utils/getCatalogLayers';

const { t } = require('g3w-i18n');

/**
* Provider definitions.
*
Expand Down Expand Up @@ -289,51 +291,16 @@ export default {
data() {
return {
/** @since 3.9.0 */
results : [],
results: [],
/** @since 3.9.0 */
disabled : false, // disabled boolean control
disabled: false, // disabled boolean control
/** @since 3.9.0 */
results_panel_open : false, // @TODO make use of `GUI.isSomething()`
results_panel_open: false, // @TODO make use of `GUI.isSomething()`
};
},

props: {

placeholder: {
type: String,
required: true,
},

/**
* @since 3.9.0
*/
noresults: {
type: String,
required: true,
},

/**
* @since 3.9.0
*/
limit: {
type: Number,
required: true,
},

/**
* @since 3.9.0
*/
viewbox: {
required: true,
},

/**
* @since 3.9.0
*/
mapCrs: {
required: true,
},

/**
* @since 3.9.0
*/
Expand Down Expand Up @@ -382,11 +349,22 @@ export default {
* @since 3.9.0
*/
extent() {
const map = GUI.getService('map');
const project = map.getProject().state;
return ol.proj.transformExtent(
Object.keys(this.providers).filter(p => 'nominatim' != p).length > 0
? GUI.getService('map').getMapExtent()
: this.viewbox, this.mapCrs, 'EPSG:4326'
)
? map.getMapExtent()
: (project.initextent || project.extent),
project.crs.epsg,
'EPSG:4326'
);
},

/**
* @since 3.11.0
*/
placeholder() {
return ApplicationState.language && t('mapcontrols.geocoding.placeholder');
},

},
Expand Down Expand Up @@ -538,7 +516,7 @@ export default {
query: q,
lang: ApplicationState.language || 'it-IT',
// countrycodes: _options.countrycodes, // <-- TODO ?
limit: this.limit,
limit: 5,
extent: this.extent,
}))
);
Expand Down Expand Up @@ -756,6 +734,7 @@ export default {
},

created() {

const queryresults = GUI.getService('queryresults');
const mapService = GUI.getService('map');
const map = mapService.getMap();
Expand Down
25 changes: 0 additions & 25 deletions src/directives/v-t-placeholder.js

This file was deleted.

2 changes: 0 additions & 2 deletions src/index.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ import vChecked from 'directives/v-checked';
import vSelect2 from 'directives/v-select2';
import vTToltip from 'directives/v-t-tooltip';
import vTHtml from 'directives/v-t-html';
import vTPlaceholder from 'directives/v-t-placeholder';
import vTTitle from 'directives/v-t-title';
import vT from "directives/v-t";
import vTPlugin from 'directives/v-t-plugin';
Expand Down Expand Up @@ -104,7 +103,6 @@ Vue.directive("checked", vChecked);
Vue.directive('select2', vSelect2);
Vue.directive('t-tooltip', vTToltip);
Vue.directive('t-html', vTHtml);
Vue.directive('t-placeholder', vTPlaceholder);
Vue.directive('t-title', vTTitle);
Vue.directive("t", vT);
Vue.directive("t-plugin", vTPlugin);
Expand Down
11 changes: 1 addition & 10 deletions src/services/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,7 @@ const CONTROLS = {
'overview': (opts = {}) => new InteractionControl({ ...opts, ol: new ol.control.OverviewMap(opts) }),
/** @since 3.8.0 */
'zoomhistory': (opts = {}) => new InteractionControl({ element: (new (Vue.extend(MapControlZoomHistory))()).$mount().$el, tipLabel: "sdk.mapcontrols.addlayer.tooltip" }),
'geocoding': (opts = {}) => new InteractionControl({ element: (new (Vue.extend(MapControlGeocoding))({
propsData: {
...opts.config, // pass configuration from server
placeholder: opts.placeholder || 'mapcontrols.geocoding.placeholder',
noresults: opts.noresults || 'mapcontrols.geocoding.noresults',
limit: opts.limit || 5,
viewbox: opts.bbox || (GUI.getService('map').getProject().state.initextent || GUI.getService('map').getProject().state.extent),
mapCrs: opts.mapCrs || GUI.getService('map').getProject().state.crs.epsg,
}
})).$mount().$el, offline: false}),
'geocoding': (opts = {}) => new InteractionControl({ element: (new (Vue.extend(MapControlGeocoding))({ propsData: opts.config })).$mount().$el, offline: false}), // pass configuration from server
'zoombox': (opts = {}) => new InteractionControl({
...opts,
name: 'zoombox',
Expand Down

0 comments on commit 36091eb

Please sign in to comment.