@shbernal/ts-xlsx 1.0.3 → 1.2.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 +21 -0
- package/dist/core/address.js +0 -33
- package/dist/core/autofilter.js +0 -9
- package/dist/core/cell.d.ts +10 -0
- package/dist/core/cell.js +4 -123
- package/dist/core/color-resolution.js +0 -60
- package/dist/core/column.d.ts +9 -1
- package/dist/core/column.js +0 -52
- package/dist/core/comment-thread.js +0 -45
- package/dist/core/conditional-formatting-overlay.js +0 -11
- package/dist/core/conditional-formatting.js +0 -10
- package/dist/core/containers.js +0 -15
- package/dist/core/data-validation-overlay.js +0 -25
- package/dist/core/data-validation.js +0 -7
- package/dist/core/date.js +0 -39
- package/dist/core/formula.js +0 -117
- package/dist/core/grid-edits.js +0 -38
- package/dist/core/image.js +0 -25
- package/dist/core/internal.js +0 -27
- package/dist/core/limits.d.ts +30 -0
- package/dist/core/limits.js +2 -0
- package/dist/core/merge.d.ts +18 -0
- package/dist/core/merge.js +22 -7
- package/dist/core/modern-functions.js +0 -17
- package/dist/core/page-setup.js +0 -5
- package/dist/core/pivot-table.d.ts +1 -1
- package/dist/core/pivot-table.js +0 -44
- package/dist/core/preserved.js +0 -4
- package/dist/core/protection.js +0 -26
- package/dist/core/range.js +0 -112
- package/dist/core/row-input.d.ts +24 -0
- package/dist/core/row-input.js +29 -0
- package/dist/core/row.d.ts +9 -1
- package/dist/core/row.js +0 -58
- package/dist/core/style.js +0 -26
- package/dist/core/table-style.js +0 -28
- package/dist/core/table.js +0 -97
- package/dist/core/text-metrics.d.ts +20 -0
- package/dist/core/text-metrics.js +10 -0
- package/dist/core/theme.js +0 -85
- package/dist/core/value.d.ts +40 -0
- package/dist/core/value.js +30 -48
- package/dist/core/workbook-protection.js +0 -13
- package/dist/core/workbook.d.ts +13 -0
- package/dist/core/workbook.js +11 -368
- package/dist/core/worksheet-model.js +2 -23
- package/dist/core/worksheet.d.ts +22 -0
- package/dist/core/worksheet.js +14 -485
- package/dist/customui/errors.js +0 -10
- package/dist/customui/index.js +0 -5
- package/dist/customui/ribbon.js +0 -43
- package/dist/entries/core.d.ts +3 -1
- package/dist/entries/core.js +3 -7
- package/dist/entries/csv.js +0 -4
- package/dist/entries/customui.js +0 -2
- package/dist/entries/errors.js +0 -13
- package/dist/entries/vba.js +0 -5
- package/dist/entries/xlsb.js +0 -6
- package/dist/entries/xlsx.js +0 -13
- package/dist/errors.d.ts +14 -0
- package/dist/errors.js +5 -56
- package/dist/index.js +0 -12
- package/dist/io/csv/read.js +0 -18
- package/dist/io/csv/write.js +5 -35
- package/dist/io/opc/errors.js +0 -30
- package/dist/io/opc/inflate.js +0 -35
- package/dist/io/opc/namespaces.js +0 -15
- package/dist/io/opc/part-paths.js +0 -11
- package/dist/io/opc/read-opc.js +0 -31
- package/dist/io/opc/read-options.js +0 -6
- package/dist/io/opc/rels.js +0 -13
- package/dist/io/opc/sniff-format.js +0 -50
- package/dist/io/style/xf-style.js +0 -31
- package/dist/io/xlsb/errors.js +0 -10
- package/dist/io/xlsb/formula.js +1 -99
- package/dist/io/xlsb/primitives.js +1 -83
- package/dist/io/xlsb/ptg-functions.js +0 -34
- package/dist/io/xlsb/read-shared-strings.js +0 -7
- package/dist/io/xlsb/read-styles.js +3 -66
- package/dist/io/xlsb/read-worksheet.js +4 -87
- package/dist/io/xlsb/read.js +2 -60
- package/dist/io/xlsb/record-stream.js +0 -28
- package/dist/io/xlsb/record-types.js +0 -19
- package/dist/io/xlsx/cell-accumulator.js +0 -32
- package/dist/io/xlsx/cell-value.js +0 -29
- package/dist/io/xlsx/color-xml.d.ts +6 -0
- package/dist/io/xlsx/color-xml.js +42 -0
- package/dist/io/xlsx/comments.js +0 -84
- package/dist/io/xlsx/conditional-formatting.d.ts +1 -1
- package/dist/io/xlsx/conditional-formatting.js +1 -97
- package/dist/io/xlsx/data-validation.js +0 -56
- package/dist/io/xlsx/edit-vba.js +0 -54
- package/dist/io/xlsx/errors.js +0 -12
- package/dist/io/xlsx/hyperlinks.js +0 -40
- package/dist/io/xlsx/images.js +0 -32
- package/dist/io/xlsx/namespaces.js +0 -42
- package/dist/io/xlsx/package-plan.js +0 -47
- package/dist/io/xlsx/pivot.js +0 -22
- package/dist/io/xlsx/{pivot-read.js → read-pivot.js} +0 -30
- package/dist/io/xlsx/read-rows.js +1 -83
- package/dist/io/xlsx/{shared-strings-read.js → read-shared-strings.js} +0 -11
- package/dist/io/xlsx/read-styles.d.ts +25 -1
- package/dist/io/xlsx/read-styles.js +61 -108
- package/dist/io/xlsx/read-worksheet.js +1 -88
- package/dist/io/xlsx/read.js +3 -211
- package/dist/io/xlsx/relationships.js +0 -11
- package/dist/io/xlsx/rich-runs.js +0 -16
- package/dist/io/xlsx/rich-text.js +0 -12
- package/dist/io/xlsx/shared-formulas.js +0 -7
- package/dist/io/xlsx/shared-strings.js +0 -21
- package/dist/io/xlsx/sheet-properties.js +1 -64
- package/dist/io/xlsx/styles.d.ts +1 -29
- package/dist/io/xlsx/styles.js +2 -366
- package/dist/io/xlsx/tables.js +5 -52
- package/dist/io/xlsx/threaded-comments.js +0 -103
- package/dist/io/xlsx/workbook-xml.js +0 -94
- package/dist/io/xlsx/worksheet-xml.js +0 -174
- package/dist/io/xlsx/write-stream.js +0 -137
- package/dist/io/xlsx/write.js +1 -134
- package/dist/io/xlsx/x14-ext.js +0 -8
- package/dist/vba/cfb-writer.js +12 -59
- package/dist/vba/cfb.js +2 -32
- package/dist/vba/codepage.js +1 -23
- package/dist/vba/errors.js +0 -15
- package/dist/vba/index.js +0 -10
- package/dist/vba/ms-ovba.js +3 -46
- package/dist/vba/project-editor.js +4 -89
- package/dist/vba/project.js +2 -34
- package/dist/vba/vba-encoding.js +1 -17
- package/dist/xml/errors.js +0 -10
- package/dist/xml/xml-read.js +3 -82
- package/dist/xml/xml.js +0 -39
- package/package.json +9 -10
- package/skills/ts-xlsx-upstream/SKILL.md +178 -0
- /package/dist/io/xlsx/{pivot-read.d.ts → read-pivot.d.ts} +0 -0
- /package/dist/io/xlsx/{shared-strings-read.d.ts → read-shared-strings.d.ts} +0 -0
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
// The field table behind `Worksheet.model`'s round-trip.
|
|
2
|
-
//
|
|
3
|
-
// Both directions used to be hand-written statement lists, one in the getter and one in the setter,
|
|
4
|
-
// each enumerating the same nineteen fields. Nothing but a comment asked the next editor to touch
|
|
5
|
-
// both, and a field exported but not imported loses data silently — the merge-loss failure the
|
|
6
|
-
// model contract exists to prevent. Here each field declares both directions in one place, and the
|
|
7
|
-
// registry is proved exhaustive over `keyof WorksheetModel` at compile time, so adding a field
|
|
8
|
-
// without wiring it is an error naming the field rather than a review catch.
|
|
9
1
|
import { cellToModel, copyCellContent } from './cell.js';
|
|
10
2
|
import { cloneConditionalFormatting } from './conditional-formatting.js';
|
|
11
3
|
import { overwrite, replaceContents } from './containers.js';
|
|
@@ -14,11 +6,6 @@ import { INTERNAL } from './internal.js';
|
|
|
14
6
|
function facet(key, read, write) {
|
|
15
7
|
return { key, read, write: (sheet, model) => write(sheet, model[key]) };
|
|
16
8
|
}
|
|
17
|
-
/**
|
|
18
|
-
* Every field of a {@link WorksheetModel}, in the order a model assignment applies them. Order is
|
|
19
|
-
* load-bearing: cells are placed at their exact positions before any merge exists, so a covered
|
|
20
|
-
* cell's value lands where the model says instead of being routed to a region master mid-load.
|
|
21
|
-
*/
|
|
22
9
|
export const WORKSHEET_MODEL_FACETS = [
|
|
23
10
|
facet('state', (sheet) => sheet.state, (sheet, value) => {
|
|
24
11
|
sheet.state = value;
|
|
@@ -40,8 +27,6 @@ export const WORKSHEET_MODEL_FACETS = [
|
|
|
40
27
|
}),
|
|
41
28
|
facet('rows', (sheet) => {
|
|
42
29
|
const rows = [];
|
|
43
|
-
// A row appears here only for its formatting; the cells it holds are the `cells` field's
|
|
44
|
-
// business, and a row carrying nothing but cells has no properties to round-trip.
|
|
45
30
|
for (const { number, properties } of sheet.rows()) {
|
|
46
31
|
if (properties !== undefined)
|
|
47
32
|
rows.push({ number, properties: { ...properties } });
|
|
@@ -82,16 +67,10 @@ export const WORKSHEET_MODEL_FACETS = [
|
|
|
82
67
|
for (const options of value)
|
|
83
68
|
sheet.addTable(options);
|
|
84
69
|
}),
|
|
85
|
-
facet('autoFilter', (sheet) => sheet.autoFilter,
|
|
86
|
-
// Through the public setter, which re-canonicalises the range and — on `undefined` — clears any
|
|
87
|
-
// autofilter the destination held. That clearing is why the field is applied even when absent.
|
|
88
|
-
(sheet, value) => {
|
|
70
|
+
facet('autoFilter', (sheet) => sheet.autoFilter, (sheet, value) => {
|
|
89
71
|
sheet.autoFilter = value;
|
|
90
72
|
}),
|
|
91
|
-
facet('protection', (sheet) => sheet.protection,
|
|
92
|
-
// A loaded credential is already hashed, so it is reinstated verbatim rather than re-derived;
|
|
93
|
-
// `protect` cannot express that, which is why this goes through the internal channel.
|
|
94
|
-
(sheet, value) => {
|
|
73
|
+
facet('protection', (sheet) => sheet.protection, (sheet, value) => {
|
|
95
74
|
if (value === undefined)
|
|
96
75
|
sheet.unprotect();
|
|
97
76
|
else
|
package/dist/core/worksheet.d.ts
CHANGED
|
@@ -259,6 +259,28 @@ export declare class Worksheet {
|
|
|
259
259
|
* other axis: a value in column E makes this 5 even if columns B–D are empty.
|
|
260
260
|
*/
|
|
261
261
|
get columnCount(): number;
|
|
262
|
+
/**
|
|
263
|
+
* The sheet's used range as one handle — `A1` through the last row and column that carry
|
|
264
|
+
* anything — or `undefined` when there is no rectangle to name.
|
|
265
|
+
*
|
|
266
|
+
* This is {@link rowCount} and {@link columnCount} said once, so a caller stops reassembling
|
|
267
|
+
* `A1:${numberToColumn(sheet.columnCount)}${sheet.rowCount}` by hand. That is what an
|
|
268
|
+
* {@link autoFilter} covering the whole sheet wants — `sheet.autoFilter = sheet.usedRange.address`
|
|
269
|
+
* — and Excel writes exactly that ref for a filter it applies itself. A header-only ref filters
|
|
270
|
+
* nothing, which is the bug this exists to make hard to write.
|
|
271
|
+
*
|
|
272
|
+
* It inherits both counts' definition of *used*, so it spans gaps (a value in `E5` and nothing
|
|
273
|
+
* else still gives `A1:E5`) and includes a line carrying only its own formatting — a set column
|
|
274
|
+
* width, an outline level, a merge reaching past the last value. `undefined` therefore means
|
|
275
|
+
* strictly "no rectangle": an empty sheet, or one carrying only row formatting and no columns at
|
|
276
|
+
* all (or the reverse), where an axis has no extent to bound the other against.
|
|
277
|
+
*
|
|
278
|
+
* Not the same thing as the `<dimension>` a written package records. That is the *tight* box —
|
|
279
|
+
* top-left at the first used cell, formatting-only rows excluded — because Excel writes it to
|
|
280
|
+
* describe where the data is, not what the grid spans. This handle is anchored at `A1`, because
|
|
281
|
+
* a caller asking for the used range means the block to read, style or filter.
|
|
282
|
+
*/
|
|
283
|
+
get usedRange(): Range | undefined;
|
|
262
284
|
/** The columns carrying format properties, as handles, in ascending index order. */
|
|
263
285
|
columns(): IterableIterator<Column>;
|
|
264
286
|
/**
|