refactor(js): remove geo-area event handlers
This commit is contained in:
parent
0dac59bffc
commit
22aefbaa4a
2 changed files with 0 additions and 41 deletions
|
@ -1,40 +0,0 @@
|
|||
import { delegate, fire, debounce } from '@utils';
|
||||
|
||||
const inputHandlers = new Map();
|
||||
|
||||
addEventListener('ds:page:update', () => {
|
||||
const inputs = document.querySelectorAll('.areas input[data-geo-area]');
|
||||
|
||||
for (const input of inputs) {
|
||||
input.addEventListener('focus', (event) => {
|
||||
const id = parseInt(event.target.dataset.geoArea);
|
||||
fire(document, 'map:feature:focus', { id });
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
delegate('click', '.areas a[data-geo-area]', (event) => {
|
||||
event.preventDefault();
|
||||
const id = parseInt(event.target.dataset.geoArea);
|
||||
fire(document, 'map:feature:focus', { id });
|
||||
});
|
||||
|
||||
delegate('input', '.areas input[data-geo-area]', (event) => {
|
||||
const id = parseInt(event.target.dataset.geoArea);
|
||||
|
||||
let handler = inputHandlers.get(id);
|
||||
if (!handler) {
|
||||
handler = debounce(() => {
|
||||
const input = document.querySelector(`input[data-geo-area="${id}"]`);
|
||||
if (input) {
|
||||
fire(document, 'map:feature:update', {
|
||||
id,
|
||||
properties: { description: input.value.trim() }
|
||||
});
|
||||
}
|
||||
}, 200);
|
||||
inputHandlers.set(id, handler);
|
||||
}
|
||||
|
||||
handler();
|
||||
});
|
|
@ -30,7 +30,6 @@ import '../new_design/messagerie';
|
|||
import '../new_design/dossiers/auto-save';
|
||||
import '../new_design/dossiers/auto-upload';
|
||||
|
||||
import '../new_design/champs/carte';
|
||||
import '../new_design/champs/linked-drop-down-list';
|
||||
import '../new_design/champs/repetition';
|
||||
import '../new_design/champs/drop-down-list';
|
||||
|
|
Loading…
Reference in a new issue