diff options
Diffstat (limited to 'src/main/resources/static/plugins/datatables-fixedcolumns/js')
4 files changed, 624 insertions, 0 deletions
diff --git a/src/main/resources/static/plugins/datatables-fixedcolumns/js/dataTables.fixedColumns.js b/src/main/resources/static/plugins/datatables-fixedcolumns/js/dataTables.fixedColumns.js new file mode 100644 index 0000000..90278c8 --- /dev/null +++ b/src/main/resources/static/plugins/datatables-fixedcolumns/js/dataTables.fixedColumns.js @@ -0,0 +1,557 @@ +/*! FixedColumns 4.0.0 + * 2019-2020 SpryMedia Ltd - datatables.net/license + */ +(function () { + 'use strict'; + + var $; + var dataTable; + function setJQuery(jq) { + $ = jq; + dataTable = $.fn.dataTable; + } + var FixedColumns = /** @class */ (function () { + function FixedColumns(settings, opts) { + var _this = this; + // Check that the required version of DataTables is included + if (!dataTable || !dataTable.versionCheck || !dataTable.versionCheck('1.10.0')) { + throw new Error('StateRestore requires DataTables 1.10 or newer'); + } + var table = new dataTable.Api(settings); + this.classes = $.extend(true, {}, FixedColumns.classes); + // Get options from user + this.c = $.extend(true, {}, FixedColumns.defaults, opts); + // Backwards compatibility for deprecated leftColumns + if (opts.left === undefined && this.c.leftColumns !== undefined) { + this.c.left = this.c.leftColumns; + } + // Backwards compatibility for deprecated rightColumns + if (opts.right === undefined && this.c.rightColumns !== undefined) { + this.c.right = this.c.rightColumns; + } + this.s = { + barWidth: 0, + dt: table, + rtl: $(table.table().node()).css('direction') === 'rtl' + }; + // Set the bar width if vertical scrolling is enabled + if (this.s.dt.settings()[0].oInit.scrollY === true) { + this.s.barWidth = this.s.dt.settings()[0].oBrowser.barWidth; + } + // Common CSS for all blockers + var blockerCSS = { + 'background-color': 'white', + 'bottom': '0px', + 'display': 'block', + 'position': 'absolute', + 'width': this.s.barWidth + 1 + 'px' + }; + this.dom = { + leftBottomBlocker: $('<div>') + .css(blockerCSS) + .css('left', 0) + .addClass(this.classes.leftBottomBlocker), + leftTopBlocker: $('<div>') + .css(blockerCSS) + .css({ + left: 0, + top: 0 + }) + .addClass(this.classes.leftTopBlocker), + rightBottomBlocker: $('<div>') + .css(blockerCSS) + .css('right', 0) + .addClass(this.classes.rightBottomBlocker), + rightTopBlocker: $('<div>') + .css(blockerCSS) + .css({ + right: 0, + top: 0 + }) + .addClass(this.classes.rightTopBlocker) + }; + if (this.s.dt.settings()[0]._bInitComplete) { + // Fixed Columns Initialisation + this._addStyles(); + this._setKeyTableListener(); + } + else { + table.one('preInit.dt', function () { + // Fixed Columns Initialisation + _this._addStyles(); + _this._setKeyTableListener(); + }); + } + // Make class available through dt object + table.settings()[0]._fixedColumns = this; + return this; + } + /** + * Getter/Setter for the fixedColumns.left property + * + * @param newVal Optional. If present this will be the new value for the number of left fixed columns + * @returns The number of left fixed columns + */ + FixedColumns.prototype.left = function (newVal) { + // If the value is to change + if (newVal !== undefined) { + // Set the new values and redraw the columns + this.c.left = newVal; + this._addStyles(); + } + return this.c.left; + }; + /** + * Getter/Setter for the fixedColumns.left property + * + * @param newVal Optional. If present this will be the new value for the number of right fixed columns + * @returns The number of right fixed columns + */ + FixedColumns.prototype.right = function (newVal) { + // If the value is to change + if (newVal !== undefined) { + // Set the new values and redraw the columns + this.c.right = newVal; + this._addStyles(); + } + return this.c.right; + }; + /** + * Iterates over the columns, fixing the appropriate ones to the left and right + */ + FixedColumns.prototype._addStyles = function () { + var parentDiv = null; + // Get the header and it's height + var header = this.s.dt.column(0).header(); + var headerHeight = null; + if (header !== null) { + header = $(header); + headerHeight = header.outerHeight() + 1; + parentDiv = $(header.closest('div.dataTables_scroll')).css('position', 'relative'); + } + // Get the footer and it's height + var footer = this.s.dt.column(0).footer(); + var footerHeight = null; + if (footer !== null) { + footer = $(footer); + footerHeight = footer.outerHeight(); + // Only attempt to retrieve the parentDiv if it has not been retrieved already + if (parentDiv === null) { + parentDiv = $(footer.closest('div.dataTables_scroll')).css('position', 'relative'); + } + } + // Get the number of columns in the table - this is used often so better to only make 1 api call + var numCols = this.s.dt.columns().data().toArray().length; + // Tracker for the number of pixels should be left to the left of the table + var distLeft = 0; + // Get all of the row elements in the table + var rows = $(this.s.dt.table().node()).children('tbody').children('tr'); + var invisibles = 0; + // Iterate over all of the columns + for (var i = 0; i < numCols; i++) { + var column = this.s.dt.column(i); + if (!column.visible()) { + invisibles++; + continue; + } + // Get the columns header and footer element + var colHeader = $(column.header()); + var colFooter = $(column.footer()); + // If i is less than the value of left then this column should be fixed left + if (i < this.c.left) { + $(this.s.dt.table().node()).addClass(this.classes.tableFixedLeft); + parentDiv.addClass(this.classes.tableFixedLeft); + // Add the width of the previous node - only if we are on atleast the second column + if (i !== 0) { + var prevCol = this.s.dt.column(i - 1); + if (prevCol.visible()) { + distLeft += $(prevCol.nodes()[0]).outerWidth(); + } + } + // Iterate over all of the rows, fixing the cell to the left + for (var _i = 0, rows_1 = rows; _i < rows_1.length; _i++) { + var row = rows_1[_i]; + $($(row).children()[i - invisibles]) + .css(this._getCellCSS(false, distLeft, 'left')) + .addClass(this.classes.fixedLeft); + } + // Add the css for the header and the footer + colHeader + .css(this._getCellCSS(true, distLeft, 'left')) + .addClass(this.classes.fixedLeft); + colFooter + .css(this._getCellCSS(true, distLeft, 'left')) + .addClass(this.classes.fixedLeft); + } + else { + // Iteriate through all of the rows, making sure they aren't currently trying to fix left + for (var _a = 0, rows_2 = rows; _a < rows_2.length; _a++) { + var row = rows_2[_a]; + var cell = $($(row).children()[i - invisibles]); + // If the cell is trying to fix to the left, remove the class and the css + if (cell.hasClass(this.classes.fixedLeft)) { + cell + .css(this._clearCellCSS('left')) + .removeClass(this.classes.fixedLeft); + } + } + // Make sure the header for this column isn't fixed left + if (colHeader.hasClass(this.classes.fixedLeft)) { + colHeader + .css(this._clearCellCSS('left')) + .removeClass(this.classes.fixedLeft); + } + // Make sure the footer for this column isn't fixed left + if (colFooter.hasClass(this.classes.fixedLeft)) { + colFooter + .css(this._clearCellCSS('left')) + .removeClass(this.classes.fixedLeft); + } + } + } + // If there is a header with the index class and reading rtl then add left top blocker + if (header !== null && !header.hasClass('index')) { + if (this.s.rtl) { + this.dom.leftTopBlocker.outerHeight(headerHeight); + parentDiv.append(this.dom.leftTopBlocker); + } + else { + this.dom.rightTopBlocker.outerHeight(headerHeight); + parentDiv.append(this.dom.rightTopBlocker); + } + } + // If there is a footer with the index class and reading rtl then add left bottom blocker + if (footer !== null && !footer.hasClass('index')) { + if (this.s.rtl) { + this.dom.leftBottomBlocker.outerHeight(footerHeight); + parentDiv.append(this.dom.leftBottomBlocker); + } + else { + this.dom.rightBottomBlocker.outerHeight(footerHeight); + parentDiv.append(this.dom.rightBottomBlocker); + } + } + var distRight = 0; + invisibles = 0; + for (var i = numCols - 1; i >= 0; i--) { + var column = this.s.dt.column(i); + // Get the columns header and footer element + var colHeader = $(column.header()); + var colFooter = $(column.footer()); + if (!column.visible()) { + invisibles++; + continue; + } + if (i >= numCols - this.c.right) { + $(this.s.dt.table().node()).addClass(this.classes.tableFixedRight); + parentDiv.addClass(this.classes.tableFixedLeft); + // Add the widht of the previous node, only if we are on atleast the second column + if (i !== numCols - 1) { + var prevCol = this.s.dt.column(i + 1); + if (prevCol.visible()) { + distRight += $(prevCol.nodes()[0]).outerWidth(); + } + } + // Iterate over all of the rows, fixing the cell to the right + for (var _b = 0, rows_3 = rows; _b < rows_3.length; _b++) { + var row = rows_3[_b]; + $($(row).children()[i + invisibles]) + .css(this._getCellCSS(false, distRight, 'right')) + .addClass(this.classes.fixedRight); + } + // Add the css for the header and the footer + colHeader + .css(this._getCellCSS(true, distRight, 'right')) + .addClass(this.classes.fixedRight); + colFooter + .css(this._getCellCSS(true, distRight, 'right')) + .addClass(this.classes.fixedRight); + } + else { + // Iteriate through all of the rows, making sure they aren't currently trying to fix right + for (var _c = 0, rows_4 = rows; _c < rows_4.length; _c++) { + var row = rows_4[_c]; + var cell = $($(row).children()[i + invisibles]); + // If the cell is trying to fix to the right, remove the class and the css + if (cell.hasClass(this.classes.fixedRight)) { + cell + .css(this._clearCellCSS('right')) + .removeClass(this.classes.fixedRight); + } + } + // Make sure the header for this column isn't fixed right + if (colHeader.hasClass(this.classes.fixedRight)) { + colHeader + .css(this._clearCellCSS('right')) + .removeClass(this.classes.fixedRight); + } + // Make sure the footer for this column isn't fixed right + if (colFooter.hasClass(this.classes.fixedRight)) { + colFooter + .css(this._clearCellCSS('right')) + .removeClass(this.classes.fixedRight); + } + } + } + // If there is a header with the index class and reading rtl then add right top blocker + if (header) { + if (!this.s.rtl) { + this.dom.rightTopBlocker.outerHeight(headerHeight); + parentDiv.append(this.dom.rightTopBlocker); + } + else { + this.dom.leftTopBlocker.outerHeight(headerHeight); + parentDiv.append(this.dom.leftTopBlocker); + } + } + // If there is a footer with the index class and reading rtl then add right bottom blocker + if (footer) { + if (!this.s.rtl) { + this.dom.rightBottomBlocker.outerHeight(footerHeight); + parentDiv.append(this.dom.rightBottomBlocker); + } + else { + this.dom.leftBottomBlocker.outerHeight(footerHeight); + parentDiv.append(this.dom.leftBottomBlocker); + } + } + }; + /** + * Gets the correct CSS for the cell, header or footer based on options provided + * + * @param header Whether this cell is a header or a footer + * @param dist The distance that the cell should be moved away from the edge + * @param lr Indicator of fixing to the left or the right + * @returns An object containing the correct css + */ + FixedColumns.prototype._getCellCSS = function (header, dist, lr) { + if (lr === 'left') { + return !this.s.rtl ? + { + left: dist + 'px', + position: 'sticky' + } : + { + position: 'sticky', + right: dist + (header ? this.s.barWidth : 0) + 'px' + }; + } + else { + return !this.s.rtl ? + { + position: 'sticky', + right: dist + (header ? this.s.barWidth : 0) + 'px' + } : + { + left: dist + 'px', + position: 'sticky' + }; + } + }; + /** + * Gets the css that is required to clear the fixing to a side + * + * @param lr Indicator of fixing to the left or the right + * @returns An object containing the correct css + */ + FixedColumns.prototype._clearCellCSS = function (lr) { + if (lr === 'left') { + return !this.s.rtl ? + { + left: '', + position: '' + } : + { + position: '', + right: '' + }; + } + else { + return !this.s.rtl ? + { + position: '', + right: '' + } : + { + left: '', + position: '' + }; + } + }; + FixedColumns.prototype._setKeyTableListener = function () { + var _this = this; + this.s.dt.on('key-focus', function (e, dt, cell) { + var cellPos = $(cell.node()).offset(); + var scroll = $($(_this.s.dt.table().node()).closest('div.dataTables_scrollBody')); + // If there are fixed columns to the left + if (_this.c.left > 0) { + // Get the rightmost left fixed column header, it's position and it's width + var rightMost = $(_this.s.dt.column(_this.c.left - 1).header()); + var rightMostPos = rightMost.offset(); + var rightMostWidth = rightMost.outerWidth(); + // If the current highlighted cell is left of the rightmost cell on the screen + if (cellPos.left < rightMostPos.left + rightMostWidth) { + // Scroll it into view + var currScroll = scroll.scrollLeft(); + scroll.scrollLeft(currScroll - (rightMostPos.left + rightMostWidth - cellPos.left)); + } + } + // If there are fixed columns to the right + if (_this.c.right > 0) { + // Get the number of columns and the width of the cell as doing right side calc + var numCols = _this.s.dt.columns().data().toArray().length; + var cellWidth = $(cell.node()).outerWidth(); + // Get the leftmost right fixed column header and it's position + var leftMost = $(_this.s.dt.column(numCols - _this.c.right).header()); + var leftMostPos = leftMost.offset(); + // If the current highlighted cell is right of the leftmost cell on the screen + if (cellPos.left + cellWidth > leftMostPos.left) { + // Scroll it into view + var currScroll = scroll.scrollLeft(); + scroll.scrollLeft(currScroll - (leftMostPos.left - (cellPos.left + cellWidth))); + } + } + }); + // Whenever a draw occurs there is potential for the data to have changed and therefore also the column widths + // Therefore it is necessary to recalculate the values for the fixed columns + this.s.dt.on('draw', function () { + _this._addStyles(); + }); + this.s.dt.on('column-reorder', function () { + _this._addStyles(); + }); + this.s.dt.on('column-visibility', function () { + _this._addStyles(); + }); + }; + FixedColumns.version = '4.0.0'; + FixedColumns.classes = { + fixedLeft: 'dtfc-fixed-left', + fixedRight: 'dtfc-fixed-right', + leftBottomBlocker: 'dtfc-left-bottom-blocker', + leftTopBlocker: 'dtfc-left-top-blocker', + rightBottomBlocker: 'dtfc-right-bottom-blocker', + rightTopBlocker: 'dtfc-right-top-blocker', + tableFixedLeft: 'dtfc-has-left', + tableFixedRight: 'dtfc-has-right' + }; + FixedColumns.defaults = { + i18n: { + button: 'FixedColumns' + }, + left: 1, + right: 0 + }; + return FixedColumns; + }()); + + /*! FixedColumns 4.0.0 + * 2019-2020 SpryMedia Ltd - datatables.net/license + */ + // DataTables extensions common UMD. Note that this allows for AMD, CommonJS + // (with window and jQuery being allowed as parameters to the returned + // function) or just default browser loading. + (function (factory) { + if (typeof define === 'function' && define.amd) { + // AMD + define(['jquery', 'datatables.net'], function ($) { + return factory($, window, document); + }); + } + else if (typeof exports === 'object') { + // CommonJS + module.exports = function (root, $) { + if (!root) { + root = window; + } + if (!$ || !$.fn.dataTable) { + // eslint-disable-next-line @typescript-eslint/no-var-requires + $ = require('datatables.net')(root, $).$; + } + return factory($, root, root.document); + }; + } + else { + // Browser - assume jQuery has already been loaded + factory(window.jQuery, window, document); + } + }(function ($, window, document) { + setJQuery($); + var dataTable = $.fn.dataTable; + $.fn.dataTable.FixedColumns = FixedColumns; + $.fn.DataTable.FixedColumns = FixedColumns; + var apiRegister = $.fn.dataTable.Api.register; + apiRegister('fixedColumns()', function () { + return this; + }); + apiRegister('fixedColumns().left()', function (newVal) { + var ctx = this.context[0]; + if (newVal !== undefined) { + ctx._fixedColumns.left(newVal); + return this; + } + else { + return ctx._fixedColumns.left(); + } + }); + apiRegister('fixedColumns().right()', function (newVal) { + var ctx = this.context[0]; + if (newVal !== undefined) { + ctx._fixedColumns.right(newVal); + return this; + } + else { + return ctx._fixedColumns.right(); + } + }); + $.fn.dataTable.ext.buttons.fixedColumns = { + action: function (e, dt, node, config) { + if ($(node).attr('active')) { + $(node).removeAttr('active').removeClass('active'); + dt.fixedColumns().left(0); + dt.fixedColumns().right(0); + } + else { + $(node).attr('active', true).addClass('active'); + dt.fixedColumns().left(config.config.left); + dt.fixedColumns().right(config.config.right); + } + }, + config: { + left: 1, + right: 0 + }, + init: function (dt, node, config) { + if (dt.settings()[0]._fixedColumns === undefined) { + _init(dt.settings(), config); + } + $(node).attr('active', true).addClass('active'); + dt.button(node).text(config.text || dt.i18n('buttons.fixedColumns', dt.settings()[0]._fixedColumns.c.i18n.button)); + }, + text: null + }; + function _init(settings, options) { + if (options === void 0) { options = null; } + var api = new dataTable.Api(settings); + var opts = options + ? options + : api.init().fixedColumns || dataTable.defaults.fixedColumns; + var fixedColumns = new FixedColumns(api, opts); + return fixedColumns; + } + // Attach a listener to the document which listens for DataTables initialisation + // events so we can automatically initialise + $(document).on('init.dt.dtfc', function (e, settings) { + if (e.namespace !== 'dt') { + return; + } + if (settings.oInit.fixedColumns || + dataTable.defaults.fixedColumns) { + if (!settings._fixedColumns) { + _init(settings, null); + } + } + }); + })); + +}()); diff --git a/src/main/resources/static/plugins/datatables-fixedcolumns/js/dataTables.fixedColumns.min.js b/src/main/resources/static/plugins/datatables-fixedcolumns/js/dataTables.fixedColumns.min.js new file mode 100644 index 0000000..3b72a60 --- /dev/null +++ b/src/main/resources/static/plugins/datatables-fixedcolumns/js/dataTables.fixedColumns.min.js @@ -0,0 +1,19 @@ +/*! + FixedColumns 4.0.0 + 2019-2020 SpryMedia Ltd - datatables.net/license +*/ +(function(){var b,v,w=function(){function f(a,c){var h=this;if(!v||!v.versionCheck||!v.versionCheck("1.10.0"))throw Error("StateRestore requires DataTables 1.10 or newer");a=new v.Api(a);this.classes=b.extend(!0,{},f.classes);this.c=b.extend(!0,{},f.defaults,c);void 0===c.left&&void 0!==this.c.leftColumns&&(this.c.left=this.c.leftColumns);void 0===c.right&&void 0!==this.c.rightColumns&&(this.c.right=this.c.rightColumns);this.s={barWidth:0,dt:a,rtl:"rtl"===b(a.table().node()).css("direction")};!0=== +this.s.dt.settings()[0].oInit.scrollY&&(this.s.barWidth=this.s.dt.settings()[0].oBrowser.barWidth);c={"background-color":"white",bottom:"0px",display:"block",position:"absolute",width:this.s.barWidth+1+"px"};this.dom={leftBottomBlocker:b("<div>").css(c).css("left",0).addClass(this.classes.leftBottomBlocker),leftTopBlocker:b("<div>").css(c).css({left:0,top:0}).addClass(this.classes.leftTopBlocker),rightBottomBlocker:b("<div>").css(c).css("right",0).addClass(this.classes.rightBottomBlocker),rightTopBlocker:b("<div>").css(c).css({right:0, +top:0}).addClass(this.classes.rightTopBlocker)};if(this.s.dt.settings()[0]._bInitComplete)this._addStyles(),this._setKeyTableListener();else a.one("preInit.dt",function(){h._addStyles();h._setKeyTableListener()});a.settings()[0]._fixedColumns=this;return this}f.prototype.left=function(a){void 0!==a&&(this.c.left=a,this._addStyles());return this.c.left};f.prototype.right=function(a){void 0!==a&&(this.c.right=a,this._addStyles());return this.c.right};f.prototype._addStyles=function(){var a=null,c=this.s.dt.column(0).header(), +h=null;null!==c&&(c=b(c),h=c.outerHeight()+1,a=b(c.closest("div.dataTables_scroll")).css("position","relative"));var l=this.s.dt.column(0).footer(),e=null;null!==l&&(l=b(l),e=l.outerHeight(),null===a&&(a=b(l.closest("div.dataTables_scroll")).css("position","relative")));for(var d=this.s.dt.columns().data().toArray().length,k=0,q=b(this.s.dt.table().node()).children("tbody").children("tr"),r=0,m=0;m<d;m++){var g=this.s.dt.column(m);if(g.visible()){var t=b(g.header()),u=b(g.footer());if(m<this.c.left){b(this.s.dt.table().node()).addClass(this.classes.tableFixedLeft); +a.addClass(this.classes.tableFixedLeft);0!==m&&(g=this.s.dt.column(m-1),g.visible()&&(k+=b(g.nodes()[0]).outerWidth()));for(var n=0,p=q;n<p.length;n++)g=p[n],b(b(g).children()[m-r]).css(this._getCellCSS(!1,k,"left")).addClass(this.classes.fixedLeft);t.css(this._getCellCSS(!0,k,"left")).addClass(this.classes.fixedLeft);u.css(this._getCellCSS(!0,k,"left")).addClass(this.classes.fixedLeft)}else{n=0;for(p=q;n<p.length;n++)g=p[n],g=b(b(g).children()[m-r]),g.hasClass(this.classes.fixedLeft)&&g.css(this._clearCellCSS("left")).removeClass(this.classes.fixedLeft); +t.hasClass(this.classes.fixedLeft)&&t.css(this._clearCellCSS("left")).removeClass(this.classes.fixedLeft);u.hasClass(this.classes.fixedLeft)&&u.css(this._clearCellCSS("left")).removeClass(this.classes.fixedLeft)}}else r++}null===c||c.hasClass("index")||(this.s.rtl?(this.dom.leftTopBlocker.outerHeight(h),a.append(this.dom.leftTopBlocker)):(this.dom.rightTopBlocker.outerHeight(h),a.append(this.dom.rightTopBlocker)));null===l||l.hasClass("index")||(this.s.rtl?(this.dom.leftBottomBlocker.outerHeight(e), +a.append(this.dom.leftBottomBlocker)):(this.dom.rightBottomBlocker.outerHeight(e),a.append(this.dom.rightBottomBlocker)));r=k=0;for(m=d-1;0<=m;m--)if(g=this.s.dt.column(m),t=b(g.header()),u=b(g.footer()),g.visible())if(m>=d-this.c.right){b(this.s.dt.table().node()).addClass(this.classes.tableFixedRight);a.addClass(this.classes.tableFixedLeft);m!==d-1&&(g=this.s.dt.column(m+1),g.visible()&&(k+=b(g.nodes()[0]).outerWidth()));n=0;for(p=q;n<p.length;n++)g=p[n],b(b(g).children()[m+r]).css(this._getCellCSS(!1, +k,"right")).addClass(this.classes.fixedRight);t.css(this._getCellCSS(!0,k,"right")).addClass(this.classes.fixedRight);u.css(this._getCellCSS(!0,k,"right")).addClass(this.classes.fixedRight)}else{n=0;for(p=q;n<p.length;n++)g=p[n],g=b(b(g).children()[m+r]),g.hasClass(this.classes.fixedRight)&&g.css(this._clearCellCSS("right")).removeClass(this.classes.fixedRight);t.hasClass(this.classes.fixedRight)&&t.css(this._clearCellCSS("right")).removeClass(this.classes.fixedRight);u.hasClass(this.classes.fixedRight)&& +u.css(this._clearCellCSS("right")).removeClass(this.classes.fixedRight)}else r++;c&&(this.s.rtl?(this.dom.leftTopBlocker.outerHeight(h),a.append(this.dom.leftTopBlocker)):(this.dom.rightTopBlocker.outerHeight(h),a.append(this.dom.rightTopBlocker)));l&&(this.s.rtl?(this.dom.leftBottomBlocker.outerHeight(e),a.append(this.dom.leftBottomBlocker)):(this.dom.rightBottomBlocker.outerHeight(e),a.append(this.dom.rightBottomBlocker)))};f.prototype._getCellCSS=function(a,c,h){return"left"===h?this.s.rtl?{position:"sticky", +right:c+(a?this.s.barWidth:0)+"px"}:{left:c+"px",position:"sticky"}:this.s.rtl?{left:c+"px",position:"sticky"}:{position:"sticky",right:c+(a?this.s.barWidth:0)+"px"}};f.prototype._clearCellCSS=function(a){return"left"===a?this.s.rtl?{position:"",right:""}:{left:"",position:""}:this.s.rtl?{left:"",position:""}:{position:"",right:""}};f.prototype._setKeyTableListener=function(){var a=this;this.s.dt.on("key-focus",function(c,h,l){c=b(l.node()).offset();h=b(b(a.s.dt.table().node()).closest("div.dataTables_scrollBody")); +if(0<a.c.left){var e=b(a.s.dt.column(a.c.left-1).header()),d=e.offset(),k=e.outerWidth();c.left<d.left+k&&(e=h.scrollLeft(),h.scrollLeft(e-(d.left+k-c.left)))}0<a.c.right&&(e=a.s.dt.columns().data().toArray().length,l=b(l.node()).outerWidth(),d=b(a.s.dt.column(e-a.c.right).header()).offset(),c.left+l>d.left&&(e=h.scrollLeft(),h.scrollLeft(e-(d.left-(c.left+l)))))});this.s.dt.on("draw",function(){a._addStyles()});this.s.dt.on("column-reorder",function(){a._addStyles()});this.s.dt.on("column-visibility", +function(){a._addStyles()})};f.version="4.0.0";f.classes={fixedLeft:"dtfc-fixed-left",fixedRight:"dtfc-fixed-right",leftBottomBlocker:"dtfc-left-bottom-blocker",leftTopBlocker:"dtfc-left-top-blocker",rightBottomBlocker:"dtfc-right-bottom-blocker",rightTopBlocker:"dtfc-right-top-blocker",tableFixedLeft:"dtfc-has-left",tableFixedRight:"dtfc-has-right"};f.defaults={i18n:{button:"FixedColumns"},left:1,right:0};return f}();(function(f){"function"===typeof define&&define.amd?define(["jquery","datatables.net"], +function(a){return f(a,window,document)}):"object"===typeof exports?module.exports=function(a,c){a||(a=window);c&&c.fn.dataTable||(c=require("datatables.net")(a,c).$);return f(c,a,a.document)}:f(window.jQuery,window,document)})(function(f,a,c){function h(e,d){void 0===d&&(d=null);e=new l.Api(e);d=d?d:e.init().fixedColumns||l.defaults.fixedColumns;return new w(e,d)}b=f;v=b.fn.dataTable;var l=f.fn.dataTable;f.fn.dataTable.FixedColumns=w;f.fn.DataTable.FixedColumns=w;a=f.fn.dataTable.Api.register;a("fixedColumns()", +function(){return this});a("fixedColumns().left()",function(e){var d=this.context[0];return void 0!==e?(d._fixedColumns.left(e),this):d._fixedColumns.left()});a("fixedColumns().right()",function(e){var d=this.context[0];return void 0!==e?(d._fixedColumns.right(e),this):d._fixedColumns.right()});f.fn.dataTable.ext.buttons.fixedColumns={action:function(e,d,k,q){f(k).attr("active")?(f(k).removeAttr("active").removeClass("active"),d.fixedColumns().left(0),d.fixedColumns().right(0)):(f(k).attr("active", +!0).addClass("active"),d.fixedColumns().left(q.config.left),d.fixedColumns().right(q.config.right))},config:{left:1,right:0},init:function(e,d,k){void 0===e.settings()[0]._fixedColumns&&h(e.settings(),k);f(d).attr("active",!0).addClass("active");e.button(d).text(k.text||e.i18n("buttons.fixedColumns",e.settings()[0]._fixedColumns.c.i18n.button))},text:null};f(c).on("init.dt.dtfc",function(e,d){"dt"===e.namespace&&(d.oInit.fixedColumns||l.defaults.fixedColumns)&&(d._fixedColumns||h(d,null))})})})(); diff --git a/src/main/resources/static/plugins/datatables-fixedcolumns/js/fixedColumns.bootstrap4.js b/src/main/resources/static/plugins/datatables-fixedcolumns/js/fixedColumns.bootstrap4.js new file mode 100644 index 0000000..aa2aeee --- /dev/null +++ b/src/main/resources/static/plugins/datatables-fixedcolumns/js/fixedColumns.bootstrap4.js @@ -0,0 +1,43 @@ +/*! FixedColumns 4.0.1 + * 2019-2021 SpryMedia Ltd - datatables.net/license + */ +(function () { + 'use strict'; + + /*! Bootstrap 4 integration for DataTables' FixedColumns + * ©2016 SpryMedia Ltd - datatables.net/license + */ + (function (factory) { + if (typeof define === 'function' && define.amd) { + // AMD + define(['jquery', 'datatables.net-bs4', 'datatables.net-fixedcolumns'], function ($) { + return factory($); + }); + } + else if (typeof exports === 'object') { + // CommonJS + module.exports = function (root, $) { + if (!root) { + root = window; + } + if (!$ || !$.fn.dataTable) { + // eslint-disable-next-line @typescript-eslint/no-var-requires + $ = require('datatables.net-bs4')(root, $).$; + } + if (!$.fn.dataTable.SearchPanes) { + // eslint-disable-next-line @typescript-eslint/no-var-requires + require('datatables.net-fixedcolumns')(root, $); + } + return factory($); + }; + } + else { + // Browser + factory(jQuery); + } + }(function ($) { + var dataTable = $.fn.dataTable; + return dataTable.fixedColumns; + })); + +}()); diff --git a/src/main/resources/static/plugins/datatables-fixedcolumns/js/fixedColumns.bootstrap4.min.js b/src/main/resources/static/plugins/datatables-fixedcolumns/js/fixedColumns.bootstrap4.min.js new file mode 100644 index 0000000..cca66d8 --- /dev/null +++ b/src/main/resources/static/plugins/datatables-fixedcolumns/js/fixedColumns.bootstrap4.min.js @@ -0,0 +1,5 @@ +/*! + Bootstrap 4 integration for DataTables' FixedColumns + ©2016 SpryMedia Ltd - datatables.net/license +*/ +(function(c){"function"===typeof define&&define.amd?define(["jquery","datatables.net-bs4","datatables.net-fixedcolumns"],function(b){return c(b)}):"object"===typeof exports?module.exports=function(b,a){b||(b=window);a&&a.fn.dataTable||(a=require("datatables.net-bs4")(b,a).$);a.fn.dataTable.SearchPanes||require("datatables.net-fixedcolumns")(b,a);return c(a)}:c(jQuery)})(function(c){return c.fn.dataTable.fixedColumns}); |