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