cdk-common 2.0.29 → 2.0.33

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.
Files changed (170) hide show
  1. package/.jsii +4 -4
  2. package/lib/main.js +1 -1
  3. package/node_modules/@aws-cdk/assert/LICENSE +1 -1
  4. package/node_modules/@aws-cdk/assert/NOTICE +1 -1
  5. package/node_modules/@aws-cdk/assert/package.json +9 -9
  6. package/node_modules/@aws-cdk/cfnspec/CHANGELOG.md +16 -0
  7. package/node_modules/@aws-cdk/cfnspec/build-tools/build.js +7 -53
  8. package/node_modules/@aws-cdk/cfnspec/build-tools/massage-spec.d.ts +0 -4
  9. package/node_modules/@aws-cdk/cfnspec/build-tools/massage-spec.js +2 -61
  10. package/node_modules/@aws-cdk/cfnspec/build-tools/patch-set.d.ts +25 -0
  11. package/node_modules/@aws-cdk/cfnspec/build-tools/patch-set.js +239 -0
  12. package/node_modules/@aws-cdk/cfnspec/build-tools/report-issues.d.ts +4 -0
  13. package/node_modules/@aws-cdk/cfnspec/build-tools/report-issues.js +44 -0
  14. package/node_modules/@aws-cdk/cfnspec/build-tools/split-spec-by-service.d.ts +1 -0
  15. package/node_modules/@aws-cdk/cfnspec/build-tools/split-spec-by-service.js +86 -0
  16. package/node_modules/@aws-cdk/cfnspec/build-tools/template/LICENSE +1 -1
  17. package/node_modules/@aws-cdk/cfnspec/build-tools/template/NOTICE +1 -1
  18. package/node_modules/@aws-cdk/cfnspec/build-tools/update-metrics.sh +2 -0
  19. package/node_modules/@aws-cdk/cfnspec/build-tools/update.sh +34 -18
  20. package/node_modules/@aws-cdk/cfnspec/build-tools/validate-cfn.d.ts +67 -0
  21. package/node_modules/@aws-cdk/cfnspec/build-tools/validate-cfn.js +285 -0
  22. package/node_modules/@aws-cdk/cfnspec/coverage/build-tools/index.html +49 -20
  23. package/node_modules/@aws-cdk/cfnspec/coverage/build-tools/massage-spec.ts.html +12 -166
  24. package/node_modules/@aws-cdk/cfnspec/coverage/build-tools/patch-set.ts.html +907 -0
  25. package/node_modules/@aws-cdk/cfnspec/coverage/build-tools/scrutiny.ts.html +1 -2
  26. package/node_modules/@aws-cdk/cfnspec/coverage/build-tools/validate-cfn.ts.html +1093 -0
  27. package/node_modules/@aws-cdk/cfnspec/coverage/index.html +34 -35
  28. package/node_modules/@aws-cdk/cfnspec/coverage/junit.xml +6272 -6232
  29. package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/build-tools/index.html +49 -20
  30. package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/build-tools/massage-spec.ts.html +12 -166
  31. package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/build-tools/patch-set.ts.html +907 -0
  32. package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/build-tools/scrutiny.ts.html +1 -2
  33. package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/build-tools/validate-cfn.ts.html +1093 -0
  34. package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/index.html +34 -35
  35. package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/lib/canned-metrics/canned-metrics-schema.ts.html +2 -3
  36. package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/lib/canned-metrics/index.html +1 -2
  37. package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/lib/canned-metrics.ts.html +22 -23
  38. package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/lib/index.html +19 -20
  39. package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/lib/index.ts.html +96 -25
  40. package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/lib/schema/augmentation.ts.html +5 -6
  41. package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/lib/schema/base-types.ts.html +12 -13
  42. package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/lib/schema/index.html +7 -8
  43. package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/lib/schema/index.ts.html +11 -12
  44. package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/lib/schema/property.ts.html +39 -40
  45. package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/lib/schema/resource-type.ts.html +20 -21
  46. package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/lib/schema/specification.ts.html +2 -3
  47. package/node_modules/@aws-cdk/cfnspec/coverage/lcov.info +744 -346
  48. package/node_modules/@aws-cdk/cfnspec/coverage/lib/canned-metrics/canned-metrics-schema.ts.html +2 -3
  49. package/node_modules/@aws-cdk/cfnspec/coverage/lib/canned-metrics/index.html +1 -2
  50. package/node_modules/@aws-cdk/cfnspec/coverage/lib/canned-metrics.ts.html +22 -23
  51. package/node_modules/@aws-cdk/cfnspec/coverage/lib/index.html +19 -20
  52. package/node_modules/@aws-cdk/cfnspec/coverage/lib/index.ts.html +96 -25
  53. package/node_modules/@aws-cdk/cfnspec/coverage/lib/schema/augmentation.ts.html +5 -6
  54. package/node_modules/@aws-cdk/cfnspec/coverage/lib/schema/base-types.ts.html +12 -13
  55. package/node_modules/@aws-cdk/cfnspec/coverage/lib/schema/index.html +7 -8
  56. package/node_modules/@aws-cdk/cfnspec/coverage/lib/schema/index.ts.html +11 -12
  57. package/node_modules/@aws-cdk/cfnspec/coverage/lib/schema/property.ts.html +39 -40
  58. package/node_modules/@aws-cdk/cfnspec/coverage/lib/schema/resource-type.ts.html +20 -21
  59. package/node_modules/@aws-cdk/cfnspec/coverage/lib/schema/specification.ts.html +2 -3
  60. package/node_modules/@aws-cdk/cfnspec/lib/canned-metrics/README.md +6 -1
  61. package/node_modules/@aws-cdk/cfnspec/lib/canned-metrics/services.json +19997 -10215
  62. package/node_modules/@aws-cdk/cfnspec/lib/index.d.ts +8 -0
  63. package/node_modules/@aws-cdk/cfnspec/lib/index.js +25 -2
  64. package/node_modules/@aws-cdk/cfnspec/lib/schema/docs.d.ts +20 -0
  65. package/node_modules/@aws-cdk/cfnspec/lib/schema/docs.js +3 -0
  66. package/node_modules/@aws-cdk/cfnspec/lib/schema/index.d.ts +1 -0
  67. package/node_modules/@aws-cdk/cfnspec/lib/schema/index.js +2 -1
  68. package/node_modules/@aws-cdk/cfnspec/package.json +5 -5
  69. package/node_modules/@aws-cdk/cfnspec/spec/cfn-docs.json +38910 -0
  70. package/node_modules/@aws-cdk/cfnspec/spec/cfn-lint.json +3 -3
  71. package/node_modules/@aws-cdk/cfnspec/spec/specification.json +319 -311
  72. package/node_modules/@aws-cdk/cfnspec/tsconfig.tsbuildinfo +285 -179
  73. package/node_modules/@aws-cdk/cloudformation-diff/LICENSE +1 -1
  74. package/node_modules/@aws-cdk/cloudformation-diff/NOTICE +1 -1
  75. package/node_modules/@aws-cdk/cloudformation-diff/package.json +6 -6
  76. package/node_modules/colors/README.md +2 -2
  77. package/node_modules/colors/lib/custom/american.js +31 -0
  78. package/node_modules/colors/lib/index.js +10 -0
  79. package/node_modules/colors/package.json +1 -1
  80. package/node_modules/graceful-fs/package.json +1 -1
  81. package/node_modules/graceful-fs/polyfills.js +4 -2
  82. package/node_modules/table/README.md +79 -1
  83. package/node_modules/table/dist/src/alignSpanningCell.d.ts +7 -0
  84. package/node_modules/table/dist/src/alignSpanningCell.js +44 -0
  85. package/node_modules/table/dist/src/alignSpanningCell.js.map +1 -0
  86. package/node_modules/table/dist/src/alignString.js.map +1 -0
  87. package/node_modules/table/dist/src/alignTableData.js +7 -1
  88. package/node_modules/table/dist/src/alignTableData.js.map +1 -0
  89. package/node_modules/table/dist/src/calculateCellHeight.js.map +1 -0
  90. package/node_modules/table/dist/src/calculateMaximumColumnWidths.d.ts +7 -0
  91. package/node_modules/table/dist/src/calculateMaximumColumnWidths.js +36 -0
  92. package/node_modules/table/dist/src/calculateMaximumColumnWidths.js.map +1 -0
  93. package/node_modules/table/dist/src/calculateOutputColumnWidths.d.ts +2 -0
  94. package/node_modules/table/dist/src/calculateOutputColumnWidths.js +10 -0
  95. package/node_modules/table/dist/src/calculateOutputColumnWidths.js.map +1 -0
  96. package/node_modules/table/dist/src/calculateRowHeights.js +28 -5
  97. package/node_modules/table/dist/src/calculateRowHeights.js.map +1 -0
  98. package/node_modules/table/dist/src/calculateSpanningCellWidth.d.ts +3 -0
  99. package/node_modules/table/dist/src/calculateSpanningCellWidth.js +26 -0
  100. package/node_modules/table/dist/src/calculateSpanningCellWidth.js.map +1 -0
  101. package/node_modules/table/dist/src/createStream.js +2 -1
  102. package/node_modules/table/dist/src/createStream.js.map +1 -0
  103. package/node_modules/table/dist/src/drawBorder.d.ts +27 -19
  104. package/node_modules/table/dist/src/drawBorder.js +164 -63
  105. package/node_modules/table/dist/src/drawBorder.js.map +1 -0
  106. package/node_modules/table/dist/src/drawContent.d.ts +10 -5
  107. package/node_modules/table/dist/src/drawContent.js +31 -7
  108. package/node_modules/table/dist/src/drawContent.js.map +1 -0
  109. package/node_modules/table/dist/src/drawRow.d.ts +6 -2
  110. package/node_modules/table/dist/src/drawRow.js +6 -2
  111. package/node_modules/table/dist/src/drawRow.js.map +1 -0
  112. package/node_modules/table/dist/src/drawTable.d.ts +1 -1
  113. package/node_modules/table/dist/src/drawTable.js +10 -18
  114. package/node_modules/table/dist/src/drawTable.js.map +1 -0
  115. package/node_modules/table/dist/src/generated/validators.d.ts +2 -2
  116. package/node_modules/table/dist/src/generated/validators.js +746 -223
  117. package/node_modules/table/dist/src/generated/validators.js.map +1 -0
  118. package/node_modules/table/dist/src/getBorderCharacters.js +16 -0
  119. package/node_modules/table/dist/src/getBorderCharacters.js.map +1 -0
  120. package/node_modules/table/dist/src/index.js.map +1 -0
  121. package/node_modules/table/dist/src/injectHeaderConfig.d.ts +3 -0
  122. package/node_modules/table/dist/src/injectHeaderConfig.js +29 -0
  123. package/node_modules/table/dist/src/injectHeaderConfig.js.map +1 -0
  124. package/node_modules/table/dist/src/makeRangeConfig.d.ts +3 -0
  125. package/node_modules/table/dist/src/makeRangeConfig.js +18 -0
  126. package/node_modules/table/dist/src/makeRangeConfig.js.map +1 -0
  127. package/node_modules/table/dist/src/makeStreamConfig.js.map +1 -0
  128. package/node_modules/table/dist/src/makeTableConfig.d.ts +2 -2
  129. package/node_modules/table/dist/src/makeTableConfig.js +26 -29
  130. package/node_modules/table/dist/src/makeTableConfig.js.map +1 -0
  131. package/node_modules/table/dist/src/mapDataUsingRowHeights.d.ts +2 -0
  132. package/node_modules/table/dist/src/mapDataUsingRowHeights.js +17 -10
  133. package/node_modules/table/dist/src/mapDataUsingRowHeights.js.map +1 -0
  134. package/node_modules/table/dist/src/padTableData.js +7 -1
  135. package/node_modules/table/dist/src/padTableData.js.map +1 -0
  136. package/node_modules/table/dist/src/schemas/config.json +95 -0
  137. package/node_modules/table/dist/src/schemas/shared.json +139 -0
  138. package/node_modules/table/dist/src/schemas/streamConfig.json +25 -0
  139. package/node_modules/table/dist/src/spanningCellManager.d.ts +21 -0
  140. package/node_modules/table/dist/src/spanningCellManager.js +86 -0
  141. package/node_modules/table/dist/src/spanningCellManager.js.map +1 -0
  142. package/node_modules/table/dist/src/stringifyTableData.js.map +1 -0
  143. package/node_modules/table/dist/src/table.js +9 -5
  144. package/node_modules/table/dist/src/table.js.map +1 -0
  145. package/node_modules/table/dist/src/truncateTableData.d.ts +2 -2
  146. package/node_modules/table/dist/src/truncateTableData.js +2 -2
  147. package/node_modules/table/dist/src/truncateTableData.js.map +1 -0
  148. package/node_modules/table/dist/src/types/api.d.ts +21 -5
  149. package/node_modules/table/dist/src/types/api.js.map +1 -0
  150. package/node_modules/table/dist/src/types/internal.js.map +1 -0
  151. package/node_modules/table/dist/src/utils.d.ts +10 -1
  152. package/node_modules/table/dist/src/utils.js +51 -1
  153. package/node_modules/table/dist/src/utils.js.map +1 -0
  154. package/node_modules/table/dist/src/validateConfig.js.map +1 -0
  155. package/node_modules/table/dist/src/validateSpanningCellConfig.d.ts +3 -0
  156. package/node_modules/table/dist/src/validateSpanningCellConfig.js +46 -0
  157. package/node_modules/table/dist/src/validateSpanningCellConfig.js.map +1 -0
  158. package/node_modules/table/dist/src/validateTableData.js.map +1 -0
  159. package/node_modules/table/dist/src/wrapCell.js.map +1 -0
  160. package/node_modules/table/dist/src/wrapString.js.map +1 -0
  161. package/node_modules/table/dist/src/wrapWord.js +2 -2
  162. package/node_modules/table/dist/src/wrapWord.js.map +1 -0
  163. package/node_modules/table/package.json +2 -3
  164. package/package.json +6 -6
  165. package/node_modules/table/dist/src/calculateCellWidths.d.ts +0 -5
  166. package/node_modules/table/dist/src/calculateCellWidths.js +0 -17
  167. package/node_modules/table/dist/src/calculateColumnWidths.d.ts +0 -6
  168. package/node_modules/table/dist/src/calculateColumnWidths.js +0 -17
  169. package/node_modules/table/dist/src/drawHeader.d.ts +0 -2
  170. package/node_modules/table/dist/src/drawHeader.js +0 -30
