More math components
This commit is contained in:
@ -1,25 +1,32 @@
|
||||
// http://www.datypic.com/sc/ooxml/e-m_nary-1.html
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
|
||||
import { MathRun } from "../math-run";
|
||||
import { MathComponent } from "../math-component";
|
||||
import { MathBase } from "./math-base";
|
||||
import { MathNArayProperties } from "./math-naray-properties";
|
||||
import { MathSubScript } from "./math-sub-script";
|
||||
import { MathSuperScript } from "./math-super-script";
|
||||
import { MathSubScriptElement } from "./math-sub-script";
|
||||
import { MathSuperScriptElement } from "./math-super-script";
|
||||
|
||||
export interface IMathSumOptions {
|
||||
readonly child: MathRun;
|
||||
readonly subScript?: MathRun;
|
||||
readonly superScript?: MathRun;
|
||||
readonly child: MathComponent;
|
||||
readonly subScript?: MathComponent;
|
||||
readonly superScript?: MathComponent;
|
||||
}
|
||||
|
||||
export class MathSum extends XmlComponent {
|
||||
constructor(readonly options: IMathSumOptions) {
|
||||
constructor(options: IMathSumOptions) {
|
||||
super("m:nary");
|
||||
|
||||
this.root.push(new MathNArayProperties("∑"));
|
||||
this.root.push(new MathSubScript(options.child));
|
||||
this.root.push(new MathSuperScript(options.child));
|
||||
this.root.push(new MathNArayProperties("∑", !!options.superScript, !!options.subScript));
|
||||
|
||||
if (!!options.subScript) {
|
||||
this.root.push(new MathSubScriptElement(options.subScript));
|
||||
}
|
||||
|
||||
if (!!options.superScript) {
|
||||
this.root.push(new MathSuperScriptElement(options.superScript));
|
||||
}
|
||||
|
||||
this.root.push(new MathBase(options.child));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user