| @@ -138,8 +138,9 @@ | ||
| 138 | 138 | __webpack_require__.r(__webpack_exports__); |
| 139 | 139 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 140 | 140 | /* harmony export */ debounce: () => (/* binding */ debounce), |
| 141 | 141 | /* harmony export */ eventHandlers: () => (/* binding */ eventHandlers), |
| 142 | +/* harmony export */ fullScreenView: () => (/* binding */ fullScreenView), | |
| 142 | 143 | /* harmony export */ getDataOfForm: () => (/* binding */ getDataOfForm), |
| 143 | 144 | /* harmony export */ getFieldKeysOfForm: () => (/* binding */ getFieldKeysOfForm), |
| 144 | 145 | /* harmony export */ listenElementCreated: () => (/* binding */ listenElementCreated), |
| 145 | 146 | /* harmony export */ listenElementViewed: () => (/* binding */ listenElementViewed), |
| @@ -151,9 +152,10 @@ | ||
| 151 | 152 | /* harmony export */ lpOnElementReady: () => (/* binding */ lpOnElementReady), |
| 152 | 153 | /* harmony export */ lpSetLoadingEl: () => (/* binding */ lpSetLoadingEl), |
| 153 | 154 | /* harmony export */ lpShowHideEl: () => (/* binding */ lpShowHideEl), |
| 154 | 155 | /* harmony export */ mergeDataWithDatForm: () => (/* binding */ mergeDataWithDatForm), |
| 155 | -/* harmony export */ toggleCollapse: () => (/* binding */ toggleCollapse) | |
| 156 | +/* harmony export */ toggleCollapse: () => (/* binding */ toggleCollapse), | |
| 157 | +/* harmony export */ toggleEnable: () => (/* binding */ toggleEnable) | |
| 156 | 158 | /* harmony export */ }); |
| 157 | 159 | /** |
| 158 | 160 | * Utils functions |
| 159 | 161 | * |
| @@ -160,9 +162,9 @@ | ||
| 160 | 162 | * @param url |
| 161 | 163 | * @param data |
| 162 | 164 | * @param functions |
| 163 | 165 | * @since 4.2.5.1 |
| 164 | - * @version 1.0.6 | |
| 166 | + * @version 1.0.7 | |
| 165 | 167 | */ |
| 166 | 168 | const lpClassName = { |
| 167 | 169 | hidden: 'lp-hidden', |
| 168 | 170 | loading: 'loading', |
| @@ -167,9 +169,12 @@ | ||
| 167 | 169 | hidden: 'lp-hidden', |
| 168 | 170 | loading: 'loading', |
| 169 | 171 | elCollapse: 'lp-collapse', |
| 170 | 172 | elSectionToggle: '.lp-section-toggle', |
| 171 | - elTriggerToggle: '.lp-trigger-toggle' | |
| 173 | + elTriggerToggle: '.lp-trigger-toggle', | |
| 174 | + elBtnFullScreen: '.lp-btn-full-screen-view', | |
| 175 | + elFullScreen: 'lp-full-screen-view', | |
| 176 | + elBtnFullScreenClose: 'lp-full-screen-view__close' | |
| 172 | 177 | }; |
| 173 | 178 | const lpFetchAPI = (url, data = {}, functions = {}) => { |
| 174 | 179 | if ('function' === typeof functions.before) { |
| 175 | 180 | functions.before(); |
| @@ -487,8 +492,141 @@ | ||
| 487 | 492 | timer = setTimeout(() => func(args), wait); |
| 488 | 493 | }; |
| 489 | 494 | }; |
| 490 | 495 | |
| 496 | +/** | |
| 497 | + * Initialize lp-toggle-enable components. | |
| 498 | + * | |
| 499 | + * Finds all `.lp-toggle-enable` elements and wires up toggle behavior. | |
| 500 | + * Reads initial state from `data-enabled` attribute ("true"/"false"). | |
| 501 | + * Calls `data-on-toggle` callback (if provided via options) on state change. | |
| 502 | + * | |
| 503 | + * HTML structure: | |
| 504 | + * <label class="lp-toggle-enable" data-enabled="true"> | |
| 505 | + * <input type="checkbox" class="lp-toggle-enable__input" /> | |
| 506 | + * <span class="lp-toggle-enable__track"></span> | |
| 507 | + * </label> | |
| 508 | + * | |
| 509 | + * @param {string} selector CSS selector for toggle elements (default: '.lp-toggle-enable') | |
| 510 | + * @param {Function} onToggle Optional callback( el, isEnabled ) called on state change | |
| 511 | + * @since 4.4.5 | |
| 512 | + * @version 1.0.0 | |
| 513 | + */ | |
| 514 | +window.lpToggleEnableInit = 0; | |
| 515 | +const toggleEnable = (onToggle = null) => { | |
| 516 | + if (window.lpToggleEnableInit) { | |
| 517 | + return; | |
| 518 | + } | |
| 519 | + window.lpToggleEnableInit = 1; | |
| 520 | + const selector = '.lp-toggle-enable'; | |
| 521 | + const updateUI = (toggle, isEnabled) => { | |
| 522 | + toggle.classList.toggle('is-enabled', isEnabled); | |
| 523 | + const input = toggle.querySelector('.lp-toggle-enable__input'); | |
| 524 | + if (input) { | |
| 525 | + input.checked = isEnabled; | |
| 526 | + input.value = isEnabled ? '1' : '0'; | |
| 527 | + } | |
| 528 | + }; | |
| 529 | + | |
| 530 | + // Delegate click handling via eventHandlers. | |
| 531 | + eventHandlers('click', [{ | |
| 532 | + selector, | |
| 533 | + callBack: args => { | |
| 534 | + const { | |
| 535 | + e, | |
| 536 | + target | |
| 537 | + } = args; | |
| 538 | + const toggle = target.closest(selector); | |
| 539 | + if (!toggle || toggle.classList.contains('is-disabled')) { | |
| 540 | + return; | |
| 541 | + } | |
| 542 | + e.preventDefault(); | |
| 543 | + const isEnabled = !toggle.classList.contains('is-enabled'); | |
| 544 | + updateUI(toggle, isEnabled); | |
| 545 | + if ('function' === typeof onToggle) { | |
| 546 | + onToggle(toggle, isEnabled); | |
| 547 | + } | |
| 548 | + } | |
| 549 | + }]); | |
| 550 | +}; | |
| 551 | + | |
| 552 | +/** | |
| 553 | + * Initialize custom fullscreen view buttons. | |
| 554 | + * | |
| 555 | + * Delegates clicks on `.lp-btn-full-screen-view` buttons to | |
| 556 | + * `lpToggleFullscreenView`. Reads the `data-target` attribute to find the | |
| 557 | + * target element. Falls back to the button's parent element when | |
| 558 | + * `data-target` is not provided. | |
| 559 | + * | |
| 560 | + * @since 4.4.5 | |
| 561 | + * @version 1.0.0 | |
| 562 | + */ | |
| 563 | +window.lpFullScreenViewInit = 0; | |
| 564 | +const fullScreenView = () => { | |
| 565 | + if (window.lpFullScreenViewInit) { | |
| 566 | + return; | |
| 567 | + } | |
| 568 | + window.lpFullScreenViewInit = 1; | |
| 569 | + let lastScrollY = 0; | |
| 570 | + const lpToggleFullscreenView = (elTarget, elBtnFullScreen = null) => { | |
| 571 | + const isFullscreen = elTarget.classList.contains(lpClassName.elFullScreen); | |
| 572 | + if (isFullscreen) { | |
| 573 | + elTarget.classList.remove(lpClassName.elFullScreen); | |
| 574 | + document.documentElement.classList.remove('lp-full-screen-active'); | |
| 575 | + window.scrollTo(0, lastScrollY); | |
| 576 | + } else { | |
| 577 | + lastScrollY = window.scrollY; | |
| 578 | + elTarget.classList.add(lpClassName.elFullScreen); | |
| 579 | + document.documentElement.classList.add('lp-full-screen-active'); | |
| 580 | + } | |
| 581 | + if (!isFullscreen) { | |
| 582 | + if (!elTarget.querySelector(`.${lpClassName.elBtnFullScreenClose}`)) { | |
| 583 | + const closeButton = document.createElement('button'); | |
| 584 | + closeButton.type = 'button'; | |
| 585 | + closeButton.className = lpClassName.elBtnFullScreenClose; | |
| 586 | + closeButton.setAttribute('aria-label', 'Close'); | |
| 587 | + closeButton.innerHTML = lpData.i18n.closeButtonFullScreen || 'Close ×'; | |
| 588 | + closeButton.addEventListener('click', e => { | |
| 589 | + e.preventDefault(); | |
| 590 | + lpToggleFullscreenView(elTarget); | |
| 591 | + }); | |
| 592 | + elTarget.appendChild(closeButton); | |
| 593 | + } | |
| 594 | + } else { | |
| 595 | + const closeButton = elTarget.querySelector(`.${lpClassName.elBtnFullScreenClose}`); | |
| 596 | + if (closeButton) { | |
| 597 | + closeButton.remove(); | |
| 598 | + } | |
| 599 | + } | |
| 600 | + }; | |
| 601 | + eventHandlers('click', [{ | |
| 602 | + selector: lpClassName.elBtnFullScreen, | |
| 603 | + callBack: args => { | |
| 604 | + const { | |
| 605 | + e, | |
| 606 | + target | |
| 607 | + } = args; | |
| 608 | + const elBtnFullScreen = target.closest(lpClassName.elBtnFullScreen); | |
| 609 | + if (!elBtnFullScreen) { | |
| 610 | + console.log('No full screen button found'); | |
| 611 | + return; | |
| 612 | + } | |
| 613 | + e.preventDefault(); | |
| 614 | + let elTarget = null; | |
| 615 | + const targetSelector = elBtnFullScreen.dataset.targetFullscreen; | |
| 616 | + console.log(targetSelector); | |
| 617 | + if (targetSelector) { | |
| 618 | + elTarget = document.querySelector(targetSelector); | |
| 619 | + } | |
| 620 | + if (!elTarget) { | |
| 621 | + console.log('No target element found'); | |
| 622 | + return; | |
| 623 | + } | |
| 624 | + lpToggleFullscreenView(elTarget, elBtnFullScreen); | |
| 625 | + } | |
| 626 | + }]); | |
| 627 | +}; | |
| 628 | + | |
| 491 | 629 | /***/ }, |
| 492 | 630 | |
| 493 | 631 | /***/ "./node_modules/css-loader/dist/cjs.js!./node_modules/toastify-js/src/toastify.css" |
| 494 | 632 | /*!*****************************************************************************************!*\ |
| @@ -1508,19 +1646,19 @@ | ||
| 1508 | 1646 | |
| 1509 | 1647 | /******/ }); |
| 1510 | 1648 | /************************************************************************/ |
| 1511 | 1649 | /******/ // The module cache |
| 1512 | -/******/ var __webpack_module_cache__ = {}; | |
| 1650 | +/******/ const __webpack_module_cache__ = {}; | |
| 1513 | 1651 | /******/ |
| 1514 | 1652 | /******/ // The require function |
| 1515 | 1653 | /******/ function __webpack_require__(moduleId) { |
| 1516 | 1654 | /******/ // Check if module is in cache |
| 1517 | -/******/ var cachedModule = __webpack_module_cache__[moduleId]; | |
| 1655 | +/******/ const cachedModule = __webpack_module_cache__[moduleId]; | |
| 1518 | 1656 | /******/ if (cachedModule !== undefined) { |
| 1519 | 1657 | /******/ return cachedModule.exports; |
| 1520 | 1658 | /******/ } |
| 1521 | 1659 | /******/ // Create a new module (and put it into the cache) |
| 1522 | -/******/ var module = __webpack_module_cache__[moduleId] = { | |
| 1660 | +/******/ const module = __webpack_module_cache__[moduleId] = { | |
| 1523 | 1661 | /******/ id: moduleId, |
| 1524 | 1662 | /******/ // no module.loaded needed |
| 1525 | 1663 | /******/ exports: {} |
| 1526 | 1664 | /******/ }; |
| @@ -1527,9 +1665,9 @@ | ||
| 1527 | 1665 | /******/ |
| 1528 | 1666 | /******/ // Execute the module function |
| 1529 | 1667 | /******/ if (!(moduleId in __webpack_modules__)) { |
| 1530 | 1668 | /******/ delete __webpack_module_cache__[moduleId]; |
| 1531 | -/******/ var e = new Error("Cannot find module '" + moduleId + "'"); | |
| 1669 | +/******/ const e = new Error("Cannot find module '" + moduleId + "'"); | |
| 1532 | 1670 | /******/ e.code = 'MODULE_NOT_FOUND'; |
| 1533 | 1671 | /******/ throw e; |
| 1534 | 1672 | /******/ } |
| 1535 | 1673 | /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); |
| @@ -1542,9 +1680,9 @@ | ||
| 1542 | 1680 | /******/ /* webpack/runtime/compat get default export */ |
| 1543 | 1681 | /******/ (() => { |
| 1544 | 1682 | /******/ // getDefaultExport function for compatibility with non-harmony modules |
| 1545 | 1683 | /******/ __webpack_require__.n = (module) => { |
| 1546 | -/******/ var getter = module && module.__esModule ? | |
| 1684 | +/******/ const getter = module && module.__esModule ? | |
| 1547 | 1685 | /******/ () => (module['default']) : |
| 1548 | 1686 | /******/ () => (module); |
| 1549 | 1687 | /******/ __webpack_require__.d(getter, { a: getter }); |
| 1550 | 1688 | /******/ return getter; |
| @@ -1552,14 +1690,29 @@ | ||
| 1552 | 1690 | /******/ })(); |
| 1553 | 1691 | /******/ |
| 1554 | 1692 | /******/ /* webpack/runtime/define property getters */ |
| 1555 | 1693 | /******/ (() => { |
| 1556 | -/******/ // define getter functions for harmony exports | |
| 1694 | +/******/ // define getter/value functions for harmony exports | |
| 1557 | 1695 | /******/ __webpack_require__.d = (exports, definition) => { |
| 1558 | -/******/ for(var key in definition) { | |
| 1559 | -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { | |
| 1560 | -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); | |
| 1696 | +/******/ if(Array.isArray(definition)) { | |
| 1697 | +/******/ var i = 0; | |
| 1698 | +/******/ while(i < definition.length) { | |
| 1699 | +/******/ var key = definition[i++]; | |
| 1700 | +/******/ var binding = definition[i++]; | |
| 1701 | +/******/ if(!__webpack_require__.o(exports, key)) { | |
| 1702 | +/******/ if(binding === 0) { | |
| 1703 | +/******/ Object.defineProperty(exports, key, { enumerable: true, value: definition[i++] }); | |
| 1704 | +/******/ } else { | |
| 1705 | +/******/ Object.defineProperty(exports, key, { enumerable: true, get: binding }); | |
| 1706 | +/******/ } | |
| 1707 | +/******/ } else if(binding === 0) { i++; } | |
| 1561 | 1708 | /******/ } |
| 1709 | +/******/ } else { | |
| 1710 | +/******/ for(var key in definition) { | |
| 1711 | +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { | |
| 1712 | +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); | |
| 1713 | +/******/ } | |
| 1714 | +/******/ } | |
| 1562 | 1715 | /******/ } |
| 1563 | 1716 | /******/ }; |
| 1564 | 1717 | /******/ })(); |
| 1565 | 1718 | /******/ |
| @@ -1564,9 +1717,9 @@ | ||
| 1564 | 1717 | /******/ })(); |
| 1565 | 1718 | /******/ |
| 1566 | 1719 | /******/ /* webpack/runtime/hasOwnProperty shorthand */ |
| 1567 | 1720 | /******/ (() => { |
| 1568 | -/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) | |
| 1721 | +/******/ __webpack_require__.o = (obj, prop) => (Object.hasOwn(obj, prop)) | |
| 1569 | 1722 | /******/ })(); |
| 1570 | 1723 | /******/ |
| 1571 | 1724 | /******/ /* webpack/runtime/make namespace object */ |
| 1572 | 1725 | /******/ (() => { |
| @@ -1571,9 +1724,9 @@ | ||
| 1571 | 1724 | /******/ /* webpack/runtime/make namespace object */ |
| 1572 | 1725 | /******/ (() => { |
| 1573 | 1726 | /******/ // define __esModule on exports |
| 1574 | 1727 | /******/ __webpack_require__.r = (exports) => { |
| 1575 | -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { | |
| 1728 | +/******/ if(Symbol.toStringTag) { | |
| 1576 | 1729 | /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
| 1577 | 1730 | /******/ } |
| 1578 | 1731 | /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
| 1579 | 1732 | /******/ }; |
| @@ -1584,9 +1737,9 @@ | ||
| 1584 | 1737 | /******/ __webpack_require__.nc = undefined; |
| 1585 | 1738 | /******/ })(); |
| 1586 | 1739 | /******/ |
| 1587 | 1740 | /************************************************************************/ |
| 1588 | -var __webpack_exports__ = {}; | |
| 1741 | +let __webpack_exports__ = {}; | |
| 1589 | 1742 | // This entry needs to be wrapped in an IIFE because it needs to be in strict mode. |
| 1590 | 1743 | (() => { |
| 1591 | 1744 | "use strict"; |
| 1592 | 1745 | /*!*********************************************!*\ |