Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
onBeforeRemoveRow(index, amount) {
this.removedRows.length = 0;
if (index !== false) {
// Collect physical row index.
rangeEach(index, index + amount - 1, (removedIndex) => {
this.removedRows.push(this.hot.runHooks('modifyRow', removedIndex, this.pluginName));
});
}
}
onAfterViewportColumnCalculatorOverride(calc) {
let newStartColumn = calc.startColumn;
rangeEach(0, Math.max(this.columnHeaderLevelCount - 1, 0), (l) => {
let startColumnNestedParent = this.getNestedParent(l, calc.startColumn);
if (startColumnNestedParent < calc.startColumn) {
let earlierColumn = Math.min(newStartColumn, startColumnNestedParent);
newStartColumn = earlierColumn;
}
});
calc.startColumn = newStartColumn;
}
value: function getChildHeaders(row, column) {
var level = this.rowCoordsToLevel(row);
var childColspanLevel = this.colspanArray[level + 1];
var nestedParentCol = this.getNestedParent(level, column);
var colspan = this.colspanArray[level][column].colspan;
var childHeaderRange = [];
if (!childColspanLevel) {
return childHeaderRange;
}
rangeEach(nestedParentCol, nestedParentCol + colspan - 1, function (i) {
if (childColspanLevel[i] && childColspanLevel[i].colspan > 1) {
colspan -= childColspanLevel[i].colspan - 1;
}
if (childColspanLevel[i] && !childColspanLevel[i].hidden && childHeaderRange.indexOf(i) === -1) {
childHeaderRange.push(i);
}
});
return childHeaderRange;
}
beforeHiddenColumns.length = 0;
afterHiddenColumns.length = 0;
var _getSelectedRangeLast2 = this.getSelectedRangeLast(),
from = _getSelectedRangeLast2.from,
to = _getSelectedRangeLast2.to;
var start = Math.min(from.col, to.col);
var end = Math.max(from.col, to.col);
var hiddenInSelection = false;
if (start === end) {
var totalColumnLength = this.countSourceCols();
rangeEach(0, totalColumnLength, function (column) {
var partedHiddenLength = beforeHiddenColumns.length + afterHiddenColumns.length;
if (partedHiddenLength === hiddenColumnsPlugin.hiddenColumns.length) {
return false;
}
if (column < start && hiddenColumnsPlugin.isHidden(column)) {
beforeHiddenColumns.push(column);
} else if (hiddenColumnsPlugin.isHidden(column)) {
afterHiddenColumns.push(column);
}
});
totalColumnLength -= 1;
if (beforeHiddenColumns.length === start && start > 0 || afterHiddenColumns.length === totalColumnLength - start && start < totalColumnLength) {
let pluralForm = 0;
if (Array.isArray(selection)) {
let [fromRow, , toRow] = selection;
if (fromRow > toRow) {
[fromRow, toRow] = [toRow, fromRow];
}
let hiddenRows = 0;
if (fromRow === toRow) {
hiddenRows = beforeHiddenRows.length + afterHiddenRows.length;
} else {
rangeEach(fromRow, toRow, (column) => {
if (hiddenRowsPlugin.isHidden(column)) {
hiddenRows += 1;
}
});
}
pluralForm = hiddenRows <= 1 ? 0 : 1;
}
return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_SHOW_ROW, pluralForm);
},
callback() {
updateHeadersHighlight() {
let selection = this.hot.getSelectedLast();
if (selection === void 0) {
return;
}
const classHighlight = 'ht__highlight';
let wtOverlays = this.hot.view.wt.wtOverlays;
let selectionByHeader = this.hot.selection.selectedHeader.cols;
let from = Math.min(selection[1], selection[3]);
let to = Math.max(selection[1], selection[3]);
let levelLimit = selectionByHeader ? -1 : this.columnHeaderLevelCount - 1;
rangeEach(from, to, (column) => {
for (let level = this.columnHeaderLevelCount - 1; level > -1; level--) {
let visibleColumnIndex = this.getNestedParent(level, column);
let topTH = wtOverlays.topOverlay ? wtOverlays.topOverlay.clone.wtTable.getColumnHeader(visibleColumnIndex, level) : void 0;
let topLeftTH = wtOverlays.topLeftCornerOverlay ? wtOverlays.topLeftCornerOverlay.clone.wtTable.getColumnHeader(visibleColumnIndex, level) : void 0;
let listTH = [topTH, topLeftTH];
let colspanLen = this.getColspan(level - this.columnHeaderLevelCount, visibleColumnIndex);
let isInSelection = visibleColumnIndex >= from && (visibleColumnIndex + colspanLen - 1) <= to;
arrayEach(listTH, (TH, index, array) => {
if (TH === void 0) {
return false;
}
if ((!selectionByHeader && level < levelLimit) || (selectionByHeader && !isInSelection)) {
if (hasClass(TH, classHighlight)) {
removeClass(TH, classHighlight);
let visibleVisualRows = [];
const conditions = this.conditionCollection.exportAllConditions();
const allowFiltering = this.hot.runHooks('beforeFilter', conditions);
if (allowFiltering !== false) {
if (needToFilter) {
let trimmedRows = [];
this.trimRowsPlugin.trimmedRows.length = 0;
visibleVisualRows = arrayMap(dataFilter.filter(), (rowData) => rowData.meta.visualRow);
const visibleVisualRowsAssertion = createArrayAssertion(visibleVisualRows);
rangeEach(this.hot.countSourceRows() - 1, (row) => {
if (!visibleVisualRowsAssertion(row)) {
trimmedRows.push(row);
}
});
this.trimRowsPlugin.trimRows(trimmedRows);
if (!visibleVisualRows.length) {
this.hot.deselectCell();
}
} else {
this.trimRowsPlugin.untrimAll();
}
}
this.hot.view.wt.wtOverlays.adjustElementsSize(true);
var getNextRow = function getNextRow(row) {
if (_this8.isHidden(row)) {
if (_this8.lastSelectedRow > row || coords.row === rowCount - 1) {
if (row > 0) {
row = getNextRow(--row);
} else {
rangeEach(0, _this8.lastSelectedRow, function (i) {
if (!_this8.isHidden(i)) {
row = i;
return false;
}
});
}
} else {
row = getNextRow(++row);
}
}
return row;
};
if (!hiddenColumnsPlugin.hiddenColumns.length || !this.selection.selectedHeader.cols) {
return true;
}
beforeHiddenColumns.length = 0;
afterHiddenColumns.length = 0;
let {from, to} = this.getSelectedRangeLast();
let start = Math.min(from.col, to.col);
let end = Math.max(from.col, to.col);
let hiddenInSelection = false;
if (start === end) {
let totalColumnLength = this.countSourceCols();
rangeEach(0, totalColumnLength, (column) => {
let partedHiddenLength = beforeHiddenColumns.length + afterHiddenColumns.length;
if (partedHiddenLength === hiddenColumnsPlugin.hiddenColumns.length) {
return false;
}
if (column < start && hiddenColumnsPlugin.isHidden(column)) {
beforeHiddenColumns.push(column);
} else if (hiddenColumnsPlugin.isHidden(column)) {
afterHiddenColumns.push(column);
}
});
totalColumnLength -= 1;
callback() {
let {from, to} = this.getSelectedRangeLast();
let start = Math.min(from.col, to.col);
let end = Math.max(from.col, to.col);
rangeEach(start, end, (column) => hiddenColumnsPlugin.hideColumn(column));
this.render();
this.view.wt.wtOverlays.adjustElementsSize(true);
},
disabled: false,