diff --git a/ts/docx/document/body/doc-grid.ts b/ts/docx/document/body/doc-grid.ts index dd3fba0e68..ec10ef4830 100644 --- a/ts/docx/document/body/doc-grid.ts +++ b/ts/docx/document/body/doc-grid.ts @@ -8,4 +8,4 @@ export class DocumentGrid extends XmlComponent { linePitch: "360", })); } -} \ No newline at end of file +} diff --git a/ts/docx/run/strike.ts b/ts/docx/run/strike.ts index bf19c2293e..7c8c575f0b 100644 --- a/ts/docx/run/strike.ts +++ b/ts/docx/run/strike.ts @@ -1,4 +1,4 @@ -import {XmlComponent} from "../xml-components"; +import { XmlComponent } from "../xml-components"; export class Strike extends XmlComponent { @@ -12,4 +12,4 @@ export class DoubleStrike extends XmlComponent { constructor() { super("w:dstrike"); } -} \ No newline at end of file +} diff --git a/ts/docx/run/tab.ts b/ts/docx/run/tab.ts index 6d1aa48ecd..3e346b6062 100644 --- a/ts/docx/run/tab.ts +++ b/ts/docx/run/tab.ts @@ -1,8 +1,8 @@ -import {XmlComponent} from "../xml-components"; +import { XmlComponent } from "../xml-components"; export class Tab extends XmlComponent { constructor() { super("w:tab"); } -} \ No newline at end of file +} diff --git a/ts/docx/run/text-run.ts b/ts/docx/run/text-run.ts index dcf850de6a..d8068021aa 100644 --- a/ts/docx/run/text-run.ts +++ b/ts/docx/run/text-run.ts @@ -1,5 +1,5 @@ -import {Text} from "./text"; -import {Run} from "../run"; +import { Run } from "../run"; +import { Text } from "./text"; export class TextRun extends Run { @@ -7,4 +7,4 @@ export class TextRun extends Run { super(); this.root.push(new Text(text)); } -} \ No newline at end of file +} diff --git a/ts/docx/run/text.ts b/ts/docx/run/text.ts index 1b55e9b1c3..68019098d4 100644 --- a/ts/docx/run/text.ts +++ b/ts/docx/run/text.ts @@ -1,4 +1,4 @@ -import {XmlUnitComponent} from "../xml-components" +import { XmlUnitComponent } from "../xml-components"; export class Text extends XmlUnitComponent { @@ -6,4 +6,4 @@ export class Text extends XmlUnitComponent { super("w:t"); this.root = text; } -} \ No newline at end of file +} diff --git a/ts/docx/run/underline.ts b/ts/docx/run/underline.ts index bdb294a4e5..cac9538a6b 100644 --- a/ts/docx/run/underline.ts +++ b/ts/docx/run/underline.ts @@ -6,7 +6,7 @@ abstract class BaseUnderline extends XmlComponent { super("w:u"); this.root.push(new Attributes({ val: underlineType, - color: color + color: color, })); } } @@ -88,7 +88,6 @@ export class DoubleUnderline extends BaseUnderline { } } - export class SingleUnderline extends BaseUnderline { constructor() { @@ -129,4 +128,4 @@ export class WordsUnderline extends BaseUnderline { constructor() { super("words"); } -} \ No newline at end of file +} diff --git a/ts/docx/xml-components/attributes.ts b/ts/docx/xml-components/attributes.ts index 37f3ca2c43..b47ad23261 100644 --- a/ts/docx/xml-components/attributes.ts +++ b/ts/docx/xml-components/attributes.ts @@ -1,7 +1,7 @@ -import {XmlAttributeComponent} from "./default-attributes"; +import { XmlAttributeComponent } from "./default-attributes"; -interface AttributesProperties { - val?: any; +interface IAttributesProperties { + val?: string | number | boolean; color?: string; space?: string; sz?: string; @@ -24,7 +24,7 @@ interface AttributesProperties { export class Attributes extends XmlAttributeComponent { - constructor(properties?: AttributesProperties) { + constructor(properties?: IAttributesProperties) { super({ val: "w:val", color: "w:color", @@ -44,7 +44,7 @@ export class Attributes extends XmlAttributeComponent { footer: "w:footer", gutter: "w:gutter", linePitch: "w:linePitch", - pos: "w:pos" + pos: "w:pos", }, properties); } -} \ No newline at end of file +} diff --git a/ts/docx/xml-components/base.ts b/ts/docx/xml-components/base.ts index 53c48f0b52..0fb1811bf4 100644 --- a/ts/docx/xml-components/base.ts +++ b/ts/docx/xml-components/base.ts @@ -5,7 +5,9 @@ export abstract class BaseXmlComponent { this.rootKey = rootKey; } - abstract replaceKey(): void; - clearVariables(): void { + public abstract replaceKey(): void; + + public clearVariables(): void { + // Do Nothing } -} \ No newline at end of file +} diff --git a/ts/docx/xml-components/default-attributes.ts b/ts/docx/xml-components/default-attributes.ts index 977db58a63..02b873f8f1 100644 --- a/ts/docx/xml-components/default-attributes.ts +++ b/ts/docx/xml-components/default-attributes.ts @@ -1,5 +1,5 @@ -import {BaseXmlComponent} from "./base"; import * as _ from "lodash"; +import { BaseXmlComponent } from "./base"; export abstract class XmlAttributeComponent extends BaseXmlComponent { protected root: Object; @@ -16,10 +16,10 @@ export abstract class XmlAttributeComponent extends BaseXmlComponent { } } - replaceKey(): void { + public replaceKey(): void { if (this.root !== undefined) { _.forOwn(this.root, (value, key) => { - let newKey = this.xmlKeys[key]; + const newKey = this.xmlKeys[key]; this.root[newKey] = value; delete this.root[key]; }); @@ -27,4 +27,4 @@ export abstract class XmlAttributeComponent extends BaseXmlComponent { delete this.root; } } -} \ No newline at end of file +} diff --git a/ts/docx/xml-components/index.ts b/ts/docx/xml-components/index.ts index fe73e6dcfe..07ef8f7363 100644 --- a/ts/docx/xml-components/index.ts +++ b/ts/docx/xml-components/index.ts @@ -1,19 +1,19 @@ import * as _ from "lodash"; -import {BaseXmlComponent} from "./base"; +import { BaseXmlComponent } from "./base"; export abstract class XmlComponent extends BaseXmlComponent { - protected root: Array; + protected root: BaseXmlComponent[]; constructor(rootKey: string) { super(rootKey); this.root = new Array(); } - replaceKey(): void { + public replaceKey(): void { // console.log(this.rootKey); // console.log(this.root); if (this.root !== undefined) { - this.root.forEach(root => { + this.root.forEach((root) => { if (root && root instanceof BaseXmlComponent) { root.replaceKey(); } @@ -27,4 +27,4 @@ export abstract class XmlComponent extends BaseXmlComponent { export * from "./attributes" export * from "./default-attributes"; export * from "./unit"; -export * from "./property"; \ No newline at end of file +export * from "./property"; diff --git a/ts/docx/xml-components/property.ts b/ts/docx/xml-components/property.ts index 9c4790c87d..bfc0cab717 100644 --- a/ts/docx/xml-components/property.ts +++ b/ts/docx/xml-components/property.ts @@ -1,17 +1,17 @@ -import {XmlComponent} from "./"; -import {ParagraphProperties} from "../paragraph/properties"; -import {RunProperties} from "../run/properties"; +import { ParagraphProperties } from "../paragraph/properties"; +import { RunProperties } from "../run/properties"; +import { XmlComponent } from "./"; export class ParagraphPropertyXmlComponent extends XmlComponent { private paragraphProperties: ParagraphProperties; - constructor(rootKey) { + constructor(rootKey: string) { super(rootKey); this.paragraphProperties = new ParagraphProperties(); this.root.push(this.paragraphProperties); } - clearVariables(): void { + public clearVariables(): void { this.paragraphProperties.clearVariables(); delete this.paragraphProperties; @@ -21,13 +21,13 @@ export class ParagraphPropertyXmlComponent extends XmlComponent { export class RunPropertyXmlComponent extends XmlComponent { private runProperties: RunProperties; - constructor(rootKey) { + constructor(rootKey: string) { super(rootKey); this.runProperties = new RunProperties(); this.root.push(this.runProperties); } - clearVariables(): void { + public clearVariables(): void { this.runProperties.clearVariables(); delete this.runProperties; @@ -38,7 +38,7 @@ export class MultiPropertyXmlComponent extends XmlComponent { private runProperties: RunProperties; private paragraphProperties: ParagraphProperties; - constructor(rootKey) { + constructor(rootKey: string) { super(rootKey); this.runProperties = new RunProperties(); this.root.push(this.runProperties); @@ -47,11 +47,11 @@ export class MultiPropertyXmlComponent extends XmlComponent { this.root.push(this.paragraphProperties); } - clearVariables(): void { + public clearVariables(): void { this.runProperties.clearVariables(); this.paragraphProperties.clearVariables(); delete this.runProperties; delete this.paragraphProperties; } -} \ No newline at end of file +} diff --git a/ts/docx/xml-components/unit.ts b/ts/docx/xml-components/unit.ts index e462fd4132..604655d230 100644 --- a/ts/docx/xml-components/unit.ts +++ b/ts/docx/xml-components/unit.ts @@ -7,10 +7,10 @@ export abstract class XmlUnitComponent extends BaseXmlComponent { super(rootKey); } - replaceKey(): void { + public replaceKey(): void { if (this.root !== undefined) { this[this.rootKey] = this.root; delete this.root; } } -} \ No newline at end of file +} diff --git a/ts/numbering/indent.ts b/ts/numbering/indent.ts index 38163fe812..b5bdac02b0 100644 --- a/ts/numbering/indent.ts +++ b/ts/numbering/indent.ts @@ -1,4 +1,4 @@ -import {XmlAttributeComponent, XmlComponent} from "../docx/xml-components"; +import { XmlAttributeComponent, XmlComponent } from "../docx/xml-components"; interface IndentAttributesProperties { left: number; diff --git a/ts/numbering/multi-level-type.ts b/ts/numbering/multi-level-type.ts index d987a9c652..9822b18c1a 100644 --- a/ts/numbering/multi-level-type.ts +++ b/ts/numbering/multi-level-type.ts @@ -1,4 +1,4 @@ -import {Attributes, XmlComponent} from "../docx/xml-components"; +import { Attributes, XmlComponent } from "../docx/xml-components"; export class MultiLevelType extends XmlComponent { diff --git a/ts/properties/components.ts b/ts/properties/components.ts index 1e6e44cb7a..5f25767a96 100644 --- a/ts/properties/components.ts +++ b/ts/properties/components.ts @@ -1,6 +1,6 @@ -import {XmlUnitComponent} from "../docx/xml-components"; -import {XmlComponent} from "../docx/xml-components"; -import {DocumentAttributes} from "../docx/document/document-attributes"; +import { DocumentAttributes } from "../docx/document/document-attributes"; +import { XmlUnitComponent } from "../docx/xml-components"; +import { XmlComponent } from "../docx/xml-components"; export class Title extends XmlUnitComponent { @@ -54,20 +54,20 @@ export class Revision extends XmlUnitComponent { constructor(value: string) { super("cp:revision"); - let revision = value; + const revision = value; this.root = value; } } abstract class DateComponent extends XmlComponent { protected getCurrentDate(): any { - let date = new Date(), - year = date.getFullYear(), - month = ("0" + (date.getMonth() + 1)).slice(-2), - day = ("0" + date.getDate()).slice(-2), - hours = ("0" + date.getHours()).slice(-2), - minutes = ("0" + date.getMinutes()).slice(-2), - seconds = ("0" + date.getSeconds()).slice(-2); + const date = new Date(); + const year = date.getFullYear(); + const month = ("0" + (date.getMonth() + 1)).slice(-2); + const day = ("0" + date.getDate()).slice(-2); + const hours = ("0" + date.getHours()).slice(-2); + const minutes = ("0" + date.getMinutes()).slice(-2); + const seconds = ("0" + date.getSeconds()).slice(-2); return year + "-" + month + "-" + day + "T" + hours + ":" + minutes + ":" + seconds + "Z"; } @@ -78,7 +78,7 @@ export class Created extends DateComponent { constructor() { super("dcterms:created"); this.root.push(new DocumentAttributes({ - type: "dcterms:W3CDTF" + type: "dcterms:W3CDTF", })); this.root.push(this.getCurrentDate()); } @@ -89,8 +89,8 @@ export class Modified extends DateComponent { constructor() { super("dcterms:modified"); this.root.push(new DocumentAttributes({ - type: "dcterms:W3CDTF" + type: "dcterms:W3CDTF", })); this.root.push(this.getCurrentDate()); } -} \ No newline at end of file +} diff --git a/ts/properties/index.ts b/ts/properties/index.ts index 48e59efb36..cbda98a13d 100644 --- a/ts/properties/index.ts +++ b/ts/properties/index.ts @@ -1,8 +1,8 @@ -import {XmlComponent} from "../docx/xml-components"; -import {DocumentAttributes} from "../docx/document/document-attributes"; -import {Title, Subject, Creator, Keywords, Description, LastModifiedBy, Revision, Created, Modified} from "./components"; +import { DocumentAttributes } from "../docx/document/document-attributes"; +import { XmlComponent } from "../docx/xml-components"; +import { Created, Creator, Description, Keywords, LastModifiedBy, Modified, Revision, Subject, Title } from "./components"; -interface PropertiesOptions { +interface IPropertiesOptions { title?: string; subject?: string; creator?: string; @@ -14,14 +14,14 @@ interface PropertiesOptions { export class Properties extends XmlComponent { - constructor(options: PropertiesOptions) { + constructor(options: IPropertiesOptions) { super("cp:coreProperties"); this.root.push(new DocumentAttributes({ cp: "http://schemas.openxmlformats.org/package/2006/metadata/core-properties", dc: "http://purl.org/dc/elements/1.1/", dcterms: "http://purl.org/dc/terms/", dcmitype: "http://purl.org/dc/dcmitype/", - xsi: "http://www.w3.org/2001/XMLSchema-instance" + xsi: "http://www.w3.org/2001/XMLSchema-instance", })); this.root.push(new Title(options.title)); this.root.push(new Subject(options.subject)); @@ -33,4 +33,4 @@ export class Properties extends XmlComponent { this.root.push(new Created()); this.root.push(new Modified()); } -} \ No newline at end of file +}