mirror of
https://github.com/getnamingo/registry.git
synced 2025-07-21 10:06:05 +02:00
Initial upload of the control panel
This commit is contained in:
parent
f21bd93fbc
commit
7eab26586c
791 changed files with 312718 additions and 0 deletions
223
cp/public/assets/libs/tom-select/dist/js/plugins/caret_position.js
vendored
Normal file
223
cp/public/assets/libs/tom-select/dist/js/plugins/caret_position.js
vendored
Normal file
|
@ -0,0 +1,223 @@
|
|||
/**
|
||||
* Tom Select v2.2.2
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
*/
|
||||
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||
typeof define === 'function' && define.amd ? define(factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.caret_position = factory());
|
||||
})(this, (function () { 'use strict';
|
||||
|
||||
/*! @orchidjs/unicode-variants | https://github.com/orchidjs/unicode-variants | Apache License (v2) */
|
||||
const accent_pat = '[\u0300-\u036F\u{b7}\u{2be}\u{2bc}]';
|
||||
/** @type {TUnicodeMap} */
|
||||
|
||||
const latin_convert = {};
|
||||
/** @type {TUnicodeMap} */
|
||||
|
||||
const latin_condensed = {
|
||||
'/': '⁄∕',
|
||||
'0': '߀',
|
||||
"a": "ⱥɐɑ",
|
||||
"aa": "ꜳ",
|
||||
"ae": "æǽǣ",
|
||||
"ao": "ꜵ",
|
||||
"au": "ꜷ",
|
||||
"av": "ꜹꜻ",
|
||||
"ay": "ꜽ",
|
||||
"b": "ƀɓƃ",
|
||||
"c": "ꜿƈȼↄ",
|
||||
"d": "đɗɖᴅƌꮷԁɦ",
|
||||
"e": "ɛǝᴇɇ",
|
||||
"f": "ꝼƒ",
|
||||
"g": "ǥɠꞡᵹꝿɢ",
|
||||
"h": "ħⱨⱶɥ",
|
||||
"i": "ɨı",
|
||||
"j": "ɉȷ",
|
||||
"k": "ƙⱪꝁꝃꝅꞣ",
|
||||
"l": "łƚɫⱡꝉꝇꞁɭ",
|
||||
"m": "ɱɯϻ",
|
||||
"n": "ꞥƞɲꞑᴎлԉ",
|
||||
"o": "øǿɔɵꝋꝍᴑ",
|
||||
"oe": "œ",
|
||||
"oi": "ƣ",
|
||||
"oo": "ꝏ",
|
||||
"ou": "ȣ",
|
||||
"p": "ƥᵽꝑꝓꝕρ",
|
||||
"q": "ꝗꝙɋ",
|
||||
"r": "ɍɽꝛꞧꞃ",
|
||||
"s": "ßȿꞩꞅʂ",
|
||||
"t": "ŧƭʈⱦꞇ",
|
||||
"th": "þ",
|
||||
"tz": "ꜩ",
|
||||
"u": "ʉ",
|
||||
"v": "ʋꝟʌ",
|
||||
"vy": "ꝡ",
|
||||
"w": "ⱳ",
|
||||
"y": "ƴɏỿ",
|
||||
"z": "ƶȥɀⱬꝣ",
|
||||
"hv": "ƕ"
|
||||
};
|
||||
|
||||
for (let latin in latin_condensed) {
|
||||
let unicode = latin_condensed[latin] || '';
|
||||
|
||||
for (let i = 0; i < unicode.length; i++) {
|
||||
let char = unicode.substring(i, i + 1);
|
||||
latin_convert[char] = latin;
|
||||
}
|
||||
}
|
||||
|
||||
new RegExp(Object.keys(latin_convert).join('|') + '|' + accent_pat, 'gu');
|
||||
|
||||
/**
|
||||
* Iterates over arrays and hashes.
|
||||
*
|
||||
* ```
|
||||
* iterate(this.items, function(item, id) {
|
||||
* // invoked for each item
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
*/
|
||||
|
||||
const iterate = (object, callback) => {
|
||||
if (Array.isArray(object)) {
|
||||
object.forEach(callback);
|
||||
} else {
|
||||
for (var key in object) {
|
||||
if (object.hasOwnProperty(key)) {
|
||||
callback(object[key], key);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Remove css classes
|
||||
*
|
||||
*/
|
||||
|
||||
const removeClasses = (elmts, ...classes) => {
|
||||
var norm_classes = classesArray(classes);
|
||||
elmts = castAsArray(elmts);
|
||||
elmts.map(el => {
|
||||
norm_classes.map(cls => {
|
||||
el.classList.remove(cls);
|
||||
});
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Return arguments
|
||||
*
|
||||
*/
|
||||
|
||||
const classesArray = args => {
|
||||
var classes = [];
|
||||
iterate(args, _classes => {
|
||||
if (typeof _classes === 'string') {
|
||||
_classes = _classes.trim().split(/[\11\12\14\15\40]/);
|
||||
}
|
||||
|
||||
if (Array.isArray(_classes)) {
|
||||
classes = classes.concat(_classes);
|
||||
}
|
||||
});
|
||||
return classes.filter(Boolean);
|
||||
};
|
||||
/**
|
||||
* Create an array from arg if it's not already an array
|
||||
*
|
||||
*/
|
||||
|
||||
const castAsArray = arg => {
|
||||
if (!Array.isArray(arg)) {
|
||||
arg = [arg];
|
||||
}
|
||||
|
||||
return arg;
|
||||
};
|
||||
/**
|
||||
* Get the index of an element amongst sibling nodes of the same type
|
||||
*
|
||||
*/
|
||||
|
||||
const nodeIndex = (el, amongst) => {
|
||||
if (!el) return -1;
|
||||
amongst = amongst || el.nodeName;
|
||||
var i = 0;
|
||||
|
||||
while (el = el.previousElementSibling) {
|
||||
if (el.matches(amongst)) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
return i;
|
||||
};
|
||||
|
||||
/**
|
||||
* Plugin: "dropdown_input" (Tom Select)
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
|
||||
* file except in compliance with the License. You may obtain a copy of the License at:
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
||||
* ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*
|
||||
*/
|
||||
function plugin () {
|
||||
var self = this;
|
||||
/**
|
||||
* Moves the caret to the specified index.
|
||||
*
|
||||
* The input must be moved by leaving it in place and moving the
|
||||
* siblings, due to the fact that focus cannot be restored once lost
|
||||
* on mobile webkit devices
|
||||
*
|
||||
*/
|
||||
|
||||
self.hook('instead', 'setCaret', new_pos => {
|
||||
if (self.settings.mode === 'single' || !self.control.contains(self.control_input)) {
|
||||
new_pos = self.items.length;
|
||||
} else {
|
||||
new_pos = Math.max(0, Math.min(self.items.length, new_pos));
|
||||
|
||||
if (new_pos != self.caretPos && !self.isPending) {
|
||||
self.controlChildren().forEach((child, j) => {
|
||||
if (j < new_pos) {
|
||||
self.control_input.insertAdjacentElement('beforebegin', child);
|
||||
} else {
|
||||
self.control.appendChild(child);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
self.caretPos = new_pos;
|
||||
});
|
||||
self.hook('instead', 'moveCaret', direction => {
|
||||
if (!self.isFocused) return; // move caret before or after selected items
|
||||
|
||||
const last_active = self.getLastActive(direction);
|
||||
|
||||
if (last_active) {
|
||||
const idx = nodeIndex(last_active);
|
||||
self.setCaret(direction > 0 ? idx + 1 : idx);
|
||||
self.setActiveItem();
|
||||
removeClasses(last_active, 'last-active'); // move caret left or right of current position
|
||||
} else {
|
||||
self.setCaret(self.caretPos + direction);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return plugin;
|
||||
|
||||
}));
|
||||
//# sourceMappingURL=caret_position.js.map
|
1
cp/public/assets/libs/tom-select/dist/js/plugins/caret_position.js.map
vendored
Normal file
1
cp/public/assets/libs/tom-select/dist/js/plugins/caret_position.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
58
cp/public/assets/libs/tom-select/dist/js/plugins/change_listener.js
vendored
Normal file
58
cp/public/assets/libs/tom-select/dist/js/plugins/change_listener.js
vendored
Normal file
|
@ -0,0 +1,58 @@
|
|||
/**
|
||||
* Tom Select v2.2.2
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
*/
|
||||
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||
typeof define === 'function' && define.amd ? define(factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.change_listener = factory());
|
||||
})(this, (function () { 'use strict';
|
||||
|
||||
/**
|
||||
* Converts a scalar to its best string representation
|
||||
* for hash keys and HTML attribute values.
|
||||
*
|
||||
* Transformations:
|
||||
* 'str' -> 'str'
|
||||
* null -> ''
|
||||
* undefined -> ''
|
||||
* true -> '1'
|
||||
* false -> '0'
|
||||
* 0 -> '0'
|
||||
* 1 -> '1'
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* Add event helper
|
||||
*
|
||||
*/
|
||||
|
||||
const addEvent = (target, type, callback, options) => {
|
||||
target.addEventListener(type, callback, options);
|
||||
};
|
||||
|
||||
/**
|
||||
* Plugin: "change_listener" (Tom Select)
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
|
||||
* file except in compliance with the License. You may obtain a copy of the License at:
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
||||
* ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*
|
||||
*/
|
||||
function plugin () {
|
||||
addEvent(this.input, 'change', () => {
|
||||
this.sync();
|
||||
});
|
||||
}
|
||||
|
||||
return plugin;
|
||||
|
||||
}));
|
||||
//# sourceMappingURL=change_listener.js.map
|
1
cp/public/assets/libs/tom-select/dist/js/plugins/change_listener.js.map
vendored
Normal file
1
cp/public/assets/libs/tom-select/dist/js/plugins/change_listener.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
236
cp/public/assets/libs/tom-select/dist/js/plugins/checkbox_options.js
vendored
Normal file
236
cp/public/assets/libs/tom-select/dist/js/plugins/checkbox_options.js
vendored
Normal file
|
@ -0,0 +1,236 @@
|
|||
/**
|
||||
* Tom Select v2.2.2
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
*/
|
||||
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||
typeof define === 'function' && define.amd ? define(factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.checkbox_options = factory());
|
||||
})(this, (function () { 'use strict';
|
||||
|
||||
/**
|
||||
* Converts a scalar to its best string representation
|
||||
* for hash keys and HTML attribute values.
|
||||
*
|
||||
* Transformations:
|
||||
* 'str' -> 'str'
|
||||
* null -> ''
|
||||
* undefined -> ''
|
||||
* true -> '1'
|
||||
* false -> '0'
|
||||
* 0 -> '0'
|
||||
* 1 -> '1'
|
||||
*
|
||||
*/
|
||||
const hash_key = value => {
|
||||
if (typeof value === 'undefined' || value === null) return null;
|
||||
return get_hash(value);
|
||||
};
|
||||
const get_hash = value => {
|
||||
if (typeof value === 'boolean') return value ? '1' : '0';
|
||||
return value + '';
|
||||
};
|
||||
/**
|
||||
* Prevent default
|
||||
*
|
||||
*/
|
||||
|
||||
const preventDefault = (evt, stop = false) => {
|
||||
if (evt) {
|
||||
evt.preventDefault();
|
||||
|
||||
if (stop) {
|
||||
evt.stopPropagation();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/*! @orchidjs/unicode-variants | https://github.com/orchidjs/unicode-variants | Apache License (v2) */
|
||||
const accent_pat = '[\u0300-\u036F\u{b7}\u{2be}\u{2bc}]';
|
||||
/** @type {TUnicodeMap} */
|
||||
|
||||
const latin_convert = {};
|
||||
/** @type {TUnicodeMap} */
|
||||
|
||||
const latin_condensed = {
|
||||
'/': '⁄∕',
|
||||
'0': '߀',
|
||||
"a": "ⱥɐɑ",
|
||||
"aa": "ꜳ",
|
||||
"ae": "æǽǣ",
|
||||
"ao": "ꜵ",
|
||||
"au": "ꜷ",
|
||||
"av": "ꜹꜻ",
|
||||
"ay": "ꜽ",
|
||||
"b": "ƀɓƃ",
|
||||
"c": "ꜿƈȼↄ",
|
||||
"d": "đɗɖᴅƌꮷԁɦ",
|
||||
"e": "ɛǝᴇɇ",
|
||||
"f": "ꝼƒ",
|
||||
"g": "ǥɠꞡᵹꝿɢ",
|
||||
"h": "ħⱨⱶɥ",
|
||||
"i": "ɨı",
|
||||
"j": "ɉȷ",
|
||||
"k": "ƙⱪꝁꝃꝅꞣ",
|
||||
"l": "łƚɫⱡꝉꝇꞁɭ",
|
||||
"m": "ɱɯϻ",
|
||||
"n": "ꞥƞɲꞑᴎлԉ",
|
||||
"o": "øǿɔɵꝋꝍᴑ",
|
||||
"oe": "œ",
|
||||
"oi": "ƣ",
|
||||
"oo": "ꝏ",
|
||||
"ou": "ȣ",
|
||||
"p": "ƥᵽꝑꝓꝕρ",
|
||||
"q": "ꝗꝙɋ",
|
||||
"r": "ɍɽꝛꞧꞃ",
|
||||
"s": "ßȿꞩꞅʂ",
|
||||
"t": "ŧƭʈⱦꞇ",
|
||||
"th": "þ",
|
||||
"tz": "ꜩ",
|
||||
"u": "ʉ",
|
||||
"v": "ʋꝟʌ",
|
||||
"vy": "ꝡ",
|
||||
"w": "ⱳ",
|
||||
"y": "ƴɏỿ",
|
||||
"z": "ƶȥɀⱬꝣ",
|
||||
"hv": "ƕ"
|
||||
};
|
||||
|
||||
for (let latin in latin_condensed) {
|
||||
let unicode = latin_condensed[latin] || '';
|
||||
|
||||
for (let i = 0; i < unicode.length; i++) {
|
||||
let char = unicode.substring(i, i + 1);
|
||||
latin_convert[char] = latin;
|
||||
}
|
||||
}
|
||||
|
||||
new RegExp(Object.keys(latin_convert).join('|') + '|' + accent_pat, 'gu');
|
||||
|
||||
/**
|
||||
* Return a dom element from either a dom query string, jQuery object, a dom element or html string
|
||||
* https://stackoverflow.com/questions/494143/creating-a-new-dom-element-from-an-html-string-using-built-in-dom-methods-or-pro/35385518#35385518
|
||||
*
|
||||
* param query should be {}
|
||||
*/
|
||||
|
||||
const getDom = query => {
|
||||
if (query.jquery) {
|
||||
return query[0];
|
||||
}
|
||||
|
||||
if (query instanceof HTMLElement) {
|
||||
return query;
|
||||
}
|
||||
|
||||
if (isHtmlString(query)) {
|
||||
var tpl = document.createElement('template');
|
||||
tpl.innerHTML = query.trim(); // Never return a text node of whitespace as the result
|
||||
|
||||
return tpl.content.firstChild;
|
||||
}
|
||||
|
||||
return document.querySelector(query);
|
||||
};
|
||||
const isHtmlString = arg => {
|
||||
if (typeof arg === 'string' && arg.indexOf('<') > -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Plugin: "restore_on_backspace" (Tom Select)
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
|
||||
* file except in compliance with the License. You may obtain a copy of the License at:
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
||||
* ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*
|
||||
*/
|
||||
function plugin () {
|
||||
var self = this;
|
||||
var orig_onOptionSelect = self.onOptionSelect;
|
||||
self.settings.hideSelected = false; // update the checkbox for an option
|
||||
|
||||
var UpdateCheckbox = function UpdateCheckbox(option) {
|
||||
setTimeout(() => {
|
||||
var checkbox = option.querySelector('input');
|
||||
|
||||
if (checkbox instanceof HTMLInputElement) {
|
||||
if (option.classList.contains('selected')) {
|
||||
checkbox.checked = true;
|
||||
} else {
|
||||
checkbox.checked = false;
|
||||
}
|
||||
}
|
||||
}, 1);
|
||||
}; // add checkbox to option template
|
||||
|
||||
|
||||
self.hook('after', 'setupTemplates', () => {
|
||||
var orig_render_option = self.settings.render.option;
|
||||
|
||||
self.settings.render.option = (data, escape_html) => {
|
||||
var rendered = getDom(orig_render_option.call(self, data, escape_html));
|
||||
var checkbox = document.createElement('input');
|
||||
checkbox.addEventListener('click', function (evt) {
|
||||
preventDefault(evt);
|
||||
});
|
||||
checkbox.type = 'checkbox';
|
||||
const hashed = hash_key(data[self.settings.valueField]);
|
||||
|
||||
if (hashed && self.items.indexOf(hashed) > -1) {
|
||||
checkbox.checked = true;
|
||||
}
|
||||
|
||||
rendered.prepend(checkbox);
|
||||
return rendered;
|
||||
};
|
||||
}); // uncheck when item removed
|
||||
|
||||
self.on('item_remove', value => {
|
||||
var option = self.getOption(value);
|
||||
|
||||
if (option) {
|
||||
// if dropdown hasn't been opened yet, the option won't exist
|
||||
option.classList.remove('selected'); // selected class won't be removed yet
|
||||
|
||||
UpdateCheckbox(option);
|
||||
}
|
||||
}); // check when item added
|
||||
|
||||
self.on('item_add', value => {
|
||||
var option = self.getOption(value);
|
||||
|
||||
if (option) {
|
||||
// if dropdown hasn't been opened yet, the option won't exist
|
||||
UpdateCheckbox(option);
|
||||
}
|
||||
}); // remove items when selected option is clicked
|
||||
|
||||
self.hook('instead', 'onOptionSelect', (evt, option) => {
|
||||
if (option.classList.contains('selected')) {
|
||||
option.classList.remove('selected');
|
||||
self.removeItem(option.dataset.value);
|
||||
self.refreshOptions();
|
||||
preventDefault(evt, true);
|
||||
return;
|
||||
}
|
||||
|
||||
orig_onOptionSelect.call(self, evt, option);
|
||||
UpdateCheckbox(option);
|
||||
});
|
||||
}
|
||||
|
||||
return plugin;
|
||||
|
||||
}));
|
||||
//# sourceMappingURL=checkbox_options.js.map
|
1
cp/public/assets/libs/tom-select/dist/js/plugins/checkbox_options.js.map
vendored
Normal file
1
cp/public/assets/libs/tom-select/dist/js/plugins/checkbox_options.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
153
cp/public/assets/libs/tom-select/dist/js/plugins/clear_button.js
vendored
Normal file
153
cp/public/assets/libs/tom-select/dist/js/plugins/clear_button.js
vendored
Normal file
|
@ -0,0 +1,153 @@
|
|||
/**
|
||||
* Tom Select v2.2.2
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
*/
|
||||
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||
typeof define === 'function' && define.amd ? define(factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.clear_button = factory());
|
||||
})(this, (function () { 'use strict';
|
||||
|
||||
/*! @orchidjs/unicode-variants | https://github.com/orchidjs/unicode-variants | Apache License (v2) */
|
||||
const accent_pat = '[\u0300-\u036F\u{b7}\u{2be}\u{2bc}]';
|
||||
/** @type {TUnicodeMap} */
|
||||
|
||||
const latin_convert = {};
|
||||
/** @type {TUnicodeMap} */
|
||||
|
||||
const latin_condensed = {
|
||||
'/': '⁄∕',
|
||||
'0': '߀',
|
||||
"a": "ⱥɐɑ",
|
||||
"aa": "ꜳ",
|
||||
"ae": "æǽǣ",
|
||||
"ao": "ꜵ",
|
||||
"au": "ꜷ",
|
||||
"av": "ꜹꜻ",
|
||||
"ay": "ꜽ",
|
||||
"b": "ƀɓƃ",
|
||||
"c": "ꜿƈȼↄ",
|
||||
"d": "đɗɖᴅƌꮷԁɦ",
|
||||
"e": "ɛǝᴇɇ",
|
||||
"f": "ꝼƒ",
|
||||
"g": "ǥɠꞡᵹꝿɢ",
|
||||
"h": "ħⱨⱶɥ",
|
||||
"i": "ɨı",
|
||||
"j": "ɉȷ",
|
||||
"k": "ƙⱪꝁꝃꝅꞣ",
|
||||
"l": "łƚɫⱡꝉꝇꞁɭ",
|
||||
"m": "ɱɯϻ",
|
||||
"n": "ꞥƞɲꞑᴎлԉ",
|
||||
"o": "øǿɔɵꝋꝍᴑ",
|
||||
"oe": "œ",
|
||||
"oi": "ƣ",
|
||||
"oo": "ꝏ",
|
||||
"ou": "ȣ",
|
||||
"p": "ƥᵽꝑꝓꝕρ",
|
||||
"q": "ꝗꝙɋ",
|
||||
"r": "ɍɽꝛꞧꞃ",
|
||||
"s": "ßȿꞩꞅʂ",
|
||||
"t": "ŧƭʈⱦꞇ",
|
||||
"th": "þ",
|
||||
"tz": "ꜩ",
|
||||
"u": "ʉ",
|
||||
"v": "ʋꝟʌ",
|
||||
"vy": "ꝡ",
|
||||
"w": "ⱳ",
|
||||
"y": "ƴɏỿ",
|
||||
"z": "ƶȥɀⱬꝣ",
|
||||
"hv": "ƕ"
|
||||
};
|
||||
|
||||
for (let latin in latin_condensed) {
|
||||
let unicode = latin_condensed[latin] || '';
|
||||
|
||||
for (let i = 0; i < unicode.length; i++) {
|
||||
let char = unicode.substring(i, i + 1);
|
||||
latin_convert[char] = latin;
|
||||
}
|
||||
}
|
||||
|
||||
new RegExp(Object.keys(latin_convert).join('|') + '|' + accent_pat, 'gu');
|
||||
|
||||
/**
|
||||
* Return a dom element from either a dom query string, jQuery object, a dom element or html string
|
||||
* https://stackoverflow.com/questions/494143/creating-a-new-dom-element-from-an-html-string-using-built-in-dom-methods-or-pro/35385518#35385518
|
||||
*
|
||||
* param query should be {}
|
||||
*/
|
||||
|
||||
const getDom = query => {
|
||||
if (query.jquery) {
|
||||
return query[0];
|
||||
}
|
||||
|
||||
if (query instanceof HTMLElement) {
|
||||
return query;
|
||||
}
|
||||
|
||||
if (isHtmlString(query)) {
|
||||
var tpl = document.createElement('template');
|
||||
tpl.innerHTML = query.trim(); // Never return a text node of whitespace as the result
|
||||
|
||||
return tpl.content.firstChild;
|
||||
}
|
||||
|
||||
return document.querySelector(query);
|
||||
};
|
||||
const isHtmlString = arg => {
|
||||
if (typeof arg === 'string' && arg.indexOf('<') > -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Plugin: "dropdown_header" (Tom Select)
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
|
||||
* file except in compliance with the License. You may obtain a copy of the License at:
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
||||
* ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*
|
||||
*/
|
||||
function plugin (userOptions) {
|
||||
const self = this;
|
||||
const options = Object.assign({
|
||||
className: 'clear-button',
|
||||
title: 'Clear All',
|
||||
html: data => {
|
||||
return `<div class="${data.className}" title="${data.title}">⨯</div>`;
|
||||
}
|
||||
}, userOptions);
|
||||
self.on('initialize', () => {
|
||||
var button = getDom(options.html(options));
|
||||
button.addEventListener('click', evt => {
|
||||
if (self.isDisabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
self.clear();
|
||||
|
||||
if (self.settings.mode === 'single' && self.settings.allowEmptyOption) {
|
||||
self.addItem('');
|
||||
}
|
||||
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
});
|
||||
self.control.appendChild(button);
|
||||
});
|
||||
}
|
||||
|
||||
return plugin;
|
||||
|
||||
}));
|
||||
//# sourceMappingURL=clear_button.js.map
|
1
cp/public/assets/libs/tom-select/dist/js/plugins/clear_button.js.map
vendored
Normal file
1
cp/public/assets/libs/tom-select/dist/js/plugins/clear_button.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
70
cp/public/assets/libs/tom-select/dist/js/plugins/drag_drop.js
vendored
Normal file
70
cp/public/assets/libs/tom-select/dist/js/plugins/drag_drop.js
vendored
Normal file
|
@ -0,0 +1,70 @@
|
|||
/**
|
||||
* Tom Select v2.2.2
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
*/
|
||||
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||
typeof define === 'function' && define.amd ? define(factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.drag_drop = factory());
|
||||
})(this, (function () { 'use strict';
|
||||
|
||||
/**
|
||||
* Plugin: "drag_drop" (Tom Select)
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
|
||||
* file except in compliance with the License. You may obtain a copy of the License at:
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
||||
* ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*
|
||||
*/
|
||||
function plugin () {
|
||||
var self = this;
|
||||
if (!$.fn.sortable) throw new Error('The "drag_drop" plugin requires jQuery UI "sortable".');
|
||||
if (self.settings.mode !== 'multi') return;
|
||||
var orig_lock = self.lock;
|
||||
var orig_unlock = self.unlock;
|
||||
self.hook('instead', 'lock', () => {
|
||||
var sortable = $(self.control).data('sortable');
|
||||
if (sortable) sortable.disable();
|
||||
return orig_lock.call(self);
|
||||
});
|
||||
self.hook('instead', 'unlock', () => {
|
||||
var sortable = $(self.control).data('sortable');
|
||||
if (sortable) sortable.enable();
|
||||
return orig_unlock.call(self);
|
||||
});
|
||||
self.on('initialize', () => {
|
||||
var $control = $(self.control).sortable({
|
||||
items: '[data-value]',
|
||||
forcePlaceholderSize: true,
|
||||
disabled: self.isLocked,
|
||||
start: (e, ui) => {
|
||||
ui.placeholder.css('width', ui.helper.css('width'));
|
||||
$control.css({
|
||||
overflow: 'visible'
|
||||
});
|
||||
},
|
||||
stop: () => {
|
||||
$control.css({
|
||||
overflow: 'hidden'
|
||||
});
|
||||
var values = [];
|
||||
$control.children('[data-value]').each(function () {
|
||||
if (this.dataset.value) values.push(this.dataset.value);
|
||||
});
|
||||
self.setValue(values);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return plugin;
|
||||
|
||||
}));
|
||||
//# sourceMappingURL=drag_drop.js.map
|
1
cp/public/assets/libs/tom-select/dist/js/plugins/drag_drop.js.map
vendored
Normal file
1
cp/public/assets/libs/tom-select/dist/js/plugins/drag_drop.js.map
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"drag_drop.js","sources":["../../../src/plugins/drag_drop/plugin.ts"],"sourcesContent":["/**\n * Plugin: \"drag_drop\" (Tom Select)\n * Copyright (c) contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this\n * file except in compliance with the License. You may obtain a copy of the License at:\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n * ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n *\n */\n\nimport TomSelect from '../../tom-select';\n\nexport default function(this:TomSelect) {\n\tvar self = this;\n\tif (!$.fn.sortable) throw new Error('The \"drag_drop\" plugin requires jQuery UI \"sortable\".');\n\tif (self.settings.mode !== 'multi') return;\n\n\tvar orig_lock\t\t= self.lock;\n\tvar orig_unlock\t\t= self.unlock;\n\n\tself.hook('instead','lock',()=>{\n\t\tvar sortable = $(self.control).data('sortable');\n\t\tif (sortable) sortable.disable();\n\t\treturn orig_lock.call(self);\n\t});\n\n\tself.hook('instead','unlock',()=>{\n\t\tvar sortable = $(self.control).data('sortable');\n\t\tif (sortable) sortable.enable();\n\t\treturn orig_unlock.call(self);\n\t});\n\n\tself.on('initialize',()=>{\n\t\tvar $control = $(self.control).sortable({\n\t\t\titems: '[data-value]',\n\t\t\tforcePlaceholderSize: true,\n\t\t\tdisabled: self.isLocked,\n\t\t\tstart: (e, ui) => {\n\t\t\t\tui.placeholder.css('width', ui.helper.css('width'));\n\t\t\t\t$control.css({overflow: 'visible'});\n\t\t\t},\n\t\t\tstop: ()=>{\n\t\t\t\t$control.css({overflow: 'hidden'});\n\n\t\t\t\tvar values:string[] = [];\n\t\t\t\t$control.children('[data-value]').each(function(this:HTMLElement){\n\t\t\t\t\tif( this.dataset.value ) values.push(this.dataset.value);\n\t\t\t\t});\n\n\t\t\t\tself.setValue(values);\n\t\t\t}\n\t\t});\n\n\t});\n\n};\n"],"names":["self","$","fn","sortable","Error","settings","mode","orig_lock","lock","orig_unlock","unlock","hook","control","data","disable","call","enable","on","$control","items","forcePlaceholderSize","disabled","isLocked","start","e","ui","placeholder","css","helper","overflow","stop","values","children","each","dataset","value","push","setValue"],"mappings":";;;;;;;;;;;CAAA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAIe,eAAyB,IAAA;CACvC,EAAIA,IAAAA,IAAI,GAAG,IAAX,CAAA;CACA,EAAA,IAAI,CAACC,CAAC,CAACC,EAAF,CAAKC,QAAV,EAAoB,MAAM,IAAIC,KAAJ,CAAU,uDAAV,CAAN,CAAA;CACpB,EAAA,IAAIJ,IAAI,CAACK,QAAL,CAAcC,IAAd,KAAuB,OAA3B,EAAoC,OAAA;CAEpC,EAAA,IAAIC,SAAS,GAAIP,IAAI,CAACQ,IAAtB,CAAA;CACA,EAAA,IAAIC,WAAW,GAAIT,IAAI,CAACU,MAAxB,CAAA;CAEAV,EAAAA,IAAI,CAACW,IAAL,CAAU,SAAV,EAAoB,MAApB,EAA2B,MAAI;CAC9B,IAAA,IAAIR,QAAQ,GAAGF,CAAC,CAACD,IAAI,CAACY,OAAN,CAAD,CAAgBC,IAAhB,CAAqB,UAArB,CAAf,CAAA;CACA,IAAA,IAAIV,QAAJ,EAAcA,QAAQ,CAACW,OAAT,EAAA,CAAA;CACd,IAAA,OAAOP,SAAS,CAACQ,IAAV,CAAef,IAAf,CAAP,CAAA;CACA,GAJD,CAAA,CAAA;CAMAA,EAAAA,IAAI,CAACW,IAAL,CAAU,SAAV,EAAoB,QAApB,EAA6B,MAAI;CAChC,IAAA,IAAIR,QAAQ,GAAGF,CAAC,CAACD,IAAI,CAACY,OAAN,CAAD,CAAgBC,IAAhB,CAAqB,UAArB,CAAf,CAAA;CACA,IAAA,IAAIV,QAAJ,EAAcA,QAAQ,CAACa,MAAT,EAAA,CAAA;CACd,IAAA,OAAOP,WAAW,CAACM,IAAZ,CAAiBf,IAAjB,CAAP,CAAA;CACA,GAJD,CAAA,CAAA;CAMAA,EAAAA,IAAI,CAACiB,EAAL,CAAQ,YAAR,EAAqB,MAAI;CACxB,IAAIC,IAAAA,QAAQ,GAAGjB,CAAC,CAACD,IAAI,CAACY,OAAN,CAAD,CAAgBT,QAAhB,CAAyB;CACvCgB,MAAAA,KAAK,EAAE,cADgC;CAEvCC,MAAAA,oBAAoB,EAAE,IAFiB;CAGvCC,MAAAA,QAAQ,EAAErB,IAAI,CAACsB,QAHwB;CAIvCC,MAAAA,KAAK,EAAE,CAACC,CAAD,EAAIC,EAAJ,KAAW;CACjBA,QAAAA,EAAE,CAACC,WAAH,CAAeC,GAAf,CAAmB,OAAnB,EAA4BF,EAAE,CAACG,MAAH,CAAUD,GAAV,CAAc,OAAd,CAA5B,CAAA,CAAA;CACAT,QAAAA,QAAQ,CAACS,GAAT,CAAa;CAACE,UAAAA,QAAQ,EAAE,SAAA;CAAX,SAAb,CAAA,CAAA;CACA,OAPsC;CAQvCC,MAAAA,IAAI,EAAE,MAAI;CACTZ,QAAAA,QAAQ,CAACS,GAAT,CAAa;CAACE,UAAAA,QAAQ,EAAE,QAAA;CAAX,SAAb,CAAA,CAAA;CAEA,QAAIE,IAAAA,MAAe,GAAG,EAAtB,CAAA;CACAb,QAAAA,QAAQ,CAACc,QAAT,CAAkB,cAAlB,CAAkCC,CAAAA,IAAlC,CAAuC,YAA0B;CAChE,UAAA,IAAI,IAAKC,CAAAA,OAAL,CAAaC,KAAjB,EAAyBJ,MAAM,CAACK,IAAP,CAAY,IAAA,CAAKF,OAAL,CAAaC,KAAzB,CAAA,CAAA;CACzB,SAFD,CAAA,CAAA;CAIAnC,QAAAA,IAAI,CAACqC,QAAL,CAAcN,MAAd,CAAA,CAAA;CACA,OAAA;CAjBsC,KAAzB,CAAf,CAAA;CAoBA,GArBD,CAAA,CAAA;CAuBA;;;;;;;;"}
|
180
cp/public/assets/libs/tom-select/dist/js/plugins/dropdown_header.js
vendored
Normal file
180
cp/public/assets/libs/tom-select/dist/js/plugins/dropdown_header.js
vendored
Normal file
|
@ -0,0 +1,180 @@
|
|||
/**
|
||||
* Tom Select v2.2.2
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
*/
|
||||
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||
typeof define === 'function' && define.amd ? define(factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.dropdown_header = factory());
|
||||
})(this, (function () { 'use strict';
|
||||
|
||||
/*! @orchidjs/unicode-variants | https://github.com/orchidjs/unicode-variants | Apache License (v2) */
|
||||
const accent_pat = '[\u0300-\u036F\u{b7}\u{2be}\u{2bc}]';
|
||||
/** @type {TUnicodeMap} */
|
||||
|
||||
const latin_convert = {};
|
||||
/** @type {TUnicodeMap} */
|
||||
|
||||
const latin_condensed = {
|
||||
'/': '⁄∕',
|
||||
'0': '߀',
|
||||
"a": "ⱥɐɑ",
|
||||
"aa": "ꜳ",
|
||||
"ae": "æǽǣ",
|
||||
"ao": "ꜵ",
|
||||
"au": "ꜷ",
|
||||
"av": "ꜹꜻ",
|
||||
"ay": "ꜽ",
|
||||
"b": "ƀɓƃ",
|
||||
"c": "ꜿƈȼↄ",
|
||||
"d": "đɗɖᴅƌꮷԁɦ",
|
||||
"e": "ɛǝᴇɇ",
|
||||
"f": "ꝼƒ",
|
||||
"g": "ǥɠꞡᵹꝿɢ",
|
||||
"h": "ħⱨⱶɥ",
|
||||
"i": "ɨı",
|
||||
"j": "ɉȷ",
|
||||
"k": "ƙⱪꝁꝃꝅꞣ",
|
||||
"l": "łƚɫⱡꝉꝇꞁɭ",
|
||||
"m": "ɱɯϻ",
|
||||
"n": "ꞥƞɲꞑᴎлԉ",
|
||||
"o": "øǿɔɵꝋꝍᴑ",
|
||||
"oe": "œ",
|
||||
"oi": "ƣ",
|
||||
"oo": "ꝏ",
|
||||
"ou": "ȣ",
|
||||
"p": "ƥᵽꝑꝓꝕρ",
|
||||
"q": "ꝗꝙɋ",
|
||||
"r": "ɍɽꝛꞧꞃ",
|
||||
"s": "ßȿꞩꞅʂ",
|
||||
"t": "ŧƭʈⱦꞇ",
|
||||
"th": "þ",
|
||||
"tz": "ꜩ",
|
||||
"u": "ʉ",
|
||||
"v": "ʋꝟʌ",
|
||||
"vy": "ꝡ",
|
||||
"w": "ⱳ",
|
||||
"y": "ƴɏỿ",
|
||||
"z": "ƶȥɀⱬꝣ",
|
||||
"hv": "ƕ"
|
||||
};
|
||||
|
||||
for (let latin in latin_condensed) {
|
||||
let unicode = latin_condensed[latin] || '';
|
||||
|
||||
for (let i = 0; i < unicode.length; i++) {
|
||||
let char = unicode.substring(i, i + 1);
|
||||
latin_convert[char] = latin;
|
||||
}
|
||||
}
|
||||
|
||||
new RegExp(Object.keys(latin_convert).join('|') + '|' + accent_pat, 'gu');
|
||||
|
||||
/**
|
||||
* Return a dom element from either a dom query string, jQuery object, a dom element or html string
|
||||
* https://stackoverflow.com/questions/494143/creating-a-new-dom-element-from-an-html-string-using-built-in-dom-methods-or-pro/35385518#35385518
|
||||
*
|
||||
* param query should be {}
|
||||
*/
|
||||
|
||||
const getDom = query => {
|
||||
if (query.jquery) {
|
||||
return query[0];
|
||||
}
|
||||
|
||||
if (query instanceof HTMLElement) {
|
||||
return query;
|
||||
}
|
||||
|
||||
if (isHtmlString(query)) {
|
||||
var tpl = document.createElement('template');
|
||||
tpl.innerHTML = query.trim(); // Never return a text node of whitespace as the result
|
||||
|
||||
return tpl.content.firstChild;
|
||||
}
|
||||
|
||||
return document.querySelector(query);
|
||||
};
|
||||
const isHtmlString = arg => {
|
||||
if (typeof arg === 'string' && arg.indexOf('<') > -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a scalar to its best string representation
|
||||
* for hash keys and HTML attribute values.
|
||||
*
|
||||
* Transformations:
|
||||
* 'str' -> 'str'
|
||||
* null -> ''
|
||||
* undefined -> ''
|
||||
* true -> '1'
|
||||
* false -> '0'
|
||||
* 0 -> '0'
|
||||
* 1 -> '1'
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* Prevent default
|
||||
*
|
||||
*/
|
||||
|
||||
const preventDefault = (evt, stop = false) => {
|
||||
if (evt) {
|
||||
evt.preventDefault();
|
||||
|
||||
if (stop) {
|
||||
evt.stopPropagation();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Plugin: "dropdown_header" (Tom Select)
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
|
||||
* file except in compliance with the License. You may obtain a copy of the License at:
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
||||
* ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*
|
||||
*/
|
||||
function plugin (userOptions) {
|
||||
const self = this;
|
||||
const options = Object.assign({
|
||||
title: 'Untitled',
|
||||
headerClass: 'dropdown-header',
|
||||
titleRowClass: 'dropdown-header-title',
|
||||
labelClass: 'dropdown-header-label',
|
||||
closeClass: 'dropdown-header-close',
|
||||
html: data => {
|
||||
return '<div class="' + data.headerClass + '">' + '<div class="' + data.titleRowClass + '">' + '<span class="' + data.labelClass + '">' + data.title + '</span>' + '<a class="' + data.closeClass + '">×</a>' + '</div>' + '</div>';
|
||||
}
|
||||
}, userOptions);
|
||||
self.on('initialize', () => {
|
||||
var header = getDom(options.html(options));
|
||||
var close_link = header.querySelector('.' + options.closeClass);
|
||||
|
||||
if (close_link) {
|
||||
close_link.addEventListener('click', evt => {
|
||||
preventDefault(evt, true);
|
||||
self.close();
|
||||
});
|
||||
}
|
||||
|
||||
self.dropdown.insertBefore(header, self.dropdown.firstChild);
|
||||
});
|
||||
}
|
||||
|
||||
return plugin;
|
||||
|
||||
}));
|
||||
//# sourceMappingURL=dropdown_header.js.map
|
1
cp/public/assets/libs/tom-select/dist/js/plugins/dropdown_header.js.map
vendored
Normal file
1
cp/public/assets/libs/tom-select/dist/js/plugins/dropdown_header.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
293
cp/public/assets/libs/tom-select/dist/js/plugins/dropdown_input.js
vendored
Normal file
293
cp/public/assets/libs/tom-select/dist/js/plugins/dropdown_input.js
vendored
Normal file
|
@ -0,0 +1,293 @@
|
|||
/**
|
||||
* Tom Select v2.2.2
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
*/
|
||||
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||
typeof define === 'function' && define.amd ? define(factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.dropdown_input = factory());
|
||||
})(this, (function () { 'use strict';
|
||||
|
||||
const KEY_ESC = 27;
|
||||
const KEY_TAB = 9;
|
||||
typeof navigator === 'undefined' ? false : /Mac/.test(navigator.userAgent);
|
||||
// ctrl key or apple key for ma
|
||||
|
||||
/*! @orchidjs/unicode-variants | https://github.com/orchidjs/unicode-variants | Apache License (v2) */
|
||||
const accent_pat = '[\u0300-\u036F\u{b7}\u{2be}\u{2bc}]';
|
||||
/** @type {TUnicodeMap} */
|
||||
|
||||
const latin_convert = {};
|
||||
/** @type {TUnicodeMap} */
|
||||
|
||||
const latin_condensed = {
|
||||
'/': '⁄∕',
|
||||
'0': '߀',
|
||||
"a": "ⱥɐɑ",
|
||||
"aa": "ꜳ",
|
||||
"ae": "æǽǣ",
|
||||
"ao": "ꜵ",
|
||||
"au": "ꜷ",
|
||||
"av": "ꜹꜻ",
|
||||
"ay": "ꜽ",
|
||||
"b": "ƀɓƃ",
|
||||
"c": "ꜿƈȼↄ",
|
||||
"d": "đɗɖᴅƌꮷԁɦ",
|
||||
"e": "ɛǝᴇɇ",
|
||||
"f": "ꝼƒ",
|
||||
"g": "ǥɠꞡᵹꝿɢ",
|
||||
"h": "ħⱨⱶɥ",
|
||||
"i": "ɨı",
|
||||
"j": "ɉȷ",
|
||||
"k": "ƙⱪꝁꝃꝅꞣ",
|
||||
"l": "łƚɫⱡꝉꝇꞁɭ",
|
||||
"m": "ɱɯϻ",
|
||||
"n": "ꞥƞɲꞑᴎлԉ",
|
||||
"o": "øǿɔɵꝋꝍᴑ",
|
||||
"oe": "œ",
|
||||
"oi": "ƣ",
|
||||
"oo": "ꝏ",
|
||||
"ou": "ȣ",
|
||||
"p": "ƥᵽꝑꝓꝕρ",
|
||||
"q": "ꝗꝙɋ",
|
||||
"r": "ɍɽꝛꞧꞃ",
|
||||
"s": "ßȿꞩꞅʂ",
|
||||
"t": "ŧƭʈⱦꞇ",
|
||||
"th": "þ",
|
||||
"tz": "ꜩ",
|
||||
"u": "ʉ",
|
||||
"v": "ʋꝟʌ",
|
||||
"vy": "ꝡ",
|
||||
"w": "ⱳ",
|
||||
"y": "ƴɏỿ",
|
||||
"z": "ƶȥɀⱬꝣ",
|
||||
"hv": "ƕ"
|
||||
};
|
||||
|
||||
for (let latin in latin_condensed) {
|
||||
let unicode = latin_condensed[latin] || '';
|
||||
|
||||
for (let i = 0; i < unicode.length; i++) {
|
||||
let char = unicode.substring(i, i + 1);
|
||||
latin_convert[char] = latin;
|
||||
}
|
||||
}
|
||||
|
||||
new RegExp(Object.keys(latin_convert).join('|') + '|' + accent_pat, 'gu');
|
||||
|
||||
/**
|
||||
* Iterates over arrays and hashes.
|
||||
*
|
||||
* ```
|
||||
* iterate(this.items, function(item, id) {
|
||||
* // invoked for each item
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
*/
|
||||
|
||||
const iterate = (object, callback) => {
|
||||
if (Array.isArray(object)) {
|
||||
object.forEach(callback);
|
||||
} else {
|
||||
for (var key in object) {
|
||||
if (object.hasOwnProperty(key)) {
|
||||
callback(object[key], key);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Return a dom element from either a dom query string, jQuery object, a dom element or html string
|
||||
* https://stackoverflow.com/questions/494143/creating-a-new-dom-element-from-an-html-string-using-built-in-dom-methods-or-pro/35385518#35385518
|
||||
*
|
||||
* param query should be {}
|
||||
*/
|
||||
|
||||
const getDom = query => {
|
||||
if (query.jquery) {
|
||||
return query[0];
|
||||
}
|
||||
|
||||
if (query instanceof HTMLElement) {
|
||||
return query;
|
||||
}
|
||||
|
||||
if (isHtmlString(query)) {
|
||||
var tpl = document.createElement('template');
|
||||
tpl.innerHTML = query.trim(); // Never return a text node of whitespace as the result
|
||||
|
||||
return tpl.content.firstChild;
|
||||
}
|
||||
|
||||
return document.querySelector(query);
|
||||
};
|
||||
const isHtmlString = arg => {
|
||||
if (typeof arg === 'string' && arg.indexOf('<') > -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
/**
|
||||
* Add css classes
|
||||
*
|
||||
*/
|
||||
|
||||
const addClasses = (elmts, ...classes) => {
|
||||
var norm_classes = classesArray(classes);
|
||||
elmts = castAsArray(elmts);
|
||||
elmts.map(el => {
|
||||
norm_classes.map(cls => {
|
||||
el.classList.add(cls);
|
||||
});
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Return arguments
|
||||
*
|
||||
*/
|
||||
|
||||
const classesArray = args => {
|
||||
var classes = [];
|
||||
iterate(args, _classes => {
|
||||
if (typeof _classes === 'string') {
|
||||
_classes = _classes.trim().split(/[\11\12\14\15\40]/);
|
||||
}
|
||||
|
||||
if (Array.isArray(_classes)) {
|
||||
classes = classes.concat(_classes);
|
||||
}
|
||||
});
|
||||
return classes.filter(Boolean);
|
||||
};
|
||||
/**
|
||||
* Create an array from arg if it's not already an array
|
||||
*
|
||||
*/
|
||||
|
||||
const castAsArray = arg => {
|
||||
if (!Array.isArray(arg)) {
|
||||
arg = [arg];
|
||||
}
|
||||
|
||||
return arg;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a scalar to its best string representation
|
||||
* for hash keys and HTML attribute values.
|
||||
*
|
||||
* Transformations:
|
||||
* 'str' -> 'str'
|
||||
* null -> ''
|
||||
* undefined -> ''
|
||||
* true -> '1'
|
||||
* false -> '0'
|
||||
* 0 -> '0'
|
||||
* 1 -> '1'
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* Prevent default
|
||||
*
|
||||
*/
|
||||
|
||||
const preventDefault = (evt, stop = false) => {
|
||||
if (evt) {
|
||||
evt.preventDefault();
|
||||
|
||||
if (stop) {
|
||||
evt.stopPropagation();
|
||||
}
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Add event helper
|
||||
*
|
||||
*/
|
||||
|
||||
const addEvent = (target, type, callback, options) => {
|
||||
target.addEventListener(type, callback, options);
|
||||
};
|
||||
|
||||
/**
|
||||
* Plugin: "dropdown_input" (Tom Select)
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
|
||||
* file except in compliance with the License. You may obtain a copy of the License at:
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
||||
* ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*
|
||||
*/
|
||||
function plugin () {
|
||||
const self = this;
|
||||
self.settings.shouldOpen = true; // make sure the input is shown even if there are no options to display in the dropdown
|
||||
|
||||
self.hook('before', 'setup', () => {
|
||||
self.focus_node = self.control;
|
||||
addClasses(self.control_input, 'dropdown-input');
|
||||
const div = getDom('<div class="dropdown-input-wrap">');
|
||||
div.append(self.control_input);
|
||||
self.dropdown.insertBefore(div, self.dropdown.firstChild); // set a placeholder in the select control
|
||||
|
||||
const placeholder = getDom('<input class="items-placeholder" tabindex="-1" />');
|
||||
placeholder.placeholder = self.settings.placeholder || '';
|
||||
self.control.append(placeholder);
|
||||
});
|
||||
self.on('initialize', () => {
|
||||
// set tabIndex on control to -1, otherwise [shift+tab] will put focus right back on control_input
|
||||
self.control_input.addEventListener('keydown', evt => {
|
||||
//addEvent(self.control_input,'keydown' as const,(evt:KeyboardEvent) =>{
|
||||
switch (evt.keyCode) {
|
||||
case KEY_ESC:
|
||||
if (self.isOpen) {
|
||||
preventDefault(evt, true);
|
||||
self.close();
|
||||
}
|
||||
|
||||
self.clearActiveItems();
|
||||
return;
|
||||
|
||||
case KEY_TAB:
|
||||
self.focus_node.tabIndex = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
return self.onKeyDown.call(self, evt);
|
||||
});
|
||||
self.on('blur', () => {
|
||||
self.focus_node.tabIndex = self.isDisabled ? -1 : self.tabIndex;
|
||||
}); // give the control_input focus when the dropdown is open
|
||||
|
||||
self.on('dropdown_open', () => {
|
||||
self.control_input.focus();
|
||||
}); // prevent onBlur from closing when focus is on the control_input
|
||||
|
||||
const orig_onBlur = self.onBlur;
|
||||
self.hook('instead', 'onBlur', evt => {
|
||||
if (evt && evt.relatedTarget == self.control_input) return;
|
||||
return orig_onBlur.call(self);
|
||||
});
|
||||
addEvent(self.control_input, 'blur', () => self.onBlur()); // return focus to control to allow further keyboard input
|
||||
|
||||
self.hook('before', 'close', () => {
|
||||
if (!self.isOpen) return;
|
||||
self.focus_node.focus({
|
||||
preventScroll: true
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return plugin;
|
||||
|
||||
}));
|
||||
//# sourceMappingURL=dropdown_input.js.map
|
1
cp/public/assets/libs/tom-select/dist/js/plugins/dropdown_input.js.map
vendored
Normal file
1
cp/public/assets/libs/tom-select/dist/js/plugins/dropdown_input.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
84
cp/public/assets/libs/tom-select/dist/js/plugins/input_autogrow.js
vendored
Normal file
84
cp/public/assets/libs/tom-select/dist/js/plugins/input_autogrow.js
vendored
Normal file
|
@ -0,0 +1,84 @@
|
|||
/**
|
||||
* Tom Select v2.2.2
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
*/
|
||||
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||
typeof define === 'function' && define.amd ? define(factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.input_autogrow = factory());
|
||||
})(this, (function () { 'use strict';
|
||||
|
||||
/**
|
||||
* Converts a scalar to its best string representation
|
||||
* for hash keys and HTML attribute values.
|
||||
*
|
||||
* Transformations:
|
||||
* 'str' -> 'str'
|
||||
* null -> ''
|
||||
* undefined -> ''
|
||||
* true -> '1'
|
||||
* false -> '0'
|
||||
* 0 -> '0'
|
||||
* 1 -> '1'
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* Add event helper
|
||||
*
|
||||
*/
|
||||
|
||||
const addEvent = (target, type, callback, options) => {
|
||||
target.addEventListener(type, callback, options);
|
||||
};
|
||||
|
||||
/**
|
||||
* Plugin: "input_autogrow" (Tom Select)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
|
||||
* file except in compliance with the License. You may obtain a copy of the License at:
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
||||
* ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*
|
||||
*/
|
||||
function plugin () {
|
||||
var self = this;
|
||||
self.on('initialize', () => {
|
||||
var test_input = document.createElement('span');
|
||||
var control = self.control_input;
|
||||
test_input.style.cssText = 'position:absolute; top:-99999px; left:-99999px; width:auto; padding:0; white-space:pre; ';
|
||||
self.wrapper.appendChild(test_input);
|
||||
var transfer_styles = ['letterSpacing', 'fontSize', 'fontFamily', 'fontWeight', 'textTransform'];
|
||||
|
||||
for (const style_name of transfer_styles) {
|
||||
// @ts-ignore TS7015 https://stackoverflow.com/a/50506154/697576
|
||||
test_input.style[style_name] = control.style[style_name];
|
||||
}
|
||||
/**
|
||||
* Set the control width
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
var resize = () => {
|
||||
test_input.textContent = control.value;
|
||||
control.style.width = test_input.clientWidth + 'px';
|
||||
};
|
||||
|
||||
resize();
|
||||
self.on('update item_add item_remove', resize);
|
||||
addEvent(control, 'input', resize);
|
||||
addEvent(control, 'keyup', resize);
|
||||
addEvent(control, 'blur', resize);
|
||||
addEvent(control, 'update', resize);
|
||||
});
|
||||
}
|
||||
|
||||
return plugin;
|
||||
|
||||
}));
|
||||
//# sourceMappingURL=input_autogrow.js.map
|
1
cp/public/assets/libs/tom-select/dist/js/plugins/input_autogrow.js.map
vendored
Normal file
1
cp/public/assets/libs/tom-select/dist/js/plugins/input_autogrow.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
33
cp/public/assets/libs/tom-select/dist/js/plugins/no_active_items.js
vendored
Normal file
33
cp/public/assets/libs/tom-select/dist/js/plugins/no_active_items.js
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* Tom Select v2.2.2
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
*/
|
||||
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||
typeof define === 'function' && define.amd ? define(factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.no_active_items = factory());
|
||||
})(this, (function () { 'use strict';
|
||||
|
||||
/**
|
||||
* Plugin: "no_active_items" (Tom Select)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
|
||||
* file except in compliance with the License. You may obtain a copy of the License at:
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
||||
* ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*
|
||||
*/
|
||||
function plugin () {
|
||||
this.hook('instead', 'setActiveItem', () => {});
|
||||
this.hook('instead', 'selectAll', () => {});
|
||||
}
|
||||
|
||||
return plugin;
|
||||
|
||||
}));
|
||||
//# sourceMappingURL=no_active_items.js.map
|
1
cp/public/assets/libs/tom-select/dist/js/plugins/no_active_items.js.map
vendored
Normal file
1
cp/public/assets/libs/tom-select/dist/js/plugins/no_active_items.js.map
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"no_active_items.js","sources":["../../../src/plugins/no_active_items/plugin.ts"],"sourcesContent":["/**\n * Plugin: \"no_active_items\" (Tom Select)\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this\n * file except in compliance with the License. You may obtain a copy of the License at:\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n * ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n *\n */\n\nimport TomSelect from '../../tom-select';\n\nexport default function(this:TomSelect) {\n\tthis.hook('instead','setActiveItem',() => {});\n\tthis.hook('instead','selectAll',() => {});\n};\n"],"names":["hook"],"mappings":";;;;;;;;;;;CAAA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAIe,eAAyB,IAAA;CACvC,EAAKA,IAAAA,CAAAA,IAAL,CAAU,SAAV,EAAoB,eAApB,EAAoC,MAAM,EAA1C,CAAA,CAAA;CACA,EAAKA,IAAAA,CAAAA,IAAL,CAAU,SAAV,EAAoB,WAApB,EAAgC,MAAM,EAAtC,CAAA,CAAA;CACA;;;;;;;;"}
|
40
cp/public/assets/libs/tom-select/dist/js/plugins/no_backspace_delete.js
vendored
Normal file
40
cp/public/assets/libs/tom-select/dist/js/plugins/no_backspace_delete.js
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
/**
|
||||
* Tom Select v2.2.2
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
*/
|
||||
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||
typeof define === 'function' && define.amd ? define(factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.no_backspace_delete = factory());
|
||||
})(this, (function () { 'use strict';
|
||||
|
||||
/**
|
||||
* Plugin: "input_autogrow" (Tom Select)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
|
||||
* file except in compliance with the License. You may obtain a copy of the License at:
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
||||
* ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*
|
||||
*/
|
||||
function plugin () {
|
||||
var self = this;
|
||||
var orig_deleteSelection = self.deleteSelection;
|
||||
this.hook('instead', 'deleteSelection', evt => {
|
||||
if (self.activeItems.length) {
|
||||
return orig_deleteSelection.call(self, evt);
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
return plugin;
|
||||
|
||||
}));
|
||||
//# sourceMappingURL=no_backspace_delete.js.map
|
1
cp/public/assets/libs/tom-select/dist/js/plugins/no_backspace_delete.js.map
vendored
Normal file
1
cp/public/assets/libs/tom-select/dist/js/plugins/no_backspace_delete.js.map
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"no_backspace_delete.js","sources":["../../../src/plugins/no_backspace_delete/plugin.ts"],"sourcesContent":["/**\n * Plugin: \"input_autogrow\" (Tom Select)\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this\n * file except in compliance with the License. You may obtain a copy of the License at:\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n * ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n *\n */\n\nimport TomSelect from '../../tom-select';\n\nexport default function(this:TomSelect) {\n\tvar self = this;\n\tvar orig_deleteSelection = self.deleteSelection;\n\n\tthis.hook('instead','deleteSelection',(evt:KeyboardEvent) => {\n\n\t\tif( self.activeItems.length ){\n\t\t\treturn orig_deleteSelection.call(self, evt);\n\t\t}\n\n\t\treturn false;\n\t});\n\n};\n"],"names":["self","orig_deleteSelection","deleteSelection","hook","evt","activeItems","length","call"],"mappings":";;;;;;;;;;;CAAA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAIe,eAAyB,IAAA;CACvC,EAAIA,IAAAA,IAAI,GAAG,IAAX,CAAA;CACA,EAAA,IAAIC,oBAAoB,GAAGD,IAAI,CAACE,eAAhC,CAAA;CAEA,EAAA,IAAA,CAAKC,IAAL,CAAU,SAAV,EAAoB,iBAApB,EAAuCC,GAAD,IAAuB;CAE5D,IAAA,IAAIJ,IAAI,CAACK,WAAL,CAAiBC,MAArB,EAA6B;CAC5B,MAAA,OAAOL,oBAAoB,CAACM,IAArB,CAA0BP,IAA1B,EAAgCI,GAAhC,CAAP,CAAA;CACA,KAAA;;CAED,IAAA,OAAO,KAAP,CAAA;CACA,GAPD,CAAA,CAAA;CASA;;;;;;;;"}
|
171
cp/public/assets/libs/tom-select/dist/js/plugins/optgroup_columns.js
vendored
Normal file
171
cp/public/assets/libs/tom-select/dist/js/plugins/optgroup_columns.js
vendored
Normal file
|
@ -0,0 +1,171 @@
|
|||
/**
|
||||
* Tom Select v2.2.2
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
*/
|
||||
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||
typeof define === 'function' && define.amd ? define(factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.optgroup_columns = factory());
|
||||
})(this, (function () { 'use strict';
|
||||
|
||||
const KEY_LEFT = 37;
|
||||
const KEY_RIGHT = 39;
|
||||
typeof navigator === 'undefined' ? false : /Mac/.test(navigator.userAgent);
|
||||
// ctrl key or apple key for ma
|
||||
|
||||
/*! @orchidjs/unicode-variants | https://github.com/orchidjs/unicode-variants | Apache License (v2) */
|
||||
const accent_pat = '[\u0300-\u036F\u{b7}\u{2be}\u{2bc}]';
|
||||
/** @type {TUnicodeMap} */
|
||||
|
||||
const latin_convert = {};
|
||||
/** @type {TUnicodeMap} */
|
||||
|
||||
const latin_condensed = {
|
||||
'/': '⁄∕',
|
||||
'0': '߀',
|
||||
"a": "ⱥɐɑ",
|
||||
"aa": "ꜳ",
|
||||
"ae": "æǽǣ",
|
||||
"ao": "ꜵ",
|
||||
"au": "ꜷ",
|
||||
"av": "ꜹꜻ",
|
||||
"ay": "ꜽ",
|
||||
"b": "ƀɓƃ",
|
||||
"c": "ꜿƈȼↄ",
|
||||
"d": "đɗɖᴅƌꮷԁɦ",
|
||||
"e": "ɛǝᴇɇ",
|
||||
"f": "ꝼƒ",
|
||||
"g": "ǥɠꞡᵹꝿɢ",
|
||||
"h": "ħⱨⱶɥ",
|
||||
"i": "ɨı",
|
||||
"j": "ɉȷ",
|
||||
"k": "ƙⱪꝁꝃꝅꞣ",
|
||||
"l": "łƚɫⱡꝉꝇꞁɭ",
|
||||
"m": "ɱɯϻ",
|
||||
"n": "ꞥƞɲꞑᴎлԉ",
|
||||
"o": "øǿɔɵꝋꝍᴑ",
|
||||
"oe": "œ",
|
||||
"oi": "ƣ",
|
||||
"oo": "ꝏ",
|
||||
"ou": "ȣ",
|
||||
"p": "ƥᵽꝑꝓꝕρ",
|
||||
"q": "ꝗꝙɋ",
|
||||
"r": "ɍɽꝛꞧꞃ",
|
||||
"s": "ßȿꞩꞅʂ",
|
||||
"t": "ŧƭʈⱦꞇ",
|
||||
"th": "þ",
|
||||
"tz": "ꜩ",
|
||||
"u": "ʉ",
|
||||
"v": "ʋꝟʌ",
|
||||
"vy": "ꝡ",
|
||||
"w": "ⱳ",
|
||||
"y": "ƴɏỿ",
|
||||
"z": "ƶȥɀⱬꝣ",
|
||||
"hv": "ƕ"
|
||||
};
|
||||
|
||||
for (let latin in latin_condensed) {
|
||||
let unicode = latin_condensed[latin] || '';
|
||||
|
||||
for (let i = 0; i < unicode.length; i++) {
|
||||
let char = unicode.substring(i, i + 1);
|
||||
latin_convert[char] = latin;
|
||||
}
|
||||
}
|
||||
|
||||
new RegExp(Object.keys(latin_convert).join('|') + '|' + accent_pat, 'gu');
|
||||
|
||||
/**
|
||||
* Get the closest node to the evt.target matching the selector
|
||||
* Stops at wrapper
|
||||
*
|
||||
*/
|
||||
|
||||
const parentMatch = (target, selector, wrapper) => {
|
||||
if (wrapper && !wrapper.contains(target)) {
|
||||
return;
|
||||
}
|
||||
|
||||
while (target && target.matches) {
|
||||
if (target.matches(selector)) {
|
||||
return target;
|
||||
}
|
||||
|
||||
target = target.parentNode;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Get the index of an element amongst sibling nodes of the same type
|
||||
*
|
||||
*/
|
||||
|
||||
const nodeIndex = (el, amongst) => {
|
||||
if (!el) return -1;
|
||||
amongst = amongst || el.nodeName;
|
||||
var i = 0;
|
||||
|
||||
while (el = el.previousElementSibling) {
|
||||
if (el.matches(amongst)) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
return i;
|
||||
};
|
||||
|
||||
/**
|
||||
* Plugin: "optgroup_columns" (Tom Select.js)
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
|
||||
* file except in compliance with the License. You may obtain a copy of the License at:
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
||||
* ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*
|
||||
*/
|
||||
function plugin () {
|
||||
var self = this;
|
||||
var orig_keydown = self.onKeyDown;
|
||||
self.hook('instead', 'onKeyDown', evt => {
|
||||
var index, option, options, optgroup;
|
||||
|
||||
if (!self.isOpen || !(evt.keyCode === KEY_LEFT || evt.keyCode === KEY_RIGHT)) {
|
||||
return orig_keydown.call(self, evt);
|
||||
}
|
||||
|
||||
self.ignoreHover = true;
|
||||
optgroup = parentMatch(self.activeOption, '[data-group]');
|
||||
index = nodeIndex(self.activeOption, '[data-selectable]');
|
||||
|
||||
if (!optgroup) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (evt.keyCode === KEY_LEFT) {
|
||||
optgroup = optgroup.previousSibling;
|
||||
} else {
|
||||
optgroup = optgroup.nextSibling;
|
||||
}
|
||||
|
||||
if (!optgroup) {
|
||||
return;
|
||||
}
|
||||
|
||||
options = optgroup.querySelectorAll('[data-selectable]');
|
||||
option = options[Math.min(options.length - 1, index)];
|
||||
|
||||
if (option) {
|
||||
self.setActiveOption(option);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return plugin;
|
||||
|
||||
}));
|
||||
//# sourceMappingURL=optgroup_columns.js.map
|
1
cp/public/assets/libs/tom-select/dist/js/plugins/optgroup_columns.js.map
vendored
Normal file
1
cp/public/assets/libs/tom-select/dist/js/plugins/optgroup_columns.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
208
cp/public/assets/libs/tom-select/dist/js/plugins/remove_button.js
vendored
Normal file
208
cp/public/assets/libs/tom-select/dist/js/plugins/remove_button.js
vendored
Normal file
|
@ -0,0 +1,208 @@
|
|||
/**
|
||||
* Tom Select v2.2.2
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
*/
|
||||
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||
typeof define === 'function' && define.amd ? define(factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.remove_button = factory());
|
||||
})(this, (function () { 'use strict';
|
||||
|
||||
/*! @orchidjs/unicode-variants | https://github.com/orchidjs/unicode-variants | Apache License (v2) */
|
||||
const accent_pat = '[\u0300-\u036F\u{b7}\u{2be}\u{2bc}]';
|
||||
/** @type {TUnicodeMap} */
|
||||
|
||||
const latin_convert = {};
|
||||
/** @type {TUnicodeMap} */
|
||||
|
||||
const latin_condensed = {
|
||||
'/': '⁄∕',
|
||||
'0': '߀',
|
||||
"a": "ⱥɐɑ",
|
||||
"aa": "ꜳ",
|
||||
"ae": "æǽǣ",
|
||||
"ao": "ꜵ",
|
||||
"au": "ꜷ",
|
||||
"av": "ꜹꜻ",
|
||||
"ay": "ꜽ",
|
||||
"b": "ƀɓƃ",
|
||||
"c": "ꜿƈȼↄ",
|
||||
"d": "đɗɖᴅƌꮷԁɦ",
|
||||
"e": "ɛǝᴇɇ",
|
||||
"f": "ꝼƒ",
|
||||
"g": "ǥɠꞡᵹꝿɢ",
|
||||
"h": "ħⱨⱶɥ",
|
||||
"i": "ɨı",
|
||||
"j": "ɉȷ",
|
||||
"k": "ƙⱪꝁꝃꝅꞣ",
|
||||
"l": "łƚɫⱡꝉꝇꞁɭ",
|
||||
"m": "ɱɯϻ",
|
||||
"n": "ꞥƞɲꞑᴎлԉ",
|
||||
"o": "øǿɔɵꝋꝍᴑ",
|
||||
"oe": "œ",
|
||||
"oi": "ƣ",
|
||||
"oo": "ꝏ",
|
||||
"ou": "ȣ",
|
||||
"p": "ƥᵽꝑꝓꝕρ",
|
||||
"q": "ꝗꝙɋ",
|
||||
"r": "ɍɽꝛꞧꞃ",
|
||||
"s": "ßȿꞩꞅʂ",
|
||||
"t": "ŧƭʈⱦꞇ",
|
||||
"th": "þ",
|
||||
"tz": "ꜩ",
|
||||
"u": "ʉ",
|
||||
"v": "ʋꝟʌ",
|
||||
"vy": "ꝡ",
|
||||
"w": "ⱳ",
|
||||
"y": "ƴɏỿ",
|
||||
"z": "ƶȥɀⱬꝣ",
|
||||
"hv": "ƕ"
|
||||
};
|
||||
|
||||
for (let latin in latin_condensed) {
|
||||
let unicode = latin_condensed[latin] || '';
|
||||
|
||||
for (let i = 0; i < unicode.length; i++) {
|
||||
let char = unicode.substring(i, i + 1);
|
||||
latin_convert[char] = latin;
|
||||
}
|
||||
}
|
||||
|
||||
new RegExp(Object.keys(latin_convert).join('|') + '|' + accent_pat, 'gu');
|
||||
|
||||
/**
|
||||
* Return a dom element from either a dom query string, jQuery object, a dom element or html string
|
||||
* https://stackoverflow.com/questions/494143/creating-a-new-dom-element-from-an-html-string-using-built-in-dom-methods-or-pro/35385518#35385518
|
||||
*
|
||||
* param query should be {}
|
||||
*/
|
||||
|
||||
const getDom = query => {
|
||||
if (query.jquery) {
|
||||
return query[0];
|
||||
}
|
||||
|
||||
if (query instanceof HTMLElement) {
|
||||
return query;
|
||||
}
|
||||
|
||||
if (isHtmlString(query)) {
|
||||
var tpl = document.createElement('template');
|
||||
tpl.innerHTML = query.trim(); // Never return a text node of whitespace as the result
|
||||
|
||||
return tpl.content.firstChild;
|
||||
}
|
||||
|
||||
return document.querySelector(query);
|
||||
};
|
||||
const isHtmlString = arg => {
|
||||
if (typeof arg === 'string' && arg.indexOf('<') > -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a scalar to its best string representation
|
||||
* for hash keys and HTML attribute values.
|
||||
*
|
||||
* Transformations:
|
||||
* 'str' -> 'str'
|
||||
* null -> ''
|
||||
* undefined -> ''
|
||||
* true -> '1'
|
||||
* false -> '0'
|
||||
* 0 -> '0'
|
||||
* 1 -> '1'
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* Escapes a string for use within HTML.
|
||||
*
|
||||
*/
|
||||
|
||||
const escape_html = str => {
|
||||
return (str + '').replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
||||
};
|
||||
/**
|
||||
* Prevent default
|
||||
*
|
||||
*/
|
||||
|
||||
const preventDefault = (evt, stop = false) => {
|
||||
if (evt) {
|
||||
evt.preventDefault();
|
||||
|
||||
if (stop) {
|
||||
evt.stopPropagation();
|
||||
}
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Add event helper
|
||||
*
|
||||
*/
|
||||
|
||||
const addEvent = (target, type, callback, options) => {
|
||||
target.addEventListener(type, callback, options);
|
||||
};
|
||||
|
||||
/**
|
||||
* Plugin: "remove_button" (Tom Select)
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
|
||||
* file except in compliance with the License. You may obtain a copy of the License at:
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
||||
* ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*
|
||||
*/
|
||||
function plugin (userOptions) {
|
||||
const options = Object.assign({
|
||||
label: '×',
|
||||
title: 'Remove',
|
||||
className: 'remove',
|
||||
append: true
|
||||
}, userOptions); //options.className = 'remove-single';
|
||||
|
||||
var self = this; // override the render method to add remove button to each item
|
||||
|
||||
if (!options.append) {
|
||||
return;
|
||||
}
|
||||
|
||||
var html = '<a href="javascript:void(0)" class="' + options.className + '" tabindex="-1" title="' + escape_html(options.title) + '">' + options.label + '</a>';
|
||||
self.hook('after', 'setupTemplates', () => {
|
||||
var orig_render_item = self.settings.render.item;
|
||||
|
||||
self.settings.render.item = (data, escape) => {
|
||||
var item = getDom(orig_render_item.call(self, data, escape));
|
||||
var close_button = getDom(html);
|
||||
item.appendChild(close_button);
|
||||
addEvent(close_button, 'mousedown', evt => {
|
||||
preventDefault(evt, true);
|
||||
});
|
||||
addEvent(close_button, 'click', evt => {
|
||||
// propagating will trigger the dropdown to show for single mode
|
||||
preventDefault(evt, true);
|
||||
if (self.isLocked) return;
|
||||
if (!self.shouldDelete([item], evt)) return;
|
||||
self.removeItem(item);
|
||||
self.refreshOptions(false);
|
||||
self.inputState();
|
||||
});
|
||||
return item;
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
return plugin;
|
||||
|
||||
}));
|
||||
//# sourceMappingURL=remove_button.js.map
|
1
cp/public/assets/libs/tom-select/dist/js/plugins/remove_button.js.map
vendored
Normal file
1
cp/public/assets/libs/tom-select/dist/js/plugins/remove_button.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
51
cp/public/assets/libs/tom-select/dist/js/plugins/restore_on_backspace.js
vendored
Normal file
51
cp/public/assets/libs/tom-select/dist/js/plugins/restore_on_backspace.js
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
/**
|
||||
* Tom Select v2.2.2
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
*/
|
||||
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||
typeof define === 'function' && define.amd ? define(factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.restore_on_backspace = factory());
|
||||
})(this, (function () { 'use strict';
|
||||
|
||||
/**
|
||||
* Plugin: "restore_on_backspace" (Tom Select)
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
|
||||
* file except in compliance with the License. You may obtain a copy of the License at:
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
||||
* ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*
|
||||
*/
|
||||
function plugin (userOptions) {
|
||||
const self = this;
|
||||
const options = Object.assign({
|
||||
text: option => {
|
||||
return option[self.settings.labelField];
|
||||
}
|
||||
}, userOptions);
|
||||
self.on('item_remove', function (value) {
|
||||
if (!self.isFocused) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.control_input.value.trim() === '') {
|
||||
var option = self.options[value];
|
||||
|
||||
if (option) {
|
||||
self.setTextboxValue(options.text.call(self, option));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return plugin;
|
||||
|
||||
}));
|
||||
//# sourceMappingURL=restore_on_backspace.js.map
|
1
cp/public/assets/libs/tom-select/dist/js/plugins/restore_on_backspace.js.map
vendored
Normal file
1
cp/public/assets/libs/tom-select/dist/js/plugins/restore_on_backspace.js.map
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"restore_on_backspace.js","sources":["../../../src/plugins/restore_on_backspace/plugin.ts"],"sourcesContent":["/**\n * Plugin: \"restore_on_backspace\" (Tom Select)\n * Copyright (c) contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this\n * file except in compliance with the License. You may obtain a copy of the License at:\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n * ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n *\n */\nimport TomSelect from '../../tom-select';\nimport { TomOption } from '../../types/index';\n\ntype TPluginOptions = {\n\ttext?:(option:TomOption)=>string,\n};\n\nexport default function(this:TomSelect, userOptions:TPluginOptions) {\n\tconst self = this;\n\n\tconst options = Object.assign({\n\t\ttext: (option:TomOption) => {\n\t\t\treturn option[self.settings.labelField];\n\t\t}\n\t},userOptions);\n\n\tself.on('item_remove',function(value:string){\n\t\tif( !self.isFocused ){\n\t\t\treturn;\n\t\t}\n\n\t\tif( self.control_input.value.trim() === '' ){\n\t\t\tvar option = self.options[value];\n\t\t\tif( option ){\n\t\t\t\tself.setTextboxValue(options.text.call(self, option));\n\t\t\t}\n\t\t}\n\t});\n\n};\n"],"names":["userOptions","self","options","Object","assign","text","option","settings","labelField","on","value","isFocused","control_input","trim","setTextboxValue","call"],"mappings":";;;;;;;;;;;CAAA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAQe,eAAA,EAAyBA,WAAzB,EAAqD;CACnE,EAAMC,MAAAA,IAAI,GAAG,IAAb,CAAA;CAEA,EAAA,MAAMC,OAAO,GAAGC,MAAM,CAACC,MAAP,CAAc;CAC7BC,IAAAA,IAAI,EAAGC,MAAD,IAAsB;CAC3B,MAAA,OAAOA,MAAM,CAACL,IAAI,CAACM,QAAL,CAAcC,UAAf,CAAb,CAAA;CACA,KAAA;CAH4B,GAAd,EAIdR,WAJc,CAAhB,CAAA;CAMAC,EAAAA,IAAI,CAACQ,EAAL,CAAQ,aAAR,EAAsB,UAASC,KAAT,EAAsB;CAC3C,IAAA,IAAI,CAACT,IAAI,CAACU,SAAV,EAAqB;CACpB,MAAA,OAAA;CACA,KAAA;;CAED,IAAIV,IAAAA,IAAI,CAACW,aAAL,CAAmBF,KAAnB,CAAyBG,IAAzB,EAAoC,KAAA,EAAxC,EAA4C;CAC3C,MAAA,IAAIP,MAAM,GAAGL,IAAI,CAACC,OAAL,CAAaQ,KAAb,CAAb,CAAA;;CACA,MAAA,IAAIJ,MAAJ,EAAY;CACXL,QAAAA,IAAI,CAACa,eAAL,CAAqBZ,OAAO,CAACG,IAAR,CAAaU,IAAb,CAAkBd,IAAlB,EAAwBK,MAAxB,CAArB,CAAA,CAAA;CACA,OAAA;CACD,KAAA;CACD,GAXD,CAAA,CAAA;CAaA;;;;;;;;"}
|
336
cp/public/assets/libs/tom-select/dist/js/plugins/virtual_scroll.js
vendored
Normal file
336
cp/public/assets/libs/tom-select/dist/js/plugins/virtual_scroll.js
vendored
Normal file
|
@ -0,0 +1,336 @@
|
|||
/**
|
||||
* Tom Select v2.2.2
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
*/
|
||||
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||
typeof define === 'function' && define.amd ? define(factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.virtual_scroll = factory());
|
||||
})(this, (function () { 'use strict';
|
||||
|
||||
/*! @orchidjs/unicode-variants | https://github.com/orchidjs/unicode-variants | Apache License (v2) */
|
||||
const accent_pat = '[\u0300-\u036F\u{b7}\u{2be}\u{2bc}]';
|
||||
/** @type {TUnicodeMap} */
|
||||
|
||||
const latin_convert = {};
|
||||
/** @type {TUnicodeMap} */
|
||||
|
||||
const latin_condensed = {
|
||||
'/': '⁄∕',
|
||||
'0': '߀',
|
||||
"a": "ⱥɐɑ",
|
||||
"aa": "ꜳ",
|
||||
"ae": "æǽǣ",
|
||||
"ao": "ꜵ",
|
||||
"au": "ꜷ",
|
||||
"av": "ꜹꜻ",
|
||||
"ay": "ꜽ",
|
||||
"b": "ƀɓƃ",
|
||||
"c": "ꜿƈȼↄ",
|
||||
"d": "đɗɖᴅƌꮷԁɦ",
|
||||
"e": "ɛǝᴇɇ",
|
||||
"f": "ꝼƒ",
|
||||
"g": "ǥɠꞡᵹꝿɢ",
|
||||
"h": "ħⱨⱶɥ",
|
||||
"i": "ɨı",
|
||||
"j": "ɉȷ",
|
||||
"k": "ƙⱪꝁꝃꝅꞣ",
|
||||
"l": "łƚɫⱡꝉꝇꞁɭ",
|
||||
"m": "ɱɯϻ",
|
||||
"n": "ꞥƞɲꞑᴎлԉ",
|
||||
"o": "øǿɔɵꝋꝍᴑ",
|
||||
"oe": "œ",
|
||||
"oi": "ƣ",
|
||||
"oo": "ꝏ",
|
||||
"ou": "ȣ",
|
||||
"p": "ƥᵽꝑꝓꝕρ",
|
||||
"q": "ꝗꝙɋ",
|
||||
"r": "ɍɽꝛꞧꞃ",
|
||||
"s": "ßȿꞩꞅʂ",
|
||||
"t": "ŧƭʈⱦꞇ",
|
||||
"th": "þ",
|
||||
"tz": "ꜩ",
|
||||
"u": "ʉ",
|
||||
"v": "ʋꝟʌ",
|
||||
"vy": "ꝡ",
|
||||
"w": "ⱳ",
|
||||
"y": "ƴɏỿ",
|
||||
"z": "ƶȥɀⱬꝣ",
|
||||
"hv": "ƕ"
|
||||
};
|
||||
|
||||
for (let latin in latin_condensed) {
|
||||
let unicode = latin_condensed[latin] || '';
|
||||
|
||||
for (let i = 0; i < unicode.length; i++) {
|
||||
let char = unicode.substring(i, i + 1);
|
||||
latin_convert[char] = latin;
|
||||
}
|
||||
}
|
||||
|
||||
new RegExp(Object.keys(latin_convert).join('|') + '|' + accent_pat, 'gu');
|
||||
|
||||
/**
|
||||
* Iterates over arrays and hashes.
|
||||
*
|
||||
* ```
|
||||
* iterate(this.items, function(item, id) {
|
||||
* // invoked for each item
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
*/
|
||||
|
||||
const iterate = (object, callback) => {
|
||||
if (Array.isArray(object)) {
|
||||
object.forEach(callback);
|
||||
} else {
|
||||
for (var key in object) {
|
||||
if (object.hasOwnProperty(key)) {
|
||||
callback(object[key], key);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Add css classes
|
||||
*
|
||||
*/
|
||||
|
||||
const addClasses = (elmts, ...classes) => {
|
||||
var norm_classes = classesArray(classes);
|
||||
elmts = castAsArray(elmts);
|
||||
elmts.map(el => {
|
||||
norm_classes.map(cls => {
|
||||
el.classList.add(cls);
|
||||
});
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Return arguments
|
||||
*
|
||||
*/
|
||||
|
||||
const classesArray = args => {
|
||||
var classes = [];
|
||||
iterate(args, _classes => {
|
||||
if (typeof _classes === 'string') {
|
||||
_classes = _classes.trim().split(/[\11\12\14\15\40]/);
|
||||
}
|
||||
|
||||
if (Array.isArray(_classes)) {
|
||||
classes = classes.concat(_classes);
|
||||
}
|
||||
});
|
||||
return classes.filter(Boolean);
|
||||
};
|
||||
/**
|
||||
* Create an array from arg if it's not already an array
|
||||
*
|
||||
*/
|
||||
|
||||
const castAsArray = arg => {
|
||||
if (!Array.isArray(arg)) {
|
||||
arg = [arg];
|
||||
}
|
||||
|
||||
return arg;
|
||||
};
|
||||
|
||||
/**
|
||||
* Plugin: "restore_on_backspace" (Tom Select)
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
|
||||
* file except in compliance with the License. You may obtain a copy of the License at:
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
||||
* ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*
|
||||
*/
|
||||
function plugin () {
|
||||
const self = this;
|
||||
const orig_canLoad = self.canLoad;
|
||||
const orig_clearActiveOption = self.clearActiveOption;
|
||||
const orig_loadCallback = self.loadCallback;
|
||||
var pagination = {};
|
||||
var dropdown_content;
|
||||
var loading_more = false;
|
||||
var load_more_opt;
|
||||
var default_values = [];
|
||||
|
||||
if (!self.settings.shouldLoadMore) {
|
||||
// return true if additional results should be loaded
|
||||
self.settings.shouldLoadMore = () => {
|
||||
const scroll_percent = dropdown_content.clientHeight / (dropdown_content.scrollHeight - dropdown_content.scrollTop);
|
||||
|
||||
if (scroll_percent > 0.9) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (self.activeOption) {
|
||||
var selectable = self.selectable();
|
||||
var index = Array.from(selectable).indexOf(self.activeOption);
|
||||
|
||||
if (index >= selectable.length - 2) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
if (!self.settings.firstUrl) {
|
||||
throw 'virtual_scroll plugin requires a firstUrl() method';
|
||||
} // in order for virtual scrolling to work,
|
||||
// options need to be ordered the same way they're returned from the remote data source
|
||||
|
||||
|
||||
self.settings.sortField = [{
|
||||
field: '$order'
|
||||
}, {
|
||||
field: '$score'
|
||||
}]; // can we load more results for given query?
|
||||
|
||||
const canLoadMore = query => {
|
||||
if (typeof self.settings.maxOptions === 'number' && dropdown_content.children.length >= self.settings.maxOptions) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (query in pagination && pagination[query]) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
const clearFilter = (option, value) => {
|
||||
if (self.items.indexOf(value) >= 0 || default_values.indexOf(value) >= 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}; // set the next url that will be
|
||||
|
||||
|
||||
self.setNextUrl = (value, next_url) => {
|
||||
pagination[value] = next_url;
|
||||
}; // getUrl() to be used in settings.load()
|
||||
|
||||
|
||||
self.getUrl = query => {
|
||||
if (query in pagination) {
|
||||
const next_url = pagination[query];
|
||||
pagination[query] = false;
|
||||
return next_url;
|
||||
} // if the user goes back to a previous query
|
||||
// we need to load the first page again
|
||||
|
||||
|
||||
pagination = {};
|
||||
return self.settings.firstUrl.call(self, query);
|
||||
}; // don't clear the active option (and cause unwanted dropdown scroll)
|
||||
// while loading more results
|
||||
|
||||
|
||||
self.hook('instead', 'clearActiveOption', () => {
|
||||
if (loading_more) {
|
||||
return;
|
||||
}
|
||||
|
||||
return orig_clearActiveOption.call(self);
|
||||
}); // override the canLoad method
|
||||
|
||||
self.hook('instead', 'canLoad', query => {
|
||||
// first time the query has been seen
|
||||
if (!(query in pagination)) {
|
||||
return orig_canLoad.call(self, query);
|
||||
}
|
||||
|
||||
return canLoadMore(query);
|
||||
}); // wrap the load
|
||||
|
||||
self.hook('instead', 'loadCallback', (options, optgroups) => {
|
||||
if (!loading_more) {
|
||||
self.clearOptions(clearFilter);
|
||||
} else if (load_more_opt) {
|
||||
const first_option = options[0];
|
||||
|
||||
if (first_option !== undefined) {
|
||||
load_more_opt.dataset.value = first_option[self.settings.valueField];
|
||||
}
|
||||
}
|
||||
|
||||
orig_loadCallback.call(self, options, optgroups);
|
||||
loading_more = false;
|
||||
}); // add templates to dropdown
|
||||
// loading_more if we have another url in the queue
|
||||
// no_more_results if we don't have another url in the queue
|
||||
|
||||
self.hook('after', 'refreshOptions', () => {
|
||||
const query = self.lastValue;
|
||||
var option;
|
||||
|
||||
if (canLoadMore(query)) {
|
||||
option = self.render('loading_more', {
|
||||
query: query
|
||||
});
|
||||
|
||||
if (option) {
|
||||
option.setAttribute('data-selectable', ''); // so that navigating dropdown with [down] keypresses can navigate to this node
|
||||
|
||||
load_more_opt = option;
|
||||
}
|
||||
} else if (query in pagination && !dropdown_content.querySelector('.no-results')) {
|
||||
option = self.render('no_more_results', {
|
||||
query: query
|
||||
});
|
||||
}
|
||||
|
||||
if (option) {
|
||||
addClasses(option, self.settings.optionClass);
|
||||
dropdown_content.append(option);
|
||||
}
|
||||
}); // add scroll listener and default templates
|
||||
|
||||
self.on('initialize', () => {
|
||||
default_values = Object.keys(self.options);
|
||||
dropdown_content = self.dropdown_content; // default templates
|
||||
|
||||
self.settings.render = Object.assign({}, {
|
||||
loading_more: () => {
|
||||
return `<div class="loading-more-results">Loading more results ... </div>`;
|
||||
},
|
||||
no_more_results: () => {
|
||||
return `<div class="no-more-results">No more results</div>`;
|
||||
}
|
||||
}, self.settings.render); // watch dropdown content scroll position
|
||||
|
||||
dropdown_content.addEventListener('scroll', () => {
|
||||
if (!self.settings.shouldLoadMore.call(self)) {
|
||||
return;
|
||||
} // !important: this will get checked again in load() but we still need to check here otherwise loading_more will be set to true
|
||||
|
||||
|
||||
if (!canLoadMore(self.lastValue)) {
|
||||
return;
|
||||
} // don't call load() too much
|
||||
|
||||
|
||||
if (loading_more) return;
|
||||
loading_more = true;
|
||||
self.load.call(self, self.lastValue);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return plugin;
|
||||
|
||||
}));
|
||||
//# sourceMappingURL=virtual_scroll.js.map
|
1
cp/public/assets/libs/tom-select/dist/js/plugins/virtual_scroll.js.map
vendored
Normal file
1
cp/public/assets/libs/tom-select/dist/js/plugins/virtual_scroll.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue