Files
docx-js/src/file/document/body/section-properties/properties/page-margin.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

47 lines
2.3 KiB
TypeScript

import { NextAttributeComponent, XmlComponent } from "@file/xml-components";
import { PositiveUniversalMeasure, UniversalMeasure, signedTwipsMeasureValue, twipsMeasureValue } from "@util/values";
// <xsd:complexType name="CT_PageMar">
// <xsd:attribute name="top" type="ST_SignedTwipsMeasure" use="required"/>
// <xsd:attribute name="right" type="s:ST_TwipsMeasure" use="required"/>
// <xsd:attribute name="bottom" type="ST_SignedTwipsMeasure" use="required"/>
// <xsd:attribute name="left" type="s:ST_TwipsMeasure" use="required"/>
// <xsd:attribute name="header" type="s:ST_TwipsMeasure" use="required"/>
// <xsd:attribute name="footer" type="s:ST_TwipsMeasure" use="required"/>
// <xsd:attribute name="gutter" type="s:ST_TwipsMeasure" use="required"/>
// </xsd:complexType>
export type IPageMarginAttributes = {
readonly top?: number | UniversalMeasure;
readonly right?: number | PositiveUniversalMeasure;
readonly bottom?: number | UniversalMeasure;
readonly left?: number | PositiveUniversalMeasure;
readonly header?: number | PositiveUniversalMeasure;
readonly footer?: number | PositiveUniversalMeasure;
readonly gutter?: number | PositiveUniversalMeasure;
};
export class PageMargin extends XmlComponent {
public constructor(
top: number | UniversalMeasure,
right: number | PositiveUniversalMeasure,
bottom: number | UniversalMeasure,
left: number | PositiveUniversalMeasure,
header: number | PositiveUniversalMeasure,
footer: number | PositiveUniversalMeasure,
gutter: number | PositiveUniversalMeasure,
) {
super("w:pgMar");
this.root.push(
new NextAttributeComponent<IPageMarginAttributes>({
top: { key: "w:top", value: signedTwipsMeasureValue(top) },
right: { key: "w:right", value: twipsMeasureValue(right) },
bottom: { key: "w:bottom", value: signedTwipsMeasureValue(bottom) },
left: { key: "w:left", value: twipsMeasureValue(left) },
header: { key: "w:header", value: twipsMeasureValue(header) },
footer: { key: "w:footer", value: twipsMeasureValue(footer) },
gutter: { key: "w:gutter", value: twipsMeasureValue(gutter) },
}),
);
}
}