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