1 | "use strict";
|
2 |
|
3 |
|
4 | Object.defineProperty(exports, "__esModule", { value: true });
|
5 | exports.DocTable = void 0;
|
6 | const tsdoc_1 = require("@microsoft/tsdoc");
|
7 | const DocTableRow_1 = require("./DocTableRow");
|
8 |
|
9 |
|
10 |
|
11 | class DocTable extends tsdoc_1.DocNode {
|
12 | constructor(parameters, rows) {
|
13 | super(parameters);
|
14 | this.header = new DocTableRow_1.DocTableRow({ configuration: this.configuration });
|
15 | this._rows = [];
|
16 | if (parameters) {
|
17 | if (parameters.headerTitles) {
|
18 | if (parameters.headerCells) {
|
19 | throw new Error('IDocTableParameters.headerCells and IDocTableParameters.headerTitles' +
|
20 | ' cannot both be specified');
|
21 | }
|
22 | for (const cellText of parameters.headerTitles) {
|
23 | this.header.addPlainTextCell(cellText);
|
24 | }
|
25 | }
|
26 | else if (parameters.headerCells) {
|
27 | for (const cell of parameters.headerCells) {
|
28 | this.header.addCell(cell);
|
29 | }
|
30 | }
|
31 | }
|
32 | if (rows) {
|
33 | for (const row of rows) {
|
34 | this.addRow(row);
|
35 | }
|
36 | }
|
37 | }
|
38 |
|
39 | get kind() {
|
40 | return "Table" ;
|
41 | }
|
42 | get rows() {
|
43 | return this._rows;
|
44 | }
|
45 | addRow(row) {
|
46 | this._rows.push(row);
|
47 | }
|
48 | createAndAddRow() {
|
49 | const row = new DocTableRow_1.DocTableRow({ configuration: this.configuration });
|
50 | this.addRow(row);
|
51 | return row;
|
52 | }
|
53 |
|
54 | onGetChildNodes() {
|
55 | return [this.header, ...this._rows];
|
56 | }
|
57 | }
|
58 | exports.DocTable = DocTable;
|
59 |
|
\ | No newline at end of file |