@rowsncolumns/toolkit 24.4.2 → 24.4.3
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/cjs/excel-parser/cfb-decryptor.d.ts +6 -0
- package/dist/cjs/excel-parser/cfb-decryptor.d.ts.map +1 -1
- package/dist/cjs/excel-parser/cfb-decryptor.js +6 -0
- package/dist/cjs/excel-parser/helpers.d.ts +9 -1
- package/dist/cjs/excel-parser/helpers.d.ts.map +1 -1
- package/dist/cjs/excel-parser/helpers.js +37 -0
- package/dist/cjs/excel-parser/interface.d.ts +10 -1
- package/dist/cjs/excel-parser/interface.d.ts.map +1 -1
- package/dist/cjs/excel-parser/plugins/ods/index.d.ts +19 -0
- package/dist/cjs/excel-parser/plugins/ods/index.d.ts.map +1 -1
- package/dist/cjs/excel-parser/plugins/ods/index.js +676 -304
- package/dist/cjs/excel-parser/plugins/ods/styles.d.ts +43 -1
- package/dist/cjs/excel-parser/plugins/ods/styles.d.ts.map +1 -1
- package/dist/cjs/excel-parser/plugins/ods/styles.js +343 -45
- package/dist/cjs/excel-parser/plugins/xls/index.d.ts +11 -3
- package/dist/cjs/excel-parser/plugins/xls/index.d.ts.map +1 -1
- package/dist/cjs/excel-parser/plugins/xls/index.js +55 -6
- package/dist/cjs/excel-parser/plugins/xlsb/index.d.ts +4 -0
- package/dist/cjs/excel-parser/plugins/xlsb/index.d.ts.map +1 -1
- package/dist/cjs/excel-parser/plugins/xlsb/index.js +21 -9
- package/dist/cjs/excel-parser/plugins/xlsx/charts.d.ts +10 -0
- package/dist/cjs/excel-parser/plugins/xlsx/charts.d.ts.map +1 -1
- package/dist/cjs/excel-parser/plugins/xlsx/charts.js +68 -9
- package/dist/cjs/excel-parser/plugins/xlsx/drawing.d.ts +28 -1
- package/dist/cjs/excel-parser/plugins/xlsx/drawing.d.ts.map +1 -1
- package/dist/cjs/excel-parser/plugins/xlsx/drawing.js +155 -20
- package/dist/cjs/excel-parser/plugins/xlsx/index.d.ts +26 -1
- package/dist/cjs/excel-parser/plugins/xlsx/index.d.ts.map +1 -1
- package/dist/cjs/excel-parser/plugins/xlsx/index.js +567 -234
- package/dist/cjs/excel-parser/plugins/xlsx/pivots.d.ts.map +1 -1
- package/dist/cjs/excel-parser/plugins/xlsx/pivots.js +125 -37
- package/dist/cjs/excel-parser/plugins/xlsx/sheet-views.d.ts +3 -0
- package/dist/cjs/excel-parser/plugins/xlsx/sheet-views.d.ts.map +1 -1
- package/dist/cjs/excel-parser/plugins/xlsx/sheet-views.js +4 -1
- package/dist/cjs/excel-parser/plugins/xlsx/styles.d.ts.map +1 -1
- package/dist/cjs/excel-parser/plugins/xlsx/styles.js +12 -2
- package/dist/cjs/excel-parser/registry.d.ts.map +1 -1
- package/dist/cjs/excel-parser/registry.js +2 -0
- package/dist/cjs/excel-parser/types.d.ts +7 -1
- package/dist/cjs/excel-parser/types.d.ts.map +1 -1
- package/dist/cjs/excel-parser/workbook.d.ts +1 -0
- package/dist/cjs/excel-parser/workbook.d.ts.map +1 -1
- package/dist/cjs/excel-parser/workbook.js +4 -0
- package/dist/cjs/excel-parser/worker.js +3 -1
- package/dist/cjs/exporter/ods/ods-export.d.ts.map +1 -1
- package/dist/cjs/exporter/ods/ods-export.js +432 -175
- package/dist/cjs/exporter/xlsx/chart-builder.d.ts.map +1 -1
- package/dist/cjs/exporter/xlsx/chart-builder.js +210 -6
- package/dist/cjs/exporter/xlsx/pivot-builder.d.ts +8 -0
- package/dist/cjs/exporter/xlsx/pivot-builder.d.ts.map +1 -1
- package/dist/cjs/exporter/xlsx/pivot-builder.js +141 -42
- package/dist/cjs/exporter/xlsx/style-builder.js +9 -3
- package/dist/cjs/exporter/xlsx/threaded-comments-builder.d.ts +7 -1
- package/dist/cjs/exporter/xlsx/threaded-comments-builder.d.ts.map +1 -1
- package/dist/cjs/exporter/xlsx/threaded-comments-builder.js +15 -3
- package/dist/cjs/exporter/xlsx/xlsx-export.d.ts +11 -2
- package/dist/cjs/exporter/xlsx/xlsx-export.d.ts.map +1 -1
- package/dist/cjs/exporter/xlsx/xlsx-export.js +678 -222
- package/dist/cjs/helpers/implicit-intersection.d.ts +16 -0
- package/dist/cjs/helpers/implicit-intersection.d.ts.map +1 -0
- package/dist/cjs/helpers/implicit-intersection.js +197 -0
- package/dist/cjs/print-settings.d.ts +105 -0
- package/dist/cjs/print-settings.d.ts.map +1 -0
- package/dist/cjs/print-settings.js +494 -0
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/excel-parser/cfb-decryptor.d.ts +6 -0
- package/dist/esm/excel-parser/cfb-decryptor.d.ts.map +1 -1
- package/dist/esm/excel-parser/cfb-decryptor.js +6 -0
- package/dist/esm/excel-parser/helpers.d.ts +9 -1
- package/dist/esm/excel-parser/helpers.d.ts.map +1 -1
- package/dist/esm/excel-parser/helpers.js +34 -0
- package/dist/esm/excel-parser/interface.d.ts +10 -1
- package/dist/esm/excel-parser/interface.d.ts.map +1 -1
- package/dist/esm/excel-parser/plugins/ods/index.d.ts +19 -0
- package/dist/esm/excel-parser/plugins/ods/index.d.ts.map +1 -1
- package/dist/esm/excel-parser/plugins/ods/index.js +347 -33
- package/dist/esm/excel-parser/plugins/ods/styles.d.ts +43 -1
- package/dist/esm/excel-parser/plugins/ods/styles.d.ts.map +1 -1
- package/dist/esm/excel-parser/plugins/ods/styles.js +276 -2
- package/dist/esm/excel-parser/plugins/xls/index.d.ts +11 -3
- package/dist/esm/excel-parser/plugins/xls/index.d.ts.map +1 -1
- package/dist/esm/excel-parser/plugins/xls/index.js +37 -5
- package/dist/esm/excel-parser/plugins/xlsb/index.d.ts +4 -0
- package/dist/esm/excel-parser/plugins/xlsb/index.d.ts.map +1 -1
- package/dist/esm/excel-parser/plugins/xlsb/index.js +20 -6
- package/dist/esm/excel-parser/plugins/xlsx/charts.d.ts +10 -0
- package/dist/esm/excel-parser/plugins/xlsx/charts.d.ts.map +1 -1
- package/dist/esm/excel-parser/plugins/xlsx/charts.js +69 -6
- package/dist/esm/excel-parser/plugins/xlsx/drawing.d.ts +28 -1
- package/dist/esm/excel-parser/plugins/xlsx/drawing.d.ts.map +1 -1
- package/dist/esm/excel-parser/plugins/xlsx/drawing.js +99 -0
- package/dist/esm/excel-parser/plugins/xlsx/index.d.ts +26 -1
- package/dist/esm/excel-parser/plugins/xlsx/index.d.ts.map +1 -1
- package/dist/esm/excel-parser/plugins/xlsx/index.js +362 -26
- package/dist/esm/excel-parser/plugins/xlsx/pivots.d.ts.map +1 -1
- package/dist/esm/excel-parser/plugins/xlsx/pivots.js +86 -6
- package/dist/esm/excel-parser/plugins/xlsx/sheet-views.d.ts +3 -0
- package/dist/esm/excel-parser/plugins/xlsx/sheet-views.d.ts.map +1 -1
- package/dist/esm/excel-parser/plugins/xlsx/sheet-views.js +2 -0
- package/dist/esm/excel-parser/plugins/xlsx/styles.d.ts.map +1 -1
- package/dist/esm/excel-parser/plugins/xlsx/styles.js +12 -2
- package/dist/esm/excel-parser/registry.d.ts.map +1 -1
- package/dist/esm/excel-parser/registry.js +2 -0
- package/dist/esm/excel-parser/types.d.ts +7 -1
- package/dist/esm/excel-parser/types.d.ts.map +1 -1
- package/dist/esm/excel-parser/workbook.d.ts +1 -0
- package/dist/esm/excel-parser/workbook.d.ts.map +1 -1
- package/dist/esm/excel-parser/workbook.js +3 -0
- package/dist/esm/excel-parser/worker.js +2 -0
- package/dist/esm/exporter/ods/ods-export.d.ts.map +1 -1
- package/dist/esm/exporter/ods/ods-export.js +306 -35
- package/dist/esm/exporter/xlsx/chart-builder.d.ts.map +1 -1
- package/dist/esm/exporter/xlsx/chart-builder.js +161 -0
- package/dist/esm/exporter/xlsx/pivot-builder.d.ts +8 -0
- package/dist/esm/exporter/xlsx/pivot-builder.d.ts.map +1 -1
- package/dist/esm/exporter/xlsx/pivot-builder.js +104 -19
- package/dist/esm/exporter/xlsx/style-builder.js +9 -3
- package/dist/esm/exporter/xlsx/threaded-comments-builder.d.ts +7 -1
- package/dist/esm/exporter/xlsx/threaded-comments-builder.d.ts.map +1 -1
- package/dist/esm/exporter/xlsx/threaded-comments-builder.js +15 -3
- package/dist/esm/exporter/xlsx/xlsx-export.d.ts +11 -2
- package/dist/esm/exporter/xlsx/xlsx-export.d.ts.map +1 -1
- package/dist/esm/exporter/xlsx/xlsx-export.js +449 -47
- package/dist/esm/helpers/implicit-intersection.d.ts +16 -0
- package/dist/esm/helpers/implicit-intersection.d.ts.map +1 -0
- package/dist/esm/helpers/implicit-intersection.js +184 -0
- package/dist/esm/print-settings.d.ts +105 -0
- package/dist/esm/print-settings.d.ts.map +1 -0
- package/dist/esm/print-settings.js +422 -0
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-builder.d.ts","sourceRoot":"","sources":["../../../../exporter/xlsx/chart-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,aAAa,EAEd,MAAM,2BAA2B,CAAC;AAovCnC,eAAO,MAAM,aAAa,GACxB,OAAO,aAAa,EACpB,eAAe,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,KACjC,MAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"chart-builder.d.ts","sourceRoot":"","sources":["../../../../exporter/xlsx/chart-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,aAAa,EAEd,MAAM,2BAA2B,CAAC;AAovCnC,eAAO,MAAM,aAAa,GACxB,OAAO,aAAa,EACpB,eAAe,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,KACjC,MAAM,GAAG,SAgoBX,CAAC"}
|
|
@@ -1565,6 +1565,12 @@ export var buildChartXml = function (chart, sheetNameById) {
|
|
|
1565
1565
|
// chartType-agnostic and intentionally run last so per-type branches
|
|
1566
1566
|
// don't have to know about them.
|
|
1567
1567
|
applyChartFormatting(chartSpace, chart.spec, sheetNameById);
|
|
1568
|
+
// 3-D / surface variants (sourceChartType BAR_3D, LINE_3D, PIE_3D,
|
|
1569
|
+
// AREA_3D, SURFACE, SURFACE_3D) — swap the 2-D chart group for its
|
|
1570
|
+
// OOXML 3-D element and add `<c:view3D>`. Runs after the formatting
|
|
1571
|
+
// pass so data labels / overlays land in the container first and are
|
|
1572
|
+
// carried across by the rename.
|
|
1573
|
+
applyThreeDChartType(chartSpace["c:chartSpace"]["c:chart"], chart.spec.sourceChartType);
|
|
1568
1574
|
// `<c:roundedCorners val="1"/>` lives at the chartSpace root (sibling
|
|
1569
1575
|
// of `<c:chart>`). Default per OOXML §21.2.2.183 is `false`; only
|
|
1570
1576
|
// emit when the spec opted in so files imported without the element
|
|
@@ -1575,6 +1581,204 @@ export var buildChartXml = function (chart, sheetNameById) {
|
|
|
1575
1581
|
var xml = chartBuilder.build(chartSpace);
|
|
1576
1582
|
return "".concat(XML_DECLARATION).concat(xml);
|
|
1577
1583
|
};
|
|
1584
|
+
// -------------------------- 3-D / surface --------------------------
|
|
1585
|
+
/** Series-axis id for the 3-D chart groups that take a third axis. */
|
|
1586
|
+
var SER_AX_ID = "1789284465";
|
|
1587
|
+
/**
|
|
1588
|
+
* How each 3-D class maps onto its 2-D chart group: which container it
|
|
1589
|
+
* replaces, the element it becomes, and how many `<c:axId>` refs the
|
|
1590
|
+
* schema wants (0 = no axes, 3 = adds a series axis).
|
|
1591
|
+
*/
|
|
1592
|
+
var THREE_D_CHART_GROUPS = {
|
|
1593
|
+
BAR_3D: { from: "c:barChart", to: "c:bar3DChart", axes: 2 },
|
|
1594
|
+
LINE_3D: { from: "c:lineChart", to: "c:line3DChart", axes: 3 },
|
|
1595
|
+
PIE_3D: { from: "c:pieChart", to: "c:pie3DChart", axes: 0 },
|
|
1596
|
+
AREA_3D: { from: "c:areaChart", to: "c:area3DChart", axes: 2 },
|
|
1597
|
+
SURFACE: { from: "c:areaChart", to: "c:surfaceChart", axes: 2 },
|
|
1598
|
+
SURFACE_3D: { from: "c:areaChart", to: "c:surface3DChart", axes: 3 },
|
|
1599
|
+
};
|
|
1600
|
+
var normalizeThreeDToken = function (value) {
|
|
1601
|
+
if (typeof value !== "string")
|
|
1602
|
+
return undefined;
|
|
1603
|
+
var token = value.trim().toUpperCase();
|
|
1604
|
+
return token in THREE_D_CHART_GROUPS ? token : undefined;
|
|
1605
|
+
};
|
|
1606
|
+
/** Copy `keys` (in order) from `source` into `target`, skipping absent ones. */
|
|
1607
|
+
var pickKeys = function (target, source, keys) {
|
|
1608
|
+
var e_6, _a;
|
|
1609
|
+
try {
|
|
1610
|
+
for (var keys_1 = __values(keys), keys_1_1 = keys_1.next(); !keys_1_1.done; keys_1_1 = keys_1.next()) {
|
|
1611
|
+
var key = keys_1_1.value;
|
|
1612
|
+
if (source[key] !== undefined)
|
|
1613
|
+
target[key] = source[key];
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
1616
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
1617
|
+
finally {
|
|
1618
|
+
try {
|
|
1619
|
+
if (keys_1_1 && !keys_1_1.done && (_a = keys_1.return)) _a.call(keys_1);
|
|
1620
|
+
}
|
|
1621
|
+
finally { if (e_6) throw e_6.error; }
|
|
1622
|
+
}
|
|
1623
|
+
};
|
|
1624
|
+
/**
|
|
1625
|
+
* Rebuild the 2-D chart group as its 3-D element with the CT_*3DChart
|
|
1626
|
+
* child sequence. Element order matters to Excel, so each shape is
|
|
1627
|
+
* written out explicitly rather than renaming the key in place:
|
|
1628
|
+
* bar3DChart: barDir, grouping, varyColors, ser, dLbls, gapWidth, shape, axId
|
|
1629
|
+
* line3DChart: grouping, varyColors, ser, dLbls, axId×3
|
|
1630
|
+
* pie3DChart: varyColors, ser, dLbls
|
|
1631
|
+
* area3DChart: grouping, varyColors, ser, dLbls, axId
|
|
1632
|
+
* surfaceChart: wireframe, ser, axId (surface3DChart: axId×3)
|
|
1633
|
+
*/
|
|
1634
|
+
var buildThreeDChartGroup = function (token, group, axIds) {
|
|
1635
|
+
var node = {};
|
|
1636
|
+
switch (token) {
|
|
1637
|
+
case "BAR_3D":
|
|
1638
|
+
pickKeys(node, group, ["c:barDir", "c:grouping", "c:varyColors"]);
|
|
1639
|
+
pickKeys(node, group, ["c:ser", "c:dLbls", "c:gapWidth"]);
|
|
1640
|
+
node["c:shape"] = { a$: { val: "box" } };
|
|
1641
|
+
node["c:axId"] = axIds;
|
|
1642
|
+
return node;
|
|
1643
|
+
case "LINE_3D":
|
|
1644
|
+
case "AREA_3D":
|
|
1645
|
+
pickKeys(node, group, ["c:grouping", "c:varyColors", "c:ser", "c:dLbls"]);
|
|
1646
|
+
node["c:axId"] = axIds;
|
|
1647
|
+
return node;
|
|
1648
|
+
case "PIE_3D":
|
|
1649
|
+
pickKeys(node, group, ["c:varyColors", "c:ser", "c:dLbls"]);
|
|
1650
|
+
return node;
|
|
1651
|
+
case "SURFACE":
|
|
1652
|
+
case "SURFACE_3D":
|
|
1653
|
+
node["c:wireframe"] = { a$: { val: "0" } };
|
|
1654
|
+
pickKeys(node, group, ["c:ser"]);
|
|
1655
|
+
node["c:axId"] = axIds;
|
|
1656
|
+
return node;
|
|
1657
|
+
}
|
|
1658
|
+
};
|
|
1659
|
+
/** `<c:serAx>` for the 3-D groups whose schema takes a third (depth) axis. */
|
|
1660
|
+
var buildSerAxNode = function (valAxId) { return ({
|
|
1661
|
+
"c:axId": { a$: { val: SER_AX_ID } },
|
|
1662
|
+
"c:scaling": { "c:orientation": { a$: { val: "minMax" } } },
|
|
1663
|
+
"c:delete": { a$: { val: "0" } },
|
|
1664
|
+
"c:axPos": { a$: { val: "b" } },
|
|
1665
|
+
"c:majorTickMark": { a$: { val: "out" } },
|
|
1666
|
+
"c:minorTickMark": { a$: { val: "none" } },
|
|
1667
|
+
"c:tickLblPos": { a$: { val: "nextTo" } },
|
|
1668
|
+
"c:crossAx": { a$: { val: valAxId } },
|
|
1669
|
+
"c:crosses": { a$: { val: "autoZero" } },
|
|
1670
|
+
}); };
|
|
1671
|
+
/** `<c:view3D>` — Excel's default camera for each class (CT_View3D order). */
|
|
1672
|
+
var buildView3DNode = function (token) {
|
|
1673
|
+
if (token === "PIE_3D") {
|
|
1674
|
+
return {
|
|
1675
|
+
"c:rotX": { a$: { val: "30" } },
|
|
1676
|
+
"c:rotY": { a$: { val: "0" } },
|
|
1677
|
+
"c:rAngAx": { a$: { val: "0" } },
|
|
1678
|
+
};
|
|
1679
|
+
}
|
|
1680
|
+
if (token === "SURFACE" || token === "SURFACE_3D") {
|
|
1681
|
+
// Right-angle axes are not allowed on surfaces; use a perspective view.
|
|
1682
|
+
return {
|
|
1683
|
+
"c:rotX": { a$: { val: "15" } },
|
|
1684
|
+
"c:rotY": { a$: { val: "20" } },
|
|
1685
|
+
"c:rAngAx": { a$: { val: "0" } },
|
|
1686
|
+
"c:perspective": { a$: { val: "30" } },
|
|
1687
|
+
};
|
|
1688
|
+
}
|
|
1689
|
+
return {
|
|
1690
|
+
"c:rotX": { a$: { val: "15" } },
|
|
1691
|
+
"c:rotY": { a$: { val: "20" } },
|
|
1692
|
+
"c:rAngAx": { a$: { val: "1" } },
|
|
1693
|
+
};
|
|
1694
|
+
};
|
|
1695
|
+
/**
|
|
1696
|
+
* Turn an assembled 2-D `<c:chart>` into its 3-D variant when the spec
|
|
1697
|
+
* carries a 3-D `sourceChartType`: the chart group is swapped for the
|
|
1698
|
+
* matching `c:*3DChart` / `c:surfaceChart` element, a `<c:serAx>` is
|
|
1699
|
+
* added where the schema takes three axes, and `<c:view3D>` is inserted
|
|
1700
|
+
* before `<c:plotArea>`. No-op for 2-D specs or when the token doesn't
|
|
1701
|
+
* match the emitted chart group (the 2-D chart is left untouched).
|
|
1702
|
+
*/
|
|
1703
|
+
var applyThreeDChartType = function (chartNode, sourceChartType) {
|
|
1704
|
+
var e_7, _a, e_8, _b, e_9, _c;
|
|
1705
|
+
var _d, _e, _f, _g, _h, _j;
|
|
1706
|
+
var token = normalizeThreeDToken(sourceChartType);
|
|
1707
|
+
if (!token || !chartNode)
|
|
1708
|
+
return;
|
|
1709
|
+
var plotArea = chartNode["c:plotArea"];
|
|
1710
|
+
if (!plotArea)
|
|
1711
|
+
return;
|
|
1712
|
+
var _k = THREE_D_CHART_GROUPS[token], from = _k.from, to = _k.to, axes = _k.axes;
|
|
1713
|
+
var group = plotArea[from];
|
|
1714
|
+
if (!group || Array.isArray(group))
|
|
1715
|
+
return;
|
|
1716
|
+
var existingAxIds = Array.isArray(group["c:axId"])
|
|
1717
|
+
? group["c:axId"]
|
|
1718
|
+
: group["c:axId"]
|
|
1719
|
+
? [group["c:axId"]]
|
|
1720
|
+
: [];
|
|
1721
|
+
var valAxId = (_j = (_f = (_e = (_d = existingAxIds[1]) === null || _d === void 0 ? void 0 : _d.a$) === null || _e === void 0 ? void 0 : _e.val) !== null && _f !== void 0 ? _f : (_h = (_g = existingAxIds[0]) === null || _g === void 0 ? void 0 : _g.a$) === null || _h === void 0 ? void 0 : _h.val) !== null && _j !== void 0 ? _j : "0";
|
|
1722
|
+
var axIds = axes === 3
|
|
1723
|
+
? __spreadArray(__spreadArray([], __read(existingAxIds.slice(0, 2)), false), [{ a$: { val: SER_AX_ID } }], false) : existingAxIds.slice(0, 2);
|
|
1724
|
+
// Rebuild plotArea preserving element order, swapping the chart group
|
|
1725
|
+
// and appending the series axis after the value axis when needed.
|
|
1726
|
+
var rebuiltPlotArea = {};
|
|
1727
|
+
try {
|
|
1728
|
+
for (var _l = __values(Object.entries(plotArea)), _m = _l.next(); !_m.done; _m = _l.next()) {
|
|
1729
|
+
var _o = __read(_m.value, 2), key = _o[0], value = _o[1];
|
|
1730
|
+
if (key === from) {
|
|
1731
|
+
rebuiltPlotArea[to] = buildThreeDChartGroup(token, group, axIds);
|
|
1732
|
+
continue;
|
|
1733
|
+
}
|
|
1734
|
+
rebuiltPlotArea[key] = value;
|
|
1735
|
+
if (key === "c:valAx" && axes === 3) {
|
|
1736
|
+
rebuiltPlotArea["c:serAx"] = buildSerAxNode(valAxId);
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1739
|
+
}
|
|
1740
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
1741
|
+
finally {
|
|
1742
|
+
try {
|
|
1743
|
+
if (_m && !_m.done && (_a = _l.return)) _a.call(_l);
|
|
1744
|
+
}
|
|
1745
|
+
finally { if (e_7) throw e_7.error; }
|
|
1746
|
+
}
|
|
1747
|
+
// Rebuild the chart node so `<c:view3D>` lands before `<c:plotArea>`.
|
|
1748
|
+
var rebuiltChart = {};
|
|
1749
|
+
try {
|
|
1750
|
+
for (var _p = __values(Object.entries(chartNode)), _q = _p.next(); !_q.done; _q = _p.next()) {
|
|
1751
|
+
var _r = __read(_q.value, 2), key = _r[0], value = _r[1];
|
|
1752
|
+
if (key === "c:plotArea") {
|
|
1753
|
+
rebuiltChart["c:view3D"] = buildView3DNode(token);
|
|
1754
|
+
rebuiltChart[key] = rebuiltPlotArea;
|
|
1755
|
+
continue;
|
|
1756
|
+
}
|
|
1757
|
+
rebuiltChart[key] = value;
|
|
1758
|
+
}
|
|
1759
|
+
}
|
|
1760
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
1761
|
+
finally {
|
|
1762
|
+
try {
|
|
1763
|
+
if (_q && !_q.done && (_b = _p.return)) _b.call(_p);
|
|
1764
|
+
}
|
|
1765
|
+
finally { if (e_8) throw e_8.error; }
|
|
1766
|
+
}
|
|
1767
|
+
try {
|
|
1768
|
+
for (var _s = __values(Object.keys(chartNode)), _t = _s.next(); !_t.done; _t = _s.next()) {
|
|
1769
|
+
var key = _t.value;
|
|
1770
|
+
delete chartNode[key];
|
|
1771
|
+
}
|
|
1772
|
+
}
|
|
1773
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
1774
|
+
finally {
|
|
1775
|
+
try {
|
|
1776
|
+
if (_t && !_t.done && (_c = _s.return)) _c.call(_s);
|
|
1777
|
+
}
|
|
1778
|
+
finally { if (e_9) throw e_9.error; }
|
|
1779
|
+
}
|
|
1780
|
+
Object.assign(chartNode, rebuiltChart);
|
|
1781
|
+
};
|
|
1578
1782
|
// -------------------------- Phase 5 helpers --------------------------
|
|
1579
1783
|
var LEGEND_POS = {
|
|
1580
1784
|
top: "t",
|
|
@@ -1622,7 +1826,7 @@ var SERIES_CONTAINER_KEYS = [
|
|
|
1622
1826
|
* matches the order emitted by the builder, so we index by position.
|
|
1623
1827
|
*/
|
|
1624
1828
|
var applySeriesOverlays = function (plotArea, series, sheetNameById) {
|
|
1625
|
-
var
|
|
1829
|
+
var e_10, _a, e_11, _b;
|
|
1626
1830
|
if (!Array.isArray(series) || !series.length)
|
|
1627
1831
|
return;
|
|
1628
1832
|
var seriesIndex = 0;
|
|
@@ -1637,7 +1841,7 @@ var applySeriesOverlays = function (plotArea, series, sheetNameById) {
|
|
|
1637
1841
|
continue;
|
|
1638
1842
|
var list = Array.isArray(ser) ? ser : [ser];
|
|
1639
1843
|
try {
|
|
1640
|
-
for (var list_1 = (
|
|
1844
|
+
for (var list_1 = (e_11 = void 0, __values(list)), list_1_1 = list_1.next(); !list_1_1.done; list_1_1 = list_1.next()) {
|
|
1641
1845
|
var node = list_1_1.value;
|
|
1642
1846
|
var data = series[seriesIndex++];
|
|
1643
1847
|
if (!data)
|
|
@@ -1657,21 +1861,21 @@ var applySeriesOverlays = function (plotArea, series, sheetNameById) {
|
|
|
1657
1861
|
}
|
|
1658
1862
|
}
|
|
1659
1863
|
}
|
|
1660
|
-
catch (
|
|
1864
|
+
catch (e_11_1) { e_11 = { error: e_11_1 }; }
|
|
1661
1865
|
finally {
|
|
1662
1866
|
try {
|
|
1663
1867
|
if (list_1_1 && !list_1_1.done && (_b = list_1.return)) _b.call(list_1);
|
|
1664
1868
|
}
|
|
1665
|
-
finally { if (
|
|
1869
|
+
finally { if (e_11) throw e_11.error; }
|
|
1666
1870
|
}
|
|
1667
1871
|
}
|
|
1668
1872
|
}
|
|
1669
|
-
catch (
|
|
1873
|
+
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
1670
1874
|
finally {
|
|
1671
1875
|
try {
|
|
1672
1876
|
if (SERIES_CONTAINER_KEYS_1_1 && !SERIES_CONTAINER_KEYS_1_1.done && (_a = SERIES_CONTAINER_KEYS_1.return)) _a.call(SERIES_CONTAINER_KEYS_1);
|
|
1673
1877
|
}
|
|
1674
|
-
finally { if (
|
|
1878
|
+
finally { if (e_10) throw e_10.error; }
|
|
1675
1879
|
}
|
|
1676
1880
|
};
|
|
1677
1881
|
var buildTrendlineNode = function (t) {
|
|
@@ -26,6 +26,14 @@
|
|
|
26
26
|
* + ~100 lines in xlsx-export.ts) is the closest reference template.
|
|
27
27
|
*/
|
|
28
28
|
import type { PivotTable } from "@rowsncolumns/spreadsheet";
|
|
29
|
+
/**
|
|
30
|
+
* Distinct source fields a calculated-field formula references —
|
|
31
|
+
* single-quoted names (`'Unit Price'`, `''` escapes a quote) or bare
|
|
32
|
+
* identifiers; numeric literals (incl. `1e5`) and operators are skipped.
|
|
33
|
+
* Mirrors `@rowsncolumns/pivot`'s tokenizer without pulling in the
|
|
34
|
+
* DuckDB-backed pivot package.
|
|
35
|
+
*/
|
|
36
|
+
export declare const calculatedFieldReferences: (formula: string) => string[];
|
|
29
37
|
/**
|
|
30
38
|
* Build pivotCacheDefinition XML for a pivot. The cacheSource
|
|
31
39
|
* points at the live worksheet range; `refreshOnLoad="1"` makes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pivot-builder.d.ts","sourceRoot":"","sources":["../../../../exporter/xlsx/pivot-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,KAAK,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"pivot-builder.d.ts","sourceRoot":"","sources":["../../../../exporter/xlsx/pivot-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,KAAK,EAAE,UAAU,EAAc,MAAM,2BAA2B,CAAC;AAqBxE;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,GAAI,SAAS,MAAM,KAAG,MAAM,EAYjE,CAAC;AA2DF;;;;;;;;GAQG;AACH,eAAO,MAAM,4BAA4B,GACvC,OAAO,UAAU,EACjB,WAAW,MAAM,EACjB,YAAY,MAAM,EAAE,KACnB,MAAM,GAAG,IAuCX,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,GAC7B,OAAO,UAAU,EACjB,SAAS,MAAM,EACf,cAAc,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,KAChC,MAAM,GAAG,IA2JX,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,GACjC,UAAU,MAAM,EAChB,aAAa,MAAM,KAClB,MAcF,CAAC"}
|
|
@@ -1,5 +1,55 @@
|
|
|
1
1
|
import { __read, __spreadArray, __values } from "tslib";
|
|
2
2
|
import { XMLBuilder } from "fast-xml-parser";
|
|
3
|
+
/**
|
|
4
|
+
* `PivotValue.showAs` → `dataField@showDataAs` (ECMA-376) or, for the
|
|
5
|
+
* rank modes Excel only knows through its 2010 extension,
|
|
6
|
+
* `x14:dataField@pivotShowAs`.
|
|
7
|
+
*/
|
|
8
|
+
var SHOW_DATA_AS = {
|
|
9
|
+
pct_of_total: "percentOfTotal",
|
|
10
|
+
pct_of_row: "percentOfRow",
|
|
11
|
+
pct_of_column: "percentOfCol",
|
|
12
|
+
running_total: "runTotal",
|
|
13
|
+
};
|
|
14
|
+
var X14_PIVOT_SHOW_AS = {
|
|
15
|
+
rank_asc: "rankAscending",
|
|
16
|
+
rank_desc: "rankDescending",
|
|
17
|
+
};
|
|
18
|
+
var X14_DATA_FIELD_EXT_URI = "{E15A36E0-9728-4e99-A89B-3F7291B0FE68}";
|
|
19
|
+
var X14_NS = "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main";
|
|
20
|
+
/**
|
|
21
|
+
* Distinct source fields a calculated-field formula references —
|
|
22
|
+
* single-quoted names (`'Unit Price'`, `''` escapes a quote) or bare
|
|
23
|
+
* identifiers; numeric literals (incl. `1e5`) and operators are skipped.
|
|
24
|
+
* Mirrors `@rowsncolumns/pivot`'s tokenizer without pulling in the
|
|
25
|
+
* DuckDB-backed pivot package.
|
|
26
|
+
*/
|
|
27
|
+
export var calculatedFieldReferences = function (formula) {
|
|
28
|
+
var e_1, _a;
|
|
29
|
+
var out = [];
|
|
30
|
+
var push = function (name) {
|
|
31
|
+
if (name && !out.includes(name))
|
|
32
|
+
out.push(name);
|
|
33
|
+
};
|
|
34
|
+
var re = /'((?:[^']|'')*)'|(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?|([A-Za-z_\u00C0-\uFFFF][A-Za-z0-9_.\u00C0-\uFFFF]*)/g;
|
|
35
|
+
try {
|
|
36
|
+
for (var _b = __values(formula.replace(/^\s*=/, "").matchAll(re)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
37
|
+
var m = _c.value;
|
|
38
|
+
if (m[1] !== undefined)
|
|
39
|
+
push(m[1].replace(/''/g, "'"));
|
|
40
|
+
else if (m[2] !== undefined)
|
|
41
|
+
push(m[2]);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
45
|
+
finally {
|
|
46
|
+
try {
|
|
47
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
48
|
+
}
|
|
49
|
+
finally { if (e_1) throw e_1.error; }
|
|
50
|
+
}
|
|
51
|
+
return out;
|
|
52
|
+
};
|
|
3
53
|
var xmlBuilder = new XMLBuilder({
|
|
4
54
|
ignoreAttributes: false,
|
|
5
55
|
attributeNamePrefix: "@_",
|
|
@@ -55,13 +105,19 @@ var aggToSubtotal = function (agg) {
|
|
|
55
105
|
* @param fieldNames All source column headers (becomes <cacheFields>)
|
|
56
106
|
*/
|
|
57
107
|
export var buildPivotCacheDefinitionXml = function (pivot, sheetName, fieldNames) {
|
|
108
|
+
var _a;
|
|
58
109
|
if (!pivot.source)
|
|
59
110
|
return null;
|
|
60
111
|
var sourceRef = rangeRef(pivot.source);
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
112
|
+
// Calculated fields are cache fields too (`databaseField="0"` +
|
|
113
|
+
// `formula`), listed after the source columns like Excel does.
|
|
114
|
+
var calculatedByName = new Map(((_a = pivot.calculatedFields) !== null && _a !== void 0 ? _a : []).map(function (c) { return [c.name, c.formula]; }));
|
|
115
|
+
var cacheFields = fieldNames.map(function (name) {
|
|
116
|
+
var formula = calculatedByName.get(name);
|
|
117
|
+
return formula !== undefined
|
|
118
|
+
? { "@_name": name, "@_formula": formula, "@_databaseField": "0" }
|
|
119
|
+
: { "@_name": name, sharedItems: { "@_count": "0" } };
|
|
120
|
+
});
|
|
65
121
|
var doc = {
|
|
66
122
|
"?xml": { "@_version": "1.0", "@_encoding": "UTF-8", "@_standalone": "yes" },
|
|
67
123
|
pivotCacheDefinition: {
|
|
@@ -96,112 +152,155 @@ export var buildPivotCacheDefinitionXml = function (pivot, sheetName, fieldNames
|
|
|
96
152
|
* @param fieldIndices Maps row/col/value field names → cacheField indices
|
|
97
153
|
*/
|
|
98
154
|
export var buildPivotTableXml = function (pivot, cacheId, fieldIndices) {
|
|
99
|
-
var
|
|
100
|
-
var _e, _f, _g, _h, _j, _k, _l;
|
|
155
|
+
var e_2, _a, e_3, _b, e_4, _c, e_5, _d;
|
|
156
|
+
var _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
101
157
|
if (!pivot.pivotRange)
|
|
102
158
|
return null;
|
|
103
159
|
var ref = rangeRef(pivot.pivotRange);
|
|
104
|
-
// pivotFields: one entry per cacheField, with axis attribute
|
|
105
|
-
// (axisRow / axisCol / dataField
|
|
160
|
+
// pivotFields: one entry per cacheField, with the axis attribute
|
|
161
|
+
// (axisRow / axisCol) and/or `dataField="1"` for value fields
|
|
162
|
+
// (`ST_Axis` has no "dataField" value — a field can sit on an axis
|
|
163
|
+
// AND be a data field). Order = cacheField order.
|
|
106
164
|
var pivotFields = [];
|
|
107
165
|
// We don't know the full field universe here without the source
|
|
108
166
|
// schema. Best-effort: declare entries for the union of row/col/
|
|
109
167
|
// value fields and tag with the appropriate axis.
|
|
110
168
|
var fieldAxis = new Map();
|
|
111
169
|
try {
|
|
112
|
-
for (var
|
|
113
|
-
var r =
|
|
170
|
+
for (var _t = __values((_e = pivot.rows) !== null && _e !== void 0 ? _e : []), _u = _t.next(); !_u.done; _u = _t.next()) {
|
|
171
|
+
var r = _u.value;
|
|
114
172
|
var idx = fieldIndices.get(r.field);
|
|
115
173
|
if (idx != null)
|
|
116
174
|
fieldAxis.set(idx, "axisRow");
|
|
117
175
|
}
|
|
118
176
|
}
|
|
119
|
-
catch (
|
|
177
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
120
178
|
finally {
|
|
121
179
|
try {
|
|
122
|
-
if (
|
|
180
|
+
if (_u && !_u.done && (_a = _t.return)) _a.call(_t);
|
|
123
181
|
}
|
|
124
|
-
finally { if (
|
|
182
|
+
finally { if (e_2) throw e_2.error; }
|
|
125
183
|
}
|
|
126
184
|
try {
|
|
127
|
-
for (var
|
|
128
|
-
var c =
|
|
185
|
+
for (var _v = __values((_f = pivot.columns) !== null && _f !== void 0 ? _f : []), _w = _v.next(); !_w.done; _w = _v.next()) {
|
|
186
|
+
var c = _w.value;
|
|
129
187
|
var idx = fieldIndices.get(c.field);
|
|
130
188
|
if (idx != null)
|
|
131
189
|
fieldAxis.set(idx, "axisCol");
|
|
132
190
|
}
|
|
133
191
|
}
|
|
134
|
-
catch (
|
|
192
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
135
193
|
finally {
|
|
136
194
|
try {
|
|
137
|
-
if (
|
|
195
|
+
if (_w && !_w.done && (_b = _v.return)) _b.call(_v);
|
|
138
196
|
}
|
|
139
|
-
finally { if (
|
|
197
|
+
finally { if (e_3) throw e_3.error; }
|
|
140
198
|
}
|
|
199
|
+
var dataFieldIndices = new Set();
|
|
141
200
|
try {
|
|
142
|
-
for (var
|
|
143
|
-
var v =
|
|
201
|
+
for (var _x = __values((_g = pivot.values) !== null && _g !== void 0 ? _g : []), _y = _x.next(); !_y.done; _y = _x.next()) {
|
|
202
|
+
var v = _y.value;
|
|
144
203
|
var idx = fieldIndices.get(v.field);
|
|
145
204
|
if (idx != null)
|
|
146
|
-
|
|
205
|
+
dataFieldIndices.add(idx);
|
|
147
206
|
}
|
|
148
207
|
}
|
|
149
|
-
catch (
|
|
208
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
150
209
|
finally {
|
|
151
210
|
try {
|
|
152
|
-
if (
|
|
211
|
+
if (_y && !_y.done && (_c = _x.return)) _c.call(_x);
|
|
153
212
|
}
|
|
154
|
-
finally { if (
|
|
213
|
+
finally { if (e_4) throw e_4.error; }
|
|
155
214
|
}
|
|
215
|
+
var calculatedNames = new Set(((_h = pivot.calculatedFields) !== null && _h !== void 0 ? _h : []).map(function (c) { return c.name; }));
|
|
156
216
|
// Need to emit one <pivotField> per cacheField in order, even
|
|
157
217
|
// for unused fields (Excel requires the array shapes match).
|
|
158
218
|
// Caller passes us the full field set via fieldIndices.
|
|
159
219
|
var sortedFieldIndices = __spreadArray([], __read(fieldIndices.entries()), false).sort(function (a, b) { return a[1] - b[1]; });
|
|
160
220
|
try {
|
|
161
221
|
for (var sortedFieldIndices_1 = __values(sortedFieldIndices), sortedFieldIndices_1_1 = sortedFieldIndices_1.next(); !sortedFieldIndices_1_1.done; sortedFieldIndices_1_1 = sortedFieldIndices_1.next()) {
|
|
162
|
-
var
|
|
222
|
+
var _z = __read(sortedFieldIndices_1_1.value, 2), name_1 = _z[0], idx = _z[1];
|
|
163
223
|
var axis = fieldAxis.get(idx);
|
|
164
|
-
|
|
165
|
-
|
|
224
|
+
var entry = {};
|
|
225
|
+
if (axis)
|
|
226
|
+
entry["@_axis"] = axis;
|
|
227
|
+
if (dataFieldIndices.has(idx))
|
|
228
|
+
entry["@_dataField"] = "1";
|
|
229
|
+
if (calculatedNames.has(name_1)) {
|
|
230
|
+
// Excel pins calculated fields to the values area.
|
|
231
|
+
entry["@_dragToRow"] = "0";
|
|
232
|
+
entry["@_dragToCol"] = "0";
|
|
233
|
+
entry["@_dragToPage"] = "0";
|
|
234
|
+
entry["@_showAll"] = "0";
|
|
235
|
+
entry["@_defaultSubtotal"] = "0";
|
|
166
236
|
}
|
|
167
237
|
else {
|
|
168
|
-
|
|
238
|
+
entry["@_compact"] = "0";
|
|
239
|
+
if (axis)
|
|
240
|
+
entry.items = {};
|
|
169
241
|
}
|
|
242
|
+
pivotFields.push(entry);
|
|
170
243
|
}
|
|
171
244
|
}
|
|
172
|
-
catch (
|
|
245
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
173
246
|
finally {
|
|
174
247
|
try {
|
|
175
248
|
if (sortedFieldIndices_1_1 && !sortedFieldIndices_1_1.done && (_d = sortedFieldIndices_1.return)) _d.call(sortedFieldIndices_1);
|
|
176
249
|
}
|
|
177
|
-
finally { if (
|
|
250
|
+
finally { if (e_5) throw e_5.error; }
|
|
178
251
|
}
|
|
179
|
-
var rowFields = ((
|
|
252
|
+
var rowFields = ((_j = pivot.rows) !== null && _j !== void 0 ? _j : [])
|
|
180
253
|
.map(function (r) { return fieldIndices.get(r.field); })
|
|
181
254
|
.filter(function (i) { return i != null; })
|
|
182
255
|
.map(function (i) { return ({ "@_x": String(i) }); });
|
|
183
|
-
var colFields = ((
|
|
256
|
+
var colFields = ((_k = pivot.columns) !== null && _k !== void 0 ? _k : [])
|
|
184
257
|
.map(function (c) { return fieldIndices.get(c.field); })
|
|
185
258
|
.filter(function (i) { return i != null; })
|
|
186
259
|
.map(function (i) { return ({ "@_x": String(i) }); });
|
|
187
|
-
|
|
260
|
+
// Running totals need a base field: Excel defaults to the first row
|
|
261
|
+
// field (falls back to the first column field / field 0).
|
|
262
|
+
var runTotalBase = (_p = (_m = (_l = rowFields[0]) === null || _l === void 0 ? void 0 : _l["@_x"]) !== null && _m !== void 0 ? _m : (_o = colFields[0]) === null || _o === void 0 ? void 0 : _o["@_x"]) !== null && _p !== void 0 ? _p : "0";
|
|
263
|
+
var dataFields = ((_q = pivot.values) !== null && _q !== void 0 ? _q : [])
|
|
188
264
|
.map(function (v) {
|
|
189
265
|
var _a;
|
|
190
266
|
var idx = fieldIndices.get(v.field);
|
|
191
267
|
if (idx == null)
|
|
192
268
|
return null;
|
|
193
|
-
|
|
269
|
+
var entry = {
|
|
194
270
|
"@_name": (_a = v.displayName) !== null && _a !== void 0 ? _a : "".concat(v.aggFunc, " of ").concat(v.field),
|
|
195
271
|
"@_fld": String(idx),
|
|
196
|
-
"@_subtotal":
|
|
272
|
+
"@_subtotal": calculatedNames.has(v.field)
|
|
273
|
+
? "sum"
|
|
274
|
+
: aggToSubtotal(v.aggFunc),
|
|
197
275
|
};
|
|
276
|
+
var showDataAs = v.showAs ? SHOW_DATA_AS[v.showAs] : undefined;
|
|
277
|
+
if (showDataAs) {
|
|
278
|
+
entry["@_showDataAs"] = showDataAs;
|
|
279
|
+
if (showDataAs === "runTotal")
|
|
280
|
+
entry["@_baseField"] = runTotalBase;
|
|
281
|
+
}
|
|
282
|
+
var pivotShowAs = v.showAs ? X14_PIVOT_SHOW_AS[v.showAs] : undefined;
|
|
283
|
+
if (pivotShowAs) {
|
|
284
|
+
entry.extLst = {
|
|
285
|
+
ext: {
|
|
286
|
+
"@_uri": X14_DATA_FIELD_EXT_URI,
|
|
287
|
+
"@_xmlns:x14": X14_NS,
|
|
288
|
+
"x14:dataField": { "@_pivotShowAs": pivotShowAs },
|
|
289
|
+
},
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
return entry;
|
|
198
293
|
})
|
|
199
294
|
.filter(function (d) { return d !== null; });
|
|
295
|
+
var styleInfo = (_r = pivot.styleInfo) !== null && _r !== void 0 ? _r : {};
|
|
296
|
+
var styleFlag = function (value, fallback) {
|
|
297
|
+
return value === undefined ? fallback : value ? "1" : "0";
|
|
298
|
+
};
|
|
200
299
|
var doc = {
|
|
201
300
|
"?xml": { "@_version": "1.0", "@_encoding": "UTF-8", "@_standalone": "yes" },
|
|
202
301
|
pivotTableDefinition: {
|
|
203
302
|
"@_xmlns": "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
|
|
204
|
-
"@_name": (
|
|
303
|
+
"@_name": (_s = pivot.name) !== null && _s !== void 0 ? _s : "PivotTable".concat(pivot.pivotId),
|
|
205
304
|
"@_cacheId": String(cacheId),
|
|
206
305
|
"@_dataOnRows": "0",
|
|
207
306
|
"@_applyNumberFormats": "0",
|
|
@@ -242,12 +341,12 @@ export var buildPivotTableXml = function (pivot, cacheId, fieldIndices) {
|
|
|
242
341
|
? { "@_count": String(dataFields.length), dataField: dataFields }
|
|
243
342
|
: undefined,
|
|
244
343
|
pivotTableStyleInfo: {
|
|
245
|
-
"@_name": "PivotStyleLight16",
|
|
246
|
-
"@_showRowHeaders": "1",
|
|
247
|
-
"@_showColHeaders": "1",
|
|
248
|
-
"@_showRowStripes": "0",
|
|
249
|
-
"@_showColStripes": "0",
|
|
250
|
-
"@_showLastColumn": "1",
|
|
344
|
+
"@_name": styleInfo.name || "PivotStyleLight16",
|
|
345
|
+
"@_showRowHeaders": styleFlag(styleInfo.showRowHeaders, "1"),
|
|
346
|
+
"@_showColHeaders": styleFlag(styleInfo.showColHeaders, "1"),
|
|
347
|
+
"@_showRowStripes": styleFlag(styleInfo.showRowStripes, "0"),
|
|
348
|
+
"@_showColStripes": styleFlag(styleInfo.showColStripes, "0"),
|
|
349
|
+
"@_showLastColumn": styleFlag(styleInfo.showLastColumn, "1"),
|
|
251
350
|
},
|
|
252
351
|
},
|
|
253
352
|
};
|
|
@@ -716,10 +716,16 @@ var serializeAlignment = function (record) {
|
|
|
716
716
|
attrs.push("relativeIndent=\"".concat(record.relativeIndent, "\""));
|
|
717
717
|
}
|
|
718
718
|
if (record.textRotation !== undefined && record.textRotation !== null) {
|
|
719
|
-
// Excel encodes "vertical (stacked)" text as the magic value 255
|
|
720
|
-
|
|
719
|
+
// Excel encodes "vertical (stacked)" text as the magic value 255 and
|
|
720
|
+
// clockwise rotation as 90 + degrees (91–180); the engine keeps signed
|
|
721
|
+
// counter-clockwise degrees.
|
|
722
|
+
var rotation = record.textRotation === "vertical"
|
|
723
|
+
? 255
|
|
724
|
+
: record.textRotation < 0
|
|
725
|
+
? 90 - record.textRotation
|
|
726
|
+
: record.textRotation;
|
|
721
727
|
if (Number.isFinite(rotation) && rotation !== 0) {
|
|
722
|
-
attrs.push("textRotation=\"".concat(rotation, "\""));
|
|
728
|
+
attrs.push("textRotation=\"".concat(Math.round(rotation), "\""));
|
|
723
729
|
}
|
|
724
730
|
}
|
|
725
731
|
if (record.shrinkToFit) {
|
|
@@ -10,6 +10,7 @@ export declare const PERSON_CONTENT_TYPE = "application/vnd.ms-excel.person+xml"
|
|
|
10
10
|
* scoping author/comment ids within a single workbook.
|
|
11
11
|
*/
|
|
12
12
|
export declare const deterministicGuid: (seed: string) => string;
|
|
13
|
+
export declare const isBracedGuid: (id: string) => boolean;
|
|
13
14
|
/**
|
|
14
15
|
* Workbook-scoped author registry. Shared across every sheet's collector so
|
|
15
16
|
* an author who comments on multiple sheets maps to a single `person` entry
|
|
@@ -35,7 +36,12 @@ export declare class ThreadedCommentsCollector {
|
|
|
35
36
|
/** Anchor a thread to a cell. No-op if the id is unknown or empty. */
|
|
36
37
|
addCell(address: string, threadId: string | number | null | undefined): void;
|
|
37
38
|
isEmpty(): boolean;
|
|
38
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* Braced root GUID for a thread — used as both the root `id` and `tc=`.
|
|
41
|
+
* An id that already is a braced GUID (what Excel and both importers
|
|
42
|
+
* produce) passes through, so a re-exported thread keeps the identity
|
|
43
|
+
* Excel assigned it; anything else is hashed deterministically.
|
|
44
|
+
*/
|
|
39
45
|
private rootGuid;
|
|
40
46
|
/**
|
|
41
47
|
* Legacy `xl/comments{N}.xml` mirror entries. Feed these into the existing
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"threaded-comments-builder.d.ts","sourceRoot":"","sources":["../../../../exporter/xlsx/threaded-comments-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAyBhE,eAAO,MAAM,yBAAyB,8EACuC,CAAC;AAC9E,eAAO,MAAM,eAAe,qEACwC,CAAC;AACrE,eAAO,MAAM,8BAA8B,kDACM,CAAC;AAClD,eAAO,MAAM,mBAAmB,wCAAwC,CAAC;AAsBzE;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAI,MAAM,MAAM,KAAG,MAiBhD,CAAC;
|
|
1
|
+
{"version":3,"file":"threaded-comments-builder.d.ts","sourceRoot":"","sources":["../../../../exporter/xlsx/threaded-comments-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAyBhE,eAAO,MAAM,yBAAyB,8EACuC,CAAC;AAC9E,eAAO,MAAM,eAAe,qEACwC,CAAC;AACrE,eAAO,MAAM,8BAA8B,kDACM,CAAC;AAClD,eAAO,MAAM,mBAAmB,wCAAwC,CAAC;AAsBzE;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAI,MAAM,MAAM,KAAG,MAiBhD,CAAC;AAKF,eAAO,MAAM,YAAY,GAAI,IAAI,MAAM,YAAyB,CAAC;AAEjE;;;;GAIG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAGlB;IAEJ,8DAA8D;IAC9D,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE,WAAW,EAAE,MAAM,GAAG,SAAS;IAWtE,OAAO;IAIP,KAAK;CAYN;AAQD;;;;GAIG;AACH,qBAAa,yBAAyB;IAMlC,OAAO,CAAC,QAAQ,CAAC,OAAO;IAL1B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA6B;IACxD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsB;gBAG3C,OAAO,EAAE,aAAa,EAAE,GAAG,SAAS,EACnB,OAAO,EAAE,cAAc;IAO1C,sEAAsE;IACtE,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS;IAQrE,OAAO;IAIP;;;;;OAKG;IACH,OAAO,CAAC,QAAQ;IAMhB;;;;;OAKG;IACH,aAAa,IAAI;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE;IAcpE;;;;OAIG;IACH,KAAK,IAAI,MAAM,GAAG,SAAS;CAiC5B"}
|