@syncfusion/ej2-office-common 35.1.37 → 35.1.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (226) hide show
  1. package/dist/ej2-office-common.umd.min.js +2 -2
  2. package/dist/ej2-office-common.umd.min.js.map +1 -1
  3. package/dist/es6/ej2-office-common.es2015.js +5421 -6017
  4. package/dist/es6/ej2-office-common.es2015.js.map +1 -1
  5. package/dist/es6/ej2-office-common.es5.js +6270 -7203
  6. package/dist/es6/ej2-office-common.es5.js.map +1 -1
  7. package/dist/global/ej2-office-common.min.js +2 -2
  8. package/dist/global/ej2-office-common.min.js.map +1 -1
  9. package/dist/global/index.d.ts +1 -1
  10. package/office-common.js +4 -0
  11. package/package.json +11 -7
  12. package/src/index.d.ts +3 -17
  13. package/src/index.js +3 -18
  14. package/src/office-common/features/index.d.ts +6 -0
  15. package/src/office-common/features/index.js +6 -0
  16. package/src/office-common/features/mathml/index.d.ts +25 -0
  17. package/src/office-common/features/mathml/index.js +22 -0
  18. package/src/office-common/features/mathml/latex/latex-generator.d.ts +8 -0
  19. package/src/office-common/features/mathml/latex/latex-generator.js +357 -0
  20. package/src/office-common/features/mathml/latex/latex-parser.d.ts +87 -0
  21. package/src/office-common/features/mathml/latex/latex-parser.js +1206 -0
  22. package/src/office-common/features/mathml/latex/latex-symbols.d.ts +13 -0
  23. package/src/office-common/features/mathml/latex/latex-symbols.js +681 -0
  24. package/src/office-common/features/mathml/math-settings.d.ts +54 -0
  25. package/src/office-common/features/mathml/math-settings.js +174 -0
  26. package/src/office-common/features/mathml/office-math/adapter.d.ts +59 -0
  27. package/src/office-common/features/mathml/office-math/adapter.js +6 -0
  28. package/src/office-common/features/mathml/office-math/basic.d.ts +91 -0
  29. package/src/office-common/features/mathml/office-math/basic.js +93 -0
  30. package/src/office-common/features/mathml/office-math/break.d.ts +30 -0
  31. package/src/office-common/features/mathml/office-math/break.js +75 -0
  32. package/src/office-common/features/mathml/office-math/collection.d.ts +104 -0
  33. package/src/office-common/features/mathml/office-math/collection.js +170 -0
  34. package/src/office-common/features/mathml/office-math/entity.d.ts +12 -0
  35. package/src/office-common/features/mathml/office-math/entity.js +3 -0
  36. package/src/office-common/features/mathml/office-math/enums.d.ts +97 -0
  37. package/src/office-common/features/mathml/office-math/enums.js +108 -0
  38. package/src/office-common/features/mathml/office-math/format.d.ts +28 -0
  39. package/src/office-common/features/mathml/office-math/format.js +90 -0
  40. package/src/office-common/features/mathml/office-math/function-base.d.ts +27 -0
  41. package/src/office-common/features/mathml/office-math/function-base.js +69 -0
  42. package/src/office-common/features/mathml/office-math/function-collection.d.ts +29 -0
  43. package/src/office-common/features/mathml/office-math/function-collection.js +76 -0
  44. package/src/office-common/features/mathml/office-math/functions-basic.d.ts +118 -0
  45. package/src/office-common/features/mathml/office-math/functions-basic.js +331 -0
  46. package/src/office-common/features/mathml/office-math/functions-multi.d.ts +156 -0
  47. package/src/office-common/features/mathml/office-math/functions-multi.js +407 -0
  48. package/src/office-common/features/mathml/office-math/index.d.ts +27 -0
  49. package/src/office-common/features/mathml/office-math/index.js +25 -0
  50. package/src/office-common/features/mathml/office-math/keys.d.ts +6 -0
  51. package/src/office-common/features/mathml/office-math/keys.js +20 -0
  52. package/src/office-common/features/mathml/office-math/math-clone.d.ts +20 -0
  53. package/src/office-common/features/mathml/office-math/math-clone.js +203 -0
  54. package/src/office-common/features/mathml/office-math/math-collection.d.ts +19 -0
  55. package/src/office-common/features/mathml/office-math/math-collection.js +41 -0
  56. package/src/office-common/features/mathml/office-math/math-equality.d.ts +21 -0
  57. package/src/office-common/features/mathml/office-math/math-equality.js +115 -0
  58. package/src/office-common/features/mathml/office-math/math-paragraph.d.ts +58 -0
  59. package/src/office-common/features/mathml/office-math/math-paragraph.js +126 -0
  60. package/src/office-common/features/mathml/office-math/math-traversal.d.ts +23 -0
  61. package/src/office-common/features/mathml/office-math/math-traversal.js +95 -0
  62. package/src/office-common/features/mathml/office-math/matrix-collections.d.ts +54 -0
  63. package/src/office-common/features/mathml/office-math/matrix-collections.js +113 -0
  64. package/src/office-common/features/mathml/office-math/matrix-column.d.ts +43 -0
  65. package/src/office-common/features/mathml/office-math/matrix-column.js +96 -0
  66. package/src/office-common/features/mathml/office-math/matrix-row.d.ts +38 -0
  67. package/src/office-common/features/mathml/office-math/matrix-row.js +71 -0
  68. package/src/office-common/features/mathml/office-math/matrix.d.ts +62 -0
  69. package/src/office-common/features/mathml/office-math/matrix.js +158 -0
  70. package/src/office-common/features/mathml/office-math/office-math.d.ts +55 -0
  71. package/src/office-common/features/mathml/office-math/office-math.js +116 -0
  72. package/src/office-common/features/mathml/office-math/owner-holder.d.ts +42 -0
  73. package/src/office-common/features/mathml/office-math/owner-holder.js +87 -0
  74. package/src/office-common/features/mathml/office-math/property-store.d.ts +66 -0
  75. package/src/office-common/features/mathml/office-math/property-store.js +99 -0
  76. package/src/office-common/features/mathml/office-math/run-element.d.ts +31 -0
  77. package/src/office-common/features/mathml/office-math/run-element.js +97 -0
  78. package/src/office-common/features/mathml/office-math/unknown-element.d.ts +37 -0
  79. package/src/office-common/features/mathml/office-math/unknown-element.js +62 -0
  80. package/src/office-common/features/mathml/office-math/xml-equal.d.ts +13 -0
  81. package/src/office-common/features/mathml/office-math/xml-equal.js +24 -0
  82. package/src/office-common/features/mathml/parse/office-math-parser.d.ts +24 -0
  83. package/src/office-common/features/mathml/parse/office-math-parser.js +396 -0
  84. package/src/office-common/features/mathml/parse/office-math-properties.d.ts +165 -0
  85. package/src/office-common/features/mathml/parse/office-math-properties.js +432 -0
  86. package/src/office-common/features/mathml/parse/parse-options.d.ts +22 -0
  87. package/src/office-common/features/mathml/parse/parse-options.js +3 -0
  88. package/src/office-common/features/mathml/serialize/office-math-properties-writer.d.ts +38 -0
  89. package/src/office-common/features/mathml/serialize/office-math-properties-writer.js +267 -0
  90. package/src/office-common/features/mathml/serialize/office-math-serializer.d.ts +23 -0
  91. package/src/office-common/features/mathml/serialize/office-math-serializer.js +306 -0
  92. package/src/office-common/features/mathml/serialize/omml-writer.d.ts +123 -0
  93. package/src/office-common/features/mathml/serialize/omml-writer.js +135 -0
  94. package/src/office-common/index.d.ts +10 -0
  95. package/src/office-common/index.js +10 -0
  96. package/.eslintrc.json +0 -263
  97. package/.prettierrc.json +0 -5
  98. package/api-extractor.json +0 -35
  99. package/core.js +0 -4
  100. package/encryption.js +0 -4
  101. package/features.js +0 -4
  102. package/global.json +0 -6
  103. package/nuget.config +0 -7
  104. package/src/all.d.ts +0 -41
  105. package/src/all.js +0 -38
  106. package/src/features/index.d.ts +0 -11
  107. package/src/features/index.js +0 -11
  108. package/src/features/mathml/index.d.ts +0 -30
  109. package/src/features/mathml/index.js +0 -22
  110. package/src/features/mathml/math-factory.d.ts +0 -26
  111. package/src/features/mathml/math-factory.js +0 -568
  112. package/src/features/mathml/model/controls.d.ts +0 -896
  113. package/src/features/mathml/model/controls.js +0 -1541
  114. package/src/features/mathml/model/math-element.d.ts +0 -173
  115. package/src/features/mathml/model/math-element.js +0 -315
  116. package/src/features/mathml/model/roots.d.ts +0 -82
  117. package/src/features/mathml/model/roots.js +0 -177
  118. package/src/features/mathml/parse/math-parser.d.ts +0 -43
  119. package/src/features/mathml/parse/math-parser.js +0 -636
  120. package/src/features/mathml/serialize/math-serializer.d.ts +0 -34
  121. package/src/features/mathml/serialize/math-serializer.js +0 -749
  122. package/tsconfig.build.json +0 -13
  123. package/tsconfig.harness.json +0 -32
  124. package/tslint.json +0 -111
  125. /package/src/{core → office-common/core}/index.d.ts +0 -0
  126. /package/src/{core → office-common/core}/index.js +0 -0
  127. /package/src/{core → office-common/core}/xml/index.d.ts +0 -0
  128. /package/src/{core → office-common/core}/xml/index.js +0 -0
  129. /package/src/{core → office-common/core}/xml/model.d.ts +0 -0
  130. /package/src/{core → office-common/core}/xml/model.js +0 -0
  131. /package/src/{encryption → office-common/encryption}/agile-constants.d.ts +0 -0
  132. /package/src/{encryption → office-common/encryption}/agile-constants.js +0 -0
  133. /package/src/{encryption → office-common/encryption}/agile-encryption-info.d.ts +0 -0
  134. /package/src/{encryption → office-common/encryption}/agile-encryption-info.js +0 -0
  135. /package/src/{encryption → office-common/encryption}/agile-password.d.ts +0 -0
  136. /package/src/{encryption → office-common/encryption}/agile-password.js +0 -0
  137. /package/src/{encryption → office-common/encryption}/cfb-reader.d.ts +0 -0
  138. /package/src/{encryption → office-common/encryption}/cfb-reader.js +0 -0
  139. /package/src/{encryption → office-common/encryption}/crypto-primitives.d.ts +0 -0
  140. /package/src/{encryption → office-common/encryption}/crypto-primitives.js +0 -0
  141. /package/src/{encryption → office-common/encryption}/decrypt-encrypted-package.d.ts +0 -0
  142. /package/src/{encryption → office-common/encryption}/decrypt-encrypted-package.js +0 -0
  143. /package/src/{encryption → office-common/encryption}/encryption-info-xml.d.ts +0 -0
  144. /package/src/{encryption → office-common/encryption}/encryption-info-xml.js +0 -0
  145. /package/src/{encryption → office-common/encryption}/errors.d.ts +0 -0
  146. /package/src/{encryption → office-common/encryption}/errors.js +0 -0
  147. /package/src/{encryption → office-common/encryption}/index.d.ts +0 -0
  148. /package/src/{encryption → office-common/encryption}/index.js +0 -0
  149. /package/src/{features → office-common/features}/diagrams/constants.d.ts +0 -0
  150. /package/src/{features → office-common/features}/diagrams/constants.js +0 -0
  151. /package/src/{features → office-common/features}/diagrams/diagram-data-model.d.ts +0 -0
  152. /package/src/{features → office-common/features}/diagrams/diagram-data-model.js +0 -0
  153. /package/src/{features → office-common/features}/diagrams/diagram-parsers.d.ts +0 -0
  154. /package/src/{features → office-common/features}/diagrams/diagram-parsers.js +0 -0
  155. /package/src/{features → office-common/features}/diagrams/diagram-serializers.d.ts +0 -0
  156. /package/src/{features → office-common/features}/diagrams/diagram-serializers.js +0 -0
  157. /package/src/{features → office-common/features}/diagrams/diagram-views.d.ts +0 -0
  158. /package/src/{features → office-common/features}/diagrams/diagram-views.js +0 -0
  159. /package/src/{features → office-common/features}/diagrams/element-tree.d.ts +0 -0
  160. /package/src/{features → office-common/features}/diagrams/element-tree.js +0 -0
  161. /package/src/{features → office-common/features}/diagrams/errors.d.ts +0 -0
  162. /package/src/{features → office-common/features}/diagrams/errors.js +0 -0
  163. /package/src/{features → office-common/features}/diagrams/index.d.ts +0 -0
  164. /package/src/{features → office-common/features}/diagrams/index.js +0 -0
  165. /package/src/{features → office-common/features}/diagrams/smart-art-catalog.d.ts +0 -0
  166. /package/src/{features → office-common/features}/diagrams/smart-art-catalog.js +0 -0
  167. /package/src/{features → office-common/features}/diagrams/smart-art-diagram.d.ts +0 -0
  168. /package/src/{features → office-common/features}/diagrams/smart-art-diagram.js +0 -0
  169. /package/src/{features → office-common/features}/ink/constants.d.ts +0 -0
  170. /package/src/{features → office-common/features}/ink/constants.js +0 -0
  171. /package/src/{features → office-common/features}/ink/index.d.ts +0 -0
  172. /package/src/{features → office-common/features}/ink/index.js +0 -0
  173. /package/src/{features → office-common/features}/ink/ink-effects.d.ts +0 -0
  174. /package/src/{features → office-common/features}/ink/ink-effects.js +0 -0
  175. /package/src/{features → office-common/features}/ink/ink-model.d.ts +0 -0
  176. /package/src/{features → office-common/features}/ink/ink-model.js +0 -0
  177. /package/src/{features → office-common/features}/ink/ink-parser.d.ts +0 -0
  178. /package/src/{features → office-common/features}/ink/ink-parser.js +0 -0
  179. /package/src/{features → office-common/features}/ink/ink-serializer.d.ts +0 -0
  180. /package/src/{features → office-common/features}/ink/ink-serializer.js +0 -0
  181. /package/src/{features → office-common/features}/ink/ink-units.d.ts +0 -0
  182. /package/src/{features → office-common/features}/ink/ink-units.js +0 -0
  183. /package/src/{features → office-common/features}/ink/ink-xml.d.ts +0 -0
  184. /package/src/{features → office-common/features}/ink/ink-xml.js +0 -0
  185. /package/src/{features → office-common/features}/ink/trace-codec.d.ts +0 -0
  186. /package/src/{features → office-common/features}/ink/trace-codec.js +0 -0
  187. /package/src/{features → office-common/features}/mathml/constants.d.ts +0 -0
  188. /package/src/{features → office-common/features}/mathml/constants.js +0 -0
  189. /package/src/{features → office-common/features}/mathml/errors.d.ts +0 -0
  190. /package/src/{features → office-common/features}/mathml/errors.js +0 -0
  191. /package/src/{features → office-common/features}/mathml/model/enums.d.ts +0 -0
  192. /package/src/{features → office-common/features}/mathml/model/enums.js +0 -0
  193. /package/src/{features → office-common/features}/mathml/openxml.d.ts +0 -0
  194. /package/src/{features → office-common/features}/mathml/openxml.js +0 -0
  195. /package/src/{features → office-common/features}/smart-art/diagram-xml.d.ts +0 -0
  196. /package/src/{features → office-common/features}/smart-art/diagram-xml.js +0 -0
  197. /package/src/{features → office-common/features}/smart-art/errors.d.ts +0 -0
  198. /package/src/{features → office-common/features}/smart-art/errors.js +0 -0
  199. /package/src/{features → office-common/features}/smart-art/index.d.ts +0 -0
  200. /package/src/{features → office-common/features}/smart-art/index.js +0 -0
  201. /package/src/{features → office-common/features}/smart-art/minimal-samples.d.ts +0 -0
  202. /package/src/{features → office-common/features}/smart-art/minimal-samples.js +0 -0
  203. /package/src/{features → office-common/features}/smart-art/mutators.d.ts +0 -0
  204. /package/src/{features → office-common/features}/smart-art/mutators.js +0 -0
  205. /package/src/{features → office-common/features}/smart-art/namespaces.d.ts +0 -0
  206. /package/src/{features → office-common/features}/smart-art/namespaces.js +0 -0
  207. /package/src/{features → office-common/features}/smart-art/package-graph.d.ts +0 -0
  208. /package/src/{features → office-common/features}/smart-art/package-graph.js +0 -0
  209. /package/src/{features → office-common/features}/smart-art/parse-colors.d.ts +0 -0
  210. /package/src/{features → office-common/features}/smart-art/parse-colors.js +0 -0
  211. /package/src/{features → office-common/features}/smart-art/parse-data.d.ts +0 -0
  212. /package/src/{features → office-common/features}/smart-art/parse-data.js +0 -0
  213. /package/src/{features → office-common/features}/smart-art/parse-layout.d.ts +0 -0
  214. /package/src/{features → office-common/features}/smart-art/parse-layout.js +0 -0
  215. /package/src/{features → office-common/features}/smart-art/parse-rel-ids.d.ts +0 -0
  216. /package/src/{features → office-common/features}/smart-art/parse-rel-ids.js +0 -0
  217. /package/src/{features → office-common/features}/smart-art/parse-style.d.ts +0 -0
  218. /package/src/{features → office-common/features}/smart-art/parse-style.js +0 -0
  219. /package/src/{features → office-common/features}/smart-art/point-text.d.ts +0 -0
  220. /package/src/{features → office-common/features}/smart-art/point-text.js +0 -0
  221. /package/src/{features → office-common/features}/smart-art/register.d.ts +0 -0
  222. /package/src/{features → office-common/features}/smart-art/register.js +0 -0
  223. /package/src/{features → office-common/features}/smart-art/serialize.d.ts +0 -0
  224. /package/src/{features → office-common/features}/smart-art/serialize.js +0 -0
  225. /package/src/{features → office-common/features}/smart-art/types.d.ts +0 -0
  226. /package/src/{features → office-common/features}/smart-art/types.js +0 -0
