2 lines
4.0 KiB
JavaScript
2 lines
4.0 KiB
JavaScript
|
import e,{Component as t}from"react";import{classNames as r,ObjectUtils as n}from"primereact/utils";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function l(e,t){return l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},l(e,t)}function a(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 c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function s(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 p(e){return p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},p(e)}function m(){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,d,y,b=function(l){a(h,t);var u,c,f,d,y,b=(u=h,c=m(),function(){var e,t=p(u);if(c){var r=p(this).constructor;e=Reflect.construct(t,arguments,r)}else e=t.apply(this,arguments);return s(this,e)});function h(){return o(this,h),b.apply(this,arguments)}return f=h,(d=[{key:"itemClick",value:function(e,t){t.disabled?e.preventDefault():(t.url||e.preventDefault(),t.command&&t.command({originalEvent:e,item:t}))}},{key:"renderHome",value:function(){var t=this;if(this.props.home){var n=r("p-breadcrumb-home",{"p-disabled":this.props.home.disabled},this.props.home.className),o=r("p-menuitem-icon",this.props.home.icon);return e.createElement("li",{className:n,style:this.props.home.style},e.createElement("a",{href:this.props.home.url||"#",className:"p-menuitem-link","aria-disabled":this.props.home.disabled,target:this.props.home.target,onClick:function(e){return t.itemClick(e,t.props.home)}},e.createElement("span",{className:o})))}return null}},{key:"renderSeparator",value:function(){return e.createElement("li",{className:"p-breadcrumb-chevron pi pi-chevron-right"})}},{key:"renderMenuitem",value:function(t){var o=this,i=r(t.className,{"p-disabled":t.disabled}),l=e.createElement("a",{href:t.url||"#",className:"p-menuitem-link",target:t.target,onClick:function(e){return o.itemClick(e,t)},"aria-disabled":t.disabled},t.label&&e.createElement("span",{className:"p-menuitem-text"},t.label));return t.template&&(l=n.getJSXElement(t.template,t,{onClick:function(e){return o.itemClick(e,t)},className:"p-menuitem-link",labelClassName:"p-menuitem-text",element:l,props:this.props})),e.createElement("li",{className:i,style:t.style},l)}},{key:"renderMenuitems",value:function(){var t=this;return this.props.model?this.props.model.map((function(r,n){var o=t.renderMenuitem(r),i=n===t.props.model.length-1?null:t.renderSeparator();return e.createElement(e.Fragment,{key:r.label+"_"+n},o,i)})):null}},{key:"render",value:function(){var t=r("p-breadcrumb p-component",this.props.className),n=this.renderHome(),o=this.renderMenuitems(),i=this.renderSeparator();return e.createElement("nav",{id:this.props.id,className:t,style:this.props.style,"aria-label":"Breadcrumb"},e.createElement("ul",null,n,i,o))}}])&&i(f.prototype,d),y&&i(f,y),Object.defineProperty(f,"prototype",{writable:!1}),h}();y={id:null,model:null,home:null,style:null,className:null},(d="defaultProps")in(f=b)?Object.defineProperty(f,d,{value:y,enumerable:!0,configurable:!0,writable:!0
|