@rowsncolumns/toolkit 24.4.2 → 24.4.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.
Files changed (166) hide show
  1. package/dist/cjs/excel-parser/cfb-decryptor.d.ts +6 -0
  2. package/dist/cjs/excel-parser/cfb-decryptor.d.ts.map +1 -1
  3. package/dist/cjs/excel-parser/cfb-decryptor.js +6 -0
  4. package/dist/cjs/excel-parser/helpers.d.ts +9 -1
  5. package/dist/cjs/excel-parser/helpers.d.ts.map +1 -1
  6. package/dist/cjs/excel-parser/helpers.js +37 -0
  7. package/dist/cjs/excel-parser/interface.d.ts +15 -2
  8. package/dist/cjs/excel-parser/interface.d.ts.map +1 -1
  9. package/dist/cjs/excel-parser/plugins/base/index.d.ts +2 -0
  10. package/dist/cjs/excel-parser/plugins/base/index.d.ts.map +1 -1
  11. package/dist/cjs/excel-parser/plugins/base/index.js +3 -0
  12. package/dist/cjs/excel-parser/plugins/ods/index.d.ts +19 -0
  13. package/dist/cjs/excel-parser/plugins/ods/index.d.ts.map +1 -1
  14. package/dist/cjs/excel-parser/plugins/ods/index.js +676 -304
  15. package/dist/cjs/excel-parser/plugins/ods/styles.d.ts +43 -1
  16. package/dist/cjs/excel-parser/plugins/ods/styles.d.ts.map +1 -1
  17. package/dist/cjs/excel-parser/plugins/ods/styles.js +343 -45
  18. package/dist/cjs/excel-parser/plugins/xls/index.d.ts +55 -1
  19. package/dist/cjs/excel-parser/plugins/xls/index.d.ts.map +1 -1
  20. package/dist/cjs/excel-parser/plugins/xls/index.js +518 -6
  21. package/dist/cjs/excel-parser/plugins/xlsb/index.d.ts +4 -0
  22. package/dist/cjs/excel-parser/plugins/xlsb/index.d.ts.map +1 -1
  23. package/dist/cjs/excel-parser/plugins/xlsb/index.js +33 -14
  24. package/dist/cjs/excel-parser/plugins/xlsx/chartex.d.ts +37 -0
  25. package/dist/cjs/excel-parser/plugins/xlsx/chartex.d.ts.map +1 -0
  26. package/dist/cjs/excel-parser/plugins/xlsx/chartex.js +244 -0
  27. package/dist/cjs/excel-parser/plugins/xlsx/charts.d.ts +10 -0
  28. package/dist/cjs/excel-parser/plugins/xlsx/charts.d.ts.map +1 -1
  29. package/dist/cjs/excel-parser/plugins/xlsx/charts.js +68 -9
  30. package/dist/cjs/excel-parser/plugins/xlsx/drawing.d.ts +28 -1
  31. package/dist/cjs/excel-parser/plugins/xlsx/drawing.d.ts.map +1 -1
  32. package/dist/cjs/excel-parser/plugins/xlsx/drawing.js +155 -20
  33. package/dist/cjs/excel-parser/plugins/xlsx/form-controls.d.ts +70 -0
  34. package/dist/cjs/excel-parser/plugins/xlsx/form-controls.d.ts.map +1 -0
  35. package/dist/cjs/excel-parser/plugins/xlsx/form-controls.js +295 -0
  36. package/dist/cjs/excel-parser/plugins/xlsx/index.d.ts +35 -2
  37. package/dist/cjs/excel-parser/plugins/xlsx/index.d.ts.map +1 -1
  38. package/dist/cjs/excel-parser/plugins/xlsx/index.js +737 -257
  39. package/dist/cjs/excel-parser/plugins/xlsx/pivots.d.ts.map +1 -1
  40. package/dist/cjs/excel-parser/plugins/xlsx/pivots.js +125 -37
  41. package/dist/cjs/excel-parser/plugins/xlsx/sheet-views.d.ts +3 -0
  42. package/dist/cjs/excel-parser/plugins/xlsx/sheet-views.d.ts.map +1 -1
  43. package/dist/cjs/excel-parser/plugins/xlsx/sheet-views.js +4 -1
  44. package/dist/cjs/excel-parser/plugins/xlsx/styles.d.ts +15 -1
  45. package/dist/cjs/excel-parser/plugins/xlsx/styles.d.ts.map +1 -1
  46. package/dist/cjs/excel-parser/plugins/xlsx/styles.js +102 -6
  47. package/dist/cjs/excel-parser/registry.d.ts +7 -0
  48. package/dist/cjs/excel-parser/registry.d.ts.map +1 -1
  49. package/dist/cjs/excel-parser/registry.js +29 -0
  50. package/dist/cjs/excel-parser/types.d.ts +17 -2
  51. package/dist/cjs/excel-parser/types.d.ts.map +1 -1
  52. package/dist/cjs/excel-parser/workbook.d.ts +3 -0
  53. package/dist/cjs/excel-parser/workbook.d.ts.map +1 -1
  54. package/dist/cjs/excel-parser/workbook.js +24 -14
  55. package/dist/cjs/excel-parser/worker.js +131 -131
  56. package/dist/cjs/exporter/ods/ods-export.d.ts.map +1 -1
  57. package/dist/cjs/exporter/ods/ods-export.js +432 -175
  58. package/dist/cjs/exporter/xlsx/chart-builder.d.ts.map +1 -1
  59. package/dist/cjs/exporter/xlsx/chart-builder.js +215 -39
  60. package/dist/cjs/exporter/xlsx/chartex-builder.d.ts +36 -0
  61. package/dist/cjs/exporter/xlsx/chartex-builder.d.ts.map +1 -0
  62. package/dist/cjs/exporter/xlsx/chartex-builder.js +109 -0
  63. package/dist/cjs/exporter/xlsx/form-controls-builder.d.ts +61 -0
  64. package/dist/cjs/exporter/xlsx/form-controls-builder.d.ts.map +1 -0
  65. package/dist/cjs/exporter/xlsx/form-controls-builder.js +197 -0
  66. package/dist/cjs/exporter/xlsx/pivot-builder.d.ts +8 -0
  67. package/dist/cjs/exporter/xlsx/pivot-builder.d.ts.map +1 -1
  68. package/dist/cjs/exporter/xlsx/pivot-builder.js +141 -42
  69. package/dist/cjs/exporter/xlsx/style-builder.js +9 -3
  70. package/dist/cjs/exporter/xlsx/threaded-comments-builder.d.ts +7 -1
  71. package/dist/cjs/exporter/xlsx/threaded-comments-builder.d.ts.map +1 -1
  72. package/dist/cjs/exporter/xlsx/threaded-comments-builder.js +15 -3
  73. package/dist/cjs/exporter/xlsx/xlsx-export.d.ts +11 -2
  74. package/dist/cjs/exporter/xlsx/xlsx-export.d.ts.map +1 -1
  75. package/dist/cjs/exporter/xlsx/xlsx-export.js +991 -297
  76. package/dist/cjs/helpers/implicit-intersection.d.ts +16 -0
  77. package/dist/cjs/helpers/implicit-intersection.d.ts.map +1 -0
  78. package/dist/cjs/helpers/implicit-intersection.js +197 -0
  79. package/dist/cjs/print-settings.d.ts +105 -0
  80. package/dist/cjs/print-settings.d.ts.map +1 -0
  81. package/dist/cjs/print-settings.js +494 -0
  82. package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  83. package/dist/esm/excel-parser/cfb-decryptor.d.ts +6 -0
  84. package/dist/esm/excel-parser/cfb-decryptor.d.ts.map +1 -1
  85. package/dist/esm/excel-parser/cfb-decryptor.js +6 -0
  86. package/dist/esm/excel-parser/helpers.d.ts +9 -1
  87. package/dist/esm/excel-parser/helpers.d.ts.map +1 -1
  88. package/dist/esm/excel-parser/helpers.js +34 -0
  89. package/dist/esm/excel-parser/interface.d.ts +15 -2
  90. package/dist/esm/excel-parser/interface.d.ts.map +1 -1
  91. package/dist/esm/excel-parser/plugins/base/index.d.ts +2 -0
  92. package/dist/esm/excel-parser/plugins/base/index.d.ts.map +1 -1
  93. package/dist/esm/excel-parser/plugins/base/index.js +3 -0
  94. package/dist/esm/excel-parser/plugins/ods/index.d.ts +19 -0
  95. package/dist/esm/excel-parser/plugins/ods/index.d.ts.map +1 -1
  96. package/dist/esm/excel-parser/plugins/ods/index.js +347 -33
  97. package/dist/esm/excel-parser/plugins/ods/styles.d.ts +43 -1
  98. package/dist/esm/excel-parser/plugins/ods/styles.d.ts.map +1 -1
  99. package/dist/esm/excel-parser/plugins/ods/styles.js +276 -2
  100. package/dist/esm/excel-parser/plugins/xls/index.d.ts +55 -1
  101. package/dist/esm/excel-parser/plugins/xls/index.d.ts.map +1 -1
  102. package/dist/esm/excel-parser/plugins/xls/index.js +441 -3
  103. package/dist/esm/excel-parser/plugins/xlsb/index.d.ts +4 -0
  104. package/dist/esm/excel-parser/plugins/xlsb/index.d.ts.map +1 -1
  105. package/dist/esm/excel-parser/plugins/xlsb/index.js +30 -9
  106. package/dist/esm/excel-parser/plugins/xlsx/chartex.d.ts +37 -0
  107. package/dist/esm/excel-parser/plugins/xlsx/chartex.d.ts.map +1 -0
  108. package/dist/esm/excel-parser/plugins/xlsx/chartex.js +199 -0
  109. package/dist/esm/excel-parser/plugins/xlsx/charts.d.ts +10 -0
  110. package/dist/esm/excel-parser/plugins/xlsx/charts.d.ts.map +1 -1
  111. package/dist/esm/excel-parser/plugins/xlsx/charts.js +69 -6
  112. package/dist/esm/excel-parser/plugins/xlsx/drawing.d.ts +28 -1
  113. package/dist/esm/excel-parser/plugins/xlsx/drawing.d.ts.map +1 -1
  114. package/dist/esm/excel-parser/plugins/xlsx/drawing.js +99 -0
  115. package/dist/esm/excel-parser/plugins/xlsx/form-controls.d.ts +70 -0
  116. package/dist/esm/excel-parser/plugins/xlsx/form-controls.d.ts.map +1 -0
  117. package/dist/esm/excel-parser/plugins/xlsx/form-controls.js +246 -0
  118. package/dist/esm/excel-parser/plugins/xlsx/index.d.ts +35 -2
  119. package/dist/esm/excel-parser/plugins/xlsx/index.d.ts.map +1 -1
  120. package/dist/esm/excel-parser/plugins/xlsx/index.js +454 -32
  121. package/dist/esm/excel-parser/plugins/xlsx/pivots.d.ts.map +1 -1
  122. package/dist/esm/excel-parser/plugins/xlsx/pivots.js +86 -6
  123. package/dist/esm/excel-parser/plugins/xlsx/sheet-views.d.ts +3 -0
  124. package/dist/esm/excel-parser/plugins/xlsx/sheet-views.d.ts.map +1 -1
  125. package/dist/esm/excel-parser/plugins/xlsx/sheet-views.js +2 -0
  126. package/dist/esm/excel-parser/plugins/xlsx/styles.d.ts +15 -1
  127. package/dist/esm/excel-parser/plugins/xlsx/styles.d.ts.map +1 -1
  128. package/dist/esm/excel-parser/plugins/xlsx/styles.js +92 -2
  129. package/dist/esm/excel-parser/registry.d.ts +7 -0
  130. package/dist/esm/excel-parser/registry.d.ts.map +1 -1
  131. package/dist/esm/excel-parser/registry.js +19 -0
  132. package/dist/esm/excel-parser/types.d.ts +17 -2
  133. package/dist/esm/excel-parser/types.d.ts.map +1 -1
  134. package/dist/esm/excel-parser/workbook.d.ts +3 -0
  135. package/dist/esm/excel-parser/workbook.d.ts.map +1 -1
  136. package/dist/esm/excel-parser/workbook.js +19 -10
  137. package/dist/esm/excel-parser/worker.js +12 -18
  138. package/dist/esm/exporter/ods/ods-export.d.ts.map +1 -1
  139. package/dist/esm/exporter/ods/ods-export.js +306 -35
  140. package/dist/esm/exporter/xlsx/chart-builder.d.ts.map +1 -1
  141. package/dist/esm/exporter/xlsx/chart-builder.js +161 -28
  142. package/dist/esm/exporter/xlsx/chartex-builder.d.ts +36 -0
  143. package/dist/esm/exporter/xlsx/chartex-builder.d.ts.map +1 -0
  144. package/dist/esm/exporter/xlsx/chartex-builder.js +97 -0
  145. package/dist/esm/exporter/xlsx/form-controls-builder.d.ts +61 -0
  146. package/dist/esm/exporter/xlsx/form-controls-builder.d.ts.map +1 -0
  147. package/dist/esm/exporter/xlsx/form-controls-builder.js +173 -0
  148. package/dist/esm/exporter/xlsx/pivot-builder.d.ts +8 -0
  149. package/dist/esm/exporter/xlsx/pivot-builder.d.ts.map +1 -1
  150. package/dist/esm/exporter/xlsx/pivot-builder.js +104 -19
  151. package/dist/esm/exporter/xlsx/style-builder.js +9 -3
  152. package/dist/esm/exporter/xlsx/threaded-comments-builder.d.ts +7 -1
  153. package/dist/esm/exporter/xlsx/threaded-comments-builder.d.ts.map +1 -1
  154. package/dist/esm/exporter/xlsx/threaded-comments-builder.js +15 -3
  155. package/dist/esm/exporter/xlsx/xlsx-export.d.ts +11 -2
  156. package/dist/esm/exporter/xlsx/xlsx-export.d.ts.map +1 -1
  157. package/dist/esm/exporter/xlsx/xlsx-export.js +675 -64
  158. package/dist/esm/helpers/implicit-intersection.d.ts +16 -0
  159. package/dist/esm/helpers/implicit-intersection.d.ts.map +1 -0
  160. package/dist/esm/helpers/implicit-intersection.js +184 -0
  161. package/dist/esm/print-settings.d.ts +105 -0
  162. package/dist/esm/print-settings.d.ts.map +1 -0
  163. package/dist/esm/print-settings.js +422 -0
  164. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
  165. package/package.json +3 -3
  166. package/xlsx.d.ts +14 -0
