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

2 lines
9.6 KiB
JavaScript

this.primereact=this.primereact||{},this.primereact.selectbutton=function(t,e,n,o,r){"use strict";function i(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var l=i(e);function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n<e;n++)o[n]=t[n];return o}function a(t){if(Array.isArray(t))return s(t)}function p(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function u(t,e){if(t){if("string"==typeof t)return s(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(t,e):void 0}}function c(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function f(t){return a(t)||p(t)||u(t)||c()}function h(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function d(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function b(t,e,n){return e&&d(t.prototype,e),n&&d(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function y(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function v(t,e){return v=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},v(t,e)}function m(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&&v(t,e)}function O(t){return O="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},O(t)}function g(t,e){if(e&&("object"===O(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return y(t)}function j(t){return j=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},j(t)}function k(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function w(){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 D=function(t){m(s,t);var e,r,i=(e=s,r=w(),function(){var t,n=j(e);if(r){var o=j(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return g(this,t)});function s(t){var e;return h(this,s),(e=i.call(this,t)).state={focused:!1},e.onClick=e.onClick.bind(y(e)),e.onFocus=e.onFocus.bind(y(e)),e.onBlur=e.onBlur.bind(y(e)),e.onKeyDown=e.onKeyDown.bind(y(e)),e}return b(s,[{key:"onClick",value:function(t){this.props.onClick&&this.props.onClick({originalEvent:t,option:this.props.option})}},{key:"onFocus",value:function(){this.setState({focused:!0})}},{key:"onBlur",value:function(){this.setState({focused:!1})}},{key:"onKeyDown",value:function(t){var e=t.which;32!==e&&13!==e||(this.onClick(t),t.preventDefault())}},{key:"renderContent",value:function(){return this.props.template?this.props.template(this.props.option):l.default.createElement("span",{className:"p-button-label p-c"},this.props.label)}},{key:"render",value:function(){var t=n.classNames("p-button p-component",{"p-highlight":this.props.selected,"p-disabled":this.props.disabled,"p-focus":this.state.focused},this.props.className),e=this.renderContent();return l.default.createElement("div",{className:t,role:"button","aria-label":this.props.label,"aria-pressed":this.props.selected,"aria-labelledby":this.props.ariaLabelledBy,onClick:this.onClick,onKeyDown:this.onKeyDown,tabIndex:this.props.tabIndex,onFocus:this.onFocus,onBlur:this.onBlur},e,!this.props.disabled&&l.default.createElement(o.Ripple,null))}}]),s}(e.Component);function C(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}function S(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?C(Object(n),!0).forEach((function(e){k(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):C(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function P(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=E(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var o=0,r=function(){};return{s:r,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,l=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return l=t.done,t},e:function(t){s=!0,i=t},f:function(){try{l||null==n.return||n.return()}finally{if(s)throw i}}}}function E(t,e){if(t){if("string"==typeof t)return B(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?B(t,e):void 0}}function B(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n<e;n++)o[n]=t[n];return o}function A(){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}}k(D,"defaultProps",{option:null,label:null,className:null,selected:null,tabIndex:null,ariaLabelledBy:null,template:null,onClick:null});var I=function(t){m(s,t);var e,o,i=(e=s,o=A(),function(){var t,n=j(e);if(o){var r=j(this).constructor;t=Reflect.construct(n,arguments,r)}else t=n.apply(this,arguments);return g(this,t)});function s(t){var e;return h(this,s),(e=i.call(this,t)).onOptionClick=e.onOptionClick.bind(y(e)),e}return b(s,[{key:"onOptionClick",value:function(t){var e=this;if(!this.props.disabled&&!this.isOptionDisabled(t.option)){var o=this.isSelected(t.option);if(!o||this.props.unselectable){var r,i=this.getOptionValue(t.option);if(this.props.multiple){var l=this.props.value?f(this.props.value):[];r=o?l.filter((function(t){return!n.ObjectUtils.equals(t,i,e.props.dataKey)})):[].concat(f(l),[i])}else r=o?null:i;this.props.onChange&&this.props.onChange({originalEvent:t.originalEvent,value:r,stopPropagation:function(){},preventDefault:function(){},target:{name:this.props.name,id:this.props.id,value:r}})}}}},{key:"getOptionLabel",value:function(t){return this.props.optionLabel?n.ObjectUtils.resolveFieldData(t,this.props.optionLabel):t&&void 0!==t.label?t.label:t}},{key:"getOptionValue",value:function(t){return this.props.optionValue?n.ObjectUtils.resolveFieldData(t,this.props.optionValue):t&&void 0!==t.value?t.value:t}},{key:"isOptionDisabled",value:function(t){return this.props.optionDisabled?n.ObjectUtils.isFunction(this.props.optionDisabled)?this.props.optionDisabled(t):n.ObjectUtils.resolveFieldData(t,this.props.optionDisabled):!(!t||void 0===t.disabled)&&t.disabled}},{key:"isSelected",value:function(t){var e=!1,o=this.getOptionValue(t);if(this.props.multiple){if(this.props.value&&this.props.value.length){var r,i=P(this.props.value);try{for(i.s();!(r=i.n()).done;){if(n.ObjectUtils.equals(r.value,o,this.props.dataKey)){e=!0;break}}}catch(t){i.e(t)}finally{i.f()}}}else e=n.ObjectUtils.equals(this.props.value,o,this.props.dataKey);return e}},{key:"componentDidMount",value:function(){this.props.tooltip&&this.renderTooltip()}},{key:"componentDidUpdate",value:function(t){t.tooltip===this.props.tooltip&&t.tooltipOptions===this.props.tooltipOptions||(this.tooltip?this.tooltip.update(S({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=r.tip({target:this.element,content:this.props.tooltip,options:this.props.tooltipOptions})}},{key:"renderItems",value:function(){var t=this;return this.props.options&&this.props.options.length?this.props.options.map((function(e,n){var o=t.props.disabled||t.isOptionDisabled(e),r=t.getOptionLabel(e),i=o?null:0;return l.default.createElement(D,{key:"".concat(r,"_").concat(n),label:r,className:e.className,option:e,onClick:t.onOptionClick,template:t.props.itemTemplate,selected:t.isSelected(e),tabIndex:i,disabled:o,ariaLabelledBy:t.props.ariaLabelledBy})})):null}},{key:"render",value:function(){var t=this,e=n.classNames("p-selectbutton p-buttonset p-component",this.props.className),o=this.renderItems();return l.default.createElement("div",{id:this.props.id,ref:function(e){return t.element=e},className:e,style:this.props.style,role:"group"},o)}}]),s}(e.Component);return k(I,"defaultProps",{id:null,value:null,options:null,optionLabel:null,optionValue:null,optionDisabled:null,tabIndex:null,multiple:!1,unselectable:!0,disabled:!1,style:null,className:null,dataKey:null,tooltip:null,tooltipOptions:null,ariaLabelledBy:null,itemTemplate:null,onChange:null}),t.SelectButton=I,Object.defineProperty(t,"__esModule",{value:!0}),t}({},React,primereact.utils,primereact.ripple,primereact.tooltip);