Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions packages/primevue/src/organizationchart/OrganizationChart.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import type { DefineComponent, DesignToken, EmitFn, HintedString, PassThrough } from '@primevue/core';
import type { ComponentHooks } from '@primevue/core/basecomponent';
import type { PassThroughOptions } from 'primevue/passthrough';
import { VNode } from 'vue';
import { AllowedComponentProps, ComponentCustomProps, VNode, VNodeProps } from 'vue';

export declare type OrganizationChartPassThroughOptionType = OrganizationChartPassThroughAttributes | ((options: OrganizationChartPassThroughMethodOptions) => OrganizationChartPassThroughAttributes | string) | string | null | undefined;

Expand Down Expand Up @@ -231,11 +231,11 @@ export interface OrganizationChartContext {
/**
* Defines valid properties in OrganizationChart component.
*/
export interface OrganizationChartProps {
export interface OrganizationChartProps<T extends OrganizationChartNode = OrganizationChartNode> {
/**
* Value of the component.
*/
value?: OrganizationChartNode;
value?: T;
/**
* A map instance of key-value pairs to represented the selected nodes.
*/
Expand Down Expand Up @@ -277,21 +277,21 @@ export interface OrganizationChartProps {
/**
* Defines valid slots in OrganizationChart component.
*/
export interface OrganizationChartSlots {
export interface OrganizationChartSlots<T extends OrganizationChartNode = OrganizationChartNode> {
/**
* Custom content template.
*/
default(scope: {
/**
* Current node
*/
node: any;
node: T;
}): VNode[];
/**
* Dynamic content template.
* @todo
*/
[key: string]: (node: any) => VNode[];
[key: string]: (node: T) => VNode[];
/**
* @deprecated since v4.0. Use 'toggleicon' slot instead.
* Custom toggler icon template.
Expand Down Expand Up @@ -365,11 +365,19 @@ export declare type OrganizationChartEmits = EmitFn<OrganizationChartEmitsOption
* @group Component
*
*/
declare const OrganizationChart: DefineComponent<OrganizationChartProps, OrganizationChartSlots, OrganizationChartEmits>;
declare const OrganizationChart: {
new <T extends OrganizationChartNode = OrganizationChartNode>(
props: OrganizationChartProps<T>
): {
$props: OrganizationChartProps<T> & VNodeProps & AllowedComponentProps & ComponentCustomProps;
$slots: OrganizationChartSlots<T>;
$emit: EmitFn<OrganizationChartEmitsOptions>;
};
};

declare module 'vue' {
export interface GlobalComponents {
OrganizationChart: DefineComponent<OrganizationChartProps, OrganizationChartSlots, OrganizationChartEmits>;
OrganizationChart: typeof OrganizationChart;
}
}

Expand Down
34 changes: 21 additions & 13 deletions packages/primevue/src/tree/Tree.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type { InputIconPassThroughOptions } from 'primevue/inputicon';
import type { InputTextPassThroughOptions } from 'primevue/inputtext';
import type { PassThroughOptions } from 'primevue/passthrough';
import type { TreeNode } from 'primevue/treenode';
import { VNode } from 'vue';
import { AllowedComponentProps, ComponentCustomProps, VNode, VNodeProps } from 'vue';

export declare type TreePassThroughOptionType<T = any> = TreePassThroughAttributes | ((options: TreePassThroughMethodOptions<T>) => TreePassThroughAttributes | string) | string | null | undefined;

Expand Down Expand Up @@ -324,11 +324,11 @@ export interface TreeContext {
/**
* Defines valid properties in Tree component.
*/
export interface TreeProps {
export interface TreeProps<T extends TreeNode = TreeNode> {
/**
* An array of treenodes.
*/
value?: TreeNode[] | undefined;
value?: T[] | undefined;
/**
* A map of keys to represent the expansion state in controlled mode.
*/
Expand Down Expand Up @@ -370,7 +370,7 @@ export interface TreeProps {
* When filtering is enabled, filterBy decides which field or fields (comma separated) to search against. A callable taking a TreeNode can be provided instead of a list of field names.
* @defaultValue label
*/
filterBy?: string | ((node: TreeNode) => string) | undefined;
filterBy?: string | ((node: T) => string) | undefined;
/**
* Mode for filtering.
* @defaultValue lenient
Expand Down Expand Up @@ -450,15 +450,15 @@ export interface TreeProps {
/**
* Defines valid slots in Tree component.
*/
export interface TreeSlots {
export interface TreeSlots<T extends TreeNode = TreeNode> {
/**
* Default content slot.
*/
default(scope: {
/**
* Tree node instance
*/
node: TreeNode;
node: T;
/**
* Selection state
*/
Expand Down Expand Up @@ -508,7 +508,7 @@ export interface TreeSlots {
/**
* Tree node instance
*/
node: TreeNode;
node: T;
/**
* Expanded state of the node
*/
Expand All @@ -523,7 +523,7 @@ export interface TreeSlots {
/**
* Tree node instance
*/
node: TreeNode;
node: T;
/**
* Expanded state of the node
*/
Expand All @@ -537,7 +537,7 @@ export interface TreeSlots {
/**
* Tree node instance
*/
node: TreeNode;
node: T;
/**
* Expanded state of the node
*/
Expand All @@ -551,7 +551,7 @@ export interface TreeSlots {
/**
* Tree node instance
*/
node: TreeNode;
node: T;
/**
* Style class of the icon.
*/
Expand Down Expand Up @@ -615,7 +615,7 @@ export interface TreeSlots {
* Optional slots.
* @todo
*/
[key: string]: (node: any) => VNode[];
[key: string]: (node: T) => VNode[];
}

/**
Expand Down Expand Up @@ -703,11 +703,19 @@ export declare type TreeEmits = EmitFn<TreeEmitsOptions>;
* @group Component
*
*/
declare const Tree: DefineComponent<TreeProps, TreeSlots, TreeEmits>;
declare const Tree: {
new <T extends TreeNode = TreeNode>(
props: TreeProps<T>
): {
$props: TreeProps<T> & VNodeProps & AllowedComponentProps & ComponentCustomProps;
$slots: TreeSlots<T>;
$emit: EmitFn<TreeEmitsOptions>;
};
};

declare module 'vue' {
export interface GlobalComponents {
Tree: DefineComponent<TreeProps, TreeSlots, TreeEmits>;
Tree: typeof Tree;
}
}

Expand Down
46 changes: 27 additions & 19 deletions packages/primevue/src/treeselect/TreeSelect.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import type { ChipPassThroughOptions } from 'primevue/chip';
import type { PassThroughOptions } from 'primevue/passthrough';
import type { TreeExpandedKeys, TreePassThroughOptions } from 'primevue/tree';
import type { TreeNode } from 'primevue/treenode';
import { InputHTMLAttributes, TransitionProps, VNode } from 'vue';
import { AllowedComponentProps, ComponentCustomProps, InputHTMLAttributes, TransitionProps, VNode, VNodeProps } from 'vue';

export declare type TreeSelectPassThroughOptionType = TreeSelectPassThroughAttributes | ((options: TreeSelectPassThroughMethodOptions) => TreeSelectPassThroughAttributes | string) | string | null | undefined;

Expand Down Expand Up @@ -172,23 +172,23 @@ export interface TreeSelectState {
/**
* Defines valid properties in TreeSelect component.
*/
export interface TreeSelectProps {
export interface TreeSelectProps<T extends TreeNode = TreeNode> {
/**
* Value of the component.
*/
modelValue?: TreeNode | any;
modelValue?: T | any;
/**
* The default value for the input when not controlled by `modelValue`.
*/
defaultValue?: TreeNode | any;
defaultValue?: T | any;
/**
* The name attribute for the element, typically used in form submissions.
*/
name?: string | undefined;
/**
* An array of treenodes.
*/
options?: TreeNode[] | undefined;
options?: T[] | undefined;
/**
* A map of keys to represent the expansion state in controlled mode.
*/
Expand Down Expand Up @@ -264,7 +264,7 @@ export interface TreeSelectProps {
* When filtering is enabled, filterBy decides which field or fields (comma separated) to search against. A callable taking a TreeNode can be provided instead of a list of field names.
* @defaultValue label
*/
filterBy?: string | ((node: TreeNode) => string) | undefined;
filterBy?: string | ((node: T) => string) | undefined;
/**
* Mode for filtering.
* @defaultValue lenient
Expand Down Expand Up @@ -366,7 +366,7 @@ export interface TreeSelectProps {
/**
* Defines valid slots in TreeSelect component.
*/
export interface TreeSelectSlots {
export interface TreeSelectSlots<T extends TreeNode = TreeNode> {
/**
* Custom value template.
* @param {Object} scope - value slot's params.
Expand All @@ -375,7 +375,7 @@ export interface TreeSelectSlots {
/**
* Selected value
*/
value: TreeNode | any;
value: T | any;
/**
* Placeholder
*/
Expand All @@ -389,7 +389,7 @@ export interface TreeSelectSlots {
/**
* Current node
*/
node: TreeNode | any;
node: T;
/**
* Selection state
*/
Expand All @@ -407,11 +407,11 @@ export interface TreeSelectSlots {
/**
* Selected value
*/
value: TreeNode | any;
value: T | any;
/**
* An array of treenodes.
*/
options: TreeNode[];
options: T[];
}): VNode[];
/**
* Custom footer template.
Expand All @@ -421,11 +421,11 @@ export interface TreeSelectSlots {
/**
* Selected value
*/
value: TreeNode | any;
value: T | any;
/**
* An array of treenodes.
*/
options: TreeNode[];
options: T[];
}): VNode[];
/**
* Custom empty template.
Expand Down Expand Up @@ -461,11 +461,11 @@ export interface TreeSelectSlots {
/**
* Node instance
*/
node: TreeNode | any;
node: T;
/**
* Expanded state of the node
*/
expanded: TreeNode[];
expanded: T[];
}): VNode[];
/**
* Custom item toggle icon template.
Expand All @@ -475,11 +475,11 @@ export interface TreeSelectSlots {
/**
* Node instance
*/
node: TreeNode | any;
node: T;
/**
* Expanded state of the node
*/
expanded: TreeNode[];
expanded: T[];
}): VNode[];
/**
* Custom item checkbox icon template.
Expand Down Expand Up @@ -599,11 +599,19 @@ export interface TreeSelectMethods {
* @group Component
*
*/
declare const TreeSelect: DefineComponent<TreeSelectProps, TreeSelectSlots, TreeSelectEmits, TreeSelectMethods>;
declare const TreeSelect: {
new <T extends TreeNode = TreeNode>(
props: TreeSelectProps<T>
): {
$props: TreeSelectProps<T> & VNodeProps & AllowedComponentProps & ComponentCustomProps;
$slots: TreeSelectSlots<T>;
$emit: EmitFn<TreeSelectEmitsOptions>;
} & TreeSelectMethods;
};

declare module 'vue' {
export interface GlobalComponents {
TreeSelect: DefineComponent<TreeSelectProps, TreeSelectSlots, TreeSelectEmits, TreeSelectMethods>;
TreeSelect: typeof TreeSelect;
}
}

Expand Down