2 lines
3.7 KiB
JavaScript
2 lines
3.7 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 s(e){return s="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},s(e)}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e,t){if(t&&("object"===s(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 u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function f(){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 m,y,d,b=function(l){a(h,t);var s,c,m,y,d,b=(s=h,c=f(),function(){var e,t=u(s);if(c){var r=u(this).constructor;e=Reflect.construct(t,arguments,r)}else e=t.apply(this,arguments);return p(this,e)});function h(){return o(this,h),b.apply(this,arguments)}return m=h,(y=[{key:"itemClick",value:function(e,t,r){this.props.readOnly||t.disabled?e.preventDefault():(this.props.onSelect&&this.props.onSelect({originalEvent:e,item:t,index:r}),t.url||e.preventDefault(),t.command&&t.command({originalEvent:e,item:t,index:r}))}},{key:"renderItem",value:function(t,o){var i=this,l=o===this.props.activeIndex,a=t.disabled||o!==this.props.activeIndex&&this.props.readOnly,s=r("p-steps-item",t.className,{"p-highlight p-steps-current":l,"p-disabled":a}),c=t.label&&e.createElement("span",{className:"p-steps-title"},t.label),p=a?-1:"",u=e.createElement("a",{href:t.url||"#",className:"p-menuitem-link",role:"presentation",target:t.target,onClick:function(e){return i.itemClick(e,t,o)},tabIndex:p,"aria-disabled":a},e.createElement("span",{className:"p-steps-number"},o+1),c);return t.template&&(u=n.getJSXElement(t.template,t,{onClick:function(e){return i.itemClick(e,t,o)},className:"p-menuitem-link",labelClassName:"p-steps-title",numberClassName:"p-steps-number",element:u,props:this.props,tabIndex:p,active:l,disabled:a})),e.createElement("li",{key:t.label+"_"+o,className:s,style:t.style,role:"tab","aria-selected":l,"aria-expanded":l},u)}},{key:"renderItems",value:function(){var t=this;if(this.props.model){var r=this.props.model.map((function(e,r){return t.renderItem(e,r)}));return e.createElement("ul",{role:"tablist"},r)}return null}},{key:"render",value:function(){var t=r("p-steps p-component",this.props.className,{"p-readonly":this.props.readOnly}),n=this.renderItems();return e.createElement("div",{id:this.props.id,className:t,style:this.props.style},n)}}])&&i(m.prototype,y),d&&i(m,d),Object.defineProperty(m,"prototype",{writable:!1}),h}();d={id:null,model:null,activeIndex:0,readOnly:!0,style:null,className:null,onSelect:null},(y="defaultProps")in(m=b)?Object.defineProperty(m,y,{value:d,enumerable:!0,configurable:!0,writable:!0}):m[y]=d;export{b as Steps};
|