selectivity-rails 0.1.8 → 0.1.9
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/lib/selectivity/rails/version.rb +1 -1
- data/vendor/assets/javascripts/selectivity.js +790 -362
- data/vendor/assets/stylesheets/selectivity.sass +2 -4
- data/vendor/assets/stylesheets/selectivity/base.sass +3 -0
- data/vendor/assets/stylesheets/selectivity/dropdown.sass +1 -1
- data/vendor/assets/stylesheets/selectivity/{multiple.sass → input-types/multiple.sass} +0 -0
- data/vendor/assets/stylesheets/selectivity/{single.sass → input-types/single.sass} +0 -0
- data/vendor/assets/stylesheets/selectivity/{submenu.sass → plugins/submenu.sass} +0 -0
- data/vendor/assets/stylesheets/selectivity/variables.sass +1 -2
- metadata +5 -6
- data/vendor/assets/stylesheets/selectivity/backdrop.sass +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d7c74200a4009b6c4523c5d5e2e9df35121bfba
|
4
|
+
data.tar.gz: 974239a9e5a5741fe860924024e0f43933bb2a67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5856966a409c802589e8d08d92223604219204be9b846beb4e5070c474bd41bfe4c1996021d4f43a19e1d53086161296a6919fcce9ea5d44cf7b43e27cdc712
|
7
|
+
data.tar.gz: 945a04f91a285cfc8da1f3fc6afafc105e9008408a11e48aa046ef612981a9c205353b938cc59a874edd73d5837db3ca0f44c64be24776b6e9576340540228be
|
@@ -5,9 +5,597 @@
|
|
5
5
|
* (c) 2016 Speakap BV
|
6
6
|
* Available under MIT license <https://github.com/arendjr/selectivity/blob/master/LICENSE>
|
7
7
|
*/
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.selectivity = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
|
9
|
+
var root = _dereq_(4);
|
10
|
+
|
11
|
+
/** Built-in value references. */
|
12
|
+
var Symbol = root.Symbol;
|
13
|
+
|
14
|
+
module.exports = Symbol;
|
15
|
+
|
16
|
+
},{"4":4}],2:[function(_dereq_,module,exports){
|
17
|
+
/**
|
18
|
+
* Checks if `value` is a global object.
|
19
|
+
*
|
20
|
+
* @private
|
21
|
+
* @param {*} value The value to check.
|
22
|
+
* @returns {null|Object} Returns `value` if it's a global object, else `null`.
|
23
|
+
*/
|
24
|
+
function checkGlobal(value) {
|
25
|
+
return (value && value.Object === Object) ? value : null;
|
26
|
+
}
|
27
|
+
|
28
|
+
module.exports = checkGlobal;
|
29
|
+
|
30
|
+
},{}],3:[function(_dereq_,module,exports){
|
31
|
+
/** Used to map characters to HTML entities. */
|
32
|
+
var htmlEscapes = {
|
33
|
+
'&': '&',
|
34
|
+
'<': '<',
|
35
|
+
'>': '>',
|
36
|
+
'"': '"',
|
37
|
+
"'": ''',
|
38
|
+
'`': '`'
|
39
|
+
};
|
40
|
+
|
41
|
+
/**
|
42
|
+
* Used by `_.escape` to convert characters to HTML entities.
|
43
|
+
*
|
44
|
+
* @private
|
45
|
+
* @param {string} chr The matched character to escape.
|
46
|
+
* @returns {string} Returns the escaped character.
|
47
|
+
*/
|
48
|
+
function escapeHtmlChar(chr) {
|
49
|
+
return htmlEscapes[chr];
|
50
|
+
}
|
51
|
+
|
52
|
+
module.exports = escapeHtmlChar;
|
53
|
+
|
54
|
+
},{}],4:[function(_dereq_,module,exports){
|
55
|
+
(function (global){
|
56
|
+
var checkGlobal = _dereq_(2);
|
57
|
+
|
58
|
+
/** Used to determine if values are of the language type `Object`. */
|
59
|
+
var objectTypes = {
|
60
|
+
'function': true,
|
61
|
+
'object': true
|
62
|
+
};
|
63
|
+
|
64
|
+
/** Detect free variable `exports`. */
|
65
|
+
var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType)
|
66
|
+
? exports
|
67
|
+
: undefined;
|
68
|
+
|
69
|
+
/** Detect free variable `module`. */
|
70
|
+
var freeModule = (objectTypes[typeof module] && module && !module.nodeType)
|
71
|
+
? module
|
72
|
+
: undefined;
|
73
|
+
|
74
|
+
/** Detect free variable `global` from Node.js. */
|
75
|
+
var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global);
|
76
|
+
|
77
|
+
/** Detect free variable `self`. */
|
78
|
+
var freeSelf = checkGlobal(objectTypes[typeof self] && self);
|
79
|
+
|
80
|
+
/** Detect free variable `window`. */
|
81
|
+
var freeWindow = checkGlobal(objectTypes[typeof window] && window);
|
82
|
+
|
83
|
+
/** Detect `this` as the global object. */
|
84
|
+
var thisGlobal = checkGlobal(objectTypes[typeof this] && this);
|
85
|
+
|
86
|
+
/**
|
87
|
+
* Used as a reference to the global object.
|
88
|
+
*
|
89
|
+
* The `this` value is used if it's the global object to avoid Greasemonkey's
|
90
|
+
* restricted `window` object, otherwise the `window` object is used.
|
91
|
+
*/
|
92
|
+
var root = freeGlobal ||
|
93
|
+
((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) ||
|
94
|
+
freeSelf || thisGlobal || Function('return this')();
|
95
|
+
|
96
|
+
module.exports = root;
|
97
|
+
|
98
|
+
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
99
|
+
},{"2":2}],5:[function(_dereq_,module,exports){
|
100
|
+
var isObject = _dereq_(8),
|
101
|
+
now = _dereq_(11),
|
102
|
+
toNumber = _dereq_(12);
|
103
|
+
|
104
|
+
/** Used as the `TypeError` message for "Functions" methods. */
|
105
|
+
var FUNC_ERROR_TEXT = 'Expected a function';
|
106
|
+
|
107
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
108
|
+
var nativeMax = Math.max;
|
109
|
+
|
110
|
+
/**
|
111
|
+
* Creates a debounced function that delays invoking `func` until after `wait`
|
112
|
+
* milliseconds have elapsed since the last time the debounced function was
|
113
|
+
* invoked. The debounced function comes with a `cancel` method to cancel
|
114
|
+
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
115
|
+
* Provide an options object to indicate whether `func` should be invoked on
|
116
|
+
* the leading and/or trailing edge of the `wait` timeout. The `func` is invoked
|
117
|
+
* with the last arguments provided to the debounced function. Subsequent calls
|
118
|
+
* to the debounced function return the result of the last `func` invocation.
|
119
|
+
*
|
120
|
+
* **Note:** If `leading` and `trailing` options are `true`, `func` is invoked
|
121
|
+
* on the trailing edge of the timeout only if the debounced function is
|
122
|
+
* invoked more than once during the `wait` timeout.
|
123
|
+
*
|
124
|
+
* See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)
|
125
|
+
* for details over the differences between `_.debounce` and `_.throttle`.
|
126
|
+
*
|
127
|
+
* @static
|
128
|
+
* @memberOf _
|
129
|
+
* @category Function
|
130
|
+
* @param {Function} func The function to debounce.
|
131
|
+
* @param {number} [wait=0] The number of milliseconds to delay.
|
132
|
+
* @param {Object} [options] The options object.
|
133
|
+
* @param {boolean} [options.leading=false] Specify invoking on the leading
|
134
|
+
* edge of the timeout.
|
135
|
+
* @param {number} [options.maxWait] The maximum time `func` is allowed to be
|
136
|
+
* delayed before it's invoked.
|
137
|
+
* @param {boolean} [options.trailing=true] Specify invoking on the trailing
|
138
|
+
* edge of the timeout.
|
139
|
+
* @returns {Function} Returns the new debounced function.
|
140
|
+
* @example
|
141
|
+
*
|
142
|
+
* // Avoid costly calculations while the window size is in flux.
|
143
|
+
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
|
144
|
+
*
|
145
|
+
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
|
146
|
+
* jQuery(element).on('click', _.debounce(sendMail, 300, {
|
147
|
+
* 'leading': true,
|
148
|
+
* 'trailing': false
|
149
|
+
* }));
|
150
|
+
*
|
151
|
+
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
|
152
|
+
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
|
153
|
+
* var source = new EventSource('/stream');
|
154
|
+
* jQuery(source).on('message', debounced);
|
155
|
+
*
|
156
|
+
* // Cancel the trailing debounced invocation.
|
157
|
+
* jQuery(window).on('popstate', debounced.cancel);
|
158
|
+
*/
|
159
|
+
function debounce(func, wait, options) {
|
160
|
+
var args,
|
161
|
+
maxTimeoutId,
|
162
|
+
result,
|
163
|
+
stamp,
|
164
|
+
thisArg,
|
165
|
+
timeoutId,
|
166
|
+
trailingCall,
|
167
|
+
lastCalled = 0,
|
168
|
+
leading = false,
|
169
|
+
maxWait = false,
|
170
|
+
trailing = true;
|
171
|
+
|
172
|
+
if (typeof func != 'function') {
|
173
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
174
|
+
}
|
175
|
+
wait = toNumber(wait) || 0;
|
176
|
+
if (isObject(options)) {
|
177
|
+
leading = !!options.leading;
|
178
|
+
maxWait = 'maxWait' in options && nativeMax(toNumber(options.maxWait) || 0, wait);
|
179
|
+
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
180
|
+
}
|
181
|
+
|
182
|
+
function cancel() {
|
183
|
+
if (timeoutId) {
|
184
|
+
clearTimeout(timeoutId);
|
185
|
+
}
|
186
|
+
if (maxTimeoutId) {
|
187
|
+
clearTimeout(maxTimeoutId);
|
188
|
+
}
|
189
|
+
lastCalled = 0;
|
190
|
+
args = maxTimeoutId = thisArg = timeoutId = trailingCall = undefined;
|
191
|
+
}
|
192
|
+
|
193
|
+
function complete(isCalled, id) {
|
194
|
+
if (id) {
|
195
|
+
clearTimeout(id);
|
196
|
+
}
|
197
|
+
maxTimeoutId = timeoutId = trailingCall = undefined;
|
198
|
+
if (isCalled) {
|
199
|
+
lastCalled = now();
|
200
|
+
result = func.apply(thisArg, args);
|
201
|
+
if (!timeoutId && !maxTimeoutId) {
|
202
|
+
args = thisArg = undefined;
|
203
|
+
}
|
204
|
+
}
|
205
|
+
}
|
206
|
+
|
207
|
+
function delayed() {
|
208
|
+
var remaining = wait - (now() - stamp);
|
209
|
+
if (remaining <= 0 || remaining > wait) {
|
210
|
+
complete(trailingCall, maxTimeoutId);
|
211
|
+
} else {
|
212
|
+
timeoutId = setTimeout(delayed, remaining);
|
213
|
+
}
|
214
|
+
}
|
215
|
+
|
216
|
+
function flush() {
|
217
|
+
if ((timeoutId && trailingCall) || (maxTimeoutId && trailing)) {
|
218
|
+
result = func.apply(thisArg, args);
|
219
|
+
}
|
220
|
+
cancel();
|
221
|
+
return result;
|
222
|
+
}
|
223
|
+
|
224
|
+
function maxDelayed() {
|
225
|
+
complete(trailing, timeoutId);
|
226
|
+
}
|
227
|
+
|
228
|
+
function debounced() {
|
229
|
+
args = arguments;
|
230
|
+
stamp = now();
|
231
|
+
thisArg = this;
|
232
|
+
trailingCall = trailing && (timeoutId || !leading);
|
233
|
+
|
234
|
+
if (maxWait === false) {
|
235
|
+
var leadingCall = leading && !timeoutId;
|
236
|
+
} else {
|
237
|
+
if (!lastCalled && !maxTimeoutId && !leading) {
|
238
|
+
lastCalled = stamp;
|
239
|
+
}
|
240
|
+
var remaining = maxWait - (stamp - lastCalled);
|
241
|
+
|
242
|
+
var isCalled = (remaining <= 0 || remaining > maxWait) &&
|
243
|
+
(leading || maxTimeoutId);
|
244
|
+
|
245
|
+
if (isCalled) {
|
246
|
+
if (maxTimeoutId) {
|
247
|
+
maxTimeoutId = clearTimeout(maxTimeoutId);
|
248
|
+
}
|
249
|
+
lastCalled = stamp;
|
250
|
+
result = func.apply(thisArg, args);
|
251
|
+
}
|
252
|
+
else if (!maxTimeoutId) {
|
253
|
+
maxTimeoutId = setTimeout(maxDelayed, remaining);
|
254
|
+
}
|
255
|
+
}
|
256
|
+
if (isCalled && timeoutId) {
|
257
|
+
timeoutId = clearTimeout(timeoutId);
|
258
|
+
}
|
259
|
+
else if (!timeoutId && wait !== maxWait) {
|
260
|
+
timeoutId = setTimeout(delayed, wait);
|
261
|
+
}
|
262
|
+
if (leadingCall) {
|
263
|
+
isCalled = true;
|
264
|
+
result = func.apply(thisArg, args);
|
265
|
+
}
|
266
|
+
if (isCalled && !timeoutId && !maxTimeoutId) {
|
267
|
+
args = thisArg = undefined;
|
268
|
+
}
|
269
|
+
return result;
|
270
|
+
}
|
271
|
+
debounced.cancel = cancel;
|
272
|
+
debounced.flush = flush;
|
273
|
+
return debounced;
|
274
|
+
}
|
275
|
+
|
276
|
+
module.exports = debounce;
|
277
|
+
|
278
|
+
},{"11":11,"12":12,"8":8}],6:[function(_dereq_,module,exports){
|
279
|
+
var escapeHtmlChar = _dereq_(3),
|
280
|
+
toString = _dereq_(13);
|
281
|
+
|
282
|
+
/** Used to match HTML entities and HTML characters. */
|
283
|
+
var reUnescapedHtml = /[&<>"'`]/g,
|
284
|
+
reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
|
285
|
+
|
286
|
+
/**
|
287
|
+
* Converts the characters "&", "<", ">", '"', "'", and "\`" in `string` to
|
288
|
+
* their corresponding HTML entities.
|
289
|
+
*
|
290
|
+
* **Note:** No other characters are escaped. To escape additional
|
291
|
+
* characters use a third-party library like [_he_](https://mths.be/he).
|
292
|
+
*
|
293
|
+
* Though the ">" character is escaped for symmetry, characters like
|
294
|
+
* ">" and "/" don't need escaping in HTML and have no special meaning
|
295
|
+
* unless they're part of a tag or unquoted attribute value.
|
296
|
+
* See [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
|
297
|
+
* (under "semi-related fun fact") for more details.
|
298
|
+
*
|
299
|
+
* Backticks are escaped because in IE < 9, they can break out of
|
300
|
+
* attribute values or HTML comments. See [#59](https://html5sec.org/#59),
|
301
|
+
* [#102](https://html5sec.org/#102), [#108](https://html5sec.org/#108), and
|
302
|
+
* [#133](https://html5sec.org/#133) of the [HTML5 Security Cheatsheet](https://html5sec.org/)
|
303
|
+
* for more details.
|
304
|
+
*
|
305
|
+
* When working with HTML you should always [quote attribute values](http://wonko.com/post/html-escaping)
|
306
|
+
* to reduce XSS vectors.
|
307
|
+
*
|
308
|
+
* @static
|
309
|
+
* @memberOf _
|
310
|
+
* @category String
|
311
|
+
* @param {string} [string=''] The string to escape.
|
312
|
+
* @returns {string} Returns the escaped string.
|
313
|
+
* @example
|
314
|
+
*
|
315
|
+
* _.escape('fred, barney, & pebbles');
|
316
|
+
* // => 'fred, barney, & pebbles'
|
317
|
+
*/
|
318
|
+
function escape(string) {
|
319
|
+
string = toString(string);
|
320
|
+
return (string && reHasUnescapedHtml.test(string))
|
321
|
+
? string.replace(reUnescapedHtml, escapeHtmlChar)
|
322
|
+
: string;
|
323
|
+
}
|
324
|
+
|
325
|
+
module.exports = escape;
|
326
|
+
|
327
|
+
},{"13":13,"3":3}],7:[function(_dereq_,module,exports){
|
328
|
+
var isObject = _dereq_(8);
|
329
|
+
|
330
|
+
/** `Object#toString` result references. */
|
331
|
+
var funcTag = '[object Function]',
|
332
|
+
genTag = '[object GeneratorFunction]';
|
333
|
+
|
334
|
+
/** Used for built-in method references. */
|
335
|
+
var objectProto = Object.prototype;
|
336
|
+
|
337
|
+
/**
|
338
|
+
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
339
|
+
* of values.
|
340
|
+
*/
|
341
|
+
var objectToString = objectProto.toString;
|
342
|
+
|
343
|
+
/**
|
344
|
+
* Checks if `value` is classified as a `Function` object.
|
345
|
+
*
|
346
|
+
* @static
|
347
|
+
* @memberOf _
|
348
|
+
* @category Lang
|
349
|
+
* @param {*} value The value to check.
|
350
|
+
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
|
351
|
+
* @example
|
352
|
+
*
|
353
|
+
* _.isFunction(_);
|
354
|
+
* // => true
|
355
|
+
*
|
356
|
+
* _.isFunction(/abc/);
|
357
|
+
* // => false
|
358
|
+
*/
|
359
|
+
function isFunction(value) {
|
360
|
+
// The use of `Object#toString` avoids issues with the `typeof` operator
|
361
|
+
// in Safari 8 which returns 'object' for typed array and weak map constructors,
|
362
|
+
// and PhantomJS 1.9 which returns 'function' for `NodeList` instances.
|
363
|
+
var tag = isObject(value) ? objectToString.call(value) : '';
|
364
|
+
return tag == funcTag || tag == genTag;
|
365
|
+
}
|
366
|
+
|
367
|
+
module.exports = isFunction;
|
368
|
+
|
369
|
+
},{"8":8}],8:[function(_dereq_,module,exports){
|
370
|
+
/**
|
371
|
+
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
|
372
|
+
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
373
|
+
*
|
374
|
+
* @static
|
375
|
+
* @memberOf _
|
376
|
+
* @category Lang
|
377
|
+
* @param {*} value The value to check.
|
378
|
+
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
379
|
+
* @example
|
380
|
+
*
|
381
|
+
* _.isObject({});
|
382
|
+
* // => true
|
383
|
+
*
|
384
|
+
* _.isObject([1, 2, 3]);
|
385
|
+
* // => true
|
386
|
+
*
|
387
|
+
* _.isObject(_.noop);
|
388
|
+
* // => true
|
389
|
+
*
|
390
|
+
* _.isObject(null);
|
391
|
+
* // => false
|
392
|
+
*/
|
393
|
+
function isObject(value) {
|
394
|
+
var type = typeof value;
|
395
|
+
return !!value && (type == 'object' || type == 'function');
|
396
|
+
}
|
397
|
+
|
398
|
+
module.exports = isObject;
|
399
|
+
|
400
|
+
},{}],9:[function(_dereq_,module,exports){
|
401
|
+
/**
|
402
|
+
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
403
|
+
* and has a `typeof` result of "object".
|
404
|
+
*
|
405
|
+
* @static
|
406
|
+
* @memberOf _
|
407
|
+
* @category Lang
|
408
|
+
* @param {*} value The value to check.
|
409
|
+
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
410
|
+
* @example
|
411
|
+
*
|
412
|
+
* _.isObjectLike({});
|
413
|
+
* // => true
|
414
|
+
*
|
415
|
+
* _.isObjectLike([1, 2, 3]);
|
416
|
+
* // => true
|
417
|
+
*
|
418
|
+
* _.isObjectLike(_.noop);
|
419
|
+
* // => false
|
420
|
+
*
|
421
|
+
* _.isObjectLike(null);
|
422
|
+
* // => false
|
423
|
+
*/
|
424
|
+
function isObjectLike(value) {
|
425
|
+
return !!value && typeof value == 'object';
|
426
|
+
}
|
427
|
+
|
428
|
+
module.exports = isObjectLike;
|
429
|
+
|
430
|
+
},{}],10:[function(_dereq_,module,exports){
|
431
|
+
var isObjectLike = _dereq_(9);
|
432
|
+
|
433
|
+
/** `Object#toString` result references. */
|
434
|
+
var symbolTag = '[object Symbol]';
|
435
|
+
|
436
|
+
/** Used for built-in method references. */
|
437
|
+
var objectProto = Object.prototype;
|
438
|
+
|
439
|
+
/**
|
440
|
+
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
441
|
+
* of values.
|
442
|
+
*/
|
443
|
+
var objectToString = objectProto.toString;
|
444
|
+
|
445
|
+
/**
|
446
|
+
* Checks if `value` is classified as a `Symbol` primitive or object.
|
447
|
+
*
|
448
|
+
* @static
|
449
|
+
* @memberOf _
|
450
|
+
* @category Lang
|
451
|
+
* @param {*} value The value to check.
|
452
|
+
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
|
453
|
+
* @example
|
454
|
+
*
|
455
|
+
* _.isSymbol(Symbol.iterator);
|
456
|
+
* // => true
|
457
|
+
*
|
458
|
+
* _.isSymbol('abc');
|
459
|
+
* // => false
|
460
|
+
*/
|
461
|
+
function isSymbol(value) {
|
462
|
+
return typeof value == 'symbol' ||
|
463
|
+
(isObjectLike(value) && objectToString.call(value) == symbolTag);
|
464
|
+
}
|
465
|
+
|
466
|
+
module.exports = isSymbol;
|
467
|
+
|
468
|
+
},{"9":9}],11:[function(_dereq_,module,exports){
|
469
|
+
/**
|
470
|
+
* Gets the timestamp of the number of milliseconds that have elapsed since
|
471
|
+
* the Unix epoch (1 January 1970 00:00:00 UTC).
|
472
|
+
*
|
473
|
+
* @static
|
474
|
+
* @memberOf _
|
475
|
+
* @type {Function}
|
476
|
+
* @category Date
|
477
|
+
* @returns {number} Returns the timestamp.
|
478
|
+
* @example
|
479
|
+
*
|
480
|
+
* _.defer(function(stamp) {
|
481
|
+
* console.log(_.now() - stamp);
|
482
|
+
* }, _.now());
|
483
|
+
* // => logs the number of milliseconds it took for the deferred function to be invoked
|
484
|
+
*/
|
485
|
+
var now = Date.now;
|
486
|
+
|
487
|
+
module.exports = now;
|
488
|
+
|
489
|
+
},{}],12:[function(_dereq_,module,exports){
|
490
|
+
var isFunction = _dereq_(7),
|
491
|
+
isObject = _dereq_(8);
|
492
|
+
|
493
|
+
/** Used as references for various `Number` constants. */
|
494
|
+
var NAN = 0 / 0;
|
495
|
+
|
496
|
+
/** Used to match leading and trailing whitespace. */
|
497
|
+
var reTrim = /^\s+|\s+$/g;
|
498
|
+
|
499
|
+
/** Used to detect bad signed hexadecimal string values. */
|
500
|
+
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
501
|
+
|
502
|
+
/** Used to detect binary string values. */
|
503
|
+
var reIsBinary = /^0b[01]+$/i;
|
504
|
+
|
505
|
+
/** Used to detect octal string values. */
|
506
|
+
var reIsOctal = /^0o[0-7]+$/i;
|
507
|
+
|
508
|
+
/** Built-in method references without a dependency on `root`. */
|
509
|
+
var freeParseInt = parseInt;
|
510
|
+
|
511
|
+
/**
|
512
|
+
* Converts `value` to a number.
|
513
|
+
*
|
514
|
+
* @static
|
515
|
+
* @memberOf _
|
516
|
+
* @category Lang
|
517
|
+
* @param {*} value The value to process.
|
518
|
+
* @returns {number} Returns the number.
|
519
|
+
* @example
|
520
|
+
*
|
521
|
+
* _.toNumber(3);
|
522
|
+
* // => 3
|
523
|
+
*
|
524
|
+
* _.toNumber(Number.MIN_VALUE);
|
525
|
+
* // => 5e-324
|
526
|
+
*
|
527
|
+
* _.toNumber(Infinity);
|
528
|
+
* // => Infinity
|
529
|
+
*
|
530
|
+
* _.toNumber('3');
|
531
|
+
* // => 3
|
532
|
+
*/
|
533
|
+
function toNumber(value) {
|
534
|
+
if (isObject(value)) {
|
535
|
+
var other = isFunction(value.valueOf) ? value.valueOf() : value;
|
536
|
+
value = isObject(other) ? (other + '') : other;
|
537
|
+
}
|
538
|
+
if (typeof value != 'string') {
|
539
|
+
return value === 0 ? value : +value;
|
540
|
+
}
|
541
|
+
value = value.replace(reTrim, '');
|
542
|
+
var isBinary = reIsBinary.test(value);
|
543
|
+
return (isBinary || reIsOctal.test(value))
|
544
|
+
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
|
545
|
+
: (reIsBadHex.test(value) ? NAN : +value);
|
546
|
+
}
|
547
|
+
|
548
|
+
module.exports = toNumber;
|
549
|
+
|
550
|
+
},{"7":7,"8":8}],13:[function(_dereq_,module,exports){
|
551
|
+
var Symbol = _dereq_(1),
|
552
|
+
isSymbol = _dereq_(10);
|
553
|
+
|
554
|
+
/** Used as references for various `Number` constants. */
|
555
|
+
var INFINITY = 1 / 0;
|
556
|
+
|
557
|
+
/** Used to convert symbols to primitives and strings. */
|
558
|
+
var symbolProto = Symbol ? Symbol.prototype : undefined,
|
559
|
+
symbolToString = symbolProto ? symbolProto.toString : undefined;
|
560
|
+
|
561
|
+
/**
|
562
|
+
* Converts `value` to a string if it's not one. An empty string is returned
|
563
|
+
* for `null` and `undefined` values. The sign of `-0` is preserved.
|
564
|
+
*
|
565
|
+
* @static
|
566
|
+
* @memberOf _
|
567
|
+
* @category Lang
|
568
|
+
* @param {*} value The value to process.
|
569
|
+
* @returns {string} Returns the string.
|
570
|
+
* @example
|
571
|
+
*
|
572
|
+
* _.toString(null);
|
573
|
+
* // => ''
|
574
|
+
*
|
575
|
+
* _.toString(-0);
|
576
|
+
* // => '-0'
|
577
|
+
*
|
578
|
+
* _.toString([1, 2, 3]);
|
579
|
+
* // => '1,2,3'
|
580
|
+
*/
|
581
|
+
function toString(value) {
|
582
|
+
// Exit early for strings to avoid a performance hit in some environments.
|
583
|
+
if (typeof value == 'string') {
|
584
|
+
return value;
|
585
|
+
}
|
586
|
+
if (value == null) {
|
587
|
+
return '';
|
588
|
+
}
|
589
|
+
if (isSymbol(value)) {
|
590
|
+
return symbolToString ? symbolToString.call(value) : '';
|
591
|
+
}
|
592
|
+
var result = (value + '');
|
593
|
+
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
594
|
+
}
|
595
|
+
|
596
|
+
module.exports = toString;
|
597
|
+
|
598
|
+
},{"1":1,"10":10}],14:[function(_dereq_,module,exports){
|
11
599
|
'use strict';
|
12
600
|
|
13
601
|
var $ = window.jQuery || window.Zepto;
|
@@ -80,158 +668,15 @@ $.extend(EventDelegator.prototype, {
|
|
80
668
|
|
81
669
|
module.exports = EventDelegator;
|
82
670
|
|
83
|
-
},{"jquery":"jquery"}],
|
84
|
-
'use strict';
|
85
|
-
|
86
|
-
/**
|
87
|
-
* @license
|
88
|
-
* lodash 3.3.1 (Custom Build) <https://lodash.com/>
|
89
|
-
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
90
|
-
* Based on Underscore.js 1.8.2 <http://underscorejs.org/LICENSE>
|
91
|
-
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
92
|
-
* Available under MIT license <https://lodash.com/license>
|
93
|
-
*/
|
94
|
-
|
95
|
-
/**
|
96
|
-
* Gets the number of milliseconds that have elapsed since the Unix epoch
|
97
|
-
* (1 January 1970 00:00:00 UTC).
|
98
|
-
*
|
99
|
-
* @static
|
100
|
-
* @memberOf _
|
101
|
-
* @category Date
|
102
|
-
* @example
|
103
|
-
*
|
104
|
-
* _.defer(function(stamp) {
|
105
|
-
* console.log(_.now() - stamp);
|
106
|
-
* }, _.now());
|
107
|
-
* // => logs the number of milliseconds it took for the deferred function to be invoked
|
108
|
-
*/
|
109
|
-
var now = Date.now;
|
110
|
-
|
111
|
-
/**
|
112
|
-
* Creates a function that delays invoking `func` until after `wait` milliseconds
|
113
|
-
* have elapsed since the last time it was invoked.
|
114
|
-
*
|
115
|
-
* See [David Corbacho's article]
|
116
|
-
* (http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)
|
117
|
-
* for details over the differences between `_.debounce` and `_.throttle`.
|
118
|
-
*
|
119
|
-
* @static
|
120
|
-
* @memberOf _
|
121
|
-
* @category Function
|
122
|
-
* @param {Function} func The function to debounce.
|
123
|
-
* @param {number} [wait=0] The number of milliseconds to delay.
|
124
|
-
* @returns {Function} Returns the new debounced function.
|
125
|
-
* @example
|
126
|
-
*
|
127
|
-
* // avoid costly calculations while the window size is in flux
|
128
|
-
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
|
129
|
-
*/
|
130
|
-
function debounce(func, wait) {
|
131
|
-
var args,
|
132
|
-
result,
|
133
|
-
stamp,
|
134
|
-
timeoutId,
|
135
|
-
trailingCall,
|
136
|
-
lastCalled = 0;
|
137
|
-
|
138
|
-
wait = wait < 0 ? 0 : (+wait || 0);
|
139
|
-
|
140
|
-
function delayed() {
|
141
|
-
var remaining = wait - (now() - stamp);
|
142
|
-
if (remaining <= 0 || remaining > wait) {
|
143
|
-
var isCalled = trailingCall;
|
144
|
-
timeoutId = trailingCall = undefined;
|
145
|
-
if (isCalled) {
|
146
|
-
lastCalled = now();
|
147
|
-
result = func.apply(null, args);
|
148
|
-
if (!timeoutId) {
|
149
|
-
args = null;
|
150
|
-
}
|
151
|
-
}
|
152
|
-
} else {
|
153
|
-
timeoutId = setTimeout(delayed, remaining);
|
154
|
-
}
|
155
|
-
}
|
156
|
-
|
157
|
-
function debounced() {
|
158
|
-
args = arguments;
|
159
|
-
stamp = now();
|
160
|
-
trailingCall = true;
|
161
|
-
|
162
|
-
if (!timeoutId) {
|
163
|
-
timeoutId = setTimeout(delayed, wait);
|
164
|
-
}
|
165
|
-
return result;
|
166
|
-
}
|
167
|
-
return debounced;
|
168
|
-
}
|
169
|
-
|
170
|
-
module.exports = debounce;
|
171
|
-
|
172
|
-
},{}],4:[function(_dereq_,module,exports){
|
173
|
-
'use strict';
|
174
|
-
|
175
|
-
/**
|
176
|
-
* @license
|
177
|
-
* Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/>
|
178
|
-
* Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
|
179
|
-
* Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE>
|
180
|
-
* Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
181
|
-
* Available under MIT license <http://lodash.com/license>
|
182
|
-
*/
|
183
|
-
|
184
|
-
var htmlEscapes = {
|
185
|
-
'&': '&',
|
186
|
-
'<': '<',
|
187
|
-
'>': '>',
|
188
|
-
'"': '"',
|
189
|
-
"'": '''
|
190
|
-
};
|
191
|
-
|
192
|
-
/**
|
193
|
-
* Used by `escape` to convert characters to HTML entities.
|
194
|
-
*
|
195
|
-
* @private
|
196
|
-
* @param {string} match The matched character to escape.
|
197
|
-
* @returns {string} Returns the escaped character.
|
198
|
-
*/
|
199
|
-
function escapeHtmlChar(match) {
|
200
|
-
return htmlEscapes[match];
|
201
|
-
}
|
202
|
-
|
203
|
-
var reUnescapedHtml = new RegExp('[' + Object.keys(htmlEscapes).join('') + ']', 'g');
|
204
|
-
|
205
|
-
/**
|
206
|
-
* Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their
|
207
|
-
* corresponding HTML entities.
|
208
|
-
*
|
209
|
-
* @static
|
210
|
-
* @memberOf _
|
211
|
-
* @category Utilities
|
212
|
-
* @param {string} string The string to escape.
|
213
|
-
* @returns {string} Returns the escaped string.
|
214
|
-
* @example
|
215
|
-
*
|
216
|
-
* _.escape('Fred, Wilma, & Pebbles');
|
217
|
-
* // => 'Fred, Wilma, & Pebbles'
|
218
|
-
*/
|
219
|
-
function escape(string) {
|
220
|
-
return string ? String(string).replace(reUnescapedHtml, escapeHtmlChar) : '';
|
221
|
-
}
|
222
|
-
|
223
|
-
module.exports = escape;
|
224
|
-
|
225
|
-
},{}],5:[function(_dereq_,module,exports){
|
671
|
+
},{"jquery":"jquery"}],15:[function(_dereq_,module,exports){
|
226
672
|
'use strict';
|
227
673
|
|
228
674
|
var $ = window.jQuery || window.Zepto;
|
675
|
+
var debounce = _dereq_(5);
|
229
676
|
|
230
|
-
var
|
231
|
-
|
232
|
-
var Selectivity = _dereq_(8);
|
677
|
+
var Selectivity = _dereq_(17);
|
233
678
|
|
234
|
-
_dereq_(
|
679
|
+
_dereq_(23);
|
235
680
|
|
236
681
|
/**
|
237
682
|
* Option listener that implements a convenience query function for performing AJAX requests.
|
@@ -276,7 +721,7 @@ Selectivity.OptionListeners.unshift(function(selectivity, options) {
|
|
276
721
|
}
|
277
722
|
|
278
723
|
var results = resultsCb(data, offset);
|
279
|
-
results.results = results.results
|
724
|
+
results.results = $.map(results.results, processItem);
|
280
725
|
queryOptions.callback(results);
|
281
726
|
},
|
282
727
|
error: function(jqXHR, textStatus, errorThrown) {
|
@@ -295,10 +740,10 @@ Selectivity.OptionListeners.unshift(function(selectivity, options) {
|
|
295
740
|
}
|
296
741
|
});
|
297
742
|
|
298
|
-
},{"
|
743
|
+
},{"17":17,"23":23,"5":5,"jquery":"jquery"}],16:[function(_dereq_,module,exports){
|
299
744
|
'use strict';
|
300
745
|
|
301
|
-
var Selectivity = _dereq_(
|
746
|
+
var Selectivity = _dereq_(17);
|
302
747
|
|
303
748
|
var latestQueryNum = 0;
|
304
749
|
|
@@ -332,56 +777,12 @@ Selectivity.OptionListeners.push(function(selectivity, options) {
|
|
332
777
|
}
|
333
778
|
});
|
334
779
|
|
335
|
-
},{"
|
780
|
+
},{"17":17}],17:[function(_dereq_,module,exports){
|
336
781
|
'use strict';
|
337
782
|
|
338
783
|
var $ = window.jQuery || window.Zepto;
|
339
784
|
|
340
|
-
var
|
341
|
-
|
342
|
-
/**
|
343
|
-
* Methods.
|
344
|
-
*/
|
345
|
-
$.extend(SelectivityDropdown.prototype, {
|
346
|
-
|
347
|
-
/**
|
348
|
-
* @inherit
|
349
|
-
*/
|
350
|
-
removeCloseHandler: function() {
|
351
|
-
|
352
|
-
if (this._$backdrop && !this.parentMenu) {
|
353
|
-
this._$backdrop.remove();
|
354
|
-
this._$backdrop = null;
|
355
|
-
}
|
356
|
-
},
|
357
|
-
|
358
|
-
/**
|
359
|
-
* @inherit
|
360
|
-
*/
|
361
|
-
setupCloseHandler: function() {
|
362
|
-
|
363
|
-
var $backdrop;
|
364
|
-
if (this.parentMenu) {
|
365
|
-
$backdrop = this.parentMenu._$backdrop;
|
366
|
-
} else {
|
367
|
-
$backdrop = $('<div>').addClass('selectivity-backdrop');
|
368
|
-
|
369
|
-
$('body').append($backdrop);
|
370
|
-
}
|
371
|
-
|
372
|
-
$backdrop.on('click', this.close.bind(this));
|
373
|
-
|
374
|
-
this._$backdrop = $backdrop;
|
375
|
-
}
|
376
|
-
|
377
|
-
});
|
378
|
-
|
379
|
-
},{"10":10,"jquery":"jquery"}],8:[function(_dereq_,module,exports){
|
380
|
-
'use strict';
|
381
|
-
|
382
|
-
var $ = window.jQuery || window.Zepto;
|
383
|
-
|
384
|
-
var EventDelegator = _dereq_(2);
|
785
|
+
var EventDelegator = _dereq_(14);
|
385
786
|
|
386
787
|
/**
|
387
788
|
* Create a new Selectivity instance or invoke a method on an instance.
|
@@ -406,7 +807,6 @@ var EventDelegator = _dereq_(2);
|
|
406
807
|
* executed on the first element in the set of matched elements.
|
407
808
|
*/
|
408
809
|
function selectivity(methodName, options) {
|
409
|
-
/* jshint validthis: true */
|
410
810
|
|
411
811
|
var methodArgs = Array.prototype.slice.call(arguments, 1);
|
412
812
|
var result;
|
@@ -560,15 +960,20 @@ function Selectivity(options) {
|
|
560
960
|
|
561
961
|
this.setOptions(options);
|
562
962
|
|
963
|
+
this.$el.attr('tabindex', options.tabindex || 0);
|
964
|
+
|
563
965
|
if (options.value) {
|
564
966
|
this.value(options.value, { triggerChange: false });
|
565
967
|
} else {
|
566
968
|
this.data(options.data || null, { triggerChange: false });
|
567
969
|
}
|
568
970
|
|
569
|
-
this
|
570
|
-
|
971
|
+
this._blur = this._blur.bind(this);
|
972
|
+
|
973
|
+
this.$el.on('mouseenter', this._mouseenter.bind(this));
|
974
|
+
this.$el.on('mouseleave', this._mouseleave.bind(this));
|
571
975
|
this.$el.on('selectivity-close', this._closed.bind(this));
|
976
|
+
this.$el.on('blur', this._blur);
|
572
977
|
|
573
978
|
EventDelegator.call(this);
|
574
979
|
}
|
@@ -709,6 +1114,8 @@ $.extend(Selectivity.prototype, EventDelegator.prototype, {
|
|
709
1114
|
listener(this, $input);
|
710
1115
|
}.bind(this));
|
711
1116
|
|
1117
|
+
$input.on('blur', this._blur);
|
1118
|
+
|
712
1119
|
if (!options || !options.noSearch) {
|
713
1120
|
$input.on('keyup', function(event) {
|
714
1121
|
if (!event.isDefaultPrevented()) {
|
@@ -730,28 +1137,30 @@ $.extend(Selectivity.prototype, EventDelegator.prototype, {
|
|
730
1137
|
*/
|
731
1138
|
open: function(options) {
|
732
1139
|
|
733
|
-
|
1140
|
+
if (this.dropdown || !this.triggerEvent('selectivity-opening')) {
|
1141
|
+
return;
|
1142
|
+
}
|
734
1143
|
|
735
|
-
|
736
|
-
if (this.triggerEvent('selectivity-opening')) {
|
737
|
-
var Dropdown = this.options.dropdown || Selectivity.Dropdown;
|
738
|
-
if (Dropdown) {
|
739
|
-
this.dropdown = new Dropdown({
|
740
|
-
items: this.items,
|
741
|
-
position: this.options.positionDropdown,
|
742
|
-
query: this.options.query,
|
743
|
-
selectivity: this,
|
744
|
-
showSearchInput: options.showSearchInput
|
745
|
-
});
|
746
|
-
}
|
1144
|
+
options = options || {};
|
747
1145
|
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
1146
|
+
var Dropdown = this.options.dropdown || Selectivity.Dropdown;
|
1147
|
+
if (Dropdown) {
|
1148
|
+
this.dropdown = new Dropdown({
|
1149
|
+
items: this.items,
|
1150
|
+
position: this.options.positionDropdown,
|
1151
|
+
query: this.options.query,
|
1152
|
+
selectivity: this,
|
1153
|
+
showSearchInput: options.showSearchInput
|
1154
|
+
});
|
1155
|
+
}
|
752
1156
|
|
753
|
-
|
1157
|
+
if (options.search !== false) {
|
1158
|
+
this.search('');
|
754
1159
|
}
|
1160
|
+
|
1161
|
+
this.focus();
|
1162
|
+
|
1163
|
+
this.$el.toggleClass('open', true);
|
755
1164
|
},
|
756
1165
|
|
757
1166
|
/**
|
@@ -1035,6 +1444,16 @@ $.extend(Selectivity.prototype, EventDelegator.prototype, {
|
|
1035
1444
|
}
|
1036
1445
|
},
|
1037
1446
|
|
1447
|
+
/**
|
1448
|
+
* @private
|
1449
|
+
*/
|
1450
|
+
_blur: function() {
|
1451
|
+
|
1452
|
+
if (!this.$el.hasClass('hover')) {
|
1453
|
+
this.close();
|
1454
|
+
}
|
1455
|
+
},
|
1456
|
+
|
1038
1457
|
/**
|
1039
1458
|
* @private
|
1040
1459
|
*/
|
@@ -1042,7 +1461,7 @@ $.extend(Selectivity.prototype, EventDelegator.prototype, {
|
|
1042
1461
|
|
1043
1462
|
this.dropdown = null;
|
1044
1463
|
|
1045
|
-
this.$el.
|
1464
|
+
this.$el.toggleClass('open', false);
|
1046
1465
|
},
|
1047
1466
|
|
1048
1467
|
/**
|
@@ -1091,17 +1510,17 @@ $.extend(Selectivity.prototype, EventDelegator.prototype, {
|
|
1091
1510
|
/**
|
1092
1511
|
* @private
|
1093
1512
|
*/
|
1094
|
-
|
1513
|
+
_mouseleave: function() {
|
1095
1514
|
|
1096
|
-
this.$el.
|
1515
|
+
this.$el.toggleClass('hover', false);
|
1097
1516
|
},
|
1098
1517
|
|
1099
1518
|
/**
|
1100
1519
|
* @private
|
1101
1520
|
*/
|
1102
|
-
|
1521
|
+
_mouseenter: function() {
|
1103
1522
|
|
1104
|
-
this.$el.
|
1523
|
+
this.$el.toggleClass('hover', true);
|
1105
1524
|
}
|
1106
1525
|
|
1107
1526
|
});
|
@@ -1350,7 +1769,9 @@ Selectivity.transformText = function(string) {
|
|
1350
1769
|
|
1351
1770
|
module.exports = $.fn.selectivity = Selectivity;
|
1352
1771
|
|
1353
|
-
},{"
|
1772
|
+
},{"14":14,"jquery":"jquery"}],18:[function(_dereq_,module,exports){
|
1773
|
+
_dereq_(15);_dereq_(16);_dereq_(19);_dereq_(20);_dereq_(21);_dereq_(22);_dereq_(23);_dereq_(24);_dereq_(25);_dereq_(26);_dereq_(27);_dereq_(28);_dereq_(29);module.exports=_dereq_(17);
|
1774
|
+
},{"15":15,"16":16,"17":17,"19":19,"20":20,"21":21,"22":22,"23":23,"24":24,"25":25,"26":26,"27":27,"28":28,"29":29}],19:[function(_dereq_,module,exports){
|
1354
1775
|
'use strict';
|
1355
1776
|
|
1356
1777
|
var DIACRITICS = {
|
@@ -2195,7 +2616,7 @@ var DIACRITICS = {
|
|
2195
2616
|
'\u03C2': '\u03C3'
|
2196
2617
|
};
|
2197
2618
|
|
2198
|
-
var Selectivity = _dereq_(
|
2619
|
+
var Selectivity = _dereq_(17);
|
2199
2620
|
var previousTransform = Selectivity.transformText;
|
2200
2621
|
|
2201
2622
|
/**
|
@@ -2214,16 +2635,17 @@ Selectivity.transformText = function(string) {
|
|
2214
2635
|
return previousTransform(result);
|
2215
2636
|
};
|
2216
2637
|
|
2217
|
-
},{"
|
2638
|
+
},{"17":17}],20:[function(_dereq_,module,exports){
|
2218
2639
|
'use strict';
|
2219
2640
|
|
2220
2641
|
var $ = window.jQuery || window.Zepto;
|
2642
|
+
var debounce = _dereq_(5);
|
2221
2643
|
|
2222
|
-
var
|
2644
|
+
var EventDelegator = _dereq_(14);
|
2223
2645
|
|
2224
|
-
var
|
2646
|
+
var Selectivity = _dereq_(17);
|
2225
2647
|
|
2226
|
-
var
|
2648
|
+
var SCROLL_EVENTS = ['scroll', 'touchend', 'touchmove'];
|
2227
2649
|
|
2228
2650
|
/**
|
2229
2651
|
* selectivity Dropdown Constructor.
|
@@ -2280,16 +2702,17 @@ function SelectivityDropdown(options) {
|
|
2280
2702
|
|
2281
2703
|
this._closed = false;
|
2282
2704
|
|
2283
|
-
this.
|
2705
|
+
this.close = this.close.bind(this);
|
2706
|
+
this.position = this.position.bind(this);
|
2707
|
+
|
2284
2708
|
if (selectivity.options.closeOnSelect !== false) {
|
2285
|
-
selectivity.$el.on('selectivity-selecting', this.
|
2709
|
+
selectivity.$el.on('selectivity-selecting', this.close);
|
2286
2710
|
}
|
2287
2711
|
|
2288
2712
|
this._lastMousePosition = {};
|
2289
2713
|
|
2290
2714
|
this.addToDom();
|
2291
2715
|
this.position();
|
2292
|
-
this.setupCloseHandler();
|
2293
2716
|
|
2294
2717
|
this._suppressMouseWheel();
|
2295
2718
|
|
@@ -2300,7 +2723,9 @@ function SelectivityDropdown(options) {
|
|
2300
2723
|
|
2301
2724
|
EventDelegator.call(this);
|
2302
2725
|
|
2303
|
-
this.$results.on('
|
2726
|
+
this.$results.on(SCROLL_EVENTS.join(' '), debounce(this._scrolled.bind(this), 50));
|
2727
|
+
|
2728
|
+
this._attachAncestorScrollListeners();
|
2304
2729
|
|
2305
2730
|
this.showLoading();
|
2306
2731
|
|
@@ -2330,7 +2755,8 @@ $.extend(SelectivityDropdown.prototype, EventDelegator.prototype, {
|
|
2330
2755
|
while (($next = $anchor.next('.selectivity-dropdown')).length) {
|
2331
2756
|
$anchor = $next;
|
2332
2757
|
}
|
2333
|
-
|
2758
|
+
|
2759
|
+
$anchor.append(this.$el);
|
2334
2760
|
},
|
2335
2761
|
|
2336
2762
|
/**
|
@@ -2343,11 +2769,11 @@ $.extend(SelectivityDropdown.prototype, EventDelegator.prototype, {
|
|
2343
2769
|
|
2344
2770
|
this.$el.remove();
|
2345
2771
|
|
2346
|
-
this.
|
2347
|
-
|
2348
|
-
this.selectivity.$el.off('selectivity-selecting', this._closeProxy);
|
2772
|
+
this.selectivity.$el.off('selectivity-selecting', this.close);
|
2349
2773
|
|
2350
2774
|
this.triggerClose();
|
2775
|
+
|
2776
|
+
this._removeAncestorScrollListeners();
|
2351
2777
|
}
|
2352
2778
|
},
|
2353
2779
|
|
@@ -2438,14 +2864,6 @@ $.extend(SelectivityDropdown.prototype, EventDelegator.prototype, {
|
|
2438
2864
|
this._scrolled();
|
2439
2865
|
},
|
2440
2866
|
|
2441
|
-
/**
|
2442
|
-
* Removes the event handler to close the dropdown.
|
2443
|
-
*/
|
2444
|
-
removeCloseHandler: function() {
|
2445
|
-
|
2446
|
-
$('body').off('click', this._closeProxy);
|
2447
|
-
},
|
2448
|
-
|
2449
2867
|
/**
|
2450
2868
|
* Renders an array of result items.
|
2451
2869
|
*
|
@@ -2539,15 +2957,6 @@ $.extend(SelectivityDropdown.prototype, EventDelegator.prototype, {
|
|
2539
2957
|
}
|
2540
2958
|
},
|
2541
2959
|
|
2542
|
-
/**
|
2543
|
-
* Sets up an event handler that will close the dropdown when the Selectivity control loses
|
2544
|
-
* focus.
|
2545
|
-
*/
|
2546
|
-
setupCloseHandler: function() {
|
2547
|
-
|
2548
|
-
$('body').on('click', this._closeProxy);
|
2549
|
-
},
|
2550
|
-
|
2551
2960
|
/**
|
2552
2961
|
* Shows an error message.
|
2553
2962
|
*
|
@@ -2624,7 +3033,13 @@ $.extend(SelectivityDropdown.prototype, EventDelegator.prototype, {
|
|
2624
3033
|
|
2625
3034
|
this.hasMore = options.hasMore;
|
2626
3035
|
|
2627
|
-
|
3036
|
+
var value = this.selectivity.value();
|
3037
|
+
if (value && $.type(value) !== 'array') {
|
3038
|
+
var item = Selectivity.findNestedById(results, value);
|
3039
|
+
if (item) {
|
3040
|
+
this.highlight(item);
|
3041
|
+
}
|
3042
|
+
} else if (!options.add || this.loadMoreHighlighted) {
|
2628
3043
|
this._highlightFirstItem(results);
|
2629
3044
|
}
|
2630
3045
|
|
@@ -2647,6 +3062,37 @@ $.extend(SelectivityDropdown.prototype, EventDelegator.prototype, {
|
|
2647
3062
|
this.selectivity.$el.trigger('selectivity-open');
|
2648
3063
|
},
|
2649
3064
|
|
3065
|
+
/**
|
3066
|
+
* @private
|
3067
|
+
*/
|
3068
|
+
_attachAncestorScrollListeners: function() {
|
3069
|
+
|
3070
|
+
var position = this.position;
|
3071
|
+
var scrollElements = [];
|
3072
|
+
|
3073
|
+
function attach(el) {
|
3074
|
+
for (var i = 0; i < SCROLL_EVENTS.length; i++) {
|
3075
|
+
el.addEventListener(SCROLL_EVENTS[i], position);
|
3076
|
+
}
|
3077
|
+
scrollElements.push(el);
|
3078
|
+
}
|
3079
|
+
|
3080
|
+
if (typeof window !== 'undefined') {
|
3081
|
+
var el = this.selectivity.$el[0];
|
3082
|
+
while ((el = el.parentElement)) {
|
3083
|
+
var style = window.getComputedStyle(el);
|
3084
|
+
if (style.overflowX === 'auto' || style.overflowX === 'scroll' ||
|
3085
|
+
style.overflowY === 'auto' || style.overflowY === 'scroll') {
|
3086
|
+
attach(el);
|
3087
|
+
}
|
3088
|
+
}
|
3089
|
+
|
3090
|
+
attach(window);
|
3091
|
+
}
|
3092
|
+
|
3093
|
+
this._ancestorScrollElements = scrollElements;
|
3094
|
+
},
|
3095
|
+
|
2650
3096
|
/**
|
2651
3097
|
* @private
|
2652
3098
|
*/
|
@@ -2684,8 +3130,6 @@ $.extend(SelectivityDropdown.prototype, EventDelegator.prototype, {
|
|
2684
3130
|
|
2685
3131
|
this.loadMore();
|
2686
3132
|
|
2687
|
-
this.selectivity.focus();
|
2688
|
-
|
2689
3133
|
return false;
|
2690
3134
|
},
|
2691
3135
|
|
@@ -2710,6 +3154,20 @@ $.extend(SelectivityDropdown.prototype, EventDelegator.prototype, {
|
|
2710
3154
|
this._lastMousePosition = { x: event.screenX, y: event.screenY };
|
2711
3155
|
},
|
2712
3156
|
|
3157
|
+
/**
|
3158
|
+
* @private
|
3159
|
+
*/
|
3160
|
+
_removeAncestorScrollListeners: function() {
|
3161
|
+
|
3162
|
+
this._ancestorScrollElements.forEach(function(el) {
|
3163
|
+
for (var i = 0; i < SCROLL_EVENTS.length; i++) {
|
3164
|
+
el.removeEventListener(SCROLL_EVENTS[i], this.position);
|
3165
|
+
}
|
3166
|
+
}, this);
|
3167
|
+
|
3168
|
+
this._ancestorScrollElements = [];
|
3169
|
+
},
|
3170
|
+
|
2713
3171
|
/**
|
2714
3172
|
* @private
|
2715
3173
|
*/
|
@@ -2808,13 +3266,13 @@ $.extend(SelectivityDropdown.prototype, EventDelegator.prototype, {
|
|
2808
3266
|
|
2809
3267
|
module.exports = Selectivity.Dropdown = SelectivityDropdown;
|
2810
3268
|
|
2811
|
-
},{"
|
3269
|
+
},{"14":14,"17":17,"5":5,"jquery":"jquery"}],21:[function(_dereq_,module,exports){
|
2812
3270
|
'use strict';
|
2813
3271
|
|
2814
3272
|
var $ = window.jQuery || window.Zepto;
|
2815
3273
|
|
2816
|
-
var Selectivity = _dereq_(
|
2817
|
-
var MultipleSelectivity = _dereq_(
|
3274
|
+
var Selectivity = _dereq_(17);
|
3275
|
+
var MultipleSelectivity = _dereq_(24);
|
2818
3276
|
|
2819
3277
|
function isValidEmail(email) {
|
2820
3278
|
|
@@ -2875,7 +3333,7 @@ function emailTokenizer(input, selection, createToken) {
|
|
2875
3333
|
}
|
2876
3334
|
break;
|
2877
3335
|
case '"':
|
2878
|
-
do { i++; } while(i < length && input[i] !== '"');
|
3336
|
+
do { i++; } while (i < length && input[i] !== '"');
|
2879
3337
|
break;
|
2880
3338
|
default:
|
2881
3339
|
continue;
|
@@ -2899,7 +3357,7 @@ function emailTokenizer(input, selection, createToken) {
|
|
2899
3357
|
}
|
2900
3358
|
break;
|
2901
3359
|
case '"':
|
2902
|
-
do { i++; } while(i < length && input[i] !== '"');
|
3360
|
+
do { i++; } while (i < length && input[i] !== '"');
|
2903
3361
|
break;
|
2904
3362
|
default:
|
2905
3363
|
continue;
|
@@ -2973,10 +3431,10 @@ var callSuper = Selectivity.inherits(Emailselectivity, MultipleSelectivity, {
|
|
2973
3431
|
|
2974
3432
|
module.exports = Selectivity.InputTypes.Email = Emailselectivity;
|
2975
3433
|
|
2976
|
-
},{"
|
3434
|
+
},{"17":17,"24":24,"jquery":"jquery"}],22:[function(_dereq_,module,exports){
|
2977
3435
|
'use strict';
|
2978
3436
|
|
2979
|
-
var Selectivity = _dereq_(
|
3437
|
+
var Selectivity = _dereq_(17);
|
2980
3438
|
|
2981
3439
|
var KEY_BACKSPACE = 8;
|
2982
3440
|
var KEY_DOWN_ARROW = 40;
|
@@ -3091,7 +3549,7 @@ function listener(selectivity, $input) {
|
|
3091
3549
|
moveHighlight(dropdown, -1);
|
3092
3550
|
} else if (event.keyCode === KEY_TAB) {
|
3093
3551
|
setTimeout(function() {
|
3094
|
-
selectivity.close(
|
3552
|
+
selectivity.close();
|
3095
3553
|
}, 1);
|
3096
3554
|
} else if (event.keyCode === KEY_ENTER) {
|
3097
3555
|
event.preventDefault(); // don't submit forms on keydown
|
@@ -3150,11 +3608,12 @@ function listener(selectivity, $input) {
|
|
3150
3608
|
|
3151
3609
|
Selectivity.SearchInputListeners.push(listener);
|
3152
3610
|
|
3153
|
-
},{"
|
3611
|
+
},{"17":17}],23:[function(_dereq_,module,exports){
|
3154
3612
|
'use strict';
|
3155
3613
|
|
3156
|
-
var escape = _dereq_(
|
3157
|
-
|
3614
|
+
var escape = _dereq_(6);
|
3615
|
+
|
3616
|
+
var Selectivity = _dereq_(17);
|
3158
3617
|
|
3159
3618
|
/**
|
3160
3619
|
* Localizable elements of the Selectivity Templates.
|
@@ -3175,12 +3634,12 @@ Selectivity.Locale = {
|
|
3175
3634
|
|
3176
3635
|
};
|
3177
3636
|
|
3178
|
-
},{"
|
3637
|
+
},{"17":17,"6":6}],24:[function(_dereq_,module,exports){
|
3179
3638
|
'use strict';
|
3180
3639
|
|
3181
3640
|
var $ = window.jQuery || window.Zepto;
|
3182
3641
|
|
3183
|
-
var Selectivity = _dereq_(
|
3642
|
+
var Selectivity = _dereq_(17);
|
3184
3643
|
|
3185
3644
|
var KEY_BACKSPACE = 8;
|
3186
3645
|
var KEY_DELETE = 46;
|
@@ -3210,18 +3669,16 @@ function MultipleSelectivity(options) {
|
|
3210
3669
|
// unless there is not enough space below, but there is space enough above, then it should
|
3211
3670
|
// open upwards
|
3212
3671
|
this.options.positionDropdown = function($el, $selectEl) {
|
3213
|
-
var
|
3214
|
-
|
3215
|
-
|
3216
|
-
|
3217
|
-
|
3218
|
-
openUpwards = (typeof window !== 'undefined' && bottom > $(window).height() &&
|
3219
|
-
top - dropdownHeight > 0);
|
3672
|
+
var rect = $selectEl[0].getBoundingClientRect();
|
3673
|
+
var dropdownHeight = $el.height();
|
3674
|
+
var openUpwards = (typeof window !== 'undefined' &&
|
3675
|
+
rect.bottom + dropdownHeight > window.innerHeight &&
|
3676
|
+
rect.top - dropdownHeight > 0);
|
3220
3677
|
|
3221
3678
|
var width = $selectEl.outerWidth ? $selectEl.outerWidth() : $selectEl.width();
|
3222
3679
|
$el.css({
|
3223
|
-
left:
|
3224
|
-
top:
|
3680
|
+
left: rect.left + 'px',
|
3681
|
+
top: (openUpwards ? rect.top - dropdownHeight : rect.bottom) + 'px'
|
3225
3682
|
}).width(width);
|
3226
3683
|
};
|
3227
3684
|
}
|
@@ -3542,10 +3999,8 @@ var callSuper = Selectivity.inherits(MultipleSelectivity, {
|
|
3542
3999
|
*/
|
3543
4000
|
_clicked: function() {
|
3544
4001
|
|
3545
|
-
if (this.enabled) {
|
3546
|
-
this.
|
3547
|
-
|
3548
|
-
this._open();
|
4002
|
+
if (this.enabled && this.options.showDropdown !== false) {
|
4003
|
+
this.open();
|
3549
4004
|
|
3550
4005
|
return false;
|
3551
4006
|
}
|
@@ -3659,16 +4114,6 @@ var callSuper = Selectivity.inherits(MultipleSelectivity, {
|
|
3659
4114
|
}.bind(this), 10);
|
3660
4115
|
},
|
3661
4116
|
|
3662
|
-
/**
|
3663
|
-
* @private
|
3664
|
-
*/
|
3665
|
-
_open: function() {
|
3666
|
-
|
3667
|
-
if (this.options.showDropdown !== false) {
|
3668
|
-
this.open();
|
3669
|
-
}
|
3670
|
-
},
|
3671
|
-
|
3672
4117
|
_renderSelectedItem: function(item) {
|
3673
4118
|
|
3674
4119
|
this.$searchInput.before(this.template('multipleSelectedItem', $.extend({
|
@@ -3736,12 +4181,12 @@ var callSuper = Selectivity.inherits(MultipleSelectivity, {
|
|
3736
4181
|
|
3737
4182
|
module.exports = Selectivity.InputTypes.Multiple = MultipleSelectivity;
|
3738
4183
|
|
3739
|
-
},{"
|
4184
|
+
},{"17":17,"jquery":"jquery"}],25:[function(_dereq_,module,exports){
|
3740
4185
|
'use strict';
|
3741
4186
|
|
3742
4187
|
var $ = window.jQuery || window.Zepto;
|
3743
4188
|
|
3744
|
-
var Selectivity = _dereq_(
|
4189
|
+
var Selectivity = _dereq_(17);
|
3745
4190
|
|
3746
4191
|
/**
|
3747
4192
|
* SingleSelectivity Constructor.
|
@@ -3763,22 +4208,21 @@ function SingleSelectivity(options) {
|
|
3763
4208
|
// unless there is not enough space below, in which case the dropdown should be moved up
|
3764
4209
|
// just enough so it fits in the window, but never so much that it reaches above the top
|
3765
4210
|
this.options.positionDropdown = function($el, $selectEl) {
|
3766
|
-
var
|
3767
|
-
|
3768
|
-
selectHeight = $selectEl.height(),
|
3769
|
-
top = $selectEl[0].getBoundingClientRect().top,
|
3770
|
-
bottom = top + selectHeight + dropdownHeight,
|
3771
|
-
deltaUp = 0;
|
4211
|
+
var rect = $selectEl[0].getBoundingClientRect();
|
4212
|
+
var dropdownTop = rect.bottom;
|
3772
4213
|
|
4214
|
+
var deltaUp = 0;
|
3773
4215
|
if (typeof window !== 'undefined') {
|
3774
|
-
deltaUp = Math.min(
|
4216
|
+
deltaUp = Math.min(
|
4217
|
+
Math.max(dropdownTop + $el.height() - window.innerHeight, 0),
|
4218
|
+
rect.top + rect.height
|
4219
|
+
);
|
3775
4220
|
}
|
3776
4221
|
|
3777
|
-
var width = $selectEl.outerWidth ? $selectEl.outerWidth() : $selectEl.width();
|
3778
4222
|
$el.css({
|
3779
|
-
left:
|
3780
|
-
top:
|
3781
|
-
}).width(width);
|
4223
|
+
left: rect.left + 'px',
|
4224
|
+
top: dropdownTop - deltaUp + 'px'
|
4225
|
+
}).width(rect.width);
|
3782
4226
|
};
|
3783
4227
|
}
|
3784
4228
|
|
@@ -3816,7 +4260,7 @@ var callSuper = Selectivity.inherits(SingleSelectivity, {
|
|
3816
4260
|
* @inherit
|
3817
4261
|
*
|
3818
4262
|
* @param options Optional options object. May contain the following property:
|
3819
|
-
* keepFocus - If
|
4263
|
+
* keepFocus - If true, the focus will remain on the input.
|
3820
4264
|
*/
|
3821
4265
|
close: function(options) {
|
3822
4266
|
|
@@ -3824,7 +4268,7 @@ var callSuper = Selectivity.inherits(SingleSelectivity, {
|
|
3824
4268
|
|
3825
4269
|
callSuper(this, 'close');
|
3826
4270
|
|
3827
|
-
if (
|
4271
|
+
if (options && options.keepFocus && this.$searchInput) {
|
3828
4272
|
this.$searchInput.focus();
|
3829
4273
|
}
|
3830
4274
|
|
@@ -3868,10 +4312,6 @@ var callSuper = Selectivity.inherits(SingleSelectivity, {
|
|
3868
4312
|
|
3869
4313
|
callSuper(this, 'open', $.extend({ showSearchInput: showSearchInput }, options));
|
3870
4314
|
|
3871
|
-
if (!showSearchInput) {
|
3872
|
-
this.focus();
|
3873
|
-
}
|
3874
|
-
|
3875
4315
|
this._opening = false;
|
3876
4316
|
},
|
3877
4317
|
|
@@ -3954,11 +4394,15 @@ var callSuper = Selectivity.inherits(SingleSelectivity, {
|
|
3954
4394
|
/**
|
3955
4395
|
* @private
|
3956
4396
|
*/
|
3957
|
-
_clicked: function() {
|
4397
|
+
_clicked: function(event) {
|
4398
|
+
|
4399
|
+
if ($(event.target).closest('.selectivity-search-input').length) {
|
4400
|
+
return true;
|
4401
|
+
}
|
3958
4402
|
|
3959
4403
|
if (this.enabled) {
|
3960
4404
|
if (this.dropdown) {
|
3961
|
-
this.close();
|
4405
|
+
this.close({ keepFocus: true });
|
3962
4406
|
} else if (this.options.showDropdown !== false) {
|
3963
4407
|
this.open();
|
3964
4408
|
}
|
@@ -3995,18 +4439,18 @@ var callSuper = Selectivity.inherits(SingleSelectivity, {
|
|
3995
4439
|
|
3996
4440
|
this.data(event.item);
|
3997
4441
|
|
3998
|
-
this.close();
|
4442
|
+
this.close({ keepFocus: true });
|
3999
4443
|
}
|
4000
4444
|
|
4001
4445
|
});
|
4002
4446
|
|
4003
4447
|
module.exports = Selectivity.InputTypes.Single = SingleSelectivity;
|
4004
4448
|
|
4005
|
-
},{"
|
4449
|
+
},{"17":17,"jquery":"jquery"}],26:[function(_dereq_,module,exports){
|
4006
4450
|
'use strict';
|
4007
4451
|
|
4008
|
-
var Selectivity = _dereq_(
|
4009
|
-
var SelectivityDropdown = _dereq_(
|
4452
|
+
var Selectivity = _dereq_(17);
|
4453
|
+
var SelectivityDropdown = _dereq_(20);
|
4010
4454
|
|
4011
4455
|
/**
|
4012
4456
|
* Extended dropdown that supports submenus.
|
@@ -4185,12 +4629,11 @@ var callSuper = Selectivity.inherits(SelectivitySubmenu, SelectivityDropdown, {
|
|
4185
4629
|
items: item.submenu.items || null,
|
4186
4630
|
parentMenu: this,
|
4187
4631
|
position: item.submenu.positionDropdown || function($el) {
|
4188
|
-
var
|
4189
|
-
var width = $dropdownEl.width();
|
4632
|
+
var rect = $dropdownEl[0].getBoundingClientRect();
|
4190
4633
|
$el.css({
|
4191
|
-
left:
|
4192
|
-
top: $item.position().top +
|
4193
|
-
}).width(width);
|
4634
|
+
left: rect.right + 'px',
|
4635
|
+
top: $item.position().top + rect.top + 'px'
|
4636
|
+
}).width(rect.width);
|
4194
4637
|
},
|
4195
4638
|
query: item.submenu.query || null,
|
4196
4639
|
selectivity: selectivity,
|
@@ -4226,14 +4669,14 @@ Selectivity.findNestedById = function(array, id) {
|
|
4226
4669
|
|
4227
4670
|
module.exports = SelectivitySubmenu;
|
4228
4671
|
|
4229
|
-
},{"
|
4672
|
+
},{"17":17,"20":20}],27:[function(_dereq_,module,exports){
|
4230
4673
|
'use strict';
|
4231
4674
|
|
4232
|
-
var escape = _dereq_(
|
4675
|
+
var escape = _dereq_(6);
|
4233
4676
|
|
4234
|
-
var Selectivity = _dereq_(
|
4677
|
+
var Selectivity = _dereq_(17);
|
4235
4678
|
|
4236
|
-
_dereq_(
|
4679
|
+
_dereq_(23);
|
4237
4680
|
|
4238
4681
|
/**
|
4239
4682
|
* Default set of templates to use with Selectivity.js.
|
@@ -4536,12 +4979,12 @@ Selectivity.Templates = {
|
|
4536
4979
|
|
4537
4980
|
};
|
4538
4981
|
|
4539
|
-
},{"
|
4982
|
+
},{"17":17,"23":23,"6":6}],28:[function(_dereq_,module,exports){
|
4540
4983
|
'use strict';
|
4541
4984
|
|
4542
4985
|
var $ = window.jQuery || window.Zepto;
|
4543
4986
|
|
4544
|
-
var Selectivity = _dereq_(
|
4987
|
+
var Selectivity = _dereq_(17);
|
4545
4988
|
|
4546
4989
|
function defaultTokenizer(input, selection, createToken, options) {
|
4547
4990
|
|
@@ -4603,14 +5046,14 @@ Selectivity.OptionListeners.push(function(selectivity, options) {
|
|
4603
5046
|
}
|
4604
5047
|
});
|
4605
5048
|
|
4606
|
-
},{"
|
5049
|
+
},{"17":17,"jquery":"jquery"}],29:[function(_dereq_,module,exports){
|
4607
5050
|
'use strict';
|
4608
5051
|
|
4609
5052
|
var $ = window.jQuery || window.Zepto;
|
4610
5053
|
|
4611
|
-
var Selectivity = _dereq_(
|
5054
|
+
var Selectivity = _dereq_(17);
|
4612
5055
|
|
4613
|
-
function
|
5056
|
+
function createSelectivityNextToSelectElement($el, options) {
|
4614
5057
|
|
4615
5058
|
var data = (options.multiple ? [] : null);
|
4616
5059
|
|
@@ -4618,7 +5061,10 @@ function replaceSelectElement($el, options) {
|
|
4618
5061
|
var $this = $(this);
|
4619
5062
|
if ($this.is('option')) {
|
4620
5063
|
var text = $this.text();
|
4621
|
-
var id = $this.attr('value')
|
5064
|
+
var id = $this.attr('value');
|
5065
|
+
if (id === undefined) {
|
5066
|
+
id = text;
|
5067
|
+
}
|
4622
5068
|
if ($this.prop('selected')) {
|
4623
5069
|
var item = { id: id, text: text };
|
4624
5070
|
if (options.multiple) {
|
@@ -4660,36 +5106,18 @@ function replaceSelectElement($el, options) {
|
|
4660
5106
|
'style': $el.attr('style'),
|
4661
5107
|
'data-name': $el.attr('name')
|
4662
5108
|
});
|
4663
|
-
$
|
5109
|
+
$div.insertAfter($el);
|
5110
|
+
$el.hide();
|
4664
5111
|
return $div;
|
4665
5112
|
}
|
4666
5113
|
|
4667
5114
|
function bindTraditionalSelectEvents(selectivity) {
|
4668
|
-
|
4669
5115
|
var $el = selectivity.$el;
|
4670
|
-
|
4671
|
-
|
4672
|
-
$el.
|
4673
|
-
|
4674
|
-
|
4675
|
-
})).removeAttr('data-name');
|
4676
|
-
}).on('selectivity-init change', function() {
|
4677
|
-
var data = selectivity._data;
|
4678
|
-
var $select = $el.find('select');
|
4679
|
-
|
4680
|
-
if (data instanceof Array) {
|
4681
|
-
$select.empty();
|
4682
|
-
|
4683
|
-
data.forEach(function(item) {
|
4684
|
-
$select.append(selectivity.template('selectOptionCompliance', item));
|
4685
|
-
});
|
4686
|
-
} else {
|
4687
|
-
if (data) {
|
4688
|
-
$select.html(selectivity.template('selectOptionCompliance', data));
|
4689
|
-
} else {
|
4690
|
-
$select.empty();
|
4691
|
-
}
|
4692
|
-
}
|
5116
|
+
$el.on('selectivity-selected', function(event) {
|
5117
|
+
var value = selectivity.value();
|
5118
|
+
$el.prev('select')
|
5119
|
+
.val($.type(value) === 'array' ? [event.item.id].concat(value) : event.item.id)
|
5120
|
+
.change();
|
4693
5121
|
});
|
4694
5122
|
}
|
4695
5123
|
|
@@ -4707,12 +5135,12 @@ Selectivity.OptionListeners.push(function(selectivity, options) {
|
|
4707
5135
|
}, 1);
|
4708
5136
|
}
|
4709
5137
|
|
4710
|
-
selectivity.$el =
|
5138
|
+
selectivity.$el = createSelectivityNextToSelectElement($el, options);
|
4711
5139
|
selectivity.$el[0].selectivity = selectivity;
|
4712
5140
|
|
4713
5141
|
bindTraditionalSelectEvents(selectivity);
|
4714
5142
|
}
|
4715
5143
|
});
|
4716
5144
|
|
4717
|
-
},{"
|
5145
|
+
},{"17":17,"jquery":"jquery"}]},{},[18])(18)
|
4718
5146
|
});
|