Web Components Dock Manager のカスタマイズ
Infragistics Web Components Dock Manager コンポーネントは、特定のアプリケーション要件に合わせてレイアウトをさらにカスタマイズするために必要なプロパティを提供します。 Web Components DockManager がどのようにして優れたユーザー インターフェイスを作成し、アプリケーションの生産性を向上させることができるのかを詳しく見ていきましょう。
Proximity Dock (近接ドック)
このモードでは、ジョイスティック インジケーターが非表示になり、ペインを別のペインの境界近くにドラッグすることでドッキングを実行できます。ペインのドラッグ中にマウス カーソルがドック位置に対応する領域に到達すると、ドック プレビューが表示されます。マウスを上に置くと、ドラッグされたペインがプレビューされた場所にドッキングされます。近接ドッキングを有効にするには、proximityDock
プロパティを true に設定するだけです。
this.dockManager.proximityDock = true;
ts
内側ドッキング
ドラッグしたペイン 1 をペイン 2 に右ドッキングするには、カーソルがペイン 2 の右境界線と左にオフセットされた右境界線によって定義される領域内にある必要があります。オフセット距離は近接ドックしきい値として指定され、50px の値に設定されます。スプリッターがある場合は、スプリッターの両側からドッキングできます。
外側ドッキング
外側ドックを実行するには、まず特定の基準を満たす必要があります。Dock Manager では、外側のドッキングはドキュメント ホスト内でのみ許可されます。つまり、ターゲット ペインをドキュメント ホストの外側の領域にドッキングすることになります。
近接ドックのしきい値の 50 ピクセルは変更されず、これは基本的に、このシナリオでは内側ドッキングに使用できるのは 25 ピクセルの領域のみであることを意味します。オフセット距離は近接ドックの外側しきい値として指定され、明示的に 25 ピクセルの値に設定されます。近接ドックのしきい値の 50 ピクセルは変更されず、これは基本的に、このシナリオでは内側ドッキングに使用できるのは 25 ピクセルの領域のみであることを意味します。ドキュメント ホスト内にスプリッターがある場合は、スプリッターの両側から外側ドックを実行できます。
注: 近接ドックが有効になっている場合、ユーザーは 1 つのペインから左右および上下の位置の両方に対して外側ドックを実行できません。たとえば、間にスプリッターを備えた 2 つの分割ペインがあるシナリオでは、ドラッグされたペインが左側の分割ペインの上にある場合、ユーザーは外側の左側のドックのみを実行でき、その逆も同様です。
以下のサンプルをご覧ください:
import './DockManagerStyles.css'
import { defineCustomElements } from 'igniteui-dockmanager/loader';
import {
IgcDockManagerPaneType,
IgcSplitPane,
IgcSplitPaneOrientation,
IgcDockManagerComponent
} from 'igniteui-dockmanager';
defineCustomElements();
export class DockManagerProximityDock {
private dockManager: IgcDockManagerComponent;
private docHostRootPane: IgcSplitPane = {
type: IgcDockManagerPaneType.splitPane,
orientation: IgcSplitPaneOrientation.horizontal,
allowEmpty: true,
panes: [
{
type: IgcDockManagerPaneType.tabGroupPane,
panes: [
{
type: IgcDockManagerPaneType.contentPane,
header: 'Document 1',
contentId: 'content3'
},
{
type: IgcDockManagerPaneType.contentPane,
header: 'Document 2',
contentId: 'content4'
}
]
}
]
};
constructor() {
this.dockManager = document.getElementById('dockManager') as IgcDockManagerComponent;
this.dockManager.dir = 'ltr';
this.dockManager.proximityDock = true;
this.dockManager.layout = {
rootPane: {
type: IgcDockManagerPaneType.splitPane,
orientation: IgcSplitPaneOrientation.horizontal,
panes: [
{
type: IgcDockManagerPaneType.splitPane,
orientation: IgcSplitPaneOrientation.vertical,
panes: [
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content1',
header: 'Content Pane 1'
},
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content2',
header: 'Unpinned Pane 1',
isPinned: false
}
]
},
{
type: IgcDockManagerPaneType.splitPane,
orientation: IgcSplitPaneOrientation.vertical,
size: 200,
panes: [
{
type: IgcDockManagerPaneType.documentHost,
size: 200,
rootPane: this.docHostRootPane
},
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content5',
header: 'Unpinned Pane 2',
isPinned: false
}
]
},
{
type: IgcDockManagerPaneType.splitPane,
orientation: IgcSplitPaneOrientation.vertical,
panes: [
{
type: IgcDockManagerPaneType.tabGroupPane,
size: 200,
panes: [
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content6',
header: 'Tab 1'
},
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content7',
header: 'Tab 2'
},
]
},
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content8',
header: 'Content Pane 2'
}
]
}
]
},
floatingPanes: [
{
type: IgcDockManagerPaneType.splitPane,
orientation: IgcSplitPaneOrientation.horizontal,
floatingHeight: 150,
floatingWidth: 250,
floatingLocation: { x: 300, y: 200 },
panes: [
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content9',
header: 'Floating Pane 1'
},
]
},
{
type: IgcDockManagerPaneType.splitPane,
orientation: IgcSplitPaneOrientation.horizontal,
floatingLocation: { x: 250, y: 200 },
floatingWidth: 250,
floatingHeight: 150,
panes: [
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content10',
header: 'Floating Pane 2'
}
],
},
]
};
}
}
new DockManagerProximityDock();
ts<!DOCTYPE html>
<html>
<head>
<title>DockManagerProximityDock</title>
<meta charset="UTF-8" />
<link rel="shortcut icon" href="https://static.infragistics.com/xplatform/images/browsers/wc.png" >
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Kanit&display=swap" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Titillium Web" />
<link rel="stylesheet" href="https://static.infragistics.com/xplatform/css/samples/shared.v8.css" type="text/css" />
</head>
<body>
<div id="root">
<div class="container sample">
<igc-dockmanager id="dockManager">
<div slot="content1">Content 1</div>
<div slot="content2">Content 2</div>
<div slot="content3">Content 3</div>
<div slot="content4">Content 4</div>
<div slot="content5">Content 5</div>
<div slot="content6">Content 6</div>
<div slot="content7">Content 7</div>
<div slot="content8">Content 8</div>
<div slot="content9">Content 9</div>
<div slot="content10">Content 10</div>
</igc-dockmanager>
</div>
</div>
<!-- This script is needed only for parcel and it will be excluded for webpack -->
<% if (false) { %><script src="src/index.ts"></script><% } %>
</body>
</html>
html
igc-dockmanager > div {
padding: 0.5rem;
height: calc(100% - 1rem);
width: calc(100% - 1rem);
display: flex;
flex-direction: column;
/* background: orange; */
}
css/* shared styles are loaded from: */
/* https://static.infragistics.com/xplatform/css/samples */
css
このサンプルが気に入りましたか? 完全な Ignite UI for Web Componentsツールキットにアクセスして、すばやく独自のアプリの作成を開始します。無料でダウンロードできます。
プログラムによるペインのフォーカス
focusPane
メソッドを使用すると、目的のペインの contentId
を指定することで、レイアウト内の特定のペインに動的かつプログラム的にフォーカスすることができます。
this.dockManager.focusPane('content1');
ts
focusPane
メソッドを使用する場合、対象のペインの状態に応じて動作が異なります。その仕組みは次のとおりです:
フローティング ペイン: ペインがフローティングしている場合、
focusPane
を呼び出すとそのペインがフォーカスされ、アクティブ ペインとして設定され、他のフローティング ペインの上に表示されるようになります。ピン固定されていないペイン: ターゲットのペインのピン固定が解除されると、
focusPane
はペインを開いた状態にポップアップします。通常のピン固定ペイン: 通常のピン固定ペインの場合、
focusPane
はペインをactivePane
として設定します。
この方法を利用すると、開発者はユーザーの操作やアプリケーション イベントに基づいてペインの表示と位置を簡単に制御できます。
以下のサンプルをご覧ください:
import './DockManagerStyles.css'
import { defineCustomElements } from 'igniteui-dockmanager/loader';
import {
IgcDockManagerPaneType,
IgcSplitPane,
IgcSplitPaneOrientation,
IgcDockManagerComponent
} from 'igniteui-dockmanager';
defineCustomElements();
export class DockManagerAddContentRuntime {
private dockManager: IgcDockManagerComponent;
private docHostRootPane: IgcSplitPane = {
type: IgcDockManagerPaneType.splitPane,
orientation: IgcSplitPaneOrientation.horizontal,
allowEmpty: true,
panes: [
{
type: IgcDockManagerPaneType.tabGroupPane,
panes: [
{
type: IgcDockManagerPaneType.contentPane,
header: 'Document 1',
contentId: 'content3'
},
{
type: IgcDockManagerPaneType.contentPane,
header: 'Document 2',
contentId: 'content4'
}
]
}
]
};
constructor() {
this.dockManager = document.getElementById('dockManager') as IgcDockManagerComponent;
const focusFloatingPaneBtn = document.getElementById('focusFloating');
const focusUnpinnedPaneBtn = document.getElementById('focusUnpinned');
const focusRegularPaneBtn = document.getElementById('focusRegular');
this.dockManager.layout = {
rootPane: {
type: IgcDockManagerPaneType.splitPane,
orientation: IgcSplitPaneOrientation.horizontal,
panes: [
{
type: IgcDockManagerPaneType.splitPane,
orientation: IgcSplitPaneOrientation.vertical,
panes: [
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content1',
header: 'Content Pane 1'
},
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content2',
header: 'Unpinned Pane 1',
isPinned: false
}
]
},
{
type: IgcDockManagerPaneType.splitPane,
orientation: IgcSplitPaneOrientation.vertical,
size: 200,
panes: [
{
type: IgcDockManagerPaneType.documentHost,
size: 200,
rootPane: this.docHostRootPane
},
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content5',
header: 'Unpinned Pane 2',
isPinned: false
}
]
},
{
type: IgcDockManagerPaneType.splitPane,
orientation: IgcSplitPaneOrientation.vertical,
panes: [
{
type: IgcDockManagerPaneType.tabGroupPane,
size: 200,
panes: [
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content6',
header: 'Tab 1'
},
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content7',
header: 'Tab 2'
},
]
},
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content8',
header: 'Content Pane 2'
}
]
}
]
},
floatingPanes: [
{
type: IgcDockManagerPaneType.splitPane,
orientation: IgcSplitPaneOrientation.horizontal,
floatingHeight: 150,
floatingWidth: 250,
floatingLocation: { x: 300, y: 200 },
panes: [
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content9',
header: 'Floating Pane 1'
},
]
},
{
type: IgcDockManagerPaneType.splitPane,
orientation: IgcSplitPaneOrientation.horizontal,
floatingLocation: { x: 250, y: 200 },
floatingWidth: 250,
floatingHeight: 150,
panes: [
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content10',
header: 'Floating Pane 2'
}
],
},
]
};
focusFloatingPaneBtn!.addEventListener('click', () => {
this.dockManager.focusPane('content9');
})
focusUnpinnedPaneBtn!.addEventListener('click', () => {
this.dockManager.focusPane('content2');
})
focusRegularPaneBtn!.addEventListener('click', () => {
this.dockManager.focusPane('content1');
})
}
}
new DockManagerAddContentRuntime();
ts<!DOCTYPE html>
<html>
<head>
<title>DockManagerFocusPaneProgrammatically</title>
<meta charset="UTF-8" />
<link rel="shortcut icon" href="https://static.infragistics.com/xplatform/images/browsers/wc.png" >
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Kanit&display=swap" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Titillium Web" />
<link rel="stylesheet" href="https://static.infragistics.com/xplatform/css/samples/shared.v8.css" type="text/css" />
</head>
<body>
<div id="root">
<div class="container sample">
<div class="options horizontal">
<button id="focusFloating">Focus Floating Pane</button>
<button id="focusUnpinned">Focus Unpinned Pane</button>
<button id="focusRegular">Focus pinned pane</button>
</div>
<igc-dockmanager id="dockManager">
<div slot="content1">Content 1</div>
<div slot="content2">Content 2</div>
<div slot="content3">Content 3</div>
<div slot="content4">Content 4</div>
<div slot="content5">Content 5</div>
<div slot="content6">Content 6</div>
<div slot="content7">Content 7</div>
<div slot="content8">Content 8</div>
<div slot="content9">Content 9</div>
<div slot="content10">Content 10</div>
</igc-dockmanager>
</div>
</div>
<!-- This script is needed only for parcel and it will be excluded for webpack -->
<% if (false) { %><script src="src/index.ts"></script><% } %>
</body>
</html>
html
igc-dockmanager > div {
padding: 0.5rem;
height: calc(100% - 1rem);
width: calc(100% - 1rem);
display: flex;
flex-direction: column;
/* background: orange; */
}
css/* shared styles are loaded from: */
/* https://static.infragistics.com/xplatform/css/samples */
css
ペイン ヘッダーを自動非表示にする
DockManager の showPaneHeaders
プロパティを使用すると、開発者は layout
内のペイン ヘッダーの表示を柔軟に制御できるようになりました。デフォルトでは、showPaneHeaders
は always
に設定されており、ペイン ヘッダーが常に表示されます。onHoverOnly
に設定すると、コンテンツ ペインの上端にマウスを置くまで、すべてのペイン ヘッダーが非表示になります。対応するペインのヘッダーが表示され、マウスが離れるとスムーズに非表示になります。以下の例を参照してください:
import './DockManagerStyles.css'
import { defineCustomElements } from 'igniteui-dockmanager/loader';
import {
IgcDockManagerPaneType,
IgcSplitPane,
IgcSplitPaneOrientation,
IgcDockManagerComponent
} from 'igniteui-dockmanager';
defineCustomElements();
export class DockManagerHidePaneHeaders {
private dockManager: IgcDockManagerComponent;
private docHostRootPane: IgcSplitPane = {
type: IgcDockManagerPaneType.splitPane,
orientation: IgcSplitPaneOrientation.horizontal,
allowEmpty: true,
panes: [
{
type: IgcDockManagerPaneType.tabGroupPane,
panes: [
{
type: IgcDockManagerPaneType.contentPane,
header: 'Document 1',
contentId: 'content3'
},
{
type: IgcDockManagerPaneType.contentPane,
header: 'Document 2',
contentId: 'content4'
}
]
}
]
};
constructor() {
this.dockManager = document.getElementById('dockManager') as IgcDockManagerComponent;
this.dockManager.showPaneHeaders = 'onHoverOnly';
this.dockManager.layout = {
rootPane: {
type: IgcDockManagerPaneType.splitPane,
orientation: IgcSplitPaneOrientation.horizontal,
panes: [
{
type: IgcDockManagerPaneType.splitPane,
orientation: IgcSplitPaneOrientation.vertical,
panes: [
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content1',
header: 'Content Pane 1'
},
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content2',
header: 'Unpinned Pane 1',
isPinned: false
}
]
},
{
type: IgcDockManagerPaneType.splitPane,
orientation: IgcSplitPaneOrientation.vertical,
size: 200,
panes: [
{
type: IgcDockManagerPaneType.documentHost,
size: 200,
rootPane: this.docHostRootPane
},
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content5',
header: 'Unpinned Pane 2',
isPinned: false
}
]
},
{
type: IgcDockManagerPaneType.splitPane,
orientation: IgcSplitPaneOrientation.vertical,
panes: [
{
type: IgcDockManagerPaneType.tabGroupPane,
size: 200,
panes: [
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content6',
header: 'Tab 1'
},
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content7',
header: 'Tab 2'
},
]
},
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content8',
header: 'Content Pane 2'
}
]
}
]
},
floatingPanes: [
{
type: IgcDockManagerPaneType.splitPane,
orientation: IgcSplitPaneOrientation.horizontal,
floatingHeight: 150,
floatingWidth: 250,
floatingLocation: { x: 300, y: 200 },
panes: [
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content9',
header: 'Floating Pane 1'
},
]
},
{
type: IgcDockManagerPaneType.splitPane,
orientation: IgcSplitPaneOrientation.horizontal,
floatingLocation: { x: 650, y: 160 },
floatingWidth: 250,
floatingHeight: 150,
panes: [
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content10',
header: 'Floating Pane 2'
}
],
},
]
};
}
}
new DockManagerHidePaneHeaders();
ts<!DOCTYPE html>
<html>
<head>
<title>DockManagerHidePaneHeaders</title>
<meta charset="UTF-8" />
<link rel="shortcut icon" href="https://static.infragistics.com/xplatform/images/browsers/wc.png" >
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Kanit&display=swap" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Titillium Web" />
<link rel="stylesheet" href="https://static.infragistics.com/xplatform/css/samples/shared.v8.css" type="text/css" />
</head>
<body>
<div id="root">
<div class="container sample">
<igc-dockmanager id="dockManager">
<div slot="content1">Content 1</div>
<div slot="content2">Content 2</div>
<div slot="content3">Content 3</div>
<div slot="content4">Content 4</div>
<div slot="content5">Content 5</div>
<div slot="content6">Content 6</div>
<div slot="content7">Content 7</div>
<div slot="content8">Content 8</div>
<div slot="content9">Content 9</div>
<div slot="content10">Content 10</div>
</igc-dockmanager>
</div>
</div>
<!-- This script is needed only for parcel and it will be excluded for webpack -->
<% if (false) { %><script src="src/index.ts"></script><% } %>
</body>
</html>
html
igc-dockmanager > div {
padding: 0.5rem;
height: calc(100% - 1rem);
width: calc(100% - 1rem);
display: flex;
flex-direction: column;
/* background: orange; */
}
css/* shared styles are loaded from: */
/* https://static.infragistics.com/xplatform/css/samples */
css
内側ドッキングの制御
デフォルトでは、Dock Manager を使用すると、ユーザーはペインを簡単にドラッグして相互にドッキングし、タブを作成できます。この機能をより詳細に制御するために、allowInnerDock
と acceptsInnerDock
という 2 つのプロパティを導入しました。
IgcContentPane
の acceptsInnerDock
プロパティを設定することで、開発者は特定のコンテンツ ペイン内のドッキングを制御できます。このプロパティを false に設定すると、ユーザーは指定されたペインで内側ドッキングを実行できなくなります。
{
type: IgcDockManagerPaneType.contentPane,
header: 'Floating 1',
contentId: 'content3',
acceptsInnerDock: false
}
ts
DockManager 全体で内側ドッキングを無効にしたい場合は、allowInnerDock
を false に設定するだけです。このプロパティは、エンド ユーザーがドック ペインの内側にアクセスできるかどうかを決定します。
this.dockManager.allowInnerDock = false;
ts
import './DockManagerStyles.css'
import { defineCustomElements } from 'igniteui-dockmanager/loader';
import {
IgcDockManagerPaneType,
IgcSplitPane,
IgcSplitPaneOrientation,
IgcDockManagerComponent
} from 'igniteui-dockmanager';
defineCustomElements();
export class DockManagerToggleInnerDock {
private dockManager: IgcDockManagerComponent;
private docHostRootPane: IgcSplitPane = {
type: IgcDockManagerPaneType.splitPane,
orientation: IgcSplitPaneOrientation.horizontal,
allowEmpty: true,
panes: [
{
type: IgcDockManagerPaneType.tabGroupPane,
panes: [
{
type: IgcDockManagerPaneType.contentPane,
header: 'Document 1',
contentId: 'content3'
},
{
type: IgcDockManagerPaneType.contentPane,
header: 'Document 2',
contentId: 'content4'
}
]
}
]
};
constructor() {
this.dockManager = document.getElementById('dockManager') as IgcDockManagerComponent;
const innerDockBtn = document.getElementById('innerDock');
this.dockManager.layout = {
rootPane: {
type: IgcDockManagerPaneType.splitPane,
orientation: IgcSplitPaneOrientation.horizontal,
panes: [
{
type: IgcDockManagerPaneType.splitPane,
orientation: IgcSplitPaneOrientation.vertical,
panes: [
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content1',
header: 'Content Pane 1'
},
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content2',
header: 'Unpinned Pane 1',
isPinned: false
}
]
},
{
type: IgcDockManagerPaneType.splitPane,
orientation: IgcSplitPaneOrientation.vertical,
size: 200,
panes: [
{
type: IgcDockManagerPaneType.documentHost,
size: 200,
rootPane: this.docHostRootPane
},
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content5',
header: 'Unpinned Pane 2',
isPinned: false
}
]
},
{
type: IgcDockManagerPaneType.splitPane,
orientation: IgcSplitPaneOrientation.vertical,
panes: [
{
type: IgcDockManagerPaneType.tabGroupPane,
size: 200,
panes: [
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content6',
header: 'Tab 1'
},
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content7',
header: 'Tab 2'
},
]
},
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content8',
header: 'Content Pane 2'
}
]
}
]
},
floatingPanes: [
{
type: IgcDockManagerPaneType.splitPane,
orientation: IgcSplitPaneOrientation.horizontal,
floatingHeight: 150,
floatingWidth: 250,
floatingLocation: { x: 300, y: 200 },
panes: [
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content9',
header: 'Floating Pane 1'
},
]
},
{
type: IgcDockManagerPaneType.splitPane,
orientation: IgcSplitPaneOrientation.horizontal,
floatingLocation: { x: 650, y: 160 },
floatingWidth: 250,
floatingHeight: 150,
panes: [
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content10',
header: 'Floating Pane 2'
}
],
},
]
};
innerDockBtn!.addEventListener('click', () => {
this.dockManager.allowInnerDock = !this.dockManager.allowInnerDock;
})
}
}
new DockManagerToggleInnerDock();
ts<!DOCTYPE html>
<html>
<head>
<title>DockManagerToggleInnerDock</title>
<meta charset="UTF-8" />
<link rel="shortcut icon" href="https://static.infragistics.com/xplatform/images/browsers/wc.png" >
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Kanit&display=swap" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Titillium Web" />
<link rel="stylesheet" href="https://static.infragistics.com/xplatform/css/samples/shared.v8.css" type="text/css" />
</head>
<body>
<div id="root">
<div class="container sample">
<div class="options horizontal">
<button id="innerDock">Toggle Inner Dock</button>
</div>
<igc-dockmanager id="dockManager">
<div slot="content1">Content 1</div>
<div slot="content2">Content 2</div>
<div slot="content3">Content 3</div>
<div slot="content4">Content 4</div>
<div slot="content5">Content 5</div>
<div slot="content6">Content 6</div>
<div slot="content7">Content 7</div>
<div slot="content8">Content 8</div>
<div slot="content9">Content 9</div>
<div slot="content10">Content 10</div>
</igc-dockmanager>
</div>
</div>
<!-- This script is needed only for parcel and it will be excluded for webpack -->
<% if (false) { %><script src="src/index.ts"></script><% } %>
</body>
</html>
html
igc-dockmanager > div {
padding: 0.5rem;
height: calc(100% - 1rem);
width: calc(100% - 1rem);
display: flex;
flex-direction: column;
/* background: orange; */
}
css/* shared styles are loaded from: */
/* https://static.infragistics.com/xplatform/css/samples */
css
ペイン ドラッグの制御
containedInBoundaries
プロパティを使用すると、開発者はフローティング ペインの側面を常に DockManager 内に含めるかどうかを制御できます。true に設定すると、いずれかの側が DockManager の境界を越えて移動しようとすると、ペインのドラッグが停止します。
以下の例をご覧ください。
import './DockManagerStyles.css'
import { defineCustomElements } from 'igniteui-dockmanager/loader';
import {
IgcDockManagerPaneType,
IgcSplitPane,
IgcSplitPaneOrientation,
IgcDockManagerComponent
} from 'igniteui-dockmanager';
defineCustomElements();
export class DockManagerContainedInBoundaries {
private dockManager: IgcDockManagerComponent;
private docHostRootPane: IgcSplitPane = {
type: IgcDockManagerPaneType.splitPane,
orientation: IgcSplitPaneOrientation.horizontal,
allowEmpty: true,
panes: [
{
type: IgcDockManagerPaneType.tabGroupPane,
panes: [
{
type: IgcDockManagerPaneType.contentPane,
header: 'Document 1',
contentId: 'content3'
},
{
type: IgcDockManagerPaneType.contentPane,
header: 'Document 2',
contentId: 'content4'
}
]
}
]
};
constructor() {
this.dockManager = document.getElementById('dockManager') as IgcDockManagerComponent;
const inBoundariesBtn = document.getElementById('inBoundariesBtn');
this.dockManager.layout = {
rootPane: {
type: IgcDockManagerPaneType.splitPane,
orientation: IgcSplitPaneOrientation.horizontal,
panes: [
{
type: IgcDockManagerPaneType.splitPane,
orientation: IgcSplitPaneOrientation.vertical,
panes: [
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content1',
header: 'Content Pane 1'
},
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content2',
header: 'Unpinned Pane 1',
isPinned: false
}
]
},
{
type: IgcDockManagerPaneType.splitPane,
orientation: IgcSplitPaneOrientation.vertical,
size: 200,
panes: [
{
type: IgcDockManagerPaneType.documentHost,
size: 200,
rootPane: this.docHostRootPane
},
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content5',
header: 'Unpinned Pane 2',
isPinned: false
}
]
},
{
type: IgcDockManagerPaneType.splitPane,
orientation: IgcSplitPaneOrientation.vertical,
panes: [
{
type: IgcDockManagerPaneType.tabGroupPane,
size: 200,
panes: [
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content6',
header: 'Tab 1'
},
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content7',
header: 'Tab 2'
},
]
},
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content8',
header: 'Content Pane 2'
}
]
}
]
},
floatingPanes: [
{
type: IgcDockManagerPaneType.splitPane,
orientation: IgcSplitPaneOrientation.horizontal,
floatingHeight: 150,
floatingWidth: 250,
floatingLocation: { x: 300, y: 200 },
panes: [
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content9',
header: 'Floating Pane 1'
},
]
},
{
type: IgcDockManagerPaneType.splitPane,
orientation: IgcSplitPaneOrientation.horizontal,
floatingLocation: { x: 650, y: 160 },
floatingWidth: 250,
floatingHeight: 150,
panes: [
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content10',
header: 'Floating Pane 2'
}
],
},
]
};
inBoundariesBtn!.addEventListener('click', () => {
this.dockManager.containedInBoundaries = !this.dockManager.containedInBoundaries;
})
}
}
new DockManagerContainedInBoundaries();
ts<!DOCTYPE html>
<html>
<head>
<title>DockManagerContainedInBoundaries</title>
<meta charset="UTF-8" />
<link rel="shortcut icon" href="https://static.infragistics.com/xplatform/images/browsers/wc.png" >
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Kanit&display=swap" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Titillium Web" />
<link rel="stylesheet" href="https://static.infragistics.com/xplatform/css/samples/shared.v8.css" type="text/css" />
</head>
<body>
<div id="root">
<div class="container sample">
<div class="options horizontal">
<button id="inBoundariesBtn">Toggle In Boundaries</button>
</div>
<igc-dockmanager id="dockManager">
<div slot="content1">Content 1</div>
<div slot="content2">Content 2</div>
<div slot="content3">Content 3</div>
<div slot="content4">Content 4</div>
<div slot="content5">Content 5</div>
<div slot="content6">Content 6</div>
<div slot="content7">Content 7</div>
<div slot="content8">Content 8</div>
<div slot="content9">Content 9</div>
<div slot="content10">Content 10</div>
</igc-dockmanager>
</div>
</div>
<!-- This script is needed only for parcel and it will be excluded for webpack -->
<% if (false) { %><script src="src/index.ts"></script><% } %>
</body>
</html>
html
igc-dockmanager > div {
padding: 0.5rem;
height: calc(100% - 1rem);
width: calc(100% - 1rem);
display: flex;
flex-direction: column;
/* background: orange; */
}
css/* shared styles are loaded from: */
/* https://static.infragistics.com/xplatform/css/samples */
css
分割ペインの固定サイズ モード
ペインのサイズはその兄弟ペインのサイズに相対し、デフォルトは 100 です。2 つの兄弟ペインがあり、最初のペインのサイズが 400 に設定され、2 番目のペインのサイズが 200 に設定されている場合、最初のペインは 2 番目のペインの 2 倍のサイズになり、これら 2 つのペインが使用可能なスペースをすべて埋めてしまいます。
特定のペインのサイズをピクセル単位で指定する場合は、使用可能なすべてのスペースの相対的な配分に依存するのではなく、親の分割ペインの useFixedSize
を設定する必要があります。このプロパティが true に設定されている場合、すべての子のサイズは、size
プロパティに基づいてピクセル単位で設定されます。この変更により、最初のペインは 400 ピクセルに広がり、2 番目のペインは 200 ピクセルに広がります。スプリッターを使用してさらにサイズを変更すると、現在のコンテンツ ペインのサイズのみが変更され、兄弟ペインのサイズには影響しません。子ペインのサイズの合計が親ペインのサイズを超えると、スクロールバーが表示され、親の分割ペインをスクロールできるようになります。
const splitPaneRelativeSize: IgcSplitPane = {
type: IgcDockManagerPaneType.splitPane,
orientation: IgcSplitPaneOrientation.horizontal,
panes: [
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content1',
header: 'Pane 1',
size: 400 // Size will be relative to siblings
},
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content2',
header: 'Pane 2',
size: 200 // Size will be relative to siblings
}
]
}
const splitPaneFixedSize: IgcSplitPane = {
type: IgcDockManagerPaneType.splitPane,
orientation: IgcSplitPaneOrientation.horizontal,
useFixedSize: true,
panes: [
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content3',
header: 'Pane 3',
size: 400 // Size will be applied in pixels
},
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content4',
header: 'Pane 4',
size: 200 // Size will be applied in pixels
}
]
}
ts
useFixedSize
が true に設定されている分割ペイン内にペインをドッキングすると、ドッキングされたペインの幅/高さは (分割ペインの方向に応じて) フローティング ペインと同じになることに注意してください。
以下のサンプルをご覧ください:
import './DockManagerStyles.css'
import { defineCustomElements } from 'igniteui-dockmanager/loader';
import {
IgcDockManagerPaneType,
IgcSplitPaneOrientation,
IgcDockManagerComponent
} from 'igniteui-dockmanager';
defineCustomElements();
export class DockManagerSplitPaneFixedSize {
private dockManager: IgcDockManagerComponent;
constructor() {
this.dockManager = document.getElementById('dockManager') as IgcDockManagerComponent;
this.dockManager.dir = 'ltr';
this.dockManager.layout = {
rootPane: {
type: IgcDockManagerPaneType.splitPane,
orientation: IgcSplitPaneOrientation.vertical,
useFixedSize: true,
panes: [
{
type: IgcDockManagerPaneType.splitPane,
orientation: IgcSplitPaneOrientation.horizontal,
size: 300, // Size will be applied in pixels
panes: [
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content1',
header: 'Pane 1',
size: 400 // Size will be relative to siblings
},
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content2',
header: 'Pane 2',
size: 200 // Size will be relative to siblings
}
]
},
{
type: IgcDockManagerPaneType.splitPane,
orientation: IgcSplitPaneOrientation.horizontal,
size: 200, // Size will be applied in pixels
useFixedSize: true,
panes: [
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content3',
header: 'Pane 3',
size: 400 // Size will be applied in pixels
},
{
type: IgcDockManagerPaneType.contentPane,
contentId: 'content4',
header: 'Pane 4',
size: 200 // Size will be applied in pixels
}
]
}
]
},
floatingPanes: [
{
type: IgcDockManagerPaneType.splitPane,
orientation: IgcSplitPaneOrientation.horizontal,
floatingLocation: { x: 250, y: 100 },
floatingWidth: 250,
floatingHeight: 150,
panes: [
{
type: IgcDockManagerPaneType.contentPane,
contentId: "content5",
header: "Pane 5"
}
]
}
]
};
}
}
new DockManagerSplitPaneFixedSize();
ts<!DOCTYPE html>
<html>
<head>
<title>DockManagerSplitPaneFixedSize</title>
<meta charset="UTF-8" />
<link rel="shortcut icon" href="https://static.infragistics.com/xplatform/images/browsers/wc.png" >
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Kanit&display=swap" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Titillium Web" />
<link rel="stylesheet" href="https://static.infragistics.com/xplatform/css/samples/shared.v8.css" type="text/css" />
</head>
<body>
<div id="root">
<div class="container sample">
<igc-dockmanager id="dockManager">
<div slot="content1">Relative size: 400</div>
<div slot="content2">Relative size: 200</div>
<div slot="content3">Fixed size: 400 px</div>
<div slot="content4">Fixed size: 200 px</div>
<div slot="content5">Floating pane</div>
</igc-dockmanager>
</div>
</div>
<!-- This script is needed only for parcel and it will be excluded for webpack -->
<% if (false) { %><script src="src/index.ts"></script><% } %>
</body>
</html>
html
igc-dockmanager > div {
padding: 0.5rem;
height: calc(100% - 1rem);
width: calc(100% - 1rem);
display: flex;
flex-direction: column;
/* background: orange; */
}
css/* shared styles are loaded from: */
/* https://static.infragistics.com/xplatform/css/samples */
css