renusify 1.4.3 → 1.4.7

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.
Files changed (53) hide show
  1. package/components/app/index.vue +1 -10
  2. package/components/chip/style.scss +0 -1
  3. package/components/codeEditor/highlightHtml.vue +8 -2
  4. package/components/codeEditor/index.vue +13 -55
  5. package/components/codeEditor/mixin.js +18 -4
  6. package/components/form/camInput.vue +6 -2
  7. package/components/form/input.vue +2 -2
  8. package/components/form/inputTel/assets/flags.png +0 -0
  9. package/components/form/inputTel/assets/flags@2x.png +0 -0
  10. package/components/form/mask-input.vue +2 -2
  11. package/components/form/select.vue +1 -1
  12. package/components/form/text-area.vue +1 -2
  13. package/components/form/text-editor/index.vue +0 -1
  14. package/components/form/timepicker/index.vue +18 -16
  15. package/components/form/unit-input.vue +1 -0
  16. package/components/formCreator/index.vue +7 -20
  17. package/components/index.js +1 -1
  18. package/components/infinite/index.vue +9 -6
  19. package/components/map/images/destination.png +0 -0
  20. package/components/map/images/layers.png +0 -0
  21. package/components/map/images/marker-icon.png +0 -0
  22. package/components/map/images/origin.png +0 -0
  23. package/components/map/images/point.png +0 -0
  24. package/components/map/index.vue +52 -20
  25. package/components/map/leaflet.css +511 -397
  26. package/components/map/route.vue +570 -560
  27. package/components/map/select.vue +64 -48
  28. package/components/message/index.vue +22 -21
  29. package/components/modal/index.vue +20 -7
  30. package/components/modal/style.scss +17 -14
  31. package/components/{app/notify → notify}/index.vue +21 -29
  32. package/components/{app/notify → notify}/notification.vue +10 -10
  33. package/components/notify/notify.js +27 -0
  34. package/components/searchBox/index.vue +30 -12
  35. package/components/slider/index.vue +1 -0
  36. package/components/table/crud/header.vue +55 -34
  37. package/components/table/crud/index.vue +4 -4
  38. package/components/table/index.vue +366 -367
  39. package/components/table/style.scss +1 -4
  40. package/components/tabs/index.vue +9 -23
  41. package/components/timeAgo/index.vue +4 -1
  42. package/components/tour/index.vue +237 -222
  43. package/components/tree/index.vue +135 -136
  44. package/components/tree/tree-element.vue +17 -3
  45. package/directive/index.js +1 -2
  46. package/directive/mask/index.js +1 -4
  47. package/directive/skeleton/index.js +27 -0
  48. package/directive/skeleton/style.scss +37 -0
  49. package/index.js +14 -9
  50. package/package.json +1 -1
  51. package/style/transitions.scss +6 -116
  52. package/tools/helper.js +20 -0
  53. package/components/app/notify/notify.js +0 -28
@@ -8,30 +8,21 @@
8
8
  <slot></slot>
9
9
  </div>
10
10
  <r-toast></r-toast>
11
- <r-notify v-if="notify" :left="notifyLeft" :top="notifyTop">
12
- <template #content="props">
13
- <slot name="notify" :item="props"></slot>
14
- </template>
15
- </r-notify>
16
11
  </div>
17
12
  </template>
18
13
 
19
14
  <script>
20
15
  import './style.scss'
21
16
  import RToast from './toast/index.vue'
22
- import RNotify from './notify/index.vue'
23
17
 
