Skip to content

Commit

Permalink
fix(select): auto scroll to focused option
Browse files Browse the repository at this point in the history
  • Loading branch information
fengtianze committed Aug 12, 2020
1 parent de02bc7 commit 1bec1e5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/select/base-select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export abstract class BaseSelect<T> extends CommonFormControl<T>
@ViewChild('tooltipRef', { static: true })
protected tooltipRef: TooltipDirective;

@ViewChild('optionListRef', { static: true })
@ViewChild('optionListRef', { static: false })
protected optionListRef: ElementRef;

@ViewChild('inputtingOption', { static: false })
Expand Down
43 changes: 17 additions & 26 deletions stories/dropdown/dropdown.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { ButtonModule, IconModule, DropdownModule } from '@alauda/ui';
<Preview>
<Story name="basic" height="240px">
{{
template: ` /* HTML */ <button
template: /* HTML */ `<button
aui-button="primary"
[plain]="true"
[auiDropdown]="menu"
Expand All @@ -43,8 +43,7 @@ import { ButtonModule, IconModule, DropdownModule } from '@alauda/ui';
<aui-menu-item [disabled]="true">
禁用按钮
</aui-menu-item>
</aui-menu>
`,
</aui-menu>`,
}}
</Story>
</Preview>
Expand All @@ -54,8 +53,7 @@ import { ButtonModule, IconModule, DropdownModule } from '@alauda/ui';
<Preview>
<Story name="submenu" height="240px">
{{
template: `
<button
template: /* HTML */ `<button
aui-button="primary"
[plain]="true"
[auiDropdown]="menu"
Expand All @@ -72,8 +70,7 @@ import { ButtonModule, IconModule, DropdownModule } from '@alauda/ui';
<aui-menu-item>操作四</aui-menu-item>
<aui-menu-item>操作五</aui-menu-item>
</aui-submenu>
</aui-menu>
`,
</aui-menu>`,
}}
</Story>
</Preview>
Expand All @@ -83,8 +80,7 @@ import { ButtonModule, IconModule, DropdownModule } from '@alauda/ui';
<Preview>
<Story name="group" height="340px">
{{
template: `
<button
template: /* HTML */ `<button
aui-button="primary"
[plain]="true"
[auiDropdown]="menu"
Expand All @@ -107,8 +103,7 @@ import { ButtonModule, IconModule, DropdownModule } from '@alauda/ui';
<aui-menu-item>操作五</aui-menu-item>
<aui-menu-item>操作六</aui-menu-item>
</aui-menu-group>
</aui-menu>
`,
</aui-menu>`,
}}
</Story>
</Preview>
Expand All @@ -118,17 +113,15 @@ import { ButtonModule, IconModule, DropdownModule } from '@alauda/ui';
<Preview>
<Story name="dropdown-button" height="200px">
{{
template: `
<aui-dropdown-button type="primary">
dropdown button
<aui-menu>
<aui-menu-item>操作一</aui-menu-item>
<aui-menu-item>操作二</aui-menu-item>
<aui-menu-item>操作三</aui-menu-item>
<aui-menu-item>操作四</aui-menu-item>
</aui-menu>
</aui-dropdown-button>
`,
template: /* HTML */ `<aui-dropdown-button type="primary">
dropdown button
<aui-menu>
<aui-menu-item>操作一</aui-menu-item>
<aui-menu-item>操作二</aui-menu-item>
<aui-menu-item>操作三</aui-menu-item>
<aui-menu-item>操作四</aui-menu-item>
</aui-menu>
</aui-dropdown-button>`,
}}
</Story>
</Preview>
Expand All @@ -138,8 +131,7 @@ import { ButtonModule, IconModule, DropdownModule } from '@alauda/ui';
<Preview>
<Story name="menu-template" height="180px">
{{
template: `
<button
template: /* HTML */ `<button
aui-button="primary"
[plain]="true"
[auiDropdown]="menu"
Expand All @@ -163,8 +155,7 @@ import { ButtonModule, IconModule, DropdownModule } from '@alauda/ui';
<aui-menu-item>更新</aui-menu-item>
<aui-menu-item *ngIf="canDelete">删除</aui-menu-item>
</ng-template>
</aui-menu>
`,
</aui-menu>`,
}}
</Story>
</Preview>
Expand Down

0 comments on commit 1bec1e5

Please sign in to comment.