glib-web 0.5.77
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/.eslintrc.js +37 -0
- package/LICENSE +201 -0
- package/README.md +33 -0
- package/action.js +167 -0
- package/actions/analytics/logEvent.js +26 -0
- package/actions/auth/creditCard.js +29 -0
- package/actions/auth/restart.js +5 -0
- package/actions/auth/saveCsrfToken.js +12 -0
- package/actions/cables/push.js +38 -0
- package/actions/dialogs/alert.js +15 -0
- package/actions/dialogs/close.js +7 -0
- package/actions/dialogs/notification.js +14 -0
- package/actions/dialogs/oauth.js +6 -0
- package/actions/dialogs/open.js +7 -0
- package/actions/dialogs/options.js +5 -0
- package/actions/dialogs/show.js +5 -0
- package/actions/forms/submit.js +15 -0
- package/actions/http/delete.js +7 -0
- package/actions/http/patch.js +7 -0
- package/actions/http/post.js +7 -0
- package/actions/http/put.js +7 -0
- package/actions/panels/scrollTo.js +18 -0
- package/actions/panels/scrollToBottom.js +11 -0
- package/actions/runMultiple.js +11 -0
- package/actions/sheets/select.js +5 -0
- package/actions/snackbars/alert.js +15 -0
- package/actions/snackbars/select.js +5 -0
- package/actions/timeouts/set.js +20 -0
- package/actions/windows/close.js +13 -0
- package/actions/windows/closeAll.js +16 -0
- package/actions/windows/closeWithReload.js +18 -0
- package/actions/windows/open.js +5 -0
- package/actions/windows/openWeb.js +5 -0
- package/actions/windows/refreshState.js +5 -0
- package/actions/windows/reload.js +24 -0
- package/actions/ws/push.js +35 -0
- package/app.vue +180 -0
- package/components/_button.vue +101 -0
- package/components/_dropdownMenu.vue +76 -0
- package/components/_icon.vue +50 -0
- package/components/_message.vue +25 -0
- package/components/avatar.vue +16 -0
- package/components/banners/alert.vue +49 -0
- package/components/banners/select.vue +82 -0
- package/components/button.vue +13 -0
- package/components/calendar.vue +105 -0
- package/components/charts/column.vue +26 -0
- package/components/charts/line.vue +61 -0
- package/components/chip.vue +24 -0
- package/components/component.vue +222 -0
- package/components/datetime.vue +54 -0
- package/components/fab.vue +33 -0
- package/components/fields/_patternText.vue +61 -0
- package/components/fields/_select.vue +86 -0
- package/components/fields/autocomplete.vue +73 -0
- package/components/fields/check.vue +104 -0
- package/components/fields/checkGroup.vue +51 -0
- package/components/fields/country/countries.js +251 -0
- package/components/fields/country/field.vue +81 -0
- package/components/fields/country/regions.js +12 -0
- package/components/fields/creditCard.vue +105 -0
- package/components/fields/date.vue +24 -0
- package/components/fields/datetime.vue +49 -0
- package/components/fields/dynamicGroup.vue +106 -0
- package/components/fields/dynamicSelect.vue +173 -0
- package/components/fields/file.vue +166 -0
- package/components/fields/googlePlace.vue +158 -0
- package/components/fields/hidden.vue +18 -0
- package/components/fields/location.vue +223 -0
- package/components/fields/newRichText.vue +191 -0
- package/components/fields/phone/countries.js +315 -0
- package/components/fields/phone/field.vue +348 -0
- package/components/fields/phone/sprite.css +1071 -0
- package/components/fields/radio.vue +64 -0
- package/components/fields/radioGroup.vue +93 -0
- package/components/fields/rating.vue +26 -0
- package/components/fields/richText.vue +172 -0
- package/components/fields/select.vue +17 -0
- package/components/fields/stripe/stripeFields.vue +93 -0
- package/components/fields/stripe/stripeIndividualFields.vue +207 -0
- package/components/fields/stripeExternalAccount.vue +135 -0
- package/components/fields/stripeToken.vue +59 -0
- package/components/fields/submit.vue +23 -0
- package/components/fields/text.vue +144 -0
- package/components/fields/textarea.vue +59 -0
- package/components/fields/timeZone.vue +22 -0
- package/components/fields/timer.vue +83 -0
- package/components/h1.vue +28 -0
- package/components/h2.vue +20 -0
- package/components/h3.vue +22 -0
- package/components/h4.vue +20 -0
- package/components/h5.vue +20 -0
- package/components/h6.vue +20 -0
- package/components/hr.vue +13 -0
- package/components/html.vue +13 -0
- package/components/icon.vue +25 -0
- package/components/image.vue +87 -0
- package/components/label.vue +62 -0
- package/components/map.vue +206 -0
- package/components/markdown.vue +52 -0
- package/components/mixins/events.js +178 -0
- package/components/mixins/generic.js +58 -0
- package/components/mixins/list/autoload.js +144 -0
- package/components/mixins/longClick.js +56 -0
- package/components/mixins/scrolling.js +35 -0
- package/components/mixins/styles.js +221 -0
- package/components/mixins/table/autoload.js +131 -0
- package/components/mixins/table/export.js +52 -0
- package/components/mixins/table/import.js +106 -0
- package/components/mixins/text.js +20 -0
- package/components/mixins/ws/actionCable.js +48 -0
- package/components/mixins/ws/phoenixSocket.js +117 -0
- package/components/p.vue +36 -0
- package/components/panels/carousel.vue +55 -0
- package/components/panels/column.vue +117 -0
- package/components/panels/custom.vue +52 -0
- package/components/panels/flow.vue +81 -0
- package/components/panels/form.vue +126 -0
- package/components/panels/horizontal.vue +73 -0
- package/components/panels/list.vue +241 -0
- package/components/panels/responsive.vue +88 -0
- package/components/panels/scroll.vue +68 -0
- package/components/panels/split.vue +52 -0
- package/components/panels/table.vue +234 -0
- package/components/panels/ul.vue +34 -0
- package/components/panels/vertical.vue +71 -0
- package/components/panels/web.vue +11 -0
- package/components/spacer.vue +11 -0
- package/components/switch.vue +42 -0
- package/components/tabBar.vue +44 -0
- package/extensions/array.js +20 -0
- package/extensions/string.js +21 -0
- package/index.js +195 -0
- package/keys.js +12 -0
- package/nav/appbar.vue +117 -0
- package/nav/content.vue +40 -0
- package/nav/dialog.vue +127 -0
- package/nav/drawer.vue +88 -0
- package/nav/drawerButton.vue +28 -0
- package/nav/drawerLabel.vue +21 -0
- package/nav/sheet.vue +57 -0
- package/nav/snackbar.vue +72 -0
- package/package.json +42 -0
- package/settings.json.example +21 -0
- package/static/plugins/alignment/alignment.js +76 -0
- package/static/plugins/alignment/alignment.min.js +1 -0
- package/static/plugins/beyondgrammar/beyondgrammar.js +46 -0
- package/static/plugins/beyondgrammar/beyondgrammar.min.js +1 -0
- package/static/plugins/blockcode/blockcode.js +110 -0
- package/static/plugins/blockcode/blockcode.min.js +1 -0
- package/static/plugins/clips/clips.js +44 -0
- package/static/plugins/clips/clips.min.js +1 -0
- package/static/plugins/counter/counter.js +60 -0
- package/static/plugins/counter/counter.min.js +1 -0
- package/static/plugins/definedlinks/definedlinks.js +64 -0
- package/static/plugins/definedlinks/definedlinks.min.js +1 -0
- package/static/plugins/handle/handle.js +173 -0
- package/static/plugins/handle/handle.min.js +1 -0
- package/static/plugins/icons/icons.js +72 -0
- package/static/plugins/icons/icons.min.js +1 -0
- package/static/plugins/imageposition/imageposition.js +85 -0
- package/static/plugins/imageposition/imageposition.min.js +1 -0
- package/static/plugins/inlineformat/inlineformat.js +85 -0
- package/static/plugins/inlineformat/inlineformat.min.js +1 -0
- package/static/plugins/removeformat/removeformat.js +28 -0
- package/static/plugins/removeformat/removeformat.min.js +1 -0
- package/static/plugins/selector/selector.js +96 -0
- package/static/plugins/selector/selector.min.js +1 -0
- package/static/plugins/specialchars/specialchars.js +63 -0
- package/static/plugins/specialchars/specialchars.min.js +1 -0
- package/static/plugins/textdirection/textdirection.js +55 -0
- package/static/plugins/textdirection/textdirection.min.js +1 -0
- package/static/plugins/textexpander/textexpander.js +46 -0
- package/static/plugins/textexpander/textexpander.min.js +1 -0
- package/static/plugins/underline/underline.js +27 -0
- package/static/plugins/underline/underline.min.js +1 -0
- package/static/redactorx.css +1344 -0
- package/static/redactorx.js +14254 -0
- package/static/redactorx.min.css +1 -0
- package/static/redactorx.min.js +1 -0
- package/static/redactorx.usm.min.js +2 -0
- package/styles/test.sass +3 -0
- package/styles/test.scss +5 -0
- package/templates/_menu.vue +38 -0
- package/templates/comment.vue +202 -0
- package/templates/featured.vue +32 -0
- package/templates/thumbnail.vue +138 -0
- package/templates/unsupported.vue +12 -0
- package/utils/app.js +14 -0
- package/utils/dom.js +13 -0
- package/utils/form.js +34 -0
- package/utils/format.js +14 -0
- package/utils/hash.js +29 -0
- package/utils/helper.js +44 -0
- package/utils/history.js +70 -0
- package/utils/http.js +209 -0
- package/utils/launch.js +135 -0
- package/utils/private/ws.js +22 -0
- package/utils/public.js +23 -0
- package/utils/settings.js +48 -0
- package/utils/storage.js +9 -0
- package/utils/type.js +69 -0
- package/utils/uploader.js +121 -0
- package/utils/url.js +132 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
|
|
2
|
+
<!-- TODO: This probably can be merged with latLong-v1 or map-v1, i.e. add infoWindow support to latLong or map -->
|
|
3
|
+
|
|
4
|
+
<template>
|
|
5
|
+
<v-container fluid class='pa-0'>
|
|
6
|
+
<div class="v-input v-text-field theme--light">
|
|
7
|
+
<div class="v-input__control">
|
|
8
|
+
<div class="v-input__slot">
|
|
9
|
+
<div class="v-text-field__slot">
|
|
10
|
+
<label class="v-label theme--light v-label--active" style="left: 0px; right: auto; position: absolute;">Address</label>
|
|
11
|
+
<!-- <gmap-place-input :default-place="placeName" :placeholder="Address" @place_changed="setPlace" /> -->
|
|
12
|
+
<gmap-autocomplete
|
|
13
|
+
:name="spec.name"
|
|
14
|
+
placeholder="Address"
|
|
15
|
+
@place_changed="setPlace"
|
|
16
|
+
/>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<gmap-map
|
|
23
|
+
:center="{ lat: 25.105497, lng: 121.597366 }"
|
|
24
|
+
:zoom="13"
|
|
25
|
+
map-type-id="roadmap"
|
|
26
|
+
style="width: 100%; height: 300px"
|
|
27
|
+
@click='onMapClick'
|
|
28
|
+
ref='map'
|
|
29
|
+
>
|
|
30
|
+
<gmap-info-window :options="infoOptions" :position="markerPos" :opened="infoWinOpen" @closeclick="closeInfoWindow">
|
|
31
|
+
<div v-if='place !== null'>
|
|
32
|
+
<strong>{{ place.name }}</strong>
|
|
33
|
+
<div>Place ID: {{ place.place_id }}</div>
|
|
34
|
+
<div>Address: {{ place.formatted_address }}</div>
|
|
35
|
+
<div>Longitude: {{ place.geometry.location.lng() }}, Latitude: {{place.geometry.location.lat() }}</div>
|
|
36
|
+
</div>
|
|
37
|
+
<div v-if="spec.hasOwnProperty('infoWindow') && spec.infoWindow['actionButtons'].length > 0">
|
|
38
|
+
<v-btn v-for="(buttonSpec, i) in spec.infoWindow.actionButtons" :key="i" @click='onActionButtonClick($event, buttonSpec)'>
|
|
39
|
+
{{ buttonSpec.text }}
|
|
40
|
+
</v-btn>
|
|
41
|
+
</div>
|
|
42
|
+
</gmap-info-window>
|
|
43
|
+
|
|
44
|
+
<gmap-marker
|
|
45
|
+
:position="markerPos"
|
|
46
|
+
:clickable="true"
|
|
47
|
+
@click="openInfoWindow"
|
|
48
|
+
/>
|
|
49
|
+
<template v-slot:visible>
|
|
50
|
+
<div id="loading-container" class="d-none" ref="loading">
|
|
51
|
+
<v-progress-circular indeterminate color="primary" />
|
|
52
|
+
</div>
|
|
53
|
+
</template>
|
|
54
|
+
</gmap-map>
|
|
55
|
+
</v-container>
|
|
56
|
+
</template>
|
|
57
|
+
|
|
58
|
+
<script>
|
|
59
|
+
import Action from "../../action"
|
|
60
|
+
|
|
61
|
+
export default {
|
|
62
|
+
props: ['spec'],
|
|
63
|
+
data() {
|
|
64
|
+
return {
|
|
65
|
+
infoOptions: {
|
|
66
|
+
pixelOffset: {
|
|
67
|
+
width: 0,
|
|
68
|
+
height: -35
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
markerPos: { lat: 0, lng: 0 },
|
|
72
|
+
infoWinOpen: false,
|
|
73
|
+
place: null
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
computed: {
|
|
77
|
+
placeName() {
|
|
78
|
+
return (this.place == null ? '' : this.place.name)
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
methods: {
|
|
82
|
+
closeInfoWindow() {
|
|
83
|
+
this.infoWinOpen = false
|
|
84
|
+
},
|
|
85
|
+
openInfoWindow() {
|
|
86
|
+
this.infoWinOpen = true
|
|
87
|
+
},
|
|
88
|
+
toggleLoadingIndicator() {
|
|
89
|
+
this.$refs.loading.classList.toggle('d-none')
|
|
90
|
+
this.$refs.loading.classList.toggle('d-flex')
|
|
91
|
+
},
|
|
92
|
+
onActionButtonClick(event, properties) {
|
|
93
|
+
properties.onClick['formData'] = {
|
|
94
|
+
'place[google_place_id]': this.place.place_id,
|
|
95
|
+
'place[name]': this.place.name,
|
|
96
|
+
'place[address]': this.place.formatted_address,
|
|
97
|
+
'place[longitude]': this.place.geometry.location.lng(),
|
|
98
|
+
'place[latitude]': this.place.geometry.location.lat(),
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
Action.execute(properties.onClick, event.target, this)
|
|
102
|
+
},
|
|
103
|
+
onMapClick(e) {
|
|
104
|
+
this.closeInfoWindow()
|
|
105
|
+
|
|
106
|
+
if (e.placeId === undefined) {
|
|
107
|
+
return
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
e.stop()
|
|
111
|
+
this.toggleLoadingIndicator()
|
|
112
|
+
|
|
113
|
+
const request = {
|
|
114
|
+
placeId: e.placeId,
|
|
115
|
+
fields: ['place_id', 'geometry', 'name', 'formatted_address']
|
|
116
|
+
}
|
|
117
|
+
var service = new google.maps.places.PlacesService(this.$refs.map.$mapObject)
|
|
118
|
+
service.getDetails(request, place => {
|
|
119
|
+
this.toggleLoadingIndicator()
|
|
120
|
+
this.markerPos = place.geometry.location
|
|
121
|
+
this.place = place
|
|
122
|
+
this.openInfoWindow()
|
|
123
|
+
})
|
|
124
|
+
},
|
|
125
|
+
setLocationField(name, value) {
|
|
126
|
+
let field = document.querySelector(`input[name="${name}"]`)
|
|
127
|
+
field.closest('div.v-input').classList.add('v-input--is-label-active')
|
|
128
|
+
field.closest('div.v-input').classList.add('v-input--is-dirty')
|
|
129
|
+
field.previousSibling.classList.add('v-label--active')
|
|
130
|
+
field.value = value
|
|
131
|
+
},
|
|
132
|
+
setPlace(place) {
|
|
133
|
+
const { location } = place.geometry
|
|
134
|
+
this.place = place
|
|
135
|
+
this.markerPos = location
|
|
136
|
+
this.$refs.map.$mapObject.setCenter(location)
|
|
137
|
+
|
|
138
|
+
if (this.spec.hasOwnProperty('locationFields')) {
|
|
139
|
+
this.setLocationField(this.spec.locationFields.latitudeName, location.lat())
|
|
140
|
+
this.setLocationField(this.spec.locationFields.longitudeName, location.lng())
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
</script>
|
|
146
|
+
|
|
147
|
+
<style scoped>
|
|
148
|
+
#loading-container {
|
|
149
|
+
position: absolute;
|
|
150
|
+
width: 100%;
|
|
151
|
+
height: 300px;
|
|
152
|
+
top: 0;
|
|
153
|
+
z-index: 100;
|
|
154
|
+
background: rgba(196, 154, 154, 0.1);
|
|
155
|
+
align-items: center;
|
|
156
|
+
justify-content: center;
|
|
157
|
+
}
|
|
158
|
+
</style>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<input
|
|
3
|
+
type="hidden"
|
|
4
|
+
:name="fieldName"
|
|
5
|
+
:value="fieldModel"
|
|
6
|
+
:data-observe="spec"
|
|
7
|
+
/>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
export default {
|
|
12
|
+
props: {
|
|
13
|
+
spec: { type: Object, required: true }
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<style scoped></style>
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-container fluid class="pa-0" :style="$styles()">
|
|
3
|
+
<!--
|
|
4
|
+
It's safer to manually implement styling than adding another dependency such as vuetify-google-autocomplete,
|
|
5
|
+
which behaves differently and needs to be actively maintained.
|
|
6
|
+
-->
|
|
7
|
+
<div
|
|
8
|
+
class="v-input theme--light v-text-field v-text-field--enclosed v-text-field--outlined"
|
|
9
|
+
>
|
|
10
|
+
<div class="v-input__control">
|
|
11
|
+
<div class="v-input__slot">
|
|
12
|
+
<fieldset aria-hidden="true">
|
|
13
|
+
<legend :style="`width: ${labelWidth}px;`"><span></span></legend>
|
|
14
|
+
</fieldset>
|
|
15
|
+
<div class="v-text-field__slot">
|
|
16
|
+
<label
|
|
17
|
+
ref="label"
|
|
18
|
+
class="v-label v-label--active theme--light"
|
|
19
|
+
style="left: 0px; right: auto; position: absolute; font-size: 16px;"
|
|
20
|
+
>{{ spec.label }}</label
|
|
21
|
+
>
|
|
22
|
+
<!-- See https://developers.google.com/places/web-service/autocomplete#place_types for autocompleteOptions -->
|
|
23
|
+
<gmap-autocomplete
|
|
24
|
+
:name="spec.name"
|
|
25
|
+
:placeholder="spec.placeholder"
|
|
26
|
+
:value="address"
|
|
27
|
+
:options="spec.autocompleteOptions"
|
|
28
|
+
@input="onAddressChanged"
|
|
29
|
+
@place_changed="onPlaceChanged"
|
|
30
|
+
/>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<gmap-map
|
|
37
|
+
ref="map"
|
|
38
|
+
:center="{ lat: 0, lng: 0 }"
|
|
39
|
+
:zoom="13"
|
|
40
|
+
class="mt-3 mb-3"
|
|
41
|
+
map-type-id="roadmap"
|
|
42
|
+
:style="mapStyles"
|
|
43
|
+
@idle="onActionCompleted"
|
|
44
|
+
>
|
|
45
|
+
<gmap-marker
|
|
46
|
+
:position="markerPos"
|
|
47
|
+
:clickable="true"
|
|
48
|
+
:draggable="true"
|
|
49
|
+
@drag="onDrag"
|
|
50
|
+
@dragend="onDrag"
|
|
51
|
+
/>
|
|
52
|
+
</gmap-map>
|
|
53
|
+
<ui-component
|
|
54
|
+
v-if="latitudeField"
|
|
55
|
+
ref="latitudeView"
|
|
56
|
+
:spec="latitudeField"
|
|
57
|
+
/>
|
|
58
|
+
<ui-component
|
|
59
|
+
v-if="longitudeField"
|
|
60
|
+
ref="longitudeView"
|
|
61
|
+
:spec="longitudeField"
|
|
62
|
+
/>
|
|
63
|
+
<ui-component v-if="zoomField" ref="zoomView" :spec="zoomField" />
|
|
64
|
+
</v-container>
|
|
65
|
+
</template>
|
|
66
|
+
|
|
67
|
+
<script>
|
|
68
|
+
export default {
|
|
69
|
+
props: {
|
|
70
|
+
spec: { type: Object, required: true }
|
|
71
|
+
},
|
|
72
|
+
data() {
|
|
73
|
+
return {
|
|
74
|
+
infoOptions: {
|
|
75
|
+
pixelOffset: {
|
|
76
|
+
width: 0,
|
|
77
|
+
height: -35
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
// markerPos: { lat: null, lng: null },
|
|
81
|
+
address: null,
|
|
82
|
+
longitude: null,
|
|
83
|
+
latitude: null,
|
|
84
|
+
longitudeField: null,
|
|
85
|
+
latitudeField: null,
|
|
86
|
+
zoomField: null,
|
|
87
|
+
longitudeView: null,
|
|
88
|
+
latitudeView: null,
|
|
89
|
+
zoomView: null,
|
|
90
|
+
labelWidth: 0
|
|
91
|
+
};
|
|
92
|
+
},
|
|
93
|
+
computed: {
|
|
94
|
+
markerPos() {
|
|
95
|
+
return { lat: this.latitude || 0, lng: this.longitude || 0 };
|
|
96
|
+
},
|
|
97
|
+
mapStyles() {
|
|
98
|
+
return this.longitude != null && this.latitude != null
|
|
99
|
+
? {
|
|
100
|
+
width: "100%",
|
|
101
|
+
height: "300px"
|
|
102
|
+
}
|
|
103
|
+
: {};
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
methods: {
|
|
107
|
+
$ready() {
|
|
108
|
+
this.address = this.spec.value;
|
|
109
|
+
this.longitudeField = this.spec.longitudeField;
|
|
110
|
+
this.latitudeField = this.spec.latitudeField;
|
|
111
|
+
this.zoomField = this.spec.zoomField;
|
|
112
|
+
|
|
113
|
+
this.centerInitial();
|
|
114
|
+
|
|
115
|
+
setTimeout(() => {
|
|
116
|
+
this.latitudeView = this.$refs.latitudeView.$children[0];
|
|
117
|
+
this.longitudeView = this.$refs.longitudeView.$children[0];
|
|
118
|
+
|
|
119
|
+
if (this.$refs.zoomView) {
|
|
120
|
+
this.zoomView = this.$refs.zoomView.$children[0];
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const labelView = this.$refs.label;
|
|
124
|
+
this.labelWidth = labelView.getBoundingClientRect().width + 6;
|
|
125
|
+
});
|
|
126
|
+
},
|
|
127
|
+
centerInitial() {
|
|
128
|
+
const latitudeValue = Utils.type.floatValue(this.latitudeField.value);
|
|
129
|
+
const longitudeValue = Utils.type.floatValue(this.longitudeField.value);
|
|
130
|
+
|
|
131
|
+
if (latitudeValue !== 0 && longitudeValue !== 0) {
|
|
132
|
+
this.setLocation(latitudeValue, longitudeValue, true);
|
|
133
|
+
|
|
134
|
+
// Avoid asking for user location right away for now
|
|
135
|
+
// } else {
|
|
136
|
+
// navigator.geolocation.getCurrentPosition(position => {
|
|
137
|
+
// const coordinate = position.coords;
|
|
138
|
+
// this.setLocation(coordinate.latitude, coordinate.longitude, false);
|
|
139
|
+
// });
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
setLocation(latitudeValue, longitudeValue, dropPin) {
|
|
143
|
+
this.$refs.map.$gmapApiPromiseLazy().then(() => {
|
|
144
|
+
// eslint-disable-next-line no-undef
|
|
145
|
+
const location = new google.maps.LatLng(latitudeValue, longitudeValue);
|
|
146
|
+
this.$refs.map.$mapObject.setCenter(location);
|
|
147
|
+
|
|
148
|
+
if (dropPin) {
|
|
149
|
+
this.setMarkerPosition(location);
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
},
|
|
153
|
+
setMarkerPosition(location) {
|
|
154
|
+
// this.markerPos.lat = location.lat();
|
|
155
|
+
// this.markerPos.lng = location.lng();
|
|
156
|
+
|
|
157
|
+
this.latitude = location.lat();
|
|
158
|
+
this.longitude = location.lng();
|
|
159
|
+
|
|
160
|
+
this.latitudeView.fieldModel = location.lat();
|
|
161
|
+
this.longitudeView.fieldModel = location.lng();
|
|
162
|
+
},
|
|
163
|
+
// setLocationField(name, value) {
|
|
164
|
+
// // let field = document.querySelector(`input[name="${name}"]`);
|
|
165
|
+
// // field.closest("div.v-input").classList.add("v-input--is-label-active");
|
|
166
|
+
// // field.closest("div.v-input").classList.add("v-input--is-dirty");
|
|
167
|
+
// // field.previousSibling.classList.add("v-label--active");
|
|
168
|
+
|
|
169
|
+
// let field = this.$refs.fieldContainer.querySelector(
|
|
170
|
+
// `input[name="${name}"]`
|
|
171
|
+
// );
|
|
172
|
+
// // field.closest("div.v-input").classList.add("v-input--is-label-active");
|
|
173
|
+
// // field.closest("div.v-input").classList.add("v-input--is-dirty");
|
|
174
|
+
// field.previousSibling.classList.add("v-label--active");
|
|
175
|
+
// field.value = value;
|
|
176
|
+
// },
|
|
177
|
+
// onMapClick(e) {
|
|
178
|
+
// const location = e.latLng;
|
|
179
|
+
// console.log("CLICK1", e);
|
|
180
|
+
// this.setMarkerPosition(location);
|
|
181
|
+
// },
|
|
182
|
+
onPlaceChanged(place) {
|
|
183
|
+
this.address = place.formatted_address;
|
|
184
|
+
|
|
185
|
+
const location = place.geometry.location;
|
|
186
|
+
this.setMarkerPosition(location);
|
|
187
|
+
this.$refs.map.$mapObject.setCenter(location);
|
|
188
|
+
},
|
|
189
|
+
onDrag(e) {
|
|
190
|
+
this.setMarkerPosition(e.latLng);
|
|
191
|
+
},
|
|
192
|
+
onActionCompleted() {
|
|
193
|
+
if (this.zoomView) {
|
|
194
|
+
this.zoomView.fieldModel = this.$refs.map.$mapObject.zoom;
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
onAddressChanged(e) {
|
|
198
|
+
this.address = e.target.value;
|
|
199
|
+
if (this.address === "") {
|
|
200
|
+
this.address = null;
|
|
201
|
+
this.longitude = null;
|
|
202
|
+
this.latitude = null;
|
|
203
|
+
|
|
204
|
+
this.latitudeView.fieldModel = null;
|
|
205
|
+
this.longitudeView.fieldModel = null;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
</script>
|
|
211
|
+
|
|
212
|
+
<style scoped>
|
|
213
|
+
/* #loading-container {
|
|
214
|
+
position: absolute;
|
|
215
|
+
width: 100%;
|
|
216
|
+
height: 300px;
|
|
217
|
+
top: 0;
|
|
218
|
+
z-index: 100;
|
|
219
|
+
background: rgba(196, 154, 154, 0.1);
|
|
220
|
+
align-items: center;
|
|
221
|
+
justify-content: center;
|
|
222
|
+
} */
|
|
223
|
+
</style>
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div style="width: 100%;">
|
|
3
|
+
<v-progress-linear v-if="showProgress" v-model="progress.value" />
|
|
4
|
+
<textarea id="editor" class="entry"></textarea>
|
|
5
|
+
<input type="hidden" :name="spec.name" :value="cleanValue" />
|
|
6
|
+
<input
|
|
7
|
+
v-for="(imageKey, index) in imageKeys"
|
|
8
|
+
:key="index"
|
|
9
|
+
type="text"
|
|
10
|
+
:name="spec.imageUploader.fieldName"
|
|
11
|
+
:value="images[imageKey]"
|
|
12
|
+
/>
|
|
13
|
+
|
|
14
|
+
<p>{{ cleanValue }}</p>
|
|
15
|
+
|
|
16
|
+
<ol>
|
|
17
|
+
<li v-for="(imageKey, index) in imageKeys" :key="index">
|
|
18
|
+
{{ images[imageKey] }} -- {{ imageKey }}
|
|
19
|
+
</li>
|
|
20
|
+
</ol>
|
|
21
|
+
</div>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script>
|
|
25
|
+
import Uploader from "../../utils/uploader";
|
|
26
|
+
import RedactorX from "../../static/redactorx";
|
|
27
|
+
import "../../static/redactorx.css";
|
|
28
|
+
import "../../static/plugins/icons/icons";
|
|
29
|
+
import "../../static/plugins/inlineformat/inlineformat";
|
|
30
|
+
import "../../static/plugins/specialchars/specialchars";
|
|
31
|
+
import "../../static/plugins/textdirection/textdirection";
|
|
32
|
+
import "../../static/plugins/underline/underline";
|
|
33
|
+
|
|
34
|
+
export default {
|
|
35
|
+
props: {
|
|
36
|
+
spec: {
|
|
37
|
+
type: Object,
|
|
38
|
+
default: null
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
data() {
|
|
42
|
+
return {
|
|
43
|
+
rawValue: "",
|
|
44
|
+
cleanValue: "",
|
|
45
|
+
progress: { value: -1 },
|
|
46
|
+
images: {},
|
|
47
|
+
imageKeys: []
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
computed: {
|
|
51
|
+
showProgress: function() {
|
|
52
|
+
return this.progress.value >= 0;
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
methods: {
|
|
56
|
+
$ready() {
|
|
57
|
+
this.initValue();
|
|
58
|
+
this.initRedactor();
|
|
59
|
+
},
|
|
60
|
+
initValue() {
|
|
61
|
+
let rawValue = this.spec.value || "";
|
|
62
|
+
|
|
63
|
+
Utils.type.ifArray(this.spec.images, images => {
|
|
64
|
+
const vm = this;
|
|
65
|
+
rawValue = rawValue.replace(/\{\{image([0-9]+)\}\}/g, function(
|
|
66
|
+
_,
|
|
67
|
+
index
|
|
68
|
+
) {
|
|
69
|
+
const image = images[index - 1];
|
|
70
|
+
if (
|
|
71
|
+
image &&
|
|
72
|
+
vm.$type.isString(image.value) &&
|
|
73
|
+
vm.$type.isString(image.fileUrl)
|
|
74
|
+
) {
|
|
75
|
+
const url = image.fileUrl;
|
|
76
|
+
const key = url.hashCode().toString();
|
|
77
|
+
vm.images[key] = image.value;
|
|
78
|
+
// return `<img src="${url}">`;
|
|
79
|
+
return url;
|
|
80
|
+
}
|
|
81
|
+
return "{{IMAGE_NOT_FOUND}}";
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
this.updateValue(rawValue);
|
|
86
|
+
},
|
|
87
|
+
initRedactor() {
|
|
88
|
+
const vm = this;
|
|
89
|
+
RedactorX("#editor", {
|
|
90
|
+
content: this.rawValue,
|
|
91
|
+
source: Utils.settings.isDev,
|
|
92
|
+
plugins: ["inlineformat", "style"],
|
|
93
|
+
image: {
|
|
94
|
+
upload: function(upload, data) {
|
|
95
|
+
for (var key in data.files) {
|
|
96
|
+
if (typeof data.files[key] === "object") {
|
|
97
|
+
const file = data.files[key];
|
|
98
|
+
vm.uploadImage(file, response => {
|
|
99
|
+
upload.complete(response, data.e);
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
subscribe: {
|
|
106
|
+
"editor.change": function(event) {
|
|
107
|
+
const content = this.app.editor.getContent();
|
|
108
|
+
vm.updateValue(content);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
},
|
|
113
|
+
updateValue(content) {
|
|
114
|
+
this.rawValue = content;
|
|
115
|
+
this.separateOutImages();
|
|
116
|
+
},
|
|
117
|
+
separateOutImages() {
|
|
118
|
+
const vm = this;
|
|
119
|
+
var index = 0;
|
|
120
|
+
vm.imageKeys.clear();
|
|
121
|
+
// TODO: Fix to avoid replacing <video src="">
|
|
122
|
+
this.cleanValue = this.rawValue.replace(/src="([^"]+)"/g, function(
|
|
123
|
+
_,
|
|
124
|
+
imageValue
|
|
125
|
+
) {
|
|
126
|
+
// It seems that quill encodes '&' in the URL to '&' which would screw up key matching.
|
|
127
|
+
var decodedValue = imageValue.replace(/&/g, "&");
|
|
128
|
+
const key = decodedValue.hashCode().toString();
|
|
129
|
+
const existingIndex = vm.imageKeys.indexOf(key);
|
|
130
|
+
if (existingIndex < 0) {
|
|
131
|
+
vm.imageKeys.push(key);
|
|
132
|
+
return `src="{{image${++index}}}"`;
|
|
133
|
+
}
|
|
134
|
+
return `src="{{image${existingIndex + 1}}}"`;
|
|
135
|
+
});
|
|
136
|
+
},
|
|
137
|
+
uploadImage(file, onComplete) {
|
|
138
|
+
const uploaderSpec = this.spec.imageUploader;
|
|
139
|
+
|
|
140
|
+
const upload = new Uploader(
|
|
141
|
+
file,
|
|
142
|
+
uploaderSpec.directUploadUrl,
|
|
143
|
+
this.progress
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
if (upload.validateFile(uploaderSpec)) {
|
|
147
|
+
upload.start((error, blob) => {
|
|
148
|
+
if (error) {
|
|
149
|
+
// Handle the error
|
|
150
|
+
console.log("Failed uploading image!");
|
|
151
|
+
} else {
|
|
152
|
+
this.insertImage(file, blob, onComplete);
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
insertImage(file, blob, onComplete) {
|
|
158
|
+
let vm = this;
|
|
159
|
+
var reader = new FileReader();
|
|
160
|
+
reader.onload = function(e) {
|
|
161
|
+
if (file.type.indexOf("image") !== -1) {
|
|
162
|
+
var image = new Image();
|
|
163
|
+
image.src = e.target.result;
|
|
164
|
+
|
|
165
|
+
const key = image.src.hashCode().toString();
|
|
166
|
+
image.onload = function() {
|
|
167
|
+
const response = {
|
|
168
|
+
[key]: {
|
|
169
|
+
url: image.src,
|
|
170
|
+
id: key
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
onComplete(response);
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
vm.images[key] = blob.signed_id;
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
reader.readAsDataURL(file);
|
|
181
|
+
vm.progress.value = -1;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
</script>
|
|
186
|
+
|
|
187
|
+
<style lang="scss">
|
|
188
|
+
// .rx-container {
|
|
189
|
+
// height: 300px;
|
|
190
|
+
// }
|
|
191
|
+
</style>
|