ooxml-core 1.8.1 → 1.8.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.
@@ -16570,10 +16570,10 @@ function patchChartColors(doc, chartNode, model, before) {
16570
16570
  const xml = fill ? drawingFillXml(fill) : color2 ? `<a:solidFill>${drawingColorXml(color2)}</a:solidFill>` : void 0;
16571
16571
  let spPr = first(point2, "spPr", NS.c);
16572
16572
  if (!xml) {
16573
- let paint2 = fillElementOf(spPr);
16574
- while (paint2 && spPr) {
16575
- spPr.removeChild(paint2);
16576
- paint2 = fillElementOf(spPr);
16573
+ if (spPr) {
16574
+ for (let paint2 = fillElementOf(spPr); paint2; paint2 = fillElementOf(spPr)) {
16575
+ spPr.removeChild(paint2);
16576
+ }
16577
16577
  }
16578
16578
  continue;
16579
16579
  }
@@ -18312,7 +18312,7 @@ function stack(ctx, args, vertical) {
18312
18312
  function flatten(ctx, args) {
18313
18313
  const m = ctx.toMatrix(args[0] ?? null);
18314
18314
  const ignore = intAt(ctx, args, 1) ?? 0;
18315
- const byCol = intAt(ctx, args, 2) ? true : false;
18315
+ const byCol = Boolean(intAt(ctx, args, 2));
18316
18316
  const values2 = [];
18317
18317
  const rows = byCol ? m.cols : m.rows;
18318
18318
  const cols = byCol ? m.rows : m.cols;
@@ -21546,7 +21546,7 @@ function ifFn(args, ctx) {
21546
21546
  const branch = (truthy) => {
21547
21547
  const arg = args[truthy ? 1 : 2];
21548
21548
  if (arg) return arg.get();
21549
- return truthy ? true : false;
21549
+ return truthy;
21550
21550
  };
21551
21551
  if (cond instanceof Matrix) return elementwise(cond, branch, ctx);
21552
21552
  if (isError(cond)) return cond;
@@ -30146,8 +30146,8 @@ function protectionXml2(sheet) {
30146
30146
  values2["sheet"] = protection2.sheet || void 0;
30147
30147
  const allow = new Set(protection2.allow ?? []);
30148
30148
  if (protection2.sheet) {
30149
- values2["objects"] = allow.has("objects") ? false : true;
30150
- values2["scenarios"] = allow.has("scenarios") ? false : true;
30149
+ values2["objects"] = !allow.has("objects");
30150
+ values2["scenarios"] = !allow.has("scenarios");
30151
30151
  }
30152
30152
  for (const name3 of allow) values2[name3] = false;
30153
30153
  return el3("sheetProtection", values2);
@@ -33196,6 +33196,7 @@ function sortRows2(sheet, range2, keys, hasHeader) {
33196
33196
  const sortKeys2 = keys.length ? keys : [{ col: r.start.col }];
33197
33197
  const rows = [];
33198
33198
  for (let row3 = firstRow; row3 <= lastRow; row3++) {
33199
+ if (sheet.rowInfo.get(row3)?.hidden) continue;
33199
33200
  const cells3 = /* @__PURE__ */ new Map();
33200
33201
  for (const [col, cell] of sheet.rows.get(row3) ?? [])
33201
33202
  if (col >= r.start.col && col <= r.end.col) cells3.set(col, cell);
@@ -33213,9 +33214,9 @@ function sortRows2(sheet, range2, keys, hasHeader) {
33213
33214
  return 0;
33214
33215
  });
33215
33216
  for (const { row: row3, cells: cells3 } of rows) for (const col of cells3.keys()) deleteCell(sheet, row3, col);
33216
- moveAnnotations(sheet, dataArea, new Map(sorted2.map((source2, i2) => [source2.row, firstRow + i2])));
33217
+ moveAnnotations(sheet, dataArea, new Map(sorted2.map((source2, i2) => [source2.row, rows[i2].row])));
33217
33218
  sorted2.forEach((source2, i2) => {
33218
- const row3 = firstRow + i2;
33219
+ const row3 = rows[i2].row;
33219
33220
  const dRow = row3 - source2.row;
33220
33221
  for (const [col, cell] of source2.cells) {
33221
33222
  if (cell.formula !== void 0 && dRow) {
@@ -16564,10 +16564,10 @@ function patchChartColors(doc, chartNode, model, before) {
16564
16564
  const xml = fill ? drawingFillXml(fill) : color2 ? `<a:solidFill>${drawingColorXml(color2)}</a:solidFill>` : void 0;
16565
16565
  let spPr = first(point2, "spPr", NS.c);
16566
16566
  if (!xml) {
16567
- let paint2 = fillElementOf(spPr);
16568
- while (paint2 && spPr) {
16569
- spPr.removeChild(paint2);
16570
- paint2 = fillElementOf(spPr);
16567
+ if (spPr) {
16568
+ for (let paint2 = fillElementOf(spPr); paint2; paint2 = fillElementOf(spPr)) {
16569
+ spPr.removeChild(paint2);
16570
+ }
16571
16571
  }
16572
16572
  continue;
16573
16573
  }
@@ -18306,7 +18306,7 @@ function stack(ctx, args, vertical) {
18306
18306
  function flatten(ctx, args) {
18307
18307
  const m = ctx.toMatrix(args[0] ?? null);
18308
18308
  const ignore = intAt(ctx, args, 1) ?? 0;
18309
- const byCol = intAt(ctx, args, 2) ? true : false;
18309
+ const byCol = Boolean(intAt(ctx, args, 2));
18310
18310
  const values2 = [];
18311
18311
  const rows = byCol ? m.cols : m.rows;
18312
18312
  const cols = byCol ? m.rows : m.cols;
@@ -21540,7 +21540,7 @@ function ifFn(args, ctx) {
21540
21540
  const branch = (truthy) => {
21541
21541
  const arg = args[truthy ? 1 : 2];
21542
21542
  if (arg) return arg.get();
21543
- return truthy ? true : false;
21543
+ return truthy;
21544
21544
  };
21545
21545
  if (cond instanceof Matrix) return elementwise(cond, branch, ctx);
21546
21546
  if (isError(cond)) return cond;
@@ -30140,8 +30140,8 @@ function protectionXml2(sheet) {
30140
30140
  values2["sheet"] = protection2.sheet || void 0;
30141
30141
  const allow = new Set(protection2.allow ?? []);
30142
30142
  if (protection2.sheet) {
30143
- values2["objects"] = allow.has("objects") ? false : true;
30144
- values2["scenarios"] = allow.has("scenarios") ? false : true;
30143
+ values2["objects"] = !allow.has("objects");
30144
+ values2["scenarios"] = !allow.has("scenarios");
30145
30145
  }
30146
30146
  for (const name3 of allow) values2[name3] = false;
30147
30147
  return el3("sheetProtection", values2);
@@ -33190,6 +33190,7 @@ function sortRows2(sheet, range2, keys, hasHeader) {
33190
33190
  const sortKeys2 = keys.length ? keys : [{ col: r.start.col }];
33191
33191
  const rows = [];
33192
33192
  for (let row3 = firstRow; row3 <= lastRow; row3++) {
33193
+ if (sheet.rowInfo.get(row3)?.hidden) continue;
33193
33194
  const cells3 = /* @__PURE__ */ new Map();
33194
33195
  for (const [col, cell] of sheet.rows.get(row3) ?? [])
33195
33196
  if (col >= r.start.col && col <= r.end.col) cells3.set(col, cell);
@@ -33207,9 +33208,9 @@ function sortRows2(sheet, range2, keys, hasHeader) {
33207
33208
  return 0;
33208
33209
  });
33209
33210
  for (const { row: row3, cells: cells3 } of rows) for (const col of cells3.keys()) deleteCell(sheet, row3, col);
33210
- moveAnnotations(sheet, dataArea, new Map(sorted2.map((source2, i2) => [source2.row, firstRow + i2])));
33211
+ moveAnnotations(sheet, dataArea, new Map(sorted2.map((source2, i2) => [source2.row, rows[i2].row])));
33211
33212
  sorted2.forEach((source2, i2) => {
33212
- const row3 = firstRow + i2;
33213
+ const row3 = rows[i2].row;
33213
33214
  const dRow = row3 - source2.row;
33214
33215
  for (const [col, cell] of source2.cells) {
33215
33216
  if (cell.formula !== void 0 && dRow) {
@@ -3935,10 +3935,10 @@ function patchChartColors(doc, chartNode, model, before) {
3935
3935
  const xml = fill ? drawingFillXml(fill) : color ? `<a:solidFill>${drawingColorXml(color)}</a:solidFill>` : void 0;
3936
3936
  let spPr = first(point, "spPr", NS.c);
3937
3937
  if (!xml) {
3938
- let paint = fillElementOf(spPr);
3939
- while (paint && spPr) {
3940
- spPr.removeChild(paint);
3941
- paint = fillElementOf(spPr);
3938
+ if (spPr) {
3939
+ for (let paint = fillElementOf(spPr); paint; paint = fillElementOf(spPr)) {
3940
+ spPr.removeChild(paint);
3941
+ }
3942
3942
  }
3943
3943
  continue;
3944
3944
  }
@@ -7961,7 +7961,7 @@ function stack(ctx, args, vertical) {
7961
7961
  function flatten(ctx, args) {
7962
7962
  const m = ctx.toMatrix(args[0] ?? null);
7963
7963
  const ignore = intAt(ctx, args, 1) ?? 0;
7964
- const byCol = intAt(ctx, args, 2) ? true : false;
7964
+ const byCol = Boolean(intAt(ctx, args, 2));
7965
7965
  const values2 = [];
7966
7966
  const rows = byCol ? m.cols : m.rows;
7967
7967
  const cols = byCol ? m.rows : m.cols;
@@ -11087,7 +11087,7 @@ function ifFn(args, ctx) {
11087
11087
  const branch = (truthy) => {
11088
11088
  const arg = args[truthy ? 1 : 2];
11089
11089
  if (arg) return arg.get();
11090
- return truthy ? true : false;
11090
+ return truthy;
11091
11091
  };
11092
11092
  if (cond instanceof Matrix) return elementwise(cond, branch, ctx);
11093
11093
  if (isError(cond)) return cond;
@@ -19629,8 +19629,8 @@ function protectionXml2(sheet) {
19629
19629
  values2["sheet"] = protection.sheet || void 0;
19630
19630
  const allow = new Set(protection.allow ?? []);
19631
19631
  if (protection.sheet) {
19632
- values2["objects"] = allow.has("objects") ? false : true;
19633
- values2["scenarios"] = allow.has("scenarios") ? false : true;
19632
+ values2["objects"] = !allow.has("objects");
19633
+ values2["scenarios"] = !allow.has("scenarios");
19634
19634
  }
19635
19635
  for (const name of allow) values2[name] = false;
19636
19636
  return el("sheetProtection", values2);
@@ -3908,10 +3908,10 @@ function patchChartColors(doc, chartNode, model, before) {
3908
3908
  const xml = fill ? drawingFillXml(fill) : color ? `<a:solidFill>${drawingColorXml(color)}</a:solidFill>` : void 0;
3909
3909
  let spPr = first(point, "spPr", NS.c);
3910
3910
  if (!xml) {
3911
- let paint = fillElementOf(spPr);
3912
- while (paint && spPr) {
3913
- spPr.removeChild(paint);
3914
- paint = fillElementOf(spPr);
3911
+ if (spPr) {
3912
+ for (let paint = fillElementOf(spPr); paint; paint = fillElementOf(spPr)) {
3913
+ spPr.removeChild(paint);
3914
+ }
3915
3915
  }
3916
3916
  continue;
3917
3917
  }
@@ -7934,7 +7934,7 @@ function stack(ctx, args, vertical) {
7934
7934
  function flatten(ctx, args) {
7935
7935
  const m = ctx.toMatrix(args[0] ?? null);
7936
7936
  const ignore = intAt(ctx, args, 1) ?? 0;
7937
- const byCol = intAt(ctx, args, 2) ? true : false;
7937
+ const byCol = Boolean(intAt(ctx, args, 2));
7938
7938
  const values2 = [];
7939
7939
  const rows = byCol ? m.cols : m.rows;
7940
7940
  const cols = byCol ? m.rows : m.cols;
@@ -11060,7 +11060,7 @@ function ifFn(args, ctx) {
11060
11060
  const branch = (truthy) => {
11061
11061
  const arg = args[truthy ? 1 : 2];
11062
11062
  if (arg) return arg.get();
11063
- return truthy ? true : false;
11063
+ return truthy;
11064
11064
  };
11065
11065
  if (cond instanceof Matrix) return elementwise(cond, branch, ctx);
11066
11066
  if (isError(cond)) return cond;
@@ -19602,8 +19602,8 @@ function protectionXml2(sheet) {
19602
19602
  values2["sheet"] = protection.sheet || void 0;
19603
19603
  const allow = new Set(protection.allow ?? []);
19604
19604
  if (protection.sheet) {
19605
- values2["objects"] = allow.has("objects") ? false : true;
19606
- values2["scenarios"] = allow.has("scenarios") ? false : true;
19605
+ values2["objects"] = !allow.has("objects");
19606
+ values2["scenarios"] = !allow.has("scenarios");
19607
19607
  }
19608
19608
  for (const name of allow) values2[name] = false;
19609
19609
  return el("sheetProtection", values2);
@@ -29385,7 +29385,9 @@ function step2(density, spacing, zoom) {
29385
29385
  if (density === 0 && spacing > 0) return spacing;
29386
29386
  const level = Math.max(-6, Math.min(6, Math.floor(Math.log2(zoom > 0 ? zoom : 1) + 1e-9)));
29387
29387
  let value = base2 / 2 ** level;
29388
- while (spacing > 0 && value < spacing - 1e-9) value *= 2;
29388
+ if (spacing > 0) {
29389
+ while (value < spacing - 1e-9) value *= 2;
29390
+ }
29389
29391
  return value;
29390
29392
  }
29391
29393
  function visioGridSteps(page, zoom = 1) {
@@ -29379,7 +29379,9 @@ function step2(density, spacing, zoom) {
29379
29379
  if (density === 0 && spacing > 0) return spacing;
29380
29380
  const level = Math.max(-6, Math.min(6, Math.floor(Math.log2(zoom > 0 ? zoom : 1) + 1e-9)));
29381
29381
  let value = base2 / 2 ** level;
29382
- while (spacing > 0 && value < spacing - 1e-9) value *= 2;
29382
+ if (spacing > 0) {
29383
+ while (value < spacing - 1e-9) value *= 2;
29384
+ }
29383
29385
  return value;
29384
29386
  }
29385
29387
  function visioGridSteps(page, zoom = 1) {
@@ -1 +1 @@
1
- {"version":3,"file":"ruler-grid.d.ts","sourceRoot":"","sources":["../../../visio/ui/ruler-grid.ts"],"names":[],"mappings":"AAAA,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BAAoB,GAAG,SAAS,EAAE,CAW9F"}
@@ -10,7 +10,7 @@ export interface SortKey {
10
10
  * text compares case-insensitively.
11
11
  */
12
12
  export declare function compareCellValues(a: CellValue, b: CellValue, descending?: boolean): number;
13
- /** Sorts rows of a range in place (no undo step). Exported for the auto-filter sort. */
13
+ /** Sorts visible rows in place, leaving hidden rows untouched. Used by the auto-filter sort. */
14
14
  export declare function sortRows(sheet: Worksheet, range: CellRange, keys: SortKey[], hasHeader: boolean): void;
15
15
  /** Sorts the rows of `range` by `keys` (absolute column indices), stable, header kept in place. */
16
16
  export declare function sortRange(ctx: EditContext, s: number, range: CellRange, keys: SortKey[], hasHeader: boolean): void;
@@ -1 +1 @@
1
- {"version":3,"file":"sort.d.ts","sourceRoot":"","sources":["../../../xlsx/edit/sort.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAmC,MAAM,YAAY,CAAC;AAE7E,OAAO,KAAK,EAAQ,SAAS,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE3D,OAAO,EAAE,KAAK,WAAW,EAAW,MAAM,WAAW,CAAC;AAItD,MAAM,WAAW,OAAO;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,OAAO,CAAC;CACrB;AAeD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,UAAU,UAAQ,GAAG,MAAM,CAaxF;AAED,wFAAwF;AACxF,wBAAgB,QAAQ,CACvB,KAAK,EAAE,SAAS,EAChB,KAAK,EAAE,SAAS,EAChB,IAAI,EAAE,OAAO,EAAE,EACf,SAAS,EAAE,OAAO,GAChB,IAAI,CAiDN;AAsBD,mGAAmG;AACnG,wBAAgB,SAAS,CACxB,GAAG,EAAE,WAAW,EAChB,CAAC,EAAE,MAAM,EACT,KAAK,EAAE,SAAS,EAChB,IAAI,EAAE,OAAO,EAAE,EACf,SAAS,EAAE,OAAO,GAChB,IAAI,CAUN"}
1
+ {"version":3,"file":"sort.d.ts","sourceRoot":"","sources":["../../../xlsx/edit/sort.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAmC,MAAM,YAAY,CAAC;AAE7E,OAAO,KAAK,EAAQ,SAAS,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE3D,OAAO,EAAE,KAAK,WAAW,EAAW,MAAM,WAAW,CAAC;AAItD,MAAM,WAAW,OAAO;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,OAAO,CAAC;CACrB;AAeD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,UAAU,UAAQ,GAAG,MAAM,CAaxF;AAED,gGAAgG;AAChG,wBAAgB,QAAQ,CACvB,KAAK,EAAE,SAAS,EAChB,KAAK,EAAE,SAAS,EAChB,IAAI,EAAE,OAAO,EAAE,EACf,SAAS,EAAE,OAAO,GAChB,IAAI,CAkDN;AAsBD,mGAAmG;AACnG,wBAAgB,SAAS,CACxB,GAAG,EAAE,WAAW,EAChB,CAAC,EAAE,MAAM,EACT,KAAK,EAAE,SAAS,EAChB,IAAI,EAAE,OAAO,EAAE,EACf,SAAS,EAAE,OAAO,GAChB,IAAI,CAUN"}
@@ -3561,7 +3561,7 @@ function stack(ctx, args, vertical) {
3561
3561
  function flatten(ctx, args) {
3562
3562
  const m = ctx.toMatrix(args[0] ?? null);
3563
3563
  const ignore = intAt(ctx, args, 1) ?? 0;
3564
- const byCol = intAt(ctx, args, 2) ? true : false;
3564
+ const byCol = Boolean(intAt(ctx, args, 2));
3565
3565
  const values2 = [];
3566
3566
  const rows = byCol ? m.cols : m.rows;
3567
3567
  const cols = byCol ? m.rows : m.cols;
@@ -6795,7 +6795,7 @@ function ifFn(args, ctx) {
6795
6795
  const branch = (truthy) => {
6796
6796
  const arg = args[truthy ? 1 : 2];
6797
6797
  if (arg) return arg.get();
6798
- return truthy ? true : false;
6798
+ return truthy;
6799
6799
  };
6800
6800
  if (cond instanceof Matrix) return elementwise(cond, branch, ctx);
6801
6801
  if (isError(cond)) return cond;
@@ -21950,10 +21950,10 @@ function patchChartColors(doc, chartNode, model, before) {
21950
21950
  const xml = fill ? drawingFillXml(fill) : color ? `<a:solidFill>${drawingColorXml(color)}</a:solidFill>` : void 0;
21951
21951
  let spPr = first(point, "spPr", NS.c);
21952
21952
  if (!xml) {
21953
- let paint = fillElementOf(spPr);
21954
- while (paint && spPr) {
21955
- spPr.removeChild(paint);
21956
- paint = fillElementOf(spPr);
21953
+ if (spPr) {
21954
+ for (let paint = fillElementOf(spPr); paint; paint = fillElementOf(spPr)) {
21955
+ spPr.removeChild(paint);
21956
+ }
21957
21957
  }
21958
21958
  continue;
21959
21959
  }
@@ -24347,8 +24347,8 @@ function protectionXml2(sheet) {
24347
24347
  values2["sheet"] = protection.sheet || void 0;
24348
24348
  const allow = new Set(protection.allow ?? []);
24349
24349
  if (protection.sheet) {
24350
- values2["objects"] = allow.has("objects") ? false : true;
24351
- values2["scenarios"] = allow.has("scenarios") ? false : true;
24350
+ values2["objects"] = !allow.has("objects");
24351
+ values2["scenarios"] = !allow.has("scenarios");
24352
24352
  }
24353
24353
  for (const name of allow) values2[name] = false;
24354
24354
  return el("sheetProtection", values2);
@@ -27397,6 +27397,7 @@ function sortRows2(sheet, range, keys, hasHeader) {
27397
27397
  const sortKeys2 = keys.length ? keys : [{ col: r.start.col }];
27398
27398
  const rows = [];
27399
27399
  for (let row2 = firstRow; row2 <= lastRow; row2++) {
27400
+ if (sheet.rowInfo.get(row2)?.hidden) continue;
27400
27401
  const cells = /* @__PURE__ */ new Map();
27401
27402
  for (const [col, cell] of sheet.rows.get(row2) ?? [])
27402
27403
  if (col >= r.start.col && col <= r.end.col) cells.set(col, cell);
@@ -27414,9 +27415,9 @@ function sortRows2(sheet, range, keys, hasHeader) {
27414
27415
  return 0;
27415
27416
  });
27416
27417
  for (const { row: row2, cells } of rows) for (const col of cells.keys()) deleteCell(sheet, row2, col);
27417
- moveAnnotations(sheet, dataArea, new Map(sorted2.map((source2, i2) => [source2.row, firstRow + i2])));
27418
+ moveAnnotations(sheet, dataArea, new Map(sorted2.map((source2, i2) => [source2.row, rows[i2].row])));
27418
27419
  sorted2.forEach((source2, i2) => {
27419
- const row2 = firstRow + i2;
27420
+ const row2 = rows[i2].row;
27420
27421
  const dRow = row2 - source2.row;
27421
27422
  for (const [col, cell] of source2.cells) {
27422
27423
  if (cell.formula !== void 0 && dRow) {
@@ -3555,7 +3555,7 @@ function stack(ctx, args, vertical) {
3555
3555
  function flatten(ctx, args) {
3556
3556
  const m = ctx.toMatrix(args[0] ?? null);
3557
3557
  const ignore = intAt(ctx, args, 1) ?? 0;
3558
- const byCol = intAt(ctx, args, 2) ? true : false;
3558
+ const byCol = Boolean(intAt(ctx, args, 2));
3559
3559
  const values2 = [];
3560
3560
  const rows = byCol ? m.cols : m.rows;
3561
3561
  const cols = byCol ? m.rows : m.cols;
@@ -6789,7 +6789,7 @@ function ifFn(args, ctx) {
6789
6789
  const branch = (truthy) => {
6790
6790
  const arg = args[truthy ? 1 : 2];
6791
6791
  if (arg) return arg.get();
6792
- return truthy ? true : false;
6792
+ return truthy;
6793
6793
  };
6794
6794
  if (cond instanceof Matrix) return elementwise(cond, branch, ctx);
6795
6795
  if (isError(cond)) return cond;
@@ -21944,10 +21944,10 @@ function patchChartColors(doc, chartNode, model, before) {
21944
21944
  const xml = fill ? drawingFillXml(fill) : color ? `<a:solidFill>${drawingColorXml(color)}</a:solidFill>` : void 0;
21945
21945
  let spPr = first(point, "spPr", NS.c);
21946
21946
  if (!xml) {
21947
- let paint = fillElementOf(spPr);
21948
- while (paint && spPr) {
21949
- spPr.removeChild(paint);
21950
- paint = fillElementOf(spPr);
21947
+ if (spPr) {
21948
+ for (let paint = fillElementOf(spPr); paint; paint = fillElementOf(spPr)) {
21949
+ spPr.removeChild(paint);
21950
+ }
21951
21951
  }
21952
21952
  continue;
21953
21953
  }
@@ -24341,8 +24341,8 @@ function protectionXml2(sheet) {
24341
24341
  values2["sheet"] = protection.sheet || void 0;
24342
24342
  const allow = new Set(protection.allow ?? []);
24343
24343
  if (protection.sheet) {
24344
- values2["objects"] = allow.has("objects") ? false : true;
24345
- values2["scenarios"] = allow.has("scenarios") ? false : true;
24344
+ values2["objects"] = !allow.has("objects");
24345
+ values2["scenarios"] = !allow.has("scenarios");
24346
24346
  }
24347
24347
  for (const name of allow) values2[name] = false;
24348
24348
  return el("sheetProtection", values2);
@@ -27391,6 +27391,7 @@ function sortRows2(sheet, range, keys, hasHeader) {
27391
27391
  const sortKeys2 = keys.length ? keys : [{ col: r.start.col }];
27392
27392
  const rows = [];
27393
27393
  for (let row2 = firstRow; row2 <= lastRow; row2++) {
27394
+ if (sheet.rowInfo.get(row2)?.hidden) continue;
27394
27395
  const cells = /* @__PURE__ */ new Map();
27395
27396
  for (const [col, cell] of sheet.rows.get(row2) ?? [])
27396
27397
  if (col >= r.start.col && col <= r.end.col) cells.set(col, cell);
@@ -27408,9 +27409,9 @@ function sortRows2(sheet, range, keys, hasHeader) {
27408
27409
  return 0;
27409
27410
  });
27410
27411
  for (const { row: row2, cells } of rows) for (const col of cells.keys()) deleteCell(sheet, row2, col);
27411
- moveAnnotations(sheet, dataArea, new Map(sorted2.map((source2, i2) => [source2.row, firstRow + i2])));
27412
+ moveAnnotations(sheet, dataArea, new Map(sorted2.map((source2, i2) => [source2.row, rows[i2].row])));
27412
27413
  sorted2.forEach((source2, i2) => {
27413
- const row2 = firstRow + i2;
27414
+ const row2 = rows[i2].row;
27414
27415
  const dRow = row2 - source2.row;
27415
27416
  for (const [col, cell] of source2.cells) {
27416
27417
  if (cell.formula !== void 0 && dRow) {
@@ -11827,10 +11827,10 @@ function patchChartColors(doc, chartNode, model, before) {
11827
11827
  const xml = fill ? drawingFillXml(fill) : color ? `<a:solidFill>${drawingColorXml(color)}</a:solidFill>` : void 0;
11828
11828
  let spPr = first(point, "spPr", NS.c);
11829
11829
  if (!xml) {
11830
- let paint = fillElementOf(spPr);
11831
- while (paint && spPr) {
11832
- spPr.removeChild(paint);
11833
- paint = fillElementOf(spPr);
11830
+ if (spPr) {
11831
+ for (let paint = fillElementOf(spPr); paint; paint = fillElementOf(spPr)) {
11832
+ spPr.removeChild(paint);
11833
+ }
11834
11834
  }
11835
11835
  continue;
11836
11836
  }
@@ -13344,7 +13344,7 @@ function stack(ctx, args, vertical) {
13344
13344
  function flatten(ctx, args) {
13345
13345
  const m = ctx.toMatrix(args[0] ?? null);
13346
13346
  const ignore = intAt(ctx, args, 1) ?? 0;
13347
- const byCol = intAt(ctx, args, 2) ? true : false;
13347
+ const byCol = Boolean(intAt(ctx, args, 2));
13348
13348
  const values2 = [];
13349
13349
  const rows = byCol ? m.cols : m.rows;
13350
13350
  const cols = byCol ? m.rows : m.cols;
@@ -16300,7 +16300,7 @@ function ifFn(args, ctx) {
16300
16300
  const branch = (truthy) => {
16301
16301
  const arg = args[truthy ? 1 : 2];
16302
16302
  if (arg) return arg.get();
16303
- return truthy ? true : false;
16303
+ return truthy;
16304
16304
  };
16305
16305
  if (cond instanceof Matrix) return elementwise(cond, branch, ctx);
16306
16306
  if (isError(cond)) return cond;
@@ -22840,8 +22840,8 @@ function protectionXml2(sheet) {
22840
22840
  values2["sheet"] = protection.sheet || void 0;
22841
22841
  const allow = new Set(protection.allow ?? []);
22842
22842
  if (protection.sheet) {
22843
- values2["objects"] = allow.has("objects") ? false : true;
22844
- values2["scenarios"] = allow.has("scenarios") ? false : true;
22843
+ values2["objects"] = !allow.has("objects");
22844
+ values2["scenarios"] = !allow.has("scenarios");
22845
22845
  }
22846
22846
  for (const name of allow) values2[name] = false;
22847
22847
  return el("sheetProtection", values2);
@@ -11821,10 +11821,10 @@ function patchChartColors(doc, chartNode, model, before) {
11821
11821
  const xml = fill ? drawingFillXml(fill) : color ? `<a:solidFill>${drawingColorXml(color)}</a:solidFill>` : void 0;
11822
11822
  let spPr = first(point, "spPr", NS.c);
11823
11823
  if (!xml) {
11824
- let paint = fillElementOf(spPr);
11825
- while (paint && spPr) {
11826
- spPr.removeChild(paint);
11827
- paint = fillElementOf(spPr);
11824
+ if (spPr) {
11825
+ for (let paint = fillElementOf(spPr); paint; paint = fillElementOf(spPr)) {
11826
+ spPr.removeChild(paint);
11827
+ }
11828
11828
  }
11829
11829
  continue;
11830
11830
  }
@@ -13338,7 +13338,7 @@ function stack(ctx, args, vertical) {
13338
13338
  function flatten(ctx, args) {
13339
13339
  const m = ctx.toMatrix(args[0] ?? null);
13340
13340
  const ignore = intAt(ctx, args, 1) ?? 0;
13341
- const byCol = intAt(ctx, args, 2) ? true : false;
13341
+ const byCol = Boolean(intAt(ctx, args, 2));
13342
13342
  const values2 = [];
13343
13343
  const rows = byCol ? m.cols : m.rows;
13344
13344
  const cols = byCol ? m.rows : m.cols;
@@ -16294,7 +16294,7 @@ function ifFn(args, ctx) {
16294
16294
  const branch = (truthy) => {
16295
16295
  const arg = args[truthy ? 1 : 2];
16296
16296
  if (arg) return arg.get();
16297
- return truthy ? true : false;
16297
+ return truthy;
16298
16298
  };
16299
16299
  if (cond instanceof Matrix) return elementwise(cond, branch, ctx);
16300
16300
  if (isError(cond)) return cond;
@@ -22834,8 +22834,8 @@ function protectionXml2(sheet) {
22834
22834
  values2["sheet"] = protection.sheet || void 0;
22835
22835
  const allow = new Set(protection.allow ?? []);
22836
22836
  if (protection.sheet) {
22837
- values2["objects"] = allow.has("objects") ? false : true;
22838
- values2["scenarios"] = allow.has("scenarios") ? false : true;
22837
+ values2["objects"] = !allow.has("objects");
22838
+ values2["scenarios"] = !allow.has("scenarios");
22839
22839
  }
22840
22840
  for (const name of allow) values2[name] = false;
22841
22841
  return el("sheetProtection", values2);
@@ -3496,7 +3496,7 @@ function stack(ctx, args, vertical2) {
3496
3496
  function flatten(ctx, args) {
3497
3497
  const m = ctx.toMatrix(args[0] ?? null);
3498
3498
  const ignore = intAt(ctx, args, 1) ?? 0;
3499
- const byCol = intAt(ctx, args, 2) ? true : false;
3499
+ const byCol = Boolean(intAt(ctx, args, 2));
3500
3500
  const values2 = [];
3501
3501
  const rows2 = byCol ? m.cols : m.rows;
3502
3502
  const cols = byCol ? m.rows : m.cols;
@@ -6730,7 +6730,7 @@ function ifFn(args, ctx) {
6730
6730
  const branch = (truthy) => {
6731
6731
  const arg = args[truthy ? 1 : 2];
6732
6732
  if (arg) return arg.get();
6733
- return truthy ? true : false;
6733
+ return truthy;
6734
6734
  };
6735
6735
  if (cond instanceof Matrix) return elementwise(cond, branch, ctx);
6736
6736
  if (isError(cond)) return cond;
@@ -17049,6 +17049,7 @@ function sortRows2(sheet, range2, keys, hasHeader) {
17049
17049
  const sortKeys2 = keys.length ? keys : [{ col: r.start.col }];
17050
17050
  const rows2 = [];
17051
17051
  for (let row2 = firstRow; row2 <= lastRow; row2++) {
17052
+ if (sheet.rowInfo.get(row2)?.hidden) continue;
17052
17053
  const cells = /* @__PURE__ */ new Map();
17053
17054
  for (const [col, cell] of sheet.rows.get(row2) ?? [])
17054
17055
  if (col >= r.start.col && col <= r.end.col) cells.set(col, cell);
@@ -17066,9 +17067,9 @@ function sortRows2(sheet, range2, keys, hasHeader) {
17066
17067
  return 0;
17067
17068
  });
17068
17069
  for (const { row: row2, cells } of rows2) for (const col of cells.keys()) deleteCell(sheet, row2, col);
17069
- moveAnnotations(sheet, dataArea, new Map(sorted2.map((source, i2) => [source.row, firstRow + i2])));
17070
+ moveAnnotations(sheet, dataArea, new Map(sorted2.map((source, i2) => [source.row, rows2[i2].row])));
17070
17071
  sorted2.forEach((source, i2) => {
17071
- const row2 = firstRow + i2;
17072
+ const row2 = rows2[i2].row;
17072
17073
  const dRow = row2 - source.row;
17073
17074
  for (const [col, cell] of source.cells) {
17074
17075
  if (cell.formula !== void 0 && dRow) {
@@ -3494,7 +3494,7 @@ function stack(ctx, args, vertical2) {
3494
3494
  function flatten(ctx, args) {
3495
3495
  const m = ctx.toMatrix(args[0] ?? null);
3496
3496
  const ignore = intAt(ctx, args, 1) ?? 0;
3497
- const byCol = intAt(ctx, args, 2) ? true : false;
3497
+ const byCol = Boolean(intAt(ctx, args, 2));
3498
3498
  const values2 = [];
3499
3499
  const rows2 = byCol ? m.cols : m.rows;
3500
3500
  const cols = byCol ? m.rows : m.cols;
@@ -6728,7 +6728,7 @@ function ifFn(args, ctx) {
6728
6728
  const branch = (truthy) => {
6729
6729
  const arg = args[truthy ? 1 : 2];
6730
6730
  if (arg) return arg.get();
6731
- return truthy ? true : false;
6731
+ return truthy;
6732
6732
  };
6733
6733
  if (cond instanceof Matrix) return elementwise(cond, branch, ctx);
6734
6734
  if (isError(cond)) return cond;
@@ -17047,6 +17047,7 @@ function sortRows2(sheet, range2, keys, hasHeader) {
17047
17047
  const sortKeys2 = keys.length ? keys : [{ col: r.start.col }];
17048
17048
  const rows2 = [];
17049
17049
  for (let row2 = firstRow; row2 <= lastRow; row2++) {
17050
+ if (sheet.rowInfo.get(row2)?.hidden) continue;
17050
17051
  const cells = /* @__PURE__ */ new Map();
17051
17052
  for (const [col, cell] of sheet.rows.get(row2) ?? [])
17052
17053
  if (col >= r.start.col && col <= r.end.col) cells.set(col, cell);
@@ -17064,9 +17065,9 @@ function sortRows2(sheet, range2, keys, hasHeader) {
17064
17065
  return 0;
17065
17066
  });
17066
17067
  for (const { row: row2, cells } of rows2) for (const col of cells.keys()) deleteCell(sheet, row2, col);
17067
- moveAnnotations(sheet, dataArea, new Map(sorted2.map((source, i2) => [source.row, firstRow + i2])));
17068
+ moveAnnotations(sheet, dataArea, new Map(sorted2.map((source, i2) => [source.row, rows2[i2].row])));
17068
17069
  sorted2.forEach((source, i2) => {
17069
- const row2 = firstRow + i2;
17070
+ const row2 = rows2[i2].row;
17070
17071
  const dRow = row2 - source.row;
17071
17072
  for (const [col, cell] of source.cells) {
17072
17073
  if (cell.formula !== void 0 && dRow) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ooxml-core",
3
- "version": "1.8.1",
3
+ "version": "1.8.3",
4
4
  "description": "Shared OOXML logic for the Word, PowerPoint and Excel viewers: everything except the UI",
5
5
  "keywords": [
6
6
  "charts",