uber_select_rails 0.2.0 → 0.2.1

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: 10c18743a0a4f7aa8ea982825a50907aeb75235437411bbafa9e1516ccaca952
4
- data.tar.gz: 6886d3f7ea294125db58af7f8c810ab67dff4f4ec70f0507843c2b0580cf4308
3
+ metadata.gz: 1565e41dee2dcac6cb743f1fef1670eba707eeb6aa677ddefded94f5341ea372
4
+ data.tar.gz: 3b1ab982cd3917c97aa271710cc73c8133455a2e4c001ecb8d4f190486801508
5
5
  SHA512:
6
- metadata.gz: 6b10307638757804884a9eee2b749da3dd661388b7f32abae304817952810794214b5403edb7d8a502ec706a84df34c1a96c088162cfe59b87af70fd327d4059
7
- data.tar.gz: fd2484075d5a73cff0e80e704c939ea06195fc4bb15a78a6281983425c073400928b7d2e4d40f7e648fac1680e2ceaf71fb224e14507584385b4d130c3d5d586
6
+ metadata.gz: 80acab71f2ef75247a3237ee21291f602b3bab8ff7e491e0a22d5f1eb5a5dd1e630088046c74a59898d8b74f30d48fac61ccfba6eb00c044e08ad83c020b7067
7
+ data.tar.gz: 599c1dbcc3986af1b83782080e7e101a4d0dcf6b1edbab91dda19570e7ddd936ea4b56986c67980aa79c957a66c540ba64eb8f9255a5c5bb7e2544559b18b68e
@@ -1,3 +1,3 @@
1
1
  module UberSelectRails
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -26,7 +26,7 @@ function List(options) {
26
26
  })
27
27
 
28
28
  // When a list item is hovered
29
- $(view).on('mouseenter', '.result', function(){
29
+ $(view).on('mouseenter', '.result:not(.disabled)', function(){
30
30
  unhighlightResults()
31
31
  highlightResult(this, {scroll: false})
32
32
  })
@@ -57,8 +57,8 @@ function List(options) {
57
57
  this.highlightResult = highlightResult
58
58
 
59
59
  function stepHighlight(amount, allowUnhighlight){
60
- var index = visibleResults().index(highlightedResult())
61
- var result = visibleResults()[index + amount]
60
+ var index = selectableResults().index(highlightedResult())
61
+ var result = selectableResults()[index + amount]
62
62
 
63
63
  if (result || allowUnhighlight){
64
64
  unhighlightResults()
@@ -72,13 +72,10 @@ function List(options) {
72
72
 
73
73
  if (!result.length) { return }
74
74
 
75
- var enabledResult = enabledResults().filter(result)
76
- if (enabledResult.length) {
77
- enabledResult.addClass('highlighted')
75
+ result.addClass('highlighted')
78
76
 
79
- if (options.scroll){
80
- scrollResultIntoView(enabledResult)
81
- }
77
+ if (options.scroll){
78
+ scrollResultIntoView(result)
82
79
  }
83
80
  }
84
81
 
@@ -90,7 +87,7 @@ function List(options) {
90
87
  return results().filter('.highlighted')
91
88
  }
92
89
 
93
- function enabledResults(){
90
+ function selectableResults(){
94
91
  return visibleResults().not('.disabled')
95
92
  }
96
93
 
@@ -262,7 +262,7 @@ var UberSearch = function(data, options){
262
262
  if (selected) {
263
263
  search.highlightResult(selected)
264
264
  } else if (options.highlightByDefault) {
265
- search.highlightResult(results.not('.hidden').first())
265
+ search.highlightResult(results.not('.hidden').not('.disabled').first())
266
266
  }
267
267
  }
268
268
 
@@ -39,6 +39,10 @@ label {
39
39
  text-overflow: ellipsis;
40
40
  position: relative; /* Contain caret */
41
41
  }
42
+ .uber_select .selected_text_container.disabled{
43
+ cursor: default;
44
+ opacity: 0.5;
45
+ }
42
46
  .uber_select .selected_text.empty{
43
47
  color: #aaa;
44
48
  }
@@ -103,6 +107,10 @@ label {
103
107
  overflow: hidden;
104
108
  text-overflow: ellipsis;
105
109
  }
110
+ .uber_select .result.disabled{
111
+ cursor: default;
112
+ opacity: 0.5;
113
+ }
106
114
  .uber_select .result.selected{
107
115
  font-weight: bold;
108
116
  }
@@ -167,6 +167,38 @@
167
167
  </p>
168
168
  </span>
169
169
 
170
+ <span class="example">
171
+ <label for="select">
172
+ Disabled Options
173
+ </label>
174
+ <select>
175
+ <option></option>
176
+ <option>Jimmy Johnson</option>
177
+ <option>Amanda Hugginkiss</option>
178
+ <option disabled="disabled">Cosmo Kramer</option>
179
+ <option>Bob Zickowski</option>
180
+ <option>Nicholas Cage</option>
181
+ <option>Queen Latifah</option>
182
+ </select>
183
+ <p>This example has a disabled option that should not highlight or be selectable.</p>
184
+ </span>
185
+
186
+ <span class="example">
187
+ <label for="select">
188
+ Disabled Select
189
+ </label>
190
+ <select disabled="disabled">
191
+ <option></option>
192
+ <option>Jimmy Johnson</option>
193
+ <option>Amanda Hugginkiss</option>
194
+ <option>Cosmo Kramer</option>
195
+ <option>Bob Zickowski</option>
196
+ <option>Nicholas Cage</option>
197
+ <option>Queen Latifah</option>
198
+ </select>
199
+ <p>This example has a disabled select that should disable the entire UI.</p>
200
+ </span>
201
+
170
202
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
171
203
  <script src="javascript/string_extensions.js"></script>
172
204
  <script src="javascript/search_field.js"></script>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uber_select_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicholas Jakobsen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-21 00:00:00.000000000 Z
11
+ date: 2020-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails