Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: select not filterable state #550

Merged
merged 1 commit into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/paginator/__snapshots__/paginator.component.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ exports[`PaginatorComponent should change page size correctly 1`] = `
autocomplete="off"
class="aui-select__input aui-input aui-input--medium aui-select__input-inaction"
placeholder=""
readonly=""
/>
<div
class="aui-input aui-input--medium aui-select__label-container"
Expand Down Expand Up @@ -416,6 +417,7 @@ exports[`PaginatorComponent should render current template 1`] = `
autocomplete="off"
class="aui-select__input aui-input aui-input--medium aui-select__input-inaction"
placeholder=""
readonly=""
/>
<div
class="aui-input aui-input--medium aui-select__label-container"
Expand Down Expand Up @@ -703,6 +705,7 @@ exports[`PaginatorComponent should render current template 2`] = `
class="aui-select__input aui-input aui-input--medium aui-select__input-inaction"
disabled=""
placeholder=""
readonly=""
/>
<div
class="aui-input aui-input--medium aui-select__label-container"
Expand Down
226 changes: 114 additions & 112 deletions src/paginator/paginator.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,122 +3,124 @@
*ngFor="let layout of getLayoutArr()"
[class]="bem.element('layout')"
>
<div
*ngIf="layout === 'pager'"
[class]="bem.element('pager')"
>
<button
[ngClass]="bem.element('navigator')"
aui-button
[disabled]="disabled || currentPage <= 1"
(click)="navigate(-1)"
<ng-container [ngSwitch]="layout">
<div
*ngSwitchCase="'pager'"
[class]="bem.element('pager')"
>
<aui-icon icon="angle_left"></aui-icon>
</button>
<button
[ngClass]="bem.element('page')"
[aui-button]="currentPage === 1 ? 'primary' : 'default'"
[plain]="!(currentPage === 1)"
[disabled]="disabled"
(click)="jumpTo(1)"
>
1
</button>
<button
*ngIf="pageCount > 7 && currentPage > 4"
[ngClass]="bem.element('fast-navigator')"
aui-button
[disabled]="disabled"
(click)="navigate(-5)"
>
<aui-icon icon="ellipsis_s"></aui-icon>
<aui-icon icon="angles_left"></aui-icon>
</button>
<button
*ngFor="let page of getCenterPages(); trackBy: trackByIndex"
[ngClass]="bem.element('page')"
[aui-button]="currentPage === page ? 'primary' : 'default'"
[plain]="!(currentPage === page)"
[disabled]="disabled"
(click)="jumpTo(page)"
>
{{ page }}
</button>
<button
*ngIf="pageCount > 7 && currentPage < pageCount - 3"
[ngClass]="bem.element('fast-navigator')"
aui-button
[disabled]="disabled"
(click)="navigate(5)"
<button
[ngClass]="bem.element('navigator')"
aui-button
[disabled]="disabled || currentPage <= 1"
(click)="navigate(-1)"
>
<aui-icon icon="angle_left"></aui-icon>
</button>
<button
[ngClass]="bem.element('page')"
[aui-button]="currentPage === 1 ? 'primary' : 'default'"
[plain]="!(currentPage === 1)"
[disabled]="disabled"
(click)="jumpTo(1)"
>
1
</button>
<button
*ngIf="pageCount > 7 && currentPage > 4"
[ngClass]="bem.element('fast-navigator')"
aui-button
[disabled]="disabled"
(click)="navigate(-5)"
>
<aui-icon icon="ellipsis_s"></aui-icon>
<aui-icon icon="angles_left"></aui-icon>
</button>
<button
*ngFor="let page of getCenterPages(); trackBy: trackByIndex"
[ngClass]="bem.element('page')"
[aui-button]="currentPage === page ? 'primary' : 'default'"
[plain]="!(currentPage === page)"
[disabled]="disabled"
(click)="jumpTo(page)"
>
{{ page }}
</button>
<button
*ngIf="pageCount > 7 && currentPage < pageCount - 3"
[ngClass]="bem.element('fast-navigator')"
aui-button
[disabled]="disabled"
(click)="navigate(5)"
>
<aui-icon icon="ellipsis_s"></aui-icon>
<aui-icon icon="angles_right"></aui-icon>
</button>
<button
*ngIf="pageCount > 1"
[ngClass]="bem.element('page')"
[aui-button]="currentPage === pageCount ? 'primary' : 'default'"
[plain]="!(currentPage === pageCount)"
[disabled]="disabled"
(click)="jumpTo(pageCount)"
>
{{ pageCount }}
</button>
<button
aui-button
[ngClass]="bem.element('navigator')"
[disabled]="disabled || currentPage >= pageCount"
(click)="navigate(1)"
>
<aui-icon icon="angle_right"></aui-icon>
</button>
</div>
<div
*ngSwitchCase="'total'"
[class]="bem.element('total')"
>
<aui-icon icon="ellipsis_s"></aui-icon>
<aui-icon icon="angles_right"></aui-icon>
</button>
<button
*ngIf="pageCount > 1"
[ngClass]="bem.element('page')"
[aui-button]="currentPage === pageCount ? 'primary' : 'default'"
[plain]="!(currentPage === pageCount)"
[disabled]="disabled"
(click)="jumpTo(pageCount)"
{{ intl.getTotalLabel(total || 0) }}
</div>
<div
*ngSwitchCase="'sizes'"
[class]="bem.element('sizes')"
>
{{ pageCount }}
</button>
<button
aui-button
[ngClass]="bem.element('navigator')"
[disabled]="disabled || currentPage >= pageCount"
(click)="navigate(1)"
<aui-select
[disabled]="disabled"
[value]="pageSize"
[filterable]="false"
(valueChange)="changePageSize($event)"
>
<aui-option
*ngFor="let size of pageSizeOptions"
[value]="size"
>
{{ size }}
</aui-option>
</aui-select>
<span>{{ intl.itemsPerPageLabel }}</span>
</div>
<div
*ngSwitchCase="'jumper'"
[class]="bem.element('jumper')"
>
<aui-icon icon="angle_right"></aui-icon>
</button>
</div>
<div
*ngIf="layout === 'total'"
[class]="bem.element('total')"
>
{{ intl.getTotalLabel(total) }}
</div>
<div
*ngIf="layout === 'sizes'"
[class]="bem.element('sizes')"
>
<aui-select
[disabled]="disabled"
[value]="pageSize"
[filterable]="false"
(valueChange)="changePageSize($event)"
<span *ngIf="intl.jumperLabelPrefix">{{ intl.jumperLabelPrefix }}</span>
<input
aui-input
type="number"
min="1"
[max]="pageCount"
[value]="currentPage"
[disabled]="disabled"
(keydown)="onKeydown($event)"
/>
<span *ngIf="intl.jumperLabelSuffix">{{ intl.jumperLabelSuffix }}</span>
</div>
<div
*ngSwitchCase="'content'"
[class]="bem.element('content')"
>
<aui-option
*ngFor="let size of pageSizeOptions"
[value]="size"
>
{{ size }}
</aui-option>
</aui-select>
<span>{{ intl.itemsPerPageLabel }}</span>
</div>
<div
*ngIf="layout === 'jumper'"
[class]="bem.element('jumper')"
>
<span *ngIf="intl.jumperLabelPrefix">{{ intl.jumperLabelPrefix }}</span>
<input
aui-input
type="number"
min="1"
[max]="pageCount"
[value]="currentPage"
[disabled]="disabled"
(keydown)="onKeydown($event)"
/>
<span *ngIf="intl.jumperLabelSuffix">{{ intl.jumperLabelSuffix }}</span>
</div>
<div
*ngIf="layout === 'content'"
[class]="bem.element('content')"
>
<ng-content></ng-content>
</div>
<ng-content></ng-content>
</div>
</ng-container>
</div>
</div>
4 changes: 3 additions & 1 deletion src/paginator/paginator.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NgFor, NgIf, NgClass } from '@angular/common';
import { NgFor, NgIf, NgClass, NgSwitch, NgSwitchCase } from '@angular/common';
import {
ChangeDetectionStrategy,
ChangeDetectorRef,
Expand Down Expand Up @@ -31,6 +31,8 @@ import { PaginatorIntl } from './paginator-intl';
imports: [
NgFor,
NgIf,
NgSwitch,
NgSwitchCase,
ButtonComponent,
NgClass,
IconComponent,
Expand Down
2 changes: 1 addition & 1 deletion src/select/select.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
aui-input
[disabled]="disabled"
[size]="size"
[readonly]="readonly"
[readonly]="readonly || inaction"
[placeholder]="!(hasSelected$ | async) ? placeholder : ''"
(input)="onInput($event)"
(keydown)="onKeyDown($event)"
Expand Down
Loading