linting fixes
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import {XmlComponent} from "../xml-components";
|
||||
import { XmlComponent } from "../xml-components";
|
||||
|
||||
export class Strike extends XmlComponent {
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {XmlComponent} from "../xml-components";
|
||||
import { XmlComponent } from "../xml-components";
|
||||
|
||||
export class Tab extends XmlComponent {
|
||||
|
||||
|
@ -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 {
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {XmlUnitComponent} from "../xml-components"
|
||||
import { XmlUnitComponent } from "../xml-components";
|
||||
|
||||
export class Text extends XmlUnitComponent {
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
@ -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
|
||||
}
|
||||
}
|
@ -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];
|
||||
});
|
||||
|
@ -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<BaseXmlComponent>;
|
||||
protected root: BaseXmlComponent[];
|
||||
|
||||
constructor(rootKey: string) {
|
||||
super(rootKey);
|
||||
this.root = new Array<BaseXmlComponent>();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
@ -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,7 +47,7 @@ export class MultiPropertyXmlComponent extends XmlComponent {
|
||||
this.root.push(this.paragraphProperties);
|
||||
}
|
||||
|
||||
clearVariables(): void {
|
||||
public clearVariables(): void {
|
||||
this.runProperties.clearVariables();
|
||||
this.paragraphProperties.clearVariables();
|
||||
|
||||
|
@ -7,7 +7,7 @@ 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;
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {XmlAttributeComponent, XmlComponent} from "../docx/xml-components";
|
||||
import { XmlAttributeComponent, XmlComponent } from "../docx/xml-components";
|
||||
|
||||
interface IndentAttributesProperties {
|
||||
left: number;
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {Attributes, XmlComponent} from "../docx/xml-components";
|
||||
import { Attributes, XmlComponent } from "../docx/xml-components";
|
||||
|
||||
export class MultiLevelType extends XmlComponent {
|
||||
|
||||
|
@ -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,7 +89,7 @@ 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());
|
||||
}
|
||||
|
@ -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));
|
||||
|
Reference in New Issue
Block a user