@office-open/core 0.3.6 → 0.4.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.
@@ -1,15 +1,48 @@
1
- import { T as XmlComponent, b as wrapEl, o as EmptyElement, p as chartAttr } from "../_chunks/xml-components-CN6syVNr.mjs";
2
- //#region src/chart/chart-collection.ts
3
- var ChartCollection = class {
4
- map;
1
+ import { T as XmlComponent, a as BuilderElement, b as wrapEl, o as EmptyElement, p as chartAttr } from "../_chunks/xml-components-CN6syVNr.mjs";
2
+ //#region src/chart/axes.ts
3
+ /**
4
+ * c:scaling — axis scaling configuration (minOccurs=1 in EG_AxShared).
5
+ */
6
+ var Scaling = class extends XmlComponent {
5
7
  constructor() {
6
- this.map = /* @__PURE__ */ new Map();
7
- }
8
- addChart(key, chartData) {
9
- this.map.set(key, chartData);
10
- }
11
- get Array() {
12
- return [...this.map.values()];
8
+ super("c:scaling");
9
+ this.root.push(wrapEl("c:orientation", chartAttr({ val: "minMax" })));
10
+ }
11
+ };
12
+ /**
13
+ * c:catAx — category axis.
14
+ */
15
+ var CatAx = class extends XmlComponent {
16
+ constructor(axId, crossAx) {
17
+ super("c:catAx");
18
+ this.root.push(wrapEl("c:axId", chartAttr({ val: axId })));
19
+ this.root.push(new Scaling());
20
+ this.root.push(wrapEl("c:delete", chartAttr({ val: 0 })));
21
+ this.root.push(wrapEl("c:axPos", chartAttr({ val: "b" })));
22
+ this.root.push(wrapEl("c:auto", chartAttr({ val: 1 })));
23
+ this.root.push(wrapEl("c:lblOffset", chartAttr({ val: 100 })));
24
+ this.root.push(wrapEl("c:noMultiLvlLbl", chartAttr({ val: 0 })));
25
+ this.root.push(wrapEl("c:crossAx", chartAttr({ val: crossAx })));
26
+ this.root.push(wrapEl("c:crosses", chartAttr({ val: "autoZero" })));
27
+ }
28
+ };
29
+ /**
30
+ * c:valAx — value axis.
31
+ */
32
+ var ValAx = class extends XmlComponent {
33
+ constructor(axId, crossAx) {
34
+ super("c:valAx");
35
+ this.root.push(wrapEl("c:axId", chartAttr({ val: axId })));
36
+ this.root.push(new Scaling());
37
+ this.root.push(wrapEl("c:delete", chartAttr({ val: 0 })));
38
+ this.root.push(wrapEl("c:axPos", chartAttr({ val: "l" })));
39
+ this.root.push(wrapEl("c:numFmt", chartAttr({
40
+ formatCode: "General",
41
+ sourceLinked: 1
42
+ })));
43
+ this.root.push(wrapEl("c:crossAx", chartAttr({ val: crossAx })));
44
+ this.root.push(wrapEl("c:crosses", chartAttr({ val: "autoZero" })));
45
+ this.root.push(new BuilderElement({ name: "c:spPr" }));
13
46
  }
14
47
  };
15
48
  //#endregion
@@ -357,4 +390,222 @@ var TitleOverlay = class extends XmlComponent {
357
390
  }
358
391
  };
359
392
  //#endregion
