Fix linting errors
This commit is contained in:
@ -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()", () => {
|
||||
|
@ -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 {
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user