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
36 changes: 22 additions & 14 deletions packages/primevue/src/autocomplete/AutoComplete.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 { InputTextPassThroughOptions } from 'primevue/inputtext';
import type { PassThroughOptions } from 'primevue/passthrough';
import type { VirtualScrollerItemOptions, VirtualScrollerPassThroughOptionType, VirtualScrollerProps } from 'primevue/virtualscroller';
import { TransitionProps, VNode } from 'vue';
import { AllowedComponentProps, ComponentCustomProps, TransitionProps, VNode, VNodeProps } from 'vue';

export declare type AutoCompletePassThroughOptionType = AutoCompletePassThroughAttributes | ((options: AutoCompletePassThroughMethodOptions) => AutoCompletePassThroughAttributes | string) | string | null | undefined;

Expand Down Expand Up @@ -316,7 +316,7 @@ export interface AutoCompleteContext {
/**
* Defines valid properties in AutoComplete component.
*/
export interface AutoCompleteProps {
export interface AutoCompleteProps<T = any> {
/**
* Value of the component.
*/
Expand All @@ -332,23 +332,23 @@ export interface AutoCompleteProps {
/**
* An array of suggestions to display.
*/
suggestions?: any[];
suggestions?: T[];
/**
* Property name or getter function to use as the label of an option.
*/
optionLabel?: string | ((data: any) => string) | undefined;
optionLabel?: string | ((data: T) => string) | undefined;
/**
* Property name or getter function to use as the disabled flag of an option, defaults to false when not defined.
*/
optionDisabled?: string | ((data: any) => boolean) | undefined;
optionDisabled?: string | ((data: T) => boolean) | undefined;
/**
* Property name or getter function to use as the label of an option group.
*/
optionGroupLabel?: string | ((data: any) => string) | undefined;
optionGroupLabel?: string | ((data: T) => string) | undefined;
/**
* Property name or getter function that refers to the children options of option group.
*/
optionGroupChildren?: string | ((data: any) => any[]) | undefined;
optionGroupChildren?: string | ((data: T) => any[]) | undefined;
/**
* whether typeahead is active or not.
* @defaultValue true
Expand Down Expand Up @@ -585,7 +585,7 @@ export interface AutoCompleteProps {
* Defines valid slots in AutoComplete component.
* @todo Next release we should complete types for all slots
*/
export interface AutoCompleteSlots {
export interface AutoCompleteSlots<T = any> {
/**
* Custom chip template.
* @param {Object} scope - chip slot's params.
Expand Down Expand Up @@ -617,7 +617,7 @@ export interface AutoCompleteSlots {
/**
* Displayed options
*/
suggestions: any[];
suggestions: T[];
}): VNode[];
/**
* Custom footer template of panel.
Expand All @@ -631,7 +631,7 @@ export interface AutoCompleteSlots {
/**
* Displayed options
*/
suggestions: any[];
suggestions: T[];
}): VNode[];
/**
* Custom option template.
Expand All @@ -641,7 +641,7 @@ export interface AutoCompleteSlots {
/**
* Option instance
*/
option: any;
option: T;
/**
* Index of the option
*/
Expand All @@ -655,7 +655,7 @@ export interface AutoCompleteSlots {
/**
* Option instance
*/
option: any;
option: T;
/**
* Index of the option
*/
Expand Down Expand Up @@ -898,11 +898,19 @@ export declare type AutoCompleteEmits = EmitFn<AutoCompleteEmitsOptions>;
* @group Component
*
*/
declare const AutoComplete: DefineComponent<AutoCompleteProps, AutoCompleteSlots, AutoCompleteEmits>;
declare const AutoComplete: {
new <T = any>(
props: AutoCompleteProps<T>
): {
$props: AutoCompleteProps<T> & VNodeProps & AllowedComponentProps & ComponentCustomProps;
$slots: AutoCompleteSlots<T>;
$emit: EmitFn<AutoCompleteEmitsOptions>;
};
};

declare module 'vue' {
export interface GlobalComponents {
AutoComplete: DefineComponent<AutoCompleteProps, AutoCompleteSlots, AutoCompleteEmits>;
AutoComplete: typeof AutoComplete;
}
}

Expand Down
36 changes: 22 additions & 14 deletions packages/primevue/src/cascadeselect/CascadeSelect.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 { HTMLAttributes, InputHTMLAttributes, TransitionProps, VNode } from 'vue';
import { AllowedComponentProps, ComponentCustomProps, HTMLAttributes, InputHTMLAttributes, TransitionProps, VNode, VNodeProps } from 'vue';

export declare type CascadeSelectPassThroughOptionType = CascadeSelectPassThroughAttributes | ((options: CascadeSelectPassThroughMethodOptions) => CascadeSelectPassThroughAttributes | string) | string | null | undefined;

Expand Down Expand Up @@ -262,7 +262,7 @@ export interface CascadeSelectContext {
/**
* Defines valid properties in CascadeSelect component.
*/
export interface CascadeSelectProps {
export interface CascadeSelectProps<T = any> {
/**
* Value of the component.
*/
Expand All @@ -278,27 +278,27 @@ export interface CascadeSelectProps {
/**
* An array of selectitems to display as the available options.
*/
options?: any[] | undefined;
options?: T[] | undefined;
/**
* Property name or getter function to use as the label of an option.
*/
optionLabel?: string | ((data: any) => string) | undefined;
optionLabel?: string | ((data: T) => string) | undefined;
/**
* Property name or getter function to use as the value of an option, defaults to the option itself when not defined.
*/
optionValue?: string | ((data: any) => any) | undefined;
optionValue?: string | ((data: T) => any) | undefined;
/**
* Property name or getter function to use as the disabled flag of an option, defaults to false when not defined.
*/
optionDisabled?: string | ((data: any) => boolean) | undefined;
optionDisabled?: string | ((data: T) => boolean) | undefined;
/**
* Property name or getter function to use as the label of an option group.
*/
optionGroupLabel?: string | ((data: any) => string) | undefined;
optionGroupLabel?: string | ((data: T) => string) | undefined;
/**
* Property name or getter function to retrieve the items of a group.
*/
optionGroupChildren?: string[] | string | ((data: any) => any[]) | undefined;
optionGroupChildren?: string[] | string | ((data: T) => any[]) | undefined;
/**
* Default text to display when no option is selected.
*/
Expand Down Expand Up @@ -494,7 +494,7 @@ export interface CascadeSelectProps {
/**
* Defines valid slots in CascadeSelect component.
*/
export interface CascadeSelectSlots {
export interface CascadeSelectSlots<T = any> {
/**
* Custom content for each option.
* @param {Object} scope - option slot's params.
Expand All @@ -503,7 +503,7 @@ export interface CascadeSelectSlots {
/**
* Option instance
*/
option: any;
option: T;
/**
* Selection state
*/
Expand Down Expand Up @@ -551,7 +551,7 @@ export interface CascadeSelectSlots {
/**
* Options of the component
*/
options: any[];
options: T[];
}): VNode[];
/**
* Custom footer template.
Expand All @@ -564,7 +564,7 @@ export interface CascadeSelectSlots {
/**
* Options of the component
*/
options: any[];
options: T[];
}): VNode[];
/**
* Custom clear icon template.
Expand Down Expand Up @@ -650,11 +650,19 @@ export declare type CascadeSelectEmits = EmitFn<CascadeSelectEmitsOptions>;
* @group Component
*
*/
declare const CascadeSelect: DefineComponent<CascadeSelectProps, CascadeSelectSlots, CascadeSelectEmits>;
declare const CascadeSelect: {
new <T = any>(
props: CascadeSelectProps<T>
): {
$props: CascadeSelectProps<T> & VNodeProps & AllowedComponentProps & ComponentCustomProps;
$slots: CascadeSelectSlots<T>;
$emit: EmitFn<CascadeSelectEmitsOptions>;
};
};

declare module 'vue' {
export interface GlobalComponents {
CascadeSelect: DefineComponent<CascadeSelectProps, CascadeSelectSlots, CascadeSelectEmits>;
CascadeSelect: typeof CascadeSelect;
}
}

Expand Down
20 changes: 14 additions & 6 deletions packages/primevue/src/dataview/DataView.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type { DefineComponent, DesignToken, EmitFn, HintedString, PassThrough }
import type { ComponentHooks } from '@primevue/core/basecomponent';
import type { PaginatorPassThroughOptionType } from 'primevue/paginator';
import type { PassThroughOptions } from 'primevue/passthrough';
import { VNode } from 'vue';
import { AllowedComponentProps, ComponentCustomProps, VNode, VNodeProps } from 'vue';

export declare type DataViewPassThroughOptionType = DataViewPassThroughAttributes | ((options: DataViewPassThroughMethodOptions) => DataViewPassThroughAttributes | string) | string | null | undefined;

Expand Down Expand Up @@ -261,7 +261,7 @@ export interface DataViewProps<T = unknown> {
/**
* Defines valid slots in DataView component.
*/
export interface DataViewSlots {
export interface DataViewSlots<T = unknown> {
/**
* Custom header template.
*/
Expand Down Expand Up @@ -357,7 +357,7 @@ export interface DataViewSlots {
/**
* Value of the component
*/
items: any;
items: T[];
}): VNode[];
/**
* Custom list template.
Expand All @@ -367,7 +367,7 @@ export interface DataViewSlots {
/**
* Value of the component
*/
items: any;
items: T[];
}): VNode[];
}

Expand Down Expand Up @@ -406,11 +406,19 @@ export declare type DataViewEmits = EmitFn<DataViewEmitsOptions>;
* @group Component
*
*/
declare const DataView: DefineComponent<DataViewProps, DataViewSlots, DataViewEmits>;
declare const DataView: {
new <T = unknown>(
props: DataViewProps<T>
): {
$props: DataViewProps<T> & VNodeProps & AllowedComponentProps & ComponentCustomProps;
$slots: DataViewSlots<T>;
$emit: EmitFn<DataViewEmitsOptions>;
};
};

declare module 'vue' {
export interface GlobalComponents {
DataView: DefineComponent<DataViewProps, DataViewSlots, DataViewEmits>;
DataView: typeof DataView;
}
}

Expand Down