@@ -0,0 +1,54 @@
1
+ import { OpenXmlElement } from './openxml';
2
+ import { MathBreakBin, MathBreakBinSub, MathJc, MathLimLoc } from './model/enums';
3
+ /**
4
+ * Typed `m:mathPr` settings. All members are optional; absent means "not specified".
5
+ *
6
+ * @public
7
+ */
8
+ export interface MathSettings {
9
+ /** Math font name (`m:mathFont`). */
10
+ mathFont?: string;
11
+ /** Break on binary operators (`m:brkBin`). */
12
+ breakOnBinaryOperators?: MathBreakBin;
13
+ /** Break on binary subtraction (`m:brkBinSub`). */
14
+ breakOnBinarySubtraction?: MathBreakBinSub;
15
+ /** Use small fractions (`m:smallFrac`). */
16
+ smallFraction?: boolean;
17
+ /** Display math defaults (`m:dispDef`). */
18
+ displayMathDefaults?: boolean;
19
+ /** Left margin in twips (`m:lMargin`). */
20
+ leftMargin?: number;
21
+ /** Right margin in twips (`m:rMargin`). */
22
+ rightMargin?: number;
23
+ /** Default justification (`m:defJc`). */
24
+ defaultJustification?: MathJc;
25
+ /** Spacing before (`m:preSp`). */
26
+ preSpacing?: number;
27
+ /** Spacing after (`m:postSp`). */
28
+ postSpacing?: number;
29
+ /** Spacing between (`m:interSp`). */
30
+ interSpacing?: number;
31
+ /** Spacing within (`m:intraSp`). */
32
+ intraSpacing?: number;
33
+ /** Wrap indent in twips (`m:wrapIndent`); exclusive with {@link wrapRight}. */
34
+ wrapIndent?: number;
35
+ /** Wrap right (`m:wrapRight`); exclusive with {@link wrapIndent}. */
36
+ wrapRight?: boolean;
37
+ /** Integral limit location (`m:intLim`). */
38
+ integralLimitLocation?: MathLimLoc;
39
+ /** N-ary limit location (`m:naryLim`). */
40
+ naryLimitLocation?: MathLimLoc;
41
+ }
42
+ /**
43
+ * Parse an `m:mathPr` element. Unknown or invalid values are omitted (tolerant).
44
+ *
45
+ * @public
46
+ */
47
+ export declare function parseMathSettings(mathPr: OpenXmlElement): MathSettings;
48
+ /**
49
+ * Serialize {@link MathSettings} to `m:mathPr` in schema order.
50
+ *
51
+ * @throws MathmlValidationError when `wrapIndent` and `wrapRight` are both set, or a twips value is not a non-negative integer.
52
+ * @public
53
+ */
54
+ export declare function mathSettingsToOpenXml(settings: MathSettings, prefix?: string): OpenXmlElement;
@@ -0,0 +1,174 @@
1
+ var __values = (this && this.__values) || function (o) {
2
+ var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
3
+ if (m) return m.call(o);
4
+ return {
5
+ next: function () {
6
+ if (o && i >= o.length) o = void 0;
7
+ return { value: o && o[i++], done: !o };
8
+ }
9
+ };
10
+ };
11
+ var __read = (this && this.__read) || function (o, n) {
12
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
13
+ if (!m) return o;
14
+ var i = m.call(o), r, ar = [], e;
15
+ try {
16
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
17
+ }
18
+ catch (error) { e = { error: error }; }
19
+ finally {
20
+ try {
21
+ if (r && !r.done && (m = i["return"])) m.call(i);
22
+ }
23
+ finally { if (e) throw e.error; }
24
+ }
25
+ return ar;
26
+ };
27
+ /**
28
+ * Document-level math settings (`m:mathPr`, `CT_MathPr`).
29
+ *
30
+ * Source: ECMA-376 shared-math.xsd `CT_MathPr`; parity with compression
31
+ * `OfficeMathProperties` / `SerializeMathProperties`.
32
+ *
33
+ * @packageDocumentation
34
+ */
35
+ import { MATH_NAMESPACE } from './constants';
36
+ import { MathmlValidationError } from './errors';
37
+ import { createElement, attrValue, childElements } from './openxml';
38
+ import { parseMathBreakBin, parseMathBreakBinSub, parseMathJc, parseMathLimLoc, parseOnOff } from './model/enums';
39
+ var TWIPS_ELEMENTS = [
40
+ ['leftMargin', 'lMargin'],
41
+ ['rightMargin', 'rMargin'],
42
+ ['defaultJustification', 'defJc'],
43
+ ['preSpacing', 'preSp'],
44
+ ['postSpacing', 'postSp'],
45
+ ['interSpacing', 'interSp'],
46
+ ['intraSpacing', 'intraSp'],
47
+ ];
48
+ function child(pr, name) {
49
+ return childElements(pr).find(function (c) { return c.namespaceUri === MATH_NAMESPACE && c.localName === name; });
50
+ }
51
+ function val(pr, name) {
52
+ var c = child(pr, name);
53
+ return c ? attrValue(c, 'val') : undefined;
54
+ }
55
+ function twips(pr, name) {
56
+ var v = val(pr, name);
57
+ return v !== undefined && /^\d+$/.test(v) ? Number(v) : undefined;
58
+ }
59
+ function onOff(pr, name) {
60
+ var c = child(pr, name);
61
+ if (!c) {
62
+ return undefined;
63
+ }
64
+ var v = attrValue(c, 'val');
65
+ return v === undefined ? true : parseOnOff(v);
66
+ }
67
+ /**
68
+ * Parse an `m:mathPr` element. Unknown or invalid values are omitted (tolerant).
69
+ *
70
+ * @public
71
+ */
72
+ export function parseMathSettings(mathPr) {
73
+ var s = {};
74
+ var set = function (k, v) {
75
+ if (v !== undefined) {
76
+ s[k] = v;
77
+ }
78
+ };
79
+ set('mathFont', val(mathPr, 'mathFont'));
80
+ var bb = val(mathPr, 'brkBin');
81
+ set('breakOnBinaryOperators', bb !== undefined ? parseMathBreakBin(bb) : undefined);
82
+ var bs = val(mathPr, 'brkBinSub');
83
+ set('breakOnBinarySubtraction', bs !== undefined ? parseMathBreakBinSub(bs) : undefined);
84
+ set('smallFraction', onOff(mathPr, 'smallFrac'));
85
+ set('displayMathDefaults', onOff(mathPr, 'dispDef'));
86
+ set('leftMargin', twips(mathPr, 'lMargin'));
87
+ set('rightMargin', twips(mathPr, 'rMargin'));
88
+ var jc = val(mathPr, 'defJc');
89
+ set('defaultJustification', jc !== undefined ? parseMathJc(jc) : undefined);
90
+ set('preSpacing', twips(mathPr, 'preSp'));
91
+ set('postSpacing', twips(mathPr, 'postSp'));
92
+ set('interSpacing', twips(mathPr, 'interSp'));
93
+ set('intraSpacing', twips(mathPr, 'intraSp'));
94
+ set('wrapIndent', twips(mathPr, 'wrapIndent'));
95
+ set('wrapRight', onOff(mathPr, 'wrapRight'));
96
+ var il = val(mathPr, 'intLim');
97
+ set('integralLimitLocation', il !== undefined ? parseMathLimLoc(il) : undefined);
98
+ var nl = val(mathPr, 'naryLim');
99
+ set('naryLimitLocation', nl !== undefined ? parseMathLimLoc(nl) : undefined);
100
+ return s;
101
+ }
102
+ /**
103
+ * Serialize {@link MathSettings} to `m:mathPr` in schema order.
104
+ *
105
+ * @throws MathmlValidationError when `wrapIndent` and `wrapRight` are both set, or a twips value is not a non-negative integer.
106
+ * @public
107
+ */
108
+ export function mathSettingsToOpenXml(settings, prefix) {
109
+ if (prefix === void 0) { prefix = 'm'; }
110
+ var e_1, _a;
111
+ var kids = [];
112
+ var el = function (name, value) {
113
+ kids.push(createElement(MATH_NAMESPACE, name, prefix, {
114
+ attributes: [{ namespaceUri: '', localName: 'val', prefix: '', value: value }],
115
+ children: [],
116
+ }));
117
+ };
118
+ var flag = function (name, v) {
119
+ if (v !== undefined) {
120
+ el(name, v ? '1' : '0');
121
+ }
122
+ };
123
+ var tw = function (name, v) {
124
+ if (v === undefined) {
125
+ return;
126
+ }
127
+ if (!Number.isInteger(v) || v < 0) {
128
+ throw new MathmlValidationError(name + " must be a non-negative integer, got " + String(v), "mathPr." + name, 'value-range');
129
+ }
130
+ el(name, String(v));
131
+ };
132
+ if (settings.wrapIndent !== undefined && settings.wrapRight !== undefined) {
133
+ throw new MathmlValidationError('wrapIndent and wrapRight are mutually exclusive', 'mathPr', 'child-order');
134
+ }
135
+ if (settings.mathFont !== undefined) {
136
+ el('mathFont', settings.mathFont);
137
+ }
138
+ if (settings.breakOnBinaryOperators !== undefined) {
139
+ el('brkBin', settings.breakOnBinaryOperators);
140
+ }
141
+ if (settings.breakOnBinarySubtraction !== undefined) {
142
+ el('brkBinSub', settings.breakOnBinarySubtraction);
143
+ }
144
+ flag('smallFrac', settings.smallFraction);
145
+ flag('dispDef', settings.displayMathDefaults);
146
+ try {
147
+ for (var TWIPS_ELEMENTS_1 = __values(TWIPS_ELEMENTS), TWIPS_ELEMENTS_1_1 = TWIPS_ELEMENTS_1.next(); !TWIPS_ELEMENTS_1_1.done; TWIPS_ELEMENTS_1_1 = TWIPS_ELEMENTS_1.next()) {
148
+ var _b = __read(TWIPS_ELEMENTS_1_1.value, 2), key = _b[0], name_1 = _b[1];
149
+ var v = settings[key];
150
+ if (typeof v === 'string') {
151
+ el(name_1, v);
152
+ }
153
+ else {
154
+ tw(name_1, v);
155
+ }
156
+ }
157
+ }
158
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
159
+ finally {
160
+ try {
161
+ if (TWIPS_ELEMENTS_1_1 && !TWIPS_ELEMENTS_1_1.done && (_a = TWIPS_ELEMENTS_1.return)) _a.call(TWIPS_ELEMENTS_1);
162
+ }
163
+ finally { if (e_1) throw e_1.error; }
164
+ }
165
+ tw('wrapIndent', settings.wrapIndent);
166
+ flag('wrapRight', settings.wrapRight);
167
+ if (settings.integralLimitLocation !== undefined) {
168
+ el('intLim', settings.integralLimitLocation);
169
+ }
170
+ if (settings.naryLimitLocation !== undefined) {
171
+ el('naryLim', settings.naryLimitLocation);
172
+ }
173
+ return createElement(MATH_NAMESPACE, 'mathPr', prefix, { attributes: [], children: kids });
174
+ }
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Generic document-adapter contracts.
3
+ *
4
+ * `ej2-office-common` stays document-agnostic: a host (for example `ej2-docx`)
5
+ * supplies native runs and character formats through {@link MathDocumentAdapter}.
6
+ */
7
+ import { OpenXmlElement } from '../openxml';
8
+ import { OfficeMathFunctionBase } from './function-base';
9
+ import { OfficeMathRunElement } from './run-element';
10
+ /**
11
+ * A document-specific run held by an {@link OfficeMathRunElement}.
12
+ *
13
+ * @public
14
+ */
15
+ export interface OfficeRun {
16
+ /** The run element that contains this run. */
17
+ ownerMathRunElement?: OfficeMathRunElement;
18
+ }
19
+ /**
20
+ * A document-specific character format.
21
+ *
22
+ * @public
23
+ */
24
+ export interface OfficeRunFormat {
25
+ /** Creates an independent copy. */
26
+ clone(): OfficeRunFormat;
27
+ /** Value equality with another format; when omitted, formats are treated as equal. */
28
+ equals?(other: OfficeRunFormat): boolean;
29
+ }
30
+ /**
31
+ * Host integration points used by the Math model, parser, serializer and LaTeX converter.
32
+ *
33
+ * @public
34
+ */
35
+ export interface MathDocumentAdapter {
36
+ /** Creates a native run for the run element. */
37
+ createRun(runElement: OfficeMathRunElement): OfficeRun;
38
+ /** Replaces the run text. */
39
+ setRunText(run: OfficeRun, text: string): void;
40
+ /** Appends text to the run. */
41
+ appendRunText(run: OfficeRun, text: string): void;
42
+ /** Reads the run text. */
43
+ getRunText(run: OfficeRun): string;
44
+ /** Creates the default Math character format for the Math owner. */
45
+ createDefaultMathCharacterFormat(mathOwner: unknown): OfficeRunFormat;
46
+ /** Creates an independent copy of the run. */
47
+ cloneRun(run: OfficeRun): OfficeRun;
48
+ /** Parses `m:ctrlPr` of a function into a native character format. */
49
+ parseControlProperties(element: OpenXmlElement, owner: OfficeMathFunctionBase): OfficeRunFormat;
50
+ /**
51
+ * Parses `m:r` content into the run element, in source order (`w:rPr`, text and other children).
52
+ * The parser has already applied `m:rPr`; the adapter ignores it and must assign `runElement.item`.
53
+ */
54
+ parseMathRun(element: OpenXmlElement, runElement: OfficeMathRunElement): void;
55
+ /** Serializes a control-properties format to the children of `m:ctrlPr`. */
56
+ serializeControlProperties(format: OfficeRunFormat): OpenXmlElement[];
57
+ /** Serializes the run (`w:rPr` and content) to the non-`m:rPr` children of `m:r`. */
58
+ serializeMathRun(runElement: OfficeMathRunElement): OpenXmlElement[];
59
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Generic document-adapter contracts.
3
+ *
4
+ * `ej2-office-common` stays document-agnostic: a host (for example `ej2-docx`)
5
+ * supplies native runs and character formats through {@link MathDocumentAdapter}.
6
+ */
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Minimal document-agnostic run and format used when no document adapter is supplied.
3
+ */
4
+ import { OfficeRun, OfficeRunFormat } from './adapter';
5
+ import { OfficeMathRunElement } from './run-element';
6
+ import { OpenXmlElement } from '../openxml';
7
+ /**
8
+ * Default character format of the standalone package. Keeps a parsed `m:ctrlPr` verbatim.
9
+ *
10
+ * @public
11
+ */
12
+ export declare class BasicRunFormat implements OfficeRunFormat {
13
+ /** The original `m:ctrlPr` element, when the format was parsed from XML. */
14
+ readonly preservedXml: OpenXmlElement | undefined;
15
+ /**
16
+ * Creates the format.
17
+ *
18
+ * @param {OpenXmlElement} preservedXml Optional original `m:ctrlPr` element.
19
+ */
20
+ constructor(preservedXml?: OpenXmlElement);
21
+ /**
22
+ * Creates an independent copy.
23
+ *
24
+ * @returns {OfficeRunFormat} The copy.
25
+ */
26
+ clone(): OfficeRunFormat;
27
+ /**
28
+ * Value equality with another format.
29
+ *
30
+ * @param {OfficeRunFormat} other The format to compare with.
31
+ * @returns {boolean} True when both keep the same XML.
32
+ */
33
+ equals(other: OfficeRunFormat): boolean;
34
+ }
35
+ /**
36
+ * A text segment of a standalone run (`m:t`).
37
+ *
38
+ * @public
39
+ */
40
+ export interface BasicRunText {
41
+ /** Discriminator. */
42
+ readonly kind: 'text';
43
+ /** Text value. */
44
+ readonly value: string;
45
+ /** `xml:space` value of the source element, when present. */
46
+ readonly space?: string;
47
+ }
48
+ /**
49
+ * A non-text child of a standalone run, kept verbatim.
50
+ *
51
+ * @public
52
+ */
53
+ export interface BasicRunXml {
54
+ /** Discriminator. */
55
+ readonly kind: 'xml';
56
+ /** The preserved element. */
57
+ readonly element: OpenXmlElement;
58
+ }
59
+ /**
60
+ * Ordered content item of a standalone run.
61
+ *
62
+ * @public
63
+ */
64
+ export declare type BasicRunPart = BasicRunText | BasicRunXml;
65
+ /**
66
+ * Default run of the standalone package. Keeps text and non-text children in source order.
67
+ *
68
+ * @public
69
+ */
70
+ export declare class BasicRun implements OfficeRun {
71
+ /** The run element that contains this run. */
72
+ ownerMathRunElement?: OfficeMathRunElement;
73
+ /** Run character format. */
74
+ characterFormat: OfficeRunFormat;
75
+ /** The original `w:rPr` element, when parsed from XML. */
76
+ runProperties: OpenXmlElement | undefined;
77
+ /** Ordered run content: text segments and preserved children. */
78
+ readonly parts: BasicRunPart[];
79
+ /**
80
+ * Concatenated text of all text segments.
81
+ *
82
+ * @returns {string} The run text.
83
+ */
84
+ text: string;
85
+ /**
86
+ * Creates an independent copy of the run.
87
+ *
88
+ * @returns {BasicRun} The copy.
89
+ */
90
+ clone(): BasicRun;
91
+ }
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Minimal document-agnostic run and format used when no document adapter is supplied.
3
+ */
4
+ import { xmlEqual } from './xml-equal';
5
+ /**
6
+ * Default character format of the standalone package. Keeps a parsed `m:ctrlPr` verbatim.
7
+ *
8
+ * @public
9
+ */
10
+ var BasicRunFormat = /** @class */ (function () {
11
+ /**
12
+ * Creates the format.
13
+ *
14
+ * @param {OpenXmlElement} preservedXml Optional original `m:ctrlPr` element.
15
+ */
16
+ function BasicRunFormat(preservedXml) {
17
+ this.preservedXml = preservedXml;
18
+ }
19
+ /**
20
+ * Creates an independent copy.
21
+ *
22
+ * @returns {OfficeRunFormat} The copy.
23
+ */
24
+ BasicRunFormat.prototype.clone = function () {
25
+ return new BasicRunFormat(this.preservedXml);
26
+ };
27
+ /**
28
+ * Value equality with another format.
29
+ *
30
+ * @param {OfficeRunFormat} other The format to compare with.
31
+ * @returns {boolean} True when both keep the same XML.
32
+ */
33
+ BasicRunFormat.prototype.equals = function (other) {
34
+ var peer = other instanceof BasicRunFormat ? other : undefined;
35
+ if (peer === undefined) {
36
+ return false;
37
+ }
38
+ if (this.preservedXml === undefined || peer.preservedXml === undefined) {
39
+ return this.preservedXml === peer.preservedXml;
40
+ }
41
+ return xmlEqual(this.preservedXml, peer.preservedXml);
42
+ };
43
+ return BasicRunFormat;
44
+ }());
45
+ export { BasicRunFormat };
46
+ /**
47
+ * Default run of the standalone package. Keeps text and non-text children in source order.
48
+ *
49
+ * @public
50
+ */
51
+ var BasicRun = /** @class */ (function () {
52
+ function BasicRun() {
53
+ /** Run character format. */
54
+ this.characterFormat = new BasicRunFormat();
55
+ /** Ordered run content: text segments and preserved children. */
56
+ this.parts = [];
57
+ }
58
+ Object.defineProperty(BasicRun.prototype, "text", {
59
+ /**
60
+ * Concatenated text of all text segments.
61
+ *
62
+ * @returns {string} The run text.
63
+ */
64
+ get: function () {
65
+ return this.parts.map(function (part) { return part.kind === 'text' ? part.value : ''; }).join('');
66
+ },
67
+ set: function (value) {
68
+ var _this = this;
69
+ var first = this.parts.map(function (part) { return part.kind; }).indexOf('text');
70
+ var kept = this.parts.filter(function (part) { return part.kind !== 'text'; });
71
+ var at = first < 0 ? kept.length : this.parts.slice(0, first).filter(function (p) { return p.kind !== 'text'; }).length;
72
+ kept.splice(at, 0, { kind: 'text', value: value });
73
+ this.parts.length = 0;
74
+ kept.forEach(function (part) { return _this.parts.push(part); });
75
+ },
76
+ enumerable: true,
77
+ configurable: true
78
+ });
79
+ /**
80
+ * Creates an independent copy of the run.
81
+ *
82
+ * @returns {BasicRun} The copy.
83
+ */
84
+ BasicRun.prototype.clone = function () {
85
+ var copy = new BasicRun();
86
+ copy.characterFormat = this.characterFormat.clone();
87
+ copy.runProperties = this.runProperties;
88
+ this.parts.forEach(function (part) { return copy.parts.push(part); });
89
+ return copy;
90
+ };
91
+ return BasicRun;
92
+ }());
93
+ export { BasicRun };
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Math break (`m:brk`) and its collection.
3
+ */
4
+ import { OwnerHolder } from './owner-holder';
5
+ import { OwnedCollection, CollectionOwner } from './collection';
6
+ /**
7
+ * Manual line break inside a Math run, box or run format.
8
+ *
9
+ * @public
10
+ */
11
+ export declare class OfficeMathBreak extends OwnerHolder {
12
+ /** Alignment point (`m:alnAt`) the next line aligns to. Default 0. */
13
+ alignAt: number;
14
+ /** Whether `alignAt` was set or parsed explicitly. */
15
+ readonly hasExplicitAlignAt: boolean;
16
+ }
17
+ /**
18
+ * Ordered collection of {@link OfficeMathBreak}.
19
+ *
20
+ * @public
21
+ */
22
+ export declare class OfficeMathBreakCollection extends OwnedCollection<OfficeMathBreak> {
23
+ constructor(owner: CollectionOwner);
24
+ /**
25
+ * Creates a break and appends it, or inserts it at `index`.
26
+ *
27
+ * @param index
28
+ */
29
+ add(index?: number): OfficeMathBreak;
30
+ }
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Math break (`m:brk`) and its collection.
3
+ */
4
+ var __extends = (this && this.__extends) || (function () {
5
+ var extendStatics = function (d, b) {
6
+ extendStatics = Object.setPrototypeOf ||
7
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
8
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
9
+ return extendStatics(d, b);
10
+ };
11
+ return function (d, b) {
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ import { K } from './keys';
18
+ import { OwnerHolder } from './owner-holder';
19
+ import { OwnedCollection } from './collection';
20
+ /**
21
+ * Manual line break inside a Math run, box or run format.
22
+ *
23
+ * @public
24
+ */
25
+ var OfficeMathBreak = /** @class */ (function (_super) {
26
+ __extends(OfficeMathBreak, _super);
27
+ function OfficeMathBreak() {
28
+ return _super !== null && _super.apply(this, arguments) || this;
29
+ }
30
+ Object.defineProperty(OfficeMathBreak.prototype, "alignAt", {
31
+ /** Alignment point (`m:alnAt`) the next line aligns to. Default 0. */
32
+ get: function () {
33
+ return this.getProperty(K.AlignAt, function () { return 0; });
34
+ },
35
+ set: function (value) {
36
+ this.setProperty(K.AlignAt, value);
37
+ },
38
+ enumerable: true,
39
+ configurable: true
40
+ });
41
+ Object.defineProperty(OfficeMathBreak.prototype, "hasExplicitAlignAt", {
42
+ /** Whether `alignAt` was set or parsed explicitly. */
43
+ get: function () {
44
+ return this.isExplicit(K.AlignAt);
45
+ },
46
+ enumerable: true,
47
+ configurable: true
48
+ });
49
+ return OfficeMathBreak;
50
+ }(OwnerHolder));
51
+ export { OfficeMathBreak };
52
+ /**
53
+ * Ordered collection of {@link OfficeMathBreak}.
54
+ *
55
+ * @public
56
+ */
57
+ var OfficeMathBreakCollection = /** @class */ (function (_super) {
58
+ __extends(OfficeMathBreakCollection, _super);
59
+ function OfficeMathBreakCollection(owner) {
60
+ return _super.call(this, owner) || this;
61
+ }
62
+ /**
63
+ * Creates a break and appends it, or inserts it at `index`.
64
+ *
65
+ * @param index
66
+ */
67
+ OfficeMathBreakCollection.prototype.add = function (index) {
68
+ var item = new OfficeMathBreak(this.owner);
69
+ item.setOwner(undefined);
70
+ this.insertItem(index === undefined ? this.count : index, item);
71
+ return item;
72
+ };
73
+ return OfficeMathBreakCollection;
74
+ }(OwnedCollection));
75
+ export { OfficeMathBreakCollection };
@@ -0,0 +1,104 @@
1
+ /**
2
+ * Generic owner-aware mutable collection used by every Math collection.
3
+ */
4
+ import { OfficeMathEntity } from './entity';
5
+ import { OwnerHolder } from './owner-holder';
6
+ /** Owner of a collection: any Math entity that can bubble mutations. */
7
+ export declare type CollectionOwner = OfficeMathEntity & {
8
+ notifyMutated(): void;
9
+ };
10
+ /**
11
+ * Ordered collection that assigns/detaches owners and notifies the root on change.
12
+ * Items are also reachable by numeric index (`collection[0]`).
13
+ *
14
+ * @public
15
+ */
16
+ export declare abstract class OwnedCollection<T extends OwnerHolder> {
17
+ protected readonly owner: CollectionOwner;
18
+ [index: number]: T;
19
+ private readonly _items;
20
+ private _synced;
21
+ protected constructor(owner: CollectionOwner);
22
+ /** Number of items. */
23
+ readonly count: number;
24
+ /**
25
+ * Returns the item at `index`.
26
+ *
27
+ * @param index
28
+ */
29
+ getItem(index: number): T;
30
+ /**
31
+ * Inserts an item at `index`; throws when it already belongs to a collection.
32
+ *
33
+ * @param index
34
+ * @param item
35
+ */
36
+ insert(index: number, item: T): void;
37
+ /**
38
+ * Removes the item; no-op when it is not in the collection.
39
+ *
40
+ * @param value
41
+ */
42
+ remove(value: T): void;
43
+ /**
44
+ * Removes the item at `index`.
45
+ *
46
+ * @param index
47
+ */
48
+ removeAt(index: number): void;
49
+ /** Removes all items. */
50
+ clear(): void;
51
+ /** Iterates the items in order. */
52
+ [Symbol.iterator](): Iterator<T>;
53
+ /**
54
+ * Snapshot of the items.
55
+ *
56
+ * @private
57
+ */
58
+ toArray(): T[];
59
+ /**
60
+ * Appends without owner assignment or notification (view/internal use).
61
+ *
62
+ * @param item
63
+ * @private
64
+ */
65
+ pushRaw(item: T): void;
66
+ /**
67
+ * Inserts with owner assignment but without the matrix guard or validation (synchronization use).
68
+ *
69
+ * @param index
70
+ * @param item
71
+ * @private
72
+ */
73
+ insertRaw(index: number, item: T): void;
74
+ /**
75
+ * Assigns ownership of an item entering the collection.
76
+ *
77
+ * @param item
78
+ */
79
+ protected attach(item: T): void;
80
+ /**
81
+ * Removes by index and detaches without notification (synchronization use).
82
+ *
83
+ * @param index
84
+ * @private
85
+ */
86
+ removeRawAt(index: number): T;
87
+ /**
88
+ * Inserts after validating index and ownership.
89
+ *
90
+ * @param index
91
+ * @param item
92
+ */
93
+ protected insertItem(index: number, item: T): void;
94
+ /** Hook for subclasses after any structural change. */
95
+ protected afterChange(): void;
96
+ /**
97
+ * Detaches a removed item.
98
+ *
99
+ * @param item
100
+ */
101
+ protected detach(item: T): void;
102
+ private checkIndex;
103
+ private syncIndexes;
104
+ }