@deephaven/dashboard 0.8.2-beta.6 → 0.9.1-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,8 +10,9 @@ export declare type DashboardProps = {
10
10
  layoutSettings?: Record<string, unknown>;
11
11
  onLayoutConfigChange?: () => void;
12
12
  onGoldenLayoutChange?: (goldenLayout: GoldenLayout) => void;
13
+ onLayoutInitialized?: () => void;
13
14
  fallbackComponent?: ForwardRefExoticComponent<RefAttributes<unknown>>;
14
15
  };
15
- export declare const Dashboard: ({ id, children, emptyDashboard, layoutConfig, layoutSettings, onLayoutConfigChange, onGoldenLayoutChange, fallbackComponent, }: DashboardProps) => JSX.Element;
16
+ export declare const Dashboard: ({ id, children, emptyDashboard, layoutConfig, layoutSettings, onLayoutConfigChange, onGoldenLayoutChange, onLayoutInitialized, fallbackComponent, }: DashboardProps) => JSX.Element;
16
17
  export default Dashboard;
17
18
  //# sourceMappingURL=Dashboard.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Dashboard.d.ts","sourceRoot":"","sources":["../src/Dashboard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,yBAAyB,EACzB,aAAa,EAKd,MAAM,OAAO,CAAC;AAEf,OAAO,YAAY,EAAE,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,wBAAwB,CAAC;AAIhC,OAAO,kBAAkB,CAAC;AAQ1B,oBAAY,cAAc,GAAG;IAC3B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;IAC/C,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACjC,YAAY,CAAC,EAAE,cAAc,EAAE,CAAC;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,oBAAoB,CAAC,EAAE,MAAM,IAAI,CAAC;IAClC,oBAAoB,CAAC,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,CAAC;IAC5D,iBAAiB,CAAC,EAAE,yBAAyB,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;CACvE,CAAC;AAEF,eAAO,MAAM,SAAS,mIASnB,cAAc,KAAG,WA6EnB,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"Dashboard.d.ts","sourceRoot":"","sources":["../src/Dashboard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,yBAAyB,EACzB,aAAa,EAKd,MAAM,OAAO,CAAC;AAEf,OAAO,YAAY,EAAE,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,wBAAwB,CAAC;AAIhC,OAAO,kBAAkB,CAAC;AAQ1B,oBAAY,cAAc,GAAG;IAC3B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;IAC/C,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACjC,YAAY,CAAC,EAAE,cAAc,EAAE,CAAC;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,oBAAoB,CAAC,EAAE,MAAM,IAAI,CAAC;IAClC,oBAAoB,CAAC,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,CAAC;IAC5D,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;IACjC,iBAAiB,CAAC,EAAE,yBAAyB,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;CACvE,CAAC;AAEF,eAAO,MAAM,SAAS,wJAUnB,cAAc,KAAG,WA8EnB,CAAC;AAEF,eAAe,SAAS,CAAC"}
package/dist/Dashboard.js CHANGED
@@ -26,6 +26,7 @@ export var Dashboard = _ref => {
26
26
  layoutSettings = EMPTY_OBJECT,
27
27
  onLayoutConfigChange = DEFAULT_CALLBACK,
28
28
  onGoldenLayoutChange = DEFAULT_CALLBACK,
29
+ onLayoutInitialized = DEFAULT_CALLBACK,
29
30
  fallbackComponent = PanelPlaceholder
30
31
  } = _ref;
31
32
  var layoutElement = useRef(null);
@@ -83,7 +84,8 @@ export var Dashboard = _ref => {
83
84
  id: id,
84
85
  layout: layout,
85
86
  layoutConfig: layoutConfig,
86
- onLayoutChange: onLayoutConfigChange
87
+ onLayoutChange: onLayoutConfigChange,
88
+ onLayoutInitialized: onLayoutInitialized
87
89
  }, children));
88
90
  };
