@deephaven/dashboard 1.7.1 → 1.7.2-beta.3

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.
Files changed (65) hide show
  1. package/dist/BasePanel.js +14 -17
  2. package/dist/BasePanel.js.map +1 -1
  3. package/dist/Dashboard.js +2 -3
  4. package/dist/Dashboard.js.map +1 -1
  5. package/dist/DashboardConstants.js.map +1 -1
  6. package/dist/DashboardEvents.js.map +1 -1
  7. package/dist/DashboardLayout.d.ts +4 -30
  8. package/dist/DashboardLayout.d.ts.map +1 -1
  9. package/dist/DashboardLayout.js +4 -17
  10. package/dist/DashboardLayout.js.map +1 -1
  11. package/dist/DashboardPanelWrapper.js +1 -2
  12. package/dist/DashboardPanelWrapper.js.map +1 -1
  13. package/dist/DashboardPlugin.d.ts +13 -4
  14. package/dist/DashboardPlugin.d.ts.map +1 -1
  15. package/dist/DashboardPlugin.js +12 -0
  16. package/dist/DashboardPlugin.js.map +1 -1
  17. package/dist/DashboardUtils.d.ts +2 -2
  18. package/dist/DashboardUtils.d.ts.map +1 -1
  19. package/dist/DashboardUtils.js +1 -2
  20. package/dist/DashboardUtils.js.map +1 -1
  21. package/dist/LazyDashboard.js.map +1 -1
  22. package/dist/NavigationEvent.js.map +1 -1
  23. package/dist/PanelContextMenu.d.ts +3 -3
  24. package/dist/PanelContextMenu.d.ts.map +1 -1
  25. package/dist/PanelContextMenu.js +12 -14
  26. package/dist/PanelContextMenu.js.map +1 -1
  27. package/dist/PanelErrorBoundary.js.map +1 -1
  28. package/dist/PanelEvent.js.map +1 -1
  29. package/dist/PanelManager.d.ts +3 -3
  30. package/dist/PanelManager.d.ts.map +1 -1
  31. package/dist/PanelManager.js +10 -11
  32. package/dist/PanelManager.js.map +1 -1
  33. package/dist/PanelPlaceholder.d.ts +1 -4
  34. package/dist/PanelPlaceholder.d.ts.map +1 -1
  35. package/dist/PanelPlaceholder.js +1 -2
  36. package/dist/PanelPlaceholder.js.map +1 -1
  37. package/dist/RenameDialog.js +3 -4
  38. package/dist/RenameDialog.js.map +1 -1
  39. package/dist/TabEvent.js.map +1 -1
  40. package/dist/declaration.d.js.map +1 -1
  41. package/dist/index.js.map +1 -1
  42. package/dist/layout/GLPropTypes.js.map +1 -1
  43. package/dist/layout/LayoutManagerContext.js.map +1 -1
  44. package/dist/layout/LayoutUtils.d.ts +3 -3
  45. package/dist/layout/LayoutUtils.d.ts.map +1 -1
  46. package/dist/layout/LayoutUtils.js +5 -6
  47. package/dist/layout/LayoutUtils.js.map +1 -1
  48. package/dist/layout/index.js.map +1 -1
  49. package/dist/layout/useDashboardPanel.js.map +1 -1
  50. package/dist/layout/useLayoutManager.js.map +1 -1
  51. package/dist/layout/useListener.js.map +1 -1
  52. package/dist/layout/usePanelRegistration.js.map +1 -1
  53. package/dist/redux/actionTypes.js.map +1 -1
  54. package/dist/redux/actions.js.map +1 -1
  55. package/dist/redux/hooks.js.map +1 -1
  56. package/dist/redux/index.js.map +1 -1
  57. package/dist/redux/reducers/dashboardData.js.map +1 -1
  58. package/dist/redux/reducers/index.js.map +1 -1
  59. package/dist/redux/selectors.js.map +1 -1
  60. package/dist/useDashboardId.js.map +1 -1
  61. package/dist/useDhId.js.map +1 -1
  62. package/dist/useFiber.js +1 -1
  63. package/dist/useFiber.js.map +1 -1
  64. package/dist/usePanelId.js.map +1 -1
  65. package/package.json +10 -10
