Skip to content

Commit

Permalink
chore: tooltip add animation
Browse files Browse the repository at this point in the history
  • Loading branch information
igauch committed Apr 25, 2023
1 parent 335b946 commit 9de51f1
Show file tree
Hide file tree
Showing 30 changed files with 234 additions and 86 deletions.
20 changes: 10 additions & 10 deletions src/autocomplete/autocomplete.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ export class AutoCompleteDirective
declare innerSelector: string;

@Output('auiAutocompleteShow')
override show = new EventEmitter<void>();
override showed = new EventEmitter<void>();

@Output('auiAutocompleteHide')
override hide = new EventEmitter<void>();
override hided = new EventEmitter<void>();

@Output('auiAutocompleteSelected')
selected = new EventEmitter<string>();
Expand Down Expand Up @@ -135,10 +135,10 @@ export class AutoCompleteDirective
}

ngOnInit() {
this.show.subscribe(() => {
this.showed.subscribe(() => {
this.updateSuggestionsContext();
});
this.hide.subscribe(() => {
this.hided.subscribe(() => {
this.resetFocusedSuggestion();
});

Expand Down Expand Up @@ -196,7 +196,7 @@ export class AutoCompleteDirective
onInput(event: Event) {
const value = (event.target as HTMLInputElement).value;
this.inputValue$$.next(value);
this.createTooltip();
this.show();
}

onKeyDown(event: KeyboardEvent) {
Expand All @@ -219,7 +219,7 @@ export class AutoCompleteDirective
}
break;
case 'Escape':
this.disposeTooltip();
this.hide();
event.stopPropagation();
event.preventDefault();
break;
Expand Down Expand Up @@ -249,11 +249,11 @@ export class AutoCompleteDirective
this.inputValue$$.next(isArrCtrl ? '' : value);

this.selected.emit(value);
this.disposeTooltip();
this.hide();
}

override createTooltip() {
super.createTooltip();
override show() {
super.show();
this.autoFocusFirstSuggestion();
}

Expand Down Expand Up @@ -281,7 +281,7 @@ export class AutoCompleteDirective

private focusSuggestionDir(dir: 'down' | 'up') {
if (!this.isCreated) {
this.createTooltip();
this.show();
return;
}
const visibleSuggestions = this.autocomplete.suggestions.filter(
Expand Down
3 changes: 2 additions & 1 deletion src/date-picker/date-picker/date-picker.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[format]="format"
style="display: flex"
[auiTooltip]="template"
[auiDisableAnimation]="true"
auiTooltipType="info"
auiTooltipClass="date-picker-wrapper"
[disabled]="!!disabled"
Expand Down Expand Up @@ -36,6 +37,6 @@
[maxDate]="maxDate"
(click)="$event.stopImmediatePropagation()"
(clear)="clearValue()"
(confirm)="tooltip.disposeTooltip(); emitValue(value)"
(confirm)="tooltip.hide(); emitValue(value)"
></aui-date-picker-panel>
</ng-template>
3 changes: 2 additions & 1 deletion src/date-picker/range-picker/range-picker.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[size]="size"
[value]="value"
[auiTooltip]="template"
[auiDisableAnimation]="true"
[disabled]="!!disabled"
style="display: flex"
auiTooltipType="info"
Expand Down Expand Up @@ -33,6 +34,6 @@
[maxDate]="maxDate"
(click)="$event.stopImmediatePropagation()"
(clear)="clearValue()"
(confirm)="tooltip.disposeTooltip(); emitValue(value)"
(confirm)="tooltip.hide(); emitValue(value)"
></aui-date-range-picker-panel>
</ng-template>
8 changes: 4 additions & 4 deletions src/dropdown/dropdown.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ export class DropdownDirective extends BaseTooltip implements OnInit {
override hideOnClick = true;

@Output('auiDropdownShow')
override show = new EventEmitter<void>();
override showed = new EventEmitter<void>();

@Output('auiDropdownHide')
override hide = new EventEmitter<void>();
override hided = new EventEmitter<void>();

private _menu: MenuComponent;

Expand All @@ -78,14 +78,14 @@ export class DropdownDirective extends BaseTooltip implements OnInit {
}

ngOnInit() {
this.show.pipe(debounceTime(0)).subscribe(() => {
this.showed.pipe(debounceTime(0)).subscribe(() => {
if (this.menu.lazyContent) {
this.menu.lazyContent.attach(this.lazyContentContext);
this.updatePosition();
}
});

this.hide.subscribe(() => {
this.hided.subscribe(() => {
if (this.menu.lazyContent) {
this.menu.lazyContent.detach();
}
Expand Down
1 change: 1 addition & 0 deletions src/dropdown/submenu/submenu.component.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<button
[class]="className"
[auiTooltip]="menu.template"
[auiDisableAnimation]="true"
[auiTooltipDisabled]="disabled"
[auiTooltipTrigger]="trigger"
[auiTooltipHideOnClick]="true"
Expand Down
4 changes: 2 additions & 2 deletions src/select/base-select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,11 +294,11 @@ export abstract class BaseSelect<T, V = T>
}

openOption() {
this.tooltipRef.createTooltip();
this.tooltipRef.show();
}

closeOption() {
this.tooltipRef.disposeTooltip();
this.tooltipRef.hide();
}

onShowOptions() {
Expand Down
1 change: 1 addition & 0 deletions src/select/multi-select/multi-select.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#selectRef
#tooltipRef="auiTooltip"
[auiTooltip]="templateRef"
[auiDisableAnimation]="true"
[auiTooltipDisabled]="disabled"
auiTooltipTrigger="click"
auiTooltipPosition="bottom start"
Expand Down
1 change: 1 addition & 0 deletions src/select/select.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#selectRef
#tooltipRef="auiTooltip"
[auiTooltip]="templateRef"
[auiDisableAnimation]="true"
[auiTooltipDisabled]="disabled"
auiTooltipTrigger="click"
auiTooltipPosition="bottom start"
Expand Down
4 changes: 2 additions & 2 deletions src/time-picker/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,15 @@ export class TimePickerComponent extends CommonFormControl<
if (this.tooltipRef.isCreated) {
return;
}
this.tooltipRef.createTooltip();
this.tooltipRef.show();
this.open.next();
}

closePanel() {
if (!this.tooltipRef.isCreated) {
return;
}
this.tooltipRef.disposeTooltip();
this.tooltipRef.hide();
this.close.next();
}

Expand Down
1 change: 1 addition & 0 deletions src/time-picker/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[class.isClearable]="clearable && timeFormatValue"
#tooltipRef="auiTooltip"
[auiTooltip]="template"
[auiDisableAnimation]="true"
auiTooltipType="plain"
auiTooltipTrigger="click"
auiTooltipPosition="bottom start"
Expand Down
Loading

0 comments on commit 9de51f1

Please sign in to comment.