pptx-angular-viewer 1.1.37 → 1.1.39
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.
|
@@ -14750,6 +14750,41 @@ function deleteTableColumn(tableData, colIdx) {
|
|
|
14750
14750
|
return { ...tableData, rows: newRows, columnWidths: newWidths };
|
|
14751
14751
|
}
|
|
14752
14752
|
|
|
14753
|
+
/**
|
|
14754
|
+
* Return a new `TablePptxElement` with the text of a single cell replaced.
|
|
14755
|
+
*
|
|
14756
|
+
* The element is not mutated: the affected row and cell are shallow-cloned and
|
|
14757
|
+
* every other row/cell is reused by reference. Returns the original element
|
|
14758
|
+
* unchanged when it carries no `tableData`.
|
|
14759
|
+
*
|
|
14760
|
+
* @param element - The source table element (not mutated).
|
|
14761
|
+
* @param rowIndex - Zero-based row index of the cell.
|
|
14762
|
+
* @param colIndex - Zero-based column index of the cell.
|
|
14763
|
+
* @param text - New plain-text content for the cell.
|
|
14764
|
+
* @returns A new `TablePptxElement` with the cell text applied.
|
|
14765
|
+
*
|
|
14766
|
+
* @example
|
|
14767
|
+
* ```ts
|
|
14768
|
+
* const updated = setCellText(el, 0, 1, "Revenue");
|
|
14769
|
+
* ```
|
|
14770
|
+
*/
|
|
14771
|
+
function setCellText(element, rowIndex, colIndex, text) {
|
|
14772
|
+
const tableData = element.tableData;
|
|
14773
|
+
if (!tableData) {
|
|
14774
|
+
return element;
|
|
14775
|
+
}
|
|
14776
|
+
const rows = tableData.rows.map((row, ri) => {
|
|
14777
|
+
if (ri !== rowIndex) {
|
|
14778
|
+
return row;
|
|
14779
|
+
}
|
|
14780
|
+
return {
|
|
14781
|
+
...row,
|
|
14782
|
+
cells: row.cells.map((cell, ci) => (ci === colIndex ? { ...cell, text } : cell)),
|
|
14783
|
+
};
|
|
14784
|
+
});
|
|
14785
|
+
return { ...element, tableData: { ...tableData, rows } };
|
|
14786
|
+
}
|
|
14787
|
+
|
|
14753
14788
|
/**
|
|
14754
14789
|
* Pure geometry helpers for the align / distribute editor operations.
|
|
14755
14790
|
*
|
|
@@ -35948,6 +35983,11 @@ function inputValue(event) {
|
|
|
35948
35983
|
*
|
|
35949
35984
|
* @module angular-viewer/table-data-helpers
|
|
35950
35985
|
*/
|
|
35986
|
+
// `setCellText` is the framework-agnostic single-cell text edit. It lives in
|
|
35987
|
+
// `pptx-viewer-shared` (`render/table-cell-edit`) so the three bindings share
|
|
35988
|
+
// one copy; Angular consumes the vendored, inlined copy under
|
|
35989
|
+
// `../internal/shared-src`. Re-exported here so existing consumers and the
|
|
35990
|
+
// colocated test keep importing it from this module unchanged.
|
|
35951
35991
|
// ---------------------------------------------------------------------------
|
|
35952
35992
|
// Internal utilities
|
|
35953
35993
|
// ---------------------------------------------------------------------------
|
|
@@ -35984,39 +36024,6 @@ function clearAllMerges(rows) {
|
|
|
35984
36024
|
}));
|
|
35985
36025
|
}
|
|
35986
36026
|
// ---------------------------------------------------------------------------
|
|
35987
|
-
// setCellText
|
|
35988
|
-
// ---------------------------------------------------------------------------
|
|
35989
|
-
/**
|
|
35990
|
-
* Return a new `TablePptxElement` with the text of a single cell updated.
|
|
35991
|
-
*
|
|
35992
|
-
* @param element - The source table element (not mutated).
|
|
35993
|
-
* @param rowIndex - Zero-based row index.
|
|
35994
|
-
* @param colIndex - Zero-based column index.
|
|
35995
|
-
* @param text - New text content for the cell.
|
|
35996
|
-
* @returns A new `TablePptxElement`.
|
|
35997
|
-
*
|
|
35998
|
-
* @example
|
|
35999
|
-
* ```ts
|
|
36000
|
-
* const updated = setCellText(el, 0, 1, "Revenue");
|
|
36001
|
-
* ```
|
|
36002
|
-
*/
|
|
36003
|
-
function setCellText(element, rowIndex, colIndex, text) {
|
|
36004
|
-
const tableData = element.tableData;
|
|
36005
|
-
if (!tableData) {
|
|
36006
|
-
return element;
|
|
36007
|
-
}
|
|
36008
|
-
const rows = tableData.rows.map((row, ri) => {
|
|
36009
|
-
if (ri !== rowIndex) {
|
|
36010
|
-
return row;
|
|
36011
|
-
}
|
|
36012
|
-
return {
|
|
36013
|
-
...row,
|
|
36014
|
-
cells: row.cells.map((cell, ci) => (ci === colIndex ? { ...cell, text } : cell)),
|
|
36015
|
-
};
|
|
36016
|
-
});
|
|
36017
|
-
return { ...element, tableData: { ...tableData, rows } };
|
|
36018
|
-
}
|
|
36019
|
-
// ---------------------------------------------------------------------------
|
|
36020
36027
|
// addTableRow
|
|
36021
36028
|
// ---------------------------------------------------------------------------
|
|
36022
36029
|
/**
|