@cj-tech-master/excelts 2.0.0-canary.20251228024848.8822305 → 2.0.1-canary.20251228093548.379d895
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/excelts.esm.js +146 -116
- package/dist/browser/excelts.esm.js.map +1 -1
- package/dist/browser/excelts.esm.min.js +22 -22
- package/dist/browser/excelts.iife.js +146 -116
- package/dist/browser/excelts.iife.js.map +1 -1
- package/dist/browser/excelts.iife.min.js +22 -22
- package/dist/cjs/doc/pivot-table.js +37 -3
- package/dist/cjs/doc/worksheet.js +0 -1
- package/dist/cjs/stream/xlsx/worksheet-writer.js +0 -1
- package/dist/cjs/xlsx/xform/book/sheet-xform.js +3 -2
- package/dist/cjs/xlsx/xform/book/workbook-properties-xform.js +1 -1
- package/dist/cjs/xlsx/xform/core/content-types-xform.js +12 -6
- package/dist/cjs/xlsx/xform/pivot-table/cache-field.js +11 -4
- package/dist/cjs/xlsx/xform/pivot-table/pivot-cache-definition-xform.js +1 -10
- package/dist/cjs/xlsx/xform/pivot-table/pivot-table-xform.js +39 -17
- package/dist/cjs/xlsx/xform/sheet/page-setup-xform.js +4 -3
- package/dist/cjs/xlsx/xform/sheet/row-xform.js +1 -1
- package/dist/cjs/xlsx/xform/sheet/sheet-format-properties-xform.js +6 -3
- package/dist/cjs/xlsx/xform/sheet/sheet-view-xform.js +8 -4
- package/dist/cjs/xlsx/xform/sheet/worksheet-xform.js +2 -2
- package/dist/cjs/xlsx/xform/style/font-xform.js +36 -23
- package/dist/cjs/xlsx/xform/table/auto-filter-xform.js +3 -1
- package/dist/cjs/xlsx/xform/table/table-column-xform.js +2 -1
- package/dist/cjs/xlsx/xform/table/table-xform.js +5 -9
- package/dist/esm/doc/pivot-table.js +37 -3
- package/dist/esm/doc/worksheet.js +0 -1
- package/dist/esm/stream/xlsx/worksheet-writer.js +0 -1
- package/dist/esm/xlsx/xform/book/sheet-xform.js +3 -2
- package/dist/esm/xlsx/xform/book/workbook-properties-xform.js +1 -1
- package/dist/esm/xlsx/xform/core/content-types-xform.js +12 -6
- package/dist/esm/xlsx/xform/pivot-table/cache-field.js +11 -4
- package/dist/esm/xlsx/xform/pivot-table/pivot-cache-definition-xform.js +1 -10
- package/dist/esm/xlsx/xform/pivot-table/pivot-table-xform.js +39 -17
- package/dist/esm/xlsx/xform/sheet/page-setup-xform.js +4 -3
- package/dist/esm/xlsx/xform/sheet/row-xform.js +1 -1
- package/dist/esm/xlsx/xform/sheet/sheet-format-properties-xform.js +6 -3
- package/dist/esm/xlsx/xform/sheet/sheet-view-xform.js +8 -4
- package/dist/esm/xlsx/xform/sheet/worksheet-xform.js +2 -2
- package/dist/esm/xlsx/xform/style/font-xform.js +36 -23
- package/dist/esm/xlsx/xform/table/auto-filter-xform.js +3 -1
- package/dist/esm/xlsx/xform/table/table-column-xform.js +2 -1
- package/dist/esm/xlsx/xform/table/table-xform.js +5 -9
- package/dist/types/doc/pivot-table.d.ts +5 -1
- package/dist/types/stream/xlsx/worksheet-writer.d.ts +1 -1
- package/dist/types/types.d.ts +1 -1
- package/dist/types/xlsx/xform/pivot-table/cache-field.d.ts +5 -1
- package/dist/types/xlsx/xform/pivot-table/pivot-cache-definition-xform.d.ts +0 -5
- package/dist/types/xlsx/xform/pivot-table/pivot-table-xform.d.ts +0 -3
- package/dist/types/xlsx/xform/sheet/sheet-format-properties-xform.d.ts +1 -1
- package/dist/types/xlsx/xform/sheet/worksheet-xform.d.ts +1 -1
- package/dist/types/xlsx/xform/style/font-xform.d.ts +1 -0
- package/dist/types/xlsx/xform/table/table-xform.d.ts +0 -4
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @cj-tech-master/excelts v2.0.
|
|
2
|
+
* @cj-tech-master/excelts v2.0.1-canary.20251228093548.379d895
|
|
3
3
|
* TypeScript Excel Workbook Manager - Read and Write xlsx and csv Files.
|
|
4
4
|
* (c) 2025 cjnoname
|
|
5
5
|
* Released under the MIT License
|
|
@@ -2965,7 +2965,7 @@ var ExcelTS = (function(exports) {
|
|
|
2965
2965
|
const endCol = startCol + columnNames.length - 1;
|
|
2966
2966
|
const shortRange = colCache.encode(startRow, startCol, endRow, endCol);
|
|
2967
2967
|
return {
|
|
2968
|
-
name:
|
|
2968
|
+
name: table.worksheet.name,
|
|
2969
2969
|
getRow(rowNumber) {
|
|
2970
2970
|
if (rowNumber === 1) return { values: headerRow };
|
|
2971
2971
|
const dataIndex = rowNumber - 2;
|
|
@@ -3049,14 +3049,40 @@ var ExcelTS = (function(exports) {
|
|
|
3049
3049
|
}
|
|
3050
3050
|
return toSortedArray(uniqueValues);
|
|
3051
3051
|
};
|
|
3052
|
+
const getMinMax = (columnIndex) => {
|
|
3053
|
+
const columnValues = source.getColumn(columnIndex).values;
|
|
3054
|
+
let min = Infinity;
|
|
3055
|
+
let max = -Infinity;
|
|
3056
|
+
let hasNumeric = false;
|
|
3057
|
+
for (let i = 2; i < columnValues.length; i++) {
|
|
3058
|
+
const v = columnValues[i];
|
|
3059
|
+
if (typeof v === "number" && !isNaN(v)) {
|
|
3060
|
+
hasNumeric = true;
|
|
3061
|
+
if (v < min) min = v;
|
|
3062
|
+
if (v > max) max = v;
|
|
3063
|
+
}
|
|
3064
|
+
}
|
|
3065
|
+
return hasNumeric ? {
|
|
3066
|
+
minValue: min,
|
|
3067
|
+
maxValue: max
|
|
3068
|
+
} : null;
|
|
3069
|
+
};
|
|
3052
3070
|
const result = [];
|
|
3053
3071
|
for (const columnIndex of range(1, names.length)) {
|
|
3054
3072
|
const name = names[columnIndex];
|
|
3055
|
-
|
|
3056
|
-
result.push({
|
|
3073
|
+
if (sharedItemsFields.has(name)) result.push({
|
|
3057
3074
|
name,
|
|
3058
|
-
sharedItems
|
|
3075
|
+
sharedItems: aggregate(columnIndex)
|
|
3059
3076
|
});
|
|
3077
|
+
else {
|
|
3078
|
+
const minMax = getMinMax(columnIndex);
|
|
3079
|
+
result.push({
|
|
3080
|
+
name,
|
|
3081
|
+
sharedItems: null,
|
|
3082
|
+
minValue: minMax?.minValue,
|
|
3083
|
+
maxValue: minMax?.maxValue
|
|
3084
|
+
});
|
|
3085
|
+
}
|
|
3060
3086
|
}
|
|
3061
3087
|
return result;
|
|
3062
3088
|
}
|
|
@@ -3118,7 +3144,6 @@ var ExcelTS = (function(exports) {
|
|
|
3118
3144
|
this.colBreaks = [];
|
|
3119
3145
|
this.properties = Object.assign({}, {
|
|
3120
3146
|
defaultRowHeight: 15,
|
|
3121
|
-
dyDescent: 55,
|
|
3122
3147
|
outlineLevelCol: 0,
|
|
3123
3148
|
outlineLevelRow: 0
|
|
3124
3149
|
}, options.properties);
|
|
@@ -7492,116 +7517,136 @@ var ExcelTS = (function(exports) {
|
|
|
7492
7517
|
constructor(options) {
|
|
7493
7518
|
super();
|
|
7494
7519
|
this.options = options || FontXform.OPTIONS;
|
|
7495
|
-
|
|
7496
|
-
|
|
7520
|
+
const fontProperties = [
|
|
7521
|
+
{
|
|
7522
|
+
tag: "b",
|
|
7497
7523
|
prop: "bold",
|
|
7498
7524
|
xform: new BooleanXform({
|
|
7499
7525
|
tag: "b",
|
|
7500
7526
|
attr: "val"
|
|
7501
7527
|
})
|
|
7502
7528
|
},
|
|
7503
|
-
|
|
7529
|
+
{
|
|
7530
|
+
tag: "i",
|
|
7504
7531
|
prop: "italic",
|
|
7505
7532
|
xform: new BooleanXform({
|
|
7506
7533
|
tag: "i",
|
|
7507
7534
|
attr: "val"
|
|
7508
7535
|
})
|
|
7509
7536
|
},
|
|
7510
|
-
|
|
7537
|
+
{
|
|
7538
|
+
tag: "u",
|
|
7511
7539
|
prop: "underline",
|
|
7512
7540
|
xform: new UnderlineXform()
|
|
7513
7541
|
},
|
|
7514
|
-
|
|
7515
|
-
|
|
7516
|
-
|
|
7517
|
-
|
|
7542
|
+
{
|
|
7543
|
+
tag: "strike",
|
|
7544
|
+
prop: "strike",
|
|
7545
|
+
xform: new BooleanXform({
|
|
7546
|
+
tag: "strike",
|
|
7518
7547
|
attr: "val"
|
|
7519
7548
|
})
|
|
7520
7549
|
},
|
|
7521
|
-
|
|
7522
|
-
|
|
7523
|
-
xform: new ColorXform()
|
|
7524
|
-
},
|
|
7525
|
-
condense: {
|
|
7550
|
+
{
|
|
7551
|
+
tag: "condense",
|
|
7526
7552
|
prop: "condense",
|
|
7527
7553
|
xform: new BooleanXform({
|
|
7528
7554
|
tag: "condense",
|
|
7529
7555
|
attr: "val"
|
|
7530
7556
|
})
|
|
7531
7557
|
},
|
|
7532
|
-
|
|
7558
|
+
{
|
|
7559
|
+
tag: "extend",
|
|
7533
7560
|
prop: "extend",
|
|
7534
7561
|
xform: new BooleanXform({
|
|
7535
7562
|
tag: "extend",
|
|
7536
7563
|
attr: "val"
|
|
7537
7564
|
})
|
|
7538
7565
|
},
|
|
7539
|
-
|
|
7540
|
-
|
|
7541
|
-
|
|
7542
|
-
|
|
7566
|
+
{
|
|
7567
|
+
tag: "outline",
|
|
7568
|
+
prop: "outline",
|
|
7569
|
+
xform: new BooleanXform({
|
|
7570
|
+
tag: "outline",
|
|
7543
7571
|
attr: "val"
|
|
7544
7572
|
})
|
|
7545
7573
|
},
|
|
7546
|
-
|
|
7547
|
-
|
|
7574
|
+
{
|
|
7575
|
+
tag: "shadow",
|
|
7576
|
+
prop: "shadow",
|
|
7548
7577
|
xform: new BooleanXform({
|
|
7549
|
-
tag: "
|
|
7578
|
+
tag: "shadow",
|
|
7550
7579
|
attr: "val"
|
|
7551
7580
|
})
|
|
7552
7581
|
},
|
|
7553
|
-
|
|
7554
|
-
|
|
7555
|
-
|
|
7556
|
-
|
|
7582
|
+
{
|
|
7583
|
+
tag: "sz",
|
|
7584
|
+
prop: "size",
|
|
7585
|
+
xform: new IntegerXform({
|
|
7586
|
+
tag: "sz",
|
|
7557
7587
|
attr: "val"
|
|
7558
7588
|
})
|
|
7559
7589
|
},
|
|
7560
|
-
|
|
7561
|
-
|
|
7590
|
+
{
|
|
7591
|
+
tag: "color",
|
|
7592
|
+
prop: "color",
|
|
7593
|
+
xform: new ColorXform()
|
|
7594
|
+
},
|
|
7595
|
+
{
|
|
7596
|
+
tag: this.options.fontNameTag,
|
|
7597
|
+
prop: "name",
|
|
7562
7598
|
xform: new StringXform({
|
|
7563
|
-
tag:
|
|
7599
|
+
tag: this.options.fontNameTag,
|
|
7564
7600
|
attr: "val"
|
|
7565
7601
|
})
|
|
7566
7602
|
},
|
|
7567
|
-
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
|
|
7603
|
+
{
|
|
7604
|
+
tag: "family",
|
|
7605
|
+
prop: "family",
|
|
7606
|
+
xform: new IntegerXform({
|
|
7607
|
+
tag: "family",
|
|
7571
7608
|
attr: "val"
|
|
7572
7609
|
})
|
|
7573
7610
|
},
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
|
|
7611
|
+
{
|
|
7612
|
+
tag: "scheme",
|
|
7613
|
+
prop: "scheme",
|
|
7614
|
+
xform: new StringXform({
|
|
7615
|
+
tag: "scheme",
|
|
7578
7616
|
attr: "val"
|
|
7579
7617
|
})
|
|
7580
7618
|
},
|
|
7581
|
-
|
|
7582
|
-
|
|
7619
|
+
{
|
|
7620
|
+
tag: "charset",
|
|
7621
|
+
prop: "charset",
|
|
7583
7622
|
xform: new IntegerXform({
|
|
7584
|
-
tag: "
|
|
7623
|
+
tag: "charset",
|
|
7624
|
+
attr: "val"
|
|
7625
|
+
})
|
|
7626
|
+
},
|
|
7627
|
+
{
|
|
7628
|
+
tag: "vertAlign",
|
|
7629
|
+
prop: "vertAlign",
|
|
7630
|
+
xform: new StringXform({
|
|
7631
|
+
tag: "vertAlign",
|
|
7585
7632
|
attr: "val"
|
|
7586
7633
|
})
|
|
7587
7634
|
}
|
|
7588
|
-
|
|
7589
|
-
this.map
|
|
7590
|
-
prop:
|
|
7591
|
-
xform:
|
|
7592
|
-
|
|
7593
|
-
|
|
7594
|
-
})
|
|
7595
|
-
};
|
|
7635
|
+
];
|
|
7636
|
+
this.map = Object.fromEntries(fontProperties.map((p) => [p.tag, {
|
|
7637
|
+
prop: p.prop,
|
|
7638
|
+
xform: p.xform
|
|
7639
|
+
}]));
|
|
7640
|
+
this.renderOrder = fontProperties.map((p) => p.tag);
|
|
7596
7641
|
}
|
|
7597
7642
|
get tag() {
|
|
7598
7643
|
return this.options.tagName;
|
|
7599
7644
|
}
|
|
7600
7645
|
render(xmlStream, model) {
|
|
7601
|
-
const { map } = this;
|
|
7646
|
+
const { map, renderOrder } = this;
|
|
7602
7647
|
xmlStream.openNode(this.options.tagName);
|
|
7603
|
-
|
|
7604
|
-
map[tag].xform.render(xmlStream, model[
|
|
7648
|
+
renderOrder.forEach((tag) => {
|
|
7649
|
+
map[tag].xform.render(xmlStream, model[map[tag].prop]);
|
|
7605
7650
|
});
|
|
7606
7651
|
xmlStream.closeNode();
|
|
7607
7652
|
}
|
|
@@ -9680,10 +9725,6 @@ var ExcelTS = (function(exports) {
|
|
|
9680
9725
|
PartName: `/xl/pivotCache/pivotCacheRecords${n}.xml`,
|
|
9681
9726
|
ContentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml"
|
|
9682
9727
|
});
|
|
9683
|
-
xmlStream.leafNode("Override", {
|
|
9684
|
-
PartName: `/xl/pivotTables/pivotTable${n}.xml`,
|
|
9685
|
-
ContentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml"
|
|
9686
|
-
});
|
|
9687
9728
|
});
|
|
9688
9729
|
xmlStream.leafNode("Override", {
|
|
9689
9730
|
PartName: "/xl/theme/theme1.xml",
|
|
@@ -9703,13 +9744,20 @@ var ExcelTS = (function(exports) {
|
|
|
9703
9744
|
ContentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml"
|
|
9704
9745
|
});
|
|
9705
9746
|
});
|
|
9747
|
+
if ((model.pivotTables || []).length) (model.pivotTables || []).forEach((pivotTable) => {
|
|
9748
|
+
const n = pivotTable.tableNumber;
|
|
9749
|
+
xmlStream.leafNode("Override", {
|
|
9750
|
+
PartName: `/xl/pivotTables/pivotTable${n}.xml`,
|
|
9751
|
+
ContentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml"
|
|
9752
|
+
});
|
|
9753
|
+
});
|
|
9706
9754
|
if (model.drawings) model.drawings.forEach((drawing) => {
|
|
9707
9755
|
xmlStream.leafNode("Override", {
|
|
9708
9756
|
PartName: `/xl/drawings/${drawing.name}.xml`,
|
|
9709
9757
|
ContentType: "application/vnd.openxmlformats-officedocument.drawing+xml"
|
|
9710
9758
|
});
|
|
9711
9759
|
});
|
|
9712
|
-
if (model.commentRefs) {
|
|
9760
|
+
if (model.commentRefs && model.commentRefs.length) {
|
|
9713
9761
|
xmlStream.leafNode("Default", {
|
|
9714
9762
|
Extension: "vml",
|
|
9715
9763
|
ContentType: "application/vnd.openxmlformats-officedocument.vmlDrawing"
|
|
@@ -9958,9 +10006,9 @@ var ExcelTS = (function(exports) {
|
|
|
9958
10006
|
var WorksheetXform = class extends BaseXform {
|
|
9959
10007
|
render(xmlStream, model) {
|
|
9960
10008
|
xmlStream.leafNode("sheet", {
|
|
9961
|
-
sheetId: model.id,
|
|
9962
10009
|
name: model.name,
|
|
9963
|
-
|
|
10010
|
+
sheetId: model.id,
|
|
10011
|
+
state: model.state === "visible" ? void 0 : model.state,
|
|
9964
10012
|
"r:id": model.rId
|
|
9965
10013
|
});
|
|
9966
10014
|
}
|
|
@@ -10030,7 +10078,6 @@ var ExcelTS = (function(exports) {
|
|
|
10030
10078
|
render(xmlStream, model) {
|
|
10031
10079
|
xmlStream.leafNode("workbookPr", {
|
|
10032
10080
|
date1904: model.date1904 ? 1 : void 0,
|
|
10033
|
-
defaultThemeVersion: 164011,
|
|
10034
10081
|
filterPrivacy: 1
|
|
10035
10082
|
});
|
|
10036
10083
|
}
|
|
@@ -10727,7 +10774,6 @@ var ExcelTS = (function(exports) {
|
|
|
10727
10774
|
xmlStream.addAttribute("s", model.styleId);
|
|
10728
10775
|
xmlStream.addAttribute("customFormat", "1");
|
|
10729
10776
|
}
|
|
10730
|
-
xmlStream.addAttribute("x14ac:dyDescent", "0.25");
|
|
10731
10777
|
if (model.outlineLevel) xmlStream.addAttribute("outlineLevel", model.outlineLevel);
|
|
10732
10778
|
if (model.collapsed) xmlStream.addAttribute("collapsed", "1");
|
|
10733
10779
|
const cellXform = this.map.c;
|
|
@@ -11260,9 +11306,9 @@ var ExcelTS = (function(exports) {
|
|
|
11260
11306
|
if (model) {
|
|
11261
11307
|
const attributes = {
|
|
11262
11308
|
defaultRowHeight: model.defaultRowHeight,
|
|
11263
|
-
outlineLevelRow: model.outlineLevelRow,
|
|
11264
|
-
outlineLevelCol: model.outlineLevelCol,
|
|
11265
|
-
"x14ac:dyDescent": model.dyDescent
|
|
11309
|
+
outlineLevelRow: model.outlineLevelRow || void 0,
|
|
11310
|
+
outlineLevelCol: model.outlineLevelCol || void 0,
|
|
11311
|
+
"x14ac:dyDescent": model.dyDescent || void 0
|
|
11266
11312
|
};
|
|
11267
11313
|
if (model.defaultColWidth) attributes.defaultColWidth = model.defaultColWidth;
|
|
11268
11314
|
if (!model.defaultRowHeight || model.defaultRowHeight !== 15) attributes.customHeight = "1";
|
|
@@ -11309,12 +11355,14 @@ var ExcelTS = (function(exports) {
|
|
|
11309
11355
|
}
|
|
11310
11356
|
}
|
|
11311
11357
|
render(xmlStream, model) {
|
|
11312
|
-
|
|
11358
|
+
const initialAttrs = {};
|
|
11359
|
+
if (model.tabSelected) initialAttrs.tabSelected = "1";
|
|
11360
|
+
initialAttrs.workbookViewId = model.workbookViewId || 0;
|
|
11361
|
+
xmlStream.openNode("sheetView", initialAttrs);
|
|
11313
11362
|
const add = function(name, value, included) {
|
|
11314
11363
|
if (included) xmlStream.addAttribute(name, value);
|
|
11315
11364
|
};
|
|
11316
11365
|
add("rightToLeft", "1", model.rightToLeft === true);
|
|
11317
|
-
add("tabSelected", "1", model.tabSelected);
|
|
11318
11366
|
add("showRuler", "0", model.showRuler === false);
|
|
11319
11367
|
add("showRowColHeaders", "0", model.showRowColHeaders === false);
|
|
11320
11368
|
add("showGridLines", "0", model.showGridLines === false);
|
|
@@ -11614,9 +11662,9 @@ var ExcelTS = (function(exports) {
|
|
|
11614
11662
|
draft: booleanToXml$1(model.draft),
|
|
11615
11663
|
cellComments: cellCommentsToXml(model.cellComments),
|
|
11616
11664
|
errors: errorsToXml(model.errors),
|
|
11617
|
-
scale: model.scale,
|
|
11618
|
-
fitToWidth: model.fitToWidth,
|
|
11619
|
-
fitToHeight: model.fitToHeight,
|
|
11665
|
+
scale: model.scale !== 100 ? model.scale : void 0,
|
|
11666
|
+
fitToWidth: model.fitToWidth !== 1 ? model.fitToWidth : void 0,
|
|
11667
|
+
fitToHeight: model.fitToHeight !== 1 ? model.fitToHeight : void 0,
|
|
11620
11668
|
firstPageNumber: model.firstPageNumber,
|
|
11621
11669
|
useFirstPageNumber: booleanToXml$1(!!model.firstPageNumber),
|
|
11622
11670
|
usePrinterDefaults: booleanToXml$1(model.usePrinterDefaults),
|
|
@@ -13008,8 +13056,8 @@ var ExcelTS = (function(exports) {
|
|
|
13008
13056
|
xmlns: "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
|
|
13009
13057
|
"xmlns:r": "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
|
|
13010
13058
|
"xmlns:mc": "http://schemas.openxmlformats.org/markup-compatibility/2006",
|
|
13011
|
-
"
|
|
13012
|
-
"
|
|
13059
|
+
"xmlns:x14ac": "http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac",
|
|
13060
|
+
"mc:Ignorable": "x14ac"
|
|
13013
13061
|
};
|
|
13014
13062
|
}
|
|
13015
13063
|
constructor(options) {
|
|
@@ -14276,7 +14324,7 @@ var ExcelTS = (function(exports) {
|
|
|
14276
14324
|
id: model.id.toString(),
|
|
14277
14325
|
name: model.name,
|
|
14278
14326
|
totalsRowLabel: model.totalsRowLabel,
|
|
14279
|
-
totalsRowFunction: model.totalsRowFunction,
|
|
14327
|
+
totalsRowFunction: model.totalsRowFunction === "none" ? void 0 : model.totalsRowFunction,
|
|
14280
14328
|
dxfId: model.dxfId
|
|
14281
14329
|
});
|
|
14282
14330
|
}
|
|
@@ -14382,8 +14430,7 @@ var ExcelTS = (function(exports) {
|
|
|
14382
14430
|
displayName: model.displayName || model.name,
|
|
14383
14431
|
ref: model.tableRef,
|
|
14384
14432
|
totalsRowCount: model.totalsRow ? "1" : void 0,
|
|
14385
|
-
|
|
14386
|
-
headerRowCount: model.headerRow ? "1" : "0"
|
|
14433
|
+
headerRowCount: model.headerRow ? void 0 : "0"
|
|
14387
14434
|
});
|
|
14388
14435
|
this.map.autoFilter.render(xmlStream, model);
|
|
14389
14436
|
this.map.tableColumns.render(xmlStream, model.columns);
|
|
@@ -14404,7 +14451,7 @@ var ExcelTS = (function(exports) {
|
|
|
14404
14451
|
displayName: attributes.displayName || attributes.name,
|
|
14405
14452
|
tableRef: attributes.ref,
|
|
14406
14453
|
totalsRow: attributes.totalsRowCount === "1",
|
|
14407
|
-
headerRow: attributes.headerRowCount
|
|
14454
|
+
headerRow: attributes.headerRowCount !== "0"
|
|
14408
14455
|
};
|
|
14409
14456
|
break;
|
|
14410
14457
|
default:
|
|
@@ -14444,13 +14491,7 @@ var ExcelTS = (function(exports) {
|
|
|
14444
14491
|
});
|
|
14445
14492
|
}
|
|
14446
14493
|
static {
|
|
14447
|
-
this.TABLE_ATTRIBUTES = {
|
|
14448
|
-
xmlns: "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
|
|
14449
|
-
"xmlns:mc": "http://schemas.openxmlformats.org/markup-compatibility/2006",
|
|
14450
|
-
"mc:Ignorable": "xr xr3",
|
|
14451
|
-
"xmlns:xr": "http://schemas.microsoft.com/office/spreadsheetml/2014/revision",
|
|
14452
|
-
"xmlns:xr3": "http://schemas.microsoft.com/office/spreadsheetml/2016/revision3"
|
|
14453
|
-
};
|
|
14494
|
+
this.TABLE_ATTRIBUTES = { xmlns: "http://schemas.openxmlformats.org/spreadsheetml/2006/main" };
|
|
14454
14495
|
}
|
|
14455
14496
|
};
|
|
14456
14497
|
|
|
@@ -14634,14 +14675,16 @@ var ExcelTS = (function(exports) {
|
|
|
14634
14675
|
//#endregion
|
|
14635
14676
|
//#region src/xlsx/xform/pivot-table/cache-field.ts
|
|
14636
14677
|
var CacheField = class {
|
|
14637
|
-
constructor({ name, sharedItems }) {
|
|
14678
|
+
constructor({ name, sharedItems, minValue, maxValue }) {
|
|
14638
14679
|
this.name = name;
|
|
14639
14680
|
this.sharedItems = sharedItems;
|
|
14681
|
+
this.minValue = minValue;
|
|
14682
|
+
this.maxValue = maxValue;
|
|
14640
14683
|
}
|
|
14641
14684
|
render() {
|
|
14642
14685
|
const escapedName = xmlEncode(this.name);
|
|
14643
14686
|
if (this.sharedItems === null) return `<cacheField name="${escapedName}" numFmtId="0">
|
|
14644
|
-
<sharedItems containsSemiMixedTypes="0" containsString="0" containsNumber="1" containsInteger="1" />
|
|
14687
|
+
<sharedItems containsSemiMixedTypes="0" containsString="0" containsNumber="1" containsInteger="1"${this.minValue !== void 0 && this.maxValue !== void 0 ? ` minValue="${this.minValue}" maxValue="${this.maxValue}"` : ""} />
|
|
14645
14688
|
</cacheField>`;
|
|
14646
14689
|
return `<cacheField name="${escapedName}" numFmtId="0">
|
|
14647
14690
|
<sharedItems count="${this.sharedItems.length}">
|
|
@@ -14796,8 +14839,6 @@ var ExcelTS = (function(exports) {
|
|
|
14796
14839
|
...PivotCacheDefinitionXform.PIVOT_CACHE_DEFINITION_ATTRIBUTES,
|
|
14797
14840
|
"r:id": "rId1",
|
|
14798
14841
|
refreshOnLoad: "1",
|
|
14799
|
-
refreshedBy: "Author",
|
|
14800
|
-
refreshedDate: "45125.026046874998",
|
|
14801
14842
|
createdVersion: "8",
|
|
14802
14843
|
refreshedVersion: "8",
|
|
14803
14844
|
minRefreshableVersion: "3",
|
|
@@ -14824,8 +14865,6 @@ var ExcelTS = (function(exports) {
|
|
|
14824
14865
|
...PivotCacheDefinitionXform.PIVOT_CACHE_DEFINITION_ATTRIBUTES,
|
|
14825
14866
|
"r:id": model.rId || "rId1",
|
|
14826
14867
|
refreshOnLoad: model.refreshOnLoad || "1",
|
|
14827
|
-
refreshedBy: model.refreshedBy || "Author",
|
|
14828
|
-
refreshedDate: model.refreshedDate || "45125.026046874998",
|
|
14829
14868
|
createdVersion: model.createdVersion || "8",
|
|
14830
14869
|
refreshedVersion: model.refreshedVersion || "8",
|
|
14831
14870
|
minRefreshableVersion: model.minRefreshableVersion || "3",
|
|
@@ -14855,8 +14894,6 @@ var ExcelTS = (function(exports) {
|
|
|
14855
14894
|
cacheFields: [],
|
|
14856
14895
|
rId: attributes["r:id"],
|
|
14857
14896
|
refreshOnLoad: attributes.refreshOnLoad,
|
|
14858
|
-
refreshedBy: attributes.refreshedBy,
|
|
14859
|
-
refreshedDate: attributes.refreshedDate,
|
|
14860
14897
|
createdVersion: attributes.createdVersion,
|
|
14861
14898
|
refreshedVersion: attributes.refreshedVersion,
|
|
14862
14899
|
minRefreshableVersion: attributes.minRefreshableVersion,
|
|
@@ -14911,10 +14948,7 @@ var ExcelTS = (function(exports) {
|
|
|
14911
14948
|
static {
|
|
14912
14949
|
this.PIVOT_CACHE_DEFINITION_ATTRIBUTES = {
|
|
14913
14950
|
xmlns: "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
|
|
14914
|
-
"xmlns:r": "http://schemas.openxmlformats.org/officeDocument/2006/relationships"
|
|
14915
|
-
"xmlns:mc": "http://schemas.openxmlformats.org/markup-compatibility/2006",
|
|
14916
|
-
"mc:Ignorable": "xr",
|
|
14917
|
-
"xmlns:xr": "http://schemas.microsoft.com/office/spreadsheetml/2014/revision"
|
|
14951
|
+
"xmlns:r": "http://schemas.openxmlformats.org/officeDocument/2006/relationships"
|
|
14918
14952
|
};
|
|
14919
14953
|
}
|
|
14920
14954
|
};
|
|
@@ -14967,18 +15001,16 @@ var ExcelTS = (function(exports) {
|
|
|
14967
15001
|
*/
|
|
14968
15002
|
renderNew(xmlStream, model) {
|
|
14969
15003
|
const { rows, columns, values, cacheFields, cacheId, applyWidthHeightFormats } = model;
|
|
14970
|
-
const uniqueUid = `{${crypto.randomUUID().toUpperCase()}}`;
|
|
14971
15004
|
const rowItems = buildRowItems(rows, cacheFields);
|
|
14972
15005
|
const colItems = buildColItems(columns, cacheFields, values.length);
|
|
14973
15006
|
const rowFieldItemCount = rows.length > 0 ? cacheFields[rows[0]]?.sharedItems?.length || 0 : 0;
|
|
14974
15007
|
const colFieldItemCount = columns.length > 0 ? cacheFields[columns[0]]?.sharedItems?.length || 0 : 0;
|
|
14975
|
-
const endRow =
|
|
15008
|
+
const endRow = 4 + rowFieldItemCount + 1;
|
|
14976
15009
|
const endCol = 1 + colFieldItemCount + 1;
|
|
14977
15010
|
const locationRef = `A3:${String.fromCharCode(64 + endCol)}${endRow}`;
|
|
14978
15011
|
xmlStream.openXml(XmlStream.StdDocAttributes);
|
|
14979
15012
|
xmlStream.openNode(this.tag, {
|
|
14980
15013
|
...PivotTableXform.PIVOT_TABLE_ATTRIBUTES,
|
|
14981
|
-
"xr:uid": uniqueUid,
|
|
14982
15014
|
name: "PivotTable2",
|
|
14983
15015
|
cacheId,
|
|
14984
15016
|
applyNumberFormats: "0",
|
|
@@ -15053,11 +15085,9 @@ var ExcelTS = (function(exports) {
|
|
|
15053
15085
|
* Render loaded pivot table (preserving original structure)
|
|
15054
15086
|
*/
|
|
15055
15087
|
renderLoaded(xmlStream, model) {
|
|
15056
|
-
const uniqueUid = model.uid || `{${crypto.randomUUID().toUpperCase()}}`;
|
|
15057
15088
|
xmlStream.openXml(XmlStream.StdDocAttributes);
|
|
15058
15089
|
xmlStream.openNode(this.tag, {
|
|
15059
15090
|
...PivotTableXform.PIVOT_TABLE_ATTRIBUTES,
|
|
15060
|
-
"xr:uid": uniqueUid,
|
|
15061
15091
|
name: model.name || "PivotTable1",
|
|
15062
15092
|
cacheId: model.cacheId,
|
|
15063
15093
|
applyNumberFormats: model.applyNumberFormats || "0",
|
|
@@ -15306,19 +15336,15 @@ var ExcelTS = (function(exports) {
|
|
|
15306
15336
|
}
|
|
15307
15337
|
reconcile(_model, _options) {}
|
|
15308
15338
|
static {
|
|
15309
|
-
this.PIVOT_TABLE_ATTRIBUTES = {
|
|
15310
|
-
xmlns: "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
|
|
15311
|
-
"xmlns:mc": "http://schemas.openxmlformats.org/markup-compatibility/2006",
|
|
15312
|
-
"mc:Ignorable": "xr",
|
|
15313
|
-
"xmlns:xr": "http://schemas.microsoft.com/office/spreadsheetml/2014/revision"
|
|
15314
|
-
};
|
|
15339
|
+
this.PIVOT_TABLE_ATTRIBUTES = { xmlns: "http://schemas.openxmlformats.org/spreadsheetml/2006/main" };
|
|
15315
15340
|
}
|
|
15316
15341
|
};
|
|
15317
15342
|
/**
|
|
15318
15343
|
* Build rowItems XML - one item for each unique value in row fields, plus grand total.
|
|
15319
15344
|
* Each <i> represents a row in the pivot table.
|
|
15320
|
-
* - Regular items: <i><x v="index"/></i>
|
|
15345
|
+
* - Regular items: <i><x/></i> for index 0, <i><x v="index"/></i> for index > 0
|
|
15321
15346
|
* - Grand total: <i t="grand"><x/></i>
|
|
15347
|
+
* Note: When v=0, the v attribute should be omitted (Excel convention)
|
|
15322
15348
|
*/
|
|
15323
15349
|
function buildRowItems(rows, cacheFields) {
|
|
15324
15350
|
if (rows.length === 0) return {
|
|
@@ -15327,7 +15353,8 @@ var ExcelTS = (function(exports) {
|
|
|
15327
15353
|
};
|
|
15328
15354
|
const itemCount = (cacheFields[rows[0]]?.sharedItems || []).length;
|
|
15329
15355
|
const items = [];
|
|
15330
|
-
for (let i = 0; i < itemCount; i++) items.push(
|
|
15356
|
+
for (let i = 0; i < itemCount; i++) if (i === 0) items.push("<i><x /></i>");
|
|
15357
|
+
else items.push(`<i><x v="${i}" /></i>`);
|
|
15331
15358
|
items.push("<i t=\"grand\"><x /></i>");
|
|
15332
15359
|
return {
|
|
15333
15360
|
count: items.length,
|
|
@@ -15337,12 +15364,14 @@ var ExcelTS = (function(exports) {
|
|
|
15337
15364
|
/**
|
|
15338
15365
|
* Build colItems XML - one item for each unique value in column fields, plus grand total.
|
|
15339
15366
|
* When there are multiple data fields (values), each column value may have sub-columns.
|
|
15367
|
+
* Note: When v=0, the v attribute should be omitted (Excel convention)
|
|
15340
15368
|
*/
|
|
15341
15369
|
function buildColItems(columns, cacheFields, valueCount) {
|
|
15342
15370
|
if (columns.length === 0) {
|
|
15343
15371
|
if (valueCount > 1) {
|
|
15344
15372
|
const items$1 = [];
|
|
15345
|
-
for (let i = 0; i < valueCount; i++) items$1.push(
|
|
15373
|
+
for (let i = 0; i < valueCount; i++) if (i === 0) items$1.push("<i><x /></i>");
|
|
15374
|
+
else items$1.push(`<i><x v="${i}" /></i>`);
|
|
15346
15375
|
items$1.push("<i t=\"grand\"><x /></i>");
|
|
15347
15376
|
return {
|
|
15348
15377
|
count: items$1.length,
|
|
@@ -15356,7 +15385,8 @@ var ExcelTS = (function(exports) {
|
|
|
15356
15385
|
}
|
|
15357
15386
|
const itemCount = (cacheFields[columns[0]]?.sharedItems || []).length;
|
|
15358
15387
|
const items = [];
|
|
15359
|
-
for (let i = 0; i < itemCount; i++) items.push(
|
|
15388
|
+
for (let i = 0; i < itemCount; i++) if (i === 0) items.push("<i><x /></i>");
|
|
15389
|
+
else items.push(`<i><x v="${i}" /></i>`);
|
|
15360
15390
|
items.push("<i t=\"grand\"><x /></i>");
|
|
15361
15391
|
return {
|
|
15362
15392
|
count: items.length,
|
|
@@ -15386,12 +15416,12 @@ var ExcelTS = (function(exports) {
|
|
|
15386
15416
|
}).join("");
|
|
15387
15417
|
}
|
|
15388
15418
|
function renderPivotField(fieldType, sharedItems) {
|
|
15389
|
-
const defaultAttributes = "compact=\"0\" outline=\"0\" showAll=\"0\" defaultSubtotal=\"0\"";
|
|
15390
15419
|
if (fieldType === "row" || fieldType === "column") {
|
|
15391
15420
|
const axis = fieldType === "row" ? "axisRow" : "axisCol";
|
|
15421
|
+
const axisAttributes = "compact=\"0\" outline=\"0\" showAll=\"0\"";
|
|
15392
15422
|
const itemsXml = [...sharedItems.map((_item, index) => `<item x="${index}" />`), "<item t=\"default\" />"].join("\n ");
|
|
15393
15423
|
return `
|
|
15394
|
-
<pivotField axis="${axis}" ${
|
|
15424
|
+
<pivotField axis="${axis}" ${axisAttributes}>
|
|
15395
15425
|
<items count="${sharedItems.length + 1}">
|
|
15396
15426
|
${itemsXml}
|
|
15397
15427
|
</items>
|
|
@@ -15401,7 +15431,7 @@ var ExcelTS = (function(exports) {
|
|
|
15401
15431
|
return `
|
|
15402
15432
|
<pivotField
|
|
15403
15433
|
${fieldType === "value" ? "dataField=\"1\"" : ""}
|
|
15404
|
-
|
|
15434
|
+
compact="0" outline="0" showAll="0" defaultSubtotal="0"
|
|
15405
15435
|
/>
|
|
15406
15436
|
`;
|
|
15407
15437
|
}
|