glib-web 2.4.1 → 3.0.0-beta1
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/action.js +6 -1
- package/actions/auth/restart.js +0 -0
- package/actions/commands/enqueue.js +17 -0
- package/actions/components/update.js +13 -14
- package/actions/dialogs/oauth.js +0 -0
- package/actions/dialogs/options.js +0 -0
- package/app.vue +25 -26
- package/components/_button.vue +21 -28
- package/components/_chip.vue +14 -19
- package/components/_dropdownMenu.vue +10 -23
- package/components/_icon.vue +5 -5
- package/components/_message.vue +0 -0
- package/components/_responsive.vue +7 -21
- package/components/avatar.vue +11 -15
- package/components/banners/alert.vue +2 -7
- package/components/banners/select.vue +18 -30
- package/components/button.vue +5 -5
- package/components/component.vue +97 -100
- package/components/datetime.vue +0 -0
- package/components/fab.vue +0 -0
- package/components/fields/_patternText.vue +5 -19
- package/components/fields/_select.vue +7 -28
- package/components/fields/autocomplete.vue +5 -21
- package/components/fields/check.vue +19 -11
- package/components/fields/country/countries.js +0 -0
- package/components/fields/country/field.vue +9 -27
- package/components/fields/country/regions.js +0 -0
- package/components/fields/date.vue +5 -5
- package/components/fields/datetime.vue +5 -5
- package/components/fields/dynamicSelect.vue +8 -29
- package/components/fields/newRichText.vue +66 -53
- package/components/fields/otpField.vue +90 -0
- package/components/fields/phone/field.vue +60 -78
- package/components/fields/radio.vue +16 -23
- package/components/fields/rating.vue +9 -16
- package/components/fields/richText.vue +8 -28
- package/components/fields/select.vue +10 -7
- package/components/fields/stripeExternalAccount.vue +10 -24
- package/components/fields/text.vue +24 -40
- package/components/fields/textarea.vue +13 -27
- package/components/fields/timeZone.vue +9 -6
- package/components/fields/timer.vue +3 -10
- package/components/hr.vue +0 -0
- package/components/html.vue +0 -0
- package/components/image.vue +13 -20
- package/components/map.vue +115 -29
- package/components/markdown.vue +15 -8
- package/components/mixins/events.js +17 -6
- package/components/mixins/longClick.js +0 -0
- package/components/mixins/scrolling.js +0 -0
- package/components/mixins/styles.js +18 -15
- package/components/mixins/table/export.js +0 -0
- package/components/mixins/table/import.js +0 -0
- package/components/p.vue +0 -0
- package/components/panels/column.vue +5 -5
- package/components/panels/custom.vue +15 -15
- package/components/panels/flow.vue +19 -13
- package/components/panels/form.vue +17 -28
- package/components/panels/grid.vue +15 -9
- package/components/panels/horizontal.vue +149 -18
- package/components/panels/list.vue +63 -70
- package/components/panels/responsive.vue +13 -33
- package/components/panels/split.vue +2 -2
- package/components/panels/table.vue +27 -61
- package/components/panels/timeline.vue +20 -30
- package/components/panels/vertical.vue +9 -14
- package/components/tabBar.vue +27 -19
- package/index.js +68 -72
- package/keys.js +0 -0
- package/nav/appbar.vue +4 -4
- package/nav/dialog.vue +24 -34
- package/nav/drawer.vue +39 -51
- package/nav/drawerButton.vue +5 -7
- package/nav/drawerLabel.vue +2 -3
- package/nav/sheet.vue +18 -24
- package/nav/snackbar.vue +16 -26
- package/package.json +10 -11
- package/plugins/driverCustomBehavior.js +1 -1
- package/plugins/updatableComponent.js +1 -7
- package/plugins/vuetify.js +27 -0
- package/settings.json.example +0 -0
- package/styles/test.sass +0 -0
- package/styles/test.scss +0 -0
- package/templates/comment.vue +42 -19
- package/templates/featured.vue +8 -9
- package/templates/thumbnail-old.vue +188 -0
- package/templates/thumbnail.vue +5 -188
- package/templates/unsupported.vue +0 -0
- package/tsconfig.json +1 -1
- package/utils/dom.js +0 -0
- package/utils/eventBus.js +9 -2
- package/utils/history.js +7 -4
- package/utils/http.js +7 -2
- package/utils/launch.js +43 -51
- package/utils/public.js +6 -0
- package/utils/queue.js +110 -0
- package/utils/settings.js +3 -1
- package/utils/storage.js +0 -0
- package/utils/url.js +0 -0
package/components/map.vue
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<!-- <div ref="map" :style="genericStyles()"></div> -->
|
|
3
2
|
<gmap-map
|
|
4
3
|
ref="map"
|
|
5
4
|
:center="center"
|
|
@@ -43,19 +42,48 @@
|
|
|
43
42
|
</gmap-marker>
|
|
44
43
|
</gmap-cluster>
|
|
45
44
|
<template v-else>
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
45
|
+
<template v-if="spec.direction">
|
|
46
|
+
<gmap-custom-marker
|
|
47
|
+
v-for="(marker, index) in markers"
|
|
48
|
+
:key="index"
|
|
49
|
+
:marker="{ lat: marker.latitude, lng: marker.longitude }"
|
|
50
|
+
@click.native="onMarkerClick(marker, index)"
|
|
51
|
+
>
|
|
52
|
+
<div class="marker-wrapper">
|
|
53
|
+
<img v-if="marker.imageUrl" :src="marker.imageUrl" class="marker" />
|
|
54
|
+
<common-icon
|
|
55
|
+
v-else
|
|
56
|
+
class="marker"
|
|
57
|
+
:spec="{
|
|
58
|
+
material: { name: 'circle', size: 40 },
|
|
59
|
+
color: marker.markerColor
|
|
60
|
+
}"
|
|
61
|
+
/>
|
|
62
|
+
<p class="marker-number">{{ marker.markerNumber }}</p>
|
|
63
|
+
</div>
|
|
64
|
+
</gmap-custom-marker>
|
|
65
|
+
</template>
|
|
66
|
+
<template v-else>
|
|
67
|
+
<gmap-custom-marker
|
|
68
|
+
v-for="(marker, index) in markers"
|
|
69
|
+
:key="index"
|
|
70
|
+
:marker="{ lat: marker.latitude, lng: marker.longitude }"
|
|
71
|
+
@click.native="onMarkerClick(marker, index)"
|
|
72
|
+
>
|
|
73
|
+
<div class="marker-wrapper">
|
|
74
|
+
<img v-if="marker.imageUrl" :src="marker.imageUrl" class="marker" />
|
|
75
|
+
<common-icon
|
|
76
|
+
v-else
|
|
77
|
+
class="marker"
|
|
78
|
+
:spec="{
|
|
79
|
+
material: { name: 'place', size: 40 },
|
|
80
|
+
color: '#c92b2a'
|
|
81
|
+
}"
|
|
82
|
+
/>
|
|
83
|
+
<p class="marker-number">{{ marker.markerNumber }}</p>
|
|
84
|
+
</div>
|
|
85
|
+
</gmap-custom-marker>
|
|
86
|
+
</template>
|
|
59
87
|
</template>
|
|
60
88
|
</gmap-map>
|
|
61
89
|
</template>
|
|
@@ -85,9 +113,35 @@ export default {
|
|
|
85
113
|
selectedMarker: null,
|
|
86
114
|
center: { lat: 0, lng: 0 },
|
|
87
115
|
zoom: 11,
|
|
88
|
-
markers: []
|
|
116
|
+
markers: [],
|
|
117
|
+
locations: this.spec.locations
|
|
89
118
|
};
|
|
90
119
|
},
|
|
120
|
+
// mounted: function() {
|
|
121
|
+
// // switch (this.spec.provider) {
|
|
122
|
+
// // case 'baidu':
|
|
123
|
+
// // this.renderBaiduMap()
|
|
124
|
+
// // break
|
|
125
|
+
// // default:
|
|
126
|
+
// // this.renderGoogleMap()
|
|
127
|
+
// // }
|
|
128
|
+
// const { latitude, longitude, zoom } = this.spec
|
|
129
|
+
// this.updateMapCenter(latitude, longitude)
|
|
130
|
+
// this.zoom = zoom
|
|
131
|
+
|
|
132
|
+
// this.fetchMarkers()
|
|
133
|
+
// }
|
|
134
|
+
mounted: function() {
|
|
135
|
+
// use $nextTick instead setTimeout
|
|
136
|
+
// https://stackoverflow.com/questions/57847474/react-and-vue-google-map-api-remove-rendered-direction-before-setting-a-new-one
|
|
137
|
+
this.$nextTick(function() {
|
|
138
|
+
this.$gmapApiPromiseLazy().then(() => {
|
|
139
|
+
if (this.spec.direction === true) {
|
|
140
|
+
this.drawLineBetweenPoint();
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
},
|
|
91
145
|
methods: {
|
|
92
146
|
// See https://stackoverflow.com/questions/37597324/markercluster-one-marker-for-a-group for calculator example
|
|
93
147
|
_calculator(markers, numStyles) {
|
|
@@ -195,26 +249,58 @@ export default {
|
|
|
195
249
|
const { center } = this.$refs.map.$mapObject;
|
|
196
250
|
this.updateMapCenter(center.lat(), center.lng());
|
|
197
251
|
this.fetchMarkers();
|
|
252
|
+
},
|
|
253
|
+
drawLineBetweenPoint() {
|
|
254
|
+
let directionService = new window.google.maps.DirectionsService();
|
|
255
|
+
let directionDisplay = new window.google.maps.DirectionsRenderer();
|
|
256
|
+
|
|
257
|
+
for (let l = 0; l < this.locations.length; l++) {
|
|
258
|
+
for (let i = 0; i < this.locations[l].length; i++) {
|
|
259
|
+
let travel = {
|
|
260
|
+
origin: this.locations[l][i],
|
|
261
|
+
destination: this.locations[l][i + 1],
|
|
262
|
+
travelMode: "DRIVING"
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
directionService.route(travel, (response, status) => {
|
|
266
|
+
if (status === "OK") {
|
|
267
|
+
let map = this.$refs.map;
|
|
268
|
+
directionDisplay = new window.google.maps.DirectionsRenderer({
|
|
269
|
+
suppressMarkers: true,
|
|
270
|
+
polylineOptions: {
|
|
271
|
+
strokeColor: "#2ab3a6",
|
|
272
|
+
stropeOpacity: 0.8,
|
|
273
|
+
strokeWeight: 5
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
directionDisplay.setMap(map.$mapObject);
|
|
277
|
+
directionDisplay.setDirections(response);
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
}
|
|
198
282
|
}
|
|
199
283
|
}
|
|
200
|
-
// mounted: function() {
|
|
201
|
-
// // switch (this.spec.provider) {
|
|
202
|
-
// // case 'baidu':
|
|
203
|
-
// // this.renderBaiduMap()
|
|
204
|
-
// // break
|
|
205
|
-
// // default:
|
|
206
|
-
// // this.renderGoogleMap()
|
|
207
|
-
// // }
|
|
208
|
-
// const { latitude, longitude, zoom } = this.spec
|
|
209
|
-
// this.updateMapCenter(latitude, longitude)
|
|
210
|
-
// this.zoom = zoom
|
|
211
|
-
|
|
212
|
-
// this.fetchMarkers()
|
|
213
|
-
// }
|
|
214
284
|
};
|
|
215
285
|
</script>
|
|
216
286
|
|
|
217
287
|
<style lang="scss" scoped>
|
|
288
|
+
.marker-wrapper {
|
|
289
|
+
position: relative;
|
|
290
|
+
width: 40px;
|
|
291
|
+
height: 40px;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.marker-number {
|
|
295
|
+
font-weight: 800;
|
|
296
|
+
font-size: 16px;
|
|
297
|
+
position: absolute;
|
|
298
|
+
top: 6px;
|
|
299
|
+
width: 40px;
|
|
300
|
+
text-align: center;
|
|
301
|
+
color: white;
|
|
302
|
+
}
|
|
303
|
+
|
|
218
304
|
.marker {
|
|
219
305
|
width: 40px;
|
|
220
306
|
height: 40px;
|
package/components/markdown.vue
CHANGED
|
@@ -2,12 +2,9 @@
|
|
|
2
2
|
<div :style="genericStyles()" :class="$classes()">
|
|
3
3
|
<!-- eslint-disable-next-line vue/no-v-html -->
|
|
4
4
|
<span v-html="compiledText"></span>
|
|
5
|
-
<div
|
|
6
|
-
v-if="youtubeId"
|
|
7
|
-
:style="`width: 320px; overflow: hidden; max-height: 180px;`"
|
|
8
|
-
>
|
|
5
|
+
<!-- <div v-if="youtubeId" :style="`width: 320px; overflow: hidden; max-height: 180px;`">
|
|
9
6
|
<youtube :video-id="youtubeId" fit-parent></youtube>
|
|
10
|
-
</div>
|
|
7
|
+
</div> -->
|
|
11
8
|
</div>
|
|
12
9
|
</template>
|
|
13
10
|
|
|
@@ -23,7 +20,7 @@ export default {
|
|
|
23
20
|
},
|
|
24
21
|
computed: {
|
|
25
22
|
compiledText() {
|
|
26
|
-
return Utils.format.markdown(this.spec.text);
|
|
23
|
+
return Utils.format.markdown(this.spec.text || '');
|
|
27
24
|
}
|
|
28
25
|
},
|
|
29
26
|
methods: {
|
|
@@ -58,45 +55,55 @@ export default {
|
|
|
58
55
|
|
|
59
56
|
<style lang="scss">
|
|
60
57
|
.views-markdown {
|
|
61
|
-
|
|
58
|
+
&>span> :last-child {
|
|
62
59
|
margin-bottom: 0;
|
|
63
60
|
}
|
|
61
|
+
|
|
64
62
|
pre {
|
|
65
63
|
background-color: #f0f0f0;
|
|
66
64
|
padding: 8px 10px;
|
|
67
65
|
|
|
68
|
-
|
|
66
|
+
&>code {
|
|
69
67
|
background-color: transparent;
|
|
70
68
|
padding: 0;
|
|
71
69
|
}
|
|
72
70
|
}
|
|
73
71
|
}
|
|
72
|
+
|
|
74
73
|
.line-clamp {
|
|
75
74
|
display: -webkit-box;
|
|
76
75
|
-webkit-box-orient: vertical;
|
|
77
76
|
overflow: hidden;
|
|
78
77
|
}
|
|
78
|
+
|
|
79
79
|
.line-clamp-1 {
|
|
80
80
|
-webkit-line-clamp: 1;
|
|
81
81
|
}
|
|
82
|
+
|
|
82
83
|
.line-clamp-2 {
|
|
83
84
|
-webkit-line-clamp: 2;
|
|
84
85
|
}
|
|
86
|
+
|
|
85
87
|
.line-clamp-3 {
|
|
86
88
|
-webkit-line-clamp: 3;
|
|
87
89
|
}
|
|
90
|
+
|
|
88
91
|
.line-clamp-4 {
|
|
89
92
|
-webkit-line-clamp: 4;
|
|
90
93
|
}
|
|
94
|
+
|
|
91
95
|
.line-clamp-5 {
|
|
92
96
|
-webkit-line-clamp: 5;
|
|
93
97
|
}
|
|
98
|
+
|
|
94
99
|
.line-clamp-6 {
|
|
95
100
|
-webkit-line-clamp: 6;
|
|
96
101
|
}
|
|
102
|
+
|
|
97
103
|
.line-clamp-7 {
|
|
98
104
|
-webkit-line-clamp: 7;
|
|
99
105
|
}
|
|
106
|
+
|
|
100
107
|
.line-clamp-8 {
|
|
101
108
|
-webkit-line-clamp: 8;
|
|
102
109
|
}
|
|
@@ -36,12 +36,12 @@ export default {
|
|
|
36
36
|
this._executeIfReady(true);
|
|
37
37
|
this.$updated();
|
|
38
38
|
},
|
|
39
|
-
|
|
39
|
+
unmounted() {
|
|
40
40
|
this.$tearDown();
|
|
41
41
|
},
|
|
42
42
|
watch: {
|
|
43
43
|
// See Utils.http
|
|
44
|
-
"$root.vueApp.isStale": function(val, oldVal) {
|
|
44
|
+
"$root.vueApp.isStale": function (val, oldVal) {
|
|
45
45
|
// Make sure $ready() will be called in the next update
|
|
46
46
|
this._mountedUrl = null;
|
|
47
47
|
}
|
|
@@ -60,7 +60,7 @@ export default {
|
|
|
60
60
|
}
|
|
61
61
|
return null;
|
|
62
62
|
},
|
|
63
|
-
$onClick: function(explicitEvent, spec) {
|
|
63
|
+
$onClick: function (explicitEvent, spec) {
|
|
64
64
|
const properties = spec || this.spec;
|
|
65
65
|
const e = explicitEvent || event;
|
|
66
66
|
|
|
@@ -75,7 +75,7 @@ export default {
|
|
|
75
75
|
Action.execute(properties.onClick, this);
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
|
-
$rel: function(spec) {
|
|
78
|
+
$rel: function (spec) {
|
|
79
79
|
const properties = spec || this.spec;
|
|
80
80
|
const onClick = properties.onClick;
|
|
81
81
|
if (TypeUtils.isObject(onClick)) {
|
|
@@ -92,12 +92,12 @@ export default {
|
|
|
92
92
|
$onLongPress() {
|
|
93
93
|
GLib.action.execute(this.spec.onLongPress, this);
|
|
94
94
|
},
|
|
95
|
-
$addViewportChangeListeners: function(handler) {
|
|
95
|
+
$addViewportChangeListeners: function (handler) {
|
|
96
96
|
window.addEventListener("load", handler);
|
|
97
97
|
window.addEventListener("resize", handler);
|
|
98
98
|
this._pageBody.addEventListener("scroll", handler);
|
|
99
99
|
},
|
|
100
|
-
$removeViewportChangeListeners: function(handler) {
|
|
100
|
+
$removeViewportChangeListeners: function (handler) {
|
|
101
101
|
window.removeEventListener("load", handler);
|
|
102
102
|
window.removeEventListener("resize", handler);
|
|
103
103
|
this._pageBody.removeEventListener("scroll", handler);
|
|
@@ -152,6 +152,17 @@ export default {
|
|
|
152
152
|
$updated() {
|
|
153
153
|
// To be overridden
|
|
154
154
|
},
|
|
155
|
+
$recursiveUpdate() {
|
|
156
|
+
this.$ready();
|
|
157
|
+
this.$forceUpdate();
|
|
158
|
+
|
|
159
|
+
// Execute on next tick to ensure that the child has received the updated spec.
|
|
160
|
+
this.$nextTick(() => {
|
|
161
|
+
this.$children.find(child => {
|
|
162
|
+
child.$recursiveUpdate();
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
},
|
|
155
166
|
$dispatchEvent(name, data) {
|
|
156
167
|
const event = new Event(name, { bubbles: true });
|
|
157
168
|
|
|
File without changes
|
|
File without changes
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import Hash from "../../utils/hash";
|
|
2
|
-
import Vue from "
|
|
2
|
+
import { Vue } from "../../index"
|
|
3
3
|
import launch from "../../utils/launch";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import jsonLogic from 'json-logic-js';
|
|
6
6
|
|
|
7
7
|
// jsonLogic.add_operation("add_ms", function(a, b) {
|
|
8
8
|
// if (Utils.type.isString(a)) {
|
|
@@ -12,7 +12,7 @@ var jsonLogic = require("json-logic-js");
|
|
|
12
12
|
// return null;
|
|
13
13
|
// });
|
|
14
14
|
export default {
|
|
15
|
-
data: function() {
|
|
15
|
+
data: function () {
|
|
16
16
|
return {
|
|
17
17
|
_fieldModels: {},
|
|
18
18
|
fieldName: null,
|
|
@@ -36,17 +36,13 @@ export default {
|
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
watch: {
|
|
39
|
-
fieldModel: function(val, oldVal) {
|
|
39
|
+
fieldModel: function (val, oldVal) {
|
|
40
40
|
if (val === this.vuetifyEmptyString) {
|
|
41
41
|
val = "";
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
// Make the field property observable for dynamic showing/hiding
|
|
45
|
-
|
|
46
|
-
this.$data._fieldModels,
|
|
47
|
-
this.fieldName,
|
|
48
|
-
this.$internalizeValue(val)
|
|
49
|
-
);
|
|
45
|
+
Object.assign(this.$data._fieldModels, { [this.fieldName]: this.$internalizeValue })
|
|
50
46
|
|
|
51
47
|
this._checkDirtyState(val, oldVal);
|
|
52
48
|
}
|
|
@@ -125,17 +121,17 @@ export default {
|
|
|
125
121
|
val => (styles["height"] = val)
|
|
126
122
|
);
|
|
127
123
|
|
|
128
|
-
Utils.type.ifObject(
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
);
|
|
124
|
+
// Utils.type.ifObject(
|
|
125
|
+
// properties.onClick,
|
|
126
|
+
// () => (styles["cursor"] = "pointer")
|
|
127
|
+
// );
|
|
132
128
|
|
|
133
129
|
// This is the main reason styles have to be used in a dynamic way.
|
|
134
130
|
this._updateDisplay(styles, properties);
|
|
135
131
|
|
|
136
132
|
return new Hash(styles);
|
|
137
133
|
},
|
|
138
|
-
$length: function(length) {
|
|
134
|
+
$length: function (length) {
|
|
139
135
|
if (Utils.type.isString(length) || Utils.type.isNumber(length)) {
|
|
140
136
|
switch (length) {
|
|
141
137
|
case "wrapContent":
|
|
@@ -191,7 +187,8 @@ export default {
|
|
|
191
187
|
},
|
|
192
188
|
_linkFieldModels() {
|
|
193
189
|
const hasCondition = this.spec && this.spec.showIf;
|
|
194
|
-
const name = GLib.component.vueName(this);
|
|
190
|
+
// const name = GLib.component.vueName(this);
|
|
191
|
+
const name = (this.spec?.view || '').replace('/', '-')
|
|
195
192
|
const isField = name && name.startsWith("fields-");
|
|
196
193
|
if (hasCondition || isField) {
|
|
197
194
|
const form = this.$closest("panels-form");
|
|
@@ -213,6 +210,11 @@ export default {
|
|
|
213
210
|
const componentName = Utils.app.componentName(properties.view);
|
|
214
211
|
const classes = (properties.styleClasses || []).concat(componentName);
|
|
215
212
|
|
|
213
|
+
Utils.type.ifObject(properties.onClick, () =>
|
|
214
|
+
classes.push("glib-clickable")
|
|
215
|
+
);
|
|
216
|
+
|
|
217
|
+
// This could appear not as before after migration to vuetify 3
|
|
216
218
|
Utils.type.ifArray(properties.styleClasses, val => {
|
|
217
219
|
if (val.includes("card")) {
|
|
218
220
|
classes.push("v-card");
|
|
@@ -224,6 +226,7 @@ export default {
|
|
|
224
226
|
}
|
|
225
227
|
}
|
|
226
228
|
});
|
|
229
|
+
|
|
227
230
|
return classes;
|
|
228
231
|
}
|
|
229
232
|
}
|
|
File without changes
|
|
File without changes
|
package/components/p.vue
CHANGED
|
File without changes
|
|
@@ -22,7 +22,7 @@ import Hash from "../../utils/hash";
|
|
|
22
22
|
|
|
23
23
|
export default {
|
|
24
24
|
props: {
|
|
25
|
-
spec: { type: Object, required: true }
|
|
25
|
+
spec: { type: Object, required: true },
|
|
26
26
|
},
|
|
27
27
|
data() {
|
|
28
28
|
return {
|
|
@@ -30,7 +30,7 @@ export default {
|
|
|
30
30
|
lg: {},
|
|
31
31
|
md: {},
|
|
32
32
|
sm: {},
|
|
33
|
-
xs: {}
|
|
33
|
+
xs: {},
|
|
34
34
|
};
|
|
35
35
|
},
|
|
36
36
|
methods: {
|
|
@@ -47,7 +47,7 @@ export default {
|
|
|
47
47
|
},
|
|
48
48
|
cssStyles() {
|
|
49
49
|
const styles = Object.assign({}, this.$styles());
|
|
50
|
-
switch (
|
|
50
|
+
switch ("xl") {
|
|
51
51
|
case "xl":
|
|
52
52
|
this.applyStyles(styles, this.xs);
|
|
53
53
|
this.applyStyles(styles, this.sm);
|
|
@@ -101,8 +101,8 @@ export default {
|
|
|
101
101
|
Utils.type.ifBoolean(spec.hide, () => {
|
|
102
102
|
styles["display"] = "none";
|
|
103
103
|
});
|
|
104
|
-
}
|
|
105
|
-
}
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
106
|
};
|
|
107
107
|
</script>
|
|
108
108
|
|
|
@@ -11,52 +11,52 @@
|
|
|
11
11
|
This should not be needed if a component (custom or not) uses $styles() or other mixin
|
|
12
12
|
methods because those methods use `spec` attributes, which will force $ready() to be called.
|
|
13
13
|
-->
|
|
14
|
-
<component
|
|
15
|
-
:is="template"
|
|
16
|
-
v-if="customData"
|
|
17
|
-
:name="spec.template"
|
|
18
|
-
:spec="customData"
|
|
19
|
-
/>
|
|
14
|
+
<component :is="template" v-if="customData" :name="spec.template" :spec="customData" />
|
|
20
15
|
</div>
|
|
21
16
|
</template>
|
|
22
17
|
|
|
23
18
|
<script>
|
|
24
|
-
import UnsupportedTemplate from "../../templates/unsupported";
|
|
25
|
-
import ThumbnailTemplate from "../../templates/thumbnail";
|
|
26
|
-
import FeaturedTemplate from "../../templates/featured";
|
|
19
|
+
import UnsupportedTemplate from "../../templates/unsupported.vue";
|
|
20
|
+
import ThumbnailTemplate from "../../templates/thumbnail.vue";
|
|
21
|
+
import FeaturedTemplate from "../../templates/featured.vue";
|
|
22
|
+
import { getCurrentInstance } from 'vue';
|
|
27
23
|
|
|
28
24
|
export default {
|
|
29
25
|
components: {
|
|
30
26
|
"template-thumbnail": ThumbnailTemplate,
|
|
31
27
|
"template-featured": FeaturedTemplate,
|
|
32
|
-
"template-unsupported": UnsupportedTemplate
|
|
28
|
+
"template-unsupported": UnsupportedTemplate,
|
|
33
29
|
},
|
|
34
30
|
props: {
|
|
35
|
-
spec: { type: Object, required: true }
|
|
31
|
+
spec: { type: Object, required: true },
|
|
36
32
|
},
|
|
37
33
|
data() {
|
|
38
34
|
return {
|
|
39
|
-
customData: null
|
|
35
|
+
customData: null,
|
|
40
36
|
};
|
|
41
37
|
},
|
|
42
38
|
computed: {
|
|
43
39
|
template() {
|
|
40
|
+
|
|
44
41
|
const name = `template-${this.spec.template.replace("/", "-")}`;
|
|
45
|
-
const strict =
|
|
42
|
+
const strict = true;
|
|
46
43
|
if (strict) {
|
|
47
44
|
return name;
|
|
48
45
|
} else {
|
|
49
|
-
if (
|
|
46
|
+
if (getCurrentInstance().appContext.components[name]) {
|
|
50
47
|
return name;
|
|
51
48
|
}
|
|
52
49
|
return "template-unsupported";
|
|
53
50
|
}
|
|
54
|
-
}
|
|
51
|
+
},
|
|
55
52
|
},
|
|
56
53
|
methods: {
|
|
57
54
|
$ready() {
|
|
58
55
|
const onClick = this.spec.onClick ? { onClick: this.spec.onClick } : {};
|
|
59
56
|
this.customData = Object.assign(onClick, this.spec.data);
|
|
57
|
+
},
|
|
58
|
+
$registryEnabled() {
|
|
59
|
+
return false;
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
};
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
|
|
2
|
+
<div
|
|
3
|
+
:class="cssClasses"
|
|
4
|
+
:style="cssStyles"
|
|
5
|
+
>
|
|
6
|
+
<template
|
|
7
|
+
v-for="(item, index) in spec.childViews"
|
|
8
|
+
:key="index"
|
|
9
|
+
>
|
|
4
10
|
<!--
|
|
5
11
|
The wrapper prevents its content (e.g. image component) from getting stretched to fill
|
|
6
12
|
remaining space on the new line.
|
|
7
13
|
-->
|
|
8
|
-
<div :
|
|
14
|
+
<div :style="innerStyles">
|
|
9
15
|
<glib-component :spec="item" />
|
|
10
16
|
</div>
|
|
11
17
|
</template>
|
|
@@ -15,10 +21,10 @@
|
|
|
15
21
|
<script>
|
|
16
22
|
export default {
|
|
17
23
|
props: {
|
|
18
|
-
spec: { type: Object, required: true }
|
|
24
|
+
spec: { type: Object, required: true },
|
|
19
25
|
},
|
|
20
26
|
computed: {
|
|
21
|
-
cssClasses: function() {
|
|
27
|
+
cssClasses: function () {
|
|
22
28
|
const classes = this.$classes().concat("layouts-flow");
|
|
23
29
|
// switch(this.spec.distribution) {
|
|
24
30
|
// case 'fillEqually':
|
|
@@ -30,7 +36,7 @@ export default {
|
|
|
30
36
|
// }
|
|
31
37
|
return classes;
|
|
32
38
|
},
|
|
33
|
-
cssStyles: function() {
|
|
39
|
+
cssStyles: function () {
|
|
34
40
|
const styles = this.$styles();
|
|
35
41
|
// switch(this.spec.align) {
|
|
36
42
|
// case 'middle':
|
|
@@ -46,27 +52,27 @@ export default {
|
|
|
46
52
|
},
|
|
47
53
|
innerStyles() {
|
|
48
54
|
const styles = {};
|
|
49
|
-
Utils.type.ifObject(this.spec.innerPadding, padding => {
|
|
55
|
+
Utils.type.ifObject(this.spec.innerPadding, (padding) => {
|
|
50
56
|
Utils.type.ifNumber(
|
|
51
57
|
padding.top,
|
|
52
|
-
top => (styles["padding-top"] = `${top}px`)
|
|
58
|
+
(top) => (styles["padding-top"] = `${top}px`)
|
|
53
59
|
);
|
|
54
60
|
Utils.type.ifNumber(
|
|
55
61
|
padding.bottom,
|
|
56
|
-
bottom => (styles["padding-bottom"] = `${bottom}px`)
|
|
62
|
+
(bottom) => (styles["padding-bottom"] = `${bottom}px`)
|
|
57
63
|
);
|
|
58
64
|
Utils.type.ifNumber(
|
|
59
65
|
padding.left,
|
|
60
|
-
left => (styles["padding-left"] = `${left}px`)
|
|
66
|
+
(left) => (styles["padding-left"] = `${left}px`)
|
|
61
67
|
);
|
|
62
68
|
Utils.type.ifNumber(
|
|
63
69
|
padding.right,
|
|
64
|
-
right => (styles["padding-right"] = `${right}px`)
|
|
70
|
+
(right) => (styles["padding-right"] = `${right}px`)
|
|
65
71
|
);
|
|
66
72
|
});
|
|
67
73
|
return styles;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
74
|
+
},
|
|
75
|
+
},
|
|
70
76
|
};
|
|
71
77
|
</script>
|
|
72
78
|
|