datatables.net-autofill 2.7.1 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/js/dataTables.autoFill.js +948 -1244
- package/js/dataTables.autoFill.min.js +3 -3
- package/js/dataTables.autoFill.min.mjs +3 -3
- package/js/dataTables.autoFill.mjs +930 -1226
- package/package.json +3 -15
- package/types/types.d.ts +189 -77
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"main": "js/dataTables.autoFill.js",
|
|
5
5
|
"module": "js/dataTables.autoFill.mjs",
|
|
6
6
|
"types": "./types/types.d.ts",
|
|
7
|
-
"version": "
|
|
7
|
+
"version": "3.0.0",
|
|
8
8
|
"files": [
|
|
9
9
|
"js/**/*.js",
|
|
10
10
|
"js/**/*.mjs",
|
|
@@ -14,25 +14,13 @@
|
|
|
14
14
|
"AutoFill",
|
|
15
15
|
"Excel",
|
|
16
16
|
"Datatables",
|
|
17
|
-
"jQuery",
|
|
18
17
|
"table",
|
|
19
18
|
"filter",
|
|
20
19
|
"sort"
|
|
21
20
|
],
|
|
22
21
|
"dependencies": {
|
|
23
|
-
"datatables.net": "
|
|
24
|
-
"jquery": ">=1.7"
|
|
22
|
+
"datatables.net": "^3"
|
|
25
23
|
},
|
|
26
|
-
"moduleType": [
|
|
27
|
-
"globals",
|
|
28
|
-
"amd",
|
|
29
|
-
"node"
|
|
30
|
-
],
|
|
31
|
-
"ignore": [
|
|
32
|
-
"composer.json",
|
|
33
|
-
"datatables.json",
|
|
34
|
-
"package.json"
|
|
35
|
-
],
|
|
36
24
|
"author": {
|
|
37
25
|
"name": "SpryMedia Ltd",
|
|
38
26
|
"url": "http://datatables.net"
|
|
@@ -42,6 +30,6 @@
|
|
|
42
30
|
"license": "MIT",
|
|
43
31
|
"repository": {
|
|
44
32
|
"type": "git",
|
|
45
|
-
"url": "https://github.com/DataTables/
|
|
33
|
+
"url": "git+https://github.com/DataTables/AutoFill.git"
|
|
46
34
|
}
|
|
47
35
|
}
|
package/types/types.d.ts
CHANGED
|
@@ -1,16 +1,189 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import DataTables__default, { ColumnSelector, Api, ApiCellMethods, CellIdxWithVisible, Dom, Context } from 'datatables.net';
|
|
2
|
+
export * from 'datatables.net';
|
|
3
|
+
export { default } from 'datatables.net';
|
|
4
|
+
|
|
5
|
+
interface Classes {
|
|
6
|
+
btn: string;
|
|
7
|
+
close: string;
|
|
8
|
+
closeable: string;
|
|
9
|
+
}
|
|
10
|
+
interface Defaults {
|
|
11
|
+
/** Ask user what they want to do, even for a single option */
|
|
12
|
+
alwaysAsk: boolean;
|
|
13
|
+
/** Show a "Close" button in the list of options */
|
|
14
|
+
closeButton: boolean;
|
|
15
|
+
/** What will trigger a focus */
|
|
16
|
+
focus: 'click' | 'focus' | 'hover' | null;
|
|
17
|
+
/** Columns to provide auto fill for */
|
|
18
|
+
columns: ColumnSelector;
|
|
19
|
+
/** Enable AutoFill on load */
|
|
20
|
+
enable: boolean;
|
|
21
|
+
/** Update the cells after a drag */
|
|
22
|
+
update: boolean;
|
|
23
|
+
/** Editor instance for automatic submission */
|
|
24
|
+
editor: any;
|
|
25
|
+
/** Enable vertical fill */
|
|
26
|
+
vertical: boolean;
|
|
27
|
+
/** Enable horizontal fill */
|
|
28
|
+
horizontal: boolean;
|
|
29
|
+
}
|
|
30
|
+
interface Action {
|
|
31
|
+
available(dt: Api, cells: SelectedCells[][]): boolean;
|
|
32
|
+
option(dt: Api, cells: SelectedCells[][]): string;
|
|
33
|
+
execute(dt: Api, cells: SelectedCells[][], node: Dom | null): void | false;
|
|
34
|
+
}
|
|
35
|
+
interface SelectedCells {
|
|
36
|
+
cell: ApiCellMethods<any>;
|
|
37
|
+
data: any;
|
|
38
|
+
index: CellIdxWithVisible;
|
|
39
|
+
label: string;
|
|
40
|
+
set?: any;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/*! AutoFill for DataTables
|
|
44
|
+
* Copyright (c) SpryMedia Ltd - datatables.net/license
|
|
45
|
+
*/
|
|
7
46
|
|
|
8
|
-
|
|
47
|
+
declare class AutoFill {
|
|
48
|
+
/**
|
|
49
|
+
* AutoFill actions. The options here determine how AutoFill will fill the
|
|
50
|
+
* data in the table when the user has selected a range of cells. Please see
|
|
51
|
+
* the documentation on the DataTables site for full details on how to
|
|
52
|
+
* create plug- ins.
|
|
53
|
+
*/
|
|
54
|
+
static actions: Record<string, Action>;
|
|
55
|
+
/** Class names used by AutoFill for customisation */
|
|
56
|
+
static classes: Classes;
|
|
57
|
+
/** Defaults */
|
|
58
|
+
static defaults: Defaults;
|
|
59
|
+
/** AutoFill version */
|
|
60
|
+
static version: string;
|
|
61
|
+
enabled(): boolean;
|
|
62
|
+
enable(flag?: boolean): this;
|
|
63
|
+
disable(): this;
|
|
64
|
+
private c;
|
|
65
|
+
private dom;
|
|
66
|
+
private s;
|
|
67
|
+
constructor(dt: Api | Context, opts?: Partial<Defaults>);
|
|
68
|
+
/**
|
|
69
|
+
* Initialise the RowReorder instance
|
|
70
|
+
*/
|
|
71
|
+
private _init;
|
|
72
|
+
/**
|
|
73
|
+
* Display the AutoFill drag handle by appending it to a table cell. This is
|
|
74
|
+
* the opposite of the _detach method.
|
|
75
|
+
*
|
|
76
|
+
* @param node Cell to insert the handle into
|
|
77
|
+
*/
|
|
78
|
+
private _attach;
|
|
79
|
+
/**
|
|
80
|
+
* Determine can the fill type should be. This can be automatic, or ask the
|
|
81
|
+
* end user.
|
|
82
|
+
*
|
|
83
|
+
* @param cells Information about the selected cells from the key up
|
|
84
|
+
* function
|
|
85
|
+
*/
|
|
86
|
+
private _actionSelector;
|
|
87
|
+
/**
|
|
88
|
+
* Remove the AutoFill handle from the document
|
|
89
|
+
*/
|
|
90
|
+
private _detach;
|
|
91
|
+
/**
|
|
92
|
+
* Draw the selection outline by calculating the range between the start
|
|
93
|
+
* and end cells, then placing the highlighting elements to draw a rectangle
|
|
94
|
+
*
|
|
95
|
+
* @param target End cell
|
|
96
|
+
* @param e Originating event
|
|
97
|
+
* @private
|
|
98
|
+
*/
|
|
99
|
+
private _drawSelection;
|
|
100
|
+
/**
|
|
101
|
+
* Use the Editor API to perform an update based on the new data for the
|
|
102
|
+
* cells
|
|
103
|
+
*
|
|
104
|
+
* @param cells Information about the selected cells from the key up
|
|
105
|
+
* function
|
|
106
|
+
*/
|
|
107
|
+
private _editor;
|
|
108
|
+
/**
|
|
109
|
+
* Emit an event on the DataTable for listeners
|
|
110
|
+
*
|
|
111
|
+
* @param name Event name
|
|
112
|
+
* @param args Event arguments
|
|
113
|
+
*/
|
|
114
|
+
private _emitEvent;
|
|
115
|
+
/**
|
|
116
|
+
* Attach suitable listeners (based on the configuration) that will attach
|
|
117
|
+
* and detach the AutoFill handle in the document.
|
|
118
|
+
*/
|
|
119
|
+
private _focusListener;
|
|
120
|
+
/**
|
|
121
|
+
* Clean up the event listeners
|
|
122
|
+
*/
|
|
123
|
+
private _focusListenerRemove;
|
|
124
|
+
/**
|
|
125
|
+
* Get the position of a node, relative to another, including any scrolling
|
|
126
|
+
* offsets.
|
|
127
|
+
*
|
|
128
|
+
* @param node Node to get the position of
|
|
129
|
+
* @param targetHost Node to use as the parent
|
|
130
|
+
* @return Offset calculation
|
|
131
|
+
*/
|
|
132
|
+
private _getPosition;
|
|
133
|
+
/**
|
|
134
|
+
* Start mouse drag - selects the start cell
|
|
135
|
+
*
|
|
136
|
+
* @param e Mouse down event
|
|
137
|
+
*/
|
|
138
|
+
private _mousedown;
|
|
139
|
+
/**
|
|
140
|
+
* Mouse drag - selects the end cell and update the selection display for
|
|
141
|
+
* the end user
|
|
142
|
+
*
|
|
143
|
+
* @param e Mouse move event
|
|
144
|
+
*/
|
|
145
|
+
private _mousemove;
|
|
146
|
+
/**
|
|
147
|
+
* End mouse drag - perform the update actions
|
|
148
|
+
*
|
|
149
|
+
* @param e Mouse up event
|
|
150
|
+
* @private
|
|
151
|
+
*/
|
|
152
|
+
private _mouseup;
|
|
153
|
+
/**
|
|
154
|
+
* Create an array with a range of numbers defined by the start and end
|
|
155
|
+
* parameters passed in (inclusive!).
|
|
156
|
+
*
|
|
157
|
+
* @param start Start
|
|
158
|
+
* @param end End
|
|
159
|
+
*/
|
|
160
|
+
private _range;
|
|
161
|
+
/**
|
|
162
|
+
* Move the window and DataTables scrolling during a drag to scroll new
|
|
163
|
+
* content into view. This is done by proximity to the edge of the scrolling
|
|
164
|
+
* container of the mouse - for example near the top edge of the window
|
|
165
|
+
* should scroll up. This is a little complicated as there are two elements
|
|
166
|
+
* that can be scrolled - the window and the DataTables scrolling view port
|
|
167
|
+
* (if scrollX and / or scrollY is enabled).
|
|
168
|
+
*
|
|
169
|
+
* @param e Mouse move event object
|
|
170
|
+
*/
|
|
171
|
+
private _shiftScroll;
|
|
172
|
+
/**
|
|
173
|
+
* Update the DataTable after the user has selected what they want to do
|
|
174
|
+
*
|
|
175
|
+
* @param result Return from the `execute` method - can be false internally
|
|
176
|
+
* to do nothing. This is not documented for plug-ins and is used only by
|
|
177
|
+
* the cancel option.
|
|
178
|
+
* @param cells Information about the selected cells from the key up
|
|
179
|
+
* function, augmented with the set values
|
|
180
|
+
*/
|
|
181
|
+
private _update;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// Type definitions for DataTables AutoFill
|
|
9
185
|
|
|
10
|
-
import DataTables, {Api} from 'datatables.net';
|
|
11
186
|
|
|
12
|
-
export default DataTables;
|
|
13
|
-
export * from 'datatables.net';
|
|
14
187
|
|
|
15
188
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
16
189
|
* DataTables' types integration
|
|
@@ -20,7 +193,7 @@ declare module 'datatables.net' {
|
|
|
20
193
|
/**
|
|
21
194
|
* autoFill extension options
|
|
22
195
|
*/
|
|
23
|
-
autoFill?: boolean |
|
|
196
|
+
autoFill?: boolean | Partial<Defaults>;
|
|
24
197
|
}
|
|
25
198
|
|
|
26
199
|
interface ConfigLanguage {
|
|
@@ -33,7 +206,7 @@ declare module 'datatables.net' {
|
|
|
33
206
|
interface Api<T> {
|
|
34
207
|
/**
|
|
35
208
|
* AutoFill methods container
|
|
36
|
-
*
|
|
209
|
+
*
|
|
37
210
|
* @returns Api for chaining with the additional autoFill methods
|
|
38
211
|
*/
|
|
39
212
|
autoFill: ApiAutoFill<T>;
|
|
@@ -43,74 +216,14 @@ declare module 'datatables.net' {
|
|
|
43
216
|
/**
|
|
44
217
|
* AutoFill class
|
|
45
218
|
*/
|
|
46
|
-
AutoFill:
|
|
47
|
-
/**
|
|
48
|
-
* Create a new AutoFill instance for the target DataTable
|
|
49
|
-
*/
|
|
50
|
-
new (dt: Api<any>, settings: boolean | ConfigAutoFill): AutoFill;
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* AutoFill version
|
|
54
|
-
*/
|
|
55
|
-
version: string;
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Default configuration values
|
|
59
|
-
*/
|
|
60
|
-
defaults: ConfigAutoFill;
|
|
61
|
-
}
|
|
219
|
+
AutoFill: AutoFill;
|
|
62
220
|
}
|
|
63
221
|
}
|
|
64
222
|
|
|
65
|
-
|
|
66
223
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
67
224
|
* Options
|
|
68
225
|
*/
|
|
69
226
|
|
|
70
|
-
interface ConfigAutoFill {
|
|
71
|
-
/**
|
|
72
|
-
* Always ask the end user if an action should be taken or not
|
|
73
|
-
*/
|
|
74
|
-
alwaysAsk?: boolean;
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Select the columns that can be auto filled
|
|
78
|
-
*/
|
|
79
|
-
columns?: string | number[];
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
*
|
|
83
|
-
* Attach an Editor instance for database updating
|
|
84
|
-
*/
|
|
85
|
-
editor?: any;
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
*
|
|
89
|
-
* Initial enablement state of AutoFill
|
|
90
|
-
*/
|
|
91
|
-
enable?: boolean;
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Action that will cause the auto fill drag handle to appear in a cell
|
|
95
|
-
*/
|
|
96
|
-
focus?: 'click' | 'focus' | 'hover' | null;
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Enable / disable user ability to horizontally drag and fill
|
|
100
|
-
*/
|
|
101
|
-
horizontal?: boolean;
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Control automatic update of data when a fill drag is completed
|
|
105
|
-
*/
|
|
106
|
-
update?: boolean;
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Enable / disable user ability to vertically drag and fill
|
|
110
|
-
*/
|
|
111
|
-
vertical?: boolean;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
227
|
interface ConfigAutoFillLanguage {
|
|
115
228
|
/**
|
|
116
229
|
* Multi-fill selector button text
|
|
@@ -148,7 +261,6 @@ interface ConfigAutoFillLanguage {
|
|
|
148
261
|
info?: string;
|
|
149
262
|
}
|
|
150
263
|
|
|
151
|
-
|
|
152
264
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
153
265
|
* API
|
|
154
266
|
*/
|
|
@@ -160,14 +272,14 @@ interface ApiAutoFill<T> {
|
|
|
160
272
|
interface ApiAutoFillMethods<T> extends Api<T> {
|
|
161
273
|
/**
|
|
162
274
|
* Disable AutoFill. Please note that this disallows future interactions with the table (until re-enabled).
|
|
163
|
-
*
|
|
275
|
+
*
|
|
164
276
|
* @returns DataTables Api instance
|
|
165
277
|
*/
|
|
166
278
|
disable(): Api<T>;
|
|
167
279
|
|
|
168
280
|
/**
|
|
169
281
|
* Enable end user and API modification of the focused cells in the DataTable. Differing levels of enablement are available via the optional parameter.
|
|
170
|
-
*
|
|
282
|
+
*
|
|
171
283
|
* @param flag can be true or false to signify whether to enable or disable
|
|
172
284
|
* @returns DataTables Api instance
|
|
173
285
|
*/
|
|
@@ -175,7 +287,7 @@ interface ApiAutoFillMethods<T> extends Api<T> {
|
|
|
175
287
|
|
|
176
288
|
/**
|
|
177
289
|
* This method will return a boolean value indicating if AutoFill is enabled or not on the selected table.
|
|
178
|
-
*
|
|
290
|
+
*
|
|
179
291
|
* @returns boolean signifying if autofill is enables
|
|
180
292
|
*/
|
|
181
293
|
enabled(): boolean;
|