From 0bb0642be598e1f295df046f10f74fbaf81b4079 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bahad=C4=B1r=20Sofuo=C4=9Flu?= Date: Fri, 3 Mar 2023 10:05:18 +0300 Subject: [PATCH] MenuItem d.ts updates --- components/menuitem/MenuItem.d.ts | 1 - layouts/doc/DocApiSection.vue | 28 ++++++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/components/menuitem/MenuItem.d.ts b/components/menuitem/MenuItem.d.ts index b0dff80f6..b0d97c06d 100644 --- a/components/menuitem/MenuItem.d.ts +++ b/components/menuitem/MenuItem.d.ts @@ -28,7 +28,6 @@ export interface MenuItemCommandEvent { /** * Defines model of MenuItem API. - * @group Model */ export interface MenuItem { /** diff --git a/layouts/doc/DocApiSection.vue b/layouts/doc/DocApiSection.vue index 87ebcb40c..568b13795 100644 --- a/layouts/doc/DocApiSection.vue +++ b/layouts/doc/DocApiSection.vue @@ -58,6 +58,8 @@ export default { let events = this.findEvents(values); const interfaces = this.findOtherInterfaces(values, docName); + const options = this.findOptions(values, docName); // Only for MenuItem + if (props && props.props.length) { newDoc.children.push({ id: `api.${moduleName}.props`, @@ -109,7 +111,7 @@ export default { } if (interfaces && interfaces.length > 0) { - const isValidDirective = this.checkDirectiveInterfaces(interfaces, docName); + const isValidDirective = this.checkDirectiveInterfaces(interfaces); if (!isValidDirective) return; @@ -132,6 +134,15 @@ export default { }); } + if (options) { + newDoc.children.push({ + id: `api.${moduleName}.options`, + label: 'Options', + component: DocApiTable, + data: this.setPropsData(options[0].values.props) + }); + } + newDocs.push(newDoc); } @@ -270,7 +281,20 @@ export default { return interfaces; }, - checkDirectiveInterfaces(interfaces, docName) { + findOptions(values, docName) { + if (docName !== 'MenuItem') return; + + const options = []; + + for (const key of Object.keys(values)) { + if (key === 'MenuItem') { + options.push({ key, values: values[key] }); + } + } + + return options; + }, + checkDirectiveInterfaces(interfaces) { const findMainInterface = interfaces.find((interfaceData) => interfaceData.key.includes('DirectiveBinding')); return !findMainInterface || findMainInterface.values.props.length > 0;