Buildapi doc changes for scoped slots

pull/3711/head
Bahadır Sofuoğlu 2023-03-04 17:52:00 +03:00
parent df4d30c4cd
commit 1e057184e4
2 changed files with 21 additions and 16 deletions

View File

@ -51,7 +51,7 @@ if (project) {
console.log('module', module); console.log('module', module);
} */ // REMOVE } */ // REMOVE
// if (name !== 'datatable') return; // REMOVE /* if (name !== 'autocomplete') return; */ // REMOVE
const description = comment && comment.summary.map((s) => s.text || '').join(' '); const description = comment && comment.summary.map((s) => s.text || '').join(' ');
@ -275,8 +275,7 @@ if (project) {
eventDescription: staticMessages['events'], eventDescription: staticMessages['events'],
methodDescription: staticMessages['methods'], methodDescription: staticMessages['methods'],
typeDescription: staticMessages['types'], typeDescription: staticMessages['types'],
emitDescription: staticMessages['emits'],
slotDescription: staticMessages['slots'],
values: {} values: {}
}); });
@ -303,26 +302,38 @@ if (project) {
event_methods_group && event_methods_group &&
event_methods_group.children.forEach((method) => { event_methods_group.children.forEach((method) => {
const signature = method.getAllSignatures()[0]; const signature = method.getAllSignatures()[0];
const isSlot = event.name.includes('Slots');
methods.push({ methods.push({
name: signature.name, name: signature.name,
parameters: signature.parameters.map((param) => { parameters: signature.parameters.map((param) => {
/* let type = param.type.toString(); let type = param.type.toString();
if (param.type.declaration) { if (param.type.declaration && isSlot) {
type = ''; type = '';
param.type.declaration.children.forEach((child) => { if (param.type.declaration.children) {
type += ` \t ${child.name}: ${child.type.name}, // ${child.comment?.summary[0].text}\n `; 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} }`; type = `{\n ${type} }`;
} */ }
return { return {
name: param.name, name: param.name,
optional: param.flags.isOptional, optional: param.flags.isOptional,
type: param.type.toString(), type: type,
description: param.comment && param.comment.summary.map((s) => parseText(s.text || '')).join(' ') description: param.comment && param.comment.summary.map((s) => parseText(s.text || '')).join(' ')
}; };
}), }),

View File

@ -152,12 +152,6 @@ export default {
const data = []; const data = [];
for (const emit of emits) { for (const emit of emits) {
/* const parameters = emit.parameters.reduce((acc, param) => {
acc.push(`${param.name}: ${param.type}`);
return acc;
}, []); */
data.push({ data.push({
name: emit.name, name: emit.name,
parameters: { parameters: {