2 lines
3.7 KiB
JavaScript
2 lines
3.7 KiB
JavaScript
|
this.primereact=this.primereact||{},this.primereact.chip=function(e,t,o){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=r(t);function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e,t){return l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},l(e,t)}function p(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}function u(e){return u="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},u(e)}function a(e,t){if(t&&("object"===u(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return c(e)}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}function y(){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 h,m,b,v=function(e){p(b,e);var t,r,l,u,h,m=(t=b,r=y(),function(){var e,o=f(t);if(r){var n=f(this).constructor;e=Reflect.construct(o,arguments,n)}else e=o.apply(this,arguments);return a(this,e)});function b(e){var t;return i(this,b),(t=m.call(this,e)).state={visible:!0},t.close=t.close.bind(c(t)),t.onKeyDown=t.onKeyDown.bind(c(t)),t}return l=b,(u=[{key:"onKeyDown",value:function(e){13===e.keyCode&&this.close(e)}},{key:"close",value:function(e){var t=this;e.persist(),this.setState({visible:!1},(function(){t.props.onRemove&&t.props.onRemove(e)}))}},{key:"renderContent",value:function(){var e=this,t=[];return this.props.image?t.push(n.default.createElement("img",{key:"image",src:this.props.image,alt:this.props.imageAlt,onError:function(t){e.props.onImageError&&e.props.onImageError(t)}})):this.props.icon&&t.push(o.IconUtils.getJSXIcon(this.props.icon,{key:"icon",className:"p-chip-icon"},{props:this.props})),this.props.label&&t.push(n.default.createElement("span",{key:"label",className:"p-chip-text"},this.props.label)),this.props.removable&&t.push(o.IconUtils.getJSXIcon(this.props.removeIcon,{key:"removeIcon",tabIndex:0,className:"p-chip-remove-icon",onClick:this.close,onKeyDown:this.onKeyDown},{props:this.props})),t}},{key:"renderElement",value:function(){var e=o.classNames("p-chip p-component",{"p-chip-image":null!=this.props.image},this.props.className),t=this.props.template?o.ObjectUtils.getJSXElement(this.props.template,this.props):this.renderContent();return n.default.createElement("div",{className:e,style:this.props.style},t)}},{key:"render",value:function(){return this.state.visible&&this.renderElement()}}])&&s(l.prototype,u),h&&s(l,h),Object.defineProperty(l,"prototype",{writable:!1}),b}(t.Component);return b={label:null,icon:null,image:null,removable:!1,removeIcon:"pi pi-times-circle",className:null,style:null,template:null,imageAlt:"chip",onImageError:null,onRemove:null},(m="defaultProps")in(h=v)?Object.defineProperty(h,m,{value:b,enumerable:!0,configurable:!0,writable:!0}):h[m]=b,e.Chip=v,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.utils);
|