@deephaven/embed-widget 0.94.1-beta.0 → 0.95.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-vPsYNR01.js → App-CwWtBiu-.js} +2 -2
- package/build/assets/App-CwWtBiu-.js.map +1 -0
- package/build/assets/{Chart-CUs2-mEg.js → Chart-B9rJzMrh.js} +2 -2
- package/build/assets/{Chart-CUs2-mEg.js.map → Chart-B9rJzMrh.js.map} +1 -1
- package/build/assets/{IrisGrid-D_SGNZes.js → IrisGrid-ByKbOZWm.js} +2 -2
- package/build/assets/{IrisGrid-D_SGNZes.js.map → IrisGrid-ByKbOZWm.js.map} +1 -1
- package/build/assets/{IrisGridThemeProvider-C-DoZoXl.js → IrisGridThemeProvider-irJImttC.js} +2 -2
- package/build/assets/{IrisGridThemeProvider-C-DoZoXl.js.map → IrisGridThemeProvider-irJImttC.js.map} +1 -1
- package/build/assets/{LocalWorkspaceStorage-CzVXUxd1.js → LocalWorkspaceStorage-BQlmJTPe.js} +2 -2
- package/build/assets/{LocalWorkspaceStorage-CzVXUxd1.js.map → LocalWorkspaceStorage-BQlmJTPe.js.map} +1 -1
- package/build/assets/{LogPanel-gMkgqISt.js → LogPanel-Cg9vSmXC.js} +2 -2
- package/build/assets/{LogPanel-gMkgqISt.js.map → LogPanel-Cg9vSmXC.js.map} +1 -1
- package/build/assets/{MarkdownEditor-BVCv6ylL.js → MarkdownEditor-1zeOkM33.js} +2 -2
- package/build/assets/{MarkdownEditor-BVCv6ylL.js.map → MarkdownEditor-1zeOkM33.js.map} +1 -1
- package/build/assets/{MarkdownNotebook-Ibb5qpfx.js → MarkdownNotebook-qBBOf8vq.js} +2 -2
- package/build/assets/{MarkdownNotebook-Ibb5qpfx.js.map → MarkdownNotebook-qBBOf8vq.js.map} +1 -1
- package/build/assets/{index-s64cc-h1.js → index-8fWKJDT0.js} +3 -3
- package/build/assets/{index-s64cc-h1.js.map → index-8fWKJDT0.js.map} +1 -1
- package/build/assets/index-Bpe4NMaa.css +1 -0
- package/build/assets/{index-Ce427kBv.js → index-C9ztydsU.js} +10 -10
- package/build/assets/index-C9ztydsU.js.map +1 -0
- package/build/assets/{index-BeeiJfkN.js → index-C_ypwWX8.js} +2 -2
- package/build/assets/{index-BeeiJfkN.js.map → index-C_ypwWX8.js.map} +1 -1
- package/build/index.html +2 -2
- package/package.json +17 -17
- package/build/assets/App-vPsYNR01.js.map +0 -1
- package/build/assets/index-CJv3wXAl.css +0 -1
- package/build/assets/index-Ce427kBv.js.map +0 -1
package/build/assets/{LocalWorkspaceStorage-CzVXUxd1.js → LocalWorkspaceStorage-BQlmJTPe.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as d,J as I,E as c,H as A,b1 as de,K as fe}from"./vendor-C-mCkYSI.js";import{L as F,q as he,a as N}from"./index-s64cc-h1.js";import{z as S,ad as K,A as ve,u as me,l as T,a8 as pe,ae as be,al as ge,an as U,aB as ye,bo as Me,aD as we,aG as Pe,bp as Se,aF as Oe,bq as Ce,aW as xe,au as Ee,a7 as De,aH as Ie,br as B,bs as G,bt as z,bu as W,a9 as k,aa as Te,ab as Le}from"./LogPanel-gMkgqISt.js";function je(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 H(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?H(Object(t),!0).forEach(function(r){M(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):H(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=Fe(n,"string");return typeof e=="symbol"?e:String(e)}function Fe(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 Y=F.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=S.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:S.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:S.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}),Y.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:h}=(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;h===0||b===0||(f+h>window.innerHeight&&(f-h-u>0?f-=h-u:f=window.innerHeight-h),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){Y.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=S.getNextMenuItem(i,-1,t):(e.key==="ArrowDown"||e.key==="Tab")&&(i=S.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,h=0;h<s.length;h+=1){var w=s[h];h>0&&w.group!==s[h-1].group&&e.push(c.jsx("hr",{},"".concat(h,".separator")));var g=c.jsx(ve,{ref:i===h?this.activeSubMenuRef:null,isKeyboardSelected:a===h,isMouseSelected:u===h,menuItem:w,closeMenu:this.handleCloseSubMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:this.handleMenuItemContextMenu},h);e.push(g)}var O=null;l.length>0&&(O=c.jsx("div",{className:"loading",children:c.jsx(he,{className:"loading-spinner-vertical-align"})}));var{menuStyle:L,"data-testid":$}=this.props,P=i!==null&&m!==null&&f!==null;return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:A({"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]}),P&&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 Z(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)}class xt extends d.Component{constructor(e){super(e),Z(this,"container",void 0),Z(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(S.isContextActionEvent(e)&&!(e.metaKey||e.ctrlKey)){var a=S.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:A("context-menu-root",{active:r}),ref:this.container,children:e})}}function $e(n,e){var t=me(),r=d.useMemo(()=>new t.CoreClient(n,e),[t,n,e]);return d.useEffect(()=>()=>{r.disconnect()},[r]),r}var se=d.createContext(null);function Et(n){var{serverUrl:e,options:t,children:r}=n,i=$e(e,t);return c.jsx(se.Provider,{value:i,children:r})}function Ke(){return T(se,"No Client available in useClient. Was code wrapped in ClientBootstrap or ClientContext.Provider?")}var Ue=1e4;function Dt(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ue;return new Promise((r,i)=>{var o,a=setTimeout(()=>{var u;(u=o)===null||u===void 0||u(),i(new pe("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 Be(n){var e=[...n.entries()].filter(t=>{var[,r]=t;return ge(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 It(){var n=be(),e=d.useMemo(()=>Be(n),[n]);return e}var Tt=d.createContext({}),Lt=d.createContext({}),Ge=d.createContext(null);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 ze(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){We(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 We(n,e,t){return e=ke(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ke(n){var e=He(n,"string");return typeof e=="symbol"?e:String(e)}function He(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 Ye=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=Se,hydrate:m,dehydrate:f,panelWrapper:p}=n,b=d.useRef(null),[h,w]=d.useState(!1),[g,O]=d.useState();d.useEffect(function(){if(!b.current){O(void 0);return}var P=ze({},ye.makeDefaultLayout());P.settings===void 0&&(P.settings={}),Object.assign(P.settings,o),P.content=[];var y=new Me(P,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())},Ye),[g]);return je(b.current,L),c.jsxs("div",{className:"dashboard-container w-100 h-100",children:[c.jsx("div",{className:"w-100 h-100",ref:b}),h&&g&&c.jsx(we.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 R="CREATE_DASHBOARD";function Je(n,e){try{n.off(R,e)}catch{}}function jt(n,e){return n.on(R,e),()=>Je(n,e)}function _t(n,e){n.emit(R,e)}var Xe=["id","isActive","plugins"];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 X(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){Qe(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 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===Oe?Ce({layoutConfig:l}):xe(e,{layoutConfig:l}))},[e,s]);return!o&&t&&a(!0),o?c.jsx(qe,X(X({id:e,onLayoutConfigChange:u},i),{},{children:r})):c.jsx(N,{})}var it=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 ot(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 ue=d.createContext(null);function At(n){var{children:e}=n,t=Ke(),[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:Ee(o)}):c.jsx(ue.Provider,{value:r,children:e})}function Ft(){return T(ue,"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 at(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){st(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 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 Nt(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 te(te({fetch:function(){var p=at(function*(){return s(f)});function b(){return p.apply(this,arguments)}return b}()},l),{},{localDashboardId:m})}catch{}return Ie.hydrate(l,m)},[s]);return c.jsx("div",{className:"tab-content",children:e.map(l=>c.jsx("div",{className:A("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 Rt(){return T(it,"No IdeConnection available in useConnection. Was code wrapped in ConnectionContext.Provider?")}function $t(){return T(Ge,"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=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 Kt{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 ft(n){return n.version===2}function ht(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 vt(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=F.module("UserLayoutUtils"),mt={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:W.COMPONENT,title:W.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 _.apply(this,arguments)}function _(){return _=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}),_.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 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 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 Pt=F.module("LocalWorkspaceStorage");class v{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 makeDefaultWorkspaceSettings(e){for(var t={defaultDateTimeFormat:k.DEFAULT_DATETIME_FORMAT_STRING,formatter:[],timeZone:k.DEFAULT_TIME_ZONE_ID,showTimeZone:!1,showTSeparator:!0,disableMoveConfirmation:!1,defaultDecimalFormatOptions:{defaultFormatString:Te.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:Le.DEFAULT_FORMAT_STRING},truncateNumbersWithPound:!1,showEmptyStrings:!0,showNullStrings:!0,showExtraGroupColumn:!0,defaultNotebookSettings:{isMinimapEnabled:!1},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:v.getBooleanServerConfig(e,"showTimeZone"),showTSeparator:v.getBooleanServerConfig(e,"showTSeparator"),disableMoveConfirmation:v.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:v.getBooleanServerConfig(e,"truncateNumbersWithPound"),showEmptyStrings:v.getBooleanServerConfig(e,"showEmptyStrings"),showNullStrings:v.getBooleanServerConfig(e,"showNullStrings"),showExtraGroupColumn:v.getBooleanServerConfig(e,"showExtraGroupColumn"),defaultNotebookSettings:(e==null?void 0:e.get("isMinimapEnabled"))!==void 0?{isMinimapEnabled:v.getBooleanServerConfig(e,"isMinimapEnabled")}:void 0,webgl:v.getBooleanServerConfig(e,"web.webgl"),webglEditable:v.getBooleanServerConfig(e,"web.webgl.editable")},i=Object.keys(r),o=0;o<i.length;o+=1){var a=i[o];r[a]!==void 0&&(t[a]=r[a])}return t}static makeWorkspaceData(e,t){return D(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 D(function*(){return{data:yield v.makeWorkspaceData(e,t)}})()}constructor(e){ce(this,"layoutStorage",void 0),this.layoutStorage=e}load(e){var t=this;return D(function*(){try{var r,i=JSON.parse((r=localStorage.getItem(v.STORAGE_KEY))!==null&&r!==void 0?r:"");return i}catch{return Pt.info("Unable to load workspace data, initializing to default data"),v.makeDefaultWorkspace(t.layoutStorage,e)}})()}save(e){return D(function*(){return localStorage.setItem(v.STORAGE_KEY,JSON.stringify(e)),e})()}}ce(v,"STORAGE_KEY","deephaven.WorkspaceStorage");export{Nt as A,xt as C,qe as D,Ue as F,Kt as G,v as L,At as S,Lt as U,Ke as a,$t as b,Ft as c,It as d,je as e,Dt as f,Et as g,se as h,Be as i,Ge as j,Tt as k,jt as l,R as m,rt as n,_t as o,it as p,yt as q,ft as r,Je as s,ht as t,Rt as u,mt as v,pt as w,le as x,bt as y,gt as z};
|
|
2
|
-
//# sourceMappingURL=LocalWorkspaceStorage-
|
|
1
|
+
import{r as d,J as I,E as c,H as A,b1 as de,K as fe}from"./vendor-C-mCkYSI.js";import{L as F,q as he,a as N}from"./index-8fWKJDT0.js";import{z as S,ad as K,A as ve,u as me,l as T,a8 as pe,ae as be,al as ge,an as U,aB as ye,bo as Me,aD as we,aG as Pe,bp as Se,aF as Oe,bq as Ce,aW as xe,au as Ee,a7 as De,aH as Ie,br as B,bs as G,bt as z,bu as W,a9 as k,aa as Te,ab as Le}from"./LogPanel-Cg9vSmXC.js";function je(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 H(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?H(Object(t),!0).forEach(function(r){M(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):H(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=Fe(n,"string");return typeof e=="symbol"?e:String(e)}function Fe(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 Y=F.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=S.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:S.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:S.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}),Y.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:h}=(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;h===0||b===0||(f+h>window.innerHeight&&(f-h-u>0?f-=h-u:f=window.innerHeight-h),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){Y.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=S.getNextMenuItem(i,-1,t):(e.key==="ArrowDown"||e.key==="Tab")&&(i=S.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,h=0;h<s.length;h+=1){var w=s[h];h>0&&w.group!==s[h-1].group&&e.push(c.jsx("hr",{},"".concat(h,".separator")));var g=c.jsx(ve,{ref:i===h?this.activeSubMenuRef:null,isKeyboardSelected:a===h,isMouseSelected:u===h,menuItem:w,closeMenu:this.handleCloseSubMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:this.handleMenuItemContextMenu},h);e.push(g)}var O=null;l.length>0&&(O=c.jsx("div",{className:"loading",children:c.jsx(he,{className:"loading-spinner-vertical-align"})}));var{menuStyle:L,"data-testid":$}=this.props,P=i!==null&&m!==null&&f!==null;return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:A({"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]}),P&&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 Z(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)}class xt extends d.Component{constructor(e){super(e),Z(this,"container",void 0),Z(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(S.isContextActionEvent(e)&&!(e.metaKey||e.ctrlKey)){var a=S.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:A("context-menu-root",{active:r}),ref:this.container,children:e})}}function $e(n,e){var t=me(),r=d.useMemo(()=>new t.CoreClient(n,e),[t,n,e]);return d.useEffect(()=>()=>{r.disconnect()},[r]),r}var se=d.createContext(null);function Et(n){var{serverUrl:e,options:t,children:r}=n,i=$e(e,t);return c.jsx(se.Provider,{value:i,children:r})}function Ke(){return T(se,"No Client available in useClient. Was code wrapped in ClientBootstrap or ClientContext.Provider?")}var Ue=1e4;function Dt(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ue;return new Promise((r,i)=>{var o,a=setTimeout(()=>{var u;(u=o)===null||u===void 0||u(),i(new pe("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 Be(n){var e=[...n.entries()].filter(t=>{var[,r]=t;return ge(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 It(){var n=be(),e=d.useMemo(()=>Be(n),[n]);return e}var Tt=d.createContext({}),Lt=d.createContext({}),Ge=d.createContext(null);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 ze(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){We(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 We(n,e,t){return e=ke(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ke(n){var e=He(n,"string");return typeof e=="symbol"?e:String(e)}function He(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 Ye=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=Se,hydrate:m,dehydrate:f,panelWrapper:p}=n,b=d.useRef(null),[h,w]=d.useState(!1),[g,O]=d.useState();d.useEffect(function(){if(!b.current){O(void 0);return}var P=ze({},ye.makeDefaultLayout());P.settings===void 0&&(P.settings={}),Object.assign(P.settings,o),P.content=[];var y=new Me(P,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())},Ye),[g]);return je(b.current,L),c.jsxs("div",{className:"dashboard-container w-100 h-100",children:[c.jsx("div",{className:"w-100 h-100",ref:b}),h&&g&&c.jsx(we.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 R="CREATE_DASHBOARD";function Je(n,e){try{n.off(R,e)}catch{}}function jt(n,e){return n.on(R,e),()=>Je(n,e)}function _t(n,e){n.emit(R,e)}var Xe=["id","isActive","plugins"];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 X(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){Qe(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 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===Oe?Ce({layoutConfig:l}):xe(e,{layoutConfig:l}))},[e,s]);return!o&&t&&a(!0),o?c.jsx(qe,X(X({id:e,onLayoutConfigChange:u},i),{},{children:r})):c.jsx(N,{})}var it=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 ot(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 ue=d.createContext(null);function At(n){var{children:e}=n,t=Ke(),[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:Ee(o)}):c.jsx(ue.Provider,{value:r,children:e})}function Ft(){return T(ue,"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 at(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){st(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 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 Nt(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 te(te({fetch:function(){var p=at(function*(){return s(f)});function b(){return p.apply(this,arguments)}return b}()},l),{},{localDashboardId:m})}catch{}return Ie.hydrate(l,m)},[s]);return c.jsx("div",{className:"tab-content",children:e.map(l=>c.jsx("div",{className:A("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 Rt(){return T(it,"No IdeConnection available in useConnection. Was code wrapped in ConnectionContext.Provider?")}function $t(){return T(Ge,"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=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 Kt{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 ft(n){return n.version===2}function ht(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 vt(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=F.module("UserLayoutUtils"),mt={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:W.COMPONENT,title:W.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 _.apply(this,arguments)}function _(){return _=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}),_.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 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 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 Pt=F.module("LocalWorkspaceStorage");class v{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 makeDefaultWorkspaceSettings(e){for(var t={defaultDateTimeFormat:k.DEFAULT_DATETIME_FORMAT_STRING,formatter:[],timeZone:k.DEFAULT_TIME_ZONE_ID,showTimeZone:!1,showTSeparator:!0,disableMoveConfirmation:!1,defaultDecimalFormatOptions:{defaultFormatString:Te.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:Le.DEFAULT_FORMAT_STRING},truncateNumbersWithPound:!1,showEmptyStrings:!0,showNullStrings:!0,showExtraGroupColumn:!0,defaultNotebookSettings:{isMinimapEnabled:!1},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:v.getBooleanServerConfig(e,"showTimeZone"),showTSeparator:v.getBooleanServerConfig(e,"showTSeparator"),disableMoveConfirmation:v.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:v.getBooleanServerConfig(e,"truncateNumbersWithPound"),showEmptyStrings:v.getBooleanServerConfig(e,"showEmptyStrings"),showNullStrings:v.getBooleanServerConfig(e,"showNullStrings"),showExtraGroupColumn:v.getBooleanServerConfig(e,"showExtraGroupColumn"),defaultNotebookSettings:(e==null?void 0:e.get("isMinimapEnabled"))!==void 0?{isMinimapEnabled:v.getBooleanServerConfig(e,"isMinimapEnabled")}:void 0,webgl:v.getBooleanServerConfig(e,"web.webgl"),webglEditable:v.getBooleanServerConfig(e,"web.webgl.editable")},i=Object.keys(r),o=0;o<i.length;o+=1){var a=i[o];r[a]!==void 0&&(t[a]=r[a])}return t}static makeWorkspaceData(e,t){return D(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 D(function*(){return{data:yield v.makeWorkspaceData(e,t)}})()}constructor(e){ce(this,"layoutStorage",void 0),this.layoutStorage=e}load(e){var t=this;return D(function*(){try{var r,i=JSON.parse((r=localStorage.getItem(v.STORAGE_KEY))!==null&&r!==void 0?r:"");return i}catch{return Pt.info("Unable to load workspace data, initializing to default data"),v.makeDefaultWorkspace(t.layoutStorage,e)}})()}save(e){return D(function*(){return localStorage.setItem(v.STORAGE_KEY,JSON.stringify(e)),e})()}}ce(v,"STORAGE_KEY","deephaven.WorkspaceStorage");export{Nt as A,xt as C,qe as D,Ue as F,Kt as G,v as L,At as S,Lt as U,Ke as a,$t as b,Ft as c,It as d,je as e,Dt as f,Et as g,se as h,Be as i,Ge as j,Tt as k,jt as l,R as m,rt as n,_t as o,it as p,yt as q,ft as r,Je as s,ht as t,Rt as u,mt as v,pt as w,le as x,bt as y,gt as z};
|
|
2
|
+
//# sourceMappingURL=LocalWorkspaceStorage-BQlmJTPe.js.map
|