glib-web 0.9.0 → 0.10.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/.eslintrc.js +0 -0
- package/actions/dialogs/close.js +0 -0
- package/components/button.vue +0 -0
- package/components/fields/creditCard.vue +0 -7
- package/components/fields/stripeToken.vue +0 -0
- package/components/fields/submit.vue +0 -0
- package/components/fields/timer.vue +74 -1
- package/components/h5.vue +0 -0
- package/components/h6.vue +0 -0
- package/components/mixins/events.js +0 -3
- package/components/mixins/list/autoload.js +33 -2
- package/components/mixins/styles.js +2 -1
- package/components/panels/horizontal.vue +1 -1
- package/components/panels/list.vue +1 -0
- package/package.json +1 -1
- package/templates/comment.vue +9 -3
- package/utils/format.js +0 -0
package/.eslintrc.js
CHANGED
|
File without changes
|
package/actions/dialogs/close.js
CHANGED
|
File without changes
|
package/components/button.vue
CHANGED
|
File without changes
|
|
@@ -84,13 +84,6 @@ export default {
|
|
|
84
84
|
stripe.createPaymentMethod("card", card).then(function(result) {
|
|
85
85
|
if (result.error) {
|
|
86
86
|
vm._displayError(result.error.message);
|
|
87
|
-
|
|
88
|
-
// // Show error in payment form
|
|
89
|
-
// vm.displayError.textContent = result.error.message;
|
|
90
|
-
// vm.clearData();
|
|
91
|
-
// setTimeout(function() {
|
|
92
|
-
// vm.retrieveToken.status = "complete";
|
|
93
|
-
// }, 50);
|
|
94
87
|
} else {
|
|
95
88
|
vm._displayError("");
|
|
96
89
|
|
|
File without changes
|
|
File without changes
|
|
@@ -1,6 +1,29 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div :style="$styles()" :class="classes()">
|
|
3
|
+
<div v-if="days_mode">
|
|
4
|
+
<div align="center">
|
|
5
|
+
<v-row align="center" justify="center">
|
|
6
|
+
<div class="day mx-2">
|
|
7
|
+
<div class="number">{{ displayDays }}</div>
|
|
8
|
+
<div class="format">Days</div>
|
|
9
|
+
</div>
|
|
10
|
+
<div class="hour mx-2">
|
|
11
|
+
<div class="number">{{ displayHours }}</div>
|
|
12
|
+
<div class="format">Hours</div>
|
|
13
|
+
</div>
|
|
14
|
+
<div class="min mx-2">
|
|
15
|
+
<div class="number">{{ displayMinutes }}</div>
|
|
16
|
+
<div class="format">Mins</div>
|
|
17
|
+
</div>
|
|
18
|
+
<div class="sec mx-2">
|
|
19
|
+
<div class="number">{{ displaySeconds }}</div>
|
|
20
|
+
<div class="format">Secs</div>
|
|
21
|
+
</div>
|
|
22
|
+
</v-row>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
3
25
|
<v-text-field
|
|
26
|
+
v-else
|
|
4
27
|
v-model="fieldModel"
|
|
5
28
|
:label="spec.label"
|
|
6
29
|
:name="fieldName"
|
|
@@ -25,11 +48,35 @@ export default {
|
|
|
25
48
|
return {
|
|
26
49
|
timer: null,
|
|
27
50
|
minValue: -1000000,
|
|
28
|
-
maxValue: 1000000
|
|
51
|
+
maxValue: 1000000,
|
|
52
|
+
days_mode: null,
|
|
53
|
+
displayDays: 0,
|
|
54
|
+
displayHours: 0,
|
|
55
|
+
displayMinutes: 0,
|
|
56
|
+
displaySeconds: 0
|
|
29
57
|
};
|
|
30
58
|
},
|
|
59
|
+
computed: {
|
|
60
|
+
_seconds: () => 1000,
|
|
61
|
+
_minutes() {
|
|
62
|
+
return this._seconds * 60;
|
|
63
|
+
},
|
|
64
|
+
_hours() {
|
|
65
|
+
return this._minutes * 60;
|
|
66
|
+
},
|
|
67
|
+
_days() {
|
|
68
|
+
return this._hours * 24;
|
|
69
|
+
},
|
|
70
|
+
end() {
|
|
71
|
+
return new Date(this.spec.value);
|
|
72
|
+
}
|
|
73
|
+
},
|
|
31
74
|
methods: {
|
|
32
75
|
$ready() {
|
|
76
|
+
if ((this.days_mode = this.$classes().includes("days"))) {
|
|
77
|
+
this.showRemaining();
|
|
78
|
+
}
|
|
79
|
+
|
|
33
80
|
this.$wsInitActionCable(this.spec.actionCable);
|
|
34
81
|
|
|
35
82
|
Utils.type.ifNumber(this.spec.min, value => {
|
|
@@ -75,6 +122,32 @@ export default {
|
|
|
75
122
|
},
|
|
76
123
|
classes() {
|
|
77
124
|
return this.$classes().concat("g-text-field--hintless");
|
|
125
|
+
},
|
|
126
|
+
// days_mode methods
|
|
127
|
+
formatNum: num => (num < 10 ? "0" + num : num),
|
|
128
|
+
showRemaining() {
|
|
129
|
+
setInterval(() => {
|
|
130
|
+
this.now = new Date();
|
|
131
|
+
this.fieldModel = this.end.getTime() - this.now.getTime();
|
|
132
|
+
|
|
133
|
+
if (this.fieldModel < 0) {
|
|
134
|
+
clearInterval(this.timer);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const days = Math.floor(this.fieldModel / this._days);
|
|
139
|
+
const hours = Math.floor((this.fieldModel % this._days) / this._hours);
|
|
140
|
+
const minutes = Math.floor(
|
|
141
|
+
(this.fieldModel % this._hours) / this._minutes
|
|
142
|
+
);
|
|
143
|
+
const seconds = Math.floor(
|
|
144
|
+
(this.fieldModel % this._minutes) / this._seconds
|
|
145
|
+
);
|
|
146
|
+
this.displayMinutes = this.formatNum(minutes);
|
|
147
|
+
this.displaySeconds = this.formatNum(seconds);
|
|
148
|
+
this.displayHours = this.formatNum(hours);
|
|
149
|
+
this.displayDays = this.formatNum(days);
|
|
150
|
+
});
|
|
78
151
|
}
|
|
79
152
|
}
|
|
80
153
|
};
|
package/components/h5.vue
CHANGED
|
File without changes
|
package/components/h6.vue
CHANGED
|
File without changes
|
|
@@ -125,10 +125,7 @@ export default {
|
|
|
125
125
|
|
|
126
126
|
// Make sure events are dispatched after $ready(). Dispatching them during $ready() causes errors.
|
|
127
127
|
for (const event of this.$data._events) {
|
|
128
|
-
// Execute later to ensure the parent has registered its event listener
|
|
129
|
-
// setTimeout(() => {
|
|
130
128
|
this.$el.dispatchEvent(event);
|
|
131
|
-
// }, 100)
|
|
132
129
|
}
|
|
133
130
|
this.$data._events = null;
|
|
134
131
|
},
|
|
@@ -29,6 +29,9 @@ export default {
|
|
|
29
29
|
const onScrollToBottom = this.spec.onScrollToBottom;
|
|
30
30
|
const onScrollToTop = this.spec.onScrollToTop;
|
|
31
31
|
|
|
32
|
+
// Reset state for reuse.
|
|
33
|
+
this.nextPageUrl = null;
|
|
34
|
+
this.prevPageUrl = null;
|
|
32
35
|
if (this.infiniteScroll) {
|
|
33
36
|
this.nextPageUrl = nextPage.url;
|
|
34
37
|
this.prevPageUrl = prevPage.url;
|
|
@@ -71,6 +74,8 @@ export default {
|
|
|
71
74
|
this.prevPageUrl = null;
|
|
72
75
|
}
|
|
73
76
|
|
|
77
|
+
var previousFirstRowIndex = null;
|
|
78
|
+
|
|
74
79
|
for (const [
|
|
75
80
|
index,
|
|
76
81
|
prependedSection
|
|
@@ -78,13 +83,17 @@ export default {
|
|
|
78
83
|
const section = this.sections[index];
|
|
79
84
|
|
|
80
85
|
Utils.type.ifArray(prependedSection.rows, rows => {
|
|
86
|
+
// Get the number of rows prepended to the top section
|
|
87
|
+
if (index == 0) {
|
|
88
|
+
previousFirstRowIndex = rows.length;
|
|
89
|
+
}
|
|
90
|
+
|
|
81
91
|
for (const row of rows) {
|
|
82
92
|
section.rows.unshift(row);
|
|
83
93
|
}
|
|
84
94
|
});
|
|
85
95
|
|
|
86
|
-
|
|
87
|
-
// https://stackoverflow.com/questions/54765451/preserve-scroll-position-on-dom-update-in-vue-js
|
|
96
|
+
this._updateScrollAfterPrepending(previousFirstRowIndex);
|
|
88
97
|
}
|
|
89
98
|
Utils.history.updatePage();
|
|
90
99
|
}
|
|
@@ -93,6 +102,28 @@ export default {
|
|
|
93
102
|
|
|
94
103
|
GLib.action.execute(onScrollToTop, this);
|
|
95
104
|
},
|
|
105
|
+
_updateScrollAfterPrepending(previousFirstRowIndex) {
|
|
106
|
+
// Scroll back to where the position was before the prepending.
|
|
107
|
+
if (previousFirstRowIndex) {
|
|
108
|
+
// Pre-record the height to get an accurate value
|
|
109
|
+
const anchorHeight = this.$refs.topAnchor.clientHeight;
|
|
110
|
+
|
|
111
|
+
this.$nextTick(() => {
|
|
112
|
+
const prependedBottomElement = this.$refs[
|
|
113
|
+
`row_0_${previousFirstRowIndex - 1}`
|
|
114
|
+
][0];
|
|
115
|
+
|
|
116
|
+
const top =
|
|
117
|
+
prependedBottomElement.offsetTop +
|
|
118
|
+
prependedBottomElement.clientHeight -
|
|
119
|
+
anchorHeight;
|
|
120
|
+
|
|
121
|
+
const pageBody = Utils.history._pageBody;
|
|
122
|
+
|
|
123
|
+
pageBody.scrollTop = top;
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
},
|
|
96
127
|
_registerBottomScroll(onScrollToBottom) {
|
|
97
128
|
this.bottomScrollHandler = this.$onVisibilityChange(
|
|
98
129
|
this.$refs.bottomAnchor,
|
|
@@ -46,11 +46,12 @@ export default {
|
|
|
46
46
|
this.$internalizeValue(val)
|
|
47
47
|
);
|
|
48
48
|
|
|
49
|
+
const dirtyCheckEnabled = !this.spec.disableDirtyCheck;
|
|
49
50
|
// Make sure value has changed and make sure that it is different from the original value.
|
|
50
51
|
// Be strict with this so it doesn't execute when the component is just initializing (e.g value changing
|
|
51
52
|
// from `null` to `this.spec.value`).
|
|
52
53
|
if (
|
|
53
|
-
|
|
54
|
+
dirtyCheckEnabled &&
|
|
54
55
|
!window.vueApp.isFormDirty &&
|
|
55
56
|
val != oldVal &&
|
|
56
57
|
val != this.spec.value
|
package/package.json
CHANGED
package/templates/comment.vue
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<v-card-title v-if="mode === 'system'" class="caption">{{
|
|
6
6
|
spec.subtitle
|
|
7
7
|
}}</v-card-title>
|
|
8
|
-
<v-avatar v-if="spec.imageUrl"
|
|
8
|
+
<v-avatar v-if="spec.imageUrl" size="30px">
|
|
9
9
|
<img :src="spec.imageUrl" alt="avatar" />
|
|
10
10
|
</v-avatar>
|
|
11
11
|
<v-card-title
|
|
@@ -164,11 +164,14 @@ export default {
|
|
|
164
164
|
align-self: start;
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
-
> .avatar {
|
|
167
|
+
> .v-avatar {
|
|
168
168
|
grid-row: 1/2;
|
|
169
169
|
grid-column: 1/2;
|
|
170
170
|
padding: 0;
|
|
171
171
|
justify-self: center;
|
|
172
|
+
> img {
|
|
173
|
+
border-radius: 50%;
|
|
174
|
+
}
|
|
172
175
|
}
|
|
173
176
|
|
|
174
177
|
> .subtitle {
|
|
@@ -217,11 +220,14 @@ export default {
|
|
|
217
220
|
align-self: start;
|
|
218
221
|
}
|
|
219
222
|
|
|
220
|
-
> .avatar {
|
|
223
|
+
> .v-avatar {
|
|
221
224
|
grid-row: 1/2;
|
|
222
225
|
grid-column: 3/4;
|
|
223
226
|
padding: 0;
|
|
224
227
|
justify-self: end;
|
|
228
|
+
> img {
|
|
229
|
+
border-radius: 50%;
|
|
230
|
+
}
|
|
225
231
|
}
|
|
226
232
|
|
|
227
233
|
> .subtitle {
|
package/utils/format.js
CHANGED
|
File without changes
|