-
Notifications
You must be signed in to change notification settings - Fork 0
/
3694-c3e5b42e89e8592c4219.js
1 lines (1 loc) · 9.86 KB
/
3694-c3e5b42e89e8592c4219.js
1
(self.webpackChunkzent_docs=self.webpackChunkzent_docs||[]).push([[3694],{5716:(e,n,t)=>{"use strict";t.d(n,{v:()=>x,Z:()=>g});var i=t(59312),o=t(24246),s=t(60042),r=t.n(s),l=t(27378),d=t(17949),p=t(42690);function a(e,n,t){return void 0===t&&(t="item"),e.key||t+"_"+n}function u(e){var n=e.isInline,t=e.depth,i=e.inlineIndent,o={};return n&&(o={paddingLeft:t*i+"px"}),o}var c=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return(0,i.ZT)(n,e),n.prototype.renderCommonMenuItem=function(e,n,t,o){var s=(0,i.pi)({specKey:a(e,n,t),onClick:this.handleClick},o);return(0,l.cloneElement)(e,s)},n}(l.PureComponent),h=function(e){function n(){var n=null!==e&&e.apply(this,arguments)||this;return n.handleClick=function(e){var t=n.props,i=t.specKey,o=t.onClick,s=t.disabled,r=t.isInline,l=t.handleSelect;s||(r&&l(i),o(e,i))},n}return(0,i.ZT)(n,e),n.prototype.render=function(){var e=this.props,n=e.specKey,t=e.className,s=e.children,l=e.disabled,d=e.isInline,p=e.selectedKey===n,a=u({isInline:d,depth:e.depth,inlineIndent:e.inlineIndent});return(0,o.jsx)("li",(0,i.pi)({className:r()("zent-menu-item",t,{"zent-menu__inline-item":d,"zent-menu__inline-item-selected":p,"zent-menu-item-disabled":l}),style:a,onClick:this.handleClick,"data-zv":"9.12.16"},{children:s}),void 0)},n}(l.Component),m=t(27036),v=t(79737),f=function(e){function n(){var n=null!==e&&e.apply(this,arguments)||this;return n.handleClick=function(e,t){(0,n.props.onClick)(e,t)},n.onSubMenuClick=function(){n.props.onSubMenuClick&&n.props.onSubMenuClick(n.props.specKey)},n.renderSubMenuItems=function(e,t){if(!e)return null;var i=n.props.specKey;return n.renderCommonMenuItem(e,t,i)},n}return(0,i.ZT)(n,e),n.prototype.render=function(){var e=this.props,n=e.children,t=e.visible,s=e.overlayCx;return t?(0,o.jsx)("ul",(0,i.pi)({className:r()("zent-menu","zent-submenu-content",s),onClick:this.onSubMenuClick,"data-zv":"9.12.16"},{children:l.Children.map(n,this.renderSubMenuItems)}),void 0):null},n}(c),y=function(e){function n(){var n=null!==e&&e.apply(this,arguments)||this;return n.state={subMenuVisible:!1},n.getEventHanders=function(e,t){var i={};return e||t||(i={onMouseEnter:n.onMouseEnter,onMouseLeave:n.onMouseLeave}),i},n.handleClick=function(e,t){var i=n.props,o=i.onClick;!i.isInline&&n.setState({subMenuVisible:!1}),o(e,t)},n.titleClickHandler=function(e){var t,i,o=n.props,s=o.isInline,r=o.specKey,l=o.toggleExpand;null===(i=(t=n.props).onSubMenuClick)||void 0===i||i.call(t,r),s&&l(r),e.stopPropagation()},n.onMouseEnter=function(){n.leaveTimer&&clearTimeout(n.leaveTimer),n.enterTimer=setTimeout((function(){n.setState({subMenuVisible:!0})}),200)},n.onMouseLeave=function(){n.enterTimer&&clearTimeout(n.enterTimer),n.leaveTimer=setTimeout((function(){n.setState({subMenuVisible:!1})}),200)},n.renderInlineChild=function(e,t){var i=n.props,o=i.depth,s=i.isInline,r=i.inlineIndent,l=i.selectedKey,d=i.expandKeys,p=i.handleSelect,a=i.toggleExpand,u=i.specKey;return n.renderCommonMenuItem(e,t,u,{depth:o+1,isInline:s,inlineIndent:r,selectedKey:l,expandKeys:d,handleSelect:p,toggleExpand:a,onSubMenuClick:n.props.onSubMenuClick})},n}return(0,i.ZT)(n,e),n.prototype.renderContent=function(){var e=this.props,n=e.children,t=e.specKey,s=e.overlayClassName,r=e.isInline,d=e.expandKeys,p=d&&-1!==d.indexOf(t);return r?(0,o.jsx)(v.H,(0,i.pi)({duration:200,height:p?"auto":0},{children:(0,o.jsx)("ul",(0,i.pi)({className:"zent-menu__inner","data-zv":"9.12.16"},{children:l.Children.map(n,this.renderInlineChild)}),void 0)}),void 0):(0,o.jsx)(f,(0,i.pi)({visible:this.state.subMenuVisible,onClick:this.handleClick,specKey:t,overlayCx:s,onSubMenuClick:this.props.onSubMenuClick},{children:n}),void 0)},n.prototype.render=function(){var e=this.props,n=e.className,t=e.disabled,s=e.title,l=e.isInline,d=e.depth,p=e.inlineIndent,a=e.expandKeys,c=e.specKey,h=a&&-1!==a.indexOf(c),v=this.getEventHanders(t,l),f=u({isInline:l,depth:d,inlineIndent:p}),y=r()(n,{"zent-menu-item":!l,"zent-menu-item-disabled":t,"zent-submenu":!l,"zent-menu__inline-submenu":l,"zent-menu__inline-item-disabled":t&&l});return(0,o.jsxs)("li",(0,i.pi)({className:y},v,{"data-zv":"9.12.16"},{children:[(0,o.jsxs)("div",(0,i.pi)({className:r()({"zent-submenu-title":!l,"zent-menu__inline-submenu-title":l,"zent-submenu-disabled":t}),style:f,onClick:this.titleClickHandler,"data-zv":"9.12.16"},{children:[s,!t&&(0,o.jsx)(m.Z,{className:r()("zent-submenu-title-operate-icon",{"zent-menu__inline-submenu-icon--expand":l&&h}),type:"right"},void 0)]}),void 0),!t&&this.renderContent()]}),void 0)},n.defaultProps={className:""},n}(c),x=function(e){function n(n){var t,o,s,r=e.call(this,n)||this;return r.toggleExpand=function(e){var n,t,o=r.state.expandedKeys,s=-1!==o.indexOf(e)?o.filter((function(n){return n!==e})):(0,i.ev)([e],o);r.setState({expandedKeys:s}),null===(t=(n=r.props).onExpandChange)||void 0===t||t.call(n,s)},r.handleSelect=function(e){var n,t;r.setState({selectedKey:e}),null===(t=(n=r.props).onSelectChange)||void 0===t||t.call(n,e)},r.handleClick=function(e,n){var t=r.props.onClick;t&&t(e,n)},r.renderMenuItem=function(e,n){return e?r.renderCommonMenuItem(e,n,void 0,{depth:1,isInline:"inline"===r.props.mode,inlineIndent:r.props.inlineIndent,selectedKey:r.state.selectedKey,expandKeys:r.state.expandedKeys,handleSelect:r.handleSelect,toggleExpand:r.toggleExpand,onSubMenuClick:r.props.onSubMenuClick}):null},"inline"===n.mode?r.state={selectedKey:null!==(t=n.selectedKey)&&void 0!==t?t:n.defaultSelectedKey,expandedKeys:null!==(s=null!==(o=n.expandedKeys)&&void 0!==o?o:n.defaultExpandedKeys)&&void 0!==s?s:n.defaultExpandKeys,prevExpandedKeysProp:n.expandedKeys,prevSelectedKeyProp:n.selectedKey}:r.state={},r}return(0,i.ZT)(n,e),n.getDerivedStateFromProps=function(e,n){if("inline"!==e.mode)return null;var t={prevSelectedKeyProp:e.selectedKey,prevExpandedKeysProp:e.expandedKeys};return e.selectedKey!==n.prevSelectedKeyProp&&e.selectedKey!==n.selectedKey&&(t.selectedKey=e.selectedKey),(0,d.Z)(e.expandedKeys,n.prevExpandedKeysProp)||(0,d.Z)(e.expandedKeys,n.expandedKeys)||(t.expandedKeys=e.expandedKeys),t},n.prototype.render=function(){var e=this.props,n=e.children,t=e.className,s=e.style,d="inline"===e.mode,p=r()("zent-menu",t,{"zent-menu__inline":d});return(0,o.jsx)("ul",(0,i.pi)({className:p,style:s,"data-zv":"9.12.16"},{children:l.Children.map(n,this.renderMenuItem)}),void 0)},n.MenuItem=h,n.SubMenu=y,n.defaultProps={onClick:p.Z,mode:"pop",inlineIndent:24,defaultExpandKeys:[],onSubMenuClick:p.Z},n}(c),g=x},13694:(e,n,t)=>{"use strict";t.d(n,{a:()=>v});var i=t(59312),o=t(24246),s=t(27378),r=t(60042),l=t.n(r),d=t(19832),p=t(90347),a=t(33806),u=t(5716).Z,c=t(27036),h=t(1348),m=u.MenuItem,v=function(e){function n(){var n=null!==e&&e.apply(this,arguments)||this;return n.state={isShowDropdown:!1},n.toggleDropdown=function(e){n.setState({isShowDropdown:e})},n.handleSelect=function(e,t){n.props.onSelect&&n.props.onSelect(t),n.toggleDropdown(!1)},n}return(0,i.ZT)(n,e),n.prototype.render=function(){var e=this,n=this.props,t=n.type,s=n.size,r=n.disabled,h=void 0===r?this.context.value:r,v=n.loading,f=n.dropdownTrigger,y=n.dropdownData,x=n.dropdownValue,g=n.dropdownText,b=n.dropdownPosition,C=n.className,K=n.children,k=n.onClick,z=l()("zent-split-button",C),S=(0,d.Z)(f),M=h||v?a.ZP.Trigger.Base:a.ZP.Trigger[S],I=b.split("-").map((function(e){return(0,d.Z)(e)})).join("");return(0,o.jsxs)("div",(0,i.pi)({className:z,"data-zv":"9.12.16"},{children:[(0,o.jsx)(p.ZP,(0,i.pi)({className:"zent-split-button__main",type:t,size:s,onClick:k,disabled:h,loading:v},{children:K}),void 0),(0,o.jsx)("div",(0,i.pi)({className:"zent-split-button__dropdown-wrapper","data-zv":"9.12.16"},{children:(0,o.jsxs)(a.ZP,(0,i.pi)({visible:this.state.isShowDropdown,onVisibleChange:function(n){return e.toggleDropdown(n)},position:a.ZP.Position[I],cushion:5},{children:[(0,o.jsx)(M,{children:(0,o.jsx)(p.ZP,(0,i.pi)({className:l()("zent-split-button__dropdown",{"zent-split-button__dropdown-disabled":v}),type:t,size:s,disabled:h},{children:(0,o.jsx)(c.Z,{className:"zent-split-button__dropdown-icon",type:"down"},void 0)}),void 0)},void 0),(0,o.jsx)(a.ZP.Content,{children:(0,o.jsx)(u,(0,i.pi)({onClick:this.handleSelect},{children:y.map((function(e){return(0,o.jsx)(m,{children:e[g]},""+e[x])}))}),void 0)},void 0)]}),void 0)}),void 0)]}),void 0)},n.defaultProps={type:"default",size:"medium",dropdownTrigger:"click",dropdownData:[],dropdownValue:"value",dropdownText:"text",dropdownPosition:"auto-bottom-left"},n.contextType=h.d,n}(s.Component)},79737:(e,n,t)=>{"use strict";t.d(n,{H:()=>d});var i=t(59312),o=t(24246),s=t(27378),r=t(17127);function l(e,n){e.style.height="number"==typeof n?n+"px":n}var d=function(e){function n(){var n=null!==e&&e.apply(this,arguments)||this;return n.ref=(0,s.createRef)(),n.timer=null,n}return(0,i.ZT)(n,e),n.prototype.componentDidMount=function(){var e=this,n=this.props,t=n.appear,i=n.height,o=n.duration,s=this.ref.current;t&&"auto"===i?(s.style.height="0px",(0,r.tA)((function(){e.props.height===i&&(s.style.height=s.offsetHeight+"px",e.timer=setTimeout((function(){e.timer=null,e.props.height===i&&(s.style.height="auto")}),o))}))):l(s,i)},n.prototype.componentDidUpdate=function(e){var n=this,t=this.props,i=t.height,o=t.duration;if(e.height!==i){null!==this.timer&&(clearTimeout(this.timer),this.timer=null);var s=this.ref.current;if("auto"===e.height)s.style.height=s.offsetHeight+"px",(0,r.tA)((function(){n.props.height===i&&l(s,i)}));else if("auto"===i){var d=s.offsetHeight;s.style.height="auto";var p=s.offsetHeight;s.style.height=d+"px",(0,r.tA)((function(){s.style.height=p+"px",n.timer=setTimeout((function(){n.timer=null,n.props.height===i&&(s.style.height=i)}),o)}))}else l(s,i)}},n.prototype.render=function(){var e=this.props,n=e.duration,t=e.className,s=e.style,r=e.easing,l=e.overflow,d=e.children;return(0,o.jsx)("div",(0,i.pi)({ref:this.ref,className:t,style:(0,i.pi)((0,i.pi)({},s),{transition:"height "+n+"ms "+r,overflow:l}),"data-zv":"9.12.16"},{children:d}),void 0)},n.defaultProps={appear:!1,duration:200,easing:"ease",overflow:"hidden"},n}(s.Component)}}]);