Add Tom-Select lib

This commit is contained in:
jf-cbd
2025-11-13 10:48:06 +01:00
parent cef8fbc859
commit 7733f13d14
354 changed files with 53014 additions and 2 deletions

12
node_modules/tom-select/dist/esm/constants.d.ts generated vendored Normal file
View File

@@ -0,0 +1,12 @@
export declare const KEY_A = 65;
export declare const KEY_RETURN = 13;
export declare const KEY_ESC = 27;
export declare const KEY_LEFT = 37;
export declare const KEY_UP = 38;
export declare const KEY_RIGHT = 39;
export declare const KEY_DOWN = 40;
export declare const KEY_BACKSPACE = 8;
export declare const KEY_DELETE = 46;
export declare const KEY_TAB = 9;
export declare const IS_MAC: boolean;
export declare const KEY_SHORTCUT: string;

13
node_modules/tom-select/dist/esm/constants.js generated vendored Normal file
View File

@@ -0,0 +1,13 @@
export const KEY_A = 65;
export const KEY_RETURN = 13;
export const KEY_ESC = 27;
export const KEY_LEFT = 37;
export const KEY_UP = 38;
export const KEY_RIGHT = 39;
export const KEY_DOWN = 40;
export const KEY_BACKSPACE = 8;
export const KEY_DELETE = 46;
export const KEY_TAB = 9;
export const IS_MAC = typeof navigator === 'undefined' ? false : /Mac/.test(navigator.userAgent);
export const KEY_SHORTCUT = IS_MAC ? 'metaKey' : 'ctrlKey'; // ctrl key or apple key for ma
//# sourceMappingURL=constants.js.map

1
node_modules/tom-select/dist/esm/constants.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,KAAK,GAAM,EAAE,CAAC;AAC3B,MAAM,CAAC,MAAM,UAAU,GAAK,EAAE,CAAC;AAC/B,MAAM,CAAC,MAAM,OAAO,GAAK,EAAE,CAAC;AAC5B,MAAM,CAAC,MAAM,QAAQ,GAAK,EAAE,CAAC;AAC7B,MAAM,CAAC,MAAM,MAAM,GAAM,EAAE,CAAC;AAC5B,MAAM,CAAC,MAAM,SAAS,GAAK,EAAE,CAAC;AAC9B,MAAM,CAAC,MAAM,QAAQ,GAAK,EAAE,CAAC;AAC7B,MAAM,CAAC,MAAM,aAAa,GAAI,CAAC,CAAC;AAChC,MAAM,CAAC,MAAM,UAAU,GAAK,EAAE,CAAC;AAC/B,MAAM,CAAC,MAAM,OAAO,GAAK,CAAC,CAAC;AAE3B,MAAM,CAAC,MAAM,MAAM,GAAU,OAAO,SAAS,KAAK,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;AACxG,MAAM,CAAC,MAAM,YAAY,GAAI,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,+BAA+B"}

View File

@@ -0,0 +1,13 @@
/**
* highlight v3 | MIT license | Johann Burkard <jb@eaio.com>
* Highlights arbitrary terms in a node.
*
* - Modified by Marshal <beatgates@gmail.com> 2011-6-24 (added regex)
* - Modified by Brian Reavis <brian@thirdroute.com> 2012-8-27 (cleanup)
*/
export declare const highlight: (element: HTMLElement, regex: string | RegExp) => void;
/**
* removeHighlight fn copied from highlight v5 and
* edited to remove with(), pass js strict mode, and use without jquery
*/
export declare const removeHighlight: (el: HTMLElement) => void;

64
node_modules/tom-select/dist/esm/contrib/highlight.js generated vendored Normal file
View File

@@ -0,0 +1,64 @@
/**
* highlight v3 | MIT license | Johann Burkard <jb@eaio.com>
* Highlights arbitrary terms in a node.
*
* - Modified by Marshal <beatgates@gmail.com> 2011-6-24 (added regex)
* - Modified by Brian Reavis <brian@thirdroute.com> 2012-8-27 (cleanup)
*/
import { replaceNode } from "../vanilla.js";
export const highlight = (element, regex) => {
if (regex === null)
return;
// convet string to regex
if (typeof regex === 'string') {
if (!regex.length)
return;
regex = new RegExp(regex, 'i');
}
// Wrap matching part of text node with highlighting <span>, e.g.
// Soccer -> <span class="highlight">Soc</span>cer for regex = /soc/i
const highlightText = (node) => {
var match = node.data.match(regex);
if (match && node.data.length > 0) {
var spannode = document.createElement('span');
spannode.className = 'highlight';
var middlebit = node.splitText(match.index);
middlebit.splitText(match[0].length);
var middleclone = middlebit.cloneNode(true);
spannode.appendChild(middleclone);
replaceNode(middlebit, spannode);
return 1;
}
return 0;
};
// Recurse element node, looking for child text nodes to highlight, unless element
// is childless, <script>, <style>, or already highlighted: <span class="hightlight">
const highlightChildren = (node) => {
if (node.nodeType === 1 && node.childNodes && !/(script|style)/i.test(node.tagName) && (node.className !== 'highlight' || node.tagName !== 'SPAN')) {
Array.from(node.childNodes).forEach(element => {
highlightRecursive(element);
});
}
};
const highlightRecursive = (node) => {
if (node.nodeType === 3) {
return highlightText(node);
}
highlightChildren(node);
return 0;
};
highlightRecursive(element);
};
/**
* removeHighlight fn copied from highlight v5 and
* edited to remove with(), pass js strict mode, and use without jquery
*/
export const removeHighlight = (el) => {
var elements = el.querySelectorAll("span.highlight");
Array.prototype.forEach.call(elements, function (el) {
var parent = el.parentNode;
parent.replaceChild(el.firstChild, el);
parent.normalize();
});
};
//# sourceMappingURL=highlight.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"highlight.js","sourceRoot":"","sources":["../../../src/contrib/highlight.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAG1C,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,OAAmB,EAAE,KAAmB,EAAE,EAAE;IAErE,IAAI,KAAK,KAAK,IAAI;QAAG,OAAO;IAE5B,yBAAyB;IACzB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAE/B,IAAI,CAAC,KAAK,CAAC,MAAM;YAAG,OAAO;QAC3B,KAAK,GAAG,IAAI,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAChC,CAAC;IAGD,iEAAiE;IACjE,wEAAwE;IACxE,MAAM,aAAa,GAAG,CAAE,IAAS,EAAU,EAAE;QAE5C,IAAI,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,C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CAAC,IAAY,CAAC,CAAC;QACpC,CAAC;QAED,iBAAiB,CAAC,IAAe,CAAC,CAAC;QAEnC,OAAO,CAAC,CAAC;IACV,CAAC,CAAC;IAEF,kBAAkB,CAAE,OAAO,CAAE,CAAC;AAC/B,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAAc,EAAE,EAAE;IACjD,IAAI,QAAQ,GAAG,EAAE,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;IACrD,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAS,EAAc;QAC7D,IAAI,MAAM,GAAG,EAAE,CAAC,UAAkB,CAAC;QACnC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC,UAAkB,EAAE,EAAE,CAAC,CAAC;QAC/C,MAAM,CAAC,SAAS,EAAE,CAAC;IACpB,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC"}

View File

@@ -0,0 +1,20 @@
/**
* MicroEvent - to make any js object an event emitter
*
* - pure javascript - server compatible, browser compatible
* - dont rely on the browser doms
* - super simple - you get it immediatly, no mistery, no magic involved
*
* @author Jerome Etienne (https://github.com/jeromeetienne)
*/
type TCallback = (...args: any) => any;
export default class MicroEvent {
_events: {
[key: string]: TCallback[];
};
constructor();
on(events: string, fct: TCallback): void;
off(events: string, fct: TCallback): void;
trigger(events: string, ...args: any): void;
}
export {};

61
node_modules/tom-select/dist/esm/contrib/microevent.js generated vendored Normal file
View File

@@ -0,0 +1,61 @@
/**
* MicroEvent - to make any js object an event emitter
*
* - pure javascript - server compatible, browser compatible
* - dont rely on the browser doms
* - super simple - you get it immediatly, no mistery, no magic involved
*
* @author Jerome Etienne (https://github.com/jeromeetienne)
*/
/**
* Execute callback for each event in space separated list of event names
*
*/
function forEvents(events, callback) {
events.split(/\s+/).forEach((event) => {
callback(event);
});
}
export default class MicroEvent {
constructor() {
this._events = {};
}
on(events, fct) {
forEvents(events, (event) => {
const event_array = this._events[event] || [];
event_array.push(fct);
this._events[event] = event_array;
});
}
off(events, fct) {
var n = arguments.length;
if (n === 0) {
this._events = {};
return;
}
forEvents(events, (event) => {
if (n === 1) {
delete this._events[event];
return;
}
const event_array = this._events[event];
if (event_array === undefined)
return;
event_array.splice(event_array.indexOf(fct), 1);
this._events[event] = event_array;
});
}
trigger(events, ...args) {
var self = this;
forEvents(events, (event) => {
const event_array = self._events[event];
if (event_array === undefined)
return;
event_array.forEach(fct => {
fct.apply(self, args);
});
});
}
}
;
//# sourceMappingURL=microevent.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"microevent.js","sourceRoot":"","sources":["../../../src/contrib/microevent.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH;;;GAGG;AACH,SAAS,SAAS,CAAC,MAAa,EAAC,QAA4B;IAC5D,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;QACrC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,OAAO,OAAO,UAAU;IAI9B;QACC,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;IACnB,CAAC;IAED,EAAE,CAAC,MAAa,EAAE,GAAa;QAC9B,SAAS,CAAC,MAAM,EAAC,CAAC,KAAK,EAAE,EAAE;YAC1B,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;YAC9C,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACtB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,WAAW,CAAC;QACnC,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,GAAG,CAAC,MAAa,EAAE,GAAa;QAC/B,IAAI,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC;QACzB,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YACb,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;YAClB,OAAO;QACR,CAAC;QAED,SAAS,CAAC,MAAM,EAAC,CAAC,KAAK,EAAE,EAAE;YAE1B,IAAI,CAAC,KAAK,CAAC,EAAC,CAAC;gBACZ,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;gBAC3B,OAAM;YACP,CAAC;YAED,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YACxC,IAAI,WAAW,KAAK,SAAS;gBAAG,OAAO;YAEvC,WAAW,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;YAChD,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,WAAW,CAAC;QACnC,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,OAAO,CAAC,MAAa,EAAE,GAAG,IAAQ;QACjC,IAAI,IAAI,GAAG,IAAI,CAAC;QAEhB,SAAS,CAAC,MAAM,EAAC,CAAC,KAAK,EAAE,EAAE;YAC1B,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YACxC,IAAI,WAAW,KAAK,SAAS;gBAAG,OAAO;YACvC,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;gBACzB,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAE,CAAC;YACxB,CAAC,CAAC,CAAC;QAEJ,CAAC,CAAC,CAAC;IACJ,CAAC;CACD;AAAA,CAAC"}

View File

@@ -0,0 +1,71 @@
/**
* microplugin.js
* Copyright (c) 2013 Brian Reavis & contributors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*
* @author Brian Reavis <brian@thirdroute.com>
*/
type TSettings = {
[key: string]: any;
};
type TPlugins = {
names: string[];
settings: TSettings;
requested: {
[key: string]: boolean;
};
loaded: {
[key: string]: any;
};
};
export type TPluginItem = {
name: string;
options: {};
};
export type TPluginHash = {
[key: string]: {};
};
export default function MicroPlugin(Interface: any): {
new (): {
[x: string]: any;
plugins: TPlugins;
/**
* Initializes the listed plugins (with options).
* Acceptable formats:
*
* List (without options):
* ['a', 'b', 'c']
*
* List (with options):
* [{'name': 'a', options: {}}, {'name': 'b', options: {}}]
*
* Hash (with options):
* {'a': { ... }, 'b': { ... }, 'c': { ... }}
*
* @param {array|object} plugins
*/
initializePlugins(plugins: string[] | TPluginItem[] | TPluginHash): void;
loadPlugin(name: string): void;
/**
* Initializes a plugin.
*
*/
require(name: string): any;
};
[x: string]: any;
/**
* Registers a plugin.
*
* @param {function} fn
*/
define(name: string, fn: (this: any, settings: TSettings) => any): void;
};
export {};

109
node_modules/tom-select/dist/esm/contrib/microplugin.js generated vendored Normal file
View File

