@datorama/core 22.0.4-rc.1 → 22.0.4-rc.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.
@@ -484,7 +484,7 @@ function yc(t,e){return t.type.lastIndexOf(e+".xml")>-1}function vc(t,e,n){this.
484
484
  *
485
485
  * Use of this source code is governed by an Apache License 2.0 license that can be
486
486
  * found in the LICENSE file at https://github.com/datorama/client-core/blob/master/LICENSE
487
- */(xc=t.PillType||(t.PillType={})).PRIMARY="primary",xc.SECONDARY="secondary",xc.RED="red",xc.ORANGE="orange";var Zc=function(){function t(t){this.size=t,this._options=[],this.labelTooltipPosition="bottom",this.canRemove=!0,this.restCount=0,this._limitTo=10,this.removeOption=new e.EventEmitter,this.size=t||"md"}return Object.defineProperty(t.prototype,"options",{get:function(){return this._options},set:function(t){this._options=t,this.setRestCount()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"limitTo",{get:function(){return this._limitTo},set:function(t){this._limitTo=t,this.setRestCount()},enumerable:!0,configurable:!0}),t.prototype.remove=function(t){this.options=this._options.filter((function(e){return e.id!==t.id})),this.removeOption.emit(t)},Object.defineProperty(t.prototype,"showRest",{get:function(){return this.options&&this.options.length>this.limitTo},enumerable:!0,configurable:!0}),t.prototype.setRestCount=function(){this.options&&this.options.length&&(this.restCount=Math.abs(this.limitTo-this.options.length))},t.ctorParameters=function(){return[{type:void 0,decorators:[{type:e.Attribute,args:["datoSize"]}]}]},vt([e.Input(),Ct("design:type",Array),Ct("design:paramtypes",[Array])],t.prototype,"options",null),vt([e.Input(),Ct("design:type",Object)],t.prototype,"labelTooltipPosition",void 0),vt([e.Input(),Ct("design:type",Object)],t.prototype,"canRemove",void 0),vt([e.Input(),Ct("design:type",Number),Ct("design:paramtypes",[Number])],t.prototype,"limitTo",null),vt([e.Output(),Ct("design:type",Object)],t.prototype,"removeOption",void 0),t=vt([e.Component({selector:"dato-pills",template:'<div class="dato-pills__active d-flex justify-between" [class.cant-remove]="!canRemove" [attr.dato-type]="option.type || \'primary\'" [class.disabled]="option.disabled"\n *ngFor="let option of options | slice: 0: limitTo; trackBy: (\'id\' | trackByProp)">\n <span [datoTooltip]="option.customTooltip || option.label" class="ellipsis"\n datoTooltipPosition="labelTooltipPosition" [datoTooltipOnTextOverflow]="!option.customTooltip">{{option.label | translate}}</span>\n <dato-icon class="d-flex-no-shrink pointer" datoIcon="close" *ngIf="canRemove"\n (click)="remove(option)"></dato-icon>\n</div>\n<div class="dato-pills__active d-flex justify-between dato-pills__rest" *ngIf="showRest">\n +{{restCount}}\n</div>\n',encapsulation:e.ViewEncapsulation.None,changeDetection:e.ChangeDetectionStrategy.OnPush,styles:["dato-pills{display:flex;flex-wrap:wrap}dato-pills .dato-pills__active{height:35px;line-height:35px;margin-right:6px;margin-bottom:6px;font-size:14px;font-weight:600}dato-pills .dato-pills__rest{padding:7px}dato-pills[datoSize=sm] .dato-pills__active{height:26px;line-height:26px;margin-right:6px;margin-bottom:6px;font-size:12px}"]}),bt(0,e.Attribute("datoSize")),Ct("design:paramtypes",[Object])],t)}(),Xc=[Zc],Jc=function(){function t(){}return t=vt([e.NgModule({imports:[s.CommonModule,Xn,yo,Ne],declarations:[Xc],exports:[Xc]})],t)}(),tp=function(){function t(){this.barColor="primary-100",this.thresholds=[33,66]}return t.prototype.ngOnInit=function(){!this.parts&&this.percent?(this.isByPercent=!0,this.hasInitialColor=!!this.color,this.initSinglePart()):this.parts&&this.parts.every((function(t){return t.weight>=0}))&&!this.parts.every((function(t){return!!t.percent}))&&this.initPartsPercent()},t.prototype.ngOnChanges=function(t){this.isByPercent&&(t.percent&&!t.percent.firstChange||t.color&&!t.color.firstChange||t.tooltip&&!t.tooltip.firstChange)&&this.initSinglePart()},t.prototype.initSinglePart=function(){this.color&&this.hasInitialColor||this.initColor(),this.parts=[{percent:this.percent,color:this.color,tooltip:this.tooltip}]},t.prototype.initColor=function(){kt(this.thresholds)&&(this.color="accent-400"),1===this.thresholds.length?this.color=this.percent<=this.thresholds[0]?"red-400":"green-400":this.color=this.percent<=this.thresholds[0]?"red-400":this.percent<=this.thresholds[1]?"yellow-400":"green-400"},t.prototype.initPartsPercent=function(){var t=this.parts.reduce((function(t,e){return t+e.weight}),0);this.parts.forEach((function(e){e.percent=e.weight>0?Math.max(Math.round(e.weight/t*100),1):0})),this.roundPartsPercent()},t.prototype.roundPartsPercent=function(){var t=this.parts.reduce((function(t,e){return t+e.percent}),0);if(100!==t)for(var e=100-t,n=0,o=0;0!==e&&o<100;){var i=this.parts[n];n=(n+1)%this.parts.length,o++,0===i.weight||i.percent<=1||(i.percent+=e>0?1:-1,e-=e>0?1:-1)}},vt([e.Input(),Ct("design:type",String)],t.prototype,"width",void 0),vt([e.Input(),Ct("design:type",Array)],t.prototype,"parts",void 0),vt([e.Input(),Ct("design:type",Number)],t.prototype,"percent",void 0),vt([e.Input(),Ct("design:type",String)],t.prototype,"color",void 0),vt([e.Input(),Ct("design:type",Object)],t.prototype,"tooltip",void 0),vt([e.Input(),Ct("design:type",String)],t.prototype,"barColor",void 0),vt([e.Input(),Ct("design:type",Array)],t.prototype,"thresholds",void 0),vt([e.Input(),Ct("design:type",Boolean)],t.prototype,"showLegend",void 0),t=vt([e.Component({selector:"dato-progress-bar",template:'<div class="bar d-flex width-100 overflow-hidden"\n [style.width]="width"\n [class]="barColor + \'-background-color\'">\n <div *ngFor="let part of parts; index as i"\n class="part height-100"\n [ngClass]="part.color ? part.color + \'-background-color\' : \'\'"\n [style.width]="i > 0 ? \'calc(\' + part.percent + \'% + 8px)\' : part.percent + \'%\'"\n [style.z-index]="100 - i"\n [datoTooltipV2]="part.tooltip">\n </div>\n</div>\n\n<ng-content></ng-content>\n\n<div *ngIf="showLegend" class="d-flex mt-12">\n <div *ngFor="let part of parts; index as i" class="d-flex mr-16">\n <div class="d-flex dato-note primary-400-color">\n <div class="legend-color mr-6" [ngClass]="part.color ? part.color + \'-background-color\' : \'\'"></div>\n <div>{{ part.legendLabel || part.tooltip }}</div>\n </div>\n </div>\n</div>\n',changeDetection:e.ChangeDetectionStrategy.OnPush,encapsulation:e.ViewEncapsulation.None,styles:["dato-progress-bar .bar{height:8px;border-radius:4px}dato-progress-bar .part{border-radius:0 4px 4px 0}dato-progress-bar .part:not(:first-child){margin-left:-8px}dato-progress-bar .legend-color{width:16px;height:16px;min-width:16px;border-radius:50%}"]})],t)}(),ep=[tp],np=function(){function t(){}return t=vt([e.NgModule({imports:[s.CommonModule,Xn],declarations:[ep],exports:[ep]})],t)}(),op=[Xn,Nc,ss,es,kc,Ec,zl,mc,Wi,oc,se,Vc,On,Rl,Ll,vo,Ne,Co,xo,tc,tr,xl,Ws,Hi,di,Gs,Pi,Tl,dl,ll,Xi,Gi,Ql,yo,At,vs,Hc,Hs,Qc,hl,xs,Yc,ds,el,Jc,np],ip=function(){function t(){}var n;return n=t,t.forRoot=function(t){return{ngModule:n,providers:[{provide:Bn,useValue:t},{provide:ut.EVENT_MANAGER_PLUGINS,useClass:Fc,multi:!0}]}},t=n=vt([e.NgModule({exports:[op]})],t)}();(t.MockService||(t.MockService={})).TRANSLATE="translate";var rp={translate:{transform:function(t){return t}}};var ap={translate:function(){return{provide:kn,useValue:rp.translate}},datePickerConfig:function(){return{provide:vn,useValue:function(){}}}};
487
+ */(xc=t.PillType||(t.PillType={})).PRIMARY="primary",xc.SECONDARY="secondary",xc.RED="red",xc.ORANGE="orange";var Zc=function(){function t(t){this.size=t,this._options=[],this.labelTooltipPosition="bottom",this.canRemove=!0,this.restCount=0,this._limitTo=10,this.removeOption=new e.EventEmitter,this.size=t||"md"}return Object.defineProperty(t.prototype,"options",{get:function(){return this._options},set:function(t){this._options=t,this.setRestCount()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"limitTo",{get:function(){return this._limitTo},set:function(t){this._limitTo=t,this.setRestCount()},enumerable:!0,configurable:!0}),t.prototype.remove=function(t){this.options=this._options.filter((function(e){return e.id!==t.id})),this.removeOption.emit(t)},Object.defineProperty(t.prototype,"showRest",{get:function(){return this.options&&this.options.length>this.limitTo},enumerable:!0,configurable:!0}),t.prototype.setRestCount=function(){this.options&&this.options.length&&(this.restCount=Math.abs(this.limitTo-this.options.length))},t.ctorParameters=function(){return[{type:void 0,decorators:[{type:e.Attribute,args:["datoSize"]}]}]},vt([e.Input(),Ct("design:type",Array),Ct("design:paramtypes",[Array])],t.prototype,"options",null),vt([e.Input(),Ct("design:type",Object)],t.prototype,"labelTooltipPosition",void 0),vt([e.Input(),Ct("design:type",Object)],t.prototype,"canRemove",void 0),vt([e.Input(),Ct("design:type",Number),Ct("design:paramtypes",[Number])],t.prototype,"limitTo",null),vt([e.Output(),Ct("design:type",Object)],t.prototype,"removeOption",void 0),t=vt([e.Component({selector:"dato-pills",template:'<div class="dato-pills__active d-flex justify-between" [class.cant-remove]="!canRemove" [attr.dato-type]="option.type || \'primary\'" [class.disabled]="option.disabled"\n *ngFor="let option of options | slice: 0: limitTo; trackBy: (\'id\' | trackByProp)">\n <span [datoTooltip]="option.customTooltip || option.label" class="ellipsis"\n datoTooltipPosition="labelTooltipPosition" [datoTooltipOnTextOverflow]="!option.customTooltip">{{option.label | translate}}</span>\n <dato-icon class="d-flex-no-shrink pointer" datoIcon="close" *ngIf="canRemove"\n (click)="remove(option)"></dato-icon>\n</div>\n<div class="dato-pills__active d-flex justify-between dato-pills__rest" *ngIf="showRest">\n +{{restCount}}\n</div>\n',encapsulation:e.ViewEncapsulation.None,changeDetection:e.ChangeDetectionStrategy.OnPush,styles:["dato-pills{display:flex;flex-wrap:wrap}dato-pills .dato-pills__active{height:35px;line-height:35px;margin-right:6px;margin-bottom:6px;font-size:14px;font-weight:600}dato-pills .dato-pills__rest{padding:7px}dato-pills[datoSize=sm] .dato-pills__active{height:26px;line-height:26px;margin-right:6px;margin-bottom:6px;font-size:12px}"]}),bt(0,e.Attribute("datoSize")),Ct("design:paramtypes",[Object])],t)}(),Xc=[Zc],Jc=function(){function t(){}return t=vt([e.NgModule({imports:[s.CommonModule,Xn,yo,Ne],declarations:[Xc],exports:[Xc]})],t)}(),tp=function(){function t(t){this.cdr=t,this.barColor="primary-100",this.thresholds=[33,66]}return t.prototype.ngOnInit=function(){!this.parts&&this.percent?(this.isByPercent=!0,this.hasInitialColor=!!this.color,this.initSinglePart()):this.parts&&this.parts.every((function(t){return t.weight>=0}))&&!this.parts.every((function(t){return!!t.percent}))&&this.initPartsPercent()},t.prototype.ngOnChanges=function(t){this.isByPercent&&(t.percent&&!t.percent.firstChange||t.color&&!t.color.firstChange||t.tooltip&&!t.tooltip.firstChange)&&(this.initSinglePart(),this.cdr.detectChanges())},t.prototype.initSinglePart=function(){this.color&&this.hasInitialColor||this.initColor(),this.parts=[{percent:this.percent,color:this.color,tooltip:this.tooltip}]},t.prototype.initColor=function(){kt(this.thresholds)&&(this.color="accent-400"),1===this.thresholds.length?this.color=this.percent<=this.thresholds[0]?"red-400":"green-400":this.color=this.percent<=this.thresholds[0]?"red-400":this.percent<=this.thresholds[1]?"yellow-400":"green-400"},t.prototype.initPartsPercent=function(){var t=this.parts.reduce((function(t,e){return t+e.weight}),0);this.parts.forEach((function(e){e.percent=e.weight>0?Math.max(Math.round(e.weight/t*100),1):0})),this.roundPartsPercent()},t.prototype.roundPartsPercent=function(){var t=this.parts.reduce((function(t,e){return t+e.percent}),0);if(100!==t)for(var e=100-t,n=0,o=0;0!==e&&o<100;){var i=this.parts[n];n=(n+1)%this.parts.length,o++,0===i.weight||i.percent<=1||(i.percent+=e>0?1:-1,e-=e>0?1:-1)}},t.ctorParameters=function(){return[{type:e.ChangeDetectorRef}]},vt([e.Input(),Ct("design:type",String)],t.prototype,"width",void 0),vt([e.Input(),Ct("design:type",Array)],t.prototype,"parts",void 0),vt([e.Input(),Ct("design:type",Number)],t.prototype,"percent",void 0),vt([e.Input(),Ct("design:type",String)],t.prototype,"color",void 0),vt([e.Input(),Ct("design:type",Object)],t.prototype,"tooltip",void 0),vt([e.Input(),Ct("design:type",String)],t.prototype,"barColor",void 0),vt([e.Input(),Ct("design:type",Array)],t.prototype,"thresholds",void 0),vt([e.Input(),Ct("design:type",Boolean)],t.prototype,"showLegend",void 0),t=vt([e.Component({selector:"dato-progress-bar",template:'<div class="bar d-flex width-100 overflow-hidden"\n [style.width]="width"\n [class]="barColor + \'-background-color\'">\n <div *ngFor="let part of parts; index as i"\n class="part height-100"\n [ngClass]="part.color ? part.color + \'-background-color\' : \'\'"\n [style.width]="i > 0 ? \'calc(\' + part.percent + \'% + 8px)\' : part.percent + \'%\'"\n [style.z-index]="100 - i"\n [datoTooltipV2]="part.tooltip">\n </div>\n</div>\n\n<ng-content></ng-content>\n\n<div *ngIf="showLegend" class="d-flex mt-12">\n <div *ngFor="let part of parts; index as i" class="d-flex mr-16">\n <div class="d-flex dato-note primary-400-color">\n <div class="legend-color mr-6" [ngClass]="part.color ? part.color + \'-background-color\' : \'\'"></div>\n <div>{{ part.legendLabel || part.tooltip }}</div>\n </div>\n </div>\n</div>\n',changeDetection:e.ChangeDetectionStrategy.OnPush,encapsulation:e.ViewEncapsulation.None,styles:["dato-progress-bar .bar{height:8px;border-radius:4px}dato-progress-bar .part{border-radius:0 4px 4px 0}dato-progress-bar .part:not(:first-child){margin-left:-8px}dato-progress-bar .legend-color{width:16px;height:16px;min-width:16px;border-radius:50%}"]}),Ct("design:paramtypes",[e.ChangeDetectorRef])],t)}(),ep=[tp],np=function(){function t(){}return t=vt([e.NgModule({imports:[s.CommonModule,Xn],declarations:[ep],exports:[ep]})],t)}(),op=[Xn,Nc,ss,es,kc,Ec,zl,mc,Wi,oc,se,Vc,On,Rl,Ll,vo,Ne,Co,xo,tc,tr,xl,Ws,Hi,di,Gs,Pi,Tl,dl,ll,Xi,Gi,Ql,yo,At,vs,Hc,Hs,Qc,hl,xs,Yc,ds,el,Jc,np],ip=function(){function t(){}var n;return n=t,t.forRoot=function(t){return{ngModule:n,providers:[{provide:Bn,useValue:t},{provide:ut.EVENT_MANAGER_PLUGINS,useClass:Fc,multi:!0}]}},t=n=vt([e.NgModule({exports:[op]})],t)}();(t.MockService||(t.MockService={})).TRANSLATE="translate";var rp={translate:{transform:function(t){return t}}};var ap={translate:function(){return{provide:kn,useValue:rp.translate}},datePickerConfig:function(){return{provide:vn,useValue:function(){}}}};
488
488
  /**
489
489
  * @license
490
490
  * Copyright Datorama. All Rights Reserved.