Skip to content

Commit

Permalink
refactor: debug cascader
Browse files Browse the repository at this point in the history
  • Loading branch information
minlovehua committed Dec 28, 2023
1 parent 5dae2b6 commit 85243ed
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 28 deletions.
11 changes: 4 additions & 7 deletions src/cascader/cascader.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,10 @@
(attach)="attached()"
(positionChange)="positionChange($event)"
[cdkConnectedOverlayOpen]="menuVisible">
<div
[attr.tabindex]="-1"
#menu
[ngClass]="menuCls"
[ngStyle]="thyMenuStyle"
(mouseleave)="mouseleaveMenu($event)"
[@scaleYMotion]="'enter'">
<div [attr.tabindex]="-1" #menu [ngClass]="menuCls" [ngStyle]="thyMenuStyle" (mouseleave)="mouseleaveMenu($event)">
<!-- [@scaleYMotion]="'enter'"
(@scaleYMotion.start)="animationStart($event)"
(@scaleYMotion.done)="animationDone($event)" -->
<ng-container *ngIf="!isShowSearchPanel">
<ng-container *ngIf="columns.length > 0; else emptyPlaceholder">
<ul #cascaderOptionContainers *ngFor="let options of columns; let i = index" [ngClass]="menuColumnCls">
Expand Down
17 changes: 14 additions & 3 deletions src/cascader/cascader.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import { ThyCascaderOptionComponent } from './cascader-li.component';
import { ThyCascaderSearchOptionComponent } from './cascader-search-option.component';
import { ThyCascaderExpandTrigger, ThyCascaderOption, ThyCascaderSearchOption, ThyCascaderTriggerType } from './types';
import { ThyCascaderService } from './cascader.service';
import { scaleYMotion } from 'ngx-tethys/core';
// import { scaleYMotion } from 'ngx-tethys/core';

/**
* 级联选择菜单
Expand Down Expand Up @@ -79,8 +79,9 @@ import { scaleYMotion } from 'ngx-tethys/core';
ThyCascaderSearchOptionComponent,
ThyEmptyComponent,
ThyIconComponent
],
animations: [scaleYMotion]
]
// ,
// animations: [scaleYMotion]
})
export class ThyCascaderComponent
extends TabIndexDisabledControlValueAccessorMixin
Expand Down Expand Up @@ -629,10 +630,20 @@ export class ThyCascaderComponent
return;
}
if (this.isHoverTriggerAction()) {
console.log('---hover了---');
this.setMenuVisible(!this.menuVisible);
console.log('---setMenuVisible 了---', this.menuVisible);
}
}

animationStart(event: any) {
console.log('动画开始', event);
}

animationDone(event: any) {
console.log('动画结束', event);
}

public clickOption(option: ThyCascaderOption, index: number, event: Event | boolean): void {
this.thyCascaderService.clickOption(option, index, event, this.selectOption);
}
Expand Down
4 changes: 2 additions & 2 deletions src/cascader/examples/basic/basic.component.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<thy-cascader [thyOptions]="areaCode" [(ngModel)]="values" (ngModelChange)="selectChanges($event)" thyColumnClassName="column-class-name">
</thy-cascader>
<!-- <thy-cascader [thyOptions]="areaCode" [(ngModel)]="values" (ngModelChange)="selectChanges($event)" thyColumnClassName="column-class-name">
</thy-cascader> -->
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<thy-cascader
<!-- <thy-cascader
[thyOptions]="thyCustomerOptions"
(ngModelChange)="selectChange($event)"
[(ngModel)]="curVal"
Expand All @@ -20,4 +20,4 @@
</span>
</ng-container>
</ng-container>
</ng-template>
</ng-template> -->
4 changes: 2 additions & 2 deletions src/cascader/examples/disabled/disabled.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="custom-disabled-container">
<!-- <div class="custom-disabled-container">
<div class="mb-2">选择框禁用:</div>
<div class="d-flex mb-2">
<thy-cascader class="mr-2" [thyDisabled]="true" style="width: 200px"></thy-cascader>
Expand All @@ -24,4 +24,4 @@
<span *ngIf="isLast && label"> {{ label }}</span>
</ng-container>
</ng-template>
</div>
</div> -->
2 changes: 1 addition & 1 deletion src/cascader/examples/empty/empty.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Component } from '@angular/core';

@Component({
selector: 'thy-cascader-empty-example',
template: ` <thy-cascader [thyOptions]="[]" thyEmptyStateText="Hello World" style="width:200px"> </thy-cascader> `
template: ``
})
export class ThyCascaderEmptyExampleComponent {
public values: any[] = [];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<thy-cascader
<!-- <thy-cascader
[thyOptions]="areaCode"
(ngModelChange)="selectChanges($event)"
[(ngModel)]="values"
thyExpandTriggerAction="hover"
thyTriggerAction="hover"
style="width:200px;"
>
</thy-cascader>
</thy-cascader> -->
2 changes: 1 addition & 1 deletion src/cascader/examples/move-unfold/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
title: Move-Unfold
order: 30
order: 0
---
4 changes: 2 additions & 2 deletions src/cascader/examples/multiple/multiple.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<thy-cascader
<!-- <thy-cascader
[thyOptions]="areaCode"
[(ngModel)]="values"
[thyMultiple]="true"
Expand All @@ -12,4 +12,4 @@
<ng-container *ngFor="let label of labels; let i = index; let isLast = last">
<span *ngIf="isLast && label"> {{ label }}</span>
</ng-container>
</ng-template>
</ng-template> -->
4 changes: 2 additions & 2 deletions src/cascader/examples/search/search.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<thy-cascader
<!-- <thy-cascader
class="mb-3"
[thyOptions]="areaCode"
[thyShowSearch]="true"
Expand All @@ -22,4 +22,4 @@
<ng-container *ngFor="let label of labels; let i = index; let isLast = last">
<span *ngIf="isLast && label"> {{ label }}</span>
</ng-container>
</ng-template>
</ng-template> -->
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<thy-cascader
<!-- <thy-cascader
[thyOptions]="areaCode"
(ngModelChange)="selectChanges($event)"
[(ngModel)]="values"
[thyChangeOnSelect]="true"
style="width: 200px;"
>
</thy-cascader>
</thy-cascader> -->
4 changes: 2 additions & 2 deletions src/cascader/examples/size/size.component.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<thy-button-group thySize="sm" thyType="outline-default">
<!-- <thy-button-group thySize="sm" thyType="outline-default">
<button thyButton *ngFor="let item of sizes" (click)="size = item" [ngClass]="{ active: size === item }">
{{ item }}
</button>
</thy-button-group>
<div class="mt-4">
<thy-cascader [thyOptions]="areaCode" [(ngModel)]="values" [thySize]="size" style="width:200px"> </thy-cascader>
</div>
</div> -->

0 comments on commit 85243ed

Please sign in to comment.