Fix linting errors
This commit is contained in:
@ -1,7 +1,6 @@
|
|||||||
import { IXmlableObject, XmlComponent } from "file/xml-components";
|
import { IXmlableObject, XmlComponent } from "file/xml-components";
|
||||||
import { SectionProperties, SectionPropertiesOptions } from "./section-properties/section-properties";
|
|
||||||
import { Paragraph, ParagraphProperties } from "../..";
|
import { Paragraph, ParagraphProperties } from "../..";
|
||||||
import { SectionProperties, SectionPropertiesOptions } from "./section-properties";
|
import { SectionProperties, SectionPropertiesOptions } from "./section-properties/section-properties";
|
||||||
|
|
||||||
export class Body extends XmlComponent {
|
export class Body extends XmlComponent {
|
||||||
private readonly defaultSection: SectionProperties;
|
private readonly defaultSection: SectionProperties;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
|
|
||||||
import { Formatter } from "../../../../../export/formatter";
|
import { Formatter } from "../../../../../export/formatter";
|
||||||
import { PageBorders, PageBorderDisplay, PageBorderZOrder } from "./page-borders";
|
|
||||||
import { BorderStyle } from "../../../../styles";
|
import { BorderStyle } from "../../../../styles";
|
||||||
|
import { PageBorderDisplay, PageBorders, PageBorderZOrder } from "./page-borders";
|
||||||
|
|
||||||
describe("PageBorders", () => {
|
describe("PageBorders", () => {
|
||||||
describe("#constructor()", () => {
|
describe("#constructor()", () => {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// http://officeopenxml.com/WPsectionBorders.php
|
// 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";
|
import { BorderStyle } from "../../../../styles";
|
||||||
|
|
||||||
export enum PageBorderDisplay {
|
export enum PageBorderDisplay {
|
||||||
@ -24,22 +24,22 @@ export interface IPageBorderAttributes {
|
|||||||
zOrder?: PageBorderZOrder;
|
zOrder?: PageBorderZOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PageBorderConfiguration {
|
export interface IPageBorderConfiguration {
|
||||||
style?: BorderStyle;
|
style?: BorderStyle;
|
||||||
size?: number;
|
size?: number;
|
||||||
color?: string;
|
color?: string;
|
||||||
space?: number;
|
space?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type PageBordersOptions = {
|
export interface IPageBordersOptions {
|
||||||
pageBorders?: IPageBorderAttributes;
|
pageBorders?: IPageBorderAttributes;
|
||||||
pageBorderTop?: PageBorderConfiguration;
|
pageBorderTop?: IPageBorderConfiguration;
|
||||||
pageBorderRight?: PageBorderConfiguration;
|
pageBorderRight?: IPageBorderConfiguration;
|
||||||
pageBorderBottom?: PageBorderConfiguration;
|
pageBorderBottom?: IPageBorderConfiguration;
|
||||||
pageBorderLeft?: PageBorderConfiguration;
|
pageBorderLeft?: IPageBorderConfiguration;
|
||||||
};
|
}
|
||||||
|
|
||||||
class PageBordeAttributes extends XmlAttributeComponent<PageBorderConfiguration> {
|
class PageBordeAttributes extends XmlAttributeComponent<IPageBorderConfiguration> {
|
||||||
protected xmlKeys = {
|
protected xmlKeys = {
|
||||||
style: "w:val",
|
style: "w:val",
|
||||||
size: "w:size",
|
size: "w:size",
|
||||||
@ -49,7 +49,7 @@ class PageBordeAttributes extends XmlAttributeComponent<PageBorderConfiguration>
|
|||||||
}
|
}
|
||||||
|
|
||||||
class PageBorder extends XmlComponent {
|
class PageBorder extends XmlComponent {
|
||||||
constructor(key: string, options: PageBorderConfiguration) {
|
constructor(key: string, options: IPageBorderConfiguration) {
|
||||||
super(key);
|
super(key);
|
||||||
|
|
||||||
this.root.push(new PageBordeAttributes(options));
|
this.root.push(new PageBordeAttributes(options));
|
||||||
@ -65,10 +65,12 @@ class PageBordersAttributes extends XmlAttributeComponent<IPageBorderAttributes>
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class PageBorders extends XmlComponent {
|
export class PageBorders extends XmlComponent {
|
||||||
constructor(options?: PageBordersOptions) {
|
constructor(options?: IPageBordersOptions) {
|
||||||
super("w:pgBorders");
|
super("w:pgBorders");
|
||||||
|
|
||||||
if (!options) return;
|
if (!options) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let pageBordersAttributes = {};
|
let pageBordersAttributes = {};
|
||||||
|
|
||||||
@ -82,10 +84,18 @@ export class PageBorders extends XmlComponent {
|
|||||||
|
|
||||||
this.root.push(new PageBordersAttributes(pageBordersAttributes));
|
this.root.push(new PageBordersAttributes(pageBordersAttributes));
|
||||||
|
|
||||||
if (options.pageBorderTop) this.root.push(new PageBorder("w:top", options.pageBorderTop));
|
if (options.pageBorderTop) {
|
||||||
if (options.pageBorderRight) this.root.push(new PageBorder("w:right", options.pageBorderRight));
|
this.root.push(new PageBorder("w:top", options.pageBorderTop));
|
||||||
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.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 {
|
public prepForXml(): IXmlableObject {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// http://officeopenxml.com/WPsection.php
|
// http://officeopenxml.com/WPsection.php
|
||||||
import { XmlComponent } from "file/xml-components";
|
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 { Columns } from "./columns/columns";
|
||||||
import { IColumnsAttributes } from "./columns/columns-attributes";
|
import { IColumnsAttributes } from "./columns/columns-attributes";
|
||||||
import { DocumentGrid } from "./doc-grid/doc-grid";
|
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 { IPageMarginAttributes } from "./page-margin/page-margin-attributes";
|
||||||
import { PageSize } from "./page-size/page-size";
|
import { PageSize } from "./page-size/page-size";
|
||||||
import { IPageSizeAttributes, PageOrientation } from "./page-size/page-size-attributes";
|
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 &
|
export type SectionPropertiesOptions = IPageSizeAttributes &
|
||||||
IPageMarginAttributes &
|
IPageMarginAttributes &
|
||||||
@ -23,7 +20,7 @@ export type SectionPropertiesOptions = IPageSizeAttributes &
|
|||||||
IHeaderOptions &
|
IHeaderOptions &
|
||||||
IFooterOptions &
|
IFooterOptions &
|
||||||
IPageNumberTypeAttributes &
|
IPageNumberTypeAttributes &
|
||||||
PageBordersOptions;
|
IPageBordersOptions;
|
||||||
|
|
||||||
export class SectionProperties extends XmlComponent {
|
export class SectionProperties extends XmlComponent {
|
||||||
private readonly options: SectionPropertiesOptions;
|
private readonly options: SectionPropertiesOptions;
|
||||||
|
@ -2,7 +2,7 @@ import { AppProperties } from "./app-properties/app-properties";
|
|||||||
import { ContentTypes } from "./content-types/content-types";
|
import { ContentTypes } from "./content-types/content-types";
|
||||||
import { CoreProperties, IPropertiesOptions } from "./core-properties";
|
import { CoreProperties, IPropertiesOptions } from "./core-properties";
|
||||||
import { Document } from "./document";
|
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 { FooterWrapper } from "./footer-wrapper";
|
||||||
import { FootNotes } from "./footnotes";
|
import { FootNotes } from "./footnotes";
|
||||||
import { HeaderWrapper } from "./header-wrapper";
|
import { HeaderWrapper } from "./header-wrapper";
|
||||||
@ -14,7 +14,6 @@ import { Styles } from "./styles";
|
|||||||
import { ExternalStylesFactory } from "./styles/external-styles-factory";
|
import { ExternalStylesFactory } from "./styles/external-styles-factory";
|
||||||
import { DefaultStylesFactory } from "./styles/factory";
|
import { DefaultStylesFactory } from "./styles/factory";
|
||||||
import { Table } from "./table";
|
import { Table } from "./table";
|
||||||
import { FooterReferenceType, HeaderReferenceType, SectionPropertiesOptions } from "./document/body/section-properties";
|
|
||||||
|
|
||||||
export class File {
|
export class File {
|
||||||
private readonly document: Document;
|
private readonly document: Document;
|
||||||
|
@ -61,8 +61,6 @@ export class Media {
|
|||||||
this.map = new Map<string, IMediaData>();
|
this.map = new Map<string, IMediaData>();
|
||||||
}
|
}
|
||||||
|
|
||||||
x: Math.round(dimensions.width * 9525),
|
|
||||||
y: Math.round(dimensions.height * 9525),
|
|
||||||
public getMedia(key: string): IMediaData {
|
public getMedia(key: string): IMediaData {
|
||||||
const data = this.map.get(key);
|
const data = this.map.get(key);
|
||||||
|
|
||||||
@ -108,12 +106,12 @@ export class Media {
|
|||||||
fileName: key,
|
fileName: key,
|
||||||
dimensions: {
|
dimensions: {
|
||||||
pixels: {
|
pixels: {
|
||||||
x: dimensions.width,
|
x: Math.round(dimensions.width),
|
||||||
y: dimensions.height,
|
y: Math.round(dimensions.height),
|
||||||
},
|
},
|
||||||
emus: {
|
emus: {
|
||||||
x: dimensions.width * 9525,
|
x: Math.round(dimensions.width * 9525),
|
||||||
y: dimensions.height * 9525,
|
y: Math.round(dimensions.height * 9525),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -110,7 +110,7 @@ export class LevelBase extends XmlComponent {
|
|||||||
this.root.push(this.runProperties);
|
this.root.push(this.runProperties);
|
||||||
}
|
}
|
||||||
|
|
||||||
public setSuffix(value: LevelSuffix) {
|
public setSuffix(value: LevelSuffix): LevelBase {
|
||||||
this.root.push(new Suffix(value));
|
this.root.push(new Suffix(value));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
import * as fastXmlParser from "fast-xml-parser";
|
import * as fastXmlParser from "fast-xml-parser";
|
||||||
import { ImportedXmlComponent, ImportedRootElementAttributes, parseOptions, convertToXmlComponent } from "./../../file/xml-components";
|
import { convertToXmlComponent, ImportedRootElementAttributes, parseOptions } from "file/xml-components";
|
||||||
import { convertToXmlComponent, ImportedRootElementAttributes, ImportedXmlComponent, parseOptions } from "file/xml-components";
|
|
||||||
import { ImportedRootElementAttributes, parseOptions, convertToXmlComponent } from "./../../file/xml-components";
|
|
||||||
import { Styles } from "./";
|
import { Styles } from "./";
|
||||||
|
|
||||||
export class ExternalStylesFactory {
|
export class ExternalStylesFactory {
|
||||||
|
Reference in New Issue
Block a user