1 | (function (global, factory) {
|
2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) :
|
3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) :
|
4 | (global = global || self, factory(global.jQuery));
|
5 | }(this, function ($) { 'use strict';
|
6 |
|
7 | $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
|
8 |
|
9 | function _typeof(obj) {
|
10 | if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
11 | _typeof = function (obj) {
|
12 | return typeof obj;
|
13 | };
|
14 | } else {
|
15 | _typeof = function (obj) {
|
16 | return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
17 | };
|
18 | }
|
19 |
|
20 | return _typeof(obj);
|
21 | }
|
22 |
|
23 | function _classCallCheck(instance, Constructor) {
|
24 | if (!(instance instanceof Constructor)) {
|
25 | throw new TypeError("Cannot call a class as a function");
|
26 | }
|
27 | }
|
28 |
|
29 | function _defineProperties(target, props) {
|
30 | for (var i = 0; i < props.length; i++) {
|
31 | var descriptor = props[i];
|
32 | descriptor.enumerable = descriptor.enumerable || false;
|
33 | descriptor.configurable = true;
|
34 | if ("value" in descriptor) descriptor.writable = true;
|
35 | Object.defineProperty(target, descriptor.key, descriptor);
|
36 | }
|
37 | }
|
38 |
|
39 | function _createClass(Constructor, protoProps, staticProps) {
|
40 | if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
41 | if (staticProps) _defineProperties(Constructor, staticProps);
|
42 | return Constructor;
|
43 | }
|
44 |
|
45 | function _taggedTemplateLiteral(strings, raw) {
|
46 | if (!raw) {
|
47 | raw = strings.slice(0);
|
48 | }
|
49 |
|
50 | return Object.freeze(Object.defineProperties(strings, {
|
51 | raw: {
|
52 | value: Object.freeze(raw)
|
53 | }
|
54 | }));
|
55 | }
|
56 |
|
57 | var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
58 |
|
59 | function createCommonjsModule(fn, module) {
|
60 | return module = { exports: {} }, fn(module, module.exports), module.exports;
|
61 | }
|
62 |
|
63 | var O = 'object';
|
64 | var check = function (it) {
|
65 | return it && it.Math == Math && it;
|
66 | };
|
67 |
|
68 |
|
69 | var global_1 =
|
70 |
|
71 | check(typeof globalThis == O && globalThis) ||
|
72 | check(typeof window == O && window) ||
|
73 | check(typeof self == O && self) ||
|
74 | check(typeof commonjsGlobal == O && commonjsGlobal) ||
|
75 |
|
76 | Function('return this')();
|
77 |
|
78 | var fails = function (exec) {
|
79 | try {
|
80 | return !!exec();
|
81 | } catch (error) {
|
82 | return true;
|
83 | }
|
84 | };
|
85 |
|
86 |
|
87 | var descriptors = !fails(function () {
|
88 | return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
|
89 | });
|
90 |
|
91 | var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
|
92 | var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
93 |
|
94 |
|
95 | var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
|
96 |
|
97 |
|
98 |
|
99 | var f = NASHORN_BUG ? function propertyIsEnumerable(V) {
|
100 | var descriptor = getOwnPropertyDescriptor(this, V);
|
101 | return !!descriptor && descriptor.enumerable;
|
102 | } : nativePropertyIsEnumerable;
|
103 |
|
104 | var objectPropertyIsEnumerable = {
|
105 | f: f
|
106 | };
|
107 |
|
108 | var createPropertyDescriptor = function (bitmap, value) {
|
109 | return {
|
110 | enumerable: !(bitmap & 1),
|
111 | configurable: !(bitmap & 2),
|
112 | writable: !(bitmap & 4),
|
113 | value: value
|
114 | };
|
115 | };
|
116 |
|
117 | var toString = {}.toString;
|
118 |
|
119 | var classofRaw = function (it) {
|
120 | return toString.call(it).slice(8, -1);
|
121 | };
|
122 |
|
123 | var split = ''.split;
|
124 |
|
125 |
|
126 | var indexedObject = fails(function () {
|
127 |
|
128 |
|
129 | return !Object('z').propertyIsEnumerable(0);
|
130 | }) ? function (it) {
|
131 | return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);
|
132 | } : Object;
|
133 |
|
134 |
|
135 |
|
136 | var requireObjectCoercible = function (it) {
|
137 | if (it == undefined) throw TypeError("Can't call method on " + it);
|
138 | return it;
|
139 | };
|
140 |
|
141 |
|
142 |
|
143 |
|
144 |
|
145 | var toIndexedObject = function (it) {
|
146 | return indexedObject(requireObjectCoercible(it));
|
147 | };
|
148 |
|
149 | var isObject = function (it) {
|
150 | return typeof it === 'object' ? it !== null : typeof it === 'function';
|
151 | };
|
152 |
|
153 |
|
154 |
|
155 |
|
156 |
|
157 | var toPrimitive = function (input, PREFERRED_STRING) {
|
158 | if (!isObject(input)) return input;
|
159 | var fn, val;
|
160 | if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
|
161 | if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
|
162 | if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
|
163 | throw TypeError("Can't convert object to primitive value");
|
164 | };
|
165 |
|
166 | var hasOwnProperty = {}.hasOwnProperty;
|
167 |
|
168 | var has = function (it, key) {
|
169 | return hasOwnProperty.call(it, key);
|
170 | };
|
171 |
|
172 | var document$1 = global_1.document;
|
173 |
|
174 | var EXISTS = isObject(document$1) && isObject(document$1.createElement);
|
175 |
|
176 | var documentCreateElement = function (it) {
|
177 | return EXISTS ? document$1.createElement(it) : {};
|
178 | };
|
179 |
|
180 |
|
181 | var ie8DomDefine = !descriptors && !fails(function () {
|
182 | return Object.defineProperty(documentCreateElement('div'), 'a', {
|
183 | get: function () { return 7; }
|
184 | }).a != 7;
|
185 | });
|
186 |
|
187 | var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
188 |
|
189 |
|
190 |
|
191 | var f$1 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
|
192 | O = toIndexedObject(O);
|
193 | P = toPrimitive(P, true);
|
194 | if (ie8DomDefine) try {
|
195 | return nativeGetOwnPropertyDescriptor(O, P);
|
196 | } catch (error) { }
|
197 | if (has(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
|
198 | };
|
199 |
|
200 | var objectGetOwnPropertyDescriptor = {
|
201 | f: f$1
|
202 | };
|
203 |
|
204 | var anObject = function (it) {
|
205 | if (!isObject(it)) {
|
206 | throw TypeError(String(it) + ' is not an object');
|
207 | } return it;
|
208 | };
|
209 |
|
210 | var nativeDefineProperty = Object.defineProperty;
|
211 |
|
212 |
|
213 |
|
214 | var f$2 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
|
215 | anObject(O);
|
216 | P = toPrimitive(P, true);
|
217 | anObject(Attributes);
|
218 | if (ie8DomDefine) try {
|
219 | return nativeDefineProperty(O, P, Attributes);
|
220 | } catch (error) { }
|
221 | if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
|
222 | if ('value' in Attributes) O[P] = Attributes.value;
|
223 | return O;
|
224 | };
|
225 |
|
226 | var objectDefineProperty = {
|
227 | f: f$2
|
228 | };
|
229 |
|
230 | var hide = descriptors ? function (object, key, value) {
|
231 | return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
|
232 | } : function (object, key, value) {
|
233 | object[key] = value;
|
234 | return object;
|
235 | };
|
236 |
|
237 | var setGlobal = function (key, value) {
|
238 | try {
|
239 | hide(global_1, key, value);
|
240 | } catch (error) {
|
241 | global_1[key] = value;
|
242 | } return value;
|
243 | };
|
244 |
|
245 | var shared = createCommonjsModule(function (module) {
|
246 | var SHARED = '__core-js_shared__';
|
247 | var store = global_1[SHARED] || setGlobal(SHARED, {});
|
248 |
|
249 | (module.exports = function (key, value) {
|
250 | return store[key] || (store[key] = value !== undefined ? value : {});
|
251 | })('versions', []).push({
|
252 | version: '3.2.1',
|
253 | mode: 'global',
|
254 | copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
|
255 | });
|
256 | });
|
257 |
|
258 | var functionToString = shared('native-function-to-string', Function.toString);
|
259 |
|
260 | var WeakMap = global_1.WeakMap;
|
261 |
|
262 | var nativeWeakMap = typeof WeakMap === 'function' && /native code/.test(functionToString.call(WeakMap));
|
263 |
|
264 | var id = 0;
|
265 | var postfix = Math.random();
|
266 |
|
267 | var uid = function (key) {
|
268 | return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
|
269 | };
|
270 |
|
271 | var keys = shared('keys');
|
272 |
|
273 | var sharedKey = function (key) {
|
274 | return keys[key] || (keys[key] = uid(key));
|
275 | };
|
276 |
|
277 | var hiddenKeys = {};
|
278 |
|
279 | var WeakMap$1 = global_1.WeakMap;
|
280 | var set, get, has$1;
|
281 |
|
282 | var enforce = function (it) {
|
283 | return has$1(it) ? get(it) : set(it, {});
|
284 | };
|
285 |
|
286 | var getterFor = function (TYPE) {
|
287 | return function (it) {
|
288 | var state;
|
289 | if (!isObject(it) || (state = get(it)).type !== TYPE) {
|
290 | throw TypeError('Incompatible receiver, ' + TYPE + ' required');
|
291 | } return state;
|
292 | };
|
293 | };
|
294 |
|
295 | if (nativeWeakMap) {
|
296 | var store = new WeakMap$1();
|
297 | var wmget = store.get;
|
298 | var wmhas = store.has;
|
299 | var wmset = store.set;
|
300 | set = function (it, metadata) {
|
301 | wmset.call(store, it, metadata);
|
302 | return metadata;
|
303 | };
|
304 | get = function (it) {
|
305 | return wmget.call(store, it) || {};
|
306 | };
|
307 | has$1 = function (it) {
|
308 | return wmhas.call(store, it);
|
309 | };
|
310 | } else {
|
311 | var STATE = sharedKey('state');
|
312 | hiddenKeys[STATE] = true;
|
313 | set = function (it, metadata) {
|
314 | hide(it, STATE, metadata);
|
315 | return metadata;
|
316 | };
|
317 | get = function (it) {
|
318 | return has(it, STATE) ? it[STATE] : {};
|
319 | };
|
320 | has$1 = function (it) {
|
321 | return has(it, STATE);
|
322 | };
|
323 | }
|
324 |
|
325 | var internalState = {
|
326 | set: set,
|
327 | get: get,
|
328 | has: has$1,
|
329 | enforce: enforce,
|
330 | getterFor: getterFor
|
331 | };
|
332 |
|
333 | var redefine = createCommonjsModule(function (module) {
|
334 | var getInternalState = internalState.get;
|
335 | var enforceInternalState = internalState.enforce;
|
336 | var TEMPLATE = String(functionToString).split('toString');
|
337 |
|
338 | shared('inspectSource', function (it) {
|
339 | return functionToString.call(it);
|
340 | });
|
341 |
|
342 | (module.exports = function (O, key, value, options) {
|
343 | var unsafe = options ? !!options.unsafe : false;
|
344 | var simple = options ? !!options.enumerable : false;
|
345 | var noTargetGet = options ? !!options.noTargetGet : false;
|
346 | if (typeof value == 'function') {
|
347 | if (typeof key == 'string' && !has(value, 'name')) hide(value, 'name', key);
|
348 | enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');
|
349 | }
|
350 | if (O === global_1) {
|
351 | if (simple) O[key] = value;
|
352 | else setGlobal(key, value);
|
353 | return;
|
354 | } else if (!unsafe) {
|
355 | delete O[key];
|
356 | } else if (!noTargetGet && O[key]) {
|
357 | simple = true;
|
358 | }
|
359 | if (simple) O[key] = value;
|
360 | else hide(O, key, value);
|
361 |
|
362 | })(Function.prototype, 'toString', function toString() {
|
363 | return typeof this == 'function' && getInternalState(this).source || functionToString.call(this);
|
364 | });
|
365 | });
|
366 |
|
367 | var path = global_1;
|
368 |
|
369 | var aFunction = function (variable) {
|
370 | return typeof variable == 'function' ? variable : undefined;
|
371 | };
|
372 |
|
373 | var getBuiltIn = function (namespace, method) {
|
374 | return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global_1[namespace])
|
375 | : path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method];
|
376 | };
|
377 |
|
378 | var ceil = Math.ceil;
|
379 | var floor = Math.floor;
|
380 |
|
381 |
|
382 |
|
383 | var toInteger = function (argument) {
|
384 | return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
|
385 | };
|
386 |
|
387 | var min = Math.min;
|
388 |
|
389 |
|
390 |
|
391 | var toLength = function (argument) {
|
392 | return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0;
|
393 | };
|
394 |
|
395 | var max = Math.max;
|
396 | var min$1 = Math.min;
|
397 |
|
398 |
|
399 |
|
400 |
|
401 | var toAbsoluteIndex = function (index, length) {
|
402 | var integer = toInteger(index);
|
403 | return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
|
404 | };
|
405 |
|
406 |
|
407 | var createMethod = function (IS_INCLUDES) {
|
408 | return function ($this, el, fromIndex) {
|
409 | var O = toIndexedObject($this);
|
410 | var length = toLength(O.length);
|
411 | var index = toAbsoluteIndex(fromIndex, length);
|
412 | var value;
|
413 |
|
414 |
|
415 | if (IS_INCLUDES && el != el) while (length > index) {
|
416 | value = O[index++];
|
417 |
|
418 | if (value != value) return true;
|
419 |
|
420 | } else for (;length > index; index++) {
|
421 | if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
|
422 | } return !IS_INCLUDES && -1;
|
423 | };
|
424 | };
|
425 |
|
426 | var arrayIncludes = {
|
427 |
|
428 |
|
429 | includes: createMethod(true),
|
430 |
|
431 |
|
432 | indexOf: createMethod(false)
|
433 | };
|
434 |
|
435 | var indexOf = arrayIncludes.indexOf;
|
436 |
|
437 |
|
438 | var objectKeysInternal = function (object, names) {
|
439 | var O = toIndexedObject(object);
|
440 | var i = 0;
|
441 | var result = [];
|
442 | var key;
|
443 | for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);
|
444 |
|
445 | while (names.length > i) if (has(O, key = names[i++])) {
|
446 | ~indexOf(result, key) || result.push(key);
|
447 | }
|
448 | return result;
|
449 | };
|
450 |
|
451 |
|
452 | var enumBugKeys = [
|
453 | 'constructor',
|
454 | 'hasOwnProperty',
|
455 | 'isPrototypeOf',
|
456 | 'propertyIsEnumerable',
|
457 | 'toLocaleString',
|
458 | 'toString',
|
459 | 'valueOf'
|
460 | ];
|
461 |
|
462 | var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype');
|
463 |
|
464 |
|
465 |
|
466 | var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
|
467 | return objectKeysInternal(O, hiddenKeys$1);
|
468 | };
|
469 |
|
470 | var objectGetOwnPropertyNames = {
|
471 | f: f$3
|
472 | };
|
473 |
|
474 | var f$4 = Object.getOwnPropertySymbols;
|
475 |
|
476 | var objectGetOwnPropertySymbols = {
|
477 | f: f$4
|
478 | };
|
479 |
|
480 |
|
481 | var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
|
482 | var keys = objectGetOwnPropertyNames.f(anObject(it));
|
483 | var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
|
484 | return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
|
485 | };
|
486 |
|
487 | var copyConstructorProperties = function (target, source) {
|
488 | var keys = ownKeys(source);
|
489 | var defineProperty = objectDefineProperty.f;
|
490 | var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
|
491 | for (var i = 0; i < keys.length; i++) {
|
492 | var key = keys[i];
|
493 | if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
|
494 | }
|
495 | };
|
496 |
|
497 | var replacement = /#|\.prototype\./;
|
498 |
|
499 | var isForced = function (feature, detection) {
|
500 | var value = data[normalize(feature)];
|
501 | return value == POLYFILL ? true
|
502 | : value == NATIVE ? false
|
503 | : typeof detection == 'function' ? fails(detection)
|
504 | : !!detection;
|
505 | };
|
506 |
|
507 | var normalize = isForced.normalize = function (string) {
|
508 | return String(string).replace(replacement, '.').toLowerCase();
|
509 | };
|
510 |
|
511 | var data = isForced.data = {};
|
512 | var NATIVE = isForced.NATIVE = 'N';
|
513 | var POLYFILL = isForced.POLYFILL = 'P';
|
514 |
|
515 | var isForced_1 = isForced;
|
516 |
|
517 | var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
|
518 |
|
519 |
|
520 |
|
521 |
|
522 |
|
523 |
|
524 | |
525 |
|
526 |
|
527 |
|
528 |
|
529 |
|
530 |
|
531 |
|
532 |
|
533 |
|
534 |
|
535 |
|
536 |
|
537 |
|
538 | var _export = function (options, source) {
|
539 | var TARGET = options.target;
|
540 | var GLOBAL = options.global;
|
541 | var STATIC = options.stat;
|
542 | var FORCED, target, key, targetProperty, sourceProperty, descriptor;
|
543 | if (GLOBAL) {
|
544 | target = global_1;
|
545 | } else if (STATIC) {
|
546 | target = global_1[TARGET] || setGlobal(TARGET, {});
|
547 | } else {
|
548 | target = (global_1[TARGET] || {}).prototype;
|
549 | }
|
550 | if (target) for (key in source) {
|
551 | sourceProperty = source[key];
|
552 | if (options.noTargetGet) {
|
553 | descriptor = getOwnPropertyDescriptor$1(target, key);
|
554 | targetProperty = descriptor && descriptor.value;
|
555 | } else targetProperty = target[key];
|
556 | FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
|
557 |
|
558 | if (!FORCED && targetProperty !== undefined) {
|
559 | if (typeof sourceProperty === typeof targetProperty) continue;
|
560 | copyConstructorProperties(sourceProperty, targetProperty);
|
561 | }
|
562 |
|
563 | if (options.sham || (targetProperty && targetProperty.sham)) {
|
564 | hide(sourceProperty, 'sham', true);
|
565 | }
|
566 |
|
567 | redefine(target, key, sourceProperty, options);
|
568 | }
|
569 | };
|
570 |
|
571 |
|
572 |
|
573 | var objectKeys = Object.keys || function keys(O) {
|
574 | return objectKeysInternal(O, enumBugKeys);
|
575 | };
|
576 |
|
577 |
|
578 |
|
579 | var toObject = function (argument) {
|
580 | return Object(requireObjectCoercible(argument));
|
581 | };
|
582 |
|
583 | var nativeAssign = Object.assign;
|
584 |
|
585 |
|
586 |
|
587 |
|
588 | var objectAssign = !nativeAssign || fails(function () {
|
589 | var A = {};
|
590 | var B = {};
|
591 |
|
592 | var symbol = Symbol();
|
593 | var alphabet = 'abcdefghijklmnopqrst';
|
594 | A[symbol] = 7;
|
595 | alphabet.split('').forEach(function (chr) { B[chr] = chr; });
|
596 | return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet;
|
597 | }) ? function assign(target, source) {
|
598 | var T = toObject(target);
|
599 | var argumentsLength = arguments.length;
|
600 | var index = 1;
|
601 | var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
|
602 | var propertyIsEnumerable = objectPropertyIsEnumerable.f;
|
603 | while (argumentsLength > index) {
|
604 | var S = indexedObject(arguments[index++]);
|
605 | var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);
|
606 | var length = keys.length;
|
607 | var j = 0;
|
608 | var key;
|
609 | while (length > j) {
|
610 | key = keys[j++];
|
611 | if (!descriptors || propertyIsEnumerable.call(S, key)) T[key] = S[key];
|
612 | }
|
613 | } return T;
|
614 | } : nativeAssign;
|
615 |
|
616 |
|
617 |
|
618 | _export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, {
|
619 | assign: objectAssign
|
620 | });
|
621 |
|
622 | var VERSION = '1.4.0';
|
623 | var DEFAULTS = {
|
624 | name: '',
|
625 | placeholder: '',
|
626 | data: undefined,
|
627 | locale: undefined,
|
628 | selectAll: true,
|
629 | single: false,
|
630 | singleRadio: false,
|
631 | multiple: false,
|
632 | hideOptgroupCheckboxes: false,
|
633 | multipleWidth: 80,
|
634 | width: undefined,
|
635 | dropWidth: undefined,
|
636 | maxHeight: 250,
|
637 | position: 'bottom',
|
638 | displayValues: false,
|
639 | displayTitle: false,
|
640 | displayDelimiter: ', ',
|
641 | minimumCountSelected: 3,
|
642 | ellipsis: false,
|
643 | isOpen: false,
|
644 | keepOpen: false,
|
645 | openOnHover: false,
|
646 | container: null,
|
647 | filter: false,
|
648 | filterGroup: false,
|
649 | filterPlaceholder: '',
|
650 | filterAcceptOnEnter: false,
|
651 | animate: undefined,
|
652 | styler: function styler() {
|
653 | return false;
|
654 | },
|
655 | textTemplate: function textTemplate($elm) {
|
656 | return $elm[0].innerHTML;
|
657 | },
|
658 | labelTemplate: function labelTemplate($elm) {
|
659 | return $elm[0].getAttribute('label');
|
660 | },
|
661 | onOpen: function onOpen() {
|
662 | return false;
|
663 | },
|
664 | onClose: function onClose() {
|
665 | return false;
|
666 | },
|
667 | onCheckAll: function onCheckAll() {
|
668 | return false;
|
669 | },
|
670 | onUncheckAll: function onUncheckAll() {
|
671 | return false;
|
672 | },
|
673 | onFocus: function onFocus() {
|
674 | return false;
|
675 | },
|
676 | onBlur: function onBlur() {
|
677 | return false;
|
678 | },
|
679 | onOptgroupClick: function onOptgroupClick() {
|
680 | return false;
|
681 | },
|
682 | onClick: function onClick() {
|
683 | return false;
|
684 | },
|
685 | onFilter: function onFilter() {
|
686 | return false;
|
687 | },
|
688 | onAfterCreate: function onAfterCreate() {
|
689 | return false;
|
690 | }
|
691 | };
|
692 | var EN = {
|
693 | formatSelectAll: function formatSelectAll() {
|
694 | return '[Select all]';
|
695 | },
|
696 | formatAllSelected: function formatAllSelected() {
|
697 | return 'All selected';
|
698 | },
|
699 | formatCountSelected: function formatCountSelected(count, total) {
|
700 | return count + ' of ' + total + ' selected';
|
701 | },
|
702 | formatNoMatchesFound: function formatNoMatchesFound() {
|
703 | return 'No matches found';
|
704 | }
|
705 | };
|
706 | var METHODS = ['getOptions', 'refreshOptions', 'getSelects', 'setSelects', 'enable', 'disable', 'open', 'close', 'checkAll', 'uncheckAll', 'focus', 'blur', 'refresh', 'destroy'];
|
707 | Object.assign(DEFAULTS, EN);
|
708 | var Constants = {
|
709 | VERSION: VERSION,
|
710 | DEFAULTS: DEFAULTS,
|
711 | METHODS: METHODS,
|
712 | LOCALES: {
|
713 | en: EN,
|
714 | 'en-US': EN
|
715 | }
|
716 | };
|
717 |
|
718 | var aFunction$1 = function (it) {
|
719 | if (typeof it != 'function') {
|
720 | throw TypeError(String(it) + ' is not a function');
|
721 | } return it;
|
722 | };
|
723 |
|
724 |
|
725 | var bindContext = function (fn, that, length) {
|
726 | aFunction$1(fn);
|
727 | if (that === undefined) return fn;
|
728 | switch (length) {
|
729 | case 0: return function () {
|
730 | return fn.call(that);
|
731 | };
|
732 | case 1: return function (a) {
|
733 | return fn.call(that, a);
|
734 | };
|
735 | case 2: return function (a, b) {
|
736 | return fn.call(that, a, b);
|
737 | };
|
738 | case 3: return function (a, b, c) {
|
739 | return fn.call(that, a, b, c);
|
740 | };
|
741 | }
|
742 | return function (/* ...args */) {
|
743 | return fn.apply(that, arguments);
|
744 | };
|
745 | };
|
746 |
|
747 |
|
748 |
|
749 | var isArray = Array.isArray || function isArray(arg) {
|
750 | return classofRaw(arg) == 'Array';
|
751 | };
|
752 |
|
753 | var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
|
754 |
|
755 |
|
756 | return !String(Symbol());
|
757 | });
|
758 |
|
759 | var Symbol$1 = global_1.Symbol;
|
760 | var store$1 = shared('wks');
|
761 |
|
762 | var wellKnownSymbol = function (name) {
|
763 | return store$1[name] || (store$1[name] = nativeSymbol && Symbol$1[name]
|
764 | || (nativeSymbol ? Symbol$1 : uid)('Symbol.' + name));
|
765 | };
|
766 |
|
767 | var SPECIES = wellKnownSymbol('species');
|
768 |
|
769 |
|
770 |
|
771 | var arraySpeciesCreate = function (originalArray, length) {
|
772 | var C;
|
773 | if (isArray(originalArray)) {
|
774 | C = originalArray.constructor;
|
775 |
|
776 | if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
|
777 | else if (isObject(C)) {
|
778 | C = C[SPECIES];
|
779 | if (C === null) C = undefined;
|
780 | }
|
781 | } return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
|
782 | };
|
783 |
|
784 | var push = [].push;
|
785 |
|
786 |
|
787 | var createMethod$1 = function (TYPE) {
|
788 | var IS_MAP = TYPE == 1;
|
789 | var IS_FILTER = TYPE == 2;
|
790 | var IS_SOME = TYPE == 3;
|
791 | var IS_EVERY = TYPE == 4;
|
792 | var IS_FIND_INDEX = TYPE == 6;
|
793 | var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
|
794 | return function ($this, callbackfn, that, specificCreate) {
|
795 | var O = toObject($this);
|
796 | var self = indexedObject(O);
|
797 | var boundFunction = bindContext(callbackfn, that, 3);
|
798 | var length = toLength(self.length);
|
799 | var index = 0;
|
800 | var create = specificCreate || arraySpeciesCreate;
|
801 | var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
|
802 | var value, result;
|
803 | for (;length > index; index++) if (NO_HOLES || index in self) {
|
804 | value = self[index];
|
805 | result = boundFunction(value, index, O);
|
806 | if (TYPE) {
|
807 | if (IS_MAP) target[index] = result;
|
808 | else if (result) switch (TYPE) {
|
809 | case 3: return true;
|
810 | case 5: return value;
|
811 | case 6: return index;
|
812 | case 2: push.call(target, value);
|
813 | } else if (IS_EVERY) return false;
|
814 | }
|
815 | }
|
816 | return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
|
817 | };
|
818 | };
|
819 |
|
820 | var arrayIteration = {
|
821 |
|
822 |
|
823 | forEach: createMethod$1(0),
|
824 |
|
825 |
|
826 | map: createMethod$1(1),
|
827 |
|
828 |
|
829 | filter: createMethod$1(2),
|
830 |
|
831 |
|
832 | some: createMethod$1(3),
|
833 |
|
834 |
|
835 | every: createMethod$1(4),
|
836 |
|
837 |
|
838 | find: createMethod$1(5),
|
839 |
|
840 |
|
841 | findIndex: createMethod$1(6)
|
842 | };
|
843 |
|
844 | var SPECIES$1 = wellKnownSymbol('species');
|
845 |
|
846 | var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
|
847 | return !fails(function () {
|
848 | var array = [];
|
849 | var constructor = array.constructor = {};
|
850 | constructor[SPECIES$1] = function () {
|
851 | return { foo: 1 };
|
852 | };
|
853 | return array[METHOD_NAME](Boolean).foo !== 1;
|
854 | });
|
855 | };
|
856 |
|
857 | var $filter = arrayIteration.filter;
|
858 |
|
859 |
|
860 |
|
861 |
|
862 |
|
863 | _export({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('filter') }, {
|
864 | filter: function filter(callbackfn /* , thisArg */) {
|
865 | return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
866 | }
|
867 | });
|
868 |
|
869 |
|
870 |
|
871 | var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
|
872 | anObject(O);
|
873 | var keys = objectKeys(Properties);
|
874 | var length = keys.length;
|
875 | var index = 0;
|
876 | var key;
|
877 | while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]);
|
878 | return O;
|
879 | };
|
880 |
|
881 | var html = getBuiltIn('document', 'documentElement');
|
882 |
|
883 | var IE_PROTO = sharedKey('IE_PROTO');
|
884 |
|
885 | var PROTOTYPE = 'prototype';
|
886 | var Empty = function () { };
|
887 |
|
888 |
|
889 | var createDict = function () {
|
890 |
|
891 | var iframe = documentCreateElement('iframe');
|
892 | var length = enumBugKeys.length;
|
893 | var lt = '<';
|
894 | var script = 'script';
|
895 | var gt = '>';
|
896 | var js = 'java' + script + ':';
|
897 | var iframeDocument;
|
898 | iframe.style.display = 'none';
|
899 | html.appendChild(iframe);
|
900 | iframe.src = String(js);
|
901 | iframeDocument = iframe.contentWindow.document;
|
902 | iframeDocument.open();
|
903 | iframeDocument.write(lt + script + gt + 'document.F=Object' + lt + '/' + script + gt);
|
904 | iframeDocument.close();
|
905 | createDict = iframeDocument.F;
|
906 | while (length--) delete createDict[PROTOTYPE][enumBugKeys[length]];
|
907 | return createDict();
|
908 | };
|
909 |
|
910 |
|
911 |
|
912 | var objectCreate = Object.create || function create(O, Properties) {
|
913 | var result;
|
914 | if (O !== null) {
|
915 | Empty[PROTOTYPE] = anObject(O);
|
916 | result = new Empty();
|
917 | Empty[PROTOTYPE] = null;
|
918 |
|
919 | result[IE_PROTO] = O;
|
920 | } else result = createDict();
|
921 | return Properties === undefined ? result : objectDefineProperties(result, Properties);
|
922 | };
|
923 |
|
924 | hiddenKeys[IE_PROTO] = true;
|
925 |
|
926 | var UNSCOPABLES = wellKnownSymbol('unscopables');
|
927 | var ArrayPrototype = Array.prototype;
|
928 |
|
929 |
|
930 |
|
931 | if (ArrayPrototype[UNSCOPABLES] == undefined) {
|
932 | hide(ArrayPrototype, UNSCOPABLES, objectCreate(null));
|
933 | }
|
934 |
|
935 |
|
936 | var addToUnscopables = function (key) {
|
937 | ArrayPrototype[UNSCOPABLES][key] = true;
|
938 | };
|
939 |
|
940 | var $find = arrayIteration.find;
|
941 |
|
942 |
|
943 | var FIND = 'find';
|
944 | var SKIPS_HOLES = true;
|
945 |
|
946 |
|
947 | if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
|
948 |
|
949 |
|
950 |
|
951 | _export({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
|
952 | find: function find(callbackfn /* , that = undefined */) {
|
953 | return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
954 | }
|
955 | });
|
956 |
|
957 |
|
958 | addToUnscopables(FIND);
|
959 |
|
960 | var $includes = arrayIncludes.includes;
|
961 |
|
962 |
|
963 |
|
964 |
|
965 | _export({ target: 'Array', proto: true }, {
|
966 | includes: function includes(el /* , fromIndex = 0 */) {
|
967 | return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
|
968 | }
|
969 | });
|
970 |
|
971 |
|
972 | addToUnscopables('includes');
|
973 |
|
974 | var sloppyArrayMethod = function (METHOD_NAME, argument) {
|
975 | var method = [][METHOD_NAME];
|
976 | return !method || !fails(function () {
|
977 |
|
978 | method.call(null, argument || function () { throw 1; }, 1);
|
979 | });
|
980 | };
|
981 |
|
982 | var nativeJoin = [].join;
|
983 |
|
984 | var ES3_STRINGS = indexedObject != Object;
|
985 | var SLOPPY_METHOD = sloppyArrayMethod('join', ',');
|
986 |
|
987 |
|
988 |
|
989 | _export({ target: 'Array', proto: true, forced: ES3_STRINGS || SLOPPY_METHOD }, {
|
990 | join: function join(separator) {
|
991 | return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator);
|
992 | }
|
993 | });
|
994 |
|
995 | var $map = arrayIteration.map;
|
996 |
|
997 |
|
998 |
|
999 |
|
1000 |
|
1001 | _export({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('map') }, {
|
1002 | map: function map(callbackfn /* , thisArg */) {
|
1003 | return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
1004 | }
|
1005 | });
|
1006 |
|
1007 | var createProperty = function (object, key, value) {
|
1008 | var propertyKey = toPrimitive(key);
|
1009 | if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
|
1010 | else object[propertyKey] = value;
|
1011 | };
|
1012 |
|
1013 | var SPECIES$2 = wellKnownSymbol('species');
|
1014 | var nativeSlice = [].slice;
|
1015 | var max$1 = Math.max;
|
1016 |
|
1017 |
|
1018 |
|
1019 |
|
1020 | _export({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('slice') }, {
|
1021 | slice: function slice(start, end) {
|
1022 | var O = toIndexedObject(this);
|
1023 | var length = toLength(O.length);
|
1024 | var k = toAbsoluteIndex(start, length);
|
1025 | var fin = toAbsoluteIndex(end === undefined ? length : end, length);
|
1026 |
|
1027 | var Constructor, result, n;
|
1028 | if (isArray(O)) {
|
1029 | Constructor = O.constructor;
|
1030 |
|
1031 | if (typeof Constructor == 'function' && (Constructor === Array || isArray(Constructor.prototype))) {
|
1032 | Constructor = undefined;
|
1033 | } else if (isObject(Constructor)) {
|
1034 | Constructor = Constructor[SPECIES$2];
|
1035 | if (Constructor === null) Constructor = undefined;
|
1036 | }
|
1037 | if (Constructor === Array || Constructor === undefined) {
|
1038 | return nativeSlice.call(O, k, fin);
|
1039 | }
|
1040 | }
|
1041 | result = new (Constructor === undefined ? Array : Constructor)(max$1(fin - k, 0));
|
1042 | for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
|
1043 | result.length = n;
|
1044 | return result;
|
1045 | }
|
1046 | });
|
1047 |
|
1048 | var defineProperty = objectDefineProperty.f;
|
1049 |
|
1050 | var FunctionPrototype = Function.prototype;
|
1051 | var FunctionPrototypeToString = FunctionPrototype.toString;
|
1052 | var nameRE = /^\s*function ([^ (]*)/;
|
1053 | var NAME = 'name';
|
1054 |
|
1055 |
|
1056 |
|
1057 | if (descriptors && !(NAME in FunctionPrototype)) {
|
1058 | defineProperty(FunctionPrototype, NAME, {
|
1059 | configurable: true,
|
1060 | get: function () {
|
1061 | try {
|
1062 | return FunctionPrototypeToString.call(this).match(nameRE)[1];
|
1063 | } catch (error) {
|
1064 | return '';
|
1065 | }
|
1066 | }
|
1067 | });
|
1068 | }
|
1069 |
|
1070 | var MATCH = wellKnownSymbol('match');
|
1071 |
|
1072 |
|
1073 |
|
1074 | var isRegexp = function (it) {
|
1075 | var isRegExp;
|
1076 | return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
|
1077 | };
|
1078 |
|
1079 | var notARegexp = function (it) {
|
1080 | if (isRegexp(it)) {
|
1081 | throw TypeError("The method doesn't accept regular expressions");
|
1082 | } return it;
|
1083 | };
|
1084 |
|
1085 | var MATCH$1 = wellKnownSymbol('match');
|
1086 |
|
1087 | var correctIsRegexpLogic = function (METHOD_NAME) {
|
1088 | var regexp = /./;
|
1089 | try {
|
1090 | '/./'[METHOD_NAME](regexp);
|
1091 | } catch (e) {
|
1092 | try {
|
1093 | regexp[MATCH$1] = false;
|
1094 | return '/./'[METHOD_NAME](regexp);
|
1095 | } catch (f) { }
|
1096 | } return false;
|
1097 | };
|
1098 |
|
1099 |
|
1100 |
|
1101 | _export({ target: 'String', proto: true, forced: !correctIsRegexpLogic('includes') }, {
|
1102 | includes: function includes(searchString /* , position = 0 */) {
|
1103 | return !!~String(requireObjectCoercible(this))
|
1104 | .indexOf(notARegexp(searchString), arguments.length > 1 ? arguments[1] : undefined);
|
1105 | }
|
1106 | });
|
1107 |
|
1108 |
|
1109 |
|
1110 | var regexpFlags = function () {
|
1111 | var that = anObject(this);
|
1112 | var result = '';
|
1113 | if (that.global) result += 'g';
|
1114 | if (that.ignoreCase) result += 'i';
|
1115 | if (that.multiline) result += 'm';
|
1116 | if (that.dotAll) result += 's';
|
1117 | if (that.unicode) result += 'u';
|
1118 | if (that.sticky) result += 'y';
|
1119 | return result;
|
1120 | };
|
1121 |
|
1122 | var nativeExec = RegExp.prototype.exec;
|
1123 |
|
1124 |
|
1125 |
|
1126 | var nativeReplace = String.prototype.replace;
|
1127 |
|
1128 | var patchedExec = nativeExec;
|
1129 |
|
1130 | var UPDATES_LAST_INDEX_WRONG = (function () {
|
1131 | var re1 = /a/;
|
1132 | var re2 = /b*/g;
|
1133 | nativeExec.call(re1, 'a');
|
1134 | nativeExec.call(re2, 'a');
|
1135 | return re1.lastIndex !== 0 || re2.lastIndex !== 0;
|
1136 | })();
|
1137 |
|
1138 |
|
1139 | var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
|
1140 |
|
1141 | var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED;
|
1142 |
|
1143 | if (PATCH) {
|
1144 | patchedExec = function exec(str) {
|
1145 | var re = this;
|
1146 | var lastIndex, reCopy, match, i;
|
1147 |
|
1148 | if (NPCG_INCLUDED) {
|
1149 | reCopy = new RegExp('^' + re.source + '$(?!\\s)', regexpFlags.call(re));
|
1150 | }
|
1151 | if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
|
1152 |
|
1153 | match = nativeExec.call(re, str);
|
1154 |
|
1155 | if (UPDATES_LAST_INDEX_WRONG && match) {
|
1156 | re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
|
1157 | }
|
1158 | if (NPCG_INCLUDED && match && match.length > 1) {
|
1159 |
|
1160 |
|
1161 | nativeReplace.call(match[0], reCopy, function () {
|
1162 | for (i = 1; i < arguments.length - 2; i++) {
|
1163 | if (arguments[i] === undefined) match[i] = undefined;
|
1164 | }
|
1165 | });
|
1166 | }
|
1167 |
|
1168 | return match;
|
1169 | };
|
1170 | }
|
1171 |
|
1172 | var regexpExec = patchedExec;
|
1173 |
|
1174 | var SPECIES$3 = wellKnownSymbol('species');
|
1175 |
|
1176 | var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
|
1177 |
|
1178 |
|
1179 |
|
1180 | var re = /./;
|
1181 | re.exec = function () {
|
1182 | var result = [];
|
1183 | result.groups = { a: '7' };
|
1184 | return result;
|
1185 | };
|
1186 | return ''.replace(re, '$<a>') !== '7';
|
1187 | });
|
1188 |
|
1189 |
|
1190 |
|
1191 | var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
|
1192 | var re = /(?:)/;
|
1193 | var originalExec = re.exec;
|
1194 | re.exec = function () { return originalExec.apply(this, arguments); };
|
1195 | var result = 'ab'.split(re);
|
1196 | return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
|
1197 | });
|
1198 |
|
1199 | var fixRegexpWellKnownSymbolLogic = function (KEY, length, exec, sham) {
|
1200 | var SYMBOL = wellKnownSymbol(KEY);
|
1201 |
|
1202 | var DELEGATES_TO_SYMBOL = !fails(function () {
|
1203 |
|
1204 | var O = {};
|
1205 | O[SYMBOL] = function () { return 7; };
|
1206 | return ''[KEY](O) != 7;
|
1207 | });
|
1208 |
|
1209 | var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {
|
1210 |
|
1211 | var execCalled = false;
|
1212 | var re = /a/;
|
1213 | re.exec = function () { execCalled = true; return null; };
|
1214 |
|
1215 | if (KEY === 'split') {
|
1216 |
|
1217 |
|
1218 | re.constructor = {};
|
1219 | re.constructor[SPECIES$3] = function () { return re; };
|
1220 | }
|
1221 |
|
1222 | re[SYMBOL]('');
|
1223 | return !execCalled;
|
1224 | });
|
1225 |
|
1226 | if (
|
1227 | !DELEGATES_TO_SYMBOL ||
|
1228 | !DELEGATES_TO_EXEC ||
|
1229 | (KEY === 'replace' && !REPLACE_SUPPORTS_NAMED_GROUPS) ||
|
1230 | (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)
|
1231 | ) {
|
1232 | var nativeRegExpMethod = /./[SYMBOL];
|
1233 | var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
|
1234 | if (regexp.exec === regexpExec) {
|
1235 | if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
|
1236 |
|
1237 |
|
1238 |
|
1239 | return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };
|
1240 | }
|
1241 | return { done: true, value: nativeMethod.call(str, regexp, arg2) };
|
1242 | }
|
1243 | return { done: false };
|
1244 | });
|
1245 | var stringMethod = methods[0];
|
1246 | var regexMethod = methods[1];
|
1247 |
|
1248 | redefine(String.prototype, KEY, stringMethod);
|
1249 | redefine(RegExp.prototype, SYMBOL, length == 2
|
1250 |
|
1251 |
|
1252 | ? function (string, arg) { return regexMethod.call(string, this, arg); }
|
1253 |
|
1254 |
|
1255 | : function (string) { return regexMethod.call(string, this); }
|
1256 | );
|
1257 | if (sham) hide(RegExp.prototype[SYMBOL], 'sham', true);
|
1258 | }
|
1259 | };
|
1260 |
|
1261 | var SPECIES$4 = wellKnownSymbol('species');
|
1262 |
|
1263 |
|
1264 |
|
1265 | var speciesConstructor = function (O, defaultConstructor) {
|
1266 | var C = anObject(O).constructor;
|
1267 | var S;
|
1268 | return C === undefined || (S = anObject(C)[SPECIES$4]) == undefined ? defaultConstructor : aFunction$1(S);
|
1269 | };
|
1270 |
|
1271 |
|
1272 | var createMethod$2 = function (CONVERT_TO_STRING) {
|
1273 | return function ($this, pos) {
|
1274 | var S = String(requireObjectCoercible($this));
|
1275 | var position = toInteger(pos);
|
1276 | var size = S.length;
|
1277 | var first, second;
|
1278 | if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
|
1279 | first = S.charCodeAt(position);
|
1280 | return first < 0xD800 || first > 0xDBFF || position + 1 === size
|
1281 | || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF
|
1282 | ? CONVERT_TO_STRING ? S.charAt(position) : first
|
1283 | : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
|
1284 | };
|
1285 | };
|
1286 |
|
1287 | var stringMultibyte = {
|
1288 |
|
1289 |
|
1290 | codeAt: createMethod$2(false),
|
1291 |
|
1292 |
|
1293 | charAt: createMethod$2(true)
|
1294 | };
|
1295 |
|
1296 | var charAt = stringMultibyte.charAt;
|
1297 |
|
1298 |
|
1299 |
|
1300 | var advanceStringIndex = function (S, index, unicode) {
|
1301 | return index + (unicode ? charAt(S, index).length : 1);
|
1302 | };
|
1303 |
|
1304 |
|
1305 |
|
1306 | var regexpExecAbstract = function (R, S) {
|
1307 | var exec = R.exec;
|
1308 | if (typeof exec === 'function') {
|
1309 | var result = exec.call(R, S);
|
1310 | if (typeof result !== 'object') {
|
1311 | throw TypeError('RegExp exec method returned something other than an Object or null');
|
1312 | }
|
1313 | return result;
|
1314 | }
|
1315 |
|
1316 | if (classofRaw(R) !== 'RegExp') {
|
1317 | throw TypeError('RegExp#exec called on incompatible receiver');
|
1318 | }
|
1319 |
|
1320 | return regexpExec.call(R, S);
|
1321 | };
|
1322 |
|
1323 | var arrayPush = [].push;
|
1324 | var min$2 = Math.min;
|
1325 | var MAX_UINT32 = 0xFFFFFFFF;
|
1326 |
|
1327 |
|
1328 | var SUPPORTS_Y = !fails(function () { return !RegExp(MAX_UINT32, 'y'); });
|
1329 |
|
1330 |
|
1331 | fixRegexpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCallNative) {
|
1332 | var internalSplit;
|
1333 | if (
|
1334 | 'abbc'.split(/(b)*/)[1] == 'c' ||
|
1335 | 'test'.split(/(?:)/, -1).length != 4 ||
|
1336 | 'ab'.split(/(?:ab)*/).length != 2 ||
|
1337 | '.'.split(/(.?)(.?)/).length != 4 ||
|
1338 | '.'.split(/()()/).length > 1 ||
|
1339 | ''.split(/.?/).length
|
1340 | ) {
|
1341 |
|
1342 | internalSplit = function (separator, limit) {
|
1343 | var string = String(requireObjectCoercible(this));
|
1344 | var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
|
1345 | if (lim === 0) return [];
|
1346 | if (separator === undefined) return [string];
|
1347 |
|
1348 | if (!isRegexp(separator)) {
|
1349 | return nativeSplit.call(string, separator, lim);
|
1350 | }
|
1351 | var output = [];
|
1352 | var flags = (separator.ignoreCase ? 'i' : '') +
|
1353 | (separator.multiline ? 'm' : '') +
|
1354 | (separator.unicode ? 'u' : '') +
|
1355 | (separator.sticky ? 'y' : '');
|
1356 | var lastLastIndex = 0;
|
1357 |
|
1358 | var separatorCopy = new RegExp(separator.source, flags + 'g');
|
1359 | var match, lastIndex, lastLength;
|
1360 | while (match = regexpExec.call(separatorCopy, string)) {
|
1361 | lastIndex = separatorCopy.lastIndex;
|
1362 | if (lastIndex > lastLastIndex) {
|
1363 | output.push(string.slice(lastLastIndex, match.index));
|
1364 | if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1));
|
1365 | lastLength = match[0].length;
|
1366 | lastLastIndex = lastIndex;
|
1367 | if (output.length >= lim) break;
|
1368 | }
|
1369 | if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++;
|
1370 | }
|
1371 | if (lastLastIndex === string.length) {
|
1372 | if (lastLength || !separatorCopy.test('')) output.push('');
|
1373 | } else output.push(string.slice(lastLastIndex));
|
1374 | return output.length > lim ? output.slice(0, lim) : output;
|
1375 | };
|
1376 |
|
1377 | } else if ('0'.split(undefined, 0).length) {
|
1378 | internalSplit = function (separator, limit) {
|
1379 | return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit);
|
1380 | };
|
1381 | } else internalSplit = nativeSplit;
|
1382 |
|
1383 | return [
|
1384 |
|
1385 |
|
1386 | function split(separator, limit) {
|
1387 | var O = requireObjectCoercible(this);
|
1388 | var splitter = separator == undefined ? undefined : separator[SPLIT];
|
1389 | return splitter !== undefined
|
1390 | ? splitter.call(separator, O, limit)
|
1391 | : internalSplit.call(String(O), separator, limit);
|
1392 | },
|
1393 |
|
1394 |
|
1395 |
|
1396 |
|
1397 |
|
1398 | function (regexp, limit) {
|
1399 | var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== nativeSplit);
|
1400 | if (res.done) return res.value;
|
1401 |
|
1402 | var rx = anObject(regexp);
|
1403 | var S = String(this);
|
1404 | var C = speciesConstructor(rx, RegExp);
|
1405 |
|
1406 | var unicodeMatching = rx.unicode;
|
1407 | var flags = (rx.ignoreCase ? 'i' : '') +
|
1408 | (rx.multiline ? 'm' : '') +
|
1409 | (rx.unicode ? 'u' : '') +
|
1410 | (SUPPORTS_Y ? 'y' : 'g');
|
1411 |
|
1412 |
|
1413 |
|
1414 | var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);
|
1415 | var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
|
1416 | if (lim === 0) return [];
|
1417 | if (S.length === 0) return regexpExecAbstract(splitter, S) === null ? [S] : [];
|
1418 | var p = 0;
|
1419 | var q = 0;
|
1420 | var A = [];
|
1421 | while (q < S.length) {
|
1422 | splitter.lastIndex = SUPPORTS_Y ? q : 0;
|
1423 | var z = regexpExecAbstract(splitter, SUPPORTS_Y ? S : S.slice(q));
|
1424 | var e;
|
1425 | if (
|
1426 | z === null ||
|
1427 | (e = min$2(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p
|
1428 | ) {
|
1429 | q = advanceStringIndex(S, q, unicodeMatching);
|
1430 | } else {
|
1431 | A.push(S.slice(p, q));
|
1432 | if (A.length === lim) return A;
|
1433 | for (var i = 1; i <= z.length - 1; i++) {
|
1434 | A.push(z[i]);
|
1435 | if (A.length === lim) return A;
|
1436 | }
|
1437 | q = p = e;
|
1438 | }
|
1439 | }
|
1440 | A.push(S.slice(p));
|
1441 | return A;
|
1442 | }
|
1443 | ];
|
1444 | }, !SUPPORTS_Y);
|
1445 |
|
1446 |
|
1447 |
|
1448 | var whitespaces = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
|
1449 |
|
1450 | var whitespace = '[' + whitespaces + ']';
|
1451 | var ltrim = RegExp('^' + whitespace + whitespace + '*');
|
1452 | var rtrim = RegExp(whitespace + whitespace + '*$');
|
1453 |
|
1454 |
|
1455 | var createMethod$3 = function (TYPE) {
|
1456 | return function ($this) {
|
1457 | var string = String(requireObjectCoercible($this));
|
1458 | if (TYPE & 1) string = string.replace(ltrim, '');
|
1459 | if (TYPE & 2) string = string.replace(rtrim, '');
|
1460 | return string;
|
1461 | };
|
1462 | };
|
1463 |
|
1464 | var stringTrim = {
|
1465 |
|
1466 |
|
1467 | start: createMethod$3(1),
|
1468 |
|
1469 |
|
1470 | end: createMethod$3(2),
|
1471 |
|
1472 |
|
1473 | trim: createMethod$3(3)
|
1474 | };
|
1475 |
|
1476 | var non = '\u200B\u0085\u180E';
|
1477 |
|
1478 |
|
1479 |
|
1480 | var forcedStringTrimMethod = function (METHOD_NAME) {
|
1481 | return fails(function () {
|
1482 | return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME;
|
1483 | });
|
1484 | };
|
1485 |
|
1486 | var $trim = stringTrim.trim;
|
1487 |
|
1488 |
|
1489 |
|
1490 |
|
1491 | _export({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
|
1492 | trim: function trim() {
|
1493 | return $trim(this);
|
1494 | }
|
1495 | });
|
1496 |
|
1497 |
|
1498 |
|
1499 | var domIterables = {
|
1500 | CSSRuleList: 0,
|
1501 | CSSStyleDeclaration: 0,
|
1502 | CSSValueList: 0,
|
1503 | ClientRectList: 0,
|
1504 | DOMRectList: 0,
|
1505 | DOMStringList: 0,
|
1506 | DOMTokenList: 1,
|
1507 | DataTransferItemList: 0,
|
1508 | FileList: 0,
|
1509 | HTMLAllCollection: 0,
|
1510 | HTMLCollection: 0,
|
1511 | HTMLFormElement: 0,
|
1512 | HTMLSelectElement: 0,
|
1513 | MediaList: 0,
|
1514 | MimeTypeArray: 0,
|
1515 | NamedNodeMap: 0,
|
1516 | NodeList: 1,
|
1517 | PaintRequestList: 0,
|
1518 | Plugin: 0,
|
1519 | PluginArray: 0,
|
1520 | SVGLengthList: 0,
|
1521 | SVGNumberList: 0,
|
1522 | SVGPathSegList: 0,
|
1523 | SVGPointList: 0,
|
1524 | SVGStringList: 0,
|
1525 | SVGTransformList: 0,
|
1526 | SourceBufferList: 0,
|
1527 | StyleSheetList: 0,
|
1528 | TextTrackCueList: 0,
|
1529 | TextTrackList: 0,
|
1530 | TouchList: 0
|
1531 | };
|
1532 |
|
1533 | var $forEach = arrayIteration.forEach;
|
1534 |
|
1535 |
|
1536 |
|
1537 |
|
1538 | var arrayForEach = sloppyArrayMethod('forEach') ? function forEach(callbackfn /* , thisArg */) {
|
1539 | return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
1540 | } : [].forEach;
|
1541 |
|
1542 | for (var COLLECTION_NAME in domIterables) {
|
1543 | var Collection = global_1[COLLECTION_NAME];
|
1544 | var CollectionPrototype = Collection && Collection.prototype;
|
1545 |
|
1546 | if (CollectionPrototype && CollectionPrototype.forEach !== arrayForEach) try {
|
1547 | hide(CollectionPrototype, 'forEach', arrayForEach);
|
1548 | } catch (error) {
|
1549 | CollectionPrototype.forEach = arrayForEach;
|
1550 | }
|
1551 | }
|
1552 |
|
1553 | var FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });
|
1554 |
|
1555 |
|
1556 |
|
1557 | _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
|
1558 | keys: function keys(it) {
|
1559 | return objectKeys(toObject(it));
|
1560 | }
|
1561 | });
|
1562 |
|
1563 | var max$2 = Math.max;
|
1564 | var min$3 = Math.min;
|
1565 | var floor$1 = Math.floor;
|
1566 | var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d\d?|<[^>]*>)/g;
|
1567 | var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d\d?)/g;
|
1568 |
|
1569 | var maybeToString = function (it) {
|
1570 | return it === undefined ? it : String(it);
|
1571 | };
|
1572 |
|
1573 |
|
1574 | fixRegexpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative) {
|
1575 | return [
|
1576 |
|
1577 |
|
1578 | function replace(searchValue, replaceValue) {
|
1579 | var O = requireObjectCoercible(this);
|
1580 | var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];
|
1581 | return replacer !== undefined
|
1582 | ? replacer.call(searchValue, O, replaceValue)
|
1583 | : nativeReplace.call(String(O), searchValue, replaceValue);
|
1584 | },
|
1585 |
|
1586 |
|
1587 | function (regexp, replaceValue) {
|
1588 | var res = maybeCallNative(nativeReplace, regexp, this, replaceValue);
|
1589 | if (res.done) return res.value;
|
1590 |
|
1591 | var rx = anObject(regexp);
|
1592 | var S = String(this);
|
1593 |
|
1594 | var functionalReplace = typeof replaceValue === 'function';
|
1595 | if (!functionalReplace) replaceValue = String(replaceValue);
|
1596 |
|
1597 | var global = rx.global;
|
1598 | if (global) {
|
1599 | var fullUnicode = rx.unicode;
|
1600 | rx.lastIndex = 0;
|
1601 | }
|
1602 | var results = [];
|
1603 | while (true) {
|
1604 | var result = regexpExecAbstract(rx, S);
|
1605 | if (result === null) break;
|
1606 |
|
1607 | results.push(result);
|
1608 | if (!global) break;
|
1609 |
|
1610 | var matchStr = String(result[0]);
|
1611 | if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
|
1612 | }
|
1613 |
|
1614 | var accumulatedResult = '';
|
1615 | var nextSourcePosition = 0;
|
1616 | for (var i = 0; i < results.length; i++) {
|
1617 | result = results[i];
|
1618 |
|
1619 | var matched = String(result[0]);
|
1620 | var position = max$2(min$3(toInteger(result.index), S.length), 0);
|
1621 | var captures = [];
|
1622 |
|
1623 |
|
1624 |
|
1625 |
|
1626 |
|
1627 | for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));
|
1628 | var namedCaptures = result.groups;
|
1629 | if (functionalReplace) {
|
1630 | var replacerArgs = [matched].concat(captures, position, S);
|
1631 | if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);
|
1632 | var replacement = String(replaceValue.apply(undefined, replacerArgs));
|
1633 | } else {
|
1634 | replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
|
1635 | }
|
1636 | if (position >= nextSourcePosition) {
|
1637 | accumulatedResult += S.slice(nextSourcePosition, position) + replacement;
|
1638 | nextSourcePosition = position + matched.length;
|
1639 | }
|
1640 | }
|
1641 | return accumulatedResult + S.slice(nextSourcePosition);
|
1642 | }
|
1643 | ];
|
1644 |
|
1645 |
|
1646 | function getSubstitution(matched, str, position, captures, namedCaptures, replacement) {
|
1647 | var tailPos = position + matched.length;
|
1648 | var m = captures.length;
|
1649 | var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
|
1650 | if (namedCaptures !== undefined) {
|
1651 | namedCaptures = toObject(namedCaptures);
|
1652 | symbols = SUBSTITUTION_SYMBOLS;
|
1653 | }
|
1654 | return nativeReplace.call(replacement, symbols, function (match, ch) {
|
1655 | var capture;
|
1656 | switch (ch.charAt(0)) {
|
1657 | case '$': return '$';
|
1658 | case '&': return matched;
|
1659 | case '`': return str.slice(0, position);
|
1660 | case "'": return str.slice(tailPos);
|
1661 | case '<':
|
1662 | capture = namedCaptures[ch.slice(1, -1)];
|
1663 | break;
|
1664 | default:
|
1665 | var n = +ch;
|
1666 | if (n === 0) return match;
|
1667 | if (n > m) {
|
1668 | var f = floor$1(n / 10);
|
1669 | if (f === 0) return match;
|
1670 | if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);
|
1671 | return match;
|
1672 | }
|
1673 | capture = captures[n - 1];
|
1674 | }
|
1675 | return capture === undefined ? '' : capture;
|
1676 | });
|
1677 | }
|
1678 | });
|
1679 |
|
1680 |
|
1681 | var s = 's';
|
1682 |
|
1683 | var sprintf = function sprintf(strings) {
|
1684 | for (var _len = arguments.length, formats = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
1685 | formats[_key - 1] = arguments[_key];
|
1686 | }
|
1687 |
|
1688 | return function () {
|
1689 | for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
1690 | args[_key2] = arguments[_key2];
|
1691 | }
|
1692 |
|
1693 | var retStr = '';
|
1694 | return strings.slice(0, -1).some(function (str, i) {
|
1695 | switch (formats[i]) {
|
1696 | default:
|
1697 | throw new TypeError('Unrecognized sprintf format');
|
1698 |
|
1699 | case 's':
|
1700 | {
|
1701 | var arg = args[i];
|
1702 |
|
1703 | if (arg === null || arg === undefined) {
|
1704 | return true;
|
1705 | }
|
1706 |
|
1707 | retStr += str + arg;
|
1708 | return false;
|
1709 | }
|
1710 | }
|
1711 | }) ? '' : retStr + strings.slice(-1);
|
1712 | };
|
1713 | };
|
1714 |
|
1715 | var compareObjects = function compareObjects(objectA, objectB, compareLength) {
|
1716 | var aKeys = Object.keys(objectA);
|
1717 | var bKeys = Object.keys(objectB);
|
1718 |
|
1719 | if (compareLength && aKeys.length !== bKeys.length) {
|
1720 | return false;
|
1721 | }
|
1722 |
|
1723 | for (var _i = 0, _aKeys = aKeys; _i < _aKeys.length; _i++) {
|
1724 | var key = _aKeys[_i];
|
1725 |
|
1726 | if (bKeys.includes(key) && objectA[key] !== objectB[key]) {
|
1727 | return false;
|
1728 | }
|
1729 | }
|
1730 |
|
1731 | return true;
|
1732 | };
|
1733 |
|
1734 | var removeDiacritics = function removeDiacritics(str) {
|
1735 | if (str.normalize) {
|
1736 | return str.normalize('NFD').replace(/[\u0300-\u036F]/g, '');
|
1737 | }
|
1738 |
|
1739 | var defaultDiacriticsRemovalMap = [{
|
1740 | 'base': 'A',
|
1741 | 'letters': /[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g
|
1742 | }, {
|
1743 | 'base': 'AA',
|
1744 | 'letters': /[\uA732]/g
|
1745 | }, {
|
1746 | 'base': 'AE',
|
1747 | 'letters': /[\u00C6\u01FC\u01E2]/g
|
1748 | }, {
|
1749 | 'base': 'AO',
|
1750 | 'letters': /[\uA734]/g
|
1751 | }, {
|
1752 | 'base': 'AU',
|
1753 | 'letters': /[\uA736]/g
|
1754 | }, {
|
1755 | 'base': 'AV',
|
1756 | 'letters': /[\uA738\uA73A]/g
|
1757 | }, {
|
1758 | 'base': 'AY',
|
1759 | 'letters': /[\uA73C]/g
|
1760 | }, {
|
1761 | 'base': 'B',
|
1762 | 'letters': /[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g
|
1763 | }, {
|
1764 | 'base': 'C',
|
1765 | 'letters': /[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g
|
1766 | }, {
|
1767 | 'base': 'D',
|
1768 | 'letters': /[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g
|
1769 | }, {
|
1770 | 'base': 'DZ',
|
1771 | 'letters': /[\u01F1\u01C4]/g
|
1772 | }, {
|
1773 | 'base': 'Dz',
|
1774 | 'letters': /[\u01F2\u01C5]/g
|
1775 | }, {
|
1776 | 'base': 'E',
|
1777 | 'letters': /[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g
|
1778 | }, {
|
1779 | 'base': 'F',
|
1780 | 'letters': /[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g
|
1781 | }, {
|
1782 | 'base': 'G',
|
1783 | 'letters': /[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g
|
1784 | }, {
|
1785 | 'base': 'H',
|
1786 | 'letters': /[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g
|
1787 | }, {
|
1788 | 'base': 'I',
|
1789 | 'letters': /[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g
|
1790 | }, {
|
1791 | 'base': 'J',
|
1792 | 'letters': /[\u004A\u24BF\uFF2A\u0134\u0248]/g
|
1793 | }, {
|
1794 | 'base': 'K',
|
1795 | 'letters': /[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g
|
1796 | }, {
|
1797 | 'base': 'L',
|
1798 | 'letters': /[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g
|
1799 | }, {
|
1800 | 'base': 'LJ',
|
1801 | 'letters': /[\u01C7]/g
|
1802 | }, {
|
1803 | 'base': 'Lj',
|
1804 | 'letters': /[\u01C8]/g
|
1805 | }, {
|
1806 | 'base': 'M',
|
1807 | 'letters': /[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g
|
1808 | }, {
|
1809 | 'base': 'N',
|
1810 | 'letters': /[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g
|
1811 | }, {
|
1812 | 'base': 'NJ',
|
1813 | 'letters': /[\u01CA]/g
|
1814 | }, {
|
1815 | 'base': 'Nj',
|
1816 | 'letters': /[\u01CB]/g
|
1817 | }, {
|
1818 | 'base': 'O',
|
1819 | 'letters': /[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g
|
1820 | }, {
|
1821 | 'base': 'OI',
|
1822 | 'letters': /[\u01A2]/g
|
1823 | }, {
|
1824 | 'base': 'OO',
|
1825 | 'letters': /[\uA74E]/g
|
1826 | }, {
|
1827 | 'base': 'OU',
|
1828 | 'letters': /[\u0222]/g
|
1829 | }, {
|
1830 | 'base': 'P',
|
1831 | 'letters': /[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g
|
1832 | }, {
|
1833 | 'base': 'Q',
|
1834 | 'letters': /[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g
|
1835 | }, {
|
1836 | 'base': 'R',
|
1837 | 'letters': /[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g
|
1838 | }, {
|
1839 | 'base': 'S',
|
1840 | 'letters': /[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g
|
1841 | }, {
|
1842 | 'base': 'T',
|
1843 | 'letters': /[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g
|
1844 | }, {
|
1845 | 'base': 'TZ',
|
1846 | 'letters': /[\uA728]/g
|
1847 | }, {
|
1848 | 'base': 'U',
|
1849 | 'letters': /[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g
|
1850 | }, {
|
1851 | 'base': 'V',
|
1852 | 'letters': /[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g
|
1853 | }, {
|
1854 | 'base': 'VY',
|
1855 | 'letters': /[\uA760]/g
|
1856 | }, {
|
1857 | 'base': 'W',
|
1858 | 'letters': /[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g
|
1859 | }, {
|
1860 | 'base': 'X',
|
1861 | 'letters': /[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g
|
1862 | }, {
|
1863 | 'base': 'Y',
|
1864 | 'letters': /[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g
|
1865 | }, {
|
1866 | 'base': 'Z',
|
1867 | 'letters': /[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g
|
1868 | }, {
|
1869 | 'base': 'a',
|
1870 | 'letters': /[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g
|
1871 | }, {
|
1872 | 'base': 'aa',
|
1873 | 'letters': /[\uA733]/g
|
1874 | }, {
|
1875 | 'base': 'ae',
|
1876 | 'letters': /[\u00E6\u01FD\u01E3]/g
|
1877 | }, {
|
1878 | 'base': 'ao',
|
1879 | 'letters': /[\uA735]/g
|
1880 | }, {
|
1881 | 'base': 'au',
|
1882 | 'letters': /[\uA737]/g
|
1883 | }, {
|
1884 | 'base': 'av',
|
1885 | 'letters': /[\uA739\uA73B]/g
|
1886 | }, {
|
1887 | 'base': 'ay',
|
1888 | 'letters': /[\uA73D]/g
|
1889 | }, {
|
1890 | 'base': 'b',
|
1891 | 'letters': /[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g
|
1892 | }, {
|
1893 | 'base': 'c',
|
1894 | 'letters': /[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g
|
1895 | }, {
|
1896 | 'base': 'd',
|
1897 | 'letters': /[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g
|
1898 | }, {
|
1899 | 'base': 'dz',
|
1900 | 'letters': /[\u01F3\u01C6]/g
|
1901 | }, {
|
1902 | 'base': 'e',
|
1903 | 'letters': /[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g
|
1904 | }, {
|
1905 | 'base': 'f',
|
1906 | 'letters': /[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g
|
1907 | }, {
|
1908 | 'base': 'g',
|
1909 | 'letters': /[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g
|
1910 | }, {
|
1911 | 'base': 'h',
|
1912 | 'letters': /[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g
|
1913 | }, {
|
1914 | 'base': 'hv',
|
1915 | 'letters': /[\u0195]/g
|
1916 | }, {
|
1917 | 'base': 'i',
|
1918 | 'letters': /[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g
|
1919 | }, {
|
1920 | 'base': 'j',
|
1921 | 'letters': /[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g
|
1922 | }, {
|
1923 | 'base': 'k',
|
1924 | 'letters': /[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g
|
1925 | }, {
|
1926 | 'base': 'l',
|
1927 | 'letters': /[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g
|
1928 | }, {
|
1929 | 'base': 'lj',
|
1930 | 'letters': /[\u01C9]/g
|
1931 | }, {
|
1932 | 'base': 'm',
|
1933 | 'letters': /[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g
|
1934 | }, {
|
1935 | 'base': 'n',
|
1936 | 'letters': /[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g
|
1937 | }, {
|
1938 | 'base': 'nj',
|
1939 | 'letters': /[\u01CC]/g
|
1940 | }, {
|
1941 | 'base': 'o',
|
1942 | 'letters': /[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g
|
1943 | }, {
|
1944 | 'base': 'oi',
|
1945 | 'letters': /[\u01A3]/g
|
1946 | }, {
|
1947 | 'base': 'ou',
|
1948 | 'letters': /[\u0223]/g
|
1949 | }, {
|
1950 | 'base': 'oo',
|
1951 | 'letters': /[\uA74F]/g
|
1952 | }, {
|
1953 | 'base': 'p',
|
1954 | 'letters': /[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g
|
1955 | }, {
|
1956 | 'base': 'q',
|
1957 | 'letters': /[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g
|
1958 | }, {
|
1959 | 'base': 'r',
|
1960 | 'letters': /[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g
|
1961 | }, {
|
1962 | 'base': 's',
|
1963 | 'letters': /[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g
|
1964 | }, {
|
1965 | 'base': 't',
|
1966 | 'letters': /[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g
|
1967 | }, {
|
1968 | 'base': 'tz',
|
1969 | 'letters': /[\uA729]/g
|
1970 | }, {
|
1971 | 'base': 'u',
|
1972 | 'letters': /[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g
|
1973 | }, {
|
1974 | 'base': 'v',
|
1975 | 'letters': /[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g
|
1976 | }, {
|
1977 | 'base': 'vy',
|
1978 | 'letters': /[\uA761]/g
|
1979 | }, {
|
1980 | 'base': 'w',
|
1981 | 'letters': /[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g
|
1982 | }, {
|
1983 | 'base': 'x',
|
1984 | 'letters': /[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g
|
1985 | }, {
|
1986 | 'base': 'y',
|
1987 | 'letters': /[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g
|
1988 | }, {
|
1989 | 'base': 'z',
|
1990 | 'letters': /[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g
|
1991 | }];
|
1992 | return defaultDiacriticsRemovalMap.reduce(function (string, _ref) {
|
1993 | var letters = _ref.letters,
|
1994 | base = _ref.base;
|
1995 | return string.replace(letters, base);
|
1996 | }, str);
|
1997 | };
|
1998 |
|
1999 | function _templateObject23() {
|
2000 | var data = _taggedTemplateLiteral(["[data-group=\"", "\"]"]);
|
2001 |
|
2002 | _templateObject23 = function _templateObject23() {
|
2003 | return data;
|
2004 | };
|
2005 |
|
2006 | return data;
|
2007 | }
|
2008 |
|
2009 | function _templateObject22() {
|
2010 | var data = _taggedTemplateLiteral(["[value=\"", "\"]"]);
|
2011 |
|
2012 | _templateObject22 = function _templateObject22() {
|
2013 | return data;
|
2014 | };
|
2015 |
|
2016 | return data;
|
2017 | }
|
2018 |
|
2019 | function _templateObject21() {
|
2020 | var data = _taggedTemplateLiteral(["[value=\"", "\"]"]);
|
2021 |
|
2022 | _templateObject21 = function _templateObject21() {
|
2023 | return data;
|
2024 | };
|
2025 |
|
2026 | return data;
|
2027 | }
|
2028 |
|
2029 | function _templateObject20() {
|
2030 | var data = _taggedTemplateLiteral(["[", "][data-group=\"", "\"]"]);
|
2031 |
|
2032 | _templateObject20 = function _templateObject20() {
|
2033 | return data;
|
2034 | };
|
2035 |
|
2036 | return data;
|
2037 | }
|
2038 |
|
2039 | function _templateObject19() {
|
2040 | var data = _taggedTemplateLiteral(["input[", "]:checked"]);
|
2041 |
|
2042 | _templateObject19 = function _templateObject19() {
|
2043 | return data;
|
2044 | };
|
2045 |
|
2046 | return data;
|
2047 | }
|
2048 |
|
2049 | function _templateObject18() {
|
2050 | var data = _taggedTemplateLiteral(["[data-group=\"", "\"]"]);
|
2051 |
|
2052 | _templateObject18 = function _templateObject18() {
|
2053 | return data;
|
2054 | };
|
2055 |
|
2056 | return data;
|
2057 | }
|
2058 |
|
2059 | function _templateObject17() {
|
2060 | var data = _taggedTemplateLiteral(["[data-group=\"", "\"]"]);
|
2061 |
|
2062 | _templateObject17 = function _templateObject17() {
|
2063 | return data;
|
2064 | };
|
2065 |
|
2066 | return data;
|
2067 | }
|
2068 |
|
2069 | function _templateObject16() {
|
2070 | var data = _taggedTemplateLiteral(["<span>", "</span>"]);
|
2071 |
|
2072 | _templateObject16 = function _templateObject16() {
|
2073 | return data;
|
2074 | };
|
2075 |
|
2076 | return data;
|
2077 | }
|
2078 |
|
2079 | function _templateObject15() {
|
2080 | var data = _taggedTemplateLiteral([" data-group=\"", "\""]);
|
2081 |
|
2082 | _templateObject15 = function _templateObject15() {
|
2083 | return data;
|
2084 | };
|
2085 |
|
2086 | return data;
|
2087 | }
|
2088 |
|
2089 | function _templateObject14() {
|
2090 | var data = _taggedTemplateLiteral(["<input type=\"", "\" value=\"", "\" ", "", "", "", ">"]);
|
2091 |
|
2092 | _templateObject14 = function _templateObject14() {
|
2093 | return data;
|
2094 | };
|
2095 |
|
2096 | return data;
|
2097 | }
|
2098 |
|
2099 | function _templateObject13() {
|
2100 | var data = _taggedTemplateLiteral(["<label class=\"", "\">"]);
|
2101 |
|
2102 | _templateObject13 = function _templateObject13() {
|
2103 | return data;
|
2104 | };
|
2105 |
|
2106 | return data;
|
2107 | }
|
2108 |
|
2109 | function _templateObject12() {
|
2110 | var data = _taggedTemplateLiteral(["<li class=\"", " ", "\" ", " ", ">"]);
|
2111 |
|
2112 | _templateObject12 = function _templateObject12() {
|
2113 | return data;
|
2114 | };
|
2115 |
|
2116 | return data;
|
2117 | }
|
2118 |
|
2119 | function _templateObject11() {
|
2120 | var data = _taggedTemplateLiteral(["style=\"", "\""]);
|
2121 |
|
2122 | _templateObject11 = function _templateObject11() {
|
2123 | return data;
|
2124 | };
|
2125 |
|
2126 | return data;
|
2127 | }
|
2128 |
|
2129 | function _templateObject10() {
|
2130 | var data = _taggedTemplateLiteral(["<input type=\"checkbox\" ", " ", ">"]);
|
2131 |
|
2132 | _templateObject10 = function _templateObject10() {
|
2133 | return data;
|
2134 | };
|
2135 |
|
2136 | return data;
|
2137 | }
|
2138 |
|
2139 | function _templateObject9() {
|
2140 | var data = _taggedTemplateLiteral(["<label class=\"optgroup ", "\" data-group=\"", "\">"]);
|
2141 |
|
2142 | _templateObject9 = function _templateObject9() {
|
2143 | return data;
|
2144 | };
|
2145 |
|
2146 | return data;
|
2147 | }
|
2148 |
|
2149 | function _templateObject8() {
|
2150 | var data = _taggedTemplateLiteral(["title=\"", "\""]);
|
2151 |
|
2152 | _templateObject8 = function _templateObject8() {
|
2153 | return data;
|
2154 | };
|
2155 |
|
2156 | return data;
|
2157 | }
|
2158 |
|
2159 | function _templateObject7() {
|
2160 | var data = _taggedTemplateLiteral(["<li class=\"ms-no-results\">", "</li>"]);
|
2161 |
|
2162 | _templateObject7 = function _templateObject7() {
|
2163 | return data;
|
2164 | };
|
2165 |
|
2166 | return data;
|
2167 | }
|
2168 |
|
2169 | function _templateObject6() {
|
2170 | var data = _taggedTemplateLiteral(["<input type=\"checkbox\" ", " />"]);
|
2171 |
|
2172 | _templateObject6 = function _templateObject6() {
|
2173 | return data;
|
2174 | };
|
2175 |
|
2176 | return data;
|
2177 | }
|
2178 |
|
2179 | function _templateObject5() {
|
2180 | var data = _taggedTemplateLiteral(["placeholder=\"", "\""]);
|
2181 |
|
2182 | _templateObject5 = function _templateObject5() {
|
2183 | return data;
|
2184 | };
|
2185 |
|
2186 | return data;
|
2187 | }
|
2188 |
|
2189 | function _templateObject4() {
|
2190 | var data = _taggedTemplateLiteral(["<div class=\"ms-drop ", "\"></div>"]);
|
2191 |
|
2192 | _templateObject4 = function _templateObject4() {
|
2193 | return data;
|
2194 | };
|
2195 |
|
2196 | return data;
|
2197 | }
|
2198 |
|
2199 | function _templateObject3() {
|
2200 | var data = _taggedTemplateLiteral(["\n <button type=\"button\" class=\"ms-choice\">\n <span class=\"placeholder\">", "</span>\n <div></div>\n </button>\n "]);
|
2201 |
|
2202 | _templateObject3 = function _templateObject3() {
|
2203 | return data;
|
2204 | };
|
2205 |
|
2206 | return data;
|
2207 | }
|
2208 |
|
2209 | function _templateObject2() {
|
2210 | var data = _taggedTemplateLiteral(["title=\"", "\""]);
|
2211 |
|
2212 | _templateObject2 = function _templateObject2() {
|
2213 | return data;
|
2214 | };
|
2215 |
|
2216 | return data;
|
2217 | }
|
2218 |
|
2219 | function _templateObject() {
|
2220 | var data = _taggedTemplateLiteral(["<div class=\"ms-parent ", "\" ", "/>"]);
|
2221 |
|
2222 | _templateObject = function _templateObject() {
|
2223 | return data;
|
2224 | };
|
2225 |
|
2226 | return data;
|
2227 | }
|
2228 |
|
2229 | var MultipleSelect =
|
2230 |
|
2231 | function () {
|
2232 | function MultipleSelect($el, options) {
|
2233 | _classCallCheck(this, MultipleSelect);
|
2234 |
|
2235 | this.$el = $el;
|
2236 | this.options = $.extend({}, Constants.DEFAULTS, options);
|
2237 | }
|
2238 |
|
2239 | _createClass(MultipleSelect, [{
|
2240 | key: "init",
|
2241 | value: function init() {
|
2242 | this.initLocale();
|
2243 | this.initContainer();
|
2244 | this.initData();
|
2245 | this.initDrop();
|
2246 | }
|
2247 | }, {
|
2248 | key: "initLocale",
|
2249 | value: function initLocale() {
|
2250 | if (this.options.locale) {
|
2251 | var locales = $.fn.multipleSelect.locales;
|
2252 | var parts = this.options.locale.split(/-|_/);
|
2253 | parts[0] = parts[0].toLowerCase();
|
2254 |
|
2255 | if (parts[1]) {
|
2256 | parts[1] = parts[1].toUpperCase();
|
2257 | }
|
2258 |
|
2259 | if (locales[this.options.locale]) {
|
2260 | $.extend(this.options, locales[this.options.locale]);
|
2261 | } else if (locales[parts.join('-')]) {
|
2262 | $.extend(this.options, locales[parts.join('-')]);
|
2263 | } else if (locales[parts[0]]) {
|
2264 | $.extend(this.options, locales[parts[0]]);
|
2265 | }
|
2266 | }
|
2267 | }
|
2268 | }, {
|
2269 | key: "initContainer",
|
2270 | value: function initContainer() {
|
2271 | var _this = this;
|
2272 |
|
2273 | var el = this.$el[0];
|
2274 | var name = el.getAttribute('name') || this.options.name || '';
|
2275 |
|
2276 | this.$el = this.$el.hide();
|
2277 |
|
2278 | this.$label = this.$el.closest('label');
|
2279 |
|
2280 | if (!this.$label.length && this.$el.attr('id')) {
|
2281 | this.$label = $("label[for=\"".concat(this.$el.attr('id'), "\"]"));
|
2282 | }
|
2283 |
|
2284 |
|
2285 | this.$parent = $(sprintf(_templateObject(), s, s)(el.getAttribute('class') || '', sprintf(_templateObject2(), s)(el.getAttribute('title'))));
|
2286 |
|
2287 | this.options.placeholder = this.options.placeholder || el.getAttribute('placeholder') || '';
|
2288 | this.$choice = $(sprintf(_templateObject3(), s)(this.options.placeholder));
|
2289 |
|
2290 | this.$drop = $(sprintf(_templateObject4(), s)(this.options.position));
|
2291 |
|
2292 | if (this.options.dropWidth) {
|
2293 | this.$drop.css('width', this.options.dropWidth);
|
2294 | }
|
2295 |
|
2296 | this.$el.after(this.$parent);
|
2297 | this.$parent.append(this.$choice);
|
2298 | this.$parent.append(this.$drop);
|
2299 |
|
2300 | if (el.disabled) {
|
2301 | this.$choice.addClass('disabled');
|
2302 | }
|
2303 |
|
2304 | this.$parent.css('width', this.options.width || this.$el.css('width') || this.$el.outerWidth() + 20);
|
2305 | this.selectAllName = "data-name=\"selectAll".concat(name, "\"");
|
2306 | this.selectGroupName = "data-name=\"selectGroup".concat(name, "\"");
|
2307 | this.selectItemName = "data-name=\"selectItem".concat(name, "\"");
|
2308 |
|
2309 | if (!this.options.keepOpen) {
|
2310 | $(document).click(function (e) {
|
2311 | if ($(e.target)[0] === _this.$choice[0] || $(e.target).parents('.ms-choice')[0] === _this.$choice[0]) {
|
2312 | return;
|
2313 | }
|
2314 |
|
2315 | if (($(e.target)[0] === _this.$drop[0] || $(e.target).parents('.ms-drop')[0] !== _this.$drop[0] && e.target !== el) && _this.options.isOpen) {
|
2316 | _this.close();
|
2317 | }
|
2318 | });
|
2319 | }
|
2320 |
|
2321 | this.options.onAfterCreate();
|
2322 | }
|
2323 | }, {
|
2324 | key: "initData",
|
2325 | value: function initData() {
|
2326 | var _this2 = this;
|
2327 |
|
2328 | var data = [];
|
2329 |
|
2330 | if (this.options.data) {
|
2331 | this.options.data.forEach(function (row, i) {
|
2332 | if (row.type === 'optgroup') {
|
2333 | row.group = row.group || "group_".concat(i);
|
2334 | row.children.forEach(function (child) {
|
2335 | child.group = child.group || row.group;
|
2336 | });
|
2337 | }
|
2338 | });
|
2339 | this.data = this.options.data;
|
2340 | return;
|
2341 | }
|
2342 |
|
2343 | $.each(this.$el.children(), function (i, elm) {
|
2344 | var row = _this2.initRow(i, elm);
|
2345 |
|
2346 | if (row) {
|
2347 | data.push(_this2.initRow(i, elm));
|
2348 | }
|
2349 | });
|
2350 | this.options.data = data;
|
2351 | this.data = data;
|
2352 | }
|
2353 | }, {
|
2354 | key: "initRow",
|
2355 | value: function initRow(i, elm, group, groupDisabled) {
|
2356 | var _this3 = this;
|
2357 |
|
2358 | var row = {};
|
2359 | var $elm = $(elm);
|
2360 |
|
2361 | if ($elm.is('option')) {
|
2362 | row.type = 'option';
|
2363 | row.group = group;
|
2364 | row.text = this.options.textTemplate($elm);
|
2365 | row.value = elm.value;
|
2366 | row.selected = elm.selected;
|
2367 | row.disabled = groupDisabled || elm.disabled;
|
2368 | row.classes = elm.getAttribute('class') || '';
|
2369 | row.title = elm.getAttribute('title');
|
2370 | return row;
|
2371 | }
|
2372 |
|
2373 | if ($elm.is('optgroup')) {
|
2374 | row.type = 'optgroup';
|
2375 | row.group = "group_".concat(i);
|
2376 | row.label = this.options.labelTemplate($elm);
|
2377 | row.disabled = elm.disabled;
|
2378 | row.children = [];
|
2379 | $.each($elm.children(), function (j, elem) {
|
2380 | row.children.push(_this3.initRow(j, elem, row.group, row.disabled));
|
2381 | });
|
2382 | return row;
|
2383 | }
|
2384 |
|
2385 | return null;
|
2386 | }
|
2387 | }, {
|
2388 | key: "initDrop",
|
2389 | value: function initDrop() {
|
2390 | var _this4 = this;
|
2391 |
|
2392 | this.initList();
|
2393 | this.events();
|
2394 | this.updateSelectAll();
|
2395 | this.update(true);
|
2396 | this.updateOptGroupSelect(true);
|
2397 |
|
2398 | if (this.options.isOpen) {
|
2399 | this.open();
|
2400 | }
|
2401 |
|
2402 | if (this.options.openOnHover) {
|
2403 | this.$parent.hover(function () {
|
2404 | _this4.open();
|
2405 | }, function () {
|
2406 | _this4.close();
|
2407 | });
|
2408 | }
|
2409 | }
|
2410 | }, {
|
2411 | key: "initList",
|
2412 | value: function initList() {
|
2413 | var _this5 = this;
|
2414 |
|
2415 | var html = [];
|
2416 |
|
2417 | if (this.options.filter) {
|
2418 | html.push("\n <div class=\"ms-search\">\n <input type=\"text\" autocomplete=\"off\" autocorrect=\"off\"\n autocapitalize=\"off\" spellcheck=\"false\"\n ".concat(sprintf(_templateObject5(), s)(this.options.filterPlaceholder), ">\n </div>\n "));
|
2419 | }
|
2420 |
|
2421 | html.push('<ul>');
|
2422 |
|
2423 | if (this.options.selectAll && !this.options.single) {
|
2424 | html.push(['<li class="ms-select-all">', '<label>', sprintf(_templateObject6(), s)(this.selectAllName), "<span>".concat(this.options.formatSelectAll(), "</span>"), '</label>', '</li>'].join(''));
|
2425 | }
|
2426 |
|
2427 | html.push(this.data.map(function (row) {
|
2428 | return _this5.initListItem(row);
|
2429 | }).join(''));
|
2430 | html.push(sprintf(_templateObject7(), s)(this.options.formatNoMatchesFound()));
|
2431 | html.push('</ul>');
|
2432 | this.$drop.html(html.join(''));
|
2433 | this.$drop.find('ul').css('max-height', "".concat(this.options.maxHeight, "px"));
|
2434 | this.$drop.find('.multiple').css('width', "".concat(this.options.multipleWidth, "px"));
|
2435 | this.$searchInput = this.$drop.find('.ms-search input');
|
2436 | this.$selectAll = this.$drop.find("input[".concat(this.selectAllName, "]"));
|
2437 | this.$selectGroups = this.$drop.find("input[".concat(this.selectGroupName, "]"));
|
2438 | this.$selectItems = this.$drop.find("input[".concat(this.selectItemName, "]:enabled"));
|
2439 | this.$disableItems = this.$drop.find("input[".concat(this.selectItemName, "]:disabled"));
|
2440 | this.$noResults = this.$drop.find('.ms-no-results');
|
2441 | }
|
2442 | }, {
|
2443 | key: "initListItem",
|
2444 | value: function initListItem(row) {
|
2445 | var _this6 = this;
|
2446 |
|
2447 | var title = sprintf(_templateObject8(), s)(row.title);
|
2448 | var multiple = this.options.multiple ? 'multiple' : '';
|
2449 | var type = this.options.single ? 'radio' : 'checkbox';
|
2450 |
|
2451 | if (row.type === 'optgroup') {
|
2452 | var html = [];
|
2453 | html.push(['<li class="group">', sprintf(_templateObject9(), s, s)(row.disabled ? 'disabled' : '', row.group), this.options.hideOptgroupCheckboxes || this.options.single ? '' : sprintf(_templateObject10(), s, s)(this.selectGroupName, row.disabled ? 'disabled="disabled"' : ''), row.label, '</label>', '</li>'].join(''));
|
2454 | html.push(row.children.map(function (child) {
|
2455 | return _this6.initListItem(child);
|
2456 | }).join(''));
|
2457 | return html.join('');
|
2458 | }
|
2459 |
|
2460 | var customStyle = this.options.styler(row.value);
|
2461 | var style = customStyle ? sprintf(_templateObject11(), s)(customStyle) : '';
|
2462 | var classes = row.classes;
|
2463 |
|
2464 | if (this.options.single && !this.options.singleRadio) {
|
2465 | classes += ' hide-radio';
|
2466 | }
|
2467 |
|
2468 | return [sprintf(_templateObject12(), s, s, s, s)(multiple, classes || '', title, style), sprintf(_templateObject13(), s)(row.disabled ? 'disabled' : ''), sprintf(_templateObject14(), s, s, s, s, s, s)(type, row.value, this.selectItemName, row.selected ? ' checked="checked"' : '', row.disabled ? ' disabled="disabled"' : '', sprintf(_templateObject15(), s)(row.group)), sprintf(_templateObject16(), s)(row.text), '</label>', '</li>'].join('');
|
2469 | }
|
2470 | }, {
|
2471 | key: "events",
|
2472 | value: function events() {
|
2473 | var _this7 = this;
|
2474 |
|
2475 | var toggleOpen = function toggleOpen(e) {
|
2476 | e.preventDefault();
|
2477 |
|
2478 | _this7[_this7.options.isOpen ? 'close' : 'open']();
|
2479 | };
|
2480 |
|
2481 | if (this.$label.length) {
|
2482 | this.$label.off('click').on('click', function (e) {
|
2483 | if (e.target.nodeName.toLowerCase() !== 'label') {
|
2484 | return;
|
2485 | }
|
2486 |
|
2487 | toggleOpen(e);
|
2488 |
|
2489 | if (!_this7.options.filter || !_this7.options.isOpen) {
|
2490 | _this7.focus();
|
2491 | }
|
2492 |
|
2493 | e.stopPropagation();
|
2494 | });
|
2495 | }
|
2496 |
|
2497 | this.$choice.off('click').on('click', toggleOpen).off('focus').on('focus', this.options.onFocus).off('blur').on('blur', this.options.onBlur);
|
2498 | this.$parent.off('keydown').on('keydown', function (e) {
|
2499 |
|
2500 | if (e.which === 27) {
|
2501 | _this7.close();
|
2502 |
|
2503 | _this7.$choice.focus();
|
2504 | }
|
2505 | });
|
2506 | this.$searchInput.off('keydown').on('keydown', function (e) {
|
2507 |
|
2508 | if (e.keyCode === 9 && e.shiftKey) {
|
2509 | _this7.close();
|
2510 | }
|
2511 | }).off('keyup').on('keyup', function (e) {
|
2512 |
|
2513 |
|
2514 | if (_this7.options.filterAcceptOnEnter && [13, 32].includes(e.which) && _this7.$searchInput.val()) {
|
2515 | _this7.$selectAll.click();
|
2516 |
|
2517 | _this7.close();
|
2518 |
|
2519 | _this7.focus();
|
2520 |
|
2521 | return;
|
2522 | }
|
2523 |
|
2524 | _this7.filter();
|
2525 | });
|
2526 | this.$selectAll.off('click').on('click', function (e) {
|
2527 | var checked = $(e.currentTarget).prop('checked');
|
2528 |
|
2529 | var $items = _this7.$selectItems.filter(':visible');
|
2530 |
|
2531 | if ($items.length === _this7.$selectItems.length) {
|
2532 | _this7[checked ? 'checkAll' : 'uncheckAll']();
|
2533 | } else {
|
2534 |
|
2535 | _this7.$selectGroups.prop('checked', checked);
|
2536 |
|
2537 | $items.prop('checked', checked);
|
2538 |
|
2539 | _this7.options[checked ? 'onCheckAll' : 'onUncheckAll']();
|
2540 |
|
2541 | _this7.update();
|
2542 | }
|
2543 | });
|
2544 | this.$selectGroups.off('click').on('click', function (e) {
|
2545 | var $this = $(e.currentTarget);
|
2546 | var group = $this.parent()[0].getAttribute('data-group');
|
2547 |
|
2548 | var $items = _this7.$selectItems.filter(':visible');
|
2549 |
|
2550 | var $children = $items.filter(sprintf(_templateObject17(), s)(group));
|
2551 | var checked = $children.length !== $children.filter(':checked').length;
|
2552 | $children.prop('checked', checked);
|
2553 |
|
2554 | _this7.updateSelectAll(true);
|
2555 |
|
2556 | _this7.update();
|
2557 |
|
2558 | _this7.options.onOptgroupClick({
|
2559 | label: $this.parent().text(),
|
2560 | checked: checked,
|
2561 | children: $children.get().map(function (el) {
|
2562 | return {
|
2563 | label: $(el).parent().text(),
|
2564 | value: $(el).val(),
|
2565 | check: $(el).prop('checked')
|
2566 | };
|
2567 | })
|
2568 | });
|
2569 | });
|
2570 | this.$selectItems.off('click').on('click', function (e) {
|
2571 | var $this = $(e.currentTarget);
|
2572 |
|
2573 | if (_this7.options.single) {
|
2574 | var clickedVal = $this.val();
|
2575 |
|
2576 | _this7.$selectItems.filter(function (i, el) {
|
2577 | return $(el).val() !== clickedVal;
|
2578 | }).each(function (i, el) {
|
2579 | $(el).prop('checked', false);
|
2580 | });
|
2581 | }
|
2582 |
|
2583 | _this7.updateSelectAll(true);
|
2584 |
|
2585 | _this7.update();
|
2586 |
|
2587 | _this7.updateOptGroupSelect();
|
2588 |
|
2589 | _this7.options.onClick({
|
2590 | label: $this.parent().text(),
|
2591 | value: $this.val(),
|
2592 | checked: $this.prop('checked')
|
2593 | });
|
2594 |
|
2595 | if (_this7.options.single && _this7.options.isOpen && !_this7.options.keepOpen) {
|
2596 | _this7.close();
|
2597 | }
|
2598 | });
|
2599 | }
|
2600 | }, {
|
2601 | key: "open",
|
2602 | value: function open() {
|
2603 | if (this.$choice.hasClass('disabled')) {
|
2604 | return;
|
2605 | }
|
2606 |
|
2607 | this.options.isOpen = true;
|
2608 | this.$choice.find('>div').addClass('open');
|
2609 | this.$drop[this.animateMethod('show')]();
|
2610 |
|
2611 | this.$selectAll.parent().show();
|
2612 | this.$noResults.hide();
|
2613 |
|
2614 | if (!this.data.length) {
|
2615 | this.$selectAll.parent().hide();
|
2616 | this.$noResults.show();
|
2617 | }
|
2618 |
|
2619 | if (this.options.container) {
|
2620 | var offset = this.$drop.offset();
|
2621 | this.$drop.appendTo($(this.options.container));
|
2622 | this.$drop.offset({
|
2623 | top: offset.top,
|
2624 | left: offset.left
|
2625 | });
|
2626 | this.$drop.outerWidth(this.$parent.outerWidth());
|
2627 | }
|
2628 |
|
2629 | if (this.data.length && this.options.filter) {
|
2630 | this.$searchInput.val('');
|
2631 | this.$searchInput.focus();
|
2632 | this.filter();
|
2633 | }
|
2634 |
|
2635 | this.options.onOpen();
|
2636 | }
|
2637 | }, {
|
2638 | key: "close",
|
2639 | value: function close() {
|
2640 | this.options.isOpen = false;
|
2641 | this.$choice.find('>div').removeClass('open');
|
2642 | this.$drop[this.animateMethod('hide')]();
|
2643 |
|
2644 | if (this.options.container) {
|
2645 | this.$parent.append(this.$drop);
|
2646 | this.$drop.css({
|
2647 | 'top': 'auto',
|
2648 | 'left': 'auto'
|
2649 | });
|
2650 | }
|
2651 |
|
2652 | this.options.onClose();
|
2653 | }
|
2654 | }, {
|
2655 | key: "animateMethod",
|
2656 | value: function animateMethod(method) {
|
2657 | var methods = {
|
2658 | show: {
|
2659 | fade: 'fadeIn',
|
2660 | slide: 'slideDown'
|
2661 | },
|
2662 | hide: {
|
2663 | fade: 'fadeOut',
|
2664 | slide: 'slideUp'
|
2665 | }
|
2666 | };
|
2667 | return methods[method][this.options.animate] || method;
|
2668 | }
|
2669 | }, {
|
2670 | key: "update",
|
2671 | value: function update(ignoreTrigger) {
|
2672 | var valueSelects = this.getSelects();
|
2673 | var textSelects = this.options.displayValues ? valueSelects : this.getSelects('text');
|
2674 | var $span = this.$choice.find('>span');
|
2675 | var sl = valueSelects.length;
|
2676 | var html = '';
|
2677 |
|
2678 | if (sl === 0) {
|
2679 | $span.addClass('placeholder').html(this.options.placeholder);
|
2680 | } else if (sl < this.options.minimumCountSelected) {
|
2681 | html = textSelects.join(this.options.displayDelimiter);
|
2682 | } else if (this.options.formatAllSelected() && sl === this.$selectItems.length + this.$disableItems.length) {
|
2683 | html = this.options.formatAllSelected();
|
2684 | } else if (this.options.ellipsis && sl > this.options.minimumCountSelected) {
|
2685 | html = "".concat(textSelects.slice(0, this.options.minimumCountSelected).join(this.options.displayDelimiter), "...");
|
2686 | } else if (this.options.formatCountSelected() && sl > this.options.minimumCountSelected) {
|
2687 | html = this.options.formatCountSelected(sl, this.$selectItems.length + this.$disableItems.length);
|
2688 | } else {
|
2689 | html = textSelects.join(this.options.displayDelimiter);
|
2690 | }
|
2691 |
|
2692 | if (html) {
|
2693 | $span.removeClass('placeholder').html(html);
|
2694 | }
|
2695 |
|
2696 | if (this.options.displayTitle) {
|
2697 | $span.prop('title', this.getSelects('text'));
|
2698 | }
|
2699 |
|
2700 |
|
2701 | this.$el.val(this.getSelects());
|
2702 |
|
2703 | this.$drop.find('li').removeClass('selected');
|
2704 | this.$drop.find('input:checked').each(function (i, el) {
|
2705 | $(el).parents('li').first().addClass('selected');
|
2706 | });
|
2707 |
|
2708 | if (!ignoreTrigger) {
|
2709 | this.$el.trigger('change');
|
2710 | }
|
2711 | }
|
2712 | }, {
|
2713 | key: "updateSelectAll",
|
2714 | value: function updateSelectAll(triggerEvent) {
|
2715 | var $items = this.$selectItems.filter(':visible');
|
2716 |
|
2717 | if (!$items.length) {
|
2718 | return;
|
2719 | }
|
2720 |
|
2721 | var selectedLength = $items.filter(':checked').length;
|
2722 | this.$selectAll.prop('checked', selectedLength === $items.length);
|
2723 |
|
2724 | if (triggerEvent) {
|
2725 | if (selectedLength === $items.length) {
|
2726 | this.options.onCheckAll();
|
2727 | } else if (selectedLength === 0) {
|
2728 | this.options.onUncheckAll();
|
2729 | }
|
2730 | }
|
2731 | }
|
2732 | }, {
|
2733 | key: "updateOptGroupSelect",
|
2734 | value: function updateOptGroupSelect(isInit) {
|
2735 | var $items = this.$selectItems;
|
2736 |
|
2737 | if (!isInit) {
|
2738 | $items = $items.filter(':visible');
|
2739 | }
|
2740 |
|
2741 | $.each(this.$selectGroups, function (i, val) {
|
2742 | var group = $(val).parent()[0].getAttribute('data-group');
|
2743 | var $children = $items.filter(sprintf(_templateObject18(), s)(group));
|
2744 | $(val).prop('checked', $children.length && $children.length === $children.filter(':checked').length);
|
2745 | });
|
2746 | }
|
2747 | }, {
|
2748 | key: "getOptions",
|
2749 | value: function getOptions() {
|
2750 |
|
2751 | var options = $.extend({}, this.options);
|
2752 | delete options.data;
|
2753 | return $.extend(true, {}, options);
|
2754 | }
|
2755 | }, {
|
2756 | key: "refreshOptions",
|
2757 | value: function refreshOptions(options) {
|
2758 |
|
2759 | if (compareObjects(this.options, options, true)) {
|
2760 | return;
|
2761 | }
|
2762 |
|
2763 | this.options = $.extend(this.options, options);
|
2764 | this.destroy();
|
2765 | this.init();
|
2766 | }
|
2767 |
|
2768 | }, {
|
2769 | key: "getSelects",
|
2770 | value: function getSelects(type) {
|
2771 | var _this8 = this;
|
2772 |
|
2773 | var texts = [];
|
2774 | var values = [];
|
2775 | this.$drop.find(sprintf(_templateObject19(), s)(this.selectItemName)).each(function (i, el) {
|
2776 | texts.push($(el).parents('li').first().text());
|
2777 | values.push($(el).val());
|
2778 | });
|
2779 |
|
2780 | if (type === 'text' && this.$selectGroups.length) {
|
2781 | texts = [];
|
2782 | this.$selectGroups.each(function (i, el) {
|
2783 | var html = [];
|
2784 | var text = $.trim($(el).parent().text());
|
2785 | var group = $(el).parent().data('group');
|
2786 |
|
2787 | var $children = _this8.$drop.find(sprintf(_templateObject20(), s, s)(_this8.selectItemName, group));
|
2788 |
|
2789 | var $selected = $children.filter(':checked');
|
2790 |
|
2791 | if (!$selected.length) {
|
2792 | return;
|
2793 | }
|
2794 |
|
2795 | html.push('[');
|
2796 | html.push(text);
|
2797 |
|
2798 | if ($children.length > $selected.length) {
|
2799 | var list = [];
|
2800 | $selected.each(function (j, elem) {
|
2801 | list.push($(elem).parent().text());
|
2802 | });
|
2803 | html.push(": ".concat(list.join(', ')));
|
2804 | }
|
2805 |
|
2806 | html.push(']');
|
2807 | texts.push(html.join(''));
|
2808 | });
|
2809 | }
|
2810 |
|
2811 | return type === 'text' ? texts : values;
|
2812 | }
|
2813 | }, {
|
2814 | key: "setSelects",
|
2815 | value: function setSelects(values) {
|
2816 | var _this9 = this;
|
2817 |
|
2818 | this.$selectItems.prop('checked', false);
|
2819 | this.$disableItems.prop('checked', false);
|
2820 | $.each(values, function (i, value) {
|
2821 | _this9.$selectItems.filter(sprintf(_templateObject21(), s)(value)).prop('checked', true);
|
2822 |
|
2823 | _this9.$disableItems.filter(sprintf(_templateObject22(), s)(value)).prop('checked', true);
|
2824 | });
|
2825 | this.$selectAll.prop('checked', this.$selectItems.length === this.$selectItems.filter(':checked').length + this.$disableItems.filter(':checked').length);
|
2826 | $.each(this.$selectGroups, function (i, val) {
|
2827 | var group = $(val).parent()[0].getAttribute('data-group');
|
2828 |
|
2829 | var $children = _this9.$selectItems.filter("[data-group=\"".concat(group, "\"]"));
|
2830 |
|
2831 | $(val).prop('checked', $children.length && $children.length === $children.filter(':checked').length);
|
2832 | });
|
2833 | this.update(false);
|
2834 | }
|
2835 | }, {
|
2836 | key: "enable",
|
2837 | value: function enable() {
|
2838 | this.$choice.removeClass('disabled');
|
2839 | }
|
2840 | }, {
|
2841 | key: "disable",
|
2842 | value: function disable() {
|
2843 | this.$choice.addClass('disabled');
|
2844 | }
|
2845 | }, {
|
2846 | key: "checkAll",
|
2847 | value: function checkAll() {
|
2848 | this.$selectItems.prop('checked', true);
|
2849 | this.$selectGroups.prop('checked', true);
|
2850 | this.$selectAll.prop('checked', true);
|
2851 | this.update();
|
2852 | this.options.onCheckAll();
|
2853 | }
|
2854 | }, {
|
2855 | key: "uncheckAll",
|
2856 | value: function uncheckAll() {
|
2857 | this.$selectItems.prop('checked', false);
|
2858 | this.$selectGroups.prop('checked', false);
|
2859 | this.$selectAll.prop('checked', false);
|
2860 | this.update();
|
2861 | this.options.onUncheckAll();
|
2862 | }
|
2863 | }, {
|
2864 | key: "focus",
|
2865 | value: function focus() {
|
2866 | this.$choice.focus();
|
2867 | this.options.onFocus();
|
2868 | }
|
2869 | }, {
|
2870 | key: "blur",
|
2871 | value: function blur() {
|
2872 | this.$choice.blur();
|
2873 | this.options.onBlur();
|
2874 | }
|
2875 | }, {
|
2876 | key: "refresh",
|
2877 | value: function refresh() {
|
2878 | this.init();
|
2879 | }
|
2880 | }, {
|
2881 | key: "filter",
|
2882 | value: function filter() {
|
2883 | var _this10 = this;
|
2884 |
|
2885 | var text = $.trim(this.$searchInput.val()).toLowerCase();
|
2886 |
|
2887 | if (text.length === 0) {
|
2888 | this.$selectAll.closest('li').show();
|
2889 | this.$selectItems.closest('li').show();
|
2890 | this.$disableItems.closest('li').show();
|
2891 | this.$selectGroups.closest('li').show();
|
2892 | this.$noResults.hide();
|
2893 | } else {
|
2894 | if (!this.options.filterGroup) {
|
2895 | this.$selectItems.each(function (i, el) {
|
2896 | var $parent = $(el).parent();
|
2897 | var hasText = removeDiacritics($parent.text().toLowerCase()).includes(removeDiacritics(text));
|
2898 | $parent.closest('li')[hasText ? 'show' : 'hide']();
|
2899 | });
|
2900 | }
|
2901 |
|
2902 | this.$disableItems.closest('li').hide();
|
2903 | this.$selectGroups.each(function (i, el) {
|
2904 | var $parent = $(el).parent();
|
2905 | var group = $parent[0].getAttribute('data-group');
|
2906 |
|
2907 | if (_this10.options.filterGroup) {
|
2908 | var hasText = removeDiacritics($parent.text().toLowerCase()).includes(removeDiacritics(text));
|
2909 | var func = hasText ? 'show' : 'hide';
|
2910 | $parent.closest('li')[func]();
|
2911 |
|
2912 | _this10.$selectItems.filter("[data-group=\"".concat(group, "\"]")).closest('li')[func]();
|
2913 | } else {
|
2914 | var $items = _this10.$selectItems.filter(':visible');
|
2915 |
|
2916 | var _hasText = $items.filter(sprintf(_templateObject23(), s)(group)).length;
|
2917 | $parent.closest('li')[_hasText ? 'show' : 'hide']();
|
2918 | }
|
2919 | });
|
2920 |
|
2921 | if (this.$selectItems.closest('li').filter(':visible').length) {
|
2922 | this.$selectAll.closest('li').show();
|
2923 | this.$noResults.hide();
|
2924 | } else {
|
2925 | this.$selectAll.closest('li').hide();
|
2926 | this.$noResults.show();
|
2927 | }
|
2928 | }
|
2929 |
|
2930 | this.updateOptGroupSelect();
|
2931 | this.updateSelectAll();
|
2932 | this.options.onFilter(text);
|
2933 | }
|
2934 | }, {
|
2935 | key: "destroy",
|
2936 | value: function destroy() {
|
2937 | if (!this.$parent) {
|
2938 | return;
|
2939 | }
|
2940 |
|
2941 | this.$el.before(this.$parent).show();
|
2942 | this.$parent.remove();
|
2943 | }
|
2944 | }]);
|
2945 |
|
2946 | return MultipleSelect;
|
2947 | }();
|
2948 |
|
2949 | $.fn.multipleSelect = function (option) {
|
2950 | for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
2951 | args[_key - 1] = arguments[_key];
|
2952 | }
|
2953 |
|
2954 | var value;
|
2955 | this.each(function (i, el) {
|
2956 | var $this = $(el);
|
2957 | var data = $this.data('multipleSelect');
|
2958 | var options = $.extend({}, $this.data(), _typeof(option) === 'object' && option);
|
2959 |
|
2960 | if (!data) {
|
2961 | data = new MultipleSelect($this, options);
|
2962 | $this.data('multipleSelect', data);
|
2963 | }
|
2964 |
|
2965 | if (typeof option === 'string') {
|
2966 | var _data;
|
2967 |
|
2968 | if ($.inArray(option, Constants.METHODS) < 0) {
|
2969 | throw new Error("Unknown method: ".concat(option));
|
2970 | }
|
2971 |
|
2972 | value = (_data = data)[option].apply(_data, args);
|
2973 |
|
2974 | if (option === 'destroy') {
|
2975 | $this.removeData('multipleSelect');
|
2976 | }
|
2977 | } else {
|
2978 | data.init();
|
2979 | }
|
2980 | });
|
2981 | return typeof value !== 'undefined' ? value : this;
|
2982 | };
|
2983 |
|
2984 | $.fn.multipleSelect.defaults = Constants.DEFAULTS;
|
2985 | $.fn.multipleSelect.locales = Constants.LOCALES;
|
2986 | $.fn.multipleSelect.methods = Constants.METHODS;
|
2987 |
|
2988 | }));
|