@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,293 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Plugin: "local_virtual_scroll" (Tom Select)
|
|
4
|
+
* Copyright (c) contributors
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
|
|
7
|
+
* file except in compliance with the License. You may obtain a copy of the License at:
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Virtual scroll for locally-loaded (non-AJAX) datasets.
|
|
11
|
+
* Maintains a sliding DOM window of pageSize * 3 items maximum.
|
|
12
|
+
* Supports optGroups via a flat list with interleaved headers.
|
|
13
|
+
*
|
|
14
|
+
* When the search query matches an optGroup label, all children of that
|
|
15
|
+
* group are included in the results — even if the individual options don't
|
|
16
|
+
* match the query text.
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.default = default_1;
|
|
20
|
+
const highlight_ts_1 = require("../../contrib/highlight.js");
|
|
21
|
+
function default_1(userOptions) {
|
|
22
|
+
var _a, _b, _c;
|
|
23
|
+
const self = this;
|
|
24
|
+
const page_size = (_a = userOptions === null || userOptions === void 0 ? void 0 : userOptions.pageSize) !== null && _a !== void 0 ? _a : 50;
|
|
25
|
+
const max_dom = (_b = userOptions === null || userOptions === void 0 ? void 0 : userOptions.maxDomItems) !== null && _b !== void 0 ? _b : page_size * 3;
|
|
26
|
+
const threshold = (_c = userOptions === null || userOptions === void 0 ? void 0 : userOptions.scrollThreshold) !== null && _c !== void 0 ? _c : 0.9;
|
|
27
|
+
let dropdown_content;
|
|
28
|
+
let flat_list = [];
|
|
29
|
+
let visible_start = 0;
|
|
30
|
+
let visible_end = 0;
|
|
31
|
+
let is_loading = false;
|
|
32
|
+
let sentinel = null;
|
|
33
|
+
// RAF handle + flag to skip the scroll event caused by our own scrollTop writes
|
|
34
|
+
let raf_id = null;
|
|
35
|
+
let skip_programmatic = false;
|
|
36
|
+
// Plugin controls maxOptions (first page only; we manage the rest)
|
|
37
|
+
self.settings.maxOptions = page_size;
|
|
38
|
+
// ─── Build flat list: Sifter results + optgroup headers interleaved ───
|
|
39
|
+
//
|
|
40
|
+
// When the query matches an optGroup label, ALL options from that group
|
|
41
|
+
// are included regardless of whether the individual option text matches.
|
|
42
|
+
const buildFlatList = () => {
|
|
43
|
+
const flat = [];
|
|
44
|
+
const results = self.search(self.lastValue);
|
|
45
|
+
const og_field = self.settings.optgroupField;
|
|
46
|
+
const og_label_field = self.settings.optgroupLabelField || 'label';
|
|
47
|
+
const query = (self.lastValue || '').trim().toLowerCase();
|
|
48
|
+
// Helper: extract first optgroup value from an option
|
|
49
|
+
const getOg = (option) => {
|
|
50
|
+
var _a;
|
|
51
|
+
let og = option[og_field] || '';
|
|
52
|
+
if (Array.isArray(og))
|
|
53
|
+
og = (_a = og[0]) !== null && _a !== void 0 ? _a : '';
|
|
54
|
+
return String(og);
|
|
55
|
+
};
|
|
56
|
+
// Find optgroups whose label matches the query
|
|
57
|
+
const matching_og_labels = new Set();
|
|
58
|
+
if (query) {
|
|
59
|
+
for (const key of Object.keys(self.optgroups)) {
|
|
60
|
+
const label = String(self.optgroups[key][og_label_field] || '').toLowerCase();
|
|
61
|
+
if (label.includes(query))
|
|
62
|
+
matching_og_labels.add(key);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
// Build ordered groups + their item sets from Sifter results
|
|
66
|
+
const group_order = [];
|
|
67
|
+
const group_items = new Map();
|
|
68
|
+
for (const item of results.items) {
|
|
69
|
+
const option = self.options[item.id];
|
|
70
|
+
if (!option)
|
|
71
|
+
continue;
|
|
72
|
+
const og = getOg(option);
|
|
73
|
+
if (!group_items.has(og)) {
|
|
74
|
+
group_items.set(og, new Set());
|
|
75
|
+
group_order.push(og);
|
|
76
|
+
}
|
|
77
|
+
group_items.get(og).add(String(item.id));
|
|
78
|
+
}
|
|
79
|
+
// Ensure matching optgroups appear in group_order (even with no Sifter hits)
|
|
80
|
+
for (const og of matching_og_labels) {
|
|
81
|
+
if (!group_items.has(og)) {
|
|
82
|
+
group_items.set(og, new Set());
|
|
83
|
+
group_order.push(og);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
// Expand matching optgroups: add ALL their options (Set deduplicates)
|
|
87
|
+
if (matching_og_labels.size > 0) {
|
|
88
|
+
for (const id of Object.keys(self.options)) {
|
|
89
|
+
const option = self.options[id];
|
|
90
|
+
const og = getOg(option);
|
|
91
|
+
if (matching_og_labels.has(og)) {
|
|
92
|
+
group_items.get(og).add(id);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
// Emit flat list in group order
|
|
97
|
+
for (const og of group_order) {
|
|
98
|
+
const ids = group_items.get(og);
|
|
99
|
+
if (ids.size === 0)
|
|
100
|
+
continue;
|
|
101
|
+
if (og && self.optgroups[og]) {
|
|
102
|
+
flat.push({ type: 'header', optgroup: og });
|
|
103
|
+
}
|
|
104
|
+
for (const id of ids) {
|
|
105
|
+
flat.push({ type: 'option', id, optgroup: og });
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return flat;
|
|
109
|
+
};
|
|
110
|
+
// ─── Render a single flat item to its DOM element ─────────────────────
|
|
111
|
+
const renderFlatItem = (item) => {
|
|
112
|
+
var _a;
|
|
113
|
+
if (item.type === 'header') {
|
|
114
|
+
if (!item.el) {
|
|
115
|
+
item.el = self.render('optgroup_header', self.optgroups[item.optgroup]);
|
|
116
|
+
}
|
|
117
|
+
return (_a = item.el) !== null && _a !== void 0 ? _a : null;
|
|
118
|
+
}
|
|
119
|
+
return self.getOption(item.id, true);
|
|
120
|
+
};
|
|
121
|
+
// ─── Re-apply search highlights to an element ─────────────────────────
|
|
122
|
+
const applyHighlights = (el) => {
|
|
123
|
+
if (!self.settings.highlight)
|
|
124
|
+
return;
|
|
125
|
+
(0, highlight_ts_1.removeHighlight)(el);
|
|
126
|
+
const results = self.currentResults;
|
|
127
|
+
if (results && results.query.length && results.tokens.length) {
|
|
128
|
+
for (const tok of results.tokens) {
|
|
129
|
+
if (tok.regex)
|
|
130
|
+
(0, highlight_ts_1.highlight)(el, tok.regex);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
// ─── Helpers ─────────────────────────────────────────────────────────
|
|
135
|
+
const measureHeight = (elements) => elements.reduce((h, el) => { var _a; return h + ((_a = el.offsetHeight) !== null && _a !== void 0 ? _a : 0); }, 0);
|
|
136
|
+
const updateSentinel = () => {
|
|
137
|
+
// dropdown_content is set only after 'initialize' fires;
|
|
138
|
+
// refreshOptions runs during construction before that — skip silently.
|
|
139
|
+
if (!dropdown_content)
|
|
140
|
+
return;
|
|
141
|
+
if (sentinel) {
|
|
142
|
+
sentinel.remove();
|
|
143
|
+
sentinel = null;
|
|
144
|
+
}
|
|
145
|
+
if (visible_end < flat_list.length) {
|
|
146
|
+
sentinel = self.render('loading_more', {});
|
|
147
|
+
if (sentinel)
|
|
148
|
+
dropdown_content.append(sentinel);
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
const renderRange = (from, to) => {
|
|
152
|
+
const els = [];
|
|
153
|
+
for (let i = from; i < to; i++) {
|
|
154
|
+
const item = flat_list[i];
|
|
155
|
+
if (!item)
|
|
156
|
+
continue;
|
|
157
|
+
const el = renderFlatItem(item);
|
|
158
|
+
if (el)
|
|
159
|
+
els.push(el);
|
|
160
|
+
}
|
|
161
|
+
return els;
|
|
162
|
+
};
|
|
163
|
+
/** Write scrollTop without triggering our own scroll handler logic */
|
|
164
|
+
const setScrollTop = (value) => {
|
|
165
|
+
skip_programmatic = true;
|
|
166
|
+
dropdown_content.scrollTop = value;
|
|
167
|
+
};
|
|
168
|
+
// ─── Load N pages forward (scroll down) ──────────────────────────────
|
|
169
|
+
const loadNext = (pages) => {
|
|
170
|
+
if (is_loading || visible_end >= flat_list.length)
|
|
171
|
+
return;
|
|
172
|
+
is_loading = true;
|
|
173
|
+
if (sentinel) {
|
|
174
|
+
sentinel.remove();
|
|
175
|
+
sentinel = null;
|
|
176
|
+
}
|
|
177
|
+
const from = visible_end;
|
|
178
|
+
const to = Math.min(flat_list.length, visible_end + page_size * pages);
|
|
179
|
+
const new_els = renderRange(from, to);
|
|
180
|
+
for (const el of new_els)
|
|
181
|
+
dropdown_content.append(el);
|
|
182
|
+
for (const el of new_els)
|
|
183
|
+
applyHighlights(el);
|
|
184
|
+
visible_end = to;
|
|
185
|
+
// Recycle items from top to stay within max_dom
|
|
186
|
+
const dom_count = visible_end - visible_start;
|
|
187
|
+
if (dom_count > max_dom) {
|
|
188
|
+
const n = dom_count - max_dom;
|
|
189
|
+
const remove_els = renderRange(visible_start, visible_start + n);
|
|
190
|
+
const removed_h = measureHeight(remove_els);
|
|
191
|
+
for (const el of remove_els)
|
|
192
|
+
el.remove();
|
|
193
|
+
visible_start += n;
|
|
194
|
+
setScrollTop(dropdown_content.scrollTop + removed_h);
|
|
195
|
+
}
|
|
196
|
+
is_loading = false;
|
|
197
|
+
updateSentinel();
|
|
198
|
+
};
|
|
199
|
+
// ─── Load N pages backward (scroll up) ───────────────────────────────
|
|
200
|
+
const loadPrev = (pages) => {
|
|
201
|
+
if (is_loading || visible_start <= 0)
|
|
202
|
+
return;
|
|
203
|
+
is_loading = true;
|
|
204
|
+
const from = Math.max(0, visible_start - page_size * pages);
|
|
205
|
+
const to = visible_start;
|
|
206
|
+
const new_els = renderRange(from, to);
|
|
207
|
+
// Prepend before current first child
|
|
208
|
+
const first_child = dropdown_content.firstChild;
|
|
209
|
+
for (const el of new_els)
|
|
210
|
+
dropdown_content.insertBefore(el, first_child);
|
|
211
|
+
for (const el of new_els)
|
|
212
|
+
applyHighlights(el);
|
|
213
|
+
// Compensate scrollTop so existing content stays in place
|
|
214
|
+
setScrollTop(dropdown_content.scrollTop + measureHeight(new_els));
|
|
215
|
+
visible_start = from;
|
|
216
|
+
// Recycle items from bottom to stay within max_dom
|
|
217
|
+
const dom_count = visible_end - visible_start;
|
|
218
|
+
if (dom_count > max_dom) {
|
|
219
|
+
const n = dom_count - max_dom;
|
|
220
|
+
const remove_els = renderRange(visible_end - n, visible_end);
|
|
221
|
+
for (const el of remove_els)
|
|
222
|
+
el.remove();
|
|
223
|
+
visible_end -= n;
|
|
224
|
+
}
|
|
225
|
+
is_loading = false;
|
|
226
|
+
updateSentinel();
|
|
227
|
+
};
|
|
228
|
+
// ─── Scroll handler with RAF debounce ─────────────────────────────────
|
|
229
|
+
const handleScroll = () => {
|
|
230
|
+
const { scrollTop, scrollHeight, clientHeight } = dropdown_content;
|
|
231
|
+
const pct_bottom = (scrollTop + clientHeight) / scrollHeight;
|
|
232
|
+
const pct_top = scrollTop / scrollHeight;
|
|
233
|
+
// Always load exactly 1 page per RAF frame.
|
|
234
|
+
// The RAF debounce already coalesces rapid scroll events, so there is no
|
|
235
|
+
// need to load multiple pages at once — that only causes long DOM operations.
|
|
236
|
+
if (pct_bottom >= threshold) {
|
|
237
|
+
loadNext(1);
|
|
238
|
+
}
|
|
239
|
+
else if (pct_top <= 1 - threshold) {
|
|
240
|
+
loadPrev(1);
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
// ─── Reset virtual state on each refreshOptions ───────────────────────
|
|
244
|
+
self.hook('before', 'refreshOptions', () => {
|
|
245
|
+
self.settings.maxOptions = page_size;
|
|
246
|
+
});
|
|
247
|
+
self.hook('after', 'refreshOptions', () => {
|
|
248
|
+
flat_list = buildFlatList();
|
|
249
|
+
visible_start = 0;
|
|
250
|
+
visible_end = Math.min(flat_list.length, page_size);
|
|
251
|
+
is_loading = false;
|
|
252
|
+
if (raf_id !== null) {
|
|
253
|
+
cancelAnimationFrame(raf_id);
|
|
254
|
+
raf_id = null;
|
|
255
|
+
}
|
|
256
|
+
// Re-render first page from flat_list to keep DOM in sync.
|
|
257
|
+
// refreshOptions may render items in optgroup wrappers or a different
|
|
258
|
+
// order than our flat list; clearing and re-rendering ensures consistency.
|
|
259
|
+
if (dropdown_content && flat_list.length > 0) {
|
|
260
|
+
dropdown_content.innerHTML = '';
|
|
261
|
+
const first_page = renderRange(0, visible_end);
|
|
262
|
+
for (const el of first_page)
|
|
263
|
+
dropdown_content.append(el);
|
|
264
|
+
// Re-apply highlights: the core applied them before we cleared the DOM,
|
|
265
|
+
// and items from optgroup expansion never went through the core highlight pass.
|
|
266
|
+
applyHighlights(dropdown_content);
|
|
267
|
+
}
|
|
268
|
+
updateSentinel();
|
|
269
|
+
});
|
|
270
|
+
// ─── Initialize: set templates and attach scroll listener ────────────
|
|
271
|
+
self.on('initialize', () => {
|
|
272
|
+
dropdown_content = self.dropdown_content;
|
|
273
|
+
// Disable overflow-anchor so the browser doesn't auto-compensate scrollTop
|
|
274
|
+
// when we insert/remove items — we handle the compensation manually.
|
|
275
|
+
dropdown_content.style['overflow-anchor'] = 'none';
|
|
276
|
+
self.settings.render = Object.assign({}, {
|
|
277
|
+
loading_more: () => '<div class="loading-more-results">Carregando mais resultados...</div>',
|
|
278
|
+
}, self.settings.render);
|
|
279
|
+
dropdown_content.addEventListener('scroll', () => {
|
|
280
|
+
if (skip_programmatic) {
|
|
281
|
+
skip_programmatic = false;
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
if (raf_id !== null)
|
|
285
|
+
cancelAnimationFrame(raf_id);
|
|
286
|
+
raf_id = requestAnimationFrame(() => {
|
|
287
|
+
raf_id = null;
|
|
288
|
+
handleScroll();
|
|
289
|
+
});
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../../src/plugins/local_virtual_scroll/plugin.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;AAMH,4BAkTC;AApTD,6DAAwE;AAExE,mBAA0C,WAAuB;;IA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AI,UAAU;gBAAE,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YACzD,wEAAwE;YACxE,gFAAgF;YAChF,eAAe,CAAC,gBAAgB,CAAC,CAAC;QACnC,CAAC;QAED,cAAc,EAAE,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,wEAAwE;IAExE,IAAI,CAAC,EAAE,CAAC,YAAY,EAAE,GAAG,EAAE;QAC1B,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,CAAC;QACzC,2EAA2E;QAC3E,qEAAqE;QACpE,gBAAgB,CAAC,KAAa,CAAC,iBAAiB,CAAC,GAAG,MAAM,CAAC;QAE5D,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CACnC,EAAE,EACF;YACC,YAAY,EAAE,GAAG,EAAE,CAClB,uEAAuE;SACxE,EACD,IAAI,CAAC,QAAQ,CAAC,MAAM,CACpB,CAAC;QAEF,gBAAgB,CAAC,gBAAgB,CAAC,QAAQ,EAAE,GAAG,EAAE;YAChD,IAAI,iBAAiB,EAAE,CAAC;gBACvB,iBAAiB,GAAG,KAAK,CAAC;gBAC1B,OAAO;YACR,CAAC;YACD,IAAI,MAAM,KAAK,IAAI;gBAAE,oBAAoB,CAAC,MAAM,CAAC,CAAC;YAClD,MAAM,GAAG,qBAAqB,CAAC,GAAG,EAAE;gBACnC,MAAM,GAAG,IAAI,CAAC;gBACd,YAAY,EAAE,CAAC;YAChB,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/plugins/local_virtual_scroll/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Plugin: "no_active_items" (Tom Select)
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
|
|
6
|
+
* file except in compliance with the License. You may obtain a copy of the License at:
|
|
7
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
10
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
|
11
|
+
* ANY KIND, either express or implied. See the License for the specific language
|
|
12
|
+
* governing permissions and limitations under the License.
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.default = default_1;
|
|
17
|
+
function default_1() {
|
|
18
|
+
this.hook('instead', 'setActiveItem', () => { });
|
|
19
|
+
this.hook('instead', 'selectAll', () => { });
|
|
20
|
+
}
|
|
21
|
+
;
|
|
22
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../../src/plugins/no_active_items/plugin.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;AAIH,4BAGC;AAHD;IACC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAC,eAAe,EAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IAC9C,IAAI,CAAC,IAAI,CAAC,SAAS,EAAC,WAAW,EAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;AAC3C,CAAC;AAAA,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Plugin: "input_autogrow" (Tom Select)
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
|
|
6
|
+
* file except in compliance with the License. You may obtain a copy of the License at:
|
|
7
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
10
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
|
11
|
+
* ANY KIND, either express or implied. See the License for the specific language
|
|
12
|
+
* governing permissions and limitations under the License.
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.default = default_1;
|
|
17
|
+
function default_1() {
|
|
18
|
+
var self = this;
|
|
19
|
+
var orig_deleteSelection = self.deleteSelection;
|
|
20
|
+
this.hook('instead', 'deleteSelection', (evt) => {
|
|
21
|
+
if (self.activeItems.length) {
|
|
22
|
+
return orig_deleteSelection.call(self, evt);
|
|
23
|
+
}
|
|
24
|
+
return false;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
;
|
|
28
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../../src/plugins/no_backspace_delete/plugin.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;AAIH,4BAaC;AAbD;IACC,IAAI,IAAI,GAAG,IAAI,CAAC;IAChB,IAAI,oBAAoB,GAAG,IAAI,CAAC,eAAe,CAAC;IAEhD,IAAI,CAAC,IAAI,CAAC,SAAS,EAAC,iBAAiB,EAAC,CAAC,GAAiB,EAAE,EAAE;QAE3D,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC;YAC7B,OAAO,oBAAoB,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QAC7C,CAAC;QAED,OAAO,KAAK,CAAC;IACd,CAAC,CAAC,CAAC;AAEJ,CAAC;AAAA,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Plugin: "optgroup_columns" (Tom Select.js)
|
|
4
|
+
* Copyright (c) contributors
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
|
|
7
|
+
* file except in compliance with the License. You may obtain a copy of the License at:
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
11
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
|
12
|
+
* ANY KIND, either express or implied. See the License for the specific language
|
|
13
|
+
* governing permissions and limitations under the License.
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.default = default_1;
|
|
18
|
+
const constants = require("../../constants.js");
|
|
19
|
+
const vanilla_ts_1 = require("../../vanilla.js");
|
|
20
|
+
function default_1() {
|
|
21
|
+
var self = this;
|
|
22
|
+
var orig_keydown = self.onKeyDown;
|
|
23
|
+
self.hook('instead', 'onKeyDown', (evt) => {
|
|
24
|
+
var index, option, options, optgroup;
|
|
25
|
+
if (!self.isOpen || !(evt.keyCode === constants.KEY_LEFT || evt.keyCode === constants.KEY_RIGHT)) {
|
|
26
|
+
return orig_keydown.call(self, evt);
|
|
27
|
+
}
|
|
28
|
+
self.ignoreHover = true;
|
|
29
|
+
optgroup = (0, vanilla_ts_1.parentMatch)(self.activeOption, '[data-group]');
|
|
30
|
+
index = (0, vanilla_ts_1.nodeIndex)(self.activeOption, '[data-selectable]');
|
|
31
|
+
if (!optgroup) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (evt.keyCode === constants.KEY_LEFT) {
|
|
35
|
+
optgroup = optgroup.previousSibling;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
optgroup = optgroup.nextSibling;
|
|
39
|
+
}
|
|
40
|
+
if (!optgroup) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
options = optgroup.querySelectorAll('[data-selectable]');
|
|
44
|
+
option = options[Math.min(options.length - 1, index)];
|
|
45
|
+
if (option) {
|
|
46
|
+
self.setActiveOption(option);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
;
|
|
51
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../../src/plugins/optgroup_columns/plugin.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;AAMH,4BAuCC;AA1CD,gDAAgD;AAChD,iDAA0D;AAE1D;IACC,IAAI,IAAI,GAAG,IAAI,CAAC;IAEhB,IAAI,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC;IAElC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAC,WAAW,EAAC,CAAC,GAAiB,EAAC,EAAE;QACpD,IAAI,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC;QAErC,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC,QAAQ,IAAI,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC;YAClG,OAAO,YAAY,CAAC,IAAI,CAAC,IAAI,EAAC,GAAG,CAAC,CAAC;QACpC,CAAC;QAED,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,QAAQ,GAAK,IAAA,wBAAW,EAAC,IAAI,CAAC,YAAY,EAAC,cAAc,CAAC,CAAC;QAC3D,KAAK,GAAM,IAAA,sBAAS,EAAC,IAAI,CAAC,YAAY,EAAC,mBAAmB,CAAC,CAAC;QAE5D,IAAI,CAAC,QAAQ,EAAE,CAAC;YACf,OAAO;QACR,CAAC;QAED,IAAI,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC,QAAQ,EAAE,CAAC;YACxC,QAAQ,GAAG,QAAQ,CAAC,eAAe,CAAC;QACrC,CAAC;aAAM,CAAC;YACP,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC;QACjC,CAAC;QAED,IAAI,CAAC,QAAQ,EAAE,CAAC;YACf,OAAO;QACR,CAAC;QAED,OAAO,GAA4B,QAAS,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,CAAC;QACnF,MAAM,GAAM,OAAO,CAAE,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,KAAK,CAAC,CAAiB,CAAC;QAE1E,IAAI,MAAM,EAAE,CAAC;YACZ,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;QAC9B,CAAC;IAEF,CAAC,CAAC,CAAC;AAEJ,CAAC;AAAA,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Plugin: "remove_button" (Tom Select)
|
|
4
|
+
* Copyright (c) contributors
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
|
|
7
|
+
* file except in compliance with the License. You may obtain a copy of the License at:
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
11
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
|
12
|
+
* ANY KIND, either express or implied. See the License for the specific language
|
|
13
|
+
* governing permissions and limitations under the License.
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.default = default_1;
|
|
18
|
+
const vanilla_ts_1 = require("../../vanilla.js");
|
|
19
|
+
const utils_ts_1 = require("../../utils.js");
|
|
20
|
+
function default_1(userOptions) {
|
|
21
|
+
const options = Object.assign({
|
|
22
|
+
label: '×',
|
|
23
|
+
title: 'Remove',
|
|
24
|
+
className: 'remove',
|
|
25
|
+
append: true
|
|
26
|
+
}, userOptions);
|
|
27
|
+
//options.className = 'remove-single';
|
|
28
|
+
var self = this;
|
|
29
|
+
// override the render method to add remove button to each item
|
|
30
|
+
if (!options.append) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
var html = '<a href="javascript:void(0)" class="' + options.className + '" tabindex="-1" title="' + (0, utils_ts_1.escape_html)(options.title) + '">' + options.label + '</a>';
|
|
34
|
+
self.hook('after', 'setupTemplates', () => {
|
|
35
|
+
var orig_render_item = self.settings.render.item;
|
|
36
|
+
self.settings.render.item = (data, escape) => {
|
|
37
|
+
var item = (0, vanilla_ts_1.getDom)(orig_render_item.call(self, data, escape));
|
|
38
|
+
var close_button = (0, vanilla_ts_1.getDom)(html);
|
|
39
|
+
item.appendChild(close_button);
|
|
40
|
+
(0, utils_ts_1.addEvent)(close_button, 'mousedown', (evt) => {
|
|
41
|
+
(0, utils_ts_1.preventDefault)(evt, true);
|
|
42
|
+
});
|
|
43
|
+
(0, utils_ts_1.addEvent)(close_button, 'click', (evt) => {
|
|
44
|
+
if (self.isLocked)
|
|
45
|
+
return;
|
|
46
|
+
// propagating will trigger the dropdown to show for single mode
|
|
47
|
+
(0, utils_ts_1.preventDefault)(evt, true);
|
|
48
|
+
if (self.isLocked)
|
|
49
|
+
return;
|
|
50
|
+
if (!self.shouldDelete([item], evt))
|
|
51
|
+
return;
|
|
52
|
+
self.removeItem(item);
|
|
53
|
+
self.refreshOptions(false);
|
|
54
|
+
self.inputState();
|
|
55
|
+
});
|
|
56
|
+
return item;
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
;
|
|
61
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../../src/plugins/remove_button/plugin.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;AAQH,4BAwDC;AA7DD,iDAA0C;AAC1C,6CAAuE;AAIvE,mBAAwC,WAAqB;IAE5D,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,KAA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,IAAI,CAAC,CAAC;gBAEzB,IAAI,IAAI,CAAC,QAAQ;oBAAG,OAAO;gBAC3B,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,EAAC,GAAiB,CAAC;oBAAG,OAAO;gBAE1D,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;gBACtB,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;gBAC3B,IAAI,CAAC,UAAU,EAAE,CAAC;YACnB,CAAC,CAAC,CAAC;YAEH,OAAO,IAAI,CAAC;QACb,CAAC,CAAC;IAEH,CAAC,CAAC,CAAC;AAGJ,CAAC;AAAA,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/plugins/remove_button/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = default_1;
|
|
4
|
+
function default_1(userOptions) {
|
|
5
|
+
const self = this;
|
|
6
|
+
const options = Object.assign({
|
|
7
|
+
text: (option) => {
|
|
8
|
+
return option[self.settings.labelField];
|
|
9
|
+
}
|
|
10
|
+
}, userOptions);
|
|
11
|
+
self.on('item_remove', function (value) {
|
|
12
|
+
if (!self.isFocused) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (self.control_input.value.trim() === '') {
|
|
16
|
+
var option = self.options[value];
|
|
17
|
+
if (option) {
|
|
18
|
+
self.setTextboxValue(options.text.call(self, option));
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
;
|
|
24
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../../src/plugins/restore_on_backspace/plugin.ts"],"names":[],"mappings":";;AAqBA,4BAsBC;AAtBD,mBAAwC,WAA0B;IACjE,MAAM,IAAI,GAAG,IAAI,CAAC;IAElB,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC;QAC7B,IAAI,EAAE,CAAC,MAAgB,EAAE,EAAE;YAC1B,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QACzC,CAAC;KACD,EAAC,WAAW,CAAC,CAAC;IAEf,IAAI,CAAC,EAAE,CAAC,aAAa,EAAC,UAAS,KAAY;QAC1C,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YACrB,OAAO;QACR,CAAC;QAED,IAAI,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YAC5C,IAAI,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YACjC,IAAI,MAAM,EAAE,CAAC;gBACZ,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;YACvD,CAAC;QACF,CAAC;IACF,CAAC,CAAC,CAAC;AAEJ,CAAC;AAAA,CAAC"}
|