| 17531 | */ |
| 17532 | var ColReorder = /** @class */ (function () { |
| 17533 | function ColReorder(dt, opts) { |
| 17534 | this.dom = { |
| 17535 | drag: null |
| 17536 | } |
| 17537 | this.c = { |
| 17538 | columns: null, |
| 17539 | enable: null, |
| 17540 | order: null |
| 17541 | } |
| 17542 | this.s = { |
| 17543 | dropZones: [], |
| 17544 | mouse: { |
| 17545 | absLeft: -1, |
| 17546 | offset: { |
| 17547 | x: -1, |
| 17548 | y: -1 |
| 17549 | }, |
| 17550 | start: { |
| 17551 | x: -1, |
| 17552 | y: -1 |
| 17553 | }, |
| 17554 | target: null, |
| 17555 | targets: [] |
| 17556 | }, |
| 17557 | scrollInterval: null |
| 17558 | } |
| 17559 | var that = this |
| 17560 | var ctx = dt.settings()[0] |
| 17561 | // Check if ColReorder already has been initialised on this DataTable - only |
| 17562 | // one can exist. |
| 17563 | if (ctx._colReorder) { |
| 17564 | return |
| 17565 | } |
| 17566 | dt.settings()[0]._colReorder = this |
| 17567 | this.dt = dt |
| 17568 | $.extend(this.c, ColReorder.defaults, opts) |
| 17569 | init(dt) |
| 17570 | dt.on("stateSaveParams", function (e, s, d) { |
| 17571 | d.colReorder = getOrder(dt) |
| 17572 | }) |
| 17573 | dt.on("destroy", function () { |
| 17574 | dt.off(".colReorder") |
| 17575 | dt.colReorder.reset() |
| 17576 | }) |
| 17577 | // Initial ordering / state restoring |
| 17578 | var loaded = dt.state.loaded() |
| 17579 | var order = this.c.order |
| 17580 | if (loaded && loaded.colReorder) { |
| 17581 | order = loaded.colReorder |
| 17582 | } |
| 17583 | if (order) { |
| 17584 | dt.ready(function () { |
| 17585 | setOrder(dt, order, true) |
| 17586 | }) |
| 17587 | } |
| 17588 | dt.table() |
| 17589 | .header.structure() |
| 17590 | .forEach(function (row) { |