| 18125 | } |
| 18126 | var FixedColumns = /** @class */ (function () { |
| 18127 | function FixedColumns(settings, opts) { |
| 18128 | var _this = this |
| 18129 | // Check that the required version of DataTables is included |
| 18130 | if (!DataTable$1 || !DataTable$1.versionCheck || !DataTable$1.versionCheck("2")) { |
| 18131 | throw new Error("FixedColumns requires DataTables 2 or newer") |
| 18132 | } |
| 18133 | var table = new DataTable$1.Api(settings) |
| 18134 | this.classes = $$1.extend(true, {}, FixedColumns.classes) |
| 18135 | // Get options from user |
| 18136 | this.c = $$1.extend(true, {}, FixedColumns.defaults, opts) |
| 18137 | this.s = { |
| 18138 | dt: table, |
| 18139 | rtl: $$1(table.table().node()).css("direction") === "rtl" |
| 18140 | } |
| 18141 | // Backwards compatibility for deprecated options |
| 18142 | if (opts && opts.leftColumns !== undefined) { |
| 18143 | opts.left = opts.leftColumns |
| 18144 | } |
| 18145 | if (opts && opts.left !== undefined) { |
| 18146 | this.c[this.s.rtl ? "end" : "start"] = opts.left |
| 18147 | } |
| 18148 | if (opts && opts.rightColumns !== undefined) { |
| 18149 | opts.right = opts.rightColumns |
| 18150 | } |
| 18151 | if (opts && opts.right !== undefined) { |
| 18152 | this.c[this.s.rtl ? "start" : "end"] = opts.right |
| 18153 | } |
| 18154 | this.dom = { |
| 18155 | bottomBlocker: $$1("<div>").addClass(this.classes.bottomBlocker), |
| 18156 | topBlocker: $$1("<div>").addClass(this.classes.topBlocker), |
| 18157 | scroller: $$1("div.dt-scroll-body", this.s.dt.table().container()) |
| 18158 | } |
| 18159 | if (this.s.dt.settings()[0]._bInitComplete) { |
| 18160 | // Fixed Columns Initialisation |
| 18161 | this._addStyles() |
| 18162 | this._setKeyTableListener() |
| 18163 | } else { |
| 18164 | table.one("init.dt.dtfc", function () { |
| 18165 | // Fixed Columns Initialisation |
| 18166 | _this._addStyles() |
| 18167 | _this._setKeyTableListener() |
| 18168 | }) |
| 18169 | } |
| 18170 | // Lots or reasons to redraw the column styles |
| 18171 | table.on("column-sizing.dt.dtfc column-reorder.dt.dtfc draw.dt.dtfc", function () { |
| 18172 | return _this._addStyles() |
| 18173 | }) |
| 18174 | // Column visibility can trigger a number of times quickly, so we debounce it |
| 18175 | var debounced = DataTable$1.util.debounce(function () { |
| 18176 | _this._addStyles() |
| 18177 | }, 50) |
| 18178 | table.on("column-visibility.dt.dtfc", function () { |
| 18179 | debounced() |
| 18180 | }) |
| 18181 | // Add classes to indicate scrolling state for styling |
| 18182 | this.dom.scroller.on("scroll.dtfc", function () { |
| 18183 | return _this._scroll() |
| 18184 | }) |