{"version":3,"file":"dynamicSubMenu.component.bundle.js","sources":["../../../../Frontend/js/components/dynamicSubMenu.component.ts"],"sourcesContent":["export const setupDynamicSubMenu = (): void => {\r\n document.querySelectorAll(\"[data-dynamic-position]\").forEach((listContainer) => {\r\n let fullWidthNumber = 0\r\n\r\n listContainer.querySelectorAll(\"[data-dynamic-width]\").forEach((item) => {\r\n const lists = item.querySelectorAll(\"UL\")\r\n lists.forEach((list) => {\r\n const nrChildren = list.children.length\r\n if (nrChildren) {\r\n //width-48 12rem\r\n //plus pl-1 0.25rem\r\n //plus pr-2 0.5rem\r\n //plus translate-2 0.5rem\r\n //13.25\r\n const calculatedwidth = 12 + 0.25 + 0.5 + 0.5\r\n const widthNumber = Math.ceil(nrChildren / 5) * calculatedwidth\r\n item.style.width = widthNumber.toString() + \"rem\"\r\n fullWidthNumber += widthNumber\r\n }\r\n })\r\n })\r\n //Check if the element is larger than just one column, move it to the left if it is.\r\n if (fullWidthNumber > 13.25) {\r\n listContainer.style.transform = `translateX(-` + fullWidthNumber / 4 + `rem)`\r\n }\r\n })\r\n}\r\n"],"names":["setupDynamicSubMenu","listContainer","fullWidthNumber","item","list","nrChildren","widthNumber"],"mappings":"AAAO,MAAMA,EAAsB,IAAY,CAC7C,SAAS,iBAA8B,yBAAyB,EAAE,QAASC,GAAkB,CAC3F,IAAIC,EAAkB,EAEtBD,EAAc,iBAA8B,sBAAsB,EAAE,QAASE,GAAS,CACtEA,EAAK,iBAAiB,IAAI,EAClC,QAASC,GAAS,CAChB,MAAAC,EAAaD,EAAK,SAAS,OACjC,GAAIC,EAAY,CAOd,MAAMC,EAAc,KAAK,KAAKD,EAAa,CAAC,EAAI,MAChDF,EAAK,MAAM,MAAQG,EAAY,SAAa,EAAA,MACzBJ,GAAAI,CAAA,CACrB,CACD,CAAA,CACF,EAEGJ,EAAkB,QACpBD,EAAc,MAAM,UAAY,eAAiBC,EAAkB,EAAI,OACzE,CACD,CACH"}