slickgrid
Advanced tools
Comparing version 5.5.5 to 5.5.6
@@ -83,3 +83,5 @@ "use strict"; | ||
var _a, _b; | ||
this._prevSelectedRow = void 0, (_a = this._options) != null && _a.selectActiveCell && Utils.isDefined(args.row) && Utils.isDefined(args.cell) ? this.setSelectedRanges([new SlickRange(args.row, args.cell)]) : (_b = this._options) != null && _b.selectActiveCell || this.setSelectedRanges([]); | ||
this._prevSelectedRow = void 0; | ||
let isCellDefined = Utils.isDefined(args.cell), isRowDefined = Utils.isDefined(args.row); | ||
(_a = this._options) != null && _a.selectActiveCell && isRowDefined && isCellDefined ? this.setSelectedRanges([new SlickRange(args.row, args.cell)]) : (!((_b = this._options) != null && _b.selectActiveCell) || !isRowDefined && !isCellDefined) && this.setSelectedRanges([]); | ||
} | ||
@@ -91,8 +93,8 @@ isKeyAllowed(key) { | ||
var _a; | ||
let ranges, last, active = this._grid.getActiveCell(), metaKey = e.ctrlKey || e.metaKey, dataLn = 0; | ||
if (this._dataView ? dataLn = ((_a = this._dataView) == null ? void 0 : _a.getPagingInfo().pageSize) || this._dataView.getLength() : dataLn = this._grid.getDataLength(), active && e.shiftKey && !metaKey && !e.altKey && this.isKeyAllowed(e.key)) { | ||
let ranges, last, colLn = this._grid.getColumns().length, active = this._grid.getActiveCell(), dataLn = 0; | ||
if (this._dataView ? dataLn = ((_a = this._dataView) == null ? void 0 : _a.getPagingInfo().pageSize) || this._dataView.getLength() : dataLn = this._grid.getDataLength(), active && (e.shiftKey || e.ctrlKey) && !e.altKey && this.isKeyAllowed(e.key)) { | ||
ranges = this.getSelectedRanges().slice(), ranges.length || ranges.push(new SlickRange(active.row, active.cell)), last = ranges.pop(), last.contains(active.row, active.cell) || (last = new SlickRange(active.row, active.cell)); | ||
let dRow = last.toRow - last.fromRow, dCell = last.toCell - last.fromCell, dirRow = active.row === last.fromRow ? 1 : -1, dirCell = active.cell === last.fromCell ? 1 : -1, isSingleKeyMove = e.key.startsWith("Arrow"), toRow = 0; | ||
isSingleKeyMove ? (e.key === "ArrowLeft" ? dCell -= dirCell : e.key === "ArrowRight" ? dCell += dirCell : e.key === "ArrowUp" ? dRow -= dirRow : e.key === "ArrowDown" && (dRow += dirRow), toRow = active.row + dirRow * dRow) : (this._cachedPageRowCount < 1 && (this._cachedPageRowCount = this._grid.getViewportRowCount()), this._prevSelectedRow === void 0 && (this._prevSelectedRow = active.row), e.key === "Home" ? toRow = 0 : e.key === "End" ? toRow = dataLn - 1 : e.key === "PageUp" ? (this._prevSelectedRow >= 0 && (toRow = this._prevSelectedRow - this._cachedPageRowCount), toRow < 0 && (toRow = 0)) : e.key === "PageDown" && (this._prevSelectedRow <= dataLn - 1 && (toRow = this._prevSelectedRow + this._cachedPageRowCount), toRow > dataLn - 1 && (toRow = dataLn - 1)), this._prevSelectedRow = toRow); | ||
let new_last = new SlickRange(active.row, active.cell, toRow, active.cell + dirCell * dCell); | ||
let dRow = last.toRow - last.fromRow, dCell = last.toCell - last.fromCell, dirRow = active.row === last.fromRow ? 1 : -1, dirCell = active.cell === last.fromCell ? 1 : -1, isSingleKeyMove = e.key.startsWith("Arrow"), toCell, toRow = 0; | ||
isSingleKeyMove && !e.ctrlKey ? (e.key === "ArrowLeft" ? dCell -= dirCell : e.key === "ArrowRight" ? dCell += dirCell : e.key === "ArrowUp" ? dRow -= dirRow : e.key === "ArrowDown" && (dRow += dirRow), toRow = active.row + dirRow * dRow) : (this._cachedPageRowCount < 1 && (this._cachedPageRowCount = this._grid.getViewportRowCount()), this._prevSelectedRow === void 0 && (this._prevSelectedRow = active.row), e.shiftKey && !e.ctrlKey && e.key === "Home" ? (toCell = 0, toRow = active.row) : e.shiftKey && !e.ctrlKey && e.key === "End" ? (toCell = colLn - 1, toRow = active.row) : e.ctrlKey && e.shiftKey && e.key === "Home" ? (toCell = 0, toRow = 0) : e.ctrlKey && e.shiftKey && e.key === "End" ? (toCell = colLn - 1, toRow = dataLn - 1) : e.key === "PageUp" ? (this._prevSelectedRow >= 0 && (toRow = this._prevSelectedRow - this._cachedPageRowCount), toRow < 0 && (toRow = 0)) : e.key === "PageDown" && (this._prevSelectedRow <= dataLn - 1 && (toRow = this._prevSelectedRow + this._cachedPageRowCount), toRow > dataLn - 1 && (toRow = dataLn - 1)), this._prevSelectedRow = toRow), toCell != null || (toCell = active.cell + dirCell * dCell); | ||
let new_last = new SlickRange(active.row, active.cell, toRow, toCell); | ||
if (this.removeInvalidRanges([new_last]).length) { | ||
@@ -99,0 +101,0 @@ ranges.push(new_last); |
@@ -519,3 +519,3 @@ "use strict"; | ||
static isDefined(value) { | ||
return value != null; | ||
return value != null && value !== ""; | ||
} | ||
@@ -522,0 +522,0 @@ static getElementProp(elm, property) { |
@@ -13,3 +13,3 @@ import type SortableInstance from 'sortablejs'; | ||
* | ||
* SlickGrid v5.5.5 | ||
* SlickGrid v5.5.6 | ||
* | ||
@@ -296,4 +296,10 @@ * NOTES: | ||
* @param val - input value can be either a string or an HTMLElement | ||
* @param options - | ||
* `emptyTarget`, defaults to true, will empty the target. | ||
* `skipEmptyReassignment`, defaults to true, when enabled it will not try to reapply an empty value when the target is already empty | ||
*/ | ||
applyHtmlCode(target: HTMLElement, val: string | HTMLElement | DocumentFragment, emptyTarget?: boolean): void; | ||
applyHtmlCode(target: HTMLElement, val: string | HTMLElement | DocumentFragment, options?: { | ||
emptyTarget?: boolean; | ||
skipEmptyReassignment?: boolean; | ||
}): void; | ||
protected initialize(): void; | ||
@@ -300,0 +306,0 @@ protected finishInitialization(): void; |
{ | ||
"name": "slickgrid", | ||
"version": "5.5.5", | ||
"version": "5.5.6", | ||
"description": "A lightning fast JavaScript grid/spreadsheet", | ||
@@ -48,3 +48,3 @@ "main": "./dist/browser/index.js", | ||
"dependencies": { | ||
"sortablejs": "^1.15.0" | ||
"sortablejs": "^1.15.1" | ||
}, | ||
@@ -51,0 +51,0 @@ "browserslist": [ |
@@ -143,5 +143,8 @@ import { SlickEvent as SlickEvent_, SlickEventData as SlickEventData_, SlickRange as SlickRange_, Utils as Utils_ } from '../slick.core'; | ||
this._prevSelectedRow = undefined; | ||
if (this._options?.selectActiveCell && Utils.isDefined(args.row) && Utils.isDefined(args.cell)) { | ||
const isCellDefined = Utils.isDefined(args.cell); | ||
const isRowDefined = Utils.isDefined(args.row); | ||
if (this._options?.selectActiveCell && isRowDefined && isCellDefined) { | ||
this.setSelectedRanges([new SlickRange(args.row, args.cell)]); | ||
} else if (!this._options?.selectActiveCell) { | ||
} else if (!this._options?.selectActiveCell || (!isRowDefined && !isCellDefined)) { | ||
// clear the previous selection once the cell changes | ||
@@ -158,4 +161,4 @@ this.setSelectedRanges([]); | ||
let ranges: SlickRange_[], last: SlickRange_; | ||
const colLn = this._grid.getColumns().length; | ||
const active = this._grid.getActiveCell(); | ||
const metaKey = e.ctrlKey || e.metaKey; | ||
let dataLn = 0; | ||
@@ -168,4 +171,3 @@ if (this._dataView) { | ||
if (active && e.shiftKey && !metaKey && !e.altKey && this.isKeyAllowed(e.key)) { | ||
if (active && (e.shiftKey || e.ctrlKey) && !e.altKey && this.isKeyAllowed(e.key)) { | ||
ranges = this.getSelectedRanges().slice(); | ||
@@ -190,5 +192,6 @@ if (!ranges.length) { | ||
const isSingleKeyMove = e.key.startsWith('Arrow'); | ||
let toCell: undefined | number = undefined; | ||
let toRow = 0; | ||
if (isSingleKeyMove) { | ||
if (isSingleKeyMove && !e.ctrlKey) { | ||
// single cell move: (Arrow{Up/ArrowDown/ArrowLeft/ArrowRight}) | ||
@@ -214,5 +217,13 @@ if (e.key === 'ArrowLeft') { | ||
if (e.key === 'Home') { | ||
if (e.shiftKey && !e.ctrlKey && e.key === 'Home') { | ||
toCell = 0; | ||
toRow = active.row; | ||
} else if (e.shiftKey && !e.ctrlKey && e.key === 'End') { | ||
toCell = colLn - 1; | ||
toRow = active.row; | ||
} else if (e.ctrlKey && e.shiftKey && e.key === 'Home') { | ||
toCell = 0; | ||
toRow = 0; | ||
} else if (e.key === 'End') { | ||
} else if (e.ctrlKey && e.shiftKey && e.key === 'End') { | ||
toCell = colLn - 1; | ||
toRow = dataLn - 1; | ||
@@ -238,3 +249,4 @@ } else if (e.key === 'PageUp') { | ||
// define new selection range | ||
const new_last = new SlickRange(active.row, active.cell, toRow, active.cell + dirCell * dCell); | ||
toCell ??= active.cell + dirCell * dCell; | ||
const new_last = new SlickRange(active.row, active.cell, toRow, toCell); | ||
if (this.removeInvalidRanges([new_last]).length) { | ||
@@ -241,0 +253,0 @@ ranges.push(new_last); |
@@ -790,3 +790,3 @@ /** | ||
public static isDefined<T>(value: T | undefined | null): value is T { | ||
return <T>value !== undefined && <T>value !== null; | ||
return <T>value !== undefined && <T>value !== null && <T>value !== ''; | ||
} | ||
@@ -793,0 +793,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6936705
58066
Updatedsortablejs@^1.15.1