@@ -0,0 +1,109 @@
/**
* microplugin.js
* Copyright (c) 2013 Brian Reavis & contributors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*
* @author Brian Reavis <brian@thirdroute.com>
*/
export default function MicroPlugin(Interface) {
Interface.plugins = {};
return class extends Interface {
constructor() {
super(...arguments);
this.plugins = {
names: [],
settings: {},
requested: {},
loaded: {}
};
}
/**
* Registers a plugin.
*
* @param {function} fn
*/
static define(name, fn) {
Interface.plugins[name] = {
'name': name,
'fn': fn
};
}
/**
* Initializes the listed plugins (with options).
* Acceptable formats:
*
* List (without options):
* ['a', 'b', 'c']
*
* List (with options):
* [{'name': 'a', options: {}}, {'name': 'b', options: {}}]
*
* Hash (with options):
* {'a': { ... }, 'b': { ... }, 'c': { ... }}
*
* @param {array|object} plugins
*/
initializePlugins(plugins) {
var key, name;
const self = this;
const queue = [];
if (Array.isArray(plugins)) {
plugins.forEach((plugin) => {
if (typeof plugin === 'string') {
queue.push(plugin);
}
else {
self.plugins.settings[plugin.name] = plugin.options;
queue.push(plugin.name);
}
});
}
else if (plugins) {
for (key in plugins) {
if (plugins.hasOwnProperty(key)) {
self.plugins.settings[key] = plugins[key];
queue.push(key);
}
}
}
while (name = queue.shift()) {
self.require(name);
}
}
loadPlugin(name) {
var self = this;
var plugins = self.plugins;
var plugin = Interface.plugins[name];
if (!Interface.plugins.hasOwnProperty(name)) {
throw new Error('Unable to find "' + name + '" plugin');
}
plugins.requested[name] = true;
plugins.loaded[name] = plugin.fn.apply(self, [self.plugins.settings[name] || {}]);
plugins.names.push(name);
}
/**
* Initializes a plugin.
*
*/
require(name) {
var self = this;
var plugins = self.plugins;
if (!self.plugins.loaded.hasOwnProperty(name)) {
if (plugins.requested[name]) {
throw new Error('Plugin has circular dependency ("' + name + '")');
}
self.loadPlugin(name);
}
return plugins.loaded[name];
}
};
}
//# sourceMappingURL=microplugin.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"microplugin.js","sourceRoot":"","sources":["../../../src/contrib/microplugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAmBH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,SAAc;IAEjD,SAAS,CAAC,OAAO,GAAG,EAAE,CAAC;IAEvB,OAAO,KAAM,SAAQ,SAAS;QAAvB;;YAEC,YAAO,GAAY;gBACzB,KAAK,EAAO,EAAE;gBACd,QAAQ,EAAI,EAAE;gBACd,SAAS,EAAG,EAAE;gBACd,MAAM,EAAM,EAAE;aACd,CAAC;QA0FH,CAAC;QAxFA;;;;WAIG;QACH,MAAM,CAAC,MAAM,CAAC,I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roups: never[];
plugins: never[];
delimiter: string;
splitOn: null;
persist: boolean;
diacritics: boolean;
create: null;
createOnBlur: boolean;
createFilter: null;
highlight: boolean;
openOnFocus: boolean;
shouldOpen: null;
maxOptions: number;
maxItems: null;
hideSelected: null;
duplicates: boolean;
addPrecedence: boolean;
selectOnTab: boolean;
preload: null;
allowEmptyOption: boolean;
refreshThrottle: number;
loadThrottle: number;
loadingClass: string;
dataAttr: null;
optgroupField: string;
valueField: string;
labelField: string;
disabledField: string;
optgroupLabelField: string;
optgroupValueField: string;
lockOptgroupOrder: boolean;
sortField: string;
searchField: string[];
searchConjunction: string;
mode: null;
wrapperClass: string;
controlClass: string;
dropdownClass: string;
dropdownContentClass: string;
itemClass: string;
optionClass: string;
dropdownParent: null;
controlInput: string;
copyClassesToDropdown: boolean;
placeholder: null;
hidePlaceholder: null;
shouldLoad: (query: string) => boolean;
render: {};
};
export default _default;

82
node_modules/tom-select/dist/esm/defaults.js generated vendored Normal file
View File

@@ -0,0 +1,82 @@
export default {
options: [],
optgroups: [],
plugins: [],
delimiter: ',',
splitOn: null, // regexp or string for splitting up values from a paste command
persist: true,
diacritics: true,
create: null,
createOnBlur: false,
createFilter: null,
highlight: true,
openOnFocus: true,
shouldOpen: null,
maxOptions: 50,
maxItems: null,
hideSelected: null,
duplicates: false,
addPrecedence: false,
selectOnTab: false,
preload: null,
allowEmptyOption: false,
//closeAfterSelect: false,
refreshThrottle: 300,
loadThrottle: 300,
loadingClass: 'loading',
dataAttr: null, //'data-data',
optgroupField: 'optgroup',
valueField: 'value',
labelField: 'text',
disabledField: 'disabled',
optgroupLabelField: 'label',
optgroupValueField: 'value',
lockOptgroupOrder: false,
sortField: '$order',
searchField: ['text'],
searchConjunction: 'and',
mode: null,
wrapperClass: 'ts-wrapper',
controlClass: 'ts-control',
dropdownClass: 'ts-dropdown',
dropdownContentClass: 'ts-dropdown-content',
itemClass: 'item',
optionClass: 'option',
dropdownParent: null,
controlInput: '<input type="text" autocomplete="off" size="1" />',
copyClassesToDropdown: false,
placeholder: null,
hidePlaceholder: null,
shouldLoad: function (query) {
return query.length > 0;
},
/*
load : null, // function(query, callback) { ... }
score : null, // function(search) { ... }
onInitialize : null, // function() { ... }
onChange : null, // function(value) { ... }
onItemAdd : null, // function(value, $item) { ... }
onItemRemove : null, // function(value) { ... }
onClear : null, // function() { ... }
onOptionAdd : null, // function(value, data) { ... }
onOptionRemove : null, // function(value) { ... }
onOptionClear : null, // function() { ... }
onOptionGroupAdd : null, // function(id, data) { ... }
onOptionGroupRemove : null, // function(id) { ... }
onOptionGroupClear : null, // function() { ... }
onDropdownOpen : null, // function(dropdown) { ... }
onDropdownClose : null, // function(dropdown) { ... }
onType : null, // function(str) { ... }
onDelete : null, // function(values) { ... }
*/
render: {
/*
item: null,
optgroup: null,
optgroup_header: null,
option: null,
option_create: null
*/
}
};
//# sourceMappingURL=defaults.js.map

1
node_modules/tom-select/dist/esm/defaults.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../src/defaults.ts"],"names":[],"mappings":"AACA,eAAe;IACd,OAAO,EAAE,EAAE;IACX,SAAS,EAAE,EAAE;IAEb,OAAO,EAAE,EAAE;IACX,SAAS,EAAE,GAAG;IACd,OAAO,EAAE,IAAI,EAAE,gEAAgE;IAC/E,OAAO,EAAE,IAAI;IACb,UAAU,EAAE,IAAI;IAChB,MAAM,EAAE,IAAI;IACZ,YAAY,EAAE,KAAK;IACnB,YAAY,EAAE,IAAI;IAClB,SAAS,EAAE,IAAI;IACf,WAAW,EAAE,IAAI;IACjB,UAAU,EAAE,IAAI;IAChB,UAAU,EAAE,EAAE;IACd,QAAQ,EAAE,IAAI;IACd,YAAY,EAAE,IAAI;IAClB,UAAU,EAAE,KAAK;IACjB,aAAa,EAAE,KAAK;IACpB,WAAW,EAAE,KAAK;IAClB,OAAO,EAAE,IAAI;IACb,gBAAgB,EAAE,KAAK;IACvB,0BAA0B;IAC1B,eAAe,EAAE,GAAG;IAGpB,YAAY,EAAE,GAAG;IACjB,YAAY,EAAE,SAAS;IAEvB,QAAQ,EAAE,IAAI,EAAE,cAAc;IAC9B,aAAa,EAAE,UAAU;IACzB,UAAU,EAAE,OAAO;IACnB,UAAU,EAAE,MAAM;IAClB,aAAa,EAAE,UAAU;IACzB,kBAAkB,EAAE,OAAO;IAC3B,kBAAkB,EAAE,OAAO;IAC3B,iBAAiB,EAAE,KAAK;IAExB,SAAS,EAAE,QAAQ;IACnB,WAAW,EAAE,CAAC,MAAM,CAAC;IACrB,iBAAiB,EAAE,KAAK;IAExB,IAAI,EAAE,IAAI;IACV,YAAY,EAAE,YAAY;IAC1B,YAAY,EAAE,YAAY;IAC1B,aAAa,EAAE,aAAa;IAC5B,oBAAoB,EAAE,qBAAqB;IAC3C,SAAS,EAAE,MAAM;IACjB,WAAW,EAAE,QAAQ;IAErB,cAAc,EAAE,IAAI;IACpB,YAAY,EAAE,mDAAmD;IAEjE,qBAAqB,EAAE,KAAK;IAE5B,WAAW,EAAE,IAAI;IACjB,eAAe,EAAE,IAAI;IAErB,UAAU,EAAE,UAAS,KAAY;QAChC,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;IACzB,CAAC;IAED;;;;;;;;;;;;;;;;;;MAkBE;IAEF,MAAM,EAAE;IACP;;;;;;MAME;KACF;CACD,CAAC"}

3
node_modules/tom-select/dist/esm/getSettings.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import { TomSettings, RecursivePartial } from './types/index.ts';
import { TomInput } from './types/index.ts';
export default function getSettings(input: TomInput, settings_user: RecursivePartial<TomSettings>): TomSettings;

143
node_modules/tom-select/dist/esm/getSettings.js generated vendored Normal file
View File

@@ -0,0 +1,143 @@
import defaults from "./defaults.js";
import { hash_key, iterate } from "./utils.js";
export default function getSettings(input, settings_user) {
var settings = Object.assign({}, defaults, settings_user);
var attr_data = settings.dataAttr;
var field_label = settings.labelField;
var field_value = settings.valueField;
var field_disabled = settings.disabledField;
var field_optgroup = settings.optgroupField;
var field_optgroup_label = settings.optgroupLabelField;
var field_optgroup_value = settings.optgroupValueField;
var tag_name = input.tagName.toLowerCase();
var placeholder = input.getAttribute('placeholder') || input.getAttribute('data-placeholder');
if (!placeholder && !settings.allowEmptyOption) {
let option = input.querySelector('option[value=""]');
if (option) {
placeholder = option.textContent;
}
}
var settings_element = {
placeholder: placeholder,
options: [],
optgroups: [],
items: [],
maxItems: null,
};
/**
* Initialize from a <select> element.
*
*/
var init_select = () => {
var tagName;
var options = settings_element.options;
var optionsMap = {};
var group_count = 1;
let $order = 0;
var readData = (el) => {
var data = Object.assign({}, el.dataset); // get plain object from DOMStringMap
var json = attr_data && data[attr_data];
if (typeof json === 'string' && json.length) {
data = Object.assign(data, JSON.parse(json));
}
return data;
};
var addOption = (option, group) => {
var value = hash_key(option.value);
if (value == null)
return;
if (!value && !settings.allowEmptyOption)
return;
// if the option already exists, it's probably been
// duplicated in another optgroup. in this case, push
// the current group to the "optgroup" property on the
// existing option so that it's rendered in both places.
if (optionsMap.hasOwnProperty(value)) {
if (group) {
var arr = optionsMap[value][field_optgroup];
if (!arr) {
optionsMap[value][field_optgroup] = group;
}
else if (!Array.isArray(arr)) {
optionsMap[value][field_optgroup] = [arr, group];
}
else {
arr.push(group);
}
}
}
else {
var option_data = readData(option);
option_data[field_label] = option_data[field_label] || option.textContent;
option_data[field_value] = option_data[field_value] || value;
option_data[field_disabled] = option_data[field_disabled] || option.disabled;
option_data[field_optgroup] = option_data[field_optgroup] || group;
option_data.$option = option;
option_data.$order = option_data.$order || ++$order;
optionsMap[value] = option_data;
options.push(option_data);
}
if (option.selected) {
settings_element.items.push(value);
}
};
var addGroup = (optgroup) => {
var id, optgroup_data;
optgroup_data = readData(optgroup);
optgroup_data[field_optgroup_label] = optgroup_data[field_optgroup_label] || optgroup.getAttribute('label') || '';
optgroup_data[field_optgroup_value] = optgroup_data[field_optgroup_value] || group_count++;
optgroup_data[field_disabled] = optgroup_data[field_disabled] || optgroup.disabled;
optgroup_data.$order = optgroup_data.$order || ++$order;
settings_element.optgroups.push(optgroup_data);
id = optgroup_data[field_optgroup_value];
iterate(optgroup.children, (option) => {
addOption(option, id);
});
};
settings_element.maxItems = input.hasAttribute('multiple') ? null : 1;
iterate(input.children, (child) => {
tagName = child.tagName.toLowerCase();
if (tagName === 'optgroup') {
addGroup(child);
}
else if (tagName === 'option') {
addOption(child);
}
});
};
/**
* Initialize from a <input type="text"> element.
*
*/
var init_textbox = () => {
const data_raw = input.getAttribute(attr_data);
if (!data_raw) {
var value = input.value.trim() || '';
if (!settings.allowEmptyOption && !value.length)
return;
const values = value.split(settings.delimiter);
iterate(values, (value) => {
const option = {};
option[field_label] = value;
option[field_value] = value;
settings_element.options.push(option);
});
settings_element.items = values;
}
else {
settings_element.options = JSON.parse(data_raw);
iterate(settings_element.options, (opt) => {
settings_element.items.push(opt[field_value]);
});
}
};
if (tag_name === 'select') {
init_select();
}
else {
init_textbox();
}
return Object.assign({}, defaults, settings_element, settings_user);
}
;
//# sourceMappingURL=getSettings.js.map

1
node_modules/tom-select/dist/esm/getSettings.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,16 @@
/**
* Plugin: "dropdown_input" (Tom Select)
* Copyright (c) contributors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*
*/
import type TomSelect from '../../tom-select.ts';
export default function (this: TomSelect): void;

View File

