1 line
2.9 KiB
JSON
1 line
2.9 KiB
JSON
{"ast":null,"code":"import _inheritsLoose from \"@babel/runtime/helpers/esm/inheritsLoose\";\nimport css from 'dom-helpers/css';\nimport qsa from 'dom-helpers/querySelectorAll';\nimport getScrollbarSize from 'dom-helpers/scrollbarSize';\nimport ModalManager from 'react-overlays/ModalManager';\nvar Selector = {\n FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',\n STICKY_CONTENT: '.sticky-top',\n NAVBAR_TOGGLER: '.navbar-toggler'\n};\n\nvar BootstrapModalManager = /*#__PURE__*/function (_ModalManager) {\n _inheritsLoose(BootstrapModalManager, _ModalManager);\n\n function BootstrapModalManager() {\n var _this;\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _ModalManager.call.apply(_ModalManager, [this].concat(args)) || this;\n\n _this.adjustAndStore = function (prop, element, adjust) {\n var _css;\n\n var actual = element.style[prop];\n element.dataset[prop] = actual;\n css(element, (_css = {}, _css[prop] = parseFloat(css(element, prop)) + adjust + \"px\", _css));\n };\n\n _this.restore = function (prop, element) {\n var value = element.dataset[prop];\n\n if (value !== undefined) {\n var _css2;\n\n delete element.dataset[prop];\n css(element, (_css2 = {}, _css2[prop] = value, _css2));\n }\n };\n\n return _this;\n }\n\n var _proto = BootstrapModalManager.prototype;\n\n _proto.setContainerStyle = function setContainerStyle(containerState, container) {\n var _this2 = this;\n\n _ModalManager.prototype.setContainerStyle.call(this, containerState, container);\n\n if (!containerState.overflowing) return;\n var size = getScrollbarSize();\n qsa(container, Selector.FIXED_CONTENT).forEach(function (el) {\n return _this2.adjustAndStore('paddingRight', el, size);\n });\n qsa(container, Selector.STICKY_CONTENT).forEach(function (el) {\n return _this2.adjustAndStore('margingRight', el, -size);\n });\n qsa(container, Selector.NAVBAR_TOGGLER).forEach(function (el) {\n return _this2.adjustAndStore('margingRight', el, size);\n });\n };\n\n _proto.removeContainerStyle = function removeContainerStyle(containerState, container) {\n var _this3 = this;\n\n _ModalManager.prototype.removeContainerStyle.call(this, containerState, container);\n\n qsa(container, Selector.FIXED_CONTENT).forEach(function (el) {\n return _this3.restore('paddingRight', el);\n });\n qsa(container, Selector.STICKY_CONTENT).forEach(function (el) {\n return _this3.restore('margingRight', el);\n });\n qsa(container, Selector.NAVBAR_TOGGLER).forEach(function (el) {\n return _this3.restore('margingRight', el);\n });\n };\n\n return BootstrapModalManager;\n}(ModalManager);\n\nexport { BootstrapModalManager as default };","map":null,"metadata":{},"sourceType":"module"} |