* 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>
57 lines
1.9 KiB
TypeScript
57 lines
1.9 KiB
TypeScript
// http://officeopenxml.com/WPSectionPgNumType.php
|
|
import { NumberFormat } from "@file/shared/number-format";
|
|
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
|
|
import { decimalNumber } from "@util/values";
|
|
|
|
// <xsd:simpleType name="ST_ChapterSep">
|
|
// <xsd:restriction base="xsd:string">
|
|
// <xsd:enumeration value="hyphen"/>
|
|
// <xsd:enumeration value="period"/>
|
|
// <xsd:enumeration value="colon"/>
|
|
// <xsd:enumeration value="emDash"/>
|
|
// <xsd:enumeration value="enDash"/>
|
|
// </xsd:restriction>
|
|
// </xsd:simpleType>
|
|
|
|
export const PageNumberSeparator = {
|
|
HYPHEN: "hyphen",
|
|
PERIOD: "period",
|
|
COLON: "colon",
|
|
EM_DASH: "emDash",
|
|
EN_DASH: "endash",
|
|
} as const;
|
|
|
|
export type IPageNumberTypeAttributes = {
|
|
readonly start?: number;
|
|
readonly formatType?: (typeof NumberFormat)[keyof typeof NumberFormat];
|
|
readonly separator?: (typeof PageNumberSeparator)[keyof typeof PageNumberSeparator];
|
|
};
|
|
|
|
// <xsd:complexType name="CT_PageNumber">
|
|
// <xsd:attribute name="fmt" type="ST_NumberFormat" use="optional" default="decimal"/>
|
|
// <xsd:attribute name="start" type="ST_DecimalNumber" use="optional"/>
|
|
// <xsd:attribute name="chapStyle" type="ST_DecimalNumber" use="optional"/>
|
|
// <xsd:attribute name="chapSep" type="ST_ChapterSep" use="optional" default="hyphen"/>
|
|
// </xsd:complexType>
|
|
|
|
export class PageNumberTypeAttributes extends XmlAttributeComponent<IPageNumberTypeAttributes> {
|
|
protected readonly xmlKeys = {
|
|
start: "w:start",
|
|
formatType: "w:fmt",
|
|
separator: "w:chapSep",
|
|
};
|
|
}
|
|
|
|
export class PageNumberType extends XmlComponent {
|
|
public constructor({ start, formatType, separator }: IPageNumberTypeAttributes) {
|
|
super("w:pgNumType");
|
|
this.root.push(
|
|
new PageNumberTypeAttributes({
|
|
start: start === undefined ? undefined : decimalNumber(start),
|
|
formatType,
|
|
separator,
|
|
}),
|
|
);
|
|
}
|
|
}
|