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