romo 0.19.10 → 0.20.0
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/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,112 +1,113 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
return new RomoModalForm(element);
|
4
|
-
});
|
5
|
-
}
|
1
|
+
var RomoModalForm = RomoComponent(function(elem) {
|
2
|
+
this.elem = elem;
|
6
3
|
|
7
|
-
|
8
|
-
this.
|
4
|
+
this.doInit();
|
5
|
+
this._bindElem();
|
9
6
|
|
10
|
-
this.
|
11
|
-
|
7
|
+
Romo.trigger(this.elem, 'romoModalForm:ready', [this]);
|
8
|
+
});
|
12
9
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
10
|
+
// private
|
11
|
+
|
12
|
+
RomoModalForm.prototype._bindElem = function() {
|
13
|
+
Romo.on(this.elem, 'romoModalForm:romoForm:triggerSubmit', Romo.proxy(function(e) {
|
14
|
+
if (this.romoForm !== undefined) {
|
15
|
+
Romo.trigger(this.romoForm.elem, 'romoForm:triggerSubmit', []);
|
17
16
|
}
|
18
17
|
}, this));
|
19
|
-
this.
|
20
|
-
|
21
|
-
this.
|
22
|
-
this.elem.trigger('modalForm:formReady', [this.form, this]);
|
18
|
+
Romo.on(this.elem, 'romoModal:loadBodySuccess', Romo.proxy(function(e, data, romoModal) {
|
19
|
+
this._bindForm();
|
20
|
+
Romo.trigger(this.elem, 'romoModalForm:formReady', [this.romoForm, this]);
|
23
21
|
}, this));
|
24
22
|
|
25
|
-
this.
|
26
|
-
this.
|
23
|
+
this._bindModal();
|
24
|
+
this._bindForm();
|
27
25
|
}
|
28
26
|
|
29
|
-
RomoModalForm.prototype.
|
30
|
-
|
31
|
-
}
|
27
|
+
RomoModalForm.prototype._bindModal = function() {
|
28
|
+
this.romoModal = new RomoModal(this.elem);
|
32
29
|
|
33
|
-
|
34
|
-
|
35
|
-
this.elem.attr('data-romo-modal-clear-content', 'true');
|
30
|
+
if (Romo.data(this.elem, 'romo-modal-clear-content') === undefined) {
|
31
|
+
Romo.setData(this.elem, 'romo-modal-clear-content', 'true');
|
36
32
|
}
|
37
33
|
|
38
|
-
this.elem
|
39
|
-
this.elem
|
34
|
+
Romo.on(this.elem, 'romoModal:ready', Romo.proxy(function(e, romoModal) {
|
35
|
+
Romo.trigger(this.elem, 'romoModalForm:romoModal:ready', [romoModal, this]);
|
40
36
|
}, this));
|
41
|
-
this.elem
|
42
|
-
this.elem
|
37
|
+
Romo.on(this.elem, 'romoModal:toggle', Romo.proxy(function(e, romoModal) {
|
38
|
+
Romo.trigger(this.elem, 'romoModalForm:romoModal:toggle', [romoModal, this]);
|
43
39
|
}, this));
|
44
|
-
this.elem
|
45
|
-
this.elem
|
40
|
+
Romo.on(this.elem, 'romoModal:popupOpen', Romo.proxy(function(e, romoModal) {
|
41
|
+
Romo.trigger(this.elem, 'romoModalForm:romoModal:popupOpen', [romoModal, this]);
|
46
42
|
}, this));
|
47
|
-
this.elem
|
48
|
-
this.elem
|
43
|
+
Romo.on(this.elem, 'romoModal:popupClose', Romo.proxy(function(e, romoModal) {
|
44
|
+
Romo.trigger(this.elem, 'romoModalForm:romoModal:popupClose', [romoModal, this]);
|
49
45
|
}, this));
|
50
|
-
this.elem
|
51
|
-
this.elem
|
46
|
+
Romo.on(this.elem, 'romoModal:dragStart', Romo.proxy(function(e, romoModal) {
|
47
|
+
Romo.trigger(this.elem, 'romoModalForm:romoModal:dragStart', [romoModal, this]);
|
52
48
|
}, this));
|
53
|
-
this.elem
|
54
|
-
this.elem
|
49
|
+
Romo.on(this.elem, 'romoModal:dragMove', Romo.proxy(function(e, placeX, placeY, romoModal) {
|
50
|
+
Romo.trigger(this.elem, 'romoModalForm:romoModal:dragMove', [placeX, placeY, romoModal, this]);
|
55
51
|
}, this));
|
56
|
-
this.elem
|
57
|
-
this.elem
|
52
|
+
Romo.on(this.elem, 'romoModal:dragStop', Romo.proxy(function(e, romoModal) {
|
53
|
+
Romo.trigger(this.elem, 'romoModalForm:romoModal:dragStop', [romoModal, this]);
|
58
54
|
}, this));
|
59
|
-
this.elem
|
60
|
-
this.elem
|
55
|
+
Romo.on(this.elem, 'romoModal:loadBodyStart', Romo.proxy(function(e, romoModal) {
|
56
|
+
Romo.trigger(this.elem, 'romoModalForm:romoModal:loadBodyStart', [romoModal, this]);
|
61
57
|
}, this));
|
62
|
-
this.elem
|
63
|
-
this.elem
|
58
|
+
Romo.on(this.elem, 'romoModal:loadBodySuccess', Romo.proxy(function(e, data, romoModal) {
|
59
|
+
Romo.trigger(this.elem, 'romoModalForm:romoModal:loadBodySuccess', [data, romoModal, this]);
|
64
60
|
}, this));
|
65
|
-
this.elem
|
66
|
-
this.elem
|
61
|
+
Romo.on(this.elem, 'romoModal:loadBodyError', Romo.proxy(function(e, xhr, romoModal) {
|
62
|
+
Romo.trigger(this.elem, 'romoModalForm:romoModal:loadBodyError', [xhr, romoModal, this]);
|
67
63
|
}, this));
|
68
|
-
this.elem
|
69
|
-
this.elem
|
64
|
+
Romo.on(this.elem, 'romoModal:dismiss', Romo.proxy(function(e, romoModal) {
|
65
|
+
Romo.trigger(this.elem, 'romoModalForm:romoModal:dismiss', [romoModal, this]);
|
70
66
|
}, this));
|
71
67
|
}
|
72
68
|
|
73
|
-
RomoModalForm.prototype.
|
74
|
-
|
69
|
+
RomoModalForm.prototype._bindForm = function() {
|
70
|
+
this.romoForm = undefined;
|
71
|
+
var formElem = Romo.find(this.romoModal.popupElem, '[data-romo-form-auto="modalForm"]')[0];
|
75
72
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
73
|
+
if (formElem !== undefined) {
|
74
|
+
Romo.on(formElem, 'romoForm:clearMsgs', Romo.proxy(function(e, romoForm) {
|
75
|
+
Romo.trigger(this.elem, 'romoModalForm:romoForm:clearMsgs', [romoForm, this]);
|
76
|
+
}, this));
|
77
|
+
Romo.on(formElem, 'romoForm:ready', Romo.proxy(function(e, romoForm) {
|
78
|
+
Romo.trigger(this.elem, 'romoModalForm:romoForm:ready', [romoForm, this]);
|
79
|
+
}, this));
|
80
|
+
Romo.on(formElem, 'romoForm:confirmSubmit', Romo.proxy(function(e, romoForm) {
|
81
|
+
Romo.trigger(this.elem, 'romoModalForm:romoForm:confirmSubmit', [romoForm, this]);
|
82
|
+
}, this));
|
83
|
+
Romo.on(formElem, 'romoForm:beforeSubmit', Romo.proxy(function(e, romoForm) {
|
84
|
+
Romo.trigger(this.elem, 'romoModalForm:romoForm:beforeSubmit', [romoForm, this]);
|
85
|
+
}, this));
|
86
|
+
Romo.on(formElem, 'romoForm:submitSuccess', Romo.proxy(function(e, data, romoForm) {
|
87
|
+
Romo.trigger(this.elem, 'romoModalForm:romoForm:submitSuccess', [data, romoForm, this]);
|
88
|
+
}, this));
|
89
|
+
Romo.on(formElem, 'romoForm:submitInvalidMsgs', Romo.proxy(function(e, msgs, xhr, romoForm) {
|
90
|
+
Romo.trigger(this.elem, 'romoModalForm:romoForm:submitInvalidMsgs', [msgs, xhr, romoForm, this]);
|
91
|
+
}, this));
|
92
|
+
Romo.on(formElem, 'romoForm:submitXhrError', Romo.proxy(function(e, xhr, romoForm) {
|
93
|
+
Romo.trigger(this.elem, 'romoModalForm:romoForm:submitXhrError', [xhr, romoForm, this]);
|
94
|
+
}, this));
|
95
|
+
Romo.on(formElem, 'romoForm:submitError', Romo.proxy(function(e, xhr, romoForm) {
|
96
|
+
Romo.trigger(this.elem, 'romoModalForm:romoForm:submitError', [xhr, romoForm, this]);
|
97
|
+
}, this));
|
98
|
+
Romo.on(formElem, 'romoForm:browserSubmit', Romo.proxy(function(e, romoForm) {
|
99
|
+
Romo.trigger(this.elem, 'romoModalForm:romoForm:browserSubmit', [romoForm, this]);
|
100
|
+
}, this));
|
103
101
|
|
104
|
-
|
105
|
-
|
106
|
-
|
102
|
+
var submitElems = Romo.find(this.romoModal.popupElem, '[data-romo-form-submit]');
|
103
|
+
var spinnerElems = Romo.find(this.romoModal.popupElem, '[data-romo-spinner-auto="true"]');
|
104
|
+
|
105
|
+
this.romoForm = new RomoForm(formElem, submitElems, spinnerElems);
|
106
|
+
}
|
107
107
|
}
|
108
108
|
|
109
|
-
|
110
|
-
|
111
|
-
|
109
|
+
// event functions
|
110
|
+
|
111
|
+
// init
|
112
112
|
|
113
|
+
Romo.addElemsInitSelector('[data-romo-modalForm-auto="true"]', RomoModalForm);
|
data/assets/js/romo/onkey.js
CHANGED
@@ -1,35 +1,38 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
return new RomoOnkey(element);
|
4
|
-
});
|
5
|
-
}
|
1
|
+
var RomoOnkey = RomoComponent(function(elem) {
|
2
|
+
this.elem = elem;
|
6
3
|
|
7
|
-
var RomoOnkey = function(element) {
|
8
|
-
this.elem = $(element);
|
9
4
|
this.defaultTriggerOn = 'keydown';
|
5
|
+
this.defaultDelayMs = 0;
|
6
|
+
this.delayTimeout = undefined;
|
10
7
|
|
11
8
|
this.doInit();
|
12
9
|
|
13
|
-
this.triggerOn = this.elem
|
14
|
-
|
10
|
+
this.triggerOn = Romo.data(this.elem, 'romo-onkey-on') || this.defaultTriggerOn;
|
11
|
+
Romo.on(this.elem, this.triggerOn, Romo.proxy(this._onTrigger, this));
|
15
12
|
|
16
|
-
this.elem
|
17
|
-
}
|
13
|
+
Romo.trigger(this.elem, 'romoOnkey:ready', [this]);
|
14
|
+
});
|
15
|
+
|
16
|
+
// private
|
18
17
|
|
19
|
-
RomoOnkey.prototype.
|
20
|
-
|
18
|
+
RomoOnkey.prototype._doTrigger = function(triggerEvent) {
|
19
|
+
clearTimeout(this.delayTimeout);
|
20
|
+
this.delayTimeout = setTimeout(
|
21
|
+
Romo.proxy(function() {
|
22
|
+
Romo.trigger(this.elem, 'romoOnkey:trigger', [triggerEvent, this]);
|
23
|
+
}, this),
|
24
|
+
Romo.data(this.elem, 'romo-onkey-delay-ms') || this.defaultDelayMs
|
25
|
+
);
|
21
26
|
}
|
22
27
|
|
23
|
-
|
24
|
-
|
25
|
-
|
28
|
+
// event functions
|
29
|
+
|
30
|
+
RomoOnkey.prototype.romoEvFn._onTrigger = function(e) {
|
31
|
+
if (Romo.hasClass(this.elem, 'disabled') === false) {
|
32
|
+
this._doTrigger(e);
|
26
33
|
}
|
27
34
|
}
|
28
35
|
|
29
|
-
|
30
|
-
this.elem.trigger('onkey:trigger', [triggerEvent, this]);
|
31
|
-
}
|
36
|
+
// init
|
32
37
|
|
33
|
-
Romo.
|
34
|
-
Romo.initUIElems(e, '[data-romo-onkey-auto="true"]').romoOnkey();
|
35
|
-
});
|
38
|
+
Romo.addElemsInitSelector('[data-romo-onkey-auto="true"]', RomoOnkey);
|