-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(control-flow): includes alert, anchor, avatar, back-top, aff…
…ix and badge
- Loading branch information
1 parent
8f1e8d0
commit 68b0124
Showing
18 changed files
with
155 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,68 @@ | ||
<div | ||
#alert | ||
class="x-alert" | ||
cdkDrag | ||
(cdkDragEnded)="dragEnded.emit($event)" | ||
[cdkDragFreeDragPosition]="dragFreeDragPosition" | ||
[cdkDragDisabled]="!draggable" | ||
[cdkDragBoundary]="dragBoundary" | ||
[ngClass]="classMap" | ||
*ngIf="!hide" | ||
@x-fade-animation | ||
[@.disabled]="disabledAnimation" | ||
(@x-fade-animation.done)="onCloseAnimationDone()" | ||
[xResizable]="resizable!" | ||
(resizing)="resizing.emit($event)" | ||
[offsetLeft]="offsetLeft" | ||
[offsetTop]="offsetTop" | ||
[style.minWidth]="minWidth" | ||
[style.minHeight]="minHeight" | ||
> | ||
<ng-container *ngIf="showIcon"> | ||
<ng-container *ngTemplateOutlet="iconTpl"></ng-container> | ||
</ng-container> | ||
<ng-template #iconTpl> | ||
<ng-container [ngSwitch]="type"> | ||
<x-icon class="x-alert-icon" *ngSwitchCase="'success'" type="adf-check-circle"></x-icon> | ||
<x-icon class="x-alert-icon" *ngSwitchCase="'info'" type="adf-info-circle"></x-icon> | ||
<x-icon class="x-alert-icon" *ngSwitchCase="'warning'" type="adf-exclamation-circle"></x-icon> | ||
<x-icon class="x-alert-icon" *ngSwitchCase="'error'" type="adf-close-circle"></x-icon> | ||
<x-icon class="x-alert-icon" *ngSwitchCase="'loading'" type="fto-loader" [spin]="true"></x-icon> | ||
</ng-container> | ||
</ng-template> | ||
<div class="x-alert-inner"> | ||
<span class="x-alert-title" cdkDragHandle [class.x-bold]="title && content"> | ||
<ng-container *xOutlet="title; context: { $iconTpl: iconTpl }">{{ title }}</ng-container> | ||
</span> | ||
<div class="x-alert-content" *ngIf="content"> | ||
<ng-container *xOutlet="content; context: { $iconTpl: iconTpl }">{{ content }}</ng-container> | ||
</div> | ||
<div class="x-alert-close"> | ||
<div class="x-alert-operation" *xOutlet="operationTpl">{{ operationTpl }}</div> | ||
<x-button | ||
*ngIf="!hideClose" | ||
size="small" | ||
[icon]="!closeText ? 'fto-x' : ''" | ||
[onlyIcon]="!closeText" | ||
[type]="closeText ? 'text' : 'initial'" | ||
(click)="onClose()" | ||
closable | ||
>{{ closeText }}</x-button | ||
> | ||
@if (!hide) { | ||
<div | ||
#alert | ||
class="x-alert" | ||
cdkDrag | ||
(cdkDragEnded)="dragEnded.emit($event)" | ||
[cdkDragFreeDragPosition]="dragFreeDragPosition" | ||
[cdkDragDisabled]="!draggable" | ||
[cdkDragBoundary]="dragBoundary" | ||
[ngClass]="classMap" | ||
@x-fade-animation | ||
[@.disabled]="disabledAnimation" | ||
(@x-fade-animation.done)="onCloseAnimationDone()" | ||
[xResizable]="resizable!" | ||
(resizing)="resizing.emit($event)" | ||
[offsetLeft]="offsetLeft" | ||
[offsetTop]="offsetTop" | ||
[style.minWidth]="minWidth" | ||
[style.minHeight]="minHeight" | ||
> | ||
@if (showIcon) { | ||
<ng-container *ngTemplateOutlet="iconTpl"></ng-container> | ||
} | ||
<ng-template #iconTpl> | ||
@switch (type) { | ||
@case ('success') { | ||
<x-icon class="x-alert-icon" type="adf-check-circle"></x-icon> | ||
} | ||
@case ('info') { | ||
<x-icon class="x-alert-icon" type="adf-info-circle"></x-icon> | ||
} | ||
@case ('warning') { | ||
<x-icon class="x-alert-icon" type="adf-exclamation-circle"></x-icon> | ||
} | ||
@case ('error') { | ||
<x-icon class="x-alert-icon" type="adf-close-circle"></x-icon> | ||
} | ||
@case ('loading') { | ||
<x-icon class="x-alert-icon" type="fto-loader" [spin]="true"></x-icon> | ||
} | ||
} | ||
</ng-template> | ||
<div class="x-alert-inner"> | ||
<span class="x-alert-title" cdkDragHandle [class.x-bold]="title && content"> | ||
<ng-container *xOutlet="title; context: { $iconTpl: iconTpl }">{{ title }}</ng-container> | ||
</span> | ||
@if (content) { | ||
<div class="x-alert-content"> | ||
<ng-container *xOutlet="content; context: { $iconTpl: iconTpl }">{{ content }}</ng-container> | ||
</div> | ||
} | ||
<div class="x-alert-close"> | ||
<div class="x-alert-operation" *xOutlet="operationTpl">{{ operationTpl }}</div> | ||
@if (!hideClose) { | ||
<x-button | ||
size="small" | ||
[icon]="!closeText ? 'fto-x' : ''" | ||
[onlyIcon]="!closeText" | ||
[type]="closeText ? 'text' : 'initial'" | ||
(click)="onClose()" | ||
closable | ||
>{{ closeText }}</x-button | ||
> | ||
} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
<ng-template #backTopTpl> | ||
<div class="x-back-top" [ngClass]="classMap" (click)="onBackTop()"> | ||
<x-link *ngIf="!template" icon="fto-arrow-up"> </x-link> | ||
@if (!template) { | ||
<x-link icon="fto-arrow-up"> </x-link> | ||
} | ||
<ng-container *ngTemplateOutlet="template"></ng-container> | ||
</div> | ||
</ng-template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,29 @@ | ||
<div #badge class="x-badge" [ngClass]="classMap" [class.x-badge-dot]="dot" [class.x-badge-standalone]="standalone"> | ||
<ng-content></ng-content> | ||
<ng-container *ngIf="valueNumber > 0 || dot"> | ||
<sup *ngIf="standalone" [@x-badge-standalone-animation] [style.marginRight]="getOffsetRight" [style.marginTop]="getOffsetTop"> | ||
<ng-container *ngIf="!dot"> | ||
<ng-container *ngTemplateOutlet="diaplayValueTpl"></ng-container> | ||
</ng-container> | ||
</sup> | ||
<sup *ngIf="!standalone" [@x-badge-animation] [style.marginRight]="getOffsetRight" [style.marginTop]="getOffsetTop"> | ||
<ng-container *ngIf="!dot"> | ||
<ng-container *ngTemplateOutlet="diaplayValueTpl"></ng-container> | ||
</ng-container> | ||
</sup> | ||
</ng-container> | ||
@if (valueNumber > 0 || dot) { | ||
@if (standalone) { | ||
<sup [@x-badge-standalone-animation] [style.marginRight]="getOffsetRight" [style.marginTop]="getOffsetTop"> | ||
<ng-container *ngTemplateOutlet="dotTpl"></ng-container> | ||
</sup> | ||
} @else { | ||
<sup [@x-badge-animation] [style.marginRight]="getOffsetRight" [style.marginTop]="getOffsetTop"> | ||
<ng-container *ngTemplateOutlet="dotTpl"></ng-container> | ||
</sup> | ||
} | ||
} | ||
</div> | ||
|
||
<ng-template #diaplayValueTpl> | ||
<span | ||
class="x-badge-scroll" | ||
*ngFor="let item of maxNums; let i = index" | ||
[style.transform]="'translateY(-' + (displayNums[i] == '+' ? 10 : displayNums[i]) * 100 + '%)'" | ||
> | ||
<p *ngFor="let j of range">{{ j }}</p> | ||
</span> | ||
<ng-template #dotTpl> | ||
@if (!dot) { | ||
@for (item of maxNums; track item; let i = $index) { | ||
<span | ||
class="x-badge-scroll" | ||
[style.transform]="'translateY(-' + (displayNums[i] == '+' ? 10 : displayNums[i]) * 100 + '%)'" | ||
> | ||
@for (j of range; track j) { | ||
<p>{{ j }}</p> | ||
} | ||
</span> | ||
} | ||
} | ||
</ng-template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.