PromoCursed/node_modules/.cache/babel-loader/d288a8e1fb990c4ee7a5f4c29297d25c0a43fab1df5cc63e0ff0d06bab9b0d7c.json

1 line
43 KiB
JSON
Raw Normal View History

2024-08-20 23:25:37 +04:00
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport _regeneratorRuntime from \"@babel/runtime/helpers/esm/regeneratorRuntime\";\nimport _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport _asyncToGenerator from \"@babel/runtime/helpers/esm/asyncToGenerator\";\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nvar _excluded = [\"component\", \"prefixCls\", \"className\", \"classNames\", \"disabled\", \"id\", \"style\", \"styles\", \"multiple\", \"accept\", \"capture\", \"children\", \"directory\", \"openFileDialogOnClick\", \"onMouseEnter\", \"onMouseLeave\", \"hasControlInside\"];\n/* eslint react/no-is-mounted:0,react/sort-comp:0,react/prop-types:0 */\nimport clsx from 'classnames';\nimport pickAttrs from \"rc-util/es/pickAttrs\";\nimport React, { Component } from 'react';\nimport attrAccept from \"./attr-accept\";\nimport defaultRequest from \"./request\";\nimport traverseFileTree from \"./traverseFileTree\";\nimport getUid from \"./uid\";\nvar AjaxUploader = /*#__PURE__*/function (_Component) {\n _inherits(AjaxUploader, _Component);\n var _super = _createSuper(AjaxUploader);\n function AjaxUploader() {\n var _this;\n _classCallCheck(this, AjaxUploader);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _super.call.apply(_super, [this].concat(args));\n _defineProperty(_assertThisInitialized(_this), \"state\", {\n uid: getUid()\n });\n _defineProperty(_assertThisInitialized(_this), \"reqs\", {});\n _defineProperty(_assertThisInitialized(_this), \"fileInput\", void 0);\n _defineProperty(_assertThisInitialized(_this), \"_isMounted\", void 0);\n _defineProperty(_assertThisInitialized(_this), \"onChange\", function (e) {\n var _this$props = _this.props,\n accept = _this$props.accept,\n directory = _this$props.directory;\n var files = e.target.files;\n var acceptedFiles = _toConsumableArray(files).filter(function (file) {\n return !directory || attrAccept(file, accept);\n });\n _this.uploadFiles(acceptedFiles);\n _this.reset();\n });\n _defineProperty(_assertThisInitialized(_this), \"onClick\", function (event) {\n var el = _this.fileInput;\n if (!el) {\n return;\n }\n var target = event.target;\n var onClick = _this.props.onClick;\n if (target && target.tagName === 'BUTTON') {\n var parent = el.parentNode;\n parent.focus();\n target.blur();\n }\n el.click();\n if (onClick) {\n onClick(event);\n }\n });\n _defineProperty(_assertThisInitialized(_this), \"onKeyDown\", function (e) {\n if (e.key === 'Enter') {\n _this.onClick(e);\n }\n });\n _defineProperty(_assertThisInitialized(_this), \"onFileDrop\", function (e) {\n var multiple = _this.props.multiple;\n e.preventDefault();\n if (e.type === 'dragover') {\n return;\n }\n if (_this.props.directory) {\n traverseFileTree(Array.prototype.slice.call(e.dataTransfer.items), _this.uploadFiles, function (_file) {\n return attrAccept(_file, _this.props.accept);\n });\n } else {\n var files = _toConsumableArray(e.dataTransfer.files).filter(function (file) {\n return attrAccept(file, _this.props.accept);\n });\n if (mult