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 +4 -4
- data/assets/css/romo/select.scss +2 -1
- data/assets/js/romo/select.js +40 -12
- data/assets/js/romo/select_dropdown.js +1 -1
- data/lib/romo/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA512:
|
3
|
-
|
4
|
-
|
3
|
+
metadata.gz: 4a6caa77e3b43296bcfeb846f8fd5a184a63fc9ac6143878130a167ea192954c3d07c4d9d536efc43dc82eb85c31b09014678c135d6190b0f449a8be61bbe071
|
4
|
+
data.tar.gz: 76bdce7f44df26dcb66ee60872dae0db2b23ee64a71b902646bfd8167784cfe68da68f18fd21d5dbb99579812911f2481f2f3583e6b640542fa1fd3e58f5555c
|
5
5
|
SHA1:
|
6
|
-
|
7
|
-
|
6
|
+
metadata.gz: ceb86c06548e5fc0c278052eac50ab0bd64cd2a6
|
7
|
+
data.tar.gz: 266215eb1ab03d10d0ae33cf4b925e15141fe0ee
|
data/assets/css/romo/select.scss
CHANGED
@@ -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 {
|
data/assets/js/romo/select.js
CHANGED
@@ -7,8 +7,9 @@ $.fn.romoSelect = function() {
|
|
7
7
|
var RomoSelect = function(element) {
|
8
8
|
this.elem = $(element);
|
9
9
|
|
10
|
-
this.defaultCaretClass
|
11
|
-
this.
|
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
|
-
|
160
|
-
|
161
|
-
|
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
|
164
|
-
|
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
|
-
// -
|
167
|
-
|
168
|
-
|
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
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.
|
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-
|
13
|
+
date: 2017-01-24 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: assert
|