| @@ -428,8 +428,9 @@ | ||
| 428 | 428 | __webpack_require__.r(__webpack_exports__); |
| 429 | 429 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 430 | 430 | /* harmony export */ debounce: () => (/* binding */ debounce), |
| 431 | 431 | /* harmony export */ eventHandlers: () => (/* binding */ eventHandlers), |
| 432 | +/* harmony export */ fullScreenView: () => (/* binding */ fullScreenView), | |
| 432 | 433 | /* harmony export */ getDataOfForm: () => (/* binding */ getDataOfForm), |
| 433 | 434 | /* harmony export */ getFieldKeysOfForm: () => (/* binding */ getFieldKeysOfForm), |
| 434 | 435 | /* harmony export */ listenElementCreated: () => (/* binding */ listenElementCreated), |
| 435 | 436 | /* harmony export */ listenElementViewed: () => (/* binding */ listenElementViewed), |
| @@ -441,9 +442,10 @@ | ||
| 441 | 442 | /* harmony export */ lpOnElementReady: () => (/* binding */ lpOnElementReady), |
| 442 | 443 | /* harmony export */ lpSetLoadingEl: () => (/* binding */ lpSetLoadingEl), |
| 443 | 444 | /* harmony export */ lpShowHideEl: () => (/* binding */ lpShowHideEl), |
| 444 | 445 | /* harmony export */ mergeDataWithDatForm: () => (/* binding */ mergeDataWithDatForm), |
| 445 | -/* harmony export */ toggleCollapse: () => (/* binding */ toggleCollapse) | |
| 446 | +/* harmony export */ toggleCollapse: () => (/* binding */ toggleCollapse), | |
| 447 | +/* harmony export */ toggleEnable: () => (/* binding */ toggleEnable) | |
| 446 | 448 | /* harmony export */ }); |
| 447 | 449 | /** |
| 448 | 450 | * Utils functions |
| 449 | 451 | * |
| @@ -450,9 +452,9 @@ | ||
| 450 | 452 | * @param url |
| 451 | 453 | * @param data |
| 452 | 454 | * @param functions |
| 453 | 455 | * @since 4.2.5.1 |
| 454 | - * @version 1.0.6 | |
| 456 | + * @version 1.0.7 | |
| 455 | 457 | */ |
| 456 | 458 | const lpClassName = { |
| 457 | 459 | hidden: 'lp-hidden', |
| 458 | 460 | loading: 'loading', |
| @@ -457,9 +459,12 @@ | ||
| 457 | 459 | hidden: 'lp-hidden', |
| 458 | 460 | loading: 'loading', |
| 459 | 461 | elCollapse: 'lp-collapse', |
| 460 | 462 | elSectionToggle: '.lp-section-toggle', |
| 461 | - elTriggerToggle: '.lp-trigger-toggle' | |
| 463 | + elTriggerToggle: '.lp-trigger-toggle', | |
| 464 | + elBtnFullScreen: '.lp-btn-full-screen-view', | |
| 465 | + elFullScreen: 'lp-full-screen-view', | |
| 466 | + elBtnFullScreenClose: 'lp-full-screen-view__close' | |
| 462 | 467 | }; |
| 463 | 468 | const lpFetchAPI = (url, data = {}, functions = {}) => { |
| 464 | 469 | if ('function' === typeof functions.before) { |
| 465 | 470 | functions.before(); |
| @@ -777,8 +782,141 @@ | ||
| 777 | 782 | timer = setTimeout(() => func(args), wait); |
| 778 | 783 | }; |
| 779 | 784 | }; |
| 780 | 785 | |
| 786 | +/** | |
| 787 | + * Initialize lp-toggle-enable components. | |
| 788 | + * | |
| 789 | + * Finds all `.lp-toggle-enable` elements and wires up toggle behavior. | |
| 790 | + * Reads initial state from `data-enabled` attribute ("true"/"false"). | |
| 791 | + * Calls `data-on-toggle` callback (if provided via options) on state change. | |
| 792 | + * | |
| 793 | + * HTML structure: | |
| 794 | + * <label class="lp-toggle-enable" data-enabled="true"> | |
| 795 | + * <input type="checkbox" class="lp-toggle-enable__input" /> | |
| 796 | + * <span class="lp-toggle-enable__track"></span> | |
| 797 | + * </label> | |
| 798 | + * | |
| 799 | + * @param {string} selector CSS selector for toggle elements (default: '.lp-toggle-enable') | |
| 800 | + * @param {Function} onToggle Optional callback( el, isEnabled ) called on state change | |
| 801 | + * @since 4.4.5 | |
| 802 | + * @version 1.0.0 | |
| 803 | + */ | |
| 804 | +window.lpToggleEnableInit = 0; | |
| 805 | +const toggleEnable = (onToggle = null) => { | |
| 806 | + if (window.lpToggleEnableInit) { | |
| 807 | + return; | |
| 808 | + } | |
| 809 | + window.lpToggleEnableInit = 1; | |
| 810 | + const selector = '.lp-toggle-enable'; | |
| 811 | + const updateUI = (toggle, isEnabled) => { | |
| 812 | + toggle.classList.toggle('is-enabled', isEnabled); | |
| 813 | + const input = toggle.querySelector('.lp-toggle-enable__input'); | |
| 814 | + if (input) { | |
| 815 | + input.checked = isEnabled; | |
| 816 | + input.value = isEnabled ? '1' : '0'; | |
| 817 | + } | |
| 818 | + }; | |
| 819 | + | |
| 820 | + // Delegate click handling via eventHandlers. | |
| 821 | + eventHandlers('click', [{ | |
| 822 | + selector, | |
| 823 | + callBack: args => { | |
| 824 | + const { | |
| 825 | + e, | |
| 826 | + target | |
| 827 | + } = args; | |
| 828 | + const toggle = target.closest(selector); | |
| 829 | + if (!toggle || toggle.classList.contains('is-disabled')) { | |
| 830 | + return; | |
| 831 | + } | |
| 832 | + e.preventDefault(); | |
| 833 | + const isEnabled = !toggle.classList.contains('is-enabled'); | |
| 834 | + updateUI(toggle, isEnabled); | |
| 835 | + if ('function' === typeof onToggle) { | |
| 836 | + onToggle(toggle, isEnabled); | |
| 837 | + } | |
| 838 | + } | |
| 839 | + }]); | |
| 840 | +}; | |
| 841 | + | |
| 842 | +/** | |
| 843 | + * Initialize custom fullscreen view buttons. | |
| 844 | + * | |
| 845 | + * Delegates clicks on `.lp-btn-full-screen-view` buttons to | |
| 846 | + * `lpToggleFullscreenView`. Reads the `data-target` attribute to find the | |
| 847 | + * target element. Falls back to the button's parent element when | |
| 848 | + * `data-target` is not provided. | |
| 849 | + * | |
| 850 | + * @since 4.4.5 | |
| 851 | + * @version 1.0.0 | |
| 852 | + */ | |
| 853 | +window.lpFullScreenViewInit = 0; | |
| 854 | +const fullScreenView = () => { | |
| 855 | + if (window.lpFullScreenViewInit) { | |
| 856 | + return; | |
| 857 | + } | |
| 858 | + window.lpFullScreenViewInit = 1; | |
| 859 | + let lastScrollY = 0; | |
| 860 | + const lpToggleFullscreenView = (elTarget, elBtnFullScreen = null) => { | |
| 861 | + const isFullscreen = elTarget.classList.contains(lpClassName.elFullScreen); | |
| 862 | + if (isFullscreen) { | |
| 863 | + elTarget.classList.remove(lpClassName.elFullScreen); | |
| 864 | + document.documentElement.classList.remove('lp-full-screen-active'); | |
| 865 | + window.scrollTo(0, lastScrollY); | |
| 866 | + } else { | |
| 867 | + lastScrollY = window.scrollY; | |
| 868 | + elTarget.classList.add(lpClassName.elFullScreen); | |
| 869 | + document.documentElement.classList.add('lp-full-screen-active'); | |
| 870 | + } | |
| 871 | + if (!isFullscreen) { | |
| 872 | + if (!elTarget.querySelector(`.${lpClassName.elBtnFullScreenClose}`)) { | |
| 873 | + const closeButton = document.createElement('button'); | |
| 874 | + closeButton.type = 'button'; | |
| 875 | + closeButton.className = lpClassName.elBtnFullScreenClose; | |
| 876 | + closeButton.setAttribute('aria-label', 'Close'); | |
| 877 | + closeButton.innerHTML = lpData.i18n.closeButtonFullScreen || 'Close ×'; | |
| 878 | + closeButton.addEventListener('click', e => { | |
| 879 | + e.preventDefault(); | |
| 880 | + lpToggleFullscreenView(elTarget); | |
| 881 | + }); | |
| 882 | + elTarget.appendChild(closeButton); | |
| 883 | + } | |
| 884 | + } else { | |
| 885 | + const closeButton = elTarget.querySelector(`.${lpClassName.elBtnFullScreenClose}`); | |
| 886 | + if (closeButton) { | |
| 887 | + closeButton.remove(); | |
| 888 | + } | |
| 889 | + } | |
| 890 | + }; | |
| 891 | + eventHandlers('click', [{ | |
| 892 | + selector: lpClassName.elBtnFullScreen, | |
| 893 | + callBack: args => { | |
| 894 | + const { | |
| 895 | + e, | |
| 896 | + target | |
| 897 | + } = args; | |
| 898 | + const elBtnFullScreen = target.closest(lpClassName.elBtnFullScreen); | |
| 899 | + if (!elBtnFullScreen) { | |
| 900 | + console.log('No full screen button found'); | |
| 901 | + return; | |
| 902 | + } | |
| 903 | + e.preventDefault(); | |
| 904 | + let elTarget = null; | |
| 905 | + const targetSelector = elBtnFullScreen.dataset.targetFullscreen; | |
| 906 | + console.log(targetSelector); | |
| 907 | + if (targetSelector) { | |
| 908 | + elTarget = document.querySelector(targetSelector); | |
| 909 | + } | |
| 910 | + if (!elTarget) { | |
| 911 | + console.log('No target element found'); | |
| 912 | + return; | |
| 913 | + } | |
| 914 | + lpToggleFullscreenView(elTarget, elBtnFullScreen); | |
| 915 | + } | |
| 916 | + }]); | |
| 917 | +}; | |
| 918 | + | |
| 781 | 919 | /***/ }, |
| 782 | 920 | |
| 783 | 921 | /***/ "./node_modules/@orchidjs/sifter/dist/esm/sifter.js" |
| 784 | 922 | /*!**********************************************************!*\ |
| @@ -6955,19 +7093,19 @@ | ||
| 6955 | 7093 | |
| 6956 | 7094 | /******/ }); |
| 6957 | 7095 | /************************************************************************/ |
| 6958 | 7096 | /******/ // The module cache |
| 6959 | -/******/ const __webpack_module_cache__ = {}; | |
| 7097 | +/******/ var __webpack_module_cache__ = {}; | |
| 6960 | 7098 | /******/ |
| 6961 | 7099 | /******/ // The require function |
| 6962 | 7100 | /******/ function __webpack_require__(moduleId) { |
| 6963 | 7101 | /******/ // Check if module is in cache |
| 6964 | -/******/ const cachedModule = __webpack_module_cache__[moduleId]; | |
| 7102 | +/******/ var cachedModule = __webpack_module_cache__[moduleId]; | |
| 6965 | 7103 | /******/ if (cachedModule !== undefined) { |
| 6966 | 7104 | /******/ return cachedModule.exports; |
| 6967 | 7105 | /******/ } |
| 6968 | 7106 | /******/ // Create a new module (and put it into the cache) |
| 6969 | -/******/ const module = __webpack_module_cache__[moduleId] = { | |
| 7107 | +/******/ var module = __webpack_module_cache__[moduleId] = { | |
| 6970 | 7108 | /******/ // no module.id needed |
| 6971 | 7109 | /******/ // no module.loaded needed |
| 6972 | 7110 | /******/ exports: {} |
| 6973 | 7111 | /******/ }; |
| @@ -6974,9 +7112,9 @@ | ||
| 6974 | 7112 | /******/ |
| 6975 | 7113 | /******/ // Execute the module function |
| 6976 | 7114 | /******/ if (!(moduleId in __webpack_modules__)) { |
| 6977 | 7115 | /******/ delete __webpack_module_cache__[moduleId]; |
| 6978 | -/******/ const e = new Error("Cannot find module '" + moduleId + "'"); | |
| 7116 | +/******/ var e = new Error("Cannot find module '" + moduleId + "'"); | |
| 6979 | 7117 | /******/ e.code = 'MODULE_NOT_FOUND'; |
| 6980 | 7118 | /******/ throw e; |
| 6981 | 7119 | /******/ } |
| 6982 | 7120 | /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); |
| @@ -6987,29 +7125,14 @@ | ||
| 6987 | 7125 | /******/ |
| 6988 | 7126 | /************************************************************************/ |
| 6989 | 7127 | /******/ /* webpack/runtime/define property getters */ |
| 6990 | 7128 | /******/ (() => { |
| 6991 | -/******/ // define getter/value functions for harmony exports | |
| 7129 | +/******/ // define getter functions for harmony exports | |
| 6992 | 7130 | /******/ __webpack_require__.d = (exports, definition) => { |
| 6993 | -/******/ if(Array.isArray(definition)) { | |
| 6994 | -/******/ var i = 0; | |
| 6995 | -/******/ while(i < definition.length) { | |
| 6996 | -/******/ var key = definition[i++]; | |
| 6997 | -/******/ var binding = definition[i++]; | |
| 6998 | -/******/ if(!__webpack_require__.o(exports, key)) { | |
| 6999 | -/******/ if(binding === 0) { | |
| 7000 | -/******/ Object.defineProperty(exports, key, { enumerable: true, value: definition[i++] }); | |
| 7001 | -/******/ } else { | |
| 7002 | -/******/ Object.defineProperty(exports, key, { enumerable: true, get: binding }); | |
| 7003 | -/******/ } | |
| 7004 | -/******/ } else if(binding === 0) { i++; } | |
| 7131 | +/******/ for(var key in definition) { | |
| 7132 | +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { | |
| 7133 | +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); | |
| 7005 | 7134 | /******/ } |
| 7006 | -/******/ } else { | |
| 7007 | -/******/ for(var key in definition) { | |
| 7008 | -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { | |
| 7009 | -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); | |
| 7010 | -/******/ } | |
| 7011 | -/******/ } | |
| 7012 | 7135 | /******/ } |
| 7013 | 7136 | /******/ }; |
| 7014 | 7137 | /******/ })(); |
| 7015 | 7138 | /******/ |
| @@ -7014,9 +7137,9 @@ | ||
| 7014 | 7137 | /******/ })(); |
| 7015 | 7138 | /******/ |
| 7016 | 7139 | /******/ /* webpack/runtime/hasOwnProperty shorthand */ |
| 7017 | 7140 | /******/ (() => { |
| 7018 | -/******/ __webpack_require__.o = (obj, prop) => (Object.hasOwn(obj, prop)) | |
| 7141 | +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) | |
| 7019 | 7142 | /******/ })(); |
| 7020 | 7143 | /******/ |
| 7021 | 7144 | /******/ /* webpack/runtime/make namespace object */ |
| 7022 | 7145 | /******/ (() => { |
| @@ -7021,9 +7144,9 @@ | ||
| 7021 | 7144 | /******/ /* webpack/runtime/make namespace object */ |
| 7022 | 7145 | /******/ (() => { |
| 7023 | 7146 | /******/ // define __esModule on exports |
| 7024 | 7147 | /******/ __webpack_require__.r = (exports) => { |
| 7025 | -/******/ if(Symbol.toStringTag) { | |
| 7148 | +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { | |
| 7026 | 7149 | /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
| 7027 | 7150 | /******/ } |
| 7028 | 7151 | /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
| 7029 | 7152 | /******/ }; |
| @@ -7029,9 +7152,9 @@ | ||
| 7029 | 7152 | /******/ }; |
| 7030 | 7153 | /******/ })(); |
| 7031 | 7154 | /******/ |
| 7032 | 7155 | /************************************************************************/ |
| 7033 | -let __webpack_exports__ = {}; | |
| 7156 | +var __webpack_exports__ = {}; | |
| 7034 | 7157 | // This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. |
| 7035 | 7158 | (() => { |
| 7036 | 7159 | /*!********************************************!*\ |
| 7037 | 7160 | !*** ./assets/src/js/admin/admin-tools.js ***! |