katoikia-app/web-ui/web-react/node_modules/primereact/multistatecheckbox/multistatecheckbox.min.js

2 lines
6.5 KiB
JavaScript

this.primereact=this.primereact||{},this.primereact.multistatecheckbox=function(t,e,o,n){"use strict";function i(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var r=i(e);function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var o=0;o<e.length;o++){var n=e[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function l(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function u(t,e){return u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},u(t,e)}function c(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&u(t,e)}function a(t){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a(t)}function f(t,e){if(e&&("object"===a(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return l(t)}function h(t){return h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},h(t)}function d(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function y(t,e){var o=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),o.push.apply(o,n)}return o}function b(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{};e%2?y(Object(o),!0).forEach((function(e){d(t,e,o[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):y(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}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(t){return!1}}var v=function(t){c(g,t);var i,u,a,y,v,O=(i=g,u=m(),function(){var t,e=h(i);if(u){var o=h(this).constructor;t=Reflect.construct(e,arguments,o)}else t=e.apply(this,arguments);return f(this,t)});function g(t){var o;return p(this,g),(o=O.call(this,t)).state={focused:!1},o.onClick=o.onClick.bind(l(o)),o.onFocus=o.onFocus.bind(l(o)),o.onBlur=o.onBlur.bind(l(o)),o.inputRef=e.createRef(o.props.inputRef),o}return a=g,(y=[{key:"onClick",value:function(t){this.props.disabled||this.props.readOnly||(this.toggle(t),this.inputRef.current.focus())}},{key:"getOptionValue",value:function(t){return this.props.optionValue?o.ObjectUtils.resolveFieldData(t,this.props.optionValue):t}},{key:"equalityKey",value:function(){return this.props.optionValue?null:this.props.dataKey}},{key:"findSelectedOptionMap",value:function(){var t,e,n=this;if(this.props.options){var i=this.equalityKey();e=this.props.options.findIndex((function(t){return o.ObjectUtils.equals(n.props.value,n.getOptionValue(t),i)})),t=this.props.options[e]}return{option:t,index:e}}},{key:"findNextOption",value:function(){if(this.props.options){var t=this.findSelectedOptionMap().index;return t===this.props.options.length-1?this.props.empty?null:this.props.options[0]:this.props.options[t+1]}return null}},{key:"toggle",value:function(t){var e=this.getOptionValue(this.findNextOption());this.props.onChange&&this.props.onChange({originalEvent:t,value:e,stopPropagation:function(){},preventDefault:function(){},target:{name:this.props.name,id:this.props.id,value:e}})}},{key:"onFocus",value:function(){this.setState({focused:!0})}},{key:"onBlur",value:function(){this.setState({focused:!1})}},{key:"updateInputRef",value:function(){var t=this.props.inputRef;t&&("function"==typeof t?t(this.inputRef.current):t.current=this.inputRef.current)}},{key:"componentDidMount",value:function(){this.updateInputRef(),this.props.tooltip&&!this.props.disabled&&this.renderTooltip(),this.props.empty||null!==this.props.value||this.toggle()}},{key:"componentDidUpdate",value:function(t){t.tooltip===this.props.tooltip&&t.tooltipOptions===this.props.tooltipOptions||(this.tooltip?this.tooltip.update(b({content:this.props.tooltip},this.props.tooltipOptions||{})):this.renderTooltip())}},{key:"componentWillUnmount",value:function(){this.tooltip&&(this.tooltip.destroy(),this.tooltip=null)}},{key:"renderTooltip",value:function(){this.tooltip=n.tip({target:this.element,content:this.props.tooltip,options:this.props.tooltipOptions})}},{key:"renderIcon",value:function(t){var e=o.classNames("p-checkbox-icon p-c",d({},"".concat(t&&t.icon||""),!0)),n=r.default.createElement("span",{className:e});return this.props.iconTemplate?o.ObjectUtils.getJSXElement(this.props.iconTemplate,{option:t,className:e,element:n,props:this.props}):n}},{key:"render",value:function(){var t=this,e=this.findSelectedOptionMap().option,n=o.classNames("p-multistatecheckbox p-checkbox p-component",this.props.className),i=o.classNames("p-checkbox-box",{"p-highlight":!!e,"p-disabled":this.props.disabled,"p-focus":this.state.focused},e&&e.className),p=this.renderIcon(e);return r.default.createElement("div",{ref:function(e){return t.element=e},id:this.props.id,className:n,style:this.props.style,onClick:this.onClick},r.default.createElement("div",{className:"p-hidden-accessible"},r.default.createElement("input",{ref:this.inputRef,type:"checkbox","aria-labelledby":this.props.ariaLabelledBy,id:this.props.inputId,name:this.props.name,onFocus:this.onFocus,onBlur:this.onBlur,disabled:this.props.disabled,readOnly:this.props.readOnly,defaultChecked:!!e})),r.default.createElement("div",{className:i,ref:function(e){return t.box=e},role:"checkbox","aria-checked":!!e,style:e&&e.style},p))}}])&&s(a.prototype,y),v&&s(a,v),Object.defineProperty(a,"prototype",{writable:!1}),g}(e.Component);return d(v,"defaultProps",{id:null,inputRef:null,inputId:null,value:null,options:null,optionValue:null,iconTemplate:null,dataKey:null,name:null,style:null,className:null,disabled:!1,readOnly:!1,empty:!0,tooltip:null,tooltipOptions:null,ariaLabelledBy:null,onChange:null}),t.MultiStateCheckbox=v,Object.defineProperty(t,"__esModule",{value:!0}),t}({},React,primereact.utils,primereact.tooltip);