lato 3.10.3 → 3.10.5
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6cadc9800d2c965476c402ba9e06165511f4f42191021ecdb50ea28b1ca3abb
|
4
|
+
data.tar.gz: f1f0b8c6dfd73eba012f71e5fe4e648018bce0e4bc433558d4f10eb5ee416827
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9755d5ed715fb489b7dc1c21de43f801b213449852b8ffbb1ddc61c3ce2c511a4931418f5f942e1960a7340df67ed6afb02af67d94b208ca1ba27619bf938804
|
7
|
+
data.tar.gz: 3c64573cd2747c2902e8b98a882fd9a452f06c16e4d1ece545883566be050cd9b4de089b0845d52ffbd7ae1093d92ca4174c918b1344edd705838562236a2ea1
|
@@ -43,17 +43,44 @@ export default class extends Controller {
|
|
43
43
|
|
44
44
|
async search(value) {
|
45
45
|
this.realInput.value = ''
|
46
|
-
if (!value
|
46
|
+
if (!value) return
|
47
47
|
|
48
48
|
try {
|
49
|
-
|
50
|
-
|
51
|
-
|
49
|
+
this.suggestShowLoading()
|
50
|
+
setTimeout(async () => {
|
51
|
+
const response = await fetch(this.pathValue + '?q=' + value)
|
52
|
+
const data = await response.json()
|
53
|
+
this.suggestShow(data)
|
54
|
+
}, 500)
|
52
55
|
} catch (err) {
|
53
56
|
console.error(err)
|
54
57
|
}
|
55
58
|
}
|
56
59
|
|
60
|
+
suggestShowLoading() {
|
61
|
+
if (this.optionsList) this.optionsList.remove()
|
62
|
+
this.optionsList = document.createElement('ul')
|
63
|
+
this.optionsList.classList.add('list-group')
|
64
|
+
this.optionsList.style.position = 'fixed'
|
65
|
+
this.optionsList.style.width = this.element.offsetWidth + 'px'
|
66
|
+
this.optionsList.style.maxHeight = '200px'
|
67
|
+
this.optionsList.style.overflowY = 'auto'
|
68
|
+
this.optionsList.style.zIndex = 9999
|
69
|
+
|
70
|
+
const elementRect = this.element.getBoundingClientRect()
|
71
|
+
this.optionsList.style.top = elementRect.bottom + 'px'
|
72
|
+
this.optionsList.style.left = elementRect.left + 'px'
|
73
|
+
|
74
|
+
const li = document.createElement('li')
|
75
|
+
li.classList.add('list-group-item')
|
76
|
+
li.classList.add('text-muted')
|
77
|
+
li.classList.add('text-center')
|
78
|
+
li.innerHTML = '<span class="lato-spin d-inline-block"><i class="bi bi-arrow-clockwise"></i></span>'
|
79
|
+
this.optionsList.appendChild(li)
|
80
|
+
|
81
|
+
document.body.appendChild(this.optionsList)
|
82
|
+
}
|
83
|
+
|
57
84
|
suggestShow(data = []) {
|
58
85
|
if (this.optionsList) this.optionsList.remove()
|
59
86
|
this.optionsList = document.createElement('ul')
|
@@ -67,20 +94,29 @@ export default class extends Controller {
|
|
67
94
|
const elementRect = this.element.getBoundingClientRect()
|
68
95
|
this.optionsList.style.top = elementRect.bottom + 'px'
|
69
96
|
this.optionsList.style.left = elementRect.left + 'px'
|
70
|
-
|
71
|
-
data.
|
97
|
+
|
98
|
+
if (data.length > 0) {
|
99
|
+
data.forEach((option) => {
|
100
|
+
const li = document.createElement('li')
|
101
|
+
li.classList.add('list-group-item')
|
102
|
+
li.classList.add('list-group-item-action')
|
103
|
+
li.style.cursor = 'pointer'
|
104
|
+
li.innerText = typeof option == 'string' ? option : option.label
|
105
|
+
li.addEventListener('click', () => {
|
106
|
+
this.element.value = typeof option == 'string' ? option : option.label
|
107
|
+
this.realInput.value = typeof option == 'string' ? option : option.value
|
108
|
+
this.suggestHide()
|
109
|
+
})
|
110
|
+
this.optionsList.appendChild(li)
|
111
|
+
})
|
112
|
+
} else {
|
72
113
|
const li = document.createElement('li')
|
73
114
|
li.classList.add('list-group-item')
|
74
|
-
li.classList.add('
|
75
|
-
li.
|
76
|
-
li.innerText =
|
77
|
-
li.addEventListener('click', () => {
|
78
|
-
this.element.value = typeof option == 'string' ? option : option.label
|
79
|
-
this.realInput.value = typeof option == 'string' ? option : option.value
|
80
|
-
this.suggestHide()
|
81
|
-
})
|
115
|
+
li.classList.add('text-muted')
|
116
|
+
li.classList.add('text-center')
|
117
|
+
li.innerText = 'No results found'
|
82
118
|
this.optionsList.appendChild(li)
|
83
|
-
}
|
119
|
+
}
|
84
120
|
|
85
121
|
document.body.appendChild(this.optionsList)
|
86
122
|
}
|
@@ -67,6 +67,20 @@ main, aside {
|
|
67
67
|
|
68
68
|
.aside-opener {
|
69
69
|
display: none;
|
70
|
+
position: fixed;
|
71
|
+
bottom: 15px;
|
72
|
+
right: 15px;
|
73
|
+
z-index: 100;
|
74
|
+
background-color: $primary;
|
75
|
+
color: $white;
|
76
|
+
border: none;
|
77
|
+
padding: 0;
|
78
|
+
width: 60px;
|
79
|
+
height: 60px;
|
80
|
+
font-size: 20px;
|
81
|
+
justify-content: center;
|
82
|
+
align-items: center;
|
83
|
+
border-radius: 50%;
|
70
84
|
}
|
71
85
|
|
72
86
|
@media screen and (max-width: 768px) {
|
@@ -93,20 +107,6 @@ main, aside {
|
|
93
107
|
|
94
108
|
.aside-opener {
|
95
109
|
display: flex;
|
96
|
-
position: fixed;
|
97
|
-
bottom: 15px;
|
98
|
-
right: 15px;
|
99
|
-
z-index: 100;
|
100
|
-
background-color: $primary;
|
101
|
-
color: $white;
|
102
|
-
border: none;
|
103
|
-
padding: 0;
|
104
|
-
width: 60px;
|
105
|
-
height: 60px;
|
106
|
-
font-size: 20px;
|
107
|
-
justify-content: center;
|
108
|
-
align-items: center;
|
109
|
-
border-radius: 50%;
|
110
110
|
}
|
111
111
|
}
|
112
112
|
|
@@ -115,4 +115,16 @@ main, aside {
|
|
115
115
|
font-size: 12px;
|
116
116
|
padding: 0.15rem 0.3rem;
|
117
117
|
}
|
118
|
+
}
|
119
|
+
|
120
|
+
.lato-spin {
|
121
|
+
animation: spin 1s linear infinite;
|
122
|
+
}
|
123
|
+
@keyframes spin {
|
124
|
+
0% {
|
125
|
+
transform: rotate(0deg);
|
126
|
+
}
|
127
|
+
100% {
|
128
|
+
transform: rotate(360deg);
|
129
|
+
}
|
118
130
|
}
|
data/lib/lato/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lato
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.10.
|
4
|
+
version: 3.10.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregorio Galante
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|