UNPKG

2.9 kBSource Map (JSON)View Raw
1{"version":3,"file":"ReflectionCategory.js","sourceRoot":"","sources":["../../../src/lib/models/ReflectionCategory.ts"],"names":[],"mappings":";;AASA,MAAa,kBAAkB;IAwB3B,YAAY,KAAa;QAfzB,aAAQ,GAAiB,EAAE,CAAC;QAgBxB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QAEnB,IAAI,CAAC,0BAA0B,GAAG,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,6BAA6B,EAAE,CAAC,CAAC;IACnF,CAAC;IAKO,6BAA6B;QACjC,IAAI,gBAAgB,GAAG,IAAI,CAAC;QAC5B,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YAC5B,gBAAgB,GAAG,gBAAgB,IAAI,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC;QAClE,CAAC,CAAC,CAAC;QAEH,OAAO,gBAAgB,CAAC;IAC5B,CAAC;IAMD,QAAQ;QACJ,MAAM,MAAM,GAAG;YACX,KAAK,EAAE,IAAI,CAAC,KAAK;SACpB,CAAC;QAEF,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,MAAM,QAAQ,GAAU,EAAE,CAAC;YAC3B,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;gBAC5B,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YAC5B,CAAC,CAAC,CAAC;YAEH,MAAM,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAC;SACjC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AA9DD,gDA8DC","sourcesContent":["import { Reflection } from './reflections/abstract';\n\n/**\n * A category of reflections.\n *\n * Reflection categories are created by the ´CategoryPlugin´ in the resolving phase\n * of the dispatcher. The main purpose of categories is to be able to more easily\n * render human readable children lists in templates.\n */\nexport class ReflectionCategory {\n /**\n * The title, a string representation of this category.\n */\n title: string;\n\n /**\n * All reflections of this category.\n */\n children: Reflection[] = [];\n\n /**\n * Do all children of this category have a separate document?\n *\n * A bound representation of the ´ReflectionCategory.getAllChildrenHaveOwnDocument´\n * that can be used within templates.\n */\n allChildrenHaveOwnDocument: Function;\n\n /**\n * Create a new ReflectionCategory instance.\n *\n * @param title The title of this category.\n */\n constructor(title: string) {\n this.title = title;\n\n this.allChildrenHaveOwnDocument = (() => this.getAllChildrenHaveOwnDocument());\n }\n\n /**\n * Do all children of this category have a separate document?\n */\n private getAllChildrenHaveOwnDocument(): boolean {\n let onlyOwnDocuments = true;\n this.children.forEach((child) => {\n onlyOwnDocuments = onlyOwnDocuments && !!child.hasOwnDocument;\n });\n\n return onlyOwnDocuments;\n }\n\n /**\n * Return a raw object representation of this reflection category.\n * @deprecated Use serializers instead\n */\n toObject(): any {\n const result = {\n title: this.title\n };\n\n if (this.children) {\n const children: any[] = [];\n this.children.forEach((child) => {\n children.push(child.id);\n });\n\n result['children'] = children;\n }\n\n return result;\n }\n}\n"]}
\No newline at end of file