2019-08-20 20:40:40 +01:00
|
|
|
// http://www.datypic.com/sc/ooxml/e-m_nary-1.html
|
2022-06-26 23:26:42 +01:00
|
|
|
import { XmlComponent } from "@file/xml-components";
|
2019-08-20 20:40:40 +01:00
|
|
|
|
2020-10-10 13:41:26 +01:00
|
|
|
import { MathComponent } from "../math-component";
|
2019-08-20 20:40:40 +01:00
|
|
|
import { MathBase } from "./math-base";
|
|
|
|
import { MathNArayProperties } from "./math-naray-properties";
|
2020-10-10 13:41:26 +01:00
|
|
|
import { MathSubScriptElement } from "./math-sub-script";
|
|
|
|
import { MathSuperScriptElement } from "./math-super-script";
|
2019-08-20 20:40:40 +01:00
|
|
|
|
|
|
|
export interface IMathSumOptions {
|
2020-10-13 02:06:27 +01:00
|
|
|
readonly children: MathComponent[];
|
|
|
|
readonly subScript?: MathComponent[];
|
|
|
|
readonly superScript?: MathComponent[];
|
2019-08-20 20:40:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export class MathSum extends XmlComponent {
|
2020-10-10 13:41:26 +01:00
|
|
|
constructor(options: IMathSumOptions) {
|
2019-08-20 20:40:40 +01:00
|
|
|
super("m:nary");
|
|
|
|
|
2020-10-10 13:41:26 +01:00
|
|
|
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));
|
|
|
|
}
|
|
|
|
|
2020-10-13 02:06:27 +01:00
|
|
|
this.root.push(new MathBase(options.children));
|
2019-08-20 20:40:40 +01:00
|
|
|
}
|
|
|
|
}
|