Skip to content

Commit

Permalink
parent updates for .d.ts files and apidoc
Browse files Browse the repository at this point in the history
  • Loading branch information
tugcekucukoglu committed Dec 5, 2023
1 parent da84f55 commit 8eea973
Show file tree
Hide file tree
Showing 30 changed files with 1,171 additions and 393 deletions.
6 changes: 3 additions & 3 deletions components/doc/DocApiTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
<template v-for="(value, i) in getType(v)" :key="value">
<span v-if="i !== 0" class="doc-option-type">{{ ' | ' }}</span>
<NuxtLink v-if="isLinkType(value)" :to="setLinkPath(value)" class="doc-option-type doc-option-link">{{ value }}</NuxtLink
><span v-else class="doc-option-type">{{ value }}</span>
><span v-else class="doc-option-type">{{ value ==='T'? 'any': value }}</span>
</template>
</template>

<template v-else-if="k === 'options'">
<template v-for="val in v" :key="val.name">
<div class="doc-option-type-options-container">
{{ val.name }}: <span class="doc-option-type-options doc-option-type">{{ val.type }}</span>
{{ val.name }}: <span class="doc-option-type-options doc-option-type">{{ (val.type === 'T' || val.type.includes('<T>')) ? 'any' : val.type }}</span>
</div>
</template>
</template>
Expand Down Expand Up @@ -111,7 +111,7 @@ export default {
});
},
isLinkType(value) {
if (this.label === 'Slots') return false;
if (this.label === 'Slots' || value.includes('SharedPassThroughOption') || value.includes('PassThrough<')) return false;
const validValues = ['confirmationoptions', 'toastmessageoptions'];
return value.toLowerCase().includes(this.id.split('.')[1]) || validValues.includes(value.toLowerCase());
Expand Down
13 changes: 12 additions & 1 deletion components/doc/helpers/PTHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,21 @@ export const getPTOption = (name) => {

for (const [i, prop] of props.entries()) {
if (options) {
let subCompName, subOptions;
let hasSubComp = prop.name !== 'hooks' && prop.type.indexOf('TransitionType') === -1 && prop.type.indexOf('<') > -1 && name.toLowerCase() !== prop.type.slice(0, prop.type.indexOf('<')).toLowerCase();

if (hasSubComp) {
subCompName = prop.type.slice(0, prop.type.indexOf('<')).replace('PassThroughOptions', '').replace('PassThroughOptionType', '');
subOptions = APIDocs[subCompName.toLowerCase()].interfaces.values[`${subCompName}PassThroughMethodOptions`];
const objToReplace = subOptions.props.find((opt) => opt.name === 'parent');

objToReplace.type = prop.type;
}

data.push({
value: i + 1,
label: prop.name,
options: options?.props,
options: hasSubComp ? subOptions?.props : options?.props,
description: prop.description
});
} else {
Expand Down
19 changes: 17 additions & 2 deletions components/lib/autocomplete/AutoComplete.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
import { HTMLAttributes, InputHTMLAttributes, TransitionProps, VNode } from 'vue';
import { ComponentHooks } from '../basecomponent';
import { ButtonPassThroughOptionType } from '../button';
import { ButtonPassThroughOptions } from '../button';
import { PassThroughOptions } from '../passthrough';
import { ClassComponent, GlobalComponentConstructor, PassThrough } from '../ts-helpers';
import { VirtualScrollerItemOptions, VirtualScrollerPassThroughOptionType, VirtualScrollerProps } from '../virtualscroller';
Expand Down Expand Up @@ -44,6 +44,20 @@ export interface AutoCompletePassThroughMethodOptions {
global: object | undefined;
}

/**
* Custom shared passthrough(pt) option method.
*/
export interface AutoCompleteSharedPassThroughMethodOptions {
/**
* Defines valid properties.
*/
props: AutoCompleteProps;
/**
* Defines current inline state.
*/
state: AutoCompleteState;
}

/**
* Custom change event.
* @see {@link AutoCompleteEmits.change}
Expand Down Expand Up @@ -150,8 +164,9 @@ export interface AutoCompletePassThroughOptions {
loadingIcon?: AutoCompletePassThroughOptionType;
/**
* Used to pass attributes to the Button component.
* @see {@link ButtonPassThroughOptions}
*/
dropdownButton?: ButtonPassThroughOptionType;
dropdownButton?: ButtonPassThroughOptions<AutoCompleteSharedPassThroughMethodOptions>;
/**
* Used to pass attributes to the panel's DOM element.
*/
Expand Down
12 changes: 8 additions & 4 deletions components/lib/badge/Badge.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ import { ComponentHooks } from '../basecomponent';
import { PassThroughOptions } from '../passthrough';
import { ClassComponent, GlobalComponentConstructor, PassThrough } from '../ts-helpers';

export declare type BadgePassThroughOptionType = BadgePassThroughAttributes | ((options: BadgePassThroughMethodOptions) => BadgePassThroughAttributes | string) | string | null | undefined;
export declare type BadgePassThroughOptionType<T = any> = BadgePassThroughAttributes | ((options: BadgePassThroughMethodOptions<T>) => BadgePassThroughAttributes | string) | string | null | undefined;

/**
* Custom passthrough(pt) option method.
*/
export interface BadgePassThroughMethodOptions {
export interface BadgePassThroughMethodOptions<T> {
/**
* Defines instance.
*/
Expand All @@ -30,6 +30,10 @@ export interface BadgePassThroughMethodOptions {
* Defines passthrough(pt) options in global config.
*/
global: object | undefined;
/**
* Defines parent instance.
*/
parent: T;
}

/**
Expand All @@ -43,11 +47,11 @@ export interface BadgePassThroughAttributes {
* Custom passthrough(pt) options.
* @see {@link BadgeProps.pt}
*/
export interface BadgePassThroughOptions {
export interface BadgePassThroughOptions<T = any> {
/**
* Used to pass attributes to the root's DOM element.
*/
root?: BadgePassThroughOptionType;
root?: BadgePassThroughOptionType<T>;
/**
* Used to manage all lifecycle hooks.
* @see {@link BaseComponent.ComponentHooks}
Expand Down
20 changes: 10 additions & 10 deletions components/lib/button/Button.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ import { ComponentHooks } from '../basecomponent';
import { PassThroughOptions } from '../passthrough';
import { ClassComponent, GlobalComponentConstructor, PassThrough } from '../ts-helpers';

export declare type ButtonPassThroughOptionType = ButtonPassThroughAttributes | ((options: ButtonPassThroughMethodOptions) => ButtonPassThroughAttributes | string) | string | null | undefined;
export declare type ButtonPassThroughOptionType<T = any> = ButtonPassThroughAttributes | ((options: ButtonPassThroughMethodOptions<T>) => ButtonPassThroughAttributes | string) | string | null | undefined;

/**
* Custom passthrough(pt) option method.
*/
export interface ButtonPassThroughMethodOptions {
export interface ButtonPassThroughMethodOptions<T> {
/**
* Defines instance.
*/
Expand All @@ -33,7 +33,7 @@ export interface ButtonPassThroughMethodOptions {
/**
* Defines parent instance.
*/
parent: any;
parent: T;
/**
* Defines passthrough(pt) options in global config.
*/
Expand All @@ -44,27 +44,27 @@ export interface ButtonPassThroughMethodOptions {
* Custom passthrough(pt) options.
* @see {@link ButtonProps.pt}
*/
export interface ButtonPassThroughOptions {
export interface ButtonPassThroughOptions<T = any> {
/**
* Used to pass attributes to the root's DOM element.
*/
root?: ButtonPassThroughOptionType;
root?: ButtonPassThroughOptionType<T>;
/**
* Used to pass attributes to the loading icon's DOM element.
*/
loadingIcon?: ButtonPassThroughOptionType;
loadingIcon?: ButtonPassThroughOptionType<T>;
/**
* Used to pass attributes to the icon's DOM element.
*/
icon?: ButtonPassThroughOptionType;
icon?: ButtonPassThroughOptionType<T>;
/**
* Used to pass attributes to the label's DOM element.
*/
label?: ButtonPassThroughOptionType;
label?: ButtonPassThroughOptionType<T>;
/**
* Used to pass attributes to the badge's DOM element.
*/
badge?: ButtonPassThroughOptionType;
badge?: ButtonPassThroughOptionType<T>;
/**
* Used to manage all lifecycle hooks.
* @see {@link BaseComponent.ComponentHooks}
Expand Down Expand Up @@ -171,7 +171,7 @@ export interface ButtonProps extends ButtonHTMLAttributes {
* Used to pass attributes to DOM elements inside the component.
* @type {ButtonPassThroughOptions}
*/
pt?: PassThrough<ButtonPassThroughOptions>;
pt?: PassThrough<ButtonPassThroughOptions<any>>;
/**
* Used to configure passthrough(pt) options of the component.
* @type {PassThroughOptions}
Expand Down
36 changes: 25 additions & 11 deletions components/lib/calendar/Calendar.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
import { HTMLAttributes, InputHTMLAttributes, TransitionProps, VNode } from 'vue';
import { ComponentHooks } from '../basecomponent';
import { ButtonPassThroughOptionType } from '../button';
import { ButtonPassThroughOptions } from '../button';
import { PassThroughOptions } from '../passthrough';
import { ClassComponent, GlobalComponentConstructor, PassThrough } from '../ts-helpers';

Expand Down Expand Up @@ -43,6 +43,20 @@ export interface CalendarPassThroughMethodOptions {
global: object | undefined;
}

/**
* Custom shared passthrough(pt) option method.
*/
export interface CalendarSharedPassThroughMethodOptions {
/**
* Defines valid properties.
*/
props: CalendarProps;
/**
* Defines current inline state.
*/
state: CalendarState;
}

/**
* Custom Calendar responsive options metadata.
*/
Expand Down Expand Up @@ -117,9 +131,9 @@ export interface CalendarPassThroughOptions {
input?: CalendarPassThroughOptionType;
/**
* Used to pass attributes to the Button component.
* @see {@link ButtonPassThroughOptionType}
* @see {@link ButtonPassThroughOptions}
*/
dropdownButton?: ButtonPassThroughOptionType;
dropdownButton?: ButtonPassThroughOptions<CalendarSharedPassThroughMethodOptions>;
/**
* Used to pass attributes to the panel's DOM element.
*/
Expand All @@ -138,9 +152,9 @@ export interface CalendarPassThroughOptions {
header?: CalendarPassThroughOptionType;
/**
* Used to pass attributes to the Button component.
* @see {@link ButtonPassThroughOptionType}
* @see {@link ButtonPassThroughOptions}
*/
previousButton?: ButtonPassThroughOptionType;
previousButton?: ButtonPassThroughOptions<CalendarSharedPassThroughMethodOptions>;
/**
* Used to pass attributes to the title's DOM element.
*/
Expand All @@ -159,9 +173,9 @@ export interface CalendarPassThroughOptions {
decadeTitle?: CalendarPassThroughOptionType;
/**
* Used to pass attributes to the Button component.
* @see {@link ButtonPassThroughOptionType}
* @see {@link ButtonPassThroughOptions}
*/
nextButton?: ButtonPassThroughOptionType;
nextButton?: ButtonPassThroughOptions<CalendarSharedPassThroughMethodOptions>;
/**
* Used to pass attributes to the container's DOM element.
*/
Expand Down Expand Up @@ -288,14 +302,14 @@ export interface CalendarPassThroughOptions {
buttonbar?: CalendarPassThroughOptionType;
/**
* Used to pass attributes to the Button component.
* @see {@link ButtonPassThroughOptionType}
* @see {@link ButtonPassThroughOptions}
*/
todayButton?: ButtonPassThroughOptionType;
todayButton?: ButtonPassThroughOptions<CalendarSharedPassThroughMethodOptions>;
/**
* Used to pass attributes to the Button component.
* @see {@link ButtonPassThroughOptionType}
* @see {@link ButtonPassThroughOptions}
*/
clearButton?: ButtonPassThroughOptionType;
clearButton?: ButtonPassThroughOptions<CalendarSharedPassThroughMethodOptions>;
/**
* Used to pass attributes to the aria selected day's DOM element.
*/
Expand Down
36 changes: 25 additions & 11 deletions components/lib/column/Column.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import { VNode } from 'vue';
import { ComponentHooks } from '../basecomponent';
import { ButtonPassThroughOptionType } from '../button';
import { ButtonPassThroughOptions } from '../button';
import { DataTablePassThroughOptions } from '../datatable';
import { DropdownPassThroughOptionType } from '../dropdown';
import { PassThroughOptions } from '../passthrough';
Expand Down Expand Up @@ -46,6 +46,20 @@ export interface ColumnPassThroughMethodOptions {
global: object | undefined;
}

/**
* Custom shared passthrough(pt) option method.
*/
export interface ColumnSharedPassThroughMethodOptions {
/**
* Defines valid properties.
*/
props: ColumnProps;
/**
* Defines parent instance.
*/
parent: DataTablePassThroughOptions;
}

/**
* Filter model metadata.
*/
Expand Down Expand Up @@ -194,7 +208,7 @@ export interface ColumnPassThroughOptions {
* Used to pass attributes to the Dropdown component.
* @see {@link DropdownPassThroughOptionType}
*/
filterOperatorDropdown?: DropdownPassThroughOptionType;
filterOperatorDropdown?: DropdownPassThroughOptionType<ColumnSharedPassThroughMethodOptions>;
/**
* Used to pass attributes to the filter constraints' DOM element.
*/
Expand All @@ -207,39 +221,39 @@ export interface ColumnPassThroughOptions {
* Used to pass attributes to the Dropdown component.
* @see {@link DropdownPassThroughOptionType}
*/
filterMatchModeDropdown?: DropdownPassThroughOptionType;
filterMatchModeDropdown?: DropdownPassThroughOptionType<ColumnSharedPassThroughMethodOptions>;
/**
* Used to pass attributes to the filter remove button container's DOM element.
*/
filterRemove?: ColumnPassThroughOptionType;
/**
* Used to pass attributes to the Button component.
* @see {@link ButtonPassThroughOptionType}
* @see {@link ButtonPassThroughOptions}
*/
filterRemoveButton?: ButtonPassThroughOptionType;
filterRemoveButton?: ButtonPassThroughOptions<ColumnSharedPassThroughMethodOptions>;
/**
* Used to pass attributes to the filter add rule's DOM element.
*/
filterAddRule?: ColumnPassThroughOptionType;
/**
* Used to pass attributes to the Button component.
* @see {@link ButtonPassThroughOptionType}
* @see {@link ButtonPassThroughOptions}
*/
filterAddRuleButton?: ButtonPassThroughOptionType;
filterAddRuleButton?: ButtonPassThroughOptions<ColumnSharedPassThroughMethodOptions>;
/**
* Used to pass attributes to the filter buttonbar's DOM element.
*/
filterButtonbar?: ColumnPassThroughOptionType;
/**
* Used to pass attributes to the Button component.
* @see {@link ButtonPassThroughOptionType}
* @see {@link ButtonPassThroughOptions}
*/
filterClearButton?: ButtonPassThroughOptionType;
filterClearButton?: ButtonPassThroughOptions<ColumnSharedPassThroughMethodOptions>;
/**
* Used to pass attributes to the Button component.
* @see {@link ButtonPassThroughOptionType}
* @see {@link ButtonPassThroughOptions}
*/
filterApplyButton?: ButtonPassThroughOptionType;
filterApplyButton?: ButtonPassThroughOptions<ColumnSharedPassThroughMethodOptions>;
/**
* Used to pass attributes to the body cell's DOM element.
*/
Expand Down

0 comments on commit 8eea973

Please sign in to comment.