24
18
  export default {
25
19
  name: 'r-app',
26
- components: {RToast, RNotify},
20
+ components: {RToast},
27
21
  props: {
28
22
  id: {
29
23
  type: [String, Number],
30
24
  default: 'renusify'
31
25
  },
32
- notify: Boolean,
33
- notifyLeft: Boolean,
34
- notifyTop: Boolean,
35
26
  rtl: {type: Boolean, default: undefined}
36
27
  },
37
28
  computed: {
@@ -56,7 +56,6 @@ $icon-sizes: (
56
56
 
57
57
 
58
58
  border-color: var(--color-divider);
59
- color: var(--color-text-primary);
60
59
 
61
60
  &:not(.chip-active) {
62
61
  background: #e0e0e0;
@@ -52,7 +52,7 @@ export default {
52
52
  res = this.re_func(res);
53
53
 
54
54
  res = res.replace(/(&lt;+[\s\S]+&gt;)/g, '<span class="color-orange code-editor-span">$1</span>')
55
- res = res.replace(/(\{\{+[\s\S]+}})/g, '<span class="color-blue code-editor-span">$1</span>')
55
+ res = res.replace(/\{\{([^}]+)}}/g, '<span class="color-blue code-editor-span">{{$1}}</span>')
56
56
  return res;
57
57
  },
58
58
  },
@@ -74,7 +74,13 @@ export default {
74
74
  this.openTag = null
75
75
  return false
76
76
  }
77
-
77
+ if (event.key === "=") {
78
+ const end = event.target.selectionEnd;
79
+ event.preventDefault()
80
+ document.execCommand('insertText', false, '=""');
81
+ event.target.selectionEnd = end + 2;
82
+ return false;
83
+ }
78
84
  return this.setTab(event)
79
85
  },
80
86
  re_comment(res) {
@@ -25,37 +25,33 @@
25
25
  <r-icon v-html="$r.icons.code_tags" exact></r-icon>
26
26
  </r-btn>
27
27
  </div>
28
- <div v-show="false" ref="codeSlot">
29
- <slot></slot>
30
- </div>
31
28
  <div v-if="show === 'run' && runnable" class="code-compile">
32
29
  <r-code-editor-run
33
30
  :id="id"
34
- :script="script"
35
- :style="style"
36
- :template="template"
31
+ :script="scr"
32
+ :style="sty"
33
+ :template="temp"
37
34
  ></r-code-editor-run>
38
35
  </div>
39
36
  <div v-show="show !== 'run'" ref="codeView" class="code-wrapper">
40
- <div v-show="templateShow">
41
- <span class="color-green">&lt;template&gt;</span>
37
+ <div>
38
+ <span v-show="templateShow" class="color-green">&lt;template&gt;</span>
42
39
  <highlight-html ref="h-html" v-model="temp"></highlight-html>
43
- <span class="color-green">&lt;/template&gt;</span>
44
- <br/>
40
+ <span v-show="templateShow" class="color-green">&lt;/template&gt;</span>
45
41
  </div>
46
- <div v-show="scriptShow">
47
- <span class="color-orange"
42
+ <div>
43
+ <span v-show="scriptShow" class="color-orange"
48
44
  >&lt;script&gt;<br/>export default {</span
49
45
  >
50
46
  <highlight-script ref="h-js" v-model="scr"></highlight-script>
51
- <span class="color-orange">}<br/>&lt;script&gt;</span>
47
+ <span v-show="scriptShow" class="color-orange">}<br/>&lt;script&gt;</span>
52
48
  </div>
53
- <div v-show="styleShow">
54
- <span class="color-orange"
49
+ <div>
50
+ <span v-show="styleShow" class="color-orange"
55
51
  >&lt;style lang<span class="color-green">="css"</span>&gt;</span
56
52
  >
57
53
  <highlight-css ref="h-css" v-model="sty"></highlight-css>
58
- <span class="color-orange">&lt;style&gt;</span>
54
+ <span v-show="styleShow" class="color-orange">&lt;style&gt;</span>
59
55
  </div>
60
56
  </div>
61
57
  </div>
@@ -101,9 +97,6 @@ export default {
101
97
  '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="m14.6 16.6l4.6-4.6l-4.6-4.6L16 6l6 6l-6 6l-1.4-1.4m-5.2 0L4.8 12l4.6-4.6L8 6l-6 6l6 6l1.4-1.4Z"/></svg>';
102
98
  }
103
99
  },
104
- mounted() {
105
- this.get_code("codeSlot");
106
- },
107
100
  watch: {
108
101
  template: function (n) {
109
102
  this.temp = n
@@ -129,42 +122,7 @@ export default {
129
122
  this.temp = this.$refs["h-html"].pretty_html(this.temp)
130
123
  this.scr = this.$refs["h-js"].pretty_js(this.scr)
131
124
  this.sty = this.$refs["h-css"].pretty_js(this.sty)
132
- },
133
- toHTML(htmlString) {
134
- let div = document.createElement("div");
135
- div.innerHTML = htmlString;
136
- return div;
137
- },
138
- get_code(slot = "codeSlot") {
139
- if (!this.$refs[slot]) {
140
- setTimeout(() => {
141
- this.get_code(slot);
142
- }, 100);
143
- return;
144
- }
145
-
146
- this.code = this.toHTML(this.$refs[slot].innerHTML);
147
- let temp = this.code.querySelector(".code-template");
148
-
149
- if (temp && temp.childNodes.length > 0) {
150
- for (let i = 0; i < temp.childNodes.length; i++) {
151
- if (temp.childNodes[i].nodeName === "#comment") {
152
- this.template = this.toHTML(temp.childNodes[i].nodeValue).innerHTML;
153
- break;
154
- }
155
- }
156
- }
157
-
158
- let script = this.code.querySelector(".code-script");
159
- if (script && script.childNodes.length > 0) {
160
- for (let i = 0; i < script.childNodes.length; i++) {
161
- if (script.childNodes[i].nodeName === "#comment") {
162
- this.script = script.childNodes[i].nodeValue;
163
- break;
164
- }
165
- }
166
- }
167
- },
125
+ }
168
126
  },
