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

feat(module:table): radio selection type #8823

Open
wants to merge 42 commits into
base: master
Choose a base branch
from
Open
Changes from 7 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
5c11a42
fix(module:tabs): wrong cursor
ParsaArvanehPA Feb 1, 2024
aac33c4
Merge branch 'NG-ZORRO:master' into master
ParsaArvanehPA Feb 13, 2024
f7525f5
Merge branch 'NG-ZORRO:master' into master
ParsaArvanehPA Feb 19, 2024
8a974b9
Merge branch 'NG-ZORRO:master' into master
ParsaArvanehPA Feb 19, 2024
e5276bb
Merge branch 'NG-ZORRO:master' into master
ParsaArvanehPA Feb 20, 2024
0f989fe
Merge branch 'NG-ZORRO:master' into master
ParsaArvanehPA Feb 27, 2024
ec35a90
Merge branch 'NG-ZORRO:master' into master
ParsaArvanehPA Feb 28, 2024
6ec6fe1
Merge branch 'NG-ZORRO:master' into master
ParsaArvanehPA Mar 2, 2024
988985b
feat(module:table): radio selection type
ParsaArvanehPA Mar 20, 2024
5e4dd2a
feat(module:table): radio selection type
ParsaArvanehPA Mar 20, 2024
5d1e384
Merge branch 'NG-ZORRO:master' into master
ParsaArvanehPA Mar 24, 2024
d81339e
Merge branch 'NG-ZORRO:master' into master
ParsaArvanehPA Mar 24, 2024
2284767
Merge branch 'NG-ZORRO:master' into master
ParsaArvanehPA Apr 6, 2024
0ac094d
Merge branch 'NG-ZORRO:master' into master
ParsaArvanehPA Apr 23, 2024
59d40a5
Merge branch 'NG-ZORRO:master' into master
ParsaArvanehPA May 12, 2024
82afabb
Merge branch 'NG-ZORRO:master' into master
ParsaArvanehPA Jul 14, 2024
5cad626
feat(module:table): radio selection type
ParsaArvanehPA Jul 17, 2024
8166519
feat(module:table): radio selection type
ParsaArvanehPA Jul 17, 2024
3a46b38
feat(module:table): radio selection type
ParsaArvanehPA Jul 17, 2024
11b7fc8
Merge branch 'NG-ZORRO:master' into master
ParsaArvanehPA Jul 17, 2024
ec24a0b
Merge branch 'refs/heads/master' into feature/radio-selection-in-tables
ParsaArvanehPA Jul 17, 2024
8705669
Merge branch 'NG-ZORRO:master' into master
ParsaArvanehPA Aug 4, 2024
19dd9b5
Merge branch 'refs/heads/master' into feature/radio-selection-in-tables
ParsaArvanehPA Aug 4, 2024
105ad16
feat(module:table): radio selection type
ParsaArvanehPA Aug 4, 2024
0e963ac
Merge branch 'NG-ZORRO:master' into master
ParsaArvanehPA Aug 12, 2024
2bb0cd9
Merge branch 'NG-ZORRO:master' into master
ParsaArvanehPA Sep 3, 2024
674a373
Merge branch 'NG-ZORRO:master' into master
ParsaArvanehPA Sep 8, 2024
124d3ac
Merge branch 'NG-ZORRO:master' into master
ParsaArvanehPA Sep 16, 2024
413ac69
Merge branch 'NG-ZORRO:master' into master
ParsaArvanehPA Sep 18, 2024
5bee081
Merge branch 'NG-ZORRO:master' into master
ParsaArvanehPA Sep 22, 2024
2569a26
Merge branch 'NG-ZORRO:master' into master
ParsaArvanehPA Sep 23, 2024
1e6cc5e
Merge branch 'NG-ZORRO:master' into master
ParsaArvanehPA Sep 28, 2024
e0eb45a
Merge branch 'NG-ZORRO:master' into master
ParsaArvanehPA Sep 30, 2024
aa3571f
Merge branch 'NG-ZORRO:master' into master
ParsaArvanehPA Oct 1, 2024
eb50945
Merge branch 'refs/heads/master' into feature/radio-selection-in-tables
ParsaArvanehPA Oct 5, 2024
44d9311
Merge branch 'NG-ZORRO:master' into master
ParsaArvanehPA Oct 5, 2024
ca70f46
Merge branch 'NG-ZORRO:master' into master
ParsaArvanehPA Oct 8, 2024
5227c13
Merge branch 'NG-ZORRO:master' into master
ParsaArvanehPA Oct 15, 2024
590f22c
Merge branch 'NG-ZORRO:master' into master
ParsaArvanehPA Oct 22, 2024
1577205
Merge branch 'NG-ZORRO:master' into master
ParsaArvanehPA Nov 2, 2024
912db8e
Merge branch 'NG-ZORRO:master' into master
ParsaArvanehPA Nov 23, 2024
ccbadd6
Merge branch 'master' into feature/radio-selection-in-table
ParsaArvanehPA Nov 23, 2024
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
60 changes: 28 additions & 32 deletions components/table/src/addon/selection.component.ts
Original file line number Diff line number Diff line change
@@ -20,44 +20,40 @@
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
template: `
<label
*ngIf="showCheckbox && nzRowSelectionType === 'checkbox'"
nz-checkbox
[class.ant-table-selection-select-all-custom]="showRowSelection"
[ngModel]="checked"
[nzDisabled]="disabled"
[nzIndeterminate]="indeterminate"
[attr.aria-label]="label"
(ngModelChange)="onCheckedChange($event)"
></label>
<div class="ant-table-selection-extra" *ngIf="showRowSelection && nzRowSelectionType === 'checkbox'">
<span nz-dropdown class="ant-table-selection-down" nzPlacement="bottomLeft" [nzDropdownMenu]="selectionMenu">
<span nz-icon nzType="down"></span>
</span>
<nz-dropdown-menu #selectionMenu="nzDropdownMenu">
<ul nz-menu class="ant-table-selection-menu">
<li nz-menu-item *ngFor="let selection of listOfSelections" (click)="selection.onSelect()">
{{ selection.text }}
</li>
</ul>
</nz-dropdown-menu>
</div>
@if (showCheckbox && nzRowSelectionType === 'checkbox') {
<label
nz-checkbox
[class.ant-table-selection-select-all-custom]="showRowSelection"
[ngModel]="checked"
[nzDisabled]="disabled"
[nzIndeterminate]="indeterminate"
[attr.aria-label]="label"
(ngModelChange)="onCheckedChange($event)"
></label>
}
@if (showRowSelection && nzRowSelectionType === 'checkbox') {
<div class="ant-table-selection-extra">
<span nz-dropdown class="ant-table-selection-down" nzPlacement="bottomLeft" [nzDropdownMenu]="selectionMenu">
<span nz-icon nzType="down"></span>
</span>
<nz-dropdown-menu #selectionMenu="nzDropdownMenu">
<ul nz-menu class="ant-table-selection-menu">
@for (selection of listOfSelections; track selection) {
<li nz-menu-item (click)="selection.onSelect()">
{{ selection.text }}
</li>
}
</ul>
</nz-dropdown-menu>
</div>
}
`,
host: { class: 'ant-table-selection' },
imports: [
NgIf,
FormsModule,
NzCheckboxModule,
NzDropDownModule,
NzIconModule,
NgForOf,
NzRadioComponent,
NzRadioGroupComponent
],
imports: [FormsModule, NzCheckboxModule, NzDropDownModule, NzIconModule, NzRadioComponent, NzRadioGroupComponent],
standalone: true
})
export class NzTableSelectionComponent {
@Input() nzRowSelectionType: NzRowSelectionType = 'checkbox';

Check warning on line 56 in components/table/src/addon/selection.component.ts

Codecov / codecov/patch

components/table/src/addon/selection.component.ts#L56

Added line #L56 was not covered by tests
@Input() listOfSelections: Array<{ text: string; onSelect(...args: NzSafeAny[]): NzSafeAny }> = [];
@Input() checked = false;
@Input() disabled = false;
63 changes: 26 additions & 37 deletions components/table/src/cell/td-addon.component.ts
Original file line number Diff line number Diff line change
@@ -21,8 +21,6 @@
import { FormsModule } from '@angular/forms';

import { NzCheckboxModule } from 'ng-zorro-antd/checkbox';
import { BooleanInput } from 'ng-zorro-antd/core/types';
import { InputBoolean } from 'ng-zorro-antd/core/util';
import { NzRadioComponent, NzRadioGroupComponent } from 'ng-zorro-antd/radio';

import { NzRowExpandButtonDirective } from '../addon/row-expand-button.directive';
@@ -47,44 +45,35 @@
(expandChange)="onExpandChange($event)"
[spaceMode]="!nzShowExpand"
></button>
</ng-template>
<ng-container *ngIf="nzExpandIcon; else rowExpand">
<ng-template [ngTemplateOutlet]="nzExpandIcon"></ng-template>
</ng-container>
</ng-container>
<label
nz-checkbox
*ngIf="nzShowCheckbox"
[nzDisabled]="nzDisabled"
[ngModel]="nzChecked"
[nzIndeterminate]="nzIndeterminate"
[attr.aria-label]="nzLabel"
(ngModelChange)="onCheckedChange($event)"
></label>
<label
nz-radio
*ngIf="nzShowRadio"
[nzDisabled]="nzDisabled"
[ngModel]="nzChecked"
[attr.aria-label]="nzLabel"
(ngModelChange)="onCheckedChange($event)"
></label>
}
}
@if (nzShowCheckbox) {
<label
nz-checkbox
[nzDisabled]="nzDisabled"
[ngModel]="nzChecked"
[nzIndeterminate]="nzIndeterminate"
[attr.aria-label]="nzLabel"
(ngModelChange)="onCheckedChange($event)"
></label>
} @else if (nzShowRadio) {
<label
nz-radio
[nzDisabled]="nzDisabled"
[ngModel]="nzChecked"
[attr.aria-label]="nzLabel"
(ngModelChange)="onCheckedChange($event)"
></label>
}
<ng-content></ng-content>
`,
host: {
'[class.ant-table-cell-with-append]': `nzShowExpand || nzIndentSize > 0`,
'[class.ant-table-selection-column]': `nzShowCheckbox || nzShowRadio`
},
imports: [
NzRowIndentDirective,
NzRowExpandButtonDirective,
NgIf,
NgTemplateOutlet,
NzCheckboxModule,
FormsModule,
imports: [NzRowIndentDirective, NzRowExpandButtonDirective, NgTemplateOutlet, NzCheckboxModule, FormsModule,
NzRadioComponent,
NzRadioGroupComponent
],
NzRadioGroupComponent],
standalone: true
})
export class NzTdAddOnComponent implements OnChanges {
@@ -94,10 +83,10 @@
@Input() nzIndeterminate = false;
@Input() nzLabel: string | null = null;
@Input() nzIndentSize = 0;
@Input() @InputBoolean() nzShowExpand = false;
@Input() @InputBoolean() nzShowCheckbox = false;
@Input() @InputBoolean() nzShowRadio = false;
@Input() @InputBoolean() nzExpand = false;
@Input({ transform: booleanAttribute }) nzShowExpand = false;
@Input({ transform: booleanAttribute }) nzShowCheckbox = false;
@Input({ transform: booleanAttribute }) nzShowRadio = false;
@Input({ transform: booleanAttribute }) nzExpand = false;
@Input() nzExpandIcon: TemplateRef<void> | null = null;
@Output() readonly nzCheckedChange = new EventEmitter<boolean>();
@Output() readonly nzExpandChange = new EventEmitter<boolean>();
@@ -130,7 +119,7 @@
if (this.nzRowSelectionType === 'checkbox') {
this.nzShowCheckbox = true;
} else {
this.nzShowRadio = true;

Check warning on line 122 in components/table/src/cell/td-addon.component.ts

Codecov / codecov/patch

components/table/src/cell/td-addon.component.ts#L122

Added line #L122 was not covered by tests
}
}
}
6 changes: 3 additions & 3 deletions components/table/src/cell/th-selection.component.ts
Original file line number Diff line number Diff line change
@@ -47,13 +47,13 @@
})
export class NzThSelectionComponent implements OnChanges {
@Input() nzSelections: Array<{ text: string; onSelect(...args: NzSafeAny[]): NzSafeAny }> = [];
@Input() nzChecked = false;
@Input() nzRowSelectionType: NzRowSelectionType = 'checkbox';
@Input() nzDisabled = false;
@Input({ transform: booleanAttribute }) nzChecked = false;
@Input({ transform: booleanAttribute }) nzDisabled = false;
@Input() nzIndeterminate = false;
@Input() nzLabel: string | null = null;
@Input({ transform: booleanAttribute }) nzShowCheckbox = false;
@Input({ transform: booleanAttribute }) nzShowRowSelection = false;
@Input() nzRowSelectionType: NzRowSelectionType = 'checkbox';

Check warning on line 56 in components/table/src/cell/th-selection.component.ts

Codecov / codecov/patch

components/table/src/cell/th-selection.component.ts#L56

Added line #L56 was not covered by tests
@Output() readonly nzCheckedChange = new EventEmitter<boolean>();

private isNzShowExpandChanged = false;