* 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>
35 lines
1.3 KiB
TypeScript
35 lines
1.3 KiB
TypeScript
// http://officeopenxml.com/drwPicFloating-position.php
|
|
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
|
|
|
|
import { Align } from "./align";
|
|
import { HorizontalPositionRelativeFrom, IHorizontalPositionOptions } from "./floating-position";
|
|
import { PositionOffset } from "./position-offset";
|
|
|
|
class HorizontalPositionAttributes extends XmlAttributeComponent<{
|
|
readonly relativeFrom: (typeof HorizontalPositionRelativeFrom)[keyof typeof HorizontalPositionRelativeFrom];
|
|
}> {
|
|
protected readonly xmlKeys = {
|
|
relativeFrom: "relativeFrom",
|
|
};
|
|
}
|
|
|
|
export class HorizontalPosition extends XmlComponent {
|
|
public constructor(horizontalPosition: IHorizontalPositionOptions) {
|
|
super("wp:positionH");
|
|
|
|
this.root.push(
|
|
new HorizontalPositionAttributes({
|
|
relativeFrom: horizontalPosition.relative || HorizontalPositionRelativeFrom.PAGE,
|
|
}),
|
|
);
|
|
|
|
if (horizontalPosition.align) {
|
|
this.root.push(new Align(horizontalPosition.align));
|
|
} else if (horizontalPosition.offset !== undefined) {
|
|
this.root.push(new PositionOffset(horizontalPosition.offset));
|
|
} else {
|
|
throw new Error("There is no configuration provided for floating position (Align or offset)");
|
|
}
|
|
}
|
|
}
|