Skip to content

Commit

Permalink
[release] 1.1.7: Minor fixes, deprecation API warnings and refactoring (
Browse files Browse the repository at this point in the history
#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
yuzhva committed Oct 16, 2017
1 parent ece586a commit e6f8208
Show file tree
Hide file tree
Showing 53 changed files with 10,909 additions and 4,448 deletions.
2 changes: 1 addition & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"presets": ["es2015"]
"presets": ["es2015", "react"]
}
28 changes: 0 additions & 28 deletions .eslintrc.js

This file was deleted.

21 changes: 21 additions & 0 deletions .eslintrc.json
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"] }]
}
}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@

/npm-debug.log
/node_modules

/yarn-error.log

/coverage
95 changes: 0 additions & 95 deletions .sass-lint.yml

This file was deleted.

19 changes: 19 additions & 0 deletions .stylelintrc.json
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": [""]
}
}
76 changes: 76 additions & 0 deletions CHANGELOG.md
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
Loading

0 comments on commit e6f8208

Please sign in to comment.