Fixes and refactoring
Signed-off-by: Paul Schwörer <hello@paulschwoerer.de>
This commit is contained in:
Родитель
4700a15e5c
Коммит
4d7b16a9a2
|
@ -1,2 +1,12 @@
|
|||
js/
|
||||
l10n/
|
||||
src/adminSettings.js
|
||||
src/contactsController.js
|
||||
src/devicesController.js
|
||||
src/favoritesController.js
|
||||
src/filetypes.js
|
||||
src/nonLocalizedPhotosController.js
|
||||
src/photosController.js
|
||||
src/script.js
|
||||
src/tracksController.js
|
||||
src/utils.js
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
17
package.json
17
package.json
|
@ -13,7 +13,7 @@
|
|||
"lint": "eslint --ext .js,.vue src",
|
||||
"lint:fix": "eslint --ext .js,.vue src --fix",
|
||||
"stylelint": "stylelint -f verbose --config .stylelintrc.json src",
|
||||
"stylelint:fix": "stylelint --config .stylelintrc.json
|
||||
"stylelint:fix": "stylelint --config .stylelintrc.json"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -32,25 +32,25 @@
|
|||
"extends @nextcloud/browserslist-config"
|
||||
],
|
||||
"dependencies": {
|
||||
"@nextcloud/vue": "^1.1.0",
|
||||
"@fortawesome/fontawesome-free": "^5.12.1",
|
||||
"@nextcloud/router": "^1.0.0",
|
||||
"@nextcloud/vue": "^1.1.0",
|
||||
"d3": "^3.5.17",
|
||||
"i18next-client": "^1.11.4",
|
||||
"install": "^0.13.0",
|
||||
"leaflet": "^1.4.0",
|
||||
"leaflet-contextmenu": "^1.4.0",
|
||||
"leaflet-control-geocoder": "^1.7.0",
|
||||
"leaflet-easybutton": "^2.4.0",
|
||||
"leaflet-mouse-position": "^1.0.4",
|
||||
"leaflet-routing-machine": "^3.2.12",
|
||||
"leaflet.elevation": "^0.0.3",
|
||||
"leaflet.featuregroup.subgroup": "^1.0.2",
|
||||
"leaflet.locatecontrol": "^0.67.0",
|
||||
"leaflet.markercluster": "^1.4.0",
|
||||
"leaflet-mouse-position": "^1.0.4",
|
||||
"leaflet-contextmenu": "^1.4.0",
|
||||
"leaflet.elevation": "^0.0.3",
|
||||
"lrm-graphhopper": "^1.3.0",
|
||||
"mapbox-gl": "^1.4.1",
|
||||
"mapbox-gl-leaflet": "^0.0.11",
|
||||
"moment": "^2.24.0",
|
||||
"nouislider": "^14.0.2",
|
||||
"opening_hours": "^3.5.0",
|
||||
"ua-parser-js": "^0.7.20",
|
||||
|
@ -63,11 +63,12 @@
|
|||
"devDependencies": {
|
||||
"@babel/core": "^7.8.4",
|
||||
"@babel/plugin-proposal-object-rest-spread": "^7.6.2",
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.8.4",
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
||||
"@babel/preset-env": "^7.8.4",
|
||||
"@nextcloud/browserslist-config": "^1.0.0",
|
||||
"babel-eslint": "^10.0.3",
|
||||
"babel-loader": "^8.0.6",
|
||||
"clean-webpack-plugin": "^3.0.0",
|
||||
"css-loader": "^3.2.0",
|
||||
"eslint": "^6.6.0",
|
||||
"eslint-config-nextcloud": "^0.1.1",
|
||||
|
@ -90,12 +91,10 @@
|
|||
"sass-loader": "^8.0.2",
|
||||
"stylelint": "^11.1.1",
|
||||
"stylelint-config-recommended-scss": "^4.0.0",
|
||||
"stylelint-config-standard": "^19.0.0",
|
||||
"stylelint-scss": "^3.12.0",
|
||||
"stylelint-webpack-plugin": "^1.0.3",
|
||||
"svg-sprite": "^1.5.0",
|
||||
"url-loader": "^3.0.0",
|
||||
"terser-webpack-plugin": "^2.2.1",
|
||||
"vue-loader": "^15.8.3",
|
||||
"vue-template-compiler": "^2.6.10",
|
||||
"webpack": "^4.41.5",
|
||||
|
|
|
@ -57,30 +57,30 @@
|
|||
:key="favorite.id"
|
||||
:lat-lng="[favorite.lat, favorite.lng]"
|
||||
:icon="createNewDivIcon(categoryKey)"
|
||||
@popupopen="handleMarkerPopupOpened(favorite.id)"
|
||||
@popupclose="handleMarkerPopupClosed(favorite.id)"
|
||||
@ready="marker => handleMarkerReady(favorite.id, marker)">
|
||||
@popupopen="storeCurrentlyOpenPopup(favorite.id)"
|
||||
@popupclose="forgetCurrentlyOpenPopup(favorite.id)"
|
||||
@ready="marker => storeMarkerReference(favorite.id, marker)">
|
||||
<LPopup>
|
||||
<FavoritePopup
|
||||
:favorite="favorite"
|
||||
:is-visible="openMarkerPopupId === favorite.id"
|
||||
:allow-category-customization="!isPublicShare"
|
||||
:allow-edits="allowFavoriteEdits"
|
||||
@deleteFavorite="handleDeleteFavorite"
|
||||
@updateFavorite="handleUpdateFavorite" />
|
||||
@deleteFavorite="emitDeleteFavoriteEvent"
|
||||
@updateFavorite="emitUpdateFavoriteEvent" />
|
||||
</LPopup>
|
||||
</LMarker>
|
||||
</LMarkerCluster>
|
||||
|
||||
<LFeatureGroup @ready="onFeatureGroupReady">
|
||||
<LPopup :lat-lng="popup.latLng">
|
||||
<LPopup :lat-lng="placePopup.latLng">
|
||||
<ClickPopup
|
||||
:is-visible="popup.visible"
|
||||
:lat-lng="popup.latLng"
|
||||
:is-visible="placePopup.visible"
|
||||
:lat-lng="placePopup.latLng"
|
||||
:allow-category-customization="!isPublicShare"
|
||||
:allow-edits="allowFavoriteEdits"
|
||||
@close="handlePopupCloseRequest"
|
||||
@addFavorite="handleAddFavorite" />
|
||||
@close="closePopup"
|
||||
@addFavorite="emitAddFavoriteEvent" />
|
||||
</LPopup>
|
||||
</LFeatureGroup>
|
||||
</LMap>
|
||||
|
@ -132,7 +132,7 @@ export default {
|
|||
return {
|
||||
activeLayerId: LayerIds.OSM,
|
||||
openMarkerPopupId: null,
|
||||
popup: {
|
||||
placePopup: {
|
||||
visible: false,
|
||||
latLng: { lat: 0, lng: 0 },
|
||||
},
|
||||
|
@ -206,7 +206,7 @@ export default {
|
|||
|
||||
created() {
|
||||
this.featureGroup = null
|
||||
this.popupWasJustClosed = false
|
||||
this.mapClickPopupLocked = false
|
||||
this.markerMap = []
|
||||
},
|
||||
|
||||
|
@ -219,35 +219,41 @@ export default {
|
|||
this.$refs.map.mapObject.setView(latLng, zoom)
|
||||
},
|
||||
|
||||
handleMarkerReady(favoriteId, marker) {
|
||||
storeMarkerReference(favoriteId, marker) {
|
||||
this.markerMap[favoriteId] = marker
|
||||
},
|
||||
|
||||
handleAddFavorite(data) {
|
||||
emitAddFavoriteEvent(data) {
|
||||
this.$emit('addFavorite', data)
|
||||
},
|
||||
|
||||
handleUpdateFavorite(data) {
|
||||
emitUpdateFavoriteEvent(data) {
|
||||
this.$emit('updateFavorite', data)
|
||||
},
|
||||
|
||||
handleDeleteFavorite(data) {
|
||||
emitDeleteFavoriteEvent(data) {
|
||||
this.$emit('deleteFavorite', data)
|
||||
},
|
||||
|
||||
handleMarkerPopupOpened(id) {
|
||||
storeCurrentlyOpenPopup(id) {
|
||||
this.openMarkerPopupId = id
|
||||
},
|
||||
|
||||
handleMarkerPopupClosed() {
|
||||
forgetCurrentlyOpenPopup() {
|
||||
this.mapClickPopupLocked = true
|
||||
|
||||
this.openMarkerPopupId = null
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.mapClickPopupLocked = false
|
||||
})
|
||||
|
||||
this.selectFavorite(null)
|
||||
},
|
||||
|
||||
openPopup(lat, lng) {
|
||||
this.popup.visible = true
|
||||
this.popup.latLng = { lat, lng }
|
||||
this.placePopup.visible = true
|
||||
this.placePopup.latLng = { lat, lng }
|
||||
this.featureGroup.openPopup([lat, lng])
|
||||
},
|
||||
|
||||
|
@ -257,20 +263,16 @@ export default {
|
|||
},
|
||||
|
||||
resetPopupState() {
|
||||
this.popup.visible = false
|
||||
this.popup.latLng = { lat: 0, lng: 0 }
|
||||
this.placePopup.visible = false
|
||||
this.placePopup.latLng = { lat: 0, lng: 0 }
|
||||
},
|
||||
|
||||
handleMapClick(e) {
|
||||
if (!this.popup.visible && !this.popupWasJustClosed) {
|
||||
if (!this.placePopup.visible && !this.mapClickPopupLocked) {
|
||||
this.openPopup(e.latlng.lat, e.latlng.lng)
|
||||
}
|
||||
},
|
||||
|
||||
handlePopupCloseRequest() {
|
||||
this.closePopup()
|
||||
},
|
||||
|
||||
createNewDivIcon(categoryKey) {
|
||||
return new DivIcon({
|
||||
iconAnchor: [MARKER_TOUCH_TARGET_SIZE * 0.5, MARKER_TOUCH_TARGET_SIZE * 0.5],
|
||||
|
@ -304,11 +306,11 @@ export default {
|
|||
handlePopupOpenEvent() {},
|
||||
|
||||
handlePopupCloseEvent() {
|
||||
this.popupWasJustClosed = true
|
||||
this.mapClickPopupLocked = true
|
||||
this.resetPopupState()
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.popupWasJustClosed = false
|
||||
this.mapClickPopupLocked = false
|
||||
})
|
||||
},
|
||||
|
||||
|
|
|
@ -25,13 +25,13 @@
|
|||
<AppNavigationNew
|
||||
v-if="allowFavoriteEdits"
|
||||
:text="newFavoriteButtonLabel"
|
||||
@click="handleAddFavoriteClick" />
|
||||
@click="toggleMapMode" />
|
||||
<AppNavigationItem
|
||||
v-for="favorite in favorites"
|
||||
:key="favorite.id"
|
||||
:title="favorite.name || t('maps', '(No name)')"
|
||||
icon="icon-star-dark"
|
||||
@click="handleFavoriteClick(favorite.id)" />
|
||||
@click="selectFavorite(favorite.id)" />
|
||||
<AppNavigationSpacer />
|
||||
</ul>
|
||||
|
||||
|
@ -90,17 +90,13 @@ export default {
|
|||
setMapMode: `${MAP_NAMESPACE}/setMode`,
|
||||
}),
|
||||
|
||||
handleAddFavoriteClick() {
|
||||
toggleMapMode() {
|
||||
if (this.mapMode === MapMode.ADDING_FAVORITES) {
|
||||
this.setMapMode(MapMode.DEFAULT)
|
||||
} else {
|
||||
this.setMapMode(MapMode.ADDING_FAVORITES)
|
||||
}
|
||||
},
|
||||
|
||||
handleFavoriteClick(id) {
|
||||
this.selectFavorite(id)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -2,11 +2,12 @@ const path = require('path')
|
|||
const webpack = require('webpack')
|
||||
const { VueLoaderPlugin } = require('vue-loader')
|
||||
const StyleLintPlugin = require('stylelint-webpack-plugin')
|
||||
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
|
||||
|
||||
module.exports = {
|
||||
entry: {
|
||||
adminSettings: path.join(__dirname, 'src', 'adminSettings.js'),
|
||||
script: path.join(__dirname, 'src', 'script.js'),
|
||||
adminSettings: path.join(__dirname, 'src', 'adminSettings.js'),
|
||||
script: path.join(__dirname, 'src', 'script.js'),
|
||||
'public-favorite-share': path.join(__dirname, 'src', 'publicFavoriteShare.js'),
|
||||
},
|
||||
output: {
|
||||
|
@ -35,16 +36,7 @@ module.exports = {
|
|||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
use: {
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
plugins: [
|
||||
'@babel/plugin-syntax-dynamic-import',
|
||||
'@babel/plugin-proposal-object-rest-spread',
|
||||
],
|
||||
presets: ['@babel/preset-env'],
|
||||
},
|
||||
},
|
||||
loader: 'babel-loader',
|
||||
exclude: /node_modules\/(?!(p-limit|p-defer|p-queue|p-try|cdav-library))/,
|
||||
},
|
||||
{
|
||||
|
@ -56,10 +48,10 @@ module.exports = {
|
|||
publicPath: '/apps/maps/img/',
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /\.(woff|woff2|eot|ttf)$/,
|
||||
loader: 'url-loader',
|
||||
}
|
||||
{
|
||||
test: /\.(woff|woff2|eot|ttf)$/,
|
||||
loader: 'url-loader',
|
||||
},
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
|
@ -70,7 +62,7 @@ module.exports = {
|
|||
new StyleLintPlugin({
|
||||
files: ['**/*.{vue,htm,html,css,sss,less,scss,sass}'],
|
||||
}),
|
||||
new CleanWebpackPlugin(),
|
||||
new CleanWebpackPlugin(),
|
||||
],
|
||||
resolve: {
|
||||
extensions: ['*', '.js', '.vue', '.json'],
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const merge = require('webpack-merge');
|
||||
const common = require('./webpack.common.js');
|
||||
const merge = require('webpack-merge')
|
||||
const common = require('./webpack.common.js')
|
||||
|
||||
module.exports = merge(common, {
|
||||
mode: 'production',
|
||||
devtool: '#source-map',
|
||||
});
|
||||
mode: 'production',
|
||||
devtool: '#source-map',
|
||||
})
|
||||
|
|
Загрузка…
Ссылка в новой задаче