UNPKG

4.67 kBSource Map (JSON)View Raw
1{"version":3,"file":"NavigationItem.js","sourceRoot":"","sources":["../../../../src/lib/output/models/NavigationItem.ts"],"names":[],"mappings":";;AASA,MAAa,cAAc;IAsEvB,YAAY,KAAc,EAAE,GAAY,EAAE,MAAuB,EAAE,UAAmB,EAAE,UAAuB;QAC3G,IAAI,CAAC,KAAK,GAAG,KAAK,IAAI,EAAE,CAAC;QACzB,IAAI,CAAC,GAAG,GAAG,GAAG,IAAI,EAAE,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,UAAU,IAAI,EAAE,CAAC;QACnC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAE7B,IAAI,CAAC,GAAG,EAAE;YACN,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;SACvB;QAED,IAAI,IAAI,CAAC,MAAM,EAAE;YACb,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;gBACvB,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,EAAE,CAAC;aAC7B;YACD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACnC;IACL,CAAC;IASD,MAAM,CAAC,MAAM,CAAC,UAAsB,EAAE,MAAuB,EAAE,aAAuB;QAClF,IAAI,IAAY,CAAC;QACjB,IAAI,aAAa,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,EAAE;YAC5C,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;SAC1B;aAAM;YACH,IAAI,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC;SACnC;QAED,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QACnB,IAAI,IAAI,KAAK,EAAE,EAAE;YACb,IAAI,GAAG,OAAO,UAAU,CAAC,UAAU,OAAO,CAAC;SAC9C;QAED,OAAO,IAAI,cAAc,CAAC,IAAI,EAAE,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAC/F,CAAC;CACJ;AA/GD,wCA+GC","sourcesContent":["import { Reflection } from '../../models/reflections/abstract';\n\n/**\n * A hierarchical model holding the data of single node within the navigation.\n *\n * This structure is used by the [[NavigationPlugin]] and [[TocPlugin]] to expose the current\n * navigation state to the template engine. Themes should generate the primary navigation structure\n * through the [[BaseTheme.getNavigation]] method.\n */\nexport class NavigationItem {\n /**\n * The visible title of the navigation node.\n */\n title: string;\n\n /**\n * The url this navigation node points to.\n */\n url: string;\n\n /**\n * A list of urls that should be seen as sub-pages of this node.\n */\n dedicatedUrls?: string[];\n\n /**\n * The parent navigation node.\n */\n parent?: NavigationItem;\n\n /**\n * An array containing all child navigation nodes.\n */\n children?: NavigationItem[];\n\n /**\n * A string containing the css classes of this node.\n */\n cssClasses: string;\n\n /**\n * Is this item a simple label without a link?\n */\n isLabel?: boolean;\n\n /**\n * Is this item visible?\n */\n isVisible?: boolean;\n\n /**\n * Does this navigation node represent the current page?\n */\n isCurrent?: boolean;\n\n /**\n * Is this the navigation node for the globals page?\n */\n isGlobals?: boolean;\n\n /**\n * Is this navigation node one of the parents of the current page?\n */\n isInPath?: boolean;\n\n /**\n * The source [Reflection] this item is built from\n */\n reflection?: Reflection;\n\n /**\n * Create a new NavigationItem instance.\n *\n * @param title The visible title of the navigation node.\n * @param url The url this navigation node points to.\n * @param parent The parent navigation node.\n * @param cssClasses A string containing the css classes of this node.\n * @param reflection The source [Reflection] for this [NavigationItem]\n */\n constructor(title?: string, url?: string, parent?: NavigationItem, cssClasses?: string, reflection?: Reflection) {\n this.title = title || '';\n this.url = url || '';\n this.parent = parent;\n this.cssClasses = cssClasses || '';\n this.reflection = reflection;\n\n if (!url) {\n this.isLabel = true;\n }\n\n if (this.parent) {\n if (!this.parent.children) {\n this.parent.children = [];\n }\n this.parent.children.push(this);\n }\n }\n\n /**\n * Create a navigation node for the given reflection.\n *\n * @param reflection The reflection whose navigation node should be created.\n * @param parent The parent navigation node.\n * @param useShortNames Force this function to always use short names.\n */\n static create(reflection: Reflection, parent?: NavigationItem, useShortNames?: boolean) {\n let name: string;\n if (useShortNames || (parent && parent.parent)) {\n name = reflection.name;\n } else {\n name = reflection.getFullName();\n }\n\n name = name.trim();\n if (name === '') {\n name = `<em>${reflection.kindString}</em>`;\n }\n\n return new NavigationItem(name, reflection.url, parent, reflection.cssClasses, reflection);\n }\n}\n"]}
\No newline at end of file