mirror of
				https://github.com/mathuo/dockview
				synced 2025-10-31 12:18:12 +00:00 
			
		
		
		
	Merge pull request #588 from mathuo/562-dockview-framework-wrappers-vuejs-angular-javascript-etc
562 dockview framework wrappers vuejs angular javascript etc
This commit is contained in:
		
						commit
						24817976f6
					
				| @ -1418,7 +1418,7 @@ export class DockviewComponent | |||||||
| 
 | 
 | ||||||
|                 if (!referencePanel) { |                 if (!referencePanel) { | ||||||
|                     throw new Error( |                     throw new Error( | ||||||
|                         `referencePanel ${options.position.referencePanel} does not exist` |                         `referencePanel '${options.position.referencePanel}' does not exist` | ||||||
|                     ); |                     ); | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
| @ -1432,7 +1432,7 @@ export class DockviewComponent | |||||||
| 
 | 
 | ||||||
|                 if (!referenceGroup) { |                 if (!referenceGroup) { | ||||||
|                     throw new Error( |                     throw new Error( | ||||||
|                         `referencePanel ${options.position.referenceGroup} does not exist` |                         `referenceGroup '${options.position.referenceGroup}' does not exist` | ||||||
|                     ); |                     ); | ||||||
|                 } |                 } | ||||||
|             } else { |             } else { | ||||||
|  | |||||||
| @ -78,6 +78,10 @@ const colors = [ | |||||||
| ]; | ]; | ||||||
| let count = 0; | let count = 0; | ||||||
| 
 | 
 | ||||||
|  | const WatermarkComponent = () => { | ||||||
|  |     return <div>custom watermark</div>; | ||||||
|  | }; | ||||||
|  | 
 | ||||||
| const DockviewDemo = (props: { theme?: string }) => { | const DockviewDemo = (props: { theme?: string }) => { | ||||||
|     const [logLines, setLogLines] = React.useState< |     const [logLines, setLogLines] = React.useState< | ||||||
|         { text: string; timestamp?: Date; backgroundColor?: string }[] |         { text: string; timestamp?: Date; backgroundColor?: string }[] | ||||||
| @ -174,6 +178,8 @@ const DockviewDemo = (props: { theme?: string }) => { | |||||||
|         defaultConfig(event.api); |         defaultConfig(event.api); | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|  |     const [watermark, setWatermark] = React.useState<boolean>(false); | ||||||
|  | 
 | ||||||
|     return ( |     return ( | ||||||
|         <div |         <div | ||||||
|             style={{ |             style={{ | ||||||
| @ -187,7 +193,11 @@ const DockviewDemo = (props: { theme?: string }) => { | |||||||
|             }} |             }} | ||||||
|         > |         > | ||||||
|             <div> |             <div> | ||||||
|                 <GridActions api={api} /> |                 <GridActions | ||||||
|  |                     api={api} | ||||||
|  |                     toggleCustomWatermark={() => setWatermark(!watermark)} | ||||||
|  |                     hasCustomWatermark={watermark} | ||||||
|  |                 /> | ||||||
|                 {api && ( |                 {api && ( | ||||||
|                     <PanelActions |                     <PanelActions | ||||||
|                         api={api} |                         api={api} | ||||||
| @ -218,6 +228,9 @@ const DockviewDemo = (props: { theme?: string }) => { | |||||||
|                     rightHeaderActionsComponent={RightControls} |                     rightHeaderActionsComponent={RightControls} | ||||||
|                     leftHeaderActionsComponent={LeftControls} |                     leftHeaderActionsComponent={LeftControls} | ||||||
|                     prefixHeaderActionsComponent={PrefixHeaderControls} |                     prefixHeaderActionsComponent={PrefixHeaderControls} | ||||||
|  |                     watermarkComponent={ | ||||||
|  |                         watermark ? WatermarkComponent : undefined | ||||||
|  |                     } | ||||||
|                     onReady={onReady} |                     onReady={onReady} | ||||||
|                     className={props.theme || 'dockview-theme-abyss'} |                     className={props.theme || 'dockview-theme-abyss'} | ||||||
|                 /> |                 /> | ||||||
|  | |||||||
| @ -2,7 +2,11 @@ import { DockviewApi } from 'dockview'; | |||||||
| import * as React from 'react'; | import * as React from 'react'; | ||||||
| import { defaultConfig, nextId } from './defaultLayout'; | import { defaultConfig, nextId } from './defaultLayout'; | ||||||
| 
 | 
 | ||||||
| export const GridActions = (props: { api?: DockviewApi }) => { | export const GridActions = (props: { | ||||||
|  |     api?: DockviewApi; | ||||||
|  |     hasCustomWatermark: boolean; | ||||||
|  |     toggleCustomWatermark: () => void; | ||||||
|  | }) => { | ||||||
|     const onClear = () => { |     const onClear = () => { | ||||||
|         props.api?.clear(); |         props.api?.clear(); | ||||||
|     }; |     }; | ||||||
| @ -61,6 +65,18 @@ export const GridActions = (props: { api?: DockviewApi }) => { | |||||||
|             <button className="text-button" onClick={onAddGroup}> |             <button className="text-button" onClick={onAddGroup}> | ||||||
|                 Add Group |                 Add Group | ||||||
|             </button> |             </button> | ||||||
|  |             <span className="button-action"> | ||||||
|  |                 <button | ||||||
|  |                     className={ | ||||||
|  |                         props.hasCustomWatermark | ||||||
|  |                             ? 'demo-button selected' | ||||||
|  |                             : 'demo-button' | ||||||
|  |                     } | ||||||
|  |                     onClick={props.toggleCustomWatermark} | ||||||
|  |                 > | ||||||
|  |                     Use Custom Watermark | ||||||
|  |                 </button> | ||||||
|  |             </span> | ||||||
|             <button className="text-button" onClick={onClear}> |             <button className="text-button" onClick={onClear}> | ||||||
|                 Clear |                 Clear | ||||||
|             </button> |             </button> | ||||||
|  | |||||||
| @ -7,7 +7,7 @@ const PanelAction = (props: { | |||||||
|     panelId: string; |     panelId: string; | ||||||
| }) => { | }) => { | ||||||
|     const onClick = () => { |     const onClick = () => { | ||||||
|         props.api?.getPanel(props.panelId)?.focus(); |         props.api.getPanel(props.panelId)?.focus(); | ||||||
|     }; |     }; | ||||||
|     return ( |     return ( | ||||||
|         <div className="button-action"> |         <div className="button-action"> | ||||||
| @ -27,9 +27,9 @@ const PanelAction = (props: { | |||||||
|                 <button |                 <button | ||||||
|                     className="demo-icon-button" |                     className="demo-icon-button" | ||||||
|                     onClick={() => { |                     onClick={() => { | ||||||
|                         const panel = props.api?.getPanel(props.panelId); |                         const panel = props.api.getPanel(props.panelId); | ||||||
|                         if (panel) { |                         if (panel) { | ||||||
|                             props.api?.addFloatingGroup(panel); |                             props.api.addFloatingGroup(panel); | ||||||
|                         } |                         } | ||||||
|                     }} |                     }} | ||||||
|                 > |                 > | ||||||
| @ -38,9 +38,9 @@ const PanelAction = (props: { | |||||||
|                 <button |                 <button | ||||||
|                     className="demo-icon-button" |                     className="demo-icon-button" | ||||||
|                     onClick={() => { |                     onClick={() => { | ||||||
|                         const panel = props.api?.getPanel(props.panelId); |                         const panel = props.api.getPanel(props.panelId); | ||||||
|                         if (panel) { |                         if (panel) { | ||||||
|                             props.api?.addPopoutGroup(panel); |                             props.api.addPopoutGroup(panel); | ||||||
|                         } |                         } | ||||||
|                     }} |                     }} | ||||||
|                 > |                 > | ||||||
| @ -51,7 +51,7 @@ const PanelAction = (props: { | |||||||
|                 <button |                 <button | ||||||
|                     className="demo-icon-button" |                     className="demo-icon-button" | ||||||
|                     onClick={() => { |                     onClick={() => { | ||||||
|                         const panel = props.api?.getPanel(props.panelId); |                         const panel = props.api.getPanel(props.panelId); | ||||||
|                         panel?.api.close(); |                         panel?.api.close(); | ||||||
|                     }} |                     }} | ||||||
|                 > |                 > | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user