Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mkarimi/nested overloads #128

Merged
merged 3 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 34 additions & 17 deletions quasar_site/src/ViewModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,24 +54,42 @@ const ViewModel = {
return;
}

//An array containing top level children to determine if an overload should be skipped
let topLevelChild = [];

let children = members.map((x) => {
const labelParts = this.shortSignature(
this.memberName(x, childType.toLowerCase())
);
// Don't display overlaods in tree: WWW-2046
if (!x.overload || x.overload < 2) {

const overloads = members.filter((m) => {
return m.path == x.path;
});

if (topLevelChild.includes(x.path)) {
return null;
} else {
topLevelChild.push(x.path);
return {
label: labelParts[0],
labelSecondary: labelParts[1],
// path: x.overload ? `${x.path}?overload=${x.overload}` : x.path,
overload: x.overload,
path: x.path,
header: "secondary",
deprecated: x.deprecated,
obsolete: x.obsolete,
children:
overloads.length > 1
? overloads.map((o) => {
return {
label: this.shortSignature(
this.memberName(o, childType.toLowerCase())
)[1],
path: `${o.path}#${this.signatureAnchorRef(o.signature)}`,
};
})
: [],
};
} else {
return null;
}
});

Expand Down Expand Up @@ -665,16 +683,16 @@ const ViewModel = {
}
}

// Adding an overload tag to members with same declarations
members.forEach((member, id) => {
const nextMember = members[id + 1];
const prevMember = members[id - 1];
if (prevMember && prevMember.path == member.path) {
member.overload = prevMember.overload + 1;
} else if (nextMember && nextMember.path == member.path) {
member.overload = 1;
}
});
// // Adding an overload tag to members with same declarations
// members.forEach((member, id) => {
// const nextMember = members[id + 1];
// const prevMember = members[id - 1];
// if (prevMember && prevMember.path == member.path) {
// member.overload = prevMember.overload + 1;
// } else if (nextMember && nextMember.path == member.path) {
// member.overload = 1;
// }
// });

// Updating path for members with overloads and updating _pathMap
members.forEach((member) => {
Expand Down Expand Up @@ -742,8 +760,7 @@ const ViewModel = {
return [signature, ""];
},
signatureAnchorRef(signature) {
return this.shortSignature(signature)
.join("")
return this.shortSignature(signature)[1]
.toLocaleLowerCase()
.replace(/\s/g, "");
},
Expand Down
4 changes: 2 additions & 2 deletions quasar_site/src/pages/MemberDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<template v-if="members && members.items && members.items.length>0">
<div style="height: 130px"></div>
<q-list>
<div v-for="(member, index) in members.items" :key="index">
<q-item :id="ViewModel.signatureAnchorRef(member.signature)">
<div v-for="(member, index) in members.items" :key="index" :id="ViewModel.signatureAnchorRef(member.signature)" :style="this.$route.hash.substring(1).length == 0 || this.$route.hash.substring(1) == ViewModel.signatureAnchorRef(member.signature) ? 'opacity: 100%' : 'opacity: 30%'">
<q-item>
<q-item-section>
<q-item-label v-if="member.summary" class="text-h6"
>Description:
Expand Down
Loading