{"version":3,"file":"responsive-table.js","sources":["../../assets/rollup/responsive-table.js"],"sourcesContent":["let $tables;\nconst $ = jQuery;\n\nconst build_responsive_grid_table = (selector) => {\n $tables = $(selector);\n\n if ($tables.length < 1) return;\n\n $tables.each(function () {\n const $table = $(this);\n\n if (!$table.hasClass('table--responsive')) {\n $table.addClass('table--responsive');\n\n const headers = $table.find('thead th').map((i, v) => {\n return v.innerText;\n });\n\n $table.find('tbody tr').each(function (i, v) {\n $(this).find('th,td').each(function (p, q) {\n const $cell = $(this);\n if ($cell.is('td') && headers.length > 0) {\n $cell.prepend('
' + headers[p] + '
');\n }\n });\n });\n }\n });\n\n};\n\nlet resizeTimer;\n\nconst forceResponsive = () => {\n $tables.each(function () {\n let $this = $(this);\n $this.removeClass('force-responsive');\n\n if ($this.outerWidth() > $this.parent().outerWidth()) {\n $this.addClass('force-responsive');\n }\n\n });\n}\n\nconst responsive_grid_table = (selector = 'table') => {\n $(document).ready(function () {\n build_responsive_grid_table(selector);\n forceResponsive();\n });\n\n $(window).on('resize', function (e) {\n\n clearTimeout(resizeTimer);\n resizeTimer = setTimeout(function () {\n\n forceResponsive();\n\n }, 100);\n\n });\n}\n\n\nwindow.responsive_grid_table = responsive_grid_table;"],"names":["$tables","$","jQuery","build_responsive_grid_table","selector","length","each","$table","hasClass","addClass","headers","find","map","i","v","innerText","p","q","$cell","is","prepend","resizeTimer","forceResponsive","$this","removeClass","outerWidth","parent","responsive_grid_table","document","ready","window","on","e","setTimeout"],"mappings":";;;AAAA,IAAIA,gBAAJ;AACA,IAAMC,IAAIC,MAAV;;AAEA,IAAMC,8BAA8B,SAA9BA,2BAA8B,CAACC,QAAD,EAAc;YACtCH,EAAEG,QAAF,CAAV;;MAEIJ,QAAQK,MAAR,GAAiB,CAArB,EAAwB;;UAEhBC,IAAR,CAAa,YAAY;QACjBC,SAASN,EAAE,IAAF,CAAf;;QAEI,CAACM,OAAOC,QAAP,CAAgB,mBAAhB,CAAL,EAA2C;aAClCC,QAAP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