Initial ESlint conversion

This commit is contained in:
Dolan Miu
2022-08-31 07:52:27 +01:00
parent d7a9cb2168
commit 1bdf9a4987
210 changed files with 4685 additions and 333 deletions

View File

@ -18,7 +18,7 @@ export class AlignmentAttributes extends XmlAttributeComponent<{ readonly val: A
}
export class Alignment extends XmlComponent {
constructor(type: AlignmentType) {
public constructor(type: AlignmentType) {
super("w:jc");
this.root.push(new AlignmentAttributes({ val: type }));
}

View File

@ -10,7 +10,7 @@ export interface IBordersOptions {
}
export class Border extends IgnoreIfEmptyXmlComponent {
constructor(options: IBordersOptions) {
public constructor(options: IBordersOptions) {
super("w:pBdr");
if (options.top) {
@ -32,7 +32,7 @@ export class Border extends IgnoreIfEmptyXmlComponent {
}
export class ThematicBreak extends XmlComponent {
constructor() {
public constructor() {
super("w:pBdr");
const bottom = new BorderElement("w:bottom", {
color: "auto",

View File

@ -9,7 +9,7 @@ enum BreakType {
}
class Break extends XmlComponent {
constructor(type: BreakType) {
public constructor(type: BreakType) {
super("w:br");
this.root.push(
new Attributes({
@ -20,14 +20,14 @@ class Break extends XmlComponent {
}
export class PageBreak extends Run {
constructor() {
public constructor() {
super({});
this.root.push(new Break(BreakType.PAGE));
}
}
export class ColumnBreak extends Run {
constructor() {
public constructor() {
super({});
this.root.push(new Break(BreakType.COLUMN));
}
@ -37,7 +37,7 @@ export class ColumnBreak extends Run {
* Add page break before the paragraph if there is no one added before.
*/
export class PageBreakBefore extends XmlComponent {
constructor() {
public constructor() {
super("w:pageBreakBefore");
}
}

View File

@ -41,7 +41,7 @@ class IndentAttributes extends XmlAttributeComponent<IIndentAttributesProperties
// ...
// <xsd:element name="ind" type="CT_Ind" minOccurs="0"/>
export class Indent extends XmlComponent {
constructor({ start, end, left, right, hanging, firstLine }: IIndentAttributesProperties) {
public constructor({ start, end, left, right, hanging, firstLine }: IIndentAttributesProperties) {
super("w:ind");
this.root.push(
new IndentAttributes({

View File

@ -25,7 +25,7 @@ class SpacingAttributes extends XmlAttributeComponent<ISpacingProperties> {
}
export class Spacing extends XmlComponent {
constructor(options: ISpacingProperties) {
public constructor(options: ISpacingProperties) {
super("w:spacing");
this.root.push(new SpacingAttributes(options));
}

View File

@ -11,7 +11,7 @@ export enum HeadingLevel {
}
export class Style extends XmlComponent {
constructor(styleId: string) {
public constructor(styleId: string) {
super("w:pStyle");
this.root.push(
new Attributes({

View File

@ -2,7 +2,7 @@
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
export class TabStop extends XmlComponent {
constructor(type: TabStopType, position: number, leader?: LeaderType) {
public constructor(type: TabStopType, position: number, leader?: LeaderType) {
super("w:tabs");
this.root.push(new TabStopItem(type, position, leader));
}
@ -41,7 +41,7 @@ export class TabAttributes extends XmlAttributeComponent<{
}
export class TabStopItem extends XmlComponent {
constructor(value: TabStopType, position: string | number, leader?: LeaderType) {
public constructor(value: TabStopType, position: string | number, leader?: LeaderType) {
super("w:tab");
this.root.push(
new TabAttributes({

View File

@ -1,7 +1,7 @@
import { Attributes, XmlComponent } from "@file/xml-components";
export class NumberProperties extends XmlComponent {
constructor(numberId: number | string, indentLevel: number) {
public constructor(numberId: number | string, indentLevel: number) {
super("w:numPr");
this.root.push(new IndentLevel(indentLevel));
this.root.push(new NumberId(numberId));
@ -9,7 +9,7 @@ export class NumberProperties extends XmlComponent {
}
class IndentLevel extends XmlComponent {
constructor(level: number) {
public constructor(level: number) {
super("w:ilvl");
if (level > 9) {
@ -27,7 +27,7 @@ class IndentLevel extends XmlComponent {
}
class NumberId extends XmlComponent {
constructor(id: number | string) {
public constructor(id: number | string) {
super("w:numId");
this.root.push(
new Attributes({

View File

@ -97,7 +97,7 @@ export class FramePropertiesAttributes extends XmlAttributeComponent<{
}
export class FrameProperties extends XmlComponent {
constructor(options: IFrameOptions) {
public constructor(options: IFrameOptions) {
super("w:framePr");
this.root.push(
new FramePropertiesAttributes({

View File

@ -10,7 +10,7 @@ export class Bookmark {
public readonly children: ParagraphChild[];
public readonly end: BookmarkEnd;
constructor(options: { readonly id: string; readonly children: ParagraphChild[] }) {
public constructor(options: { readonly id: string; readonly children: ParagraphChild[] }) {
const linkId = uniqueNumericId();
this.start = new BookmarkStart(options.id, linkId);
@ -52,7 +52,7 @@ export class Bookmark {
// </xsd:complexType>
export class BookmarkStart extends XmlComponent {
constructor(id: string, linkId: number) {
public constructor(id: string, linkId: number) {
super("w:bookmarkStart");
const attributes = new BookmarkStartAttributes({
@ -64,7 +64,7 @@ export class BookmarkStart extends XmlComponent {
}
export class BookmarkEnd extends XmlComponent {
constructor(linkId: number) {
public constructor(linkId: number) {
super("w:bookmarkEnd");
const attributes = new BookmarkEndAttributes({

View File

@ -13,7 +13,7 @@ export enum HyperlinkType {
export class ConcreteHyperlink extends XmlComponent {
public readonly linkId: string;
constructor(children: ParagraphChild[], relationshipId: string, anchor?: string) {
public constructor(children: ParagraphChild[], relationshipId: string, anchor?: string) {
super("w:hyperlink");
this.linkId = relationshipId;
@ -33,13 +33,13 @@ export class ConcreteHyperlink extends XmlComponent {
}
export class InternalHyperlink extends ConcreteHyperlink {
constructor(options: { readonly children: ParagraphChild[]; readonly anchor: string }) {
public constructor(options: { readonly children: ParagraphChild[]; readonly anchor: string }) {
super(options.children, uniqueId(), options.anchor);
}
}
export class ExternalHyperlink extends XmlComponent {
constructor(public readonly options: { readonly children: ParagraphChild[]; readonly link: string }) {
public constructor(public readonly options: { readonly children: ParagraphChild[]; readonly link: string }) {
super("w:externalHyperlink");
}
}

View File

@ -2,7 +2,7 @@
import { Attributes, XmlComponent } from "@file/xml-components";
export class OutlineLevel extends XmlComponent {
constructor(public readonly level: number) {
public constructor(public readonly level: number) {
super("w:outlineLvl");
this.root.push(

View File

@ -5,7 +5,7 @@ import { TextAttributes } from "../run/text-attributes";
import { IPageReferenceOptions } from "./pageref-properties";
export class PageReferenceFieldInstruction extends XmlComponent {
constructor(bookmarkId: string, options: IPageReferenceOptions = {}) {
public constructor(bookmarkId: string, options: IPageReferenceOptions = {}) {
super("w:instrText");
this.root.push(new TextAttributes({ space: SpaceType.PRESERVE }));

View File

@ -5,7 +5,7 @@ import { PageReferenceFieldInstruction } from "./pageref-field-instruction";
import type { IPageReferenceOptions } from "./pageref-properties";
export class PageReference extends Run {
constructor(bookmarkId: string, options: IPageReferenceOptions = {}) {
public constructor(bookmarkId: string, options: IPageReferenceOptions = {}) {
super({
children: [new Begin(true), new PageReferenceFieldInstruction(bookmarkId, options), new End()],
});

View File

@ -6,7 +6,7 @@ import { MathBase } from "../n-ary";
import { MathBracketProperties } from "./math-bracket-properties";
export class MathAngledBrackets extends XmlComponent {
constructor(options: { readonly children: MathComponent[] }) {
public constructor(options: { readonly children: MathComponent[] }) {
super("m:d");
this.root.push(

View File

@ -6,7 +6,7 @@ class MathBeginningCharacterAttributes extends XmlAttributeComponent<{ readonly
}
export class MathBeginningCharacter extends XmlComponent {
constructor(character: string) {
public constructor(character: string) {
super("m:begChr");
this.root.push(new MathBeginningCharacterAttributes({ character }));

View File

@ -5,7 +5,7 @@ import { MathBeginningCharacter } from "./math-beginning-character";
import { MathEndingCharacter } from "./math-ending-char";
export class MathBracketProperties extends XmlComponent {
constructor(options?: { readonly beginningCharacter: string; readonly endingCharacter: string }) {
public constructor(options?: { readonly beginningCharacter: string; readonly endingCharacter: string }) {
super("m:dPr");
if (!!options) {

View File

@ -6,7 +6,7 @@ import { MathBase } from "../n-ary";
import { MathBracketProperties } from "./math-bracket-properties";
export class MathCurlyBrackets extends XmlComponent {
constructor(options: { readonly children: MathComponent[] }) {
public constructor(options: { readonly children: MathComponent[] }) {
super("m:d");
this.root.push(

View File

@ -6,7 +6,7 @@ class MathEndingCharacterAttributes extends XmlAttributeComponent<{ readonly cha
}
export class MathEndingCharacter extends XmlComponent {
constructor(character: string) {
public constructor(character: string) {
super("m:endChr");
this.root.push(new MathEndingCharacterAttributes({ character }));

View File

@ -6,7 +6,7 @@ import { MathBase } from "../n-ary";
import { MathBracketProperties } from "./math-bracket-properties";
export class MathRoundBrackets extends XmlComponent {
constructor(options: { readonly children: MathComponent[] }) {
public constructor(options: { readonly children: MathComponent[] }) {
super("m:d");
this.root.push(new MathBracketProperties());

View File

@ -6,7 +6,7 @@ import { MathBase } from "../n-ary";
import { MathBracketProperties } from "./math-bracket-properties";
export class MathSquareBrackets extends XmlComponent {
constructor(options: { readonly children: MathComponent[] }) {
public constructor(options: { readonly children: MathComponent[] }) {
super("m:d");
this.root.push(

View File

@ -3,7 +3,7 @@ import { XmlComponent } from "@file/xml-components";
import { MathComponent } from "../math-component";
export class MathDenominator extends XmlComponent {
constructor(children: MathComponent[]) {
public constructor(children: MathComponent[]) {
super("m:den");
for (const child of children) {

View File

@ -10,7 +10,7 @@ export interface IMathFractionOptions {
}
export class MathFraction extends XmlComponent {
constructor(options: IMathFractionOptions) {
public constructor(options: IMathFractionOptions) {
super("m:f");
this.root.push(new MathNumerator(options.numerator));

View File

@ -3,7 +3,7 @@ import { XmlComponent } from "@file/xml-components";
import { MathComponent } from "../math-component";
export class MathNumerator extends XmlComponent {
constructor(children: MathComponent[]) {
public constructor(children: MathComponent[]) {
super("m:num");
for (const child of children) {

View File

@ -3,7 +3,7 @@ import { XmlComponent } from "@file/xml-components";
import { MathComponent } from "../math-component";
export class MathFunctionName extends XmlComponent {
constructor(children: MathComponent[]) {
public constructor(children: MathComponent[]) {
super("m:fName");
for (const child of children) {

View File

@ -2,7 +2,7 @@
import { XmlComponent } from "@file/xml-components";
export class MathFunctionProperties extends XmlComponent {
constructor() {
public constructor() {
super("m:funcPr");
}
}

View File

@ -12,7 +12,7 @@ export interface IMathFunctionOptions {
}
export class MathFunction extends XmlComponent {
constructor(options: IMathFunctionOptions) {
public constructor(options: IMathFunctionOptions) {
super("m:func");
this.root.push(new MathFunctionProperties());

View File

@ -4,7 +4,7 @@ import { XmlComponent } from "@file/xml-components";
import { MathText } from "./math-text";
export class MathRun extends XmlComponent {
constructor(text: string) {
public constructor(text: string) {
super("m:r");
this.root.push(new MathText(text));

View File

@ -1,7 +1,7 @@
import { XmlComponent } from "@file/xml-components";
export class MathText extends XmlComponent {
constructor(text: string) {
public constructor(text: string) {
super("m:t");
this.root.push(text);

View File

@ -8,7 +8,7 @@ export interface IMathOptions {
}
export class Math extends XmlComponent {
constructor(options: IMathOptions) {
public constructor(options: IMathOptions) {
super("m:oMath");
for (const child of options.children) {

View File

@ -6,7 +6,7 @@ class MathAccentCharacterAttributes extends XmlAttributeComponent<{ readonly acc
}
export class MathAccentCharacter extends XmlComponent {
constructor(accent: string) {
public constructor(accent: string) {
super("m:chr");
this.root.push(new MathAccentCharacterAttributes({ accent }));

View File

@ -4,7 +4,7 @@ import { XmlComponent } from "@file/xml-components";
import { MathComponent } from "../math-component";
export class MathBase extends XmlComponent {
constructor(children: MathComponent[]) {
public constructor(children: MathComponent[]) {
super("m:e");
for (const child of children) {

View File

@ -6,7 +6,7 @@ class MathLimitLocationAttributes extends XmlAttributeComponent<{ readonly value
}
export class MathLimitLocation extends XmlComponent {
constructor() {
public constructor() {
super("m:limLoc");
this.root.push(new MathLimitLocationAttributes({ value: "undOvr" }));

View File

@ -7,7 +7,7 @@ import { MathSubScriptHide } from "./math-sub-script-hide";
import { MathSuperScriptHide } from "./math-super-script-hide";
export class MathNAryProperties extends XmlComponent {
constructor(accent: string, hasSuperScript: boolean, hasSubScript: boolean) {
public constructor(accent: string, hasSuperScript: boolean, hasSubScript: boolean) {
super("m:naryPr");
this.root.push(new MathAccentCharacter(accent));

View File

@ -6,7 +6,7 @@ class MathSubScriptHideAttributes extends XmlAttributeComponent<{ readonly hide:
}
export class MathSubScriptHide extends XmlComponent {
constructor() {
public constructor() {
super("m:subHide");
this.root.push(new MathSubScriptHideAttributes({ hide: 1 }));

View File

@ -4,7 +4,7 @@ import { XmlComponent } from "@file/xml-components";
import { MathComponent } from "../math-component";
export class MathSubScriptElement extends XmlComponent {
constructor(children: MathComponent[]) {
public constructor(children: MathComponent[]) {
super("m:sub");
for (const child of children) {

View File

@ -14,7 +14,7 @@ export interface IMathSumOptions {
}
export class MathSum extends XmlComponent {
constructor(options: IMathSumOptions) {
public constructor(options: IMathSumOptions) {
super("m:nary");
this.root.push(new MathNAryProperties("∑", !!options.superScript, !!options.subScript));

View File

@ -6,7 +6,7 @@ class MathSuperScriptHideAttributes extends XmlAttributeComponent<{ readonly hid
}
export class MathSuperScriptHide extends XmlComponent {
constructor() {
public constructor() {
super("m:supHide");
this.root.push(new MathSuperScriptHideAttributes({ hide: 1 }));

View File

@ -4,7 +4,7 @@ import { XmlComponent } from "@file/xml-components";
import { MathComponent } from "../math-component";
export class MathSuperScriptElement extends XmlComponent {
constructor(children: MathComponent[]) {
public constructor(children: MathComponent[]) {
super("m:sup");
for (const child of children) {

View File

@ -6,7 +6,7 @@ class MathDegreeHideAttributes extends XmlAttributeComponent<{ readonly hide: nu
}
export class MathDegreeHide extends XmlComponent {
constructor() {
public constructor() {
super("m:degHide");
this.root.push(new MathDegreeHideAttributes({ hide: 1 }));

View File

@ -3,7 +3,7 @@ import { XmlComponent } from "@file/xml-components";
import { MathComponent } from "../math-component";
export class MathDegree extends XmlComponent {
constructor(children?: MathComponent[]) {
public constructor(children?: MathComponent[]) {
super("m:deg");
if (!!children) {

View File

@ -3,7 +3,7 @@ import { XmlComponent } from "@file/xml-components";
import { MathDegreeHide } from "./math-degree-hide";
export class MathRadicalProperties extends XmlComponent {
constructor(hasDegree: boolean) {
public constructor(hasDegree: boolean) {
super("m:radPr");
if (!hasDegree) {

View File

@ -12,7 +12,7 @@ export interface IMathRadicalOptions {
}
export class MathRadical extends XmlComponent {
constructor(options: IMathRadicalOptions) {
public constructor(options: IMathRadicalOptions) {
super("m:rad");
this.root.push(new MathRadicalProperties(!!options.degree));

View File

@ -2,7 +2,7 @@
import { XmlComponent } from "@file/xml-components";
export class MathPreSubSuperScriptProperties extends XmlComponent {
constructor() {
public constructor() {
super("m:sPrePr");
}
}

View File

@ -12,7 +12,7 @@ export interface IMathPreSubSuperScriptOptions {
}
export class MathPreSubSuperScript extends XmlComponent {
constructor(options: IMathPreSubSuperScriptOptions) {
public constructor(options: IMathPreSubSuperScriptOptions) {
super("m:sPre");
this.root.push(new MathPreSubSuperScriptProperties());

View File

@ -2,7 +2,7 @@
import { XmlComponent } from "@file/xml-components";
export class MathSubScriptProperties extends XmlComponent {
constructor() {
public constructor() {
super("m:sSubPr");
}
}

View File

@ -11,7 +11,7 @@ export interface IMathSubScriptOptions {
}
export class MathSubScript extends XmlComponent {
constructor(options: IMathSubScriptOptions) {
public constructor(options: IMathSubScriptOptions) {
super("m:sSub");
this.root.push(new MathSubScriptProperties());

View File

@ -2,7 +2,7 @@
import { XmlComponent } from "@file/xml-components";
export class MathSubSuperScriptProperties extends XmlComponent {
constructor() {
public constructor() {
super("m:sSubSupPr");
}
}

View File

@ -12,7 +12,7 @@ export interface IMathSubSuperScriptOptions {
}
export class MathSubSuperScript extends XmlComponent {
constructor(options: IMathSubSuperScriptOptions) {
public constructor(options: IMathSubSuperScriptOptions) {
super("m:sSubSup");
this.root.push(new MathSubSuperScriptProperties());

View File

@ -2,7 +2,7 @@
import { XmlComponent } from "@file/xml-components";
export class MathSuperScriptProperties extends XmlComponent {
constructor() {
public constructor() {
super("m:sSupPr");
}
}

View File

@ -11,7 +11,7 @@ export interface IMathSuperScriptOptions {
}
export class MathSuperScript extends XmlComponent {
constructor(options: IMathSuperScriptOptions) {
public constructor(options: IMathSuperScriptOptions) {
super("m:sSup");
this.root.push(new MathSuperScriptProperties());

View File

@ -42,7 +42,7 @@ export interface IParagraphOptions extends IParagraphPropertiesOptions {
export class Paragraph extends XmlComponent {
private readonly properties: ParagraphProperties;
constructor(options: string | IParagraphOptions) {
public constructor(options: string | IParagraphOptions) {
super("w:p");
if (typeof options === "string") {

View File

@ -59,7 +59,7 @@ export interface IParagraphPropertiesOptions extends IParagraphStylePropertiesOp
export class ParagraphProperties extends IgnoreIfEmptyXmlComponent {
private readonly numberingReferences: { readonly reference: string; readonly instance: number }[] = [];
constructor(options?: IParagraphPropertiesOptions) {
public constructor(options?: IParagraphPropertiesOptions) {
super("w:pPr");
if (!options) {

View File

@ -26,7 +26,7 @@ import { XmlComponent } from "@file/xml-components";
// </xsd:restriction>
// </xsd:simpleType>
export class Break extends XmlComponent {
constructor() {
public constructor() {
super("w:br");
}
}

View File

@ -96,7 +96,7 @@ class RootCommentsAttributes extends XmlAttributeComponent<{
}
export class CommentRangeStart extends XmlComponent {
constructor(id: number) {
public constructor(id: number) {
super("w:commentRangeStart");
this.root.push(new CommentRangeAttributes({ id }));
@ -104,7 +104,7 @@ export class CommentRangeStart extends XmlComponent {
}
export class CommentRangeEnd extends XmlComponent {
constructor(id: number) {
public constructor(id: number) {
super("w:commentRangeEnd");
this.root.push(new CommentRangeAttributes({ id }));
@ -112,7 +112,7 @@ export class CommentRangeEnd extends XmlComponent {
}
export class CommentReference extends XmlComponent {
constructor(id: number) {
public constructor(id: number) {
super("w:commentReference");
this.root.push(new CommentRangeAttributes({ id }));
@ -120,7 +120,7 @@ export class CommentReference extends XmlComponent {
}
export class Comment extends XmlComponent {
constructor({ id, initials, author, date = new Date(), text }: ICommentOptions) {
public constructor({ id, initials, author, date = new Date(), text }: ICommentOptions) {
super("w:comment");
this.root.push(
@ -136,7 +136,7 @@ export class Comment extends XmlComponent {
}
}
export class Comments extends XmlComponent {
constructor({ children }: ICommentsOptions) {
public constructor({ children }: ICommentsOptions) {
super("w:comments");
this.root.push(

View File

@ -16,13 +16,13 @@ export abstract class BaseEmphasisMark extends XmlComponent {
}
export class EmphasisMark extends BaseEmphasisMark {
constructor(emphasisMarkType: EmphasisMarkType = EmphasisMarkType.DOT) {
public constructor(emphasisMarkType: EmphasisMarkType = EmphasisMarkType.DOT) {
super(emphasisMarkType);
}
}
export class DotEmphasisMark extends BaseEmphasisMark {
constructor() {
public constructor() {
super(EmphasisMarkType.DOT);
}
}

View File

@ -11,21 +11,21 @@ class FidCharAttrs extends XmlAttributeComponent<{ readonly type: FieldCharacter
}
export class Begin extends XmlComponent {
constructor(dirty?: boolean) {
public constructor(dirty?: boolean) {
super("w:fldChar");
this.root.push(new FidCharAttrs({ type: FieldCharacterType.BEGIN, dirty }));
}
}
export class Separate extends XmlComponent {
constructor(dirty?: boolean) {
public constructor(dirty?: boolean) {
super("w:fldChar");
this.root.push(new FidCharAttrs({ type: FieldCharacterType.SEPARATE, dirty }));
}
}
export class End extends XmlComponent {
constructor(dirty?: boolean) {
public constructor(dirty?: boolean) {
super("w:fldChar");
this.root.push(new FidCharAttrs({ type: FieldCharacterType.END, dirty }));
}

View File

@ -2,7 +2,7 @@ import { Attributes, XmlComponent } from "@file/xml-components";
import { hexColorValue, signedTwipsMeasureValue } from "@util/values";
export class CharacterSpacing extends XmlComponent {
constructor(value: number | string) {
public constructor(value: number | string) {
super("w:spacing");
this.root.push(
new Attributes({
@ -19,7 +19,7 @@ export class CharacterSpacing extends XmlComponent {
// <xsd:attribute name="themeShade" type="ST_UcharHexNumber" use="optional"/>
// </xsd:complexType>
export class Color extends XmlComponent {
constructor(color: string) {
public constructor(color: string) {
super("w:color");
this.root.push(
new Attributes({
@ -51,7 +51,7 @@ export class Color extends XmlComponent {
// </xsd:restriction>
// </xsd:simpleType>
export class Highlight extends XmlComponent {
constructor(color: string) {
public constructor(color: string) {
super("w:highlight");
this.root.push(
new Attributes({
@ -62,7 +62,7 @@ export class Highlight extends XmlComponent {
}
export class HighlightComplexScript extends XmlComponent {
constructor(color: string) {
public constructor(color: string) {
super("w:highlightCs");
this.root.push(
new Attributes({

View File

@ -17,7 +17,7 @@ export class ImageRun extends Run {
private readonly key = `${uniqueId()}.png`;
private readonly imageData: IMediaData;
constructor(options: IImageOptions) {
public constructor(options: IImageOptions) {
super({});
const newData = typeof options.data === "string" ? this.convertDataURIToBinary(options.data) : options.data;

View File

@ -4,7 +4,7 @@ import { XmlComponent } from "@file/xml-components";
import { TextAttributes } from "./text-attributes";
export class Page extends XmlComponent {
constructor() {
public constructor() {
super("w:instrText");
this.root.push(new TextAttributes({ space: SpaceType.PRESERVE }));
this.root.push("PAGE");
@ -12,7 +12,7 @@ export class Page extends XmlComponent {
}
export class NumberOfPages extends XmlComponent {
constructor() {
public constructor() {
super("w:instrText");
this.root.push(new TextAttributes({ space: SpaceType.PRESERVE }));
this.root.push("NUMPAGES");
@ -20,7 +20,7 @@ export class NumberOfPages extends XmlComponent {
}
export class NumberOfPagesSection extends XmlComponent {
constructor() {
public constructor() {
super("w:instrText");
this.root.push(new TextAttributes({ space: SpaceType.PRESERVE }));
this.root.push("SECTIONPAGES");

View File

@ -99,7 +99,7 @@ export interface IRunPropertiesChangeOptions extends IRunPropertiesOptions, ICha
// </xsd:choice>
// </xsd:group>
export class RunProperties extends IgnoreIfEmptyXmlComponent {
constructor(options?: IRunPropertiesOptions) {
public constructor(options?: IRunPropertiesOptions) {
super("w:rPr");
if (!options) {
@ -225,7 +225,7 @@ export class RunProperties extends IgnoreIfEmptyXmlComponent {
}
export class RunPropertiesChange extends XmlComponent {
constructor(options: IRunPropertiesChangeOptions) {
public constructor(options: IRunPropertiesChangeOptions) {
super("w:rPrChange");
this.root.push(
new ChangeAttributes({

View File

@ -11,7 +11,7 @@ class SymbolAttributes extends XmlAttributeComponent<{
}
export class Symbol extends XmlComponent {
constructor(char: string = "", symbolfont: string = "Wingdings") {
public constructor(char: string = "", symbolfont: string = "Wingdings") {
super("w:sym");
this.root.push(new SymbolAttributes({ char: char, symbolfont: symbolfont }));
}

View File

@ -4,7 +4,7 @@ import { XmlComponent } from "@file/xml-components";
import { TextAttributes } from "../text-attributes";
export class Text extends XmlComponent {
constructor(text: string) {
public constructor(text: string) {
super("w:t");
this.root.push(new TextAttributes({ space: SpaceType.PRESERVE }));

View File

@ -19,12 +19,12 @@ class RunFontAttributes extends XmlAttributeComponent<IFontAttributesProperties>
}
export class RunFonts extends XmlComponent {
constructor(name: string, hint?: string);
constructor(attrs: string | IFontAttributesProperties);
constructor(nameOrAttrs: string | IFontAttributesProperties, hint?: string) {
public constructor(name: string, hint?: string);
public constructor(attrs: string | IFontAttributesProperties);
public constructor(nameOrAttrs: string | IFontAttributesProperties, hint?: string) {
super("w:rFonts");
if (typeof nameOrAttrs === "string") {
// use constructor(name: string, hint?: string);
// use public constructor(name: string, hint?: string);
const name = nameOrAttrs;
this.root.push(
new RunFontAttributes({
@ -36,7 +36,7 @@ export class RunFonts extends XmlComponent {
}),
);
} else {
// use constructor(attrs: IRunFontAttributesProperties);
// use public constructor(attrs: IRunFontAttributesProperties);
const attrs = nameOrAttrs;
this.root.push(new RunFontAttributes(attrs));
}

View File

@ -26,7 +26,7 @@ export enum PageNumber {
export class Run extends XmlComponent {
protected readonly properties: RunProperties;
constructor(options: IRunOptions) {
public constructor(options: IRunOptions) {
super("w:r");
this.properties = new RunProperties(options);
this.root.push(this.properties);

View File

@ -1,7 +1,7 @@
import { Attributes, XmlComponent } from "@file/xml-components";
export abstract class VerticalAlign extends XmlComponent {
constructor(type: string) {
public constructor(type: string) {
super("w:vertAlign");
this.root.push(
new Attributes({
@ -12,13 +12,13 @@ export abstract class VerticalAlign extends XmlComponent {
}
export class SuperScript extends VerticalAlign {
constructor() {
public constructor() {
super("superscript");
}
}
export class SubScript extends VerticalAlign {
constructor() {
public constructor() {
super("subscript");
}
}

View File

@ -5,7 +5,7 @@ import { XmlComponent } from "@file/xml-components";
import { TextAttributes } from "./text-attributes";
export class SequentialIdentifierInstruction extends XmlComponent {
constructor(identifier: string) {
public constructor(identifier: string) {
super("w:instrText");
this.root.push(new TextAttributes({ space: SpaceType.PRESERVE }));
this.root.push(`SEQ ${identifier}`);

View File

@ -3,7 +3,7 @@ import { Begin, End, Separate } from "@file/paragraph/run/field";
import { SequentialIdentifierInstruction } from "./sequential-identifier-instruction";
export class SequentialIdentifier extends Run {
constructor(identifier: string) {
public constructor(identifier: string) {
super({});
this.root.push(new Begin(true));
this.root.push(new SequentialIdentifierInstruction(identifier));

View File

@ -7,7 +7,7 @@ class FldSimpleAttrs extends XmlAttributeComponent<{ readonly instr: string }> {
}
export class SimpleField extends XmlComponent {
constructor(instruction: string, cachedValue?: string) {
public constructor(instruction: string, cachedValue?: string) {
super("w:fldSimple");
this.root.push(new FldSimpleAttrs({ instr: instruction }));
if (cachedValue !== undefined) {
@ -17,7 +17,7 @@ export class SimpleField extends XmlComponent {
}
export class SimpleMailMergeField extends SimpleField {
constructor(fieldName: string) {
public constructor(fieldName: string) {
super(` MERGEFIELD ${fieldName} `, `«${fieldName}»`);
}
}

View File

@ -7,7 +7,7 @@ export interface ISymbolRunOptions extends IRunOptions {
}
export class SymbolRun extends Run {
constructor(options: ISymbolRunOptions | string) {
public constructor(options: ISymbolRunOptions | string) {
if (typeof options === "string") {
super({});
this.root.push(new Symbol(options));

View File

@ -7,7 +7,7 @@ import { XmlComponent } from "@file/xml-components";
// TODO: this is unused and undocumented currently.
// I think the intended use was for users to import, and insert as a child of `Run`.
export class Tab extends XmlComponent {
constructor() {
public constructor() {
super("w:tab");
}
}

View File

@ -2,7 +2,7 @@ import { IRunOptions, Run } from "./run";
import { Text } from "./run-components/text";
export class TextRun extends Run {
constructor(options: IRunOptions | string) {
public constructor(options: IRunOptions | string) {
if (typeof options === "string") {
super({});
this.root.push(new Text(options));

View File

@ -22,7 +22,7 @@ export enum UnderlineType {
}
export class Underline extends XmlComponent {
constructor(underlineType: UnderlineType = UnderlineType.SINGLE, color?: string) {
public constructor(underlineType: UnderlineType = UnderlineType.SINGLE, color?: string) {
super("w:u");
this.root.push(
new Attributes({