mtd.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. "use strict";
  2. var __extends = (this && this.__extends) || (function () {
  3. var extendStatics = function (d, b) {
  4. extendStatics = Object.setPrototypeOf ||
  5. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  6. function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
  7. return extendStatics(d, b);
  8. };
  9. return function (d, b) {
  10. if (typeof b !== "function" && b !== null)
  11. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  12. extendStatics(d, b);
  13. function __() { this.constructor = d; }
  14. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15. };
  16. })();
  17. Object.defineProperty(exports, "__esModule", { value: true });
  18. exports.CHTMLmtd = void 0;
  19. var Wrapper_js_1 = require("../Wrapper.js");
  20. var mtd_js_1 = require("../../common/Wrappers/mtd.js");
  21. var mtd_js_2 = require("../../../core/MmlTree/MmlNodes/mtd.js");
  22. var CHTMLmtd = (function (_super) {
  23. __extends(CHTMLmtd, _super);
  24. function CHTMLmtd() {
  25. return _super !== null && _super.apply(this, arguments) || this;
  26. }
  27. CHTMLmtd.prototype.toCHTML = function (parent) {
  28. _super.prototype.toCHTML.call(this, parent);
  29. var ralign = this.node.attributes.get('rowalign');
  30. var calign = this.node.attributes.get('columnalign');
  31. var palign = this.parent.node.attributes.get('rowalign');
  32. if (ralign !== palign) {
  33. this.adaptor.setAttribute(this.chtml, 'rowalign', ralign);
  34. }
  35. if (calign !== 'center' &&
  36. (this.parent.kind !== 'mlabeledtr' || this !== this.parent.childNodes[0] ||
  37. calign !== this.parent.parent.node.attributes.get('side'))) {
  38. this.adaptor.setStyle(this.chtml, 'textAlign', calign);
  39. }
  40. if (this.parent.parent.node.getProperty('useHeight')) {
  41. this.adaptor.append(this.chtml, this.html('mjx-tstrut'));
  42. }
  43. };
  44. CHTMLmtd.kind = mtd_js_2.MmlMtd.prototype.kind;
  45. CHTMLmtd.styles = {
  46. 'mjx-mtd': {
  47. display: 'table-cell',
  48. 'text-align': 'center',
  49. 'padding': '.215em .4em'
  50. },
  51. 'mjx-mtd:first-child': {
  52. 'padding-left': 0
  53. },
  54. 'mjx-mtd:last-child': {
  55. 'padding-right': 0
  56. },
  57. 'mjx-mtable > * > mjx-itable > *:first-child > mjx-mtd': {
  58. 'padding-top': 0
  59. },
  60. 'mjx-mtable > * > mjx-itable > *:last-child > mjx-mtd': {
  61. 'padding-bottom': 0
  62. },
  63. 'mjx-tstrut': {
  64. display: 'inline-block',
  65. height: '1em',
  66. 'vertical-align': '-.25em'
  67. },
  68. 'mjx-labels[align="left"] > mjx-mtr > mjx-mtd': {
  69. 'text-align': 'left'
  70. },
  71. 'mjx-labels[align="right"] > mjx-mtr > mjx-mtd': {
  72. 'text-align': 'right'
  73. },
  74. 'mjx-mtd[extra]': {
  75. padding: 0
  76. },
  77. 'mjx-mtd[rowalign="top"]': {
  78. 'vertical-align': 'top'
  79. },
  80. 'mjx-mtd[rowalign="center"]': {
  81. 'vertical-align': 'middle'
  82. },
  83. 'mjx-mtd[rowalign="bottom"]': {
  84. 'vertical-align': 'bottom'
  85. },
  86. 'mjx-mtd[rowalign="baseline"]': {
  87. 'vertical-align': 'baseline'
  88. },
  89. 'mjx-mtd[rowalign="axis"]': {
  90. 'vertical-align': '.25em'
  91. }
  92. };
  93. return CHTMLmtd;
  94. }((0, mtd_js_1.CommonMtdMixin)(Wrapper_js_1.CHTMLWrapper)));
  95. exports.CHTMLmtd = CHTMLmtd;
  96. //# sourceMappingURL=mtd.js.map