2 lines
3.7 KiB
JavaScript
2 lines
3.7 KiB
JavaScript
import e,{Component as r}from"react";import{classNames as t}from"primereact/utils";function o(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function n(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function a(e,r){return a=Object.setPrototypeOf||function(e,r){return e.__proto__=r,e},a(e,r)}function i(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),r&&a(e,r)}function s(e){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}function l(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e,r){if(r&&("object"===s(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return l(e)}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var f,m,d,y=function(a){i(b,r);var s,l,f,m,d,y=(s=b,l=c(),function(){var e,r=u(s);if(l){var t=u(this).constructor;e=Reflect.construct(r,arguments,t)}else e=r.apply(this,arguments);return p(this,e)});function b(){return o(this,b),y.apply(this,arguments)}return f=b,(m=[{key:"renderLabel",value:function(){if(this.props.showValue&&null!=this.props.value){var r=this.props.displayValueTemplate?this.props.displayValueTemplate(this.props.value):this.props.value+this.props.unit;return e.createElement("div",{className:"p-progressbar-label"},r)}return null}},{key:"renderDeterminate",value:function(){var r=t("p-progressbar p-component p-progressbar-determinate",this.props.className),o=this.renderLabel();return e.createElement("div",{role:"progressbar",id:this.props.id,className:r,style:this.props.style,"aria-valuemin":"0","aria-valuenow":this.props.value,"aria-valuemax":"100","aria-label":this.props.value},e.createElement("div",{className:"p-progressbar-value p-progressbar-value-animate",style:{width:this.props.value+"%",display:"block",backgroundColor:this.props.color}}),o)}},{key:"renderIndeterminate",value:function(){var r=t("p-progressbar p-component p-progressbar-indeterminate",this.props.className);return e.createElement("div",{role:"progressbar",id:this.props.id,className:r,style:this.props.style},e.createElement("div",{className:"p-progressbar-indeterminate-container"},e.createElement("div",{className:"p-progressbar-value p-progressbar-value-animate",style:{backgroundColor:this.props.color}})))}},{key:"render",value:function(){if("determinate"===this.props.mode)return this.renderDeterminate();if("indeterminate"===this.props.mode)return this.renderIndeterminate();throw new Error(this.props.mode+" is not a valid mode for the ProgressBar. Valid values are 'determinate' and 'indeterminate'")}}])&&n(f.prototype,m),d&&n(f,d),Object.defineProperty(f,"prototype",{writable:!1}),b}();d={id:null,value:null,showValue:!0,unit:"%",style:null,className:null,mode:"determinate",displayValueTemplate:null,color:null},(m="defaultProps")in(f=y)?Object.defineProperty(f,m,{value:d,enumerable:!0,configurable:!0,writable:!0}):f[m]=d;export{y as ProgressBar};
|