pintu2/public/plugins/bs-stepper/js/bs-stepper.js.map

1 line
25 KiB
Plaintext
Raw Normal View History

2024-02-27 22:53:57 +07:00
{"version":3,"file":"bs-stepper.js","sources":["../../src/js/polyfill.js","../../src/js/util.js","../../src/js/listeners.js","../../src/js/index.js"],"sourcesContent":["let matches = window.Element.prototype.matches\nlet closest = (element, selector) => element.closest(selector)\nlet WinEvent = (inType, params) => new window.Event(inType, params)\nlet createCustomEvent = (eventName, params) => {\n const cEvent = new window.CustomEvent(eventName, params)\n\n return cEvent\n}\n\n/* istanbul ignore next */\nfunction polyfill () {\n if (!window.Element.prototype.matches) {\n matches = window.Element.prototype.msMatchesSelector ||\n window.Element.prototype.webkitMatchesSelector\n }\n\n if (!window.Element.prototype.closest) {\n closest = (element, selector) => {\n if (!document.documentElement.contains(element)) {\n return null\n }\n\n do {\n if (matches.call(element, selector)) {\n return element\n }\n\n element = element.parentElement || element.parentNode\n } while (element !== null && element.nodeType === 1)\n\n return null\n }\n }\n\n if (!window.Event || typeof window.Event !== 'function') {\n WinEvent = (inType, params) => {\n params = params || {}\n const e = document.createEvent('Event')\n e.initEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable))\n return e\n }\n }\n\n if (typeof window.CustomEvent !== 'function') {\n const originPreventDefault = window.Event.prototype.preventDefault\n\n createCustomEvent = (eventName, params) => {\n const evt = document.createEvent('CustomEvent')\n\n params = params || { bubbles: false, cancelable: false, detail: null }\n evt.initCustomEvent(eventName, params.bubbles, params.cancelable, params.detail)\n evt.preventDefault = function () {\n if (!this.cancelable) {\n return\n }\n\n originPreventDefault.call(this)\n Object.defineProperty(this, 'defaultPrevented', {\n get: function () { return true }\n })\n }\n\n return evt\n }\n }\n}\n\npolyfill()\n\nexport {\n closest,\n WinEvent,\n createCustomEvent\n}\n","import { WinEvent, createCustomEvent } from './polyfill'\n\nconst MILLISECONDS_MULTIPLIER = 1000\n\nconst ClassName = {\n ACTIVE: 'active',\n LINEAR: 'linear',\n BLOCK: 'dstepper-block',\n NONE: 'dstepper-none',\n FADE: 'fade',\n VERTICAL: 'vertical'\n}\n\nconst transitionEndEvent = 'transitionend'\nconst customProperty = 'bsStepper'\n\nconst show = (stepperNode, indexStep, options, done) => {\n const stepper = stepperNode[customProperty]\n\n if (stepper._steps[indexStep].classList.contains(ClassName.ACTIVE) || stepper._stepsContents[indexStep].classList.contains(ClassName.ACTIVE)) {\n return\n }\n\n const showEvent = createCustomEvent('show.bs-stepper', {\n cancelable: true,\n detail: {\n from: stepper._currentIndex,\n to: indexStep,\n indexStep\n }\n })\n stepperNode.dispatchEvent(showEvent)\n\n const activeStep = stepper._steps.filter(step => step.classList.contains(ClassName.ACTIVE))\n const activeContent = stepper._stepsContents.filter(content => content.classList.contains(ClassName.ACTIVE))\n\n if (showEvent.defaultPrevented) {\n return\n }\n\n if (activeStep.length) {\n activeStep[0].classList.remove(ClassName.ACTIVE)\n }\n if (activeContent.length) {\n activeContent[0].classList.remove(ClassName.ACTIVE)\n\n if (!stepperNode.classList.contains(ClassName.VERTICAL) && !stepper.options.animation) {\n activeContent[0].classList.remove(ClassName.BLOCK)\n }\n }\n\n showStep(stepperNode, stepper._steps[indexStep], stepper._steps, options)\n showContent(stepperNode, stepper._stepsContents[indexStep], stepper._stepsContents, activeContent, done)\n}\n\nconst showStep = (stepperNode, step, stepList, options) => {\n stepList.forEach(step => {\n const trigger = step.querySelector(options.selectors.trigger)\n\n trigger.setAttribute('aria-selected', 'false')\n // if stepper is in linear mode,