Compare commits

..

230 Commits
7.5.0 ... 7.8.1

Author SHA1 Message Date
a481518470 Version bump 2022-12-30 16:21:00 +00:00
2435ebf16e Correctly return value from constructor 2022-12-30 16:16:59 +00:00
62d0767ceb Version bump 2022-12-10 15:43:26 +00:00
8024c01a82 Merge pull request #1831 from dolanmiu/dependabot/npm_and_yarn/qs-6.5.3
build(deps): bump qs from 6.5.2 to 6.5.3
2022-12-10 01:35:59 +00:00
1b380c3fdb Merge pull request #1825 from dolanmiu/dependabot/npm_and_yarn/prettier-2.8.1
build(deps-dev): bump prettier from 2.8.0 to 2.8.1
2022-12-10 00:13:12 +00:00
06b67bd292 build(deps): bump qs from 6.5.2 to 6.5.3
Bumps [qs](https://github.com/ljharb/qs) from 6.5.2 to 6.5.3.
- [Release notes](https://github.com/ljharb/qs/releases)
- [Changelog](https://github.com/ljharb/qs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ljharb/qs/compare/v6.5.2...v6.5.3)

---
updated-dependencies:
- dependency-name: qs
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-10 00:12:40 +00:00
8a1087f601 Merge pull request #1824 from dolanmiu/dependabot/npm_and_yarn/typescript-eslint/parser-5.46.0
build(deps-dev): bump @typescript-eslint/parser from 5.45.1 to 5.46.0
2022-12-10 00:12:37 +00:00
ff09d6515c Merge pull request #1826 from dolanmiu/dependabot/npm_and_yarn/typescript-eslint/eslint-plugin-5.46.0
build(deps-dev): bump @typescript-eslint/eslint-plugin from 5.45.1 to 5.46.0
2022-12-10 00:12:29 +00:00
ebe85d8e14 Merge pull request #1827 from dolanmiu/dependabot/npm_and_yarn/typescript-4.9.4
build(deps-dev): bump typescript from 4.9.3 to 4.9.4
2022-12-10 00:12:20 +00:00
5dc27ac46a Merge pull request #1828 from dolanmiu/dependabot/npm_and_yarn/types/node-18.11.12
build(deps): bump @types/node from 18.11.11 to 18.11.12
2022-12-10 00:12:11 +00:00
1dcc8ee761 Merge pull request #1830 from dolanmiu/feat/optional-background
Optional background property
2022-12-10 00:12:01 +00:00
f789f60e22 Optional background property 2022-12-09 21:07:08 +00:00
32e3f07d57 build(deps): bump @types/node from 18.11.11 to 18.11.12
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 18.11.11 to 18.11.12.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-09 11:01:11 +00:00
9ea41ab3ce build(deps-dev): bump typescript from 4.9.3 to 4.9.4
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.9.3 to 4.9.4.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v4.9.3...v4.9.4)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-08 11:02:37 +00:00
4b8d062862 build(deps-dev): bump @typescript-eslint/eslint-plugin
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.45.1 to 5.46.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.46.0/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-08 11:02:17 +00:00
d9408029f3 build(deps-dev): bump prettier from 2.8.0 to 2.8.1
Bumps [prettier](https://github.com/prettier/prettier) from 2.8.0 to 2.8.1.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.8.0...2.8.1)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-08 11:01:36 +00:00
9fe0406078 build(deps-dev): bump @typescript-eslint/parser from 5.45.1 to 5.46.0
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 5.45.1 to 5.46.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.46.0/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-08 11:01:18 +00:00
3ea453a07f Merge pull request #1822 from dolanmiu/feat/underline-none
#1807 Add underline none
2022-12-06 23:51:05 +00:00
984e762a53 Fix test 2022-12-06 23:42:22 +00:00
1592aa7117 Add underline none
Add space options for Text
2022-12-06 22:04:30 +00:00
62b4522c94 Merge pull request #1819 from dolanmiu/dependabot/npm_and_yarn/typescript-eslint/parser-5.45.1
build(deps-dev): bump @typescript-eslint/parser from 5.45.0 to 5.45.1
2022-12-06 13:53:02 +00:00
8b86751c95 build(deps-dev): bump @typescript-eslint/parser from 5.45.0 to 5.45.1
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 5.45.0 to 5.45.1.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.45.1/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-06 13:19:01 +00:00
afa380e336 Merge pull request #1818 from dolanmiu/dependabot/npm_and_yarn/types/node-18.11.11
build(deps): bump @types/node from 18.11.10 to 18.11.11
2022-12-06 13:18:20 +00:00
feebff9077 Merge pull request #1816 from dolanmiu/dependabot/npm_and_yarn/typescript-eslint/eslint-plugin-5.45.1
build(deps-dev): bump @typescript-eslint/eslint-plugin from 5.45.0 to 5.45.1
2022-12-06 13:18:13 +00:00
028b50ff99 Merge pull request #1815 from dolanmiu/dependabot/npm_and_yarn/cspell-6.17.0
build(deps-dev): bump cspell from 6.16.0 to 6.17.0
2022-12-06 13:18:03 +00:00
559e81c3fe Merge pull request #1817 from dolanmiu/dependabot/npm_and_yarn/webpack-cli-5.0.1
build(deps-dev): bump webpack-cli from 5.0.0 to 5.0.1
2022-12-06 13:17:55 +00:00
4da6b98437 build(deps): bump @types/node from 18.11.10 to 18.11.11
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 18.11.10 to 18.11.11.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-06 11:03:55 +00:00
5b2409c76f build(deps-dev): bump webpack-cli from 5.0.0 to 5.0.1
Bumps [webpack-cli](https://github.com/webpack/webpack-cli) from 5.0.0 to 5.0.1.
- [Release notes](https://github.com/webpack/webpack-cli/releases)
- [Changelog](https://github.com/webpack/webpack-cli/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-cli/compare/webpack-cli@5.0.0...webpack-cli@5.0.1)

---
updated-dependencies:
- dependency-name: webpack-cli
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-06 11:03:32 +00:00
ff027d172e build(deps-dev): bump @typescript-eslint/eslint-plugin
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.45.0 to 5.45.1.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.45.1/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-06 11:03:20 +00:00
3f23290a46 build(deps-dev): bump cspell from 6.16.0 to 6.17.0
Bumps [cspell](https://github.com/streetsidesoftware/cspell) from 6.16.0 to 6.17.0.
- [Release notes](https://github.com/streetsidesoftware/cspell/releases)
- [Changelog](https://github.com/streetsidesoftware/cspell/blob/main/CHANGELOG.md)
- [Commits](https://github.com/streetsidesoftware/cspell/compare/v6.16.0...v6.17.0)

---
updated-dependencies:
- dependency-name: cspell
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-06 11:02:53 +00:00
f1a10d32e6 Merge pull request #1813 from dolanmiu/dependabot/npm_and_yarn/cspell-6.16.0
build(deps-dev): bump cspell from 6.15.1 to 6.16.0
2022-12-05 17:14:33 +00:00
a71f40e873 Merge pull request #1810 from dolanmiu/dependabot/npm_and_yarn/tsconfig-paths-4.1.1
build(deps-dev): bump tsconfig-paths from 4.1.0 to 4.1.1
2022-12-05 17:14:27 +00:00
7f449319cd Merge pull request #1809 from dolanmiu/dependabot/npm_and_yarn/types/node-18.11.10
build(deps): bump @types/node from 18.11.9 to 18.11.10
2022-12-05 17:14:20 +00:00
ab5c8ea698 Merge pull request #1814 from dolanmiu/dependabot/npm_and_yarn/eslint-8.29.0
build(deps-dev): bump eslint from 8.28.0 to 8.29.0
2022-12-05 17:14:12 +00:00
68cfa9360b build(deps-dev): bump eslint from 8.28.0 to 8.29.0
Bumps [eslint](https://github.com/eslint/eslint) from 8.28.0 to 8.29.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.28.0...v8.29.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-05 11:01:36 +00:00
f627e3d994 build(deps-dev): bump cspell from 6.15.1 to 6.16.0
Bumps [cspell](https://github.com/streetsidesoftware/cspell) from 6.15.1 to 6.16.0.
- [Release notes](https://github.com/streetsidesoftware/cspell/releases)
- [Changelog](https://github.com/streetsidesoftware/cspell/blob/main/CHANGELOG.md)
- [Commits](https://github.com/streetsidesoftware/cspell/compare/v6.15.1...v6.16.0)

---
updated-dependencies:
- dependency-name: cspell
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-05 11:01:06 +00:00
7c870548d9 Merge pull request #1811 from dolanmiu/dependabot/npm_and_yarn/ts-loader-9.4.2
build(deps-dev): bump ts-loader from 9.4.1 to 9.4.2
2022-12-02 14:34:36 +00:00
57ccc41547 Merge pull request #1812 from dolanmiu/dependabot/npm_and_yarn/cspell-6.15.1
build(deps-dev): bump cspell from 6.15.0 to 6.15.1
2022-12-02 14:34:25 +00:00
988ba45197 build(deps-dev): bump cspell from 6.15.0 to 6.15.1
Bumps [cspell](https://github.com/streetsidesoftware/cspell) from 6.15.0 to 6.15.1.
- [Release notes](https://github.com/streetsidesoftware/cspell/releases)
- [Changelog](https://github.com/streetsidesoftware/cspell/blob/main/CHANGELOG.md)
- [Commits](https://github.com/streetsidesoftware/cspell/compare/v6.15.0...v6.15.1)

---
updated-dependencies:
- dependency-name: cspell
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-01 11:02:12 +00:00
df6606041b build(deps-dev): bump ts-loader from 9.4.1 to 9.4.2
Bumps [ts-loader](https://github.com/TypeStrong/ts-loader) from 9.4.1 to 9.4.2.
- [Release notes](https://github.com/TypeStrong/ts-loader/releases)
- [Changelog](https://github.com/TypeStrong/ts-loader/blob/main/CHANGELOG.md)
- [Commits](https://github.com/TypeStrong/ts-loader/compare/9.4.1...v9.4.2)

---
updated-dependencies:
- dependency-name: ts-loader
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-01 11:01:53 +00:00
3ae27b466f build(deps-dev): bump tsconfig-paths from 4.1.0 to 4.1.1
Bumps [tsconfig-paths](https://github.com/dividab/tsconfig-paths) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/dividab/tsconfig-paths/releases)
- [Changelog](https://github.com/dividab/tsconfig-paths/blob/master/CHANGELOG.md)
- [Commits](https://github.com/dividab/tsconfig-paths/compare/v4.1.0...v4.1.1)

---
updated-dependencies:
- dependency-name: tsconfig-paths
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-01 11:01:25 +00:00
69f5e21435 build(deps): bump @types/node from 18.11.9 to 18.11.10
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 18.11.9 to 18.11.10.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-01 11:01:05 +00:00
6da73c612a Add demo for thai distributed 2022-11-30 03:54:01 +00:00
e1b1c1492f Merge pull request #1803 from dolanmiu/dependabot/npm_and_yarn/typescript-eslint/eslint-plugin-5.45.0
build(deps-dev): bump @typescript-eslint/eslint-plugin from 5.44.0 to 5.45.0
2022-11-30 01:47:32 +00:00
6ca13c4fce Merge pull request #1802 from dolanmiu/dependabot/npm_and_yarn/types/mocha-10.0.1
build(deps-dev): bump @types/mocha from 10.0.0 to 10.0.1
2022-11-30 01:47:24 +00:00
b474567d20 Merge pull request #1801 from dolanmiu/dependabot/npm_and_yarn/typescript-eslint/parser-5.45.0
build(deps-dev): bump @typescript-eslint/parser from 5.44.0 to 5.45.0
2022-11-30 01:47:13 +00:00
c07170902e Merge pull request #1804 from dolanmiu/dependabot/npm_and_yarn/sinon-15.0.0
build(deps-dev): bump sinon from 14.0.2 to 15.0.0
2022-11-30 01:47:04 +00:00
0f201d2f4b Update README.md 2022-11-29 19:29:32 +00:00
b875d6f183 build(deps-dev): bump sinon from 14.0.2 to 15.0.0
Bumps [sinon](https://github.com/sinonjs/sinon) from 14.0.2 to 15.0.0.
- [Release notes](https://github.com/sinonjs/sinon/releases)
- [Changelog](https://github.com/sinonjs/sinon/blob/main/docs/changelog.md)
- [Commits](https://github.com/sinonjs/sinon/compare/v14.0.2...v15.0.0)

---
updated-dependencies:
- dependency-name: sinon
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-29 11:02:17 +00:00
831b92239d build(deps-dev): bump @typescript-eslint/eslint-plugin
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.44.0 to 5.45.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.45.0/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-29 11:01:30 +00:00
66b91c22dd build(deps-dev): bump @types/mocha from 10.0.0 to 10.0.1
Bumps [@types/mocha](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/mocha) from 10.0.0 to 10.0.1.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/mocha)

---
updated-dependencies:
- dependency-name: "@types/mocha"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-29 11:01:14 +00:00
1242c0689f build(deps-dev): bump @typescript-eslint/parser from 5.44.0 to 5.45.0
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 5.44.0 to 5.45.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.45.0/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-29 11:01:01 +00:00
4386d02526 Merge pull request #1799 from dolanmiu/dependabot/npm_and_yarn/cspell-6.15.0
build(deps-dev): bump cspell from 6.14.3 to 6.15.0
2022-11-29 10:32:39 +00:00
3ba521f8cc Merge pull request #1800 from dolanmiu/dependabot/npm_and_yarn/eslint-plugin-unicorn-45.0.1
build(deps-dev): bump eslint-plugin-unicorn from 45.0.0 to 45.0.1
2022-11-29 10:32:30 +00:00
85bb818ae6 build(deps-dev): bump eslint-plugin-unicorn from 45.0.0 to 45.0.1
Bumps [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) from 45.0.0 to 45.0.1.
- [Release notes](https://github.com/sindresorhus/eslint-plugin-unicorn/releases)
- [Commits](https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v45.0.0...v45.0.1)

---
updated-dependencies:
- dependency-name: eslint-plugin-unicorn
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-28 11:01:03 +00:00
be7e2aa8fe build(deps-dev): bump cspell from 6.14.3 to 6.15.0
Bumps [cspell](https://github.com/streetsidesoftware/cspell) from 6.14.3 to 6.15.0.
- [Release notes](https://github.com/streetsidesoftware/cspell/releases)
- [Changelog](https://github.com/streetsidesoftware/cspell/blob/main/CHANGELOG.md)
- [Commits](https://github.com/streetsidesoftware/cspell/compare/v6.14.3...v6.15.0)

---
updated-dependencies:
- dependency-name: cspell
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-28 11:00:50 +00:00
7f71f6e3f1 Add demo for data source for tables 2022-11-26 20:32:32 +00:00
a94d23e2ae Add default npmrc 2022-11-26 19:33:58 +00:00
133c255ce2 Merge pull request #1798 from dolanmiu/dependabot/npm_and_yarn/eslint-plugin-jsdoc-39.6.4
build(deps-dev): bump eslint-plugin-jsdoc from 39.6.2 to 39.6.4
2022-11-25 11:11:26 +00:00
863e27ff9b build(deps-dev): bump eslint-plugin-jsdoc from 39.6.2 to 39.6.4
Bumps [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) from 39.6.2 to 39.6.4.
- [Release notes](https://github.com/gajus/eslint-plugin-jsdoc/releases)
- [Commits](https://github.com/gajus/eslint-plugin-jsdoc/compare/v39.6.2...v39.6.4)

---
updated-dependencies:
- dependency-name: eslint-plugin-jsdoc
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-25 11:00:50 +00:00
5c63e6ae12 Merge pull request #1797 from dolanmiu/feat/new-levels
#212 Add more levels support
2022-11-25 01:48:30 +00:00
10dd36569d #212 Add more levels support 2022-11-25 01:36:59 +00:00
be5985fb6a Merge pull request #1795 from dolanmiu/dependabot/npm_and_yarn/prettier-2.8.0
build(deps-dev): bump prettier from 2.7.1 to 2.8.0
2022-11-23 20:17:39 +00:00
0d7f169613 build(deps-dev): bump prettier from 2.7.1 to 2.8.0
Bumps [prettier](https://github.com/prettier/prettier) from 2.7.1 to 2.8.0.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.7.1...2.8.0)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-23 11:01:16 +00:00
eaddcb83ab Merge pull request #1792 from dolanmiu/dependabot/npm_and_yarn/typescript-eslint/parser-5.44.0
build(deps-dev): bump @typescript-eslint/parser from 5.43.0 to 5.44.0
2022-11-23 01:00:45 +00:00
9a6885f124 Add Thai Distributed demo 2022-11-23 00:36:54 +00:00
7284ee818b build(deps-dev): bump @typescript-eslint/parser from 5.43.0 to 5.44.0
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 5.43.0 to 5.44.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.44.0/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-22 23:51:30 +00:00
20964454c4 Merge pull request #1793 from dolanmiu/dependabot/npm_and_yarn/typescript-eslint/eslint-plugin-5.44.0
build(deps-dev): bump @typescript-eslint/eslint-plugin from 5.43.0 to 5.44.0
2022-11-22 23:50:51 +00:00
d7670929d1 build(deps-dev): bump @typescript-eslint/eslint-plugin
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.43.0 to 5.44.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.44.0/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-22 11:02:02 +00:00
58f0761423 Merge pull request #1790 from dolanmiu/dependabot/npm_and_yarn/eslint-8.28.0
build(deps-dev): bump eslint from 8.27.0 to 8.28.0
2022-11-21 23:26:13 +00:00
3f28bc09bc Merge pull request #1791 from dolanmiu/dependabot/npm_and_yarn/eslint-plugin-unicorn-45.0.0
build(deps-dev): bump eslint-plugin-unicorn from 44.0.2 to 45.0.0
2022-11-21 23:26:02 +00:00
6efa734e81 build(deps-dev): bump eslint-plugin-unicorn from 44.0.2 to 45.0.0
Bumps [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) from 44.0.2 to 45.0.0.
- [Release notes](https://github.com/sindresorhus/eslint-plugin-unicorn/releases)
- [Commits](https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v44.0.2...v45.0.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-unicorn
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-21 11:01:31 +00:00
47d64af737 build(deps-dev): bump eslint from 8.27.0 to 8.28.0
Bumps [eslint](https://github.com/eslint/eslint) from 8.27.0 to 8.28.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.27.0...v8.28.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-21 11:00:53 +00:00
4a2b91ce07 Update sidebar for docs 2022-11-19 22:16:04 +00:00
080a77cc73 Merge pull request #1787 from dolanmiu/feat/more-alignment-options
#1784 Add more alignment options according to spec
2022-11-19 22:08:12 +00:00
9b874b0061 #1784 Add more alignment options according to spec 2022-11-19 20:14:15 +00:00
ff8a2ed538 Merge pull request #1785 from dolanmiu/feat/exact
#1773 Add `exact` for spacing
2022-11-19 16:24:07 +00:00
251eafe103 #1773 Add exact for spacing 2022-11-19 15:51:41 +00:00
64b604c9ac Merge pull request #1782 from dolanmiu/dependabot/npm_and_yarn/cspell-6.14.3
build(deps-dev): bump cspell from 6.14.2 to 6.14.3
2022-11-18 17:11:29 +00:00
72fc5f9874 Merge pull request #1783 from dolanmiu/dependabot/npm_and_yarn/webpack-cli-5.0.0
build(deps-dev): bump webpack-cli from 4.10.0 to 5.0.0
2022-11-18 17:11:22 +00:00
71dcdf0ca2 build(deps-dev): bump webpack-cli from 4.10.0 to 5.0.0
Bumps [webpack-cli](https://github.com/webpack/webpack-cli) from 4.10.0 to 5.0.0.
- [Release notes](https://github.com/webpack/webpack-cli/releases)
- [Changelog](https://github.com/webpack/webpack-cli/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-cli/compare/webpack-cli@4.10.0...webpack-cli@5.0.0)

---
updated-dependencies:
- dependency-name: webpack-cli
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-17 11:02:49 +00:00
e23fc987a7 build(deps-dev): bump cspell from 6.14.2 to 6.14.3
Bumps [cspell](https://github.com/streetsidesoftware/cspell) from 6.14.2 to 6.14.3.
- [Release notes](https://github.com/streetsidesoftware/cspell/releases)
- [Changelog](https://github.com/streetsidesoftware/cspell/blob/main/CHANGELOG.md)
- [Commits](https://github.com/streetsidesoftware/cspell/compare/v6.14.2...v6.14.3)

---
updated-dependencies:
- dependency-name: cspell
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-17 11:01:56 +00:00
36dba1a36f Merge pull request #1781 from dolanmiu/dependabot/npm_and_yarn/typescript-4.9.3
build(deps-dev): bump typescript from 4.8.4 to 4.9.3
2022-11-17 00:39:57 +00:00
1b1547d4b6 build(deps-dev): bump typescript from 4.8.4 to 4.9.3
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.8.4 to 4.9.3.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/commits)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-16 11:01:25 +00:00
8008482592 Version bump 2022-11-15 21:15:57 +00:00
6d1a7fe438 Merge pull request #1778 from dolanmiu/dependabot/npm_and_yarn/typescript-eslint/parser-5.43.0
build(deps-dev): bump @typescript-eslint/parser from 5.42.1 to 5.43.0
2022-11-15 11:40:04 +00:00
90c58b0498 Merge pull request #1777 from dolanmiu/dependabot/npm_and_yarn/typescript-eslint/eslint-plugin-5.43.0
build(deps-dev): bump @typescript-eslint/eslint-plugin from 5.42.1 to 5.43.0
2022-11-15 11:39:57 +00:00
c91bb71700 build(deps-dev): bump @typescript-eslint/parser from 5.42.1 to 5.43.0
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 5.42.1 to 5.43.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.43.0/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-15 11:01:20 +00:00
3d09c45205 build(deps-dev): bump @typescript-eslint/eslint-plugin
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.42.1 to 5.43.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.43.0/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-15 11:01:05 +00:00
f1e41d883c Merge pull request #1776 from dolanmiu/dependabot/npm_and_yarn/typedoc-0.23.21
build(deps-dev): bump typedoc from 0.23.20 to 0.23.21
2022-11-14 14:58:03 +00:00
4f783ec8e4 build(deps-dev): bump typedoc from 0.23.20 to 0.23.21
Bumps [typedoc](https://github.com/TypeStrong/TypeDoc) from 0.23.20 to 0.23.21.
- [Release notes](https://github.com/TypeStrong/TypeDoc/releases)
- [Changelog](https://github.com/TypeStrong/typedoc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TypeStrong/TypeDoc/compare/v0.23.20...v0.23.21)

---
updated-dependencies:
- dependency-name: typedoc
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-14 11:00:55 +00:00
3d35e84953 Merge pull request #1772 from dolanmiu/dependabot/npm_and_yarn/typescript-eslint/parser-5.42.1
build(deps-dev): bump @typescript-eslint/parser from 5.42.0 to 5.42.1
2022-11-11 11:42:35 +00:00
e80bc8b584 Merge pull request #1775 from dolanmiu/dependabot/npm_and_yarn/cspell-6.14.2
build(deps-dev): bump cspell from 6.13.3 to 6.14.2
2022-11-11 11:39:31 +00:00
2848b39479 build(deps-dev): bump @typescript-eslint/parser from 5.42.0 to 5.42.1
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 5.42.0 to 5.42.1.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.42.1/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-11 11:24:53 +00:00
7ee9be200c Merge pull request #1771 from dolanmiu/dependabot/npm_and_yarn/sinon-14.0.2
build(deps-dev): bump sinon from 14.0.1 to 14.0.2
2022-11-11 11:22:48 +00:00
94cdd740ad Merge pull request #1770 from dolanmiu/dependabot/npm_and_yarn/typescript-eslint/eslint-plugin-5.42.1
build(deps-dev): bump @typescript-eslint/eslint-plugin from 5.42.0 to 5.42.1
2022-11-11 11:22:33 +00:00
9130687164 Merge pull request #1769 from dolanmiu/dependabot/npm_and_yarn/chai-4.3.7
build(deps-dev): bump chai from 4.3.6 to 4.3.7
2022-11-11 11:22:23 +00:00
2f52f47463 build(deps-dev): bump cspell from 6.13.3 to 6.14.2
Bumps [cspell](https://github.com/streetsidesoftware/cspell) from 6.13.3 to 6.14.2.
- [Release notes](https://github.com/streetsidesoftware/cspell/releases)
- [Changelog](https://github.com/streetsidesoftware/cspell/blob/main/CHANGELOG.md)
- [Commits](https://github.com/streetsidesoftware/cspell/compare/v6.13.3...v6.14.2)

---
updated-dependencies:
- dependency-name: cspell
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-11 11:01:36 +00:00
01866f4802 build(deps-dev): bump chai from 4.3.6 to 4.3.7
Bumps [chai](https://github.com/chaijs/chai) from 4.3.6 to 4.3.7.
- [Release notes](https://github.com/chaijs/chai/releases)
- [Changelog](https://github.com/chaijs/chai/blob/4.x.x/History.md)
- [Commits](https://github.com/chaijs/chai/compare/v4.3.6...v4.3.7)

---
updated-dependencies:
- dependency-name: chai
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-10 17:34:14 +00:00
fa8ac0f2e4 build(deps-dev): bump @typescript-eslint/eslint-plugin
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.42.0 to 5.42.1.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.42.1/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-10 17:31:07 +00:00
e9a909ed20 build(deps-dev): bump sinon from 14.0.1 to 14.0.2
Bumps [sinon](https://github.com/sinonjs/sinon) from 14.0.1 to 14.0.2.
- [Release notes](https://github.com/sinonjs/sinon/releases)
- [Changelog](https://github.com/sinonjs/sinon/blob/main/docs/changelog.md)
- [Commits](https://github.com/sinonjs/sinon/compare/v14.0.1...v14.0.2)

---
updated-dependencies:
- dependency-name: sinon
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-10 17:31:01 +00:00
8808447963 Merge pull request #1768 from dolanmiu/dependabot/npm_and_yarn/eslint-8.27.0
build(deps-dev): bump eslint from 8.26.0 to 8.27.0
2022-11-10 17:29:56 +00:00
056b496189 build(deps-dev): bump eslint from 8.26.0 to 8.27.0
Bumps [eslint](https://github.com/eslint/eslint) from 8.26.0 to 8.27.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.26.0...v8.27.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-10 16:47:03 +00:00
11b374ea75 Merge pull request #1774 from dolanmiu/dependabot/npm_and_yarn/webpack-5.75.0
build(deps-dev): bump webpack from 5.74.0 to 5.75.0
2022-11-10 16:45:49 +00:00
f8f9744786 build(deps-dev): bump webpack from 5.74.0 to 5.75.0
Bumps [webpack](https://github.com/webpack/webpack) from 5.74.0 to 5.75.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.74.0...v5.75.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-10 11:01:00 +00:00
6f6888d638 #1413 - Add side by side table demo 2022-11-04 00:30:12 +00:00
995430b76f Merge pull request #1762 from dolanmiu/dependabot/npm_and_yarn/eslint-plugin-jsdoc-39.6.2
build(deps-dev): bump eslint-plugin-jsdoc from 39.5.0 to 39.6.2
2022-11-03 12:44:53 +00:00
d4a5ec4e14 Merge pull request #1763 from dolanmiu/dependabot/npm_and_yarn/typedoc-0.23.20
build(deps-dev): bump typedoc from 0.23.19 to 0.23.20
2022-11-03 12:44:46 +00:00
c7dce059f8 build(deps-dev): bump typedoc from 0.23.19 to 0.23.20
Bumps [typedoc](https://github.com/TypeStrong/TypeDoc) from 0.23.19 to 0.23.20.
- [Release notes](https://github.com/TypeStrong/TypeDoc/releases)
- [Changelog](https://github.com/TypeStrong/typedoc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TypeStrong/TypeDoc/compare/v0.23.19...v0.23.20)

---
updated-dependencies:
- dependency-name: typedoc
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-03 11:01:11 +00:00
2f4e3f2153 build(deps-dev): bump eslint-plugin-jsdoc from 39.5.0 to 39.6.2
Bumps [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) from 39.5.0 to 39.6.2.
- [Release notes](https://github.com/gajus/eslint-plugin-jsdoc/releases)
- [Commits](https://github.com/gajus/eslint-plugin-jsdoc/compare/v39.5.0...v39.6.2)

---
updated-dependencies:
- dependency-name: eslint-plugin-jsdoc
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-03 11:00:46 +00:00
a37c5646b6 Merge pull request #1760 from dolanmiu/dependabot/npm_and_yarn/eslint-plugin-jsdoc-39.5.0
build(deps-dev): bump eslint-plugin-jsdoc from 39.4.0 to 39.5.0
2022-11-03 01:54:01 +00:00
ddc9c8f62f Merge pull request #1761 from dolanmiu/feat/add-scale
#1507 - Add scale for run
2022-11-03 01:47:27 +00:00
1b06fc71cf #1507 - Add scale for run 2022-11-03 00:30:16 +00:00
e65a3bfeab build(deps-dev): bump eslint-plugin-jsdoc from 39.4.0 to 39.5.0
Bumps [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) from 39.4.0 to 39.5.0.
- [Release notes](https://github.com/gajus/eslint-plugin-jsdoc/releases)
- [Commits](https://github.com/gajus/eslint-plugin-jsdoc/compare/v39.4.0...v39.5.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-jsdoc
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-02 11:27:08 +00:00
b9ceabcc07 Merge pull request #1750 from dolanmiu/dependabot/npm_and_yarn/eslint-plugin-jsdoc-39.4.0
build(deps-dev): bump eslint-plugin-jsdoc from 39.3.25 to 39.4.0
2022-11-02 02:39:37 +00:00
35be3bfb9b Merge pull request #1755 from dolanmiu/dependabot/npm_and_yarn/typescript-eslint/eslint-plugin-5.42.0
build(deps-dev): bump @typescript-eslint/eslint-plugin from 5.41.0 to 5.42.0
2022-11-02 02:39:31 +00:00
572c8efbc7 Merge pull request #1756 from dolanmiu/dependabot/npm_and_yarn/typescript-eslint/parser-5.42.0
build(deps-dev): bump @typescript-eslint/parser from 5.41.0 to 5.42.0
2022-11-02 02:39:24 +00:00
b1b3e2369b Merge pull request #1757 from dolanmiu/dependabot/npm_and_yarn/types/node-18.11.9
build(deps): bump @types/node from 18.11.7 to 18.11.9
2022-11-02 02:39:17 +00:00
dc72bb629e Merge pull request #1758 from dolanmiu/dependabot/npm_and_yarn/cspell-6.13.3
build(deps-dev): bump cspell from 6.13.1 to 6.13.3
2022-11-02 02:39:09 +00:00
a724706817 build(deps-dev): bump cspell from 6.13.1 to 6.13.3
Bumps [cspell](https://github.com/streetsidesoftware/cspell) from 6.13.1 to 6.13.3.
- [Release notes](https://github.com/streetsidesoftware/cspell/releases)
- [Changelog](https://github.com/streetsidesoftware/cspell/blob/main/CHANGELOG.md)
- [Commits](https://github.com/streetsidesoftware/cspell/compare/v6.13.1...v6.13.3)

---
updated-dependencies:
- dependency-name: cspell
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-01 11:02:16 +00:00
84989116ef build(deps): bump @types/node from 18.11.7 to 18.11.9
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 18.11.7 to 18.11.9.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-01 11:01:54 +00:00
6c4efe4a1c build(deps-dev): bump @typescript-eslint/parser from 5.41.0 to 5.42.0
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 5.41.0 to 5.42.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.42.0/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-01 11:01:41 +00:00
8596d70b79 build(deps-dev): bump @typescript-eslint/eslint-plugin
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.41.0 to 5.42.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.42.0/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-01 11:01:27 +00:00
db6c9b2700 build(deps-dev): bump eslint-plugin-jsdoc from 39.3.25 to 39.4.0
Bumps [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) from 39.3.25 to 39.4.0.
- [Release notes](https://github.com/gajus/eslint-plugin-jsdoc/releases)
- [Commits](https://github.com/gajus/eslint-plugin-jsdoc/compare/v39.3.25...v39.4.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-jsdoc
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-31 11:00:53 +00:00
a33602ccf6 Merge pull request #1749 from dolanmiu/feat/compatibility
#1126 - Add all comptability options
2022-10-30 18:14:35 +00:00
988987ddbe #1126 - Add all comptability options 2022-10-29 15:10:02 +01:00
309e66a6de Merge pull request #1748 from dolanmiu/feat/clean-up
Move SpaceType to shared
2022-10-29 04:21:57 +01:00
7d8cfc0382 Move SpaceType to shared 2022-10-29 03:10:29 +01:00
5cbae5d3f7 Merge pull request #1746 from dolanmiu/dependabot/npm_and_yarn/typedoc-0.23.19
build(deps-dev): bump typedoc from 0.23.18 to 0.23.19
2022-10-28 23:18:44 +01:00
9b630c4ef7 Merge pull request #1745 from dolanmiu/dependabot/npm_and_yarn/cspell-6.13.1
build(deps-dev): bump cspell from 6.12.0 to 6.13.1
2022-10-28 23:14:18 +01:00
befcbabe27 Merge pull request #1747 from dolanmiu/feat/vanish
#1744 - Add `vanish` and `specVanish`
2022-10-28 22:46:08 +01:00
4cfb0ade88 #1744 - Add vanish and specVanish 2022-10-28 22:20:16 +01:00
a6f528537b build(deps-dev): bump typedoc from 0.23.18 to 0.23.19
Bumps [typedoc](https://github.com/TypeStrong/TypeDoc) from 0.23.18 to 0.23.19.
- [Release notes](https://github.com/TypeStrong/TypeDoc/releases)
- [Changelog](https://github.com/TypeStrong/typedoc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TypeStrong/TypeDoc/compare/v0.23.18...v0.23.19)

---
updated-dependencies:
- dependency-name: typedoc
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-28 11:01:56 +00:00
dfc82a517d build(deps-dev): bump cspell from 6.12.0 to 6.13.1
Bumps [cspell](https://github.com/streetsidesoftware/cspell) from 6.12.0 to 6.13.1.
- [Release notes](https://github.com/streetsidesoftware/cspell/releases)
- [Changelog](https://github.com/streetsidesoftware/cspell/blob/main/CHANGELOG.md)
- [Commits](https://github.com/streetsidesoftware/cspell/compare/v6.12.0...v6.13.1)

---
updated-dependencies:
- dependency-name: cspell
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-28 11:01:44 +00:00
29f421686f Merge pull request #1743 from dolanmiu/dependabot/npm_and_yarn/types/node-18.11.7
build(deps): bump @types/node from 18.11.5 to 18.11.7
2022-10-28 03:07:46 +01:00
c11299076f build(deps): bump @types/node from 18.11.5 to 18.11.7
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 18.11.5 to 18.11.7.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-27 11:01:05 +00:00
1cb2ef565e Increase coverage threshold 2022-10-27 02:01:14 +01:00
2de07d04a8 Merge pull request #1742 from dolanmiu/feat/tab-feature
#1281 - Tab feature
2022-10-27 00:38:25 +01:00
75e064dd1d #1281 - Tab feature 2022-10-27 00:17:02 +01:00
5f0091ee25 Merge pull request #1741 from dolanmiu/feat/alt-text
#756 Adding alt text feature
2022-10-26 23:56:10 +01:00
d2c0e656d0 Add tests 2022-10-26 23:43:51 +01:00
522b21862b #756 Adding alt text feature 2022-10-26 23:09:36 +01:00
ccf66dbd50 Merge pull request #1734 from dolanmiu/dependabot/npm_and_yarn/typescript-eslint/eslint-plugin-5.41.0
build(deps-dev): bump @typescript-eslint/eslint-plugin from 5.40.1 to 5.41.0
2022-10-26 10:28:57 +01:00
6e30ab0355 build(deps-dev): bump @typescript-eslint/eslint-plugin
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.40.1 to 5.41.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.41.0/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-25 21:25:52 +00:00
568c764e3c Merge pull request #1729 from dolanmiu/dependabot/npm_and_yarn/typedoc-0.23.18
build(deps-dev): bump typedoc from 0.23.15 to 0.23.18
2022-10-25 22:25:02 +01:00
d508e8ae31 Merge pull request #1730 from dolanmiu/dependabot/npm_and_yarn/eslint-8.26.0
build(deps-dev): bump eslint from 8.25.0 to 8.26.0
2022-10-25 22:24:56 +01:00
ded346e34a Merge pull request #1733 from dolanmiu/dependabot/npm_and_yarn/types/chai-4.3.3
build(deps-dev): bump @types/chai from 4.3.1 to 4.3.3
2022-10-25 22:24:47 +01:00
edb8eddce1 Merge pull request #1735 from dolanmiu/dependabot/npm_and_yarn/typescript-eslint/parser-5.41.0
build(deps-dev): bump @typescript-eslint/parser from 5.40.1 to 5.41.0
2022-10-25 22:24:35 +01:00
abd3641da4 build(deps-dev): bump eslint from 8.25.0 to 8.26.0
Bumps [eslint](https://github.com/eslint/eslint) from 8.25.0 to 8.26.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.25.0...v8.26.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-25 21:01:04 +00:00
7e1165d012 Merge pull request #1737 from dolanmiu/dependabot/npm_and_yarn/types/node-18.11.5
build(deps): bump @types/node from 18.11.2 to 18.11.5
2022-10-25 22:00:44 +01:00
461754e591 build(deps-dev): bump typedoc from 0.23.15 to 0.23.18
Bumps [typedoc](https://github.com/TypeStrong/TypeDoc) from 0.23.15 to 0.23.18.
- [Release notes](https://github.com/TypeStrong/TypeDoc/releases)
- [Changelog](https://github.com/TypeStrong/typedoc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TypeStrong/TypeDoc/compare/v0.23.15...v0.23.18)

---
updated-dependencies:
- dependency-name: typedoc
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-25 21:00:39 +00:00
e649330dbc build(deps-dev): bump @types/chai from 4.3.1 to 4.3.3
Bumps [@types/chai](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/chai) from 4.3.1 to 4.3.3.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/chai)

---
updated-dependencies:
- dependency-name: "@types/chai"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-25 21:00:27 +00:00
baec324811 build(deps-dev): bump @typescript-eslint/parser from 5.40.1 to 5.41.0
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 5.40.1 to 5.41.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.41.0/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-25 21:00:10 +00:00
91c430d9e2 Merge pull request #1739 from dolanmiu/dependabot/npm_and_yarn/eslint-plugin-jsdoc-39.3.25
build(deps-dev): bump eslint-plugin-jsdoc from 39.3.6 to 39.3.25
2022-10-25 21:59:32 +01:00
efd853d519 Merge pull request #1725 from kkocdko/patch-1
Change `globalObject` to `globalThis`
2022-10-25 21:58:07 +01:00
f717b0eae4 build(deps-dev): bump eslint-plugin-jsdoc from 39.3.6 to 39.3.25
Bumps [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) from 39.3.6 to 39.3.25.
- [Release notes](https://github.com/gajus/eslint-plugin-jsdoc/releases)
- [Commits](https://github.com/gajus/eslint-plugin-jsdoc/compare/v39.3.6...v39.3.25)

---
updated-dependencies:
- dependency-name: eslint-plugin-jsdoc
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-25 20:44:04 +00:00
d76d21a1f2 build(deps): bump @types/node from 18.11.2 to 18.11.5
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 18.11.2 to 18.11.5.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-25 20:43:47 +00:00
712450d717 Character style example for underline and strike 2022-10-25 21:29:22 +01:00
b9d93c9d33 Fix declarative styles example 2022-10-25 21:03:59 +01:00
c7ca51cd65 Merge pull request #1738 from dolanmiu/feat/word-wrap
#1529 - Word wrap feature
2022-10-25 20:51:45 +01:00
20b793620a #1720 - Update demo 2 to show underline and strike used together 2022-10-25 19:03:48 +01:00
9bed303d34 #1529 - Word wrap feature 2022-10-25 18:53:00 +01:00
f4ed171f85 Fix demos 2022-10-25 01:13:44 +01:00
8a3ccdb196 Upgrade chai to 4.x 2022-10-25 01:08:54 +01:00
41765d133f Merge pull request #1722 from dolanmiu/dependabot/npm_and_yarn/mocha-10.1.0
build(deps-dev): bump mocha from 10.0.0 to 10.1.0
2022-10-24 23:40:42 +01:00
482ea1b186 Change globalObject to globalThis 2022-10-21 15:40:54 +08:00
3bba7f9d23 build(deps-dev): bump mocha from 10.0.0 to 10.1.0
Bumps [mocha](https://github.com/mochajs/mocha) from 10.0.0 to 10.1.0.
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mochajs/mocha/compare/v10.0.0...v10.1.0)

---
updated-dependencies:
- dependency-name: mocha
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-20 11:04:03 +00:00
7e5e2baf92 Version bump 2022-10-19 21:21:33 +01:00
53c70e6cd1 Merge pull request #1718 from codecnmc/patch-1
Update numbering.md
2022-10-19 20:26:21 +01:00
4bfb87ea74 Merge pull request #1716 from dolanmiu/dependabot/npm_and_yarn/typescript-eslint/parser-5.40.1
build(deps-dev): bump @typescript-eslint/parser from 5.38.1 to 5.40.1
2022-10-19 20:25:47 +01:00
86e12c7d40 Merge pull request #1715 from dolanmiu/dependabot/npm_and_yarn/typescript-eslint/eslint-plugin-5.40.1
build(deps-dev): bump @typescript-eslint/eslint-plugin from 5.38.1 to 5.40.1
2022-10-19 20:25:40 +01:00
eb5449adf8 build(deps-dev): bump @typescript-eslint/parser from 5.38.1 to 5.40.1
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 5.38.1 to 5.40.1.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.40.1/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-19 19:13:25 +00:00
19eeec9fc8 build(deps-dev): bump @typescript-eslint/eslint-plugin
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.38.1 to 5.40.1.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.40.1/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-19 19:13:20 +00:00
449f5f5be3 Merge pull request #1719 from dolanmiu/dependabot/npm_and_yarn/types/node-18.11.2
build(deps): bump @types/node from 18.7.23 to 18.11.2
2022-10-19 20:12:01 +01:00
bc5a1b52b7 Merge pull request #1702 from dolanmiu/dependabot/npm_and_yarn/eslint-8.25.0
build(deps-dev): bump eslint from 8.24.0 to 8.25.0
2022-10-19 20:11:53 +01:00
fc7f37767f Merge pull request #1697 from dolanmiu/dependabot/npm_and_yarn/eslint-plugin-unicorn-44.0.2
build(deps-dev): bump eslint-plugin-unicorn from 44.0.0 to 44.0.2
2022-10-19 20:11:45 +01:00
38dbdd02ae Merge pull request #1692 from dolanmiu/dependabot/npm_and_yarn/sinon-14.0.1
build(deps-dev): bump sinon from 14.0.0 to 14.0.1
2022-10-19 20:11:40 +01:00
7bb3fa74ce Merge pull request #1691 from dolanmiu/dependabot/npm_and_yarn/eslint-plugin-functional-4.4.1
build(deps-dev): bump eslint-plugin-functional from 4.4.0 to 4.4.1
2022-10-19 20:11:35 +01:00
a33660d32c Merge pull request #1686 from dolanmiu/dependabot/npm_and_yarn/types/prompt-1.1.4
build(deps-dev): bump @types/prompt from 1.1.3 to 1.1.4
2022-10-19 20:11:28 +01:00
ef842d1f3f Merge pull request #1709 from ronram5126/master
FIX: multiple tabStop support for LibreWriter
2022-10-19 20:11:03 +01:00
e5c2a0a87b Fix linting and spelling 2022-10-19 19:58:46 +01:00
817ffe8fd0 build(deps): bump @types/node from 18.7.23 to 18.11.2
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 18.7.23 to 18.11.2.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-19 11:01:41 +00:00
5b582d45ba Update numbering.md
Long time to find a way to unident ,See the document can't resolve my problem,Source code analysis found that does not belong to the indent.
2022-10-19 17:35:46 +08:00
6a303532f4 DEMO: 75-tab-stops.ts added missing \t 2022-10-17 14:56:12 +05:45
c75abb7cb9 DEMO: added demo/75-tab-stops.ts 2022-10-17 14:49:32 +05:45
8282d76b87 Merge branch 'dolanmiu:master' into master 2022-10-17 14:25:48 +05:45
79f3866c4c Merge pull request #1700 from tvale1/master
Add MathIntegral class
2022-10-16 00:54:57 +01:00
6dcf3f25e9 Fix test 2022-10-16 00:44:40 +01:00
e80acea63f Add more MathIntegral tests 2022-10-16 00:38:02 +01:00
640639264d Add MathIntegral tests 2022-10-16 00:33:44 +01:00
3ccdd2585c Fix prettier and linting 2022-10-16 00:29:16 +01:00
2c4b55c692 Refactor code to simplify interface 2022-10-16 00:21:34 +01:00
70a3b25d54 Fix Prettier errors 2022-10-16 00:20:16 +01:00
d053baef03 FIX: added legacy support for TabStop 2022-10-14 17:01:41 +05:45
629c586014 FIX: multiple tabStop support for LibreWriter 2022-10-14 16:38:02 +05:45
e4b03b3f71 build(deps-dev): bump eslint from 8.24.0 to 8.25.0
Bumps [eslint](https://github.com/eslint/eslint) from 8.24.0 to 8.25.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.24.0...v8.25.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-10 11:02:11 +00:00
9ab6df99b1 Add MathIntegral class 2022-10-08 12:56:35 +11:00
51519a55ef build(deps-dev): bump eslint-plugin-unicorn from 44.0.0 to 44.0.2
Bumps [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) from 44.0.0 to 44.0.2.
- [Release notes](https://github.com/sindresorhus/eslint-plugin-unicorn/releases)
- [Commits](https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v44.0.0...v44.0.2)

---
updated-dependencies:
- dependency-name: eslint-plugin-unicorn
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-07 11:00:58 +00:00
059455929b Merge pull request #1685 from dolanmiu/dependabot/npm_and_yarn/eslint-plugin-unicorn-44.0.0
build(deps-dev): bump eslint-plugin-unicorn from 43.0.2 to 44.0.0
2022-10-04 15:24:15 +01:00
8a1df4438e build(deps-dev): bump sinon from 14.0.0 to 14.0.1
Bumps [sinon](https://github.com/sinonjs/sinon) from 14.0.0 to 14.0.1.
- [Release notes](https://github.com/sinonjs/sinon/releases)
- [Changelog](https://github.com/sinonjs/sinon/blob/main/docs/changelog.md)
- [Commits](https://github.com/sinonjs/sinon/compare/v14.0.0...v14.0.1)

---
updated-dependencies:
- dependency-name: sinon
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-04 11:03:04 +00:00
cbf6e46e35 build(deps-dev): bump eslint-plugin-functional from 4.4.0 to 4.4.1
Bumps [eslint-plugin-functional](https://github.com/eslint-functional/eslint-plugin-functional) from 4.4.0 to 4.4.1.
- [Release notes](https://github.com/eslint-functional/eslint-plugin-functional/releases)
- [Changelog](https://github.com/eslint-functional/eslint-plugin-functional/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint-functional/eslint-plugin-functional/compare/v4.4.0...v4.4.1)

---
updated-dependencies:
- dependency-name: eslint-plugin-functional
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-04 11:02:30 +00:00
727b1bd63b build(deps-dev): bump @types/prompt from 1.1.3 to 1.1.4
Bumps [@types/prompt](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/prompt) from 1.1.3 to 1.1.4.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/prompt)

---
updated-dependencies:
- dependency-name: "@types/prompt"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-03 11:02:26 +00:00
363b8d74ae build(deps-dev): bump eslint-plugin-unicorn from 43.0.2 to 44.0.0
Bumps [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) from 43.0.2 to 44.0.0.
- [Release notes](https://github.com/sindresorhus/eslint-plugin-unicorn/releases)
- [Commits](https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v43.0.2...v44.0.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-unicorn
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-03 11:01:33 +00:00
b31ecd6583 Merge pull request #1684 from dolanmiu/dependabot/npm_and_yarn/cspell-6.12.0
build(deps-dev): bump cspell from 6.10.1 to 6.12.0
2022-10-03 11:27:15 +01:00
563914a0ef Merge pull request #1682 from dolanmiu/dependabot/npm_and_yarn/typescript-4.8.4
build(deps-dev): bump typescript from 4.8.3 to 4.8.4
2022-10-03 11:27:06 +01:00
1e8adbb240 Merge pull request #1681 from dolanmiu/dependabot/npm_and_yarn/types/mocha-10.0.0
build(deps-dev): bump @types/mocha from 9.1.1 to 10.0.0
2022-10-03 11:26:57 +01:00
4b1f89a561 Merge pull request #1680 from dolanmiu/dependabot/npm_and_yarn/typescript-eslint/eslint-plugin-5.38.1
build(deps-dev): bump @typescript-eslint/eslint-plugin from 5.38.0 to 5.38.1
2022-10-03 11:26:48 +01:00
1a4a0ea5b8 Merge pull request #1679 from dolanmiu/dependabot/npm_and_yarn/types/node-18.7.23
build(deps): bump @types/node from 18.7.18 to 18.7.23
2022-10-03 11:26:39 +01:00
f781028b08 build(deps-dev): bump @typescript-eslint/eslint-plugin
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.38.0 to 5.38.1.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.38.1/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-30 16:50:54 +00:00
56e8ad4f17 build(deps-dev): bump cspell from 6.10.1 to 6.12.0
Bumps [cspell](https://github.com/streetsidesoftware/cspell) from 6.10.1 to 6.12.0.
- [Release notes](https://github.com/streetsidesoftware/cspell/releases)
- [Changelog](https://github.com/streetsidesoftware/cspell/blob/main/CHANGELOG.md)
- [Commits](https://github.com/streetsidesoftware/cspell/compare/v6.10.1...v6.12.0)

---
updated-dependencies:
- dependency-name: cspell
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-30 16:50:37 +00:00
62c34ae612 build(deps-dev): bump typescript from 4.8.3 to 4.8.4
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.8.3 to 4.8.4.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v4.8.3...v4.8.4)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-30 16:50:05 +00:00
26123b0a93 build(deps): bump @types/node from 18.7.18 to 18.7.23
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 18.7.18 to 18.7.23.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-30 16:49:55 +00:00
4023464a13 build(deps-dev): bump @types/mocha from 9.1.1 to 10.0.0
Bumps [@types/mocha](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/mocha) from 9.1.1 to 10.0.0.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/mocha)

---
updated-dependencies:
- dependency-name: "@types/mocha"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-30 16:49:48 +00:00
0c92f354c5 Merge pull request #1678 from dolanmiu/dependabot/npm_and_yarn/typescript-eslint/parser-5.38.1
build(deps-dev): bump @typescript-eslint/parser from 5.38.0 to 5.38.1
2022-09-30 17:48:40 +01:00
676723c8bd build(deps-dev): bump @typescript-eslint/parser from 5.38.0 to 5.38.1
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 5.38.0 to 5.38.1.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.38.1/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-30 15:12:31 +00:00
2f4d5afaea Merge pull request #1676 from dolanmiu/dependabot/npm_and_yarn/eslint-8.24.0
build(deps-dev): bump eslint from 8.23.1 to 8.24.0
2022-09-30 16:10:45 +01:00
d0abceb08d Merge pull request #1677 from hunterwilhelm/patch-1
Added the name horizontal line or horizontal rules
2022-09-30 16:10:30 +01:00
8b165e93e1 Specify which borders could look like a <hr/> 2022-09-28 09:19:18 -06:00
321969eb85 Added the name horizontal line or horizontal rules
There was some confusion in https://github.com/dolanmiu/docx/issues/437 because the docs don't mention anything called horizontal lines or horizontal rules. Microsoft calls them by that name here https://support.microsoft.com/en-us/office/insert-a-line-9bf172f6-5908-4791-9bb9-2c952197b1a9
This will make it easier for people to find this in the docs.
2022-09-26 10:22:32 -06:00
85ec90849e build(deps-dev): bump eslint from 8.23.1 to 8.24.0
Bumps [eslint](https://github.com/eslint/eslint) from 8.23.1 to 8.24.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.23.1...v8.24.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-26 11:01:39 +00:00
96451bc5b7 Merge pull request #1669 from dolanmiu/dependabot/npm_and_yarn/eslint-8.23.1
build(deps-dev): bump eslint from 8.23.0 to 8.23.1
2022-09-25 09:57:01 +01:00
311cbf55ef Merge pull request #1670 from dolanmiu/dependabot/npm_and_yarn/eslint-plugin-functional-4.4.0
build(deps-dev): bump eslint-plugin-functional from 4.3.1 to 4.4.0
2022-09-25 09:56:54 +01:00
0258b256f2 Merge pull request #1671 from dolanmiu/dependabot/npm_and_yarn/typescript-eslint/parser-5.38.0
build(deps-dev): bump @typescript-eslint/parser from 5.36.1 to 5.38.0
2022-09-25 09:56:47 +01:00
c615de97c4 Merge pull request #1672 from dolanmiu/dependabot/npm_and_yarn/typescript-eslint/eslint-plugin-5.38.0
build(deps-dev): bump @typescript-eslint/eslint-plugin from 5.36.1 to 5.38.0
2022-09-25 09:56:39 +01:00
e29a7bf146 build(deps-dev): bump @typescript-eslint/eslint-plugin
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.36.1 to 5.38.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.38.0/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-22 11:02:29 +00:00
b665c243f0 build(deps-dev): bump @typescript-eslint/parser from 5.36.1 to 5.38.0
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 5.36.1 to 5.38.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.38.0/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-22 11:01:59 +00:00
bea1c9ed61 build(deps-dev): bump eslint-plugin-functional from 4.3.1 to 4.4.0
Bumps [eslint-plugin-functional](https://github.com/eslint-functional/eslint-plugin-functional) from 4.3.1 to 4.4.0.
- [Release notes](https://github.com/eslint-functional/eslint-plugin-functional/releases)
- [Changelog](https://github.com/eslint-functional/eslint-plugin-functional/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint-functional/eslint-plugin-functional/compare/v4.3.1...v4.4.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-functional
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-22 11:01:40 +00:00
0e6bdaa9c9 build(deps-dev): bump eslint from 8.23.0 to 8.23.1
Bumps [eslint](https://github.com/eslint/eslint) from 8.23.0 to 8.23.1.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.23.0...v8.23.1)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-22 11:01:19 +00:00
7925689618 Merge pull request #1652 from dolanmiu/dependabot/npm_and_yarn/typescript-4.8.3
build(deps-dev): bump typescript from 4.7.4 to 4.8.3
2022-09-22 09:27:39 +01:00
791441ec86 build(deps-dev): bump typescript from 4.7.4 to 4.8.3
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.7.4 to 4.8.3.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v4.7.4...v4.8.3)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-22 08:14:04 +00:00
95 changed files with 6941 additions and 2401 deletions

View File

@ -689,3 +689,30 @@ jobs:
with:
xml-file: build/extracted-doc/word/document.xml
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
- name: Run Demo
run: npm run ts-node -- ./demo/72-word-wrap.ts
- name: Extract Word Document
run: npm run extract
- name: Validate XML
uses: ChristophWurst/xmllint-action@v1
with:
xml-file: build/extracted-doc/word/document.xml
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
- name: Run Demo
run: npm run ts-node -- ./demo/73-comments.ts
- name: Extract Word Document
run: npm run extract
- name: Validate XML
uses: ChristophWurst/xmllint-action@v1
with:
xml-file: build/extracted-doc/word/document.xml
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
- name: Run Demo
run: npm run ts-node -- ./demo/73-comments.ts
- name: Extract Word Document
run: npm run extract
- name: Validate XML
uses: ChristophWurst/xmllint-action@v1
with:
xml-file: build/extracted-doc/word/document.xml
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd

1
.npmrc Normal file
View File

@ -0,0 +1 @@
registry=https://registry.npmjs.org/

8
.nycrc
View File

@ -1,9 +1,9 @@
{
"check-coverage": true,
"statements": 99.72,
"branches": 97.95,
"functions": 99.82,
"lines": 99.71,
"statements": 99.79,
"branches": 98.41,
"functions": 100,
"lines": 99.73,
"include": [
"src/**/*.ts"
],

View File

@ -29,11 +29,12 @@ Here are examples of `docx` being used with basic `HTML/JS` in a browser environ
- https://codepen.io/dolanmiu/pen/RwNeObg
- https://jsfiddle.net/dolanmiu/onadx1gu/
Here is an example of `docx` working in `Angular`:
Here are examples of `docx` working in `Angular`:
- https://stackblitz.com/edit/angular-docx
- https://stackblitz.com/edit/angular-wmd6k3
Here is an example of `docx` working in `React`:
Here are examples of `docx` working in `React`:
- https://stackblitz.com/edit/react-docx
- https://stackblitz.com/edit/react-docx-images (adding images to Word Document)

View File

@ -1,7 +1,7 @@
// Simple example to add text to a document
// Import from 'docx' rather than '../build' if you install from npm
import * as fs from "fs";
import { Document, Packer, Paragraph, TextRun } from "../build";
import { Document, Packer, Paragraph, Tab, TextRun } from "../build";
const doc = new Document({
sections: [
@ -14,9 +14,10 @@ const doc = new Document({
new TextRun({
text: "Foo Bar",
bold: true,
size: 40,
}),
new TextRun({
text: "\tGithub is the best",
children: [new Tab(), "Github is the best"],
bold: true,
}),
],

View File

@ -1,7 +1,7 @@
// Generate a CV
// Import from 'docx' rather than '../build' if you install from npm
import * as fs from "fs";
import { AlignmentType, Document, HeadingLevel, Packer, Paragraph, TabStopPosition, TabStopType, TextRun } from "../build";
import { AlignmentType, Document, HeadingLevel, Packer, Paragraph, Tab, TabStopPosition, TabStopType, TextRun } from "../build";
// tslint:disable:no-shadowed-variable
@ -284,7 +284,7 @@ class DocumentCreator {
bold: true,
}),
new TextRun({
text: `\t${dateText}`,
children: [new Tab(), dateText],
bold: true,
}),
],

View File

@ -1,7 +1,7 @@
// Export to base64 string - Useful in a browser environment.
// Import from 'docx' rather than '../build' if you install from npm
import * as fs from "fs";
import { Document, Packer, Paragraph, TextRun } from "../build";
import { Document, Packer, Paragraph, Tab, TextRun } from "../build";
const doc = new Document({
sections: [
@ -15,7 +15,7 @@ const doc = new Document({
bold: true,
}),
new TextRun({
text: "\tBar",
children: [new Tab(), "Bar"],
bold: true,
}),
],

View File

@ -82,6 +82,32 @@ const doc = new Document({
spacing: { line: 276, before: 20 * 72 * 0.1, after: 20 * 72 * 0.05 },
},
},
{
id: "strikeUnderline",
name: "Strike Underline",
basedOn: "Normal",
quickFormat: true,
run: {
strike: true,
underline: {
type: UnderlineType.SINGLE,
},
},
},
],
characterStyles: [
{
id: "strikeUnderlineCharacter",
name: "Strike Underline",
basedOn: "Normal",
quickFormat: true,
run: {
strike: true,
underline: {
type: UnderlineType.SINGLE,
},
},
},
],
},
numbering: {
@ -169,6 +195,14 @@ const doc = new Document({
new TextRun({
text: "and back to normal.",
}),
new TextRun({
text: "This text will be invisible!",
vanish: true,
}),
new TextRun({
text: "This text will be VERY invisible! Word processors cannot override this!",
specVanish: true,
}),
],
}),
new Paragraph({
@ -182,6 +216,49 @@ const doc = new Document({
}),
],
}),
new Paragraph({
style: "strikeUnderline",
children: [
new TextRun({
text: "Underline and Strike",
}),
new TextRun({
text: " Override Underline ",
underline: {
type: UnderlineType.NONE,
},
}),
new TextRun({
text: "Strike and Underline",
}),
],
}),
new Paragraph({
children: [
new TextRun({
text: "Hello World ",
}),
new TextRun({
style: "strikeUnderlineCharacter",
text: "Underline and Strike",
}),
new TextRun({
text: " Another Hello World",
}),
new TextRun({
scale: 50,
text: " Scaled text",
}),
],
}),
new Paragraph({
scale: 200,
children: [
new TextRun({
text: "Scaled paragraph",
}),
],
}),
],
},
],

View File

@ -1,7 +1,7 @@
// Example of making content of section vertically aligned
// Import from 'docx' rather than '../build' if you install from npm
import * as fs from "fs";
import { Document, Packer, Paragraph, VerticalAlign, TextRun } from "../build";
import { Document, Packer, Paragraph, VerticalAlign, TextRun, Tab } from "../build";
const doc = new Document({
sections: [
@ -18,7 +18,7 @@ const doc = new Document({
bold: true,
}),
new TextRun({
text: "\tGithub is the best",
children: [new Tab(), "Github is the best"],
bold: true,
}),
],

View File

@ -25,6 +25,11 @@ const doc = new Document({
width: 100,
height: 100,
},
altText: {
title: "This is an ultimate title",
description: "This is an ultimate image",
name: "My Ultimate Image",
},
}),
],
}),

View File

@ -16,6 +16,7 @@ import {
MathSubScript,
MathSubSuperScript,
MathSum,
MathIntegral,
MathSuperScript,
Packer,
Paragraph,
@ -90,6 +91,35 @@ const doc = new Document({
}),
],
}),
new Paragraph({
children: [
new Math({
children: [
new MathIntegral({
children: [new MathRun("test")],
}),
new MathIntegral({
children: [
new MathSuperScript({
children: [new MathRun("e")],
superScript: [new MathRun("2")],
}),
],
subScript: [new MathRun("i")],
}),
new MathIntegral({
children: [
new MathRadical({
children: [new MathRun("i")],
}),
],
subScript: [new MathRun("i")],
superScript: [new MathRun("10")],
}),
],
}),
],
}),
new Paragraph({
children: [
new Math({

View File

@ -1,7 +1,7 @@
// Change background colour of whole document
// Import from 'docx' rather than '../build' if you install from npm
import * as fs from "fs";
import { Document, Packer, Paragraph, TextRun } from "../build";
import { Document, Packer, Paragraph, Tab, TextRun } from "../build";
const doc = new Document({
background: {
@ -19,7 +19,7 @@ const doc = new Document({
bold: true,
}),
new TextRun({
text: "\tGithub is the best",
children: [new Tab(), "Github is the best"],
bold: true,
}),
],

View File

@ -1,7 +1,7 @@
// Example of how to change page borders
// Import from 'docx' rather than '../build' if you install from npm
import * as fs from "fs";
import { Document, HeadingLevel, Packer, Paragraph, TextRun } from "../build";
import { Document, HeadingLevel, Packer, Paragraph, Tab, TextRun } from "../build";
const doc = new Document({
sections: [
@ -25,7 +25,7 @@ const doc = new Document({
bold: true,
}),
new TextRun({
text: "\tGithub is the best",
children: [new Tab(), "Github is the best"],
bold: true,
}),
],

View File

@ -12,6 +12,7 @@ import {
PageNumber,
Paragraph,
ShadingType,
Tab,
TextRun,
} from "../build";
@ -111,7 +112,7 @@ const doc = new Document({
}),
new TextRun({
bold: true,
children: ["\tuse Inserted and Deleted TextRuns.", new FootnoteReferenceRun(1)],
children: [new Tab(), "use Inserted and Deleted TextRuns.", new FootnoteReferenceRun(1)],
}),
new TextRun({
bold: true,

View File

@ -8,6 +8,7 @@ import {
HorizontalPositionAlign,
Packer,
Paragraph,
Tab,
TextRun,
VerticalPositionAlign,
} from "../build";
@ -67,7 +68,7 @@ const doc = new Document({
bold: true,
}),
new TextRun({
text: "\tGithub is the best",
children: [new Tab(), "Github is the best"],
bold: true,
}),
],

View File

@ -7,12 +7,31 @@ const doc = new Document({
sections: [
{
children: [
new Paragraph({
wordWrap: true,
children: [
new TextRun("我今天遛狗去公园"),
new TextRun({
text: "456435234523456435564745673456345456435234523456435564745673456345456435234523456435564745673456345456435234523456435564745673456345456435234523456435564745673456345",
}),
],
}),
new Paragraph({
wordWrap: true,
children: [
new TextRun(
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua",
),
new TextRun({
text: "456435234523456435564745673456345456435234523456435564745673456345456435234523456435564745673456345456435234523456435564745673456345456435234523456435564745673456345",
}),
],
}),
new Paragraph({
children: [
new TextRun("我今天遛狗去公园"),
new TextRun({
text: "456435234523456435564745673456345456435234523456435564745673456345456435234523456435564745673456345456435234523456435564745673456345456435234523456435564745673456345",
space: SpaceType.PRESERVE,
}),
],
}),
@ -23,7 +42,6 @@ const doc = new Document({
),
new TextRun({
text: "456435234523456435564745673456345456435234523456435564745673456345456435234523456435564745673456345456435234523456435564745673456345456435234523456435564745673456345",
space: SpaceType.PRESERVE,
}),
],
}),

View File

@ -1,7 +1,7 @@
// Exporting the document as a stream
// Import from 'docx' rather than '../build' if you install from npm
import * as fs from "fs";
import { Document, Packer, Paragraph, TextRun } from "../build";
import { Document, Packer, Paragraph, Tab, TextRun } from "../build";
const doc = new Document({
sections: [
@ -16,7 +16,7 @@ const doc = new Document({
bold: true,
}),
new TextRun({
text: "\tGithub is the best",
children: [new Tab(), "Github is the best"],
bold: true,
}),
],

80
demo/75-tab-stops.ts Normal file
View File

@ -0,0 +1,80 @@
// Exporting the document as a stream
// Import from 'docx' rather than '../build' if you install from npm
import * as fs from "fs";
import { Document, HeadingLevel, Packer, Paragraph, TabStopPosition, TabStopType, TextRun } from "../build";
const columnWidth = TabStopPosition.MAX / 4;
const receiptTabStops = [
// no need to define first left tab column
// the right aligned tab column position should point to the end of column
// i.e. in this case
// (end position of 1st) + (end position of current)
// columnWidth + columnWidth = columnWidth * 2
{ type: TabStopType.RIGHT, position: columnWidth * 2 },
{ type: TabStopType.RIGHT, position: columnWidth * 3 },
{ type: TabStopType.RIGHT, position: TabStopPosition.MAX },
],
twoTabStops = [{ type: TabStopType.RIGHT, position: TabStopPosition.MAX }];
const doc = new Document({
sections: [
{
properties: {},
children: [
new Paragraph({
heading: HeadingLevel.HEADING_1,
children: [new TextRun("Receipt 001")],
}),
new Paragraph({
tabStops: twoTabStops,
children: [
new TextRun({
text: "To Bob.\tBy Alice.",
bold: true,
}),
],
}),
new Paragraph({
tabStops: twoTabStops,
children: [new TextRun("Foo Inc\tBar Inc")],
}),
new Paragraph({ text: "" }),
new Paragraph({
tabStops: receiptTabStops,
children: [
new TextRun({
text: "Item\tPrice\tQuantity\tSub-total",
bold: true,
}),
],
}),
new Paragraph({
tabStops: receiptTabStops,
text: "Item 3\t10\t5\t50",
}),
new Paragraph({
tabStops: receiptTabStops,
text: "Item 3\t10\t5\t50",
}),
new Paragraph({
tabStops: receiptTabStops,
text: "Item 3\t10\t5\t50",
}),
new Paragraph({
tabStops: receiptTabStops,
children: [
new TextRun({
text: "\t\t\tTotal: 200",
bold: true,
}),
],
}),
],
},
],
});
const stream = Packer.toStream(doc);
stream.pipe(fs.createWriteStream("My Document.docx"));

87
demo/76-compatibility.ts Normal file
View File

@ -0,0 +1,87 @@
// Add compatibility options
// Import from 'docx' rather than '../build' if you install from npm
import * as fs from "fs";
import { Document, Packer, Paragraph, TextRun } from "../build";
const doc = new Document({
compatibility: {
useSingleBorderforContiguousCells: true,
wordPerfectJustification: true,
noTabStopForHangingIndent: true,
noLeading: true,
spaceForUnderline: true,
noColumnBalance: true,
balanceSingleByteDoubleByteWidth: true,
noExtraLineSpacing: true,
doNotLeaveBackslashAlone: true,
underlineTrailingSpaces: true,
doNotExpandShiftReturn: true,
spacingInWholePoints: true,
lineWrapLikeWord6: true,
printBodyTextBeforeHeader: true,
printColorsBlack: true,
spaceWidth: true,
showBreaksInFrames: true,
subFontBySize: true,
suppressBottomSpacing: true,
suppressTopSpacing: true,
suppressSpacingAtTopOfPage: true,
suppressTopSpacingWP: true,
suppressSpBfAfterPgBrk: true,
swapBordersFacingPages: true,
convertMailMergeEsc: true,
truncateFontHeightsLikeWP6: true,
macWordSmallCaps: true,
usePrinterMetrics: true,
doNotSuppressParagraphBorders: true,
wrapTrailSpaces: true,
footnoteLayoutLikeWW8: true,
shapeLayoutLikeWW8: true,
alignTablesRowByRow: true,
forgetLastTabAlignment: true,
adjustLineHeightInTable: true,
autoSpaceLikeWord95: true,
noSpaceRaiseLower: true,
doNotUseHTMLParagraphAutoSpacing: true,
layoutRawTableWidth: true,
layoutTableRowsApart: true,
useWord97LineBreakRules: true,
doNotBreakWrappedTables: true,
doNotSnapToGridInCell: true,
selectFieldWithFirstOrLastCharacter: true,
applyBreakingRules: true,
doNotWrapTextWithPunctuation: true,
doNotUseEastAsianBreakRules: true,
useWord2002TableStyleRules: true,
growAutofit: true,
useFELayout: true,
useNormalStyleForList: true,
doNotUseIndentAsNumberingTabStop: true,
useAlternateEastAsianLineBreakRules: true,
allowSpaceOfSameStyleInTable: true,
doNotSuppressIndentation: true,
doNotAutofitConstrainedTables: true,
autofitToFirstFixedWidthCell: true,
underlineTabInNumberingList: true,
displayHangulFixedWidth: true,
splitPgBreakAndParaMark: true,
doNotVerticallyAlignCellWithSp: true,
doNotBreakConstrainedForcedTable: true,
ignoreVerticalAlignmentInTextboxes: true,
useAnsiKerningPairs: true,
cachedColumnBalance: true,
},
sections: [
{
children: [
new Paragraph({
children: [new TextRun("Hello World")],
}),
],
},
],
});
Packer.toBuffer(doc).then((buffer) => {
fs.writeFileSync("My Document.docx", buffer);
});

View File

@ -0,0 +1,116 @@
// Exporting the document as a stream
// Import from 'docx' rather than '../build' if you install from npm
import * as fs from "fs";
import { Document, Packer, Paragraph, Table, TableBorders, TableCell, TableRow, WidthType } from "../build";
const table1 = new Table({
columnWidths: [3505, 5505],
rows: [
new TableRow({
children: [
new TableCell({
width: {
size: 3505,
type: WidthType.DXA,
},
children: [new Paragraph("Hello")],
}),
new TableCell({
width: {
size: 5505,
type: WidthType.DXA,
},
children: [],
}),
],
}),
new TableRow({
children: [
new TableCell({
width: {
size: 3505,
type: WidthType.DXA,
},
children: [],
}),
new TableCell({
width: {
size: 5505,
type: WidthType.DXA,
},
children: [new Paragraph("World")],
}),
],
}),
],
});
const table2 = new Table({
columnWidths: [3505, 5505],
rows: [
new TableRow({
children: [
new TableCell({
width: {
size: 3505,
type: WidthType.DXA,
},
children: [new Paragraph("Foo")],
}),
new TableCell({
width: {
size: 5505,
type: WidthType.DXA,
},
children: [],
}),
],
}),
new TableRow({
children: [
new TableCell({
width: {
size: 3505,
type: WidthType.DXA,
},
children: [],
}),
new TableCell({
width: {
size: 5505,
type: WidthType.DXA,
},
children: [new Paragraph("Bar")],
}),
],
}),
],
});
const noBorderTable = new Table({
borders: TableBorders.NONE,
rows: [
new TableRow({
children: [
new TableCell({
children: [table1],
}),
new TableCell({
children: [table2],
}),
],
}),
],
});
const doc = new Document({
sections: [
{
properties: {},
children: [noBorderTable],
},
],
});
const stream = Packer.toStream(doc);
stream.pipe(fs.createWriteStream("My Document.docx"));

View File

@ -0,0 +1,27 @@
// Simple example to add text to a document
// Import from 'docx' rather than '../build' if you install from npm
import * as fs from "fs";
import { AlignmentType, Document, Packer, Paragraph, TextRun } from "../build";
const doc = new Document({
sections: [
{
properties: {},
children: [
new Paragraph({
alignment: AlignmentType.THAI_DISTRIBUTE,
children: [
new TextRun({
text: "บริษัท บิสกิด จำกัด (บริษัทฯ) ได้จดทะเบียนจัดตั้งขึ้นเป็นบริษัทจำกัดตามประมวลกฎหมายแพ่งและพาณิชย์ของประเทศไทย เมื่อวันที่ 30 พฤษภาคม 2561 ทะเบียนนิติบุคคลเลขที่ 0845561005665",
size: 36,
}),
],
}),
],
},
],
});
Packer.toBuffer(doc).then((buffer) => {
fs.writeFileSync("My Document.docx", buffer);
});

View File

@ -0,0 +1,193 @@
// Example of how you would create a table and add data to it from a data source
// Import from 'docx' rather than '../build' if you install from npm
import * as fs from "fs";
import {
Document,
HeadingLevel,
Packer,
Paragraph,
Table,
TableCell,
TableRow,
VerticalAlign,
TextDirection,
TextRun,
WidthType,
} from "../build";
interface StockPrice {
readonly date: Date;
readonly ticker: string;
readonly price: number;
}
const DATA: StockPrice[] = [
{
date: new Date("2007-08-28"),
ticker: "Apple",
price: 18.12,
},
{
date: new Date("2007-08-29"),
ticker: "Apple",
price: 19.15,
},
{
date: new Date("2007-08-30"),
ticker: "Apple",
price: 19.46,
},
{
date: new Date("2007-08-31"),
ticker: "Apple",
price: 19.78,
},
{
date: new Date("2007-09-04"),
ticker: "Apple",
price: 20.59,
},
{
date: new Date("2007-09-05"),
ticker: "Apple",
price: 19.54,
},
{
date: new Date("2007-09-06"),
ticker: "Apple",
price: 19.29,
},
{
date: new Date("2007-09-07"),
ticker: "Apple",
price: 18.82,
},
{
date: new Date("2007-09-10"),
ticker: "Apple",
price: 19.53,
},
{
date: new Date("2007-09-11"),
ticker: "Apple",
price: 19.36,
},
{
date: new Date("2007-09-12"),
ticker: "Apple",
price: 19.55,
},
{
date: new Date("2007-09-13"),
ticker: "Apple",
price: 19.6,
},
{
date: new Date("2007-09-14"),
ticker: "Apple",
price: 19.83,
},
{
date: new Date("2007-09-17"),
ticker: "Apple",
price: 19.77,
},
];
const generateRows = (prices: StockPrice[]): TableRow[] =>
prices.map(
({ date, ticker, price }) =>
new TableRow({
children: [
new TableCell({
children: [new Paragraph(date.toString())],
verticalAlign: VerticalAlign.CENTER,
textDirection: TextDirection.LEFT_TO_RIGHT_TOP_TO_BOTTOM,
}),
new TableCell({
children: [new Paragraph(ticker)],
verticalAlign: VerticalAlign.CENTER,
textDirection: TextDirection.LEFT_TO_RIGHT_TOP_TO_BOTTOM,
}),
new TableCell({
children: [new Paragraph(price.toString())],
verticalAlign: VerticalAlign.CENTER,
textDirection: TextDirection.TOP_TO_BOTTOM_RIGHT_TO_LEFT,
}),
],
}),
);
const doc = new Document({
sections: [
{
children: [
new Table({
width: {
size: 9070,
type: WidthType.DXA,
},
rows: [
new TableRow({
children: [
new TableCell({
children: [
new Paragraph({
heading: HeadingLevel.HEADING_2,
children: [
new TextRun({
text: "Date",
bold: true,
size: 40,
}),
],
}),
],
verticalAlign: VerticalAlign.CENTER,
textDirection: TextDirection.LEFT_TO_RIGHT_TOP_TO_BOTTOM,
}),
new TableCell({
children: [
new Paragraph({
heading: HeadingLevel.HEADING_2,
children: [
new TextRun({
text: "Ticker",
bold: true,
size: 40,
}),
],
}),
],
verticalAlign: VerticalAlign.CENTER,
textDirection: TextDirection.LEFT_TO_RIGHT_TOP_TO_BOTTOM,
}),
new TableCell({
children: [
new Paragraph({
heading: HeadingLevel.HEADING_2,
children: [
new TextRun({
text: "Price",
bold: true,
size: 40,
}),
],
}),
],
verticalAlign: VerticalAlign.CENTER,
textDirection: TextDirection.TOP_TO_BOTTOM_RIGHT_TO_LEFT,
}),
],
}),
...generateRows(DATA),
],
}),
],
},
],
});
Packer.toBuffer(doc).then((buffer) => {
fs.writeFileSync("My Document.docx", buffer);
});

View File

@ -0,0 +1,49 @@
// Simple example to add text to a document
// Import from 'docx' rather than '../build' if you install from npm
import * as fs from "fs";
import { AlignmentType, convertMillimetersToTwip, Document, Packer, Paragraph, TextRun } from "../build";
const doc = new Document({
styles: {
paragraphStyles: [
{
id: "test",
name: "Test",
basedOn: "Normal",
next: "Normal",
paragraph: {
indent: { left: convertMillimetersToTwip(6.4) },
},
},
],
},
sections: [
{
properties: {
page: {
margin: {
top: 0,
right: convertMillimetersToTwip(24),
bottom: convertMillimetersToTwip(24),
left: convertMillimetersToTwip(24),
},
},
},
children: [
new Paragraph({
alignment: AlignmentType.THAI_DISTRIBUTE,
children: [
new TextRun({
text: "บริษัทฯ มีเงินสด 41,985.00 บาท และ 25,855.66 บาทตามลำดับ เงินสดทั้งจำนวนอยู่ในความดูแลและรับผิดชอบของกรรมการ บริษัทฯบันทึกการรับชำระเงินและการจ่ายชำระเงินผ่านบัญชีเงินสดเพียงเท่านั้น ซึ่งอาจกระทบต่อความถูกต้องครบถ้วนของการบันทึกบัญชี ทั้งนี้ขึ้นอยู่กับระบบการควบคุมภายในของบริษัท",
size: 28,
}),
],
}),
],
},
],
});
Packer.toBuffer(doc).then((buffer) => {
fs.writeFileSync("My Document.docx", buffer);
});

View File

@ -24,7 +24,7 @@
bold: true,
}),
new docx.TextRun({
text: "\tGithub is the best",
children: [new docx.Tab(), "Github is the best"],
bold: true,
}),
],

View File

@ -11,8 +11,10 @@
- [Document](usage/document.md)
- [Sections](usage/sections.md)
- [Paragraph](usage/paragraph.md)
- [Text Frames](usage/text-frames.md)
- [Symbols](usage/symbols.md)
- [Text](usage/text.md)
- [Image](usage/images.md)
- [Images](usage/images.md)
- [Headers & Footers](usage/headers-and-footers.md)
- [Bullet Points](usage/bullet-points.md)
- [Hyperlinks](usage/hyperlinks.md)
@ -23,10 +25,12 @@
- [Page Numbers](usage/page-numbers.md)
- [Change Tracking](usage/change-tracking.md)
- [Math](usage/math.md)
- [Text Frames](usage/text-frames.md)
- [Comments](usage/comments.md)
- [Footnotes](usage/footnotes.md)
- [Fields](usage/fields.md)
- Styling
_ [Styling with JS](usage/styling-with-js.md)
_ [Styling with XML](usage/styling-with-xml.md)
- [Styling with JS](usage/styling-with-js.md)
- [Styling with XML](usage/styling-with-xml.md)
- Exporting

View File

@ -22,20 +22,19 @@ const doc = new docx.Document({
### Full list of options:
* creator
* description
* title
* subject
* keywords
* lastModifiedBy
* revision
* externalStyles
* styles
* numbering
* footnotes
* hyperlinks
* background
- creator
- description
- title
- subject
- keywords
- lastModifiedBy
- revision
- externalStyles
- styles
- numbering
- footnotes
- hyperlinks
- background
### Change background color of Document
@ -55,3 +54,87 @@ You can mix and match whatever properties you want, or provide no properties.
Various parts of the API require positioning arguments. The units are "20ths of a point" from the [OOXML](http://officeopenxml.com/index.php) specification.
See [Lars Corneliussen's blog post](https://startbigthinksmall.wordpress.com/2010/01/04/points-inches-and-emus-measuring-units-in-office-open-xml/) for more information and how to convert units.
## Compatibility
Compatibility Settings are optional settings used to preserve visual fidelity of documents created in earlier word processing applications. Some of these settings provide ability for specific behaviors, described in detail below; and others simply instruct applications to mimic the behavior of an existing word processing application.
```ts
const doc = new docx.Document({
compatibility: {
version: 15,
doNotExpandShiftReturn: true,
},
});
```
### Compatibility Options
| Property | Type | Notes | Possible Values |
| ----------------------------------- | --------- | -------- | ---------------------------- |
| version | `number` | Optional | `15`, `16`, `17` |
| useSingleBorderforContiguousCells | `boolean` | Optional | `true`, `false`, `undefined` |
| wordPerfectJustification | `boolean` | Optional | `true`, `false`, `undefined` |
| noTabStopForHangingIndent | `boolean` | Optional | `true`, `false`, `undefined` |
| noLeading | `boolean` | Optional | `true`, `false`, `undefined` |
| spaceForUnderline | `boolean` | Optional | `true`, `false`, `undefined` |
| noColumnBalance | `boolean` | Optional | `true`, `false`, `undefined` |
| balanceSingleByteDoubleByteWidth | `boolean` | Optional | `true`, `false`, `undefined` |
| noExtraLineSpacing | `boolean` | Optional | `true`, `false`, `undefined` |
| doNotLeaveBackslashAlone | `boolean` | Optional | `true`, `false`, `undefined` |
| underlineTrailingSpaces | `boolean` | Optional | `true`, `false`, `undefined` |
| doNotExpandShiftReturn | `boolean` | Optional | `true`, `false`, `undefined` |
| spacingInWholePoints | `boolean` | Optional | `true`, `false`, `undefined` |
| lineWrapLikeWord6 | `boolean` | Optional | `true`, `false`, `undefined` |
| printBodyTextBeforeHeader | `boolean` | Optional | `true`, `false`, `undefined` |
| printColorsBlack | `boolean` | Optional | `true`, `false`, `undefined` |
| spaceWidth | `boolean` | Optional | `true`, `false`, `undefined` |
| showBreaksInFrames | `boolean` | Optional | `true`, `false`, `undefined` |
| subFontBySize | `boolean` | Optional | `true`, `false`, `undefined` |
| suppressBottomSpacing | `boolean` | Optional | `true`, `false`, `undefined` |
| suppressTopSpacing | `boolean` | Optional | `true`, `false`, `undefined` |
| suppressSpacingAtTopOfPage | `boolean` | Optional | `true`, `false`, `undefined` |
| suppressTopSpacingWP | `boolean` | Optional | `true`, `false`, `undefined` |
| suppressSpBfAfterPgBrk | `boolean` | Optional | `true`, `false`, `undefined` |
| swapBordersFacingPages | `boolean` | Optional | `true`, `false`, `undefined` |
| convertMailMergeEsc | `boolean` | Optional | `true`, `false`, `undefined` |
| truncateFontHeightsLikeWP6 | `boolean` | Optional | `true`, `false`, `undefined` |
| macWordSmallCaps | `boolean` | Optional | `true`, `false`, `undefined` |
| usePrinterMetrics | `boolean` | Optional | `true`, `false`, `undefined` |
| doNotSuppressParagraphBorders | `boolean` | Optional | `true`, `false`, `undefined` |
| wrapTrailSpaces | `boolean` | Optional | `true`, `false`, `undefined` |
| footnoteLayoutLikeWW8 | `boolean` | Optional | `true`, `false`, `undefined` |
| shapeLayoutLikeWW8 | `boolean` | Optional | `true`, `false`, `undefined` |
| alignTablesRowByRow | `boolean` | Optional | `true`, `false`, `undefined` |
| forgetLastTabAlignment | `boolean` | Optional | `true`, `false`, `undefined` |
| adjustLineHeightInTable | `boolean` | Optional | `true`, `false`, `undefined` |
| autoSpaceLikeWord95 | `boolean` | Optional | `true`, `false`, `undefined` |
| noSpaceRaiseLower | `boolean` | Optional | `true`, `false`, `undefined` |
| doNotUseHTMLParagraphAutoSpacing | `boolean` | Optional | `true`, `false`, `undefined` |
| layoutRawTableWidth | `boolean` | Optional | `true`, `false`, `undefined` |
| layoutTableRowsApart | `boolean` | Optional | `true`, `false`, `undefined` |
| useWord97LineBreakRules | `boolean` | Optional | `true`, `false`, `undefined` |
| doNotBreakWrappedTables | `boolean` | Optional | `true`, `false`, `undefined` |
| doNotSnapToGridInCell | `boolean` | Optional | `true`, `false`, `undefined` |
| selectFieldWithFirstOrLastCharacter | `boolean` | Optional | `true`, `false`, `undefined` |
| applyBreakingRules | `boolean` | Optional | `true`, `false`, `undefined` |
| doNotWrapTextWithPunctuation | `boolean` | Optional | `true`, `false`, `undefined` |
| doNotUseEastAsianBreakRules | `boolean` | Optional | `true`, `false`, `undefined` |
| useWord2002TableStyleRules | `boolean` | Optional | `true`, `false`, `undefined` |
| growAutofit | `boolean` | Optional | `true`, `false`, `undefined` |
| useFELayout | `boolean` | Optional | `true`, `false`, `undefined` |
| useNormalStyleForList | `boolean` | Optional | `true`, `false`, `undefined` |
| doNotUseIndentAsNumberingTabStop | `boolean` | Optional | `true`, `false`, `undefined` |
| useAlternateEastAsianLineBreakRules | `boolean` | Optional | `true`, `false`, `undefined` |
| allowSpaceOfSameStyleInTable | `boolean` | Optional | `true`, `false`, `undefined` |
| doNotSuppressIndentation | `boolean` | Optional | `true`, `false`, `undefined` |
| doNotAutofitConstrainedTables | `boolean` | Optional | `true`, `false`, `undefined` |
| autofitToFirstFixedWidthCell | `boolean` | Optional | `true`, `false`, `undefined` |
| underlineTabInNumberingList | `boolean` | Optional | `true`, `false`, `undefined` |
| displayHangulFixedWidth | `boolean` | Optional | `true`, `false`, `undefined` |
| splitPgBreakAndParaMark | `boolean` | Optional | `true`, `false`, `undefined` |
| doNotVerticallyAlignCellWithSp | `boolean` | Optional | `true`, `false`, `undefined` |
| doNotBreakConstrainedForcedTable | `boolean` | Optional | `true`, `false`, `undefined` |
| ignoreVerticalAlignmentInTextboxes | `boolean` | Optional | `true`, `false`, `undefined` |
| useAnsiKerningPairs | `boolean` | Optional | `true`, `false`, `undefined` |
| cachedColumnBalance | `boolean` | Optional | `true`, `false`, `undefined` |

View File

@ -252,13 +252,36 @@ const image = new ImageRun({
});
```
## Alternative Text
Specifies common non-visual DrawingML properties. A name, title and description for a picture can be specified.
```ts
const image = new ImageRun({
data: fs.readFileSync("./demo/images/pizza.gif"),
altText: {
title: "This is an ultimate title",
description: "This is an ultimate image",
name: "My Ultimate Image",
},
});
```
### Options
| Property | Type | Notes | Possible Values |
| ----------- | -------- | -------- | ------------------------------------ |
| name | `string` | Required | `Specimen A` |
| title | `string` | Required | `My awesome title of my image` |
| description | `string` | Required | `My awesome description of my image` |
## Examples
### Add image to the document
Importing Images from file system path
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/5-images.ts ':include')
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/5-images.ts ":include")
_Source: https://github.com/dolanmiu/docx/blob/master/demo/5-images.ts_
@ -266,7 +289,7 @@ _Source: https://github.com/dolanmiu/docx/blob/master/demo/5-images.ts_
Example showing how to add image to headers and footers
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/9-images-in-header-and-footer.ts ':include')
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/9-images-in-header-and-footer.ts ":include")
_Source: https://github.com/dolanmiu/docx/blob/master/demo/9-images-in-header-and-footer.ts_
@ -274,6 +297,6 @@ _Source: https://github.com/dolanmiu/docx/blob/master/demo/9-images-in-header-an
Example showing how to float images on top of text and optimally give a `margin`
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/38-text-wrapping.ts ':include')
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/38-text-wrapping.ts ":include")
_Source: https://github.com/dolanmiu/docx/blob/master/demo/38-text-wrapping.ts_

View File

@ -86,3 +86,34 @@ topLevelP.setNumbering(concrete, 0);
subP.setNumbering(concrete, 1);
subSubP.setNumbering(concrete, 2);
```
## Unindent numbering
Default:1. test
After:1.test
Use default numbering have indent,If you want unindent numbering
How to custom number see the demo:
https://runkit.com/dolanmiu/docx-demo3
```ts
enum LevelSuffix {
NOTHING = "nothing",
SPACE = "space",
TAB = "tab"
}
// custom numbering
const levels=[
{
level: 0,
format: "decimal",
text: "%1.",
alignment: AlignmentType.START,
suffix: LevelSuffix.NOTHING, // Cancel intent
}]
```

View File

@ -61,13 +61,13 @@ const doc = new Document({
This is the list of options for a paragraph. A detailed explanation is below:
| Property | Type | Mandatory? | Possible Values |
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------- | ---------- | ---------------------------------------------------------------------------------------------------------- |
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [text](#text) | `string` | Optional | |
| [heading](#heading) | `HeadingLevel` | Optional | `HEADING_1`, `HEADING_2`, `HEADING_3`, `HEADING_4`, `HEADING_5`, `HEADING_6`, `TITLE` |
| [border](#border) | `IBorderOptions` | Optional | `top`, `bottom`, `left`, `right`. Each of these are of type IBorderPropertyOptions. Click here for Example |
| [spacing](#spacing) | `ISpacingProperties` | Optional | See below for ISpacingProperties |
| [outlineLevel](#outline-level) | `number` | Optional | |
| alignment | `AlignmentType` | Optional | |
| alignment | `AlignmentType` | Optional | `START`, `CENTER`, `END`, `BOTH`, `MEDIUM_KASHIDA`, `DISTRIBUTE`, `NUM_TAB`, `HIGH_KASHIDA`, `LOW_KASHIDA`, `THAI_DISTRIBUTE`, `LEFT`, `RIGHT`, `JUSTIFIED` |
| heading | `HeadingLevel` | Optional | |
| bidirectional | `boolean` | Optional | |
| thematicBreak | `boolean` | Optional | |
@ -111,7 +111,7 @@ const paragraph = new Paragraph({
## Border
Add borders to a `Paragraph`. Good for making the `Paragraph` stand out
Add borders to a `Paragraph`. Good for making the `Paragraph` stand out. Border top and border bottom can be used as a horizontal rule (also known as horizontal line).
#### IBorderPropertyOptions
@ -181,11 +181,13 @@ Adding spacing between paragraphs
### ISpacingProperties
| Property | Type | Notes | Possible Values |
| -------- | -------------- | -------- | ----------------------------- |
| -------- | -------------- | -------- | -------------------------------------- |
| after | `number` | Optional | |
| before | `number` | Optional | |
| line | `number` | Optional | |
| lineRule | `LineRuleType` | Optional | `AT_LEAST`, `EXACTLY`, `AUTO` |
| lineRule | `LineRuleType` | Optional | `AT_LEAST`, `EXACTLY`, `EXACT`, `AUTO` |
Note: The `lineRule` property has different values depending on the version of Word you are using. The `EXACTLY` value is only available in Word 2016 and above. Use `EXACT` for greater support, including LibreOffice etc. Read this issue for more information: https://github.com/dolanmiu/docx/issues/1773.
**Example:**

View File

@ -151,6 +151,28 @@ const text = new TextRun({
});
```
### Vanish and SpecVanish
You may want to hide your text in your document.
`Vanish` should affect the normal display of text, but an application may have settings to force hidden text to be displayed.
```ts
const text = new TextRun({
text: "This text will be hidden",
vanish: true,
});
```
`SpecVanish` was typically used to ensure that a paragraph style can be applied to a part of a paragraph, and still appear as in the Table of Contents (which in previous word processors would ignore the use of the style if it were being used as a character style).
```ts
const text = new TextRun({
text: "This text will be hidden forever.",
specVanish: true,
});
```
## Break
Sometimes you would want to put text underneath another line of text but inside the same paragraph.

3783
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "docx",
"version": "7.5.0",
"version": "7.8.1",
"description": "Easily generate .docx files with JS/TS with a nice declarative API. Works for Node and on the Browser.",
"main": "build/index.js",
"scripts": {
@ -65,7 +65,7 @@
"devDependencies": {
"@types/chai": "^4.2.15",
"@types/glob": "^8.0.0",
"@types/mocha": "^9.0.0",
"@types/mocha": "^10.0.0",
"@types/prompt": "^1.1.1",
"@types/request-promise": "^4.1.42",
"@types/shelljs": "^0.8.9",
@ -75,7 +75,7 @@
"@typescript-eslint/eslint-plugin": "^5.36.1",
"@typescript-eslint/parser": "^5.36.1",
"buffer": "^6.0.3",
"chai": "^3.5.0",
"chai": "^4.3.6",
"cspell": "^6.2.2",
"docsify-cli": "^4.3.0",
"eslint": "^8.23.0",
@ -84,7 +84,7 @@
"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",
"eslint-plugin-unicorn": "^45.0.0",
"glob": "^8.0.1",
"jszip": "^3.1.5",
"mocha": "^10.0.0",
@ -98,17 +98,17 @@
"request-promise": "^4.2.2",
"rimraf": "^3.0.2",
"shelljs": "^0.8.4",
"sinon": "^14.0.0",
"sinon": "^15.0.0",
"stream-browserify": "^3.0.0",
"ts-loader": "^9.0.0",
"ts-node": "^10.2.1",
"tsconfig-paths": "^4.0.0",
"tsconfig-paths-webpack-plugin": "^4.0.0",
"typedoc": "^0.23.2",
"typescript": "4.7.4",
"typescript": "4.9.4",
"unzipper": "^0.10.11",
"webpack": "^5.28.0",
"webpack-cli": "^4.6.0"
"webpack-cli": "^5.0.0"
},
"engines": {
"node": ">=10"

View File

@ -1,4 +1,5 @@
import { ICommentsOptions } from "@file/paragraph/run/comment-run";
import { ICompatibilityOptions } from "@file/settings/compatibility";
import { StringContainer, XmlComponent } from "@file/xml-components";
import { dateTimeValue } from "@util/values";
@ -35,6 +36,7 @@ export interface IPropertiesOptions {
readonly updateFields?: boolean;
};
readonly compatabilityModeVersion?: number;
readonly compatibility?: ICompatibilityOptions;
readonly customProperties?: readonly ICustomPropertyOptions[];
readonly evenAndOddHeaderAndFooters?: boolean;
}

View File

@ -8,7 +8,7 @@ import { DocumentAttributes } from "./document-attributes";
import { DocumentBackground, IDocumentBackgroundOptions } from "./document-background";
export interface IDocumentOptions {
readonly background: IDocumentBackgroundOptions;
readonly background?: IDocumentBackgroundOptions;
}
// <xsd:element name="document" type="CT_Document"/>
@ -73,7 +73,9 @@ export class Document extends XmlComponent {
}),
);
this.body = new Body();
if (options.background) {
this.root.push(new DocumentBackground(options.background));
}
this.root.push(this.body);
}

View File

@ -1,4 +1,8 @@
import { assert } from "chai";
import { assert, expect } from "chai";
import { SinonStub, stub } from "sinon";
import { Formatter } from "@export/formatter";
import * as convenienceFunctions from "@util/convenience-functions";
import { Utility } from "tests/utility";
@ -36,6 +40,14 @@ const createAnchor = (drawingOptions: IDrawingOptions): Anchor =>
);
describe("Anchor", () => {
before(() => {
stub(convenienceFunctions, "uniqueNumericId").callsFake(() => 0);
});
after(() => {
(convenienceFunctions.uniqueNumericId as SinonStub).restore();
});
let anchor: Anchor;
describe("#constructor()", () => {
@ -362,5 +374,236 @@ describe("Anchor", () => {
relativeHeight: 120,
});
});
it("should create a Drawing with doc properties", () => {
anchor = createAnchor({
floating: {
verticalPosition: {
offset: 0,
},
horizontalPosition: {
offset: 0,
},
zIndex: 120,
},
docProperties: {
name: "test",
description: "test",
title: "test",
},
});
const tree = new Formatter().format(anchor);
expect(tree).to.deep.equal({
"wp:anchor": [
{
_attr: {
allowOverlap: "1",
behindDoc: "0",
distB: 0,
distL: 0,
distR: 0,
distT: 0,
layoutInCell: "1",
locked: "0",
relativeHeight: 120,
simplePos: "0",
},
},
{
"wp:simplePos": {
_attr: {
x: 0,
y: 0,
},
},
},
{
"wp:positionH": [
{
_attr: {
relativeFrom: "page",
},
},
{
"wp:posOffset": ["0"],
},
],
},
{
"wp:positionV": [
{
_attr: {
relativeFrom: "page",
},
},
{
"wp:posOffset": ["0"],
},
],
},
{
"wp:extent": {
_attr: {
cx: 952500,
cy: 952500,
},
},
},
{
"wp:effectExtent": {
_attr: {
b: 0,
l: 0,
r: 0,
t: 0,
},
},
},
{
"wp:wrapNone": {},
},
{
"wp:docPr": {
_attr: {
descr: "test",
id: 0,
name: "test",
title: "test",
},
},
},
{
"wp:cNvGraphicFramePr": [
{
"a:graphicFrameLocks": {
_attr: {
noChangeAspect: 1,
"xmlns:a": "http://schemas.openxmlformats.org/drawingml/2006/main",
},
},
},
],
},
{
"a:graphic": [
{
_attr: {
"xmlns:a": "http://schemas.openxmlformats.org/drawingml/2006/main",
},
},
{
"a:graphicData": [
{
_attr: {
uri: "http://schemas.openxmlformats.org/drawingml/2006/picture",
},
},
{
"pic:pic": [
{
_attr: {
"xmlns:pic": "http://schemas.openxmlformats.org/drawingml/2006/picture",
},
},
{
"pic:nvPicPr": [
{
"pic:cNvPr": {
_attr: {
descr: "",
id: 0,
name: "",
},
},
},
{
"pic:cNvPicPr": [
{
"a:picLocks": {
_attr: {
noChangeArrowheads: 1,
noChangeAspect: 1,
},
},
},
],
},
],
},
{
"pic:blipFill": [
{
"a:blip": {
_attr: {
cstate: "none",
"r:embed": "rId{test.png}",
},
},
},
{
"a:srcRect": {},
},
{
"a:stretch": [
{
"a:fillRect": {},
},
],
},
],
},
{
"pic:spPr": [
{
_attr: {
bwMode: "auto",
},
},
{
"a:xfrm": [
{
_attr: {},
},
{
"a:off": {
_attr: {
x: 0,
y: 0,
},
},
},
{
"a:ext": {
_attr: {
cx: 952500,
cy: 952500,
},
},
},
],
},
{
"a:prstGeom": [
{
_attr: {
prst: "rect",
},
},
{
"a:avLst": {},
},
],
},
],
},
],
},
],
},
],
},
],
});
});
});
});

View File

@ -90,7 +90,7 @@ export class Anchor extends XmlComponent {
this.root.push(new WrapNone());
}
this.root.push(new DocProperties());
this.root.push(new DocProperties(drawingOptions.docProperties));
this.root.push(new GraphicFrameProperties());
this.root.push(new Graphic(mediaData, transform));
}

View File

@ -1,13 +0,0 @@
import { XmlAttributeComponent } from "@file/xml-components";
export class DocPropertiesAttributes extends XmlAttributeComponent<{
readonly id?: number;
readonly name?: string;
readonly descr?: string;
}> {
protected readonly xmlKeys = {
id: "id",
name: "name",
descr: "descr",
};
}

View File

@ -1,15 +1,36 @@
import { XmlComponent } from "@file/xml-components";
import { DocPropertiesAttributes } from "./doc-properties-attributes";
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
import { uniqueNumericId } from "@util/convenience-functions";
class DocPropertiesAttributes extends XmlAttributeComponent<{
readonly id?: number;
readonly name?: string;
readonly description?: string;
readonly title?: string;
}> {
protected readonly xmlKeys = {
id: "id",
name: "name",
description: "descr",
title: "title",
};
}
export interface DocPropertiesOptions {
readonly name: string;
readonly description: string;
readonly title: string;
}
export class DocProperties extends XmlComponent {
public constructor() {
public constructor({ name, description, title }: DocPropertiesOptions = { name: "", description: "", title: "" }) {
super("wp:docPr");
this.root.push(
new DocPropertiesAttributes({
id: 0,
name: "",
descr: "",
id: uniqueNumericId(),
name,
description,
title,
}),
);
}

View File

@ -1,6 +1,8 @@
import { expect } from "chai";
import { SinonStub, stub } from "sinon";
import { Formatter } from "@export/formatter";
import * as convenienceFunctions from "@util/convenience-functions";
import { Drawing, IDrawingOptions } from "./drawing";
@ -26,6 +28,14 @@ const createDrawing = (drawingOptions?: IDrawingOptions): Drawing =>
);
describe("Drawing", () => {
before(() => {
stub(convenienceFunctions, "uniqueNumericId").callsFake(() => 0);
});
after(() => {
(convenienceFunctions.uniqueNumericId as SinonStub).restore();
});
let currentBreak: Drawing;
describe("#constructor()", () => {
@ -68,6 +78,7 @@ describe("Drawing", () => {
descr: "",
id: 0,
name: "",
title: "",
},
},
},
@ -298,6 +309,7 @@ describe("Drawing", () => {
descr: "",
id: 0,
name: "",
title: "",
},
},
},

View File

@ -1,6 +1,8 @@
import { IMediaData } from "@file/media";
import { XmlComponent } from "@file/xml-components";
import { Anchor } from "./anchor";
import { DocPropertiesOptions } from "./doc-properties/doc-properties";
import { IFloating } from "./floating";
import { Inline } from "./inline";
@ -13,6 +15,7 @@ export interface IDistance {
export interface IDrawingOptions {
readonly floating?: IFloating;
readonly docProperties?: DocPropertiesOptions;
}
// <xsd:complexType name="CT_Drawing">
@ -29,7 +32,11 @@ export class Drawing extends XmlComponent {
super("w:drawing");
if (!drawingOptions.floating) {
this.inline = new Inline(imageData, imageData.transformation);
this.inline = new Inline({
mediaData: imageData,
transform: imageData.transformation,
docProperties: drawingOptions.docProperties,
});
this.root.push(this.inline);
} else {
this.root.push(new Anchor(imageData, imageData.transformation, drawingOptions));

View File

@ -1,13 +1,19 @@
// http://officeopenxml.com/drwPicInline.php
import { IMediaData, IMediaDataTransformation } from "@file/media";
import { XmlComponent } from "@file/xml-components";
import { DocProperties } from "./../doc-properties/doc-properties";
import { DocProperties, DocPropertiesOptions } from "./../doc-properties/doc-properties";
import { EffectExtent } from "./../effect-extent/effect-extent";
import { Extent } from "./../extent/extent";
import { GraphicFrameProperties } from "./../graphic-frame/graphic-frame-properties";
import { Graphic } from "./../inline/graphic";
import { InlineAttributes } from "./inline-attributes";
interface InlineOptions {
readonly mediaData: IMediaData;
readonly transform: IMediaDataTransformation;
readonly docProperties?: DocPropertiesOptions;
}
// <xsd:complexType name="CT_Inline">
// <xsd:sequence>
// <xsd:element name="extent" type="a:CT_PositiveSize2D"/>
@ -26,7 +32,7 @@ export class Inline extends XmlComponent {
private readonly extent: Extent;
private readonly graphic: Graphic;
public constructor(mediaData: IMediaData, transform: IMediaDataTransformation) {
public constructor({ mediaData, transform, docProperties }: InlineOptions) {
super("wp:inline");
this.root.push(
@ -43,7 +49,7 @@ export class Inline extends XmlComponent {
this.root.push(this.extent);
this.root.push(new EffectExtent());
this.root.push(new DocProperties());
this.root.push(new DocProperties(docProperties));
this.root.push(new GraphicFrameProperties());
this.root.push(this.graphic);
}

View File

@ -73,9 +73,10 @@ export class File {
this.appProperties = new AppProperties();
this.footnotesWrapper = new FootnotesWrapper();
this.contentTypes = new ContentTypes();
this.documentWrapper = new DocumentWrapper({ background: options.background || {} });
this.documentWrapper = new DocumentWrapper({ background: options.background });
this.settings = new Settings({
compatabilityModeVersion: options.compatabilityModeVersion,
compatibilityModeVersion: options.compatabilityModeVersion,
compatibility: options.compatibility,
evenAndOddHeaders: options.evenAndOddHeaderAndFooters ? true : false,
trackRevisions: options.features?.trackRevisions,
updateFields: options.features?.updateFields,

View File

@ -18,4 +18,3 @@ export * from "./track-revision";
export * from "./shared";
export * from "./border";
export * from "./vertical-align";
export * from "./space-type";

File diff suppressed because it is too large Load Diff

View File

@ -56,7 +56,21 @@ describe("ConcreteNumbering", () => {
},
});
const tree = new Formatter().format(concreteNumbering);
expect(tree["w:num"]).to.include({
expect(tree).to.deep.equal({
"w:num": [
{
_attr: {
"w:numId": 0,
},
},
{
"w:abstractNumId": {
_attr: {
"w:val": 1,
},
},
},
{
"w:lvlOverride": [
{
_attr: {
@ -71,6 +85,8 @@ describe("ConcreteNumbering", () => {
},
},
],
},
],
});
});

View File

@ -1,4 +1,5 @@
// http://officeopenxml.com/WPnumbering-numFmt.php
// http://www.datypic.com/sc/ooxml/a-w_val-57.html
import { Attributes, NumberValueElement, XmlAttributeComponent, XmlComponent } from "@file/xml-components";
import { decimalNumber } from "@util/values";
@ -6,21 +7,138 @@ import { AlignmentType } from "../paragraph/formatting";
import { ILevelParagraphStylePropertiesOptions, ParagraphProperties } from "../paragraph/properties";
import { IRunStylePropertiesOptions, RunProperties } from "../paragraph/run/properties";
// TODO: Breaking change - consolidate with number-format
// <xsd:simpleType name="ST_NumberFormat">
// <xsd:restriction base="xsd:string">
// <xsd:enumeration value="decimal"/>
// <xsd:enumeration value="upperRoman"/>
// <xsd:enumeration value="lowerRoman"/>
// <xsd:enumeration value="upperLetter"/>
// <xsd:enumeration value="lowerLetter"/>
// <xsd:enumeration value="ordinal"/>
// <xsd:enumeration value="cardinalText"/>
// <xsd:enumeration value="ordinalText"/>
// <xsd:enumeration value="hex"/>
// <xsd:enumeration value="chicago"/>
// <xsd:enumeration value="ideographDigital"/>
// <xsd:enumeration value="japaneseCounting"/>
// <xsd:enumeration value="aiueo"/>
// <xsd:enumeration value="iroha"/>
// <xsd:enumeration value="decimalFullWidth"/>
// <xsd:enumeration value="decimalHalfWidth"/>
// <xsd:enumeration value="japaneseLegal"/>
// <xsd:enumeration value="japaneseDigitalTenThousand"/>
// <xsd:enumeration value="decimalEnclosedCircle"/>
// <xsd:enumeration value="decimalFullWidth2"/>
// <xsd:enumeration value="aiueoFullWidth"/>
// <xsd:enumeration value="irohaFullWidth"/>
// <xsd:enumeration value="decimalZero"/>
// <xsd:enumeration value="bullet"/>
// <xsd:enumeration value="ganada"/>
// <xsd:enumeration value="chosung"/>
// <xsd:enumeration value="decimalEnclosedFullstop"/>
// <xsd:enumeration value="decimalEnclosedParen"/>
// <xsd:enumeration value="decimalEnclosedCircleChinese"/>
// <xsd:enumeration value="ideographEnclosedCircle"/>
// <xsd:enumeration value="ideographTraditional"/>
// <xsd:enumeration value="ideographZodiac"/>
// <xsd:enumeration value="ideographZodiacTraditional"/>
// <xsd:enumeration value="taiwaneseCounting"/>
// <xsd:enumeration value="ideographLegalTraditional"/>
// <xsd:enumeration value="taiwaneseCountingThousand"/>
// <xsd:enumeration value="taiwaneseDigital"/>
// <xsd:enumeration value="chineseCounting"/>
// <xsd:enumeration value="chineseLegalSimplified"/>
// <xsd:enumeration value="chineseCountingThousand"/>
// <xsd:enumeration value="koreanDigital"/>
// <xsd:enumeration value="koreanCounting"/>
// <xsd:enumeration value="koreanLegal"/>
// <xsd:enumeration value="koreanDigital2"/>
// <xsd:enumeration value="vietnameseCounting"/>
// <xsd:enumeration value="russianLower"/>
// <xsd:enumeration value="russianUpper"/>
// <xsd:enumeration value="none"/>
// <xsd:enumeration value="numberInDash"/>
// <xsd:enumeration value="hebrew1"/>
// <xsd:enumeration value="hebrew2"/>
// <xsd:enumeration value="arabicAlpha"/>
// <xsd:enumeration value="arabicAbjad"/>
// <xsd:enumeration value="hindiVowels"/>
// <xsd:enumeration value="hindiConsonants"/>
// <xsd:enumeration value="hindiNumbers"/>
// <xsd:enumeration value="hindiCounting"/>
// <xsd:enumeration value="thaiLetters"/>
// <xsd:enumeration value="thaiNumbers"/>
// <xsd:enumeration value="thaiCounting"/>
// <xsd:enumeration value="bahtText"/>
// <xsd:enumeration value="dollarText"/>
// <xsd:enumeration value="custom"/>
// </xsd:restriction>
// </xsd:simpleType>
export enum LevelFormat {
BULLET = "bullet",
CARDINAL_TEXT = "cardinalText",
CHICAGO = "chicago",
DECIMAL = "decimal",
UPPER_ROMAN = "upperRoman",
LOWER_ROMAN = "lowerRoman",
UPPER_LETTER = "upperLetter",
LOWER_LETTER = "lowerLetter",
ORDINAL = "ordinal",
CARDINAL_TEXT = "cardinalText",
ORDINAL_TEXT = "ordinalText",
HEX = "hex",
CHICAGO = "chicago",
IDEOGRAPH__DIGITAL = "ideographDigital",
JAPANESE_COUNTING = "japaneseCounting",
AIUEO = "aiueo",
IROHA = "iroha",
DECIMAL_FULL_WIDTH = "decimalFullWidth",
DECIMAL_HALF_WIDTH = "decimalHalfWidth",
JAPANESE_LEGAL = "japaneseLegal",
JAPANESE_DIGITAL_TEN_THOUSAND = "japaneseDigitalTenThousand",
DECIMAL_ENCLOSED_CIRCLE = "decimalEnclosedCircle",
DECIMAL_FULL_WIDTH2 = "decimalFullWidth2",
AIUEO_FULL_WIDTH = "aiueoFullWidth",
IROHA_FULL_WIDTH = "irohaFullWidth",
DECIMAL_ZERO = "decimalZero",
BULLET = "bullet",
GANADA = "ganada",
CHOSUNG = "chosung",
DECIMAL_ENCLOSED_FULLSTOP = "decimalEnclosedFullstop",
DECIMAL_ENCLOSED_PARENTHESES = "decimalEnclosedParen",
DECIMAL_ZERO = "decimalZero",
LOWER_LETTER = "lowerLetter",
LOWER_ROMAN = "lowerRoman",
DECIMAL_ENCLOSED_CIRCLE_CHINESE = "decimalEnclosedCircleChinese",
IDEOGRAPH_ENCLOSED_CIRCLE = "ideographEnclosedCircle",
IDEOGRAPH_TRADITIONAL = "ideographTraditional",
IDEOGRAPH_ZODIAC = "ideographZodiac",
IDEOGRAPH_ZODIAC_TRADITIONAL = "ideographZodiacTraditional",
TAIWANESE_COUNTING = "taiwaneseCounting",
IDEOGRAPH_LEGAL_TRADITIONAL = "ideographLegalTraditional",
TAIWANESE_COUNTING_THOUSAND = "taiwaneseCountingThousand",
TAIWANESE_DIGITAL = "taiwaneseDigital",
CHINESE_COUNTING = "chineseCounting",
CHINESE_LEGAL_SIMPLIFIED = "chineseLegalSimplified",
CHINESE_COUNTING_THOUSAND = "chineseCountingThousand",
KOREAN_DIGITAL = "koreanDigital",
KOREAN_COUNTING = "koreanCounting",
KOREAN_LEGAL = "koreanLegal",
KOREAN_DIGITAL2 = "koreanDigital2",
VIETNAMESE_COUNTING = "vietnameseCounting",
RUSSIAN_LOWER = "russianLower",
RUSSIAN_UPPER = "russianUpper",
NONE = "none",
ORDINAL_TEXT = "ordinalText",
UPPER_LETTER = "upperLetter",
UPPER_ROMAN = "upperRoman",
NUMBER_IN_DASH = "numberInDash",
HEBREW1 = "hebrew1",
HEBREW2 = "hebrew2",
ARABIC_ALPHA = "arabicAlpha",
ARABIC_ABJAD = "arabicAbjad",
HINDI_VOWELS = "hindiVowels",
HINDI_CONSONANTS = "hindiConsonants",
HINDI_NUMBERS = "hindiNumbers",
HINDI_COUNTING = "hindiCounting",
THAI_LETTERS = "thaiLetters",
THAI_NUMBERS = "thaiNumbers",
THAI_COUNTING = "thaiCounting",
BAHT_TEXT = "bahtText",
DOLLAR_TEXT = "dollarText",
CUSTOM = "custom",
}
class LevelAttributes extends XmlAttributeComponent<{

View File

@ -1,16 +1,51 @@
// http://officeopenxml.com/WPalignment.php
// http://officeopenxml.com/WPtableAlignment.php
// http://www.datypic.com/sc/ooxml/t-w_ST_Jc.html
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
// <xsd:simpleType name="ST_Jc">
// <xsd:restriction base="xsd:string">
// <xsd:enumeration value="start"/>
// <xsd:enumeration value="center"/>
// <xsd:enumeration value="end"/>
// <xsd:enumeration value="both"/>
// <xsd:enumeration value="mediumKashida"/>
// <xsd:enumeration value="distribute"/>
// <xsd:enumeration value="numTab"/>
// <xsd:enumeration value="highKashida"/>
// <xsd:enumeration value="lowKashida"/>
// <xsd:enumeration value="thaiDistribute"/>
// <xsd:enumeration value="left"/>
// <xsd:enumeration value="right"/>
// </xsd:restriction>
// </xsd:simpleType>
export enum AlignmentType {
/** Align Start */
START = "start",
END = "end",
/** Align Center */
CENTER = "center",
/** End */
END = "end",
/** Justified */
BOTH = "both",
JUSTIFIED = "both",
/** Medium Kashida Length */
MEDIUM_KASHIDA = "mediumKashida",
/** Distribute All Characters Equally */
DISTRIBUTE = "distribute",
/** Align to List Tab */
NUM_TAB = "numTab",
/** Widest Kashida Length */
HIGH_KASHIDA = "highKashida",
/** Low Kashida Length */
LOW_KASHIDA = "lowKashida",
/** Thai Language Justification */
THAI_DISTRIBUTE = "thaiDistribute",
/** Align Left */
LEFT = "left",
/** Align Right */
RIGHT = "right",
/** Justified */
JUSTIFIED = "both",
}
export class AlignmentAttributes extends XmlAttributeComponent<{ readonly val: AlignmentType }> {

View File

@ -4,6 +4,7 @@ import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
export enum LineRuleType {
AT_LEAST = "atLeast",
EXACTLY = "exactly",
EXACT = "exact",
AUTO = "auto",
}
export interface ISpacingProperties {

View File

@ -8,7 +8,7 @@ describe("LeftTabStop", () => {
let tabStop: TabStop;
beforeEach(() => {
tabStop = new TabStop(TabStopType.LEFT, 100);
tabStop = new TabStop([{ type: TabStopType.LEFT, position: 100 }]);
});
describe("#constructor()", () => {
@ -32,7 +32,7 @@ describe("RightTabStop", () => {
let tabStop: TabStop;
beforeEach(() => {
tabStop = new TabStop(TabStopType.RIGHT, 100, LeaderType.DOT);
tabStop = new TabStop([{ type: TabStopType.RIGHT, position: 100, leader: LeaderType.DOT }]);
});
describe("#constructor()", () => {

View File

@ -1,10 +1,19 @@
// http://officeopenxml.com/WPtab.php
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
export interface TabStopDefinition {
readonly type: TabStopType;
readonly position: number | TabStopPosition;
readonly leader?: LeaderType;
}
export class TabStop extends XmlComponent {
public constructor(type: TabStopType, position: number, leader?: LeaderType) {
public constructor(tabDefinitions: readonly TabStopDefinition[]) {
super("w:tabs");
this.root.push(new TabStopItem(type, position, leader));
for (const tabDefinition of tabDefinitions) {
this.root.push(new TabStopItem(tabDefinition));
}
}
}
@ -41,13 +50,13 @@ export class TabAttributes extends XmlAttributeComponent<{
}
export class TabStopItem extends XmlComponent {
public constructor(value: TabStopType, position: string | number, leader?: LeaderType) {
public constructor({ type, position, leader }: TabStopDefinition) {
super("w:tab");
this.root.push(
new TabAttributes({
val: value,
val: type,
pos: position,
leader,
leader: leader,
}),
);
}

View File

View File

@ -0,0 +1,20 @@
import { expect } from "chai";
import { Formatter } from "@export/formatter";
import { WordWrap } from "./word-wrap";
describe("WordWrap", () => {
it("should create", () => {
const wordWrap = new WordWrap();
const tree = new Formatter().format(wordWrap);
expect(tree).to.deep.equal({
"w:wordWrap": {
_attr: {
"w:val": 0,
},
},
});
});
});

View File

@ -0,0 +1,14 @@
// http://officeopenxml.com/WPalignment.php
// http://officeopenxml.com/WPtableAlignment.php
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
export class WordWrapAttributes extends XmlAttributeComponent<{ readonly val: 0 }> {
protected readonly xmlKeys = { val: "w:val" };
}
export class WordWrap extends XmlComponent {
public constructor() {
super("w:wordWrap");
this.root.push(new WordWrapAttributes({ val: 0 }));
}
}

View File

@ -1,4 +1,4 @@
import { SpaceType } from "@file/space-type";
import { SpaceType } from "@file/shared";
import { XmlComponent } from "@file/xml-components";
import { TextAttributes } from "../run/text-attributes";

View File

@ -2,7 +2,7 @@ import { MathAngledBrackets, MathCurlyBrackets, MathRoundBrackets, MathSquareBra
import { MathFraction } from "./fraction";
import { MathFunction } from "./function";
import { MathRun } from "./math-run";
import { MathSum } from "./n-ary";
import { MathSum, MathIntegral } from "./n-ary";
import { MathRadical } from "./radical";
import { MathSubScript, MathSubSuperScript, MathSuperScript } from "./script";
@ -10,6 +10,7 @@ export type MathComponent =
| MathRun
| MathFraction
| MathSum
| MathIntegral
| MathSuperScript
| MathSubScript
| MathSubSuperScript

View File

@ -4,4 +4,5 @@ export * from "./math-limit-location";
export * from "./math-n-ary-properties";
export * from "./math-sub-script";
export * from "./math-sum";
export * from "./math-integral";
export * from "./math-super-script";

View File

@ -0,0 +1,116 @@
import { expect } from "chai";
import { Formatter } from "@export/formatter";
import { MathRun } from "../math-run";
import { MathIntegral } from "./math-integral";
describe("MathIntegral", () => {
describe("#constructor()", () => {
it("should create a MathIntegral with correct root key", () => {
const mathIntegral = new MathIntegral({
children: [new MathRun("1")],
subScript: [new MathRun("2")],
superScript: [new MathRun("3")],
});
const tree = new Formatter().format(mathIntegral);
expect(tree).to.deep.equal({
"m:nary": [
{
"m:naryPr": [
{
"m:limLoc": {
_attr: {
"m:val": "undOvr",
},
},
},
],
},
{
"m:sub": [
{
"m:r": [
{
"m:t": ["2"],
},
],
},
],
},
{
"m:sup": [
{
"m:r": [
{
"m:t": ["3"],
},
],
},
],
},
{
"m:e": [
{
"m:r": [
{
"m:t": ["1"],
},
],
},
],
},
],
});
});
it("should create a MathIntegral with correct root key without sub-script and super-scripts", () => {
const mathIntegral = new MathIntegral({
children: [new MathRun("1")],
});
const tree = new Formatter().format(mathIntegral);
expect(tree).to.deep.equal({
"m:nary": [
{
"m:naryPr": [
{
"m:limLoc": {
_attr: {
"m:val": "undOvr",
},
},
},
{
"m:supHide": {
_attr: {
"m:val": 1,
},
},
},
{
"m:subHide": {
_attr: {
"m:val": 1,
},
},
},
],
},
{
"m:e": [
{
"m:r": [
{
"m:t": ["1"],
},
],
},
],
},
],
});
});
});
});

View File

@ -0,0 +1,31 @@
import { XmlComponent } from "@file/xml-components";
import { MathComponent } from "../math-component";
import { MathBase } from "./math-base";
import { MathNAryProperties } from "./math-n-ary-properties";
import { MathSubScriptElement } from "./math-sub-script";
import { MathSuperScriptElement } from "./math-super-script";
export interface IMathIntegralOptions {
readonly children: readonly MathComponent[];
readonly subScript?: readonly MathComponent[];
readonly superScript?: readonly MathComponent[];
}
export class MathIntegral extends XmlComponent {
public constructor(options: IMathIntegralOptions) {
super("m:nary");
this.root.push(new MathNAryProperties("", !!options.superScript, !!options.subScript));
if (!!options.subScript) {
this.root.push(new MathSubScriptElement(options.subScript));
}
if (!!options.superScript) {
this.root.push(new MathSuperScriptElement(options.superScript));
}
this.root.push(new MathBase(options.children));
}
}

View File

@ -10,7 +10,9 @@ export class MathNAryProperties extends XmlComponent {
public constructor(accent: string, hasSuperScript: boolean, hasSubScript: boolean) {
super("m:naryPr");
if (!!accent) {
this.root.push(new MathAccentCharacter(accent));
}
this.root.push(new MathLimitLocation());
if (!hasSuperScript) {

View File

@ -3,6 +3,7 @@ import { SinonStub, stub } from "sinon";
import * as convenienceFunctions from "@util/convenience-functions";
import { HorizontalPositionAlign, VerticalPositionAlign } from "@file/shared";
import { Formatter } from "@export/formatter";
import { BorderStyle } from "@file/border";
import { EMPTY_OBJECT } from "@file/xml-components";
@ -10,7 +11,6 @@ import { EMPTY_OBJECT } from "@file/xml-components";
import { IViewWrapper } from "../document-wrapper";
import { File } from "../file";
import { ShadingType } from "../shading";
import { HorizontalPositionAlign, VerticalPositionAlign } from "../shared";
import { AlignmentType, HeadingLevel, LeaderType, PageBreak, TabStopPosition, TabStopType } from "./formatting";
import { FrameAnchorType } from "./frame";
import { Bookmark, ExternalHyperlink } from "./links";
@ -25,6 +25,7 @@ describe("Paragraph", () => {
after(() => {
(convenienceFunctions.uniqueId as SinonStub).restore();
(convenienceFunctions.uniqueNumericId as SinonStub).restore();
});
describe("#constructor()", () => {

View File

@ -123,5 +123,24 @@ describe("ParagraphProperties", () => {
],
});
});
it("should create with the wordWrap property", () => {
const properties = new ParagraphProperties({
wordWrap: true,
});
const tree = new Formatter().format(properties);
expect(tree).to.deep.equal({
"w:pPr": [
{
"w:wordWrap": {
_attr: {
"w:val": 0,
},
},
},
],
});
});
});
});

View File

@ -9,8 +9,9 @@ import { PageBreakBefore } from "./formatting/break";
import { IIndentAttributesProperties, Indent } from "./formatting/indent";
import { ISpacingProperties, Spacing } from "./formatting/spacing";
import { HeadingLevel, Style } from "./formatting/style";
import { LeaderType, TabStop, TabStopPosition, TabStopType } from "./formatting/tab-stop";
import { TabStop, TabStopDefinition, TabStopType } from "./formatting/tab-stop";
import { NumberProperties } from "./formatting/unordered-list";
import { WordWrap } from "./formatting/word-wrap";
import { FrameProperties, IFrameOptions } from "./frame/frame-properties";
import { OutlineLevel } from "./links";
@ -41,11 +42,7 @@ export interface IParagraphPropertiesOptions extends IParagraphStylePropertiesOp
readonly heading?: HeadingLevel;
readonly bidirectional?: boolean;
readonly pageBreakBefore?: boolean;
readonly tabStops?: readonly {
readonly position: number | TabStopPosition;
readonly type: TabStopType;
readonly leader?: LeaderType;
}[];
readonly tabStops?: readonly TabStopDefinition[];
readonly style?: string;
readonly bullet?: {
readonly level: number;
@ -54,6 +51,8 @@ export interface IParagraphPropertiesOptions extends IParagraphStylePropertiesOp
readonly widowControl?: boolean;
readonly frame?: IFrameOptions;
readonly suppressLineNumbers?: boolean;
readonly wordWrap?: boolean;
readonly scale?: number;
}
export class ParagraphProperties extends IgnoreIfEmptyXmlComponent {
@ -132,19 +131,26 @@ export class ParagraphProperties extends IgnoreIfEmptyXmlComponent {
this.push(new Shading(options.shading));
}
if (options.rightTabStop) {
this.push(new TabStop(TabStopType.RIGHT, options.rightTabStop));
if (options.wordWrap) {
this.push(new WordWrap());
}
if (options.tabStops) {
for (const tabStop of options.tabStops) {
this.push(new TabStop(tabStop.type, tabStop.position, tabStop.leader));
}
}
/**
* FIX: Multitab support for Libre Writer
* Ensure there is only one w:tabs tag with multiple w:tab
*/
const tabDefinitions: readonly TabStopDefinition[] = [
...(options.rightTabStop ? [{ type: TabStopType.RIGHT, position: options.rightTabStop }] : []),
...(options.tabStops ? options.tabStops : []),
...(options.leftTabStop ? [{ type: TabStopType.LEFT, position: options.leftTabStop }] : []),
];
if (options.leftTabStop) {
this.push(new TabStop(TabStopType.LEFT, options.leftTabStop));
if (tabDefinitions.length > 0) {
this.push(new TabStop(tabDefinitions));
}
/**
* FIX - END
*/
if (options.bidirectional !== undefined) {
this.push(new OnOffElement("w:bidi", options.bidirectional));

View File

@ -1,4 +1,5 @@
import { expect } from "chai";
import * as sinon from "sinon";
import { Formatter } from "@export/formatter";
import { Comment, CommentRangeEnd, CommentRangeStart, CommentReference, Comments } from "./comment-run";
@ -40,6 +41,17 @@ describe("CommentReference", () => {
});
describe("Comment", () => {
let clock: sinon.SinonFakeTimers;
beforeEach(() => {
const now = new Date(1999, 0, 1);
clock = sinon.useFakeTimers(now.getTime());
});
afterEach(() => {
clock.restore();
});
describe("#constructor()", () => {
it("should create", () => {
const component = new Comment({
@ -72,6 +84,37 @@ describe("Comment", () => {
],
});
});
it("should create by using default date", () => {
const component = new Comment({
id: 0,
text: "test-comment",
});
const tree = new Formatter().format(component);
expect(tree).to.deep.equal({
"w:comment": [
{ _attr: { "w:id": 0, "w:date": "1999-01-01T00:00:00.000Z" } },
{
"w:p": [
{
"w:r": [
{
"w:t": [
{
_attr: {
"xml:space": "preserve",
},
},
"test-comment",
],
},
],
},
],
},
],
});
});
});
});

View File

@ -11,10 +11,12 @@ import { ImageRun } from "./image-run";
describe("ImageRun", () => {
before(() => {
stub(convenienceFunctions, "uniqueId").callsFake(() => "test-unique-id");
stub(convenienceFunctions, "uniqueNumericId").callsFake(() => 0);
});
after(() => {
(convenienceFunctions.uniqueId as SinonStub).restore();
(convenienceFunctions.uniqueNumericId as SinonStub).restore();
});
describe("#constructor()", () => {
@ -125,6 +127,7 @@ describe("ImageRun", () => {
descr: "",
id: 0,
name: "",
title: "",
},
},
},
@ -375,6 +378,7 @@ describe("ImageRun", () => {
descr: "",
id: 0,
name: "",
title: "",
},
},
},
@ -629,6 +633,7 @@ describe("ImageRun", () => {
descr: "",
id: 0,
name: "",
title: "",
},
},
},
@ -886,6 +891,7 @@ describe("ImageRun", () => {
descr: "",
id: 0,
name: "",
title: "",
},
},
},

View File

@ -1,6 +1,7 @@
import { uniqueId } from "@util/convenience-functions";
import { IContext, IXmlableObject } from "@file/xml-components";
import { DocPropertiesOptions } from "@file/drawing/doc-properties/doc-properties";
import { Drawing, IFloating } from "../../drawing";
import { IMediaTransformation } from "../../media";
@ -11,6 +12,7 @@ export interface IImageOptions {
readonly data: Buffer | string | Uint8Array | ArrayBuffer;
readonly transformation: IMediaTransformation;
readonly floating?: IFloating;
readonly altText?: DocPropertiesOptions;
}
export class ImageRun extends Run {
@ -37,7 +39,7 @@ export class ImageRun extends Run {
rotation: options.transformation.rotation ? options.transformation.rotation * 60000 : undefined,
},
};
const drawing = new Drawing(this.imageData, { floating: options.floating });
const drawing = new Drawing(this.imageData, { floating: options.floating, docProperties: options.altText });
this.root.push(drawing);
}
@ -49,15 +51,16 @@ export class ImageRun extends Run {
}
private convertDataURIToBinary(dataURI: string): Uint8Array {
if (typeof atob === "function") {
// https://gist.github.com/borismus/1032746
// https://github.com/mafintosh/base64-to-uint8array
const BASE64_MARKER = ";base64,";
const base64Index = dataURI.indexOf(BASE64_MARKER);
const base64Index = dataURI.indexOf(BASE64_MARKER) + BASE64_MARKER.length;
const base64IndexWithOffset = base64Index === -1 ? 0 : base64Index + BASE64_MARKER.length;
if (typeof atob === "function") {
return new Uint8Array(
atob(dataURI.substring(base64Index))
atob(dataURI.substring(base64IndexWithOffset))
.split("")
.map((c) => c.charCodeAt(0)),
);

View File

@ -1,4 +1,4 @@
import { SpaceType } from "@file/space-type";
import { SpaceType } from "@file/shared";
import { XmlComponent } from "@file/xml-components";
import { TextAttributes } from "./text-attributes";

View File

@ -1,8 +1,14 @@
import { BorderElement, IBorderOptions } from "@file/border";
import { IShadingAttributesProperties, Shading } from "@file/shading";
import { SpaceType } from "@file/space-type";
import { ChangeAttributes, IChangedAttributesProperties } from "@file/track-revision/track-revision";
import { HpsMeasureElement, IgnoreIfEmptyXmlComponent, OnOffElement, StringValueElement, XmlComponent } from "@file/xml-components";
import {
HpsMeasureElement,
IgnoreIfEmptyXmlComponent,
NumberValueElement,
OnOffElement,
StringValueElement,
XmlComponent,
} from "@file/xml-components";
import { EmphasisMark, EmphasisMarkType } from "./emphasis-mark";
import { CharacterSpacing, Color, Highlight, HighlightComplexScript } from "./formatting";
@ -46,7 +52,9 @@ export interface IRunStylePropertiesOptions {
readonly imprint?: boolean;
readonly revision?: IRunPropertiesChangeOptions;
readonly border?: IBorderOptions;
readonly space?: SpaceType;
readonly vanish?: boolean;
readonly specVanish?: boolean;
readonly scale?: number;
}
export interface IRunPropertiesOptions extends IRunStylePropertiesOptions {
@ -217,6 +225,21 @@ export class RunProperties extends IgnoreIfEmptyXmlComponent {
if (options.border) {
this.push(new BorderElement("w:bdr", options.border));
}
if (options.vanish) {
// https://c-rex.net/projects/samples/ooxml/e1/Part4/OOXML_P4_DOCX_vanish_topic_ID0E6W3O.html
// http://www.datypic.com/sc/ooxml/e-w_vanish-1.html
this.push(new OnOffElement("w:vanish", options.vanish));
}
if (options.specVanish) {
// https://c-rex.net/projects/samples/ooxml/e1/Part4/OOXML_P4_DOCX_specVanish_topic_ID0EIE1O.html
this.push(new OnOffElement("w:specVanish", options.vanish));
}
if (options.scale !== undefined) {
this.push(new NumberValueElement("w:w", options.scale));
}
}
public push(item: XmlComponent): void {

View File

@ -1,6 +1,7 @@
import { expect } from "chai";
import { Formatter } from "@export/formatter";
import { SpaceType } from "@file/shared";
import { Text } from "./text";
@ -13,5 +14,26 @@ describe("Text", () => {
"w:t": [{ _attr: { "xml:space": "preserve" } }, " this is\n text"],
});
});
it("adds the passed in text to the component with options", () => {
const t = new Text({
text: " this is\n text",
space: SpaceType.PRESERVE,
});
const f = new Formatter().format(t);
expect(f).to.deep.equal({
"w:t": [{ _attr: { "xml:space": "preserve" } }, " this is\n text"],
});
});
it("adds the passed in text to the component with options and sets default space type", () => {
const t = new Text({
text: " this is\n text",
});
const f = new Formatter().format(t);
expect(f).to.deep.equal({
"w:t": [{ _attr: { "xml:space": "default" } }, " this is\n text"],
});
});
});
});

View File

@ -1,13 +1,33 @@
import { SpaceType } from "@file/space-type";
import { SpaceType } from "@file/shared";
import { XmlComponent } from "@file/xml-components";
import { TextAttributes } from "../text-attributes";
export class Text extends XmlComponent {
public constructor(text: string) {
super("w:t");
this.root.push(new TextAttributes({ space: SpaceType.PRESERVE }));
// <xsd:complexType name="CT_Text">
// <xsd:simpleContent>
// <xsd:extension base="s:ST_String">
// <xsd:attribute ref="xml:space" use="optional" />
// </xsd:extension>
// </xsd:simpleContent>
// </xsd:complexType>
this.root.push(text);
interface ITextOptions {
readonly space?: SpaceType;
readonly text?: string;
}
export class Text extends XmlComponent {
public constructor(options: string | ITextOptions) {
super("w:t");
if (typeof options === "string") {
this.root.push(new TextAttributes({ space: SpaceType.PRESERVE }));
this.root.push(options);
return this;
} else {
this.root.push(new TextAttributes({ space: options.space ?? SpaceType.DEFAULT }));
this.root.push(options.text);
return this;
}
}
}

View File

@ -3,7 +3,6 @@ import { expect } from "chai";
import { Formatter } from "@export/formatter";
import { BorderStyle } from "@file/border";
import { ShadingType } from "@file/shading";
import { SpaceType } from "@file/space-type";
import { EmphasisMarkType } from "./emphasis-mark";
import { PageNumber, Run } from "./run";
@ -521,18 +520,64 @@ describe("Run", () => {
});
});
describe("#space", () => {
it("should correctly set the border", () => {
describe("#vanish and #specVanish", () => {
it("should correctly set vanish", () => {
const run = new Run({
space: SpaceType.PRESERVE,
vanish: true,
});
const tree = new Formatter().format(run);
expect(tree).to.deep.equal({
"w:r": {
"w:r": [
{
"w:rPr": [
{
"w:vanish": {},
},
],
},
],
});
});
it("should correctly set specVanish", () => {
const run = new Run({
specVanish: true,
});
const tree = new Formatter().format(run);
expect(tree).to.deep.equal({
"w:r": [
{
"w:rPr": [
{
"w:specVanish": {},
},
],
},
],
});
});
describe("#scale", () => {
it("should correctly set the border", () => {
const run = new Run({
scale: 200,
});
const tree = new Formatter().format(run);
expect(tree).to.deep.equal({
"w:r": [
{
"w:rPr": [
{
"w:w": {
_attr: {
"xml:space": "preserve",
"w:val": 200,
},
},
},
],
},
],
});
});
});
});

View File

@ -9,10 +9,10 @@ import { Begin, End, Separate } from "./field";
import { NumberOfPages, NumberOfPagesSection, Page } from "./page-number";
import { IRunPropertiesOptions, RunProperties } from "./properties";
import { Text } from "./run-components/text";
import { TextAttributes } from "./text-attributes";
import { Tab } from "./tab";
export interface IRunOptions extends IRunPropertiesOptions {
readonly children?: readonly (Begin | FieldInstruction | Separate | End | PageNumber | FootnoteReferenceRun | string)[];
readonly children?: readonly (Begin | FieldInstruction | Separate | End | PageNumber | FootnoteReferenceRun | Tab | string)[];
readonly break?: number;
readonly text?: string;
}
@ -37,10 +37,6 @@ export class Run extends XmlComponent {
}
}
if (options.space) {
this.root.push(new TextAttributes({ space: options.space }));
}
if (options.children) {
for (const child of options.children) {
if (typeof child === "string") {

View File

@ -1,5 +1,5 @@
// http://officeopenxml.com/WPfieldInstructions.php
import { SpaceType } from "@file/space-type";
import { SpaceType } from "@file/shared";
import { XmlComponent } from "@file/xml-components";
import { TextAttributes } from "./text-attributes";

View File

@ -1,3 +1,4 @@
// https://c-rex.net/projects/samples/ooxml/e1/Part4/OOXML_P4_DOCX_tab_topic_ID0EM6AO.html
import { XmlComponent } from "@file/xml-components";
// <xsd:group name="EG_RunInnerContent">

View File

@ -1,4 +1,4 @@
import { SpaceType } from "@file/space-type";
import { SpaceType } from "@file/shared";
import { XmlAttributeComponent } from "@file/xml-components";
export class TextAttributes extends XmlAttributeComponent<{ readonly space: SpaceType }> {

View File

@ -19,6 +19,7 @@ export enum UnderlineType {
WAVE = "wave",
WAVYHEAVY = "wavyHeavy",
WAVYDOUBLE = "wavyDouble",
NONE = "none",
}
export class Underline extends XmlComponent {

View File

@ -1,7 +1,6 @@
import { expect } from "chai";
import { Formatter } from "@export/formatter";
import { EMPTY_OBJECT } from "@file/xml-components";
import { Compatibility } from "./compatibility";
@ -11,7 +10,140 @@ describe("Compatibility", () => {
const compatibility = new Compatibility({});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": EMPTY_OBJECT });
expect(tree).to.deep.equal({ "w:compat": {} });
});
});
describe("#version", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
version: 10,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({
"w:compat": [
{
"w:compatSetting": {
_attr: {
"w:name": "compatibilityMode",
"w:uri": "http://schemas.microsoft.com/office/word",
"w:val": 10,
},
},
},
],
});
});
});
describe("#useSingleBorderforContiguousCells", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
useSingleBorderforContiguousCells: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:useSingleBorderforContiguousCells": {} }] });
});
});
describe("#wordPerfectJustification", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
wordPerfectJustification: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:wpJustification": {} }] });
});
});
describe("#noTabStopForHangingIndent", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
noTabStopForHangingIndent: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:noTabHangInd": {} }] });
});
});
describe("#noLeading", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
noLeading: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:noLeading": {} }] });
});
});
describe("#spaceForUnderline", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
spaceForUnderline: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:spaceForUL": {} }] });
});
});
describe("#noColumnBalance", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
noColumnBalance: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:noColumnBalance": {} }] });
});
});
describe("#balanceSingleByteDoubleByteWidth", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
balanceSingleByteDoubleByteWidth: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:balanceSingleByteDoubleByteWidth": {} }] });
});
});
describe("#noExtraLineSpacing", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
noExtraLineSpacing: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:noExtraLineSpacing": {} }] });
});
});
describe("#doNotLeaveBackslashAlone", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
doNotLeaveBackslashAlone: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:doNotLeaveBackslashAlone": {} }] });
});
});
describe("#underlineTrailingSpaces", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
underlineTrailingSpaces: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:ulTrailSpace": {} }] });
});
});
@ -22,7 +154,601 @@ describe("Compatibility", () => {
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:doNotExpandShiftReturn": EMPTY_OBJECT }] });
expect(tree).to.deep.equal({ "w:compat": [{ "w:doNotExpandShiftReturn": {} }] });
});
});
describe("#spacingInWholePoints", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
spacingInWholePoints: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:spacingInWholePoints": {} }] });
});
});
describe("#lineWrapLikeWord6", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
lineWrapLikeWord6: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:lineWrapLikeWord6": {} }] });
});
});
describe("#printBodyTextBeforeHeader", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
printBodyTextBeforeHeader: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:printBodyTextBeforeHeader": {} }] });
});
});
describe("#printColorsBlack", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
printColorsBlack: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:printColBlack": {} }] });
});
});
describe("#spaceWidth", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
spaceWidth: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:wpSpaceWidth": {} }] });
});
});
describe("#showBreaksInFrames", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
showBreaksInFrames: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:showBreaksInFrames": {} }] });
});
});
describe("#subFontBySize", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
subFontBySize: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:subFontBySize": {} }] });
});
});
describe("#suppressBottomSpacing", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
suppressBottomSpacing: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:suppressBottomSpacing": {} }] });
});
});
describe("#suppressTopSpacing", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
suppressTopSpacing: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:suppressTopSpacing": {} }] });
});
});
describe("#suppressSpacingAtTopOfPage", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
suppressSpacingAtTopOfPage: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:suppressSpacingAtTopOfPage": {} }] });
});
});
describe("#suppressTopSpacingWP", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
suppressTopSpacingWP: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:suppressTopSpacingWP": {} }] });
});
});
describe("#suppressSpBfAfterPgBrk", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
suppressSpBfAfterPgBrk: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:suppressSpBfAfterPgBrk": {} }] });
});
});
describe("#swapBordersFacingPages", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
swapBordersFacingPages: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:swapBordersFacingPages": {} }] });
});
});
describe("#convertMailMergeEsc", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
convertMailMergeEsc: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:convMailMergeEsc": {} }] });
});
});
describe("#truncateFontHeightsLikeWP6", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
truncateFontHeightsLikeWP6: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:truncateFontHeightsLikeWP6": {} }] });
});
});
describe("#macWordSmallCaps", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
macWordSmallCaps: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:mwSmallCaps": {} }] });
});
});
describe("#usePrinterMetrics", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
usePrinterMetrics: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:usePrinterMetrics": {} }] });
});
});
describe("#doNotSuppressParagraphBorders", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
doNotSuppressParagraphBorders: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:doNotSuppressParagraphBorders": {} }] });
});
});
describe("#wrapTrailSpaces", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
wrapTrailSpaces: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:wrapTrailSpaces": {} }] });
});
});
describe("#footnoteLayoutLikeWW8", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
footnoteLayoutLikeWW8: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:footnoteLayoutLikeWW8": {} }] });
});
});
describe("#shapeLayoutLikeWW8", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
shapeLayoutLikeWW8: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:shapeLayoutLikeWW8": {} }] });
});
});
describe("#alignTablesRowByRow", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
alignTablesRowByRow: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:alignTablesRowByRow": {} }] });
});
});
describe("#forgetLastTabAlignment", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
forgetLastTabAlignment: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:forgetLastTabAlignment": {} }] });
});
});
describe("#adjustLineHeightInTable", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
adjustLineHeightInTable: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:adjustLineHeightInTable": {} }] });
});
});
describe("#autoSpaceLikeWord95", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
autoSpaceLikeWord95: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:autoSpaceLikeWord95": {} }] });
});
});
describe("#noSpaceRaiseLower", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
noSpaceRaiseLower: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:noSpaceRaiseLower": {} }] });
});
});
describe("#doNotUseHTMLParagraphAutoSpacing", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
doNotUseHTMLParagraphAutoSpacing: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:doNotUseHTMLParagraphAutoSpacing": {} }] });
});
});
describe("#layoutRawTableWidth", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
layoutRawTableWidth: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:layoutRawTableWidth": {} }] });
});
});
describe("#layoutTableRowsApart", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
layoutTableRowsApart: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:layoutTableRowsApart": {} }] });
});
});
describe("#useWord97LineBreakRules", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
useWord97LineBreakRules: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:useWord97LineBreakRules": {} }] });
});
});
describe("#doNotBreakWrappedTables", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
doNotBreakWrappedTables: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:doNotBreakWrappedTables": {} }] });
});
});
describe("#doNotSnapToGridInCell", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
doNotSnapToGridInCell: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:doNotSnapToGridInCell": {} }] });
});
});
describe("#selectFieldWithFirstOrLastCharacter", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
selectFieldWithFirstOrLastCharacter: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:selectFldWithFirstOrLastChar": {} }] });
});
});
describe("#applyBreakingRules", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
applyBreakingRules: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:applyBreakingRules": {} }] });
});
});
describe("#doNotWrapTextWithPunctuation", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
doNotWrapTextWithPunctuation: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:doNotWrapTextWithPunct": {} }] });
});
});
describe("#doNotUseEastAsianBreakRules", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
doNotUseEastAsianBreakRules: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:doNotUseEastAsianBreakRules": {} }] });
});
});
describe("#useWord2002TableStyleRules", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
useWord2002TableStyleRules: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:useWord2002TableStyleRules": {} }] });
});
});
describe("#growAutofit", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
growAutofit: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:growAutofit": {} }] });
});
});
describe("#useFELayout", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
useFELayout: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:useFELayout": {} }] });
});
});
describe("#useNormalStyleForList", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
useNormalStyleForList: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:useNormalStyleForList": {} }] });
});
});
describe("#doNotUseIndentAsNumberingTabStop", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
doNotUseIndentAsNumberingTabStop: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:doNotUseIndentAsNumberingTabStop": {} }] });
});
});
describe("#useAlternateEastAsianLineBreakRules", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
useAlternateEastAsianLineBreakRules: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:useAltKinsokuLineBreakRules": {} }] });
});
});
describe("#allowSpaceOfSameStyleInTable", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
allowSpaceOfSameStyleInTable: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:allowSpaceOfSameStyleInTable": {} }] });
});
});
describe("#doNotSuppressIndentation", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
doNotSuppressIndentation: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:doNotSuppressIndentation": {} }] });
});
});
describe("#doNotAutofitConstrainedTables", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
doNotAutofitConstrainedTables: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:doNotAutofitConstrainedTables": {} }] });
});
});
describe("#autofitToFirstFixedWidthCell", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
autofitToFirstFixedWidthCell: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:autofitToFirstFixedWidthCell": {} }] });
});
});
describe("#underlineTabInNumberingList", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
underlineTabInNumberingList: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:underlineTabInNumList": {} }] });
});
});
describe("#displayHangulFixedWidth", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
displayHangulFixedWidth: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:displayHangulFixedWidth": {} }] });
});
});
describe("#splitPgBreakAndParaMark", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
splitPgBreakAndParaMark: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:splitPgBreakAndParaMark": {} }] });
});
});
describe("#doNotVerticallyAlignCellWithSp", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
doNotVerticallyAlignCellWithSp: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:doNotVertAlignCellWithSp": {} }] });
});
});
describe("#doNotBreakConstrainedForcedTable", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
doNotBreakConstrainedForcedTable: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:doNotBreakConstrainedForcedTable": {} }] });
});
});
describe("#ignoreVerticalAlignmentInTextboxes", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
ignoreVerticalAlignmentInTextboxes: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:doNotVertAlignInTxbx": {} }] });
});
});
describe("#useAnsiKerningPairs", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
useAnsiKerningPairs: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:useAnsiKerningPairs": {} }] });
});
});
describe("#cachedColumnBalance", () => {
it("should create a setting for not justifying lines ending in soft line break", () => {
const compatibility = new Compatibility({
cachedColumnBalance: true,
});
const tree = new Formatter().format(compatibility);
expect(tree).to.deep.equal({ "w:compat": [{ "w:cachedColBalance": {} }] });
});
});
});

View File

@ -1,3 +1,4 @@
// http://www.datypic.com/sc/ooxml/e-w_compat-1.html
import { OnOffElement, XmlComponent } from "@file/xml-components";
import { CompatibilitySetting } from "./compatibility-setting/compatibility-setting";
@ -74,21 +75,405 @@ import { CompatibilitySetting } from "./compatibility-setting/compatibility-sett
// </xsd:complexType>
export interface ICompatibilityOptions {
readonly doNotExpandShiftReturn?: boolean;
readonly version?: number;
/** Use Simplified Rules For Table Border Conflicts */
readonly useSingleBorderforContiguousCells?: boolean;
/** Emulate WordPerfect 6.x Paragraph Justification */
readonly wordPerfectJustification?: boolean;
/** Do Not Create Custom Tab Stop for Hanging Indent */
readonly noTabStopForHangingIndent?: boolean;
/** Do Not Add Leading Between Lines of Text */
readonly noLeading?: boolean;
/** Add Additional Space Below Baseline For Underlined East Asian Text */
readonly spaceForUnderline?: boolean;
/** Do Not Balance Text Columns within a Section */
readonly noColumnBalance?: boolean;
/** Balance Single Byte and Double Byte Characters */
readonly balanceSingleByteDoubleByteWidth?: boolean;
/** Do Not Center Content on Lines With Exact Line Height */
readonly noExtraLineSpacing?: boolean;
/** Convert Backslash To Yen Sign When Entered */
readonly doNotLeaveBackslashAlone?: boolean;
/** Underline All Trailing Spaces */
readonly underlineTrailingSpaces?: boolean;
/** Don't Justify Lines Ending in Soft Line Break */
readonly doNotExpandShiftReturn?: boolean;
/** Only Expand/Condense Text By Whole Points */
readonly spacingInWholePoints?: boolean;
/** Emulate Word 6.0 Line Wrapping for East Asian Text */
readonly lineWrapLikeWord6?: boolean;
/** Print Body Text before Header/Footer Contents */
readonly printBodyTextBeforeHeader?: boolean;
/** Print Colors as Black And White without Dithering */
readonly printColorsBlack?: boolean;
/** Space width */
readonly spaceWidth?: boolean;
/** Display Page/Column Breaks Present in Frames */
readonly showBreaksInFrames?: boolean;
/** Increase Priority Of Font Size During Font Substitution */
readonly subFontBySize?: boolean;
/** Ignore Exact Line Height for Last Line on Page */
readonly suppressBottomSpacing?: boolean;
/** Ignore Minimum and Exact Line Height for First Line on Page */
readonly suppressTopSpacing?: boolean;
/** Ignore Minimum Line Height for First Line on Page */
readonly suppressSpacingAtTopOfPage?: boolean;
/** Emulate WordPerfect 5.x Line Spacing */
readonly suppressTopSpacingWP?: boolean;
/** Do Not Use Space Before On First Line After a Page Break */
readonly suppressSpBfAfterPgBrk?: boolean;
/** Swap Paragraph Borders on Odd Numbered Pages */
readonly swapBordersFacingPages?: boolean;
/** Treat Backslash Quotation Delimiter as Two Quotation Marks */
readonly convertMailMergeEsc?: boolean;
/** Emulate WordPerfect 6.x Font Height Calculation */
readonly truncateFontHeightsLikeWP6?: boolean;
/** Emulate Word 5.x for the Macintosh Small Caps Formatting */
readonly macWordSmallCaps?: boolean;
/** Use Printer Metrics To Display Documents */
readonly usePrinterMetrics?: boolean;
/** Do Not Suppress Paragraph Borders Next To Frames */
readonly doNotSuppressParagraphBorders?: boolean;
/** Line Wrap Trailing Spaces */
readonly wrapTrailSpaces?: boolean;
/** Emulate Word 6.x/95/97 Footnote Placement */
readonly footnoteLayoutLikeWW8?: boolean;
/** Emulate Word 97 Text Wrapping Around Floating Objects */
readonly shapeLayoutLikeWW8?: boolean;
/** Align Table Rows Independently */
readonly alignTablesRowByRow?: boolean;
/** Ignore Width of Last Tab Stop When Aligning Paragraph If It Is Not Left Aligned */
readonly forgetLastTabAlignment?: boolean;
/** Add Document Grid Line Pitch To Lines in Table Cells */
readonly adjustLineHeightInTable?: boolean;
/** Emulate Word 95 Full-Width Character Spacing */
readonly autoSpaceLikeWord95?: boolean;
/** Do Not Increase Line Height for Raised/Lowered Text */
readonly noSpaceRaiseLower?: boolean;
/** Use Fixed Paragraph Spacing for HTML Auto Setting */
readonly doNotUseHTMLParagraphAutoSpacing?: boolean;
/** Ignore Space Before Table When Deciding If Table Should Wrap Floating Object */
readonly layoutRawTableWidth?: boolean;
/** Allow Table Rows to Wrap Inline Objects Independently */
readonly layoutTableRowsApart?: boolean;
/** Emulate Word 97 East Asian Line Breaking */
readonly useWord97LineBreakRules?: boolean;
/** Do Not Allow Floating Tables To Break Across Pages */
readonly doNotBreakWrappedTables?: boolean;
/** Do Not Snap to Document Grid in Table Cells with Objects */
readonly doNotSnapToGridInCell?: boolean;
/** Select Field When First or Last Character Is Selected */
readonly selectFieldWithFirstOrLastCharacter?: boolean;
/** Use Legacy Ethiopic and Amharic Line Breaking Rules */
readonly applyBreakingRules?: boolean;
/** Do Not Allow Hanging Punctuation With Character Grid */
readonly doNotWrapTextWithPunctuation?: boolean;
/** Do Not Compress Compressible Characters When Using Document Grid */
readonly doNotUseEastAsianBreakRules?: boolean;
/** Emulate Word 2002 Table Style Rules */
readonly useWord2002TableStyleRules?: boolean;
/** Allow Tables to AutoFit Into Page Margins */
readonly growAutofit?: boolean;
/** Do Not Bypass East Asian/Complex Script Layout Code */
readonly useFELayout?: boolean;
/** Do Not Automatically Apply List Paragraph Style To Bulleted/Numbered Text */
readonly useNormalStyleForList?: boolean;
/** Ignore Hanging Indent When Creating Tab Stop After Numbering */
readonly doNotUseIndentAsNumberingTabStop?: boolean;
/** Use Alternate Set of East Asian Line Breaking Rules */
readonly useAlternateEastAsianLineBreakRules?: boolean;
/** Allow Contextual Spacing of Paragraphs in Tables */
readonly allowSpaceOfSameStyleInTable?: boolean;
/** Do Not Ignore Floating Objects When Calculating Paragraph Indentation */
readonly doNotSuppressIndentation?: boolean;
/** Do Not AutoFit Tables To Fit Next To Wrapped Objects */
readonly doNotAutofitConstrainedTables?: boolean;
/** Allow Table Columns To Exceed Preferred Widths of Constituent Cells */
readonly autofitToFirstFixedWidthCell?: boolean;
/** Underline Following Character Following Numbering */
readonly underlineTabInNumberingList?: boolean;
/** Always Use Fixed Width for Hangul Characters */
readonly displayHangulFixedWidth?: boolean;
/** Always Move Paragraph Mark to Page after a Page Break */
readonly splitPgBreakAndParaMark?: boolean;
/** Don't Vertically Align Cells Containing Floating Objects */
readonly doNotVerticallyAlignCellWithSp?: boolean;
/** Don't Break Table Rows Around Floating Tables */
readonly doNotBreakConstrainedForcedTable?: boolean;
/** Ignore Vertical Alignment in Textboxes */
readonly ignoreVerticalAlignmentInTextboxes?: boolean;
/** Use ANSI Kerning Pairs from Fonts */
readonly useAnsiKerningPairs?: boolean;
/** Use Cached Paragraph Information for Column Balancing */
readonly cachedColumnBalance?: boolean;
}
export class Compatibility extends XmlComponent {
public constructor(options: ICompatibilityOptions) {
super("w:compat");
// Don't justify lines ending in soft line break setting
if (options.doNotExpandShiftReturn !== undefined) {
this.root.push(new OnOffElement("w:doNotExpandShiftReturn", options.doNotExpandShiftReturn));
}
if (options.version) {
this.root.push(new CompatibilitySetting(options.version));
}
if (options.useSingleBorderforContiguousCells) {
this.root.push(new OnOffElement("w:useSingleBorderforContiguousCells", options.useSingleBorderforContiguousCells));
}
if (options.wordPerfectJustification) {
this.root.push(new OnOffElement("w:wpJustification", options.wordPerfectJustification));
}
if (options.noTabStopForHangingIndent) {
this.root.push(new OnOffElement("w:noTabHangInd", options.noTabStopForHangingIndent));
}
if (options.noLeading) {
this.root.push(new OnOffElement("w:noLeading", options.noLeading));
}
if (options.spaceForUnderline) {
this.root.push(new OnOffElement("w:spaceForUL", options.spaceForUnderline));
}
if (options.noColumnBalance) {
this.root.push(new OnOffElement("w:noColumnBalance", options.noColumnBalance));
}
if (options.balanceSingleByteDoubleByteWidth) {
this.root.push(new OnOffElement("w:balanceSingleByteDoubleByteWidth", options.balanceSingleByteDoubleByteWidth));
}
if (options.noExtraLineSpacing) {
this.root.push(new OnOffElement("w:noExtraLineSpacing", options.noExtraLineSpacing));
}
if (options.doNotLeaveBackslashAlone) {
this.root.push(new OnOffElement("w:doNotLeaveBackslashAlone", options.doNotLeaveBackslashAlone));
}
if (options.underlineTrailingSpaces) {
this.root.push(new OnOffElement("w:ulTrailSpace", options.underlineTrailingSpaces));
}
if (options.doNotExpandShiftReturn) {
this.root.push(new OnOffElement("w:doNotExpandShiftReturn", options.doNotExpandShiftReturn));
}
if (options.spacingInWholePoints) {
this.root.push(new OnOffElement("w:spacingInWholePoints", options.spacingInWholePoints));
}
if (options.lineWrapLikeWord6) {
this.root.push(new OnOffElement("w:lineWrapLikeWord6", options.lineWrapLikeWord6));
}
if (options.printBodyTextBeforeHeader) {
this.root.push(new OnOffElement("w:printBodyTextBeforeHeader", options.printBodyTextBeforeHeader));
}
if (options.printColorsBlack) {
this.root.push(new OnOffElement("w:printColBlack", options.printColorsBlack));
}
if (options.spaceWidth) {
this.root.push(new OnOffElement("w:wpSpaceWidth", options.spaceWidth));
}
if (options.showBreaksInFrames) {
this.root.push(new OnOffElement("w:showBreaksInFrames", options.showBreaksInFrames));
}
if (options.subFontBySize) {
this.root.push(new OnOffElement("w:subFontBySize", options.subFontBySize));
}
if (options.suppressBottomSpacing) {
this.root.push(new OnOffElement("w:suppressBottomSpacing", options.suppressBottomSpacing));
}
if (options.suppressTopSpacing) {
this.root.push(new OnOffElement("w:suppressTopSpacing", options.suppressTopSpacing));
}
if (options.suppressSpacingAtTopOfPage) {
this.root.push(new OnOffElement("w:suppressSpacingAtTopOfPage", options.suppressSpacingAtTopOfPage));
}
if (options.suppressTopSpacingWP) {
this.root.push(new OnOffElement("w:suppressTopSpacingWP", options.suppressTopSpacingWP));
}
if (options.suppressSpBfAfterPgBrk) {
this.root.push(new OnOffElement("w:suppressSpBfAfterPgBrk", options.suppressSpBfAfterPgBrk));
}
if (options.swapBordersFacingPages) {
this.root.push(new OnOffElement("w:swapBordersFacingPages", options.swapBordersFacingPages));
}
if (options.convertMailMergeEsc) {
this.root.push(new OnOffElement("w:convMailMergeEsc", options.convertMailMergeEsc));
}
if (options.truncateFontHeightsLikeWP6) {
this.root.push(new OnOffElement("w:truncateFontHeightsLikeWP6", options.truncateFontHeightsLikeWP6));
}
if (options.macWordSmallCaps) {
this.root.push(new OnOffElement("w:mwSmallCaps", options.macWordSmallCaps));
}
if (options.usePrinterMetrics) {
this.root.push(new OnOffElement("w:usePrinterMetrics", options.usePrinterMetrics));
}
if (options.doNotSuppressParagraphBorders) {
this.root.push(new OnOffElement("w:doNotSuppressParagraphBorders", options.doNotSuppressParagraphBorders));
}
if (options.wrapTrailSpaces) {
this.root.push(new OnOffElement("w:wrapTrailSpaces", options.wrapTrailSpaces));
}
if (options.footnoteLayoutLikeWW8) {
this.root.push(new OnOffElement("w:footnoteLayoutLikeWW8", options.footnoteLayoutLikeWW8));
}
if (options.shapeLayoutLikeWW8) {
this.root.push(new OnOffElement("w:shapeLayoutLikeWW8", options.shapeLayoutLikeWW8));
}
if (options.alignTablesRowByRow) {
this.root.push(new OnOffElement("w:alignTablesRowByRow", options.alignTablesRowByRow));
}
if (options.forgetLastTabAlignment) {
this.root.push(new OnOffElement("w:forgetLastTabAlignment", options.forgetLastTabAlignment));
}
if (options.adjustLineHeightInTable) {
this.root.push(new OnOffElement("w:adjustLineHeightInTable", options.adjustLineHeightInTable));
}
if (options.autoSpaceLikeWord95) {
this.root.push(new OnOffElement("w:autoSpaceLikeWord95", options.autoSpaceLikeWord95));
}
if (options.noSpaceRaiseLower) {
this.root.push(new OnOffElement("w:noSpaceRaiseLower", options.noSpaceRaiseLower));
}
if (options.doNotUseHTMLParagraphAutoSpacing) {
this.root.push(new OnOffElement("w:doNotUseHTMLParagraphAutoSpacing", options.doNotUseHTMLParagraphAutoSpacing));
}
if (options.layoutRawTableWidth) {
this.root.push(new OnOffElement("w:layoutRawTableWidth", options.layoutRawTableWidth));
}
if (options.layoutTableRowsApart) {
this.root.push(new OnOffElement("w:layoutTableRowsApart", options.layoutTableRowsApart));
}
if (options.useWord97LineBreakRules) {
this.root.push(new OnOffElement("w:useWord97LineBreakRules", options.useWord97LineBreakRules));
}
if (options.doNotBreakWrappedTables) {
this.root.push(new OnOffElement("w:doNotBreakWrappedTables", options.doNotBreakWrappedTables));
}
if (options.doNotSnapToGridInCell) {
this.root.push(new OnOffElement("w:doNotSnapToGridInCell", options.doNotSnapToGridInCell));
}
if (options.selectFieldWithFirstOrLastCharacter) {
this.root.push(new OnOffElement("w:selectFldWithFirstOrLastChar", options.selectFieldWithFirstOrLastCharacter));
}
if (options.applyBreakingRules) {
this.root.push(new OnOffElement("w:applyBreakingRules", options.applyBreakingRules));
}
if (options.doNotWrapTextWithPunctuation) {
this.root.push(new OnOffElement("w:doNotWrapTextWithPunct", options.doNotWrapTextWithPunctuation));
}
if (options.doNotUseEastAsianBreakRules) {
this.root.push(new OnOffElement("w:doNotUseEastAsianBreakRules", options.doNotUseEastAsianBreakRules));
}
if (options.useWord2002TableStyleRules) {
this.root.push(new OnOffElement("w:useWord2002TableStyleRules", options.useWord2002TableStyleRules));
}
if (options.growAutofit) {
this.root.push(new OnOffElement("w:growAutofit", options.growAutofit));
}
if (options.useFELayout) {
this.root.push(new OnOffElement("w:useFELayout", options.useFELayout));
}
if (options.useNormalStyleForList) {
this.root.push(new OnOffElement("w:useNormalStyleForList", options.useNormalStyleForList));
}
if (options.doNotUseIndentAsNumberingTabStop) {
this.root.push(new OnOffElement("w:doNotUseIndentAsNumberingTabStop", options.doNotUseIndentAsNumberingTabStop));
}
if (options.useAlternateEastAsianLineBreakRules) {
this.root.push(new OnOffElement("w:useAltKinsokuLineBreakRules", options.useAlternateEastAsianLineBreakRules));
}
if (options.allowSpaceOfSameStyleInTable) {
this.root.push(new OnOffElement("w:allowSpaceOfSameStyleInTable", options.allowSpaceOfSameStyleInTable));
}
if (options.doNotSuppressIndentation) {
this.root.push(new OnOffElement("w:doNotSuppressIndentation", options.doNotSuppressIndentation));
}
if (options.doNotAutofitConstrainedTables) {
this.root.push(new OnOffElement("w:doNotAutofitConstrainedTables", options.doNotAutofitConstrainedTables));
}
if (options.autofitToFirstFixedWidthCell) {
this.root.push(new OnOffElement("w:autofitToFirstFixedWidthCell", options.autofitToFirstFixedWidthCell));
}
if (options.underlineTabInNumberingList) {
this.root.push(new OnOffElement("w:underlineTabInNumList", options.underlineTabInNumberingList));
}
if (options.displayHangulFixedWidth) {
this.root.push(new OnOffElement("w:displayHangulFixedWidth", options.displayHangulFixedWidth));
}
if (options.splitPgBreakAndParaMark) {
this.root.push(new OnOffElement("w:splitPgBreakAndParaMark", options.splitPgBreakAndParaMark));
}
if (options.doNotVerticallyAlignCellWithSp) {
this.root.push(new OnOffElement("w:doNotVertAlignCellWithSp", options.doNotVerticallyAlignCellWithSp));
}
if (options.doNotBreakConstrainedForcedTable) {
this.root.push(new OnOffElement("w:doNotBreakConstrainedForcedTable", options.doNotBreakConstrainedForcedTable));
}
if (options.ignoreVerticalAlignmentInTextboxes) {
this.root.push(new OnOffElement("w:doNotVertAlignInTxbx", options.ignoreVerticalAlignmentInTextboxes));
}
if (options.useAnsiKerningPairs) {
this.root.push(new OnOffElement("w:useAnsiKerningPairs", options.useAnsiKerningPairs));
}
if (options.cachedColumnBalance) {
this.root.push(new OnOffElement("w:cachedColBalance", options.cachedColumnBalance));
}
}
}

View File

@ -61,5 +61,80 @@ describe("Settings", () => {
"w:trackRevisions": {},
});
});
it("should add compatibility setting with default compatability version", () => {
const settings = new Settings({
compatibility: {},
});
const tree = new Formatter().format(settings);
expect(Object.keys(tree)).has.length(1);
expect(tree["w:settings"]).to.be.an("array");
expect(tree["w:settings"]).to.deep.include({
"w:compat": [
{
"w:compatSetting": {
_attr: {
"w:name": "compatibilityMode",
"w:uri": "http://schemas.microsoft.com/office/word",
"w:val": 15,
},
},
},
],
});
});
it("should add compatibility setting with version", () => {
const settings = new Settings({
compatibility: {
version: 99,
},
});
const tree = new Formatter().format(settings);
expect(Object.keys(tree)).has.length(1);
expect(tree["w:settings"]).to.be.an("array");
expect(tree["w:settings"]).to.deep.include({
"w:compat": [
{
"w:compatSetting": {
_attr: {
"w:name": "compatibilityMode",
"w:uri": "http://schemas.microsoft.com/office/word",
"w:val": 99,
},
},
},
],
});
});
// TODO: Remove when deprecating compatibilityModeVersion
it("should add compatibility setting with legacy version", () => {
const settings = new Settings({
compatibilityModeVersion: 99,
});
const tree = new Formatter().format(settings);
expect(Object.keys(tree)).has.length(1);
expect(tree["w:settings"]).to.be.an("array");
expect(tree["w:settings"]).to.deep.include({
"w:compat": [
{
"w:compatSetting": {
_attr: {
"w:name": "compatibilityMode",
"w:uri": "http://schemas.microsoft.com/office/word",
"w:val": 99,
},
},
},
],
});
});
});
});

View File

@ -1,6 +1,6 @@
import { OnOffElement, XmlAttributeComponent, XmlComponent } from "@file/xml-components";
import { Compatibility } from "./compatibility";
import { Compatibility, ICompatibilityOptions } from "./compatibility";
export class SettingsAttributes extends XmlAttributeComponent<{
readonly wpc?: string;
@ -147,10 +147,11 @@ export class SettingsAttributes extends XmlAttributeComponent<{
// </xsd:complexType>
export interface ISettingsOptions {
readonly compatabilityModeVersion?: number;
readonly compatibilityModeVersion?: number;
readonly evenAndOddHeaders?: boolean;
readonly trackRevisions?: boolean;
readonly updateFields?: boolean;
readonly compatibility?: ICompatibilityOptions;
}
export class Settings extends XmlComponent {
@ -199,7 +200,8 @@ export class Settings extends XmlComponent {
this.root.push(
new Compatibility({
version: options.compatabilityModeVersion || 15,
...(options.compatibility ?? {}),
version: options.compatibility?.version ?? options.compatibilityModeVersion ?? 15,
}),
);
}

View File

@ -1,2 +1,3 @@
export * from "./alignment";
export * from "./number-format";
export * from "./space-type";

View File

@ -1,12 +0,0 @@
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
class AliasAttributes extends XmlAttributeComponent<{ readonly alias: string }> {
protected readonly xmlKeys = { alias: "w:val" };
}
export class Alias extends XmlComponent {
public constructor(alias: string) {
super("w:alias");
this.root.push(new AliasAttributes({ alias }));
}
}

View File

@ -1,6 +1,6 @@
// http://officeopenxml.com/WPfieldInstructions.php
import { TextAttributes } from "@file/paragraph/run/text-attributes";
import { SpaceType } from "@file/space-type";
import { SpaceType } from "@file/shared";
import { XmlComponent } from "@file/xml-components";
import { ITableOfContentsOptions } from "./table-of-contents-properties";

View File

@ -1,10 +1,9 @@
// http://www.datypic.com/sc/ooxml/e-w_sdtPr-1.html
import { XmlComponent } from "@file/xml-components";
import { Alias } from "./alias";
import { StringValueElement, XmlComponent } from "@file/xml-components";
export class StructuredDocumentTagProperties extends XmlComponent {
public constructor(alias: string) {
super("w:sdtPr");
this.root.push(new Alias(alias));
this.root.push(new StringValueElement("w:alias", alias));
}
}

View File

@ -2,4 +2,3 @@ export * from "./table-properties";
export * from "./table-float-properties";
export * from "./table-layout";
export * from "./table-borders";
export * from "./table-overlap";

View File

@ -2,8 +2,13 @@ import { expect } from "chai";
import { Formatter } from "@export/formatter";
import { RelativeHorizontalPosition, RelativeVerticalPosition, TableAnchorType, TableFloatProperties } from "./table-float-properties";
import { OverlapType } from "./table-overlap";
import {
OverlapType,
RelativeHorizontalPosition,
RelativeVerticalPosition,
TableAnchorType,
TableFloatProperties,
} from "./table-float-properties";
describe("Table Float Properties", () => {
describe("#constructor", () => {

View File

@ -1,8 +1,6 @@
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
import { StringEnumValueElement, XmlAttributeComponent, XmlComponent } from "@file/xml-components";
import { signedTwipsMeasureValue, twipsMeasureValue } from "@util/values";
import { OverlapType, TableOverlap } from "./table-overlap";
export enum TableAnchorType {
MARGIN = "margin",
PAGE = "page",
@ -26,6 +24,17 @@ export enum RelativeVerticalPosition {
TOP = "top",
}
// <xsd:simpleType name="ST_TblOverlap">
// <xsd:restriction base="xsd:string">
// <xsd:enumeration value="never"/>
// <xsd:enumeration value="overlap"/>
// </xsd:restriction>
// </xsd:simpleType>
export enum OverlapType {
NEVER = "never",
OVERLAP = "overlap",
}
export interface ITableFloatOptions {
/* cSpell:disable */
/**
@ -171,7 +180,10 @@ export class TableFloatProperties extends XmlComponent {
);
if (options.overlap) {
this.root.push(new TableOverlap(options.overlap));
// <xsd:complexType name="CT_TblOverlap">
// <xsd:attribute name="val" type="ST_TblOverlap" use="required"/>
// </xsd:complexType>
this.root.push(new StringEnumValueElement<OverlapType>("w:tblOverlap", options.overlap));
}
}
}

View File

@ -1,22 +0,0 @@
import { expect } from "chai";
import { Formatter } from "@export/formatter";
import { OverlapType, TableOverlap } from "./table-overlap";
describe("TableOverlap", () => {
describe("#constructor", () => {
it("sets the width attribute to the value given", () => {
const tableOverlap = new TableOverlap(OverlapType.OVERLAP);
const tree = new Formatter().format(tableOverlap);
expect(tree).to.deep.equal({
"w:tblOverlap": {
_attr: {
"w:val": "overlap",
},
},
});
});
});
});

View File

@ -1,26 +0,0 @@
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
// <xsd:simpleType name="ST_TblOverlap">
// <xsd:restriction base="xsd:string">
// <xsd:enumeration value="never"/>
// <xsd:enumeration value="overlap"/>
// </xsd:restriction>
// </xsd:simpleType>
export enum OverlapType {
NEVER = "never",
OVERLAP = "overlap",
}
// <xsd:complexType name="CT_TblOverlap">
// <xsd:attribute name="val" type="ST_TblOverlap" use="required"/>
// </xsd:complexType>
class TableOverlapAttributes extends XmlAttributeComponent<{ readonly val: OverlapType }> {
protected readonly xmlKeys = { val: "w:val" };
}
export class TableOverlap extends XmlComponent {
public constructor(type: OverlapType) {
super("w:tblOverlap");
this.root.push(new TableOverlapAttributes({ val: type }));
}
}

View File

@ -1,5 +1,5 @@
import { TextAttributes } from "@file/paragraph/run/text-attributes";
import { SpaceType } from "@file/space-type";
import { SpaceType } from "@file/shared";
import { XmlComponent } from "@file/xml-components";
export class DeletedPage extends XmlComponent {

View File

@ -1,5 +1,5 @@
import { TextAttributes } from "@file/paragraph/run/text-attributes";
import { SpaceType } from "@file/space-type";
import { SpaceType } from "@file/shared";
import { XmlComponent } from "@file/xml-components";
export class DeletedText extends XmlComponent {

View File

@ -3,7 +3,7 @@ import { Element, xml2js } from "xml-js";
import { EMPTY_OBJECT } from "@file/xml-components";
import { convertToXmlComponent, ImportedXmlComponent } from "./imported-xml-component";
import { convertToXmlComponent, ImportedRootElementAttributes, ImportedXmlComponent } from "./imported-xml-component";
import { IContext } from "./base";
const xmlString = `
@ -90,5 +90,29 @@ describe("ImportedXmlComponent", () => {
const converted = convertToXmlComponent(xmlObj);
expect(converted).to.deep.equal(convertedXmlElement);
});
it("should return undefined if xml type is invalid", () => {
const xmlObj = { type: "invalid" } as Element;
const converted = convertToXmlComponent(xmlObj);
expect(converted).to.equal(undefined);
});
});
});
describe("ImportedRootElementAttributes", () => {
let attributes: ImportedRootElementAttributes;
beforeEach(() => {
attributes = new ImportedRootElementAttributes({});
});
describe("#prepForXml()", () => {
it("should work", () => {
// tslint:disable-next-line: no-object-literal-type-assertion
const converted = attributes.prepForXml({} as IContext);
expect(converted).to.deep.equal({
_attr: {},
});
});
});
});

View File

@ -53,6 +53,13 @@ export class NumberValueElement extends XmlComponent {
}
}
export class StringEnumValueElement<T extends string> extends XmlComponent {
public constructor(name: string, val: T) {
super(name);
this.root.push(new Attributes({ val }));
}
}
// Simple nodes containing text.
//
// new StringContainer("hello", "world")

View File

@ -16,7 +16,8 @@
"paths": {
"@util/*": ["./util/*"],
"@export/*": ["./export/*"],
"@file/*": ["./file/*"]
"@file/*": ["./file/*"],
"@shared": ["./shared/index.ts"]
}
},
"include": ["src"]

View File

@ -12,7 +12,7 @@ const configuration = {
filename: "index.js",
libraryTarget: "umd",
library: "docx",
globalObject: "this",
globalObject: "globalThis",
},
resolve: {