add schema comments and update file/document; unify VerticalAlign type

This commit is contained in:
Tom Hunkapiller
2021-05-24 21:06:34 +03:00
parent 22e62ed950
commit e198f0752a
12 changed files with 81 additions and 67 deletions

View File

@ -110,31 +110,6 @@ export class VerticalMerge extends XmlComponent {
}
}
export enum VerticalAlign {
BOTTOM = "bottom",
CENTER = "center",
TOP = "top",
}
class VAlignAttributes extends XmlAttributeComponent<{ readonly val: VerticalAlign }> {
protected readonly xmlKeys = { val: "w:val" };
}
/**
* Vertical align element.
*/
export class VAlign extends XmlComponent {
constructor(value: VerticalAlign) {
super("w:vAlign");
this.root.push(
new VAlignAttributes({
val: value,
}),
);
}
}
export enum TextDirection {
BOTTOM_TO_TOP_LEFT_TO_RIGHT = "btLr",
LEFT_TO_RIGHT_TOP_TO_BOTTOM = "lrTb",

View File

@ -2,9 +2,11 @@ import { expect } from "chai";
import { Formatter } from "export/formatter";
import { BorderStyle } from "file/border";
import { VerticalAlign } from "file/vertical-align";
import { WidthType } from "../table-width";
import { VerticalAlign, VerticalMergeType } from "./table-cell-components";
import { VerticalMergeType } from "./table-cell-components";
import { TableCellProperties } from "./table-cell-properties";
describe("TableCellProperties", () => {

View File

@ -1,3 +1,4 @@
import { VerticalAlign, VerticalAlignElement } from "file/vertical-align";
import { IgnoreIfEmptyXmlComponent } from "file/xml-components";
import { IShadingAttributesProperties, Shading } from "../../shading";
@ -9,8 +10,6 @@ import {
TableCellBorders,
TDirection,
TextDirection,
VAlign,
VerticalAlign,
VerticalMerge,
VerticalMergeType,
} from "./table-cell-components";
@ -63,7 +62,7 @@ export class TableCellProperties extends IgnoreIfEmptyXmlComponent {
}
if (options.verticalAlign) {
this.root.push(new VAlign(options.verticalAlign));
this.root.push(new VerticalAlignElement(options.verticalAlign));
}
}
}

View File

@ -2,11 +2,12 @@ import { expect } from "chai";
import { Formatter } from "export/formatter";
import { BorderStyle } from "file/border";
import { ShadingType } from "file/shading";
import { VerticalAlign } from "file/vertical-align";
import { WidthType } from "../table-width";
import { TableCell } from "./table-cell";
import { TableCellBorders, TextDirection, VerticalAlign, VerticalMergeType } from "./table-cell-components";
import { TableCellBorders, TextDirection, VerticalMergeType } from "./table-cell-components";
describe("TableCellBorders", () => {
describe("#prepForXml", () => {