@native-html/heuristic-table-plugin
Version:
🔠A 100% native component using heuristics to render tables in react-native-render-html
27 lines (21 loc) • 1.17 kB
JavaScript
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
import { sum } from 'ramda';
import computeColumnWidths from './helpers/computeColumnWidths';
import createRenderTree from './helpers/createRenderTree';
import fillTableDisplay, { createEmptyDisplay } from './helpers/fillTableDisplay';
import TCellConstraintsComputer from './helpers/TCellConstraintsComputer';
export default class TableLayout {
constructor(tnode, config) {
_defineProperty(this, "display", void 0);
_defineProperty(this, "columnWidths", void 0);
_defineProperty(this, "totalWidth", void 0);
_defineProperty(this, "renderTree", void 0);
const computer = new TCellConstraintsComputer({});
this.display = createEmptyDisplay(config);
fillTableDisplay(tnode, this.display, computer);
this.columnWidths = computeColumnWidths(this.display);
this.totalWidth = sum(this.columnWidths);
this.renderTree = createRenderTree(this.display, this.columnWidths);
}
}
//# sourceMappingURL=TableLayout.js.map