bootstrap-combobox 1.2.2 → 1.2.3
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.
@@ -1,5 +1,5 @@
|
|
1
1
|
/* =============================================================
|
2
|
-
* bootstrap-combobox.js v1.2.
|
2
|
+
* bootstrap-combobox.js v1.2.3
|
3
3
|
* =============================================================
|
4
4
|
* Copyright 2012 Daniel Farrell
|
5
5
|
*
|
@@ -29,6 +29,7 @@
|
|
29
29
|
this.$button = this.$container.find('.dropdown-toggle')
|
30
30
|
this.$menu = $(this.options.menu).appendTo('body')
|
31
31
|
this.matcher = this.options.matcher || this.matcher
|
32
|
+
this.updater = this.options.updater || this.updater
|
32
33
|
this.sorter = this.options.sorter || this.sorter
|
33
34
|
this.highlighter = this.options.highlighter || this.highlighter
|
34
35
|
this.shown = false
|
@@ -46,6 +47,7 @@
|
|
46
47
|
constructor: Combobox
|
47
48
|
|
48
49
|
, setup: function () {
|
50
|
+
console.log('setup')
|
49
51
|
var combobox = $(this.options.template)
|
50
52
|
this.$source.before(combobox)
|
51
53
|
this.$source.hide()
|
@@ -53,6 +55,7 @@
|
|
53
55
|
}
|
54
56
|
|
55
57
|
, parse: function () {
|
58
|
+
console.log('parse')
|
56
59
|
var that = this
|
57
60
|
, map = {}
|
58
61
|
, source = []
|
@@ -77,6 +80,7 @@
|
|
77
80
|
}
|
78
81
|
|
79
82
|
, transferAttributes: function() {
|
83
|
+
console.log('transferAttributes')
|
80
84
|
this.options.placeholder = this.$source.attr('data-placeholder') || this.options.placeholder
|
81
85
|
this.$element.attr('placeholder', this.options.placeholder)
|
82
86
|
this.$target.prop('name', this.$source.prop('name'))
|
@@ -91,6 +95,7 @@
|
|
91
95
|
}
|
92
96
|
|
93
97
|
, toggle: function () {
|
98
|
+
console.log('toggle')
|
94
99
|
if (this.$container.hasClass('combobox-selected')) {
|
95
100
|
this.clearTarget()
|
96
101
|
this.triggerChange()
|
@@ -106,10 +111,12 @@
|
|
106
111
|
}
|
107
112
|
|
108
113
|
, clearElement: function () {
|
114
|
+
console.log('clearElement')
|
109
115
|
this.$element.val('').focus()
|
110
116
|
}
|
111
117
|
|
112
118
|
, clearTarget: function () {
|
119
|
+
console.log('clearTarget')
|
113
120
|
this.$source.val('')
|
114
121
|
this.$target.val('')
|
115
122
|
this.$container.removeClass('combobox-selected')
|
@@ -117,20 +124,30 @@
|
|
117
124
|
}
|
118
125
|
|
119
126
|
, triggerChange: function () {
|
127
|
+
console.log('triggerChagne')
|
120
128
|
this.$source.trigger('change')
|
121
129
|
}
|
122
130
|
|
123
131
|
, refresh: function () {
|
132
|
+
console.log('refresh')
|
124
133
|
this.source = this.parse()
|
125
134
|
this.options.items = this.source.length
|
126
135
|
}
|
127
136
|
|
128
137
|
// modified typeahead function adding container and target handling
|
129
138
|
, select: function () {
|
139
|
+
console.log('select')
|
130
140
|
var val = this.$menu.find('.active').attr('data-value')
|
141
|
+
console.log('in select, val is: ' + val + ' this.query is ' + this.query)
|
142
|
+
var mapped_val = this.map[val]
|
143
|
+
if (!this.options.force_match && this.query != '' && !this.matcher(val)) {
|
144
|
+
val = this.query
|
145
|
+
this.$menu.find('.active').removeClass('active')
|
146
|
+
mapped_val = val
|
147
|
+
}
|
131
148
|
this.$element.val(this.updater(val)).trigger('change')
|
132
|
-
this.$source.val(
|
133
|
-
this.$target.val(
|
149
|
+
this.$source.val(mapped_val).trigger('change')
|
150
|
+
this.$target.val(mapped_val).trigger('change')
|
134
151
|
this.$container.addClass('combobox-selected')
|
135
152
|
this.selected = true
|
136
153
|
return this.hide()
|
@@ -138,12 +155,14 @@
|
|
138
155
|
|
139
156
|
// modified typeahead function removing the blank handling and source function handling
|
140
157
|
, lookup: function (event) {
|
158
|
+
console.log('lookup')
|
141
159
|
this.query = this.$element.val()
|
142
160
|
return this.process(this.source)
|
143
161
|
}
|
144
162
|
|
145
163
|
// modified typeahead function adding button handling and remove mouseleave
|
146
164
|
, listen: function () {
|
165
|
+
console.log('listen')
|
147
166
|
this.$element
|
148
167
|
.on('focus', $.proxy(this.focus, this))
|
149
168
|
.on('blur', $.proxy(this.blur, this))
|
@@ -165,6 +184,7 @@
|
|
165
184
|
|
166
185
|
// modified typeahead function to clear on type and prevent on moving around
|
167
186
|
, keyup: function (e) {
|
187
|
+
console.log('keyup')
|
168
188
|
switch(e.keyCode) {
|
169
189
|
case 40: // down arrow
|
170
190
|
case 39: // right arrow
|
@@ -199,6 +219,7 @@
|
|
199
219
|
|
200
220
|
// modified typeahead function to force a match and add a delay on hide
|
201
221
|
, blur: function (e) {
|
222
|
+
console.log('blur')
|
202
223
|
var that = this
|
203
224
|
this.focused = false
|
204
225
|
var val = this.$element.val()
|
@@ -216,6 +237,7 @@
|
|
216
237
|
|
217
238
|
// modified typeahead function to not hide
|
218
239
|
, mouseleave: function (e) {
|
240
|
+
console.log('mouseleave')
|
219
241
|
this.mousedover = false
|
220
242
|
}
|
221
243
|
})
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bootstrap-combobox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-07-
|
13
|
+
date: 2013-07-24 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: railties
|