datatables.net-columncontrol 1.0.4 → 1.0.6
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.6
|
|
2
2
|
* Copyright (c) SpryMedia Ltd - datatables.net/license
|
|
3
3
|
*
|
|
4
4
|
* SVG icons: ISC License
|
|
@@ -252,6 +252,51 @@ function relativePosition(parent, origin) {
|
|
|
252
252
|
left: left
|
|
253
253
|
};
|
|
254
254
|
}
|
|
255
|
+
/**
|
|
256
|
+
* Function that will provide the keyboard navigation for the dropdown
|
|
257
|
+
*
|
|
258
|
+
* @param dropdown Dropdown element in question
|
|
259
|
+
* @returns Function that can be bound to `keypress`
|
|
260
|
+
*/
|
|
261
|
+
function focusCapture(dropdown, host) {
|
|
262
|
+
return function (e) {
|
|
263
|
+
// Do nothing if not shown
|
|
264
|
+
if (!dropdown._shown) {
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
// Focus trap for tab key
|
|
268
|
+
var elements = Array.from(dropdown.querySelectorAll('a, button, input, select'));
|
|
269
|
+
var active = document.activeElement;
|
|
270
|
+
// An escape key should close the dropdown
|
|
271
|
+
if (e.key === 'Escape') {
|
|
272
|
+
dropdown._close();
|
|
273
|
+
host.focus(); // Restore focus to the host
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
else if (e.key !== 'Tab' || elements.length === 0) {
|
|
277
|
+
// Anything other than tab we aren't interested in from here
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
if (!elements.includes(active)) {
|
|
281
|
+
// If new focus is not inside the popover we want to drag it back in
|
|
282
|
+
elements[0].focus();
|
|
283
|
+
e.preventDefault();
|
|
284
|
+
}
|
|
285
|
+
else if (e.shiftKey) {
|
|
286
|
+
// Reverse tabbing order when shift key is pressed
|
|
287
|
+
if (active === elements[0]) {
|
|
288
|
+
elements[elements.length - 1].focus();
|
|
289
|
+
e.preventDefault();
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
if (active === elements[elements.length - 1]) {
|
|
294
|
+
elements[0].focus();
|
|
295
|
+
e.preventDefault();
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
}
|
|
255
300
|
var dropdownContent = {
|
|
256
301
|
classes: {
|
|
257
302
|
container: 'dtcc-dropdown',
|
|
@@ -273,6 +318,8 @@ var dropdownContent = {
|
|
|
273
318
|
dropdown.remove();
|
|
274
319
|
dropdown._shown = false;
|
|
275
320
|
};
|
|
321
|
+
dropdown.setAttribute('role', 'dialog');
|
|
322
|
+
dropdown.setAttribute('aria-label', dt.i18n('columnControl.dropdown', config.text));
|
|
276
323
|
// When FixedHeader is used, the transition between states messes up positioning, so if
|
|
277
324
|
// shown we just reattach the dropdown.
|
|
278
325
|
dt.on('fixedheader-mode', function () {
|
|
@@ -294,7 +341,13 @@ var dropdownContent = {
|
|
|
294
341
|
return;
|
|
295
342
|
}
|
|
296
343
|
attachDropdown(dropdown, dt, config._parents ? config._parents[0] : btn);
|
|
344
|
+
// When activated using a key - auto focus on the first item in the popover
|
|
345
|
+
var focusable = dropdown.querySelector('input, a, button');
|
|
346
|
+
if (focusable && e.type === 'keypress') {
|
|
347
|
+
focusable.focus();
|
|
348
|
+
}
|
|
297
349
|
});
|
|
350
|
+
btn.element().setAttribute('aria-haspopup', 'dialog');
|
|
298
351
|
// Add the content for the dropdown
|
|
299
352
|
for (var i = 0; i < config.content.length; i++) {
|
|
300
353
|
var content = this.resolve(config.content[i]);
|
|
@@ -315,6 +368,12 @@ var dropdownContent = {
|
|
|
315
368
|
dt.on('columns-reordered', function () {
|
|
316
369
|
positionDropdown(dropdown, dt, btn.element());
|
|
317
370
|
});
|
|
371
|
+
// Focus capture events
|
|
372
|
+
var capture = focusCapture(dropdown, btn.element());
|
|
373
|
+
document.body.addEventListener('keydown', capture);
|
|
374
|
+
dt.on('destroy', function () {
|
|
375
|
+
document.body.removeEventListener('keydown', capture);
|
|
376
|
+
});
|
|
318
377
|
return btn.element();
|
|
319
378
|
}
|
|
320
379
|
};
|
|
@@ -345,6 +404,7 @@ var Button = /** @class */ (function () {
|
|
|
345
404
|
state: createElement('span', 'dtcc-button-state'),
|
|
346
405
|
text: createElement('span', 'dtcc-button-text')
|
|
347
406
|
};
|
|
407
|
+
this._dom.button.setAttribute('type', 'button');
|
|
348
408
|
this._dom.button.append(this._dom.icon);
|
|
349
409
|
this._dom.button.append(this._dom.text);
|
|
350
410
|
this._dom.button.append(this._dom.state);
|
|
@@ -411,6 +471,7 @@ var Button = /** @class */ (function () {
|
|
|
411
471
|
Button.prototype.destroy = function () {
|
|
412
472
|
if (this._s.buttonClick) {
|
|
413
473
|
this._dom.button.removeEventListener('click', this._s.buttonClick);
|
|
474
|
+
this._dom.button.removeEventListener('keypress', this._s.buttonClick);
|
|
414
475
|
}
|
|
415
476
|
if (this._s.namespace) {
|
|
416
477
|
this._s.dt.off('destroy.' + this._s.namespace);
|
|
@@ -478,6 +539,7 @@ var Button = /** @class */ (function () {
|
|
|
478
539
|
this._s.buttonClick = buttonClick;
|
|
479
540
|
this._s.namespace = 'dtcc-' + _namespace++;
|
|
480
541
|
this._dom.button.addEventListener('click', buttonClick);
|
|
542
|
+
this._dom.button.addEventListener('keypress', buttonClick);
|
|
481
543
|
// Use a unique namespace to be able to easily remove per button
|
|
482
544
|
this._s.dt.on('destroy.' + this._s.namespace, function () {
|
|
483
545
|
_this.destroy();
|
|
@@ -500,6 +562,7 @@ var Button = /** @class */ (function () {
|
|
|
500
562
|
}
|
|
501
563
|
this._dom.text.innerHTML = text;
|
|
502
564
|
this._s.label = text; // for fast retrieval
|
|
565
|
+
this._dom.button.setAttribute('aria-label', text);
|
|
503
566
|
return this;
|
|
504
567
|
};
|
|
505
568
|
Button.prototype.value = function (val) {
|
|
@@ -565,6 +628,8 @@ var CheckList = /** @class */ (function () {
|
|
|
565
628
|
dom.controls.append(dom.selectNone);
|
|
566
629
|
dom.selectAll.append(dom.selectAllCount);
|
|
567
630
|
dom.selectNone.append(dom.selectNoneCount);
|
|
631
|
+
dom.selectAll.setAttribute('type', 'button');
|
|
632
|
+
dom.selectNone.setAttribute('type', 'button');
|
|
568
633
|
}
|
|
569
634
|
// Events
|
|
570
635
|
var searchInput = function () {
|
|
@@ -1517,6 +1582,7 @@ var searchDateTime = {
|
|
|
1517
1582
|
if (DateTime) {
|
|
1518
1583
|
dateTime = new DateTime(searchInput.input(), {
|
|
1519
1584
|
format: displayFormat,
|
|
1585
|
+
i18n: dt.settings()[0].oLanguage.datetime, // could be undefined
|
|
1520
1586
|
onChange: function () {
|
|
1521
1587
|
fromPicker = true;
|
|
1522
1588
|
searchInput.runSearch();
|
|
@@ -1680,7 +1746,7 @@ function reloadOptions(dt, config, idx, checkList, loadedValues) {
|
|
|
1680
1746
|
var rows = dt.rows({ order: idx }).indexes().toArray();
|
|
1681
1747
|
var settings = dt.settings()[0];
|
|
1682
1748
|
for (var i = 0; i < rows.length; i++) {
|
|
1683
|
-
var filter = settings.fastData(rows[i], idx, 'filter');
|
|
1749
|
+
var filter = settings.fastData(rows[i], idx, 'filter').toString();
|
|
1684
1750
|
if (!found[filter]) {
|
|
1685
1751
|
found[filter] = true;
|
|
1686
1752
|
options.push({
|
|
@@ -1759,7 +1825,10 @@ var searchList = {
|
|
|
1759
1825
|
}
|
|
1760
1826
|
// Xhr event listener for updates of options
|
|
1761
1827
|
dt.on('xhr', function (e, s, json) {
|
|
1762
|
-
|
|
1828
|
+
// Need to wait for the draw to complete so the table has the latest data
|
|
1829
|
+
dt.one('draw', function () {
|
|
1830
|
+
reloadOptions(dt, config, _this.idx(), checkList, loadedValues);
|
|
1831
|
+
});
|
|
1763
1832
|
});
|
|
1764
1833
|
// Unlike the SearchInput based search contents, CheckList does not handle state saving
|
|
1765
1834
|
// (since the mechanism for column visibility is different), so state saving is handled
|
|
@@ -2091,6 +2160,7 @@ var spacer = {
|
|
|
2091
2160
|
init: function (config) {
|
|
2092
2161
|
var dt = this.dt();
|
|
2093
2162
|
var spacer = createElement('div', config.className, dt.i18n('columnControl.spacer', config.text));
|
|
2163
|
+
spacer.setAttribute('role', 'separator');
|
|
2094
2164
|
return spacer;
|
|
2095
2165
|
}
|
|
2096
2166
|
};
|
|
@@ -2295,7 +2365,7 @@ var ColumnControl = /** @class */ (function () {
|
|
|
2295
2365
|
/** SVG icons that can be used by the content plugins */
|
|
2296
2366
|
ColumnControl.icons = icons;
|
|
2297
2367
|
/** Version */
|
|
2298
|
-
ColumnControl.version = '1.0.
|
|
2368
|
+
ColumnControl.version = '1.0.6';
|
|
2299
2369
|
return ColumnControl;
|
|
2300
2370
|
}());
|
|
2301
2371
|
|
|
@@ -2370,7 +2440,9 @@ DataTable.Api.registerPlural('columns().ccSearchClear()', 'column().ccSearchClea
|
|
|
2370
2440
|
});
|
|
2371
2441
|
});
|
|
2372
2442
|
DataTable.ext.buttons.ccSearchClear = {
|
|
2373
|
-
text:
|
|
2443
|
+
text: function (dt) {
|
|
2444
|
+
return dt.i18n('columnControl.buttons.searchClear', 'Clear search');
|
|
2445
|
+
},
|
|
2374
2446
|
init: function (dt, node, config) {
|
|
2375
2447
|
var _this = this;
|
|
2376
2448
|
dt.on('draw', function () {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/*! ColumnControl 1.0.
|
|
1
|
+
/*! ColumnControl 1.0.6
|
|
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,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});
|
|
8
|
+
(n=>{var r,o;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(t){return n(t,window,document)}):"object"==typeof exports?(r=require("jquery"),o=function(t,e){e.fn.dataTable||require("datatables.net")(t,e)},"undefined"==typeof window?module.exports=function(t,e){return t=t||window,e=e||r(t),o(t,e),n(e,0,t.document)}:(o(window,r),module.exports=n(r,window,window.document))):n(jQuery,window,document)})(function(t,I,d){var y=t.fn.dataTable;function x(t,e,n,r){void 0===e&&(e=[]),void 0===n&&(n=null),void 0===r&&(r=[]);var o=d.createElement(t);return i(o,e),n&&(o.innerHTML=n),r.forEach(function(t){o.appendChild(t)}),o}function i(e,t){t&&(t=Array.isArray(t)?t:[t]).forEach(function(t){e&&t&&e.classList.add(t)})}function e(t){return'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">'+t+"</svg>"}var c={chevronRight:e('<path d="m9 18 6-6-6-6"/>'),columns:e('<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/><path d="M15 3v18"/>'),contains:e('<path d="M10 3h4v18h-4z"/><path d="M18 8h3v9h-3"/><path d="M6 17H3V8h3"/>'),empty:e('<circle cx="12" cy="12" r="10"/>'),ends:e('<path d="M21 3h-4v18h4z"/><path d="M13 8H3v9h10"/>'),equal:e('<line x1="5" x2="19" y1="9" y2="9"/><line x1="5" x2="19" y1="15" y2="15"/>'),greater:e('<path d="m9 18 6-6-6-6"/>'),greaterOrEqual:e('<path d="m9 16 6-6-6-6"/><path d="m9 21 6-6"/>'),less:e('<path d="m15 18-6-6 6-6"/>'),lessOrEqual:e('<path d="m15 16-6-6 6-6"/><path d="m15 21-6-6"/>'),menu:e('<line x1="4" x2="20" y1="12" y2="12"/><line x1="4" x2="20" y1="6" y2="6"/><line x1="4" x2="20" y1="18" y2="18"/>'),move:e('<line x1="12" x2="12" y1="3" y2="21"/><polyline points="8 8 4 12 8 16"/><polyline points="16 16 20 12 16 8"/>'),moveLeft:e('<path d="m9 6-6 6 6 6"/><path d="M3 12h14"/><path d="M21 19V5"/>'),moveRight:e('<path d="M3 5v14"/><path d="M21 12H7"/><path d="m15 18 6-6-6-6"/>'),notContains:e('<path d="M15 4 9 20"/><path d="M3 8h18v9H3z"/>'),notEmpty:e('<circle cx="12" cy="12" r="10"/><line x1="9" x2="15" y1="15" y2="9"/>'),notEqual:e('<path d="M5 9h14"/><path d="M5 15h14"/><path d="M15 5 9 19"/>'),orderAddAsc:e('<path d="M17 21v-8"/><path d="M3 4h6"/><path d="M3 8h9"/><path d="M3 12h10"/><path d="M13 17h8"/>'),orderAddDesc:e('<path d="M17 21v-8"/><path d="M3 4h12"/><path d="M3 8h9"/><path d="M3 12h6"/><path d="M13 17h8"/>'),orderAsc:e('<path d="m3 8 4-4 4 4"/><path d="M7 4v16"/><path d="M11 12h4"/><path d="M11 16h7"/><path d="M11 20h10"/>'),orderClear:e('<path d="m21 21-8-8"/><path d="M3 4h12"/><path d="M3 8h9"/><path d="M3 12h6"/><path d="m13 21 8-8"/>'),orderDesc:e('<path d="m3 16 4 4 4-4"/><path d="M7 20V4"/><path d="M11 4h10"/><path d="M11 8h7"/><path d="M11 12h4"/>'),orderRemove:e('<path d="M3 4h12"/><path d="M3 8h9"/><path d="M3 12h6"/><path d="M13 17h8"/>'),orderNone:e('<path d="m3 8 4-4 4 4"/><path d="m11 16-4 4-4-4"/><path d="M7 4v16"/><path d="M15 8h6"/><path d="M15 16h6"/><path d="M13 12h8"/>'),search:e('<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>'),searchClear:e('<path d="m13.5 8.5-5 5"/><path d="m8.5 8.5 5 5"/><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>'),starts:e('<path d="M3 3h4v18H3z"/><path d="M11 8h10v9H11"/>'),tick:e('<path d="M20 6 9 17l-5-5"/>'),x:e('<path d="M18 6 6 18"/><path d="m6 6 12 12"/>')};function s(t,e){return e.closest("div.dtfh-floatingparent")||t.table().container()}function u(t,e,n){var r=n.closest("div.dt-column-header"),e=s(e,n),r=getComputedStyle(r),o=t.offsetWidth,i=((t,e)=>{for(var n=0,r=0;e&&e!==t&&e!==d.body;)n+=e.offsetTop,r+=e.offsetLeft,e.scrollTop&&(r-=e.scrollTop),e.scrollLeft&&(r-=e.scrollLeft),e=e.offsetParent;return{top:n,left:r}})(e,n),a=i.top+n.offsetHeight,r="row-reverse"===r.flexDirection?i.left:i.left-o+n.offsetWidth,i=e.offsetWidth;i<r+o&&(r-=r+o-i),r<0&&(r=0),t.style.top=a+"px",t.style.left=r+"px"}function h(e,t,n){function r(t){e._shown?t.target===e||e.contains(t.target)||(e._close(),d.body.removeEventListener("click",r)):d.body.removeEventListener("click",r)}var o=s(t,n.element());e._shown=!0,o.append(e),u(e,t,n.element());d.body.addEventListener("click",r)}var p={classes:{container:"dtcc-dropdown",liner:"dtcc-dropdown-liner"},defaults:{className:"dropdown",content:[],icon:"menu",text:"More..."},init:function(n){var r=this.dt(),o=x("div",p.classes.container,"",[x("div",p.classes.liner)]),t=(o._shown=!1,o._close=function(){o.remove(),o._shown=!1},o.setAttribute("role","dialog"),o.setAttribute("aria-label",r.i18n("columnControl.dropdown",n.text)),r.on("fixedheader-mode",function(){o._shown&&h(o,r,n._parents?n._parents[0]:i)}),o.childNodes[0]),i=new f(r).text(r.i18n("columnControl.dropdown",n.text)).icon(n.icon).className(n.className).dropdownDisplay(t).handler(function(t){var e;t._closed&&t._closed.includes(o)||(h(o,r,n._parents?n._parents[0]:i),(e=o.querySelector("input, a, button"))&&"keypress"===t.type&&e.focus())});i.element().setAttribute("aria-haspopup","dialog");for(var e=0;e<n.content.length;e++){var a=this.resolve(n.content[e]),a=(a.config._parents||(a.config._parents=[]),a.config._parents.push(i),a.plugin.init.call(this,a.config));t.appendChild(a)}n._parents&&n._parents.length&&i.extra("chevronRight"),r.on("columns-reordered",function(){u(o,r,i.element())});function s(t){var e,n;c._shown&&(e=Array.from(c.querySelectorAll("a, button, input, select")),n=d.activeElement,"Escape"===t.key?(c._close(),l.focus()):"Tab"===t.key&&0!==e.length&&(e.includes(n)?t.shiftKey?n===e[0]&&(e[e.length-1].focus(),t.preventDefault()):n===e[e.length-1]&&(e[0].focus(),t.preventDefault()):(e[0].focus(),t.preventDefault())))}var c,l;c=o,l=i.element();return d.body.addEventListener("keydown",s),r.on("destroy",function(){d.body.removeEventListener("keydown",s)}),i.element()}},o=0,f=(n.prototype.active=function(t){return void 0===t?this._s.active:(this._s.active=t,this._checkActive(),this)},n.prototype.activeList=function(t,e){return this._s.activeList[t]=e,this._checkActive(),this},n.prototype.checkDisplay=function(){for(var t=0,e=this._dom.dropdownDisplay.childNodes,n=0;n<e.length;n++)"none"!==e[n].style.display&&t++;return 0===t&&(this._dom.button.style.display="none"),this},n.prototype.className=function(t){return this._dom.button.classList.add("dtcc-button_"+t),this},n.prototype.destroy=function(){this._s.buttonClick&&(this._dom.button.removeEventListener("click",this._s.buttonClick),this._dom.button.removeEventListener("keypress",this._s.buttonClick)),this._s.namespace&&this._s.dt.off("destroy."+this._s.namespace)},n.prototype.dropdownDisplay=function(t){return this._dom.dropdownDisplay=t,this},n.prototype.element=function(){return this._dom.button},n.prototype.enable=function(t){return this._dom.button.classList.toggle("dtcc-button_disabled",!t),this._s.enabled=t,this},n.prototype.extra=function(t){return this._dom.extra.innerHTML=t?c[t]:"",this},n.prototype.handler=function(n){function t(t){var e;void 0===(e=t)&&(e=null),d.querySelectorAll("div.dtcc-dropdown").forEach(function(t){null!==e&&t.contains(e.target)||(t._close(),e._closed||(e._closed=[]),e._closed.push(t))}),t.stopPropagation(),t.preventDefault(),r._s.enabled&&n(t)}var r=this;return this._s.buttonClick=t,this._s.namespace="dtcc-"+o++,this._dom.button.addEventListener("click",t),this._dom.button.addEventListener("keypress",t),this._s.dt.on("destroy."+this._s.namespace,function(){r.destroy()}),this},n.prototype.icon=function(t){return this._dom.icon.innerHTML=t?c[t]:"",this},n.prototype.text=function(t){return void 0===t?this._s.label:(this._dom.text.innerHTML=t,this._s.label=t,this._dom.button.setAttribute("aria-label",t),this)},n.prototype.value=function(t){return void 0===t?this._s.value:(this._s.value=t,this)},n.prototype._checkActive=function(){return!0===this._s.active||Object.values(this._s.activeList).includes(!0)?(this._dom.state.innerHTML=c.tick,this._dom.button.classList.add("dtcc-button_active")):(this._dom.state.innerHTML="",this._dom.button.classList.remove("dtcc-button_active")),this},n.classes={container:"dtcc-button"},n);function n(t){this._s={active:!1,activeList:[],buttonClick:null,dt:null,enabled:!0,label:"",namespace:"",value:null},this._s.dt=t,this._dom={button:x("button",n.classes.container),dropdownDisplay:null,extra:x("span","dtcc-button-extra"),icon:x("span","dtcc-button-icon"),state:x("span","dtcc-button-state"),text:x("span","dtcc-button-text")},this._dom.button.setAttribute("type","button"),this._dom.button.append(this._dom.icon),this._dom.button.append(this._dom.text),this._dom.button.append(this._dom.state),this._dom.button.append(this._dom.extra),this.enable(!0)}m.prototype.add=function(n,t){for(var r=this,o=(Array.isArray(n)||(n=[n]),this),e=0;e<n.length;e++)(t=>{var t=n[t],e=new f(o._s.dt).active(t.active||!1).handler(function(t){r._s.handler(t,e,r._s.buttons,!0),r._updateCount()}).icon(t.icon||"").text(""!==t.label?t.label:o._s.dt.i18n("columnControl.list.emptyOption","Empty")).value(t.value);""===t.label&&e.className("empty"),o._s.buttons.push(e)})(e);var i=this._s.buttons.length;return!0!==t&&void 0!==t||(this._dom.selectAllCount.innerHTML=i?"("+i+")":"",this._redraw()),this},m.prototype.button=function(t){for(var e=this._s.buttons,n=0;n<e.length;n++)if(e[n].value()===t)return e[n];return null},m.prototype.clear=function(){for(var t=0;t<this._s.buttons.length;t++)this._s.buttons[t].destroy();return this._dom.buttons.replaceChildren(),this._s.buttons.length=0,this},m.prototype.element=function(){return this._dom.container},m.prototype.handler=function(t){return this._s.handler=t,this},m.prototype.searchListener=function(t,n){var r=this;return t.on("cc-search-clear",function(t,e){e===n.idx()&&(r.selectNone(),r._s.handler(t,null,r._s.buttons,!1),r._s.search="",r._dom.search.value="",r._redraw(),r._updateCount())}),this},m.prototype.selectAll=function(){for(var t=0;t<this._s.buttons.length;t++)this._s.buttons[t].active(!0);return this},m.prototype.selectNone=function(){for(var t=0;t<this._s.buttons.length;t++)this._s.buttons[t].active(!1);return this},m.prototype.title=function(t){return this._dom.title.innerHTML=t,this},m.prototype.values=function(t){var e,n=[],r=this._s.buttons;if(void 0!==t){for(e=0;e<r.length;e++)t.includes(r[e].value())&&r[e].active(!0);return this._updateCount(),this}for(e=0;e<r.length;e++)r[e].active()&&n.push(r[e].value());return n},m.prototype._updateCount=function(){var t=this.values().length;this._dom.selectNoneCount.innerHTML=t?"("+t+")":""},m.prototype._redraw=function(){var t=this._s.buttons,e=this._dom.buttons,n=this._s.search.toLowerCase();e.replaceChildren();for(var r=0;r<t.length;r++){var o=t[r];n&&!o.text().toLowerCase().includes(n)||e.appendChild(o.element())}},m.classes={container:"dtcc-list",input:"dtcc-list-search"};var l=m;function m(t,e){function n(){i._s.search=a.search.value,i._redraw()}function r(t){i.selectAll(),i._s.handler(t,null,i._s.buttons,!0),i._updateCount()}function o(t){i.selectNone(),i._s.handler(t,null,i._s.buttons,!0),i._updateCount()}var i=this,a=(this._s={buttons:[],dt:null,handler:function(){},search:""},this._s.dt=t,this._dom={buttons:x("div","dtcc-list-buttons"),container:x("div",m.classes.container),controls:x("div","dtcc-list-controls"),title:x("div","dtcc-list-title"),selectAll:x("button","dtcc-list-selectAll",t.i18n("columnControl.list.all","Select all")),selectAllCount:x("span"),selectNone:x("button","dtcc-list-selectNone",t.i18n("columnControl.list.none","Deselect")),selectNoneCount:x("span"),search:x("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),a.selectAll.setAttribute("type","button"),a.selectNone.setAttribute("type","button"));e.search&&(a.controls.append(a.search),a.search.setAttribute("placeholder",t.i18n("columnControl.list.search","Search...")),a.search.addEventListener("input",n)),a.selectAll.addEventListener("click",r),a.selectNone.addEventListener("click",o),t.on("destroy",function(){a.selectAll.removeEventListener("click",r),a.selectNone.removeEventListener("click",o),a.search.removeEventListener("input",n)})}var r={defaults:{className:"colVis",columns:"",search:!1,select:!1,title:"Column visibility"},init:function(t){function n(){o.columns(t.columns).every(function(){i.add({active:this.visible(),label:this.title(),value:this.index()})})}var o=this.dt(),i=new l(o,{search:t.search,select:t.select}).title(o.i18n("columnControl.colVis",t.title)).handler(function(t,e,n){e&&e.active(!e.active()),r(n)}),r=function(t){for(var e=0;e<t.length;e++){var n=t[e],r=n.value(),r=o.column(r);n.active()&&!r.visible()?r.visible(!0):!n.active()&&r.visible()&&r.visible(!1)}};return n(),o.on("column-visibility",function(t,e,n,r){n=i.button(n);n&&n.active(r)}),o.on("columns-reordered",function(t,e){i.clear(),n()}),i.element()}},a={defaults:{className:"colVis",columns:"",search:!1,select:!1,text:"Column visibility",title:"Column visibility"},extend:function(t){return{extend:"dropdown",icon:"columns",text:this.dt().i18n("columnControl.colVisDropdown",t.text),content:[Object.assign(t,{extend:"colVis"})]}}},R={defaults:{className:"reorder",icon:"move",text:"Reorder columns"},init:function(t){var n=this,e=this.dt(),r=new f(e).text(e.i18n("columnControl.reorder",t.text)).icon(t.icon).className(t.className).handler(function(){var t=n.idx();0<t&&e.colReorder.move(t,t-1)});return 0===this.idx()&&r.enable(!1),e.on("columns-reordered",function(t,e){r.enable(0<n.idx())}),e.init().colReorder||new y.ColReorder(e,{}),r.element()}},H={defaults:{className:"reorderLeft",icon:"moveLeft",text:"Move column left"},init:function(t){var n=this,e=this.dt(),r=new f(e).text(e.i18n("columnControl.reorderLeft",t.text)).icon(t.icon).className(t.className).handler(function(){var t=n.idx();0<t&&e.colReorder.move(t,t-1)});return 0===this.idx()&&r.enable(!1),e.on("columns-reordered",function(t,e){r.enable(0<n.idx())}),r.element()}},V={defaults:{className:"reorderRight",icon:"moveRight",text:"Move column right"},init:function(t){var n=this,r=this.dt(),o=new f(r).text(r.i18n("columnControl.reorderRight",t.text)).icon(t.icon).className(t.className).handler(function(){var t=n.idx();t<r.columns().count()-1&&r.colReorder.move(t,t+1)});return this.idx()===r.columns().count()-1&&o.enable(!1),r.on("columns-reordered",function(t,e){o.enable(n.idx()<r.columns().count()-1)}),o.element()}},Y={defaults:{className:"order",iconAsc:"orderAsc",iconDesc:"orderDesc",iconNone:"orderNone",statusOnly:!1,text:"Toggle ordering"},init:function(r){var o=this,t=this.dt(),i=new f(t).text(t.i18n("columnControl.order",r.text)).icon("orderAsc").className(r.className);return r.statusOnly||t.order.listener(i.element(),y.versionCheck("2.3.2")?function(){return[o.idx()]}:this.idx(),function(){}),t.on("order",function(t,e,n){n=n.find(function(t){return t.col===o.idx()});n?"asc"===n.dir?i.active(!0).icon(r.iconAsc):"desc"===n.dir&&i.active(!0).icon(r.iconDesc):i.active(!1).icon(r.iconNone)}),i.element()}},W={defaults:{className:"orderAddAsc",icon:"orderAddAsc",text:"Add Sort Ascending"},init:function(t){var r=this,e=this.dt(),o=new f(e).text(e.i18n("columnControl.orderAddAsc",t.text)).icon(t.icon).className(t.className).handler(function(){e.order().push([r.idx(),"asc"]),e.draw()});return e.on("order",function(t,e,n){n=n.some(function(t){return t.col===r.idx()});o.enable(!n)}),o.element()}},B={defaults:{className:"orderAddDesc",icon:"orderAddDesc",text:"Add Sort Descending"},init:function(t){var r=this,e=this.dt(),o=new f(e).text(e.i18n("columnControl.orderAddDesc",t.text)).icon(t.icon).className(t.className).handler(function(){e.order().push([r.idx(),"desc"]),e.draw()});return e.on("order",function(t,e,n){n=n.some(function(t){return t.col===r.idx()});o.enable(!n)}),o.element()}},P={defaults:{className:"orderAsc",icon:"orderAsc",text:"Sort Ascending"},init:function(t){var r=this,e=this.dt(),o=new f(e).text(e.i18n("columnControl.orderAsc",t.text)).icon(t.icon).className(t.className).handler(function(){r.dt().order([{idx:r.idx(),dir:"asc"}]).draw()});return e.on("order",function(t,e,n){n=n.some(function(t){return t.col===r.idx()&&"asc"===t.dir});o.active(n)}),o.element()}},z={defaults:{className:"orderClear",icon:"orderClear",text:"Clear sort"},init:function(t){var e=this.dt(),r=new f(e).text(e.i18n("columnControl.orderClear",t.text)).icon(t.icon).className(t.className).handler(function(){e.order([]).draw()});return e.on("order",function(t,e,n){r.enable(0<n.length)}),0===e.order().length&&r.enable(!1),r.element()}},F={defaults:{className:"orderDesc",icon:"orderDesc",text:"Sort Descending"},init:function(t){var r=this,e=this.dt(),o=new f(e).text(e.i18n("columnControl.orderDesc",t.text)).icon(t.icon).className(t.className).handler(function(){r.dt().order([{idx:r.idx(),dir:"desc"}]).draw()});return e.on("order",function(t,e,n){n=n.some(function(t){return t.col===r.idx()&&"desc"===t.dir});o.active(n)}),o.element()}},G={defaults:{className:"orderRemove",icon:"orderRemove",text:"Remove from sort"},init:function(t){var r=this,n=this.dt(),o=new f(n).text(n.i18n("columnControl.orderRemove",t.text)).icon(t.icon).className(t.className).handler(function(){var t=n.order(),e=t.findIndex(function(t){return t[0]===r.idx()});t.splice(e,1),n.order(t).draw()});return n.on("order",function(t,e,n){n=n.some(function(t){return t.col===r.idx()});o.enable(n)}),o.enable(!1),o.element()}},K={defaults:{className:"order",iconAsc:"orderAsc",iconDesc:"orderDesc",iconNone:"orderNone",statusOnly:!0,text:"Sort status"},extend:function(t){return Object.assign(t,{extend:"order"})}},v=(_.prototype.addClass=function(t){return this._dom.container.classList.add(t),this},_.prototype.clear=function(){return this.set(this._dom.select.children[0].getAttribute("value"),""),this},_.prototype.clearable=function(t){return t||this._dom.clear.remove(),this},_.prototype.element=function(){return this._dom.container},_.prototype.input=function(){return this._dom.input},_.prototype.options=function(t){for(var e=this._dom.select,n=0;n<t.length;n++)e.add(new Option(t[n].label,t[n].value));return this._dom.typeIcon.innerHTML=c[t[0].value],this},_.prototype.placeholder=function(t){var e;return t&&(e=this._dt.column(this._idx).title(),this._dom.input.placeholder=t.replace("[title]",e)),this},_.prototype.runSearch=function(){var t=this._dom,e="empty"===t.select.value||"notEmpty"===t.select.value||""!==t.input.value;t.container.classList.toggle("dtcc-search_active",e),!this._search||this._lastValue===t.input.value&&this._lastType===t.select.value||(this._search(t.select.value,t.input.value,this._loadingState),this._lastValue=t.input.value,this._lastType=t.select.value)},_.prototype.search=function(t){return this._search=t,this._stateLoad(this._dt.state.loaded()),this},_.prototype.set=function(t,e){var n=this._dom;return n.input.value=e,n.select.value=t,n.typeIcon.innerHTML=c[n.select.value],this.runSearch(),this},_.prototype.title=function(t){var e;return t&&(e=this._dt.column(this._idx).title(),this._dom.title.innerHTML=t.replace("[title]",e)),this},_.prototype.titleAttr=function(t){var e;return t&&(e=this._dt.column(this._idx).title(),this._dom.input.title=t.replace("[title]",e)),this},_.prototype.type=function(t){return this._type=t,this},_.prototype._stateLoad=function(t){var e=this._dom,n=this._idx,n=null==(t=null==(t=null==t?void 0:t.columnControl)?void 0:t[n])?void 0:t.searchInput;n&&(this._loadingState=!0,e.select.value=n.logic,e.input.value=n.value,e.select.dispatchEvent(new Event("input")),this._loadingState=!1)},_.classes={container:["dtcc-content","dtcc-search"],input:"",select:""},_);function _(n,r){function t(){i.runSearch()}function e(){a.typeIcon.innerHTML=c[a.select.value],i.runSearch()}function o(){i.clear()}var i=this,a=(this._type="text",this._dt=n,this._idx=r,this._dom={clear:x("span","dtcc-search-clear",c.x),container:x("div",_.classes.container),typeIcon:x("div","dtcc-search-type-icon"),searchIcon:x("div","dtcc-search-icon",c.search),input:x("input",_.classes.input),inputs:x("div"),select:x("select",_.classes.select),title:x("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=y.use("moment"),d=y.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=y.use("datetime");h=((t,e)=>{if(t=t.column(e).type())if("datetime"===t){var e=y.use("moment"),n=y.use("luxon");if(e)return e().creationData().locale._longDateFormat.L;if(n)return n.DateTime.fromISO("1999-08-07").toLocaleString().replace("07","dd").replace("7","d").replace("08","MM").replace("8","M").replace("1999","yyyy").replace("99","yy")}else{if(t.includes("datetime-"))return t.replace(/datetime-/g,"");if(t.includes("moment"))return t.replace(/moment-/g,"");if(t.includes("luxon"))return t.replace(/luxon-/g,"")}return"YYYY-MM-DD"})(u,s.idx()),t&&(a=new t(e.input(),{format:h,i18n:u.settings()[0].oLanguage.datetime,onChange:function(){c=!0,e.runSearch(),c=!1}}))}),e.element()}};function g(t,e,n,r){return""===t?"":t instanceof Date?t.getTime():"YYYY-MM-DD"!==e&&(n||r)?n?1e3*n(t,e).unix():r.DateTime.fromFormat(t,e).toMillis():new Date(t).getTime()}function C(t,e){var n=t.values();t.clear();for(var r=0;r<e.length;r++)"object"==typeof e[r]?t.add({active:!1,label:e[r].label,value:e[r].value},r===e.length-1):t.add({active:!1,label:e[r],value:e[r]},r===e.length-1);n.length&&t.values(n)}function w(t,e){t=null==(e=null==(e=null==e?void 0:e.columnControl)?void 0:e[t])?void 0:e.searchList;if(t)return t}function A(t,e){var n=null==(n=t.ajax.json())?void 0:n.columnControl,t=t.column(e),r=t.name(),t=t.dataSrc();return n&&n[r]?n[r]:n&&"string"==typeof t&&n[t]?n[t]:n&&n[e]?n[e]:null}function L(t,e,n,r,o){var i=null==(i=t.ajax.json())?void 0:i.columnControl,a=[],s=A(t,n);if(s)a=s;else{if(i&&e.ajaxOnly)return r.element().style.display="none",void(e._parents&&e._parents.forEach(function(t){return t.checkDisplay()}));for(var c={},l=t.rows({order:n}).indexes().toArray(),d=t.settings()[0],u=0;u<l.length;u++){var h=d.fastData(l[u],n,"filter").toString();c[h]||(c[h]=!0,a.push({label:d.fastData(l[u],n,"display"),value:h}))}}C(r,a),o&&r.values(o)}var E={defaults:{ajaxOnly:!0,className:"searchList",options:null,search:!0,select:!0,title:""},init:function(r){function o(e){var t=s.column(i.idx());e&&(0===e.length?t.search.fixed("dtcc-list",""):t.search.fixed("dtcc-list",function(t){return e.includes(t)}),r._parents)&&r._parents.forEach(function(t){return t.activeList(i.unique(),!!e.length)})}var i=this,a=null,s=this.dt(),c=new l(s,{search:r.search,select:r.select}).searchListener(s,this).title(s.i18n("columnControl.searchList",r.title).replace("[title]",s.column(this.idx()).title())).handler(function(t,e,n,r){e&&e.active(!e.active()),o(c.values()),r&&s.draw()});return r.options?C(c,r.options):s.ready(function(){L(s,r,i.idx(),c,a)}),s.on("xhr",function(t,e,n){s.one("draw",function(){L(s,r,i.idx(),c,a)})}),s.on("stateLoaded",function(t,e,n){n=w(i.idx(),n);n&&c.values(n)}),s.on("stateSaveParams",function(t,e,n){var r=i.idx();n.columnControl||(n.columnControl={}),n.columnControl[r]||(n.columnControl[r]={}),n.columnControl[r].searchList=s.ready()?c.values():a}),a=w(this.idx(),s.state.loaded()),o(a),c.element()}},N={defaults:{clear:!0,placeholder:"",title:"",titleAttr:""},init:function(o){var i=this,a=this.dt(),t="columnControl.search.number.",t=new v(a,this.idx()).type("num").addClass("dtcc-searchNumber").clearable(o.clear).placeholder(o.placeholder).title(o.title).titleAttr(o.titleAttr).options([{label:a.i18n(t+"equal","Equals"),value:"equal"},{label:a.i18n(t+"notEqual","Does not equal"),value:"notEqual"},{label:a.i18n(t+"greater","Greater than"),value:"greater"},{label:a.i18n(t+"greaterOrEqual","Greater or equal"),value:"greaterOrEqual"},{label:a.i18n(t+"less","Less than"),value:"less"},{label:a.i18n(t+"lessOrEqual","Less or equal"),value:"lessOrEqual"},{label:a.i18n(t+"empty","Empty"),value:"empty"},{label:a.i18n(t+"notEmpty","Not empty"),value:"notEmpty"}]).search(function(t,e,n){var r=a.column(i.idx());if("empty"===t)r.search.fixed("dtcc",function(t){return!t});else if("notEmpty"===t)r.search.fixed("dtcc",function(t){return!!t});else{if(""===r.search.fixed("dtcc")&&""===e)return;""===e?r.search.fixed("dtcc",""):"equal"===t?r.search.fixed("dtcc",function(t){return M(t)==e}):"notEqual"===t?r.search.fixed("dtcc",function(t){return M(t)!=e}):"greater"===t?r.search.fixed("dtcc",function(t){return M(t)>e}):"greaterOrEqual"===t?r.search.fixed("dtcc",function(t){return M(t)>=e}):"less"===t?r.search.fixed("dtcc",function(t){return M(t)<e}):"lessOrEqual"===t&&r.search.fixed("dtcc",function(t){return M(t)<=e})}o._parents&&o._parents.forEach(function(t){return t.activeList(i.unique(),!!r.search.fixed("dtcc"))}),n||r.draw()});return t.input().setAttribute("inputmode","numeric"),t.input().setAttribute("pattern","[0-9]*"),t.element()}},Q=/<([^>]*>)/g,U=/['\u00A0,$£€¥%\u2009\u202F\u20BD\u20a9\u20BArfkɃΞ]/gi;function M(t){var e;return 0===t||t&&"-"!==t?"number"==(e=typeof t)||"bigint"==e?t:+(t=t.replace?t.replace(Q,"").replace(U,""):t):-1/0}var q={defaults:{clear:!0,placeholder:"",title:"",titleAttr:""},init:function(o){var i=this,a=this.dt(),t="columnControl.search.text.";return new v(a,this.idx()).addClass("dtcc-searchText").clearable(o.clear).placeholder(o.placeholder).title(o.title).titleAttr(o.titleAttr).options([{label:a.i18n(t+"contains","Contains"),value:"contains"},{label:a.i18n(t+"notContains","Does not contain"),value:"notContains"},{label:a.i18n(t+"equal","Equals"),value:"equal"},{label:a.i18n(t+"notEqual","Does not equal"),value:"notEqual"},{label:a.i18n(t+"starts","Starts"),value:"starts"},{label:a.i18n(t+"ends","Ends"),value:"ends"},{label:a.i18n(t+"empty","Empty"),value:"empty"},{label:a.i18n(t+"notEmpty","Not empty"),value:"notEmpty"}]).search(function(t,e,n){var r=a.column(i.idx());if(e=e.toLowerCase(),"empty"===t)r.search.fixed("dtcc",function(t){return!t});else if("notEmpty"===t)r.search.fixed("dtcc",function(t){return!!t});else{if(""===r.search.fixed("dtcc")&&""===e)return;""===e?r.search.fixed("dtcc",""):"equal"===t?r.search.fixed("dtcc",function(t){return t.toLowerCase()==e}):"notEqual"===t?r.search.fixed("dtcc",function(t){return t.toLowerCase()!=e}):"contains"===t?r.search.fixed("dtcc",e):"notContains"===t?r.search.fixed("dtcc",function(t){return!t.toLowerCase().includes(e)}):"starts"===t?r.search.fixed("dtcc",function(t){return t.toLowerCase().startsWith(e)}):"ends"===t&&r.search.fixed("dtcc",function(t){return t.toLowerCase().endsWith(e)})}o._parents&&o._parents.forEach(function(t){return t.activeList(i.unique(),!!r.search.fixed("dtcc"))}),n||r.draw()}).element()}},r={colVis:r,colVisDropdown:a,dropdown:p,reorder:R,reorderLeft:H,reorderRight:V,order:Y,orderAddAsc:W,orderAddDesc:B,orderAsc:P,orderClear:z,orderDesc:F,orderRemove:G,orderStatus:K,search:{defaults:{allowSearchList:!1},init:function(n){function e(t){var e=A(i,a);return n.allowSearchList&&e?E.init.call(o,Object.assign({},E.defaults,n)):"date"===t||t.startsWith("datetime")?b.init.call(o,Object.assign({},b.defaults,n)):t.includes("num")?N.init.call(o,Object.assign({},N.defaults,n)):q.init.call(o,Object.assign({},q.defaults,n))}var r,o=this,i=this.dt(),a=this.idx(),t=null==(t=null==(t=null==(t=i.state.loaded())?void 0:t.columnControl)?void 0:t[a])?void 0:t.searchInput;return t?r=e(t.type):(r=d.createElement("div"),i.ready(function(){var t=i.column(a),t=e(t.type());r.replaceWith(t)})),r}},searchClear:{defaults:{className:"searchClear",icon:"searchClear",text:"Clear Search"},init:function(t){var n=this,r=this.dt(),o=new f(r).text(r.i18n("columnControl.searchClear",t.text)).icon(t.icon).className(t.className).handler(function(){r.column(n.idx()).ccSearchClear().draw()}).enable(!1);return r.on("draw",function(){var t=r.column(n.idx()).search.fixed("dtcc"),e=r.column(n.idx()).search.fixed("dtcc-list");o.enable(!(!t&&!e))}),o.element()}},searchDropdown:{defaults:{ajaxOnly:!0,allowSearchList:!0,className:"searchDropdown",clear:!0,columns:"",options:null,placeholder:"",search:!0,select:!0,text:"Search",title:"",titleAttr:""},extend:function(t){return{extend:"dropdown",icon:"search",text:this.dt().i18n("columnControl.searchDropdown",t.text),content:[Object.assign(t,{extend:"search"})]}}},searchDateTime:b,searchList:E,searchNumber:N,searchText:q,spacer:{defaults:{className:"dtcc-spacer",text:""},init:function(t){var e=this.dt(),e=x("div",t.className,e.i18n("columnControl.spacer",t.text));return e.setAttribute("role","separator"),e}},title:{defaults:{className:"dtcc-title",text:null},init:function(t){var e=this.dt().column(this.idx()).title(),n=null===t.text?"[title]":t.text;return x("div",t.className,n.replace("[title]",e))}}},D=(S.prototype.dt=function(){return this._dt},S.prototype.idx=function(){return this._s.columnIdx},S.prototype.resolve=function(t){var e=null,n=null,r=null;if("string"==typeof t?(e=S.content[r=t],n=Object.assign({},null==e?void 0:e.defaults)):Array.isArray(t)?(e=S.content[r="dropdown"],n=Object.assign({},null==e?void 0:e.defaults,{content:t})):t.extend&&(r=t.extend,e=S.content[r],n=Object.assign({},null==e?void 0:e.defaults,t)),e)return e.extend?(t=e.extend.call(this,n),this.resolve(t)):{config:n,type:r,plugin:e};throw new Error("Unknown ColumnControl content type: "+r)},S.prototype.unique=function(){return this._s.unique},S.prototype._target=function(){var t,e,n=this._c.target,r=this._dt.column(this._s.columnIdx),o="header";return"number"==typeof n?t=r.header(n):(e="tfoot"!==(n=n.split(":"))[0],n=n[1]?parseInt(n[1]):0,e?t=r.header(n):(t=r.footer(n),o="footer")),t.querySelector("div.dt-column-"+o)},S.Button=f,S.CheckList=l,S.SearchInput=v,S.content=r,S.defaults={className:"",content:null,target:0},S.icons=c,S.version="1.0.6",S);function S(n,t,e){var r=this,o=(this._dom={target:null,wrapper:null},this._c={},this._s={columnIdx:null,unique:null},this._dt=n,this._s.columnIdx=t,this._s.unique=Math.random(),t);Object.assign(this._c,S.defaults,e),this._dom.target=this._target(),e.className&&i(this._dom.target.closest("tr"),e.className),this._c.content&&(n.on("columns-reordered",function(t,e){r._s.columnIdx=n.colReorder.transpose(o,"fromOriginal")}),this._dom.wrapper=d.createElement("span"),this._dom.wrapper.classList.add("dtcc"),this._dom.target.appendChild(this._dom.wrapper),this._c.content.forEach(function(t){t=r.resolve(t),t=t.plugin.init.call(r,t.config);r._dom.wrapper.appendChild(t)}),n.on("destroy",function(){r._dom.wrapper.remove()}))}function k(t,e){var n=D.defaults.target;if(T(e)){if(n===t)return{target:n,content:e}}else if(Array.isArray(e))for(var r=0;r<e.length;r++){var o=e[r];if(T(o)){if(n===t)return{target:n,content:o}}else if(j(o)){if(t===(void 0!==o.target?o.target:n))return o}else if(t===n)return{target:n,content:e}}else if("object"==typeof e)if(j(e)){if(t===(void 0!==e.target?e.target:n))return e}else if(t===n)return{target:n,content:e}}function O(e,t){function n(t){e.includes(t)||e.push(t)}return Array.isArray(t)?t.forEach(function(t){n(("object"==typeof t&&void 0!==t.target?t:D.defaults).target)}):"object"==typeof t&&n((void 0!==t.target?t:D.defaults).target),e}function j(t){return"object"==typeof t&&void 0!==t.target}function T(t){var e=!1;if(Array.isArray(t)){for(var n=0;n<t.length;n++)if(j(t[n])){e=!0;break}return!e}}return y.ColumnControl=D,t(d).on("i18n.dt",function(t,e){if("dt"===t.namespace){var n=new y.Api(e),t=n.table().header(),r=e.oInit.columnControl,o=D.defaults,i=[],a={};t.querySelectorAll("tr").length<=1&&null===e.titleRow&&(e.titleRow=0),O(i,r),O(i,o),n.columns().every(function(t){var e=this.init().columnControl;O(i,e)});for(var s=0;s<i.length;s++){v=m=f=p=h=u=d=l=c=void 0;var c=a,l=i[s],d=n;if(!c[l]){var u=!0,h=0,p=("number"==typeof l?h=l:("tfoot"===(p=l.split(":"))[0]&&(u=!1),p[1]&&(h=parseInt(p[1]))),u?d.table().header():d.table().footer());if(!p.querySelectorAll("tr")[h]){var f=d.columns().count(),m=x("tr");m.setAttribute("data-dt-order","disable");for(var v=0;v<f;v++)m.appendChild(x("td"));p.appendChild(m)}c[l]=!0}}}}),t(d).on("preInit.dt",function(t,e){var s,c,l,d;"dt"===t.namespace&&(s=new y.Api(e),c=e.oInit.columnControl,l=D.defaults,O(d=[],c),O(d,l),s.columns().every(function(t){for(var e=this.init().columnControl,n=O(d.slice(),e),r=0;r<n.length;r++){var o=k(n[r],e),i=k(n[r],c),a=k(n[r],l);(a||i||o)&&new D(s,this.index(),Object.assign({},a||{},i||{},o||{}))}}))}),y.Api.registerPlural("columns().ccSearchClear()","column().ccSearchClear()",function(){var n=this;return this.iterator("column",function(t,e){n.trigger("cc-search-clear",[e])})}),y.ext.buttons.ccSearchClear={text:function(t){return t.i18n("columnControl.buttons.searchClear","Clear search")},init:function(n,t,e){var r=this;n.on("draw",function(){var t=!1,e=!!n.search();e||n.columns().every(function(){(this.search.fixed("dtcc")||this.search.fixed("dtcc-list"))&&(t=!0)}),r.enable(e||t)}),this.enable(!1)},action:function(t,e,n,r){e.search(""),e.columns().ccSearchClear(),e.draw()}},y});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/*! ColumnControl 1.0.
|
|
1
|
+
/*! ColumnControl 1.0.6
|
|
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){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;
|
|
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}}function focusCapture(r,o){return function(t){var e,n;r._shown&&(e=Array.from(r.querySelectorAll("a, button, input, select")),n=document.activeElement,"Escape"===t.key?(r._close(),o.focus()):"Tab"===t.key&&0!==e.length&&(e.includes(n)?t.shiftKey?n===e[0]&&(e[e.length-1].focus(),t.preventDefault()):n===e[e.length-1]&&(e[0].focus(),t.preventDefault()):(e[0].focus(),t.preventDefault())))}}var dropdownContent={classes:{container:"dtcc-dropdown",liner:"dtcc-dropdown-liner"},defaults:{className:"dropdown",content:[],icon:"menu",text:"More..."},init:function(n){var r=this.dt(),o=createElement("div",dropdownContent.classes.container,"",[createElement("div",dropdownContent.classes.liner)]),t=(o._shown=!1,o._close=function(){o.remove(),o._shown=!1},o.setAttribute("role","dialog"),o.setAttribute("aria-label",r.i18n("columnControl.dropdown",n.text)),r.on("fixedheader-mode",function(){o._shown&&attachDropdown(o,r,n._parents?n._parents[0]:i)}),o.childNodes[0]),i=new Button(r).text(r.i18n("columnControl.dropdown",n.text)).icon(n.icon).className(n.className).dropdownDisplay(t).handler(function(t){var e;t._closed&&t._closed.includes(o)||(attachDropdown(o,r,n._parents?n._parents[0]:i),(e=o.querySelector("input, a, button"))&&"keypress"===t.type&&e.focus())});i.element().setAttribute("aria-haspopup","dialog");for(var e=0;e<n.content.length;e++){var a=this.resolve(n.content[e]),a=(a.config._parents||(a.config._parents=[]),a.config._parents.push(i),a.plugin.init.call(this,a.config));t.appendChild(a)}n._parents&&n._parents.length&&i.extra("chevronRight"),r.on("columns-reordered",function(){positionDropdown(o,r,i.element())});var s=focusCapture(o,i.element());return document.body.addEventListener("keydown",s),r.on("destroy",function(){document.body.removeEventListener("keydown",s)}),i.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.setAttribute("type","button"),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._dom.button.removeEventListener("keypress",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._dom.button.addEventListener("keypress",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._dom.button.setAttribute("aria-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),a.selectAll.setAttribute("type","button"),a.selectNone.setAttribute("type","button"));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,i18n:u.settings()[0].oLanguage.datetime,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").toString();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){s.one("draw",function(){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(),e=createElement("div",t.className,e.i18n("columnControl.spacer",t.text));return e.setAttribute("role","separator"),e}},title={defaults:{className:"dtcc-title",text:null},init:function(t){var e=this.dt().column(this.idx()).title(),n=null===t.text?"[title]":t.text;return 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.6",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:function(t){return t.i18n("columnControl.buttons.searchClear","Clear search")},init:function(n,t,e){var r=this;n.on("draw",function(){var t=!1,e=!!n.search();e||n.columns().every(function(){(this.search.fixed("dtcc")||this.search.fixed("dtcc-list"))&&(t=!0)}),r.enable(e||t)}),this.enable(!1)},action:function(t,e,n,r){e.search(""),e.columns().ccSearchClear(),e.draw()}};export default DataTable;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! ColumnControl 1.0.
|
|
1
|
+
/*! ColumnControl 1.0.6
|
|
2
2
|
* Copyright (c) SpryMedia Ltd - datatables.net/license
|
|
3
3
|
*
|
|
4
4
|
* SVG icons: ISC License
|
|
@@ -212,6 +212,51 @@ function relativePosition(parent, origin) {
|
|
|
212
212
|
left: left
|
|
213
213
|
};
|
|
214
214
|
}
|
|
215
|
+
/**
|
|
216
|
+
* Function that will provide the keyboard navigation for the dropdown
|
|
217
|
+
*
|
|
218
|
+
* @param dropdown Dropdown element in question
|
|
219
|
+
* @returns Function that can be bound to `keypress`
|
|
220
|
+
*/
|
|
221
|
+
function focusCapture(dropdown, host) {
|
|
222
|
+
return function (e) {
|
|
223
|
+
// Do nothing if not shown
|
|
224
|
+
if (!dropdown._shown) {
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
// Focus trap for tab key
|
|
228
|
+
var elements = Array.from(dropdown.querySelectorAll('a, button, input, select'));
|
|
229
|
+
var active = document.activeElement;
|
|
230
|
+
// An escape key should close the dropdown
|
|
231
|
+
if (e.key === 'Escape') {
|
|
232
|
+
dropdown._close();
|
|
233
|
+
host.focus(); // Restore focus to the host
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
else if (e.key !== 'Tab' || elements.length === 0) {
|
|
237
|
+
// Anything other than tab we aren't interested in from here
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
if (!elements.includes(active)) {
|
|
241
|
+
// If new focus is not inside the popover we want to drag it back in
|
|
242
|
+
elements[0].focus();
|
|
243
|
+
e.preventDefault();
|
|
244
|
+
}
|
|
245
|
+
else if (e.shiftKey) {
|
|
246
|
+
// Reverse tabbing order when shift key is pressed
|
|
247
|
+
if (active === elements[0]) {
|
|
248
|
+
elements[elements.length - 1].focus();
|
|
249
|
+
e.preventDefault();
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
if (active === elements[elements.length - 1]) {
|
|
254
|
+
elements[0].focus();
|
|
255
|
+
e.preventDefault();
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
}
|
|
215
260
|
var dropdownContent = {
|
|
216
261
|
classes: {
|
|
217
262
|
container: 'dtcc-dropdown',
|
|
@@ -233,6 +278,8 @@ var dropdownContent = {
|
|
|
233
278
|
dropdown.remove();
|
|
234
279
|
dropdown._shown = false;
|
|
235
280
|
};
|
|
281
|
+
dropdown.setAttribute('role', 'dialog');
|
|
282
|
+
dropdown.setAttribute('aria-label', dt.i18n('columnControl.dropdown', config.text));
|
|
236
283
|
// When FixedHeader is used, the transition between states messes up positioning, so if
|
|
237
284
|
// shown we just reattach the dropdown.
|
|
238
285
|
dt.on('fixedheader-mode', function () {
|
|
@@ -254,7 +301,13 @@ var dropdownContent = {
|
|
|
254
301
|
return;
|
|
255
302
|
}
|
|
256
303
|
attachDropdown(dropdown, dt, config._parents ? config._parents[0] : btn);
|
|
304
|
+
// When activated using a key - auto focus on the first item in the popover
|
|
305
|
+
var focusable = dropdown.querySelector('input, a, button');
|
|
306
|
+
if (focusable && e.type === 'keypress') {
|
|
307
|
+
focusable.focus();
|
|
308
|
+
}
|
|
257
309
|
});
|
|
310
|
+
btn.element().setAttribute('aria-haspopup', 'dialog');
|
|
258
311
|
// Add the content for the dropdown
|
|
259
312
|
for (var i = 0; i < config.content.length; i++) {
|
|
260
313
|
var content = this.resolve(config.content[i]);
|
|
@@ -275,6 +328,12 @@ var dropdownContent = {
|
|
|
275
328
|
dt.on('columns-reordered', function () {
|
|
276
329
|
positionDropdown(dropdown, dt, btn.element());
|
|
277
330
|
});
|
|
331
|
+
// Focus capture events
|
|
332
|
+
var capture = focusCapture(dropdown, btn.element());
|
|
333
|
+
document.body.addEventListener('keydown', capture);
|
|
334
|
+
dt.on('destroy', function () {
|
|
335
|
+
document.body.removeEventListener('keydown', capture);
|
|
336
|
+
});
|
|
278
337
|
return btn.element();
|
|
279
338
|
}
|
|
280
339
|
};
|
|
@@ -305,6 +364,7 @@ var Button = /** @class */ (function () {
|
|
|
305
364
|
state: createElement('span', 'dtcc-button-state'),
|
|
306
365
|
text: createElement('span', 'dtcc-button-text')
|
|
307
366
|
};
|
|
367
|
+
this._dom.button.setAttribute('type', 'button');
|
|
308
368
|
this._dom.button.append(this._dom.icon);
|
|
309
369
|
this._dom.button.append(this._dom.text);
|
|
310
370
|
this._dom.button.append(this._dom.state);
|
|
@@ -371,6 +431,7 @@ var Button = /** @class */ (function () {
|
|
|
371
431
|
Button.prototype.destroy = function () {
|
|
372
432
|
if (this._s.buttonClick) {
|
|
373
433
|
this._dom.button.removeEventListener('click', this._s.buttonClick);
|
|
434
|
+
this._dom.button.removeEventListener('keypress', this._s.buttonClick);
|
|
374
435
|
}
|
|
375
436
|
if (this._s.namespace) {
|
|
376
437
|
this._s.dt.off('destroy.' + this._s.namespace);
|
|
@@ -438,6 +499,7 @@ var Button = /** @class */ (function () {
|
|
|
438
499
|
this._s.buttonClick = buttonClick;
|
|
439
500
|
this._s.namespace = 'dtcc-' + _namespace++;
|
|
440
501
|
this._dom.button.addEventListener('click', buttonClick);
|
|
502
|
+
this._dom.button.addEventListener('keypress', buttonClick);
|
|
441
503
|
// Use a unique namespace to be able to easily remove per button
|
|
442
504
|
this._s.dt.on('destroy.' + this._s.namespace, function () {
|
|
443
505
|
_this.destroy();
|
|
@@ -460,6 +522,7 @@ var Button = /** @class */ (function () {
|
|
|
460
522
|
}
|
|
461
523
|
this._dom.text.innerHTML = text;
|
|
462
524
|
this._s.label = text; // for fast retrieval
|
|
525
|
+
this._dom.button.setAttribute('aria-label', text);
|
|
463
526
|
return this;
|
|
464
527
|
};
|
|
465
528
|
Button.prototype.value = function (val) {
|
|
@@ -525,6 +588,8 @@ var CheckList = /** @class */ (function () {
|
|
|
525
588
|
dom.controls.append(dom.selectNone);
|
|
526
589
|
dom.selectAll.append(dom.selectAllCount);
|
|
527
590
|
dom.selectNone.append(dom.selectNoneCount);
|
|
591
|
+
dom.selectAll.setAttribute('type', 'button');
|
|
592
|
+
dom.selectNone.setAttribute('type', 'button');
|
|
528
593
|
}
|
|
529
594
|
// Events
|
|
530
595
|
var searchInput = function () {
|
|
@@ -1477,6 +1542,7 @@ var searchDateTime = {
|
|
|
1477
1542
|
if (DateTime) {
|
|
1478
1543
|
dateTime = new DateTime(searchInput.input(), {
|
|
1479
1544
|
format: displayFormat,
|
|
1545
|
+
i18n: dt.settings()[0].oLanguage.datetime, // could be undefined
|
|
1480
1546
|
onChange: function () {
|
|
1481
1547
|
fromPicker = true;
|
|
1482
1548
|
searchInput.runSearch();
|
|
@@ -1640,7 +1706,7 @@ function reloadOptions(dt, config, idx, checkList, loadedValues) {
|
|
|
1640
1706
|
var rows = dt.rows({ order: idx }).indexes().toArray();
|
|
1641
1707
|
var settings = dt.settings()[0];
|
|
1642
1708
|
for (var i = 0; i < rows.length; i++) {
|
|
1643
|
-
var filter = settings.fastData(rows[i], idx, 'filter');
|
|
1709
|
+
var filter = settings.fastData(rows[i], idx, 'filter').toString();
|
|
1644
1710
|
if (!found[filter]) {
|
|
1645
1711
|
found[filter] = true;
|
|
1646
1712
|
options.push({
|
|
@@ -1719,7 +1785,10 @@ var searchList = {
|
|
|
1719
1785
|
}
|
|
1720
1786
|
// Xhr event listener for updates of options
|
|
1721
1787
|
dt.on('xhr', function (e, s, json) {
|
|
1722
|
-
|
|
1788
|
+
// Need to wait for the draw to complete so the table has the latest data
|
|
1789
|
+
dt.one('draw', function () {
|
|
1790
|
+
reloadOptions(dt, config, _this.idx(), checkList, loadedValues);
|
|
1791
|
+
});
|
|
1723
1792
|
});
|
|
1724
1793
|
// Unlike the SearchInput based search contents, CheckList does not handle state saving
|
|
1725
1794
|
// (since the mechanism for column visibility is different), so state saving is handled
|
|
@@ -2051,6 +2120,7 @@ var spacer = {
|
|
|
2051
2120
|
init: function (config) {
|
|
2052
2121
|
var dt = this.dt();
|
|
2053
2122
|
var spacer = createElement('div', config.className, dt.i18n('columnControl.spacer', config.text));
|
|
2123
|
+
spacer.setAttribute('role', 'separator');
|
|
2054
2124
|
return spacer;
|
|
2055
2125
|
}
|
|
2056
2126
|
};
|
|
@@ -2255,7 +2325,7 @@ var ColumnControl = /** @class */ (function () {
|
|
|
2255
2325
|
/** SVG icons that can be used by the content plugins */
|
|
2256
2326
|
ColumnControl.icons = icons;
|
|
2257
2327
|
/** Version */
|
|
2258
|
-
ColumnControl.version = '1.0.
|
|
2328
|
+
ColumnControl.version = '1.0.6';
|
|
2259
2329
|
return ColumnControl;
|
|
2260
2330
|
}());
|
|
2261
2331
|
|
|
@@ -2330,7 +2400,9 @@ DataTable.Api.registerPlural('columns().ccSearchClear()', 'column().ccSearchClea
|
|
|
2330
2400
|
});
|
|
2331
2401
|
});
|
|
2332
2402
|
DataTable.ext.buttons.ccSearchClear = {
|
|
2333
|
-
text:
|
|
2403
|
+
text: function (dt) {
|
|
2404
|
+
return dt.i18n('columnControl.buttons.searchClear', 'Clear search');
|
|
2405
|
+
},
|
|
2334
2406
|
init: function (dt, node, config) {
|
|
2335
2407
|
var _this = this;
|
|
2336
2408
|
dt.on('draw', function () {
|