Files
docx-js/src/file/paragraph/formatting/border.ts
dependabot[bot] 2381ba8a05 build(deps-dev): bump eslint from 8.57.1 to 9.13.0 (#2792)
* build(deps-dev): bump eslint from 8.57.1 to 9.13.0

Bumps [eslint](https://github.com/eslint/eslint) from 8.57.1 to 9.13.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.57.1...v9.13.0)

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

Signed-off-by: dependabot[bot] <support@github.com>

* Upgrade EsLint

* Fix all new lint errors

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dolan Miu <dolan_miu@hotmail.com>
2024-10-21 03:57:15 +01:00

46 lines
1.3 KiB
TypeScript

// http://officeopenxml.com/WPborders.php
import { BorderElement, BorderStyle, IBorderOptions } from "@file/border";
import { IgnoreIfEmptyXmlComponent, XmlComponent } from "@file/xml-components";
export type IBordersOptions = {
readonly top?: IBorderOptions;
readonly bottom?: IBorderOptions;
readonly left?: IBorderOptions;
readonly right?: IBorderOptions;
};
export class Border extends IgnoreIfEmptyXmlComponent {
public constructor(options: IBordersOptions) {
super("w:pBdr");
if (options.top) {
this.root.push(new BorderElement("w:top", options.top));
}
if (options.bottom) {
this.root.push(new BorderElement("w:bottom", options.bottom));
}
if (options.left) {
this.root.push(new BorderElement("w:left", options.left));
}
if (options.right) {
this.root.push(new BorderElement("w:right", options.right));
}
}
}
export class ThematicBreak extends XmlComponent {
public constructor() {
super("w:pBdr");
const bottom = new BorderElement("w:bottom", {
color: "auto",
space: 1,
style: BorderStyle.SINGLE,
size: 6,
});
this.root.push(bottom);
}
}