|
1 |
| -/* Tabulator v5.1.6 (c) Oliver Folkerd 2022 */ |
| 1 | +/* Tabulator v5.1.7 (c) Oliver Folkerd 2022 */ |
2 | 2 | (function (global, factory) {
|
3 | 3 | typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
4 | 4 | typeof define === 'function' && define.amd ? define(factory) :
|
|
2604 | 2604 | }, {
|
2605 | 2605 | key: "vertScrollListen",
|
2606 | 2606 | value: function vertScrollListen() {
|
2607 |
| - var _this2 = this; |
2608 |
| - |
2609 |
| - this.subscribe("scroll-vertical", function () { |
2610 |
| - _this2.visibleRows = null; |
2611 |
| - }); |
| 2607 | + this.subscribe("scroll-vertical", this.clearVisRowCache.bind(this)); |
| 2608 | + this.subscribe("data-refreshed", this.clearVisRowCache.bind(this)); |
| 2609 | + } |
| 2610 | + }, { |
| 2611 | + key: "clearVisRowCache", |
| 2612 | + value: function clearVisRowCache() { |
| 2613 | + this.visibleRows = null; |
2612 | 2614 | } //////////////////////////////////////
|
2613 | 2615 | ///////// Public Functions ///////////
|
2614 | 2616 | //////////////////////////////////////
|
|
2644 | 2646 | }, {
|
2645 | 2647 | key: "rerenderColumns",
|
2646 | 2648 | value: function rerenderColumns(update, blockRedraw) {
|
2647 |
| - var _this3 = this; |
| 2649 | + var _this2 = this; |
2648 | 2650 |
|
2649 | 2651 | var old = {
|
2650 | 2652 | cols: this.columns,
|
|
2671 | 2673 | config.rightPos = colPos + width;
|
2672 | 2674 | config.width = width;
|
2673 | 2675 |
|
2674 |
| - if (_this3.isFitData) { |
| 2676 | + if (_this2.isFitData) { |
2675 | 2677 | config.fitDataCheck = column.modules.vdomHoz ? column.modules.vdomHoz.fitDataCheck : true;
|
2676 | 2678 | }
|
2677 | 2679 |
|
2678 |
| - if (colPos + width > _this3.vDomScrollPosLeft && colPos < _this3.vDomScrollPosRight) { |
| 2680 | + if (colPos + width > _this2.vDomScrollPosLeft && colPos < _this2.vDomScrollPosRight) { |
2679 | 2681 | //column is visible
|
2680 |
| - if (_this3.leftCol == -1) { |
2681 |
| - _this3.leftCol = _this3.columns.length; |
2682 |
| - _this3.vDomPadLeft = colPos; |
| 2682 | + if (_this2.leftCol == -1) { |
| 2683 | + _this2.leftCol = _this2.columns.length; |
| 2684 | + _this2.vDomPadLeft = colPos; |
2683 | 2685 | }
|
2684 | 2686 |
|
2685 |
| - _this3.rightCol = _this3.columns.length; |
| 2687 | + _this2.rightCol = _this2.columns.length; |
2686 | 2688 | } else {
|
2687 | 2689 | // column is hidden
|
2688 |
| - if (_this3.leftCol !== -1) { |
2689 |
| - _this3.vDomPadRight += width; |
| 2690 | + if (_this2.leftCol !== -1) { |
| 2691 | + _this2.vDomPadRight += width; |
2690 | 2692 | }
|
2691 | 2693 | }
|
2692 | 2694 |
|
2693 |
| - _this3.columns.push(column); |
| 2695 | + _this2.columns.push(column); |
2694 | 2696 |
|
2695 | 2697 | column.modules.vdomHoz = config;
|
2696 | 2698 | colPos += width;
|
|
2754 | 2756 | }, {
|
2755 | 2757 | key: "dataChange",
|
2756 | 2758 | value: function dataChange() {
|
2757 |
| - var _this4 = this; |
| 2759 | + var _this3 = this; |
2758 | 2760 |
|
2759 | 2761 | var change = false,
|
2760 | 2762 | collsWidth = 0,
|
|
2773 | 2775 | if (change && this.table.rowManager.getDisplayRows().length) {
|
2774 | 2776 | this.vDomScrollPosRight = this.scrollLeft + this.elementVertical.clientWidth + this.windowBuffer;
|
2775 | 2777 | var row = this.chain("rows-sample", [1], [], function () {
|
2776 |
| - return _this4.table.rowManager.getDisplayRows(); |
| 2778 | + return _this3.table.rowManager.getDisplayRows(); |
2777 | 2779 | })[0];
|
2778 | 2780 |
|
2779 | 2781 | if (row) {
|
|
2809 | 2811 | }, {
|
2810 | 2812 | key: "reinitChanged",
|
2811 | 2813 | value: function reinitChanged(old) {
|
2812 |
| - var _this5 = this; |
| 2814 | + var _this4 = this; |
2813 | 2815 |
|
2814 | 2816 | var match = true;
|
2815 | 2817 |
|
|
2818 | 2820 | }
|
2819 | 2821 |
|
2820 | 2822 | old.cols.forEach(function (col, i) {
|
2821 |
| - if (col !== _this5.columns[i]) { |
| 2823 | + if (col !== _this4.columns[i]) { |
2822 | 2824 | match = false;
|
2823 | 2825 | }
|
2824 | 2826 | });
|
|
2827 | 2829 | }, {
|
2828 | 2830 | key: "reinitializeRows",
|
2829 | 2831 | value: function reinitializeRows() {
|
2830 |
| - var _this6 = this; |
| 2832 | + var _this5 = this; |
2831 | 2833 |
|
2832 | 2834 | var rows = this.getVisibleRows();
|
2833 | 2835 | rows.forEach(function (row) {
|
2834 |
| - _this6.reinitializeRow(row, true); |
| 2836 | + _this5.reinitializeRow(row, true); |
2835 | 2837 | });
|
2836 | 2838 | }
|
2837 | 2839 | }, {
|
|
2875 | 2877 | }, {
|
2876 | 2878 | key: "addColRight",
|
2877 | 2879 | value: function addColRight() {
|
2878 |
| - var _this7 = this; |
| 2880 | + var _this6 = this; |
2879 | 2881 |
|
2880 | 2882 | var changes = false;
|
2881 | 2883 |
|
2882 | 2884 | var _loop = function _loop() {
|
2883 |
| - var column = _this7.columns[_this7.rightCol + 1]; |
| 2885 | + var column = _this6.columns[_this6.rightCol + 1]; |
2884 | 2886 |
|
2885 | 2887 | if (column) {
|
2886 |
| - if (column.modules.vdomHoz.leftPos <= _this7.vDomScrollPosRight) { |
| 2888 | + if (column.modules.vdomHoz.leftPos <= _this6.vDomScrollPosRight) { |
2887 | 2889 | changes = true;
|
2888 | 2890 |
|
2889 |
| - _this7.getVisibleRows().forEach(function (row) { |
| 2891 | + _this6.getVisibleRows().forEach(function (row) { |
2890 | 2892 | if (row.type !== "group") {
|
2891 | 2893 | var cell = row.getCell(column);
|
2892 | 2894 | row.getElement().appendChild(cell.getElement());
|
2893 | 2895 | cell.cellRendered();
|
2894 | 2896 | }
|
2895 | 2897 | });
|
2896 | 2898 |
|
2897 |
| - _this7.fitDataColActualWidthCheck(column); |
| 2899 | + _this6.fitDataColActualWidthCheck(column); |
2898 | 2900 |
|
2899 |
| - _this7.rightCol++; // Don't move this below the >= check below |
| 2901 | + _this6.rightCol++; // Don't move this below the >= check below |
2900 | 2902 |
|
2901 |
| - if (_this7.rightCol >= _this7.columns.length - 1) { |
2902 |
| - _this7.vDomPadRight = 0; |
| 2903 | + if (_this6.rightCol >= _this6.columns.length - 1) { |
| 2904 | + _this6.vDomPadRight = 0; |
2903 | 2905 | } else {
|
2904 |
| - _this7.vDomPadRight -= column.getWidth(); |
| 2906 | + _this6.vDomPadRight -= column.getWidth(); |
2905 | 2907 | }
|
2906 | 2908 | } else {
|
2907 | 2909 | return "break";
|
|
2924 | 2926 | }, {
|
2925 | 2927 | key: "addColLeft",
|
2926 | 2928 | value: function addColLeft() {
|
2927 |
| - var _this8 = this; |
| 2929 | + var _this7 = this; |
2928 | 2930 |
|
2929 | 2931 | var changes = false;
|
2930 | 2932 |
|
2931 | 2933 | var _loop2 = function _loop2() {
|
2932 |
| - var column = _this8.columns[_this8.leftCol - 1]; |
| 2934 | + var column = _this7.columns[_this7.leftCol - 1]; |
2933 | 2935 |
|
2934 | 2936 | if (column) {
|
2935 |
| - if (column.modules.vdomHoz.rightPos >= _this8.vDomScrollPosLeft) { |
| 2937 | + if (column.modules.vdomHoz.rightPos >= _this7.vDomScrollPosLeft) { |
2936 | 2938 | changes = true;
|
2937 | 2939 |
|
2938 |
| - _this8.getVisibleRows().forEach(function (row) { |
| 2940 | + _this7.getVisibleRows().forEach(function (row) { |
2939 | 2941 | if (row.type !== "group") {
|
2940 | 2942 | var cell = row.getCell(column);
|
2941 | 2943 | row.getElement().prepend(cell.getElement());
|
2942 | 2944 | cell.cellRendered();
|
2943 | 2945 | }
|
2944 | 2946 | });
|
2945 | 2947 |
|
2946 |
| - _this8.leftCol--; // don't move this below the <= check below |
| 2948 | + _this7.leftCol--; // don't move this below the <= check below |
2947 | 2949 |
|
2948 |
| - if (_this8.leftCol <= 0) { |
| 2950 | + if (_this7.leftCol <= 0) { |
2949 | 2951 | // replicating logic in addColRight
|
2950 |
| - _this8.vDomPadLeft = 0; |
| 2952 | + _this7.vDomPadLeft = 0; |
2951 | 2953 | } else {
|
2952 |
| - _this8.vDomPadLeft -= column.getWidth(); |
| 2954 | + _this7.vDomPadLeft -= column.getWidth(); |
2953 | 2955 | }
|
2954 | 2956 |
|
2955 |
| - var diff = _this8.fitDataColActualWidthCheck(column); |
| 2957 | + var diff = _this7.fitDataColActualWidthCheck(column); |
2956 | 2958 |
|
2957 | 2959 | if (diff) {
|
2958 |
| - _this8.scrollLeft = _this8.elementVertical.scrollLeft = _this8.elementVertical.scrollLeft + diff; |
2959 |
| - _this8.vDomPadRight -= diff; |
| 2960 | + _this7.scrollLeft = _this7.elementVertical.scrollLeft = _this7.elementVertical.scrollLeft + diff; |
| 2961 | + _this7.vDomPadRight -= diff; |
2960 | 2962 | }
|
2961 | 2963 | } else {
|
2962 | 2964 | return "break";
|
|
2979 | 2981 | }, {
|
2980 | 2982 | key: "removeColRight",
|
2981 | 2983 | value: function removeColRight() {
|
2982 |
| - var _this9 = this; |
| 2984 | + var _this8 = this; |
2983 | 2985 |
|
2984 | 2986 | var changes = false;
|
2985 | 2987 |
|
2986 | 2988 | var _loop3 = function _loop3() {
|
2987 |
| - var column = _this9.columns[_this9.rightCol]; |
| 2989 | + var column = _this8.columns[_this8.rightCol]; |
2988 | 2990 |
|
2989 | 2991 | if (column) {
|
2990 |
| - if (column.modules.vdomHoz.leftPos > _this9.vDomScrollPosRight) { |
| 2992 | + if (column.modules.vdomHoz.leftPos > _this8.vDomScrollPosRight) { |
2991 | 2993 | changes = true;
|
2992 | 2994 |
|
2993 |
| - _this9.getVisibleRows().forEach(function (row) { |
| 2995 | + _this8.getVisibleRows().forEach(function (row) { |
2994 | 2996 | if (row.type !== "group") {
|
2995 | 2997 | var cell = row.getCell(column);
|
2996 | 2998 |
|
|
3002 | 3004 | }
|
3003 | 3005 | });
|
3004 | 3006 |
|
3005 |
| - _this9.vDomPadRight += column.getWidth(); |
3006 |
| - _this9.rightCol--; |
| 3007 | + _this8.vDomPadRight += column.getWidth(); |
| 3008 | + _this8.rightCol--; |
3007 | 3009 | } else {
|
3008 | 3010 | return "break";
|
3009 | 3011 | }
|
|
3025 | 3027 | }, {
|
3026 | 3028 | key: "removeColLeft",
|
3027 | 3029 | value: function removeColLeft() {
|
3028 |
| - var _this10 = this; |
| 3030 | + var _this9 = this; |
3029 | 3031 |
|
3030 | 3032 | var changes = false;
|
3031 | 3033 |
|
3032 | 3034 | var _loop4 = function _loop4() {
|
3033 |
| - var column = _this10.columns[_this10.leftCol]; |
| 3035 | + var column = _this9.columns[_this9.leftCol]; |
3034 | 3036 |
|
3035 | 3037 | if (column) {
|
3036 |
| - if (column.modules.vdomHoz.rightPos < _this10.vDomScrollPosLeft) { |
| 3038 | + if (column.modules.vdomHoz.rightPos < _this9.vDomScrollPosLeft) { |
3037 | 3039 | changes = true;
|
3038 | 3040 |
|
3039 |
| - _this10.getVisibleRows().forEach(function (row) { |
| 3041 | + _this9.getVisibleRows().forEach(function (row) { |
3040 | 3042 | if (row.type !== "group") {
|
3041 | 3043 | var cell = row.getCell(column);
|
3042 | 3044 |
|
|
3048 | 3050 | }
|
3049 | 3051 | });
|
3050 | 3052 |
|
3051 |
| - _this10.vDomPadLeft += column.getWidth(); |
3052 |
| - _this10.leftCol++; |
| 3053 | + _this9.vDomPadLeft += column.getWidth(); |
| 3054 | + _this9.leftCol++; |
3053 | 3055 | } else {
|
3054 | 3056 | return "break";
|
3055 | 3057 | }
|
|
0 commit comments