@@ -1 +1 @@
1
- {"version":3,"file":"LayoutUtils.js","names":["deepEqual","nanoid","isMatch","Log","isComponent","isRoot","isStack","GoldenLayoutThemeExport","assertNotNull","log","module","isComponentConfig","config","componentName","undefined","isReactComponentConfig","reactConfig","type","component","isHTMLElement","element","focus","isStackItemConfig","LayoutUtils","activateTab","root","stack","getStackForRoot","error","contentItem","getContentItemInStack","setActiveContentItem","isActiveTab","activeItem","getActiveContentItem","addStack","parent","columnPreferred","arguments","length","rowOrColConfig","contentItems","addChild","child","isCorrectType","isColumn","isRow","removeChild","maintainFocusElement","document","activeElement","newParent","_newParent$config","_newParent$config2","inverseRowOrColConfig","layoutManager","createContentItem","height","width","replaceChild","getAllStackContainers","layout","_findAllStackContainers","getFocusedStackIndex","allStacks","findIndex","header","tabs","some","tab","classList","contains","getFocusedStack","focusedStackIndex","getStackById","item","searchId","_item$config","allowEmptyStack","id","Error","concat","i","getContentItemById","_item$config2","getStackForConfig","createIfNecessary","matchComponentType","getStackForComponentTypes","types","isLastType","dehydrateLayoutConfig","dehydrateComponent","dehydratedConfig","itemConfig","content","dehydratedComponent","push","debug2","layoutItemConfig","_objectSpread","getTabPoint","glContainer","tabRect","getBoundingClientRect","left","bottom","dropLayoutMinorChange","activeItemIndex","props","panelState","irisGridState","sorts","quickFilters","gridState","isStuckToBottom","isStuckToRight","isEqual","layout1","layout2","major","layout1Clone","cloneLayout","layout2Clone","JSON","parse","stringify","hydrateLayoutConfig","hydrateComponent","hydratedConfig","_itemConfig$id","contentConfig","warn","openComponent","configParam","stackParam","replaceExisting","replaceConfig","createNewStack","focusElement","dragEvent","createDragSourceFromEvent","searchConfig","oldContentItem","onComponentCreated","event","debug","off","origin","requestAnimationFrame","on","index","indexOf","openComponentInStack","closeComponent","closeOptions","container","close","renameComponent","newTitle","setTitle","cloneComponent","getPanelComponentState","cloneConfig","title","_config$componentStat","componentState","_config$props","makeDefaultLayout","dimensions","headerHeight","tabHeight","borderWidth","dragBorderWidth","borderGrabWidth","settings","showPopoutIcon","showCloseIcon","constrainDragToContainer","getRootFromContainer","getComponentConfigFromContainer","_config","getTitleFromContainer","getTitleFromTab","getIdFromContainer","getIdFromPanel","panel","getComponentNameFromPanel","_config$component","getComponentName","_component$WrappedCom","_component$WrappedCom2","name","WrappedComponent","displayName","selector","DEFAULT_FOCUS_SELECTOR","querySelector","onInitialized","Promise","resolve","isInitialised","onInit","_defineProperty"],"sources":["../../src/layout/LayoutUtils.ts"],"sourcesContent":["import deepEqual from 'fast-deep-equal';\nimport { nanoid } from 'nanoid';\nimport isMatch from 'lodash.ismatch';\nimport Log from '@deephaven/log';\nimport type GoldenLayout from '@deephaven/golden-layout';\nimport {\n isComponent,\n isRoot,\n isStack,\n GoldenLayoutThemeExport,\n} from '@deephaven/golden-layout';\nimport type {\n ComponentConfig,\n Config,\n Container,\n ContentItem,\n ItemConfig,\n ReactComponentConfig,\n Stack,\n Tab,\n CloseOptions,\n GLPanelProps,\n} from '@deephaven/golden-layout';\nimport { assertNotNull, type Brand } from '@deephaven/utils';\nimport { type DashboardLayoutConfig } from '../DashboardLayout';\nimport { type PanelConfig } from '../DashboardPlugin';\n\nconst log = Log.module('LayoutUtils');\n\ntype LayoutConfig = { id?: string; component?: string };\n\nexport type PanelId = Brand<'PanelId', string | undefined>;\n\nexport type LayoutPanel = {\n props: GLPanelProps;\n};\n\nexport type StackItemConfig = ItemConfig & {\n activeItemIndex?: number;\n};\n\nfunction isComponentConfig(config: ItemConfig): config is ComponentConfig {\n return (config as ComponentConfig).componentName !== undefined;\n}\n\nexport function isReactComponentConfig(\n config: ItemConfig\n): config is ReactComponentConfig {\n const reactConfig = config as ReactComponentConfig;\n // Golden layout sets the type to 'component' and componentName to 'lm-react-component' in `createContentItem`, then changes it back in `toConfig`\n // For our purposes, we need to check both.\n return (\n ((isComponentConfig(config) &&\n config.componentName === 'lm-react-component') ||\n config.type === 'react-component') &&\n reactConfig.component !== undefined\n );\n}\n\nfunction isHTMLElement(element: Element): element is HTMLElement {\n return (element as HTMLElement).focus !== undefined;\n}\n\nfunction isStackItemConfig(config: ItemConfig): config is StackItemConfig {\n return config.type === 'stack';\n}\nclass LayoutUtils {\n static DEFAULT_FOCUS_SELECTOR = 'input, select, textarea, button';\n\n static activateTab(root: ContentItem, config: Partial<ItemConfig>): void {\n const stack = LayoutUtils.getStackForRoot(root, config, false);\n if (!stack) {\n log.error('Could not find stack for config', config);\n return;\n }\n // Find the tab with the specified table and activate it\n const contentItem = LayoutUtils.getContentItemInStack(stack, config);\n if (contentItem) {\n stack.setActiveContentItem(contentItem);\n }\n }\n\n /**\n * Is the tab with the given config active\n * @param root A GoldenLayout content item with the tab\n * @param config Tab config to match\n * @returns True if the tab is active\n */\n static isActiveTab(\n root: ContentItem,\n config: Partial<ReactComponentConfig>\n ): boolean {\n const stack = LayoutUtils.getStackForRoot(root, config, false);\n if (!stack) {\n log.error('Could not find stack for config', config);\n return false;\n }\n // Find the item with the specified config and compare with active item\n const contentItem = LayoutUtils.getContentItemInStack(stack, config);\n const activeItem = stack.getActiveContentItem();\n return activeItem === contentItem;\n }\n\n /**\n * Adds a stack to the root layout specified. Adds to the first row/column with only one item\n * @param parent A GoldenLayout content item to add the stack to\n * @returns The newly created stack.\n */\n static addStack(parent: ContentItem, columnPreferred = true): Stack {\n if (isRoot(parent)) {\n const rowOrColConfig: ItemConfig = {\n type: columnPreferred ? 'column' : 'row',\n };\n\n if (parent.contentItems == null || parent.contentItems.length === 0) {\n parent.addChild(rowOrColConfig);\n }\n\n const child = parent.contentItems[0];\n const isCorrectType = columnPreferred ? child.isColumn : child.isRow;\n if (!isCorrectType) {\n parent.removeChild(child, true);\n parent.addChild(rowOrColConfig);\n\n // The addChild may cause the element that has focus to be removed from the DOM, which changes focus to the body\n // Try and maintain the focus as best we can. The unfocused element may still send a blur/focus event so that needs to be handled correctly.\n const maintainFocusElement = document.activeElement;\n parent.contentItems[0].addChild(child);\n if (\n maintainFocusElement &&\n (maintainFocusElement as HTMLElement).focus != null\n ) {\n (maintainFocusElement as HTMLElement).focus();\n }\n }\n\n return this.addStack(parent.contentItems[0], columnPreferred);\n }\n\n if (parent.contentItems.length < 2) {\n parent.addChild({ type: 'stack' });\n return parent.contentItems[parent.contentItems.length - 1] as Stack;\n }\n let newParent = parent.contentItems[parent.contentItems.length - 1];\n const isCorrectType = !columnPreferred\n ? newParent.isColumn\n : newParent.isRow;\n\n // This is usually triggered because we hit a stack within the last row/column\n if (!isCorrectType) {\n const inverseRowOrColConfig = parent.layoutManager.createContentItem(\n {\n type: !columnPreferred ? 'column' : 'row',\n height: newParent.config?.height,\n width: newParent.config?.width,\n },\n parent\n );\n parent.replaceChild(newParent, inverseRowOrColConfig);\n parent.contentItems[parent.contentItems.length - 1].addChild(newParent);\n newParent = parent.contentItems[parent.contentItems.length - 1];\n }\n\n return this.addStack(newParent, !columnPreferred);\n }\n\n /**\n * Gets all stack containers in the layout\n * @param layout GoldenLayout instance\n * @returns The found stack containers\n */\n static getAllStackContainers(layout: GoldenLayout): Stack[] {\n // eslint-disable-next-line no-underscore-dangle\n return layout._findAllStackContainers();\n }\n\n /**\n * Get the index of the stack that is currently focused\n * @param allStacks All the stacks\n * @returns The focused stack's index or -1 if not found\n */\n static getFocusedStackIndex(allStacks: Stack[]): number {\n // NOTE: We target the 'lm_focusin' class because GoldenLayout automatically applies this class\n // to tab elements when they receive focus. Until we enhance focus tracking in GoldenLayout, we\n // will have to rely on this internal CSS class.\n return allStacks.findIndex(stack =>\n stack.header.tabs.some(tab =>\n tab.element[0].classList.contains('lm_focusin')\n )\n );\n }\n\n /**\n * Get the stack that is currently focused\n * @param layout GoldenLayout instance\n * @returns The focused stack or undefined if none found\n */\n static getFocusedStack(layout: GoldenLayout): Stack | undefined {\n const allStacks = LayoutUtils.getAllStackContainers(layout);\n const focusedStackIndex = LayoutUtils.getFocusedStackIndex(allStacks);\n return allStacks[focusedStackIndex];\n }\n\n /**\n * Gets a stack by its ID\n * @param item Golden layout content item to search for the stack\n * @param searchId the ID\n */\n static getStackById(\n item: ContentItem,\n searchId: string | string[],\n allowEmptyStack = false\n ): Stack | null {\n if (allowEmptyStack && isStack(item) && item.contentItems.length === 0) {\n return item;\n }\n\n if (searchId === item.config?.id) {\n if (isStack(item)) {\n return item as Stack;\n }\n throw new Error(`Item with ID ${searchId} is not a stack`);\n }\n\n if (item.contentItems == null) {\n return null;\n }\n\n for (let i = 0; i < item.contentItems.length; i += 1) {\n const stack = this.getStackById(\n item.contentItems[i],\n searchId,\n allowEmptyStack\n );\n if (stack) {\n return stack;\n }\n }\n\n return null;\n }\n\n /**\n * Gets a content item by its ID\n * @param item Golden layout content item to search for the content item. Typically the root.\n * @param searchId the ID\n */\n static getContentItemById(\n item: ContentItem,\n searchId: string | string[]\n ): ContentItem | null {\n if (item.config?.id === searchId) {\n return item;\n }\n\n if (item.contentItems == null) {\n return null;\n }\n\n for (let i = 0; i < item.contentItems.length; i += 1) {\n const contentItem = this.getContentItemById(\n item.contentItems[i],\n searchId\n );\n if (contentItem) {\n return contentItem;\n }\n }\n\n return null;\n }\n\n /**\n * Gets the first stack which contains a contentItem with the given config values\n * @param item Golden layout content item to search for the stack\n * @param config The item properties to match\n */\n static getStackForConfig(\n item: ContentItem,\n config: Partial<ItemConfig> = {},\n allowEmptyStack = false\n ): Stack | null {\n if (allowEmptyStack && isStack(item) && item.contentItems.length === 0) {\n return item;\n }\n\n if (item.contentItems == null) {\n return null;\n }\n\n for (let i = 0; i < item.contentItems.length; i += 1) {\n const contentItem = item.contentItems[i];\n if (contentItem.isComponent && contentItem.config != null) {\n if (isMatch(contentItem.config, config)) {\n return item as Stack;\n }\n }\n\n const stack = this.getStackForConfig(\n contentItem,\n config,\n allowEmptyStack\n );\n if (stack) {\n return stack;\n }\n }\n\n return null;\n }\n\n /**\n * Gets a stack matching the specified config\n * @param root The root GoldenLayout element\n * @param config The item config type to match, eg. { component: 'IrisGridPanel', title: 'Table Name' }\n * @param createIfNecessary Whether to create the stack if it does not exist.\n * @param matchComponentType If the config doesn't match exactly, just find another one of the same component type\n * @param allowEmptyStack If no configs match, search for an empty stack that can be used\n */\n static getStackForRoot(\n root: ContentItem,\n config: Partial<ItemConfig>,\n createIfNecessary = true,\n matchComponentType = true,\n allowEmptyStack = true\n ): Stack | null {\n let stack = this.getStackForConfig(root, config);\n if (!stack && matchComponentType) {\n stack = this.getStackForConfig(\n root,\n { component: (config as { component?: string }).component },\n allowEmptyStack\n );\n }\n\n if (!stack && createIfNecessary) {\n stack = this.addStack(root);\n }\n\n return stack;\n }\n\n /**\n * Gets a stack matching one of the specified types, creates new stack if necessary\n * @param root The GoldenLayout root to find or create the stack in\n * @param types The array of component types to match\n * @param createIfNecessary Whether to create the stack if it does not exist\n * @param matchComponentType If the config doesn't match exactly, just find another one of the same component type\n * @param allowEmptyStack If no configs match, search for an empty stack that can be used\n */\n static getStackForComponentTypes(\n root: ContentItem,\n types: string[],\n createIfNecessary = true,\n matchComponentType = true,\n allowEmptyStack = true\n ): Stack | null {\n for (let i = 0; i < types.length; i += 1) {\n const component = types[i];\n const isLastType = i === types.length - 1;\n const stack = LayoutUtils.getStackForRoot(\n root,\n { component },\n createIfNecessary && isLastType,\n matchComponentType,\n allowEmptyStack\n );\n if (stack) {\n return stack;\n }\n }\n return null;\n }\n\n /**\n * Gets first content item with the specified config in stack.\n * @param stack The stack to search for the item\n * @param config The item config type to match, eg. { component: 'IrisGridPanel', title: 'Table Name' }\n * @returns Returns the found content item, null if not found.\n */\n static getContentItemInStack(\n stack: ContentItem | null,\n config: Partial<ItemConfig>\n ): ContentItem | null {\n if (!stack) {\n return null;\n }\n for (let i = 0; i < stack.contentItems.length; i += 1) {\n const contentItem = stack.contentItems[i];\n if (contentItem.isComponent && contentItem.config != null) {\n if (isMatch(contentItem.config, config)) {\n return contentItem;\n }\n }\n }\n return null;\n }\n\n /**\n * Removes dynamic props from components in the given config so this config could be serialized\n * @param config Config objec\n * @returns Dehydrated config\n */\n static dehydrateLayoutConfig(\n config: ItemConfig[],\n dehydrateComponent: (\n componentName: string,\n config: ItemConfig\n ) => PanelConfig\n ): (PanelConfig | ItemConfig)[] {\n if (config == null || !config.length) {\n return [];\n }\n const dehydratedConfig: (PanelConfig | ItemConfig)[] = [];\n\n for (let i = 0; i < config.length; i += 1) {\n const itemConfig = config[i];\n const { component, content } = itemConfig as ReactComponentConfig;\n if (component) {\n const dehydratedComponent = dehydrateComponent(component, itemConfig);\n if (dehydratedComponent != null) {\n dehydratedConfig.push(dehydratedComponent);\n } else {\n log.debug2(\n `dehydrateLayoutConfig: skipping unmapped component \"${component}\"`\n );\n }\n } else if (content) {\n const layoutItemConfig = {\n ...itemConfig,\n content: LayoutUtils.dehydrateLayoutConfig(\n content,\n dehydrateComponent\n ),\n };\n dehydratedConfig.push(layoutItemConfig);\n } else {\n dehydratedConfig.push(itemConfig);\n }\n }\n return dehydratedConfig;\n }\n\n static getTabPoint(glContainer: Container): [number, number] {\n const { tab } = glContainer;\n if (tab == null) {\n throw new Error(`Cannot get tab for panel container ${glContainer}`);\n }\n const tabRect = tab.element[0].getBoundingClientRect();\n\n return [tabRect.left + tabRect.width * 0.5, tabRect.bottom - 8];\n }\n\n /**\n * Drop minor changes in Layout Configuration for deep comparison\n * @param config Layout Configuration\n *\n * minor changes:\n * 1. sorts in grid\n * 2. quick filters in grid\n * 3. active item\n * 4. isStuckToBottom/isStuckToRight\n *\n * item id is also removed\n */\n static dropLayoutMinorChange(config: DashboardLayoutConfig): void {\n for (let i = 0; i < config.length; i += 1) {\n const itemConfig = config[i];\n const { content } = itemConfig;\n if (content !== undefined) {\n if (isStackItemConfig(itemConfig)) {\n delete itemConfig.activeItemIndex;\n }\n LayoutUtils.dropLayoutMinorChange(content);\n } else if (\n isReactComponentConfig(itemConfig) &&\n itemConfig.component === 'IrisGridPanel'\n ) {\n if (itemConfig.props.panelState != null) {\n delete itemConfig.id;\n itemConfig.props.panelState.irisGridState.sorts = [];\n itemConfig.props.panelState.irisGridState.quickFilters = [];\n itemConfig.props.panelState.gridState.isStuckToBottom = false;\n itemConfig.props.panelState.gridState.isStuckToRight = false;\n }\n }\n }\n }\n\n /**\n * Compare two layouts to see if they are equivalent\n * @param layout1 A Golden Layout config object\n * @param layout2 Another Golden layout config object\n * @param major When true, will ignore \"minor\" property differences (eg. sorts)\n */\n static isEqual(\n layout1: DashboardLayoutConfig,\n layout2: DashboardLayoutConfig,\n major = false\n ): boolean {\n const layout1Clone = LayoutUtils.cloneLayout(layout1);\n const layout2Clone = LayoutUtils.cloneLayout(layout2);\n if (major) {\n LayoutUtils.dropLayoutMinorChange(layout1Clone);\n LayoutUtils.dropLayoutMinorChange(layout2Clone);\n return deepEqual(layout1Clone, layout2Clone);\n }\n // Pass cloned layouts to avoid false negatives\n // when comparing layouts with undefined and missing properties\n return deepEqual(layout1Clone, layout2Clone);\n }\n\n static cloneLayout(layout: DashboardLayoutConfig): DashboardLayoutConfig {\n return JSON.parse(JSON.stringify(layout));\n }\n\n /**\n * Adds dynamic props to components in the given config so this config could be used to initialize a layout\n * @param config Dehydrated config object\n * @param hydrateComponent Function to hydrate the component\n * @returns Hydrated config\n */\n static hydrateLayoutConfig(\n config: (PanelConfig | ItemConfig)[],\n hydrateComponent: (\n componentName: string,\n config: PanelConfig | ItemConfig\n ) => ReactComponentConfig\n ): DashboardLayoutConfig {\n if (config == null || !config.length) {\n return [];\n }\n const hydratedConfig = [];\n\n for (let i = 0; i < config.length; i += 1) {\n const itemConfig = config[i];\n if (isReactComponentConfig(itemConfig)) {\n const { component, props = {} } = itemConfig;\n hydratedConfig.push({\n ...itemConfig,\n id: itemConfig?.id ?? nanoid(),\n props: hydrateComponent(component, props),\n });\n } else if (itemConfig.content !== undefined) {\n const contentConfig = LayoutUtils.hydrateLayoutConfig(\n itemConfig.content,\n hydrateComponent\n );\n if (\n isStackItemConfig(itemConfig) &&\n itemConfig.activeItemIndex != null &&\n itemConfig.activeItemIndex >= contentConfig.length\n ) {\n log.warn(\n 'Fixing bad activeItemIndex!',\n itemConfig.activeItemIndex,\n itemConfig\n );\n itemConfig.activeItemIndex = 0;\n }\n hydratedConfig.push({\n ...itemConfig,\n content: contentConfig,\n });\n } else {\n hydratedConfig.push(itemConfig);\n }\n }\n\n return hydratedConfig;\n }\n\n /**\n * Opens a component. It will try and open the component in an existing stack of the same component.\n * If `replaceExisting` is true and there is a component found with the same `config.id`, it will replace that component with this one.\n * If `allowStack` is true and there is a component of the same type found, it will open in that stack (potentially covering up a panel).\n * @param root The GoldenLayout root to open the component in\n * @param config The component config definition to open\n * @param replaceExisting Whether it should replace the existing one matching component type and id, or open a new one\n * @param replaceConfig The component config to replace\n * @param createNewStack True to force opening in a new stack, false to try and open in a stack with the same type of component.\n * @param focusElement The element to focus on\n * @param dragEvent Whether component is being created with a drag, mouse event is initial position for drag proxy\n */\n static openComponent({\n root,\n config: configParam,\n stack: stackParam = undefined,\n replaceExisting = true,\n replaceConfig = undefined,\n createNewStack = false,\n focusElement = undefined,\n dragEvent = undefined,\n }: {\n root?: ContentItem;\n config?: Partial<ReactComponentConfig>;\n stack?: Stack;\n replaceExisting?: boolean;\n replaceConfig?: Partial<ItemConfig>;\n createNewStack?: boolean;\n focusElement?: string;\n dragEvent?: MouseEvent;\n } = {}): void {\n // attempt to retain focus after dom manipulation, which can break focus\n const maintainFocusElement = document.activeElement;\n const config = { ...configParam } as ReactComponentConfig;\n\n if (config.id == null) {\n config.id = nanoid();\n }\n\n if (dragEvent != null) {\n root?.layoutManager.createDragSourceFromEvent(config, dragEvent);\n return;\n }\n\n const searchConfig = replaceConfig || {\n id: config.id,\n component: config.component,\n };\n assertNotNull(root);\n const stack =\n stackParam ??\n (createNewStack\n ? LayoutUtils.addStack(root)\n : LayoutUtils.getStackForRoot(root, searchConfig));\n\n assertNotNull(stack);\n const oldContentItem = LayoutUtils.getContentItemInStack(\n stack,\n searchConfig\n );\n\n if (focusElement != null) {\n // We need to listen for when the stack is created\n const onComponentCreated = (event: {\n origin: { element: Element[] };\n }): void => {\n log.debug('Component created, focusing element', focusElement);\n\n stack.off('componentCreated', onComponentCreated);\n\n const { element } = event.origin;\n\n // Need to wait until the component actually renders.\n requestAnimationFrame(() => {\n LayoutUtils.focusElement(element[0], focusElement);\n });\n };\n stack.on('componentCreated', onComponentCreated);\n }\n if (replaceExisting && oldContentItem) {\n const index = stack.contentItems.indexOf(oldContentItem);\n\n // Using remove/add here instead of replaceChild because I was getting errors with replaceChild... should be the same.\n // Add first so that the stack doesn't get screwed up\n stack.addChild(config, index + 1);\n stack.removeChild(oldContentItem);\n\n stack.setActiveContentItem(stack.contentItems[index]);\n } else {\n stack.addChild(config);\n }\n\n if (\n focusElement == null &&\n maintainFocusElement &&\n isHTMLElement(maintainFocusElement)\n ) {\n maintainFocusElement.focus();\n }\n }\n\n /**\n * Opens a component in an given stack.\n * If `replaceExisting` is true and there is a component found with the same `config.id`, it will replace that component with this one\n * @param stack The GoldenLayout stack to open the component in\n * @param config The component config definition to open\n * @param replaceExisting Whether it should replace the existing one matching component type and id, or open a new one\n */\n static openComponentInStack(\n stack: Stack | null,\n config: ItemConfig & Record<string, unknown>,\n replaceExisting = true\n ): void {\n const maintainFocusElement = document.activeElement; // attempt to retain focus after dom manipulation, which can break focus\n\n const searchConfig = { id: config.id };\n\n const oldContentItem = LayoutUtils.getContentItemInStack(\n stack,\n searchConfig\n );\n\n if (replaceExisting && oldContentItem && stack) {\n const index = stack?.contentItems.indexOf(oldContentItem);\n\n // Using remove/add here instead of replaceChild because I was getting errors with replaceChild... should be the same.\n // Add first so that the stack doesn't get screwed up\n stack.addChild(config, index + 1);\n stack.removeChild(oldContentItem);\n\n stack.setActiveContentItem(stack.contentItems[index]);\n } else {\n stack?.addChild(config);\n }\n\n if (maintainFocusElement && isHTMLElement(maintainFocusElement)) {\n maintainFocusElement.focus();\n }\n }\n\n /**\n * Close the specified component and remove it from the stack it's currently in\n * @param root The GoldenLayout root to search and close the component in\n * @param config The GoldenLayout component config definition to close, eg. { component: 'IrisGridPanel', id: 'table-t' }\n */\n static closeComponent(\n root: ContentItem,\n config: LayoutConfig,\n closeOptions?: CloseOptions\n ): void {\n const stack = LayoutUtils.getStackForRoot(\n root,\n config,\n false,\n false,\n false\n );\n\n if (!stack) {\n log.warn('Cannot find stack for component, ignoring close', config);\n return;\n }\n\n // Find the tab with the specified config and remove it\n // Same component was used to get the stack above, so getContentItemInStack shouldn't return null\n const oldContentItem = LayoutUtils.getContentItemInStack(stack, config);\n const maintainFocusElement = document.activeElement; // attempt to retain focus after dom manipulation, which can break focus\n if (oldContentItem) {\n if (isComponent(oldContentItem)) {\n oldContentItem.container.close(closeOptions);\n } else {\n stack.removeChild(oldContentItem);\n }\n }\n // if focused element is still in dom restore focus, note it could have been in the removed panel so check first\n if (\n maintainFocusElement &&\n document.contains(maintainFocusElement) &&\n isHTMLElement(maintainFocusElement)\n ) {\n maintainFocusElement.focus();\n }\n }\n\n static renameComponent(\n root: ContentItem,\n config: Partial<ItemConfig>,\n newTitle: string\n ): void {\n const stack = LayoutUtils.getStackForRoot(root, config, false);\n if (!stack) {\n log.error('Could not find stack for config', config);\n return;\n }\n // Find the tab with the specified config and rename it\n const contentItem = LayoutUtils.getContentItemInStack(stack, config);\n if (contentItem) {\n contentItem.setTitle(newTitle);\n }\n }\n\n /**\n * Create a component clone based on the given config\n * @param root The GoldenLayout root to clone the component in\n * @param config The config to clone\n * @returns Clone config\n */\n static cloneComponent(\n root: ContentItem,\n config: ReactComponentConfig\n ): ReactComponentConfig | null {\n const stack = LayoutUtils.getStackForRoot(root, config, false);\n if (!stack) {\n log.error('Could not find stack for config', config);\n return null;\n }\n const { props = {} } = config;\n const panelState = LayoutUtils.getPanelComponentState(config);\n const cloneConfig = {\n type: 'react-component' as const,\n component: config.component,\n props: {\n ...props,\n panelState,\n },\n title: `${config.title} Copy`,\n id: nanoid(),\n };\n LayoutUtils.openComponentInStack(stack, cloneConfig);\n return cloneConfig;\n }\n\n /**\n * Get panel component state for the given config\n * @param config Panel config\n * @returns Panel state\n */\n static getPanelComponentState(config: ItemConfig): unknown {\n if (isComponentConfig(config)) {\n return config.componentState?.panelState;\n }\n if (isReactComponentConfig(config)) {\n return config.props?.panelState;\n }\n return null;\n }\n\n static makeDefaultLayout(): Config {\n return {\n dimensions: {\n headerHeight: GoldenLayoutThemeExport.tabHeight,\n borderWidth: GoldenLayoutThemeExport.dragBorderWidth,\n borderGrabWidth: 10,\n },\n settings: {\n showPopoutIcon: false,\n showCloseIcon: false,\n constrainDragToContainer: false,\n },\n } as Config;\n }\n\n /**\n * Gets a containers root node\n * @param container The Golden Layout container to get the root for\n */\n static getRootFromContainer(container: Container): ContentItem {\n return container.layoutManager.root;\n }\n\n /**\n * Gets the config for the panel component given a glContainer\n * @param container The Golden Layout container to get the config for\n */\n static getComponentConfigFromContainer(\n container?: Container\n ): ItemConfig | null {\n if (container) {\n if (container.tab != null && container.tab.contentItem != null) {\n return container.tab.contentItem.config;\n }\n\n // If the container hasn't populated the tab yet, just get the config directly from the container\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore private api usage\n // eslint-disable-next-line no-underscore-dangle\n return container._config;\n }\n\n return null;\n }\n\n static getTitleFromContainer(\n container: Container\n ): string | null | undefined {\n if (\n container != null &&\n container.tab != null &&\n container.tab.contentItem != null\n ) {\n return container.tab.contentItem.config.title;\n }\n return null;\n }\n\n static getTitleFromTab(tab: Tab): string | null | undefined {\n if (tab != null && tab.contentItem != null) {\n return tab.contentItem.config.title;\n }\n return null;\n }\n\n /**\n * Retrieve the panel ID for the provided golden layout container\n * @param glContainer The container to get the panel ID for\n * @returns Panel ID\n */\n static getIdFromContainer(glContainer: Container): PanelId | null {\n const config = LayoutUtils.getComponentConfigFromContainer(glContainer);\n if (config) {\n return config.id as PanelId;\n }\n return null;\n }\n\n /**\n * Retrieve the ID of the panel provided\n * @param panel The panel to get the ID for\n * @returns Panel ID\n */\n static getIdFromPanel(panel: LayoutPanel): PanelId | null {\n const { glContainer } = panel.props;\n return LayoutUtils.getIdFromContainer(glContainer);\n }\n\n /**\n * Get component name from the panel instance\n * @param panel Panel to get component name for\n * @returns Component name or null if unable to retrieve name\n */\n static getComponentNameFromPanel(panel: LayoutPanel): string | null {\n const { glContainer } = panel.props;\n const config = LayoutUtils.getComponentConfigFromContainer(glContainer);\n if (config && isReactComponentConfig(config)) {\n return config.component ?? null;\n }\n return null;\n }\n\n /**\n * Get component name for wrapped and un-wrapped components\n * @param component Component to get name for\n * @returns Component name\n * @throws If displayName for the component is not defined\n */\n static getComponentName(component: {\n displayName?: string;\n WrappedComponent?: { displayName?: string };\n }): string {\n const name =\n component.WrappedComponent?.displayName ?? component.displayName;\n if (name == null) {\n throw new Error(`Component displayName not defined ${component}`);\n }\n return name;\n }\n\n /**\n * Put focus on the first \"input\" element (input, button, select, textarea) within an element\n * If element is null or input element not found, does nothing\n * @param element The element to put focus in.\n * @param selector The first element matching this selector will be focused.\n * @returns The element that was focused, null if not focused\n */\n static focusElement(\n element: Element,\n selector = LayoutUtils.DEFAULT_FOCUS_SELECTOR\n ): Element | null {\n if (element == null) {\n return null;\n }\n const focusElement = element.querySelector(selector);\n if (focusElement == null) {\n return null;\n }\n\n if (isHTMLElement(focusElement)) {\n focusElement.focus();\n }\n return focusElement;\n }\n\n /**\n * Get a promise that initializes when layout is initialized\n * @param layout The layout to await initialization on\n * @returns Promise that resolves when layout is initialized\n */\n static onInitialized(layout: GoldenLayout): Promise<void> {\n return new Promise(resolve => {\n if (layout.isInitialised) {\n resolve();\n return;\n }\n const onInit = (): void => {\n layout.off('initialised', onInit);\n resolve();\n };\n layout.on('initialised', onInit);\n });\n }\n}\n\nexport default LayoutUtils;\n"],"mappings":";;;;;AAAA,OAAOA,SAAS,MAAM,iBAAiB;AACvC,SAASC,MAAM,QAAQ,QAAQ;AAC/B,OAAOC,OAAO,MAAM,gBAAgB;AACpC,OAAOC,GAAG,MAAM,gBAAgB;AAEhC,SACEC,WAAW,EACXC,MAAM,EACNC,OAAO,EACPC,uBAAuB,QAClB,0BAA0B;AAajC,SAASC,aAAa,QAAoB,kBAAkB;AAI5D,IAAMC,GAAG,GAAGN,GAAG,CAACO,MAAM,CAAC,aAAa,CAAC;AAcrC,SAASC,iBAAiBA,CAACC,MAAkB,EAA6B;EACxE,OAAQA,MAAM,CAAqBC,aAAa,KAAKC,SAAS;AAChE;AAEA,OAAO,SAASC,sBAAsBA,CACpCH,MAAkB,EACc;EAChC,IAAMI,WAAW,GAAGJ,MAA8B;EAClD;EACA;EACA,OACE,CAAED,iBAAiB,CAACC,MAAM,CAAC,IACzBA,MAAM,CAACC,aAAa,KAAK,oBAAoB,IAC7CD,MAA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,GAAGvH,OAAO,CAACiL,aAAa,CAACF,QAAQ,CAAC;IACpD,IAAIxD,YAAY,IAAI,IAAI,EAAE;MACxB,OAAO,IAAI;IACb;IAEA,IAAIxH,aAAa,CAACwH,YAAY,CAAC,EAAE;MAC/BA,YAAY,CAACtH,KAAK,CAAC,CAAC;IACtB;IACA,OAAOsH,YAAY;EACrB;;EAEA;AACF;AACA;AACA;AACA;EACE,OAAO2D,aAAaA,CAACzI,MAAoB,EAAiB;IACxD,OAAO,IAAI0I,OAAO,CAACC,OAAO,IAAI;MAC5B,IAAI3I,MAAM,CAAC4I,aAAa,EAAE;QACxBD,OAAO,CAAC,CAAC;QACT;MACF;MACA,IAAME,MAAM,GAAGA,CAAA,KAAY;QACzB7I,MAAM,CAACsF,GAAG,CAAC,aAAa,EAAEuD,MAAM,CAAC;QACjCF,OAAO,CAAC,CAAC;MACX,CAAC;MACD3I,MAAM,CAACyF,EAAE,CAAC,aAAa,EAAEoD,MAAM,CAAC;IAClC,CAAC,CAAC;EACJ;AACF;AAACC,eAAA,CAp5BKpL,WAAW,4BACiB,iCAAiC;AAq5BnE,eAAeA,WAAW"}
1
+ {"version":3,"file":"LayoutUtils.js","names":["deepEqual","nanoid","isMatch","Log","isComponent","isRoot","isStack","GoldenLayoutThemeExport","assertNotNull","log","module","isComponentConfig","config","componentName","undefined","isReactComponentConfig","reactConfig","type","component","isHTMLElement","element","focus","isStackItemConfig","LayoutUtils","activateTab","root","stack","getStackForRoot","error","contentItem","getContentItemInStack","setActiveContentItem","isActiveTab","activeItem","getActiveContentItem","addStack","parent","columnPreferred","arguments","length","rowOrColConfig","contentItems","addChild","child","isCorrectType","isColumn","isRow","removeChild","maintainFocusElement","document","activeElement","newParent","_newParent$config","_newParent$config2","inverseRowOrColConfig","layoutManager","createContentItem","height","width","replaceChild","getAllStackContainers","layout","_findAllStackContainers","getFocusedStackIndex","allStacks","findIndex","header","tabs","some","tab","classList","contains","getFocusedStack","focusedStackIndex","getStackById","item","searchId","_item$config","allowEmptyStack","id","Error","concat","i","getContentItemById","_item$config2","getStackForConfig","createIfNecessary","matchComponentType","getStackForComponentTypes","types","isLastType","dehydrateLayoutConfig","dehydrateComponent","dehydratedConfig","itemConfig","content","dehydratedComponent","push","debug2","layoutItemConfig","_objectSpread","getTabPoint","glContainer","tabRect","getBoundingClientRect","left","bottom","dropLayoutMinorChange","activeItemIndex","props","panelState","irisGridState","sorts","quickFilters","gridState","isStuckToBottom","isStuckToRight","isEqual","layout1","layout2","major","layout1Clone","cloneLayout","layout2Clone","JSON","parse","stringify","hydrateLayoutConfig","hydrateComponent","hydratedConfig","_itemConfig$id","contentConfig","warn","openComponent","configParam","stackParam","replaceExisting","replaceConfig","createNewStack","focusElement","dragEvent","createDragSourceFromEvent","searchConfig","oldContentItem","onComponentCreated","event","debug","off","origin","requestAnimationFrame","on","index","indexOf","openComponentInStack","closeComponent","closeOptions","container","close","renameComponent","newTitle","setTitle","cloneComponent","getPanelComponentState","cloneConfig","title","_config$componentStat","componentState","_config$props","makeDefaultLayout","dimensions","headerHeight","tabHeight","borderWidth","dragBorderWidth","borderGrabWidth","settings","showPopoutIcon","showCloseIcon","constrainDragToContainer","getRootFromContainer","getComponentConfigFromContainer","_config","getTitleFromContainer","getTitleFromTab","getIdFromContainer","getIdFromPanel","panel","getComponentNameFromPanel","_config$component","getComponentName","_component$WrappedCom","_component$WrappedCom2","name","WrappedComponent","displayName","selector","DEFAULT_FOCUS_SELECTOR","querySelector","onInitialized","Promise","resolve","isInitialised","onInit","_defineProperty"],"sources":["../../src/layout/LayoutUtils.ts"],"sourcesContent":["import deepEqual from 'fast-deep-equal';\nimport { nanoid } from 'nanoid';\nimport isMatch from 'lodash.ismatch';\nimport Log from '@deephaven/log';\nimport type GoldenLayout from '@deephaven/golden-layout';\nimport {\n isComponent,\n isRoot,\n isStack,\n GoldenLayoutThemeExport,\n} from '@deephaven/golden-layout';\nimport type {\n ComponentConfig,\n Config,\n Container,\n ContentItem,\n ItemConfig,\n ReactComponentConfig,\n Stack,\n Tab,\n CloseOptions,\n GLPanelProps,\n} from '@deephaven/golden-layout';\nimport { assertNotNull, type Brand } from '@deephaven/utils';\nimport { type DashboardLayoutConfig } from '../DashboardLayout';\nimport {\n type PanelConfig,\n type DehydratedPanelProps,\n type DehydratedDashboardPanelProps,\n type DehydratedPanelConfig,\n} from '../DashboardPlugin';\n\nconst log = Log.module('LayoutUtils');\n\ntype LayoutConfig = { id?: string; component?: string };\n\nexport type PanelId = Brand<'PanelId', string | undefined>;\n\nexport type LayoutPanel = {\n props: GLPanelProps;\n};\n\nexport type StackItemConfig = ItemConfig & {\n activeItemIndex?: number;\n};\n\nfunction isComponentConfig(config: ItemConfig): config is ComponentConfig {\n return (config as ComponentConfig).componentName !== undefined;\n}\n\nexport function isReactComponentConfig(\n config: ItemConfig\n): config is ReactComponentConfig {\n const reactConfig = config as ReactComponentConfig;\n // Golden layout sets the type to 'component' and componentName to 'lm-react-component' in `createContentItem`, then changes it back in `toConfig`\n // For our purposes, we need to check both.\n return (\n ((isComponentConfig(config) &&\n config.componentName === 'lm-react-component') ||\n config.type === 'react-component') &&\n reactConfig.component !== undefined\n );\n}\n\nfunction isHTMLElement(element: Element): element is HTMLElement {\n return (element as HTMLElement).focus !== undefined;\n}\n\nfunction isStackItemConfig(config: ItemConfig): config is StackItemConfig {\n return config.type === 'stack';\n}\nclass LayoutUtils {\n static DEFAULT_FOCUS_SELECTOR = 'input, select, textarea, button';\n\n static activateTab(root: ContentItem, config: Partial<ItemConfig>): void {\n const stack = LayoutUtils.getStackForRoot(root, config, false);\n if (!stack) {\n log.error('Could not find stack for config', config);\n return;\n }\n // Find the tab with the specified table and activate it\n const contentItem = LayoutUtils.getContentItemInStack(stack, config);\n if (contentItem) {\n stack.setActiveContentItem(contentItem);\n }\n }\n\n /**\n * Is the tab with the given config active\n * @param root A GoldenLayout content item with the tab\n * @param config Tab config to match\n * @returns True if the tab is active\n */\n static isActiveTab(\n root: ContentItem,\n config: Partial<ReactComponentConfig>\n ): boolean {\n const stack = LayoutUtils.getStackForRoot(root, config, false);\n if (!stack) {\n log.error('Could not find stack for config', config);\n return false;\n }\n // Find the item with the specified config and compare with active item\n const contentItem = LayoutUtils.getContentItemInStack(stack, config);\n const activeItem = stack.getActiveContentItem();\n return activeItem === contentItem;\n }\n\n /**\n * Adds a stack to the root layout specified. Adds to the first row/column with only one item\n * @param parent A GoldenLayout content item to add the stack to\n * @returns The newly created stack.\n */\n static addStack(parent: ContentItem, columnPreferred = true): Stack {\n if (isRoot(parent)) {\n const rowOrColConfig: ItemConfig = {\n type: columnPreferred ? 'column' : 'row',\n };\n\n if (parent.contentItems == null || parent.contentItems.length === 0) {\n parent.addChild(rowOrColConfig);\n }\n\n const child = parent.contentItems[0];\n const isCorrectType = columnPreferred ? child.isColumn : child.isRow;\n if (!isCorrectType) {\n parent.removeChild(child, true);\n parent.addChild(rowOrColConfig);\n\n // The addChild may cause the element that has focus to be removed from the DOM, which changes focus to the body\n // Try and maintain the focus as best we can. The unfocused element may still send a blur/focus event so that needs to be handled correctly.\n const maintainFocusElement = document.activeElement;\n parent.contentItems[0].addChild(child);\n if (\n maintainFocusElement &&\n (maintainFocusElement as HTMLElement).focus != null\n ) {\n (maintainFocusElement as HTMLElement).focus();\n }\n }\n\n return this.addStack(parent.contentItems[0], columnPreferred);\n }\n\n if (parent.contentItems.length < 2) {\n parent.addChild({ type: 'stack' });\n return parent.contentItems[parent.contentItems.length - 1] as Stack;\n }\n let newParent = parent.contentItems[parent.contentItems.length - 1];\n const isCorrectType = !columnPreferred\n ? newParent.isColumn\n : newParent.isRow;\n\n // This is usually triggered because we hit a stack within the last row/column\n if (!isCorrectType) {\n const inverseRowOrColConfig = parent.layoutManager.createContentItem(\n {\n type: !columnPreferred ? 'column' : 'row',\n height: newParent.config?.height,\n width: newParent.config?.width,\n },\n parent\n );\n parent.replaceChild(newParent, inverseRowOrColConfig);\n parent.contentItems[parent.contentItems.length - 1].addChild(newParent);\n newParent = parent.contentItems[parent.contentItems.length - 1];\n }\n\n return this.addStack(newParent, !columnPreferred);\n }\n\n /**\n * Gets all stack containers in the layout\n * @param layout GoldenLayout instance\n * @returns The found stack containers\n */\n static getAllStackContainers(layout: GoldenLayout): Stack[] {\n // eslint-disable-next-line no-underscore-dangle\n return layout._findAllStackContainers();\n }\n\n /**\n * Get the index of the stack that is currently focused\n * @param allStacks All the stacks\n * @returns The focused stack's index or -1 if not found\n */\n static getFocusedStackIndex(allStacks: Stack[]): number {\n // NOTE: We target the 'lm_focusin' class because GoldenLayout automatically applies this class\n // to tab elements when they receive focus. Until we enhance focus tracking in GoldenLayout, we\n // will have to rely on this internal CSS class.\n return allStacks.findIndex(stack =>\n stack.header.tabs.some(tab =>\n tab.element[0].classList.contains('lm_focusin')\n )\n );\n }\n\n /**\n * Get the stack that is currently focused\n * @param layout GoldenLayout instance\n * @returns The focused stack or undefined if none found\n */\n static getFocusedStack(layout: GoldenLayout): Stack | undefined {\n const allStacks = LayoutUtils.getAllStackContainers(layout);\n const focusedStackIndex = LayoutUtils.getFocusedStackIndex(allStacks);\n return allStacks[focusedStackIndex];\n }\n\n /**\n * Gets a stack by its ID\n * @param item Golden layout content item to search for the stack\n * @param searchId the ID\n */\n static getStackById(\n item: ContentItem,\n searchId: string | string[],\n allowEmptyStack = false\n ): Stack | null {\n if (allowEmptyStack && isStack(item) && item.contentItems.length === 0) {\n return item;\n }\n\n if (searchId === item.config?.id) {\n if (isStack(item)) {\n return item as Stack;\n }\n throw new Error(`Item with ID ${searchId} is not a stack`);\n }\n\n if (item.contentItems == null) {\n return null;\n }\n\n for (let i = 0; i < item.contentItems.length; i += 1) {\n const stack = this.getStackById(\n item.contentItems[i],\n searchId,\n allowEmptyStack\n );\n if (stack) {\n return stack;\n }\n }\n\n return null;\n }\n\n /**\n * Gets a content item by its ID\n * @param item Golden layout content item to search for the content item. Typically the root.\n * @param searchId the ID\n */\n static getContentItemById(\n item: ContentItem,\n searchId: string | string[]\n ): ContentItem | null {\n if (item.config?.id === searchId) {\n return item;\n }\n\n if (item.contentItems == null) {\n return null;\n }\n\n for (let i = 0; i < item.contentItems.length; i += 1) {\n const contentItem = this.getContentItemById(\n item.contentItems[i],\n searchId\n );\n if (contentItem) {\n return contentItem;\n }\n }\n\n return null;\n }\n\n /**\n * Gets the first stack which contains a contentItem with the given config values\n * @param item Golden layout content item to search for the stack\n * @param config The item properties to match\n */\n static getStackForConfig(\n item: ContentItem,\n config: Partial<ItemConfig> = {},\n allowEmptyStack = false\n ): Stack | null {\n if (allowEmptyStack && isStack(item) && item.contentItems.length === 0) {\n return item;\n }\n\n if (item.contentItems == null) {\n return null;\n }\n\n for (let i = 0; i < item.contentItems.length; i += 1) {\n const contentItem = item.contentItems[i];\n if (contentItem.isComponent && contentItem.config != null) {\n if (isMatch(contentItem.config, config)) {\n return item as Stack;\n }\n }\n\n const stack = this.getStackForConfig(\n contentItem,\n config,\n allowEmptyStack\n );\n if (stack) {\n return stack;\n }\n }\n\n return null;\n }\n\n /**\n * Gets a stack matching the specified config\n * @param root The root GoldenLayout element\n * @param config The item config type to match, eg. { component: 'IrisGridPanel', title: 'Table Name' }\n * @param createIfNecessary Whether to create the stack if it does not exist.\n * @param matchComponentType If the config doesn't match exactly, just find another one of the same component type\n * @param allowEmptyStack If no configs match, search for an empty stack that can be used\n */\n static getStackForRoot(\n root: ContentItem,\n config: Partial<ItemConfig>,\n createIfNecessary = true,\n matchComponentType = true,\n allowEmptyStack = true\n ): Stack | null {\n let stack = this.getStackForConfig(root, config);\n if (!stack && matchComponentType) {\n stack = this.getStackForConfig(\n root,\n { component: (config as { component?: string }).component },\n allowEmptyStack\n );\n }\n\n if (!stack && createIfNecessary) {\n stack = this.addStack(root);\n }\n\n return stack;\n }\n\n /**\n * Gets a stack matching one of the specified types, creates new stack if necessary\n * @param root The GoldenLayout root to find or create the stack in\n * @param types The array of component types to match\n * @param createIfNecessary Whether to create the stack if it does not exist\n * @param matchComponentType If the config doesn't match exactly, just find another one of the same component type\n * @param allowEmptyStack If no configs match, search for an empty stack that can be used\n */\n static getStackForComponentTypes(\n root: ContentItem,\n types: string[],\n createIfNecessary = true,\n matchComponentType = true,\n allowEmptyStack = true\n ): Stack | null {\n for (let i = 0; i < types.length; i += 1) {\n const component = types[i];\n const isLastType = i === types.length - 1;\n const stack = LayoutUtils.getStackForRoot(\n root,\n { component },\n createIfNecessary && isLastType,\n matchComponentType,\n allowEmptyStack\n );\n if (stack) {\n return stack;\n }\n }\n return null;\n }\n\n /**\n * Gets first content item with the specified config in stack.\n * @param stack The stack to search for the item\n * @param config The item config type to match, eg. { component: 'IrisGridPanel', title: 'Table Name' }\n * @returns Returns the found content item, null if not found.\n */\n static getContentItemInStack(\n stack: ContentItem | null,\n config: Partial<ItemConfig>\n ): ContentItem | null {\n if (!stack) {\n return null;\n }\n for (let i = 0; i < stack.contentItems.length; i += 1) {\n const contentItem = stack.contentItems[i];\n if (contentItem.isComponent && contentItem.config != null) {\n if (isMatch(contentItem.config, config)) {\n return contentItem;\n }\n }\n }\n return null;\n }\n\n /**\n * Removes dynamic props from components in the given config so this config could be serialized\n * @param config Config objec\n * @returns Dehydrated config\n */\n static dehydrateLayoutConfig(\n config: ItemConfig[],\n dehydrateComponent: (\n componentName: string,\n config: PanelConfig\n ) => DehydratedPanelConfig\n ): (PanelConfig | ItemConfig)[] {\n if (config == null || !config.length) {\n return [];\n }\n const dehydratedConfig: (PanelConfig | ItemConfig)[] = [];\n\n for (let i = 0; i < config.length; i += 1) {\n const itemConfig = config[i];\n const { content } = itemConfig;\n if (isReactComponentConfig(itemConfig)) {\n const dehydratedComponent = dehydrateComponent(\n itemConfig.component,\n itemConfig\n );\n if (dehydratedComponent != null) {\n dehydratedConfig.push(dehydratedComponent);\n } else {\n log.debug2(\n `dehydrateLayoutConfig: skipping unmapped component \"${itemConfig.component}\"`\n );\n }\n } else if (content) {\n const layoutItemConfig = {\n ...itemConfig,\n content: LayoutUtils.dehydrateLayoutConfig(\n content,\n dehydrateComponent\n ),\n };\n dehydratedConfig.push(layoutItemConfig);\n } else {\n dehydratedConfig.push(itemConfig);\n }\n }\n return dehydratedConfig;\n }\n\n static getTabPoint(glContainer: Container): [number, number] {\n const { tab } = glContainer;\n if (tab == null) {\n throw new Error(`Cannot get tab for panel container ${glContainer}`);\n }\n const tabRect = tab.element[0].getBoundingClientRect();\n\n return [tabRect.left + tabRect.width * 0.5, tabRect.bottom - 8];\n }\n\n /**\n * Drop minor changes in Layout Configuration for deep comparison\n * @param config Layout Configuration\n *\n * minor changes:\n * 1. sorts in grid\n * 2. quick filters in grid\n * 3. active item\n * 4. isStuckToBottom/isStuckToRight\n *\n * item id is also removed\n */\n static dropLayoutMinorChange(config: DashboardLayoutConfig): void {\n for (let i = 0; i < config.length; i += 1) {\n const itemConfig = config[i];\n const { content } = itemConfig;\n if (content !== undefined) {\n if (isStackItemConfig(itemConfig)) {\n delete itemConfig.activeItemIndex;\n }\n LayoutUtils.dropLayoutMinorChange(content);\n } else if (\n isReactComponentConfig(itemConfig) &&\n itemConfig.component === 'IrisGridPanel'\n ) {\n if (itemConfig.props.panelState != null) {\n delete itemConfig.id;\n itemConfig.props.panelState.irisGridState.sorts = [];\n itemConfig.props.panelState.irisGridState.quickFilters = [];\n itemConfig.props.panelState.gridState.isStuckToBottom = false;\n itemConfig.props.panelState.gridState.isStuckToRight = false;\n }\n }\n }\n }\n\n /**\n * Compare two layouts to see if they are equivalent\n * @param layout1 A Golden Layout config object\n * @param layout2 Another Golden layout config object\n * @param major When true, will ignore \"minor\" property differences (eg. sorts)\n */\n static isEqual(\n layout1: DashboardLayoutConfig,\n layout2: DashboardLayoutConfig,\n major = false\n ): boolean {\n const layout1Clone = LayoutUtils.cloneLayout(layout1);\n const layout2Clone = LayoutUtils.cloneLayout(layout2);\n if (major) {\n LayoutUtils.dropLayoutMinorChange(layout1Clone);\n LayoutUtils.dropLayoutMinorChange(layout2Clone);\n return deepEqual(layout1Clone, layout2Clone);\n }\n // Pass cloned layouts to avoid false negatives\n // when comparing layouts with undefined and missing properties\n return deepEqual(layout1Clone, layout2Clone);\n }\n\n static cloneLayout(layout: DashboardLayoutConfig): DashboardLayoutConfig {\n return JSON.parse(JSON.stringify(layout));\n }\n\n /**\n * Adds dynamic props to components in the given config so this config could be used to initialize a layout\n * @param config Dehydrated config object\n * @param hydrateComponent Function to hydrate the component\n * @returns Hydrated config\n */\n static hydrateLayoutConfig(\n config: (PanelConfig | ItemConfig)[],\n hydrateComponent: (\n componentName: string,\n props: DehydratedPanelProps\n ) => DehydratedDashboardPanelProps\n ): DashboardLayoutConfig {\n if (config == null || !config.length) {\n return [];\n }\n const hydratedConfig = [];\n\n for (let i = 0; i < config.length; i += 1) {\n const itemConfig = config[i];\n if (isReactComponentConfig(itemConfig)) {\n const { component, props = {} } = itemConfig;\n hydratedConfig.push({\n ...itemConfig,\n id: itemConfig?.id ?? nanoid(),\n props: hydrateComponent(component, props),\n });\n } else if (itemConfig.content !== undefined) {\n const contentConfig = LayoutUtils.hydrateLayoutConfig(\n itemConfig.content,\n hydrateComponent\n );\n if (\n isStackItemConfig(itemConfig) &&\n itemConfig.activeItemIndex != null &&\n itemConfig.activeItemIndex >= contentConfig.length\n ) {\n log.warn(\n 'Fixing bad activeItemIndex!',\n itemConfig.activeItemIndex,\n itemConfig\n );\n itemConfig.activeItemIndex = 0;\n }\n hydratedConfig.push({\n ...itemConfig,\n content: contentConfig,\n });\n } else {\n hydratedConfig.push(itemConfig);\n }\n }\n\n return hydratedConfig;\n }\n\n /**\n * Opens a component. It will try and open the component in an existing stack of the same component.\n * If `replaceExisting` is true and there is a component found with the same `config.id`, it will replace that component with this one.\n * If `allowStack` is true and there is a component of the same type found, it will open in that stack (potentially covering up a panel).\n * @param root The GoldenLayout root to open the component in\n * @param config The component config definition to open\n * @param replaceExisting Whether it should replace the existing one matching component type and id, or open a new one\n * @param replaceConfig The component config to replace\n * @param createNewStack True to force opening in a new stack, false to try and open in a stack with the same type of component.\n * @param focusElement The element to focus on\n * @param dragEvent Whether component is being created with a drag, mouse event is initial position for drag proxy\n */\n static openComponent({\n root,\n config: configParam,\n stack: stackParam = undefined,\n replaceExisting = true,\n replaceConfig = undefined,\n createNewStack = false,\n focusElement = undefined,\n dragEvent = undefined,\n }: {\n root?: ContentItem;\n config?: Partial<ReactComponentConfig>;\n stack?: Stack;\n replaceExisting?: boolean;\n replaceConfig?: Partial<ItemConfig>;\n createNewStack?: boolean;\n focusElement?: string;\n dragEvent?: MouseEvent;\n } = {}): void {\n // attempt to retain focus after dom manipulation, which can break focus\n const maintainFocusElement = document.activeElement;\n const config = { ...configParam } as ReactComponentConfig;\n\n if (config.id == null) {\n config.id = nanoid();\n }\n\n if (dragEvent != null) {\n root?.layoutManager.createDragSourceFromEvent(config, dragEvent);\n return;\n }\n\n const searchConfig = replaceConfig || {\n id: config.id,\n component: config.component,\n };\n assertNotNull(root);\n const stack =\n stackParam ??\n (createNewStack\n ? LayoutUtils.addStack(root)\n : LayoutUtils.getStackForRoot(root, searchConfig));\n\n assertNotNull(stack);\n const oldContentItem = LayoutUtils.getContentItemInStack(\n stack,\n searchConfig\n );\n\n if (focusElement != null) {\n // We need to listen for when the stack is created\n const onComponentCreated = (event: {\n origin: { element: Element[] };\n }): void => {\n log.debug('Component created, focusing element', focusElement);\n\n stack.off('componentCreated', onComponentCreated);\n\n const { element } = event.origin;\n\n // Need to wait until the component actually renders.\n requestAnimationFrame(() => {\n LayoutUtils.focusElement(element[0], focusElement);\n });\n };\n stack.on('componentCreated', onComponentCreated);\n }\n if (replaceExisting && oldContentItem) {\n const index = stack.contentItems.indexOf(oldContentItem);\n\n // Using remove/add here instead of replaceChild because I was getting errors with replaceChild... should be the same.\n // Add first so that the stack doesn't get screwed up\n stack.addChild(config, index + 1);\n stack.removeChild(oldContentItem);\n\n stack.setActiveContentItem(stack.contentItems[index]);\n } else {\n stack.addChild(config);\n }\n\n if (\n focusElement == null &&\n maintainFocusElement &&\n isHTMLElement(maintainFocusElement)\n ) {\n maintainFocusElement.focus();\n }\n }\n\n /**\n * Opens a component in an given stack.\n * If `replaceExisting` is true and there is a component found with the same `config.id`, it will replace that component with this one\n * @param stack The GoldenLayout stack to open the component in\n * @param config The component config definition to open\n * @param replaceExisting Whether it should replace the existing one matching component type and id, or open a new one\n */\n static openComponentInStack(\n stack: Stack | null,\n config: ItemConfig & Record<string, unknown>,\n replaceExisting = true\n ): void {\n const maintainFocusElement = document.activeElement; // attempt to retain focus after dom manipulation, which can break focus\n\n const searchConfig = { id: config.id };\n\n const oldContentItem = LayoutUtils.getContentItemInStack(\n stack,\n searchConfig\n );\n\n if (replaceExisting && oldContentItem && stack) {\n const index = stack?.contentItems.indexOf(oldContentItem);\n\n // Using remove/add here instead of replaceChild because I was getting errors with replaceChild... should be the same.\n // Add first so that the stack doesn't get screwed up\n stack.addChild(config, index + 1);\n stack.removeChild(oldContentItem);\n\n stack.setActiveContentItem(stack.contentItems[index]);\n } else {\n stack?.addChild(config);\n }\n\n if (maintainFocusElement && isHTMLElement(maintainFocusElement)) {\n maintainFocusElement.focus();\n }\n }\n\n /**\n * Close the specified component and remove it from the stack it's currently in\n * @param root The GoldenLayout root to search and close the component in\n * @param config The GoldenLayout component config definition to close, eg. { component: 'IrisGridPanel', id: 'table-t' }\n */\n static closeComponent(\n root: ContentItem,\n config: LayoutConfig,\n closeOptions?: CloseOptions\n ): void {\n const stack = LayoutUtils.getStackForRoot(\n root,\n config,\n false,\n false,\n false\n );\n\n if (!stack) {\n log.warn('Cannot find stack for component, ignoring close', config);\n return;\n }\n\n // Find the tab with the specified config and remove it\n // Same component was used to get the stack above, so getContentItemInStack shouldn't return null\n const oldContentItem = LayoutUtils.getContentItemInStack(stack, config);\n const maintainFocusElement = document.activeElement; // attempt to retain focus after dom manipulation, which can break focus\n if (oldContentItem) {\n if (isComponent(oldContentItem)) {\n oldContentItem.container.close(closeOptions);\n } else {\n stack.removeChild(oldContentItem);\n }\n }\n // if focused element is still in dom restore focus, note it could have been in the removed panel so check first\n if (\n maintainFocusElement &&\n document.contains(maintainFocusElement) &&\n isHTMLElement(maintainFocusElement)\n ) {\n maintainFocusElement.focus();\n }\n }\n\n static renameComponent(\n root: ContentItem,\n config: Partial<ItemConfig>,\n newTitle: string\n ): void {\n const stack = LayoutUtils.getStackForRoot(root, config, false);\n if (!stack) {\n log.error('Could not find stack for config', config);\n return;\n }\n // Find the tab with the specified config and rename it\n const contentItem = LayoutUtils.getContentItemInStack(stack, config);\n if (contentItem) {\n contentItem.setTitle(newTitle);\n }\n }\n\n /**\n * Create a component clone based on the given config\n * @param root The GoldenLayout root to clone the component in\n * @param config The config to clone\n * @returns Clone config\n */\n static cloneComponent(\n root: ContentItem,\n config: ReactComponentConfig\n ): ReactComponentConfig | null {\n const stack = LayoutUtils.getStackForRoot(root, config, false);\n if (!stack) {\n log.error('Could not find stack for config', config);\n return null;\n }\n const { props = {} } = config;\n const panelState = LayoutUtils.getPanelComponentState(config);\n const cloneConfig = {\n type: 'react-component' as const,\n component: config.component,\n props: {\n ...props,\n panelState,\n },\n title: `${config.title} Copy`,\n id: nanoid(),\n };\n LayoutUtils.openComponentInStack(stack, cloneConfig);\n return cloneConfig;\n }\n\n /**\n * Get panel component state for the given config\n * @param config Panel config\n * @returns Panel state\n */\n static getPanelComponentState(config: ItemConfig): unknown {\n if (isComponentConfig(config)) {\n return config.componentState?.panelState;\n }\n if (isReactComponentConfig(config)) {\n return config.props?.panelState;\n }\n return null;\n }\n\n static makeDefaultLayout(): Config {\n return {\n dimensions: {\n headerHeight: GoldenLayoutThemeExport.tabHeight,\n borderWidth: GoldenLayoutThemeExport.dragBorderWidth,\n borderGrabWidth: 10,\n },\n settings: {\n showPopoutIcon: false,\n showCloseIcon: false,\n constrainDragToContainer: false,\n },\n } as Config;\n }\n\n /**\n * Gets a containers root node\n * @param container The Golden Layout container to get the root for\n */\n static getRootFromContainer(container: Container): ContentItem {\n return container.layoutManager.root;\n }\n\n /**\n * Gets the config for the panel component given a glContainer\n * @param container The Golden Layout container to get the config for\n */\n static getComponentConfigFromContainer(\n container?: Container\n ): ItemConfig | null {\n if (container) {\n if (container.tab != null && container.tab.contentItem != null) {\n return container.tab.contentItem.config;\n }\n\n // If the container hasn't populated the tab yet, just get the config directly from the container\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore private api usage\n // eslint-disable-next-line no-underscore-dangle\n return container._config;\n }\n\n return null;\n }\n\n static getTitleFromContainer(\n container: Container\n ): string | null | undefined {\n if (\n container != null &&\n container.tab != null &&\n container.tab.contentItem != null\n ) {\n return container.tab.contentItem.config.title;\n }\n return null;\n }\n\n static getTitleFromTab(tab: Tab): string | null | undefined {\n if (tab != null && tab.contentItem != null) {\n return tab.contentItem.config.title;\n }\n return null;\n }\n\n /**\n * Retrieve the panel ID for the provided golden layout container\n * @param glContainer The container to get the panel ID for\n * @returns Panel ID\n */\n static getIdFromContainer(glContainer: Container): PanelId | null {\n const config = LayoutUtils.getComponentConfigFromContainer(glContainer);\n if (config) {\n return config.id as PanelId;\n }\n return null;\n }\n\n /**\n * Retrieve the ID of the panel provided\n * @param panel The panel to get the ID for\n * @returns Panel ID\n */\n static getIdFromPanel(panel: LayoutPanel): PanelId | null {\n const { glContainer } = panel.props;\n return LayoutUtils.getIdFromContainer(glContainer);\n }\n\n /**\n * Get component name from the panel instance\n * @param panel Panel to get component name for\n * @returns Component name or null if unable to retrieve name\n */\n static getComponentNameFromPanel(panel: LayoutPanel): string | null {\n const { glContainer } = panel.props;\n const config = LayoutUtils.getComponentConfigFromContainer(glContainer);\n if (config && isReactComponentConfig(config)) {\n return config.component ?? null;\n }\n return null;\n }\n\n /**\n * Get component name for wrapped and un-wrapped components\n * @param component Component to get name for\n * @returns Component name\n * @throws If displayName for the component is not defined\n */\n static getComponentName(component: {\n displayName?: string;\n WrappedComponent?: { displayName?: string };\n }): string {\n const name =\n component.WrappedComponent?.displayName ?? component.displayName;\n if (name == null) {\n throw new Error(`Component displayName not defined ${component}`);\n }\n return name;\n }\n\n /**\n * Put focus on the first \"input\" element (input, button, select, textarea) within an element\n * If element is null or input element not found, does nothing\n * @param element The element to put focus in.\n * @param selector The first element matching this selector will be focused.\n * @returns The element that was focused, null if not focused\n */\n static focusElement(\n element: Element,\n selector = LayoutUtils.DEFAULT_FOCUS_SELECTOR\n ): Element | null {\n if (element == null) {\n return null;\n }\n const focusElement = element.querySelector(selector);\n if (focusElement == null) {\n return null;\n }\n\n if (isHTMLElement(focusElement)) {\n focusElement.focus();\n }\n return focusElement;\n }\n\n /**\n * Get a promise that initializes when layout is initialized\n * @param layout The layout to await initialization on\n * @returns Promise that resolves when layout is initialized\n */\n static onInitialized(layout: GoldenLayout): Promise<void> {\n return new Promise(resolve => {\n if (layout.isInitialised) {\n resolve();\n return;\n }\n const onInit = (): void => {\n layout.off('initialised', onInit);\n resolve();\n };\n layout.on('initialised', onInit);\n });\n }\n}\n\nexport default LayoutUtils;\n"],"mappings":";;;;;AAAA,OAAOA,SAAS,MAAM,iBAAiB;AACvC,SAASC,MAAM,QAAQ,QAAQ;AAC/B,OAAOC,OAAO,MAAM,gBAAgB;AACpC,OAAOC,GAAG,MAAM,gBAAgB;AAEhC,SACEC,WAAW,EACXC,MAAM,EACNC,OAAO,EACPC,uBAAuB,QAClB,0BAA0B;AAajC,SAASC,aAAa,QAAoB,kBAAkB;AAS5D,IAAMC,GAAG,GAAGN,GAAG,CAACO,MAAM,CAAC,aAAa,CAAC;AAcrC,SAASC,iBAAiBA,CAACC,MAAkB,EAA6B;EACxE,OAAQA,MAAM,CAAqBC,aAAa,KAAKC,SAAS;AAChE;AAEA,OAAO,SAASC,sBAAsBA,CACpCH,MAAkB,EACc;EAChC,IAAMI,WAAW,GAAGJ,MAA8B;EAClD;EACA;EACA,OACE,CAAED,iBAAiB,CAACC,MAAM,CAAC,IACzBA,MAAM,CAACC,aAAa,KAAK,oBAAoB,IAC7CD,MAAM,CAACK,IAAI,KAAK,iBAAiB,KACnCD,WAAW,CAACE,SAAS,KAAKJ,SAAS;AAEv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CAAC;IACpD,IAAIxD,YAAY,IAAI,IAAI,EAAE;MACxB,OAAO,IAAI;IACb;IAEA,IAAIxH,aAAa,CAACwH,YAAY,CAAC,EAAE;MAC/BA,YAAY,CAACtH,KAAK,CAAC,CAAC;IACtB;IACA,OAAOsH,YAAY;EACrB;;EAEA;AACF;AACA;AACA;AACA;EACE,OAAO2D,aAAaA,CAACzI,MAAoB,EAAiB;IACxD,OAAO,IAAI0I,OAAO,CAACC,OAAO,IAAI;MAC5B,IAAI3I,MAAM,CAAC4I,aAAa,EAAE;QACxBD,OAAO,CAAC,CAAC;QACT;MACF;MACA,IAAME,MAAM,GAAGA,CAAA,KAAY;QACzB7I,MAAM,CAACsF,GAAG,CAAC,aAAa,EAAEuD,MAAM,CAAC;QACjCF,OAAO,CAAC,CAAC;MACX,CAAC;MACD3I,MAAM,CAACyF,EAAE,CAAC,aAAa,EAAEoD,MAAM,CAAC;IAClC,CAAC,CAAC;EACJ;AACF;AAACC,eAAA,CAv5BKpL,WAAW,4BACiB,iCAAiC;AAw5BnE,eAAeA,WAAW","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["default","LayoutManagerContext","LayoutUtils","GLPropTypes","useDashboardPanel","useLayoutManager","useListener","usePanelRegistration"],"sources":["../../src/layout/index.ts"],"sourcesContent":["export { default as LayoutManagerContext } from './LayoutManagerContext';\nexport { default as LayoutUtils, type PanelId } from './LayoutUtils';\nexport { default as GLPropTypes } from './GLPropTypes';\nexport { default as useDashboardPanel } from './useDashboardPanel';\nexport { default as useLayoutManager } from './useLayoutManager';\nexport { default as useListener } from './useListener';\nexport { default as usePanelRegistration } from './usePanelRegistration';\n"],"mappings":"SAASA,OAAO,IAAIC,oBAAoB;AAAA,SAC/BD,OAAO,IAAIE,WAAW;AAAA,SACtBF,OAAO,IAAIG,WAAW;AAAA,SACtBH,OAAO,IAAII,iBAAiB;AAAA,SAC5BJ,OAAO,IAAIK,gBAAgB;AAAA,SAC3BL,OAAO,IAAIM,WAAW;AAAA,SACtBN,OAAO,IAAIO,oBAAoB"}
1
+ {"version":3,"file":"index.js","names":["default","LayoutManagerContext","LayoutUtils","GLPropTypes","useDashboardPanel","useLayoutManager","useListener","usePanelRegistration"],"sources":["../../src/layout/index.ts"],"sourcesContent":["export { default as LayoutManagerContext } from './LayoutManagerContext';\nexport { default as LayoutUtils, type PanelId } from './LayoutUtils';\nexport { default as GLPropTypes } from './GLPropTypes';\nexport { default as useDashboardPanel } from './useDashboardPanel';\nexport { default as useLayoutManager } from './useLayoutManager';\nexport { default as useListener } from './useListener';\nexport { default as usePanelRegistration } from './usePanelRegistration';\n"],"mappings":"SAASA,OAAO,IAAIC,oBAAoB;AAAA,SAC/BD,OAAO,IAAIE,WAAW;AAAA,SACtBF,OAAO,IAAIG,WAAW;AAAA,SACtBH,OAAO,IAAII,iBAAiB;AAAA,SAC5BJ,OAAO,IAAIK,gBAAgB;AAAA,SAC3BL,OAAO,IAAIM,WAAW;AAAA,SACtBN,OAAO,IAAIO,oBAAoB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"useDashboardPanel.js","names":["useCallback","nanoid","usePanelOpenListener","LayoutUtils","usePanelRegistration","useDashboardPanel","_ref","dashboardProps","componentName","component","supportedTypes","hydrate","dehydrate","id","layout","registerComponent","handlePanelOpen","_ref2","dragEvent","panelId","widget","name","type","isSupportedType","Array","isArray","includes","props","localDashboardId","metadata","config","title","undefined","root","openComponent","eventHub"],"sources":["../../src/layout/useDashboardPanel.ts"],"sourcesContent":["import { type ComponentType, useCallback } from 'react';\nimport type { ReactComponentConfig } from '@deephaven/golden-layout';\nimport { nanoid } from 'nanoid';\nimport {\n type DashboardPanelProps,\n type DashboardPluginComponentProps,\n type DehydratedDashboardPanelProps,\n type PanelComponentType,\n type PanelDehydrateFunction,\n type PanelHydrateFunction,\n} from '../DashboardPlugin';\nimport { type PanelOpenEventDetail, usePanelOpenListener } from '../PanelEvent';\nimport LayoutUtils from './LayoutUtils';\nimport usePanelRegistration from './usePanelRegistration';\n\n/**\n * Register a panel that will be opened when one of the `supportedTypes` objects is triggered.\n */\nexport function useDashboardPanel<\n P extends DashboardPanelProps,\n C extends ComponentType<P>,\n>({\n dashboardProps,\n componentName,\n component,\n supportedTypes,\n hydrate,\n dehydrate,\n}: {\n /** Props from the dashboard this panel is being registered in */\n dashboardProps: DashboardPluginComponentProps;\n\n /** Name of the component to register */\n componentName: string;\n\n /** Component type to register */\n component: PanelComponentType<P, C>;\n\n /** Names of the supported variable types this panel opens for */\n supportedTypes: string | string[];\n\n /** Custom hydration function to call when opening a panel */\n hydrate?: PanelHydrateFunction;\n\n /** Custom dehydration function to call when saving a panel's state to the layout */\n dehydrate?: PanelDehydrateFunction;\n}): void {\n const { id, layout, registerComponent } = dashboardProps;\n\n const handlePanelOpen = useCallback(\n ({ dragEvent, panelId = nanoid(), widget }: PanelOpenEventDetail) => {\n const { name, type } = widget;\n const isSupportedType =\n type != null &&\n ((Array.isArray(supportedTypes) && supportedTypes.includes(type)) ||\n type === supportedTypes);\n if (!isSupportedType) {\n // Only want to listen for your custom variable types\n return;\n }\n let props: DehydratedDashboardPanelProps = {\n localDashboardId: id,\n metadata: widget,\n };\n if (hydrate != null) {\n props = hydrate(props, id);\n }\n const config: ReactComponentConfig = {\n type: 'react-component',\n component: componentName,\n props,\n title: name ?? undefined,\n id: panelId,\n };\n\n const { root } = layout;\n LayoutUtils.openComponent({ root, config, dragEvent });\n },\n [componentName, hydrate, id, layout, supportedTypes]\n );\n\n /**\n * Register our custom component type so the layout know hows to open it\n */\n usePanelRegistration(registerComponent, component, hydrate, dehydrate);\n\n /**\n * Listen for panel open events so we know when to open a panel\n */\n usePanelOpenListener(layout.eventHub, handlePanelOpen);\n}\n\nexport default useDashboardPanel;\n"],"mappings":"AAAA,SAA6BA,WAAW,QAAQ,OAAO;AAEvD,SAASC,MAAM,QAAQ,QAAQ;AAAC,SASIC,oBAAoB;AAAA,OACjDC,WAAW;AAAA,OACXC,oBAAoB;A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,EAAE,EAAEC,MAAM,EAAEJ,cAAc,CACrD,CAAC;;EAED;AACF;AACA;EACEN,oBAAoB,CAACW,iBAAiB,EAAEN,SAAS,EAAEE,OAAO,EAAEC,SAAS,CAAC;;EAEtE;AACF;AACA;EACEV,oBAAoB,CAACY,MAAM,CAACqB,QAAQ,EAAEnB,eAAe,CAAC;AACxD;AAEA,eAAeX,iBAAiB"}
1
+ {"version":3,"file":"useDashboardPanel.js","names":["useCallback","nanoid","usePanelOpenListener","LayoutUtils","usePanelRegistration","useDashboardPanel","_ref","dashboardProps","componentName","component","supportedTypes","hydrate","dehydrate","id","layout","registerComponent","handlePanelOpen","_ref2","dragEvent","panelId","widget","name","type","isSupportedType","Array","isArray","includes","props","localDashboardId","metadata","config","title","undefined","root","openComponent","eventHub"],"sources":["../../src/layout/useDashboardPanel.ts"],"sourcesContent":["import { type ComponentType, useCallback } from 'react';\nimport type { ReactComponentConfig } from '@deephaven/golden-layout';\nimport { nanoid } from 'nanoid';\nimport {\n type DashboardPanelProps,\n type DashboardPluginComponentProps,\n type DehydratedDashboardPanelProps,\n type PanelComponentType,\n type PanelDehydrateFunction,\n type PanelHydrateFunction,\n} from '../DashboardPlugin';\nimport { type PanelOpenEventDetail, usePanelOpenListener } from '../PanelEvent';\nimport LayoutUtils from './LayoutUtils';\nimport usePanelRegistration from './usePanelRegistration';\n\n/**\n * Register a panel that will be opened when one of the `supportedTypes` objects is triggered.\n */\nexport function useDashboardPanel<\n P extends DashboardPanelProps,\n C extends ComponentType<P>,\n>({\n dashboardProps,\n componentName,\n component,\n supportedTypes,\n hydrate,\n dehydrate,\n}: {\n /** Props from the dashboard this panel is being registered in */\n dashboardProps: DashboardPluginComponentProps;\n\n /** Name of the component to register */\n componentName: string;\n\n /** Component type to register */\n component: PanelComponentType<P, C>;\n\n /** Names of the supported variable types this panel opens for */\n supportedTypes: string | string[];\n\n /** Custom hydration function to call when opening a panel */\n hydrate?: PanelHydrateFunction;\n\n /** Custom dehydration function to call when saving a panel's state to the layout */\n dehydrate?: PanelDehydrateFunction;\n}): void {\n const { id, layout, registerComponent } = dashboardProps;\n\n const handlePanelOpen = useCallback(\n ({ dragEvent, panelId = nanoid(), widget }: PanelOpenEventDetail) => {\n const { name, type } = widget;\n const isSupportedType =\n type != null &&\n ((Array.isArray(supportedTypes) && supportedTypes.includes(type)) ||\n type === supportedTypes);\n if (!isSupportedType) {\n // Only want to listen for your custom variable types\n return;\n }\n let props: DehydratedDashboardPanelProps = {\n localDashboardId: id,\n metadata: widget,\n };\n if (hydrate != null) {\n props = hydrate(props, id);\n }\n const config: ReactComponentConfig = {\n type: 'react-component',\n component: componentName,\n props,\n title: name ?? undefined,\n id: panelId,\n };\n\n const { root } = layout;\n LayoutUtils.openComponent({ root, config, dragEvent });\n },\n [componentName, hydrate, id, layout, supportedTypes]\n );\n\n /**\n * Register our custom component type so the layout know hows to open it\n */\n usePanelRegistration(registerComponent, component, hydrate, dehydrate);\n\n /**\n * Listen for panel open events so we know when to open a panel\n */\n usePanelOpenListener(layout.eventHub, handlePanelOpen);\n}\n\nexport default useDashboardPanel;\n"],"mappings":"AAAA,SAA6BA,WAAW,QAAQ,OAAO;AAEvD,SAASC,MAAM,QAAQ,QAAQ;AAAC,SASIC,oBAAoB;AAAA,OACjDC,WAAW;AAAA,OACXC,oBAAoB;AAE3B;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAAAC,IAAA,EA4BxB;EAAA,IAzBP;IACAC,cAAc;IACdC,aAAa;IACbC,SAAS;IACTC,cAAc;IACdC,OAAO;IACPC;EAmBF,CAAC,GAAAN,IAAA;EACC,IAAM;IAAEO,EAAE;IAAEC,MAAM;IAAEC;EAAkB,CAAC,GAAGR,cAAc;EAExD,IAAMS,eAAe,GAAGhB,WAAW,CACjCiB,KAAA,IAAqE;IAAA,IAApE;MAAEC,SAAS;MAAEC,OAAO,GAAGlB,MAAM,CAAC,CAAC;MAAEmB;IAA6B,CAAC,GAAAH,KAAA;IAC9D,IAAM;MAAEI,IAAI;MAAEC;IAAK,CAAC,GAAGF,MAAM;IAC7B,IAAMG,eAAe,GACnBD,IAAI,IAAI,IAAI,KACVE,KAAK,CAACC,OAAO,CAACf,cAAc,CAAC,IAAIA,cAAc,CAACgB,QAAQ,CAACJ,IAAI,CAAC,IAC9DA,IAAI,KAAKZ,cAAc,CAAC;IAC5B,IAAI,CAACa,eAAe,EAAE;MACpB;MACA;IACF;IACA,IAAII,KAAoC,GAAG;MACzCC,gBAAgB,EAAEf,EAAE;MACpBgB,QAAQ,EAAET;IACZ,CAAC;IACD,IAAIT,OAAO,IAAI,IAAI,EAAE;MACnBgB,KAAK,GAAGhB,OAAO,CAACgB,KAAK,EAAEd,EAAE,CAAC;IAC5B;IACA,IAAMiB,MAA4B,GAAG;MACnCR,IAAI,EAAE,iBAAiB;MACvBb,SAAS,EAAED,aAAa;MACxBmB,KAAK;MACLI,KAAK,EAAEV,IAAI,aAAJA,IAAI,cAAJA,IAAI,GAAIW,SAAS;MACxBnB,EAAE,EAAEM;IACN,CAAC;IAED,IAAM;MAAEc;IAAK,CAAC,GAAGnB,MAAM;IACvBX,WAAW,CAAC+B,aAAa,CAAC;MAAED,IAAI;MAAEH,MAAM;MAAEZ;IAAU,CAAC,CAAC;EACxD,CAAC,EACD,CAACV,aAAa,EAAEG,OAAO,EAAEE,EAAE,EAAEC,MAAM,EAAEJ,cAAc,CACrD,CAAC;;EAED;AACF;AACA;EACEN,oBAAoB,CAACW,iBAAiB,EAAEN,SAAS,EAAEE,OAAO,EAAEC,SAAS,CAAC;;EAEtE;AACF;AACA;EACEV,oBAAoB,CAACY,MAAM,CAACqB,QAAQ,EAAEnB,eAAe,CAAC;AACxD;AAEA,eAAeX,iBAAiB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"useLayoutManager.js","names":["useContext","LayoutManagerContext","useLayoutManager","layoutManager","Error"],"sources":["../../src/layout/useLayoutManager.ts"],"sourcesContent":["import { useContext } from 'react';\nimport type LayoutManager from '@deephaven/golden-layout';\nimport LayoutManagerContext from './LayoutManagerContext';\n\n/**\n * Retrieve the current LayoutManager from the context\n */\nfunction useLayoutManager(): LayoutManager {\n const layoutManager = useContext(LayoutManagerContext);\n if (layoutManager == null) {\n throw new Error(\n 'LayoutManager not available, did you add a LayoutManagerContext.Provider to the tree?'\n );\n }\n return layoutManager;\n}\n\nexport default useLayoutManager;\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,OAAO;AAAC,OAE5BC,oBAAoB;AAE3B;AACA;AACA;AACA,SAASC,gBAAgBA,CAAA,EAAkB;EACzC,IAAMC,aAAa,GAAGH,UAAU,CAACC,oBAAoB,CAAC;EACtD,IAAIE,aAAa,IAAI,IAAI,EAAE;IACzB,MAAM,IAAIC,KAAK,CACb,uFACF,CAAC;EACH;EACA,OAAOD,aAAa;AACtB;AAEA,eAAeD,gBAAgB"}
1
+ {"version":3,"file":"useLayoutManager.js","names":["useContext","LayoutManagerContext","useLayoutManager","layoutManager","Error"],"sources":["../../src/layout/useLayoutManager.ts"],"sourcesContent":["import { useContext } from 'react';\nimport type LayoutManager from '@deephaven/golden-layout';\nimport LayoutManagerContext from './LayoutManagerContext';\n\n/**\n * Retrieve the current LayoutManager from the context\n */\nfunction useLayoutManager(): LayoutManager {\n const layoutManager = useContext(LayoutManagerContext);\n if (layoutManager == null) {\n throw new Error(\n 'LayoutManager not available, did you add a LayoutManagerContext.Provider to the tree?'\n );\n }\n return layoutManager;\n}\n\nexport default useLayoutManager;\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,OAAO;AAAC,OAE5BC,oBAAoB;AAE3B;AACA;AACA;AACA,SAASC,gBAAgBA,CAAA,EAAkB;EACzC,IAAMC,aAAa,GAAGH,UAAU,CAACC,oBAAoB,CAAC;EACtD,IAAIE,aAAa,IAAI,IAAI,EAAE;IACzB,MAAM,IAAIC,KAAK,CACb,uFACF,CAAC;EACH;EACA,OAAOD,aAAa;AACtB;AAEA,eAAeD,gBAAgB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"useListener.js","names":["useEffect","useListener","eventEmitter","eventName","callback","initEventEmitter","on","off"],"sources":["../../src/layout/useListener.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport type { EventEmitter } from '@deephaven/golden-layout';\n\n/**\n * Listen for a specific event on an EventEmitter\n * @param eventEmitter EventEmitter to listen to\n * @param eventName Name of the event to listen to\n * @param callback Callback to call when the event is triggered\n */\nexport function useListener(\n eventEmitter: EventEmitter,\n eventName: string,\n // eslint-disable-next-line @typescript-eslint/ban-types\n callback: Function\n): void {\n useEffect(\n function initEventEmitter() {\n eventEmitter.on(eventName, callback);\n\n return () => {\n eventEmitter.off(eventName, callback);\n };\n },\n [eventEmitter, eventName, callback]\n );\n}\n\nexport default useListener;\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,OAAO;AAGjC;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CACzBC,YAA0B,EAC1BC,SAAiB;AACjB;AACAC,QAAkB,EACZ;EACNJ,SAAS,CACP,SAASK,gBAAgBA,CAAA,EAAG;IAC1BH,YAAY,CAACI,EAAE,CAACH,SAAS,EAAEC,QAAQ,CAAC;IAEpC,OAAO,MAAM;MACXF,YAAY,CAACK,GAAG,CAACJ,SAAS,EAAEC,QAAQ,CAAC;IACvC,CAAC;EACH,CAAC,EACD,CAACF,YAAY,EAAEC,SAAS,EAAEC,QAAQ,CACpC,CAAC;AACH;AAEA,eAAeH,WAAW"}
1
+ {"version":3,"file":"useListener.js","names":["useEffect","useListener","eventEmitter","eventName","callback","initEventEmitter","on","off"],"sources":["../../src/layout/useListener.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport type { EventEmitter } from '@deephaven/golden-layout';\n\n/**\n * Listen for a specific event on an EventEmitter\n * @param eventEmitter EventEmitter to listen to\n * @param eventName Name of the event to listen to\n * @param callback Callback to call when the event is triggered\n */\nexport function useListener(\n eventEmitter: EventEmitter,\n eventName: string,\n // eslint-disable-next-line @typescript-eslint/ban-types\n callback: Function\n): void {\n useEffect(\n function initEventEmitter() {\n eventEmitter.on(eventName, callback);\n\n return () => {\n eventEmitter.off(eventName, callback);\n };\n },\n [eventEmitter, eventName, callback]\n );\n}\n\nexport default useListener;\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,OAAO;AAGjC;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CACzBC,YAA0B,EAC1BC,SAAiB;AACjB;AACAC,QAAkB,EACZ;EACNJ,SAAS,CACP,SAASK,gBAAgBA,CAAA,EAAG;IAC1BH,YAAY,CAACI,EAAE,CAACH,SAAS,EAAEC,QAAQ,CAAC;IAEpC,OAAO,MAAM;MACXF,YAAY,CAACK,GAAG,CAACJ,SAAS,EAAEC,QAAQ,CAAC;IACvC,CAAC;EACH,CAAC,EACD,CAACF,YAAY,EAAEC,SAAS,EAAEC,QAAQ,CACpC,CAAC;AACH;AAEA,eAAeH,WAAW","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"usePanelRegistration.js","names":["React","usePanelRegistration","registerComponent","ComponentType","hydrate","dehydrate","_ComponentType$COMPON","name","COMPONENT","displayName","Error","useEffect","deregister"],"sources":["../../src/layout/usePanelRegistration.ts"],"sourcesContent":["import React from 'react';\nimport {\n type DashboardPanelProps,\n type DashboardPluginComponentProps,\n type PanelComponentType,\n type PanelDehydrateFunction,\n type PanelHydrateFunction,\n} from '../DashboardPlugin';\n\n/**\n * Registers a given panel component. Also runs a `useEffect` that will\n * automatically de-register then panel on unmount.\n * @param registerComponent\n * @param ComponentType\n * @param hydrate\n * @param dehydrate\n */\nexport default function usePanelRegistration<\n P extends DashboardPanelProps,\n C extends React.ComponentType<P>,\n>(\n registerComponent: DashboardPluginComponentProps['registerComponent'],\n ComponentType: PanelComponentType<P, C>,\n hydrate?: PanelHydrateFunction,\n dehydrate?: PanelDehydrateFunction\n): void {\n const name = ComponentType.COMPONENT ?? ComponentType.displayName;\n\n if (name == null) {\n throw new Error(\n 'ComponentType must have a `COMPONENT` or `displayName` attribute.'\n );\n }\n\n React.useEffect(() => {\n const deregister = registerComponent(\n name,\n ComponentType,\n hydrate,\n dehydrate\n );\n\n return () => {\n deregister();\n };\n }, [ComponentType, dehydrate, hydrate, name, registerComponent]);\n}\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AASzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,oBAAoBA,CAI1CC,iBAAqE,EACrEC,aAAuC,EACvCC,OAA8B,EAC9BC,SAAkC,EAC5B;EAAA,IAAAC,qBAAA;EACN,IAAMC,IAAI,IAAAD,qBAAA,GAAGH,aAAa,CAACK,SAAS,cAAAF,qBAAA,cAAAA,qBAAA,GAAIH,aAAa,CAACM,WAAW;EAEjE,IAAIF,IAAI,IAAI,IAAI,EAAE;IAChB,MAAM,IAAIG,KAAK,CACb,mEACF,CAAC;EACH;EAEAV,KAAK,CAACW,SAAS,CAAC,MAAM;IACpB,IAAMC,UAAU,GAAGV,iBAAiB,CAClCK,IAAI,EACJJ,aAAa,EACbC,OAAO,EACPC,SACF,CAAC;IAED,OAAO,MAAM;MACXO,UAAU,CAAC,CAAC;IACd,CAAC;EACH,CAAC,EAAE,CAACT,aAAa,EAAEE,SAAS,EAAED,OAAO,EAAEG,IAAI,EAAEL,iBAAiB,CAAC,CAAC;AAClE"}
1
+ {"version":3,"file":"usePanelRegistration.js","names":["React","usePanelRegistration","registerComponent","ComponentType","hydrate","dehydrate","_ComponentType$COMPON","name","COMPONENT","displayName","Error","useEffect","deregister"],"sources":["../../src/layout/usePanelRegistration.ts"],"sourcesContent":["import React from 'react';\nimport {\n type DashboardPanelProps,\n type DashboardPluginComponentProps,\n type PanelComponentType,\n type PanelDehydrateFunction,\n type PanelHydrateFunction,\n} from '../DashboardPlugin';\n\n/**\n * Registers a given panel component. Also runs a `useEffect` that will\n * automatically de-register then panel on unmount.\n * @param registerComponent\n * @param ComponentType\n * @param hydrate\n * @param dehydrate\n */\nexport default function usePanelRegistration<\n P extends DashboardPanelProps,\n C extends React.ComponentType<P>,\n>(\n registerComponent: DashboardPluginComponentProps['registerComponent'],\n ComponentType: PanelComponentType<P, C>,\n hydrate?: PanelHydrateFunction,\n dehydrate?: PanelDehydrateFunction\n): void {\n const name = ComponentType.COMPONENT ?? ComponentType.displayName;\n\n if (name == null) {\n throw new Error(\n 'ComponentType must have a `COMPONENT` or `displayName` attribute.'\n );\n }\n\n React.useEffect(() => {\n const deregister = registerComponent(\n name,\n ComponentType,\n hydrate,\n dehydrate\n );\n\n return () => {\n deregister();\n };\n }, [ComponentType, dehydrate, hydrate, name, registerComponent]);\n}\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AASzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,oBAAoBA,CAI1CC,iBAAqE,EACrEC,aAAuC,EACvCC,OAA8B,EAC9BC,SAAkC,EAC5B;EAAA,IAAAC,qBAAA;EACN,IAAMC,IAAI,IAAAD,qBAAA,GAAGH,aAAa,CAACK,SAAS,cAAAF,qBAAA,cAAAA,qBAAA,GAAIH,aAAa,CAACM,WAAW;EAEjE,IAAIF,IAAI,IAAI,IAAI,EAAE;IAChB,MAAM,IAAIG,KAAK,CACb,mEACF,CAAC;EACH;EAEAV,KAAK,CAACW,SAAS,CAAC,MAAM;IACpB,IAAMC,UAAU,GAAGV,iBAAiB,CAClCK,IAAI,EACJJ,aAAa,EACbC,OAAO,EACPC,SACF,CAAC;IAED,OAAO,MAAM;MACXO,UAAU,CAAC,CAAC;IACd,CAAC;EACH,CAAC,EAAE,CAACT,aAAa,EAAEE,SAAS,EAAED,OAAO,EAAEG,IAAI,EAAEL,iBAAiB,CAAC,CAAC;AAClE","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"actionTypes.js","names":["SET_DASHBOARD_DATA"],"sources":["../../src/redux/actionTypes.ts"],"sourcesContent":["// eslint-disable-next-line import/prefer-default-export\nexport const SET_DASHBOARD_DATA = 'SET_DASHBOARD_DATA';\n"],"mappings":"AAAA;AACA,OAAO,IAAMA,kBAAkB,GAAG,oBAAoB"}
1
+ {"version":3,"file":"actionTypes.js","names":["SET_DASHBOARD_DATA"],"sources":["../../src/redux/actionTypes.ts"],"sourcesContent":["// eslint-disable-next-line import/prefer-default-export\nexport const SET_DASHBOARD_DATA = 'SET_DASHBOARD_DATA';\n"],"mappings":"AAAA;AACA,OAAO,IAAMA,kBAAkB,GAAG,oBAAoB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"actions.js","names":["SET_DASHBOARD_DATA","getDashboardData","getPluginDataMapForDashboard","setDashboardData","id","data","type","payload","updateDashboardData","dispatch","getState","_objectSpread","setDashboardPluginData","pluginId","pluginDataMap"],"sources":["../../src/redux/actions.ts"],"sourcesContent":["import {\n type DashboardData,\n type PluginData,\n type RootState,\n} from '@deephaven/redux';\nimport type { Action } from 'redux';\nimport type { ThunkAction } from 'redux-thunk';\nimport { SET_DASHBOARD_DATA } from './actionTypes';\nimport { getDashboardData, getPluginDataMapForDashboard } from './selectors';\n\n/**\n * Action to replace the dashboard data for a dashboard\n * @param id The ID of the dashboard to set the data on\n * @param data Data for the dashboard\n * @returns The action to get dispatched\n */\nexport const setDashboardData = (\n id: string,\n data: DashboardData\n): {\n type: string;\n id: string;\n payload: DashboardData;\n} => ({\n type: SET_DASHBOARD_DATA,\n id,\n payload: data,\n});\n\n/**\n * Action to update the dashboard data. Will combine the update with any existing dashboard data.\n * @param id The id of the dashboard to update the data on\n * @param updateData The data to combine with the existing dashboard data\n * @returns\n */\nexport const updateDashboardData =\n (\n id: string,\n data: DashboardData\n ): ThunkAction<unknown, RootState, undefined, Action<unknown>> =>\n (dispatch, getState) =>\n dispatch(\n setDashboardData(id, {\n ...getDashboardData(getState(), id),\n ...data,\n })\n );\n\n/**\n * Action to set the dashboard plugin data.\n * Will replace any existing plugin data for the plugin in the dashboard with the data provided.\n * @param id The id of the dashboard to set the data on\n * @param pluginId The id of the plugin to set the data on\n * @param data The data to replace the existing plugin data with\n * @returns Thunk action to dispatch\n */\nexport const setDashboardPluginData =\n (\n id: string,\n pluginId: string,\n data: PluginData\n ): ThunkAction<unknown, RootState, undefined, Action<unknown>> =>\n (dispatch, getState) =>\n dispatch(\n setDashboardData(id, {\n ...getDashboardData(getState(), id),\n pluginDataMap: {\n ...getPluginDataMapForDashboard(getState(), id),\n [pluginId]: data,\n },\n })\n );\n"],"mappings":";;;;;SAOSA,kBAAkB;AAAA,SAClBC,gBAAgB,EAAEC,4BAA4B;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMC,gBAAgB,GAAGA,CAC9BC,EAAU,EACVC,IAAmB,MAKf;EACJC,IAAI,EAAEN,kBAAkB;EACxBI,EAAE;EACFG,OAAO,EAAEF;AACX,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMG,mBAAmB,GAC9BA,CACEJ,EAAU,EACVC,IAAmB,KAErB,CAACI,QAAQ,EAAEC,QAAQ,KACjBD,QAAQ,CACNN,gBAAgB,CAACC,EAAE,EAAAO,aAAA,CAAAA,aAAA,KACdV,gBAAgB,CAACS,QAAQ,CAAC,CAAC,EAAEN,EAAE,CAAC,GAChCC,IAAI,CACR,CACH,CAAC;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMO,sBAAsB,GACjCA,CACER,EAAU,EACVS,QAAgB,EAChBR,IAAgB,KAElB,CAACI,QAAQ,EAAEC,QAAQ,KACjBD,QAAQ,CACNN,gBAAgB,CAACC,EAAE,EAAAO,aAAA,CAAAA,aAAA,KACdV,gBAAgB,CAACS,QAAQ,CAAC,CAAC,EAAEN,EAAE,CAAC;EACnCU,aAAa,EAAAH,aAAA,CAAAA,aAAA,KACRT,4BAA4B,CAACQ,QAAQ,CAAC,CAAC,EAAEN,EAAE,CAAC;IAC/C,CAACS,QAAQ,GAAGR;EAAI;AACjB,EACF,CACH,CAAC"}
1
+ {"version":3,"file":"actions.js","names":["SET_DASHBOARD_DATA","getDashboardData","getPluginDataMapForDashboard","setDashboardData","id","data","type","payload","updateDashboardData","dispatch","getState","_objectSpread","setDashboardPluginData","pluginId","pluginDataMap"],"sources":["../../src/redux/actions.ts"],"sourcesContent":["import {\n type DashboardData,\n type PluginData,\n type RootState,\n} from '@deephaven/redux';\nimport type { Action } from 'redux';\nimport type { ThunkAction } from 'redux-thunk';\nimport { SET_DASHBOARD_DATA } from './actionTypes';\nimport { getDashboardData, getPluginDataMapForDashboard } from './selectors';\n\n/**\n * Action to replace the dashboard data for a dashboard\n * @param id The ID of the dashboard to set the data on\n * @param data Data for the dashboard\n * @returns The action to get dispatched\n */\nexport const setDashboardData = (\n id: string,\n data: DashboardData\n): {\n type: string;\n id: string;\n payload: DashboardData;\n} => ({\n type: SET_DASHBOARD_DATA,\n id,\n payload: data,\n});\n\n/**\n * Action to update the dashboard data. Will combine the update with any existing dashboard data.\n * @param id The id of the dashboard to update the data on\n * @param updateData The data to combine with the existing dashboard data\n * @returns\n */\nexport const updateDashboardData =\n (\n id: string,\n data: DashboardData\n ): ThunkAction<unknown, RootState, undefined, Action<unknown>> =>\n (dispatch, getState) =>\n dispatch(\n setDashboardData(id, {\n ...getDashboardData(getState(), id),\n ...data,\n })\n );\n\n/**\n * Action to set the dashboard plugin data.\n * Will replace any existing plugin data for the plugin in the dashboard with the data provided.\n * @param id The id of the dashboard to set the data on\n * @param pluginId The id of the plugin to set the data on\n * @param data The data to replace the existing plugin data with\n * @returns Thunk action to dispatch\n */\nexport const setDashboardPluginData =\n (\n id: string,\n pluginId: string,\n data: PluginData\n ): ThunkAction<unknown, RootState, undefined, Action<unknown>> =>\n (dispatch, getState) =>\n dispatch(\n setDashboardData(id, {\n ...getDashboardData(getState(), id),\n pluginDataMap: {\n ...getPluginDataMapForDashboard(getState(), id),\n [pluginId]: data,\n },\n })\n );\n"],"mappings":";;;;;SAOSA,kBAAkB;AAAA,SAClBC,gBAAgB,EAAEC,4BAA4B;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMC,gBAAgB,GAAGA,CAC9BC,EAAU,EACVC,IAAmB,MAKf;EACJC,IAAI,EAAEN,kBAAkB;EACxBI,EAAE;EACFG,OAAO,EAAEF;AACX,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMG,mBAAmB,GAC9BA,CACEJ,EAAU,EACVC,IAAmB,KAErB,CAACI,QAAQ,EAAEC,QAAQ,KACjBD,QAAQ,CACNN,gBAAgB,CAACC,EAAE,EAAAO,aAAA,CAAAA,aAAA,KACdV,gBAAgB,CAACS,QAAQ,CAAC,CAAC,EAAEN,EAAE,CAAC,GAChCC,IAAI,CACR,CACH,CAAC;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMO,sBAAsB,GACjCA,CACER,EAAU,EACVS,QAAgB,EAChBR,IAAgB,KAElB,CAACI,QAAQ,EAAEC,QAAQ,KACjBD,QAAQ,CACNN,gBAAgB,CAACC,EAAE,EAAAO,aAAA,CAAAA,aAAA,KACdV,gBAAgB,CAACS,QAAQ,CAAC,CAAC,EAAEN,EAAE,CAAC;EACnCU,aAAa,EAAAH,aAAA,CAAAA,aAAA,KACRT,4BAA4B,CAACQ,QAAQ,CAAC,CAAC,EAAEN,EAAE,CAAC;IAC/C,CAACS,QAAQ,GAAGR;EAAI;AACjB,EACF,CACH,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.js","names":["useCallback","useDispatch","useSelector","getPluginDataForDashboard","setDashboardPluginData","useDashboardPluginData","dashboardId","pluginId","dispatch","data","store","setData","newData"],"sources":["../../src/redux/hooks.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useDispatch, useSelector } from 'react-redux';\nimport { type PluginData, type RootState } from '@deephaven/redux';\nimport { getPluginDataForDashboard } from './selectors';\nimport { setDashboardPluginData } from './actions';\n\n/**\n * Custom hook that provides access to plugin data for a specific dashboard and plugin.\n * @param dashboardId - The ID of the dashboard.\n * @param pluginId - The ID of the plugin.\n * @returns A tuple containing the plugin data and a function to update the plugin data.\n */\nexport function useDashboardPluginData<T = PluginData>(\n dashboardId: string,\n pluginId: string\n): [T, (data: T) => void] {\n const dispatch = useDispatch();\n const data = useSelector((store: RootState) =>\n getPluginDataForDashboard<T>(store, dashboardId, pluginId)\n );\n const setData = useCallback(\n (newData: T) =>\n dispatch(setDashboardPluginData(dashboardId, pluginId, newData)),\n [dashboardId, pluginId, dispatch]\n );\n return [data, setData];\n}\n\nexport default { useDashboardPluginData };\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,OAAO;AACnC,SAASC,WAAW,EAAEC,WAAW,QAAQ,aAAa;AAAC,SAE9CC,yBAAyB;AAAA,SACzBC,sBAAsB;AAE/B;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAsBA,CACpCC,WAAmB,EACnBC,QAAgB,EACQ;EACxB,IAAMC,QAAQ,GAAGP,WAAW,CAAC,CAAC;EAC9B,IAAMQ,IAAI,GAAGP,WAAW,CAAEQ,KAAgB,IACxCP,yBAAyB,CAAIO,KAAK,EAAEJ,WAAW,EAAEC,QAAQ,CAC3D,CAAC;EACD,IAAMI,OAAO,GAAGX,WAAW,CACxBY,OAAU,IACTJ,QAAQ,CAACJ,sBAAsB,CAACE,WAAW,EAAEC,QAAQ,EAAEK,OAAO,CAAC,CAAC,EAClE,CAACN,WAAW,EAAEC,QAAQ,EAAEC,QAAQ,CAClC,CAAC;EACD,OAAO,CAACC,IAAI,EAAEE,OAAO,CAAC;AACxB;AAEA,eAAe;EAAEN;AAAuB,CAAC"}
1
+ {"version":3,"file":"hooks.js","names":["useCallback","useDispatch","useSelector","getPluginDataForDashboard","setDashboardPluginData","useDashboardPluginData","dashboardId","pluginId","dispatch","data","store","setData","newData"],"sources":["../../src/redux/hooks.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useDispatch, useSelector } from 'react-redux';\nimport { type PluginData, type RootState } from '@deephaven/redux';\nimport { getPluginDataForDashboard } from './selectors';\nimport { setDashboardPluginData } from './actions';\n\n/**\n * Custom hook that provides access to plugin data for a specific dashboard and plugin.\n * @param dashboardId - The ID of the dashboard.\n * @param pluginId - The ID of the plugin.\n * @returns A tuple containing the plugin data and a function to update the plugin data.\n */\nexport function useDashboardPluginData<T = PluginData>(\n dashboardId: string,\n pluginId: string\n): [T, (data: T) => void] {\n const dispatch = useDispatch();\n const data = useSelector((store: RootState) =>\n getPluginDataForDashboard<T>(store, dashboardId, pluginId)\n );\n const setData = useCallback(\n (newData: T) =>\n dispatch(setDashboardPluginData(dashboardId, pluginId, newData)),\n [dashboardId, pluginId, dispatch]\n );\n return [data, setData];\n}\n\nexport default { useDashboardPluginData };\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,OAAO;AACnC,SAASC,WAAW,EAAEC,WAAW,QAAQ,aAAa;AAAC,SAE9CC,yBAAyB;AAAA,SACzBC,sBAAsB;AAE/B;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAsBA,CACpCC,WAAmB,EACnBC,QAAgB,EACQ;EACxB,IAAMC,QAAQ,GAAGP,WAAW,CAAC,CAAC;EAC9B,IAAMQ,IAAI,GAAGP,WAAW,CAAEQ,KAAgB,IACxCP,yBAAyB,CAAIO,KAAK,EAAEJ,WAAW,EAAEC,QAAQ,CAC3D,CAAC;EACD,IAAMI,OAAO,GAAGX,WAAW,CACxBY,OAAU,IACTJ,QAAQ,CAACJ,sBAAsB,CAACE,WAAW,EAAEC,QAAQ,EAAEK,OAAO,CAAC,CAAC,EAClE,CAACN,WAAW,EAAEC,QAAQ,EAAEC,QAAQ,CAClC,CAAC;EACD,OAAO,CAACC,IAAI,EAAEE,OAAO,CAAC;AACxB;AAEA,eAAe;EAAEN;AAAuB,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["reducerRegistry","reducers","Object","entries","map","_ref","name","reducer","register"],"sources":["../../src/redux/index.ts"],"sourcesContent":["import { reducerRegistry } from '@deephaven/redux';\nimport reducers from './reducers';\n\nObject.entries(reducers).map(([name, reducer]) =>\n reducerRegistry.register(name, reducer)\n);\n\nexport { reducers };\nexport * from './actions';\nexport * from './actionTypes';\nexport * from './hooks';\nexport * from './selectors';\n"],"mappings":"AAAA,SAASA,eAAe,QAAQ,kBAAkB;AAAC,OAC5CC,QAAQ;AAEfC,MAAM,CAACC,OAAO,CAACF,QAAQ,CAAC,CAACG,GAAG,CAACC,IAAA;EAAA,IAAC,CAACC,IAAI,EAAEC,OAAO,CAAC,GAAAF,IAAA;EAAA,OAC3CL,eAAe,CAACQ,QAAQ,CAACF,IAAI,EAAEC,OAAO,CAAC;AAAA,CACzC,CAAC;AAED,SAASN,QAAQ;AAAG;AAAA;AAAA;AAAA"}
1
+ {"version":3,"file":"index.js","names":["reducerRegistry","reducers","Object","entries","map","_ref","name","reducer","register"],"sources":["../../src/redux/index.ts"],"sourcesContent":["import { reducerRegistry } from '@deephaven/redux';\nimport reducers from './reducers';\n\nObject.entries(reducers).map(([name, reducer]) =>\n reducerRegistry.register(name, reducer)\n);\n\nexport { reducers };\nexport * from './actions';\nexport * from './actionTypes';\nexport * from './hooks';\nexport * from './selectors';\n"],"mappings":"AAAA,SAASA,eAAe,QAAQ,kBAAkB;AAAC,OAC5CC,QAAQ;AAEfC,MAAM,CAACC,OAAO,CAACF,QAAQ,CAAC,CAACG,GAAG,CAACC,IAAA;EAAA,IAAC,CAACC,IAAI,EAAEC,OAAO,CAAC,GAAAF,IAAA;EAAA,OAC3CL,eAAe,CAACQ,QAAQ,CAACF,IAAI,EAAEC,OAAO,CAAC;AAAA,CACzC,CAAC;AAED,SAASN,QAAQ;AAAG;AAAA;AAAA;AAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"dashboardData.js","names":["replaceByIdReducer","SET_DASHBOARD_DATA"],"sources":["../../../src/redux/reducers/dashboardData.ts"],"sourcesContent":["/**\n * Store information about input filters set in a dashboard\n */\nimport { replaceByIdReducer } from '@deephaven/redux';\nimport { SET_DASHBOARD_DATA } from '../actionTypes';\n\nexport default replaceByIdReducer(SET_DASHBOARD_DATA, {}, false);\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,kBAAkB,QAAQ,kBAAkB;AAAC,SAC7CC,kBAAkB;AAE3B,eAAeD,kBAAkB,CAACC,kBAAkB,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC"}
1
+ {"version":3,"file":"dashboardData.js","names":["replaceByIdReducer","SET_DASHBOARD_DATA"],"sources":["../../../src/redux/reducers/dashboardData.ts"],"sourcesContent":["/**\n * Store information about input filters set in a dashboard\n */\nimport { replaceByIdReducer } from '@deephaven/redux';\nimport { SET_DASHBOARD_DATA } from '../actionTypes';\n\nexport default replaceByIdReducer(SET_DASHBOARD_DATA, {}, false);\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,kBAAkB,QAAQ,kBAAkB;AAAC,SAC7CC,kBAAkB;AAE3B,eAAeD,kBAAkB,CAACC,kBAAkB,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["dashboardData"],"sources":["../../../src/redux/reducers/index.ts"],"sourcesContent":["import dashboardData from './dashboardData';\n\nexport default { dashboardData };\n"],"mappings":"OAAOA,aAAa;AAEpB,eAAe;EAAEA;AAAc,CAAC"}
1
+ {"version":3,"file":"index.js","names":["dashboardData"],"sources":["../../../src/redux/reducers/index.ts"],"sourcesContent":["import dashboardData from './dashboardData';\n\nexport default { dashboardData };\n"],"mappings":"OAAOA,aAAa;AAEpB,eAAe;EAAEA;AAAc,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"selectors.js","names":["useDispatch","useSelector","useStore","EMPTY_MAP","Map","EMPTY_OBJECT","Object","freeze","EMPTY_ARRAY","useAppDispatch","useAppSelector","useAppStore","getAllDashboardsData","store","dashboardData","getDashboardData","dashboardId","_getAllDashboardsData","getClosedPanelsForDashboard","_getDashboardData$clo","closed","getOpenedPanelMapForDashboard","_getDashboardData$ope","openedMap","getPluginDataMapForDashboard","_getDashboardData$plu","pluginDataMap","getPluginDataForDashboard","pluginId"],"sources":["../../src/redux/selectors.ts"],"sourcesContent":["import {\n type AppStore,\n type DashboardData,\n type PluginData,\n type PluginDataMap,\n type RootDispatch,\n type RootState,\n} from '@deephaven/redux';\nimport {\n type TypedUseSelectorHook,\n useDispatch,\n useSelector,\n useStore,\n} from 'react-redux';\nimport { type ClosedPanels, type OpenedPanelMap } from '../PanelManager';\n\nconst EMPTY_MAP = new Map();\n\nconst EMPTY_OBJECT = Object.freeze({});\n\nconst EMPTY_ARRAY = Object.freeze([]);\n\ntype Selector<R> = (state: RootState) => R;\n\n// https://react-redux.js.org/using-react-redux/usage-with-typescript#define-typed-hooks\n// Defined in @deephaven/dashboard, as that's the most common package with React and @deephaven/redux as dependencies\n// We could have another package specifically for this, but it's not really necessary.\nexport const useAppDispatch: () => RootDispatch = useDispatch;\nexport const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;\nexport const useAppStore: () => AppStore = useStore;\n\n/**\n * Retrieve the data for all dashboards\n * @param store The redux store\n * @returns Property mapping dashboard ID to data for that dashboard\n */\nexport const getAllDashboardsData: Selector<\n Record<string, DashboardData>\n> = store => store.dashboardData;\n\n/**\n * @param store The redux store\n * @param dashboardId The dashboard ID to get data for\n * @returns The data object for the dashboard with the specified ID\n */\nexport const getDashboardData = (\n store: RootState,\n dashboardId: string\n): DashboardData => getAllDashboardsData(store)[dashboardId] ?? EMPTY_OBJECT;\n\n/**\n * @param store The redux store\n * @param dashboardId The dashboard ID to get data for\n * @returns The ClosedPanel array of panels that were previously closed/dehydrated\n */\nexport const getClosedPanelsForDashboard = (\n store: RootState,\n dashboardId: string\n): ClosedPanels =>\n (getDashboardData(store, dashboardId).closed ?? EMPTY_ARRAY) as ClosedPanels;\n\n/**\n * @param store The redux store\n * @param dashboardId The dashboard ID to get data for\n * @returns The map of panel IDs to components of all currently open components\n */\nexport const getOpenedPanelMapForDashboard = (\n store: RootState,\n dashboardId: string\n): OpenedPanelMap =>\n (getDashboardData(store, dashboardId).openedMap ??\n EMPTY_MAP) as OpenedPanelMap;\n\n/**\n * @param store The redux store\n * @param dashboardId The dashboard ID to get data for\n * @returns The map of plugin IDs to data for all plugins on the dashboard\n */\nexport const getPluginDataMapForDashboard = <T = PluginData>(\n store: RootState,\n dashboardId: string\n): PluginDataMap<T> =>\n getDashboardData(store, dashboardId).pluginDataMap ?? EMPTY_OBJECT;\n\n/**\n * @param store The redux store\n * @param dashboardId The dashboard ID to get data for\n * @param pluginId The plugin ID to get data for\n * @returns The plugin data\n */\nexport const getPluginDataForDashboard = <T = PluginData>(\n store: RootState,\n dashboardId: string,\n pluginId: string\n): T => getPluginDataMapForDashboard<T>(store, dashboardId)[pluginId];\n"],"mappings":"AAQA,SAEEA,WAAW,EACXC,WAAW,EACXC,QAAQ,QACH,aAAa;AAGpB,IAAMC,SAAS,GAAG,IAAIC,GAAG,CAAC,CAAC;AAE3B,IAAMC,YAAY,GAAGC,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,CAAC;AAEtC,IAAMC,WAAW,GAAGF,MAAM,CAACC,MAAM,CAAC,EAAE,CAAC;AAIrC;AACA;AACA;AACA,OAAO,IAAME,cAAkC,GAAGT,WAAW;AAC7D,OAAO,IAAMU,cAA+C,GAAGT,WAAW;AAC1E,OAAO,IAAMU,WAA2B,GAAGT,QAAQ;;AAEnD;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMU,oBAEZ,GAAGC,KAAK,IAAIA,KAAK,CAACC,aAAa;;AAEhC;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMC,gBAAgB,GAAGA,CAC9BF,KAAgB,EAChBG,WAAmB;EAAA,IAAAC,qBAAA;EAAA,QAAAA,qBAAA,GACDL,oBAAoB,CAACC,KAAK,CAAC,CAACG,WAAW,CAAC,cAAAC,qBAAA,cAAAA,qBAAA,GAAIZ,YAAY;AAAA;;AAE5E;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMa,2BAA2B,GAAGA,CACzCL,KAAgB,EAChBG,WAAmB;EAAA,IAAAG,qBAAA;EAAA,QAAAA,qBAAA,GAElBJ,gBAAgB,CAACF,KAAK,EAAEG,WAAW,CAAC,CAACI,MAAM,cAAAD,qBAAA,cAAAA,qBAAA,GAAIX,WAAW;AAAA,CAAiB;;AAE9E;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMa,6BAA6B,GAAGA,CAC3CR,KAAgB,EAChBG,WAAmB;EAAA,IAAAM,qBAAA;EAAA,QAAAA,qBAAA,GAElBP,gBAAgB,CAACF,KAAK,EAAEG,WAAW,CAAC,CAACO,SAAS,cAAAD,qBAAA,cAAAA,qBAAA,GAC7CnB,SAAS;AAAA,CAAmB;;AAEhC;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMqB,4BAA4B,GAAGA,CAC1CX,KAAgB,EAChBG,WAAmB;EAAA,IAAAS,qBAAA;EAAA,QAAAA,qBAAA,GAEnBV,gBAAgB,CAACF,KAAK,EAAEG,WAAW,CAAC,CAACU,aAAa,cAAAD,qBAAA,cAAAA,qBAAA,GAAIpB,YAAY;AAAA;;AAEpE;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMsB,yBAAyB,GAAGA,CACvCd,KAAgB,EAChBG,WAAmB,EACnBY,QAAgB,KACVJ,4BAA4B,CAAIX,KAAK,EAAEG,WAAW,CAAC,CAACY,QAAQ,CAAC"}
1
+ {"version":3,"file":"selectors.js","names":["useDispatch","useSelector","useStore","EMPTY_MAP","Map","EMPTY_OBJECT","Object","freeze","EMPTY_ARRAY","useAppDispatch","useAppSelector","useAppStore","getAllDashboardsData","store","dashboardData","getDashboardData","dashboardId","_getAllDashboardsData","getClosedPanelsForDashboard","_getDashboardData$clo","closed","getOpenedPanelMapForDashboard","_getDashboardData$ope","openedMap","getPluginDataMapForDashboard","_getDashboardData$plu","pluginDataMap","getPluginDataForDashboard","pluginId"],"sources":["../../src/redux/selectors.ts"],"sourcesContent":["import {\n type AppStore,\n type DashboardData,\n type PluginData,\n type PluginDataMap,\n type RootDispatch,\n type RootState,\n} from '@deephaven/redux';\nimport {\n type TypedUseSelectorHook,\n useDispatch,\n useSelector,\n useStore,\n} from 'react-redux';\nimport { type ClosedPanels, type OpenedPanelMap } from '../PanelManager';\n\nconst EMPTY_MAP = new Map();\n\nconst EMPTY_OBJECT = Object.freeze({});\n\nconst EMPTY_ARRAY = Object.freeze([]);\n\ntype Selector<R> = (state: RootState) => R;\n\n// https://react-redux.js.org/using-react-redux/usage-with-typescript#define-typed-hooks\n// Defined in @deephaven/dashboard, as that's the most common package with React and @deephaven/redux as dependencies\n// We could have another package specifically for this, but it's not really necessary.\nexport const useAppDispatch: () => RootDispatch = useDispatch;\nexport const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;\nexport const useAppStore: () => AppStore = useStore;\n\n/**\n * Retrieve the data for all dashboards\n * @param store The redux store\n * @returns Property mapping dashboard ID to data for that dashboard\n */\nexport const getAllDashboardsData: Selector<\n Record<string, DashboardData>\n> = store => store.dashboardData;\n\n/**\n * @param store The redux store\n * @param dashboardId The dashboard ID to get data for\n * @returns The data object for the dashboard with the specified ID\n */\nexport const getDashboardData = (\n store: RootState,\n dashboardId: string\n): DashboardData => getAllDashboardsData(store)[dashboardId] ?? EMPTY_OBJECT;\n\n/**\n * @param store The redux store\n * @param dashboardId The dashboard ID to get data for\n * @returns The ClosedPanel array of panels that were previously closed/dehydrated\n */\nexport const getClosedPanelsForDashboard = (\n store: RootState,\n dashboardId: string\n): ClosedPanels =>\n (getDashboardData(store, dashboardId).closed ?? EMPTY_ARRAY) as ClosedPanels;\n\n/**\n * @param store The redux store\n * @param dashboardId The dashboard ID to get data for\n * @returns The map of panel IDs to components of all currently open components\n */\nexport const getOpenedPanelMapForDashboard = (\n store: RootState,\n dashboardId: string\n): OpenedPanelMap =>\n (getDashboardData(store, dashboardId).openedMap ??\n EMPTY_MAP) as OpenedPanelMap;\n\n/**\n * @param store The redux store\n * @param dashboardId The dashboard ID to get data for\n * @returns The map of plugin IDs to data for all plugins on the dashboard\n */\nexport const getPluginDataMapForDashboard = <T = PluginData>(\n store: RootState,\n dashboardId: string\n): PluginDataMap<T> =>\n getDashboardData(store, dashboardId).pluginDataMap ?? EMPTY_OBJECT;\n\n/**\n * @param store The redux store\n * @param dashboardId The dashboard ID to get data for\n * @param pluginId The plugin ID to get data for\n * @returns The plugin data\n */\nexport const getPluginDataForDashboard = <T = PluginData>(\n store: RootState,\n dashboardId: string,\n pluginId: string\n): T => getPluginDataMapForDashboard<T>(store, dashboardId)[pluginId];\n"],"mappings":"AAQA,SAEEA,WAAW,EACXC,WAAW,EACXC,QAAQ,QACH,aAAa;AAGpB,IAAMC,SAAS,GAAG,IAAIC,GAAG,CAAC,CAAC;AAE3B,IAAMC,YAAY,GAAGC,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,CAAC;AAEtC,IAAMC,WAAW,GAAGF,MAAM,CAACC,MAAM,CAAC,EAAE,CAAC;AAIrC;AACA;AACA;AACA,OAAO,IAAME,cAAkC,GAAGT,WAAW;AAC7D,OAAO,IAAMU,cAA+C,GAAGT,WAAW;AAC1E,OAAO,IAAMU,WAA2B,GAAGT,QAAQ;;AAEnD;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMU,oBAEZ,GAAGC,KAAK,IAAIA,KAAK,CAACC,aAAa;;AAEhC;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMC,gBAAgB,GAAGA,CAC9BF,KAAgB,EAChBG,WAAmB;EAAA,IAAAC,qBAAA;EAAA,QAAAA,qBAAA,GACDL,oBAAoB,CAACC,KAAK,CAAC,CAACG,WAAW,CAAC,cAAAC,qBAAA,cAAAA,qBAAA,GAAIZ,YAAY;AAAA;;AAE5E;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMa,2BAA2B,GAAGA,CACzCL,KAAgB,EAChBG,WAAmB;EAAA,IAAAG,qBAAA;EAAA,QAAAA,qBAAA,GAElBJ,gBAAgB,CAACF,KAAK,EAAEG,WAAW,CAAC,CAACI,MAAM,cAAAD,qBAAA,cAAAA,qBAAA,GAAIX,WAAW;AAAA,CAAiB;;AAE9E;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMa,6BAA6B,GAAGA,CAC3CR,KAAgB,EAChBG,WAAmB;EAAA,IAAAM,qBAAA;EAAA,QAAAA,qBAAA,GAElBP,gBAAgB,CAACF,KAAK,EAAEG,WAAW,CAAC,CAACO,SAAS,cAAAD,qBAAA,cAAAA,qBAAA,GAC7CnB,SAAS;AAAA,CAAmB;;AAEhC;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMqB,4BAA4B,GAAGA,CAC1CX,KAAgB,EAChBG,WAAmB;EAAA,IAAAS,qBAAA;EAAA,QAAAA,qBAAA,GAEnBV,gBAAgB,CAACF,KAAK,EAAEG,WAAW,CAAC,CAACU,aAAa,cAAAD,qBAAA,cAAAA,qBAAA,GAAIpB,YAAY;AAAA;;AAEpE;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMsB,yBAAyB,GAAGA,CACvCd,KAAgB,EAChBG,WAAmB,EACnBY,QAAgB,KACVJ,4BAA4B,CAAIX,KAAK,EAAEG,WAAW,CAAC,CAACY,QAAQ,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"useDashboardId.js","names":["createContext","useContext","DashboardIdContext","displayName","useDashboardId","dashboardId","Error"],"sources":["../src/useDashboardId.ts"],"sourcesContent":["import { createContext, useContext } from 'react';\n\nexport const DashboardIdContext = createContext<string | null>(null);\nDashboardIdContext.displayName = 'DashboardIdContext';\n\nexport function useDashboardId(): string {\n const dashboardId = useContext(DashboardIdContext);\n if (dashboardId == null) {\n throw new Error(\n 'useDashboardId must be used within a DashboardIdContext provider'\n );\n }\n return dashboardId;\n}\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,OAAO;AAEjD,OAAO,IAAMC,kBAAkB,gBAAGF,aAAa,CAAgB,IAAI,CAAC;AACpEE,kBAAkB,CAACC,WAAW,GAAG,oBAAoB;AAErD,OAAO,SAASC,cAAcA,CAAA,EAAW;EACvC,IAAMC,WAAW,GAAGJ,UAAU,CAACC,kBAAkB,CAAC;EAClD,IAAIG,WAAW,IAAI,IAAI,EAAE;IACvB,MAAM,IAAIC,KAAK,CACb,kEACF,CAAC;EACH;EACA,OAAOD,WAAW;AACpB"}
1
+ {"version":3,"file":"useDashboardId.js","names":["createContext","useContext","DashboardIdContext","displayName","useDashboardId","dashboardId","Error"],"sources":["../src/useDashboardId.ts"],"sourcesContent":["import { createContext, useContext } from 'react';\n\nexport const DashboardIdContext = createContext<string | null>(null);\nDashboardIdContext.displayName = 'DashboardIdContext';\n\nexport function useDashboardId(): string {\n const dashboardId = useContext(DashboardIdContext);\n if (dashboardId == null) {\n throw new Error(\n 'useDashboardId must be used within a DashboardIdContext provider'\n );\n }\n return dashboardId;\n}\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,OAAO;AAEjD,OAAO,IAAMC,kBAAkB,gBAAGF,aAAa,CAAgB,IAAI,CAAC;AACpEE,kBAAkB,CAACC,WAAW,GAAG,oBAAoB;AAErD,OAAO,SAASC,cAAcA,CAAA,EAAW;EACvC,IAAMC,WAAW,GAAGJ,UAAU,CAACC,kBAAkB,CAAC;EAClD,IAAIG,WAAW,IAAI,IAAI,EAAE;IACvB,MAAM,IAAIC,KAAK,CACb,kEACF,CAAC;EACH;EACA,OAAOD,WAAW;AACpB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"useDhId.js","names":["Log","useFiber","usePanelId","log","module","DH_ID_PROP","useDhId","_ref","_useFiber","props","pendingProps","dhIdProp","panelId","Error","concat","warn"],"sources":["../src/useDhId.ts"],"sourcesContent":["import Log from '@deephaven/log';\nimport { useFiber } from './useFiber';\nimport { usePanelId } from './usePanelId';\n\nconst log = Log.module('useDhId');\n\nexport const DH_ID_PROP = '__dhId';\n\n/**\n * Gets the Deephaven ID of a component.\n * This is used to identify the component within a dashboard.\n * Usually this is just a panel ID, but in some contexts such as dh.ui,\n * it may be an ID for a component within a panel.\n *\n * Looks for a __dhId prop on the component, and if not found, looks in the PanelIdContext.\n * @param props The props of the component using this hook\n * @returns The Deephaven ID of the component or null if not found.\n */\nexport function useDhId(): string | null {\n // pendingProps are the props passed to the fiber node\n const props =\n (useFiber()?.pendingProps as Record<string, unknown> | undefined) ?? {};\n const dhIdProp = props[DH_ID_PROP];\n const panelId = usePanelId();\n\n if (dhIdProp != null) {\n if (typeof dhIdProp !== 'string') {\n throw new Error(\n `useDhId expected prop ${DH_ID_PROP} to be a string, but got ${typeof dhIdProp}`\n );\n }\n return dhIdProp;\n }\n\n if (panelId == null) {\n log.warn(\n `useDhId must be used within a PanelIdContext provider if there is no ${DH_ID_PROP} prop. Defaulting to null.`\n );\n return null;\n }\n\n return panelId;\n}\n"],"mappings":"AAAA,OAAOA,GAAG,MAAM,gBAAgB;AAAC,SACxBC,QAAQ;AAAA,SACRC,UAAU;AAEnB,IAAMC,GAAG,GAAGH,GAAG,CAACI,MAAM,CAAC,SAAS,CAAC;AAEjC,OAAO,IAAMC,UAAU,GAAG,QAAQ;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,OAAOA,CAAA,EAAkB;EAAA,IAAAC,IAAA,EAAAC,SAAA;EACvC;EACA,IAAMC,KAAK,IAAAF,IAAA,IAAAC,SAAA,GACRP,QAAQ,CAAC,CAAC,cAAAO,SAAA,uBAAVA,SAAA,CAAYE,YAAY,cAAAH,IAAA,cAAAA,IAAA,GAA4C,CAAC,CAAC;EACzE,IAAMI,QAAQ,GAAGF,KAAK,CAACJ,UAAU,CAAC;EAClC,IAAMO,OAAO,GAAGV,UAAU,CAAC,CAAC;EAE5B,IAAIS,QAAQ,IAAI,IAAI,EAAE;IACpB,IAAI,OAAOA,QAAQ,KAAK,QAAQ,EAAE;MAChC,MAAM,IAAIE,KAAK,0BAAAC,MAAA,CACYT,UAAU,+BAAAS,MAAA,CAA4B,OAAOH,QAAQ,CAChF,CAAC;IACH;IACA,OAAOA,QAAQ;EACjB;EAEA,IAAIC,OAAO,IAAI,IAAI,EAAE;IACnBT,GAAG,CAACY,IAAI,yEAAAD,MAAA,CACkET,UAAU,+BACpF,CAAC;IACD,OAAO,IAAI;EACb;EAEA,OAAOO,OAAO;AAChB"}
1
+ {"version":3,"file":"useDhId.js","names":["Log","useFiber","usePanelId","log","module","DH_ID_PROP","useDhId","_ref","_useFiber","props","pendingProps","dhIdProp","panelId","Error","concat","warn"],"sources":["../src/useDhId.ts"],"sourcesContent":["import Log from '@deephaven/log';\nimport { useFiber } from './useFiber';\nimport { usePanelId } from './usePanelId';\n\nconst log = Log.module('useDhId');\n\nexport const DH_ID_PROP = '__dhId';\n\n/**\n * Gets the Deephaven ID of a component.\n * This is used to identify the component within a dashboard.\n * Usually this is just a panel ID, but in some contexts such as dh.ui,\n * it may be an ID for a component within a panel.\n *\n * Looks for a __dhId prop on the component, and if not found, looks in the PanelIdContext.\n * @param props The props of the component using this hook\n * @returns The Deephaven ID of the component or null if not found.\n */\nexport function useDhId(): string | null {\n // pendingProps are the props passed to the fiber node\n const props =\n (useFiber()?.pendingProps as Record<string, unknown> | undefined) ?? {};\n const dhIdProp = props[DH_ID_PROP];\n const panelId = usePanelId();\n\n if (dhIdProp != null) {\n if (typeof dhIdProp !== 'string') {\n throw new Error(\n `useDhId expected prop ${DH_ID_PROP} to be a string, but got ${typeof dhIdProp}`\n );\n }\n return dhIdProp;\n }\n\n if (panelId == null) {\n log.warn(\n `useDhId must be used within a PanelIdContext provider if there is no ${DH_ID_PROP} prop. Defaulting to null.`\n );\n return null;\n }\n\n return panelId;\n}\n"],"mappings":"AAAA,OAAOA,GAAG,MAAM,gBAAgB;AAAC,SACxBC,QAAQ;AAAA,SACRC,UAAU;AAEnB,IAAMC,GAAG,GAAGH,GAAG,CAACI,MAAM,CAAC,SAAS,CAAC;AAEjC,OAAO,IAAMC,UAAU,GAAG,QAAQ;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,OAAOA,CAAA,EAAkB;EAAA,IAAAC,IAAA,EAAAC,SAAA;EACvC;EACA,IAAMC,KAAK,IAAAF,IAAA,IAAAC,SAAA,GACRP,QAAQ,CAAC,CAAC,cAAAO,SAAA,uBAAVA,SAAA,CAAYE,YAAY,cAAAH,IAAA,cAAAA,IAAA,GAA4C,CAAC,CAAC;EACzE,IAAMI,QAAQ,GAAGF,KAAK,CAACJ,UAAU,CAAC;EAClC,IAAMO,OAAO,GAAGV,UAAU,CAAC,CAAC;EAE5B,IAAIS,QAAQ,IAAI,IAAI,EAAE;IACpB,IAAI,OAAOA,QAAQ,KAAK,QAAQ,EAAE;MAChC,MAAM,IAAIE,KAAK,0BAAAC,MAAA,CACYT,UAAU,+BAAAS,MAAA,CAA4B,OAAOH,QAAQ,CAChF,CAAC;IACH;IACA,OAAOA,QAAQ;EACjB;EAEA,IAAIC,OAAO,IAAI,IAAI,EAAE;IACnBT,GAAG,CAACY,IAAI,yEAAAD,MAAA,CACkET,UAAU,+BACpF,CAAC;IACD,OAAO,IAAI;EACb;EAEA,OAAOO,OAAO;AAChB","ignoreList":[]}
package/dist/useFiber.js CHANGED
@@ -21,7 +21,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
21
21
  /**
22
22
  * Traverses up or down a {@link Fiber}, return `true` to stop and select a node.
23
23
  */
24
- function traverseFiber( /** Input {@link Fiber} to traverse. */
24
+ function traverseFiber(/** Input {@link Fiber} to traverse. */
25
25
  fiber, /** Whether to ascend and walk up the tree. Will walk down if `false`. */
26
26
  ascending, /** A {@link Fiber} node selector, returns the first match when `true` is passed. */
27
27
  selector) {
@@ -1 +1 @@
1
- {"version":3,"file":"useFiber.js","names":["nanoid","React","jsx","_jsx","traverseFiber","fiber","ascending","selector","child","return","match","sibling","wrapContext","context","Object","defineProperties","_currentRenderer","get","set","_currentRenderer2","_","FiberContext","createContext","displayName","FiberProvider","Component","constructor","arguments","_defineProperty","render","children","props","Provider","value","_reactInternals","useFiber","root","useContext","Error","id","useState","actualFiber","useMemo","maybeFiber","alternate","filter","r","node","state","memoizedState","next"],"sources":["../src/useFiber.tsx"],"sourcesContent":["/**\n * Adapted from https://www.npmjs.com/package/its-fine to support React 17.\n * The main change is using `nanoid` instead of `useId` which doesn't exist in React 17.\n * Also tweaked a bit of the code to match our style and removed the parts we don't use.\n */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { nanoid } from 'nanoid';\nimport * as React from 'react';\nimport type ReactReconciler from 'react-reconciler';\n\n/**\n * Represents a react-internal Fiber node.\n */\ntype Fiber<T = any> = Omit<ReactReconciler.Fiber, 'stateNode'> & {\n stateNode: T;\n};\n\n/**\n * Represents a {@link Fiber} node selector for traversal.\n */\ntype FiberSelector<T = any> = (\n /** The current {@link Fiber} node. */\n node: Fiber<T | null>\n) => boolean | void;\n\n/**\n * Traverses up or down a {@link Fiber}, return `true` to stop and select a node.\n */\nfunction traverseFiber<T = any>(\n /** Input {@link Fiber} to traverse. */\n fiber: Fiber | undefined,\n /** Whether to ascend and walk up the tree. Will walk down if `false`. */\n ascending: boolean,\n /** A {@link Fiber} node selector, returns the first match when `true` is passed. */\n selector: FiberSelector<T>\n): Fiber<T> | undefined {\n if (!fiber) {\n return;\n }\n if (selector(fiber) === true) {\n return fiber;\n }\n\n let child = ascending ? fiber.return : fiber.child;\n while (child) {\n const match = traverseFiber(child, ascending, selector);\n if (match) {\n return match;\n }\n\n child = ascending ? null : child.sibling;\n }\n}\n\n// In development, React will warn about using contexts between renderers.\n// Hide the warning because its-fine fixes this issue\n// https://github.com/facebook/react/pull/12779\nfunction wrapContext<T>(context: React.Context<T>): React.Context<T> {\n try {\n return Object.defineProperties(context, {\n _currentRenderer: {\n get() {\n return null;\n },\n set() {\n /* no-op */\n },\n },\n _currentRenderer2: {\n get() {\n return null;\n },\n set() {\n /* no-op */\n },\n },\n });\n } catch (_) {\n return context;\n }\n}\n\n// eslint-disable-next-line react-refresh/only-export-components\nconst FiberContext = /* @__PURE__ */ wrapContext(\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n /* @__PURE__ */ React.createContext<Fiber>(null!)\n);\nFiberContext.displayName = 'FiberContext';\n\n/**\n * A react-internal {@link Fiber} provider. This component binds React children to the React Fiber tree. Call its-fine hooks within this.\n */\nexport class FiberProvider extends React.Component<{\n children?: React.ReactNode;\n}> {\n private _reactInternals!: Fiber;\n\n render(): JSX.Element {\n const { children } = this.props;\n return (\n // eslint-disable-next-line no-underscore-dangle\n <FiberContext.Provider value={this._reactInternals}>\n {children}\n </FiberContext.Provider>\n );\n }\n}\n\n/**\n * Returns the current react-internal {@link Fiber}. This is an implementation detail of [react-reconciler](https://github.com/facebook/react/tree/main/packages/react-reconciler).\n */\nexport function useFiber(): Fiber<null> | undefined {\n const root = React.useContext(FiberContext);\n if (root === null) {\n throw new Error('useFiber must be called within a <FiberProvider />!');\n }\n\n const [id] = React.useState(() => nanoid());\n const actualFiber = React.useMemo(() => {\n // eslint-disable-next-line no-restricted-syntax\n for (const maybeFiber of [root, root?.alternate].filter(r => r != null)) {\n const fiber = traverseFiber<null>(maybeFiber, false, node => {\n let state = node.memoizedState;\n while (state != null) {\n if (state.memoizedState === id) {\n return true;\n }\n state = state.next;\n }\n });\n\n if (fiber) {\n return fiber;\n }\n }\n }, [root, id]);\n\n return actualFiber;\n}\n"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,MAAM,QAAQ,QAAQ;AAC/B,OAAO,KAAKC,KAAK,MAAM,OAAO;;AAG9B;AACA;AACA;;AAKA;AACA;AACA;AAFA,SAAAC,GAAA,IAAAC,IAAA;AAQA;AACA;AACA;AACA,SAASC,aAAaA,CAAA,CACpB;AACAC,KAAwB,EACxB;AACAC,SAAkB,EAClB;A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,GAAG,IAAI,CAACC,KAAK;IAC/B;MAAA;MACE;MACA5B,IAAA,CAACkB,YAAY,CAACW,QAAQ;QAACC,KAAK,EAAE,IAAI,CAACC,eAAgB;QAAAJ,QAAA,EAChDA;MAAQ,CACY;IAAC;EAE5B;AACF;;AAEA;AACA;AACA;AACA,OAAO,SAASK,QAAQA,CAAA,EAA4B;EAClD,IAAMC,IAAI,GAAGnC,KAAK,CAACoC,UAAU,CAAChB,YAAY,CAAC;EAC3C,IAAIe,IAAI,KAAK,IAAI,EAAE;IACjB,MAAM,IAAIE,KAAK,CAAC,qDAAqD,CAAC;EACxE;EAEA,IAAM,CAACC,EAAE,CAAC,GAAGtC,KAAK,CAACuC,QAAQ,CAAC,MAAMxC,MAAM,CAAC,CAAC,CAAC;EAC3C,IAAMyC,WAAW,GAAGxC,KAAK,CAACyC,OAAO,CAAC,MAAM;IACtC;IACA,KAAK,IAAMC,UAAU,IAAI,CAACP,IAAI,EAAEA,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEQ,SAAS,CAAC,CAACC,MAAM,CAACC,CAAC,IAAIA,CAAC,IAAI,IAAI,CAAC,EAAE;MACvE,IAAMzC,KAAK,GAAGD,aAAa,CAAOuC,UAAU,EAAE,KAAK,EAAEI,IAAI,IAAI;QAC3D,IAAIC,KAAK,GAAGD,IAAI,CAACE,aAAa;QAC9B,OAAOD,KAAK,IAAI,IAAI,EAAE;UACpB,IAAIA,KAAK,CAACC,aAAa,KAAKV,EAAE,EAAE;YAC9B,OAAO,IAAI;UACb;UACAS,KAAK,GAAGA,KAAK,CAACE,IAAI;QACpB;MACF,CAAC,CAAC;MAEF,IAAI7C,KAAK,EAAE;QACT,OAAOA,KAAK;MACd;IACF;EACF,CAAC,EAAE,CAAC+B,IAAI,EAAEG,EAAE,CAAC,CAAC;EAEd,OAAOE,WAAW;AACpB"}
1
+ {"version":3,"file":"useFiber.js","names":["nanoid","React","jsx","_jsx","traverseFiber","fiber","ascending","selector","child","return","match","sibling","wrapContext","context","Object","defineProperties","_currentRenderer","get","set","_currentRenderer2","_","FiberContext","createContext","displayName","FiberProvider","Component","constructor","arguments","_defineProperty","render","children","props","Provider","value","_reactInternals","useFiber","root","useContext","Error","id","useState","actualFiber","useMemo","maybeFiber","alternate","filter","r","node","state","memoizedState","next"],"sources":["../src/useFiber.tsx"],"sourcesContent":["/**\n * Adapted from https://www.npmjs.com/package/its-fine to support React 17.\n * The main change is using `nanoid` instead of `useId` which doesn't exist in React 17.\n * Also tweaked a bit of the code to match our style and removed the parts we don't use.\n */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { nanoid } from 'nanoid';\nimport * as React from 'react';\nimport type ReactReconciler from 'react-reconciler';\n\n/**\n * Represents a react-internal Fiber node.\n */\ntype Fiber<T = any> = Omit<ReactReconciler.Fiber, 'stateNode'> & {\n stateNode: T;\n};\n\n/**\n * Represents a {@link Fiber} node selector for traversal.\n */\ntype FiberSelector<T = any> = (\n /** The current {@link Fiber} node. */\n node: Fiber<T | null>\n) => boolean | void;\n\n/**\n * Traverses up or down a {@link Fiber}, return `true` to stop and select a node.\n */\nfunction traverseFiber<T = any>(\n /** Input {@link Fiber} to traverse. */\n fiber: Fiber | undefined,\n /** Whether to ascend and walk up the tree. Will walk down if `false`. */\n ascending: boolean,\n /** A {@link Fiber} node selector, returns the first match when `true` is passed. */\n selector: FiberSelector<T>\n): Fiber<T> | undefined {\n if (!fiber) {\n return;\n }\n if (selector(fiber) === true) {\n return fiber;\n }\n\n let child = ascending ? fiber.return : fiber.child;\n while (child) {\n const match = traverseFiber(child, ascending, selector);\n if (match) {\n return match;\n }\n\n child = ascending ? null : child.sibling;\n }\n}\n\n// In development, React will warn about using contexts between renderers.\n// Hide the warning because its-fine fixes this issue\n// https://github.com/facebook/react/pull/12779\nfunction wrapContext<T>(context: React.Context<T>): React.Context<T> {\n try {\n return Object.defineProperties(context, {\n _currentRenderer: {\n get() {\n return null;\n },\n set() {\n /* no-op */\n },\n },\n _currentRenderer2: {\n get() {\n return null;\n },\n set() {\n /* no-op */\n },\n },\n });\n } catch (_) {\n return context;\n }\n}\n\n// eslint-disable-next-line react-refresh/only-export-components\nconst FiberContext = /* @__PURE__ */ wrapContext(\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n /* @__PURE__ */ React.createContext<Fiber>(null!)\n);\nFiberContext.displayName = 'FiberContext';\n\n/**\n * A react-internal {@link Fiber} provider. This component binds React children to the React Fiber tree. Call its-fine hooks within this.\n */\nexport class FiberProvider extends React.Component<{\n children?: React.ReactNode;\n}> {\n private _reactInternals!: Fiber;\n\n render(): JSX.Element {\n const { children } = this.props;\n return (\n // eslint-disable-next-line no-underscore-dangle\n <FiberContext.Provider value={this._reactInternals}>\n {children}\n </FiberContext.Provider>\n );\n }\n}\n\n/**\n * Returns the current react-internal {@link Fiber}. This is an implementation detail of [react-reconciler](https://github.com/facebook/react/tree/main/packages/react-reconciler).\n */\nexport function useFiber(): Fiber<null> | undefined {\n const root = React.useContext(FiberContext);\n if (root === null) {\n throw new Error('useFiber must be called within a <FiberProvider />!');\n }\n\n const [id] = React.useState(() => nanoid());\n const actualFiber = React.useMemo(() => {\n // eslint-disable-next-line no-restricted-syntax\n for (const maybeFiber of [root, root?.alternate].filter(r => r != null)) {\n const fiber = traverseFiber<null>(maybeFiber, false, node => {\n let state = node.memoizedState;\n while (state != null) {\n if (state.memoizedState === id) {\n return true;\n }\n state = state.next;\n }\n });\n\n if (fiber) {\n return fiber;\n }\n }\n }, [root, id]);\n\n return actualFiber;\n}\n"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,MAAM,QAAQ,QAAQ;AAC/B,OAAO,KAAKC,KAAK,MAAM,OAAO;;AAG9B;AACA;AACA;;AAKA;AACA;AACA;AAFA,SAAAC,GAAA,IAAAC,IAAA;AAQA;AACA;AACA;AACA,SAASC,aAAaA,CACpB;AACAC,KAAwB,EACxB;AACAC,SAAkB,EAClB;AACAC,QAA0B,EACJ;EACtB,IAA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C/B;MAAA;MACE;MACA5B,IAAA,CAACkB,YAAY,CAACW,QAAQ;QAACC,KAAK,EAAE,IAAI,CAACC,eAAgB;QAAAJ,QAAA,EAChDA;MAAQ,CACY;IAAC;EAE5B;AACF;;AAEA;AACA;AACA;AACA,OAAO,SAASK,QAAQA,CAAA,EAA4B;EAClD,IAAMC,IAAI,GAAGnC,KAAK,CAACoC,UAAU,CAAChB,YAAY,CAAC;EAC3C,IAAIe,IAAI,KAAK,IAAI,EAAE;IACjB,MAAM,IAAIE,KAAK,CAAC,qDAAqD,CAAC;EACxE;EAEA,IAAM,CAACC,EAAE,CAAC,GAAGtC,KAAK,CAACuC,QAAQ,CAAC,MAAMxC,MAAM,CAAC,CAAC,CAAC;EAC3C,IAAMyC,WAAW,GAAGxC,KAAK,CAACyC,OAAO,CAAC,MAAM;IACtC;IACA,KAAK,IAAMC,UAAU,IAAI,CAACP,IAAI,EAAEA,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEQ,SAAS,CAAC,CAACC,MAAM,CAACC,CAAC,IAAIA,CAAC,IAAI,IAAI,CAAC,EAAE;MACvE,IAAMzC,KAAK,GAAGD,aAAa,CAAOuC,UAAU,EAAE,KAAK,EAAEI,IAAI,IAAI;QAC3D,IAAIC,KAAK,GAAGD,IAAI,CAACE,aAAa;QAC9B,OAAOD,KAAK,IAAI,IAAI,EAAE;UACpB,IAAIA,KAAK,CAACC,aAAa,KAAKV,EAAE,EAAE;YAC9B,OAAO,IAAI;UACb;UACAS,KAAK,GAAGA,KAAK,CAACE,IAAI;QACpB;MACF,CAAC,CAAC;MAEF,IAAI7C,KAAK,EAAE;QACT,OAAOA,KAAK;MACd;IACF;EACF,CAAC,EAAE,CAAC+B,IAAI,EAAEG,EAAE,CAAC,CAAC;EAEd,OAAOE,WAAW;AACpB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"usePanelId.js","names":["createContext","useContext","PanelIdContext","displayName","usePanelId"],"sources":["../src/usePanelId.ts"],"sourcesContent":["import { createContext, useContext } from 'react';\n\n/**\n * Context to provide the golden layout panel ID.\n */\nexport const PanelIdContext = createContext<string | null>(null);\nPanelIdContext.displayName = 'PanelIdContext';\n\n/**\n * Gets the current panel ID from the nearest context.\n * @returns The current panel ID from the context, or null if not set or there is no context.\n */\nexport function usePanelId(): string | null {\n return useContext(PanelIdContext);\n}\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,OAAO;;AAEjD;AACA;AACA;AACA,OAAO,IAAMC,cAAc,gBAAGF,aAAa,CAAgB,IAAI,CAAC;AAChEE,cAAc,CAACC,WAAW,GAAG,gBAAgB;;AAE7C;AACA;AACA;AACA;AACA,OAAO,SAASC,UAAUA,CAAA,EAAkB;EAC1C,OAAOH,UAAU,CAACC,cAAc,CAAC;AACnC"}
1
+ {"version":3,"file":"usePanelId.js","names":["createContext","useContext","PanelIdContext","displayName","usePanelId"],"sources":["../src/usePanelId.ts"],"sourcesContent":["import { createContext, useContext } from 'react';\n\n/**\n * Context to provide the golden layout panel ID.\n */\nexport const PanelIdContext = createContext<string | null>(null);\nPanelIdContext.displayName = 'PanelIdContext';\n\n/**\n * Gets the current panel ID from the nearest context.\n * @returns The current panel ID from the context, or null if not set or there is no context.\n */\nexport function usePanelId(): string | null {\n return useContext(PanelIdContext);\n}\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,OAAO;;AAEjD;AACA;AACA;AACA,OAAO,IAAMC,cAAc,gBAAGF,aAAa,CAAgB,IAAI,CAAC;AAChEE,cAAc,CAACC,WAAW,GAAG,gBAAgB;;AAE7C;AACA;AACA;AACA;AACA,OAAO,SAASC,UAAUA,CAAA,EAAkB;EAC1C,OAAOH,UAAU,CAACC,cAAc,CAAC;AACnC","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deephaven/dashboard",
3
- "version": "1.7.1",
3
+ "version": "1.7.2-beta.3+b369a51e",
4
4
  "description": "Deephaven Dashboard",
5
5
  "author": "Deephaven Data Labs LLC",
6
6
  "license": "Apache-2.0",
@@ -22,12 +22,12 @@
22
22
  "build:sass": "sass --embed-sources --load-path=../../node_modules ./src:./dist"
23
23
  },
24
24
  "dependencies": {
25
- "@deephaven/components": "^1.7.1",
26
- "@deephaven/golden-layout": "^1.7.1",
27
- "@deephaven/log": "^1.5.3",
28
- "@deephaven/react-hooks": "^1.7.1",
29
- "@deephaven/redux": "^1.7.1",
30
- "@deephaven/utils": "^1.7.1",
25
+ "@deephaven/components": "^1.7.2-beta.3+b369a51e",
26
+ "@deephaven/golden-layout": "^1.7.2-beta.3+b369a51e",
27
+ "@deephaven/log": "^1.7.2-beta.3+b369a51e",
28
+ "@deephaven/react-hooks": "^1.7.2-beta.3+b369a51e",
29
+ "@deephaven/redux": "^1.7.2-beta.3+b369a51e",
30
+ "@deephaven/utils": "^1.7.2-beta.3+b369a51e",
31
31
  "classnames": "^2.3.1",
32
32
  "fast-deep-equal": "^3.1.3",
33
33
  "lodash.ismatch": "^4.1.1",
@@ -42,8 +42,8 @@
42
42
  "react-redux": "^7.2.4"
43
43
  },
44
44
  "devDependencies": {
45
- "@deephaven/mocks": "^1.1.0",
46
- "@deephaven/test-utils": "^1.1.0",
45
+ "@deephaven/mocks": "^1.7.2-beta.3+b369a51e",
46
+ "@deephaven/test-utils": "^1.7.2-beta.3+b369a51e",
47
47
  "@types/lodash.ismatch": "^4.4.0",
48
48
  "@types/react-reconciler": "^0.32.0"
49
49
  },
@@ -53,5 +53,5 @@
53
53
  "publishConfig": {
54
54
  "access": "public"
55
55
  },
56
- "gitHead": "ebca722ed76f97d280a9302e79f21087f8d79965"
56
+ "gitHead": "b369a51ee94d212641a14c6ce1f19fcc85168339"
57
57
  }