honkoma/priv/static/packs/features/list_editor.js

2 lines
5.0 KiB
JavaScript

(window.webpackJsonp=window.webpackJsonp||[]).push([[31],{715:function(e,t,a){"use strict";a.r(t);var n,c,i,o,r,s,u,d=a(1),l=a(6),b=a(2),p=a(3),f=a.n(p),j=a(5),O=a.n(j),v=a(26),m=a.n(v),h=a(20),g=a(24),_=a(7),y=a(34),I=a(154),R=a(140),C=a(141),N=a(63),w=Object(_.f)({remove:{id:"lists.account.remove",defaultMessage:"Remove from list"},add:{id:"lists.account.add",defaultMessage:"Add to list"}}),q=Object(h.connect)(function(){var c=Object(I.d)();return function(e,t){var a=t.accountId,n=t.added;return{account:c(e,a),added:void 0===n?e.getIn(["listEditor","accounts","items"]).includes(a):n}}},function(e,t){var a=t.accountId;return{onRemove:function(){return e(Object(y.K)(a))},onAdd:function(){return e(Object(y.B)(a))}}})(n=Object(_.g)((i=c=function(e){function t(){return e.apply(this,arguments)||this}return Object(l.a)(t,e),t.prototype.render=function(){var e,t=this.props,a=t.account,n=t.intl,c=t.onRemove,i=t.onAdd;return e=t.added?Object(d.a)(N.a,{icon:"times",title:n.formatMessage(w.remove),onClick:c}):Object(d.a)(N.a,{icon:"plus",title:n.formatMessage(w.add),onClick:i}),Object(d.a)("div",{className:"account"},void 0,Object(d.a)("div",{className:"account__wrapper"},void 0,Object(d.a)("div",{className:"account__display-name"},void 0,Object(d.a)("div",{className:"account__avatar-wrapper"},void 0,Object(d.a)(R.a,{account:a,size:36})),Object(d.a)(C.a,{account:a})),Object(d.a)("div",{className:"account__relationship"},void 0,e)))},t}(g.a),Object(b.a)(c,"propTypes",{account:m.a.map.isRequired,intl:O.a.object.isRequired,onRemove:O.a.func.isRequired,onAdd:O.a.func.isRequired,added:O.a.bool}),Object(b.a)(c,"defaultProps",{added:!1}),n=i))||n)||n,M=a(0),k=a(12),A=a.n(k),E=Object(_.f)({search:{id:"lists.search",defaultMessage:"Search among people you follow"}}),x=Object(h.connect)(function(e){return{value:e.getIn(["listEditor","suggestions","value"])}},function(t){return{onSubmit:function(e){return t(Object(y.H)(e))},onClear:function(){return t(Object(y.E)())},onChange:function(e){return t(Object(y.D)(e))}}})(o=Object(_.g)(o=function(c){function e(){for(var t,e=arguments.length,a=new Array(e),n=0;n<e;n++)a[n]=arguments[n];return t=c.call.apply(c,[this].concat(a))||this,Object(b.a)(Object(M.a)(Object(M.a)(t)),"handleChange",function(e){t.props.onChange(e.target.value)}),Object(b.a)(Object(M.a)(Object(M.a)(t)),"handleKeyUp",function(e){13===e.keyCode&&t.props.onSubmit(t.props.value)}),Object(b.a)(Object(M.a)(Object(M.a)(t)),"handleClear",function(){t.props.onClear()}),t}return Object(l.a)(e,c),e.prototype.render=function(){var e=this.props,t=e.value,a=e.intl,n=0<t.length;return Object(d.a)("div",{className:"list-editor__search search"},void 0,Object(d.a)("label",{},void 0,Object(d.a)("span",{style:{display:"none"}},void 0,a.formatMessage(E.search)),Object(d.a)("input",{className:"search__input",type:"text",value:t,onChange:this.handleChange,onKeyUp:this.handleKeyUp,placeholder:a.formatMessage(E.search)})),Object(d.a)("div",{role:"button",tabIndex:"0",className:"search__icon",onClick:this.handleClear},void 0,Object(d.a)("i",{className:A()("fa fa-search",{active:!n})}),Object(d.a)("i",{"aria-label":a.formatMessage(E.search),className:A()("fa fa-times-circle",{active:n})})))},e}(f.a.PureComponent))||o)||o,z=a(139),K=a(45),S=a.n(K);a.d(t,"default",function(){return U});var U=Object(h.connect)(function(e){return{title:e.getIn(["listEditor","title"]),accountIds:e.getIn(["listEditor","accounts","items"]),searchAccountIds:e.getIn(["listEditor","suggestions","items"])}},function(t){return{onInitialize:function(e){return t(Object(y.O)(e))},onClear:function(){return t(Object(y.E)())},onReset:function(){return t(Object(y.M)())}}})(r=Object(_.g)((u=s=function(e){function t(){return e.apply(this,arguments)||this}Object(l.a)(t,e);var a=t.prototype;return a.componentDidMount=function(){var e=this.props;(0,e.onInitialize)(e.listId)},a.componentWillUnmount=function(){(0,this.props.onReset)()},a.render=function(){var e=this.props,t=e.title,a=e.accountIds,n=e.searchAccountIds,c=e.onClear,i=0<n.size;return Object(d.a)("div",{className:"modal-root__modal list-editor"},void 0,Object(d.a)("h4",{},void 0,t),Object(d.a)(x,{}),Object(d.a)("div",{className:"drawer__pager"},void 0,Object(d.a)("div",{className:"drawer__inner list-editor__accounts"},void 0,a.map(function(e){return Object(d.a)(q,{accountId:e,added:!0},e)})),i&&Object(d.a)("div",{role:"button",tabIndex:"-1",className:"drawer__backdrop",onClick:c}),Object(d.a)(z.a,{defaultStyle:{x:-100},style:{x:S()(i?0:-100,{stiffness:210,damping:20})}},void 0,function(e){var t=e.x;return Object(d.a)("div",{className:"drawer__inner backdrop",style:{transform:0===t?null:"translateX("+t+"%)",visibility:-100===t?"hidden":"visible"}},void 0,n.map(function(e){return Object(d.a)(q,{accountId:e},e)}))})))},t}(g.a),Object(b.a)(s,"propTypes",{listId:O.a.string.isRequired,onClose:O.a.func.isRequired,intl:O.a.object.isRequired,onInitialize:O.a.func.isRequired,onClear:O.a.func.isRequired,onReset:O.a.func.isRequired,title:O.a.string.isRequired,accountIds:m.a.list.isRequired,searchAccountIds:m.a.list.isRequired}),r=u))||r)||r}}]);
//# sourceMappingURL=list_editor.js.map