glib-web 0.5.98 → 0.6.2
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/LICENSE +0 -0
- package/README.md +0 -0
- package/action.js +167 -167
- package/actions/analytics/logEvent.js +0 -0
- package/actions/auth/creditCard.js +0 -0
- package/actions/auth/restart.js +0 -0
- package/actions/auth/saveCsrfToken.js +0 -0
- package/actions/cables/push.js +0 -0
- package/actions/dialogs/alert.js +0 -0
- package/actions/dialogs/notification.js +0 -0
- package/actions/dialogs/oauth.js +0 -0
- package/actions/dialogs/open.js +0 -0
- package/actions/dialogs/options.js +0 -0
- package/actions/dialogs/show.js +0 -0
- package/actions/forms/submit.js +0 -0
- package/actions/http/delete.js +0 -0
- package/actions/http/patch.js +0 -0
- package/actions/http/post.js +0 -0
- package/actions/http/put.js +0 -0
- package/actions/panels/scrollTo.js +18 -18
- package/actions/panels/scrollToBottom.js +0 -0
- package/actions/runMultiple.js +0 -0
- package/actions/sheets/select.js +0 -0
- package/actions/snackbars/alert.js +0 -0
- package/actions/snackbars/select.js +0 -0
- package/actions/timeouts/set.js +20 -20
- package/actions/windows/close.js +0 -0
- package/actions/windows/closeAll.js +0 -0
- package/actions/windows/closeWithReload.js +0 -0
- package/actions/windows/open.js +0 -0
- package/actions/windows/openWeb.js +0 -0
- package/actions/windows/refreshState.js +5 -5
- package/actions/windows/reload.js +0 -0
- package/actions/ws/push.js +0 -0
- package/app.vue +180 -180
- package/components/_badge.vue +23 -23
- package/components/_button.vue +107 -107
- package/components/_dropdownMenu.vue +76 -76
- package/components/_icon.vue +50 -50
- package/components/_message.vue +0 -0
- package/components/avatar.vue +18 -18
- package/components/banners/alert.vue +0 -0
- package/components/banners/select.vue +82 -82
- package/components/button.vue +33 -40
- package/components/calendar.vue +0 -0
- package/components/charts/column.vue +47 -34
- package/components/charts/line.vue +67 -65
- package/components/chip.vue +51 -26
- package/components/component.vue +225 -225
- package/components/datetime.vue +0 -0
- package/components/fab.vue +0 -0
- package/components/fields/_patternText.vue +65 -65
- package/components/fields/_select.vue +86 -86
- package/components/fields/autocomplete.vue +73 -73
- package/components/fields/check.vue +91 -81
- package/components/fields/checkGroup.vue +58 -58
- package/components/fields/country/countries.js +0 -0
- package/components/fields/country/field.vue +0 -0
- package/components/fields/country/regions.js +0 -0
- package/components/fields/creditCard.vue +22 -13
- package/components/fields/date.vue +24 -24
- package/components/fields/datetime.vue +0 -0
- package/components/fields/dynamicGroup.vue +0 -0
- package/components/fields/dynamicSelect.vue +0 -0
- package/components/fields/file.vue +0 -0
- package/components/fields/googlePlace.vue +0 -0
- package/components/fields/hidden.vue +0 -0
- package/components/fields/location.vue +198 -198
- package/components/fields/newRichText.vue +0 -0
- package/components/fields/phone/countries.js +315 -315
- package/components/fields/phone/field.vue +351 -351
- package/components/fields/phone/sprite.css +1071 -1071
- package/components/fields/radio.vue +16 -16
- package/components/fields/radioGroup.vue +42 -42
- package/components/fields/rating.vue +0 -0
- package/components/fields/richText.vue +0 -0
- package/components/fields/select.vue +17 -17
- package/components/fields/stripe/stripeFields.vue +93 -93
- package/components/fields/stripe/stripeIndividualFields.vue +207 -207
- package/components/fields/stripeExternalAccount.vue +135 -135
- package/components/fields/text.vue +0 -0
- package/components/fields/textarea.vue +0 -0
- package/components/fields/timeZone.vue +22 -22
- package/components/fields/timer.vue +83 -83
- package/components/h1.vue +28 -28
- package/components/h2.vue +28 -20
- package/components/h3.vue +29 -22
- package/components/h4.vue +28 -20
- package/components/h5.vue +28 -20
- package/components/h6.vue +28 -20
- package/components/hr.vue +0 -0
- package/components/html.vue +0 -0
- package/components/icon.vue +25 -25
- package/components/image.vue +0 -0
- package/components/label.vue +62 -62
- package/components/map.vue +0 -0
- package/components/markdown.vue +0 -0
- package/components/mixins/{chart.js → chart/annotation.js} +73 -73
- package/components/mixins/chart/tooltip.js +31 -0
- package/components/mixins/events.js +178 -178
- package/components/mixins/generic.js +0 -0
- package/components/mixins/list/autoload.js +0 -0
- package/components/mixins/longClick.js +0 -0
- package/components/mixins/scrolling.js +0 -0
- package/components/mixins/styles.js +222 -222
- package/components/mixins/table/autoload.js +0 -0
- package/components/mixins/table/export.js +0 -0
- package/components/mixins/table/import.js +0 -0
- package/components/mixins/text.js +20 -20
- package/components/mixins/tooltip.js +11 -0
- package/components/mixins/ws/actionCable.js +48 -48
- package/components/mixins/ws/phoenixSocket.js +0 -0
- package/components/p.vue +0 -0
- package/components/panels/carousel.vue +55 -55
- package/components/panels/column.vue +0 -0
- package/components/panels/custom.vue +0 -0
- package/components/panels/flow.vue +81 -81
- package/components/panels/form.vue +130 -130
- package/components/panels/horizontal.vue +0 -0
- package/components/panels/list.vue +247 -247
- package/components/panels/responsive.vue +94 -94
- package/components/panels/scroll.vue +0 -0
- package/components/panels/split.vue +0 -0
- package/components/panels/table.vue +0 -0
- package/components/panels/ul.vue +34 -34
- package/components/panels/vertical.vue +0 -0
- package/components/panels/web.vue +11 -11
- package/components/progressbar.vue +36 -36
- package/components/spacer.vue +0 -0
- package/components/switch.vue +42 -42
- package/components/tabBar.vue +68 -68
- package/extensions/array.js +0 -0
- package/extensions/string.js +21 -21
- package/index.js +199 -199
- package/keys.js +0 -0
- package/nav/appbar.vue +136 -136
- package/nav/content.vue +0 -0
- package/nav/dialog.vue +127 -127
- package/nav/drawer.vue +105 -105
- package/nav/drawerButton.vue +31 -31
- package/nav/drawerLabel.vue +0 -0
- package/nav/sheet.vue +0 -0
- package/nav/snackbar.vue +0 -0
- package/package.json +44 -44
- package/settings.json.example +0 -0
- package/static/plugins/alignment/alignment.js +0 -0
- package/static/plugins/alignment/alignment.min.js +0 -0
- package/static/plugins/beyondgrammar/beyondgrammar.js +0 -0
- package/static/plugins/beyondgrammar/beyondgrammar.min.js +0 -0
- package/static/plugins/blockcode/blockcode.js +0 -0
- package/static/plugins/blockcode/blockcode.min.js +0 -0
- package/static/plugins/clips/clips.js +0 -0
- package/static/plugins/clips/clips.min.js +0 -0
- package/static/plugins/counter/counter.js +0 -0
- package/static/plugins/counter/counter.min.js +0 -0
- package/static/plugins/definedlinks/definedlinks.js +0 -0
- package/static/plugins/definedlinks/definedlinks.min.js +0 -0
- package/static/plugins/handle/handle.js +0 -0
- package/static/plugins/handle/handle.min.js +0 -0
- package/static/plugins/icons/icons.js +0 -0
- package/static/plugins/icons/icons.min.js +0 -0
- package/static/plugins/imageposition/imageposition.js +0 -0
- package/static/plugins/imageposition/imageposition.min.js +0 -0
- package/static/plugins/inlineformat/inlineformat.js +0 -0
- package/static/plugins/inlineformat/inlineformat.min.js +0 -0
- package/static/plugins/removeformat/removeformat.js +0 -0
- package/static/plugins/removeformat/removeformat.min.js +0 -0
- package/static/plugins/selector/selector.js +0 -0
- package/static/plugins/selector/selector.min.js +0 -0
- package/static/plugins/specialchars/specialchars.js +0 -0
- package/static/plugins/specialchars/specialchars.min.js +0 -0
- package/static/plugins/textdirection/textdirection.js +0 -0
- package/static/plugins/textdirection/textdirection.min.js +0 -0
- package/static/plugins/textexpander/textexpander.js +0 -0
- package/static/plugins/textexpander/textexpander.min.js +0 -0
- package/static/plugins/underline/underline.js +0 -0
- package/static/plugins/underline/underline.min.js +0 -0
- package/static/redactorx.css +0 -0
- package/static/redactorx.js +0 -0
- package/static/redactorx.min.css +0 -0
- package/static/redactorx.min.js +0 -0
- package/static/redactorx.usm.min.js +0 -0
- package/styles/test.sass +0 -0
- package/styles/test.scss +0 -0
- package/templates/_menu.vue +38 -38
- package/templates/comment.vue +202 -202
- package/templates/featured.vue +32 -32
- package/templates/thumbnail.vue +145 -145
- package/templates/unsupported.vue +12 -12
- package/utils/app.js +0 -0
- package/utils/dom.js +0 -0
- package/utils/form.js +0 -0
- package/utils/hash.js +0 -0
- package/utils/helper.js +0 -0
- package/utils/history.js +70 -70
- package/utils/http.js +209 -209
- package/utils/launch.js +135 -135
- package/utils/private/ws.js +0 -0
- package/utils/public.js +0 -0
- package/utils/settings.js +0 -0
- package/utils/storage.js +0 -0
- package/utils/type.js +0 -0
- package/utils/uploader.js +0 -0
- package/utils/url.js +136 -136
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div ref="checkGroup" data-component="checkGroup" :name="spec.name">
|
|
3
|
-
<fields-hidden v-if="!anyChecked" :spec="uncheckSpec" />
|
|
4
|
-
|
|
5
|
-
<div v-for="(item, index) in spec.childViews" :key="index">
|
|
6
|
-
<ui-component :spec="item" />
|
|
7
|
-
</div>
|
|
8
|
-
</div>
|
|
9
|
-
</template>
|
|
10
|
-
|
|
11
|
-
<script>
|
|
12
|
-
import HiddenField from "./hidden";
|
|
13
|
-
|
|
14
|
-
export default {
|
|
15
|
-
components: {
|
|
16
|
-
"fields-hidden": HiddenField
|
|
17
|
-
},
|
|
18
|
-
props: {
|
|
19
|
-
spec: { type: Object, required: true }
|
|
20
|
-
},
|
|
21
|
-
data() {
|
|
22
|
-
return {
|
|
23
|
-
anyChecked: false
|
|
24
|
-
};
|
|
25
|
-
},
|
|
26
|
-
computed: {
|
|
27
|
-
uncheckSpec() {
|
|
28
|
-
return { name: this.spec.name, value: this.spec.uncheckValue };
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
methods: {
|
|
32
|
-
$ready() {
|
|
33
|
-
this.detectChecked();
|
|
34
|
-
const vm = this;
|
|
35
|
-
this.$el.addEventListener(
|
|
36
|
-
"change",
|
|
37
|
-
function(e) {
|
|
38
|
-
vm.detectChecked();
|
|
39
|
-
},
|
|
40
|
-
false
|
|
41
|
-
);
|
|
42
|
-
},
|
|
43
|
-
detectChecked() {
|
|
44
|
-
this.anyChecked = false;
|
|
45
|
-
const vm = this;
|
|
46
|
-
this.$el
|
|
47
|
-
.querySelectorAll("input[type=checkbox]")
|
|
48
|
-
.forEach(function(checkbox) {
|
|
49
|
-
if (checkbox.checked) {
|
|
50
|
-
vm.anyChecked = true;
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
</script>
|
|
57
|
-
|
|
58
|
-
<style scoped></style>
|
|
1
|
+
<template>
|
|
2
|
+
<div ref="checkGroup" data-component="checkGroup" :name="spec.name">
|
|
3
|
+
<fields-hidden v-if="!anyChecked" :spec="uncheckSpec" />
|
|
4
|
+
|
|
5
|
+
<div v-for="(item, index) in spec.childViews" :key="index">
|
|
6
|
+
<ui-component :spec="item" />
|
|
7
|
+
</div>
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script>
|
|
12
|
+
import HiddenField from "./hidden";
|
|
13
|
+
|
|
14
|
+
export default {
|
|
15
|
+
components: {
|
|
16
|
+
"fields-hidden": HiddenField
|
|
17
|
+
},
|
|
18
|
+
props: {
|
|
19
|
+
spec: { type: Object, required: true }
|
|
20
|
+
},
|
|
21
|
+
data() {
|
|
22
|
+
return {
|
|
23
|
+
anyChecked: false
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
computed: {
|
|
27
|
+
uncheckSpec() {
|
|
28
|
+
return { name: this.spec.name, value: this.spec.uncheckValue };
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
methods: {
|
|
32
|
+
$ready() {
|
|
33
|
+
this.detectChecked();
|
|
34
|
+
const vm = this;
|
|
35
|
+
this.$el.addEventListener(
|
|
36
|
+
"change",
|
|
37
|
+
function(e) {
|
|
38
|
+
vm.detectChecked();
|
|
39
|
+
},
|
|
40
|
+
false
|
|
41
|
+
);
|
|
42
|
+
},
|
|
43
|
+
detectChecked() {
|
|
44
|
+
this.anyChecked = false;
|
|
45
|
+
const vm = this;
|
|
46
|
+
this.$el
|
|
47
|
+
.querySelectorAll("input[type=checkbox]")
|
|
48
|
+
.forEach(function(checkbox) {
|
|
49
|
+
if (checkbox.checked) {
|
|
50
|
+
vm.anyChecked = true;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
</script>
|
|
57
|
+
|
|
58
|
+
<style scoped></style>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div :style="genericStyles()" :class="$classes()">
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
3
|
+
<div class="stretcher">
|
|
4
|
+
<StripeIndividualFields
|
|
5
|
+
v-if="$classes().includes('individual')"
|
|
6
|
+
:spec="spec"
|
|
7
|
+
:on-complete="_retrieveToken"
|
|
8
|
+
:on-error="_displayError"
|
|
9
|
+
/>
|
|
10
|
+
<StripeFields
|
|
11
|
+
v-else
|
|
12
|
+
:spec="spec"
|
|
13
|
+
:on-complete="_retrieveToken"
|
|
14
|
+
:on-error="_displayError"
|
|
15
|
+
/>
|
|
16
|
+
<div ref="error" style="color: red;"></div>
|
|
17
|
+
</div>
|
|
16
18
|
<!-- <input ref="token" type="hidden" :name="spec.name" /> -->
|
|
17
19
|
|
|
18
20
|
<input
|
|
@@ -103,3 +105,10 @@ export default {
|
|
|
103
105
|
}
|
|
104
106
|
};
|
|
105
107
|
</script>
|
|
108
|
+
|
|
109
|
+
<style lang="scss" scoped>
|
|
110
|
+
// Without this, this view will have minimal width when displayed using showIf.
|
|
111
|
+
.stretcher {
|
|
112
|
+
width: 100%;
|
|
113
|
+
}
|
|
114
|
+
</style>
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<!-- See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date for why we need to use `pattern` -->
|
|
3
|
-
<fields-patternText
|
|
4
|
-
:spec="spec"
|
|
5
|
-
:type="spec.type || 'date'"
|
|
6
|
-
pattern="[0-9]{4}-[0-9]{2}-[0-9]{2}"
|
|
7
|
-
/>
|
|
8
|
-
</template>
|
|
9
|
-
|
|
10
|
-
<script>
|
|
11
|
-
import PatternTextField from "./_patternText";
|
|
12
|
-
|
|
13
|
-
export default {
|
|
14
|
-
components: {
|
|
15
|
-
// Need to start with `fields-` to enable jsonlogic in `styles.js#_linkFieldModels`
|
|
16
|
-
"fields-patternText": PatternTextField
|
|
17
|
-
},
|
|
18
|
-
props: {
|
|
19
|
-
spec: { type: Object, required: true }
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
</script>
|
|
23
|
-
|
|
24
|
-
<style lang="scss" scoped></style>
|
|
1
|
+
<template>
|
|
2
|
+
<!-- See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date for why we need to use `pattern` -->
|
|
3
|
+
<fields-patternText
|
|
4
|
+
:spec="spec"
|
|
5
|
+
:type="spec.type || 'date'"
|
|
6
|
+
pattern="[0-9]{4}-[0-9]{2}-[0-9]{2}"
|
|
7
|
+
/>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
import PatternTextField from "./_patternText";
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
components: {
|
|
15
|
+
// Need to start with `fields-` to enable jsonlogic in `styles.js#_linkFieldModels`
|
|
16
|
+
"fields-patternText": PatternTextField
|
|
17
|
+
},
|
|
18
|
+
props: {
|
|
19
|
+
spec: { type: Object, required: true }
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<style lang="scss" scoped></style>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,198 +1,198 @@
|
|
|
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 map"
|
|
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
|
-
display: "block"
|
|
101
|
-
}
|
|
102
|
-
: { display: "none" };
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
methods: {
|
|
106
|
-
$ready() {
|
|
107
|
-
this.address = this.spec.value;
|
|
108
|
-
this.longitudeField = this.spec.longitudeField;
|
|
109
|
-
this.latitudeField = this.spec.latitudeField;
|
|
110
|
-
this.zoomField = this.spec.zoomField;
|
|
111
|
-
|
|
112
|
-
this.centerInitial();
|
|
113
|
-
|
|
114
|
-
setTimeout(() => {
|
|
115
|
-
this.latitudeView = this.$refs.latitudeView.$children[0];
|
|
116
|
-
this.longitudeView = this.$refs.longitudeView.$children[0];
|
|
117
|
-
|
|
118
|
-
if (this.$refs.zoomView) {
|
|
119
|
-
this.zoomView = this.$refs.zoomView.$children[0];
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
const labelView = this.$refs.label;
|
|
123
|
-
this.labelWidth = labelView.getBoundingClientRect().width + 6;
|
|
124
|
-
});
|
|
125
|
-
},
|
|
126
|
-
centerInitial() {
|
|
127
|
-
const latitudeValue = Utils.type.floatValue(this.latitudeField.value);
|
|
128
|
-
const longitudeValue = Utils.type.floatValue(this.longitudeField.value);
|
|
129
|
-
|
|
130
|
-
if (latitudeValue !== 0 && longitudeValue !== 0) {
|
|
131
|
-
this.setLocation(latitudeValue, longitudeValue, true);
|
|
132
|
-
|
|
133
|
-
// Avoid asking for user location right away for now
|
|
134
|
-
// } else {
|
|
135
|
-
// navigator.geolocation.getCurrentPosition(position => {
|
|
136
|
-
// const coordinate = position.coords;
|
|
137
|
-
// this.setLocation(coordinate.latitude, coordinate.longitude, false);
|
|
138
|
-
// });
|
|
139
|
-
}
|
|
140
|
-
},
|
|
141
|
-
setLocation(latitudeValue, longitudeValue, dropPin) {
|
|
142
|
-
this.$refs.map.$gmapApiPromiseLazy().then(() => {
|
|
143
|
-
// eslint-disable-next-line no-undef
|
|
144
|
-
const location = new google.maps.LatLng(latitudeValue, longitudeValue);
|
|
145
|
-
this.$refs.map.$mapObject.setCenter(location);
|
|
146
|
-
|
|
147
|
-
if (dropPin) {
|
|
148
|
-
this.setMarkerPosition(location);
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
},
|
|
152
|
-
setMarkerPosition(location) {
|
|
153
|
-
this.latitude = location.lat();
|
|
154
|
-
this.longitude = location.lng();
|
|
155
|
-
|
|
156
|
-
this.latitudeView.fieldModel = location.lat();
|
|
157
|
-
this.longitudeView.fieldModel = location.lng();
|
|
158
|
-
},
|
|
159
|
-
onPlaceChanged(place) {
|
|
160
|
-
this.address = place.formatted_address;
|
|
161
|
-
|
|
162
|
-
const location = place.geometry.location;
|
|
163
|
-
this.setMarkerPosition(location);
|
|
164
|
-
this.$refs.map.$mapObject.setCenter(location);
|
|
165
|
-
},
|
|
166
|
-
onDrag(e) {
|
|
167
|
-
this.setMarkerPosition(e.latLng);
|
|
168
|
-
},
|
|
169
|
-
onActionCompleted() {
|
|
170
|
-
if (this.zoomView) {
|
|
171
|
-
this.zoomView.fieldModel = this.$refs.map.$mapObject.zoom;
|
|
172
|
-
}
|
|
173
|
-
},
|
|
174
|
-
onAddressChanged(e) {
|
|
175
|
-
this.address = e.target.value;
|
|
176
|
-
if (this.address === "") {
|
|
177
|
-
this.address = null;
|
|
178
|
-
this.longitude = null;
|
|
179
|
-
this.latitude = null;
|
|
180
|
-
|
|
181
|
-
this.latitudeView.fieldModel = null;
|
|
182
|
-
this.longitudeView.fieldModel = null;
|
|
183
|
-
}
|
|
184
|
-
},
|
|
185
|
-
// Override
|
|
186
|
-
$displayValue() {
|
|
187
|
-
return "block";
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
</script>
|
|
192
|
-
|
|
193
|
-
<style scoped>
|
|
194
|
-
.map {
|
|
195
|
-
width: 100%;
|
|
196
|
-
height: 300px;
|
|
197
|
-
}
|
|
198
|
-
</style>
|
|
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 map"
|
|
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
|
+
display: "block"
|
|
101
|
+
}
|
|
102
|
+
: { display: "none" };
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
methods: {
|
|
106
|
+
$ready() {
|
|
107
|
+
this.address = this.spec.value;
|
|
108
|
+
this.longitudeField = this.spec.longitudeField;
|
|
109
|
+
this.latitudeField = this.spec.latitudeField;
|
|
110
|
+
this.zoomField = this.spec.zoomField;
|
|
111
|
+
|
|
112
|
+
this.centerInitial();
|
|
113
|
+
|
|
114
|
+
setTimeout(() => {
|
|
115
|
+
this.latitudeView = this.$refs.latitudeView.$children[0];
|
|
116
|
+
this.longitudeView = this.$refs.longitudeView.$children[0];
|
|
117
|
+
|
|
118
|
+
if (this.$refs.zoomView) {
|
|
119
|
+
this.zoomView = this.$refs.zoomView.$children[0];
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const labelView = this.$refs.label;
|
|
123
|
+
this.labelWidth = labelView.getBoundingClientRect().width + 6;
|
|
124
|
+
});
|
|
125
|
+
},
|
|
126
|
+
centerInitial() {
|
|
127
|
+
const latitudeValue = Utils.type.floatValue(this.latitudeField.value);
|
|
128
|
+
const longitudeValue = Utils.type.floatValue(this.longitudeField.value);
|
|
129
|
+
|
|
130
|
+
if (latitudeValue !== 0 && longitudeValue !== 0) {
|
|
131
|
+
this.setLocation(latitudeValue, longitudeValue, true);
|
|
132
|
+
|
|
133
|
+
// Avoid asking for user location right away for now
|
|
134
|
+
// } else {
|
|
135
|
+
// navigator.geolocation.getCurrentPosition(position => {
|
|
136
|
+
// const coordinate = position.coords;
|
|
137
|
+
// this.setLocation(coordinate.latitude, coordinate.longitude, false);
|
|
138
|
+
// });
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
setLocation(latitudeValue, longitudeValue, dropPin) {
|
|
142
|
+
this.$refs.map.$gmapApiPromiseLazy().then(() => {
|
|
143
|
+
// eslint-disable-next-line no-undef
|
|
144
|
+
const location = new google.maps.LatLng(latitudeValue, longitudeValue);
|
|
145
|
+
this.$refs.map.$mapObject.setCenter(location);
|
|
146
|
+
|
|
147
|
+
if (dropPin) {
|
|
148
|
+
this.setMarkerPosition(location);
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
},
|
|
152
|
+
setMarkerPosition(location) {
|
|
153
|
+
this.latitude = location.lat();
|
|
154
|
+
this.longitude = location.lng();
|
|
155
|
+
|
|
156
|
+
this.latitudeView.fieldModel = location.lat();
|
|
157
|
+
this.longitudeView.fieldModel = location.lng();
|
|
158
|
+
},
|
|
159
|
+
onPlaceChanged(place) {
|
|
160
|
+
this.address = place.formatted_address;
|
|
161
|
+
|
|
162
|
+
const location = place.geometry.location;
|
|
163
|
+
this.setMarkerPosition(location);
|
|
164
|
+
this.$refs.map.$mapObject.setCenter(location);
|
|
165
|
+
},
|
|
166
|
+
onDrag(e) {
|
|
167
|
+
this.setMarkerPosition(e.latLng);
|
|
168
|
+
},
|
|
169
|
+
onActionCompleted() {
|
|
170
|
+
if (this.zoomView) {
|
|
171
|
+
this.zoomView.fieldModel = this.$refs.map.$mapObject.zoom;
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
onAddressChanged(e) {
|
|
175
|
+
this.address = e.target.value;
|
|
176
|
+
if (this.address === "") {
|
|
177
|
+
this.address = null;
|
|
178
|
+
this.longitude = null;
|
|
179
|
+
this.latitude = null;
|
|
180
|
+
|
|
181
|
+
this.latitudeView.fieldModel = null;
|
|
182
|
+
this.longitudeView.fieldModel = null;
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
// Override
|
|
186
|
+
$displayValue() {
|
|
187
|
+
return "block";
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
</script>
|
|
192
|
+
|
|
193
|
+
<style scoped>
|
|
194
|
+
.map {
|
|
195
|
+
width: 100%;
|
|
196
|
+
height: 300px;
|
|
197
|
+
}
|
|
198
|
+
</style>
|
|
File without changes
|