@cj-tech-master/excelts 5.1.13 → 5.1.14

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 CHANGED
@@ -9,13 +9,12 @@ Modern TypeScript Excel Workbook Manager - Read, manipulate and write spreadshee
9
9
  ExcelTS is a modern TypeScript Excel workbook manager with:
10
10
 
11
11
  - 🚀 **Zero Runtime Dependencies** - Pure TypeScript implementation with no external packages
12
+ - ✅ **Broad Runtime Support** - LTS Node.js, Bun, and modern browsers (Chrome, Firefox, Safari, Edge)
12
13
  - ✅ **Full TypeScript Support** - Complete type definitions and modern TypeScript patterns
13
14
  - ✅ **Modern Build System** - Using Rolldown for faster builds
14
15
  - ✅ **Enhanced Testing** - Migrated to Vitest with browser testing support
15
16
  - ✅ **ESM First** - Native ES Module support with CommonJS compatibility
16
- - ✅ **Node 20+** - Optimized for modern Node.js versions
17
17
  - ✅ **Named Exports** - All exports are named for better tree-shaking
18
- - ✅ **Broad Browser Support** - Works in Chrome 89+, Firefox 102+, Safari 14.1+ (with built-in fallbacks for missing `CompressionStream`)
19
18
 
20
19
  ## Translations
21
20
 
package/README_zh.md CHANGED
@@ -9,13 +9,12 @@
9
9
  ExcelTS 是现代化的 TypeScript Excel 工作簿管理器,具有以下特性:
10
10
 
11
11
  - 🚀 **零运行时依赖** - 纯 TypeScript 实现,无任何外部包依赖
12
+ - ✅ **广泛运行时支持** - 支持 LTS Node.js、Bun 及主流最新浏览器(Chrome、Firefox、Safari、Edge)
12
13
  - ✅ **完整的 TypeScript 支持** - 完整的类型定义和现代 TypeScript 模式
13
14
  - ✅ **现代构建系统** - 使用 Rolldown 进行更快的构建
14
15
  - ✅ **增强的测试** - 迁移到 Vitest 并支持浏览器测试
15
16
  - ✅ **ESM 优先** - 原生 ES Module 支持,兼容 CommonJS
16
- - ✅ **Node 20+** - 针对现代 Node.js 版本优化
17
17
  - ✅ **命名导出** - 所有导出都是命名导出,更好的 tree-shaking
18
- - ✅ **广泛浏览器支持** - 支持 Chrome 89+、Firefox 102+、Safari 14.1+(对缺失 `CompressionStream` 有内置 fallback)
19
18
 
20
19
  ## 翻译
21
20
 
