|
1 | 1 |
|
2 |
| -{{alias}}( [data,] [headers,] [options] ) |
| 2 | +{{alias}}( [data,] [options] ) |
3 | 3 | Returns a Unicode table instance.
|
4 | 4 |
|
5 | 5 | Parameters
|
6 | 6 | ----------
|
7 |
| - data: Object|Array<Object>|Array<Array>|MatrixLike (optional) |
| 7 | + data: Object|Array<Object>|Array<Array>|ndarray (optional) |
8 | 8 | Table data.
|
9 | 9 |
|
10 |
| - headers: Collection (optional) |
11 |
| - Table headers. |
12 |
| - |
13 | 10 | options: Object (optional)
|
14 | 11 | Table options.
|
15 | 12 |
|
16 |
| - options.alignment: Array<string>|string (optional) |
17 |
| - Datum's cell alignment(s). Default: 'right'. |
| 13 | + options.align: Array<string>|string (optional) |
| 14 | + Cell alignment(s). Must be one of the following: |
| 15 | + |
| 16 | + - left: left-aligned. |
| 17 | + - center: center-aligned. |
| 18 | + - right: right-aligned. |
| 19 | + |
| 20 | + Default: 'right'. |
18 | 21 |
|
19 | 22 | options.autoRender: boolean (optional)
|
20 |
| - Boolean indicating whether to re-render on a 'change' event. Default: |
21 |
| - false. |
| 23 | + Boolean indicating whether to automatically re-render on a 'change' |
| 24 | + event. Default: false. |
22 | 25 |
|
23 |
| - options.borders: Array<string> (optional) |
24 |
| - Border characters. Default: [ '─', '│', '─', '│' ]. |
| 26 | + options.borderTop: string (optional) |
| 27 | + Top table border character(s). Default: '-'. |
25 | 28 |
|
26 |
| - options.bufferSize: integer|null (optional) |
27 |
| - Data buffer size. If provided, data is kept in a first-in first-out |
28 |
| - (FIFO) buffer which cannot exceed the buffer size. Default: +infinity. |
| 29 | + options.borderRight: string (optional) |
| 30 | + Right table border character(s). Default: '|'. |
29 | 31 |
|
30 |
| - options.cellPaddingLeft: Array<NonNegativeInteger>|NonNegativeInteger |
31 |
| - (optional) |
32 |
| - Cell's left padding(s). Default: 1. |
| 32 | + options.borderBottom: string (optional) |
| 33 | + Bottom table border character(s). Default: '-'. |
33 | 34 |
|
34 |
| - options.cellPaddingRight: Array<NonNegativeInteger>|NonNegativeInteger |
35 |
| - (optional) |
36 |
| - Cell's right padding(s). Default: 1. |
| 35 | + options.borderLeft: string (optional) |
| 36 | + Left table border character(s). Default: '|'. |
| 37 | + |
| 38 | + options.borders: Array<string> (optional) |
| 39 | + Table border characters in the order [top, right, bottom, left]. |
| 40 | + Default: [ '─', '│', '─', '│' ]. |
| 41 | + |
| 42 | + options.bufferSize: integer|null (optional) |
| 43 | + Data buffer size. If specified, data is kept in a first-in first-out |
| 44 | + (FIFO) buffer which cannot exceed the specified buffer size. Default: |
| 45 | + +infinity. |
37 | 46 |
|
38 | 47 | options.columnSeparator: string (optional)
|
39 | 48 | Column separator character(s). Default: '│'.
|
40 | 49 |
|
| 50 | + options.cornerTopLeft: string (optional) |
| 51 | + Top-left table corner grapheme cluster (i.e., visual character). |
| 52 | + Default: '┌'. |
| 53 | + |
| 54 | + options.cornerTopRight: string (optional) |
| 55 | + Top-right table corner grapheme cluster (i.e., visual character). |
| 56 | + Default: '┐'. |
| 57 | + |
| 58 | + options.cornerBottomRight: string (optional) |
| 59 | + Bottom-right table corner grapheme cluster (i.e., visual character). |
| 60 | + Default: '┘'. |
| 61 | + |
| 62 | + options.cornerBottomLeft: string (optional) |
| 63 | + Bottom-left table corner grapheme cluster (i.e., visual character). |
| 64 | + Default: '└'. |
| 65 | + |
41 | 66 | options.corners: Array<string> (optional)
|
42 |
| - Corner characters. Default: [ '┌', '┐', '┘', '└' ]. |
| 67 | + Table corner grapheme clusters (i.e., visual characters) in the order |
| 68 | + [top-left, top-right, bottom-right, bottom-left]. Default: [ '┌', '┐', |
| 69 | + '┘', '└' ]. |
| 70 | + |
| 71 | + options.headers: Array<string> (optional) |
| 72 | + Table headers. |
43 | 73 |
|
44 | 74 | options.headerSeparator: string (optional)
|
45 | 75 | Header separator character(s). Default: '─'.
|
46 | 76 |
|
47 | 77 | options.horizontalSeparatorMode: string (optional)
|
48 |
| - Horizontal line separator mode. The following modes are supported: |
| 78 | + Horizontal line separator mode. Must be one of the following: |
49 | 79 |
|
50 | 80 | - resume: resume line sequence after a joint.
|
51 | 81 | - interpolate: skip line character at a joint.
|
52 | 82 | - repeat: repeat line sequence after a joint.
|
53 | 83 |
|
54 |
| - Default: `resume`. |
| 84 | + Default: 'resume'. |
| 85 | + |
| 86 | + options.jointMiddle: string (optional) |
| 87 | + Joint grapheme cluster (i.e., visual character) connecting cells within |
| 88 | + the middle of the table. Default: '┼'. |
| 89 | + |
| 90 | + options.jointTop: string (optional) |
| 91 | + Joint grapheme cluster (i.e., visual character) connecting cells along |
| 92 | + the top of the table. Default: '┬'. |
| 93 | + |
| 94 | + options.jointRight: string (optional) |
| 95 | + Joint grapheme cluster (i.e., visual character) connecting cells along |
| 96 | + the right side of the table. Default: '┤'. |
| 97 | + |
| 98 | + options.jointBottom: string (optional) |
| 99 | + Joint grapheme cluster (i.e., visual character) connecting cells along |
| 100 | + the bottom of the table. Default: '┴'. |
| 101 | + |
| 102 | + options.jointLeft: string (optional) |
| 103 | + Joint grapheme cluster (i.e., visual character) connecting cells along |
| 104 | + the left side of the table. Default: '├'. |
55 | 105 |
|
56 | 106 | options.joints: Array<string> (optional)
|
57 |
| - Joint characters. Default: [ '┼', '┬', '┤', '┴', '├' ]. |
| 107 | + Joint grapheme cluster (i.e., visual characters) in the order [middle, |
| 108 | + top, right, bottom, left]. Default: [ '┼', '┬', '┤', '┴', '├' ]. |
| 109 | + |
| 110 | + options.marginTop: integer (optional) |
| 111 | + Margin at the top of the table in units of blank lines. Default: 0. |
| 112 | + |
| 113 | + options.marginRight: integer (optional) |
| 114 | + Margin to the right of the table in units of whitespace. Default: 0. |
| 115 | + |
| 116 | + options.marginBottom: integer (optional) |
| 117 | + Margin at the bottom of the table in units of blank lines. Default: 0. |
58 | 118 |
|
59 |
| - options.marginX: NonNegativeInteger (optional) |
60 |
| - Horizontal output margin. Default: 0. |
| 119 | + options.marginLeft: integer (optional) |
| 120 | + Margin to the left of the table in units of whitespace. Default: 0. |
61 | 121 |
|
62 |
| - options.marginY: NonNegativeInteger (optional) |
63 |
| - Vertical output margin. Default: 0. |
| 122 | + options.margins: Array<integer> (optional) |
| 123 | + Table margins in the order [top, right, bottom, left]. Default: |
| 124 | + [ 0, 0, 0, 0 ]. |
64 | 125 |
|
65 |
| - options.maxCellWidth: Array<NonNegativeInteger>|NonNegativeInteger|null |
66 |
| - (optional) |
67 |
| - Maximum cell width(s). Default: +infinity. |
| 126 | + options.maxCellWidth: Array<integer>|integer|null (optional) |
| 127 | + Maximum cell width(s) in units of grapheme clusters (i.e., visual |
| 128 | + characters). Default: +infinity. |
68 | 129 |
|
69 |
| - options.maxOutputWidth: NonNegativeInteger|null (optional) |
70 |
| - Maximum output width. Default: +infinity. |
| 130 | + options.maxWidth: integer|null (optional) |
| 131 | + Maximum table width in units of grapheme clusters (i.e., visual |
| 132 | + characters). Default: +infinity. |
| 133 | + |
| 134 | + options.paddingLeft: Array<integer>|integer (optional) |
| 135 | + Cell left padding(s) in units of whitespace characters. Default: 1. |
| 136 | + |
| 137 | + options.paddingRight: Array<integer>|integer (optional) |
| 138 | + Cell right padding(s) in units of whitespace characters. Default: 1. |
71 | 139 |
|
72 | 140 | options.rowSeparator: string (optional)
|
73 | 141 | Row separator character(s). Default: ''.
|
74 | 142 |
|
75 | 143 | options.verticalSeparatorMode: string (optional)
|
76 |
| - Vertical line separator mode. The following modes are supported: |
| 144 | + Vertical line separator mode. Must be one of the following: |
77 | 145 |
|
78 | 146 | - resume: resume line sequence after a joint.
|
79 | 147 | - interpolate: skip line character at a joint.
|
80 | 148 | - repeat: repeat line sequence after a joint.
|
81 | 149 |
|
82 |
| - Default: `resume`. |
| 150 | + Default: 'resume'. |
83 | 151 |
|
84 | 152 | Returns
|
85 | 153 | -------
|
86 |
| - table.alignment |
87 |
| - Datum's cell alignment(s). |
| 154 | + table: Table |
| 155 | + Table instance. |
| 156 | + |
| 157 | + table.align |
| 158 | + Cell alignment(s). |
88 | 159 |
|
89 | 160 | table.autoRender
|
90 |
| - Rendering mode. If `true`, an instance renders on each 'change' event; |
91 |
| - otherwise, rendering must be triggered manually. |
| 161 | + Rendering mode. If `true`, an instance automatically re-renders on each |
| 162 | + 'change' event; otherwise, rendering must be triggered manually. |
| 163 | + |
| 164 | + table.borderTop |
| 165 | + Top table border character(s). |
| 166 | + |
| 167 | + table.borderRight |
| 168 | + Right table border character(s). |
| 169 | + |
| 170 | + table.borderBottom |
| 171 | + Bottom table border character(s). |
| 172 | + |
| 173 | + table.borderLeft |
| 174 | + Left table border character(s). |
92 | 175 |
|
93 | 176 | table.borders
|
94 |
| - Border characters. |
| 177 | + Table border characters in the order [top, right, bottom, left]. |
95 | 178 |
|
96 | 179 | table.bufferSize
|
97 | 180 | Data buffer size.
|
98 | 181 |
|
99 |
| - table.cellPaddingLeft |
100 |
| - Cell's left Padding. |
101 |
| - |
102 |
| - table.cellPaddingRight |
103 |
| - Cell's right Padding. |
104 |
| - |
105 | 182 | table.columnSeparator
|
106 | 183 | Column separator character(s).
|
107 | 184 |
|
| 185 | + table.cornerTopLeft |
| 186 | + Top-left table corner grapheme cluster (i.e., visual character). |
| 187 | + |
| 188 | + table.cornerTopRight |
| 189 | + Top-right table corner grapheme cluster (i.e., visual character). |
| 190 | + |
| 191 | + table.cornerBottomRight |
| 192 | + Bottom-right table corner grapheme cluster (i.e., visual character). |
| 193 | + |
| 194 | + table.cornerBottomLeft |
| 195 | + Bottom-left table corner grapheme cluster (i.e., visual character). |
| 196 | + |
108 | 197 | table.corners
|
109 |
| - Corner characters. |
| 198 | + Corner grapheme clusters (i.e., visual characters) in the order |
| 199 | + [top-left, top-right, bottom-right, bottom-left]. |
110 | 200 |
|
111 | 201 | table.data
|
112 | 202 | Table data.
|
|
120 | 210 | table.horizontalSeparatorMode
|
121 | 211 | Horizontal line separator mode.
|
122 | 212 |
|
| 213 | + table.jointMiddle |
| 214 | + Joint grapheme cluster (i.e., visual character) connecting cells within |
| 215 | + the middle of the table. |
| 216 | + |
| 217 | + table.jointTop |
| 218 | + Joint grapheme cluster (i.e., visual character) connecting cells along |
| 219 | + the top of the table. |
| 220 | + |
| 221 | + table.jointRight |
| 222 | + Joint grapheme cluster (i.e., visual character) connecting cells along |
| 223 | + the right side of the table. |
| 224 | + |
| 225 | + table.jointBottom |
| 226 | + Joint grapheme cluster (i.e., visual character) connecting cells along |
| 227 | + the bottom of the table. |
| 228 | + |
| 229 | + table.jointLeft |
| 230 | + Joint grapheme cluster (i.e., visual character) connecting cells along |
| 231 | + the left side of the table. |
| 232 | + |
123 | 233 | table.joints
|
124 |
| - Joint characters. |
| 234 | + Joint grapheme clusters (i.e., visual characters) in the order [middle, |
| 235 | + top, right, bottom, left]. |
125 | 236 |
|
126 |
| - table.marginX |
127 |
| - Horizontal output margin. |
| 237 | + table.marginTop |
| 238 | + Top table margin. |
128 | 239 |
|
129 |
| - table.marginY |
130 |
| - Vertical output margin. |
| 240 | + table.marginRight |
| 241 | + Right table margin. |
| 242 | + |
| 243 | + table.marginBottom |
| 244 | + Bottom table margin. |
| 245 | + |
| 246 | + table.marginLeft |
| 247 | + Left table margin. |
| 248 | + |
| 249 | + table.margins |
| 250 | + Table margins in the order [top, right, bottom, left]. |
131 | 251 |
|
132 | 252 | table.maxCellWidth
|
133 | 253 | Maximum cell width.
|
134 | 254 |
|
135 |
| - table.maxOutputWidth |
136 |
| - Maximum output width. |
| 255 | + table.maxWidth |
| 256 | + Maximum table width. |
| 257 | + |
| 258 | + table.paddingLeft |
| 259 | + Cell left padding. |
| 260 | + |
| 261 | + table.paddingRight |
| 262 | + Cell right padding. |
137 | 263 |
|
138 | 264 | table.push( row )
|
139 | 265 | Appends a row to table data.
|
|
151 | 277 | --------
|
152 | 278 | > var data = [ [ 45, 33, 'hello' ], [ 32.54, true, null ] ];
|
153 | 279 | > var headers = [ 'col1', 'col2', 'col3' ];
|
154 |
| - > var table = new {{alias}}( data, headers ); |
| 280 | + > var table = new {{alias}}( data, { 'headers': headers } ); |
155 | 281 | > table.render()
|
156 | 282 | '...'
|
157 | 283 |
|
|
0 commit comments