From d9f6d096960a8e0c6c682c2535a6501359dbc482 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bahad=C4=B1r=20Sofuo=C4=9Flu?= Date: Thu, 2 Mar 2023 17:25:05 +0300 Subject: [PATCH] Docapi changes for directives - d.ts files updated --- components/badgedirective/BadgeDirective.d.ts | 6 ++++-- components/focustrap/FocusTrap.d.ts | 2 ++ components/ripple/Ripple.d.ts | 2 ++ components/styleclass/StyleClass.d.ts | 2 ++ components/tooltip/Tooltip.d.ts | 7 +++++-- layouts/doc/DocApiSection.vue | 12 ++++++++++-- 6 files changed, 25 insertions(+), 6 deletions(-) diff --git a/components/badgedirective/BadgeDirective.d.ts b/components/badgedirective/BadgeDirective.d.ts index 8a59fa939..417fbf7dc 100644 --- a/components/badgedirective/BadgeDirective.d.ts +++ b/components/badgedirective/BadgeDirective.d.ts @@ -3,13 +3,15 @@ * Badge directive is a small status indicator for another element. * * - [Live Demo](https://primevue.org/badge) + * + * @module badgedirective */ import { DirectiveBinding, ObjectDirective } from 'vue'; /** * Defines modifiers of Badge directive. */ -export declare type BadgeDirectiveModifiers = { +export interface BadgeDirectiveModifiers { /** * Success severity for Badge directive. */ @@ -26,7 +28,7 @@ export declare type BadgeDirectiveModifiers = { * Danger severity for Badge directive. */ danger?: string | undefined; -}; +} /** * Binding of Badge directive. diff --git a/components/focustrap/FocusTrap.d.ts b/components/focustrap/FocusTrap.d.ts index d779386c2..6760c935d 100644 --- a/components/focustrap/FocusTrap.d.ts +++ b/components/focustrap/FocusTrap.d.ts @@ -3,6 +3,8 @@ * Focus Trap keeps focus within a certain DOM element while tabbing. * * - [Live Demo](https://primevue.org/focustrap) + * + * @module focustrap */ import { DirectiveBinding, ObjectDirective } from 'vue'; diff --git a/components/ripple/Ripple.d.ts b/components/ripple/Ripple.d.ts index e204dd690..3a727c94f 100644 --- a/components/ripple/Ripple.d.ts +++ b/components/ripple/Ripple.d.ts @@ -3,6 +3,8 @@ * Ripple directive adds ripple effect to the host element. * * - [Live Demo](https://primevue.org/ripple) + * + * @module ripple */ import { DirectiveBinding, ObjectDirective } from 'vue'; diff --git a/components/styleclass/StyleClass.d.ts b/components/styleclass/StyleClass.d.ts index e668c25f0..00b82cc26 100644 --- a/components/styleclass/StyleClass.d.ts +++ b/components/styleclass/StyleClass.d.ts @@ -3,6 +3,8 @@ * StyleClass manages css classes declaratively to during enter/leave animations or just to toggle classes on an element. * * - [Live Demo](https://primevue.org/styleclass) + * + * @module styleclass */ import { DirectiveBinding, ObjectDirective } from 'vue'; diff --git a/components/tooltip/Tooltip.d.ts b/components/tooltip/Tooltip.d.ts index 3a0b3b069..324cf5280 100755 --- a/components/tooltip/Tooltip.d.ts +++ b/components/tooltip/Tooltip.d.ts @@ -3,6 +3,9 @@ * Tooltip directive provides advisory information for a component. * * - [Live Demo](https://primevue.org/tooltip) + * + * @module tooltip + * */ import { DirectiveBinding, ObjectDirective } from 'vue'; @@ -42,7 +45,7 @@ export interface TooltipOptions { /** * Defines modifiers of Tooltip. */ -export declare type TooltipDirectiveModifiers = { +export interface TooltipDirectiveModifiers { /** * Right position for Tooltip. */ @@ -63,7 +66,7 @@ export declare type TooltipDirectiveModifiers = { * Focus event for Tooltip. */ focus?: string | undefined; -}; +} /** * Binding of Tooltip directive. diff --git a/layouts/doc/DocApiSection.vue b/layouts/doc/DocApiSection.vue index fe8491aee..87ebcb40c 100644 --- a/layouts/doc/DocApiSection.vue +++ b/layouts/doc/DocApiSection.vue @@ -54,7 +54,6 @@ export default { const emits = values[`${docName}Emits`]; const slots = values[`${docName}Slots`]; const methods = componentValues ? componentValues['default'].methods : null; - const types = APIDocs[moduleName]['types']; let events = this.findEvents(values); 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({ id: `api.${moduleName}.interfaces`, label: 'Interfaces', @@ -266,6 +269,11 @@ export default { } return interfaces; + }, + checkDirectiveInterfaces(interfaces, docName) { + const findMainInterface = interfaces.find((interfaceData) => interfaceData.key.includes('DirectiveBinding')); + + return !findMainInterface || findMainInterface.values.props.length > 0; } } };