@cj-tech-master/excelts 4.0.4-canary.20260109050555.4f97ebb → 4.0.4-canary.20260110000241.8ac37ef

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 (55) hide show
  1. package/dist/browser/modules/excel/cell.js +39 -1
  2. package/dist/browser/modules/excel/enums.d.ts +2 -1
  3. package/dist/browser/modules/excel/enums.js +2 -1
  4. package/dist/browser/modules/excel/stream/workbook-writer.browser.d.ts +1 -0
  5. package/dist/browser/modules/excel/stream/workbook-writer.browser.js +19 -1
  6. package/dist/browser/modules/excel/types.d.ts +5 -1
  7. package/dist/browser/modules/excel/utils/ooxml-paths.d.ts +2 -0
  8. package/dist/browser/modules/excel/utils/ooxml-paths.js +4 -2
  9. package/dist/browser/modules/excel/xlsx/rel-type.d.ts +1 -0
  10. package/dist/browser/modules/excel/xlsx/rel-type.js +2 -1
  11. package/dist/browser/modules/excel/xlsx/xform/core/content-types-xform.js +7 -0
  12. package/dist/browser/modules/excel/xlsx/xform/core/feature-property-bag-xform.d.ts +8 -0
  13. package/dist/browser/modules/excel/xlsx/xform/core/feature-property-bag-xform.js +36 -0
  14. package/dist/browser/modules/excel/xlsx/xform/sheet/cell-xform.js +5 -0
  15. package/dist/browser/modules/excel/xlsx/xform/style/style-xform.d.ts +2 -0
  16. package/dist/browser/modules/excel/xlsx/xform/style/style-xform.js +11 -0
  17. package/dist/browser/modules/excel/xlsx/xform/style/styles-xform.d.ts +2 -0
  18. package/dist/browser/modules/excel/xlsx/xform/style/styles-xform.js +28 -4
  19. package/dist/browser/modules/excel/xlsx/xlsx.browser.d.ts +2 -0
  20. package/dist/browser/modules/excel/xlsx/xlsx.browser.js +19 -0
  21. package/dist/cjs/modules/excel/cell.js +39 -1
  22. package/dist/cjs/modules/excel/enums.js +2 -1
  23. package/dist/cjs/modules/excel/stream/workbook-writer.browser.js +19 -1
  24. package/dist/cjs/modules/excel/utils/ooxml-paths.js +4 -2
  25. package/dist/cjs/modules/excel/xlsx/rel-type.js +2 -1
  26. package/dist/cjs/modules/excel/xlsx/xform/core/content-types-xform.js +7 -0
  27. package/dist/cjs/modules/excel/xlsx/xform/core/feature-property-bag-xform.js +39 -0
  28. package/dist/cjs/modules/excel/xlsx/xform/sheet/cell-xform.js +5 -0
  29. package/dist/cjs/modules/excel/xlsx/xform/style/style-xform.js +11 -0
  30. package/dist/cjs/modules/excel/xlsx/xform/style/styles-xform.js +28 -4
  31. package/dist/cjs/modules/excel/xlsx/xlsx.browser.js +19 -0
  32. package/dist/esm/modules/excel/cell.js +39 -1
  33. package/dist/esm/modules/excel/enums.js +2 -1
  34. package/dist/esm/modules/excel/stream/workbook-writer.browser.js +19 -1
  35. package/dist/esm/modules/excel/utils/ooxml-paths.js +4 -2
  36. package/dist/esm/modules/excel/xlsx/rel-type.js +2 -1
  37. package/dist/esm/modules/excel/xlsx/xform/core/content-types-xform.js +7 -0
  38. package/dist/esm/modules/excel/xlsx/xform/core/feature-property-bag-xform.js +36 -0
  39. package/dist/esm/modules/excel/xlsx/xform/sheet/cell-xform.js +5 -0
  40. package/dist/esm/modules/excel/xlsx/xform/style/style-xform.js +11 -0
  41. package/dist/esm/modules/excel/xlsx/xform/style/styles-xform.js +28 -4
  42. package/dist/esm/modules/excel/xlsx/xlsx.browser.js +19 -0
  43. package/dist/iife/excelts.iife.js +145 -8
  44. package/dist/iife/excelts.iife.js.map +1 -1
  45. package/dist/iife/excelts.iife.min.js +28 -28
  46. package/dist/types/modules/excel/enums.d.ts +2 -1
  47. package/dist/types/modules/excel/stream/workbook-writer.browser.d.ts +1 -0
  48. package/dist/types/modules/excel/types.d.ts +5 -1
  49. package/dist/types/modules/excel/utils/ooxml-paths.d.ts +2 -0
  50. package/dist/types/modules/excel/xlsx/rel-type.d.ts +1 -0
  51. package/dist/types/modules/excel/xlsx/xform/core/feature-property-bag-xform.d.ts +8 -0
  52. package/dist/types/modules/excel/xlsx/xform/style/style-xform.d.ts +2 -0
  53. package/dist/types/modules/excel/xlsx/xform/style/styles-xform.d.ts +2 -0
  54. package/dist/types/modules/excel/xlsx/xlsx.browser.d.ts +2 -0
  55. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @cj-tech-master/excelts v4.0.4-canary.20260109050555.4f97ebb
