xlsx-template-browser 0.3.0 → 0.3.1
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/README.md +7 -0
- package/dist/index.cjs +52 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +52 -8
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -543,6 +543,10 @@ var getReplacements = (oldValues, dataStore) => {
|
|
|
543
543
|
}
|
|
544
544
|
const isTable = typeof match.groups.table === "string";
|
|
545
545
|
const value = dataStore.get(match.groups.accessor);
|
|
546
|
+
if (typeof value !== "object") {
|
|
547
|
+
replacements.set(String(index), "");
|
|
548
|
+
continue;
|
|
549
|
+
}
|
|
546
550
|
const cloned = structuredClone(value);
|
|
547
551
|
if (isTable) Object.defineProperty(cloned, "$isTable", { value: true, enumerable: false });
|
|
548
552
|
replacements.set(String(index), cloned);
|
|
@@ -1185,13 +1189,23 @@ var getConditionalFormatting = (xml) => {
|
|
|
1185
1189
|
rows: 0,
|
|
1186
1190
|
cols: 0
|
|
1187
1191
|
};
|
|
1192
|
+
let columnExtension = 0;
|
|
1193
|
+
let rowExtension = 0;
|
|
1194
|
+
let currentRow = 0;
|
|
1188
1195
|
const extend = (cell) => {
|
|
1189
1196
|
if (Array.isArray(cell.newValue)) {
|
|
1197
|
+
if (cell.row !== currentRow) {
|
|
1198
|
+
currentRow = cell.row;
|
|
1199
|
+
columnExtension = 0;
|
|
1200
|
+
rowExtension = 0;
|
|
1201
|
+
}
|
|
1190
1202
|
const length = cell.newValue.length - 1;
|
|
1191
1203
|
if ("$isTable" in cell.newValue) {
|
|
1192
|
-
|
|
1204
|
+
rowExtension = Math.max(length, rowExtension) - Math.min(length, rowExtension);
|
|
1205
|
+
extension.rows = extension.rows + rowExtension;
|
|
1193
1206
|
} else {
|
|
1194
|
-
|
|
1207
|
+
columnExtension = columnExtension + length;
|
|
1208
|
+
extension.cols = Math.max(columnExtension, extension.cols);
|
|
1195
1209
|
}
|
|
1196
1210
|
}
|
|
1197
1211
|
};
|
|
@@ -1277,6 +1291,9 @@ var getTables = async ({
|
|
|
1277
1291
|
return h;
|
|
1278
1292
|
});
|
|
1279
1293
|
};
|
|
1294
|
+
let columnExtension = 0;
|
|
1295
|
+
let rowExtension = 0;
|
|
1296
|
+
let currentRow = 0;
|
|
1280
1297
|
const extend = (cell) => {
|
|
1281
1298
|
const t = tables.get(file);
|
|
1282
1299
|
if (t === void 0) return;
|
|
@@ -1292,11 +1309,18 @@ var getTables = async ({
|
|
|
1292
1309
|
}
|
|
1293
1310
|
}
|
|
1294
1311
|
if (Array.isArray(cell.newValue)) {
|
|
1312
|
+
if (cell.row !== currentRow) {
|
|
1313
|
+
currentRow = cell.row;
|
|
1314
|
+
columnExtension = 0;
|
|
1315
|
+
rowExtension = 0;
|
|
1316
|
+
}
|
|
1295
1317
|
const length = cell.newValue.length - 1;
|
|
1296
1318
|
if ("$isTable" in cell.newValue) {
|
|
1297
|
-
|
|
1319
|
+
rowExtension = Math.max(length, rowExtension) - Math.min(length, rowExtension);
|
|
1320
|
+
t.extension.rows = t.extension.rows + rowExtension;
|
|
1298
1321
|
} else {
|
|
1299
|
-
|
|
1322
|
+
columnExtension = columnExtension + length;
|
|
1323
|
+
t.extension.cols = Math.max(columnExtension, t.extension.cols);
|
|
1300
1324
|
}
|
|
1301
1325
|
}
|
|
1302
1326
|
t.isDirty = true;
|
|
@@ -1749,13 +1773,23 @@ var getPivotTables = async (xlsx) => {
|
|
|
1749
1773
|
rows: 0,
|
|
1750
1774
|
cols: 0
|
|
1751
1775
|
};
|
|
1776
|
+
let columnExtension = 0;
|
|
1777
|
+
let rowExtension = 0;
|
|
1778
|
+
let currentRow = 0;
|
|
1752
1779
|
const extend = (cell) => {
|
|
1753
1780
|
if (Array.isArray(cell.newValue)) {
|
|
1781
|
+
if (cell.row !== currentRow) {
|
|
1782
|
+
currentRow = cell.row;
|
|
1783
|
+
columnExtension = 0;
|
|
1784
|
+
rowExtension = 0;
|
|
1785
|
+
}
|
|
1754
1786
|
const length = cell.newValue.length - 1;
|
|
1755
1787
|
if ("$isTable" in cell.newValue) {
|
|
1756
|
-
|
|
1788
|
+
rowExtension = Math.max(length, rowExtension) - Math.min(length, rowExtension);
|
|
1789
|
+
extension.rows = extension.rows + rowExtension;
|
|
1757
1790
|
} else {
|
|
1758
|
-
|
|
1791
|
+
columnExtension = columnExtension + length;
|
|
1792
|
+
extension.cols = Math.max(columnExtension, extension.cols);
|
|
1759
1793
|
}
|
|
1760
1794
|
}
|
|
1761
1795
|
};
|
|
@@ -1873,13 +1907,23 @@ var getDataValidations = (sheets) => {
|
|
|
1873
1907
|
validation.listRange.range = parseCellRange(reference.ref);
|
|
1874
1908
|
}
|
|
1875
1909
|
}
|
|
1910
|
+
let columnExtension = 0;
|
|
1911
|
+
let rowExtension = 0;
|
|
1912
|
+
let currentRow = 0;
|
|
1876
1913
|
const extend = (cell) => {
|
|
1877
1914
|
if (Array.isArray(cell.newValue)) {
|
|
1915
|
+
if (cell.row !== currentRow) {
|
|
1916
|
+
currentRow = cell.row;
|
|
1917
|
+
columnExtension = 0;
|
|
1918
|
+
rowExtension = 0;
|
|
1919
|
+
}
|
|
1878
1920
|
const length = cell.newValue.length - 1;
|
|
1879
1921
|
if ("$isTable" in cell.newValue) {
|
|
1880
|
-
|
|
1922
|
+
rowExtension = Math.max(length, rowExtension) - Math.min(length, rowExtension);
|
|
1923
|
+
extension.rows = extension.rows + rowExtension;
|
|
1881
1924
|
} else {
|
|
1882
|
-
|
|
1925
|
+
columnExtension = columnExtension + length;
|
|
1926
|
+
extension.cols = Math.max(columnExtension, extension.cols);
|
|
1883
1927
|
}
|
|
1884
1928
|
}
|
|
1885
1929
|
};
|