6986cd86763d757098e54d4ee7e9b6b8f911b26b972e929cb5489087cae097aef49749a7c544c02f6ef4bdd821910e9b0704022297f2dd0a82018606a29655 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. "use strict";
  2. exports.__esModule = true;
  3. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5. /**
  6. * @class ColumnFilter
  7. */
  8. var ColumnFilter = function () {
  9. /**
  10. * @param {Number} offset
  11. * @param {Number} total
  12. * @param {Number} countTH
  13. */
  14. function ColumnFilter(offset, total, countTH) {
  15. _classCallCheck(this, ColumnFilter);
  16. this.offset = offset;
  17. this.total = total;
  18. this.countTH = countTH;
  19. }
  20. /**
  21. * @param index
  22. * @returns {Number}
  23. */
  24. _createClass(ColumnFilter, [{
  25. key: "offsetted",
  26. value: function offsetted(index) {
  27. return index + this.offset;
  28. }
  29. /**
  30. * @param index
  31. * @returns {Number}
  32. */
  33. }, {
  34. key: "unOffsetted",
  35. value: function unOffsetted(index) {
  36. return index - this.offset;
  37. }
  38. /**
  39. * @param index
  40. * @returns {Number}
  41. */
  42. }, {
  43. key: "renderedToSource",
  44. value: function renderedToSource(index) {
  45. return this.offsetted(index);
  46. }
  47. /**
  48. * @param index
  49. * @returns {Number}
  50. */
  51. }, {
  52. key: "sourceToRendered",
  53. value: function sourceToRendered(index) {
  54. return this.unOffsetted(index);
  55. }
  56. /**
  57. * @param index
  58. * @returns {Number}
  59. */
  60. }, {
  61. key: "offsettedTH",
  62. value: function offsettedTH(index) {
  63. return index - this.countTH;
  64. }
  65. /**
  66. * @param index
  67. * @returns {Number}
  68. */
  69. }, {
  70. key: "unOffsettedTH",
  71. value: function unOffsettedTH(index) {
  72. return index + this.countTH;
  73. }
  74. /**
  75. * @param index
  76. * @returns {Number}
  77. */
  78. }, {
  79. key: "visibleRowHeadedColumnToSourceColumn",
  80. value: function visibleRowHeadedColumnToSourceColumn(index) {
  81. return this.renderedToSource(this.offsettedTH(index));
  82. }
  83. /**
  84. * @param index
  85. * @returns {Number}
  86. */
  87. }, {
  88. key: "sourceColumnToVisibleRowHeadedColumn",
  89. value: function sourceColumnToVisibleRowHeadedColumn(index) {
  90. return this.unOffsettedTH(this.sourceToRendered(index));
  91. }
  92. }]);
  93. return ColumnFilter;
  94. }();
  95. exports.default = ColumnFilter;