renusify 1.1.4 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/app/notify/notification.vue +2 -1
- package/components/app/toast/index.vue +7 -2
- package/components/app/toast/toast.vue +2 -0
- package/components/avatar/index.vue +29 -23
- package/components/bar/bottomNavigationCircle.vue +8 -3
- package/components/bar/scss/bottomNav.scss +1 -1
- package/components/bar/toolbar/laptop.vue +4 -4
- package/components/bar/toolbar/mixin.js +1 -2
- package/components/bar/toolbar/mobile.vue +5 -4
- package/components/breadcrumb/index.vue +1 -0
- package/components/button/buttonConfirm.vue +1 -1
- package/components/button/buttonGroup.vue +1 -0
- package/components/button/style.scss +1 -0
- package/components/calendar/index.vue +1 -0
- package/components/calendar/month.vue +1 -0
- package/components/calendar/year.vue +1 -0
- package/components/chat/chatInput.vue +1 -0
- package/components/chat/chatMsg.vue +1 -0
- package/components/chat/index.vue +1 -0
- package/components/chip/index.vue +1 -0
- package/components/codeEditor/index.vue +0 -2
- package/components/confirm/index.vue +1 -0
- package/components/countdown/index.vue +1 -0
- package/components/float/index.vue +1 -0
- package/components/form/address.vue +6 -2
- package/components/form/camInput.vue +10 -3
- package/components/form/check-input.vue +95 -94
- package/components/form/checkbox.vue +1 -1
- package/components/form/colorPicker/index.vue +1 -0
- package/components/form/colorPicker/picker.vue +1 -0
- package/components/form/datePicker/index.vue +349 -348
- package/components/form/datePicker/month.vue +1 -0
- package/components/form/datePicker/year.vue +1 -0
- package/components/form/fileUploader/file.js +21 -3
- package/components/form/fileUploader/index.vue +13 -2
- package/components/form/fileUploader/single.vue +4 -2
- package/components/form/form.vue +1 -0
- package/components/form/group-input.vue +42 -38
- package/components/form/input.vue +253 -1
- package/components/form/inputTel/index.vue +22 -12
- package/components/form/json/JsonView.vue +95 -94
- package/components/form/json/index.vue +2 -0
- package/components/form/mask-input.vue +1 -0
- package/components/form/number.vue +25 -12
- package/components/form/password.vue +121 -121
- package/components/form/radioInput.vue +1 -0
- package/components/form/range.vue +26 -1
- package/components/form/rating.vue +13 -1
- package/components/form/select.vue +67 -4
- package/components/form/switch.vue +64 -2
- package/components/form/text-area.vue +1 -1
- package/components/form/text-editor/index.vue +18 -11
- package/components/form/text-input.vue +1 -1
- package/components/form/timepicker/index.vue +2 -1
- package/components/form/timepicker/range.vue +2 -1
- package/components/form/timepicker/timepicker.vue +2 -1
- package/components/form/unique/index.vue +3 -1
- package/components/form/unit-input.vue +2 -1
- package/components/formCreator/index.vue +8 -6
- package/components/html2pdf/index.vue +1 -0
- package/components/img/index.vue +12 -2
- package/components/img/svgImg.vue +43 -0
- package/components/infinite/div.vue +2 -1
- package/components/infinite/page.vue +24 -23
- package/components/list/index.vue +35 -32
- package/components/map/index.vue +324 -306
- package/components/map/route.vue +1 -0
- package/components/map/select.vue +1 -0
- package/components/menu/index.vue +1 -0
- package/components/modal/index.vue +1 -0
- package/components/searchBox/index.vue +5 -3
- package/components/slider/index.vue +1 -0
- package/components/table/crud/footer.vue +1 -1
- package/components/table/crud/header.vue +10 -4
- package/components/table/crud/index.vue +463 -458
- package/components/tabs/index.vue +1 -0
- package/components/tree/index.vue +15 -13
- package/components/tree/tree-element.vue +8 -4
- package/package.json +1 -1
- package/style/colors.scss +1 -1
- package/components/form/scss/input.scss +0 -249
- package/components/form/scss/rating.scss +0 -9
- package/components/form/scss/select.scss +0 -55
- package/components/form/scss/switch.scss +0 -68
package/components/map/index.vue
CHANGED
|
@@ -1,331 +1,349 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
<div ref="map"
|
|
3
|
+
:class="{[`${$r.prefix}map`]:true,'map-dark': dark, 'attribution-show': attribution }"
|
|
4
|
+
>
|
|
5
|
+
<div class="map-search" v-if="searchBox">
|
|
6
|
+
<r-search-box
|
|
7
|
+
:label="$t('search','renusify')"
|
|
8
|
+
@select="go"
|
|
9
|
+
url="https://nominatim.openstreetmap.org/search.php?polygon_geojson=0&accept-language=fa&countrycodes=IR&format=jsonv2"
|
|
10
|
+
query="q"
|
|
11
|
+
no-overlay
|
|
12
|
+
inputControlClass="sheet"
|
|
13
|
+
:notFoundMsg="$t('map_not_found','renusify')"
|
|
14
|
+
>
|
|
15
|
+
<template v-slot="{ item }">
|
|
16
|
+
{{ item["display_name"] }}
|
|
17
|
+
</template>
|
|
18
|
+
</r-search-box>
|
|
19
|
+
</div>
|
|
20
|
+
<div class="map-box" :id="map_id" :style="`height: ${height}`"></div>
|
|
21
|
+
|
|
22
|
+
<r-btn
|
|
23
|
+
v-if="meLocation"
|
|
24
|
+
class="map-location color-white color-primary-text"
|
|
25
|
+
icon
|
|
26
|
+
@click.prevent="showConfirm"
|
|
27
|
+
:loading="loading"
|
|
4
28
|
>
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
<template v-slot="{ item }">
|
|
16
|
-
{{ item["display_name"] }}
|
|
17
|
-
</template>
|
|
18
|
-
</r-search-box>
|
|
19
|
-
</div>
|
|
20
|
-
<div class="map-box" :id="map_id" :style="`height: ${height}`"></div>
|
|
29
|
+
<r-icon v-html="$r.icons.crosshairs_gps"></r-icon>
|
|
30
|
+
</r-btn>
|
|
31
|
+
<r-btn
|
|
32
|
+
class="map-attribution color-white color-primary-text"
|
|
33
|
+
@click.prevent="attribution = !attribution"
|
|
34
|
+
size="x-small"
|
|
35
|
+
icon
|
|
36
|
+
>
|
|
37
|
+
<r-icon v-html="$r.icons.copyright" exact></r-icon>
|
|
38
|
+
</r-btn>
|
|
21
39
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
:loading="loading"
|
|
27
|
-
>
|
|
28
|
-
<r-icon v-html="$r.icons.crosshairs_gps"></r-icon>
|
|
29
|
-
</r-btn>
|
|
30
|
-
<r-btn
|
|
31
|
-
class="map-attribution color-white"
|
|
32
|
-
@click.prevent="attribution = !attribution"
|
|
33
|
-
size="x-small"
|
|
34
|
-
icon
|
|
35
|
-
>
|
|
36
|
-
<r-icon v-html="$r.icons.copyright" exact></r-icon>
|
|
37
|
-
</r-btn>
|
|
38
|
-
|
|
39
|
-
<r-confirm v-model="confirm"
|
|
40
|
-
@accept="getLocation"
|
|
41
|
-
@cancel="confirm = false" :text="$t('map_location_confirm','renusify')"></r-confirm>
|
|
42
|
-
</div>
|
|
40
|
+
<r-confirm v-model="confirm"
|
|
41
|
+
@accept="getLocation"
|
|
42
|
+
@cancel="confirm = false" :text="$t('map_location_confirm','renusify')"></r-confirm>
|
|
43
|
+
</div>
|
|
43
44
|
|
|
44
45
|
</template>
|
|
45
46
|
|
|
46
47
|
<script>
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
zoomOutTitle: this.$t("map_zoom_out",'renusify')
|
|
162
|
-
})
|
|
163
|
-
.addTo(this.map);
|
|
48
|
+
export default {
|
|
49
|
+
name: "rMap",
|
|
50
|
+
props: {
|
|
51
|
+
modelValue: Array,
|
|
52
|
+
height: {type: String, default: "500px"},
|
|
53
|
+
zoom: {type: Number, default: 13},
|
|
54
|
+
center: {
|
|
55
|
+
type: Array,
|
|
56
|
+
default: () => {
|
|
57
|
+
return [35.69940749291485, 51.33705139160157];
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
markers: {
|
|
61
|
+
type: Array,
|
|
62
|
+
default: () => {
|
|
63
|
+
return [];
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
searchBox: Boolean,
|
|
67
|
+
zoomControl: {type: Boolean, default: true},
|
|
68
|
+
layerControl: {type: Boolean, default: true},
|
|
69
|
+
meLocation: {type: Boolean, default: true},
|
|
70
|
+
disableMove: {type: Boolean, default: false},
|
|
71
|
+
darkMode: Boolean
|
|
72
|
+
},
|
|
73
|
+
data() {
|
|
74
|
+
return {
|
|
75
|
+
dark: this.darkMode,
|
|
76
|
+
attribution: false,
|
|
77
|
+
confirm: false,
|
|
78
|
+
loading: false,
|
|
79
|
+
L: null,
|
|
80
|
+
map: null,
|
|
81
|
+
layerGroup: null,
|
|
82
|
+
map_id: "map_" + this.$helper.uniqueId(12),
|
|
83
|
+
layers: {},
|
|
84
|
+
license: '© | <a href="https://leafletjs.com" target="_blank">Leaflet</a> | <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors | Renusify'
|
|
85
|
+
};
|
|
86
|
+
},
|
|
87
|
+
emits:['update:modelValue','leaflet','map'],
|
|
88
|
+
created() {
|
|
89
|
+
if (!this.$r.icons.crosshairs_gps) {
|
|
90
|
+
this.$r.icons.crosshairs_gps = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M12 8a4 4 0 0 1 4 4a4 4 0 0 1-4 4a4 4 0 0 1-4-4a4 4 0 0 1 4-4m-8.95 5H1v-2h2.05C3.5 6.83 6.83 3.5 11 3.05V1h2v2.05c4.17.45 7.5 3.78 7.95 7.95H23v2h-2.05c-.45 4.17-3.78 7.5-7.95 7.95V23h-2v-2.05C6.83 20.5 3.5 17.17 3.05 13M12 5a7 7 0 0 0-7 7a7 7 0 0 0 7 7a7 7 0 0 0 7-7a7 7 0 0 0-7-7Z"/></svg>'
|
|
91
|
+
}
|
|
92
|
+
if (!this.$r.icons.copyright) {
|
|
93
|
+
this.$r.icons.copyright = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M10.08 10.86c.05-.33.16-.62.3-.86c.3-.56.81-.85 1.5-.86c.45 0 .86.2 1.15.49c.28.31.47.74.47 1.17h1.8c-.02-.47-.11-.9-.3-1.3c-.15-.38-.38-.72-.68-1c-1.45-1.34-4.14-1.15-5.37.37c-1.29 1.67-1.32 4.59-.01 6.26c1.21 1.49 3.86 1.7 5.3.37c.31-.25.56-.56.76-.92c.16-.36.27-.74.28-1.15H13.5c0 .21-.07.4-.16.57c-.09.19-.21.34-.34.47c-.33.26-.72.4-1.14.4c-.36-.01-.66-.08-.89-.23a1.41 1.41 0 0 1-.59-.64c-.5-.9-.42-2.15-.3-3.14M12 2C6.5 2 2 6.5 2 12c.53 13.27 19.5 13.26 20 0c0-5.5-4.5-10-10-10m0 18c-4.41 0-8-3.59-8-8c.44-10.61 15.56-10.61 16 0c0 4.41-3.59 8-8 8Z"/></svg>'
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
async beforeMount() {
|
|
97
|
+
await this.add();
|
|
98
|
+
},
|
|
99
|
+
watch: {
|
|
100
|
+
modelValue: function () {
|
|
101
|
+
this.map.flyTo(this.modelValue);
|
|
102
|
+
},
|
|
103
|
+
markers: function () {
|
|
104
|
+
this.printMarkers()
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
methods: {
|
|
108
|
+
showConfirm() {
|
|
109
|
+
if (this.$storage.has('map_location_access')) {
|
|
110
|
+
this.getLocation()
|
|
111
|
+
} else {
|
|
112
|
+
this.confirm = true
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
go(e) {
|
|
116
|
+
if (e.lat) {
|
|
117
|
+
this.map.flyTo([e.lat, e.lon]);
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
initMap() {
|
|
121
|
+
let opt = {
|
|
122
|
+
maxZoom: 19,
|
|
123
|
+
zoomControl: false,
|
|
124
|
+
minZoom: 3,
|
|
125
|
+
noWrap: true
|
|
126
|
+
};
|
|
127
|
+
this.layers[this.$t('map_hot', 'renusify')] = this.L.tileLayer(
|
|
128
|
+
"https://tile-{s}.openstreetmap.fr/hot/{z}/{x}/{y}.png",
|
|
129
|
+
opt
|
|
130
|
+
);
|
|
131
|
+
opt.dark = true;
|
|
132
|
+
this.layers[this.$t('map_hot_dark', 'renusify')] = this.L.tileLayer(
|
|
133
|
+
"https://tile-{s}.openstreetmap.fr/hot/{z}/{x}/{y}.png",
|
|
134
|
+
opt
|
|
135
|
+
);
|
|
136
|
+
opt.dark = false;
|
|
137
|
+
this.layers[this.$t('map_standard', 'renusify')] = this.L.tileLayer(
|
|
138
|
+
"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
|
|
139
|
+
opt
|
|
140
|
+
);
|
|
141
|
+
opt.dark = true;
|
|
142
|
+
this.layers[this.$t('map_standard_dark', 'renusify')] = this.L.tileLayer(
|
|
143
|
+
"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
|
|
144
|
+
opt
|
|
145
|
+
);
|
|
146
|
+
opt.dark = false;
|
|
147
|
+
opt.subdomains = ["mt0", "mt1", "mt2", "mt3"];
|
|
148
|
+
this.layers[this.$t('map_google', 'renusify')] = this.L.tileLayer(
|
|
149
|
+
"http://{s}.google.com/vt/lyrs=m&x={x}&y={y}&z={z}",
|
|
150
|
+
opt
|
|
151
|
+
);
|
|
152
|
+
opt.dark = true;
|
|
153
|
+
this.layers[this.$t('map_google_dark', 'renusify')] = this.L.tileLayer(
|
|
154
|
+
"http://{s}.google.com/vt/lyrs=m&x={x}&y={y}&z={z}",
|
|
155
|
+
opt
|
|
156
|
+
);
|
|
157
|
+
opt.dark = false;
|
|
158
|
+
this.layers[this.$t('map_satelite', 'renusify')] = this.L.tileLayer(
|
|
159
|
+
"http://{s}.google.com/vt/lyrs=s,h&x={x}&y={y}&z={z}",
|
|
160
|
+
opt
|
|
161
|
+
);
|
|
164
162
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
this.$emit("map", this.map);
|
|
190
|
-
this.printCopy()
|
|
191
|
-
},
|
|
192
|
-
printCopy() {
|
|
193
|
-
const attr = this.$refs.map.querySelector('.leaflet-control-attribution')
|
|
194
|
-
attr.innerHTML = '© | <a href="https://leafletjs.com" target="_blank">Leaflet</a> | <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors | Renusify'
|
|
195
|
-
},
|
|
196
|
-
printMarkers() {
|
|
197
|
-
if (!this.layerGroup) {
|
|
198
|
-
return
|
|
199
|
-
}
|
|
200
|
-
this.layerGroup.clearLayers();
|
|
201
|
-
this.markers.forEach((item) => {
|
|
202
|
-
let options = {riseOnHover: true, item: item}
|
|
203
|
-
if (item.icon) {
|
|
204
|
-
options.icon = new this.L.icon(item.icon);
|
|
205
|
-
}
|
|
206
|
-
let marker = new this.L.Marker(item.loc, options);
|
|
207
|
-
marker.addTo(this.layerGroup)
|
|
208
|
-
if (item.popup) {
|
|
209
|
-
marker.bindPopup(item.popup);
|
|
210
|
-
}
|
|
211
|
-
if (item.open_popup) {
|
|
212
|
-
marker.openPopup();
|
|
213
|
-
}
|
|
214
|
-
if (item.tooltip) {
|
|
215
|
-
marker.bindTooltip(item.tooltip);
|
|
216
|
-
}
|
|
217
|
-
if (item.open_tooltip) {
|
|
218
|
-
marker.openTooltip();
|
|
219
|
-
}
|
|
220
|
-
if (item.click) {
|
|
221
|
-
marker.on('click', item.click)
|
|
222
|
-
}
|
|
223
|
-
})
|
|
224
|
-
},
|
|
225
|
-
getLocation() {
|
|
226
|
-
this.$storage.set('map_location_access', true)
|
|
227
|
-
this.confirm = false
|
|
228
|
-
this.loading = true;
|
|
229
|
-
if (navigator.geolocation) {
|
|
230
|
-
navigator.geolocation.getCurrentPosition(
|
|
231
|
-
this.showPosition,
|
|
232
|
-
this.showError
|
|
233
|
-
);
|
|
234
|
-
} else {
|
|
235
|
-
this.loading = false;
|
|
236
|
-
this.$toast(this.$t("map_not_support_location",'renusify'), {type: "error"});
|
|
237
|
-
}
|
|
238
|
-
},
|
|
239
|
-
showPosition(position) {
|
|
240
|
-
this.map.flyTo([position.coords.latitude, position.coords.longitude]);
|
|
241
|
-
this.map.zoom = 18;
|
|
242
|
-
this.loading = false;
|
|
243
|
-
},
|
|
244
|
-
showError(error) {
|
|
245
|
-
this.loading = false;
|
|
246
|
-
switch (error.code) {
|
|
247
|
-
case error.PERMISSION_DENIED:
|
|
248
|
-
this.$toast(this.$t("map_access_denied",'renusify'), {type: "error"});
|
|
249
|
-
break;
|
|
250
|
-
default:
|
|
251
|
-
this.$toast(this.$t("map_unavailable",'renusify'), {type: "error"});
|
|
252
|
-
break;
|
|
253
|
-
}
|
|
254
|
-
},
|
|
255
|
-
async add() {
|
|
256
|
-
import('./leaflet.css')
|
|
257
|
-
this.L = await import('./leaflet')
|
|
258
|
-
this.run();
|
|
259
|
-
},
|
|
163
|
+
this.layers[this.$t('map_hot', 'renusify')].addTo(this.map);
|
|
164
|
+
if (this.zoomControl) {
|
|
165
|
+
this.L.control
|
|
166
|
+
.zoom({
|
|
167
|
+
zoomInTitle: this.$t("map_zoom_in", 'renusify'),
|
|
168
|
+
zoomOutTitle: this.$t("map_zoom_out", 'renusify')
|
|
169
|
+
})
|
|
170
|
+
.addTo(this.map);
|
|
171
|
+
} else {
|
|
172
|
+
this.map.touchZoom.disable();
|
|
173
|
+
this.map.doubleClickZoom.disable();
|
|
174
|
+
this.map.scrollWheelZoom.disable();
|
|
175
|
+
this.map.boxZoom.disable();
|
|
176
|
+
this.map.keyboard.disable();
|
|
177
|
+
}
|
|
178
|
+
if (this.layerControl) {
|
|
179
|
+
this.L.control.layers(this.layers).addTo(this.map);
|
|
180
|
+
}
|
|
181
|
+
const that = this;
|
|
182
|
+
this.map.on("baselayerchange", function (e) {
|
|
183
|
+
if (that.$helper.ifHas(e, false, "layer", "options", "dark")) {
|
|
184
|
+
that.dark = true;
|
|
185
|
+
} else {
|
|
186
|
+
that.dark = that.darkMode;
|
|
260
187
|
}
|
|
261
|
-
|
|
188
|
+
});
|
|
189
|
+
this.map.on("move", function () {
|
|
190
|
+
that.$emit("update:modelValue", Object.values(that.map.getCenter()));
|
|
191
|
+
});
|
|
192
|
+
},
|
|
193
|
+
run() {
|
|
194
|
+
this.map = this.L.map(this.map_id, {
|
|
195
|
+
center: this.center,
|
|
196
|
+
zoom: this.zoom,
|
|
197
|
+
zoomControl: false,
|
|
198
|
+
dragging: !this.disableMove,
|
|
199
|
+
tap: !this.disableMove
|
|
200
|
+
});
|
|
201
|
+
this.initMap();
|
|
202
|
+
this.layerGroup = new this.L.layerGroup().addTo(this.map);
|
|
203
|
+
this.printMarkers()
|
|
204
|
+
this.$emit("update:modelValue", this.center);
|
|
205
|
+
this.$emit("leaflet", this.L);
|
|
206
|
+
this.$emit("map", this.map);
|
|
207
|
+
this.printCopy()
|
|
208
|
+
},
|
|
209
|
+
printCopy() {
|
|
210
|
+
const attr = this.$refs.map.querySelector('.leaflet-control-attribution')
|
|
211
|
+
attr.innerHTML = '© | <a href="https://leafletjs.com" target="_blank">Leaflet</a> | <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors | Renusify'
|
|
212
|
+
},
|
|
213
|
+
printMarkers() {
|
|
214
|
+
if (!this.layerGroup) {
|
|
215
|
+
return
|
|
216
|
+
}
|
|
217
|
+
this.layerGroup.clearLayers();
|
|
218
|
+
this.markers.forEach((item) => {
|
|
219
|
+
let options = {riseOnHover: true, item: item}
|
|
220
|
+
if (item.icon) {
|
|
221
|
+
options.icon = new this.L.icon(item.icon);
|
|
222
|
+
}
|
|
223
|
+
let marker = new this.L.Marker(item.loc, options);
|
|
224
|
+
marker.addTo(this.layerGroup)
|
|
225
|
+
if (item.popup) {
|
|
226
|
+
marker.bindPopup(item.popup);
|
|
227
|
+
}
|
|
228
|
+
if (item.open_popup) {
|
|
229
|
+
marker.openPopup();
|
|
230
|
+
}
|
|
231
|
+
if (item.tooltip) {
|
|
232
|
+
marker.bindTooltip(item.tooltip);
|
|
233
|
+
}
|
|
234
|
+
if (item.open_tooltip) {
|
|
235
|
+
marker.openTooltip();
|
|
236
|
+
}
|
|
237
|
+
if (item.click) {
|
|
238
|
+
marker.on('click', item.click)
|
|
239
|
+
}
|
|
240
|
+
})
|
|
241
|
+
},
|
|
242
|
+
getLocation() {
|
|
243
|
+
this.$storage.set('map_location_access', true)
|
|
244
|
+
this.confirm = false
|
|
245
|
+
this.loading = true;
|
|
246
|
+
if (navigator.geolocation) {
|
|
247
|
+
navigator.geolocation.getCurrentPosition(
|
|
248
|
+
this.showPosition,
|
|
249
|
+
this.showError
|
|
250
|
+
);
|
|
251
|
+
} else {
|
|
252
|
+
this.loading = false;
|
|
253
|
+
this.$toast(this.$t("map_not_support_location", 'renusify'), {type: "error"});
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
showPosition(position) {
|
|
257
|
+
this.map.flyTo([position.coords.latitude, position.coords.longitude]);
|
|
258
|
+
this.map.zoom = 18;
|
|
259
|
+
this.loading = false;
|
|
260
|
+
},
|
|
261
|
+
showError(error) {
|
|
262
|
+
this.loading = false;
|
|
263
|
+
switch (error.code) {
|
|
264
|
+
case error.PERMISSION_DENIED:
|
|
265
|
+
this.$toast(this.$t("map_access_denied", 'renusify'), {type: "error"});
|
|
266
|
+
break;
|
|
267
|
+
default:
|
|
268
|
+
this.$toast(this.$t("map_unavailable", 'renusify'), {type: "error"});
|
|
269
|
+
break;
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
async add() {
|
|
273
|
+
import('./leaflet.css')
|
|
274
|
+
await import('./leaflet')
|
|
275
|
+
this.L = global.L
|
|
276
|
+
this.run();
|
|
277
|
+
},
|
|
278
|
+
}
|
|
279
|
+
};
|
|
262
280
|
</script>
|
|
263
281
|
|
|
264
282
|
<style lang="scss">
|
|
265
|
-
|
|
283
|
+
@import "~renusify/style/include";
|
|
266
284
|
|
|
267
|
-
|
|
268
|
-
|
|
285
|
+
.#{$prefix}map {
|
|
286
|
+
position: relative;
|
|
269
287
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
288
|
+
.leaflet-popup {
|
|
289
|
+
max-width: 250px;
|
|
290
|
+
}
|
|
273
291
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
292
|
+
.leaflet-popup-content {
|
|
293
|
+
text-align: center;
|
|
294
|
+
}
|
|
277
295
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
296
|
+
.map-box {
|
|
297
|
+
z-index: 1;
|
|
298
|
+
}
|
|
281
299
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
300
|
+
.map-search {
|
|
301
|
+
width: 400px;
|
|
302
|
+
position: absolute;
|
|
303
|
+
top: 0;
|
|
304
|
+
left: 0;
|
|
305
|
+
right: 0;
|
|
306
|
+
margin-right: auto;
|
|
307
|
+
margin-left: auto;
|
|
308
|
+
z-index: 2;
|
|
309
|
+
max-width: calc(100vw - 130px);
|
|
310
|
+
}
|
|
293
311
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
312
|
+
.map-location {
|
|
313
|
+
position: absolute;
|
|
314
|
+
left: 10px;
|
|
315
|
+
bottom: 10px;
|
|
316
|
+
z-index: 2;
|
|
317
|
+
}
|
|
300
318
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
319
|
+
&.map-dark .leaflet-tile {
|
|
320
|
+
-webkit-filter: hue-rotate(180deg) invert(100%);
|
|
321
|
+
}
|
|
304
322
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
323
|
+
.map-attribution {
|
|
324
|
+
position: absolute;
|
|
325
|
+
right: 10px;
|
|
326
|
+
bottom: 10px;
|
|
327
|
+
z-index: 2;
|
|
328
|
+
}
|
|
311
329
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
330
|
+
.leaflet-control-attribution {
|
|
331
|
+
transition: all 0.3s ease-in-out;
|
|
332
|
+
position: absolute;
|
|
333
|
+
bottom: -30px;
|
|
334
|
+
right: 0;
|
|
335
|
+
width: 100vw;
|
|
336
|
+
direction: ltr;
|
|
337
|
+
}
|
|
320
338
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
339
|
+
&.attribution-show {
|
|
340
|
+
.map-attribution {
|
|
341
|
+
bottom: 20px;
|
|
342
|
+
}
|
|
325
343
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
}
|
|
329
|
-
}
|
|
344
|
+
.leaflet-control-attribution {
|
|
345
|
+
bottom: 0;
|
|
330
346
|
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
331
349
|
</style>
|