|
425 | 425 | };
|
426 | 426 |
|
427 | 427 | var DIACRITICS = {
|
428 |
| - 'a': '[aÀÁÂÃÄÅàáâãäå]', |
| 428 | + 'a': '[aÀÁÂÃÄÅàáâãäåĀā]', |
429 | 429 | 'c': '[cÇçćĆčČ]',
|
430 | 430 | 'd': '[dđĐďĎ]',
|
431 |
| - 'e': '[eÈÉÊËèéêëěĚ]', |
432 |
| - 'i': '[iÌÍÎÏìíîï]', |
| 431 | + 'e': '[eÈÉÊËèéêëěĚĒē]', |
| 432 | + 'i': '[iÌÍÎÏìíîïĪī]', |
433 | 433 | 'n': '[nÑñňŇ]',
|
434 |
| - 'o': '[oÒÓÔÕÕÖØòóôõöø]', |
| 434 | + 'o': '[oÒÓÔÕÕÖØòóôõöøŌō]', |
435 | 435 | 'r': '[rřŘ]',
|
436 | 436 | 's': '[sŠš]',
|
437 | 437 | 't': '[tťŤ]',
|
438 |
| - 'u': '[uÙÚÛÜùúûüůŮ]', |
| 438 | + 'u': '[uÙÚÛÜùúûüůŮŪū]', |
439 | 439 | 'y': '[yŸÿýÝ]',
|
440 | 440 | 'z': '[zŽž]'
|
441 | 441 | };
|
|
585 | 585 | }));
|
586 | 586 |
|
587 | 587 | /**
|
588 |
| - * selectize.js (v0.10.1) |
| 588 | + * selectize.js (v0.11.0) |
589 | 589 | * Copyright (c) 2013 Brian Reavis & contributors
|
590 | 590 | *
|
591 | 591 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
|
|
726 | 726 | * 1 -> '1'
|
727 | 727 | *
|
728 | 728 | * @param {string} value
|
729 |
| - * @returns {string} |
| 729 | + * @returns {string|null} |
730 | 730 | */
|
731 | 731 | var hash_key = function(value) {
|
732 |
| - if (typeof value === 'undefined' || value === null) return ''; |
| 732 | + if (typeof value === 'undefined' || value === null) return null; |
733 | 733 | if (typeof value === 'boolean') return value ? '1' : '0';
|
734 | 734 | return value + '';
|
735 | 735 | };
|
|
1668 | 1668 | self.createItem();
|
1669 | 1669 | } else {
|
1670 | 1670 | value = $target.attr('data-value');
|
1671 |
| - if (value) { |
| 1671 | + if (typeof value !== 'undefined') { |
1672 | 1672 | self.lastQuery = null;
|
1673 | 1673 | self.setTextboxValue('');
|
1674 | 1674 | self.addItem(value);
|
|
2159 | 2159 | }
|
2160 | 2160 |
|
2161 | 2161 | value = hash_key(data[self.settings.valueField]);
|
2162 |
| - if (!value || self.options.hasOwnProperty(value)) return; |
| 2162 | + if (typeof value !== 'string' || self.options.hasOwnProperty(value)) return; |
2163 | 2163 |
|
2164 | 2164 | self.userOptions[value] = true;
|
2165 | 2165 | self.options[value] = data;
|
|
2196 | 2196 | value_new = hash_key(data[self.settings.valueField]);
|
2197 | 2197 |
|
2198 | 2198 | // sanity checks
|
| 2199 | + if (value === null) return; |
2199 | 2200 | if (!self.options.hasOwnProperty(value)) return;
|
2200 |
| - if (!value_new) throw new Error('Value must be set in option data'); |
| 2201 | + if (typeof value_new !== 'string') throw new Error('Value must be set in option data'); |
2201 | 2202 |
|
2202 | 2203 | // update references
|
2203 | 2204 | if (value_new !== value) {
|
|
2309 | 2310 | getElementWithValue: function(value, $els) {
|
2310 | 2311 | value = hash_key(value);
|
2311 | 2312 |
|
2312 |
| - if (value) { |
| 2313 | + if (typeof value !== 'undefined' && value !== null) { |
2313 | 2314 | for (var i = 0, n = $els.length; i < n; i++) {
|
2314 | 2315 | if ($els[i].getAttribute('data-value') === value) {
|
2315 | 2316 | return $($els[i]);
|
|
2475 | 2476 |
|
2476 | 2477 | if (!data || typeof data !== 'object') return;
|
2477 | 2478 | var value = hash_key(data[self.settings.valueField]);
|
2478 |
| - if (!value) return; |
| 2479 | + if (typeof value !== 'string') return; |
2479 | 2480 |
|
2480 | 2481 | self.setTextboxValue('');
|
2481 | 2482 | self.addOption(data);
|
|
3014 | 3015 | addPrecedence: false,
|
3015 | 3016 | selectOnTab: false,
|
3016 | 3017 | preload: false,
|
| 3018 | + allowEmptyOption: false, |
3017 | 3019 |
|
3018 | 3020 | scrollDuration: 60,
|
3019 | 3021 | loadThrottle: 300,
|
|
3084 | 3086 | */
|
3085 | 3087 | var init_textbox = function($input, settings_element) {
|
3086 | 3088 | var i, n, values, option, value = $.trim($input.val() || '');
|
3087 |
| - if (!value.length) return; |
| 3089 | + if (!settings.allowEmptyOption && !value.length) return; |
3088 | 3090 |
|
3089 | 3091 | values = value.split(settings.delimiter);
|
3090 | 3092 | for (i = 0, n = values.length; i < n; i++) {
|
|
3122 | 3124 | $option = $($option);
|
3123 | 3125 |
|
3124 | 3126 | value = $option.attr('value') || '';
|
3125 |
| - if (!value.length) return; |
| 3127 | + if (!value.length && !settings.allowEmptyOption) return; |
3126 | 3128 |
|
3127 | 3129 | // if the option already exists, it's probably been
|
3128 | 3130 | // duplicated in another optgroup. in this case, push
|
|
3192 | 3194 | var instance;
|
3193 | 3195 | var $input = $(this);
|
3194 | 3196 | var tag_name = this.tagName.toLowerCase();
|
| 3197 | + var placeholder = $input.attr('placeholder') || $input.attr('data-placeholder'); |
| 3198 | + if (!placeholder && !settings.allowEmptyOption) { |
| 3199 | + placeholder = $input.children('option[value=""]').text(); |
| 3200 | + } |
| 3201 | + |
3195 | 3202 | var settings_element = {
|
3196 |
| - 'placeholder' : $input.children('option[value=""]').text() || $input.attr('placeholder'), |
| 3203 | + 'placeholder' : placeholder, |
3197 | 3204 | 'options' : {},
|
3198 | 3205 | 'optgroups' : {},
|
3199 | 3206 | 'items' : []
|
|
0 commit comments