Fix linting errors

This commit is contained in:
Dolan
2018-08-09 23:22:03 +01:00
parent 3436a1584c
commit 89df3c48e0
8 changed files with 37 additions and 36 deletions

View File

@ -1,7 +1,6 @@
import { IXmlableObject, XmlComponent } from "file/xml-components";
import { SectionProperties, SectionPropertiesOptions } from "./section-properties/section-properties";
import { Paragraph, ParagraphProperties } from "../..";
import { SectionProperties, SectionPropertiesOptions } from "./section-properties";
import { SectionProperties, SectionPropertiesOptions } from "./section-properties/section-properties";
export class Body extends XmlComponent {
private readonly defaultSection: SectionProperties;

View File

@ -1,8 +1,8 @@
import { expect } from "chai";
import { Formatter } from "../../../../../export/formatter";
import { PageBorders, PageBorderDisplay, PageBorderZOrder } from "./page-borders";
import { BorderStyle } from "../../../../styles";
import { PageBorderDisplay, PageBorders, PageBorderZOrder } from "./page-borders";
describe("PageBorders", () => {
describe("#constructor()", () => {

View File

@ -1,5 +1,5 @@
// http://officeopenxml.com/WPsectionBorders.php
import { XmlComponent, XmlAttributeComponent, IXmlableObject } from "file/xml-components";
import { IXmlableObject, XmlAttributeComponent, XmlComponent } from "file/xml-components";
import { BorderStyle } from "../../../../styles";
export enum PageBorderDisplay {
@ -24,22 +24,22 @@ export interface IPageBorderAttributes {
zOrder?: PageBorderZOrder;
}
export interface PageBorderConfiguration {
export interface IPageBorderConfiguration {
style?: BorderStyle;
size?: number;
color?: string;
space?: number;
}
export type PageBordersOptions = {
export interface IPageBordersOptions {
pageBorders?: IPageBorderAttributes;
pageBorderTop?: PageBorderConfiguration;
pageBorderRight?: PageBorderConfiguration;
pageBorderBottom?: PageBorderConfiguration;
pageBorderLeft?: PageBorderConfiguration;
};
pageBorderTop?: IPageBorderConfiguration;
pageBorderRight?: IPageBorderConfiguration;
pageBorderBottom?: IPageBorderConfiguration;
pageBorderLeft?: IPageBorderConfiguration;
}
class PageBordeAttributes extends XmlAttributeComponent<PageBorderConfiguration> {
class PageBordeAttributes extends XmlAttributeComponent<IPageBorderConfiguration> {
protected xmlKeys = {
style: "w:val",
size: "w:size",
@ -49,7 +49,7 @@ class PageBordeAttributes extends XmlAttributeComponent<PageBorderConfiguration>
}
class PageBorder extends XmlComponent {
constructor(key: string, options: PageBorderConfiguration) {
constructor(key: string, options: IPageBorderConfiguration) {
super(key);
this.root.push(new PageBordeAttributes(options));
@ -65,10 +65,12 @@ class PageBordersAttributes extends XmlAttributeComponent<IPageBorderAttributes>
}
export class PageBorders extends XmlComponent {
constructor(options?: PageBordersOptions) {
constructor(options?: IPageBordersOptions) {
super("w:pgBorders");
if (!options) return;
if (!options) {
return;
}
let pageBordersAttributes = {};
@ -82,10 +84,18 @@ export class PageBorders extends XmlComponent {
this.root.push(new PageBordersAttributes(pageBordersAttributes));
if (options.pageBorderTop) this.root.push(new PageBorder("w:top", options.pageBorderTop));
if (options.pageBorderRight) this.root.push(new PageBorder("w:right", options.pageBorderRight));
if (options.pageBorderBottom) this.root.push(new PageBorder("w:bottom", options.pageBorderBottom));
if (options.pageBorderLeft) this.root.push(new PageBorder("w:left", options.pageBorderLeft));
if (options.pageBorderTop) {
this.root.push(new PageBorder("w:top", options.pageBorderTop));
}
if (options.pageBorderRight) {
this.root.push(new PageBorder("w:right", options.pageBorderRight));
}
if (options.pageBorderBottom) {
this.root.push(new PageBorder("w:bottom", options.pageBorderBottom));
}
if (options.pageBorderLeft) {
this.root.push(new PageBorder("w:left", options.pageBorderLeft));
}
}
public prepForXml(): IXmlableObject {

View File

@ -1,6 +1,6 @@
// http://officeopenxml.com/WPsection.php
import { XmlComponent } from "file/xml-components";
import { FooterReferenceType, IPageNumberTypeAttributes, PageNumberFormat, PageNumberType } from "./";
import { FooterReferenceType, IPageBordersOptions, IPageNumberTypeAttributes, PageBorders, PageNumberFormat, PageNumberType } from "./";
import { Columns } from "./columns/columns";
import { IColumnsAttributes } from "./columns/columns-attributes";
import { DocumentGrid } from "./doc-grid/doc-grid";
@ -12,9 +12,6 @@ import { PageMargin } from "./page-margin/page-margin";
import { IPageMarginAttributes } from "./page-margin/page-margin-attributes";
import { PageSize } from "./page-size/page-size";
import { IPageSizeAttributes, PageOrientation } from "./page-size/page-size-attributes";
import { FooterReferenceType, IPageNumberTypeAttributes, PageNumberType, PageNumberFormat } from ".";
// import { TitlePage } from "./title-page/title-page";
import { FooterReferenceType, IPageNumberTypeAttributes, PageNumberType, PageNumberFormat, PageBordersOptions, PageBorders } from ".";
export type SectionPropertiesOptions = IPageSizeAttributes &
IPageMarginAttributes &
@ -23,7 +20,7 @@ export type SectionPropertiesOptions = IPageSizeAttributes &
IHeaderOptions &
IFooterOptions &
IPageNumberTypeAttributes &
PageBordersOptions;
IPageBordersOptions;
export class SectionProperties extends XmlComponent {
private readonly options: SectionPropertiesOptions;

View File

@ -2,7 +2,7 @@ import { AppProperties } from "./app-properties/app-properties";
import { ContentTypes } from "./content-types/content-types";
import { CoreProperties, IPropertiesOptions } from "./core-properties";
import { Document } from "./document";
import { FooterReferenceType, HeaderReference, HeaderReferenceType } from "./document/body/section-properties";
import { FooterReferenceType, HeaderReference, HeaderReferenceType, SectionPropertiesOptions } from "./document/body/section-properties";
import { FooterWrapper } from "./footer-wrapper";
import { FootNotes } from "./footnotes";
import { HeaderWrapper } from "./header-wrapper";
@ -14,7 +14,6 @@ import { Styles } from "./styles";
import { ExternalStylesFactory } from "./styles/external-styles-factory";
import { DefaultStylesFactory } from "./styles/factory";
import { Table } from "./table";
import { FooterReferenceType, HeaderReferenceType, SectionPropertiesOptions } from "./document/body/section-properties";
export class File {
private readonly document: Document;

View File

@ -61,8 +61,6 @@ export class Media {
this.map = new Map<string, IMediaData>();
}
x: Math.round(dimensions.width * 9525),
y: Math.round(dimensions.height * 9525),
public getMedia(key: string): IMediaData {
const data = this.map.get(key);
@ -108,12 +106,12 @@ export class Media {
fileName: key,
dimensions: {
pixels: {
x: dimensions.width,
y: dimensions.height,
x: Math.round(dimensions.width),
y: Math.round(dimensions.height),
},
emus: {
x: dimensions.width * 9525,
y: dimensions.height * 9525,
x: Math.round(dimensions.width * 9525),
y: Math.round(dimensions.height * 9525),
},
},
};

View File

@ -110,7 +110,7 @@ export class LevelBase extends XmlComponent {
this.root.push(this.runProperties);
}
public setSuffix(value: LevelSuffix) {
public setSuffix(value: LevelSuffix): LevelBase {
this.root.push(new Suffix(value));
return this;
}

View File

@ -1,7 +1,5 @@
import * as fastXmlParser from "fast-xml-parser";
import { ImportedXmlComponent, ImportedRootElementAttributes, parseOptions, convertToXmlComponent } from "./../../file/xml-components";
import { convertToXmlComponent, ImportedRootElementAttributes, ImportedXmlComponent, parseOptions } from "file/xml-components";
import { ImportedRootElementAttributes, parseOptions, convertToXmlComponent } from "./../../file/xml-components";
import { convertToXmlComponent, ImportedRootElementAttributes, parseOptions } from "file/xml-components";
import { Styles } from "./";
export class ExternalStylesFactory {