1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,153 @@ |
1 |
+/** |
|
2 |
+* Tom Select v2.2.2 |
|
3 |
+* Licensed under the Apache License, Version 2.0 (the "License"); |
|
4 |
+*/ |
|
5 |
+ |
|
6 |
+(function (global, factory) { |
|
7 |
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : |
|
8 |
+ typeof define === 'function' && define.amd ? define(factory) : |
|
9 |
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.clear_button = factory()); |
|
10 |
+})(this, (function () { 'use strict'; |
|
11 |
+ |
|
12 |
+ /*! @orchidjs/unicode-variants | https://github.com/orchidjs/unicode-variants | Apache License (v2) */ |
|
13 |
+ const accent_pat = '[\u0300-\u036F\u{b7}\u{2be}\u{2bc}]'; |
|
14 |
+ /** @type {TUnicodeMap} */ |
|
15 |
+ |
|
16 |
+ const latin_convert = {}; |
|
17 |
+ /** @type {TUnicodeMap} */ |
|
18 |
+ |
|
19 |
+ const latin_condensed = { |
|
20 |
+ '/': '⁄∕', |
|
21 |
+ '0': '߀', |
|
22 |
+ "a": "ⱥɐɑ", |
|
23 |
+ "aa": "ꜳ", |
|
24 |
+ "ae": "æǽǣ", |
|
25 |
+ "ao": "ꜵ", |
|
26 |
+ "au": "ꜷ", |
|
27 |
+ "av": "ꜹꜻ", |
|
28 |
+ "ay": "ꜽ", |
|
29 |
+ "b": "ƀɓƃ", |
|
30 |
+ "c": "ꜿƈȼↄ", |
|
31 |
+ "d": "đɗɖᴅƌꮷԁɦ", |
|
32 |
+ "e": "ɛǝᴇɇ", |
|
33 |
+ "f": "ꝼƒ", |
|
34 |
+ "g": "ǥɠꞡᵹꝿɢ", |
|
35 |
+ "h": "ħⱨⱶɥ", |
|
36 |
+ "i": "ɨı", |
|
37 |
+ "j": "ɉȷ", |
|
38 |
+ "k": "ƙⱪꝁꝃꝅꞣ", |
|
39 |
+ "l": "łƚɫⱡꝉꝇꞁɭ", |
|
40 |
+ "m": "ɱɯϻ", |
|
41 |
+ "n": "ꞥƞɲꞑᴎлԉ", |
|
42 |
+ "o": "øǿɔɵꝋꝍᴑ", |
|
43 |
+ "oe": "œ", |
|
44 |
+ "oi": "ƣ", |
|
45 |
+ "oo": "ꝏ", |
|
46 |
+ "ou": "ȣ", |
|
47 |
+ "p": "ƥᵽꝑꝓꝕρ", |
|
48 |
+ "q": "ꝗꝙɋ", |
|
49 |
+ "r": "ɍɽꝛꞧꞃ", |
|
50 |
+ "s": "ßȿꞩꞅʂ", |
|
51 |
+ "t": "ŧƭʈⱦꞇ", |
|
52 |
+ "th": "þ", |
|
53 |
+ "tz": "ꜩ", |
|
54 |
+ "u": "ʉ", |
|
55 |
+ "v": "ʋꝟʌ", |
|
56 |
+ "vy": "ꝡ", |
|
57 |
+ "w": "ⱳ", |
|
58 |
+ "y": "ƴɏỿ", |
|
59 |
+ "z": "ƶȥɀⱬꝣ", |
|
60 |
+ "hv": "ƕ" |
|
61 |
+ }; |
|
62 |
+ |
|
63 |
+ for (let latin in latin_condensed) { |
|
64 |
+ let unicode = latin_condensed[latin] || ''; |
|
65 |
+ |
|
66 |
+ for (let i = 0; i < unicode.length; i++) { |
|
67 |
+ let char = unicode.substring(i, i + 1); |
|
68 |
+ latin_convert[char] = latin; |
|
69 |
+ } |
|
70 |
+ } |
|
71 |
+ |
|
72 |
+ new RegExp(Object.keys(latin_convert).join('|') + '|' + accent_pat, 'gu'); |
|
73 |
+ |
|
74 |
+ /** |
|
75 |
+ * Return a dom element from either a dom query string, jQuery object, a dom element or html string |
|
76 |
+ * https://stackoverflow.com/questions/494143/creating-a-new-dom-element-from-an-html-string-using-built-in-dom-methods-or-pro/35385518#35385518 |
|
77 |
+ * |
|
78 |
+ * param query should be {} |
|
79 |
+ */ |
|
80 |
+ |
|
81 |
+ const getDom = query => { |
|
82 |
+ if (query.jquery) { |
|
83 |
+ return query[0]; |
|
84 |
+ } |
|
85 |
+ |
|
86 |
+ if (query instanceof HTMLElement) { |
|
87 |
+ return query; |
|
88 |
+ } |
|
89 |
+ |
|
90 |
+ if (isHtmlString(query)) { |
|
91 |
+ var tpl = document.createElement('template'); |
|
92 |
+ tpl.innerHTML = query.trim(); // Never return a text node of whitespace as the result |
|
93 |
+ |
|
94 |
+ return tpl.content.firstChild; |
|
95 |
+ } |
|
96 |
+ |
|
97 |
+ return document.querySelector(query); |
|
98 |
+ }; |
|
99 |
+ const isHtmlString = arg => { |
|
100 |
+ if (typeof arg === 'string' && arg.indexOf('<') > -1) { |
|
101 |
+ return true; |
|
102 |
+ } |
|
103 |
+ |
|
104 |
+ return false; |
|
105 |
+ }; |
|
106 |
+ |
|
107 |
+ /** |
|
108 |
+ * Plugin: "dropdown_header" (Tom Select) |
|
109 |
+ * Copyright (c) contributors |
|
110 |
+ * |
|
111 |
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this |
|
112 |
+ * file except in compliance with the License. You may obtain a copy of the License at: |
|
113 |
+ * http://www.apache.org/licenses/LICENSE-2.0 |
|
114 |
+ * |
|
115 |
+ * Unless required by applicable law or agreed to in writing, software distributed under |
|
116 |
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF |
|
117 |
+ * ANY KIND, either express or implied. See the License for the specific language |
|
118 |
+ * governing permissions and limitations under the License. |
|
119 |
+ * |
|
120 |
+ */ |
|
121 |
+ function plugin (userOptions) { |
|
122 |
+ const self = this; |
|
123 |
+ const options = Object.assign({ |
|
124 |
+ className: 'clear-button', |
|
125 |
+ title: 'Clear All', |
|
126 |
+ html: data => { |
|
127 |
+ return `<div class="${data.className}" title="${data.title}">⨯</div>`; |
|
128 |
+ } |
|
129 |
+ }, userOptions); |
|
130 |
+ self.on('initialize', () => { |
|
131 |
+ var button = getDom(options.html(options)); |
|
132 |
+ button.addEventListener('click', evt => { |
|
133 |
+ if (self.isDisabled) { |
|
134 |
+ return; |
|
135 |
+ } |
|
136 |
+ |
|
137 |
+ self.clear(); |
|
138 |
+ |
|
139 |
+ if (self.settings.mode === 'single' && self.settings.allowEmptyOption) { |
|
140 |
+ self.addItem(''); |
|
141 |
+ } |
|
142 |
+ |
|
143 |
+ evt.preventDefault(); |
|
144 |
+ evt.stopPropagation(); |
|
145 |
+ }); |
|
146 |
+ self.control.appendChild(button); |
|
147 |
+ }); |
|
148 |
+ } |
|
149 |
+ |
|
150 |
+ return plugin; |
|
151 |
+ |
|
152 |
+})); |
|
153 |
+//# sourceMappingURL=clear_button.js.map |