* Defines default configuration and initializes WalkOnTable instance. * * @private
()
| 766 | * @private |
| 767 | */ |
| 768 | initializeWalkontable() { |
| 769 | const walkontableConfig = { |
| 770 | ariaTags: this.settings.ariaTags, |
| 771 | rtlMode: this.hot.isRtl(), |
| 772 | externalRowCalculator: this.hot.getPlugin('autoRowSize') && |
| 773 | this.hot.getPlugin('autoRowSize').isEnabled(), |
| 774 | table: this.#table, |
| 775 | isDataViewInstance: () => isRootInstance(this.hot), |
| 776 | preventOverflow: () => this.settings.preventOverflow, |
| 777 | preventWheel: () => this.settings.preventWheel, |
| 778 | viewportColumnRenderingThreshold: () => this.settings.viewportColumnRenderingThreshold, |
| 779 | viewportRowRenderingThreshold: () => this.settings.viewportRowRenderingThreshold, |
| 780 | data: (renderableRow: number, renderableColumn: number) => { |
| 781 | const [visualRow, visualCol] = this.translateFromRenderableToVisualIndex(renderableRow, renderableColumn); |
| 782 | |
| 783 | return this.hot.getDataAtCell(visualRow, visualCol); |
| 784 | }, |
| 785 | totalRows: () => this.countRenderableRows(), |
| 786 | totalColumns: () => this.countRenderableColumns(), |
| 787 | // Number of renderable columns for the left overlay. |
| 788 | fixedColumnsStart: () => this.countNotHiddenFixedColumnsStart(), |
| 789 | // Number of renderable rows for the top overlay. |
| 790 | fixedRowsTop: () => this.countNotHiddenFixedRowsTop(), |
| 791 | // Number of renderable rows for the bottom overlay. |
| 792 | fixedRowsBottom: () => this.countNotHiddenFixedRowsBottom(), |
| 793 | // Enable the inline start overlay when conditions are met. |
| 794 | shouldRenderInlineStartOverlay: () => { |
| 795 | return (this.settings.fixedColumnsStart ?? 0) > 0 || walkontableConfig.rowHeaders().length > 0; |
| 796 | }, |
| 797 | // Enable the top overlay when conditions are met. |
| 798 | shouldRenderTopOverlay: () => { |
| 799 | return (this.settings.fixedRowsTop ?? 0) > 0 || walkontableConfig.columnHeaders().length > 0; |
| 800 | }, |
| 801 | // Enable the bottom overlay when conditions are met. |
| 802 | shouldRenderBottomOverlay: () => { |
| 803 | return (this.settings.fixedRowsBottom ?? 0) > 0; |
| 804 | }, |
| 805 | minSpareRows: () => this.settings.minSpareRows, |
| 806 | renderAllRows: this.settings.renderAllRows, |
| 807 | renderAllColumns: this.settings.renderAllColumns, |
| 808 | rowHeaders: () => { |
| 809 | const headerRenderers = []; |
| 810 | |
| 811 | if (this.hot.hasRowHeaders()) { |
| 812 | headerRenderers.push((renderableRowIndex: number, TH: HTMLTableCellElement) => { |
| 813 | // TODO: Some helper may be needed. |
| 814 | // We perform translation for row indexes (without row headers). |
| 815 | const visualRowIndex = renderableRowIndex >= 0 ? |
| 816 | this.hot.rowIndexMapper.getVisualFromRenderableIndex(renderableRowIndex) : renderableRowIndex; |
| 817 | |
| 818 | this.appendRowHeader(visualRowIndex!, TH); |
| 819 | }); |
| 820 | } |
| 821 | |
| 822 | this.hot.runHooks('afterGetRowHeaderRenderers', headerRenderers); |
| 823 | this.#rowHeadersCount = headerRenderers.length; |
| 824 | |
| 825 | if (this.hot.getSettings().ariaTags) { |
no test coverage detected