@deephaven/embed-widget 0.102.1 → 0.102.2-beta.0
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-CidpSFPb.js → App-Cq_dubUx.js} +2 -2
- package/build/assets/{App-CidpSFPb.js.map → App-Cq_dubUx.js.map} +1 -1
- package/build/assets/{Chart-0SGAeaqR.js → Chart-CVA5BcqU.js} +2 -2
- package/build/assets/{Chart-0SGAeaqR.js.map → Chart-CVA5BcqU.js.map} +1 -1
- package/build/assets/{IrisGrid-KsNxbXwr.js → IrisGrid-CWqS4Ghs.js} +2 -2
- package/build/assets/{IrisGrid-KsNxbXwr.js.map → IrisGrid-CWqS4Ghs.js.map} +1 -1
- package/build/assets/{IrisGridThemeProvider-CqUDue5L.js → IrisGridThemeProvider-DQ4NPsB2.js} +2 -2
- package/build/assets/{IrisGridThemeProvider-CqUDue5L.js.map → IrisGridThemeProvider-DQ4NPsB2.js.map} +1 -1
- package/build/assets/{LocalWorkspaceStorage-CQLwlQk0.js → LocalWorkspaceStorage-CXQsWTct.js} +2 -2
- package/build/assets/{LocalWorkspaceStorage-CQLwlQk0.js.map → LocalWorkspaceStorage-CXQsWTct.js.map} +1 -1
- package/build/assets/{LogPanel-B35MgEAT.js → LogPanel-BRnY0qNZ.js} +2 -2
- package/build/assets/{LogPanel-B35MgEAT.js.map → LogPanel-BRnY0qNZ.js.map} +1 -1
- package/build/assets/{MarkdownEditor-PhXC6md-.js → MarkdownEditor-Ssjl3kkZ.js} +2 -2
- package/build/assets/{MarkdownEditor-PhXC6md-.js.map → MarkdownEditor-Ssjl3kkZ.js.map} +1 -1
- package/build/assets/{MarkdownNotebook-jEgunXB1.js → MarkdownNotebook-3oHt8UVE.js} +2 -2
- package/build/assets/{MarkdownNotebook-jEgunXB1.js.map → MarkdownNotebook-3oHt8UVE.js.map} +1 -1
- package/build/assets/{index-bY_0wWke.js → index-DDWRrUAg.js} +5 -5
- package/build/assets/{index-bY_0wWke.js.map → index-DDWRrUAg.js.map} +1 -1
- package/build/assets/{index-D_npg5aN.js → index-DNKcxsUH.js} +2 -2
- package/build/assets/{index-D_npg5aN.js.map → index-DNKcxsUH.js.map} +1 -1
- package/build/assets/{index-z-BJyE7K.js → index-DS7nI-iv.js} +3 -3
- package/build/assets/{index-z-BJyE7K.js.map → index-DS7nI-iv.js.map} +1 -1
- package/build/assets/{index-CUJF8lx0.css → index-gTIOiWk4.css} +1 -1
- package/build/index.html +2 -2
- package/package.json +17 -17
package/build/assets/{LocalWorkspaceStorage-CQLwlQk0.js → LocalWorkspaceStorage-CXQsWTct.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as d,K as D,F as c,I as _,bj as de,L as fe,bk as he}from"./vendor-l7RFz9yv.js";import{L as A,q as ve,a as N}from"./index-z-BJyE7K.js";import{F as P,ag as K,G as me,u as pe,m as T,aa as be,ah as ge,ao as ye,aq as R,aE as Me,bA as we,aG as Se,aL as Pe,bB as Oe,aK as Ce,bC as xe,b3 as Ee,ax as Ie,a9 as De,aM as Te,bD as U,bE as B,bF as G,bG as k,ab as z,ac as Le,ad as je}from"./LogPanel-B35MgEAT.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=Ae(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ae(n){var e=Ne(n,"string");return typeof e=="symbol"?e:String(e)}function Ne(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 H=A.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=D.createRef(),this.oldFocus=document.activeElement,this.activeSubMenuRef=D.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}),H.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){H.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(me,{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(ve,{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:_({"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 Ct 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=D.createRef(),this.openMenu=D.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:_("context-menu-root",{active:r}),ref:this.container,children:e})}}function Re(n,e){var t=pe(),r=d.useMemo(()=>new t.CoreClient(n,e),[t,n,e]);return d.useEffect(()=>()=>{r.disconnect()},[r]),r}var se=d.createContext(null);function xt(n){var{serverUrl:e,options:t,children:r}=n,i=Re(e,t);return c.jsx(se.Provider,{value:i,children:r})}function Ue(){return T(se,"No Client available in useClient. Was code wrapped in ClientBootstrap or ClientContext.Provider?")}var Be=1e4;function Et(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Be;return new Promise((r,i)=>{var o,a=setTimeout(()=>{var u;(u=o)===null||u===void 0||u(),i(new be("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 Ge(n){var e=[...n.entries()].filter(t=>{var[,r]=t;return ye(r)||R(r)});return e.map(t=>{var[r,i]=t;if(R(i)){var{DashboardPlugin:o}=i;return c.jsx(o,{},r)}var{component:a}=i;return c.jsx(a,{},r)})}function It(){var n=ge(),e=d.useMemo(()=>Ge(n),[n]);return e}var Dt=d.createContext({}),Tt=d.createContext({}),ke=d.createContext(null);function J(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 ze(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?J(Object(t),!0).forEach(function(r){We(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):J(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function We(n,e,t){return e=He(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function He(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 Je=100,j=()=>{},Ze=Object.freeze({});function qe(n){var{id:e="default",children:t,emptyDashboard:r,layoutConfig:i,layoutSettings:o=Ze,onLayoutConfigChange:a=j,onGoldenLayoutChange:s=j,onLayoutInitialized:u=j,fallbackComponent:l=Oe,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=ze({},Me.makeDefaultLayout());S.settings===void 0&&(S.settings={}),Object.assign(S.settings,o),S.content=[];var y=new we(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(()=>de(()=>{g!=null&&g.isInitialised&&(g==null||g.updateSize())},Je),[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(Se.Provider,{value:g,children:c.jsx(Pe,{emptyDashboard:r,id:e,layout:g,layoutConfig:i,onLayoutChange:a,onLayoutInitialized:u,hydrate:m,dehydrate:f,panelWrapper:p,children:t})})]})}var Xe=["id","isActive","plugins"];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 q(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){Qe(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 Qe(n,e,t){return e=Ve(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ve(n){var e=et(n,"string");return typeof e=="symbol"?e:String(e)}function et(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 tt(n,e){if(n==null)return{};var t=nt(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 nt(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 rt(n){var{id:e,isActive:t,plugins:r}=n,i=tt(n,Xe),[o,a]=d.useState(t),s=fe(),u=d.useCallback(l=>{s(e===Ce?xe({layoutConfig:l}):Ee(e,{layoutConfig:l}))},[e,s]);return!o&&t&&a(!0),o?c.jsx(qe,q(q({id:e,onLayoutConfigChange:u},i),{},{children:r})):c.jsx(N,{})}var it=d.createContext(null);function X(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 ot(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(u){X(o,r,i,a,s,"next",u)}function s(u){X(o,r,i,a,s,"throw",u)}a(void 0)})}}var ue=d.createContext(null);function Lt(n){var{children:e}=n,t=Ue(),[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=ot(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(ue.Provider,{value:r,children:e})}function jt(){return T(ue,"No server config available in useServerConfig. Was code wrapped in ServerConfigBootstrap or ServerConfigContext.Provider?")}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 at(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)})}}function V(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 ee(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?V(Object(t),!0).forEach(function(r){st(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):V(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function st(n,e,t){return e=ut(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ut(n){var e=lt(n,"string");return typeof e=="symbol"?e:String(e)}function lt(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 Ft(n){var{dashboards:e,activeDashboard:t,onLayoutInitialized:r,onGoldenLayoutChange:i,plugins:o,emptyDashboard:a=c.jsx(N,{})}=n,s=De(),u=d.useCallback((l,m)=>{var{metadata:f}=l;try{if(f!=null)return ee(ee({fetch:function(){var p=at(function*(){return s(f)});function b(){return p.apply(this,arguments)}return b}()},l),{},{localDashboardId:m})}catch{}return Te.hydrate(l,m)},[s]);return c.jsx("div",{className:"tab-content",children:e.map(l=>c.jsx("div",{className:_("tab-pane",{active:l.id===t}),children:c.jsx(rt,{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(it,"No IdeConnection available in useConnection. Was code wrapped in ConnectionContext.Provider?")}function At(){return T(ke,"No user available in useUser. Was code wrapped in UserBootstrap or UserContext.Provider?")}function te(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 ne(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(u){te(o,r,i,a,s,"next",u)}function s(u){te(o,r,i,a,s,"throw",u)}a(void 0)})}}function re(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)}class Nt{constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";re(this,"storageService",void 0),re(this,"root",void 0),this.storageService=e,this.root=t}getLayouts(){var e=this;return ne(function*(){var t=yield e.storageService.listItems(e.root,"*.json");return t.map(r=>r.basename)})()}getLayout(e){var t=this;return ne(function*(){var r=yield t.storageService.loadFile("".concat(t.root,"/").concat(e)),i=yield r.text();return JSON.parse(i)})()}}function ft(n){return n.version===2}function ht(n){return Array.isArray(n)}function ie(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 vt(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(u){ie(o,r,i,a,s,"next",u)}function s(u){ie(o,r,i,a,s,"throw",u)}a(void 0)})}}var E=A.module("UserLayoutUtils"),mt={layoutConfig:[{type:"column",content:[{type:"row",height:40,content:[{type:"stack",content:[{type:"react-component",component:U.COMPONENT,title:U.TITLE,isClosable:!1},{type:"react-component",component:B.COMPONENT,title:B.TITLE,isClosable:!1}]},{type:"stack",width:25,content:[{type:"react-component",component:G.COMPONENT,title:G.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},pt={layoutConfig:[],links:[],filterSets:[],version:2};function le(n){if(ft(n))return n;if(ht(n)){var e=n;return{layoutConfig:e,links:[],filterSets:[],version:2}}throw new Error("Unexpected layout import format: ".concat(n))}function bt(n){return F.apply(this,arguments)}function F(){return F=vt(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 le(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?mt:pt}),F.apply(this,arguments)}function gt(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 yt={exportLayout:gt,getDefaultLayout:bt,normalizeLayout:le};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 I(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)})}}function ce(n,e,t){return e=Mt(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Mt(n){var e=wt(n,"string");return typeof e=="symbol"?e:String(e)}function wt(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 ae=A.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{ae.error("Unable to parse JSON server config for key ".concat(t,". Value: ").concat(r));return}}static makeDefaultWorkspaceSettings(e){var t={defaultDateTimeFormat:z.DEFAULT_DATETIME_FORMAT_STRING,formatter:[],timeZone:z.DEFAULT_TIME_ZONE_ID,showTimeZone:!1,showTSeparator:!0,disableMoveConfirmation:!1,defaultDecimalFormatOptions:{defaultFormatString:Le.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:je.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 he({},t,r)}static makeWorkspaceData(e,t){return I(function*(){var{filterSets:r,links:i,layoutConfig:o,pluginDataMap:a={}}=yield yt.getDefaultLayout(e,t==null?void 0:t.isConsoleAvailable);return{settings:{},layoutConfig:o,closed:[{}],links:i,filterSets:r,pluginDataMap:a}})()}static makeDefaultWorkspace(e,t){return I(function*(){return{data:yield h.makeWorkspaceData(e,t)}})()}constructor(e){ce(this,"layoutStorage",void 0),this.layoutStorage=e}load(e){var t=this;return I(function*(){try{var r,i=JSON.parse((r=localStorage.getItem(h.STORAGE_KEY))!==null&&r!==void 0?r:"");return i}catch{return ae.info("Unable to load workspace data, initializing to default data"),h.makeDefaultWorkspace(t.layoutStorage,e)}})()}save(e){return I(function*(){return localStorage.setItem(h.STORAGE_KEY,JSON.stringify(e)),e})()}}ce(h,"STORAGE_KEY","deephaven.WorkspaceStorage");export{Ft as A,Ct as C,qe as D,Be as F,Nt as G,h as L,Lt as S,Tt as U,Ue as a,At as b,jt as c,It as d,Fe as e,Et as f,xt as g,se as h,Ge as i,ke as j,Dt as k,rt as l,it as m,yt as n,ft as o,ht as p,mt as q,pt as r,le as s,bt as t,_t as u,gt as v};
|
|
2
|
-
//# sourceMappingURL=LocalWorkspaceStorage-
|
|
1
|
+
import{r as d,K as D,F as c,I as _,bj as de,L as fe,bk as he}from"./vendor-l7RFz9yv.js";import{L as A,q as ve,a as N}from"./index-DS7nI-iv.js";import{F as P,ag as K,G as me,u as pe,m as T,aa as be,ah as ge,ao as ye,aq as R,aE as Me,bA as we,aG as Se,aL as Pe,bB as Oe,aK as Ce,bC as xe,b3 as Ee,ax as Ie,a9 as De,aM as Te,bD as U,bE as B,bF as G,bG as k,ab as z,ac as Le,ad as je}from"./LogPanel-BRnY0qNZ.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=Ae(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ae(n){var e=Ne(n,"string");return typeof e=="symbol"?e:String(e)}function Ne(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 H=A.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=D.createRef(),this.oldFocus=document.activeElement,this.activeSubMenuRef=D.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}),H.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){H.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(me,{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(ve,{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:_({"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 Ct 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=D.createRef(),this.openMenu=D.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:_("context-menu-root",{active:r}),ref:this.container,children:e})}}function Re(n,e){var t=pe(),r=d.useMemo(()=>new t.CoreClient(n,e),[t,n,e]);return d.useEffect(()=>()=>{r.disconnect()},[r]),r}var se=d.createContext(null);function xt(n){var{serverUrl:e,options:t,children:r}=n,i=Re(e,t);return c.jsx(se.Provider,{value:i,children:r})}function Ue(){return T(se,"No Client available in useClient. Was code wrapped in ClientBootstrap or ClientContext.Provider?")}var Be=1e4;function Et(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Be;return new Promise((r,i)=>{var o,a=setTimeout(()=>{var u;(u=o)===null||u===void 0||u(),i(new be("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 Ge(n){var e=[...n.entries()].filter(t=>{var[,r]=t;return ye(r)||R(r)});return e.map(t=>{var[r,i]=t;if(R(i)){var{DashboardPlugin:o}=i;return c.jsx(o,{},r)}var{component:a}=i;return c.jsx(a,{},r)})}function It(){var n=ge(),e=d.useMemo(()=>Ge(n),[n]);return e}var Dt=d.createContext({}),Tt=d.createContext({}),ke=d.createContext(null);function J(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 ze(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?J(Object(t),!0).forEach(function(r){We(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):J(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function We(n,e,t){return e=He(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function He(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 Je=100,j=()=>{},Ze=Object.freeze({});function qe(n){var{id:e="default",children:t,emptyDashboard:r,layoutConfig:i,layoutSettings:o=Ze,onLayoutConfigChange:a=j,onGoldenLayoutChange:s=j,onLayoutInitialized:u=j,fallbackComponent:l=Oe,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=ze({},Me.makeDefaultLayout());S.settings===void 0&&(S.settings={}),Object.assign(S.settings,o),S.content=[];var y=new we(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(()=>de(()=>{g!=null&&g.isInitialised&&(g==null||g.updateSize())},Je),[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(Se.Provider,{value:g,children:c.jsx(Pe,{emptyDashboard:r,id:e,layout:g,layoutConfig:i,onLayoutChange:a,onLayoutInitialized:u,hydrate:m,dehydrate:f,panelWrapper:p,children:t})})]})}var Xe=["id","isActive","plugins"];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 q(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){Qe(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 Qe(n,e,t){return e=Ve(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ve(n){var e=et(n,"string");return typeof e=="symbol"?e:String(e)}function et(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 tt(n,e){if(n==null)return{};var t=nt(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 nt(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 rt(n){var{id:e,isActive:t,plugins:r}=n,i=tt(n,Xe),[o,a]=d.useState(t),s=fe(),u=d.useCallback(l=>{s(e===Ce?xe({layoutConfig:l}):Ee(e,{layoutConfig:l}))},[e,s]);return!o&&t&&a(!0),o?c.jsx(qe,q(q({id:e,onLayoutConfigChange:u},i),{},{children:r})):c.jsx(N,{})}var it=d.createContext(null);function X(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 ot(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(u){X(o,r,i,a,s,"next",u)}function s(u){X(o,r,i,a,s,"throw",u)}a(void 0)})}}var ue=d.createContext(null);function Lt(n){var{children:e}=n,t=Ue(),[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=ot(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(ue.Provider,{value:r,children:e})}function jt(){return T(ue,"No server config available in useServerConfig. Was code wrapped in ServerConfigBootstrap or ServerConfigContext.Provider?")}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 at(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)})}}function V(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 ee(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?V(Object(t),!0).forEach(function(r){st(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):V(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function st(n,e,t){return e=ut(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ut(n){var e=lt(n,"string");return typeof e=="symbol"?e:String(e)}function lt(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 Ft(n){var{dashboards:e,activeDashboard:t,onLayoutInitialized:r,onGoldenLayoutChange:i,plugins:o,emptyDashboard:a=c.jsx(N,{})}=n,s=De(),u=d.useCallback((l,m)=>{var{metadata:f}=l;try{if(f!=null)return ee(ee({fetch:function(){var p=at(function*(){return s(f)});function b(){return p.apply(this,arguments)}return b}()},l),{},{localDashboardId:m})}catch{}return Te.hydrate(l,m)},[s]);return c.jsx("div",{className:"tab-content",children:e.map(l=>c.jsx("div",{className:_("tab-pane",{active:l.id===t}),children:c.jsx(rt,{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(it,"No IdeConnection available in useConnection. Was code wrapped in ConnectionContext.Provider?")}function At(){return T(ke,"No user available in useUser. Was code wrapped in UserBootstrap or UserContext.Provider?")}function te(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 ne(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(u){te(o,r,i,a,s,"next",u)}function s(u){te(o,r,i,a,s,"throw",u)}a(void 0)})}}function re(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)}class Nt{constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";re(this,"storageService",void 0),re(this,"root",void 0),this.storageService=e,this.root=t}getLayouts(){var e=this;return ne(function*(){var t=yield e.storageService.listItems(e.root,"*.json");return t.map(r=>r.basename)})()}getLayout(e){var t=this;return ne(function*(){var r=yield t.storageService.loadFile("".concat(t.root,"/").concat(e)),i=yield r.text();return JSON.parse(i)})()}}function ft(n){return n.version===2}function ht(n){return Array.isArray(n)}function ie(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 vt(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(u){ie(o,r,i,a,s,"next",u)}function s(u){ie(o,r,i,a,s,"throw",u)}a(void 0)})}}var E=A.module("UserLayoutUtils"),mt={layoutConfig:[{type:"column",content:[{type:"row",height:40,content:[{type:"stack",content:[{type:"react-component",component:U.COMPONENT,title:U.TITLE,isClosable:!1},{type:"react-component",component:B.COMPONENT,title:B.TITLE,isClosable:!1}]},{type:"stack",width:25,content:[{type:"react-component",component:G.COMPONENT,title:G.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},pt={layoutConfig:[],links:[],filterSets:[],version:2};function le(n){if(ft(n))return n;if(ht(n)){var e=n;return{layoutConfig:e,links:[],filterSets:[],version:2}}throw new Error("Unexpected layout import format: ".concat(n))}function bt(n){return F.apply(this,arguments)}function F(){return F=vt(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 le(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?mt:pt}),F.apply(this,arguments)}function gt(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 yt={exportLayout:gt,getDefaultLayout:bt,normalizeLayout:le};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 I(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)})}}function ce(n,e,t){return e=Mt(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Mt(n){var e=wt(n,"string");return typeof e=="symbol"?e:String(e)}function wt(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 ae=A.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{ae.error("Unable to parse JSON server config for key ".concat(t,". Value: ").concat(r));return}}static makeDefaultWorkspaceSettings(e){var t={defaultDateTimeFormat:z.DEFAULT_DATETIME_FORMAT_STRING,formatter:[],timeZone:z.DEFAULT_TIME_ZONE_ID,showTimeZone:!1,showTSeparator:!0,disableMoveConfirmation:!1,defaultDecimalFormatOptions:{defaultFormatString:Le.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:je.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 he({},t,r)}static makeWorkspaceData(e,t){return I(function*(){var{filterSets:r,links:i,layoutConfig:o,pluginDataMap:a={}}=yield yt.getDefaultLayout(e,t==null?void 0:t.isConsoleAvailable);return{settings:{},layoutConfig:o,closed:[{}],links:i,filterSets:r,pluginDataMap:a}})()}static makeDefaultWorkspace(e,t){return I(function*(){return{data:yield h.makeWorkspaceData(e,t)}})()}constructor(e){ce(this,"layoutStorage",void 0),this.layoutStorage=e}load(e){var t=this;return I(function*(){try{var r,i=JSON.parse((r=localStorage.getItem(h.STORAGE_KEY))!==null&&r!==void 0?r:"");return i}catch{return ae.info("Unable to load workspace data, initializing to default data"),h.makeDefaultWorkspace(t.layoutStorage,e)}})()}save(e){return I(function*(){return localStorage.setItem(h.STORAGE_KEY,JSON.stringify(e)),e})()}}ce(h,"STORAGE_KEY","deephaven.WorkspaceStorage");export{Ft as A,Ct as C,qe as D,Be as F,Nt as G,h as L,Lt as S,Tt as U,Ue as a,At as b,jt as c,It as d,Fe as e,Et as f,xt as g,se as h,Ge as i,ke as j,Dt as k,rt as l,it as m,yt as n,ft as o,ht as p,mt as q,pt as r,le as s,bt as t,_t as u,gt as v};
|
|
2
|
+
//# sourceMappingURL=LocalWorkspaceStorage-CXQsWTct.js.map
|