2
+ * @cj-tech-master/excelts v4.0.4-canary.20260110000241.8ac37ef
3
3
  * TypeScript Excel Workbook Manager - Read and Write xlsx and csv Files.
4
4
  * (c) 2026 cjnoname
5
5
  * Released under the MIT License
@@ -448,6 +448,7 @@ var ExcelTS = (function(exports) {
448
448
  ValueType$1[ValueType$1["Boolean"] = 9] = "Boolean";
449
449
  ValueType$1[ValueType$1["Error"] = 10] = "Error";
450
450
  ValueType$1[ValueType$1["JSON"] = 11] = "JSON";
451
+ ValueType$1[ValueType$1["Checkbox"] = 12] = "Checkbox";
451
452
  return ValueType$1;
452
453
  }({});
453
454
  let FormulaType = /* @__PURE__ */ function(FormulaType$1) {
@@ -1336,6 +1337,40 @@ var ExcelTS = (function(exports) {
1336
1337
  return this.model.value.toString();
1337
1338
  }
1338
1339
  };
1340
+ var CheckboxValue = class {
1341
+ constructor(cell, value) {
1342
+ this.model = {
1343
+ address: cell.address,
1344
+ type: Cell.Types.Checkbox,
1345
+ value: value.checkbox
1346
+ };
1347
+ }
1348
+ get value() {
1349
+ return { checkbox: this.model.value };
1350
+ }
1351
+ set value(value) {
1352
+ this.model.value = value.checkbox;
1353
+ }
1354
+ get type() {
1355
+ return Cell.Types.Checkbox;
1356
+ }
1357
+ get effectiveType() {
1358
+ return Cell.Types.Boolean;
1359
+ }
1360
+ get address() {
1361
+ return this.model.address;
1362
+ }
1363
+ set address(value) {
1364
+ this.model.address = value;
1365
+ }
1366
+ toCsvString() {
1367
+ return this.model.value ? 1 : 0;
1368
+ }
1369
+ release() {}
1370
+ toString() {
1371
+ return this.model.value.toString();
1372
+ }
1373
+ };
1339
1374
  var ErrorValue$1 = class {
1340
1375
  constructor(cell, value) {
1341
1376
  this.model = {
@@ -1414,6 +1449,7 @@ var ExcelTS = (function(exports) {
1414
1449
  if (typeof value === "boolean") return Cell.Types.Boolean;
1415
1450
  if (value instanceof Date) return Cell.Types.Date;
1416
1451
  if (typeof value === "object") {
1452
+ if ("checkbox" in value && typeof value.checkbox === "boolean") return Cell.Types.Checkbox;
1417
1453
  if ("text" in value && value.text && "hyperlink" in value && value.hyperlink) return Cell.Types.Hyperlink;
1418
1454
  if ("formula" in value && value.formula || "sharedFormula" in value && value.sharedFormula) return Cell.Types.Formula;
1419
1455
  if ("richText" in value && value.richText) return Cell.Types.RichText;
@@ -1470,6 +1506,10 @@ var ExcelTS = (function(exports) {
1470
1506
  {
1471
1507
  t: Cell.Types.Error,
1472
1508
  f: ErrorValue$1
1509
+ },
1510
+ {
1511
+ t: Cell.Types.Checkbox,
1512
+ f: CheckboxValue
1473
1513
  }
1474
1514
  ].reduce((p, t) => {
1475
1515
  p[t.t] = t.f;
@@ -8345,6 +8385,16 @@ var ExcelTS = (function(exports) {
8345
8385
  */
8346
8386
  if (model.alignment) this.map.alignment.render(xmlStream, model.alignment);
8347
8387
  if (model.protection) this.map.protection.render(xmlStream, model.protection);
8388
+ if (model.checkbox && model.xfComplementIndex !== void 0) {
8389
+ xmlStream.openNode("extLst");
8390
+ xmlStream.openNode("ext", {
8391
+ "xmlns:xfpb": "http://schemas.microsoft.com/office/spreadsheetml/2022/featurepropertybag",
8392
+ uri: "{C7286773-470A-42A8-94C5-96B5CB345126}"
8393
+ });
8394
+ xmlStream.leafNode("xfpb:xfComplement", { i: model.xfComplementIndex });
8395
+ xmlStream.closeNode();
8396
+ xmlStream.closeNode();
8397
+ }
8348
8398
  xmlStream.closeNode();
8349
8399
  }
8350
8400
  parseOpen(node) {
@@ -8552,6 +8602,7 @@ var ExcelTS = (function(exports) {
8552
8602
  pattern: "gray125"
8553
8603
  });
8554
8604
  this.weakMap = /* @__PURE__ */ new WeakMap();
8605
+ this._hasCheckboxes = false;
8555
8606
  }
8556
8607
  render(xmlStream, model) {
8557
8608
  const renderModel = model || this.model;
@@ -8681,9 +8732,9 @@ var ExcelTS = (function(exports) {
8681
8732
  family: 2,
8682
8733
  scheme: "minor"
8683
8734
  });
8684
- if (this.weakMap && this.weakMap.has(model)) return this.weakMap.get(model);
8685
- const style = {};
8686
8735
  const type = cellType || Enums.ValueType.Number;
8736
+ if (type !== Enums.ValueType.Checkbox && this.weakMap && this.weakMap.has(model)) return this.weakMap.get(model);
8737
+ const style = {};
8687
8738
  if (model.numFmt) style.numFmtId = this._addNumFmtStr(model.numFmt);
8688
8739
  else switch (type) {
8689
8740
  case Enums.ValueType.Number:
@@ -8699,8 +8750,14 @@ var ExcelTS = (function(exports) {
8699
8750
  if (model.fill) style.fillId = this._addFill(model.fill);
8700
8751
  if (model.alignment) style.alignment = model.alignment;
8701
8752
  if (model.protection) style.protection = model.protection;
8753
+ if (type === Enums.ValueType.Checkbox) {
8754
+ this._hasCheckboxes = true;
8755
+ style.alignment = style.alignment || {};
8756
+ style.checkbox = true;
8757
+ style.xfComplementIndex = 0;
8758
+ }
8702
8759
  const styleId = this._addStyle(style);
8703
- if (this.weakMap) this.weakMap.set(model, styleId);
8760
+ if (type !== Enums.ValueType.Checkbox && this.weakMap) this.weakMap.set(model, styleId);
8704
8761
  return styleId;
8705
8762
  }
8706
8763
  getStyleModel(id) {
@@ -8734,6 +8791,9 @@ var ExcelTS = (function(exports) {
8734
8791
  getDxfStyle(id) {
8735
8792
  return this.model.dxfs[id];
8736
8793
  }
8794
+ get hasCheckboxes() {
8795
+ return !!this._hasCheckboxes;
8796
+ }
8737
8797
  _addStyle(style) {
8738
8798
  const xml = this.map.style.toXml(style);
8739
8799
  let index = this.index.style[xml];
@@ -8880,10 +8940,14 @@ var ExcelTS = (function(exports) {
8880
8940
  }
8881
8941
  addStyleModel(model, cellType) {
8882
8942
  switch (cellType) {
8943
+ case Enums.ValueType.Checkbox: throw new Error("Checkbox cells require styles to be enabled (useStyles: true)");
8883
8944
  case Enums.ValueType.Date: return this.dateStyleId;
8884
8945
  default: return 0;
8885
8946
  }
8886
8947
  }
8948
+ get hasCheckboxes() {
8949
+ return false;
8950
+ }
8887
8951
  get dateStyleId() {
8888
8952
  if (!this._dateStyleId) {
8889
8953
  const dateStyle = { numFmtId: NumFmtXform.getDefaultFmtId("mm-dd-yy") };
@@ -9492,7 +9556,8 @@ var ExcelTS = (function(exports) {
9492
9556
  xlWorkbookRels: "xl/_rels/workbook.xml.rels",
9493
9557
  xlSharedStrings: "xl/sharedStrings.xml",
9494
9558
  xlStyles: "xl/styles.xml",
9495
- xlTheme1: "xl/theme/theme1.xml"
9559
+ xlTheme1: "xl/theme/theme1.xml",
9560
+ xlFeaturePropertyBag: "xl/featurePropertyBag/featurePropertyBag.xml"
9496
9561
  };
9497
9562
  const worksheetXmlRegex = /^xl\/worksheets\/sheet(\d+)[.]xml$/;
9498
9563
  const worksheetRelsXmlRegex = /^xl\/worksheets\/_rels\/sheet(\d+)[.]xml[.]rels$/;
@@ -9638,7 +9703,8 @@ var ExcelTS = (function(exports) {
9638
9703
  const OOXML_REL_TARGETS = {
9639
9704
  workbookStyles: "styles.xml",
9640
9705
  workbookSharedStrings: "sharedStrings.xml",
9641
- workbookTheme1: "theme/theme1.xml"
9706
+ workbookTheme1: "theme/theme1.xml",
9707
+ workbookFeaturePropertyBag: "featurePropertyBag/featurePropertyBag.xml"
9642
9708
  };
9643
9709
  function pivotCacheDefinitionRelTargetFromWorkbook(n) {
9644
9710
  return `pivotCache/pivotCacheDefinition${n}.xml`;
@@ -9735,6 +9801,10 @@ var ExcelTS = (function(exports) {
9735
9801
  PartName: toContentTypesPartName(OOXML_PATHS.xlStyles),
9736
9802
  ContentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"
9737
9803
  });
9804
+ if (model.hasCheckboxes) xmlStream.leafNode("Override", {
9805
+ PartName: toContentTypesPartName(OOXML_PATHS.xlFeaturePropertyBag),
9806
+ ContentType: "application/vnd.ms-excel.featurepropertybag+xml"
9807
+ });
9738
9808
  if (model.sharedStrings && model.sharedStrings.count) xmlStream.leafNode("Override", {
9739
9809
  PartName: toContentTypesPartName(OOXML_PATHS.xlSharedStrings),
9740
9810
  ContentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"
@@ -10343,7 +10413,8 @@ var ExcelTS = (function(exports) {
10343
10413
  Table: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/table",
10344
10414
  PivotCacheDefinition: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition",
10345
10415
  PivotCacheRecords: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheRecords",
10346
- PivotTable: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotTable"
10416
+ PivotTable: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotTable",
10417
+ FeaturePropertyBag: "http://schemas.microsoft.com/office/2022/11/relationships/FeaturePropertyBag"
10347
10418
  };
10348
10419
 
10349
10420
  //#endregion
@@ -10522,6 +10593,10 @@ var ExcelTS = (function(exports) {
10522
10593
  xmlStream.addAttribute("t", "b");
10523
10594
  xmlStream.leafNode("v", null, model.value ? "1" : "0");
10524
10595
  break;
10596
+ case Enums.ValueType.Checkbox:
10597
+ xmlStream.addAttribute("t", "b");
10598
+ xmlStream.leafNode("v", null, model.value ? "1" : "0");
10599
+ break;
10525
10600
  case Enums.ValueType.Error:
10526
10601
  xmlStream.addAttribute("t", "e");
10527
10602
  xmlStream.leafNode("v", null, model.value.error);
@@ -13449,6 +13524,42 @@ var ExcelTS = (function(exports) {
13449
13524
  }
13450
13525
  };
13451
13526
 
13527
+ //#endregion
13528
+ //#region src/modules/excel/xlsx/xform/core/feature-property-bag-xform.ts
13529
+ var FeaturePropertyBagXform = class extends BaseXform {
13530
+ render(xmlStream) {
13531
+ xmlStream.openXml({
13532
+ version: "1.0",
13533
+ encoding: "UTF-8",
13534
+ standalone: "yes"
13535
+ });
13536
+ xmlStream.openNode("FeaturePropertyBags", { xmlns: "http://schemas.microsoft.com/office/spreadsheetml/2022/featurepropertybag" });
13537
+ xmlStream.leafNode("bag", { type: "Checkbox" });
13538
+ xmlStream.openNode("bag", { type: "XFControls" });
13539
+ xmlStream.leafNode("bagId", { k: "CellControl" }, "0");
13540
+ xmlStream.closeNode();
13541
+ xmlStream.openNode("bag", { type: "XFComplement" });
13542
+ xmlStream.leafNode("bagId", { k: "XFControls" }, "1");
13543
+ xmlStream.closeNode();
13544
+ xmlStream.openNode("bag", {
13545
+ type: "XFComplements",
13546
+ extRef: "XFComplementsMapperExtRef"
13547
+ });
13548
+ xmlStream.openNode("a", { k: "MappedFeaturePropertyBags" });
13549
+ xmlStream.leafNode("bagId", {}, "2");
13550
+ xmlStream.closeNode();
13551
+ xmlStream.closeNode();
13552
+ xmlStream.closeNode();
13553
+ }
13554
+ parseOpen() {
13555
+ return false;
13556
+ }
13557
+ parseText() {}
13558
+ parseClose() {
13559
+ return false;
13560
+ }
13561
+ };
13562
+
13452
13563
  //#endregion
13453
13564
  //#region src/modules/excel/xlsx/xform/drawing/base-cell-anchor-xform.ts
13454
13565
  var BaseCellAnchorXform = class extends BaseXform {
@@ -19622,6 +19733,7 @@ var ExcelTS = (function(exports) {
19622
19733
  this.addTables(zip, model);
19623
19734
  this.addPivotTables(zip, model);
19624
19735
  await Promise.all([this.addThemes(zip, model), this.addStyles(zip, model)]);
19736
+ await this.addFeaturePropertyBag(zip, model);
19625
19737
  await this.addMedia(zip, model);
19626
19738
  await Promise.all([this.addApp(zip, model), this.addCore(zip, model)]);
19627
19739
  await this.addWorkbook(zip, model);
@@ -20280,6 +20392,11 @@ var ExcelTS = (function(exports) {
20280
20392
  Type: XLSX.RelType.SharedStrings,
20281
20393
  Target: OOXML_REL_TARGETS.workbookSharedStrings
20282
20394
  });
20395
+ if (model.hasCheckboxes) relationships.push({
20396
+ Id: `rId${count++}`,
20397
+ Type: XLSX.RelType.FeaturePropertyBag,
20398
+ Target: OOXML_REL_TARGETS.workbookFeaturePropertyBag
20399
+ });
20283
20400
  (model.pivotTables || []).forEach((pivotTable) => {
20284
20401
  pivotTable.rId = `rId${count++}`;
20285
20402
  relationships.push({
@@ -20300,6 +20417,11 @@ var ExcelTS = (function(exports) {
20300
20417
  const xml = new RelationshipsXform().toXml(relationships);
20301
20418
  zip.append(xml, { name: OOXML_PATHS.xlWorkbookRels });
20302
20419
  }
20420
+ async addFeaturePropertyBag(zip, model) {
20421
+ if (!model.hasCheckboxes) return;
20422
+ const xform$1 = new FeaturePropertyBagXform();
20423
+ zip.append(xform$1.toXml({}), { name: OOXML_PATHS.xlFeaturePropertyBag });
20424
+ }
20303
20425
  async addSharedStrings(zip, model) {
20304
20426
  if (model.sharedStrings && model.sharedStrings.count) zip.append(model.sharedStrings.xml, { name: OOXML_PATHS.xlSharedStrings });
20305
20427
  }
@@ -20441,6 +20563,7 @@ var ExcelTS = (function(exports) {
20441
20563
  });
20442
20564
  worksheetXform.prepare(worksheet, worksheetOptions);
20443
20565
  });
20566
+ model.hasCheckboxes = model.styles.hasCheckboxes;
20444
20567
  }
20445
20568
  };
20446
20569
 
@@ -22464,6 +22587,7 @@ var ExcelTS = (function(exports) {
22464
22587
  this.addCore(),
22465
22588
  this.addSharedStrings(),
22466
22589
  this.addStyles(),
22590
+ this.addFeaturePropertyBag(),
22467
22591
  this.addWorkbookRels()
22468
22592
  ]);
22469
22593
  await this.addWorkbook();
@@ -22559,7 +22683,8 @@ var ExcelTS = (function(exports) {
22559
22683
  worksheets: this._worksheets.filter(Boolean),
22560
22684
  sharedStrings: this.sharedStrings,
22561
22685
  commentRefs: this.commentRefs,
22562
- media: this.media
22686
+ media: this.media,
22687
+ hasCheckboxes: this.styles.hasCheckboxes
22563
22688
  };
22564
22689
  const xform$1 = new ContentTypesXform();
22565
22690
  this._addFile(xform$1.toXml(model), OOXML_PATHS.contentTypes);
@@ -22609,6 +22734,13 @@ var ExcelTS = (function(exports) {
22609
22734
  });
22610
22735
  return Promise.resolve();
22611
22736
  }
22737
+ addFeaturePropertyBag() {
22738
+ if (this.styles.hasCheckboxes) {
22739
+ const xform$1 = new FeaturePropertyBagXform();
22740
+ this._addFile(xform$1.toXml({}), OOXML_PATHS.xlFeaturePropertyBag);
22741
+ }
22742
+ return Promise.resolve();
22743
+ }
22612
22744
  addWorkbookRels() {
22613
22745
  let count = 1;
22614
22746
  const relationships = [{
@@ -22625,6 +22757,11 @@ var ExcelTS = (function(exports) {
22625
22757
  Type: RelType.SharedStrings,
22626
22758
  Target: OOXML_REL_TARGETS.workbookSharedStrings
22627
22759
  });
22760
+ if (this.styles.hasCheckboxes) relationships.push({
22761
+ Id: `rId${count++}`,
22762
+ Type: RelType.FeaturePropertyBag,
22763
+ Target: OOXML_REL_TARGETS.workbookFeaturePropertyBag
22764
+ });
22628
22765
  this._worksheets.forEach((ws) => {
22629
22766
  if (ws) {
22630
22767
  ws.rId = `rId${count++}`;