Files
docx-js/ts/docx/xml-components/index.ts

31 lines
828 B
TypeScript
Raw Normal View History

2016-04-25 03:28:02 +01:00
import * as _ from "lodash";
2017-03-08 21:49:41 +00:00
import { BaseXmlComponent } from "./base";
2016-04-25 03:28:02 +01:00
2016-04-21 23:27:46 +01:00
export abstract class XmlComponent extends BaseXmlComponent {
2017-03-08 21:49:41 +00:00
protected root: BaseXmlComponent[];
2016-04-21 23:27:46 +01:00
constructor(rootKey: string) {
super(rootKey);
this.root = new Array<BaseXmlComponent>();
}
2017-03-08 21:49:41 +00:00
public replaceKey(): void {
2016-05-26 15:08:34 +01:00
// console.log(this.rootKey);
// console.log(this.root);
2016-04-10 05:09:02 +01:00
if (this.root !== undefined) {
2017-03-08 21:49:41 +00:00
this.root.forEach((root) => {
2016-05-01 22:24:20 +01:00
if (root && root instanceof BaseXmlComponent) {
root.replaceKey();
}
2016-04-10 05:09:02 +01:00
});
2016-04-21 23:27:46 +01:00
this[this.rootKey] = this.root;
delete this.root;
}
}
}
export * from "./attributes"
export * from "./default-attributes";
export * from "./unit";
2017-03-08 21:49:41 +00:00
export * from "./property";