aa-intel-tool 2.12.1__py3-none-any.whl → 2.13.0__py3-none-any.whl

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.
Files changed (52) hide show
  1. aa_intel_tool/__init__.py +1 -1
  2. aa_intel_tool/locale/cs_CZ/LC_MESSAGES/django.po +1 -1
  3. aa_intel_tool/locale/de/LC_MESSAGES/django.mo +0 -0
  4. aa_intel_tool/locale/de/LC_MESSAGES/django.po +5 -5
  5. aa_intel_tool/locale/django.pot +2 -2
  6. aa_intel_tool/locale/es/LC_MESSAGES/django.po +1 -1
  7. aa_intel_tool/locale/fr_FR/LC_MESSAGES/django.po +1 -1
  8. aa_intel_tool/locale/it_IT/LC_MESSAGES/django.po +1 -1
  9. aa_intel_tool/locale/ja/LC_MESSAGES/django.po +1 -1
  10. aa_intel_tool/locale/ko_KR/LC_MESSAGES/django.po +1 -1
  11. aa_intel_tool/locale/nl_NL/LC_MESSAGES/django.po +1 -1
  12. aa_intel_tool/locale/pl_PL/LC_MESSAGES/django.po +1 -1
  13. aa_intel_tool/locale/ru/LC_MESSAGES/django.po +1 -1
  14. aa_intel_tool/locale/sk/LC_MESSAGES/django.po +1 -1
  15. aa_intel_tool/locale/uk/LC_MESSAGES/django.po +1 -1
  16. aa_intel_tool/locale/zh_Hans/LC_MESSAGES/django.mo +0 -0
  17. aa_intel_tool/locale/zh_Hans/LC_MESSAGES/django.po +6 -5
  18. aa_intel_tool/templates/aa_intel_tool/views/scan/chatlist.html +4 -2
  19. aa_intel_tool/templates/aa_intel_tool/views/scan/dscan.html +4 -2
  20. aa_intel_tool/templates/aa_intel_tool/views/scan/fleetcomp.html +4 -2
  21. {aa_intel_tool-2.12.1.dist-info → aa_intel_tool-2.13.0.dist-info}/METADATA +2 -2
  22. {aa_intel_tool-2.12.1.dist-info → aa_intel_tool-2.13.0.dist-info}/RECORD +24 -52
  23. aa_intel_tool/static/aa_intel_tool/libs/DataTables/2.3.4/dataTables.bootstrap5.css +0 -610
  24. aa_intel_tool/static/aa_intel_tool/libs/DataTables/2.3.4/dataTables.bootstrap5.js +0 -123
  25. aa_intel_tool/static/aa_intel_tool/libs/DataTables/2.3.4/dataTables.bootstrap5.min.css +0 -8
  26. aa_intel_tool/static/aa_intel_tool/libs/DataTables/2.3.4/dataTables.bootstrap5.min.css.map +0 -1
  27. aa_intel_tool/static/aa_intel_tool/libs/DataTables/2.3.4/dataTables.bootstrap5.min.js +0 -6
  28. aa_intel_tool/static/aa_intel_tool/libs/DataTables/2.3.4/dataTables.bootstrap5.min.js.map +0 -1
  29. aa_intel_tool/static/aa_intel_tool/libs/DataTables/2.3.4/datatables.min.js +0 -10
  30. aa_intel_tool/static/aa_intel_tool/libs/DataTables/2.3.4/datatables.min.js.map +0 -1
  31. aa_intel_tool/static/aa_intel_tool/libs/DataTables/Extensions/ColumnControl/1.1.1/css/columnControl.bootstrap5.css +0 -516
  32. aa_intel_tool/static/aa_intel_tool/libs/DataTables/Extensions/ColumnControl/1.1.1/css/columnControl.bootstrap5.min.css +0 -2
  33. aa_intel_tool/static/aa_intel_tool/libs/DataTables/Extensions/ColumnControl/1.1.1/css/columnControl.bootstrap5.min.css.map +0 -1
  34. aa_intel_tool/static/aa_intel_tool/libs/DataTables/Extensions/ColumnControl/1.1.1/js/columnControl.bootstrap5.js +0 -73
  35. aa_intel_tool/static/aa_intel_tool/libs/DataTables/Extensions/ColumnControl/1.1.1/js/columnControl.bootstrap5.min.js +0 -6
  36. aa_intel_tool/static/aa_intel_tool/libs/DataTables/Extensions/ColumnControl/1.1.1/js/columnControl.bootstrap5.min.js.map +0 -1
  37. aa_intel_tool/static/aa_intel_tool/libs/DataTables/Extensions/ColumnControl/1.1.1/js/dataTables.columnControl.js +0 -3091
  38. aa_intel_tool/static/aa_intel_tool/libs/DataTables/Extensions/ColumnControl/1.1.1/js/dataTables.columnControl.min.js +0 -10
  39. aa_intel_tool/static/aa_intel_tool/libs/DataTables/Extensions/ColumnControl/1.1.1/js/dataTables.columnControl.min.js.map +0 -1
  40. aa_intel_tool/static/aa_intel_tool/libs/DataTables/Extensions/FixedHeader/4.0.4/css/fixedHeader.bootstrap5.css +0 -20
  41. aa_intel_tool/static/aa_intel_tool/libs/DataTables/Extensions/FixedHeader/4.0.4/css/fixedHeader.bootstrap5.min.css +0 -2
  42. aa_intel_tool/static/aa_intel_tool/libs/DataTables/Extensions/FixedHeader/4.0.4/css/fixedHeader.bootstrap5.min.css.map +0 -1
  43. aa_intel_tool/static/aa_intel_tool/libs/DataTables/Extensions/FixedHeader/4.0.4/js/dataTables.fixedHeader.js +0 -1203
  44. aa_intel_tool/static/aa_intel_tool/libs/DataTables/Extensions/FixedHeader/4.0.4/js/dataTables.fixedHeader.min.js +0 -6
  45. aa_intel_tool/static/aa_intel_tool/libs/DataTables/Extensions/FixedHeader/4.0.4/js/dataTables.fixedHeader.min.js.map +0 -1
  46. aa_intel_tool/static/aa_intel_tool/libs/DataTables/Extensions/FixedHeader/4.0.4/js/fixedHeader.bootstrap5.js +0 -59
  47. aa_intel_tool/static/aa_intel_tool/libs/DataTables/Extensions/FixedHeader/4.0.4/js/fixedHeader.bootstrap5.min.js +0 -6
  48. aa_intel_tool/static/aa_intel_tool/libs/DataTables/Extensions/FixedHeader/4.0.4/js/fixedHeader.bootstrap5.min.js.map +0 -1
  49. aa_intel_tool/templates/aa_intel_tool/bundles/datatables-2-css.html +0 -11
  50. aa_intel_tool/templates/aa_intel_tool/bundles/datatables-2-js.html +0 -14
  51. {aa_intel_tool-2.12.1.dist-info → aa_intel_tool-2.13.0.dist-info}/WHEEL +0 -0
  52. {aa_intel_tool-2.12.1.dist-info → aa_intel_tool-2.13.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,1203 +0,0 @@
1
- /*!
2
- * FixedHeader 4.0.4
3
- * © SpryMedia Ltd - datatables.net/license
4
- */
5
-
6
- (function( factory ){
7
- if ( typeof define === 'function' && define.amd ) {
8
- // AMD
9
- define( ['jquery', 'datatables.net'], function ( $ ) {
10
- return factory( $, window, document );
11
- } );
12
- }
13
- else if ( typeof exports === 'object' ) {
14
- // CommonJS
15
- var jq = require('jquery');
16
- var cjsRequires = function (root, $) {
17
- if ( ! $.fn.dataTable ) {
18
- require('datatables.net')(root, $);
19
- }
20
- };
21
-
22
- if (typeof window === 'undefined') {
23
- module.exports = function (root, $) {
24
- if ( ! root ) {
25
- // CommonJS environments without a window global must pass a
26
- // root. This will give an error otherwise
27
- root = window;
28
- }
29
-
30
- if ( ! $ ) {
31
- $ = jq( root );
32
- }
33
-
34
- cjsRequires( root, $ );
35
- return factory( $, root, root.document );
36
- };
37
- }
38
- else {
39
- cjsRequires( window, jq );
40
- module.exports = factory( jq, window, window.document );
41
- }
42
- }
43
- else {
44
- // Browser
45
- factory( jQuery, window, document );
46
- }
47
- }(function( $, window, document ) {
48
- 'use strict';
49
- var DataTable = $.fn.dataTable;
50
-
51
-
52
-
53
- /**
54
- * @summary FixedHeader
55
- * @description Fix a table's header or footer, so it is always visible while
56
- * scrolling
57
- * @version 4.0.4
58
- * @author SpryMedia Ltd
59
- * @contact datatables.net
60
- *
61
- * This source file is free software, available under the following license:
62
- * MIT license - http://datatables.net/license/mit
63
- *
64
- * This source file is distributed in the hope that it will be useful, but
65
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
66
- * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
67
- *
68
- * For details please refer to: http://www.datatables.net
69
- */
70
-
71
- var _instCounter = 0;
72
-
73
- var FixedHeader = function (dt, config) {
74
- if (!DataTable.versionCheck('2')) {
75
- throw 'Warning: FixedHeader requires DataTables 2 or newer';
76
- }
77
-
78
- // Sanity check - you just know it will happen
79
- if (!(this instanceof FixedHeader)) {
80
- throw "FixedHeader must be initialised with the 'new' keyword.";
81
- }
82
-
83
- // Allow a boolean true for defaults
84
- if (config === true) {
85
- config = {};
86
- }
87
-
88
- dt = new DataTable.Api(dt);
89
-
90
- this.c = $.extend(true, {}, FixedHeader.defaults, config);
91
-
92
- this.s = {
93
- dt: dt,
94
- position: {
95
- theadTop: 0,
96
- tbodyTop: 0,
97
- tfootTop: 0,
98
- tfootBottom: 0,
99
- width: 0,
100
- left: 0,
101
- tfootHeight: 0,
102
- theadHeight: 0,
103
- windowHeight: $(window).height(),
104
- visible: true
105
- },
106
- headerMode: null,
107
- footerMode: null,
108
- autoWidth: dt.settings()[0].oFeatures.bAutoWidth,
109
- namespace: '.dtfc' + _instCounter++,
110
- scrollLeft: {
111
- header: -1,
112
- footer: -1
113
- },
114
- enable: true,
115
- autoDisable: false
116
- };
117
-
118
- this.dom = {
119
- floatingHeader: null,
120
- thead: $(dt.table().header()),
121
- tbody: $(dt.table().body()),
122
- tfoot: $(dt.table().footer()),
123
- header: {
124
- host: null,
125
- scrollAdjust: null,
126
- floating: null,
127
- floatingParent: $(
128
- '<div class="dtfh-floatingparent">' + // location
129
- '<div class="dtfh-floating-limiter">' + // hidden overflow / scrolling
130
- '<div></div>' + // adjustment for scrollbar (padding)
131
- '</div>' +
132
- '</div>'),
133
- limiter: null,
134
- placeholder: null
135
- },
136
- footer: {
137
- host: null,
138
- scrollAdjust: null,
139
- floating: null,
140
- floatingParent: $(
141
- '<div class="dtfh-floatingparent">' +
142
- '<div class="dtfh-floating-limiter">' +
143
- '<div></div>' +
144
- '</div>' +
145
- '</div>'),
146
- limiter: null,
147
- placeholder: null
148
- }
149
- };
150
-
151
- var dom = this.dom;
152
-
153
- dom.header.host = dom.thead.parent();
154
- dom.header.limiter = dom.header.floatingParent.children();
155
- dom.header.scrollAdjust = dom.header.limiter.children();
156
-
157
- dom.footer.host = dom.tfoot.parent();
158
- dom.footer.limiter = dom.footer.floatingParent.children();
159
- dom.footer.scrollAdjust = dom.footer.limiter.children();
160
-
161
- var dtSettings = dt.settings()[0];
162
- if (dtSettings._fixedHeader) {
163
- throw (
164
- 'FixedHeader already initialised on table ' + dtSettings.nTable.id
165
- );
166
- }
167
-
168
- dtSettings._fixedHeader = this;
169
-
170
- this._constructor();
171
- };
172
-
173
- /*
174
- * Variable: FixedHeader
175
- * Purpose: Prototype for FixedHeader
176
- * Scope: global
177
- */
178
- $.extend(FixedHeader.prototype, {
179
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
180
- * API methods
181
- */
182
-
183
- /**
184
- * Kill off FH and any events
185
- */
186
- destroy: function () {
187
- var dom = this.dom;
188
-
189
- this.s.dt.off('.dtfc');
190
- $(window).off(this.s.namespace);
191
-
192
- // Remove clones of FC blockers
193
- if (dom.header.rightBlocker) {
194
- dom.header.rightBlocker.remove();
195
- }
196
- if (dom.header.leftBlocker) {
197
- dom.header.leftBlocker.remove();
198
- }
199
- if (dom.footer.rightBlocker) {
200
- dom.footer.rightBlocker.remove();
201
- }
202
- if (dom.footer.leftBlocker) {
203
- dom.footer.leftBlocker.remove();
204
- }
205
-
206
- if (this.c.header) {
207
- this._modeChange('in-place', 'header', true);
208
- }
209
-
210
- if (this.c.footer && dom.tfoot.length) {
211
- this._modeChange('in-place', 'footer', true);
212
- }
213
- },
214
-
215
- /**
216
- * Enable / disable the fixed elements
217
- *
218
- * @param {boolean} enable `true` to enable, `false` to disable
219
- */
220
- enable: function (enable, update, type) {
221
- this.s.enable = enable;
222
-
223
- this.s.enableType = type;
224
-
225
- if (update || update === undefined) {
226
- this._positions();
227
- this._scroll(true);
228
- }
229
- },
230
-
231
- /**
232
- * Get enabled status
233
- */
234
- enabled: function () {
235
- return this.s.enable;
236
- },
237
-
238
- /**
239
- * Set header offset
240
- *
241
- * @param {int} new value for headerOffset
242
- */
243
- headerOffset: function (offset) {
244
- if (offset !== undefined) {
245
- this.c.headerOffset = offset;
246
- this.update();
247
- }
248
-
249
- return this.c.headerOffset;
250
- },
251
-
252
- /**
253
- * Set footer offset
254
- *
255
- * @param {int} new value for footerOffset
256
- */
257
- footerOffset: function (offset) {
258
- if (offset !== undefined) {
259
- this.c.footerOffset = offset;
260
- this.update();
261
- }
262
-
263
- return this.c.footerOffset;
264
- },
265
-
266
- /**
267
- * Recalculate the position of the fixed elements and force them into place
268
- */
269
- update: function (force) {
270
- var table = this.s.dt.table().node();
271
-
272
- // Update should only do something if enabled by the dev.
273
- if (!this.s.enable && !this.s.autoDisable) {
274
- return;
275
- }
276
-
277
- if ($(table).is(':visible')) {
278
- this.s.autoDisable = false;
279
- this.enable(true, false);
280
- }
281
- else {
282
- this.s.autoDisable = true;
283
- this.enable(false, false);
284
- }
285
-
286
- // Don't update if header is not in the document atm (due to
287
- // async events)
288
- if ($(table).children('thead').length === 0) {
289
- return;
290
- }
291
-
292
- this._positions();
293
- this._scroll(force !== undefined ? force : true);
294
- this._widths(this.dom.header);
295
- this._widths(this.dom.footer);
296
- },
297
-
298
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
299
- * Constructor
300
- */
301
-
302
- /**
303
- * FixedHeader constructor - adding the required event listeners and
304
- * simple initialisation
305
- *
306
- * @private
307
- */
308
- _constructor: function () {
309
- var that = this;
310
- var dt = this.s.dt;
311
-
312
- $(window)
313
- .on('scroll' + this.s.namespace, function () {
314
- that._scroll();
315
- })
316
- .on(
317
- 'resize' + this.s.namespace,
318
- DataTable.util.throttle(function () {
319
- that.s.position.windowHeight = $(window).height();
320
- that.update();
321
- }, 50)
322
- );
323
-
324
- var autoHeader = $('.fh-fixedHeader');
325
- if (!this.c.headerOffset && autoHeader.length) {
326
- this.c.headerOffset = autoHeader.outerHeight();
327
- }
328
-
329
- var autoFooter = $('.fh-fixedFooter');
330
- if (!this.c.footerOffset && autoFooter.length) {
331
- this.c.footerOffset = autoFooter.outerHeight();
332
- }
333
-
334
- dt.on(
335
- 'column-reorder.dt.dtfc column-visibility.dt.dtfc column-sizing.dt.dtfc responsive-display.dt.dtfc',
336
- function (e, ctx) {
337
- that.update();
338
- }
339
- ).on('draw.dt.dtfc', function (e, ctx) {
340
- // For updates from our own table, don't reclone, but for all others, do
341
- that.update(ctx === dt.settings()[0] ? false : true);
342
- });
343
-
344
- dt.on('destroy.dtfc', function () {
345
- that.destroy();
346
- });
347
-
348
- this._positions();
349
- this._scroll();
350
- },
351
-
352
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
353
- * Private methods
354
- */
355
-
356
- /**
357
- * Clone a fixed item to act as a place holder for the original element
358
- * which is moved into a clone of the table element, and moved around the
359
- * document to give the fixed effect.
360
- *
361
- * @param {string} item 'header' or 'footer'
362
- * @param {boolean} force Force the clone to happen, or allow automatic
363
- * decision (reuse existing if available)
364
- * @private
365
- */
366
- _clone: function (item, force) {
367
- var that = this;
368
- var dt = this.s.dt;
369
- var itemDom = this.dom[item];
370
- var itemElement = item === 'header' ? this.dom.thead : this.dom.tfoot;
371
-
372
- // If footer and scrolling is enabled then we don't clone
373
- // Instead the table's height is decreased accordingly - see `_scroll()`
374
- if (item === 'footer' && this._scrollEnabled()) {
375
- return;
376
- }
377
-
378
- if (!force && itemDom.floating) {
379
- // existing floating element - reuse it
380
- itemDom.floating.removeClass(
381
- 'fixedHeader-floating fixedHeader-locked'
382
- );
383
- }
384
- else {
385
- if (itemDom.floating) {
386
- if (itemDom.placeholder !== null) {
387
- itemDom.placeholder.detach();
388
- }
389
-
390
- itemDom.floating.detach();
391
- }
392
-
393
- var tableNode = $(dt.table().node());
394
- var scrollBody = $(tableNode.parent());
395
- var scrollEnabled = this._scrollEnabled();
396
-
397
- itemDom.floating = $(dt.table().node().cloneNode(false))
398
- .attr('aria-hidden', 'true')
399
- .css({
400
- top: 0,
401
- left: 0
402
- })
403
- .removeAttr('id');
404
-
405
- itemDom.floatingParent
406
- .css({
407
- width: scrollBody[0].offsetWidth,
408
- position: 'fixed',
409
- left: scrollEnabled
410
- ? tableNode.offset().left + scrollBody.scrollLeft()
411
- : 0
412
- })
413
- .css(
414
- item === 'header'
415
- ? {
416
- top: this.c.headerOffset,
417
- bottom: ''
418
- }
419
- : {
420
- top: '',
421
- bottom: this.c.footerOffset
422
- }
423
- )
424
- .addClass(
425
- item === 'footer'
426
- ? 'dtfh-floatingparent-foot'
427
- : 'dtfh-floatingparent-head'
428
- )
429
- .appendTo('body')
430
- .children()
431
- .eq(0);
432
-
433
- itemDom.limiter
434
- .css({
435
- width: '100%',
436
- overflow: 'hidden',
437
- height: 'fit-content'
438
- });
439
-
440
- itemDom.scrollAdjust
441
- .append(itemDom.floating);
442
-
443
- this._stickyPosition(itemDom.floating, '-');
444
-
445
- var scrollLeftUpdate = function () {
446
- var scrollLeft = scrollBody.scrollLeft();
447
- that.s.scrollLeft = { footer: scrollLeft, header: scrollLeft };
448
- itemDom.limiter.scrollLeft(that.s.scrollLeft.header);
449
- };
450
-
451
- scrollLeftUpdate();
452
- scrollBody.off('scroll.dtfh').on('scroll.dtfh', scrollLeftUpdate);
453
-
454
- // Need padding on the header's container to allow for a scrollbar,
455
- // just like how DataTables handles it
456
- itemDom.scrollAdjust.css({
457
- width: 'fit-content',
458
- paddingRight: that.s.dt.settings()[0].oBrowser.barWidth
459
- });
460
-
461
- // Blocker to hide the table behind the scrollbar - this needs to use
462
- // fixed positioning in the container since we don't have an outer wrapper
463
- let blocker = $(
464
- item === 'footer'
465
- ? 'div.dtfc-bottom-blocker'
466
- : 'div.dtfc-top-blocker',
467
- dt.table().container()
468
- );
469
-
470
- if (blocker.length) {
471
- blocker
472
- .clone()
473
- .appendTo(itemDom.floatingParent)
474
- .css({
475
- position: 'fixed',
476
- right: blocker.width()
477
- });
478
- }
479
-
480
- // Insert a fake thead/tfoot into the DataTable to stop it jumping around
481
- itemDom.placeholder = itemElement.clone(false);
482
- itemDom.placeholder.find('*[id]').removeAttr('id');
483
-
484
- // Move the thead / tfoot elements around - original into the floating
485
- // element and clone into the original table
486
- itemDom.host.prepend(itemDom.placeholder);
487
- itemDom.floating.append(itemElement);
488
-
489
- this._widths(itemDom);
490
- }
491
- },
492
-
493
- /**
494
- * This method sets the sticky position of the header elements to match fixed columns
495
- * @param {JQuery<HTMLElement>} el
496
- * @param {string} sign
497
- */
498
- _stickyPosition: function (el, sign) {
499
- if (this._scrollEnabled()) {
500
- var that = this;
501
- var rtl = $(that.s.dt.table().node()).css('direction') === 'rtl';
502
-
503
- el.find('th').each(function () {
504
- // Find out if fixed header has previously set this column
505
- if ($(this).css('position') === 'sticky') {
506
- var right = $(this).css('right');
507
- var left = $(this).css('left');
508
- var potential;
509
-
510
- if (right !== 'auto' && !rtl) {
511
- potential = +right.replace(/px/g, '')
512
-
513
- $(this).css('right', potential > 0 ? potential : 0);
514
- }
515
- else if (left !== 'auto' && rtl) {
516
- potential = +left.replace(/px/g, '');
517
-
518
- $(this).css('left', potential > 0 ? potential : 0);
519
- }
520
- }
521
- });
522
- }
523
- },
524
-
525
- /**
526
- * Reposition the floating elements to take account of horizontal page
527
- * scroll
528
- *
529
- * @param {string} item The `header` or `footer`
530
- * @param {int} scrollLeft Document scrollLeft
531
- * @private
532
- */
533
- _horizontal: function (item, scrollLeft) {
534
- var itemDom = this.dom[item];
535
- var lastScrollLeft = this.s.scrollLeft;
536
-
537
- if (itemDom.floating && lastScrollLeft[item] !== scrollLeft) {
538
- // If scrolling is enabled we need to match the floating header to the body
539
- if (this._scrollEnabled()) {
540
- var newScrollLeft = $(
541
- $(this.s.dt.table().node()).parent()
542
- ).scrollLeft();
543
- itemDom.floating.scrollLeft(newScrollLeft);
544
- itemDom.floatingParent.scrollLeft(newScrollLeft);
545
- }
546
-
547
- lastScrollLeft[item] = scrollLeft;
548
- }
549
- },
550
-
551
- /**
552
- * Change from one display mode to another. Each fixed item can be in one
553
- * of:
554
- *
555
- * * `in-place` - In the main DataTable
556
- * * `in` - Floating over the DataTable
557
- * * `below` - (Header only) Fixed to the bottom of the table body
558
- * * `above` - (Footer only) Fixed to the top of the table body
559
- *
560
- * @param {string} mode Mode that the item should be shown in
561
- * @param {string} item 'header' or 'footer'
562
- * @param {boolean} forceChange Force a redraw of the mode, even if already
563
- * in that mode.
564
- * @private
565
- */
566
- _modeChange: function (mode, item, forceChange) {
567
- var dt = this.s.dt;
568
- var itemDom = this.dom[item];
569
- var position = this.s.position;
570
-
571
- // Just determine if scroll is enabled once
572
- var scrollEnabled = this._scrollEnabled();
573
-
574
- // If footer and scrolling is enabled then we don't clone
575
- // Instead the table's height is decreased accordingly - see `_scroll()`
576
- if (item === 'footer' && scrollEnabled) {
577
- return;
578
- }
579
-
580
- // It isn't trivial to add a !important css attribute...
581
- var importantWidth = function (w) {
582
- itemDom.floating[0].style.setProperty('width', w + 'px', 'important');
583
-
584
- // If not scrolling also have to update the floatingParent
585
- if (!scrollEnabled) {
586
- itemDom.floatingParent[0].style.setProperty('width', w + 'px', 'important');
587
- }
588
- };
589
-
590
- // Record focus. Browser's will cause input elements to loose focus if
591
- // they are inserted else where in the doc
592
- var tablePart = this.dom[item === 'footer' ? 'tfoot' : 'thead'];
593
- var focus = $.contains(tablePart[0], document.activeElement)
594
- ? document.activeElement
595
- : null;
596
- var scrollBody = $($(this.s.dt.table().node()).parent());
597
-
598
- if (mode === 'in-place') {
599
- // Insert the header back into the table's real header
600
- if (itemDom.placeholder) {
601
- itemDom.placeholder.remove();
602
- itemDom.placeholder = null;
603
- }
604
-
605
- if (!$.contains(itemDom.host[0], tablePart[0])) {
606
- if (item === 'header') {
607
- itemDom.host.prepend(tablePart);
608
- }
609
- else {
610
- itemDom.host.append(tablePart);
611
- }
612
- }
613
-
614
- if (itemDom.floating) {
615
- itemDom.floating.remove();
616
- itemDom.floating = null;
617
- this._stickyPosition(itemDom.host, '+');
618
- }
619
-
620
- if (itemDom.floatingParent) {
621
- itemDom.floatingParent.find('div.dtfc-top-blocker').remove();
622
- itemDom.floatingParent.remove();
623
- }
624
-
625
- $($(itemDom.host.parent()).parent()).scrollLeft(
626
- scrollBody.scrollLeft()
627
- );
628
- }
629
- else if (mode === 'in') {
630
- // Remove the header from the real table and insert into a fixed
631
- // positioned floating table clone
632
- this._clone(item, forceChange);
633
-
634
- // Get useful position values
635
- var scrollOffset = scrollBody.offset();
636
- var windowTop = $(document).scrollTop();
637
- var windowHeight = $(window).height();
638
- var windowBottom = windowTop + windowHeight;
639
- var bodyTop = scrollEnabled ? scrollOffset.top : position.tbodyTop;
640
- var bodyBottom = scrollEnabled
641
- ? scrollOffset.top + scrollBody.outerHeight()
642
- : position.tfootTop;
643
-
644
- // Calculate the amount that the footer or header needs to be shuffled
645
- var shuffle;
646
-
647
- if (item === 'footer') {
648
- shuffle =
649
- bodyTop > windowBottom
650
- ? position.tfootHeight // Yes - push the footer below
651
- : bodyTop + position.tfootHeight - windowBottom; // No
652
- }
653
- else {
654
- // Otherwise must be a header so get the difference from the bottom of the
655
- // desired floating header and the bottom of the table body
656
- shuffle =
657
- windowTop +
658
- this.c.headerOffset +
659
- position.theadHeight -
660
- bodyBottom;
661
- }
662
-
663
- // Set the top or bottom based off of the offset and the shuffle value
664
- var prop = item === 'header' ? 'top' : 'bottom';
665
- var val = this.c[item + 'Offset'] - (shuffle > 0 ? shuffle : 0);
666
-
667
- itemDom.floating.addClass('fixedHeader-floating');
668
- itemDom.floatingParent
669
- .css(prop, val)
670
- .css({
671
- left: position.left,
672
- 'z-index': 3
673
- });
674
-
675
- importantWidth(position.width);
676
-
677
- if (item === 'footer') {
678
- itemDom.floating.css('top', '');
679
- }
680
- }
681
- else if (mode === 'below') {
682
- // only used for the header
683
- // Fix the position of the floating header at base of the table body
684
- this._clone(item, forceChange);
685
-
686
- itemDom.floating.addClass('fixedHeader-locked');
687
- itemDom.floatingParent.css({
688
- position: 'absolute',
689
- top: position.tfootTop - position.theadHeight,
690
- left: position.left + 'px'
691
- });
692
-
693
- importantWidth(position.width);
694
- }
695
- else if (mode === 'above') {
696
- // only used for the footer
697
- // Fix the position of the floating footer at top of the table body
698
- this._clone(item, forceChange);
699
-
700
- itemDom.floating.addClass('fixedHeader-locked');
701
- itemDom.floatingParent.css({
702
- position: 'absolute',
703
- top: position.tbodyTop,
704
- left: position.left + 'px'
705
- });
706
-
707
- importantWidth(position.width);
708
- }
709
-
710
- // Restore focus if it was lost
711
- if (focus && focus !== document.activeElement) {
712
- setTimeout(function () {
713
- focus.focus();
714
- }, 10);
715
- }
716
-
717
- this.s.scrollLeft.header = -1;
718
- this.s.scrollLeft.footer = -1;
719
- this.s[item + 'Mode'] = mode;
720
-
721
- dt.trigger('fixedheader-mode', [mode, item]);
722
- },
723
-
724
- /**
725
- * Cache the positional information that is required for the mode
726
- * calculations that FixedHeader performs.
727
- *
728
- * @private
729
- */
730
- _positions: function () {
731
- var dt = this.s.dt;
732
- var table = dt.table();
733
- var position = this.s.position;
734
- var dom = this.dom;
735
- var tableNode = $(table.node());
736
- var scrollEnabled = this._scrollEnabled();
737
-
738
- // Need to use the header and footer that are in the main table,
739
- // regardless of if they are clones, since they hold the positions we
740
- // want to measure from
741
- var thead = $(dt.table().header());
742
- var tfoot = $(dt.table().footer());
743
- var tbody = dom.tbody;
744
- var scrollBody = tableNode.parent();
745
-
746
- position.visible = tableNode.is(':visible');
747
- position.width = tableNode.outerWidth();
748
- position.left = tableNode.offset().left;
749
- position.theadTop = thead.offset().top;
750
- position.tbodyTop = scrollEnabled
751
- ? scrollBody.offset().top
752
- : tbody.offset().top;
753
- position.tbodyHeight = scrollEnabled
754
- ? scrollBody.outerHeight()
755
- : tbody.outerHeight();
756
- position.theadHeight = thead.outerHeight();
757
- position.theadBottom = position.theadTop + position.theadHeight;
758
- position.tfootTop = position.tbodyTop + position.tbodyHeight; //tfoot.offset().top;
759
-
760
- if (tfoot.length) {
761
- position.tfootBottom = position.tfootTop + tfoot.outerHeight();
762
- position.tfootHeight = tfoot.outerHeight();
763
- }
764
- else {
765
- position.tfootBottom = position.tfootTop;
766
- position.tfootHeight = 0;
767
- }
768
- },
769
-
770
- /**
771
- * Mode calculation - determine what mode the fixed items should be placed
772
- * into.
773
- *
774
- * @param {boolean} forceChange Force a redraw of the mode, even if already
775
- * in that mode.
776
- * @private
777
- */
778
- _scroll: function (forceChange) {
779
- if (this.s.dt.settings()[0].bDestroying) {
780
- return;
781
- }
782
-
783
- // ScrollBody details
784
- var scrollEnabled = this._scrollEnabled();
785
- var scrollBody = $(this.s.dt.table().node()).parent();
786
- var scrollOffset = scrollBody.offset();
787
- var scrollHeight = scrollBody.outerHeight();
788
-
789
- // Window details
790
- var windowLeft = $(document).scrollLeft();
791
- var windowTop = $(document).scrollTop();
792
- var windowHeight = $(window).height();
793
- var windowBottom = windowHeight + windowTop;
794
-
795
- var position = this.s.position;
796
- var headerMode, footerMode;
797
-
798
- // Body Details
799
- var bodyTop = scrollEnabled ? scrollOffset.top : position.tbodyTop;
800
- var bodyLeft = scrollEnabled ? scrollOffset.left : position.left;
801
- var bodyBottom = scrollEnabled
802
- ? scrollOffset.top + scrollHeight
803
- : position.tfootTop;
804
- var bodyWidth = scrollEnabled
805
- ? scrollBody.outerWidth()
806
- : position.tbodyWidth;
807
-
808
- if (this.c.header) {
809
- if (!this.s.enable) {
810
- headerMode = 'in-place';
811
- }
812
- // The header is in it's normal place if the body top is lower than
813
- // the scroll of the window plus the headerOffset and the height of the header
814
- else if (
815
- !position.visible ||
816
- windowTop + this.c.headerOffset + position.theadHeight <=
817
- bodyTop
818
- ) {
819
- headerMode = 'in-place';
820
- }
821
- // The header should be floated if
822
- else if (
823
- // The scrolling plus the header offset plus the height of the header is lower than the top of the body
824
- windowTop + this.c.headerOffset + position.theadHeight >
825
- bodyTop &&
826
- // And the scrolling at the top plus the header offset is above the bottom of the body
827
- windowTop + this.c.headerOffset + position.theadHeight <
828
- bodyBottom
829
- ) {
830
- headerMode = 'in';
831
-
832
- // Further to the above, If the scrolling plus the header offset plus the header height is lower
833
- // than the bottom of the table a shuffle is required so have to force the calculation
834
- if (
835
- windowTop + this.c.headerOffset + position.theadHeight >
836
- bodyBottom ||
837
- this.dom.header.floatingParent === undefined
838
- ) {
839
- forceChange = true;
840
- }
841
- else {
842
- var child = this.dom.header.floatingParent
843
- .css({
844
- top: this.c.headerOffset,
845
- position: 'fixed'
846
- })
847
- .children()
848
- .eq(0);
849
-
850
- if (child.find(this.dom.header.floating).length === 0) {
851
- child.append(this.dom.header.floating);
852
- }
853
- }
854
- }
855
- // Anything else and the view is below the table
856
- else {
857
- headerMode = 'below';
858
- }
859
-
860
- if (forceChange || headerMode !== this.s.headerMode) {
861
- this._modeChange(headerMode, 'header', forceChange);
862
- }
863
-
864
- this._horizontal('header', windowLeft);
865
- }
866
-
867
- var header = {
868
- offset: { top: 0, left: 0 },
869
- height: 0
870
- };
871
- var footer = {
872
- offset: { top: 0, left: 0 },
873
- height: 0
874
- };
875
-
876
- if (
877
- this.c.footer &&
878
- this.dom.tfoot.length &&
879
- this.dom.tfoot.find('th, td').length
880
- ) {
881
- if (!this.s.enable) {
882
- footerMode = 'in-place';
883
- }
884
- else if (
885
- !position.visible ||
886
- position.tfootBottom + this.c.footerOffset <= windowBottom
887
- ) {
888
- footerMode = 'in-place';
889
- }
890
- else if (
891
- bodyBottom + position.tfootHeight + this.c.footerOffset >
892
- windowBottom &&
893
- bodyTop + this.c.footerOffset < windowBottom
894
- ) {
895
- footerMode = 'in';
896
- forceChange = true;
897
- }
898
- else {
899
- footerMode = 'above';
900
- }
901
-
902
- if (forceChange || footerMode !== this.s.footerMode) {
903
- this._modeChange(footerMode, 'footer', forceChange);
904
- }
905
-
906
- this._horizontal('footer', windowLeft);
907
-
908
- var getOffsetHeight = function (el) {
909
- return {
910
- offset: el.offset(),
911
- height: el.outerHeight()
912
- };
913
- };
914
-
915
- header = this.dom.header.floating
916
- ? getOffsetHeight(this.dom.header.floating)
917
- : getOffsetHeight(this.dom.thead);
918
- footer = this.dom.footer.floating
919
- ? getOffsetHeight(this.dom.footer.floating)
920
- : getOffsetHeight(this.dom.tfoot);
921
-
922
- // If scrolling is enabled and the footer is off the screen
923
- if (scrollEnabled && footer.offset.top > windowTop) {
924
- // && footer.offset.top >= windowBottom) {
925
- // Calculate the gap between the top of the scrollBody and the top of the window
926
- var overlap = windowTop - scrollOffset.top;
927
- // The new height is the bottom of the window
928
- var newHeight =
929
- windowBottom +
930
- // If the gap between the top of the scrollbody and the window is more than
931
- // the height of the header then the top of the table is still visible so add that gap
932
- // Doing this has effectively calculated the height from the top of the table to the bottom of the current page
933
- (overlap > -header.height ? overlap : 0) -
934
- // Take from that
935
- // The top of the header plus
936
- (header.offset.top +
937
- // The header height if the standard header is present
938
- (overlap < -header.height ? header.height : 0) +
939
- // And the height of the footer
940
- footer.height);
941
-
942
- // Don't want a negative height
943
- if (newHeight < 0) {
944
- newHeight = 0;
945
- }
946
-
947
- // At the end of the above calculation the space between the header (top of the page if floating)
948
- // and the point just above the footer should be the new value for the height of the table.
949
- scrollBody.outerHeight(newHeight);
950
-
951
- // Need some rounding here as sometimes very small decimal places are encountered
952
- // If the actual height is bigger or equal to the height we just applied then the footer is "Floating"
953
- if (
954
- Math.round(scrollBody.outerHeight()) >=
955
- Math.round(newHeight)
956
- ) {
957
- $(this.dom.tfoot.parent()).addClass('fixedHeader-floating');
958
- }
959
- // Otherwise max-width has kicked in so it is not floating
960
- else {
961
- $(this.dom.tfoot.parent()).removeClass(
962
- 'fixedHeader-floating'
963
- );
964
- }
965
- }
966
- }
967
-
968
- if (this.dom.header.floating) {
969
- this.dom.header.floatingParent.css('left', bodyLeft - windowLeft);
970
- }
971
- if (this.dom.footer.floating) {
972
- this.dom.footer.floatingParent.css('left', bodyLeft - windowLeft);
973
- }
974
-
975
- // If fixed columns is being used on this table then the blockers need to be copied across
976
- // Cloning these is cleaner than creating as our own as it will keep consistency with fixedColumns automatically
977
- // ASSUMING that the class remains the same
978
- if (this.s.dt.settings()[0]._fixedColumns !== undefined) {
979
- var adjustBlocker = function (side, end, el) {
980
- if (el === undefined) {
981
- var blocker = $(
982
- 'div.dtfc-' + side + '-' + end + '-blocker'
983
- );
984
-
985
- el =
986
- blocker.length === 0
987
- ? null
988
- : blocker.clone().css('z-index', 1);
989
- }
990
-
991
- if (el !== null) {
992
- if (headerMode === 'in' || headerMode === 'below') {
993
- el.appendTo('body').css({
994
- top:
995
- end === 'top'
996
- ? header.offset.top
997
- : footer.offset.top,
998
- left:
999
- side === 'right'
1000
- ? bodyLeft + bodyWidth - el.width()
1001
- : bodyLeft
1002
- });
1003
- }
1004
- else {
1005
- el.detach();
1006
- }
1007
- }
1008
-
1009
- return el;
1010
- };
1011
-
1012
- // Adjust all blockers
1013
- this.dom.header.rightBlocker = adjustBlocker(
1014
- 'right',
1015
- 'top',
1016
- this.dom.header.rightBlocker
1017
- );
1018
- this.dom.header.leftBlocker = adjustBlocker(
1019
- 'left',
1020
- 'top',
1021
- this.dom.header.leftBlocker
1022
- );
1023
- this.dom.footer.rightBlocker = adjustBlocker(
1024
- 'right',
1025
- 'bottom',
1026
- this.dom.footer.rightBlocker
1027
- );
1028
- this.dom.footer.leftBlocker = adjustBlocker(
1029
- 'left',
1030
- 'bottom',
1031
- this.dom.footer.leftBlocker
1032
- );
1033
- }
1034
- },
1035
-
1036
- /**
1037
- * Function to check if scrolling is enabled on the table or not
1038
- * @returns Boolean value indicating if scrolling on the table is enabled or not
1039
- */
1040
- _scrollEnabled: function () {
1041
- var oScroll = this.s.dt.settings()[0].oScroll;
1042
- if (oScroll.sY !== '' || oScroll.sX !== '') {
1043
- return true;
1044
- }
1045
- return false;
1046
- },
1047
-
1048
- /**
1049
- * Realign columns by using the colgroup tag and
1050
- * checking column widths
1051
- */
1052
- _widths: function (itemDom) {
1053
- if (! itemDom || ! itemDom.placeholder) {
1054
- return;
1055
- }
1056
-
1057
- // Match the table overall width
1058
- var tableNode = $(this.s.dt.table().node());
1059
- var scrollBody = $(tableNode.parent());
1060
-
1061
- itemDom.floatingParent.css('width', scrollBody[0].offsetWidth);
1062
- itemDom.floating.css('width', tableNode[0].offsetWidth);
1063
-
1064
- // Strip out the old colgroup
1065
- $('colgroup', itemDom.floating).remove();
1066
-
1067
- // Copy the `colgroup` element to define the number of columns - needed
1068
- // for complex header cases where a column might not have a unique
1069
- // header
1070
- var cols = itemDom.placeholder
1071
- .parent()
1072
- .find('colgroup')
1073
- .clone()
1074
- .appendTo(itemDom.floating)
1075
- .find('col');
1076
-
1077
- // However, the widths defined in the colgroup from the DataTable might
1078
- // not exactly reflect the actual widths of the columns (content can
1079
- // force it to stretch). So we need to copy the actual widths into the
1080
- // colgroup / col's used for the floating header.
1081
- var widths = this.s.dt.columns(':visible').widths();
1082
-
1083
- for (var i=0 ; i<widths.length ; i++) {
1084
- cols.eq(i).css('width', widths[i]);
1085
- }
1086
- }
1087
- });
1088
-
1089
- /**
1090
- * Version
1091
- * @type {String}
1092
- * @static
1093
- */
1094
- FixedHeader.version = '4.0.4';
1095
-
1096
- /**
1097
- * Defaults
1098
- * @type {Object}
1099
- * @static
1100
- */
1101
- FixedHeader.defaults = {
1102
- header: true,
1103
- footer: false,
1104
- headerOffset: 0,
1105
- footerOffset: 0
1106
- };
1107
-
1108
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1109
- * DataTables interfaces
1110
- */
1111
-
1112
- // Attach for constructor access
1113
- $.fn.dataTable.FixedHeader = FixedHeader;
1114
- $.fn.DataTable.FixedHeader = FixedHeader;
1115
-
1116
- // DataTables creation - check if the FixedHeader option has been defined on the
1117
- // table and if so, initialise
1118
- $(document).on('init.dt.dtfh', function (e, settings, json) {
1119
- if (e.namespace !== 'dt') {
1120
- return;
1121
- }
1122
-
1123
- var init = settings.oInit.fixedHeader;
1124
- var defaults = DataTable.defaults.fixedHeader;
1125
-
1126
- if ((init || defaults) && !settings._fixedHeader) {
1127
- var opts = $.extend({}, defaults, init);
1128
-
1129
- if (init !== false) {
1130
- new FixedHeader(settings, opts);
1131
- }
1132
- }
1133
- });
1134
-
1135
- // DataTables API methods
1136
- DataTable.Api.register('fixedHeader()', function () { });
1137
-
1138
- DataTable.Api.register('fixedHeader.adjust()', function () {
1139
- return this.iterator('table', function (ctx) {
1140
- var fh = ctx._fixedHeader;
1141
-
1142
- if (fh) {
1143
- fh.update();
1144
- }
1145
- });
1146
- });
1147
-
1148
- DataTable.Api.register('fixedHeader.enable()', function (flag) {
1149
- return this.iterator('table', function (ctx) {
1150
- var fh = ctx._fixedHeader;
1151
-
1152
- flag = flag !== undefined ? flag : true;
1153
- if (fh && flag !== fh.enabled()) {
1154
- fh.enable(flag);
1155
- }
1156
- });
1157
- });
1158
-
1159
- DataTable.Api.register('fixedHeader.enabled()', function () {
1160
- if (this.context.length) {
1161
- var fh = this.context[0]._fixedHeader;
1162
-
1163
- if (fh) {
1164
- return fh.enabled();
1165
- }
1166
- }
1167
-
1168
- return false;
1169
- });
1170
-
1171
- DataTable.Api.register('fixedHeader.disable()', function () {
1172
- return this.iterator('table', function (ctx) {
1173
- var fh = ctx._fixedHeader;
1174
-
1175
- if (fh && fh.enabled()) {
1176
- fh.enable(false);
1177
- }
1178
- });
1179
- });
1180
-
1181
- $.each(['header', 'footer'], function (i, el) {
1182
- DataTable.Api.register('fixedHeader.' + el + 'Offset()', function (offset) {
1183
- var ctx = this.context;
1184
-
1185
- if (offset === undefined) {
1186
- return ctx.length && ctx[0]._fixedHeader
1187
- ? ctx[0]._fixedHeader[el + 'Offset']()
1188
- : undefined;
1189
- }
1190
-
1191
- return this.iterator('table', function (ctx) {
1192
- var fh = ctx._fixedHeader;
1193
-
1194
- if (fh) {
1195
- fh[el + 'Offset'](offset);
1196
- }
1197
- });
1198
- });
1199
- });
1200
-
1201
-
1202
- return DataTable;
1203
- }));