Introduce some functional programming techniques

This commit is contained in:
Dolan
2018-11-02 02:51:57 +00:00
parent 9cfd835171
commit 7980f14efb
108 changed files with 749 additions and 659 deletions

View File

@ -16,7 +16,7 @@ export enum WrapTextOption {
}
export interface ITextWrapping {
textWrapStyle: TextWrapStyle;
wrapTextOption?: WrapTextOption;
distanceFromText?: IDistance;
readonly textWrapStyle: TextWrapStyle;
readonly wrapTextOption?: WrapTextOption;
readonly distanceFromText?: IDistance;
}

View File

@ -4,11 +4,11 @@ import { ITextWrapping, WrapTextOption } from ".";
import { IDistance } from "../drawing";
interface IWrapSquareAttributes extends IDistance {
wrapText?: WrapTextOption;
readonly wrapText?: WrapTextOption;
}
class WrapSquareAttributes extends XmlAttributeComponent<IWrapSquareAttributes> {
protected xmlKeys = {
protected readonly xmlKeys = {
distT: "distT",
distB: "distB",
distL: "distL",

View File

@ -3,25 +3,25 @@ import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
import { IDistance } from "../drawing";
interface IWrapTightAttributes {
distT?: number;
distB?: number;
readonly distT?: number;
readonly distB?: number;
}
class WrapTightAttributes extends XmlAttributeComponent<IWrapTightAttributes> {
protected xmlKeys = {
protected readonly xmlKeys = {
distT: "distT",
distB: "distB",
};
}
export class WrapTight extends XmlComponent {
constructor(distanceFromText?: IDistance) {
super("wp:wrapTight");
distanceFromText = distanceFromText || {
constructor(
distanceFromText: IDistance = {
distT: 0,
distB: 0,
};
},
) {
super("wp:wrapTight");
this.root.push(
new WrapTightAttributes({

View File

@ -3,25 +3,25 @@ import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
import { IDistance } from "../drawing";
interface IWrapTopAndBottomAttributes {
distT?: number;
distB?: number;
readonly distT?: number;
readonly distB?: number;
}
class WrapTopAndBottomAttributes extends XmlAttributeComponent<IWrapTopAndBottomAttributes> {
protected xmlKeys = {
protected readonly xmlKeys = {
distT: "distT",
distB: "distB",
};
}
export class WrapTopAndBottom extends XmlComponent {
constructor(distanceFromText?: IDistance) {
super("wp:wrapTopAndBottom");
distanceFromText = distanceFromText || {
constructor(
distanceFromText: IDistance = {
distT: 0,
distB: 0,
};
},
) {
super("wp:wrapTopAndBottom");
this.root.push(
new WrapTopAndBottomAttributes({