@drecchia/tom-select 2.5.2-virtual-scroll.0 → 2.5.2-virtual-scroll.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/constants.js +16 -0
- package/dist/cjs/constants.js.map +1 -0
- package/dist/cjs/contrib/highlight.js +69 -0
- package/dist/cjs/contrib/highlight.js.map +1 -0
- package/dist/cjs/contrib/microevent.js +64 -0
- package/dist/cjs/contrib/microevent.js.map +1 -0
- package/dist/cjs/contrib/microplugin.js +112 -0
- package/dist/cjs/contrib/microplugin.js.map +1 -0
- package/dist/cjs/defaults.js +85 -0
- package/dist/cjs/defaults.js.map +1 -0
- package/dist/cjs/getSettings.js +146 -0
- package/dist/cjs/getSettings.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/plugins/caret_position/plugin.js +66 -0
- package/dist/cjs/plugins/caret_position/plugin.js.map +1 -0
- package/dist/cjs/plugins/change_listener/plugin.js +25 -0
- package/dist/cjs/plugins/change_listener/plugin.js.map +1 -0
- package/dist/cjs/plugins/checkbox_options/plugin.js +108 -0
- package/dist/cjs/plugins/checkbox_options/plugin.js.map +1 -0
- package/dist/cjs/plugins/checkbox_options/types.js +3 -0
- package/dist/cjs/plugins/checkbox_options/types.js.map +1 -0
- package/dist/cjs/plugins/clear_button/plugin.js +47 -0
- package/dist/cjs/plugins/clear_button/plugin.js.map +1 -0
- package/dist/cjs/plugins/clear_button/types.js +3 -0
- package/dist/cjs/plugins/clear_button/types.js.map +1 -0
- package/dist/cjs/plugins/drag_drop/plugin.js +117 -0
- package/dist/cjs/plugins/drag_drop/plugin.js.map +1 -0
- package/dist/cjs/plugins/dropdown_header/plugin.js +50 -0
- package/dist/cjs/plugins/dropdown_header/plugin.js.map +1 -0
- package/dist/cjs/plugins/dropdown_header/types.js +3 -0
- package/dist/cjs/plugins/dropdown_header/types.js.map +1 -0
- package/dist/cjs/plugins/dropdown_input/plugin.js +88 -0
- package/dist/cjs/plugins/dropdown_input/plugin.js.map +1 -0
- package/dist/cjs/plugins/input_autogrow/plugin.js +47 -0
- package/dist/cjs/plugins/input_autogrow/plugin.js.map +1 -0
- package/dist/cjs/plugins/local_virtual_scroll/plugin.js +293 -0
- package/dist/cjs/plugins/local_virtual_scroll/plugin.js.map +1 -0
- package/dist/cjs/plugins/local_virtual_scroll/types.js +3 -0
- package/dist/cjs/plugins/local_virtual_scroll/types.js.map +1 -0
- package/dist/cjs/plugins/no_active_items/plugin.js +22 -0
- package/dist/cjs/plugins/no_active_items/plugin.js.map +1 -0
- package/dist/cjs/plugins/no_backspace_delete/plugin.js +28 -0
- package/dist/cjs/plugins/no_backspace_delete/plugin.js.map +1 -0
- package/dist/cjs/plugins/optgroup_columns/plugin.js +51 -0
- package/dist/cjs/plugins/optgroup_columns/plugin.js.map +1 -0
- package/dist/cjs/plugins/remove_button/plugin.js +61 -0
- package/dist/cjs/plugins/remove_button/plugin.js.map +1 -0
- package/dist/cjs/plugins/remove_button/types.js +3 -0
- package/dist/cjs/plugins/remove_button/types.js.map +1 -0
- package/dist/cjs/plugins/restore_on_backspace/plugin.js +24 -0
- package/dist/cjs/plugins/restore_on_backspace/plugin.js.map +1 -0
- package/dist/cjs/plugins/virtual_scroll/plugin.js +170 -0
- package/dist/cjs/plugins/virtual_scroll/plugin.js.map +1 -0
- package/dist/cjs/tom-select.complete.js +35 -0
- package/dist/cjs/tom-select.complete.js.map +1 -0
- package/dist/cjs/tom-select.js +2303 -0
- package/dist/cjs/tom-select.js.map +1 -0
- package/dist/cjs/tom-select.popular.js +15 -0
- package/dist/cjs/tom-select.popular.js.map +1 -0
- package/dist/cjs/types/core.js +3 -0
- package/dist/cjs/types/core.js.map +1 -0
- package/dist/cjs/types/index.js +19 -0
- package/dist/cjs/types/index.js.map +1 -0
- package/dist/cjs/types/settings.js +3 -0
- package/dist/cjs/types/settings.js.map +1 -0
- package/dist/cjs/utils.js +212 -0
- package/dist/cjs/utils.js.map +1 -0
- package/dist/cjs/vanilla.js +190 -0
- package/dist/cjs/vanilla.js.map +1 -0
- package/dist/css/tom-select.bootstrap4.css +16 -4
- package/dist/css/tom-select.bootstrap4.css.map +1 -0
- package/dist/css/tom-select.bootstrap4.min.css +2 -0
- package/dist/css/tom-select.bootstrap4.min.css.map +1 -0
- package/dist/css/tom-select.bootstrap5.css +16 -4
- package/dist/css/tom-select.bootstrap5.css.map +1 -0
- package/dist/css/tom-select.bootstrap5.min.css +2 -0
- package/dist/css/tom-select.bootstrap5.min.css.map +1 -0
- package/dist/css/tom-select.css +12 -4
- package/dist/css/tom-select.css.map +1 -0
- package/dist/css/tom-select.default.css +11 -5
- package/dist/css/tom-select.default.css.map +1 -1
- package/dist/css/tom-select.default.min.css +2 -0
- package/dist/css/tom-select.default.min.css.map +1 -0
- package/dist/css/tom-select.min.css +2 -0
- package/dist/css/tom-select.min.css.map +1 -0
- package/dist/esm/constants.d.ts +12 -0
- package/dist/esm/constants.js +13 -0
- package/dist/esm/constants.js.map +1 -0
- package/dist/esm/contrib/highlight.d.ts +13 -0
- package/dist/esm/contrib/highlight.js +64 -0
- package/dist/esm/contrib/highlight.js.map +1 -0
- package/dist/esm/contrib/microevent.d.ts +20 -0
- package/dist/esm/contrib/microevent.js +61 -0
- package/dist/esm/contrib/microevent.js.map +1 -0
- package/dist/esm/contrib/microplugin.d.ts +71 -0
- package/dist/esm/contrib/microplugin.js +109 -0
- package/dist/esm/contrib/microplugin.js.map +1 -0
- package/dist/esm/defaults.d.ts +53 -0
- package/dist/esm/defaults.js +83 -0
- package/dist/esm/defaults.js.map +1 -0
- package/dist/esm/getSettings.d.ts +3 -0
- package/dist/esm/getSettings.js +143 -0
- package/dist/esm/getSettings.js.map +1 -0
- package/dist/esm/plugins/caret_position/plugin.d.ts +16 -0
- package/dist/esm/plugins/caret_position/plugin.js +1 -1
- package/dist/esm/plugins/change_listener/plugin.d.ts +16 -0
- package/dist/esm/plugins/change_listener/plugin.js +1 -1
- package/dist/esm/plugins/checkbox_options/plugin.d.ts +17 -0
- package/dist/esm/plugins/checkbox_options/plugin.js +1 -1
- package/dist/esm/plugins/checkbox_options/types.d.ts +14 -0
- package/dist/esm/plugins/checkbox_options/types.js +2 -0
- package/dist/esm/plugins/checkbox_options/types.js.map +1 -0
- package/dist/esm/plugins/clear_button/plugin.d.ts +17 -0
- package/dist/esm/plugins/clear_button/plugin.js +1 -1
- package/dist/esm/plugins/clear_button/types.d.ts +7 -0
- package/dist/esm/plugins/clear_button/types.js +2 -0
- package/dist/esm/plugins/clear_button/types.js.map +1 -0
- package/dist/esm/plugins/drag_drop/plugin.d.ts +16 -0
- package/dist/esm/plugins/drag_drop/plugin.js +1 -1
- package/dist/esm/plugins/dropdown_header/plugin.d.ts +17 -0
- package/dist/esm/plugins/dropdown_header/plugin.js +1 -1
- package/dist/esm/plugins/dropdown_header/types.d.ts +8 -0
- package/dist/esm/plugins/dropdown_header/types.js +2 -0
- package/dist/esm/plugins/dropdown_header/types.js.map +1 -0
- package/dist/esm/plugins/dropdown_input/plugin.d.ts +16 -0
- package/dist/esm/plugins/dropdown_input/plugin.js +1 -1
- package/dist/esm/plugins/input_autogrow/plugin.d.ts +15 -0
- package/dist/esm/plugins/input_autogrow/plugin.js +1 -1
- package/dist/esm/plugins/local_virtual_scroll/plugin.d.ts +19 -0
- package/dist/esm/plugins/local_virtual_scroll/plugin.js +92 -1
- package/dist/esm/plugins/local_virtual_scroll/plugin.js.map +1 -1
- package/dist/esm/plugins/local_virtual_scroll/types.d.ts +14 -0
- package/dist/esm/plugins/local_virtual_scroll/types.js +2 -0
- package/dist/esm/plugins/local_virtual_scroll/types.js.map +1 -0
- package/dist/esm/plugins/no_active_items/plugin.d.ts +15 -0
- package/dist/esm/plugins/no_active_items/plugin.js +1 -1
- package/dist/esm/plugins/no_backspace_delete/plugin.d.ts +15 -0
- package/dist/esm/plugins/no_backspace_delete/plugin.js +1 -1
- package/dist/esm/plugins/optgroup_columns/plugin.d.ts +16 -0
- package/dist/esm/plugins/optgroup_columns/plugin.js +1 -1
- package/dist/esm/plugins/remove_button/plugin.d.ts +17 -0
- package/dist/esm/plugins/remove_button/plugin.js +1 -1
- package/dist/esm/plugins/remove_button/types.d.ts +6 -0
- package/dist/esm/plugins/remove_button/types.js +2 -0
- package/dist/esm/plugins/remove_button/types.js.map +1 -0
- package/dist/esm/plugins/restore_on_backspace/plugin.d.ts +21 -0
- package/dist/esm/plugins/restore_on_backspace/plugin.js +1 -1
- package/dist/esm/plugins/virtual_scroll/plugin.d.ts +16 -0
- package/dist/esm/plugins/virtual_scroll/plugin.js +1 -1
- package/dist/esm/tom-select.complete.d.ts +2 -0
- package/dist/esm/tom-select.complete.js +33 -0
- package/dist/esm/tom-select.complete.js.map +1 -0
- package/dist/esm/tom-select.d.ts +594 -0
- package/dist/esm/tom-select.js +2300 -0
- package/dist/esm/tom-select.js.map +1 -0
- package/dist/esm/tom-select.popular.d.ts +2 -0
- package/dist/esm/tom-select.popular.js +13 -0
- package/dist/esm/tom-select.popular.js.map +1 -0
- package/dist/esm/types/core.d.ts +50 -0
- package/dist/esm/types/core.js +2 -0
- package/dist/esm/types/core.js.map +1 -0
- package/dist/esm/types/index.d.ts +2 -0
- package/dist/esm/types/index.js +3 -0
- package/dist/esm/types/index.js.map +1 -0
- package/dist/esm/types/settings.d.ts +81 -0
- package/dist/esm/types/settings.js +2 -0
- package/dist/esm/types/settings.js.map +1 -0
- package/dist/esm/utils.d.ts +95 -0
- package/dist/esm/utils.js +195 -0
- package/dist/esm/utils.js.map +1 -0
- package/dist/esm/vanilla.d.ts +76 -0
- package/dist/esm/vanilla.js +172 -0
- package/dist/esm/vanilla.js.map +1 -0
- package/dist/js/package.json +1 -0
- package/dist/js/plugins/caret_position.js +1 -1
- package/dist/js/plugins/change_listener.js +1 -1
- package/dist/js/plugins/checkbox_options.js +1 -1
- package/dist/js/plugins/clear_button.js +1 -1
- package/dist/js/plugins/drag_drop.js +1 -1
- package/dist/js/plugins/dropdown_header.js +1 -1
- package/dist/js/plugins/dropdown_input.js +1 -1
- package/dist/js/plugins/input_autogrow.js +1 -1
- package/dist/js/plugins/local_virtual_scroll.js +92 -1
- package/dist/js/plugins/local_virtual_scroll.js.map +1 -1
- package/dist/js/plugins/no_active_items.js +1 -1
- package/dist/js/plugins/no_backspace_delete.js +1 -1
- package/dist/js/plugins/optgroup_columns.js +1 -1
- package/dist/js/plugins/remove_button.js +1 -1
- package/dist/js/plugins/restore_on_backspace.js +1 -1
- package/dist/js/plugins/virtual_scroll.js +1 -1
- package/dist/js/tom-select.base.js +1 -1
- package/dist/js/tom-select.base.min.js +1 -1
- package/dist/js/tom-select.complete.js +19 -1
- package/dist/js/tom-select.complete.js.map +1 -1
- package/dist/js/tom-select.complete.min.js +51 -45
- package/dist/js/tom-select.complete.min.js.map +1 -1
- package/dist/js/tom-select.popular.js +1 -1
- package/dist/js/tom-select.popular.min.js +1 -1
- package/dist/scss/_dropdown.scss +99 -0
- package/dist/scss/_items.scss +114 -0
- package/dist/scss/plugins/checkbox_options.scss +11 -0
- package/dist/scss/plugins/clear_button.scss +33 -0
- package/dist/scss/plugins/drag_drop.scss +10 -0
- package/dist/scss/plugins/dropdown_header.scss +24 -0
- package/dist/scss/plugins/dropdown_input.scss +43 -0
- package/dist/scss/plugins/input_autogrow.scss +15 -0
- package/dist/scss/plugins/optgroup_columns.scss +25 -0
- package/dist/scss/plugins/remove_button.scss +70 -0
- package/dist/scss/tom-select.bootstrap4.scss +218 -0
- package/dist/scss/tom-select.bootstrap5.scss +270 -0
- package/dist/scss/tom-select.default.scss +89 -0
- package/dist/scss/tom-select.scss +179 -0
- package/package.json +2 -2
- package/src/plugins/local_virtual_scroll/plugin.ts +19 -0
- /package/dist/{types → cjs}/constants.d.ts +0 -0
- /package/dist/{types → cjs}/contrib/highlight.d.ts +0 -0
- /package/dist/{types → cjs}/contrib/microevent.d.ts +0 -0
- /package/dist/{types → cjs}/contrib/microplugin.d.ts +0 -0
- /package/dist/{types → cjs}/defaults.d.ts +0 -0
- /package/dist/{types → cjs}/getSettings.d.ts +0 -0
- /package/dist/{types → cjs}/plugins/caret_position/plugin.d.ts +0 -0
- /package/dist/{types → cjs}/plugins/change_listener/plugin.d.ts +0 -0
- /package/dist/{types → cjs}/plugins/checkbox_options/plugin.d.ts +0 -0
- /package/dist/{types → cjs}/plugins/checkbox_options/types.d.ts +0 -0
- /package/dist/{types → cjs}/plugins/clear_button/plugin.d.ts +0 -0
- /package/dist/{types → cjs}/plugins/clear_button/types.d.ts +0 -0
- /package/dist/{types → cjs}/plugins/drag_drop/plugin.d.ts +0 -0
- /package/dist/{types → cjs}/plugins/dropdown_header/plugin.d.ts +0 -0
- /package/dist/{types → cjs}/plugins/dropdown_header/types.d.ts +0 -0
- /package/dist/{types → cjs}/plugins/dropdown_input/plugin.d.ts +0 -0
- /package/dist/{types → cjs}/plugins/input_autogrow/plugin.d.ts +0 -0
- /package/dist/{types → cjs}/plugins/local_virtual_scroll/plugin.d.ts +0 -0
- /package/dist/{types → cjs}/plugins/local_virtual_scroll/types.d.ts +0 -0
- /package/dist/{types → cjs}/plugins/no_active_items/plugin.d.ts +0 -0
- /package/dist/{types → cjs}/plugins/no_backspace_delete/plugin.d.ts +0 -0
- /package/dist/{types → cjs}/plugins/optgroup_columns/plugin.d.ts +0 -0
- /package/dist/{types → cjs}/plugins/remove_button/plugin.d.ts +0 -0
- /package/dist/{types → cjs}/plugins/remove_button/types.d.ts +0 -0
- /package/dist/{types → cjs}/plugins/restore_on_backspace/plugin.d.ts +0 -0
- /package/dist/{types → cjs}/plugins/virtual_scroll/plugin.d.ts +0 -0
- /package/dist/{types → cjs}/tom-select.complete.d.ts +0 -0
- /package/dist/{types → cjs}/tom-select.d.ts +0 -0
- /package/dist/{types → cjs}/tom-select.popular.d.ts +0 -0
- /package/dist/{types → cjs}/types/core.d.ts +0 -0
- /package/dist/{types → cjs}/types/index.d.ts +0 -0
- /package/dist/{types → cjs}/types/settings.d.ts +0 -0
- /package/dist/{types → cjs}/utils.d.ts +0 -0
- /package/dist/{types → cjs}/vanilla.d.ts +0 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Return a dom element from either a dom query string, jQuery object, a dom element or html string
|
|
3
|
+
* https://stackoverflow.com/questions/494143/creating-a-new-dom-element-from-an-html-string-using-built-in-dom-methods-or-pro/35385518#35385518
|
|
4
|
+
*
|
|
5
|
+
* param query should be {}
|
|
6
|
+
*/
|
|
7
|
+
export declare const getDom: (query: any) => HTMLElement;
|
|
8
|
+
export declare const isHtmlString: (arg: any) => boolean;
|
|
9
|
+
export declare const escapeQuery: (query: string) => string;
|
|
10
|
+
/**
|
|
11
|
+
* Dispatch an event
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
export declare const triggerEvent: (dom_el: HTMLElement, event_name: string) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Apply CSS rules to a dom element
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
export declare const applyCSS: (dom_el: HTMLElement, css: {
|
|
20
|
+
[key: string]: string | number;
|
|
21
|
+
}) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Add css classes
|
|
24
|
+
*
|
|
25
|
+
*/
|
|
26
|
+
export declare const addClasses: (elmts: HTMLElement | HTMLElement[], ...classes: string[] | string[][]) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Remove css classes
|
|
29
|
+
*
|
|
30
|
+
*/
|
|
31
|
+
export declare const removeClasses: (elmts: HTMLElement | HTMLElement[], ...classes: string[] | string[][]) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Return arguments
|
|
34
|
+
*
|
|
35
|
+
*/
|
|
36
|
+
export declare const classesArray: (args: string[] | string[][]) => string[];
|
|
37
|
+
/**
|
|
38
|
+
* Create an array from arg if it's not already an array
|
|
39
|
+
*
|
|
40
|
+
*/
|
|
41
|
+
export declare const castAsArray: (arg: any) => Array<any>;
|
|
42
|
+
/**
|
|
43
|
+
* Get the closest node to the evt.target matching the selector
|
|
44
|
+
* Stops at wrapper
|
|
45
|
+
*
|
|
46
|
+
*/
|
|
47
|
+
export declare const parentMatch: (target: null | HTMLElement, selector: string, wrapper?: HTMLElement) => HTMLElement | void;
|
|
48
|
+
/**
|
|
49
|
+
* Get the first or last item from an array
|
|
50
|
+
*
|
|
51
|
+
* > 0 - right (last)
|
|
52
|
+
* <= 0 - left (first)
|
|
53
|
+
*
|
|
54
|
+
*/
|
|
55
|
+
export declare const getTail: (list: Array<any> | NodeList, direction?: number) => any;
|
|
56
|
+
/**
|
|
57
|
+
* Return true if an object is empty
|
|
58
|
+
*
|
|
59
|
+
*/
|
|
60
|
+
export declare const isEmptyObject: (obj: object) => boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Get the index of an element amongst sibling nodes of the same type
|
|
63
|
+
*
|
|
64
|
+
*/
|
|
65
|
+
export declare const nodeIndex: (el: null | Element, amongst?: string) => number;
|
|
66
|
+
/**
|
|
67
|
+
* Set attributes of an element
|
|
68
|
+
*
|
|
69
|
+
*/
|
|
70
|
+
export declare const setAttr: (el: Element, attrs: {
|
|
71
|
+
[key: string]: null | string | number;
|
|
72
|
+
}) => void;
|
|
73
|
+
/**
|
|
74
|
+
* Replace a node
|
|
75
|
+
*/
|
|
76
|
+
export declare const replaceNode: (existing: Node, replacement: Node) => void;
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { iterate } from "./utils.js";
|
|
2
|
+
/**
|
|
3
|
+
* Return a dom element from either a dom query string, jQuery object, a dom element or html string
|
|
4
|
+
* https://stackoverflow.com/questions/494143/creating-a-new-dom-element-from-an-html-string-using-built-in-dom-methods-or-pro/35385518#35385518
|
|
5
|
+
*
|
|
6
|
+
* param query should be {}
|
|
7
|
+
*/
|
|
8
|
+
export const getDom = (query) => {
|
|
9
|
+
if (query.jquery) {
|
|
10
|
+
return query[0];
|
|
11
|
+
}
|
|
12
|
+
if (query instanceof HTMLElement) {
|
|
13
|
+
return query;
|
|
14
|
+
}
|
|
15
|
+
if (isHtmlString(query)) {
|
|
16
|
+
var tpl = document.createElement('template');
|
|
17
|
+
tpl.innerHTML = query.trim(); // Never return a text node of whitespace as the result
|
|
18
|
+
return tpl.content.firstChild;
|
|
19
|
+
}
|
|
20
|
+
return document.querySelector(query);
|
|
21
|
+
};
|
|
22
|
+
export const isHtmlString = (arg) => {
|
|
23
|
+
if (typeof arg === 'string' && arg.indexOf('<') > -1) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
return false;
|
|
27
|
+
};
|
|
28
|
+
export const escapeQuery = (query) => {
|
|
29
|
+
return query.replace(/['"\\]/g, '\\$&');
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Dispatch an event
|
|
33
|
+
*
|
|
34
|
+
*/
|
|
35
|
+
export const triggerEvent = (dom_el, event_name) => {
|
|
36
|
+
var event = document.createEvent('HTMLEvents');
|
|
37
|
+
event.initEvent(event_name, true, false);
|
|
38
|
+
dom_el.dispatchEvent(event);
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Apply CSS rules to a dom element
|
|
42
|
+
*
|
|
43
|
+
*/
|
|
44
|
+
export const applyCSS = (dom_el, css) => {
|
|
45
|
+
Object.assign(dom_el.style, css);
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Add css classes
|
|
49
|
+
*
|
|
50
|
+
*/
|
|
51
|
+
export const addClasses = (elmts, ...classes) => {
|
|
52
|
+
var norm_classes = classesArray(classes);
|
|
53
|
+
elmts = castAsArray(elmts);
|
|
54
|
+
elmts.map(el => {
|
|
55
|
+
norm_classes.map(cls => {
|
|
56
|
+
el.classList.add(cls);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Remove css classes
|
|
62
|
+
*
|
|
63
|
+
*/
|
|
64
|
+
export const removeClasses = (elmts, ...classes) => {
|
|
65
|
+
var norm_classes = classesArray(classes);
|
|
66
|
+
elmts = castAsArray(elmts);
|
|
67
|
+
elmts.map(el => {
|
|
68
|
+
norm_classes.map(cls => {
|
|
69
|
+
el.classList.remove(cls);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Return arguments
|
|
75
|
+
*
|
|
76
|
+
*/
|
|
77
|
+
export const classesArray = (args) => {
|
|
78
|
+
var classes = [];
|
|
79
|
+
iterate(args, (_classes) => {
|
|
80
|
+
if (typeof _classes === 'string') {
|
|
81
|
+
_classes = _classes.trim().split(/[\t\n\f\r\s]/);
|
|
82
|
+
}
|
|
83
|
+
if (Array.isArray(_classes)) {
|
|
84
|
+
classes = classes.concat(_classes);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
return classes.filter(Boolean);
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Create an array from arg if it's not already an array
|
|
91
|
+
*
|
|
92
|
+
*/
|
|
93
|
+
export const castAsArray = (arg) => {
|
|
94
|
+
if (!Array.isArray(arg)) {
|
|
95
|
+
arg = [arg];
|
|
96
|
+
}
|
|
97
|
+
return arg;
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Get the closest node to the evt.target matching the selector
|
|
101
|
+
* Stops at wrapper
|
|
102
|
+
*
|
|
103
|
+
*/
|
|
104
|
+
export const parentMatch = (target, selector, wrapper) => {
|
|
105
|
+
if (wrapper && !wrapper.contains(target)) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
while (target && target.matches) {
|
|
109
|
+
if (target.matches(selector)) {
|
|
110
|
+
return target;
|
|
111
|
+
}
|
|
112
|
+
target = target.parentNode;
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* Get the first or last item from an array
|
|
117
|
+
*
|
|
118
|
+
* > 0 - right (last)
|
|
119
|
+
* <= 0 - left (first)
|
|
120
|
+
*
|
|
121
|
+
*/
|
|
122
|
+
export const getTail = (list, direction = 0) => {
|
|
123
|
+
if (direction > 0) {
|
|
124
|
+
return list[list.length - 1];
|
|
125
|
+
}
|
|
126
|
+
return list[0];
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Return true if an object is empty
|
|
130
|
+
*
|
|
131
|
+
*/
|
|
132
|
+
export const isEmptyObject = (obj) => {
|
|
133
|
+
return (Object.keys(obj).length === 0);
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* Get the index of an element amongst sibling nodes of the same type
|
|
137
|
+
*
|
|
138
|
+
*/
|
|
139
|
+
export const nodeIndex = (el, amongst) => {
|
|
140
|
+
if (!el)
|
|
141
|
+
return -1;
|
|
142
|
+
amongst = amongst || el.nodeName;
|
|
143
|
+
var i = 0;
|
|
144
|
+
while (el = el.previousElementSibling) {
|
|
145
|
+
if (el.matches(amongst)) {
|
|
146
|
+
i++;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return i;
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* Set attributes of an element
|
|
153
|
+
*
|
|
154
|
+
*/
|
|
155
|
+
export const setAttr = (el, attrs) => {
|
|
156
|
+
iterate(attrs, (val, attr) => {
|
|
157
|
+
if (val == null) {
|
|
158
|
+
el.removeAttribute(attr);
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
el.setAttribute(attr, '' + val);
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
/**
|
|
166
|
+
* Replace a node
|
|
167
|
+
*/
|
|
168
|
+
export const replaceNode = (existing, replacement) => {
|
|
169
|
+
if (existing.parentNode)
|
|
170
|
+
existing.parentNode.replaceChild(replacement, existing);
|
|
171
|
+
};
|
|
172
|
+
//# sourceMappingURL=vanilla.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,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,CAAC;AACnF,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Tom Select v2.5.2
|
|
2
|
+
* Tom Select v2.5.2-virtual-scroll.1
|
|
3
3
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -9,6 +9,79 @@
|
|
|
9
9
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.local_virtual_scroll = factory());
|
|
10
10
|
})(this, (function () { 'use strict';
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Replace a node
|
|
14
|
+
*/
|
|
15
|
+
const replaceNode = (existing, replacement) => {
|
|
16
|
+
if (existing.parentNode) existing.parentNode.replaceChild(replacement, existing);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* highlight v3 | MIT license | Johann Burkard <jb@eaio.com>
|
|
21
|
+
* Highlights arbitrary terms in a node.
|
|
22
|
+
*
|
|
23
|
+
* - Modified by Marshal <beatgates@gmail.com> 2011-6-24 (added regex)
|
|
24
|
+
* - Modified by Brian Reavis <brian@thirdroute.com> 2012-8-27 (cleanup)
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
const highlight = (element, regex) => {
|
|
28
|
+
if (regex === null) return;
|
|
29
|
+
|
|
30
|
+
// convet string to regex
|
|
31
|
+
if (typeof regex === 'string') {
|
|
32
|
+
if (!regex.length) return;
|
|
33
|
+
regex = new RegExp(regex, 'i');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Wrap matching part of text node with highlighting <span>, e.g.
|
|
37
|
+
// Soccer -> <span class="highlight">Soc</span>cer for regex = /soc/i
|
|
38
|
+
const highlightText = node => {
|
|
39
|
+
var match = node.data.match(regex);
|
|
40
|
+
if (match && node.data.length > 0) {
|
|
41
|
+
var spannode = document.createElement('span');
|
|
42
|
+
spannode.className = 'highlight';
|
|
43
|
+
var middlebit = node.splitText(match.index);
|
|
44
|
+
middlebit.splitText(match[0].length);
|
|
45
|
+
var middleclone = middlebit.cloneNode(true);
|
|
46
|
+
spannode.appendChild(middleclone);
|
|
47
|
+
replaceNode(middlebit, spannode);
|
|
48
|
+
return 1;
|
|
49
|
+
}
|
|
50
|
+
return 0;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// Recurse element node, looking for child text nodes to highlight, unless element
|
|
54
|
+
// is childless, <script>, <style>, or already highlighted: <span class="hightlight">
|
|
55
|
+
const highlightChildren = node => {
|
|
56
|
+
if (node.nodeType === 1 && node.childNodes && !/(script|style)/i.test(node.tagName) && (node.className !== 'highlight' || node.tagName !== 'SPAN')) {
|
|
57
|
+
Array.from(node.childNodes).forEach(element => {
|
|
58
|
+
highlightRecursive(element);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
const highlightRecursive = node => {
|
|
63
|
+
if (node.nodeType === 3) {
|
|
64
|
+
return highlightText(node);
|
|
65
|
+
}
|
|
66
|
+
highlightChildren(node);
|
|
67
|
+
return 0;
|
|
68
|
+
};
|
|
69
|
+
highlightRecursive(element);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* removeHighlight fn copied from highlight v5 and
|
|
74
|
+
* edited to remove with(), pass js strict mode, and use without jquery
|
|
75
|
+
*/
|
|
76
|
+
const removeHighlight = el => {
|
|
77
|
+
var elements = el.querySelectorAll("span.highlight");
|
|
78
|
+
Array.prototype.forEach.call(elements, function (el) {
|
|
79
|
+
var parent = el.parentNode;
|
|
80
|
+
parent.replaceChild(el.firstChild, el);
|
|
81
|
+
parent.normalize();
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
|
|
12
85
|
/**
|
|
13
86
|
* Plugin: "local_virtual_scroll" (Tom Select)
|
|
14
87
|
* Copyright (c) contributors
|
|
@@ -142,6 +215,19 @@
|
|
|
142
215
|
return self.getOption(item.id, true);
|
|
143
216
|
};
|
|
144
217
|
|
|
218
|
+
// ─── Re-apply search highlights to an element ─────────────────────────
|
|
219
|
+
|
|
220
|
+
const applyHighlights = el => {
|
|
221
|
+
if (!self.settings.highlight) return;
|
|
222
|
+
removeHighlight(el);
|
|
223
|
+
const results = self.currentResults;
|
|
224
|
+
if (results && results.query.length && results.tokens.length) {
|
|
225
|
+
for (const tok of results.tokens) {
|
|
226
|
+
if (tok.regex) highlight(el, tok.regex);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
|
|
145
231
|
// ─── Helpers ─────────────────────────────────────────────────────────
|
|
146
232
|
|
|
147
233
|
const measureHeight = elements => elements.reduce((h, el) => {
|
|
@@ -191,6 +277,7 @@
|
|
|
191
277
|
const to = Math.min(flat_list.length, visible_end + page_size * pages);
|
|
192
278
|
const new_els = renderRange(from, to);
|
|
193
279
|
for (const el of new_els) dropdown_content.append(el);
|
|
280
|
+
for (const el of new_els) applyHighlights(el);
|
|
194
281
|
visible_end = to;
|
|
195
282
|
|
|
196
283
|
// Recycle items from top to stay within max_dom
|
|
@@ -219,6 +306,7 @@
|
|
|
219
306
|
// Prepend before current first child
|
|
220
307
|
const first_child = dropdown_content.firstChild;
|
|
221
308
|
for (const el of new_els) dropdown_content.insertBefore(el, first_child);
|
|
309
|
+
for (const el of new_els) applyHighlights(el);
|
|
222
310
|
|
|
223
311
|
// Compensate scrollTop so existing content stays in place
|
|
224
312
|
setScrollTop(dropdown_content.scrollTop + measureHeight(new_els));
|
|
@@ -279,6 +367,9 @@
|
|
|
279
367
|
dropdown_content.innerHTML = '';
|
|
280
368
|
const first_page = renderRange(0, visible_end);
|
|
281
369
|
for (const el of first_page) dropdown_content.append(el);
|
|
370
|
+
// Re-apply highlights: the core applied them before we cleared the DOM,
|
|
371
|
+
// and items from optgroup expansion never went through the core highlight pass.
|
|
372
|
+
applyHighlights(dropdown_content);
|
|
282
373
|
}
|
|
283
374
|
updateSentinel();
|
|
284
375
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local_virtual_scroll.js","sources":["../../../src/plugins/local_virtual_scroll/plugin.ts"],"sourcesContent":["/**\n * Plugin: \"local_virtual_scroll\" (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 * Virtual scroll for locally-loaded (non-AJAX) datasets.\n * Maintains a sliding DOM window of pageSize * 3 items maximum.\n * Supports optGroups via a flat list with interleaved headers.\n *\n * When the search query matches an optGroup label, all children of that\n * group are included in the results — even if the individual options don't\n * match the query text.\n */\n\nimport type TomSelect from '../../tom-select.ts';\nimport type { LVSOptions, FlatItem } from './types.ts';\n\nexport default function (this: TomSelect, userOptions: LVSOptions) {\n\tconst self = this;\n\tconst page_size = userOptions?.pageSize ?? 50;\n\tconst max_dom = userOptions?.maxDomItems ?? page_size * 3;\n\tconst threshold = userOptions?.scrollThreshold ?? 0.9;\n\n\tlet dropdown_content: HTMLElement;\n\tlet flat_list: FlatItem[] = [];\n\tlet visible_start = 0;\n\tlet visible_end = 0;\n\tlet is_loading = false;\n\tlet sentinel: HTMLElement | null = null;\n\n\t// RAF handle + flag to skip the scroll event caused by our own scrollTop writes\n\tlet raf_id: number | null = null;\n\tlet skip_programmatic = false;\n\n\t// Plugin controls maxOptions (first page only; we manage the rest)\n\tself.settings.maxOptions = page_size;\n\n\t// ─── Build flat list: Sifter results + optgroup headers interleaved ───\n\t//\n\t// When the query matches an optGroup label, ALL options from that group\n\t// are included regardless of whether the individual option text matches.\n\n\tconst buildFlatList = (): FlatItem[] => {\n\t\tconst flat: FlatItem[] = [];\n\t\tconst results = self.search(self.lastValue);\n\t\tconst og_field = self.settings.optgroupField;\n\t\tconst og_label_field =\n\t\t\t(self.settings as any).optgroupLabelField || 'label';\n\t\tconst query = (self.lastValue || '').trim().toLowerCase();\n\n\t\t// Helper: extract first optgroup value from an option\n\t\tconst getOg = (option: any): string => {\n\t\t\tlet og = option[og_field] || '';\n\t\t\tif (Array.isArray(og)) og = og[0] ?? '';\n\t\t\treturn String(og);\n\t\t};\n\n\t\t// Find optgroups whose label matches the query\n\t\tconst matching_og_labels = new Set<string>();\n\t\tif (query) {\n\t\t\tfor (const key of Object.keys(self.optgroups)) {\n\t\t\t\tconst label = String(\n\t\t\t\t\t(self.optgroups[key] as any)[og_label_field] || '',\n\t\t\t\t).toLowerCase();\n\t\t\t\tif (label.includes(query)) matching_og_labels.add(key);\n\t\t\t}\n\t\t}\n\n\t\t// Build ordered groups + their item sets from Sifter results\n\t\tconst group_order: string[] = [];\n\t\tconst group_items = new Map<string, Set<string>>();\n\n\t\tfor (const item of results.items) {\n\t\t\tconst option = self.options[item.id];\n\t\t\tif (!option) continue;\n\t\t\tconst og = getOg(option);\n\t\t\tif (!group_items.has(og)) {\n\t\t\t\tgroup_items.set(og, new Set());\n\t\t\t\tgroup_order.push(og);\n\t\t\t}\n\t\t\tgroup_items.get(og)!.add(String(item.id));\n\t\t}\n\n\t\t// Ensure matching optgroups appear in group_order (even with no Sifter hits)\n\t\tfor (const og of matching_og_labels) {\n\t\t\tif (!group_items.has(og)) {\n\t\t\t\tgroup_items.set(og, new Set());\n\t\t\t\tgroup_order.push(og);\n\t\t\t}\n\t\t}\n\n\t\t// Expand matching optgroups: add ALL their options (Set deduplicates)\n\t\tif (matching_og_labels.size > 0) {\n\t\t\tfor (const id of Object.keys(self.options)) {\n\t\t\t\tconst option = self.options[id];\n\t\t\t\tconst og = getOg(option);\n\t\t\t\tif (matching_og_labels.has(og)) {\n\t\t\t\t\tgroup_items.get(og)!.add(id);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Emit flat list in group order\n\t\tfor (const og of group_order) {\n\t\t\tconst ids = group_items.get(og)!;\n\t\t\tif (ids.size === 0) continue;\n\t\t\tif (og && self.optgroups[og]) {\n\t\t\t\tflat.push({ type: 'header', optgroup: og });\n\t\t\t}\n\t\t\tfor (const id of ids) {\n\t\t\t\tflat.push({ type: 'option', id, optgroup: og });\n\t\t\t}\n\t\t}\n\n\t\treturn flat;\n\t};\n\n\t// ─── Render a single flat item to its DOM element ─────────────────────\n\n\tconst renderFlatItem = (item: FlatItem): HTMLElement | null => {\n\t\tif (item.type === 'header') {\n\t\t\tif (!item.el) {\n\t\t\t\titem.el = self.render(\n\t\t\t\t\t'optgroup_header',\n\t\t\t\t\tself.optgroups[item.optgroup],\n\t\t\t\t) as HTMLElement;\n\t\t\t}\n\t\t\treturn item.el ?? null;\n\t\t}\n\t\treturn self.getOption(item.id, true) as HTMLElement;\n\t};\n\n\t// ─── Helpers ─────────────────────────────────────────────────────────\n\n\tconst measureHeight = (elements: HTMLElement[]): number =>\n\t\telements.reduce((h, el) => h + (el.offsetHeight ?? 0), 0);\n\n\tconst updateSentinel = () => {\n\t\t// dropdown_content is set only after 'initialize' fires;\n\t\t// refreshOptions runs during construction before that — skip silently.\n\t\tif (!dropdown_content) return;\n\t\tif (sentinel) {\n\t\t\tsentinel.remove();\n\t\t\tsentinel = null;\n\t\t}\n\t\tif (visible_end < flat_list.length) {\n\t\t\tsentinel = self.render('loading_more', {}) as HTMLElement;\n\t\t\tif (sentinel) dropdown_content.append(sentinel);\n\t\t}\n\t};\n\n\tconst renderRange = (from: number, to: number): HTMLElement[] => {\n\t\tconst els: HTMLElement[] = [];\n\t\tfor (let i = from; i < to; i++) {\n\t\t\tconst item = flat_list[i];\n\t\t\tif (!item) continue;\n\t\t\tconst el = renderFlatItem(item);\n\t\t\tif (el) els.push(el);\n\t\t}\n\t\treturn els;\n\t};\n\n\t/** Write scrollTop without triggering our own scroll handler logic */\n\tconst setScrollTop = (value: number) => {\n\t\tskip_programmatic = true;\n\t\tdropdown_content.scrollTop = value;\n\t};\n\n\t// ─── Load N pages forward (scroll down) ──────────────────────────────\n\n\tconst loadNext = (pages: number) => {\n\t\tif (is_loading || visible_end >= flat_list.length) return;\n\t\tis_loading = true;\n\t\tif (sentinel) {\n\t\t\tsentinel.remove();\n\t\t\tsentinel = null;\n\t\t}\n\n\t\tconst from = visible_end;\n\t\tconst to = Math.min(flat_list.length, visible_end + page_size * pages);\n\t\tconst new_els = renderRange(from, to);\n\t\tfor (const el of new_els) dropdown_content.append(el);\n\t\tvisible_end = to;\n\n\t\t// Recycle items from top to stay within max_dom\n\t\tconst dom_count = visible_end - visible_start;\n\t\tif (dom_count > max_dom) {\n\t\t\tconst n = dom_count - max_dom;\n\t\t\tconst remove_els = renderRange(visible_start, visible_start + n);\n\t\t\tconst removed_h = measureHeight(remove_els);\n\t\t\tfor (const el of remove_els) el.remove();\n\t\t\tvisible_start += n;\n\t\t\tsetScrollTop(dropdown_content.scrollTop + removed_h);\n\t\t}\n\n\t\tis_loading = false;\n\t\tupdateSentinel();\n\t};\n\n\t// ─── Load N pages backward (scroll up) ───────────────────────────────\n\n\tconst loadPrev = (pages: number) => {\n\t\tif (is_loading || visible_start <= 0) return;\n\t\tis_loading = true;\n\n\t\tconst from = Math.max(0, visible_start - page_size * pages);\n\t\tconst to = visible_start;\n\t\tconst new_els = renderRange(from, to);\n\n\t\t// Prepend before current first child\n\t\tconst first_child = dropdown_content.firstChild;\n\t\tfor (const el of new_els)\n\t\t\tdropdown_content.insertBefore(el, first_child);\n\n\t\t// Compensate scrollTop so existing content stays in place\n\t\tsetScrollTop(dropdown_content.scrollTop + measureHeight(new_els));\n\t\tvisible_start = from;\n\n\t\t// Recycle items from bottom to stay within max_dom\n\t\tconst dom_count = visible_end - visible_start;\n\t\tif (dom_count > max_dom) {\n\t\t\tconst n = dom_count - max_dom;\n\t\t\tconst remove_els = renderRange(visible_end - n, visible_end);\n\t\t\tfor (const el of remove_els) el.remove();\n\t\t\tvisible_end -= n;\n\t\t}\n\n\t\tis_loading = false;\n\t\tupdateSentinel();\n\t};\n\n\t// ─── Scroll handler with RAF debounce ─────────────────────────────────\n\n\tconst handleScroll = () => {\n\t\tconst { scrollTop, scrollHeight, clientHeight } = dropdown_content;\n\t\tconst pct_bottom = (scrollTop + clientHeight) / scrollHeight;\n\t\tconst pct_top = scrollTop / scrollHeight;\n\n\t\t// Always load exactly 1 page per RAF frame.\n\t\t// The RAF debounce already coalesces rapid scroll events, so there is no\n\t\t// need to load multiple pages at once — that only causes long DOM operations.\n\t\tif (pct_bottom >= threshold) {\n\t\t\tloadNext(1);\n\t\t} else if (pct_top <= 1 - threshold) {\n\t\t\tloadPrev(1);\n\t\t}\n\t};\n\n\t// ─── Reset virtual state on each refreshOptions ───────────────────────\n\n\tself.hook('before', 'refreshOptions', () => {\n\t\tself.settings.maxOptions = page_size;\n\t});\n\n\tself.hook('after', 'refreshOptions', () => {\n\t\tflat_list = buildFlatList();\n\t\tvisible_start = 0;\n\t\tvisible_end = Math.min(flat_list.length, page_size);\n\t\tis_loading = false;\n\t\tif (raf_id !== null) {\n\t\t\tcancelAnimationFrame(raf_id);\n\t\t\traf_id = null;\n\t\t}\n\n\t\t// Re-render first page from flat_list to keep DOM in sync.\n\t\t// refreshOptions may render items in optgroup wrappers or a different\n\t\t// order than our flat list; clearing and re-rendering ensures consistency.\n\t\tif (dropdown_content && flat_list.length > 0) {\n\t\t\tdropdown_content.innerHTML = '';\n\t\t\tconst first_page = renderRange(0, visible_end);\n\t\t\tfor (const el of first_page) dropdown_content.append(el);\n\t\t}\n\n\t\tupdateSentinel();\n\t});\n\n\t// ─── Initialize: set templates and attach scroll listener ────────────\n\n\tself.on('initialize', () => {\n\t\tdropdown_content = self.dropdown_content;\n\t\t// Disable overflow-anchor so the browser doesn't auto-compensate scrollTop\n\t\t// when we insert/remove items — we handle the compensation manually.\n\t\t(dropdown_content.style as any)['overflow-anchor'] = 'none';\n\n\t\tself.settings.render = Object.assign(\n\t\t\t{},\n\t\t\t{\n\t\t\t\tloading_more: () =>\n\t\t\t\t\t'<div class=\"loading-more-results\">Carregando mais resultados...</div>',\n\t\t\t},\n\t\t\tself.settings.render,\n\t\t);\n\n\t\tdropdown_content.addEventListener('scroll', () => {\n\t\t\tif (skip_programmatic) {\n\t\t\t\tskip_programmatic = false;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (raf_id !== null) cancelAnimationFrame(raf_id);\n\t\t\traf_id = requestAnimationFrame(() => {\n\t\t\t\traf_id = null;\n\t\t\t\thandleScroll();\n\t\t\t});\n\t\t});\n\t});\n}\n"],"names":["userOptions","_userOptions$pageSize","_userOptions$maxDomIt","_userOptions$scrollTh","self","page_size","pageSize","max_dom","maxDomItems","threshold","scrollThreshold","dropdown_content","flat_list","visible_start","visible_end","is_loading","sentinel","raf_id","skip_programmatic","settings","maxOptions","buildFlatList","flat","results","search","lastValue","og_field","optgroupField","og_label_field","optgroupLabelField","query","trim","toLowerCase","getOg","option","_og$","og","Array","isArray","String","matching_og_labels","Set","key","Object","keys","optgroups","label","includes","add","group_order","group_items","Map","item","items","options","id","has","set","push","get","size","ids","type","optgroup","renderFlatItem","_item$el","el","render","getOption","measureHeight","elements","reduce","h","_el$offsetHeight","offsetHeight","updateSentinel","remove","length","append","renderRange","from","to","els","i","setScrollTop","value","scrollTop","loadNext","pages","Math","min","new_els","dom_count","n","remove_els","removed_h","loadPrev","max","first_child","firstChild","insertBefore","handleScroll","scrollHeight","clientHeight","pct_bottom","pct_top","hook","cancelAnimationFrame","innerHTML","first_page","on","style","assign","loading_more","addEventListener","requestAnimationFrame"],"mappings":";;;;;;;;;;;CAAA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;CAKe,eAAA,EAA2BA,WAAuB,EAAE;CAAA,EAAA,IAAAC,qBAAA,EAAAC,qBAAA,EAAAC,qBAAA;GAClE,MAAMC,IAAI,GAAG,IAAI;CACjB,EAAA,MAAMC,SAAS,GAAA,CAAAJ,qBAAA,GAAGD,WAAW,IAAA,IAAA,GAAA,MAAA,GAAXA,WAAW,CAAEM,QAAQ,KAAA,IAAA,GAAAL,qBAAA,GAA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;CACD,MAAA;CACA,MAAA,IAAID,MAAM,KAAK,IAAI,EAAE0F,oBAAoB,CAAC1F,MAAM,CAAC;OACjDA,MAAM,GAAGkG,qBAAqB,CAAC,MAAM;CACpClG,QAAAA,MAAM,GAAG,IAAI;CACboF,QAAAA,YAAY,EAAE;CACf,MAAA,CAAC,CAAC;CACH,IAAA,CAAC,CAAC;CACH,EAAA,CAAC,CAAC;CACH;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"local_virtual_scroll.js","sources":["../../../src/vanilla.ts","../../../src/contrib/highlight.ts","../../../src/plugins/local_virtual_scroll/plugin.ts"],"sourcesContent":["\nimport { iterate } from './utils.ts';\n\n/**\n * Return a dom element from either a dom query string, jQuery object, a dom element or html string\n * https://stackoverflow.com/questions/494143/creating-a-new-dom-element-from-an-html-string-using-built-in-dom-methods-or-pro/35385518#35385518\n *\n * param query should be {}\n */\nexport const getDom = ( query:any ):HTMLElement => {\n\n\tif( query.jquery ){\n\t\treturn query[0];\n\t}\n\n\tif( query instanceof HTMLElement ){\n\t\treturn query;\n\t}\n\n\tif( isHtmlString(query) ){\n\t\tvar tpl = document.createElement('template');\n\t\ttpl.innerHTML = query.trim(); // Never return a text node of whitespace as the result\n\t\treturn tpl.content.firstChild as HTMLElement;\n\t}\n\n\treturn document.querySelector(query);\n};\n\nexport const isHtmlString = (arg:any): boolean => {\n\tif( typeof arg === 'string' && arg.indexOf('<') > -1 ){\n\t\treturn true;\n\t}\n\treturn false;\n}\n\nexport const escapeQuery = (query:string):string => {\n\treturn query.replace(/['\"\\\\]/g, '\\\\$&');\n}\n\n/**\n * Dispatch an event\n *\n */\nexport const triggerEvent = ( dom_el:HTMLElement, event_name:string ):void => {\n\tvar event = document.createEvent('HTMLEvents');\n\tevent.initEvent(event_name, true, false);\n\tdom_el.dispatchEvent(event)\n};\n\n/**\n * Apply CSS rules to a dom element\n *\n */\nexport const applyCSS = ( dom_el:HTMLElement, css:{ [key: string]: string|number }):void => {\n\tObject.assign(dom_el.style, css);\n}\n\n\n/**\n * Add css classes\n *\n */\nexport const addClasses = ( elmts:HTMLElement|HTMLElement[], ...classes:string[]|string[][] ) => {\n\n\tvar norm_classes \t= classesArray(classes);\n\telmts\t\t\t\t= castAsArray(elmts);\n\n\telmts.map( el => {\n\t\tnorm_classes.map( cls => {\n\t\t\tel.classList.add( cls );\n\t\t});\n\t});\n}\n\n/**\n * Remove css classes\n *\n */\n export const removeClasses = ( elmts:HTMLElement|HTMLElement[], ...classes:string[]|string[][] ) => {\n\n \tvar norm_classes \t= classesArray(classes);\n\telmts\t\t\t\t= castAsArray(elmts);\n\n\telmts.map( el => {\n\t\tnorm_classes.map(cls => {\n\t \t\tel.classList.remove( cls );\n\t\t});\n \t});\n }\n\n\n/**\n * Return arguments\n *\n */\nexport const classesArray = (args:string[]|string[][]):string[] => {\n\tvar classes:string[] = [];\n\titerate( args, (_classes) =>{\n\t\tif( typeof _classes === 'string' ){\n\t\t\t_classes = _classes.trim().split(/[\\t\\n\\f\\r\\s]/);\n\t\t}\n\t\tif( Array.isArray(_classes) ){\n\t\t\tclasses = classes.concat(_classes);\n\t\t}\n\t});\n\n\treturn classes.filter(Boolean);\n}\n\n\n/**\n * Create an array from arg if it's not already an array\n *\n */\nexport const castAsArray = (arg:any):Array<any> => {\n\tif( !Array.isArray(arg) ){\n \t\targ = [arg];\n \t}\n\treturn arg;\n}\n\n\n/**\n * Get the closest node to the evt.target matching the selector\n * Stops at wrapper\n *\n */\nexport const parentMatch = ( target:null|HTMLElement, selector:string, wrapper?:HTMLElement ):HTMLElement|void => {\n\n\tif( wrapper && !wrapper.contains(target) ){\n\t\treturn;\n\t}\n\n\twhile( target && target.matches ){\n\n\t\tif( target.matches(selector) ){\n\t\t\treturn target;\n\t\t}\n\n\t\ttarget = target.parentNode as HTMLElement;\n\t}\n}\n\n\n/**\n * Get the first or last item from an array\n *\n * > 0 - right (last)\n * <= 0 - left (first)\n *\n */\nexport const getTail = ( list:Array<any>|NodeList, direction:number=0 ):any => {\n\n\tif( direction > 0 ){\n\t\treturn list[list.length-1];\n\t}\n\n\treturn list[0];\n}\n\n/**\n * Return true if an object is empty\n *\n */\nexport const isEmptyObject = (obj:object):boolean => {\n\treturn (Object.keys(obj).length === 0);\n}\n\n\n/**\n * Get the index of an element amongst sibling nodes of the same type\n *\n */\nexport const nodeIndex = ( el:null|Element, amongst?:string ):number => {\n\tif (!el) return -1;\n\n\tamongst = amongst || el.nodeName;\n\n\tvar i = 0;\n\twhile( el = el.previousElementSibling ){\n\n\t\tif( el.matches(amongst) ){\n\t\t\ti++;\n\t\t}\n\t}\n\treturn i;\n}\n\n\n/**\n * Set attributes of an element\n *\n */\nexport const setAttr = (el:Element,attrs:{ [key: string]: null|string|number }) => {\n\titerate( attrs,(val,attr) => {\n\t\tif( val == null ){\n\t\t\tel.removeAttribute(attr as string);\n\t\t}else{\n\t\t\tel.setAttribute(attr as string, ''+val);\n\t\t}\n\t});\n}\n\n\n/**\n * Replace a node\n */\nexport const replaceNode = ( existing:Node, replacement:Node ) => {\n\tif( existing.parentNode ) existing.parentNode.replaceChild(replacement, existing);\n}\n","/**\n * highlight v3 | MIT license | Johann Burkard <jb@eaio.com>\n * Highlights arbitrary terms in a node.\n *\n * - Modified by Marshal <beatgates@gmail.com> 2011-6-24 (added regex)\n * - Modified by Brian Reavis <brian@thirdroute.com> 2012-8-27 (cleanup)\n */\n\nimport {replaceNode} from '../vanilla.ts';\n\n\nexport const highlight = (element:HTMLElement, regex:string|RegExp) => {\n\n\tif( regex === null ) return;\n\n\t// convet string to regex\n\tif( typeof regex === 'string' ){\n\n\t\tif( !regex.length ) return;\n\t\tregex = new RegExp(regex, 'i');\n\t}\n\n\n\t// Wrap matching part of text node with highlighting <span>, e.g.\n\t// Soccer -> <span class=\"highlight\">Soc</span>cer for regex = /soc/i\n\tconst highlightText = ( node:Text ):number => {\n\n\t\tvar match = node.data.match(regex);\n\t\tif( match && node.data.length > 0 ){\n\t\t\tvar spannode\t\t= document.createElement('span');\n\t\t\tspannode.className\t= 'highlight';\n\t\t\tvar middlebit\t\t= node.splitText(match.index as number);\n\n\t\t\tmiddlebit.splitText(match[0]!.length);\n\t\t\tvar middleclone\t\t= middlebit.cloneNode(true);\n\n\t\t\tspannode.appendChild(middleclone);\n\t\t\treplaceNode(middlebit, spannode);\n\t\t\treturn 1;\n\t\t}\n\n\t\treturn 0;\n\t};\n\n\t// Recurse element node, looking for child text nodes to highlight, unless element\n\t// is childless, <script>, <style>, or already highlighted: <span class=\"hightlight\">\n\tconst highlightChildren = ( node:Element ):void => {\n\t\tif( node.nodeType === 1 && node.childNodes && !/(script|style)/i.test(node.tagName) && ( node.className !== 'highlight' || node.tagName !== 'SPAN' ) ){\n\t\t\tArray.from(node.childNodes).forEach(element => {\n\t\t\t\thighlightRecursive(element);\n\t\t\t});\n\t\t}\n\t};\n\n\n\tconst highlightRecursive = ( node:Node|Element ):number => {\n\n\t\tif( node.nodeType === 3 ){\n\t\t\treturn highlightText(node as Text);\n\t\t}\n\n\t\thighlightChildren(node as Element);\n\n\t\treturn 0;\n\t};\n\n\thighlightRecursive( element );\n};\n\n/**\n * removeHighlight fn copied from highlight v5 and\n * edited to remove with(), pass js strict mode, and use without jquery\n */\nexport const removeHighlight = (el:HTMLElement) => {\n\tvar elements = el.querySelectorAll(\"span.highlight\");\n\tArray.prototype.forEach.call(elements, function(el:HTMLElement){\n\t\tvar parent = el.parentNode as Node;\n\t\tparent.replaceChild(el.firstChild as Node, el);\n\t\tparent.normalize();\n\t});\n};\n","/**\n * Plugin: \"local_virtual_scroll\" (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 * Virtual scroll for locally-loaded (non-AJAX) datasets.\n * Maintains a sliding DOM window of pageSize * 3 items maximum.\n * Supports optGroups via a flat list with interleaved headers.\n *\n * When the search query matches an optGroup label, all children of that\n * group are included in the results — even if the individual options don't\n * match the query text.\n */\n\nimport type TomSelect from '../../tom-select.ts';\nimport type { LVSOptions, FlatItem } from './types.ts';\nimport { highlight, removeHighlight } from '../../contrib/highlight.ts';\n\nexport default function (this: TomSelect, userOptions: LVSOptions) {\n\tconst self = this;\n\tconst page_size = userOptions?.pageSize ?? 50;\n\tconst max_dom = userOptions?.maxDomItems ?? page_size * 3;\n\tconst threshold = userOptions?.scrollThreshold ?? 0.9;\n\n\tlet dropdown_content: HTMLElement;\n\tlet flat_list: FlatItem[] = [];\n\tlet visible_start = 0;\n\tlet visible_end = 0;\n\tlet is_loading = false;\n\tlet sentinel: HTMLElement | null = null;\n\n\t// RAF handle + flag to skip the scroll event caused by our own scrollTop writes\n\tlet raf_id: number | null = null;\n\tlet skip_programmatic = false;\n\n\t// Plugin controls maxOptions (first page only; we manage the rest)\n\tself.settings.maxOptions = page_size;\n\n\t// ─── Build flat list: Sifter results + optgroup headers interleaved ───\n\t//\n\t// When the query matches an optGroup label, ALL options from that group\n\t// are included regardless of whether the individual option text matches.\n\n\tconst buildFlatList = (): FlatItem[] => {\n\t\tconst flat: FlatItem[] = [];\n\t\tconst results = self.search(self.lastValue);\n\t\tconst og_field = self.settings.optgroupField;\n\t\tconst og_label_field =\n\t\t\t(self.settings as any).optgroupLabelField || 'label';\n\t\tconst query = (self.lastValue || '').trim().toLowerCase();\n\n\t\t// Helper: extract first optgroup value from an option\n\t\tconst getOg = (option: any): string => {\n\t\t\tlet og = option[og_field] || '';\n\t\t\tif (Array.isArray(og)) og = og[0] ?? '';\n\t\t\treturn String(og);\n\t\t};\n\n\t\t// Find optgroups whose label matches the query\n\t\tconst matching_og_labels = new Set<string>();\n\t\tif (query) {\n\t\t\tfor (const key of Object.keys(self.optgroups)) {\n\t\t\t\tconst label = String(\n\t\t\t\t\t(self.optgroups[key] as any)[og_label_field] || '',\n\t\t\t\t).toLowerCase();\n\t\t\t\tif (label.includes(query)) matching_og_labels.add(key);\n\t\t\t}\n\t\t}\n\n\t\t// Build ordered groups + their item sets from Sifter results\n\t\tconst group_order: string[] = [];\n\t\tconst group_items = new Map<string, Set<string>>();\n\n\t\tfor (const item of results.items) {\n\t\t\tconst option = self.options[item.id];\n\t\t\tif (!option) continue;\n\t\t\tconst og = getOg(option);\n\t\t\tif (!group_items.has(og)) {\n\t\t\t\tgroup_items.set(og, new Set());\n\t\t\t\tgroup_order.push(og);\n\t\t\t}\n\t\t\tgroup_items.get(og)!.add(String(item.id));\n\t\t}\n\n\t\t// Ensure matching optgroups appear in group_order (even with no Sifter hits)\n\t\tfor (const og of matching_og_labels) {\n\t\t\tif (!group_items.has(og)) {\n\t\t\t\tgroup_items.set(og, new Set());\n\t\t\t\tgroup_order.push(og);\n\t\t\t}\n\t\t}\n\n\t\t// Expand matching optgroups: add ALL their options (Set deduplicates)\n\t\tif (matching_og_labels.size > 0) {\n\t\t\tfor (const id of Object.keys(self.options)) {\n\t\t\t\tconst option = self.options[id];\n\t\t\t\tconst og = getOg(option);\n\t\t\t\tif (matching_og_labels.has(og)) {\n\t\t\t\t\tgroup_items.get(og)!.add(id);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Emit flat list in group order\n\t\tfor (const og of group_order) {\n\t\t\tconst ids = group_items.get(og)!;\n\t\t\tif (ids.size === 0) continue;\n\t\t\tif (og && self.optgroups[og]) {\n\t\t\t\tflat.push({ type: 'header', optgroup: og });\n\t\t\t}\n\t\t\tfor (const id of ids) {\n\t\t\t\tflat.push({ type: 'option', id, optgroup: og });\n\t\t\t}\n\t\t}\n\n\t\treturn flat;\n\t};\n\n\t// ─── Render a single flat item to its DOM element ─────────────────────\n\n\tconst renderFlatItem = (item: FlatItem): HTMLElement | null => {\n\t\tif (item.type === 'header') {\n\t\t\tif (!item.el) {\n\t\t\t\titem.el = self.render(\n\t\t\t\t\t'optgroup_header',\n\t\t\t\t\tself.optgroups[item.optgroup],\n\t\t\t\t) as HTMLElement;\n\t\t\t}\n\t\t\treturn item.el ?? null;\n\t\t}\n\t\treturn self.getOption(item.id, true) as HTMLElement;\n\t};\n\n\t// ─── Re-apply search highlights to an element ─────────────────────────\n\n\tconst applyHighlights = (el: HTMLElement) => {\n\t\tif (!self.settings.highlight) return;\n\t\tremoveHighlight(el);\n\t\tconst results = self.currentResults;\n\t\tif (results && results.query.length && results.tokens.length) {\n\t\t\tfor (const tok of results.tokens) {\n\t\t\t\tif (tok.regex) highlight(el, tok.regex);\n\t\t\t}\n\t\t}\n\t};\n\n\t// ─── Helpers ─────────────────────────────────────────────────────────\n\n\tconst measureHeight = (elements: HTMLElement[]): number =>\n\t\telements.reduce((h, el) => h + (el.offsetHeight ?? 0), 0);\n\n\tconst updateSentinel = () => {\n\t\t// dropdown_content is set only after 'initialize' fires;\n\t\t// refreshOptions runs during construction before that — skip silently.\n\t\tif (!dropdown_content) return;\n\t\tif (sentinel) {\n\t\t\tsentinel.remove();\n\t\t\tsentinel = null;\n\t\t}\n\t\tif (visible_end < flat_list.length) {\n\t\t\tsentinel = self.render('loading_more', {}) as HTMLElement;\n\t\t\tif (sentinel) dropdown_content.append(sentinel);\n\t\t}\n\t};\n\n\tconst renderRange = (from: number, to: number): HTMLElement[] => {\n\t\tconst els: HTMLElement[] = [];\n\t\tfor (let i = from; i < to; i++) {\n\t\t\tconst item = flat_list[i];\n\t\t\tif (!item) continue;\n\t\t\tconst el = renderFlatItem(item);\n\t\t\tif (el) els.push(el);\n\t\t}\n\t\treturn els;\n\t};\n\n\t/** Write scrollTop without triggering our own scroll handler logic */\n\tconst setScrollTop = (value: number) => {\n\t\tskip_programmatic = true;\n\t\tdropdown_content.scrollTop = value;\n\t};\n\n\t// ─── Load N pages forward (scroll down) ──────────────────────────────\n\n\tconst loadNext = (pages: number) => {\n\t\tif (is_loading || visible_end >= flat_list.length) return;\n\t\tis_loading = true;\n\t\tif (sentinel) {\n\t\t\tsentinel.remove();\n\t\t\tsentinel = null;\n\t\t}\n\n\t\tconst from = visible_end;\n\t\tconst to = Math.min(flat_list.length, visible_end + page_size * pages);\n\t\tconst new_els = renderRange(from, to);\n\t\tfor (const el of new_els) dropdown_content.append(el);\n\t\tfor (const el of new_els) applyHighlights(el);\n\t\tvisible_end = to;\n\n\t\t// Recycle items from top to stay within max_dom\n\t\tconst dom_count = visible_end - visible_start;\n\t\tif (dom_count > max_dom) {\n\t\t\tconst n = dom_count - max_dom;\n\t\t\tconst remove_els = renderRange(visible_start, visible_start + n);\n\t\t\tconst removed_h = measureHeight(remove_els);\n\t\t\tfor (const el of remove_els) el.remove();\n\t\t\tvisible_start += n;\n\t\t\tsetScrollTop(dropdown_content.scrollTop + removed_h);\n\t\t}\n\n\t\tis_loading = false;\n\t\tupdateSentinel();\n\t};\n\n\t// ─── Load N pages backward (scroll up) ───────────────────────────────\n\n\tconst loadPrev = (pages: number) => {\n\t\tif (is_loading || visible_start <= 0) return;\n\t\tis_loading = true;\n\n\t\tconst from = Math.max(0, visible_start - page_size * pages);\n\t\tconst to = visible_start;\n\t\tconst new_els = renderRange(from, to);\n\n\t\t// Prepend before current first child\n\t\tconst first_child = dropdown_content.firstChild;\n\t\tfor (const el of new_els)\n\t\t\tdropdown_content.insertBefore(el, first_child);\n\t\tfor (const el of new_els) applyHighlights(el);\n\n\t\t// Compensate scrollTop so existing content stays in place\n\t\tsetScrollTop(dropdown_content.scrollTop + measureHeight(new_els));\n\t\tvisible_start = from;\n\n\t\t// Recycle items from bottom to stay within max_dom\n\t\tconst dom_count = visible_end - visible_start;\n\t\tif (dom_count > max_dom) {\n\t\t\tconst n = dom_count - max_dom;\n\t\t\tconst remove_els = renderRange(visible_end - n, visible_end);\n\t\t\tfor (const el of remove_els) el.remove();\n\t\t\tvisible_end -= n;\n\t\t}\n\n\t\tis_loading = false;\n\t\tupdateSentinel();\n\t};\n\n\t// ─── Scroll handler with RAF debounce ─────────────────────────────────\n\n\tconst handleScroll = () => {\n\t\tconst { scrollTop, scrollHeight, clientHeight } = dropdown_content;\n\t\tconst pct_bottom = (scrollTop + clientHeight) / scrollHeight;\n\t\tconst pct_top = scrollTop / scrollHeight;\n\n\t\t// Always load exactly 1 page per RAF frame.\n\t\t// The RAF debounce already coalesces rapid scroll events, so there is no\n\t\t// need to load multiple pages at once — that only causes long DOM operations.\n\t\tif (pct_bottom >= threshold) {\n\t\t\tloadNext(1);\n\t\t} else if (pct_top <= 1 - threshold) {\n\t\t\tloadPrev(1);\n\t\t}\n\t};\n\n\t// ─── Reset virtual state on each refreshOptions ───────────────────────\n\n\tself.hook('before', 'refreshOptions', () => {\n\t\tself.settings.maxOptions = page_size;\n\t});\n\n\tself.hook('after', 'refreshOptions', () => {\n\t\tflat_list = buildFlatList();\n\t\tvisible_start = 0;\n\t\tvisible_end = Math.min(flat_list.length, page_size);\n\t\tis_loading = false;\n\t\tif (raf_id !== null) {\n\t\t\tcancelAnimationFrame(raf_id);\n\t\t\traf_id = null;\n\t\t}\n\n\t\t// Re-render first page from flat_list to keep DOM in sync.\n\t\t// refreshOptions may render items in optgroup wrappers or a different\n\t\t// order than our flat list; clearing and re-rendering ensures consistency.\n\t\tif (dropdown_content && flat_list.length > 0) {\n\t\t\tdropdown_content.innerHTML = '';\n\t\t\tconst first_page = renderRange(0, visible_end);\n\t\t\tfor (const el of first_page) dropdown_content.append(el);\n\t\t\t// Re-apply highlights: the core applied them before we cleared the DOM,\n\t\t\t// and items from optgroup expansion never went through the core highlight pass.\n\t\t\tapplyHighlights(dropdown_content);\n\t\t}\n\n\t\tupdateSentinel();\n\t});\n\n\t// ─── Initialize: set templates and attach scroll listener ────────────\n\n\tself.on('initialize', () => {\n\t\tdropdown_content = self.dropdown_content;\n\t\t// Disable overflow-anchor so the browser doesn't auto-compensate scrollTop\n\t\t// when we insert/remove items — we handle the compensation manually.\n\t\t(dropdown_content.style as any)['overflow-anchor'] = 'none';\n\n\t\tself.settings.render = Object.assign(\n\t\t\t{},\n\t\t\t{\n\t\t\t\tloading_more: () =>\n\t\t\t\t\t'<div class=\"loading-more-results\">Carregando mais resultados...</div>',\n\t\t\t},\n\t\t\tself.settings.render,\n\t\t);\n\n\t\tdropdown_content.addEventListener('scroll', () => {\n\t\t\tif (skip_programmatic) {\n\t\t\t\tskip_programmatic = false;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (raf_id !== null) cancelAnimationFrame(raf_id);\n\t\t\traf_id = requestAnimationFrame(() => {\n\t\t\t\traf_id = null;\n\t\t\t\thandleScroll();\n\t\t\t});\n\t\t});\n\t});\n}\n"],"names":["replaceNode","existing","replacement","parentNode","replaceChild","highlight","element","regex","length","RegExp","highlightText","node","match","data","spannode","document","createElement","className","middlebit","splitText","index","middleclone","cloneNode","appendChild","highlightChildren","nodeType","childNodes","test","tagName","Array","from","forEach","highlightRecursive","removeHighlight","el","elements","querySelectorAll","prototype","call","parent","firstChild","normalize","userOptions","_userOptions$pageSize","_userOptions$maxDomIt","_userOptions$scrollTh","self","page_size","pageSize","max_dom","maxDomItems","threshold","scrollThreshold","dropdown_content","flat_list","visible_start","visible_end","is_loading","sentinel","raf_id","skip_programmatic","settings","maxOptions","buildFlatList","flat","results","search","lastValue","og_field","optgroupField","og_label_field","optgroupLabelField","query","trim","toLowerCase","getOg","option","_og$","og","isArray","String","matching_og_labels","Set","key","Object","keys","optgroups","label","includes","add","group_order","group_items","Map","item","items","options","id","has","set","push","get","size","ids","type","optgroup","renderFlatItem","_item$el","render","getOption","applyHighlights","currentResults","tokens","tok","measureHeight","reduce","h","_el$offsetHeight","offsetHeight","updateSentinel","remove","append","renderRange","to","els","i","setScrollTop","value","scrollTop","loadNext","pages","Math","min","new_els","dom_count","n","remove_els","removed_h","loadPrev","max","first_child","insertBefore","handleScroll","scrollHeight","clientHeight","pct_bottom","pct_top","hook","cancelAnimationFrame","innerHTML","first_page","on","style","assign","loading_more","addEventListener","requestAnimationFrame"],"mappings":";;;;;;;;;;;CA4MA;CACA;CACA;CACO,MAAMA,WAAW,GAAGA,CAAEC,QAAa,EAAEC,WAAgB,KAAM;CACjE,EAAA,IAAID,QAA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2.5.2
|
|
2
|
+
* Tom Select v2.5.2-virtual-scroll.1
|
|
3
3
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
*/
|
|
5
5
|
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).TomSelect=e()}(this,function(){"use strict"
|