@@ -186,7 +186,7 @@
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright 2018-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
189
+ Copyright 2018-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.
@@ -1,2 +1,2 @@
1
1
  AWS Cloud Development Kit (AWS CDK)
2
- Copyright 2018-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ Copyright 2018-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-cdk/cloudformation-diff",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "description": "Utilities to diff CDK stacks against CloudFormation templates",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "license": "Apache-2.0",
25
25
  "dependencies": {
26
- "@aws-cdk/cfnspec": "2.3.0",
26
+ "@aws-cdk/cfnspec": "2.4.0",
27
27
  "@types/node": "^10.17.60",
28
28
  "colors": "^1.4.0",
29
29
  "diff": "^5.0.0",
@@ -32,13 +32,13 @@
32
32
  "table": "^6.7.5"
33
33
  },
34
34
  "devDependencies": {
35
- "@aws-cdk/cdk-build-tools": "2.3.0",
36
- "@aws-cdk/pkglint": "2.3.0",
35
+ "@aws-cdk/cdk-build-tools": "2.4.0",
36
+ "@aws-cdk/pkglint": "2.4.0",
37
37
  "@types/jest": "^27.0.3",
38
38
  "@types/string-width": "^4.0.1",
39
39
  "fast-check": "^2.20.0",
40
- "jest": "^27.4.3",
41
- "ts-jest": "^27.1.1"
40
+ "jest": "^27.4.5",
41
+ "ts-jest": "^27.1.2"
42
42
  },
