{"version":3,"sources":["webpack:////Users/owenli/Documents/workspace/awi-wool-fe/src/views/widgets/sidebarItemsWidget/js/sidebarItemsWidget.js"],"names":["CLS","SidebarItemsWidget","element","_this","this","_classCallCheck","$element","$","$dropdownHeadings","children","concat","$dropdownHeadingsLink","find","$selectedItem","itemContentAnimationDuration","itemHeadingIconAnimationDuration","itemHeadingIconRotationDegree","on","event","$itemToBeSelected","currentTarget","parent","isEqualNode","attr","deactivate","activate","stopPropagation","params","animate","key","value","item","arguments","length","undefined","slideDown","duration","rotateIcon","show","slideUp","each","index","trigger","initialDegree","degree","deg","step","now","css","transform"],"mappings":"83BAAA,IACMA,EAAM,qBAECC,EAAkB,WA+C7B,SA9CD,SAAAA,EAAYC,GAAS,IAAAC,EAAAC,kGAAAC,CAAAD,KAAAH,GACpBG,KAAKF,QAAUA,EACfE,KAAKE,SAAWC,EAAEL,GAElBE,KAAKI,kBAAoBJ,KAAKE,SAASG,SAAQ,IAAAC,OAAKV,EAAG,cAAaS,SAAQ,IAAAC,OAAKV,EAAG,sBACpFI,KAAKO,sBAAwBP,KAAKI,kBAAkBI,KAAI,IAAAF,OAAKV,EAAG,mBAChEI,KAAKS,cAAgB,KACrBT,KAAKU,6BAA+B,IACpCV,KAAKW,iCAAmC,IACxCX,KAAKY,8BAAgC,GAErCZ,KAAKI,kBAAkBS,GAAG,QAAS,SAACC,GACnC,IAAIC,EAAoBZ,EAAEW,EAAME,eAAeC,OAAM,IAAAX,OAAKV,EAAG,cAEzDG,EAAKU,cAGDV,EAAKU,cAAc,GAAGS,YAAYH,EAAkB,KAAOhB,EAAKU,cAAcU,KAAK,eAC1FpB,EAAKqB,WAAWL,GAERhB,EAAKU,cAAc,GAAGS,YAAYH,EAAkB,MAC5DhB,EAAKqB,WAAWrB,EAAKU,eACrBV,EAAKsB,SAASN,IAPdhB,EAAKsB,SAASN,KAYhBf,KAAKO,sBAAsBM,GAAG,QAAS,SAACC,GACvCA,EAAMQ,oBAIPtB,KAAKE,SAASW,G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tE4B,EACFrB,GAAIsC,IAAKF,IAAiBf,SAAUiB,IAAKD,IACxCR,SAAUhC,KAAKW,iCACf+B,KAAM,SAACC,GACNzC,EAAS0C,KACRC,UAAS,UAAAvC,OAAYqC,EAAG,aAM3BzC,EAAS0C,KACRC,UAAS,UAAAvC,OAAYkC,EAAM,yGA7FA","file":"widget-21.430117f348aedc9992ce.js","sourcesContent":["const NS = 'SidebarItemsWidget';\nconst CLS = 'sidebarItemsWidget';\n\nexport class SidebarItemsWidget {\n\tconstructor(element) {\n\t\tthis.element = element;\n\t\tthis.$element = $(element);\n\n\t\tthis.$dropdownHeadings = this.$element.children(`.${CLS}-dropdown`).children(`.${CLS}-dropdown-heading`);\n\t\tthis.$dropdownHeadingsLink = this.$dropdownHeadings.find(`.${CLS}-dropdown-link`);\n\t\tthis.$selectedItem = null;\n\t\tthis.itemContentAnimationDuration = 350;\n\t\tthis.itemHeadingIconAnimationDuration = 250;\n\t\tthis.itemHeadingIconRotationDegree = 90;\n\n\t\tthis.$dropdownHeadings.on('click', (event) => {\n\t\t\tlet $itemToBeSelected = $(event.currentTarget).parent(`.${CLS}-dropdown`);\n\n\t\t\tif(!this.$selectedItem) {\n\t\t\t\tthis.activate($itemToBeSelected);\n\t\t\t}\n\t\t\telse if(this.$selectedItem[0].isEqualNode($itemToBeSelected[0]) && this.$selectedItem.attr('data-active')) {\n\t\t\t\tthis.deactivate($itemToBeSelected);\n\t\t\t}\n\t\t\telse if(!this.$selectedItem[0].isEqualNode($itemToBeSelected[0])) {\n\t\t\t\tthis.deactivate(this.$selectedItem);\n\t\t\t\tthis.activate($itemToBeSelected);\n\t\t\t}\n\t\t});\n\n\t\t// Stops dropdownHeadingLink from toggling the dropdown\n\t\tthis.$dropdownHeadingsLink.on('click', (event) => {\n\t\t\tevent.stopPropagation();\n\t\t});\n\n\t\t// Deactivates all the dropdowns. for the most part can be called by the parent dropdown…\n\t\tthis.$element.on(`${CLS}.dropdown.deactivate`, (event) => {\n\t\t\tevent.stopPropagation();\n\t\t\tif(this.$selectedItem) {\n\t\t\t\tthis.deactivate(this.$selectedItem);\n\t\t\t}\n\t\t});\n\n\t\tthis.$element.on(`${CLS}.dropdown.activate`, (event, params) => {\n\t\t\tevent.stopPropagation();\n\t\t\t// Dropdown element passed from sidebarWidget\n\t\t\tif(params.element) {\n\t\t\t\tthis.activate(params.element, params.animate);\n\t\t\t}\n\t\t});\n\t}\n\n\tactivate(item, animate = true) {\n\t\tif(animate) {\n\t\t\titem.children(`.${CLS}-dropdown-content`).slideDown({\n\t\t\t\tduration: this.itemContentAnimationDuration\n\t\t\t});\n\t\t\tthis.rotateIcon(item, 0, this.itemHeadingIconRotationDegree);\n\t\t}\n\t\telse {\n\t\t\titem.children(`.${CLS}-dropdown-content`).show();\n\t\t\tthis.rotateIcon(item, 0, this.itemHeadingIconRotationDegree, false);\n\t\t}\n\n\t\titem.attr('data-active', true);\n\t\tthis.$selectedItem = item;\n\t}\n\n\tdeactivate(item) {\n\t\titem.children(`.${CLS}-dropdown-content`).slideUp({\n\t\t\tduration: this.itemContentAnimationDuration\n\t\t});\n\t\tthis.rotateIcon(item, this.itemHeadingIconRotationDegree, 0);\n\t\titem.attr('data-active', false);\n\t\tthis.$selectedItem = null;\n\n\t\titem.children(`.${CLS}-dropdown-content`).children(`.${CLS}-dropdown-content-inner`).children('[data-wg=\"SidebarItemsWidget\"]').each((index, element) => {\n\t\t\t$(element).trigger(`${CLS}.dropdown.deactivate`, {});\n\t\t});\n\t}\n\n\trotateIcon(item, initialDegree, degree, animate = true) {\n\t\tlet $element = item.children(`.${CLS}-dropdown-heading`).children(`.${CLS}-dropdown-icon`);\n\n\t\tif(animate) {\n\t\t\t$({ deg: initialDegree }).animate({ deg: degree }, {\n\t\t\t\tduration: this.itemHeadingIconAnimationDuration,\n\t\t\t\tstep: (now) => {\n\t\t\t\t\t$element.css({\n\t\t\t\t\t\ttransform: `rotate(${now}deg)`\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\telse {\n\t\t\t$element.css({\n\t\t\t\ttransform: `rotate(${degree}deg)`\n\t\t\t});\n\t\t}\n\t}\n}\n"],"sourceRoot":""}