@cj-tech-master/excelts 4.2.2 → 4.2.3-canary.20260115111903.b80904d
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/dist/browser/modules/excel/utils/parse-sax.d.ts +3 -0
- package/dist/browser/modules/excel/utils/parse-sax.js +32 -13
- package/dist/browser/modules/excel/xlsx/xform/core/app-xform.js +3 -3
- package/dist/browser/modules/excel/xlsx/xform/core/core-xform.js +56 -68
- package/dist/browser/modules/excel/xlsx/xform/list-xform.js +8 -10
- package/dist/browser/modules/excel/xlsx/xform/strings/shared-string-xform.js +2 -3
- package/dist/browser/modules/excel/xlsx/xform/strings/text-xform.js +5 -7
- package/dist/browser/modules/excel/xlsx/xlsx.browser.js +8 -4
- package/dist/browser/modules/stream/streams.browser.js +0 -3
- package/dist/cjs/modules/excel/utils/parse-sax.js +32 -13
- package/dist/cjs/modules/excel/xlsx/xform/core/app-xform.js +3 -3
- package/dist/cjs/modules/excel/xlsx/xform/core/core-xform.js +56 -68
- package/dist/cjs/modules/excel/xlsx/xform/list-xform.js +8 -10
- package/dist/cjs/modules/excel/xlsx/xform/strings/shared-string-xform.js +2 -3
- package/dist/cjs/modules/excel/xlsx/xform/strings/text-xform.js +5 -7
- package/dist/cjs/modules/excel/xlsx/xlsx.browser.js +8 -4
- package/dist/cjs/modules/stream/streams.browser.js +0 -3
- package/dist/esm/modules/excel/utils/parse-sax.js +32 -13
- package/dist/esm/modules/excel/xlsx/xform/core/app-xform.js +3 -3
- package/dist/esm/modules/excel/xlsx/xform/core/core-xform.js +56 -68
- package/dist/esm/modules/excel/xlsx/xform/list-xform.js +8 -10
- package/dist/esm/modules/excel/xlsx/xform/strings/shared-string-xform.js +2 -3
- package/dist/esm/modules/excel/xlsx/xform/strings/text-xform.js +5 -7
- package/dist/esm/modules/excel/xlsx/xlsx.browser.js +8 -4
- package/dist/esm/modules/stream/streams.browser.js +0 -3
- package/dist/iife/excelts.iife.js +100 -101
- package/dist/iife/excelts.iife.js.map +1 -1
- package/dist/iife/excelts.iife.min.js +25 -25
- package/dist/types/modules/excel/utils/parse-sax.d.ts +3 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @cj-tech-master/excelts v4.2.
|
|
2
|
+
* @cj-tech-master/excelts v4.2.3-canary.20260115111903.b80904d
|
|
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
|
|
@@ -3951,7 +3951,6 @@ var ExcelTS = (function(exports) {
|
|
|
3951
3951
|
yield chunk;
|
|
3952
3952
|
}
|
|
3953
3953
|
}
|
|
3954
|
-
if (streamError) throw streamError;
|
|
3955
3954
|
} finally {
|
|
3956
3955
|
this.off("data", dataHandler);
|
|
3957
3956
|
this.off("end", endHandler);
|
|
@@ -6764,6 +6763,8 @@ var ExcelTS = (function(exports) {
|
|
|
6764
6763
|
quot: "\"",
|
|
6765
6764
|
apos: "'"
|
|
6766
6765
|
};
|
|
6766
|
+
const HAN_CELL_PREFIXES = /^(ep|cp|dc|dcterms|dcmitype|vt):/;
|
|
6767
|
+
const SPREADSHEETML_NS = "http://schemas.openxmlformats.org/spreadsheetml/2006/main";
|
|
6767
6768
|
const S_TEXT = 0;
|
|
6768
6769
|
const S_OPEN_WAKA = 1;
|
|
6769
6770
|
const S_OPEN_WAKA_BANG = 2;
|
|
@@ -6815,6 +6816,7 @@ var ExcelTS = (function(exports) {
|
|
|
6815
6816
|
this.positionAtNewLine = 0;
|
|
6816
6817
|
this.chunkPosition = 0;
|
|
6817
6818
|
this.ENTITIES = { ...XML_ENTITIES };
|
|
6819
|
+
this.nsPrefix = null;
|
|
6818
6820
|
this.trackPosition = opt?.position !== false;
|
|
6819
6821
|
this.fileName = opt?.fileName;
|
|
6820
6822
|
this.fragment = opt?.fragment ?? false;
|
|
@@ -6849,6 +6851,11 @@ var ExcelTS = (function(exports) {
|
|
|
6849
6851
|
this.chunk = "";
|
|
6850
6852
|
this.i = 0;
|
|
6851
6853
|
this.prevI = 0;
|
|
6854
|
+
this.nsPrefix = null;
|
|
6855
|
+
}
|
|
6856
|
+
stripNsPrefix(name) {
|
|
6857
|
+
const n = name.replace(HAN_CELL_PREFIXES, "");
|
|
6858
|
+
return this.nsPrefix && n.startsWith(this.nsPrefix + ":") ? n.slice(this.nsPrefix.length + 1) : n;
|
|
6852
6859
|
}
|
|
6853
6860
|
on(name, handler) {
|
|
6854
6861
|
switch (name) {
|
|
@@ -7188,7 +7195,7 @@ var ExcelTS = (function(exports) {
|
|
|
7188
7195
|
return;
|
|
7189
7196
|
}
|
|
7190
7197
|
this.tag = {
|
|
7191
|
-
name: this.name,
|
|
7198
|
+
name: this.stripNsPrefix(this.name),
|
|
7192
7199
|
attributes: Object.create(null),
|
|
7193
7200
|
isSelfClosing: false
|
|
7194
7201
|
};
|
|
@@ -7484,8 +7491,7 @@ var ExcelTS = (function(exports) {
|
|
|
7484
7491
|
openTag() {
|
|
7485
7492
|
const tag = this.tag;
|
|
7486
7493
|
tag.isSelfClosing = false;
|
|
7487
|
-
|
|
7488
|
-
this.attribList = [];
|
|
7494
|
+
this.processAttributes(tag);
|
|
7489
7495
|
this.openTagHandler?.(tag);
|
|
7490
7496
|
this.tags.push(tag);
|
|
7491
7497
|
this.name = "";
|
|
@@ -7494,16 +7500,26 @@ var ExcelTS = (function(exports) {
|
|
|
7494
7500
|
openSelfClosingTag() {
|
|
7495
7501
|
const tag = this.tag;
|
|
7496
7502
|
tag.isSelfClosing = true;
|
|
7497
|
-
|
|
7498
|
-
this.attribList = [];
|
|
7503
|
+
this.processAttributes(tag);
|
|
7499
7504
|
this.openTagHandler?.(tag);
|
|
7500
7505
|
this.closeTagHandler?.(tag);
|
|
7501
7506
|
if (this.tags.length === 0) this.closedRoot = true;
|
|
7502
7507
|
this.name = "";
|
|
7503
7508
|
this.state = S_TEXT;
|
|
7504
7509
|
}
|
|
7510
|
+
processAttributes(tag) {
|
|
7511
|
+
for (const { name, value } of this.attribList) {
|
|
7512
|
+
tag.attributes[name] = value;
|
|
7513
|
+
if (name.startsWith("xmlns:") && value === SPREADSHEETML_NS) {
|
|
7514
|
+
this.nsPrefix = name.slice(6);
|
|
7515
|
+
tag.name = this.stripNsPrefix(tag.name);
|
|
7516
|
+
}
|
|
7517
|
+
}
|
|
7518
|
+
this.attribList = [];
|
|
7519
|
+
}
|
|
7505
7520
|
closeTag() {
|
|
7506
|
-
const { tags
|
|
7521
|
+
const { tags } = this;
|
|
7522
|
+
const name = this.stripNsPrefix(this.name);
|
|
7507
7523
|
this.state = S_TEXT;
|
|
7508
7524
|
this.name = "";
|
|
7509
7525
|
if (name === "") {
|
|
@@ -7730,17 +7746,15 @@ var ExcelTS = (function(exports) {
|
|
|
7730
7746
|
this.parser.parseOpen(node);
|
|
7731
7747
|
return true;
|
|
7732
7748
|
}
|
|
7733
|
-
|
|
7734
|
-
|
|
7735
|
-
|
|
7736
|
-
return true;
|
|
7737
|
-
default:
|
|
7738
|
-
if (this.childXform.parseOpen(node)) {
|
|
7739
|
-
this.parser = this.childXform;
|
|
7740
|
-
return true;
|
|
7741
|
-
}
|
|
7742
|
-
return false;
|
|
7749
|
+
if (node.name === this.tag) {
|
|
7750
|
+
this.model = [];
|
|
7751
|
+
return true;
|
|
7743
7752
|
}
|
|
7753
|
+
if (this.childXform.parseOpen(node)) {
|
|
7754
|
+
this.parser = this.childXform;
|
|
7755
|
+
return true;
|
|
7756
|
+
}
|
|
7757
|
+
return false;
|
|
7744
7758
|
}
|
|
7745
7759
|
parseText(text) {
|
|
7746
7760
|
if (this.parser) this.parser.parseText(text);
|
|
@@ -9591,34 +9605,52 @@ var ExcelTS = (function(exports) {
|
|
|
9591
9605
|
|
|
9592
9606
|
//#endregion
|
|
9593
9607
|
//#region src/modules/excel/xlsx/xform/core/core-xform.ts
|
|
9608
|
+
const PROPS = {
|
|
9609
|
+
creator: "dc:creator",
|
|
9610
|
+
title: "dc:title",
|
|
9611
|
+
subject: "dc:subject",
|
|
9612
|
+
description: "dc:description",
|
|
9613
|
+
identifier: "dc:identifier",
|
|
9614
|
+
language: "dc:language",
|
|
9615
|
+
keywords: "cp:keywords",
|
|
9616
|
+
category: "cp:category",
|
|
9617
|
+
lastModifiedBy: "cp:lastModifiedBy",
|
|
9618
|
+
lastPrinted: "cp:lastPrinted",
|
|
9619
|
+
revision: "cp:revision",
|
|
9620
|
+
version: "cp:version",
|
|
9621
|
+
contentStatus: "cp:contentStatus",
|
|
9622
|
+
contentType: "cp:contentType",
|
|
9623
|
+
created: "dcterms:created",
|
|
9624
|
+
modified: "dcterms:modified"
|
|
9625
|
+
};
|
|
9594
9626
|
var CoreXform = class CoreXform extends BaseXform {
|
|
9595
9627
|
constructor() {
|
|
9596
9628
|
super();
|
|
9597
9629
|
this.map = {
|
|
9598
|
-
|
|
9599
|
-
|
|
9600
|
-
|
|
9601
|
-
|
|
9602
|
-
|
|
9603
|
-
|
|
9604
|
-
|
|
9605
|
-
|
|
9606
|
-
|
|
9607
|
-
|
|
9608
|
-
tag:
|
|
9630
|
+
creator: new StringXform({ tag: PROPS.creator }),
|
|
9631
|
+
title: new StringXform({ tag: PROPS.title }),
|
|
9632
|
+
subject: new StringXform({ tag: PROPS.subject }),
|
|
9633
|
+
description: new StringXform({ tag: PROPS.description }),
|
|
9634
|
+
identifier: new StringXform({ tag: PROPS.identifier }),
|
|
9635
|
+
language: new StringXform({ tag: PROPS.language }),
|
|
9636
|
+
keywords: new StringXform({ tag: PROPS.keywords }),
|
|
9637
|
+
category: new StringXform({ tag: PROPS.category }),
|
|
9638
|
+
lastModifiedBy: new StringXform({ tag: PROPS.lastModifiedBy }),
|
|
9639
|
+
lastPrinted: new DateXform({
|
|
9640
|
+
tag: PROPS.lastPrinted,
|
|
9609
9641
|
format: CoreXform.DateFormat
|
|
9610
9642
|
}),
|
|
9611
|
-
|
|
9612
|
-
|
|
9613
|
-
|
|
9614
|
-
|
|
9615
|
-
|
|
9616
|
-
tag:
|
|
9643
|
+
revision: new IntegerXform({ tag: PROPS.revision }),
|
|
9644
|
+
version: new StringXform({ tag: PROPS.version }),
|
|
9645
|
+
contentStatus: new StringXform({ tag: PROPS.contentStatus }),
|
|
9646
|
+
contentType: new StringXform({ tag: PROPS.contentType }),
|
|
9647
|
+
created: new DateXform({
|
|
9648
|
+
tag: PROPS.created,
|
|
9617
9649
|
attrs: CoreXform.DateAttrs,
|
|
9618
9650
|
format: CoreXform.DateFormat
|
|
9619
9651
|
}),
|
|
9620
|
-
|
|
9621
|
-
tag:
|
|
9652
|
+
modified: new DateXform({
|
|
9653
|
+
tag: PROPS.modified,
|
|
9622
9654
|
attrs: CoreXform.DateAttrs,
|
|
9623
9655
|
format: CoreXform.DateFormat
|
|
9624
9656
|
})
|
|
@@ -9627,22 +9659,7 @@ var ExcelTS = (function(exports) {
|
|
|
9627
9659
|
render(xmlStream, model) {
|
|
9628
9660
|
xmlStream.openXml(XmlStream.StdDocAttributes);
|
|
9629
9661
|
xmlStream.openNode("cp:coreProperties", CoreXform.CORE_PROPERTY_ATTRIBUTES);
|
|
9630
|
-
this.map[
|
|
9631
|
-
this.map["dc:title"].render(xmlStream, model.title);
|
|
9632
|
-
this.map["dc:subject"].render(xmlStream, model.subject);
|
|
9633
|
-
this.map["dc:description"].render(xmlStream, model.description);
|
|
9634
|
-
this.map["dc:identifier"].render(xmlStream, model.identifier);
|
|
9635
|
-
this.map["dc:language"].render(xmlStream, model.language);
|
|
9636
|
-
this.map["cp:keywords"].render(xmlStream, model.keywords);
|
|
9637
|
-
this.map["cp:category"].render(xmlStream, model.category);
|
|
9638
|
-
this.map["cp:lastModifiedBy"].render(xmlStream, model.lastModifiedBy);
|
|
9639
|
-
this.map["cp:lastPrinted"].render(xmlStream, model.lastPrinted);
|
|
9640
|
-
this.map["cp:revision"].render(xmlStream, model.revision);
|
|
9641
|
-
this.map["cp:version"].render(xmlStream, model.version);
|
|
9642
|
-
this.map["cp:contentStatus"].render(xmlStream, model.contentStatus);
|
|
9643
|
-
this.map["cp:contentType"].render(xmlStream, model.contentType);
|
|
9644
|
-
this.map["dcterms:created"].render(xmlStream, model.created);
|
|
9645
|
-
this.map["dcterms:modified"].render(xmlStream, model.modified);
|
|
9662
|
+
for (const key of Object.keys(PROPS)) this.map[key].render(xmlStream, model[key]);
|
|
9646
9663
|
xmlStream.closeNode();
|
|
9647
9664
|
}
|
|
9648
9665
|
parseOpen(node) {
|
|
@@ -9650,17 +9667,11 @@ var ExcelTS = (function(exports) {
|
|
|
9650
9667
|
this.parser.parseOpen(node);
|
|
9651
9668
|
return true;
|
|
9652
9669
|
}
|
|
9653
|
-
|
|
9654
|
-
|
|
9655
|
-
|
|
9656
|
-
default:
|
|
9657
|
-
this.parser = this.map[node.name];
|
|
9658
|
-
if (this.parser) {
|
|
9659
|
-
this.parser.parseOpen(node);
|
|
9660
|
-
return true;
|
|
9661
|
-
}
|
|
9662
|
-
throw new Error(`Unexpected xml node in parseOpen: ${JSON.stringify(node)}`);
|
|
9670
|
+
if (node.name !== "coreProperties") {
|
|
9671
|
+
this.parser = this.map[node.name];
|
|
9672
|
+
if (this.parser) this.parser.parseOpen(node);
|
|
9663
9673
|
}
|
|
9674
|
+
return true;
|
|
9664
9675
|
}
|
|
9665
9676
|
parseText(text) {
|
|
9666
9677
|
if (this.parser) this.parser.parseText(text);
|
|
@@ -9670,29 +9681,15 @@ var ExcelTS = (function(exports) {
|
|
|
9670
9681
|
if (!this.parser.parseClose(name)) this.parser = void 0;
|
|
9671
9682
|
return true;
|
|
9672
9683
|
}
|
|
9673
|
-
|
|
9674
|
-
|
|
9675
|
-
|
|
9676
|
-
this.model
|
|
9677
|
-
|
|
9678
|
-
|
|
9679
|
-
|
|
9680
|
-
description: this.map["dc:description"].model,
|
|
9681
|
-
identifier: this.map["dc:identifier"].model,
|
|
9682
|
-
language: this.map["dc:language"].model,
|
|
9683
|
-
keywords: this.map["cp:keywords"].model,
|
|
9684
|
-
category: this.map["cp:category"].model,
|
|
9685
|
-
lastModifiedBy: this.map["cp:lastModifiedBy"].model,
|
|
9686
|
-
lastPrinted: this.map["cp:lastPrinted"].model,
|
|
9687
|
-
revision: this.map["cp:revision"].model,
|
|
9688
|
-
contentStatus: this.map["cp:contentStatus"].model,
|
|
9689
|
-
contentType: this.map["cp:contentType"].model,
|
|
9690
|
-
created: this.map["dcterms:created"].model,
|
|
9691
|
-
modified: this.map["dcterms:modified"].model
|
|
9692
|
-
};
|
|
9693
|
-
return false;
|
|
9694
|
-
default: throw new Error(`Unexpected xml node in parseClose: ${name}`);
|
|
9684
|
+
if (name === "coreProperties") {
|
|
9685
|
+
this.model = {};
|
|
9686
|
+
for (const key of Object.keys(PROPS)) {
|
|
9687
|
+
const val = this.map[key].model;
|
|
9688
|
+
if (val !== void 0 && val !== "") this.model[key] = val;
|
|
9689
|
+
}
|
|
9690
|
+
return false;
|
|
9695
9691
|
}
|
|
9692
|
+
return true;
|
|
9696
9693
|
}
|
|
9697
9694
|
static {
|
|
9698
9695
|
this.DateFormat = function(dt) {
|
|
@@ -9726,13 +9723,12 @@ var ExcelTS = (function(exports) {
|
|
|
9726
9723
|
xmlStream.closeNode();
|
|
9727
9724
|
}
|
|
9728
9725
|
parseOpen(node) {
|
|
9729
|
-
|
|
9730
|
-
|
|
9731
|
-
|
|
9732
|
-
|
|
9733
|
-
return true;
|
|
9734
|
-
default: return false;
|
|
9726
|
+
if (node.name === "t") {
|
|
9727
|
+
this._text = [];
|
|
9728
|
+
this.model = "";
|
|
9729
|
+
return true;
|
|
9735
9730
|
}
|
|
9731
|
+
return false;
|
|
9736
9732
|
}
|
|
9737
9733
|
parseText(text) {
|
|
9738
9734
|
this._text.push(text);
|
|
@@ -9913,16 +9909,15 @@ var ExcelTS = (function(exports) {
|
|
|
9913
9909
|
xmlStream.closeNode();
|
|
9914
9910
|
}
|
|
9915
9911
|
parseOpen(node) {
|
|
9916
|
-
const { name } = node;
|
|
9917
9912
|
if (this.parser) {
|
|
9918
9913
|
this.parser.parseOpen(node);
|
|
9919
9914
|
return true;
|
|
9920
9915
|
}
|
|
9921
|
-
if (name === this.tag) {
|
|
9916
|
+
if (node.name === this.tag) {
|
|
9922
9917
|
this.model = {};
|
|
9923
9918
|
return true;
|
|
9924
9919
|
}
|
|
9925
|
-
this.parser = this.map[name];
|
|
9920
|
+
this.parser = this.map[node.name];
|
|
9926
9921
|
if (this.parser) {
|
|
9927
9922
|
this.parser.parseOpen(node);
|
|
9928
9923
|
return true;
|
|
@@ -10515,7 +10510,7 @@ var ExcelTS = (function(exports) {
|
|
|
10515
10510
|
Company: new StringXform({ tag: "Company" }),
|
|
10516
10511
|
Manager: new StringXform({ tag: "Manager" }),
|
|
10517
10512
|
HeadingPairs: new AppHeadingPairsXform(),
|
|
10518
|
-
|
|
10513
|
+
TitlesOfParts: new AppTitlesOfPartsXform()
|
|
10519
10514
|
};
|
|
10520
10515
|
}
|
|
10521
10516
|
render(xmlStream, model) {
|
|
@@ -10525,7 +10520,7 @@ var ExcelTS = (function(exports) {
|
|
|
10525
10520
|
xmlStream.leafNode("DocSecurity", void 0, "0");
|
|
10526
10521
|
xmlStream.leafNode("ScaleCrop", void 0, "false");
|
|
10527
10522
|
this.map.HeadingPairs.render(xmlStream, model.worksheets);
|
|
10528
|
-
this.map.
|
|
10523
|
+
this.map.TitlesOfParts.render(xmlStream, model.worksheets);
|
|
10529
10524
|
this.map.Company.render(xmlStream, model.company || "");
|
|
10530
10525
|
this.map.Manager.render(xmlStream, model.manager);
|
|
10531
10526
|
xmlStream.leafNode("LinksUpToDate", void 0, "false");
|
|
@@ -10561,7 +10556,7 @@ var ExcelTS = (function(exports) {
|
|
|
10561
10556
|
switch (name) {
|
|
10562
10557
|
case "Properties":
|
|
10563
10558
|
this.model = {
|
|
10564
|
-
worksheets: this.map.
|
|
10559
|
+
worksheets: this.map.TitlesOfParts.model,
|
|
10565
10560
|
company: this.map.Company.model,
|
|
10566
10561
|
manager: this.map.Manager.model
|
|
10567
10562
|
};
|
|
@@ -20494,8 +20489,10 @@ var ExcelTS = (function(exports) {
|
|
|
20494
20489
|
break;
|
|
20495
20490
|
case OOXML_PATHS.docPropsApp: {
|
|
20496
20491
|
const appProperties = await new AppXform().parseStream(stream);
|
|
20497
|
-
|
|
20498
|
-
|
|
20492
|
+
if (appProperties) {
|
|
20493
|
+
model.company = appProperties.company;
|
|
20494
|
+
model.manager = appProperties.manager;
|
|
20495
|
+
}
|
|
20499
20496
|
break;
|
|
20500
20497
|
}
|
|
20501
20498
|
case OOXML_PATHS.docPropsCore: {
|
|
@@ -20873,8 +20870,10 @@ var ExcelTS = (function(exports) {
|
|
|
20873
20870
|
break;
|
|
20874
20871
|
case OOXML_PATHS.docPropsApp: {
|
|
20875
20872
|
const appProperties = await new AppXform().parseStream(stream);
|
|
20876
|
-
|
|
20877
|
-
|
|
20873
|
+
if (appProperties) {
|
|
20874
|
+
model.company = appProperties.company;
|
|
20875
|
+
model.manager = appProperties.manager;
|
|
20876
|
+
}
|
|
20878
20877
|
break;
|
|
20879
20878
|
}
|
|
20880
20879
|
case OOXML_PATHS.docPropsCore: {
|