@@ -0,0 +1,163 @@
/**
* Tom Select v2.4.3
* Licensed under the Apache License, Version 2.0 (the "License");
*/
/**
* Converts a scalar to its best string representation
* for hash keys and HTML attribute values.
*
* Transformations:
* 'str' -> 'str'
* null -> ''
* undefined -> ''
* true -> '1'
* false -> '0'
* 0 -> '0'
* 1 -> '1'
*
*/
/**
* Iterates over arrays and hashes.
*
* ```
* iterate(this.items, function(item, id) {
* // invoked for each item
* });
* ```
*
*/
const iterate = (object, callback) => {
if (Array.isArray(object)) {
object.forEach(callback);
} else {
for (var key in object) {
if (object.hasOwnProperty(key)) {
callback(object[key], key);
}
}
}
};
/**
* Remove css classes
*
*/
const removeClasses = (elmts, ...classes) => {
var norm_classes = classesArray(classes);
elmts = castAsArray(elmts);
elmts.map(el => {
norm_classes.map(cls => {
el.classList.remove(cls);
});
});
};
/**
* Return arguments
*
*/
const classesArray = args => {
var classes = [];
iterate(args, _classes => {
if (typeof _classes === 'string') {
_classes = _classes.trim().split(/[\t\n\f\r\s]/);
}
if (Array.isArray(_classes)) {
classes = classes.concat(_classes);
}
});
return classes.filter(Boolean);
};
/**
* Create an array from arg if it's not already an array
*
*/
const castAsArray = arg => {
if (!Array.isArray(arg)) {
arg = [arg];
}
return arg;
};
/**
* Get the index of an element amongst sibling nodes of the same type
*
*/
const nodeIndex = (el, amongst) => {
if (!el) return -1;
amongst = amongst || el.nodeName;
var i = 0;
while (el = el.previousElementSibling) {
if (el.matches(amongst)) {
i++;
}
}
return i;
};
/**
* Plugin: "dropdown_input" (Tom Select)
* Copyright (c) contributors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*
*/
function plugin () {
var self = this;
/**
* Moves the caret to the specified index.
*
* The input must be moved by leaving it in place and moving the
* siblings, due to the fact that focus cannot be restored once lost
* on mobile webkit devices
*
*/
self.hook('instead', 'setCaret', new_pos => {
if (self.settings.mode === 'single' || !self.control.contains(self.control_input)) {
new_pos = self.items.length;
} else {
new_pos = Math.max(0, Math.min(self.items.length, new_pos));
if (new_pos != self.caretPos && !self.isPending) {
self.controlChildren().forEach((child, j) => {
if (j < new_pos) {
self.control_input.insertAdjacentElement('beforebegin', child);
} else {
self.control.appendChild(child);
}
});
}
}
self.caretPos = new_pos;
});
self.hook('instead', 'moveCaret', direction => {
if (!self.isFocused) return;
// move caret before or after selected items
const last_active = self.getLastActive(direction);
if (last_active) {
const idx = nodeIndex(last_active);
self.setCaret(direction > 0 ? idx + 1 : idx);
self.setActiveItem();
removeClasses(last_active, 'last-active');
// move caret left or right of current position
} else {
self.setCaret(self.caretPos + direction);
}
});
}
export { plugin as default };
//# sourceMappingURL=plugin.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,16 @@
/**
* Plugin: "change_listener" (Tom Select)
* Copyright (c) contributors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*
*/
import type TomSelect from '../../tom-select.ts';
export default function (this: TomSelect): void;

View File

@@ -0,0 +1,51 @@
/**
* Tom Select v2.4.3
* Licensed under the Apache License, Version 2.0 (the "License");
*/
/**
* Converts a scalar to its best string representation
* for hash keys and HTML attribute values.
*
* Transformations:
* 'str' -> 'str'
* null -> ''
* undefined -> ''
* true -> '1'
* false -> '0'
* 0 -> '0'
* 1 -> '1'
*
*/
/**
* Add event helper
*
*/
const addEvent = (target, type, callback, options) => {
target.addEventListener(type, callback, options);
};
/**
* Plugin: "change_listener" (Tom Select)
* Copyright (c) contributors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*
*/
function plugin () {
addEvent(this.input, 'change', () => {
this.sync();
});
}
export { plugin as default };
//# sourceMappingURL=plugin.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,17 @@
/**
* Plugin: "checkbox_options" (Tom Select)
* Copyright (c) contributors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*
*/
import type TomSelect from '../../tom-select.ts';
import { CBOptions } from './types.ts';
export default function (this: TomSelect, userOptions: CBOptions): void;

View File

@@ -0,0 +1,179 @@
/**
* Tom Select v2.4.3
* Licensed under the Apache License, Version 2.0 (the "License");
*/
/**
* Converts a scalar to its best string representation
* for hash keys and HTML attribute values.
*
* Transformations:
* 'str' -> 'str'
* null -> ''
* undefined -> ''
* true -> '1'
* false -> '0'
* 0 -> '0'
* 1 -> '1'
*
*/
const hash_key = value => {
if (typeof value === 'undefined' || value === null) return null;
return get_hash(value);
};
const get_hash = value => {
if (typeof value === 'boolean') return value ? '1' : '0';
return value + '';
};
/**
* Prevent default
*
*/
const preventDefault = (evt, stop = false) => {
if (evt) {
evt.preventDefault();
if (stop) {
evt.stopPropagation();
}
}
};
/**
* Return a dom element from either a dom query string, jQuery object, a dom element or html string
* https://stackoverflow.com/questions/494143/creating-a-new-dom-element-from-an-html-string-using-built-in-dom-methods-or-pro/35385518#35385518
*
* param query should be {}
*/
const getDom = query => {
if (query.jquery) {
return query[0];
}
if (query instanceof HTMLElement) {
return query;
}
if (isHtmlString(query)) {
var tpl = document.createElement('template');
tpl.innerHTML = query.trim(); // Never return a text node of whitespace as the result
return tpl.content.firstChild;
}
return document.querySelector(query);
};
const isHtmlString = arg => {
if (typeof arg === 'string' && arg.indexOf('<') > -1) {
return true;
}
return false;
};
/**
* Plugin: "checkbox_options" (Tom Select)
* Copyright (c) contributors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*
*/
function plugin (userOptions) {
var self = this;
var orig_onOptionSelect = self.onOptionSelect;
self.settings.hideSelected = false;
const cbOptions = Object.assign({
// so that the user may add different ones as well
className: "tomselect-checkbox",
// the following default to the historic plugin's values
checkedClassNames: undefined,
uncheckedClassNames: undefined
}, userOptions);
var UpdateChecked = function UpdateChecked(checkbox, toCheck) {
if (toCheck) {
checkbox.checked = true;
if (cbOptions.uncheckedClassNames) {
checkbox.classList.remove(...cbOptions.uncheckedClassNames);
}
if (cbOptions.checkedClassNames) {
checkbox.classList.add(...cbOptions.checkedClassNames);
}
} else {
checkbox.checked = false;
if (cbOptions.checkedClassNames) {
checkbox.classList.remove(...cbOptions.checkedClassNames);
}
if (cbOptions.uncheckedClassNames) {
checkbox.classList.add(...cbOptions.uncheckedClassNames);
}
}
};
// update the checkbox for an option
var UpdateCheckbox = function UpdateCheckbox(option) {
setTimeout(() => {
var checkbox = option.querySelector('input.' + cbOptions.className);
if (checkbox instanceof HTMLInputElement) {
UpdateChecked(checkbox, option.classList.contains('selected'));
}
}, 1);
};
// add checkbox to option template
self.hook('after', 'setupTemplates', () => {
var orig_render_option = self.settings.render.option;
self.settings.render.option = (data, escape_html) => {
var rendered = getDom(orig_render_option.call(self, data, escape_html));
var checkbox = document.createElement('input');
if (cbOptions.className) {
checkbox.classList.add(cbOptions.className);
}
checkbox.addEventListener('click', function (evt) {
preventDefault(evt);
});
checkbox.type = 'checkbox';
const hashed = hash_key(data[self.settings.valueField]);
UpdateChecked(checkbox, !!(hashed && self.items.indexOf(hashed) > -1));
rendered.prepend(checkbox);
return rendered;
};
});
// uncheck when item removed
self.on('item_remove', value => {
var option = self.getOption(value);
if (option) {
// if dropdown hasn't been opened yet, the option won't exist
option.classList.remove('selected'); // selected class won't be removed yet
UpdateCheckbox(option);
}
});
// check when item added
self.on('item_add', value => {
var option = self.getOption(value);
if (option) {
// if dropdown hasn't been opened yet, the option won't exist
UpdateCheckbox(option);
}
});
// remove items when selected option is clicked
self.hook('instead', 'onOptionSelect', (evt, option) => {
if (option.classList.contains('selected')) {
option.classList.remove('selected');
self.removeItem(option.dataset.value);
self.refreshOptions();
preventDefault(evt, true);
return;
}
orig_onOptionSelect.call(self, evt, option);
UpdateCheckbox(option);
});
}
export { plugin as default };
//# sourceMappingURL=plugin.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,14 @@
export type CBOptions = {
/**
* a unique class name for the checkbox to find the input
*/
className?: string;
/**
* class name to add if checkbox is checked and remove otherwise
*/
checkedClassNames?: string[];
/**
* class name to add if checkbox was not checked and remove otherwise
*/
uncheckedClassNames?: string[];
};

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=types.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/plugins/checkbox_options/types.ts"],"names":[],"mappings":""}

View File

@@ -0,0 +1,17 @@
/**
* Plugin: "dropdown_header" (Tom Select)
* Copyright (c) contributors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*
*/
import type TomSelect from '../../tom-select.ts';
import { CBOptions } from './types.ts';
export default function (this: TomSelect, userOptions: CBOptions): void;

View File

@@ -0,0 +1,73 @@
/**
* Tom Select v2.4.3
* Licensed under the Apache License, Version 2.0 (the "License");
*/
/**
* Return a dom element from either a dom query string, jQuery object, a dom element or html string
* https://stackoverflow.com/questions/494143/creating-a-new-dom-element-from-an-html-string-using-built-in-dom-methods-or-pro/35385518#35385518
*
* param query should be {}
*/
const getDom = query => {
if (query.jquery) {
return query[0];
}
if (query instanceof HTMLElement) {
return query;
}
if (isHtmlString(query)) {
var tpl = document.createElement('template');
tpl.innerHTML = query.trim(); // Never return a text node of whitespace as the result
return tpl.content.firstChild;
}
return document.querySelector(query);
};
const isHtmlString = arg => {
if (typeof arg === 'string' && arg.indexOf('<') > -1) {
return true;
}
return false;
};
/**
* Plugin: "dropdown_header" (Tom Select)
* Copyright (c) contributors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*
*/
function plugin (userOptions) {
const self = this;
const options = Object.assign({
className: 'clear-button',
title: 'Clear All',
html: data => {
return `<div class="${data.className}" title="${data.title}">&#10799;</div>`;
}
}, userOptions);
self.on('initialize', () => {
var button = getDom(options.html(options));
button.addEventListener('click', evt => {
if (self.isLocked) return;
self.clear();
if (self.settings.mode === 'single' && self.settings.allowEmptyOption) {
self.addItem('');
}
evt.preventDefault();
evt.stopPropagation();
});
self.control.appendChild(button);
});
}
export { plugin as default };
//# sourceMappingURL=plugin.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,5 @@
export type CBOptions = {
className?: string;
title?: string;
html?: (data: CBOptions) => string;
};

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=types.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/plugins/clear_button/types.ts"],"names":[],"mappings":""}

View File

@@ -0,0 +1,16 @@
/**
* Plugin: "drag_drop" (Tom Select)
* Copyright (c) contributors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*
*/
import type TomSelect from '../../tom-select.ts';
export default function (this: TomSelect): void;

View File

@@ -0,0 +1,220 @@
/**
* Tom Select v2.4.3
* Licensed under the Apache License, Version 2.0 (the "License");
*/
/**
* Converts a scalar to its best string representation
* for hash keys and HTML attribute values.
*
* Transformations:
* 'str' -> 'str'
* null -> ''
* undefined -> ''
* true -> '1'
* false -> '0'
* 0 -> '0'
* 1 -> '1'
*
*/
/**
* Prevent default
*
*/
const preventDefault = (evt, stop = false) => {
if (evt) {
evt.preventDefault();
if (stop) {
evt.stopPropagation();
}
}
};
/**
* Add event helper
*
*/
const addEvent = (target, type, callback, options) => {
target.addEventListener(type, callback, options);
};
/**
* Iterates over arrays and hashes.
*
* ```
* iterate(this.items, function(item, id) {
* // invoked for each item
* });
* ```
*
*/
const iterate = (object, callback) => {
if (Array.isArray(object)) {
object.forEach(callback);
} else {
for (var key in object) {
if (object.hasOwnProperty(key)) {
callback(object[key], key);
}
}
}
};
/**
* Return a dom element from either a dom query string, jQuery object, a dom element or html string
* https://stackoverflow.com/questions/494143/creating-a-new-dom-element-from-an-html-string-using-built-in-dom-methods-or-pro/35385518#35385518
*
* param query should be {}
*/
const getDom = query => {
if (query.jquery) {
return query[0];
}
if (query instanceof HTMLElement) {
return query;
}
if (isHtmlString(query)) {
var tpl = document.createElement('template');
tpl.innerHTML = query.trim(); // Never return a text node of whitespace as the result
return tpl.content.firstChild;
}
return document.querySelector(query);
};
const isHtmlString = arg => {
if (typeof arg === 'string' && arg.indexOf('<') > -1) {
return true;
}
return false;
};
/**
* Set attributes of an element
*
*/
const setAttr = (el, attrs) => {
iterate(attrs, (val, attr) => {
if (val == null) {
el.removeAttribute(attr);
} else {
el.setAttribute(attr, '' + val);
}
});
};
/**
* Plugin: "drag_drop" (Tom Select)
* Copyright (c) contributors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*
*/
const insertAfter = (referenceNode, newNode) => {
var _referenceNode$parent;
(_referenceNode$parent = referenceNode.parentNode) == null || _referenceNode$parent.insertBefore(newNode, referenceNode.nextSibling);
};
const insertBefore = (referenceNode, newNode) => {
var _referenceNode$parent2;
(_referenceNode$parent2 = referenceNode.parentNode) == null || _referenceNode$parent2.insertBefore(newNode, referenceNode);
};
const isBefore = (referenceNode, newNode) => {
do {
var _newNode;
newNode = (_newNode = newNode) == null ? void 0 : _newNode.previousElementSibling;
if (referenceNode == newNode) {
return true;
}
} while (newNode && newNode.previousElementSibling);
return false;
};
function plugin () {
var self = this;
if (self.settings.mode !== 'multi') return;
var orig_lock = self.lock;
var orig_unlock = self.unlock;
let sortable = true;
let drag_item;
/**
* Add draggable attribute to item
*/
self.hook('after', 'setupTemplates', () => {
var orig_render_item = self.settings.render.item;
self.settings.render.item = (data, escape) => {
const item = getDom(orig_render_item.call(self, data, escape));
setAttr(item, {
'draggable': 'true'
});
// prevent doc_mousedown (see tom-select.ts)
const mousedown = evt => {
if (!sortable) preventDefault(evt);
evt.stopPropagation();
};
const dragStart = evt => {
drag_item = item;
setTimeout(() => {
item.classList.add('ts-dragging');
}, 0);
};
const dragOver = evt => {
evt.preventDefault();
item.classList.add('ts-drag-over');
moveitem(item, drag_item);
};
const dragLeave = () => {
item.classList.remove('ts-drag-over');
};
const moveitem = (targetitem, dragitem) => {
if (dragitem === undefined) return;
if (isBefore(dragitem, item)) {
insertAfter(targetitem, dragitem);
} else {
insertBefore(targetitem, dragitem);
}
};
const dragend = () => {
var _drag_item;
document.querySelectorAll('.ts-drag-over').forEach(el => el.classList.remove('ts-drag-over'));
(_drag_item = drag_item) == null || _drag_item.classList.remove('ts-dragging');
drag_item = undefined;
var values = [];
self.control.querySelectorAll(`[data-value]`).forEach(el => {
if (el.dataset.value) {
let value = el.dataset.value;
if (value) {
values.push(value);
}
}
});
self.setValue(values);
};
addEvent(item, 'mousedown', mousedown);
addEvent(item, 'dragstart', dragStart);
addEvent(item, 'dragenter', dragOver);
addEvent(item, 'dragover', dragOver);
addEvent(item, 'dragleave', dragLeave);
addEvent(item, 'dragend', dragend);
return item;
};
});
self.hook('instead', 'lock', () => {
sortable = false;
return orig_lock.call(self);
});
self.hook('instead', 'unlock', () => {
sortable = true;
return orig_unlock.call(self);
});
}
export { plugin as default };
//# sourceMappingURL=plugin.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,17 @@
/**
* Plugin: "dropdown_header" (Tom Select)
* Copyright (c) contributors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*
*/
import type TomSelect from '../../tom-select.ts';
import { DHOptions } from './types.ts';
export default function (this: TomSelect, userOptions: DHOptions): void;

