1
0
Fork 0
owl-admin-starter/public/admin-assets/assets/SwitchContainer-3yEgmLyV.js

2 lines
2.6 KiB
JavaScript

import{t as g,l as c,a5 as w,ad as b,z as h,b6 as N,ae as M,D as o,Q as d,T as n,E as x}from"./index-CEmnTf-r.js";var I=function(r){g(t,r);function t(a){var e=r.call(this,a)||this;return e.state={activeIndex:-1},e}return t.prototype.componentDidUpdate=function(a){var e=this.props.items||[];this.state.activeIndex>0&&!e[this.state.activeIndex]&&this.setState({activeIndex:0})},t.prototype.handleClick=function(a){var e=this.props,s=e.dispatchEvent,i=e.data;s(a,i)},t.prototype.handleMouseEnter=function(a){var e=this.props,s=e.dispatchEvent,i=e.data;s(a,i)},t.prototype.handleMouseLeave=function(a){var e=this.props,s=e.dispatchEvent,i=e.data;s(a,i)},t.prototype.renderBody=function(a){var e=this.props,s=e.children,i=e.render,p=e.disabled,l=a==null?void 0:a.body,u=s?typeof s=="function"?s(this.props):s:l?i("body",l,{disabled:p}):null;return c.createElement("div",{style:{display:"inline"}},u)},t.prototype.switchTo=function(a){var e=this.props.items||[];a>=0&&a<e.length&&this.setState({activeIndex:a})},t.prototype.render=function(){var a,e=this.props,s=e.className,i=e.items,p=i===void 0?[]:i,l=e.classnames,u=e.style,v=e.data,y=e.id,m=e.wrapperCustomStyle,_=e.env,C=e.themeCss,f=(a=p[this.state.activeIndex])!==null&&a!==void 0?a:p.find(function(S){return w(S,v)}),E=c.createElement("div",{className:l("SwitchContainer",s,b(h(h({},this.props),{name:"baseControlClassName",id:y,themeCss:C})),b(h(h({},this.props),{name:"wrapperCustomStyle",id:y,themeCss:m}))),onClick:this.handleClick,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,style:N(u,v),"data-role":"container"},f&&this.renderBody(f),c.createElement(M,{config:{wrapperCustomStyle:m,id:y,themeCss:C,classNames:[{key:"baseControlClassName"}]},env:_}));return E},t.propsList=["body","className"],t.defaultProps={className:""},o([d,n("design:type",Function),n("design:paramtypes",[Object]),n("design:returntype",void 0)],t.prototype,"handleClick",null),o([d,n("design:type",Function),n("design:paramtypes",[Object]),n("design:returntype",void 0)],t.prototype,"handleMouseEnter",null),o([d,n("design:type",Function),n("design:paramtypes",[Object]),n("design:returntype",void 0)],t.prototype,"handleMouseLeave",null),o([d,n("design:type",Function),n("design:paramtypes",[Object]),n("design:returntype",Object)],t.prototype,"renderBody",null),o([d,n("design:type",Function),n("design:paramtypes",[Number]),n("design:returntype",void 0)],t.prototype,"switchTo",null),t}(c.Component),k=function(r){g(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t=o([x({type:"switch-container"})],t),t}(I);export{k as SwitchContainerRenderer,I as default};