-
-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[release] 1.1.7: Minor fixes, deprecation API warnings and refactoring (
#47) * [config] Dependencies update * [refactoring] Handle empty markers on receiving new props * [fix] Webpack ExtractTextPlugin config * [config] React 15 and 16 peerDependencie support * [fix] Check if map className was already added on cluster mounting * [alerts] Add deprecation warnings * [config] Update eslint rules according to AirBnb standarts * [refactoring] Improve syntax according new ESlint rules * [enhancement] Use not only index for key prop * [config] Move config files from .yml to .json * [config] Check syntax on precommit * [refactoring] Improve syntax of config files according new ESlint rules * [config] Move webpack and gulp config files to config folder * [config] Setup tests * [demo-app] Move import of main.scss from .js to webpack * [demo-app][refactoring] WelcomePage * [demo-app][refactoring] Improve syntax according new ESlint rules * [refactoring] Moving to the updated marker 'position' API * [refactoring] Removing deprecated wrapperOptions API * [refactoring] style to plural styles * [doc] Update README * [fix] Gulp config * [doc] CHANGELOG * [fix] build:hg-pages * [refactoring] Move dist files after build:gh-pages to rootPath * [fix] Separate new and deprecated styles * [build] Source * [config] Update release version
- Loading branch information
Showing
53 changed files
with
10,909 additions
and
4,448 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"presets": ["es2015"] | ||
"presets": ["es2015", "react"] | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"extends": "airbnb", | ||
"env": { | ||
"browser": true, | ||
"jest": true | ||
}, | ||
"plugins": [ | ||
"react", | ||
"jsx-a11y", | ||
"import" | ||
], | ||
"rules": { | ||
"arrow-parens": ["error", "always"], | ||
"no-console": [1, { "allow": ["warn"] }], | ||
|
||
"react/jsx-filename-extension": 0, | ||
|
||
"react/forbid-prop-types": 0, | ||
"no-underscore-dangle": ["error", { "allow": ["_container"] }] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,7 @@ | |
|
||
/npm-debug.log | ||
/node_modules | ||
|
||
/yarn-error.log | ||
|
||
/coverage |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"extends": "stylelint-config-sass-guidelines", | ||
"plugins": [ | ||
"stylelint-declaration-use-variable" | ||
], | ||
"rules": { | ||
"declaration-no-important": true, | ||
"max-nesting-depth": 3, | ||
"sh-waqar/declaration-use-variable": [ | ||
"color", | ||
"background-color", | ||
"border-color", | ||
"outline-color", | ||
"transition", | ||
"font-family" | ||
], | ||
"scss/at-import-partial-extension-blacklist": [""] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# v1.2.0 | ||
There are critical changes that touches to the MarkerClusterGroup API: | ||
|
||
### **1.** marker object `lat` and `lng` keys are deprecated (will be removed at v1.2.0). | ||
To set marker position, please use `position` key at marker object like: | ||
```javascript | ||
const markers = [ | ||
{ position: [49.8397, 24.0297] }, | ||
{ position: [52.2297, 21.0122] }, | ||
{ position: [51.5074, -0.0901] }, | ||
]; | ||
``` | ||
`position` that is [Leaflet.LatLng](http://leafletjs.com/reference-1.2.0.html#latlng) | ||
`array` or `object`, that could be declared like: | ||
```javascript | ||
const markers = [ | ||
{ position: [49.8397, 24.0297] }, // [lat, lng] | ||
{ position: { lat: 52.2297, lng: 21.0122 } }, | ||
{ position: { lat: 52.2297, lon: 21.0122 } }, | ||
]; | ||
``` | ||
|
||
### **2.** `wrapperOptions` is fully deprecated and will not use anymore (will be removed at v1.2.0). | ||
How to replace `wrapperOptions` old `enableDefaultStyle | disableDefaultAnimation | removeDuplicates` features: | ||
- `enableDefaultStyle:` to enable `leaflet.markercluster` default style for cluster, | ||
just import Markercluster styles: | ||
```javascript | ||
@import '~react-leaflet-markercluster/dist/styles.min.css'; // sass | ||
@import url('~react-leaflet-markercluster/dist/styles.min.css'); // css | ||
|
||
require('react-leaflet-markercluster/dist/styles.min.css'); // inside .js file | ||
``` | ||
or include CSS styles directly to the head of HTML file: | ||
```html | ||
<link rel="stylesheet" href="https://unpkg.com/react-leaflet-markercluster/dist/styles.min.css" /> | ||
``` | ||
- `disableDefaultAnimation:` to disable markers animation, set [Leaflet.markercluster](https://github.com/Leaflet/Leaflet.markercluster/#enabled-by-default-boolean-options) | ||
`animate` option to `false`: | ||
```javascript | ||
<MarkerClusterGroup markers={markers} options={{ animate: false }} /> | ||
``` | ||
- `removeDuplicates:` you could use our previous solution for markers filtering | ||
(before sending them to MarkerClusterGroup) as follows: | ||
```javascript | ||
function removeMarkersWithSameCoordinates(markers) { | ||
// init filtered markers list with first marker from list | ||
const filteredMarkers = [markers[0]]; | ||
|
||
markers.forEach((marker) => { | ||
if (!JSON.stringify(filteredMarkers).includes(JSON.stringify(marker))) { | ||
filteredMarkers.push(marker); | ||
} | ||
}); | ||
|
||
return filteredMarkers; | ||
} | ||
|
||
// ... | ||
render() { | ||
const filteredMarkers = removeMarkersWithSameCoordinates(this.props.markers); | ||
return ( | ||
// ... | ||
<MarkerClusterGroup markers={filteredMarkers} /> | ||
// ... | ||
) | ||
} | ||
// ... | ||
``` | ||
|
||
### **3.** Bug Fix | ||
- Check if map className was already added/changed when MarkerClusterGroup is mounting | ||
- Remove markers from map when MarkerClusterGroup received empty array in nextProps | ||
- Updated MarkerClusterGroup API. Deprecation warnings about `wrapperOptions` | ||
and marker `lat` and `lng` object keys. | ||
- React 16 peerDependency support | ||
- Updated documentation |
Oops, something went wrong.