View File

@@ -0,0 +1,102 @@
/**
* Tom Select v2.4.3
* Licensed under the Apache License, Version 2.0 (the "License");
*/
/**
* Converts a scalar to its best string representation
* for hash keys and HTML attribute values.
*
* Transformations:
* 'str' -> 'str'
* null -> ''
* undefined -> ''
* true -> '1'
* false -> '0'
* 0 -> '0'
* 1 -> '1'
*
*/
/**
* Prevent default
*
*/
const preventDefault = (evt, stop = false) => {
if (evt) {
evt.preventDefault();
if (stop) {
evt.stopPropagation();
}
}
};
/**
* Return a dom element from either a dom query string, jQuery object, a dom element or html string
* https://stackoverflow.com/questions/494143/creating-a-new-dom-element-from-an-html-string-using-built-in-dom-methods-or-pro/35385518#35385518
*
* param query should be {}
*/
const getDom = query => {
if (query.jquery) {
return query[0];
}
if (query instanceof HTMLElement) {
return query;
}
if (isHtmlString(query)) {
var tpl = document.createElement('template');
tpl.innerHTML = query.trim(); // Never return a text node of whitespace as the result
return tpl.content.firstChild;
}
return document.querySelector(query);
};
const isHtmlString = arg => {
if (typeof arg === 'string' && arg.indexOf('<') > -1) {
return true;
}
return false;
};
/**
* Plugin: "dropdown_header" (Tom Select)
* Copyright (c) contributors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*
*/
function plugin (userOptions) {
const self = this;
const options = Object.assign({
title: 'Untitled',
headerClass: 'dropdown-header',
titleRowClass: 'dropdown-header-title',
labelClass: 'dropdown-header-label',
closeClass: 'dropdown-header-close',
html: data => {
return '<div class="' + data.headerClass + '">' + '<div class="' + data.titleRowClass + '">' + '<span class="' + data.labelClass + '">' + data.title + '</span>' + '<a class="' + data.closeClass + '">&times;</a>' + '</div>' + '</div>';
}
}, userOptions);
self.on('initialize', () => {
var header = getDom(options.html(options));
var close_link = header.querySelector('.' + options.closeClass);
if (close_link) {
close_link.addEventListener('click', evt => {
preventDefault(evt, true);
self.close();
});
}
self.dropdown.insertBefore(header, self.dropdown.firstChild);
});
}
export { plugin as default };
//# sourceMappingURL=plugin.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,8 @@
export type DHOptions = {
title?: string;
headerClass?: string;
titleRowClass?: string;
labelClass?: string;
closeClass?: string;
html?: (data: DHOptions) => string;
};

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=types.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/plugins/dropdown_header/types.ts"],"names":[],"mappings":""}

View File

@@ -0,0 +1,16 @@
/**
* Plugin: "dropdown_input" (Tom Select)
* Copyright (c) contributors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*
*/
import type TomSelect from '../../tom-select.ts';
export default function (this: TomSelect): void;

View File

@@ -0,0 +1,214 @@
/**
* Tom Select v2.4.3
* Licensed under the Apache License, Version 2.0 (the "License");
*/
const KEY_ESC = 27;
const KEY_TAB = 9;
// ctrl key or apple key for ma
/**
* Converts a scalar to its best string representation
* for hash keys and HTML attribute values.
*
* Transformations:
* 'str' -> 'str'
* null -> ''
* undefined -> ''
* true -> '1'
* false -> '0'
* 0 -> '0'
* 1 -> '1'
*
*/
/**
* Prevent default
*
*/
const preventDefault = (evt, stop = false) => {
if (evt) {
evt.preventDefault();
if (stop) {
evt.stopPropagation();
}
}
};
/**
* Add event helper
*
*/
const addEvent = (target, type, callback, options) => {
target.addEventListener(type, callback, options);
};
/**
* Iterates over arrays and hashes.
*
* ```
* iterate(this.items, function(item, id) {
* // invoked for each item
* });
* ```
*
*/
const iterate = (object, callback) => {
if (Array.isArray(object)) {
object.forEach(callback);
} else {
for (var key in object) {
if (object.hasOwnProperty(key)) {
callback(object[key], key);
}
}
}
};
/**
* Return a dom element from either a dom query string, jQuery object, a dom element or html string
* https://stackoverflow.com/questions/494143/creating-a-new-dom-element-from-an-html-string-using-built-in-dom-methods-or-pro/35385518#35385518
*
* param query should be {}
*/
const getDom = query => {
if (query.jquery) {
return query[0];
}
if (query instanceof HTMLElement) {
return query;
}
if (isHtmlString(query)) {
var tpl = document.createElement('template');
tpl.innerHTML = query.trim(); // Never return a text node of whitespace as the result
return tpl.content.firstChild;
}
return document.querySelector(query);
};
const isHtmlString = arg => {
if (typeof arg === 'string' && arg.indexOf('<') > -1) {
return true;
}
return false;
};
/**
* Add css classes
*
*/
const addClasses = (elmts, ...classes) => {
var norm_classes = classesArray(classes);
elmts = castAsArray(elmts);
elmts.map(el => {
norm_classes.map(cls => {
el.classList.add(cls);
});
});
};
/**
* Return arguments
*
*/
const classesArray = args => {
var classes = [];
iterate(args, _classes => {
if (typeof _classes === 'string') {
_classes = _classes.trim().split(/[\t\n\f\r\s]/);
}
if (Array.isArray(_classes)) {
classes = classes.concat(_classes);
}
});
return classes.filter(Boolean);
};
/**
* Create an array from arg if it's not already an array
*
*/
const castAsArray = arg => {
if (!Array.isArray(arg)) {
arg = [arg];
}
return arg;
};
/**
* Plugin: "dropdown_input" (Tom Select)
* Copyright (c) contributors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*
*/
function plugin () {
const self = this;
self.settings.shouldOpen = true; // make sure the input is shown even if there are no options to display in the dropdown
self.hook('before', 'setup', () => {
self.focus_node = self.control;
addClasses(self.control_input, 'dropdown-input');
const div = getDom('<div class="dropdown-input-wrap">');
div.append(self.control_input);
self.dropdown.insertBefore(div, self.dropdown.firstChild);
// set a placeholder in the select control
const placeholder = getDom('<input class="items-placeholder" tabindex="-1" />');
placeholder.placeholder = self.settings.placeholder || '';
self.control.append(placeholder);
});
self.on('initialize', () => {
// set tabIndex on control to -1, otherwise [shift+tab] will put focus right back on control_input
self.control_input.addEventListener('keydown', evt => {
//addEvent(self.control_input,'keydown' as const,(evt:KeyboardEvent) =>{
switch (evt.keyCode) {
case KEY_ESC:
if (self.isOpen) {
preventDefault(evt, true);
self.close();
}
self.clearActiveItems();
return;
case KEY_TAB:
self.focus_node.tabIndex = -1;
break;
}
return self.onKeyDown.call(self, evt);
});
self.on('blur', () => {
self.focus_node.tabIndex = self.isDisabled ? -1 : self.tabIndex;
});
// give the control_input focus when the dropdown is open
self.on('dropdown_open', () => {
self.control_input.focus();
});
// prevent onBlur from closing when focus is on the control_input
const orig_onBlur = self.onBlur;
self.hook('instead', 'onBlur', evt => {
if (evt && evt.relatedTarget == self.control_input) return;
return orig_onBlur.call(self);
});
addEvent(self.control_input, 'blur', () => self.onBlur());
// return focus to control to allow further keyboard input
self.hook('before', 'close', () => {
if (!self.isOpen) return;
self.focus_node.focus({
preventScroll: true
});
});
});
}
export { plugin as default };
//# sourceMappingURL=plugin.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,15 @@
/**
* Plugin: "input_autogrow" (Tom Select)
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*
*/
import type TomSelect from '../../tom-select.ts';
export default function (this: TomSelect): void;

View File

@@ -0,0 +1,74 @@
/**
* Tom Select v2.4.3
* Licensed under the Apache License, Version 2.0 (the "License");
*/
/**
* Converts a scalar to its best string representation
* for hash keys and HTML attribute values.
*
* Transformations:
* 'str' -> 'str'
* null -> ''
* undefined -> ''
* true -> '1'
* false -> '0'
* 0 -> '0'
* 1 -> '1'
*
*/
/**
* Add event helper
*
*/
const addEvent = (target, type, callback, options) => {
target.addEventListener(type, callback, options);
};
/**
* Plugin: "input_autogrow" (Tom Select)
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*
*/
function plugin () {
var self = this;
self.on('initialize', () => {
var test_input = document.createElement('span');
var control = self.control_input;
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'];
for (const style_name of transfer_styles) {
// @ts-ignore TS7015 https://stackoverflow.com/a/50506154/697576
test_input.style[style_name] = control.style[style_name];
}
/**
* Set the control width
*
*/
var resize = () => {
test_input.textContent = control.value;
control.style.width = test_input.clientWidth + 'px';
};
resize();
self.on('update item_add item_remove', resize);
addEvent(control, 'input', resize);
addEvent(control, 'keyup', resize);
addEvent(control, 'blur', resize);
addEvent(control, 'update', resize);
});
}
export { plugin as default };
//# sourceMappingURL=plugin.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,15 @@
/**
* Plugin: "no_active_items" (Tom Select)
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*
*/
import type TomSelect from '../../tom-select.ts';
export default function (this: TomSelect): void;

View File

@@ -0,0 +1,26 @@
/**
* Tom Select v2.4.3
* Licensed under the Apache License, Version 2.0 (the "License");
*/
/**
* Plugin: "no_active_items" (Tom Select)
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*
*/
function plugin () {
this.hook('instead', 'setActiveItem', () => {});
this.hook('instead', 'selectAll', () => {});
}
export { plugin as default };
//# sourceMappingURL=plugin.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"plugin.js","sources":["../../../../src/plugins/no_active_items/plugin.ts"],"sourcesContent":["/**\n * Plugin: \"no_active_items\" (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 */\n\nimport type TomSelect from '../../tom-select.ts';\n\nexport default function(this:TomSelect) {\n\tthis.hook('instead','setActiveItem',() => {});\n\tthis.hook('instead','selectAll',() => {});\n};\n"],"names":["hook"],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIe,eAAyB,IAAA;EACvC,IAAI,CAACA,IAAI,CAAC,SAAS,EAAC,eAAe,EAAC,MAAM,EAAE,CAAC;EAC7C,IAAI,CAACA,IAAI,CAAC,SAAS,EAAC,WAAW,EAAC,MAAM,EAAE,CAAC;AAC1C;;;;"}

View File

@@ -0,0 +1,15 @@
/**
* Plugin: "input_autogrow" (Tom Select)
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*
*/
import type TomSelect from '../../tom-select.ts';
export default function (this: TomSelect): void;

View File