89
91
  export default Dashboard;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/Dashboard.tsx"],"names":["React","useEffect","useMemo","useRef","useState","throttle","GoldenLayout","LayoutUtils","PanelPlaceholder","DashboardLayout","RESIZE_THROTTLE","DEFAULT_CALLBACK","undefined","EMPTY_OBJECT","Object","freeze","Dashboard","id","children","emptyDashboard","layoutConfig","layoutSettings","onLayoutConfigChange","onGoldenLayoutChange","fallbackComponent","layoutElement","isInitialized","setIsInitialized","layout","setLayout","current","config","makeDefaultLayout","assign","settings","content","newLayout","onInit","off","on","setFallbackComponent","init","destroy","handleResize","isInitialised","updateSize","window","addEventListener","removeEventListener"],"mappings":";;;;;;AAAA,OAAOA,KAAP,IAGEC,SAHF,EAIEC,OAJF,EAKEC,MALF,EAMEC,QANF,QAOO,OAPP;AAQA,OAAOC,QAAP,MAAqB,iBAArB;AACA,OAAOC,YAAP,MAA6C,0BAA7C;;OAEOC,W;OACAC,gB;OACAC,e;;AAGP,IAAMC,eAAe,GAAG,GAAxB;;AAEA,IAAMC,gBAAgB,GAAG,MAAMC,SAA/B;;AAEA,IAAMC,YAAY,GAAGC,MAAM,CAACC,MAAP,CAAc,EAAd,CAArB;AAaA,OAAO,IAAMC,SAAS,GAAG,QASU;AAAA,MATT;AACxBC,IAAAA,EAAE,GAAG,SADmB;AAExBC,IAAAA,QAFwB;AA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;AACXA,MAAAA,SAAS,CAACM,OAAV;AACD,KAFD;AAGD,GA/BQ,EA+BN,CACDrB,cADC,EAEDG,iBAFC,EAGDD,oBAHC,EAIDI,gBAJC,EAKDE,SALC,CA/BM,CAAT;AAuCA,MAAMc,YAAY,GAAGzC,OAAO,CAC1B,MACEG,QAAQ,CAAC,MAAM;AACb,QAAIuB,MAAJ,aAAIA,MAAJ,eAAIA,MAAM,CAAEgB,aAAZ,EAA2B;AACzBhB,MAAAA,MAAM,SAAN,IAAAA,MAAM,WAAN,YAAAA,MAAM,CAAEiB,UAAR;AACD;AACF,GAJO,EAILnC,eAJK,CAFgB,EAO1B,CAACkB,MAAD,CAP0B,CAA5B;AAUA3B,EAAAA,SAAS,CAAC,MAAM;AACd6C,IAAAA,MAAM,CAACC,gBAAP,CAAwB,QAAxB,EAAkCJ,YAAlC;AACA,WAAO,MAAM;AACXG,MAAAA,MAAM,CAACE,mBAAP,CAA2B,QAA3B,EAAqCL,YAArC;AACD,KAFD;AAGD,GALQ,EAKN,CAACA,YAAD,CALM,CAAT;AAOA,sBACE;AAAK,IAAA,SAAS,EAAC;AAAf,kBACE;AAAK,IAAA,SAAS,EAAC,aAAf;AAA6B,IAAA,GAAG,EAAElB;AAAlC,IADF,EAEGC,aAAa,IAAIE,MAAjB,iBACC,oBAAC,eAAD;AACE,IAAA,cAAc,EAAET,cADlB;AAEE,IAAA,EAAE,EAAEF,EAFN;AAGE,IAAA,MAAM,EAAEW,MAHV;AAIE,IAAA,YAAY,EAAER,YAJhB;AAKE,IAAA,cAAc,EAAEE;AALlB,KAOGJ,QAPH,CAHJ,CADF;AAgBD,CAtFM;AAwFP,eAAeF,SAAf","sourcesContent":["import React, {\n ForwardRefExoticComponent,\n RefAttributes,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport throttle from 'lodash.throttle';\nimport GoldenLayout, { ItemConfigType } from '@deephaven/golden-layout';\nimport './layout/golden-layout';\nimport LayoutUtils from './layout/LayoutUtils';\nimport PanelPlaceholder from './PanelPlaceholder';\nimport DashboardLayout from './DashboardLayout';\nimport './Dashboard.scss';\n\nconst RESIZE_THROTTLE = 100;\n\nconst DEFAULT_CALLBACK = () => undefined;\n\nconst EMPTY_OBJECT = Object.freeze({});\n\nexport type DashboardProps = {\n id?: string;\n children?: React.ReactNode | React.ReactNode[];\n emptyDashboard?: React.ReactNode;\n layoutConfig?: ItemConfigType[];\n layoutSettings?: Record<string, unknown>;\n onLayoutConfigChange?: () => void;\n onGoldenLayoutChange?: (goldenLayout: GoldenLayout) => void;\n fallbackComponent?: ForwardRefExoticComponent<RefAttributes<unknown>>;\n};\n\nexport const Dashboard = ({\n id = 'default',\n children,\n emptyDashboard,\n layoutConfig,\n layoutSettings = EMPTY_OBJECT,\n onLayoutConfigChange = DEFAULT_CALLBACK,\n onGoldenLayoutChange = DEFAULT_CALLBACK,\n fallbackComponent = PanelPlaceholder,\n}: DashboardProps): JSX.Element => {\n const layoutElement = useRef<HTMLDivElement>(null);\n const [isInitialized, setIsInitialized] = useState(false);\n const [layout, setLayout] = useState<GoldenLayout>();\n\n useEffect(() => {\n if (!layoutElement.current) {\n setLayout(undefined);\n return;\n }\n const config: GoldenLayout.Config = { ...LayoutUtils.makeDefaultLayout() };\n Object.assign(config.settings, layoutSettings);\n // Load our content later after plugins have registered\n config.content = [];\n\n const newLayout = new GoldenLayout(config, layoutElement.current);\n\n const onInit = () => {\n newLayout.off('initialised', onInit);\n setIsInitialized(true);\n };\n newLayout.on('initialised', onInit);\n\n if (fallbackComponent) {\n newLayout.setFallbackComponent(fallbackComponent);\n }\n\n newLayout.init();\n\n setLayout(newLayout);\n\n onGoldenLayoutChange(newLayout);\n\n return () => {\n newLayout.destroy();\n };\n }, [\n layoutSettings,\n fallbackComponent,\n onGoldenLayoutChange,\n setIsInitialized,\n setLayout,\n ]);\n\n const handleResize = useMemo(\n () =>\n throttle(() => {\n if (layout?.isInitialised) {\n layout?.updateSize();\n }\n }, RESIZE_THROTTLE),\n [layout]\n );\n\n useEffect(() => {\n window.addEventListener('resize', handleResize);\n return () => {\n window.removeEventListener('resize', handleResize);\n };\n }, [handleResize]);\n\n return (\n <div className=\"dashboard-container w-100 h-100\">\n <div className=\"w-100 h-100\" ref={layoutElement} />\n {isInitialized && layout && (\n <DashboardLayout\n emptyDashboard={emptyDashboard}\n id={id}\n layout={layout}\n layoutConfig={layoutConfig}\n onLayoutChange={onLayoutConfigChange}\n >\n {children}\n </DashboardLayout>\n )}\n </div>\n );\n};\n\nexport default Dashboard;\n"],"file":"Dashboard.js"}
1
+ {"version":3,"sources":["../src/Dashboard.tsx"],"names":["React","useEffect","useMemo","useRef","useState","throttle","GoldenLayout","LayoutUtils","PanelPlaceholder","DashboardLayout","RESIZE_THROTTLE","DEFAULT_CALLBACK","undefined","EMPTY_OBJECT","Object","freeze","Dashboard","id","children","emptyDashboard","layoutConfig","layoutSettings","onLayoutConfigChange","onGoldenLayoutChange","onLayoutInitialized","fallbackComponent","layoutElement","isInitialized","setIsInitialized","layout","setLayout","current","config","makeDefaultLayout","assign","settings","content","newLayout","onInit","off","on","setFallbackComponent","init","destroy","handleResize","isInitialised","updateSize","window","addEventListener","removeEventListener"],"mappings":";;;;;;AAAA,OAAOA,KAAP,IAGEC,SAHF,EAIEC,OAJF,EAKEC,MALF,EAMEC,QANF,QAOO,OAPP;AAQA,OAAOC,QAAP,MAAqB,iBAArB;AACA,OAAOC,YAAP,MAA6C,0BAA7C;;OAEOC,W;OACAC,gB;OACAC,e;;AAGP,IAAMC,eAAe,GAAG,GAAxB;;AAEA,IAAMC,gBAAgB,GAAG,MAAMC,SAA/B;;AAEA,IAAMC,YAAY,GAAGC,MAAM,CAACC,MAAP,CAAc,EAAd,CAArB;AAcA,OAAO,IAAMC,SAAS,GAAG,QAUU;AAAA,MAVT;AACxBC,IAAAA,EAAE,GAAG,SADmB;AAExBC,IAAAA,QAFwB;AAGxBC,IAAAA,cAHwB;AAIxBC,IAAAA,YAJwB;AAKxBC,IAAAA,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,CAACM,OAAV;AACD,KAFD;AAGD,GA/BQ,EA+BN,CACDtB,cADC,EAEDI,iBAFC,EAGDF,oBAHC,EAIDK,gBAJC,EAKDE,SALC,CA/BM,CAAT;AAuCA,MAAMc,YAAY,GAAG1C,OAAO,CAC1B,MACEG,QAAQ,CAAC,MAAM;AACb,QAAIwB,MAAJ,aAAIA,MAAJ,eAAIA,MAAM,CAAEgB,aAAZ,EAA2B;AACzBhB,MAAAA,MAAM,SAAN,IAAAA,MAAM,WAAN,YAAAA,MAAM,CAAEiB,UAAR;AACD;AACF,GAJO,EAILpC,eAJK,CAFgB,EAO1B,CAACmB,MAAD,CAP0B,CAA5B;AAUA5B,EAAAA,SAAS,CAAC,MAAM;AACd8C,IAAAA,MAAM,CAACC,gBAAP,CAAwB,QAAxB,EAAkCJ,YAAlC;AACA,WAAO,MAAM;AACXG,MAAAA,MAAM,CAACE,mBAAP,CAA2B,QAA3B,EAAqCL,YAArC;AACD,KAFD;AAGD,GALQ,EAKN,CAACA,YAAD,CALM,CAAT;AAOA,sBACE;AAAK,IAAA,SAAS,EAAC;AAAf,kBACE;AAAK,IAAA,SAAS,EAAC,aAAf;AAA6B,IAAA,GAAG,EAAElB;AAAlC,IADF,EAEGC,aAAa,IAAIE,MAAjB,iBACC,oBAAC,eAAD;AACE,IAAA,cAAc,EAAEV,cADlB;AAEE,IAAA,EAAE,EAAEF,EAFN;AAGE,IAAA,MAAM,EAAEY,MAHV;AAIE,IAAA,YAAY,EAAET,YAJhB;AAKE,IAAA,cAAc,EAAEE,oBALlB;AAME,IAAA,mBAAmB,EAAEE;AANvB,KAQGN,QARH,CAHJ,CADF;AAiBD,CAxFM;AA0FP,eAAeF,SAAf","sourcesContent":["import React, {\n ForwardRefExoticComponent,\n RefAttributes,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport throttle from 'lodash.throttle';\nimport GoldenLayout, { ItemConfigType } from '@deephaven/golden-layout';\nimport './layout/golden-layout';\nimport LayoutUtils from './layout/LayoutUtils';\nimport PanelPlaceholder from './PanelPlaceholder';\nimport DashboardLayout from './DashboardLayout';\nimport './Dashboard.scss';\n\nconst RESIZE_THROTTLE = 100;\n\nconst DEFAULT_CALLBACK = () => undefined;\n\nconst EMPTY_OBJECT = Object.freeze({});\n\nexport type DashboardProps = {\n id?: string;\n children?: React.ReactNode | React.ReactNode[];\n emptyDashboard?: React.ReactNode;\n layoutConfig?: ItemConfigType[];\n layoutSettings?: Record<string, unknown>;\n onLayoutConfigChange?: () => void;\n onGoldenLayoutChange?: (goldenLayout: GoldenLayout) => void;\n onLayoutInitialized?: () => void;\n fallbackComponent?: ForwardRefExoticComponent<RefAttributes<unknown>>;\n};\n\nexport const Dashboard = ({\n id = 'default',\n children,\n emptyDashboard,\n layoutConfig,\n layoutSettings = EMPTY_OBJECT,\n onLayoutConfigChange = DEFAULT_CALLBACK,\n onGoldenLayoutChange = DEFAULT_CALLBACK,\n onLayoutInitialized = DEFAULT_CALLBACK,\n fallbackComponent = PanelPlaceholder,\n}: DashboardProps): JSX.Element => {\n const layoutElement = useRef<HTMLDivElement>(null);\n const [isInitialized, setIsInitialized] = useState(false);\n const [layout, setLayout] = useState<GoldenLayout>();\n\n useEffect(() => {\n if (!layoutElement.current) {\n setLayout(undefined);\n return;\n }\n const config: GoldenLayout.Config = { ...LayoutUtils.makeDefaultLayout() };\n Object.assign(config.settings, layoutSettings);\n // Load our content later after plugins have registered\n config.content = [];\n\n const newLayout = new GoldenLayout(config, layoutElement.current);\n\n const onInit = () => {\n newLayout.off('initialised', onInit);\n setIsInitialized(true);\n };\n newLayout.on('initialised', onInit);\n\n if (fallbackComponent) {\n newLayout.setFallbackComponent(fallbackComponent);\n }\n\n newLayout.init();\n\n setLayout(newLayout);\n\n onGoldenLayoutChange(newLayout);\n\n return () => {\n newLayout.destroy();\n };\n }, [\n layoutSettings,\n fallbackComponent,\n onGoldenLayoutChange,\n setIsInitialized,\n setLayout,\n ]);\n\n const handleResize = useMemo(\n () =>\n throttle(() => {\n if (layout?.isInitialised) {\n layout?.updateSize();\n }\n }, RESIZE_THROTTLE),\n [layout]\n );\n\n useEffect(() => {\n window.addEventListener('resize', handleResize);\n return () => {\n window.removeEventListener('resize', handleResize);\n };\n }, [handleResize]);\n\n return (\n <div className=\"dashboard-container w-100 h-100\">\n <div className=\"w-100 h-100\" ref={layoutElement} />\n {isInitialized && layout && (\n <DashboardLayout\n emptyDashboard={emptyDashboard}\n id={id}\n layout={layout}\n layoutConfig={layoutConfig}\n onLayoutChange={onLayoutConfigChange}\n onLayoutInitialized={onLayoutInitialized}\n >\n {children}\n </DashboardLayout>\n )}\n </div>\n );\n};\n\nexport default Dashboard;\n"],"file":"Dashboard.js"}
@@ -11,6 +11,7 @@ interface DashboardLayoutProps {
11
11
  layout: GoldenLayout;
12
12
  layoutConfig?: DashboardLayoutConfig;
13
13
  onLayoutChange?: (dehydratedLayout: DashboardLayoutConfig) => void;
14
+ onLayoutInitialized?: () => void;
14
15
  data?: DashboardData;
15
16
  children?: React.ReactNode | React.ReactNode[];
16
17
  emptyDashboard?: React.ReactNode;
@@ -19,7 +20,7 @@ interface DashboardLayoutProps {
19
20
  * DashboardLayout component. Handles hydrating, dehydrating components, listening for dragging panels.
20
21
  */
21
22
  export declare const DashboardLayout: {
22
- ({ id, children, emptyDashboard, layout, layoutConfig, onLayoutChange, }: DashboardLayoutProps): JSX.Element;
23
+ ({ id, children, emptyDashboard, layout, layoutConfig, onLayoutChange, onLayoutInitialized, }: DashboardLayoutProps): JSX.Element;
23
24
  propTypes: {
24
25
  id: PropTypes.Validator<string>;
25
26
  children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
@@ -40,6 +41,7 @@ export declare const DashboardLayout: {
40
41
  }>>;
41
42
  layoutConfig: PropTypes.Requireable<(PropTypes.InferProps<{}> | null | undefined)[]>;
42
43
  onLayoutChange: PropTypes.Requireable<(...args: any[]) => any>;
44
+ onLayoutInitialized: PropTypes.Requireable<(...args: any[]) => any>;
43
45
  };
44
46
  };
45
47
  export default DashboardLayout;
@@ -1 +1 @@
1
- {"version":3,"file":"DashboardLayout.d.ts","sourceRoot":"","sources":["../src/DashboardLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAMN,MAAM,OAAO,CAAC;AACf,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,YAAY,EAAE,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAIxE,OAAqB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAY5D,oBAAY,qBAAqB,GAAG,cAAc,EAAE,CAAC;AAarD,aAAK,aAAa,GAAG;IACnB,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB,CAAC;AAEF,UAAU,oBAAoB;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,YAAY,CAAC;IACrB,YAAY,CAAC,EAAE,qBAAqB,CAAC;IACrC,cAAc,CAAC,EAAE,CAAC,gBAAgB,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACnE,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;IAC/C,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAClC;AAED;;GAEG;AACH,eAAO,MAAM,eAAe;8EAOzB,oBAAoB,GAAG,WAAW;;;;;;;;;;;;;;;;;;;;;;CAgMpC,CAAC;AAYF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"DashboardLayout.d.ts","sourceRoot":"","sources":["../src/DashboardLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAMN,MAAM,OAAO,CAAC;AACf,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,YAAY,EAAE,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAIxE,OAAqB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAY5D,oBAAY,qBAAqB,GAAG,cAAc,EAAE,CAAC;AAarD,aAAK,aAAa,GAAG;IACnB,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB,CAAC;AAEF,UAAU,oBAAoB;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,YAAY,CAAC;IACrB,YAAY,CAAC,EAAE,qBAAqB,CAAC;IACrC,cAAc,CAAC,EAAE,CAAC,gBAAgB,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACnE,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;IACjC,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;IAC/C,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAClC;AAED;;GAEG;AACH,eAAO,MAAM,eAAe;mGAQzB,oBAAoB,GAAG,WAAW;;;;;;;;;;;;;;;;;;;;;;;CA8MpC,CAAC;AAaF,eAAe,eAAe,CAAC"}
@@ -33,7 +33,8 @@ export var DashboardLayout = _ref => {
33
33
  emptyDashboard = /*#__PURE__*/React.createElement("div", null, "Dashboard is empty."),
34
34
  layout,
35
35
  layoutConfig = DEFAULT_LAYOUT_CONFIG,
36
- onLayoutChange = DEFAULT_CALLBACK
36
+ onLayoutChange = DEFAULT_CALLBACK,
37
+ onLayoutInitialized = DEFAULT_CALLBACK
37
38
  } = _ref;
38
39
  var dispatch = useDispatch();
39
40
  var data = (_useSelector = useSelector(state => getDashboardData(state, id))) !== null && _useSelector !== void 0 ? _useSelector : EMPTY_OBJECT;
@@ -41,6 +42,7 @@ export var DashboardLayout = _ref => {
41
42
  var [isItemDragging, setIsItemDragging] = useState(false);
42
43
  var [lastConfig, setLastConfig] = useState();
43
44
  var [initialClosedPanels] = useState((_data$closed = data === null || data === void 0 ? void 0 : data.closed) !== null && _data$closed !== void 0 ? _data$closed : []);
45
+ var [isDashboardInitialized, setIsDashboardInitialized] = useState(false);
44
46
  var hydrateMap = useMemo(() => new Map(), []);
45
47
  var dehydrateMap = useMemo(() => new Map(), []);
46
48
  var store = useStore();
@@ -100,6 +102,12 @@ export var DashboardLayout = _ref => {
100
102
  // we don't want to emit stateChanges that happen during item drags or else
101
103
  // we risk the last saved state being one without that panel in the layout entirely
102
104
  if (isItemDragging) return;
105
+
106
+ if (!isDashboardInitialized) {
107
+ onLayoutInitialized();
108
+ setIsDashboardInitialized(true);
109
+ }
110
+
103
111
  var glConfig = layout.toConfig();
104
112
  var contentConfig = glConfig.content;
105
113
  var dehydratedLayoutConfig = LayoutUtils.dehydrateLayoutConfig(contentConfig, dehydrateComponent);
@@ -111,7 +119,7 @@ export var DashboardLayout = _ref => {
111
119
  setLastConfig(dehydratedLayoutConfig);
112
120
  onLayoutChange(dehydratedLayoutConfig);
113
121
  }
114
- }, [dehydrateComponent, isItemDragging, lastConfig, layout, onLayoutChange]);
122
+ }, [dehydrateComponent, isDashboardInitialized, isItemDragging, lastConfig, layout, onLayoutChange, onLayoutInitialized]);
115
123
  var handleLayoutItemPickedUp = useCallback(() => {
116
124
  setIsItemDragging(true);
117
125
  }, []);
@@ -166,7 +174,8 @@ DashboardLayout.propTypes = {
166
174
  emptyDashboard: PropTypes.node,
167
175
  layout: GLPropTypes.Layout.isRequired,
168
176
  layoutConfig: PropTypes.arrayOf(PropTypes.shape({})),
169
- onLayoutChange: PropTypes.func
177
+ onLayoutChange: PropTypes.func,
178
+ onLayoutInitialized: PropTypes.func
170
179
  };
171
180
  export default DashboardLayout;
172
181
  //# sourceMappingURL=DashboardLayout.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/DashboardLayout.tsx"],"names":["React","useCallback","useEffect","useMemo","useState","PropTypes","Log","usePrevious","Provider","useDispatch","useSelector","useStore","PanelManager","PanelErrorBoundary","LayoutUtils","dehydrate","dehydrateDefault","hydrate","hydrateDefault","PanelEvent","GLPropTypes","useListener","getDashboardData","updateDashboardData","log","module","EMPTY_OBJECT","Object","freeze","DEFAULT_LAYOUT_CONFIG","DEFAULT_CALLBACK","undefined","FALLBACK_CALLBACK","props","DashboardLayout","id","children","emptyDashboard","layout","layoutConfig","onLayoutChange","dispatch","data","state","isDashboardEmpty","setIsDashboardEmpty","isItemDragging","setIsItemDragging","lastConfig","setLastConfig","initialClosedPanels","closed","hydrateMap","Map","dehydrateMap","store","registerComponent","name","componentType","debug2","renderComponent","ref","CType","glContainer","glEventHub","wrappedComponent","forwardRef","cleanup","set","hydrateComponent","get","dehydrateComponent","config","panelManager","openedMap","handleLayoutStateChanged","glConfig","toConfig","contentConfig","content","dehydratedLayoutConfig","dehydrateLayoutConfig","hasChanged","isEqual","debug","root","contentItems","length","handleLayoutItemPickedUp","handleLayoutItemDropped","handleComponentCreated","item","component","element","cssComponent","replace","toLowerCase","cssClass","addClass","eventHub","TITLE_CHANGED","previousLayoutConfig","hydrateLayoutConfig","remove","i","addChild","Children","map","child","cloneElement","propTypes","string","isRequired","node","shape","Layout","arrayOf","func"],"mappings":";;AAAA,OAAOA,KAAP,IAEEC,WAFF,EAGEC,SAHF,EAIEC,OAJF,EAKEC,QALF,QAMO,OANP;AAOA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,OAAOC,GAAP,MAAgB,gBAAhB;AACA,SAASC,WAAT,QAA4B,wBAA5B;AACA,SAASC,QAAT,EAAmBC,WAAnB,EAAgCC,WAAhC,EAA6CC,QAA7C,QAA6D,aAA7D;OACOC,Y;OACAC,kB;OACAC,W;SAELC,SAAS,IAAIC,gB,EACbC,OAAO,IAAIC,c;OAENC,U;SACEC,W,EAAaC,W;SACbC,gB,EAAkBC,mB;AAK3B,IAAMC,GAAG,GAAGlB,GAAG,CAACmB,MAAJ,CAAW,iBAAX,CAAZ;AAEA,IAAMC,YAAY,GAAGC,MAAM,CAACC,MAAP,CAAc,EAAd,CAArB;AAEA,IAAMC,qBAA4C,GAAG,EAArD;;AAEA,IAAMC,gBAAgB,GAAG,MAAMC,SAA/B,C,CAEA;;;AACA,IAAMC,iBAAiB,GAAIC,KAAD,I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AAAA,YAHwC;AAIxCjB,IAAAA;AAJwC,GAA1C,CADC,GAOD,IARL,CAFH,CADF;AAeD,CAvMM;AAyMPtB,eAAe,CAAC4E,SAAhB,GAA4B;AAC1B3E,EAAAA,EAAE,EAAE9B,SAAS,CAAC0G,MAAV,CAAiBC,UADK;AAE1B5E,EAAAA,QAAQ,EAAE/B,SAAS,CAAC4G,IAFM;AAG1BvE,EAAAA,IAAI,EAAErC,SAAS,CAAC6G,KAAV,CAAgB,EAAhB,CAHoB;AAI1B7E,EAAAA,cAAc,EAAEhC,SAAS,CAAC4G,IAJA;AAK1B3E,EAAAA,MAAM,EAAElB,WAAW,CAAC+F,MAAZ,CAAmBH,UALD;AAM1BzE,EAAAA,YAAY,EAAElC,SAAS,CAAC+G,OAAV,CAAkB/G,SAAS,CAAC6G,KAAV,CAAgB,EAAhB,CAAlB,CANY;AAO1B1E,EAAAA,cAAc,EAAEnC,SAAS,CAACgH;AAPA,CAA5B;AAUA,eAAenF,eAAf","sourcesContent":["import React, {\n ReactElement,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from 'react';\nimport PropTypes from 'prop-types';\nimport GoldenLayout, { ItemConfigType } from '@deephaven/golden-layout';\nimport Log from '@deephaven/log';\nimport { usePrevious } from '@deephaven/react-hooks';\nimport { Provider, useDispatch, useSelector, useStore } from 'react-redux';\nimport PanelManager, { ClosedPanels } from './PanelManager';\nimport PanelErrorBoundary from './PanelErrorBoundary';\nimport LayoutUtils from './layout/LayoutUtils';\nimport {\n dehydrate as dehydrateDefault,\n hydrate as hydrateDefault,\n} from './DashboardUtils';\nimport PanelEvent from './PanelEvent';\nimport { GLPropTypes, useListener } from './layout';\nimport { getDashboardData, updateDashboardData } from './redux';\nimport { PanelComponentType } from './DashboardPlugin';\n\nexport type DashboardLayoutConfig = ItemConfigType[];\n\nconst log = Log.module('DashboardLayout');\n\nconst EMPTY_OBJECT = Object.freeze({});\n\nconst DEFAULT_LAYOUT_CONFIG: DashboardLayoutConfig = [];\n\nconst DEFAULT_CALLBACK = () => undefined;\n\n// If a component isn't registered, just pass through the props so they are saved if a plugin is loaded later\nconst FALLBACK_CALLBACK = (props: unknown) => props;\n\ntype DashboardData = {\n closed?: ClosedPanels;\n};\n\ninterface DashboardLayoutProps {\n id: string;\n layout: GoldenLayout;\n layoutConfig?: DashboardLayoutConfig;\n onLayoutChange?: (dehydratedLayout: DashboardLayoutConfig) => void;\n data?: DashboardData;\n children?: React.ReactNode | React.ReactNode[];\n emptyDashboard?: React.ReactNode;\n}\n\n/**\n * DashboardLayout component. Handles hydrating, dehydrating components, listening for dragging panels.\n */\nexport const DashboardLayout = ({\n id,\n children,\n emptyDashboard = <div>Dashboard is empty.</div>,\n layout,\n layoutConfig = DEFAULT_LAYOUT_CONFIG,\n onLayoutChange = DEFAULT_CALLBACK,\n}: DashboardLayoutProps): JSX.Element => {\n const dispatch = useDispatch();\n const data =\n useSelector(state => getDashboardData(state, id)) ?? EMPTY_OBJECT;\n\n const [isDashboardEmpty, setIsDashboardEmpty] = useState(false);\n const [isItemDragging, setIsItemDragging] = useState(false);\n const [lastConfig, setLastConfig] = useState<DashboardLayoutConfig>();\n const [initialClosedPanels] = useState(data?.closed ?? []);\n\n const hydrateMap = useMemo(() => new Map(), []);\n const dehydrateMap = useMemo(() => new Map(), []);\n const store = useStore();\n const registerComponent = useCallback(\n (\n name: string,\n componentType: PanelComponentType,\n hydrate = hydrateDefault,\n dehydrate = dehydrateDefault\n ) => {\n log.debug2('registerComponent', name, componentType, hydrate, dehydrate);\n\n function renderComponent(\n props: { glContainer: unknown; glEventHub: unknown },\n ref: unknown\n ) {\n // Cast it to an `any` type so we can pass the ref in correctly.\n // ComponentType doesn't seem to work right, ReactNode is also incorrect\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const CType = componentType as any;\n\n // Props supplied by GoldenLayout\n // eslint-disable-next-line react/prop-types\n const { glContainer, glEventHub } = props;\n return (\n <Provider store={store}>\n <PanelErrorBoundary\n glContainer={glContainer}\n glEventHub={glEventHub}\n >\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <CType {...props} ref={ref} />\n </PanelErrorBoundary>\n </Provider>\n );\n }\n\n const wrappedComponent = React.forwardRef(renderComponent);\n const cleanup = layout.registerComponent(name, wrappedComponent);\n hydrateMap.set(name, hydrate);\n dehydrateMap.set(name, dehydrate);\n return cleanup;\n },\n [hydrateMap, dehydrateMap, layout, store]\n );\n const hydrateComponent = useCallback(\n (name, props) => (hydrateMap.get(name) ?? FALLBACK_CALLBACK)(props, id),\n [hydrateMap, id]\n );\n const dehydrateComponent = useCallback(\n (name, config) => (dehydrateMap.get(name) ?? FALLBACK_CALLBACK)(config, id),\n [dehydrateMap, id]\n );\n const panelManager = useMemo(\n () =>\n new PanelManager(\n layout,\n hydrateComponent,\n dehydrateComponent,\n new Map(),\n initialClosedPanels,\n ({ closed, openedMap }) => {\n dispatch(updateDashboardData(id, { closed, openedMap }));\n }\n ),\n [\n dehydrateComponent,\n dispatch,\n hydrateComponent,\n id,\n initialClosedPanels,\n layout,\n ]\n );\n\n const handleLayoutStateChanged = useCallback(() => {\n // we don't want to emit stateChanges that happen during item drags or else\n // we risk the last saved state being one without that panel in the layout entirely\n if (isItemDragging) return;\n\n const glConfig = layout.toConfig();\n const contentConfig = glConfig.content;\n const dehydratedLayoutConfig = LayoutUtils.dehydrateLayoutConfig(\n contentConfig,\n dehydrateComponent\n );\n const hasChanged =\n lastConfig == null ||\n !LayoutUtils.isEqual(lastConfig, dehydratedLayoutConfig);\n\n log.debug(\n 'handleLayoutStateChanged',\n hasChanged,\n contentConfig,\n dehydratedLayoutConfig\n );\n\n if (hasChanged) {\n setIsDashboardEmpty(layout.root.contentItems.length === 0);\n\n setLastConfig(dehydratedLayoutConfig);\n\n onLayoutChange(dehydratedLayoutConfig);\n }\n }, [dehydrateComponent, isItemDragging, lastConfig, layout, onLayoutChange]);\n\n const handleLayoutItemPickedUp = useCallback(() => {\n setIsItemDragging(true);\n }, []);\n\n const handleLayoutItemDropped = useCallback(() => {\n setIsItemDragging(false);\n }, []);\n\n const handleComponentCreated = useCallback(item => {\n log.debug2('handleComponentCreated', item);\n\n if (!item || !item.config || !item.config.component || !item.element) {\n return;\n }\n\n const cssComponent = item.config.component\n .replace(/([a-z])([A-Z])/g, '$1-$2')\n .toLowerCase();\n const cssClass = `${cssComponent}-component`;\n item.element.addClass(cssClass);\n }, []);\n\n useListener(layout, 'stateChanged', handleLayoutStateChanged);\n useListener(layout, 'itemPickedUp', handleLayoutItemPickedUp);\n useListener(layout, 'itemDropped', handleLayoutItemDropped);\n useListener(layout, 'componentCreated', handleComponentCreated);\n useListener(\n layout.eventHub,\n PanelEvent.TITLE_CHANGED,\n handleLayoutStateChanged\n );\n\n const previousLayoutConfig = usePrevious(layoutConfig);\n useEffect(() => {\n if (previousLayoutConfig !== layoutConfig && layoutConfig !== lastConfig) {\n log.debug('Setting new layout content...');\n const content = LayoutUtils.hydrateLayoutConfig(\n layoutConfig,\n hydrateComponent\n );\n // Remove the old layout before add the new one\n while (layout.root.contentItems.length > 0) {\n layout.root.contentItems[0].remove();\n }\n\n // Add the new content. It is usally just one item from the root\n for (let i = 0; i < content.length; i += 1) {\n layout.root.addChild(content[i]);\n }\n\n setIsDashboardEmpty(layout.root.contentItems.length === 0);\n }\n }, [\n hydrateComponent,\n layout,\n layoutConfig,\n lastConfig,\n panelManager,\n previousLayoutConfig,\n ]);\n\n return (\n <>\n {isDashboardEmpty && emptyDashboard}\n {React.Children.map(children, child =>\n child\n ? React.cloneElement(child as ReactElement, {\n id,\n layout,\n panelManager,\n registerComponent,\n })\n : null\n )}\n </>\n );\n};\n\nDashboardLayout.propTypes = {\n id: PropTypes.string.isRequired,\n children: PropTypes.node,\n data: PropTypes.shape({}),\n emptyDashboard: PropTypes.node,\n layout: GLPropTypes.Layout.isRequired,\n layoutConfig: PropTypes.arrayOf(PropTypes.shape({})),\n onLayoutChange: PropTypes.func,\n};\n\nexport default DashboardLayout;\n"],"file":"DashboardLayout.js"}
1
+ {"version":3,"sources":["../src/DashboardLayout.tsx"],"names":["React","useCallback","useEffect","useMemo","useState","PropTypes","Log","usePrevious","Provider","useDispatch","useSelector","useStore","PanelManager","PanelErrorBoundary","LayoutUtils","dehydrate","dehydrateDefault","hydrate","hydrateDefault","PanelEvent","GLPropTypes","useListener","getDashboardData","updateDashboardData","log","module","EMPTY_OBJECT","Object","freeze","DEFAULT_LAYOUT_CONFIG","DEFAULT_CALLBACK","undefined","FALLBACK_CALLBACK","props","DashboardLayout","id","children","emptyDashboard","layout","layoutConfig","onLayoutChange","onLayoutInitialized","dispatch","data","state","isDashboardEmpty","setIsDashboardEmpty","isItemDragging","setIsItemDragging","lastConfig","setLastConfig","initialClosedPanels","closed","isDashboardInitialized","setIsDashboardInitialized","hydrateMap","Map","dehydrateMap","store","registerComponent","name","componentType","debug2","renderComponent","ref","CType","glContainer","glEventHub","wrappedComponent","forwardRef","cleanup","set","hydrateComponent","get","dehydrateComponent","config","panelManager","openedMap","handleLayoutStateChanged","glConfig","toConfig","contentConfig","content","dehydratedLayoutConfig","dehydrateLayoutConfig","hasChanged","isEqual","debug","root","contentItems","length","handleLayoutItemPickedUp","handleLayoutItemDropped","handleComponentCreated","item","component","element","cssComponent","replace","toLowerCase","cssClass","addClass","eventHub","TITLE_CHANGED","previousLayoutConfig","hydrateLayoutConfig","remove","i","addChild","Children","map","child","cloneElement","propTypes","string","isRequired","node","shape","Layout","arrayOf","func"],"mappings":";;AAAA,OAAOA,KAAP,IAEEC,WAFF,EAGEC,SAHF,EAIEC,OAJF,EAKEC,QALF,QAMO,OANP;AAOA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,OAAOC,GAAP,MAAgB,gBAAhB;AACA,SAASC,WAAT,QAA4B,wBAA5B;AACA,SAASC,QAAT,EAAmBC,WAAnB,EAAgCC,WAAhC,EAA6CC,QAA7C,QAA6D,aAA7D;OACOC,Y;OACAC,kB;OACAC,W;SAELC,SAAS,IAAIC,gB,EACbC,OAAO,I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Element,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from 'react';\nimport PropTypes from 'prop-types';\nimport GoldenLayout, { ItemConfigType } from '@deephaven/golden-layout';\nimport Log from '@deephaven/log';\nimport { usePrevious } from '@deephaven/react-hooks';\nimport { Provider, useDispatch, useSelector, useStore } from 'react-redux';\nimport PanelManager, { ClosedPanels } from './PanelManager';\nimport PanelErrorBoundary from './PanelErrorBoundary';\nimport LayoutUtils from './layout/LayoutUtils';\nimport {\n dehydrate as dehydrateDefault,\n hydrate as hydrateDefault,\n} from './DashboardUtils';\nimport PanelEvent from './PanelEvent';\nimport { GLPropTypes, useListener } from './layout';\nimport { getDashboardData, updateDashboardData } from './redux';\nimport { PanelComponentType } from './DashboardPlugin';\n\nexport type DashboardLayoutConfig = ItemConfigType[];\n\nconst log = Log.module('DashboardLayout');\n\nconst EMPTY_OBJECT = Object.freeze({});\n\nconst DEFAULT_LAYOUT_CONFIG: DashboardLayoutConfig = [];\n\nconst DEFAULT_CALLBACK = () => undefined;\n\n// If a component isn't registered, just pass through the props so they are saved if a plugin is loaded later\nconst FALLBACK_CALLBACK = (props: unknown) => props;\n\ntype DashboardData = {\n closed?: ClosedPanels;\n};\n\ninterface DashboardLayoutProps {\n id: string;\n layout: GoldenLayout;\n layoutConfig?: DashboardLayoutConfig;\n onLayoutChange?: (dehydratedLayout: DashboardLayoutConfig) => void;\n onLayoutInitialized?: () => void;\n data?: DashboardData;\n children?: React.ReactNode | React.ReactNode[];\n emptyDashboard?: React.ReactNode;\n}\n\n/**\n * DashboardLayout component. Handles hydrating, dehydrating components, listening for dragging panels.\n */\nexport const DashboardLayout = ({\n id,\n children,\n emptyDashboard = <div>Dashboard is empty.</div>,\n layout,\n layoutConfig = DEFAULT_LAYOUT_CONFIG,\n onLayoutChange = DEFAULT_CALLBACK,\n onLayoutInitialized = DEFAULT_CALLBACK,\n}: DashboardLayoutProps): JSX.Element => {\n const dispatch = useDispatch();\n const data =\n useSelector(state => getDashboardData(state, id)) ?? EMPTY_OBJECT;\n\n const [isDashboardEmpty, setIsDashboardEmpty] = useState(false);\n const [isItemDragging, setIsItemDragging] = useState(false);\n const [lastConfig, setLastConfig] = useState<DashboardLayoutConfig>();\n const [initialClosedPanels] = useState(data?.closed ?? []);\n const [isDashboardInitialized, setIsDashboardInitialized] = useState(false);\n\n const hydrateMap = useMemo(() => new Map(), []);\n const dehydrateMap = useMemo(() => new Map(), []);\n const store = useStore();\n const registerComponent = useCallback(\n (\n name: string,\n componentType: PanelComponentType,\n hydrate = hydrateDefault,\n dehydrate = dehydrateDefault\n ) => {\n log.debug2('registerComponent', name, componentType, hydrate, dehydrate);\n\n function renderComponent(\n props: { glContainer: unknown; glEventHub: unknown },\n ref: unknown\n ) {\n // Cast it to an `any` type so we can pass the ref in correctly.\n // ComponentType doesn't seem to work right, ReactNode is also incorrect\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const CType = componentType as any;\n\n // Props supplied by GoldenLayout\n // eslint-disable-next-line react/prop-types\n const { glContainer, glEventHub } = props;\n return (\n <Provider store={store}>\n <PanelErrorBoundary\n glContainer={glContainer}\n glEventHub={glEventHub}\n >\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <CType {...props} ref={ref} />\n </PanelErrorBoundary>\n </Provider>\n );\n }\n\n const wrappedComponent = React.forwardRef(renderComponent);\n const cleanup = layout.registerComponent(name, wrappedComponent);\n hydrateMap.set(name, hydrate);\n dehydrateMap.set(name, dehydrate);\n return cleanup;\n },\n [hydrateMap, dehydrateMap, layout, store]\n );\n const hydrateComponent = useCallback(\n (name, props) => (hydrateMap.get(name) ?? FALLBACK_CALLBACK)(props, id),\n [hydrateMap, id]\n );\n const dehydrateComponent = useCallback(\n (name, config) => (dehydrateMap.get(name) ?? FALLBACK_CALLBACK)(config, id),\n [dehydrateMap, id]\n );\n const panelManager = useMemo(\n () =>\n new PanelManager(\n layout,\n hydrateComponent,\n dehydrateComponent,\n new Map(),\n initialClosedPanels,\n ({ closed, openedMap }) => {\n dispatch(updateDashboardData(id, { closed, openedMap }));\n }\n ),\n [\n dehydrateComponent,\n dispatch,\n hydrateComponent,\n id,\n initialClosedPanels,\n layout,\n ]\n );\n\n const handleLayoutStateChanged = useCallback(() => {\n // we don't want to emit stateChanges that happen during item drags or else\n // we risk the last saved state being one without that panel in the layout entirely\n if (isItemDragging) return;\n\n if (!isDashboardInitialized) {\n onLayoutInitialized();\n setIsDashboardInitialized(true);\n }\n\n const glConfig = layout.toConfig();\n const contentConfig = glConfig.content;\n const dehydratedLayoutConfig = LayoutUtils.dehydrateLayoutConfig(\n contentConfig,\n dehydrateComponent\n );\n const hasChanged =\n lastConfig == null ||\n !LayoutUtils.isEqual(lastConfig, dehydratedLayoutConfig);\n\n log.debug(\n 'handleLayoutStateChanged',\n hasChanged,\n contentConfig,\n dehydratedLayoutConfig\n );\n\n if (hasChanged) {\n setIsDashboardEmpty(layout.root.contentItems.length === 0);\n\n setLastConfig(dehydratedLayoutConfig);\n\n onLayoutChange(dehydratedLayoutConfig);\n }\n }, [\n dehydrateComponent,\n isDashboardInitialized,\n isItemDragging,\n lastConfig,\n layout,\n onLayoutChange,\n onLayoutInitialized,\n ]);\n\n const handleLayoutItemPickedUp = useCallback(() => {\n setIsItemDragging(true);\n }, []);\n\n const handleLayoutItemDropped = useCallback(() => {\n setIsItemDragging(false);\n }, []);\n\n const handleComponentCreated = useCallback(item => {\n log.debug2('handleComponentCreated', item);\n\n if (!item || !item.config || !item.config.component || !item.element) {\n return;\n }\n\n const cssComponent = item.config.component\n .replace(/([a-z])([A-Z])/g, '$1-$2')\n .toLowerCase();\n const cssClass = `${cssComponent}-component`;\n item.element.addClass(cssClass);\n }, []);\n\n useListener(layout, 'stateChanged', handleLayoutStateChanged);\n useListener(layout, 'itemPickedUp', handleLayoutItemPickedUp);\n useListener(layout, 'itemDropped', handleLayoutItemDropped);\n useListener(layout, 'componentCreated', handleComponentCreated);\n useListener(\n layout.eventHub,\n PanelEvent.TITLE_CHANGED,\n handleLayoutStateChanged\n );\n\n const previousLayoutConfig = usePrevious(layoutConfig);\n useEffect(() => {\n if (previousLayoutConfig !== layoutConfig && layoutConfig !== lastConfig) {\n log.debug('Setting new layout content...');\n const content = LayoutUtils.hydrateLayoutConfig(\n layoutConfig,\n hydrateComponent\n );\n // Remove the old layout before add the new one\n while (layout.root.contentItems.length > 0) {\n layout.root.contentItems[0].remove();\n }\n\n // Add the new content. It is usally just one item from the root\n for (let i = 0; i < content.length; i += 1) {\n layout.root.addChild(content[i]);\n }\n\n setIsDashboardEmpty(layout.root.contentItems.length === 0);\n }\n }, [\n hydrateComponent,\n layout,\n layoutConfig,\n lastConfig,\n panelManager,\n previousLayoutConfig,\n ]);\n\n return (\n <>\n {isDashboardEmpty && emptyDashboard}\n {React.Children.map(children, child =>\n child\n ? React.cloneElement(child as ReactElement, {\n id,\n layout,\n panelManager,\n registerComponent,\n })\n : null\n )}\n </>\n );\n};\n\nDashboardLayout.propTypes = {\n id: PropTypes.string.isRequired,\n children: PropTypes.node,\n data: PropTypes.shape({}),\n emptyDashboard: PropTypes.node,\n layout: GLPropTypes.Layout.isRequired,\n layoutConfig: PropTypes.arrayOf(PropTypes.shape({})),\n onLayoutChange: PropTypes.func,\n onLayoutInitialized: PropTypes.func,\n};\n\nexport default DashboardLayout;\n"],"file":"DashboardLayout.js"}
@@ -8,7 +8,7 @@ declare class LayoutUtils {
8
8
  * @param {Object} config Tab config to match
9
9
  * @returns {boolean} True if the tab is active
10
10
  */
11
- static isActiveTab(root: any, config: Object): boolean;
11
+ static isActiveTab(root: ContentItem, config: Object): boolean;
12
12
  /**
13
13
  * Adds a stack to the root layout specified. Adds to the first row/column with only one item
14
14
  * @param {ContentItem} root A GoldenLayout content item to add the stack to
@@ -16,10 +16,11 @@ declare class LayoutUtils {
16
16
  */
17
17
  static addStack(parent: any, columnPreferred?: boolean): any;
18
18
  /**
19
+ * Gets the first stack which contains a contentItem with the given config values
19
20
  * @param {ContentItem} item Golden layout content item to search for the stack
20
21
  * @param {Config} config The item properties to match
21
22
  */
22
- static getStackForConfig(item: any, config?: any, allowEmptyStack?: boolean): any;
23
+ static getStackForConfig(item: ContentItem, config?: Config, allowEmptyStack?: boolean): any;
23
24
  /**
24
25
  * Gets a stack matching the specified config
25
26
  * @param {Config} config The item config type to match, eg. { component: 'IrisGridPanel', title: 'Table Name' }
@@ -27,7 +28,7 @@ declare class LayoutUtils {
27
28
  * @param {boolean} matchComponentType If the config doesn't match exactly, just find another one of the same component type
28
29
  * @param {boolean} allowEmptyStack If no configs match, search for an empty stack that can be used
29
30
  */
30
- static getStackForRoot(root: any, config: any, createIfNecessary?: boolean, matchComponentType?: boolean, allowEmptyStack?: boolean): any;
31
+ static getStackForRoot(root: any, config: Config, createIfNecessary?: boolean, matchComponentType?: boolean, allowEmptyStack?: boolean): any;
31
32
  /**
32
33
  * Gets a stack matching one of the specified types, creates new stack if necessary
33
34
  * @param {ContentItem} root The GoldenLayout root to find or create the stack in
@@ -36,14 +37,14 @@ declare class LayoutUtils {
36
37
  * @param {boolean} matchComponentType If the config doesn't match exactly, just find another one of the same component type
37
38
  * @param {boolean} allowEmptyStack If no configs match, search for an empty stack that can be used
38
39
  */
39
- static getStackForComponentTypes(root: any, types: any, createIfNecessary?: boolean, matchComponentType?: boolean, allowEmptyStack?: boolean): any;
40
+ static getStackForComponentTypes(root: ContentItem, types: any, createIfNecessary?: boolean, matchComponentType?: boolean, allowEmptyStack?: boolean): any;
40
41
  /**
41
- * Gets content item with the specified config in stack.
42
+ * Gets first content item with the specified config in stack.
42
43
  * @param {ContentItem} stack The stack to search for the item
43
44
  * @param {Config} config The item config type to match, eg. { component: 'IrisGridPanel', title: 'Table Name' }
44
45
  * @returns {ContentItem} Returns the found content item, null if not found.
45
46
  */
46
- static getContentItemInStack(stack: any, config: any): any;
47
+ static getContentItemInStack(stack: ContentItem, config: Config): ContentItem;
47
48
  /**
48
49
  * Removes dynamic props from components in the given config so this config could be serialized
49
50
  * @param {Array} config Config object
@@ -78,7 +79,7 @@ declare class LayoutUtils {
78
79
  * @param {(name: string, config: PanelProps) => PanelProps} hydrateComponent Function to hydrate the component
79
80
  * @returns {Array} Hydrated config
80
81
  */
81
- static hydrateLayoutConfig(config: any, hydrateComponent: (name: string, config: any) => any): any[];
82
+ static hydrateLayoutConfig(config: GoldenLayout.Config, hydrateComponent: (name: string, config: PanelProps) => PanelProps): any[];
82
83
  /**
83
84
  * Opens a component. It will try and open the component in an existing stack of the same component.
84
85
  * If `replaceExisting` is true and there is a component found with the same `config.id`, it will replace that component with this one.
@@ -91,7 +92,7 @@ declare class LayoutUtils {
91
92
  * @param {String} focusElement The element to focus on
92
93
  * @param {MouseEvent} dragEvent Whether component is being created with a drag, mouse event is initial position for drag proxy
93
94
  */
94
- static openComponent({ root, config: configParam, replaceExisting, replaceConfig, createNewStack, focusElement, dragEvent, }?: any): void;
95
+ static openComponent({ root, config: configParam, replaceExisting, replaceConfig, createNewStack, focusElement, dragEvent, }?: ContentItem): void;
95
96
  /**
96
97
  * Opens a component in an given stack.
97
98
  * If `replaceExisting` is true and there is a component found with the same `config.id`, it will replace that component with this one
@@ -99,13 +100,13 @@ declare class LayoutUtils {
99
100
  * @param {Config} config The component config definition to open
100
101
  * @param {Boolean} replaceExisting Whether it should replace the existing one matching component type and id, or open a new one
101
102
  */
102
- static openComponentInStack(stack: any, config: any, replaceExisting?: boolean): void;
103
+ static openComponentInStack(stack: ContentItem, config: Config, replaceExisting?: boolean): void;
103
104
  /**
104
105
  * Close the specified component and remove it from the stack it's currently in
105
106
  * @param {ContentItem} root The GoldenLayout root to search and close the component in
106
107
  * @param {Config} config The GoldenLayout component config definition to close, eg. { component: 'IrisGridPanel', id: 'table-t' }
107
108
  */
108
- static closeComponent(root: any, config: any): void;
109
+ static closeComponent(root: ContentItem, config: Config): void;
109
110
  static renameComponent(root: any, config: any, newTitle: any): void;
110
111
  /**
111
112
  * Create a component clone based on the given config
@@ -113,7 +114,7 @@ declare class LayoutUtils {
113
114
  * @param {Config} config The config to clone
114
115
  * @returns {Config} Clone config
115
116
  */
116
- static cloneComponent(root: any, config: any): any;
117
+ static cloneComponent(root: ContentItem, config: Config): Config;
117
118
  /**
118
119
  * Get panel component state for the given config
119
120
  * @param {Object} config Panel config
@@ -136,12 +137,12 @@ declare class LayoutUtils {
136
137
  * Gets a containers root node
137
138
  * @param {GlContainer} container The Golden Layout container to get the root for
138
139
  */
139
- static getRootFromContainer(container: any): any;
140
+ static getRootFromContainer(container: GlContainer): any;
140
141
  /**
141
142
  * Gets the config for the panel component given a glContainer
142
143
  * @param {GlContainer} container The Golden Layout container to get the config for
143
144
  */
144
- static getComponentConfigFromContainer(container: any): any;
145
+ static getComponentConfigFromContainer(container: GlContainer): any;
145
146
  static getTitleFromContainer(container: any): any;
146
147
  static getTitleFromTab(tab: any): any;
147
148
  /**
@@ -149,26 +150,26 @@ declare class LayoutUtils {
149
150
  * @param {GlContainer} glContainer The container to get the panel ID for
150
151
  * @returns {string|null} Panel ID
151
152
  */
152
- static getIdFromContainer(glContainer: any): string | null;
153
+ static getIdFromContainer(glContainer: GlContainer): string | null;
153
154
  /**
154
155
  * Retrieve the ID of the panel provided
155
156
  * @param {Component} panel The panel to get the ID for
156
157
  * @returns {string|null} Panel ID
157
158
  */
158
- static getIdFromPanel(panel: any): string | null;
159
+ static getIdFromPanel(panel: Component): string | null;
159
160
  /**
160
161
  * Get component name from the panel instance
161
162
  * @param {Component} panel Panel to get component name for
162
163
  * @returns {string} Component name or null if unable to retrieve name
163
164
  */
164
- static getComponentNameFromPanel(panel: any): string;
165
+ static getComponentNameFromPanel(panel: Component): string;
165
166
  /**
166
167
  * Get component name for wrapped and un-wrapped components
167
168
  * @param {Component} component Component to get name for
168
169
  * @returns {string} Component name
169
170
  * @throws If displayName for the component is not defined
170
171
  */
171
- static getComponentName(component: any): string;
172
+ static getComponentName(component: Component): string;
172
173
  /**
173
174
  * Put focus on the first "input" element (input, button, select, textarea) within an element
174
175
  * If element is null or input element not found, does nothing
@@ -176,12 +177,12 @@ declare class LayoutUtils {
176
177
  * @param {String} selector The first element matching this selector will be focused.
177
178
  * @returns {DOMElement} The element that was focused, null if not focused
178
179
  */
179
- static focusElement(element: any, selector?: string): any;
180
+ static focusElement(element: DOMElement, selector?: string): DOMElement;
180
181
  /**
181
182
  * Get a promise that initializes when layout is initialized
182
183
  * @param {GoldenLayout} layout The layout to await initialization on
183
184
  * @returns Promise that resolves when layout is initialized
184
185
  */
185
- static onInitialized(layout: any): Promise<any>;
186
+ static onInitialized(layout: GoldenLayout): Promise<any>;
186
187
  }
187
188
  //# sourceMappingURL=LayoutUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"LayoutUtils.d.ts","sourceRoot":"","sources":["../../src/layout/LayoutUtils.js"],"names":[],"mappings":";AAOA;IACE,sCAAkE;IAElE,iDASC;IAED;;;;;OAKG;IACH,sCAHW,MAAM,GACJ,OAAO,CAYnB;IAED;;;;OAIG;IACH,6DAuCC;IAED;;;OAGG;IACH,kFAqCC;IAED;;;;;;OAMG;IACH,mEAJW,OAAO,uBACP,OAAO,oBACP,OAAO,OAuBjB;IAED;;;;;;;OAOG;IACH,4EAJW,OAAO,uBACP,OAAO,oBACP,OAAO,OAwBjB;IAED;;;;;OAKG;IACH,2DAmBC;IAED;;;;;OAKG;IACH,4EAgCC;IAED,4CAQC;IAED;;;;;;;;;;OAUG;IACH,qCATW,MAAM,QA0BhB;IAED;;;;;OAKG;IACH,wBAJW,MAAM,WACN,MAAM,UACN,OAAO,WAWjB;IAED,qCAEC;IAED;;;;;OAKG;IACH,iEAHkB,MAAM,8BA2CvB;IAED;;;;;;;;;;;OAWG;IACH,0IAmEC;IAED;;;;;;OAMG;IACH,sFA2BC;IAED;;;;OAIG;IACH,oDA2BC;IAED,oEASC;IAED;;;;;OAKG;IACH,mDAmBC;IAED;;;;OAIG;IACH,sCAHW,MAAM,GACJ,MAAM,CAOlB;IAED;;;;;;;;;;;MAaC;IAED;;;OAGG;IACH,iDAEC;IAED;;;OAGG;IACH,4DAYC;IAED,kDAKC;IAED,sCAKC;IAED;;;;OAIG;IACH,6CAFa,MAAM,GAAC,IAAI,CAQvB;IAED;;;;OAIG;IACH,mCAFa,MAAM,GAAC,IAAI,CAKvB;IAED;;;;OAIG;IACH,8CAFa,MAAM,CAMlB;IAED;;;;;OAKG;IACH,yCAHa,MAAM,CAUlB;IAED;;;;;;OAMG;IACH,0DAWC;IAED;;;;OAIG;IACH,gDAYC;CACF"}
1
+ {"version":3,"file":"LayoutUtils.d.ts","sourceRoot":"","sources":["../../src/layout/LayoutUtils.js"],"names":[],"mappings":";AAQA;IACE,sCAAkE;IAElE,iDASC;IAED;;;;;OAKG;IACH,8CAHW,MAAM,GACJ,OAAO,CAYnB;IAED;;;;OAIG;IACH,6DAuCC;IAED;;;;OAIG;IACH,6FA4BC;IAED;;;;;;OAMG;IACH,sEAJW,OAAO,uBACP,OAAO,oBACP,OAAO,OAuBjB;IAED;;;;;;;OAOG;IACH,oFAJW,OAAO,uBACP,OAAO,oBACP,OAAO,OAwBjB;IAED;;;;;OAKG;IACH,8EAUC;IAED;;;;;OAKG;IACH,4EAgCC;IAED,4CAQC;IAED;;;;;;;;;;OAUG;IACH,qCATW,MAAM,QA0BhB;IAED;;;;;OAKG;IACH,wBAJW,MAAM,WACN,MAAM,UACN,OAAO,WAWjB;IAED,qCAEC;IAED;;;;;OAKG;IACH,iFAHkB,MAAM,4CA2CvB;IAED;;;;;;;;;;;OAWG;IACH,kJAmEC;IAED;;;;;;OAMG;IACH,iGA2BC;IAED;;;;OAIG;IACH,+DA2BC;IAED,oEASC;IAED;;;;;OAKG;IACH,iEAmBC;IAED;;;;OAIG;IACH,sCAHW,MAAM,GACJ,MAAM,CAOlB;IAED;;;;;;;;;;;MAaC;IAED;;;OAGG;IACH,yDAEC;IAED;;;OAGG;IACH,oEAYC;IAED,kDAKC;IAED,sCAKC;IAED;;;;OAIG;IACH,qDAFa,MAAM,GAAC,IAAI,CAQvB;IAED;;;;OAIG;IACH,yCAFa,MAAM,GAAC,IAAI,CAKvB;IAED;;;;OAIG;IACH,oDAFa,MAAM,CAMlB;IAED;;;;;OAKG;IACH,+CAHa,MAAM,CAUlB;IAED;;;;;;OAMG;IACH,wEAWC;IAED;;;;OAIG;IACH,yDAYC;CACF"}
@@ -6,6 +6,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
6
6
 
7
7
  import deepEqual from 'deep-equal';
8
8
  import shortid from 'shortid';
9
+ import isMatch from 'lodash.ismatch';
9
10
  import Log from '@deephaven/log';
10
11
  import GoldenLayoutThemeExport from "./GoldenLayoutThemeExport.js";
11
12
  var log = Log.module('LayoutUtils');
@@ -103,6 +104,7 @@ class LayoutUtils {
103
104
  return this.addStack(newParent, !columnPreferred);
104
105
  }
105
106
  /**
107
+ * Gets the first stack which contains a contentItem with the given config values
106
108
  * @param {ContentItem} item Golden layout content item to search for the stack
107
109
  * @param {Config} config The item properties to match
108
110
  */
@@ -124,19 +126,7 @@ class LayoutUtils {
124
126
  var contentItem = item.contentItems[i];
125
127
 
126
128
  if (contentItem.isComponent && contentItem.config) {
127
- var isMatch = true;
128
- var keys = Object.keys(config);
129
-
130
- for (var k = 0; k < keys.length; k += 1) {
131
- var key = keys[k];
132
-
133
- if (config[key] !== contentItem.config[key]) {
134
- isMatch = false;
135
- break;
136
- }
137
- }
138
-
139
- if (isMatch) {
129
+ if (isMatch(contentItem.config, config)) {
140
130
  return item;
141
131
  }
142
132
  }
@@ -207,7 +197,7 @@ class LayoutUtils {
207
197
  return null;
208
198
  }
209
199
  /**
210
- * Gets content item with the specified config in stack.
200
+ * Gets first content item with the specified config in stack.
211
201
  * @param {ContentItem} stack The stack to search for the item
212
202
  * @param {Config} config The item config type to match, eg. { component: 'IrisGridPanel', title: 'Table Name' }
213
203
  * @returns {ContentItem} Returns the found content item, null if not found.
@@ -219,19 +209,7 @@ class LayoutUtils {
219
209
  var contentItem = stack.contentItems[i];
220
210
 
221
211
  if (contentItem.isComponent && contentItem.config) {
222
- var isMatch = true;
223
- var keys = Object.keys(config);
224
-
225
- for (var k = 0; k < keys.length; k += 1) {
226
- var key = keys[k];
227
-
228
- if (config[key] !== contentItem.config[key]) {
229
- isMatch = false;
230
- break;
231
- }
232
- }
233
-
234
- if (isMatch) {
212
+ if (isMatch(contentItem.config, config)) {
235
213
  return contentItem;
236
214
  }
237
215
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/layout/LayoutUtils.js"],"names":["deepEqual","shortid","Log","GoldenLayoutThemeExport","log","module","LayoutUtils","activateTab","root","config","stack","getStackForRoot","error","contentItem","getContentItemInStack","setActiveContentItem","isActiveTab","activeItem","getActiveContentItem","addStack","parent","columnPreferred","type","isRoot","contentItems","length","addChild","child","isCorrectType","isColumn","isRow","removeChild","maintainFocusElement","document","activeElement","focus","newParent","getStackForConfig","item","allowEmptyStack","isStack","i","isComponent","isMatch","keys","Object","k","key","createIfNecessary","matchComponentType","component","getStackForComponentTypes","types","isLastType","dehydrateLayoutConfig","dehydrateComponent","dehydratedConfig","itemConfig","content","dehydratedComponent","push","debug2","layoutItemConfig","getTabPoint","glContainer","tab","Error","tabRect","element","getBoundingClientRect","left","width","bottom","dropLayoutMinorChange","activeItemIndex","props","panelState","id","irisGridState","sorts","quickFilters","isEqual","layout1","layout2","major","layout1Clone","cloneLayout","layout2Clone","layout","JSON","parse","stringify","hydrateLayoutConfig","hydrateComponent","hydratedConfig","contentConfig","warn","openComponent","configParam","replaceExisting","replaceConfig","createNewStack","focusElement","dragEvent","generate","layoutManager","createDragSourceFromEvent","searchConfig","oldContentItem","onComponentCreated","event","debug","off","origin","requestAnimationFrame","on","index","indexOf","openComponentInStack","closeComponent","container","close","contains","renameComponent","newTitle","setTitle","cloneComponent","getPanelComponentState","cloneConfig","title","componentState","makeDefaultLayout","dimensions","headerHeight","tabHeight","borderWidth","dragBorderWidth","borderGrabWidth","settings","showPopoutIcon","showCloseIcon","constrainDragToContainer","getRootFromContainer","getComponentConfigFromContainer","_config","getTitleFromContainer","getTitleFromTab","getIdFromContainer","getIdFromPanel","panel","getComponentNameFromPanel","getComponentName","name","WrappedComponent","displayName","selector","DEFAULT_FOCUS_SELECTOR","querySelector","onInitialized","Promise","resolve","isInitialised","onInit"],"mappings":";;;;;;AAAA,OAAOA,SAAP,MAAsB,YAAtB;AACA,OAAOC,OAAP,MAAoB,SAApB;AACA,OAAOC,GAAP,MAAgB,gBAAhB;OACOC,uB;AAEP,IAAMC,GAAG,GAAGF,GAAG,CAACG,MAAJ,CAAW,aAAX,CAAZ;;AAEA,MAAMC,WAAN,CAAkB;AAGE,SAAXC,WAAW,CAACC,IAAD,EAAOC,MAAP,EAAe;AAC/B,QAAMC,KAAK,GAAGJ,WAAW,CAACK,eAAZ,CAA4BH,IAA5B,EAAkCC,MAAlC,EAA0C,KAA1C,CAAd;;AACA,QAAI,CAACC,KAAL,EAAY;AACVN,MAAAA,GAAG,CAACQ,KAAJ,CAAU,iCAAV,EAA6CH,MAA7C;AACA;AACD,KAL8B,CAM/B;;;AACA,QAAMI,WAAW,GAAGP,WAAW,CAACQ,qBAAZ,CAAkCJ,KAAlC,EAAyCD,MAAzC,CAApB;AACAC,IAAAA,KAAK,CAACK,oBAAN,CAA2BF,WAA3B;AACD;AAED;AACF;AACA;AACA;AACA;AACA;;;AACoB,SAAXG,WAAW,CAACR,IAAD,EAAOC,MAAP,EAAe;AAC/B,QAAMC,KAAK,GAAGJ,WAAW,CAACK,eAAZ,CAA4BH,IAA5B,EAAkCC,MAAlC,EAA0C,KAA1C,CAAd;;AACA,QAAI,CAACC,KAAL,EAAY;AACVN,MAAAA,GAAG,CAACQ,KAAJ,CAAU,iCAAV,EAA6CH,MAA7C;AACA,aAAO,KAAP;AACD,KAL8B,CAM/B;;;AACA,QAAMI,WAAW,GAAGP,WAAW,CAACQ,qBAAZ,CAAkCJ,KAAlC,EAAyCD,MAAzC,CAApB;AACA,QAAMQ,UAAU,GAAGP,KAAK,CAACQ,oBAAN,EAAnB;AAC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AW,CAACsJ,sBAAwB;;AAC1E,QAAIxF,OAAO,IAAI,IAAf,EAAqB;AACnB,aAAO,IAAP;AACD;;AACD,QAAMkC,YAAY,GAAGlC,OAAO,CAACyF,aAAR,CAAsBF,QAAtB,CAArB;;AACA,QAAIrD,YAAY,IAAI,IAApB,EAA0B;AACxB,aAAO,IAAP;AACD;;AAEDA,IAAAA,YAAY,CAACnE,KAAb;AACA,WAAOmE,YAAP;AACD;AAED;AACF;AACA;AACA;AACA;;;AACsB,SAAbwD,aAAa,CAACtE,MAAD,EAAS;AAC3B,WAAO,IAAIuE,OAAJ,CAAYC,OAAO,IAAI;AAC5B,UAAIxE,MAAM,CAACyE,aAAX,EAA0B;AACxBD,QAAAA,OAAO;AACP;AACD;;AACD,UAAME,MAAM,GAAG,MAAM;AACnB1E,QAAAA,MAAM,CAACwB,GAAP,CAAW,aAAX,EAA0BkD,MAA1B;AACAF,QAAAA,OAAO;AACR,OAHD;;AAIAxE,MAAAA,MAAM,CAAC2B,EAAP,CAAU,aAAV,EAAyB+C,MAAzB;AACD,KAVM,CAAP;AAWD;;AA7rBe;;gBAAZ5J,W,4BAC4B,iC;;AA+rBlC,eAAeA,WAAf","sourcesContent":["import deepEqual from 'deep-equal';\nimport shortid from 'shortid';\nimport Log from '@deephaven/log';\nimport GoldenLayoutThemeExport from './GoldenLayoutThemeExport';\n\nconst log = Log.module('LayoutUtils');\n\nclass LayoutUtils {\n static DEFAULT_FOCUS_SELECTOR = 'input, select, textarea, button';\n\n static activateTab(root, config) {\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 stack.setActiveContentItem(contentItem);\n }\n\n /**\n * Is the tab with the given config active\n * @param {ContentItem} root A GoldenLayout content item with the tab\n * @param {Object} config Tab config to match\n * @returns {boolean} True if the tab is active\n */\n static isActiveTab(root, config) {\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 {ContentItem} root A GoldenLayout content item to add the stack to\n * @returns The newly created stack.\n */\n static addStack(parent, columnPreferred = true) {\n const type = columnPreferred ? 'column' : 'row';\n if (parent.isRoot) {\n if (!parent.contentItems || parent.contentItems.length === 0) {\n parent.addChild({ type });\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({ type });\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 maintainFocusElement?.focus();\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];\n }\n let newParent = parent.contentItems[parent.contentItems.length - 1];\n const isCorrectType = !columnPreferred\n ? newParent.isColumn\n : newParent.isRow;\n if (!isCorrectType) {\n parent.addChild({ type: !columnPreferred ? 'column' : 'row' });\n parent.removeChild(newParent, true);\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 * @param {ContentItem} item Golden layout content item to search for the stack\n * @param {Config} config The item properties to match\n */\n static getStackForConfig(item, config = {}, allowEmptyStack = false) {\n if (allowEmptyStack && item.isStack && item.contentItems.length === 0) {\n return item;\n }\n\n if (!item.contentItems) {\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) {\n let isMatch = true;\n const keys = Object.keys(config);\n for (let k = 0; k < keys.length; k += 1) {\n const key = keys[k];\n if (config[key] !== contentItem.config[key]) {\n isMatch = false;\n break;\n }\n }\n if (isMatch) {\n return item;\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 {Config} config The item config type to match, eg. { component: 'IrisGridPanel', title: 'Table Name' }\n * @param {boolean} createIfNecessary Whether to create the stack if it does not exist.\n * @param {boolean} matchComponentType If the config doesn't match exactly, just find another one of the same component type\n * @param {boolean} allowEmptyStack If no configs match, search for an empty stack that can be used\n */\n static getStackForRoot(\n root,\n config,\n createIfNecessary = true,\n matchComponentType = true,\n allowEmptyStack = true\n ) {\n let stack = this.getStackForConfig(root, config);\n if (!stack && matchComponentType) {\n stack = this.getStackForConfig(\n root,\n { component: config.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 {ContentItem} root The GoldenLayout root to find or create the stack in\n * @param {Array[string]} types The array of component types to match\n * @param {boolean} createIfNecessary Whether to create the stack if it does not exist\n * @param {boolean} matchComponentType If the config doesn't match exactly, just find another one of the same component type\n * @param {boolean} allowEmptyStack If no configs match, search for an empty stack that can be used\n */\n static getStackForComponentTypes(\n root,\n types,\n createIfNecessary = true,\n matchComponentType = true,\n allowEmptyStack = true\n ) {\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 content item with the specified config in stack.\n * @param {ContentItem} stack The stack to search for the item\n * @param {Config} config The item config type to match, eg. { component: 'IrisGridPanel', title: 'Table Name' }\n * @returns {ContentItem} Returns the found content item, null if not found.\n */\n static getContentItemInStack(stack, config) {\n for (let i = 0; i < stack.contentItems.length; i += 1) {\n const contentItem = stack.contentItems[i];\n if (contentItem.isComponent && contentItem.config) {\n let isMatch = true;\n const keys = Object.keys(config);\n for (let k = 0; k < keys.length; k += 1) {\n const key = keys[k];\n if (config[key] !== contentItem.config[key]) {\n isMatch = false;\n break;\n }\n }\n if (isMatch) {\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 {Array} config Config object\n * @param {(name: string, config: PanelConfig) => PanelConfig | null}\n * @returns {Array} Dehydrated config\n */\n static dehydrateLayoutConfig(config, dehydrateComponent) {\n if (!config || !config.length) {\n return [];\n }\n const dehydratedConfig = [];\n\n for (let i = 0; i < config.length; i += 1) {\n const itemConfig = config[i];\n const { component, content } = itemConfig;\n if (component) {\n const dehydratedComponent = dehydrateComponent(component, itemConfig);\n if (dehydratedComponent) {\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) {\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 {Object} config Layout Configuration\n *\n * minor changes:\n * 1. sorts in grid\n * 2. quick filters in grid\n * 3. active item\n *\n * item id is also removed\n */\n static dropLayoutMinorChange(config) {\n for (let i = 0; i < config.length; i += 1) {\n const itemConfig = config[i];\n const { component, content, activeItemIndex } = itemConfig;\n if (content) {\n if (activeItemIndex || activeItemIndex === 0) {\n delete itemConfig.activeItemIndex;\n }\n LayoutUtils.dropLayoutMinorChange(content);\n } else if (component === 'IrisGridPanel') {\n if (itemConfig.props.panelState) {\n delete itemConfig.id;\n itemConfig.props.panelState.irisGridState.sorts = [];\n itemConfig.props.panelState.irisGridState.quickFilters = [];\n }\n }\n }\n }\n\n /**\n * Compare two layouts to see if they are equivalent\n * @param {object} layout1 A Golden Layout config object\n * @param {object} layout2 Another Golden layout config object\n * @param {boolean} major When true, will ignore \"minor\" property differences (eg. sorts)\n */\n static isEqual(layout1, layout2, major = false) {\n if (major) {\n const layout1Clone = LayoutUtils.cloneLayout(layout1);\n const layout2Clone = LayoutUtils.cloneLayout(layout2);\n LayoutUtils.dropLayoutMinorChange(layout1Clone);\n LayoutUtils.dropLayoutMinorChange(layout2Clone);\n return deepEqual(layout1Clone, layout2Clone);\n }\n return deepEqual(layout1, layout2);\n }\n\n static cloneLayout(layout) {\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 {GoldenLayout.Config} config Dehydrated config object\n * @param {(name: string, config: PanelProps) => PanelProps} hydrateComponent Function to hydrate the component\n * @returns {Array} Hydrated config\n */\n static hydrateLayoutConfig(config, hydrateComponent) {\n if (!config || !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 const { component, content, props, type } = itemConfig;\n if (type === 'react-component') {\n hydratedConfig.push({\n ...itemConfig,\n id: itemConfig?.id ?? shortid(),\n props: hydrateComponent(component, props),\n });\n } else if (content) {\n const contentConfig = LayoutUtils.hydrateLayoutConfig(\n content,\n hydrateComponent\n );\n if (\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 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 {ContentItem} root The GoldenLayout root to open the component in\n * @param {Config} config The component config definition to open\n * @param {Boolean} replaceExisting Whether it should replace the existing one matching component type and id, or open a new one\n * @param {Config} replaceConfig The component config to replace\n * @param {Boolean} 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 {String} focusElement The element to focus on\n * @param {MouseEvent} 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 replaceExisting = true,\n replaceConfig = null,\n createNewStack = false,\n focusElement = null,\n dragEvent = null,\n } = {}) {\n // attempt to retain focus after dom manipulation, which can break focus\n const maintainFocusElement = document.activeElement;\n const config = { ...configParam };\n\n if (!config.id) {\n config.id = shortid.generate();\n }\n\n if (dragEvent) {\n root.layoutManager.createDragSourceFromEvent(config, dragEvent);\n return;\n }\n\n const searchConfig = replaceConfig || {\n id: config.id,\n component: config.component,\n };\n const stack = createNewStack\n ? LayoutUtils.addStack(root)\n : LayoutUtils.getStackForRoot(root, searchConfig);\n\n const oldContentItem = LayoutUtils.getContentItemInStack(\n stack,\n searchConfig\n );\n\n if (focusElement) {\n // We need to listen for when the stack is created\n const onComponentCreated = event => {\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 (!focusElement && maintainFocusElement) {\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 {ContentItem} stack The GoldenLayout stack to open the component in\n * @param {Config} config The component config definition to open\n * @param {Boolean} replaceExisting Whether it should replace the existing one matching component type and id, or open a new one\n */\n static openComponentInStack(stack, config, replaceExisting = true) {\n const maintainFocusElement = document.activeElement; // attempt to retain focus after dom manipulation, which can break focus\n\n const searchConfig = {\n id: config.id,\n component: config.component,\n };\n\n const oldContentItem = LayoutUtils.getContentItemInStack(\n stack,\n searchConfig\n );\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 (maintainFocusElement) maintainFocusElement.focus();\n }\n\n /**\n * Close the specified component and remove it from the stack it's currently in\n * @param {ContentItem} root The GoldenLayout root to search and close the component in\n * @param {Config} config The GoldenLayout component config definition to close, eg. { component: 'IrisGridPanel', id: 'table-t' }\n */\n static closeComponent(root, config) {\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.isComponent) {\n oldContentItem.container.close();\n } else {\n stack.removeChild(oldContentItem);\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 (maintainFocusElement && document.contains(maintainFocusElement)) {\n maintainFocusElement.focus();\n }\n }\n\n static renameComponent(root, config, newTitle) {\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 contentItem.setTitle(newTitle);\n }\n\n /**\n * Create a component clone based on the given config\n * @param {ContentItem} root The GoldenLayout root to clone the component in\n * @param {Config} config The config to clone\n * @returns {Config} Clone config\n */\n static cloneComponent(root, config) {\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 panelState = LayoutUtils.getPanelComponentState(config);\n const cloneConfig = {\n type: 'react-component',\n component: config.component,\n props: {\n ...config.props,\n panelState,\n },\n title: `${config.title} Copy`,\n id: shortid.generate(),\n };\n LayoutUtils.openComponentInStack(stack, cloneConfig);\n return cloneConfig;\n }\n\n /**\n * Get panel component state for the given config\n * @param {Object} config Panel config\n * @returns {Object} Panel state\n */\n static getPanelComponentState(config) {\n return (\n // Fallback to props.panelState for uninitialized panels\n config.componentState?.panelState ?? config.props?.panelState ?? null\n );\n }\n\n static makeDefaultLayout() {\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 };\n }\n\n /**\n * Gets a containers root node\n * @param {GlContainer} container The Golden Layout container to get the root for\n */\n static getRootFromContainer(container) {\n return container.layoutManager.root;\n }\n\n /**\n * Gets the config for the panel component given a glContainer\n * @param {GlContainer} container The Golden Layout container to get the config for\n */\n static getComponentConfigFromContainer(container) {\n if (container) {\n if (container.tab && container.tab.contentItem) {\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 no-underscore-dangle\n return container._config;\n }\n\n return null;\n }\n\n static getTitleFromContainer(container) {\n if (container && container.tab && container.tab.contentItem) {\n return container.tab.contentItem.config.title;\n }\n return null;\n }\n\n static getTitleFromTab(tab) {\n if (tab && tab.contentItem) {\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} glContainer The container to get the panel ID for\n * @returns {string|null} Panel ID\n */\n static getIdFromContainer(glContainer) {\n const config = LayoutUtils.getComponentConfigFromContainer(glContainer);\n if (config) {\n return config.id;\n }\n return null;\n }\n\n /**\n * Retrieve the ID of the panel provided\n * @param {Component} panel The panel to get the ID for\n * @returns {string|null} Panel ID\n */\n static getIdFromPanel(panel) {\n const { glContainer } = panel.props;\n return LayoutUtils.getIdFromContainer(glContainer);\n }\n\n /**\n * Get component name from the panel instance\n * @param {Component} panel Panel to get component name for\n * @returns {string} Component name or null if unable to retrieve name\n */\n static getComponentNameFromPanel(panel) {\n const { glContainer } = panel.props;\n const config = LayoutUtils.getComponentConfigFromContainer(glContainer);\n return config?.component ?? null;\n }\n\n /**\n * Get component name for wrapped and un-wrapped components\n * @param {Component} component Component to get name for\n * @returns {string} Component name\n * @throws If displayName for the component is not defined\n */\n static getComponentName(component) {\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 {DOMElement} element The element to put focus in.\n * @param {String} selector The first element matching this selector will be focused.\n * @returns {DOMElement} The element that was focused, null if not focused\n */\n static focusElement(element, selector = LayoutUtils.DEFAULT_FOCUS_SELECTOR) {\n if (element == null) {\n return null;\n }\n const focusElement = element.querySelector(selector);\n if (focusElement == null) {\n return null;\n }\n\n focusElement.focus();\n return focusElement;\n }\n\n /**\n * Get a promise that initializes when layout is initialized\n * @param {GoldenLayout} layout The layout to await initialization on\n * @returns Promise that resolves when layout is initialized\n */\n static onInitialized(layout) {\n return new Promise(resolve => {\n if (layout.isInitialised) {\n resolve();\n return;\n }\n const onInit = () => {\n layout.off('initialised', onInit);\n resolve();\n };\n layout.on('initialised', onInit);\n });\n }\n}\n\nexport default LayoutUtils;\n"],"file":"LayoutUtils.js"}
1
+ {"version":3,"sources":["../../src/layout/LayoutUtils.js"],"names":["deepEqual","shortid","isMatch","Log","GoldenLayoutThemeExport","log","module","LayoutUtils","activateTab","root","config","stack","getStackForRoot","error","contentItem","getContentItemInStack","setActiveContentItem","isActiveTab","activeItem","getActiveContentItem","addStack","parent","columnPreferred","type","isRoot","contentItems","length","addChild","child","isCorrectType","isColumn","isRow","removeChild","maintainFocusElement","document","activeElement","focus","newParent","getStackForConfig","item","allowEmptyStack","isStack","i","isComponent","createIfNecessary","matchComponentType","component","getStackForComponentTypes","types","isLastType","dehydrateLayoutConfig","dehydrateComponent","dehydratedConfig","itemConfig","content","dehydratedComponent","push","debug2","layoutItemConfig","getTabPoint","glContainer","tab","Error","tabRect","element","getBoundingClientRect","left","width","bottom","dropLayoutMinorChange","activeItemIndex","props","panelState","id","irisGridState","sorts","quickFilters","isEqual","layout1","layout2","major","layout1Clone","cloneLayout","layout2Clone","layout","JSON","parse","stringify","hydrateLayoutConfig","hydrateComponent","hydratedConfig","contentConfig","warn","openComponent","configParam","replaceExisting","replaceConfig","createNewStack","focusElement","dragEvent","generate","layoutManager","createDragSourceFromEvent","searchConfig","oldContentItem","onComponentCreated","event","debug","off","origin","requestAnimationFrame","on","index","indexOf","openComponentInStack","closeComponent","container","close","contains","renameComponent","newTitle","setTitle","cloneComponent","getPanelComponentState","cloneConfig","title","componentState","makeDefaultLayout","dimensions","headerHeight","tabHeight","borderWidth","dragBorderWidth","borderGrabWidth","settings","showPopoutIcon","showCloseIcon","constrainDragToContainer","getRootFromContainer","getComponentConfigFromContainer","_config","getTitleFromContainer","getTitleFromTab","getIdFromContainer","getIdFromPanel","panel","getComponentNameFromPanel","getComponentName","name","WrappedComponent","displayName","selector","DEFAULT_FOCUS_SELECTOR","querySelector","onInitialized","Promise","resolve","isInitialised","onInit"],"mappings":";;;;;;AAAA,OAAOA,SAAP,MAAsB,YAAtB;AACA,OAAOC,OAAP,MAAoB,SAApB;AACA,OAAOC,OAAP,MAAoB,gBAApB;AACA,OAAOC,GAAP,MAAgB,gBAAhB;OACOC,uB;AAEP,IAAMC,GAAG,GAAGF,GAAG,CAACG,MAAJ,CAAW,aAAX,CAAZ;;AAEA,MAAMC,WAAN,CAAkB;AAGE,SAAXC,WAAW,CAACC,IAAD,EAAOC,MAAP,EAAe;AAC/B,QAAMC,KAAK,GAAGJ,WAAW,CAACK,eAAZ,CAA4BH,IAA5B,EAAkCC,MAAlC,EAA0C,KAA1C,CAAd;;AACA,QAAI,CAACC,KAAL,EAAY;AACVN,MAAAA,GAAG,CAACQ,KAAJ,CAAU,iCAAV,EAA6CH,MAA7C;AACA;AACD,KAL8B,CAM/B;;;AACA,QAAMI,WAAW,GAAGP,WAAW,CAACQ,qBAAZ,CAAkCJ,KAAlC,EAAyCD,MAAzC,CAApB;AACAC,IAAAA,KAAK,CAACK,oBAAN,CAA2BF,WAA3B;AACD;AAED;AACF;AACA;AACA;AACA;AACA;;;AACoB,SAAXG,WAAW,CAACR,IAAD,EAAOC,MAAP,EAAe;AAC/B,QAAMC,KAAK,GAAGJ,WAAW,CAACK,eAAZ,CAA4BH,IAA5B,EAAkCC,MAAlC,EAA0C,KAA1C,CAAd;;AACA,QAAI,CAACC,KAAL,EAAY;AACVN,MAAAA,GAAG,CAACQ,KAAJ,CAAU,iCAAV,EAA6CH,MAA7C;AACA,aAAO,KAAP;AACD,KAL8B,CAM/B;;;AACA,QAAMI,WAAW,GAAGP,WAAW,CAACQ,qBAAZ,CAAkCJ,KAAlC,EAAy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AyB+C,MAAzB;AACD,KAVM,CAAP;AAWD;;AA5qBe;;gBAAZvJ,W,4BAC4B,iC;;AA8qBlC,eAAeA,WAAf","sourcesContent":["import deepEqual from 'deep-equal';\nimport shortid from 'shortid';\nimport isMatch from 'lodash.ismatch';\nimport Log from '@deephaven/log';\nimport GoldenLayoutThemeExport from './GoldenLayoutThemeExport';\n\nconst log = Log.module('LayoutUtils');\n\nclass LayoutUtils {\n static DEFAULT_FOCUS_SELECTOR = 'input, select, textarea, button';\n\n static activateTab(root, config) {\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 stack.setActiveContentItem(contentItem);\n }\n\n /**\n * Is the tab with the given config active\n * @param {ContentItem} root A GoldenLayout content item with the tab\n * @param {Object} config Tab config to match\n * @returns {boolean} True if the tab is active\n */\n static isActiveTab(root, config) {\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 {ContentItem} root A GoldenLayout content item to add the stack to\n * @returns The newly created stack.\n */\n static addStack(parent, columnPreferred = true) {\n const type = columnPreferred ? 'column' : 'row';\n if (parent.isRoot) {\n if (!parent.contentItems || parent.contentItems.length === 0) {\n parent.addChild({ type });\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({ type });\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 maintainFocusElement?.focus();\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];\n }\n let newParent = parent.contentItems[parent.contentItems.length - 1];\n const isCorrectType = !columnPreferred\n ? newParent.isColumn\n : newParent.isRow;\n if (!isCorrectType) {\n parent.addChild({ type: !columnPreferred ? 'column' : 'row' });\n parent.removeChild(newParent, true);\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 the first stack which contains a contentItem with the given config values\n * @param {ContentItem} item Golden layout content item to search for the stack\n * @param {Config} config The item properties to match\n */\n static getStackForConfig(item, config = {}, allowEmptyStack = false) {\n if (allowEmptyStack && item.isStack && item.contentItems.length === 0) {\n return item;\n }\n\n if (!item.contentItems) {\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) {\n if (isMatch(contentItem.config, config)) {\n return item;\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 {Config} config The item config type to match, eg. { component: 'IrisGridPanel', title: 'Table Name' }\n * @param {boolean} createIfNecessary Whether to create the stack if it does not exist.\n * @param {boolean} matchComponentType If the config doesn't match exactly, just find another one of the same component type\n * @param {boolean} allowEmptyStack If no configs match, search for an empty stack that can be used\n */\n static getStackForRoot(\n root,\n config,\n createIfNecessary = true,\n matchComponentType = true,\n allowEmptyStack = true\n ) {\n let stack = this.getStackForConfig(root, config);\n if (!stack && matchComponentType) {\n stack = this.getStackForConfig(\n root,\n { component: config.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 {ContentItem} root The GoldenLayout root to find or create the stack in\n * @param {Array[string]} types The array of component types to match\n * @param {boolean} createIfNecessary Whether to create the stack if it does not exist\n * @param {boolean} matchComponentType If the config doesn't match exactly, just find another one of the same component type\n * @param {boolean} allowEmptyStack If no configs match, search for an empty stack that can be used\n */\n static getStackForComponentTypes(\n root,\n types,\n createIfNecessary = true,\n matchComponentType = true,\n allowEmptyStack = true\n ) {\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 {ContentItem} stack The stack to search for the item\n * @param {Config} config The item config type to match, eg. { component: 'IrisGridPanel', title: 'Table Name' }\n * @returns {ContentItem} Returns the found content item, null if not found.\n */\n static getContentItemInStack(stack, config) {\n for (let i = 0; i < stack.contentItems.length; i += 1) {\n const contentItem = stack.contentItems[i];\n if (contentItem.isComponent && contentItem.config) {\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 {Array} config Config object\n * @param {(name: string, config: PanelConfig) => PanelConfig | null}\n * @returns {Array} Dehydrated config\n */\n static dehydrateLayoutConfig(config, dehydrateComponent) {\n if (!config || !config.length) {\n return [];\n }\n const dehydratedConfig = [];\n\n for (let i = 0; i < config.length; i += 1) {\n const itemConfig = config[i];\n const { component, content } = itemConfig;\n if (component) {\n const dehydratedComponent = dehydrateComponent(component, itemConfig);\n if (dehydratedComponent) {\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) {\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 {Object} config Layout Configuration\n *\n * minor changes:\n * 1. sorts in grid\n * 2. quick filters in grid\n * 3. active item\n *\n * item id is also removed\n */\n static dropLayoutMinorChange(config) {\n for (let i = 0; i < config.length; i += 1) {\n const itemConfig = config[i];\n const { component, content, activeItemIndex } = itemConfig;\n if (content) {\n if (activeItemIndex || activeItemIndex === 0) {\n delete itemConfig.activeItemIndex;\n }\n LayoutUtils.dropLayoutMinorChange(content);\n } else if (component === 'IrisGridPanel') {\n if (itemConfig.props.panelState) {\n delete itemConfig.id;\n itemConfig.props.panelState.irisGridState.sorts = [];\n itemConfig.props.panelState.irisGridState.quickFilters = [];\n }\n }\n }\n }\n\n /**\n * Compare two layouts to see if they are equivalent\n * @param {object} layout1 A Golden Layout config object\n * @param {object} layout2 Another Golden layout config object\n * @param {boolean} major When true, will ignore \"minor\" property differences (eg. sorts)\n */\n static isEqual(layout1, layout2, major = false) {\n if (major) {\n const layout1Clone = LayoutUtils.cloneLayout(layout1);\n const layout2Clone = LayoutUtils.cloneLayout(layout2);\n LayoutUtils.dropLayoutMinorChange(layout1Clone);\n LayoutUtils.dropLayoutMinorChange(layout2Clone);\n return deepEqual(layout1Clone, layout2Clone);\n }\n return deepEqual(layout1, layout2);\n }\n\n static cloneLayout(layout) {\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 {GoldenLayout.Config} config Dehydrated config object\n * @param {(name: string, config: PanelProps) => PanelProps} hydrateComponent Function to hydrate the component\n * @returns {Array} Hydrated config\n */\n static hydrateLayoutConfig(config, hydrateComponent) {\n if (!config || !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 const { component, content, props, type } = itemConfig;\n if (type === 'react-component') {\n hydratedConfig.push({\n ...itemConfig,\n id: itemConfig?.id ?? shortid(),\n props: hydrateComponent(component, props),\n });\n } else if (content) {\n const contentConfig = LayoutUtils.hydrateLayoutConfig(\n content,\n hydrateComponent\n );\n if (\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 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 {ContentItem} root The GoldenLayout root to open the component in\n * @param {Config} config The component config definition to open\n * @param {Boolean} replaceExisting Whether it should replace the existing one matching component type and id, or open a new one\n * @param {Config} replaceConfig The component config to replace\n * @param {Boolean} 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 {String} focusElement The element to focus on\n * @param {MouseEvent} 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 replaceExisting = true,\n replaceConfig = null,\n createNewStack = false,\n focusElement = null,\n dragEvent = null,\n } = {}) {\n // attempt to retain focus after dom manipulation, which can break focus\n const maintainFocusElement = document.activeElement;\n const config = { ...configParam };\n\n if (!config.id) {\n config.id = shortid.generate();\n }\n\n if (dragEvent) {\n root.layoutManager.createDragSourceFromEvent(config, dragEvent);\n return;\n }\n\n const searchConfig = replaceConfig || {\n id: config.id,\n component: config.component,\n };\n const stack = createNewStack\n ? LayoutUtils.addStack(root)\n : LayoutUtils.getStackForRoot(root, searchConfig);\n\n const oldContentItem = LayoutUtils.getContentItemInStack(\n stack,\n searchConfig\n );\n\n if (focusElement) {\n // We need to listen for when the stack is created\n const onComponentCreated = event => {\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 (!focusElement && maintainFocusElement) {\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 {ContentItem} stack The GoldenLayout stack to open the component in\n * @param {Config} config The component config definition to open\n * @param {Boolean} replaceExisting Whether it should replace the existing one matching component type and id, or open a new one\n */\n static openComponentInStack(stack, config, replaceExisting = true) {\n const maintainFocusElement = document.activeElement; // attempt to retain focus after dom manipulation, which can break focus\n\n const searchConfig = {\n id: config.id,\n component: config.component,\n };\n\n const oldContentItem = LayoutUtils.getContentItemInStack(\n stack,\n searchConfig\n );\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 (maintainFocusElement) maintainFocusElement.focus();\n }\n\n /**\n * Close the specified component and remove it from the stack it's currently in\n * @param {ContentItem} root The GoldenLayout root to search and close the component in\n * @param {Config} config The GoldenLayout component config definition to close, eg. { component: 'IrisGridPanel', id: 'table-t' }\n */\n static closeComponent(root, config) {\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.isComponent) {\n oldContentItem.container.close();\n } else {\n stack.removeChild(oldContentItem);\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 (maintainFocusElement && document.contains(maintainFocusElement)) {\n maintainFocusElement.focus();\n }\n }\n\n static renameComponent(root, config, newTitle) {\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 contentItem.setTitle(newTitle);\n }\n\n /**\n * Create a component clone based on the given config\n * @param {ContentItem} root The GoldenLayout root to clone the component in\n * @param {Config} config The config to clone\n * @returns {Config} Clone config\n */\n static cloneComponent(root, config) {\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 panelState = LayoutUtils.getPanelComponentState(config);\n const cloneConfig = {\n type: 'react-component',\n component: config.component,\n props: {\n ...config.props,\n panelState,\n },\n title: `${config.title} Copy`,\n id: shortid.generate(),\n };\n LayoutUtils.openComponentInStack(stack, cloneConfig);\n return cloneConfig;\n }\n\n /**\n * Get panel component state for the given config\n * @param {Object} config Panel config\n * @returns {Object} Panel state\n */\n static getPanelComponentState(config) {\n return (\n // Fallback to props.panelState for uninitialized panels\n config.componentState?.panelState ?? config.props?.panelState ?? null\n );\n }\n\n static makeDefaultLayout() {\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 };\n }\n\n /**\n * Gets a containers root node\n * @param {GlContainer} container The Golden Layout container to get the root for\n */\n static getRootFromContainer(container) {\n return container.layoutManager.root;\n }\n\n /**\n * Gets the config for the panel component given a glContainer\n * @param {GlContainer} container The Golden Layout container to get the config for\n */\n static getComponentConfigFromContainer(container) {\n if (container) {\n if (container.tab && container.tab.contentItem) {\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 no-underscore-dangle\n return container._config;\n }\n\n return null;\n }\n\n static getTitleFromContainer(container) {\n if (container && container.tab && container.tab.contentItem) {\n return container.tab.contentItem.config.title;\n }\n return null;\n }\n\n static getTitleFromTab(tab) {\n if (tab && tab.contentItem) {\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} glContainer The container to get the panel ID for\n * @returns {string|null} Panel ID\n */\n static getIdFromContainer(glContainer) {\n const config = LayoutUtils.getComponentConfigFromContainer(glContainer);\n if (config) {\n return config.id;\n }\n return null;\n }\n\n /**\n * Retrieve the ID of the panel provided\n * @param {Component} panel The panel to get the ID for\n * @returns {string|null} Panel ID\n */\n static getIdFromPanel(panel) {\n const { glContainer } = panel.props;\n return LayoutUtils.getIdFromContainer(glContainer);\n }\n\n /**\n * Get component name from the panel instance\n * @param {Component} panel Panel to get component name for\n * @returns {string} Component name or null if unable to retrieve name\n */\n static getComponentNameFromPanel(panel) {\n const { glContainer } = panel.props;\n const config = LayoutUtils.getComponentConfigFromContainer(glContainer);\n return config?.component ?? null;\n }\n\n /**\n * Get component name for wrapped and un-wrapped components\n * @param {Component} component Component to get name for\n * @returns {string} Component name\n * @throws If displayName for the component is not defined\n */\n static getComponentName(component) {\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 {DOMElement} element The element to put focus in.\n * @param {String} selector The first element matching this selector will be focused.\n * @returns {DOMElement} The element that was focused, null if not focused\n */\n static focusElement(element, selector = LayoutUtils.DEFAULT_FOCUS_SELECTOR) {\n if (element == null) {\n return null;\n }\n const focusElement = element.querySelector(selector);\n if (focusElement == null) {\n return null;\n }\n\n focusElement.focus();\n return focusElement;\n }\n\n /**\n * Get a promise that initializes when layout is initialized\n * @param {GoldenLayout} layout The layout to await initialization on\n * @returns Promise that resolves when layout is initialized\n */\n static onInitialized(layout) {\n return new Promise(resolve => {\n if (layout.isInitialised) {\n resolve();\n return;\n }\n const onInit = () => {\n layout.off('initialised', onInit);\n resolve();\n };\n layout.on('initialised', onInit);\n });\n }\n}\n\nexport default LayoutUtils;\n"],"file":"LayoutUtils.js"}
@@ -1,5 +1,5 @@
1
- export function getAllDashboardsData(store: any): any;
2
- export function getDashboardData(store: any, dashboardId: string): any;
3
- export function getClosedPanelsForDashboard(store: any, dashboardId: string): any;
4
- export function getOpenedPanelMapForDashboard(store: any, dashboardId: string): any;
1
+ export function getAllDashboardsData(store: Store): any;
2
+ export function getDashboardData(store: Store, dashboardId: string): any;
3
+ export function getClosedPanelsForDashboard(store: Store, dashboardId: string): ClosedPanels;
4
+ export function getOpenedPanelMapForDashboard(store: Store, dashboardId: string): OpenedPanelMap;
5
5
  //# sourceMappingURL=selectors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../src/redux/selectors.js"],"names":[],"mappings":"AAWO,sDAAyD;AAOzD,0DAHI,MAAM,OAIyC;AAOnD,qEAHI,MAAM,OAI2C;AAOrD,uEAHI,MAAM,OAI4C"}
1
+ {"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../src/redux/selectors.js"],"names":[],"mappings":"AAWO,wDAAyD;AAOzD,4DAHI,MAAM,OAIyC;AAOnD,uEAHI,MAAM,gBAI2C;AAOrD,yEAHI,MAAM,kBAI4C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deephaven/dashboard",
3
- "version": "0.8.2-beta.6+b82791e",
3
+ "version": "0.9.1-beta.5+675913b",
4
4
  "description": "Deephaven Dashboard",
5
5
  "author": "Deephaven Data Labs LLC",
6
6
  "license": "Apache-2.0",
@@ -34,10 +34,11 @@
34
34
  "start": "cross-env NODE_ENV=development npm run watch"
35
35
  },
36
36
  "dependencies": {
37
- "@deephaven/golden-layout": "^0.8.2-beta.6+b82791e",
38
- "@deephaven/react-hooks": "^0.8.2-beta.6+b82791e",
37
+ "@deephaven/golden-layout": "^0.9.1-beta.5+675913b",
38
+ "@deephaven/react-hooks": "^0.9.1-beta.5+675913b",
39
39
  "deep-equal": "^2.0.4",
40
40
  "jquery": "^3.5.1",
41
+ "lodash.ismatch": "^4.1.1",
41
42
  "lodash.throttle": "^4.1.1",
42
43
  "prop-types": "^15.7.2",
43
44
  "shortid": "^2.2.15"
@@ -52,11 +53,11 @@
52
53
  },
53
54
  "devDependencies": {
54
55
  "@babel/cli": "^7.16.0",
55
- "@deephaven/components": "^0.8.2-beta.6+b82791e",
56
- "@deephaven/log": "^0.8.2-beta.6+b82791e",
57
- "@deephaven/mocks": "^0.8.2-beta.6+b82791e",
58
- "@deephaven/redux": "^0.8.2-beta.6+b82791e",
59
- "@deephaven/tsconfig": "^0.8.2-beta.6+b82791e",
56
+ "@deephaven/components": "^0.9.1-beta.5+675913b",
57
+ "@deephaven/log": "^0.9.1-beta.5+675913b",
58
+ "@deephaven/mocks": "^0.9.1-beta.5+675913b",
59
+ "@deephaven/redux": "^0.9.1-beta.5+675913b",
60
+ "@deephaven/tsconfig": "^0.9.1-beta.5+675913b",
60
61
  "@storybook/addon-actions": "^6.2.3",
61
62
  "@storybook/addon-essentials": "^6.2.3",
62
63
  "@storybook/addon-links": "^6.2.3",
@@ -69,8 +70,7 @@
69
70
  "react-dom": "^16.14.0",
70
71
  "react-redux": "^7.2.4",
71
72
  "rimraf": "^3.0.2",
72
- "sass": "1.32.13",
73
- "typescript": "~4.3.2"
73
+ "sass": "1.32.13"
74
74
  },
75
75
  "files": [
76
76
  "dist"
@@ -78,5 +78,5 @@
78
78
  "publishConfig": {
79
79
  "access": "public"
80
80
  },
81
- "gitHead": "b82791e64062d6563c924b448e788878222df2ef"
81
+ "gitHead": "675913bbbdbadb2eae76b3732f457b8ec7be4a90"
82
82
  }