@deephaven/embed-widget 0.95.1-beta.3 → 0.95.1-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/assets/{App-BWgIXvTa.js → App-CKzlmAdy.js} +2 -2
- package/build/assets/{App-BWgIXvTa.js.map → App-CKzlmAdy.js.map} +1 -1
- package/build/assets/{Chart-CuMHG4al.js → Chart-D9ISn8H2.js} +2 -2
- package/build/assets/{Chart-CuMHG4al.js.map → Chart-D9ISn8H2.js.map} +1 -1
- package/build/assets/{IrisGrid-CQjgVDmu.js → IrisGrid-CmkmkUHh.js} +2 -2
- package/build/assets/{IrisGrid-CQjgVDmu.js.map → IrisGrid-CmkmkUHh.js.map} +1 -1
- package/build/assets/{IrisGridThemeProvider-jRMl44OR.js → IrisGridThemeProvider-DkYnJfQ3.js} +2 -2
- package/build/assets/{IrisGridThemeProvider-jRMl44OR.js.map → IrisGridThemeProvider-DkYnJfQ3.js.map} +1 -1
- package/build/assets/{LocalWorkspaceStorage-BhLrjrIO.js → LocalWorkspaceStorage-CsKd2UsW.js} +2 -2
- package/build/assets/{LocalWorkspaceStorage-BhLrjrIO.js.map → LocalWorkspaceStorage-CsKd2UsW.js.map} +1 -1
- package/build/assets/{LogPanel-By1Tc2qv.js → LogPanel-Bn3A8r0P.js} +2 -2
- package/build/assets/LogPanel-Bn3A8r0P.js.map +1 -0
- package/build/assets/{MarkdownEditor-BS_yxoPU.js → MarkdownEditor-DxG2r7RF.js} +2 -2
- package/build/assets/{MarkdownEditor-BS_yxoPU.js.map → MarkdownEditor-DxG2r7RF.js.map} +1 -1
- package/build/assets/{MarkdownNotebook-D5u9EXkr.js → MarkdownNotebook-Brk39EA8.js} +2 -2
- package/build/assets/{MarkdownNotebook-D5u9EXkr.js.map → MarkdownNotebook-Brk39EA8.js.map} +1 -1
- package/build/assets/{index-Bi3PkwrR.js → index-D1GeTrCi.js} +2 -2
- package/build/assets/{index-Bi3PkwrR.js.map → index-D1GeTrCi.js.map} +1 -1
- package/build/assets/{index-C6yth-wS.js → index-DaGLd5K-.js} +5 -5
- package/build/assets/{index-C6yth-wS.js.map → index-DaGLd5K-.js.map} +1 -1
- package/build/assets/{index-_QtlRRiX.js → index-FRlziSIF.js} +3 -3
- package/build/assets/{index-_QtlRRiX.js.map → index-FRlziSIF.js.map} +1 -1
- package/build/index.html +1 -1
- package/package.json +17 -17
- package/build/assets/LogPanel-By1Tc2qv.js.map +0 -1
package/build/assets/{LocalWorkspaceStorage-BhLrjrIO.js → LocalWorkspaceStorage-CsKd2UsW.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as d,J as I,E as c,H as F,b6 as fe,K as he,b7 as ve}from"./vendor-BBjJBO3m.js";import{L as _,q as me,a as N}from"./index-_QtlRRiX.js";import{A as P,ae as K,F as pe,u as be,l as T,a9 as ge,af as ye,am as Me,ao as U,aC as we,bs as Se,aE as Pe,aH as Oe,bt as Ce,aG as xe,bu as Ee,aX as De,av as Ie,a8 as Te,aI as Le,bv as B,bw as G,bx as z,by as k,aa as H,ab as je,ac as Ae}from"./LogPanel-By1Tc2qv.js";function Fe(n,e){d.useEffect(()=>{if(n!=null){var t=new window.ResizeObserver(e);return t.observe(n),()=>{n!=null&&t.unobserve(n)}}},[n,e])}function W(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function _e(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?W(Object(t),!0).forEach(function(r){M(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):W(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function M(n,e,t){return e=Ne(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ne(n){var e=Re(n,"string");return typeof e=="symbol"?e:String(e)}function Re(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var J=_.module("ContextMenu");class C extends d.PureComponent{static handleContextMenu(e){e.metaKey||(e.stopPropagation(),e.preventDefault())}constructor(e){super(e),M(this,"container",void 0),M(this,"oldFocus",void 0),M(this,"activeSubMenuRef",void 0),M(this,"subMenuTimer",void 0),M(this,"rAF",void 0),M(this,"initialPosition",void 0),this.handleBlur=this.handleBlur.bind(this),this.handleCloseSubMenu=this.handleCloseSubMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleMenuItemContextMenu=this.handleMenuItemContextMenu.bind(this),this.handleMenuItemMouseMove=this.handleMenuItemMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowResize=this.handleWindowResize.bind(this),this.container=I.createRef(),this.oldFocus=document.activeElement,this.activeSubMenuRef=I.createRef(),this.subMenuTimer=0,this.rAF=0,this.initialPosition={top:e.top,left:e.left},this.state={menuItems:[],pendingItems:[],activeSubMenu:null,hasOverflow:!1,subMenuTop:null,subMenuLeft:null,subMenuParentWidth:0,subMenuParentHeight:0,keyboardIndex:-1,mouseIndex:-1}}componentDidMount(){this.initMenu(),this.verifyPosition(),window.addEventListener("resize",this.handleWindowResize),this.rAF=window.requestAnimationFrame(()=>{var e;(e=this.container.current)===null||e===void 0||e.focus();var{onMenuOpened:t}=this.props;t(this)})}componentDidUpdate(e,t){var{actions:r}=this.props,{activeSubMenu:i}=this.state;if(i!==t.activeSubMenu)if(i==null){var o;(o=this.container.current)===null||o===void 0||o.focus()}else this.setActiveSubMenuPosition();if(e.actions!==r&&(this.initMenu(),this.container.current==null||!this.container.current.contains(document.activeElement))){var a;(a=this.container.current)===null||a===void 0||a.focus()}this.verifyPosition()}componentWillUnmount(){this.cancelPromises(),window.removeEventListener("resize",this.handleWindowResize),cancelAnimationFrame(this.rAF)}getKeyboardIndex(){var{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){var{keyboardIndex:t}=this.state;return t}return this.getMouseIndex()}setKeyboardIndex(e){var{options:t}=this.props;t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){var{mouseIndex:e}=this.state;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){this.cancelPromises(),cancelAnimationFrame(this.rAF);var{options:e}=this.props,t=e.initialKeyboardIndex;t===void 0&&(t=-1);for(var{actions:r}=this.props,i=P.getMenuItems(r),o=[],a=i.length-1;a>=0;a-=1){var s=i[a];s instanceof Promise?this.initMenuPromise(s):o.push(s)}this.setState({mouseIndex:-1,keyboardIndex:t,activeSubMenu:null,menuItems:P.sortActions(o)})}initMenuPromise(e){var t=K.makeCancelable(e);this.setState(r=>({pendingItems:r.pendingItems.concat(t)})),t.then(r=>{this.setState(i=>{var o=i.pendingItems.indexOf(t);if(o>=0){var a=i.pendingItems.slice();return a.splice(o,1),{menuItems:P.sortActions(i.menuItems.concat(r)),pendingItems:a}}return null})},r=>{K.isCanceled(r)||(this.setState(i=>{var o=i.pendingItems.indexOf(t);if(o>=0){var a=i.pendingItems.slice();return a.splice(o,1),{pendingItems:a}}return null}),J.error(r))})}cancelPromises(){var{pendingItems:e}=this.state;e.map(t=>t.cancel())}setActiveSubMenuPosition(){if(this.activeSubMenuRef.current!==null){var e=this.activeSubMenuRef.current.getBoundingClientRect();this.setState({subMenuTop:e.top,subMenuLeft:e.right,subMenuParentHeight:e.height,subMenuParentWidth:e.width})}}verifyPosition(){var e,t,r,i,{options:o,updatePosition:a,subMenuParentWidth:s,subMenuParentHeight:u,top:l,left:m}=this.props;if(!(!this.container.current||o.doNotVerifyPosition!=null&&o.doNotVerifyPosition)){var{top:f,left:p}=this.initialPosition,{width:b,height:v}=(e=(t=this.container.current)===null||t===void 0?void 0:t.getBoundingClientRect())!==null&&e!==void 0?e:{width:0,height:0},w=((r=(i=this.container.current)===null||i===void 0?void 0:i.scrollHeight)!==null&&r!==void 0?r:0)>window.innerHeight;v===0||b===0||(f+v>window.innerHeight&&(f-v-u>0?f-=v-u:f=window.innerHeight-v),p+b>window.innerWidth&&(p=p-b-s),(m!==p||l!==f)&&(this.setState({hasOverflow:w}),a(f,p)))}}handleWindowResize(){this.container.current&&this.closeMenu(!0)}handleBlur(e){if(!this.container.current){J.warn("Container is null!");return}if(!this.container.current.contains(e.relatedTarget)){for(var t=e.relatedTarget,r=!1;t&&!r;)r=t.hasAttribute("data-dh-context-menu"),t=t.parentElement;r||this.closeMenu(!0)}}isEscapeKey(e){var{left:t}=this.props;return e==="Escape"||t<0&&e==="ArrowRight"||e==="ArrowLeft"}handleKeyDown(e){var{menuItems:t}=this.state,r=this.getKeyboardIndex(),i=r,o=!1;if(e.key==="Enter"||e.key===" "){r>=0&&r<t.length&&this.handleMenuItemClick(t[r],e);return}if(e.key==="ArrowRight"?r>=0&&r<=t.length?o=!0:i=0:this.isEscapeKey(e.key)?i=null:e.key==="ArrowUp"||e.shiftKey&&e.key==="Tab"?i=P.getNextMenuItem(i,-1,t):(e.key==="ArrowDown"||e.key==="Tab")&&(i=P.getNextMenuItem(i,1,t)),o){this.openSubMenu(r),e.preventDefault(),e.stopPropagation();return}r!==i&&(i!==null?this.setKeyboardIndex(i):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}openSubMenu(e){var{menuItems:t,activeSubMenu:r}=this.state,i=t[e].actions?e:null;r!==i&&this.setState({activeSubMenu:i,subMenuTop:null,subMenuLeft:null})}closeMenu(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,{closeMenu:t,onMenuClosed:r}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),r(this)})}closeSubMenu(){this.setState({activeSubMenu:null})}handleCloseSubMenu(e){e?this.closeMenu(!0):this.closeSubMenu()}handleMenuItemClick(e,t){t.preventDefault(),t.stopPropagation();var{menuItems:r}=this.state;e!=null&&(e.disabled===void 0||!e.disabled)&&(e.actions!=null?this.openSubMenu(r.indexOf(e)):e.action!=null&&(e.action(t.nativeEvent),this.closeMenu(!0)))}handleMenuItemContextMenu(e,t){t.metaKey||this.handleMenuItemClick(e,t)}handleMenuItemMouseMove(e){var{menuItems:t}=this.state,r=t.indexOf(e);this.setMouseIndex(r),r>=0&&r<t.length&&(e.disabled===void 0||!e.disabled)&&this.openSubMenu(r)}handleMouseLeave(){this.setMouseIndex(-1)}render(){for(var e=[],{top:t,left:r}=this.props,{activeSubMenu:i,hasOverflow:o,keyboardIndex:a,menuItems:s,mouseIndex:u,pendingItems:l,subMenuTop:m,subMenuLeft:f,subMenuParentWidth:p,subMenuParentHeight:b}=this.state,v=0;v<s.length;v+=1){var w=s[v];v>0&&w.group!==s[v-1].group&&e.push(c.jsx("hr",{},"".concat(v,".separator")));var g=c.jsx(pe,{ref:i===v?this.activeSubMenuRef:null,isKeyboardSelected:a===v,isMouseSelected:u===v,menuItem:w,closeMenu:this.handleCloseSubMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:this.handleMenuItemContextMenu},v);e.push(g)}var O=null;l.length>0&&(O=c.jsx("div",{className:"loading",children:c.jsx(me,{className:"loading-spinner-vertical-align"})}));var{menuStyle:L,"data-testid":$}=this.props,S=i!==null&&m!==null&&f!==null;return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:F({"has-overflow":o},"context-menu-container"),style:_e({top:t,left:r},L),ref:this.container,"data-dh-context-menu":!0,onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,onContextMenu:C.handleContextMenu,role:"menuitem",tabIndex:0,"data-testid":$,children:[e,O]}),S&&i!==null&&m!==null&&f!==null&&c.jsx(C,{actions:s[i].actions||[],closeMenu:this.handleCloseSubMenu,top:m,left:f,updatePosition:(y,x)=>{this.setState({subMenuTop:y,subMenuLeft:x})},subMenuParentWidth:p,subMenuParentHeight:b},"sub-".concat(i))]})}}M(C,"defaultProps",{subMenuParentWidth:0,subMenuParentHeight:0,closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0});function Y(n,e,t){return e=$e(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function $e(n){var e=Ke(n,"string");return typeof e=="symbol"?e:String(e)}function Ke(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Et extends d.Component{constructor(e){super(e),Y(this,"container",void 0),Y(this,"openMenu",void 0),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.container=I.createRef(),this.openMenu=I.createRef(),this.state={actions:null,left:0,top:0}}componentDidMount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu)}componentWillUnmount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu)}handleContextMenu(e){if(this.container.current){var t=this.container.current.getBoundingClientRect(),r=e.clientY-t.top,i=e.clientX-t.left,{actions:o}=this.state;if(o!=null&&e.target===this.container.current){e.preventDefault(),this.setState({actions:null},()=>{var s=document.elementFromPoint(i,r),u=new MouseEvent("contextmenu",{clientX:e.clientX,clientY:e.clientY,bubbles:!0,cancelable:!0});s==null||s.dispatchEvent(u)});return}if(P.isContextActionEvent(e)&&!(e.metaKey||e.ctrlKey)){var a=P.getMenuItems(e.contextActions);a.length!==0&&(e.preventDefault(),this.setState({actions:a,top:r,left:i}))}}}handleMenuClose(e){e===this.openMenu.current&&this.setState({actions:null})}render(){var e=null,{"data-testid":t}=this.props,{actions:r,top:i,left:o}=this.state;return r&&(e=c.jsx(C,{ref:this.openMenu,actions:r,onMenuClosed:this.handleMenuClose,top:i,left:o,updatePosition:(a,s)=>{this.setState({top:a,left:s})},"data-testid":t})),c.jsx("div",{className:F("context-menu-root",{active:r}),ref:this.container,children:e})}}function Ue(n,e){var t=be(),r=d.useMemo(()=>new t.CoreClient(n,e),[t,n,e]);return d.useEffect(()=>()=>{r.disconnect()},[r]),r}var ue=d.createContext(null);function Dt(n){var{serverUrl:e,options:t,children:r}=n,i=Ue(e,t);return c.jsx(ue.Provider,{value:i,children:r})}function Be(){return T(ue,"No Client available in useClient. Was code wrapped in ClientBootstrap or ClientContext.Provider?")}var Ge=1e4;function It(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ge;return new Promise((r,i)=>{var o,a=setTimeout(()=>{var u;(u=o)===null||u===void 0||u(),i(new ge("Timeout looking for variable ".concat(e)))},t);function s(u){var l,m=u.created.find(f=>f.title===e);clearTimeout(a),(l=o)===null||l===void 0||l(),m!=null?r(m):i(new Error("Variable ".concat(e," not found")))}o=n.subscribeToFieldUpdates(s)})}function ze(n){var e=[...n.entries()].filter(t=>{var[,r]=t;return Me(r)||U(r)});return e.map(t=>{var[r,i]=t;if(U(i)){var{DashboardPlugin:o}=i;return c.jsx(o,{},r)}var{component:a}=i;return c.jsx(a,{},r)})}function Tt(){var n=ye(),e=d.useMemo(()=>ze(n),[n]);return e}var Lt=d.createContext({}),jt=d.createContext({}),ke=d.createContext(null);function Z(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function He(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Z(Object(t),!0).forEach(function(r){We(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Z(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function We(n,e,t){return e=Je(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Je(n){var e=Ye(n,"string");return typeof e=="symbol"?e:String(e)}function Ye(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Ze=100,j=()=>{},qe=Object.freeze({});function Xe(n){var{id:e="default",children:t,emptyDashboard:r,layoutConfig:i,layoutSettings:o=qe,onLayoutConfigChange:a=j,onGoldenLayoutChange:s=j,onLayoutInitialized:u=j,fallbackComponent:l=Ce,hydrate:m,dehydrate:f,panelWrapper:p}=n,b=d.useRef(null),[v,w]=d.useState(!1),[g,O]=d.useState();d.useEffect(function(){if(!b.current){O(void 0);return}var S=He({},we.makeDefaultLayout());S.settings===void 0&&(S.settings={}),Object.assign(S.settings,o),S.content=[];var y=new Se(S,b.current),x=()=>{y.off("initialised",x),w(!0)};return y.on("initialised",x),l!=null&&y.setFallbackComponent(l),y.init(),O(y),s(y),()=>{y.destroy()}},[o,l,s,w,O]);var L=d.useMemo(()=>fe(()=>{g!=null&&g.isInitialised&&(g==null||g.updateSize())},Ze),[g]);return Fe(b.current,L),c.jsxs("div",{className:"dashboard-container w-100 h-100",children:[c.jsx("div",{className:"w-100 h-100",ref:b}),v&&g&&c.jsx(Pe.Provider,{value:g,children:c.jsx(Oe,{emptyDashboard:r,id:e,layout:g,layoutConfig:i,onLayoutChange:a,onLayoutInitialized:u,hydrate:m,dehydrate:f,panelWrapper:p,children:t})})]})}var R="CREATE_DASHBOARD";function Qe(n,e){try{n.off(R,e)}catch{}}function At(n,e){return n.on(R,e),()=>Qe(n,e)}function Ft(n,e){n.emit(R,e)}var Ve=["id","isActive","plugins"];function q(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function X(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?q(Object(t),!0).forEach(function(r){et(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):q(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function et(n,e,t){return e=tt(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function tt(n){var e=nt(n,"string");return typeof e=="symbol"?e:String(e)}function nt(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function rt(n,e){if(n==null)return{};var t=it(n,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(i=0;i<o.length;i++)r=o[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function it(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,o;for(o=0;o<r.length;o++)i=r[o],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}function ot(n){var{id:e,isActive:t,plugins:r}=n,i=rt(n,Ve),[o,a]=d.useState(t),s=he(),u=d.useCallback(l=>{s(e===xe?Ee({layoutConfig:l}):De(e,{layoutConfig:l}))},[e,s]);return!o&&t&&a(!0),o?c.jsx(Xe,X(X({id:e,onLayoutConfigChange:u},i),{},{children:r})):c.jsx(N,{})}var at=d.createContext(null);function Q(n,e,t,r,i,o,a){try{var s=n[o](a),u=s.value}catch(l){t(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function st(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(u){Q(o,r,i,a,s,"next",u)}function s(u){Q(o,r,i,a,s,"throw",u)}a(void 0)})}}var le=d.createContext(null);function _t(n){var{children:e}=n,t=Be(),[r,i]=d.useState(),[o,a]=d.useState();d.useEffect(function(){var l=!1;function m(){return f.apply(this,arguments)}function f(){return f=st(function*(){try{var p=yield t.getServerConfigValues();l||i(new Map(p))}catch(b){l||a(b)}}),f.apply(this,arguments)}return m(),()=>{l=!0}},[t]);var s=r==null;return s||o!=null?c.jsx(N,{isLoading:s&&o==null,errorMessage:Ie(o)}):c.jsx(le.Provider,{value:r,children:e})}function Nt(){return T(le,"No server config available in useServerConfig. Was code wrapped in ServerConfigBootstrap or ServerConfigContext.Provider?")}function V(n,e,t,r,i,o,a){try{var s=n[o](a),u=s.value}catch(l){t(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function ut(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(u){V(o,r,i,a,s,"next",u)}function s(u){V(o,r,i,a,s,"throw",u)}a(void 0)})}}function ee(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function te(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ee(Object(t),!0).forEach(function(r){lt(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ee(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function lt(n,e,t){return e=ct(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ct(n){var e=dt(n,"string");return typeof e=="symbol"?e:String(e)}function dt(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Rt(n){var{dashboards:e,activeDashboard:t,onLayoutInitialized:r,onGoldenLayoutChange:i,plugins:o,emptyDashboard:a=c.jsx(N,{})}=n,s=Te(),u=d.useCallback((l,m)=>{var{metadata:f}=l;try{if(f!=null)return te(te({fetch:function(){var p=ut(function*(){return s(f)});function b(){return p.apply(this,arguments)}return b}()},l),{},{localDashboardId:m})}catch{}return Le.hydrate(l,m)},[s]);return c.jsx("div",{className:"tab-content",children:e.map(l=>c.jsx("div",{className:F("tab-pane",{active:l.id===t}),children:c.jsx(ot,{id:l.id,isActive:l.id===t,emptyDashboard:a,layoutConfig:l.layoutConfig,layoutSettings:l.layoutSettings,onLayoutInitialized:r,onGoldenLayoutChange:i,hydrate:u,plugins:o},l.key)},l.id))})}function $t(){return T(at,"No IdeConnection available in useConnection. Was code wrapped in ConnectionContext.Provider?")}function Kt(){return T(ke,"No user available in useUser. Was code wrapped in UserBootstrap or UserContext.Provider?")}function ne(n,e,t,r,i,o,a){try{var s=n[o](a),u=s.value}catch(l){t(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function re(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(u){ne(o,r,i,a,s,"next",u)}function s(u){ne(o,r,i,a,s,"throw",u)}a(void 0)})}}function ie(n,e,t){return e=ft(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ft(n){var e=ht(n,"string");return typeof e=="symbol"?e:String(e)}function ht(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ut{constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";ie(this,"storageService",void 0),ie(this,"root",void 0),this.storageService=e,this.root=t}getLayouts(){var e=this;return re(function*(){var t=yield e.storageService.listItems(e.root,"*.json");return t.map(r=>r.basename)})()}getLayout(e){var t=this;return re(function*(){var r=yield t.storageService.loadFile("".concat(t.root,"/").concat(e)),i=yield r.text();return JSON.parse(i)})()}}function vt(n){return n.version===2}function mt(n){return Array.isArray(n)}function oe(n,e,t,r,i,o,a){try{var s=n[o](a),u=s.value}catch(l){t(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function pt(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(u){oe(o,r,i,a,s,"next",u)}function s(u){oe(o,r,i,a,s,"throw",u)}a(void 0)})}}var E=_.module("UserLayoutUtils"),bt={layoutConfig:[{type:"column",content:[{type:"row",height:40,content:[{type:"stack",content:[{type:"react-component",component:B.COMPONENT,title:B.TITLE,isClosable:!1},{type:"react-component",component:G.COMPONENT,title:G.TITLE,isClosable:!1}]},{type:"stack",width:25,content:[{type:"react-component",component:z.COMPONENT,title:z.TITLE,isClosable:!1},{type:"react-component",component:k.COMPONENT,title:k.TITLE,isClosable:!1}]}]},{type:"row",content:[{type:"stack",title:"Notebooks",content:[]}]}]}],links:[],filterSets:[],version:2},gt={layoutConfig:[],links:[],filterSets:[],version:2};function ce(n){if(vt(n))return n;if(mt(n)){var e=n;return{layoutConfig:e,links:[],filterSets:[],version:2}}throw new Error("Unexpected layout import format: ".concat(n))}function yt(n){return A.apply(this,arguments)}function A(){return A=pt(function*(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;try{var t=yield n.getLayouts();if(t.length>0)try{var r=yield n.getLayout(t[0]);return ce(r)}catch(i){E.error("Unable to load layout",t[0],":",i),E.warn("No valid layouts found, falling back to default layout")}}catch(i){E.error("Unable to fetch layout list",i),E.warn("Falling back to default layout")}return e?bt:gt}),A.apply(this,arguments)}function Mt(n){var{filterSets:e,layoutConfig:t,links:r,pluginDataMap:i}=n,o={filterSets:e,layoutConfig:t,links:r,pluginDataMap:i,version:2};return o}const wt={exportLayout:Mt,getDefaultLayout:yt,normalizeLayout:ce};function ae(n,e,t,r,i,o,a){try{var s=n[o](a),u=s.value}catch(l){t(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function D(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(u){ae(o,r,i,a,s,"next",u)}function s(u){ae(o,r,i,a,s,"throw",u)}a(void 0)})}}function de(n,e,t){return e=St(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function St(n){var e=Pt(n,"string");return typeof e=="symbol"?e:String(e)}function Pt(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var se=_.module("LocalWorkspaceStorage");class h{static getBooleanServerConfig(e,t){var r,i;if((e==null||(r=e.get(t))===null||r===void 0?void 0:r.toLowerCase())==="true")return!0;if((e==null||(i=e.get(t))===null||i===void 0?void 0:i.toLowerCase())==="false")return!1}static getJSONServerConfig(e,t){var r=e==null?void 0:e.get(t);if(r!=null)try{return JSON.parse(r)}catch{se.error("Unable to parse JSON server config for key ".concat(t,". Value: ").concat(r));return}}static makeDefaultWorkspaceSettings(e){var t={defaultDateTimeFormat:H.DEFAULT_DATETIME_FORMAT_STRING,formatter:[],timeZone:H.DEFAULT_TIME_ZONE_ID,showTimeZone:!1,showTSeparator:!0,disableMoveConfirmation:!1,defaultDecimalFormatOptions:{defaultFormatString:je.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:Ae.DEFAULT_FORMAT_STRING},truncateNumbersWithPound:!1,showEmptyStrings:!0,showNullStrings:!0,showExtraGroupColumn:!0,notebookSettings:{isMinimapEnabled:!1,formatOnSave:!1,python:{linter:{isEnabled:!0}}},webgl:!0,webglEditable:!0,gridDensity:"regular"},r={defaultDateTimeFormat:e==null?void 0:e.get("dateTimeFormat"),formatter:[],timeZone:e==null?void 0:e.get("timeZone"),showTimeZone:h.getBooleanServerConfig(e,"showTimeZone"),showTSeparator:h.getBooleanServerConfig(e,"showTSeparator"),disableMoveConfirmation:h.getBooleanServerConfig(e,"disableMoveConfirmation"),defaultDecimalFormatOptions:(e==null?void 0:e.get("decimalFormat"))!==void 0?{defaultFormatString:e==null?void 0:e.get("decimalFormat")}:void 0,defaultIntegerFormatOptions:(e==null?void 0:e.get("integerFormat"))!==void 0?{defaultFormatString:e==null?void 0:e.get("integerFormat")}:void 0,truncateNumbersWithPound:h.getBooleanServerConfig(e,"truncateNumbersWithPound"),showEmptyStrings:h.getBooleanServerConfig(e,"showEmptyStrings"),showNullStrings:h.getBooleanServerConfig(e,"showNullStrings"),showExtraGroupColumn:h.getBooleanServerConfig(e,"showExtraGroupColumn"),notebookSettings:{isMinimapEnabled:h.getBooleanServerConfig(e,"web.user.notebookSettings.isMinimapEnabled"),formatOnSave:h.getBooleanServerConfig(e,"web.user.notebookSettings.formatOnSave"),python:{linter:{isEnabled:h.getBooleanServerConfig(e,"web.user.notebookSettings.python.linter.isEnabled"),config:h.getJSONServerConfig(e,"web.user.notebookSettings.python.linter.config")}}},webgl:h.getBooleanServerConfig(e,"web.webgl"),webglEditable:h.getBooleanServerConfig(e,"web.webgl.editable")};return ve({},t,r)}static makeWorkspaceData(e,t){return D(function*(){var{filterSets:r,links:i,layoutConfig:o,pluginDataMap:a={}}=yield wt.getDefaultLayout(e,t==null?void 0:t.isConsoleAvailable);return{settings:{},layoutConfig:o,closed:[{}],links:i,filterSets:r,pluginDataMap:a}})()}static makeDefaultWorkspace(e,t){return D(function*(){return{data:yield h.makeWorkspaceData(e,t)}})()}constructor(e){de(this,"layoutStorage",void 0),this.layoutStorage=e}load(e){var t=this;return D(function*(){try{var r,i=JSON.parse((r=localStorage.getItem(h.STORAGE_KEY))!==null&&r!==void 0?r:"");return i}catch{return se.info("Unable to load workspace data, initializing to default data"),h.makeDefaultWorkspace(t.layoutStorage,e)}})()}save(e){return D(function*(){return localStorage.setItem(h.STORAGE_KEY,JSON.stringify(e)),e})()}}de(h,"STORAGE_KEY","deephaven.WorkspaceStorage");export{Rt as A,Et as C,Xe as D,Ge as F,Ut as G,h as L,_t as S,jt as U,Be as a,Kt as b,Nt as c,Tt as d,Fe as e,It as f,Dt as g,ue as h,ze as i,ke as j,Lt as k,At as l,R as m,ot as n,Ft as o,at as p,wt as q,vt as r,Qe as s,mt as t,$t as u,bt as v,gt as w,ce as x,yt as y,Mt as z};
|
|
2
|
-
//# sourceMappingURL=LocalWorkspaceStorage-
|
|
1
|
+
import{r as d,J as I,E as c,H as F,b6 as fe,K as he,b7 as ve}from"./vendor-BBjJBO3m.js";import{L as _,q as me,a as N}from"./index-FRlziSIF.js";import{A as P,ae as K,F as pe,u as be,l as T,a9 as ge,af as ye,am as Me,ao as U,aC as we,bs as Se,aE as Pe,aH as Oe,bt as Ce,aG as xe,bu as Ee,aX as De,av as Ie,a8 as Te,aI as Le,bv as B,bw as G,bx as z,by as k,aa as H,ab as je,ac as Ae}from"./LogPanel-Bn3A8r0P.js";function Fe(n,e){d.useEffect(()=>{if(n!=null){var t=new window.ResizeObserver(e);return t.observe(n),()=>{n!=null&&t.unobserve(n)}}},[n,e])}function W(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function _e(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?W(Object(t),!0).forEach(function(r){M(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):W(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function M(n,e,t){return e=Ne(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ne(n){var e=Re(n,"string");return typeof e=="symbol"?e:String(e)}function Re(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var J=_.module("ContextMenu");class C extends d.PureComponent{static handleContextMenu(e){e.metaKey||(e.stopPropagation(),e.preventDefault())}constructor(e){super(e),M(this,"container",void 0),M(this,"oldFocus",void 0),M(this,"activeSubMenuRef",void 0),M(this,"subMenuTimer",void 0),M(this,"rAF",void 0),M(this,"initialPosition",void 0),this.handleBlur=this.handleBlur.bind(this),this.handleCloseSubMenu=this.handleCloseSubMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleMenuItemContextMenu=this.handleMenuItemContextMenu.bind(this),this.handleMenuItemMouseMove=this.handleMenuItemMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowResize=this.handleWindowResize.bind(this),this.container=I.createRef(),this.oldFocus=document.activeElement,this.activeSubMenuRef=I.createRef(),this.subMenuTimer=0,this.rAF=0,this.initialPosition={top:e.top,left:e.left},this.state={menuItems:[],pendingItems:[],activeSubMenu:null,hasOverflow:!1,subMenuTop:null,subMenuLeft:null,subMenuParentWidth:0,subMenuParentHeight:0,keyboardIndex:-1,mouseIndex:-1}}componentDidMount(){this.initMenu(),this.verifyPosition(),window.addEventListener("resize",this.handleWindowResize),this.rAF=window.requestAnimationFrame(()=>{var e;(e=this.container.current)===null||e===void 0||e.focus();var{onMenuOpened:t}=this.props;t(this)})}componentDidUpdate(e,t){var{actions:r}=this.props,{activeSubMenu:i}=this.state;if(i!==t.activeSubMenu)if(i==null){var o;(o=this.container.current)===null||o===void 0||o.focus()}else this.setActiveSubMenuPosition();if(e.actions!==r&&(this.initMenu(),this.container.current==null||!this.container.current.contains(document.activeElement))){var a;(a=this.container.current)===null||a===void 0||a.focus()}this.verifyPosition()}componentWillUnmount(){this.cancelPromises(),window.removeEventListener("resize",this.handleWindowResize),cancelAnimationFrame(this.rAF)}getKeyboardIndex(){var{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){var{keyboardIndex:t}=this.state;return t}return this.getMouseIndex()}setKeyboardIndex(e){var{options:t}=this.props;t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){var{mouseIndex:e}=this.state;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){this.cancelPromises(),cancelAnimationFrame(this.rAF);var{options:e}=this.props,t=e.initialKeyboardIndex;t===void 0&&(t=-1);for(var{actions:r}=this.props,i=P.getMenuItems(r),o=[],a=i.length-1;a>=0;a-=1){var s=i[a];s instanceof Promise?this.initMenuPromise(s):o.push(s)}this.setState({mouseIndex:-1,keyboardIndex:t,activeSubMenu:null,menuItems:P.sortActions(o)})}initMenuPromise(e){var t=K.makeCancelable(e);this.setState(r=>({pendingItems:r.pendingItems.concat(t)})),t.then(r=>{this.setState(i=>{var o=i.pendingItems.indexOf(t);if(o>=0){var a=i.pendingItems.slice();return a.splice(o,1),{menuItems:P.sortActions(i.menuItems.concat(r)),pendingItems:a}}return null})},r=>{K.isCanceled(r)||(this.setState(i=>{var o=i.pendingItems.indexOf(t);if(o>=0){var a=i.pendingItems.slice();return a.splice(o,1),{pendingItems:a}}return null}),J.error(r))})}cancelPromises(){var{pendingItems:e}=this.state;e.map(t=>t.cancel())}setActiveSubMenuPosition(){if(this.activeSubMenuRef.current!==null){var e=this.activeSubMenuRef.current.getBoundingClientRect();this.setState({subMenuTop:e.top,subMenuLeft:e.right,subMenuParentHeight:e.height,subMenuParentWidth:e.width})}}verifyPosition(){var e,t,r,i,{options:o,updatePosition:a,subMenuParentWidth:s,subMenuParentHeight:u,top:l,left:m}=this.props;if(!(!this.container.current||o.doNotVerifyPosition!=null&&o.doNotVerifyPosition)){var{top:f,left:p}=this.initialPosition,{width:b,height:v}=(e=(t=this.container.current)===null||t===void 0?void 0:t.getBoundingClientRect())!==null&&e!==void 0?e:{width:0,height:0},w=((r=(i=this.container.current)===null||i===void 0?void 0:i.scrollHeight)!==null&&r!==void 0?r:0)>window.innerHeight;v===0||b===0||(f+v>window.innerHeight&&(f-v-u>0?f-=v-u:f=window.innerHeight-v),p+b>window.innerWidth&&(p=p-b-s),(m!==p||l!==f)&&(this.setState({hasOverflow:w}),a(f,p)))}}handleWindowResize(){this.container.current&&this.closeMenu(!0)}handleBlur(e){if(!this.container.current){J.warn("Container is null!");return}if(!this.container.current.contains(e.relatedTarget)){for(var t=e.relatedTarget,r=!1;t&&!r;)r=t.hasAttribute("data-dh-context-menu"),t=t.parentElement;r||this.closeMenu(!0)}}isEscapeKey(e){var{left:t}=this.props;return e==="Escape"||t<0&&e==="ArrowRight"||e==="ArrowLeft"}handleKeyDown(e){var{menuItems:t}=this.state,r=this.getKeyboardIndex(),i=r,o=!1;if(e.key==="Enter"||e.key===" "){r>=0&&r<t.length&&this.handleMenuItemClick(t[r],e);return}if(e.key==="ArrowRight"?r>=0&&r<=t.length?o=!0:i=0:this.isEscapeKey(e.key)?i=null:e.key==="ArrowUp"||e.shiftKey&&e.key==="Tab"?i=P.getNextMenuItem(i,-1,t):(e.key==="ArrowDown"||e.key==="Tab")&&(i=P.getNextMenuItem(i,1,t)),o){this.openSubMenu(r),e.preventDefault(),e.stopPropagation();return}r!==i&&(i!==null?this.setKeyboardIndex(i):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}openSubMenu(e){var{menuItems:t,activeSubMenu:r}=this.state,i=t[e].actions?e:null;r!==i&&this.setState({activeSubMenu:i,subMenuTop:null,subMenuLeft:null})}closeMenu(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,{closeMenu:t,onMenuClosed:r}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),r(this)})}closeSubMenu(){this.setState({activeSubMenu:null})}handleCloseSubMenu(e){e?this.closeMenu(!0):this.closeSubMenu()}handleMenuItemClick(e,t){t.preventDefault(),t.stopPropagation();var{menuItems:r}=this.state;e!=null&&(e.disabled===void 0||!e.disabled)&&(e.actions!=null?this.openSubMenu(r.indexOf(e)):e.action!=null&&(e.action(t.nativeEvent),this.closeMenu(!0)))}handleMenuItemContextMenu(e,t){t.metaKey||this.handleMenuItemClick(e,t)}handleMenuItemMouseMove(e){var{menuItems:t}=this.state,r=t.indexOf(e);this.setMouseIndex(r),r>=0&&r<t.length&&(e.disabled===void 0||!e.disabled)&&this.openSubMenu(r)}handleMouseLeave(){this.setMouseIndex(-1)}render(){for(var e=[],{top:t,left:r}=this.props,{activeSubMenu:i,hasOverflow:o,keyboardIndex:a,menuItems:s,mouseIndex:u,pendingItems:l,subMenuTop:m,subMenuLeft:f,subMenuParentWidth:p,subMenuParentHeight:b}=this.state,v=0;v<s.length;v+=1){var w=s[v];v>0&&w.group!==s[v-1].group&&e.push(c.jsx("hr",{},"".concat(v,".separator")));var g=c.jsx(pe,{ref:i===v?this.activeSubMenuRef:null,isKeyboardSelected:a===v,isMouseSelected:u===v,menuItem:w,closeMenu:this.handleCloseSubMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:this.handleMenuItemContextMenu},v);e.push(g)}var O=null;l.length>0&&(O=c.jsx("div",{className:"loading",children:c.jsx(me,{className:"loading-spinner-vertical-align"})}));var{menuStyle:L,"data-testid":$}=this.props,S=i!==null&&m!==null&&f!==null;return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:F({"has-overflow":o},"context-menu-container"),style:_e({top:t,left:r},L),ref:this.container,"data-dh-context-menu":!0,onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,onContextMenu:C.handleContextMenu,role:"menuitem",tabIndex:0,"data-testid":$,children:[e,O]}),S&&i!==null&&m!==null&&f!==null&&c.jsx(C,{actions:s[i].actions||[],closeMenu:this.handleCloseSubMenu,top:m,left:f,updatePosition:(y,x)=>{this.setState({subMenuTop:y,subMenuLeft:x})},subMenuParentWidth:p,subMenuParentHeight:b},"sub-".concat(i))]})}}M(C,"defaultProps",{subMenuParentWidth:0,subMenuParentHeight:0,closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0});function Y(n,e,t){return e=$e(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function $e(n){var e=Ke(n,"string");return typeof e=="symbol"?e:String(e)}function Ke(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Et extends d.Component{constructor(e){super(e),Y(this,"container",void 0),Y(this,"openMenu",void 0),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.container=I.createRef(),this.openMenu=I.createRef(),this.state={actions:null,left:0,top:0}}componentDidMount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu)}componentWillUnmount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu)}handleContextMenu(e){if(this.container.current){var t=this.container.current.getBoundingClientRect(),r=e.clientY-t.top,i=e.clientX-t.left,{actions:o}=this.state;if(o!=null&&e.target===this.container.current){e.preventDefault(),this.setState({actions:null},()=>{var s=document.elementFromPoint(i,r),u=new MouseEvent("contextmenu",{clientX:e.clientX,clientY:e.clientY,bubbles:!0,cancelable:!0});s==null||s.dispatchEvent(u)});return}if(P.isContextActionEvent(e)&&!(e.metaKey||e.ctrlKey)){var a=P.getMenuItems(e.contextActions);a.length!==0&&(e.preventDefault(),this.setState({actions:a,top:r,left:i}))}}}handleMenuClose(e){e===this.openMenu.current&&this.setState({actions:null})}render(){var e=null,{"data-testid":t}=this.props,{actions:r,top:i,left:o}=this.state;return r&&(e=c.jsx(C,{ref:this.openMenu,actions:r,onMenuClosed:this.handleMenuClose,top:i,left:o,updatePosition:(a,s)=>{this.setState({top:a,left:s})},"data-testid":t})),c.jsx("div",{className:F("context-menu-root",{active:r}),ref:this.container,children:e})}}function Ue(n,e){var t=be(),r=d.useMemo(()=>new t.CoreClient(n,e),[t,n,e]);return d.useEffect(()=>()=>{r.disconnect()},[r]),r}var ue=d.createContext(null);function Dt(n){var{serverUrl:e,options:t,children:r}=n,i=Ue(e,t);return c.jsx(ue.Provider,{value:i,children:r})}function Be(){return T(ue,"No Client available in useClient. Was code wrapped in ClientBootstrap or ClientContext.Provider?")}var Ge=1e4;function It(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ge;return new Promise((r,i)=>{var o,a=setTimeout(()=>{var u;(u=o)===null||u===void 0||u(),i(new ge("Timeout looking for variable ".concat(e)))},t);function s(u){var l,m=u.created.find(f=>f.title===e);clearTimeout(a),(l=o)===null||l===void 0||l(),m!=null?r(m):i(new Error("Variable ".concat(e," not found")))}o=n.subscribeToFieldUpdates(s)})}function ze(n){var e=[...n.entries()].filter(t=>{var[,r]=t;return Me(r)||U(r)});return e.map(t=>{var[r,i]=t;if(U(i)){var{DashboardPlugin:o}=i;return c.jsx(o,{},r)}var{component:a}=i;return c.jsx(a,{},r)})}function Tt(){var n=ye(),e=d.useMemo(()=>ze(n),[n]);return e}var Lt=d.createContext({}),jt=d.createContext({}),ke=d.createContext(null);function Z(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function He(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Z(Object(t),!0).forEach(function(r){We(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Z(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function We(n,e,t){return e=Je(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Je(n){var e=Ye(n,"string");return typeof e=="symbol"?e:String(e)}function Ye(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Ze=100,j=()=>{},qe=Object.freeze({});function Xe(n){var{id:e="default",children:t,emptyDashboard:r,layoutConfig:i,layoutSettings:o=qe,onLayoutConfigChange:a=j,onGoldenLayoutChange:s=j,onLayoutInitialized:u=j,fallbackComponent:l=Ce,hydrate:m,dehydrate:f,panelWrapper:p}=n,b=d.useRef(null),[v,w]=d.useState(!1),[g,O]=d.useState();d.useEffect(function(){if(!b.current){O(void 0);return}var S=He({},we.makeDefaultLayout());S.settings===void 0&&(S.settings={}),Object.assign(S.settings,o),S.content=[];var y=new Se(S,b.current),x=()=>{y.off("initialised",x),w(!0)};return y.on("initialised",x),l!=null&&y.setFallbackComponent(l),y.init(),O(y),s(y),()=>{y.destroy()}},[o,l,s,w,O]);var L=d.useMemo(()=>fe(()=>{g!=null&&g.isInitialised&&(g==null||g.updateSize())},Ze),[g]);return Fe(b.current,L),c.jsxs("div",{className:"dashboard-container w-100 h-100",children:[c.jsx("div",{className:"w-100 h-100",ref:b}),v&&g&&c.jsx(Pe.Provider,{value:g,children:c.jsx(Oe,{emptyDashboard:r,id:e,layout:g,layoutConfig:i,onLayoutChange:a,onLayoutInitialized:u,hydrate:m,dehydrate:f,panelWrapper:p,children:t})})]})}var R="CREATE_DASHBOARD";function Qe(n,e){try{n.off(R,e)}catch{}}function At(n,e){return n.on(R,e),()=>Qe(n,e)}function Ft(n,e){n.emit(R,e)}var Ve=["id","isActive","plugins"];function q(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function X(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?q(Object(t),!0).forEach(function(r){et(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):q(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function et(n,e,t){return e=tt(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function tt(n){var e=nt(n,"string");return typeof e=="symbol"?e:String(e)}function nt(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function rt(n,e){if(n==null)return{};var t=it(n,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(i=0;i<o.length;i++)r=o[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function it(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,o;for(o=0;o<r.length;o++)i=r[o],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}function ot(n){var{id:e,isActive:t,plugins:r}=n,i=rt(n,Ve),[o,a]=d.useState(t),s=he(),u=d.useCallback(l=>{s(e===xe?Ee({layoutConfig:l}):De(e,{layoutConfig:l}))},[e,s]);return!o&&t&&a(!0),o?c.jsx(Xe,X(X({id:e,onLayoutConfigChange:u},i),{},{children:r})):c.jsx(N,{})}var at=d.createContext(null);function Q(n,e,t,r,i,o,a){try{var s=n[o](a),u=s.value}catch(l){t(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function st(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(u){Q(o,r,i,a,s,"next",u)}function s(u){Q(o,r,i,a,s,"throw",u)}a(void 0)})}}var le=d.createContext(null);function _t(n){var{children:e}=n,t=Be(),[r,i]=d.useState(),[o,a]=d.useState();d.useEffect(function(){var l=!1;function m(){return f.apply(this,arguments)}function f(){return f=st(function*(){try{var p=yield t.getServerConfigValues();l||i(new Map(p))}catch(b){l||a(b)}}),f.apply(this,arguments)}return m(),()=>{l=!0}},[t]);var s=r==null;return s||o!=null?c.jsx(N,{isLoading:s&&o==null,errorMessage:Ie(o)}):c.jsx(le.Provider,{value:r,children:e})}function Nt(){return T(le,"No server config available in useServerConfig. Was code wrapped in ServerConfigBootstrap or ServerConfigContext.Provider?")}function V(n,e,t,r,i,o,a){try{var s=n[o](a),u=s.value}catch(l){t(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function ut(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(u){V(o,r,i,a,s,"next",u)}function s(u){V(o,r,i,a,s,"throw",u)}a(void 0)})}}function ee(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function te(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ee(Object(t),!0).forEach(function(r){lt(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ee(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function lt(n,e,t){return e=ct(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ct(n){var e=dt(n,"string");return typeof e=="symbol"?e:String(e)}function dt(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Rt(n){var{dashboards:e,activeDashboard:t,onLayoutInitialized:r,onGoldenLayoutChange:i,plugins:o,emptyDashboard:a=c.jsx(N,{})}=n,s=Te(),u=d.useCallback((l,m)=>{var{metadata:f}=l;try{if(f!=null)return te(te({fetch:function(){var p=ut(function*(){return s(f)});function b(){return p.apply(this,arguments)}return b}()},l),{},{localDashboardId:m})}catch{}return Le.hydrate(l,m)},[s]);return c.jsx("div",{className:"tab-content",children:e.map(l=>c.jsx("div",{className:F("tab-pane",{active:l.id===t}),children:c.jsx(ot,{id:l.id,isActive:l.id===t,emptyDashboard:a,layoutConfig:l.layoutConfig,layoutSettings:l.layoutSettings,onLayoutInitialized:r,onGoldenLayoutChange:i,hydrate:u,plugins:o},l.key)},l.id))})}function $t(){return T(at,"No IdeConnection available in useConnection. Was code wrapped in ConnectionContext.Provider?")}function Kt(){return T(ke,"No user available in useUser. Was code wrapped in UserBootstrap or UserContext.Provider?")}function ne(n,e,t,r,i,o,a){try{var s=n[o](a),u=s.value}catch(l){t(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function re(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(u){ne(o,r,i,a,s,"next",u)}function s(u){ne(o,r,i,a,s,"throw",u)}a(void 0)})}}function ie(n,e,t){return e=ft(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ft(n){var e=ht(n,"string");return typeof e=="symbol"?e:String(e)}function ht(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ut{constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";ie(this,"storageService",void 0),ie(this,"root",void 0),this.storageService=e,this.root=t}getLayouts(){var e=this;return re(function*(){var t=yield e.storageService.listItems(e.root,"*.json");return t.map(r=>r.basename)})()}getLayout(e){var t=this;return re(function*(){var r=yield t.storageService.loadFile("".concat(t.root,"/").concat(e)),i=yield r.text();return JSON.parse(i)})()}}function vt(n){return n.version===2}function mt(n){return Array.isArray(n)}function oe(n,e,t,r,i,o,a){try{var s=n[o](a),u=s.value}catch(l){t(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function pt(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(u){oe(o,r,i,a,s,"next",u)}function s(u){oe(o,r,i,a,s,"throw",u)}a(void 0)})}}var E=_.module("UserLayoutUtils"),bt={layoutConfig:[{type:"column",content:[{type:"row",height:40,content:[{type:"stack",content:[{type:"react-component",component:B.COMPONENT,title:B.TITLE,isClosable:!1},{type:"react-component",component:G.COMPONENT,title:G.TITLE,isClosable:!1}]},{type:"stack",width:25,content:[{type:"react-component",component:z.COMPONENT,title:z.TITLE,isClosable:!1},{type:"react-component",component:k.COMPONENT,title:k.TITLE,isClosable:!1}]}]},{type:"row",content:[{type:"stack",title:"Notebooks",content:[]}]}]}],links:[],filterSets:[],version:2},gt={layoutConfig:[],links:[],filterSets:[],version:2};function ce(n){if(vt(n))return n;if(mt(n)){var e=n;return{layoutConfig:e,links:[],filterSets:[],version:2}}throw new Error("Unexpected layout import format: ".concat(n))}function yt(n){return A.apply(this,arguments)}function A(){return A=pt(function*(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;try{var t=yield n.getLayouts();if(t.length>0)try{var r=yield n.getLayout(t[0]);return ce(r)}catch(i){E.error("Unable to load layout",t[0],":",i),E.warn("No valid layouts found, falling back to default layout")}}catch(i){E.error("Unable to fetch layout list",i),E.warn("Falling back to default layout")}return e?bt:gt}),A.apply(this,arguments)}function Mt(n){var{filterSets:e,layoutConfig:t,links:r,pluginDataMap:i}=n,o={filterSets:e,layoutConfig:t,links:r,pluginDataMap:i,version:2};return o}const wt={exportLayout:Mt,getDefaultLayout:yt,normalizeLayout:ce};function ae(n,e,t,r,i,o,a){try{var s=n[o](a),u=s.value}catch(l){t(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function D(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(u){ae(o,r,i,a,s,"next",u)}function s(u){ae(o,r,i,a,s,"throw",u)}a(void 0)})}}function de(n,e,t){return e=St(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function St(n){var e=Pt(n,"string");return typeof e=="symbol"?e:String(e)}function Pt(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var se=_.module("LocalWorkspaceStorage");class h{static getBooleanServerConfig(e,t){var r,i;if((e==null||(r=e.get(t))===null||r===void 0?void 0:r.toLowerCase())==="true")return!0;if((e==null||(i=e.get(t))===null||i===void 0?void 0:i.toLowerCase())==="false")return!1}static getJSONServerConfig(e,t){var r=e==null?void 0:e.get(t);if(r!=null)try{return JSON.parse(r)}catch{se.error("Unable to parse JSON server config for key ".concat(t,". Value: ").concat(r));return}}static makeDefaultWorkspaceSettings(e){var t={defaultDateTimeFormat:H.DEFAULT_DATETIME_FORMAT_STRING,formatter:[],timeZone:H.DEFAULT_TIME_ZONE_ID,showTimeZone:!1,showTSeparator:!0,disableMoveConfirmation:!1,defaultDecimalFormatOptions:{defaultFormatString:je.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:Ae.DEFAULT_FORMAT_STRING},truncateNumbersWithPound:!1,showEmptyStrings:!0,showNullStrings:!0,showExtraGroupColumn:!0,notebookSettings:{isMinimapEnabled:!1,formatOnSave:!1,python:{linter:{isEnabled:!0}}},webgl:!0,webglEditable:!0,gridDensity:"regular"},r={defaultDateTimeFormat:e==null?void 0:e.get("dateTimeFormat"),formatter:[],timeZone:e==null?void 0:e.get("timeZone"),showTimeZone:h.getBooleanServerConfig(e,"showTimeZone"),showTSeparator:h.getBooleanServerConfig(e,"showTSeparator"),disableMoveConfirmation:h.getBooleanServerConfig(e,"disableMoveConfirmation"),defaultDecimalFormatOptions:(e==null?void 0:e.get("decimalFormat"))!==void 0?{defaultFormatString:e==null?void 0:e.get("decimalFormat")}:void 0,defaultIntegerFormatOptions:(e==null?void 0:e.get("integerFormat"))!==void 0?{defaultFormatString:e==null?void 0:e.get("integerFormat")}:void 0,truncateNumbersWithPound:h.getBooleanServerConfig(e,"truncateNumbersWithPound"),showEmptyStrings:h.getBooleanServerConfig(e,"showEmptyStrings"),showNullStrings:h.getBooleanServerConfig(e,"showNullStrings"),showExtraGroupColumn:h.getBooleanServerConfig(e,"showExtraGroupColumn"),notebookSettings:{isMinimapEnabled:h.getBooleanServerConfig(e,"web.user.notebookSettings.isMinimapEnabled"),formatOnSave:h.getBooleanServerConfig(e,"web.user.notebookSettings.formatOnSave"),python:{linter:{isEnabled:h.getBooleanServerConfig(e,"web.user.notebookSettings.python.linter.isEnabled"),config:h.getJSONServerConfig(e,"web.user.notebookSettings.python.linter.config")}}},webgl:h.getBooleanServerConfig(e,"web.webgl"),webglEditable:h.getBooleanServerConfig(e,"web.webgl.editable")};return ve({},t,r)}static makeWorkspaceData(e,t){return D(function*(){var{filterSets:r,links:i,layoutConfig:o,pluginDataMap:a={}}=yield wt.getDefaultLayout(e,t==null?void 0:t.isConsoleAvailable);return{settings:{},layoutConfig:o,closed:[{}],links:i,filterSets:r,pluginDataMap:a}})()}static makeDefaultWorkspace(e,t){return D(function*(){return{data:yield h.makeWorkspaceData(e,t)}})()}constructor(e){de(this,"layoutStorage",void 0),this.layoutStorage=e}load(e){var t=this;return D(function*(){try{var r,i=JSON.parse((r=localStorage.getItem(h.STORAGE_KEY))!==null&&r!==void 0?r:"");return i}catch{return se.info("Unable to load workspace data, initializing to default data"),h.makeDefaultWorkspace(t.layoutStorage,e)}})()}save(e){return D(function*(){return localStorage.setItem(h.STORAGE_KEY,JSON.stringify(e)),e})()}}de(h,"STORAGE_KEY","deephaven.WorkspaceStorage");export{Rt as A,Et as C,Xe as D,Ge as F,Ut as G,h as L,_t as S,jt as U,Be as a,Kt as b,Nt as c,Tt as d,Fe as e,It as f,Dt as g,ue as h,ze as i,ke as j,Lt as k,At as l,R as m,ot as n,Ft as o,at as p,wt as q,vt as r,Qe as s,mt as t,$t as u,bt as v,gt as w,ce as x,yt as y,Mt as z};
|
|
2
|
+
//# sourceMappingURL=LocalWorkspaceStorage-CsKd2UsW.js.map
|