glib-web 3.1.0 → 3.2.0
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.
|
@@ -35,6 +35,7 @@ export default class {
|
|
|
35
35
|
};
|
|
36
36
|
new IntersectionObserver(function([entry]) {
|
|
37
37
|
const ratio = entry.intersectionRatio;
|
|
38
|
+
|
|
38
39
|
if (ratio < 1) {
|
|
39
40
|
// const place = ratio <= 0 && centerIfNeeded ? "center" : "nearest";
|
|
40
41
|
const place = ratio <= 0 ? alignment : "nearest";
|
|
@@ -42,9 +43,15 @@ export default class {
|
|
|
42
43
|
block: place,
|
|
43
44
|
inline: place,
|
|
44
45
|
behavior: spec["animate"] ? "smooth" : "auto",
|
|
45
|
-
|
|
46
46
|
});
|
|
47
47
|
} else {
|
|
48
|
+
if (spec.force) {
|
|
49
|
+
element.scrollIntoView({
|
|
50
|
+
block: alignment,
|
|
51
|
+
inline: alignment,
|
|
52
|
+
behavior: spec["animate"] ? "smooth" : "auto",
|
|
53
|
+
});
|
|
54
|
+
}
|
|
48
55
|
vm.onScrollEnd(element, spec, component);
|
|
49
56
|
this.disconnect();
|
|
50
57
|
}
|
|
@@ -20,7 +20,7 @@ export default {
|
|
|
20
20
|
spec: { type: Object, required: true },
|
|
21
21
|
defaultValue: { type: String, default: null }
|
|
22
22
|
},
|
|
23
|
-
data
|
|
23
|
+
data() {
|
|
24
24
|
return {
|
|
25
25
|
options: null,
|
|
26
26
|
append: {},
|
|
@@ -28,7 +28,7 @@ export default {
|
|
|
28
28
|
};
|
|
29
29
|
},
|
|
30
30
|
computed: {
|
|
31
|
-
values
|
|
31
|
+
values() {
|
|
32
32
|
// Depends on whether the field is single or multiple
|
|
33
33
|
if (this.$type.isArray(this.fieldModel)) {
|
|
34
34
|
return this.fieldModel.length > 0 ? this.fieldModel : this.emptyValue;
|
|
@@ -38,18 +38,18 @@ export default {
|
|
|
38
38
|
// return this.emptyValue;
|
|
39
39
|
},
|
|
40
40
|
// To avoid empty param error
|
|
41
|
-
emptyValue
|
|
41
|
+
emptyValue() {
|
|
42
42
|
return [null];
|
|
43
43
|
},
|
|
44
|
-
density
|
|
44
|
+
density() {
|
|
45
45
|
return determineDensity(this.spec.styleClasses)
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
48
|
methods: {
|
|
49
|
-
$ready
|
|
49
|
+
$ready() {
|
|
50
50
|
this.updateData(false);
|
|
51
51
|
},
|
|
52
|
-
normalizedOptions
|
|
52
|
+
normalizedOptions() {
|
|
53
53
|
return this.spec.options.map(i => {
|
|
54
54
|
switch (i.type) {
|
|
55
55
|
case "label":
|
|
@@ -61,13 +61,13 @@ export default {
|
|
|
61
61
|
}
|
|
62
62
|
});
|
|
63
63
|
},
|
|
64
|
-
classes
|
|
64
|
+
classes() {
|
|
65
65
|
return this.$classes().concat("g-text-field--hintless");
|
|
66
66
|
},
|
|
67
|
-
onChange
|
|
67
|
+
onChange() {
|
|
68
68
|
this.$executeOnChange();
|
|
69
69
|
},
|
|
70
|
-
updateData
|
|
70
|
+
updateData(reinitValue) {
|
|
71
71
|
this.options = this.normalizedOptions();
|
|
72
72
|
this.append = this.spec.append || {};
|
|
73
73
|
this.rules = this.$validation();
|
|
@@ -80,7 +80,7 @@ export default {
|
|
|
80
80
|
this.fieldModel = this.defaultValue;
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
|
-
$registryEnabled
|
|
83
|
+
$registryEnabled() {
|
|
84
84
|
return false;
|
|
85
85
|
}
|
|
86
86
|
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
class="otp-input" @input="handleInput($event, index)" @keydown="handleKeydown($event, index)"
|
|
6
6
|
@paste="handlePaste($event, index)" @focus="handleFocus($event, index)" @blur="handleBlur($event, index)"
|
|
7
7
|
@click="handleClick($event)" />
|
|
8
|
+
<label class="hint">{{ spec.hint }}</label>
|
|
8
9
|
</div>
|
|
9
10
|
<div v-else>
|
|
10
11
|
<input v-for="(digit, index) in digits" ref="input" :key="index" v-model="otp[index]" type="number"
|
|
@@ -12,6 +13,7 @@
|
|
|
12
13
|
maxlength="1" class="otp-input" @input="handleInput($event, index)" @keydown="handleKeydown($event, index)"
|
|
13
14
|
@paste="handlePaste($event, index)" @focus="handleFocus($event, index)" @blur="handleBlur($event, index)"
|
|
14
15
|
@click="handleClick($event)" />
|
|
16
|
+
<label class="hint">{{ spec.hint }}</label>
|
|
15
17
|
</div>
|
|
16
18
|
<input type="hidden" :name="spec.name" :value="otpValue" />
|
|
17
19
|
</div>
|
|
@@ -26,22 +28,21 @@ export default {
|
|
|
26
28
|
},
|
|
27
29
|
data() {
|
|
28
30
|
return {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
};
|
|
31
|
+
otp: (this.spec.value || '').toString().split("")
|
|
32
|
+
}
|
|
32
33
|
},
|
|
33
|
-
|
|
34
34
|
computed: {
|
|
35
35
|
otpValue() {
|
|
36
|
+
if (!this.otp) return ''
|
|
37
|
+
|
|
36
38
|
// concatenate the digits into a single string
|
|
37
39
|
return this.otp.join("");
|
|
38
|
-
}
|
|
40
|
+
},
|
|
41
|
+
digits() {
|
|
42
|
+
return this.spec.length
|
|
43
|
+
},
|
|
39
44
|
},
|
|
40
45
|
methods: {
|
|
41
|
-
$ready() {
|
|
42
|
-
this.digits = this.spec.length;
|
|
43
|
-
this.otp = Array(this.spec.length).fill("");
|
|
44
|
-
},
|
|
45
46
|
handleInput(event, index) {
|
|
46
47
|
if (event.target.value.length === 1) {
|
|
47
48
|
this.focusNext(index);
|
|
@@ -51,10 +52,10 @@ export default {
|
|
|
51
52
|
if (event.key === "Backspace") {
|
|
52
53
|
event.preventDefault();
|
|
53
54
|
if (this.otp[index] !== "") {
|
|
54
|
-
this
|
|
55
|
+
this.otp[index] = ""
|
|
55
56
|
} else {
|
|
56
57
|
this.focusPrevious(index);
|
|
57
|
-
this
|
|
58
|
+
this.otp[index - 1] = ""
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
61
|
},
|
|
@@ -116,4 +117,14 @@ input::-webkit-inner-spin-button {
|
|
|
116
117
|
input[type="number"] {
|
|
117
118
|
-moz-appearance: textfield;
|
|
118
119
|
}
|
|
120
|
+
|
|
121
|
+
.hint {
|
|
122
|
+
display: none;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
input:focus~.hint,
|
|
126
|
+
input:focus-visible~.hint {
|
|
127
|
+
display: block;
|
|
128
|
+
padding: 8px 16px;
|
|
129
|
+
}
|
|
119
130
|
</style>
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
const variants = ['outlined', 'plain', 'underlined', 'filled', 'solo', 'solo-inverted', 'solo-filled']
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
methods: {
|
|
10
|
-
$ready() {
|
|
11
|
-
variants.forEach((value) => {
|
|
12
|
-
if (this.$classes().includes(value)) this.variant = value
|
|
4
|
+
computed: {
|
|
5
|
+
variant() {
|
|
6
|
+
let val = null
|
|
7
|
+
variants.forEach((vari) => {
|
|
8
|
+
if (this.$classes().includes(vari)) val = vari
|
|
13
9
|
})
|
|
10
|
+
return val || 'outlined'
|
|
14
11
|
}
|
|
15
12
|
}
|
|
16
13
|
}
|
package/nav/dialog.vue
CHANGED