diff --git a/dist/css/tom-select.bootstrap3.css b/dist/css/tom-select.bootstrap3.css index 3c93d5d4..65d5721b 100644 --- a/dist/css/tom-select.bootstrap3.css +++ b/dist/css/tom-select.bootstrap3.css @@ -1,5 +1,5 @@ /** - * tom-select.css (v1.0.0-rc.3) + * tom-select.css (v1.0.0) * Copyright (c) contributors * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this diff --git a/dist/css/tom-select.bootstrap4.css b/dist/css/tom-select.bootstrap4.css index b438f4de..0b2a3d8f 100644 --- a/dist/css/tom-select.bootstrap4.css +++ b/dist/css/tom-select.bootstrap4.css @@ -2,7 +2,7 @@ * Tom Select bootstrap 4 */ /** - * tom-select.css (v1.0.0-rc.3) + * tom-select.css (v1.0.0) * Copyright (c) contributors * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this diff --git a/dist/css/tom-select.css b/dist/css/tom-select.css index df0ec1ab..34d959c5 100644 --- a/dist/css/tom-select.css +++ b/dist/css/tom-select.css @@ -1,5 +1,5 @@ /** - * tom-select.css (v1.0.0-rc.3) + * tom-select.css (v1.0.0) * Copyright (c) contributors * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this diff --git a/dist/css/tom-select.default.css b/dist/css/tom-select.default.css index 4a6f859b..1f4d082a 100644 --- a/dist/css/tom-select.default.css +++ b/dist/css/tom-select.default.css @@ -1,5 +1,5 @@ /** - * tom-select.css (v1.0.0-rc.3) + * tom-select.css (v1.0.0) * Copyright (c) contributors * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this diff --git a/dist/js/plugins/change_listener.js b/dist/js/plugins/change_listener.js index e2544ab6..34aaf36b 100644 --- a/dist/js/plugins/change_listener.js +++ b/dist/js/plugins/change_listener.js @@ -1,12 +1,12 @@ /** -* Tom Select v1.0.0-rc.3 +* Tom Select v1.0.0 * Licensed under the Apache License, Version 2.0 (the "License"); */ (function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('../../tom-select.js')) : + typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('../../tom-select.js')) : typeof define === 'function' && define.amd ? define(['../../tom-select.js'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.change_listener = factory(global.TomSelect)); + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TomSelect)); }(this, (function (TomSelect) { 'use strict'; function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } @@ -285,7 +285,7 @@ * governing permissions and limitations under the License. * */ - var plugin = TomSelect__default['default'].define('change_listener', function (options) { + TomSelect__default['default'].define('change_listener', function (options) { var self = this; var changed = false; self.input.addEventListener('change', function () { @@ -302,7 +302,5 @@ }); }); - return plugin; - }))); //# sourceMappingURL=change_listener.js.map diff --git a/dist/js/plugins/change_listener.js.map b/dist/js/plugins/change_listener.js.map index 4c3dbbb0..b6aca951 100644 --- a/dist/js/plugins/change_listener.js.map +++ b/dist/js/plugins/change_listener.js.map @@ -1 +1 @@ -{"version":3,"file":"change_listener.js","sources":["../../../src/defaults.js","../../../src/utils.js","../../../src/settings.js","../../../src/plugins/change_listener/plugin.js"],"sourcesContent":["\nexport default {\n\toptions: [],\n\toptgroups: [],\n\n\tplugins: [],\n\tdelimiter: ',',\n\tsplitOn: null, // regexp or string for splitting up values from a paste command\n\tpersist: true,\n\tdiacritics: true,\n\tcreate: false,\n\tcreateOnBlur: false,\n\tcreateFilter: null,\n\thighlight: true,\n\topenOnFocus: true,\n\tmaxOptions: 50,\n\tmaxItems: null,\n\thideSelected: null,\n\tduplicates: false,\n\taddPrecedence: false,\n\tselectOnTab: false,\n\tpreload: false,\n\tallowEmptyOption: false,\n\tcloseAfterSelect: false,\n\n\tscrollDuration: 60,\n\tloadThrottle: 300,\n\tloadingClass: 'loading',\n\n\tdataAttr: null, //'data-data',\n\toptgroupField: 'optgroup',\n\tvalueField: 'value',\n\tlabelField: 'text',\n\tdisabledField: 'disabled',\n\toptgroupLabelField: 'label',\n\toptgroupValueField: 'value',\n\tlockOptgroupOrder: false,\n\n\tsortField: '$order',\n\tsearchField: ['text'],\n\tsearchConjunction: 'and',\n\n\tmode: null,\n\twrapperClass: 'ts-control',\n\tinputClass: 'ts-input',\n\tdropdownClass: 'ts-dropdown',\n\tdropdownContentClass: 'ts-dropdown-content',\n\titemClass: 'item',\n\toptionClass: 'option',\n\n\tdropdownParent: null,\n\tcontrolInput: null,\n\n\tcopyClassesToDropdown: true,\n\n\t/*\n\tload : null, // function(query, callback) { ... }\n\tscore : null, // function(search) { ... }\n\tonInitialize : null, // function() { ... }\n\tonChange : null, // function(value) { ... }\n\tonItemAdd : null, // function(value, $item) { ... }\n\tonItemRemove : null, // function(value) { ... }\n\tonClear : null, // function() { ... }\n\tonOptionAdd : null, // function(value, data) { ... }\n\tonOptionRemove : null, // function(value) { ... }\n\tonOptionClear : null, // function() { ... }\n\tonOptionGroupAdd : null, // function(id, data) { ... }\n\tonOptionGroupRemove : null, // function(id) { ... }\n\tonOptionGroupClear : null, // function() { ... }\n\tonDropdownOpen : null, // function(dropdown) { ... }\n\tonDropdownClose : null, // function(dropdown) { ... }\n\tonType : null, // function(str) { ... }\n\tonDelete : null, // function(values) { ... }\n\t*/\n\n\trender: {\n\t\t/*\n\t\titem: null,\n\t\toptgroup: null,\n\t\toptgroup_header: null,\n\t\toption: null,\n\t\toption_create: null\n\t\t*/\n\t}\n};\n","\n\n/**\n * Converts a scalar to its best string representation\n * for hash keys and HTML attribute values.\n *\n * Transformations:\n * 'str' -> 'str'\n * null -> ''\n * undefined -> ''\n * true -> '1'\n * false -> '0'\n * 0 -> '0'\n * 1 -> '1'\n *\n * @param {string} value\n * @returns {string|null}\n */\nexport function hash_key(value) {\n\tif (typeof value === 'undefined' || value === null) return null;\n\tif (typeof value === 'boolean') return value ? '1' : '0';\n\treturn value + '';\n};\n\n/**\n * Escapes a string for use within HTML.\n *\n * @param {string} str\n * @returns {string}\n */\nexport function escape_html(str) {\n\treturn (str + '')\n\t\t.replace(/&/g, '&')\n\t\t.replace(//g, '>')\n\t\t.replace(/\"/g, '"');\n};\n\n\n/**\n * Debounce all fired events types listed in `types`\n * while executing the provided `fn`.\n *\n * @param {object} self\n * @param {array} types\n * @param {function} fn\n */\nexport function debounce_events( self, types, fn) {\n\tvar type;\n\tvar trigger = self.trigger;\n\tvar event_args = {};\n\n\t// override trigger method\n\tself.trigger = function() {\n\t\tvar type = arguments[0];\n\t\tif (types.indexOf(type) !== -1) {\n\t\t\tevent_args[type] = arguments;\n\t\t} else {\n\t\t\treturn trigger.apply(self, arguments);\n\t\t}\n\t};\n\n\t// invoke provided function\n\tfn.apply(self, []);\n\tself.trigger = trigger;\n\n\t// trigger queued events\n\tfor (type in event_args) {\n\t\tif (event_args.hasOwnProperty(type)) {\n\t\t\ttrigger.apply(self, event_args[type]);\n\t\t}\n\t}\n};\n\n\n/**\n * Determines the current selection within a text input control.\n * Returns an object containing:\n * - start\n * - length\n *\n * @param {object} input\n * @returns {object}\n */\nexport function getSelection(input) {\n\treturn {\n\t\tstart\t: input.selectionStart,\n\t\tlength\t: input.selectionEnd - input.selectionStart,\n\t};\n};\n","import defaults from './defaults.js';\nimport { hash_key } from './utils.js';\n\nexport default function getSettings( input, settings_user){\n\tvar settings\t\t\t\t= Object.assign({}, defaults, settings_user);\n\n\tvar attr_data\t\t\t\t= settings.dataAttr;\n\tvar field_label\t\t\t\t= settings.labelField;\n\tvar field_value\t\t\t\t= settings.valueField;\n\tvar field_disabled\t\t\t= settings.disabledField;\n\tvar field_optgroup\t\t\t= settings.optgroupField;\n\tvar field_optgroup_label\t= settings.optgroupLabelField;\n\tvar field_optgroup_value\t= settings.optgroupValueField;\n\n\tvar tag_name\t\t\t\t= input.tagName.toLowerCase();\n\tvar placeholder\t\t\t\t= input.getAttribute('placeholder') || input.getAttribute('data-placeholder');\n\n\tif (!placeholder && !settings.allowEmptyOption) {\n\t\tlet option\t\t= input.querySelector('option[value=\"\"]');\n\t\tif( option ){\n\t\t\tplaceholder = option.textContent;\n\t\t}\n\n\t}\n\n\tvar settings_element\t\t= {\n\t\t\t\t\t\t\t\t\t\t'placeholder' : placeholder,\n\t\t\t\t\t\t\t\t\t\t'options' : [],\n\t\t\t\t\t\t\t\t\t\t'optgroups' : [],\n\t\t\t\t\t\t\t\t\t\t'items' : []\n\t\t\t\t\t\t\t\t\t};\n\n\n\t/**\n\t * Initialize from a element.\n\t *\n\t */\n\tvar init_textbox = function(){\n\t\tvar i, n, values, option;\n\n\t\tvar data_raw = input.getAttribute(attr_data);\n\n\t\tif (!data_raw) {\n\t\t\tvar value = input.value.trim() || '';\n\t\t\tif (!settings.allowEmptyOption && !value.length) return;\n\t\t\tvalues = value.split(settings.delimiter);\n\t\t\tfor (i = 0, n = values.length; i < n; i++) {\n\t\t\t\toption = {};\n\t\t\t\toption[field_label] = values[i];\n\t\t\t\toption[field_value] = values[i];\n\t\t\t\tsettings_element.options.push(option);\n\t\t\t}\n\t\t\tsettings_element.items = values;\n\t\t} else {\n\t\t\tsettings_element.options = JSON.parse(data_raw);\n\t\t\tfor (i = 0, n = settings_element.options.length; i < n; i++) {\n\t\t\t\tsettings_element.items.push(settings_element.options[i][field_value]);\n\t\t\t}\n\t\t}\n\t};\n\n\n\tif (tag_name === 'select') {\n\t\tinit_select();\n\t} else {\n\t\tinit_textbox();\n\t}\n\n\treturn Object.assign( {}, defaults, settings_element, settings_user);\n};\n","/**\n * Plugin: \"change_listener\" (Tom Select)\n * Copyright (c) contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this\n * file except in compliance with the License. You may obtain a copy of the License at:\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n * ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n *\n */\n\nimport TomSelect from '../../tom-select.js';\nimport getSettings from '../../settings.js';\n\nexport default TomSelect.define('change_listener',function(options){\n\tvar self\t\t= this;\n\tvar changed\t\t= false;\n\n\tself.input.addEventListener('change',function(){\n\n\t\t// prevent infinite loops\n\t\tif( changed ){\n\t\t\tchanged = false;\n\t\t\treturn;\n\t\t}\n\n\t\tchanged\t\t\t= true;\n\t\tvar settings\t= getSettings( self.input, {} );\n\n\t\tself.setupOptions(settings.options,settings.optgroups);\n\t\tself.setValue(settings.items);\n\t});\n\n});\n"],"names":["options","optgroups","plugins","delimiter","splitOn","persist","diacritics","create","createOnBlur","createFilter","highlight","openOnFocus","maxOptions","maxItems","hideSelected","duplicates","addPrecedence","selectOnTab","preload","allowEmptyOption","closeAfterSelect","scrollDuration","loadThrottle","loadingClass","dataAttr","optgroupField","valueField","labelField","disabledField","optgroupLabelField","optgroupValueField","lockOptgroupOrder","sortField","searchField","searchConjunction","mode","wrapperClass","inputClass","dropdownClass","dropdownContentClass","itemClass","optionClass","dropdownParent","controlInput","copyClassesToDropdown","render","hash_key","value","getSettings","input","settings_user","settings","Object","assign","defaults","attr_data","field_label","field_value","field_disabled","field_optgroup","field_optgroup_label","field_optgroup_value","tag_name","tagName","toLowerCase","placeholder","getAttribute","option","querySelector","textContent","settings_element","init_select","i","n","children","optionsMap","readData","el","data","dataset","json","length","JSON","parse","addOption","group","hasOwnProperty","arr","Array","isArray","push","option_data","disabled","selected","items","addGroup","optgroup","id","optgroup_data","hasAttribute","init_textbox","values","data_raw","trim","split","TomSelect","define","self","changed","addEventListener","setupOptions","setValue"],"mappings":";;;;;;;;;;;;;;;AACA,gBAAe;CACdA,EAAAA,OAAO,EAAE,EADK;CAEdC,EAAAA,SAAS,EAAE,EAFG;CAIdC,EAAAA,OAAO,EAAE,EAJK;CAKdC,EAAAA,SAAS,EAAE,GALG;CAMdC,EAAAA,OAAO,EAAE,IANK;CAMC;CACfC,EAAAA,OAAO,EAAE,IAPK;CAQdC,EAAAA,UAAU,EAAE,IARE;CASdC,EAAAA,MAAM,EAAE,KATM;CAUdC,EAAAA,YAAY,EAAE,KAVA;CA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AAuBJ,IAAvB,CAA4BpB,gBAAgB,CAACtE,OAAjB,CAAyBwE,CAAzB,EAA4Bf,WAA5B,CAA5B;CACA;CACD;CACD,GAtBD;;CAyBA,MAAIK,QAAQ,KAAK,QAAjB,EAA2B;CAC1BS,IAAAA,WAAW;CACX,GAFD,MAEO;CACN6B,IAAAA,YAAY;CACZ;;CAED,SAAOhD,MAAM,CAACC,MAAP,CAAe,EAAf,EAAmBC,QAAnB,EAA6BgB,gBAA7B,EAA+CpB,aAA/C,CAAP;CACA;;CChKD;;;;;;;;;;;;;;AAkBA,cAAeuD,6BAAS,CAACC,MAAV,CAAiB,iBAAjB,EAAmC,UAAS1G,OAAT,EAAiB;CAClE,MAAI2G,IAAI,GAAI,IAAZ;CACA,MAAIC,OAAO,GAAI,KAAf;CAEAD,EAAAA,IAAI,CAAC1D,KAAL,CAAW4D,gBAAX,CAA4B,QAA5B,EAAqC,YAAU;CAE9C;CACA,QAAID,OAAJ,EAAa;CACZA,MAAAA,OAAO,GAAG,KAAV;CACA;CACA;;CAEDA,IAAAA,OAAO,GAAK,IAAZ;CACA,QAAIzD,QAAQ,GAAGH,WAAW,CAAE2D,IAAI,CAAC1D,KAAP,EAAc,EAAd,CAA1B;CAEA0D,IAAAA,IAAI,CAACG,YAAL,CAAkB3D,QAAQ,CAACnD,OAA3B,EAAmCmD,QAAQ,CAAClD,SAA5C;CACA0G,IAAAA,IAAI,CAACI,QAAL,CAAc5D,QAAQ,CAAC2C,KAAvB;CACA,GAbD;CAeA,CAnBc,CAAf;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"change_listener.js","sources":["../../../src/defaults.js","../../../src/utils.js","../../../src/settings.js","../../../src/plugins/change_listener/plugin.js"],"sourcesContent":["\nexport default {\n\toptions: [],\n\toptgroups: [],\n\n\tplugins: [],\n\tdelimiter: ',',\n\tsplitOn: null, // regexp or string for splitting up values from a paste command\n\tpersist: true,\n\tdiacritics: true,\n\tcreate: false,\n\tcreateOnBlur: false,\n\tcreateFilter: null,\n\thighlight: true,\n\topenOnFocus: true,\n\tmaxOptions: 50,\n\tmaxItems: null,\n\thideSelected: null,\n\tduplicates: false,\n\taddPrecedence: false,\n\tselectOnTab: false,\n\tpreload: false,\n\tallowEmptyOption: false,\n\tcloseAfterSelect: false,\n\n\tscrollDuration: 60,\n\tloadThrottle: 300,\n\tloadingClass: 'loading',\n\n\tdataAttr: null, //'data-data',\n\toptgroupField: 'optgroup',\n\tvalueField: 'value',\n\tlabelField: 'text',\n\tdisabledField: 'disabled',\n\toptgroupLabelField: 'label',\n\toptgroupValueField: 'value',\n\tlockOptgroupOrder: false,\n\n\tsortField: '$order',\n\tsearchField: ['text'],\n\tsearchConjunction: 'and',\n\n\tmode: null,\n\twrapperClass: 'ts-control',\n\tinputClass: 'ts-input',\n\tdropdownClass: 'ts-dropdown',\n\tdropdownContentClass: 'ts-dropdown-content',\n\titemClass: 'item',\n\toptionClass: 'option',\n\n\tdropdownParent: null,\n\tcontrolInput: null,\n\n\tcopyClassesToDropdown: true,\n\n\t/*\n\tload : null, // function(query, callback) { ... }\n\tscore : null, // function(search) { ... }\n\tonInitialize : null, // function() { ... }\n\tonChange : null, // function(value) { ... }\n\tonItemAdd : null, // function(value, $item) { ... }\n\tonItemRemove : null, // function(value) { ... }\n\tonClear : null, // function() { ... }\n\tonOptionAdd : null, // function(value, data) { ... }\n\tonOptionRemove : null, // function(value) { ... }\n\tonOptionClear : null, // function() { ... }\n\tonOptionGroupAdd : null, // function(id, data) { ... }\n\tonOptionGroupRemove : null, // function(id) { ... }\n\tonOptionGroupClear : null, // function() { ... }\n\tonDropdownOpen : null, // function(dropdown) { ... }\n\tonDropdownClose : null, // function(dropdown) { ... }\n\tonType : null, // function(str) { ... }\n\tonDelete : null, // function(values) { ... }\n\t*/\n\n\trender: {\n\t\t/*\n\t\titem: null,\n\t\toptgroup: null,\n\t\toptgroup_header: null,\n\t\toption: null,\n\t\toption_create: null\n\t\t*/\n\t}\n};\n","\n\n/**\n * Converts a scalar to its best string representation\n * for hash keys and HTML attribute values.\n *\n * Transformations:\n * 'str' -> 'str'\n * null -> ''\n * undefined -> ''\n * true -> '1'\n * false -> '0'\n * 0 -> '0'\n * 1 -> '1'\n *\n * @param {string} value\n * @returns {string|null}\n */\nexport function hash_key(value) {\n\tif (typeof value === 'undefined' || value === null) return null;\n\tif (typeof value === 'boolean') return value ? '1' : '0';\n\treturn value + '';\n};\n\n/**\n * Escapes a string for use within HTML.\n *\n * @param {string} str\n * @returns {string}\n */\nexport function escape_html(str) {\n\treturn (str + '')\n\t\t.replace(/&/g, '&')\n\t\t.replace(//g, '>')\n\t\t.replace(/\"/g, '"');\n};\n\n\n/**\n * Debounce all fired events types listed in `types`\n * while executing the provided `fn`.\n *\n * @param {object} self\n * @param {array} types\n * @param {function} fn\n */\nexport function debounce_events( self, types, fn) {\n\tvar type;\n\tvar trigger = self.trigger;\n\tvar event_args = {};\n\n\t// override trigger method\n\tself.trigger = function() {\n\t\tvar type = arguments[0];\n\t\tif (types.indexOf(type) !== -1) {\n\t\t\tevent_args[type] = arguments;\n\t\t} else {\n\t\t\treturn trigger.apply(self, arguments);\n\t\t}\n\t};\n\n\t// invoke provided function\n\tfn.apply(self, []);\n\tself.trigger = trigger;\n\n\t// trigger queued events\n\tfor (type in event_args) {\n\t\tif (event_args.hasOwnProperty(type)) {\n\t\t\ttrigger.apply(self, event_args[type]);\n\t\t}\n\t}\n};\n\n\n/**\n * Determines the current selection within a text input control.\n * Returns an object containing:\n * - start\n * - length\n *\n * @param {object} input\n * @returns {object}\n */\nexport function getSelection(input) {\n\treturn {\n\t\tstart\t: input.selectionStart,\n\t\tlength\t: input.selectionEnd - input.selectionStart,\n\t};\n};\n","import defaults from './defaults.js';\nimport { hash_key } from './utils.js';\n\nexport default function getSettings( input, settings_user){\n\tvar settings\t\t\t\t= Object.assign({}, defaults, settings_user);\n\n\tvar attr_data\t\t\t\t= settings.dataAttr;\n\tvar field_label\t\t\t\t= settings.labelField;\n\tvar field_value\t\t\t\t= settings.valueField;\n\tvar field_disabled\t\t\t= settings.disabledField;\n\tvar field_optgroup\t\t\t= settings.optgroupField;\n\tvar field_optgroup_label\t= settings.optgroupLabelField;\n\tvar field_optgroup_value\t= settings.optgroupValueField;\n\n\tvar tag_name\t\t\t\t= input.tagName.toLowerCase();\n\tvar placeholder\t\t\t\t= input.getAttribute('placeholder') || input.getAttribute('data-placeholder');\n\n\tif (!placeholder && !settings.allowEmptyOption) {\n\t\tlet option\t\t= input.querySelector('option[value=\"\"]');\n\t\tif( option ){\n\t\t\tplaceholder = option.textContent;\n\t\t}\n\n\t}\n\n\tvar settings_element\t\t= {\n\t\t\t\t\t\t\t\t\t\t'placeholder' : placeholder,\n\t\t\t\t\t\t\t\t\t\t'options' : [],\n\t\t\t\t\t\t\t\t\t\t'optgroups' : [],\n\t\t\t\t\t\t\t\t\t\t'items' : []\n\t\t\t\t\t\t\t\t\t};\n\n\n\t/**\n\t * Initialize from a element.\n\t *\n\t */\n\tvar init_textbox = function(){\n\t\tvar i, n, values, option;\n\n\t\tvar data_raw = input.getAttribute(attr_data);\n\n\t\tif (!data_raw) {\n\t\t\tvar value = input.value.trim() || '';\n\t\t\tif (!settings.allowEmptyOption && !value.length) return;\n\t\t\tvalues = value.split(settings.delimiter);\n\t\t\tfor (i = 0, n = values.length; i < n; i++) {\n\t\t\t\toption = {};\n\t\t\t\toption[field_label] = values[i];\n\t\t\t\toption[field_value] = values[i];\n\t\t\t\tsettings_element.options.push(option);\n\t\t\t}\n\t\t\tsettings_element.items = values;\n\t\t} else {\n\t\t\tsettings_element.options = JSON.parse(data_raw);\n\t\t\tfor (i = 0, n = settings_element.options.length; i < n; i++) {\n\t\t\t\tsettings_element.items.push(settings_element.options[i][field_value]);\n\t\t\t}\n\t\t}\n\t};\n\n\n\tif (tag_name === 'select') {\n\t\tinit_select();\n\t} else {\n\t\tinit_textbox();\n\t}\n\n\treturn Object.assign( {}, defaults, settings_element, settings_user);\n};\n","/**\n * Plugin: \"change_listener\" (Tom Select)\n * Copyright (c) contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this\n * file except in compliance with the License. You may obtain a copy of the License at:\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n * ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n *\n */\n\nimport TomSelect from '../../tom-select.js';\nimport getSettings from '../../settings.js';\n\nTomSelect.define('change_listener',function(options){\n\tvar self\t\t= this;\n\tvar changed\t\t= false;\n\n\tself.input.addEventListener('change',function(){\n\n\t\t// prevent infinite loops\n\t\tif( changed ){\n\t\t\tchanged = false;\n\t\t\treturn;\n\t\t}\n\n\t\tchanged\t\t\t= true;\n\t\tvar settings\t= getSettings( self.input, {} );\n\n\t\tself.setupOptions(settings.options,settings.optgroups);\n\t\tself.setValue(settings.items);\n\t});\n\n});\n"],"names":["options","optgroups","plugins","delimiter","splitOn","persist","diacritics","create","createOnBlur","createFilter","highlight","openOnFocus","maxOptions","maxItems","hideSelected","duplicates","addPrecedence","selectOnTab","preload","allowEmptyOption","closeAfterSelect","scrollDuration","loadThrottle","loadingClass","dataAttr","optgroupField","valueField","labelField","disabledField","optgroupLabelField","optgroupValueField","lockOptgroupOrder","sortField","searchField","searchConjunction","mode","wrapperClass","inputClass","dropdownClass","dropdownContentClass","itemClass","optionClass","dropdownParent","controlInput","copyClassesToDropdown","render","hash_key","value","getSettings","input","settings_user","settings","Object","assign","defaults","attr_data","field_label","field_value","field_disabled","field_optgroup","field_optgroup_label","field_optgroup_value","tag_name","tagName","toLowerCase","placeholder","getAttribute","option","querySelector","textContent","settings_element","init_select","i","n","children","optionsMap","readData","el","data","dataset","json","length","JSON","parse","addOption","group","hasOwnProperty","arr","Array","isArray","push","option_data","disabled","selected","items","addGroup","optgroup","id","optgroup_data","hasAttribute","init_textbox","values","data_raw","trim","split","TomSel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,QAAL,CAAc5D,QAAQ,CAAC2C,KAAvB;CACA,GAbD;CAeA,CAnBD;;;;;;"} \ No newline at end of file diff --git a/dist/js/plugins/drag_drop.js b/dist/js/plugins/drag_drop.js index 4b074ce6..377dbd57 100644 --- a/dist/js/plugins/drag_drop.js +++ b/dist/js/plugins/drag_drop.js @@ -1,12 +1,12 @@ /** -* Tom Select v1.0.0-rc.3 +* Tom Select v1.0.0 * Licensed under the Apache License, Version 2.0 (the "License"); */ (function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('../../tom-select.js')) : + typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('../../tom-select.js')) : typeof define === 'function' && define.amd ? define(['../../tom-select.js'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.drag_drop = factory(global.TomSelect)); + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TomSelect)); }(this, (function (TomSelect) { 'use strict'; function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } @@ -27,7 +27,7 @@ * governing permissions and limitations under the License. * */ - var plugin = TomSelect__default['default'].define('drag_drop', function (options) { + TomSelect__default['default'].define('drag_drop', function (options) { if (!$.fn.sortable) throw new Error('The "drag_drop" plugin requires jQuery UI "sortable".'); if (this.settings.mode !== 'multi') return; var self = this; @@ -68,7 +68,5 @@ }); }); - return plugin; - }))); //# sourceMappingURL=drag_drop.js.map diff --git a/dist/js/plugins/drag_drop.js.map b/dist/js/plugins/drag_drop.js.map index c28e2b88..40ce903e 100644 --- a/dist/js/plugins/drag_drop.js.map +++ b/dist/js/plugins/drag_drop.js.map @@ -1 +1 @@ -{"version":3,"file":"drag_drop.js","sources":["../../../src/plugins/drag_drop/plugin.js"],"sourcesContent":["/**\n * Plugin: \"drag_drop\" (Tom Select)\n * Copyright (c) contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this\n * file except in compliance with the License. You may obtain a copy of the License at:\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n * ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n *\n */\nimport TomSelect from '../../tom-select.js';\n\nexport default TomSelect.define('drag_drop',function(options) {\n\tif (!$.fn.sortable) throw new Error('The \"drag_drop\" plugin requires jQuery UI \"sortable\".');\n\tif (this.settings.mode !== 'multi') return;\n\tvar self = this;\n\n\tvar orig_lock\t\t= self.lock;\n\tvar orig_unlock\t\t= self.unlock;\n\n\tself.hook('instead','lock',function(){\n\t\tvar sortable = self.control.dataset.sortable;\n\t\tif (sortable) sortable.disable();\n\t\treturn orig_lock.apply(self, arguments);\n\t});\n\n\tself.hook('instead','unlock',function(){\n\t\tvar sortable = self.control.dataset.sortable;\n\t\tif (sortable) sortable.enable();\n\t\treturn orig_unlock.apply(self, arguments);\n\t});\n\n\tself.hook('after','setup',function(){\n\t\tvar $control = $(self.control).sortable({\n\t\t\titems: '[data-value]',\n\t\t\tforcePlaceholderSize: true,\n\t\t\tdisabled: self.isLocked,\n\t\t\tstart: function(e, ui) {\n\t\t\t\tui.placeholder.css('width', ui.helper.css('width'));\n\t\t\t\t$control.css({overflow: 'visible'});\n\t\t\t},\n\t\t\tstop: function() {\n\t\t\t\t$control.css({overflow: 'hidden'});\n\n\t\t\t\tvar values = [];\n\t\t\t\t$control.children('[data-value]').each(function() {\n\t\t\t\t\tvalues.push($(this).attr('data-value'));\n\t\t\t\t});\n\n\t\t\t\tself.setValue(values);\n\t\t\t}\n\t\t});\n\n\t});\n\n});\n"],"names":["TomSelect","define","options","$","fn","sortable","Error","settings","mode","self","orig_lock","lock","orig_unlock","unlock","hook","control","dataset","disable","apply","arguments","enable","$control","items","forcePlaceholderSize","disabled","isLocked","start","e","ui","placeholder","css","helper","overflow","stop","values","children","each","push","attr","setValue"],"mappings":";;;;;;;;;;;;;;;CAAA;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AYC,EAAZ,EAAgB;CACtBA,QAAAA,EAAE,CAACC,WAAH,CAAeC,GAAf,CAAmB,OAAnB,EAA4BF,EAAE,CAACG,MAAH,CAAUD,GAAV,CAAc,OAAd,CAA5B;CACAT,QAAAA,QAAQ,CAACS,GAAT,CAAa;CAACE,UAAAA,QAAQ,EAAE;CAAX,SAAb;CACA,OAPsC;CAQvCC,MAAAA,IAAI,EAAE,gBAAW;CAChBZ,QAAAA,QAAQ,CAACS,GAAT,CAAa;CAACE,UAAAA,QAAQ,EAAE;CAAX,SAAb;CAEA,YAAIE,MAAM,GAAG,EAAb;CACAb,QAAAA,QAAQ,CAACc,QAAT,CAAkB,cAAlB,EAAkCC,IAAlC,CAAuC,YAAW;CACjDF,UAAAA,MAAM,CAACG,IAAP,CAAYlC,CAAC,CAAC,IAAD,CAAD,CAAQmC,IAAR,CAAa,YAAb,CAAZ;CACA,SAFD;CAIA7B,QAAAA,IAAI,CAAC8B,QAAL,CAAcL,MAAd;CACA;CAjBsC,KAAzB,CAAf;CAoBA,GArBD;CAuBA,CA3Cc,CAAf;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"drag_drop.js","sources":["../../../src/plugins/drag_drop/plugin.js"],"sourcesContent":["/**\n * Plugin: \"drag_drop\" (Tom Select)\n * Copyright (c) contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this\n * file except in compliance with the License. You may obtain a copy of the License at:\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n * ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n *\n */\nimport TomSelect from '../../tom-select.js';\n\nTomSelect.define('drag_drop',function(options) {\n\tif (!$.fn.sortable) throw new Error('The \"drag_drop\" plugin requires jQuery UI \"sortable\".');\n\tif (this.settings.mode !== 'multi') return;\n\tvar self = this;\n\n\tvar orig_lock\t\t= self.lock;\n\tvar orig_unlock\t\t= self.unlock;\n\n\tself.hook('instead','lock',function(){\n\t\tvar sortable = self.control.dataset.sortable;\n\t\tif (sortable) sortable.disable();\n\t\treturn orig_lock.apply(self, arguments);\n\t});\n\n\tself.hook('instead','unlock',function(){\n\t\tvar sortable = self.control.dataset.sortable;\n\t\tif (sortable) sortable.enable();\n\t\treturn orig_unlock.apply(self, arguments);\n\t});\n\n\tself.hook('after','setup',function(){\n\t\tvar $control = $(self.control).sortable({\n\t\t\titems: '[data-value]',\n\t\t\tforcePlaceholderSize: true,\n\t\t\tdisabled: self.isLocked,\n\t\t\tstart: function(e, ui) {\n\t\t\t\tui.placeholder.css('width', ui.helper.css('width'));\n\t\t\t\t$control.css({overflow: 'visible'});\n\t\t\t},\n\t\t\tstop: function() {\n\t\t\t\t$control.css({overflow: 'hidden'});\n\n\t\t\t\tvar values = [];\n\t\t\t\t$control.children('[data-value]').each(function() {\n\t\t\t\t\tvalues.push($(this).attr('data-value'));\n\t\t\t\t});\n\n\t\t\t\tself.setValue(values);\n\t\t\t}\n\t\t});\n\n\t});\n\n});\n"],"names":["TomSelect","define","options","$","fn","sortable","Error","settings","mode","self","orig_lock","lock","orig_unlock","unlock","hook","control","dataset","disable","apply","arguments","enable","$control","items","forcePlaceholderSize","disabled","isLocked","start","e","ui","placeholder","css","helper","overflow","stop","values","children","each","push","attr","setValue"],"mappings":";;;;;;;;;;;;;;;CAAA;;;;;;;;;;;;;;AAgBAA,8BAAS,CAACC,MAAV,CAAiB,WAAjB,EAA6B,UAASC,OAAT,EAAkB;CAC9C,MAAI,CAACC,CAAC,CAACC,EAAF,CAAKC,QAAV,EAAoB,MAAM,IAAIC,KAAJ,CAAU,uDAAV,CAAN;CACpB,MAAI,KAAKC,QAAL,CAAcC,IAAd,KAAuB,OAA3B,EAAoC;CACpC,MAAIC,IAAI,GAAG,IAAX;CAEA,MAAIC,SAAS,GAAID,IAAI,CAACE,IAAtB;CACA,MAAIC,WAAW,GAAIH,IAAI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,MAAM,GAAG,EAAb;CACAb,QAAAA,QAAQ,CAACc,QAAT,CAAkB,cAAlB,EAAkCC,IAAlC,CAAuC,YAAW;CACjDF,UAAAA,MAAM,CAACG,IAAP,CAAYlC,CAAC,CAAC,IAAD,CAAD,CAAQmC,IAAR,CAAa,YAAb,CAAZ;CACA,SAFD;CAIA7B,QAAAA,IAAI,CAAC8B,QAAL,CAAcL,MAAd;CACA;CAjBsC,KAAzB,CAAf;CAoBA,GArBD;CAuBA,CA3CD;;;;;;"} \ No newline at end of file diff --git a/dist/js/plugins/dropdown_header.js b/dist/js/plugins/dropdown_header.js index c28812e4..a54a1603 100644 --- a/dist/js/plugins/dropdown_header.js +++ b/dist/js/plugins/dropdown_header.js @@ -1,12 +1,12 @@ /** -* Tom Select v1.0.0-rc.3 +* Tom Select v1.0.0 * Licensed under the Apache License, Version 2.0 (the "License"); */ (function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('../../tom-select.js')) : + typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('../../tom-select.js')) : typeof define === 'function' && define.amd ? define(['../../tom-select.js'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.dropdown_header = factory(global.TomSelect)); + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TomSelect)); }(this, (function (TomSelect) { 'use strict'; function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } @@ -53,7 +53,7 @@ * governing permissions and limitations under the License. * */ - var plugin = TomSelect__default['default'].define('dropdown_header', function (options) { + TomSelect__default['default'].define('dropdown_header', function (options) { var self = this; options = Object.assign({ title: 'Untitled', @@ -71,7 +71,5 @@ }); }); - return plugin; - }))); //# sourceMappingURL=dropdown_header.js.map diff --git a/dist/js/plugins/dropdown_header.js.map b/dist/js/plugins/dropdown_header.js.map index 7483c4fa..9e3418fc 100644 --- a/dist/js/plugins/dropdown_header.js.map +++ b/dist/js/plugins/dropdown_header.js.map @@ -1 +1 @@ -{"version":3,"file":"dropdown_header.js","sources":["../../../src/vanilla.js","../../../src/plugins/dropdown_header/plugin.js"],"sourcesContent":["\n/**\n * Return a dom element from either a dom query string, jQuery object, a dom element or html string\n * https://stackoverflow.com/questions/494143/creating-a-new-dom-element-from-an-html-string-using-built-in-dom-methods-or-pro/35385518#35385518\n *\n * @param {any} query .. should be {HTMLElement|string|JQuery}\n * @return {HTMLElement}\n */\nexport function getDom( query ){\n\n\tif( query.jquery ){\n\t\treturn query[0];\n\t}\n\n\tif( query instanceof HTMLElement ){\n\t\treturn query;\n\t}\n\n\tif( query.indexOf('<') > -1 ){\n\t\tlet div = document.createElement('div');\n\t\tdiv.innerHTML = query.trim(); // Never return a text node of whitespace as the result\n\t\treturn div.querySelector(':first-child');\n\t}\n\n\treturn document.querySelector(query);\n};\n\n/**\n * Dispatch an event\n *\n */\nexport function triggerEvent( dom_el, event_name ){\n\tvar event = document.createEvent('HTMLEvents');\n\tevent.initEvent(event_name, true, false);\n\tdom_el.dispatchEvent(event)\n};\n\n/**\n * Apply CSS rules to a dom element\n *\n */\nexport function applyCSS( dom_el, css){\n\tObject.keys(css).forEach(function(name){\n\t\tdom_el.style[name] = css[name];\n\t});\n}\n\n\n/**\n * Add css classes\n *\n */\nexport function addClasses( elmts ){\n\n\tvar classes\t\t= classesArray.apply(null,arguments);\n\telmts\t\t\t= castAsArray(elmts);\n\n\telmts.map( el => {\n\t\tclasses.map( cls => {\n\t\t\tel.classList.add( cls );\n\t\t});\n\t});\n}\n\n/**\n * Remove css classes\n *\n */\n export function removeClasses( elmts ){\n\n \tvar classes \t= classesArray.apply(null,arguments);\n\telmts\t\t= castAsArray(elmts);\n\n\telmts.map( el => {\n\t\tclasses.map(cls => {\n\t \t\tel.classList.remove( cls );\n\t\t});\n \t});\n }\n\n\n/**\n * Return arguments\n *\n */\nexport function classesArray(){\n\tvar classes = [];\n\tfor( let i = 1; i < arguments.length; i++ ){\n\t\tlet _classes = arguments[i];\n\t\tif( typeof _classes === 'string' ){\n\t\t\t_classes = _classes.trim().split(/[\\11\\12\\14\\15\\40]/);\n\t\t}\n\t\tif( Array.isArray(_classes) ){\n\t\t\tclasses = classes.concat(_classes);\n\t\t}\n\t}\n\n\treturn classes.filter(Boolean);\n}\n\nexport function castAsArray(arg){\n\tif( !Array.isArray(arg) ){\n \t\targ = [arg];\n \t}\n\treturn arg;\n}\n\n\n/**\n * Get the closest node to the evt.target matching the selector\n * Stops at wrapper\n *\n */\nexport function parentMatch(target, selector, wrapper ){\n\n\tif( wrapper && !wrapper.contains(target) ){\n\t\treturn;\n\t}\n\n\twhile( target && target.matches ){\n\n\t\tif( target.matches(selector) ){\n\t\t\treturn target;\n\t\t}\n\n\t\ttarget = target.parentNode;\n\t}\n}\n\n/**\n * Get the first or last item from a querySelectorAll result\n *\n * > 0 - right (last)\n * < 0 - left (first)\n *\n */\nexport function querySelectorEnd( el, query, direction){\n\tvar result = el.querySelectorAll(query);\n\tif( !result ){\n\t\treturn;\n\t}\n\n\treturn getTail(result,direction);\n};\n\n\n/**\n * Get the first or last item from an array\n *\n */\nexport function getTail( array, direction ){\n\n\tif( direction > 0 ){\n\t\treturn array[array.length-1];\n\t}\n\n\treturn array[0];\n}\n\n/**\n * Return true if an object is empty\n *\n */\nexport function isEmptyObject(obj){\n\treturn (Object.keys(obj).length === 0);\n}\n\n\n/**\n * Get the index of an element amongst sibling nodes of the same type\n *\n */\nexport function nodeIndex( el, amongst ){\n\tif (!el) return -1;\n\n\tamongst = amongst || el.nodeName;\n\n\tvar i = 0;\n\twhile( el = el.previousElementSibling ){\n\n\t\tif( el.matches(amongst) ){\n\t\t\ti++;\n\t\t}\n\t}\n\treturn i;\n}\n","/**\n * Plugin: \"dropdown_header\" (Tom Select)\n * Copyright (c) contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this\n * file except in compliance with the License. You may obtain a copy of the License at:\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n * ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n *\n */\n\nimport TomSelect from '../../tom-select.js';\nimport { getDom } from '../../vanilla.js';\n\n\nexport default TomSelect.define('dropdown_header',function(options) {\n\tvar self = this;\n\n\toptions = Object.assign({\n\t\ttitle : 'Untitled',\n\t\theaderClass : 'dropdown-header',\n\t\ttitleRowClass : 'dropdown-header-title',\n\t\tlabelClass : 'dropdown-header-label',\n\t\tcloseClass : 'dropdown-header-close',\n\n\t\thtml: function(data) {\n\t\t\treturn (\n\t\t\t\t'
' +\n\t\t\t\t\t'
' +\n\t\t\t\t\t\t'' + data.title + '' +\n\t\t\t\t\t\t'×' +\n\t\t\t\t\t'
' +\n\t\t\t\t'
'\n\t\t\t);\n\t\t}\n\t}, options);\n\n\tself.hook('after','setup',function(){\n\t\tvar header = getDom(options.html(options));\n\t\tself.dropdown.insertBefore(header, self.dropdown.firstChild);\n\t});\n\n});\n"],"names":["getDom","query","jquery","HTMLElement","indexOf","div","document","createElement","innerHTML","trim","querySelector","TomSelect","define","options","self","Object","assign","title","headerClass","titleRowClass","labelClass","closeClass","html","data","hook","header","dropdown","insertBefore","firstChild"],"mappings":";;;;;;;;;;;;;;;CACA;;;;;;;CAOO,SAASA,MAAT,CAAiBC,KAAjB,EAAwB;CAE9B,MAAIA,KAAK,CAACC,MAAV,EAAkB;CACjB,WAAOD,KAAK,CAAC,CAAD,CAAZ;CACA;;CAED,MAAIA,KAAK,YAAYE,WAArB,EAAkC;CACjC,WAAOF,KAAP;CACA;;CAED,MAAIA,KAAK,CAACG,OAAN,CAAc,GAAd,IAAqB,CAAC,CAA1B,EAA6B;CAC5B,QAAIC,GAAG,GAAGC,QAAQ,CAACC,aAAT,CAAuB,KAAvB,CAAV;CACAF,IAAAA,GAAG,CAACG,SAAJ,GAAgBP,KAAK,CAACQ,IAAN,EAAhB,CAF4B;;CAG5B,WAAOJ,GAAG,CAACK,aAAJ,CAAkB,cAAlB,CAAP;CACA;;CAED,SAAOJ,QAAQ,CAACI,aAAT,CAAuBT,KAAvB,CAAP;CACA;;CCzBD;;;;;;;;;;;;;;AAmBA,cAAeU,6BAAS,CAACC,MAAV,CAAiB,iBAAjB,EAAmC,UAASC,OAAT,EAAkB;CACnE,MAAIC,IAAI,GAAG,IAAX;CAEAD,EAAAA,OAAO,GAAGE,MAAM,CAACC,MAAP,CAAc;CACvBC,IAAAA,KAAK,EAAW,UADO;CAEvBC,IAAAA,WAAW,EAAK,iBAFO;CAGvBC,IAAAA,aAAa,EAAG,uBAHO;CAIvBC,IAAAA,UAAU,EAAM,uBAJO;CAKvBC,IAAAA,UAAU,EAAM,uBALO;CAOvBC,IAAAA,IAAI,EAAE,cAASC,IAAT,EAAe;CACpB,aACC,iBAAiBA,IAAI,CAACL,WAAtB,GAAoC,IAApC,GACC,cADD,GACkBK,IAAI,CAACJ,aADvB,GACuC,IADvC,GAEE,eAFF,GAEoBI,IAAI,CAACH,UAFzB,GAEsC,IAFtC,GAE6CG,IAAI,CAACN,KAFlD,GAE0D,SAF1D,GAGE,sCAHF,GAG2CM,IAAI,CAACF,UAHhD,GAG6D,eAH7D,GAIC,QAJD,GAKA,QAND;CAQA;CAhBsB,GAAd,EAiBPR,OAjBO,CAAV;CAmBAC,EAAAA,IAAI,CAACU,IAAL,CAAU,OAAV,EAAkB,OAAlB,EAA0B,YAAU;CACnC,QAAIC,MAAM,GAAGzB,MAAM,CAACa,OAAO,CAACS,IAAR,CAAaT,OAAb,CAAD,CAAnB;CACAC,IAAAA,IAAI,CAACY,QAAL,CAAcC,YAAd,CAA2BF,MAA3B,EAAmCX,IAAI,CAACY,QAAL,CAAcE,UAAjD;CACA,GAHD;CAKA,CA3Bc,CAAf;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"dropdown_header.js","sources":["../../../src/vanilla.js","../../../src/plugins/dropdown_header/plugin.js"],"sourcesContent":["\n/**\n * Return a dom element from either a dom query string, jQuery object, a dom element or html string\n * https://stackoverflow.com/questions/494143/creating-a-new-dom-element-from-an-html-string-using-built-in-dom-methods-or-pro/35385518#35385518\n *\n * @param {any} query .. should be {HTMLElement|string|JQuery}\n * @return {HTMLElement}\n */\nexport function getDom( query ){\n\n\tif( query.jquery ){\n\t\treturn query[0];\n\t}\n\n\tif( query instanceof HTMLElement ){\n\t\treturn query;\n\t}\n\n\tif( query.indexOf('<') > -1 ){\n\t\tlet div = document.createElement('div');\n\t\tdiv.innerHTML = query.trim(); // Never return a text node of whitespace as the result\n\t\treturn div.querySelector(':first-child');\n\t}\n\n\treturn document.querySelector(query);\n};\n\n/**\n * Dispatch an event\n *\n * @param {HTMLElement} dom_el\n * @param {string} event_name\n */\nexport function triggerEvent( dom_el, event_name ){\n\tvar event = document.createEvent('HTMLEvents');\n\tevent.initEvent(event_name, true, false);\n\tdom_el.dispatchEvent(event)\n};\n\n/**\n * Apply CSS rules to a dom element\n *\n * @param {HTMLElement} dom_el\n * @param {object} css\n */\nexport function applyCSS( dom_el, css){\n\tObject.keys(css).forEach(function(name){\n\t\tdom_el.style[name] = css[name];\n\t});\n}\n\n\n/**\n * Add css classes\n *\n */\nexport function addClasses( elmts ){\n\n\tvar classes\t\t= classesArray.apply(null,arguments);\n\telmts\t\t\t= castAsArray(elmts);\n\n\telmts.map( el => {\n\t\tclasses.map( cls => {\n\t\t\tel.classList.add( cls );\n\t\t});\n\t});\n}\n\n/**\n * Remove css classes\n *\n */\n export function removeClasses( elmts ){\n\n \tvar classes \t= classesArray.apply(null,arguments);\n\telmts\t\t= castAsArray(elmts);\n\n\telmts.map( el => {\n\t\tclasses.map(cls => {\n\t \t\tel.classList.remove( cls );\n\t\t});\n \t});\n }\n\n\n/**\n * Return arguments\n *\n * @return {array}\n */\nexport function classesArray(){\n\tvar classes = [];\n\tfor( let i = 1; i < arguments.length; i++ ){\n\t\tlet _classes = arguments[i];\n\t\tif( typeof _classes === 'string' ){\n\t\t\t_classes = _classes.trim().split(/[\\11\\12\\14\\15\\40]/);\n\t\t}\n\t\tif( Array.isArray(_classes) ){\n\t\t\tclasses = classes.concat(_classes);\n\t\t}\n\t}\n\n\treturn classes.filter(Boolean);\n}\n\n\n/**\n * Create an array from arg if it's not already an array\n *\n *\n * @param {any} arg\n * @return {array}\n */\nexport function castAsArray(arg){\n\tif( !Array.isArray(arg) ){\n \t\targ = [arg];\n \t}\n\treturn arg;\n}\n\n\n/**\n * Get the closest node to the evt.target matching the selector\n * Stops at wrapper\n *\n * param {HTMLElement} target\n * @param {string} selector\n * @param {HTMLElement} [wrapper=null]\n * return {HTMLElement}\n */\nexport function parentMatch( target, selector, wrapper ){\n\n\tif( wrapper && !wrapper.contains(target) ){\n\t\treturn;\n\t}\n\n\twhile( target && target.matches ){\n\n\t\tif( target.matches(selector) ){\n\t\t\treturn target;\n\t\t}\n\n\t\ttarget = target.parentNode;\n\t}\n}\n\n/**\n * Get the first or last item from a querySelectorAll result\n *\n * > 0 - right (last)\n * < 0 - left (first)\n *\n * @param {HTMLElement} el\n * @param {string} query\n * @param {number} direction\n * @return {HTMLElement}\n */\nexport function querySelectorEnd( el, query, direction){\n\tvar result = el.querySelectorAll(query);\n\tif( !result ){\n\t\treturn;\n\t}\n\n\treturn getTail(result,direction);\n};\n\n\n/**\n * Get the first or last item from an array\n *\n * @param {array|NodeList} array\n * @param {number} direction\n * @return {any}\n */\nexport function getTail( array, direction ){\n\n\tif( direction > 0 ){\n\t\treturn array[array.length-1];\n\t}\n\n\treturn array[0];\n}\n\n/**\n * Return true if an object is empty\n *\n * @param {object} obj\n * @return {boolean}\n */\nexport function isEmptyObject(obj){\n\treturn (Object.keys(obj).length === 0);\n}\n\n\n/**\n * Get the index of an element amongst sibling nodes of the same type\n *\n * @param {Element} el\n * @param {string} [amongst=null]\n * @return {number}\n */\nexport function nodeIndex( el, amongst ){\n\tif (!el) return -1;\n\n\tamongst = amongst || el.nodeName;\n\n\tvar i = 0;\n\twhile( el = el.previousElementSibling ){\n\n\t\tif( el.matches(amongst) ){\n\t\t\ti++;\n\t\t}\n\t}\n\treturn i;\n}\n","/**\n * Plugin: \"dropdown_header\" (Tom Select)\n * Copyright (c) contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this\n * file except in compliance with the License. You may obtain a copy of the License at:\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n * ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n *\n */\n\nimport TomSelect from '../../tom-select.js';\nimport { getDom } from '../../vanilla.js';\n\n\nTomSelect.define('dropdown_header',function(options) {\n\tvar self = this;\n\n\toptions = Object.assign({\n\t\ttitle : 'Untitled',\n\t\theaderClass : 'dropdown-header',\n\t\ttitleRowClass : 'dropdown-header-title',\n\t\tlabelClass : 'dropdown-header-label',\n\t\tcloseClass : 'dropdown-header-close',\n\n\t\thtml: function(data) {\n\t\t\treturn (\n\t\t\t\t'
' +\n\t\t\t\t\t'
' +\n\t\t\t\t\t\t'' + data.title + '' +\n\t\t\t\t\t\t'×' +\n\t\t\t\t\t'
' +\n\t\t\t\t'
'\n\t\t\t);\n\t\t}\n\t}, options);\n\n\tself.hook('after','setup',function(){\n\t\tvar header = getDom(options.html(options));\n\t\tself.dropdown.insertBefore(header, self.dropdown.firstChild);\n\t});\n\n});\n"],"names":["getDom","query","jquery","HTMLElement","indexOf","div","document","createElement","innerHTML","trim","querySelector","TomSelect","define","options","self","Object","assign","title","headerClass","titleRowClass","labelClass","closeClass","html","data","hook","header","dropdown","insertBefore","firstChild"],"mappings":";;;;;;;;;;;;;;;CACA;;;;;;;CAOO,SAASA,MAAT,CAAiBC,KAAjB,EAAwB;CAE9B,MAAIA,KAAK,CAACC,MAAV,EAAkB;CACjB,WAAOD,KAAK,CAAC,CAAD,CAAZ;CACA;;CAED,MAAIA,KAAK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b,CAAD,CAAnB;CACAC,IAAAA,IAAI,CAACY,QAAL,CAAcC,YAAd,CAA2BF,MAA3B,EAAmCX,IAAI,CAACY,QAAL,CAAcE,UAAjD;CACA,GAHD;CAKA,CA3BD;;;;;;"} \ No newline at end of file diff --git a/dist/js/plugins/input_autogrow.js b/dist/js/plugins/input_autogrow.js index f8db5f35..81bca3b8 100644 --- a/dist/js/plugins/input_autogrow.js +++ b/dist/js/plugins/input_autogrow.js @@ -1,12 +1,12 @@ /** -* Tom Select v1.0.0-rc.3 +* Tom Select v1.0.0 * Licensed under the Apache License, Version 2.0 (the "License"); */ (function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('../../tom-select.js')) : + typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('../../tom-select.js')) : typeof define === 'function' && define.amd ? define(['../../tom-select.js'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.input_autogrow = factory(global.TomSelect)); + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TomSelect)); }(this, (function (TomSelect) { 'use strict'; function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } @@ -26,17 +26,12 @@ * governing permissions and limitations under the License. * */ - var plugin = TomSelect__default['default'].define('input_autogrow', function (options) { + TomSelect__default['default'].define('input_autogrow', function (options) { var self = this; self.hook('after', 'setup', function () { var test_input = document.createElement('span'); var control = this.control_input; - test_input.style.position = 'absolute'; - test_input.style.top = '-99999px'; - test_input.style.left = '-99999px'; - test_input.style.width = 'auto'; - test_input.style.padding = '0'; - test_input.style.whiteSpace = 'pre'; + test_input.style.cssText = 'position:absolute; top:-99999px; left:-99999px; width:auto; padding:0; white-space:pre; '; self.wrapper.appendChild(test_input); var transfer_styles = ['letterSpacing', 'fontSize', 'fontFamily', 'fontWeight', 'textTransform']; @@ -62,7 +57,5 @@ }); }); - return plugin; - }))); //# sourceMappingURL=input_autogrow.js.map diff --git a/dist/js/plugins/input_autogrow.js.map b/dist/js/plugins/input_autogrow.js.map index be0ff893..8cddf8f8 100644 --- a/dist/js/plugins/input_autogrow.js.map +++ b/dist/js/plugins/input_autogrow.js.map @@ -1 +1 @@ -{"version":3,"file":"input_autogrow.js","sources":["../../../src/plugins/input_autogrow/plugin.js"],"sourcesContent":["/**\n * Plugin: \"input_autogrow\" (Tom Select)\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this\n * file except in compliance with the License. You may obtain a copy of the License at:\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n * ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n *\n */\nimport TomSelect from '../../tom-select.js';\n\nexport default TomSelect.define('input_autogrow', function(options) {\n\n\tvar self\t\t\t\t\t= this;\n\n\tself.hook('after','setup',function(){\n\n\n\t\tvar test_input\t\t\t\t= document.createElement('span');\n\t\tvar control\t\t\t\t\t= this.control_input;\n\t\ttest_input.style.position\t= 'absolute';\n\t\ttest_input.style.top\t\t= '-99999px';\n\t\ttest_input.style.left\t\t= '-99999px';\n\t\ttest_input.style.width\t\t= 'auto';\n\t\ttest_input.style.padding\t= '0';\n\t\ttest_input.style.whiteSpace\t= 'pre';\n\n\t\tself.wrapper.appendChild(test_input);\n\n\n\t\tvar transfer_styles\t\t\t= [ 'letterSpacing', 'fontSize', 'fontFamily', 'fontWeight', 'textTransform' ];\n\n\t\tfor( let i = 0, n = transfer_styles.length; i < n; i++ ){\n\t\t\tlet style_name = transfer_styles[i];\n\t\t\ttest_input.style[style_name] = control.style[style_name];\n\t\t}\n\n\n\t\t/**\n\t\t * Set the control width\n\t\t *\n\t\t */\n\t\tvar resize = function(){\n\t\t\ttest_input.textContent\t= control.value;\n\t\t\tcontrol.style.width\t\t= test_input.clientWidth+'px';\n\t\t};\n\n\t\tcontrol.addEventListener('input', resize );\n\t\tcontrol.addEventListener('keyup', resize );\n\t\tcontrol.addEventListener('blur', resize );\n\t\tcontrol.addEventListener('update', resize );\n\t});\n\n});\n"],"names":["TomSelect","define","options","self","hook","test_input","document","createElement","control","control_input","style","position","top","left","width","padding","whiteSpace","wrapper","appendChild","transfer_styles","i","n","length","style_name","resize","textContent","value","clientWidth","addEventListener"],"mappings":";;;;;;;;;;;;;;;CAAA;;;;;;;;;;;;;AAeA,cAAeA,6BAAS,CAACC,MAAV,CAAiB,gBAAjB,EAAmC,UAASC,OAAT,EAAkB;CAEnE,MAAIC,IAAI,GAAO,IAAf;CAEAA,EAAAA,IAAI,CAACC,IAAL,CAAU,OAAV,EAAkB,OAAlB,EAA0B,YAAU;CAGnC,QAAIC,UAAU,GAAMC,QAAQ,CAACC,aAAT,CAAuB,MAAvB,CAApB;CACA,QAAIC,OAAO,GAAO,KAAKC,aAAvB;CACAJ,IAAAA,UAAU,CAACK,KAAX,CAAiBC,QAAjB,GAA4B,UAA5B;CACAN,IAAAA,UAAU,CAACK,KAAX,CAAiBE,GAAjB,GAAwB,UAAxB;CACAP,IAAAA,UAAU,CAACK,KAAX,CAAiBG,IAAjB,GAAyB,UAAzB;CACAR,IAAAA,UAAU,CAACK,KAAX,CAAiBI,KAAjB,GAA0B,MAA1B;CACAT,IAAAA,UAAU,CAACK,KAAX,CAAiBK,OAAjB,GAA2B,GAA3B;CACAV,IAAAA,UAAU,CAACK,KAAX,CAAiBM,UAAjB,GAA8B,KAA9B;CAEAb,IAAAA,IAAI,CAACc,OAAL,CAAaC,WAAb,CAAyBb,UAAzB;CAGA,QAAIc,eAAe,GAAK,CAAE,eAAF,EAAmB,UAAnB,EAA+B,YAA/B,EAA6C,YAA7C,EAA2D,eAA3D,CAAxB;;CAEA,SAAK,IAAIC,CAAC,GAAG,CAAR,EAAWC,CAAC,GAAGF,eAAe,CAACG,MAApC,EAA4CF,CAAC,GAAGC,CAAhD,EAAmDD,CAAC,EAApD,EAAwD;CACvD,UAAIG,UAAU,GAAGJ,eAAe,CAACC,CAAD,CAAhC;CACAf,MAAAA,UAAU,CAACK,KAAX,CAAiBa,UAAjB,IAA+Bf,OAAO,CAACE,KAAR,CAAca,UAAd,CAA/B;CACA;CAGD;;;;;;CAIA,QAAIC,MAAM,GAAG,SAATA,MAAS,GAAU;CACtBnB,MAAAA,UAAU,CAACoB,WAAX,GAAyBjB,OAAO,CAACkB,KAAjC;CACAlB,MAAAA,OAAO,CAACE,KAAR,CAAcI,KAAd,GAAuBT,UAAU,CAACsB,WAAX,GAAuB,IAA9C;CACA,KAHD;;CAKAnB,IAAAA,OAAO,CAACoB,gBAAR,CAAyB,OAAzB,EAAkCJ,MAAlC;CACAhB,IAAAA,OAAO,CAACoB,gBAAR,CAAyB,OAAzB,EAAkCJ,MAAlC;CACAhB,IAAAA,OAAO,CAACoB,gBAAR,CAAyB,MAAzB,EAAiCJ,MAAjC;CACAhB,IAAAA,OAAO,CAACoB,gBAAR,CAAyB,QAAzB,EAAmCJ,MAAnC;CACA,GApCD;CAsCA,CA1Cc,CAAf;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"input_autogrow.js","sources":["../../../src/plugins/input_autogrow/plugin.js"],"sourcesContent":["/**\n * Plugin: \"input_autogrow\" (Tom Select)\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this\n * file except in compliance with the License. You may obtain a copy of the License at:\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n * ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n *\n */\nimport TomSelect from '../../tom-select.js';\n\nTomSelect.define('input_autogrow', function(options) {\n\n\tvar self\t\t\t\t\t= this;\n\n\tself.hook('after','setup',function(){\n\n\n\t\tvar test_input\t\t\t\t= document.createElement('span');\n\t\tvar control\t\t\t\t\t= this.control_input;\n\t\ttest_input.style.cssText\t= 'position:absolute; top:-99999px; left:-99999px; width:auto; padding:0; white-space:pre; ';\n\n\t\tself.wrapper.appendChild(test_input);\n\n\n\t\tvar transfer_styles\t\t\t= [ 'letterSpacing', 'fontSize', 'fontFamily', 'fontWeight', 'textTransform' ];\n\n\t\tfor( let i = 0, n = transfer_styles.length; i < n; i++ ){\n\t\t\tlet style_name = transfer_styles[i];\n\t\t\ttest_input.style[style_name] = control.style[style_name];\n\t\t}\n\n\n\t\t/**\n\t\t * Set the control width\n\t\t *\n\t\t */\n\t\tvar resize = function(){\n\t\t\ttest_input.textContent\t= control.value;\n\t\t\tcontrol.style.width\t\t= test_input.clientWidth+'px';\n\t\t};\n\n\t\tcontrol.addEventListener('input', resize );\n\t\tcontrol.addEventListener('keyup', resize );\n\t\tcontrol.addEventListener('blur', resize );\n\t\tcontrol.addEventListener('update', resize );\n\t});\n\n});\n"],"names":["TomSelect","define","options","self","hook","test_input","document","createElement","control","control_input","style","cssText","wrapper","appendChild","transfer_styles","i","n","length","style_name","resize","textContent","value","width","clientWidth","addEventListener"],"mappings":";;;;;;;;;;;;;;;CAAA;;;;;;;;;;;;;AAeAA,8BAAS,CAACC,MAAV,CAAiB,gBAAjB,EAAmC,UAASC,OAAT,EAAkB;CAEpD,MAAIC,IAAI,GAAO,IAAf;CAEAA,EAAAA,IAAI,CAACC,IAAL,CAAU,OAAV,EAAkB,OAAlB,EAA0B,YAAU;CAGnC,QAAIC,UAAU,GAAMC,QAAQ,CAACC,aAAT,CAAuB,MAAvB,CAApB;CACA,QAAIC,OAAO,GAAO,KAAKC,aAAvB;CACAJ,IAAAA,UAAU,CAACK,KAAX,CAAiBC,OAAjB,GAA2B,0FAA3B;CAEAR,IAAAA,IAAI,CAACS,OAAL,CAAaC,WAAb,CAAyBR,UAAzB;CAGA,QAAIS,eAAe,GAAK,CAAE,eAAF,EAAmB,UAAnB,EAA+B,YAA/B,EAA6C,YAA7C,EAA2D,eAA3D,CAAxB;;CAEA,SAAK,IAAIC,CAAC,GAAG,CAAR,EAAWC,CAAC,GAAGF,eAAe,CAACG,MAApC,EAA4CF,CAAC,GAAGC,CAAhD,EAAmDD,CAAC,EAApD,EAAwD;CACvD,UAAIG,UAAU,GAAGJ,eAAe,CAACC,CAAD,CAAhC;CACAV,MAAAA,UAAU,CAACK,KAAX,CAAiBQ,UAAjB,IAA+BV,OAAO,CAACE,KAAR,CAAcQ,UAAd,CAA/B;CACA;CAGD;;;;;;CAIA,QAAIC,MAAM,GAAG,SAATA,MAAS,GAAU;CACtBd,MAAAA,UAAU,CAACe,WAAX,GAAyBZ,OAAO,CAACa,KAAjC;CACAb,MAAAA,OAAO,CAACE,KAAR,CAAcY,KAAd,GAAuBjB,UAAU,CAACkB,WAAX,GAAuB,IAA9C;CACA,KAHD;;CAKAf,IAAAA,OAAO,CAACgB,gBAAR,CAAyB,OAAzB,EAAkCL,MAAlC;CACAX,IAAAA,OAAO,CAACgB,gBAAR,CAAyB,OAAzB,EAAkCL,MAAlC;CACAX,IAAAA,OAAO,CAACgB,gBAAR,CAAyB,MAAzB,EAAiCL,MAAjC;CACAX,IAAAA,OAAO,CAACgB,gBAAR,CAAyB,QAAzB,EAAmCL,MAAnC;CACA,GA/BD;CAiCA,CArCD;;;;;;"} \ No newline at end of file diff --git a/dist/js/plugins/no_backspace_delete.js b/dist/js/plugins/no_backspace_delete.js index bd79d283..f96499b7 100644 --- a/dist/js/plugins/no_backspace_delete.js +++ b/dist/js/plugins/no_backspace_delete.js @@ -1,12 +1,12 @@ /** -* Tom Select v1.0.0-rc.3 +* Tom Select v1.0.0 * Licensed under the Apache License, Version 2.0 (the "License"); */ (function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('../../tom-select.js')) : + typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('../../tom-select.js')) : typeof define === 'function' && define.amd ? define(['../../tom-select.js'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.no_backspace_delete = factory(global.TomSelect)); + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TomSelect)); }(this, (function (TomSelect) { 'use strict'; function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } @@ -26,13 +26,11 @@ * governing permissions and limitations under the License. * */ - var plugin = TomSelect__default['default'].define('no_backspace_delete', function (options) { + TomSelect__default['default'].define('no_backspace_delete', function (options) { this.hook('instead', 'setActiveItem', function () {}); this.hook('instead', 'selectAll', function () {}); this.hook('instead', 'deleteSelection', function () {}); }); - return plugin; - }))); //# sourceMappingURL=no_backspace_delete.js.map diff --git a/dist/js/plugins/no_backspace_delete.js.map b/dist/js/plugins/no_backspace_delete.js.map index 4b1a00de..442613a8 100644 --- a/dist/js/plugins/no_backspace_delete.js.map +++ b/dist/js/plugins/no_backspace_delete.js.map @@ -1 +1 @@ -{"version":3,"file":"no_backspace_delete.js","sources":["../../../src/plugins/no_backspace_delete/plugin.js"],"sourcesContent":["/**\n * Plugin: \"input_autogrow\" (Tom Select)\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this\n * file except in compliance with the License. You may obtain a copy of the License at:\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n * ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n *\n */\nimport TomSelect from '../../tom-select.js';\n\nexport default TomSelect.define('no_backspace_delete', function(options) {\n\n\tthis.hook('instead','setActiveItem',function(){});\n\tthis.hook('instead','selectAll',function(){});\n\tthis.hook('instead','deleteSelection',function(){});\n\n});\n"],"names":["TomSelect","define","options","hook"],"mappings":";;;;;;;;;;;;;;;CAAA;;;;;;;;;;;;;AAeA,cAAeA,6BAAS,CAACC,MAAV,CAAiB,qBAAjB,EAAwC,UAASC,OAAT,EAAkB;CAExE,OAAKC,IAAL,CAAU,SAAV,EAAoB,eAApB,EAAoC,YAAU,EAA9C;CACA,OAAKA,IAAL,CAAU,SAAV,EAAoB,WAApB,EAAgC,YAAU,EAA1C;CACA,OAAKA,IAAL,CAAU,SAAV,EAAoB,iBAApB,EAAsC,YAAU,EAAhD;CAEA,CANc,CAAf;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"no_backspace_delete.js","sources":["../../../src/plugins/no_backspace_delete/plugin.js"],"sourcesContent":["/**\n * Plugin: \"input_autogrow\" (Tom Select)\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this\n * file except in compliance with the License. You may obtain a copy of the License at:\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n * ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n *\n */\nimport TomSelect from '../../tom-select.js';\n\nTomSelect.define('no_backspace_delete', function(options) {\n\n\tthis.hook('instead','setActiveItem',function(){});\n\tthis.hook('instead','selectAll',function(){});\n\tthis.hook('instead','deleteSelection',function(){});\n\n});\n"],"names":["TomSelect","define","options","hook"],"mappings":";;;;;;;;;;;;;;;CAAA;;;;;;;;;;;;;AAeAA,8BAAS,CAACC,MAAV,CAAiB,qBAAjB,EAAwC,UAASC,OAAT,EAAkB;CAEzD,OAAKC,IAAL,CAAU,SAAV,EAAoB,eAApB,EAAoC,YAAU,EAA9C;CACA,OAAKA,IAAL,CAAU,SAAV,EAAoB,WAApB,EAAgC,YAAU,EAA1C;CACA,OAAKA,IAAL,CAAU,SAAV,EAAoB,iBAApB,EAAsC,YAAU,EAAhD;CAEA,CAND;;;;;;"} \ No newline at end of file diff --git a/dist/js/plugins/optgroup_columns.js b/dist/js/plugins/optgroup_columns.js index 3ea1dc67..d55dd308 100644 --- a/dist/js/plugins/optgroup_columns.js +++ b/dist/js/plugins/optgroup_columns.js @@ -1,12 +1,12 @@ /** -* Tom Select v1.0.0-rc.3 +* Tom Select v1.0.0 * Licensed under the Apache License, Version 2.0 (the "License"); */ (function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('../../tom-select.js')) : + typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('../../tom-select.js')) : typeof define === 'function' && define.amd ? define(['../../tom-select.js'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.optgroup_columns = factory(global.TomSelect)); + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TomSelect)); }(this, (function (TomSelect) { 'use strict'; function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } @@ -15,6 +15,8 @@ var KEY_LEFT = 37; var KEY_RIGHT = 39; + var IS_MAC = /Mac/.test(navigator.userAgent); + // ctrl key or apple key for ma /** * Return a dom element from either a dom query string, jQuery object, a dom element or html string @@ -27,6 +29,10 @@ * Get the closest node to the evt.target matching the selector * Stops at wrapper * + * param {HTMLElement} target + * @param {string} selector + * @param {HTMLElement} [wrapper=null] + * return {HTMLElement} */ function parentMatch(target, selector, wrapper) { @@ -45,6 +51,9 @@ /** * Get the index of an element amongst sibling nodes of the same type * + * @param {Element} el + * @param {string} [amongst=null] + * @return {number} */ function nodeIndex(el, amongst) { @@ -75,7 +84,7 @@ * governing permissions and limitations under the License. * */ - var plugin = TomSelect__default['default'].define('optgroup_columns', function (options) { + TomSelect__default['default'].define('optgroup_columns', function (options) { var self = this; var orig_keydown = self.onKeyDown; self.hook('instead', 'onKeyDown', function (evt) { @@ -108,7 +117,5 @@ }); }); - return plugin; - }))); //# sourceMappingURL=optgroup_columns.js.map diff --git a/dist/js/plugins/optgroup_columns.js.map b/dist/js/plugins/optgroup_columns.js.map index d2a3bd3a..c4735656 100644 --- a/dist/js/plugins/optgroup_columns.js.map +++ b/dist/js/plugins/optgroup_columns.js.map @@ -1 +1 @@ -{"version":3,"file":"optgroup_columns.js","sources":["../../../src/constants.js","../../../src/vanilla.js","../../../src/plugins/optgroup_columns/plugin.js"],"sourcesContent":["export const KEY_A\t\t\t\t= 65;\nexport const KEY_RETURN\t\t= 13;\nexport const KEY_ESC\t\t\t= 27;\nexport const KEY_LEFT\t\t\t= 37;\nexport const KEY_UP\t\t\t= 38;\nexport const KEY_RIGHT\t\t\t= 39;\nexport const KEY_DOWN\t\t\t= 40;\nexport const KEY_BACKSPACE\t\t= 8;\nexport const KEY_DELETE\t\t= 46;\nexport const KEY_SHIFT\t\t\t= 16;\nexport const KEY_CTRL\t\t\t= 17;\nexport const KEY_TAB\t\t\t= 9;\n","\n/**\n * Return a dom element from either a dom query string, jQuery object, a dom element or html string\n * https://stackoverflow.com/questions/494143/creating-a-new-dom-element-from-an-html-string-using-built-in-dom-methods-or-pro/35385518#35385518\n *\n * @param {any} query .. should be {HTMLElement|string|JQuery}\n * @return {HTMLElement}\n */\nexport function getDom( query ){\n\n\tif( query.jquery ){\n\t\treturn query[0];\n\t}\n\n\tif( query instanceof HTMLElement ){\n\t\treturn query;\n\t}\n\n\tif( query.indexOf('<') > -1 ){\n\t\tlet div = document.createElement('div');\n\t\tdiv.innerHTML = query.trim(); // Never return a text node of whitespace as the result\n\t\treturn div.querySelector(':first-child');\n\t}\n\n\treturn document.querySelector(query);\n};\n\n/**\n * Dispatch an event\n *\n */\nexport function triggerEvent( dom_el, event_name ){\n\tvar event = document.createEvent('HTMLEvents');\n\tevent.initEvent(event_name, true, false);\n\tdom_el.dispatchEvent(event)\n};\n\n/**\n * Apply CSS rules to a dom element\n *\n */\nexport function applyCSS( dom_el, css){\n\tObject.keys(css).forEach(function(name){\n\t\tdom_el.style[name] = css[name];\n\t});\n}\n\n\n/**\n * Add css classes\n *\n */\nexport function addClasses( elmts ){\n\n\tvar classes\t\t= classesArray.apply(null,arguments);\n\telmts\t\t\t= castAsArray(elmts);\n\n\telmts.map( el => {\n\t\tclasses.map( cls => {\n\t\t\tel.classList.add( cls );\n\t\t});\n\t});\n}\n\n/**\n * Remove css classes\n *\n */\n export function removeClasses( elmts ){\n\n \tvar classes \t= classesArray.apply(null,arguments);\n\telmts\t\t= castAsArray(elmts);\n\n\telmts.map( el => {\n\t\tclasses.map(cls => {\n\t \t\tel.classList.remove( cls );\n\t\t});\n \t});\n }\n\n\n/**\n * Return arguments\n *\n */\nexport function classesArray(){\n\tvar classes = [];\n\tfor( let i = 1; i < arguments.length; i++ ){\n\t\tlet _classes = arguments[i];\n\t\tif( typeof _classes === 'string' ){\n\t\t\t_classes = _classes.trim().split(/[\\11\\12\\14\\15\\40]/);\n\t\t}\n\t\tif( Array.isArray(_classes) ){\n\t\t\tclasses = classes.concat(_classes);\n\t\t}\n\t}\n\n\treturn classes.filter(Boolean);\n}\n\nexport function castAsArray(arg){\n\tif( !Array.isArray(arg) ){\n \t\targ = [arg];\n \t}\n\treturn arg;\n}\n\n\n/**\n * Get the closest node to the evt.target matching the selector\n * Stops at wrapper\n *\n */\nexport function parentMatch(target, selector, wrapper ){\n\n\tif( wrapper && !wrapper.contains(target) ){\n\t\treturn;\n\t}\n\n\twhile( target && target.matches ){\n\n\t\tif( target.matches(selector) ){\n\t\t\treturn target;\n\t\t}\n\n\t\ttarget = target.parentNode;\n\t}\n}\n\n/**\n * Get the first or last item from a querySelectorAll result\n *\n * > 0 - right (last)\n * < 0 - left (first)\n *\n */\nexport function querySelectorEnd( el, query, direction){\n\tvar result = el.querySelectorAll(query);\n\tif( !result ){\n\t\treturn;\n\t}\n\n\treturn getTail(result,direction);\n};\n\n\n/**\n * Get the first or last item from an array\n *\n */\nexport function getTail( array, direction ){\n\n\tif( direction > 0 ){\n\t\treturn array[array.length-1];\n\t}\n\n\treturn array[0];\n}\n\n/**\n * Return true if an object is empty\n *\n */\nexport function isEmptyObject(obj){\n\treturn (Object.keys(obj).length === 0);\n}\n\n\n/**\n * Get the index of an element amongst sibling nodes of the same type\n *\n */\nexport function nodeIndex( el, amongst ){\n\tif (!el) return -1;\n\n\tamongst = amongst || el.nodeName;\n\n\tvar i = 0;\n\twhile( el = el.previousElementSibling ){\n\n\t\tif( el.matches(amongst) ){\n\t\t\ti++;\n\t\t}\n\t}\n\treturn i;\n}\n","/**\n * Plugin: \"optgroup_columns\" (Tom Select.js)\n * Copyright (c) contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this\n * file except in compliance with the License. You may obtain a copy of the License at:\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n * ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n *\n */\n\nimport TomSelect from '../../tom-select.js';\nimport * as constants from '../../constants.js';\nimport { parentMatch, nodeIndex } from '../../vanilla.js';\n\nexport default TomSelect.define('optgroup_columns', function(options) {\n\tvar self = this;\n\n\tvar orig_keydown = self.onKeyDown;\n\n\tself.hook('instead','onKeyDown',function( evt ) {\n\t\tvar index, option, options, optgroup;\n\n\t\tif( !self.isOpen || !(evt.keyCode === constants.KEY_LEFT || evt.keyCode === constants.KEY_RIGHT)) {\n\t\t\treturn orig_keydown.apply(self,arguments);\n\t\t}\n\n\t\tself.ignoreHover\t= true;\n\t\toptgroup\t\t\t= parentMatch(self.activeOption,'[data-group]');\n\t\tindex\t\t\t\t= nodeIndex(self.activeOption,'[data-selectable]');\n\n\t\tif( evt.keyCode === constants.KEY_LEFT ){\n\t\t\toptgroup = optgroup.previousSibling;\n\t\t} else {\n\t\t\toptgroup = optgroup.nextSibling;\n\t\t}\n\n\t\tif( !optgroup ){\n\t\t\treturn;\n\t\t}\n\n\t\toptions\t\t\t\t= optgroup.querySelectorAll('[data-selectable]');\n\t\toption\t\t\t\t= options[ Math.min(options.length - 1, index) ];\n\n\t\tif( option ){\n\t\t\tself.setActiveOption(option);\n\t\t}\n\n\t});\n\n});\n"],"names":["KEY_LEFT","KEY_RIGHT","parentMatch","target","selector","wrapper","contains","matches","parentNode","nodeIndex","el","amongst","nodeName","i","previousElementSibling","TomSelect","define","options","self","orig_keydown","onKeyDown","hook","evt","index","option","optgroup","isOpen","keyCode","constants","apply","arguments","ignoreHover","activeOption","previousSibling","nextSibling","querySelectorAll","Math","min","length","setActiveOption"],"mappings":";;;;;;;;;;;;;;;CAGO,IAAMA,QAAQ,GAAK,EAAnB;CAEA,IAAMC,SAAS,GAAK,EAApB;;CCJP;;;;;;;CA2GA;;;;;;CAKO,SAASC,WAAT,CAAqBC,MAArB,EAA6BC,QAA7B,EAAuCC,OAAvC,EAAgD;CAEtD,MAAIA,OAAO,IAAI,CAACA,OAAO,CAACC,QAAR,CAAiBH,MAAjB,CAAhB,EAA0C;CACzC;CACA;;CAED,SAAOA,MAAM,IAAIA,MAAM,CAACI,OAAxB,EAAiC;CAEhC,QAAIJ,MAAM,CAACI,OAAP,CAAeH,QAAf,CAAJ,EAA8B;CAC7B,aAAOD,MAAP;CACA;;CAEDA,IAAAA,MAAM,GAAGA,MAAM,CAACK,UAAhB;CACA;CACD;CAyCD;;;;;CAIO,SAASC,SAAT,CAAoBC,EAApB,EAAwBC,OAAxB,EAAiC;CACvC,MAAI,CAACD,EAAL,EAAS,OAAO,CAAC,CAAR;CAETC,EAAAA,OAAO,GAAGA,OAAO,IAAID,EAAE,CAACE,QAAxB;CAEA,MAAIC,CAAC,GAAG,CAAR;;CACA,SAAOH,EAAE,GAAGA,EAAE,CAACI,sBAAf,EAAuC;CAEtC,QAAIJ,EAAE,CAACH,OAAH,CAAWI,OAAX,CAAJ,EAAyB;CACxBE,MAAAA,CAAC;CACD;CACD;;CACD,SAAOA,CAAP;CACA;;CCzLD;;;;;;;;;;;;;;AAmBA,cAAeE,6BAAS,CAACC,MAAV,CAAiB,kBAAjB,EAAqC,UAASC,OAAT,EAAkB;CACrE,MAAIC,IAAI,GAAG,IAAX;CAEA,MAAIC,YAAY,GAAGD,IAAI,CAACE,SAAxB;CAEAF,EAAAA,IAAI,CAACG,IAAL,CAAU,SAAV,EAAoB,WAApB,EAAgC,UAAUC,GAAV,EAAgB;CAC/C,QAAIC,KAAJ,EAAWC,MAAX,EAAmBP,OAAnB,EAA4BQ,QAA5B;;CAEA,QAAI,CAACP,IAAI,CAACQ,MAAN,IAAgB,EAAEJ,GAAG,CAACK,OAAJ,KAAgBC,QAAhB,IAAsCN,GAAG,CAACK,OAAJ,KAAgBC,SAAxD,CAApB,EAAkG;CACjG,aAAOT,YAAY,CAACU,KAAb,CAAmBX,IAAnB,EAAwBY,SAAxB,CAAP;CACA;;CAEDZ,IAAAA,IAAI,CAACa,WAAL,GAAmB,IAAnB;CACAN,IAAAA,QAAQ,GAAKvB,WAAW,CAACgB,IAAI,CAACc,YAAN,EAAmB,cAAnB,CAAxB;CACAT,IAAAA,KAAK,GAAMd,SAAS,CAACS,IAAI,CAACc,YAAN,EAAmB,mBAAnB,CAApB;;CAEA,QAAIV,GAAG,CAACK,OAAJ,KAAgBC,QAApB,EAAwC;CACvCH,MAAAA,QAAQ,GAAGA,QAAQ,CAACQ,eAApB;CACA,KAFD,MAEO;CACNR,MAAAA,QAAQ,GAAGA,QAAQ,CAACS,WAApB;CACA;;CAED,QAAI,CAACT,QAAL,EAAe;CACd;CACA;;CAEDR,IAAAA,OAAO,GAAMQ,QAAQ,CAACU,gBAAT,CAA0B,mBAA1B,CAAb;CACAX,IAAAA,MAAM,GAAMP,OAAO,CAAEmB,IAAI,CAACC,GAAL,CAASpB,OAAO,CAACqB,MAAR,GAAiB,CAA1B,EAA6Bf,KAA7B,CAAF,CAAnB;;CAEA,QAAIC,MAAJ,EAAY;CACXN,MAAAA,IAAI,CAACqB,eAAL,CAAqBf,MAArB;CACA;CAED,GA5BD;CA8BA,CAnCc,CAAf;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"optgroup_columns.js","sources":["../../../src/constants.js","../../../src/vanilla.js","../../../src/plugins/optgroup_columns/plugin.js"],"sourcesContent":["export const KEY_A\t\t\t\t= 65;\nexport const KEY_RETURN\t\t\t= 13;\nexport const KEY_ESC\t\t\t= 27;\nexport const KEY_LEFT\t\t\t= 37;\nexport const KEY_UP\t\t\t\t= 38;\nexport const KEY_RIGHT\t\t\t= 39;\nexport const KEY_DOWN\t\t\t= 40;\nexport const KEY_BACKSPACE\t\t= 8;\nexport const KEY_DELETE\t\t\t= 46;\nexport const KEY_TAB\t\t\t= 9;\n\nexport const IS_MAC \t\t= /Mac/.test(navigator.userAgent);\nexport const KEY_SHORTCUT\t\t= IS_MAC ? 'metaKey' : 'ctrlKey'; // ctrl key or apple key for ma\n","\n/**\n * Return a dom element from either a dom query string, jQuery object, a dom element or html string\n * https://stackoverflow.com/questions/494143/creating-a-new-dom-element-from-an-html-string-using-built-in-dom-methods-or-pro/35385518#35385518\n *\n * @param {any} query .. should be {HTMLElement|string|JQuery}\n * @return {HTMLElement}\n */\nexport function getDom( query ){\n\n\tif( query.jquery ){\n\t\treturn query[0];\n\t}\n\n\tif( query instanceof HTMLElement ){\n\t\treturn query;\n\t}\n\n\tif( query.indexOf('<') > -1 ){\n\t\tlet div = document.createElement('div');\n\t\tdiv.innerHTML = query.trim(); // Never return a text node of whitespace as the result\n\t\treturn div.querySelector(':first-child');\n\t}\n\n\treturn document.querySelector(query);\n};\n\n/**\n * Dispatch an event\n *\n * @param {HTMLElement} dom_el\n * @param {string} event_name\n */\nexport function triggerEvent( dom_el, event_name ){\n\tvar event = document.createEvent('HTMLEvents');\n\tevent.initEvent(event_name, true, false);\n\tdom_el.dispatchEvent(event)\n};\n\n/**\n * Apply CSS rules to a dom element\n *\n * @param {HTMLElement} dom_el\n * @param {object} css\n */\nexport function applyCSS( dom_el, css){\n\tObject.keys(css).forEach(function(name){\n\t\tdom_el.style[name] = css[name];\n\t});\n}\n\n\n/**\n * Add css classes\n *\n */\nexport function addClasses( elmts ){\n\n\tvar classes\t\t= classesArray.apply(null,arguments);\n\telmts\t\t\t= castAsArray(elmts);\n\n\telmts.map( el => {\n\t\tclasses.map( cls => {\n\t\t\tel.classList.add( cls );\n\t\t});\n\t});\n}\n\n/**\n * Remove css classes\n *\n */\n export function removeClasses( elmts ){\n\n \tvar classes \t= classesArray.apply(null,arguments);\n\telmts\t\t= castAsArray(elmts);\n\n\telmts.map( el => {\n\t\tclasses.map(cls => {\n\t \t\tel.classList.remove( cls );\n\t\t});\n \t});\n }\n\n\n/**\n * Return arguments\n *\n * @return {array}\n */\nexport function classesArray(){\n\tvar classes = [];\n\tfor( let i = 1; i < arguments.length; i++ ){\n\t\tlet _classes = arguments[i];\n\t\tif( typeof _classes === 'string' ){\n\t\t\t_classes = _classes.trim().split(/[\\11\\12\\14\\15\\40]/);\n\t\t}\n\t\tif( Array.isArray(_classes) ){\n\t\t\tclasses = classes.concat(_classes);\n\t\t}\n\t}\n\n\treturn classes.filter(Boolean);\n}\n\n\n/**\n * Create an array from arg if it's not already an array\n *\n *\n * @param {any} arg\n * @return {array}\n */\nexport function castAsArray(arg){\n\tif( !Array.isArray(arg) ){\n \t\targ = [arg];\n \t}\n\treturn arg;\n}\n\n\n/**\n * Get the closest node to the evt.target matching the selector\n * Stops at wrapper\n *\n * param {HTMLElement} target\n * @param {string} selector\n * @param {HTMLElement} [wrapper=null]\n * return {HTMLElement}\n */\nexport function parentMatch( target, selector, wrapper ){\n\n\tif( wrapper && !wrapper.contains(target) ){\n\t\treturn;\n\t}\n\n\twhile( target && target.matches ){\n\n\t\tif( target.matches(selector) ){\n\t\t\treturn target;\n\t\t}\n\n\t\ttarget = target.parentNode;\n\t}\n}\n\n/**\n * Get the first or last item from a querySelectorAll result\n *\n * > 0 - right (last)\n * < 0 - left (first)\n *\n * @param {HTMLElement} el\n * @param {string} query\n * @param {number} direction\n * @return {HTMLElement}\n */\nexport function querySelectorEnd( el, query, direction){\n\tvar result = el.querySelectorAll(query);\n\tif( !result ){\n\t\treturn;\n\t}\n\n\treturn getTail(result,direction);\n};\n\n\n/**\n * Get the first or last item from an array\n *\n * @param {array|NodeList} array\n * @param {number} direction\n * @return {any}\n */\nexport function getTail( array, direction ){\n\n\tif( direction > 0 ){\n\t\treturn array[array.length-1];\n\t}\n\n\treturn array[0];\n}\n\n/**\n * Return true if an object is empty\n *\n * @param {object} obj\n * @return {boolean}\n */\nexport function isEmptyObject(obj){\n\treturn (Object.keys(obj).length === 0);\n}\n\n\n/**\n * Get the index of an element amongst sibling nodes of the same type\n *\n * @param {Element} el\n * @param {string} [amongst=null]\n * @return {number}\n */\nexport function nodeIndex( el, amongst ){\n\tif (!el) return -1;\n\n\tamongst = amongst || el.nodeName;\n\n\tvar i = 0;\n\twhile( el = el.previousElementSibling ){\n\n\t\tif( el.matches(amongst) ){\n\t\t\ti++;\n\t\t}\n\t}\n\treturn i;\n}\n","/**\n * Plugin: \"optgroup_columns\" (Tom Select.js)\n * Copyright (c) contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this\n * file except in compliance with the License. You may obtain a copy of the License at:\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n * ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n *\n */\n\nimport TomSelect from '../../tom-select.js';\nimport * as constants from '../../constants.js';\nimport { parentMatch, nodeIndex } from '../../vanilla.js';\n\nTomSelect.define('optgroup_columns', function(options) {\n\tvar self = this;\n\n\tvar orig_keydown = self.onKeyDown;\n\n\tself.hook('instead','onKeyDown',function( evt ) {\n\t\tvar index, option, options, optgroup;\n\n\t\tif( !self.isOpen || !(evt.keyCode === constants.KEY_LEFT || evt.keyCode === constants.KEY_RIGHT)) {\n\t\t\treturn orig_keydown.apply(self,arguments);\n\t\t}\n\n\t\tself.ignoreHover\t= true;\n\t\toptgroup\t\t\t= parentMatch(self.activeOption,'[data-group]');\n\t\tindex\t\t\t\t= nodeIndex(self.activeOption,'[data-selectable]');\n\n\t\tif( evt.keyCode === constants.KEY_LEFT ){\n\t\t\toptgroup = optgroup.previousSibling;\n\t\t} else {\n\t\t\toptgroup = optgroup.nextSibling;\n\t\t}\n\n\t\tif( !optgroup ){\n\t\t\treturn;\n\t\t}\n\n\t\toptions\t\t\t\t= optgroup.querySelectorAll('[data-selectable]');\n\t\toption\t\t\t\t= options[ Math.min(options.length - 1, index) ];\n\n\t\tif( option ){\n\t\t\tself.setActiveOption(option);\n\t\t}\n\n\t});\n\n});\n"],"names":["KEY_LEFT","KEY_RIGHT","IS_MAC","test","navigator","userAgent","parentMatch","target","selector","wrapper","contains","matches","parentNode","nodeIndex","el","amongst","nodeName","i","previousElementSibling","TomSelect","define","options","self","orig_keydown","onKeyDown","hook","evt","index","option","optgroup","isOpen","keyCode","constants","apply","arguments","ignoreHover","activeOption","previousSibling","nextSibling","querySelectorAll","Math","min","length","setActiveOption"],"mappings":";;;;;;;;;;;;;;;CAGO,IAAMA,QAAQ,GAAK,EAAnB;CAEA,IAAMC,SAAS,GAAK,EAApB;CAMA,IAAMC,MAAM,GAAU,MAAMC,IAAN,CAAWC,SAAS,CAACC,SAArB,CAAtB;;;CCVP;;;;;;;CAwHA;;;;;;;;;;CASO,SAASC,WAAT,CAAsBC,MAAtB,EAA8BC,QAA9B,EAAwCC,OAAxC,EAAiD;CAEvD,MAAIA,OAAO,IAAI,CAACA,OAAO,CAACC,QAAR,CAAiBH,MAAjB,CAAhB,EAA0C;CACzC;CACA;;CAED,SAAOA,MAAM,IAAIA,MAAM,CAACI,OAAxB,EAAiC;CAEhC,QAAIJ,MAAM,CAACI,OAAP,CAAeH,QAAf,CAAJ,EAA8B;CAC7B,aAAOD,MAAP;CACA;;CAEDA,IAAAA,MAAM,GAAGA,MAAM,CAACK,UAAhB;CACA;CACD;CAkDD;;;;;;;;CAOO,SAASC,SAAT,CAAoBC,EAApB,EAAwBC,OAAxB,EAAiC;CACvC,MAAI,CAACD,EAAL,EAAS,OAAO,CAAC,CAAR;CAETC,EAAAA,OAAO,GAAGA,OAAO,IAAID,EAAE,CAACE,QAAxB;CAEA,MAAIC,CAAC,GAAG,CAAR;;CACA,SAAOH,EAAE,GAA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C,GAAL,CAASpB,OAAO,CAACqB,MAAR,GAAiB,CAA1B,EAA6Bf,KAA7B,CAAF,CAAnB;;CAEA,QAAIC,MAAJ,EAAY;CACXN,MAAAA,IAAI,CAACqB,eAAL,CAAqBf,MAArB;CACA;CAED,GA5BD;CA8BA,CAnCD;;;;;;"} \ No newline at end of file diff --git a/dist/js/plugins/remove_button.js b/dist/js/plugins/remove_button.js index d5c6bbc9..8489b0e4 100644 --- a/dist/js/plugins/remove_button.js +++ b/dist/js/plugins/remove_button.js @@ -1,12 +1,12 @@ /** -* Tom Select v1.0.0-rc.3 +* Tom Select v1.0.0 * Licensed under the Apache License, Version 2.0 (the "License"); */ (function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('../../tom-select.js')) : + typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('../../tom-select.js')) : typeof define === 'function' && define.amd ? define(['../../tom-select.js'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.remove_button = factory(global.TomSelect)); + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TomSelect)); }(this, (function (TomSelect) { 'use strict'; function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } @@ -80,7 +80,7 @@ * governing permissions and limitations under the License. * */ - var plugin = TomSelect__default['default'].define('remove_button', function (options) { + TomSelect__default['default'].define('remove_button', function (options) { options = Object.assign({ label: '×', title: 'Remove', @@ -124,7 +124,5 @@ }); }); - return plugin; - }))); //# sourceMappingURL=remove_button.js.map diff --git a/dist/js/plugins/remove_button.js.map b/dist/js/plugins/remove_button.js.map index ff2805fe..6873db76 100644 --- a/dist/js/plugins/remove_button.js.map +++ b/dist/js/plugins/remove_button.js.map @@ -1 +1 @@ -{"version":3,"file":"remove_button.js","sources":["../../../src/vanilla.js","../../../src/utils.js","../../../src/plugins/remove_button/plugin.js"],"sourcesContent":["\n/**\n * Return a dom element from either a dom query string, jQuery object, a dom element or html string\n * https://stackoverflow.com/questions/494143/creating-a-new-dom-element-from-an-html-string-using-built-in-dom-methods-or-pro/35385518#35385518\n *\n * @param {any} query .. should be {HTMLElement|string|JQuery}\n * @return {HTMLElement}\n */\nexport function getDom( query ){\n\n\tif( query.jquery ){\n\t\treturn query[0];\n\t}\n\n\tif( query instanceof HTMLElement ){\n\t\treturn query;\n\t}\n\n\tif( query.indexOf('<') > -1 ){\n\t\tlet div = document.createElement('div');\n\t\tdiv.innerHTML = query.trim(); // Never return a text node of whitespace as the result\n\t\treturn div.querySelector(':first-child');\n\t}\n\n\treturn document.querySelector(query);\n};\n\n/**\n * Dispatch an event\n *\n */\nexport function triggerEvent( dom_el, event_name ){\n\tvar event = document.createEvent('HTMLEvents');\n\tevent.initEvent(event_name, true, false);\n\tdom_el.dispatchEvent(event)\n};\n\n/**\n * Apply CSS rules to a dom element\n *\n */\nexport function applyCSS( dom_el, css){\n\tObject.keys(css).forEach(function(name){\n\t\tdom_el.style[name] = css[name];\n\t});\n}\n\n\n/**\n * Add css classes\n *\n */\nexport function addClasses( elmts ){\n\n\tvar classes\t\t= classesArray.apply(null,arguments);\n\telmts\t\t\t= castAsArray(elmts);\n\n\telmts.map( el => {\n\t\tclasses.map( cls => {\n\t\t\tel.classList.add( cls );\n\t\t});\n\t});\n}\n\n/**\n * Remove css classes\n *\n */\n export function removeClasses( elmts ){\n\n \tvar classes \t= classesArray.apply(null,arguments);\n\telmts\t\t= castAsArray(elmts);\n\n\telmts.map( el => {\n\t\tclasses.map(cls => {\n\t \t\tel.classList.remove( cls );\n\t\t});\n \t});\n }\n\n\n/**\n * Return arguments\n *\n */\nexport function classesArray(){\n\tvar classes = [];\n\tfor( let i = 1; i < arguments.length; i++ ){\n\t\tlet _classes = arguments[i];\n\t\tif( typeof _classes === 'string' ){\n\t\t\t_classes = _classes.trim().split(/[\\11\\12\\14\\15\\40]/);\n\t\t}\n\t\tif( Array.isArray(_classes) ){\n\t\t\tclasses = classes.concat(_classes);\n\t\t}\n\t}\n\n\treturn classes.filter(Boolean);\n}\n\nexport function castAsArray(arg){\n\tif( !Array.isArray(arg) ){\n \t\targ = [arg];\n \t}\n\treturn arg;\n}\n\n\n/**\n * Get the closest node to the evt.target matching the selector\n * Stops at wrapper\n *\n */\nexport function parentMatch(target, selector, wrapper ){\n\n\tif( wrapper && !wrapper.contains(target) ){\n\t\treturn;\n\t}\n\n\twhile( target && target.matches ){\n\n\t\tif( target.matches(selector) ){\n\t\t\treturn target;\n\t\t}\n\n\t\ttarget = target.parentNode;\n\t}\n}\n\n/**\n * Get the first or last item from a querySelectorAll result\n *\n * > 0 - right (last)\n * < 0 - left (first)\n *\n */\nexport function querySelectorEnd( el, query, direction){\n\tvar result = el.querySelectorAll(query);\n\tif( !result ){\n\t\treturn;\n\t}\n\n\treturn getTail(result,direction);\n};\n\n\n/**\n * Get the first or last item from an array\n *\n */\nexport function getTail( array, direction ){\n\n\tif( direction > 0 ){\n\t\treturn array[array.length-1];\n\t}\n\n\treturn array[0];\n}\n\n/**\n * Return true if an object is empty\n *\n */\nexport function isEmptyObject(obj){\n\treturn (Object.keys(obj).length === 0);\n}\n\n\n/**\n * Get the index of an element amongst sibling nodes of the same type\n *\n */\nexport function nodeIndex( el, amongst ){\n\tif (!el) return -1;\n\n\tamongst = amongst || el.nodeName;\n\n\tvar i = 0;\n\twhile( el = el.previousElementSibling ){\n\n\t\tif( el.matches(amongst) ){\n\t\t\ti++;\n\t\t}\n\t}\n\treturn i;\n}\n","\n\n/**\n * Converts a scalar to its best string representation\n * for hash keys and HTML attribute values.\n *\n * Transformations:\n * 'str' -> 'str'\n * null -> ''\n * undefined -> ''\n * true -> '1'\n * false -> '0'\n * 0 -> '0'\n * 1 -> '1'\n *\n * @param {string} value\n * @returns {string|null}\n */\nexport function hash_key(value) {\n\tif (typeof value === 'undefined' || value === null) return null;\n\tif (typeof value === 'boolean') return value ? '1' : '0';\n\treturn value + '';\n};\n\n/**\n * Escapes a string for use within HTML.\n *\n * @param {string} str\n * @returns {string}\n */\nexport function escape_html(str) {\n\treturn (str + '')\n\t\t.replace(/&/g, '&')\n\t\t.replace(//g, '>')\n\t\t.replace(/\"/g, '"');\n};\n\n\n/**\n * Debounce all fired events types listed in `types`\n * while executing the provided `fn`.\n *\n * @param {object} self\n * @param {array} types\n * @param {function} fn\n */\nexport function debounce_events( self, types, fn) {\n\tvar type;\n\tvar trigger = self.trigger;\n\tvar event_args = {};\n\n\t// override trigger method\n\tself.trigger = function() {\n\t\tvar type = arguments[0];\n\t\tif (types.indexOf(type) !== -1) {\n\t\t\tevent_args[type] = arguments;\n\t\t} else {\n\t\t\treturn trigger.apply(self, arguments);\n\t\t}\n\t};\n\n\t// invoke provided function\n\tfn.apply(self, []);\n\tself.trigger = trigger;\n\n\t// trigger queued events\n\tfor (type in event_args) {\n\t\tif (event_args.hasOwnProperty(type)) {\n\t\t\ttrigger.apply(self, event_args[type]);\n\t\t}\n\t}\n};\n\n\n/**\n * Determines the current selection within a text input control.\n * Returns an object containing:\n * - start\n * - length\n *\n * @param {object} input\n * @returns {object}\n */\nexport function getSelection(input) {\n\treturn {\n\t\tstart\t: input.selectionStart,\n\t\tlength\t: input.selectionEnd - input.selectionStart,\n\t};\n};\n","/**\n * Plugin: \"remove_button\" (Tom Select)\n * Copyright (c) contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this\n * file except in compliance with the License. You may obtain a copy of the License at:\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n * ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n *\n */\nimport TomSelect from '../../tom-select.js';\nimport { getDom } from '../../vanilla.js';\nimport { escape_html } from '../../utils.js';\n\nexport default TomSelect.define('remove_button',function(options) {\n\n\toptions = Object.assign({\n\t\t\tlabel : '×',\n\t\t\ttitle : 'Remove',\n\t\t\tclassName : 'remove',\n\t\t\tappend : true\n\t\t}, options);\n\n\n\t//options.className = 'remove-single';\n\tvar self\t\t\t= this;\n\n\t// override the render method to add remove button to each item\n\tif( !options.append ){\n\t\treturn;\n\t}\n\n\tvar html = '' + options.label + '';\n\n\tself.hook('after','setupTemplates',function(){\n\n\t\tvar orig_render_item = self.settings.render.item;\n\n\t\tself.settings.render.item = function(){\n\n\t\t\tvar rendered = getDom(orig_render_item.apply(self, arguments));\n\n\t\t\tvar close_button = getDom(html);\n\t\t\trendered.appendChild(close_button);\n\n\t\t\tclose_button.addEventListener('mousedown',function(evt){\n\t\t\t\tevt.preventDefault();\n\t\t\t\tevt.stopPropagation();\n\t\t\t});\n\n\t\t\tclose_button.addEventListener('click',function(evt){\n\t\t\t\tevt.preventDefault();\n\t\t\t\tevt.stopPropagation();\n\n\t\t\t\t// propagating will trigger the dropdown to show for single mode\n\t\t\t\tif( self.settings.mode !== 'single' ){\n\t\t\t\t\tevt.stopPropagation();\n\t\t\t\t}\n\n\t\t\t\tif (self.isLocked) return;\n\n\t\t\t\tvar value = rendered.dataset.value;\n\t\t\t\tself.removeItem(value);\n\t\t\t\tself.refreshOptions(false);\n\t\t\t});\n\n\t\t\treturn rendered;\n\t\t};\n\n\t});\n\n\n});\n"],"names":["getDom","query","jquery","HTMLElement","indexOf","div","document","createElement","innerHTML","trim","querySelector","escape_html","str","replace","TomSelect","define","options","Object","assign","label","title","className","append","self","html","hook","orig_render_item","settings","render","item","rendered","apply","arguments","close_button","appendChild","addEventListener","evt","preventDefault","stopPropagation","mode","isLocked","value","dataset","removeItem","refreshOptions"],"mappings":";;;;;;;;;;;;;;;CACA;;;;;;;CAOO,SAASA,MAAT,CAAiBC,KAAjB,EAAwB;CAE9B,MAAIA,KAAK,CAACC,MAAV,EAAkB;CACjB,WAAOD,KAAK,CAAC,CAAD,CAAZ;CACA;;CAED,MAAIA,KAAK,YAAYE,WAArB,EAAkC;CACjC,WAAOF,KAAP;CACA;;CAED,MAAIA,KAAK,CAACG,OAAN,CA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QAAIC,gBAAgB,GAAGH,IAAI,CAACI,QAAL,CAAcC,MAAd,CAAqBC,IAA5C;;CAEAN,IAAAA,IAAI,CAACI,QAAL,CAAcC,MAAd,CAAqBC,IAArB,GAA4B,YAAU;CAErC,UAAIC,QAAQ,GAAG9B,MAAM,CAAC0B,gBAAgB,CAACK,KAAjB,CAAuBR,IAAvB,EAA6BS,SAA7B,CAAD,CAArB;CAEA,UAAIC,YAAY,GAAGjC,MAAM,CAACwB,IAAD,CAAzB;CACAM,MAAAA,QAAQ,CAACI,WAAT,CAAqBD,YAArB;CAEAA,MAAAA,YAAY,CAACE,gBAAb,CAA8B,WAA9B,EAA0C,UAASC,GAAT,EAAa;CACtDA,QAAAA,GAAG,CAACC,cAAJ;CACAD,QAAAA,GAAG,CAACE,eAAJ;CACA,OAHD;CAKAL,MAAAA,YAAY,CAACE,gBAAb,CAA8B,OAA9B,EAAsC,UAASC,GAAT,EAAa;CAClDA,QAAAA,GAAG,CAACC,cAAJ;CACAD,QAAAA,GAAG,CAACE,eAAJ,GAFkD;;CAKlD,YAAIf,IAAI,CAACI,QAAL,CAAcY,IAAd,KAAuB,QAA3B,EAAqC;CACpCH,UAAAA,GAAG,CAACE,eAAJ;CACA;;CAED,YAAIf,IAAI,CAACiB,QAAT,EAAmB;CAEnB,YAAIC,KAAK,GAAGX,QAAQ,CAACY,OAAT,CAAiBD,KAA7B;CACAlB,QAAAA,IAAI,CAACoB,UAAL,CAAgBF,KAAhB;CACAlB,QAAAA,IAAI,CAACqB,cAAL,CAAoB,KAApB;CACA,OAdD;CAgBA,aAAOd,QAAP;CACA,KA7BD;CA+BA,GAnCD;CAsCA,CA1Dc,CAAf;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"remove_button.js","sources":["../../../src/vanilla.js","../../../src/utils.js","../../../src/plugins/remove_button/plugin.js"],"sourcesContent":["\n/**\n * Return a dom element from either a dom query string, jQuery object, a dom element or html string\n * https://stackoverflow.com/questions/494143/creating-a-new-dom-element-from-an-html-string-using-built-in-dom-methods-or-pro/35385518#35385518\n *\n * @param {any} query .. should be {HTMLElement|string|JQuery}\n * @return {HTMLElement}\n */\nexport function getDom( query ){\n\n\tif( query.jquery ){\n\t\treturn query[0];\n\t}\n\n\tif( query instanceof HTMLElement ){\n\t\treturn query;\n\t}\n\n\tif( query.indexOf('<') > -1 ){\n\t\tlet div = document.createElement('div');\n\t\tdiv.innerHTML = query.trim(); // Never return a text node of whitespace as the result\n\t\treturn div.querySelector(':first-child');\n\t}\n\n\treturn document.querySelector(query);\n};\n\n/**\n * Dispatch an event\n *\n * @param {HTMLElement} dom_el\n * @param {string} event_name\n */\nexport function triggerEvent( dom_el, event_name ){\n\tvar event = document.createEvent('HTMLEvents');\n\tevent.initEvent(event_name, true, false);\n\tdom_el.dispatchEvent(event)\n};\n\n/**\n * Apply CSS rules to a dom element\n *\n * @param {HTMLElement} dom_el\n * @param {object} css\n */\nexport function applyCSS( dom_el, css){\n\tObject.keys(css).forEach(function(name){\n\t\tdom_el.style[name] = css[name];\n\t});\n}\n\n\n/**\n * Add css classes\n *\n */\nexport function addClasses( elmts ){\n\n\tvar classes\t\t= classesArray.apply(null,arguments);\n\telmts\t\t\t= castAsArray(elmts);\n\n\telmts.map( el => {\n\t\tclasses.map( cls => {\n\t\t\tel.classList.add( cls );\n\t\t});\n\t});\n}\n\n/**\n * Remove css classes\n *\n */\n export function removeClasses( elmts ){\n\n \tvar classes \t= classesArray.apply(null,arguments);\n\telmts\t\t= castAsArray(elmts);\n\n\telmts.map( el => {\n\t\tclasses.map(cls => {\n\t \t\tel.classList.remove( cls );\n\t\t});\n \t});\n }\n\n\n/**\n * Return arguments\n *\n * @return {array}\n */\nexport function classesArray(){\n\tvar classes = [];\n\tfor( let i = 1; i < arguments.length; i++ ){\n\t\tlet _classes = arguments[i];\n\t\tif( typeof _classes === 'string' ){\n\t\t\t_classes = _classes.trim().split(/[\\11\\12\\14\\15\\40]/);\n\t\t}\n\t\tif( Array.isArray(_classes) ){\n\t\t\tclasses = classes.concat(_classes);\n\t\t}\n\t}\n\n\treturn classes.filter(Boolean);\n}\n\n\n/**\n * Create an array from arg if it's not already an array\n *\n *\n * @param {any} arg\n * @return {array}\n */\nexport function castAsArray(arg){\n\tif( !Array.isArray(arg) ){\n \t\targ = [arg];\n \t}\n\treturn arg;\n}\n\n\n/**\n * Get the closest node to the evt.target matching the selector\n * Stops at wrapper\n *\n * param {HTMLElement} target\n * @param {string} selector\n * @param {HTMLElement} [wrapper=null]\n * return {HTMLElement}\n */\nexport function parentMatch( target, selector, wrapper ){\n\n\tif( wrapper && !wrapper.contains(target) ){\n\t\treturn;\n\t}\n\n\twhile( target && target.matches ){\n\n\t\tif( target.matches(selector) ){\n\t\t\treturn target;\n\t\t}\n\n\t\ttarget = target.parentNode;\n\t}\n}\n\n/**\n * Get the first or last item from a querySelectorAll result\n *\n * > 0 - right (last)\n * < 0 - left (first)\n *\n * @param {HTMLElement} el\n * @param {string} query\n * @param {number} direction\n * @return {HTMLElement}\n */\nexport function querySelectorEnd( el, query, direction){\n\tvar result = el.querySelectorAll(query);\n\tif( !result ){\n\t\treturn;\n\t}\n\n\treturn getTail(result,direction);\n};\n\n\n/**\n * Get the first or last item from an array\n *\n * @param {array|NodeList} array\n * @param {number} direction\n * @return {any}\n */\nexport function getTail( array, direction ){\n\n\tif( direction > 0 ){\n\t\treturn array[array.length-1];\n\t}\n\n\treturn array[0];\n}\n\n/**\n * Return true if an object is empty\n *\n * @param {object} obj\n * @return {boolean}\n */\nexport function isEmptyObject(obj){\n\treturn (Object.keys(obj).length === 0);\n}\n\n\n/**\n * Get the index of an element amongst sibling nodes of the same type\n *\n * @param {Element} el\n * @param {string} [amongst=null]\n * @return {number}\n */\nexport function nodeIndex( el, amongst ){\n\tif (!el) return -1;\n\n\tamongst = amongst || el.nodeName;\n\n\tvar i = 0;\n\twhile( el = el.previousElementSibling ){\n\n\t\tif( el.matches(amongst) ){\n\t\t\ti++;\n\t\t}\n\t}\n\treturn i;\n}\n","\n\n/**\n * Converts a scalar to its best string representation\n * for hash keys and HTML attribute values.\n *\n * Transformations:\n * 'str' -> 'str'\n * null -> ''\n * undefined -> ''\n * true -> '1'\n * false -> '0'\n * 0 -> '0'\n * 1 -> '1'\n *\n * @param {string} value\n * @returns {string|null}\n */\nexport function hash_key(value) {\n\tif (typeof value === 'undefined' || value === null) return null;\n\tif (typeof value === 'boolean') return value ? '1' : '0';\n\treturn value + '';\n};\n\n/**\n * Escapes a string for use within HTML.\n *\n * @param {string} str\n * @returns {string}\n */\nexport function escape_html(str) {\n\treturn (str + '')\n\t\t.replace(/&/g, '&')\n\t\t.replace(//g, '>')\n\t\t.replace(/\"/g, '"');\n};\n\n\n/**\n * Debounce all fired events types listed in `types`\n * while executing the provided `fn`.\n *\n * @param {object} self\n * @param {array} types\n * @param {function} fn\n */\nexport function debounce_events( self, types, fn) {\n\tvar type;\n\tvar trigger = self.trigger;\n\tvar event_args = {};\n\n\t// override trigger method\n\tself.trigger = function() {\n\t\tvar type = arguments[0];\n\t\tif (types.indexOf(type) !== -1) {\n\t\t\tevent_args[type] = arguments;\n\t\t} else {\n\t\t\treturn trigger.apply(self, arguments);\n\t\t}\n\t};\n\n\t// invoke provided function\n\tfn.apply(self, []);\n\tself.trigger = trigger;\n\n\t// trigger queued events\n\tfor (type in event_args) {\n\t\tif (event_args.hasOwnProperty(type)) {\n\t\t\ttrigger.apply(self, event_args[type]);\n\t\t}\n\t}\n};\n\n\n/**\n * Determines the current selection within a text input control.\n * Returns an object containing:\n * - start\n * - length\n *\n * @param {object} input\n * @returns {object}\n */\nexport function getSelection(input) {\n\treturn {\n\t\tstart\t: input.selectionStart,\n\t\tlength\t: input.selectionEnd - input.selectionStart,\n\t};\n};\n","/**\n * Plugin: \"remove_button\" (Tom Select)\n * Copyright (c) contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this\n * file except in compliance with the License. You may obtain a copy of the License at:\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n * ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n *\n */\nimport TomSelect from '../../tom-select.js';\nimport { getDom } from '../../vanilla.js';\nimport { escape_html } from '../../utils.js';\n\nTomSelect.define('remove_button',function(options) {\n\n\toptions = Object.assign({\n\t\t\tlabel : '×',\n\t\t\ttitle : 'Remove',\n\t\t\tclassName : 'remove',\n\t\t\tappend : true\n\t\t}, options);\n\n\n\t//options.className = 'remove-single';\n\tvar self\t\t\t= this;\n\n\t// override the render method to add remove button to each item\n\tif( !options.append ){\n\t\treturn;\n\t}\n\n\tvar html = '' + options.label + '';\n\n\tself.hook('after','setupTemplates',function(){\n\n\t\tvar orig_render_item = self.settings.render.item;\n\n\t\tself.settings.render.item = function(){\n\n\t\t\tvar rendered = getDom(orig_render_item.apply(self, arguments));\n\n\t\t\tvar close_button = getDom(html);\n\t\t\trendered.appendChild(close_button);\n\n\t\t\tclose_button.addEventListener('mousedown',function(evt){\n\t\t\t\tevt.preventDefault();\n\t\t\t\tevt.stopPropagation();\n\t\t\t});\n\n\t\t\tclose_button.addEventListener('click',function(evt){\n\t\t\t\tevt.preventDefault();\n\t\t\t\tevt.stopPropagation();\n\n\t\t\t\t// propagating will trigger the dropdown to show for single mode\n\t\t\t\tif( self.settings.mode !== 'single' ){\n\t\t\t\t\tevt.stopPropagation();\n\t\t\t\t}\n\n\t\t\t\tif (self.isLocked) return;\n\n\t\t\t\tvar value = rendered.dataset.value;\n\t\t\t\tself.removeItem(value);\n\t\t\t\tself.refreshOptions(false);\n\t\t\t});\n\n\t\t\treturn rendered;\n\t\t};\n\n\t});\n\n\n});\n"],"names":["getDom","query","jquery","HTMLElement","indexOf","div","document","createElement","innerHTML","trim","querySelector","escape_html","str","replace","TomSelect","define","options","Object","assign","label","title","className","append","self","html","hook","orig_render_item","settings","render","item","rendered","apply","arguments","close_button","appendChild","addEventListener","evt","preventDefault","stopPropagation","mode","isLocked","value","dataset","removeItem","refreshOptions"],"mappings":";;;;;;;;;;;;;;;CACA;;;;;;;CAOO,SAASA,MAAT,CAAiBC,KAAjB,EAAwB;CAE9B,MAAIA,KAAK,CAACC,MAAV,EAAkB;CACjB,WAAOD,KAAK,CAAC,CAAD,CAAZ;CACA;;CAED,MAAIA,KAAK,YAAYE,WAArB,EAAkC;CACjC,WAAOF,KAAP;CACA;;CAED,MAAIA,KAAK,CAACG,OAAN,CAAc,GAAd,IAAqB,CAAC,CAA1B,EAA6B;CAC5B,QAAIC,GAAG,GAAGC,QAAQ,CAACC,aAAT,CAAuB,KAAvB,CAAV;CACAF,IAAAA,GAAG,CAACG,SAAJ,GAAgBP,KAAK,CAACQ,IAAN,EAAhB,CAF4B;;CAG5B,WAAOJ,GAAG,CAACK,aAAJ,CAAkB,cAAlB,CAAP;CACA;;CAED,SAAOJ,QAAQ,CAACI,aAAT,CAAuBT,KAAvB,CAAP;CACA;;CCvBD;;;;;;;;;;;;;;;;CAsBA;;;;;;;CAMO,SAASU,WAAT,CAAqBC,GAArB,EAA0B;CAChC,SAAO,CAACA,GAAG,GAAG,EAAP,EACLC,OADK,CACG,IADH,EACS,OADT,EAELA,OAFK,CAEG,IAFH,EAES,MAFT,EAGLA,OAHK,CAGG,IAHH,EAGS,MAHT,EAILA,OAJK,CAIG,IAJH,EAIS,QAJT,CAAP;CAKA;;CCpCD;;;;;;;;;;;;;;AAkBAC,8BAAS,CAACC,MAAV,CAAiB,eAAjB,EAAiC,UAASC,OAAT,EAAkB;CAElDA,EAAAA,OAAO,GAAGC,MAAM,CAACC,MAAP,CAAc;CACtBC,IAAAA,KAAK,EAAO,SADU;CAEtBC,IAAAA,KAAK,EAAO,QAFU;CAGtBC,IAAAA,SAAS,EAAG,QAHU;CAItBC,IAAAA,MAAM,EAAM;CAJU,GAAd,EAKNN,OALM,CAAV,CAFkD;;CAWlD,MAAIO,IAAI,GAAK,IAAb,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QAAAA,IAAI,CAACqB,cAAL,CAAoB,KAApB;CACA,OAdD;CAgBA,aAAOd,QAAP;CACA,KA7BD;CA+BA,GAnCD;CAsCA,CA1DD;;;;;;"} \ No newline at end of file diff --git a/dist/js/plugins/restore_on_backspace.js b/dist/js/plugins/restore_on_backspace.js index a6719725..1bf108ce 100644 --- a/dist/js/plugins/restore_on_backspace.js +++ b/dist/js/plugins/restore_on_backspace.js @@ -1,12 +1,12 @@ /** -* Tom Select v1.0.0-rc.3 +* Tom Select v1.0.0 * Licensed under the Apache License, Version 2.0 (the "License"); */ (function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('../../tom-select.js')) : + typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('../../tom-select.js')) : typeof define === 'function' && define.amd ? define(['../../tom-select.js'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.restore_on_backspace = factory(global.TomSelect)); + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TomSelect)); }(this, (function (TomSelect) { 'use strict'; function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } @@ -14,6 +14,8 @@ var TomSelect__default = /*#__PURE__*/_interopDefaultLegacy(TomSelect); var KEY_BACKSPACE = 8; + var IS_MAC = /Mac/.test(navigator.userAgent); + // ctrl key or apple key for ma /** * Plugin: "restore_on_backspace" (Tom Select) @@ -29,7 +31,7 @@ * governing permissions and limitations under the License. * */ - var plugin = TomSelect__default['default'].define('restore_on_backspace', function (options) { + TomSelect__default['default'].define('restore_on_backspace', function (options) { var self = this; options.text = options.text || function (option) { @@ -60,7 +62,5 @@ }); }); - return plugin; - }))); //# sourceMappingURL=restore_on_backspace.js.map diff --git a/dist/js/plugins/restore_on_backspace.js.map b/dist/js/plugins/restore_on_backspace.js.map index d4644382..5b1f51a6 100644 --- a/dist/js/plugins/restore_on_backspace.js.map +++ b/dist/js/plugins/restore_on_backspace.js.map @@ -1 +1 @@ -{"version":3,"file":"restore_on_backspace.js","sources":["../../../src/constants.js","../../../src/plugins/restore_on_backspace/plugin.js"],"sourcesContent":["export const KEY_A\t\t\t\t= 65;\nexport const KEY_RETURN\t\t= 13;\nexport const KEY_ESC\t\t\t= 27;\nexport const KEY_LEFT\t\t\t= 37;\nexport const KEY_UP\t\t\t= 38;\nexport const KEY_RIGHT\t\t\t= 39;\nexport const KEY_DOWN\t\t\t= 40;\nexport const KEY_BACKSPACE\t\t= 8;\nexport const KEY_DELETE\t\t= 46;\nexport const KEY_SHIFT\t\t\t= 16;\nexport const KEY_CTRL\t\t\t= 17;\nexport const KEY_TAB\t\t\t= 9;\n","/**\n * Plugin: \"restore_on_backspace\" (Tom Select)\n * Copyright (c) contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this\n * file except in compliance with the License. You may obtain a copy of the License at:\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n * ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n *\n */\nimport TomSelect from '../../tom-select.js';\nimport * as constants from '../../constants.js';\n\nexport default TomSelect.define('restore_on_backspace',function(options) {\n\tvar self = this;\n\n\toptions.text = options.text || function(option) {\n\t\treturn option[self.settings.labelField];\n\t};\n\n\tvar orig_keydown = self.onKeyDown;\n\n\tself.hook('instead','onKeyDown',function(evt){\n\t\tvar index, option;\n\t\tif (evt.keyCode === constants.KEY_BACKSPACE && self.control_input.value === '' && !self.activeItems.length) {\n\t\t\tindex = self.caretPos - 1;\n\t\t\tif (index >= 0 && index < self.items.length) {\n\t\t\t\toption = self.options[self.items[index]];\n\t\t\t\tif (self.deleteSelection(evt)) {\n\t\t\t\t\tself.setTextboxValue(options.text.call(self, option));\n\t\t\t\t\tself.refreshOptions(true);\n\t\t\t\t}\n\t\t\t\tevt.preventDefault();\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\treturn orig_keydown.apply(self, arguments);\n\t});\n\n});\n"],"names":["KEY_BACKSPACE","TomSelect","define","options","self","text","option","settings","labelField","orig_keydown","onKeyDown","hook","evt","index","keyCode","constants","control_input","value","activeItems","length","caretPos","items","deleteSelection","setTextboxValue","call","refreshOptions","preventDefault","apply","arguments"],"mappings":";;;;;;;;;;;;;;;CAOO,IAAMA,aAAa,GAAI,CAAvB;;CCPP;;;;;;;;;;;;;;AAiBA,cAAeC,6BAAS,CAACC,MAAV,CAAiB,sBAAjB,EAAwC,UAASC,OAAT,EAAkB;CACxE,MAAIC,IAAI,GAAG,IAAX;;CAEAD,EAAAA,OAAO,CAACE,IAAR,GAAeF,OAAO,CAACE,IAAR,IAAgB,UAASC,MAAT,EAAiB;CAC/C,WAAOA,MAAM,CAACF,IAAI,CAACG,QAAL,CAAcC,UAAf,CAAb;CACA,GAFD;;CAIA,MAAIC,YAAY,GAAGL,IAAI,CAACM,SAAxB;CAEAN,EAAAA,IAAI,CAACO,IAAL,CAAU,SAAV,EAAoB,WAApB,EAAgC,UAASC,GAAT,EAAa;CAC5C,QAAIC,KAAJ,EAAWP,MAAX;;CACA,QAAIM,GAAG,CAACE,OAAJ,KAAgBC,aAAhB,IAA2CX,IAAI,CAACY,aAAL,CAAmBC,KAAnB,KAA6B,EAAxE,IAA8E,CAACb,IAAI,CAACc,WAAL,CAAiBC,MAApG,EAA4G;CAC3GN,MAAAA,KAAK,GAAGT,IAAI,CAACgB,QAAL,GAAgB,CAAxB;;CACA,UAAIP,KAAK,IAAI,CAAT,IAAcA,KAAK,GAAGT,IAAI,CAACiB,KAAL,CAAWF,MAArC,EAA6C;CAC5Cb,QAAAA,MAAM,GAAGF,IAAI,CAACD,OAAL,CAAaC,IAAI,CAACiB,KAAL,CAAWR,KAAX,CAAb,CAAT;;CACA,YAAIT,IAAI,CAACkB,eAAL,CAAqBV,GAArB,CAAJ,EAA+B;CAC9BR,UAAAA,IAAI,CAACmB,eAAL,CAAqBpB,OAAO,CAACE,IAAR,CAAamB,IAAb,CAAkBpB,IAAlB,EAAwBE,MAAxB,CAArB;CACAF,UAAAA,IAAI,CAACqB,cAAL,CAAoB,IAApB;CACA;;CACDb,QAAAA,GAAG,CAACc,cAAJ;CACA;CACA;CACD;;CACD,WAAOjB,YAAY,CAACkB,KAAb,CAAmBvB,IAAnB,EAAyBwB,SAAzB,CAAP;CACA,GAfD;CAiBA,CA1Bc,CAAf;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"restore_on_backspace.js","sources":["../../../src/constants.js","../../../src/plugins/restore_on_backspace/plugin.js"],"sourcesContent":["export const KEY_A\t\t\t\t= 65;\nexport const KEY_RETURN\t\t\t= 13;\nexport const KEY_ESC\t\t\t= 27;\nexport const KEY_LEFT\t\t\t= 37;\nexport const KEY_UP\t\t\t\t= 38;\nexport const KEY_RIGHT\t\t\t= 39;\nexport const KEY_DOWN\t\t\t= 40;\nexport const KEY_BACKSPACE\t\t= 8;\nexport const KEY_DELETE\t\t\t= 46;\nexport const KEY_TAB\t\t\t= 9;\n\nexport const IS_MAC \t\t= /Mac/.test(navigator.userAgent);\nexport const KEY_SHORTCUT\t\t= IS_MAC ? 'metaKey' : 'ctrlKey'; // ctrl key or apple key for ma\n","/**\n * Plugin: \"restore_on_backspace\" (Tom Select)\n * Copyright (c) contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this\n * file except in compliance with the License. You may obtain a copy of the License at:\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n * ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n *\n */\nimport TomSelect from '../../tom-select.js';\nimport * as constants from '../../constants.js';\n\nTomSelect.define('restore_on_backspace',function(options) {\n\tvar self = this;\n\n\toptions.text = options.text || function(option) {\n\t\treturn option[self.settings.labelField];\n\t};\n\n\tvar orig_keydown = self.onKeyDown;\n\n\tself.hook('instead','onKeyDown',function(evt){\n\t\tvar index, option;\n\t\tif (evt.keyCode === constants.KEY_BACKSPACE && self.control_input.value === '' && !self.activeItems.length) {\n\t\t\tindex = self.caretPos - 1;\n\t\t\tif (index >= 0 && index < self.items.length) {\n\t\t\t\toption = self.options[self.items[index]];\n\t\t\t\tif (self.deleteSelection(evt)) {\n\t\t\t\t\tself.setTextboxValue(options.text.call(self, option));\n\t\t\t\t\tself.refreshOptions(true);\n\t\t\t\t}\n\t\t\t\tevt.preventDefault();\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\treturn orig_keydown.apply(self, arguments);\n\t});\n\n});\n"],"names":["KEY_BACKSPACE","IS_MAC","test","navigator","userAgent","TomSelect","define","options","self","text","option","settings","labelField","orig_keydown","onKeyDown","hook","evt","index","keyCode","constants","control_input","value","activeItems","length","caretPos","items","deleteSelection","setTextboxValue","call","refreshOptions","preventDefault","apply","arguments"],"mappings":";;;;;;;;;;;;;;;CAOO,IAAMA,aAAa,GAAI,CAAvB;CAIA,IAAMC,MAAM,GAAU,MAAMC,IAAN,CAAWC,SAAS,CAACC,SAArB,CAAtB;;;CCXP;;;;;;;;;;;;;;AAiBAC,8BAAS,CAACC,MAAV,CAAiB,sBAAjB,EAAwC,UAASC,OAAT,EAAkB;CACzD,MAAIC,IAAI,GAAG,IAAX;;CAEAD,EAAAA,OAAO,CAACE,IAAR,GAAeF,OAAO,CAACE,IAAR,IAAgB,UAASC,MAAT,EAAiB;CAC/C,WAAOA,MAAM,CAACF,IAAI,CAACG,QAAL,CAAcC,UAAf,CAAb;CACA,GAFD;;CAIA,MAAIC,YAAY,GAAGL,IAAI,CAACM,SAAxB;CAEAN,EAAAA,IAAI,CAACO,IAAL,CAAU,SAAV,EAAoB,WAApB,EAAgC,UAASC,GAAT,EAAa;CAC5C,QAAIC,KAAJ,EAAWP,MAAX;;CACA,QAAIM,GAAG,CAACE,OAAJ,KAAgBC,aAAhB,IAA2CX,IAAI,CAACY,aAAL,CAAmBC,KAAnB,KAA6B,EAAxE,IAA8E,CAACb,IAAI,CAACc,WAAL,CAAiBC,MAApG,EAA4G;CAC3GN,MAAAA,KAAK,GAAGT,IAAI,CAACgB,QAAL,GAAgB,CAAxB;;CACA,UAAIP,KAAK,IAAI,CAAT,IAAcA,KAAK,GAAGT,IAAI,CAACiB,KAAL,CAAWF,MAArC,EAA6C;CAC5Cb,QAAAA,MAAM,GAAGF,IAAI,CAACD,OAAL,CAAaC,IAAI,CAACiB,KAAL,CAAWR,KAAX,CAAb,CAAT;;CACA,YAAIT,IAAI,CAACkB,eAAL,CAAqBV,GAArB,CAAJ,EAA+B;CAC9BR,UAAAA,IAAI,CAACmB,eAAL,CAAqBpB,OAAO,CAACE,IAAR,CAAamB,IAAb,CAAkBpB,IAAlB,EAAwBE,MAAxB,CAArB;CACAF,UAAAA,IAAI,CAACqB,cAAL,CAAoB,IAApB;CACA;;CACDb,QAAAA,GAAG,CAACc,cAAJ;CACA;CACA;CACD;;CACD,WAAOjB,YAAY,CAACkB,KAAb,CAAmBvB,IAAnB,EAAyBwB,SAAzB,CAAP;CACA,GAfD;CAiBA,CA1BD;;;;;;"} \ No newline at end of file diff --git a/dist/js/tom-select.base.js b/dist/js/tom-select.base.js index 963e5bbb..39ad1ca9 100644 --- a/dist/js/tom-select.base.js +++ b/dist/js/tom-select.base.js @@ -1,5 +1,5 @@ /** -* Tom Select v1.0.0-rc.3 +* Tom Select v1.0.0 * Licensed under the Apache License, Version 2.0 (the "License"); */ @@ -758,9 +758,9 @@ var KEY_DOWN = 40; var KEY_BACKSPACE = 8; var KEY_DELETE = 46; - var KEY_SHIFT = 16; - var KEY_CTRL = 17; var KEY_TAB = 9; + var IS_MAC = /Mac/.test(navigator.userAgent); + var KEY_SHORTCUT = IS_MAC ? 'metaKey' : 'ctrlKey'; // ctrl key or apple key for ma var defaults = { options: [], @@ -1108,6 +1108,8 @@ /** * Dispatch an event * + * @param {HTMLElement} dom_el + * @param {string} event_name */ function triggerEvent(dom_el, event_name) { @@ -1118,6 +1120,8 @@ /** * Apply CSS rules to a dom element * + * @param {HTMLElement} dom_el + * @param {object} css */ function applyCSS(dom_el, css) { @@ -1156,6 +1160,7 @@ /** * Return arguments * + * @return {array} */ function classesArray() { @@ -1175,6 +1180,14 @@ return classes.filter(Boolean); } + /** + * Create an array from arg if it's not already an array + * + * + * @param {any} arg + * @return {array} + */ + function castAsArray(arg) { if (!Array.isArray(arg)) { arg = [arg]; @@ -1186,6 +1199,10 @@ * Get the closest node to the evt.target matching the selector * Stops at wrapper * + * param {HTMLElement} target + * @param {string} selector + * @param {HTMLElement} [wrapper=null] + * return {HTMLElement} */ function parentMatch(target, selector, wrapper) { @@ -1207,6 +1224,10 @@ * > 0 - right (last) * < 0 - left (first) * + * @param {HTMLElement} el + * @param {string} query + * @param {number} direction + * @return {HTMLElement} */ function querySelectorEnd(el, query, direction) { @@ -1221,6 +1242,9 @@ /** * Get the first or last item from an array * + * @param {array|NodeList} array + * @param {number} direction + * @return {any} */ function getTail(array, direction) { @@ -1233,6 +1257,8 @@ /** * Return true if an object is empty * + * @param {object} obj + * @return {boolean} */ function isEmptyObject(obj) { @@ -1241,6 +1267,9 @@ /** * Get the index of an element amongst sibling nodes of the same type * + * @param {Element} el + * @param {string} [amongst=null] + * @return {number} */ function nodeIndex(el, amongst) { @@ -1378,6 +1407,9 @@ var classes_plugins; var inputId; var input = self.input; + var passive_event = { + passive: true + }; inputMode = self.settings.mode; classes = input.getAttribute('class') || ''; wrapper = getDom('
'); @@ -1483,7 +1515,7 @@ }); control_input.addEventListener('resize', function () { self.positionDropdown.apply(self, []); - }); + }, passive_event); control_input.addEventListener('blur', function () { return self.onBlur.apply(self, arguments); }); @@ -1527,9 +1559,9 @@ }; document.addEventListener('mousedown', doc_mousedown); - window.addEventListener('sroll', win_scroll); - window.addEventListener('resize', win_scroll); - window.addEventListener('mousemove', win_hover); + window.addEventListener('sroll', win_scroll, passive_event); + window.addEventListener('resize', win_scroll, passive_event); + window.addEventListener('mousemove', win_hover, passive_event); self._destroy = function () { document.removeEventListener('mousedown', doc_mousedown); @@ -1812,9 +1844,9 @@ } switch (e.keyCode) { - // cmd+A: select all + // ctrl+A: select all case KEY_A: - if (self.isKeyDown(KEY_CTRL, e)) { + if (self.isKeyDown(KEY_SHORTCUT, e)) { self.selectAll(); return; } @@ -1894,7 +1926,7 @@ return; } - if (self.isInputHidden && !self.isKeyDown(KEY_CTRL, e)) { + if (self.isInputHidden && !self.isKeyDown(KEY_SHORTCUT, e)) { e.preventDefault(); return; } @@ -2226,7 +2258,7 @@ eventName = e && e.type.toLowerCase(); - if (eventName === 'mousedown' && this.isKeyDown(KEY_SHIFT, e) && this.activeItems.length) { + if (eventName === 'mousedown' && this.isKeyDown('shiftKey', e) && this.activeItems.length) { last = this.getLastActive(); begin = Array.prototype.indexOf.call(this.control.children, last); end = Array.prototype.indexOf.call(this.control.children, item); @@ -2246,7 +2278,7 @@ } e.preventDefault(); - } else if (eventName === 'mousedown' && this.isKeyDown(KEY_CTRL, e) || eventName === 'keydown' && this.isKeyDown(KEY_SHIFT, e)) { + } else if (eventName === 'mousedown' && this.isKeyDown(KEY_SHORTCUT, e) || eventName === 'keydown' && this.isKeyDown('shiftKey', e)) { if (item.classList.contains('active')) { this.removeActiveItem(item); } else { @@ -2268,6 +2300,7 @@ /** * Set the active and last-active classes * + * @param {HTMLElement} item */ ; @@ -2283,6 +2316,7 @@ /** * Remove active item * + * @param {HTMLElement} item */ ; @@ -2295,7 +2329,7 @@ * Sets the selected item in the dropdown menu * of available options. * - * @param {object} option + * @param {HTMLElement} option * @param {boolean} scroll */ ; @@ -2697,6 +2731,7 @@ /** * Return list of selectable options * + * @return {NodeList} */ ; @@ -3543,7 +3578,7 @@ if (direction === 0) return; if (this.rtl) direction *= -1; // add or remove to active items - if (this.isKeyDown(KEY_CTRL, e) || this.isKeyDown(KEY_SHIFT, e)) { + if (this.isKeyDown(KEY_SHORTCUT, e) || this.isKeyDown('shiftKey', e)) { last_active = this.getLastActive(direction); var adjacent = this.getAdjacent(last_active, direction, 'item'); @@ -3813,28 +3848,23 @@ * Will return false if more than one control character is pressed ( when [ctrl+shift+a] != [ctrl+a] ) * The current evt may not always set ( eg calling advanceSelection() ) * + * @param {string} key_name + * @param {KeyboardEvent|MouseEvent} evt */ ; - _proto.isKeyDown = function isKeyDown(key_code, evt) { + _proto.isKeyDown = function isKeyDown(key_name, evt) { if (!evt) { return false; } - if (evt.altKey) { - return false; - } // if [ctrl+shift], return false - - - if (evt.ctrlKey && evt.shiftKey) { + if (!evt[key_name]) { return false; } - if (key_code == KEY_CTRL && evt.ctrlKey) { - return true; - } + var count = Number(evt.altKey) + Number(evt.ctrlKey) + Number(evt.shiftKey) + Number(evt.metaKey); - if (key_code == KEY_SHIFT && evt.shiftKey) { + if (count === 1) { return true; } diff --git a/dist/js/tom-select.base.js.map b/dist/js/tom-select.base.js.map index 6111f9c2..500d32b3 100644 --- a/dist/js/tom-select.base.js.map +++ b/dist/js/tom-select.base.js.map @@ -1 +1 @@ -{"version":3,"file":"tom-select.base.js","sources":["../../src/contrib/microevent.js","../../src/contrib/microplugin.js","../../src/contrib/sifter.js","../../src/contrib/highlight.js","../../src/constants.js","../../src/defaults.js","../../src/utils.js","../../src/settings.js","../../src/vanilla.js","../../src/tom-select.js"],"sourcesContent":["/**\n * MicroEvent - to make any js object an event emitter\n *\n * - pure javascript - server compatible, browser compatible\n * - dont rely on the browser doms\n * - super simple - you get it immediatly, no mistery, no magic involved\n *\n * @author Jerome Etienne (https://github.com/jeromeetienne)\n */\n\nexport default class MicroEvent{\n\tconstructor(){\n\t\tthis._events = {};\n\t}\n\n\ton(event, fct){\n\t\tthis._events[event] = this._events[event] || [];\n\t\tthis._events[event].push(fct);\n\t}\n\n\toff(event, fct){\n\t\tvar n = arguments.length;\n\t\tif (n === 0) return delete this._events;\n\t\tif (n === 1) return delete this._events[event];\n\n\t\tthis._events = this._events || {};\n\t\tif (event in this._events === false) return;\n\t\tthis._events[event].splice(this._events[event].indexOf(fct), 1);\n\t}\n\n\ttrigger(event /* , args... */){\n\t\tthis._events = this._events || {};\n\t\tif (event in this._events === false) return;\n\t\tfor (var i = 0; i < this._events[event].length; i++){\n\t\t\tthis._events[event][i].apply(this, Array.prototype.slice.call(arguments, 1));\n\t\t}\n\t}\n};\n","/**\n * microplugin.js\n * Copyright (c) 2013 Brian Reavis & contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this\n * file except in compliance with the License. You may obtain a copy of the License at:\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n * ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n *\n * @author Brian Reavis \n */\n\nexport default function MicroPlugin(Interface){\n\n\tInterface.plugins = {};\n\n\n\treturn class mixin extends Interface{\n\n\t\t/**\n\t\t * Registers a plugin.\n\t\t *\n\t\t * @param {string} name\n\t\t * @param {function} fn\n\t\t */\n\t\tstatic define(name, fn){\n\t\t\tInterface.plugins[name] = {\n\t\t\t\t'name' : name,\n\t\t\t\t'fn' : fn\n\t\t\t};\n\t\t}\n\n\t\t/**\n\t\t * Initializes the listed plugins (with options).\n\t\t * Acceptable formats:\n\t\t *\n\t\t * List (without options):\n\t\t * ['a', 'b', 'c']\n\t\t *\n\t\t * List (with options):\n\t\t * [{'name': 'a', options: {}}, {'name': 'b', options: {}}]\n\t\t *\n\t\t * Hash (with options):\n\t\t * {'a': { ... }, 'b': { ... }, 'c': { ... }}\n\t\t *\n\t\t * @param {array|object} plugins\n\t\t */\n\t\tinitializePlugins(plugins) {\n\t\t\tvar i, n, key;\n\t\t\tvar self = this;\n\t\t\tvar queue = [];\n\n\t\t\tself.plugins = {\n\t\t\t\tnames : [],\n\t\t\t\tsettings : {},\n\t\t\t\trequested : {},\n\t\t\t\tloaded : {}\n\t\t\t};\n\n\t\t\tif (Array.isArray(plugins)) {\n\t\t\t\tfor (i = 0, n = plugins.length; i < n; i++) {\n\t\t\t\t\tif (typeof plugins[i] === 'string') {\n\t\t\t\t\t\tqueue.push(plugins[i]);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tself.plugins.settings[plugins[i].name] = plugins[i].options;\n\t\t\t\t\t\tqueue.push(plugins[i].name);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (plugins) {\n\t\t\t\tfor (key in plugins) {\n\t\t\t\t\tif (plugins.hasOwnProperty(key)) {\n\t\t\t\t\t\tself.plugins.settings[key] = plugins[key];\n\t\t\t\t\t\tqueue.push(key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\twhile (queue.length) {\n\t\t\t\tself.require(queue.shift());\n\t\t\t}\n\t\t}\n\n\t\tloadPlugin(name) {\n\t\t\tvar self = this;\n\t\t\tvar plugins = self.plugins;\n\t\t\tvar plugin = Interface.plugins[name];\n\n\t\t\tif (!Interface.plugins.hasOwnProperty(name)) {\n\t\t\t\tthrow new Error('Unable to find \"' + name + '\" plugin');\n\t\t\t}\n\n\t\t\tplugins.requested[name] = true;\n\t\t\tplugins.loaded[name] = plugin.fn.apply(self, [self.plugins.settings[name] || {}]);\n\t\t\tplugins.names.push(name);\n\t\t}\n\n\t\t/**\n\t\t * Initializes a plugin.\n\t\t *\n\t\t * @param {string} name\n\t\t */\n\t\trequire(name) {\n\t\t\tvar self = this;\n\t\t\tvar plugins = self.plugins;\n\n\t\t\tif (!self.plugins.loaded.hasOwnProperty(name)) {\n\t\t\t\tif (plugins.requested[name]) {\n\t\t\t\t\tthrow new Error('Plugin has circular dependency (\"' + name + '\")');\n\t\t\t\t}\n\t\t\t\tself.loadPlugin(name);\n\t\t\t}\n\n\t\t\treturn plugins.loaded[name];\n\t\t}\n\n\t};\n\n}\n","/**\n * sifter.js\n * Copyright (c) 2013–2020 Brian Reavis & contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this\n * file except in compliance with the License. You may obtain a copy of the License at:\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n * ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n *\n * @author Brian Reavis \n */\n\n\n// utilities\n// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n\nvar cmp = function(a, b) {\n\tif (typeof a === 'number' && typeof b === 'number') {\n\t\treturn a > b ? 1 : (a < b ? -1 : 0);\n\t}\n\ta = asciifold(String(a || ''));\n\tb = asciifold(String(b || ''));\n\tif (a > b) return 1;\n\tif (b > a) return -1;\n\treturn 0;\n};\n\n/**\n * A property getter resolving dot-notation\n * @param {Object} obj The root object to fetch property on\n * @param {String} name The optionally dotted property name to fetch\n * @param {Boolean} nesting Handle nesting or not\n * @return {Object} The resolved property value\n */\nvar getattr = function(obj, name, nesting) {\n if (!obj || !name) return;\n if (!nesting) return obj[name];\n var names = name.split(\".\");\n while(names.length && (obj = obj[names.shift()]));\n return obj;\n};\n\nvar escape_regex = function(str) {\n\treturn (str + '').replace(/([.?*+^$[\\]\\\\(){}|-])/g, '\\\\$1');\n};\n\nvar DIACRITICS = {\n\t'a': '[aḀḁĂăÂâǍǎȺⱥȦȧẠạÄäÀàÁáĀāÃãÅåąĄÃąĄ]',\n\t'b': '[b␢βΒB฿𐌁ᛒ]',\n\t'c': '[cĆćĈĉČčĊċC̄c̄ÇçḈḉȻȼƇƈɕᴄCc]',\n\t'd': '[dĎďḊḋḐḑḌḍḒḓḎḏĐđD̦d̦ƉɖƊɗƋƌᵭᶁᶑȡᴅDdð]',\n\t'e': '[eÉéÈèÊêḘḙĚěĔĕẼẽḚḛẺẻĖėËëĒēȨȩĘęᶒɆɇȄȅẾếỀềỄễỂểḜḝḖḗḔḕȆȇẸẹỆệⱸᴇEeɘǝƏƐε]',\n\t'f': '[fƑƒḞḟ]',\n\t'g': '[gɢ₲ǤǥĜĝĞğĢģƓɠĠġ]',\n\t'h': '[hĤĥĦħḨḩẖẖḤḥḢḣɦʰǶƕ]',\n\t'i': '[iÍíÌìĬĭÎîǏǐÏïḮḯĨĩĮįĪīỈỉȈȉȊȋỊịḬḭƗɨɨ̆ᵻᶖİiIıɪIi]',\n\t'j': '[jȷĴĵɈɉʝɟʲ]',\n\t'k': '[kƘƙꝀꝁḰḱǨǩḲḳḴḵκϰ₭]',\n\t'l': '[lŁłĽľĻļĹĺḶḷḸḹḼḽḺḻĿŀȽƚⱠⱡⱢɫɬᶅɭȴʟLl]',\n\t'n': '[nŃńǸǹŇňÑñṄṅŅņṆṇṊṋṈṉN̈n̈ƝɲȠƞᵰᶇɳȵɴNnŊŋ]',\n\t'o': '[oØøÖöÓóÒòÔôǑǒŐőŎŏȮȯỌọƟɵƠơỎỏŌōÕõǪǫȌȍՕօ]',\n\t'p': '[pṔṕṖṗⱣᵽƤƥᵱ]',\n\t'q': '[qꝖꝗʠɊɋꝘꝙq̃]',\n\t'r': '[rŔŕɌɍŘřŖŗṘṙȐȑȒȓṚṛⱤɽ]',\n\t's': '[sŚśṠṡṢṣꞨꞩŜŝŠšŞşȘșS̈s̈]',\n\t't': '[tŤťṪṫŢţṬṭƮʈȚțṰṱṮṯƬƭ]',\n\t'u': '[uŬŭɄʉỤụÜüÚúÙùÛûǓǔŰűŬŭƯưỦủŪūŨũŲųȔȕ∪]',\n\t'v': '[vṼṽṾṿƲʋꝞꝟⱱʋ]',\n\t'w': '[wẂẃẀẁŴŵẄẅẆẇẈẉ]',\n\t'x': '[xẌẍẊẋχ]',\n\t'y': '[yÝýỲỳŶŷŸÿỸỹẎẏỴỵɎɏƳƴ]',\n\t'z': '[zŹźẐẑŽžŻżẒẓẔẕƵƶ]'\n};\n\nvar asciifold = (function() {\n\tvar i, n, k, chunk;\n\tvar foreignletters = '';\n\tvar lookup = {};\n\tfor (k in DIACRITICS) {\n\t\tif (DIACRITICS.hasOwnProperty(k)) {\n\t\t\tchunk = DIACRITICS[k].substring(2, DIACRITICS[k].length - 1);\n\t\t\tforeignletters += chunk;\n\t\t\tfor (i = 0, n = chunk.length; i < n; i++) {\n\t\t\t\tlookup[chunk.charAt(i)] = k;\n\t\t\t}\n\t\t}\n\t}\n\tvar regexp = new RegExp('[' + foreignletters + ']', 'g');\n\treturn function(str) {\n\t\treturn str.replace(regexp, function(foreignletter) {\n\t\t\treturn lookup[foreignletter];\n\t\t}).toLowerCase();\n\t};\n})();\n\n\nexport default class Sifter{\n\n\t/**\n\t * Textually searches arrays and hashes of objects\n\t * by property (or multiple properties). Designed\n\t * specifically for autocomplete.\n\t *\n\t * @constructor\n\t * @param {array|object} items\n\t * @param {object} items\n\t */\n\tconstructor(items, settings) {\n\t\tthis.items = items;\n\t\tthis.settings = settings || {diacritics: true};\n\t};\n\n\t/**\n\t * Splits a search string into an array of individual\n\t * regexps to be used to match results.\n\t *\n\t * @param {string} query\n\t * @returns {array}\n\t */\n\ttokenize(query, respect_word_boundaries) {\n\t\tquery = String(query || '').toLowerCase().trim();\n\t\tif (!query || !query.length) return [];\n\n\t\tvar i, n, regex, letter;\n\t\tvar tokens = [];\n\t\tvar words = query.split(/ +/);\n\n\t\tfor (i = 0, n = words.length; i < n; i++) {\n\t\t\tregex = escape_regex(words[i]);\n\t\t\tif (this.settings.diacritics) {\n\t\t\t\tfor (letter in DIACRITICS) {\n\t\t\t\t\tif (DIACRITICS.hasOwnProperty(letter)) {\n\t\t\t\t\t\tregex = regex.replace(new RegExp(letter, 'g'), DIACRITICS[letter]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (respect_word_boundaries) regex = \"\\\\b\"+regex\n\t\t\ttokens.push({\n\t\t\t\tstring : words[i],\n\t\t\t\tregex : new RegExp(regex, 'i')\n\t\t\t});\n\t\t}\n\n\t\treturn tokens;\n\t};\n\n\t/**\n\t * Iterates over arrays and hashes.\n\t *\n\t * ```\n\t * this.iterator(this.items, function(item, id) {\n\t * // invoked for each item\n\t * });\n\t * ```\n\t *\n\t * @param {array|object} object\n\t */\n\titerator(object, callback) {\n\t\tvar iterator;\n\t\tif (Array.isArray(object)) {\n\t\t\titerator = Array.prototype.forEach || function(callback) {\n\t\t\t\tfor (var i = 0, n = this.length; i < n; i++) {\n\t\t\t\t\tcallback(this[i], i, this);\n\t\t\t\t}\n\t\t\t};\n\t\t} else {\n\t\t\titerator = function(callback) {\n\t\t\t\tfor (var key in this) {\n\t\t\t\t\tif (this.hasOwnProperty(key)) {\n\t\t\t\t\t\tcallback(this[key], key, this);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t\titerator.apply(object, [callback]);\n\t};\n\n\t/**\n\t * Returns a function to be used to score individual results.\n\t *\n\t * Good matches will have a higher score than poor matches.\n\t * If an item is not a match, 0 will be returned by the function.\n\t *\n\t * @param {object|string} search\n\t * @param {object} options\n\t * @returns {function}\n\t */\n\tgetScoreFunction(search, options=null ){\n\t\tvar self, fields, tokens, token_count, nesting;\n\n\t\tself = this;\n\t\tsearch = self.prepareSearch(search, options);\n\t\ttokens = search.tokens;\n\t\tfields = search.options.fields;\n\t\ttoken_count = tokens.length;\n\t\tnesting = search.options.nesting;\n\n\t\t/**\n\t\t * Calculates how close of a match the\n\t\t * given value is against a search token.\n\t\t *\n\t\t * @param {string} value\n\t\t * @param {object} token\n\t\t * @return {number}\n\t\t */\n\t\tvar scoreValue = function(value, token) {\n\t\t\tvar score, pos;\n\n\t\t\tif (!value) return 0;\n\t\t\tvalue = String(value || '');\n\t\t\tpos = value.search(token.regex);\n\t\t\tif (pos === -1) return 0;\n\t\t\tscore = token.string.length / value.length;\n\t\t\tif (pos === 0) score += 0.5;\n\t\t\treturn score;\n\t\t};\n\n\t\t/**\n\t\t * Calculates the score of an object\n\t\t * against the search query.\n\t\t *\n\t\t * @param {object} token\n\t\t * @param {object} data\n\t\t * @return {number}\n\t\t */\n\t\tvar scoreObject = (function() {\n\t\t\tvar field_count = fields.length;\n\t\t\tif (!field_count) {\n\t\t\t\treturn function() { return 0; };\n\t\t\t}\n\t\t\tif (field_count === 1) {\n\t\t\t\treturn function(token, data) {\n\t\t\t\t\treturn scoreValue(getattr(data, fields[0], nesting), token);\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn function(token, data) {\n\t\t\t\tfor (var i = 0, sum = 0; i < field_count; i++) {\n\t\t\t\t\tsum += scoreValue(getattr(data, fields[i], nesting), token);\n\t\t\t\t}\n\t\t\t\treturn sum / field_count;\n\t\t\t};\n\t\t})();\n\n\t\tif (!token_count) {\n\t\t\treturn function() { return 0; };\n\t\t}\n\t\tif (token_count === 1) {\n\t\t\treturn function(data) {\n\t\t\t\treturn scoreObject(tokens[0], data);\n\t\t\t};\n\t\t}\n\n\t\tif (search.options.conjunction === 'and') {\n\t\t\treturn function(data) {\n\t\t\t\tvar score;\n\t\t\t\tfor (var i = 0, sum = 0; i < token_count; i++) {\n\t\t\t\t\tscore = scoreObject(tokens[i], data);\n\t\t\t\t\tif (score <= 0) return 0;\n\t\t\t\t\tsum += score;\n\t\t\t\t}\n\t\t\t\treturn sum / token_count;\n\t\t\t};\n\t\t} else {\n\t\t\treturn function(data) {\n\t\t\t\tfor (var i = 0, sum = 0; i < token_count; i++) {\n\t\t\t\t\tsum += scoreObject(tokens[i], data);\n\t\t\t\t}\n\t\t\t\treturn sum / token_count;\n\t\t\t};\n\t\t}\n\t};\n\n\t/**\n\t * Returns a function that can be used to compare two\n\t * results, for sorting purposes. If no sorting should\n\t * be performed, `null` will be returned.\n\t *\n\t * @param {string|object} search\n\t * @param {object} options\n\t * @return function(a,b)\n\t */\n\tgetSortFunction(search, options) {\n\t\tvar i, n, self, field, fields, fields_count, multiplier, multipliers, get_field, implicit_score, sort;\n\n\t\tself = this;\n\t\tsearch = self.prepareSearch(search, options);\n\t\tsort = (!search.query && options.sort_empty) || options.sort;\n\n\t\t/**\n\t\t * Fetches the specified sort field value\n\t\t * from a search result item.\n\t\t *\n\t\t * @param {string} name\n\t\t * @param {object} result\n\t\t * @return {string}\n\t\t */\n\t\tget_field = function(name, result) {\n\t\t\tif (name === '$score') return result.score;\n\t\t\treturn getattr(self.items[result.id], name, options.nesting);\n\t\t};\n\n\t\t// parse options\n\t\tfields = [];\n\t\tif (sort) {\n\t\t\tfor (i = 0, n = sort.length; i < n; i++) {\n\t\t\t\tif (search.query || sort[i].field !== '$score') {\n\t\t\t\t\tfields.push(sort[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// the \"$score\" field is implied to be the primary\n\t\t// sort field, unless it's manually specified\n\t\tif (search.query) {\n\t\t\timplicit_score = true;\n\t\t\tfor (i = 0, n = fields.length; i < n; i++) {\n\t\t\t\tif (fields[i].field === '$score') {\n\t\t\t\t\timplicit_score = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (implicit_score) {\n\t\t\t\tfields.unshift({field: '$score', direction: 'desc'});\n\t\t\t}\n\t\t} else {\n\t\t\tfor (i = 0, n = fields.length; i < n; i++) {\n\t\t\t\tif (fields[i].field === '$score') {\n\t\t\t\t\tfields.splice(i, 1);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tmultipliers = [];\n\t\tfor (i = 0, n = fields.length; i < n; i++) {\n\t\t\tmultipliers.push(fields[i].direction === 'desc' ? -1 : 1);\n\t\t}\n\n\t\t// build function\n\t\tfields_count = fields.length;\n\t\tif (!fields_count) {\n\t\t\treturn null;\n\t\t} else if (fields_count === 1) {\n\t\t\tfield = fields[0].field;\n\t\t\tmultiplier = multipliers[0];\n\t\t\treturn function(a, b) {\n\t\t\t\treturn multiplier * cmp(\n\t\t\t\t\tget_field(field, a),\n\t\t\t\t\tget_field(field, b)\n\t\t\t\t);\n\t\t\t};\n\t\t} else {\n\t\t\treturn function(a, b) {\n\t\t\t\tvar i, result, a_value, b_value, field;\n\t\t\t\tfor (i = 0; i < fields_count; i++) {\n\t\t\t\t\tfield = fields[i].field;\n\t\t\t\t\tresult = multipliers[i] * cmp(\n\t\t\t\t\t\tget_field(field, a),\n\t\t\t\t\t\tget_field(field, b)\n\t\t\t\t\t);\n\t\t\t\t\tif (result) return result;\n\t\t\t\t}\n\t\t\t\treturn 0;\n\t\t\t};\n\t\t}\n\t};\n\n\t/**\n\t * Parses a search query and returns an object\n\t * with tokens and fields ready to be populated\n\t * with results.\n\t *\n\t * @param {string} query\n\t * @param {object} options\n\t * @returns {object}\n\t */\n\tprepareSearch(query, options) {\n\t\tif (typeof query === 'object') return query;\n\n\t\toptions = Object.assign({},options);\n\n\t\tvar option_fields = options.fields;\n\t\tvar option_sort = options.sort;\n\t\tvar option_sort_empty = options.sort_empty;\n\n\t\tif (option_fields && !Array.isArray(option_fields)) options.fields = [option_fields];\n\t\tif (option_sort && !Array.isArray(option_sort)) options.sort = [option_sort];\n\t\tif (option_sort_empty && !Array.isArray(option_sort_empty)) options.sort_empty = [option_sort_empty];\n\n\t\treturn {\n\t\t\toptions : options,\n\t\t\tquery : String(query || '').toLowerCase(),\n\t\t\ttokens : this.tokenize(query, options.respect_word_boundaries),\n\t\t\ttotal : 0,\n\t\t\titems : []\n\t\t};\n\t};\n\n\t/**\n\t * Searches through all items and returns a sorted array of matches.\n\t *\n\t * The `options` parameter can contain:\n\t *\n\t * - fields {string|array}\n\t * - sort {array}\n\t * - score {function}\n\t * - filter {bool}\n\t * - limit {integer}\n\t *\n\t * Returns an object containing:\n\t *\n\t * - options {object}\n\t * - query {string}\n\t * - tokens {array}\n\t * - total {int}\n\t * - items {array}\n\t *\n\t * @param {string} query\n\t * @param {object} options\n\t * @returns {object}\n\t */\n\tsearch(query, options) {\n\t\tvar self = this, value, score, search, calculateScore;\n\t\tvar fn_sort;\n\t\tvar fn_score;\n\n\t\tsearch = this.prepareSearch(query, options);\n\t\toptions = search.options;\n\t\tquery = search.query;\n\n\t\t// generate result scoring function\n\t\tfn_score = options.score || self.getScoreFunction(search);\n\n\t\t// perform search and sort\n\t\tif (query.length) {\n\t\t\tself.iterator(self.items, function(item, id) {\n\t\t\t\tscore = fn_score(item);\n\t\t\t\tif (options.filter === false || score > 0) {\n\t\t\t\t\tsearch.items.push({'score': score, 'id': id});\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\tself.iterator(self.items, function(item, id) {\n\t\t\t\tsearch.items.push({'score': 1, 'id': id});\n\t\t\t});\n\t\t}\n\n\t\tfn_sort = self.getSortFunction(search, options);\n\t\tif (fn_sort) search.items.sort(fn_sort);\n\n\t\t// apply limits\n\t\tsearch.total = search.items.length;\n\t\tif (typeof options.limit === 'number') {\n\t\t\tsearch.items = search.items.slice(0, options.limit);\n\t\t}\n\n\t\treturn search;\n\t};\n}\n","/**\n * highlight v3 | MIT license | Johann Burkard \n * Highlights arbitrary terms in a node.\n *\n * - Modified by Marshal 2011-6-24 (added regex)\n * - Modified by Brian Reavis 2012-8-27 (cleanup)\n */\n\nexport function highlight(element, pattern) {\n\tif (typeof pattern === 'string' && !pattern.length) return;\n\tvar regex = (typeof pattern === 'string') ? new RegExp(pattern, 'i') : pattern;\n\n\tvar highlight = function(node) {\n\t\tvar skip = 0;\n\t\t// Wrap matching part of text node with highlighting , e.g.\n\t\t// Soccer -> Soccer for regex = /soc/i\n\t\tif (node.nodeType === 3) {\n\t\t\tvar pos = node.data.search(regex);\n\t\t\tif (pos >= 0 && node.data.length > 0) {\n\t\t\t\tvar match = node.data.match(regex);\n\t\t\t\tvar spannode = document.createElement('span');\n\t\t\t\tspannode.className = 'highlight';\n\t\t\t\tvar middlebit = node.splitText(pos);\n\t\t\t\tvar endbit = middlebit.splitText(match[0].length);\n\t\t\t\tvar middleclone = middlebit.cloneNode(true);\n\t\t\t\tspannode.appendChild(middleclone);\n\t\t\t\tmiddlebit.parentNode.replaceChild(spannode, middlebit);\n\t\t\t\tskip = 1;\n\t\t\t}\n\t\t}\n\t\t// Recurse element node, looking for child text nodes to highlight, unless element\n\t\t// is childless,