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 1/2] 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; } } }; From 1a44d57e16c6ed7c3435bcf378297d27c24451c6 Mon Sep 17 00:00:00 2001 From: mertsincan Date: Thu, 2 Mar 2023 14:45:27 +0000 Subject: [PATCH 2/2] Update DataTable.spec.js --- components/datatable/DataTable.spec.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/components/datatable/DataTable.spec.js b/components/datatable/DataTable.spec.js index ddfb8e7e0..070130742 100644 --- a/components/datatable/DataTable.spec.js +++ b/components/datatable/DataTable.spec.js @@ -458,7 +458,7 @@ describe('DataTable.vue', () => { await wrapper.setProps({ selection: null, selectionMode: 'single' }); await wrapper.vm.onRowClick({ - originalEvent: { target: wrapper.findAll('tr.p-selectable-row')[0] }, + originalEvent: { target: wrapper.findAll('tr.p-selectable-row')[0].element }, data: smallData[0], index: 0 }); @@ -472,13 +472,13 @@ describe('DataTable.vue', () => { await wrapper.setProps({ selection: null, selectionMode: 'multiple' }); await wrapper.vm.onRowClick({ - originalEvent: { shiftKey: true, target: wrapper.findAll('tr.p-selectable-row')[0] }, + originalEvent: { shiftKey: true, target: wrapper.findAll('tr.p-selectable-row')[0].element }, data: smallData[0], index: 0 }); await wrapper.vm.onRowClick({ - originalEvent: { shiftKey: true, target: wrapper.findAll('tr.p-selectable-row')[1] }, + originalEvent: { shiftKey: true, target: wrapper.findAll('tr.p-selectable-row')[1].element }, data: smallData[1], index: 1 }); @@ -492,13 +492,13 @@ describe('DataTable.vue', () => { await wrapper.setProps({ selection: null, selectionMode: 'multiple', metaKeySelection: false }); await wrapper.vm.onRowClick({ - originalEvent: { target: wrapper.findAll('tr.p-selectable-row')[0] }, + originalEvent: { target: wrapper.findAll('tr.p-selectable-row')[0].element }, data: smallData[0], index: 0 }); await wrapper.vm.onRowClick({ - originalEvent: { target: wrapper.findAll('tr.p-selectable-row')[1] }, + originalEvent: { target: wrapper.findAll('tr.p-selectable-row')[1].element }, data: smallData[1], index: 1 });