romo 0.18.1 → 0.18.2

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
  SHA512:
3
- data.tar.gz: 50cbf6926495cdfb0d4f37c8de78223765e090f8a8776ce411f6d82d98a7194bbd0ebd2f75a6c50632018e36f31590794844fa24b327056c4a94215f3a9dcd90
4
- metadata.gz: 98362f39c7531bce3483f67ee32f6b5cbd5d2891ddff83af346a313b1f2b45a7fda4c097bd22d61fc2b8433f67891f11799f53d403a86130a691b982f0b0f212
3
+ metadata.gz: 4a6caa77e3b43296bcfeb846f8fd5a184a63fc9ac6143878130a167ea192954c3d07c4d9d536efc43dc82eb85c31b09014678c135d6190b0f449a8be61bbe071
4
+ data.tar.gz: 76bdce7f44df26dcb66ee60872dae0db2b23ee64a71b902646bfd8167784cfe68da68f18fd21d5dbb99579812911f2481f2f3583e6b640542fa1fd3e58f5555c
5
5
  SHA1:
6
- data.tar.gz: cad251f2088b1bee923e9f1309edc208ef893721
7
- metadata.gz: 77d4306dc8c5de5e50c12e15c7089f0b78d5380a
6
+ metadata.gz: ceb86c06548e5fc0c278052eac50ab0bd64cd2a6
7
+ data.tar.gz: 266215eb1ab03d10d0ae33cf4b925e15141fe0ee
@@ -39,9 +39,10 @@
39
39
  width: 100%;
40
40
  }
41
41
  .romo-select-caret {
42
+ display: inline-block;
42
43
  position: absolute;
43
- right: 4px + 1px; /* 4 px for desired spacing + 1 px select styling optical illusion */
44
44
  vertical-align: middle;
45
+ cursor: pointer;
45
46
  }
46
47
 
47
48
  .romo-select-dropdown-option-filter-wrapper {
@@ -7,8 +7,9 @@ $.fn.romoSelect = function() {
7
7
  var RomoSelect = function(element) {
8
8
  this.elem = $(element);
9
9
 
10
- this.defaultCaretClass = undefined;
11
- this.defaultCaretWidthPx = 0;
10
+ this.defaultCaretClass = undefined;
11
+ this.defaultCaretPaddingPx = 5;
12
+ this.defaultCaretPosition = 'right'
12
13
 
13
14
  this.doInit();
14
15
  this.doBindSelectDropdown();
@@ -154,25 +155,52 @@ RomoSelect.prototype._buildSelectDropdownElem = function() {
154
155
  Romo.parentChildElems.add(this.elem, [this.elemWrapper]);
155
156
  }, this), 1);
156
157
 
158
+ this.caretElem = $();
157
159
  var caretClass = this.elem.data('romo-select-caret') || this.defaultCaretClass;
158
160
  if (caretClass !== undefined && caretClass !== 'none') {
159
- var caret = $('<i class="romo-select-caret '+caretClass+'"></i>');
160
- caret.css({'line-height': romoSelectDropdownElem.css('line-height')});
161
- caret.on('click', $.proxy(this.onCaretClick, this));
161
+ this.caretElem = $('<i class="romo-select-caret '+caretClass+'"></i>');
162
+ this.caretElem.css('line-height', parseInt(Romo.getComputedStyle(romoSelectDropdownElem[0], "line-height"), 10)+'px');
163
+ this.caretElem.on('click', $.proxy(this.onCaretClick, this));
164
+ romoSelectDropdownElem.append(this.caretElem);
162
165
 
163
- var caretWidthPx = this.elem.data('romo-select-caret-width-px') || this.defaultCaretWidthPx;
164
- // left-side spacing
166
+ var caretPaddingPx = this._getCaretPaddingPx();
167
+ var caretWidthPx = this._getCaretWidthPx();
168
+ var caretPosition = this._getCaretPosition();
169
+
170
+ // add a pixel to account for the default input border
171
+ this.caretElem.css(caretPosition, caretPaddingPx+1);
172
+
173
+ // left-side padding
165
174
  // + caret width
166
- // - 1 px select styling optical illusion
167
- // + right-side spacing
168
- var caretPaddingPx = 4 + caretWidthPx - 1 + 4;
169
- romoSelectDropdownElem.css({'padding-right': caretPaddingPx + 'px'});
170
- romoSelectDropdownElem.append(caret);
175
+ // + right-side padding
176
+ var dropdownPaddingPx = caretPaddingPx + caretWidthPx + caretPaddingPx;
177
+ romoSelectDropdownElem.css('padding-'+caretPosition, dropdownPaddingPx+'px');
171
178
  }
172
179
 
173
180
  return romoSelectDropdownElem;
174
181
  }
175
182
 
183
+ RomoSelect.prototype._getCaretPaddingPx = function() {
184
+ return (
185
+ this.elem.data('romo-select-caret-padding-px') ||
186
+ this.defaultCaretPaddingPx
187
+ );
188
+ }
189
+
190
+ RomoSelect.prototype._getCaretWidthPx = function() {
191
+ return (
192
+ this.elem.data('romo-select-caret-width-px') ||
193
+ parseInt(Romo.getComputedStyle(this.caretElem[0], "width"), 10)
194
+ );
195
+ }
196
+
197
+ RomoSelect.prototype._getCaretPosition = function() {
198
+ return (
199
+ this.elem.data('romo-select-caret-position') ||
200
+ this.defaultCaretPosition
201
+ );
202
+ }
203
+
176
204
  Romo.onInitUI(function(e) {
177
205
  Romo.initUIElems(e, '[data-romo-select-auto="true"]').romoSelect();
178
206
  });
@@ -379,7 +379,7 @@ RomoSelectDropdown.prototype._buildOptGroupListItem = function(optGroupElem) {
379
379
  }
380
380
 
381
381
  RomoSelectDropdown.prototype._buildOptionFilter = function() {
382
- var filter = $('<input type="text" class="romo-select-dropdown-option-filter"></input>');
382
+ var filter = $('<input type="text" size="1" class="romo-select-dropdown-option-filter"></input>');
383
383
 
384
384
  if (this.elem.data('romo-select-dropdown-filter-placeholder') !== undefined) {
385
385
  filter.attr('placeholder', this.elem.data('romo-select-dropdown-filter-placeholder'));
data/lib/romo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Romo
2
- VERSION = "0.18.1"
2
+ VERSION = "0.18.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: romo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.1
4
+ version: 0.18.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kelly Redding
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2017-01-23 00:00:00 Z
13
+ date: 2017-01-24 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: assert