360
- export { AreaChart, BarChart, ChartCollection, ChartTitle, LineChart, PieChart, ScatterChart, createChartType, createNumRef, createStrRef };
393
+ //#region src/chart/chart-space.ts
394
+ /**
395
+ * ChartSpace — root element for chart XML parts (c:chartSpace).
396
+ *
397
+ * Full XSD-compliant implementation with all optional elements.
398
+ *
399
+ * @module
400
+ */
401
+ /**
402
+ * c:chartSpace — root element for chart XML parts.
403
+ */
404
+ var ChartSpace = class extends XmlComponent {
405
+ constructor(options) {
406
+ super("c:chartSpace");
407
+ this.root.push(chartAttr({
408
+ "xmlns:a": "http://schemas.openxmlformats.org/drawingml/2006/main",
409
+ "xmlns:c": "http://schemas.openxmlformats.org/drawingml/2006/chart",
410
+ "xmlns:r": "http://schemas.openxmlformats.org/officeDocument/2006/relationships"
411
+ }));
412
+ this.root.push(wrapEl("c:date1904", chartAttr({ val: 0 })));
413
+ this.root.push(wrapEl("c:lang", chartAttr({ val: "en-US" })));
414
+ this.root.push(wrapEl("c:roundedCorners", chartAttr({ val: 0 })));
415
+ const chart = new ChartContainer();
416
+ if (options.title) chart["root"].push(new ChartTitle(options.title));
417
+ chart["root"].push(wrapEl("c:autoTitleDeleted", chartAttr({ val: 0 })));
418
+ const plotArea = new PlotArea();
419
+ plotArea["root"].push(new BuilderElement({ name: "c:layout" }));
420
+ plotArea["root"].push(createChartType({
421
+ categories: options.categories,
422
+ series: options.series,
423
+ type: options.type
424
+ }));
425
+ if (options.type !== "pie") if (options.type === "scatter") {
426
+ plotArea["root"].push(new ValAx(10, 20));
427
+ plotArea["root"].push(new ValAx(20, 10));
428
+ } else {
429
+ plotArea["root"].push(new CatAx(10, 20));
430
+ plotArea["root"].push(new ValAx(20, 10));
431
+ }
432
+ chart["root"].push(plotArea);
433
+ if (options.showLegend !== false) chart["root"].push(createLegend());
434
+ this.root.push(chart);
435
+ this.root.push(createChartSpPr());
436
+ this.root.push(createChartTxPr());
437
+ if (options.style !== void 0) this.root.push(new ChartStyle(options.style));
438
+ }
439
+ };
440
+ var ChartContainer = class extends XmlComponent {
441
+ constructor() {
442
+ super("c:chart");
443
+ }
444
+ };
445
+ var PlotArea = class extends XmlComponent {
446
+ constructor() {
447
+ super("c:plotArea");
448
+ }
449
+ };
450
+ function createLegend() {
451
+ const legend = new class extends XmlComponent {
452
+ constructor() {
453
+ super("c:legend");
454
+ }
455
+ }();
456
+ legend["root"].push(wrapEl("c:legendPos", chartAttr({ val: "b" })));
457
+ legend["root"].push(new BuilderElement({ name: "c:layout" }));
458
+ legend["root"].push(wrapEl("c:overlay", chartAttr({ val: 0 })));
459
+ legend["root"].push(createNoFillSpPr());
460
+ legend["root"].push(createTxPr());
461
+ return legend;
462
+ }
463
+ function createNoFillSpPr() {
464
+ const spPr = new class extends XmlComponent {
465
+ constructor() {
466
+ super("c:spPr");
467
+ }
468
+ }();
469
+ spPr["root"].push(new class extends XmlComponent {
470
+ constructor() {
471
+ super("a:noFill");
472
+ }
473
+ }());
474
+ spPr["root"].push(new class extends XmlComponent {
475
+ constructor() {
476
+ super("a:ln");
477
+ this.root.push(new class extends XmlComponent {
478
+ constructor() {
479
+ super("a:noFill");
480
+ }
481
+ }());
482
+ }
483
+ }());
484
+ spPr["root"].push(new BuilderElement({ name: "a:effectLst" }));
485
+ return spPr;
486
+ }
487
+ function createChartSpPr() {
488
+ const spPr = new class extends XmlComponent {
489
+ constructor() {
490
+ super("c:spPr");
491
+ }
492
+ }();
493
+ spPr["root"].push(new class extends XmlComponent {
494
+ constructor() {
495
+ super("a:noFill");
496
+ }
497
+ }());
498
+ spPr["root"].push(new class extends XmlComponent {
499
+ constructor() {
500
+ super("a:ln");
501
+ this.root.push(new class extends XmlComponent {
502
+ constructor() {
503
+ super("a:noFill");
504
+ }
505
+ }());
506
+ }
507
+ }());
508
+ spPr["root"].push(new BuilderElement({ name: "a:effectLst" }));
509
+ return spPr;
510
+ }
511
+ function createChartTxPr() {
512
+ const txPr = new class extends XmlComponent {
513
+ constructor() {
514
+ super("c:txPr");
515
+ }
516
+ }();
517
+ txPr["root"].push(new BuilderElement({ name: "a:bodyPr" }));
518
+ txPr["root"].push(new BuilderElement({ name: "a:lstStyle" }));
519
+ txPr["root"].push(createTextParagraph());
520
+ return txPr;
521
+ }
522
+ function createTxPr() {
523
+ const txPr = new class extends XmlComponent {
524
+ constructor() {
525
+ super("c:txPr");
526
+ }
527
+ }();
528
+ txPr["root"].push(createBodyPr());
529
+ txPr["root"].push(new BuilderElement({ name: "a:lstStyle" }));
530
+ txPr["root"].push(createTextParagraph());
531
+ return txPr;
532
+ }
533
+ function createBodyPr() {
534
+ return new BuilderElement({
535
+ name: "a:bodyPr",
536
+ attributes: {
537
+ rot: {
538
+ key: "rot",
539
+ value: "0"
540
+ },
541
+ spcFirstLastPara: {
542
+ key: "spcFirstLastPara",
543
+ value: "1"
544
+ },
545
+ vertOverflow: {
546
+ key: "vertOverflow",
547
+ value: "ellipsis"
548
+ },
549
+ vert: {
550
+ key: "vert",
551
+ value: "horz"
552
+ },
553
+ wrap: {
554
+ key: "wrap",
555
+ value: "square"
556
+ },
557
+ anchor: {
558
+ key: "anchor",
559
+ value: "ctr"
560
+ },
561
+ anchorCtr: {
562
+ key: "anchorCtr",
563
+ value: "1"
564
+ }
565
+ }
566
+ });
567
+ }
568
+ function createTextParagraph() {
569
+ const p = new class extends XmlComponent {
570
+ constructor() {
571
+ super("a:p");
572
+ }
573
+ }();
574
+ const pPr = new class extends XmlComponent {
575
+ constructor() {
576
+ super("a:pPr");
577
+ }
578
+ }();
579
+ pPr["root"].push(new BuilderElement({ name: "a:defRPr" }));
580
+ p["root"].push(pPr);
581
+ p["root"].push(new BuilderElement({
582
+ name: "a:endParaRPr",
583
+ attributes: { lang: {
584
+ key: "lang",
585
+ value: "en-US"
586
+ } }
587
+ }));
588
+ return p;
589
+ }
590
+ var ChartStyle = class extends XmlComponent {
591
+ constructor(val) {
592
+ super("c:style");
593
+ this.root.push(chartAttr({ val: String(val) }));
594
+ }
595
+ };
596
+ //#endregion
597
+ //#region src/chart/chart-collection.ts
598
+ var ChartCollection = class {
599
+ map;
600
+ constructor() {
601
+ this.map = /* @__PURE__ */ new Map();
602
+ }
603
+ addChart(key, chartData) {
604
+ this.map.set(key, chartData);
605
+ }
606
+ get Array() {
607
+ return [...this.map.values()];
608
+ }
609
+ };
610
+ //#endregion
611
+ export { AreaChart, BarChart, CatAx, ChartCollection, ChartSpace, ChartTitle, LineChart, PieChart, ScatterChart, ValAx, createChartType, createNumRef, createStrRef };