Type definitions for datatables.net-fixedcolumns (#36816)

* Create index.d.ts

* Create LICENSE

* Create README.md

* Update README.md

* Create package.json

* Delete LICENSE

* Delete README.md

* Delete package.json

* Create datatables.net-fixedcolumns-tests.ts

* Create tslint.json

* Create tsconfig.json

* changes after tslint

* formatting

* formatting

* formatting

* correct return types
add deprecation comments

* Type definitions for datatables.net-keytable
This commit is contained in:
Konstantin 2019-07-12 04:22:07 +05:00 committed by Armando Aguirre
parent 014198710d
commit 6968096151
8 changed files with 279 additions and 0 deletions

View File

@ -0,0 +1,10 @@
$(document).ready(() => {
const config: DataTables.Settings = {
// FixedColumns extension options
fixedColumns: {
heightMatch: 'semiauto',
leftColumns: 2,
rightColumns: 1
}
};
});

View File

@ -0,0 +1,87 @@
// Type definitions for datatables.net-fixedcolumns 3.2
// Project: https://datatables.net
// Definitions by: Konstantin Kuznetsov <https://github.com/Arik-neKrol>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
/// <reference types="jquery" />
/// <reference types="datatables.net"/>
declare namespace DataTables {
interface Settings {
/*
* FixedColumns extension options
*/
fixedColumns?: boolean | FixedColumnsSettings;
}
interface FixedColumnsSettings {
/*
* Row height matching algorithm to use
*
* The algorithm to use. This can be one of (see below for full description):
* 'none' | 'semiauto' | 'auto'
*/
heightMatch?: string;
/*
* The number of columns on the left hand side of the table to fix in place.
*/
leftColumns?: number;
/*
* The number of columns on the right hand side of the table to fix in place.
*/
rightColumns?: number;
}
interface Api {
fixedColumns: FixedColumnsMethodsModel;
}
interface FixedColumnsMethodsModel {
/*
* Get FixedColumns Api
*/
fixedColumns(): FixedColumnsMethods;
}
interface FixedColumnsMethods extends Api {
/*
* Update the data shown in the FixedColumns
*/
update(): Api;
/*
* Redraw the fixed columns based on new table size
*/
relayout(): Api;
/*
* @Deprecated(use dt.row(this).index())
* Get the row index of a row in a fixed column
*/
rowIndex(): number;
/*
* @Deprecated(use dt.cell(this).index())
* Get the cell index of a cell in a fixed column
*/
cellIndex(): CellIndex;
}
/*
*/
interface CellIndex {
row: number;
column: number;
columnVisible: number;
}
interface RowsMethods {
/*
* Recalculate the height of one or more rows after a data change
*/
recalcHeight(): Api;
}
}

View File

@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"datatables.net-fixedcolumns-tests.ts"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@ -0,0 +1,17 @@
$(document).ready(() => {
const config: DataTables.Settings = {
// KeyTable extension options
keys: {
blurable: true,
className: "focusClass",
clipboard: false,
columns: ":not(:first-child)",
editOnFocus: false,
focus: ":eq(0)",
tabIndex: 2,
keys: [ "\t".charCodeAt(0) ],
clipboardOrthogonal: 'export',
editor: null
}
};
});

115
types/datatables.net-keytable/index.d.ts vendored Normal file
View File

@ -0,0 +1,115 @@
// Type definitions for datatables.net-keytable 2.5
// Project: https://datatables.net
// Definitions by: Konstantin Kuznetsov <https://github.com/Arik-neKrol>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
/// <reference types="jquery" />
/// <reference types="datatables.net"/>
declare namespace DataTables {
interface Settings {
/*
* KeyTable extension options
*/
keys?: boolean | KeyTableSettings;
}
interface KeyTableSettings {
/*
* Allow KeyTable's focus to be blurred (removed) from a table
*
* When set to true this option allows the table to lose focus (i.e. to be blurred),
* while false will not allow the table to lose focus.
*/
blurable?: boolean;
/*
* Set the class name used for the focused cell
*
* The class name to be added and removed from cells as they gain and loose focus.
*/
className?: string;
/*
* Enable / disable clipboard interaction with KeyTable
*
* A boolean flag that can optionally be used to disable KeyTables' clipboard interaction.
*/
clipboard?: boolean;
/*
* Set the orthogonal data point for the data to copy to clipboard.
*/
clipboardOrthogonal?: string;
/*
* Select the columns that can gain focus
*
* The columns that can gain focus. This accepts all of the options of column-selector
* such as class name selector, jQuery pseudo selects and column index selectors.
*/
columns?: any;
/*
* Control if editing should be activated immediately upon focus
*
* true to enable editing on focus, false to disable.
*/
editOnFocus?: boolean;
/*
* Attach an Editor instance for Excel like editing
*
* The Editor instance to use for editing of the table
*/
editor?: any;
/*
* Cell to receive initial focus in the table
*
* The cell that will receive focus when the table is initialised. This accepts all of
* the options of cell-selector such as class name selector, jQuery pseudo selects and
* cell index selectors.
*/
focus?: any;
/*
* Limit the keys that KeyTable will listen for and take action on
*
* As null KeyTable will listen for all key presses, regardless of what key is pressed.
* an array you can limit the keys that KeyTable will take action on to just the key
* codes given in the array.
*/
keys?: number[] | null;
/*
* Set the table's tab index for when it will receive focus
*
* The tab index for the table. Like all other tab indexes, this can be -1 to disallow
* tabbing into the table.
*/
tabIndex?: number;
}
interface Api {
keys: {
/*
* Disable KeyTable's interactions (mouse and keyboard)
*/
disable(): Api;
/*
* Enable or disable KeyTable's interactions (mouse and keyboard)
*/
enable(): Api;
};
}
interface CellMethods {
/*
* Focus on a cell
*/
focus(): Api;
}
}

View File

@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"datatables.net-keytable-tests.ts"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }