svg-table 0.0.1 → 0.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.
Files changed (43) hide show
  1. package/CHANGES.md +5 -0
  2. package/README.md +447 -1
  3. package/{tableData.ts → TableData.ts} +2 -3
  4. package/TableFormatter.ts +587 -0
  5. package/{tableStyler.ts → TableStyler.ts} +75 -6
  6. package/dist/{tableData.d.ts → TableData.d.ts} +2 -2
  7. package/dist/{tableData.d.ts.map → TableData.d.ts.map} +1 -1
  8. package/dist/{tableData.js → TableData.js} +10 -10
  9. package/dist/{tableData.js.map → TableData.js.map} +1 -1
  10. package/dist/TableFormatter.d.ts +459 -0
  11. package/dist/TableFormatter.d.ts.map +1 -0
  12. package/dist/TableFormatter.js +579 -0
  13. package/dist/TableFormatter.js.map +1 -0
  14. package/dist/{tableStyler.d.ts → TableStyler.d.ts} +58 -3
  15. package/dist/TableStyler.d.ts.map +1 -0
  16. package/dist/{tableStyler.js → TableStyler.js} +90 -31
  17. package/dist/TableStyler.js.map +1 -0
  18. package/dist/index.d.ts +5 -5
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +12 -12
  21. package/dist/index.js.map +1 -1
  22. package/dist/tableData.test.js +15 -15
  23. package/dist/tableFormatter.test.js +54 -15
  24. package/dist/tableFormatter.test.js.map +1 -1
  25. package/dist/tableStyler.test.js +236 -20
  26. package/dist/tableStyler.test.js.map +1 -1
  27. package/dist/tableSvg.d.ts +2 -2
  28. package/dist/tableSvg.js +7 -7
  29. package/index.ts +13 -12
  30. package/package.json +2 -2
  31. package/svg-table-0.0.1.tgz +0 -0
  32. package/tableData.test.ts +1 -1
  33. package/tableFormatter.test.ts +48 -4
  34. package/tableStyler.test.ts +133 -10
  35. package/tableSvg.ts +3 -3
  36. package/dist/tableFormatter.d.ts +0 -179
  37. package/dist/tableFormatter.d.ts.map +0 -1
  38. package/dist/tableFormatter.js +0 -298
  39. package/dist/tableFormatter.js.map +0 -1
  40. package/dist/tableStyler.d.ts.map +0 -1
  41. package/dist/tableStyler.js.map +0 -1
  42. package/svg-table-0.0.1-snapshot.tgz +0 -0
  43. package/tableFormatter.ts +0 -306
