| @@ -1,6 +1,5 @@ | ||
| 1 | 1 | /******/ (() => { // webpackBootstrap |
| 2 | -/******/ "use strict"; | |
| 3 | 2 | /******/ var __webpack_modules__ = ({ |
| 4 | 3 | |
| 5 | 4 | /***/ "./assets/src/js/admin/init-tom-select.js" |
| 6 | 5 | /*!************************************************!*\ |
| @@ -7,8 +6,9 @@ | ||
| 7 | 6 | !*** ./assets/src/js/admin/init-tom-select.js ***! |
| 8 | 7 | \************************************************/ |
| 9 | 8 | (__unused_webpack_module, __webpack_exports__, __webpack_require__) { |
| 10 | 9 | |
| 10 | +"use strict"; | |
| 11 | 11 | __webpack_require__.r(__webpack_exports__); |
| 12 | 12 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 13 | 13 | /* harmony export */ initElsTomSelect: () => (/* binding */ initElsTomSelect), |
| 14 | 14 | /* harmony export */ initTomSelect: () => (/* binding */ initTomSelect), |
| @@ -250,8 +250,319 @@ | ||
| 250 | 250 | |
| 251 | 251 | |
| 252 | 252 | /***/ }, |
| 253 | 253 | |
| 254 | +/***/ "./assets/src/js/admin/share/dropdown-pages.js" | |
| 255 | +/*!*****************************************************!*\ | |
| 256 | + !*** ./assets/src/js/admin/share/dropdown-pages.js ***! | |
| 257 | + \*****************************************************/ | |
| 258 | +(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 259 | + | |
| 260 | +"use strict"; | |
| 261 | +__webpack_require__.r(__webpack_exports__); | |
| 262 | +/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 263 | +/* harmony export */ DropdownPages: () => (/* binding */ DropdownPages) | |
| 264 | +/* harmony export */ }); | |
| 265 | +/* harmony import */ var lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lpAssetsJsPath/utils.js */ "./assets/src/js/utils.js"); | |
| 266 | +/* harmony import */ var lpAssetsJsPath_lpToastify_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lpAssetsJsPath/lpToastify.js */ "./assets/src/js/lpToastify.js"); | |
| 267 | +/** | |
| 268 | + * Dropdown Pages | |
| 269 | + * | |
| 270 | + * @since 4.2.5.1 | |
| 271 | + * @version 1.0.0 | |
| 272 | + */ | |
| 273 | + | |
| 274 | + | |
| 275 | +class DropdownPages { | |
| 276 | + static selectors = { | |
| 277 | + elDropdown: '.learn-press-dropdown-pages', | |
| 278 | + elSelect: 'select', | |
| 279 | + elListWrap: '.list-pages-wrapper', | |
| 280 | + elActions: '.quick-add-page-actions', | |
| 281 | + elForm: '.quick-add-page-inline', | |
| 282 | + elButtonQuickAdd: '.button-quick-add-page', | |
| 283 | + elInput: '.quick-add-page-inline input[type="text"]', | |
| 284 | + elButtonSubmit: '.quick-add-page-inline button', | |
| 285 | + elButtonCancel: '.quick-add-page-inline a' | |
| 286 | + }; | |
| 287 | + constructor() { | |
| 288 | + this.elDropdowns = []; | |
| 289 | + } | |
| 290 | + init() { | |
| 291 | + this.elDropdowns = document.querySelectorAll(DropdownPages.selectors.elDropdown); | |
| 292 | + if (!this.elDropdowns.length) { | |
| 293 | + return; | |
| 294 | + } | |
| 295 | + this.events(); | |
| 296 | + } | |
| 297 | + events() { | |
| 298 | + // Check and attach events only once | |
| 299 | + if (DropdownPages._loadedEvents) { | |
| 300 | + return; | |
| 301 | + } | |
| 302 | + DropdownPages._loadedEvents = this; | |
| 303 | + | |
| 304 | + // Change events | |
| 305 | + lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.eventHandlers('change', [{ | |
| 306 | + selector: DropdownPages.selectors.elDropdown, | |
| 307 | + class: this, | |
| 308 | + callBack: this.handleChangeSelect.name | |
| 309 | + }]); | |
| 310 | + | |
| 311 | + // Click events | |
| 312 | + lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.eventHandlers('click', [{ | |
| 313 | + selector: DropdownPages.selectors.elButtonSubmit, | |
| 314 | + class: this, | |
| 315 | + callBack: this.handleSubmit.name | |
| 316 | + }, { | |
| 317 | + selector: DropdownPages.selectors.elButtonCancel, | |
| 318 | + class: this, | |
| 319 | + callBack: this.handleCancel.name | |
| 320 | + }, { | |
| 321 | + selector: DropdownPages.selectors.elButtonQuickAdd, | |
| 322 | + class: this, | |
| 323 | + callBack: this.handleQuickAdd.name | |
| 324 | + }]); | |
| 325 | + | |
| 326 | + // Keydown events | |
| 327 | + lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.eventHandlers('keydown', [{ | |
| 328 | + selector: DropdownPages.selectors.elInput, | |
| 329 | + class: this, | |
| 330 | + callBack: this.handleInputEnter.name, | |
| 331 | + checkIsEventEnter: true | |
| 332 | + }, { | |
| 333 | + selector: DropdownPages.selectors.elInput, | |
| 334 | + class: this, | |
| 335 | + callBack: this.handleInputEscape.name | |
| 336 | + }]); | |
| 337 | + } | |
| 338 | + handleChangeSelect(args) { | |
| 339 | + const { | |
| 340 | + e | |
| 341 | + } = args; | |
| 342 | + const elSelect = e.target; | |
| 343 | + if (!elSelect.matches(DropdownPages.selectors.elSelect)) { | |
| 344 | + return; | |
| 345 | + } | |
| 346 | + const elDropdown = elSelect.closest(DropdownPages.selectors.elDropdown); | |
| 347 | + if (!elDropdown) { | |
| 348 | + return; | |
| 349 | + } | |
| 350 | + const elActions = elDropdown.querySelector(DropdownPages.selectors.elActions); | |
| 351 | + if (elActions) { | |
| 352 | + elActions.classList.add('hide-if-js'); | |
| 353 | + } | |
| 354 | + if (parseInt(elSelect.value, 10)) { | |
| 355 | + if (elActions) { | |
| 356 | + const editLink = elActions.querySelector('a.edit-page'); | |
| 357 | + const viewLink = elActions.querySelector('a.view-page'); | |
| 358 | + if (editLink) { | |
| 359 | + editLink.href = `post.php?post=${elSelect.value}&action=edit`; | |
| 360 | + } | |
| 361 | + if (viewLink) { | |
| 362 | + viewLink.href = `${window.lpGlobalSettings.siteurl}?page_id=${elSelect.value}`; | |
| 363 | + } | |
| 364 | + elActions.classList.remove('hide-if-js'); | |
| 365 | + } | |
| 366 | + elSelect.setAttribute('data-selected', elSelect.value); | |
| 367 | + } | |
| 368 | + } | |
| 369 | + openQuickAddForm(elDropdown) { | |
| 370 | + const elListWrap = elDropdown.querySelector(DropdownPages.selectors.elListWrap); | |
| 371 | + const elForm = elDropdown.querySelector(DropdownPages.selectors.elForm); | |
| 372 | + if (elListWrap) { | |
| 373 | + elListWrap.classList.add('hide-if-js'); | |
| 374 | + } | |
| 375 | + if (elForm) { | |
| 376 | + elForm.classList.remove('hide-if-js'); | |
| 377 | + const elInput = elForm.querySelector('input'); | |
| 378 | + if (elInput) { | |
| 379 | + elInput.value = ''; | |
| 380 | + elInput.focus(); | |
| 381 | + } | |
| 382 | + } | |
| 383 | + } | |
| 384 | + handleSubmit(args) { | |
| 385 | + const { | |
| 386 | + e | |
| 387 | + } = args; | |
| 388 | + e.preventDefault(); | |
| 389 | + const elButton = e.target.closest(DropdownPages.selectors.elButtonSubmit); | |
| 390 | + if (!elButton) { | |
| 391 | + return; | |
| 392 | + } | |
| 393 | + const elForm = elButton.closest(DropdownPages.selectors.elForm); | |
| 394 | + if (!elForm) { | |
| 395 | + return; | |
| 396 | + } | |
| 397 | + const elDropdown = elForm.closest(DropdownPages.selectors.elDropdown); | |
| 398 | + if (!elDropdown) { | |
| 399 | + return; | |
| 400 | + } | |
| 401 | + const elInput = elForm.querySelector('input'); | |
| 402 | + const elListWrap = elDropdown.querySelector(DropdownPages.selectors.elListWrap); | |
| 403 | + const pageName = elInput ? elInput.value.trim() : ''; | |
| 404 | + if (!pageName) { | |
| 405 | + alert('Please enter the name of page'); | |
| 406 | + if (elInput) { | |
| 407 | + elInput.focus(); | |
| 408 | + } | |
| 409 | + return; | |
| 410 | + } | |
| 411 | + elButton.disabled = true; | |
| 412 | + let fieldName = ''; | |
| 413 | + const elFieldName = elDropdown.querySelector('select'); | |
| 414 | + fieldName = elFieldName ? elFieldName.name : ''; | |
| 415 | + if (!window.lpGlobalSettings || !window.lpGlobalSettings.ajax || !window.lpDataAdmin || !window.lpDataAdmin.nonce) { | |
| 416 | + elButton.disabled = false; | |
| 417 | + return; | |
| 418 | + } | |
| 419 | + const formData = new FormData(); | |
| 420 | + formData.append('action', 'learnpress_create_page'); | |
| 421 | + formData.append('page_name', pageName); | |
| 422 | + formData.append('field_name', fieldName); | |
| 423 | + formData.append('nonce', window.lpDataAdmin.nonce); | |
| 424 | + fetch(window.lpGlobalSettings.ajax, { | |
| 425 | + method: 'POST', | |
| 426 | + body: formData | |
| 427 | + }).then(response => response.json()).then(response => { | |
| 428 | + const { | |
| 429 | + message, | |
| 430 | + status, | |
| 431 | + data | |
| 432 | + } = response; | |
| 433 | + if (status === 'success') { | |
| 434 | + elForm.classList.add('hide-if-js'); | |
| 435 | + lpAssetsJsPath_lpToastify_js__WEBPACK_IMPORTED_MODULE_1__.show(message, 'success'); | |
| 436 | + setTimeout(() => { | |
| 437 | + window.location.reload(); | |
| 438 | + }, 1000); | |
| 439 | + } else { | |
| 440 | + throw new Error(message); | |
| 441 | + } | |
| 442 | + }).catch(error => { | |
| 443 | + lpAssetsJsPath_lpToastify_js__WEBPACK_IMPORTED_MODULE_1__.show(error.message, 'error'); | |
| 444 | + }).finally(() => { | |
| 445 | + elButton.disabled = false; | |
| 446 | + if (elListWrap) { | |
| 447 | + elListWrap.classList.remove('hide-if-js'); | |
| 448 | + } | |
| 449 | + }); | |
| 450 | + } | |
| 451 | + addNewPageToList(args) { | |
| 452 | + const { | |
| 453 | + ID, | |
| 454 | + name, | |
| 455 | + positions | |
| 456 | + } = args; | |
| 457 | + const option = document.createElement('option'); | |
| 458 | + option.value = ID; | |
| 459 | + option.textContent = name; | |
| 460 | + const position = positions.indexOf(ID + ''); | |
| 461 | + document.querySelectorAll(`${DropdownPages.selectors.elDropdown} ${DropdownPages.selectors.elSelect}`).forEach(select => { | |
| 462 | + const newOption = option.cloneNode(true); | |
| 463 | + if (position === 0) { | |
| 464 | + const options = select.querySelectorAll('option'); | |
| 465 | + for (const opt of options) { | |
| 466 | + if (parseInt(opt.value, 10)) { | |
| 467 | + opt.before(newOption); | |
| 468 | + break; | |
| 469 | + } | |
| 470 | + } | |
| 471 | + } else if (position === positions.length - 1) { | |
| 472 | + select.appendChild(newOption); | |
| 473 | + } else { | |
| 474 | + const prevOption = select.querySelector(`option[value="${positions[position - 1]}"]`); | |
| 475 | + if (prevOption) { | |
| 476 | + prevOption.after(newOption); | |
| 477 | + } else { | |
| 478 | + select.appendChild(newOption); | |
| 479 | + } | |
| 480 | + } | |
| 481 | + }); | |
| 482 | + } | |
| 483 | + handleCancel(args) { | |
| 484 | + const { | |
| 485 | + e | |
| 486 | + } = args; | |
| 487 | + e.preventDefault(); | |
| 488 | + const elCancel = e.target.closest(DropdownPages.selectors.elButtonCancel); | |
| 489 | + if (!elCancel) { | |
| 490 | + return; | |
| 491 | + } | |
| 492 | + const elForm = elCancel.closest(DropdownPages.selectors.elForm); | |
| 493 | + if (!elForm) { | |
| 494 | + return; | |
| 495 | + } | |
| 496 | + const elDropdown = elForm.closest(DropdownPages.selectors.elDropdown); | |
| 497 | + if (!elDropdown) { | |
| 498 | + return; | |
| 499 | + } | |
| 500 | + const elSelect = elDropdown.querySelector(DropdownPages.selectors.elSelect); | |
| 501 | + const elListWrap = elDropdown.querySelector(DropdownPages.selectors.elListWrap); | |
| 502 | + const selected = elSelect ? elSelect.getAttribute('data-selected') : ''; | |
| 503 | + elForm.classList.add('hide-if-js'); | |
| 504 | + if (elSelect) { | |
| 505 | + elSelect.value = selected + ''; | |
| 506 | + elSelect.removeAttribute('disabled'); | |
| 507 | + elSelect.dispatchEvent(new Event('change', { | |
| 508 | + bubbles: true | |
| 509 | + })); | |
| 510 | + } | |
| 511 | + if (elListWrap) { | |
| 512 | + elListWrap.classList.remove('hide-if-js'); | |
| 513 | + } | |
| 514 | + } | |
| 515 | + handleQuickAdd(args) { | |
| 516 | + const { | |
| 517 | + e | |
| 518 | + } = args; | |
| 519 | + const elButton = e.target.closest(DropdownPages.selectors.elButtonQuickAdd); | |
| 520 | + if (!elButton) { | |
| 521 | + return; | |
| 522 | + } | |
| 523 | + const elDropdown = elButton.closest(DropdownPages.selectors.elDropdown); | |
| 524 | + if (!elDropdown) { | |
| 525 | + return; | |
| 526 | + } | |
| 527 | + this.openQuickAddForm(elDropdown); | |
| 528 | + } | |
| 529 | + handleInputEnter(args) { | |
| 530 | + const { | |
| 531 | + e | |
| 532 | + } = args; | |
| 533 | + e.preventDefault(); | |
| 534 | + const elInput = e.target; | |
| 535 | + const elForm = elInput.closest(DropdownPages.selectors.elForm); | |
| 536 | + if (!elForm) { | |
| 537 | + return; | |
| 538 | + } | |
| 539 | + const elButton = elForm.querySelector('button'); | |
| 540 | + if (elButton) { | |
| 541 | + elButton.click(); | |
| 542 | + } | |
| 543 | + } | |
| 544 | + handleInputEscape(args) { | |
| 545 | + const { | |
| 546 | + e | |
| 547 | + } = args; | |
| 548 | + if (e.key !== 'Escape') { | |
| 549 | + return; | |
| 550 | + } | |
| 551 | + const elInput = e.target; | |
| 552 | + const elForm = elInput.closest(DropdownPages.selectors.elForm); | |
| 553 | + if (!elForm) { | |
| 554 | + return; | |
| 555 | + } | |
| 556 | + const elCancel = elForm.querySelector('a'); | |
| 557 | + if (elCancel) { | |
| 558 | + elCancel.click(); | |
| 559 | + } | |
| 560 | + } | |
| 561 | +} | |
| 562 | + | |
| 563 | +/***/ }, | |
| 564 | + | |
| 254 | 565 | /***/ "./assets/src/js/admin/utils-admin.js" |
| 255 | 566 | /*!********************************************!*\ |
| 256 | 567 | !*** ./assets/src/js/admin/utils-admin.js ***! |
| 257 | 568 | \********************************************/ |
| @@ -256,8 +567,9 @@ | ||
| 256 | 567 | !*** ./assets/src/js/admin/utils-admin.js ***! |
| 257 | 568 | \********************************************/ |
| 258 | 569 | (__unused_webpack_module, __webpack_exports__, __webpack_require__) { |
| 259 | 570 | |
| 571 | +"use strict"; | |
| 260 | 572 | __webpack_require__.r(__webpack_exports__); |
| 261 | 573 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 262 | 574 | /* harmony export */ AdminUtilsFunctions: () => (/* binding */ AdminUtilsFunctions), |
| 263 | 575 | /* harmony export */ Api: () => (/* reexport safe */ _api_js__WEBPACK_IMPORTED_MODULE_2__["default"]), |
| @@ -378,8 +690,9 @@ | ||
| 378 | 690 | !*** ./assets/src/js/api.js ***! |
| 379 | 691 | \******************************/ |
| 380 | 692 | (__unused_webpack_module, __webpack_exports__, __webpack_require__) { |
| 381 | 693 | |
| 694 | +"use strict"; | |
| 382 | 695 | __webpack_require__.r(__webpack_exports__); |
| 383 | 696 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 384 | 697 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 385 | 698 | /* harmony export */ }); |
| @@ -424,8 +737,62 @@ | ||
| 424 | 737 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (lplistAPI); |
| 425 | 738 | |
| 426 | 739 | /***/ }, |
| 427 | 740 | |
| 741 | +/***/ "./assets/src/js/lpToastify.js" | |
| 742 | +/*!*************************************!*\ | |
| 743 | + !*** ./assets/src/js/lpToastify.js ***! | |
| 744 | + \*************************************/ | |
| 745 | +(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 746 | + | |
| 747 | +"use strict"; | |
| 748 | +__webpack_require__.r(__webpack_exports__); | |
| 749 | +/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 750 | +/* harmony export */ show: () => (/* binding */ show) | |
| 751 | +/* harmony export */ }); | |
| 752 | +/* harmony import */ var toastify_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! toastify-js */ "./node_modules/toastify-js/src/toastify.js"); | |
| 753 | +/* harmony import */ var toastify_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(toastify_js__WEBPACK_IMPORTED_MODULE_0__); | |
| 754 | +/* harmony import */ var toastify_js_src_toastify_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! toastify-js/src/toastify.css */ "./node_modules/toastify-js/src/toastify.css"); | |
| 755 | +/** | |
| 756 | + * Utils functions | |
| 757 | + * | |
| 758 | + * @param url | |
| 759 | + * @param data | |
| 760 | + * @param functions | |
| 761 | + * @since 4.3.0 | |
| 762 | + * @version 1.0.0 | |
| 763 | + */ | |
| 764 | + | |
| 765 | + | |
| 766 | +const argsToastify = { | |
| 767 | + text: '', | |
| 768 | + gravity: lpData.toast.gravity, | |
| 769 | + // `top` or `bottom` | |
| 770 | + position: lpData.toast.position, | |
| 771 | + // `left`, `center` or `right` | |
| 772 | + className: `${lpData.toast.classPrefix}`, | |
| 773 | + close: lpData.toast.close == 1, | |
| 774 | + stopOnFocus: lpData.toast.stopOnFocus == 1, | |
| 775 | + duration: lpData.toast.duration | |
| 776 | +}; | |
| 777 | +const show = (message, status = 'success', argsCustom) => { | |
| 778 | + let args = argsToastify; | |
| 779 | + if (argsCustom) { | |
| 780 | + args = { | |
| 781 | + ...args, | |
| 782 | + ...argsCustom | |
| 783 | + }; | |
| 784 | + } | |
| 785 | + const toastify = new (toastify_js__WEBPACK_IMPORTED_MODULE_0___default())({ | |
| 786 | + ...args, | |
| 787 | + text: message, | |
| 788 | + className: `${lpData.toast.classPrefix} ${status}` | |
| 789 | + }); | |
| 790 | + toastify.showToast(); | |
| 791 | +}; | |
| 792 | + | |
| 793 | +/***/ }, | |
| 794 | + | |
| 428 | 795 | /***/ "./assets/src/js/utils.js" |
| 429 | 796 | /*!********************************!*\ |
| 430 | 797 | !*** ./assets/src/js/utils.js ***! |
| 431 | 798 | \********************************/ |
| @@ -430,12 +797,14 @@ | ||
| 430 | 797 | !*** ./assets/src/js/utils.js ***! |
| 431 | 798 | \********************************/ |
| 432 | 799 | (__unused_webpack_module, __webpack_exports__, __webpack_require__) { |
| 433 | 800 | |
| 801 | +"use strict"; | |
| 434 | 802 | __webpack_require__.r(__webpack_exports__); |
| 435 | 803 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 436 | 804 | /* harmony export */ debounce: () => (/* binding */ debounce), |
| 437 | 805 | /* harmony export */ eventHandlers: () => (/* binding */ eventHandlers), |
| 806 | +/* harmony export */ fullScreenView: () => (/* binding */ fullScreenView), | |
| 438 | 807 | /* harmony export */ getDataOfForm: () => (/* binding */ getDataOfForm), |
| 439 | 808 | /* harmony export */ getFieldKeysOfForm: () => (/* binding */ getFieldKeysOfForm), |
| 440 | 809 | /* harmony export */ listenElementCreated: () => (/* binding */ listenElementCreated), |
| 441 | 810 | /* harmony export */ listenElementViewed: () => (/* binding */ listenElementViewed), |
| @@ -447,9 +816,10 @@ | ||
| 447 | 816 | /* harmony export */ lpOnElementReady: () => (/* binding */ lpOnElementReady), |
| 448 | 817 | /* harmony export */ lpSetLoadingEl: () => (/* binding */ lpSetLoadingEl), |
| 449 | 818 | /* harmony export */ lpShowHideEl: () => (/* binding */ lpShowHideEl), |
| 450 | 819 | /* harmony export */ mergeDataWithDatForm: () => (/* binding */ mergeDataWithDatForm), |
| 451 | -/* harmony export */ toggleCollapse: () => (/* binding */ toggleCollapse) | |
| 820 | +/* harmony export */ toggleCollapse: () => (/* binding */ toggleCollapse), | |
| 821 | +/* harmony export */ toggleEnable: () => (/* binding */ toggleEnable) | |
| 452 | 822 | /* harmony export */ }); |
| 453 | 823 | /** |
| 454 | 824 | * Utils functions |
| 455 | 825 | * |
| @@ -456,9 +826,9 @@ | ||
| 456 | 826 | * @param url |
| 457 | 827 | * @param data |
| 458 | 828 | * @param functions |
| 459 | 829 | * @since 4.2.5.1 |
| 460 | - * @version 1.0.6 | |
| 830 | + * @version 1.0.7 | |
| 461 | 831 | */ |
| 462 | 832 | const lpClassName = { |
| 463 | 833 | hidden: 'lp-hidden', |
| 464 | 834 | loading: 'loading', |
| @@ -463,9 +833,12 @@ | ||
| 463 | 833 | hidden: 'lp-hidden', |
| 464 | 834 | loading: 'loading', |
| 465 | 835 | elCollapse: 'lp-collapse', |
| 466 | 836 | elSectionToggle: '.lp-section-toggle', |
| 467 | - elTriggerToggle: '.lp-trigger-toggle' | |
| 837 | + elTriggerToggle: '.lp-trigger-toggle', | |
| 838 | + elBtnFullScreen: '.lp-btn-full-screen-view', | |
| 839 | + elFullScreen: 'lp-full-screen-view', | |
| 840 | + elBtnFullScreenClose: 'lp-full-screen-view__close' | |
| 468 | 841 | }; |
| 469 | 842 | const lpFetchAPI = (url, data = {}, functions = {}) => { |
| 470 | 843 | if ('function' === typeof functions.before) { |
| 471 | 844 | functions.before(); |
| @@ -783,10 +1156,1159 @@ | ||
| 783 | 1156 | timer = setTimeout(() => func(args), wait); |
| 784 | 1157 | }; |
| 785 | 1158 | }; |
| 786 | 1159 | |
| 1160 | +/** | |
| 1161 | + * Initialize lp-toggle-enable components. | |
| 1162 | + * | |
| 1163 | + * Finds all `.lp-toggle-enable` elements and wires up toggle behavior. | |
| 1164 | + * Reads initial state from `data-enabled` attribute ("true"/"false"). | |
| 1165 | + * Calls `data-on-toggle` callback (if provided via options) on state change. | |
| 1166 | + * | |
| 1167 | + * HTML structure: | |
| 1168 | + * <label class="lp-toggle-enable" data-enabled="true"> | |
| 1169 | + * <input type="checkbox" class="lp-toggle-enable__input" /> | |
| 1170 | + * <span class="lp-toggle-enable__track"></span> | |
| 1171 | + * </label> | |
| 1172 | + * | |
| 1173 | + * @param {string} selector CSS selector for toggle elements (default: '.lp-toggle-enable') | |
| 1174 | + * @param {Function} onToggle Optional callback( el, isEnabled ) called on state change | |
| 1175 | + * @since 4.4.5 | |
| 1176 | + * @version 1.0.0 | |
| 1177 | + */ | |
| 1178 | +window.lpToggleEnableInit = 0; | |
| 1179 | +const toggleEnable = (onToggle = null) => { | |
| 1180 | + if (window.lpToggleEnableInit) { | |
| 1181 | + return; | |
| 1182 | + } | |
| 1183 | + window.lpToggleEnableInit = 1; | |
| 1184 | + const selector = '.lp-toggle-enable'; | |
| 1185 | + const updateUI = (toggle, isEnabled) => { | |
| 1186 | + toggle.classList.toggle('is-enabled', isEnabled); | |
| 1187 | + const input = toggle.querySelector('.lp-toggle-enable__input'); | |
| 1188 | + if (input) { | |
| 1189 | + input.checked = isEnabled; | |
| 1190 | + input.value = isEnabled ? '1' : '0'; | |
| 1191 | + } | |
| 1192 | + }; | |
| 1193 | + | |
| 1194 | + // Delegate click handling via eventHandlers. | |
| 1195 | + eventHandlers('click', [{ | |
| 1196 | + selector, | |
| 1197 | + callBack: args => { | |
| 1198 | + const { | |
| 1199 | + e, | |
| 1200 | + target | |
| 1201 | + } = args; | |
| 1202 | + const toggle = target.closest(selector); | |
| 1203 | + if (!toggle || toggle.classList.contains('is-disabled')) { | |
| 1204 | + return; | |
| 1205 | + } | |
| 1206 | + e.preventDefault(); | |
| 1207 | + const isEnabled = !toggle.classList.contains('is-enabled'); | |
| 1208 | + updateUI(toggle, isEnabled); | |
| 1209 | + if ('function' === typeof onToggle) { | |
| 1210 | + onToggle(toggle, isEnabled); | |
| 1211 | + } | |
| 1212 | + } | |
| 1213 | + }]); | |
| 1214 | +}; | |
| 1215 | + | |
| 1216 | +/** | |
| 1217 | + * Initialize custom fullscreen view buttons. | |
| 1218 | + * | |
| 1219 | + * Delegates clicks on `.lp-btn-full-screen-view` buttons to | |
| 1220 | + * `lpToggleFullscreenView`. Reads the `data-target` attribute to find the | |
| 1221 | + * target element. Falls back to the button's parent element when | |
| 1222 | + * `data-target` is not provided. | |
| 1223 | + * | |
| 1224 | + * @since 4.4.5 | |
| 1225 | + * @version 1.0.0 | |
| 1226 | + */ | |
| 1227 | +window.lpFullScreenViewInit = 0; | |
| 1228 | +const fullScreenView = () => { | |
| 1229 | + if (window.lpFullScreenViewInit) { | |
| 1230 | + return; | |
| 1231 | + } | |
| 1232 | + window.lpFullScreenViewInit = 1; | |
| 1233 | + let lastScrollY = 0; | |
| 1234 | + const lpToggleFullscreenView = (elTarget, elBtnFullScreen = null) => { | |
| 1235 | + const isFullscreen = elTarget.classList.contains(lpClassName.elFullScreen); | |
| 1236 | + if (isFullscreen) { | |
| 1237 | + elTarget.classList.remove(lpClassName.elFullScreen); | |
| 1238 | + document.documentElement.classList.remove('lp-full-screen-active'); | |
| 1239 | + window.scrollTo(0, lastScrollY); | |
| 1240 | + } else { | |
| 1241 | + lastScrollY = window.scrollY; | |
| 1242 | + elTarget.classList.add(lpClassName.elFullScreen); | |
| 1243 | + document.documentElement.classList.add('lp-full-screen-active'); | |
| 1244 | + } | |
| 1245 | + if (!isFullscreen) { | |
| 1246 | + if (!elTarget.querySelector(`.${lpClassName.elBtnFullScreenClose}`)) { | |
| 1247 | + const closeButton = document.createElement('button'); | |
| 1248 | + closeButton.type = 'button'; | |
| 1249 | + closeButton.className = lpClassName.elBtnFullScreenClose; | |
| 1250 | + closeButton.setAttribute('aria-label', 'Close'); | |
| 1251 | + closeButton.innerHTML = lpData.i18n.closeButtonFullScreen || 'Close ×'; | |
| 1252 | + closeButton.addEventListener('click', e => { | |
| 1253 | + e.preventDefault(); | |
| 1254 | + lpToggleFullscreenView(elTarget); | |
| 1255 | + }); | |
| 1256 | + elTarget.appendChild(closeButton); | |
| 1257 | + } | |
| 1258 | + } else { | |
| 1259 | + const closeButton = elTarget.querySelector(`.${lpClassName.elBtnFullScreenClose}`); | |
| 1260 | + if (closeButton) { | |
| 1261 | + closeButton.remove(); | |
| 1262 | + } | |
| 1263 | + } | |
| 1264 | + }; | |
| 1265 | + eventHandlers('click', [{ | |
| 1266 | + selector: lpClassName.elBtnFullScreen, | |
| 1267 | + callBack: args => { | |
| 1268 | + const { | |
| 1269 | + e, | |
| 1270 | + target | |
| 1271 | + } = args; | |
| 1272 | + const elBtnFullScreen = target.closest(lpClassName.elBtnFullScreen); | |
| 1273 | + if (!elBtnFullScreen) { | |
| 1274 | + console.log('No full screen button found'); | |
| 1275 | + return; | |
| 1276 | + } | |
| 1277 | + e.preventDefault(); | |
| 1278 | + let elTarget = null; | |
| 1279 | + const targetSelector = elBtnFullScreen.dataset.targetFullscreen; | |
| 1280 | + console.log(targetSelector); | |
| 1281 | + if (targetSelector) { | |
| 1282 | + elTarget = document.querySelector(targetSelector); | |
| 1283 | + } | |
| 1284 | + if (!elTarget) { | |
| 1285 | + console.log('No target element found'); | |
| 1286 | + return; | |
| 1287 | + } | |
| 1288 | + lpToggleFullscreenView(elTarget, elBtnFullScreen); | |
| 1289 | + } | |
| 1290 | + }]); | |
| 1291 | +}; | |
| 1292 | + | |
| 787 | 1293 | /***/ }, |
| 788 | 1294 | |
| 1295 | +/***/ "./node_modules/css-loader/dist/cjs.js!./node_modules/toastify-js/src/toastify.css" | |
| 1296 | +/*!*****************************************************************************************!*\ | |
| 1297 | + !*** ./node_modules/css-loader/dist/cjs.js!./node_modules/toastify-js/src/toastify.css ***! | |
| 1298 | + \*****************************************************************************************/ | |
| 1299 | +(module, __webpack_exports__, __webpack_require__) { | |
| 1300 | + | |
| 1301 | +"use strict"; | |
| 1302 | +__webpack_require__.r(__webpack_exports__); | |
| 1303 | +/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 1304 | +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) | |
| 1305 | +/* harmony export */ }); | |
| 1306 | +/* harmony import */ var _css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../css-loader/dist/runtime/sourceMaps.js */ "./node_modules/css-loader/dist/runtime/sourceMaps.js"); | |
| 1307 | +/* harmony import */ var _css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0__); | |
| 1308 | +/* harmony import */ var _css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../css-loader/dist/runtime/api.js */ "./node_modules/css-loader/dist/runtime/api.js"); | |
| 1309 | +/* harmony import */ var _css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__); | |
| 1310 | +// Imports | |
| 1311 | + | |
| 1312 | + | |
| 1313 | +var ___CSS_LOADER_EXPORT___ = _css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default())); | |
| 1314 | +// Module | |
| 1315 | +___CSS_LOADER_EXPORT___.push([module.id, `/*! | |
| 1316 | + * Toastify js 1.12.0 | |
| 1317 | + * https://github.com/apvarun/toastify-js | |
| 1318 | + * @license MIT licensed | |
| 1319 | + * | |
| 1320 | + * Copyright (C) 2018 Varun A P | |
| 1321 | + */ | |
| 1322 | + | |
| 1323 | +.toastify { | |
| 1324 | + padding: 12px 20px; | |
| 1325 | + color: #ffffff; | |
| 1326 | + display: inline-block; | |
| 1327 | + box-shadow: 0 3px 6px -1px rgba(0, 0, 0, 0.12), 0 10px 36px -4px rgba(77, 96, 232, 0.3); | |
| 1328 | + background: -webkit-linear-gradient(315deg, #73a5ff, #5477f5); | |
| 1329 | + background: linear-gradient(135deg, #73a5ff, #5477f5); | |
| 1330 | + position: fixed; | |
| 1331 | + opacity: 0; | |
| 1332 | + transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1); | |
| 1333 | + border-radius: 2px; | |
| 1334 | + cursor: pointer; | |
| 1335 | + text-decoration: none; | |
| 1336 | + max-width: calc(50% - 20px); | |
| 1337 | + z-index: 2147483647; | |
| 1338 | +} | |
| 1339 | + | |
| 1340 | +.toastify.on { | |
| 1341 | + opacity: 1; | |
| 1342 | +} | |
| 1343 | + | |
| 1344 | +.toast-close { | |
| 1345 | + background: transparent; | |
| 1346 | + border: 0; | |
| 1347 | + color: white; | |
| 1348 | + cursor: pointer; | |
| 1349 | + font-family: inherit; | |
| 1350 | + font-size: 1em; | |
| 1351 | + opacity: 0.4; | |
| 1352 | + padding: 0 5px; | |
| 1353 | +} | |
| 1354 | + | |
| 1355 | +.toastify-right { | |
| 1356 | + right: 15px; | |
| 1357 | +} | |
| 1358 | + | |
| 1359 | +.toastify-left { | |
| 1360 | + left: 15px; | |
| 1361 | +} | |
| 1362 | + | |
| 1363 | +.toastify-top { | |
| 1364 | + top: -150px; | |
| 1365 | +} | |
| 1366 | + | |
| 1367 | +.toastify-bottom { | |
| 1368 | + bottom: -150px; | |
| 1369 | +} | |
| 1370 | + | |
| 1371 | +.toastify-rounded { | |
| 1372 | + border-radius: 25px; | |
| 1373 | +} | |
| 1374 | + | |
| 1375 | +.toastify-avatar { | |
| 1376 | + width: 1.5em; | |
| 1377 | + height: 1.5em; | |
| 1378 | + margin: -7px 5px; | |
| 1379 | + border-radius: 2px; | |
| 1380 | +} | |
| 1381 | + | |
| 1382 | +.toastify-center { | |
| 1383 | + margin-left: auto; | |
| 1384 | + margin-right: auto; | |
| 1385 | + left: 0; | |
| 1386 | + right: 0; | |
| 1387 | + max-width: fit-content; | |
| 1388 | + max-width: -moz-fit-content; | |
| 1389 | +} | |
| 1390 | + | |
| 1391 | +@media only screen and (max-width: 360px) { | |
| 1392 | + .toastify-right, .toastify-left { | |
| 1393 | + margin-left: auto; | |
| 1394 | + margin-right: auto; | |
| 1395 | + left: 0; | |
| 1396 | + right: 0; | |
| 1397 | + max-width: fit-content; | |
| 1398 | + } | |
| 1399 | +} | |
| 1400 | +`, "",{"version":3,"sources":["webpack://./node_modules/toastify-js/src/toastify.css"],"names":[],"mappings":"AAAA;;;;;;EAME;;AAEF;IACI,kBAAkB;IAClB,cAAc;IACd,qBAAqB;IACrB,uFAAuF;IACvF,6DAA6D;IAC7D,qDAAqD;IACrD,eAAe;IACf,UAAU;IACV,wDAAwD;IACxD,kBAAkB;IAClB,eAAe;IACf,qBAAqB;IACrB,2BAA2B;IAC3B,mBAAmB;AACvB;;AAEA;IACI,UAAU;AACd;;AAEA;IACI,uBAAuB;IACvB,SAAS;IACT,YAAY;IACZ,eAAe;IACf,oBAAoB;IACpB,cAAc;IACd,YAAY;IACZ,cAAc;AAClB;;AAEA;IACI,WAAW;AACf;;AAEA;IACI,UAAU;AACd;;AAEA;IACI,WAAW;AACf;;AAEA;IACI,cAAc;AAClB;;AAEA;IACI,mBAAmB;AACvB;;AAEA;IACI,YAAY;IACZ,aAAa;IACb,gBAAgB;IAChB,kBAAkB;AACtB;;AAEA;IACI,iBAAiB;IACjB,kBAAkB;IAClB,OAAO;IACP,QAAQ;IACR,sBAAsB;IACtB,2BAA2B;AAC/B;;AAEA;IACI;QACI,iBAAiB;QACjB,kBAAkB;QAClB,OAAO;QACP,QAAQ;QACR,sBAAsB;IAC1B;AACJ","sourcesContent":["/*!\n * Toastify js 1.12.0\n * https://github.com/apvarun/toastify-js\n * @license MIT licensed\n *\n * Copyright (C) 2018 Varun A P\n */\n\n.toastify {\n padding: 12px 20px;\n color: #ffffff;\n display: inline-block;\n box-shadow: 0 3px 6px -1px rgba(0, 0, 0, 0.12), 0 10px 36px -4px rgba(77, 96, 232, 0.3);\n background: -webkit-linear-gradient(315deg, #73a5ff, #5477f5);\n background: linear-gradient(135deg, #73a5ff, #5477f5);\n position: fixed;\n opacity: 0;\n transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1);\n border-radius: 2px;\n cursor: pointer;\n text-decoration: none;\n max-width: calc(50% - 20px);\n z-index: 2147483647;\n}\n\n.toastify.on {\n opacity: 1;\n}\n\n.toast-close {\n background: transparent;\n border: 0;\n color: white;\n cursor: pointer;\n font-family: inherit;\n font-size: 1em;\n opacity: 0.4;\n padding: 0 5px;\n}\n\n.toastify-right {\n right: 15px;\n}\n\n.toastify-left {\n left: 15px;\n}\n\n.toastify-top {\n top: -150px;\n}\n\n.toastify-bottom {\n bottom: -150px;\n}\n\n.toastify-rounded {\n border-radius: 25px;\n}\n\n.toastify-avatar {\n width: 1.5em;\n height: 1.5em;\n margin: -7px 5px;\n border-radius: 2px;\n}\n\n.toastify-center {\n margin-left: auto;\n margin-right: auto;\n left: 0;\n right: 0;\n max-width: fit-content;\n max-width: -moz-fit-content;\n}\n\n@media only screen and (max-width: 360px) {\n .toastify-right, .toastify-left {\n margin-left: auto;\n margin-right: auto;\n left: 0;\n right: 0;\n max-width: fit-content;\n }\n}\n"],"sourceRoot":""}]); | |
| 1401 | +// Exports | |
| 1402 | +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___); | |
| 1403 | + | |
| 1404 | + | |
| 1405 | +/***/ }, | |
| 1406 | + | |
| 1407 | +/***/ "./node_modules/css-loader/dist/runtime/api.js" | |
| 1408 | +/*!*****************************************************!*\ | |
| 1409 | + !*** ./node_modules/css-loader/dist/runtime/api.js ***! | |
| 1410 | + \*****************************************************/ | |
| 1411 | +(module) { | |
| 1412 | + | |
| 1413 | +"use strict"; | |
| 1414 | + | |
| 1415 | + | |
| 1416 | +/* | |
| 1417 | + MIT License http://www.opensource.org/licenses/mit-license.php | |
| 1418 | + Author Tobias Koppers @sokra | |
| 1419 | +*/ | |
| 1420 | +module.exports = function (cssWithMappingToString) { | |
| 1421 | + var list = []; | |
| 1422 | + | |
| 1423 | + // return the list of modules as css string | |
| 1424 | + list.toString = function toString() { | |
| 1425 | + return this.map(function (item) { | |
| 1426 | + var content = ""; | |
| 1427 | + var needLayer = typeof item[5] !== "undefined"; | |
| 1428 | + if (item[4]) { | |
| 1429 | + content += "@supports (".concat(item[4], ") {"); | |
| 1430 | + } | |
| 1431 | + if (item[2]) { | |
| 1432 | + content += "@media ".concat(item[2], " {"); | |
| 1433 | + } | |
| 1434 | + if (needLayer) { | |
| 1435 | + content += "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {"); | |
| 1436 | + } | |
| 1437 | + content += cssWithMappingToString(item); | |
| 1438 | + if (needLayer) { | |
| 1439 | + content += "}"; | |
| 1440 | + } | |
| 1441 | + if (item[2]) { | |
| 1442 | + content += "}"; | |
| 1443 | + } | |
| 1444 | + if (item[4]) { | |
| 1445 | + content += "}"; | |
| 1446 | + } | |
| 1447 | + return content; | |
| 1448 | + }).join(""); | |
| 1449 | + }; | |
| 1450 | + | |
| 1451 | + // import a list of modules into the list | |
| 1452 | + list.i = function i(modules, media, dedupe, supports, layer) { | |
| 1453 | + if (typeof modules === "string") { | |
| 1454 | + modules = [[null, modules, undefined]]; | |
| 1455 | + } | |
| 1456 | + var alreadyImportedModules = {}; | |
| 1457 | + if (dedupe) { | |
| 1458 | + for (var k = 0; k < this.length; k++) { | |
| 1459 | + var id = this[k][0]; | |
| 1460 | + if (id != null) { | |
| 1461 | + alreadyImportedModules[id] = true; | |
| 1462 | + } | |
| 1463 | + } | |
| 1464 | + } | |
| 1465 | + for (var _k = 0; _k < modules.length; _k++) { | |
| 1466 | + var item = [].concat(modules[_k]); | |
| 1467 | + if (dedupe && alreadyImportedModules[item[0]]) { | |
| 1468 | + continue; | |
| 1469 | + } | |
| 1470 | + if (typeof layer !== "undefined") { | |
| 1471 | + if (typeof item[5] === "undefined") { | |
| 1472 | + item[5] = layer; | |
| 1473 | + } else { | |
| 1474 | + item[1] = "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {").concat(item[1], "}"); | |
| 1475 | + item[5] = layer; | |
| 1476 | + } | |
| 1477 | + } | |
| 1478 | + if (media) { | |
| 1479 | + if (!item[2]) { | |
| 1480 | + item[2] = media; | |
| 1481 | + } else { | |
| 1482 | + item[1] = "@media ".concat(item[2], " {").concat(item[1], "}"); | |
| 1483 | + item[2] = media; | |
| 1484 | + } | |
| 1485 | + } | |
| 1486 | + if (supports) { | |
| 1487 | + if (!item[4]) { | |
| 1488 | + item[4] = "".concat(supports); | |
| 1489 | + } else { | |
| 1490 | + item[1] = "@supports (".concat(item[4], ") {").concat(item[1], "}"); | |
| 1491 | + item[4] = supports; | |
| 1492 | + } | |
| 1493 | + } | |
| 1494 | + list.push(item); | |
| 1495 | + } | |
| 1496 | + }; | |
| 1497 | + return list; | |
| 1498 | +}; | |
| 1499 | + | |
| 1500 | +/***/ }, | |
| 1501 | + | |
| 1502 | +/***/ "./node_modules/css-loader/dist/runtime/sourceMaps.js" | |
| 1503 | +/*!************************************************************!*\ | |
| 1504 | + !*** ./node_modules/css-loader/dist/runtime/sourceMaps.js ***! | |
| 1505 | + \************************************************************/ | |
| 1506 | +(module) { | |
| 1507 | + | |
| 1508 | +"use strict"; | |
| 1509 | + | |
| 1510 | + | |
| 1511 | +module.exports = function (item) { | |
| 1512 | + var content = item[1]; | |
| 1513 | + var cssMapping = item[3]; | |
| 1514 | + if (!cssMapping) { | |
| 1515 | + return content; | |
| 1516 | + } | |
| 1517 | + if (typeof btoa === "function") { | |
| 1518 | + var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(cssMapping)))); | |
| 1519 | + var data = "sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(base64); | |
| 1520 | + var sourceMapping = "/*# ".concat(data, " */"); | |
| 1521 | + return [content].concat([sourceMapping]).join("\n"); | |
| 1522 | + } | |
| 1523 | + return [content].join("\n"); | |
| 1524 | +}; | |
| 1525 | + | |
| 1526 | +/***/ }, | |
| 1527 | + | |
| 1528 | +/***/ "./node_modules/toastify-js/src/toastify.css" | |
| 1529 | +/*!***************************************************!*\ | |
| 1530 | + !*** ./node_modules/toastify-js/src/toastify.css ***! | |
| 1531 | + \***************************************************/ | |
| 1532 | +(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 1533 | + | |
| 1534 | +"use strict"; | |
| 1535 | +__webpack_require__.r(__webpack_exports__); | |
| 1536 | +/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 1537 | +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) | |
| 1538 | +/* harmony export */ }); | |
| 1539 | +/* harmony import */ var _style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! !../../style-loader/dist/runtime/injectStylesIntoStyleTag.js */ "./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"); | |
| 1540 | +/* harmony import */ var _style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__); | |
| 1541 | +/* harmony import */ var _style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! !../../style-loader/dist/runtime/styleDomAPI.js */ "./node_modules/style-loader/dist/runtime/styleDomAPI.js"); | |
| 1542 | +/* harmony import */ var _style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1__); | |
| 1543 | +/* harmony import */ var _style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! !../../style-loader/dist/runtime/insertBySelector.js */ "./node_modules/style-loader/dist/runtime/insertBySelector.js"); | |
| 1544 | +/* harmony import */ var _style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2__); | |
| 1545 | +/* harmony import */ var _style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! !../../style-loader/dist/runtime/setAttributesWithoutAttributes.js */ "./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"); | |
| 1546 | +/* harmony import */ var _style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3__); | |
| 1547 | +/* harmony import */ var _style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! !../../style-loader/dist/runtime/insertStyleElement.js */ "./node_modules/style-loader/dist/runtime/insertStyleElement.js"); | |
| 1548 | +/* harmony import */ var _style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4__); | |
| 1549 | +/* harmony import */ var _style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! !../../style-loader/dist/runtime/styleTagTransform.js */ "./node_modules/style-loader/dist/runtime/styleTagTransform.js"); | |
| 1550 | +/* harmony import */ var _style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5__); | |
| 1551 | +/* harmony import */ var _css_loader_dist_cjs_js_toastify_css__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! !!../../css-loader/dist/cjs.js!./toastify.css */ "./node_modules/css-loader/dist/cjs.js!./node_modules/toastify-js/src/toastify.css"); | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | +var options = {}; | |
| 1564 | + | |
| 1565 | +options.styleTagTransform = (_style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5___default()); | |
| 1566 | +options.setAttributes = (_style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3___default()); | |
| 1567 | + | |
| 1568 | + options.insert = _style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2___default().bind(null, "head"); | |
| 1569 | + | |
| 1570 | +options.domAPI = (_style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1___default()); | |
| 1571 | +options.insertStyleElement = (_style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4___default()); | |
| 1572 | + | |
| 1573 | +var update = _style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default()(_css_loader_dist_cjs_js_toastify_css__WEBPACK_IMPORTED_MODULE_6__["default"], options); | |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
| 1578 | + /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_css_loader_dist_cjs_js_toastify_css__WEBPACK_IMPORTED_MODULE_6__["default"] && _css_loader_dist_cjs_js_toastify_css__WEBPACK_IMPORTED_MODULE_6__["default"].locals ? _css_loader_dist_cjs_js_toastify_css__WEBPACK_IMPORTED_MODULE_6__["default"].locals : undefined); | |
| 1579 | + | |
| 1580 | + | |
| 1581 | +/***/ }, | |
| 1582 | + | |
| 1583 | +/***/ "./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js" | |
| 1584 | +/*!****************************************************************************!*\ | |
| 1585 | + !*** ./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js ***! | |
| 1586 | + \****************************************************************************/ | |
| 1587 | +(module) { | |
| 1588 | + | |
| 1589 | +"use strict"; | |
| 1590 | + | |
| 1591 | + | |
| 1592 | +var stylesInDOM = []; | |
| 1593 | +function getIndexByIdentifier(identifier) { | |
| 1594 | + var result = -1; | |
| 1595 | + for (var i = 0; i < stylesInDOM.length; i++) { | |
| 1596 | + if (stylesInDOM[i].identifier === identifier) { | |
| 1597 | + result = i; | |
| 1598 | + break; | |
| 1599 | + } | |
| 1600 | + } | |
| 1601 | + return result; | |
| 1602 | +} | |
| 1603 | +function modulesToDom(list, options) { | |
| 1604 | + var idCountMap = {}; | |
| 1605 | + var identifiers = []; | |
| 1606 | + for (var i = 0; i < list.length; i++) { | |
| 1607 | + var item = list[i]; | |
| 1608 | + var id = options.base ? item[0] + options.base : item[0]; | |
| 1609 | + var count = idCountMap[id] || 0; | |
| 1610 | + var identifier = "".concat(id, " ").concat(count); | |
| 1611 | + idCountMap[id] = count + 1; | |
| 1612 | + var indexByIdentifier = getIndexByIdentifier(identifier); | |
| 1613 | + var obj = { | |
| 1614 | + css: item[1], | |
| 1615 | + media: item[2], | |
| 1616 | + sourceMap: item[3], | |
| 1617 | + supports: item[4], | |
| 1618 | + layer: item[5] | |
| 1619 | + }; | |
| 1620 | + if (indexByIdentifier !== -1) { | |
| 1621 | + stylesInDOM[indexByIdentifier].references++; | |
| 1622 | + stylesInDOM[indexByIdentifier].updater(obj); | |
| 1623 | + } else { | |
| 1624 | + var updater = addElementStyle(obj, options); | |
| 1625 | + options.byIndex = i; | |
| 1626 | + stylesInDOM.splice(i, 0, { | |
| 1627 | + identifier: identifier, | |
| 1628 | + updater: updater, | |
| 1629 | + references: 1 | |
| 1630 | + }); | |
| 1631 | + } | |
| 1632 | + identifiers.push(identifier); | |
| 1633 | + } | |
| 1634 | + return identifiers; | |
| 1635 | +} | |
| 1636 | +function addElementStyle(obj, options) { | |
| 1637 | + var api = options.domAPI(options); | |
| 1638 | + api.update(obj); | |
| 1639 | + var updater = function updater(newObj) { | |
| 1640 | + if (newObj) { | |
| 1641 | + if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap && newObj.supports === obj.supports && newObj.layer === obj.layer) { | |
| 1642 | + return; | |
| 1643 | + } | |
| 1644 | + api.update(obj = newObj); | |
| 1645 | + } else { | |
| 1646 | + api.remove(); | |
| 1647 | + } | |
| 1648 | + }; | |
| 1649 | + return updater; | |
| 1650 | +} | |
| 1651 | +module.exports = function (list, options) { | |
| 1652 | + options = options || {}; | |
| 1653 | + list = list || []; | |
| 1654 | + var lastIdentifiers = modulesToDom(list, options); | |
| 1655 | + return function update(newList) { | |
| 1656 | + newList = newList || []; | |
| 1657 | + for (var i = 0; i < lastIdentifiers.length; i++) { | |
| 1658 | + var identifier = lastIdentifiers[i]; | |
| 1659 | + var index = getIndexByIdentifier(identifier); | |
| 1660 | + stylesInDOM[index].references--; | |
| 1661 | + } | |
| 1662 | + var newLastIdentifiers = modulesToDom(newList, options); | |
| 1663 | + for (var _i = 0; _i < lastIdentifiers.length; _i++) { | |
| 1664 | + var _identifier = lastIdentifiers[_i]; | |
| 1665 | + var _index = getIndexByIdentifier(_identifier); | |
| 1666 | + if (stylesInDOM[_index].references === 0) { | |
| 1667 | + stylesInDOM[_index].updater(); | |
| 1668 | + stylesInDOM.splice(_index, 1); | |
| 1669 | + } | |
| 1670 | + } | |
| 1671 | + lastIdentifiers = newLastIdentifiers; | |
| 1672 | + }; | |
| 1673 | +}; | |
| 1674 | + | |
| 1675 | +/***/ }, | |
| 1676 | + | |
| 1677 | +/***/ "./node_modules/style-loader/dist/runtime/insertBySelector.js" | |
| 1678 | +/*!********************************************************************!*\ | |
| 1679 | + !*** ./node_modules/style-loader/dist/runtime/insertBySelector.js ***! | |
| 1680 | + \********************************************************************/ | |
| 1681 | +(module) { | |
| 1682 | + | |
| 1683 | +"use strict"; | |
| 1684 | + | |
| 1685 | + | |
| 1686 | +var memo = {}; | |
| 1687 | + | |
| 1688 | +/* istanbul ignore next */ | |
| 1689 | +function getTarget(target) { | |
| 1690 | + if (typeof memo[target] === "undefined") { | |
| 1691 | + var styleTarget = document.querySelector(target); | |
| 1692 | + | |
| 1693 | + // Special case to return head of iframe instead of iframe itself | |
| 1694 | + if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) { | |
| 1695 | + try { | |
| 1696 | + // This will throw an exception if access to iframe is blocked | |
| 1697 | + // due to cross-origin restrictions | |
| 1698 | + styleTarget = styleTarget.contentDocument.head; | |
| 1699 | + } catch (e) { | |
| 1700 | + // istanbul ignore next | |
| 1701 | + styleTarget = null; | |
| 1702 | + } | |
| 1703 | + } | |
| 1704 | + memo[target] = styleTarget; | |
| 1705 | + } | |
| 1706 | + return memo[target]; | |
| 1707 | +} | |
| 1708 | + | |
| 1709 | +/* istanbul ignore next */ | |
| 1710 | +function insertBySelector(insert, style) { | |
| 1711 | + var target = getTarget(insert); | |
| 1712 | + if (!target) { | |
| 1713 | + throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid."); | |
| 1714 | + } | |
| 1715 | + target.appendChild(style); | |
| 1716 | +} | |
| 1717 | +module.exports = insertBySelector; | |
| 1718 | + | |
| 1719 | +/***/ }, | |
| 1720 | + | |
| 1721 | +/***/ "./node_modules/style-loader/dist/runtime/insertStyleElement.js" | |
| 1722 | +/*!**********************************************************************!*\ | |
| 1723 | + !*** ./node_modules/style-loader/dist/runtime/insertStyleElement.js ***! | |
| 1724 | + \**********************************************************************/ | |
| 1725 | +(module) { | |
| 1726 | + | |
| 1727 | +"use strict"; | |
| 1728 | + | |
| 1729 | + | |
| 1730 | +/* istanbul ignore next */ | |
| 1731 | +function insertStyleElement(options) { | |
| 1732 | + var element = document.createElement("style"); | |
| 1733 | + options.setAttributes(element, options.attributes); | |
| 1734 | + options.insert(element, options.options); | |
| 1735 | + return element; | |
| 1736 | +} | |
| 1737 | +module.exports = insertStyleElement; | |
| 1738 | + | |
| 1739 | +/***/ }, | |
| 1740 | + | |
| 1741 | +/***/ "./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js" | |
| 1742 | +/*!**********************************************************************************!*\ | |
| 1743 | + !*** ./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js ***! | |
| 1744 | + \**********************************************************************************/ | |
| 1745 | +(module, __unused_webpack_exports, __webpack_require__) { | |
| 1746 | + | |
| 1747 | +"use strict"; | |
| 1748 | + | |
| 1749 | + | |
| 1750 | +/* istanbul ignore next */ | |
| 1751 | +function setAttributesWithoutAttributes(styleElement) { | |
| 1752 | + var nonce = true ? __webpack_require__.nc : 0; | |
| 1753 | + if (nonce) { | |
| 1754 | + styleElement.setAttribute("nonce", nonce); | |
| 1755 | + } | |
| 1756 | +} | |
| 1757 | +module.exports = setAttributesWithoutAttributes; | |
| 1758 | + | |
| 1759 | +/***/ }, | |
| 1760 | + | |
| 1761 | +/***/ "./node_modules/style-loader/dist/runtime/styleDomAPI.js" | |
| 1762 | +/*!***************************************************************!*\ | |
| 1763 | + !*** ./node_modules/style-loader/dist/runtime/styleDomAPI.js ***! | |
| 1764 | + \***************************************************************/ | |
| 1765 | +(module) { | |
| 1766 | + | |
| 1767 | +"use strict"; | |
| 1768 | + | |
| 1769 | + | |
| 1770 | +/* istanbul ignore next */ | |
| 1771 | +function apply(styleElement, options, obj) { | |
| 1772 | + var css = ""; | |
| 1773 | + if (obj.supports) { | |
| 1774 | + css += "@supports (".concat(obj.supports, ") {"); | |
| 1775 | + } | |
| 1776 | + if (obj.media) { | |
| 1777 | + css += "@media ".concat(obj.media, " {"); | |
| 1778 | + } | |
| 1779 | + var needLayer = typeof obj.layer !== "undefined"; | |
| 1780 | + if (needLayer) { | |
| 1781 | + css += "@layer".concat(obj.layer.length > 0 ? " ".concat(obj.layer) : "", " {"); | |
| 1782 | + } | |
| 1783 | + css += obj.css; | |
| 1784 | + if (needLayer) { | |
| 1785 | + css += "}"; | |
| 1786 | + } | |
| 1787 | + if (obj.media) { | |
| 1788 | + css += "}"; | |
| 1789 | + } | |
| 1790 | + if (obj.supports) { | |
| 1791 | + css += "}"; | |
| 1792 | + } | |
| 1793 | + var sourceMap = obj.sourceMap; | |
| 1794 | + if (sourceMap && typeof btoa !== "undefined") { | |
| 1795 | + css += "\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), " */"); | |
| 1796 | + } | |
| 1797 | + | |
| 1798 | + // For old IE | |
| 1799 | + /* istanbul ignore if */ | |
| 1800 | + options.styleTagTransform(css, styleElement, options.options); | |
| 1801 | +} | |
| 1802 | +function removeStyleElement(styleElement) { | |
| 1803 | + // istanbul ignore if | |
| 1804 | + if (styleElement.parentNode === null) { | |
| 1805 | + return false; | |
| 1806 | + } | |
| 1807 | + styleElement.parentNode.removeChild(styleElement); | |
| 1808 | +} | |
| 1809 | + | |
| 1810 | +/* istanbul ignore next */ | |
| 1811 | +function domAPI(options) { | |
| 1812 | + if (typeof document === "undefined") { | |
| 1813 | + return { | |
| 1814 | + update: function update() {}, | |
| 1815 | + remove: function remove() {} | |
| 1816 | + }; | |
| 1817 | + } | |
| 1818 | + var styleElement = options.insertStyleElement(options); | |
| 1819 | + return { | |
| 1820 | + update: function update(obj) { | |
| 1821 | + apply(styleElement, options, obj); | |
| 1822 | + }, | |
| 1823 | + remove: function remove() { | |
| 1824 | + removeStyleElement(styleElement); | |
| 1825 | + } | |
| 1826 | + }; | |
| 1827 | +} | |
| 1828 | +module.exports = domAPI; | |
| 1829 | + | |
| 1830 | +/***/ }, | |
| 1831 | + | |
| 1832 | +/***/ "./node_modules/style-loader/dist/runtime/styleTagTransform.js" | |
| 1833 | +/*!*********************************************************************!*\ | |
| 1834 | + !*** ./node_modules/style-loader/dist/runtime/styleTagTransform.js ***! | |
| 1835 | + \*********************************************************************/ | |
| 1836 | +(module) { | |
| 1837 | + | |
| 1838 | +"use strict"; | |
| 1839 | + | |
| 1840 | + | |
| 1841 | +/* istanbul ignore next */ | |
| 1842 | +function styleTagTransform(css, styleElement) { | |
| 1843 | + if (styleElement.styleSheet) { | |
| 1844 | + styleElement.styleSheet.cssText = css; | |
| 1845 | + } else { | |
| 1846 | + while (styleElement.firstChild) { | |
| 1847 | + styleElement.removeChild(styleElement.firstChild); | |
| 1848 | + } | |
| 1849 | + styleElement.appendChild(document.createTextNode(css)); | |
| 1850 | + } | |
| 1851 | +} | |
| 1852 | +module.exports = styleTagTransform; | |
| 1853 | + | |
| 1854 | +/***/ }, | |
| 1855 | + | |
| 1856 | +/***/ "./node_modules/toastify-js/src/toastify.js" | |
| 1857 | +/*!**************************************************!*\ | |
| 1858 | + !*** ./node_modules/toastify-js/src/toastify.js ***! | |
| 1859 | + \**************************************************/ | |
| 1860 | +(module) { | |
| 1861 | + | |
| 1862 | +/*! | |
| 1863 | + * Toastify js 1.12.0 | |
| 1864 | + * https://github.com/apvarun/toastify-js | |
| 1865 | + * @license MIT licensed | |
| 1866 | + * | |
| 1867 | + * Copyright (C) 2018 Varun A P | |
| 1868 | + */ | |
| 1869 | +(function(root, factory) { | |
| 1870 | + if ( true && module.exports) { | |
| 1871 | + module.exports = factory(); | |
| 1872 | + } else { | |
| 1873 | + root.Toastify = factory(); | |
| 1874 | + } | |
| 1875 | +})(this, function(global) { | |
| 1876 | + // Object initialization | |
| 1877 | + var Toastify = function(options) { | |
| 1878 | + // Returning a new init object | |
| 1879 | + return new Toastify.lib.init(options); | |
| 1880 | + }, | |
| 1881 | + // Library version | |
| 1882 | + version = "1.12.0"; | |
| 1883 | + | |
| 1884 | + // Set the default global options | |
| 1885 | + Toastify.defaults = { | |
| 1886 | + oldestFirst: true, | |
| 1887 | + text: "Toastify is awesome!", | |
| 1888 | + node: undefined, | |
| 1889 | + duration: 3000, | |
| 1890 | + selector: undefined, | |
| 1891 | + callback: function () { | |
| 1892 | + }, | |
| 1893 | + destination: undefined, | |
| 1894 | + newWindow: false, | |
| 1895 | + close: false, | |
| 1896 | + gravity: "toastify-top", | |
| 1897 | + positionLeft: false, | |
| 1898 | + position: '', | |
| 1899 | + backgroundColor: '', | |
| 1900 | + avatar: "", | |
| 1901 | + className: "", | |
| 1902 | + stopOnFocus: true, | |
| 1903 | + onClick: function () { | |
| 1904 | + }, | |
| 1905 | + offset: {x: 0, y: 0}, | |
| 1906 | + escapeMarkup: true, | |
| 1907 | + ariaLive: 'polite', | |
| 1908 | + style: {background: ''} | |
| 1909 | + }; | |
| 1910 | + | |
| 1911 | + // Defining the prototype of the object | |
| 1912 | + Toastify.lib = Toastify.prototype = { | |
| 1913 | + toastify: version, | |
| 1914 | + | |
| 1915 | + constructor: Toastify, | |
| 1916 | + | |
| 1917 | + // Initializing the object with required parameters | |
| 1918 | + init: function(options) { | |
| 1919 | + // Verifying and validating the input object | |
| 1920 | + if (!options) { | |
| 1921 | + options = {}; | |
| 1922 | + } | |
| 1923 | + | |
| 1924 | + // Creating the options object | |
| 1925 | + this.options = {}; | |
| 1926 | + | |
| 1927 | + this.toastElement = null; | |
| 1928 | + | |
| 1929 | + // Validating the options | |
| 1930 | + this.options.text = options.text || Toastify.defaults.text; // Display message | |
| 1931 | + this.options.node = options.node || Toastify.defaults.node; // Display content as node | |
| 1932 | + this.options.duration = options.duration === 0 ? 0 : options.duration || Toastify.defaults.duration; // Display duration | |
| 1933 | + this.options.selector = options.selector || Toastify.defaults.selector; // Parent selector | |
| 1934 | + this.options.callback = options.callback || Toastify.defaults.callback; // Callback after display | |
| 1935 | + this.options.destination = options.destination || Toastify.defaults.destination; // On-click destination | |
| 1936 | + this.options.newWindow = options.newWindow || Toastify.defaults.newWindow; // Open destination in new window | |
| 1937 | + this.options.close = options.close || Toastify.defaults.close; // Show toast close icon | |
| 1938 | + this.options.gravity = options.gravity === "bottom" ? "toastify-bottom" : Toastify.defaults.gravity; // toast position - top or bottom | |
| 1939 | + this.options.positionLeft = options.positionLeft || Toastify.defaults.positionLeft; // toast position - left or right | |
| 1940 | + this.options.position = options.position || Toastify.defaults.position; // toast position - left or right | |
| 1941 | + this.options.backgroundColor = options.backgroundColor || Toastify.defaults.backgroundColor; // toast background color | |
| 1942 | + this.options.avatar = options.avatar || Toastify.defaults.avatar; // img element src - url or a path | |
| 1943 | + this.options.className = options.className || Toastify.defaults.className; // additional class names for the toast | |
| 1944 | + this.options.stopOnFocus = options.stopOnFocus === undefined ? Toastify.defaults.stopOnFocus : options.stopOnFocus; // stop timeout on focus | |
| 1945 | + this.options.onClick = options.onClick || Toastify.defaults.onClick; // Callback after click | |
| 1946 | + this.options.offset = options.offset || Toastify.defaults.offset; // toast offset | |
| 1947 | + this.options.escapeMarkup = options.escapeMarkup !== undefined ? options.escapeMarkup : Toastify.defaults.escapeMarkup; | |
| 1948 | + this.options.ariaLive = options.ariaLive || Toastify.defaults.ariaLive; | |
| 1949 | + this.options.style = options.style || Toastify.defaults.style; | |
| 1950 | + if(options.backgroundColor) { | |
| 1951 | + this.options.style.background = options.backgroundColor; | |
| 1952 | + } | |
| 1953 | + | |
| 1954 | + // Returning the current object for chaining functions | |
| 1955 | + return this; | |
| 1956 | + }, | |
| 1957 | + | |
| 1958 | + // Building the DOM element | |
| 1959 | + buildToast: function() { | |
| 1960 | + // Validating if the options are defined | |
| 1961 | + if (!this.options) { | |
| 1962 | + throw "Toastify is not initialized"; | |
| 1963 | + } | |
| 1964 | + | |
| 1965 | + // Creating the DOM object | |
| 1966 | + var divElement = document.createElement("div"); | |
| 1967 | + divElement.className = "toastify on " + this.options.className; | |
| 1968 | + | |
| 1969 | + // Positioning toast to left or right or center | |
| 1970 | + if (!!this.options.position) { | |
| 1971 | + divElement.className += " toastify-" + this.options.position; | |
| 1972 | + } else { | |
| 1973 | + // To be depreciated in further versions | |
| 1974 | + if (this.options.positionLeft === true) { | |
| 1975 | + divElement.className += " toastify-left"; | |
| 1976 | + console.warn('Property `positionLeft` will be depreciated in further versions. Please use `position` instead.') | |
| 1977 | + } else { | |
| 1978 | + // Default position | |
| 1979 | + divElement.className += " toastify-right"; | |
| 1980 | + } | |
| 1981 | + } | |
| 1982 | + | |
| 1983 | + // Assigning gravity of element | |
| 1984 | + divElement.className += " " + this.options.gravity; | |
| 1985 | + | |
| 1986 | + if (this.options.backgroundColor) { | |
| 1987 | + // This is being deprecated in favor of using the style HTML DOM property | |
| 1988 | + console.warn('DEPRECATION NOTICE: "backgroundColor" is being deprecated. Please use the "style.background" property.'); | |
| 1989 | + } | |
| 1990 | + | |
| 1991 | + // Loop through our style object and apply styles to divElement | |
| 1992 | + for (var property in this.options.style) { | |
| 1993 | + divElement.style[property] = this.options.style[property]; | |
| 1994 | + } | |
| 1995 | + | |
| 1996 | + // Announce the toast to screen readers | |
| 1997 | + if (this.options.ariaLive) { | |
| 1998 | + divElement.setAttribute('aria-live', this.options.ariaLive) | |
| 1999 | + } | |
| 2000 | + | |
| 2001 | + // Adding the toast message/node | |
| 2002 | + if (this.options.node && this.options.node.nodeType === Node.ELEMENT_NODE) { | |
| 2003 | + // If we have a valid node, we insert it | |
| 2004 | + divElement.appendChild(this.options.node) | |
| 2005 | + } else { | |
| 2006 | + if (this.options.escapeMarkup) { | |
| 2007 | + divElement.innerText = this.options.text; | |
| 2008 | + } else { | |
| 2009 | + divElement.innerHTML = this.options.text; | |
| 2010 | + } | |
| 2011 | + | |
| 2012 | + if (this.options.avatar !== "") { | |
| 2013 | + var avatarElement = document.createElement("img"); | |
| 2014 | + avatarElement.src = this.options.avatar; | |
| 2015 | + | |
| 2016 | + avatarElement.className = "toastify-avatar"; | |
| 2017 | + | |
| 2018 | + if (this.options.position == "left" || this.options.positionLeft === true) { | |
| 2019 | + // Adding close icon on the left of content | |
| 2020 | + divElement.appendChild(avatarElement); | |
| 2021 | + } else { | |
| 2022 | + // Adding close icon on the right of content | |
| 2023 | + divElement.insertAdjacentElement("afterbegin", avatarElement); | |
| 2024 | + } | |
| 2025 | + } | |
| 2026 | + } | |
| 2027 | + | |
| 2028 | + // Adding a close icon to the toast | |
| 2029 | + if (this.options.close === true) { | |
| 2030 | + // Create a span for close element | |
| 2031 | + var closeElement = document.createElement("button"); | |
| 2032 | + closeElement.type = "button"; | |
| 2033 | + closeElement.setAttribute("aria-label", "Close"); | |
| 2034 | + closeElement.className = "toast-close"; | |
| 2035 | + closeElement.innerHTML = "✖"; | |
| 2036 | + | |
| 2037 | + // Triggering the removal of toast from DOM on close click | |
| 2038 | + closeElement.addEventListener( | |
| 2039 | + "click", | |
| 2040 | + function(event) { | |
| 2041 | + event.stopPropagation(); | |
| 2042 | + this.removeElement(this.toastElement); | |
| 2043 | + window.clearTimeout(this.toastElement.timeOutValue); | |
| 2044 | + }.bind(this) | |
| 2045 | + ); | |
| 2046 | + | |
| 2047 | + //Calculating screen width | |
| 2048 | + var width = window.innerWidth > 0 ? window.innerWidth : screen.width; | |
| 2049 | + | |
| 2050 | + // Adding the close icon to the toast element | |
| 2051 | + // Display on the right if screen width is less than or equal to 360px | |
| 2052 | + if ((this.options.position == "left" || this.options.positionLeft === true) && width > 360) { | |
| 2053 | + // Adding close icon on the left of content | |
| 2054 | + divElement.insertAdjacentElement("afterbegin", closeElement); | |
| 2055 | + } else { | |
| 2056 | + // Adding close icon on the right of content | |
| 2057 | + divElement.appendChild(closeElement); | |
| 2058 | + } | |
| 2059 | + } | |
| 2060 | + | |
| 2061 | + // Clear timeout while toast is focused | |
| 2062 | + if (this.options.stopOnFocus && this.options.duration > 0) { | |
| 2063 | + var self = this; | |
| 2064 | + // stop countdown | |
| 2065 | + divElement.addEventListener( | |
| 2066 | + "mouseover", | |
| 2067 | + function(event) { | |
| 2068 | + window.clearTimeout(divElement.timeOutValue); | |
| 2069 | + } | |
| 2070 | + ) | |
| 2071 | + // add back the timeout | |
| 2072 | + divElement.addEventListener( | |
| 2073 | + "mouseleave", | |
| 2074 | + function() { | |
| 2075 | + divElement.timeOutValue = window.setTimeout( | |
| 2076 | + function() { | |
| 2077 | + // Remove the toast from DOM | |
| 2078 | + self.removeElement(divElement); | |
| 2079 | + }, | |
| 2080 | + self.options.duration | |
| 2081 | + ) | |
| 2082 | + } | |
| 2083 | + ) | |
| 2084 | + } | |
| 2085 | + | |
| 2086 | + // Adding an on-click destination path | |
| 2087 | + if (typeof this.options.destination !== "undefined") { | |
| 2088 | + divElement.addEventListener( | |
| 2089 | + "click", | |
| 2090 | + function(event) { | |
| 2091 | + event.stopPropagation(); | |
| 2092 | + if (this.options.newWindow === true) { | |
| 2093 | + window.open(this.options.destination, "_blank"); | |
| 2094 | + } else { | |
| 2095 | + window.location = this.options.destination; | |
| 2096 | + } | |
| 2097 | + }.bind(this) | |
| 2098 | + ); | |
| 2099 | + } | |
| 2100 | + | |
| 2101 | + if (typeof this.options.onClick === "function" && typeof this.options.destination === "undefined") { | |
| 2102 | + divElement.addEventListener( | |
| 2103 | + "click", | |
| 2104 | + function(event) { | |
| 2105 | + event.stopPropagation(); | |
| 2106 | + this.options.onClick(); | |
| 2107 | + }.bind(this) | |
| 2108 | + ); | |
| 2109 | + } | |
| 2110 | + | |
| 2111 | + // Adding offset | |
| 2112 | + if(typeof this.options.offset === "object") { | |
| 2113 | + | |
| 2114 | + var x = getAxisOffsetAValue("x", this.options); | |
| 2115 | + var y = getAxisOffsetAValue("y", this.options); | |
| 2116 | + | |
| 2117 | + var xOffset = this.options.position == "left" ? x : "-" + x; | |
| 2118 | + var yOffset = this.options.gravity == "toastify-top" ? y : "-" + y; | |
| 2119 | + | |
| 2120 | + divElement.style.transform = "translate(" + xOffset + "," + yOffset + ")"; | |
| 2121 | + | |
| 2122 | + } | |
| 2123 | + | |
| 2124 | + // Returning the generated element | |
| 2125 | + return divElement; | |
| 2126 | + }, | |
| 2127 | + | |
| 2128 | + // Displaying the toast | |
| 2129 | + showToast: function() { | |
| 2130 | + // Creating the DOM object for the toast | |
| 2131 | + this.toastElement = this.buildToast(); | |
| 2132 | + | |
| 2133 | + // Getting the root element to with the toast needs to be added | |
| 2134 | + var rootElement; | |
| 2135 | + if (typeof this.options.selector === "string") { | |
| 2136 | + rootElement = document.getElementById(this.options.selector); | |
| 2137 | + } else if (this.options.selector instanceof HTMLElement || (typeof ShadowRoot !== 'undefined' && this.options.selector instanceof ShadowRoot)) { | |
| 2138 | + rootElement = this.options.selector; | |
| 2139 | + } else { | |
| 2140 | + rootElement = document.body; | |
| 2141 | + } | |
| 2142 | + | |
| 2143 | + // Validating if root element is present in DOM | |
| 2144 | + if (!rootElement) { | |
| 2145 | + throw "Root element is not defined"; | |
| 2146 | + } | |
| 2147 | + | |
| 2148 | + // Adding the DOM element | |
| 2149 | + var elementToInsert = Toastify.defaults.oldestFirst ? rootElement.firstChild : rootElement.lastChild; | |
| 2150 | + rootElement.insertBefore(this.toastElement, elementToInsert); | |
| 2151 | + | |
| 2152 | + // Repositioning the toasts in case multiple toasts are present | |
| 2153 | + Toastify.reposition(); | |
| 2154 | + | |
| 2155 | + if (this.options.duration > 0) { | |
| 2156 | + this.toastElement.timeOutValue = window.setTimeout( | |
| 2157 | + function() { | |
| 2158 | + // Remove the toast from DOM | |
| 2159 | + this.removeElement(this.toastElement); | |
| 2160 | + }.bind(this), | |
| 2161 | + this.options.duration | |
| 2162 | + ); // Binding `this` for function invocation | |
| 2163 | + } | |
| 2164 | + | |
| 2165 | + // Supporting function chaining | |
| 2166 | + return this; | |
| 2167 | + }, | |
| 2168 | + | |
| 2169 | + hideToast: function() { | |
| 2170 | + if (this.toastElement.timeOutValue) { | |
| 2171 | + clearTimeout(this.toastElement.timeOutValue); | |
| 2172 | + } | |
| 2173 | + this.removeElement(this.toastElement); | |
| 2174 | + }, | |
| 2175 | + | |
| 2176 | + // Removing the element from the DOM | |
| 2177 | + removeElement: function(toastElement) { | |
| 2178 | + // Hiding the element | |
| 2179 | + // toastElement.classList.remove("on"); | |
| 2180 | + toastElement.className = toastElement.className.replace(" on", ""); | |
| 2181 | + | |
| 2182 | + // Removing the element from DOM after transition end | |
| 2183 | + window.setTimeout( | |
| 2184 | + function() { | |
| 2185 | + // remove options node if any | |
| 2186 | + if (this.options.node && this.options.node.parentNode) { | |
| 2187 | + this.options.node.parentNode.removeChild(this.options.node); | |
| 2188 | + } | |
| 2189 | + | |
| 2190 | + // Remove the element from the DOM, only when the parent node was not removed before. | |
| 2191 | + if (toastElement.parentNode) { | |
| 2192 | + toastElement.parentNode.removeChild(toastElement); | |
| 2193 | + } | |
| 2194 | + | |
| 2195 | + // Calling the callback function | |
| 2196 | + this.options.callback.call(toastElement); | |
| 2197 | + | |
| 2198 | + // Repositioning the toasts again | |
| 2199 | + Toastify.reposition(); | |
| 2200 | + }.bind(this), | |
| 2201 | + 400 | |
| 2202 | + ); // Binding `this` for function invocation | |
| 2203 | + }, | |
| 2204 | + }; | |
| 2205 | + | |
| 2206 | + // Positioning the toasts on the DOM | |
| 2207 | + Toastify.reposition = function() { | |
| 2208 | + | |
| 2209 | + // Top margins with gravity | |
| 2210 | + var topLeftOffsetSize = { | |
| 2211 | + top: 15, | |
| 2212 | + bottom: 15, | |
| 2213 | + }; | |
| 2214 | + var topRightOffsetSize = { | |
| 2215 | + top: 15, | |
| 2216 | + bottom: 15, | |
| 2217 | + }; | |
| 2218 | + var offsetSize = { | |
| 2219 | + top: 15, | |
| 2220 | + bottom: 15, | |
| 2221 | + }; | |
| 2222 | + | |
| 2223 | + // Get all toast messages on the DOM | |
| 2224 | + var allToasts = document.getElementsByClassName("toastify"); | |
| 2225 | + | |
| 2226 | + var classUsed; | |
| 2227 | + | |
| 2228 | + // Modifying the position of each toast element | |
| 2229 | + for (var i = 0; i < allToasts.length; i++) { | |
| 2230 | + // Getting the applied gravity | |
| 2231 | + if (containsClass(allToasts[i], "toastify-top") === true) { | |
| 2232 | + classUsed = "toastify-top"; | |
| 2233 | + } else { | |
| 2234 | + classUsed = "toastify-bottom"; | |
| 2235 | + } | |
| 2236 | + | |
| 2237 | + var height = allToasts[i].offsetHeight; | |
| 2238 | + classUsed = classUsed.substr(9, classUsed.length-1) | |
| 2239 | + // Spacing between toasts | |
| 2240 | + var offset = 15; | |
| 2241 | + | |
| 2242 | + var width = window.innerWidth > 0 ? window.innerWidth : screen.width; | |
| 2243 | + | |
| 2244 | + // Show toast in center if screen with less than or equal to 360px | |
| 2245 | + if (width <= 360) { | |
| 2246 | + // Setting the position | |
| 2247 | + allToasts[i].style[classUsed] = offsetSize[classUsed] + "px"; | |
| 2248 | + | |
| 2249 | + offsetSize[classUsed] += height + offset; | |
| 2250 | + } else { | |
| 2251 | + if (containsClass(allToasts[i], "toastify-left") === true) { | |
| 2252 | + // Setting the position | |
| 2253 | + allToasts[i].style[classUsed] = topLeftOffsetSize[classUsed] + "px"; | |
| 2254 | + | |
| 2255 | + topLeftOffsetSize[classUsed] += height + offset; | |
| 2256 | + } else { | |
| 2257 | + // Setting the position | |
| 2258 | + allToasts[i].style[classUsed] = topRightOffsetSize[classUsed] + "px"; | |
| 2259 | + | |
| 2260 | + topRightOffsetSize[classUsed] += height + offset; | |
| 2261 | + } | |
| 2262 | + } | |
| 2263 | + } | |
| 2264 | + | |
| 2265 | + // Supporting function chaining | |
| 2266 | + return this; | |
| 2267 | + }; | |
| 2268 | + | |
| 2269 | + // Helper function to get offset. | |
| 2270 | + function getAxisOffsetAValue(axis, options) { | |
| 2271 | + | |
| 2272 | + if(options.offset[axis]) { | |
| 2273 | + if(isNaN(options.offset[axis])) { | |
| 2274 | + return options.offset[axis]; | |
| 2275 | + } | |
| 2276 | + else { | |
| 2277 | + return options.offset[axis] + 'px'; | |
| 2278 | + } | |
| 2279 | + } | |
| 2280 | + | |
| 2281 | + return '0px'; | |
| 2282 | + | |
| 2283 | + } | |
| 2284 | + | |
| 2285 | + function containsClass(elem, yourClass) { | |
| 2286 | + if (!elem || typeof yourClass !== "string") { | |
| 2287 | + return false; | |
| 2288 | + } else if ( | |
| 2289 | + elem.className && | |
| 2290 | + elem.className | |
| 2291 | + .trim() | |
| 2292 | + .split(/\s+/gi) | |
| 2293 | + .indexOf(yourClass) > -1 | |
| 2294 | + ) { | |
| 2295 | + return true; | |
| 2296 | + } else { | |
| 2297 | + return false; | |
| 2298 | + } | |
| 2299 | + } | |
| 2300 | + | |
| 2301 | + // Setting up the prototype for the init object | |
| 2302 | + Toastify.lib.init.prototype = Toastify.lib; | |
| 2303 | + | |
| 2304 | + // Returning the Toastify function to be assigned to the window object/module | |
| 2305 | + return Toastify; | |
| 2306 | +}); | |
| 2307 | + | |
| 2308 | + | |
| 2309 | +/***/ }, | |
| 2310 | + | |
| 789 | 2311 | /***/ "./node_modules/@orchidjs/sifter/dist/esm/sifter.js" |
| 790 | 2312 | /*!**********************************************************!*\ |
| 791 | 2313 | !*** ./node_modules/@orchidjs/sifter/dist/esm/sifter.js ***! |
| 792 | 2314 | \**********************************************************/ |
| @@ -791,8 +2313,9 @@ | ||
| 791 | 2313 | !*** ./node_modules/@orchidjs/sifter/dist/esm/sifter.js ***! |
| 792 | 2314 | \**********************************************************/ |
| 793 | 2315 | (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { |
| 794 | 2316 | |
| 2317 | +"use strict"; | |
| 795 | 2318 | __webpack_require__.r(__webpack_exports__); |
| 796 | 2319 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 797 | 2320 | /* harmony export */ Sifter: () => (/* binding */ Sifter), |
| 798 | 2321 | /* harmony export */ cmp: () => (/* reexport safe */ _utils_js__WEBPACK_IMPORTED_MODULE_0__.cmp), |
| @@ -1118,8 +2641,9 @@ | ||
| 1118 | 2641 | !*** ./node_modules/@orchidjs/sifter/dist/esm/types.js ***! |
| 1119 | 2642 | \*********************************************************/ |
| 1120 | 2643 | (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { |
| 1121 | 2644 | |
| 2645 | +"use strict"; | |
| 1122 | 2646 | __webpack_require__.r(__webpack_exports__); |
| 1123 | 2647 | |
| 1124 | 2648 | //# sourceMappingURL=types.js.map |
| 1125 | 2649 | |
| @@ -1130,8 +2654,9 @@ | ||
| 1130 | 2654 | !*** ./node_modules/@orchidjs/sifter/dist/esm/utils.js ***! |
| 1131 | 2655 | \*********************************************************/ |
| 1132 | 2656 | (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { |
| 1133 | 2657 | |
| 2658 | +"use strict"; | |
| 1134 | 2659 | __webpack_require__.r(__webpack_exports__); |
| 1135 | 2660 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 1136 | 2661 | /* harmony export */ cmp: () => (/* binding */ cmp), |
| 1137 | 2662 | /* harmony export */ getAttr: () => (/* binding */ getAttr), |
| @@ -1242,8 +2767,9 @@ | ||
| 1242 | 2767 | !*** ./node_modules/@orchidjs/unicode-variants/dist/esm/index.js ***! |
| 1243 | 2768 | \*******************************************************************/ |
| 1244 | 2769 | (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { |
| 1245 | 2770 | |
| 2771 | +"use strict"; | |
| 1246 | 2772 | __webpack_require__.r(__webpack_exports__); |
| 1247 | 2773 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 1248 | 2774 | /* harmony export */ _asciifold: () => (/* binding */ _asciifold), |
| 1249 | 2775 | /* harmony export */ asciifold: () => (/* binding */ asciifold), |
| @@ -1645,8 +3171,9 @@ | ||
| 1645 | 3171 | !*** ./node_modules/@orchidjs/unicode-variants/dist/esm/regex.js ***! |
| 1646 | 3172 | \*******************************************************************/ |
| 1647 | 3173 | (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { |
| 1648 | 3174 | |
| 3175 | +"use strict"; | |
| 1649 | 3176 | __webpack_require__.r(__webpack_exports__); |
| 1650 | 3177 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 1651 | 3178 | /* harmony export */ arrayToPattern: () => (/* binding */ arrayToPattern), |
| 1652 | 3179 | /* harmony export */ escape_regex: () => (/* binding */ escape_regex), |
| @@ -1730,8 +3257,9 @@ | ||
| 1730 | 3257 | !*** ./node_modules/@orchidjs/unicode-variants/dist/esm/strings.js ***! |
| 1731 | 3258 | \*********************************************************************/ |
| 1732 | 3259 | (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { |
| 1733 | 3260 | |
| 3261 | +"use strict"; | |
| 1734 | 3262 | __webpack_require__.r(__webpack_exports__); |
| 1735 | 3263 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 1736 | 3264 | /* harmony export */ allSubstrings: () => (/* binding */ allSubstrings) |
| 1737 | 3265 | /* harmony export */ }); |
| @@ -1764,8 +3292,9 @@ | ||
| 1764 | 3292 | !*** ./node_modules/tom-select/dist/esm/constants.js ***! |
| 1765 | 3293 | \*******************************************************/ |
| 1766 | 3294 | (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { |
| 1767 | 3295 | |
| 3296 | +"use strict"; | |
| 1768 | 3297 | __webpack_require__.r(__webpack_exports__); |
| 1769 | 3298 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 1770 | 3299 | /* harmony export */ IS_MAC: () => (/* binding */ IS_MAC), |
| 1771 | 3300 | /* harmony export */ KEY_A: () => (/* binding */ KEY_A), |
| @@ -1801,8 +3330,9 @@ | ||
| 1801 | 3330 | !*** ./node_modules/tom-select/dist/esm/contrib/highlight.js ***! |
| 1802 | 3331 | \***************************************************************/ |
| 1803 | 3332 | (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { |
| 1804 | 3333 | |
| 3334 | +"use strict"; | |
| 1805 | 3335 | __webpack_require__.r(__webpack_exports__); |
| 1806 | 3336 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 1807 | 3337 | /* harmony export */ highlight: () => (/* binding */ highlight), |
| 1808 | 3338 | /* harmony export */ removeHighlight: () => (/* binding */ removeHighlight) |
| @@ -1880,8 +3410,9 @@ | ||
| 1880 | 3410 | !*** ./node_modules/tom-select/dist/esm/contrib/microevent.js ***! |
| 1881 | 3411 | \****************************************************************/ |
| 1882 | 3412 | (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { |
| 1883 | 3413 | |
| 3414 | +"use strict"; | |
| 1884 | 3415 | __webpack_require__.r(__webpack_exports__); |
| 1885 | 3416 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 1886 | 3417 | /* harmony export */ "default": () => (/* binding */ MicroEvent) |
| 1887 | 3418 | /* harmony export */ }); |
| @@ -1954,8 +3485,9 @@ | ||
| 1954 | 3485 | !*** ./node_modules/tom-select/dist/esm/contrib/microplugin.js ***! |
| 1955 | 3486 | \*****************************************************************/ |
| 1956 | 3487 | (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { |
| 1957 | 3488 | |
| 3489 | +"use strict"; | |
| 1958 | 3490 | __webpack_require__.r(__webpack_exports__); |
| 1959 | 3491 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 1960 | 3492 | /* harmony export */ "default": () => (/* binding */ MicroPlugin) |
| 1961 | 3493 | /* harmony export */ }); |
| @@ -2076,8 +3608,9 @@ | ||
| 2076 | 3608 | !*** ./node_modules/tom-select/dist/esm/defaults.js ***! |
| 2077 | 3609 | \******************************************************/ |
| 2078 | 3610 | (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { |
| 2079 | 3611 | |
| 3612 | +"use strict"; | |
| 2080 | 3613 | __webpack_require__.r(__webpack_exports__); |
| 2081 | 3614 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 2082 | 3615 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 2083 | 3616 | /* harmony export */ }); |
| @@ -2091,8 +3624,9 @@ | ||
| 2091 | 3624 | diacritics: true, |
| 2092 | 3625 | create: null, |
| 2093 | 3626 | createOnBlur: false, |
| 2094 | 3627 | createFilter: null, |
| 3628 | + clearAfterSelect: false, | |
| 2095 | 3629 | highlight: true, |
| 2096 | 3630 | openOnFocus: true, |
| 2097 | 3631 | shouldOpen: null, |
| 2098 | 3632 | maxOptions: 50, |
| @@ -2171,8 +3705,9 @@ | ||
| 2171 | 3705 | !*** ./node_modules/tom-select/dist/esm/getSettings.js ***! |
| 2172 | 3706 | \*********************************************************/ |
| 2173 | 3707 | (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { |
| 2174 | 3708 | |
| 3709 | +"use strict"; | |
| 2175 | 3710 | __webpack_require__.r(__webpack_exports__); |
| 2176 | 3711 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 2177 | 3712 | /* harmony export */ "default": () => (/* binding */ getSettings) |
| 2178 | 3713 | /* harmony export */ }); |
| @@ -2289,11 +3824,12 @@ | ||
| 2289 | 3824 | * Initialize from a <input type="text"> element. |
| 2290 | 3825 | * |
| 2291 | 3826 | */ |
| 2292 | 3827 | var init_textbox = () => { |
| 3828 | + var _a, _b; | |
| 2293 | 3829 | const data_raw = input.getAttribute(attr_data); |
| 2294 | 3830 | if (!data_raw) { |
| 2295 | - var value = input.value.trim() || ''; | |
| 3831 | + 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 : ''; | |
| 2296 | 3832 | if (!settings.allowEmptyOption && !value.length) |
| 2297 | 3833 | return; |
| 2298 | 3834 | const values = value.split(settings.delimiter); |
| 2299 | 3835 | (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.iterate)(values, (value) => { |
| @@ -2329,14 +3865,15 @@ | ||
| 2329 | 3865 | !*** ./node_modules/tom-select/dist/esm/plugins/caret_position/plugin.js ***! |
| 2330 | 3866 | \***************************************************************************/ |
| 2331 | 3867 | (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { |
| 2332 | 3868 | |
| 3869 | +"use strict"; | |
| 2333 | 3870 | __webpack_require__.r(__webpack_exports__); |
| 2334 | 3871 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 2335 | 3872 | /* harmony export */ "default": () => (/* binding */ plugin) |
| 2336 | 3873 | /* harmony export */ }); |
| 2337 | 3874 | /** |
| 2338 | -* Tom Select v2.4.3 | |
| 3875 | +* Tom Select v2.6.2 | |
| 2339 | 3876 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 2340 | 3877 | */ |
| 2341 | 3878 | |
| 2342 | 3879 | /** |
| @@ -2506,14 +4043,15 @@ | ||
| 2506 | 4043 | !*** ./node_modules/tom-select/dist/esm/plugins/change_listener/plugin.js ***! |
| 2507 | 4044 | \****************************************************************************/ |
| 2508 | 4045 | (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { |
| 2509 | 4046 | |
| 4047 | +"use strict"; | |
| 2510 | 4048 | __webpack_require__.r(__webpack_exports__); |
| 2511 | 4049 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 2512 | 4050 | /* harmony export */ "default": () => (/* binding */ plugin) |
| 2513 | 4051 | /* harmony export */ }); |
| 2514 | 4052 | /** |
| 2515 | -* Tom Select v2.4.3 | |
| 4053 | +* Tom Select v2.6.2 | |
| 2516 | 4054 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 2517 | 4055 | */ |
| 2518 | 4056 | |
| 2519 | 4057 | /** |
| @@ -2571,14 +4109,15 @@ | ||
| 2571 | 4109 | !*** ./node_modules/tom-select/dist/esm/plugins/checkbox_options/plugin.js ***! |
| 2572 | 4110 | \*****************************************************************************/ |
| 2573 | 4111 | (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { |
| 2574 | 4112 | |
| 4113 | +"use strict"; | |
| 2575 | 4114 | __webpack_require__.r(__webpack_exports__); |
| 2576 | 4115 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 2577 | 4116 | /* harmony export */ "default": () => (/* binding */ plugin) |
| 2578 | 4117 | /* harmony export */ }); |
| 2579 | 4118 | /** |
| 2580 | -* Tom Select v2.4.3 | |
| 4119 | +* Tom Select v2.6.2 | |
| 2581 | 4120 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 2582 | 4121 | */ |
| 2583 | 4122 | |
| 2584 | 4123 | /** |
| @@ -2764,14 +4303,15 @@ | ||
| 2764 | 4303 | !*** ./node_modules/tom-select/dist/esm/plugins/clear_button/plugin.js ***! |
| 2765 | 4304 | \*************************************************************************/ |
| 2766 | 4305 | (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { |
| 2767 | 4306 | |
| 4307 | +"use strict"; | |
| 2768 | 4308 | __webpack_require__.r(__webpack_exports__); |
| 2769 | 4309 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 2770 | 4310 | /* harmony export */ "default": () => (/* binding */ plugin) |
| 2771 | 4311 | /* harmony export */ }); |
| 2772 | 4312 | /** |
| 2773 | -* Tom Select v2.4.3 | |
| 4313 | +* Tom Select v2.6.2 | |
| 2774 | 4314 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 2775 | 4315 | */ |
| 2776 | 4316 | |
| 2777 | 4317 | /** |
| @@ -2820,10 +4360,12 @@ | ||
| 2820 | 4360 | const self = this; |
| 2821 | 4361 | const options = Object.assign({ |
| 2822 | 4362 | className: 'clear-button', |
| 2823 | 4363 | title: 'Clear All', |
| 4364 | + role: 'button', | |
| 4365 | + tabindex: 0, | |
| 2824 | 4366 | html: data => { |
| 2825 | - return `<div class="${data.className}" title="${data.title}">⨯</div>`; | |
| 4367 | + return `<div class="${data.className}" title="${data.title}" role="${data.role}" tabindex="${data.tabindex}">×</div>`; | |
| 2826 | 4368 | } |
| 2827 | 4369 | }, userOptions); |
| 2828 | 4370 | self.on('initialize', () => { |
| 2829 | 4371 | var button = getDom(options.html(options)); |
| @@ -2832,8 +4374,9 @@ | ||
| 2832 | 4374 | self.clear(); |
| 2833 | 4375 | if (self.settings.mode === 'single' && self.settings.allowEmptyOption) { |
| 2834 | 4376 | self.addItem(''); |
| 2835 | 4377 | } |
| 4378 | + self.refreshOptions(false); | |
| 2836 | 4379 | evt.preventDefault(); |
| 2837 | 4380 | evt.stopPropagation(); |
| 2838 | 4381 | }); |
| 2839 | 4382 | self.control.appendChild(button); |
| @@ -2851,14 +4394,15 @@ | ||
| 2851 | 4394 | !*** ./node_modules/tom-select/dist/esm/plugins/drag_drop/plugin.js ***! |
| 2852 | 4395 | \**********************************************************************/ |
| 2853 | 4396 | (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { |
| 2854 | 4397 | |
| 4398 | +"use strict"; | |
| 2855 | 4399 | __webpack_require__.r(__webpack_exports__); |
| 2856 | 4400 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 2857 | 4401 | /* harmony export */ "default": () => (/* binding */ plugin) |
| 2858 | 4402 | /* harmony export */ }); |
| 2859 | 4403 | /** |
| 2860 | -* Tom Select v2.4.3 | |
| 4404 | +* Tom Select v2.6.2 | |
| 2861 | 4405 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 2862 | 4406 | */ |
| 2863 | 4407 | |
| 2864 | 4408 | /** |
| @@ -3085,14 +4629,15 @@ | ||
| 3085 | 4629 | !*** ./node_modules/tom-select/dist/esm/plugins/dropdown_header/plugin.js ***! |
| 3086 | 4630 | \****************************************************************************/ |
| 3087 | 4631 | (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { |
| 3088 | 4632 | |
| 4633 | +"use strict"; | |
| 3089 | 4634 | __webpack_require__.r(__webpack_exports__); |
| 3090 | 4635 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 3091 | 4636 | /* harmony export */ "default": () => (/* binding */ plugin) |
| 3092 | 4637 | /* harmony export */ }); |
| 3093 | 4638 | /** |
| 3094 | -* Tom Select v2.4.3 | |
| 4639 | +* Tom Select v2.6.2 | |
| 3095 | 4640 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 3096 | 4641 | */ |
| 3097 | 4642 | |
| 3098 | 4643 | /** |
| @@ -3201,14 +4746,15 @@ | ||
| 3201 | 4746 | !*** ./node_modules/tom-select/dist/esm/plugins/dropdown_input/plugin.js ***! |
| 3202 | 4747 | \***************************************************************************/ |
| 3203 | 4748 | (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { |
| 3204 | 4749 | |
| 4750 | +"use strict"; | |
| 3205 | 4751 | __webpack_require__.r(__webpack_exports__); |
| 3206 | 4752 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 3207 | 4753 | /* harmony export */ "default": () => (/* binding */ plugin) |
| 3208 | 4754 | /* harmony export */ }); |
| 3209 | 4755 | /** |
| 3210 | -* Tom Select v2.4.3 | |
| 4756 | +* Tom Select v2.6.2 | |
| 3211 | 4757 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 3212 | 4758 | */ |
| 3213 | 4759 | |
| 3214 | 4760 | const KEY_ESC = 27; |
| @@ -3361,8 +4907,9 @@ | ||
| 3361 | 4907 | const self = this; |
| 3362 | 4908 | self.settings.shouldOpen = true; // make sure the input is shown even if there are no options to display in the dropdown |
| 3363 | 4909 | |
| 3364 | 4910 | self.hook('before', 'setup', () => { |
| 4911 | + var _self$input; | |
| 3365 | 4912 | self.focus_node = self.control; |
| 3366 | 4913 | addClasses(self.control_input, 'dropdown-input'); |
| 3367 | 4914 | const div = getDom('<div class="dropdown-input-wrap">'); |
| 3368 | 4915 | div.append(self.control_input); |
| @@ -3371,8 +4918,17 @@ | ||
| 3371 | 4918 | // set a placeholder in the select control |
| 3372 | 4919 | const placeholder = getDom('<input class="items-placeholder" tabindex="-1" />'); |
| 3373 | 4920 | placeholder.placeholder = self.settings.placeholder || ''; |
| 3374 | 4921 | self.control.append(placeholder); |
| 4922 | + /** | |
| 4923 | + * TomSelect renders a custom control with a focusable <input class="items-placeholder">. | |
| 4924 | + * The source <select>'s aria-label is not automatically propagated to that input, | |
| 4925 | + * which triggers "Missing form label" accessibility warnings. | |
| 4926 | + * This helper copies the label from the <select> onto the generated input. | |
| 4927 | + */ | |
| 4928 | + const label = (_self$input = self.input) == null ? void 0 : _self$input.getAttribute('aria-label'); | |
| 4929 | + if (!label) return; | |
| 4930 | + placeholder.setAttribute('aria-label', label); | |
| 3375 | 4931 | }); |
| 3376 | 4932 | self.on('initialize', () => { |
| 3377 | 4933 | // set tabIndex on control to -1, otherwise [shift+tab] will put focus right back on control_input |
| 3378 | 4934 | self.control_input.addEventListener('keydown', evt => { |
| @@ -3429,14 +4985,15 @@ | ||
| 3429 | 4985 | !*** ./node_modules/tom-select/dist/esm/plugins/input_autogrow/plugin.js ***! |
| 3430 | 4986 | \***************************************************************************/ |
| 3431 | 4987 | (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { |
| 3432 | 4988 | |
| 4989 | +"use strict"; | |
| 3433 | 4990 | __webpack_require__.r(__webpack_exports__); |
| 3434 | 4991 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 3435 | 4992 | /* harmony export */ "default": () => (/* binding */ plugin) |
| 3436 | 4993 | /* harmony export */ }); |
| 3437 | 4994 | /** |
| 3438 | -* Tom Select v2.4.3 | |
| 4995 | +* Tom Select v2.6.2 | |
| 3439 | 4996 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 3440 | 4997 | */ |
| 3441 | 4998 | |
| 3442 | 4999 | /** |
| @@ -3517,14 +5074,15 @@ | ||
| 3517 | 5074 | !*** ./node_modules/tom-select/dist/esm/plugins/no_active_items/plugin.js ***! |
| 3518 | 5075 | \****************************************************************************/ |
| 3519 | 5076 | (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { |
| 3520 | 5077 | |
| 5078 | +"use strict"; | |
| 3521 | 5079 | __webpack_require__.r(__webpack_exports__); |
| 3522 | 5080 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 3523 | 5081 | /* harmony export */ "default": () => (/* binding */ plugin) |
| 3524 | 5082 | /* harmony export */ }); |
| 3525 | 5083 | /** |
| 3526 | -* Tom Select v2.4.3 | |
| 5084 | +* Tom Select v2.6.2 | |
| 3527 | 5085 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 3528 | 5086 | */ |
| 3529 | 5087 | |
| 3530 | 5088 | /** |
| @@ -3557,14 +5115,15 @@ | ||
| 3557 | 5115 | !*** ./node_modules/tom-select/dist/esm/plugins/no_backspace_delete/plugin.js ***! |
| 3558 | 5116 | \********************************************************************************/ |
| 3559 | 5117 | (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { |
| 3560 | 5118 | |
| 5119 | +"use strict"; | |
| 3561 | 5120 | __webpack_require__.r(__webpack_exports__); |
| 3562 | 5121 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 3563 | 5122 | /* harmony export */ "default": () => (/* binding */ plugin) |
| 3564 | 5123 | /* harmony export */ }); |
| 3565 | 5124 | /** |
| 3566 | -* Tom Select v2.4.3 | |
| 5125 | +* Tom Select v2.6.2 | |
| 3567 | 5126 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 3568 | 5127 | */ |
| 3569 | 5128 | |
| 3570 | 5129 | /** |
| @@ -3603,14 +5162,15 @@ | ||
| 3603 | 5162 | !*** ./node_modules/tom-select/dist/esm/plugins/optgroup_columns/plugin.js ***! |
| 3604 | 5163 | \*****************************************************************************/ |
| 3605 | 5164 | (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { |
| 3606 | 5165 | |
| 5166 | +"use strict"; | |
| 3607 | 5167 | __webpack_require__.r(__webpack_exports__); |
| 3608 | 5168 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 3609 | 5169 | /* harmony export */ "default": () => (/* binding */ plugin) |
| 3610 | 5170 | /* harmony export */ }); |
| 3611 | 5171 | /** |
| 3612 | -* Tom Select v2.4.3 | |
| 5172 | +* Tom Select v2.6.2 | |
| 3613 | 5173 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 3614 | 5174 | */ |
| 3615 | 5175 | |
| 3616 | 5176 | const KEY_LEFT = 37; |
| @@ -3703,14 +5263,15 @@ | ||
| 3703 | 5263 | !*** ./node_modules/tom-select/dist/esm/plugins/remove_button/plugin.js ***! |
| 3704 | 5264 | \**************************************************************************/ |
| 3705 | 5265 | (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { |
| 3706 | 5266 | |
| 5267 | +"use strict"; | |
| 3707 | 5268 | __webpack_require__.r(__webpack_exports__); |
| 3708 | 5269 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 3709 | 5270 | /* harmony export */ "default": () => (/* binding */ plugin) |
| 3710 | 5271 | /* harmony export */ }); |
| 3711 | 5272 | /** |
| 3712 | -* Tom Select v2.4.3 | |
| 5273 | +* Tom Select v2.6.2 | |
| 3713 | 5274 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 3714 | 5275 | */ |
| 3715 | 5276 | |
| 3716 | 5277 | /** |
| @@ -3728,16 +5289,8 @@ | ||
| 3728 | 5289 | * |
| 3729 | 5290 | */ |
| 3730 | 5291 | |
| 3731 | 5292 | /** |
| 3732 | - * Escapes a string for use within HTML. | |
| 3733 | - * | |
| 3734 | - */ | |
| 3735 | -const escape_html = str => { | |
| 3736 | - return (str + '').replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"'); | |
| 3737 | -}; | |
| 3738 | - | |
| 3739 | -/** | |
| 3740 | 5293 | * Prevent default |
| 3741 | 5294 | * |
| 3742 | 5295 | */ |
| 3743 | 5296 | const preventDefault = (evt, stop = false) => { |
| @@ -3799,28 +5352,31 @@ | ||
| 3799 | 5352 | * |
| 3800 | 5353 | */ |
| 3801 | 5354 | |
| 3802 | 5355 | function plugin (userOptions) { |
| 5356 | + const self = this; | |
| 3803 | 5357 | const options = Object.assign({ |
| 3804 | - label: '×', | |
| 5358 | + label: '×', | |
| 3805 | 5359 | title: 'Remove', |
| 3806 | 5360 | className: 'remove', |
| 3807 | - append: true | |
| 5361 | + tabindex: -1, | |
| 5362 | + role: 'button', | |
| 5363 | + html: data => { | |
| 5364 | + var _data$tabindex; | |
| 5365 | + const el = document.createElement('div'); | |
| 5366 | + el.className = data.className || ''; | |
| 5367 | + el.title = data.title || ''; | |
| 5368 | + el.setAttribute('role', data.role || 'button'); | |
| 5369 | + el.tabIndex = (_data$tabindex = data.tabindex) != null ? _data$tabindex : -1; | |
| 5370 | + el.textContent = data.label || ''; | |
| 5371 | + return el; | |
| 5372 | + } | |
| 3808 | 5373 | }, userOptions); |
| 3809 | - | |
| 3810 | - //options.className = 'remove-single'; | |
| 3811 | - var self = this; | |
| 3812 | - | |
| 3813 | - // override the render method to add remove button to each item | |
| 3814 | - if (!options.append) { | |
| 3815 | - return; | |
| 3816 | - } | |
| 3817 | - var html = '<a href="javascript:void(0)" class="' + options.className + '" tabindex="-1" title="' + escape_html(options.title) + '">' + options.label + '</a>'; | |
| 3818 | 5374 | self.hook('after', 'setupTemplates', () => { |
| 3819 | 5375 | var orig_render_item = self.settings.render.item; |
| 3820 | 5376 | self.settings.render.item = (data, escape) => { |
| 3821 | 5377 | var item = getDom(orig_render_item.call(self, data, escape)); |
| 3822 | - var close_button = getDom(html); | |
| 5378 | + var close_button = getDom(options.html(options)); | |
| 3823 | 5379 | item.appendChild(close_button); |
| 3824 | 5380 | addEvent(close_button, 'mousedown', evt => { |
| 3825 | 5381 | preventDefault(evt, true); |
| 3826 | 5382 | }); |
| @@ -3851,14 +5407,15 @@ | ||
| 3851 | 5407 | !*** ./node_modules/tom-select/dist/esm/plugins/restore_on_backspace/plugin.js ***! |
| 3852 | 5408 | \*********************************************************************************/ |
| 3853 | 5409 | (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { |
| 3854 | 5410 | |
| 5411 | +"use strict"; | |
| 3855 | 5412 | __webpack_require__.r(__webpack_exports__); |
| 3856 | 5413 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 3857 | 5414 | /* harmony export */ "default": () => (/* binding */ plugin) |
| 3858 | 5415 | /* harmony export */ }); |
| 3859 | 5416 | /** |
| 3860 | -* Tom Select v2.4.3 | |
| 5417 | +* Tom Select v2.6.2 | |
| 3861 | 5418 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 3862 | 5419 | */ |
| 3863 | 5420 | |
| 3864 | 5421 | /** |
| @@ -3907,14 +5464,15 @@ | ||
| 3907 | 5464 | !*** ./node_modules/tom-select/dist/esm/plugins/virtual_scroll/plugin.js ***! |
| 3908 | 5465 | \***************************************************************************/ |
| 3909 | 5466 | (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { |
| 3910 | 5467 | |
| 5468 | +"use strict"; | |
| 3911 | 5469 | __webpack_require__.r(__webpack_exports__); |
| 3912 | 5470 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 3913 | 5471 | /* harmony export */ "default": () => (/* binding */ plugin) |
| 3914 | 5472 | /* harmony export */ }); |
| 3915 | 5473 | /** |
| 3916 | -* Tom Select v2.4.3 | |
| 5474 | +* Tom Select v2.6.2 | |
| 3917 | 5475 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 3918 | 5476 | */ |
| 3919 | 5477 | |
| 3920 | 5478 | /** |
| @@ -3996,9 +5554,9 @@ | ||
| 3996 | 5554 | return arg; |
| 3997 | 5555 | }; |
| 3998 | 5556 | |
| 3999 | 5557 | /** |
| 4000 | - * Plugin: "restore_on_backspace" (Tom Select) | |
| 5558 | + * Plugin: "virtual_scroll" (Tom Select) | |
| 4001 | 5559 | * Copyright (c) contributors |
| 4002 | 5560 | * |
| 4003 | 5561 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this |
| 4004 | 5562 | * file except in compliance with the License. You may obtain a copy of the License at: |
| @@ -4020,8 +5578,12 @@ | ||
| 4020 | 5578 | var dropdown_content; |
| 4021 | 5579 | var loading_more = false; |
| 4022 | 5580 | var load_more_opt; |
| 4023 | 5581 | var default_values = []; |
| 5582 | + var default_values_loaded = false; | |
| 5583 | + var default_pagination; | |
| 5584 | + var default_options = []; | |
| 5585 | + var html_values = []; | |
| 4024 | 5586 | if (!self.settings.shouldLoadMore) { |
| 4025 | 5587 | // return true if additional results should be loaded |
| 4026 | 5588 | self.settings.shouldLoadMore = () => { |
| 4027 | 5589 | const scroll_percent = dropdown_content.clientHeight / (dropdown_content.scrollHeight - dropdown_content.scrollTop); |
| @@ -4051,9 +5613,9 @@ | ||
| 4051 | 5613 | }]; |
| 4052 | 5614 | |
| 4053 | 5615 | // can we load more results for given query? |
| 4054 | 5616 | const canLoadMore = query => { |
| 4055 | - if (typeof self.settings.maxOptions === 'number' && dropdown_content.children.length >= self.settings.maxOptions) { | |
| 5617 | + if (self.settings.maxOptions !== null && typeof self.settings.maxOptions === 'number' && dropdown_content.children.length >= self.settings.maxOptions) { | |
| 4056 | 5618 | return false; |
| 4057 | 5619 | } |
| 4058 | 5620 | if (query in pagination && pagination[query]) { |
| 4059 | 5621 | return true; |
| @@ -4111,9 +5673,13 @@ | ||
| 4111 | 5673 | |
| 4112 | 5674 | // wrap the load |
| 4113 | 5675 | self.hook('instead', 'loadCallback', (options, optgroups) => { |
| 4114 | 5676 | if (!loading_more) { |
| 4115 | - self.clearOptions(clearFilter); | |
| 5677 | + // When searching (non-empty query), keep selected items and HTML default options, | |
| 5678 | + // but remove preloaded remote options so they don't bleed into search results. | |
| 5679 | + // For empty query, use clearFilter (keeps default_values + items). | |
| 5680 | + const activeFilter = self.lastValue !== '' ? (_option, value) => self.items.indexOf(value) >= 0 || html_values.indexOf(value) >= 0 : clearFilter; | |
| 5681 | + self.clearOptions(activeFilter); | |
| 4116 | 5682 | } else if (load_more_opt) { |
| 4117 | 5683 | const first_option = options[0]; |
| 4118 | 5684 | if (first_option !== undefined) { |
| 4119 | 5685 | load_more_opt.dataset.value = first_option[self.settings.valueField]; |
| @@ -4119,11 +5685,31 @@ | ||
| 4119 | 5685 | load_more_opt.dataset.value = first_option[self.settings.valueField]; |
| 4120 | 5686 | } |
| 4121 | 5687 | } |
| 4122 | 5688 | orig_loadCallback.call(self, options, optgroups); |
| 5689 | + | |
| 5690 | + // After the initial preload (empty query), snapshot default_values and option objects | |
| 5691 | + // so they can be restored when the user clears their search. | |
| 5692 | + if (!loading_more && !default_values_loaded) { | |
| 5693 | + default_values_loaded = true; | |
| 5694 | + if (self.lastValue === '') { | |
| 5695 | + default_values = Object.keys(self.options); | |
| 5696 | + default_pagination = pagination['']; | |
| 5697 | + default_options = Object.values(self.options); | |
| 5698 | + } | |
| 5699 | + } | |
| 4123 | 5700 | loading_more = false; |
| 4124 | 5701 | }); |
| 4125 | 5702 | |
| 5703 | + // as the “loading_more” element will be removed from the dropdown, | |
| 5704 | + // we activate the previous option if needed | |
| 5705 | + // to avoid the dropdown being scrolled back to the first one | |
| 5706 | + self.hook('before', 'refreshOptions', () => { | |
| 5707 | + if (self.activeOption && "option" !== self.activeOption.getAttribute("role")) { | |
| 5708 | + self.setActiveOption(self.activeOption.previousElementSibling); | |
| 5709 | + } | |
| 5710 | + }); | |
| 5711 | + | |
| 4126 | 5712 | // add templates to dropdown |
| 4127 | 5713 | // loading_more if we have another url in the queue |
| 4128 | 5714 | // no_more_results if we don't have another url in the queue |
| 4129 | 5715 | self.hook('after', 'refreshOptions', () => { |
| @@ -4147,10 +5733,32 @@ | ||
| 4147 | 5733 | dropdown_content.append(option); |
| 4148 | 5734 | } |
| 4149 | 5735 | }); |
| 4150 | 5736 | |
| 5737 | + // Restore preloaded options and pagination when clearing search | |
| 5738 | + const restoreDefaults = () => { | |
| 5739 | + if (!default_values_loaded) { | |
| 5740 | + return; | |
| 5741 | + } | |
| 5742 | + // Re-add preloaded option objects (clearOptions can only remove, not restore) | |
| 5743 | + self.addOptions(default_options); | |
| 5744 | + // Remove any search results that are not part of the preloaded defaults | |
| 5745 | + self.clearOptions(clearFilter); | |
| 5746 | + if (default_pagination) { | |
| 5747 | + pagination[''] = default_pagination; | |
| 5748 | + } | |
| 5749 | + }; | |
| 5750 | + self.on('type', query => { | |
| 5751 | + if (query === '') { | |
| 5752 | + restoreDefaults(); | |
| 5753 | + self.refreshOptions(false); | |
| 5754 | + } | |
| 5755 | + }); | |
| 5756 | + self.on('dropdown_close', restoreDefaults); | |
| 5757 | + | |
| 4151 | 5758 | // add scroll listener and default templates |
| 4152 | 5759 | self.on('initialize', () => { |
| 5760 | + html_values = Object.keys(self.options); | |
| 4153 | 5761 | default_values = Object.keys(self.options); |
| 4154 | 5762 | dropdown_content = self.dropdown_content; |
| 4155 | 5763 | |
| 4156 | 5764 | // default templates |
| @@ -4193,8 +5801,9 @@ | ||
| 4193 | 5801 | !*** ./node_modules/tom-select/dist/esm/tom-select.complete.js ***! |
| 4194 | 5802 | \*****************************************************************/ |
| 4195 | 5803 | (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { |
| 4196 | 5804 | |
| 5805 | +"use strict"; | |
| 4197 | 5806 | __webpack_require__.r(__webpack_exports__); |
| 4198 | 5807 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 4199 | 5808 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 4200 | 5809 | /* harmony export */ }); |
| @@ -4252,8 +5861,9 @@ | ||
| 4252 | 5861 | !*** ./node_modules/tom-select/dist/esm/tom-select.js ***! |
| 4253 | 5862 | \********************************************************/ |
| 4254 | 5863 | (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { |
| 4255 | 5864 | |
| 5865 | +"use strict"; | |
| 4256 | 5866 | __webpack_require__.r(__webpack_exports__); |
| 4257 | 5867 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 4258 | 5868 | /* harmony export */ "default": () => (/* binding */ TomSelect) |
| 4259 | 5869 | /* harmony export */ }); |
| @@ -4288,8 +5898,9 @@ | ||
| 4288 | 5898 | this.isLocked = false; |
| 4289 | 5899 | this.isFocused = false; |
| 4290 | 5900 | this.isInputHidden = false; |
| 4291 | 5901 | this.isSetup = false; |
| 5902 | + this.isDropdownContentStale = true; | |
| 4292 | 5903 | this.ignoreFocus = false; |
| 4293 | 5904 | this.ignoreHover = false; |
| 4294 | 5905 | this.hasOptions = false; |
| 4295 | 5906 | this.lastValue = ''; |
| @@ -4364,9 +5975,9 @@ | ||
| 4364 | 5975 | (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.addClasses)(dropdown, settings.dropdownClass, inputMode); |
| 4365 | 5976 | if (settings.copyClassesToDropdown) { |
| 4366 | 5977 | (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.addClasses)(dropdown, classes); |
| 4367 | 5978 | } |
| 4368 | - (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.addClasses)(dropdown_content, settings.dropdownContentClass); | |
| 5979 | + ;(0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.addClasses)(dropdown_content, settings.dropdownContentClass); | |
| 4369 | 5980 | (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.append)(dropdown, dropdown_content); |
| 4370 | 5981 | (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.getDom)(settings.dropdownParent || wrapper).appendChild(dropdown); |
| 4371 | 5982 | // default controlInput |
| 4372 | 5983 | if ((0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.isHtmlString)(settings.controlInput)) { |
| @@ -4371,9 +5982,9 @@ | ||
| 4371 | 5982 | // default controlInput |
| 4372 | 5983 | if ((0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.isHtmlString)(settings.controlInput)) { |
| 4373 | 5984 | control_input = (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.getDom)(settings.controlInput); |
| 4374 | 5985 | // set attributes |
| 4375 | - var attrs = ['autocorrect', 'autocapitalize', 'autocomplete', 'spellcheck']; | |
| 5986 | + var attrs = ['autocorrect', 'autocapitalize', 'autocomplete', 'spellcheck', 'aria-label']; | |
| 4376 | 5987 | (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.iterate)(attrs, (attr) => { |
| 4377 | 5988 | if (input.getAttribute(attr)) { |
| 4378 | 5989 | (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.setAttr)(control_input, { [attr]: input.getAttribute(attr) }); |
| 4379 | 5990 | } |
| @@ -4434,8 +6045,10 @@ | ||
| 4434 | 6045 | (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.setAttr)(focus_node, { 'aria-labelledby': label_id }); |
| 4435 | 6046 | (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.setAttr)(dropdown_content, { 'aria-labelledby': label_id }); |
| 4436 | 6047 | } |
| 4437 | 6048 | wrapper.style.width = input.style.width; |
| 6049 | + wrapper.style.minWidth = input.style.minWidth; | |
| 6050 | + wrapper.style.maxWidth = input.style.maxWidth; | |
| 4438 | 6051 | if (self.plugins.names.length) { |
| 4439 | 6052 | const classes_plugins = 'plugin-' + self.plugins.names.join(' plugin-'); |
| 4440 | 6053 | (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.addClasses)([wrapper, dropdown], classes_plugins); |
| 4441 | 6054 | } |
| @@ -4453,9 +6066,9 @@ | ||
| 4453 | 6066 | // after initializePlugins() so plugins can create/modify user defined loaders |
| 4454 | 6067 | if (settings.load && settings.loadThrottle) { |
| 4455 | 6068 | settings.load = (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.loadDebounce)(settings.load, settings.loadThrottle); |
| 4456 | 6069 | } |
| 4457 | - (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.addEvent)(dropdown, 'mousemove', () => { | |
| 6070 | + ;(0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.addEvent)(dropdown, 'mousemove', () => { | |
| 4458 | 6071 | self.ignoreHover = false; |
| 4459 | 6072 | }); |
| 4460 | 6073 | (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.addEvent)(dropdown, 'mouseenter', (e) => { |
| 4461 | 6074 | var target_match = (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.parentMatch)(e.target, '[data-selectable]', dropdown); |
| @@ -4518,12 +6131,21 @@ | ||
| 4518 | 6131 | if (self.isOpen) { |
| 4519 | 6132 | self.positionDropdown(); |
| 4520 | 6133 | } |
| 4521 | 6134 | }; |
| 6135 | + const input_invalid = () => { | |
| 6136 | + if (self.isValid) { | |
| 6137 | + self.isValid = false; | |
| 6138 | + self.isInvalid = true; | |
| 6139 | + self.refreshState(); | |
| 6140 | + } | |
| 6141 | + }; | |
| 6142 | + (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.addEvent)(input, 'invalid', input_invalid); | |
| 4522 | 6143 | (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.addEvent)(document, 'mousedown', doc_mousedown); |
| 4523 | 6144 | (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.addEvent)(window, 'scroll', win_scroll, passive_event); |
| 4524 | 6145 | (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.addEvent)(window, 'resize', win_scroll, passive_event); |
| 4525 | 6146 | this._destroy = () => { |
| 6147 | + input.removeEventListener('invalid', input_invalid); | |
| 4526 | 6148 | document.removeEventListener('mousedown', doc_mousedown); |
| 4527 | 6149 | window.removeEventListener('scroll', win_scroll); |
| 4528 | 6150 | window.removeEventListener('resize', win_scroll); |
| 4529 | 6151 | if (label) |
| @@ -4540,29 +6162,12 @@ | ||
| 4540 | 6162 | self.sync(false); |
| 4541 | 6163 | settings.items = []; |
| 4542 | 6164 | delete settings.optgroups; |
| 4543 | 6165 | delete settings.options; |
| 4544 | - (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.addEvent)(input, 'invalid', () => { | |
| 4545 | - if (self.isValid) { | |
| 4546 | - self.isValid = false; | |
| 4547 | - self.isInvalid = true; | |
| 4548 | - self.refreshState(); | |
| 4549 | - } | |
| 4550 | - }); | |
| 4551 | - self.updateOriginalInput(); | |
| 4552 | 6166 | self.refreshItems(); |
| 4553 | 6167 | self.close(false); |
| 4554 | 6168 | self.inputState(); |
| 4555 | 6169 | self.isSetup = true; |
| 4556 | - if (input.disabled) { | |
| 4557 | - self.disable(); | |
| 4558 | - } | |
| 4559 | - else if (input.readOnly) { | |
| 4560 | - self.setReadOnly(true); | |
| 4561 | - } | |
| 4562 | - else { | |
| 4563 | - self.enable(); //sets tabIndex | |
| 4564 | - } | |
| 4565 | 6170 | self.on('change', this.onChange); |
| 4566 | 6171 | (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.addClasses)(input, 'tomselected', 'ts-hidden-accessible'); |
| 4567 | 6172 | self.trigger('initialize'); |
| 4568 | 6173 | // preload options |
| @@ -4658,11 +6263,20 @@ | ||
| 4658 | 6263 | * |
| 4659 | 6264 | */ |
| 4660 | 6265 | sync(get_settings = true) { |
| 4661 | 6266 | const self = this; |
| 4662 | - const settings = get_settings ? (0,_getSettings_js__WEBPACK_IMPORTED_MODULE_6__["default"])(self.input, { delimiter: self.settings.delimiter }) : self.settings; | |
| 6267 | + const settings = get_settings ? (0,_getSettings_js__WEBPACK_IMPORTED_MODULE_6__["default"])(self.input, { delimiter: self.settings.delimiter, allowEmptyOption: self.settings.allowEmptyOption }) : self.settings; | |
| 4663 | 6268 | self.setupOptions(settings.options, settings.optgroups); |
| 4664 | 6269 | self.setValue(settings.items || [], true); // silent prevents recursion |
| 6270 | + if (self.input.disabled) { | |
| 6271 | + self.disable(); | |
| 6272 | + } | |
| 6273 | + else if (self.input.readOnly) { | |
| 6274 | + self.setReadOnly(true); | |
| 6275 | + } | |
| 6276 | + else { | |
| 6277 | + self.enable(); //sets tabIndex | |
| 6278 | + } | |
| 4665 | 6279 | self.lastQuery = null; // so updated options will be displayed in dropdown |
| 4666 | 6280 | } |
| 4667 | 6281 | /** |
| 4668 | 6282 | * Triggered when the main control element |
| @@ -4693,9 +6307,9 @@ | ||
| 4693 | 6307 | * This should propagate the event to the original DOM |
| 4694 | 6308 | * input / select element. |
| 4695 | 6309 | */ |
| 4696 | 6310 | onChange() { |
| 4697 | - (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.triggerEvent)(this.input, 'input'); | |
| 6311 | + ;(0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.triggerEvent)(this.input, 'input'); | |
| 4698 | 6312 | (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.triggerEvent)(this.input, 'change'); |
| 4699 | 6313 | } |
| 4700 | 6314 | /** |
| 4701 | 6315 | * Triggered on <input> paste. |
| @@ -4790,9 +6404,9 @@ | ||
| 4790 | 6404 | let next = self.getAdjacent(self.activeOption, 1); |
| 4791 | 6405 | if (next) |
| 4792 | 6406 | self.setActiveOption(next); |
| 4793 | 6407 | } |
| 4794 | - (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.preventDefault)(e); | |
| 6408 | + ;(0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.preventDefault)(e); | |
| 4795 | 6409 | return; |
| 4796 | 6410 | // up: move selection up |
| 4797 | 6411 | case _constants_js__WEBPACK_IMPORTED_MODULE_5__.KEY_UP: |
| 4798 | 6412 | if (self.activeOption) { |
| @@ -4799,9 +6413,9 @@ | ||
| 4799 | 6413 | let prev = self.getAdjacent(self.activeOption, -1); |
| 4800 | 6414 | if (prev) |
| 4801 | 6415 | self.setActiveOption(prev); |
| 4802 | 6416 | } |
| 4803 | - (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.preventDefault)(e); | |
| 6417 | + ;(0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.preventDefault)(e); | |
| 4804 | 6418 | return; |
| 4805 | 6419 | // return: select active option |
| 4806 | 6420 | case _constants_js__WEBPACK_IMPORTED_MODULE_5__.KEY_RETURN: |
| 4807 | 6421 | if (self.canSelect(self.activeOption)) { |
| @@ -4833,9 +6447,9 @@ | ||
| 4833 | 6447 | // prevent default [tab] behaviour of jump to the next field |
| 4834 | 6448 | // if select isFull, then the dropdown won't be open and [tab] will work normally |
| 4835 | 6449 | (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.preventDefault)(e); |
| 4836 | 6450 | } |
| 4837 | - if (self.settings.create && self.createItem()) { | |
| 6451 | + else if (self.settings.create && self.createItem()) { | |
| 4838 | 6452 | (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.preventDefault)(e); |
| 4839 | 6453 | } |
| 4840 | 6454 | } |
| 4841 | 6455 | return; |
| @@ -4957,18 +6571,24 @@ | ||
| 4957 | 6571 | self.createItem(null, () => { |
| 4958 | 6572 | if (self.settings.closeAfterSelect) { |
| 4959 | 6573 | self.close(); |
| 4960 | 6574 | } |
| 6575 | + else if (self.settings.clearAfterSelect) { | |
| 6576 | + self.setTextboxValue(); | |
| 6577 | + } | |
| 4961 | 6578 | }); |
| 4962 | 6579 | } |
| 4963 | 6580 | else { |
| 4964 | 6581 | value = option.dataset.value; |
| 4965 | 6582 | if (typeof value !== 'undefined') { |
| 4966 | - self.lastQuery = null; | |
| 6583 | + self.isDropdownContentStale = self.settings.hideSelected; | |
| 4967 | 6584 | self.addItem(value); |
| 4968 | 6585 | if (self.settings.closeAfterSelect) { |
| 4969 | 6586 | self.close(); |
| 4970 | 6587 | } |
| 6588 | + else if (self.settings.clearAfterSelect) { | |
| 6589 | + self.setTextboxValue(); | |
| 6590 | + } | |
| 4971 | 6591 | if (!self.settings.hideSelected && evt.type && /click/.test(evt.type)) { |
| 4972 | 6592 | self.setActiveOption(option); |
| 4973 | 6593 | } |
| 4974 | 6594 | } |
| @@ -5040,9 +6660,9 @@ | ||
| 5040 | 6660 | */ |
| 5041 | 6661 | loadCallback(options, optgroups) { |
| 5042 | 6662 | const self = this; |
| 5043 | 6663 | self.loading = Math.max(self.loading - 1, 0); |
| 5044 | - self.lastQuery = null; | |
| 6664 | + self.isDropdownContentStale = true; | |
| 5045 | 6665 | self.clearActiveOption(); // when new results load, focus should be on first option |
| 5046 | 6666 | self.setupOptions(options, optgroups); |
| 5047 | 6667 | self.refreshOptions(self.isFocused && !self.isInputHidden); |
| 5048 | 6668 | if (!self.loading) { |
| @@ -5139,9 +6759,9 @@ | ||
| 5139 | 6759 | if (self.activeItems.indexOf(item) === -1) { |
| 5140 | 6760 | self.setActiveItemClass(item); |
| 5141 | 6761 | } |
| 5142 | 6762 | } |
| 5143 | - (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.preventDefault)(e); | |
| 6763 | + ;(0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.preventDefault)(e); | |
| 5144 | 6764 | } |
| 5145 | 6765 | 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))) { |
| 5146 | 6766 | if (item.classList.contains('active')) { |
| 5147 | 6767 | self.removeActiveItem(item); |
| @@ -5188,9 +6808,9 @@ | ||
| 5188 | 6808 | * Clears all the active items |
| 5189 | 6809 | * |
| 5190 | 6810 | */ |
| 5191 | 6811 | clearActiveItems() { |
| 5192 | - (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.removeClasses)(this.activeItems, 'active'); | |
| 6812 | + ;(0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.removeClasses)(this.activeItems, 'active'); | |
| 5193 | 6813 | this.activeItems = []; |
| 5194 | 6814 | } |
| 5195 | 6815 | /** |
| 5196 | 6816 | * Sets the selected item in the dropdown menu |
| @@ -5305,17 +6925,21 @@ | ||
| 5305 | 6925 | var self = this; |
| 5306 | 6926 | if (self.isDisabled || self.isReadOnly) |
| 5307 | 6927 | return; |
| 5308 | 6928 | self.ignoreFocus = true; |
| 5309 | - if (self.control_input.offsetWidth) { | |
| 5310 | - self.control_input.focus(); | |
| 5311 | - } | |
| 5312 | - else { | |
| 5313 | - self.focus_node.focus(); | |
| 5314 | - } | |
| 6929 | + const focusTarget = this.control_input.offsetWidth ? this.control_input : this.focus_node; | |
| 6930 | + focusTarget.focus(); | |
| 5315 | 6931 | setTimeout(() => { |
| 5316 | 6932 | self.ignoreFocus = false; |
| 5317 | - self.onFocus(); | |
| 6933 | + // Fix https://github.com/orchidjs/tom-select/issues/806 | |
| 6934 | + // Only proceed if this instance's element is still the active element. If Edge autofill | |
| 6935 | + // (or anything else) has moved focus to a different element in the interim, calling | |
| 6936 | + // onFocus() here would steal focus back and restart the cascade loop. | |
| 6937 | + const root = focusTarget.getRootNode(); | |
| 6938 | + if (root.activeElement !== focusTarget) { | |
| 6939 | + return; | |
| 6940 | + } | |
| 6941 | + this.onFocus(); | |
| 5318 | 6942 | }, 0); |
| 5319 | 6943 | } |
| 5320 | 6944 | /** |
| 5321 | 6945 | * Forces the control out of focus. |
| @@ -5371,10 +6995,15 @@ | ||
| 5371 | 6995 | throw new Error('Tom Select "score" setting must be a function that returns a function'); |
| 5372 | 6996 | } |
| 5373 | 6997 | } |
| 5374 | 6998 | // perform search |
| 5375 | - if (query !== self.lastQuery) { | |
| 6999 | + if (self.isDropdownContentStale || query !== self.lastQuery) { | |
| 5376 | 7000 | self.lastQuery = query; |
| 7001 | + // temp fix for https://github.com/orchidjs/tom-select/issues/987 | |
| 7002 | + // UI crashed when more than 30 same chars in a row, prevent search and return empt result | |
| 7003 | + if (/(.)\1{15,}/.test(query)) { | |
| 7004 | + query = ''; | |
| 7005 | + } | |
| 5377 | 7006 | result = self.sifter.search(query, Object.assign(options, { score: calculateScore })); |
| 5378 | 7007 | self.currentResults = result; |
| 5379 | 7008 | } |
| 5380 | 7009 | else { |
| @@ -5383,9 +7012,9 @@ | ||
| 5383 | 7012 | // filter out selected items |
| 5384 | 7013 | if (self.settings.hideSelected) { |
| 5385 | 7014 | result.items = result.items.filter((item) => { |
| 5386 | 7015 | let hashed = (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.hash_key)(item.id); |
| 5387 | - return !(hashed && self.items.indexOf(hashed) !== -1); | |
| 7016 | + return !(hashed !== null && self.items.indexOf(hashed) !== -1); | |
| 5388 | 7017 | }); |
| 5389 | 7018 | } |
| 5390 | 7019 | return result; |
| 5391 | 7020 | } |
| @@ -5455,8 +7084,15 @@ | ||
| 5455 | 7084 | for (j = 0, k = optgroups && optgroups.length; j < k; j++) { |
| 5456 | 7085 | optgroup = optgroups[j]; |
| 5457 | 7086 | let order = option.$order; |
| 5458 | 7087 | let self_optgroup = self.optgroups[optgroup]; |
| 7088 | + if (self_optgroup === undefined && typeof self.settings.optionGroupRegister === 'function') { | |
| 7089 | + var regGroup; | |
| 7090 | + if (regGroup = self.settings.optionGroupRegister.apply(self, [optgroup])) { | |
| 7091 | + self.registerOptionGroup(regGroup); | |
| 7092 | + } | |
| 7093 | + } | |
| 7094 | + self_optgroup = self.optgroups[optgroup]; | |
| 5459 | 7095 | if (self_optgroup === undefined) { |
| 5460 | 7096 | optgroup = ''; |
| 5461 | 7097 | } |
| 5462 | 7098 | else { |
| @@ -5509,8 +7145,9 @@ | ||
| 5509 | 7145 | } |
| 5510 | 7146 | }); |
| 5511 | 7147 | dropdown_content.innerHTML = ''; |
| 5512 | 7148 | (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.append)(dropdown_content, html); |
| 7149 | + self.isDropdownContentStale = false; | |
| 5513 | 7150 | // highlight matching terms inline |
| 5514 | 7151 | if (self.settings.highlight) { |
| 5515 | 7152 | (0,_contrib_highlight_js__WEBPACK_IMPORTED_MODULE_4__.removeHighlight)(dropdown_content); |
| 5516 | 7153 | if (results.query.length && results.tokens.length) { |
| @@ -5603,14 +7240,15 @@ | ||
| 5603 | 7240 | return false; |
| 5604 | 7241 | } |
| 5605 | 7242 | const key = (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.hash_key)(data[self.settings.valueField]); |
| 5606 | 7243 | if (key === null || self.options.hasOwnProperty(key)) { |
| 7244 | + self.updateOption(data[self.settings.valueField], data); | |
| 5607 | 7245 | return false; |
| 5608 | 7246 | } |
| 5609 | 7247 | data.$order = data.$order || ++self.order; |
| 5610 | 7248 | data.$id = self.inputId + '-opt-' + data.$order; |
| 5611 | 7249 | self.options[key] = data; |
| 5612 | - self.lastQuery = null; | |
| 7250 | + self.isDropdownContentStale = true; | |
| 5613 | 7251 | if (user_created) { |
| 5614 | 7252 | self.userOptions[key] = user_created; |
| 5615 | 7253 | self.trigger('option_add', key, data); |
| 5616 | 7254 | } |
| @@ -5620,9 +7258,9 @@ | ||
| 5620 | 7258 | * Add multiple options |
| 5621 | 7259 | * |
| 5622 | 7260 | */ |
| 5623 | 7261 | addOptions(data, user_created = false) { |
| 5624 | - (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.iterate)(data, (dat) => { | |
| 7262 | + ;(0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.iterate)(data, (dat) => { | |
| 5625 | 7263 | this.addOption(dat, user_created); |
| 5626 | 7264 | }); |
| 5627 | 7265 | } |
| 5628 | 7266 | /** |
| @@ -5724,10 +7362,10 @@ | ||
| 5724 | 7362 | if (item.classList.contains('active')) |
| 5725 | 7363 | (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.addClasses)(item_new, 'active'); |
| 5726 | 7364 | (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.replaceNode)(item, item_new); |
| 5727 | 7365 | } |
| 5728 | - // invalidate last query because we might have updated the sortField | |
| 5729 | - self.lastQuery = null; | |
| 7366 | + // we might have updated the sortField | |
| 7367 | + self.isDropdownContentStale = true; | |
| 5730 | 7368 | } |
| 5731 | 7369 | /** |
| 5732 | 7370 | * Removes a single option. |
| 5733 | 7371 | * |
| @@ -5737,9 +7375,9 @@ | ||
| 5737 | 7375 | value = (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.get_hash)(value); |
| 5738 | 7376 | self.uncacheValue(value); |
| 5739 | 7377 | delete self.userOptions[value]; |
| 5740 | 7378 | delete self.options[value]; |
| 5741 | - self.lastQuery = null; | |
| 7379 | + self.isDropdownContentStale = true; | |
| 5742 | 7380 | self.trigger('option_remove', value); |
| 5743 | 7381 | self.removeItem(value, silent); |
| 5744 | 7382 | } |
| 5745 | 7383 | /** |
| @@ -5756,9 +7394,9 @@ | ||
| 5756 | 7394 | selected[key] = option; |
| 5757 | 7395 | } |
| 5758 | 7396 | }); |
| 5759 | 7397 | this.options = this.sifter.items = selected; |
| 5760 | - this.lastQuery = null; | |
| 7398 | + this.isDropdownContentStale = true; | |
| 5761 | 7399 | this.trigger('option_clear'); |
| 5762 | 7400 | } |
| 5763 | 7401 | /** |
| 5764 | 7402 | * Used by clearOptions() to decide whether or not an option should be removed |
| @@ -5888,8 +7526,12 @@ | ||
| 5888 | 7526 | if (next) { |
| 5889 | 7527 | self.setActiveOption(next); |
| 5890 | 7528 | } |
| 5891 | 7529 | } |
| 7530 | + //remove input value when enabled | |
| 7531 | + if (self.settings.clearAfterSelect) { | |
| 7532 | + self.setTextboxValue(); | |
| 7533 | + } | |
| 5892 | 7534 | // refreshOptions after setActiveOption(), |
| 5893 | 7535 | // otherwise setActiveOption() will be called by refreshOptions() with the wrong value |
| 5894 | 7536 | if (!self.isPending && !self.settings.closeAfterSelect) { |
| 5895 | 7537 | self.refreshOptions(self.isFocused && inputMode !== 'single'); |
| @@ -5931,9 +7573,9 @@ | ||
| 5931 | 7573 | self.activeItems.splice(idx, 1); |
| 5932 | 7574 | (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.removeClasses)(item, 'active'); |
| 5933 | 7575 | } |
| 5934 | 7576 | self.items.splice(i, 1); |
| 5935 | - self.lastQuery = null; | |
| 7577 | + self.isDropdownContentStale = true; | |
| 5936 | 7578 | if (!self.settings.persist && self.userOptions.hasOwnProperty(value)) { |
| 5937 | 7579 | self.removeOption(value, silent); |
| 5938 | 7580 | } |
| 5939 | 7581 | if (i < self.caretPos) { |
| @@ -5965,8 +7607,14 @@ | ||
| 5965 | 7607 | var caret = self.caretPos; |
| 5966 | 7608 | var output; |
| 5967 | 7609 | input = input || self.inputValue(); |
| 5968 | 7610 | if (!self.canCreate(input)) { |
| 7611 | + const hash = (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.hash_key)(input); | |
| 7612 | + if (hash) { | |
| 7613 | + if (this.options[input]) { | |
| 7614 | + self.addItem(input); | |
| 7615 | + } | |
| 7616 | + } | |
| 5969 | 7617 | callback(); |
| 5970 | 7618 | return false; |
| 5971 | 7619 | } |
| 5972 | 7620 | self.lock(); |
| @@ -6004,9 +7652,9 @@ | ||
| 6004 | 7652 | * Re-renders the selected item lists. |
| 6005 | 7653 | */ |
| 6006 | 7654 | refreshItems() { |
| 6007 | 7655 | var self = this; |
| 6008 | - self.lastQuery = null; | |
| 7656 | + self.isDropdownContentStale = true; | |
| 6009 | 7657 | if (self.isSetup) { |
| 6010 | 7658 | self.addItems(self.items); |
| 6011 | 7659 | } |
| 6012 | 7660 | self.updateOriginalInput(); |
| @@ -6083,9 +7731,9 @@ | ||
| 6083 | 7731 | } |
| 6084 | 7732 | selected.push(option_el); |
| 6085 | 7733 | // marking empty option as selected can break validation |
| 6086 | 7734 | // fixes https://github.com/orchidjs/tom-select/issues/303 |
| 6087 | - if (option_el != empty_option || has_selected > 0) { | |
| 7735 | + if (option_el != empty_option || has_selected > 0 || self.settings.mode == 'multi') { | |
| 6088 | 7736 | option_el.selected = true; |
| 6089 | 7737 | } |
| 6090 | 7738 | return option_el; |
| 6091 | 7739 | } |
| @@ -6226,9 +7874,9 @@ | ||
| 6226 | 7874 | caret = (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.nodeIndex)(tail); |
| 6227 | 7875 | if (direction > 0) { |
| 6228 | 7876 | caret++; |
| 6229 | 7877 | } |
| 6230 | - (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.iterate)(self.activeItems, (item) => rm_items.push(item)); | |
| 7878 | + ;(0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.iterate)(self.activeItems, (item) => rm_items.push(item)); | |
| 6231 | 7879 | } |
| 6232 | 7880 | else if ((self.isFocused || self.settings.mode === 'single') && self.items.length) { |
| 6233 | 7881 | const items = self.controlChildren(); |
| 6234 | 7882 | let rm_item; |
| @@ -6244,9 +7892,9 @@ | ||
| 6244 | 7892 | } |
| 6245 | 7893 | if (!self.shouldDelete(rm_items, e)) { |
| 6246 | 7894 | return false; |
| 6247 | 7895 | } |
| 6248 | - (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.preventDefault)(e, true); | |
| 7896 | + ;(0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.preventDefault)(e, true); | |
| 6249 | 7897 | // perform removal |
| 6250 | 7898 | if (typeof caret !== 'undefined') { |
| 6251 | 7899 | self.setCaret(caret); |
| 6252 | 7900 | } |
| @@ -6263,9 +7911,9 @@ | ||
| 6263 | 7911 | */ |
| 6264 | 7912 | shouldDelete(items, evt) { |
| 6265 | 7913 | const values = items.map(item => item.dataset.value); |
| 6266 | 7914 | // allow the callback to abort |
| 6267 | - if (!values.length || (typeof this.settings.onDelete === 'function' && this.settings.onDelete(values, evt) === false)) { | |
| 7915 | + if (!values.length || (typeof this.settings.onDelete === 'function' && this.settings.onDelete.call(this, values, evt) === false)) { | |
| 6268 | 7916 | return false; |
| 6269 | 7917 | } |
| 6270 | 7918 | return true; |
| 6271 | 7919 | } |
| @@ -6482,9 +8130,9 @@ | ||
| 6482 | 8130 | * caches. |
| 6483 | 8131 | * |
| 6484 | 8132 | */ |
| 6485 | 8133 | clearCache() { |
| 6486 | - (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.iterate)(this.options, (option) => { | |
| 8134 | + ;(0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.iterate)(this.options, (option) => { | |
| 6487 | 8135 | if (option.$div) { |
| 6488 | 8136 | option.$div.remove(); |
| 6489 | 8137 | delete option.$div; |
| 6490 | 8138 | } |
| @@ -6543,8 +8191,9 @@ | ||
| 6543 | 8191 | !*** ./node_modules/tom-select/dist/esm/utils.js ***! |
| 6544 | 8192 | \***************************************************/ |
| 6545 | 8193 | (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { |
| 6546 | 8194 | |
| 8195 | +"use strict"; | |
| 6547 | 8196 | __webpack_require__.r(__webpack_exports__); |
| 6548 | 8197 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 6549 | 8198 | /* harmony export */ addEvent: () => (/* binding */ addEvent), |
| 6550 | 8199 | /* harmony export */ addSlashes: () => (/* binding */ addSlashes), |
| @@ -6764,8 +8413,9 @@ | ||
| 6764 | 8413 | !*** ./node_modules/tom-select/dist/esm/vanilla.js ***! |
| 6765 | 8414 | \*****************************************************/ |
| 6766 | 8415 | (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { |
| 6767 | 8416 | |
| 8417 | +"use strict"; | |
| 6768 | 8418 | __webpack_require__.r(__webpack_exports__); |
| 6769 | 8419 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 6770 | 8420 | /* harmony export */ addClasses: () => (/* binding */ addClasses), |
| 6771 | 8421 | /* harmony export */ applyCSS: () => (/* binding */ applyCSS), |
| @@ -6972,9 +8622,9 @@ | ||
| 6972 | 8622 | /******/ return cachedModule.exports; |
| 6973 | 8623 | /******/ } |
| 6974 | 8624 | /******/ // Create a new module (and put it into the cache) |
| 6975 | 8625 | /******/ const module = __webpack_module_cache__[moduleId] = { |
| 6976 | -/******/ // no module.id needed | |
| 8626 | +/******/ id: moduleId, | |
| 6977 | 8627 | /******/ // no module.loaded needed |
| 6978 | 8628 | /******/ exports: {} |
| 6979 | 8629 | /******/ }; |
| 6980 | 8630 | /******/ |
| @@ -6984,9 +8634,9 @@ | ||
| 6984 | 8634 | /******/ const e = new Error("Cannot find module '" + moduleId + "'"); |
| 6985 | 8635 | /******/ e.code = 'MODULE_NOT_FOUND'; |
| 6986 | 8636 | /******/ throw e; |
| 6987 | 8637 | /******/ } |
| 6988 | -/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); | |
| 8638 | +/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); | |
| 6989 | 8639 | /******/ |
| 6990 | 8640 | /******/ // Return the exports of the module |
| 6991 | 8641 | /******/ return module.exports; |
| 6992 | 8642 | /******/ } |
| @@ -6991,8 +8641,20 @@ | ||
| 6991 | 8641 | /******/ return module.exports; |
| 6992 | 8642 | /******/ } |
| 6993 | 8643 | /******/ |
| 6994 | 8644 | /************************************************************************/ |
| 8645 | +/******/ /* webpack/runtime/compat get default export */ | |
| 8646 | +/******/ (() => { | |
| 8647 | +/******/ // getDefaultExport function for compatibility with non-harmony modules | |
| 8648 | +/******/ __webpack_require__.n = (module) => { | |
| 8649 | +/******/ const getter = module && module.__esModule ? | |
| 8650 | +/******/ () => (module['default']) : | |
| 8651 | +/******/ () => (module); | |
| 8652 | +/******/ __webpack_require__.d(getter, { a: getter }); | |
| 8653 | +/******/ return getter; | |
| 8654 | +/******/ }; | |
| 8655 | +/******/ })(); | |
| 8656 | +/******/ | |
| 6995 | 8657 | /******/ /* webpack/runtime/define property getters */ |
| 6996 | 8658 | /******/ (() => { |
| 6997 | 8659 | /******/ // define getter/value functions for harmony exports |
| 6998 | 8660 | /******/ __webpack_require__.d = (exports, definition) => { |
| @@ -7034,12 +8696,18 @@ | ||
| 7034 | 8696 | /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
| 7035 | 8697 | /******/ }; |
| 7036 | 8698 | /******/ })(); |
| 7037 | 8699 | /******/ |
| 8700 | +/******/ /* webpack/runtime/nonce */ | |
| 8701 | +/******/ (() => { | |
| 8702 | +/******/ __webpack_require__.nc = undefined; | |
| 8703 | +/******/ })(); | |
| 8704 | +/******/ | |
| 7038 | 8705 | /************************************************************************/ |
| 7039 | 8706 | let __webpack_exports__ = {}; |
| 7040 | -// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. | |
| 8707 | +// This entry needs to be wrapped in an IIFE because it needs to be in strict mode. | |
| 7041 | 8708 | (() => { |
| 8709 | +"use strict"; | |
| 7042 | 8710 | /*!**************************************!*\ |
| 7043 | 8711 | !*** ./assets/src/js/admin/admin.js ***! |
| 7044 | 8712 | \**************************************/ |
| 7045 | 8713 | __webpack_require__.r(__webpack_exports__); |
| @@ -7044,10 +8712,12 @@ | ||
| 7044 | 8712 | \**************************************/ |
| 7045 | 8713 | __webpack_require__.r(__webpack_exports__); |
| 7046 | 8714 | /* harmony import */ var _init_tom_select_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./init-tom-select.js */ "./assets/src/js/admin/init-tom-select.js"); |
| 7047 | 8715 | /* harmony import */ var _utils_admin_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils-admin.js */ "./assets/src/js/admin/utils-admin.js"); |
| 8716 | +/* harmony import */ var _share_dropdown_pages_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./share/dropdown-pages.js */ "./assets/src/js/admin/share/dropdown-pages.js"); | |
| 7048 | 8717 | |
| 7049 | 8718 | |
| 8719 | + | |
| 7050 | 8720 | (function ($) { |
| 7051 | 8721 | /** |
| 7052 | 8722 | * Callback event for button to creating pages inside error message. |
| 7053 | 8723 | * |
| @@ -7161,9 +8831,10 @@ | ||
| 7161 | 8831 | }; |
| 7162 | 8832 | const onReady = function onReady() { |
| 7163 | 8833 | lpMetaboxFileInput(); |
| 7164 | 8834 | //updateDb(); |
| 7165 | - $('.learn-press-dropdown-pages').LP('DropdownPages'); | |
| 8835 | + const dropdownPages = new _share_dropdown_pages_js__WEBPACK_IMPORTED_MODULE_2__.DropdownPages(); | |
| 8836 | + dropdownPages.init(); | |
| 7166 | 8837 | //$( '.learn-press-advertisement-slider' ).LP( 'Advertisement', 'a', 's' ).appendTo( $( '#wpbody-content' ) ); |
| 7167 | 8838 | //$( '.learn-press-toggle-item-preview' ).on( 'change', updateItemPreview ); |
| 7168 | 8839 | $('.learn-press-tip').LP('QuickTip'); //$('.learn-press-tabs').LP('AdminTab'); |
| 7169 | 8840 | |