@cj-tech-master/excelts 5.0.3 → 5.0.4

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.
@@ -7,6 +7,7 @@ import type { PivotTableSource } from "@excel/pivot-table";
7
7
  interface ParsedCacheDefinitionModel {
8
8
  sourceRef?: string;
9
9
  sourceSheet?: string;
10
+ sourceTableName?: string;
10
11
  cacheFields: CacheFieldModel[];
11
12
  recordCount?: number;
12
13
  rId?: string;
@@ -71,7 +71,7 @@ class PivotCacheDefinitionXform extends BaseXform {
71
71
  * Render loaded pivot cache definition (preserving original structure)
72
72
  */
73
73
  renderLoaded(xmlStream, model) {
74
- const { cacheFields, sourceRef, sourceSheet, recordCount } = model;
74
+ const { cacheFields, sourceRef, sourceSheet, sourceTableName, recordCount } = model;
75
75
  xmlStream.openXml(XmlStream.StdDocAttributes);
76
76
  xmlStream.openNode(this.tag, {
77
77
  ...PivotCacheDefinitionXform.PIVOT_CACHE_DEFINITION_ATTRIBUTES,
@@ -83,10 +83,13 @@ class PivotCacheDefinitionXform extends BaseXform {
83
83
  recordCount: recordCount || cacheFields.length + 1
84
84
  });
85
85
  xmlStream.openNode("cacheSource", { type: "worksheet" });
86
- xmlStream.leafNode("worksheetSource", {
87
- ref: sourceRef,
88
- sheet: sourceSheet
89
- });
86
+ // worksheetSource supports two reference styles:
87
+ // 1. name: references a named Table
88
+ // 2. ref + sheet: references a cell range on a worksheet
89
+ const worksheetSourceAttrs = sourceTableName
90
+ ? { name: sourceTableName }
91
+ : { ref: sourceRef, sheet: sourceSheet };
92
+ xmlStream.leafNode("worksheetSource", worksheetSourceAttrs);
90
93
  xmlStream.closeNode();
91
94
  xmlStream.openNode("cacheFields", { count: cacheFields.length });
92
95
  xmlStream.writeXml(cacheFields
@@ -124,6 +127,7 @@ class PivotCacheDefinitionXform extends BaseXform {
124
127
  if (this.inCacheSource && this.model) {
125
128
  this.model.sourceRef = attributes.ref;
126
129
  this.model.sourceSheet = attributes.sheet;
130
+ this.model.sourceTableName = attributes.name;
127
131
  }
128
132
  break;
129
133
  case "cacheFields":
@@ -74,7 +74,7 @@ class PivotCacheDefinitionXform extends base_xform_1.BaseXform {
74
74
  * Render loaded pivot cache definition (preserving original structure)
75
75
  */
76
76
  renderLoaded(xmlStream, model) {
77
- const { cacheFields, sourceRef, sourceSheet, recordCount } = model;
77
+ const { cacheFields, sourceRef, sourceSheet, sourceTableName, recordCount } = model;
78
78
  xmlStream.openXml(xml_stream_1.XmlStream.StdDocAttributes);
79
79
  xmlStream.openNode(this.tag, {
80
80
  ...PivotCacheDefinitionXform.PIVOT_CACHE_DEFINITION_ATTRIBUTES,
@@ -86,10 +86,13 @@ class PivotCacheDefinitionXform extends base_xform_1.BaseXform {
86
86
  recordCount: recordCount || cacheFields.length + 1
87
87
  });
88
88
  xmlStream.openNode("cacheSource", { type: "worksheet" });
89
- xmlStream.leafNode("worksheetSource", {
90
- ref: sourceRef,
91
- sheet: sourceSheet
92
- });
89
+ // worksheetSource supports two reference styles:
90
+ // 1. name: references a named Table
91
+ // 2. ref + sheet: references a cell range on a worksheet
92
+ const worksheetSourceAttrs = sourceTableName
93
+ ? { name: sourceTableName }
94
+ : { ref: sourceRef, sheet: sourceSheet };
95
+ xmlStream.leafNode("worksheetSource", worksheetSourceAttrs);
93
96
  xmlStream.closeNode();
94
97
  xmlStream.openNode("cacheFields", { count: cacheFields.length });
95
98
  xmlStream.writeXml(cacheFields
@@ -127,6 +130,7 @@ class PivotCacheDefinitionXform extends base_xform_1.BaseXform {
127
130
  if (this.inCacheSource && this.model) {
128
131
  this.model.sourceRef = attributes.ref;
129
132
  this.model.sourceSheet = attributes.sheet;
133
+ this.model.sourceTableName = attributes.name;
130
134
  }
131
135
  break;
132
136
  case "cacheFields":
@@ -71,7 +71,7 @@ class PivotCacheDefinitionXform extends BaseXform {
71
71
  * Render loaded pivot cache definition (preserving original structure)
72
72
  */
73
73
  renderLoaded(xmlStream, model) {
74
- const { cacheFields, sourceRef, sourceSheet, recordCount } = model;
74
+ const { cacheFields, sourceRef, sourceSheet, sourceTableName, recordCount } = model;
75
75
  xmlStream.openXml(XmlStream.StdDocAttributes);
76
76
  xmlStream.openNode(this.tag, {
77
77
  ...PivotCacheDefinitionXform.PIVOT_CACHE_DEFINITION_ATTRIBUTES,
@@ -83,10 +83,13 @@ class PivotCacheDefinitionXform extends BaseXform {
83
83
  recordCount: recordCount || cacheFields.length + 1
84
84
  });
85
85
  xmlStream.openNode("cacheSource", { type: "worksheet" });
86
- xmlStream.leafNode("worksheetSource", {
87
- ref: sourceRef,
88
- sheet: sourceSheet
89
- });
86
+ // worksheetSource supports two reference styles:
87
+ // 1. name: references a named Table
88
+ // 2. ref + sheet: references a cell range on a worksheet
89
+ const worksheetSourceAttrs = sourceTableName
90
+ ? { name: sourceTableName }
91
+ : { ref: sourceRef, sheet: sourceSheet };
92
+ xmlStream.leafNode("worksheetSource", worksheetSourceAttrs);
90
93
  xmlStream.closeNode();
91
94
  xmlStream.openNode("cacheFields", { count: cacheFields.length });
92
95
  xmlStream.writeXml(cacheFields
@@ -124,6 +127,7 @@ class PivotCacheDefinitionXform extends BaseXform {
124
127
  if (this.inCacheSource && this.model) {
125
128
  this.model.sourceRef = attributes.ref;
126
129
  this.model.sourceSheet = attributes.sheet;
130
+ this.model.sourceTableName = attributes.name;
127
131
  }
128
132
  break;
129
133
  case "cacheFields":
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @cj-tech-master/excelts v5.0.3
2
+ * @cj-tech-master/excelts v5.0.4
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
@@ -15967,7 +15967,7 @@ var ExcelTS = (function(exports) {
15967
15967
  * Render loaded pivot cache definition (preserving original structure)
15968
15968
  */
15969
15969
  renderLoaded(xmlStream, model) {
15970
- const { cacheFields, sourceRef, sourceSheet, recordCount } = model;
15970
+ const { cacheFields, sourceRef, sourceSheet, sourceTableName, recordCount } = model;
15971
15971
  xmlStream.openXml(XmlStream.StdDocAttributes);
15972
15972
  xmlStream.openNode(this.tag, {
15973
15973
  ...PivotCacheDefinitionXform.PIVOT_CACHE_DEFINITION_ATTRIBUTES,
@@ -15979,10 +15979,11 @@ var ExcelTS = (function(exports) {
15979
15979
  recordCount: recordCount || cacheFields.length + 1
15980
15980
  });
15981
15981
  xmlStream.openNode("cacheSource", { type: "worksheet" });
15982
- xmlStream.leafNode("worksheetSource", {
15982
+ const worksheetSourceAttrs = sourceTableName ? { name: sourceTableName } : {
15983
15983
  ref: sourceRef,
15984
15984
  sheet: sourceSheet
15985
- });
15985
+ };
15986
+ xmlStream.leafNode("worksheetSource", worksheetSourceAttrs);
15986
15987
  xmlStream.closeNode();
15987
15988
  xmlStream.openNode("cacheFields", { count: cacheFields.length });
15988
15989
  xmlStream.writeXml(cacheFields.map((cacheField) => new CacheField(cacheField).render()).join("\n "));
@@ -16016,6 +16017,7 @@ var ExcelTS = (function(exports) {
16016
16017
  if (this.inCacheSource && this.model) {
16017
16018
  this.model.sourceRef = attributes.ref;
16018
16019
  this.model.sourceSheet = attributes.sheet;
16020
+ this.model.sourceTableName = attributes.name;
16019
16021
  }
16020
16022
  break;
16021
16023
  case "cacheFields":