Skip to content

Commit 7baf611

Browse files
committed
9272f0a5e26e4a21dab2a5d02a21ee486856a80a
Sync to source repo @9272f0a5e26e4a21dab2a5d02a21ee486856a80a
1 parent a82441b commit 7baf611

4 files changed

Lines changed: 150 additions & 46 deletions

File tree

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/StateRestore",
17-
"last-tag": "1.1.1"
18-
}
17+
"last-tag": "1.1.1",
18+
"last-sync": "9272f0a5e26e4a21dab2a5d02a21ee486856a80a"
19+
}

js/stateRestore.jqueryui.js

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,6 @@
1-
21
/*! Bootstrap integration for DataTables' StateRestore
32
* © SpryMedia Ltd - datatables.net/license
43
*/
5-
6-
(function( factory ){
7-
if ( typeof define === 'function' && define.amd ) {
8-
// AMD
9-
define( [''], function ( $ ) {
10-
return factory( $, window, document );
11-
} );
12-
}
13-
else if ( typeof exports === 'object' ) {
14-
// CommonJS
15-
module.exports = function (root, $) {
16-
if ( ! root ) {
17-
// CommonJS environments without a window global must pass a
18-
// root. This will give an error otherwise
19-
root = window;
20-
}
21-
22-
if ( ! $.fn.dataTable ) {
23-
require('')(root, $);
24-
}
25-
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-
394
$.extend(true, DataTable.StateRestoreCollection.classes, {
405
checkBox: 'dtsr-check-box form-check-input',
416
checkLabel: 'dtsr-check-label form-check-label',
@@ -52,7 +17,3 @@ $.extend(true, DataTable.StateRestore.classes, {
5217
// eslint-disable-next-line max-len
5318
confirmationButton: 'dtsr-confirmation-button ui-button ui-state-default ui-button-text-only ui-corner-all ui-widget'
5419
});
55-
56-
57-
return DataTable;
58-
}));

js/stateRestore.jqueryui.min.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
!function(o){"function"==typeof define&&define.amd?define([""],function(t){return o(t,window,document)}):"object"==typeof exports?module.exports=function(t,e){return t=t||window,e.fn.dataTable||require("")(t,e),o(e,0,t.document)}:o(jQuery,window,document)}(function(t,e,o,n){"use strict";var r=t.fn.dataTable;return t.extend(!0,r.StateRestoreCollection.classes,{checkBox:"dtsr-check-box form-check-input",checkLabel:"dtsr-check-label form-check-label",checkRow:"dtsr-check-row form",creationButton:"dtsr-creation-button ui-button ui-corner-all ui-widget",creationForm:"dtsr-creation-form modal-body",creationText:"dtsr-creation-text modal-header",creationTitle:"dtsr-creation-title modal-title",nameInput:"dtsr-name-input form-control",nameLabel:"dtsr-name-label form-label",nameRow:"dtsr-name-row medium-6 cell"}),t.extend(!0,r.StateRestore.classes,{confirmationButton:"dtsr-confirmation-button ui-button ui-state-default ui-button-text-only ui-corner-all ui-widget"}),r});
1+
/*!
2+
Bootstrap integration for DataTables' StateRestore
3+
© SpryMedia Ltd - datatables.net/license
4+
*/
5+
$.extend(!0,DataTable.StateRestoreCollection.classes,{checkBox:"dtsr-check-box form-check-input",checkLabel:"dtsr-check-label form-check-label",checkRow:"dtsr-check-row form",creationButton:"dtsr-creation-button ui-button ui-corner-all ui-widget",creationForm:"dtsr-creation-form modal-body",creationText:"dtsr-creation-text modal-header",creationTitle:"dtsr-creation-title modal-title",nameInput:"dtsr-name-input form-control",nameLabel:"dtsr-name-label form-label",nameRow:"dtsr-name-row medium-6 cell"});
6+
$.extend(!0,DataTable.StateRestore.classes,{confirmationButton:"dtsr-confirmation-button ui-button ui-state-default ui-button-text-only ui-corner-all ui-widget"});

types/types.d.ts

Lines changed: 141 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,144 @@
1+
// Type definitions for DataTables StateRestore
2+
//
3+
// Project: https://datatables.net/extensions/StateRestore/, https://datatables.net
14

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

6-
export default Api;
7+
import DataTables, {Api} from 'datatables.net';
8+
import * as stateRestoreCollectionType from './StateRestoreCollection';
9+
import * as stateRestoreType from './StateRestore';
710

11+
export default DataTables;
12+
13+
type DeepPartial<T> = T extends object ? {
14+
[P in keyof T]?: DeepPartial<T[P]>;
15+
} : T;
16+
17+
18+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
19+
* DataTables' types integration
20+
*/
21+
declare module 'datatables.net' {
22+
interface Config {
23+
/**
24+
* StateRestore extension options
25+
*/
26+
stateRestore?: boolean | string[] | ConfigStateRestore | ConfigStateRestore[];
27+
}
28+
29+
interface ConfigLanguage {
30+
/**
31+
* StateRestore language options
32+
*/
33+
stateRestore?: ConfigStateRestoreLanguage;
34+
}
35+
36+
interface Api<T> {
37+
/**
38+
* StateRestore API Methods
39+
*/
40+
stateRestore: ApiStateRestore<T>;
41+
}
42+
43+
interface ApiStatic {
44+
/**
45+
* StateRestore class
46+
*/
47+
StateRestore: {
48+
/**
49+
* Create a new StateRestore instance for the target DataTable
50+
*/
51+
new (dt: Api<any>, settings: string[] | ConfigStateRestore | ConfigStateRestore[]);
52+
53+
/**
54+
* StateRestore version
55+
*/
56+
version: string;
57+
58+
/**
59+
* Default configuration values
60+
*/
61+
defaults: ConfigStateRestore;
62+
}
63+
}
64+
}
65+
66+
67+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
68+
* Options
69+
*/
70+
interface ConfigStateRestore extends Partial<stateRestoreCollectionType.IDefaults> {}
71+
72+
interface ConfigStateRestoreLanguage extends DeepPartial<stateRestoreCollectionType.II18n> {}
73+
74+
75+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
76+
* API
77+
*/
78+
79+
interface ApiStateRestore<T> {
80+
/**
81+
* Creates a new state, adding it to the collection.
82+
*
83+
* @param identifier The identifier that is to be used for the new state
84+
*
85+
* @returns DatatTables Api for chaining
86+
*/
87+
addState(identifier: string): void | Api<T>;
88+
89+
/**
90+
* Retrieves a state from the collection.
91+
*
92+
* @param identifier The identifier of the state that is to be retrieved.
93+
*
94+
* @returns StateRestore instance, or further api methods.
95+
*/
96+
state(identifier: string): stateRestoreType.default | null | StateRestoreSubApi<T>;
97+
98+
/**
99+
* Retrieves all of the states from the collection.
100+
*
101+
* @returns An array of the StateRestore instances,
102+
* or further api methods that are applicable to multiple states.
103+
*/
104+
states(): stateRestoreType.default[] | StateRestoreMultiSubApi<T>;
105+
}
106+
107+
interface StateRestoreSubApi<T> extends Api<T> {
108+
/**
109+
* Removes the state previously identified in the call to `state()`.
110+
*
111+
* @returns Datatables Api for chaining.
112+
*/
113+
remove(): Api<T>;
114+
115+
/**
116+
* Loads the state previously identified in the call to `state()` into the table.
117+
*
118+
* @returns Datatables Api for chaining.
119+
*/
120+
load(): Api<T>;
121+
122+
/**
123+
* Renames the state previously identified in the call to `state()`.
124+
*
125+
* @returns Datatables Api for chaining.
126+
*/
127+
rename(): Api<T>;
128+
129+
/**
130+
* Saves the state previously identified in the call to `state()`.
131+
*
132+
* @returns Datatables Api for chaining.
133+
*/
134+
save(): Api<T>;
135+
}
136+
137+
interface StateRestoreMultiSubApi<T> extends Api<T> {
138+
/**
139+
* Removes all of the states that were previously identified in the call to `states()`.
140+
*
141+
* @returns Datatables Api for chaining.
142+
*/
143+
remove(): Api<T>;
144+
}

0 commit comments

Comments
 (0)