InputRating-DggSgPZ3.js 2.6 KB

1
  1. import{s as b,aF as w,E as F,G as O,f as m,bI as N,z as g,P as S,Q as v,aX as H,bJ as z,K as I,a1 as T,ah as j}from"./index-DT8qTvyx.js";var A=function(n){b(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.doAction=function(e,o,l){var s,a,i=e==null?void 0:e.actionType,c=this.props,r=c.onChange,p=c.resetValue,d=c.formStore,h=c.store,C=c.name;if(i==="clear")r==null||r("");else if(i==="reset"){var u=(a=w((s=d==null?void 0:d.pristine)!==null&&s!==void 0?s:h==null?void 0:h.pristine,C))!==null&&a!==void 0?a:p;r==null||r(u??"")}},t.prototype.handleChange=function(e){return F(this,void 0,void 0,function(){var o,l,s,a;return O(this,function(i){switch(i.label){case 0:return o=this.props,l=o.onChange,s=o.dispatchEvent,[4,s("change",j(this.props,{value:e}))];case 1:return a=i.sent(),a!=null&&a.prevented?[2]:(l==null||l(e),[2])}})})},t.prototype.renderStatic=function(){var e=this.props,o=e.className;e.style;var l=e.value,s=e.count,a=e.half,i=e.char,c=e.inactiveColor,r=e.colors,p=e.texts,d=e.charClassName,h=e.textClassName,C=e.textPosition,u=e.classnames;return m.createElement("div",{className:u("RatingControl",o)},m.createElement(N,{classnames:u,value:l,disabled:!0,count:s,half:a,char:i,inactiveColor:c,colors:r,texts:p,charClassName:d,textClassName:h,textPosition:C}))},t.prototype.render=function(){var e=this.props,o=e.className,l=e.value,s=e.count,a=e.half,i=e.readOnly,c=e.disabled,r=e.onHoverChange,p=e.allowClear,d=e.char,h=e.inactiveColor,C=e.colors,u=e.texts,_=e.charClassName,E=e.textClassName,P=e.textPosition,y=e.classnames,f=x(s,this.props.data);return f>100&&(f=100),m.createElement("div",{className:y("RatingControl",o)},m.createElement(N,{classnames:y,value:l,disabled:c,count:f,half:a,allowClear:p,readOnly:i,char:d,inactiveColor:h,colors:C,texts:u,charClassName:_,textClassName:E,textPosition:P,onChange:this.handleChange,onHoverChange:function(R){r&&r(R)}}))},t.defaultProps={value:0,count:5,half:!1,readOnly:!1},g([S,v("design:type",Function),v("design:paramtypes",[Object]),v("design:returntype",Promise)],t.prototype,"handleChange",null),g([H(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",void 0)],t.prototype,"render",null),t}(m.Component);function x(n,t){return typeof n=="number"?n:z(I(n,t))}var G=function(n){b(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t=g([T({type:"input-rating",sizeMutable:!1,shouldComponentUpdate:function(e,o){return x(e.count,e.data)!==x(o.count,o.data)},detectProps:["half","allowClear","colors","inactiveColor","texts","textPosition","char"]})],t),t}(A);export{G as RatingControlRenderer,A as default};