PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.9
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.9
4.4.9 4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 All 140 releases
← All changes | assets/js/dist/admin/admin-tools.js +101 -214 4.4.5 → 4.4.9 View file →
@@ -2223,9 +2223,8 @@
2223 2223 diacritics: true,
2224 2224 create: null,
2225 2225 createOnBlur: false,
2226 2226 createFilter: null,
2227 - clearAfterSelect: false,
2228 2227 highlight: true,
2229 2228 openOnFocus: true,
2230 2229 shouldOpen: null,
2231 2230 maxOptions: 50,
@@ -2422,12 +2421,11 @@
2422 2421 * Initialize from a <input type="text"> element.
2423 2422 *
2424 2423 */
2425 2424 var init_textbox = () => {
2426 - var _a, _b;
2427 2425 const data_raw = input.getAttribute(attr_data);
2428 2426 if (!data_raw) {
2429 - var value = (_b = (_a = input === null || input === void 0 ? void 0 : input.value) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : '';
2427 + var value = input.value.trim() || '';
2430 2428 if (!settings.allowEmptyOption && !value.length)
2431 2429 return;
2432 2430 const values = value.split(settings.delimiter);
2433 2431 (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.iterate)(values, (value) => {
@@ -2468,9 +2466,9 @@
2468 2466 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2469 2467 /* harmony export */ "default": () => (/* binding */ plugin)
2470 2468 /* harmony export */ });
2471 2469 /**
2472 -* Tom Select v2.6.2
2470 +* Tom Select v2.4.3
2473 2471 * Licensed under the Apache License, Version 2.0 (the "License");
2474 2472 */
2475 2473
2476 2474 /**
@@ -2645,9 +2643,9 @@
2645 2643 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2646 2644 /* harmony export */ "default": () => (/* binding */ plugin)
2647 2645 /* harmony export */ });
2648 2646 /**
2649 -* Tom Select v2.6.2
2647 +* Tom Select v2.4.3
2650 2648 * Licensed under the Apache License, Version 2.0 (the "License");
2651 2649 */
2652 2650
2653 2651 /**
@@ -2710,9 +2708,9 @@
2710 2708 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2711 2709 /* harmony export */ "default": () => (/* binding */ plugin)
2712 2710 /* harmony export */ });
2713 2711 /**
2714 -* Tom Select v2.6.2
2712 +* Tom Select v2.4.3
2715 2713 * Licensed under the Apache License, Version 2.0 (the "License");
2716 2714 */
2717 2715
2718 2716 /**
@@ -2903,9 +2901,9 @@
2903 2901 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2904 2902 /* harmony export */ "default": () => (/* binding */ plugin)
2905 2903 /* harmony export */ });
2906 2904 /**
2907 -* Tom Select v2.6.2
2905 +* Tom Select v2.4.3
2908 2906 * Licensed under the Apache License, Version 2.0 (the "License");
2909 2907 */
2910 2908
2911 2909 /**
@@ -2954,12 +2952,10 @@
2954 2952 const self = this;
2955 2953 const options = Object.assign({
2956 2954 className: 'clear-button',
2957 2955 title: 'Clear All',
2958 - role: 'button',
2959 - tabindex: 0,
2960 2956 html: data => {
2961 - return `<div class="${data.className}" title="${data.title}" role="${data.role}" tabindex="${data.tabindex}">&times;</div>`;
2957 + return `<div class="${data.className}" title="${data.title}">&#10799;</div>`;
2962 2958 }
2963 2959 }, userOptions);
2964 2960 self.on('initialize', () => {
2965 2961 var button = getDom(options.html(options));
@@ -2968,9 +2964,8 @@
2968 2964 self.clear();
2969 2965 if (self.settings.mode === 'single' && self.settings.allowEmptyOption) {
2970 2966 self.addItem('');
2971 2967 }
2972 - self.refreshOptions(false);
2973 2968 evt.preventDefault();
2974 2969 evt.stopPropagation();
2975 2970 });
2976 2971 self.control.appendChild(button);
@@ -2993,9 +2988,9 @@
2993 2988 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2994 2989 /* harmony export */ "default": () => (/* binding */ plugin)
2995 2990 /* harmony export */ });
2996 2991 /**
2997 -* Tom Select v2.6.2
2992 +* Tom Select v2.4.3
2998 2993 * Licensed under the Apache License, Version 2.0 (the "License");
2999 2994 */
3000 2995
3001 2996 /**
@@ -3227,9 +3222,9 @@
3227 3222 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3228 3223 /* harmony export */ "default": () => (/* binding */ plugin)
3229 3224 /* harmony export */ });
3230 3225 /**
3231 -* Tom Select v2.6.2
3226 +* Tom Select v2.4.3
3232 3227 * Licensed under the Apache License, Version 2.0 (the "License");
3233 3228 */
3234 3229
3235 3230 /**
@@ -3343,9 +3338,9 @@
3343 3338 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3344 3339 /* harmony export */ "default": () => (/* binding */ plugin)
3345 3340 /* harmony export */ });
3346 3341 /**
3347 -* Tom Select v2.6.2
3342 +* Tom Select v2.4.3
3348 3343 * Licensed under the Apache License, Version 2.0 (the "License");
3349 3344 */
3350 3345
3351 3346 const KEY_ESC = 27;
@@ -3498,9 +3493,8 @@
3498 3493 const self = this;
3499 3494 self.settings.shouldOpen = true; // make sure the input is shown even if there are no options to display in the dropdown
3500 3495
3501 3496 self.hook('before', 'setup', () => {
3502 - var _self$input;
3503 3497 self.focus_node = self.control;
3504 3498 addClasses(self.control_input, 'dropdown-input');
3505 3499 const div = getDom('<div class="dropdown-input-wrap">');
3506 3500 div.append(self.control_input);
@@ -3509,17 +3503,8 @@
3509 3503 // set a placeholder in the select control
3510 3504 const placeholder = getDom('<input class="items-placeholder" tabindex="-1" />');
3511 3505 placeholder.placeholder = self.settings.placeholder || '';
3512 3506 self.control.append(placeholder);
3513 - /**
3514 - * TomSelect renders a custom control with a focusable <input class="items-placeholder">.
3515 - * The source <select>'s aria-label is not automatically propagated to that input,
3516 - * which triggers "Missing form label" accessibility warnings.
3517 - * This helper copies the label from the <select> onto the generated input.
3518 - */
3519 - const label = (_self$input = self.input) == null ? void 0 : _self$input.getAttribute('aria-label');
3520 - if (!label) return;
3521 - placeholder.setAttribute('aria-label', label);
3522 3507 });
3523 3508 self.on('initialize', () => {
3524 3509 // set tabIndex on control to -1, otherwise [shift+tab] will put focus right back on control_input
3525 3510 self.control_input.addEventListener('keydown', evt => {
@@ -3581,9 +3566,9 @@
3581 3566 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3582 3567 /* harmony export */ "default": () => (/* binding */ plugin)
3583 3568 /* harmony export */ });
3584 3569 /**
3585 -* Tom Select v2.6.2
3570 +* Tom Select v2.4.3
3586 3571 * Licensed under the Apache License, Version 2.0 (the "License");
3587 3572 */
3588 3573
3589 3574 /**
@@ -3669,9 +3654,9 @@
3669 3654 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3670 3655 /* harmony export */ "default": () => (/* binding */ plugin)
3671 3656 /* harmony export */ });
3672 3657 /**
3673 -* Tom Select v2.6.2
3658 +* Tom Select v2.4.3
3674 3659 * Licensed under the Apache License, Version 2.0 (the "License");
3675 3660 */
3676 3661
3677 3662 /**
@@ -3709,9 +3694,9 @@
3709 3694 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3710 3695 /* harmony export */ "default": () => (/* binding */ plugin)
3711 3696 /* harmony export */ });
3712 3697 /**
3713 -* Tom Select v2.6.2
3698 +* Tom Select v2.4.3
3714 3699 * Licensed under the Apache License, Version 2.0 (the "License");
3715 3700 */
3716 3701
3717 3702 /**
@@ -3755,9 +3740,9 @@
3755 3740 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3756 3741 /* harmony export */ "default": () => (/* binding */ plugin)
3757 3742 /* harmony export */ });
3758 3743 /**
3759 -* Tom Select v2.6.2
3744 +* Tom Select v2.4.3
3760 3745 * Licensed under the Apache License, Version 2.0 (the "License");
3761 3746 */
3762 3747
3763 3748 const KEY_LEFT = 37;
@@ -3855,9 +3840,9 @@
3855 3840 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3856 3841 /* harmony export */ "default": () => (/* binding */ plugin)
3857 3842 /* harmony export */ });
3858 3843 /**
3859 -* Tom Select v2.6.2
3844 +* Tom Select v2.4.3
3860 3845 * Licensed under the Apache License, Version 2.0 (the "License");
3861 3846 */
3862 3847
3863 3848 /**
@@ -3875,8 +3860,16 @@
3875 3860 *
3876 3861 */
3877 3862
3878 3863 /**
3864 + * Escapes a string for use within HTML.
3865 + *
3866 + */
3867 +const escape_html = str => {
3868 + return (str + '').replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
3869 +};
3870 +
3871 +/**
3879 3872 * Prevent default
3880 3873 *
3881 3874 */
3882 3875 const preventDefault = (evt, stop = false) => {
@@ -3938,31 +3931,28 @@
3938 3931 *
3939 3932 */
3940 3933
3941 3934 function plugin (userOptions) {
3942 - const self = this;
3943 3935 const options = Object.assign({
3944 - label: '×',
3936 + label: '&times;',
3945 3937 title: 'Remove',
3946 3938 className: 'remove',
3947 - tabindex: -1,
3948 - role: 'button',
3949 - html: data => {
3950 - var _data$tabindex;
3951 - const el = document.createElement('div');
3952 - el.className = data.className || '';
3953 - el.title = data.title || '';
3954 - el.setAttribute('role', data.role || 'button');
3955 - el.tabIndex = (_data$tabindex = data.tabindex) != null ? _data$tabindex : -1;
3956 - el.textContent = data.label || '';
3957 - return el;
3958 - }
3939 + append: true
3959 3940 }, userOptions);
3941 +
3942 + //options.className = 'remove-single';
3943 + var self = this;
3944 +
3945 + // override the render method to add remove button to each item
3946 + if (!options.append) {
3947 + return;
3948 + }
3949 + var html = '<a href="javascript:void(0)" class="' + options.className + '" tabindex="-1" title="' + escape_html(options.title) + '">' + options.label + '</a>';
3960 3950 self.hook('after', 'setupTemplates', () => {
3961 3951 var orig_render_item = self.settings.render.item;
3962 3952 self.settings.render.item = (data, escape) => {
3963 3953 var item = getDom(orig_render_item.call(self, data, escape));
3964 - var close_button = getDom(options.html(options));
3954 + var close_button = getDom(html);
3965 3955 item.appendChild(close_button);
3966 3956 addEvent(close_button, 'mousedown', evt => {
3967 3957 preventDefault(evt, true);
3968 3958 });
@@ -3998,9 +3988,9 @@
3998 3988 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3999 3989 /* harmony export */ "default": () => (/* binding */ plugin)
4000 3990 /* harmony export */ });
4001 3991 /**
4002 -* Tom Select v2.6.2
3992 +* Tom Select v2.4.3
4003 3993 * Licensed under the Apache License, Version 2.0 (the "License");
4004 3994 */
4005 3995
4006 3996 /**
@@ -4054,9 +4044,9 @@
4054 4044 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4055 4045 /* harmony export */ "default": () => (/* binding */ plugin)
4056 4046 /* harmony export */ });
4057 4047 /**
4058 -* Tom Select v2.6.2
4048 +* Tom Select v2.4.3
4059 4049 * Licensed under the Apache License, Version 2.0 (the "License");
4060 4050 */
4061 4051
4062 4052 /**
@@ -4138,9 +4128,9 @@
4138 4128 return arg;
4139 4129 };
4140 4130
4141 4131 /**
4142 - * Plugin: "virtual_scroll" (Tom Select)
4132 + * Plugin: "restore_on_backspace" (Tom Select)
4143 4133 * Copyright (c) contributors
4144 4134 *
4145 4135 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
4146 4136 * file except in compliance with the License. You may obtain a copy of the License at:
@@ -4162,12 +4152,8 @@
4162 4152 var dropdown_content;
4163 4153 var loading_more = false;
4164 4154 var load_more_opt;
4165 4155 var default_values = [];
4166 - var default_values_loaded = false;
4167 - var default_pagination;
4168 - var default_options = [];
4169 - var html_values = [];
4170 4156 if (!self.settings.shouldLoadMore) {
4171 4157 // return true if additional results should be loaded
4172 4158 self.settings.shouldLoadMore = () => {
4173 4159 const scroll_percent = dropdown_content.clientHeight / (dropdown_content.scrollHeight - dropdown_content.scrollTop);
@@ -4197,9 +4183,9 @@
4197 4183 }];
4198 4184
4199 4185 // can we load more results for given query?
4200 4186 const canLoadMore = query => {
4201 - if (self.settings.maxOptions !== null && typeof self.settings.maxOptions === 'number' && dropdown_content.children.length >= self.settings.maxOptions) {
4187 + if (typeof self.settings.maxOptions === 'number' && dropdown_content.children.length >= self.settings.maxOptions) {
4202 4188 return false;
4203 4189 }
4204 4190 if (query in pagination && pagination[query]) {
4205 4191 return true;
@@ -4257,13 +4243,9 @@
4257 4243
4258 4244 // wrap the load
4259 4245 self.hook('instead', 'loadCallback', (options, optgroups) => {
4260 4246 if (!loading_more) {
4261 - // When searching (non-empty query), keep selected items and HTML default options,
4262 - // but remove preloaded remote options so they don't bleed into search results.
4263 - // For empty query, use clearFilter (keeps default_values + items).
4264 - const activeFilter = self.lastValue !== '' ? (_option, value) => self.items.indexOf(value) >= 0 || html_values.indexOf(value) >= 0 : clearFilter;
4265 - self.clearOptions(activeFilter);
4247 + self.clearOptions(clearFilter);
4266 4248 } else if (load_more_opt) {
4267 4249 const first_option = options[0];
4268 4250 if (first_option !== undefined) {
4269 4251 load_more_opt.dataset.value = first_option[self.settings.valueField];
@@ -4269,31 +4251,11 @@
4269 4251 load_more_opt.dataset.value = first_option[self.settings.valueField];
4270 4252 }
4271 4253 }
4272 4254 orig_loadCallback.call(self, options, optgroups);
4273 -
4274 - // After the initial preload (empty query), snapshot default_values and option objects
4275 - // so they can be restored when the user clears their search.
4276 - if (!loading_more && !default_values_loaded) {
4277 - default_values_loaded = true;
4278 - if (self.lastValue === '') {
4279 - default_values = Object.keys(self.options);
4280 - default_pagination = pagination[''];
4281 - default_options = Object.values(self.options);
4282 - }
4283 - }
4284 4255 loading_more = false;
4285 4256 });
4286 4257
4287 - // as the “loading_more” element will be removed from the dropdown,
4288 - // we activate the previous option if needed
4289 - // to avoid the dropdown being scrolled back to the first one
4290 - self.hook('before', 'refreshOptions', () => {
4291 - if (self.activeOption && "option" !== self.activeOption.getAttribute("role")) {
4292 - self.setActiveOption(self.activeOption.previousElementSibling);
4293 - }
4294 - });
4295 -
4296 4258 // add templates to dropdown
4297 4259 // loading_more if we have another url in the queue
4298 4260 // no_more_results if we don't have another url in the queue
4299 4261 self.hook('after', 'refreshOptions', () => {
@@ -4317,32 +4279,10 @@
4317 4279 dropdown_content.append(option);
4318 4280 }
4319 4281 });
4320 4282
4321 - // Restore preloaded options and pagination when clearing search
4322 - const restoreDefaults = () => {
4323 - if (!default_values_loaded) {
4324 - return;
4325 - }
4326 - // Re-add preloaded option objects (clearOptions can only remove, not restore)
4327 - self.addOptions(default_options);
4328 - // Remove any search results that are not part of the preloaded defaults
4329 - self.clearOptions(clearFilter);
4330 - if (default_pagination) {
4331 - pagination[''] = default_pagination;
4332 - }
4333 - };
4334 - self.on('type', query => {
4335 - if (query === '') {
4336 - restoreDefaults();
4337 - self.refreshOptions(false);
4338 - }
4339 - });
4340 - self.on('dropdown_close', restoreDefaults);
4341 -
4342 4283 // add scroll listener and default templates
4343 4284 self.on('initialize', () => {
4344 - html_values = Object.keys(self.options);
4345 4285 default_values = Object.keys(self.options);
4346 4286 dropdown_content = self.dropdown_content;
4347 4287
4348 4288 // default templates
@@ -4480,9 +4420,8 @@
4480 4420 this.isLocked = false;
4481 4421 this.isFocused = false;
4482 4422 this.isInputHidden = false;
4483 4423 this.isSetup = false;
4484 - this.isDropdownContentStale = true;
4485 4424 this.ignoreFocus = false;
4486 4425 this.ignoreHover = false;
4487 4426 this.hasOptions = false;
4488 4427 this.lastValue = '';
@@ -4557,9 +4496,9 @@
4557 4496 (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.addClasses)(dropdown, settings.dropdownClass, inputMode);
4558 4497 if (settings.copyClassesToDropdown) {
4559 4498 (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.addClasses)(dropdown, classes);
4560 4499 }
4561 - ;(0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.addClasses)(dropdown_content, settings.dropdownContentClass);
4500 + (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.addClasses)(dropdown_content, settings.dropdownContentClass);
4562 4501 (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.append)(dropdown, dropdown_content);
4563 4502 (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.getDom)(settings.dropdownParent || wrapper).appendChild(dropdown);
4564 4503 // default controlInput
4565 4504 if ((0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.isHtmlString)(settings.controlInput)) {
@@ -4564,9 +4503,9 @@
4564 4503 // default controlInput
4565 4504 if ((0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.isHtmlString)(settings.controlInput)) {
4566 4505 control_input = (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.getDom)(settings.controlInput);
4567 4506 // set attributes
4568 - var attrs = ['autocorrect', 'autocapitalize', 'autocomplete', 'spellcheck', 'aria-label'];
4507 + var attrs = ['autocorrect', 'autocapitalize', 'autocomplete', 'spellcheck'];
4569 4508 (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.iterate)(attrs, (attr) => {
4570 4509 if (input.getAttribute(attr)) {
4571 4510 (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.setAttr)(control_input, { [attr]: input.getAttribute(attr) });
4572 4511 }
@@ -4627,10 +4566,8 @@
4627 4566 (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.setAttr)(focus_node, { 'aria-labelledby': label_id });
4628 4567 (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.setAttr)(dropdown_content, { 'aria-labelledby': label_id });
4629 4568 }
4630 4569 wrapper.style.width = input.style.width;
4631 - wrapper.style.minWidth = input.style.minWidth;
4632 - wrapper.style.maxWidth = input.style.maxWidth;
4633 4570 if (self.plugins.names.length) {
4634 4571 const classes_plugins = 'plugin-' + self.plugins.names.join(' plugin-');
4635 4572 (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.addClasses)([wrapper, dropdown], classes_plugins);
4636 4573 }
@@ -4648,9 +4585,9 @@
4648 4585 // after initializePlugins() so plugins can create/modify user defined loaders
4649 4586 if (settings.load && settings.loadThrottle) {
4650 4587 settings.load = (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.loadDebounce)(settings.load, settings.loadThrottle);
4651 4588 }
4652 - ;(0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.addEvent)(dropdown, 'mousemove', () => {
4589 + (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.addEvent)(dropdown, 'mousemove', () => {
4653 4590 self.ignoreHover = false;
4654 4591 });
4655 4592 (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.addEvent)(dropdown, 'mouseenter', (e) => {
4656 4593 var target_match = (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.parentMatch)(e.target, '[data-selectable]', dropdown);
@@ -4713,21 +4650,12 @@
4713 4650 if (self.isOpen) {
4714 4651 self.positionDropdown();
4715 4652 }
4716 4653 };
4717 - const input_invalid = () => {
4718 - if (self.isValid) {
4719 - self.isValid = false;
4720 - self.isInvalid = true;
4721 - self.refreshState();
4722 - }
4723 - };
4724 - (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.addEvent)(input, 'invalid', input_invalid);
4725 4654 (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.addEvent)(document, 'mousedown', doc_mousedown);
4726 4655 (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.addEvent)(window, 'scroll', win_scroll, passive_event);
4727 4656 (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.addEvent)(window, 'resize', win_scroll, passive_event);
4728 4657 this._destroy = () => {
4729 - input.removeEventListener('invalid', input_invalid);
4730 4658 document.removeEventListener('mousedown', doc_mousedown);
4731 4659 window.removeEventListener('scroll', win_scroll);
4732 4660 window.removeEventListener('resize', win_scroll);
4733 4661 if (label)
@@ -4744,12 +4672,29 @@
4744 4672 self.sync(false);
4745 4673 settings.items = [];
4746 4674 delete settings.optgroups;
4747 4675 delete settings.options;
4676 + (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.addEvent)(input, 'invalid', () => {
4677 + if (self.isValid) {
4678 + self.isValid = false;
4679 + self.isInvalid = true;
4680 + self.refreshState();
4681 + }
4682 + });
4683 + self.updateOriginalInput();
4748 4684 self.refreshItems();
4749 4685 self.close(false);
4750 4686 self.inputState();
4751 4687 self.isSetup = true;
4688 + if (input.disabled) {
4689 + self.disable();
4690 + }
4691 + else if (input.readOnly) {
4692 + self.setReadOnly(true);
4693 + }
4694 + else {
4695 + self.enable(); //sets tabIndex
4696 + }
4752 4697 self.on('change', this.onChange);
4753 4698 (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.addClasses)(input, 'tomselected', 'ts-hidden-accessible');
4754 4699 self.trigger('initialize');
4755 4700 // preload options
@@ -4845,20 +4790,11 @@
4845 4790 *
4846 4791 */
4847 4792 sync(get_settings = true) {
4848 4793 const self = this;
4849 - const settings = get_settings ? (0,_getSettings_js__WEBPACK_IMPORTED_MODULE_6__["default"])(self.input, { delimiter: self.settings.delimiter, allowEmptyOption: self.settings.allowEmptyOption }) : self.settings;
4794 + const settings = get_settings ? (0,_getSettings_js__WEBPACK_IMPORTED_MODULE_6__["default"])(self.input, { delimiter: self.settings.delimiter }) : self.settings;
4850 4795 self.setupOptions(settings.options, settings.optgroups);
4851 4796 self.setValue(settings.items || [], true); // silent prevents recursion
4852 - if (self.input.disabled) {
4853 - self.disable();
4854 - }
4855 - else if (self.input.readOnly) {
4856 - self.setReadOnly(true);
4857 - }
4858 - else {
4859 - self.enable(); //sets tabIndex
4860 - }
4861 4797 self.lastQuery = null; // so updated options will be displayed in dropdown
4862 4798 }
4863 4799 /**
4864 4800 * Triggered when the main control element
@@ -4889,9 +4825,9 @@
4889 4825 * This should propagate the event to the original DOM
4890 4826 * input / select element.
4891 4827 */
4892 4828 onChange() {
4893 - ;(0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.triggerEvent)(this.input, 'input');
4829 + (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.triggerEvent)(this.input, 'input');
4894 4830 (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.triggerEvent)(this.input, 'change');
4895 4831 }
4896 4832 /**
4897 4833 * Triggered on <input> paste.
@@ -4986,9 +4922,9 @@
4986 4922 let next = self.getAdjacent(self.activeOption, 1);
4987 4923 if (next)
4988 4924 self.setActiveOption(next);
4989 4925 }
4990 - ;(0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.preventDefault)(e);
4926 + (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.preventDefault)(e);
4991 4927 return;
4992 4928 // up: move selection up
4993 4929 case _constants_js__WEBPACK_IMPORTED_MODULE_5__.KEY_UP:
4994 4930 if (self.activeOption) {
@@ -4995,9 +4931,9 @@
4995 4931 let prev = self.getAdjacent(self.activeOption, -1);
4996 4932 if (prev)
4997 4933 self.setActiveOption(prev);
4998 4934 }
4999 - ;(0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.preventDefault)(e);
4935 + (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.preventDefault)(e);
5000 4936 return;
5001 4937 // return: select active option
5002 4938 case _constants_js__WEBPACK_IMPORTED_MODULE_5__.KEY_RETURN:
5003 4939 if (self.canSelect(self.activeOption)) {
@@ -5029,9 +4965,9 @@
5029 4965 // prevent default [tab] behaviour of jump to the next field
5030 4966 // if select isFull, then the dropdown won't be open and [tab] will work normally
5031 4967 (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.preventDefault)(e);
5032 4968 }
5033 - else if (self.settings.create && self.createItem()) {
4969 + if (self.settings.create && self.createItem()) {
5034 4970 (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.preventDefault)(e);
5035 4971 }
5036 4972 }
5037 4973 return;
@@ -5153,24 +5089,18 @@
5153 5089 self.createItem(null, () => {
5154 5090 if (self.settings.closeAfterSelect) {
5155 5091 self.close();
5156 5092 }
5157 - else if (self.settings.clearAfterSelect) {
5158 - self.setTextboxValue();
5159 - }
5160 5093 });
5161 5094 }
5162 5095 else {
5163 5096 value = option.dataset.value;
5164 5097 if (typeof value !== 'undefined') {
5165 - self.isDropdownContentStale = self.settings.hideSelected;
5098 + self.lastQuery = null;
5166 5099 self.addItem(value);
5167 5100 if (self.settings.closeAfterSelect) {
5168 5101 self.close();
5169 5102 }
5170 - else if (self.settings.clearAfterSelect) {
5171 - self.setTextboxValue();
5172 - }
5173 5103 if (!self.settings.hideSelected && evt.type && /click/.test(evt.type)) {
5174 5104 self.setActiveOption(option);
5175 5105 }
5176 5106 }
@@ -5242,9 +5172,9 @@
5242 5172 */
5243 5173 loadCallback(options, optgroups) {
5244 5174 const self = this;
5245 5175 self.loading = Math.max(self.loading - 1, 0);
5246 - self.isDropdownContentStale = true;
5176 + self.lastQuery = null;
5247 5177 self.clearActiveOption(); // when new results load, focus should be on first option
5248 5178 self.setupOptions(options, optgroups);
5249 5179 self.refreshOptions(self.isFocused && !self.isInputHidden);
5250 5180 if (!self.loading) {
@@ -5341,9 +5271,9 @@
5341 5271 if (self.activeItems.indexOf(item) === -1) {
5342 5272 self.setActiveItemClass(item);
5343 5273 }
5344 5274 }
5345 - ;(0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.preventDefault)(e);
5275 + (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.preventDefault)(e);
5346 5276 }
5347 5277 else if ((eventName === 'click' && (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.isKeyDown)(_constants_js__WEBPACK_IMPORTED_MODULE_5__.KEY_SHORTCUT, e)) || (eventName === 'keydown' && (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.isKeyDown)('shiftKey', e))) {
5348 5278 if (item.classList.contains('active')) {
5349 5279 self.removeActiveItem(item);
@@ -5390,9 +5320,9 @@
5390 5320 * Clears all the active items
5391 5321 *
5392 5322 */
5393 5323 clearActiveItems() {
5394 - ;(0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.removeClasses)(this.activeItems, 'active');
5324 + (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.removeClasses)(this.activeItems, 'active');
5395 5325 this.activeItems = [];
5396 5326 }
5397 5327 /**
5398 5328 * Sets the selected item in the dropdown menu
@@ -5507,21 +5437,17 @@
5507 5437 var self = this;
5508 5438 if (self.isDisabled || self.isReadOnly)
5509 5439 return;
5510 5440 self.ignoreFocus = true;
5511 - const focusTarget = this.control_input.offsetWidth ? this.control_input : this.focus_node;
5512 - focusTarget.focus();
5441 + if (self.control_input.offsetWidth) {
5442 + self.control_input.focus();
5443 + }
5444 + else {
5445 + self.focus_node.focus();
5446 + }
5513 5447 setTimeout(() => {
5514 5448 self.ignoreFocus = false;
5515 - // Fix https://github.com/orchidjs/tom-select/issues/806
5516 - // Only proceed if this instance's element is still the active element. If Edge autofill
5517 - // (or anything else) has moved focus to a different element in the interim, calling
5518 - // onFocus() here would steal focus back and restart the cascade loop.
5519 - const root = focusTarget.getRootNode();
5520 - if (root.activeElement !== focusTarget) {
5521 - return;
5522 - }
5523 - this.onFocus();
5449 + self.onFocus();
5524 5450 }, 0);
5525 5451 }
5526 5452 /**
5527 5453 * Forces the control out of focus.
@@ -5577,15 +5503,10 @@
5577 5503 throw new Error('Tom Select "score" setting must be a function that returns a function');
5578 5504 }
5579 5505 }
5580 5506 // perform search
5581 - if (self.isDropdownContentStale || query !== self.lastQuery) {
5507 + if (query !== self.lastQuery) {
5582 5508 self.lastQuery = query;
5583 - // temp fix for https://github.com/orchidjs/tom-select/issues/987
5584 - // UI crashed when more than 30 same chars in a row, prevent search and return empt result
5585 - if (/(.)\1{15,}/.test(query)) {
5586 - query = '';
5587 - }
5588 5509 result = self.sifter.search(query, Object.assign(options, { score: calculateScore }));
5589 5510 self.currentResults = result;
5590 5511 }
5591 5512 else {
@@ -5594,9 +5515,9 @@
5594 5515 // filter out selected items
5595 5516 if (self.settings.hideSelected) {
5596 5517 result.items = result.items.filter((item) => {
5597 5518 let hashed = (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.hash_key)(item.id);
5598 - return !(hashed !== null && self.items.indexOf(hashed) !== -1);
5519 + return !(hashed && self.items.indexOf(hashed) !== -1);
5599 5520 });
5600 5521 }
5601 5522 return result;
5602 5523 }
@@ -5666,15 +5587,8 @@
5666 5587 for (j = 0, k = optgroups && optgroups.length; j < k; j++) {
5667 5588 optgroup = optgroups[j];
5668 5589 let order = option.$order;
5669 5590 let self_optgroup = self.optgroups[optgroup];
5670 - if (self_optgroup === undefined && typeof self.settings.optionGroupRegister === 'function') {
5671 - var regGroup;
5672 - if (regGroup = self.settings.optionGroupRegister.apply(self, [optgroup])) {
5673 - self.registerOptionGroup(regGroup);
5674 - }
5675 - }
5676 - self_optgroup = self.optgroups[optgroup];
5677 5591 if (self_optgroup === undefined) {
5678 5592 optgroup = '';
5679 5593 }
5680 5594 else {
@@ -5727,9 +5641,8 @@
5727 5641 }
5728 5642 });
5729 5643 dropdown_content.innerHTML = '';
5730 5644 (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.append)(dropdown_content, html);
5731 - self.isDropdownContentStale = false;
5732 5645 // highlight matching terms inline
5733 5646 if (self.settings.highlight) {
5734 5647 (0,_contrib_highlight_js__WEBPACK_IMPORTED_MODULE_4__.removeHighlight)(dropdown_content);
5735 5648 if (results.query.length && results.tokens.length) {
@@ -5822,15 +5735,14 @@
5822 5735 return false;
5823 5736 }
5824 5737 const key = (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.hash_key)(data[self.settings.valueField]);
5825 5738 if (key === null || self.options.hasOwnProperty(key)) {
5826 - self.updateOption(data[self.settings.valueField], data);
5827 5739 return false;
5828 5740 }
5829 5741 data.$order = data.$order || ++self.order;
5830 5742 data.$id = self.inputId + '-opt-' + data.$order;
5831 5743 self.options[key] = data;
5832 - self.isDropdownContentStale = true;
5744 + self.lastQuery = null;
5833 5745 if (user_created) {
5834 5746 self.userOptions[key] = user_created;
5835 5747 self.trigger('option_add', key, data);
5836 5748 }
@@ -5840,9 +5752,9 @@
5840 5752 * Add multiple options
5841 5753 *
5842 5754 */
5843 5755 addOptions(data, user_created = false) {
5844 - ;(0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.iterate)(data, (dat) => {
5756 + (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.iterate)(data, (dat) => {
5845 5757 this.addOption(dat, user_created);
5846 5758 });
5847 5759 }
5848 5760 /**
@@ -5944,10 +5856,10 @@
5944 5856 if (item.classList.contains('active'))
5945 5857 (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.addClasses)(item_new, 'active');
5946 5858 (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.replaceNode)(item, item_new);
5947 5859 }
5948 - // we might have updated the sortField
5949 - self.isDropdownContentStale = true;
5860 + // invalidate last query because we might have updated the sortField
5861 + self.lastQuery = null;
5950 5862 }
5951 5863 /**
5952 5864 * Removes a single option.
5953 5865 *
@@ -5957,9 +5869,9 @@
5957 5869 value = (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.get_hash)(value);
5958 5870 self.uncacheValue(value);
5959 5871 delete self.userOptions[value];
5960 5872 delete self.options[value];
5961 - self.isDropdownContentStale = true;
5873 + self.lastQuery = null;
5962 5874 self.trigger('option_remove', value);
5963 5875 self.removeItem(value, silent);
5964 5876 }
5965 5877 /**
@@ -5976,9 +5888,9 @@
5976 5888 selected[key] = option;
5977 5889 }
5978 5890 });
5979 5891 this.options = this.sifter.items = selected;
5980 - this.isDropdownContentStale = true;
5892 + this.lastQuery = null;
5981 5893 this.trigger('option_clear');
5982 5894 }
5983 5895 /**
5984 5896 * Used by clearOptions() to decide whether or not an option should be removed
@@ -6108,12 +6020,8 @@
6108 6020 if (next) {
6109 6021 self.setActiveOption(next);
6110 6022 }
6111 6023 }
6112 - //remove input value when enabled
6113 - if (self.settings.clearAfterSelect) {
6114 - self.setTextboxValue();
6115 - }
6116 6024 // refreshOptions after setActiveOption(),
6117 6025 // otherwise setActiveOption() will be called by refreshOptions() with the wrong value
6118 6026 if (!self.isPending && !self.settings.closeAfterSelect) {
6119 6027 self.refreshOptions(self.isFocused && inputMode !== 'single');
@@ -6155,9 +6063,9 @@
6155 6063 self.activeItems.splice(idx, 1);
6156 6064 (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.removeClasses)(item, 'active');
6157 6065 }
6158 6066 self.items.splice(i, 1);
6159 - self.isDropdownContentStale = true;
6067 + self.lastQuery = null;
6160 6068 if (!self.settings.persist && self.userOptions.hasOwnProperty(value)) {
6161 6069 self.removeOption(value, silent);
6162 6070 }
6163 6071 if (i < self.caretPos) {
@@ -6189,14 +6097,8 @@
6189 6097 var caret = self.caretPos;
6190 6098 var output;
6191 6099 input = input || self.inputValue();
6192 6100 if (!self.canCreate(input)) {
6193 - const hash = (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.hash_key)(input);
6194 - if (hash) {
6195 - if (this.options[input]) {
6196 - self.addItem(input);
6197 - }
6198 - }
6199 6101 callback();
6200 6102 return false;
6201 6103 }
6202 6104 self.lock();
@@ -6234,9 +6136,9 @@
6234 6136 * Re-renders the selected item lists.
6235 6137 */
6236 6138 refreshItems() {
6237 6139 var self = this;
6238 - self.isDropdownContentStale = true;
6140 + self.lastQuery = null;
6239 6141 if (self.isSetup) {
6240 6142 self.addItems(self.items);
6241 6143 }
6242 6144 self.updateOriginalInput();
@@ -6313,9 +6215,9 @@
6313 6215 }
6314 6216 selected.push(option_el);
6315 6217 // marking empty option as selected can break validation
6316 6218 // fixes https://github.com/orchidjs/tom-select/issues/303
6317 - if (option_el != empty_option || has_selected > 0 || self.settings.mode == 'multi') {
6219 + if (option_el != empty_option || has_selected > 0) {
6318 6220 option_el.selected = true;
6319 6221 }
6320 6222 return option_el;
6321 6223 }
@@ -6456,9 +6358,9 @@
6456 6358 caret = (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.nodeIndex)(tail);
6457 6359 if (direction > 0) {
6458 6360 caret++;
6459 6361 }
6460 - ;(0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.iterate)(self.activeItems, (item) => rm_items.push(item));
6362 + (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.iterate)(self.activeItems, (item) => rm_items.push(item));
6461 6363 }
6462 6364 else if ((self.isFocused || self.settings.mode === 'single') && self.items.length) {
6463 6365 const items = self.controlChildren();
6464 6366 let rm_item;
@@ -6474,9 +6376,9 @@
6474 6376 }
6475 6377 if (!self.shouldDelete(rm_items, e)) {
6476 6378 return false;
6477 6379 }
6478 - ;(0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.preventDefault)(e, true);
6380 + (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.preventDefault)(e, true);
6479 6381 // perform removal
6480 6382 if (typeof caret !== 'undefined') {
6481 6383 self.setCaret(caret);
6482 6384 }
@@ -6493,9 +6395,9 @@
6493 6395 */
6494 6396 shouldDelete(items, evt) {
6495 6397 const values = items.map(item => item.dataset.value);
6496 6398 // allow the callback to abort
6497 - if (!values.length || (typeof this.settings.onDelete === 'function' && this.settings.onDelete.call(this, values, evt) === false)) {
6399 + if (!values.length || (typeof this.settings.onDelete === 'function' && this.settings.onDelete(values, evt) === false)) {
6498 6400 return false;
6499 6401 }
6500 6402 return true;
6501 6403 }
@@ -6712,9 +6614,9 @@
6712 6614 * caches.
6713 6615 *
6714 6616 */
6715 6617 clearCache() {
6716 - ;(0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.iterate)(this.options, (option) => {
6618 + (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.iterate)(this.options, (option) => {
6717 6619 if (option.$div) {
6718 6620 option.$div.remove();
6719 6621 delete option.$div;
6720 6622 }
@@ -7191,19 +7093,19 @@
7191 7093
7192 7094 /******/ });
7193 7095 /************************************************************************/
7194 7096 /******/ // The module cache
7195 -/******/ const __webpack_module_cache__ = {};
7097 +/******/ var __webpack_module_cache__ = {};
7196 7098 /******/
7197 7099 /******/ // The require function
7198 7100 /******/ function __webpack_require__(moduleId) {
7199 7101 /******/ // Check if module is in cache
7200 -/******/ const cachedModule = __webpack_module_cache__[moduleId];
7102 +/******/ var cachedModule = __webpack_module_cache__[moduleId];
7201 7103 /******/ if (cachedModule !== undefined) {
7202 7104 /******/ return cachedModule.exports;
7203 7105 /******/ }
7204 7106 /******/ // Create a new module (and put it into the cache)
7205 -/******/ const module = __webpack_module_cache__[moduleId] = {
7107 +/******/ var module = __webpack_module_cache__[moduleId] = {
7206 7108 /******/ // no module.id needed
7207 7109 /******/ // no module.loaded needed
7208 7110 /******/ exports: {}
7209 7111 /******/ };
@@ -7210,9 +7112,9 @@
7210 7112 /******/
7211 7113 /******/ // Execute the module function
7212 7114 /******/ if (!(moduleId in __webpack_modules__)) {
7213 7115 /******/ delete __webpack_module_cache__[moduleId];
7214 -/******/ const e = new Error("Cannot find module '" + moduleId + "'");
7116 +/******/ var e = new Error("Cannot find module '" + moduleId + "'");
7215 7117 /******/ e.code = 'MODULE_NOT_FOUND';
7216 7118 /******/ throw e;
7217 7119 /******/ }
7218 7120 /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
@@ -7223,29 +7125,14 @@
7223 7125 /******/
7224 7126 /************************************************************************/
7225 7127 /******/ /* webpack/runtime/define property getters */
7226 7128 /******/ (() => {
7227 -/******/ // define getter/value functions for harmony exports
7129 +/******/ // define getter functions for harmony exports
7228 7130 /******/ __webpack_require__.d = (exports, definition) => {
7229 -/******/ if(Array.isArray(definition)) {
7230 -/******/ var i = 0;
7231 -/******/ while(i < definition.length) {
7232 -/******/ var key = definition[i++];
7233 -/******/ var binding = definition[i++];
7234 -/******/ if(!__webpack_require__.o(exports, key)) {
7235 -/******/ if(binding === 0) {
7236 -/******/ Object.defineProperty(exports, key, { enumerable: true, value: definition[i++] });
7237 -/******/ } else {
7238 -/******/ Object.defineProperty(exports, key, { enumerable: true, get: binding });
7239 -/******/ }
7240 -/******/ } else if(binding === 0) { i++; }
7131 +/******/ for(var key in definition) {
7132 +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
7133 +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
7241 7134 /******/ }
7242 -/******/ } else {
7243 -/******/ for(var key in definition) {
7244 -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
7245 -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
7246 -/******/ }
7247 -/******/ }
7248 7135 /******/ }
7249 7136 /******/ };
7250 7137 /******/ })();
7251 7138 /******/
@@ -7250,9 +7137,9 @@
7250 7137 /******/ })();
7251 7138 /******/
7252 7139 /******/ /* webpack/runtime/hasOwnProperty shorthand */
7253 7140 /******/ (() => {
7254 -/******/ __webpack_require__.o = (obj, prop) => (Object.hasOwn(obj, prop))
7141 +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
7255 7142 /******/ })();
7256 7143 /******/
7257 7144 /******/ /* webpack/runtime/make namespace object */
7258 7145 /******/ (() => {
@@ -7257,9 +7144,9 @@
7257 7144 /******/ /* webpack/runtime/make namespace object */
7258 7145 /******/ (() => {
7259 7146 /******/ // define __esModule on exports
7260 7147 /******/ __webpack_require__.r = (exports) => {
7261 -/******/ if(Symbol.toStringTag) {
7148 +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
7262 7149 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
7263 7150 /******/ }
7264 7151 /******/ Object.defineProperty(exports, '__esModule', { value: true });
7265 7152 /******/ };
@@ -7265,9 +7152,9 @@
7265 7152 /******/ };
7266 7153 /******/ })();
7267 7154 /******/
7268 7155 /************************************************************************/
7269 -let __webpack_exports__ = {};
7156 +var __webpack_exports__ = {};
7270 7157 // This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
7271 7158 (() => {
7272 7159 /*!********************************************!*\
7273 7160 !*** ./assets/src/js/admin/admin-tools.js ***!