Skip to content

Commit

Permalink
Merge branch 'v19'
Browse files Browse the repository at this point in the history
  • Loading branch information
EnochGao committed Feb 10, 2025
2 parents c7fb8d7 + defc6ed commit 99e0ec2
Show file tree
Hide file tree
Showing 94 changed files with 7,538 additions and 3,867 deletions.
2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
registry=https://registry.npmmirror.com
# registry=https://registry.npmmirror.com
3 changes: 2 additions & 1 deletion README-zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ npm install [email protected] --save

| angular | ng-zorro-antd | ng-zorro-antd-extension | LTS ENDS |
| ------- | ------------- | ----------------------- | --------------- |
| ^18.0.0 | ^18.0.0 | ^18.0.0 | 2025-11-xx |
| ^19.0.0 | ^19.0.0 | ^19.0.0 | 2026-05-19 |
| ^18.0.0 | ^18.0.0 | ^18.0.0 | 2025-11-19 |
| ^17.0.0 | ^17.0.0 | ^15.6.0 | 2025-05-15 |
| ^16.0.0 | ^16.0.0 | ^15.6.0 | 2024-11-08(end) |
| ^15.0.0 | ^15.0.0 | ^15.0.0 | 2024-05-18(end) |
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ export class AppModule {}

| angular | ng-zorro-antd | ng-zorro-antd-extension | LTS ends |
| ------- | ------------- | ----------------------- | --------------- |
| ^18.0.0 | ^18.0.0 | ^18.0.0 | 2025-11-xx |
| ^19.0.0 | ^19.0.0 | ^19.0.0 | 2026-05-19 |
| ^18.0.0 | ^18.0.0 | ^18.0.0 | 2025-11-19 |
| ^17.0.0 | ^17.0.0 | ^15.6.0 | 2025-05-15 |
| ^16.0.0 | ^16.0.0 | ^15.6.0 | 2024-11-08(end) |
| ^15.0.0 | ^15.0.0 | ^15.0.0 | 2024-05-18(end) |
Expand Down
3 changes: 2 additions & 1 deletion components/README-zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ export class AppModule {}

| angular | ng-zorro-antd | ng-zorro-antd-extension | LTS ends |
| ------- | ------------- | ----------------------- | --------------- |
| ^18.0.0 | ^18.0.0 | ^18.0.0 | 2025-11-xx |
| ^19.0.0 | ^19.0.0 | ^19.0.0 | 2026-05-19 |
| ^18.0.0 | ^18.0.0 | ^18.0.0 | 2025-11-19 |
| ^17.0.0 | ^17.0.0 | ^15.6.0 | 2025-05-15 |
| ^16.0.0 | ^16.0.0 | ^15.6.0 | 2024-11-08(end) |
| ^15.0.0 | ^15.0.0 | ^15.0.0 | 2024-05-18(end) |
Expand Down
3 changes: 2 additions & 1 deletion components/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ export class AppModule {}

| angular | ng-zorro-antd | ng-zorro-antd-extension | LTS ends |
| ------- | ------------- | ----------------------- | --------------- |
| ^18.0.0 | ^18.0.0 | ^18.0.0 | 2025-11-xx |
| ^19.0.0 | ^19.0.0 | ^19.0.0 | 2026-05-19 |
| ^18.0.0 | ^18.0.0 | ^18.0.0 | 2025-11-19 |
| ^17.0.0 | ^17.0.0 | ^15.6.0 | 2025-05-15 |
| ^16.0.0 | ^16.0.0 | ^15.6.0 | 2024-11-08(end) |
| ^15.0.0 | ^15.0.0 | ^15.0.0 | 2024-05-18(end) |
Expand Down
1 change: 0 additions & 1 deletion components/acl/examples/acl/acl.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { NzDividerModule } from 'ng-zorro-antd/divider';

