2 lines
5.7 KiB
JavaScript
2 lines
5.7 KiB
JavaScript
this.primereact=this.primereact||{},this.primereact.fieldset=function(e,t,n,r,o){"use strict";function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=l(t);function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function p(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function c(e,t){return c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},c(e,t)}function u(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&&c(e,t)}function f(e){return f="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},f(e)}function d(e,t){if(t&&("object"===f(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return p(e)}function g(e){return g=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},g(e)}function h(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function b(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?y(Object(n),!0).forEach((function(t){h(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return 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 v=function(e){u(v,e);var t,l,c,f,h,y=(t=v,l=m(),function(){var e,n=g(t);if(l){var r=g(this).constructor;e=Reflect.construct(n,arguments,r)}else e=n.apply(this,arguments);return d(this,e)});function v(e){var t;s(this,v),t=y.call(this,e);var n={id:e.id};return t.props.onToggle||(n=b(b({},n),{},{collapsed:e.collapsed})),t.state=n,t.toggle=t.toggle.bind(p(t)),t.contentRef=i.default.createRef(),t}return c=v,(f=[{key:"toggle",value:function(e){if(this.props.toggleable){var t=this.props.onToggle?this.props.collapsed:this.state.collapsed;t?this.expand(e):this.collapse(e),this.props.onToggle&&this.props.onToggle({originalEvent:e,value:!t})}e.preventDefault()}},{key:"expand",value:function(e){this.props.onToggle||this.setState({collapsed:!1}),this.props.onExpand&&this.props.onExpand(e)}},{key:"collapse",value:function(e){this.props.onToggle||this.setState({collapsed:!0}),this.props.onCollapse&&this.props.onCollapse(e)}},{key:"isCollapsed",value:function(){return!!this.props.toggleable&&(this.props.onToggle?this.props.collapsed:this.state.collapsed)}},{key:"componentDidMount",value:function(){this.state.id||this.setState({id:n.UniqueComponentId()})}},{key:"renderContent",value:function(e){return i.default.createElement(r.CSSTransition,{nodeRef:this.contentRef,classNames:"p-toggleable-content",timeout:{enter:1e3,exit:450},in:!e,unmountOnExit:!0,options:this.props.transitionOptions},i.default.createElement("div",{ref:this.contentRef,id:this.state.id+"_content",className:"p-toggleable-content","aria-hidden":e,role:"region","aria-labelledby":this.state.id+"_header"},i.default.createElement("div",{className:"p-fieldset-content"},this.props.children)))}},{key:"renderToggleIcon",value:function(e){if(this.props.toggleable){var t=n.classNames("p-fieldset-toggler pi",{"pi-plus":e,"pi-minus":!e});return i.default.createElement("span",{className:t})}return null}},{key:"renderLegendContent",value:function(e){if(this.props.toggleable){var t=this.renderToggleIcon(e),n=this.state.id+"_content";return i.default.createElement("a",{href:"#"+n,"aria-controls":n,id:this.state.id+"_header","aria-expanded":!e,tabIndex:this.props.toggleable?null:-1},t,i.default.createElement("span",{className:"p-fieldset-legend-text"},this.props.legend),i.default.createElement(o.Ripple,null))}return i.default.createElement("span",{className:"p-fieldset-legend-text",id:this.state.id+"_header"},this.props.legend)}},{key:"renderLegend",value:function(e){var t=this.renderLegendContent(e);if(null!=this.props.legend||this.props.toggleable)return i.default.createElement("legend",{className:"p-fieldset-legend p-unselectable-text",onClick:this.toggle},t)}},{key:"render",value:function(){var e=n.classNames("p-fieldset p-component",this.props.className,{"p-fieldset-toggleable":this.props.toggleable}),t=this.isCollapsed(),r=this.renderLegend(t),o=this.renderContent(t);return i.default.createElement("fieldset",{id:this.props.id,className:e,style:this.props.style,onClick:this.props.onClick},r,o)}}])&&a(c.prototype,f),h&&a(c,h),Object.defineProperty(c,"prototype",{writable:!1}),v}(t.Component);return h(v,"defaultProps",{id:null,legend:null,className:null,style:null,toggleable:null,collapsed:null,transitionOptions:null,onExpand:null,onCollapse:null,onToggle:null,onClick:null}),e.Fieldset=v,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.utils,primereact.csstransition,primereact.ripple);
|