Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit66ac009

Browse files
committed
refactor(pagination): input transform for disabled prop, cleanups
1 parentf4c29f8 commit66ac009

File tree

4 files changed

+41
-7
lines changed

4 files changed

+41
-7
lines changed

‎CHANGELOG.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
---
44

5+
####`5.5.22` next
6+
7+
- refactor(pagination): input transform for disabled prop, cleanups
8+
9+
---
10+
511
####`5.5.21`
612

713
- chore(dependencies): update to`Angular 20.3.10`

‎projects/coreui-angular/src/lib/pagination/page-item/page-item.directive.ts‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1-
import{computed,contentChild,Directive,effect,ElementRef,inject,input,Renderer2}from'@angular/core';
1+
import{
2+
booleanAttribute,
3+
computed,
4+
contentChild,
5+
Directive,
6+
effect,
7+
ElementRef,
8+
inject,
9+
input,
10+
Renderer2
11+
}from'@angular/core';
12+
import{BooleanInput}from'@angular/cdk/coercion';
213

314
import{PageLinkDirective}from'../page-link/page-link.directive';
415

@@ -11,6 +22,8 @@ import { PageLinkDirective } from '../page-link/page-link.directive';
1122
}
1223
})
1324
exportclassPageItemDirective{
25+
staticngAcceptInputType_disabled:BooleanInput;
26+
1427
readonly #renderer=inject(Renderer2);
1528

1629
/**
@@ -23,7 +36,7 @@ export class PageItemDirective {
2336
* Toggle the disabled state for the component.
2437
*@return boolean
2538
*/
26-
readonlydisabled=input<boolean>();
39+
readonlydisabled=input(false,{transform:booleanAttribute});
2740

2841
readonlyariaCurrent=computed(()=>{
2942
returnthis.active() ?'page' :null;
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
import{TestBed}from'@angular/core/testing';
12
import{PageLinkDirective}from'./page-link.directive';
23

34
describe('PageLinkDirective',()=>{
45
it('should create an instance',()=>{
5-
constdirective=newPageLinkDirective();
6-
expect(directive).toBeTruthy();
6+
TestBed.runInInjectionContext(()=>{
7+
constdirective=newPageLinkDirective();
8+
expect(directive).toBeTruthy();
9+
});
710
});
811
});
Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
1-
import{Directive}from'@angular/core';
1+
import{booleanAttribute,computed,Directive,input}from'@angular/core';
2+
import{BooleanInput}from'@angular/cdk/coercion';
23

34
@Directive({
45
selector:'[cPageLink]',
5-
host:{class:'page-link'}
6+
host:{class:'page-link','[class]':'hostClasses()'}
67
})
7-
exportclassPageLinkDirective{}
8+
exportclassPageLinkDirective{
9+
staticngAcceptInputType_disabled:BooleanInput;
10+
11+
readonlydisabled=input(false,{transform:booleanAttribute});
12+
13+
readonlyhostClasses=computed(()=>{
14+
return{
15+
'page-link':true,
16+
disabled:this.disabled()
17+
}asRecord<string,boolean>;
18+
});
19+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp