romo 0.19.10 → 0.20.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.
- checksums.yaml +4 -4
- data/assets/css/romo/buttons.scss +1 -0
- data/assets/css/romo/modal.scss +5 -0
- data/assets/js/romo/ajax.js +75 -89
- data/assets/js/romo/base.js +699 -274
- data/assets/js/romo/currency_text_input.js +93 -83
- data/assets/js/romo/date.js +3 -3
- data/assets/js/romo/datepicker.js +227 -234
- data/assets/js/romo/dropdown.js +235 -344
- data/assets/js/romo/dropdown_form.js +77 -76
- data/assets/js/romo/form.js +215 -159
- data/assets/js/romo/indicator_text_input.js +64 -95
- data/assets/js/romo/inline.js +66 -59
- data/assets/js/romo/inline_form.js +74 -73
- data/assets/js/romo/modal.js +218 -294
- data/assets/js/romo/modal_form.js +83 -82
- data/assets/js/romo/onkey.js +25 -22
- data/assets/js/romo/option_list_dropdown.js +318 -298
- data/assets/js/romo/picker.js +175 -181
- data/assets/js/romo/select.js +177 -165
- data/assets/js/romo/select_dropdown.js +86 -93
- data/assets/js/romo/selected_options_list.js +66 -76
- data/assets/js/romo/sortable.js +154 -120
- data/assets/js/romo/{indicator.js → spinner.js} +74 -89
- data/assets/js/romo/tooltip.js +257 -271
- data/assets/js/romo/word_boundary_filter.js +7 -10
- data/lib/romo/dassets.rb +1 -1
- data/lib/romo/version.rb +1 -1
- data/test/unit/dassets_tests.rb +1 -1
- metadata +3 -3
@@ -1,11 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
return new RomoCurrencyTextInput(element);
|
4
|
-
});
|
5
|
-
}
|
6
|
-
|
7
|
-
var RomoCurrencyTextInput = function(element) {
|
8
|
-
this.elem = $(element);
|
1
|
+
var RomoCurrencyTextInput = RomoComponent(function(elem) {
|
2
|
+
this.elem = elem;
|
9
3
|
this.hiddenInputElem = undefined;
|
10
4
|
|
11
5
|
this.defaultIndicatorPosition = 'left';
|
@@ -15,108 +9,117 @@ var RomoCurrencyTextInput = function(element) {
|
|
15
9
|
this.defaultFormatNumDecimalPlaces = 2;
|
16
10
|
|
17
11
|
this.doInit();
|
18
|
-
this.
|
12
|
+
this._bindElem();
|
19
13
|
|
20
|
-
this.elem
|
21
|
-
}
|
14
|
+
Romo.trigger(this.elem, 'romoCurrencyTextInput:ready', [this]);
|
15
|
+
});
|
22
16
|
|
23
|
-
RomoCurrencyTextInput.prototype.
|
24
|
-
|
17
|
+
RomoCurrencyTextInput.prototype.doSetValue = function(value) {
|
18
|
+
this.elem.value = value;
|
19
|
+
this._refreshInputValue();
|
25
20
|
}
|
26
21
|
|
27
|
-
|
28
|
-
|
22
|
+
// private
|
23
|
+
|
24
|
+
RomoCurrencyTextInput.prototype._bindElem = function() {
|
25
|
+
this._bindIndicatorTextInput();
|
29
26
|
|
30
27
|
this.hiddenInputElem = this._getHiddenInputElem();
|
31
|
-
|
32
|
-
this.elem
|
28
|
+
Romo.before(this.elem, this.hiddenInputElem);
|
29
|
+
Romo.setAttr(this.elem, 'name', this._getNewInputName());
|
33
30
|
|
34
|
-
this.elem
|
35
|
-
this.
|
31
|
+
Romo.on(this.elem, 'change', Romo.proxy(function(e) {
|
32
|
+
this._refreshInputValue();
|
36
33
|
}, this));
|
37
|
-
this.elem
|
38
|
-
this.
|
34
|
+
Romo.on(this.elem, 'romoOnkey:trigger', Romo.proxy(function(e, triggerEvent, romoOnkey) {
|
35
|
+
this._refreshInputValue(true);
|
36
|
+
}, this));
|
37
|
+
Romo.on(this.elem, 'romoCurrencyTextInput:triggerUpdateInputValue', Romo.proxy(function(e) {
|
38
|
+
this._refreshInputValue();
|
39
39
|
}, this));
|
40
40
|
|
41
|
-
this.
|
42
|
-
}
|
43
|
-
|
44
|
-
RomoCurrencyTextInput.prototype.doUpdateInputValue = function() {
|
45
|
-
var unFormattedValue = this._unFormatCurrencyValue(this.elem.val());
|
46
|
-
this.hiddenInputElem.val(unFormattedValue);
|
47
|
-
if (this.elem.data('romo-currency-text-input-format-for-currency') !== false) {
|
48
|
-
this.elem.val(this._formatCurrencyValue(unFormattedValue));
|
49
|
-
} else {
|
50
|
-
this.elem.val(unFormattedValue);
|
51
|
-
}
|
52
|
-
}
|
41
|
+
new RomoOnkey(this.elem)
|
53
42
|
|
54
|
-
|
55
|
-
this.elem.val(value);
|
56
|
-
this.doUpdateInputValue();
|
43
|
+
this._refreshInputValue();
|
57
44
|
}
|
58
45
|
|
59
|
-
RomoCurrencyTextInput.prototype.
|
60
|
-
|
61
|
-
|
62
|
-
|
46
|
+
RomoCurrencyTextInput.prototype._bindIndicatorTextInput = function() {
|
47
|
+
Romo.setData(
|
48
|
+
this.elem,
|
49
|
+
'romo-indicator-text-input-indicator-position',
|
50
|
+
Romo.data(this.elem, 'romo-currency-text-input-indicator-position') || this.defaultIndicatorPosition
|
63
51
|
);
|
64
52
|
|
65
|
-
if (this.elem
|
66
|
-
|
67
|
-
|
68
|
-
|
53
|
+
if (Romo.data(this.elem, 'romo-currency-text-input-indicator') !== undefined) {
|
54
|
+
Romo.setData(
|
55
|
+
this.elem,
|
56
|
+
'romo-indicator-text-input-indicator',
|
57
|
+
Romo.data(this.elem, 'romo-currency-text-input-indicator')
|
69
58
|
);
|
70
59
|
}
|
71
|
-
if (this.elem
|
72
|
-
|
73
|
-
|
74
|
-
|
60
|
+
if (Romo.data(this.elem, 'romo-currency-text-input-indicator-width-px') !== undefined) {
|
61
|
+
Romo.setData(
|
62
|
+
this.elem,
|
63
|
+
'romo-indicator-text-input-indicator-width-px',
|
64
|
+
Romo.data(this.elem, 'romo-currency-text-input-indicator-width-px')
|
75
65
|
);
|
76
66
|
}
|
77
|
-
if (this.elem
|
78
|
-
|
79
|
-
|
80
|
-
|
67
|
+
if (Romo.data(this.elem, 'romo-currency-text-input-indicator-padding-px') !== undefined) {
|
68
|
+
Romo.setData(
|
69
|
+
this.elem,
|
70
|
+
'romo-indicator-text-input-indicator-padding-px',
|
71
|
+
Romo.data(this.elem, 'romo-currency-text-input-indicator-padding-px')
|
81
72
|
);
|
82
73
|
}
|
83
|
-
if (this.elem
|
84
|
-
|
85
|
-
|
86
|
-
|
74
|
+
if (Romo.data(this.elem, 'romo-currency-text-input-elem-display') !== undefined) {
|
75
|
+
Romo.setData(
|
76
|
+
this.elem,
|
77
|
+
'romo-indicator-text-input-elem-display',
|
78
|
+
Romo.data(this.elem, 'romo-currency-text-input-elem-display')
|
87
79
|
);
|
88
80
|
}
|
89
|
-
if (this.elem
|
90
|
-
|
91
|
-
|
92
|
-
|
81
|
+
if (Romo.data(this.elem, 'romo-currency-text-input-btn-group') !== undefined) {
|
82
|
+
Romo.setData(
|
83
|
+
this.elem,
|
84
|
+
'romo-indicator-text-input-btn-group',
|
85
|
+
Romo.data(this.elem, 'romo-currency-text-input-btn-group')
|
93
86
|
);
|
94
87
|
}
|
95
88
|
|
96
|
-
this.elem
|
97
|
-
this.elem
|
89
|
+
Romo.on(this.elem, 'romoIndicatorTextInput:indicatorClick', Romo.proxy(function(e) {
|
90
|
+
Romo.trigger(this.elem, 'romoCurrencyTextInput:indicatorClick', []);
|
98
91
|
}, this));
|
99
92
|
|
100
|
-
this.elem
|
101
|
-
this.elem
|
93
|
+
Romo.on(this.elem, 'romoCurrencyTextInput:triggerPlaceIndicator', Romo.proxy(function(e) {
|
94
|
+
Romo.trigger(this.elem, 'romoIndicatorTextInput:triggerPlaceIndicator', []);
|
102
95
|
}, this));
|
103
|
-
this.elem
|
104
|
-
this.elem
|
96
|
+
Romo.on(this.elem, 'romoCurrencyTextInput:triggerEnable', Romo.proxy(function(e) {
|
97
|
+
Romo.trigger(this.elem, 'romoIndicatorTextInput:triggerEnable', []);
|
105
98
|
}, this));
|
106
|
-
this.elem
|
107
|
-
this.elem
|
99
|
+
Romo.on(this.elem, 'romoCurrencyTextInput:triggerDisable', Romo.proxy(function(e) {
|
100
|
+
Romo.trigger(this.elem, 'romoIndicatorTextInput:triggerDisable', []);
|
108
101
|
}, this));
|
109
|
-
this.elem
|
110
|
-
this.elem
|
102
|
+
Romo.on(this.elem, 'romoCurrencyTextInput:triggerShow', Romo.proxy(function(e) {
|
103
|
+
Romo.trigger(this.elem, 'romoIndicatorTextInput:triggerShow', []);
|
111
104
|
}, this));
|
112
|
-
this.elem
|
113
|
-
this.elem
|
105
|
+
Romo.on(this.elem, 'romoCurrencyTextInput:triggerHide', Romo.proxy(function(e) {
|
106
|
+
Romo.trigger(this.elem, 'romoIndicatorTextInput:triggerHide', []);
|
114
107
|
}, this));
|
115
108
|
|
116
|
-
this.elem
|
109
|
+
new RomoIndicatorTextInput(this.elem);
|
117
110
|
}
|
118
111
|
|
119
|
-
|
112
|
+
RomoCurrencyTextInput.prototype._refreshInputValue = function(skipRefreshElemValue) {
|
113
|
+
var unFormattedValue = this._unFormatCurrencyValue(this.elem.value);
|
114
|
+
this.hiddenInputElem.value = unFormattedValue;
|
115
|
+
if (!skipRefreshElemValue) {
|
116
|
+
if (Romo.data(this.elem, 'romo-currency-text-input-format-for-currency') !== false) {
|
117
|
+
this.elem.value = this._formatCurrencyValue(unFormattedValue);
|
118
|
+
} else {
|
119
|
+
this.elem.value = unFormattedValue;
|
120
|
+
}
|
121
|
+
}
|
122
|
+
}
|
120
123
|
|
121
124
|
RomoCurrencyTextInput.prototype._formatCurrencyValue = function(sanitizedValue) {
|
122
125
|
return RomoCurrency.format(sanitizedValue, {
|
@@ -134,35 +137,42 @@ RomoCurrencyTextInput.prototype._unFormatCurrencyValue = function(inputValue) {
|
|
134
137
|
|
135
138
|
RomoCurrencyTextInput.prototype._getFormatThousandsDelim = function() {
|
136
139
|
return (
|
137
|
-
this.elem
|
140
|
+
Romo.data(this.elem, 'romo-currency-text-input-format-thousands-delim') ||
|
138
141
|
this.defaultFormatThousandsDelim
|
139
142
|
);
|
140
143
|
}
|
141
144
|
|
142
145
|
RomoCurrencyTextInput.prototype._getFormatDecimalDelim = function() {
|
143
146
|
return (
|
144
|
-
this.elem
|
147
|
+
Romo.data(this.elem, 'romo-currency-text-input-format-decimal-delim') ||
|
145
148
|
this.defaultFormatDecimalDelim
|
146
149
|
);
|
147
150
|
}
|
148
151
|
|
149
152
|
RomoCurrencyTextInput.prototype._getFormatNumDecimalPlaces = function() {
|
150
|
-
var places = this.elem
|
153
|
+
var places = Romo.data(this.elem, 'romo-currency-text-input-format-num-decimal-places');
|
151
154
|
return !isNaN(places = Math.abs(places)) ? places : this.defaultFormatNumDecimalPlaces;
|
152
155
|
}
|
153
156
|
|
154
157
|
RomoCurrencyTextInput.prototype._getHiddenInputElem = function() {
|
155
|
-
return
|
158
|
+
return Romo.elems(
|
159
|
+
'<input type="hidden" ' +
|
160
|
+
'name="'+Romo.attr(this.elem, 'name')+'" ' +
|
161
|
+
'value="'+this.elem.value+'"' +
|
162
|
+
'>'
|
163
|
+
)[0];
|
156
164
|
}
|
157
165
|
|
158
166
|
RomoCurrencyTextInput.prototype._getNewInputName = function() {
|
159
167
|
return (
|
160
|
-
this.elem
|
168
|
+
Romo.attr(this.elem, 'name')+
|
161
169
|
'-'+
|
162
|
-
(this.elem
|
170
|
+
(Romo.data(this.elem, 'romo-currency-text-input-name-suffix') || this.defaultInputNameSuffix)
|
163
171
|
);
|
164
172
|
}
|
165
173
|
|
166
|
-
|
167
|
-
|
168
|
-
|
174
|
+
// event functions
|
175
|
+
|
176
|
+
// init
|
177
|
+
|
178
|
+
Romo.addElemsInitSelector('[data-romo-currency-text-input-auto="true"]', RomoCurrencyTextInput);
|
data/assets/js/romo/date.js
CHANGED
@@ -161,7 +161,7 @@ RomoDate.Parser.prototype.date = function() {
|
|
161
161
|
if (dateValues.length === 0) {
|
162
162
|
return undefined;
|
163
163
|
}
|
164
|
-
var year = parseInt(dateValues[0]);
|
164
|
+
var year = parseInt(dateValues[0], 10);
|
165
165
|
if (year < 0) {
|
166
166
|
return undefined;
|
167
167
|
}
|
@@ -176,12 +176,12 @@ RomoDate.Parser.prototype.date = function() {
|
|
176
176
|
}
|
177
177
|
}
|
178
178
|
|
179
|
-
var month = parseInt(dateValues[1]) - 1;
|
179
|
+
var month = parseInt(dateValues[1], 10) - 1;
|
180
180
|
if (month < 0 || month > 11) {
|
181
181
|
return undefined;
|
182
182
|
}
|
183
183
|
|
184
|
-
var day = parseInt(dateValues[2]);
|
184
|
+
var day = parseInt(dateValues[2], 10);
|
185
185
|
var date = RomoDate.for(year, month, day);
|
186
186
|
if (date.getMonth() !== month) {
|
187
187
|
return undefined;
|