6 lines
17 KiB
JavaScript
6 lines
17 KiB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([["context-menu-renderer"],{"+EG+":function(e,t,n){"use strict";var o,r,i,s;n.d(t,"a",function(){return i}),n.d(t,"b",function(){return s}),o=n("mrSG"),r=n("q1tI"),i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(o.__extends)(t,e),t.prototype.shouldComponentUpdate=function(){return!1},t.prototype.render=function(){return r.createElement("div",{style:{position:"fixed",zIndex:150,left:0,top:0},ref:this.props.reference})},t}(r.Component),s=r.createContext(null)},"8Rai":function(e,t,n){"use strict";function o(e){var t=e.click,n=e.mouseDown,o=e.touchEnd,a=e.touchStart,c=e.handler,u=e.ownerDocument,l=void 0===u?document:u,p=Object(r.useRef)(null),h=Object(r.useRef)(new i.CustomEvent("timestamp").timeStamp);return Object(r.useLayoutEffect)(function(){var e={click:t,mouseDown:n,touchEnd:o,touchStart:a};return Object(s.a)(h.current,p.current,c,l,e)},[t,n,o,a,c]),p}var r,i,s;n.d(t,"a",function(){return o}),r=n("q1tI"),i=n("efOF"),s=n("R5JZ")},"G/dZ":function(e,t,n){e.exports={toolbox:"toolbox-1zer1221"}},Gpmm:function(e,t,n){e.exports={row:"row-1Gn06tA2",line:"line-c_e_alAN",hint:"hint-18i4fysm"}},K5ke:function(e,t,n){e.exports={loader:"loader-3Pj8ExOX",item:"item-2n55_7om","tv-button-loader":"tv-button-loader-SKpJjjYw",black:"black-eFIQWyf4",white:"white-2Ma0ajvT",gray:"gray-24fvVR0S"}},R5JZ:function(e,t,n){"use strict";function o(e,t,n,o,r){function i(r){if(!(e>r.timeStamp)){var i=r.target;void 0!==n&&null!==t&&null!==i&&i.ownerDocument===o&&(t.contains(i)||n(r))}}return r.click&&o.addEventListener("click",i,!1),r.mouseDown&&o.addEventListener("mousedown",i,!1),r.touchEnd&&o.addEventListener("touchend",i,!1),r.touchStart&&o.addEventListener("touchstart",i,!1),function(){o.removeEventListener("click",i,!1),o.removeEventListener("mousedown",i,!1),o.removeEventListener("touchend",i,!1),o.removeEventListener("touchstart",i,!1)}}n.d(t,"a",function(){return o})},RgaO:function(e,t,n){"use strict";function o(e){var t=e.children,n=Object(r.__rest)(e,["children"]);return t(Object(i.a)(n))}var r,i;n.d(t,"a",function(){return o}),r=n("mrSG"),i=n("8Rai")},X64X:function(e,t,n){e.exports={loaderWrap:"loaderWrap-18NjkayD",loader:"loader-Cgjcl0qz"}},cbq4:function(e,t,n){"use strict";function o(e){return u.createElement("tr",{className:_.row},u.createElement("td",null,u.createElement("div",{className:_.line})),u.createElement("td",null,u.createElement("div",{className:_.line}),e.hint?u.createElement("div",{className:_.hint},e.hint):null))}function r(e){return u.createElement(E,{icon:g,onClick:e.onClick})}function i(e){return u.createElement("span",{className:v.shortcut},e.text)}function s(e){return u.createElement(O,{label:u.createElement("div",{className:I.loaderWrap},u.createElement(j.a,{className:I.loader,color:"gray"})),noInteractive:!0,onMouseOver:e.onMouseOver})}function a(e){return u.createElement(O,{label:e.label,noInteractive:!0,disabled:!0,onMouseOver:e.onMouseOver})}var c,u,l,p,h,d,m,f,_,v,b,y,S,w,E,g,C,O,x,k,N,M,I,j,T,D,L,R,W,A,P;n.r(t),
|
|
c=n("mrSG"),u=n("q1tI"),l=n("i8i4"),p=n("DTHj"),h=n("RgaO"),d=n("ycI/"),m=n("TSYQ"),f=n("zRdu"),_=n("Gpmm"),v=n("ycgn"),b=n("euMy"),y=n("hn2c"),n("bf9a"),S=n("L/Ed"),w=n("G/dZ"),E=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._handleClick=function(e){t.props.onClick(e.nativeEvent)},t}return Object(c.__extends)(t,e),t.prototype.render=function(){return u.createElement("span",{className:w.toolbox,dangerouslySetInnerHTML:{__html:this.props.icon},onClick:this._handleClick,"data-toolbox-icon":!0})},t}(u.PureComponent),g=n("PgQx"),C=n("qFKp"),O=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._handleMouseOver=function(e){var n,o,r;(n=e.nativeEvent,o=n.sourceCapabilities,void 0===(r=o&&o.firesTouchEvents)&&(r=Modernizr.touch),r)||t.props.onMouseOver&&t.props.onMouseOver()},t._handleClickToolbox=function(e){e.stopPropagation(),t.props.onClickToolbox&&t.props.onClickToolbox()},t}return Object(c.__extends)(t,e),t.prototype.render=function(){var e=this.props,t=e.hasSubItems,n=e.shortcutHint,o=e.hint;return u.createElement(u.Fragment,null,u.createElement("tr",{className:m(v.item,!this.props.noInteractive&&v.interactive,this.props.hovered&&v.hovered,this.props.disabled&&v.disabled,this.props.active&&v.active),onClick:this.props.onClick,onMouseOver:this._handleMouseOver,ref:this.props.reference,"data-action-name":this.props.actionName},u.createElement("td",{className:m(v.iconCell),"data-icon-cell":!0},this._icon()),u.createElement("td",null,u.createElement("div",{className:v.content},u.createElement("span",{className:m(v.label,this.props.checked&&v.checked),"data-label":!0},this.props.label),this._toolbox(),t&&u.createElement("span",{className:v.arrowIcon,dangerouslySetInnerHTML:{__html:y},"data-submenu-arrow":!0}),!t&&n&&!C.CheckMobile.any()&&u.createElement(i,{text:n}),!t&&!n&&o&&u.createElement(i,{text:o})))),u.createElement("tr",{className:v.subMenu},u.createElement("td",null,this.props.children)))},t.prototype._icon=function(){var e,t;return this.props.checkable?this.props.checked?(e=!this.props.icon&&!this.props.iconChecked,t=this.props.iconChecked||this.props.icon||b,u.createElement("span",{className:m(v.icon,e&&v.checkmark),dangerouslySetInnerHTML:{__html:t},"data-icon-checkmark":e})):this.props.icon?u.createElement("span",{className:v.icon,dangerouslySetInnerHTML:{__html:this.props.icon}}):u.createElement("span",{className:v.icon}):this.props.icon?u.createElement("span",{className:v.icon,dangerouslySetInnerHTML:{__html:this.props.icon}}):null},t.prototype._toolbox=function(){return this.props.toolbox?u.createElement("span",{className:m(v.toolbox,this.props.showToolboxOnHover&&v.showToolboxOnHover),onClick:this._handleClickToolbox,"data-toolbox":!0},this._renderToolboxContent()):null},t.prototype._renderToolboxContent=function(){if(this.props.toolbox)switch(this.props.toolbox.type){case S.ToolboxType.Delete:return u.createElement(r,{onClick:this.props.toolbox.action})}return null},t}(u.PureComponent),x=n("tWVy"),k=n("PC8g"),N=n("Ialn"),M=function(e){
|
|
function t(t){var n=e.call(this,t)||this;return n._itemRef=null,n._handleClick=function(e){e.isDefaultPrevented()||n.state.disabled||(n._hasSubItems()?n._showSubMenu():(n.state.doNotCloseOnClick||Object(x.b)(),n.props.action.execute(),n._trackEvent()))},n._handleClickToolbox=function(){Object(x.b)()},n._showSubMenu=function(){n.props.onShowSubMenu(n.props.action)},n._calcSubMenuPos=function(e){return function(e,t,n){var o,r,i,s,a,c,u;return void 0===n&&(n={x:0,y:10}),t?(r=(o=t.getBoundingClientRect()).left,i=o.right,s=o.top,a=document.documentElement.clientWidth,c={x:r-e,y:s},u={x:i,y:s},Object(N.isRtl)()?r<=e?u:c:a-i>=e?u:c):n}(e,n._itemRef)},n._updateState=function(e){n.setState(e.getState())},n._setItemRef=function(e){n._itemRef=e},n.state=Object(c.__assign)({},n.props.action.getState()),n}return Object(c.__extends)(t,e),t.prototype.componentDidMount=function(){this.props.action.onUpdate().subscribe(this,this._updateState)},t.prototype.componentWillUnmount=function(){this.props.action.onUpdate().unsubscribe(this,this._updateState)},t.prototype.render=function(){return u.createElement(O,Object(c.__assign)({reference:this._setItemRef,onClick:this._handleClick,onClickToolbox:this._handleClickToolbox,onMouseOver:this._showSubMenu,hovered:this.props.isSubMenuOpened,hasSubItems:this._hasSubItems(),actionName:this.state.name},this.state),u.createElement(A,{isOpened:this.props.isSubMenuOpened,items:this.state.subItems,position:this._calcSubMenuPos,menuStatName:this.props.menuStatName,parentStatName:this._getStatName()}))},t.prototype._hasSubItems=function(){return this.state.subItems.length>0},t.prototype._trackEvent=function(){var e=this._getStatName();Object(k.trackEvent)("ContextMenuClick",this.props.menuStatName||"",e)},t.prototype._getStatName=function(){return[this.props.parentStatName,this.state.statName].filter(function(e){return Boolean(e)}).join(".")},t}(u.PureComponent),I=n("X64X"),j=n("ntfI"),T=n("4O8T"),D=n.n(T),L=function(e){function t(t){var n=e.call(this,t)||this;return n._loadEmitter=new D.a,n._onDone=function(){n.setState({loaded:!0,failed:!1})},n._onFail=function(e){n.setState({failed:!0,error:e})},n._handleMouseOver=function(){n.props.onShowSubMenu(n.props.action)},n.state={loaded:n.props.action.isLoaded(),failed:!1,error:""},n}return Object(c.__extends)(t,e),t.prototype.componentDidMount=function(){this._loadEmitter.on("done",this._onDone),this._loadEmitter.on("fail",this._onFail),this._load()},t.prototype.componentWillUnmount=function(){this._loadEmitter.removeEvent("done"),this._loadEmitter.removeEvent("fail")},t.prototype.render=function(){return this.state.failed?u.createElement(a,{label:this.state.error,onMouseOver:this._handleMouseOver}):this.state.loaded?u.createElement(M,Object(c.__assign)({},this.props)):u.createElement(s,{onMouseOver:this._handleMouseOver})},t.prototype._load=function(){var e=this;this.props.action.loadOptions().then(function(){e._loadEmitter.emit("done")}).catch(function(t){e._loadEmitter.emit("fail",t)})},t}(u.PureComponent),R=function(e){function t(t){
|
|
var n=e.call(this,t)||this;return n._handleShowSubMenu=function(e){var t=e.getState();n.setState({showSubMenuOf:t.subItems.length?e:void 0})},n.state={},n}return Object(c.__extends)(t,e),t.prototype.render=function(){var e=this;return u.createElement("table",null,u.createElement("tbody",null,this.props.items.map(function(t){return e._item(t)})))},t.getDerivedStateFromProps=function(e,t){return!e.parentIsOpened&&t.showSubMenuOf?{showSubMenuOf:void 0}:null},t.prototype._item=function(e){switch(e.type){case f.a.Separator:return u.createElement(o,{key:e.id,hint:e.getHint()});case f.a.Action:return u.createElement(M,{key:e.id,action:e,onShowSubMenu:this._handleShowSubMenu,isSubMenuOpened:this.state.showSubMenuOf===e,menuStatName:this.props.menuStatName,parentStatName:this.props.parentStatName});case f.a.ActionAsync:return u.createElement(L,{key:e.id,action:e,onShowSubMenu:this._handleShowSubMenu,isSubMenuOpened:this.state.showSubMenuOf===e,menuStatName:this.props.menuStatName,parentStatName:this.props.parentStatName});default:return null}},t}(u.PureComponent),W=n("t3rk"),A=function(e){function t(t){var n=e.call(this,t)||this;return n._handleClose=function(){n.props.onClose&&n.props.onClose()},n._handleOutsideClickClose=function(e){var t=n.props,o=t.doNotCloseOn,r=t.onClose;!r||void 0!==o&&o.contains(e.target)||r()},n.state={},n}return Object(c.__extends)(t,e),t.prototype.render=function(){var e=this,t=this.props,n=t.isOpened,o=(t.onClose,t.items),r=(t.doNotCloseOn,t.menuStatName),i=t.parentStatName,s=Object(c.__rest)(t,["isOpened","onClose","items","doNotCloseOn","menuStatName","parentStatName"]);return n?u.createElement(h.a,{handler:this._handleOutsideClickClose,mouseDown:!0,touchStart:!0},function(t){return u.createElement(u.Fragment,null,u.createElement(d.a,{keyCode:27,eventType:"keyup",handler:e._handleClose}),u.createElement(p.a,Object(c.__assign)({},s,{reference:t,isOpened:e.props.isOpened,className:m(W.menu,"context-menu"),onClose:e._handleClose,noMomentumBasedScroll:!0}),u.createElement(R,{items:o,menuStatName:r,parentStatName:i,parentIsOpened:n})))}):null},t}(u.PureComponent),n.d(t,"ContextMenuRenderer",function(){return P}),P=function(){function e(e,t,n,o){this._root=null,this._isShown=!1,this._props={isOpened:!1,items:e,position:{x:0,y:0},menuStatName:t.statName},this._onDestroy=n,this._onShow=o}return e.prototype.show=function(e,t,n){var o=this;this._onShow&&this._onShow(),this._isShown=!0,this._render(Object(c.__assign)(Object(c.__assign)({},this._props),{position:function(t,o){return"function"==typeof e&&(e=e(t,o)),e.touches&&e.touches.length>0&&(e={clientX:e.touches[0].clientX,clientY:e.touches[0].clientY}),{x:!n&&Object(N.isRtl)()?e.clientX-t:e.clientX,y:e.clientY,overrideHeight:e.overrideHeight}},isOpened:!0,onClose:function(){o.hide(),o.destroy()},doNotCloseOn:t}))},e.prototype.hide=function(){this._isShown=!1,this._render(Object(c.__assign)(Object(c.__assign)({},this._props),{isOpened:!1}))},e.prototype.isShown=function(){return this._isShown},e.prototype.destroy=function(){this._isShown=!1,
|
|
this._root&&(l.unmountComponentAtNode(this._root),document.body.removeChild(this._root),this._root=null),this._onDestroy&&this._onDestroy()},e.prototype._render=function(e){this._root||(this._root=document.createElement("span"),this._root.className="context-menu-wrapper",document.body.appendChild(this._root)),l.render(u.createElement(A,e),this._root)},e}()},euMy:function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 14" width="18" height="14"><path fill="currentColor" d="M6 11.17l-4.17-4.17-1.42 1.41 5.59 5.59 12-12-1.41-1.41-10.59 10.58z"/></svg>'},hn2c:function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 16" width="10" height="16"><path d="M.6 1.4l1.4-1.4 8 8-8 8-1.4-1.4 6.389-6.532-6.389-6.668z"/></svg>'},jAh7:function(e,t,n){"use strict";function o(e){var t,n,o;return void 0===e&&(e=document),null!==(t=e.getElementById("overlap-manager-root"))?Object(r.ensureDefined)(a.get(t)):(n=new s(e),o=function(e){var t=e.createElement("div");return t.style.position="absolute",t.style.zIndex=150..toString(),t.style.top="0px",t.style.left="0px",t.id="overlap-manager-root",t}(e),a.set(o,n),n.setContainer(o),e.body.appendChild(o),n)}var r,i,s,a;n.r(t),n.d(t,"OverlapManager",function(){return s}),n.d(t,"getRootOverlapManager",function(){return o}),r=n("Eyy1"),i=function(){function e(){this._storage=[]}return e.prototype.add=function(e){this._storage.push(e)},e.prototype.remove=function(e){this._storage=this._storage.filter(function(t){return e!==t})},e.prototype.has=function(e){return this._storage.includes(e)},e.prototype.getItems=function(){return this._storage},e}(),s=function(){function e(e){void 0===e&&(e=document),this._storage=new i,this._windows=new Map,this._index=0,this._document=e,this._container=e.createDocumentFragment()}return e.prototype.setContainer=function(e){var t=this._container,n=null===e?this._document.createDocumentFragment():e;!function(e,t){Array.from(e.childNodes).forEach(function(e){e.nodeType===Node.ELEMENT_NODE&&t.appendChild(e)})}(t,n),this._container=n},e.prototype.registerWindow=function(e){this._storage.has(e)||this._storage.add(e)},e.prototype.ensureWindow=function(e,t){var n,o;return void 0===t&&(t={position:"fixed"}),void 0!==(n=this._windows.get(e))?n:(this.registerWindow(e),(o=this._document.createElement("div")).style.position=t.position,o.style.zIndex=this._index.toString(),o.dataset.id=e,this._container.appendChild(o),this._windows.set(e,o),++this._index,o)},e.prototype.unregisterWindow=function(e){this._storage.remove(e);var t=this._windows.get(e);void 0!==t&&(null!==t.parentElement&&t.parentElement.removeChild(t),this._windows.delete(e))},e.prototype.getZindex=function(e){var t=this.ensureWindow(e);return parseInt(t.style.zIndex||"0")},e.prototype.moveToTop=function(e){this.getZindex(e)!==this._index&&(this.ensureWindow(e).style.zIndex=(++this._index).toString())},e.prototype.removeWindow=function(e){this.unregisterWindow(e)},e}(),a=new WeakMap},ntfI:function(e,t,n){"use strict";var o,r,i,s,a,c,u;n.d(t,"a",function(){return u}),
|
|
o=n("mrSG"),r=n("q1tI"),i=n("TSYQ"),s=n("j1f4"),a=n("K5ke"),function(e){e[e.Initial=0]="Initial",e[e.Appear=1]="Appear",e[e.Active=2]="Active"}(c||(c={})),u=function(e){function t(t){var n=e.call(this,t)||this;return n._stateChangeTimeout=null,n.state={state:c.Initial},n}return Object(o.__extends)(t,e),t.prototype.render=function(){var e,t=this.props,n=t.className,o=t.color,s=void 0===o?"black":o,c=i(a.item,((e={})[a[s]]=Boolean(s),e));return r.createElement("span",{className:i(a.loader,n,this._getStateClass())},r.createElement("span",{className:c}),r.createElement("span",{className:c}),r.createElement("span",{className:c}))},t.prototype.componentDidMount=function(){var e=this;this.setState({state:c.Appear}),this._stateChangeTimeout=setTimeout(function(){e.setState({state:c.Active})},2*s.dur)},t.prototype.componentWillUnmount=function(){this._stateChangeTimeout&&(clearTimeout(this._stateChangeTimeout),this._stateChangeTimeout=null)},t.prototype._getStateClass=function(){switch(this.state.state){case c.Initial:return"loader-initial";case c.Appear:return"loader-appear";default:return""}},t}(r.PureComponent)},t3rk:function(e,t,n){e.exports={menu:"menu-1y0eDKzl"}},"ycI/":function(e,t,n){"use strict";var o,r,i;n.d(t,"a",function(){return i}),o=n("mrSG"),r=n("q1tI"),i=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._handleKeyDown=function(e){e.keyCode===t.props.keyCode&&t.props.handler(e)},t}return Object(o.__extends)(t,e),t.prototype.componentDidMount=function(){document.addEventListener(this.props.eventType||"keydown",this._handleKeyDown,!1)},t.prototype.componentWillUnmount=function(){document.removeEventListener(this.props.eventType||"keydown",this._handleKeyDown,!1)},t.prototype.render=function(){return null},t}(r.PureComponent)},ycgn:function(e,t,n){e.exports={item:"item-stVdeCwG",interactive:"interactive-3E0jwVyG",hovered:"hovered-2HCCgw6c",disabled:"disabled-2K7FyUI3",active:"active-muW4lycL",shortcut:"shortcut-2P38AivB",iconCell:"iconCell-OhwVvlgA",icon:"icon-3DDcYD-t",checkmark:"checkmark-2UE1siCn",content:"content-1GXgstZ5",label:"label-1If3beUH",checked:"checked-5eQn8630",toolbox:"toolbox-2XX2mSNw",showToolboxOnHover:"showToolboxOnHover-iCrUIcOG",arrowIcon:"arrowIcon-2FMesq_x",subMenu:"subMenu-QM4GIDtY"}}}]); |