16 lines
6.8 KiB
JavaScript
16 lines
6.8 KiB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/common"),require("primeng/utils"),require("primeng/ripple"),require("@angular/forms")):"function"==typeof define&&define.amd?define("primeng/selectbutton",["exports","@angular/core","@angular/common","primeng/utils","primeng/ripple","@angular/forms"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).primeng=t.primeng||{},t.primeng.selectbutton={}),t.ng.core,t.ng.common,t.primeng.utils,t.primeng.ripple,t.ng.forms)}(this,(function(t,e,n,o,i,l){"use strict";
|
|
/*! *****************************************************************************
|
|
Copyright (c) Microsoft Corporation.
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
PERFORMANCE OF THIS SOFTWARE.
|
|
***************************************************************************** */Object.create;function r(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,i,l=n.call(t),r=[];try{for(;(void 0===e||e-- >0)&&!(o=l.next()).done;)r.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=l.return)&&n.call(l)}finally{if(i)throw i.error}}return r}Object.create;var s={provide:l.NG_VALUE_ACCESSOR,useExisting:e.forwardRef((function(){return a})),multi:!0},a=function(){function t(t){this.cd=t,this.tabindex=0,this.onOptionClick=new e.EventEmitter,this.onChange=new e.EventEmitter,this.onModelChange=function(){},this.onModelTouched=function(){}}return Object.defineProperty(t.prototype,"options",{get:function(){return this._options},set:function(t){},enumerable:!1,configurable:!0}),t.prototype.ngOnChanges=function(t){t.options&&(this._options=this.optionLabel?o.ObjectUtils.generateSelectItems(t.options.currentValue,this.optionLabel):t.options.currentValue)},t.prototype.writeValue=function(t){this.value=t,this.cd.markForCheck()},t.prototype.registerOnChange=function(t){this.onModelChange=t},t.prototype.registerOnTouched=function(t){this.onModelTouched=t},t.prototype.setDisabledState=function(t){this.disabled=t,this.cd.markForCheck()},t.prototype.onItemClick=function(t,e,n){if(!this.disabled&&!e.disabled){if(this.multiple){var o=this.findItemIndex(e);this.value=-1!=o?this.value.filter((function(t,e){return e!=o})):function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(r(arguments[e]));return t}(this.value||[],[e.value])}else this.value=e.value;this.onOptionClick.emit({originalEvent:t,option:e,index:n}),this.onModelChange(this.value),this.onChange.emit({originalEvent:t,value:this.value})}},t.prototype.onBlur=function(){this.onModelTouched()},t.prototype.isSelected=function(t){return this.multiple?-1!=this.findItemIndex(t):o.ObjectUtils.equals(t.value,this.value,this.dataKey)},t.prototype.findItemIndex=function(t){var e=-1;if(this.value)for(var n=0;n<this.value.length;n++)if(this.value[n]==t.value){e=n;break}return e},t}();a.decorators=[{type:e.Component,args:[{selector:"p-selectButton",template:'\n <div [ngClass]="\'p-selectbutton p-buttonset p-component\'" [ngStyle]="style" [class]="styleClass" role="group">\n <div *ngFor="let option of options; let i = index" #btn class="p-button p-component" [class]="option.styleClass" role="button" [attr.aria-pressed]="isSelected(option)"\n [ngClass]="{\'p-highlight\':isSelected(option), \'p-disabled\': disabled || option.disabled, \n \'p-button-icon-only\': (option.icon && !option.label)}" (click)="onItemClick($event,option,i)" (keydown.enter)="onItemClick($event,option,i)"\n [attr.title]="option.title" [attr.aria-label]="option.label" (blur)="onBlur()" [attr.tabindex]="disabled ? null : tabindex" [attr.aria-labelledby]="ariaLabelledBy" pRipple>\n <ng-container *ngIf="!itemTemplate else customcontent">\n <span [ngClass]="\'p-button-icon p-button-icon-left\'" [class]="option.icon" *ngIf="option.icon"></span>\n <span class="p-button-label">{{option.label}}</span>\n </ng-container>\n <ng-template #customcontent>\n <ng-container *ngTemplateOutlet="itemTemplate; context: {$implicit: option, index: i}"></ng-container>\n </ng-template>\n </div>\n </div>\n ',providers:[s],changeDetection:e.ChangeDetectionStrategy.OnPush,encapsulation:e.ViewEncapsulation.None,styles:[".ui-selectbutton{display:inline-block}.ui-selectbutton.ui-state-error{padding:0}.ui-selectbutton .ui-button.ui-state-focus{outline:none}",".p-button{-moz-user-select:none;-ms-flex-align:center;-ms-user-select:none;-webkit-user-select:none;align-items:center;cursor:pointer;display:-ms-inline-flexbox;display:inline-flex;margin:0;overflow:hidden;position:relative;text-align:center;user-select:none;vertical-align:bottom}.p-button-label{-ms-flex:1 1 auto;flex:1 1 auto}.p-button-icon-right{-ms-flex-order:1;order:1}.p-button:disabled{cursor:default}.p-button-icon-only{-ms-flex-pack:center;justify-content:center}.p-button-icon-only .p-button-label{-ms-flex:0 0 auto;flex:0 0 auto;visibility:hidden;width:0}.p-button-vertical{-ms-flex-direction:column;flex-direction:column}.p-button-icon-bottom{-ms-flex-order:2;order:2}.p-buttonset .p-button{margin:0}.p-buttonset .p-button:not(:last-child){border-right:0}.p-buttonset .p-button:not(:first-of-type):not(:last-of-type){border-radius:0}.p-buttonset .p-button:first-of-type{border-bottom-right-radius:0;border-top-right-radius:0}.p-buttonset .p-button:last-of-type{border-bottom-left-radius:0;border-top-left-radius:0}.p-buttonset .p-button:focus{position:relative;z-index:1}"]}]}],a.ctorParameters=function(){return[{type:e.ChangeDetectorRef}]},a.propDecorators={tabindex:[{type:e.Input}],multiple:[{type:e.Input}],style:[{type:e.Input}],styleClass:[{type:e.Input}],ariaLabelledBy:[{type:e.Input}],disabled:[{type:e.Input}],dataKey:[{type:e.Input}],optionLabel:[{type:e.Input}],onOptionClick:[{type:e.Output}],onChange:[{type:e.Output}],itemTemplate:[{type:e.ContentChild,args:[e.TemplateRef]}],options:[{type:e.Input}]};var u=function(){};u.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,i.RippleModule],exports:[a],declarations:[a]}]}],t.SELECTBUTTON_VALUE_ACCESSOR=s,t.SelectButton=a,t.SelectButtonModule=u,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
//# sourceMappingURL=primeng-selectbutton.umd.min.js.map
|