mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-2979] Updated props script to avoid copying missing JSDocs (#3327)
* [ADF-2979] Updated tools to ignore blank JSDocs for inputs/outputs * [ADF-2979] Bug fixes for handling missing tables, etc
This commit is contained in:
committed by
Eugenio Romano
parent
25f20dbec9
commit
92e0809a16
81
tools/doc/mdNav.ts
Normal file
81
tools/doc/mdNav.ts
Normal file
@@ -0,0 +1,81 @@
|
||||
|
||||
export class MDNav {
|
||||
|
||||
constructor(public root: any, public pos: number = 0) {}
|
||||
|
||||
find(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
|
||||
if (!this.root || !this.root.children) {
|
||||
return new MDNav(null);
|
||||
}
|
||||
|
||||
let currIndex = 0;
|
||||
|
||||
for (let i = this.pos; i < this.root.children.length; i++) {
|
||||
let child = this.root.children[i];
|
||||
|
||||
if (test(child)) {
|
||||
if (currIndex === index) {
|
||||
return new MDNav(this.root, i);
|
||||
} else {
|
||||
currIndex++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new MDNav(this.root, this.root.children.length);
|
||||
}
|
||||
|
||||
|
||||
heading(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
|
||||
return this.find((h) => {
|
||||
return h.type === "heading" && test(h);
|
||||
}, index);
|
||||
}
|
||||
|
||||
|
||||
table(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
|
||||
return this.find((h) => {
|
||||
return h.type === "table" && test(h);
|
||||
}, index);
|
||||
}
|
||||
|
||||
|
||||
text(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
|
||||
return this.find((h) => {
|
||||
return h.type === "text" && test(h);
|
||||
}, index);
|
||||
}
|
||||
|
||||
|
||||
tableRow(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
|
||||
return this.find((h) => {
|
||||
return h.type === "tableRow" && test(h);
|
||||
}, index);
|
||||
}
|
||||
|
||||
|
||||
tableCell(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
|
||||
return this.find((h) => {
|
||||
return h.type === "tableCell" && test(h);
|
||||
}, index);
|
||||
}
|
||||
|
||||
get item(): any {
|
||||
if (!this.root || !this.root.children) {
|
||||
return undefined;
|
||||
} else {
|
||||
return this.root.children[this.pos];
|
||||
}
|
||||
}
|
||||
|
||||
get empty(): boolean {
|
||||
return !this.root ||
|
||||
!this.root.children ||
|
||||
(this.pos >= this.root.children.length);
|
||||
}
|
||||
|
||||
|
||||
get childNav() {
|
||||
return new MDNav(this.item);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user