| @@ -641,8 +641,9 @@ | ||
| 641 | 641 | __webpack_require__.r(__webpack_exports__); |
| 642 | 642 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 643 | 643 | /* harmony export */ debounce: () => (/* binding */ debounce), |
| 644 | 644 | /* harmony export */ eventHandlers: () => (/* binding */ eventHandlers), |
| 645 | +/* harmony export */ fullScreenView: () => (/* binding */ fullScreenView), | |
| 645 | 646 | /* harmony export */ getDataOfForm: () => (/* binding */ getDataOfForm), |
| 646 | 647 | /* harmony export */ getFieldKeysOfForm: () => (/* binding */ getFieldKeysOfForm), |
| 647 | 648 | /* harmony export */ listenElementCreated: () => (/* binding */ listenElementCreated), |
| 648 | 649 | /* harmony export */ listenElementViewed: () => (/* binding */ listenElementViewed), |
| @@ -654,9 +655,10 @@ | ||
| 654 | 655 | /* harmony export */ lpOnElementReady: () => (/* binding */ lpOnElementReady), |
| 655 | 656 | /* harmony export */ lpSetLoadingEl: () => (/* binding */ lpSetLoadingEl), |
| 656 | 657 | /* harmony export */ lpShowHideEl: () => (/* binding */ lpShowHideEl), |
| 657 | 658 | /* harmony export */ mergeDataWithDatForm: () => (/* binding */ mergeDataWithDatForm), |
| 658 | -/* harmony export */ toggleCollapse: () => (/* binding */ toggleCollapse) | |
| 659 | +/* harmony export */ toggleCollapse: () => (/* binding */ toggleCollapse), | |
| 660 | +/* harmony export */ toggleEnable: () => (/* binding */ toggleEnable) | |
| 659 | 661 | /* harmony export */ }); |
| 660 | 662 | /** |
| 661 | 663 | * Utils functions |
| 662 | 664 | * |
| @@ -663,9 +665,9 @@ | ||
| 663 | 665 | * @param url |
| 664 | 666 | * @param data |
| 665 | 667 | * @param functions |
| 666 | 668 | * @since 4.2.5.1 |
| 667 | - * @version 1.0.6 | |
| 669 | + * @version 1.0.7 | |
| 668 | 670 | */ |
| 669 | 671 | const lpClassName = { |
| 670 | 672 | hidden: 'lp-hidden', |
| 671 | 673 | loading: 'loading', |
| @@ -670,9 +672,12 @@ | ||
| 670 | 672 | hidden: 'lp-hidden', |
| 671 | 673 | loading: 'loading', |
| 672 | 674 | elCollapse: 'lp-collapse', |
| 673 | 675 | elSectionToggle: '.lp-section-toggle', |
| 674 | - elTriggerToggle: '.lp-trigger-toggle' | |
| 676 | + elTriggerToggle: '.lp-trigger-toggle', | |
| 677 | + elBtnFullScreen: '.lp-btn-full-screen-view', | |
| 678 | + elFullScreen: 'lp-full-screen-view', | |
| 679 | + elBtnFullScreenClose: 'lp-full-screen-view__close' | |
| 675 | 680 | }; |
| 676 | 681 | const lpFetchAPI = (url, data = {}, functions = {}) => { |
| 677 | 682 | if ('function' === typeof functions.before) { |
| 678 | 683 | functions.before(); |
| @@ -990,8 +995,141 @@ | ||
| 990 | 995 | timer = setTimeout(() => func(args), wait); |
| 991 | 996 | }; |
| 992 | 997 | }; |
| 993 | 998 | |
| 999 | +/** | |
| 1000 | + * Initialize lp-toggle-enable components. | |
| 1001 | + * | |
| 1002 | + * Finds all `.lp-toggle-enable` elements and wires up toggle behavior. | |
| 1003 | + * Reads initial state from `data-enabled` attribute ("true"/"false"). | |
| 1004 | + * Calls `data-on-toggle` callback (if provided via options) on state change. | |
| 1005 | + * | |
| 1006 | + * HTML structure: | |
| 1007 | + * <label class="lp-toggle-enable" data-enabled="true"> | |
| 1008 | + * <input type="checkbox" class="lp-toggle-enable__input" /> | |
| 1009 | + * <span class="lp-toggle-enable__track"></span> | |
| 1010 | + * </label> | |
| 1011 | + * | |
| 1012 | + * @param {string} selector CSS selector for toggle elements (default: '.lp-toggle-enable') | |
| 1013 | + * @param {Function} onToggle Optional callback( el, isEnabled ) called on state change | |
| 1014 | + * @since 4.4.5 | |
| 1015 | + * @version 1.0.0 | |
| 1016 | + */ | |
| 1017 | +window.lpToggleEnableInit = 0; | |
| 1018 | +const toggleEnable = (onToggle = null) => { | |
| 1019 | + if (window.lpToggleEnableInit) { | |
| 1020 | + return; | |
| 1021 | + } | |
| 1022 | + window.lpToggleEnableInit = 1; | |
| 1023 | + const selector = '.lp-toggle-enable'; | |
| 1024 | + const updateUI = (toggle, isEnabled) => { | |
| 1025 | + toggle.classList.toggle('is-enabled', isEnabled); | |
| 1026 | + const input = toggle.querySelector('.lp-toggle-enable__input'); | |
| 1027 | + if (input) { | |
| 1028 | + input.checked = isEnabled; | |
| 1029 | + input.value = isEnabled ? '1' : '0'; | |
| 1030 | + } | |
| 1031 | + }; | |
| 1032 | + | |
| 1033 | + // Delegate click handling via eventHandlers. | |
| 1034 | + eventHandlers('click', [{ | |
| 1035 | + selector, | |
| 1036 | + callBack: args => { | |
| 1037 | + const { | |
| 1038 | + e, | |
| 1039 | + target | |
| 1040 | + } = args; | |
| 1041 | + const toggle = target.closest(selector); | |
| 1042 | + if (!toggle || toggle.classList.contains('is-disabled')) { | |
| 1043 | + return; | |
| 1044 | + } | |
| 1045 | + e.preventDefault(); | |
| 1046 | + const isEnabled = !toggle.classList.contains('is-enabled'); | |
| 1047 | + updateUI(toggle, isEnabled); | |
| 1048 | + if ('function' === typeof onToggle) { | |
| 1049 | + onToggle(toggle, isEnabled); | |
| 1050 | + } | |
| 1051 | + } | |
| 1052 | + }]); | |
| 1053 | +}; | |
| 1054 | + | |
| 1055 | +/** | |
| 1056 | + * Initialize custom fullscreen view buttons. | |
| 1057 | + * | |
| 1058 | + * Delegates clicks on `.lp-btn-full-screen-view` buttons to | |
| 1059 | + * `lpToggleFullscreenView`. Reads the `data-target` attribute to find the | |
| 1060 | + * target element. Falls back to the button's parent element when | |
| 1061 | + * `data-target` is not provided. | |
| 1062 | + * | |
| 1063 | + * @since 4.4.5 | |
| 1064 | + * @version 1.0.0 | |
| 1065 | + */ | |
| 1066 | +window.lpFullScreenViewInit = 0; | |
| 1067 | +const fullScreenView = () => { | |
| 1068 | + if (window.lpFullScreenViewInit) { | |
| 1069 | + return; | |
| 1070 | + } | |
| 1071 | + window.lpFullScreenViewInit = 1; | |
| 1072 | + let lastScrollY = 0; | |
| 1073 | + const lpToggleFullscreenView = (elTarget, elBtnFullScreen = null) => { | |
| 1074 | + const isFullscreen = elTarget.classList.contains(lpClassName.elFullScreen); | |
| 1075 | + if (isFullscreen) { | |
| 1076 | + elTarget.classList.remove(lpClassName.elFullScreen); | |
| 1077 | + document.documentElement.classList.remove('lp-full-screen-active'); | |
| 1078 | + window.scrollTo(0, lastScrollY); | |
| 1079 | + } else { | |
| 1080 | + lastScrollY = window.scrollY; | |
| 1081 | + elTarget.classList.add(lpClassName.elFullScreen); | |
| 1082 | + document.documentElement.classList.add('lp-full-screen-active'); | |
| 1083 | + } | |
| 1084 | + if (!isFullscreen) { | |
| 1085 | + if (!elTarget.querySelector(`.${lpClassName.elBtnFullScreenClose}`)) { | |
| 1086 | + const closeButton = document.createElement('button'); | |
| 1087 | + closeButton.type = 'button'; | |
| 1088 | + closeButton.className = lpClassName.elBtnFullScreenClose; | |
| 1089 | + closeButton.setAttribute('aria-label', 'Close'); | |
| 1090 | + closeButton.innerHTML = lpData.i18n.closeButtonFullScreen || 'Close ×'; | |
| 1091 | + closeButton.addEventListener('click', e => { | |
| 1092 | + e.preventDefault(); | |
| 1093 | + lpToggleFullscreenView(elTarget); | |
| 1094 | + }); | |
| 1095 | + elTarget.appendChild(closeButton); | |
| 1096 | + } | |
| 1097 | + } else { | |
| 1098 | + const closeButton = elTarget.querySelector(`.${lpClassName.elBtnFullScreenClose}`); | |
| 1099 | + if (closeButton) { | |
| 1100 | + closeButton.remove(); | |
| 1101 | + } | |
| 1102 | + } | |
| 1103 | + }; | |
| 1104 | + eventHandlers('click', [{ | |
| 1105 | + selector: lpClassName.elBtnFullScreen, | |
| 1106 | + callBack: args => { | |
| 1107 | + const { | |
| 1108 | + e, | |
| 1109 | + target | |
| 1110 | + } = args; | |
| 1111 | + const elBtnFullScreen = target.closest(lpClassName.elBtnFullScreen); | |
| 1112 | + if (!elBtnFullScreen) { | |
| 1113 | + console.log('No full screen button found'); | |
| 1114 | + return; | |
| 1115 | + } | |
| 1116 | + e.preventDefault(); | |
| 1117 | + let elTarget = null; | |
| 1118 | + const targetSelector = elBtnFullScreen.dataset.targetFullscreen; | |
| 1119 | + console.log(targetSelector); | |
| 1120 | + if (targetSelector) { | |
| 1121 | + elTarget = document.querySelector(targetSelector); | |
| 1122 | + } | |
| 1123 | + if (!elTarget) { | |
| 1124 | + console.log('No target element found'); | |
| 1125 | + return; | |
| 1126 | + } | |
| 1127 | + lpToggleFullscreenView(elTarget, elBtnFullScreen); | |
| 1128 | + } | |
| 1129 | + }]); | |
| 1130 | +}; | |
| 1131 | + | |
| 994 | 1132 | /***/ }, |
| 995 | 1133 | |
| 996 | 1134 | /***/ "react" |
| 997 | 1135 | /*!************************!*\ |
| @@ -1028,19 +1166,19 @@ | ||
| 1028 | 1166 | |
| 1029 | 1167 | /******/ }); |
| 1030 | 1168 | /************************************************************************/ |
| 1031 | 1169 | /******/ // The module cache |
| 1032 | -/******/ var __webpack_module_cache__ = {}; | |
| 1170 | +/******/ const __webpack_module_cache__ = {}; | |
| 1033 | 1171 | /******/ |
| 1034 | 1172 | /******/ // The require function |
| 1035 | 1173 | /******/ function __webpack_require__(moduleId) { |
| 1036 | 1174 | /******/ // Check if module is in cache |
| 1037 | -/******/ var cachedModule = __webpack_module_cache__[moduleId]; | |
| 1175 | +/******/ const cachedModule = __webpack_module_cache__[moduleId]; | |
| 1038 | 1176 | /******/ if (cachedModule !== undefined) { |
| 1039 | 1177 | /******/ return cachedModule.exports; |
| 1040 | 1178 | /******/ } |
| 1041 | 1179 | /******/ // Create a new module (and put it into the cache) |
| 1042 | -/******/ var module = __webpack_module_cache__[moduleId] = { | |
| 1180 | +/******/ const module = __webpack_module_cache__[moduleId] = { | |
| 1043 | 1181 | /******/ // no module.id needed |
| 1044 | 1182 | /******/ // no module.loaded needed |
| 1045 | 1183 | /******/ exports: {} |
| 1046 | 1184 | /******/ }; |
| @@ -1047,9 +1185,9 @@ | ||
| 1047 | 1185 | /******/ |
| 1048 | 1186 | /******/ // Execute the module function |
| 1049 | 1187 | /******/ if (!(moduleId in __webpack_modules__)) { |
| 1050 | 1188 | /******/ delete __webpack_module_cache__[moduleId]; |
| 1051 | -/******/ var e = new Error("Cannot find module '" + moduleId + "'"); | |
| 1189 | +/******/ const e = new Error("Cannot find module '" + moduleId + "'"); | |
| 1052 | 1190 | /******/ e.code = 'MODULE_NOT_FOUND'; |
| 1053 | 1191 | /******/ throw e; |
| 1054 | 1192 | /******/ } |
| 1055 | 1193 | /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); |
| @@ -1062,9 +1200,9 @@ | ||
| 1062 | 1200 | /******/ /* webpack/runtime/compat get default export */ |
| 1063 | 1201 | /******/ (() => { |
| 1064 | 1202 | /******/ // getDefaultExport function for compatibility with non-harmony modules |
| 1065 | 1203 | /******/ __webpack_require__.n = (module) => { |
| 1066 | -/******/ var getter = module && module.__esModule ? | |
| 1204 | +/******/ const getter = module && module.__esModule ? | |
| 1067 | 1205 | /******/ () => (module['default']) : |
| 1068 | 1206 | /******/ () => (module); |
| 1069 | 1207 | /******/ __webpack_require__.d(getter, { a: getter }); |
| 1070 | 1208 | /******/ return getter; |
| @@ -1072,14 +1210,29 @@ | ||
| 1072 | 1210 | /******/ })(); |
| 1073 | 1211 | /******/ |
| 1074 | 1212 | /******/ /* webpack/runtime/define property getters */ |
| 1075 | 1213 | /******/ (() => { |
| 1076 | -/******/ // define getter functions for harmony exports | |
| 1214 | +/******/ // define getter/value functions for harmony exports | |
| 1077 | 1215 | /******/ __webpack_require__.d = (exports, definition) => { |
| 1078 | -/******/ for(var key in definition) { | |
| 1079 | -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { | |
| 1080 | -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); | |
| 1216 | +/******/ if(Array.isArray(definition)) { | |
| 1217 | +/******/ var i = 0; | |
| 1218 | +/******/ while(i < definition.length) { | |
| 1219 | +/******/ var key = definition[i++]; | |
| 1220 | +/******/ var binding = definition[i++]; | |
| 1221 | +/******/ if(!__webpack_require__.o(exports, key)) { | |
| 1222 | +/******/ if(binding === 0) { | |
| 1223 | +/******/ Object.defineProperty(exports, key, { enumerable: true, value: definition[i++] }); | |
| 1224 | +/******/ } else { | |
| 1225 | +/******/ Object.defineProperty(exports, key, { enumerable: true, get: binding }); | |
| 1226 | +/******/ } | |
| 1227 | +/******/ } else if(binding === 0) { i++; } | |
| 1081 | 1228 | /******/ } |
| 1229 | +/******/ } else { | |
| 1230 | +/******/ for(var key in definition) { | |
| 1231 | +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { | |
| 1232 | +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); | |
| 1233 | +/******/ } | |
| 1234 | +/******/ } | |
| 1082 | 1235 | /******/ } |
| 1083 | 1236 | /******/ }; |
| 1084 | 1237 | /******/ })(); |
| 1085 | 1238 | /******/ |
| @@ -1084,9 +1237,9 @@ | ||
| 1084 | 1237 | /******/ })(); |
| 1085 | 1238 | /******/ |
| 1086 | 1239 | /******/ /* webpack/runtime/hasOwnProperty shorthand */ |
| 1087 | 1240 | /******/ (() => { |
| 1088 | -/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) | |
| 1241 | +/******/ __webpack_require__.o = (obj, prop) => (Object.hasOwn(obj, prop)) | |
| 1089 | 1242 | /******/ })(); |
| 1090 | 1243 | /******/ |
| 1091 | 1244 | /******/ /* webpack/runtime/make namespace object */ |
| 1092 | 1245 | /******/ (() => { |
| @@ -1091,9 +1244,9 @@ | ||
| 1091 | 1244 | /******/ /* webpack/runtime/make namespace object */ |
| 1092 | 1245 | /******/ (() => { |
| 1093 | 1246 | /******/ // define __esModule on exports |
| 1094 | 1247 | /******/ __webpack_require__.r = (exports) => { |
| 1095 | -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { | |
| 1248 | +/******/ if(Symbol.toStringTag) { | |
| 1096 | 1249 | /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
| 1097 | 1250 | /******/ } |
| 1098 | 1251 | /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
| 1099 | 1252 | /******/ }; |
| @@ -1099,9 +1252,9 @@ | ||
| 1099 | 1252 | /******/ }; |
| 1100 | 1253 | /******/ })(); |
| 1101 | 1254 | /******/ |
| 1102 | 1255 | /************************************************************************/ |
| 1103 | -var __webpack_exports__ = {}; | |
| 1256 | +let __webpack_exports__ = {}; | |
| 1104 | 1257 | // This entry needs to be wrapped in an IIFE because it needs to be in strict mode. |
| 1105 | 1258 | (() => { |
| 1106 | 1259 | "use strict"; |
| 1107 | 1260 | /*!**********************************************************!*\ |