import { NzxAclModule, NzxAclService } from 'ng-zorro-antd-extension/acl';
@Component({
standalone: true,
imports: [CommonModule, NzButtonModule, NzDividerModule, NzxAclModule],
selector: 'nzx-acl-example',
template: `
Expand Down
4 changes: 1 addition & 3 deletions components/acl/nzx-acl.module.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { CommonModule } from '@angular/common';
import { ModuleWithProviders, NgModule } from '@angular/core';
import { NzxAclDirective } from './nzx-acl.directive';
import { NzxAclService } from './nzx-acl.service';

@NgModule({
imports: [CommonModule],
declarations: [NzxAclDirective],
imports: [NzxAclDirective],
exports: [NzxAclDirective],
})
export class NzxAclModule {
Expand Down
9 changes: 6 additions & 3 deletions components/blank-field/blank-field.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* eslint-disable @angular-eslint/component-selector */
import { CommonModule } from '@angular/common';
import {
ChangeDetectionStrategy,
Component,
Expand All @@ -14,9 +15,11 @@ interface Context {
}
@Component({
selector: 'nzx-blank-field',
template: ` <ng-container
*ngTemplateOutlet="templateRefExp; context: contextExp"
></ng-container>`,
imports: [CommonModule],
template: `
<ng-container *ngTemplateOutlet="templateRefExp; context: contextExp">
</ng-container>
`,
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [
{
Expand Down
4 changes: 1 addition & 3 deletions components/blank-field/blank-field.module.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';

import { NzxBlankFieldComponent } from './blank-field.component';

@NgModule({
declarations: [NzxBlankFieldComponent],
imports: [CommonModule],
imports: [NzxBlankFieldComponent],
exports: [NzxBlankFieldComponent],
})
export class NzxBlankFieldModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { NzSpaceModule } from 'ng-zorro-antd/space';
import { NzSwitchModule } from 'ng-zorro-antd/switch';

@Component({
standalone: true,
imports: [
CommonModule,
FormsModule,
Expand Down
69 changes: 25 additions & 44 deletions components/checkbox/checkbox-group.component.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import { CommonModule } from '@angular/common';
import {
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
forwardRef,
Input,
} from '@angular/core';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
import {
ControlValueAccessor,
FormsModule,
NG_VALUE_ACCESSOR,
} from '@angular/forms';

import { NzxOptions } from 'ng-zorro-antd-extension/types';
import { NzCheckboxModule, NzCheckboxOption } from 'ng-zorro-antd/checkbox';

/**
* nzx-checkbox-group
Expand All @@ -16,10 +22,12 @@ import { NzxOptions } from 'ng-zorro-antd-extension/types';
@Component({
selector: 'nzx-checkbox-group',
exportAs: 'NzxCheckboxGroup',
imports: [CommonModule, FormsModule, NzCheckboxModule],
template: `
<nz-checkbox-group
[nzDisabled]="nzDisabled"
[ngModel]="_checkOptions"
[ngModel]="selectValue"
[nzOptions]="checkOptions"
(ngModelChange)="valueChange($event)"
>
</nz-checkbox-group>
Expand All @@ -33,21 +41,8 @@ import { NzxOptions } from 'ng-zorro-antd-extension/types';
},
],
})
export class NzxCheckboxGroupComponent
implements ControlValueAccessor
{
@Input() set checkOptions(value: Array<NzxOptions<string | number>>) {
this._checkOptions = value.map((i) => {
return { ...i, checked: false };
});
}

_checkOptions: Array<{
label: string;
value: number | string;
disabled?: boolean;
checked?: boolean;
}> = [];
export class NzxCheckboxGroupComponent implements ControlValueAccessor {
@Input() checkOptions: Array<NzCheckboxOption> = [];

/**
* 自定义函数用来格式化输输入内容用来回显
Expand All @@ -62,22 +57,25 @@ export class NzxCheckboxGroupComponent
checkedList;

nzDisabled = false;
private templateValue: any;
selectValue = [];

private propagateChange = (_: any) => {};

constructor(private cd: ChangeDetectorRef) {}

writeValue(v: (string | number)[] | any): void {
this._checkOptions.forEach((i) => (i['checked'] = false));
this.templateValue = v;
this._updateView();
console.log(v);
if (v) {
this.selectValue = this.customFormateInFn(v);
} else {
this.selectValue = [];
}
this.cd.markForCheck();
}

/**更新视图 */
updateView() {
setTimeout(() => {
this._updateView();
}, 0);
this.cd.markForCheck();
}

registerOnChange(fn: any): void {
Expand All @@ -91,25 +89,8 @@ export class NzxCheckboxGroupComponent
this.cd.markForCheck();
}

valueChange(
value: Array<{
label: string;
value: number | string;
checked?: boolean;
}>
): void {
const checkedList = value.filter((i) => i['checked']).map((i) => i.value);
this.propagateChange(this.customFormateOutFn(checkedList));
}

private _updateView() {
let list = this.customFormateInFn(this.templateValue) || [];
list.forEach((value: string | number) => {
const index = this._checkOptions.findIndex((i) => i.value === value);
if (index > -1) {
this._checkOptions[index]['checked'] = true;
}
});
this.cd.markForCheck();
valueChange(value: Array<number | string>): void {
console.log(value);
this.propagateChange(this.customFormateOutFn(value));
}
}
7 changes: 1 addition & 6 deletions components/checkbox/checkbox.module.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { CommonModule } from '@angular/common';

import { NzCheckboxModule } from 'ng-zorro-antd/checkbox';

import { NzxCheckboxGroupComponent } from './checkbox-group.component';

@NgModule({
declarations: [NzxCheckboxGroupComponent],
imports: [CommonModule, FormsModule, NzCheckboxModule],
imports: [NzxCheckboxGroupComponent],
exports: [NzxCheckboxGroupComponent],
})
export class NzxCheckboxModule {}
15 changes: 11 additions & 4 deletions components/checkbox/doc/zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ order: 1

提供`customFormateInFn``customFormateOutFn`自定义函数转换出入参格式

**注意(v19+):zorro19版本增加了`nzOptions`属性,解决了checkbox group使用不便的情况,请酌情使用此组件,现与zorro的不同之处仅仅是自定义函数转换出入参**

## 版本支持

<label type="success">v13.0.0+</label>
Expand All @@ -18,14 +20,19 @@ order: 1
### 引入

```ts
import { NzxCheckboxModule } from "ng-zorro-antd-extension/checkbox";
import { NzxCheckboxModule } from 'ng-zorro-antd-extension/checkbox';
```

### html

```html
<form [formGroup]="form">
<nzx-checkbox-group [customFormateInFn]="inFn" [customFormateOutFn]="outFn" [checkOptions]="checkOptions" formControlName="value"></nzx-checkbox-group>
<nzx-checkbox-group
[customFormateInFn]="inFn"
[customFormateOutFn]="outFn"
[checkOptions]="checkOptions"
formControlName="value"
></nzx-checkbox-group>
</form>
```

Expand All @@ -34,8 +41,8 @@ import { NzxCheckboxModule } from "ng-zorro-antd-extension/checkbox";
```ts
class CheckboxGroupDemoComponent implements OnInit {
checkOptions = [
{ label: "客户信赖", value: 1 },
{ label: "技术评估", value: 2 },
{ label: '客户信赖', value: 1 },
{ label: '技术评估', value: 2 },
];
form!: FormGroup;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,18 @@ import {
Component,
OnInit,
ViewChild,
ViewEncapsulation,
} from '@angular/core';
import { FormBuilder, FormGroup, ReactiveFormsModule } from '@angular/forms';

import { NzButtonModule } from 'ng-zorro-antd/button';
import { NzCardModule } from 'ng-zorro-antd/card';

import {
NzxCheckboxModule,
NzxCheckboxGroupComponent,
NzxCheckboxModule,
} from 'ng-zorro-antd-extension/checkbox';

@Component({
standalone: true,
imports: [
CommonModule,
ReactiveFormsModule,
Expand Down
2 changes: 0 additions & 2 deletions components/checkbox/public-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
*/


export * from './checkbox-group.component';
export * from './checkbox.module';
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
ChangeDetectionStrategy,
Component,
Input,
OnDestroy,
Expand All @@ -11,6 +12,8 @@ import { FormGroup } from '@angular/forms';
import { Subject, takeUntil } from 'rxjs';
import { NzxQueryConfigService } from '../query-config.service';
import { NzxQueryControlOptions, NzxQueryControlType } from '../type';
import { NzFormModule } from 'ng-zorro-antd/form';
import { NgIf } from '@angular/common';

@Component({
selector: 'nzx-configurable-query-item',
Expand All @@ -30,6 +33,8 @@ import { NzxQueryControlOptions, NzxQueryControlType } from '../type';
</nz-form-control>
</nz-form-item>
`,
imports: [NzFormModule,NgIf],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class NzxConfigurableQueryItemComponent implements OnInit, OnDestroy {
@Input() form!: FormGroup;
Expand Down
20 changes: 18 additions & 2 deletions components/configurable-query/configurable-query.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,21 @@ import {
SimpleChanges,
ViewChild,
} from '@angular/core';
import { AbstractControl, FormBuilder, FormGroup } from '@angular/forms';
import { AbstractControl, FormBuilder, FormGroup, ReactiveFormsModule } from '@angular/forms';

import { NzxQueryI18nInterface } from 'ng-zorro-antd-extension/i18n';
import { updateControlStatus } from 'ng-zorro-antd-extension/util';
import { NzJustify } from 'ng-zorro-antd/grid';
import { NzGridModule, NzJustify } from 'ng-zorro-antd/grid';
import { NzI18nService } from 'ng-zorro-antd/i18n';
import { Subject, fromEvent, takeUntil } from 'rxjs';
import { NzxControlDirective } from './control.directive';
import { NzxQueryControlOptions, NzxQueryParams } from './type';
import { NzCardModule } from 'ng-zorro-antd/card';
import { NzxConfigurableQueryItemComponent } from './configurable-query-item/configurable-query-item.component';
import { CommonModule } from '@angular/common';
import { NzSpaceModule } from 'ng-zorro-antd/space';
import { NzIconModule } from 'ng-zorro-antd/icon';
import { NzButtonModule } from 'ng-zorro-antd/button';

/**
* 查询组件
Expand All @@ -37,6 +43,16 @@ import { NzxQueryControlOptions, NzxQueryParams } from './type';
styleUrls: ['./configurable-query.component.less'],
changeDetection: ChangeDetectionStrategy.OnPush,
exportAs: 'NzxConfigurableQuery',
imports: [
CommonModule,
ReactiveFormsModule,
NzCardModule,
NzGridModule,
NzSpaceModule,
NzButtonModule,
NzIconModule,
NzxConfigurableQueryItemComponent,
],
})
export class NzxConfigurableQueryComponent
implements OnChanges, OnInit, AfterViewInit, AfterContentInit, OnDestroy
Expand Down
Loading

0 comments on commit 99e0ec2

Please sign in to comment.