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wolf-sb-integration/./src/global/js/ControllerBase.ts","webpack://@dgtls-pub/wolf-sb-integration/./src/wolf/components/molecules/m-professional-product-table-desktop/m-professional-product-table-desktop.controller.ts"],"sourcesContent":["import { IDomServices } from 'global/interfaces/controller.interface';\nimport { Subject } from 'rxjs';\n\nexport class DomServices implements IDomServices {\n\tprotected $element: HTMLElement;\n\tprotected $references: Record;\n\tonDomElementChanged: Subject = new Subject();\n\n\tconstructor(element: HTMLElement, references: Record) {\n\t\tthis.$references = references;\n\t\tthis.$element = element;\n\t}\n\n\tstatic collectReferences(\n\t\telement: HTMLElement,\n\t\tignoredReferences: string[],\n\t\tincludedReferences: string[],\n\t): Partial> {\n\t\tconst refs: Partial> = {};\n\n\t\tArray.from(element.querySelectorAll('[data-ref]')).forEach((el: HTMLElement) => {\n\t\t\tlet referenceName: string = '';\n\t\t\tif (el.dataset.ref) {\n\t\t\t\treferenceName = el.dataset.ref;\n\t\t\t}\n\n\t\t\t// skip ignored references\n\t\t\tif (ignoredReferences.includes(referenceName)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (referenceName) {\n\t\t\t\t// if the included list has items, only include these references, otherwise consider all\n\t\t\t\tif (includedReferences.length > 0) {\n\t\t\t\t\tif (includedReferences.includes(referenceName)) {\n\t\t\t\t\t\trefs[referenceName] = el;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (Object.prototype.hasOwnProperty.call(refs, referenceName)) {\n\t\t\t\t\t\tif (window.location.hostname === 'localhost') {\n\t\t\t\t\t\t\tconsole.warn(`A reference called '${referenceName}' has already been registered in ${this.constructor.name}!\\n Element:`, element);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\trefs[referenceName] = el;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\treturn refs;\n\t}\n\n\tgetRef(ref: string): T | undefined {\n\t\tif (this.$references) {\n\t\t\treturn Object.prototype.hasOwnProperty.call(this.$references, ref) ? (this.$references[ref] as T) : undefined;\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tparseStringToHtml = (htmlAsString: string): void | ChildNode => {\n\t\tconst parsedNode = new DOMParser().parseFromString(htmlAsString, 'text/html').body.firstChild;\n\t\tif (parsedNode) return parsedNode;\n\t};\n\n\trenderDomElement = (ref: string, html: string, renderOnParent: boolean = false): void => {\n\t\tconst refExists = this.$references ? Object.prototype.hasOwnProperty.call(this.$references, ref) : undefined;\n\t\tif (renderOnParent) {\n\t\t\tthis.$element.innerHTML = html;\n\t\t\tthis.domElementChanged(ref);\n\t\t} else if (this.$references && refExists) {\n\t\t\t(this.$references as any)[ref].innerHTML = html;\n\t\t\tthis.domElementChanged(ref);\n\t\t} else {\n\t\t\tconsole.warn('DOM ref does not exist!', ref);\n\t\t}\n\t};\n\n\tappendRawHtmlToDomElement = (\n\t\tnode: HTMLElement,\n\t\thtmlAsString: string,\n\t\tposition: 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend' = 'afterend',\n\t): void | ChildNode => {\n\t\tconst htmlNode = this.parseStringToHtml(htmlAsString);\n\t\tnode.insertAdjacentElement(position, htmlNode as Element);\n\t\tif (htmlNode) {\n\t\t\treturn htmlNode;\n\t\t}\n\t};\n\n\treplaceLastChildElementWithRawHtml = (ref: string, htmlAsString: string): void | ChildNode => {\n\t\tconst refExists = this.$references ? Object.prototype.hasOwnProperty.call(this.$references, ref) : undefined;\n\t\tif (refExists) {\n\t\t\tconst htmlNode = this.parseStringToHtml(htmlAsString);\n\t\t\tconst lastNode = this.$references[ref].childNodes[this.$references[ref].childNodes.length - 1];\n\t\t\t(this.$references as any)[ref].replaceChild(htmlNode, lastNode);\n\t\t\tthis.domElementChanged(ref);\n\t\t\tif (htmlNode) {\n\t\t\t\treturn htmlNode;\n\t\t\t}\n\t\t} else {\n\t\t\tconsole.warn('DOM ref does not exist!', ref);\n\t\t}\n\t};\n\n\ttoggleElementState(control: HTMLElement, newState: Array<'enable' | 'disable' | 'show' | 'hide' | 'check' | 'uncheck'>): void {\n\t\tif (!control) return;\n\t\tnewState &&\n\t\t\tnewState.forEach((state) => {\n\t\t\t\tswitch (state) {\n\t\t\t\t\tcase 'enable': {\n\t\t\t\t\t\tcontrol.removeAttribute('disabled');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase 'disable': {\n\t\t\t\t\t\tcontrol.setAttribute('disabled', 'true');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase 'show': {\n\t\t\t\t\t\tcontrol.removeAttribute('hidden');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase 'hide': {\n\t\t\t\t\t\tcontrol.setAttribute('hidden', 'true');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase 'uncheck': {\n\t\t\t\t\t\tcontrol.removeAttribute('checked');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase 'check': {\n\t\t\t\t\t\tcontrol.setAttribute('checked', 'true');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t});\n\t}\n\n\tdomElementChanged = (reference: string): void => {\n\t\tthis.onDomElementChanged.next(reference);\n\t};\n\n\tparseDOMScriptTag = (elementId: string): TJSON => {\n\t\tconst data = document.getElementById(elementId) as HTMLScriptElement;\n\t\ttry {\n\t\t\tconst out = JSON.parse(data.innerText);\n\t\t\treturn out as TJSON;\n\t\t} catch (error) {\n\t\t\tconsole.warn('Cannot parse component form config', error);\n\t\t}\n\t\treturn {} as TJSON;\n\t};\n\n\trenderDomElementInHTMLElement(element: HTMLElement, html: string): void {\n\t\telement.innerHTML = html;\n\t}\n}\n","import { IInputServicesBase } from 'global/interfaces/controller.interface';\nimport { fromEvent, Subscription } from 'rxjs';\nimport { map } from 'rxjs/operators';\n\nexport enum InputClasses {\n\terrorClass = 'uk-form-danger',\n\thiddenClass = 'uk-hidden',\n}\nexport class InputServices implements IInputServicesBase {\n\tprivate observedInputs: Record = {};\n\n\taddFocusToInput({ element, inputName }: { element: HTMLElement; inputName: string }): void {\n\t\tconst input = element?.querySelector(`input[name='${inputName}']`);\n\t\tif (input) (input as HTMLInputElement).focus();\n\t}\n\n\tobserveElementEvents(\n\t\telement: HTMLInputElement | HTMLSelectElement | HTMLButtonElement,\n\t\tinputEvent: 'input' | 'change' | 'click',\n\t\tonChange: (value: string, event: InputEvent) => any,\n\t): void {\n\t\tconst inputToObserve$ = fromEvent(element, inputEvent);\n\n\t\tthis.observedInputs[element.name] = inputToObserve$.pipe(map(this.mapInputEvent)).subscribe(({ value, event }) =>\n\t\t\tthis.subscribeInputWithErrorRemovalOnInputChange({\n\t\t\t\tvalue,\n\t\t\t\tevent,\n\t\t\t\tonChange,\n\t\t\t}),\n\t\t);\n\t}\n\n\t/**\n\t * This method is in charge of adding error classes to the correct element within an input group on a defined element\n\t * @param {HTMLElement | null} element - The element to update\n\t * @param {Record} errors - The errors to manage\n\t */\n\taddErrorsToFieldset({\n\t\telement,\n\t\terrors,\n\t\tonErrorsUpdated,\n\t}: {\n\t\telement: HTMLElement | null;\n\t\terrors: Record;\n\t\tonErrorsUpdated?: () => void;\n\t}): void {\n\t\tif (element) {\n\t\t\tObject.keys(errors).forEach((inputName) => {\n\t\t\t\tconst input = element?.querySelector(`input[name='${inputName}']`) as HTMLElement;\n\n\t\t\t\tif (input) {\n\t\t\t\t\tconst errorMessage = errors[inputName] || '';\n\t\t\t\t\tthis.addOrRemoveFormValidationError('SHOW_VALIDATION_ERROR', input, errorMessage);\n\t\t\t\t}\n\t\t\t});\n\t\t\tif (onErrorsUpdated) onErrorsUpdated();\n\t\t\tif (errors) {\n\t\t\t\tconst inputNameToFocus = Object.keys(errors)[0];\n\t\t\t\tconst firstErrorElement = element?.querySelector(`input[name='${inputNameToFocus}']`);\n\t\t\t\tif (firstErrorElement) firstErrorElement.scrollIntoView();\n\t\t\t\tif (inputNameToFocus) this.addFocusToInput({ element, inputName: inputNameToFocus });\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new Error(`ADD ERRORS TO FIELDSET: Looks like the element you want to update doesn't exist`);\n\t\t}\n\t}\n\n\taddOrRemoveFormValidationError(showOrHide: 'SHOW_VALIDATION_ERROR' | 'HIDE_VALIDATION_ERROR', input: HTMLElement, errorMessage: string = ''): void {\n\t\tif (!input) return;\n\n\t\tconst label = input.previousElementSibling;\n\t\tconst errorMessageContainer = input.nextElementSibling;\n\n\t\tif (showOrHide === 'SHOW_VALIDATION_ERROR') {\n\t\t\t// add error class to label\n\t\t\tif (label && label.classList) label.classList.add(InputClasses.errorClass);\n\t\t\t// add error class to input\n\t\t\tinput.classList.add(InputClasses.errorClass);\n\t\t\t// if there's an error message, inject it, show the div and add an error class\n\t\t\tif (errorMessageContainer) {\n\t\t\t\terrorMessageContainer.classList.add(InputClasses.errorClass);\n\t\t\t\terrorMessageContainer.classList.remove(InputClasses.hiddenClass);\n\t\t\t\terrorMessageContainer.innerHTML = errorMessage;\n\t\t\t}\n\t\t} else if (showOrHide === 'HIDE_VALIDATION_ERROR') {\n\t\t\t// remove error class from label\n\t\t\tif (label && label.classList) label.classList.remove(InputClasses.errorClass);\n\t\t\t// remove error class from input\n\t\t\tinput.classList.remove(InputClasses.errorClass);\n\t\t\t// remove error message and class\n\t\t\tif (errorMessageContainer) {\n\t\t\t\terrorMessageContainer.classList.remove(InputClasses.errorClass);\n\t\t\t\terrorMessageContainer.classList.add(InputClasses.hiddenClass);\n\t\t\t\terrorMessageContainer.innerHTML = '';\n\t\t\t}\n\t\t}\n\t}\n\n\tsubscribeInputWithErrorRemovalOnInputChange = ({\n\t\tvalue,\n\t\tevent,\n\t\tonChange,\n\t}: {\n\t\tvalue: string;\n\t\tevent: InputEvent;\n\t\tonChange?: (value: string, event: InputEvent) => void;\n\t}): void => {\n\t\tconst castEvent = event.target as HTMLElement;\n\n\t\tconst label = castEvent && castEvent.previousElementSibling;\n\t\tif (label && label.classList.contains(InputClasses.errorClass)) label.classList.remove(InputClasses.errorClass);\n\n\t\tconst input = event.target as HTMLElement;\n\t\tif (input && input.classList.contains(InputClasses.errorClass)) input.classList.remove(InputClasses.errorClass);\n\n\t\tconst errorMessage = castEvent && castEvent.nextElementSibling;\n\t\tif (errorMessage) {\n\t\t\terrorMessage.classList.remove(InputClasses.errorClass);\n\t\t\terrorMessage.classList.add('uk-hidden');\n\t\t}\n\n\t\tif (onChange) onChange(value, event);\n\t};\n\n\tmapInputEvent = (event: InputEvent): { value: string; event: InputEvent } => {\n\t\treturn { value: (event.target as HTMLInputElement | HTMLSelectElement).value, event };\n\t};\n}\n","import { IControllerBase, IDomServices } from 'global/interfaces/controller.interface';\nimport { DomServices } from './DomServices';\nimport { InputServices } from './InputsServices';\nexport default class ControllerBase = Record> implements IControllerBase {\n\treadonly $element: HTMLElement;\n\treadonly $references: Record;\n\treadonly ignoredReferences: string[];\n\treadonly includedReferences: string[];\n\treadonly disableReferenceCollection: boolean;\n\t/** See {@link DomServices} */\n\treadonly domUtils: IDomServices;\n\t/** See {@link InputServices} */\n\treadonly inputUtils: InputServices;\n\n\tconstructor(element: HTMLElement, ignoredReferences?: string[], includedReferences?: string[], disableReferenceCollection?: boolean) {\n\t\tthis.$element = element;\n\t\tthis.ignoredReferences = ignoredReferences || [];\n\t\tthis.includedReferences = includedReferences || [];\n\t\tthis.disableReferenceCollection = disableReferenceCollection || false;\n\n\t\tif (!this.disableReferenceCollection) {\n\t\t\tconst references = DomServices.collectReferences(this.$element, this.ignoredReferences, this.includedReferences);\n\t\t\tif (references && Object.keys(references).length > 0) {\n\t\t\t\tthis.$references = references as Record;\n\t\t\t} else {\n\t\t\t\tthis.$references = {} as Record;\n\t\t\t}\n\t\t}\n\n\t\tthis.domUtils = new DomServices(this.$element, this.$references);\n\t\tthis.inputUtils = new InputServices();\n\t}\n\n\tdispatchCustomEvent(\n\t\tname: string,\n\t\tdetail: T,\n\t\tbubbles: boolean = false,\n\t\tdispatchOnWindow: boolean = false,\n\t\tdispatchOnSpecificElement?: HTMLElement,\n\t): void {\n\t\tconst customEvent = new CustomEvent(name, { detail: detail, bubbles: bubbles });\n\t\tif (true === dispatchOnWindow) {\n\t\t\twindow.dispatchEvent(customEvent);\n\t\t} else if (dispatchOnSpecificElement) {\n\t\t\tdispatchOnSpecificElement.dispatchEvent(customEvent);\n\t\t} else {\n\t\t\tthis.$element.dispatchEvent(customEvent);\n\t\t}\n\t}\n}\n","import ControllerBase from 'global/js/ControllerBase';\nimport { fromEvent } from 'rxjs';\n\ninterface ComponentRefs {\n\t/** The table outer wrapper, which has the which gradients (right and bottom) */\n\ttable: 'table';\n\t/** The table wrapper, which has the overflow-x */\n\ttableInner: 'tableInner';\n\t/** The scroll left arrow */\n\tscrollLeft: 'scrollLeft';\n\t/** The scroll right arrow */\n\tscrollRight: 'scrollRight';\n\t/** The DIV which contains the show all button */\n\tshowAllWrapper: 'showAllWrapper';\n}\n\nexport default class ControllerProfessionalProductTableDesktop extends ControllerBase {\n\tprivate table: HTMLDivElement;\n\tprivate tableInner: HTMLDivElement;\n\tprivate scrollLeft: HTMLAnchorElement;\n\tprivate scrollRight: HTMLAnchorElement;\n\tprivate showAllButton: HTMLAnchorElement | null;\n\tprivate hideAllButton: HTMLAnchorElement | null;\n\t/** A list of hidden table rows, if the table row limit has been set */\n\tprivate readonly hiddenTableRows: HTMLDivElement[];\n\n\tconstructor(element: HTMLElement) {\n\t\tsuper(element);\n\n\t\tthis.table = this.$references.table as HTMLDivElement;\n\t\tthis.tableInner = this.$references.tableInner as HTMLDivElement;\n\n\t\tif (this.tableInner) {\n\t\t\t// set the initial number of hidden rows\n\t\t\tthis.hiddenTableRows = Array.from(this.tableInner.querySelectorAll('div.js-col-hidden'));\n\t\t}\n\n\t\tthis.init();\n\t}\n\n\tprivate init(): void {\n\t\tthis.scrollLeft = this.$references.scrollLeft as HTMLAnchorElement;\n\t\tthis.scrollRight = this.$references.scrollRight as HTMLAnchorElement;\n\n\t\t// handle toggle show/hide rows\n\t\tif (this.$references.showAllWrapper && this.hiddenTableRows.length > 0) {\n\t\t\t// get a ref to the button\n\t\t\tthis.showAllButton = this.$references.showAllWrapper.querySelector('a.a-button.m-professional-product-table-desktop__show');\n\t\t\tthis.showAllButton && this.showAllButton.addEventListener('click', (e) => this.handleShowAllToggle(e));\n\t\t\tthis.hideAllButton = this.$references.showAllWrapper.querySelector('a.a-button.m-professional-product-table-desktop__hide');\n\t\t\tthis.hideAllButton && this.hideAllButton.addEventListener('click', (e) => this.handleShowAllToggle(e));\n\t\t}\n\n\t\tthis.scrollLeft && this.scrollLeft.addEventListener('click', (e) => this.handleTableScrolling(e, 'LEFT'));\n\t\tthis.scrollRight && this.scrollRight.addEventListener('click', (e) => this.handleTableScrolling(e, 'RIGHT'));\n\n\t\tthis.handleFirstLoadScrollArrows();\n\t\tthis.observeTableScrolling();\n\t\tthis.observeViewportResizing();\n\t\tthis.setStickyColumn2Width();\n\t}\n\n\tprivate handleTableScrolling(event: MouseEvent, direction: 'LEFT' | 'RIGHT'): void {\n\t\tif (event) event.preventDefault();\n\t\t// if (!this.table) return;\n\n\t\tlet scrollAmount = 270;\n\n\t\tswitch (direction) {\n\t\t\tcase 'LEFT': {\n\t\t\t\tscrollAmount = scrollAmount * -1;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\n\t\t// this.tableWrapper.scrollLeft += scrollAmount;\n\t\tthis.tableInner.scrollTo({\n\t\t\tleft: this.tableInner.scrollLeft + scrollAmount,\n\t\t\ttop: 0,\n\t\t\tbehavior: 'smooth',\n\t\t});\n\t}\n\n\t/**\n\t * Handle the disabled state of the arrow controls, depending on the scroll position of the table\n\t * @returns void\n\t */\n\tprivate observeTableScrolling(): void {\n\t\tthis.tableInner.addEventListener('scroll', (ev: Event) => {\n\t\t\t// set the active attrib of the scroll button, based on where the user is along the x scroll axis\n\t\t\tconst tableWidth = this.tableInner.scrollWidth;\n\t\t\tconst tableDisplayWidth = this.table.scrollWidth;\n\t\t\tconst scrollLeft = this.tableInner.scrollLeft;\n\n\t\t\t// viewport width including scrollbar\n\t\t\t// const viewportWidth = window.innerWidth\n\t\t\t// viewport width without scrollbar\n\t\t\tconst viewportWidth = document.documentElement.clientWidth;\n\n\t\t\tswitch (true) {\n\t\t\t\tcase scrollLeft === 0: {\n\t\t\t\t\t// disable the left arrow, enable the right\n\t\t\t\t\tthis.scrollLeft.setAttribute('disabled', 'true');\n\t\t\t\t\tthis.scrollRight.removeAttribute('disabled');\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase scrollLeft >= tableWidth - tableDisplayWidth: {\n\t\t\t\t\t// disable the right arrow, enable the left\n\t\t\t\t\t// @todo - disable the white gradient also\n\t\t\t\t\tthis.scrollRight.setAttribute('disabled', 'true');\n\t\t\t\t\tthis.scrollLeft.removeAttribute('disabled');\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tdefault: {\n\t\t\t\t\t// enable both arrows, if not already\n\t\t\t\t\tif (this.scrollLeft.hasAttribute('disabled')) {\n\t\t\t\t\t\tthis.scrollLeft.removeAttribute('disabled');\n\t\t\t\t\t}\n\n\t\t\t\t\tif (this.scrollRight.hasAttribute('disabled')) {\n\t\t\t\t\t\tthis.scrollRight.removeAttribute('disabled');\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * When a user clicks on the show all button, toggle shown/hidden table rows\n\t * @param {MouseEvent} event\n\t * @returns void\n\t */\n\tprivate handleShowAllToggle(event: MouseEvent): void {\n\t\tevent.preventDefault();\n\t\tconst SHOWN_CLASS = 'col--shown';\n\t\tconst TRUNCATED_CLASS = 'truncated-y';\n\t\t// if rows have been shown then toggle should hide them, else show\n\t\tconst shouldHide = this.hiddenTableRows.some((r) => r.classList.contains(SHOWN_CLASS));\n\t\tthis.hiddenTableRows.forEach((r) => {\n\t\t\tshouldHide ? r.classList.remove(SHOWN_CLASS) : r.classList.add(SHOWN_CLASS);\n\t\t});\n\n\t\t// control the bottom white gradient, by adding/removing the class\n\t\tshouldHide ? this.table.classList.add(TRUNCATED_CLASS) : this.table.classList.remove(TRUNCATED_CLASS);\n\n\t\t// disable the show all button?\n\t\t// this.showAllButton?.setAttribute('disabled', 'true');\n\n\t\t//Toggle hide/show buttons when\n\t\tthis.showAllButton?.classList.toggle('uk-hidden');\n\t\tthis.hideAllButton?.classList.toggle('uk-hidden');\n\t}\n\n\tprivate handleFirstLoadScrollArrows(): void {\n\t\tconst viewportWidth = document.documentElement.clientWidth;\n\t\tconst tableWidth = this.tableInner.scrollWidth;\n\n\t\tif (tableWidth > viewportWidth) {\n\t\t\tthis.scrollLeft.classList.remove('uk-hidden');\n\t\t\tthis.scrollRight.classList.remove('uk-hidden');\n\t\t} else {\n\t\t\tthis.scrollLeft.classList.add('uk-hidden');\n\t\t\tthis.scrollRight.classList.add('uk-hidden');\n\t\t}\n\t}\n\n\t/**\n\t * When the window is resized, decide if the table needs a right-vertical white gradient\n\t * This should show when the width of the table is wider than the width of the viewport\n\t * @returns void\n\t */\n\tprivate observeViewportResizing(): void {\n\t\tthis.table &&\n\t\t\twindow.addEventListener('resize', () => {\n\t\t\t\tconst viewportWidth = document.documentElement.clientWidth;\n\t\t\t\tconst tableWidth = this.tableInner.scrollWidth;\n\t\t\t\tconst widthOfWhiteGradient = 100;\n\t\t\t\t// the class to add for the white gradient\n\t\t\t\tconst truncatedX = 'truncated-x';\n\n\t\t\t\tif (tableWidth > viewportWidth + widthOfWhiteGradient) {\n\t\t\t\t\tthis.scrollLeft.classList.remove('uk-hidden');\n\t\t\t\t\tthis.scrollRight.classList.remove('uk-hidden');\n\t\t\t\t\tthis.table.classList.contains(truncatedX) ? undefined : this.table.classList.add(truncatedX);\n\n\t\t\t\t\tthis.setStickyColumn2Width();\n\t\t\t\t} else {\n\t\t\t\t\tthis.scrollLeft.classList.add('uk-hidden');\n\t\t\t\t\tthis.scrollRight.classList.add('uk-hidden');\n\t\t\t\t\tthis.table.classList.contains(truncatedX) ? this.table.classList.remove(truncatedX) : undefined;\n\t\t\t\t}\n\t\t\t});\n\t}\n\n\t/**\n\t * Set the second column's position when second column should be sticky also for a desktop table\n\t * @returns void\n\t */\n\tprivate setStickyColumn2Width(): void {\n\t\tconst stickyColElementWidth = this.tableInner.querySelector('div.sticky-col-1')?.getBoundingClientRect().width;\n\t\tconst stickyCol2Elements = this.tableInner.querySelectorAll('div.sticky-col-2');\n\n\t\tif (stickyColElementWidth && stickyCol2Elements && stickyCol2Elements.length > 0) {\n\t\t\tArray.from(stickyCol2Elements).forEach((element) => {\n\t\t\t\telement.style.left = stickyColElementWidth + 'px';\n\t\t\t});\n\t\t}\n\t}\n}\n"],"names":["DomServices","constructor","element","references","onDomElementChanged","Subject","parseStringToHtml","htmlAsString","parsedNode","DOMParser","parseFromString","body","firstChild","renderDomElement","ref","html","renderOnParent","refExists","this","$references","Object","prototype","hasOwnProperty","call","undefined","$element","innerHTML","domElementChanged","console","warn","appendRawHtmlToDomElement","node","position","htmlNode","insertAdjacentElement","replaceLastChildElementWithRawHtml","lastNode","childNodes","length","replaceChild","reference","next","parseDOMScriptTag","elementId","data","document","getElementById","JSON","parse","innerText","error","collectReferences","ignoredReferences","includedReferences","refs","Array","from","querySelectorAll","forEach","el","referenceName","dataset","includes","window","location","hostname","name","getRef","toggleElementState","control","newState","state","removeAttribute","setAttribute","renderDomElementInHTMLElement","InputClasses","InputServices","observedInputs","subscribeInputWithErrorRemovalOnInputChange","value","event","onChange","castEvent","target","label","previousElementSibling","classList","contains","errorClass","remove","input","errorMessage","nextElementSibling","add","mapInputEvent","addFocusToInput","inputName","querySelector","focus","observeElementEvents","inputEvent","inputToObserve$","fromEvent","pipe","map","subscribe","addErrorsToFieldset","errors","onErrorsUpdated","Error","keys","addOrRemoveFormValidationError","inputNameToFocus","firstErrorElement","scrollIntoView","showOrHide","errorMessageContainer","hiddenClass","ControllerBase","disableReferenceCollection","domUtils","inputUtils","dispatchCustomEvent","detail","bubbles","dispatchOnWindow","dispatchOnSpecificElement","customEvent","CustomEvent","dispatchEvent","ControllerProfessionalProductTableDesktop","super","table","tableInner","hiddenTableRows","init","scrollLeft","scrollRight","showAllWrapper","showAllButton","addEventListener","e","handleShowAllToggle","hideAllButton","handleTableScrolling","handleFirstLoadScrollArrows","observeTableScrolling","observeViewportResizing","setStickyColumn2Width","direction","preventDefault","scrollAmount","scrollTo","left","top","behavior","ev","tableWidth","scrollWidth","tableDisplayWidth","documentElement","clientWidth","hasAttribute","SHOWN_CLASS","TRUNCATED_CLASS","shouldHide","some","r","toggle","viewportWidth","truncatedX","stickyColElementWidth","getBoundingClientRect","width","stickyCol2Elements","style"],"sourceRoot":""}