@@ -0,0 +1,32 @@
/**
* Tom Select v2.4.3
* Licensed under the Apache License, Version 2.0 (the "License");
*/
/**
* Plugin: "input_autogrow" (Tom Select)
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*
*/
function plugin () {
var self = this;
var orig_deleteSelection = self.deleteSelection;
this.hook('instead', 'deleteSelection', evt => {
if (self.activeItems.length) {
return orig_deleteSelection.call(self, evt);
}
return false;
});
}
export { plugin as default };
//# sourceMappingURL=plugin.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"plugin.js","sources":["../../../../src/plugins/no_backspace_delete/plugin.ts"],"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 */\n\nimport type TomSelect from '../../tom-select.ts';\n\nexport default function(this:TomSelect) {\n\tvar self = this;\n\tvar orig_deleteSelection = self.deleteSelection;\n\n\tthis.hook('instead','deleteSelection',(evt:KeyboardEvent) => {\n\n\t\tif( self.activeItems.length ){\n\t\t\treturn orig_deleteSelection.call(self, evt);\n\t\t}\n\n\t\treturn false;\n\t});\n\n};\n"],"names":["self","orig_deleteSelection","deleteSelection","hook","evt","activeItems","length","call"],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIe,eAAyB,IAAA;EACvC,IAAIA,IAAI,GAAG,IAAI;AACf,EAAA,IAAIC,oBAAoB,GAAGD,IAAI,CAACE,eAAe;EAE/C,IAAI,CAACC,IAAI,CAAC,SAAS,EAAC,iBAAiB,EAAEC,GAAiB,IAAK;AAE5D,IAAA,IAAIJ,IAAI,CAACK,WAAW,CAACC,MAAM,EAAE;AAC5B,MAAA,OAAOL,oBAAoB,CAACM,IAAI,CAACP,IAAI,EAAEI,GAAG,CAAC;AAC5C;AAEA,IAAA,OAAO,KAAK;AACb,GAAC,CAAC;AAEH;;;;"}

View File

@@ -0,0 +1,16 @@
/**
* Plugin: "optgroup_columns" (Tom Select.js)
* Copyright (c) contributors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*
*/
import type TomSelect from '../../tom-select.ts';
export default function (this: TomSelect): void;

View File

@@ -0,0 +1,86 @@
/**
* Tom Select v2.4.3
* Licensed under the Apache License, Version 2.0 (the "License");
*/
const KEY_LEFT = 37;
const KEY_RIGHT = 39;
// ctrl key or apple key for ma
/**
* Get the closest node to the evt.target matching the selector
* Stops at wrapper
*
*/
const parentMatch = (target, selector, wrapper) => {
while (target && target.matches) {
if (target.matches(selector)) {
return target;
}
target = target.parentNode;
}
};
/**
* Get the index of an element amongst sibling nodes of the same type
*
*/
const nodeIndex = (el, amongst) => {
if (!el) return -1;
amongst = amongst || el.nodeName;
var i = 0;
while (el = el.previousElementSibling) {
if (el.matches(amongst)) {
i++;
}
}
return i;
};
/**
* Plugin: "optgroup_columns" (Tom Select.js)
* Copyright (c) contributors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*
*/
function plugin () {
var self = this;
var orig_keydown = self.onKeyDown;
self.hook('instead', 'onKeyDown', evt => {
var index, option, options, optgroup;
if (!self.isOpen || !(evt.keyCode === KEY_LEFT || evt.keyCode === KEY_RIGHT)) {
return orig_keydown.call(self, evt);
}
self.ignoreHover = true;
optgroup = parentMatch(self.activeOption, '[data-group]');
index = nodeIndex(self.activeOption, '[data-selectable]');
if (!optgroup) {
return;
}
if (evt.keyCode === KEY_LEFT) {
optgroup = optgroup.previousSibling;
} else {
optgroup = optgroup.nextSibling;
}
if (!optgroup) {
return;
}
options = optgroup.querySelectorAll('[data-selectable]');
option = options[Math.min(options.length - 1, index)];
if (option) {
self.setActiveOption(option);
}
});
}
export { plugin as default };
//# sourceMappingURL=plugin.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,17 @@
/**
* Plugin: "remove_button" (Tom Select)
* Copyright (c) contributors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*
*/
import type TomSelect from '../../tom-select.ts';
import { RBOptions } from './types.ts';
export default function (this: TomSelect, userOptions: RBOptions): void;

View File

@@ -0,0 +1,134 @@
/**
* Tom Select v2.4.3
* Licensed under the Apache License, Version 2.0 (the "License");
*/
/**
* Converts a scalar to its best string representation
* for hash keys and HTML attribute values.
*
* Transformations:
* 'str' -> 'str'
* null -> ''
* undefined -> ''
* true -> '1'
* false -> '0'
* 0 -> '0'
* 1 -> '1'
*
*/
/**
* Escapes a string for use within HTML.
*
*/
const escape_html = str => {
return (str + '').replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
};
/**
* Prevent default
*
*/
const preventDefault = (evt, stop = false) => {
if (evt) {
evt.preventDefault();
if (stop) {
evt.stopPropagation();
}
}
};
/**
* Add event helper
*
*/
const addEvent = (target, type, callback, options) => {
target.addEventListener(type, callback, options);
};
/**
* Return a dom element from either a dom query string, jQuery object, a dom element or html string
* https://stackoverflow.com/questions/494143/creating-a-new-dom-element-from-an-html-string-using-built-in-dom-methods-or-pro/35385518#35385518
*
* param query should be {}
*/
const getDom = query => {
if (query.jquery) {
return query[0];
}
if (query instanceof HTMLElement) {
return query;
}
if (isHtmlString(query)) {
var tpl = document.createElement('template');
tpl.innerHTML = query.trim(); // Never return a text node of whitespace as the result
return tpl.content.firstChild;
}
return document.querySelector(query);
};
const isHtmlString = arg => {
if (typeof arg === 'string' && arg.indexOf('<') > -1) {
return true;
}
return false;
};
/**
* Plugin: "remove_button" (Tom Select)
* Copyright (c) contributors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*
*/
function plugin (userOptions) {
const options = Object.assign({
label: '&times;',
title: 'Remove',
className: 'remove',
append: true
}, userOptions);
//options.className = 'remove-single';
var self = this;
// override the render method to add remove button to each item
if (!options.append) {
return;
}
var html = '<a href="javascript:void(0)" class="' + options.className + '" tabindex="-1" title="' + escape_html(options.title) + '">' + options.label + '</a>';
self.hook('after', 'setupTemplates', () => {
var orig_render_item = self.settings.render.item;
self.settings.render.item = (data, escape) => {
var item = getDom(orig_render_item.call(self, data, escape));
var close_button = getDom(html);
item.appendChild(close_button);
addEvent(close_button, 'mousedown', evt => {
preventDefault(evt, true);
});
addEvent(close_button, 'click', evt => {
if (self.isLocked) return;
// propagating will trigger the dropdown to show for single mode
preventDefault(evt, true);
if (self.isLocked) return;
if (!self.shouldDelete([item], evt)) return;
self.removeItem(item);
self.refreshOptions(false);
self.inputState();
});
return item;
};
});
}
export { plugin as default };
//# sourceMappingURL=plugin.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,6 @@
export type RBOptions = {
label?: string;
title?: string;
className?: string;
append?: boolean;
};

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=types.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/plugins/remove_button/types.ts"],"names":[],"mappings":""}

View File

@@ -0,0 +1,21 @@
/**
* Plugin: "restore_on_backspace" (Tom Select)
* Copyright (c) contributors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*
*/
import type TomSelect from '../../tom-select.ts';
import { TomOption } from '../../types/index.ts';
type TPluginOptions = {
text?: (option: TomOption) => string;
};
export default function (this: TomSelect, userOptions: TPluginOptions): void;
export {};

View File

@@ -0,0 +1,42 @@
/**
* Tom Select v2.4.3
* Licensed under the Apache License, Version 2.0 (the "License");
*/
/**
* Plugin: "restore_on_backspace" (Tom Select)
* Copyright (c) contributors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*
*/
function plugin (userOptions) {
const self = this;
const options = Object.assign({
text: option => {
return option[self.settings.labelField];
}
}, userOptions);
self.on('item_remove', function (value) {
if (!self.isFocused) {
return;
}
if (self.control_input.value.trim() === '') {
var option = self.options[value];
if (option) {
self.setTextboxValue(options.text.call(self, option));
}
}
});
}
export { plugin as default };
//# sourceMappingURL=plugin.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"plugin.js","sources":["../../../../src/plugins/restore_on_backspace/plugin.ts"],"sourcesContent":["/**\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 type TomSelect from '../../tom-select.ts';\nimport { TomOption } from '../../types/index.ts';\n\ntype TPluginOptions = {\n\ttext?:(option:TomOption)=>string,\n};\n\nexport default function(this:TomSelect, userOptions:TPluginOptions) {\n\tconst self = this;\n\n\tconst options = Object.assign({\n\t\ttext: (option:TomOption) => {\n\t\t\treturn option[self.settings.labelField];\n\t\t}\n\t},userOptions);\n\n\tself.on('item_remove',function(value:string){\n\t\tif( !self.isFocused ){\n\t\t\treturn;\n\t\t}\n\n\t\tif( self.control_input.value.trim() === '' ){\n\t\t\tvar option = self.options[value];\n\t\t\tif( option ){\n\t\t\t\tself.setTextboxValue(options.text.call(self, option));\n\t\t\t}\n\t\t}\n\t});\n\n};\n"],"names":["userOptions","self","options","Object","assign","text","option","settings","labelField","on","value","isFocused","control_input","trim","setTextboxValue","call"],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQe,eAAA,EAAyBA,WAA0B,EAAE;EACnE,MAAMC,IAAI,GAAG,IAAI;AAEjB,EAAA,MAAMC,OAAO,GAAGC,MAAM,CAACC,MAAM,CAAC;IAC7BC,IAAI,EAAGC,MAAgB,IAAK;AAC3B,MAAA,OAAOA,MAAM,CAACL,IAAI,CAACM,QAAQ,CAACC,UAAU,CAAC;AACxC;GACA,EAACR,WAAW,CAAC;AAEdC,EAAAA,IAAI,CAACQ,EAAE,CAAC,aAAa,EAAC,UAASC,KAAY,EAAC;AAC3C,IAAA,IAAI,CAACT,IAAI,CAACU,SAAS,EAAE;AACpB,MAAA;AACD;IAEA,IAAIV,IAAI,CAACW,aAAa,CAACF,KAAK,CAACG,IAAI,EAAE,KAAK,EAAE,EAAE;AAC3C,MAAA,IAAIP,MAAM,GAAGL,IAAI,CAACC,OAAO,CAACQ,KAAK,CAAC;AAChC,MAAA,IAAIJ,MAAM,EAAE;AACXL,QAAAA,IAAI,CAACa,eAAe,CAACZ,OAAO,CAACG,IAAI,CAACU,IAAI,CAACd,IAAI,EAAEK,MAAM,CAAC,CAAC;AACtD;AACD;AACD,GAAC,CAAC;AAEH;;;;"}

View File

@@ -0,0 +1,16 @@
/**
* Plugin: "restore_on_backspace" (Tom Select)
* Copyright (c) contributors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*
*/
import type TomSelect from '../../tom-select.ts';
export default function (this: TomSelect): void;

View File

@@ -0,0 +1,272 @@
/**
* Tom Select v2.4.3
* Licensed under the Apache License, Version 2.0 (the "License");
*/
/**
* Converts a scalar to its best string representation
* for hash keys and HTML attribute values.
*
* Transformations:
* 'str' -> 'str'
* null -> ''
* undefined -> ''
* true -> '1'
* false -> '0'
* 0 -> '0'
* 1 -> '1'
*
*/
/**
* Iterates over arrays and hashes.
*
* ```
* iterate(this.items, function(item, id) {
* // invoked for each item
* });
* ```
*
*/
const iterate = (object, callback) => {
if (Array.isArray(object)) {
object.forEach(callback);
} else {
for (var key in object) {
if (object.hasOwnProperty(key)) {
callback(object[key], key);
}
}
}
};
/**
* Add css classes
*
*/
const addClasses = (elmts, ...classes) => {
var norm_classes = classesArray(classes);
elmts = castAsArray(elmts);
elmts.map(el => {
norm_classes.map(cls => {
el.classList.add(cls);
});
});
};
/**
* Return arguments
*
*/
const classesArray = args => {
var classes = [];
iterate(args, _classes => {
if (typeof _classes === 'string') {
_classes = _classes.trim().split(/[\t\n\f\r\s]/);
}
if (Array.isArray(_classes)) {
classes = classes.concat(_classes);
}
});
return classes.filter(Boolean);
};
/**
* Create an array from arg if it's not already an array
*
*/
const castAsArray = arg => {
if (!Array.isArray(arg)) {
arg = [arg];
}
return arg;
};
/**
* Plugin: "restore_on_backspace" (Tom Select)
* Copyright (c) contributors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*
*/
function plugin () {
const self = this;
const orig_canLoad = self.canLoad;
const orig_clearActiveOption = self.clearActiveOption;
const orig_loadCallback = self.loadCallback;
var pagination = {};
var dropdown_content;
var loading_more = false;
var load_more_opt;
var default_values = [];
if (!self.settings.shouldLoadMore) {
// return true if additional results should be loaded
self.settings.shouldLoadMore = () => {
const scroll_percent = dropdown_content.clientHeight / (dropdown_content.scrollHeight - dropdown_content.scrollTop);
if (scroll_percent > 0.9) {
return true;
}
if (self.activeOption) {
var selectable = self.selectable();
var index = Array.from(selectable).indexOf(self.activeOption);
if (index >= selectable.length - 2) {
return true;
}
}
return false;
};
}
if (!self.settings.firstUrl) {
throw 'virtual_scroll plugin requires a firstUrl() method';
}
// in order for virtual scrolling to work,
// options need to be ordered the same way they're returned from the remote data source
self.settings.sortField = [{
field: '$order'
}, {
field: '$score'
}];
// can we load more results for given query?
const canLoadMore = query => {
if (typeof self.settings.maxOptions === 'number' && dropdown_content.children.length >= self.settings.maxOptions) {
return false;
}
if (query in pagination && pagination[query]) {
return true;
}
return false;
};
const clearFilter = (option, value) => {
if (self.items.indexOf(value) >= 0 || default_values.indexOf(value) >= 0) {
return true;
}
return false;
};
// set the next url that will be
self.setNextUrl = (value, next_url) => {
pagination[value] = next_url;
};
// getUrl() to be used in settings.load()
self.getUrl = query => {
if (query in pagination) {
const next_url = pagination[query];
pagination[query] = false;
return next_url;
}
// if the user goes back to a previous query
// we need to load the first page again
self.clearPagination();
return self.settings.firstUrl.call(self, query);
};
// clear pagination
self.clearPagination = () => {
pagination = {};
};
// don't clear the active option (and cause unwanted dropdown scroll)
// while loading more results
self.hook('instead', 'clearActiveOption', () => {
if (loading_more) {
return;
}
return orig_clearActiveOption.call(self);
});
// override the canLoad method
self.hook('instead', 'canLoad', query => {
// first time the query has been seen
if (!(query in pagination)) {
return orig_canLoad.call(self, query);
}
return canLoadMore(query);
});
// wrap the load
self.hook('instead', 'loadCallback', (options, optgroups) => {
if (!loading_more) {
self.clearOptions(clearFilter);
} else if (load_more_opt) {
const first_option = options[0];
if (first_option !== undefined) {
load_more_opt.dataset.value = first_option[self.settings.valueField];
}
}
orig_loadCallback.call(self, options, optgroups);
loading_more = false;
});
// add templates to dropdown
// loading_more if we have another url in the queue
// no_more_results if we don't have another url in the queue
self.hook('after', 'refreshOptions', () => {
const query = self.lastValue;
var option;
if (canLoadMore(query)) {
option = self.render('loading_more', {
query: query
});
if (option) {
option.setAttribute('data-selectable', ''); // so that navigating dropdown with [down] keypresses can navigate to this node
load_more_opt = option;
}
} else if (query in pagination && !dropdown_content.querySelector('.no-results')) {
option = self.render('no_more_results', {
query: query
});
}
if (option) {
addClasses(option, self.settings.optionClass);
dropdown_content.append(option);
}
});
// add scroll listener and default templates
self.on('initialize', () => {
default_values = Object.keys(self.options);
dropdown_content = self.dropdown_content;
// default templates
self.settings.render = Object.assign({}, {
loading_more: () => {
return `<div class="loading-more-results">Loading more results ... </div>`;
},
no_more_results: () => {
return `<div class="no-more-results">No more results</div>`;
}
}, self.settings.render);
// watch dropdown content scroll position
dropdown_content.addEventListener('scroll', () => {
if (!self.settings.shouldLoadMore.call(self)) {
return;
}
// !important: this will get checked again in load() but we still need to check here otherwise loading_more will be set to true
if (!canLoadMore(self.lastValue)) {
return;
}
// don't call load() too much
if (loading_more) return;
loading_more = true;
self.load.call(self, self.lastValue);
});
});
}
export { plugin as default };
//# sourceMappingURL=plugin.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
import TomSelect from './tom-select.ts';
export default TomSelect;

