Initial ESlint conversion
This commit is contained in:
265
.eslintrc.js
Normal file
265
.eslintrc.js
Normal file
@ -0,0 +1,265 @@
|
||||
/*
|
||||
👋 Hi! This file was autogenerated by tslint-to-eslint-config.
|
||||
https://github.com/typescript-eslint/tslint-to-eslint-config
|
||||
|
||||
It represents the closest reasonable ESLint configuration to this
|
||||
project's original TSLint configuration.
|
||||
|
||||
We recommend eventually switching this configuration to extend from
|
||||
the recommended rulesets in typescript-eslint.
|
||||
https://github.com/typescript-eslint/tslint-to-eslint-config/blob/master/docs/FAQs.md
|
||||
|
||||
Happy linting! 💖
|
||||
*/
|
||||
module.exports = {
|
||||
env: {
|
||||
browser: true,
|
||||
es6: true,
|
||||
node: true,
|
||||
},
|
||||
parser: "@typescript-eslint/parser",
|
||||
parserOptions: {
|
||||
project: "tsconfig.json",
|
||||
sourceType: "module",
|
||||
},
|
||||
plugins: [
|
||||
"eslint-plugin-import",
|
||||
"eslint-plugin-no-null",
|
||||
"eslint-plugin-unicorn",
|
||||
"eslint-plugin-jsdoc",
|
||||
"eslint-plugin-prefer-arrow",
|
||||
"@typescript-eslint",
|
||||
"@typescript-eslint/tslint",
|
||||
],
|
||||
root: true,
|
||||
rules: {
|
||||
"@typescript-eslint/adjacent-overload-signatures": "error",
|
||||
"@typescript-eslint/array-type": [
|
||||
"error",
|
||||
{
|
||||
default: "array",
|
||||
},
|
||||
],
|
||||
"@typescript-eslint/ban-types": [
|
||||
"error",
|
||||
{
|
||||
types: {
|
||||
Object: {
|
||||
message: "Avoid using the `Object` type. Did you mean `object`?",
|
||||
},
|
||||
Function: {
|
||||
message: "Avoid using the `Function` type. Prefer a specific function type, like `() => void`.",
|
||||
},
|
||||
Boolean: {
|
||||
message: "Avoid using the `Boolean` type. Did you mean `boolean`?",
|
||||
},
|
||||
Number: {
|
||||
message: "Avoid using the `Number` type. Did you mean `number`?",
|
||||
},
|
||||
String: {
|
||||
message: "Avoid using the `String` type. Did you mean `string`?",
|
||||
},
|
||||
Symbol: {
|
||||
message: "Avoid using the `Symbol` type. Did you mean `symbol`?",
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"@typescript-eslint/consistent-type-assertions": "error",
|
||||
"@typescript-eslint/dot-notation": "error",
|
||||
"@typescript-eslint/explicit-function-return-type": [
|
||||
"error",
|
||||
{
|
||||
allowExpressions: false,
|
||||
allowTypedFunctionExpressions: false,
|
||||
allowHigherOrderFunctions: false,
|
||||
allowDirectConstAssertionInArrowFunctions: true,
|
||||
allowConciseArrowFunctionExpressionsStartingWithVoid: true,
|
||||
},
|
||||
],
|
||||
"@typescript-eslint/explicit-member-accessibility": [
|
||||
"error",
|
||||
{
|
||||
accessibility: "explicit",
|
||||
overrides: {
|
||||
accessors: "explicit",
|
||||
},
|
||||
},
|
||||
],
|
||||
"@typescript-eslint/explicit-module-boundary-types": [
|
||||
"error",
|
||||
{
|
||||
allowArgumentsExplicitlyTypedAsAny: true,
|
||||
allowDirectConstAssertionInArrowFunctions: true,
|
||||
allowHigherOrderFunctions: false,
|
||||
allowTypedFunctionExpressions: false,
|
||||
},
|
||||
],
|
||||
"@typescript-eslint/indent": [
|
||||
"error",
|
||||
4,
|
||||
{
|
||||
ObjectExpression: "first",
|
||||
FunctionDeclaration: {
|
||||
parameters: "first",
|
||||
},
|
||||
FunctionExpression: {
|
||||
parameters: "first",
|
||||
},
|
||||
},
|
||||
],
|
||||
"@typescript-eslint/naming-convention": [
|
||||
"error",
|
||||
{
|
||||
selector: ["objectLiteralProperty"],
|
||||
leadingUnderscore: "allow",
|
||||
format: ["camelCase"],
|
||||
custom: {
|
||||
regex: "^w:.+",
|
||||
match: false,
|
||||
},
|
||||
},
|
||||
],
|
||||
"@typescript-eslint/no-empty-function": "error",
|
||||
"@typescript-eslint/no-empty-interface": "error",
|
||||
"@typescript-eslint/no-explicit-any": "error",
|
||||
"@typescript-eslint/no-misused-new": "error",
|
||||
"@typescript-eslint/no-namespace": "error",
|
||||
"@typescript-eslint/no-parameter-properties": "off",
|
||||
"@typescript-eslint/no-require-imports": "error",
|
||||
"@typescript-eslint/no-shadow": [
|
||||
"error",
|
||||
{
|
||||
hoist: "all",
|
||||
},
|
||||
],
|
||||
"@typescript-eslint/no-this-alias": "error",
|
||||
"@typescript-eslint/no-unused-expressions": "error",
|
||||
"@typescript-eslint/no-use-before-define": "off",
|
||||
"@typescript-eslint/no-var-requires": "error",
|
||||
"@typescript-eslint/prefer-for-of": "error",
|
||||
"@typescript-eslint/prefer-function-type": "error",
|
||||
"@typescript-eslint/prefer-namespace-keyword": "error",
|
||||
"@typescript-eslint/prefer-readonly": "error",
|
||||
"@typescript-eslint/triple-slash-reference": [
|
||||
"error",
|
||||
{
|
||||
path: "always",
|
||||
types: "prefer-import",
|
||||
lib: "always",
|
||||
},
|
||||
],
|
||||
"@typescript-eslint/typedef": [
|
||||
"error",
|
||||
{
|
||||
parameter: true,
|
||||
propertyDeclaration: true,
|
||||
},
|
||||
],
|
||||
"@typescript-eslint/unified-signatures": "error",
|
||||
"arrow-body-style": "error",
|
||||
complexity: "off",
|
||||
"constructor-super": "error",
|
||||
curly: "error",
|
||||
"dot-notation": "off",
|
||||
eqeqeq: ["error", "smart"],
|
||||
"guard-for-in": "error",
|
||||
"id-denylist": ["error", "any", "Number", "number", "String", "string", "Boolean", "boolean", "Undefined", "undefined"],
|
||||
"id-match": "error",
|
||||
"import/no-default-export": "error",
|
||||
"import/no-extraneous-dependencies": "off",
|
||||
"import/no-internal-modules": "off",
|
||||
"import/order": "error",
|
||||
indent: "off",
|
||||
"jsdoc/check-alignment": "error",
|
||||
"jsdoc/check-indentation": "error",
|
||||
"jsdoc/newline-after-description": "error",
|
||||
"max-classes-per-file": "off",
|
||||
"max-len": "off",
|
||||
"new-parens": "error",
|
||||
"no-bitwise": "error",
|
||||
"no-caller": "error",
|
||||
"no-cond-assign": "error",
|
||||
"no-console": "error",
|
||||
"no-debugger": "error",
|
||||
"no-duplicate-case": "error",
|
||||
"no-duplicate-imports": "error",
|
||||
"no-empty": "error",
|
||||
"no-empty-function": "off",
|
||||
"no-eval": "error",
|
||||
"no-extra-bind": "error",
|
||||
"no-fallthrough": "off",
|
||||
"no-invalid-this": "off",
|
||||
"no-multiple-empty-lines": "error",
|
||||
"no-new-func": "error",
|
||||
"no-new-wrappers": "error",
|
||||
"no-null/no-null": "error",
|
||||
"no-param-reassign": "error",
|
||||
"no-redeclare": "error",
|
||||
"no-return-await": "error",
|
||||
"no-sequences": "error",
|
||||
"no-shadow": "off",
|
||||
"no-sparse-arrays": "error",
|
||||
"no-template-curly-in-string": "error",
|
||||
"no-throw-literal": "error",
|
||||
"no-trailing-spaces": "error",
|
||||
"no-undef-init": "error",
|
||||
"no-underscore-dangle": "error",
|
||||
"no-unsafe-finally": "error",
|
||||
"no-unused-expressions": "off",
|
||||
"no-unused-labels": "error",
|
||||
"no-use-before-define": "off",
|
||||
"no-useless-constructor": "error",
|
||||
"no-var": "error",
|
||||
"object-shorthand": "off",
|
||||
"one-var": ["error", "never"],
|
||||
"prefer-arrow/prefer-arrow-functions": "error",
|
||||
"prefer-const": "error",
|
||||
"prefer-object-spread": "error",
|
||||
radix: "error",
|
||||
"space-in-parens": ["error", "never"],
|
||||
"spaced-comment": [
|
||||
"error",
|
||||
"always",
|
||||
{
|
||||
markers: ["/"],
|
||||
},
|
||||
],
|
||||
"unicorn/filename-case": "error",
|
||||
"unicorn/prefer-ternary": "error",
|
||||
"use-isnan": "error",
|
||||
"valid-typeof": "off",
|
||||
"@typescript-eslint/tslint/config": [
|
||||
"error",
|
||||
{
|
||||
rules: {
|
||||
"no-delete": true,
|
||||
"no-method-signature": true,
|
||||
"no-mixed-interface": true,
|
||||
"readonly-keyword": true,
|
||||
"return-undefined": true,
|
||||
whitespace: [
|
||||
true,
|
||||
"check-branch",
|
||||
"check-decl",
|
||||
"check-operator",
|
||||
"check-separator",
|
||||
"check-type",
|
||||
"check-typecast",
|
||||
"check-type-operator",
|
||||
"check-rest-spread",
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
// enable the rule specifically for TypeScript files
|
||||
files: ["*.spec.ts"],
|
||||
rules: {
|
||||
"@typescript-eslint/explicit-function-return-type": "off",
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
4178
package-lock.json
generated
4178
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
11
package.json
11
package.json
@ -9,7 +9,7 @@
|
||||
"test.coverage": "nyc npm test",
|
||||
"test.watch": "npm test -- --watch",
|
||||
"prepublishOnly": "npm run build --production",
|
||||
"lint": "tslint --project .",
|
||||
"lint": "eslint -c .eslintrc.js --ext .ts .",
|
||||
"build": "npm run webpack && npm run fix-types",
|
||||
"webpack": "rimraf ./build && webpack --config ./webpack.config.ts",
|
||||
"demo": "npm run build && npm run ts-node --skip-project ./demo",
|
||||
@ -72,10 +72,19 @@
|
||||
"@types/sinon": "^10.0.0",
|
||||
"@types/unzipper": "^0.10.4",
|
||||
"@types/webpack": "^5.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.36.1",
|
||||
"@typescript-eslint/eslint-plugin-tslint": "^5.36.1",
|
||||
"@typescript-eslint/parser": "^5.36.1",
|
||||
"buffer": "^6.0.3",
|
||||
"chai": "^3.5.0",
|
||||
"cspell": "^6.2.2",
|
||||
"docsify-cli": "^4.3.0",
|
||||
"eslint": "^8.23.0",
|
||||
"eslint-plugin-import": "^2.26.0",
|
||||
"eslint-plugin-jsdoc": "^39.3.6",
|
||||
"eslint-plugin-no-null": "^1.0.2",
|
||||
"eslint-plugin-prefer-arrow": "^1.2.3",
|
||||
"eslint-plugin-unicorn": "^43.0.2",
|
||||
"glob": "^8.0.1",
|
||||
"jszip": "^3.1.5",
|
||||
"mocha": "^10.0.0",
|
||||
|
@ -38,7 +38,7 @@ export class Compiler {
|
||||
private readonly imageReplacer: ImageReplacer;
|
||||
private readonly numberingReplacer: NumberingReplacer;
|
||||
|
||||
constructor() {
|
||||
public constructor() {
|
||||
this.formatter = new Formatter();
|
||||
this.imageReplacer = new ImageReplacer();
|
||||
this.numberingReplacer = new NumberingReplacer();
|
||||
|
@ -2,7 +2,7 @@ import { XmlComponent } from "@file/xml-components";
|
||||
import { AppPropertiesAttributes } from "./app-properties-attributes";
|
||||
|
||||
export class AppProperties extends XmlComponent {
|
||||
constructor() {
|
||||
public constructor() {
|
||||
super("Properties");
|
||||
|
||||
this.root.push(
|
||||
|
@ -33,7 +33,7 @@ export interface IBorderOptions {
|
||||
}
|
||||
|
||||
export class BorderElement extends XmlComponent {
|
||||
constructor(elementName: string, { color, size, space, style }: IBorderOptions) {
|
||||
public constructor(elementName: string, { color, size, space, style }: IBorderOptions) {
|
||||
super(elementName);
|
||||
this.root.push(
|
||||
new BordersAttributes({
|
||||
|
@ -4,7 +4,7 @@ import { Default } from "./default/default";
|
||||
import { Override } from "./override/override";
|
||||
|
||||
export class ContentTypes extends XmlComponent {
|
||||
constructor() {
|
||||
public constructor() {
|
||||
super("Types");
|
||||
|
||||
this.root.push(
|
||||
|
@ -2,7 +2,7 @@ import { XmlComponent } from "@file/xml-components";
|
||||
import { DefaultAttributes } from "./default-attributes";
|
||||
|
||||
export class Default extends XmlComponent {
|
||||
constructor(contentType: string, extension?: string) {
|
||||
public constructor(contentType: string, extension?: string) {
|
||||
super("Default");
|
||||
|
||||
this.root.push(
|
||||
|
@ -2,7 +2,7 @@ import { XmlComponent } from "@file/xml-components";
|
||||
import { OverrideAttributes } from "./override-attributes";
|
||||
|
||||
export class Override extends XmlComponent {
|
||||
constructor(contentType: string, partName?: string) {
|
||||
public constructor(contentType: string, partName?: string) {
|
||||
super("Override");
|
||||
|
||||
this.root.push(
|
||||
|
@ -64,7 +64,7 @@ export interface IPropertiesOptions {
|
||||
/* cSpell:enable */
|
||||
|
||||
export class CoreProperties extends XmlComponent {
|
||||
constructor(options: Omit<IPropertiesOptions, "sections">) {
|
||||
public constructor(options: Omit<IPropertiesOptions, "sections">) {
|
||||
super("cp:coreProperties");
|
||||
this.root.push(
|
||||
new DocumentAttributes({
|
||||
@ -102,7 +102,7 @@ export class CoreProperties extends XmlComponent {
|
||||
}
|
||||
|
||||
class TimestampElement extends XmlComponent {
|
||||
constructor(name: string) {
|
||||
public constructor(name: string) {
|
||||
super(name);
|
||||
this.root.push(
|
||||
new DocumentAttributes({
|
||||
|
@ -7,7 +7,7 @@ export class CustomProperties extends XmlComponent {
|
||||
private nextId: number;
|
||||
private readonly properties: CustomProperty[] = [];
|
||||
|
||||
constructor(properties: ICustomPropertyOptions[]) {
|
||||
public constructor(properties: ICustomPropertyOptions[]) {
|
||||
super("Properties");
|
||||
|
||||
this.root.push(
|
||||
|
@ -7,7 +7,7 @@ export interface ICustomPropertyOptions {
|
||||
}
|
||||
|
||||
export class CustomProperty extends XmlComponent {
|
||||
constructor(id: number, properties: ICustomPropertyOptions) {
|
||||
public constructor(id: number, properties: ICustomPropertyOptions) {
|
||||
super("property");
|
||||
this.root.push(
|
||||
new CustomPropertyAttributes({
|
||||
@ -21,7 +21,7 @@ export class CustomProperty extends XmlComponent {
|
||||
}
|
||||
|
||||
export class CustomPropertyValue extends XmlComponent {
|
||||
constructor(value: string) {
|
||||
public constructor(value: string) {
|
||||
super("vt:lpwstr");
|
||||
this.root.push(value);
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ export class DocumentWrapper implements IViewWrapper {
|
||||
private readonly document: Document;
|
||||
private readonly relationships: Relationships;
|
||||
|
||||
constructor(options: IDocumentOptions) {
|
||||
public constructor(options: IDocumentOptions) {
|
||||
this.document = new Document(options);
|
||||
this.relationships = new Relationships();
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import { ISectionPropertiesOptions, SectionProperties } from "./section-properti
|
||||
export class Body extends XmlComponent {
|
||||
private readonly sections: SectionProperties[] = [];
|
||||
|
||||
constructor() {
|
||||
public constructor() {
|
||||
super("w:body");
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ export class ColumnAttributes extends XmlAttributeComponent<IColumnAttributes> {
|
||||
}
|
||||
|
||||
export class Column extends XmlComponent {
|
||||
constructor({ width, space }: IColumnAttributes) {
|
||||
public constructor({ width, space }: IColumnAttributes) {
|
||||
super("w:col");
|
||||
this.root.push(
|
||||
new ColumnAttributes({
|
||||
|
@ -30,7 +30,7 @@ export class ColumnsAttributes extends XmlAttributeComponent<IColumnsAttributes>
|
||||
}
|
||||
|
||||
export class Columns extends XmlComponent {
|
||||
constructor({ space, count, separate, equalWidth, children }: IColumnsAttributes) {
|
||||
public constructor({ space, count, separate, equalWidth, children }: IColumnsAttributes) {
|
||||
super("w:cols");
|
||||
this.root.push(
|
||||
new ColumnsAttributes({
|
||||
|
@ -38,7 +38,7 @@ export class DocGridAttributes extends XmlAttributeComponent<IDocGridAttributesP
|
||||
}
|
||||
|
||||
export class DocumentGrid extends XmlComponent {
|
||||
constructor(linePitch: number, charSpace?: number, type?: DocumentGridType) {
|
||||
public constructor(linePitch: number, charSpace?: number, type?: DocumentGridType) {
|
||||
super("w:docGrid");
|
||||
|
||||
this.root.push(
|
||||
|
@ -52,7 +52,7 @@ export enum HeaderFooterType {
|
||||
FOOTER = "w:footerReference",
|
||||
}
|
||||
export class HeaderFooterReference extends XmlComponent {
|
||||
constructor(type: HeaderFooterType, options: IHeaderFooterOptions) {
|
||||
public constructor(type: HeaderFooterType, options: IHeaderFooterOptions) {
|
||||
super(type);
|
||||
|
||||
this.root.push(
|
||||
|
@ -39,7 +39,7 @@ export class LineNumberAttributes extends XmlAttributeComponent<ILineNumberAttri
|
||||
}
|
||||
|
||||
export class LineNumberType extends XmlComponent {
|
||||
constructor({ countBy, start, restart, distance }: ILineNumberAttributes) {
|
||||
public constructor({ countBy, start, restart, distance }: ILineNumberAttributes) {
|
||||
super("w:lnNumType");
|
||||
this.root.push(
|
||||
new LineNumberAttributes({
|
||||
|
@ -71,7 +71,7 @@ class PageBordersAttributes extends XmlAttributeComponent<IPageBorderAttributes>
|
||||
// <xsd:attribute name="offsetFrom" type="ST_PageBorderOffset" use="optional" default="text"/>
|
||||
// </xsd:complexType>
|
||||
export class PageBorders extends IgnoreIfEmptyXmlComponent {
|
||||
constructor(options?: IPageBordersOptions) {
|
||||
public constructor(options?: IPageBordersOptions) {
|
||||
super("w:pgBorders");
|
||||
|
||||
if (!options) {
|
||||
|
@ -33,7 +33,7 @@ export class PageMarginAttributes extends XmlAttributeComponent<IPageMarginAttri
|
||||
}
|
||||
|
||||
export class PageMargin extends XmlComponent {
|
||||
constructor(
|
||||
public constructor(
|
||||
top: number | string,
|
||||
right: number | string,
|
||||
bottom: number | string,
|
||||
|
@ -41,7 +41,7 @@ export class PageNumberTypeAttributes extends XmlAttributeComponent<IPageNumberT
|
||||
};
|
||||
}
|
||||
export class PageNumberType extends XmlComponent {
|
||||
constructor({ start, formatType, separator }: IPageNumberTypeAttributes) {
|
||||
public constructor({ start, formatType, separator }: IPageNumberTypeAttributes) {
|
||||
super("w:pgNumType");
|
||||
this.root.push(
|
||||
new PageNumberTypeAttributes({
|
||||
|
@ -33,7 +33,7 @@ export class PageSizeAttributes extends XmlAttributeComponent<IPageSizeAttribute
|
||||
}
|
||||
|
||||
export class PageSize extends XmlComponent {
|
||||
constructor(width: number | string, height: number | string, orientation: PageOrientation) {
|
||||
public constructor(width: number | string, height: number | string, orientation: PageOrientation) {
|
||||
super("w:pgSz");
|
||||
|
||||
const flip = orientation === PageOrientation.LANDSCAPE;
|
||||
|
@ -10,7 +10,7 @@ class PageTextDirectionAttributes extends XmlAttributeComponent<{ readonly val:
|
||||
}
|
||||
|
||||
export class PageTextDirection extends XmlComponent {
|
||||
constructor(value: PageTextDirectionType) {
|
||||
public constructor(value: PageTextDirectionType) {
|
||||
super("w:textDirection");
|
||||
|
||||
this.root.push(
|
||||
|
@ -30,7 +30,7 @@ export class SectionTypeAttributes extends XmlAttributeComponent<{
|
||||
}
|
||||
|
||||
export class Type extends XmlComponent {
|
||||
constructor(value: SectionType) {
|
||||
public constructor(value: SectionType) {
|
||||
super("w:type");
|
||||
this.root.push(new SectionTypeAttributes({ val: value }));
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ export const sectionPageSizeDefaults = {
|
||||
};
|
||||
|
||||
export class SectionProperties extends XmlComponent {
|
||||
constructor({
|
||||
public constructor({
|
||||
page: {
|
||||
size: {
|
||||
width = sectionPageSizeDefaults.WIDTH,
|
||||
|
@ -63,7 +63,7 @@ export interface IDocumentBackgroundOptions {
|
||||
// </xsd:complexType>
|
||||
|
||||
export class DocumentBackground extends XmlComponent {
|
||||
constructor(options: IDocumentBackgroundOptions) {
|
||||
public constructor(options: IDocumentBackgroundOptions) {
|
||||
super("w:background");
|
||||
|
||||
this.root.push(
|
||||
|
@ -33,7 +33,7 @@ export interface IDocumentOptions {
|
||||
export class Document extends XmlComponent {
|
||||
private readonly body: Body;
|
||||
|
||||
constructor(options: IDocumentOptions) {
|
||||
public constructor(options: IDocumentOptions) {
|
||||
super("w:document");
|
||||
this.root.push(
|
||||
new DocumentAttributes({
|
||||
|
@ -37,7 +37,7 @@ import { AnchorAttributes } from "./anchor-attributes";
|
||||
// <xsd:attribute name="allowOverlap" type="xsd:boolean" use="required"/>
|
||||
// </xsd:complexType>
|
||||
export class Anchor extends XmlComponent {
|
||||
constructor(mediaData: IMediaData, transform: IMediaDataTransformation, drawingOptions: IDrawingOptions) {
|
||||
public constructor(mediaData: IMediaData, transform: IMediaDataTransformation, drawingOptions: IDrawingOptions) {
|
||||
super("wp:anchor");
|
||||
|
||||
const floating: IFloating = {
|
||||
|
@ -2,7 +2,7 @@ import { XmlComponent } from "@file/xml-components";
|
||||
import { DocPropertiesAttributes } from "./doc-properties-attributes";
|
||||
|
||||
export class DocProperties extends XmlComponent {
|
||||
constructor() {
|
||||
public constructor() {
|
||||
super("wp:docPr");
|
||||
|
||||
this.root.push(
|
||||
|
@ -25,7 +25,7 @@ export interface IDrawingOptions {
|
||||
export class Drawing extends XmlComponent {
|
||||
private readonly inline: Inline;
|
||||
|
||||
constructor(imageData: IMediaData, drawingOptions: IDrawingOptions = {}) {
|
||||
public constructor(imageData: IMediaData, drawingOptions: IDrawingOptions = {}) {
|
||||
super("w:drawing");
|
||||
|
||||
if (!drawingOptions.floating) {
|
||||
|
@ -2,7 +2,7 @@ import { XmlComponent } from "@file/xml-components";
|
||||
import { EffectExtentAttributes } from "./effect-extent-attributes";
|
||||
|
||||
export class EffectExtent extends XmlComponent {
|
||||
constructor() {
|
||||
public constructor() {
|
||||
super("wp:effectExtent");
|
||||
|
||||
this.root.push(
|
||||
|
@ -5,7 +5,7 @@ import { ExtentAttributes } from "./extent-attributes";
|
||||
export class Extent extends XmlComponent {
|
||||
private readonly attributes: ExtentAttributes;
|
||||
|
||||
constructor(x: number, y: number) {
|
||||
public constructor(x: number, y: number) {
|
||||
super("wp:extent");
|
||||
|
||||
this.attributes = new ExtentAttributes({
|
||||
|
@ -3,7 +3,7 @@ import { HorizontalPositionAlign, VerticalPositionAlign } from "@file/shared/ali
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
export class Align extends XmlComponent {
|
||||
constructor(value: HorizontalPositionAlign | VerticalPositionAlign) {
|
||||
public constructor(value: HorizontalPositionAlign | VerticalPositionAlign) {
|
||||
super("wp:align");
|
||||
this.root.push(value);
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ class HorizontalPositionAttributes extends XmlAttributeComponent<{
|
||||
}
|
||||
|
||||
export class HorizontalPosition extends XmlComponent {
|
||||
constructor(horizontalPosition: IHorizontalPositionOptions) {
|
||||
public constructor(horizontalPosition: IHorizontalPositionOptions) {
|
||||
super("wp:positionH");
|
||||
|
||||
this.root.push(
|
||||
|
@ -2,7 +2,7 @@
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
export class PositionOffset extends XmlComponent {
|
||||
constructor(offsetValue: number) {
|
||||
public constructor(offsetValue: number) {
|
||||
super("wp:posOffset");
|
||||
this.root.push(offsetValue.toString());
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ class SimplePosAttributes extends XmlAttributeComponent<{
|
||||
}
|
||||
|
||||
export class SimplePos extends XmlComponent {
|
||||
constructor() {
|
||||
public constructor() {
|
||||
super("wp:simplePos");
|
||||
|
||||
// NOTE: It's not fully supported in Microsoft Word, but this element is needed anyway
|
||||
|
@ -13,7 +13,7 @@ class VerticalPositionAttributes extends XmlAttributeComponent<{
|
||||
}
|
||||
|
||||
export class VerticalPosition extends XmlComponent {
|
||||
constructor(verticalPosition: IVerticalPositionOptions) {
|
||||
public constructor(verticalPosition: IVerticalPositionOptions) {
|
||||
super("wp:positionV");
|
||||
|
||||
this.root.push(
|
||||
|
@ -2,7 +2,7 @@ import { XmlComponent } from "@file/xml-components";
|
||||
import { GraphicFrameLockAttributes } from "./graphic-frame-lock-attributes";
|
||||
|
||||
export class GraphicFrameLocks extends XmlComponent {
|
||||
constructor() {
|
||||
public constructor() {
|
||||
super("a:graphicFrameLocks");
|
||||
|
||||
this.root.push(
|
||||
|
@ -2,7 +2,7 @@ import { XmlComponent } from "@file/xml-components";
|
||||
import { GraphicFrameLocks } from "./graphic-frame-locks/graphic-frame-locks";
|
||||
|
||||
export class GraphicFrameProperties extends XmlComponent {
|
||||
constructor() {
|
||||
public constructor() {
|
||||
super("wp:cNvGraphicFramePr");
|
||||
|
||||
this.root.push(new GraphicFrameLocks());
|
||||
|
@ -7,7 +7,7 @@ import { Pic } from "./pic";
|
||||
export class GraphicData extends XmlComponent {
|
||||
private readonly pic: Pic;
|
||||
|
||||
constructor(mediaData: IMediaData, transform: IMediaDataTransformation) {
|
||||
public constructor(mediaData: IMediaData, transform: IMediaDataTransformation) {
|
||||
super("a:graphicData");
|
||||
|
||||
this.root.push(
|
||||
|
@ -6,7 +6,7 @@ import { SourceRectangle } from "./source-rectangle";
|
||||
import { Stretch } from "./stretch";
|
||||
|
||||
export class BlipFill extends XmlComponent {
|
||||
constructor(mediaData: IMediaData) {
|
||||
public constructor(mediaData: IMediaData) {
|
||||
super("pic:blipFill");
|
||||
|
||||
this.root.push(new Blip(mediaData));
|
||||
|
@ -12,7 +12,7 @@ class BlipAttributes extends XmlAttributeComponent<{
|
||||
}
|
||||
|
||||
export class Blip extends XmlComponent {
|
||||
constructor(mediaData: IMediaData) {
|
||||
public constructor(mediaData: IMediaData) {
|
||||
super("a:blip");
|
||||
this.root.push(
|
||||
new BlipAttributes({
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
export class SourceRectangle extends XmlComponent {
|
||||
constructor() {
|
||||
public constructor() {
|
||||
super("a:srcRect");
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
class FillRectangle extends XmlComponent {
|
||||
constructor() {
|
||||
public constructor() {
|
||||
super("a:fillRect");
|
||||
}
|
||||
}
|
||||
|
||||
export class Stretch extends XmlComponent {
|
||||
constructor() {
|
||||
public constructor() {
|
||||
super("a:stretch");
|
||||
this.root.push(new FillRectangle());
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ import { XmlComponent } from "@file/xml-components";
|
||||
import { PicLocks } from "./pic-locks/pic-locks";
|
||||
|
||||
export class ChildNonVisualProperties extends XmlComponent {
|
||||
constructor() {
|
||||
public constructor() {
|
||||
super("pic:cNvPicPr");
|
||||
|
||||
this.root.push(new PicLocks());
|
||||
|
@ -2,7 +2,7 @@ import { XmlComponent } from "@file/xml-components";
|
||||
import { PicLocksAttributes } from "./pic-locks-attributes";
|
||||
|
||||
export class PicLocks extends XmlComponent {
|
||||
constructor() {
|
||||
public constructor() {
|
||||
super("a:picLocks");
|
||||
this.root.push(
|
||||
new PicLocksAttributes({
|
||||
|
@ -3,7 +3,7 @@ import { ChildNonVisualProperties } from "./child-non-visual-pic-properties/chil
|
||||
import { NonVisualProperties } from "./non-visual-properties/non-visual-properties";
|
||||
|
||||
export class NonVisualPicProperties extends XmlComponent {
|
||||
constructor() {
|
||||
public constructor() {
|
||||
super("pic:nvPicPr");
|
||||
|
||||
this.root.push(new NonVisualProperties());
|
||||
|
@ -2,7 +2,7 @@ import { XmlComponent } from "@file/xml-components";
|
||||
import { NonVisualPropertiesAttributes } from "./non-visual-properties-attributes";
|
||||
|
||||
export class NonVisualProperties extends XmlComponent {
|
||||
constructor() {
|
||||
public constructor() {
|
||||
super("pic:cNvPr");
|
||||
|
||||
this.root.push(
|
||||
|
@ -8,7 +8,7 @@ import { PicAttributes } from "./pic-attributes";
|
||||
import { ShapeProperties } from "./shape-properties/shape-properties";
|
||||
|
||||
export class Pic extends XmlComponent {
|
||||
constructor(mediaData: IMediaData, transform: IMediaDataTransformation) {
|
||||
public constructor(mediaData: IMediaData, transform: IMediaDataTransformation) {
|
||||
super("pic:pic");
|
||||
|
||||
this.root.push(
|
||||
|
@ -5,7 +5,7 @@ import { ExtentsAttributes } from "./extents-attributes";
|
||||
export class Extents extends XmlComponent {
|
||||
private readonly attributes: ExtentsAttributes;
|
||||
|
||||
constructor(x: number, y: number) {
|
||||
public constructor(x: number, y: number) {
|
||||
super("a:ext");
|
||||
|
||||
this.attributes = new ExtentsAttributes({
|
||||
|
@ -21,7 +21,7 @@ export class FormAttributes extends XmlAttributeComponent<{
|
||||
export class Form extends XmlComponent {
|
||||
private readonly extents: Extents;
|
||||
|
||||
constructor(options: IMediaDataTransformation) {
|
||||
public constructor(options: IMediaDataTransformation) {
|
||||
super("a:xfrm");
|
||||
|
||||
this.root.push(
|
||||
|
@ -3,7 +3,7 @@ import { XmlComponent } from "@file/xml-components";
|
||||
import { OffsetAttributes } from "./off-attributes";
|
||||
|
||||
export class Offset extends XmlComponent {
|
||||
constructor() {
|
||||
public constructor() {
|
||||
super("a:off");
|
||||
|
||||
this.root.push(
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
export class NoFill extends XmlComponent {
|
||||
constructor() {
|
||||
public constructor() {
|
||||
super("a:noFill");
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ import { XmlComponent } from "@file/xml-components";
|
||||
import { NoFill } from "./no-fill";
|
||||
|
||||
export class Outline extends XmlComponent {
|
||||
constructor() {
|
||||
public constructor() {
|
||||
super("a:ln");
|
||||
|
||||
this.root.push(new NoFill());
|
||||
|
@ -2,7 +2,7 @@
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
export class AdjustmentValues extends XmlComponent {
|
||||
constructor() {
|
||||
public constructor() {
|
||||
super("a:avLst");
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import { AdjustmentValues } from "./adjustment-values/adjustment-values";
|
||||
import { PresetGeometryAttributes } from "./preset-geometry-attributes";
|
||||
|
||||
export class PresetGeometry extends XmlComponent {
|
||||
constructor() {
|
||||
public constructor() {
|
||||
super("a:prstGeom");
|
||||
|
||||
this.root.push(
|
||||
|
@ -10,7 +10,7 @@ import { ShapePropertiesAttributes } from "./shape-properties-attributes";
|
||||
export class ShapeProperties extends XmlComponent {
|
||||
private readonly form: Form;
|
||||
|
||||
constructor(transform: IMediaDataTransformation) {
|
||||
public constructor(transform: IMediaDataTransformation) {
|
||||
super("pic:spPr");
|
||||
|
||||
this.root.push(
|
||||
|
@ -14,7 +14,7 @@ class GraphicAttributes extends XmlAttributeComponent<{
|
||||
export class Graphic extends XmlComponent {
|
||||
private readonly data: GraphicData;
|
||||
|
||||
constructor(mediaData: IMediaData, transform: IMediaDataTransformation) {
|
||||
public constructor(mediaData: IMediaData, transform: IMediaDataTransformation) {
|
||||
super("a:graphic");
|
||||
this.root.push(
|
||||
new GraphicAttributes({
|
||||
|
@ -26,7 +26,7 @@ export class Inline extends XmlComponent {
|
||||
private readonly extent: Extent;
|
||||
private readonly graphic: Graphic;
|
||||
|
||||
constructor(mediaData: IMediaData, transform: IMediaDataTransformation) {
|
||||
public constructor(mediaData: IMediaData, transform: IMediaDataTransformation) {
|
||||
super("wp:inline");
|
||||
|
||||
this.root.push(
|
||||
|
@ -2,7 +2,7 @@
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
export class WrapNone extends XmlComponent {
|
||||
constructor() {
|
||||
public constructor() {
|
||||
super("wp:wrapNone");
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ class WrapSquareAttributes extends XmlAttributeComponent<IWrapSquareAttributes>
|
||||
}
|
||||
|
||||
export class WrapSquare extends XmlComponent {
|
||||
constructor(
|
||||
public constructor(
|
||||
textWrapping: ITextWrapping,
|
||||
margins: IMargins = {
|
||||
top: 0,
|
||||
|
@ -14,7 +14,7 @@ class WrapTightAttributes extends XmlAttributeComponent<{
|
||||
}
|
||||
|
||||
export class WrapTight extends XmlComponent {
|
||||
constructor(
|
||||
public constructor(
|
||||
margins: IMargins = {
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
|
@ -14,7 +14,7 @@ class WrapTopAndBottomAttributes extends XmlAttributeComponent<{
|
||||
}
|
||||
|
||||
export class WrapTopAndBottom extends XmlComponent {
|
||||
constructor(
|
||||
public constructor(
|
||||
margins: IMargins = {
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
|
@ -55,7 +55,7 @@ export class File {
|
||||
private readonly styles: Styles;
|
||||
private readonly comments: Comments;
|
||||
|
||||
constructor(options: IPropertiesOptions, fileProperties: IFileProperties = {}) {
|
||||
public constructor(options: IPropertiesOptions, fileProperties: IFileProperties = {}) {
|
||||
this.coreProperties = new CoreProperties({
|
||||
...options,
|
||||
creator: options.creator ?? "Un-named",
|
||||
|
@ -17,7 +17,7 @@ export class FooterWrapper implements IViewWrapper {
|
||||
private readonly footer: Footer;
|
||||
private readonly relationships: Relationships;
|
||||
|
||||
constructor(private readonly media: Media, referenceId: number, initContent?: XmlComponent) {
|
||||
public constructor(private readonly media: Media, referenceId: number, initContent?: XmlComponent) {
|
||||
this.footer = new Footer(referenceId, initContent);
|
||||
this.relationships = new Relationships();
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import { FooterAttributes } from "./footer-attributes";
|
||||
export class Footer extends InitializableXmlComponent {
|
||||
private readonly refId: number;
|
||||
|
||||
constructor(referenceNumber: number, initContent?: XmlComponent) {
|
||||
public constructor(referenceNumber: number, initContent?: XmlComponent) {
|
||||
super("w:ftr", initContent);
|
||||
this.refId = referenceNumber;
|
||||
if (!initContent) {
|
||||
|
@ -6,7 +6,7 @@ export class FootnotesWrapper implements IViewWrapper {
|
||||
private readonly footnotess: FootNotes;
|
||||
private readonly relationships: Relationships;
|
||||
|
||||
constructor() {
|
||||
public constructor() {
|
||||
this.footnotess = new FootNotes();
|
||||
this.relationships = new Relationships();
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ export interface IFootnoteOptions {
|
||||
}
|
||||
|
||||
export class Footnote extends XmlComponent {
|
||||
constructor(options: IFootnoteOptions) {
|
||||
public constructor(options: IFootnoteOptions) {
|
||||
super("w:footnote");
|
||||
this.root.push(
|
||||
new FootnoteAttributes({
|
||||
|
@ -2,7 +2,7 @@ import { Run } from "@file/paragraph";
|
||||
import { ContinuationSeperator } from "./continuation-seperator";
|
||||
|
||||
export class ContinuationSeperatorRun extends Run {
|
||||
constructor() {
|
||||
public constructor() {
|
||||
super({});
|
||||
|
||||
this.root.push(new ContinuationSeperator());
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
export class ContinuationSeperator extends XmlComponent {
|
||||
constructor() {
|
||||
public constructor() {
|
||||
super("w:continuationSeparator");
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ import { Run } from "@file/paragraph";
|
||||
import { FootnoteRef } from "./footnote-ref";
|
||||
|
||||
export class FootnoteRefRun extends Run {
|
||||
constructor() {
|
||||
public constructor() {
|
||||
super({
|
||||
style: "FootnoteReference",
|
||||
});
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
export class FootnoteRef extends XmlComponent {
|
||||
constructor() {
|
||||
public constructor() {
|
||||
super("w:footnoteRef");
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ export class FootNoteReferenceRunAttributes extends XmlAttributeComponent<{
|
||||
}
|
||||
|
||||
export class FootnoteReference extends XmlComponent {
|
||||
constructor(id: number) {
|
||||
public constructor(id: number) {
|
||||
super("w:footnoteReference");
|
||||
|
||||
this.root.push(
|
||||
@ -22,7 +22,7 @@ export class FootnoteReference extends XmlComponent {
|
||||
}
|
||||
|
||||
export class FootnoteReferenceRun extends Run {
|
||||
constructor(id: number) {
|
||||
public constructor(id: number) {
|
||||
super({ style: "FootnoteReference" });
|
||||
|
||||
this.root.push(new FootnoteReference(id));
|
||||
|
@ -2,7 +2,7 @@ import { Run } from "@file/paragraph";
|
||||
import { Seperator } from "./seperator";
|
||||
|
||||
export class SeperatorRun extends Run {
|
||||
constructor() {
|
||||
public constructor() {
|
||||
super({});
|
||||
|
||||
this.root.push(new Seperator());
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
export class Seperator extends XmlComponent {
|
||||
constructor() {
|
||||
public constructor() {
|
||||
super("w:separator");
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import { SeperatorRun } from "./footnote/run/seperator-run";
|
||||
import { FootnotesAttributes } from "./footnotes-attributes";
|
||||
|
||||
export class FootNotes extends XmlComponent {
|
||||
constructor() {
|
||||
public constructor() {
|
||||
super("w:footnotes");
|
||||
|
||||
this.root.push(
|
||||
|
@ -17,7 +17,7 @@ export class HeaderWrapper implements IViewWrapper {
|
||||
private readonly header: Header;
|
||||
private readonly relationships: Relationships;
|
||||
|
||||
constructor(private readonly media: Media, referenceId: number, initContent?: XmlComponent) {
|
||||
public constructor(private readonly media: Media, referenceId: number, initContent?: XmlComponent) {
|
||||
this.header = new Header(referenceId, initContent);
|
||||
this.relationships = new Relationships();
|
||||
}
|
||||
|
@ -6,9 +6,9 @@ export interface IHeaderOptions {
|
||||
}
|
||||
|
||||
export class Header {
|
||||
constructor(public readonly options: IHeaderOptions = { children: [] }) {}
|
||||
public constructor(public readonly options: IHeaderOptions = { children: [] }) {}
|
||||
}
|
||||
|
||||
export class Footer {
|
||||
constructor(public readonly options: IHeaderOptions = { children: [] }) {}
|
||||
public constructor(public readonly options: IHeaderOptions = { children: [] }) {}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import { HeaderAttributes } from "./header-attributes";
|
||||
export class Header extends InitializableXmlComponent {
|
||||
private readonly refId: number;
|
||||
|
||||
constructor(referenceNumber: number, initContent?: XmlComponent) {
|
||||
public constructor(referenceNumber: number, initContent?: XmlComponent) {
|
||||
super("w:hdr", initContent);
|
||||
|
||||
this.refId = referenceNumber;
|
||||
|
@ -15,7 +15,7 @@ export interface IMediaTransformation {
|
||||
export class Media {
|
||||
private readonly map: Map<string, IMediaData>;
|
||||
|
||||
constructor() {
|
||||
public constructor() {
|
||||
this.map = new Map<string, IMediaData>();
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ class AbstractNumberingAttributes extends XmlAttributeComponent<{
|
||||
export class AbstractNumbering extends XmlComponent {
|
||||
public readonly id: number;
|
||||
|
||||
constructor(id: number, levelOptions: ILevelsOptions[]) {
|
||||
public constructor(id: number, levelOptions: ILevelsOptions[]) {
|
||||
super("w:abstractNum");
|
||||
this.root.push(
|
||||
new AbstractNumberingAttributes({
|
||||
|
@ -38,7 +38,7 @@ class LevelAttributes extends XmlAttributeComponent<{
|
||||
// <xsd:attribute name="format" type="s:ST_String" use="optional"/>
|
||||
// </xsd:complexType>
|
||||
class NumberFormat extends XmlComponent {
|
||||
constructor(value: string) {
|
||||
public constructor(value: string) {
|
||||
super("w:numFmt");
|
||||
this.root.push(
|
||||
new Attributes({
|
||||
@ -53,7 +53,7 @@ class NumberFormat extends XmlComponent {
|
||||
// <xsd:attribute name="null" type="s:ST_OnOff" use="optional"/>
|
||||
// </xsd:complexType>
|
||||
class LevelText extends XmlComponent {
|
||||
constructor(value: string) {
|
||||
public constructor(value: string) {
|
||||
super("w:lvlText");
|
||||
this.root.push(
|
||||
new Attributes({
|
||||
@ -64,7 +64,7 @@ class LevelText extends XmlComponent {
|
||||
}
|
||||
|
||||
class LevelJc extends XmlComponent {
|
||||
constructor(value: AlignmentType) {
|
||||
public constructor(value: AlignmentType) {
|
||||
super("w:lvlJc");
|
||||
this.root.push(
|
||||
new Attributes({
|
||||
@ -104,7 +104,7 @@ export interface ILevelsOptions {
|
||||
// </xsd:restriction>
|
||||
// </xsd:simpleType>
|
||||
class Suffix extends XmlComponent {
|
||||
constructor(value: LevelSuffix) {
|
||||
public constructor(value: LevelSuffix) {
|
||||
super("w:suff");
|
||||
this.root.push(
|
||||
new Attributes({
|
||||
@ -137,7 +137,7 @@ export class LevelBase extends XmlComponent {
|
||||
private readonly paragraphProperties: ParagraphProperties;
|
||||
private readonly runProperties: RunProperties;
|
||||
|
||||
constructor({ level, format, text, alignment = AlignmentType.START, start = 1, style, suffix }: ILevelsOptions) {
|
||||
public constructor({ level, format, text, alignment = AlignmentType.START, start = 1, style, suffix }: ILevelsOptions) {
|
||||
super("w:lvl");
|
||||
|
||||
this.root.push(new NumberValueElement("w:start", decimalNumber(start)));
|
||||
@ -180,7 +180,7 @@ export class LevelBase extends XmlComponent {
|
||||
export class Level extends LevelBase {
|
||||
// This is the level that sits under abstractNum. We make a
|
||||
// handful of properties required
|
||||
constructor(options: ILevelsOptions) {
|
||||
public constructor(options: ILevelsOptions) {
|
||||
super(options);
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ import { Attributes, XmlComponent } from "@file/xml-components";
|
||||
// </xsd:restriction>
|
||||
// </xsd:simpleType>
|
||||
export class MultiLevelType extends XmlComponent {
|
||||
constructor(value: string) {
|
||||
public constructor(value: string) {
|
||||
super("w:multiLevelType");
|
||||
this.root.push(
|
||||
new Attributes({
|
||||
|
@ -2,7 +2,7 @@ import { Attributes, XmlAttributeComponent, XmlComponent } from "@file/xml-compo
|
||||
import { decimalNumber } from "@util/values";
|
||||
|
||||
class AbstractNumId extends XmlComponent {
|
||||
constructor(value: number) {
|
||||
public constructor(value: number) {
|
||||
super("w:abstractNumId");
|
||||
this.root.push(
|
||||
new Attributes({
|
||||
@ -45,7 +45,7 @@ export class ConcreteNumbering extends XmlComponent {
|
||||
public readonly reference: string;
|
||||
public readonly instance: number;
|
||||
|
||||
constructor(options: IConcreteNumberingOptions) {
|
||||
public constructor(options: IConcreteNumberingOptions) {
|
||||
super("w:num");
|
||||
|
||||
this.numId = options.numId;
|
||||
@ -71,7 +71,7 @@ class LevelOverrideAttributes extends XmlAttributeComponent<{ readonly ilvl: num
|
||||
}
|
||||
|
||||
export class LevelOverride extends XmlComponent {
|
||||
constructor(levelNum: number, start?: number) {
|
||||
public constructor(levelNum: number, start?: number) {
|
||||
super("w:lvlOverride");
|
||||
this.root.push(new LevelOverrideAttributes({ ilvl: levelNum }));
|
||||
if (start !== undefined) {
|
||||
@ -85,7 +85,7 @@ class StartOverrideAttributes extends XmlAttributeComponent<{ readonly val: numb
|
||||
}
|
||||
|
||||
class StartOverride extends XmlComponent {
|
||||
constructor(start: number) {
|
||||
public constructor(start: number) {
|
||||
super("w:startOverride");
|
||||
this.root.push(new StartOverrideAttributes({ val: start }));
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ export class Numbering extends XmlComponent {
|
||||
private readonly concreteNumberingMap = new Map<string, ConcreteNumbering>();
|
||||
private readonly referenceConfigMap = new Map<string, object>();
|
||||
|
||||
constructor(options: INumberingOptions) {
|
||||
public constructor(options: INumberingOptions) {
|
||||
super("w:numbering");
|
||||
this.root.push(
|
||||
new DocumentAttributes({
|
||||
|
@ -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 }));
|
||||
}
|
||||
|
@ -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",
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
@ -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({
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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({
|
||||
|
@ -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({
|
||||
|
@ -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({
|
||||
|
@ -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({
|
||||
|
@ -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({
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
@ -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(
|
||||
|
@ -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 }));
|
||||
|
||||
|
@ -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()],
|
||||
});
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user