169
127
  };
170
128
  </script>
@@ -1,6 +1,10 @@
1
1
  export default {
2
2
  methods: {
3
3
  pretty_html(text) {
4
+ if (!text) {
5
+ return ''
6
+ }
7
+ text = text.trim()
4
8
  text = text.replace(/ +(?= )/g, '');
5
9
  text = text.replace(/[\r|\n|\t]/g, '');
6
10
  let r = ''
@@ -18,9 +22,14 @@ export default {
18
22
  }
19
23
  }
20
24
  })
25
+ r = r.replace(/<([^/].*)>+[\r|\n|\t]+<\//g, '<$1></');
21
26
  return r
22
27
  },
23
28
  pretty_js(text) {
29
+ if (!text) {
30
+ return ''
31
+ }
32
+ text = text.trim()
24
33
  text = text.replace(/ +(?= )/g, '');
25
34
  text = text.replace(/[\r|\n|\t]/g, '');
26
35
  text = text.replace(/([,|;|{|(|\[])+[\s]/g, '$1');
@@ -50,6 +59,9 @@ export default {
50
59
  if (c === '}') {
51
60
  numopen -= 1
52
61
  }
62
+ if (numopen < 0) {
63
+ numopen = 0
64
+ }
53
65
  r += c
54
66
  if (c === '}' && next !== ',' && next !== ';' && next !== '}' && next !== ')') {
55
67
  r += '\n' + '\t'.repeat(numopen)
@@ -60,7 +72,8 @@ export default {
60
72
  if (c === ';' && next !== '}') {
61
73
  r += '\n' + '\t'.repeat(numopen)
62
74
  }
63
- if (next === '}' && c !== '{') {
75
+ if (next === '}' && c !== '{' && numopen > 0) {
76
+
64
77
  r += '\n' + '\t'.repeat(numopen - 1)
65
78
  }
66
79
 
@@ -112,11 +125,12 @@ export default {
112
125
  if (event.keyCode === 13) {
113
126
  event.preventDefault()
114
127
  let n = event.target.value.substr(0, event.target.selectionStart).split('\n')
115
- n = n[n.length - 1].split('')
128
+ n = n[n.length - 1].split('\t')
129
+
116
130
  let w = ''
117
131
  for (let i = 0; i < n.length; i++) {
118
- if (n[i] === ' ') {
119
- w += ' '
132
+ if (n[i] === '') {
133
+ w += '\t'
120
134
  } else {
121
135
  break
122
136
  }
@@ -133,7 +133,7 @@ export default {
133
133
  },
134
134
  headers: Object
135
135
  },
136
- emits:['update:modelValue','error'],
136
+ emits: ['update:modelValue', 'error'],
137
137
  data() {
138
138
  return {
139
139
  started: false,
@@ -268,7 +268,11 @@ export default {
268
268
  },
269
269
  (err) => {
270
270
  this.uploadPercentage = 0;
271
- this.$emit('error', err.response.data)
271
+ if (err.response) {
272
+ this.$emit('error', err.response.data)
273
+ } else {
274
+ this.$emit('error', err)
275
+ }
272
276
  }
273
277
  );
274
278
  },
@@ -2,7 +2,7 @@
2
2
  <div
3
3
  :class="{
4
4
  [`${$r.prefix}input-container`]:true,
5
- [c_color]:c_color&&!isDisabled,
5
+ [c_color]:c_color&&!isDisabled&&!hasError,
6
6
  'color-error-text':hasError&&genMessages.length>0,
7
7
  'hide-detail':c_hide,
8
8
  'input-focused':active,
@@ -521,7 +521,7 @@ export default {
521
521
  }
522
522
  }
523
523
 
524
- &.text-area {
524
+ &.#{$prefix}text-area {
525
525
  .input-control {
526
526
  height: auto;
527
527
 
@@ -74,11 +74,11 @@
74
74
  for (let i = 0; i <lng; i++) {
75
75
  const dataChar = data.charAt(n);
76
76
  const maskChar = mask.charAt(i);
77
- switch (maskChar) {
77
+
78
+ switch (maskChar) {
78
79
  case 'N':
79
80
  if (/[0-9]/.test(dataChar)) {
80
81
  dataOutput += dataChar;
81
-
82
82
  }
83
83
  n++
84
84
  break;
@@ -11,7 +11,7 @@
11
11
  'flex-nowrap':!multiple
12
12
  }">
13
13
  <r-chip
14
- class="my-0 ms-0"
14
+ class="my-0 ms-0 color-primary-text"
15
15
  :close="multiple&&!textChip"
16
16
  :key="key"
17
17
  :text="textChip || !multiple"
@@ -3,8 +3,7 @@
3
3
  v-model="lazyValue"
4
4
  @click.stop="handleClick()"
5
5
  @update:model-value="emit"
6
- class="text-area"
7
- :class="{'no-resize':noResize}"
6
+ :class="[`${$r.prefix}text-area`,{'no-resize':noResize}]"
8
7
  >
9
8
  <template v-slot="{uid}">
10
9
  <textarea @focusin="active=true"
@@ -37,7 +37,6 @@
37
37
  <r-select-input :label="$t('class','renusify')" :model-value="[...selectElm.classList]"
38
38
  multiple
39
39
  tags
40
- disableSearch
41
40
  justValue
42
41
  @update:model-value="addClass"></r-select-input>
43
42
  </r-col>
@@ -30,22 +30,24 @@
30
30
  :withSec="withSec"
31
31
  v-model="lazyValue"
32
32
  ></timepicker>
33
- <r-btn
34
- class="color-success-text ml-7 mr-9 mb-3 mt-3"
35
- outlined
36
- @click="show_modal = false,emit()"
37
- >
38
- {{ $t('accept', 'renusify') }}
39
- </r-btn
40
- >
41
- <r-btn
42
- class="color-warning-text mr-7 ml-4 mb-3 mt-3"
43
- outlined
44
- @click="(show_modal = false), (lazyValue = null),emit()"
45
- >
46
- {{ $t('cancel', 'renusify') }}
47
- </r-btn
48
- >
33
+ <div class="my-3 d-flex h-space-between">
34
+ <r-btn
35
+ class="color-success-text"
36
+ outlined
37
+ @click="show_modal = false,emit()"
38
+ >
39
+ {{ $t('accept', 'renusify') }}
40
+ </r-btn
41
+ >
42
+ <r-btn
43
+ class="color-warning-text"
44
+ outlined
45
+ @click="(show_modal = false), (lazyValue = null),emit()"
46
+ >
47
+ {{ $t('cancel', 'renusify') }}
48
+ </r-btn
49
+ >
50
+ </div>
49
51
  </r-card>
50
52
  </r-modal>
51
53
  </div>
@@ -99,6 +99,7 @@ emits:['update:modelValue'],
99
99
 
100
100
  .input-control {
101
101
  border-radius: 0;
102
+ padding: 4px;
102
103
  @include rtl() {
103
104
  border-right: 1px solid var(--c-unit) !important;
104
105
  }
@@ -6,9 +6,9 @@
6
6
  <r-row>
7
7
  <template :key="key" v-for="(item,key) in options">
8
8
  <r-col v-if="item['formInput']!==false&&iff(options[key])"
9
- :class="options[key]['r-col']?options[key]['r-col']:'col-12'">
9
+ :class="options[key]['class']?options[key]['class']:'col-12'">
10
10
  <component
11
- :is="buildName(item['type'])"
11
+ :is="item['type']"
12
12
  :label="$t(key)"
13
13
  v-model="editedItem[key]"
14
14
  v-bind="getAttr(options[key])"
@@ -99,12 +99,6 @@ export default {
99
99
  }
100
100
  },
101
101
  methods: {
102
- buildName(name) {
103
- if (name.startsWith('r-')) {
104
- return name
105
- }
106
- return 'r-' + name
107
- },
108
102
  iff(data) {
109
103
  const that = this
110
104
 
@@ -152,18 +146,11 @@ export default {
152
146
  return true
153
147
  },
154
148
  getAttr(data) {
155
- let res = {}
156
- for (let i in data) {
157
- if (this.$helper.hasKey(data, i) && !['formInput', 'sortable', 'type', 'tableShow', 'priority', '$if', 'r-col'].includes(i)) {
158
- if (i === '$bind') {
159
- data[i].forEach((item) => {
160
- res[item[0]] = this.editedItem[item[1]]
161
- })
162
-
163
- } else {
164
- res[i] = data[i]
165
- }
166
- }
149
+ let res = data['props'] ? data['props'] : {}
150
+ if (data['$bind']) {
151
+ data['$bind'].forEach((item) => {
152
+ res[item[0]] = this.editedItem[item[1]]
153
+ })
167
154
  }
168
155
  return res
169
156
  },
@@ -1,5 +1,6 @@
1
1
  const list = {
2
2
  'r-app': {'p': 'app/index.vue', 'c': ['r-btn', 'r-icon', 'r-spacer'], 'd': []},
3
+ 'r-notify': {'p': 'notify/index.vue', 'c': ['r-btn', 'r-icon'], 'd': []},
3
4
  'r-avatar': {'p': 'avatar/index.vue', 'c': ['r-btn', 'r-icon'], 'd': []},
4
5
  'r-toolbar': {
5
6
  'p': 'bar/toolbar/index.vue',
@@ -146,7 +147,6 @@ const list = {
146
147
  'c': ['r-progress-line', 'r-card', 'r-list', 'r-btn', 'r-icon', 'r-select-input'],
147
148
  'd': ['click-outside']
148
149
  },
149
- 'r-skeleton': {'p': 'skeleton/index.vue', 'c': [], 'd': []},
150
150
  'r-slider': {'p': 'slider/index.vue', 'c': ['r-progress-line', 'r-btn', 'r-icon'], 'd': ['touch']},
151
151
  'r-swiper': {'p': 'swiper/index.vue', 'c': [], 'd': ['touch']},
152
152
  'r-table': {
@@ -13,17 +13,19 @@
13
13
  </r-col>
14
14
  </r-row>
15
15
  </r-container>
16
- <r-infinite-div class="pt-0"
16
+ <r-infinite-div class="pt-0"
17
17
  :url="url"
18
18
  :height="height"
19
19
  :query="query"
20
20
  :live-timer="liveTimer"
21
- :is-chat="isChat"
22
- :live="live">
21
+ :is-chat="isChat"
22
+ :headers="headers"
23
+ :live="live"
24
+ >
23
25
 
24
- <template v-slot="{item}">
25
- <slot v-bind:item="item"></slot>
26
- </template>
26
+ <template v-slot="{item}">
27
+ <slot v-bind:item="item"></slot>
28
+ </template>
27
29
 
28
30
  </r-infinite-div>
29
31
  </r-card>
@@ -59,6 +61,7 @@
59
61
  default: 10000,
60
62
  type: Number
61
63
  },
64
+ headers: Object
62
65
  },
63
66
  data() {
64
67
  return {
Binary file
Binary file
Binary file
@@ -1,16 +1,19 @@
1
1
  <template>
2
2
  <div ref="map"
3
+ :style="{
4
+ '--map-image-layers':`url(${iconLayers})`
5
+ }"
3
6
  :class="{[`${$r.prefix}map`]:true,'map-dark': dark, 'attribution-show': attribution }"
4
7
  >
5
8
  <div class="map-search" v-if="searchBox">
6
9
  <r-search-box
7
10
  :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
11
  :notFoundMsg="$t('map_not_found','renusify')"
12
+ inputClass="sheet"
13
+ no-overlay
14
+ query="q"
15
+ url="https://nominatim.openstreetmap.org/search.php?polygon_geojson=0&accept-language=fa&countrycodes=IR&format=jsonv2"
16
+ @select="go"
14
17
  >
15
18
  <template v-slot="{ item }">
16
19
  {{ item["display_name"] }}
@@ -21,20 +24,20 @@
21
24
 
22
25
  <r-btn
23
26
  v-if="meLocation"
27
+ :loading="loading"
24
28
  class="map-location color-white color-primary-text"
25
29
  icon
26
30
  @click.prevent="showConfirm"
27
- :loading="loading"
28
31
  >
29
32
  <r-icon v-html="$r.icons.crosshairs_gps"></r-icon>
30
33
  </r-btn>
31
34
  <r-btn
32
- class="map-attribution color-white color-primary-text"
33
- @click.prevent="attribution = !attribution"
34
- size="x-small"
35
+ class="map-attribution color-white color-black-text"
35
36
  icon
37
+ size="x-small"
38
+ @click.prevent="attribution = !attribution"
36
39
  >
37
- <r-icon v-html="$r.icons.copyright" exact></r-icon>
40
+ C
38
41
  </r-btn>
39
42
 
40
43
  <r-confirm v-model="confirm"
@@ -54,7 +57,10 @@ export default {
54
57
  center: {
55
58
  type: Array,
56
59
  default: () => {
57
- return [35.69940749291485, 51.33705139160157];
60
+ return [
61
+ 35.69973857757377,
62
+ 51.33806092139637
63
+ ];
58
64
  }
59
65
  },
60
66
  markers: {
@@ -68,10 +74,13 @@ export default {
68
74
  layerControl: {type: Boolean, default: true},
69
75
  meLocation: {type: Boolean, default: true},
70
76
  disableMove: {type: Boolean, default: false},
71
- darkMode: Boolean
77
+ darkMode: Boolean,
78
+ mapImageMarker: String,
79
+ mapImageLayers: String
72
80
  },
73
81
  data() {
74
82
  return {
83
+ timeout_id: null,
75
84
  dark: this.darkMode,
76
85
  attribution: false,
77
86
  confirm: false,
@@ -84,26 +93,37 @@ export default {
84
93
  license: '&copy; | <a href="https://leafletjs.com" target="_blank">Leaflet</a> | <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors | Renusify'
85
94
  };
86
95
  },
87
- emits:['update:modelValue','leaflet','map'],
96
+ emits: ['update:modelValue', 'leaflet', 'map'],
88
97
  created() {
89
98
  if (!this.$r.icons.crosshairs_gps) {
90
99
  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
100
  }
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
101
  },
96
102
  async beforeMount() {
97
103
  await this.add();
98
104
  },
99
105
  watch: {
100
- modelValue: function () {
106
+ modelValue: function (n, o) {
101
107
  this.map.flyTo(this.modelValue);
102
108
  },
103
109
  markers: function () {
104
110
  this.printMarkers()
105
111
  }
106
112
  },
113
+ computed: {
114
+ iconLayers() {
115
+ if (this.mapImageLayers) {
116
+ return this.mapImageLayers
117
+ }
118
+ return require('./images/layers.png')
119
+ },
120
+ iconMarker() {
121
+ if (this.mapImageMarker) {
122
+ return this.mapImageMarker
123
+ }
124
+ return require('./images/marker-icon.png')
125
+ }
126
+ },
107
127
  methods: {
108
128
  showConfirm() {
109
129
  if (this.$storage.has('map_location_access')) {
@@ -114,7 +134,7 @@ export default {
114
134
  },
115
135
  go(e) {
116
136
  if (e.lat) {
117
- this.map.flyTo([e.lat, e.lon]);
137
+ this.$emit("update:modelValue", [parseFloat(e.lat), parseFloat(e.lon)]);
118
138
  }
119
139
  },
120
140
  initMap() {
@@ -186,8 +206,13 @@ export default {
186
206
  that.dark = that.darkMode;
187
207
  }
188
208
  });
189
- this.map.on("move", function () {
190
- that.$emit("update:modelValue", Object.values(that.map.getCenter()));
209
+ this.map.on("move", function (e) {
210
+ if (e.originalEvent) {
211
+ clearTimeout(that.timeout_id)
212
+ that.timeout_id = setTimeout(() => {
213
+ that.$emit("update:modelValue", Object.values(that.map.getCenter()));
214
+ }, 100)
215
+ }
191
216
  });
192
217
  },
193
218
  run() {
@@ -219,6 +244,13 @@ export default {
219
244
  let options = {riseOnHover: true, item: item}
220
245
  if (item.icon) {
221
246
  options.icon = new this.L.icon(item.icon);
247
+ } else {
248
+ options.icon = new this.L.icon({
249
+ iconUrl: this.iconMarker,
250
+ iconSize: [30, 30],
251
+ iconAnchor: [15, 30],
252
+ popupAnchor: [0, -30]
253
+ });
222
254
  }
223
255
  let marker = new this.L.Marker(item.loc, options);
224
256
  marker.addTo(this.layerGroup)