d854f06446c831afb8ee35c9bd302d19.json
32.5 KB
{"ast":null,"code":"function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) _setPrototypeOf(subClass, superClass);\n}\n\nfunction _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nfunction _createSuper(Derived) {\n var hasNativeReflectConstruct = _isNativeReflectConstruct();\n\n return function _createSuperInternal() {\n var Super = _getPrototypeOf(Derived),\n result;\n\n if (hasNativeReflectConstruct) {\n var NewTarget = _getPrototypeOf(this).constructor;\n\n result = Reflect.construct(Super, arguments, NewTarget);\n } else {\n result = Super.apply(this, arguments);\n }\n\n return _possibleConstructorReturn(this, result);\n };\n}\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return _assertThisInitialized(self);\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nfunction _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n\n try {\n Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}\n\nfunction _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nimport * as React from 'react';\nimport arrayTreeFilter from 'array-tree-filter';\n\nvar Menus = /*#__PURE__*/function (_React$Component) {\n _inherits(Menus, _React$Component);\n\n var _super = _createSuper(Menus);\n\n function Menus() {\n var _this;\n\n _classCallCheck(this, Menus);\n\n _this = _super.apply(this, arguments);\n _this.menuItems = {};\n\n _this.saveMenuItem = function (index) {\n return function (node) {\n _this.menuItems[index] = node;\n };\n };\n\n return _this;\n }\n\n _createClass(Menus, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n this.scrollActiveItemToView();\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate(prevProps) {\n if (!prevProps.visible && this.props.visible) {\n this.scrollActiveItemToView();\n }\n }\n }, {\n key: \"getFieldName\",\n value: function getFieldName(name) {\n var _this$props = this.props,\n fieldNames = _this$props.fieldNames,\n defaultFieldNames = _this$props.defaultFieldNames; // 防止只设置单个属性的名字\n\n return fieldNames[name] || defaultFieldNames[name];\n }\n }, {\n key: \"getOption\",\n value: function getOption(option, menuIndex) {\n var _this$props2 = this.props,\n prefixCls = _this$props2.prefixCls,\n expandTrigger = _this$props2.expandTrigger,\n expandIcon = _this$props2.expandIcon,\n loadingIcon = _this$props2.loadingIcon;\n var onSelect = this.props.onSelect.bind(this, option, menuIndex);\n var onItemDoubleClick = this.props.onItemDoubleClick.bind(this, option, menuIndex);\n var expandProps = {\n onClick: onSelect,\n onDoubleClick: onItemDoubleClick\n };\n var menuItemCls = \"\".concat(prefixCls, \"-menu-item\");\n var expandIconNode = null;\n var hasChildren = option[this.getFieldName('children')] && option[this.getFieldName('children')].length > 0;\n\n if (hasChildren || option.isLeaf === false) {\n menuItemCls += \" \".concat(prefixCls, \"-menu-item-expand\");\n\n if (!option.loading) {\n expandIconNode = React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-menu-item-expand-icon\")\n }, expandIcon);\n }\n }\n\n if (expandTrigger === 'hover' && (hasChildren || option.isLeaf === false)) {\n expandProps = {\n onMouseEnter: this.delayOnSelect.bind(this, onSelect),\n onMouseLeave: this.delayOnSelect.bind(this),\n onClick: onSelect\n };\n }\n\n if (this.isActiveOption(option, menuIndex)) {\n menuItemCls += \" \".concat(prefixCls, \"-menu-item-active\");\n expandProps.ref = this.saveMenuItem(menuIndex);\n }\n\n if (option.disabled) {\n menuItemCls += \" \".concat(prefixCls, \"-menu-item-disabled\");\n }\n\n var loadingIconNode = null;\n\n if (option.loading) {\n menuItemCls += \" \".concat(prefixCls, \"-menu-item-loading\");\n loadingIconNode = loadingIcon || null;\n }\n\n var title = '';\n\n if ('title' in option) {\n // eslint-disable-next-line prefer-destructuring\n title = option.title;\n } else if (typeof option[this.getFieldName('label')] === 'string') {\n title = option[this.getFieldName('label')];\n }\n\n return React.createElement(\"li\", Object.assign({\n key: option[this.getFieldName('value')],\n className: menuItemCls,\n title: title\n }, expandProps, {\n role: \"menuitem\",\n onMouseDown: function onMouseDown(e) {\n return e.preventDefault();\n }\n }), option[this.getFieldName('label')], expandIconNode, loadingIconNode);\n }\n }, {\n key: \"getActiveOptions\",\n value: function getActiveOptions(values) {\n var _this2 = this;\n\n var options = this.props.options;\n var activeValue = values || this.props.activeValue;\n return arrayTreeFilter(options, function (o, level) {\n return o[_this2.getFieldName('value')] === activeValue[level];\n }, {\n childrenKeyName: this.getFieldName('children')\n });\n }\n }, {\n key: \"getShowOptions\",\n value: function getShowOptions() {\n var _this3 = this;\n\n var options = this.props.options;\n var result = this.getActiveOptions().map(function (activeOption) {\n return activeOption[_this3.getFieldName('children')];\n }).filter(function (activeOption) {\n return !!activeOption;\n });\n result.unshift(options);\n return result;\n }\n }, {\n key: \"delayOnSelect\",\n value: function delayOnSelect(onSelect) {\n var _this4 = this;\n\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n if (this.delayTimer) {\n clearTimeout(this.delayTimer);\n this.delayTimer = null;\n }\n\n if (typeof onSelect === 'function') {\n this.delayTimer = window.setTimeout(function () {\n onSelect(args);\n _this4.delayTimer = null;\n }, 150);\n }\n }\n }, {\n key: \"scrollActiveItemToView\",\n value: function scrollActiveItemToView() {\n // scroll into view\n var optionsLength = this.getShowOptions().length; // eslint-disable-next-line no-plusplus\n\n for (var i = 0; i < optionsLength; i++) {\n var itemComponent = this.menuItems[i];\n\n if (itemComponent && itemComponent.parentElement) {\n itemComponent.parentElement.scrollTop = itemComponent.offsetTop;\n }\n }\n }\n }, {\n key: \"isActiveOption\",\n value: function isActiveOption(option, menuIndex) {\n var _this$props$activeVal = this.props.activeValue,\n activeValue = _this$props$activeVal === void 0 ? [] : _this$props$activeVal;\n return activeValue[menuIndex] === option[this.getFieldName('value')];\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this5 = this;\n\n var _this$props3 = this.props,\n prefixCls = _this$props3.prefixCls,\n dropdownMenuColumnStyle = _this$props3.dropdownMenuColumnStyle;\n return React.createElement(\"div\", null, this.getShowOptions().map(function (options, menuIndex) {\n return React.createElement(\"ul\", {\n className: \"\".concat(prefixCls, \"-menu\"),\n key: menuIndex,\n style: dropdownMenuColumnStyle\n }, options.map(function (option) {\n return _this5.getOption(option, menuIndex);\n }));\n }));\n }\n }]);\n\n return Menus;\n}(React.Component);\n\nMenus.defaultProps = {\n options: [],\n value: [],\n activeValue: [],\n onSelect: function onSelect() {},\n prefixCls: 'rc-cascader-menus',\n visible: false,\n expandTrigger: 'click'\n};\nexport default Menus;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/rc-cascader/es/Menus.js"],"names":["_typeof","obj","Symbol","iterator","constructor","prototype","_classCallCheck","instance","Constructor","TypeError","_defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","key","_createClass","protoProps","staticProps","_inherits","subClass","superClass","create","value","_setPrototypeOf","o","p","setPrototypeOf","__proto__","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf","result","NewTarget","Reflect","construct","arguments","apply","_possibleConstructorReturn","self","call","_assertThisInitialized","ReferenceError","sham","Proxy","Date","toString","e","getPrototypeOf","React","arrayTreeFilter","Menus","_React$Component","_super","_this","menuItems","saveMenuItem","index","node","componentDidMount","scrollActiveItemToView","componentDidUpdate","prevProps","visible","getFieldName","name","_this$props","fieldNames","defaultFieldNames","getOption","option","menuIndex","_this$props2","prefixCls","expandTrigger","expandIcon","loadingIcon","onSelect","bind","onItemDoubleClick","expandProps","onClick","onDoubleClick","menuItemCls","concat","expandIconNode","hasChildren","isLeaf","loading","createElement","className","onMouseEnter","delayOnSelect","onMouseLeave","isActiveOption","ref","disabled","loadingIconNode","title","assign","role","onMouseDown","preventDefault","getActiveOptions","values","_this2","options","activeValue","level","childrenKeyName","getShowOptions","_this3","map","activeOption","filter","unshift","_this4","_len","args","Array","_key","delayTimer","clearTimeout","window","setTimeout","optionsLength","itemComponent","parentElement","scrollTop","offsetTop","_this$props$activeVal","render","_this5","_this$props3","dropdownMenuColumnStyle","style","Component","defaultProps"],"mappings":"AAAA,SAASA,OAAT,CAAiBC,GA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K,CAACuF,SA7MiB,CAAzB;;AA+MArF,KAAK,CAACsF,YAAN,GAAqB;AACnB/B,EAAAA,OAAO,EAAE,EADU;AAEnBvF,EAAAA,KAAK,EAAE,EAFY;AAGnBwF,EAAAA,WAAW,EAAE,EAHM;AAInB9B,EAAAA,QAAQ,EAAE,SAASA,QAAT,GAAoB,CAAE,CAJb;AAKnBJ,EAAAA,SAAS,EAAE,mBALQ;AAMnBV,EAAAA,OAAO,EAAE,KANU;AAOnBW,EAAAA,aAAa,EAAE;AAPI,CAArB;AASA,eAAevB,KAAf","sourcesContent":["function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nimport * as React from 'react';\nimport arrayTreeFilter from 'array-tree-filter';\n\nvar Menus = /*#__PURE__*/function (_React$Component) {\n _inherits(Menus, _React$Component);\n\n var _super = _createSuper(Menus);\n\n function Menus() {\n var _this;\n\n _classCallCheck(this, Menus);\n\n _this = _super.apply(this, arguments);\n _this.menuItems = {};\n\n _this.saveMenuItem = function (index) {\n return function (node) {\n _this.menuItems[index] = node;\n };\n };\n\n return _this;\n }\n\n _createClass(Menus, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n this.scrollActiveItemToView();\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate(prevProps) {\n if (!prevProps.visible && this.props.visible) {\n this.scrollActiveItemToView();\n }\n }\n }, {\n key: \"getFieldName\",\n value: function getFieldName(name) {\n var _this$props = this.props,\n fieldNames = _this$props.fieldNames,\n defaultFieldNames = _this$props.defaultFieldNames; // 防止只设置单个属性的名字\n\n return fieldNames[name] || defaultFieldNames[name];\n }\n }, {\n key: \"getOption\",\n value: function getOption(option, menuIndex) {\n var _this$props2 = this.props,\n prefixCls = _this$props2.prefixCls,\n expandTrigger = _this$props2.expandTrigger,\n expandIcon = _this$props2.expandIcon,\n loadingIcon = _this$props2.loadingIcon;\n var onSelect = this.props.onSelect.bind(this, option, menuIndex);\n var onItemDoubleClick = this.props.onItemDoubleClick.bind(this, option, menuIndex);\n var expandProps = {\n onClick: onSelect,\n onDoubleClick: onItemDoubleClick\n };\n var menuItemCls = \"\".concat(prefixCls, \"-menu-item\");\n var expandIconNode = null;\n var hasChildren = option[this.getFieldName('children')] && option[this.getFieldName('children')].length > 0;\n\n if (hasChildren || option.isLeaf === false) {\n menuItemCls += \" \".concat(prefixCls, \"-menu-item-expand\");\n\n if (!option.loading) {\n expandIconNode = React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-menu-item-expand-icon\")\n }, expandIcon);\n }\n }\n\n if (expandTrigger === 'hover' && (hasChildren || option.isLeaf === false)) {\n expandProps = {\n onMouseEnter: this.delayOnSelect.bind(this, onSelect),\n onMouseLeave: this.delayOnSelect.bind(this),\n onClick: onSelect\n };\n }\n\n if (this.isActiveOption(option, menuIndex)) {\n menuItemCls += \" \".concat(prefixCls, \"-menu-item-active\");\n expandProps.ref = this.saveMenuItem(menuIndex);\n }\n\n if (option.disabled) {\n menuItemCls += \" \".concat(prefixCls, \"-menu-item-disabled\");\n }\n\n var loadingIconNode = null;\n\n if (option.loading) {\n menuItemCls += \" \".concat(prefixCls, \"-menu-item-loading\");\n loadingIconNode = loadingIcon || null;\n }\n\n var title = '';\n\n if ('title' in option) {\n // eslint-disable-next-line prefer-destructuring\n title = option.title;\n } else if (typeof option[this.getFieldName('label')] === 'string') {\n title = option[this.getFieldName('label')];\n }\n\n return React.createElement(\"li\", Object.assign({\n key: option[this.getFieldName('value')],\n className: menuItemCls,\n title: title\n }, expandProps, {\n role: \"menuitem\",\n onMouseDown: function onMouseDown(e) {\n return e.preventDefault();\n }\n }), option[this.getFieldName('label')], expandIconNode, loadingIconNode);\n }\n }, {\n key: \"getActiveOptions\",\n value: function getActiveOptions(values) {\n var _this2 = this;\n\n var options = this.props.options;\n var activeValue = values || this.props.activeValue;\n return arrayTreeFilter(options, function (o, level) {\n return o[_this2.getFieldName('value')] === activeValue[level];\n }, {\n childrenKeyName: this.getFieldName('children')\n });\n }\n }, {\n key: \"getShowOptions\",\n value: function getShowOptions() {\n var _this3 = this;\n\n var options = this.props.options;\n var result = this.getActiveOptions().map(function (activeOption) {\n return activeOption[_this3.getFieldName('children')];\n }).filter(function (activeOption) {\n return !!activeOption;\n });\n result.unshift(options);\n return result;\n }\n }, {\n key: \"delayOnSelect\",\n value: function delayOnSelect(onSelect) {\n var _this4 = this;\n\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n if (this.delayTimer) {\n clearTimeout(this.delayTimer);\n this.delayTimer = null;\n }\n\n if (typeof onSelect === 'function') {\n this.delayTimer = window.setTimeout(function () {\n onSelect(args);\n _this4.delayTimer = null;\n }, 150);\n }\n }\n }, {\n key: \"scrollActiveItemToView\",\n value: function scrollActiveItemToView() {\n // scroll into view\n var optionsLength = this.getShowOptions().length; // eslint-disable-next-line no-plusplus\n\n for (var i = 0; i < optionsLength; i++) {\n var itemComponent = this.menuItems[i];\n\n if (itemComponent && itemComponent.parentElement) {\n itemComponent.parentElement.scrollTop = itemComponent.offsetTop;\n }\n }\n }\n }, {\n key: \"isActiveOption\",\n value: function isActiveOption(option, menuIndex) {\n var _this$props$activeVal = this.props.activeValue,\n activeValue = _this$props$activeVal === void 0 ? [] : _this$props$activeVal;\n return activeValue[menuIndex] === option[this.getFieldName('value')];\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this5 = this;\n\n var _this$props3 = this.props,\n prefixCls = _this$props3.prefixCls,\n dropdownMenuColumnStyle = _this$props3.dropdownMenuColumnStyle;\n return React.createElement(\"div\", null, this.getShowOptions().map(function (options, menuIndex) {\n return React.createElement(\"ul\", {\n className: \"\".concat(prefixCls, \"-menu\"),\n key: menuIndex,\n style: dropdownMenuColumnStyle\n }, options.map(function (option) {\n return _this5.getOption(option, menuIndex);\n }));\n }));\n }\n }]);\n\n return Menus;\n}(React.Component);\n\nMenus.defaultProps = {\n options: [],\n value: [],\n activeValue: [],\n onSelect: function onSelect() {},\n prefixCls: 'rc-cascader-menus',\n visible: false,\n expandTrigger: 'click'\n};\nexport default Menus;"]},"metadata":{},"sourceType":"module"}