6f80c773d7df66b31058184a329c0ffca3a15d09ff83fe51d1dadd53b77a8552d98cadf37a63df0ed0d510b3068e63c476f336869e10b5de473fb068484191 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649
  1. import {
  2. getStyle,
  3. getTrimmingContainer,
  4. hasClass,
  5. index,
  6. offset,
  7. removeClass,
  8. removeTextNodes,
  9. overlayContainsElement,
  10. closest
  11. } from './../../../helpers/dom/element';
  12. import {isFunction} from './../../../helpers/function';
  13. import CellCoords from './cell/coords';
  14. import CellRange from './cell/range';
  15. import ColumnFilter from './filter/column';
  16. import RowFilter from './filter/row';
  17. import TableRenderer from './tableRenderer';
  18. import Overlay from './overlay/_base';
  19. /**
  20. *
  21. */
  22. class Table {
  23. /**
  24. * @param {Walkontable} wotInstance
  25. * @param {HTMLTableElement} table
  26. */
  27. constructor(wotInstance, table) {
  28. this.wot = wotInstance;
  29. // legacy support
  30. this.instance = this.wot;
  31. this.TABLE = table;
  32. this.TBODY = null;
  33. this.THEAD = null;
  34. this.COLGROUP = null;
  35. this.tableOffset = 0;
  36. this.holderOffset = 0;
  37. removeTextNodes(this.TABLE);
  38. this.spreader = this.createSpreader(this.TABLE);
  39. this.hider = this.createHider(this.spreader);
  40. this.holder = this.createHolder(this.hider);
  41. this.wtRootElement = this.holder.parentNode;
  42. this.alignOverlaysWithTrimmingContainer();
  43. this.fixTableDomTree();
  44. this.colgroupChildrenLength = this.COLGROUP.childNodes.length;
  45. this.theadChildrenLength = this.THEAD.firstChild ? this.THEAD.firstChild.childNodes.length : 0;
  46. this.tbodyChildrenLength = this.TBODY.childNodes.length;
  47. this.rowFilter = null;
  48. this.columnFilter = null;
  49. this.correctHeaderWidth = false;
  50. const origRowHeaderWidth = this.wot.wtSettings.settings.rowHeaderWidth;
  51. // Fix for jumping row headers (https://github.com/handsontable/handsontable/issues/3850)
  52. this.wot.wtSettings.settings.rowHeaderWidth = () => this._modifyRowHeaderWidth(origRowHeaderWidth);
  53. }
  54. /**
  55. *
  56. */
  57. fixTableDomTree() {
  58. this.TBODY = this.TABLE.querySelector('tbody');
  59. if (!this.TBODY) {
  60. this.TBODY = document.createElement('tbody');
  61. this.TABLE.appendChild(this.TBODY);
  62. }
  63. this.THEAD = this.TABLE.querySelector('thead');
  64. if (!this.THEAD) {
  65. this.THEAD = document.createElement('thead');
  66. this.TABLE.insertBefore(this.THEAD, this.TBODY);
  67. }
  68. this.COLGROUP = this.TABLE.querySelector('colgroup');
  69. if (!this.COLGROUP) {
  70. this.COLGROUP = document.createElement('colgroup');
  71. this.TABLE.insertBefore(this.COLGROUP, this.THEAD);
  72. }
  73. if (this.wot.getSetting('columnHeaders').length && !this.THEAD.childNodes.length) {
  74. this.THEAD.appendChild(document.createElement('TR'));
  75. }
  76. }
  77. /**
  78. * @param table
  79. * @returns {HTMLElement}
  80. */
  81. createSpreader(table) {
  82. const parent = table.parentNode;
  83. let spreader;
  84. if (!parent || parent.nodeType !== 1 || !hasClass(parent, 'wtHolder')) {
  85. spreader = document.createElement('div');
  86. spreader.className = 'wtSpreader';
  87. if (parent) {
  88. // if TABLE is detached (e.g. in Jasmine test), it has no parentNode so we cannot attach holder to it
  89. parent.insertBefore(spreader, table);
  90. }
  91. spreader.appendChild(table);
  92. }
  93. spreader.style.position = 'relative';
  94. return spreader;
  95. }
  96. /**
  97. * @param spreader
  98. * @returns {HTMLElement}
  99. */
  100. createHider(spreader) {
  101. const parent = spreader.parentNode;
  102. let hider;
  103. if (!parent || parent.nodeType !== 1 || !hasClass(parent, 'wtHolder')) {
  104. hider = document.createElement('div');
  105. hider.className = 'wtHider';
  106. if (parent) {
  107. // if TABLE is detached (e.g. in Jasmine test), it has no parentNode so we cannot attach holder to it
  108. parent.insertBefore(hider, spreader);
  109. }
  110. hider.appendChild(spreader);
  111. }
  112. return hider;
  113. }
  114. /**
  115. *
  116. * @param hider
  117. * @returns {HTMLElement}
  118. */
  119. createHolder(hider) {
  120. const parent = hider.parentNode;
  121. let holder;
  122. if (!parent || parent.nodeType !== 1 || !hasClass(parent, 'wtHolder')) {
  123. holder = document.createElement('div');
  124. holder.style.position = 'relative';
  125. holder.className = 'wtHolder';
  126. if (parent) {
  127. // if TABLE is detached (e.g. in Jasmine test), it has no parentNode so we cannot attach holder to it
  128. parent.insertBefore(holder, hider);
  129. }
  130. if (!this.isWorkingOnClone()) {
  131. holder.parentNode.className += 'ht_master handsontable';
  132. }
  133. holder.appendChild(hider);
  134. }
  135. return holder;
  136. }
  137. alignOverlaysWithTrimmingContainer() {
  138. const trimmingElement = getTrimmingContainer(this.wtRootElement);
  139. if (!this.isWorkingOnClone()) {
  140. this.holder.parentNode.style.position = 'relative';
  141. if (trimmingElement === window) {
  142. let preventOverflow = this.wot.getSetting('preventOverflow');
  143. if (!preventOverflow) {
  144. this.holder.style.overflow = 'visible';
  145. this.wtRootElement.style.overflow = 'visible';
  146. }
  147. } else {
  148. this.holder.style.width = getStyle(trimmingElement, 'width');
  149. this.holder.style.height = getStyle(trimmingElement, 'height');
  150. this.holder.style.overflow = '';
  151. }
  152. }
  153. }
  154. isWorkingOnClone() {
  155. return !!this.wot.cloneSource;
  156. }
  157. /**
  158. * Redraws the table
  159. *
  160. * @param {Boolean} fastDraw If TRUE, will try to avoid full redraw and only update the border positions. If FALSE or UNDEFINED, will perform a full redraw
  161. * @returns {Table}
  162. */
  163. draw(fastDraw) {
  164. const {wtOverlays, wtViewport} = this.wot;
  165. let totalRows = this.instance.getSetting('totalRows');
  166. let rowHeaders = this.wot.getSetting('rowHeaders').length;
  167. let columnHeaders = this.wot.getSetting('columnHeaders').length;
  168. let syncScroll = false;
  169. if (!this.isWorkingOnClone()) {
  170. this.holderOffset = offset(this.holder);
  171. fastDraw = wtViewport.createRenderCalculators(fastDraw);
  172. if (rowHeaders && !this.wot.getSetting('fixedColumnsLeft')) {
  173. const leftScrollPos = wtOverlays.leftOverlay.getScrollPosition();
  174. const previousState = this.correctHeaderWidth;
  175. this.correctHeaderWidth = leftScrollPos > 0;
  176. if (previousState !== this.correctHeaderWidth) {
  177. fastDraw = false;
  178. }
  179. }
  180. }
  181. if (!this.isWorkingOnClone()) {
  182. syncScroll = wtOverlays.prepareOverlays();
  183. }
  184. if (fastDraw) {
  185. if (!this.isWorkingOnClone()) {
  186. // in case we only scrolled without redraw, update visible rows information in oldRowsCalculator
  187. wtViewport.createVisibleCalculators();
  188. }
  189. if (wtOverlays) {
  190. wtOverlays.refresh(true);
  191. }
  192. } else {
  193. if (this.isWorkingOnClone()) {
  194. this.tableOffset = this.wot.cloneSource.wtTable.tableOffset;
  195. } else {
  196. this.tableOffset = offset(this.TABLE);
  197. }
  198. let startRow;
  199. if (Overlay.isOverlayTypeOf(this.wot.cloneOverlay, Overlay.CLONE_DEBUG) ||
  200. Overlay.isOverlayTypeOf(this.wot.cloneOverlay, Overlay.CLONE_TOP) ||
  201. Overlay.isOverlayTypeOf(this.wot.cloneOverlay, Overlay.CLONE_TOP_LEFT_CORNER)) {
  202. startRow = 0;
  203. } else if (Overlay.isOverlayTypeOf(this.instance.cloneOverlay, Overlay.CLONE_BOTTOM) ||
  204. Overlay.isOverlayTypeOf(this.instance.cloneOverlay, Overlay.CLONE_BOTTOM_LEFT_CORNER)) {
  205. startRow = Math.max(totalRows - this.wot.getSetting('fixedRowsBottom'), 0);
  206. } else {
  207. startRow = wtViewport.rowsRenderCalculator.startRow;
  208. }
  209. let startColumn;
  210. if (Overlay.isOverlayTypeOf(this.wot.cloneOverlay, Overlay.CLONE_DEBUG) ||
  211. Overlay.isOverlayTypeOf(this.wot.cloneOverlay, Overlay.CLONE_LEFT) ||
  212. Overlay.isOverlayTypeOf(this.wot.cloneOverlay, Overlay.CLONE_TOP_LEFT_CORNER) ||
  213. Overlay.isOverlayTypeOf(this.wot.cloneOverlay, Overlay.CLONE_BOTTOM_LEFT_CORNER)) {
  214. startColumn = 0;
  215. } else {
  216. startColumn = wtViewport.columnsRenderCalculator.startColumn;
  217. }
  218. this.rowFilter = new RowFilter(startRow, totalRows, columnHeaders);
  219. this.columnFilter = new ColumnFilter(startColumn, this.wot.getSetting('totalColumns'), rowHeaders);
  220. this.alignOverlaysWithTrimmingContainer();
  221. this._doDraw(); // creates calculator after draw
  222. }
  223. this.refreshSelections(fastDraw);
  224. if (!this.isWorkingOnClone()) {
  225. wtOverlays.topOverlay.resetFixedPosition();
  226. if (wtOverlays.bottomOverlay.clone) {
  227. wtOverlays.bottomOverlay.resetFixedPosition();
  228. }
  229. wtOverlays.leftOverlay.resetFixedPosition();
  230. if (wtOverlays.topLeftCornerOverlay) {
  231. wtOverlays.topLeftCornerOverlay.resetFixedPosition();
  232. }
  233. if (wtOverlays.bottomLeftCornerOverlay && wtOverlays.bottomLeftCornerOverlay.clone) {
  234. wtOverlays.bottomLeftCornerOverlay.resetFixedPosition();
  235. }
  236. }
  237. if (syncScroll) {
  238. wtOverlays.syncScrollWithMaster();
  239. }
  240. this.wot.drawn = true;
  241. return this;
  242. }
  243. _doDraw() {
  244. const wtRenderer = new TableRenderer(this);
  245. wtRenderer.render();
  246. }
  247. removeClassFromCells(className) {
  248. const nodes = this.TABLE.querySelectorAll(`.${className}`);
  249. for (let i = 0, len = nodes.length; i < len; i++) {
  250. removeClass(nodes[i], className);
  251. }
  252. }
  253. refreshSelections(fastDraw) {
  254. if (!this.wot.selections) {
  255. return;
  256. }
  257. let len = this.wot.selections.length;
  258. if (fastDraw) {
  259. for (let i = 0; i < len; i++) {
  260. // there was no rerender, so we need to remove classNames by ourselves
  261. if (this.wot.selections[i].settings.className) {
  262. this.removeClassFromCells(this.wot.selections[i].settings.className);
  263. }
  264. if (this.wot.selections[i].settings.highlightHeaderClassName) {
  265. this.removeClassFromCells(this.wot.selections[i].settings.highlightHeaderClassName);
  266. }
  267. if (this.wot.selections[i].settings.highlightRowClassName) {
  268. this.removeClassFromCells(this.wot.selections[i].settings.highlightRowClassName);
  269. }
  270. if (this.wot.selections[i].settings.highlightColumnClassName) {
  271. this.removeClassFromCells(this.wot.selections[i].settings.highlightColumnClassName);
  272. }
  273. }
  274. }
  275. for (let i = 0; i < len; i++) {
  276. this.wot.selections[i].draw(this.wot, fastDraw);
  277. }
  278. }
  279. /**
  280. * Get cell element at coords.
  281. *
  282. * @param {CellCoords} coords
  283. * @returns {HTMLElement|Number} HTMLElement on success or Number one of the exit codes on error:
  284. * -1 row before viewport
  285. * -2 row after viewport
  286. */
  287. getCell(coords) {
  288. if (this.isRowBeforeRenderedRows(coords.row)) {
  289. // row before rendered rows
  290. return -1;
  291. } else if (this.isRowAfterRenderedRows(coords.row)) {
  292. // row after rendered rows
  293. return -2;
  294. }
  295. const TR = this.TBODY.childNodes[this.rowFilter.sourceToRendered(coords.row)];
  296. if (TR) {
  297. return TR.childNodes[this.columnFilter.sourceColumnToVisibleRowHeadedColumn(coords.col)];
  298. }
  299. }
  300. /**
  301. * getColumnHeader
  302. *
  303. * @param {Number} col Column index
  304. * @param {Number} [level=0] Header level (0 = most distant to the table)
  305. * @returns {Object} HTMLElement on success or undefined on error
  306. */
  307. getColumnHeader(col, level = 0) {
  308. const TR = this.THEAD.childNodes[level];
  309. if (TR) {
  310. return TR.childNodes[this.columnFilter.sourceColumnToVisibleRowHeadedColumn(col)];
  311. }
  312. }
  313. /**
  314. * getRowHeader
  315. *
  316. * @param {Number} row Row index
  317. * @returns {HTMLElement} HTMLElement on success or Number one of the exit codes on error: `null table doesn't have row headers`
  318. */
  319. getRowHeader(row) {
  320. if (this.columnFilter.sourceColumnToVisibleRowHeadedColumn(0) === 0) {
  321. return null;
  322. }
  323. const TR = this.TBODY.childNodes[this.rowFilter.sourceToRendered(row)];
  324. if (TR) {
  325. return TR.childNodes[0];
  326. }
  327. }
  328. /**
  329. * Returns cell coords object for a given TD (or a child element of a TD element).
  330. *
  331. * @param {HTMLTableCellElement} TD A cell DOM element (or a child of one).
  332. * @returns {CellCoords|null} The coordinates of the provided TD element (or the closest TD element) or null, if the provided element is not applicable.
  333. */
  334. getCoords(TD) {
  335. if (TD.nodeName !== 'TD' && TD.nodeName !== 'TH') {
  336. TD = closest(TD, ['TD', 'TH']);
  337. }
  338. if (TD === null) {
  339. return null;
  340. }
  341. const TR = TD.parentNode;
  342. const CONTAINER = TR.parentNode;
  343. let row = index(TR);
  344. let col = TD.cellIndex;
  345. if (overlayContainsElement(Overlay.CLONE_TOP_LEFT_CORNER, TD) || overlayContainsElement(Overlay.CLONE_TOP, TD)) {
  346. if (CONTAINER.nodeName === 'THEAD') {
  347. row -= CONTAINER.childNodes.length;
  348. }
  349. } else if (CONTAINER === this.THEAD) {
  350. row = this.rowFilter.visibleColHeadedRowToSourceRow(row);
  351. } else {
  352. row = this.rowFilter.renderedToSource(row);
  353. }
  354. if (overlayContainsElement(Overlay.CLONE_TOP_LEFT_CORNER, TD) || overlayContainsElement(Overlay.CLONE_LEFT, TD)) {
  355. col = this.columnFilter.offsettedTH(col);
  356. } else {
  357. col = this.columnFilter.visibleRowHeadedColumnToSourceColumn(col);
  358. }
  359. return new CellCoords(row, col);
  360. }
  361. getTrForRow(row) {
  362. return this.TBODY.childNodes[this.rowFilter.sourceToRendered(row)];
  363. }
  364. getFirstRenderedRow() {
  365. return this.wot.wtViewport.rowsRenderCalculator.startRow;
  366. }
  367. getFirstVisibleRow() {
  368. return this.wot.wtViewport.rowsVisibleCalculator.startRow;
  369. }
  370. getFirstRenderedColumn() {
  371. return this.wot.wtViewport.columnsRenderCalculator.startColumn;
  372. }
  373. /**
  374. * @returns {Number} Returns -1 if no row is visible
  375. */
  376. getFirstVisibleColumn() {
  377. return this.wot.wtViewport.columnsVisibleCalculator.startColumn;
  378. }
  379. /**
  380. * @returns {Number} Returns -1 if no row is visible
  381. */
  382. getLastRenderedRow() {
  383. return this.wot.wtViewport.rowsRenderCalculator.endRow;
  384. }
  385. getLastVisibleRow() {
  386. return this.wot.wtViewport.rowsVisibleCalculator.endRow;
  387. }
  388. getLastRenderedColumn() {
  389. return this.wot.wtViewport.columnsRenderCalculator.endColumn;
  390. }
  391. /**
  392. * @returns {Number} Returns -1 if no column is visible
  393. */
  394. getLastVisibleColumn() {
  395. return this.wot.wtViewport.columnsVisibleCalculator.endColumn;
  396. }
  397. isRowBeforeRenderedRows(row) {
  398. return this.rowFilter && (this.rowFilter.sourceToRendered(row) < 0 && row >= 0);
  399. }
  400. isRowAfterViewport(row) {
  401. return this.rowFilter && (this.rowFilter.sourceToRendered(row) > this.getLastVisibleRow());
  402. }
  403. isRowAfterRenderedRows(row) {
  404. return this.rowFilter && (this.rowFilter.sourceToRendered(row) > this.getLastRenderedRow());
  405. }
  406. isColumnBeforeViewport(column) {
  407. return this.columnFilter && (this.columnFilter.sourceToRendered(column) < 0 && column >= 0);
  408. }
  409. isColumnAfterViewport(column) {
  410. return this.columnFilter && (this.columnFilter.sourceToRendered(column) > this.getLastVisibleColumn());
  411. }
  412. isLastRowFullyVisible() {
  413. return this.getLastVisibleRow() === this.getLastRenderedRow();
  414. }
  415. isLastColumnFullyVisible() {
  416. return this.getLastVisibleColumn() === this.getLastRenderedColumn();
  417. }
  418. getRenderedColumnsCount() {
  419. let columnsCount = this.wot.wtViewport.columnsRenderCalculator.count;
  420. let totalColumns = this.wot.getSetting('totalColumns');
  421. if (this.wot.isOverlayName(Overlay.CLONE_DEBUG)) {
  422. columnsCount = totalColumns;
  423. } else if (this.wot.isOverlayName(Overlay.CLONE_LEFT) ||
  424. this.wot.isOverlayName(Overlay.CLONE_TOP_LEFT_CORNER) ||
  425. this.wot.isOverlayName(Overlay.CLONE_BOTTOM_LEFT_CORNER)) {
  426. return Math.min(this.wot.getSetting('fixedColumnsLeft'), totalColumns);
  427. }
  428. return columnsCount;
  429. }
  430. getRenderedRowsCount() {
  431. let rowsCount = this.wot.wtViewport.rowsRenderCalculator.count;
  432. let totalRows = this.wot.getSetting('totalRows');
  433. if (this.wot.isOverlayName(Overlay.CLONE_DEBUG)) {
  434. rowsCount = totalRows;
  435. } else if (this.wot.isOverlayName(Overlay.CLONE_TOP) ||
  436. this.wot.isOverlayName(Overlay.CLONE_TOP_LEFT_CORNER)) {
  437. rowsCount = Math.min(this.wot.getSetting('fixedRowsTop'), totalRows);
  438. } else if (this.wot.isOverlayName(Overlay.CLONE_BOTTOM) ||
  439. this.wot.isOverlayName(Overlay.CLONE_BOTTOM_LEFT_CORNER)) {
  440. rowsCount = Math.min(this.wot.getSetting('fixedRowsBottom'), totalRows);
  441. }
  442. return rowsCount;
  443. }
  444. getVisibleRowsCount() {
  445. return this.wot.wtViewport.rowsVisibleCalculator.count;
  446. }
  447. allRowsInViewport() {
  448. return this.wot.getSetting('totalRows') == this.getVisibleRowsCount();
  449. }
  450. /**
  451. * Checks if any of the row's cells content exceeds its initial height, and if so, returns the oversized height
  452. *
  453. * @param {Number} sourceRow
  454. * @returns {Number}
  455. */
  456. getRowHeight(sourceRow) {
  457. let height = this.wot.wtSettings.settings.rowHeight(sourceRow);
  458. let oversizedHeight = this.wot.wtViewport.oversizedRows[sourceRow];
  459. if (oversizedHeight !== void 0) {
  460. height = height === void 0 ? oversizedHeight : Math.max(height, oversizedHeight);
  461. }
  462. return height;
  463. }
  464. getColumnHeaderHeight(level) {
  465. let height = this.wot.wtSettings.settings.defaultRowHeight;
  466. let oversizedHeight = this.wot.wtViewport.oversizedColumnHeaders[level];
  467. if (oversizedHeight !== void 0) {
  468. height = height ? Math.max(height, oversizedHeight) : oversizedHeight;
  469. }
  470. return height;
  471. }
  472. getVisibleColumnsCount() {
  473. return this.wot.wtViewport.columnsVisibleCalculator.count;
  474. }
  475. allColumnsInViewport() {
  476. return this.wot.getSetting('totalColumns') == this.getVisibleColumnsCount();
  477. }
  478. getColumnWidth(sourceColumn) {
  479. let width = this.wot.wtSettings.settings.columnWidth;
  480. if (typeof width === 'function') {
  481. width = width(sourceColumn);
  482. } else if (typeof width === 'object') {
  483. width = width[sourceColumn];
  484. }
  485. return width || this.wot.wtSettings.settings.defaultColumnWidth;
  486. }
  487. getStretchedColumnWidth(sourceColumn) {
  488. let columnWidth = this.getColumnWidth(sourceColumn);
  489. let width = columnWidth == null ? this.instance.wtSettings.settings.defaultColumnWidth : columnWidth;
  490. let calculator = this.wot.wtViewport.columnsRenderCalculator;
  491. if (calculator) {
  492. let stretchedWidth = calculator.getStretchedColumnWidth(sourceColumn, width);
  493. if (stretchedWidth) {
  494. width = stretchedWidth;
  495. }
  496. }
  497. return width;
  498. }
  499. /**
  500. * Modify row header widths provided by user in class contructor.
  501. *
  502. * @private
  503. */
  504. _modifyRowHeaderWidth(rowHeaderWidthFactory) {
  505. let widths = isFunction(rowHeaderWidthFactory) ? rowHeaderWidthFactory() : null;
  506. if (Array.isArray(widths)) {
  507. widths = [...widths];
  508. widths[widths.length - 1] = this._correctRowHeaderWidth(widths[widths.length - 1]);
  509. } else {
  510. widths = this._correctRowHeaderWidth(widths);
  511. }
  512. return widths;
  513. }
  514. /**
  515. * Correct row header width if necessary.
  516. *
  517. * @private
  518. */
  519. _correctRowHeaderWidth(width) {
  520. if (typeof width !== 'number') {
  521. width = this.wot.getSetting('defaultColumnWidth');
  522. }
  523. if (this.correctHeaderWidth) {
  524. width++;
  525. }
  526. return width;
  527. }
  528. }
  529. export default Table;