From 1d6377119dc7f0b3f02d41314775315347f3373a Mon Sep 17 00:00:00 2001 From: mertsincan Date: Wed, 1 Dec 2021 16:58:03 +0300 Subject: [PATCH] Fixed #1836 - For OrganizationChart --- .../organizationchart/OrganizationChart.d.ts | 152 ++++++++++++++++-- 1 file changed, 137 insertions(+), 15 deletions(-) diff --git a/src/components/organizationchart/OrganizationChart.d.ts b/src/components/organizationchart/OrganizationChart.d.ts index 43bab3288..e98efeb71 100755 --- a/src/components/organizationchart/OrganizationChart.d.ts +++ b/src/components/organizationchart/OrganizationChart.d.ts @@ -1,24 +1,146 @@ import { VNode } from 'vue'; +import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; -interface OrganizationChartProps { - value?: any; - selectionKeys?: any; - selectionMode?: string; - collapsedKeys?: any; +type OrganizationChartSelectionModeType = 'single' | 'multiple' | undefined; + +export interface OrganizationChartNode { + /** + * Unique identifier of the node. (required) + */ + key: any; + /** + * Type of the node to match a template. + */ + type?: string; + /** + * Style class of the node content. + */ + styleClass?: string; + /** + * Data represented by the node. + */ + data?: any; + /** + * Whether node is selectable when selection is enabled. + * Default value is true. + */ + selectable?: boolean; + /** + * Whether node is collapsible when node expansion is enabled. + * Default value is true. + */ + collapsible?: boolean; + /** + * Children nodes array. + */ + children?: OrganizationChartNode[]; + /** + * Optional keys + */ + [key: string]: any; +} + +export interface OrganizationChartSelectionKeys { + /** + * Optional keys + */ + [key: string]: any; +} + +export interface OrganizationChartCollapsedKeys { + /** + * Optional keys + */ + [key: string]: any; +} + +export interface OrganizationChartProps { + /** + * Value of the component. + */ + value?: OrganizationChartNode[]; + /** + * A map instance of key-value pairs to represented the selected nodes. + */ + selectionKeys?: OrganizationChartSelectionKeys; + /** + * Type of the selection. + * @see OrganizationChartSelectionModeType + */ + selectionMode?: OrganizationChartSelectionModeType; + /** + * A map instance of key-value pairs to represented the collapsed nodes. + */ + collapsedKeys?: OrganizationChartCollapsedKeys; + /** + * Whether the nodes can be expanded or toggled. + */ collapsible?: boolean; } -declare class OrganizationChart { - $props: OrganizationChartProps; - $emit(eventName: 'update:selectionKeys', value: any): this; - $emit(eventName: 'update:collapsedKeys', value: boolean): this; - $emit(eventName: 'node-select', node: any): this; - $emit(eventName: 'node-unselect', node: any): this; - $emit(eventName: 'node-expand', node: any): this; - $emit(eventName: 'node-collapsed', node: any): this; - $slots: { - [key: string]: VNode[]; +export interface OrganizationChartSlots { + /** + * Custom content template. + */ + default: (node: any) => VNode[]; + /** + * Dynamic content template. + */ + [key: string]: (node: any) => VNode[]; +} + +type OrganizationChartEmits = { + /** + * Emitted when the value changes. + * @param {*} value - New value. + */ + 'update:selectionKeys': (value: any) => void; + /** + * Emitted when the value changes. + * @param {boolean} value - New value. + */ + 'update:collapsedKeys': (value: boolean) => void; + /** + * Callback to invoke when a suggestion is selected. + * @param {OrganizationChartNode} node - Node instance. + */ + 'node-select': (node: OrganizationChartNode) => void; + /** + * Callback to invoke when a node is unselected. + * @param {OrganizationChartNode} node - Node instance. + */ + 'node-unselect': (node: OrganizationChartNode) => void; + /** + * Callback to invoke when a node is expanded. + * @param {OrganizationChartNode} node - Node instance. + */ + 'node-expand': (node: OrganizationChartNode) => void; + /** + * Callback to invoke when a node is collapsed. + * @param {OrganizationChartNode} node - Node instance. + */ + 'node-collapsed': (node: OrganizationChartNode) => void; +} + +declare class OrganizationChart extends ClassComponent { } + +declare module '@vue/runtime-core' { + interface GlobalComponents { + OrganizationChart: GlobalComponentConstructor } } +/** + * + * OrganizationChart visualizes hierarchical organization data. + * + * Helper API: + * + * - OrganizationChartNode + * + * Demos: + * + * - [OrganizationChart](https://www.primefaces.org/primevue/showcase/#/organizationchart) + * + */ export default OrganizationChart;