OrganizationChart

OrganizationChartは、階層的な組織データを表す視覚化コンポーネントです。


import OrganizationChart from 'primevue/organizationchart';

OrganizationChartは、valueとしてTreeNodeインスタンスのコレクションを必要とします。

アルゼンチン
    
アルゼンチン
    
アルゼンチン
クロアチア
フランス
    
フランス
モロッコ

<OrganizationChart :value="data">
    <template #default="slotProps">
        <span>{{ slotProps.node.label }}</span>
    </template>
</OrganizationChart>

OrganizationChartNodeのtypeプロパティは、ノードにテンプレートをマッピングするために使用されます。未定義の場合は、デフォルトテンプレートが使用されます。

Argentina
アルゼンチン
    
Argentina
アルゼンチン
    
Argentina
アルゼンチン
Croatia
クロアチア
France
フランス
    
France
フランス
Morocco
モロッコ

<OrganizationChart :value="data" collapsible>
    <template #country="slotProps">
        <div class="flex flex-col items-center">
            <img :alt="slotProps.node.label" src="https://primefaces.org/cdn/primevue/images/flag/flag_placeholder.png" :class="`w-2rem flag flag-${slotProps.node.data}`" />
            <div class="mt-4 font-medium text-lg">{{ slotProps.node.label }}</div>
        </div>
    </template>
    <template #default="slotProps">
        <span>{{slotProps.node.data.label}}</span>
    </template>
</OrganizationChart>

選択は、selectionModeを「single」または「multiple」に設定し、v-modelディレクティブでselectionKeysを指定することで有効になります。特定のノードの選択は、ノードインスタンスのselectableがfalseの場合、無効にすることができます。

Amy ElsnerAmy ElsnerCEO
    
Anna FaliAnna FaliCMO
    
営業
マーケティング
Stephen ShawStephen ShawCTO
    
開発
UI/UXデザイン

<OrganizationChart v-model:selectionKeys="selection" :value="data" collapsible selectionMode="multiple">
    <template #person="slotProps">
        <div class="flex flex-col">
            <div class="flex flex-col items-center">
                <img :alt="slotProps.node.data.name" :src="slotProps.node.data.image" class="mb-4 w-12 h-12" />
                <span class="font-bold mb-2">{{ slotProps.node.data.name }}</span>
                <span>{{ slotProps.node.data.title }}</span>
            </div>
        </div>
    </template>
    <template #default="slotProps">
        <span>{{ slotProps.node.label }}</span>
    </template>
</OrganizationChart>

特定のノードのスタイル設定は、TreeNodeのstyleClassstyleオプションで構成されます。

Amy ElsnerAmy ElsnerCEO
    
Anna FaliAnna FaliCMO
    
営業
マーケティング
Stephen ShawStephen ShawCTO
    
開発
UI/UXデザイン

<OrganizationChart :value="data" collapsible>
    <template #person="slotProps">
        <div class="flex flex-col">
            <div class="flex flex-col items-center">
                <img :alt="slotProps.node.data.name" :src="slotProps.node.data.image" class="mb-4 w-12 h-12" />
                <span class="font-bold mb-2">{{ slotProps.node.data.name }}</span>
                <span>{{ slotProps.node.data.title }}</span>
            </div>
        </div>
    </template>
    <template #default="slotProps">
        <span>{{ slotProps.node.label }}</span>
    </template>
</OrganizationChart>

スクリーンリーダー

このコンポーネントは現在、テーブルベースの実装を使用しており、高度なスクリーンリーダーサポートを提供していません。今後のバージョンでは、ariaロールと属性をツリーウィジェットに合わせたネストされたリスト実装に置き換え、高度なリーダーサポートを提供する予定です。

キーボードサポート

キー機能
tabチャート内のフォーカス可能な要素間を移動します。
enterノードの展開状態を切り替えます。
spaceノードの展開状態を切り替えます。