@zoodogood/utils 1.0.7-change.843 → 1.0.7-change.854
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -60,7 +60,7 @@ declare class TextTableBuilder {
|
|
|
60
60
|
addMultilineRowWithElements(elements: ITableCell["value"][], optionsForEveryElement?: Partial<ICellOptions>, useOnAddingOptions?: ICellBuilderOptions): this;
|
|
61
61
|
addEmptyRow(): this;
|
|
62
62
|
addRowSeparator(setSymbol?: TCellSetSymbolCallback): this;
|
|
63
|
-
addCellAtRow(rowIndex: number, cellValue: ITableCell["value"], cellOptions: ICellOptions): this;
|
|
63
|
+
addCellAtRow(rowIndex: number, cellValue: ITableCell["value"], cellOptions: ICellOptions, useOnAddingOptions: ICellBuilderOptions): this;
|
|
64
64
|
private pushCellToArray;
|
|
65
65
|
private pushRowToTable;
|
|
66
66
|
generateTextContent(): string;
|
|
@@ -7,6 +7,12 @@ function getRowType(row) {
|
|
|
7
7
|
function isCell(target) {
|
|
8
8
|
return "value" in target && "options" in target;
|
|
9
9
|
}
|
|
10
|
+
function emptyCell(value = "") {
|
|
11
|
+
return {
|
|
12
|
+
value,
|
|
13
|
+
options: DEFAULT_CELL_OPTIONS,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
10
16
|
function addPaddingByCellAlign(original, totalForAdd, align) {
|
|
11
17
|
const addidableGapLeft = align === CellAlignEnum.Right
|
|
12
18
|
? totalForAdd
|
|
@@ -88,9 +94,12 @@ class TextTableGenerator {
|
|
|
88
94
|
.filter((row) => getRowType(row) === SpecialRowTypeEnum.Default)
|
|
89
95
|
.map((row) => row.length));
|
|
90
96
|
for (let index = 0; index < largestCellsCount; index++) {
|
|
91
|
-
const column = rows.map((row) =>
|
|
92
|
-
|
|
93
|
-
|
|
97
|
+
const column = rows.map((row) => {
|
|
98
|
+
var _a;
|
|
99
|
+
return getRowType(row) === SpecialRowTypeEnum.Default
|
|
100
|
+
? (_a = row.at(index)) !== null && _a !== void 0 ? _a : emptyCell()
|
|
101
|
+
: { row };
|
|
102
|
+
});
|
|
94
103
|
columns.push(column);
|
|
95
104
|
}
|
|
96
105
|
return columns;
|
|
@@ -266,15 +275,15 @@ class TextTableBuilder {
|
|
|
266
275
|
this.pushRowToTable(row);
|
|
267
276
|
return this;
|
|
268
277
|
}
|
|
269
|
-
addCellAtRow(rowIndex, cellValue, cellOptions) {
|
|
278
|
+
addCellAtRow(rowIndex, cellValue, cellOptions, useOnAddingOptions) {
|
|
270
279
|
const row = this.rows.at(rowIndex);
|
|
271
280
|
if (!row) {
|
|
272
|
-
throw new RangeError(
|
|
281
|
+
throw new RangeError();
|
|
273
282
|
}
|
|
274
283
|
if (getRowType(row) !== SpecialRowTypeEnum.Default) {
|
|
275
284
|
throw new Error("Is not default row: without cells");
|
|
276
285
|
}
|
|
277
|
-
this.pushCellToArray(row, cellValue, cellOptions);
|
|
286
|
+
this.pushCellToArray(row, cellValue, cellOptions, useOnAddingOptions);
|
|
278
287
|
return this;
|
|
279
288
|
}
|
|
280
289
|
pushCellToArray(array, cellValue, cellOptions = {}, pushOptions) {
|