Apidoc services completed
parent
1ddebd977c
commit
e2747c5ae8
|
@ -167,6 +167,11 @@ if (project) {
|
|||
description: '',
|
||||
values: []
|
||||
};
|
||||
|
||||
const methods = {
|
||||
description: '',
|
||||
values: []
|
||||
};
|
||||
const model_props_group = model.groups.find((g) => g.title === 'Properties');
|
||||
|
||||
model_props_group &&
|
||||
|
@ -181,9 +186,55 @@ if (project) {
|
|||
});
|
||||
});
|
||||
|
||||
const model_methods_group = model.groups.find((g) => g.title === 'Methods');
|
||||
|
||||
model_methods_group &&
|
||||
model_methods_group.children.forEach((method) => {
|
||||
const signature = method.getAllSignatures()[0];
|
||||
const isSlot = model.name.includes('Slots');
|
||||
|
||||
methods.values.push({
|
||||
name: signature.name,
|
||||
parameters: signature.parameters.map((param) => {
|
||||
let type = param.type.toString();
|
||||
|
||||
if (param.type.declaration && isSlot) {
|
||||
type = '';
|
||||
|
||||
if (param.type.declaration.children) {
|
||||
param.type.declaration.children.forEach((child) => {
|
||||
if (child.signatures) {
|
||||
const childSinature = child.signatures[0];
|
||||
const parameters = childSinature.parameters.reduce((acc, { name, type }, index) => (index === 0 ? `${name}: ${type.name}` : `${acc}, ${name}: ${type.name}`), '');
|
||||
|
||||
type += ` \t ${childSinature.name}(${parameters}): ${childSinature.type?.name}, // ${childSinature.comment?.summary[0]?.text}\n `;
|
||||
} else {
|
||||
const childType = child.type.elementType ? child.type.elementType.name : child.type.name;
|
||||
|
||||
type += ` \t ${child.name}: ${childType}, // ${child.comment?.summary[0]?.text}\n `;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
type = `{\n ${type} }`;
|
||||
}
|
||||
|
||||
return {
|
||||
name: param.name,
|
||||
optional: param.flags.isOptional,
|
||||
type: type,
|
||||
description: param.comment && param.comment.summary.map((s) => parseText(s.text || '')).join(' ')
|
||||
};
|
||||
}),
|
||||
returnType: signature.type.toString(),
|
||||
description: signature.comment && signature.comment.summary.map((s) => parseText(s.text || '')).join(' ')
|
||||
});
|
||||
});
|
||||
|
||||
doc[name]['model'][model.name] = {
|
||||
description: event_props_description,
|
||||
props
|
||||
props,
|
||||
methods
|
||||
};
|
||||
});
|
||||
|
||||
|
|
|
@ -278,6 +278,7 @@ export interface AutoCompleteProps {
|
|||
|
||||
/**
|
||||
* Defines valid slots in AutoComplete component.
|
||||
* @todo Next release we should complete types for all slots
|
||||
*/
|
||||
export interface AutoCompleteSlots {
|
||||
/**
|
||||
|
|
|
@ -41,8 +41,9 @@ export interface ConfirmationOptions {
|
|||
blockScroll?: boolean | undefined;
|
||||
/**
|
||||
* Callback to execute when action is confirmed.
|
||||
* @todo Next release should be able to change
|
||||
*/
|
||||
accept?(): void;
|
||||
accept?: () => void;
|
||||
/**
|
||||
* Callback to execute when action is rejected.
|
||||
*/
|
||||
|
@ -50,7 +51,7 @@ export interface ConfirmationOptions {
|
|||
/**
|
||||
* Callback to execute when dialog is hidden.
|
||||
*/
|
||||
onHide?(): void;
|
||||
onHide?: () => void;
|
||||
/**
|
||||
* Label of the accept button. Defaults to PrimeVue Locale configuration.
|
||||
*/
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* [Live Demo](https://www.primevue.org/confirmdialog/)
|
||||
*
|
||||
* @module confirmationservice
|
||||
* @module confirmationservice-useconfirm
|
||||
*
|
||||
*/
|
||||
import { Plugin } from 'vue';
|
||||
|
@ -13,9 +13,7 @@ export default plugin;
|
|||
|
||||
/**
|
||||
* Confirmation Service methods.
|
||||
*
|
||||
* @group Interfaces
|
||||
*
|
||||
* @group Model
|
||||
*/
|
||||
export interface ConfirmationServiceMethods {
|
||||
/**
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* [Live Demo](https://www.primevue.org/dynamicdialog/)
|
||||
*
|
||||
* @module dialogservice
|
||||
* @module dialogservice-usedialog
|
||||
*
|
||||
*/
|
||||
import { Plugin } from 'vue';
|
||||
|
@ -14,7 +14,7 @@ export default plugin;
|
|||
/**
|
||||
* Dynamic Dialog components methods.
|
||||
*
|
||||
* @group Interfaces
|
||||
* @group Model
|
||||
*
|
||||
*/
|
||||
export interface DialogServiceMethods {
|
||||
|
@ -24,7 +24,7 @@ export interface DialogServiceMethods {
|
|||
* @param {DynamicDialogOptions} options - DynamicDialog Object
|
||||
* @return {@link DynamicDialogInstance}
|
||||
*/
|
||||
open: (content: any, options?: DynamicDialogOptions) => DynamicDialogInstance;
|
||||
open(content: any, options?: DynamicDialogOptions): DynamicDialogInstance;
|
||||
}
|
||||
|
||||
declare module 'vue/types/vue' {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
/**
|
||||
* Confirmation Service methods.
|
||||
*
|
||||
* @group Interfaces
|
||||
* @group Model
|
||||
*
|
||||
*/
|
||||
export interface TerminalServiceOptions {
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
*
|
||||
* [Live Demo](https://www.primevue.org/toast/)
|
||||
*
|
||||
* @module toastservice
|
||||
*
|
||||
* @module toastservice-usetoast
|
||||
* @todo 'use' is not a valid name for a module. Next release will change.
|
||||
*/
|
||||
import { Plugin } from 'vue';
|
||||
import { ToastMessageOptions } from '../toast';
|
||||
|
@ -14,7 +14,7 @@ export default plugin;
|
|||
/**
|
||||
* Toast Service methods.
|
||||
*
|
||||
* @group Interfaces
|
||||
* @group Model
|
||||
*
|
||||
*/
|
||||
export interface ToastServiceMethods {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -48,18 +48,29 @@ export default {
|
|||
docName: docName
|
||||
};
|
||||
|
||||
const values = APIDocs[moduleName].interfaces.values;
|
||||
const values = APIDocs[moduleName]?.interfaces?.values;
|
||||
const componentValues = APIDocs[moduleName]?.components;
|
||||
const modelValues = APIDocs[moduleName]?.model;
|
||||
let props = null;
|
||||
let emits = null;
|
||||
let slots = null;
|
||||
let events = null;
|
||||
let options = null;
|
||||
let interfaces = null;
|
||||
|
||||
if (values) {
|
||||
props = values[`${docName}Props`];
|
||||
emits = values[`${docName}Emits`];
|
||||
slots = values[`${docName}Slots`];
|
||||
events = this.findEvents(values);
|
||||
options = this.findOptions(values, docName); // MenuItem && ConfirmationOptions
|
||||
interfaces = this.findOtherInterfaces(values, docName);
|
||||
}
|
||||
|
||||
const props = values[`${docName}Props`];
|
||||
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);
|
||||
|
||||
const options = this.findOptions(values, docName); // Only for MenuItem
|
||||
const services = modelValues; // (TerminalService && ConfirmationService && ToastService)
|
||||
|
||||
if (props && props.props.length) {
|
||||
newDoc.children.push({
|
||||
|
@ -101,7 +112,7 @@ export default {
|
|||
});
|
||||
}
|
||||
|
||||
if (events && events.length) {
|
||||
if (events && events.length > 0) {
|
||||
newDoc.children.push({
|
||||
id: `api.${moduleName}.events`,
|
||||
label: 'Events',
|
||||
|
@ -144,6 +155,17 @@ export default {
|
|||
});
|
||||
}
|
||||
|
||||
if (services) {
|
||||
console.log(services);
|
||||
newDoc.children.push({
|
||||
id: `api.${moduleName}.services`,
|
||||
label: 'Services',
|
||||
component: DocApiTable,
|
||||
data: this.setServicesData(moduleName, services),
|
||||
description: Object.values(services)[0].description || null
|
||||
});
|
||||
}
|
||||
|
||||
newDocs.push(newDoc);
|
||||
}
|
||||
|
||||
|
@ -257,6 +279,27 @@ export default {
|
|||
|
||||
return data;
|
||||
},
|
||||
setServicesData(moduleName, services) {
|
||||
const data = [];
|
||||
|
||||
for (const key of Object.keys(services)) {
|
||||
const value = services[key];
|
||||
|
||||
value?.methods.values.forEach((method) => {
|
||||
data.push({
|
||||
name: method.name,
|
||||
parameters: {
|
||||
name: method.parameters[0]?.name,
|
||||
type: method.parameters[0]?.type
|
||||
},
|
||||
returnType: method.returnType,
|
||||
description: method.description
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return data;
|
||||
},
|
||||
findEvents(values) {
|
||||
const events = [];
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ export default {
|
|||
isLinkType(value) {
|
||||
if (this.label === 'Slots') return false;
|
||||
|
||||
return value.toLowerCase().includes(this.$route.hash.replace('#api.', '').split('.')[0].toLowerCase());
|
||||
return value.toLowerCase().includes(this.id.split('.')[1]);
|
||||
},
|
||||
setLinkPath(value, type) {
|
||||
const currentRoute = this.$router.currentRoute.value.name;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
header="ConfirmDialog"
|
||||
description="ConfirmDialog uses a Dialog UI that is integrated with the Confirmation API."
|
||||
:componentDocs="docs"
|
||||
:apiDocs="['ConfirmDialog', 'ConfirmationService', 'ConfirmationOptions']"
|
||||
:apiDocs="['ConfirmDialog', 'ConfirmationService-UseConfirm', 'ConfirmationOptions']"
|
||||
/>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<DocComponent title="Vue Dialog Component" header="Dialog" description="Dialog is a container to display content in an overlay window" :componentDocs="docs" :apiDocs="['Dialog']" />
|
||||
<DocComponent title="Vue Dialog Component" header="Dialog" description="Dialog is a container to display content in an overlay window" :componentDocs="docs" :apiDocs="['Dialog', 'DialogService-UseDialog']" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<DocComponent title="Vue Toast Component" header="Toast" description="Toast is used to display messages in an overlay." :componentDocs="docs" :apiDocs="['Toast', 'ToastService']" />
|
||||
<DocComponent title="Vue Toast Component" header="Toast" description="Toast is used to display messages in an overlay." :componentDocs="docs" :apiDocs="['Toast', 'ToastService-UseToast']" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
|
Loading…
Reference in New Issue