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AEM,eAAe;QACpB,MAAM,GAAG,GAAgB,IAAI,yBAAW,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;QAChF,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACjB,OAAO,GAAG,CAAC;IACb,CAAC;IAED,gBAAgB;IACN,eAAe;QACvB,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;CACF;AA3DD,4BA2DC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { type IDocNodeParameters, DocNode } from '@microsoft/tsdoc';\nimport { CustomDocNodeKind } from './CustomDocNodeKind';\nimport { DocTableRow } from './DocTableRow';\nimport type { DocTableCell } from './DocTableCell';\n\n/**\n * Constructor parameters for {@link DocTable}.\n */\nexport interface IDocTableParameters extends IDocNodeParameters {\n headerCells?: ReadonlyArray<DocTableCell>;\n headerTitles?: string[];\n}\n\n/**\n * Represents table, similar to an HTML `<table>` element.\n */\nexport class DocTable extends DocNode {\n public readonly header: DocTableRow;\n\n private _rows: DocTableRow[];\n\n public constructor(parameters: IDocTableParameters, rows?: ReadonlyArray<DocTableRow>) {\n super(parameters);\n\n this.header = new DocTableRow({ configuration: this.configuration });\n this._rows = [];\n\n if (parameters) {\n if (parameters.headerTitles) {\n if (parameters.headerCells) {\n throw new Error(\n 'IDocTableParameters.headerCells and IDocTableParameters.headerTitles' +\n ' cannot both be specified'\n );\n }\n for (const cellText of parameters.headerTitles) {\n this.header.addPlainTextCell(cellText);\n }\n } else if (parameters.headerCells) {\n for (const cell of parameters.headerCells) {\n this.header.addCell(cell);\n }\n }\n }\n\n if (rows) {\n for (const row of rows) {\n this.addRow(row);\n }\n }\n }\n\n /** @override */\n public get kind(): string {\n return CustomDocNodeKind.Table;\n }\n\n public get rows(): ReadonlyArray<DocTableRow> {\n return this._rows;\n }\n\n public addRow(row: DocTableRow): void {\n this._rows.push(row);\n }\n\n public createAndAddRow(): DocTableRow {\n const row: DocTableRow = new DocTableRow({ configuration: this.configuration });\n this.addRow(row);\n return row;\n }\n\n /** @override */\n protected onGetChildNodes(): ReadonlyArray<DocNode | undefined> {\n return [this.header, ...this._rows];\n }\n}\n"]} |