cdk-common 2.0.26 → 2.0.30
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.
- package/.jsii +2 -2
- package/lib/main.js +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/net.d.ts +1 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/concat-stream/node_modules/@types/node/process.d.ts +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/net.d.ts +1 -0
- package/node_modules/@types/form-data/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/form-data/node_modules/@types/node/process.d.ts +1 -1
- package/node_modules/graceful-fs/package.json +1 -1
- package/node_modules/graceful-fs/polyfills.js +4 -2
- package/node_modules/table/README.md +79 -1
- package/node_modules/table/dist/src/alignSpanningCell.d.ts +7 -0
- package/node_modules/table/dist/src/alignSpanningCell.js +44 -0
- package/node_modules/table/dist/src/alignSpanningCell.js.map +1 -0
- package/node_modules/table/dist/src/alignString.js.map +1 -0
- package/node_modules/table/dist/src/alignTableData.js +7 -1
- package/node_modules/table/dist/src/alignTableData.js.map +1 -0
- package/node_modules/table/dist/src/calculateCellHeight.js.map +1 -0
- package/node_modules/table/dist/src/calculateMaximumColumnWidths.d.ts +7 -0
- package/node_modules/table/dist/src/calculateMaximumColumnWidths.js +36 -0
- package/node_modules/table/dist/src/calculateMaximumColumnWidths.js.map +1 -0
- package/node_modules/table/dist/src/calculateOutputColumnWidths.d.ts +2 -0
- package/node_modules/table/dist/src/calculateOutputColumnWidths.js +10 -0
- package/node_modules/table/dist/src/calculateOutputColumnWidths.js.map +1 -0
- package/node_modules/table/dist/src/calculateRowHeights.js +28 -5
- package/node_modules/table/dist/src/calculateRowHeights.js.map +1 -0
- package/node_modules/table/dist/src/calculateSpanningCellWidth.d.ts +3 -0
- package/node_modules/table/dist/src/calculateSpanningCellWidth.js +26 -0
- package/node_modules/table/dist/src/calculateSpanningCellWidth.js.map +1 -0
- package/node_modules/table/dist/src/createStream.js +2 -1
- package/node_modules/table/dist/src/createStream.js.map +1 -0
- package/node_modules/table/dist/src/drawBorder.d.ts +27 -19
- package/node_modules/table/dist/src/drawBorder.js +164 -63
- package/node_modules/table/dist/src/drawBorder.js.map +1 -0
- package/node_modules/table/dist/src/drawContent.d.ts +10 -5
- package/node_modules/table/dist/src/drawContent.js +31 -7
- package/node_modules/table/dist/src/drawContent.js.map +1 -0
- package/node_modules/table/dist/src/drawRow.d.ts +6 -2
- package/node_modules/table/dist/src/drawRow.js +6 -2
- package/node_modules/table/dist/src/drawRow.js.map +1 -0
- package/node_modules/table/dist/src/drawTable.d.ts +1 -1
- package/node_modules/table/dist/src/drawTable.js +10 -18
- package/node_modules/table/dist/src/drawTable.js.map +1 -0
- package/node_modules/table/dist/src/generated/validators.d.ts +2 -2
- package/node_modules/table/dist/src/generated/validators.js +746 -223
- package/node_modules/table/dist/src/generated/validators.js.map +1 -0
- package/node_modules/table/dist/src/getBorderCharacters.js +16 -0
- package/node_modules/table/dist/src/getBorderCharacters.js.map +1 -0
- package/node_modules/table/dist/src/index.js.map +1 -0
- package/node_modules/table/dist/src/injectHeaderConfig.d.ts +3 -0
- package/node_modules/table/dist/src/injectHeaderConfig.js +29 -0
- package/node_modules/table/dist/src/injectHeaderConfig.js.map +1 -0
- package/node_modules/table/dist/src/makeRangeConfig.d.ts +3 -0
- package/node_modules/table/dist/src/makeRangeConfig.js +18 -0
- package/node_modules/table/dist/src/makeRangeConfig.js.map +1 -0
- package/node_modules/table/dist/src/makeStreamConfig.js.map +1 -0
- package/node_modules/table/dist/src/makeTableConfig.d.ts +2 -2
- package/node_modules/table/dist/src/makeTableConfig.js +26 -29
- package/node_modules/table/dist/src/makeTableConfig.js.map +1 -0
- package/node_modules/table/dist/src/mapDataUsingRowHeights.d.ts +2 -0
- package/node_modules/table/dist/src/mapDataUsingRowHeights.js +17 -10
- package/node_modules/table/dist/src/mapDataUsingRowHeights.js.map +1 -0
- package/node_modules/table/dist/src/padTableData.js +7 -1
- package/node_modules/table/dist/src/padTableData.js.map +1 -0
- package/node_modules/table/dist/src/schemas/config.json +95 -0
- package/node_modules/table/dist/src/schemas/shared.json +139 -0
- package/node_modules/table/dist/src/schemas/streamConfig.json +25 -0
- package/node_modules/table/dist/src/spanningCellManager.d.ts +21 -0
- package/node_modules/table/dist/src/spanningCellManager.js +86 -0
- package/node_modules/table/dist/src/spanningCellManager.js.map +1 -0
- package/node_modules/table/dist/src/stringifyTableData.js.map +1 -0
- package/node_modules/table/dist/src/table.js +9 -5
- package/node_modules/table/dist/src/table.js.map +1 -0
- package/node_modules/table/dist/src/truncateTableData.d.ts +2 -2
- package/node_modules/table/dist/src/truncateTableData.js +2 -2
- package/node_modules/table/dist/src/truncateTableData.js.map +1 -0
- package/node_modules/table/dist/src/types/api.d.ts +21 -5
- package/node_modules/table/dist/src/types/api.js.map +1 -0
- package/node_modules/table/dist/src/types/internal.js.map +1 -0
- package/node_modules/table/dist/src/utils.d.ts +10 -1
- package/node_modules/table/dist/src/utils.js +51 -1
- package/node_modules/table/dist/src/utils.js.map +1 -0
- package/node_modules/table/dist/src/validateConfig.js.map +1 -0
- package/node_modules/table/dist/src/validateSpanningCellConfig.d.ts +3 -0
- package/node_modules/table/dist/src/validateSpanningCellConfig.js +46 -0
- package/node_modules/table/dist/src/validateSpanningCellConfig.js.map +1 -0
- package/node_modules/table/dist/src/validateTableData.js.map +1 -0
- package/node_modules/table/dist/src/wrapCell.js.map +1 -0
- package/node_modules/table/dist/src/wrapString.js.map +1 -0
- package/node_modules/table/dist/src/wrapWord.js +2 -2
- package/node_modules/table/dist/src/wrapWord.js.map +1 -0
- package/node_modules/table/package.json +2 -3
- package/package.json +3 -3
- package/node_modules/table/dist/src/calculateCellWidths.d.ts +0 -5
- package/node_modules/table/dist/src/calculateCellWidths.js +0 -17
- package/node_modules/table/dist/src/calculateColumnWidths.d.ts +0 -6
- package/node_modules/table/dist/src/calculateColumnWidths.js +0 -17
- package/node_modules/table/dist/src/drawHeader.d.ts +0 -2
- package/node_modules/table/dist/src/drawHeader.js +0 -30
|
@@ -1,34 +1,150 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.createTableBorderGetter = exports.drawBorderBottom = exports.drawBorderJoin = exports.drawBorderTop = exports.drawBorder = exports.createSeparatorGetter = exports.drawBorderSegments = void 0;
|
|
4
4
|
const drawContent_1 = require("./drawContent");
|
|
5
|
-
const
|
|
6
|
-
const { separator,
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
const drawBorderSegments = (columnWidths, parameters) => {
|
|
6
|
+
const { separator, horizontalBorderIndex, spanningCellManager } = parameters;
|
|
7
|
+
return columnWidths.map((columnWidth, columnIndex) => {
|
|
8
|
+
const normalSegment = separator.body.repeat(columnWidth);
|
|
9
|
+
if (horizontalBorderIndex === undefined) {
|
|
10
|
+
return normalSegment;
|
|
11
|
+
}
|
|
12
|
+
/* istanbul ignore next */
|
|
13
|
+
const range = spanningCellManager === null || spanningCellManager === void 0 ? void 0 : spanningCellManager.getContainingRange({ col: columnIndex,
|
|
14
|
+
row: horizontalBorderIndex });
|
|
15
|
+
if (!range) {
|
|
16
|
+
return normalSegment;
|
|
17
|
+
}
|
|
18
|
+
const { topLeft } = range;
|
|
19
|
+
// draw border segments as usual for top border of spanning cell
|
|
20
|
+
if (horizontalBorderIndex === topLeft.row) {
|
|
21
|
+
return normalSegment;
|
|
22
|
+
}
|
|
23
|
+
// if for first column/row of spanning cell, just skip
|
|
24
|
+
if (columnIndex !== topLeft.col) {
|
|
25
|
+
return '';
|
|
26
|
+
}
|
|
27
|
+
return range.extractBorderContent(horizontalBorderIndex);
|
|
9
28
|
});
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
29
|
+
};
|
|
30
|
+
exports.drawBorderSegments = drawBorderSegments;
|
|
31
|
+
const createSeparatorGetter = (dependencies) => {
|
|
32
|
+
const { separator, spanningCellManager, horizontalBorderIndex, rowCount } = dependencies;
|
|
33
|
+
// eslint-disable-next-line complexity
|
|
34
|
+
return (verticalBorderIndex, columnCount) => {
|
|
35
|
+
const inSameRange = spanningCellManager === null || spanningCellManager === void 0 ? void 0 : spanningCellManager.inSameRange;
|
|
36
|
+
if (horizontalBorderIndex !== undefined && inSameRange) {
|
|
37
|
+
const topCell = { col: verticalBorderIndex,
|
|
38
|
+
row: horizontalBorderIndex - 1 };
|
|
39
|
+
const leftCell = { col: verticalBorderIndex - 1,
|
|
40
|
+
row: horizontalBorderIndex };
|
|
41
|
+
const oppositeCell = { col: verticalBorderIndex - 1,
|
|
42
|
+
row: horizontalBorderIndex - 1 };
|
|
43
|
+
const currentCell = { col: verticalBorderIndex,
|
|
44
|
+
row: horizontalBorderIndex };
|
|
45
|
+
const pairs = [
|
|
46
|
+
[oppositeCell, topCell],
|
|
47
|
+
[topCell, currentCell],
|
|
48
|
+
[currentCell, leftCell],
|
|
49
|
+
[leftCell, oppositeCell],
|
|
50
|
+
];
|
|
51
|
+
// left side of horizontal border
|
|
52
|
+
if (verticalBorderIndex === 0) {
|
|
53
|
+
if (inSameRange(currentCell, topCell) && separator.bodyJoinOuter) {
|
|
54
|
+
return separator.bodyJoinOuter;
|
|
55
|
+
}
|
|
14
56
|
return separator.left;
|
|
15
57
|
}
|
|
16
|
-
|
|
58
|
+
// right side of horizontal border
|
|
59
|
+
if (verticalBorderIndex === columnCount) {
|
|
60
|
+
if (inSameRange(oppositeCell, leftCell) && separator.bodyJoinOuter) {
|
|
61
|
+
return separator.bodyJoinOuter;
|
|
62
|
+
}
|
|
17
63
|
return separator.right;
|
|
18
64
|
}
|
|
19
|
-
|
|
20
|
-
|
|
65
|
+
// top horizontal border
|
|
66
|
+
if (horizontalBorderIndex === 0) {
|
|
67
|
+
if (inSameRange(currentCell, leftCell)) {
|
|
68
|
+
return separator.body;
|
|
69
|
+
}
|
|
70
|
+
return separator.join;
|
|
71
|
+
}
|
|
72
|
+
// bottom horizontal border
|
|
73
|
+
if (horizontalBorderIndex === rowCount) {
|
|
74
|
+
if (inSameRange(topCell, oppositeCell)) {
|
|
75
|
+
return separator.body;
|
|
76
|
+
}
|
|
77
|
+
return separator.join;
|
|
78
|
+
}
|
|
79
|
+
const sameRangeCount = pairs.map((pair) => {
|
|
80
|
+
return inSameRange(...pair);
|
|
81
|
+
}).filter(Boolean).length;
|
|
82
|
+
// four cells are belongs to different spanning cells
|
|
83
|
+
if (sameRangeCount === 0) {
|
|
84
|
+
return separator.join;
|
|
85
|
+
}
|
|
86
|
+
// belong to one spanning cell
|
|
87
|
+
if (sameRangeCount === 4) {
|
|
88
|
+
return '';
|
|
89
|
+
}
|
|
90
|
+
// belongs to two spanning cell
|
|
91
|
+
if (sameRangeCount === 2) {
|
|
92
|
+
if (inSameRange(...pairs[1]) && inSameRange(...pairs[3]) && separator.bodyJoinInner) {
|
|
93
|
+
return separator.bodyJoinInner;
|
|
94
|
+
}
|
|
95
|
+
return separator.body;
|
|
96
|
+
}
|
|
97
|
+
/* istanbul ignore next */
|
|
98
|
+
if (sameRangeCount === 1) {
|
|
99
|
+
if (!separator.joinRight || !separator.joinLeft || !separator.joinUp || !separator.joinDown) {
|
|
100
|
+
throw new Error(`Can not get border separator for position [${horizontalBorderIndex}, ${verticalBorderIndex}]`);
|
|
101
|
+
}
|
|
102
|
+
if (inSameRange(...pairs[0])) {
|
|
103
|
+
return separator.joinDown;
|
|
104
|
+
}
|
|
105
|
+
if (inSameRange(...pairs[1])) {
|
|
106
|
+
return separator.joinLeft;
|
|
107
|
+
}
|
|
108
|
+
if (inSameRange(...pairs[2])) {
|
|
109
|
+
return separator.joinUp;
|
|
110
|
+
}
|
|
111
|
+
return separator.joinRight;
|
|
112
|
+
}
|
|
113
|
+
/* istanbul ignore next */
|
|
114
|
+
throw new Error('Invalid case');
|
|
115
|
+
}
|
|
116
|
+
if (verticalBorderIndex === 0) {
|
|
117
|
+
return separator.left;
|
|
118
|
+
}
|
|
119
|
+
if (verticalBorderIndex === columnCount) {
|
|
120
|
+
return separator.right;
|
|
121
|
+
}
|
|
122
|
+
return separator.join;
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
exports.createSeparatorGetter = createSeparatorGetter;
|
|
126
|
+
const drawBorder = (columnWidths, parameters) => {
|
|
127
|
+
const borderSegments = (0, exports.drawBorderSegments)(columnWidths, parameters);
|
|
128
|
+
const { drawVerticalLine, horizontalBorderIndex, spanningCellManager } = parameters;
|
|
129
|
+
return (0, drawContent_1.drawContent)({
|
|
130
|
+
contents: borderSegments,
|
|
131
|
+
drawSeparator: drawVerticalLine,
|
|
132
|
+
elementType: 'border',
|
|
133
|
+
rowIndex: horizontalBorderIndex,
|
|
134
|
+
separatorGetter: (0, exports.createSeparatorGetter)(parameters),
|
|
135
|
+
spanningCellManager,
|
|
21
136
|
}) + '\n';
|
|
22
137
|
};
|
|
23
138
|
exports.drawBorder = drawBorder;
|
|
24
|
-
const drawBorderTop = (columnWidths,
|
|
25
|
-
const
|
|
26
|
-
|
|
139
|
+
const drawBorderTop = (columnWidths, parameters) => {
|
|
140
|
+
const { border } = parameters;
|
|
141
|
+
const result = (0, exports.drawBorder)(columnWidths, {
|
|
142
|
+
...parameters,
|
|
27
143
|
separator: {
|
|
28
|
-
body:
|
|
29
|
-
join:
|
|
30
|
-
left:
|
|
31
|
-
right:
|
|
144
|
+
body: border.topBody,
|
|
145
|
+
join: border.topJoin,
|
|
146
|
+
left: border.topLeft,
|
|
147
|
+
right: border.topRight,
|
|
32
148
|
},
|
|
33
149
|
});
|
|
34
150
|
if (result === '\n') {
|
|
@@ -37,64 +153,49 @@ const drawBorderTop = (columnWidths, config) => {
|
|
|
37
153
|
return result;
|
|
38
154
|
};
|
|
39
155
|
exports.drawBorderTop = drawBorderTop;
|
|
40
|
-
const drawBorderJoin = (columnWidths,
|
|
41
|
-
|
|
42
|
-
|
|
156
|
+
const drawBorderJoin = (columnWidths, parameters) => {
|
|
157
|
+
const { border } = parameters;
|
|
158
|
+
return (0, exports.drawBorder)(columnWidths, {
|
|
159
|
+
...parameters,
|
|
43
160
|
separator: {
|
|
44
|
-
body:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
161
|
+
body: border.joinBody,
|
|
162
|
+
bodyJoinInner: border.bodyJoin,
|
|
163
|
+
bodyJoinOuter: border.bodyLeft,
|
|
164
|
+
join: border.joinJoin,
|
|
165
|
+
joinDown: border.joinMiddleDown,
|
|
166
|
+
joinLeft: border.joinMiddleLeft,
|
|
167
|
+
joinRight: border.joinMiddleRight,
|
|
168
|
+
joinUp: border.joinMiddleUp,
|
|
169
|
+
left: border.joinLeft,
|
|
170
|
+
right: border.joinRight,
|
|
48
171
|
},
|
|
49
172
|
});
|
|
50
173
|
};
|
|
51
174
|
exports.drawBorderJoin = drawBorderJoin;
|
|
52
|
-
const drawBorderBottom = (columnWidths,
|
|
53
|
-
|
|
54
|
-
|
|
175
|
+
const drawBorderBottom = (columnWidths, parameters) => {
|
|
176
|
+
const { border } = parameters;
|
|
177
|
+
return (0, exports.drawBorder)(columnWidths, {
|
|
178
|
+
...parameters,
|
|
55
179
|
separator: {
|
|
56
|
-
body:
|
|
57
|
-
join:
|
|
58
|
-
left:
|
|
59
|
-
right:
|
|
180
|
+
body: border.bottomBody,
|
|
181
|
+
join: border.bottomJoin,
|
|
182
|
+
left: border.bottomLeft,
|
|
183
|
+
right: border.bottomRight,
|
|
60
184
|
},
|
|
61
185
|
});
|
|
62
186
|
};
|
|
63
187
|
exports.drawBorderBottom = drawBorderBottom;
|
|
64
|
-
const createTableBorderGetter = (columnWidths,
|
|
188
|
+
const createTableBorderGetter = (columnWidths, parameters) => {
|
|
65
189
|
return (index, size) => {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return drawBorderTop(columnWidths, config);
|
|
69
|
-
}
|
|
70
|
-
if (index === size) {
|
|
71
|
-
return drawBorderBottom(columnWidths, config);
|
|
72
|
-
}
|
|
73
|
-
return drawBorderJoin(columnWidths, config);
|
|
74
|
-
}
|
|
75
|
-
// Deal with the header
|
|
190
|
+
const drawBorderParameters = { ...parameters,
|
|
191
|
+
horizontalBorderIndex: index };
|
|
76
192
|
if (index === 0) {
|
|
77
|
-
return drawBorderTop(columnWidths,
|
|
78
|
-
...config,
|
|
79
|
-
border: {
|
|
80
|
-
...config.border,
|
|
81
|
-
topJoin: config.border.topBody,
|
|
82
|
-
},
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
if (index === 1) {
|
|
86
|
-
return drawBorderJoin(columnWidths, {
|
|
87
|
-
...config,
|
|
88
|
-
border: {
|
|
89
|
-
...config.border,
|
|
90
|
-
joinJoin: config.border.headerJoin,
|
|
91
|
-
},
|
|
92
|
-
});
|
|
193
|
+
return (0, exports.drawBorderTop)(columnWidths, drawBorderParameters);
|
|
93
194
|
}
|
|
94
|
-
if (index === size) {
|
|
95
|
-
return drawBorderBottom(columnWidths,
|
|
195
|
+
else if (index === size) {
|
|
196
|
+
return (0, exports.drawBorderBottom)(columnWidths, drawBorderParameters);
|
|
96
197
|
}
|
|
97
|
-
return drawBorderJoin(columnWidths,
|
|
198
|
+
return (0, exports.drawBorderJoin)(columnWidths, drawBorderParameters);
|
|
98
199
|
};
|
|
99
200
|
};
|
|
100
201
|
exports.createTableBorderGetter = createTableBorderGetter;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawBorder.js","sourceRoot":"","sources":["../../src/drawBorder.ts"],"names":[],"mappings":";;;AAAA,+CAEuB;AA0BhB,MAAM,kBAAkB,GAAG,CAAC,YAAsB,EAAE,UAA4C,EAAY,EAAE;IACnH,MAAM,EAAC,SAAS,EAAE,qBAAqB,EAAE,mBAAmB,EAAC,GAAG,UAAU,CAAC;IAE3E,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC,WAA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1B;KACF,CAAC,CAAC;AACL,CAAC,CAAC;AAZW,QAAA,gBAAgB,oBAY3B;AAaK,MAAM,uBAAuB,GAAG,CAAC,YAAsB,EAAE,UAAkC,EAAmB,EAAE;IACrH,OAAO,CAAC,KAAa,EAAE,IAAY,EAAE,EAAE;QACrC,MAAM,oBAAoB,GAAyB,EAAC,GAAG,UAAU;YAC/D,qBAAqB,EAAE,KAAK,EAAC,CAAC;QAEhC,IAAI,KAAK,KAAK,CAAC,EAAE;YACf,OAAO,IAAA,qBAAa,EAAC,YAAY,EAAE,oBAAoB,CAAC,CAAC;SAC1D;aAAM,IAAI,KAAK,KAAK,IAAI,EAAE;YACzB,OAAO,IAAA,wBAAgB,EAAC,YAAY,EAAE,oBAAoB,CAAC,CAAC;SAC7D;QAED,OAAO,IAAA,sBAAc,EAAC,YAAY,EAAE,oBAAoB,CAAC,CAAC;IAC5D,CAAC,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,uBAAuB,2BAalC"}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
drawSeparator: (index: number, size: number) => boolean;
|
|
3
|
-
separatorGetter: (index: number, size: number) => string;
|
|
4
|
-
};
|
|
1
|
+
import type { SpanningCellManager } from './spanningCellManager';
|
|
5
2
|
/**
|
|
6
3
|
* Shared function to draw horizontal borders, rows or the entire table
|
|
7
4
|
*/
|
|
8
|
-
|
|
5
|
+
declare type DrawContentParameters = {
|
|
6
|
+
contents: string[];
|
|
7
|
+
drawSeparator: (index: number, size: number) => boolean;
|
|
8
|
+
separatorGetter: (index: number, size: number) => string;
|
|
9
|
+
spanningCellManager?: SpanningCellManager;
|
|
10
|
+
rowIndex?: number;
|
|
11
|
+
elementType?: 'border' | 'cell' | 'row';
|
|
12
|
+
};
|
|
13
|
+
export declare const drawContent: (parameters: DrawContentParameters) => string;
|
|
9
14
|
export {};
|
|
@@ -1,21 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.drawContent = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*/
|
|
7
|
-
const drawContent = (contents, separatorConfig) => {
|
|
8
|
-
const { separatorGetter, drawSeparator } = separatorConfig;
|
|
4
|
+
const drawContent = (parameters) => {
|
|
5
|
+
const { contents, separatorGetter, drawSeparator, spanningCellManager, rowIndex, elementType } = parameters;
|
|
9
6
|
const contentSize = contents.length;
|
|
10
7
|
const result = [];
|
|
11
8
|
if (drawSeparator(0, contentSize)) {
|
|
12
9
|
result.push(separatorGetter(0, contentSize));
|
|
13
10
|
}
|
|
14
11
|
contents.forEach((content, contentIndex) => {
|
|
15
|
-
|
|
12
|
+
if (!elementType || elementType === 'border' || elementType === 'row') {
|
|
13
|
+
result.push(content);
|
|
14
|
+
}
|
|
15
|
+
if (elementType === 'cell' && rowIndex === undefined) {
|
|
16
|
+
result.push(content);
|
|
17
|
+
}
|
|
18
|
+
if (elementType === 'cell' && rowIndex !== undefined) {
|
|
19
|
+
/* istanbul ignore next */
|
|
20
|
+
const containingRange = spanningCellManager === null || spanningCellManager === void 0 ? void 0 : spanningCellManager.getContainingRange({ col: contentIndex,
|
|
21
|
+
row: rowIndex });
|
|
22
|
+
// when drawing content row, just add a cell when it is a normal cell
|
|
23
|
+
// or belongs to first column of spanning cell
|
|
24
|
+
if (!containingRange || contentIndex === containingRange.topLeft.col) {
|
|
25
|
+
result.push(content);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
16
28
|
// Only append the middle separator if the content is not the last
|
|
17
29
|
if (contentIndex + 1 < contentSize && drawSeparator(contentIndex + 1, contentSize)) {
|
|
18
|
-
|
|
30
|
+
const separator = separatorGetter(contentIndex + 1, contentSize);
|
|
31
|
+
if (elementType === 'cell' && rowIndex !== undefined) {
|
|
32
|
+
const currentCell = { col: contentIndex + 1,
|
|
33
|
+
row: rowIndex };
|
|
34
|
+
/* istanbul ignore next */
|
|
35
|
+
const containingRange = spanningCellManager === null || spanningCellManager === void 0 ? void 0 : spanningCellManager.getContainingRange(currentCell);
|
|
36
|
+
if (!containingRange || containingRange.topLeft.col === currentCell.col) {
|
|
37
|
+
result.push(separator);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
result.push(separator);
|
|
42
|
+
}
|
|
19
43
|
}
|
|
20
44
|
});
|
|
21
45
|
if (drawSeparator(contentSize, contentSize)) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawContent.js","sourceRoot":"","sources":["../../src/drawContent.ts"],"names":[],"mappings":";;;AAmBO,MAAM,WAAW,GAAG,CAAC,UAAiC,EAAU,EAAE;IACvE,MAAM,EAAC,QAAQ,EAAE,eAAe,EAAE,aAAa,EAAE,mBAAmB,EAAE,QAAQ,EAAE,WAAW,EAAC,GAAG,UAAU,CAAC;IAC1G,MAAM,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC;IACpC,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,IAAI,aAAa,CAAC,CAAC,EAAE,WAAW,CAAC,EAAE;QACjC,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC;KAC9C;IAED,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE;QACzC,IAAI,CAAC,WAAW,IAAI,WAAW,KAAK,QAAQ,IAAI,WAAW,KAAK,KAAK,EAAE;YACrE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SACtB;QAED,IAAI,WAAW,KAAK,MAAM,IAAI,QAAQ,KAAK,SAAS,EAAE;YACpD,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SACtB;QAED,IAAI,WAAW,KAAK,MAAM,IAAI,QAAQ,KAAK,SAAS,EAAE;YACpD,0BAA0B;YAC1B,MAAM,eAAe,GAAG,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAE,kBAAkB,CAAC,EAA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
import type { SpanningCellManager } from './spanningCellManager';
|
|
1
2
|
import type { DrawVerticalLine } from './types/api';
|
|
2
3
|
import type { BodyBorderConfig, Row } from './types/internal';
|
|
3
|
-
export declare
|
|
4
|
+
export declare type DrawRowConfig = {
|
|
4
5
|
border: BodyBorderConfig;
|
|
5
6
|
drawVerticalLine: DrawVerticalLine;
|
|
6
|
-
|
|
7
|
+
spanningCellManager?: SpanningCellManager;
|
|
8
|
+
rowIndex?: number;
|
|
9
|
+
};
|
|
10
|
+
export declare const drawRow: (row: Row, config: DrawRowConfig) => string;
|
|
@@ -3,9 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.drawRow = void 0;
|
|
4
4
|
const drawContent_1 = require("./drawContent");
|
|
5
5
|
const drawRow = (row, config) => {
|
|
6
|
-
const { border, drawVerticalLine } = config;
|
|
7
|
-
return (0, drawContent_1.drawContent)(
|
|
6
|
+
const { border, drawVerticalLine, rowIndex, spanningCellManager } = config;
|
|
7
|
+
return (0, drawContent_1.drawContent)({
|
|
8
|
+
contents: row,
|
|
8
9
|
drawSeparator: drawVerticalLine,
|
|
10
|
+
elementType: 'cell',
|
|
11
|
+
rowIndex,
|
|
9
12
|
separatorGetter: (index, columnCount) => {
|
|
10
13
|
if (index === 0) {
|
|
11
14
|
return border.bodyLeft;
|
|
@@ -15,6 +18,7 @@ const drawRow = (row, config) => {
|
|
|
15
18
|
}
|
|
16
19
|
return border.bodyJoin;
|
|
17
20
|
},
|
|
21
|
+
spanningCellManager,
|
|
18
22
|
}) + '\n';
|
|
19
23
|
};
|
|
20
24
|
exports.drawRow = drawRow;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawRow.js","sourceRoot":"","sources":["../../src/drawRow.ts"],"names":[],"mappings":";;;AAAA,+CAEuB;AAmBhB,MAAM,OAAO,GAAG,CAAC,GAAQ,EAAE,MAAqB,EAAU,EAAE;IACjE,MAAM,EAAC,MAAM,EAAE,gBAAgB,EAAE,QAAQ,EAAE,mBAAmB,EAAC,GAAG,MAAM,CAAC;IAEzE,OAAO,IAAA,yBAAW,EAAC;QACjB,QAAQ,EAAE,GAAG;QACb,aAAa,EAAE,gBAAgB;QAC/B,WAAW,EAAE,MAAM;QACnB,QAAQ;QACR,eAAe,EAAE,CAAC,KAAK,EAAE,WAAW,EAAE,EAAE;YACtC,IAAI,KAAK,KAAK,CAAC,EAAE;gBACf,OAAO,MAAM,CAAC,QAAQ,CAAC;aACxB;YAED,IAAI,KAAK,KAAK,WAAW,EAAE;gBACzB,OAAO,MAAM,CAAC,SAAS,CAAC;aACzB;YAED,OAAO,MAAM,CAAC,QAAQ,CAAC;QACzB,CAAC;QACD,mBAAmB;KACpB,CAAC,GAAG,IAAI,CAAC;AACZ,CAAC,CAAC;AArBW,QAAA,OAAO,WAqBlB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { TableConfig, Row } from './types/internal';
|
|
2
|
-
export declare const drawTable: (rows: Row[],
|
|
2
|
+
export declare const drawTable: (rows: Row[], outputColumnWidths: number[], rowHeights: number[], config: TableConfig) => string;
|
|
@@ -1,30 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.drawTable = void 0;
|
|
7
|
-
const string_width_1 = __importDefault(require("string-width"));
|
|
8
4
|
const drawBorder_1 = require("./drawBorder");
|
|
9
5
|
const drawContent_1 = require("./drawContent");
|
|
10
|
-
const drawHeader_1 = require("./drawHeader");
|
|
11
6
|
const drawRow_1 = require("./drawRow");
|
|
12
7
|
const utils_1 = require("./utils");
|
|
13
|
-
const drawTable = (rows,
|
|
8
|
+
const drawTable = (rows, outputColumnWidths, rowHeights, config) => {
|
|
14
9
|
const { drawHorizontalLine, singleLine, } = config;
|
|
15
|
-
const contents = (0, utils_1.groupBySizes)(rows, rowHeights).map((group) => {
|
|
10
|
+
const contents = (0, utils_1.groupBySizes)(rows, rowHeights).map((group, groupIndex) => {
|
|
16
11
|
return group.map((row) => {
|
|
17
|
-
return (0, drawRow_1.drawRow)(row, config
|
|
12
|
+
return (0, drawRow_1.drawRow)(row, { ...config,
|
|
13
|
+
rowIndex: groupIndex });
|
|
18
14
|
}).join('');
|
|
19
15
|
});
|
|
20
|
-
|
|
21
|
-
// assume that topLeft/right border have width = 1
|
|
22
|
-
const headerWidth = (0, string_width_1.default)((0, drawRow_1.drawRow)(rows[0], config)) - 2 -
|
|
23
|
-
config.header.paddingLeft - config.header.paddingRight;
|
|
24
|
-
const header = (0, drawHeader_1.drawHeader)(headerWidth, config);
|
|
25
|
-
contents.unshift(header);
|
|
26
|
-
}
|
|
27
|
-
return (0, drawContent_1.drawContent)(contents, {
|
|
16
|
+
return (0, drawContent_1.drawContent)({ contents,
|
|
28
17
|
drawSeparator: (index, size) => {
|
|
29
18
|
// Top/bottom border
|
|
30
19
|
if (index === 0 || index === size) {
|
|
@@ -32,8 +21,11 @@ const drawTable = (rows, columnWidths, rowHeights, config) => {
|
|
|
32
21
|
}
|
|
33
22
|
return !singleLine && drawHorizontalLine(index, size);
|
|
34
23
|
},
|
|
35
|
-
|
|
36
|
-
|
|
24
|
+
elementType: 'row',
|
|
25
|
+
rowIndex: -1,
|
|
26
|
+
separatorGetter: (0, drawBorder_1.createTableBorderGetter)(outputColumnWidths, { ...config,
|
|
27
|
+
rowCount: contents.length }),
|
|
28
|
+
spanningCellManager: config.spanningCellManager });
|
|
37
29
|
};
|
|
38
30
|
exports.drawTable = drawTable;
|
|
39
31
|
//# sourceMappingURL=drawTable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawTable.js","sourceRoot":"","sources":["../../src/drawTable.ts"],"names":[],"mappings":";;;AAAA,6CAEsB;AACtB,+CAEuB;AACvB,uCAEmB;AAInB,mCAE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?: any;
|
|
6
6
|
}): boolean;
|
|
7
|
-
declare function
|
|
7
|
+
declare function validate86(data: any, { instancePath, parentData, parentDataProperty, rootData }?: {
|
|
8
8
|
instancePath?: string | undefined;
|
|
9
9
|
parentData: any;
|
|
10
10
|
parentDataProperty: any;
|
|
11
11
|
rootData?: any;
|
|
12
12
|
}): boolean;
|
|
13
|
-
export { validate43 as _config_json,
|
|
13
|
+
export { validate43 as _config_json, validate86 as _streamConfig_json };
|