chore: fix JS syntax to be compatible with browser >= 2020

Safari only supports public field since 2021…
This commit is contained in:
Yohan Boniface 2024-03-15 17:19:56 +01:00
parent 46016cb10b
commit c5e3dfb95c
3 changed files with 19 additions and 14 deletions

View file

@ -2,13 +2,12 @@ import { DomUtil, DomEvent } from '../../vendors/leaflet/leaflet-src.esm.js'
import { translate } from './i18n.js'
export class Panel {
MODE = 'condensed'
CLASSNAME = 'left'
constructor(map) {
this.parent = map._container
this.map = map
this.container = DomUtil.create('div', '', this.parent)
this.mode = 'condensed'
this.classname = 'left'
DomEvent.disableClickPropagation(this.container)
DomEvent.on(this.container, 'contextmenu', DomEvent.stopPropagation) // Do not activate our custom context menu.
DomEvent.on(this.container, 'wheel', DomEvent.stopPropagation)
@ -16,7 +15,7 @@ export class Panel {
}
open(e) {
this.container.className = `with-transition panel ${this.CLASSNAME} ${this.MODE}`
this.container.className = `with-transition panel ${this.classname} ${this.mode}`
this.container.innerHTML = ''
const actionsContainer = DomUtil.create('ul', 'toolbox', this.container)
const body = DomUtil.create('div', 'body', this.container)
@ -45,12 +44,12 @@ export class Panel {
}
resize() {
if (this.MODE === 'expanded') {
this.MODE = 'condensed'
if (this.mode === 'expanded') {
this.mode = 'condensed'
this.container.classList.remove('expanded')
this.container.classList.add('condensed')
} else {
this.MODE = 'expanded'
this.mode = 'expanded'
this.container.classList.remove('condensed')
this.container.classList.add('expanded')
}
@ -66,10 +65,16 @@ export class Panel {
}
export class EditPanel extends Panel {
CLASSNAME = 'right dark'
constructor(map) {
super(map)
this.classname = 'right dark'
}
}
export class FullPanel extends Panel {
CLASSNAME = 'full dark'
MODE = 'expanded'
constructor(map) {
super(map)
this.classname = 'full dark'
this.mode = 'expanded'
}
}

View file

@ -207,13 +207,13 @@ U.Map = L.Map.extend({
if (L.Util.queryString('share')) {
this.share.open()
} else if (this.options.onLoadPanel === 'databrowser') {
this.panel.MODE = 'expanded'
this.panel.mode = 'expanded'
this.openBrowser()
} else if (this.options.onLoadPanel === 'datalayers') {
this.panel.MODE = 'condensed'
this.panel.mode = 'condensed'
this.openBrowser()
} else if (this.options.onLoadPanel === 'caption') {
this.panel.MODE = 'condensed'
this.panel.mode = 'condensed'
this.displayCaption()
} else if (['facet', 'datafilters'].includes(this.options.onLoadPanel)) {
this.openFacet()

View file

@ -1,7 +1,7 @@
import json
import re
from time import sleep
from pathlib import Path
from time import sleep
import pytest
from playwright.sync_api import expect