katoikia-app/web-ui/web-react/node_modules/primereact/rating/rating.min.js

2 lines
5.5 KiB
JavaScript

this.primereact=this.primereact||{},this.primereact.rating=function(t,e,n,o){"use strict";function r(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var i=r(e);function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function l(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function s(t,e){return s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},s(t,e)}function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e)}function c(t){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c(t)}function f(t,e){if(e&&("object"===c(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return l(t)}function y(t){return y=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},y(t)}function h(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function d(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}function b(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?d(Object(n),!0).forEach((function(e){h(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function v(){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(t){return!1}}var m=function(t){u(m,t);var e,r,s,c,h,d=(e=m,r=v(),function(){var t,n=y(e);if(r){var o=y(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return f(this,t)});function m(t){var e;return p(this,m),(e=d.call(this,t)).clear=e.clear.bind(l(e)),e.onStarKeyDown=e.onStarKeyDown.bind(l(e)),e.onCancelKeyDown=e.onCancelKeyDown.bind(l(e)),e}return s=m,(c=[{key:"rate",value:function(t,e){this.props.readOnly||this.props.disabled||!this.props.onChange||this.props.onChange({originalEvent:t,value:e,stopPropagation:function(){},preventDefault:function(){},target:{name:this.props.name,id:this.props.id,value:e}}),t.preventDefault()}},{key:"clear",value:function(t){this.props.readOnly||this.props.disabled||!this.props.onChange||this.props.onChange({originalEvent:t,value:null,stopPropagation:function(){},preventDefault:function(){},target:{name:this.props.name,id:this.props.id,value:null}}),t.preventDefault()}},{key:"shouldComponentUpdate",value:function(t,e){return t.value!==this.props.value||t.disabled!==this.props.disabled}},{key:"onStarKeyDown",value:function(t,e){"Enter"===t.key&&this.rate(t,e)}},{key:"onCancelKeyDown",value:function(t){"Enter"===t.key&&this.clear(t)}},{key:"getFocusIndex",value:function(){return this.props.disabled||this.props.readOnly?null:0}},{key:"componentDidMount",value:function(){this.props.tooltip&&this.renderTooltip()}},{key:"componentDidUpdate",value:function(t){t.tooltip===this.props.tooltip&&t.tooltipOptions===this.props.tooltipOptions||(this.tooltip?this.tooltip.update(b({content:this.props.tooltip},this.props.tooltipOptions||{})):this.renderTooltip())}},{key:"componentWillUnmount",value:function(){this.tooltip&&(this.tooltip.destroy(),this.tooltip=null)}},{key:"renderTooltip",value:function(){this.tooltip=o.tip({target:this.element,content:this.props.tooltip,options:this.props.tooltipOptions})}},{key:"renderStars",value:function(){for(var t=this,e=[],o=0;o<this.props.stars;o++)e[o]=o+1;return e.map((function(e){var o=n.classNames("p-rating-icon",{"pi pi-star":!t.props.value||e>t.props.value,"pi pi-star-fill":e<=t.props.value});return i.default.createElement("span",{className:o,onClick:function(n){return t.rate(n,e)},key:e,tabIndex:t.getFocusIndex(),onKeyDown:function(n){return t.onStarKeyDown(n,e)}})}))}},{key:"renderCancelIcon",value:function(){return this.props.cancel?i.default.createElement("span",{className:"p-rating-icon p-rating-cancel pi pi-ban",onClick:this.clear,tabIndex:this.getFocusIndex(),onKeyDown:this.onCancelKeyDown}):null}},{key:"render",value:function(){var t=this,e=n.classNames("p-rating",{"p-disabled":this.props.disabled,"p-rating-readonly":this.props.readOnly},this.props.className),o=this.renderCancelIcon(),r=this.renderStars();return i.default.createElement("div",{ref:function(e){return t.element=e},id:this.props.id,className:e,style:this.props.style},o,r)}}])&&a(s.prototype,c),h&&a(s,h),Object.defineProperty(s,"prototype",{writable:!1}),m}(e.Component);return h(m,"defaultProps",{id:null,value:null,disabled:!1,readOnly:!1,stars:5,cancel:!0,style:null,className:null,tooltip:null,tooltipOptions:null,onChange:null}),t.Rating=m,Object.defineProperty(t,"__esModule",{value:!0}),t}({},React,primereact.utils,primereact.tooltip);