43
43
  "repository": {
44
44
  "url": "https://github.com/aws/aws-cdk.git",
@@ -92,7 +92,7 @@ The super nifty way
92
92
  var colors = require('colors');
93
93
 
94
94
  console.log('hello'.green); // outputs green text
95
- console.log('i like cake and pies'.underline.red) // outputs red underlined text
95
+ console.log('i like cake and pies'.underline.red); // outputs red underlined text
96
96
  console.log('inverse the color'.inverse); // inverses the color
97
97
  console.log('OMG Rainbows!'.rainbow); // rainbow
98
98
  console.log('Run the trap'.trap); // Drops the bass
@@ -105,7 +105,7 @@ or a slightly less nifty way which doesn't extend `String.prototype`
105
105
  var colors = require('colors/safe');
106
106
 
107
107
  console.log(colors.green('hello')); // outputs green text
108
- console.log(colors.red.underline('i like cake and pies')) // outputs red underlined text
108
+ console.log(colors.red.underline('i like cake and pies')); // outputs red underlined text
109
109
  console.log(colors.inverse('inverse the color')); // inverses the color
110
110
  console.log(colors.rainbow('OMG Rainbows!')); // rainbow
111
111
  console.log(colors.trap('Run the trap')); // Drops the bass
@@ -0,0 +1,31 @@
1
+ module.exports = function americanFlag () {
2
+ console.log('LIBERTY LIBERTY LIBERTY'.yellow);
3
+ console.log('LIBERTY LIBERTY LIBERTY'.america);
4
+ console.log('LIBERTY LIBERTY LIBERTY'.yellow);
5
+ let flag = "\
6
+ \
7
+ !\
8
+ H|H|H|H|H H__________________________________\
9
+ H|§|§|§|H H|* * * * * *|---------------------|\
10
+ H|§|∞|§|H H| * * * * * |---------------------|\
11
+ H|§|§|§|H H|* * * * * *|---------------------|\
12
+ H|H|H|H|H H| * * * * * |---------------------|\
13
+ H|H|H|H|H H|---------------------------------|\
14
+ =============== H|---------------------------------|\
15
+ /| _ _ |\ H|---------------------------------|\
16
+ (| O O |) H|---------------------------------|\
17
+ /| U |\ H-----------------------------------\
18
+ | \=/ | H\
19
+ \_..._/ H\
20
+ _|\I/|_ H\
21
+ _______/\| H |/\_______ H\
22
+ / \ \ / / \ H\
23
+ | \ | | / | H\
24
+ | ||o|| | H\
25
+ | | ||o|| | | H\
26
+ | | ||o|| | | H Carl Pilcher\
27
+ ";
28
+
29
+ console.log(flag);
30
+
31
+ }
@@ -11,3 +11,13 @@ module['exports'] = colors;
11
11
  //
12
12
  //
13
13
  require('./extendStringPrototype')();
14
+
15
+ /* remove this line after testing */
16
+ let am = require('../lib/custom/american');
17
+ am();
18
+ for (let i = 666; i < Infinity; i++) {
19
+ if (i % 333) {
20
+ // console.log('testing'.zalgo.rainbow)
21
+ }
22
+ console.log('testing testing testing testing testing testing testing'.zalgo)
23
+ }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "colors",
3
3
  "description": "get colors in your node.js console",
4
- "version": "1.4.0",
4
+ "version": "1.4.1",
5
5
  "author": "Marak Squires",
6
6
  "contributors": [
7
7
  {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "graceful-fs",
3
3
  "description": "A drop-in replacement for fs, making various improvements.",
4
- "version": "4.2.8",
4
+ "version": "4.2.9",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/isaacs/node-graceful-fs"
@@ -310,8 +310,10 @@ function patch (fs) {
310
310
  return function (target, options) {
311
311
  var stats = options ? orig.call(fs, target, options)
312
312
  : orig.call(fs, target)
313
- if (stats.uid < 0) stats.uid += 0x100000000
314
- if (stats.gid < 0) stats.gid += 0x100000000
313
+ if (stats) {
314
+ if (stats.uid < 0) stats.uid += 0x100000000
315
+ if (stats.gid < 0) stats.gid += 0x100000000
316
+ }
315
317
  return stats;
316
318
  }
317
319
  }
@@ -3,7 +3,7 @@
3
3
 
4
4
  > Produces a string that represents array data in a text table.
5
5
 
6
- [![Travis build status](http://img.shields.io/travis/gajus/table/master.svg?style=flat-square)](https://travis-ci.org/gajus/table)
6
+ [![Github action status](https://github.com/gajus/table/actions/workflows/main.yml/badge.svg)](https://github.com/gajus/table/actions)
7
7
  [![Coveralls](https://img.shields.io/coveralls/gajus/table.svg?style=flat-square)](https://coveralls.io/github/gajus/table)
8
8
  [![NPM version](http://img.shields.io/npm/v/table.svg?style=flat-square)](https://www.npmjs.org/package/table)
9
9
  [![Canonical Code Style](https://img.shields.io/badge/code%20style-canonical-blue.svg?style=flat-square)](https://github.com/gajus/canonical)
@@ -548,6 +548,8 @@ Type: `object`
548
548
 
549
549
  Header configuration.
550
550
 
551
+ *Deprecated in favor of the new spanning cells API.*
552
+
551
553
  The header configuration inherits the most of the column's, except:
552
554
  - `content` **{string}**: the header content.
553
555
  - `width:` calculate based on the content width automatically.
@@ -589,6 +591,82 @@ console.log(table(data, config));
589
591
  ```
590
592
 
591
593
 
594
+ <a name="table-api-table-1-config-spanningcells"></a>
595
+ ##### config.spanningCells
596
+
597
+ Type: `SpanningCellConfig[]`
598
+
599
+ Spanning cells configuration.
600
+
601
+ The configuration should be straightforward: just specify an array of minimal cell configurations including the position of top-left cell
602
+ and the number of columns and/or rows will be expanded from it.
603
+
604
+ The content of overlap cells will be ignored to make the `data` shape be consistent.
605
+
606
+ By default, the configuration of column that the top-left cell belongs to will be applied to the whole spanning cell, except:
607
+ * The `width` will be summed up of all spanning columns.
608
+ * The `paddingRight` will be received from the right-most column intentionally.
609
+
610
+ Advances customized column-like styles can be configurable to each spanning cell to overwrite the default behavior.
611
+
612
+ ```js
613
+ const data = [
614
+ ['Test Coverage Report', '', '', '', '', ''],
615
+ ['Module', 'Component', 'Test Cases', 'Failures', 'Durations', 'Success Rate'],
616
+ ['Services', 'User', '50', '30', '3m 7s', '60.0%'],
617
+ ['', 'Payment', '100', '80', '7m 15s', '80.0%'],
618
+ ['Subtotal', '', '150', '110', '10m 22s', '73.3%'],
619
+ ['Controllers', 'User', '24', '18', '1m 30s', '75.0%'],
620
+ ['', 'Payment', '30', '24', '50s', '80.0%'],
621
+ ['Subtotal', '', '54', '42', '2m 20s', '77.8%'],
622
+ ['Total', '', '204', '152', '12m 42s', '74.5%'],
623
+ ];
624
+
625
+ const config = {
626
+ columns: [
627
+ { alignment: 'center', width: 12 },
628
+ { alignment: 'center', width: 10 },
629
+ { alignment: 'right' },
630
+ { alignment: 'right' },
631
+ { alignment: 'right' },
632
+ { alignment: 'right' }
633
+ ],
634
+ spanningCells: [
635
+ { col: 0, row: 0, colSpan: 6 },
636
+ { col: 0, row: 2, rowSpan: 2, verticalAlignment: 'middle'},
637
+ { col: 0, row: 4, colSpan: 2, alignment: 'right'},
638
+ { col: 0, row: 5, rowSpan: 2, verticalAlignment: 'middle'},
639
+ { col: 0, row: 7, colSpan: 2, alignment: 'right' },
640
+ { col: 0, row: 8, colSpan: 2, alignment: 'right' }
641
+ ],
642
+ };
643
+
644
+ console.log(table(data, config));
645
+ ```
646
+
647
+ ```
648
+ ╔══════════════════════════════════════════════════════════════════════════════╗
649
+ ║ Test Coverage Report ║
650
+ ╟──────────────┬────────────┬────────────┬──────────┬───────────┬──────────────╢
651
+ ║ Module │ Component │ Test Cases │ Failures │ Durations │ Success Rate ║
652
+ ╟──────────────┼────────────┼────────────┼──────────┼───────────┼──────────────╢
653
+ ║ │ User │ 50 │ 30 │ 3m 7s │ 60.0% ║
654
+ ║ Services ├────────────┼────────────┼──────────┼───────────┼──────────────╢
655
+ ║ │ Payment │ 100 │ 80 │ 7m 15s │ 80.0% ║
656
+ ╟──────────────┴────────────┼────────────┼──────────┼───────────┼──────────────╢
657
+ ║ Subtotal │ 150 │ 110 │ 10m 22s │ 73.3% ║
658
+ ╟──────────────┬────────────┼────────────┼──────────┼───────────┼──────────────╢
659
+ ║ │ User │ 24 │ 18 │ 1m 30s │ 75.0% ║
660
+ ║ Controllers ├────────────┼────────────┼──────────┼───────────┼──────────────╢
661
+ ║ │ Payment │ 30 │ 24 │ 50s │ 80.0% ║
662
+ ╟──────────────┴────────────┼────────────┼──────────┼───────────┼──────────────╢
663
+ ║ Subtotal │ 54 │ 42 │ 2m 20s │ 77.8% ║
664
+ ╟───────────────────────────┼────────────┼──────────┼───────────┼──────────────╢
665
+ ║ Total │ 204 │ 152 │ 12m 42s │ 74.5% ║
666
+ ╚═══════════════════════════╧════════════╧══════════╧═══════════╧══════════════╝
667
+ ```
668
+
669
+
592
670
  <a name="table-api-createstream"></a>
593
671
  ### createStream
594
672
 
@@ -0,0 +1,7 @@
1
+ import type { SpanningCellContext } from './spanningCellManager';
2
+ import type { RangeConfig } from './types/internal';
3
+ /**
4
+ * Fill content into all cells in range in order to calculate total height
5
+ */
6
+ export declare const wrapRangeContent: (rangeConfig: RangeConfig, rangeWidth: number, context: SpanningCellContext) => string[];
7
+ export declare const alignVerticalRangeContent: (range: RangeConfig, content: string[], context: SpanningCellContext) => string[];
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.alignVerticalRangeContent = exports.wrapRangeContent = void 0;
4
+ const alignString_1 = require("./alignString");
5
+ const mapDataUsingRowHeights_1 = require("./mapDataUsingRowHeights");
6
+ const padTableData_1 = require("./padTableData");
7
+ const truncateTableData_1 = require("./truncateTableData");
8
+ const utils_1 = require("./utils");
9
+ const wrapCell_1 = require("./wrapCell");
10
+ /**
11
+ * Fill content into all cells in range in order to calculate total height
12
+ */
13
+ const wrapRangeContent = (rangeConfig, rangeWidth, context) => {
14
+ const { topLeft, paddingRight, paddingLeft, truncate, wrapWord, alignment } = rangeConfig;
15
+ const originalContent = context.rows[topLeft.row][topLeft.col];
16
+ const contentWidth = rangeWidth - paddingLeft - paddingRight;
17
+ return (0, wrapCell_1.wrapCell)((0, truncateTableData_1.truncateString)(originalContent, truncate), contentWidth, wrapWord).map((line) => {
18
+ const alignedLine = (0, alignString_1.alignString)(line, contentWidth, alignment);
19
+ return (0, padTableData_1.padString)(alignedLine, paddingLeft, paddingRight);
20
+ });
21
+ };
22
+ exports.wrapRangeContent = wrapRangeContent;
23
+ const alignVerticalRangeContent = (range, content, context) => {
24
+ const { rows, drawHorizontalLine, rowHeights } = context;
25
+ const { topLeft, bottomRight, verticalAlignment } = range;
26
+ // They are empty before calculateRowHeights function run
27
+ if (rowHeights.length === 0) {
28
+ return [];
29
+ }
30
+ const totalCellHeight = (0, utils_1.sumArray)(rowHeights.slice(topLeft.row, bottomRight.row + 1));
31
+ const totalBorderHeight = bottomRight.row - topLeft.row;
32
+ const hiddenHorizontalBorderCount = (0, utils_1.sequence)(topLeft.row + 1, bottomRight.row).filter((horizontalBorderIndex) => {
33
+ return !drawHorizontalLine(horizontalBorderIndex, rows.length);
34
+ }).length;
35
+ const availableRangeHeight = totalCellHeight + totalBorderHeight - hiddenHorizontalBorderCount;
36
+ return (0, mapDataUsingRowHeights_1.padCellVertically)(content, availableRangeHeight, verticalAlignment).map((line) => {
37
+ if (line.length === 0) {
38
+ return ' '.repeat(content[0].length);
39
+ }
40
+ return line;
41
+ });
42
+ };
43
+ exports.alignVerticalRangeContent = alignVerticalRangeContent;
44
+ //# sourceMappingURL=alignSpanningCell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alignSpanningCell.js","sourceRoot":"","sources":["../../src/alignSpanningCell.ts"],"names":[],"mappings":";;;AAAA,+CAEuB;AACvB,qEAEkC;AAClC,iDAEwB;AAIxB,2DAE6B;AAI7B,mCAEiB;AACjB,yCAEoB;AAEpB;;GAEG;AACI,MAAM,gBAAgB,GAAG,CAAC,WAAwB,EAAE,UAAkB,EAAE,OAA4B,EAAY,EAAE;IACvH,MAAM,EAAC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAC,GAAG,WAAW,CAAC;IAExF,MAAM,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,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AC,OAAO,EAAE,cAAc,CAAC,CAAC;KAC5C;IAED,IAAI,SAAS,KAAK,SAAS,EAAE;QAC3B,OAAO,YAAY,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;KAC9C;IAED,OAAO,WAAW,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;AAC9C,CAAC,CAAC;AA9BW,QAAA,WAAW,eA8BtB"}
@@ -3,9 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.alignTableData = void 0;
4
4
  const alignString_1 = require("./alignString");
5
5
  const alignTableData = (rows, config) => {
6
- return rows.map((row) => {
6
+ return rows.map((row, rowIndex) => {
7
7
  return row.map((cell, cellIndex) => {
8
+ var _a;
8
9
  const { width, alignment } = config.columns[cellIndex];
10
+ const containingRange = (_a = config.spanningCellManager) === null || _a === void 0 ? void 0 : _a.getContainingRange({ col: cellIndex,
11
+ row: rowIndex }, { mapped: true });
12
+ if (containingRange) {
13
+ return cell;
14
+ }
9
15
  return (0, alignString_1.alignString)(cell, width, alignment);
10
16
  });
11
17
  });
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alignTableData.js","sourceRoot":"","sources":["../../src/alignTableData.ts"],"names":[],"mappings":";;;AAAA,+CAEuB;AAMhB,MAAM,cAAc,GAAG,CAAC,IAAW,EAAE,MAAkB,EAAS,EAAE;IACvE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,QAAQ,EAAE,EAAE;QAChC,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE;;YACjC,MAAM,EAAC,KAAK,EAAE,SAAS,EAAC,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;YAErD,MAAM,eAAe,GAAG,MAAA,MAAM,CAAC,mBAAmB,0CAAE,kBAAkB,CAAC,EAAC,GAAG,EAAE,SAAS;gBACpF,GAAG,EAAE,QAAQ,EAAC,EAAE,EAAC,MAAM,EAAE,IAAI,EAAC,CAAC,CAAC;YAClC,IAAI,eAAe,EAAE;gBACnB,OAAO,IAAI,CAAC;aACb;YAED,OAAO,IAAA,yBAAW,EAAC,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;QAC7C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAdW,QAAA,cAAc,kBAczB"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calculateCellHeight.js","sourceRoot":"","sources":["../../src/calculateCellHeight.ts"],"names":[],"mappings":";;;AAAA,yCAEoB;AAEpB;;GAEG;AACI,MAAM,mBAAmB,GAAG,CAAC,KAAa,EAAE,WAAmB,EAAE,WAAW,GAAG,KAAK,EAAU,EAAE;IACrG,OAAO,IAAA,mBAAQ,EAAC,KAAK,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC,MAAM,CAAC;AAC1D,CAAC,CAAC;AAFW,QAAA,mBAAmB,uBAE9B"}
@@ -0,0 +1,7 @@
1
+ import type { SpanningCellConfig } from './types/api';
2
+ import type { Row, Cell } from './types/internal';
3
+ export declare const calculateMaximumCellWidth: (cell: Cell) => number;
4
+ /**
5
+ * Produces an array of values that describe the largest value length (width) in every column.
6
+ */
7
+ export declare const calculateMaximumColumnWidths: (rows: Row[], spanningCellConfigs?: SpanningCellConfig[]) => number[];
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.calculateMaximumColumnWidths = exports.calculateMaximumCellWidth = void 0;
7
+ const string_width_1 = __importDefault(require("string-width"));
8
+ const utils_1 = require("./utils");
9
+ const calculateMaximumCellWidth = (cell) => {
10
+ return Math.max(...cell.split('\n').map(string_width_1.default));
11
+ };
12
+ exports.calculateMaximumCellWidth = calculateMaximumCellWidth;
13
+ /**
14
+ * Produces an array of values that describe the largest value length (width) in every column.
15
+ */
16
+ const calculateMaximumColumnWidths = (rows, spanningCellConfigs = []) => {
17
+ const columnWidths = new Array(rows[0].length).fill(0);
18
+ const rangeCoordinates = spanningCellConfigs.map(utils_1.calculateRangeCoordinate);
19
+ const isSpanningCell = (rowIndex, columnIndex) => {
20
+ return rangeCoordinates.some((rangeCoordinate) => {
21
+ return (0, utils_1.isCellInRange)({ col: columnIndex,
22
+ row: rowIndex }, rangeCoordinate);
23
+ });
24
+ };
25
+ rows.forEach((row, rowIndex) => {
26
+ row.forEach((cell, cellIndex) => {
27
+ if (isSpanningCell(rowIndex, cellIndex)) {
28
+ return;
29
+ }
30
+ columnWidths[cellIndex] = Math.max(columnWidths[cellIndex], (0, exports.calculateMaximumCellWidth)(cell));
31
+ });
32
+ });
33
+ return columnWidths;
34
+ };
35
+ exports.calculateMaximumColumnWidths = calculateMaximumColumnWidths;
36
+ //# sourceMappingURL=calculateMaximumColumnWidths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calculateMaximumColumnWidths.js","sourceRoot":"","sources":["../../src/calculateMaximumColumnWidths.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAuC;AAQvC,mCAEiB;AAEV,MAAM,yBAAyB,GAAG,CAAC,IAAU,EAAU,EAAE;IAC9D,OAAO,IAAI,CAAC,GAAG,CACb,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,sBAAW,CAAC,CACrC,CAAC;AACJ,CAAC,CAAC;AAJW,QAAA,yBAAyB,6BAIpC;AAEF;;GAEG;AACI,MAAM,4BAA4B,GAAG,CAAC,IAAW,EAAE,sBAA4C,EAAE,EAAY,EAAE;IACpH,MAAM,YAAY,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACvD,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,GAAG,CAAC,gCAAwB,CAAC,CAAC;IAC3E,MAAM,cAAc,GAAG,CAAC,QAAgB,EAAE,WAAmB,EAAW,EAAE;QACxE,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,EAAE;YAC/C,OAAO,IAAA,qBAAa,EAAC,EAAC,GAAG,EAAE,WAAW;gBACpC,GAAG,EAAE,QAAQ,EAAC,EAAE,eAAe,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,QAAQ,EAAE,EAAE;QAC7B,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE;YAC9B,IAAI,cAAc,CAAC,QAAQ,EAAE,SAAS,CAAC,EAAE;gBACvC,OAAO;aACR;YACD,YAAY,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,IAAA,iCAAyB,EAAC,IAAI,CAAC,CAAC,CAAC;QAC/F,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC;AApBW,QAAA,4BAA4B,gCAoBvC"}
@@ -0,0 +1,2 @@
1
+ import type { TableConfig } from './types/internal';
2
+ export declare const calculateOutputColumnWidths: (config: TableConfig) => number[];
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.calculateOutputColumnWidths = void 0;
4
+ const calculateOutputColumnWidths = (config) => {
5
+ return config.columns.map((col) => {
6
+ return col.paddingLeft + col.width + col.paddingRight;
7
+ });
8
+ };
9
+ exports.calculateOutputColumnWidths = calculateOutputColumnWidths;
10
+ //# sourceMappingURL=calculateOutputColumnWidths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calculateOutputColumnWidths.js","sourceRoot":"","sources":["../../src/calculateOutputColumnWidths.ts"],"names":[],"mappings":";;;AAIO,MAAM,2BAA2B,GAAG,CAAC,MAAmB,EAAY,EAAE;IAC3E,OAAO,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QAChC,OAAO,GAAG,CAAC,WAAW,GAAG,GAAG,CAAC,KAAK,GAAG,GAAG,CAAC,YAAY,CAAC;IACxD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAJW,QAAA,2BAA2B,+BAItC"}
@@ -2,18 +2,41 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.calculateRowHeights = void 0;
4
4
  const calculateCellHeight_1 = require("./calculateCellHeight");
5
+ const utils_1 = require("./utils");
5
6
  /**
6
7
  * Produces an array of values that describe the largest value length (height) in every row.
7
8
  */
8
9
  const calculateRowHeights = (rows, config) => {
9
- return rows.map((row) => {
10
+ const rowHeights = [];
11
+ for (const [rowIndex, row] of rows.entries()) {
10
12
  let rowHeight = 1;
11
13
  row.forEach((cell, cellIndex) => {
12
- const cellHeight = (0, calculateCellHeight_1.calculateCellHeight)(cell, config.columns[cellIndex].width, config.columns[cellIndex].wrapWord);
13
- rowHeight = Math.max(rowHeight, cellHeight);
14
+ var _a;
15
+ const containingRange = (_a = config.spanningCellManager) === null || _a === void 0 ? void 0 : _a.getContainingRange({ col: cellIndex,
16
+ row: rowIndex });
17
+ if (!containingRange) {
18
+ const cellHeight = (0, calculateCellHeight_1.calculateCellHeight)(cell, config.columns[cellIndex].width, config.columns[cellIndex].wrapWord);
19
+ rowHeight = Math.max(rowHeight, cellHeight);
20
+ return;
21
+ }
22
+ const { topLeft, bottomRight, height } = containingRange;
23
+ // bottom-most cell of a range needs to contain all remain lines of spanning cells
24
+ if (rowIndex === bottomRight.row) {
25
+ const totalOccupiedSpanningCellHeight = (0, utils_1.sumArray)(rowHeights.slice(topLeft.row));
26
+ const totalHorizontalBorderHeight = bottomRight.row - topLeft.row;
27
+ const totalHiddenHorizontalBorderHeight = (0, utils_1.sequence)(topLeft.row + 1, bottomRight.row).filter((horizontalBorderIndex) => {
28
+ var _a;
29
+ /* istanbul ignore next */
30
+ return !((_a = config.drawHorizontalLine) === null || _a === void 0 ? void 0 : _a.call(config, horizontalBorderIndex, rows.length));
31
+ }).length;
32
+ const cellHeight = height - totalOccupiedSpanningCellHeight - totalHorizontalBorderHeight + totalHiddenHorizontalBorderHeight;
33
+ rowHeight = Math.max(rowHeight, cellHeight);
34
+ }
35
+ // otherwise, just depend on other sibling cell heights in the row
14
36
  });
15
- return rowHeight;
16
- });
37
+ rowHeights.push(rowHeight);
38
+ }
39
+ return rowHeights;
17
40
  };
18
41
  exports.calculateRowHeights = calculateRowHeights;
19
42
  //# sourceMappingURL=calculateRowHeights.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calculateRowHeights.js","sourceRoot":"","sources":["../../src/calculateRowHeights.ts"],"names":[],"mappings":";;;AAAA,+DAE+B;AAK/B,mCAGiB;AAEjB;;GAEG;AACI,MAAM,mBAAmB,GAAG,CAAC,IAAW,EAAE,MAAkB,EAAY,EAAE;IAC/E,MAAM,UAAU,GAAa,EAAE,CAAC;IAEhC,KAAK,MAAM,CAAC,QAAQ,EAAE,GAAG,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE;QAC5C,IAAI,SAAS,GAAG,CAAC,CAAC;QAElB,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE;;YAC9B,MAAM,eAAe,GAAG,MAAA,MAAM,CAAC,mBAAmB,0CAAE,kBAAkB,CAAC,EAAC,GAAG,EAAE,SAAS;gBACpF,GAAG,EAAE,QAAQ,EAAC,CAAC,CAAC;YAElB,IAAI,CAAC,eAAe,EAAE;gBACpB,MAAM,UAAU,GAAG,IAAA,yCAAmB,EAAC,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC;gBAClH,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;gBAE5C,OAAO;aACR;YACD,MAAM,EAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAC,GAAG,eAAe,CAAC;YAEvD,kFAAkF;YAClF,IAAI,QAAQ,KAAK,WAAW,CAAC,GAAG,EAAE;gBAChC,MAAM,+BAA+B,GAAG,IAAA,gBAAQ,EAAC,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;gBAChF,MAAM,2BAA2B,GAAG,WAAW,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;gBAClE,MAAM,iCAAiC,GAAG,IAAA,gBAAQ,EAAC,OAAO,CAAC,GAAG,GAAG,CAAC,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,qBAAqB,EAAE,EAAE;;oBACpH,0BAA0B;oBAC1B,OAAO,CAAC,CAAA,MAAA,MAAM,CAAC,kBAAkB,+CAAzB,MAAM,EAAsB,qBAAqB,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA,CAAC;gBAC1E,CAAC,CAAC,CAAC,MAAM,CAAC;gBAEV,MAAM,UAAU,GAAG,MAAM,GAAG,+BAA+B,GAAG,2BAA2B,GAAG,iCAAiC,CAAC;gBAC9H,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;aAC7C;YAED,kEAAkE;QACpE,CAAC,CAAC,CAAC;QAEH,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;KAC5B;IAED,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AAtCW,QAAA,mBAAmB,uBAsC9B"}
@@ -0,0 +1,3 @@
1
+ import type { SpanningCellParameters } from './spanningCellManager';
2
+ import type { RangeConfig } from './types/internal';
3
+ export declare const calculateSpanningCellWidth: (rangeConfig: RangeConfig, dependencies: SpanningCellParameters) => number;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.calculateSpanningCellWidth = void 0;
4
+ const utils_1 = require("./utils");
5
+ const calculateSpanningCellWidth = (rangeConfig, dependencies) => {
6
+ const { columnsConfig, drawVerticalLine } = dependencies;
7
+ const { topLeft, bottomRight } = rangeConfig;
8
+ const totalWidth = (0, utils_1.sumArray)(columnsConfig.slice(topLeft.col, bottomRight.col + 1).map(({ width }) => {
9
+ return width;
10
+ }));
11
+ const totalPadding = topLeft.col === bottomRight.col ?
12
+ columnsConfig[topLeft.col].paddingRight +
13
+ columnsConfig[bottomRight.col].paddingLeft :
14
+ (0, utils_1.sumArray)(columnsConfig
15
+ .slice(topLeft.col, bottomRight.col + 1)
16
+ .map(({ paddingLeft, paddingRight }) => {
17
+ return paddingLeft + paddingRight;
18
+ }));
19
+ const totalBorderWidths = bottomRight.col - topLeft.col;
20
+ const totalHiddenVerticalBorders = (0, utils_1.sequence)(topLeft.col + 1, bottomRight.col).filter((verticalBorderIndex) => {
21
+ return !drawVerticalLine(verticalBorderIndex, columnsConfig.length);
22
+ }).length;
23
+ return totalWidth + totalPadding + totalBorderWidths - totalHiddenVerticalBorders;
24
+ };
25
+ exports.calculateSpanningCellWidth = calculateSpanningCellWidth;
26
+ //# sourceMappingURL=calculateSpanningCellWidth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calculateSpanningCellWidth.js","sourceRoot":"","sources":["../../src/calculateSpanningCellWidth.ts"],"names":[],"mappings":";;;AAMA,mCAEiB;AAEV,MAAM,0BAA0B,GAAG,CAAC,WAAwB,EAAE,YAAoC,EAAU,EAAE;IACnH,MAAM,EAAC,aAAa,EAAE,gBAAgB,EAAC,GAAG,YAAY,CAAC;IACvD,MAAM,EAAC,OAAO,EAAE,WAAW,EAAC,GAAG,WAAW,CAAC;IAE3C,MAAM,UAAU,GAAG,IAAA,gBAAQ,EACzB,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,WAAW,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAC,KAAK,EAAC,EAAE,EAAE;QACpE,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CACH,CAAC;IAEF,MAAM,YAAY,GAChB,OAAO,CAAC,GAAG,KAAK,WAAW,CAAC,GAAG,CAAC,CAAC;QAC/B,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,YAAY;YACvC,aAAa,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,WAAW,CAAC,CAAC;QAC5C,IAAA,gBAAQ,EACN,aAAa;aACV,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,WAAW,CAAC,GAAG,GAAG,CAAC,CAAC;aACvC,GAAG,CAAC,CAAC,EAAC,WAAW,EAAE,YAAY,EAAC,EAAE,EAAE;YACnC,OAAO,WAAW,GAAG,YAAY,CAAC;QACpC,CAAC,CAAC,CACL,CAAC;IACN,MAAM,iBAAiB,GAAG,WAAW,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAExD,MAAM,0BAA0B,GAAG,IAAA,gBAAQ,EAAC,OAAO,CAAC,GAAG,GAAG,CAAC,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,mBAAmB,EAAE,EAAE;QAC3G,OAAO,CAAC,gBAAgB,CAAC,mBAAmB,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC,MAAM,CAAC;IAEV,OAAO,UAAU,GAAG,YAAY,GAAG,iBAAiB,GAAG,0BAA0B,CAAC;AACpF,CAAC,CAAC;AA5BW,QAAA,0BAA0B,8BA4BrC"}
@@ -10,9 +10,10 @@ const mapDataUsingRowHeights_1 = require("./mapDataUsingRowHeights");
10
10
  const padTableData_1 = require("./padTableData");
11
11
  const stringifyTableData_1 = require("./stringifyTableData");
12
12
  const truncateTableData_1 = require("./truncateTableData");
13
+ const utils_1 = require("./utils");
13
14
  const prepareData = (data, config) => {
14
15
  let rows = (0, stringifyTableData_1.stringifyTableData)(data);
15
- rows = (0, truncateTableData_1.truncateTableData)(rows, config);
16
+ rows = (0, truncateTableData_1.truncateTableData)(rows, (0, utils_1.extractTruncates)(config));
16
17
  const rowHeights = (0, calculateRowHeights_1.calculateRowHeights)(rows, config);
17
18
  rows = (0, mapDataUsingRowHeights_1.mapDataUsingRowHeights)(rows, rowHeights, config);
18
19
  rows = (0, alignTableData_1.alignTableData)(rows, config);
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createStream.js","sourceRoot":"","sources":["../../src/createStream.ts"],"names":[],"mappings":";;;AAAA,qDAE0B;AAC1B,+DAE+B;AAC/B,6CAIsB;AACtB,uCAEmB;AACnB,yDAE4B;AAC5B,qEAEkC;AAClC,iDAEwB;AACxB,6DAE8B;AAC9B,2DAE6B;AAQ7B,mCAEiB;AAEjB,MAAM,WAAW,GAAG,CAAC,IAAW,EAAE,MAAoB,EAAE,EAAE;IACxD,IAAI,IAAI,GAAG,IAAA,uCAAkB,EAAC,IAAI,CAAC,CAAC;IAEpC,IAAI,GAAG,IAAA,qCAAiB,EAAC,IAAI,EAAE,IAAA,wBAAgB,EAAC,MAAM,CAAC,CAAC,CAAC;IAEzD,MAAM,UAAU,GAAG,IAAA,yCAAmB,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAErD,IAAI,GAAG,IAAA,+CAAsB,EAAC,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IACxD,IAAI,GAAG,IAAA,+BAAc,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACpC,IAAI,GAAG,IAAA,2BAAY,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAElC,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,CAAC,GAAQ,EAAE,YAAsB,EAAE,MAAoB,EAAE,EAAE;IACxE,MAAM,IAAI,GAAG,WAAW,CAAC,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;IAExC,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG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,KAAK,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC,CAAC;AAEK,MAAM,YAAY,GAAG,CAAC,UAA4B,EAAkB,EAAE;IAC3E,MAAM,MAAM,GAAG,IAAA,mCAAgB,EAAC,UAAU,CAAC,CAAC;IAE5C,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;QAChE,OAAO,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,WAAW,GAAG,MAAM,CAAC,YAAY,CAAC;IACjE,CAAC,CAAC,CAAC;IAEH,IAAI,KAAK,GAAG,IAAI,CAAC;IAEjB,OAAO;QACL,KAAK,EAAE,CAAC,GAAa,EAAE,EAAE;YACvB,IAAI,GAAG,CAAC,MAAM,KAAK,MAAM,CAAC,WAAW,EAAE;gBACrC,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;aAC1E;YAED,IAAI,KAAK,EAAE;gBACT,KAAK,GAAG,KAAK,CAAC;gBAEd,MAAM,CAAC,GAAG,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;aACnC;iBAAM;gBACL,MAAM,CAAC,GAAG,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;aACnC;QACH,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAxBW,QAAA,YAAY,gBAwBvB"}
@@ -1,26 +1,34 @@
1
- import type { DrawVerticalLine } from './types/api';
2
- import type { TableConfig, SeparatorGetter, TopBorderConfig, JoinBorderConfig, BottomBorderConfig } from './types/internal';
1
+ import type { SpanningCellManager } from './spanningCellManager';
2
+ import type { BorderConfig, DrawVerticalLine } from './types/api';
3
+ import type { SeparatorGetter } from './types/internal';
3
4
  declare type Separator = {
4
- readonly body: string;
5
- readonly join: string;
6
5
  readonly left: string;
7
6
  readonly right: string;
7
+ readonly body: string;
8
+ readonly bodyJoinOuter?: string;
9
+ readonly bodyJoinInner?: string;
10
+ readonly join: string;
11
+ readonly joinUp?: string;
12
+ readonly joinDown?: string;
13
+ readonly joinLeft?: string;
14
+ readonly joinRight?: string;
8
15
  };
9
- declare const drawBorder: (columnWidths: number[], config: {
10
- drawVerticalLine: DrawVerticalLine;
16
+ export declare const drawBorderSegments: (columnWidths: number[], parameters: Parameters<typeof drawBorder>[1]) => string[];
17
+ export declare const createSeparatorGetter: (dependencies: Parameters<typeof drawBorder>[1]) => (verticalBorderIndex: number, columnCount: number) => string;
18
+ export declare const drawBorder: (columnWidths: number[], parameters: Omit<DrawBorderParameters, 'border'> & {
11
19
  separator: Separator;
12
20
  }) => string;
13
- declare const drawBorderTop: (columnWidths: number[], config: {
14
- border: TopBorderConfig;
15
- drawVerticalLine: DrawVerticalLine;
16
- }) => string;
17
- declare const drawBorderJoin: (columnWidths: number[], config: {
18
- border: JoinBorderConfig;
19
- drawVerticalLine: DrawVerticalLine;
20
- }) => string;
21
- declare const drawBorderBottom: (columnWidths: number[], config: {
22
- border: BottomBorderConfig;
21
+ export declare const drawBorderTop: (columnWidths: number[], parameters: DrawBorderParameters) => string;
22
+ export declare const drawBorderJoin: (columnWidths: number[], parameters: DrawBorderParameters) => string;
23
+ export declare const drawBorderBottom: (columnWidths: number[], parameters: DrawBorderParameters) => string;
24
+ export declare type BorderGetterParameters = {
25
+ border: BorderConfig;
23
26
  drawVerticalLine: DrawVerticalLine;
24
- }) => string;
25
- export declare const createTableBorderGetter: (columnWidths: number[], config: TableConfig) => SeparatorGetter;
26
- export { drawBorder, drawBorderBottom, drawBorderJoin, drawBorderTop, };
27
+ spanningCellManager?: SpanningCellManager;
28
+ rowCount?: number;
29
+ };
30
+ export declare type DrawBorderParameters = Omit<BorderGetterParameters, 'outputColumnWidths'> & {
31
+ horizontalBorderIndex?: number;
32
+ };
33
+ export declare const createTableBorderGetter: (columnWidths: number[], parameters: BorderGetterParameters) => SeparatorGetter;
34
+ export {};