Docapi changes for directives - d.ts files updated

pull/3699/head
Bahadır Sofuoğlu 2023-03-02 17:25:05 +03:00
parent c4d9c17a69
commit d9f6d09696
6 changed files with 25 additions and 6 deletions

View File

@ -3,13 +3,15 @@
* Badge directive is a small status indicator for another element. * Badge directive is a small status indicator for another element.
* *
* - [Live Demo](https://primevue.org/badge) * - [Live Demo](https://primevue.org/badge)
*
* @module badgedirective
*/ */
import { DirectiveBinding, ObjectDirective } from 'vue'; import { DirectiveBinding, ObjectDirective } from 'vue';
/** /**
* Defines modifiers of Badge directive. * Defines modifiers of Badge directive.
*/ */
export declare type BadgeDirectiveModifiers = { export interface BadgeDirectiveModifiers {
/** /**
* Success severity for Badge directive. * Success severity for Badge directive.
*/ */
@ -26,7 +28,7 @@ export declare type BadgeDirectiveModifiers = {
* Danger severity for Badge directive. * Danger severity for Badge directive.
*/ */
danger?: string | undefined; danger?: string | undefined;
}; }
/** /**
* Binding of Badge directive. * Binding of Badge directive.

View File

@ -3,6 +3,8 @@
* Focus Trap keeps focus within a certain DOM element while tabbing. * Focus Trap keeps focus within a certain DOM element while tabbing.
* *
* - [Live Demo](https://primevue.org/focustrap) * - [Live Demo](https://primevue.org/focustrap)
*
* @module focustrap
*/ */
import { DirectiveBinding, ObjectDirective } from 'vue'; import { DirectiveBinding, ObjectDirective } from 'vue';

View File

@ -3,6 +3,8 @@
* Ripple directive adds ripple effect to the host element. * Ripple directive adds ripple effect to the host element.
* *
* - [Live Demo](https://primevue.org/ripple) * - [Live Demo](https://primevue.org/ripple)
*
* @module ripple
*/ */
import { DirectiveBinding, ObjectDirective } from 'vue'; import { DirectiveBinding, ObjectDirective } from 'vue';

View File

@ -3,6 +3,8 @@
* StyleClass manages css classes declaratively to during enter/leave animations or just to toggle classes on an element. * StyleClass manages css classes declaratively to during enter/leave animations or just to toggle classes on an element.
* *
* - [Live Demo](https://primevue.org/styleclass) * - [Live Demo](https://primevue.org/styleclass)
*
* @module styleclass
*/ */
import { DirectiveBinding, ObjectDirective } from 'vue'; import { DirectiveBinding, ObjectDirective } from 'vue';

View File

@ -3,6 +3,9 @@
* Tooltip directive provides advisory information for a component. * Tooltip directive provides advisory information for a component.
* *
* - [Live Demo](https://primevue.org/tooltip) * - [Live Demo](https://primevue.org/tooltip)
*
* @module tooltip
*
*/ */
import { DirectiveBinding, ObjectDirective } from 'vue'; import { DirectiveBinding, ObjectDirective } from 'vue';
@ -42,7 +45,7 @@ export interface TooltipOptions {
/** /**
* Defines modifiers of Tooltip. * Defines modifiers of Tooltip.
*/ */
export declare type TooltipDirectiveModifiers = { export interface TooltipDirectiveModifiers {
/** /**
* Right position for Tooltip. * Right position for Tooltip.
*/ */
@ -63,7 +66,7 @@ export declare type TooltipDirectiveModifiers = {
* Focus event for Tooltip. * Focus event for Tooltip.
*/ */
focus?: string | undefined; focus?: string | undefined;
}; }
/** /**
* Binding of Tooltip directive. * Binding of Tooltip directive.

View File

@ -54,7 +54,6 @@ export default {
const emits = values[`${docName}Emits`]; const emits = values[`${docName}Emits`];
const slots = values[`${docName}Slots`]; const slots = values[`${docName}Slots`];
const methods = componentValues ? componentValues['default'].methods : null; const methods = componentValues ? componentValues['default'].methods : null;
const types = APIDocs[moduleName]['types']; const types = APIDocs[moduleName]['types'];
let events = this.findEvents(values); let events = this.findEvents(values);
const interfaces = this.findOtherInterfaces(values, docName); const interfaces = this.findOtherInterfaces(values, docName);
@ -109,7 +108,11 @@ export default {
}); });
} }
if (interfaces && interfaces.length) { if (interfaces && interfaces.length > 0) {
const isValidDirective = this.checkDirectiveInterfaces(interfaces, docName);
if (!isValidDirective) return;
newDoc.children.push({ newDoc.children.push({
id: `api.${moduleName}.interfaces`, id: `api.${moduleName}.interfaces`,
label: 'Interfaces', label: 'Interfaces',
@ -266,6 +269,11 @@ export default {
} }
return interfaces; return interfaces;
},
checkDirectiveInterfaces(interfaces, docName) {
const findMainInterface = interfaces.find((interfaceData) => interfaceData.key.includes('DirectiveBinding'));
return !findMainInterface || findMainInterface.values.props.length > 0;
} }
} }
}; };