* 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>
40 lines
1.7 KiB
TypeScript
40 lines
1.7 KiB
TypeScript
import { NextAttributeComponent, XmlComponent } from "@file/xml-components";
|
|
import { PositiveUniversalMeasure, decimalNumber, twipsMeasureValue } from "@util/values";
|
|
|
|
import { Column } from "./column";
|
|
|
|
// <xsd:complexType name="CT_Columns">
|
|
// <xsd:sequence minOccurs="0">
|
|
// <xsd:element name="col" type="CT_Column" maxOccurs="45"/>
|
|
// </xsd:sequence>
|
|
// <xsd:attribute name="equalWidth" type="s:ST_OnOff" use="optional"/>
|
|
// <xsd:attribute name="space" type="s:ST_TwipsMeasure" use="optional" default="720"/>
|
|
// <xsd:attribute name="num" type="ST_DecimalNumber" use="optional" default="1"/>
|
|
// <xsd:attribute name="sep" type="s:ST_OnOff" use="optional"/>
|
|
// </xsd:complexType>
|
|
export type IColumnsAttributes = {
|
|
readonly space?: number | PositiveUniversalMeasure;
|
|
readonly count?: number;
|
|
readonly separate?: boolean;
|
|
readonly equalWidth?: boolean;
|
|
readonly children?: readonly Column[];
|
|
};
|
|
|
|
export class Columns extends XmlComponent {
|
|
public constructor({ space, count, separate, equalWidth, children }: IColumnsAttributes) {
|
|
super("w:cols");
|
|
this.root.push(
|
|
new NextAttributeComponent<Omit<IColumnsAttributes, "children">>({
|
|
space: { key: "w:space", value: space === undefined ? undefined : twipsMeasureValue(space) },
|
|
count: { key: "w:num", value: count === undefined ? undefined : decimalNumber(count) },
|
|
separate: { key: "w:sep", value: separate },
|
|
equalWidth: { key: "w:equalWidth", value: equalWidth },
|
|
}),
|
|
);
|
|
|
|
if (!equalWidth && children) {
|
|
children.forEach((column) => this.addChildElement(column));
|
|
}
|
|
}
|
|
}
|