1 line
11 KiB
JSON
1 line
11 KiB
JSON
|
{"ast":null,"code":"'use strict';\n\nvar _typeof2 = require(\"D:/Work/WorkSpace/GitWorkSpace/TenShop/resource/ElectronicMall/src/qingge-Market/qingge-vue/vue/node_modules/@babel/runtime/helpers/typeof.js\").default;\n\nrequire(\"core-js/modules/es.symbol.js\");\n\nrequire(\"core-js/modules/es.symbol.description.js\");\n\nrequire(\"core-js/modules/es.object.to-string.js\");\n\nrequire(\"core-js/modules/es.symbol.iterator.js\");\n\nrequire(\"core-js/modules/es.string.iterator.js\");\n\nrequire(\"core-js/modules/web.dom-collections.iterator.js\");\n\nrequire(\"core-js/modules/es.error.cause.js\");\n\nexports.__esModule = true;\n\nvar _typeof = typeof Symbol === \"function\" && _typeof2(Symbol.iterator) === \"symbol\" ? function (obj) {\n return _typeof2(obj);\n} : function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : _typeof2(obj);\n};\n\nvar _ariaUtils = require('./aria-utils');\n\nvar _ariaUtils2 = _interopRequireDefault(_ariaUtils);\n\nfunction _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n}\n/**\n * @constructor\n * @desc Dialog object providing modal focus management.\n *\n * Assumptions: The element serving as the dialog container is present in the\n * DOM and hidden. The dialog container has role='dialog'.\n *\n * @param dialogId\n * The ID of the element serving as the dialog container.\n * @param focusAfterClosed\n * Either the DOM node or the ID of the DOM node to focus when the\n * dialog closes.\n * @param focusFirst\n * Optional parameter containing either the DOM node or the ID of the\n * DOM node to focus when the dialog opens. If not specified, the\n * first focusable element in the dialog will receive focus.\n */\n\n\nvar aria = aria || {};\nvar tabEvent;\n\naria.Dialog = function (dialog, focusAfterClosed, focusFirst) {\n var _this = this;\n\n this.dialogNode = dialog;\n\n if (this.dialogNode === null || this.dialogNode.getAttribute('role') !== 'dialog') {\n throw new Error('Dialog() requires a DOM element with ARIA role of dialog.');\n }\n\n if (typeof focusAfterClosed === 'string') {\n this.focusAfterClosed = document.getElementById(focusAfterClosed);\n } else if ((typeof focusAfterClosed === 'undefined' ? 'undefined' : _typeof(focusAfterClosed)) === 'object') {\n this.focusAfterClosed = focusAfterClosed;\n } else {\n this.focusAfterClosed = null;\n }\n\n if (typeof focusFirst === 'string') {\n this.focusFirst = document.getElementById(focusFirst);\n } else if ((typeof focusFirst === 'undefined' ? 'undefined' : _typeof(focusFirst)) === 'object') {\n this.focusFirst = focusFirst;\n } else {\n this.focusFirst = null;\n }\n\n if (this.focusFirst) {\n this.focusFirst.focus();\n } else {\n _ariaUtils2.default.focusFirstDescendant(this.dialogNode);\n }\n\n this.lastFocus = document.activeElement;\n\n tabEvent = function tabEvent(e) {\n _this.trapFocus(e);\n };\n\n this.addListeners();\n};\n\naria.Dialog.prototype.addListeners = function () {\n document.addEventListener('focus', tabEvent, true);\n};\n\naria.Dialog.prototype.removeListeners = function () {\n document.removeEventListener('focus', tabEvent, true);\n};\n\naria.Dialog.prototype.closeDialog = function () {\n var _this2 = this;\n\n this.removeListeners();\n\n if (this.focusAfterClosed) {\n setTimeout(function () {\n _this2.focusAfterClosed.focus();\n });\n }\n};\n\naria.Dialog.prototype.trapFocus = function (event) {\n if (_ariaUtils2.default.IgnoreUtilFocusChanges) {\n return;\n }\n\n if (this.dialogNode.contains(event.target)) {\n this.lastFocus = event.target;\n } else {\n _ariaUtils2.default.focusFirstDescendant(this.dialogNode);\n\n if (this.lastFocus === document.activeElement) {\n _ariaUtils2.default.focusLastDescendant(this.dialogNode);\n }\n\n this.lastFocus = document.activeElement;\n }\n};\n\nexports.default = aria.Dialog;","map":{"version":3,"sources":["D:/Wor
|