@@ -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,SAsnBX,CAAC"}
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,SA+lBX,CAAC"}
@@ -1053,7 +1053,7 @@ var buildDoughnutChart = function (domainRef, valueRef, title, subtitle) {
1053
1053
  };
1054
1054
  export var buildChartXml = function (chart, sheetNameById) {
1055
1055
  var e_3, _a, e_4, _b, e_5, _c;
1056
- var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10;
1056
+ var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8;
1057
1057
  var series = (_e = (_d = chart.spec) === null || _d === void 0 ? void 0 : _d.series) !== null && _e !== void 0 ? _e : [];
1058
1058
  if (!series.length)
1059
1059
  return undefined;
@@ -1093,7 +1093,7 @@ export var buildChartXml = function (chart, sheetNameById) {
1093
1093
  try {
1094
1094
  // Add chart type containers for each group
1095
1095
  for (var groups_1 = __values(groups), groups_1_1 = groups_1.next(); !groups_1_1.done; groups_1_1 = groups_1.next()) {
1096
- var _11 = __read(groups_1_1.value, 2), groupType = _11[0], groupSeries = _11[1];
1096
+ var _9 = __read(groups_1_1.value, 2), groupType = _9[0], groupSeries = _9[1];
1097
1097
  if (groupType === "bar" || groupType === "column") {
1098
1098
  var barChartNode = {
1099
1099
  "c:barDir": { a$: { val: groupType === "bar" ? "bar" : "col" } },
@@ -1104,7 +1104,7 @@ export var buildChartXml = function (chart, sheetNameById) {
1104
1104
  "c:axId": axisIds,
1105
1105
  };
1106
1106
  for (var i = 0; i < groupSeries.length; i++) {
1107
- var _12 = groupSeries[i], index = _12.index, ref = _12.ref, data = _12.data;
1107
+ var _10 = groupSeries[i], index = _10.index, ref = _10.ref, data = _10.data;
1108
1108
  var seriesNode = buildBarSeriesNode(index, ref, data, (_o = seriesCatRefs[index]) !== null && _o !== void 0 ? _o : domainRef, sheetName, i === 0);
1109
1109
  barChartNode["c:ser"].push(seriesNode);
1110
1110
  }
@@ -1120,7 +1120,7 @@ export var buildChartXml = function (chart, sheetNameById) {
1120
1120
  };
1121
1121
  try {
1122
1122
  for (var groupSeries_1 = (e_4 = void 0, __values(groupSeries)), groupSeries_1_1 = groupSeries_1.next(); !groupSeries_1_1.done; groupSeries_1_1 = groupSeries_1.next()) {
1123
- var _13 = groupSeries_1_1.value, index = _13.index, ref = _13.ref, data = _13.data;
1123
+ var _11 = groupSeries_1_1.value, index = _11.index, ref = _11.ref, data = _11.data;
1124
1124
  var seriesNode = buildLineSeriesNode(index, ref, data, (_p = seriesCatRefs[index]) !== null && _p !== void 0 ? _p : domainRef, sheetName, smooth);
1125
1125
  lineChartNode["c:ser"].push(seriesNode);
1126
1126
  }
@@ -1144,7 +1144,7 @@ export var buildChartXml = function (chart, sheetNameById) {
1144
1144
  };
1145
1145
  try {
1146
1146
  for (var groupSeries_2 = (e_5 = void 0, __values(groupSeries)), groupSeries_2_1 = groupSeries_2.next(); !groupSeries_2_1.done; groupSeries_2_1 = groupSeries_2.next()) {
1147
- var _14 = groupSeries_2_1.value, index = _14.index, ref = _14.ref, data = _14.data;
1147
+ var _12 = groupSeries_2_1.value, index = _12.index, ref = _12.ref, data = _12.data;
1148
1148
  var seriesNode = buildAreaSeriesNode(index, ref, data, (_q = seriesCatRefs[index]) !== null && _q !== void 0 ? _q : domainRef, sheetName);
1149
1149
  areaChartNode["c:ser"].push(seriesNode);
1150
1150
  }
@@ -1529,34 +1529,6 @@ export var buildChartXml = function (chart, sheetNameById) {
1529
1529
  targetChart["c:ser"] = seriesContainer_5;
1530
1530
  chartSpace["c:chartSpace"]["c:chart"] = chartDoc;
1531
1531
  }
1532
- else if (chartType === "treemap" || chartType === "sunburst") {
1533
- var treeSpec = chart.spec;
1534
- var labelRef = formatRangeRef(getPrimarySource((_9 = treeSpec.labels) === null || _9 === void 0 ? void 0 : _9[0]), sheetNameById);
1535
- var sizeRef = formatRangeRef(getPrimarySource((_10 = treeSpec.sizeData) === null || _10 === void 0 ? void 0 : _10[0]), sheetNameById);
1536
- if (!labelRef || !sizeRef)
1537
- return undefined;
1538
- if (chartType === "sunburst") {
1539
- var pieChart = buildPieChart(labelRef, sizeRef, chartTitle, chartSubtitle);
1540
- chartSpace["c:chartSpace"]["c:chart"] = pieChart;
1541
- }
1542
- else {
1543
- var columnChart = cloneTemplate(column_json);
1544
- applyChartTitle(columnChart, chartTitle, chartTitleFmt, chartSubtitle);
1545
- var bar = columnChart["c:plotArea"]["c:barChart"];
1546
- var seriesContainer = bar["c:ser"];
1547
- var seriesNode = cloneTemplate(column_series);
1548
- seriesNode["c:idx"] = { a$: { val: "0" } };
1549
- seriesNode["c:order"] = { a$: { val: "0" } };
1550
- seriesNode["c:cat"] = {
1551
- "c:strRef": {
1552
- "c:f": labelRef,
1553
- },
1554
- };
1555
- seriesNode["c:val"]["c:numRef"]["c:f"] = sizeRef;
1556
- seriesContainer.push(seriesNode);
1557
- chartSpace["c:chartSpace"]["c:chart"] = columnChart;
1558
- }
1559
- }
1560
1532
  else {
1561
1533
  return undefined;
1562
1534
  }
@@ -1565,6 +1537,12 @@ export var buildChartXml = function (chart, sheetNameById) {
1565
1537
  // chartType-agnostic and intentionally run last so per-type branches
1566
1538
  // don't have to know about them.
1567
1539
  applyChartFormatting(chartSpace, chart.spec, sheetNameById);
1540
+ // 3-D / surface variants (sourceChartType BAR_3D, LINE_3D, PIE_3D,
1541
+ // AREA_3D, SURFACE, SURFACE_3D) — swap the 2-D chart group for its
1542
+ // OOXML 3-D element and add `<c:view3D>`. Runs after the formatting
1543
+ // pass so data labels / overlays land in the container first and are
1544
+ // carried across by the rename.
1545
+ applyThreeDChartType(chartSpace["c:chartSpace"]["c:chart"], chart.spec.sourceChartType);
1568
1546
  // `<c:roundedCorners val="1"/>` lives at the chartSpace root (sibling
1569
1547
  // of `<c:chart>`). Default per OOXML §21.2.2.183 is `false`; only
1570
1548
  // emit when the spec opted in so files imported without the element
@@ -1575,6 +1553,204 @@ export var buildChartXml = function (chart, sheetNameById) {
1575
1553
  var xml = chartBuilder.build(chartSpace);
1576
1554
  return "".concat(XML_DECLARATION).concat(xml);
1577
1555
  };
1556
+ // -------------------------- 3-D / surface --------------------------
1557
+ /** Series-axis id for the 3-D chart groups that take a third axis. */
1558
+ var SER_AX_ID = "1789284465";
1559
+ /**
1560
+ * How each 3-D class maps onto its 2-D chart group: which container it
1561
+ * replaces, the element it becomes, and how many `<c:axId>` refs the
1562
+ * schema wants (0 = no axes, 3 = adds a series axis).
1563
+ */
1564
+ var THREE_D_CHART_GROUPS = {
1565
+ BAR_3D: { from: "c:barChart", to: "c:bar3DChart", axes: 2 },
1566
+ LINE_3D: { from: "c:lineChart", to: "c:line3DChart", axes: 3 },
1567
+ PIE_3D: { from: "c:pieChart", to: "c:pie3DChart", axes: 0 },
1568
+ AREA_3D: { from: "c:areaChart", to: "c:area3DChart", axes: 2 },
1569
+ SURFACE: { from: "c:areaChart", to: "c:surfaceChart", axes: 2 },
1570
+ SURFACE_3D: { from: "c:areaChart", to: "c:surface3DChart", axes: 3 },
1571
+ };
1572
+ var normalizeThreeDToken = function (value) {
1573
+ if (typeof value !== "string")
1574
+ return undefined;
1575
+ var token = value.trim().toUpperCase();
1576
+ return token in THREE_D_CHART_GROUPS ? token : undefined;
1577
+ };
1578
+ /** Copy `keys` (in order) from `source` into `target`, skipping absent ones. */
1579
+ var pickKeys = function (target, source, keys) {
1580
+ var e_6, _a;
1581
+ try {
1582
+ for (var keys_1 = __values(keys), keys_1_1 = keys_1.next(); !keys_1_1.done; keys_1_1 = keys_1.next()) {
1583
+ var key = keys_1_1.value;
1584
+ if (source[key] !== undefined)
1585
+ target[key] = source[key];
1586
+ }
1587
+ }
1588
+ catch (e_6_1) { e_6 = { error: e_6_1 }; }
1589
+ finally {
1590
+ try {
1591
+ if (keys_1_1 && !keys_1_1.done && (_a = keys_1.return)) _a.call(keys_1);
1592
+ }
1593
+ finally { if (e_6) throw e_6.error; }
1594
+ }
1595
+ };
1596
+ /**
1597
+ * Rebuild the 2-D chart group as its 3-D element with the CT_*3DChart
1598
+ * child sequence. Element order matters to Excel, so each shape is
1599
+ * written out explicitly rather than renaming the key in place:
1600
+ * bar3DChart: barDir, grouping, varyColors, ser, dLbls, gapWidth, shape, axId
1601
+ * line3DChart: grouping, varyColors, ser, dLbls, axId×3
1602
+ * pie3DChart: varyColors, ser, dLbls
1603
+ * area3DChart: grouping, varyColors, ser, dLbls, axId
1604
+ * surfaceChart: wireframe, ser, axId (surface3DChart: axId×3)
1605
+ */
1606
+ var buildThreeDChartGroup = function (token, group, axIds) {
1607
+ var node = {};
1608
+ switch (token) {
1609
+ case "BAR_3D":
1610
+ pickKeys(node, group, ["c:barDir", "c:grouping", "c:varyColors"]);
1611
+ pickKeys(node, group, ["c:ser", "c:dLbls", "c:gapWidth"]);
1612
+ node["c:shape"] = { a$: { val: "box" } };
1613
+ node["c:axId"] = axIds;
1614
+ return node;
1615
+ case "LINE_3D":
1616
+ case "AREA_3D":
1617
+ pickKeys(node, group, ["c:grouping", "c:varyColors", "c:ser", "c:dLbls"]);
1618
+ node["c:axId"] = axIds;
1619
+ return node;
1620
+ case "PIE_3D":
1621
+ pickKeys(node, group, ["c:varyColors", "c:ser", "c:dLbls"]);
1622
+ return node;
1623
+ case "SURFACE":
1624
+ case "SURFACE_3D":
1625
+ node["c:wireframe"] = { a$: { val: "0" } };
1626
+ pickKeys(node, group, ["c:ser"]);
1627
+ node["c:axId"] = axIds;
1628
+ return node;
1629
+ }
1630
+ };
1631
+ /** `<c:serAx>` for the 3-D groups whose schema takes a third (depth) axis. */
1632
+ var buildSerAxNode = function (valAxId) { return ({
1633
+ "c:axId": { a$: { val: SER_AX_ID } },
1634
+ "c:scaling": { "c:orientation": { a$: { val: "minMax" } } },
1635
+ "c:delete": { a$: { val: "0" } },
1636
+ "c:axPos": { a$: { val: "b" } },
1637
+ "c:majorTickMark": { a$: { val: "out" } },
1638
+ "c:minorTickMark": { a$: { val: "none" } },
1639
+ "c:tickLblPos": { a$: { val: "nextTo" } },
1640
+ "c:crossAx": { a$: { val: valAxId } },
1641
+ "c:crosses": { a$: { val: "autoZero" } },
1642
+ }); };
1643
+ /** `<c:view3D>` — Excel's default camera for each class (CT_View3D order). */
1644
+ var buildView3DNode = function (token) {
1645
+ if (token === "PIE_3D") {
1646
+ return {
1647
+ "c:rotX": { a$: { val: "30" } },
1648
+ "c:rotY": { a$: { val: "0" } },
1649
+ "c:rAngAx": { a$: { val: "0" } },
1650
+ };
1651
+ }
1652
+ if (token === "SURFACE" || token === "SURFACE_3D") {
1653
+ // Right-angle axes are not allowed on surfaces; use a perspective view.
1654
+ return {
1655
+ "c:rotX": { a$: { val: "15" } },
1656
+ "c:rotY": { a$: { val: "20" } },
1657
+ "c:rAngAx": { a$: { val: "0" } },
1658
+ "c:perspective": { a$: { val: "30" } },
1659
+ };
1660
+ }
1661
+ return {
1662
+ "c:rotX": { a$: { val: "15" } },
1663
+ "c:rotY": { a$: { val: "20" } },
1664
+ "c:rAngAx": { a$: { val: "1" } },
1665
+ };
1666
+ };
1667
+ /**
1668
+ * Turn an assembled 2-D `<c:chart>` into its 3-D variant when the spec
1669
+ * carries a 3-D `sourceChartType`: the chart group is swapped for the
1670
+ * matching `c:*3DChart` / `c:surfaceChart` element, a `<c:serAx>` is
1671
+ * added where the schema takes three axes, and `<c:view3D>` is inserted
1672
+ * before `<c:plotArea>`. No-op for 2-D specs or when the token doesn't
1673
+ * match the emitted chart group (the 2-D chart is left untouched).
1674
+ */
1675
+ var applyThreeDChartType = function (chartNode, sourceChartType) {
1676
+ var e_7, _a, e_8, _b, e_9, _c;
1677
+ var _d, _e, _f, _g, _h, _j;
1678
+ var token = normalizeThreeDToken(sourceChartType);
1679
+ if (!token || !chartNode)
1680
+ return;
1681
+ var plotArea = chartNode["c:plotArea"];
1682
+ if (!plotArea)
1683
+ return;
1684
+ var _k = THREE_D_CHART_GROUPS[token], from = _k.from, to = _k.to, axes = _k.axes;
1685
+ var group = plotArea[from];
1686
+ if (!group || Array.isArray(group))
1687
+ return;
1688
+ var existingAxIds = Array.isArray(group["c:axId"])
1689
+ ? group["c:axId"]
1690
+ : group["c:axId"]
1691
+ ? [group["c:axId"]]
1692
+ : [];
1693
+ 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";
1694
+ var axIds = axes === 3
1695
+ ? __spreadArray(__spreadArray([], __read(existingAxIds.slice(0, 2)), false), [{ a$: { val: SER_AX_ID } }], false) : existingAxIds.slice(0, 2);
1696
+ // Rebuild plotArea preserving element order, swapping the chart group
1697
+ // and appending the series axis after the value axis when needed.
1698
+ var rebuiltPlotArea = {};
1699
+ try {
1700
+ for (var _l = __values(Object.entries(plotArea)), _m = _l.next(); !_m.done; _m = _l.next()) {
1701
+ var _o = __read(_m.value, 2), key = _o[0], value = _o[1];
1702
+ if (key === from) {
1703
+ rebuiltPlotArea[to] = buildThreeDChartGroup(token, group, axIds);
1704
+ continue;
1705
+ }
1706
+ rebuiltPlotArea[key] = value;
1707
+ if (key === "c:valAx" && axes === 3) {
1708
+ rebuiltPlotArea["c:serAx"] = buildSerAxNode(valAxId);
1709
+ }
1710
+ }
1711
+ }
1712
+ catch (e_7_1) { e_7 = { error: e_7_1 }; }
1713
+ finally {
1714
+ try {
1715
+ if (_m && !_m.done && (_a = _l.return)) _a.call(_l);
1716
+ }
1717
+ finally { if (e_7) throw e_7.error; }
1718
+ }
1719
+ // Rebuild the chart node so `<c:view3D>` lands before `<c:plotArea>`.
1720
+ var rebuiltChart = {};
1721
+ try {
1722
+ for (var _p = __values(Object.entries(chartNode)), _q = _p.next(); !_q.done; _q = _p.next()) {
1723
+ var _r = __read(_q.value, 2), key = _r[0], value = _r[1];
1724
+ if (key === "c:plotArea") {
1725
+ rebuiltChart["c:view3D"] = buildView3DNode(token);
1726
+ rebuiltChart[key] = rebuiltPlotArea;
1727
+ continue;
1728
+ }
1729
+ rebuiltChart[key] = value;
1730
+ }
1731
+ }
1732
+ catch (e_8_1) { e_8 = { error: e_8_1 }; }
1733
+ finally {
1734
+ try {
1735
+ if (_q && !_q.done && (_b = _p.return)) _b.call(_p);
1736
+ }
1737
+ finally { if (e_8) throw e_8.error; }
1738
+ }
1739
+ try {
1740
+ for (var _s = __values(Object.keys(chartNode)), _t = _s.next(); !_t.done; _t = _s.next()) {
1741
+ var key = _t.value;
1742
+ delete chartNode[key];
1743
+ }
1744
+ }
1745
+ catch (e_9_1) { e_9 = { error: e_9_1 }; }
1746
+ finally {
1747
+ try {
1748
+ if (_t && !_t.done && (_c = _s.return)) _c.call(_s);
1749
+ }
1750
+ finally { if (e_9) throw e_9.error; }
1751
+ }
1752
+ Object.assign(chartNode, rebuiltChart);
1753
+ };
1578
1754
  // -------------------------- Phase 5 helpers --------------------------
1579
1755
  var LEGEND_POS = {
1580
1756
  top: "t",
@@ -1622,7 +1798,7 @@ var SERIES_CONTAINER_KEYS = [
1622
1798
  * matches the order emitted by the builder, so we index by position.
1623
1799
  */
1624
1800
  var applySeriesOverlays = function (plotArea, series, sheetNameById) {
1625
- var e_6, _a, e_7, _b;
1801
+ var e_10, _a, e_11, _b;
1626
1802
  if (!Array.isArray(series) || !series.length)
1627
1803
  return;
1628
1804
  var seriesIndex = 0;
@@ -1637,7 +1813,7 @@ var applySeriesOverlays = function (plotArea, series, sheetNameById) {
1637
1813
  continue;
1638
1814
  var list = Array.isArray(ser) ? ser : [ser];
1639
1815
  try {
1640
- for (var list_1 = (e_7 = void 0, __values(list)), list_1_1 = list_1.next(); !list_1_1.done; list_1_1 = list_1.next()) {
1816
+ 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
1817
  var node = list_1_1.value;
1642
1818
  var data = series[seriesIndex++];
1643
1819
  if (!data)
@@ -1657,21 +1833,21 @@ var applySeriesOverlays = function (plotArea, series, sheetNameById) {
1657
1833
  }
1658
1834
  }
1659
1835
  }
1660
- catch (e_7_1) { e_7 = { error: e_7_1 }; }
1836
+ catch (e_11_1) { e_11 = { error: e_11_1 }; }
1661
1837
  finally {
1662
1838
  try {
1663
1839
  if (list_1_1 && !list_1_1.done && (_b = list_1.return)) _b.call(list_1);
1664
1840
  }
1665
- finally { if (e_7) throw e_7.error; }
1841
+ finally { if (e_11) throw e_11.error; }
1666
1842
  }
1667
1843
  }
1668
1844
  }
1669
- catch (e_6_1) { e_6 = { error: e_6_1 }; }
1845
+ catch (e_10_1) { e_10 = { error: e_10_1 }; }
1670
1846
  finally {
1671
1847
  try {
1672
1848
  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
1849
  }
1674
- finally { if (e_6) throw e_6.error; }
1850
+ finally { if (e_10) throw e_10.error; }
1675
1851
  }
1676
1852
  };
1677
1853
  var buildTrendlineNode = function (t) {
@@ -0,0 +1,36 @@
1
+ import type { EmbeddedChart, SheetRange, TreemapChart } from "@rowsncolumns/spreadsheet";
2
+ /**
3
+ * Excel 2016+ "chartex" writer (`xl/charts/chartEx{N}.xml`) — the inverse
4
+ * of `excel-parser/plugins/xlsx/chartex.ts`. Treemap and sunburst have no
5
+ * `c:chartSpace` representation; Excel stores them as a `cx:chartSpace`
6
+ * whose series `layoutId` names the chart and whose data is a hierarchy
7
+ * `strDim type="cat"` (parent columns first, leaf last) plus a
8
+ * `numDim type="size"`. Anchored through `mc:AlternateContent` requiring the
9
+ * `cx1` namespace.
10
+ */
11
+ export declare const CHART_EX_REL_TYPE = "http://schemas.microsoft.com/office/2014/relationships/chartEx";
12
+ export declare const CHART_EX_CONTENT_TYPE = "application/vnd.ms-office.chartex+xml";
13
+ export declare const CHART_EX_NS = "http://schemas.microsoft.com/office/drawing/2014/chartex";
14
+ /** Chart types that live in a chartex part rather than a `c:chartSpace`. */
15
+ export declare const isChartExType: (chartType: string | undefined | null) => chartType is "treemap" | "sunburst";
16
+ /**
17
+ * The hierarchy reference: parent columns + the leaf column merged into one
18
+ * contiguous range when they sit side by side on the same sheet over the same
19
+ * rows (how Excel lays a treemap out); otherwise the leaf labels alone.
20
+ */
21
+ export declare const hierarchyRange: (spec: TreemapChart) => SheetRange | undefined;
22
+ /** `xl/charts/chartEx{N}.xml` for a treemap / sunburst; undefined when the spec has no data. */
23
+ export declare const buildChartExXml: (chart: EmbeddedChart, sheetNameById: Map<number, string>) => string | undefined;
24
+ /**
25
+ * The drawing anchor body for a chartex part: Excel's `mc:AlternateContent`
26
+ * with a `cx1`-requiring choice holding the graphic frame. No `mc:Fallback`
27
+ * is written — Excel opens the file without one, and a fallback text box
28
+ * would import as a stray shape in consumers that do not know chartex.
29
+ */
30
+ export declare const buildChartExGraphicFrameXml: ({ relId, frameId, widthEmu, heightEmu, }: {
31
+ relId: string;
32
+ frameId: number;
33
+ widthEmu: number;
34
+ heightEmu: number;
35
+ }) => string;
36
+ //# sourceMappingURL=chartex-builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chartex-builder.d.ts","sourceRoot":"","sources":["../../../../exporter/xlsx/chartex-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,aAAa,EACb,UAAU,EACV,YAAY,EACb,MAAM,2BAA2B,CAAC;AAGnC;;;;;;;;GAQG;AAEH,eAAO,MAAM,iBAAiB,mEACoC,CAAC;AACnE,eAAO,MAAM,qBAAqB,0CAA0C,CAAC;AAC7E,eAAO,MAAM,WAAW,6DAA6D,CAAC;AAyBtF,4EAA4E;AAC5E,eAAO,MAAM,aAAa,GAAI,WAAW,MAAM,GAAG,SAAS,GAAG,IAAI,wCACb,CAAC;AAItD;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM,YAAY,KAAG,UAAU,GAAG,SAsBhE,CAAC;AAEF,gGAAgG;AAChG,eAAO,MAAM,eAAe,GAC1B,OAAO,aAAa,EACpB,eAAe,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,KACjC,MAAM,GAAG,SAkCX,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,GAAI,0CAKzC;IACD,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB,WACkhB,CAAC"}
@@ -0,0 +1,109 @@
1
+ import { __assign, __read, __spreadArray } from "tslib";
2
+ import { cellRangeToAddress } from "@rowsncolumns/utils";
3
+ /**
4
+ * Excel 2016+ "chartex" writer (`xl/charts/chartEx{N}.xml`) — the inverse
5
+ * of `excel-parser/plugins/xlsx/chartex.ts`. Treemap and sunburst have no
6
+ * `c:chartSpace` representation; Excel stores them as a `cx:chartSpace`
7
+ * whose series `layoutId` names the chart and whose data is a hierarchy
8
+ * `strDim type="cat"` (parent columns first, leaf last) plus a
9
+ * `numDim type="size"`. Anchored through `mc:AlternateContent` requiring the
10
+ * `cx1` namespace.
11
+ */
12
+ export var CHART_EX_REL_TYPE = "http://schemas.microsoft.com/office/2014/relationships/chartEx";
13
+ export var CHART_EX_CONTENT_TYPE = "application/vnd.ms-office.chartex+xml";
14
+ export var CHART_EX_NS = "http://schemas.microsoft.com/office/drawing/2014/chartex";
15
+ var CHART_EX_1_NS = "http://schemas.microsoft.com/office/drawing/2015/9/8/chartex";
16
+ var A_NS = "http://schemas.openxmlformats.org/drawingml/2006/main";
17
+ var R_NS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
18
+ var MC_NS = "http://schemas.openxmlformats.org/markup-compatibility/2006";
19
+ var XML_DECLARATION = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n";
20
+ /** `{XXXXXXXX-XXXX-4XXX-XXXX-XXXXXXXXXXXX}` — the series `uniqueId` Excel expects. */
21
+ var guid = function () {
22
+ var hex = function () { return Math.floor(Math.random() * 16).toString(16).toUpperCase(); };
23
+ var block = function (n) { return Array.from({ length: n }, hex).join(""); };
24
+ return "{".concat(block(8), "-").concat(block(4), "-4").concat(block(3), "-").concat(block(4), "-").concat(block(12), "}");
25
+ };
26
+ /** `'Sheet'!A2:B9` → `'Sheet'!$A$2:$B$9` — Excel writes chart data references absolute. */
27
+ var absoluteRef = function (ref) {
28
+ var bang = ref.lastIndexOf("!");
29
+ var sheetPart = bang >= 0 ? ref.slice(0, bang + 1) : "";
30
+ var cells = bang >= 0 ? ref.slice(bang + 1) : ref;
31
+ return "".concat(sheetPart).concat(cells.replace(/\$?([A-Z]+)\$?(\d+)/g, "$$$1$$$2"));
32
+ };
33
+ var escapeText = function (value) {
34
+ return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
35
+ };
36
+ /** Chart types that live in a chartex part rather than a `c:chartSpace`. */
37
+ export var isChartExType = function (chartType) {
38
+ return chartType === "treemap" || chartType === "sunburst";
39
+ };
40
+ var primarySource = function (entry) { var _a; return (_a = entry === null || entry === void 0 ? void 0 : entry.sources) === null || _a === void 0 ? void 0 : _a[0]; };
41
+ /**
42
+ * The hierarchy reference: parent columns + the leaf column merged into one
43
+ * contiguous range when they sit side by side on the same sheet over the same
44
+ * rows (how Excel lays a treemap out); otherwise the leaf labels alone.
45
+ */
46
+ export var hierarchyRange = function (spec) {
47
+ var _a, _b;
48
+ var leaf = primarySource((_a = spec.labels) === null || _a === void 0 ? void 0 : _a[0]);
49
+ if (!leaf)
50
+ return undefined;
51
+ var parents = ((_b = spec.parentLabels) !== null && _b !== void 0 ? _b : [])
52
+ .map(function (entry) { return primarySource(entry); })
53
+ .filter(function (range) { return Boolean(range); });
54
+ if (!parents.length)
55
+ return leaf;
56
+ var sameRows = parents.every(function (p) {
57
+ return p.sheetId === leaf.sheetId &&
58
+ p.startRowIndex === leaf.startRowIndex &&
59
+ p.endRowIndex === leaf.endRowIndex;
60
+ });
61
+ if (!sameRows)
62
+ return leaf;
63
+ var columns = __spreadArray(__spreadArray([], __read(parents), false), [leaf], false).map(function (r) { return r.startColumnIndex; }).sort(function (a, b) { return a - b; });
64
+ var contiguous = columns.every(function (c, i) { return i === 0 || c === columns[i - 1] + 1; });
65
+ if (!contiguous || columns[columns.length - 1] !== leaf.startColumnIndex) {
66
+ return leaf;
67
+ }
68
+ return __assign(__assign({}, leaf), { startColumnIndex: columns[0], endColumnIndex: leaf.endColumnIndex });
69
+ };
70
+ /** `xl/charts/chartEx{N}.xml` for a treemap / sunburst; undefined when the spec has no data. */
71
+ export var buildChartExXml = function (chart, sheetNameById) {
72
+ var _a;
73
+ var spec = chart.spec;
74
+ if (!isChartExType(spec.chartType))
75
+ return undefined;
76
+ var cat = hierarchyRange(spec);
77
+ var size = primarySource((_a = spec.sizeData) === null || _a === void 0 ? void 0 : _a[0]);
78
+ if (!cat || !size)
79
+ return undefined;
80
+ var catAddress = cellRangeToAddress(sheetNameById.get(cat.sheetId), cat);
81
+ var sizeAddress = cellRangeToAddress(sheetNameById.get(size.sheetId), size);
82
+ if (!catAddress || !sizeAddress)
83
+ return undefined;
84
+ var catRef = absoluteRef(catAddress);
85
+ var sizeRef = absoluteRef(sizeAddress);
86
+ var title = chart.spec.title;
87
+ var titleXml = title
88
+ ? "<cx:title pos=\"t\" align=\"ctr\" overlay=\"0\"><cx:tx><cx:txData><cx:v>".concat(escapeText(title), "</cx:v></cx:txData></cx:tx></cx:title>")
89
+ : "";
90
+ var isTreemap = spec.chartType === "treemap";
91
+ var dataLabels = isTreemap
92
+ ? "<cx:dataLabels pos=\"inEnd\"><cx:visibility seriesName=\"0\" categoryName=\"1\" value=\"0\"/></cx:dataLabels>"
93
+ : "<cx:dataLabels><cx:visibility seriesName=\"0\" categoryName=\"1\" value=\"0\"/></cx:dataLabels>";
94
+ var layoutPr = isTreemap
95
+ ? "<cx:layoutPr><cx:parentLabelLayout val=\"banner\"/></cx:layoutPr>"
96
+ : "";
97
+ var legend = isTreemap ? "<cx:legend pos=\"t\" align=\"ctr\" overlay=\"0\"/>" : "";
98
+ return "".concat(XML_DECLARATION, "<cx:chartSpace xmlns:a=\"").concat(A_NS, "\" xmlns:r=\"").concat(R_NS, "\" xmlns:cx=\"").concat(CHART_EX_NS, "\"><cx:chartData><cx:data id=\"0\"><cx:strDim type=\"cat\"><cx:f>").concat(escapeText(catRef), "</cx:f></cx:strDim><cx:numDim type=\"size\"><cx:f>").concat(escapeText(sizeRef), "</cx:f></cx:numDim></cx:data></cx:chartData><cx:chart>").concat(titleXml, "<cx:plotArea><cx:plotAreaRegion><cx:series layoutId=\"").concat(spec.chartType, "\" uniqueId=\"").concat(guid(), "\">").concat(dataLabels, "<cx:dataId val=\"0\"/>").concat(layoutPr, "</cx:series></cx:plotAreaRegion></cx:plotArea>").concat(legend, "</cx:chart></cx:chartSpace>");
99
+ };
100
+ /**
101
+ * The drawing anchor body for a chartex part: Excel's `mc:AlternateContent`
102
+ * with a `cx1`-requiring choice holding the graphic frame. No `mc:Fallback`
103
+ * is written — Excel opens the file without one, and a fallback text box
104
+ * would import as a stray shape in consumers that do not know chartex.
105
+ */
106
+ export var buildChartExGraphicFrameXml = function (_a) {
107
+ var relId = _a.relId, frameId = _a.frameId, widthEmu = _a.widthEmu, heightEmu = _a.heightEmu;
108
+ return "<mc:AlternateContent xmlns:mc=\"".concat(MC_NS, "\"><mc:Choice xmlns:cx1=\"").concat(CHART_EX_1_NS, "\" Requires=\"cx1\"><xdr:graphicFrame macro=\"\"><xdr:nvGraphicFramePr><xdr:cNvPr id=\"").concat(frameId, "\" name=\"Chart ").concat(frameId, "\"/><xdr:cNvGraphicFramePr/></xdr:nvGraphicFramePr><xdr:xfrm><a:off x=\"0\" y=\"0\"/><a:ext cx=\"").concat(widthEmu, "\" cy=\"").concat(heightEmu, "\"/></xdr:xfrm><a:graphic><a:graphicData uri=\"").concat(CHART_EX_NS, "\"><cx:chart xmlns:cx=\"").concat(CHART_EX_NS, "\" xmlns:r=\"").concat(R_NS, "\" r:id=\"").concat(relId, "\"/></a:graphicData></a:graphic></xdr:graphicFrame></mc:Choice></mc:AlternateContent>");
109
+ };
@@ -0,0 +1,61 @@
1
+ import type { EmbedFormControlSpec } from "@rowsncolumns/spreadsheet";
2
+ /**
3
+ * Excel form-control writers — the inverse of
4
+ * `excel-parser/plugins/xlsx/form-controls.ts`. A control is three parts:
5
+ * the worksheet `<controls><control>` entry (anchor + `<controlPr>`), its
6
+ * `xl/ctrlProps/ctrlPropN.xml` (`<formControlPr>`), and the legacy VML shape
7
+ * Excel actually draws (`<v:shape type="#_x0000_t201"><x:ClientData
8
+ * ObjectType="Checkbox">`). All three are written; Excel drops a control
9
+ * whose VML shape is missing.
10
+ */
11
+ export declare const CTRL_PROP_CONTENT_TYPE = "application/vnd.ms-excel.controlproperties+xml";
12
+ export declare const CTRL_PROP_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/ctrlProp";
13
+ export declare const FORM_CONTROL_NS = "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main";
14
+ /** `xl/ctrlProps/ctrlPropN.xml` body. */
15
+ export declare const buildCtrlPropXml: (spec: EmbedFormControlSpec) => string;
16
+ /** A cell anchor in OOXML units: 0-based cell + EMU offsets. */
17
+ export type ControlCellAnchor = {
18
+ col: number;
19
+ colOff: number;
20
+ row: number;
21
+ rowOff: number;
22
+ };
23
+ /** One `<control>` element (inside the `<controls>` wrapper). */
24
+ export declare const buildControlElementXml: ({ spec, relId, shapeId, from, to, }: {
25
+ spec: EmbedFormControlSpec;
26
+ relId: string;
27
+ shapeId: number;
28
+ from: ControlCellAnchor;
29
+ to: ControlCellAnchor;
30
+ }) => string;
31
+ /**
32
+ * The worksheet `<controls>` element. Excel wraps controls in an
33
+ * `mc:AlternateContent` whose `Choice` requires the `x14` namespace; the
34
+ * namespaces the wrapper and the `xdr:` anchor cells need are declared on
35
+ * the element so the worksheet root stays untouched.
36
+ */
37
+ export declare const buildControlsXml: (controlElements: string[]) => string;
38
+ /** VML `<v:shapetype>` every form control references (`#_x0000_t201`). */
39
+ export declare const FORM_CONTROL_VML_SHAPETYPE = "<v:shapetype id=\"_x0000_t201\" coordsize=\"21600,21600\" o:spt=\"201\" path=\"m,l,21600r21600,l21600,xe\"><v:stroke joinstyle=\"miter\"/><v:path shadowok=\"f\" o:extrusionok=\"f\" strokeok=\"f\" fillok=\"f\" o:connecttype=\"rect\"/><o:lock v:ext=\"edit\" shapetype=\"t\"/></v:shapetype>";
40
+ /** Pixel geometry the VML shape needs (absolute position + cell-span anchor). */
41
+ export type FormControlVmlGeometry = {
42
+ leftPx: number;
43
+ topPx: number;
44
+ widthPx: number;
45
+ heightPx: number;
46
+ /** `x:Anchor` — from col, from col px offset, from row, from row px offset, to … */
47
+ anchor: [number, number, number, number, number, number, number, number];
48
+ };
49
+ /** One `<v:shape>` drawing a form control. */
50
+ export declare const buildFormControlVmlShape: ({ spec, shapeId, zIndex, geometry, }: {
51
+ spec: EmbedFormControlSpec;
52
+ shapeId: number;
53
+ zIndex: number;
54
+ geometry: FormControlVmlGeometry;
55
+ }) => string;
56
+ /** Wrap note + control shapes into one `vmlDrawing` part. */
57
+ export declare const buildVmlDrawingXml: ({ shapeTypes, shapes, }: {
58
+ shapeTypes: string[];
59
+ shapes: string[];
60
+ }) => string | undefined;
61
+ //# sourceMappingURL=form-controls-builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-controls-builder.d.ts","sourceRoot":"","sources":["../../../../exporter/xlsx/form-controls-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEtE;;;;;;;;GAQG;AAEH,eAAO,MAAM,sBAAsB,mDACe,CAAC;AACnD,eAAO,MAAM,kBAAkB,iFACiD,CAAC;AACjF,eAAO,MAAM,eAAe,kEACqC,CAAC;AAuBlE,yCAAyC;AACzC,eAAO,MAAM,gBAAgB,GAAI,MAAM,oBAAoB,KAAG,MAU7D,CAAC;AAEF,gEAAgE;AAChE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AASF,iEAAiE;AACjE,eAAO,MAAM,sBAAsB,GAAI,qCAMpC;IACD,IAAI,EAAE,oBAAoB,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,iBAAiB,CAAC;IACxB,EAAE,EAAE,iBAAiB,CAAC;CACvB,KAAG,MAaH,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAI,iBAAiB,MAAM,EAAE,KAAG,MAK5D,CAAC;AAmEF,0EAA0E;AAC1E,eAAO,MAAM,0BAA0B,oSAA4Q,CAAC;AAEpT,iFAAiF;AACjF,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,qFAAqF;IACrF,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1E,CAAC;AAIF,8CAA8C;AAC9C,eAAO,MAAM,wBAAwB,GAAI,sCAKtC;IACD,IAAI,EAAE,oBAAoB,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,sBAAsB,CAAC;CAClC,KAAG,MAmBH,CAAC;AAEF,6DAA6D;AAC7D,eAAO,MAAM,kBAAkB,GAAI,yBAGhC;IACD,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,KAAG,MAAM,GAAG,SAKZ,CAAC"}