{"version":3,"sources":["webpack:///./modules/Table.ts"],"names":["__webpack_require__","r","__webpack_exports__","_helpers_DOMHelpers__WEBPACK_IMPORTED_MODULE_0__","_helpers_helperFunctions__WEBPACK_IMPORTED_MODULE_1__","Table","element","this","init","setup","selector","Array","from","document","querySelectorAll","filter","node","dataset","moduleInitialized","forEach","prototype","_this","textNode","querySelector","table","Object"],"mappings":"2FAAAA,EAAAC,EAAAC,GAAA,IAAAC,EAAAH,EAAA,GAAAI,EAAAJ,EAAA,IAIAK,EAAA,WAWI,SAAAA,EAAmBC,GAAAC,KAAAD,UACfC,KAAKD,QAAUA,EACfC,KAAKC,OAkBb,OA3BWH,EAAAI,MAAP,SAAaC,QAAA,IAAAA,MANM,yBAOfC,MAAMC,KAAKC,SAASC,iBAAiBJ,IAAWK,OAAO,SAACC,GAAsB,OAACA,EAAKC,QAAQC,oBAAmBC,QAAQ,SAACb,GACpH,IAAID,EAAMC,GACVA,EAAQW,QAAQC,kBAAoB,UASpCb,EAAAe,UAAAZ,KAAR,eAAAa,EAAAd,KAaI,OAZAA,KAAKe,SAAwBf,KAAKD,QAAQiB,cAAc,YAExDZ,MAAMC,KAAKL,KAAKD,QAAQQ,iBAAiB,mBAAmBK,QAAQ,SAACK,GACjEC,OAAAtB,EAAA,EAAAsB,CAASD,EAAO,YAChBC,OAAAtB,EAAA,EAAAsB,CAASD,EAAO,kBAChBC,OAAAtB,EAAA,EAAAsB,CAASD,EAAO,oBAEZC,OAAArB,EAAA,EAAAqB,KAAeA,OAAAtB,EAAA,EAAAsB,CAASJ,EAAKC,SAAU,qBACvCG,OAAAtB,EAAA,EAAAsB,CAASJ,EAAKC,SAAU,sBAIzBf,MAEfF,EA/BA,eAiCA,IAAIA,EAAMI,MAeN,IAAIJ,EAAMI,MAlDS","file":"./modules/Table.ca9baee6.js","sourcesContent":["import { addClass,hasClass } from \"../helpers/DOMHelpers\";\r\nimport { isMobile } from \"../helpers/helperFunctions\";\r\nconst moduleSelector = '[data-module=\"Table\"]';\r\n\r\nexport default class Table {\r\n\r\n    private textNode : HTMLElement;\r\n\r\n    static setup(selector: string = moduleSelector): void {\r\n        Array.from(document.querySelectorAll(selector)).filter((node: HTMLElement) => !node.dataset.moduleInitialized).forEach((element: HTMLElement) => {\r\n            new Table(element);\r\n            element.dataset.moduleInitialized = 'true';\r\n        });\r\n    }\r\n\r\n    constructor(public element: HTMLElement) {\r\n        this.element = element;\r\n        this.init();\r\n    }\r\n\r\n    private init(): Table {\r\n        this.textNode = <HTMLElement>this.element.querySelector('.cw-text');\r\n\r\n        Array.from(this.element.querySelectorAll('.cw-text table')).forEach((table: HTMLElement) => {\r\n            addClass(table, \"uk-table\");\r\n            addClass(table, \"uk-table-small\");\r\n            addClass(table, \"uk-table-striped\");\r\n\r\n            if (isMobile() && !hasClass(this.textNode, 'uk-overflow-auto')) {\r\n                addClass(this.textNode, 'uk-overflow-auto');\r\n            }\r\n        });\r\n\r\n        return this;\r\n    }\r\n}\r\n\r\nnew Table.setup();\r\n\r\n// Hot Module Replacement\r\nif (module.hot) {\r\n    let nodesCache: HMRNodes[] = Array.from(document.querySelectorAll(moduleSelector)).map((element: Node) => ({ nodeToReplace: element, nodeOrigin: element.cloneNode(true) }));\r\n\r\n    new Table.setup(moduleSelector);\r\n\r\n    module.hot.accept(() => {\r\n        new Table.setup(moduleSelector);\r\n    });\r\n    module.hot.dispose(() => {\r\n        nodesCache.forEach(({ nodeToReplace, nodeOrigin }) => { nodeToReplace = nodeToReplace.parentElement.replaceChild(nodeOrigin.cloneNode(true), nodeToReplace) });\r\n    });\r\n} else {\r\n    new Table.setup(moduleSelector);\r\n}"],"sourceRoot":""}