carbon-components-angular 5.58.0 → 5.58.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/documentation/components/ActionableNotification.html +80 -41
- package/docs/documentation/components/DropdownList.html +84 -82
- package/docs/documentation/components/Notification.html +76 -37
- package/docs/documentation/coverage.html +6 -6
- package/docs/documentation/js/search/search_index.js +2 -2
- package/docs/documentation/modules/ComboBoxModule/dependencies.svg +4 -4
- package/docs/documentation/modules/ComboBoxModule.html +4 -4
- package/docs/documentation/modules/DatePickerInputModule/dependencies.svg +37 -41
- package/docs/documentation/modules/DatePickerInputModule.html +37 -41
- package/docs/documentation/modules/DialogModule/dependencies.svg +34 -34
- package/docs/documentation/modules/DialogModule.html +34 -34
- package/docs/documentation/modules/FileUploaderModule/dependencies.svg +36 -36
- package/docs/documentation/modules/FileUploaderModule.html +36 -36
- package/docs/documentation/modules/NumberModule/dependencies.svg +4 -4
- package/docs/documentation/modules/NumberModule.html +4 -4
- package/docs/documentation/modules/RadioModule/dependencies.svg +48 -48
- package/docs/documentation/modules/RadioModule.html +48 -48
- package/docs/documentation/modules/SelectModule/dependencies.svg +43 -43
- package/docs/documentation/modules/SelectModule.html +43 -43
- package/docs/documentation/modules/SliderModule/dependencies.svg +4 -4
- package/docs/documentation/modules/SliderModule.html +4 -4
- package/docs/documentation/modules/TabsModule/dependencies.svg +69 -69
- package/docs/documentation/modules/TabsModule.html +69 -69
- package/docs/documentation/modules/TagModule/dependencies.svg +39 -39
- package/docs/documentation/modules/TagModule.html +39 -39
- package/docs/documentation/modules/ThemeModule/dependencies.svg +4 -4
- package/docs/documentation/modules/ThemeModule.html +4 -4
- package/docs/documentation/modules/TilesModule/dependencies.svg +107 -107
- package/docs/documentation/modules/TilesModule.html +107 -107
- package/docs/documentation/modules/TimePickerModule/dependencies.svg +45 -41
- package/docs/documentation/modules/TimePickerModule.html +45 -41
- package/docs/documentation/modules/TimePickerSelectModule/dependencies.svg +38 -42
- package/docs/documentation/modules/TimePickerSelectModule.html +38 -42
- package/docs/documentation/modules/ToggleModule/dependencies.svg +34 -38
- package/docs/documentation/modules/ToggleModule.html +34 -38
- package/docs/documentation/modules/ToggletipModule/dependencies.svg +38 -38
- package/docs/documentation/modules/ToggletipModule.html +38 -38
- package/docs/documentation/modules/TooltipModule/dependencies.svg +29 -29
- package/docs/documentation/modules/TooltipModule.html +29 -29
- package/docs/documentation/modules/TreeviewModule/dependencies.svg +31 -31
- package/docs/documentation/modules/TreeviewModule.html +31 -31
- package/docs/documentation/modules/UIShellModule/dependencies.svg +4 -4
- package/docs/documentation/modules/UIShellModule.html +4 -4
- package/docs/documentation.json +134 -114
- package/docs/storybook/{3224.5a4b3111.iframe.bundle.js → 3224.ee9adbba.iframe.bundle.js} +1 -1
- package/docs/storybook/901.9e4e376b.iframe.bundle.js +1 -0
- package/docs/storybook/iframe.html +2 -2
- package/docs/storybook/main.d00e3563.iframe.bundle.js +1 -0
- package/docs/storybook/project.json +1 -1
- package/docs/storybook/{runtime~main.89fec306.iframe.bundle.js → runtime~main.c31464c5.iframe.bundle.js} +1 -1
- package/esm2020/dropdown/list/dropdown-list.component.mjs +5 -3
- package/esm2020/notification/actionable-notification.component.mjs +18 -7
- package/esm2020/notification/notification.component.mjs +17 -6
- package/fesm2015/carbon-components-angular-dropdown.mjs +4 -2
- package/fesm2015/carbon-components-angular-dropdown.mjs.map +1 -1
- package/fesm2015/carbon-components-angular-notification.mjs +33 -11
- package/fesm2015/carbon-components-angular-notification.mjs.map +1 -1
- package/fesm2020/carbon-components-angular-dropdown.mjs +4 -2
- package/fesm2020/carbon-components-angular-dropdown.mjs.map +1 -1
- package/fesm2020/carbon-components-angular-notification.mjs +33 -11
- package/fesm2020/carbon-components-angular-notification.mjs.map +1 -1
- package/notification/actionable-notification.component.d.ts +1 -0
- package/notification/notification.component.d.ts +1 -0
- package/package.json +1 -1
- package/docs/storybook/901.32dc2d61.iframe.bundle.js +0 -1
- package/docs/storybook/main.622b2392.iframe.bundle.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkcarbon_components_angular=self.webpackChunkcarbon_components_angular||[]).push([[3224],{"./src/dropdown/index.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{jq:()=>AbstractDropdownView,Lt:()=>Dropdown,kW:()=>DropdownModule,Vn:()=>DropdownService});var tslib_es6=__webpack_require__("./node_modules/tslib/tslib.es6.js"),core=__webpack_require__("./node_modules/@angular/core/fesm2020/core.mjs"),fesm2020_forms=__webpack_require__("./node_modules/@angular/forms/fesm2020/forms.mjs"),Subscription=__webpack_require__("./node_modules/rxjs/dist/esm5/internal/Subscription.js"),of=__webpack_require__("./node_modules/rxjs/dist/esm5/internal/observable/of.js");let AbstractDropdownView=class AbstractDropdownView{constructor(){this.type="single",this.size="md"}set items(value){}get items(){}getNextItem(){}hasNextElement(){}getNextElement(){}getPrevItem(){}hasPrevElement(){}getPrevElement(){}getSelected(){}getCurrentItem(){}getCurrentElement(){}getListItems(){}propagateSelected(value){}filterBy(value){}initFocus(){}onItemsReady(subcription){}reorderSelected(moveFocus){}};AbstractDropdownView.propDecorators={items:[{type:core.Input}],select:[{type:core.Output}],blurIntent:[{type:core.Output}]},AbstractDropdownView=(0,tslib_es6.gn)([(0,core.Directive)({selector:"[cdsAbstractDropdownView], [ibmAbstractDropdownView]"})],AbstractDropdownView);var i18n=__webpack_require__("./src/i18n/index.ts"),placeholder=__webpack_require__("./src/placeholder/index.ts"),utils_position=__webpack_require__("./node_modules/@carbon/utils-position/index.js"),utils=__webpack_require__("./src/utils/index.ts");const defaultOffset={top:0,left:0};let DropdownService=class DropdownService{constructor(placeholderService,animationFrameService){this.placeholderService=placeholderService,this.animationFrameService=animationFrameService,this.animationFrameSubscription=new Subscription.w0,this._offset=defaultOffset}set offset(value){this._offset=Object.assign({},defaultOffset,value)}get offset(){return this._offset}appendToBody(parentRef,menuRef,classList){menuRef.style.display="block";const dropdownWrapper=document.createElement("div");return dropdownWrapper.className=`dropdown ${classList}`,dropdownWrapper.style.width=parentRef.offsetWidth+"px",dropdownWrapper.style.position="absolute",dropdownWrapper.appendChild(menuRef),this.placeholderService.hasPlaceholderRef()?this.placeholderService.appendElement(dropdownWrapper):document.body.appendChild(dropdownWrapper),this.menuInstance=dropdownWrapper,this.animationFrameSubscription=this.animationFrameService.tick.subscribe((()=>{this.positionDropdown(parentRef,dropdownWrapper)})),this.positionDropdown(parentRef,dropdownWrapper),dropdownWrapper}appendToDropdown(hostRef){if(!this.menuInstance)return;const instance=this.menuInstance,menu=instance.firstElementChild;return this.menuInstance=null,menu.style.display="none",hostRef.appendChild(menu),this.animationFrameSubscription.unsubscribe(),this.placeholderService.hasPlaceholderRef()&&this.placeholderService.hasElement(instance)?this.placeholderService.removeElement(instance):document.body.contains(instance)&&document.body.removeChild(instance),instance}updatePosition(parentRef){this.positionDropdown(parentRef,this.menuInstance)}ngOnDestroy(){this.animationFrameSubscription.unsubscribe()}positionDropdown(parentRef,menuRef){if(!menuRef)return;let leftOffset=0;const boxMenu=menuRef.querySelector(".cds--list-box__menu");if(boxMenu)if(parentRef.getBoundingClientRect().left!==boxMenu.getBoundingClientRect().left){parentRef.getBoundingClientRect().left-boxMenu.getBoundingClientRect().left+boxMenu.getBoundingClientRect().right>(window.innerWidth||document.documentElement.clientWidth)&&(leftOffset=parentRef.offsetWidth-boxMenu.offsetWidth)}else boxMenu.getBoundingClientRect().right>(window.innerWidth||document.documentElement.clientWidth)&&(leftOffset=parentRef.offsetWidth-boxMenu.offsetWidth);const closestMenuWithPos=(0,utils._K)("position",["relative","fixed","absolute"],menuRef.parentElement),topPos=closestMenuWithPos?-1*closestMenuWithPos.getBoundingClientRect().top:this.offset.top,leftPos=closestMenuWithPos?-1*closestMenuWithPos.getBoundingClientRect().left:this.offset.left+leftOffset;let pos=utils_position.FK.findAbsolute(parentRef,menuRef,"bottom");pos=utils_position.FK.addOffset(pos,topPos,leftPos),utils_position.FK.setElement(menuRef,pos)}};DropdownService.ctorParameters=()=>[{type:placeholder.Q_},{type:utils.NV}],DropdownService=(0,tslib_es6.gn)([(0,core.Injectable)()],DropdownService);let Dropdown=class Dropdown{constructor(elementRef,i18n,dropdownService,elementService){this.elementRef=elementRef,this.i18n=i18n,this.dropdownService=dropdownService,this.elementService=elementService,this.id="dropdown-"+Dropdown.dropdownCount++,this.hideLabel=!1,this.placeholder="",this.displayValue="",this.clearText=this.i18n.get().DROPDOWN.CLEAR,this.size="md",this.type="single",this.theme="dark",this.disabled=!1,this.readonly=!1,this.skeleton=!1,this.inline=!1,this.disableArrowKeys=!1,this.invalid=!1,this.warn=!1,this.appendInline=null,this.selectionFeedback="top-after-reopen",this.menuButtonLabel=this.i18n.get().DROPDOWN.OPEN,this.selectedLabel=this.i18n.get().DROPDOWN.SELECTED,this.selected=new core.EventEmitter,this.onClose=new core.EventEmitter,this.close=new core.EventEmitter,this.hostClass=!0,this.hostWrapperClass=!0,this.fluid=!1,this.menuIsClosed=!0,this._dropUp=!1,this.noop=this._noop.bind(this),this.outsideClick=this._outsideClick.bind(this),this.outsideKey=this._outsideKey.bind(this),this.keyboardNav=this._keyboardNav.bind(this),this.visibilitySubscription=new Subscription.w0,this.onTouchedCallback=this._noop,this._isFocused=!1,this._writtenValue=[],this.propagateChange=_=>{}}get fluidInvalidClass(){return this.invalid&&this.fluid}get fluidFocusClass(){return this.fluid&&this._isFocused&&this.menuIsClosed}get writtenValue(){return this._writtenValue}set writtenValue(val){val&&0===val.length&&this.clearSelected(),this._writtenValue=val}ngOnInit(){this.view&&(this.view.type=this.type)}ngAfterContentInit(){if(!this.view)return;(this.writtenValue&&this.writtenValue.length||"number"==typeof this.writtenValue)&&this.writeValue(this.writtenValue),this.view.type=this.type,this.view.size=this.size;const isUpdate=event=>event&&event.isUpdate;this.view.select.subscribe((event=>{if("single"!==this.type||isUpdate(event)||Array.isArray(event)||(this.closeMenu(),event.item&&event.item.selected?this.itemValueKey?this.propagateChange(event.item[this.itemValueKey]):this.propagateChange(event.item):this.propagateChange(null)),"multi"===this.type&&!isUpdate(event))if(this.itemValueKey&&this.view.getSelected()){const values=this.view.getSelected().map((item=>item[this.itemValueKey]));this.propagateChange(values)}else this.propagateChange(this.view.getSelected());isUpdate(event)||(this.checkForReorder(),this.selected.emit(event))}))}ngAfterViewInit(){null===this.appendInline&&(0,utils.OQ)(this.elementRef.nativeElement)?this.appendInline=!1:null===this.appendInline&&(this.appendInline=!0),this.checkForReorder()}ngOnDestroy(){this.appendInline||this._appendToDropdown()}writeValue(value){this.writtenValue=value,this.view.onItemsReady((()=>{if(value)if("single"===this.type)if(this.itemValueKey){const newValue=Object.assign({},this.view.getListItems().find((item=>item[this.itemValueKey]===value)));newValue.selected=!0,this.view.propagateSelected([newValue])}else this.view.propagateSelected([value]);else if(this.itemValueKey){let newValues=[];for(const v of value)for(const item of this.view.getListItems())item[this.itemValueKey]===v&&newValues.push(Object.assign({},item,{selected:!0}));this.view.propagateSelected(newValues)}else this.view.propagateSelected(value);else this.view.propagateSelected([value]);this.checkForReorder()}))}onBlur(){this.onTouchedCallback()}registerOnChange(fn){this.propagateChange=fn}registerOnTouched(fn){this.onTouchedCallback=fn}setDisabledState(isDisabled){this.disabled=isDisabled}onKeyDown(event){if(!this.readonly){if("Escape"!==event.key||this.menuIsClosed||event.stopImmediatePropagation(),"Escape"===event.key)event.preventDefault(),this.closeMenu(),this.dropdownButton.nativeElement.focus();else if(this.menuIsClosed&&(" "===event.key||"ArrowDown"===event.key||"ArrowUp"===event.key)){if(this.disableArrowKeys&&("ArrowDown"===event.key||"ArrowUp"===event.key))return;event.preventDefault(),this.openMenu()}!this.menuIsClosed&&"Tab"===event.key&&this.dropdownMenu.nativeElement.contains(event.target)&&this.closeMenu(),!this.menuIsClosed&&"Tab"===event.key&&event.shiftKey&&this.closeMenu(),"multi"!==this.type&&this.menuIsClosed&&this.closedDropdownNavigation(event)}}closedDropdownNavigation(event){if("ArrowDown"===event.key){event.preventDefault(),this.view.getCurrentItem().selected=!1;let item=this.view.getNextItem();item&&(item.selected=!0)}else if("ArrowUp"===event.key){event.preventDefault(),this.view.getCurrentItem().selected=!1;let item=this.view.getPrevItem();item&&(item.selected=!0)}}getDisplayStringValue(){if(!this.view||this.skeleton)return;let selected=this.view.getSelected();return!selected.length||this.displayValue&&this.isRenderString()?selected.length&&this.isRenderString()?(0,of.of)(this.displayValue):(0,of.of)(this.placeholder):"multi"===this.type?(0,of.of)(this.placeholder):(0,of.of)(selected[0].content)}isRenderString(){return"string"==typeof this.displayValue}getRenderTemplateContext(){if(!this.view)return;let selected=this.view.getSelected();return"multi"===this.type?{items:selected}:selected&&selected.length>0?{item:selected[0]}:{}}getSelectedCount(){if(this.view.getSelected())return this.view.getSelected().length}clearSelected(){if(!this.disabled&&0!==this.getSelectedCount()){for(const item of this.view.getListItems())item.selected=!1;this.selected.emit([]),this.propagateChange([])}}valueSelected(){return!!this.view.getSelected()}_noop(){}_outsideClick(event){this.elementRef.nativeElement.contains(event.target)||this.dropdownMenu.nativeElement.contains(event.target)||this.closeMenu()}_outsideKey(event){!this.menuIsClosed&&"Tab"===event.key&&this.dropdownMenu.nativeElement.contains(event.target)&&this.closeMenu()}_keyboardNav(event){"Escape"!==event.key||this.menuIsClosed||event.stopImmediatePropagation(),"Escape"===event.key?(event.preventDefault(),this.closeMenu(),this.dropdownButton.nativeElement.focus()):this.menuIsClosed||"Tab"!==event.key||(this.dropdownButton.nativeElement.focus(),this.dropdownButton.nativeElement.dispatchEvent(new KeyboardEvent("keydown",{bubbles:!0,cancelable:!0,key:"Tab"})),this.closeMenu())}_appendToDropdown(){this.dropdownService.appendToDropdown(this.elementRef.nativeElement),this.dropdownMenu.nativeElement.removeEventListener("keydown",this.keyboardNav,!0)}_appendToBody(){const lightClass="light"===this.theme?" cds--list-box--light":"",expandedClass=this.menuIsClosed?"":" cds--list-box--expanded";this.dropdownService.appendToBody(this.dropdownButton.nativeElement,this.dropdownMenu.nativeElement,`${this.elementRef.nativeElement.className}${lightClass}${expandedClass}`),this.dropdownMenu.nativeElement.addEventListener("keydown",this.keyboardNav,!0)}_shouldDropUp(){const menu=this.dropdownMenu&&this.dropdownMenu.nativeElement.querySelector(".cds--list-box__menu"),menuRect=menu&&menu.getBoundingClientRect();if(menu&&menuRect){return(0,utils.O3)(menu).reduce(((shouldDropUp,parent)=>{const parentRect=parent.getBoundingClientRect(),isBelowParent=!(menuRect.bottom<=parentRect.bottom);return shouldDropUp||isBelowParent}),!1)}return!1}openMenu(){if(0!==this.view.getListItems().length){if(this._dropUp=!1,this.menuIsClosed=!1,!this.appendInline){const target=this.dropdownButton.nativeElement,parent=this.elementRef.nativeElement;this.visibilitySubscription=this.elementService.visibility(target,parent).subscribe((value=>{value.visible||this.closeMenu()})),this._appendToBody()}setTimeout((()=>{null!==this.dropUp&&void 0!==this.dropUp||(this._dropUp=this._shouldDropUp())}),0),document.body.firstElementChild.addEventListener("click",this.noop,!0),document.body.firstElementChild.addEventListener("keydown",this.noop,!0),document.addEventListener("click",this.outsideClick,!0),document.addEventListener("keydown",this.outsideKey,!0),setTimeout((()=>this.view.initFocus()),0)}}closeMenu(){this.menuIsClosed||(this.menuIsClosed=!0,this.checkForReorder(),this.onClose.emit(),this.close.emit(),this.dropdownButton.nativeElement.focus(),this.view.disableScroll&&this.view.disableScroll(),this.appendInline||(this.visibilitySubscription.unsubscribe(),this._appendToDropdown()),document.body.firstElementChild.removeEventListener("click",this.noop,!0),document.body.firstElementChild.removeEventListener("keydown",this.noop,!0),document.removeEventListener("click",this.outsideClick,!0),document.removeEventListener("keydown",this.outsideKey,!0))}toggleMenu(){this.menuIsClosed?this.openMenu():this.closeMenu()}isTemplate(value){return value instanceof core.TemplateRef}handleFocus(event){this._isFocused="focus"===event.type,"blur"===event.type&&this.onBlur()}checkForReorder(){const topAfterReopen=this.menuIsClosed&&"top-after-reopen"===this.selectionFeedback;"multi"!==this.type||!topAfterReopen&&"top"!==this.selectionFeedback||this.view.reorderSelected()}};Dropdown.dropdownCount=0,Dropdown.ctorParameters=()=>[{type:core.ElementRef},{type:i18n.oc},{type:DropdownService},{type:utils.d2}],Dropdown.propDecorators={fluidInvalidClass:[{type:core.HostBinding,args:["class.cds--list-box__wrapper--fluid--invalid"]}],fluidFocusClass:[{type:core.HostBinding,args:["class.cds--list-box__wrapper--fluid--focus"]}],id:[{type:core.Input}],label:[{type:core.Input}],hideLabel:[{type:core.Input}],helperText:[{type:core.Input}],placeholder:[{type:core.Input}],displayValue:[{type:core.Input}],clearText:[{type:core.Input}],size:[{type:core.Input}],type:[{type:core.Input}],theme:[{type:core.Input}],disabled:[{type:core.Input}],readonly:[{type:core.Input}],skeleton:[{type:core.Input}],inline:[{type:core.Input}],disableArrowKeys:[{type:core.Input}],invalid:[{type:core.Input}],invalidText:[{type:core.Input}],warn:[{type:core.Input}],warnText:[{type:core.Input}],appendInline:[{type:core.Input}],scrollableContainer:[{type:core.Input}],itemValueKey:[{type:core.Input}],selectionFeedback:[{type:core.Input}],menuButtonLabel:[{type:core.Input}],selectedLabel:[{type:core.Input}],dropUp:[{type:core.Input}],selected:[{type:core.Output}],onClose:[{type:core.Output}],close:[{type:core.Output}],view:[{type:core.ContentChild,args:[AbstractDropdownView,{static:!0}]}],dropdownButton:[{type:core.ViewChild,args:["dropdownButton",{static:!0}]}],dropdownMenu:[{type:core.ViewChild,args:["dropdownMenu",{static:!0}]}],hostClass:[{type:core.HostBinding,args:["class.cds--dropdown__wrapper"]}],hostWrapperClass:[{type:core.HostBinding,args:["class.cds--list-box__wrapper"]}],fluid:[{type:core.HostBinding,args:["class.cds--list-box__wrapper--fluid"]},{type:core.Input}],onKeyDown:[{type:core.HostListener,args:["keydown",["$event"]]}]},Dropdown=(0,tslib_es6.gn)([(0,core.Component)({selector:"cds-dropdown, ibm-dropdown",template:'\n\t<label\n\t\t*ngIf="label && !skeleton"\n\t\t[for]="id"\n\t\tclass="cds--label"\n\t\t[ngClass]="{\n\t\t\t\'cds--label--disabled\': disabled,\n\t\t\t\'cds--visually-hidden\': hideLabel\n\t\t}">\n\t\t<ng-container *ngIf="!isTemplate(label)">{{label}}</ng-container>\n\t\t<ng-template *ngIf="isTemplate(label)" [ngTemplateOutlet]="label"></ng-template>\n\t</label>\n\t<div\n\t\tclass="cds--list-box"\n\t\t[ngClass]="{\n\t\t\t\'cds--dropdown\': type !== \'multi\' && !(skeleton && fluid),\n\t\t\t\'cds--multiselect\': type === \'multi\',\n\t\t\t\'cds--multi-select--selected\': type === \'multi\' && getSelectedCount() > 0,\n\t\t\t\'cds--dropdown--light\': theme === \'light\',\n\t\t\t\'cds--list-box--light\': theme === \'light\',\n\t\t\t\'cds--list-box--inline\': inline,\n\t\t\t\'cds--skeleton\': skeleton,\n\t\t\t\'cds--dropdown--disabled cds--list-box--disabled\': disabled,\n\t\t\t\'cds--dropdown--readonly\': readonly,\n\t\t\t\'cds--dropdown--invalid\': invalid,\n\t\t\t\'cds--dropdown--warning cds--list-box--warning\': warn,\n\t\t\t\'cds--dropdown--sm cds--list-box--sm\': size === \'sm\',\n\t\t\t\'cds--dropdown--md cds--list-box--md\': size === \'md\',\n\t\t\t\'cds--dropdown--lg cds--list-box--lg\': size === \'lg\',\n\t\t\t\'cds--list-box--expanded\': !menuIsClosed,\n\t\t\t\'cds--list-box--invalid\': invalid\n\t\t}"\n\t\t[attr.data-invalid]="invalid ? true : null">\n\t\t<div *ngIf="skeleton && fluid" class="cds--list-box__label"></div>\n\t\t<button\n\t\t\t#dropdownButton\n\t\t\t[id]="id"\n\t\t\ttype="button"\n\t\t\tclass="cds--list-box__field"\n\t\t\t[ngClass]="{\'a\': !menuIsClosed}"\n\t\t\t[attr.aria-expanded]="!menuIsClosed"\n\t\t\t[attr.aria-disabled]="disabled"\n\t\t\taria-haspopup="listbox"\n\t\t\t(click)="disabled || readonly ? $event.stopPropagation() : toggleMenu()"\n\t\t\t(focus)="fluid ? handleFocus($event) : null"\n\t\t\t(blur)="fluid ? handleFocus($event) : onBlur()"\n\t\t\t[attr.disabled]="disabled ? true : null">\n\t\t\t<div\n\t\t\t\t(click)="clearSelected()"\n\t\t\t\t(keydown.enter)="clearSelected()"\n\t\t\t\t*ngIf="type === \'multi\' && getSelectedCount() > 0"\n\t\t\t\tclass="cds--list-box__selection cds--tag--filter cds--list-box__selection--multi"\n\t\t\t\ttabindex="0"\n\t\t\t\t[title]="clearText">\n\t\t\t\t{{getSelectedCount()}}\n\t\t\t\t<svg\n\t\t\t\t\tfocusable="false"\n\t\t\t\t\tpreserveAspectRatio="xMidYMid meet"\n\t\t\t\t\tstyle="will-change: transform;"\n\t\t\t\t\trole="img"\n\t\t\t\t\txmlns="http://www.w3.org/2000/svg"\n\t\t\t\t\twidth="16"\n\t\t\t\t\theight="16"\n\t\t\t\t\tviewBox="0 0 16 16"\n\t\t\t\t\taria-hidden="true">\n\t\t\t\t\t<path d="M12 4.7l-.7-.7L8 7.3 4.7 4l-.7.7L7.3 8 4 11.3l.7.7L8 8.7l3.3 3.3.7-.7L8.7 8z"></path>\n\t\t\t\t</svg>\n\t\t\t</div>\n\t\t\t<span *ngIf="isRenderString()" class="cds--list-box__label">{{getDisplayStringValue() | async}}</span>\n\t\t\t<ng-template\n\t\t\t\t*ngIf="!isRenderString()"\n\t\t\t\t[ngTemplateOutletContext]="getRenderTemplateContext()"\n\t\t\t\t[ngTemplateOutlet]="displayValue">\n\t\t\t</ng-template>\n\t\t\t<span class="cds--list-box__menu-icon">\n\t\t\t\t<svg\n\t\t\t\t\t*ngIf="!skeleton"\n\t\t\t\t\tcdsIcon="chevron--down"\n\t\t\t\t\tsize="16"\n\t\t\t\t\t[attr.aria-label]="menuButtonLabel"\n\t\t\t\t\t[ngClass]="{\'cds--list-box__menu-icon--open\': !menuIsClosed }">\n\t\t\t\t</svg>\n\t\t\t</span>\n\t\t</button>\n\t\t<svg\n\t\t\t*ngIf="invalid"\n\t\t\tclass="cds--list-box__invalid-icon"\n\t\t\tcdsIcon="warning--filled"\n\t\t\tsize="16">\n\t\t</svg>\n\t\t<svg\n\t\t\t*ngIf="!invalid && warn"\n\t\t\tcdsIcon="warning--alt--filled"\n\t\t\tsize="16"\n\t\t\tclass="cds--list-box__invalid-icon cds--list-box__invalid-icon--warning">\n\t\t</svg>\n\t\t<div\n\t\t\t#dropdownMenu\n\t\t\t[ngClass]="{\n\t\t\t\t\'cds--list-box--up\': this.dropUp !== null && this.dropUp !== undefined ? dropUp : _dropUp\n\t\t\t}">\n\t\t\t<ng-content *ngIf="!menuIsClosed"></ng-content>\n\t\t</div>\n\t</div>\n\t<hr *ngIf="fluid" class="cds--list-box__divider" />\n\t<div\n\t\t*ngIf="helperText && !invalid && !warn && !skeleton && !fluid"\n\t\tclass="cds--form__helper-text"\n\t\t[ngClass]="{\n\t\t\t\'cds--form__helper-text--disabled\': disabled\n\t\t}">\n\t\t<ng-container *ngIf="!isTemplate(helperText)">{{helperText}}</ng-container>\n\t\t<ng-template *ngIf="isTemplate(helperText)" [ngTemplateOutlet]="helperText"></ng-template>\n\t</div>\n\t<div *ngIf="invalid" class="cds--form-requirement">\n\t\t<ng-container *ngIf="!isTemplate(invalidText)">{{ invalidText }}</ng-container>\n\t\t<ng-template *ngIf="isTemplate(invalidText)" [ngTemplateOutlet]="invalidText"></ng-template>\n\t</div>\n\t<div *ngIf="!invalid && warn" class="cds--form-requirement">\n\t\t<ng-container *ngIf="!isTemplate(warnText)">{{warnText}}</ng-container>\n\t\t<ng-template *ngIf="isTemplate(warnText)" [ngTemplateOutlet]="warnText"></ng-template>\n\t</div>\n\t',providers:[{provide:fesm2020_forms.JU,useExisting:Dropdown,multi:!0}]})],Dropdown);var isObservable=__webpack_require__("./node_modules/rxjs/dist/esm5/internal/util/isObservable.js"),Observable=__webpack_require__("./node_modules/rxjs/dist/esm5/internal/Observable.js"),first=__webpack_require__("./node_modules/rxjs/dist/esm5/internal/operators/first.js"),fromEvent=__webpack_require__("./node_modules/rxjs/dist/esm5/internal/observable/fromEvent.js"),debounceTime=__webpack_require__("./node_modules/rxjs/dist/esm5/internal/operators/debounceTime.js"),map=__webpack_require__("./node_modules/rxjs/dist/esm5/internal/operators/map.js"),filter=__webpack_require__("./node_modules/rxjs/dist/esm5/internal/operators/filter.js");let DropdownList=class DropdownList{constructor(elementRef,i18n,appRef){this.elementRef=elementRef,this.i18n=i18n,this.appRef=appRef,this.ariaLabel=this.i18n.get().DROPDOWN_LIST.LABEL,this.listTpl=null,this.select=new core.EventEmitter,this.scroll=new core.EventEmitter,this.blurIntent=new core.EventEmitter,this.type="single",this.showTitles=!0,this.size="md",this.listId="listbox-"+DropdownList.listCount++,this.highlightedItem=null,this.displayItems=[],this.index=-1,this._items=[]}set items(value){(0,isObservable.b)(value)?(this._itemsSubscription&&this._itemsSubscription.unsubscribe(),this._itemsReady=new Observable.y((observer=>{this._itemsSubscription=value.subscribe((v=>{this.updateList(v),observer.next(!0),observer.complete()}))})),this.onItemsReady(null)):this.updateList(value),this._originalItems=value}get items(){return this._originalItems}ngAfterViewInit(){this.index=this.getListItems().findIndex((item=>item.selected)),this.setupFocusObservable(),setTimeout((()=>{this.doEmitSelect(!0)}))}ngOnDestroy(){this.focusJump&&this.focusJump.unsubscribe(),this._itemsSubscription&&this._itemsSubscription.unsubscribe()}doEmitSelect(isUpdate=!0){if("single"===this.type)this.select.emit({item:this._items.find((item=>item.selected)),isUpdate});else{const selected=this.getSelected()||[];selected.isUpdate=isUpdate,this.select.emit(selected)}}getItemId(index){return`${this.listId}-${index}`}updateList(items){this._items=items.map((item=>Object.assign({},item))),this.displayItems=this._items,this.updateIndex(),this.setupFocusObservable(),this.doEmitSelect()}filterBy(query=""){query?(this.displayItems=this.getListItems().filter((item=>item.content.toLowerCase().includes(query.toLowerCase()))),this.displayItems&&(this.index=0)):this.displayItems=this.getListItems(),this.updateIndex()}setupFocusObservable(){if(!this.list)return;this.focusJump&&this.focusJump.unsubscribe();let elList=Array.from(this.list.nativeElement.querySelectorAll("li"));this.focusJump=function watchFocusJump(target,elements){return(0,fromEvent.R)(target,"keydown").pipe((0,debounceTime.b)(150),(0,map.U)((ev=>{let el=elements.find((itemEl=>itemEl.textContent.trim().toLowerCase().startsWith(ev.key)));if(el)return el})),(0,filter.h)((el=>!!el)))}(this.list.nativeElement,elList).subscribe((el=>{el.focus()}))}getNextItem(){return this.index<this.displayItems.length-1&&this.index++,this.displayItems[this.index]}hasNextElement(){return this.index<this.displayItems.length-1&&(!(this.index===this.displayItems.length-2)||!this.displayItems[this.index+1].disabled)}getNextElement(){const elemList=this.listElementList?this.listElementList.toArray():[];if(!elemList.length)return null;for(let i=this.index+1;i<elemList.length;i++)if(!this.displayItems[i].disabled)return this.index=i,elemList[i].nativeElement;return elemList[this.index]?.nativeElement}getPrevItem(){return this.index>0&&this.index--,this.displayItems[this.index]}hasPrevElement(){return this.index>0&&(!(1===this.index)||!this.displayItems[0].disabled)}getPrevElement(){const elemList=this.listElementList?this.listElementList.toArray():[];if(!elemList.length)return null;for(let i=this.index-1;i<this.index&&i>=0;i--)if(!this.displayItems[i].disabled)return this.index=i,elemList[i].nativeElement;return elemList[this.index].nativeElement}getCurrentItem(){return this.index<0?this.displayItems[0]:this.displayItems[this.index]}getCurrentElement(){return this.index<0?this.listElementList.first.nativeElement:this.listElementList.toArray()[this.index].nativeElement}getListItems(){return this._items}getSelected(){let selected=this.getListItems().filter((item=>item.selected));return 0===selected.length?[]:selected}propagateSelected(value){Array.isArray(value)||console.error(`${this.constructor.name}.propagateSelected expects an Array<ListItem>, got ${JSON.stringify(value)}`),this.onItemsReady((()=>{const selectedNewItems=[];for(let newItem of value)if(newItem&&newItem.selected){let tempNewItem=Object.assign({},newItem);delete tempNewItem.selected,tempNewItem=JSON.stringify(tempNewItem),selectedNewItems.push(tempNewItem)}for(let oldItem of this.getListItems()){if(0===selectedNewItems.length){oldItem.selected=!1;continue}let tempOldItem=Object.assign({},oldItem);delete tempOldItem.selected,tempOldItem=JSON.stringify(tempOldItem);for(let selectedNewItem of selectedNewItems){if(tempOldItem.includes(selectedNewItem)){oldItem.selected=!0;break}oldItem.selected=!1}}}))}initFocus(){this.index<0&&this.updateIndex(),this.list.nativeElement.focus(),setTimeout((()=>{this.highlightedItem=this.getItemId(this.index)}))}updateIndex(){const selected=this.getSelected();selected.length?this.index=this.displayItems.indexOf(selected[0]):this.index<0&&this.hasNextElement()&&this.getNextElement()}navigateList(event){"Enter"===event.key||" "===event.key?(this.listElementList.some((option=>option.nativeElement===event.target))&&event.preventDefault(),"Enter"===event.key&&this.doClick(event,this.getCurrentItem())):"ArrowDown"!==event.key&&"ArrowUp"!==event.key||(event.preventDefault(),"ArrowDown"===event.key?this.hasNextElement()?this.getNextElement()?.scrollIntoView({block:"end"}):this.blurIntent.emit("bottom"):"ArrowUp"===event.key&&(this.hasPrevElement()?this.getPrevElement().scrollIntoView({block:"nearest"}):this.blurIntent.emit("top")),setTimeout((()=>{this.highlightedItem=this.getItemId(this.index)})))}doClick(event,item){if(event.preventDefault(),item&&!item.disabled){if(this.list.nativeElement.focus(),"single"===this.type){item.selected=!0;for(let otherItem of this.getListItems())item!==otherItem&&(otherItem.selected=!1)}else item.selected=!item.selected;this.index=this.displayItems.indexOf(item),this.highlightedItem=this.getItemId(this.index),this.doEmitSelect(!1),this.appRef.tick()}}onItemFocus(index){const element=this.listElementList.toArray()[index].nativeElement;element.classList.add("cds--list-box__menu-item--highlighted"),element.tabIndex=0}onItemBlur(index){const element=this.listElementList.toArray()[index].nativeElement;element.classList.remove("cds--list-box__menu-item--highlighted"),element.tabIndex=-1}emitScroll(event){const customScrollEvent={atTop:0===event.srcElement.scrollTop,atBottom:event.srcElement.scrollHeight-event.srcElement.scrollTop===event.srcElement.clientHeight,event};this.scroll.emit(customScrollEvent)}onItemsReady(subcription){(this._itemsReady||(0,of.of)(!0)).pipe((0,first.P)()).subscribe(subcription)}reorderSelected(moveFocus=!0){this.displayItems=[...this.getSelected(),...this.getListItems().filter((item=>!item.selected))],moveFocus&&setTimeout((()=>{this.updateIndex(),this.highlightedItem=this.getItemId(this.index)}))}};DropdownList.listCount=0,DropdownList.ctorParameters=()=>[{type:core.ElementRef},{type:i18n.oc},{type:core.ApplicationRef}],DropdownList.propDecorators={ariaLabel:[{type:core.Input}],items:[{type:core.Input}],listTpl:[{type:core.Input}],select:[{type:core.Output}],scroll:[{type:core.Output}],blurIntent:[{type:core.Output}],list:[{type:core.ViewChild,args:["list",{static:!0}]}],type:[{type:core.Input}],showTitles:[{type:core.Input}],listElementList:[{type:core.ViewChildren,args:["listItem"]}]},DropdownList=(0,tslib_es6.gn)([(0,core.Component)({selector:"cds-dropdown-list, ibm-dropdown-list",template:'\n\t\t<ul\n\t\t\t#list\n\t\t\t[id]="listId"\n\t\t\trole="listbox"\n\t\t\tclass="cds--list-box__menu cds--multi-select"\n\t\t\t(scroll)="emitScroll($event)"\n\t\t\t(keydown)="navigateList($event)"\n\t\t\ttabindex="-1"\n\t\t\t[attr.aria-label]="ariaLabel"\n\t\t\t[attr.aria-activedescendant]="highlightedItem">\n\t\t\t<li\n\t\t\t\trole="option"\n\t\t\t\t*ngFor="let item of displayItems; let i = index"\n\t\t\t\t(click)="doClick($event, item)"\n\t\t\t\tclass="cds--list-box__menu-item"\n\t\t\t\t[attr.aria-selected]="item.selected"\n\t\t\t\t[id]="getItemId(i)"\n\t\t\t\t[attr.title]=" showTitles ? item.content : null"\n\t\t\t\t[attr.disabled]="item.disabled ? true : null"\n\t\t\t\t[ngClass]="{\n\t\t\t\t\t\'cds--list-box__menu-item--active\': item.selected,\n\t\t\t\t\t\'cds--list-box__menu-item--highlighted\': highlightedItem === getItemId(i)\n\t\t\t\t}">\n\t\t\t\t<div\n\t\t\t\t\t#listItem\n\t\t\t\t\ttabindex="-1"\n\t\t\t\t\tclass="cds--list-box__menu-item__option">\n\t\t\t\t\t<div\n\t\t\t\t\t\t*ngIf="!listTpl && type === \'multi\'"\n\t\t\t\t\t\tclass="cds--form-item cds--checkbox-wrapper">\n\t\t\t\t\t\t<label\n\t\t\t\t\t\t\t[attr.data-contained-checkbox-state]="item.selected"\n\t\t\t\t\t\t\tclass="cds--checkbox-label">\n\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\tclass="cds--checkbox"\n\t\t\t\t\t\t\t\ttype="checkbox"\n\t\t\t\t\t\t\t\t[checked]="item.selected"\n\t\t\t\t\t\t\t\t[disabled]="item.disabled"\n\t\t\t\t\t\t\t\ttabindex="-1">\n\t\t\t\t\t\t\t<span class="cds--checkbox-appearance"></span>\n\t\t\t\t\t\t\t<span class="cds--checkbox-label-text">{{item.content}}</span>\n\t\t\t\t\t\t</label>\n\t\t\t\t\t</div>\n\t\t\t\t\t<ng-container *ngIf="!listTpl && type === \'single\'">{{item.content}}</ng-container>\n\t\t\t\t\t<svg\n\t\t\t\t\t\t*ngIf="!listTpl && type === \'single\'"\n\t\t\t\t\t\tcdsIcon="checkmark"\n\t\t\t\t\t\tsize="16"\n\t\t\t\t\t\tclass="cds--list-box__menu-item__selected-icon">\n\t\t\t\t\t</svg>\n\t\t\t\t\t<ng-template\n\t\t\t\t\t\t*ngIf="listTpl"\n\t\t\t\t\t\t[ngTemplateOutletContext]="{item: item}"\n\t\t\t\t\t\t[ngTemplateOutlet]="listTpl">\n\t\t\t\t\t</ng-template>\n\t\t\t\t</div>\n\t\t\t</li>\n\t\t</ul>',providers:[{provide:AbstractDropdownView,useExisting:DropdownList}]})],DropdownList);let ScrollableList=class ScrollableList{constructor(elementRef){this.elementRef=elementRef,this.nScrollableList=null,this.scrollEnabled=!0,this.scrollBy=10,this.canScrollUp=!1,this.canScrollDown=!1,this.list=this.elementRef.nativeElement}ngOnChanges(changes){changes.scrollEnabled&&(changes.scrollEnabled.currentValue?(this.list.style.overflow="hidden",this.scrollUpTarget.style.display="flex",this.scrollDownTarget.style.display="flex",this.canScrollUp=!0,this.canScrollDown=!0,this.updateScrollHeight(),this.checkScrollArrows(),setTimeout((()=>{this.checkScrollArrows()}))):(this.scrollUpTarget.style.display="none",this.scrollDownTarget.style.display="none",this.canScrollUp=!1,this.canScrollDown=!1,this.list.style.height=null,this.list.style.overflow=null,clearInterval(this.hoverScrollInterval)))}ngAfterViewInit(){this.nScrollableList&&(this.list=this.elementRef.nativeElement.querySelector(this.nScrollableList)),this.scrollUpTarget.addEventListener("mouseover",(()=>this.onHoverUp(!0))),this.scrollUpTarget.addEventListener("mouseout",(()=>this.onHoverUp(!1))),this.scrollDownTarget.addEventListener("mouseover",(()=>this.onHoverDown(!0))),this.scrollDownTarget.addEventListener("mouseout",(()=>this.onHoverDown(!1)))}updateScrollHeight(){if(this.scrollEnabled){const containerRect=this.elementRef.nativeElement.parentElement.getBoundingClientRect(),innerHeightDiff=this.list.getBoundingClientRect().top-containerRect.top,height=containerRect.height-(containerRect.bottom-window.innerHeight)-innerHeightDiff-40;this.list.style.height=`${height}px`}}checkScrollArrows(){const scrollUpHeight=this.scrollUpTarget.offsetHeight,scrollDownHeight=this.scrollDownTarget.offsetHeight;0===this.list.scrollTop?(this.canScrollUp&&(this.list.style.height=`${parseInt(this.list.style.height,10)+scrollUpHeight}px`),this.scrollUpTarget.style.display="none",this.canScrollUp=!1):this.list.scrollTop===this.list.scrollTopMax?(this.canScrollDown&&(this.list.style.height=`${parseInt(this.list.style.height,10)+scrollDownHeight}px`),this.scrollDownTarget.style.display="none",this.canScrollDown=!1):(this.canScrollUp||(this.list.style.height=parseInt(this.list.style.height,10)-scrollUpHeight+"px"),this.canScrollDown||(this.list.style.height=parseInt(this.list.style.height,10)-scrollDownHeight+"px"),this.scrollUpTarget.style.display="flex",this.scrollDownTarget.style.display="flex",this.canScrollUp=!0,this.canScrollDown=!0)}onWheel(event){event.deltaY<0?this.list.scrollTop-=this.scrollBy:this.list.scrollTop+=this.scrollBy,this.list.scrollTop!==this.list.scrollTopMax&&0!==this.list.scrollTop&&(event.preventDefault(),event.stopPropagation()),this.checkScrollArrows()}onTouchStart(event){event.touches[0]&&(this.lastTouch=event.touches[0].clientY)}onTouchMove(event){if(event.preventDefault(),event.stopPropagation(),event.touches[0]){const touch=event.touches[0];this.list.scrollTop+=this.lastTouch-touch.clientY,this.lastTouch=touch.clientY,this.checkScrollArrows()}}hoverScrollBy(hovering,amount){hovering?this.hoverScrollInterval=setInterval((()=>{this.list.scrollTop+=amount,this.checkScrollArrows()}),1):clearInterval(this.hoverScrollInterval)}onHoverUp(hovering){this.hoverScrollBy(hovering,-3)}onHoverDown(hovering){this.hoverScrollBy(hovering,3)}onKeyDown(event){"ArrowDown"!==event.key&&"ArrowUp"!==event.key||this.checkScrollArrows()}};ScrollableList.ctorParameters=()=>[{type:core.ElementRef}],ScrollableList.propDecorators={nScrollableList:[{type:core.Input}],scrollEnabled:[{type:core.Input}],scrollUpTarget:[{type:core.Input}],scrollDownTarget:[{type:core.Input}],scrollBy:[{type:core.Input}],onWheel:[{type:core.HostListener,args:["wheel",["$event"]]}],onTouchStart:[{type:core.HostListener,args:["touchstart",["$event"]]}],onTouchMove:[{type:core.HostListener,args:["touchmove",["$event"]]}],onKeyDown:[{type:core.HostListener,args:["keydown",["$event"]]}]},ScrollableList=(0,tslib_es6.gn)([(0,core.Directive)({selector:"[cdsScrollableList], [ibmScrollableList]",exportAs:"scrollable-list"})],ScrollableList);var common=__webpack_require__("./node_modules/@angular/common/fesm2020/common.mjs"),icon=__webpack_require__("./src/icon/index.ts");let DropdownModule=class DropdownModule{};DropdownModule=(0,tslib_es6.gn)([(0,core.NgModule)({declarations:[Dropdown,DropdownList,ScrollableList,AbstractDropdownView],exports:[Dropdown,DropdownList,ScrollableList,AbstractDropdownView],imports:[common.CommonModule,fesm2020_forms.u5,i18n.LU,placeholder.Qq,utils.As,icon.QX],providers:[DropdownService]})],DropdownModule)}}]);
|
|
1
|
+
"use strict";(self.webpackChunkcarbon_components_angular=self.webpackChunkcarbon_components_angular||[]).push([[3224],{"./src/dropdown/index.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{jq:()=>AbstractDropdownView,Lt:()=>Dropdown,kW:()=>DropdownModule,Vn:()=>DropdownService});var tslib_es6=__webpack_require__("./node_modules/tslib/tslib.es6.js"),core=__webpack_require__("./node_modules/@angular/core/fesm2020/core.mjs"),fesm2020_forms=__webpack_require__("./node_modules/@angular/forms/fesm2020/forms.mjs"),Subscription=__webpack_require__("./node_modules/rxjs/dist/esm5/internal/Subscription.js"),of=__webpack_require__("./node_modules/rxjs/dist/esm5/internal/observable/of.js");let AbstractDropdownView=class AbstractDropdownView{constructor(){this.type="single",this.size="md"}set items(value){}get items(){}getNextItem(){}hasNextElement(){}getNextElement(){}getPrevItem(){}hasPrevElement(){}getPrevElement(){}getSelected(){}getCurrentItem(){}getCurrentElement(){}getListItems(){}propagateSelected(value){}filterBy(value){}initFocus(){}onItemsReady(subcription){}reorderSelected(moveFocus){}};AbstractDropdownView.propDecorators={items:[{type:core.Input}],select:[{type:core.Output}],blurIntent:[{type:core.Output}]},AbstractDropdownView=(0,tslib_es6.gn)([(0,core.Directive)({selector:"[cdsAbstractDropdownView], [ibmAbstractDropdownView]"})],AbstractDropdownView);var i18n=__webpack_require__("./src/i18n/index.ts"),placeholder=__webpack_require__("./src/placeholder/index.ts"),utils_position=__webpack_require__("./node_modules/@carbon/utils-position/index.js"),utils=__webpack_require__("./src/utils/index.ts");const defaultOffset={top:0,left:0};let DropdownService=class DropdownService{constructor(placeholderService,animationFrameService){this.placeholderService=placeholderService,this.animationFrameService=animationFrameService,this.animationFrameSubscription=new Subscription.w0,this._offset=defaultOffset}set offset(value){this._offset=Object.assign({},defaultOffset,value)}get offset(){return this._offset}appendToBody(parentRef,menuRef,classList){menuRef.style.display="block";const dropdownWrapper=document.createElement("div");return dropdownWrapper.className=`dropdown ${classList}`,dropdownWrapper.style.width=parentRef.offsetWidth+"px",dropdownWrapper.style.position="absolute",dropdownWrapper.appendChild(menuRef),this.placeholderService.hasPlaceholderRef()?this.placeholderService.appendElement(dropdownWrapper):document.body.appendChild(dropdownWrapper),this.menuInstance=dropdownWrapper,this.animationFrameSubscription=this.animationFrameService.tick.subscribe((()=>{this.positionDropdown(parentRef,dropdownWrapper)})),this.positionDropdown(parentRef,dropdownWrapper),dropdownWrapper}appendToDropdown(hostRef){if(!this.menuInstance)return;const instance=this.menuInstance,menu=instance.firstElementChild;return this.menuInstance=null,menu.style.display="none",hostRef.appendChild(menu),this.animationFrameSubscription.unsubscribe(),this.placeholderService.hasPlaceholderRef()&&this.placeholderService.hasElement(instance)?this.placeholderService.removeElement(instance):document.body.contains(instance)&&document.body.removeChild(instance),instance}updatePosition(parentRef){this.positionDropdown(parentRef,this.menuInstance)}ngOnDestroy(){this.animationFrameSubscription.unsubscribe()}positionDropdown(parentRef,menuRef){if(!menuRef)return;let leftOffset=0;const boxMenu=menuRef.querySelector(".cds--list-box__menu");if(boxMenu)if(parentRef.getBoundingClientRect().left!==boxMenu.getBoundingClientRect().left){parentRef.getBoundingClientRect().left-boxMenu.getBoundingClientRect().left+boxMenu.getBoundingClientRect().right>(window.innerWidth||document.documentElement.clientWidth)&&(leftOffset=parentRef.offsetWidth-boxMenu.offsetWidth)}else boxMenu.getBoundingClientRect().right>(window.innerWidth||document.documentElement.clientWidth)&&(leftOffset=parentRef.offsetWidth-boxMenu.offsetWidth);const closestMenuWithPos=(0,utils._K)("position",["relative","fixed","absolute"],menuRef.parentElement),topPos=closestMenuWithPos?-1*closestMenuWithPos.getBoundingClientRect().top:this.offset.top,leftPos=closestMenuWithPos?-1*closestMenuWithPos.getBoundingClientRect().left:this.offset.left+leftOffset;let pos=utils_position.FK.findAbsolute(parentRef,menuRef,"bottom");pos=utils_position.FK.addOffset(pos,topPos,leftPos),utils_position.FK.setElement(menuRef,pos)}};DropdownService.ctorParameters=()=>[{type:placeholder.Q_},{type:utils.NV}],DropdownService=(0,tslib_es6.gn)([(0,core.Injectable)()],DropdownService);let Dropdown=class Dropdown{constructor(elementRef,i18n,dropdownService,elementService){this.elementRef=elementRef,this.i18n=i18n,this.dropdownService=dropdownService,this.elementService=elementService,this.id="dropdown-"+Dropdown.dropdownCount++,this.hideLabel=!1,this.placeholder="",this.displayValue="",this.clearText=this.i18n.get().DROPDOWN.CLEAR,this.size="md",this.type="single",this.theme="dark",this.disabled=!1,this.readonly=!1,this.skeleton=!1,this.inline=!1,this.disableArrowKeys=!1,this.invalid=!1,this.warn=!1,this.appendInline=null,this.selectionFeedback="top-after-reopen",this.menuButtonLabel=this.i18n.get().DROPDOWN.OPEN,this.selectedLabel=this.i18n.get().DROPDOWN.SELECTED,this.selected=new core.EventEmitter,this.onClose=new core.EventEmitter,this.close=new core.EventEmitter,this.hostClass=!0,this.hostWrapperClass=!0,this.fluid=!1,this.menuIsClosed=!0,this._dropUp=!1,this.noop=this._noop.bind(this),this.outsideClick=this._outsideClick.bind(this),this.outsideKey=this._outsideKey.bind(this),this.keyboardNav=this._keyboardNav.bind(this),this.visibilitySubscription=new Subscription.w0,this.onTouchedCallback=this._noop,this._isFocused=!1,this._writtenValue=[],this.propagateChange=_=>{}}get fluidInvalidClass(){return this.invalid&&this.fluid}get fluidFocusClass(){return this.fluid&&this._isFocused&&this.menuIsClosed}get writtenValue(){return this._writtenValue}set writtenValue(val){val&&0===val.length&&this.clearSelected(),this._writtenValue=val}ngOnInit(){this.view&&(this.view.type=this.type)}ngAfterContentInit(){if(!this.view)return;(this.writtenValue&&this.writtenValue.length||"number"==typeof this.writtenValue)&&this.writeValue(this.writtenValue),this.view.type=this.type,this.view.size=this.size;const isUpdate=event=>event&&event.isUpdate;this.view.select.subscribe((event=>{if("single"!==this.type||isUpdate(event)||Array.isArray(event)||(this.closeMenu(),event.item&&event.item.selected?this.itemValueKey?this.propagateChange(event.item[this.itemValueKey]):this.propagateChange(event.item):this.propagateChange(null)),"multi"===this.type&&!isUpdate(event))if(this.itemValueKey&&this.view.getSelected()){const values=this.view.getSelected().map((item=>item[this.itemValueKey]));this.propagateChange(values)}else this.propagateChange(this.view.getSelected());isUpdate(event)||(this.checkForReorder(),this.selected.emit(event))}))}ngAfterViewInit(){null===this.appendInline&&(0,utils.OQ)(this.elementRef.nativeElement)?this.appendInline=!1:null===this.appendInline&&(this.appendInline=!0),this.checkForReorder()}ngOnDestroy(){this.appendInline||this._appendToDropdown()}writeValue(value){this.writtenValue=value,this.view.onItemsReady((()=>{if(value)if("single"===this.type)if(this.itemValueKey){const newValue=Object.assign({},this.view.getListItems().find((item=>item[this.itemValueKey]===value)));newValue.selected=!0,this.view.propagateSelected([newValue])}else this.view.propagateSelected([value]);else if(this.itemValueKey){let newValues=[];for(const v of value)for(const item of this.view.getListItems())item[this.itemValueKey]===v&&newValues.push(Object.assign({},item,{selected:!0}));this.view.propagateSelected(newValues)}else this.view.propagateSelected(value);else this.view.propagateSelected([value]);this.checkForReorder()}))}onBlur(){this.onTouchedCallback()}registerOnChange(fn){this.propagateChange=fn}registerOnTouched(fn){this.onTouchedCallback=fn}setDisabledState(isDisabled){this.disabled=isDisabled}onKeyDown(event){if(!this.readonly){if("Escape"!==event.key||this.menuIsClosed||event.stopImmediatePropagation(),"Escape"===event.key)event.preventDefault(),this.closeMenu(),this.dropdownButton.nativeElement.focus();else if(this.menuIsClosed&&(" "===event.key||"ArrowDown"===event.key||"ArrowUp"===event.key)){if(this.disableArrowKeys&&("ArrowDown"===event.key||"ArrowUp"===event.key))return;event.preventDefault(),this.openMenu()}!this.menuIsClosed&&"Tab"===event.key&&this.dropdownMenu.nativeElement.contains(event.target)&&this.closeMenu(),!this.menuIsClosed&&"Tab"===event.key&&event.shiftKey&&this.closeMenu(),"multi"!==this.type&&this.menuIsClosed&&this.closedDropdownNavigation(event)}}closedDropdownNavigation(event){if("ArrowDown"===event.key){event.preventDefault(),this.view.getCurrentItem().selected=!1;let item=this.view.getNextItem();item&&(item.selected=!0)}else if("ArrowUp"===event.key){event.preventDefault(),this.view.getCurrentItem().selected=!1;let item=this.view.getPrevItem();item&&(item.selected=!0)}}getDisplayStringValue(){if(!this.view||this.skeleton)return;let selected=this.view.getSelected();return!selected.length||this.displayValue&&this.isRenderString()?selected.length&&this.isRenderString()?(0,of.of)(this.displayValue):(0,of.of)(this.placeholder):"multi"===this.type?(0,of.of)(this.placeholder):(0,of.of)(selected[0].content)}isRenderString(){return"string"==typeof this.displayValue}getRenderTemplateContext(){if(!this.view)return;let selected=this.view.getSelected();return"multi"===this.type?{items:selected}:selected&&selected.length>0?{item:selected[0]}:{}}getSelectedCount(){if(this.view.getSelected())return this.view.getSelected().length}clearSelected(){if(!this.disabled&&0!==this.getSelectedCount()){for(const item of this.view.getListItems())item.selected=!1;this.selected.emit([]),this.propagateChange([])}}valueSelected(){return!!this.view.getSelected()}_noop(){}_outsideClick(event){this.elementRef.nativeElement.contains(event.target)||this.dropdownMenu.nativeElement.contains(event.target)||this.closeMenu()}_outsideKey(event){!this.menuIsClosed&&"Tab"===event.key&&this.dropdownMenu.nativeElement.contains(event.target)&&this.closeMenu()}_keyboardNav(event){"Escape"!==event.key||this.menuIsClosed||event.stopImmediatePropagation(),"Escape"===event.key?(event.preventDefault(),this.closeMenu(),this.dropdownButton.nativeElement.focus()):this.menuIsClosed||"Tab"!==event.key||(this.dropdownButton.nativeElement.focus(),this.dropdownButton.nativeElement.dispatchEvent(new KeyboardEvent("keydown",{bubbles:!0,cancelable:!0,key:"Tab"})),this.closeMenu())}_appendToDropdown(){this.dropdownService.appendToDropdown(this.elementRef.nativeElement),this.dropdownMenu.nativeElement.removeEventListener("keydown",this.keyboardNav,!0)}_appendToBody(){const lightClass="light"===this.theme?" cds--list-box--light":"",expandedClass=this.menuIsClosed?"":" cds--list-box--expanded";this.dropdownService.appendToBody(this.dropdownButton.nativeElement,this.dropdownMenu.nativeElement,`${this.elementRef.nativeElement.className}${lightClass}${expandedClass}`),this.dropdownMenu.nativeElement.addEventListener("keydown",this.keyboardNav,!0)}_shouldDropUp(){const menu=this.dropdownMenu&&this.dropdownMenu.nativeElement.querySelector(".cds--list-box__menu"),menuRect=menu&&menu.getBoundingClientRect();if(menu&&menuRect){return(0,utils.O3)(menu).reduce(((shouldDropUp,parent)=>{const parentRect=parent.getBoundingClientRect(),isBelowParent=!(menuRect.bottom<=parentRect.bottom);return shouldDropUp||isBelowParent}),!1)}return!1}openMenu(){if(0!==this.view.getListItems().length){if(this._dropUp=!1,this.menuIsClosed=!1,!this.appendInline){const target=this.dropdownButton.nativeElement,parent=this.elementRef.nativeElement;this.visibilitySubscription=this.elementService.visibility(target,parent).subscribe((value=>{value.visible||this.closeMenu()})),this._appendToBody()}setTimeout((()=>{null!==this.dropUp&&void 0!==this.dropUp||(this._dropUp=this._shouldDropUp())}),0),document.body.firstElementChild.addEventListener("click",this.noop,!0),document.body.firstElementChild.addEventListener("keydown",this.noop,!0),document.addEventListener("click",this.outsideClick,!0),document.addEventListener("keydown",this.outsideKey,!0),setTimeout((()=>this.view.initFocus()),0)}}closeMenu(){this.menuIsClosed||(this.menuIsClosed=!0,this.checkForReorder(),this.onClose.emit(),this.close.emit(),this.dropdownButton.nativeElement.focus(),this.view.disableScroll&&this.view.disableScroll(),this.appendInline||(this.visibilitySubscription.unsubscribe(),this._appendToDropdown()),document.body.firstElementChild.removeEventListener("click",this.noop,!0),document.body.firstElementChild.removeEventListener("keydown",this.noop,!0),document.removeEventListener("click",this.outsideClick,!0),document.removeEventListener("keydown",this.outsideKey,!0))}toggleMenu(){this.menuIsClosed?this.openMenu():this.closeMenu()}isTemplate(value){return value instanceof core.TemplateRef}handleFocus(event){this._isFocused="focus"===event.type,"blur"===event.type&&this.onBlur()}checkForReorder(){const topAfterReopen=this.menuIsClosed&&"top-after-reopen"===this.selectionFeedback;"multi"!==this.type||!topAfterReopen&&"top"!==this.selectionFeedback||this.view.reorderSelected()}};Dropdown.dropdownCount=0,Dropdown.ctorParameters=()=>[{type:core.ElementRef},{type:i18n.oc},{type:DropdownService},{type:utils.d2}],Dropdown.propDecorators={fluidInvalidClass:[{type:core.HostBinding,args:["class.cds--list-box__wrapper--fluid--invalid"]}],fluidFocusClass:[{type:core.HostBinding,args:["class.cds--list-box__wrapper--fluid--focus"]}],id:[{type:core.Input}],label:[{type:core.Input}],hideLabel:[{type:core.Input}],helperText:[{type:core.Input}],placeholder:[{type:core.Input}],displayValue:[{type:core.Input}],clearText:[{type:core.Input}],size:[{type:core.Input}],type:[{type:core.Input}],theme:[{type:core.Input}],disabled:[{type:core.Input}],readonly:[{type:core.Input}],skeleton:[{type:core.Input}],inline:[{type:core.Input}],disableArrowKeys:[{type:core.Input}],invalid:[{type:core.Input}],invalidText:[{type:core.Input}],warn:[{type:core.Input}],warnText:[{type:core.Input}],appendInline:[{type:core.Input}],scrollableContainer:[{type:core.Input}],itemValueKey:[{type:core.Input}],selectionFeedback:[{type:core.Input}],menuButtonLabel:[{type:core.Input}],selectedLabel:[{type:core.Input}],dropUp:[{type:core.Input}],selected:[{type:core.Output}],onClose:[{type:core.Output}],close:[{type:core.Output}],view:[{type:core.ContentChild,args:[AbstractDropdownView,{static:!0}]}],dropdownButton:[{type:core.ViewChild,args:["dropdownButton",{static:!0}]}],dropdownMenu:[{type:core.ViewChild,args:["dropdownMenu",{static:!0}]}],hostClass:[{type:core.HostBinding,args:["class.cds--dropdown__wrapper"]}],hostWrapperClass:[{type:core.HostBinding,args:["class.cds--list-box__wrapper"]}],fluid:[{type:core.HostBinding,args:["class.cds--list-box__wrapper--fluid"]},{type:core.Input}],onKeyDown:[{type:core.HostListener,args:["keydown",["$event"]]}]},Dropdown=(0,tslib_es6.gn)([(0,core.Component)({selector:"cds-dropdown, ibm-dropdown",template:'\n\t<label\n\t\t*ngIf="label && !skeleton"\n\t\t[for]="id"\n\t\tclass="cds--label"\n\t\t[ngClass]="{\n\t\t\t\'cds--label--disabled\': disabled,\n\t\t\t\'cds--visually-hidden\': hideLabel\n\t\t}">\n\t\t<ng-container *ngIf="!isTemplate(label)">{{label}}</ng-container>\n\t\t<ng-template *ngIf="isTemplate(label)" [ngTemplateOutlet]="label"></ng-template>\n\t</label>\n\t<div\n\t\tclass="cds--list-box"\n\t\t[ngClass]="{\n\t\t\t\'cds--dropdown\': type !== \'multi\' && !(skeleton && fluid),\n\t\t\t\'cds--multiselect\': type === \'multi\',\n\t\t\t\'cds--multi-select--selected\': type === \'multi\' && getSelectedCount() > 0,\n\t\t\t\'cds--dropdown--light\': theme === \'light\',\n\t\t\t\'cds--list-box--light\': theme === \'light\',\n\t\t\t\'cds--list-box--inline\': inline,\n\t\t\t\'cds--skeleton\': skeleton,\n\t\t\t\'cds--dropdown--disabled cds--list-box--disabled\': disabled,\n\t\t\t\'cds--dropdown--readonly\': readonly,\n\t\t\t\'cds--dropdown--invalid\': invalid,\n\t\t\t\'cds--dropdown--warning cds--list-box--warning\': warn,\n\t\t\t\'cds--dropdown--sm cds--list-box--sm\': size === \'sm\',\n\t\t\t\'cds--dropdown--md cds--list-box--md\': size === \'md\',\n\t\t\t\'cds--dropdown--lg cds--list-box--lg\': size === \'lg\',\n\t\t\t\'cds--list-box--expanded\': !menuIsClosed,\n\t\t\t\'cds--list-box--invalid\': invalid\n\t\t}"\n\t\t[attr.data-invalid]="invalid ? true : null">\n\t\t<div *ngIf="skeleton && fluid" class="cds--list-box__label"></div>\n\t\t<button\n\t\t\t#dropdownButton\n\t\t\t[id]="id"\n\t\t\ttype="button"\n\t\t\tclass="cds--list-box__field"\n\t\t\t[ngClass]="{\'a\': !menuIsClosed}"\n\t\t\t[attr.aria-expanded]="!menuIsClosed"\n\t\t\t[attr.aria-disabled]="disabled"\n\t\t\taria-haspopup="listbox"\n\t\t\t(click)="disabled || readonly ? $event.stopPropagation() : toggleMenu()"\n\t\t\t(focus)="fluid ? handleFocus($event) : null"\n\t\t\t(blur)="fluid ? handleFocus($event) : onBlur()"\n\t\t\t[attr.disabled]="disabled ? true : null">\n\t\t\t<div\n\t\t\t\t(click)="clearSelected()"\n\t\t\t\t(keydown.enter)="clearSelected()"\n\t\t\t\t*ngIf="type === \'multi\' && getSelectedCount() > 0"\n\t\t\t\tclass="cds--list-box__selection cds--tag--filter cds--list-box__selection--multi"\n\t\t\t\ttabindex="0"\n\t\t\t\t[title]="clearText">\n\t\t\t\t{{getSelectedCount()}}\n\t\t\t\t<svg\n\t\t\t\t\tfocusable="false"\n\t\t\t\t\tpreserveAspectRatio="xMidYMid meet"\n\t\t\t\t\tstyle="will-change: transform;"\n\t\t\t\t\trole="img"\n\t\t\t\t\txmlns="http://www.w3.org/2000/svg"\n\t\t\t\t\twidth="16"\n\t\t\t\t\theight="16"\n\t\t\t\t\tviewBox="0 0 16 16"\n\t\t\t\t\taria-hidden="true">\n\t\t\t\t\t<path d="M12 4.7l-.7-.7L8 7.3 4.7 4l-.7.7L7.3 8 4 11.3l.7.7L8 8.7l3.3 3.3.7-.7L8.7 8z"></path>\n\t\t\t\t</svg>\n\t\t\t</div>\n\t\t\t<span *ngIf="isRenderString()" class="cds--list-box__label">{{getDisplayStringValue() | async}}</span>\n\t\t\t<ng-template\n\t\t\t\t*ngIf="!isRenderString()"\n\t\t\t\t[ngTemplateOutletContext]="getRenderTemplateContext()"\n\t\t\t\t[ngTemplateOutlet]="displayValue">\n\t\t\t</ng-template>\n\t\t\t<span class="cds--list-box__menu-icon">\n\t\t\t\t<svg\n\t\t\t\t\t*ngIf="!skeleton"\n\t\t\t\t\tcdsIcon="chevron--down"\n\t\t\t\t\tsize="16"\n\t\t\t\t\t[attr.aria-label]="menuButtonLabel"\n\t\t\t\t\t[ngClass]="{\'cds--list-box__menu-icon--open\': !menuIsClosed }">\n\t\t\t\t</svg>\n\t\t\t</span>\n\t\t</button>\n\t\t<svg\n\t\t\t*ngIf="invalid"\n\t\t\tclass="cds--list-box__invalid-icon"\n\t\t\tcdsIcon="warning--filled"\n\t\t\tsize="16">\n\t\t</svg>\n\t\t<svg\n\t\t\t*ngIf="!invalid && warn"\n\t\t\tcdsIcon="warning--alt--filled"\n\t\t\tsize="16"\n\t\t\tclass="cds--list-box__invalid-icon cds--list-box__invalid-icon--warning">\n\t\t</svg>\n\t\t<div\n\t\t\t#dropdownMenu\n\t\t\t[ngClass]="{\n\t\t\t\t\'cds--list-box--up\': this.dropUp !== null && this.dropUp !== undefined ? dropUp : _dropUp\n\t\t\t}">\n\t\t\t<ng-content *ngIf="!menuIsClosed"></ng-content>\n\t\t</div>\n\t</div>\n\t<hr *ngIf="fluid" class="cds--list-box__divider" />\n\t<div\n\t\t*ngIf="helperText && !invalid && !warn && !skeleton && !fluid"\n\t\tclass="cds--form__helper-text"\n\t\t[ngClass]="{\n\t\t\t\'cds--form__helper-text--disabled\': disabled\n\t\t}">\n\t\t<ng-container *ngIf="!isTemplate(helperText)">{{helperText}}</ng-container>\n\t\t<ng-template *ngIf="isTemplate(helperText)" [ngTemplateOutlet]="helperText"></ng-template>\n\t</div>\n\t<div *ngIf="invalid" class="cds--form-requirement">\n\t\t<ng-container *ngIf="!isTemplate(invalidText)">{{ invalidText }}</ng-container>\n\t\t<ng-template *ngIf="isTemplate(invalidText)" [ngTemplateOutlet]="invalidText"></ng-template>\n\t</div>\n\t<div *ngIf="!invalid && warn" class="cds--form-requirement">\n\t\t<ng-container *ngIf="!isTemplate(warnText)">{{warnText}}</ng-container>\n\t\t<ng-template *ngIf="isTemplate(warnText)" [ngTemplateOutlet]="warnText"></ng-template>\n\t</div>\n\t',providers:[{provide:fesm2020_forms.JU,useExisting:Dropdown,multi:!0}]})],Dropdown);var isObservable=__webpack_require__("./node_modules/rxjs/dist/esm5/internal/util/isObservable.js"),Observable=__webpack_require__("./node_modules/rxjs/dist/esm5/internal/Observable.js"),first=__webpack_require__("./node_modules/rxjs/dist/esm5/internal/operators/first.js"),fromEvent=__webpack_require__("./node_modules/rxjs/dist/esm5/internal/observable/fromEvent.js"),debounceTime=__webpack_require__("./node_modules/rxjs/dist/esm5/internal/operators/debounceTime.js"),map=__webpack_require__("./node_modules/rxjs/dist/esm5/internal/operators/map.js"),filter=__webpack_require__("./node_modules/rxjs/dist/esm5/internal/operators/filter.js");let DropdownList=class DropdownList{constructor(elementRef,i18n,appRef){this.elementRef=elementRef,this.i18n=i18n,this.appRef=appRef,this.ariaLabel=this.i18n.get().DROPDOWN_LIST.LABEL,this.listTpl=null,this.select=new core.EventEmitter,this.scroll=new core.EventEmitter,this.blurIntent=new core.EventEmitter,this.type="single",this.showTitles=!0,this.size="md",this.listId="listbox-"+DropdownList.listCount++,this.highlightedItem=null,this.displayItems=[],this.index=-1,this._items=[]}set items(value){(0,isObservable.b)(value)?(this._itemsSubscription&&this._itemsSubscription.unsubscribe(),this._itemsReady=new Observable.y((observer=>{this._itemsSubscription=value.subscribe((v=>{this.updateList(v),observer.next(!0),observer.complete()}))})),this.onItemsReady(null)):this.updateList(value),this._originalItems=value}get items(){return this._originalItems}ngAfterViewInit(){this.index=this.getListItems().findIndex((item=>item.selected)),this.setupFocusObservable(),setTimeout((()=>{this.doEmitSelect(!0)}))}ngOnDestroy(){this.focusJump&&this.focusJump.unsubscribe(),this._itemsSubscription&&this._itemsSubscription.unsubscribe()}doEmitSelect(isUpdate=!0){if("single"===this.type)this.select.emit({item:this._items.find((item=>item.selected)),isUpdate});else{const selected=this.getSelected()||[];selected.isUpdate=isUpdate,this.select.emit(selected)}}getItemId(index){return`${this.listId}-${index}`}updateList(items){this._items=items.map((item=>Object.assign({},item))),this.displayItems=this._items,this.updateIndex(),this.setupFocusObservable(),this.doEmitSelect()}filterBy(query=""){query?(this.displayItems=this.getListItems().filter((item=>item.content.toLowerCase().includes(query.toLowerCase()))),this.displayItems&&(this.index=0)):this.displayItems=this.getListItems(),this.updateIndex()}setupFocusObservable(){if(!this.list)return;this.focusJump&&this.focusJump.unsubscribe();let elList=Array.from(this.list.nativeElement.querySelectorAll("li"));this.focusJump=function watchFocusJump(target,elements){return(0,fromEvent.R)(target,"keydown").pipe((0,debounceTime.b)(150),(0,map.U)((ev=>{let el=elements.find((itemEl=>itemEl.textContent.trim().toLowerCase().startsWith(ev.key)));if(el)return el})),(0,filter.h)((el=>!!el)))}(this.list.nativeElement,elList).subscribe((el=>{el.focus()}))}getNextItem(){return this.index<this.displayItems.length-1&&this.index++,this.displayItems[this.index]}hasNextElement(){return this.index<this.displayItems.length-1&&(!(this.index===this.displayItems.length-2)||!this.displayItems[this.index+1].disabled)}getNextElement(){const elemList=this.listElementList?this.listElementList.toArray():[];if(!elemList.length)return null;for(let i=this.index+1;i<elemList.length;i++)if(!this.displayItems[i].disabled)return this.index=i,elemList[i].nativeElement;return elemList[this.index]?.nativeElement}getPrevItem(){return this.index>0&&this.index--,this.displayItems[this.index]}hasPrevElement(){return this.index>0&&(!(1===this.index)||!this.displayItems[0].disabled)}getPrevElement(){const elemList=this.listElementList?this.listElementList.toArray():[];if(!elemList.length)return null;for(let i=this.index-1;i<this.index&&i>=0;i--)if(!this.displayItems[i].disabled)return this.index=i,elemList[i].nativeElement;return elemList[this.index].nativeElement}getCurrentItem(){return this.index<0?this.displayItems[0]:this.displayItems[this.index]}getCurrentElement(){return this.index<0?this.listElementList.first.nativeElement:this.listElementList.toArray()[this.index].nativeElement}getListItems(){return this._items}getSelected(){let selected=this.getListItems().filter((item=>item.selected));return 0===selected.length?[]:selected}propagateSelected(value){Array.isArray(value)||console.error(`${this.constructor.name}.propagateSelected expects an Array<ListItem>, got ${JSON.stringify(value)}`),this.onItemsReady((()=>{const selectedNewItems=[];for(let newItem of value)if(newItem&&newItem.selected){let tempNewItem=Object.assign({},newItem);delete tempNewItem.selected,tempNewItem=JSON.stringify(tempNewItem),selectedNewItems.push(tempNewItem)}for(let oldItem of this.getListItems()){if(0===selectedNewItems.length){oldItem.selected=!1;continue}let tempOldItem=Object.assign({},oldItem);delete tempOldItem.selected,tempOldItem=JSON.stringify(tempOldItem);for(let selectedNewItem of selectedNewItems){if(tempOldItem.includes(selectedNewItem)){oldItem.selected=!0;break}oldItem.selected=!1}}}))}initFocus(){this.index<0&&this.updateIndex(),this.list.nativeElement.focus(),setTimeout((()=>{this.highlightedItem=this.getItemId(this.index)}))}updateIndex(){const selected=this.getSelected();selected.length?this.index=this.displayItems.indexOf(selected[0]):this.index<0&&this.hasNextElement()&&this.getNextElement()}navigateList(event){"Enter"===event.key||" "===event.key?(this.listElementList.some((option=>option.nativeElement===event.target))&&event.preventDefault(),"Enter"===event.key&&this.doClick(event,this.getCurrentItem())):"ArrowDown"!==event.key&&"ArrowUp"!==event.key||(event.preventDefault(),"ArrowDown"===event.key?this.hasNextElement()?this.getNextElement()?.scrollIntoView({block:"end"}):this.blurIntent.emit("bottom"):"ArrowUp"===event.key&&(this.hasPrevElement()?this.getPrevElement().scrollIntoView({block:"nearest"}):this.blurIntent.emit("top")),setTimeout((()=>{this.highlightedItem=this.getItemId(this.index)})))}doClick(event,item){if(event.preventDefault(),item&&!item.disabled){if(this.list.nativeElement.focus(),"single"===this.type){item.selected=!0;for(let otherItem of this.getListItems())item!==otherItem&&(otherItem.selected=!1)}else item.selected=!item.selected;this.index=this.displayItems.indexOf(item),this.highlightedItem=this.getItemId(this.index),this.doEmitSelect(!1),this.appRef.tick()}}onItemFocus(index){const element=this.listElementList.toArray()[index].nativeElement;element.classList.add("cds--list-box__menu-item--highlighted"),element.tabIndex=0}onItemBlur(index){const element=this.listElementList.toArray()[index].nativeElement;element.classList.remove("cds--list-box__menu-item--highlighted"),element.tabIndex=-1}emitScroll(event){const customScrollEvent={atTop:0===event.srcElement.scrollTop,atBottom:event.srcElement.scrollHeight-event.srcElement.scrollTop===event.srcElement.clientHeight,event};this.scroll.emit(customScrollEvent)}onItemsReady(subcription){(this._itemsReady||(0,of.of)(!0)).pipe((0,first.P)()).subscribe(subcription)}reorderSelected(moveFocus=!0){this.displayItems=[...this.getSelected(),...this.getListItems().filter((item=>!item.selected))],moveFocus&&setTimeout((()=>{this.updateIndex(),this.highlightedItem=this.getItemId(this.index)}))}};DropdownList.listCount=0,DropdownList.ctorParameters=()=>[{type:core.ElementRef},{type:i18n.oc},{type:core.ApplicationRef}],DropdownList.propDecorators={ariaLabel:[{type:core.Input}],items:[{type:core.Input}],listTpl:[{type:core.Input}],select:[{type:core.Output}],scroll:[{type:core.Output}],blurIntent:[{type:core.Output}],list:[{type:core.ViewChild,args:["list",{static:!0}]}],type:[{type:core.Input}],showTitles:[{type:core.Input}],listElementList:[{type:core.ViewChildren,args:["listItem"]}]},DropdownList=(0,tslib_es6.gn)([(0,core.Component)({selector:"cds-dropdown-list, ibm-dropdown-list",template:'\n\t\t<ul\n\t\t\t#list\n\t\t\t[id]="listId"\n\t\t\trole="listbox"\n\t\t\tclass="cds--list-box__menu cds--multi-select"\n\t\t\t(scroll)="emitScroll($event)"\n\t\t\t(keydown)="navigateList($event)"\n\t\t\ttabindex="0"\n\t\t\t[attr.aria-label]="ariaLabel"\n\t\t\t[attr.aria-activedescendant]="highlightedItem">\n\t\t\t<li\n\t\t\t\trole="option"\n\t\t\t\t*ngFor="let item of displayItems; let i = index"\n\t\t\t\t(click)="doClick($event, item)"\n\t\t\t\tclass="cds--list-box__menu-item"\n\t\t\t\t[attr.aria-selected]="item.selected"\n\t\t\t\t[id]="getItemId(i)"\n\t\t\t\t[attr.tabindex]="highlightedItem === getItemId(i) ? 0 : null"\n\t\t\t\t[attr.title]=" showTitles ? item.content : null"\n\t\t\t\t[attr.disabled]="item.disabled ? true : null"\n\t\t\t\t[ngClass]="{\n\t\t\t\t\t\'cds--list-box__menu-item--active\': item.selected,\n\t\t\t\t\t\'cds--list-box__menu-item--highlighted\': highlightedItem === getItemId(i)\n\t\t\t\t}">\n\t\t\t\t<div\n\t\t\t\t\t#listItem\n\t\t\t\t\ttabindex="-1"\n\t\t\t\t\tclass="cds--list-box__menu-item__option">\n\t\t\t\t\t<div\n\t\t\t\t\t\t*ngIf="!listTpl && type === \'multi\'"\n\t\t\t\t\t\tclass="cds--form-item cds--checkbox-wrapper">\n\t\t\t\t\t\t<label\n\t\t\t\t\t\t\t[attr.data-contained-checkbox-state]="item.selected"\n\t\t\t\t\t\t\tclass="cds--checkbox-label">\n\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\tclass="cds--checkbox"\n\t\t\t\t\t\t\t\ttype="checkbox"\n\t\t\t\t\t\t\t\t[checked]="item.selected"\n\t\t\t\t\t\t\t\t[disabled]="item.disabled"\n\t\t\t\t\t\t\t\ttabindex="-1">\n\t\t\t\t\t\t\t<span class="cds--checkbox-appearance"></span>\n\t\t\t\t\t\t\t<span class="cds--checkbox-label-text">{{item.content}}</span>\n\t\t\t\t\t\t</label>\n\t\t\t\t\t</div>\n\t\t\t\t\t<ng-container *ngIf="!listTpl && type === \'single\'">{{item.content}}</ng-container>\n\t\t\t\t\t<svg\n\t\t\t\t\t\t*ngIf="!listTpl && type === \'single\'"\n\t\t\t\t\t\tcdsIcon="checkmark"\n\t\t\t\t\t\tsize="16"\n\t\t\t\t\t\tclass="cds--list-box__menu-item__selected-icon">\n\t\t\t\t\t</svg>\n\t\t\t\t\t<ng-template\n\t\t\t\t\t\t*ngIf="listTpl"\n\t\t\t\t\t\t[ngTemplateOutletContext]="{item: item}"\n\t\t\t\t\t\t[ngTemplateOutlet]="listTpl">\n\t\t\t\t\t</ng-template>\n\t\t\t\t</div>\n\t\t\t</li>\n\t\t</ul>',providers:[{provide:AbstractDropdownView,useExisting:DropdownList}]})],DropdownList);let ScrollableList=class ScrollableList{constructor(elementRef){this.elementRef=elementRef,this.nScrollableList=null,this.scrollEnabled=!0,this.scrollBy=10,this.canScrollUp=!1,this.canScrollDown=!1,this.list=this.elementRef.nativeElement}ngOnChanges(changes){changes.scrollEnabled&&(changes.scrollEnabled.currentValue?(this.list.style.overflow="hidden",this.scrollUpTarget.style.display="flex",this.scrollDownTarget.style.display="flex",this.canScrollUp=!0,this.canScrollDown=!0,this.updateScrollHeight(),this.checkScrollArrows(),setTimeout((()=>{this.checkScrollArrows()}))):(this.scrollUpTarget.style.display="none",this.scrollDownTarget.style.display="none",this.canScrollUp=!1,this.canScrollDown=!1,this.list.style.height=null,this.list.style.overflow=null,clearInterval(this.hoverScrollInterval)))}ngAfterViewInit(){this.nScrollableList&&(this.list=this.elementRef.nativeElement.querySelector(this.nScrollableList)),this.scrollUpTarget.addEventListener("mouseover",(()=>this.onHoverUp(!0))),this.scrollUpTarget.addEventListener("mouseout",(()=>this.onHoverUp(!1))),this.scrollDownTarget.addEventListener("mouseover",(()=>this.onHoverDown(!0))),this.scrollDownTarget.addEventListener("mouseout",(()=>this.onHoverDown(!1)))}updateScrollHeight(){if(this.scrollEnabled){const containerRect=this.elementRef.nativeElement.parentElement.getBoundingClientRect(),innerHeightDiff=this.list.getBoundingClientRect().top-containerRect.top,height=containerRect.height-(containerRect.bottom-window.innerHeight)-innerHeightDiff-40;this.list.style.height=`${height}px`}}checkScrollArrows(){const scrollUpHeight=this.scrollUpTarget.offsetHeight,scrollDownHeight=this.scrollDownTarget.offsetHeight;0===this.list.scrollTop?(this.canScrollUp&&(this.list.style.height=`${parseInt(this.list.style.height,10)+scrollUpHeight}px`),this.scrollUpTarget.style.display="none",this.canScrollUp=!1):this.list.scrollTop===this.list.scrollTopMax?(this.canScrollDown&&(this.list.style.height=`${parseInt(this.list.style.height,10)+scrollDownHeight}px`),this.scrollDownTarget.style.display="none",this.canScrollDown=!1):(this.canScrollUp||(this.list.style.height=parseInt(this.list.style.height,10)-scrollUpHeight+"px"),this.canScrollDown||(this.list.style.height=parseInt(this.list.style.height,10)-scrollDownHeight+"px"),this.scrollUpTarget.style.display="flex",this.scrollDownTarget.style.display="flex",this.canScrollUp=!0,this.canScrollDown=!0)}onWheel(event){event.deltaY<0?this.list.scrollTop-=this.scrollBy:this.list.scrollTop+=this.scrollBy,this.list.scrollTop!==this.list.scrollTopMax&&0!==this.list.scrollTop&&(event.preventDefault(),event.stopPropagation()),this.checkScrollArrows()}onTouchStart(event){event.touches[0]&&(this.lastTouch=event.touches[0].clientY)}onTouchMove(event){if(event.preventDefault(),event.stopPropagation(),event.touches[0]){const touch=event.touches[0];this.list.scrollTop+=this.lastTouch-touch.clientY,this.lastTouch=touch.clientY,this.checkScrollArrows()}}hoverScrollBy(hovering,amount){hovering?this.hoverScrollInterval=setInterval((()=>{this.list.scrollTop+=amount,this.checkScrollArrows()}),1):clearInterval(this.hoverScrollInterval)}onHoverUp(hovering){this.hoverScrollBy(hovering,-3)}onHoverDown(hovering){this.hoverScrollBy(hovering,3)}onKeyDown(event){"ArrowDown"!==event.key&&"ArrowUp"!==event.key||this.checkScrollArrows()}};ScrollableList.ctorParameters=()=>[{type:core.ElementRef}],ScrollableList.propDecorators={nScrollableList:[{type:core.Input}],scrollEnabled:[{type:core.Input}],scrollUpTarget:[{type:core.Input}],scrollDownTarget:[{type:core.Input}],scrollBy:[{type:core.Input}],onWheel:[{type:core.HostListener,args:["wheel",["$event"]]}],onTouchStart:[{type:core.HostListener,args:["touchstart",["$event"]]}],onTouchMove:[{type:core.HostListener,args:["touchmove",["$event"]]}],onKeyDown:[{type:core.HostListener,args:["keydown",["$event"]]}]},ScrollableList=(0,tslib_es6.gn)([(0,core.Directive)({selector:"[cdsScrollableList], [ibmScrollableList]",exportAs:"scrollable-list"})],ScrollableList);var common=__webpack_require__("./node_modules/@angular/common/fesm2020/common.mjs"),icon=__webpack_require__("./src/icon/index.ts");let DropdownModule=class DropdownModule{};DropdownModule=(0,tslib_es6.gn)([(0,core.NgModule)({declarations:[Dropdown,DropdownList,ScrollableList,AbstractDropdownView],exports:[Dropdown,DropdownList,ScrollableList,AbstractDropdownView],imports:[common.CommonModule,fesm2020_forms.u5,i18n.LU,placeholder.Qq,utils.As,icon.QX],providers:[DropdownService]})],DropdownModule)}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkcarbon_components_angular=self.webpackChunkcarbon_components_angular||[]).push([[901],{"./src/link/index.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{rU:()=>Link,LO:()=>LinkModule});var tslib_es6=__webpack_require__("./node_modules/tslib/tslib.es6.js"),core=__webpack_require__("./node_modules/@angular/core/fesm2020/core.mjs");let Link=class Link{constructor(){this.baseClass=!0,this.inline=!1}set disabled(disabled){this._disabled=disabled,this.tabindex=this.disabled?-1:null}get disabled(){return this._disabled}};Link.propDecorators={baseClass:[{type:core.HostBinding,args:["class.cds--link"]}],tabindex:[{type:core.HostBinding,args:["attr.tabindex"]}],inline:[{type:core.Input},{type:core.HostBinding,args:["class.cds--link--inline"]}],disabled:[{type:core.Input},{type:core.HostBinding,args:["attr.aria-disabled"]},{type:core.HostBinding,args:["class.cds--link--disabled"]}]},Link=(0,tslib_es6.gn)([(0,core.Directive)({selector:"[cdsLink], [ibmLink]"})],Link);let LinkIconDirective=class LinkIconDirective{constructor(){this.iconClass=!0}};LinkIconDirective.propDecorators={iconClass:[{type:core.HostBinding,args:["class.cds--link__icon"]}]},LinkIconDirective=(0,tslib_es6.gn)([(0,core.Directive)({selector:"[ibmLinkIcon], [cdsLinkIcon]"})],LinkIconDirective);var common=__webpack_require__("./node_modules/@angular/common/fesm2020/common.mjs");let LinkModule=class LinkModule{};LinkModule=(0,tslib_es6.gn)([(0,core.NgModule)({declarations:[Link,LinkIconDirective],exports:[Link,LinkIconDirective],imports:[common.CommonModule]})],LinkModule)},"./src/notification/index.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Yj:()=>BaseNotification,PQ:()=>NotificationModule,gq:()=>NotificationService});var tslib_es6=__webpack_require__("./node_modules/tslib/tslib.es6.js"),core=__webpack_require__("./node_modules/@angular/core/fesm2020/core.mjs");let ActionableButton=class ActionableButton{constructor(){this.actionableButton=!0,this.type="button"}};ActionableButton.propDecorators={actionableButton:[{type:core.HostBinding,args:["class.cds--actionable-notification__action-button"]}],type:[{type:core.HostBinding,args:["attr.type"]}]},ActionableButton=(0,tslib_es6.gn)([(0,core.Directive)({selector:"[cdsActionableButton], [ibmActionableButton]"})],ActionableButton);let ActionableSubtitle=class ActionableSubtitle{constructor(){this.baseClass=!0}};ActionableSubtitle.propDecorators={baseClass:[{type:core.HostBinding,args:["class.cds--actionable-notification__subtitle"]}]},ActionableSubtitle=(0,tslib_es6.gn)([(0,core.Directive)({selector:"[cdsActionableSubtitle], [ibmActionableSubtitle]"})],ActionableSubtitle);let ActionableTitle=class ActionableTitle{constructor(){this.baseClass=!0}};ActionableTitle.propDecorators={baseClass:[{type:core.HostBinding,args:["class.cds--actionable-notification__title"]}]},ActionableTitle=(0,tslib_es6.gn)([(0,core.Directive)({selector:"[cdsActionableTitle], [ibmActionableTitle]"})],ActionableTitle);var isObservable=__webpack_require__("./node_modules/rxjs/dist/esm5/internal/util/isObservable.js"),of=__webpack_require__("./node_modules/rxjs/dist/esm5/internal/observable/of.js"),i18n=__webpack_require__("./src/i18n/index.ts");let NotificationDisplayService=class NotificationDisplayService{constructor(applicationRef){this.applicationRef=applicationRef}close(notificationRef){notificationRef.hostView&&setTimeout((()=>{this.applicationRef.detachView(notificationRef.hostView),notificationRef.destroy()}),200)}};NotificationDisplayService.ctorParameters=()=>[{type:core.ApplicationRef}],NotificationDisplayService=(0,tslib_es6.gn)([(0,core.Injectable)()],NotificationDisplayService);let BaseNotification=class BaseNotification{constructor(notificationDisplayService,i18n){this.notificationDisplayService=notificationDisplayService,this.i18n=i18n,this.close=new core.EventEmitter,this.iconDictionary={error:"error--filled",info:"information--filled","info-square":"information--square--filled",success:"checkmark--filled",warning:"warning--filled","warning-alt":"warning--alt--filled"},this.defaultNotificationObj={title:"",message:"",type:"info",showClose:!0,closeLabel:this.i18n.get("NOTIFICATION.CLOSE_BUTTON"),role:"status"},this._notificationObj=Object.assign({},this.defaultNotificationObj)}get roleAttr(){return this._notificationObj.role}onClose(){this.close.emit()}onClick(action,event){action.click&&((0,isObservable.b)(action.click)?action.click.next({event,action}):action.click({event,action}))}destroy(){this.notificationDisplayService.close(this)}};BaseNotification.ctorParameters=()=>[{type:NotificationDisplayService},{type:i18n.oc}],BaseNotification.propDecorators={roleAttr:[{type:core.HostBinding,args:["attr.role"]}],close:[{type:core.Output}]},BaseNotification=(0,tslib_es6.gn)([(0,core.Component)({template:""})],BaseNotification);let ActionableNotification=class ActionableNotification extends BaseNotification{constructor(notificationDisplayService,i18n){super(notificationDisplayService,i18n),this.notificationDisplayService=notificationDisplayService,this.i18n=i18n,this.notificationID="actionable-notification-"+ActionableNotification.notificationCount++,this.notificationLabel=this.notificationID,this.notificationClass=!0,this.defaultNotificationObj={...this.defaultNotificationObj,variant:"inline",role:"alertdialog"}}get notificationObj(){return this._notificationObj}set notificationObj(obj){obj.closeLabel&&!(0,isObservable.b)(obj.closeLabel)&&(obj.closeLabel=(0,of.of)(obj.closeLabel)),this._notificationObj=Object.assign({},this.defaultNotificationObj,obj)}get toastVariant(){return"toast"===this.notificationObj.variant}get isError(){return"error"===this.notificationObj.type}get isInfo(){return"info"===this.notificationObj.type}get isInfoSquare(){return"info-square"===this.notificationObj.type}get isSuccess(){return"success"===this.notificationObj.type}get isWarning(){return"warning"===this.notificationObj.type}get isWarningAlt(){return"warning-alt"===this.notificationObj.type}get isLowContrast(){return this.notificationObj.lowContrast}get isCloseHidden(){return!this._notificationObj.showClose}};ActionableNotification.notificationCount=0,ActionableNotification.ctorParameters=()=>[{type:NotificationDisplayService},{type:i18n.oc}],ActionableNotification.propDecorators={notificationObj:[{type:core.Input}],notificationLabel:[{type:core.HostBinding,args:["attr.aria-labelledBy"]}],notificationClass:[{type:core.HostBinding,args:["class.cds--actionable-notification"]}],toastVariant:[{type:core.HostBinding,args:["class.cds--actionable-notification--toast"]}],isError:[{type:core.HostBinding,args:["class.cds--actionable-notification--error"]}],isInfo:[{type:core.HostBinding,args:["class.cds--actionable-notification--info"]}],isInfoSquare:[{type:core.HostBinding,args:["class.cds--actionable-notification--info-square"]}],isSuccess:[{type:core.HostBinding,args:["class.cds--actionable-notification--success"]}],isWarning:[{type:core.HostBinding,args:["class.cds--actionable-notification--warning"]}],isWarningAlt:[{type:core.HostBinding,args:["class.cds--actionable-notification--warning-alt"]}],isLowContrast:[{type:core.HostBinding,args:["class.cds--actionable-notification--low-contrast"]}],isCloseHidden:[{type:core.HostBinding,args:["class.cds--actionable-notification--hide-close-button"]}]},ActionableNotification=(0,tslib_es6.gn)([(0,core.Component)({selector:"cds-actionable-notification, ibm-actionable-notification",template:'\n\t\t<div class="cds--actionable-notification__details">\n\t\t\t<svg\n\t\t\t\t[cdsIcon]="iconDictionary[notificationObj.type]"\n\t\t\t\tsize="20"\n\t\t\t\t*ngIf="notificationObj.type"\n\t\t\t\t[ngClass]="{\n\t\t\t\t\t\'cds--inline-notification__icon\': notificationObj.variant === \'inline\',\n\t\t\t\t\t\'cds--toast-notification__icon\': notificationObj.variant === \'toast\'\n\t\t\t\t}"\n\t\t\t\tclass="cds--actionable-notification__icon">\n\t\t\t</svg>\n\t\t\t<div class="cds--actionable-notification__text-wrapper">\n\t\t\t\t<div class="cds--actionable-notification__content">\n\t\t\t\t\t<div\n\t\t\t\t\t\tcdsActionableTitle\n\t\t\t\t\t\t*ngIf="!notificationObj.template"\n\t\t\t\t\t\t[id]="notificationID"\n\t\t\t\t\t\t[innerHTML]="notificationObj.title">\n\t\t\t\t\t</div>\n\t\t\t\t\t<div *ngIf="!notificationObj.template" cdsActionableSubtitle>\n\t\t\t\t\t\t<span [innerHTML]="notificationObj.message"></span>\n\t\t\t\t\t\t<ng-container *ngFor="let link of notificationObj.links">\n\t\t\t\t\t\t\t<a cdsLink [href]="link.href">{{link.text}}</a>\n\t\t\t\t\t\t</ng-container>\n\t\t\t\t\t</div>\n\t\t\t\t\t<ng-container *ngTemplateOutlet="notificationObj.template; context: { $implicit: notificationObj }"></ng-container>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t\t<ng-container *ngIf="!notificationObj.actionsTemplate">\n\t\t\t<button\n\t\t\t\t*ngFor="let action of notificationObj.actions"\n\t\t\t\t(click)="onClick(action, $event)"\n\t\t\t\t[cdsButton]="notificationObj.variant === \'inline\' ? \'ghost\' : \'tertiary\'"\n\t\t\t\tsize="sm"\n\t\t\t\tcdsActionableButton>\n\t\t\t\t{{action.text}}\n\t\t\t</button>\n\t\t</ng-container>\n\t\t<ng-container *ngTemplateOutlet="notificationObj.actionsTemplate; context: { $implicit: notificationObj }"></ng-container>\n\t\t<button\n\t\t\t*ngIf="!isCloseHidden"\n\t\t\t(click)="onClose()"\n\t\t\tclass="cds--actionable-notification__close-button"\n\t\t\t[attr.aria-label]="notificationObj.closeLabel | async"\n\t\t\ttype="button">\n\t\t\t<svg cdsIcon="close" size="16" class="cds--actionable-notification__close-icon"></svg>\n\t\t</button>\n\t'})],ActionableNotification);let NotificationSubtitle=class NotificationSubtitle{constructor(){this.baseClass=!0}};NotificationSubtitle.propDecorators={baseClass:[{type:core.HostBinding,args:["class.cds--inline-notification__subtitle"]}]},NotificationSubtitle=(0,tslib_es6.gn)([(0,core.Directive)({selector:"[cdsNotificationSubtitle], [ibmNotificationSubtitle]"})],NotificationSubtitle);let NotificationTitle=class NotificationTitle{constructor(){this.baseClass=!0}};NotificationTitle.propDecorators={baseClass:[{type:core.HostBinding,args:["class.cds--inline-notification__title"]}]},NotificationTitle=(0,tslib_es6.gn)([(0,core.Directive)({selector:"[cdsNotificationTitle], [ibmNotificationTitle]"})],NotificationTitle);let Notification=class Notification extends BaseNotification{constructor(notificationDisplayService,i18n){super(notificationDisplayService,i18n),this.notificationDisplayService=notificationDisplayService,this.i18n=i18n,this.notificationID="notification-"+Notification.notificationCount++,this.notificationLabel=this.notificationID,this.notificationClass=!0}get notificationObj(){return this._notificationObj}set notificationObj(obj){obj.closeLabel&&!(0,isObservable.b)(obj.closeLabel)&&(obj.closeLabel=(0,of.of)(obj.closeLabel)),this._notificationObj=Object.assign({},this.defaultNotificationObj,obj)}get isError(){return"error"===this.notificationObj.type}get isInfo(){return"info"===this.notificationObj.type}get isInfoSquare(){return"info-square"===this.notificationObj.type}get isSuccess(){return"success"===this.notificationObj.type}get isWarning(){return"warning"===this.notificationObj.type}get isWarningAlt(){return"warning-alt"===this.notificationObj.type}get isLowContrast(){return this.notificationObj.lowContrast}get isCloseHidden(){return!this.notificationObj.showClose}};Notification.notificationCount=0,Notification.ctorParameters=()=>[{type:NotificationDisplayService},{type:i18n.oc}],Notification.propDecorators={notificationObj:[{type:core.Input}],notificationLabel:[{type:core.HostBinding,args:["attr.aria-labelledBy"]}],notificationClass:[{type:core.HostBinding,args:["class.cds--inline-notification"]}],isError:[{type:core.HostBinding,args:["class.cds--inline-notification--error"]}],isInfo:[{type:core.HostBinding,args:["class.cds--inline-notification--info"]}],isInfoSquare:[{type:core.HostBinding,args:["class.cds--inline-notification--info-square"]}],isSuccess:[{type:core.HostBinding,args:["class.cds--inline-notification--success"]}],isWarning:[{type:core.HostBinding,args:["class.cds--inline-notification--warning"]}],isWarningAlt:[{type:core.HostBinding,args:["class.cds--inline-notification--warning-alt"]}],isLowContrast:[{type:core.HostBinding,args:["class.cds--inline-notification--low-contrast"]}],isCloseHidden:[{type:core.HostBinding,args:["class.cds--inline-notification--hide-close-button"]}]},Notification=(0,tslib_es6.gn)([(0,core.Component)({selector:"cds-notification, cds-inline-notification, ibm-notification, ibm-inline-notification",template:'\n\t\t<div class="cds--inline-notification__details">\n\t\t\t<svg\n\t\t\t\t[cdsIcon]="iconDictionary[notificationObj.type]"\n\t\t\t\tsize="20"\n\t\t\t\t*ngIf="notificationObj.type"\n\t\t\t\tclass="cds--inline-notification__icon">\n\t\t\t</svg>\n\t\t\t<div class="cds--inline-notification__text-wrapper">\n\t\t\t\t<div\n\t\t\t\t\tcdsNotificationTitle\n\t\t\t\t\t*ngIf="!notificationObj.template"\n\t\t\t\t\t[innerHTML]="notificationObj.title"\n\t\t\t\t\t[id]="notificationID">\n\t\t\t\t</div>\n\t\t\t\t<div *ngIf="!notificationObj.template" cdsNotificationSubtitle>\n\t\t\t\t\t<span [innerHTML]="notificationObj.message"></span>\n\t\t\t\t</div>\n\t\t\t\t<ng-container *ngTemplateOutlet="notificationObj.template; context: { $implicit: notificationObj}"></ng-container>\n\t\t\t</div>\n\t\t</div>\n\t\t<button\n\t\t\t*ngIf="!isCloseHidden"\n\t\t\t(click)="onClose()"\n\t\t\tclass="cds--inline-notification__close-button"\n\t\t\t[attr.aria-label]="notificationObj.closeLabel | async"\n\t\t\ttype="button">\n\t\t\t<svg cdsIcon="close" size="16" class="cds--inline-notification__close-icon"></svg>\n\t\t</button>\n\t'})],Notification);var src_button=__webpack_require__("./src/button/index.ts"),common=__webpack_require__("./node_modules/@angular/common/fesm2020/common.mjs");let Toast=class Toast extends BaseNotification{constructor(notificationDisplayService,i18n){super(notificationDisplayService,i18n),this.notificationDisplayService=notificationDisplayService,this.i18n=i18n,this.toastID="toast-"+Toast.toastCount++,this.toastClass=!0}set notificationObj(obj){obj.closeLabel&&!(0,isObservable.b)(obj.closeLabel)&&(obj.closeLabel=(0,of.of)(obj.closeLabel)),this._notificationObj=Object.assign({},this.defaultNotificationObj,obj)}get notificationObj(){return this._notificationObj}get isError(){return"error"===this.notificationObj.type}get isInfo(){return"info"===this.notificationObj.type}get isInfoSquare(){return"info-square"===this.notificationObj.type}get isSuccess(){return"success"===this.notificationObj.type}get isWarning(){return"warning"===this.notificationObj.type}get isWarningAlt(){return"warning-alt"===this.notificationObj.type}get isLowContrast(){return this.notificationObj.lowContrast}get isCloseHidden(){return!this.notificationObj.showClose}ngOnInit(){this.notificationObj.closeLabel||(this.notificationObj.closeLabel=this.i18n.get().NOTIFICATION.CLOSE_BUTTON)}};Toast.toastCount=0,Toast.ctorParameters=()=>[{type:NotificationDisplayService},{type:i18n.oc}],Toast.propDecorators={notificationObj:[{type:core.Input}],toastID:[{type:core.HostBinding,args:["attr.id"]}],toastClass:[{type:core.HostBinding,args:["class.cds--toast-notification"]}],isError:[{type:core.HostBinding,args:["class.cds--toast-notification--error"]}],isInfo:[{type:core.HostBinding,args:["class.cds--toast-notification--info"]}],isInfoSquare:[{type:core.HostBinding,args:["class.cds--toast-notification--info-square"]}],isSuccess:[{type:core.HostBinding,args:["class.cds--toast-notification--success"]}],isWarning:[{type:core.HostBinding,args:["class.cds--toast-notification--warning"]}],isWarningAlt:[{type:core.HostBinding,args:["class.cds--toast-notification--warning-alt"]}],isLowContrast:[{type:core.HostBinding,args:["class.cds--toast-notification--low-contrast"]}],isCloseHidden:[{type:core.HostBinding,args:["class.cds--toast-notification--hide-close-button"]}]},Toast=(0,tslib_es6.gn)([(0,core.Component)({selector:"cds-toast, ibm-toast",template:'\n\t\t<svg\n\t\t\t[cdsIcon]="iconDictionary[notificationObj.type]"\n\t\t\tsize="20"\n\t\t\t*ngIf="notificationObj.type"\n\t\t\tclass="cds--toast-notification__icon">\n\t\t</svg>\n\t\t<div class="cds--toast-notification__details">\n\t\t\t<h3 *ngIf="!notificationObj.template" cdsToastTitle [innerHTML]="notificationObj.title"></h3>\n\t\t\t<div *ngIf="!notificationObj.template" cdsToastSubtitle>\n\t\t\t\t<span [innerHTML]="notificationObj.subtitle"></span>\n\t\t\t</div>\n\t\t\t<p *ngIf="!notificationObj.template" cdsToastCaption [innerHTML]="notificationObj.caption"></p>\n\t\t\t<ng-container *ngTemplateOutlet="notificationObj.template; context: { $implicit: notificationObj }"></ng-container>\n\t\t</div>\n\t\t<button\n\t\t\t*ngIf="!isCloseHidden"\n\t\t\tclass="cds--toast-notification__close-button"\n\t\t\ttype="button"\n\t\t\t[attr.aria-label]="notificationObj.closeLabel | async"\n\t\t\t(click)="onClose()">\n\t\t\t<svg cdsIcon="close" size="16" class="cds--toast-notification__close-icon"></svg>\n\t\t</button>\n\t'})],Toast);let ToastTitle=class ToastTitle{constructor(){this.baseClass=!0}};ToastTitle.propDecorators={baseClass:[{type:core.HostBinding,args:["class.cds--toast-notification__title"]}]},ToastTitle=(0,tslib_es6.gn)([(0,core.Directive)({selector:"[cdsToastTitle], [ibmToastTitle]"})],ToastTitle);let ToastSubtitle=class ToastSubtitle{constructor(){this.baseClass=!0}};ToastSubtitle.propDecorators={baseClass:[{type:core.HostBinding,args:["class.cds--toast-notification__subtitle"]}]},ToastSubtitle=(0,tslib_es6.gn)([(0,core.Directive)({selector:"[cdsToastSubtitle], [ibmToastSubtitle]"})],ToastSubtitle);let ToastCaption=class ToastCaption{constructor(){this.baseClass=!0}};ToastCaption.propDecorators={baseClass:[{type:core.HostBinding,args:["class.cds--toast-notification__caption"]}]},ToastCaption=(0,tslib_es6.gn)([(0,core.Directive)({selector:"[cdsToastCaption], [ibmToastCaption]"})],ToastCaption);let NotificationService=class NotificationService{constructor(injector,viewContainer,ngZone){this.injector=injector,this.viewContainer=viewContainer,this.ngZone=ngZone,this.notificationRefs=new Array,this.onClose=new core.EventEmitter}showNotification(notificationObj,notificationComp=Notification){const notificationRef=this.viewContainer.createComponent(notificationComp);if(notificationRef.instance.notificationObj=notificationObj,this.notificationRefs.push(notificationRef),this.onClose=notificationRef.instance.close,notificationObj.target)document.querySelector(notificationObj.target).appendChild(notificationRef.location.nativeElement);else{let body=document.querySelector("body"),notificationClassName="notification-overlay",notificationList=body.querySelector(`.${notificationClassName}`);notificationList||(notificationList=document.createElement("div"),notificationList.className=notificationClassName,body.appendChild(notificationList)),notificationList.firstChild?notificationList.insertBefore(notificationRef.location.nativeElement,notificationList.firstChild):notificationList.appendChild(notificationRef.location.nativeElement)}return notificationObj.duration&¬ificationObj.duration>0&&this.ngZone.runOutsideAngular((()=>{setTimeout((()=>{this.ngZone.run((()=>{this.close(notificationRef)}))}),notificationObj.duration)})),notificationObj.smart&&this.ngZone.runOutsideAngular((()=>{setTimeout((()=>{this.ngZone.run((()=>{this.close(notificationRef)}))}),this.getSmartTimeout(notificationObj))})),this.onClose.subscribe((()=>{this.close(notificationRef)})),notificationRef.instance.componentRef=notificationRef,notificationRef.instance}showToast(notificationObj,notificationComp=Toast){return this.showNotification(notificationObj,notificationComp)}showActionable(notificationObj,notificationComp=ActionableNotification){return this.showNotification(notificationObj,notificationComp)}close(notificationRef){if(notificationRef)if(notificationRef instanceof Notification)this.close(notificationRef.componentRef);else{notificationRef.destroy();const index=this.notificationRefs.indexOf(notificationRef);-1!==index&&this.notificationRefs.splice(index,1)}}getSmartTimeout(notificationObj){let timeout=600;switch(timeout+=notificationObj.duration||0,notificationObj.type){case"info":case"info-square":case"success":default:break;case"danger":timeout+=3e3;break;case"warning":case"warning-alt":timeout+=1500}return timeout+=450*notificationObj.message.trim().split(/\s+/).length,timeout}ngOnDestroy(){this.notificationRefs.forEach((ref=>{ref.destroy()}))}};NotificationService.ctorParameters=()=>[{type:core.Injector},{type:core.ViewContainerRef},{type:core.NgZone}],NotificationService=(0,tslib_es6.gn)([(0,core.Injectable)()],NotificationService);var experimental=__webpack_require__("./src/experimental/index.ts"),src_link=__webpack_require__("./src/link/index.ts"),icon=__webpack_require__("./src/icon/index.ts");let NotificationModule=class NotificationModule{};NotificationModule=(0,tslib_es6.gn)([(0,core.NgModule)({declarations:[ActionableButton,ActionableNotification,ActionableTitle,ActionableSubtitle,BaseNotification,Notification,Toast,ToastTitle,ToastSubtitle,ToastCaption,NotificationTitle,NotificationSubtitle],exports:[Notification,ActionableButton,ActionableNotification,ActionableTitle,ActionableSubtitle,Toast,ToastTitle,ToastSubtitle,ToastCaption,NotificationTitle,NotificationSubtitle],imports:[src_button.hJ,common.CommonModule,i18n.LU,experimental.OV,src_link.LO,icon.QX],providers:[NotificationService,NotificationDisplayService]})],NotificationModule)}}]);
|
|
@@ -348,8 +348,8 @@
|
|
|
348
348
|
window['DOCS_OPTIONS'] = {"defaultName":"Docs","autodocs":true};</script><script type="module">import './sb-preview/runtime.js';
|
|
349
349
|
|
|
350
350
|
|
|
351
|
-
import './runtime~main.
|
|
351
|
+
import './runtime~main.c31464c5.iframe.bundle.js';
|
|
352
352
|
|
|
353
353
|
import './5478.5fc19af5.iframe.bundle.js';
|
|
354
354
|
|
|
355
|
-
import './main.
|
|
355
|
+
import './main.d00e3563.iframe.bundle.js';</script></body></html>
|