Merge pull request #6432 from tchak/update-dependencies

Mise à jour des dépendances Javascript (#6432)
This commit is contained in:
Pierre de La Morinerie 2021-08-31 11:53:00 -05:00 committed by GitHub
commit b709a160fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 657 additions and 419 deletions

View file

@ -44,13 +44,8 @@ function MapEditor({ featureCollection, url, options, preview }) {
enabled: !preview, enabled: !preview,
cadastreEnabled cadastreEnabled
}); });
const { const { style, layers, setStyle, setLayerEnabled, setLayerOpacity } =
style, useMapStyle(options.layers, {
layers,
setStyle,
setLayerEnabled,
setLayerOpacity
} = useMapStyle(options.layers, {
onStyleChange, onStyleChange,
cadastreEnabled cadastreEnabled
}); });

View file

@ -133,20 +133,15 @@ export function useMapboxEditor(
); );
const addEventListeners = useCallback((events) => { const addEventListeners = useCallback((events) => {
const unsubscribe = Object.entries( const unsubscribe = Object.entries(events).map(
events ([eventName, [target, callback]]) =>
).map(([eventName, [target, callback]]) =>
addEventListener(eventName, target, callback) addEventListener(eventName, target, callback)
); );
return () => unsubscribe.map((unsubscribe) => unsubscribe()); return () => unsubscribe.map((unsubscribe) => unsubscribe());
}, []); }, []);
const { const { createFeatures, updateFeatures, deleteFeatures, ...props } =
createFeatures, useFeatureCollection(featureCollection, {
updateFeatures,
deleteFeatures,
...props
} = useFeatureCollection(featureCollection, {
url, url,
enabled: isSupported && enabled, enabled: isSupported && enabled,
addFeatures, addFeatures,

View file

@ -13,20 +13,10 @@ import { useMapbox } from './useMapbox';
const Mapbox = ReactMapboxGl({}); const Mapbox = ReactMapboxGl({});
const MapReader = ({ featureCollection, options }) => { const MapReader = ({ featureCollection, options }) => {
const { const { isSupported, onLoad, onStyleChange, onMouseEnter, onMouseLeave } =
isSupported, useMapbox(featureCollection);
onLoad, const { style, layers, setStyle, setLayerEnabled, setLayerOpacity } =
onStyleChange, useMapStyle(options.layers, { onStyleChange });
onMouseEnter,
onMouseLeave
} = useMapbox(featureCollection);
const {
style,
layers,
setStyle,
setLayerEnabled,
setLayerOpacity
} = useMapStyle(options.layers, { onStyleChange });
if (!isSupported) { if (!isSupported) {
return ( return (

View file

@ -1,5 +1,6 @@
import React from 'react'; import React from 'react';
import { createPortal } from 'react-dom'; import { createPortal } from 'react-dom';
import PropTypes from 'prop-types';
export function FlashMessage({ message, level, sticky, fixed }) { export function FlashMessage({ message, level, sticky, fixed }) {
return createPortal( return createPortal(
@ -22,3 +23,10 @@ function flashClassName(level, sticky = false, fixed = false) {
} }
return className.join(' '); return className.join(' ');
} }
FlashMessage.propTypes = {
message: PropTypes.string,
level: PropTypes.string,
sticky: PropTypes.bool,
fixed: PropTypes.bool
};

View file

@ -198,8 +198,7 @@ export default {
sources: { sources: {
'decoupage-administratif': { 'decoupage-administratif': {
type: 'vector', type: 'vector',
url: url: 'https://openmaptiles.geo.data.gouv.fr/data/decoupage-administratif.json'
'https://openmaptiles.geo.data.gouv.fr/data/decoupage-administratif.json'
}, },
openmaptiles: { openmaptiles: {
type: 'vector', type: 'vector',

View file

@ -99,9 +99,8 @@ export default class AutoUploadController {
} }
_hideErrorMessage() { _hideErrorMessage() {
let errorElement = this.input.parentElement.querySelector( let errorElement =
'.attachment-error' this.input.parentElement.querySelector('.attachment-error');
);
if (errorElement) { if (errorElement) {
hide(errorElement); hide(errorElement);
} }

View file

@ -1,25 +1,25 @@
{ {
"dependencies": { "dependencies": {
"@babel/preset-react": "^7.12.13", "@babel/preset-react": "^7.14.5",
"@headlessui/react": "^1.3.0", "@headlessui/react": "^1.3.0",
"@heroicons/react": "^1.0.1", "@heroicons/react": "^1.0.1",
"@mapbox/mapbox-gl-draw": "^1.2.2", "@mapbox/mapbox-gl-draw": "^1.2.2",
"@popperjs/core": "^2.9.2", "@popperjs/core": "^2.9.2",
"@rails/actiontext": "^6.0.3", "@rails/actiontext": "^6.1.4-1",
"@rails/activestorage": "^6.0.3", "@rails/activestorage": "^6.1.4-1",
"@rails/ujs": "^6.0.3", "@rails/ujs": "^6.1.4-1",
"@rails/webpacker": "5.1.1", "@rails/webpacker": "5.1.1",
"@reach/combobox": "^0.13.0", "@reach/combobox": "^0.13.0",
"@reach/slider": "^0.15.0", "@reach/slider": "^0.15.0",
"@reach/visually-hidden": "^0.15.2", "@reach/visually-hidden": "^0.15.2",
"@sentry/browser": "6.9.0", "@sentry/browser": "6.11.0",
"@tmcw/togeojson": "^4.3.0", "@tmcw/togeojson": "^4.3.0",
"babel-plugin-macros": "^2.8.0", "babel-plugin-macros": "^2.8.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24", "babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"chartkick": "^3.2.0", "chartkick": "^3.2.0",
"core-js": "^3.6.5", "core-js": "^3.6.5",
"debounce": "^1.2.0", "debounce": "^1.2.1",
"dom4": "^2.1.5", "dom4": "^2.1.6",
"email-butler": "^1.0.13", "email-butler": "^1.0.13",
"highcharts": "^9.0.0", "highcharts": "^9.0.0",
"intersection-observer": "^0.12.0", "intersection-observer": "^0.12.0",
@ -44,13 +44,13 @@
"devDependencies": { "devDependencies": {
"@2fd/graphdoc": "^2.4.0", "@2fd/graphdoc": "^2.4.0",
"babel-eslint": "^10.1.0", "babel-eslint": "^10.1.0",
"eslint": "^7.0.0", "eslint": "^7.32.0",
"eslint-config-prettier": "^6.11.0", "eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.1.3", "eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.22.0", "eslint-plugin-react": "^7.25.1",
"eslint-plugin-react-hooks": "^4.2.0", "eslint-plugin-react-hooks": "^4.2.0",
"netlify-cli": "^2.61.2", "netlify-cli": "^2.61.2",
"prettier": "^2.0.5", "prettier": "^2.3.2",
"webpack-bundle-analyzer": "^3.7.0", "webpack-bundle-analyzer": "^3.7.0",
"webpack-dev-server": "^3.11.0" "webpack-dev-server": "^3.11.0"
}, },

978
yarn.lock

File diff suppressed because it is too large Load diff