Merge pull request #3 from dolanmiu/master

merge latest changes from Dolans master
This commit is contained in:
Andrey Savin
2021-09-23 10:38:47 +03:00
committed by GitHub
5 changed files with 45 additions and 56 deletions

View File

@ -4,7 +4,7 @@
- Simple, declarative API - Simple, declarative API
- 60+ usage examples - 60+ usage examples
- Battle tested, mature, 98%+ coverage - Battle tested, mature, 99%+ coverage
[GitHub](https://github.com/dolanmiu/docx) [GitHub](https://github.com/dolanmiu/docx)
[Get Started](#Welcome) [Get Started](#Welcome)

View File

@ -180,12 +180,12 @@ Adding spacing between paragraphs
### ISpacingProperties ### ISpacingProperties
| Property | Type | Notes | | Property | Type | Notes | Possible Values |
| -------- | -------------- | -------- | | -------- | -------------- | -------- | ----------------------------- |
| after | `number` | Optional | | after | `number` | Optional | |
| before | `number` | Optional | | before | `number` | Optional | |
| line | `number` | Optional | | line | `number` | Optional | |
| lineRule | `LineRuleType` | Optional | | lineRule | `LineRuleType` | Optional | `AT_LEAST`, `EXACTLY`, `AUTO` |
**Example:** **Example:**

78
package-lock.json generated
View File

@ -534,9 +534,9 @@
"dev": true "dev": true
}, },
"@types/chai": { "@types/chai": {
"version": "4.2.21", "version": "4.2.22",
"resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.2.21.tgz", "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.2.22.tgz",
"integrity": "sha512-yd+9qKmJxm496BOV9CMNaey8TWsikaZOwMRwPHQIjcOJM9oV+fi9ZMNw3JsVnbEEbo2gRTDnGEBv8pjyn67hNg==", "integrity": "sha512-tFfcE+DSTzWAgifkjik9AySNqIyNoYwmR+uecPwwD/XRNfvOjmC/FjCxpiUGDkDVDphPfCUecSQVFw+lN3M3kQ==",
"dev": true "dev": true
}, },
"@types/color-name": { "@types/color-name": {
@ -590,9 +590,9 @@
"dev": true "dev": true
}, },
"@types/node": { "@types/node": {
"version": "16.9.2", "version": "16.9.6",
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.2.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.6.tgz",
"integrity": "sha512-ZHty/hKoOLZvSz6BtP1g7tc7nUeJhoCf3flLjh8ZEv1vFKBWHXcnMbJMyN/pftSljNyy0kNW/UqI3DccnBnZ8w==" "integrity": "sha512-YHUZhBOMTM3mjFkXVcK+WwAcYmyhe1wL4lfqNtzI0b3qAy7yuSetnM7QJazgE5PFmgVTNGiLOgRFfJMqW7XpSQ=="
}, },
"@types/request": { "@types/request": {
"version": "2.48.6", "version": "2.48.6",
@ -630,23 +630,12 @@
} }
}, },
"@types/sinon": { "@types/sinon": {
"version": "10.0.2", "version": "10.0.3",
"resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-10.0.2.tgz", "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-10.0.3.tgz",
"integrity": "sha512-BHn8Bpkapj8Wdfxvh2jWIUoaYB/9/XhsL0oOvBfRagJtKlSl9NWPcFOz2lRukI9szwGxFtYZCTejJSqsGDbdmw==", "integrity": "sha512-XUaFuUOQ3A/r6gS1qCU/USMleascaqGeQpGR1AZ5JdRtBPlzijRzKsik1TuGzvdtPA0mdq42JqaJmJ+Afg1LJg==",
"dev": true, "dev": true,
"requires": { "requires": {
"@sinonjs/fake-timers": "^7.1.0" "@sinonjs/fake-timers": "^7.1.0"
},
"dependencies": {
"@sinonjs/fake-timers": {
"version": "7.1.2",
"resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-7.1.2.tgz",
"integrity": "sha512-iQADsW4LBMISqZ6Ci1dupJL9pprqwcVFTcOsEmQOEhW+KLCVn/Y4Jrvg2k19fIHCp+iFprriYPTdRcQR8NbUPg==",
"dev": true,
"requires": {
"@sinonjs/commons": "^1.7.0"
}
}
} }
}, },
"@types/tough-cookie": { "@types/tough-cookie": {
@ -3083,14 +3072,11 @@
"integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=",
"dev": true "dev": true
}, },
"json5": { "jsonc-parser": {
"version": "2.2.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz", "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.0.0.tgz",
"integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==", "integrity": "sha512-fQzRfAbIBnR0IQvftw9FJveWiHp72Fg20giDrHz6TdfB12UH/uue0D3hm57UB5KgAVuniLMCaS8P1IMj9NR7cA==",
"dev": true, "dev": true
"requires": {
"minimist": "^1.2.5"
}
}, },
"jsonfile": { "jsonfile": {
"version": "4.0.0", "version": "4.0.0",
@ -3436,9 +3422,9 @@
"dev": true "dev": true
}, },
"marked": { "marked": {
"version": "3.0.3", "version": "3.0.4",
"resolved": "https://registry.npmjs.org/marked/-/marked-3.0.3.tgz", "resolved": "https://registry.npmjs.org/marked/-/marked-3.0.4.tgz",
"integrity": "sha512-4oIDhVSQ2s+xNCfek9OnZgCQR/WykGCom02JzIIvi4Pme+MIwPYqvGVW8CQWOXeoZu0TtVB6pTxIuoLm+dKqDA==", "integrity": "sha512-jBo8AOayNaEcvBhNobg6/BLhdsK3NvnKWJg33MAAPbvTWiG4QBn9gpW1+7RssrKu4K1dKlN+0goVQwV41xEfOA==",
"dev": true "dev": true
}, },
"medium-zoom": { "medium-zoom": {
@ -4301,9 +4287,9 @@
"dev": true "dev": true
}, },
"prismjs": { "prismjs": {
"version": "1.24.0", "version": "1.25.0",
"resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.24.0.tgz", "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.25.0.tgz",
"integrity": "sha512-SqV5GRsNqnzCL8k5dfAjCNhUrF3pR0A9lTDSCUZeh/LIshheXJEaP0hwLz2t4XHivd2J/v2HR+gRnigzeKe3cQ==", "integrity": "sha512-WCjJHl1KEWbnkQom1+SzftbtXMKQoezOCYs5rECqMN+jP+apI7ftoflyqigqzopSO3hMhTEb0mFClA8lkolgEg==",
"dev": true "dev": true
}, },
"process": { "process": {
@ -4813,12 +4799,12 @@
} }
}, },
"shiki": { "shiki": {
"version": "0.9.10", "version": "0.9.11",
"resolved": "https://registry.npmjs.org/shiki/-/shiki-0.9.10.tgz", "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.9.11.tgz",
"integrity": "sha512-xeM7Oc6hY+6iW5O/T5hor8ul7mEprzyl5y4r5zthEHToQNw7MIhREMgU3r2gKDB0NaMLNrkcEQagudCdzE13Lg==", "integrity": "sha512-tjruNTLFhU0hruCPoJP0y+B9LKOmcqUhTpxn7pcJB3fa+04gFChuEmxmrUfOJ7ZO6Jd+HwMnDHgY3lv3Tqonuw==",
"dev": true, "dev": true,
"requires": { "requires": {
"json5": "^2.2.0", "jsonc-parser": "^3.0.0",
"onigasm": "^2.2.5", "onigasm": "^2.2.5",
"vscode-textmate": "5.2.0" "vscode-textmate": "5.2.0"
} }
@ -5183,9 +5169,9 @@
} }
}, },
"ts-loader": { "ts-loader": {
"version": "9.2.5", "version": "9.2.6",
"resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.2.5.tgz", "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.2.6.tgz",
"integrity": "sha512-al/ATFEffybdRMUIr5zMEWQdVnCGMUA9d3fXJ8dBVvBlzytPvIszoG9kZoR+94k6/i293RnVOXwMaWbXhNy9pQ==", "integrity": "sha512-QMTC4UFzHmu9wU2VHZEmWWE9cUajjfcdcws+Gh7FhiO+Dy0RnR1bNz0YCHqhI0yRowCE9arVnNxYHqELOy9Hjw==",
"dev": true, "dev": true,
"requires": { "requires": {
"chalk": "^4.1.0", "chalk": "^4.1.0",
@ -5435,16 +5421,16 @@
} }
}, },
"typedoc": { "typedoc": {
"version": "0.22.3", "version": "0.22.4",
"resolved": "http://registry.npmjs.org/typedoc/-/typedoc-0.22.3.tgz", "resolved": "http://registry.npmjs.org/typedoc/-/typedoc-0.22.4.tgz",
"integrity": "sha512-EOWf9Vf3Vfb/jzBzr87uoLybQw9fx3iyXLUcpQn9F2Ks1/ZJN9iGeBbYRU+VNqrWvV4T+aS7Ife7GFEJUf0ohQ==", "integrity": "sha512-M/a8NnPxq3/iZNNVjzFCK5gu4m//HTJIPbSS0JQVbkHJPP9wyepR12agylWTSqeVZe0xsbidVtO26+PP7iD/jw==",
"dev": true, "dev": true,
"requires": { "requires": {
"glob": "^7.1.7", "glob": "^7.1.7",
"lunr": "^2.3.9", "lunr": "^2.3.9",
"marked": "^3.0.3", "marked": "^3.0.4",
"minimatch": "^3.0.4", "minimatch": "^3.0.4",
"shiki": "^0.9.10" "shiki": "^0.9.11"
} }
}, },
"typescript": { "typescript": {

View File

@ -2,7 +2,7 @@
import { decimalNumber } from "file/values"; import { decimalNumber } from "file/values";
import { Attributes, NumberValueElement, XmlAttributeComponent, XmlComponent } from "file/xml-components"; import { Attributes, NumberValueElement, XmlAttributeComponent, XmlComponent } from "file/xml-components";
import { AlignmentType } from "../paragraph/formatting"; import { AlignmentType } from "../paragraph/formatting";
import { IParagraphStylePropertiesOptions, ParagraphProperties } from "../paragraph/properties"; import { ILevelParagraphStylePropertiesOptions, ParagraphProperties } from "../paragraph/properties";
import { IRunStylePropertiesOptions, RunProperties } from "../paragraph/run/properties"; import { IRunStylePropertiesOptions, RunProperties } from "../paragraph/run/properties";
export enum LevelFormat { export enum LevelFormat {
@ -88,7 +88,7 @@ export interface ILevelsOptions {
readonly suffix?: LevelSuffix; readonly suffix?: LevelSuffix;
readonly style?: { readonly style?: {
readonly run?: IRunStylePropertiesOptions; readonly run?: IRunStylePropertiesOptions;
readonly paragraph?: IParagraphStylePropertiesOptions; readonly paragraph?: ILevelParagraphStylePropertiesOptions;
}; };
} }

View File

@ -13,7 +13,7 @@ import { NumberProperties } from "./formatting/unordered-list";
import { FrameProperties, IFrameOptions } from "./frame/frame-properties"; import { FrameProperties, IFrameOptions } from "./frame/frame-properties";
import { OutlineLevel } from "./links"; import { OutlineLevel } from "./links";
export interface IParagraphStylePropertiesOptions { export interface ILevelParagraphStylePropertiesOptions {
readonly alignment?: AlignmentType; readonly alignment?: AlignmentType;
readonly thematicBreak?: boolean; readonly thematicBreak?: boolean;
readonly contextualSpacing?: boolean; readonly contextualSpacing?: boolean;
@ -24,6 +24,9 @@ export interface IParagraphStylePropertiesOptions {
readonly keepNext?: boolean; readonly keepNext?: boolean;
readonly keepLines?: boolean; readonly keepLines?: boolean;
readonly outlineLevel?: number; readonly outlineLevel?: number;
}
export interface IParagraphStylePropertiesOptions extends ILevelParagraphStylePropertiesOptions {
readonly numbering?: { readonly numbering?: {
readonly reference: string; readonly reference: string;
readonly level: number; readonly level: number;