Skip to content

Commit 6b68ec2

Browse files
committed
2de7c4a50f823d633cecea052206234aa575c1ba
Sync to source repo @2de7c4a50f823d633cecea052206234aa575c1ba
1 parent 02d5c55 commit 6b68ec2

File tree

6 files changed

+213
-81
lines changed

6 files changed

+213
-81
lines changed

datatables.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@
1414
"types/types.d.ts"
1515
],
1616
"src-repo": "http://github.com/DataTables/KeyTable",
17-
"last-tag": "2.7.0"
18-
}
17+
"last-tag": "2.7.0",
18+
"last-sync": "2de7c4a50f823d633cecea052206234aa575c1ba"
19+
}

js/keyTable.semanticui.js

Lines changed: 13 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11

22
/*! Semanic UI styling wrapper for KeyTable
3-
* ©2018 SpryMedia Ltd - datatables.net/license
3+
* © SpryMedia Ltd - datatables.net/license
44
*/
55

66
(function( factory ){
77
if ( typeof define === 'function' && define.amd ) {
88
// AMD
9-
define( [''], function ( $ ) {
9+
define( ['jquery', 'datatables.net-se', 'datatables.net-keytable'], function ( $ ) {
1010
return factory( $, window, document );
1111
} );
1212
}
@@ -19,46 +19,21 @@
1919
root = window;
2020
}
2121

22-
if ( ! $.fn.dataTable ) {
23-
require('')(root, $);
22+
if ( ! $ ) {
23+
$ = typeof window !== 'undefined' ? // jQuery's factory checks for a global window
24+
require('jquery') :
25+
require('jquery')( root );
2426
}
2527

26-
27-
return factory( $, root, root.document );
28-
};
29-
}
30-
else {
31-
// Browser
32-
factory( jQuery, window, document );
33-
}
34-
}(function( $, window, document, undefined ) {
35-
'use strict';
36-
var DataTable = $.fn.dataTable;
37-
38-
39-
40-
(function( factory ){
41-
if ( typeof define === 'function' && define.amd ) {
42-
// AMD
43-
define( ['jquery', 'datatables.net-se', 'datatables.net-keytable'], function ( $ ) {
44-
return factory( $, window, document );
45-
} );
46-
}
47-
else if ( typeof exports === 'object' ) {
48-
// CommonJS
49-
module.exports = function (root, $) {
50-
if ( ! root ) {
51-
root = window;
52-
}
53-
54-
if ( ! $ || ! $.fn.dataTable ) {
55-
$ = require('datatables.net-se')(root, $).$;
28+
if ( ! $.fn.dataTable ) {
29+
require('datatables.net-se')(root, $);
5630
}
5731

58-
if ( ! $.fn.dataTable.KeyTable ) {
32+
if ( ! $.fn.dataTable ) {
5933
require('datatables.net-keytable')(root, $);
6034
}
6135

36+
6237
return factory( $, root, root.document );
6338
};
6439
}
@@ -67,10 +42,11 @@ var DataTable = $.fn.dataTable;
6742
factory( jQuery, window, document );
6843
}
6944
}(function( $, window, document, undefined ) {
45+
'use strict';
46+
var DataTable = $.fn.dataTable;
47+
7048

71-
return $.fn.dataTable;
7249

73-
}));
7450

7551
return DataTable;
7652
}));

js/keyTable.semanticui.min.js

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/keyTable.semanticui.min.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
import DataTable from"";!function(a){"function"==typeof define&&define.amd?define(["jquery","datatables.net-se","datatables.net-keytable"],function(e){return a(e,window,document)}):"object"==typeof exports?module.exports=function(e,t){return e=e||window,(t=t&&t.fn.dataTable?t:require("datatables.net-se")(e,t).$).fn.dataTable.KeyTable||require("datatables.net-keytable")(e,t),a(t,0,e.document)}:a(jQuery,window,document)}(function(e,t,a,n){return e.fn.dataTable});export default DataTable;
1+
/*! Semanic UI styling wrapper for KeyTable
2+
* © SpryMedia Ltd - datatables.net/license
3+
*/
4+
import $ from"jquery";import DataTable from"datatables.net-se";import DataTable from"datatables.net-keytable";export default DataTable;

js/keyTable.semanticui.mjs

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,13 @@
11

22
/*! Semanic UI styling wrapper for KeyTable
3-
* ©2018 SpryMedia Ltd - datatables.net/license
3+
* © SpryMedia Ltd - datatables.net/license
44
*/
55

6-
import DataTable from '';
6+
import $ from 'jquery';
7+
import DataTable from 'datatables.net-se';
8+
import DataTable from 'datatables.net-keytable';
79

810

911

10-
(function( factory ){
11-
if ( typeof define === 'function' && define.amd ) {
12-
// AMD
13-
define( ['jquery', 'datatables.net-se', 'datatables.net-keytable'], function ( $ ) {
14-
return factory( $, window, document );
15-
} );
16-
}
17-
else if ( typeof exports === 'object' ) {
18-
// CommonJS
19-
module.exports = function (root, $) {
20-
if ( ! root ) {
21-
root = window;
22-
}
23-
24-
if ( ! $ || ! $.fn.dataTable ) {
25-
$ = require('datatables.net-se')(root, $).$;
26-
}
27-
28-
if ( ! $.fn.dataTable.KeyTable ) {
29-
require('datatables.net-keytable')(root, $);
30-
}
31-
32-
return factory( $, root, root.document );
33-
};
34-
}
35-
else {
36-
// Browser
37-
factory( jQuery, window, document );
38-
}
39-
}(function( $, window, document, undefined ) {
40-
41-
return $.fn.dataTable;
42-
43-
}));
4412

4513
export default DataTable;

types/types.d.ts

Lines changed: 185 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,188 @@
1+
// Type definitions for DataTables KeyTable
2+
//
3+
// Project: https://datatables.net/extensions/keytable/, https://datatables.net
4+
// Definitions by:
5+
// SpryMedia
6+
// Konstantin Kuznetsov <https://github.com/Arik-neKrol>
17

2-
// Dist-DataTables-KeyTable-SemanticUI integration with SemanticUI exports the DataTables API having
3-
// set default values to complete the ingeration.
4-
import Api from "datatables.net";
8+
/// <reference types="jquery" />
59

6-
export default Api;
10+
import DataTables, {Api} from 'datatables.net';
711

12+
export default DataTables;
13+
14+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
15+
* DataTables' types integration
16+
*/
17+
declare module 'datatables.net' {
18+
interface Config {
19+
/**
20+
* KeyTable extension options
21+
*/
22+
keys?: boolean | ConfigKeyTable;
23+
}
24+
25+
interface Api<T> {
26+
/**
27+
* KeyTable methods container
28+
*
29+
* @returns Api for chaining with the additional KeyTable methods
30+
*/
31+
keys: ApiKeyTableMethods<T>;
32+
}
33+
34+
interface ApiCell<T> {
35+
/**
36+
* Blur focus from the currently focused cell
37+
*/
38+
blur(): Api<T>;
39+
}
40+
41+
interface ApiCellMethods<T> {
42+
/**
43+
* Focus on a cell
44+
*/
45+
focus(): Api<T>;
46+
}
47+
48+
interface ApiStatic {
49+
/**
50+
* KeyTable class
51+
*/
52+
KeyTable: {
53+
/**
54+
* Create a new KeyTable instance for the target DataTable
55+
*/
56+
new (dt: Api<any>, settings: boolean | ConfigKeyTable);
57+
58+
/**
59+
* KeyTable version
60+
*/
61+
version: string;
62+
63+
/**
64+
* Default configuration values
65+
*/
66+
defaults: ConfigKeyTable;
67+
}
68+
}
69+
}
70+
71+
72+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
73+
* Options
74+
*/
75+
76+
interface ConfigKeyTable {
77+
/**
78+
* Allow KeyTable's focus to be blurred (removed) from a table
79+
*
80+
* When set to true this option allows the table to lose focus (i.e. to be blurred),
81+
* while false will not allow the table to lose focus.
82+
*/
83+
blurable?: boolean;
84+
85+
/**
86+
* Set the class name used for the focused cell
87+
*
88+
* The class name to be added and removed from cells as they gain and loose focus.
89+
*/
90+
className?: string;
91+
92+
/**
93+
* Enable / disable clipboard interaction with KeyTable
94+
*
95+
* A boolean flag that can optionally be used to disable KeyTables' clipboard interaction.
96+
*/
97+
clipboard?: boolean;
98+
99+
/**
100+
* Set the orthogonal data point for the data to copy to clipboard.
101+
*/
102+
clipboardOrthogonal?: string;
103+
104+
/**
105+
* Select the columns that can gain focus
106+
*
107+
* The columns that can gain focus. This accepts all of the options of column-selector
108+
* such as class name selector, jQuery pseudo selects and column index selectors.
109+
*/
110+
columns?: any;
111+
112+
/**
113+
* Control if editing should be activated immediately upon focus
114+
*
115+
* true to enable editing on focus, false to disable.
116+
*/
117+
editOnFocus?: boolean;
118+
119+
/**
120+
* Attach an Editor instance for Excel like editing
121+
*
122+
* The Editor instance to use for editing of the table
123+
*/
124+
editor?: any;
125+
126+
/**
127+
* Cell to receive initial focus in the table
128+
*
129+
* The cell that will receive focus when the table is initialised. This accepts all of
130+
* the options of cell-selector such as class name selector, jQuery pseudo selects and
131+
* cell index selectors.
132+
*/
133+
focus?: any;
134+
135+
/**
136+
* Limit the keys that KeyTable will listen for and take action on
137+
*
138+
* As null KeyTable will listen for all key presses, regardless of what key is pressed.
139+
* an array you can limit the keys that KeyTable will take action on to just the key
140+
* codes given in the array.
141+
*/
142+
keys?: number[] | null;
143+
144+
/**
145+
* Set the table's tab index for when it will receive focus
146+
*
147+
* The tab index for the table. Like all other tab indexes, this can be -1 to disallow
148+
* tabbing into the table.
149+
*/
150+
tabIndex?: number;
151+
}
152+
153+
154+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
155+
* API
156+
*/
157+
158+
interface ApiKeyTableMethods<T> extends Api<T> {
159+
/**
160+
* Disable KeyTable's interactions (mouse and keyboard)
161+
*
162+
* @returns DataTables API instance
163+
*/
164+
disable(): Api<T>;
165+
166+
/**
167+
* Enable or disable KeyTable's interactions (mouse and keyboard)
168+
*
169+
* @param options This option can be given as the following values: true - Fully enable KeyTable; false - Fully disable KeyTable (keys.disable()); "navigation-only" - Respond to navigation inputs only;
170+
* @returns DataTables API instance
171+
*/
172+
enable(options?: string | boolean): Api<T>;
173+
174+
/**
175+
* Determine if KeyTable is enabled on this table
176+
*
177+
* @returns Current state
178+
*/
179+
enabled(): boolean | 'navigation-only';
180+
181+
/**
182+
* Move the focus from the current cell to one adjacent to it.
183+
*
184+
* @param direction String representing the direction that the focus should move in
185+
* @returns DataTables API instance.
186+
*/
187+
move(direction: string): Api<T>;
188+
}

0 commit comments

Comments
 (0)