Skip to content

Commit

Permalink
Merge branch 'release/2.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
perruche committed Jan 11, 2024
2 parents e9f90ef + 48003ae commit eaf86c8
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file. The format

## [Unreleased]

## [v2.3.0](https://github.com/studiometa/vue-mapbox-gl/compare/2.2.0...2.3.0) (2024-01-11)
- Add `filterItemsCallback` props to `StoreLocator` component, that allow to filter the order of the items list.

## [v2.2.0](https://github.com/studiometa/vue-mapbox-gl/compare/2.1.1...2.2.0) (2023-09-15)

### Added
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@studiometa/vue-mapbox-gl-workspace",
"private": true,
"version": "2.2.0",
"version": "2.3.0",
"workspaces": [
"packages/*"
],
Expand Down
7 changes: 7 additions & 0 deletions packages/docs/components/StoreLocator/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,13 @@ interface StoreLocatorClassesProp {
}
```

### `filterItemsCallback`

- Type `Function|Boolean`
- Default `false`

Props to add a custom filtering on the `items` props. That is triggered on `onMapCreated` `onMapMoveend` event.

## Events

### `map-created`
Expand Down
13 changes: 13 additions & 0 deletions packages/vue-mapbox-gl/components/StoreLocator/StoreLocator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,15 @@
};
},
},
/**
* Filter items callback function
* @type {Function}
*/
filterItemsCallback: {
type: [Function, Boolean],
default: false,
},
});
const emit = defineEmits();
Expand Down Expand Up @@ -164,6 +173,10 @@
return 0;
});
if (props.filterItemsCallback && typeof props.filterItemsCallback === 'function') {
filteredItems.value = await props.filterItemsCallback(filteredItems.value, map.value);
}
await nextTick();
listIsLoading.value = false;
}
Expand Down

0 comments on commit eaf86c8

Please sign in to comment.