mediacms/static/js/search.js

1 wiersz
38 KiB
JavaScript
Czysty Zwykły widok Historia

!function(){"use strict";var e={4e3:function(e,t,n){var r=n(2667),i=(n(7441),n(5101),n(2322),n(9006),n(5466)),o=n(1346),s=n(8204),a=n(4426),l=n(4830),c=n(9174),u=(n(2701),n(5261)),p=n(3074),f=n.n(p),d=n(7207),h=n(2836),m=n(2331);function y(e){return(y="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})(e)}function g(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function b(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 v(e,t,n){return t&&b(e.prototype,t),n&&b(e,n),e}function w(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}}),t&&S(e,t)}function S(e,t){return(S=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function O(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=k(e);if(t){var i=k(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return E(this,n)}}function E(e,t){return!t||"object"!==y(t)&&"function"!=typeof t?_(e):t}function _(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function k(e){return(k=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}n(8534),n(3562);var C=function(e){w(n,e);var t=O(n);function n(e){var r;return g(this,n),(r=t.call(this,e)).onSelectOption=r.onSelectOption.bind(_(r)),r}return v(n,[{key:"onSelectOption",value:function(){this.props.onSelect(this.props.id)}},{key:"render",value:function(){return i.createElement("div",{className:"media-filter-option"},i.createElement("button",{className:this.props.selected?"active":"",onClick:this.onSelectOption},this.props.label))}}]),n}(i.PureComponent),P=function(e){w(n,e);var t=O(n);function n(e){var r;return g(this,n),(r=t.call(this,e)).state={selected:r.props.default},r.onSelectOption=r.onSelectOption.bind(_(r)),r}return v(n,[{key:"onSelectOption",value:function(e){this.setState({selected:e},(function(){"function"==typeof this.props.onSelect&&this.props.onSelect(this.state.selected)}))}},{key:"renderOptions",value:function(e){for(var t=[],n=0;n<this.props.items.length;)this.props.hideOptionOnSelect?this.props.items[n].id!==e&&t.push(i.createElement(C,{key:this.props.items[n].id,id:this.props.items[n].id,label:this.props.items[n].label,selected:this.props.items[n].id===e,onSelect:this.onSelectOption})):t.push(i.createElement(C,{key:this.props.items[n].id,id:this.props.items[n].id,label:this.props.items[n].label,selected:this.props.items[n].id===e,onSelect:this.onSelectOption})),n+=1;return t}},{key:"render",value:function(){return i.createElement("div",{className:"media-filter-option-list"},this.renderOptions(this.state.selected))}}]),n}(i.PureComponent),T=function(e){w(n,e);var t=O(n);function n(e){var r;return g(this,n),(r=t.call(this,e)).state={value:r.props.default,visiblePopup:!1},r.triggerButtonDomElem=null,r.onSelectOption=r.onSelectOption.bind(_(r)),r.onPopupsDisplayChange=r.onPopupsDisplayChange.bind(_(r)),r.popup=new d.Z(i.createElement("button",{className:"popup-trigger","aria-label":"Filter"},i.createElement("span",{className:"filter-button-label"},i.createElement("span",{className:"filter-button-label-text"},r.props.label),i.createElement(m.O,{type:"arrow_drop_down"}))),i.createElement("div",{className:"main-options"},i.createElement(h.W8,null,i.createElement(P,{items:r.props.options,default:r.state.value,onSelect:r.onSelectOption,hideOptionOnSelect:r.props.hideOptionOnSelect}))),r.onPop