View File

@@ -0,0 +1,31 @@
import TomSelect from "./tom-select.js";
import change_listener from "./plugins/change_listener/plugin.js";
import checkbox_options from "./plugins/checkbox_options/plugin.js";
import clear_button from "./plugins/clear_button/plugin.js";
import drag_drop from "./plugins/drag_drop/plugin.js";
import dropdown_header from "./plugins/dropdown_header/plugin.js";
import caret_position from "./plugins/caret_position/plugin.js";
import dropdown_input from "./plugins/dropdown_input/plugin.js";
import input_autogrow from "./plugins/input_autogrow/plugin.js";
import no_backspace_delete from "./plugins/no_backspace_delete/plugin.js";
import no_active_items from "./plugins/no_active_items/plugin.js";
import optgroup_columns from "./plugins/optgroup_columns/plugin.js";
import remove_button from "./plugins/remove_button/plugin.js";
import restore_on_backspace from "./plugins/restore_on_backspace/plugin.js";
import virtual_scroll from "./plugins/virtual_scroll/plugin.js";
TomSelect.define('change_listener', change_listener);
TomSelect.define('checkbox_options', checkbox_options);
TomSelect.define('clear_button', clear_button);
TomSelect.define('drag_drop', drag_drop);
TomSelect.define('dropdown_header', dropdown_header);
TomSelect.define('caret_position', caret_position);
TomSelect.define('dropdown_input', dropdown_input);
TomSelect.define('input_autogrow', input_autogrow);
TomSelect.define('no_backspace_delete', no_backspace_delete);
TomSelect.define('no_active_items', no_active_items);
TomSelect.define('optgroup_columns', optgroup_columns);
TomSelect.define('remove_button', remove_button);
TomSelect.define('restore_on_backspace', restore_on_backspace);
TomSelect.define('virtual_scroll', virtual_scroll);
export default TomSelect;
//# sourceMappingURL=tom-select.complete.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"tom-select.complete.js","sourceRoot":"","sources":["../../src/tom-select.complete.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,iBAAiB,CAAC;AAExC,OAAO,eAAe,MAAM,qCAAqC,CAAC;AAClE,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,YAAY,MAAM,kCAAkC,CAAC;AAC5D,OAAO,SAAS,MAAM,+BAA+B,CAAC;AACtD,OAAO,eAAe,MAAM,qCAAqC,CAAC;AAClE,OAAO,cAAc,MAAM,oCAAoC,CAAC;AAChE,OAAO,cAAc,MAAM,oCAAoC,CAAC;AAChE,OAAO,cAAc,MAAM,oCAAoC,CAAC;AAChE,OAAO,mBAAmB,MAAM,yCAAyC,CAAC;AAC1E,OAAO,eAAe,MAAM,qCAAqC,CAAC;AAClE,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,aAAa,MAAM,mCAAmC,CAAC;AAC9D,OAAO,oBAAoB,MAAM,0CAA0C,CAAC;AAC5E,OAAO,cAAc,MAAM,oCAAoC,CAAC;AAEhE,SAAS,CAAC,MAAM,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC;AACrD,SAAS,CAAC,MAAM,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAC;AACvD,SAAS,CAAC,MAAM,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;AAC/C,SAAS,CAAC,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;AACzC,SAAS,CAAC,MAAM,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC;AACrD,SAAS,CAAC,MAAM,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAC;AACnD,SAAS,CAAC,MAAM,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAC;AACnD,SAAS,CAAC,MAAM,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAC;AACnD,SAAS,CAAC,MAAM,CAAC,qBAAqB,EAAE,mBAAmB,CAAC,CAAC;AAC7D,SAAS,CAAC,MAAM,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC;AACrD,SAAS,CAAC,MAAM,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAC;AACvD,SAAS,CAAC,MAAM,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;AACjD,SAAS,CAAC,MAAM,CAAC,sBAAsB,EAAE,oBAAoB,CAAC,CAAC;AAC/D,SAAS,CAAC,MAAM,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAC;AAEnD,eAAe,SAAS,CAAC"}

594
node_modules/tom-select/dist/esm/tom-select.d.ts generated vendored Normal file
View File

@@ -0,0 +1,594 @@
import { Sifter } from '@orchidjs/sifter';
import { TomInput, TomArgObject, TomOption, TomOptions, TomCreateCallback, TomItem, TomSettings, TomTemplateNames, TomClearFilter, RecursivePartial } from './types/index.ts';
declare const TomSelect_base: {
new (): {
[x: string]: any;
plugins: {
names: string[];
settings: {
[key: string]: any;
};
requested: {
[key: string]: boolean;
};
loaded: {
[key: string]: any;
};
};
initializePlugins(plugins: string[] | import("./contrib/microplugin.ts").TPluginItem[] | import("./contrib/microplugin.ts").TPluginHash): void;
loadPlugin(name: string): void;
require(name: string): any;
};
[x: string]: any;
define(name: string, fn: (this: any, settings: {
[key: string]: any;
}) => any): void;
};
export default class TomSelect extends TomSelect_base {
control_input: HTMLInputElement;
wrapper: HTMLElement;
dropdown: HTMLElement;
control: HTMLElement;
dropdown_content: HTMLElement;
focus_node: HTMLElement;
order: number;
settings: TomSettings;
input: TomInput;
tabIndex: number;
is_select_tag: boolean;
rtl: boolean;
private inputId;
private _destroy;
sifter: Sifter;
isOpen: boolean;
isDisabled: boolean;
isReadOnly: boolean;
isRequired: boolean;
isInvalid: boolean;
isValid: boolean;
isLocked: boolean;
isFocused: boolean;
isInputHidden: boolean;
isSetup: boolean;
ignoreFocus: boolean;
ignoreHover: boolean;
hasOptions: boolean;
currentResults?: ReturnType<Sifter['search']>;
lastValue: string;
caretPos: number;
loading: number;
loadedSearches: {
[key: string]: boolean;
};
activeOption: null | HTMLElement;
activeItems: TomItem[];
optgroups: TomOptions;
options: TomOptions;
userOptions: {
[key: string]: boolean;
};
items: string[];
private refreshTimeout;
constructor(input_arg: string | TomInput, user_settings: RecursivePartial<TomSettings>);
/**
* set up event bindings.
*
*/
setup(): void;
/**
* Register options and optgroups
*
*/
setupOptions(options?: TomOption[], optgroups?: TomOption[]): void;
/**
* Sets up default rendering functions.
*/
setupTemplates(): void;
/**
* Maps fired events to callbacks provided
* in the settings used when creating the control.
*/
setupCallbacks(): void;
/**
* Sync the Tom Select instance with the original input or select
*
*/
sync(get_settings?: boolean): void;
/**
* Triggered when the main control element
* has a click event.
*
*/
onClick(): void;
/**
* @deprecated v1.7
*
*/
onMouseDown(): void;
/**
* Triggered when the value of the control has been changed.
* This should propagate the event to the original DOM
* input / select element.
*/
onChange(): void;
/**
* Triggered on <input> paste.
*
*/
onPaste(e: MouseEvent | KeyboardEvent): void;
/**
* Triggered on <input> keypress.
*
*/
onKeyPress(e: KeyboardEvent): void;
/**
* Triggered on <input> keydown.
*
*/
onKeyDown(e: KeyboardEvent): void;
/**
* Triggered on <input> keyup.
*
*/
onInput(e: MouseEvent | KeyboardEvent): void;
_onInput(): void;
/**
* Triggered when the user rolls over
* an option in the autocomplete dropdown menu.
*
*/
onOptionHover(evt: MouseEvent | KeyboardEvent, option: HTMLElement): void;
/**
* Triggered on <input> focus.
*
*/
onFocus(e?: MouseEvent | KeyboardEvent): void;
/**
* Triggered on <input> blur.
*
*/
onBlur(e?: FocusEvent): void;
/**
* Triggered when the user clicks on an option
* in the autocomplete dropdown menu.
*
*/
onOptionSelect(evt: MouseEvent | KeyboardEvent, option: HTMLElement): void;
/**
* Return true if the given option can be selected
*
*/
canSelect(option: HTMLElement | null): boolean;
/**
* Triggered when the user clicks on an item
* that has been selected.
*
*/
onItemSelect(evt?: MouseEvent, item?: TomItem): boolean;
/**
* Determines whether or not to invoke
* the user-provided option provider / loader
*
* Note, there is a subtle difference between
* this.canLoad() and this.settings.shouldLoad();
*
* - settings.shouldLoad() is a user-input validator.
* When false is returned, the not_loading template
* will be added to the dropdown
*
* - canLoad() is lower level validator that checks
* the Tom Select instance. There is no inherent user
* feedback when canLoad returns false
*
*/
canLoad(value: string): boolean;
/**
* Invokes the user-provided option provider / loader.
*
*/
load(value: string): void;
/**
* Invoked by the user-provided option provider
*
*/
loadCallback(options: TomOption[], optgroups: TomOption[]): void;
preload(): void;
/**
* Sets the input field of the control to the specified value.
*
*/
setTextboxValue(value?: string): void;
/**
* Returns the value of the control. If multiple items
* can be selected (e.g. <select multiple>), this returns
* an array. If only one item can be selected, this
* returns a string.
*
*/
getValue(): string | string[];
/**
* Resets the selected items to the given value.
*
*/
setValue(value: string | string[], silent?: boolean): void;
/**
* Resets the number of max items to the given value
*
*/
setMaxItems(value: null | number): void;
/**
* Sets the selected item.
*
*/
setActiveItem(item?: TomItem, e?: MouseEvent | KeyboardEvent): void;
/**
* Set the active and last-active classes
*
*/
setActiveItemClass(item: TomItem): void;
/**
* Remove active item
*
*/
removeActiveItem(item: TomItem): void;
/**
* Clears all the active items
*
*/
clearActiveItems(): void;
/**
* Sets the selected item in the dropdown menu
* of available options.
*
*/
setActiveOption(option: null | HTMLElement, scroll?: boolean): void;
/**
* Sets the dropdown_content scrollTop to display the option
*
*/
scrollToOption(option: null | HTMLElement, behavior?: string): void;
/**
* Scroll the dropdown to the given position
*
*/
scroll(scrollTop: number, behavior?: string): void;
/**
* Clears the active option
*
*/
clearActiveOption(): void;
/**
* Selects all items (CTRL + A).
*/
selectAll(): void;
/**
* Determines if the control_input should be in a hidden or visible state
*
*/
inputState(): void;
/**
* Get the input value
*/
inputValue(): string;
/**
* Gives the control focus.
*/
focus(): void;
/**
* Forces the control out of focus.
*
*/
blur(): void;
/**
* Returns a function that scores an object
* to show how good of a match it is to the
* provided query.
*
* @return {function}
*/
getScoreFunction(query: string): (data: {}) => number;
/**
* Returns search options for sifter (the system
* for scoring and sorting results).
*
* @see https://github.com/orchidjs/sifter.js
* @return {object}
*/
getSearchOptions(): {
fields: string[];
conjunction: string;
sort: string | import("@orchidjs/sifter").SortFn | import("@orchidjs/sifter").Sort[];
nesting: boolean;
};
/**
* Searches through available options and returns
* a sorted array of matches.
*
*/
search(query: string): ReturnType<Sifter['search']>;
/**
* Refreshes the list of available options shown
* in the autocomplete dropdown menu.
*
*/
refreshOptions(triggerDropdown?: boolean): void;
/**
* Return list of selectable options
*
*/
selectable(): NodeList;
/**
* Adds an available option. If it already exists,
* nothing will happen. Note: this does not refresh
* the options list dropdown (use `refreshOptions`
* for that).
*
* Usage:
*
* this.addOption(data)
*
*/
addOption(data: TomOption, user_created?: boolean): false | string;
/**
* Add multiple options
*
*/
addOptions(data: TomOption[], user_created?: boolean): void;
/**
* @deprecated 1.7.7
*/
registerOption(data: TomOption): false | string;
/**
* Registers an option group to the pool of option groups.
*
* @return {boolean|string}
*/
registerOptionGroup(data: TomOption): string | false;
/**
* Registers a new optgroup for options
* to be bucketed into.
*
*/
addOptionGroup(id: string, data: TomOption): void;
/**
* Removes an existing option group.
*
*/
removeOptionGroup(id: string): void;
/**
* Clears all existing option groups.
*/
clearOptionGroups(): void;
/**
* Updates an option available for selection. If
* it is visible in the selected items or options
* dropdown, it will be re-rendered automatically.
*
*/
updateOption(value: string, data: TomOption): void;
/**
* Removes a single option.
*
*/
removeOption(value: string, silent?: boolean): void;
/**
* Clears all options.
*/
clearOptions(filter?: TomClearFilter): void;
/**
* Used by clearOptions() to decide whether or not an option should be removed
* Return true to keep an option, false to remove
*
*/
clearFilter(option: TomOption, value: string): boolean;
/**
* Returns the dom element of the option
* matching the given value.
*
*/
getOption(value: undefined | null | boolean | string | number, create?: boolean): null | HTMLElement;
/**
* Returns the dom element of the next or previous dom element of the same type
* Note: adjacent options may not be adjacent DOM elements (optgroups)
*
*/
getAdjacent(option: null | HTMLElement, direction: number, type?: string): HTMLElement | null;
/**
* Returns the dom element of the item
* matching the given value.
*
*/
getItem(item: string | TomItem | null): null | TomItem;
/**
* "Selects" multiple items at once. Adds them to the list
* at the current caret position.
*
*/
addItems(values: string | string[], silent?: boolean): void;
/**
* "Selects" an item. Adds it to the list
* at the current caret position.
*
*/
addItem(value: string, silent?: boolean): void;
/**
* Removes the selected item matching
* the provided value.
*
*/
removeItem(item?: string | TomItem | null, silent?: boolean): void;
/**
* Invokes the `create` method provided in the
* TomSelect options that should provide the data
* for the new item, given the user input.
*
* Once this completes, it will be added
* to the item list.
*
*/
createItem(input?: null | string, callback?: TomCreateCallback): boolean;
/**
* Re-renders the selected item lists.
*/
refreshItems(): void;
/**
* Updates all state-dependent attributes
* and CSS classes.
*/
refreshState(): void;
/**
* Update the `required` attribute of both input and control input.
*
* The `required` property needs to be activated on the control input
* for the error to be displayed at the right place. `required` also
* needs to be temporarily deactivated on the input since the input is
* hidden and can't show errors.
*/
refreshValidityState(): void;
/**
* Determines whether or not more items can be added
* to the control without exceeding the user-defined maximum.
*
* @returns {boolean}
*/
isFull(): boolean;
/**
* Refreshes the original <select> or <input>
* element to reflect the current state.
*
*/
updateOriginalInput(opts?: TomArgObject): void;
/**
* Shows the autocomplete dropdown containing
* the available options.
*/
open(): void;
/**
* Closes the autocomplete dropdown menu.
*/
close(setTextboxValue?: boolean): void;
/**
* Calculates and applies the appropriate
* position of the dropdown if dropdownParent = 'body'.
* Otherwise, position is determined by css
*/
positionDropdown(): void;
/**
* Resets / clears all selected items
* from the control.
*
*/
clear(silent?: boolean): void;
/**
* A helper method for inserting an element
* at the current caret position.
*
*/
insertAtCaret(el: HTMLElement): void;
/**
* Removes the current selected item(s).
*
*/
deleteSelection(e: KeyboardEvent): boolean;
/**
* Return true if the items should be deleted
*/
shouldDelete(items: TomItem[], evt: MouseEvent | KeyboardEvent): boolean;
/**
* Selects the previous / next item (depending on the `direction` argument).
*
* > 0 - right
* < 0 - left
*
*/
advanceSelection(direction: number, e?: MouseEvent | KeyboardEvent): void;
moveCaret(direction: number): void;
/**
* Get the last active item
*
*/
getLastActive(direction?: number): any;
/**
* Moves the caret to the specified index.
*
* The input must be moved by leaving it in place and moving the
* siblings, due to the fact that focus cannot be restored once lost
* on mobile webkit devices
*
*/
setCaret(new_pos: number): void;
/**
* Return list of item dom elements
*
*/
controlChildren(): TomItem[];
/**
* Disables user input on the control. Used while
* items are being asynchronously created.
*/
lock(): void;
/**
* Re-enables user input on the control.
*/
unlock(): void;
/**
* Disable or enable user input on the control
*/
setLocked(lock?: boolean): void;
/**
* Disables user input on the control completely.
* While disabled, it cannot receive focus.
*/
disable(): void;
/**
* Enables the control so that it can respond
* to focus and user input.
*/
enable(): void;
setDisabled(disabled: boolean): void;
setReadOnly(isReadOnly: boolean): void;
/**
* Completely destroys the control and
* unbinds all event listeners so that it can
* be garbage collected.
*/
destroy(): void;
/**
* A helper method for rendering "item" and
* "option" templates, given the data.
*
*/
render(templateName: TomTemplateNames, data?: any): null | HTMLElement;
/**
* Type guarded rendering
*
*/
_render(templateName: TomTemplateNames, data?: any): HTMLElement;
/**
* Clears the render cache for a template. If
* no template is given, clears all render
* caches.
*
*/
clearCache(): void;
/**
* Removes a value from item and option caches
*
*/
uncacheValue(value: string): void;
/**
* Determines whether or not to display the
* create item prompt, given a user input.
*
*/
canCreate(input: string): boolean;
/**
* Wraps this.`method` so that `new_fn` can be invoked 'before', 'after', or 'instead' of the original method
*
* this.hook('instead','onKeyDown',function( arg1, arg2 ...){
*
* });
*/
hook(when: string, method: string, new_fn: any): void;
}
export {};

