datatables.net-columncontrol 1.0.2 → 1.0.4
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.4
|
|
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,13 +185,12 @@ 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
|
|
186
|
-
var containerWidth = dtContainer.offsetWidth;
|
|
188
|
+
var containerWidth = container.offsetWidth;
|
|
187
189
|
if (left + dropdownWidth > containerWidth) {
|
|
188
190
|
left -= left + dropdownWidth - containerWidth;
|
|
189
191
|
}
|
|
190
|
-
if (left <
|
|
191
|
-
left =
|
|
192
|
+
if (left < 0) {
|
|
193
|
+
left = 0;
|
|
192
194
|
}
|
|
193
195
|
dropdown.style.top = top + 'px';
|
|
194
196
|
dropdown.style.left = left + 'px';
|
|
@@ -202,7 +204,7 @@ function positionDropdown(dropdown, dt, btn) {
|
|
|
202
204
|
* @returns Function to call when the dropdown should be removed from the document
|
|
203
205
|
*/
|
|
204
206
|
function attachDropdown(dropdown, dt, btn) {
|
|
205
|
-
var dtContainer = dt.
|
|
207
|
+
var dtContainer = getContainer(dt, btn.element());
|
|
206
208
|
dropdown._shown = true;
|
|
207
209
|
dtContainer.append(dropdown);
|
|
208
210
|
positionDropdown(dropdown, dt, btn.element());
|
|
@@ -237,6 +239,12 @@ function relativePosition(parent, origin) {
|
|
|
237
239
|
while (origin && origin !== parent && origin !== document.body) {
|
|
238
240
|
top += origin.offsetTop;
|
|
239
241
|
left += origin.offsetLeft;
|
|
242
|
+
if (origin.scrollTop) {
|
|
243
|
+
left -= origin.scrollTop;
|
|
244
|
+
}
|
|
245
|
+
if (origin.scrollLeft) {
|
|
246
|
+
left -= origin.scrollLeft;
|
|
247
|
+
}
|
|
240
248
|
origin = origin.offsetParent;
|
|
241
249
|
}
|
|
242
250
|
return {
|
|
@@ -265,6 +273,13 @@ var dropdownContent = {
|
|
|
265
273
|
dropdown.remove();
|
|
266
274
|
dropdown._shown = false;
|
|
267
275
|
};
|
|
276
|
+
// When FixedHeader is used, the transition between states messes up positioning, so if
|
|
277
|
+
// shown we just reattach the dropdown.
|
|
278
|
+
dt.on('fixedheader-mode', function () {
|
|
279
|
+
if (dropdown._shown) {
|
|
280
|
+
attachDropdown(dropdown, dt, config._parents ? config._parents[0] : btn);
|
|
281
|
+
}
|
|
282
|
+
});
|
|
268
283
|
// A liner element allows more styling options, so the contents go inside this
|
|
269
284
|
var liner = dropdown.childNodes[0];
|
|
270
285
|
var btn = new Button(dt)
|
|
@@ -558,12 +573,12 @@ var CheckList = /** @class */ (function () {
|
|
|
558
573
|
};
|
|
559
574
|
var selectAllClick = function (e) {
|
|
560
575
|
_this.selectAll();
|
|
561
|
-
_this._s.handler(e, null, _this._s.buttons);
|
|
576
|
+
_this._s.handler(e, null, _this._s.buttons, true);
|
|
562
577
|
_this._updateCount();
|
|
563
578
|
};
|
|
564
579
|
var selectNoneClick = function (e) {
|
|
565
580
|
_this.selectNone();
|
|
566
|
-
_this._s.handler(e, null, _this._s.buttons);
|
|
581
|
+
_this._s.handler(e, null, _this._s.buttons, true);
|
|
567
582
|
_this._updateCount();
|
|
568
583
|
};
|
|
569
584
|
if (opts.search) {
|
|
@@ -595,12 +610,17 @@ var CheckList = /** @class */ (function () {
|
|
|
595
610
|
var btn = new Button(this_1._s.dt)
|
|
596
611
|
.active(option.active || false)
|
|
597
612
|
.handler(function (e) {
|
|
598
|
-
_this._s.handler(e, btn, _this._s.buttons);
|
|
613
|
+
_this._s.handler(e, btn, _this._s.buttons, true);
|
|
599
614
|
_this._updateCount();
|
|
600
615
|
})
|
|
601
616
|
.icon(option.icon || '')
|
|
602
|
-
.text(option.label
|
|
617
|
+
.text(option.label !== ''
|
|
618
|
+
? option.label
|
|
619
|
+
: this_1._s.dt.i18n('columnControl.list.emptyOption', 'Empty'))
|
|
603
620
|
.value(option.value);
|
|
621
|
+
if (option.label === '') {
|
|
622
|
+
btn.className('empty');
|
|
623
|
+
}
|
|
604
624
|
this_1._s.buttons.push(btn);
|
|
605
625
|
};
|
|
606
626
|
var this_1 = this;
|
|
@@ -673,7 +693,7 @@ var CheckList = /** @class */ (function () {
|
|
|
673
693
|
dt.on('cc-search-clear', function (e, colIdx) {
|
|
674
694
|
if (colIdx === parent.idx()) {
|
|
675
695
|
_this.selectNone();
|
|
676
|
-
_this._s.handler(e, null, _this._s.buttons);
|
|
696
|
+
_this._s.handler(e, null, _this._s.buttons, false);
|
|
677
697
|
_this._s.search = '';
|
|
678
698
|
_this._dom.search.value = '';
|
|
679
699
|
_this._redraw();
|
|
@@ -960,7 +980,7 @@ var order = {
|
|
|
960
980
|
.icon('orderAsc')
|
|
961
981
|
.className(config.className);
|
|
962
982
|
if (!config.statusOnly) {
|
|
963
|
-
dt.order.listener(btn.element(), this.idx(), function () { });
|
|
983
|
+
dt.order.listener(btn.element(), DataTable.versionCheck('2.3.2') ? function () { return [_this.idx()]; } : this.idx(), function () { });
|
|
964
984
|
}
|
|
965
985
|
dt.on('order', function (e, s, order) {
|
|
966
986
|
var found = order.find(function (o) { return o.col === _this.idx(); });
|
|
@@ -1228,7 +1248,10 @@ var SearchInput = /** @class */ (function () {
|
|
|
1228
1248
|
// Column control search clearing (column().ccSearchClear() method)
|
|
1229
1249
|
dt.on('cc-search-clear', function (e, colIdx) {
|
|
1230
1250
|
if (colIdx === _this._idx) {
|
|
1251
|
+
// Don't want an automatic redraw on this event
|
|
1252
|
+
_this._loadingState = true;
|
|
1231
1253
|
_this.clear();
|
|
1254
|
+
_this._loadingState = false;
|
|
1232
1255
|
}
|
|
1233
1256
|
});
|
|
1234
1257
|
}
|
|
@@ -1425,22 +1448,23 @@ var searchDateTime = {
|
|
|
1425
1448
|
var moment = DataTable.use('moment');
|
|
1426
1449
|
var luxon = DataTable.use('luxon');
|
|
1427
1450
|
var dt = this.dt();
|
|
1451
|
+
var i18nBase = 'columnControl.search.datetime.';
|
|
1428
1452
|
var displayFormat = '';
|
|
1429
1453
|
var dateTime;
|
|
1430
1454
|
var searchInput = new SearchInput(dt, this.idx())
|
|
1431
1455
|
.type('date')
|
|
1432
|
-
.addClass('dtcc-
|
|
1456
|
+
.addClass('dtcc-searchDateTime')
|
|
1433
1457
|
.clearable(config.clear)
|
|
1434
1458
|
.placeholder(config.placeholder)
|
|
1435
1459
|
.title(config.title)
|
|
1436
1460
|
.titleAttr(config.titleAttr)
|
|
1437
1461
|
.options([
|
|
1438
|
-
{ label: 'Equals', value: 'equal' },
|
|
1439
|
-
{ label: 'Does not equal', value: 'notEqual' },
|
|
1440
|
-
{ label: 'After', value: 'greater' },
|
|
1441
|
-
{ label: 'Before', value: 'less' },
|
|
1442
|
-
{ label: 'Empty', value: 'empty' },
|
|
1443
|
-
{ label: 'Not empty', value: 'notEmpty' }
|
|
1462
|
+
{ label: dt.i18n(i18nBase + 'equal', 'Equals'), value: 'equal' },
|
|
1463
|
+
{ label: dt.i18n(i18nBase + 'notEqual', 'Does not equal'), value: 'notEqual' },
|
|
1464
|
+
{ label: dt.i18n(i18nBase + 'greater', 'After'), value: 'greater' },
|
|
1465
|
+
{ label: dt.i18n(i18nBase + 'less', 'Before'), value: 'less' },
|
|
1466
|
+
{ label: dt.i18n(i18nBase + 'empty', 'Empty'), value: 'empty' },
|
|
1467
|
+
{ label: dt.i18n(i18nBase + 'notEmpty', 'Not empty'), value: 'notEmpty' }
|
|
1444
1468
|
])
|
|
1445
1469
|
.search(function (searchType, searchTerm, loadingState) {
|
|
1446
1470
|
var column = dt.column(_this.idx());
|
|
@@ -1716,12 +1740,14 @@ var searchList = {
|
|
|
1716
1740
|
.title(dt
|
|
1717
1741
|
.i18n('columnControl.searchList', config.title)
|
|
1718
1742
|
.replace('[title]', dt.column(this.idx()).title()))
|
|
1719
|
-
.handler(function (e, btn) {
|
|
1743
|
+
.handler(function (e, btn, btns, redraw) {
|
|
1720
1744
|
if (btn) {
|
|
1721
1745
|
btn.active(!btn.active());
|
|
1722
1746
|
}
|
|
1723
1747
|
applySearch(checkList.values());
|
|
1724
|
-
|
|
1748
|
+
if (redraw) {
|
|
1749
|
+
dt.draw();
|
|
1750
|
+
}
|
|
1725
1751
|
});
|
|
1726
1752
|
if (config.options) {
|
|
1727
1753
|
setOptions(checkList, config.options);
|
|
@@ -1775,6 +1801,7 @@ var searchNumber = {
|
|
|
1775
1801
|
init: function (config) {
|
|
1776
1802
|
var _this = this;
|
|
1777
1803
|
var dt = this.dt();
|
|
1804
|
+
var i18nBase = 'columnControl.search.number.';
|
|
1778
1805
|
var searchInput = new SearchInput(dt, this.idx())
|
|
1779
1806
|
.type('num')
|
|
1780
1807
|
.addClass('dtcc-searchNumber')
|
|
@@ -1783,14 +1810,17 @@ var searchNumber = {
|
|
|
1783
1810
|
.title(config.title)
|
|
1784
1811
|
.titleAttr(config.titleAttr)
|
|
1785
1812
|
.options([
|
|
1786
|
-
{ label: 'Equals', value: 'equal' },
|
|
1787
|
-
{ label: 'Does not equal', value: 'notEqual' },
|
|
1788
|
-
{ label: 'Greater than', value: 'greater' },
|
|
1789
|
-
{
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
{ label: '
|
|
1813
|
+
{ label: dt.i18n(i18nBase + 'equal', 'Equals'), value: 'equal' },
|
|
1814
|
+
{ label: dt.i18n(i18nBase + 'notEqual', 'Does not equal'), value: 'notEqual' },
|
|
1815
|
+
{ label: dt.i18n(i18nBase + 'greater', 'Greater than'), value: 'greater' },
|
|
1816
|
+
{
|
|
1817
|
+
label: dt.i18n(i18nBase + 'greaterOrEqual', 'Greater or equal'),
|
|
1818
|
+
value: 'greaterOrEqual'
|
|
1819
|
+
},
|
|
1820
|
+
{ label: dt.i18n(i18nBase + 'less', 'Less than'), value: 'less' },
|
|
1821
|
+
{ label: dt.i18n(i18nBase + 'lessOrEqual', 'Less or equal'), value: 'lessOrEqual' },
|
|
1822
|
+
{ label: dt.i18n(i18nBase + 'empty', 'Empty'), value: 'empty' },
|
|
1823
|
+
{ label: dt.i18n(i18nBase + 'notEmpty', 'Not empty'), value: 'notEmpty' }
|
|
1794
1824
|
])
|
|
1795
1825
|
.search(function (searchType, searchTerm, loadingState) {
|
|
1796
1826
|
var column = dt.column(_this.idx());
|
|
@@ -1869,6 +1899,7 @@ var searchText = {
|
|
|
1869
1899
|
init: function (config) {
|
|
1870
1900
|
var _this = this;
|
|
1871
1901
|
var dt = this.dt();
|
|
1902
|
+
var i18nBase = 'columnControl.search.text.';
|
|
1872
1903
|
var searchInput = new SearchInput(dt, this.idx())
|
|
1873
1904
|
.addClass('dtcc-searchText')
|
|
1874
1905
|
.clearable(config.clear)
|
|
@@ -1876,14 +1907,17 @@ var searchText = {
|
|
|
1876
1907
|
.title(config.title)
|
|
1877
1908
|
.titleAttr(config.titleAttr)
|
|
1878
1909
|
.options([
|
|
1879
|
-
{ label: 'Contains', value: 'contains' },
|
|
1880
|
-
{
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
{ label: '
|
|
1885
|
-
{ label: '
|
|
1886
|
-
{ label: '
|
|
1910
|
+
{ label: dt.i18n(i18nBase + 'contains', 'Contains'), value: 'contains' },
|
|
1911
|
+
{
|
|
1912
|
+
label: dt.i18n(i18nBase + 'notContains', 'Does not contain'),
|
|
1913
|
+
value: 'notContains'
|
|
1914
|
+
},
|
|
1915
|
+
{ label: dt.i18n(i18nBase + 'equal', 'Equals'), value: 'equal' },
|
|
1916
|
+
{ label: dt.i18n(i18nBase + 'notEqual', 'Does not equal'), value: 'notEqual' },
|
|
1917
|
+
{ label: dt.i18n(i18nBase + 'starts', 'Starts'), value: 'starts' },
|
|
1918
|
+
{ label: dt.i18n(i18nBase + 'ends', 'Ends'), value: 'ends' },
|
|
1919
|
+
{ label: dt.i18n(i18nBase + 'empty', 'Empty'), value: 'empty' },
|
|
1920
|
+
{ label: dt.i18n(i18nBase + 'notEmpty', 'Not empty'), value: 'notEmpty' }
|
|
1887
1921
|
])
|
|
1888
1922
|
.search(function (searchType, searchTerm, loadingState) {
|
|
1889
1923
|
var column = dt.column(_this.idx());
|
|
@@ -2006,7 +2040,7 @@ var searchClear = {
|
|
|
2006
2040
|
.icon(config.icon)
|
|
2007
2041
|
.className(config.className)
|
|
2008
2042
|
.handler(function () {
|
|
2009
|
-
dt.column(_this.idx()).ccSearchClear();
|
|
2043
|
+
dt.column(_this.idx()).ccSearchClear().draw();
|
|
2010
2044
|
})
|
|
2011
2045
|
.enable(false);
|
|
2012
2046
|
dt.on('draw', function () {
|
|
@@ -2261,7 +2295,7 @@ var ColumnControl = /** @class */ (function () {
|
|
|
2261
2295
|
/** SVG icons that can be used by the content plugins */
|
|
2262
2296
|
ColumnControl.icons = icons;
|
|
2263
2297
|
/** Version */
|
|
2264
|
-
ColumnControl.version = '1.0.
|
|
2298
|
+
ColumnControl.version = '1.0.4';
|
|
2265
2299
|
return ColumnControl;
|
|
2266
2300
|
}());
|
|
2267
2301
|
|
|
@@ -2331,6 +2365,7 @@ $(document).on('preInit.dt', function (e, settings) {
|
|
|
2331
2365
|
DataTable.Api.registerPlural('columns().ccSearchClear()', 'column().ccSearchClear()', function () {
|
|
2332
2366
|
var ctx = this;
|
|
2333
2367
|
return this.iterator('column', function (settings, idx) {
|
|
2368
|
+
// Note that the listeners for this will not redraw the table.
|
|
2334
2369
|
ctx.trigger('cc-search-clear', [idx]);
|
|
2335
2370
|
});
|
|
2336
2371
|
});
|
|
@@ -2356,6 +2391,7 @@ DataTable.ext.buttons.ccSearchClear = {
|
|
|
2356
2391
|
action: function (e, dt, node, config) {
|
|
2357
2392
|
dt.search('');
|
|
2358
2393
|
dt.columns().ccSearchClear();
|
|
2394
|
+
dt.draw();
|
|
2359
2395
|
}
|
|
2360
2396
|
};
|
|
2361
2397
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/*! ColumnControl 1.0.
|
|
1
|
+
/*! ColumnControl 1.0.4
|
|
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=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.offsetLeft,n=e.offsetWidth;n<r+o&&(r-=r+o-n),r<i&&(r=i),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-searchDate").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.2",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,s){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=s.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 l(t,e){return e.closest("div.dtfh-floatingparent")||t.table().container()}function d(t,e,n){var r=n.closest("div.dt-column-header"),e=l(e,n),r=getComputedStyle(r),o=t.offsetWidth,i=((t,e)=>{for(var n=0,r=0;e&&e!==t&&e!==s.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 u(e,t,n){function r(t){e._shown?t.target===e||e.contains(t.target)||(e._close(),s.body.removeEventListener("click",r)):s.body.removeEventListener("click",r)}var o=l(t,n.element());e._shown=!0,o.append(e),d(e,t,n.element());s.body.addEventListener("click",r)}var h={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=y("div",h.classes.container,"",[y("div",h.classes.liner)]),t=(r._shown=!1,r._close=function(){r.remove(),r._shown=!1},n.on("fixedheader-mode",function(){r._shown&&u(r,n,e._parents?e._parents[0]:o)}),r.childNodes[0]),o=new p(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)||u(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(){d(r,n,o.element())}),o.element()}},o=0,p=(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?c[t]:"",this},n.prototype.handler=function(n){function t(t){var e;void 0===(e=t)&&(e=null),s.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?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)},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 p(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 f=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 f(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 p(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 p(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 p(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 p(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 p(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 p(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 p(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 p(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 p(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 p(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()}},Q={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,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 N={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 f(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()}},M={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 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()}},U=/<([^>]*>)/g,$=/['\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(U,"").replace($,""):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:h,reorder:R,reorderLeft:H,reorderRight:V,order:Y,orderAddAsc:W,orderAddDesc:B,orderAsc:P,orderClear:z,orderDesc:F,orderRemove:G,orderStatus:Q,search:{defaults:{allowSearchList:!1},init:function(n){function e(t){var e=A(i,a);return n.allowSearchList&&e?N.init.call(o,Object.assign({},N.defaults,n)):"date"===t||t.startsWith("datetime")?b.init.call(o,Object.assign({},b.defaults,n)):t.includes("num")?M.init.call(o,Object.assign({},M.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=s.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 p(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:N,searchNumber:M,searchText:q,spacer:{defaults:{className:"dtcc-spacer",text:""},init:function(t){var e=this.dt();return y("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 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=p,S.CheckList=f,S.SearchInput=v,S.content=r,S.defaults={className:"",content:null,target:0},S.icons=c,S.version="1.0.4",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=s.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 O(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 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: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(s).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),k(i,r),k(i,o),n.columns().every(function(t){var e=this.init().columnControl;k(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(s).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,k(d=[],c),k(d,l),s.columns().every(function(t){for(var e=this.init().columnControl,n=k(d.slice(),e),r=0;r<n.length;r++){var o=O(n[r],e),i=O(n[r],c),a=O(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:"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});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/*! ColumnControl 1.0.
|
|
1
|
+
/*! ColumnControl 1.0.4
|
|
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
|
-
import jQuery from"jquery";import DataTable from"datatables.net";let $=jQuery;function createElement(t,e,n,r){void 0===e&&(e=[]),void 0===n&&(n=null),void 0===r&&(r=[]);var o=document.createElement(t);return addClass(o,e),n&&(o.innerHTML=n),r.forEach(function(t){o.appendChild(t)}),o}function addClass(e,t){t&&(t=Array.isArray(t)?t:[t]).forEach(function(t){t&&e.classList.add(t)})}function wrap(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 icons={chevronRight:wrap('<path d="m9 18 6-6-6-6"/>'),columns:wrap('<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/><path d="M15 3v18"/>'),contains:wrap('<path d="M10 3h4v18h-4z"/><path d="M18 8h3v9h-3"/><path d="M6 17H3V8h3"/>'),empty:wrap('<circle cx="12" cy="12" r="10"/>'),ends:wrap('<path d="M21 3h-4v18h4z"/><path d="M13 8H3v9h10"/>'),equal:wrap('<line x1="5" x2="19" y1="9" y2="9"/><line x1="5" x2="19" y1="15" y2="15"/>'),greater:wrap('<path d="m9 18 6-6-6-6"/>'),greaterOrEqual:wrap('<path d="m9 16 6-6-6-6"/><path d="m9 21 6-6"/>'),less:wrap('<path d="m15 18-6-6 6-6"/>'),lessOrEqual:wrap('<path d="m15 16-6-6 6-6"/><path d="m15 21-6-6"/>'),menu:wrap('<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:wrap('<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:wrap('<path d="m9 6-6 6 6 6"/><path d="M3 12h14"/><path d="M21 19V5"/>'),moveRight:wrap('<path d="M3 5v14"/><path d="M21 12H7"/><path d="m15 18 6-6-6-6"/>'),notContains:wrap('<path d="M15 4 9 20"/><path d="M3 8h18v9H3z"/>'),notEmpty:wrap('<circle cx="12" cy="12" r="10"/><line x1="9" x2="15" y1="15" y2="9"/>'),notEqual:wrap('<path d="M5 9h14"/><path d="M5 15h14"/><path d="M15 5 9 19"/>'),orderAddAsc:wrap('<path d="M17 21v-8"/><path d="M3 4h6"/><path d="M3 8h9"/><path d="M3 12h10"/><path d="M13 17h8"/>'),orderAddDesc:wrap('<path d="M17 21v-8"/><path d="M3 4h12"/><path d="M3 8h9"/><path d="M3 12h6"/><path d="M13 17h8"/>'),orderAsc:wrap('<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:wrap('<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:wrap('<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:wrap('<path d="M3 4h12"/><path d="M3 8h9"/><path d="M3 12h6"/><path d="M13 17h8"/>'),orderNone:wrap('<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:wrap('<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>'),searchClear:wrap('<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:wrap('<path d="M3 3h4v18H3z"/><path d="M11 8h10v9H11"/>'),tick:wrap('<path d="M20 6 9 17l-5-5"/>'),x:wrap('<path d="M18 6 6 18"/><path d="m6 6 12 12"/>')};function close(e){void 0===e&&(e=null),document.querySelectorAll("div.dtcc-dropdown").forEach(function(t){null!==e&&t.contains(e.target)||(t._close(),e._closed||(e._closed=[]),e._closed.push(t))})}function positionDropdown(t,e,n){var e=e.table().container(),r=n.closest("div.dt-column-header"),r=getComputedStyle(r),o=t.offsetWidth,i=relativePosition(e,n),a=i.top+n.offsetHeight,r="row-reverse"===r.flexDirection?i.left:i.left-o+n.offsetWidth,i=e.offsetLeft,n=e.offsetWidth;n<r+o&&(r-=r+o-n),r<i&&(r=i),t.style.top=a+"px",t.style.left=r+"px"}function attachDropdown(e,t,n){function r(t){e._shown?t.target===e||e.contains(t.target)||(e._close(),document.body.removeEventListener("click",r)):document.body.removeEventListener("click",r)}var o=t.table().container();e._shown=!0,o.append(e),positionDropdown(e,t,n.element());return document.body.addEventListener("click",r),r}function relativePosition(t,e){for(var n=0,r=0;e&&e!==t&&e!==document.body;)n+=e.offsetTop,r+=e.offsetLeft,e=e.offsetParent;return{top:n,left:r}}var dropdownContent={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=createElement("div",dropdownContent.classes.container,"",[createElement("div",dropdownContent.classes.liner)]),t=(r._shown=!1,r._close=function(){r.remove(),r._shown=!1},r.childNodes[0]),o=new Button(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)||attachDropdown(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(){positionDropdown(r,n,o.element())}),o.element()}},_namespace=0,Button=(()=>{function e(t){this._s={active:!1,activeList:[],buttonClick:null,dt:null,enabled:!0,label:"",namespace:"",value:null},this._s.dt=t,this._dom={button:createElement("button",e.classes.container),dropdownDisplay:null,extra:createElement("span","dtcc-button-extra"),icon:createElement("span","dtcc-button-icon"),state:createElement("span","dtcc-button-state"),text:createElement("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)}return e.prototype.active=function(t){return void 0===t?this._s.active:(this._s.active=t,this._checkActive(),this)},e.prototype.activeList=function(t,e){return this._s.activeList[t]=e,this._checkActive(),this},e.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},e.prototype.className=function(t){return this._dom.button.classList.add("dtcc-button_"+t),this},e.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)},e.prototype.dropdownDisplay=function(t){return this._dom.dropdownDisplay=t,this},e.prototype.element=function(){return this._dom.button},e.prototype.enable=function(t){return this._dom.button.classList.toggle("dtcc-button_disabled",!t),this._s.enabled=t,this},e.prototype.extra=function(t){return this._dom.extra.innerHTML=t?icons[t]:"",this},e.prototype.handler=function(e){function t(t){close(t),t.stopPropagation(),t.preventDefault(),n._s.enabled&&e(t)}var n=this;return this._s.buttonClick=t,this._s.namespace="dtcc-"+_namespace++,this._dom.button.addEventListener("click",t),this._s.dt.on("destroy."+this._s.namespace,function(){n.destroy()}),this},e.prototype.icon=function(t){return this._dom.icon.innerHTML=t?icons[t]:"",this},e.prototype.text=function(t){return void 0===t?this._s.label:(this._dom.text.innerHTML=t,this._s.label=t,this)},e.prototype.value=function(t){return void 0===t?this._s.value:(this._s.value=t,this)},e.prototype._checkActive=function(){return!0===this._s.active||Object.values(this._s.activeList).includes(!0)?(this._dom.state.innerHTML=icons.tick,this._dom.button.classList.add("dtcc-button_active")):(this._dom.state.innerHTML="",this._dom.button.classList.remove("dtcc-button_active")),this},e.classes={container:"dtcc-button"},e})(),CheckList=(()=>{function s(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:createElement("div","dtcc-list-buttons"),container:createElement("div",s.classes.container),controls:createElement("div","dtcc-list-controls"),title:createElement("div","dtcc-list-title"),selectAll:createElement("button","dtcc-list-selectAll",t.i18n("columnControl.list.all","Select all")),selectAllCount:createElement("span"),selectNone:createElement("button","dtcc-list-selectNone",t.i18n("columnControl.list.none","Deselect")),selectNoneCount:createElement("span"),search:createElement("input",s.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)})}return s.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 Button(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},s.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},s.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},s.prototype.element=function(){return this._dom.container},s.prototype.handler=function(t){return this._s.handler=t,this},s.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},s.prototype.selectAll=function(){for(var t=0;t<this._s.buttons.length;t++)this._s.buttons[t].active(!0);return this},s.prototype.selectNone=function(){for(var t=0;t<this._s.buttons.length;t++)this._s.buttons[t].active(!1);return this},s.prototype.title=function(t){return this._dom.title.innerHTML=t,this},s.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},s.prototype._updateCount=function(){var t=this.values().length;this._dom.selectNoneCount.innerHTML=t?"("+t+")":""},s.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())}},s.classes={container:"dtcc-list",input:"dtcc-list-search"},s})(),colVis={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 CheckList(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()}},colVisDropdown={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"})]}}},reorder={defaults:{className:"reorder",icon:"move",text:"Reorder columns"},init:function(t){var n=this,e=this.dt(),r=new Button(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 DataTable.ColReorder(e,{}),r.element()}},reorderLeft={defaults:{className:"reorderLeft",icon:"moveLeft",text:"Move column left"},init:function(t){var n=this,e=this.dt(),r=new Button(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()}},reorderRight={defaults:{className:"reorderRight",icon:"moveRight",text:"Move column right"},init:function(t){var n=this,r=this.dt(),o=new Button(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()}},order={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 Button(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()}},orderAddAsc={defaults:{className:"orderAddAsc",icon:"orderAddAsc",text:"Add Sort Ascending"},init:function(t){var r=this,e=this.dt(),o=new Button(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()}},orderAddDesc={defaults:{className:"orderAddDesc",icon:"orderAddDesc",text:"Add Sort Descending"},init:function(t){var r=this,e=this.dt(),o=new Button(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()}},orderAsc={defaults:{className:"orderAsc",icon:"orderAsc",text:"Sort Ascending"},init:function(t){var r=this,e=this.dt(),o=new Button(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()}},orderClear={defaults:{className:"orderClear",icon:"orderClear",text:"Clear sort"},init:function(t){var e=this.dt(),r=new Button(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()}},orderDesc={defaults:{className:"orderDesc",icon:"orderDesc",text:"Sort Descending"},init:function(t){var r=this,e=this.dt(),o=new Button(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()}},orderRemove={defaults:{className:"orderRemove",icon:"orderRemove",text:"Remove from sort"},init:function(t){var r=this,n=this.dt(),o=new Button(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()}},orderStatus={defaults:{className:"order",iconAsc:"orderAsc",iconDesc:"orderDesc",iconNone:"orderNone",statusOnly:!0,text:"Sort status"},extend:function(t){return Object.assign(t,{extend:"order"})}},SearchInput=(()=>{function c(n,r){function t(){i.runSearch()}function e(){a.typeIcon.innerHTML=icons[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:createElement("span","dtcc-search-clear",icons.x),container:createElement("div",c.classes.container),typeIcon:createElement("div","dtcc-search-type-icon"),searchIcon:createElement("div","dtcc-search-icon",icons.search),input:createElement("input",c.classes.input),inputs:createElement("div"),select:createElement("select",c.classes.select),title:createElement("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.clear()})}return c.prototype.addClass=function(t){return this._dom.container.classList.add(t),this},c.prototype.clear=function(){return this.set(this._dom.select.children[0].getAttribute("value"),""),this},c.prototype.clearable=function(t){return t||this._dom.clear.remove(),this},c.prototype.element=function(){return this._dom.container},c.prototype.input=function(){return this._dom.input},c.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=icons[t[0].value],this},c.prototype.placeholder=function(t){var e;return t&&(e=this._dt.column(this._idx).title(),this._dom.input.placeholder=t.replace("[title]",e)),this},c.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)},c.prototype.search=function(t){return this._search=t,this._stateLoad(this._dt.state.loaded()),this},c.prototype.set=function(t,e){var n=this._dom;return n.input.value=e,n.select.value=t,n.typeIcon.innerHTML=icons[n.select.value],this.runSearch(),this},c.prototype.title=function(t){var e;return t&&(e=this._dt.column(this._idx).title(),this._dom.title.innerHTML=t.replace("[title]",e)),this},c.prototype.titleAttr=function(t){var e;return t&&(e=this._dt.column(this._idx).title(),this._dom.input.title=t.replace("[title]",e)),this},c.prototype.type=function(t){return this._type=t,this},c.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)},c.classes={container:["dtcc-content","dtcc-search"],input:"",select:""},c})(),searchDateTime={defaults:{clear:!0,placeholder:"",title:"",titleAttr:""},init:function(i){var a,s=this,c=!1,l=DataTable.use("moment"),d=DataTable.use("luxon"),u=this.dt(),h="",e=new SearchInput(u,this.idx()).type("date").addClass("dtcc-searchDate").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(s.idx()),o=""===e?"":dateToNum(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 dateToNum(t,h,l,d)==o}):"notEqual"===t?r.search.fixed("dtcc",function(t){return dateToNum(t,h,l,d)!=o}):"greater"===t?r.search.fixed("dtcc",function(t){return dateToNum(t,h,l,d)>o}):"less"===t&&r.search.fixed("dtcc",function(t){return dateToNum(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=DataTable.use("datetime");h=getFormat(u,s.idx()),t&&(a=new t(e.input(),{format:h,onChange:function(){c=!0,e.runSearch(),c=!1}}))}),e.element()}};function getFormat(t,e){t=t.column(e).type();if(t)if("datetime"===t){var e=DataTable.use("moment"),n=DataTable.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"}function dateToNum(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 setOptions(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 getState(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 getJsonOptions(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 reloadOptions(t,e,n,r,o){var i=null==(i=t.ajax.json())?void 0:i.columnControl,a=[],s=getJsonOptions(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}))}}setOptions(r,a),o&&r.values(o)}var searchList={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(),s=new CheckList(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(s.values()),a.draw()});return r.options?setOptions(s,r.options):a.ready(function(){reloadOptions(a,r,o.idx(),s,i)}),a.on("xhr",function(t,e,n){reloadOptions(a,r,o.idx(),s,i)}),a.on("stateLoaded",function(t,e,n){n=getState(o.idx(),n);n&&s.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()?s.values():i}),i=getState(this.idx(),a.state.loaded()),n(i),s.element()}},searchNumber={defaults:{clear:!0,placeholder:"",title:"",titleAttr:""},init:function(o){var i=this,a=this.dt(),t=new SearchInput(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 stringToNum(t)==e}):"notEqual"===t?r.search.fixed("dtcc",function(t){return stringToNum(t)!=e}):"greater"===t?r.search.fixed("dtcc",function(t){return stringToNum(t)>e}):"greaterOrEqual"===t?r.search.fixed("dtcc",function(t){return stringToNum(t)>=e}):"less"===t?r.search.fixed("dtcc",function(t){return stringToNum(t)<e}):"lessOrEqual"===t&&r.search.fixed("dtcc",function(t){return stringToNum(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()}},_re_html=/<([^>]*>)/g,_re_formatted_numeric=/['\u00A0,$£€¥%\u2009\u202F\u20BD\u20a9\u20BArfkɃΞ]/gi;function stringToNum(t){var e;return 0===t||t&&"-"!==t?"number"==(e=typeof t)||"bigint"==e?t:+(t=t.replace?t.replace(_re_html,"").replace(_re_formatted_numeric,""):t):-1/0}var searchText={defaults:{clear:!0,placeholder:"",title:"",titleAttr:""},init:function(o){var i=this,a=this.dt();return new SearchInput(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()}},search={defaults:{allowSearchList:!1},init:function(n){function e(t){var e=getJsonOptions(i,a);return n.allowSearchList&&e?searchList.init.call(o,Object.assign({},searchList.defaults,n)):"date"===t||t.startsWith("datetime")?searchDateTime.init.call(o,Object.assign({},searchDateTime.defaults,n)):t.includes("num")?searchNumber.init.call(o,Object.assign({},searchNumber.defaults,n)):searchText.init.call(o,Object.assign({},searchText.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=document.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 Button(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"})]}}},spacer={defaults:{className:"dtcc-spacer",text:""},init:function(t){var e=this.dt();return createElement("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 createElement("div",t.className,n.replace("[title]",e))}},contentTypes={colVis:colVis,colVisDropdown:colVisDropdown,dropdown:dropdownContent,reorder:reorder,reorderLeft:reorderLeft,reorderRight:reorderRight,order:order,orderAddAsc:orderAddAsc,orderAddDesc:orderAddDesc,orderAsc:orderAsc,orderClear:orderClear,orderDesc:orderDesc,orderRemove:orderRemove,orderStatus:orderStatus,search:search,searchClear:searchClear,searchDropdown:searchDropdown,searchDateTime:searchDateTime,searchList:searchList,searchNumber:searchNumber,searchText:searchText,spacer:spacer,title:title},ColumnControl=(()=>{function i(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,i.defaults,e),this._dom.target=this._target(),e.className&&addClass(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=document.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()}))}return i.prototype.dt=function(){return this._dt},i.prototype.idx=function(){return this._s.columnIdx},i.prototype.resolve=function(t){var e=null,n=null,r=null;if("string"==typeof t?(e=i.content[r=t],n=Object.assign({},null==e?void 0:e.defaults)):Array.isArray(t)?(e=i.content[r="dropdown"],n=Object.assign({},null==e?void 0:e.defaults,{content:t})):t.extend&&(r=t.extend,e=i.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)},i.prototype.unique=function(){return this._s.unique},i.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)},i.Button=Button,i.CheckList=CheckList,i.SearchInput=SearchInput,i.content=contentTypes,i.defaults={className:"",content:null,target:0},i.icons=icons,i.version="1.0.2",i})();function assetTarget(t,e,n){if(!t[e]){var r=!0,o=0,i=("number"==typeof e?o=e:("tfoot"===(i=e.split(":"))[0]&&(r=!1),i[1]&&(o=parseInt(i[1]))),r?n.table().header():n.table().footer());if(!i.querySelectorAll("tr")[o]){var a=n.columns().count(),s=createElement("tr");s.setAttribute("data-dt-order","disable");for(var c=0;c<a;c++)s.appendChild(createElement("td"));i.appendChild(s)}t[e]=!0}}function getOptionsForTarget(t,e){var n=ColumnControl.defaults.target;if(isIContentArray(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(isIContentArray(o)){if(n===t)return{target:n,content:o}}else if(isIConfig(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(isIConfig(e)){if(t===(void 0!==e.target?e.target:n))return e}else if(t===n)return{target:n,content:e}}function identifyTargets(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:ColumnControl.defaults).target)}):"object"==typeof t&&n((void 0!==t.target?t:ColumnControl.defaults).target),e}function isIConfig(t){return"object"==typeof t&&void 0!==t.target}function isIContentArray(t){var e=!1;if(!Array.isArray(t))return!1;for(var n=0;n<t.length;n++)if(isIConfig(t[n])){e=!0;break}return!e}DataTable.ColumnControl=ColumnControl,$(document).on("i18n.dt",function(t,e){if("dt"===t.namespace){var n=new DataTable.Api(e),t=n.table().header(),r=e.oInit.columnControl,o=ColumnControl.defaults,i=[],a={};t.querySelectorAll("tr").length<=1&&null===e.titleRow&&(e.titleRow=0),identifyTargets(i,r),identifyTargets(i,o),n.columns().every(function(t){var e=this.init().columnControl;identifyTargets(i,e)});for(var s=0;s<i.length;s++)assetTarget(a,i[s],n)}}),$(document).on("preInit.dt",function(t,e){var s,c,l,d;"dt"===t.namespace&&(s=new DataTable.Api(e),c=e.oInit.columnControl,l=ColumnControl.defaults,identifyTargets(d=[],c),identifyTargets(d,l),s.columns().every(function(t){for(var e=this.init().columnControl,n=identifyTargets(d.slice(),e),r=0;r<n.length;r++){var o=getOptionsForTarget(n[r],e),i=getOptionsForTarget(n[r],c),a=getOptionsForTarget(n[r],l);(a||i||o)&&new ColumnControl(s,this.index(),Object.assign({},a||{},i||{},o||{}))}}))}),DataTable.Api.registerPlural("columns().ccSearchClear()","column().ccSearchClear()",function(){var n=this;return this.iterator("column",function(t,e){n.trigger("cc-search-clear",[e])})}),DataTable.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()}};export default DataTable;
|
|
8
|
+
import jQuery from"jquery";import DataTable from"datatables.net";let $=jQuery;function createElement(t,e,n,r){void 0===e&&(e=[]),void 0===n&&(n=null),void 0===r&&(r=[]);var o=document.createElement(t);return addClass(o,e),n&&(o.innerHTML=n),r.forEach(function(t){o.appendChild(t)}),o}function addClass(e,t){t&&(t=Array.isArray(t)?t:[t]).forEach(function(t){e&&t&&e.classList.add(t)})}function wrap(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 icons={chevronRight:wrap('<path d="m9 18 6-6-6-6"/>'),columns:wrap('<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/><path d="M15 3v18"/>'),contains:wrap('<path d="M10 3h4v18h-4z"/><path d="M18 8h3v9h-3"/><path d="M6 17H3V8h3"/>'),empty:wrap('<circle cx="12" cy="12" r="10"/>'),ends:wrap('<path d="M21 3h-4v18h4z"/><path d="M13 8H3v9h10"/>'),equal:wrap('<line x1="5" x2="19" y1="9" y2="9"/><line x1="5" x2="19" y1="15" y2="15"/>'),greater:wrap('<path d="m9 18 6-6-6-6"/>'),greaterOrEqual:wrap('<path d="m9 16 6-6-6-6"/><path d="m9 21 6-6"/>'),less:wrap('<path d="m15 18-6-6 6-6"/>'),lessOrEqual:wrap('<path d="m15 16-6-6 6-6"/><path d="m15 21-6-6"/>'),menu:wrap('<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:wrap('<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:wrap('<path d="m9 6-6 6 6 6"/><path d="M3 12h14"/><path d="M21 19V5"/>'),moveRight:wrap('<path d="M3 5v14"/><path d="M21 12H7"/><path d="m15 18 6-6-6-6"/>'),notContains:wrap('<path d="M15 4 9 20"/><path d="M3 8h18v9H3z"/>'),notEmpty:wrap('<circle cx="12" cy="12" r="10"/><line x1="9" x2="15" y1="15" y2="9"/>'),notEqual:wrap('<path d="M5 9h14"/><path d="M5 15h14"/><path d="M15 5 9 19"/>'),orderAddAsc:wrap('<path d="M17 21v-8"/><path d="M3 4h6"/><path d="M3 8h9"/><path d="M3 12h10"/><path d="M13 17h8"/>'),orderAddDesc:wrap('<path d="M17 21v-8"/><path d="M3 4h12"/><path d="M3 8h9"/><path d="M3 12h6"/><path d="M13 17h8"/>'),orderAsc:wrap('<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:wrap('<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:wrap('<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:wrap('<path d="M3 4h12"/><path d="M3 8h9"/><path d="M3 12h6"/><path d="M13 17h8"/>'),orderNone:wrap('<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:wrap('<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>'),searchClear:wrap('<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:wrap('<path d="M3 3h4v18H3z"/><path d="M11 8h10v9H11"/>'),tick:wrap('<path d="M20 6 9 17l-5-5"/>'),x:wrap('<path d="M18 6 6 18"/><path d="m6 6 12 12"/>')};function close(e){void 0===e&&(e=null),document.querySelectorAll("div.dtcc-dropdown").forEach(function(t){null!==e&&t.contains(e.target)||(t._close(),e._closed||(e._closed=[]),e._closed.push(t))})}function getContainer(t,e){return e.closest("div.dtfh-floatingparent")||t.table().container()}function positionDropdown(t,e,n){var r=n.closest("div.dt-column-header"),e=getContainer(e,n),r=getComputedStyle(r),o=t.offsetWidth,i=relativePosition(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 attachDropdown(e,t,n){function r(t){e._shown?t.target===e||e.contains(t.target)||(e._close(),document.body.removeEventListener("click",r)):document.body.removeEventListener("click",r)}var o=getContainer(t,n.element());e._shown=!0,o.append(e),positionDropdown(e,t,n.element());return document.body.addEventListener("click",r),r}function relativePosition(t,e){for(var n=0,r=0;e&&e!==t&&e!==document.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}}var dropdownContent={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=createElement("div",dropdownContent.classes.container,"",[createElement("div",dropdownContent.classes.liner)]),t=(r._shown=!1,r._close=function(){r.remove(),r._shown=!1},n.on("fixedheader-mode",function(){r._shown&&attachDropdown(r,n,e._parents?e._parents[0]:o)}),r.childNodes[0]),o=new Button(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)||attachDropdown(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(){positionDropdown(r,n,o.element())}),o.element()}},_namespace=0,Button=(()=>{function e(t){this._s={active:!1,activeList:[],buttonClick:null,dt:null,enabled:!0,label:"",namespace:"",value:null},this._s.dt=t,this._dom={button:createElement("button",e.classes.container),dropdownDisplay:null,extra:createElement("span","dtcc-button-extra"),icon:createElement("span","dtcc-button-icon"),state:createElement("span","dtcc-button-state"),text:createElement("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)}return e.prototype.active=function(t){return void 0===t?this._s.active:(this._s.active=t,this._checkActive(),this)},e.prototype.activeList=function(t,e){return this._s.activeList[t]=e,this._checkActive(),this},e.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},e.prototype.className=function(t){return this._dom.button.classList.add("dtcc-button_"+t),this},e.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)},e.prototype.dropdownDisplay=function(t){return this._dom.dropdownDisplay=t,this},e.prototype.element=function(){return this._dom.button},e.prototype.enable=function(t){return this._dom.button.classList.toggle("dtcc-button_disabled",!t),this._s.enabled=t,this},e.prototype.extra=function(t){return this._dom.extra.innerHTML=t?icons[t]:"",this},e.prototype.handler=function(e){function t(t){close(t),t.stopPropagation(),t.preventDefault(),n._s.enabled&&e(t)}var n=this;return this._s.buttonClick=t,this._s.namespace="dtcc-"+_namespace++,this._dom.button.addEventListener("click",t),this._s.dt.on("destroy."+this._s.namespace,function(){n.destroy()}),this},e.prototype.icon=function(t){return this._dom.icon.innerHTML=t?icons[t]:"",this},e.prototype.text=function(t){return void 0===t?this._s.label:(this._dom.text.innerHTML=t,this._s.label=t,this)},e.prototype.value=function(t){return void 0===t?this._s.value:(this._s.value=t,this)},e.prototype._checkActive=function(){return!0===this._s.active||Object.values(this._s.activeList).includes(!0)?(this._dom.state.innerHTML=icons.tick,this._dom.button.classList.add("dtcc-button_active")):(this._dom.state.innerHTML="",this._dom.button.classList.remove("dtcc-button_active")),this},e.classes={container:"dtcc-button"},e})(),CheckList=(()=>{function s(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:createElement("div","dtcc-list-buttons"),container:createElement("div",s.classes.container),controls:createElement("div","dtcc-list-controls"),title:createElement("div","dtcc-list-title"),selectAll:createElement("button","dtcc-list-selectAll",t.i18n("columnControl.list.all","Select all")),selectAllCount:createElement("span"),selectNone:createElement("button","dtcc-list-selectNone",t.i18n("columnControl.list.none","Deselect")),selectNoneCount:createElement("span"),search:createElement("input",s.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)})}return s.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 Button(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},s.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},s.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},s.prototype.element=function(){return this._dom.container},s.prototype.handler=function(t){return this._s.handler=t,this},s.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},s.prototype.selectAll=function(){for(var t=0;t<this._s.buttons.length;t++)this._s.buttons[t].active(!0);return this},s.prototype.selectNone=function(){for(var t=0;t<this._s.buttons.length;t++)this._s.buttons[t].active(!1);return this},s.prototype.title=function(t){return this._dom.title.innerHTML=t,this},s.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},s.prototype._updateCount=function(){var t=this.values().length;this._dom.selectNoneCount.innerHTML=t?"("+t+")":""},s.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())}},s.classes={container:"dtcc-list",input:"dtcc-list-search"},s})(),colVis={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 CheckList(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()}},colVisDropdown={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"})]}}},reorder={defaults:{className:"reorder",icon:"move",text:"Reorder columns"},init:function(t){var n=this,e=this.dt(),r=new Button(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 DataTable.ColReorder(e,{}),r.element()}},reorderLeft={defaults:{className:"reorderLeft",icon:"moveLeft",text:"Move column left"},init:function(t){var n=this,e=this.dt(),r=new Button(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()}},reorderRight={defaults:{className:"reorderRight",icon:"moveRight",text:"Move column right"},init:function(t){var n=this,r=this.dt(),o=new Button(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()}},order={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 Button(t).text(t.i18n("columnControl.order",r.text)).icon("orderAsc").className(r.className);return r.statusOnly||t.order.listener(i.element(),DataTable.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()}},orderAddAsc={defaults:{className:"orderAddAsc",icon:"orderAddAsc",text:"Add Sort Ascending"},init:function(t){var r=this,e=this.dt(),o=new Button(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()}},orderAddDesc={defaults:{className:"orderAddDesc",icon:"orderAddDesc",text:"Add Sort Descending"},init:function(t){var r=this,e=this.dt(),o=new Button(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()}},orderAsc={defaults:{className:"orderAsc",icon:"orderAsc",text:"Sort Ascending"},init:function(t){var r=this,e=this.dt(),o=new Button(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()}},orderClear={defaults:{className:"orderClear",icon:"orderClear",text:"Clear sort"},init:function(t){var e=this.dt(),r=new Button(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()}},orderDesc={defaults:{className:"orderDesc",icon:"orderDesc",text:"Sort Descending"},init:function(t){var r=this,e=this.dt(),o=new Button(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()}},orderRemove={defaults:{className:"orderRemove",icon:"orderRemove",text:"Remove from sort"},init:function(t){var r=this,n=this.dt(),o=new Button(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()}},orderStatus={defaults:{className:"order",iconAsc:"orderAsc",iconDesc:"orderDesc",iconNone:"orderNone",statusOnly:!0,text:"Sort status"},extend:function(t){return Object.assign(t,{extend:"order"})}},SearchInput=(()=>{function c(n,r){function t(){i.runSearch()}function e(){a.typeIcon.innerHTML=icons[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:createElement("span","dtcc-search-clear",icons.x),container:createElement("div",c.classes.container),typeIcon:createElement("div","dtcc-search-type-icon"),searchIcon:createElement("div","dtcc-search-icon",icons.search),input:createElement("input",c.classes.input),inputs:createElement("div"),select:createElement("select",c.classes.select),title:createElement("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)})}return c.prototype.addClass=function(t){return this._dom.container.classList.add(t),this},c.prototype.clear=function(){return this.set(this._dom.select.children[0].getAttribute("value"),""),this},c.prototype.clearable=function(t){return t||this._dom.clear.remove(),this},c.prototype.element=function(){return this._dom.container},c.prototype.input=function(){return this._dom.input},c.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=icons[t[0].value],this},c.prototype.placeholder=function(t){var e;return t&&(e=this._dt.column(this._idx).title(),this._dom.input.placeholder=t.replace("[title]",e)),this},c.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)},c.prototype.search=function(t){return this._search=t,this._stateLoad(this._dt.state.loaded()),this},c.prototype.set=function(t,e){var n=this._dom;return n.input.value=e,n.select.value=t,n.typeIcon.innerHTML=icons[n.select.value],this.runSearch(),this},c.prototype.title=function(t){var e;return t&&(e=this._dt.column(this._idx).title(),this._dom.title.innerHTML=t.replace("[title]",e)),this},c.prototype.titleAttr=function(t){var e;return t&&(e=this._dt.column(this._idx).title(),this._dom.input.title=t.replace("[title]",e)),this},c.prototype.type=function(t){return this._type=t,this},c.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)},c.classes={container:["dtcc-content","dtcc-search"],input:"",select:""},c})(),searchDateTime={defaults:{clear:!0,placeholder:"",title:"",titleAttr:""},init:function(i){var a,s=this,c=!1,l=DataTable.use("moment"),d=DataTable.use("luxon"),u=this.dt(),t="columnControl.search.datetime.",h="",e=new SearchInput(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?"":dateToNum(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 dateToNum(t,h,l,d)==o}):"notEqual"===t?r.search.fixed("dtcc",function(t){return dateToNum(t,h,l,d)!=o}):"greater"===t?r.search.fixed("dtcc",function(t){return dateToNum(t,h,l,d)>o}):"less"===t&&r.search.fixed("dtcc",function(t){return dateToNum(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=DataTable.use("datetime");h=getFormat(u,s.idx()),t&&(a=new t(e.input(),{format:h,onChange:function(){c=!0,e.runSearch(),c=!1}}))}),e.element()}};function getFormat(t,e){t=t.column(e).type();if(t)if("datetime"===t){var e=DataTable.use("moment"),n=DataTable.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"}function dateToNum(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 setOptions(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 getState(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 getJsonOptions(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 reloadOptions(t,e,n,r,o){var i=null==(i=t.ajax.json())?void 0:i.columnControl,a=[],s=getJsonOptions(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}))}}setOptions(r,a),o&&r.values(o)}var searchList={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 CheckList(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?setOptions(c,r.options):s.ready(function(){reloadOptions(s,r,i.idx(),c,a)}),s.on("xhr",function(t,e,n){reloadOptions(s,r,i.idx(),c,a)}),s.on("stateLoaded",function(t,e,n){n=getState(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=getState(this.idx(),s.state.loaded()),o(a),c.element()}},searchNumber={defaults:{clear:!0,placeholder:"",title:"",titleAttr:""},init:function(o){var i=this,a=this.dt(),t="columnControl.search.number.",t=new SearchInput(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 stringToNum(t)==e}):"notEqual"===t?r.search.fixed("dtcc",function(t){return stringToNum(t)!=e}):"greater"===t?r.search.fixed("dtcc",function(t){return stringToNum(t)>e}):"greaterOrEqual"===t?r.search.fixed("dtcc",function(t){return stringToNum(t)>=e}):"less"===t?r.search.fixed("dtcc",function(t){return stringToNum(t)<e}):"lessOrEqual"===t&&r.search.fixed("dtcc",function(t){return stringToNum(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()}},_re_html=/<([^>]*>)/g,_re_formatted_numeric=/['\u00A0,$£€¥%\u2009\u202F\u20BD\u20a9\u20BArfkɃΞ]/gi;function stringToNum(t){var e;return 0===t||t&&"-"!==t?"number"==(e=typeof t)||"bigint"==e?t:+(t=t.replace?t.replace(_re_html,"").replace(_re_formatted_numeric,""):t):-1/0}var searchText={defaults:{clear:!0,placeholder:"",title:"",titleAttr:""},init:function(o){var i=this,a=this.dt(),t="columnControl.search.text.";return new SearchInput(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()}},search={defaults:{allowSearchList:!1},init:function(n){function e(t){var e=getJsonOptions(i,a);return n.allowSearchList&&e?searchList.init.call(o,Object.assign({},searchList.defaults,n)):"date"===t||t.startsWith("datetime")?searchDateTime.init.call(o,Object.assign({},searchDateTime.defaults,n)):t.includes("num")?searchNumber.init.call(o,Object.assign({},searchNumber.defaults,n)):searchText.init.call(o,Object.assign({},searchText.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=document.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 Button(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"})]}}},spacer={defaults:{className:"dtcc-spacer",text:""},init:function(t){var e=this.dt();return createElement("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 createElement("div",t.className,n.replace("[title]",e))}},contentTypes={colVis:colVis,colVisDropdown:colVisDropdown,dropdown:dropdownContent,reorder:reorder,reorderLeft:reorderLeft,reorderRight:reorderRight,order:order,orderAddAsc:orderAddAsc,orderAddDesc:orderAddDesc,orderAsc:orderAsc,orderClear:orderClear,orderDesc:orderDesc,orderRemove:orderRemove,orderStatus:orderStatus,search:search,searchClear:searchClear,searchDropdown:searchDropdown,searchDateTime:searchDateTime,searchList:searchList,searchNumber:searchNumber,searchText:searchText,spacer:spacer,title:title},ColumnControl=(()=>{function i(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,i.defaults,e),this._dom.target=this._target(),e.className&&addClass(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=document.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()}))}return i.prototype.dt=function(){return this._dt},i.prototype.idx=function(){return this._s.columnIdx},i.prototype.resolve=function(t){var e=null,n=null,r=null;if("string"==typeof t?(e=i.content[r=t],n=Object.assign({},null==e?void 0:e.defaults)):Array.isArray(t)?(e=i.content[r="dropdown"],n=Object.assign({},null==e?void 0:e.defaults,{content:t})):t.extend&&(r=t.extend,e=i.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)},i.prototype.unique=function(){return this._s.unique},i.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)},i.Button=Button,i.CheckList=CheckList,i.SearchInput=SearchInput,i.content=contentTypes,i.defaults={className:"",content:null,target:0},i.icons=icons,i.version="1.0.4",i})();function assetTarget(t,e,n){if(!t[e]){var r=!0,o=0,i=("number"==typeof e?o=e:("tfoot"===(i=e.split(":"))[0]&&(r=!1),i[1]&&(o=parseInt(i[1]))),r?n.table().header():n.table().footer());if(!i.querySelectorAll("tr")[o]){var a=n.columns().count(),s=createElement("tr");s.setAttribute("data-dt-order","disable");for(var c=0;c<a;c++)s.appendChild(createElement("td"));i.appendChild(s)}t[e]=!0}}function getOptionsForTarget(t,e){var n=ColumnControl.defaults.target;if(isIContentArray(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(isIContentArray(o)){if(n===t)return{target:n,content:o}}else if(isIConfig(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(isIConfig(e)){if(t===(void 0!==e.target?e.target:n))return e}else if(t===n)return{target:n,content:e}}function identifyTargets(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:ColumnControl.defaults).target)}):"object"==typeof t&&n((void 0!==t.target?t:ColumnControl.defaults).target),e}function isIConfig(t){return"object"==typeof t&&void 0!==t.target}function isIContentArray(t){var e=!1;if(!Array.isArray(t))return!1;for(var n=0;n<t.length;n++)if(isIConfig(t[n])){e=!0;break}return!e}DataTable.ColumnControl=ColumnControl,$(document).on("i18n.dt",function(t,e){if("dt"===t.namespace){var n=new DataTable.Api(e),t=n.table().header(),r=e.oInit.columnControl,o=ColumnControl.defaults,i=[],a={};t.querySelectorAll("tr").length<=1&&null===e.titleRow&&(e.titleRow=0),identifyTargets(i,r),identifyTargets(i,o),n.columns().every(function(t){var e=this.init().columnControl;identifyTargets(i,e)});for(var s=0;s<i.length;s++)assetTarget(a,i[s],n)}}),$(document).on("preInit.dt",function(t,e){var s,c,l,d;"dt"===t.namespace&&(s=new DataTable.Api(e),c=e.oInit.columnControl,l=ColumnControl.defaults,identifyTargets(d=[],c),identifyTargets(d,l),s.columns().every(function(t){for(var e=this.init().columnControl,n=identifyTargets(d.slice(),e),r=0;r<n.length;r++){var o=getOptionsForTarget(n[r],e),i=getOptionsForTarget(n[r],c),a=getOptionsForTarget(n[r],l);(a||i||o)&&new ColumnControl(s,this.index(),Object.assign({},a||{},i||{},o||{}))}}))}),DataTable.Api.registerPlural("columns().ccSearchClear()","column().ccSearchClear()",function(){var n=this;return this.iterator("column",function(t,e){n.trigger("cc-search-clear",[e])})}),DataTable.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(),e.draw()}};export default DataTable;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! ColumnControl 1.0.
|
|
1
|
+
/*! ColumnControl 1.0.4
|
|
2
2
|
* Copyright (c) SpryMedia Ltd - datatables.net/license
|
|
3
3
|
*
|
|
4
4
|
* SVG icons: ISC License
|
|
@@ -35,7 +35,7 @@ function addClass(el, classes) {
|
|
|
35
35
|
classes = [classes];
|
|
36
36
|
}
|
|
37
37
|
classes.forEach(function (className) {
|
|
38
|
-
if (className) {
|
|
38
|
+
if (el && className) {
|
|
39
39
|
el.classList.add(className);
|
|
40
40
|
}
|
|
41
41
|
});
|
|
@@ -117,6 +117,9 @@ function close(e) {
|
|
|
117
117
|
}
|
|
118
118
|
});
|
|
119
119
|
}
|
|
120
|
+
function getContainer(dt, btn) {
|
|
121
|
+
return btn.closest('div.dtfh-floatingparent') || dt.table().container();
|
|
122
|
+
}
|
|
120
123
|
/**
|
|
121
124
|
* Position the dropdown relative to the button that activated it, with possible corrections
|
|
122
125
|
* to make sure it is visible on the page.
|
|
@@ -126,11 +129,11 @@ function close(e) {
|
|
|
126
129
|
* @param btn Button the dropdown emanates from
|
|
127
130
|
*/
|
|
128
131
|
function positionDropdown(dropdown, dt, btn) {
|
|
129
|
-
var dtContainer = dt.table().container();
|
|
130
132
|
var header = btn.closest('div.dt-column-header');
|
|
133
|
+
var container = getContainer(dt, btn);
|
|
131
134
|
var headerStyle = getComputedStyle(header);
|
|
132
135
|
var dropdownWidth = dropdown.offsetWidth;
|
|
133
|
-
var position = relativePosition(
|
|
136
|
+
var position = relativePosition(container, btn);
|
|
134
137
|
var left, top;
|
|
135
138
|
top = position.top + btn.offsetHeight;
|
|
136
139
|
if (headerStyle.flexDirection === 'row-reverse') {
|
|
@@ -142,13 +145,12 @@ function positionDropdown(dropdown, dt, btn) {
|
|
|
142
145
|
left = position.left - dropdownWidth + btn.offsetWidth;
|
|
143
146
|
}
|
|
144
147
|
// Corrections - don't extend past the DataTable to the left and right
|
|
145
|
-
var
|
|
146
|
-
var containerWidth = dtContainer.offsetWidth;
|
|
148
|
+
var containerWidth = container.offsetWidth;
|
|
147
149
|
if (left + dropdownWidth > containerWidth) {
|
|
148
150
|
left -= left + dropdownWidth - containerWidth;
|
|
149
151
|
}
|
|
150
|
-
if (left <
|
|
151
|
-
left =
|
|
152
|
+
if (left < 0) {
|
|
153
|
+
left = 0;
|
|
152
154
|
}
|
|
153
155
|
dropdown.style.top = top + 'px';
|
|
154
156
|
dropdown.style.left = left + 'px';
|
|
@@ -162,7 +164,7 @@ function positionDropdown(dropdown, dt, btn) {
|
|
|
162
164
|
* @returns Function to call when the dropdown should be removed from the document
|
|
163
165
|
*/
|
|
164
166
|
function attachDropdown(dropdown, dt, btn) {
|
|
165
|
-
var dtContainer = dt.
|
|
167
|
+
var dtContainer = getContainer(dt, btn.element());
|
|
166
168
|
dropdown._shown = true;
|
|
167
169
|
dtContainer.append(dropdown);
|
|
168
170
|
positionDropdown(dropdown, dt, btn.element());
|
|
@@ -197,6 +199,12 @@ function relativePosition(parent, origin) {
|
|
|
197
199
|
while (origin && origin !== parent && origin !== document.body) {
|
|
198
200
|
top += origin.offsetTop;
|
|
199
201
|
left += origin.offsetLeft;
|
|
202
|
+
if (origin.scrollTop) {
|
|
203
|
+
left -= origin.scrollTop;
|
|
204
|
+
}
|
|
205
|
+
if (origin.scrollLeft) {
|
|
206
|
+
left -= origin.scrollLeft;
|
|
207
|
+
}
|
|
200
208
|
origin = origin.offsetParent;
|
|
201
209
|
}
|
|
202
210
|
return {
|
|
@@ -225,6 +233,13 @@ var dropdownContent = {
|
|
|
225
233
|
dropdown.remove();
|
|
226
234
|
dropdown._shown = false;
|
|
227
235
|
};
|
|
236
|
+
// When FixedHeader is used, the transition between states messes up positioning, so if
|
|
237
|
+
// shown we just reattach the dropdown.
|
|
238
|
+
dt.on('fixedheader-mode', function () {
|
|
239
|
+
if (dropdown._shown) {
|
|
240
|
+
attachDropdown(dropdown, dt, config._parents ? config._parents[0] : btn);
|
|
241
|
+
}
|
|
242
|
+
});
|
|
228
243
|
// A liner element allows more styling options, so the contents go inside this
|
|
229
244
|
var liner = dropdown.childNodes[0];
|
|
230
245
|
var btn = new Button(dt)
|
|
@@ -518,12 +533,12 @@ var CheckList = /** @class */ (function () {
|
|
|
518
533
|
};
|
|
519
534
|
var selectAllClick = function (e) {
|
|
520
535
|
_this.selectAll();
|
|
521
|
-
_this._s.handler(e, null, _this._s.buttons);
|
|
536
|
+
_this._s.handler(e, null, _this._s.buttons, true);
|
|
522
537
|
_this._updateCount();
|
|
523
538
|
};
|
|
524
539
|
var selectNoneClick = function (e) {
|
|
525
540
|
_this.selectNone();
|
|
526
|
-
_this._s.handler(e, null, _this._s.buttons);
|
|
541
|
+
_this._s.handler(e, null, _this._s.buttons, true);
|
|
527
542
|
_this._updateCount();
|
|
528
543
|
};
|
|
529
544
|
if (opts.search) {
|
|
@@ -555,12 +570,17 @@ var CheckList = /** @class */ (function () {
|
|
|
555
570
|
var btn = new Button(this_1._s.dt)
|
|
556
571
|
.active(option.active || false)
|
|
557
572
|
.handler(function (e) {
|
|
558
|
-
_this._s.handler(e, btn, _this._s.buttons);
|
|
573
|
+
_this._s.handler(e, btn, _this._s.buttons, true);
|
|
559
574
|
_this._updateCount();
|
|
560
575
|
})
|
|
561
576
|
.icon(option.icon || '')
|
|
562
|
-
.text(option.label
|
|
577
|
+
.text(option.label !== ''
|
|
578
|
+
? option.label
|
|
579
|
+
: this_1._s.dt.i18n('columnControl.list.emptyOption', 'Empty'))
|
|
563
580
|
.value(option.value);
|
|
581
|
+
if (option.label === '') {
|
|
582
|
+
btn.className('empty');
|
|
583
|
+
}
|
|
564
584
|
this_1._s.buttons.push(btn);
|
|
565
585
|
};
|
|
566
586
|
var this_1 = this;
|
|
@@ -633,7 +653,7 @@ var CheckList = /** @class */ (function () {
|
|
|
633
653
|
dt.on('cc-search-clear', function (e, colIdx) {
|
|
634
654
|
if (colIdx === parent.idx()) {
|
|
635
655
|
_this.selectNone();
|
|
636
|
-
_this._s.handler(e, null, _this._s.buttons);
|
|
656
|
+
_this._s.handler(e, null, _this._s.buttons, false);
|
|
637
657
|
_this._s.search = '';
|
|
638
658
|
_this._dom.search.value = '';
|
|
639
659
|
_this._redraw();
|
|
@@ -920,7 +940,7 @@ var order = {
|
|
|
920
940
|
.icon('orderAsc')
|
|
921
941
|
.className(config.className);
|
|
922
942
|
if (!config.statusOnly) {
|
|
923
|
-
dt.order.listener(btn.element(), this.idx(), function () { });
|
|
943
|
+
dt.order.listener(btn.element(), DataTable.versionCheck('2.3.2') ? function () { return [_this.idx()]; } : this.idx(), function () { });
|
|
924
944
|
}
|
|
925
945
|
dt.on('order', function (e, s, order) {
|
|
926
946
|
var found = order.find(function (o) { return o.col === _this.idx(); });
|
|
@@ -1188,7 +1208,10 @@ var SearchInput = /** @class */ (function () {
|
|
|
1188
1208
|
// Column control search clearing (column().ccSearchClear() method)
|
|
1189
1209
|
dt.on('cc-search-clear', function (e, colIdx) {
|
|
1190
1210
|
if (colIdx === _this._idx) {
|
|
1211
|
+
// Don't want an automatic redraw on this event
|
|
1212
|
+
_this._loadingState = true;
|
|
1191
1213
|
_this.clear();
|
|
1214
|
+
_this._loadingState = false;
|
|
1192
1215
|
}
|
|
1193
1216
|
});
|
|
1194
1217
|
}
|
|
@@ -1385,22 +1408,23 @@ var searchDateTime = {
|
|
|
1385
1408
|
var moment = DataTable.use('moment');
|
|
1386
1409
|
var luxon = DataTable.use('luxon');
|
|
1387
1410
|
var dt = this.dt();
|
|
1411
|
+
var i18nBase = 'columnControl.search.datetime.';
|
|
1388
1412
|
var displayFormat = '';
|
|
1389
1413
|
var dateTime;
|
|
1390
1414
|
var searchInput = new SearchInput(dt, this.idx())
|
|
1391
1415
|
.type('date')
|
|
1392
|
-
.addClass('dtcc-
|
|
1416
|
+
.addClass('dtcc-searchDateTime')
|
|
1393
1417
|
.clearable(config.clear)
|
|
1394
1418
|
.placeholder(config.placeholder)
|
|
1395
1419
|
.title(config.title)
|
|
1396
1420
|
.titleAttr(config.titleAttr)
|
|
1397
1421
|
.options([
|
|
1398
|
-
{ label: 'Equals', value: 'equal' },
|
|
1399
|
-
{ label: 'Does not equal', value: 'notEqual' },
|
|
1400
|
-
{ label: 'After', value: 'greater' },
|
|
1401
|
-
{ label: 'Before', value: 'less' },
|
|
1402
|
-
{ label: 'Empty', value: 'empty' },
|
|
1403
|
-
{ label: 'Not empty', value: 'notEmpty' }
|
|
1422
|
+
{ label: dt.i18n(i18nBase + 'equal', 'Equals'), value: 'equal' },
|
|
1423
|
+
{ label: dt.i18n(i18nBase + 'notEqual', 'Does not equal'), value: 'notEqual' },
|
|
1424
|
+
{ label: dt.i18n(i18nBase + 'greater', 'After'), value: 'greater' },
|
|
1425
|
+
{ label: dt.i18n(i18nBase + 'less', 'Before'), value: 'less' },
|
|
1426
|
+
{ label: dt.i18n(i18nBase + 'empty', 'Empty'), value: 'empty' },
|
|
1427
|
+
{ label: dt.i18n(i18nBase + 'notEmpty', 'Not empty'), value: 'notEmpty' }
|
|
1404
1428
|
])
|
|
1405
1429
|
.search(function (searchType, searchTerm, loadingState) {
|
|
1406
1430
|
var column = dt.column(_this.idx());
|
|
@@ -1676,12 +1700,14 @@ var searchList = {
|
|
|
1676
1700
|
.title(dt
|
|
1677
1701
|
.i18n('columnControl.searchList', config.title)
|
|
1678
1702
|
.replace('[title]', dt.column(this.idx()).title()))
|
|
1679
|
-
.handler(function (e, btn) {
|
|
1703
|
+
.handler(function (e, btn, btns, redraw) {
|
|
1680
1704
|
if (btn) {
|
|
1681
1705
|
btn.active(!btn.active());
|
|
1682
1706
|
}
|
|
1683
1707
|
applySearch(checkList.values());
|
|
1684
|
-
|
|
1708
|
+
if (redraw) {
|
|
1709
|
+
dt.draw();
|
|
1710
|
+
}
|
|
1685
1711
|
});
|
|
1686
1712
|
if (config.options) {
|
|
1687
1713
|
setOptions(checkList, config.options);
|
|
@@ -1735,6 +1761,7 @@ var searchNumber = {
|
|
|
1735
1761
|
init: function (config) {
|
|
1736
1762
|
var _this = this;
|
|
1737
1763
|
var dt = this.dt();
|
|
1764
|
+
var i18nBase = 'columnControl.search.number.';
|
|
1738
1765
|
var searchInput = new SearchInput(dt, this.idx())
|
|
1739
1766
|
.type('num')
|
|
1740
1767
|
.addClass('dtcc-searchNumber')
|
|
@@ -1743,14 +1770,17 @@ var searchNumber = {
|
|
|
1743
1770
|
.title(config.title)
|
|
1744
1771
|
.titleAttr(config.titleAttr)
|
|
1745
1772
|
.options([
|
|
1746
|
-
{ label: 'Equals', value: 'equal' },
|
|
1747
|
-
{ label: 'Does not equal', value: 'notEqual' },
|
|
1748
|
-
{ label: 'Greater than', value: 'greater' },
|
|
1749
|
-
{
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
{ label: '
|
|
1773
|
+
{ label: dt.i18n(i18nBase + 'equal', 'Equals'), value: 'equal' },
|
|
1774
|
+
{ label: dt.i18n(i18nBase + 'notEqual', 'Does not equal'), value: 'notEqual' },
|
|
1775
|
+
{ label: dt.i18n(i18nBase + 'greater', 'Greater than'), value: 'greater' },
|
|
1776
|
+
{
|
|
1777
|
+
label: dt.i18n(i18nBase + 'greaterOrEqual', 'Greater or equal'),
|
|
1778
|
+
value: 'greaterOrEqual'
|
|
1779
|
+
},
|
|
1780
|
+
{ label: dt.i18n(i18nBase + 'less', 'Less than'), value: 'less' },
|
|
1781
|
+
{ label: dt.i18n(i18nBase + 'lessOrEqual', 'Less or equal'), value: 'lessOrEqual' },
|
|
1782
|
+
{ label: dt.i18n(i18nBase + 'empty', 'Empty'), value: 'empty' },
|
|
1783
|
+
{ label: dt.i18n(i18nBase + 'notEmpty', 'Not empty'), value: 'notEmpty' }
|
|
1754
1784
|
])
|
|
1755
1785
|
.search(function (searchType, searchTerm, loadingState) {
|
|
1756
1786
|
var column = dt.column(_this.idx());
|
|
@@ -1829,6 +1859,7 @@ var searchText = {
|
|
|
1829
1859
|
init: function (config) {
|
|
1830
1860
|
var _this = this;
|
|
1831
1861
|
var dt = this.dt();
|
|
1862
|
+
var i18nBase = 'columnControl.search.text.';
|
|
1832
1863
|
var searchInput = new SearchInput(dt, this.idx())
|
|
1833
1864
|
.addClass('dtcc-searchText')
|
|
1834
1865
|
.clearable(config.clear)
|
|
@@ -1836,14 +1867,17 @@ var searchText = {
|
|
|
1836
1867
|
.title(config.title)
|
|
1837
1868
|
.titleAttr(config.titleAttr)
|
|
1838
1869
|
.options([
|
|
1839
|
-
{ label: 'Contains', value: 'contains' },
|
|
1840
|
-
{
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
{ label: '
|
|
1845
|
-
{ label: '
|
|
1846
|
-
{ label: '
|
|
1870
|
+
{ label: dt.i18n(i18nBase + 'contains', 'Contains'), value: 'contains' },
|
|
1871
|
+
{
|
|
1872
|
+
label: dt.i18n(i18nBase + 'notContains', 'Does not contain'),
|
|
1873
|
+
value: 'notContains'
|
|
1874
|
+
},
|
|
1875
|
+
{ label: dt.i18n(i18nBase + 'equal', 'Equals'), value: 'equal' },
|
|
1876
|
+
{ label: dt.i18n(i18nBase + 'notEqual', 'Does not equal'), value: 'notEqual' },
|
|
1877
|
+
{ label: dt.i18n(i18nBase + 'starts', 'Starts'), value: 'starts' },
|
|
1878
|
+
{ label: dt.i18n(i18nBase + 'ends', 'Ends'), value: 'ends' },
|
|
1879
|
+
{ label: dt.i18n(i18nBase + 'empty', 'Empty'), value: 'empty' },
|
|
1880
|
+
{ label: dt.i18n(i18nBase + 'notEmpty', 'Not empty'), value: 'notEmpty' }
|
|
1847
1881
|
])
|
|
1848
1882
|
.search(function (searchType, searchTerm, loadingState) {
|
|
1849
1883
|
var column = dt.column(_this.idx());
|
|
@@ -1966,7 +2000,7 @@ var searchClear = {
|
|
|
1966
2000
|
.icon(config.icon)
|
|
1967
2001
|
.className(config.className)
|
|
1968
2002
|
.handler(function () {
|
|
1969
|
-
dt.column(_this.idx()).ccSearchClear();
|
|
2003
|
+
dt.column(_this.idx()).ccSearchClear().draw();
|
|
1970
2004
|
})
|
|
1971
2005
|
.enable(false);
|
|
1972
2006
|
dt.on('draw', function () {
|
|
@@ -2221,7 +2255,7 @@ var ColumnControl = /** @class */ (function () {
|
|
|
2221
2255
|
/** SVG icons that can be used by the content plugins */
|
|
2222
2256
|
ColumnControl.icons = icons;
|
|
2223
2257
|
/** Version */
|
|
2224
|
-
ColumnControl.version = '1.0.
|
|
2258
|
+
ColumnControl.version = '1.0.4';
|
|
2225
2259
|
return ColumnControl;
|
|
2226
2260
|
}());
|
|
2227
2261
|
|
|
@@ -2291,6 +2325,7 @@ $(document).on('preInit.dt', function (e, settings) {
|
|
|
2291
2325
|
DataTable.Api.registerPlural('columns().ccSearchClear()', 'column().ccSearchClear()', function () {
|
|
2292
2326
|
var ctx = this;
|
|
2293
2327
|
return this.iterator('column', function (settings, idx) {
|
|
2328
|
+
// Note that the listeners for this will not redraw the table.
|
|
2294
2329
|
ctx.trigger('cc-search-clear', [idx]);
|
|
2295
2330
|
});
|
|
2296
2331
|
});
|
|
@@ -2316,6 +2351,7 @@ DataTable.ext.buttons.ccSearchClear = {
|
|
|
2316
2351
|
action: function (e, dt, node, config) {
|
|
2317
2352
|
dt.search('');
|
|
2318
2353
|
dt.columns().ccSearchClear();
|
|
2354
|
+
dt.draw();
|
|
2319
2355
|
}
|
|
2320
2356
|
};
|
|
2321
2357
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"main": "js/dataTables.columnControl.js",
|
|
5
5
|
"module": "js/dataTables.columnControl.mjs",
|
|
6
6
|
"types": "./types/types.d.ts",
|
|
7
|
-
"version": "1.0.
|
|
7
|
+
"version": "1.0.4",
|
|
8
8
|
"files": [
|
|
9
9
|
"js/**/*.js",
|
|
10
10
|
"js/**/*.mjs",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"sort"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"datatables.net": "^2.3"
|
|
25
|
+
"datatables.net": "^2.3.2"
|
|
26
26
|
},
|
|
27
27
|
"moduleType": [
|
|
28
28
|
"globals",
|
package/types/types.d.ts
CHANGED
|
@@ -57,6 +57,109 @@ declare module 'datatables.net' {
|
|
|
57
57
|
defaults: ConfigColumnControl;
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
|
+
|
|
61
|
+
interface ConfigLanguage {
|
|
62
|
+
/** Column Control language options */
|
|
63
|
+
columnControl: {
|
|
64
|
+
/** Column visibility title */
|
|
65
|
+
colVis?: string;
|
|
66
|
+
|
|
67
|
+
/** Column visibility button text */
|
|
68
|
+
colVisDropdown?: string;
|
|
69
|
+
|
|
70
|
+
/** Dropdown button text */
|
|
71
|
+
dropdown?: string;
|
|
72
|
+
|
|
73
|
+
/** Add to ordering (ascending) button text */
|
|
74
|
+
orderAddAsc?: string;
|
|
75
|
+
|
|
76
|
+
/** Add to ordering (descending) button text */
|
|
77
|
+
orderAddDesc?: string;
|
|
78
|
+
|
|
79
|
+
/** Set ordering (ascending) button text */
|
|
80
|
+
orderAsc?: string;
|
|
81
|
+
|
|
82
|
+
/** Clear all ordering button text */
|
|
83
|
+
orderClear?: string;
|
|
84
|
+
|
|
85
|
+
/** Set ordering (descending) button text */
|
|
86
|
+
orderDesc?: string;
|
|
87
|
+
|
|
88
|
+
/** Remove column from multi-ordering button text */
|
|
89
|
+
orderRemove?: string;
|
|
90
|
+
|
|
91
|
+
/** Column reorder button text */
|
|
92
|
+
reorder?: string;
|
|
93
|
+
|
|
94
|
+
/** Move column left button text */
|
|
95
|
+
reorderLeft?: string;
|
|
96
|
+
|
|
97
|
+
/** Move column right button text */
|
|
98
|
+
reorderRight?: string;
|
|
99
|
+
|
|
100
|
+
/** Clear search button text */
|
|
101
|
+
searchClear?: string;
|
|
102
|
+
|
|
103
|
+
/** Search dropdown button text */
|
|
104
|
+
searchDropdown?: string;
|
|
105
|
+
|
|
106
|
+
/** Search list dropdown button text */
|
|
107
|
+
searchList?: string;
|
|
108
|
+
|
|
109
|
+
/** Spacer text */
|
|
110
|
+
spacer?: string;
|
|
111
|
+
|
|
112
|
+
/** List strings, used for searchList and colVis */
|
|
113
|
+
list?: {
|
|
114
|
+
/** Select all link text */
|
|
115
|
+
add?: string;
|
|
116
|
+
|
|
117
|
+
/** Label for when there is no label */
|
|
118
|
+
empty?: string;
|
|
119
|
+
|
|
120
|
+
/** Select none link text */
|
|
121
|
+
none?: string;
|
|
122
|
+
|
|
123
|
+
/** Search placeholder */
|
|
124
|
+
search?: string;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** Strings used for the <select> available for choosing different search logic */
|
|
128
|
+
search?: {
|
|
129
|
+
/** searchText options */
|
|
130
|
+
text?: {
|
|
131
|
+
equal?: string;
|
|
132
|
+
notEqual?: string;
|
|
133
|
+
starts?: string;
|
|
134
|
+
ends?: string;
|
|
135
|
+
empty?: string;
|
|
136
|
+
notEmpty?: string;
|
|
137
|
+
},
|
|
138
|
+
|
|
139
|
+
/** searchDateTime options */
|
|
140
|
+
datetime?: {
|
|
141
|
+
equal?: string;
|
|
142
|
+
notEqual?: string;
|
|
143
|
+
greater?: string;
|
|
144
|
+
less?: string;
|
|
145
|
+
empty?: string;
|
|
146
|
+
notEmpty?: string;
|
|
147
|
+
},
|
|
148
|
+
|
|
149
|
+
/** searchNumber options */
|
|
150
|
+
number?: {
|
|
151
|
+
equal?: string;
|
|
152
|
+
notEqual?: string;
|
|
153
|
+
greater?: string;
|
|
154
|
+
greaterOrEqual?: string;
|
|
155
|
+
less?: string;
|
|
156
|
+
lessOrEqual?: string;
|
|
157
|
+
empty?: string;
|
|
158
|
+
notEmpty?: string;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
60
163
|
}
|
|
61
164
|
|
|
62
165
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|