@@ -11,6 +11,7 @@ export interface RowModel {
11
11
  min: number;
12
12
  max: number;
13
13
  height?: number;
14
+ customHeight?: boolean;
14
15
  style: Partial<Style>;
15
16
  hidden: boolean;
16
17
  outlineLevel: number;
@@ -25,6 +26,7 @@ declare class Row {
25
26
  private _hidden?;
26
27
  private _outlineLevel?;
27
28
  height?: number;
29
+ customHeight?: boolean;
28
30
  dyDescent?: number;
29
31
  constructor(worksheet: Worksheet, number: number);
30
32
  /**
@@ -379,13 +379,14 @@ class Row {
379
379
  }
380
380
  }
381
381
  });
382
- return this.height || cells.length
382
+ return this.height != null || cells.length
383
383
  ? {
384
384
  cells,
385
385
  number: this.number,
386
386
  min,
387
387
  max,
388
388
  height: this.height,
389
+ customHeight: this.customHeight,
389
390
  style: this.style,
390
391
  hidden: this.hidden,
391
392
  outlineLevel: this.outlineLevel,
@@ -429,12 +430,18 @@ class Row {
429
430
  }
430
431
  }
431
432
  });
432
- if (value.height) {
433
+ if (value.height != null) {
433
434
  this.height = value.height;
434
435
  }
435
436
  else {
436
437
  delete this.height;
437
438
  }
439
+ if (value.customHeight != null) {
440
+ this.customHeight = value.customHeight;
441
+ }
442
+ else {
443
+ delete this.customHeight;
444
+ }
438
445
  this.hidden = value.hidden;
439
446
  this.outlineLevel = value.outlineLevel ?? 0;
440
447
  this.dyDescent = value.dyDescent;
@@ -176,6 +176,9 @@ class WorksheetReader extends EventEmitter {
176
176
  if (node.attributes.ht) {
177
177
  row.height = parseFloat(node.attributes.ht);
178
178
  }
179
+ if (node.attributes.customHeight === "1") {
180
+ row.customHeight = true;
181
+ }
179
182
  if (node.attributes.s !== undefined) {
180
183
  const styleId = parseInt(node.attributes.s, 10);
181
184
  const style = styles.getStyleModel(styleId);
@@ -519,7 +519,7 @@ class WorksheetWriter {
519
519
  this._writeOpenSheetData();
520
520
  this.startedData = true;
521
521
  }
522
- if (row.hasValues || row.height) {
522
+ if (row.hasValues || row.height != null) {
523
523
  const { model } = row;
524
524
  const options = {
525
525
  styles: this._workbook.styles,
@@ -11,6 +11,7 @@ interface RowModel {
11
11
  hidden?: boolean;
12
12
  bestFit?: boolean;
13
13
  height?: number;
14
+ customHeight?: boolean;
14
15
  outlineLevel?: number;
15
16
  collapsed?: boolean;
16
17
  style?: any;
@@ -34,9 +34,11 @@ class RowXform extends BaseXform {
34
34
  }
35
35
  xmlStream.openNode("row");
36
36
  xmlStream.addAttribute("r", model.number);
37
- if (model.height) {
37
+ if (model.height != null && model.height > 0) {
38
38
  xmlStream.addAttribute("ht", model.height);
39
- xmlStream.addAttribute("customHeight", "1");
39
+ if (model.customHeight !== false) {
40
+ xmlStream.addAttribute("customHeight", "1");
41
+ }
40
42
  }
41
43
  if (model.hidden) {
42
44
  xmlStream.addAttribute("hidden", "1");
@@ -96,6 +98,9 @@ class RowXform extends BaseXform {
96
98
  if (node.attributes.ht) {
97
99
  model.height = parseFloat(node.attributes.ht);
98
100
  }
101
+ if (parseBoolean(node.attributes.customHeight)) {
102
+ model.customHeight = true;
103
+ }
99
104
  if (node.attributes.outlineLevel) {
100
105
  model.outlineLevel = parseInt(node.attributes.outlineLevel, 10);
101
106
  }
@@ -382,13 +382,14 @@ class Row {
382
382
  }
383
383
  }
384
384
  });
385
- return this.height || cells.length
385
+ return this.height != null || cells.length
386
386
  ? {
387
387
  cells,
388
388
  number: this.number,
389
389
  min,
390
390
  max,
391
391
  height: this.height,
392
+ customHeight: this.customHeight,
392
393
  style: this.style,
393
394
  hidden: this.hidden,
394
395
  outlineLevel: this.outlineLevel,
@@ -432,12 +433,18 @@ class Row {
432
433
  }
433
434
  }
434
435
  });
435
- if (value.height) {
436
+ if (value.height != null) {
436
437
  this.height = value.height;
437
438
  }
438
439
  else {
439
440
  delete this.height;
440
441
  }
442
+ if (value.customHeight != null) {
443
+ this.customHeight = value.customHeight;
444
+ }
445
+ else {
446
+ delete this.customHeight;
447
+ }
441
448
  this.hidden = value.hidden;
442
449
  this.outlineLevel = value.outlineLevel ?? 0;
443
450
  this.dyDescent = value.dyDescent;
@@ -179,6 +179,9 @@ class WorksheetReader extends _stream_1.EventEmitter {
179
179
  if (node.attributes.ht) {
180
180
  row.height = parseFloat(node.attributes.ht);
181
181
  }
182
+ if (node.attributes.customHeight === "1") {
183
+ row.customHeight = true;
184
+ }
182
185
  if (node.attributes.s !== undefined) {
183
186
  const styleId = parseInt(node.attributes.s, 10);
184
187
  const style = styles.getStyleModel(styleId);
@@ -522,7 +522,7 @@ class WorksheetWriter {
522
522
  this._writeOpenSheetData();
523
523
  this.startedData = true;
524
524
  }
525
- if (row.hasValues || row.height) {
525
+ if (row.hasValues || row.height != null) {
526
526
  const { model } = row;
527
527
  const options = {
528
528
  styles: this._workbook.styles,
@@ -37,9 +37,11 @@ class RowXform extends base_xform_1.BaseXform {
37
37
  }
38
38
  xmlStream.openNode("row");
39
39
  xmlStream.addAttribute("r", model.number);
40
- if (model.height) {
40
+ if (model.height != null && model.height > 0) {
41
41
  xmlStream.addAttribute("ht", model.height);
42
- xmlStream.addAttribute("customHeight", "1");
42
+ if (model.customHeight !== false) {
43
+ xmlStream.addAttribute("customHeight", "1");
44
+ }
43
45
  }
44
46
  if (model.hidden) {
45
47
  xmlStream.addAttribute("hidden", "1");
@@ -99,6 +101,9 @@ class RowXform extends base_xform_1.BaseXform {
99
101
  if (node.attributes.ht) {
100
102
  model.height = parseFloat(node.attributes.ht);
101
103
  }
104
+ if ((0, utils_1.parseBoolean)(node.attributes.customHeight)) {
105
+ model.customHeight = true;
106
+ }
102
107
  if (node.attributes.outlineLevel) {
103
108
  model.outlineLevel = parseInt(node.attributes.outlineLevel, 10);
104
109
  }
@@ -379,13 +379,14 @@ class Row {
379
379
  }
380
380
  }
381
381
  });
382
- return this.height || cells.length
382
+ return this.height != null || cells.length
383
383
  ? {
384
384
  cells,
385
385
  number: this.number,
386
386
  min,
387
387
  max,
388
388
  height: this.height,
389
+ customHeight: this.customHeight,
389
390
  style: this.style,
390
391
  hidden: this.hidden,
391
392
  outlineLevel: this.outlineLevel,
@@ -429,12 +430,18 @@ class Row {
429
430
  }
430
431
  }
431
432
  });
432
- if (value.height) {
433
+ if (value.height != null) {
433
434
  this.height = value.height;
434
435
  }
435
436
  else {
436
437
  delete this.height;
437
438
  }
439
+ if (value.customHeight != null) {
440
+ this.customHeight = value.customHeight;
441
+ }
442
+ else {
443
+ delete this.customHeight;
444
+ }
438
445
  this.hidden = value.hidden;
439
446
  this.outlineLevel = value.outlineLevel ?? 0;
440
447
  this.dyDescent = value.dyDescent;
@@ -176,6 +176,9 @@ class WorksheetReader extends EventEmitter {
176
176
  if (node.attributes.ht) {
177
177
  row.height = parseFloat(node.attributes.ht);
178
178
  }
179
+ if (node.attributes.customHeight === "1") {
180
+ row.customHeight = true;
181
+ }
179
182
  if (node.attributes.s !== undefined) {
180
183
  const styleId = parseInt(node.attributes.s, 10);
181
184
  const style = styles.getStyleModel(styleId);
@@ -519,7 +519,7 @@ class WorksheetWriter {
519
519
  this._writeOpenSheetData();
520
520
  this.startedData = true;
521
521
  }
522
- if (row.hasValues || row.height) {
522
+ if (row.hasValues || row.height != null) {
523
523
  const { model } = row;
524
524
  const options = {
525
525
  styles: this._workbook.styles,
@@ -34,9 +34,11 @@ class RowXform extends BaseXform {
34
34
  }
35
35
  xmlStream.openNode("row");
36
36
  xmlStream.addAttribute("r", model.number);
37
- if (model.height) {
37
+ if (model.height != null && model.height > 0) {
38
38
  xmlStream.addAttribute("ht", model.height);
39
- xmlStream.addAttribute("customHeight", "1");
39
+ if (model.customHeight !== false) {
40
+ xmlStream.addAttribute("customHeight", "1");
41
+ }
40
42
  }
41
43
  if (model.hidden) {
42
44
  xmlStream.addAttribute("hidden", "1");
@@ -96,6 +98,9 @@ class RowXform extends BaseXform {
96
98
  if (node.attributes.ht) {
97
99
  model.height = parseFloat(node.attributes.ht);
98
100
  }
101
+ if (parseBoolean(node.attributes.customHeight)) {
102
+ model.customHeight = true;
103
+ }
99
104
  if (node.attributes.outlineLevel) {
100
105
  model.outlineLevel = parseInt(node.attributes.outlineLevel, 10);
101
106
  }
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @cj-tech-master/excelts v5.1.13
2
+ * @cj-tech-master/excelts v5.1.14
3
3
  * TypeScript Excel Workbook Manager - Read and Write xlsx and csv Files.
4
4
  * (c) 2026 cjnoname
5
5
  * Released under the MIT License
@@ -1862,12 +1862,13 @@ var ExcelTS = (function(exports) {
1862
1862
  }
1863
1863
  }
1864
1864
  });
1865
- return this.height || cells.length ? {
1865
+ return this.height != null || cells.length ? {
1866
1866
  cells,
1867
1867
  number: this.number,
1868
1868
  min,
1869
1869
  max,
1870
1870
  height: this.height,
1871
+ customHeight: this.customHeight,
1871
1872
  style: this.style,
1872
1873
  hidden: this.hidden,
1873
1874
  outlineLevel: this.outlineLevel,
@@ -1902,8 +1903,10 @@ var ExcelTS = (function(exports) {
1902
1903
  }
1903
1904
  }
1904
1905
  });
1905
- if (value.height) this.height = value.height;
1906
+ if (value.height != null) this.height = value.height;
1906
1907
  else delete this.height;
1908
+ if (value.customHeight != null) this.customHeight = value.customHeight;
1909
+ else delete this.customHeight;
1907
1910
  this.hidden = value.hidden;
1908
1911
  this.outlineLevel = value.outlineLevel ?? 0;
1909
1912
  this.dyDescent = value.dyDescent;
@@ -11946,9 +11949,9 @@ var ExcelTS = (function(exports) {
11946
11949
  if (!model) return;
11947
11950
  xmlStream.openNode("row");
11948
11951
  xmlStream.addAttribute("r", model.number);
11949
- if (model.height) {
11952
+ if (model.height != null && model.height > 0) {
11950
11953
  xmlStream.addAttribute("ht", model.height);
11951
- xmlStream.addAttribute("customHeight", "1");
11954
+ if (model.customHeight !== false) xmlStream.addAttribute("customHeight", "1");
11952
11955
  }
11953
11956
  if (model.hidden) xmlStream.addAttribute("hidden", "1");
11954
11957
  if (model.min > 0 && model.max > 0 && model.min <= model.max) xmlStream.addAttribute("spans", `${model.min}:${model.max}`);
@@ -11984,6 +11987,7 @@ var ExcelTS = (function(exports) {
11984
11987
  if (parseBoolean(node.attributes.hidden)) model.hidden = true;
11985
11988
  if (parseBoolean(node.attributes.bestFit)) model.bestFit = true;
11986
11989
  if (node.attributes.ht) model.height = parseFloat(node.attributes.ht);
11990
+ if (parseBoolean(node.attributes.customHeight)) model.customHeight = true;
11987
11991
  if (node.attributes.outlineLevel) model.outlineLevel = parseInt(node.attributes.outlineLevel, 10);
11988
11992
  if (parseBoolean(node.attributes.collapsed)) model.collapsed = true;
11989
11993
  if (node.attributes["x14ac:dyDescent"] !== void 0) model.dyDescent = parseFloat(node.attributes["x14ac:dyDescent"]);
@@ -24513,7 +24517,7 @@ var ExcelTS = (function(exports) {
24513
24517
  this._writeOpenSheetData();
24514
24518
  this.startedData = true;
24515
24519
  }
24516
- if (row.hasValues || row.height) {
24520
+ if (row.hasValues || row.height != null) {
24517
24521
  const { model } = row;
24518
24522
  const options = {
24519
24523
  styles: this._workbook.styles,
@@ -26377,6 +26381,7 @@ onmessage = async (ev) => {
26377
26381
  const r = parseInt(node.attributes.r, 10);
26378
26382
  row = new Row(this, r);
26379
26383
  if (node.attributes.ht) row.height = parseFloat(node.attributes.ht);
26384
+ if (node.attributes.customHeight === "1") row.customHeight = true;
26380
26385
  if (node.attributes.s !== void 0) {
26381
26386
  const styleId = parseInt(node.attributes.s, 10);
26382
26387
  const style = styles.getStyleModel(styleId);