2269
node_modules/tom-select/dist/esm/tom-select.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

1
node_modules/tom-select/dist/esm/tom-select.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
import TomSelect from './tom-select.ts';
export default TomSelect;

13
node_modules/tom-select/dist/esm/tom-select.popular.js generated vendored Normal file
View File

@@ -0,0 +1,13 @@
import TomSelect from "./tom-select.js";
import caret_position from "./plugins/caret_position/plugin.js";
import dropdown_input from "./plugins/dropdown_input/plugin.js";
import no_backspace_delete from "./plugins/no_backspace_delete/plugin.js";
import remove_button from "./plugins/remove_button/plugin.js";
import restore_on_backspace from "./plugins/restore_on_backspace/plugin.js";
TomSelect.define('caret_position', caret_position);
TomSelect.define('dropdown_input', dropdown_input);
TomSelect.define('no_backspace_delete', no_backspace_delete);
TomSelect.define('remove_button', remove_button);
TomSelect.define('restore_on_backspace', restore_on_backspace);
export default TomSelect;
//# sourceMappingURL=tom-select.popular.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"tom-select.popular.js","sourceRoot":"","sources":["../../src/tom-select.popular.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,iBAAiB,CAAC;AAExC,OAAO,cAAc,MAAM,oCAAoC,CAAC;AAChE,OAAO,cAAc,MAAM,oCAAoC,CAAC;AAChE,OAAO,mBAAmB,MAAM,yCAAyC,CAAC;AAC1E,OAAO,aAAa,MAAM,mCAAmC,CAAC;AAC9D,OAAO,oBAAoB,MAAM,0CAA0C,CAAC;AAE5E,SAAS,CAAC,MAAM,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAC;AACnD,SAAS,CAAC,MAAM,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAC;AACnD,SAAS,CAAC,MAAM,CAAC,qBAAqB,EAAE,mBAAmB,CAAC,CAAC;AAC7D,SAAS,CAAC,MAAM,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;AACjD,SAAS,CAAC,MAAM,CAAC,sBAAsB,EAAE,oBAAoB,CAAC,CAAC;AAE/D,eAAe,SAAS,CAAC"}

49
node_modules/tom-select/dist/esm/types/core.d.ts generated vendored Normal file
View File

