mtr.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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.CHTMLmlabeledtr = exports.CHTMLmtr = void 0;
  19. var Wrapper_js_1 = require("../Wrapper.js");
  20. var mtr_js_1 = require("../../common/Wrappers/mtr.js");
  21. var mtr_js_2 = require("../../common/Wrappers/mtr.js");
  22. var mtr_js_3 = require("../../../core/MmlTree/MmlNodes/mtr.js");
  23. var CHTMLmtr = (function (_super) {
  24. __extends(CHTMLmtr, _super);
  25. function CHTMLmtr() {
  26. return _super !== null && _super.apply(this, arguments) || this;
  27. }
  28. CHTMLmtr.prototype.toCHTML = function (parent) {
  29. _super.prototype.toCHTML.call(this, parent);
  30. var align = this.node.attributes.get('rowalign');
  31. if (align !== 'baseline') {
  32. this.adaptor.setAttribute(this.chtml, 'rowalign', align);
  33. }
  34. };
  35. CHTMLmtr.kind = mtr_js_3.MmlMtr.prototype.kind;
  36. CHTMLmtr.styles = {
  37. 'mjx-mtr': {
  38. display: 'table-row',
  39. },
  40. 'mjx-mtr[rowalign="top"] > mjx-mtd': {
  41. 'vertical-align': 'top'
  42. },
  43. 'mjx-mtr[rowalign="center"] > mjx-mtd': {
  44. 'vertical-align': 'middle'
  45. },
  46. 'mjx-mtr[rowalign="bottom"] > mjx-mtd': {
  47. 'vertical-align': 'bottom'
  48. },
  49. 'mjx-mtr[rowalign="baseline"] > mjx-mtd': {
  50. 'vertical-align': 'baseline'
  51. },
  52. 'mjx-mtr[rowalign="axis"] > mjx-mtd': {
  53. 'vertical-align': '.25em'
  54. }
  55. };
  56. return CHTMLmtr;
  57. }((0, mtr_js_1.CommonMtrMixin)(Wrapper_js_1.CHTMLWrapper)));
  58. exports.CHTMLmtr = CHTMLmtr;
  59. var CHTMLmlabeledtr = (function (_super) {
  60. __extends(CHTMLmlabeledtr, _super);
  61. function CHTMLmlabeledtr() {
  62. return _super !== null && _super.apply(this, arguments) || this;
  63. }
  64. CHTMLmlabeledtr.prototype.toCHTML = function (parent) {
  65. _super.prototype.toCHTML.call(this, parent);
  66. var child = this.adaptor.firstChild(this.chtml);
  67. if (child) {
  68. this.adaptor.remove(child);
  69. var align = this.node.attributes.get('rowalign');
  70. var attr = (align !== 'baseline' && align !== 'axis' ? { rowalign: align } : {});
  71. var row = this.html('mjx-mtr', attr, [child]);
  72. this.adaptor.append(this.parent.labels, row);
  73. }
  74. };
  75. CHTMLmlabeledtr.prototype.markUsed = function () {
  76. _super.prototype.markUsed.call(this);
  77. this.jax.wrapperUsage.add(CHTMLmtr.kind);
  78. };
  79. CHTMLmlabeledtr.kind = mtr_js_3.MmlMlabeledtr.prototype.kind;
  80. CHTMLmlabeledtr.styles = {
  81. 'mjx-mlabeledtr': {
  82. display: 'table-row'
  83. },
  84. 'mjx-mlabeledtr[rowalign="top"] > mjx-mtd': {
  85. 'vertical-align': 'top'
  86. },
  87. 'mjx-mlabeledtr[rowalign="center"] > mjx-mtd': {
  88. 'vertical-align': 'middle'
  89. },
  90. 'mjx-mlabeledtr[rowalign="bottom"] > mjx-mtd': {
  91. 'vertical-align': 'bottom'
  92. },
  93. 'mjx-mlabeledtr[rowalign="baseline"] > mjx-mtd': {
  94. 'vertical-align': 'baseline'
  95. },
  96. 'mjx-mlabeledtr[rowalign="axis"] > mjx-mtd': {
  97. 'vertical-align': '.25em'
  98. }
  99. };
  100. return CHTMLmlabeledtr;
  101. }((0, mtr_js_2.CommonMlabeledtrMixin)(CHTMLmtr)));
  102. exports.CHTMLmlabeledtr = CHTMLmlabeledtr;
  103. //# sourceMappingURL=mtr.js.map