Add mark.js and jquery typings (#21066)

This commit is contained in:
Charles Gagnon
2022-11-02 09:18:03 -07:00
committed by GitHub
parent 9d921e4efc
commit 649b23e6c8
6 changed files with 28 additions and 4618 deletions

View File

@@ -85,7 +85,7 @@ export class AutoColumnSize<T extends Slick.SlickData> implements Slick.Plugin<T
let colIndices: number[] = [];
for (let i = 0; i <= headerColumns.children.length; i++) {
let headerEl = jQuery(headerColumns.children.item(i)!);
let headerEl = jQuery(headerColumns.children.item(i)! as HTMLElement);
let columnDef = headerEl.data('column');
if (columnDef) {
headerElements.push(headerEl[0]);
@@ -118,7 +118,7 @@ export class AutoColumnSize<T extends Slick.SlickData> implements Slick.Plugin<T
}
}
private handleDoubleClick(e: JQuery.Event<HTMLElement, unknown>) {
private handleDoubleClick(e: JQuery.TriggeredEvent<HTMLElement, unknown>) {
let headerEl = jQuery(e.currentTarget).closest('.slick-header-column');
let columnDef = headerEl.data('column');

View File

@@ -131,7 +131,7 @@ export class Table<T extends Slick.SlickData> extends Widget implements IDisposa
this._grid.onColumnsResized.subscribe(() => this._onColumnResize.fire());
this._grid.onKeyDown.subscribe((e, args: Slick.OnKeyDownEventArgs<T>) => {
const evt = (e as JQuery.Event).originalEvent as KeyboardEvent;
const evt = (e as JQuery.TriggeredEvent).originalEvent as KeyboardEvent;
this._onKeyDown.fire({
event: evt,
cell: {
@@ -151,7 +151,7 @@ export class Table<T extends Slick.SlickData> extends Widget implements IDisposa
private mapMouseEvent(slickEvent: Slick.Event<any>, emitter: Emitter<ITableMouseEvent>) {
slickEvent.subscribe((e: Slick.EventData) => {
const originalEvent = (e as JQuery.Event).originalEvent;
const originalEvent = (e as JQuery.TriggeredEvent).originalEvent;
const cell = this._grid.getCellFromEvent(originalEvent);
const anchor = originalEvent instanceof MouseEvent ? { x: originalEvent.x, y: originalEvent.y } : originalEvent.srcElement as HTMLElement;
emitter.fire({ anchor, cell });

View File

@@ -226,7 +226,7 @@ export class OutputComponent extends CellView implements OnInit, AfterViewInit {
markCurrent = new Mark(elementContainingText.children[range.startColumn]);
markCurrent?.mark(this.searchTerm, {
className: findRangeSpecificClass,
each: function (node, range) {
each: function (node) {
// node is the marked DOM element
node.scrollIntoView({ behavior: 'smooth', block: 'center' });
}
@@ -253,7 +253,7 @@ export class OutputComponent extends CellView implements OnInit, AfterViewInit {
separateWordSearch: true,
});
// if there are grids
let grids = document.querySelectorAll(GRID_CLASS);
let grids = document.querySelectorAll<HTMLElement>(GRID_CLASS);
grids?.forEach(g => {
markAllOccurances = new Mark(g);
markAllOccurances.mark(this.searchTerm, {
@@ -281,7 +281,7 @@ export class OutputComponent extends CellView implements OnInit, AfterViewInit {
markAllOccurances.unmark({ acrossElements: true, className: findRangeSpecificClass });
this.highlightRange = undefined;
// if there is a grid
let grids = document.querySelectorAll(GRID_CLASS);
let grids = document.querySelectorAll<HTMLElement>(GRID_CLASS);
grids?.forEach(g => {
markAllOccurances = new Mark(g);
markAllOccurances.unmark({ acrossElements: true, className: findHighlightClass });