datatables.net-columncontrol 1.0.3 → 1.0.5
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! ColumnControl 1.0.
|
|
1
|
+
/*! ColumnControl 1.0.5
|
|
2
2
|
* Copyright (c) SpryMedia Ltd - datatables.net/license
|
|
3
3
|
*
|
|
4
4
|
* SVG icons: ISC License
|
|
@@ -75,7 +75,7 @@ function addClass(el, classes) {
|
|
|
75
75
|
classes = [classes];
|
|
76
76
|
}
|
|
77
77
|
classes.forEach(function (className) {
|
|
78
|
-
if (className) {
|
|
78
|
+
if (el && className) {
|
|
79
79
|
el.classList.add(className);
|
|
80
80
|
}
|
|
81
81
|
});
|
|
@@ -157,6 +157,9 @@ function close(e) {
|
|
|
157
157
|
}
|
|
158
158
|
});
|
|
159
159
|
}
|
|
160
|
+
function getContainer(dt, btn) {
|
|
161
|
+
return btn.closest('div.dtfh-floatingparent') || dt.table().container();
|
|
162
|
+
}
|
|
160
163
|
/**
|
|
161
164
|
* Position the dropdown relative to the button that activated it, with possible corrections
|
|
162
165
|
* to make sure it is visible on the page.
|
|
@@ -166,11 +169,11 @@ function close(e) {
|
|
|
166
169
|
* @param btn Button the dropdown emanates from
|
|
167
170
|
*/
|
|
168
171
|
function positionDropdown(dropdown, dt, btn) {
|
|
169
|
-
var dtContainer = dt.table().container();
|
|
170
172
|
var header = btn.closest('div.dt-column-header');
|
|
173
|
+
var container = getContainer(dt, btn);
|
|
171
174
|
var headerStyle = getComputedStyle(header);
|
|
172
175
|
var dropdownWidth = dropdown.offsetWidth;
|
|
173
|
-
var position = relativePosition(
|
|
176
|
+
var position = relativePosition(container, btn);
|
|
174
177
|
var left, top;
|
|
175
178
|
top = position.top + btn.offsetHeight;
|
|
176
179
|
if (headerStyle.flexDirection === 'row-reverse') {
|
|
@@ -182,7 +185,7 @@ function positionDropdown(dropdown, dt, btn) {
|
|
|
182
185
|
left = position.left - dropdownWidth + btn.offsetWidth;
|
|
183
186
|
}
|
|
184
187
|
// Corrections - don't extend past the DataTable to the left and right
|
|
185
|
-
var containerWidth =
|
|
188
|
+
var containerWidth = container.offsetWidth;
|
|
186
189
|
if (left + dropdownWidth > containerWidth) {
|
|
187
190
|
left -= left + dropdownWidth - containerWidth;
|
|
188
191
|
}
|
|
@@ -201,7 +204,7 @@ function positionDropdown(dropdown, dt, btn) {
|
|
|
201
204
|
* @returns Function to call when the dropdown should be removed from the document
|
|
202
205
|
*/
|
|
203
206
|
function attachDropdown(dropdown, dt, btn) {
|
|
204
|
-
var dtContainer = dt.
|
|
207
|
+
var dtContainer = getContainer(dt, btn.element());
|
|
205
208
|
dropdown._shown = true;
|
|
206
209
|
dtContainer.append(dropdown);
|
|
207
210
|
positionDropdown(dropdown, dt, btn.element());
|
|
@@ -249,6 +252,51 @@ function relativePosition(parent, origin) {
|
|
|
249
252
|
left: left
|
|
250
253
|
};
|
|
251
254
|
}
|
|
255
|
+
/**
|
|
256
|
+
* Function that will provide the keyboard navigation for the dropdown
|
|
257
|
+
*
|
|
258
|
+
* @param dropdown Dropdown element in question
|
|
259
|
+
* @returns Function that can be bound to `keypress`
|
|
260
|
+
*/
|
|
261
|
+
function focusCapture(dropdown, host) {
|
|
262
|
+
return function (e) {
|
|
263
|
+
// Do nothing if not shown
|
|
264
|
+
if (!dropdown._shown) {
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
// Focus trap for tab key
|
|
268
|
+
var elements = Array.from(dropdown.querySelectorAll('a, button, input, select'));
|
|
269
|
+
var active = document.activeElement;
|
|
270
|
+
// An escape key should close the dropdown
|
|
271
|
+
if (e.key === 'Escape') {
|
|
272
|
+
dropdown._close();
|
|
273
|
+
host.focus(); // Restore focus to the host
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
else if (e.key !== 'Tab' || elements.length === 0) {
|
|
277
|
+
// Anything other than tab we aren't interested in from here
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
if (!elements.includes(active)) {
|
|
281
|
+
// If new focus is not inside the popover we want to drag it back in
|
|
282
|
+
elements[0].focus();
|
|
283
|
+
e.preventDefault();
|
|
284
|
+
}
|
|
285
|
+
else if (e.shiftKey) {
|
|
286
|
+
// Reverse tabbing order when shift key is pressed
|
|
287
|
+
if (active === elements[0]) {
|
|
288
|
+
elements[elements.length - 1].focus();
|
|
289
|
+
e.preventDefault();
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
if (active === elements[elements.length - 1]) {
|
|
294
|
+
elements[0].focus();
|
|
295
|
+
e.preventDefault();
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
}
|
|
252
300
|
var dropdownContent = {
|
|
253
301
|
classes: {
|
|
254
302
|
container: 'dtcc-dropdown',
|
|
@@ -270,6 +318,15 @@ var dropdownContent = {
|
|
|
270
318
|
dropdown.remove();
|
|
271
319
|
dropdown._shown = false;
|
|
272
320
|
};
|
|
321
|
+
dropdown.setAttribute('role', 'dialog');
|
|
322
|
+
dropdown.setAttribute('aria-label', dt.i18n('columnControl.dropdown', config.text));
|
|
323
|
+
// When FixedHeader is used, the transition between states messes up positioning, so if
|
|
324
|
+
// shown we just reattach the dropdown.
|
|
325
|
+
dt.on('fixedheader-mode', function () {
|
|
326
|
+
if (dropdown._shown) {
|
|
327
|
+
attachDropdown(dropdown, dt, config._parents ? config._parents[0] : btn);
|
|
328
|
+
}
|
|
329
|
+
});
|
|
273
330
|
// A liner element allows more styling options, so the contents go inside this
|
|
274
331
|
var liner = dropdown.childNodes[0];
|
|
275
332
|
var btn = new Button(dt)
|
|
@@ -284,7 +341,14 @@ var dropdownContent = {
|
|
|
284
341
|
return;
|
|
285
342
|
}
|
|
286
343
|
attachDropdown(dropdown, dt, config._parents ? config._parents[0] : btn);
|
|
344
|
+
// When activated using a key - auto focus on the first item in the popover
|
|
345
|
+
var focusable = dropdown.querySelector('input, a, button');
|
|
346
|
+
console.log(e.type, e);
|
|
347
|
+
if (focusable && e.type === 'keypress') {
|
|
348
|
+
focusable.focus();
|
|
349
|
+
}
|
|
287
350
|
});
|
|
351
|
+
btn.element().setAttribute('aria-haspopup', 'dialog');
|
|
288
352
|
// Add the content for the dropdown
|
|
289
353
|
for (var i = 0; i < config.content.length; i++) {
|
|
290
354
|
var content = this.resolve(config.content[i]);
|
|
@@ -305,6 +369,12 @@ var dropdownContent = {
|
|
|
305
369
|
dt.on('columns-reordered', function () {
|
|
306
370
|
positionDropdown(dropdown, dt, btn.element());
|
|
307
371
|
});
|
|
372
|
+
// Focus capture events
|
|
373
|
+
var capture = focusCapture(dropdown, btn.element());
|
|
374
|
+
document.body.addEventListener('keydown', capture);
|
|
375
|
+
dt.on('destroy', function () {
|
|
376
|
+
document.body.removeEventListener('keydown', capture);
|
|
377
|
+
});
|
|
308
378
|
return btn.element();
|
|
309
379
|
}
|
|
310
380
|
};
|
|
@@ -401,6 +471,7 @@ var Button = /** @class */ (function () {
|
|
|
401
471
|
Button.prototype.destroy = function () {
|
|
402
472
|
if (this._s.buttonClick) {
|
|
403
473
|
this._dom.button.removeEventListener('click', this._s.buttonClick);
|
|
474
|
+
this._dom.button.removeEventListener('keypress', this._s.buttonClick);
|
|
404
475
|
}
|
|
405
476
|
if (this._s.namespace) {
|
|
406
477
|
this._s.dt.off('destroy.' + this._s.namespace);
|
|
@@ -468,6 +539,7 @@ var Button = /** @class */ (function () {
|
|
|
468
539
|
this._s.buttonClick = buttonClick;
|
|
469
540
|
this._s.namespace = 'dtcc-' + _namespace++;
|
|
470
541
|
this._dom.button.addEventListener('click', buttonClick);
|
|
542
|
+
this._dom.button.addEventListener('keypress', buttonClick);
|
|
471
543
|
// Use a unique namespace to be able to easily remove per button
|
|
472
544
|
this._s.dt.on('destroy.' + this._s.namespace, function () {
|
|
473
545
|
_this.destroy();
|
|
@@ -490,6 +562,7 @@ var Button = /** @class */ (function () {
|
|
|
490
562
|
}
|
|
491
563
|
this._dom.text.innerHTML = text;
|
|
492
564
|
this._s.label = text; // for fast retrieval
|
|
565
|
+
this._dom.button.setAttribute('aria-label', text);
|
|
493
566
|
return this;
|
|
494
567
|
};
|
|
495
568
|
Button.prototype.value = function (val) {
|
|
@@ -563,12 +636,12 @@ var CheckList = /** @class */ (function () {
|
|
|
563
636
|
};
|
|
564
637
|
var selectAllClick = function (e) {
|
|
565
638
|
_this.selectAll();
|
|
566
|
-
_this._s.handler(e, null, _this._s.buttons);
|
|
639
|
+
_this._s.handler(e, null, _this._s.buttons, true);
|
|
567
640
|
_this._updateCount();
|
|
568
641
|
};
|
|
569
642
|
var selectNoneClick = function (e) {
|
|
570
643
|
_this.selectNone();
|
|
571
|
-
_this._s.handler(e, null, _this._s.buttons);
|
|
644
|
+
_this._s.handler(e, null, _this._s.buttons, true);
|
|
572
645
|
_this._updateCount();
|
|
573
646
|
};
|
|
574
647
|
if (opts.search) {
|
|
@@ -600,12 +673,17 @@ var CheckList = /** @class */ (function () {
|
|
|
600
673
|
var btn = new Button(this_1._s.dt)
|
|
601
674
|
.active(option.active || false)
|
|
602
675
|
.handler(function (e) {
|
|
603
|
-
_this._s.handler(e, btn, _this._s.buttons);
|
|
676
|
+
_this._s.handler(e, btn, _this._s.buttons, true);
|
|
604
677
|
_this._updateCount();
|
|
605
678
|
})
|
|
606
679
|
.icon(option.icon || '')
|
|
607
|
-
.text(option.label
|
|
680
|
+
.text(option.label !== ''
|
|
681
|
+
? option.label
|
|
682
|
+
: this_1._s.dt.i18n('columnControl.list.emptyOption', 'Empty'))
|
|
608
683
|
.value(option.value);
|
|
684
|
+
if (option.label === '') {
|
|
685
|
+
btn.className('empty');
|
|
686
|
+
}
|
|
609
687
|
this_1._s.buttons.push(btn);
|
|
610
688
|
};
|
|
611
689
|
var this_1 = this;
|
|
@@ -678,7 +756,7 @@ var CheckList = /** @class */ (function () {
|
|
|
678
756
|
dt.on('cc-search-clear', function (e, colIdx) {
|
|
679
757
|
if (colIdx === parent.idx()) {
|
|
680
758
|
_this.selectNone();
|
|
681
|
-
_this._s.handler(e, null, _this._s.buttons);
|
|
759
|
+
_this._s.handler(e, null, _this._s.buttons, false);
|
|
682
760
|
_this._s.search = '';
|
|
683
761
|
_this._dom.search.value = '';
|
|
684
762
|
_this._redraw();
|
|
@@ -965,7 +1043,7 @@ var order = {
|
|
|
965
1043
|
.icon('orderAsc')
|
|
966
1044
|
.className(config.className);
|
|
967
1045
|
if (!config.statusOnly) {
|
|
968
|
-
dt.order.listener(btn.element(), this.idx(), function () { });
|
|
1046
|
+
dt.order.listener(btn.element(), DataTable.versionCheck('2.3.2') ? function () { return [_this.idx()]; } : this.idx(), function () { });
|
|
969
1047
|
}
|
|
970
1048
|
dt.on('order', function (e, s, order) {
|
|
971
1049
|
var found = order.find(function (o) { return o.col === _this.idx(); });
|
|
@@ -1233,7 +1311,10 @@ var SearchInput = /** @class */ (function () {
|
|
|
1233
1311
|
// Column control search clearing (column().ccSearchClear() method)
|
|
1234
1312
|
dt.on('cc-search-clear', function (e, colIdx) {
|
|
1235
1313
|
if (colIdx === _this._idx) {
|
|
1314
|
+
// Don't want an automatic redraw on this event
|
|
1315
|
+
_this._loadingState = true;
|
|
1236
1316
|
_this.clear();
|
|
1317
|
+
_this._loadingState = false;
|
|
1237
1318
|
}
|
|
1238
1319
|
});
|
|
1239
1320
|
}
|
|
@@ -1430,6 +1511,7 @@ var searchDateTime = {
|
|
|
1430
1511
|
var moment = DataTable.use('moment');
|
|
1431
1512
|
var luxon = DataTable.use('luxon');
|
|
1432
1513
|
var dt = this.dt();
|
|
1514
|
+
var i18nBase = 'columnControl.search.datetime.';
|
|
1433
1515
|
var displayFormat = '';
|
|
1434
1516
|
var dateTime;
|
|
1435
1517
|
var searchInput = new SearchInput(dt, this.idx())
|
|
@@ -1440,12 +1522,12 @@ var searchDateTime = {
|
|
|
1440
1522
|
.title(config.title)
|
|
1441
1523
|
.titleAttr(config.titleAttr)
|
|
1442
1524
|
.options([
|
|
1443
|
-
{ label: 'Equals', value: 'equal' },
|
|
1444
|
-
{ label: 'Does not equal', value: 'notEqual' },
|
|
1445
|
-
{ label: 'After', value: 'greater' },
|
|
1446
|
-
{ label: 'Before', value: 'less' },
|
|
1447
|
-
{ label: 'Empty', value: 'empty' },
|
|
1448
|
-
{ label: 'Not empty', value: 'notEmpty' }
|
|
1525
|
+
{ label: dt.i18n(i18nBase + 'equal', 'Equals'), value: 'equal' },
|
|
1526
|
+
{ label: dt.i18n(i18nBase + 'notEqual', 'Does not equal'), value: 'notEqual' },
|
|
1527
|
+
{ label: dt.i18n(i18nBase + 'greater', 'After'), value: 'greater' },
|
|
1528
|
+
{ label: dt.i18n(i18nBase + 'less', 'Before'), value: 'less' },
|
|
1529
|
+
{ label: dt.i18n(i18nBase + 'empty', 'Empty'), value: 'empty' },
|
|
1530
|
+
{ label: dt.i18n(i18nBase + 'notEmpty', 'Not empty'), value: 'notEmpty' }
|
|
1449
1531
|
])
|
|
1450
1532
|
.search(function (searchType, searchTerm, loadingState) {
|
|
1451
1533
|
var column = dt.column(_this.idx());
|
|
@@ -1498,6 +1580,7 @@ var searchDateTime = {
|
|
|
1498
1580
|
if (DateTime) {
|
|
1499
1581
|
dateTime = new DateTime(searchInput.input(), {
|
|
1500
1582
|
format: displayFormat,
|
|
1583
|
+
i18n: dt.settings()[0].oLanguage.datetime, // could be undefined
|
|
1501
1584
|
onChange: function () {
|
|
1502
1585
|
fromPicker = true;
|
|
1503
1586
|
searchInput.runSearch();
|
|
@@ -1721,12 +1804,14 @@ var searchList = {
|
|
|
1721
1804
|
.title(dt
|
|
1722
1805
|
.i18n('columnControl.searchList', config.title)
|
|
1723
1806
|
.replace('[title]', dt.column(this.idx()).title()))
|
|
1724
|
-
.handler(function (e, btn) {
|
|
1807
|
+
.handler(function (e, btn, btns, redraw) {
|
|
1725
1808
|
if (btn) {
|
|
1726
1809
|
btn.active(!btn.active());
|
|
1727
1810
|
}
|
|
1728
1811
|
applySearch(checkList.values());
|
|
1729
|
-
|
|
1812
|
+
if (redraw) {
|
|
1813
|
+
dt.draw();
|
|
1814
|
+
}
|
|
1730
1815
|
});
|
|
1731
1816
|
if (config.options) {
|
|
1732
1817
|
setOptions(checkList, config.options);
|
|
@@ -1780,6 +1865,7 @@ var searchNumber = {
|
|
|
1780
1865
|
init: function (config) {
|
|
1781
1866
|
var _this = this;
|
|
1782
1867
|
var dt = this.dt();
|
|
1868
|
+
var i18nBase = 'columnControl.search.number.';
|
|
1783
1869
|
var searchInput = new SearchInput(dt, this.idx())
|
|
1784
1870
|
.type('num')
|
|
1785
1871
|
.addClass('dtcc-searchNumber')
|
|
@@ -1788,14 +1874,17 @@ var searchNumber = {
|
|
|
1788
1874
|
.title(config.title)
|
|
1789
1875
|
.titleAttr(config.titleAttr)
|
|
1790
1876
|
.options([
|
|
1791
|
-
{ label: 'Equals', value: 'equal' },
|
|
1792
|
-
{ label: 'Does not equal', value: 'notEqual' },
|
|
1793
|
-
{ label: 'Greater than', value: 'greater' },
|
|
1794
|
-
{
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
{ label: '
|
|
1877
|
+
{ label: dt.i18n(i18nBase + 'equal', 'Equals'), value: 'equal' },
|
|
1878
|
+
{ label: dt.i18n(i18nBase + 'notEqual', 'Does not equal'), value: 'notEqual' },
|
|
1879
|
+
{ label: dt.i18n(i18nBase + 'greater', 'Greater than'), value: 'greater' },
|
|
1880
|
+
{
|
|
1881
|
+
label: dt.i18n(i18nBase + 'greaterOrEqual', 'Greater or equal'),
|
|
1882
|
+
value: 'greaterOrEqual'
|
|
1883
|
+
},
|
|
1884
|
+
{ label: dt.i18n(i18nBase + 'less', 'Less than'), value: 'less' },
|
|
1885
|
+
{ label: dt.i18n(i18nBase + 'lessOrEqual', 'Less or equal'), value: 'lessOrEqual' },
|
|
1886
|
+
{ label: dt.i18n(i18nBase + 'empty', 'Empty'), value: 'empty' },
|
|
1887
|
+
{ label: dt.i18n(i18nBase + 'notEmpty', 'Not empty'), value: 'notEmpty' }
|
|
1799
1888
|
])
|
|
1800
1889
|
.search(function (searchType, searchTerm, loadingState) {
|
|
1801
1890
|
var column = dt.column(_this.idx());
|
|
@@ -1874,6 +1963,7 @@ var searchText = {
|
|
|
1874
1963
|
init: function (config) {
|
|
1875
1964
|
var _this = this;
|
|
1876
1965
|
var dt = this.dt();
|
|
1966
|
+
var i18nBase = 'columnControl.search.text.';
|
|
1877
1967
|
var searchInput = new SearchInput(dt, this.idx())
|
|
1878
1968
|
.addClass('dtcc-searchText')
|
|
1879
1969
|
.clearable(config.clear)
|
|
@@ -1881,14 +1971,17 @@ var searchText = {
|
|
|
1881
1971
|
.title(config.title)
|
|
1882
1972
|
.titleAttr(config.titleAttr)
|
|
1883
1973
|
.options([
|
|
1884
|
-
{ label: 'Contains', value: 'contains' },
|
|
1885
|
-
{
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
{ label: '
|
|
1890
|
-
{ label: '
|
|
1891
|
-
{ label: '
|
|
1974
|
+
{ label: dt.i18n(i18nBase + 'contains', 'Contains'), value: 'contains' },
|
|
1975
|
+
{
|
|
1976
|
+
label: dt.i18n(i18nBase + 'notContains', 'Does not contain'),
|
|
1977
|
+
value: 'notContains'
|
|
1978
|
+
},
|
|
1979
|
+
{ label: dt.i18n(i18nBase + 'equal', 'Equals'), value: 'equal' },
|
|
1980
|
+
{ label: dt.i18n(i18nBase + 'notEqual', 'Does not equal'), value: 'notEqual' },
|
|
1981
|
+
{ label: dt.i18n(i18nBase + 'starts', 'Starts'), value: 'starts' },
|
|
1982
|
+
{ label: dt.i18n(i18nBase + 'ends', 'Ends'), value: 'ends' },
|
|
1983
|
+
{ label: dt.i18n(i18nBase + 'empty', 'Empty'), value: 'empty' },
|
|
1984
|
+
{ label: dt.i18n(i18nBase + 'notEmpty', 'Not empty'), value: 'notEmpty' }
|
|
1892
1985
|
])
|
|
1893
1986
|
.search(function (searchType, searchTerm, loadingState) {
|
|
1894
1987
|
var column = dt.column(_this.idx());
|
|
@@ -2011,7 +2104,7 @@ var searchClear = {
|
|
|
2011
2104
|
.icon(config.icon)
|
|
2012
2105
|
.className(config.className)
|
|
2013
2106
|
.handler(function () {
|
|
2014
|
-
dt.column(_this.idx()).ccSearchClear();
|
|
2107
|
+
dt.column(_this.idx()).ccSearchClear().draw();
|
|
2015
2108
|
})
|
|
2016
2109
|
.enable(false);
|
|
2017
2110
|
dt.on('draw', function () {
|
|
@@ -2062,6 +2155,7 @@ var spacer = {
|
|
|
2062
2155
|
init: function (config) {
|
|
2063
2156
|
var dt = this.dt();
|
|
2064
2157
|
var spacer = createElement('div', config.className, dt.i18n('columnControl.spacer', config.text));
|
|
2158
|
+
spacer.setAttribute('role', 'separator');
|
|
2065
2159
|
return spacer;
|
|
2066
2160
|
}
|
|
2067
2161
|
};
|
|
@@ -2266,7 +2360,7 @@ var ColumnControl = /** @class */ (function () {
|
|
|
2266
2360
|
/** SVG icons that can be used by the content plugins */
|
|
2267
2361
|
ColumnControl.icons = icons;
|
|
2268
2362
|
/** Version */
|
|
2269
|
-
ColumnControl.version = '1.0.
|
|
2363
|
+
ColumnControl.version = '1.0.5';
|
|
2270
2364
|
return ColumnControl;
|
|
2271
2365
|
}());
|
|
2272
2366
|
|
|
@@ -2336,11 +2430,14 @@ $(document).on('preInit.dt', function (e, settings) {
|
|
|
2336
2430
|
DataTable.Api.registerPlural('columns().ccSearchClear()', 'column().ccSearchClear()', function () {
|
|
2337
2431
|
var ctx = this;
|
|
2338
2432
|
return this.iterator('column', function (settings, idx) {
|
|
2433
|
+
// Note that the listeners for this will not redraw the table.
|
|
2339
2434
|
ctx.trigger('cc-search-clear', [idx]);
|
|
2340
2435
|
});
|
|
2341
2436
|
});
|
|
2342
2437
|
DataTable.ext.buttons.ccSearchClear = {
|
|
2343
|
-
text:
|
|
2438
|
+
text: function (dt) {
|
|
2439
|
+
return dt.i18n('columnControl.buttons.searchClear', 'Clear search');
|
|
2440
|
+
},
|
|
2344
2441
|
init: function (dt, node, config) {
|
|
2345
2442
|
var _this = this;
|
|
2346
2443
|
dt.on('draw', function () {
|
|
@@ -2361,6 +2458,7 @@ DataTable.ext.buttons.ccSearchClear = {
|
|
|
2361
2458
|
action: function (e, dt, node, config) {
|
|
2362
2459
|
dt.search('');
|
|
2363
2460
|
dt.columns().ccSearchClear();
|
|
2461
|
+
dt.draw();
|
|
2364
2462
|
}
|
|
2365
2463
|
};
|
|
2366
2464
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/*! ColumnControl 1.0.
|
|
1
|
+
/*! ColumnControl 1.0.5
|
|
2
2
|
* Copyright (c) SpryMedia Ltd - datatables.net/license
|
|
3
3
|
*
|
|
4
4
|
* SVG icons: ISC License
|
|
5
5
|
* Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT).
|
|
6
6
|
* All other copyright (c) for Lucide are held by Lucide Contributors 2022.
|
|
7
7
|
*/
|
|
8
|
-
(n=>{var r,o;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(t){return n(t,window,document)}):"object"==typeof exports?(r=require("jquery"),o=function(t,e){e.fn.dataTable||require("datatables.net")(t,e)},"undefined"==typeof window?module.exports=function(t,e){return t=t||window,e=e||r(t),o(t,e),n(e,0,t.document)}:(o(window,r),module.exports=n(r,window,window.document))):n(jQuery,window,document)})(function(t,I,c){var x=t.fn.dataTable;function _(t,e,n,r){void 0===e&&(e=[]),void 0===n&&(n=null),void 0===r&&(r=[]);var o=c.createElement(t);return i(o,e),n&&(o.innerHTML=n),r.forEach(function(t){o.appendChild(t)}),o}function i(e,t){t&&(t=Array.isArray(t)?t:[t]).forEach(function(t){t&&e.classList.add(t)})}function e(t){return'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">'+t+"</svg>"}var s={chevronRight:e('<path d="m9 18 6-6-6-6"/>'),columns:e('<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/><path d="M15 3v18"/>'),contains:e('<path d="M10 3h4v18h-4z"/><path d="M18 8h3v9h-3"/><path d="M6 17H3V8h3"/>'),empty:e('<circle cx="12" cy="12" r="10"/>'),ends:e('<path d="M21 3h-4v18h4z"/><path d="M13 8H3v9h10"/>'),equal:e('<line x1="5" x2="19" y1="9" y2="9"/><line x1="5" x2="19" y1="15" y2="15"/>'),greater:e('<path d="m9 18 6-6-6-6"/>'),greaterOrEqual:e('<path d="m9 16 6-6-6-6"/><path d="m9 21 6-6"/>'),less:e('<path d="m15 18-6-6 6-6"/>'),lessOrEqual:e('<path d="m15 16-6-6 6-6"/><path d="m15 21-6-6"/>'),menu:e('<line x1="4" x2="20" y1="12" y2="12"/><line x1="4" x2="20" y1="6" y2="6"/><line x1="4" x2="20" y1="18" y2="18"/>'),move:e('<line x1="12" x2="12" y1="3" y2="21"/><polyline points="8 8 4 12 8 16"/><polyline points="16 16 20 12 16 8"/>'),moveLeft:e('<path d="m9 6-6 6 6 6"/><path d="M3 12h14"/><path d="M21 19V5"/>'),moveRight:e('<path d="M3 5v14"/><path d="M21 12H7"/><path d="m15 18 6-6-6-6"/>'),notContains:e('<path d="M15 4 9 20"/><path d="M3 8h18v9H3z"/>'),notEmpty:e('<circle cx="12" cy="12" r="10"/><line x1="9" x2="15" y1="15" y2="9"/>'),notEqual:e('<path d="M5 9h14"/><path d="M5 15h14"/><path d="M15 5 9 19"/>'),orderAddAsc:e('<path d="M17 21v-8"/><path d="M3 4h6"/><path d="M3 8h9"/><path d="M3 12h10"/><path d="M13 17h8"/>'),orderAddDesc:e('<path d="M17 21v-8"/><path d="M3 4h12"/><path d="M3 8h9"/><path d="M3 12h6"/><path d="M13 17h8"/>'),orderAsc:e('<path d="m3 8 4-4 4 4"/><path d="M7 4v16"/><path d="M11 12h4"/><path d="M11 16h7"/><path d="M11 20h10"/>'),orderClear:e('<path d="m21 21-8-8"/><path d="M3 4h12"/><path d="M3 8h9"/><path d="M3 12h6"/><path d="m13 21 8-8"/>'),orderDesc:e('<path d="m3 16 4 4 4-4"/><path d="M7 20V4"/><path d="M11 4h10"/><path d="M11 8h7"/><path d="M11 12h4"/>'),orderRemove:e('<path d="M3 4h12"/><path d="M3 8h9"/><path d="M3 12h6"/><path d="M13 17h8"/>'),orderNone:e('<path d="m3 8 4-4 4 4"/><path d="m11 16-4 4-4-4"/><path d="M7 4v16"/><path d="M15 8h6"/><path d="M15 16h6"/><path d="M13 12h8"/>'),search:e('<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>'),searchClear:e('<path d="m13.5 8.5-5 5"/><path d="m8.5 8.5 5 5"/><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>'),starts:e('<path d="M3 3h4v18H3z"/><path d="M11 8h10v9H11"/>'),tick:e('<path d="M20 6 9 17l-5-5"/>'),x:e('<path d="M18 6 6 18"/><path d="m6 6 12 12"/>')};function l(t,e,n){var e=e.table().container(),r=n.closest("div.dt-column-header"),r=getComputedStyle(r),o=t.offsetWidth,i=((t,e)=>{for(var n=0,r=0;e&&e!==t&&e!==c.body;)n+=e.offsetTop,r+=e.offsetLeft,e.scrollTop&&(r-=e.scrollTop),e.scrollLeft&&(r-=e.scrollLeft),e=e.offsetParent;return{top:n,left:r}})(e,n),a=i.top+n.offsetHeight,r="row-reverse"===r.flexDirection?i.left:i.left-o+n.offsetWidth,i=e.offsetWidth;i<r+o&&(r-=r+o-i),r<0&&(r=0),t.style.top=a+"px",t.style.left=r+"px"}function d(e,t,n){function r(t){e._shown?t.target===e||e.contains(t.target)||(e._close(),c.body.removeEventListener("click",r)):c.body.removeEventListener("click",r)}var o=t.table().container();e._shown=!0,o.append(e),l(e,t,n.element());c.body.addEventListener("click",r)}var u={classes:{container:"dtcc-dropdown",liner:"dtcc-dropdown-liner"},defaults:{className:"dropdown",content:[],icon:"menu",text:"More..."},init:function(e){for(var n=this.dt(),r=_("div",u.classes.container,"",[_("div",u.classes.liner)]),t=(r._shown=!1,r._close=function(){r.remove(),r._shown=!1},r.childNodes[0]),o=new h(n).text(n.i18n("columnControl.dropdown",e.text)).icon(e.icon).className(e.className).dropdownDisplay(t).handler(function(t){t._closed&&t._closed.includes(r)||d(r,n,e._parents?e._parents[0]:o)}),i=0;i<e.content.length;i++){var a=this.resolve(e.content[i]),a=(a.config._parents||(a.config._parents=[]),a.config._parents.push(o),a.plugin.init.call(this,a.config));t.appendChild(a)}return e._parents&&e._parents.length&&o.extra("chevronRight"),n.on("columns-reordered",function(){l(r,n,o.element())}),o.element()}},o=0,h=(n.prototype.active=function(t){return void 0===t?this._s.active:(this._s.active=t,this._checkActive(),this)},n.prototype.activeList=function(t,e){return this._s.activeList[t]=e,this._checkActive(),this},n.prototype.checkDisplay=function(){for(var t=0,e=this._dom.dropdownDisplay.childNodes,n=0;n<e.length;n++)"none"!==e[n].style.display&&t++;return 0===t&&(this._dom.button.style.display="none"),this},n.prototype.className=function(t){return this._dom.button.classList.add("dtcc-button_"+t),this},n.prototype.destroy=function(){this._s.buttonClick&&this._dom.button.removeEventListener("click",this._s.buttonClick),this._s.namespace&&this._s.dt.off("destroy."+this._s.namespace)},n.prototype.dropdownDisplay=function(t){return this._dom.dropdownDisplay=t,this},n.prototype.element=function(){return this._dom.button},n.prototype.enable=function(t){return this._dom.button.classList.toggle("dtcc-button_disabled",!t),this._s.enabled=t,this},n.prototype.extra=function(t){return this._dom.extra.innerHTML=t?s[t]:"",this},n.prototype.handler=function(n){function t(t){var e;void 0===(e=t)&&(e=null),c.querySelectorAll("div.dtcc-dropdown").forEach(function(t){null!==e&&t.contains(e.target)||(t._close(),e._closed||(e._closed=[]),e._closed.push(t))}),t.stopPropagation(),t.preventDefault(),r._s.enabled&&n(t)}var r=this;return this._s.buttonClick=t,this._s.namespace="dtcc-"+o++,this._dom.button.addEventListener("click",t),this._s.dt.on("destroy."+this._s.namespace,function(){r.destroy()}),this},n.prototype.icon=function(t){return this._dom.icon.innerHTML=t?s[t]:"",this},n.prototype.text=function(t){return void 0===t?this._s.label:(this._dom.text.innerHTML=t,this._s.label=t,this)},n.prototype.value=function(t){return void 0===t?this._s.value:(this._s.value=t,this)},n.prototype._checkActive=function(){return!0===this._s.active||Object.values(this._s.activeList).includes(!0)?(this._dom.state.innerHTML=s.tick,this._dom.button.classList.add("dtcc-button_active")):(this._dom.state.innerHTML="",this._dom.button.classList.remove("dtcc-button_active")),this},n.classes={container:"dtcc-button"},n);function n(t){this._s={active:!1,activeList:[],buttonClick:null,dt:null,enabled:!0,label:"",namespace:"",value:null},this._s.dt=t,this._dom={button:_("button",n.classes.container),dropdownDisplay:null,extra:_("span","dtcc-button-extra"),icon:_("span","dtcc-button-icon"),state:_("span","dtcc-button-state"),text:_("span","dtcc-button-text")},this._dom.button.append(this._dom.icon),this._dom.button.append(this._dom.text),this._dom.button.append(this._dom.state),this._dom.button.append(this._dom.extra),this.enable(!0)}f.prototype.add=function(n,t){for(var r=this,o=(Array.isArray(n)||(n=[n]),this),e=0;e<n.length;e++)(t=>{var t=n[t],e=new h(o._s.dt).active(t.active||!1).handler(function(t){r._s.handler(t,e,r._s.buttons),r._updateCount()}).icon(t.icon||"").text(t.label).value(t.value);o._s.buttons.push(e)})(e);var i=this._s.buttons.length;return!0!==t&&void 0!==t||(this._dom.selectAllCount.innerHTML=i?"("+i+")":"",this._redraw()),this},f.prototype.button=function(t){for(var e=this._s.buttons,n=0;n<e.length;n++)if(e[n].value()===t)return e[n];return null},f.prototype.clear=function(){for(var t=0;t<this._s.buttons.length;t++)this._s.buttons[t].destroy();return this._dom.buttons.replaceChildren(),this._s.buttons.length=0,this},f.prototype.element=function(){return this._dom.container},f.prototype.handler=function(t){return this._s.handler=t,this},f.prototype.searchListener=function(t,n){var r=this;return t.on("cc-search-clear",function(t,e){e===n.idx()&&(r.selectNone(),r._s.handler(t,null,r._s.buttons),r._s.search="",r._dom.search.value="",r._redraw(),r._updateCount())}),this},f.prototype.selectAll=function(){for(var t=0;t<this._s.buttons.length;t++)this._s.buttons[t].active(!0);return this},f.prototype.selectNone=function(){for(var t=0;t<this._s.buttons.length;t++)this._s.buttons[t].active(!1);return this},f.prototype.title=function(t){return this._dom.title.innerHTML=t,this},f.prototype.values=function(t){var e,n=[],r=this._s.buttons;if(void 0!==t){for(e=0;e<r.length;e++)t.includes(r[e].value())&&r[e].active(!0);return this._updateCount(),this}for(e=0;e<r.length;e++)r[e].active()&&n.push(r[e].value());return n},f.prototype._updateCount=function(){var t=this.values().length;this._dom.selectNoneCount.innerHTML=t?"("+t+")":""},f.prototype._redraw=function(){var t=this._s.buttons,e=this._dom.buttons,n=this._s.search.toLowerCase();e.replaceChildren();for(var r=0;r<t.length;r++){var o=t[r];n&&!o.text().toLowerCase().includes(n)||e.appendChild(o.element())}},f.classes={container:"dtcc-list",input:"dtcc-list-search"};var p=f;function f(t,e){function n(){i._s.search=a.search.value,i._redraw()}function r(t){i.selectAll(),i._s.handler(t,null,i._s.buttons),i._updateCount()}function o(t){i.selectNone(),i._s.handler(t,null,i._s.buttons),i._updateCount()}var i=this,a=(this._s={buttons:[],dt:null,handler:function(){},search:""},this._s.dt=t,this._dom={buttons:_("div","dtcc-list-buttons"),container:_("div",f.classes.container),controls:_("div","dtcc-list-controls"),title:_("div","dtcc-list-title"),selectAll:_("button","dtcc-list-selectAll",t.i18n("columnControl.list.all","Select all")),selectAllCount:_("span"),selectNone:_("button","dtcc-list-selectNone",t.i18n("columnControl.list.none","Deselect")),selectNoneCount:_("span"),search:_("input",f.classes.input)},this._dom);a.search.setAttribute("type","text"),a.container.append(a.title),a.container.append(a.controls),a.container.append(a.buttons),e.select&&(a.controls.append(a.selectAll),a.controls.append(a.selectNone),a.selectAll.append(a.selectAllCount),a.selectNone.append(a.selectNoneCount));e.search&&(a.controls.append(a.search),a.search.setAttribute("placeholder",t.i18n("columnControl.list.search","Search...")),a.search.addEventListener("input",n)),a.selectAll.addEventListener("click",r),a.selectNone.addEventListener("click",o),t.on("destroy",function(){a.selectAll.removeEventListener("click",r),a.selectNone.removeEventListener("click",o),a.search.removeEventListener("input",n)})}var r={defaults:{className:"colVis",columns:"",search:!1,select:!1,title:"Column visibility"},init:function(t){function n(){o.columns(t.columns).every(function(){i.add({active:this.visible(),label:this.title(),value:this.index()})})}var o=this.dt(),i=new p(o,{search:t.search,select:t.select}).title(o.i18n("columnControl.colVis",t.title)).handler(function(t,e,n){e&&e.active(!e.active()),r(n)}),r=function(t){for(var e=0;e<t.length;e++){var n=t[e],r=n.value(),r=o.column(r);n.active()&&!r.visible()?r.visible(!0):!n.active()&&r.visible()&&r.visible(!1)}};return n(),o.on("column-visibility",function(t,e,n,r){n=i.button(n);n&&n.active(r)}),o.on("columns-reordered",function(t,e){i.clear(),n()}),i.element()}},a={defaults:{className:"colVis",columns:"",search:!1,select:!1,text:"Column visibility",title:"Column visibility"},extend:function(t){return{extend:"dropdown",icon:"columns",text:this.dt().i18n("columnControl.colVisDropdown",t.text),content:[Object.assign(t,{extend:"colVis"})]}}},m={defaults:{className:"reorder",icon:"move",text:"Reorder columns"},init:function(t){var n=this,e=this.dt(),r=new h(e).text(e.i18n("columnControl.reorder",t.text)).icon(t.icon).className(t.className).handler(function(){var t=n.idx();0<t&&e.colReorder.move(t,t-1)});return 0===this.idx()&&r.enable(!1),e.on("columns-reordered",function(t,e){r.enable(0<n.idx())}),e.init().colReorder||new x.ColReorder(e,{}),r.element()}},R={defaults:{className:"reorderLeft",icon:"moveLeft",text:"Move column left"},init:function(t){var n=this,e=this.dt(),r=new h(e).text(e.i18n("columnControl.reorderLeft",t.text)).icon(t.icon).className(t.className).handler(function(){var t=n.idx();0<t&&e.colReorder.move(t,t-1)});return 0===this.idx()&&r.enable(!1),e.on("columns-reordered",function(t,e){r.enable(0<n.idx())}),r.element()}},H={defaults:{className:"reorderRight",icon:"moveRight",text:"Move column right"},init:function(t){var n=this,r=this.dt(),o=new h(r).text(r.i18n("columnControl.reorderRight",t.text)).icon(t.icon).className(t.className).handler(function(){var t=n.idx();t<r.columns().count()-1&&r.colReorder.move(t,t+1)});return this.idx()===r.columns().count()-1&&o.enable(!1),r.on("columns-reordered",function(t,e){o.enable(n.idx()<r.columns().count()-1)}),o.element()}},V={defaults:{className:"order",iconAsc:"orderAsc",iconDesc:"orderDesc",iconNone:"orderNone",statusOnly:!1,text:"Toggle ordering"},init:function(r){var o=this,t=this.dt(),i=new h(t).text(t.i18n("columnControl.order",r.text)).icon("orderAsc").className(r.className);return r.statusOnly||t.order.listener(i.element(),this.idx(),function(){}),t.on("order",function(t,e,n){n=n.find(function(t){return t.col===o.idx()});n?"asc"===n.dir?i.active(!0).icon(r.iconAsc):"desc"===n.dir&&i.active(!0).icon(r.iconDesc):i.active(!1).icon(r.iconNone)}),i.element()}},Y={defaults:{className:"orderAddAsc",icon:"orderAddAsc",text:"Add Sort Ascending"},init:function(t){var r=this,e=this.dt(),o=new h(e).text(e.i18n("columnControl.orderAddAsc",t.text)).icon(t.icon).className(t.className).handler(function(){e.order().push([r.idx(),"asc"]),e.draw()});return e.on("order",function(t,e,n){n=n.some(function(t){return t.col===r.idx()});o.enable(!n)}),o.element()}},W={defaults:{className:"orderAddDesc",icon:"orderAddDesc",text:"Add Sort Descending"},init:function(t){var r=this,e=this.dt(),o=new h(e).text(e.i18n("columnControl.orderAddDesc",t.text)).icon(t.icon).className(t.className).handler(function(){e.order().push([r.idx(),"desc"]),e.draw()});return e.on("order",function(t,e,n){n=n.some(function(t){return t.col===r.idx()});o.enable(!n)}),o.element()}},B={defaults:{className:"orderAsc",icon:"orderAsc",text:"Sort Ascending"},init:function(t){var r=this,e=this.dt(),o=new h(e).text(e.i18n("columnControl.orderAsc",t.text)).icon(t.icon).className(t.className).handler(function(){r.dt().order([{idx:r.idx(),dir:"asc"}]).draw()});return e.on("order",function(t,e,n){n=n.some(function(t){return t.col===r.idx()&&"asc"===t.dir});o.active(n)}),o.element()}},P={defaults:{className:"orderClear",icon:"orderClear",text:"Clear sort"},init:function(t){var e=this.dt(),r=new h(e).text(e.i18n("columnControl.orderClear",t.text)).icon(t.icon).className(t.className).handler(function(){e.order([]).draw()});return e.on("order",function(t,e,n){r.enable(0<n.length)}),0===e.order().length&&r.enable(!1),r.element()}},z={defaults:{className:"orderDesc",icon:"orderDesc",text:"Sort Descending"},init:function(t){var r=this,e=this.dt(),o=new h(e).text(e.i18n("columnControl.orderDesc",t.text)).icon(t.icon).className(t.className).handler(function(){r.dt().order([{idx:r.idx(),dir:"desc"}]).draw()});return e.on("order",function(t,e,n){n=n.some(function(t){return t.col===r.idx()&&"desc"===t.dir});o.active(n)}),o.element()}},F={defaults:{className:"orderRemove",icon:"orderRemove",text:"Remove from sort"},init:function(t){var r=this,n=this.dt(),o=new h(n).text(n.i18n("columnControl.orderRemove",t.text)).icon(t.icon).className(t.className).handler(function(){var t=n.order(),e=t.findIndex(function(t){return t[0]===r.idx()});t.splice(e,1),n.order(t).draw()});return n.on("order",function(t,e,n){n=n.some(function(t){return t.col===r.idx()});o.enable(n)}),o.enable(!1),o.element()}},G={defaults:{className:"order",iconAsc:"orderAsc",iconDesc:"orderDesc",iconNone:"orderNone",statusOnly:!0,text:"Sort status"},extend:function(t){return Object.assign(t,{extend:"order"})}},v=(y.prototype.addClass=function(t){return this._dom.container.classList.add(t),this},y.prototype.clear=function(){return this.set(this._dom.select.children[0].getAttribute("value"),""),this},y.prototype.clearable=function(t){return t||this._dom.clear.remove(),this},y.prototype.element=function(){return this._dom.container},y.prototype.input=function(){return this._dom.input},y.prototype.options=function(t){for(var e=this._dom.select,n=0;n<t.length;n++)e.add(new Option(t[n].label,t[n].value));return this._dom.typeIcon.innerHTML=s[t[0].value],this},y.prototype.placeholder=function(t){var e;return t&&(e=this._dt.column(this._idx).title(),this._dom.input.placeholder=t.replace("[title]",e)),this},y.prototype.runSearch=function(){var t=this._dom,e="empty"===t.select.value||"notEmpty"===t.select.value||""!==t.input.value;t.container.classList.toggle("dtcc-search_active",e),!this._search||this._lastValue===t.input.value&&this._lastType===t.select.value||(this._search(t.select.value,t.input.value,this._loadingState),this._lastValue=t.input.value,this._lastType=t.select.value)},y.prototype.search=function(t){return this._search=t,this._stateLoad(this._dt.state.loaded()),this},y.prototype.set=function(t,e){var n=this._dom;return n.input.value=e,n.select.value=t,n.typeIcon.innerHTML=s[n.select.value],this.runSearch(),this},y.prototype.title=function(t){var e;return t&&(e=this._dt.column(this._idx).title(),this._dom.title.innerHTML=t.replace("[title]",e)),this},y.prototype.titleAttr=function(t){var e;return t&&(e=this._dt.column(this._idx).title(),this._dom.input.title=t.replace("[title]",e)),this},y.prototype.type=function(t){return this._type=t,this},y.prototype._stateLoad=function(t){var e=this._dom,n=this._idx,n=null==(t=null==(t=null==t?void 0:t.columnControl)?void 0:t[n])?void 0:t.searchInput;n&&(this._loadingState=!0,e.select.value=n.logic,e.input.value=n.value,e.select.dispatchEvent(new Event("input")),this._loadingState=!1)},y.classes={container:["dtcc-content","dtcc-search"],input:"",select:""},y);function y(n,r){function t(){i.runSearch()}function e(){a.typeIcon.innerHTML=s[a.select.value],i.runSearch()}function o(){i.clear()}var i=this,a=(this._type="text",this._dt=n,this._idx=r,this._dom={clear:_("span","dtcc-search-clear",s.x),container:_("div",y.classes.container),typeIcon:_("div","dtcc-search-type-icon"),searchIcon:_("div","dtcc-search-icon",s.search),input:_("input",y.classes.input),inputs:_("div"),select:_("select",y.classes.select),title:_("div","dtcc-search-title")},this._dom),c=r;a.input.setAttribute("type","text"),a.container.append(a.title,a.inputs),a.inputs.append(a.typeIcon,a.select,a.searchIcon,a.clear,a.input);a.input.addEventListener("input",t),a.select.addEventListener("input",e),a.clear.addEventListener("click",o),n.on("destroy",function(){a.input.removeEventListener("input",t),a.select.removeEventListener("input",e),a.clear.removeEventListener("click",o)}),n.on("stateSaveParams",function(t,e,n){n.columnControl||(n.columnControl={}),n.columnControl[r]||(n.columnControl[r]={}),n.columnControl[r].searchInput={logic:a.select.value,type:i._type,value:a.input.value}}),n.on("stateLoaded",function(t,e,n){i._stateLoad(n)}),n.on("columns-reordered",function(t,e){i._idx=n.colReorder.transpose(c,"fromOriginal")}),n.on("cc-search-clear",function(t,e){e===i._idx&&i.clear()})}var b={defaults:{clear:!0,placeholder:"",title:"",titleAttr:""},init:function(i){var a,c=this,s=!1,l=x.use("moment"),d=x.use("luxon"),u=this.dt(),h="",e=new v(u,this.idx()).type("date").addClass("dtcc-searchDateTime").clearable(i.clear).placeholder(i.placeholder).title(i.title).titleAttr(i.titleAttr).options([{label:"Equals",value:"equal"},{label:"Does not equal",value:"notEqual"},{label:"After",value:"greater"},{label:"Before",value:"less"},{label:"Empty",value:"empty"},{label:"Not empty",value:"notEmpty"}]).search(function(t,e,n){var r=u.column(c.idx()),o=""===e?"":g(a&&s?a.val():e.trim(),h,l,d);if("empty"===t)r.search.fixed("dtcc",function(t){return!t});else if("notEmpty"===t)r.search.fixed("dtcc",function(t){return!!t});else{if(""===r.search.fixed("dtcc")&&""===o)return;o?"equal"===t?r.search.fixed("dtcc",function(t){return g(t,h,l,d)==o}):"notEqual"===t?r.search.fixed("dtcc",function(t){return g(t,h,l,d)!=o}):"greater"===t?r.search.fixed("dtcc",function(t){return g(t,h,l,d)>o}):"less"===t&&r.search.fixed("dtcc",function(t){return g(t,h,l,d)<o}):r.search.fixed("dtcc","")}i._parents&&i._parents.forEach(function(t){return t.activeList(c.unique(),!!r.search.fixed("dtcc"))}),n||r.draw()});return u.ready(function(){var t=x.use("datetime");h=((t,e)=>{if(t=t.column(e).type())if("datetime"===t){var e=x.use("moment"),n=x.use("luxon");if(e)return e().creationData().locale._longDateFormat.L;if(n)return n.DateTime.fromISO("1999-08-07").toLocaleString().replace("07","dd").replace("7","d").replace("08","MM").replace("8","M").replace("1999","yyyy").replace("99","yy")}else{if(t.includes("datetime-"))return t.replace(/datetime-/g,"");if(t.includes("moment"))return t.replace(/moment-/g,"");if(t.includes("luxon"))return t.replace(/luxon-/g,"")}return"YYYY-MM-DD"})(u,c.idx()),t&&(a=new t(e.input(),{format:h,onChange:function(){s=!0,e.runSearch(),s=!1}}))}),e.element()}};function g(t,e,n,r){return""===t?"":t instanceof Date?t.getTime():"YYYY-MM-DD"!==e&&(n||r)?n?1e3*n(t,e).unix():r.DateTime.fromFormat(t,e).toMillis():new Date(t).getTime()}function w(t,e){var n=t.values();t.clear();for(var r=0;r<e.length;r++)"object"==typeof e[r]?t.add({active:!1,label:e[r].label,value:e[r].value},r===e.length-1):t.add({active:!1,label:e[r],value:e[r]},r===e.length-1);n.length&&t.values(n)}function C(t,e){t=null==(e=null==(e=null==e?void 0:e.columnControl)?void 0:e[t])?void 0:e.searchList;if(t)return t}function A(t,e){var n=null==(n=t.ajax.json())?void 0:n.columnControl,t=t.column(e),r=t.name(),t=t.dataSrc();return n&&n[r]?n[r]:n&&"string"==typeof t&&n[t]?n[t]:n&&n[e]?n[e]:null}function L(t,e,n,r,o){var i=null==(i=t.ajax.json())?void 0:i.columnControl,a=[],c=A(t,n);if(c)a=c;else{if(i&&e.ajaxOnly)return r.element().style.display="none",void(e._parents&&e._parents.forEach(function(t){return t.checkDisplay()}));for(var s={},l=t.rows({order:n}).indexes().toArray(),d=t.settings()[0],u=0;u<l.length;u++){var h=d.fastData(l[u],n,"filter");s[h]||(s[h]=!0,a.push({label:d.fastData(l[u],n,"display"),value:h}))}}w(r,a),o&&r.values(o)}var M={defaults:{ajaxOnly:!0,className:"searchList",options:null,search:!0,select:!0,title:""},init:function(r){function n(e){var t=a.column(o.idx());e&&(0===e.length?t.search.fixed("dtcc-list",""):t.search.fixed("dtcc-list",function(t){return e.includes(t)}),r._parents)&&r._parents.forEach(function(t){return t.activeList(o.unique(),!!e.length)})}var o=this,i=null,a=this.dt(),c=new p(a,{search:r.search,select:r.select}).searchListener(a,this).title(a.i18n("columnControl.searchList",r.title).replace("[title]",a.column(this.idx()).title())).handler(function(t,e){e&&e.active(!e.active()),n(c.values()),a.draw()});return r.options?w(c,r.options):a.ready(function(){L(a,r,o.idx(),c,i)}),a.on("xhr",function(t,e,n){L(a,r,o.idx(),c,i)}),a.on("stateLoaded",function(t,e,n){n=C(o.idx(),n);n&&c.values(n)}),a.on("stateSaveParams",function(t,e,n){var r=o.idx();n.columnControl||(n.columnControl={}),n.columnControl[r]||(n.columnControl[r]={}),n.columnControl[r].searchList=a.ready()?c.values():i}),i=C(this.idx(),a.state.loaded()),n(i),c.element()}},N={defaults:{clear:!0,placeholder:"",title:"",titleAttr:""},init:function(o){var i=this,a=this.dt(),t=new v(a,this.idx()).type("num").addClass("dtcc-searchNumber").clearable(o.clear).placeholder(o.placeholder).title(o.title).titleAttr(o.titleAttr).options([{label:"Equals",value:"equal"},{label:"Does not equal",value:"notEqual"},{label:"Greater than",value:"greater"},{label:"Greater or equal",value:"greaterOrEqual"},{label:"Less than",value:"less"},{label:"Less or equal",value:"lessOrEqual"},{label:"Empty",value:"empty"},{label:"Not empty",value:"notEmpty"}]).search(function(t,e,n){var r=a.column(i.idx());if("empty"===t)r.search.fixed("dtcc",function(t){return!t});else if("notEmpty"===t)r.search.fixed("dtcc",function(t){return!!t});else{if(""===r.search.fixed("dtcc")&&""===e)return;""===e?r.search.fixed("dtcc",""):"equal"===t?r.search.fixed("dtcc",function(t){return E(t)==e}):"notEqual"===t?r.search.fixed("dtcc",function(t){return E(t)!=e}):"greater"===t?r.search.fixed("dtcc",function(t){return E(t)>e}):"greaterOrEqual"===t?r.search.fixed("dtcc",function(t){return E(t)>=e}):"less"===t?r.search.fixed("dtcc",function(t){return E(t)<e}):"lessOrEqual"===t&&r.search.fixed("dtcc",function(t){return E(t)<=e})}o._parents&&o._parents.forEach(function(t){return t.activeList(i.unique(),!!r.search.fixed("dtcc"))}),n||r.draw()});return t.input().setAttribute("inputmode","numeric"),t.input().setAttribute("pattern","[0-9]*"),t.element()}},Q=/<([^>]*>)/g,U=/['\u00A0,$£€¥%\u2009\u202F\u20BD\u20a9\u20BArfkɃΞ]/gi;function E(t){var e;return 0===t||t&&"-"!==t?"number"==(e=typeof t)||"bigint"==e?t:+(t=t.replace?t.replace(Q,"").replace(U,""):t):-1/0}var D={defaults:{clear:!0,placeholder:"",title:"",titleAttr:""},init:function(o){var i=this,a=this.dt();return new v(a,this.idx()).addClass("dtcc-searchText").clearable(o.clear).placeholder(o.placeholder).title(o.title).titleAttr(o.titleAttr).options([{label:"Contains",value:"contains"},{label:"Does not contain",value:"notContains"},{label:"Equals",value:"equal"},{label:"Does not equal",value:"notEqual"},{label:"Starts",value:"starts"},{label:"Ends",value:"ends"},{label:"Empty",value:"empty"},{label:"Not empty",value:"notEmpty"}]).search(function(t,e,n){var r=a.column(i.idx());if(e=e.toLowerCase(),"empty"===t)r.search.fixed("dtcc",function(t){return!t});else if("notEmpty"===t)r.search.fixed("dtcc",function(t){return!!t});else{if(""===r.search.fixed("dtcc")&&""===e)return;""===e?r.search.fixed("dtcc",""):"equal"===t?r.search.fixed("dtcc",function(t){return t.toLowerCase()==e}):"notEqual"===t?r.search.fixed("dtcc",function(t){return t.toLowerCase()!=e}):"contains"===t?r.search.fixed("dtcc",e):"notContains"===t?r.search.fixed("dtcc",function(t){return!t.toLowerCase().includes(e)}):"starts"===t?r.search.fixed("dtcc",function(t){return t.toLowerCase().startsWith(e)}):"ends"===t&&r.search.fixed("dtcc",function(t){return t.toLowerCase().endsWith(e)})}o._parents&&o._parents.forEach(function(t){return t.activeList(i.unique(),!!r.search.fixed("dtcc"))}),n||r.draw()}).element()}},r={colVis:r,colVisDropdown:a,dropdown:u,reorder:m,reorderLeft:R,reorderRight:H,order:V,orderAddAsc:Y,orderAddDesc:W,orderAsc:B,orderClear:P,orderDesc:z,orderRemove:F,orderStatus:G,search:{defaults:{allowSearchList:!1},init:function(n){function e(t){var e=A(i,a);return n.allowSearchList&&e?M.init.call(o,Object.assign({},M.defaults,n)):"date"===t||t.startsWith("datetime")?b.init.call(o,Object.assign({},b.defaults,n)):t.includes("num")?N.init.call(o,Object.assign({},N.defaults,n)):D.init.call(o,Object.assign({},D.defaults,n))}var r,o=this,i=this.dt(),a=this.idx(),t=null==(t=null==(t=null==(t=i.state.loaded())?void 0:t.columnControl)?void 0:t[a])?void 0:t.searchInput;return t?r=e(t.type):(r=c.createElement("div"),i.ready(function(){var t=i.column(a),t=e(t.type());r.replaceWith(t)})),r}},searchClear:{defaults:{className:"searchClear",icon:"searchClear",text:"Clear Search"},init:function(t){var n=this,r=this.dt(),o=new h(r).text(r.i18n("columnControl.searchClear",t.text)).icon(t.icon).className(t.className).handler(function(){r.column(n.idx()).ccSearchClear()}).enable(!1);return r.on("draw",function(){var t=r.column(n.idx()).search.fixed("dtcc"),e=r.column(n.idx()).search.fixed("dtcc-list");o.enable(!(!t&&!e))}),o.element()}},searchDropdown:{defaults:{ajaxOnly:!0,allowSearchList:!0,className:"searchDropdown",clear:!0,columns:"",options:null,placeholder:"",search:!0,select:!0,text:"Search",title:"",titleAttr:""},extend:function(t){return{extend:"dropdown",icon:"search",text:this.dt().i18n("columnControl.searchDropdown",t.text),content:[Object.assign(t,{extend:"search"})]}}},searchDateTime:b,searchList:M,searchNumber:N,searchText:D,spacer:{defaults:{className:"dtcc-spacer",text:""},init:function(t){var e=this.dt();return _("div",t.className,e.i18n("columnControl.spacer",t.text))}},title:{defaults:{className:"dtcc-title",text:null},init:function(t){var e=this.dt().column(this.idx()).title(),n=null===t.text?"[title]":t.text;return _("div",t.className,n.replace("[title]",e))}}},q=(S.prototype.dt=function(){return this._dt},S.prototype.idx=function(){return this._s.columnIdx},S.prototype.resolve=function(t){var e=null,n=null,r=null;if("string"==typeof t?(e=S.content[r=t],n=Object.assign({},null==e?void 0:e.defaults)):Array.isArray(t)?(e=S.content[r="dropdown"],n=Object.assign({},null==e?void 0:e.defaults,{content:t})):t.extend&&(r=t.extend,e=S.content[r],n=Object.assign({},null==e?void 0:e.defaults,t)),e)return e.extend?(t=e.extend.call(this,n),this.resolve(t)):{config:n,type:r,plugin:e};throw new Error("Unknown ColumnControl content type: "+r)},S.prototype.unique=function(){return this._s.unique},S.prototype._target=function(){var t,e,n=this._c.target,r=this._dt.column(this._s.columnIdx),o="header";return"number"==typeof n?t=r.header(n):(e="tfoot"!==(n=n.split(":"))[0],n=n[1]?parseInt(n[1]):0,e?t=r.header(n):(t=r.footer(n),o="footer")),t.querySelector("div.dt-column-"+o)},S.Button=h,S.CheckList=p,S.SearchInput=v,S.content=r,S.defaults={className:"",content:null,target:0},S.icons=s,S.version="1.0.3",S);function S(n,t,e){var r=this,o=(this._dom={target:null,wrapper:null},this._c={},this._s={columnIdx:null,unique:null},this._dt=n,this._s.columnIdx=t,this._s.unique=Math.random(),t);Object.assign(this._c,S.defaults,e),this._dom.target=this._target(),e.className&&i(this._dom.target.closest("tr"),e.className),this._c.content&&(n.on("columns-reordered",function(t,e){r._s.columnIdx=n.colReorder.transpose(o,"fromOriginal")}),this._dom.wrapper=c.createElement("span"),this._dom.wrapper.classList.add("dtcc"),this._dom.target.appendChild(this._dom.wrapper),this._c.content.forEach(function(t){t=r.resolve(t),t=t.plugin.init.call(r,t.config);r._dom.wrapper.appendChild(t)}),n.on("destroy",function(){r._dom.wrapper.remove()}))}function j(t,e){var n=q.defaults.target;if(T(e)){if(n===t)return{target:n,content:e}}else if(Array.isArray(e))for(var r=0;r<e.length;r++){var o=e[r];if(T(o)){if(n===t)return{target:n,content:o}}else if(O(o)){if(t===(void 0!==o.target?o.target:n))return o}else if(t===n)return{target:n,content:e}}else if("object"==typeof e)if(O(e)){if(t===(void 0!==e.target?e.target:n))return e}else if(t===n)return{target:n,content:e}}function k(e,t){function n(t){e.includes(t)||e.push(t)}return Array.isArray(t)?t.forEach(function(t){n(("object"==typeof t&&void 0!==t.target?t:q.defaults).target)}):"object"==typeof t&&n((void 0!==t.target?t:q.defaults).target),e}function O(t){return"object"==typeof t&&void 0!==t.target}function T(t){var e=!1;if(Array.isArray(t)){for(var n=0;n<t.length;n++)if(O(t[n])){e=!0;break}return!e}}return x.ColumnControl=q,t(c).on("i18n.dt",function(t,e){if("dt"===t.namespace){var n=new x.Api(e),t=n.table().header(),r=e.oInit.columnControl,o=q.defaults,i=[],a={};t.querySelectorAll("tr").length<=1&&null===e.titleRow&&(e.titleRow=0),k(i,r),k(i,o),n.columns().every(function(t){var e=this.init().columnControl;k(i,e)});for(var c=0;c<i.length;c++){v=m=f=p=h=u=d=l=s=void 0;var s=a,l=i[c],d=n;if(!s[l]){var u=!0,h=0,p=("number"==typeof l?h=l:("tfoot"===(p=l.split(":"))[0]&&(u=!1),p[1]&&(h=parseInt(p[1]))),u?d.table().header():d.table().footer());if(!p.querySelectorAll("tr")[h]){var f=d.columns().count(),m=_("tr");m.setAttribute("data-dt-order","disable");for(var v=0;v<f;v++)m.appendChild(_("td"));p.appendChild(m)}s[l]=!0}}}}),t(c).on("preInit.dt",function(t,e){var c,s,l,d;"dt"===t.namespace&&(c=new x.Api(e),s=e.oInit.columnControl,l=q.defaults,k(d=[],s),k(d,l),c.columns().every(function(t){for(var e=this.init().columnControl,n=k(d.slice(),e),r=0;r<n.length;r++){var o=j(n[r],e),i=j(n[r],s),a=j(n[r],l);(a||i||o)&&new q(c,this.index(),Object.assign({},a||{},i||{},o||{}))}}))}),x.Api.registerPlural("columns().ccSearchClear()","column().ccSearchClear()",function(){var n=this;return this.iterator("column",function(t,e){n.trigger("cc-search-clear",[e])})}),x.ext.buttons.ccSearchClear={text:"Clear search",init:function(n,t,e){var r=this;n.on("draw",function(){var t=!1,e=!!n.search();e||n.columns().every(function(){(this.search.fixed("dtcc")||this.search.fixed("dtcc-list"))&&(t=!0)}),r.enable(e||t)}),this.enable(!1)},action:function(t,e,n,r){e.search(""),e.columns().ccSearchClear()}},x});
|
|
8
|
+
(n=>{var r,o;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(t){return n(t,window,document)}):"object"==typeof exports?(r=require("jquery"),o=function(t,e){e.fn.dataTable||require("datatables.net")(t,e)},"undefined"==typeof window?module.exports=function(t,e){return t=t||window,e=e||r(t),o(t,e),n(e,0,t.document)}:(o(window,r),module.exports=n(r,window,window.document))):n(jQuery,window,document)})(function(t,I,d){var x=t.fn.dataTable;function y(t,e,n,r){void 0===e&&(e=[]),void 0===n&&(n=null),void 0===r&&(r=[]);var o=d.createElement(t);return i(o,e),n&&(o.innerHTML=n),r.forEach(function(t){o.appendChild(t)}),o}function i(e,t){t&&(t=Array.isArray(t)?t:[t]).forEach(function(t){e&&t&&e.classList.add(t)})}function e(t){return'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">'+t+"</svg>"}var c={chevronRight:e('<path d="m9 18 6-6-6-6"/>'),columns:e('<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/><path d="M15 3v18"/>'),contains:e('<path d="M10 3h4v18h-4z"/><path d="M18 8h3v9h-3"/><path d="M6 17H3V8h3"/>'),empty:e('<circle cx="12" cy="12" r="10"/>'),ends:e('<path d="M21 3h-4v18h4z"/><path d="M13 8H3v9h10"/>'),equal:e('<line x1="5" x2="19" y1="9" y2="9"/><line x1="5" x2="19" y1="15" y2="15"/>'),greater:e('<path d="m9 18 6-6-6-6"/>'),greaterOrEqual:e('<path d="m9 16 6-6-6-6"/><path d="m9 21 6-6"/>'),less:e('<path d="m15 18-6-6 6-6"/>'),lessOrEqual:e('<path d="m15 16-6-6 6-6"/><path d="m15 21-6-6"/>'),menu:e('<line x1="4" x2="20" y1="12" y2="12"/><line x1="4" x2="20" y1="6" y2="6"/><line x1="4" x2="20" y1="18" y2="18"/>'),move:e('<line x1="12" x2="12" y1="3" y2="21"/><polyline points="8 8 4 12 8 16"/><polyline points="16 16 20 12 16 8"/>'),moveLeft:e('<path d="m9 6-6 6 6 6"/><path d="M3 12h14"/><path d="M21 19V5"/>'),moveRight:e('<path d="M3 5v14"/><path d="M21 12H7"/><path d="m15 18 6-6-6-6"/>'),notContains:e('<path d="M15 4 9 20"/><path d="M3 8h18v9H3z"/>'),notEmpty:e('<circle cx="12" cy="12" r="10"/><line x1="9" x2="15" y1="15" y2="9"/>'),notEqual:e('<path d="M5 9h14"/><path d="M5 15h14"/><path d="M15 5 9 19"/>'),orderAddAsc:e('<path d="M17 21v-8"/><path d="M3 4h6"/><path d="M3 8h9"/><path d="M3 12h10"/><path d="M13 17h8"/>'),orderAddDesc:e('<path d="M17 21v-8"/><path d="M3 4h12"/><path d="M3 8h9"/><path d="M3 12h6"/><path d="M13 17h8"/>'),orderAsc:e('<path d="m3 8 4-4 4 4"/><path d="M7 4v16"/><path d="M11 12h4"/><path d="M11 16h7"/><path d="M11 20h10"/>'),orderClear:e('<path d="m21 21-8-8"/><path d="M3 4h12"/><path d="M3 8h9"/><path d="M3 12h6"/><path d="m13 21 8-8"/>'),orderDesc:e('<path d="m3 16 4 4 4-4"/><path d="M7 20V4"/><path d="M11 4h10"/><path d="M11 8h7"/><path d="M11 12h4"/>'),orderRemove:e('<path d="M3 4h12"/><path d="M3 8h9"/><path d="M3 12h6"/><path d="M13 17h8"/>'),orderNone:e('<path d="m3 8 4-4 4 4"/><path d="m11 16-4 4-4-4"/><path d="M7 4v16"/><path d="M15 8h6"/><path d="M15 16h6"/><path d="M13 12h8"/>'),search:e('<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>'),searchClear:e('<path d="m13.5 8.5-5 5"/><path d="m8.5 8.5 5 5"/><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>'),starts:e('<path d="M3 3h4v18H3z"/><path d="M11 8h10v9H11"/>'),tick:e('<path d="M20 6 9 17l-5-5"/>'),x:e('<path d="M18 6 6 18"/><path d="m6 6 12 12"/>')};function s(t,e){return e.closest("div.dtfh-floatingparent")||t.table().container()}function u(t,e,n){var r=n.closest("div.dt-column-header"),e=s(e,n),r=getComputedStyle(r),o=t.offsetWidth,i=((t,e)=>{for(var n=0,r=0;e&&e!==t&&e!==d.body;)n+=e.offsetTop,r+=e.offsetLeft,e.scrollTop&&(r-=e.scrollTop),e.scrollLeft&&(r-=e.scrollLeft),e=e.offsetParent;return{top:n,left:r}})(e,n),a=i.top+n.offsetHeight,r="row-reverse"===r.flexDirection?i.left:i.left-o+n.offsetWidth,i=e.offsetWidth;i<r+o&&(r-=r+o-i),r<0&&(r=0),t.style.top=a+"px",t.style.left=r+"px"}function h(e,t,n){function r(t){e._shown?t.target===e||e.contains(t.target)||(e._close(),d.body.removeEventListener("click",r)):d.body.removeEventListener("click",r)}var o=s(t,n.element());e._shown=!0,o.append(e),u(e,t,n.element());d.body.addEventListener("click",r)}var p={classes:{container:"dtcc-dropdown",liner:"dtcc-dropdown-liner"},defaults:{className:"dropdown",content:[],icon:"menu",text:"More..."},init:function(n){var r=this.dt(),o=y("div",p.classes.container,"",[y("div",p.classes.liner)]),t=(o._shown=!1,o._close=function(){o.remove(),o._shown=!1},o.setAttribute("role","dialog"),o.setAttribute("aria-label",r.i18n("columnControl.dropdown",n.text)),r.on("fixedheader-mode",function(){o._shown&&h(o,r,n._parents?n._parents[0]:i)}),o.childNodes[0]),i=new f(r).text(r.i18n("columnControl.dropdown",n.text)).icon(n.icon).className(n.className).dropdownDisplay(t).handler(function(t){var e;t._closed&&t._closed.includes(o)||(h(o,r,n._parents?n._parents[0]:i),e=o.querySelector("input, a, button"),console.log(t.type,t),e&&"keypress"===t.type&&e.focus())});i.element().setAttribute("aria-haspopup","dialog");for(var e=0;e<n.content.length;e++){var a=this.resolve(n.content[e]),a=(a.config._parents||(a.config._parents=[]),a.config._parents.push(i),a.plugin.init.call(this,a.config));t.appendChild(a)}n._parents&&n._parents.length&&i.extra("chevronRight"),r.on("columns-reordered",function(){u(o,r,i.element())});function s(t){var e,n;c._shown&&(e=Array.from(c.querySelectorAll("a, button, input, select")),n=d.activeElement,"Escape"===t.key?(c._close(),l.focus()):"Tab"===t.key&&0!==e.length&&(e.includes(n)?t.shiftKey?n===e[0]&&(e[e.length-1].focus(),t.preventDefault()):n===e[e.length-1]&&(e[0].focus(),t.preventDefault()):(e[0].focus(),t.preventDefault())))}var c,l;c=o,l=i.element();return d.body.addEventListener("keydown",s),r.on("destroy",function(){d.body.removeEventListener("keydown",s)}),i.element()}},o=0,f=(n.prototype.active=function(t){return void 0===t?this._s.active:(this._s.active=t,this._checkActive(),this)},n.prototype.activeList=function(t,e){return this._s.activeList[t]=e,this._checkActive(),this},n.prototype.checkDisplay=function(){for(var t=0,e=this._dom.dropdownDisplay.childNodes,n=0;n<e.length;n++)"none"!==e[n].style.display&&t++;return 0===t&&(this._dom.button.style.display="none"),this},n.prototype.className=function(t){return this._dom.button.classList.add("dtcc-button_"+t),this},n.prototype.destroy=function(){this._s.buttonClick&&(this._dom.button.removeEventListener("click",this._s.buttonClick),this._dom.button.removeEventListener("keypress",this._s.buttonClick)),this._s.namespace&&this._s.dt.off("destroy."+this._s.namespace)},n.prototype.dropdownDisplay=function(t){return this._dom.dropdownDisplay=t,this},n.prototype.element=function(){return this._dom.button},n.prototype.enable=function(t){return this._dom.button.classList.toggle("dtcc-button_disabled",!t),this._s.enabled=t,this},n.prototype.extra=function(t){return this._dom.extra.innerHTML=t?c[t]:"",this},n.prototype.handler=function(n){function t(t){var e;void 0===(e=t)&&(e=null),d.querySelectorAll("div.dtcc-dropdown").forEach(function(t){null!==e&&t.contains(e.target)||(t._close(),e._closed||(e._closed=[]),e._closed.push(t))}),t.stopPropagation(),t.preventDefault(),r._s.enabled&&n(t)}var r=this;return this._s.buttonClick=t,this._s.namespace="dtcc-"+o++,this._dom.button.addEventListener("click",t),this._dom.button.addEventListener("keypress",t),this._s.dt.on("destroy."+this._s.namespace,function(){r.destroy()}),this},n.prototype.icon=function(t){return this._dom.icon.innerHTML=t?c[t]:"",this},n.prototype.text=function(t){return void 0===t?this._s.label:(this._dom.text.innerHTML=t,this._s.label=t,this._dom.button.setAttribute("aria-label",t),this)},n.prototype.value=function(t){return void 0===t?this._s.value:(this._s.value=t,this)},n.prototype._checkActive=function(){return!0===this._s.active||Object.values(this._s.activeList).includes(!0)?(this._dom.state.innerHTML=c.tick,this._dom.button.classList.add("dtcc-button_active")):(this._dom.state.innerHTML="",this._dom.button.classList.remove("dtcc-button_active")),this},n.classes={container:"dtcc-button"},n);function n(t){this._s={active:!1,activeList:[],buttonClick:null,dt:null,enabled:!0,label:"",namespace:"",value:null},this._s.dt=t,this._dom={button:y("button",n.classes.container),dropdownDisplay:null,extra:y("span","dtcc-button-extra"),icon:y("span","dtcc-button-icon"),state:y("span","dtcc-button-state"),text:y("span","dtcc-button-text")},this._dom.button.append(this._dom.icon),this._dom.button.append(this._dom.text),this._dom.button.append(this._dom.state),this._dom.button.append(this._dom.extra),this.enable(!0)}m.prototype.add=function(n,t){for(var r=this,o=(Array.isArray(n)||(n=[n]),this),e=0;e<n.length;e++)(t=>{var t=n[t],e=new f(o._s.dt).active(t.active||!1).handler(function(t){r._s.handler(t,e,r._s.buttons,!0),r._updateCount()}).icon(t.icon||"").text(""!==t.label?t.label:o._s.dt.i18n("columnControl.list.emptyOption","Empty")).value(t.value);""===t.label&&e.className("empty"),o._s.buttons.push(e)})(e);var i=this._s.buttons.length;return!0!==t&&void 0!==t||(this._dom.selectAllCount.innerHTML=i?"("+i+")":"",this._redraw()),this},m.prototype.button=function(t){for(var e=this._s.buttons,n=0;n<e.length;n++)if(e[n].value()===t)return e[n];return null},m.prototype.clear=function(){for(var t=0;t<this._s.buttons.length;t++)this._s.buttons[t].destroy();return this._dom.buttons.replaceChildren(),this._s.buttons.length=0,this},m.prototype.element=function(){return this._dom.container},m.prototype.handler=function(t){return this._s.handler=t,this},m.prototype.searchListener=function(t,n){var r=this;return t.on("cc-search-clear",function(t,e){e===n.idx()&&(r.selectNone(),r._s.handler(t,null,r._s.buttons,!1),r._s.search="",r._dom.search.value="",r._redraw(),r._updateCount())}),this},m.prototype.selectAll=function(){for(var t=0;t<this._s.buttons.length;t++)this._s.buttons[t].active(!0);return this},m.prototype.selectNone=function(){for(var t=0;t<this._s.buttons.length;t++)this._s.buttons[t].active(!1);return this},m.prototype.title=function(t){return this._dom.title.innerHTML=t,this},m.prototype.values=function(t){var e,n=[],r=this._s.buttons;if(void 0!==t){for(e=0;e<r.length;e++)t.includes(r[e].value())&&r[e].active(!0);return this._updateCount(),this}for(e=0;e<r.length;e++)r[e].active()&&n.push(r[e].value());return n},m.prototype._updateCount=function(){var t=this.values().length;this._dom.selectNoneCount.innerHTML=t?"("+t+")":""},m.prototype._redraw=function(){var t=this._s.buttons,e=this._dom.buttons,n=this._s.search.toLowerCase();e.replaceChildren();for(var r=0;r<t.length;r++){var o=t[r];n&&!o.text().toLowerCase().includes(n)||e.appendChild(o.element())}},m.classes={container:"dtcc-list",input:"dtcc-list-search"};var l=m;function m(t,e){function n(){i._s.search=a.search.value,i._redraw()}function r(t){i.selectAll(),i._s.handler(t,null,i._s.buttons,!0),i._updateCount()}function o(t){i.selectNone(),i._s.handler(t,null,i._s.buttons,!0),i._updateCount()}var i=this,a=(this._s={buttons:[],dt:null,handler:function(){},search:""},this._s.dt=t,this._dom={buttons:y("div","dtcc-list-buttons"),container:y("div",m.classes.container),controls:y("div","dtcc-list-controls"),title:y("div","dtcc-list-title"),selectAll:y("button","dtcc-list-selectAll",t.i18n("columnControl.list.all","Select all")),selectAllCount:y("span"),selectNone:y("button","dtcc-list-selectNone",t.i18n("columnControl.list.none","Deselect")),selectNoneCount:y("span"),search:y("input",m.classes.input)},this._dom);a.search.setAttribute("type","text"),a.container.append(a.title),a.container.append(a.controls),a.container.append(a.buttons),e.select&&(a.controls.append(a.selectAll),a.controls.append(a.selectNone),a.selectAll.append(a.selectAllCount),a.selectNone.append(a.selectNoneCount));e.search&&(a.controls.append(a.search),a.search.setAttribute("placeholder",t.i18n("columnControl.list.search","Search...")),a.search.addEventListener("input",n)),a.selectAll.addEventListener("click",r),a.selectNone.addEventListener("click",o),t.on("destroy",function(){a.selectAll.removeEventListener("click",r),a.selectNone.removeEventListener("click",o),a.search.removeEventListener("input",n)})}var r={defaults:{className:"colVis",columns:"",search:!1,select:!1,title:"Column visibility"},init:function(t){function n(){o.columns(t.columns).every(function(){i.add({active:this.visible(),label:this.title(),value:this.index()})})}var o=this.dt(),i=new l(o,{search:t.search,select:t.select}).title(o.i18n("columnControl.colVis",t.title)).handler(function(t,e,n){e&&e.active(!e.active()),r(n)}),r=function(t){for(var e=0;e<t.length;e++){var n=t[e],r=n.value(),r=o.column(r);n.active()&&!r.visible()?r.visible(!0):!n.active()&&r.visible()&&r.visible(!1)}};return n(),o.on("column-visibility",function(t,e,n,r){n=i.button(n);n&&n.active(r)}),o.on("columns-reordered",function(t,e){i.clear(),n()}),i.element()}},a={defaults:{className:"colVis",columns:"",search:!1,select:!1,text:"Column visibility",title:"Column visibility"},extend:function(t){return{extend:"dropdown",icon:"columns",text:this.dt().i18n("columnControl.colVisDropdown",t.text),content:[Object.assign(t,{extend:"colVis"})]}}},R={defaults:{className:"reorder",icon:"move",text:"Reorder columns"},init:function(t){var n=this,e=this.dt(),r=new f(e).text(e.i18n("columnControl.reorder",t.text)).icon(t.icon).className(t.className).handler(function(){var t=n.idx();0<t&&e.colReorder.move(t,t-1)});return 0===this.idx()&&r.enable(!1),e.on("columns-reordered",function(t,e){r.enable(0<n.idx())}),e.init().colReorder||new x.ColReorder(e,{}),r.element()}},H={defaults:{className:"reorderLeft",icon:"moveLeft",text:"Move column left"},init:function(t){var n=this,e=this.dt(),r=new f(e).text(e.i18n("columnControl.reorderLeft",t.text)).icon(t.icon).className(t.className).handler(function(){var t=n.idx();0<t&&e.colReorder.move(t,t-1)});return 0===this.idx()&&r.enable(!1),e.on("columns-reordered",function(t,e){r.enable(0<n.idx())}),r.element()}},V={defaults:{className:"reorderRight",icon:"moveRight",text:"Move column right"},init:function(t){var n=this,r=this.dt(),o=new f(r).text(r.i18n("columnControl.reorderRight",t.text)).icon(t.icon).className(t.className).handler(function(){var t=n.idx();t<r.columns().count()-1&&r.colReorder.move(t,t+1)});return this.idx()===r.columns().count()-1&&o.enable(!1),r.on("columns-reordered",function(t,e){o.enable(n.idx()<r.columns().count()-1)}),o.element()}},Y={defaults:{className:"order",iconAsc:"orderAsc",iconDesc:"orderDesc",iconNone:"orderNone",statusOnly:!1,text:"Toggle ordering"},init:function(r){var o=this,t=this.dt(),i=new f(t).text(t.i18n("columnControl.order",r.text)).icon("orderAsc").className(r.className);return r.statusOnly||t.order.listener(i.element(),x.versionCheck("2.3.2")?function(){return[o.idx()]}:this.idx(),function(){}),t.on("order",function(t,e,n){n=n.find(function(t){return t.col===o.idx()});n?"asc"===n.dir?i.active(!0).icon(r.iconAsc):"desc"===n.dir&&i.active(!0).icon(r.iconDesc):i.active(!1).icon(r.iconNone)}),i.element()}},W={defaults:{className:"orderAddAsc",icon:"orderAddAsc",text:"Add Sort Ascending"},init:function(t){var r=this,e=this.dt(),o=new f(e).text(e.i18n("columnControl.orderAddAsc",t.text)).icon(t.icon).className(t.className).handler(function(){e.order().push([r.idx(),"asc"]),e.draw()});return e.on("order",function(t,e,n){n=n.some(function(t){return t.col===r.idx()});o.enable(!n)}),o.element()}},B={defaults:{className:"orderAddDesc",icon:"orderAddDesc",text:"Add Sort Descending"},init:function(t){var r=this,e=this.dt(),o=new f(e).text(e.i18n("columnControl.orderAddDesc",t.text)).icon(t.icon).className(t.className).handler(function(){e.order().push([r.idx(),"desc"]),e.draw()});return e.on("order",function(t,e,n){n=n.some(function(t){return t.col===r.idx()});o.enable(!n)}),o.element()}},P={defaults:{className:"orderAsc",icon:"orderAsc",text:"Sort Ascending"},init:function(t){var r=this,e=this.dt(),o=new f(e).text(e.i18n("columnControl.orderAsc",t.text)).icon(t.icon).className(t.className).handler(function(){r.dt().order([{idx:r.idx(),dir:"asc"}]).draw()});return e.on("order",function(t,e,n){n=n.some(function(t){return t.col===r.idx()&&"asc"===t.dir});o.active(n)}),o.element()}},z={defaults:{className:"orderClear",icon:"orderClear",text:"Clear sort"},init:function(t){var e=this.dt(),r=new f(e).text(e.i18n("columnControl.orderClear",t.text)).icon(t.icon).className(t.className).handler(function(){e.order([]).draw()});return e.on("order",function(t,e,n){r.enable(0<n.length)}),0===e.order().length&&r.enable(!1),r.element()}},F={defaults:{className:"orderDesc",icon:"orderDesc",text:"Sort Descending"},init:function(t){var r=this,e=this.dt(),o=new f(e).text(e.i18n("columnControl.orderDesc",t.text)).icon(t.icon).className(t.className).handler(function(){r.dt().order([{idx:r.idx(),dir:"desc"}]).draw()});return e.on("order",function(t,e,n){n=n.some(function(t){return t.col===r.idx()&&"desc"===t.dir});o.active(n)}),o.element()}},G={defaults:{className:"orderRemove",icon:"orderRemove",text:"Remove from sort"},init:function(t){var r=this,n=this.dt(),o=new f(n).text(n.i18n("columnControl.orderRemove",t.text)).icon(t.icon).className(t.className).handler(function(){var t=n.order(),e=t.findIndex(function(t){return t[0]===r.idx()});t.splice(e,1),n.order(t).draw()});return n.on("order",function(t,e,n){n=n.some(function(t){return t.col===r.idx()});o.enable(n)}),o.enable(!1),o.element()}},K={defaults:{className:"order",iconAsc:"orderAsc",iconDesc:"orderDesc",iconNone:"orderNone",statusOnly:!0,text:"Sort status"},extend:function(t){return Object.assign(t,{extend:"order"})}},v=(_.prototype.addClass=function(t){return this._dom.container.classList.add(t),this},_.prototype.clear=function(){return this.set(this._dom.select.children[0].getAttribute("value"),""),this},_.prototype.clearable=function(t){return t||this._dom.clear.remove(),this},_.prototype.element=function(){return this._dom.container},_.prototype.input=function(){return this._dom.input},_.prototype.options=function(t){for(var e=this._dom.select,n=0;n<t.length;n++)e.add(new Option(t[n].label,t[n].value));return this._dom.typeIcon.innerHTML=c[t[0].value],this},_.prototype.placeholder=function(t){var e;return t&&(e=this._dt.column(this._idx).title(),this._dom.input.placeholder=t.replace("[title]",e)),this},_.prototype.runSearch=function(){var t=this._dom,e="empty"===t.select.value||"notEmpty"===t.select.value||""!==t.input.value;t.container.classList.toggle("dtcc-search_active",e),!this._search||this._lastValue===t.input.value&&this._lastType===t.select.value||(this._search(t.select.value,t.input.value,this._loadingState),this._lastValue=t.input.value,this._lastType=t.select.value)},_.prototype.search=function(t){return this._search=t,this._stateLoad(this._dt.state.loaded()),this},_.prototype.set=function(t,e){var n=this._dom;return n.input.value=e,n.select.value=t,n.typeIcon.innerHTML=c[n.select.value],this.runSearch(),this},_.prototype.title=function(t){var e;return t&&(e=this._dt.column(this._idx).title(),this._dom.title.innerHTML=t.replace("[title]",e)),this},_.prototype.titleAttr=function(t){var e;return t&&(e=this._dt.column(this._idx).title(),this._dom.input.title=t.replace("[title]",e)),this},_.prototype.type=function(t){return this._type=t,this},_.prototype._stateLoad=function(t){var e=this._dom,n=this._idx,n=null==(t=null==(t=null==t?void 0:t.columnControl)?void 0:t[n])?void 0:t.searchInput;n&&(this._loadingState=!0,e.select.value=n.logic,e.input.value=n.value,e.select.dispatchEvent(new Event("input")),this._loadingState=!1)},_.classes={container:["dtcc-content","dtcc-search"],input:"",select:""},_);function _(n,r){function t(){i.runSearch()}function e(){a.typeIcon.innerHTML=c[a.select.value],i.runSearch()}function o(){i.clear()}var i=this,a=(this._type="text",this._dt=n,this._idx=r,this._dom={clear:y("span","dtcc-search-clear",c.x),container:y("div",_.classes.container),typeIcon:y("div","dtcc-search-type-icon"),searchIcon:y("div","dtcc-search-icon",c.search),input:y("input",_.classes.input),inputs:y("div"),select:y("select",_.classes.select),title:y("div","dtcc-search-title")},this._dom),s=r;a.input.setAttribute("type","text"),a.container.append(a.title,a.inputs),a.inputs.append(a.typeIcon,a.select,a.searchIcon,a.clear,a.input);a.input.addEventListener("input",t),a.select.addEventListener("input",e),a.clear.addEventListener("click",o),n.on("destroy",function(){a.input.removeEventListener("input",t),a.select.removeEventListener("input",e),a.clear.removeEventListener("click",o)}),n.on("stateSaveParams",function(t,e,n){n.columnControl||(n.columnControl={}),n.columnControl[r]||(n.columnControl[r]={}),n.columnControl[r].searchInput={logic:a.select.value,type:i._type,value:a.input.value}}),n.on("stateLoaded",function(t,e,n){i._stateLoad(n)}),n.on("columns-reordered",function(t,e){i._idx=n.colReorder.transpose(s,"fromOriginal")}),n.on("cc-search-clear",function(t,e){e===i._idx&&(i._loadingState=!0,i.clear(),i._loadingState=!1)})}var b={defaults:{clear:!0,placeholder:"",title:"",titleAttr:""},init:function(i){var a,s=this,c=!1,l=x.use("moment"),d=x.use("luxon"),u=this.dt(),t="columnControl.search.datetime.",h="",e=new v(u,this.idx()).type("date").addClass("dtcc-searchDateTime").clearable(i.clear).placeholder(i.placeholder).title(i.title).titleAttr(i.titleAttr).options([{label:u.i18n(t+"equal","Equals"),value:"equal"},{label:u.i18n(t+"notEqual","Does not equal"),value:"notEqual"},{label:u.i18n(t+"greater","After"),value:"greater"},{label:u.i18n(t+"less","Before"),value:"less"},{label:u.i18n(t+"empty","Empty"),value:"empty"},{label:u.i18n(t+"notEmpty","Not empty"),value:"notEmpty"}]).search(function(t,e,n){var r=u.column(s.idx()),o=""===e?"":g(a&&c?a.val():e.trim(),h,l,d);if("empty"===t)r.search.fixed("dtcc",function(t){return!t});else if("notEmpty"===t)r.search.fixed("dtcc",function(t){return!!t});else{if(""===r.search.fixed("dtcc")&&""===o)return;o?"equal"===t?r.search.fixed("dtcc",function(t){return g(t,h,l,d)==o}):"notEqual"===t?r.search.fixed("dtcc",function(t){return g(t,h,l,d)!=o}):"greater"===t?r.search.fixed("dtcc",function(t){return g(t,h,l,d)>o}):"less"===t&&r.search.fixed("dtcc",function(t){return g(t,h,l,d)<o}):r.search.fixed("dtcc","")}i._parents&&i._parents.forEach(function(t){return t.activeList(s.unique(),!!r.search.fixed("dtcc"))}),n||r.draw()});return u.ready(function(){var t=x.use("datetime");h=((t,e)=>{if(t=t.column(e).type())if("datetime"===t){var e=x.use("moment"),n=x.use("luxon");if(e)return e().creationData().locale._longDateFormat.L;if(n)return n.DateTime.fromISO("1999-08-07").toLocaleString().replace("07","dd").replace("7","d").replace("08","MM").replace("8","M").replace("1999","yyyy").replace("99","yy")}else{if(t.includes("datetime-"))return t.replace(/datetime-/g,"");if(t.includes("moment"))return t.replace(/moment-/g,"");if(t.includes("luxon"))return t.replace(/luxon-/g,"")}return"YYYY-MM-DD"})(u,s.idx()),t&&(a=new t(e.input(),{format:h,i18n:u.settings()[0].oLanguage.datetime,onChange:function(){c=!0,e.runSearch(),c=!1}}))}),e.element()}};function g(t,e,n,r){return""===t?"":t instanceof Date?t.getTime():"YYYY-MM-DD"!==e&&(n||r)?n?1e3*n(t,e).unix():r.DateTime.fromFormat(t,e).toMillis():new Date(t).getTime()}function C(t,e){var n=t.values();t.clear();for(var r=0;r<e.length;r++)"object"==typeof e[r]?t.add({active:!1,label:e[r].label,value:e[r].value},r===e.length-1):t.add({active:!1,label:e[r],value:e[r]},r===e.length-1);n.length&&t.values(n)}function w(t,e){t=null==(e=null==(e=null==e?void 0:e.columnControl)?void 0:e[t])?void 0:e.searchList;if(t)return t}function A(t,e){var n=null==(n=t.ajax.json())?void 0:n.columnControl,t=t.column(e),r=t.name(),t=t.dataSrc();return n&&n[r]?n[r]:n&&"string"==typeof t&&n[t]?n[t]:n&&n[e]?n[e]:null}function L(t,e,n,r,o){var i=null==(i=t.ajax.json())?void 0:i.columnControl,a=[],s=A(t,n);if(s)a=s;else{if(i&&e.ajaxOnly)return r.element().style.display="none",void(e._parents&&e._parents.forEach(function(t){return t.checkDisplay()}));for(var c={},l=t.rows({order:n}).indexes().toArray(),d=t.settings()[0],u=0;u<l.length;u++){var h=d.fastData(l[u],n,"filter");c[h]||(c[h]=!0,a.push({label:d.fastData(l[u],n,"display"),value:h}))}}C(r,a),o&&r.values(o)}var E={defaults:{ajaxOnly:!0,className:"searchList",options:null,search:!0,select:!0,title:""},init:function(r){function o(e){var t=s.column(i.idx());e&&(0===e.length?t.search.fixed("dtcc-list",""):t.search.fixed("dtcc-list",function(t){return e.includes(t)}),r._parents)&&r._parents.forEach(function(t){return t.activeList(i.unique(),!!e.length)})}var i=this,a=null,s=this.dt(),c=new l(s,{search:r.search,select:r.select}).searchListener(s,this).title(s.i18n("columnControl.searchList",r.title).replace("[title]",s.column(this.idx()).title())).handler(function(t,e,n,r){e&&e.active(!e.active()),o(c.values()),r&&s.draw()});return r.options?C(c,r.options):s.ready(function(){L(s,r,i.idx(),c,a)}),s.on("xhr",function(t,e,n){L(s,r,i.idx(),c,a)}),s.on("stateLoaded",function(t,e,n){n=w(i.idx(),n);n&&c.values(n)}),s.on("stateSaveParams",function(t,e,n){var r=i.idx();n.columnControl||(n.columnControl={}),n.columnControl[r]||(n.columnControl[r]={}),n.columnControl[r].searchList=s.ready()?c.values():a}),a=w(this.idx(),s.state.loaded()),o(a),c.element()}},N={defaults:{clear:!0,placeholder:"",title:"",titleAttr:""},init:function(o){var i=this,a=this.dt(),t="columnControl.search.number.",t=new v(a,this.idx()).type("num").addClass("dtcc-searchNumber").clearable(o.clear).placeholder(o.placeholder).title(o.title).titleAttr(o.titleAttr).options([{label:a.i18n(t+"equal","Equals"),value:"equal"},{label:a.i18n(t+"notEqual","Does not equal"),value:"notEqual"},{label:a.i18n(t+"greater","Greater than"),value:"greater"},{label:a.i18n(t+"greaterOrEqual","Greater or equal"),value:"greaterOrEqual"},{label:a.i18n(t+"less","Less than"),value:"less"},{label:a.i18n(t+"lessOrEqual","Less or equal"),value:"lessOrEqual"},{label:a.i18n(t+"empty","Empty"),value:"empty"},{label:a.i18n(t+"notEmpty","Not empty"),value:"notEmpty"}]).search(function(t,e,n){var r=a.column(i.idx());if("empty"===t)r.search.fixed("dtcc",function(t){return!t});else if("notEmpty"===t)r.search.fixed("dtcc",function(t){return!!t});else{if(""===r.search.fixed("dtcc")&&""===e)return;""===e?r.search.fixed("dtcc",""):"equal"===t?r.search.fixed("dtcc",function(t){return M(t)==e}):"notEqual"===t?r.search.fixed("dtcc",function(t){return M(t)!=e}):"greater"===t?r.search.fixed("dtcc",function(t){return M(t)>e}):"greaterOrEqual"===t?r.search.fixed("dtcc",function(t){return M(t)>=e}):"less"===t?r.search.fixed("dtcc",function(t){return M(t)<e}):"lessOrEqual"===t&&r.search.fixed("dtcc",function(t){return M(t)<=e})}o._parents&&o._parents.forEach(function(t){return t.activeList(i.unique(),!!r.search.fixed("dtcc"))}),n||r.draw()});return t.input().setAttribute("inputmode","numeric"),t.input().setAttribute("pattern","[0-9]*"),t.element()}},Q=/<([^>]*>)/g,U=/['\u00A0,$£€¥%\u2009\u202F\u20BD\u20a9\u20BArfkɃΞ]/gi;function M(t){var e;return 0===t||t&&"-"!==t?"number"==(e=typeof t)||"bigint"==e?t:+(t=t.replace?t.replace(Q,"").replace(U,""):t):-1/0}var q={defaults:{clear:!0,placeholder:"",title:"",titleAttr:""},init:function(o){var i=this,a=this.dt(),t="columnControl.search.text.";return new v(a,this.idx()).addClass("dtcc-searchText").clearable(o.clear).placeholder(o.placeholder).title(o.title).titleAttr(o.titleAttr).options([{label:a.i18n(t+"contains","Contains"),value:"contains"},{label:a.i18n(t+"notContains","Does not contain"),value:"notContains"},{label:a.i18n(t+"equal","Equals"),value:"equal"},{label:a.i18n(t+"notEqual","Does not equal"),value:"notEqual"},{label:a.i18n(t+"starts","Starts"),value:"starts"},{label:a.i18n(t+"ends","Ends"),value:"ends"},{label:a.i18n(t+"empty","Empty"),value:"empty"},{label:a.i18n(t+"notEmpty","Not empty"),value:"notEmpty"}]).search(function(t,e,n){var r=a.column(i.idx());if(e=e.toLowerCase(),"empty"===t)r.search.fixed("dtcc",function(t){return!t});else if("notEmpty"===t)r.search.fixed("dtcc",function(t){return!!t});else{if(""===r.search.fixed("dtcc")&&""===e)return;""===e?r.search.fixed("dtcc",""):"equal"===t?r.search.fixed("dtcc",function(t){return t.toLowerCase()==e}):"notEqual"===t?r.search.fixed("dtcc",function(t){return t.toLowerCase()!=e}):"contains"===t?r.search.fixed("dtcc",e):"notContains"===t?r.search.fixed("dtcc",function(t){return!t.toLowerCase().includes(e)}):"starts"===t?r.search.fixed("dtcc",function(t){return t.toLowerCase().startsWith(e)}):"ends"===t&&r.search.fixed("dtcc",function(t){return t.toLowerCase().endsWith(e)})}o._parents&&o._parents.forEach(function(t){return t.activeList(i.unique(),!!r.search.fixed("dtcc"))}),n||r.draw()}).element()}},r={colVis:r,colVisDropdown:a,dropdown:p,reorder:R,reorderLeft:H,reorderRight:V,order:Y,orderAddAsc:W,orderAddDesc:B,orderAsc:P,orderClear:z,orderDesc:F,orderRemove:G,orderStatus:K,search:{defaults:{allowSearchList:!1},init:function(n){function e(t){var e=A(i,a);return n.allowSearchList&&e?E.init.call(o,Object.assign({},E.defaults,n)):"date"===t||t.startsWith("datetime")?b.init.call(o,Object.assign({},b.defaults,n)):t.includes("num")?N.init.call(o,Object.assign({},N.defaults,n)):q.init.call(o,Object.assign({},q.defaults,n))}var r,o=this,i=this.dt(),a=this.idx(),t=null==(t=null==(t=null==(t=i.state.loaded())?void 0:t.columnControl)?void 0:t[a])?void 0:t.searchInput;return t?r=e(t.type):(r=d.createElement("div"),i.ready(function(){var t=i.column(a),t=e(t.type());r.replaceWith(t)})),r}},searchClear:{defaults:{className:"searchClear",icon:"searchClear",text:"Clear Search"},init:function(t){var n=this,r=this.dt(),o=new f(r).text(r.i18n("columnControl.searchClear",t.text)).icon(t.icon).className(t.className).handler(function(){r.column(n.idx()).ccSearchClear().draw()}).enable(!1);return r.on("draw",function(){var t=r.column(n.idx()).search.fixed("dtcc"),e=r.column(n.idx()).search.fixed("dtcc-list");o.enable(!(!t&&!e))}),o.element()}},searchDropdown:{defaults:{ajaxOnly:!0,allowSearchList:!0,className:"searchDropdown",clear:!0,columns:"",options:null,placeholder:"",search:!0,select:!0,text:"Search",title:"",titleAttr:""},extend:function(t){return{extend:"dropdown",icon:"search",text:this.dt().i18n("columnControl.searchDropdown",t.text),content:[Object.assign(t,{extend:"search"})]}}},searchDateTime:b,searchList:E,searchNumber:N,searchText:q,spacer:{defaults:{className:"dtcc-spacer",text:""},init:function(t){var e=this.dt(),e=y("div",t.className,e.i18n("columnControl.spacer",t.text));return e.setAttribute("role","separator"),e}},title:{defaults:{className:"dtcc-title",text:null},init:function(t){var e=this.dt().column(this.idx()).title(),n=null===t.text?"[title]":t.text;return y("div",t.className,n.replace("[title]",e))}}},D=(S.prototype.dt=function(){return this._dt},S.prototype.idx=function(){return this._s.columnIdx},S.prototype.resolve=function(t){var e=null,n=null,r=null;if("string"==typeof t?(e=S.content[r=t],n=Object.assign({},null==e?void 0:e.defaults)):Array.isArray(t)?(e=S.content[r="dropdown"],n=Object.assign({},null==e?void 0:e.defaults,{content:t})):t.extend&&(r=t.extend,e=S.content[r],n=Object.assign({},null==e?void 0:e.defaults,t)),e)return e.extend?(t=e.extend.call(this,n),this.resolve(t)):{config:n,type:r,plugin:e};throw new Error("Unknown ColumnControl content type: "+r)},S.prototype.unique=function(){return this._s.unique},S.prototype._target=function(){var t,e,n=this._c.target,r=this._dt.column(this._s.columnIdx),o="header";return"number"==typeof n?t=r.header(n):(e="tfoot"!==(n=n.split(":"))[0],n=n[1]?parseInt(n[1]):0,e?t=r.header(n):(t=r.footer(n),o="footer")),t.querySelector("div.dt-column-"+o)},S.Button=f,S.CheckList=l,S.SearchInput=v,S.content=r,S.defaults={className:"",content:null,target:0},S.icons=c,S.version="1.0.5",S);function S(n,t,e){var r=this,o=(this._dom={target:null,wrapper:null},this._c={},this._s={columnIdx:null,unique:null},this._dt=n,this._s.columnIdx=t,this._s.unique=Math.random(),t);Object.assign(this._c,S.defaults,e),this._dom.target=this._target(),e.className&&i(this._dom.target.closest("tr"),e.className),this._c.content&&(n.on("columns-reordered",function(t,e){r._s.columnIdx=n.colReorder.transpose(o,"fromOriginal")}),this._dom.wrapper=d.createElement("span"),this._dom.wrapper.classList.add("dtcc"),this._dom.target.appendChild(this._dom.wrapper),this._c.content.forEach(function(t){t=r.resolve(t),t=t.plugin.init.call(r,t.config);r._dom.wrapper.appendChild(t)}),n.on("destroy",function(){r._dom.wrapper.remove()}))}function k(t,e){var n=D.defaults.target;if(T(e)){if(n===t)return{target:n,content:e}}else if(Array.isArray(e))for(var r=0;r<e.length;r++){var o=e[r];if(T(o)){if(n===t)return{target:n,content:o}}else if(j(o)){if(t===(void 0!==o.target?o.target:n))return o}else if(t===n)return{target:n,content:e}}else if("object"==typeof e)if(j(e)){if(t===(void 0!==e.target?e.target:n))return e}else if(t===n)return{target:n,content:e}}function O(e,t){function n(t){e.includes(t)||e.push(t)}return Array.isArray(t)?t.forEach(function(t){n(("object"==typeof t&&void 0!==t.target?t:D.defaults).target)}):"object"==typeof t&&n((void 0!==t.target?t:D.defaults).target),e}function j(t){return"object"==typeof t&&void 0!==t.target}function T(t){var e=!1;if(Array.isArray(t)){for(var n=0;n<t.length;n++)if(j(t[n])){e=!0;break}return!e}}return x.ColumnControl=D,t(d).on("i18n.dt",function(t,e){if("dt"===t.namespace){var n=new x.Api(e),t=n.table().header(),r=e.oInit.columnControl,o=D.defaults,i=[],a={};t.querySelectorAll("tr").length<=1&&null===e.titleRow&&(e.titleRow=0),O(i,r),O(i,o),n.columns().every(function(t){var e=this.init().columnControl;O(i,e)});for(var s=0;s<i.length;s++){v=m=f=p=h=u=d=l=c=void 0;var c=a,l=i[s],d=n;if(!c[l]){var u=!0,h=0,p=("number"==typeof l?h=l:("tfoot"===(p=l.split(":"))[0]&&(u=!1),p[1]&&(h=parseInt(p[1]))),u?d.table().header():d.table().footer());if(!p.querySelectorAll("tr")[h]){var f=d.columns().count(),m=y("tr");m.setAttribute("data-dt-order","disable");for(var v=0;v<f;v++)m.appendChild(y("td"));p.appendChild(m)}c[l]=!0}}}}),t(d).on("preInit.dt",function(t,e){var s,c,l,d;"dt"===t.namespace&&(s=new x.Api(e),c=e.oInit.columnControl,l=D.defaults,O(d=[],c),O(d,l),s.columns().every(function(t){for(var e=this.init().columnControl,n=O(d.slice(),e),r=0;r<n.length;r++){var o=k(n[r],e),i=k(n[r],c),a=k(n[r],l);(a||i||o)&&new D(s,this.index(),Object.assign({},a||{},i||{},o||{}))}}))}),x.Api.registerPlural("columns().ccSearchClear()","column().ccSearchClear()",function(){var n=this;return this.iterator("column",function(t,e){n.trigger("cc-search-clear",[e])})}),x.ext.buttons.ccSearchClear={text:function(t){return t.i18n("columnControl.buttons.searchClear","Clear search")},init:function(n,t,e){var r=this;n.on("draw",function(){var t=!1,e=!!n.search();e||n.columns().every(function(){(this.search.fixed("dtcc")||this.search.fixed("dtcc-list"))&&(t=!0)}),r.enable(e||t)}),this.enable(!1)},action:function(t,e,n,r){e.search(""),e.columns().ccSearchClear(),e.draw()}},x});
|