@@ -0,0 +1,579 @@
1
+ "use strict";
2
+ var __read = (this && this.__read) || function (o, n) {
3
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
4
+ if (!m) return o;
5
+ var i = m.call(o), r, ar = [], e;
6
+ try {
7
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
8
+ }
9
+ catch (error) { e = { error: error }; }
10
+ finally {
11
+ try {
12
+ if (r && !r.done && (m = i["return"])) m.call(i);
13
+ }
14
+ finally { if (e) throw e.error; }
15
+ }
16
+ return ar;
17
+ };
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.TableFormatter = exports.TableFormatterType = void 0;
20
+ exports.defaultFormatter = defaultFormatter;
21
+ exports.defaultFormatting = defaultFormatting;
22
+ exports.isFormattingTag = isFormattingTag;
23
+ var result_fn_1 = require("result-fn");
24
+ var TableData_1 = require("./TableData");
25
+ /**
26
+ * Default formatter that converts a {@link value} of type `V` to a string
27
+ * @param value The value to convert
28
+ * @return a string representation of the {@link value}
29
+ */
30
+ function defaultFormatter(value) {
31
+ return value === undefined || value === null ? '' : "".concat(value);
32
+ }
33
+ function defaultFormatting() {
34
+ return {
35
+ formatter: (defaultFormatter),
36
+ priority: 0
37
+ };
38
+ }
39
+ var TableFormatterType;
40
+ (function (TableFormatterType) {
41
+ TableFormatterType["CELL"] = "cell-formatter";
42
+ TableFormatterType["COLUMN"] = "column-formatter";
43
+ TableFormatterType["ROW"] = "row-formatter";
44
+ })(TableFormatterType || (exports.TableFormatterType = TableFormatterType = {}));
45
+ function isFormattingTag(tag) {
46
+ return (tag.name === TableFormatterType.COLUMN ||
47
+ tag.name === TableFormatterType.ROW ||
48
+ tag.name === TableFormatterType.CELL) &&
49
+ tag.value.hasOwnProperty("formatter") &&
50
+ tag.value.hasOwnProperty("priority");
51
+ }
52
+ /**
53
+ * Represents a formatter used to apply row, column, and cell formatting to a data table.
54
+ * This class is used to define custom formatters for specific rows, columns, or cells,
55
+ * with support for priority-based selection of formatters.
56
+ */
57
+ var TableFormatter = /** @class */ (function () {
58
+ /**
59
+ * @param dataFrame A data-frame that will be tagged with the row, column, and
60
+ * cell formatters.
61
+ * @private
62
+ */
63
+ function TableFormatter(dataFrame) {
64
+ this.dataFrame = dataFrame;
65
+ }
66
+ /**
67
+ * Constructs a new {@link TableFormatter} from a {@link TableData} object. Underneath,
68
+ * this factory method merely unwraps the {@link DataFrame} from the {@link TableData}
69
+ * and hands it to the constructor.
70
+ * @param tableData The table data object from which to construct the table formatter
71
+ * @return A new {@link TableFormatter} based on the {@link TableData}
72
+ * @see TableFormatter.fromDataFrame
73
+ */
74
+ TableFormatter.fromTableData = function (tableData) {
75
+ return new TableFormatter(tableData.unwrapDataFrame());
76
+ };
77
+ /**
78
+ * Constructs a new {@link TableFormatter} from a {@link DataFrame} object
79
+ * @param dataFrame The data-frame object from which to construct the table formatter
80
+ * @return A new {@link TableFormatter} based on the {@link DataFrame}
81
+ @see TableFormatter.fromTableData
82
+ */
83
+ TableFormatter.fromDataFrame = function (dataFrame) {
84
+ return new TableFormatter(dataFrame.copy());
85
+ };
86
+ /**
87
+ * Formatters convert the column value types to formatted strings. The formatter used to format a given
88
+ * cell depends on the priority of each formatter associated with that cell. The formatter with the
89
+ * highest priority is used. If two or more formatters for a given cell have the same priority, the selected
90
+ * formatter is indeterminant.
91
+ * @param columnIndex The index of the column to which to add the formatter
92
+ * @param formatter The formatter
93
+ * @param [priority = 0] The priority of this formatter. If cells have more than one associated formatter,
94
+ * the one with the highest priority number is used.
95
+ * @see addColumnFormatters
96
+ * @see addRowFormatter
97
+ * @see addRowFormatters
98
+ * @example
99
+ * ```typescript
100
+ * // create the data
101
+ * const data = DataFrame.from<string | number | Date>([
102
+ * [dateTimeFor(1, 1), 12345, 'gnm-f234', 123.45, 4],
103
+ * [dateTimeFor(2, 2), 23456, 'gnm-g234', 23.45, 5],
104
+ * [dateTimeFor(3, 3), 34567, 'gnm-h234', 3.65, 40],
105
+ * [dateTimeFor(4, 4), 45678, 'gnm-i234', 314.15, 9],
106
+ * ]).getOrThrow()
107
+ *
108
+ * // create the table-data object from the data, and then hand the table-data
109
+ * // to the table formatter, add column formats, and format the table, getting
110
+ * // back a new TableData<string>
111
+ * const tableData: TableData<string> = TableData.fromDataFrame<string | number | Date>(data)
112
+ * // from the table-data, create a table-formatter
113
+ * .flatMap(tableData => createTableFormatterFrom(tableData)
114
+ * // add a column formatter for the first column of dates
115
+ * .addColumnFormatter(0, value => (value as Date).toLocaleDateString())
116
+ * // add a column formatter to the second column of number
117
+ * .flatMap(tf => tf.addColumnFormatter(1, value => defaultFormatter(value)))
118
+ * // add a column formatter to the fourth column of currencies
119
+ * .flatMap(tf => tf.addColumnFormatter(3, value => `$ ${(value as number).toFixed(2)}`))
120
+ * .flatMap(tf => tf.addColumnFormatter(4, value => `${(value as number).toFixed(0)}`))
121
+ * // format the table into a new TableData<string> object
122
+ * .flatMap(tf => tf.formatTable())
123
+ * )
124
+ * .getOrThrow()
125
+ *
126
+ * // we expect the data-frame in the table data to be the following
127
+ * const expectedData = DataFrame.from<string>([
128
+ * ['2/1/2021', '12345', 'gnm-f234', '$ 123.45', '4'],
129
+ * ['2/2/2021', '23456', 'gnm-g234', '$ 23.45', '5'],
130
+ * ['2/3/2021', '34567', 'GNM-H234', '$ 3.65', '40'],
131
+ * ['2/4/2021', '45678', 'gnm-i234', '$ 314.15', '9'],
132
+ * ]).getOrThrow()
133
+ * ```
134
+ */
135
+ TableFormatter.prototype.addColumnFormatter = function (columnIndex, formatter, priority) {
136
+ if (priority === void 0) { priority = 0; }
137
+ return this.dataFrame
138
+ .tagColumn(columnIndex, TableFormatterType.COLUMN, { formatter: formatter, priority: priority })
139
+ .map(function (data) { return new TableFormatter(data); });
140
+ };
141
+ /**
142
+ * Adds formatters to specified column indexes in a table formatter.
143
+ *
144
+ * @param columnIndexes An array of column indexes to which the formatter will be applied.
145
+ * @param formatter The formatting function to apply to the specified columns.
146
+ * @param [priority = 0] The priority level for the formatter. Higher priority formatters are applied first.
147
+ * @return A result indicating the success or failure of adding the column formatters.
148
+ * @see addColumnFormatter
149
+ * @see addRowFormatter
150
+ * @see addRowFormatters
151
+ * @see addCellFormatter
152
+ * @see addCellFormatters
153
+ *
154
+ * @example
155
+ * ```typescript
156
+ * const data = DataFrame.from<string | number | Date>([
157
+ * [dateTimeFor(1, 1), 12345, 'gnm-f234', 123.45, 4],
158
+ * [dateTimeFor(2, 2), 23456, 'gnm-g234', 23.45, 5],
159
+ * [dateTimeFor(3, 3), 34567, 'gnm-h234', 3.65, 40],
160
+ * [dateTimeFor(4, 4), 45678, 'gnm-i234', 314.15, 9],
161
+ * ]).getOrThrow()
162
+ * const columnHeader = ['Date-Time', 'Customer ID', 'Product ID', 'Purchase Price', 'Amount']
163
+ * const rowHeader = [1, 2, 3, 4]
164
+ *
165
+ * const tableData = TableData.fromDataFrame<string | number | Date>(data)
166
+ * .withColumnHeader(columnHeader)
167
+ * .flatMap(td => td.withRowHeader(rowHeader))
168
+ * .flatMap(tableData => TableFormatter.fromTableData(tableData)
169
+ * // add the default formatter for the column header, at the highest priority so that
170
+ * // it is the one that applies to the row representing the column header
171
+ * .addRowFormatters([0], defaultFormatter, Infinity)
172
+ * // add the default formatter for the row header, at the highest priority so that
173
+ * // it is the one that applies to the column representing the row header
174
+ * .flatMap(tf => tf.addColumnFormatters([0], defaultFormatter, Infinity))
175
+ * // add the column formatters for each column at the default (lowest) priority
176
+ * // (notice that the columns are shifted by one for the columns because the row-header
177
+ * // occupies the first column (index=0))
178
+ * .flatMap(tf => tf.addColumnFormatter(1, value => (value as Date).toLocaleDateString()))
179
+ * .flatMap(tf => tf.addColumnFormatter(2, value => defaultFormatter(value)))
180
+ * .flatMap(tf => tf.addColumnFormatter(4, value => `$ ${(value as number).toFixed(2)}`))
181
+ * .flatMap(tf => tf.addColumnFormatter(5, value => `${(value as number).toFixed(0)}`))
182
+ * // format the table data and get back a TableData<string>
183
+ * .flatMap(tf => tf.formatTable())
184
+ * )
185
+ * .getOrThrow()
186
+ *
187
+ * const expectedData = DataFrame.from<string>([
188
+ * ['2/1/2021', '12345', 'gnm-f234', '$ 123.45', '4'],
189
+ * ['2/2/2021', '23456', 'gnm-g234', '$ 23.45', '5'],
190
+ * ['2/3/2021', '34567', 'gnm-h234', '$ 3.65', '40'],
191
+ * ['2/4/2021', '45678', 'gnm-i234', '$ 314.15', '9'],
192
+ * ]).getOrThrow()
193
+ * ```
194
+ */
195
+ TableFormatter.prototype.addColumnFormatters = function (columnIndexes, formatter, priority) {
196
+ if (priority === void 0) { priority = 0; }
197
+ return TableFormatter.addColumnFormatters(this, columnIndexes.slice(), formatter, priority);
198
+ };
199
+ TableFormatter.addColumnFormatters = function (tableFormatter, columnIndexes, formatter, priority) {
200
+ if (priority === void 0) { priority = 0; }
201
+ if (columnIndexes.length > 0) {
202
+ var columnIndex = columnIndexes.shift();
203
+ if (columnIndex != null) {
204
+ return tableFormatter
205
+ .addColumnFormatter(columnIndex, formatter, priority)
206
+ .flatMap(function (tf) { return TableFormatter.addColumnFormatters(tf, columnIndexes, formatter, priority); });
207
+ }
208
+ }
209
+ return (0, result_fn_1.successResult)(tableFormatter);
210
+ };
211
+ /**
212
+ * Formatters convert the row value types to formatted strings. The formatter used to format each cell in
213
+ * a given row depends on the priority of each formatter associated with that cell. The formatter with the
214
+ * highest priority is used. If two or more formatters for a given cell have the same priority, the selected
215
+ * formatter is indeterminant.
216
+ * @param rowIndex The index of the row to which to add the formatter
217
+ * @param formatter The formatter
218
+ * @param [priority = 0] The priority of this formatter. If cells have more than one associated formatter,
219
+ * the one with the highest priority number is used.
220
+ * @see addColumnFormatter
221
+ * @see addColumnFormatters
222
+ * @see addRowFormatters
223
+ * @example
224
+ * ```typescript
225
+ * // create the data
226
+ * const data = DataFrame.from<string | number | Date>([
227
+ * [dateTimeFor(1, 1), 12345, 'gnm-f234', 123.45, 4],
228
+ * [dateTimeFor(2, 2), 23456, 'gnm-g234', 23.45, 5],
229
+ * [dateTimeFor(3, 3), 34567, 'gnm-h234', 3.65, 40],
230
+ * [dateTimeFor(4, 4), 45678, 'gnm-i234', 314.15, 9],
231
+ * ]).getOrThrow()
232
+ *
233
+ * // create the table-data object from the data, and then hand the table-data
234
+ * // to the table formatter, add column formats, and format the table, getting
235
+ * // back a new TableData<string>
236
+ * const tableData: TableData<string> = TableData.fromDataFrame<string | number | Date>(data)
237
+ * // from the table-data, create a table-formatter
238
+ * .flatMap(tableData => createTableFormatterFrom(tableData)
239
+ * // add a column formatter for the first column of dates
240
+ * .addColumnFormatter(0, value => (value as Date).toLocaleDateString())
241
+ * // add a column formatter to the second column of number
242
+ * .flatMap(tf => tf.addColumnFormatter(1, value => defaultFormatter(value)))
243
+ * // add a column formatter to the fourth column of currencies
244
+ * .flatMap(tf => tf.addColumnFormatter(3, value => `$ ${(value as number).toFixed(2)}`))
245
+ * .flatMap(tf => tf.addColumnFormatter(4, value => `${(value as number).toFixed(0)}`))
246
+ * // format the table into a new TableData<string> object
247
+ * .flatMap(tf => tf.formatTable())
248
+ * )
249
+ * .getOrThrow()
250
+ *
251
+ * // we expect the data-frame in the table data to be the following
252
+ * const expectedData = DataFrame.from<string>([
253
+ * ['2/1/2021', '12345', 'gnm-f234', '$ 123.45', '4'],
254
+ * ['2/2/2021', '23456', 'gnm-g234', '$ 23.45', '5'],
255
+ * ['2/3/2021', '34567', 'GNM-H234', '$ 3.65', '40'],
256
+ * ['2/4/2021', '45678', 'gnm-i234', '$ 314.15', '9'],
257
+ * ]).getOrThrow()
258
+ * ```
259
+ */
260
+ TableFormatter.prototype.addRowFormatter = function (rowIndex, formatter, priority) {
261
+ if (priority === void 0) { priority = 0; }
262
+ return this.dataFrame
263
+ .tagRow(rowIndex, TableFormatterType.ROW, { formatter: formatter, priority: priority })
264
+ .map(function (data) { return new TableFormatter(data); });
265
+ };
266
+ /**
267
+ * Adds formatters to specified row indexes in a table formatter.
268
+ *
269
+ * @param rowIndexes An array of row indexes to which the formatter will be applied.
270
+ * @param formatter The formatting function to apply to the specified columns.
271
+ * @param [priority = 0] The priority level for the formatter. Higher priority formatters are applied first.
272
+ * @return A result indicating the success or failure of adding the row formatters.
273
+ * @see addColumnFormatter
274
+ * @see addRowFormatter
275
+ * @see addRowFormatters
276
+ * @see addCellFormatter
277
+ * @see addCellFormatters
278
+ * @example
279
+ * ```typescript
280
+ * const data = DataFrame.from<string | number | Date>([
281
+ * [dateTimeFor(1, 1), 12345, 'gnm-f234', 123.45, 4],
282
+ * [dateTimeFor(2, 2), 23456, 'gnm-g234', 23.45, 5],
283
+ * [dateTimeFor(3, 3), 34567, 'gnm-h234', 3.65, 40],
284
+ * [dateTimeFor(4, 4), 45678, 'gnm-i234', 314.15, 9],
285
+ * ]).getOrThrow()
286
+ * const columnHeader = ['Date-Time', 'Customer ID', 'Product ID', 'Purchase Price', 'Amount']
287
+ * const rowHeader = [1, 2, 3, 4]
288
+ *
289
+ * const tableData = TableData.fromDataFrame<string | number | Date>(data)
290
+ * .withColumnHeader(columnHeader)
291
+ * .flatMap(td => td.withRowHeader(rowHeader))
292
+ * .flatMap(tableData => TableFormatter.fromTableData(tableData)
293
+ * // add the default formatter for the column header, at the highest priority so that
294
+ * // it is the one that applies to the row representing the column header
295
+ * .addRowFormatters([0], defaultFormatter, Infinity)
296
+ * // add the default formatter for the row header, at the highest priority so that
297
+ * // it is the one that applies to the column representing the row header
298
+ * .flatMap(tf => tf.addColumnFormatters([0], defaultFormatter, Infinity))
299
+ * // add the column formatters for each column at the default (lowest) priority
300
+ * // (notice that the columns are shifted by one for the columns because the row-header
301
+ * // occupies the first column (index=0))
302
+ * .flatMap(tf => tf.addColumnFormatter(1, value => (value as Date).toLocaleDateString()))
303
+ * .flatMap(tf => tf.addColumnFormatter(2, value => defaultFormatter(value)))
304
+ * .flatMap(tf => tf.addColumnFormatter(4, value => `$ ${(value as number).toFixed(2)}`))
305
+ * .flatMap(tf => tf.addColumnFormatter(5, value => `${(value as number).toFixed(0)}`))
306
+ * // format the table data and get back a TableData<string>
307
+ * .flatMap(tf => tf.formatTable())
308
+ * )
309
+ * .getOrThrow()
310
+ *
311
+ * const expectedData = DataFrame.from<string>([
312
+ * ['2/1/2021', '12345', 'gnm-f234', '$ 123.45', '4'],
313
+ * ['2/2/2021', '23456', 'gnm-g234', '$ 23.45', '5'],
314
+ * ['2/3/2021', '34567', 'gnm-h234', '$ 3.65', '40'],
315
+ * ['2/4/2021', '45678', 'gnm-i234', '$ 314.15', '9'],
316
+ * ]).getOrThrow()
317
+ * ```
318
+ */
319
+ TableFormatter.prototype.addRowFormatters = function (rowIndexes, formatter, priority) {
320
+ if (priority === void 0) { priority = 0; }
321
+ return TableFormatter.addRowFormatters(this, rowIndexes.slice(), formatter, priority);
322
+ };
323
+ TableFormatter.addRowFormatters = function (tableFormatter, rowIndexes, formatter, priority) {
324
+ if (priority === void 0) { priority = 0; }
325
+ if (rowIndexes.length > 0) {
326
+ var rowIndex = rowIndexes.shift();
327
+ if (rowIndex != null) {
328
+ return tableFormatter
329
+ .addRowFormatter(rowIndex, formatter, priority)
330
+ .flatMap(function (tf) { return TableFormatter.addRowFormatters(tf, rowIndexes, formatter, priority); });
331
+ }
332
+ }
333
+ return (0, result_fn_1.successResult)(tableFormatter);
334
+ };
335
+ /**
336
+ * Adds a formatter to a specified cell based on the row and column indexes.
337
+ * @param rowIndex The row index of the cell.
338
+ * @param columnIndex The column index of the cell.
339
+ * @param formatter The formatter to apply to the cell.
340
+ * @param [priority = 0] The priority level for the formatter. Higher priority formatters are applied first.
341
+ * @return A result indicating the success or failure of adding the cell formatter.
342
+ * @see addColumnFormatter
343
+ * @see addRowFormatter
344
+ * @see addRowFormatters
345
+ * @see addCellFormatters
346
+ * @see addCellFormatters
347
+ * @example
348
+ * ```typescript
349
+ * const data = DataFrame.from<string | number | Date>([
350
+ * [dateTimeFor(1, 1), 12345, 'gnm-f234', 123.45, 4],
351
+ * [dateTimeFor(2, 2), 23456, 'gnm-g234', 23.45, 5],
352
+ * [dateTimeFor(3, 3), 34567, 'gnm-h234', 3.65, 40],
353
+ * [dateTimeFor(4, 4), 45678, 'gnm-i234', 314.15, 9],
354
+ * ]).getOrThrow()
355
+ * const columnHeader = ['Date-Time', 'Customer ID', 'Product ID', 'Purchase Price', 'Amount']
356
+ * const rowHeader = [1, 2, 3, 4]
357
+ *
358
+ * const tableData = TableData.fromDataFrame<string | number | Date>(data)
359
+ * .withColumnHeader(columnHeader)
360
+ * .flatMap(td => td.withRowHeader(rowHeader))
361
+ * .flatMap(tableData => TableFormatter.fromTableData(tableData)
362
+ * // add the default formatter for the column header, at the highest priority so that
363
+ * // it is the one that applies to the row representing the column header
364
+ * .addRowFormatters([0], defaultFormatter, Infinity)
365
+ * // add the default formatter for the row header, at the highest priority so that
366
+ * // it is the one that applies to the column representing the row header
367
+ * .flatMap(tf => tf.addColumnFormatters([0], defaultFormatter, Infinity))
368
+ * // add the column formatters for each column at the default (lowest) priority
369
+ * // (notice that the columns are shifted by one for the columns because the row-header
370
+ * // occupies the first column (index=0))
371
+ * .flatMap(tf => tf.addColumnFormatter(1, value => (value as Date).toLocaleDateString()))
372
+ * .flatMap(tf => tf.addColumnFormatter(2, value => defaultFormatter(value)))
373
+ * .flatMap(tf => tf.addColumnFormatter(4, value => `$ ${(value as number).toFixed(2)}`))
374
+ * .flatMap(tf => tf.addColumnFormatter(5, value => `${(value as number).toFixed(0)}`))
375
+ * // override the cell formatter for a select set of cells
376
+ * .flatMap(tf => tf.addCellFormatter(1, 4, value => `${(value as number).toFixed(2)}`, 1000))
377
+ * .flatMap(tf => tf.addCellFormatters([[3, 5], [4, 5]], value => `${((value as number) * 10).toFixed(0)}`, 1000))
378
+ * // format the table data and get back a TableData<string>
379
+ * .flatMap(tf => tf.formatTable())
380
+ * )
381
+ * .getOrThrow()
382
+ *
383
+ * const expectedData = DataFrame.from<string>([
384
+ * ['2/1/2021', '12345', 'gnm-f234', '123.45', '4'], // overwrite (1, 4) to remove "$"
385
+ * ['2/2/2021', '23456', 'gnm-g234', '$ 23.45', '5'],
386
+ * ['2/3/2021', '34567', 'gnm-h234', '$ 3.65', '400'], // overwrite (3, 5) to multiply by 10
387
+ * ['2/4/2021', '45678', 'gnm-i234', '$ 314.15', '90'], // overwrite (4, 5) to multiply by 10
388
+ * ]).getOrThrow()
389
+ * ```
390
+ */
391
+ TableFormatter.prototype.addCellFormatter = function (rowIndex, columnIndex, formatter, priority) {
392
+ if (priority === void 0) { priority = 0; }
393
+ return this.dataFrame
394
+ .tagCell(rowIndex, columnIndex, TableFormatterType.CELL, { formatter: formatter, priority: priority })
395
+ .map(function (data) { return new TableFormatter(data); });
396
+ };
397
+ /**
398
+ * Adds formatters to specified cell indexes in a table formatter.
399
+ * @param cellIndexes An array of cell indexes to which the formatter will be applied.
400
+ * @param formatter The formatting function to apply to the specified cells.
401
+ * @param [priority = 0] The priority level for the formatter. Higher priority formatters are applied first.
402
+ * @return A result indicating the success or failure of adding the cell formatters.
403
+ * @see addColumnFormatter
404
+ * @see addRowFormatter
405
+ * @see addRowFormatters
406
+ * @see addCellFormatters
407
+ * @see addCellFormatters
408
+ * @example
409
+ * ```typescript
410
+ * const data = DataFrame.from<string | number | Date>([
411
+ * [dateTimeFor(1, 1), 12345, 'gnm-f234', 123.45, 4],
412
+ * [dateTimeFor(2, 2), 23456, 'gnm-g234', 23.45, 5],
413
+ * [dateTimeFor(3, 3), 34567, 'gnm-h234', 3.65, 40],
414
+ * [dateTimeFor(4, 4), 45678, 'gnm-i234', 314.15, 9],
415
+ * ]).getOrThrow()
416
+ * const columnHeader = ['Date-Time', 'Customer ID', 'Product ID', 'Purchase Price', 'Amount']
417
+ * const rowHeader = [1, 2, 3, 4]
418
+ *
419
+ * const tableData = TableData.fromDataFrame<string | number | Date>(data)
420
+ * .withColumnHeader(columnHeader)
421
+ * .flatMap(td => td.withRowHeader(rowHeader))
422
+ * .flatMap(tableData => TableFormatter.fromTableData(tableData)
423
+ * // add the default formatter for the column header, at the highest priority so that
424
+ * // it is the one that applies to the row representing the column header
425
+ * .addRowFormatters([0], defaultFormatter, Infinity)
426
+ * // add the default formatter for the row header, at the highest priority so that
427
+ * // it is the one that applies to the column representing the row header
428
+ * .flatMap(tf => tf.addColumnFormatters([0], defaultFormatter, Infinity))
429
+ * // add the column formatters for each column at the default (lowest) priority
430
+ * // (notice that the columns are shifted by one for the columns because the row-header
431
+ * // occupies the first column (index=0))
432
+ * .flatMap(tf => tf.addColumnFormatter(1, value => (value as Date).toLocaleDateString()))
433
+ * .flatMap(tf => tf.addColumnFormatter(2, value => defaultFormatter(value)))
434
+ * .flatMap(tf => tf.addColumnFormatter(4, value => `$ ${(value as number).toFixed(2)}`))
435
+ * .flatMap(tf => tf.addColumnFormatter(5, value => `${(value as number).toFixed(0)}`))
436
+ * // override the cell formatter for a select set of cells
437
+ * .flatMap(tf => tf.addCellFormatter(1, 4, value => `${(value as number).toFixed(2)}`, 1000))
438
+ * .flatMap(tf => tf.addCellFormatters([[3, 5], [4, 5]], value => `${((value as number) * 10).toFixed(0)}`, 1000))
439
+ * // format the table data and get back a TableData<string>
440
+ * .flatMap(tf => tf.formatTable())
441
+ * )
442
+ * .getOrThrow()
443
+ *
444
+ * const expectedData = DataFrame.from<string>([
445
+ * ['2/1/2021', '12345', 'gnm-f234', '123.45', '4'], // overwrite (1, 4) to remove "$"
446
+ * ['2/2/2021', '23456', 'gnm-g234', '$ 23.45', '5'],
447
+ * ['2/3/2021', '34567', 'gnm-h234', '$ 3.65', '400'], // overwrite (3, 5) to multiply by 10
448
+ * ['2/4/2021', '45678', 'gnm-i234', '$ 314.15', '90'], // overwrite (4, 5) to multiply by 10
449
+ * ]).getOrThrow()
450
+ * ```
451
+ */
452
+ TableFormatter.prototype.addCellFormatters = function (cellIndexes, formatter, priority) {
453
+ if (priority === void 0) { priority = 0; }
454
+ return TableFormatter.addCellFormatters(this, cellIndexes.slice(), formatter, priority);
455
+ };
456
+ TableFormatter.addCellFormatters = function (tableFormatter, cellIndexes, formatter, priority) {
457
+ var _a;
458
+ if (priority === void 0) { priority = 0; }
459
+ if (cellIndexes.length > 0) {
460
+ var _b = __read((_a = cellIndexes.shift()) !== null && _a !== void 0 ? _a : [undefined, undefined], 2), rowIndex = _b[0], columnIndex = _b[1];
461
+ if (rowIndex != null && columnIndex != null) {
462
+ return tableFormatter
463
+ .addCellFormatter(rowIndex, columnIndex, formatter, priority)
464
+ .flatMap(function (tf) { return TableFormatter.addCellFormatters(tf, cellIndexes, formatter, priority); });
465
+ }
466
+ }
467
+ return (0, result_fn_1.successResult)(tableFormatter);
468
+ };
469
+ /**
470
+ * Formats the table headers, footer, and values using the formatters that have been added
471
+ * to this `TableData<V>` object and returns a new `TableData<string>` object where all the
472
+ * elements have been converted to a formatted string.
473
+ * @return a new `TableData<string>` object where all the elements have been converted to a
474
+ * formatted string.
475
+ * @example
476
+ * ```typescript
477
+ * function dateTimeFor(day: number, hour: number): Date {
478
+ * return new Date(2021, 1, day, hour, 0, 0, 0);
479
+ * }
480
+ *
481
+ * // the headers for the table
482
+ * const columnHeader = ['Date-Time', 'Customer ID', 'Product ID', 'Purchase Price', 'Amount']
483
+ * const rowHeader = [1, 2, 3, 4]
484
+ *
485
+ * // this is the actual data used to creat the data table (in row-form)
486
+ * const data = DataFrame.from<string | number | Date>([
487
+ * [dateTimeFor(1, 1), 12345, 'gnm-f234', 123.45, 4],
488
+ * [dateTimeFor(2, 2), 23456, 'gnm-g234', 23.45, 5],
489
+ * [dateTimeFor(3, 3), 34567, 'gnm-h234', 3.65, 40],
490
+ * [dateTimeFor(4, 4), 45678, 'gnm-i234', 314.15, 9],
491
+ * ]).getOrThrow()
492
+ *
493
+ * // this is what we expect that formatted data to look like
494
+ * const expectedData = DataFrame.from<string>([
495
+ * ['2/1/2021', '12345', 'gnm-f234', '$ 123.45', '4'],
496
+ * ['2/2/2021', '23456', 'gnm-g234', '$ 23.45', '5'],
497
+ * ['2/3/2021', '34567', 'gnm-h234', '$ 3.65', '40'],
498
+ * ['2/4/2021', '45678', 'gnm-i234', '$ 314.15', '9'],
499
+ * ]).getOrThrow()
500
+ *
501
+ * // 1. create a data-table that has a column-header and a row-header and mixed-type
502
+ * // data (number, string, Date)
503
+ * // 2. add formatters for the row and column headers (at highest priority)
504
+ * // 3. add formatters for some of the other data columns
505
+ * // 4. format the table
506
+ * const tableData = TableData.fromDataFrame<string | number | Date>(data)
507
+ * .withColumnHeader(columnHeader)
508
+ * .flatMap(table => table.withRowHeader(rowHeader))
509
+ * // add the default formatter for the column header, at the highest priority so that
510
+ * // it is the one that applies to the row representing the column header
511
+ * .flatMap(td => td.addRowFormatter(0, defaultFormatter, Infinity))
512
+ * // add the default formatter for the row header, at the highest priority so that
513
+ * // it is the one that applies to the column representing the row header
514
+ * .flatMap(td => td.addColumnFormatter(0, defaultFormatter, Infinity))
515
+ * // add the column formatters for each column at the default (lowest) priority
516
+ * // (notice that the columns are shifted by one for the columns because the row-header
517
+ * // occupies the first column (index=0))
518
+ * .flatMap(td => td.addColumnFormatter(1, value => (value as Date).toLocaleDateString()))
519
+ * .flatMap(td => td.addColumnFormatter(2, value => defaultFormatter(value)))
520
+ * .flatMap(td => td.addColumnFormatter(4, value => `$ ${(value as number).toFixed(2)}`))
521
+ * .flatMap(td => td.addColumnFormatter(5, value => `${(value as number).toFixed(0)}`))
522
+ * // format the table data and get back a TableData<string>
523
+ * .map(td => td.formatTable())
524
+ * .getOrThrow()
525
+ *
526
+ * // the column header of the formatted table should be the same as the one specified
527
+ * expect(tableData.columnHeader().getOrThrow()).toEqual(columnHeader)
528
+ *
529
+ * // the row header of the formatted table should be the same as the one specified
530
+ * expect(tableData.rowHeader().getOrThrow()).toEqual(rowHeader.map(hdr => defaultFormatter(hdr)))
531
+ *
532
+ * // the data should be equal to the expected data
533
+ * expect(tableData.data().map(df => df.equals(expectedData)).getOrThrow()).toBeTruthy()
534
+ * ```
535
+ */
536
+ TableFormatter.prototype.formatTable = function () {
537
+ return this.formatTableInto(function (dataFrame) { return TableData_1.TableData.fromDataFrame(dataFrame); });
538
+ };
539
+ /**
540
+ * Generally, the {@link TableFormatter} formats the {@link DataFrame} into a `TableData<string>`
541
+ * where all the elements of the {@link TableData} are a string. Because a formatted table does
542
+ * not necessarily have to be a `TableData<string>` (which would contain a `DataFrame<string>`,
543
+ * this method allows mapping a {@link DataFrame} into any desired type.
544
+ * @param mapper A function that takes a `DataFrame<string>` and returns a desired type (`D`).
545
+ * @return A `Result<D, string>` where the `Result<D, string>` is either success, containing the
546
+ * desired type (`D`), or failure, containing an error message.
547
+ * @see formatTable
548
+ */
549
+ TableFormatter.prototype.formatTableInto = function (mapper) {
550
+ var _this = this;
551
+ var formattingFailures = [];
552
+ var formattedDataFrame = this
553
+ .dataFrame
554
+ .mapElements(function (elem, row, col) {
555
+ var tags = _this.dataFrame
556
+ .tagsFor(row, col)
557
+ .filter(function (tag) { return isFormattingTag(tag); });
558
+ var sorted = tags
559
+ .sort(function (t1, t2) { return t2.value.priority - t1.value.priority; });
560
+ if (sorted.length > 0) {
561
+ var formatter = sorted[0].value.formatter;
562
+ try {
563
+ return formatter(elem);
564
+ }
565
+ catch (e) {
566
+ formattingFailures.push("(TableData::formatTable) Failed to format cell (".concat(row, ", ").concat(col, "); value: ").concat(elem, "; error: ").concat(e));
567
+ }
568
+ }
569
+ return defaultFormatter(elem);
570
+ });
571
+ if (formattingFailures.length === 0) {
572
+ return (0, result_fn_1.successResult)(mapper(formattedDataFrame));
573
+ }
574
+ return (0, result_fn_1.failureResult)(formattingFailures.concat('').join('\n'));
575
+ };
576
+ return TableFormatter;
577
+ }());
578
+ exports.TableFormatter = TableFormatter;
579
+ //# sourceMappingURL=TableFormatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableFormatter.js","sourceRoot":"","sources":["../TableFormatter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;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