51f17ca8ac00b843f120043883283d5a68a311cbcd06a00d89cf02cc3f87c2059466ff374efd8073bdf4c5ef7814712a5c5a40a88aca40f5851e40f6562e45 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. 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; }; }();
  2. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3. /**
  4. * @class RowFilter
  5. */
  6. var RowFilter = function () {
  7. /**
  8. * @param {Number} offset
  9. * @param {Number} total
  10. * @param {Number} countTH
  11. */
  12. function RowFilter(offset, total, countTH) {
  13. _classCallCheck(this, RowFilter);
  14. this.offset = offset;
  15. this.total = total;
  16. this.countTH = countTH;
  17. }
  18. /**
  19. * @param index
  20. * @returns {Number}
  21. */
  22. _createClass(RowFilter, [{
  23. key: "offsetted",
  24. value: function offsetted(index) {
  25. return index + this.offset;
  26. }
  27. /**
  28. * @param index
  29. * @returns {Number}
  30. */
  31. }, {
  32. key: "unOffsetted",
  33. value: function unOffsetted(index) {
  34. return index - this.offset;
  35. }
  36. /**
  37. * @param index
  38. * @returns {Number}
  39. */
  40. }, {
  41. key: "renderedToSource",
  42. value: function renderedToSource(index) {
  43. return this.offsetted(index);
  44. }
  45. /**
  46. * @param index
  47. * @returns {Number}
  48. */
  49. }, {
  50. key: "sourceToRendered",
  51. value: function sourceToRendered(index) {
  52. return this.unOffsetted(index);
  53. }
  54. /**
  55. * @param index
  56. * @returns {Number}
  57. */
  58. }, {
  59. key: "offsettedTH",
  60. value: function offsettedTH(index) {
  61. return index - this.countTH;
  62. }
  63. /**
  64. * @param index
  65. * @returns {Number}
  66. */
  67. }, {
  68. key: "unOffsettedTH",
  69. value: function unOffsettedTH(index) {
  70. return index + this.countTH;
  71. }
  72. /**
  73. * @param index
  74. * @returns {Number}
  75. */
  76. }, {
  77. key: "visibleColHeadedRowToSourceRow",
  78. value: function visibleColHeadedRowToSourceRow(index) {
  79. return this.renderedToSource(this.offsettedTH(index));
  80. }
  81. /**
  82. * @param index
  83. * @returns {Number}
  84. */
  85. }, {
  86. key: "sourceRowToVisibleColHeadedRow",
  87. value: function sourceRowToVisibleColHeadedRow(index) {
  88. return this.unOffsettedTH(this.sourceToRendered(index));
  89. }
  90. }]);
  91. return RowFilter;
  92. }();
  93. export default RowFilter;