@@ -0,0 +1,49 @@
import type TomSelect from '../tom-select.ts';
import { escape_html } from '../utils.ts';
export interface TomInput extends HTMLElement {
tomselect?: TomSelect;
disabled: boolean;
readOnly?: boolean;
required: boolean;
value: string;
type: string;
validity: ValidityState;
}
export type TomArgObject = {
silent?: boolean;
};
export type TomOption = {
[key: string]: any;
};
export type TomOptions = {
[key: string]: TomOption;
};
export type TomCreateFilter = (input: string) => boolean;
export type TomCreateCallback = (data?: TomOption) => void;
export type TomCreate = (input: string, create: TomCreateCallback) => boolean;
export interface TomItem extends HTMLElement {
dataset: {
value: string;
};
}
export type TomLoadCallback = TomSelect['loadCallback'];
export type TomTemplate = (data: TomOption, escape: typeof escape_html) => string | HTMLElement;
export type TomTemplateNull = (data: TomOption, escape: typeof escape_html) => null | string | HTMLElement;
export type TomTemplates = {
'dropdown': TomTemplate;
'optgroup': TomTemplate;
'optgroup_header': TomTemplate;
'option': TomTemplate;
'item': TomTemplate;
'option_create': TomTemplate;
'no_results': TomTemplate;
'loading': TomTemplate;
'not_loading': TomTemplateNull;
'loading_more': TomTemplateNull;
'no_more_results': TomTemplateNull;
};
export type TomTemplateNames = keyof TomTemplates;
export type TomClearFilter = (option: TomOption, value: string) => boolean;
export type RecursivePartial<T> = {
[P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends object | undefined ? RecursivePartial<T[P]> : T[P];
};

2
node_modules/tom-select/dist/esm/types/core.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=core.js.map

1
node_modules/tom-select/dist/esm/types/core.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../src/types/core.ts"],"names":[],"mappings":""}

2
node_modules/tom-select/dist/esm/types/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
export * from './core.ts';
export * from './settings.ts';

3
node_modules/tom-select/dist/esm/types/index.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
export * from "./core.js";
export * from "./settings.js";
//# sourceMappingURL=index.js.map

1
node_modules/tom-select/dist/esm/types/index.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AACA,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC"}

79
node_modules/tom-select/dist/esm/types/settings.d.ts generated vendored Normal file
View File

@@ -0,0 +1,79 @@
import { TomCreateFilter, TomCreate, TomLoadCallback, TomTemplates, TomOption } from './index.ts';
import { TPluginItem, TPluginHash } from '../contrib/microplugin.ts';
import { type Sort as SifterSort, type SortFn as SifterSortFn } from '@orchidjs/sifter';
export type TomSettings = {
options?: any[];
optgroups?: any[];
items?: string[];
plugins: string[] | TPluginItem[] | TPluginHash;
delimiter: string;
splitOn: RegExp | string;
persist: boolean;
diacritics: boolean;
create: boolean | TomCreate;
createOnBlur: boolean;
createFilter: RegExp | string | TomCreateFilter;
highlight: boolean;
openOnFocus: boolean;
shouldOpen: boolean;
maxOptions: number;
maxItems: null | number;
hideSelected: boolean;
duplicates: boolean;
addPrecedence: boolean;
selectOnTab: boolean;
preload: boolean | string;
allowEmptyOption: boolean;
closeAfterSelect: boolean;
refreshThrottle: number;
loadThrottle: number;
loadingClass: string;
dataAttr: string;
optgroupField: string;
valueField: string;
labelField: string;
disabledField: string;
optgroupLabelField: string;
optgroupValueField: string;
lockOptgroupOrder: boolean;
sortField: string | SifterSort[] | SifterSortFn;
searchField: string[];
searchConjunction: string;
nesting: boolean;
mode: string;
wrapperClass: string;
controlClass: string;
dropdownClass: string;
dropdownContentClass: string;
itemClass: string;
optionClass: string;
dropdownParent: string;
controlInput: string | HTMLInputElement;
copyClassesToDropdown: boolean;
placeholder: string;
hidePlaceholder: boolean;
load: (value: string, callback: TomLoadCallback) => void;
score?: (query: string) => () => any;
shouldLoad: (query: string) => boolean;
onInitialize: () => void;
onChange: (value: string | number) => void;
onItemAdd: (value: string | number, item: HTMLDivElement) => void;
onItemRemove: (value: string | number, item: HTMLDivElement) => void;
onClear: () => void;
onOptionAdd: (value: string | number, data: TomOption) => void;
onOptionRemove: (value: string | number) => void;
onOptionClear: () => void;
onOptionGroupAdd: (value: string | number, data: TomOption) => void;
onOptionGroupRemove: (value: string | number) => void;
onOptionGroupClear: () => void;
onDropdownOpen: (dropdown: HTMLDivElement) => void;
onDropdownClose: (dropdown: HTMLDivElement) => void;
onType: (str: string) => void;
onLoad: (options: TomOption[], optgroups: TomOption[]) => void;
onFocus: () => void;
onBlur: () => void;
onDelete: (values: string[], evt: KeyboardEvent | MouseEvent) => boolean;
render: TomTemplates;
firstUrl: (query: string) => any;
shouldLoadMore: () => boolean;
};

2
node_modules/tom-select/dist/esm/types/settings.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=settings.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../../../src/types/settings.ts"],"names":[],"mappings":""}

95
node_modules/tom-select/dist/esm/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,95 @@
import type TomSelect from './tom-select.ts';
import { TomLoadCallback } from './types/index.ts';
/**
* Converts a scalar to its best string representation
* for hash keys and HTML attribute values.
*
* Transformations:
* 'str' -> 'str'
* null -> ''
* undefined -> ''
* true -> '1'
* false -> '0'
* 0 -> '0'
* 1 -> '1'
*
*/
export declare const hash_key: (value: undefined | null | boolean | string | number) => string | null;
export declare const get_hash: (value: boolean | string | number) => string;
/**
* Escapes a string for use within HTML.
*
*/
export declare const escape_html: (str: string) => string;
/**
* use setTimeout if timeout > 0
*/
export declare const timeout: (fn: () => void, timeout: number) => number | null;
/**
* Debounce the user provided load function
*
*/
export declare const loadDebounce: (fn: (value: string, callback: TomLoadCallback) => void, delay: number) => (this: TomSelect, value: string, callback: TomLoadCallback) => void;
/**
* Debounce all fired events types listed in `types`
* while executing the provided `fn`.
*
*/
export declare const debounce_events: (self: TomSelect, types: string[], fn: () => void) => void;
/**
* Determines the current selection within a text input control.
* Returns an object containing:
* - start
* - length
*
* Note: "selectionStart, selectionEnd ... apply only to inputs of types text, search, URL, tel and password"
* - https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setSelectionRange
*/
export declare const getSelection: (input: HTMLInputElement) => {
start: number;
length: number;
};
/**
* Prevent default
*
*/
export declare const preventDefault: (evt?: Event, stop?: boolean) => void;
/**
* Add event helper
*
*/
export declare const addEvent: (target: EventTarget, type: string, callback: EventListenerOrEventListenerObject, options?: object) => void;
/**
* Return true if the requested key is down
* 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() )
*
*/
export declare const isKeyDown: (key_name: keyof (KeyboardEvent | MouseEvent), evt?: KeyboardEvent | MouseEvent) => boolean;
/**
* Get the id of an element
* If the id attribute is not set, set the attribute with the given id
*
*/
export declare const getId: (el: Element, id: string) => string;
/**
* Returns a string with backslashes added before characters that need to be escaped.
*/
export declare const addSlashes: (str: string) => string;
/**
*
*/
export declare const append: (parent: Element | DocumentFragment, node: string | Node | null | undefined) => void;
/**
* Iterates over arrays and hashes.
*
* ```
* iterate(this.items, function(item, id) {
* // invoked for each item
* });
* ```
*
*/
export declare const iterate: (object: [] | {
[key: string]: any;
}, callback: (value: any, key: any) => any) => void;

195
node_modules/tom-select/dist/esm/utils.js generated vendored Normal file
View File

@@ -0,0 +1,195 @@
/**
* Converts a scalar to its best string representation
* for hash keys and HTML attribute values.
*
* Transformations:
* 'str' -> 'str'
* null -> ''
* undefined -> ''
* true -> '1'
* false -> '0'
* 0 -> '0'
* 1 -> '1'
*
*/
export const hash_key = (value) => {
if (typeof value === 'undefined' || value === null)
return null;
return get_hash(value);
};
export const get_hash = (value) => {
if (typeof value === 'boolean')
return value ? '1' : '0';
return value + '';
};
/**
* Escapes a string for use within HTML.
*
*/
export const escape_html = (str) => {
return (str + '')
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;');
};
/**
* use setTimeout if timeout > 0
*/
export const timeout = (fn, timeout) => {
if (timeout > 0) {
return window.setTimeout(fn, timeout);
}
fn.call(null);
return null;
};
/**
* Debounce the user provided load function
*
*/
export const loadDebounce = (fn, delay) => {
var timeout;
return function (value, callback) {
var self = this;
if (timeout) {
self.loading = Math.max(self.loading - 1, 0);
clearTimeout(timeout);
}
timeout = setTimeout(function () {
timeout = null;
self.loadedSearches[value] = true;
fn.call(self, value, callback);
}, delay);
};
};
/**
* Debounce all fired events types listed in `types`
* while executing the provided `fn`.
*
*/
export const debounce_events = (self, types, fn) => {
var type;
var trigger = self.trigger;
var event_args = {};
// override trigger method
self.trigger = function () {
var type = arguments[0];
if (types.indexOf(type) !== -1) {
event_args[type] = arguments;
}
else {
return trigger.apply(self, arguments);
}
};
// invoke provided function
fn.apply(self, []);
self.trigger = trigger;
// trigger queued events
for (type of types) {
if (type in event_args) {
trigger.apply(self, event_args[type]);
}
}
};
/**
* Determines the current selection within a text input control.
* Returns an object containing:
* - start
* - length
*
* Note: "selectionStart, selectionEnd ... apply only to inputs of types text, search, URL, tel and password"
* - https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setSelectionRange
*/
export const getSelection = (input) => {
return {
start: input.selectionStart || 0,
length: (input.selectionEnd || 0) - (input.selectionStart || 0),
};
};
/**
* Prevent default
*
*/
export const preventDefault = (evt, stop = false) => {
if (evt) {
evt.preventDefault();
if (stop) {
evt.stopPropagation();
}
}
};
/**
* Add event helper
*
*/
export const addEvent = (target, type, callback, options) => {
target.addEventListener(type, callback, options);
};
/**
* Return true if the requested key is down
* 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() )
*
*/
export const isKeyDown = (key_name, evt) => {
if (!evt) {
return false;
}
if (!evt[key_name]) {
return false;
}
var count = (evt.altKey ? 1 : 0) + (evt.ctrlKey ? 1 : 0) + (evt.shiftKey ? 1 : 0) + (evt.metaKey ? 1 : 0);
if (count === 1) {
return true;
}
return false;
};
/**
* Get the id of an element
* If the id attribute is not set, set the attribute with the given id
*
*/
export const getId = (el, id) => {
const existing_id = el.getAttribute('id');
if (existing_id) {
return existing_id;
}
el.setAttribute('id', id);
return id;
};
/**
* Returns a string with backslashes added before characters that need to be escaped.
*/
export const addSlashes = (str) => {
return str.replace(/[\\"']/g, '\\$&');
};
/**
*
*/
export const append = (parent, node) => {
if (node)
parent.append(node);
};
/**
* Iterates over arrays and hashes.
*
* ```
* iterate(this.items, function(item, id) {
* // invoked for each item
* });
* ```
*
*/
export const iterate = (object, callback) => {
if (Array.isArray(object)) {
object.forEach(callback);
}
else {
for (var key in object) {
if (object.hasOwnProperty(key)) {
callback(object[key], key);
}
}
}
};
//# sourceMappingURL=utils.js.map

1
node_modules/tom-select/dist/esm/utils.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAA0C,EAAc,EAAE;IAClF,IAAI,OAAO,KAAK,KAAK,WAAW,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAChE,OAAO,QAAQ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,CAAC;YAC5B,CAAC;QACF,CAAC;IACF,CAAC;AACF,CAAC,CAAC"}

76
node_modules/tom-select/dist/esm/vanilla.d.ts generated vendored Normal file
View File

@@ -0,0 +1,76 @@
/**
* Return a dom element from either a dom query string, jQuery object, a dom element or html string
* https://stackoverflow.com/questions/494143/creating-a-new-dom-element-from-an-html-string-using-built-in-dom-methods-or-pro/35385518#35385518
*
* param query should be {}
*/
export declare const getDom: (query: any) => HTMLElement;
export declare const isHtmlString: (arg: any) => boolean;
export declare const escapeQuery: (query: string) => string;
/**
* Dispatch an event
*
*/
export declare const triggerEvent: (dom_el: HTMLElement, event_name: string) => void;
/**
* Apply CSS rules to a dom element
*
*/
export declare const applyCSS: (dom_el: HTMLElement, css: {
[key: string]: string | number;
}) => void;
/**
* Add css classes
*
*/
export declare const addClasses: (elmts: HTMLElement | HTMLElement[], ...classes: string[] | string[][]) => void;
/**
* Remove css classes
*
*/
export declare const removeClasses: (elmts: HTMLElement | HTMLElement[], ...classes: string[] | string[][]) => void;
/**
* Return arguments
*
*/
export declare const classesArray: (args: string[] | string[][]) => string[];
/**
* Create an array from arg if it's not already an array
*
*/
export declare const castAsArray: (arg: any) => Array<any>;
/**
* Get the closest node to the evt.target matching the selector
* Stops at wrapper
*
*/
export declare const parentMatch: (target: null | HTMLElement, selector: string, wrapper?: HTMLElement) => HTMLElement | void;
/**
* Get the first or last item from an array
*
* > 0 - right (last)
* <= 0 - left (first)
*
*/
export declare const getTail: (list: Array<any> | NodeList, direction?: number) => any;
/**
* Return true if an object is empty
*
*/
export declare const isEmptyObject: (obj: object) => boolean;
/**
* Get the index of an element amongst sibling nodes of the same type
*
*/
export declare const nodeIndex: (el: null | Element, amongst?: string) => number;
/**
* Set attributes of an element
*
*/
export declare const setAttr: (el: Element, attrs: {
[key: string]: null | string | number;
}) => void;
/**
* Replace a node
*/
export declare const replaceNode: (existing: Node, replacement: Node) => void;

172
node_modules/tom-select/dist/esm/vanilla.js generated vendored Normal file
View File

@@ -0,0 +1,172 @@
import { iterate } from "./utils.js";
/**
* Return a dom element from either a dom query string, jQuery object, a dom element or html string
* https://stackoverflow.com/questions/494143/creating-a-new-dom-element-from-an-html-string-using-built-in-dom-methods-or-pro/35385518#35385518
*
* param query should be {}
*/
export const getDom = (query) => {
if (query.jquery) {
return query[0];
}
if (query instanceof HTMLElement) {
return query;
}
if (isHtmlString(query)) {
var tpl = document.createElement('template');
tpl.innerHTML = query.trim(); // Never return a text node of whitespace as the result
return tpl.content.firstChild;
}
return document.querySelector(query);
};
export const isHtmlString = (arg) => {
if (typeof arg === 'string' && arg.indexOf('<') > -1) {
return true;
}
return false;
};
export const escapeQuery = (query) => {
return query.replace(/['"\\]/g, '\\$&');
};
/**
* Dispatch an event
*
*/
export const triggerEvent = (dom_el, event_name) => {
var event = document.createEvent('HTMLEvents');
event.initEvent(event_name, true, false);
dom_el.dispatchEvent(event);
};
/**
* Apply CSS rules to a dom element
*
*/
export const applyCSS = (dom_el, css) => {
Object.assign(dom_el.style, css);
};
/**
* Add css classes
*
*/
export const addClasses = (elmts, ...classes) => {
var norm_classes = classesArray(classes);
elmts = castAsArray(elmts);
elmts.map(el => {
norm_classes.map(cls => {
el.classList.add(cls);
});
});
};
/**
* Remove css classes
*
*/
export const removeClasses = (elmts, ...classes) => {
var norm_classes = classesArray(classes);
elmts = castAsArray(elmts);
elmts.map(el => {
norm_classes.map(cls => {
el.classList.remove(cls);
});
});
};
/**
* Return arguments
*
*/
export const classesArray = (args) => {
var classes = [];
iterate(args, (_classes) => {
if (typeof _classes === 'string') {
_classes = _classes.trim().split(/[\t\n\f\r\s]/);
}
if (Array.isArray(_classes)) {
classes = classes.concat(_classes);
}
});
return classes.filter(Boolean);
};
/**
* Create an array from arg if it's not already an array
*
*/
export const castAsArray = (arg) => {
if (!Array.isArray(arg)) {
arg = [arg];
}
return arg;
};
/**
* Get the closest node to the evt.target matching the selector
* Stops at wrapper
*
*/
export const parentMatch = (target, selector, wrapper) => {
if (wrapper && !wrapper.contains(target)) {
return;
}
while (target && target.matches) {
if (target.matches(selector)) {
return target;
}
target = target.parentNode;
}
};
/**
* Get the first or last item from an array
*
* > 0 - right (last)
* <= 0 - left (first)
*
*/
export const getTail = (list, direction = 0) => {
if (direction > 0) {
return list[list.length - 1];
}
return list[0];
};
/**
* Return true if an object is empty
*
*/
export const isEmptyObject = (obj) => {
return (Object.keys(obj).length === 0);
};
/**
* Get the index of an element amongst sibling nodes of the same type
*
*/
export const nodeIndex = (el, amongst) => {
if (!el)
return -1;
amongst = amongst || el.nodeName;
var i = 0;
while (el = el.previousElementSibling) {
if (el.matches(amongst)) {
i++;
}
}
return i;
};
/**
* Set attributes of an element
*
*/
export const setAttr = (el, attrs) => {
iterate(attrs, (val, attr) => {
if (val == null) {
el.removeAttribute(attr);
}
else {
el.setAttribute(attr, '' + val);
}
});
};
/**
* Replace a node
*/
export const replaceNode = (existing, replacement) => {
if (existing.parentNode)
existing.parentNode.replaceChild(replacement, existing);
};
//# sourceMappingURL=vanilla.js.map

1
node_modules/tom-select/dist/esm/vanilla.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"vanilla.js","sourceRoot":"","sources":["../../src/vanilla.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAE,KAAS,EAAe,EAAE;IAEjD,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;QAClB,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC;IAED,IAAI,KAAK,YAAY,WAAW,EAAE,CAAC;QAClC,OAAO,KAAK,CAAC;IACd,CAAC;IAED,IAAI,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,IAAI,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QAC7C,GAAG,CAAC,SAAS,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,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