@trebco/treb 32.13.2 → 32.14.0

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/dist/treb.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /*! API v32.13. Copyright 2018-2025 trebco, llc. All rights reserved. LGPL: https://treb.app/license */
1
+ /*! API v32.14. Copyright 2018-2025 trebco, llc. All rights reserved. LGPL: https://treb.app/license */
2
2
  /*
3
3
  * This file is part of TREB.
4
4
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trebco/treb",
3
- "version": "32.13.2",
3
+ "version": "32.14.0",
4
4
  "license": "LGPL-3.0-or-later",
5
5
  "homepage": "https://treb.app",
6
6
  "repository": {
@@ -2371,6 +2371,8 @@ export const BaseFunctionLibrary: FunctionMap = {
2371
2371
  unroll: true,
2372
2372
  } ],
2373
2373
 
2374
+ xlfn: true,
2375
+
2374
2376
  fn: (a: number, significance = 1, mode?: number) => {
2375
2377
 
2376
2378
  let value = 0;
@@ -1220,6 +1220,10 @@ export class Exporter {
1220
1220
  data = this.zip?.Get('xl/styles.xml');
1221
1221
  style_cache.FromXML(this.xmlparser2.parse(data || ''), theme);
1222
1222
 
1223
+ // new flag: we need metadata for dynamic arrays
1224
+
1225
+ let dynamic_array_metadata = false;
1226
+
1223
1227
  // reset counters
1224
1228
 
1225
1229
  Drawing.next_drawing_index = 1;
@@ -1573,6 +1577,7 @@ export class Exporter {
1573
1577
  }
1574
1578
 
1575
1579
  if (cell.area && cell.area.start.row === r && cell.area.start.column === c) {
1580
+
1576
1581
  if (typeof f === 'string') {
1577
1582
  f = {
1578
1583
  t$: f,
@@ -1584,6 +1589,25 @@ export class Exporter {
1584
1589
  }
1585
1590
  }
1586
1591
 
1592
+ let cm: number|undefined = undefined;
1593
+
1594
+ if (cell.spill && cell.spill.start.row === r && cell.spill.start.column === c) {
1595
+
1596
+ cm = 1;
1597
+ dynamic_array_metadata = true;
1598
+
1599
+ if (typeof f === 'string') {
1600
+ f = {
1601
+ t$: f,
1602
+ a$: {
1603
+ t: 'array',
1604
+ ref: cell.spill.spreadsheet_label,
1605
+ },
1606
+ }
1607
+ }
1608
+
1609
+ }
1610
+
1587
1611
  row.push({
1588
1612
  a$: {
1589
1613
 
@@ -1597,6 +1621,9 @@ export class Exporter {
1597
1621
  // or there is no column style and it's equal to sheet style
1598
1622
 
1599
1623
  s,
1624
+
1625
+ cm,
1626
+
1600
1627
  },
1601
1628
 
1602
1629
  f,
@@ -2357,6 +2384,83 @@ export class Exporter {
2357
2384
  `worksheets/sheet${index + 1}.xml`,
2358
2385
  ));
2359
2386
 
2387
+ if (dynamic_array_metadata) {
2388
+
2389
+ const metadata_dom: DOMContent = {
2390
+ metadata: {
2391
+ a$: {
2392
+ xmlns: 'http://schemas.openxmlformats.org/spreadsheetml/2006/main',
2393
+ 'xmlns:xda': 'http://schemas.microsoft.com/office/spreadsheetml/2017/dynamicarray',
2394
+ },
2395
+
2396
+ metadataTypes: {
2397
+ a$: {
2398
+ count: 1,
2399
+ },
2400
+ metadataType: {
2401
+ a$: {
2402
+ name: 'XLDAPR',
2403
+ minSupportedVersion: '120000',
2404
+ copy: 1,
2405
+ pasteAll: 1,
2406
+ pasteValues: 1,
2407
+ merge: 1,
2408
+ splitFirst: 1,
2409
+ rowColShift: 1,
2410
+ clearFormats: 1,
2411
+ clearComments: 1,
2412
+ assign: 1,
2413
+ coerce: 1,
2414
+ cellMeta: 1,
2415
+ },
2416
+ },
2417
+ },
2418
+
2419
+ futureMetadata: {
2420
+ a$: {
2421
+ name: 'XLDAPR',
2422
+ count: 1,
2423
+ },
2424
+ bk: {
2425
+ extLst: {
2426
+ ext: {
2427
+ a$: {
2428
+ uri: '{bdbb8cdc-fa1e-496e-a857-3c3f30c029c3}',
2429
+ },
2430
+ 'xda:dynamicArrayProperties': {
2431
+ a$: {
2432
+ fDynamic: 1,
2433
+ fCollapsed: `0`,
2434
+ },
2435
+ },
2436
+ },
2437
+ },
2438
+ },
2439
+ },
2440
+
2441
+ cellMetadata: {
2442
+ a$: { count: 1 },
2443
+ bk: {
2444
+ rc: {
2445
+ a$: {
2446
+ t: 1,
2447
+ v: `0`,
2448
+ }
2449
+ },
2450
+ },
2451
+ },
2452
+
2453
+
2454
+ },
2455
+ };
2456
+ const metadata_xml = XMLDeclaration + this.xmlbuilder1.build(metadata_dom);
2457
+ // console.info(metadata_xml);
2458
+ this.zip?.Set(`xl/metadata.xml`, metadata_xml);
2459
+
2460
+ // add rel
2461
+ AddRel(workbook_rels, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/sheetMetadata', 'metadata.xml');
2462
+ }
2463
+
2360
2464
  this.WriteRels(workbook_rels, `xl/_rels/workbook.xml.rels`);
2361
2465
 
2362
2466
  const definedNames: DOMContent|undefined = source.named?.length ? {
@@ -2381,8 +2485,8 @@ export class Exporter {
2381
2485
 
2382
2486
  }),
2383
2487
  } : undefined;
2384
-
2385
-
2488
+
2489
+
2386
2490
  const workbook_dom: DOMContent = {
2387
2491
  workbook: {
2388
2492
  a$: {
@@ -2487,6 +2591,11 @@ export class Exporter {
2487
2591
  { a$: { PartName: '/xl/styles.xml', ContentType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml' }},
2488
2592
  { a$: { PartName: '/xl/sharedStrings.xml', ContentType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml' }},
2489
2593
 
2594
+ // metadata
2595
+ ...(dynamic_array_metadata ? [
2596
+ { a$: { PartName: '/xl/metadata.xml', ContentType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml' }},
2597
+ ] : []),
2598
+
2490
2599
  // tables
2491
2600
  ...global_tables.map(table => {
2492
2601
  return { a$: {