2 lines
5.8 KiB
JavaScript
2 lines
5.8 KiB
JavaScript
|
import t,{createRef as e,Component as o}from"react";import{classNames as r,IconUtils as n,ObjectUtils as i}from"primereact/utils";import{tip as p}from"primereact/tooltip";import{Ripple as s}from"primereact/ripple";function l(){return l=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var o=arguments[e];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(t[r]=o[r])}return t},l.apply(this,arguments)}function c(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){for(var o=0;o<e.length;o++){var r=e[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function u(t,e){return u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},u(t,e)}function f(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&&u(t,e)}function b(t){return b="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},b(t)}function h(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function d(t,e){if(e&&("object"===b(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return h(t)}function y(t){return y=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},y(t)}function m(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function g(t,e){var o=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),o.push.apply(o,r)}return o}function O(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{};e%2?g(Object(o),!0).forEach((function(e){m(t,e,o[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):g(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,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 P=function(u){f(R,o);var b,h,g,P,w,j=(b=R,h=v(),function(){var t,e=y(b);if(h){var o=y(this).constructor;t=Reflect.construct(e,arguments,o)}else t=e.apply(this,arguments);return d(this,t)});function R(t){var o;return c(this,R),(o=j.call(this,t)).elementRef=e(o.props.forwardRef),o}return g=R,(P=[{key:"updateForwardRef",value:function(){var t=this.props.forwardRef;t&&("function"==typeof t?t(this.elementRef.current):t.current=this.elementRef.current)}},{key:"isDisabled",value:function(){return this.props.disabled||this.props.loading}},{key:"componentDidMount",value:function(){this.updateForwardRef(),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(O({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=p({target:this.elementRef.current,content:this.props.tooltip,options:this.props.tooltipOptions})}},{key:"renderIcon",value:function(){var t=this.props.loading?this.props.loadingIcon:this.props.icon,e=r("p-button-icon p-c",{"p-button-loading-icon":this.props.loading,"p-button-icon-left":"left"===this.props.iconPos&&this.props.label,"p-button-icon-right":"right"===this.props.iconPos
|