Merge pull request #24554 from andy-maca/master

Change API according to datatable definition
This commit is contained in:
Nathan Shively-Sanders
2018-03-29 07:38:19 -07:00
committed by GitHub
11 changed files with 212 additions and 6 deletions
@@ -0,0 +1,8 @@
const config: DataTables.Settings = {
// AutoFill extension options
autoFill: {
alwaysAsk: true,
enable: true,
columns: [1, 2]
}
};
+33
View File
@@ -0,0 +1,33 @@
// Type definitions for datatables.net-autofill 2.2
// Project: https://datatables.net
// Definitions by: Andy Ma <https://github.com/andy-maca>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
/// <reference types="jquery" />
/// <reference types="datatables.net"/>
declare namespace DataTables {
interface Settings {
/*
* autoFill extension options
*/
autoFill?: boolean | AutoFillSettings;
}
interface AutoFillSettings {
/*
* Always ask the end user if an action should be taken or not
*/
alwaysAsk?: boolean;
/*
* Select the columns that can be auto filled
*/
columns: string | number[];
/*
*
* Initial enablement state of AutoFill
*/
enable?: boolean;
}
}
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"datatables.net-autofill-tests.ts"
]
}
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
@@ -0,0 +1,12 @@
$(document).ready(() => {
const config: DataTables.Settings = {
// ColReorder extension options
colReorder: {
fixedColumnsLeft: 0,
fixedColumnsRight: 0,
order: [1, 2, 3],
realtime: true,
reorderCallback: () => {},
}
};
});
+64
View File
@@ -0,0 +1,64 @@
// Type definitions for datatables.net-colReorder 1.4
// Project: https://datatables.net/extensions/colreorder/
// Definitions by: Andy Ma <https://github.com/andy-maca>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
/// <reference types="jquery" />
/// <reference types="datatables.net"/>
declare namespace DataTables {
interface Settings {
/*
* colReorder extension options
*/
colReorder?: boolean | ColReorderSettings;
}
interface ColReorderSettings {
/*
* Number of columns (counting from the left) to disallow reordering of, '0' in default
*/
fixedColumnsLeft?: number;
/*
* Number of columns (counting from the right) to disallow reordering of, '0' in default
*/
fixedColumnsRight?: number;
/*
* Set a default order for the columns in the table
*/
order?: number[];
/*
* Enable / disable live reordering of columns during a drag, 'true' in default
*/
realtime?: boolean;
/*
* Callback after reorder
*/
reorderCallback: () => void;
}
interface Api {
colReorder: {
/*
* Programmatically reorder columns
*/
move(from: number, to: number, drop: boolean, invalidate: boolean): Api;
/*
* Get / set column order
*/
order(newOrder?: number[], originalIndexes?: boolean): Api;
/*
* Restore the loaded column order
*/
reset(): Api;
/*
* Convert one or more column indexes to and from current and original indexes
*/
transpose(idx?: number | number[], direction?: "toCurrent" | "toOriginal" | "fromOriginal" | "fromCurrent"): Api;
};
}
}
@@ -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-colreorder-tests.ts"
]
}
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+36 -1
View File
@@ -44,6 +44,41 @@ declare namespace DataTables {
/*
* Set the selection style for end user interaction with the table
*/
style?: string;
style?: "api" | "single" | "multi" | "os" | "multi+shift";
}
interface Api {
select: {
/*
* Get the current selection style applied to the table
*/
style(): string;
/*
* Set the table's selection style
*/
style(s: "api" | "single" | "multi" | "os"): Api;
};
}
interface RowMethods {
/**
* Select a row
*/
select(): Api;
/**
* Deselect a row
*/
deselect(): Api;
}
interface RowsMethods {
/**
* Select multiple rows
*/
select(): Api;
/**
* Deselect a row
*/
deselect(): Api;
}
}
+1 -1
View File
@@ -225,7 +225,7 @@ let config: DataTables.Settings = {
],
// Data
ajax: "url",
data: {},
data: [],
// Features
autoWidth: true,
deferRender: true,
+9 -4
View File
@@ -28,6 +28,10 @@ declare namespace DataTables {
}
interface Api extends CoreMethods {
/**
* API should be array-like
*/
[key: number]: any;
/**
* Returns DataTables API instance
*
@@ -221,7 +225,7 @@ declare namespace DataTables {
* @param event Event name to remove.
* @param callback Specific callback function to remove if you want to unbind a single event listener.
*/
off(event: string, callback?: ((e: Event, settings: Settings, json: any) => void)): Api;
off(event: string, callback?: ((e: Event, ...args: any[]) => void)): Api;
/**
* Table events listener.
@@ -229,7 +233,7 @@ declare namespace DataTables {
* @param event Event to listen for.
* @param callback Specific callback function to remove if you want to unbind a single event listener.
*/
on(event: string, callback: ((e: Event, settings: Settings, json: any) => void)): Api;
on(event: string, callback: ((e: Event, ...args: any[]) => void)): Api;
/**
* Listen for a table event once and then remove the listener.
@@ -237,7 +241,7 @@ declare namespace DataTables {
* @param event Event to listen for.
* @param callback Specific callback function to remove if you want to unbind a single event listener.
*/
one(event: string, callback: ((e: Event, settings: Settings, json: any) => void)): Api;
one(event: string, callback: ((e: Event, ...args: any[]) => void)): Api;
/**
* Page Methods / object
@@ -1297,7 +1301,7 @@ declare namespace DataTables {
/**
* Data to use as the display data for the table. Since: 1.10
*/
data?: object;
data?: any[];
//#endregion "Data"
@@ -1931,6 +1935,7 @@ declare namespace DataTables {
}
interface ColumnLegacy {
idx: number;
aDataSort: any;
asSorting: string[];
bSearchable: boolean;