Use dedicated XmlComponent rather than polute pure one
This commit is contained in:
@ -1,10 +1,10 @@
|
||||
// http://officeopenxml.com/WPfooters.php
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
import { InitializableXmlComponent, XmlComponent } from "file/xml-components";
|
||||
import { Paragraph } from "../paragraph";
|
||||
import { Table } from "../table";
|
||||
import { FooterAttributes } from "./footer-attributes";
|
||||
|
||||
export class Footer extends XmlComponent {
|
||||
export class Footer extends InitializableXmlComponent {
|
||||
private readonly refId: number;
|
||||
|
||||
constructor(referenceNumber: number, initContent?: XmlComponent) {
|
||||
|
@ -1,10 +1,10 @@
|
||||
// http://officeopenxml.com/WPheaders.php
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
import { InitializableXmlComponent, XmlComponent } from "file/xml-components";
|
||||
import { Paragraph } from "../paragraph";
|
||||
import { Table } from "../table";
|
||||
import { HeaderAttributes } from "./header-attributes";
|
||||
|
||||
export class Header extends XmlComponent {
|
||||
export class Header extends InitializableXmlComponent {
|
||||
private readonly refId: number;
|
||||
|
||||
constructor(referenceNumber: number, initContent?: XmlComponent) {
|
||||
|
@ -3,3 +3,4 @@ export * from "./attributes";
|
||||
export * from "./default-attributes";
|
||||
export * from "./imported-xml-component";
|
||||
export * from "./xmlable-object";
|
||||
export * from "./initializable-xml-component";
|
||||
|
11
src/file/xml-components/initializable-xml-component.ts
Normal file
11
src/file/xml-components/initializable-xml-component.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
|
||||
export abstract class InitializableXmlComponent extends XmlComponent {
|
||||
constructor(rootKey: string, initComponent?: InitializableXmlComponent) {
|
||||
super(rootKey);
|
||||
|
||||
if (initComponent) {
|
||||
this.root = initComponent.root;
|
||||
}
|
||||
}
|
||||
}
|
@ -5,9 +5,9 @@ export { BaseXmlComponent };
|
||||
export abstract class XmlComponent extends BaseXmlComponent {
|
||||
protected root: Array<BaseXmlComponent | string>;
|
||||
|
||||
constructor(rootKey: string, initContent?: XmlComponent) {
|
||||
constructor(rootKey: string) {
|
||||
super(rootKey);
|
||||
this.root = initContent ? initContent.root : new Array<BaseXmlComponent>();
|
||||
this.root = new Array<BaseXmlComponent>();
|
||||
}
|
||||
|
||||
public prepForXml(): IXmlableObject {
|
||||
|
Reference in New Issue
Block a user