table 6.0.9 → 6.1.0
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/README.md +52 -0
- package/dist/createStream.js +10 -10
- package/dist/createStream.js.flow +10 -10
- package/dist/drawBorder.js +57 -51
- package/dist/drawBorder.js.flow +43 -55
- package/dist/drawHorizontalContent.js +41 -0
- package/dist/drawHorizontalContent.js.flow +31 -0
- package/dist/drawRow.js +20 -4
- package/dist/drawRow.js.flow +18 -4
- package/dist/drawTable.js +11 -9
- package/dist/drawTable.js.flow +24 -13
- package/dist/makeConfig.js +11 -2
- package/dist/makeConfig.js.flow +11 -2
- package/dist/makeStreamConfig.js +10 -0
- package/dist/makeStreamConfig.js.flow +9 -0
- package/dist/schemas/config.json +3 -0
- package/dist/schemas/streamConfig.json +3 -0
- package/dist/table.js +13 -1
- package/dist/table.js.flow +13 -1
- package/dist/validators.js +54 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* [Cell Content Alignment](#table-usage-cell-content-alignment)
|
|
15
15
|
* [Column Width](#table-usage-column-width)
|
|
16
16
|
* [Custom Border](#table-usage-custom-border)
|
|
17
|
+
* [Draw Vertical Line](#table-usage-draw-vertical-line)
|
|
17
18
|
* [Draw Horizontal Line](#table-usage-draw-horizontal-line)
|
|
18
19
|
* [Single Line Mode](#table-usage-single-line-mode)
|
|
19
20
|
* [Padding Cell Content](#table-usage-padding-cell-content)
|
|
@@ -292,6 +293,57 @@ console.log(output);
|
|
|
292
293
|
└────┴────┴────┘
|
|
293
294
|
```
|
|
294
295
|
|
|
296
|
+
<a name="table-usage-draw-vertical-line"></a>
|
|
297
|
+
### Draw Vertical Line
|
|
298
|
+
|
|
299
|
+
`{function} config.drawVerticalLine` property is a function that is called for every non-content column in the table. The result of the function `{boolean}` determines whether a border is drawn.
|
|
300
|
+
|
|
301
|
+
```js
|
|
302
|
+
let data,
|
|
303
|
+
output,
|
|
304
|
+
options;
|
|
305
|
+
|
|
306
|
+
data = [
|
|
307
|
+
['0A', '0B', '0C'],
|
|
308
|
+
['1A', '1B', '1C'],
|
|
309
|
+
['2A', '2B', '2C'],
|
|
310
|
+
['3A', '3B', '3C'],
|
|
311
|
+
['4A', '4B', '4C']
|
|
312
|
+
];
|
|
313
|
+
|
|
314
|
+
options = {
|
|
315
|
+
/**
|
|
316
|
+
* @typedef {function} drawVerticalLine
|
|
317
|
+
* @param {number} index
|
|
318
|
+
* @param {number} size
|
|
319
|
+
* @return {boolean}
|
|
320
|
+
*/
|
|
321
|
+
drawVerticalLine: (index, size) => {
|
|
322
|
+
return index === 0 || index === size;
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
output = table(data, options);
|
|
327
|
+
|
|
328
|
+
console.log(output);
|
|
329
|
+
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
```
|
|
333
|
+
╔════════════╗
|
|
334
|
+
║ 0A 0B 0C ║
|
|
335
|
+
╟────────────╢
|
|
336
|
+
║ 1A 1B 1C ║
|
|
337
|
+
╟────────────╢
|
|
338
|
+
║ 2A 2B 2C ║
|
|
339
|
+
╟────────────╢
|
|
340
|
+
║ 3A 3B 3C ║
|
|
341
|
+
╟────────────╢
|
|
342
|
+
║ 4A 4B 4C ║
|
|
343
|
+
╚════════════╝
|
|
344
|
+
|
|
345
|
+
```
|
|
346
|
+
|
|
295
347
|
<a name="table-usage-draw-horizontal-line"></a>
|
|
296
348
|
### Draw Horizontal Line
|
|
297
349
|
|
package/dist/createStream.js
CHANGED
|
@@ -27,13 +27,13 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* @param {Array} data
|
|
30
|
-
* @param {
|
|
30
|
+
* @param {streamConfig} config
|
|
31
31
|
* @returns {Array}
|
|
32
32
|
*/
|
|
33
33
|
const prepareData = (data, config) => {
|
|
34
34
|
let rows;
|
|
35
35
|
rows = (0, _stringifyTableData.default)(data);
|
|
36
|
-
rows = (0, _truncateTableData.default)(
|
|
36
|
+
rows = (0, _truncateTableData.default)(rows, config);
|
|
37
37
|
const rowHeightIndex = (0, _calculateRowHeightIndex.default)(rows, config);
|
|
38
38
|
rows = (0, _mapDataUsingRowHeightIndex.default)(rows, rowHeightIndex, config);
|
|
39
39
|
rows = (0, _alignTableData.default)(rows, config);
|
|
@@ -43,7 +43,7 @@ const prepareData = (data, config) => {
|
|
|
43
43
|
/**
|
|
44
44
|
* @param {string[]} row
|
|
45
45
|
* @param {number[]} columnWidthIndex
|
|
46
|
-
* @param {
|
|
46
|
+
* @param {streamConfig} config
|
|
47
47
|
* @returns {undefined}
|
|
48
48
|
*/
|
|
49
49
|
|
|
@@ -51,20 +51,20 @@ const prepareData = (data, config) => {
|
|
|
51
51
|
const create = (row, columnWidthIndex, config) => {
|
|
52
52
|
const rows = prepareData([row], config);
|
|
53
53
|
const body = rows.map(literalRow => {
|
|
54
|
-
return (0, _drawRow.default)(literalRow, config
|
|
54
|
+
return (0, _drawRow.default)(literalRow, config);
|
|
55
55
|
}).join('');
|
|
56
56
|
let output;
|
|
57
57
|
output = '';
|
|
58
|
-
output += (0, _drawBorder.drawBorderTop)(columnWidthIndex, config
|
|
58
|
+
output += (0, _drawBorder.drawBorderTop)(columnWidthIndex, config);
|
|
59
59
|
output += body;
|
|
60
|
-
output += (0, _drawBorder.drawBorderBottom)(columnWidthIndex, config
|
|
60
|
+
output += (0, _drawBorder.drawBorderBottom)(columnWidthIndex, config);
|
|
61
61
|
output = output.trimEnd();
|
|
62
62
|
process.stdout.write(output);
|
|
63
63
|
};
|
|
64
64
|
/**
|
|
65
65
|
* @param {string[]} row
|
|
66
66
|
* @param {number[]} columnWidthIndex
|
|
67
|
-
* @param {
|
|
67
|
+
* @param {streamConfig} config
|
|
68
68
|
* @returns {undefined}
|
|
69
69
|
*/
|
|
70
70
|
|
|
@@ -72,16 +72,16 @@ const create = (row, columnWidthIndex, config) => {
|
|
|
72
72
|
const append = (row, columnWidthIndex, config) => {
|
|
73
73
|
const rows = prepareData([row], config);
|
|
74
74
|
const body = rows.map(literalRow => {
|
|
75
|
-
return (0, _drawRow.default)(literalRow, config
|
|
75
|
+
return (0, _drawRow.default)(literalRow, config);
|
|
76
76
|
}).join('');
|
|
77
77
|
let output = '';
|
|
78
|
-
const bottom = (0, _drawBorder.drawBorderBottom)(columnWidthIndex, config
|
|
78
|
+
const bottom = (0, _drawBorder.drawBorderBottom)(columnWidthIndex, config);
|
|
79
79
|
|
|
80
80
|
if (bottom !== '\n') {
|
|
81
81
|
output = '\r\u001B[K';
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
output += (0, _drawBorder.drawBorderJoin)(columnWidthIndex, config
|
|
84
|
+
output += (0, _drawBorder.drawBorderJoin)(columnWidthIndex, config);
|
|
85
85
|
output += body;
|
|
86
86
|
output += bottom;
|
|
87
87
|
output = output.trimEnd();
|
|
@@ -14,7 +14,7 @@ import truncateTableData from './truncateTableData';
|
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* @param {Array} data
|
|
17
|
-
* @param {
|
|
17
|
+
* @param {streamConfig} config
|
|
18
18
|
* @returns {Array}
|
|
19
19
|
*/
|
|
20
20
|
const prepareData = (data, config) => {
|
|
@@ -22,7 +22,7 @@ const prepareData = (data, config) => {
|
|
|
22
22
|
|
|
23
23
|
rows = stringifyTableData(data);
|
|
24
24
|
|
|
25
|
-
rows = truncateTableData(
|
|
25
|
+
rows = truncateTableData(rows, config);
|
|
26
26
|
|
|
27
27
|
const rowHeightIndex = calculateRowHeightIndex(rows, config);
|
|
28
28
|
|
|
@@ -36,23 +36,23 @@ const prepareData = (data, config) => {
|
|
|
36
36
|
/**
|
|
37
37
|
* @param {string[]} row
|
|
38
38
|
* @param {number[]} columnWidthIndex
|
|
39
|
-
* @param {
|
|
39
|
+
* @param {streamConfig} config
|
|
40
40
|
* @returns {undefined}
|
|
41
41
|
*/
|
|
42
42
|
const create = (row, columnWidthIndex, config) => {
|
|
43
43
|
const rows = prepareData([row], config);
|
|
44
44
|
|
|
45
45
|
const body = rows.map((literalRow) => {
|
|
46
|
-
return drawRow(literalRow, config
|
|
46
|
+
return drawRow(literalRow, config);
|
|
47
47
|
}).join('');
|
|
48
48
|
|
|
49
49
|
let output;
|
|
50
50
|
|
|
51
51
|
output = '';
|
|
52
52
|
|
|
53
|
-
output += drawBorderTop(columnWidthIndex, config
|
|
53
|
+
output += drawBorderTop(columnWidthIndex, config);
|
|
54
54
|
output += body;
|
|
55
|
-
output += drawBorderBottom(columnWidthIndex, config
|
|
55
|
+
output += drawBorderBottom(columnWidthIndex, config);
|
|
56
56
|
|
|
57
57
|
output = output.trimEnd();
|
|
58
58
|
|
|
@@ -62,24 +62,24 @@ const create = (row, columnWidthIndex, config) => {
|
|
|
62
62
|
/**
|
|
63
63
|
* @param {string[]} row
|
|
64
64
|
* @param {number[]} columnWidthIndex
|
|
65
|
-
* @param {
|
|
65
|
+
* @param {streamConfig} config
|
|
66
66
|
* @returns {undefined}
|
|
67
67
|
*/
|
|
68
68
|
const append = (row, columnWidthIndex, config) => {
|
|
69
69
|
const rows = prepareData([row], config);
|
|
70
70
|
|
|
71
71
|
const body = rows.map((literalRow) => {
|
|
72
|
-
return drawRow(literalRow, config
|
|
72
|
+
return drawRow(literalRow, config);
|
|
73
73
|
}).join('');
|
|
74
74
|
|
|
75
75
|
let output = '';
|
|
76
|
-
const bottom = drawBorderBottom(columnWidthIndex, config
|
|
76
|
+
const bottom = drawBorderBottom(columnWidthIndex, config);
|
|
77
77
|
|
|
78
78
|
if (bottom !== '\n') {
|
|
79
79
|
output = '\r\u001B[K';
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
output += drawBorderJoin(columnWidthIndex, config
|
|
82
|
+
output += drawBorderJoin(columnWidthIndex, config);
|
|
83
83
|
output += body;
|
|
84
84
|
output += bottom;
|
|
85
85
|
|
package/dist/drawBorder.js
CHANGED
|
@@ -5,8 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.drawBorderTop = exports.drawBorderJoin = exports.drawBorderBottom = exports.drawBorder = void 0;
|
|
7
7
|
|
|
8
|
+
var _drawHorizontalContent = _interopRequireDefault(require("./drawHorizontalContent"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
8
12
|
/**
|
|
9
|
-
* @typedef drawBorder~
|
|
13
|
+
* @typedef drawBorder~border
|
|
10
14
|
* @property {string} left
|
|
11
15
|
* @property {string} right
|
|
12
16
|
* @property {string} body
|
|
@@ -15,94 +19,96 @@ exports.drawBorderTop = exports.drawBorderJoin = exports.drawBorderBottom = expo
|
|
|
15
19
|
|
|
16
20
|
/**
|
|
17
21
|
* @param {number[]} columnSizeIndex
|
|
18
|
-
* @param {
|
|
22
|
+
* @param {object} config
|
|
23
|
+
* @param {drawBorder~border} config.border
|
|
24
|
+
* @param {Function} config.drawVerticalLine
|
|
19
25
|
* @returns {string}
|
|
20
26
|
*/
|
|
21
|
-
const drawBorder = (columnSizeIndex,
|
|
27
|
+
const drawBorder = (columnSizeIndex, {
|
|
28
|
+
border,
|
|
29
|
+
drawVerticalLine
|
|
30
|
+
}) => {
|
|
22
31
|
const columns = columnSizeIndex.map(size => {
|
|
23
|
-
return
|
|
24
|
-
})
|
|
25
|
-
return
|
|
32
|
+
return border.body.repeat(size);
|
|
33
|
+
});
|
|
34
|
+
return (0, _drawHorizontalContent.default)(columns, {
|
|
35
|
+
drawVerticalLine,
|
|
36
|
+
separator: border
|
|
37
|
+
});
|
|
26
38
|
};
|
|
27
|
-
/**
|
|
28
|
-
* @typedef drawBorderTop~parts
|
|
29
|
-
* @property {string} topLeft
|
|
30
|
-
* @property {string} topRight
|
|
31
|
-
* @property {string} topBody
|
|
32
|
-
* @property {string} topJoin
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
39
|
/**
|
|
36
40
|
* @param {number[]} columnSizeIndex
|
|
37
|
-
* @param {
|
|
41
|
+
* @param {table~config} config
|
|
38
42
|
* @returns {string}
|
|
39
43
|
*/
|
|
40
44
|
|
|
41
45
|
|
|
42
46
|
exports.drawBorder = drawBorder;
|
|
43
47
|
|
|
44
|
-
const drawBorderTop = (columnSizeIndex,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
const drawBorderTop = (columnSizeIndex, {
|
|
49
|
+
border,
|
|
50
|
+
drawVerticalLine
|
|
51
|
+
}) => {
|
|
52
|
+
const result = drawBorder(columnSizeIndex, {
|
|
53
|
+
border: {
|
|
54
|
+
body: border.topBody,
|
|
55
|
+
join: border.topJoin,
|
|
56
|
+
left: border.topLeft,
|
|
57
|
+
right: border.topRight
|
|
58
|
+
},
|
|
59
|
+
drawVerticalLine
|
|
50
60
|
});
|
|
51
61
|
|
|
52
|
-
if (
|
|
62
|
+
if (result === '\n') {
|
|
53
63
|
return '';
|
|
54
64
|
}
|
|
55
65
|
|
|
56
|
-
return
|
|
66
|
+
return result;
|
|
57
67
|
};
|
|
58
|
-
/**
|
|
59
|
-
* @typedef drawBorderJoin~parts
|
|
60
|
-
* @property {string} joinLeft
|
|
61
|
-
* @property {string} joinRight
|
|
62
|
-
* @property {string} joinBody
|
|
63
|
-
* @property {string} joinJoin
|
|
64
|
-
*/
|
|
65
|
-
|
|
66
68
|
/**
|
|
67
69
|
* @param {number[]} columnSizeIndex
|
|
68
|
-
* @param {
|
|
70
|
+
* @param {table~config} config
|
|
69
71
|
* @returns {string}
|
|
70
72
|
*/
|
|
71
73
|
|
|
72
74
|
|
|
73
75
|
exports.drawBorderTop = drawBorderTop;
|
|
74
76
|
|
|
75
|
-
const drawBorderJoin = (columnSizeIndex,
|
|
77
|
+
const drawBorderJoin = (columnSizeIndex, {
|
|
78
|
+
border,
|
|
79
|
+
drawVerticalLine
|
|
80
|
+
}) => {
|
|
76
81
|
return drawBorder(columnSizeIndex, {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
82
|
+
border: {
|
|
83
|
+
body: border.joinBody,
|
|
84
|
+
join: border.joinJoin,
|
|
85
|
+
left: border.joinLeft,
|
|
86
|
+
right: border.joinRight
|
|
87
|
+
},
|
|
88
|
+
drawVerticalLine
|
|
81
89
|
});
|
|
82
90
|
};
|
|
83
|
-
/**
|
|
84
|
-
* @typedef drawBorderBottom~parts
|
|
85
|
-
* @property {string} topLeft
|
|
86
|
-
* @property {string} topRight
|
|
87
|
-
* @property {string} topBody
|
|
88
|
-
* @property {string} topJoin
|
|
89
|
-
*/
|
|
90
|
-
|
|
91
91
|
/**
|
|
92
92
|
* @param {number[]} columnSizeIndex
|
|
93
|
-
* @param {
|
|
93
|
+
* @param {table~config} config
|
|
94
94
|
* @returns {string}
|
|
95
95
|
*/
|
|
96
96
|
|
|
97
97
|
|
|
98
98
|
exports.drawBorderJoin = drawBorderJoin;
|
|
99
99
|
|
|
100
|
-
const drawBorderBottom = (columnSizeIndex,
|
|
100
|
+
const drawBorderBottom = (columnSizeIndex, {
|
|
101
|
+
border,
|
|
102
|
+
drawVerticalLine
|
|
103
|
+
}) => {
|
|
101
104
|
return drawBorder(columnSizeIndex, {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
105
|
+
border: {
|
|
106
|
+
body: border.bottomBody,
|
|
107
|
+
join: border.bottomJoin,
|
|
108
|
+
left: border.bottomLeft,
|
|
109
|
+
right: border.bottomRight
|
|
110
|
+
},
|
|
111
|
+
drawVerticalLine
|
|
106
112
|
});
|
|
107
113
|
};
|
|
108
114
|
|
package/dist/drawBorder.js.flow
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import drawHorizontalContent from './drawHorizontalContent';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
|
-
* @typedef drawBorder~
|
|
4
|
+
* @typedef drawBorder~border
|
|
3
5
|
* @property {string} left
|
|
4
6
|
* @property {string} right
|
|
5
7
|
* @property {string} body
|
|
@@ -8,88 +10,74 @@
|
|
|
8
10
|
|
|
9
11
|
/**
|
|
10
12
|
* @param {number[]} columnSizeIndex
|
|
11
|
-
* @param {
|
|
13
|
+
* @param {object} config
|
|
14
|
+
* @param {drawBorder~border} config.border
|
|
15
|
+
* @param {Function} config.drawVerticalLine
|
|
12
16
|
* @returns {string}
|
|
13
17
|
*/
|
|
14
|
-
const drawBorder = (columnSizeIndex,
|
|
15
|
-
const columns = columnSizeIndex
|
|
16
|
-
.
|
|
17
|
-
|
|
18
|
-
})
|
|
19
|
-
.join(parts.join);
|
|
18
|
+
const drawBorder = (columnSizeIndex, {border, drawVerticalLine}) => {
|
|
19
|
+
const columns = columnSizeIndex.map((size) => {
|
|
20
|
+
return border.body.repeat(size);
|
|
21
|
+
});
|
|
20
22
|
|
|
21
|
-
return
|
|
23
|
+
return drawHorizontalContent(columns, {
|
|
24
|
+
drawVerticalLine,
|
|
25
|
+
separator: border,
|
|
26
|
+
});
|
|
22
27
|
};
|
|
23
28
|
|
|
24
|
-
/**
|
|
25
|
-
* @typedef drawBorderTop~parts
|
|
26
|
-
* @property {string} topLeft
|
|
27
|
-
* @property {string} topRight
|
|
28
|
-
* @property {string} topBody
|
|
29
|
-
* @property {string} topJoin
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
29
|
/**
|
|
33
30
|
* @param {number[]} columnSizeIndex
|
|
34
|
-
* @param {
|
|
31
|
+
* @param {table~config} config
|
|
35
32
|
* @returns {string}
|
|
36
33
|
*/
|
|
37
|
-
const drawBorderTop = (columnSizeIndex,
|
|
38
|
-
const
|
|
39
|
-
body:
|
|
40
|
-
join:
|
|
41
|
-
left:
|
|
42
|
-
right:
|
|
43
|
-
}
|
|
34
|
+
const drawBorderTop = (columnSizeIndex, {border, drawVerticalLine}) => {
|
|
35
|
+
const result = drawBorder(columnSizeIndex, {border: {
|
|
36
|
+
body: border.topBody,
|
|
37
|
+
join: border.topJoin,
|
|
38
|
+
left: border.topLeft,
|
|
39
|
+
right: border.topRight,
|
|
40
|
+
},
|
|
41
|
+
drawVerticalLine});
|
|
44
42
|
|
|
45
|
-
if (
|
|
43
|
+
if (result === '\n') {
|
|
46
44
|
return '';
|
|
47
45
|
}
|
|
48
46
|
|
|
49
|
-
return
|
|
47
|
+
return result;
|
|
50
48
|
};
|
|
51
49
|
|
|
52
|
-
/**
|
|
53
|
-
* @typedef drawBorderJoin~parts
|
|
54
|
-
* @property {string} joinLeft
|
|
55
|
-
* @property {string} joinRight
|
|
56
|
-
* @property {string} joinBody
|
|
57
|
-
* @property {string} joinJoin
|
|
58
|
-
*/
|
|
59
|
-
|
|
60
50
|
/**
|
|
61
51
|
* @param {number[]} columnSizeIndex
|
|
62
|
-
* @param {
|
|
52
|
+
* @param {table~config} config
|
|
63
53
|
* @returns {string}
|
|
64
54
|
*/
|
|
65
|
-
const drawBorderJoin = (columnSizeIndex,
|
|
55
|
+
const drawBorderJoin = (columnSizeIndex, {border, drawVerticalLine}) => {
|
|
66
56
|
return drawBorder(columnSizeIndex, {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
57
|
+
border: {
|
|
58
|
+
body: border.joinBody,
|
|
59
|
+
join: border.joinJoin,
|
|
60
|
+
left: border.joinLeft,
|
|
61
|
+
right: border.joinRight,
|
|
62
|
+
},
|
|
63
|
+
drawVerticalLine,
|
|
71
64
|
});
|
|
72
65
|
};
|
|
73
66
|
|
|
74
|
-
/**
|
|
75
|
-
* @typedef drawBorderBottom~parts
|
|
76
|
-
* @property {string} topLeft
|
|
77
|
-
* @property {string} topRight
|
|
78
|
-
* @property {string} topBody
|
|
79
|
-
* @property {string} topJoin
|
|
80
|
-
*/
|
|
81
|
-
|
|
82
67
|
/**
|
|
83
68
|
* @param {number[]} columnSizeIndex
|
|
84
|
-
* @param {
|
|
69
|
+
* @param {table~config} config
|
|
85
70
|
* @returns {string}
|
|
86
71
|
*/
|
|
87
|
-
const drawBorderBottom = (columnSizeIndex,
|
|
72
|
+
const drawBorderBottom = (columnSizeIndex, {border, drawVerticalLine}) => {
|
|
88
73
|
return drawBorder(columnSizeIndex, {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
74
|
+
border: {
|
|
75
|
+
body: border.bottomBody,
|
|
76
|
+
join: border.bottomJoin,
|
|
77
|
+
left: border.bottomLeft,
|
|
78
|
+
right: border.bottomRight,
|
|
79
|
+
},
|
|
80
|
+
drawVerticalLine,
|
|
93
81
|
});
|
|
94
82
|
};
|
|
95
83
|
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @typedef {object} drawHorizontalContent~separator
|
|
10
|
+
* @property {string} left
|
|
11
|
+
* @property {string} right
|
|
12
|
+
* @property {string} join
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @param {string[]} columns
|
|
17
|
+
* @param {object} config
|
|
18
|
+
* @param {drawHorizontalContent~separator} config.separator
|
|
19
|
+
* @param {Function} config.drawVerticalLine
|
|
20
|
+
* @returns {string}
|
|
21
|
+
*/
|
|
22
|
+
const drawHorizontalContent = (columns, {
|
|
23
|
+
separator,
|
|
24
|
+
drawVerticalLine
|
|
25
|
+
}) => {
|
|
26
|
+
const columnCount = columns.length;
|
|
27
|
+
const result = [];
|
|
28
|
+
result.push(drawVerticalLine(0, columnCount) ? separator.left : '');
|
|
29
|
+
columns.forEach((column, index) => {
|
|
30
|
+
result.push(column);
|
|
31
|
+
|
|
32
|
+
if (index + 1 < columnCount) {
|
|
33
|
+
result.push(drawVerticalLine(index + 1, columnCount) ? separator.join : '');
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
result.push(drawVerticalLine(columnCount, columnCount) ? separator.right : '');
|
|
37
|
+
return result.join('') + '\n';
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
var _default = drawHorizontalContent;
|
|
41
|
+
exports.default = _default;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {object} drawHorizontalContent~separator
|
|
3
|
+
* @property {string} left
|
|
4
|
+
* @property {string} right
|
|
5
|
+
* @property {string} join
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @param {string[]} columns
|
|
10
|
+
* @param {object} config
|
|
11
|
+
* @param {drawHorizontalContent~separator} config.separator
|
|
12
|
+
* @param {Function} config.drawVerticalLine
|
|
13
|
+
* @returns {string}
|
|
14
|
+
*/
|
|
15
|
+
export default (columns, {separator, drawVerticalLine}) => {
|
|
16
|
+
const columnCount = columns.length;
|
|
17
|
+
const result = [];
|
|
18
|
+
|
|
19
|
+
result.push(drawVerticalLine(0, columnCount) ? separator.left : '');
|
|
20
|
+
|
|
21
|
+
columns.forEach((column, index) => {
|
|
22
|
+
result.push(column);
|
|
23
|
+
|
|
24
|
+
if (index + 1 < columnCount) {
|
|
25
|
+
result.push(drawVerticalLine(index + 1, columnCount) ? separator.join : '');
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
result.push(drawVerticalLine(columnCount, columnCount) ? separator.right : '');
|
|
29
|
+
|
|
30
|
+
return result.join('') + '\n';
|
|
31
|
+
};
|
package/dist/drawRow.js
CHANGED
|
@@ -5,6 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
+
var _drawHorizontalContent = _interopRequireDefault(require("./drawHorizontalContent"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
8
12
|
/**
|
|
9
13
|
* @typedef {object} drawRow~border
|
|
10
14
|
* @property {string} bodyLeft
|
|
@@ -13,12 +17,24 @@ exports.default = void 0;
|
|
|
13
17
|
*/
|
|
14
18
|
|
|
15
19
|
/**
|
|
16
|
-
* @param {
|
|
17
|
-
* @param {
|
|
20
|
+
* @param {string[]} columns
|
|
21
|
+
* @param {object} config
|
|
22
|
+
* @param {border} config.border
|
|
23
|
+
* @param {Function} config.drawVerticalLine
|
|
18
24
|
* @returns {string}
|
|
19
25
|
*/
|
|
20
|
-
const drawRow = (columns,
|
|
21
|
-
|
|
26
|
+
const drawRow = (columns, {
|
|
27
|
+
border,
|
|
28
|
+
drawVerticalLine
|
|
29
|
+
}) => {
|
|
30
|
+
return (0, _drawHorizontalContent.default)(columns, {
|
|
31
|
+
drawVerticalLine,
|
|
32
|
+
separator: {
|
|
33
|
+
join: border.bodyJoin,
|
|
34
|
+
left: border.bodyLeft,
|
|
35
|
+
right: border.bodyRight
|
|
36
|
+
}
|
|
37
|
+
});
|
|
22
38
|
};
|
|
23
39
|
|
|
24
40
|
var _default = drawRow;
|
package/dist/drawRow.js.flow
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import drawHorizontalContent from './drawHorizontalContent';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* @typedef {object} drawRow~border
|
|
3
5
|
* @property {string} bodyLeft
|
|
@@ -6,10 +8,22 @@
|
|
|
6
8
|
*/
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
|
-
* @param {
|
|
10
|
-
* @param {
|
|
11
|
+
* @param {string[]} columns
|
|
12
|
+
* @param {object} config
|
|
13
|
+
* @param {border} config.border
|
|
14
|
+
* @param {Function} config.drawVerticalLine
|
|
11
15
|
* @returns {string}
|
|
12
16
|
*/
|
|
13
|
-
export default (columns,
|
|
14
|
-
|
|
17
|
+
export default (columns, {
|
|
18
|
+
border,
|
|
19
|
+
drawVerticalLine,
|
|
20
|
+
}) => {
|
|
21
|
+
return drawHorizontalContent(columns, {
|
|
22
|
+
drawVerticalLine,
|
|
23
|
+
separator: {
|
|
24
|
+
join: border.bodyJoin,
|
|
25
|
+
left: border.bodyLeft,
|
|
26
|
+
right: border.bodyRight,
|
|
27
|
+
},
|
|
28
|
+
});
|
|
15
29
|
};
|
package/dist/drawTable.js
CHANGED
|
@@ -12,15 +12,17 @@ var _drawRow = _interopRequireDefault(require("./drawRow"));
|
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
* @param {
|
|
16
|
-
* @param {object} border
|
|
15
|
+
* @param {string[][]} rows
|
|
17
16
|
* @param {Array} columnSizeIndex
|
|
18
17
|
* @param {Array} rowSpanIndex
|
|
19
|
-
* @param {
|
|
20
|
-
* @param {boolean} singleLine
|
|
18
|
+
* @param {table~config} config
|
|
21
19
|
* @returns {string}
|
|
22
20
|
*/
|
|
23
|
-
const drawTable = (rows,
|
|
21
|
+
const drawTable = (rows, columnSizeIndex, rowSpanIndex, config) => {
|
|
22
|
+
const {
|
|
23
|
+
drawHorizontalLine,
|
|
24
|
+
singleLine
|
|
25
|
+
} = config;
|
|
24
26
|
let output;
|
|
25
27
|
let realRowIndex;
|
|
26
28
|
let rowHeight;
|
|
@@ -29,11 +31,11 @@ const drawTable = (rows, border, columnSizeIndex, rowSpanIndex, drawHorizontalLi
|
|
|
29
31
|
output = '';
|
|
30
32
|
|
|
31
33
|
if (drawHorizontalLine(realRowIndex, rowCount)) {
|
|
32
|
-
output += (0, _drawBorder.drawBorderTop)(columnSizeIndex,
|
|
34
|
+
output += (0, _drawBorder.drawBorderTop)(columnSizeIndex, config);
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
rows.forEach((row, index0) => {
|
|
36
|
-
output += (0, _drawRow.default)(row,
|
|
38
|
+
output += (0, _drawRow.default)(row, config);
|
|
37
39
|
|
|
38
40
|
if (!rowHeight) {
|
|
39
41
|
rowHeight = rowSpanIndex[realRowIndex];
|
|
@@ -43,12 +45,12 @@ const drawTable = (rows, border, columnSizeIndex, rowSpanIndex, drawHorizontalLi
|
|
|
43
45
|
rowHeight--;
|
|
44
46
|
|
|
45
47
|
if (!singleLine && rowHeight === 0 && index0 !== rowCount - 1 && drawHorizontalLine(realRowIndex, rowCount)) {
|
|
46
|
-
output += (0, _drawBorder.drawBorderJoin)(columnSizeIndex,
|
|
48
|
+
output += (0, _drawBorder.drawBorderJoin)(columnSizeIndex, config);
|
|
47
49
|
}
|
|
48
50
|
});
|
|
49
51
|
|
|
50
52
|
if (drawHorizontalLine(realRowIndex, rowCount)) {
|
|
51
|
-
output += (0, _drawBorder.drawBorderBottom)(columnSizeIndex,
|
|
53
|
+
output += (0, _drawBorder.drawBorderBottom)(columnSizeIndex, config);
|
|
52
54
|
}
|
|
53
55
|
|
|
54
56
|
return output;
|
package/dist/drawTable.js.flow
CHANGED
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
import {
|
|
2
|
-
drawBorderTop,
|
|
3
|
-
drawBorderJoin,
|
|
4
|
-
drawBorderBottom,
|
|
2
|
+
drawBorderTop, drawBorderJoin, drawBorderBottom,
|
|
5
3
|
} from './drawBorder';
|
|
6
4
|
import drawRow from './drawRow';
|
|
7
5
|
|
|
8
6
|
/**
|
|
9
|
-
* @param {
|
|
10
|
-
* @param {object} border
|
|
7
|
+
* @param {string[][]} rows
|
|
11
8
|
* @param {Array} columnSizeIndex
|
|
12
9
|
* @param {Array} rowSpanIndex
|
|
13
|
-
* @param {
|
|
14
|
-
* @param {boolean} singleLine
|
|
10
|
+
* @param {table~config} config
|
|
15
11
|
* @returns {string}
|
|
16
12
|
*/
|
|
17
|
-
export default (
|
|
13
|
+
export default (
|
|
14
|
+
rows,
|
|
15
|
+
columnSizeIndex,
|
|
16
|
+
rowSpanIndex,
|
|
17
|
+
config,
|
|
18
|
+
) => {
|
|
19
|
+
const {
|
|
20
|
+
drawHorizontalLine,
|
|
21
|
+
singleLine,
|
|
22
|
+
} = config;
|
|
23
|
+
|
|
18
24
|
let output;
|
|
19
25
|
let realRowIndex;
|
|
20
26
|
let rowHeight;
|
|
@@ -26,11 +32,11 @@ export default (rows, border, columnSizeIndex, rowSpanIndex, drawHorizontalLine,
|
|
|
26
32
|
output = '';
|
|
27
33
|
|
|
28
34
|
if (drawHorizontalLine(realRowIndex, rowCount)) {
|
|
29
|
-
output += drawBorderTop(columnSizeIndex,
|
|
35
|
+
output += drawBorderTop(columnSizeIndex, config);
|
|
30
36
|
}
|
|
31
37
|
|
|
32
38
|
rows.forEach((row, index0) => {
|
|
33
|
-
output += drawRow(row,
|
|
39
|
+
output += drawRow(row, config);
|
|
34
40
|
|
|
35
41
|
if (!rowHeight) {
|
|
36
42
|
rowHeight = rowSpanIndex[realRowIndex];
|
|
@@ -40,13 +46,18 @@ export default (rows, border, columnSizeIndex, rowSpanIndex, drawHorizontalLine,
|
|
|
40
46
|
|
|
41
47
|
rowHeight--;
|
|
42
48
|
|
|
43
|
-
if (
|
|
44
|
-
|
|
49
|
+
if (
|
|
50
|
+
!singleLine &&
|
|
51
|
+
rowHeight === 0 &&
|
|
52
|
+
index0 !== rowCount - 1 &&
|
|
53
|
+
drawHorizontalLine(realRowIndex, rowCount)
|
|
54
|
+
) {
|
|
55
|
+
output += drawBorderJoin(columnSizeIndex, config);
|
|
45
56
|
}
|
|
46
57
|
});
|
|
47
58
|
|
|
48
59
|
if (drawHorizontalLine(realRowIndex, rowCount)) {
|
|
49
|
-
output += drawBorderBottom(columnSizeIndex,
|
|
60
|
+
output += drawBorderBottom(columnSizeIndex, config);
|
|
50
61
|
}
|
|
51
62
|
|
|
52
63
|
return output;
|
package/dist/makeConfig.js
CHANGED
|
@@ -73,13 +73,22 @@ const makeConfig = (rows, userConfig = {}) => {
|
|
|
73
73
|
|
|
74
74
|
if (!config.drawHorizontalLine) {
|
|
75
75
|
/**
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
* @returns {boolean}
|
|
77
|
+
*/
|
|
78
78
|
config.drawHorizontalLine = () => {
|
|
79
79
|
return true;
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
if (!config.drawVerticalLine) {
|
|
84
|
+
/**
|
|
85
|
+
* @returns {boolean}
|
|
86
|
+
*/
|
|
87
|
+
config.drawVerticalLine = () => {
|
|
88
|
+
return true;
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
83
92
|
if (config.singleLine === undefined) {
|
|
84
93
|
config.singleLine = false;
|
|
85
94
|
}
|
package/dist/makeConfig.js.flow
CHANGED
|
@@ -61,13 +61,22 @@ export default (rows, userConfig = {}) => {
|
|
|
61
61
|
|
|
62
62
|
if (!config.drawHorizontalLine) {
|
|
63
63
|
/**
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
* @returns {boolean}
|
|
65
|
+
*/
|
|
66
66
|
config.drawHorizontalLine = () => {
|
|
67
67
|
return true;
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
if (!config.drawVerticalLine) {
|
|
72
|
+
/**
|
|
73
|
+
* @returns {boolean}
|
|
74
|
+
*/
|
|
75
|
+
config.drawVerticalLine = () => {
|
|
76
|
+
return true;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
71
80
|
if (config.singleLine === undefined) {
|
|
72
81
|
config.singleLine = false;
|
|
73
82
|
}
|
package/dist/makeStreamConfig.js
CHANGED
|
@@ -90,6 +90,16 @@ const makeStreamConfig = (userConfig = {}) => {
|
|
|
90
90
|
|
|
91
91
|
config.border = makeBorder(config.border);
|
|
92
92
|
config.columns = makeColumns(config.columnCount, config.columns, config.columnDefault);
|
|
93
|
+
|
|
94
|
+
if (!config.drawVerticalLine) {
|
|
95
|
+
/**
|
|
96
|
+
* @returns {boolean}
|
|
97
|
+
*/
|
|
98
|
+
config.drawVerticalLine = () => {
|
|
99
|
+
return true;
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
93
103
|
return config;
|
|
94
104
|
};
|
|
95
105
|
|
|
@@ -79,5 +79,14 @@ export default (userConfig = {}) => {
|
|
|
79
79
|
config.border = makeBorder(config.border);
|
|
80
80
|
config.columns = makeColumns(config.columnCount, config.columns, config.columnDefault);
|
|
81
81
|
|
|
82
|
+
if (!config.drawVerticalLine) {
|
|
83
|
+
/**
|
|
84
|
+
* @returns {boolean}
|
|
85
|
+
*/
|
|
86
|
+
config.drawVerticalLine = () => {
|
|
87
|
+
return true;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
82
91
|
return config;
|
|
83
92
|
};
|
package/dist/schemas/config.json
CHANGED
package/dist/table.js
CHANGED
|
@@ -64,6 +64,17 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
64
64
|
* @property {string} joinJoin
|
|
65
65
|
*/
|
|
66
66
|
|
|
67
|
+
/**
|
|
68
|
+
* Used to tell whether to draw a vertical line.
|
|
69
|
+
* This callback is called for each non-content line of the table.
|
|
70
|
+
* The default behavior is to always return true.
|
|
71
|
+
*
|
|
72
|
+
* @typedef {Function} drawVerticalLine
|
|
73
|
+
* @param {number} index
|
|
74
|
+
* @param {number} size
|
|
75
|
+
* @returns {boolean}
|
|
76
|
+
*/
|
|
77
|
+
|
|
67
78
|
/**
|
|
68
79
|
* Used to tell whether to draw a horizontal line.
|
|
69
80
|
* This callback is called for each non-content line of the table.
|
|
@@ -80,6 +91,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
80
91
|
* @property {table~border} border
|
|
81
92
|
* @property {table~columns[]} columns Column specific configuration.
|
|
82
93
|
* @property {table~columns} columnDefault Default values for all columns. Column specific settings overwrite the default values.
|
|
94
|
+
* @property {table~drawVerticalLine} drawVerticalLine
|
|
83
95
|
* @property {table~drawHorizontalLine} drawHorizontalLine
|
|
84
96
|
* @property {table~singleLine} singleLine Horizontal lines inside the table are not drawn.
|
|
85
97
|
*/
|
|
@@ -102,7 +114,7 @@ const table = (data, userConfig = {}) => {
|
|
|
102
114
|
rows = (0, _alignTableData.default)(rows, config);
|
|
103
115
|
rows = (0, _padTableData.default)(rows, config);
|
|
104
116
|
const cellWidthIndex = (0, _calculateCellWidthIndex.default)(rows[0]);
|
|
105
|
-
return (0, _drawTable.default)(rows,
|
|
117
|
+
return (0, _drawTable.default)(rows, cellWidthIndex, rowHeightIndex, config);
|
|
106
118
|
};
|
|
107
119
|
|
|
108
120
|
var _default = table;
|
package/dist/table.js.flow
CHANGED
|
@@ -46,6 +46,17 @@ import validateTableData from './validateTableData';
|
|
|
46
46
|
* @property {string} joinJoin
|
|
47
47
|
*/
|
|
48
48
|
|
|
49
|
+
/**
|
|
50
|
+
* Used to tell whether to draw a vertical line.
|
|
51
|
+
* This callback is called for each non-content line of the table.
|
|
52
|
+
* The default behavior is to always return true.
|
|
53
|
+
*
|
|
54
|
+
* @typedef {Function} drawVerticalLine
|
|
55
|
+
* @param {number} index
|
|
56
|
+
* @param {number} size
|
|
57
|
+
* @returns {boolean}
|
|
58
|
+
*/
|
|
59
|
+
|
|
49
60
|
/**
|
|
50
61
|
* Used to tell whether to draw a horizontal line.
|
|
51
62
|
* This callback is called for each non-content line of the table.
|
|
@@ -62,6 +73,7 @@ import validateTableData from './validateTableData';
|
|
|
62
73
|
* @property {table~border} border
|
|
63
74
|
* @property {table~columns[]} columns Column specific configuration.
|
|
64
75
|
* @property {table~columns} columnDefault Default values for all columns. Column specific settings overwrite the default values.
|
|
76
|
+
* @property {table~drawVerticalLine} drawVerticalLine
|
|
65
77
|
* @property {table~drawHorizontalLine} drawHorizontalLine
|
|
66
78
|
* @property {table~singleLine} singleLine Horizontal lines inside the table are not drawn.
|
|
67
79
|
*/
|
|
@@ -92,5 +104,5 @@ export default (data, userConfig = {}) => {
|
|
|
92
104
|
|
|
93
105
|
const cellWidthIndex = calculateCellWidthIndex(rows[0]);
|
|
94
106
|
|
|
95
|
-
return drawTable(rows,
|
|
107
|
+
return drawTable(rows, cellWidthIndex, rowHeightIndex, config);
|
|
96
108
|
};
|
package/dist/validators.js
CHANGED
|
@@ -14,6 +14,9 @@ const schema13 = {
|
|
|
14
14
|
"columnDefault": {
|
|
15
15
|
"$ref": "shared.json#/definitions/column"
|
|
16
16
|
},
|
|
17
|
+
"drawVerticalLine": {
|
|
18
|
+
"typeof": "function"
|
|
19
|
+
},
|
|
17
20
|
"drawHorizontalLine": {
|
|
18
21
|
"typeof": "function"
|
|
19
22
|
},
|
|
@@ -801,7 +804,7 @@ function validate43(data, {
|
|
|
801
804
|
let errors = 0;
|
|
802
805
|
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
803
806
|
for (const key0 in data) {
|
|
804
|
-
if (!(((((key0 === "border") || (key0 === "columns")) || (key0 === "columnDefault")) || (key0 === "drawHorizontalLine")) || (key0 === "singleLine"))) {
|
|
807
|
+
if (!((((((key0 === "border") || (key0 === "columns")) || (key0 === "columnDefault")) || (key0 === "drawVerticalLine")) || (key0 === "drawHorizontalLine")) || (key0 === "singleLine"))) {
|
|
805
808
|
const err0 = {
|
|
806
809
|
instancePath,
|
|
807
810
|
schemaPath: "#/additionalProperties",
|
|
@@ -852,9 +855,26 @@ function validate43(data, {
|
|
|
852
855
|
errors = vErrors.length;
|
|
853
856
|
}
|
|
854
857
|
}
|
|
858
|
+
if (data.drawVerticalLine !== undefined) {
|
|
859
|
+
if (typeof data.drawVerticalLine != "function") {
|
|
860
|
+
const err1 = {
|
|
861
|
+
instancePath: instancePath + "/drawVerticalLine",
|
|
862
|
+
schemaPath: "#/properties/drawVerticalLine/typeof",
|
|
863
|
+
keyword: "typeof",
|
|
864
|
+
params: {},
|
|
865
|
+
message: "should pass \"typeof\" keyword validation"
|
|
866
|
+
};
|
|
867
|
+
if (vErrors === null) {
|
|
868
|
+
vErrors = [err1];
|
|
869
|
+
} else {
|
|
870
|
+
vErrors.push(err1);
|
|
871
|
+
}
|
|
872
|
+
errors++;
|
|
873
|
+
}
|
|
874
|
+
}
|
|
855
875
|
if (data.drawHorizontalLine !== undefined) {
|
|
856
876
|
if (typeof data.drawHorizontalLine != "function") {
|
|
857
|
-
const
|
|
877
|
+
const err2 = {
|
|
858
878
|
instancePath: instancePath + "/drawHorizontalLine",
|
|
859
879
|
schemaPath: "#/properties/drawHorizontalLine/typeof",
|
|
860
880
|
keyword: "typeof",
|
|
@@ -862,16 +882,16 @@ function validate43(data, {
|
|
|
862
882
|
message: "should pass \"typeof\" keyword validation"
|
|
863
883
|
};
|
|
864
884
|
if (vErrors === null) {
|
|
865
|
-
vErrors = [
|
|
885
|
+
vErrors = [err2];
|
|
866
886
|
} else {
|
|
867
|
-
vErrors.push(
|
|
887
|
+
vErrors.push(err2);
|
|
868
888
|
}
|
|
869
889
|
errors++;
|
|
870
890
|
}
|
|
871
891
|
}
|
|
872
892
|
if (data.singleLine !== undefined) {
|
|
873
893
|
if (typeof data.singleLine != "boolean") {
|
|
874
|
-
const
|
|
894
|
+
const err3 = {
|
|
875
895
|
instancePath: instancePath + "/singleLine",
|
|
876
896
|
schemaPath: "#/properties/singleLine/typeof",
|
|
877
897
|
keyword: "typeof",
|
|
@@ -879,15 +899,15 @@ function validate43(data, {
|
|
|
879
899
|
message: "should pass \"typeof\" keyword validation"
|
|
880
900
|
};
|
|
881
901
|
if (vErrors === null) {
|
|
882
|
-
vErrors = [
|
|
902
|
+
vErrors = [err3];
|
|
883
903
|
} else {
|
|
884
|
-
vErrors.push(
|
|
904
|
+
vErrors.push(err3);
|
|
885
905
|
}
|
|
886
906
|
errors++;
|
|
887
907
|
}
|
|
888
908
|
}
|
|
889
909
|
} else {
|
|
890
|
-
const
|
|
910
|
+
const err4 = {
|
|
891
911
|
instancePath,
|
|
892
912
|
schemaPath: "#/type",
|
|
893
913
|
keyword: "type",
|
|
@@ -897,9 +917,9 @@ function validate43(data, {
|
|
|
897
917
|
message: "must be object"
|
|
898
918
|
};
|
|
899
919
|
if (vErrors === null) {
|
|
900
|
-
vErrors = [
|
|
920
|
+
vErrors = [err4];
|
|
901
921
|
} else {
|
|
902
|
-
vErrors.push(
|
|
922
|
+
vErrors.push(err4);
|
|
903
923
|
}
|
|
904
924
|
errors++;
|
|
905
925
|
}
|
|
@@ -923,6 +943,9 @@ const schema20 = {
|
|
|
923
943
|
},
|
|
924
944
|
"columnCount": {
|
|
925
945
|
"type": "number"
|
|
946
|
+
},
|
|
947
|
+
"drawVerticalLine": {
|
|
948
|
+
"typeof": "function"
|
|
926
949
|
}
|
|
927
950
|
},
|
|
928
951
|
"additionalProperties": false
|
|
@@ -1400,7 +1423,7 @@ function validate69(data, {
|
|
|
1400
1423
|
let errors = 0;
|
|
1401
1424
|
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
1402
1425
|
for (const key0 in data) {
|
|
1403
|
-
if (!((((key0 === "border") || (key0 === "columns")) || (key0 === "columnDefault")) || (key0 === "columnCount"))) {
|
|
1426
|
+
if (!(((((key0 === "border") || (key0 === "columns")) || (key0 === "columnDefault")) || (key0 === "columnCount")) || (key0 === "drawVerticalLine"))) {
|
|
1404
1427
|
const err0 = {
|
|
1405
1428
|
instancePath,
|
|
1406
1429
|
schemaPath: "#/additionalProperties",
|
|
@@ -1471,8 +1494,25 @@ function validate69(data, {
|
|
|
1471
1494
|
errors++;
|
|
1472
1495
|
}
|
|
1473
1496
|
}
|
|
1497
|
+
if (data.drawVerticalLine !== undefined) {
|
|
1498
|
+
if (typeof data.drawVerticalLine != "function") {
|
|
1499
|
+
const err2 = {
|
|
1500
|
+
instancePath: instancePath + "/drawVerticalLine",
|
|
1501
|
+
schemaPath: "#/properties/drawVerticalLine/typeof",
|
|
1502
|
+
keyword: "typeof",
|
|
1503
|
+
params: {},
|
|
1504
|
+
message: "should pass \"typeof\" keyword validation"
|
|
1505
|
+
};
|
|
1506
|
+
if (vErrors === null) {
|
|
1507
|
+
vErrors = [err2];
|
|
1508
|
+
} else {
|
|
1509
|
+
vErrors.push(err2);
|
|
1510
|
+
}
|
|
1511
|
+
errors++;
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
1474
1514
|
} else {
|
|
1475
|
-
const
|
|
1515
|
+
const err3 = {
|
|
1476
1516
|
instancePath,
|
|
1477
1517
|
schemaPath: "#/type",
|
|
1478
1518
|
keyword: "type",
|
|
@@ -1482,9 +1522,9 @@ function validate69(data, {
|
|
|
1482
1522
|
message: "must be object"
|
|
1483
1523
|
};
|
|
1484
1524
|
if (vErrors === null) {
|
|
1485
|
-
vErrors = [
|
|
1525
|
+
vErrors = [err3];
|
|
1486
1526
|
} else {
|
|
1487
|
-
vErrors.push(
|
|
1527
|
+
vErrors.push(err3);
|
|
1488
1528
|
}
|
|
1489
1529
|
errors++;
|
|
1490
1530
|
}
|
package/package.json
CHANGED