Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ng-alain/delon
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 14.1.0
Choose a base ref
...
head repository: ng-alain/delon
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 14.1.1
Choose a head ref
  • 3 commits
  • 12 files changed
  • 2 contributors

Commits on Oct 14, 2022

  1. Copy the full SHA
    a4e62ef View commit details
  2. Copy the full SHA
    14a7388 View commit details
  3. Copy the full SHA
    a1b845e View commit details
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
## [14.1.0](https://github.com/ng-alain/delon/compare/14.0.0...14.0.1) (2022-10-09)
## [14.1.1](https://github.com/ng-alain/delon/compare/14.1.0...14.1.1) (2022-10-14)


### Bug Fixes

* **form:** fix form multiple bind visibility ([#1531](https://github.com/ng-alain/delon/issues/1531)) ([a4e62ef](https://github.com/ng-alain/delon/commit/a4e62ef49b31f42beb850eb02aa53de536165df8))
* **form:** fix missing error style ([#1537](https://github.com/ng-alain/delon/issues/1537)) ([14a7388](https://github.com/ng-alain/delon/commit/14a7388443805ed1f06e2ed81008ab51547e4c75))



## [14.1.0](https://github.com/ng-alain/delon/compare/14.0.0...14.1.0) (2022-10-09)


### Bug Fixes
8 changes: 8 additions & 0 deletions docs/changelog.en-US.md
Original file line number Diff line number Diff line change
@@ -14,6 +14,14 @@ NG-ALAIN strictly follows [Semantic Versioning 2.0.0](http://semver.org/lang/zh-

---

## [14.1.1](https://github.com/ng-alain/delon/compare/14.1.0...14.1.1) (2022-10-14)

### Bug Fixes

* **form:** fix form multiple bind visibility ([#1531](https://github.com/ng-alain/delon/issues/1531)) ([a4e62ef](https://github.com/ng-alain/delon/commit/a4e62ef49b31f42beb850eb02aa53de536165df8))
* **form:** fix missing error style ([#1537](https://github.com/ng-alain/delon/issues/1537)) ([14a7388](https://github.com/ng-alain/delon/commit/14a7388443805ed1f06e2ed81008ab51547e4c75))


## [14.1.0](https://github.com/ng-alain/delon/compare/14.0.0...14.0.1) (2022-10-09)

### Bug Fixes
8 changes: 8 additions & 0 deletions docs/changelog.zh-CN.md
Original file line number Diff line number Diff line change
@@ -14,6 +14,14 @@ NG-ALAIN 严格遵循 [Semantic Versioning 2.0.0](http://semver.org/lang/zh-CN/)

---

## [14.1.1](https://github.com/ng-alain/delon/compare/14.1.0...14.1.1) (2022-10-14)

### Bug Fixes

* **form:** 修复可显会引发多次绑定 ([#1531](https://github.com/ng-alain/delon/issues/1531)) ([a4e62ef](https://github.com/ng-alain/delon/commit/a4e62ef49b31f42beb850eb02aa53de536165df8))
* **form:** 修复丢失错误样式 ([#1537](https://github.com/ng-alain/delon/issues/1537)) ([14a7388](https://github.com/ng-alain/delon/commit/14a7388443805ed1f06e2ed81008ab51547e4c75))


## [14.1.0](https://github.com/ng-alain/delon/compare/14.0.0...14.0.1) (2022-10-09)

### Bug Fixes
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "delon",
"version": "14.1.0",
"version": "14.1.1",
"description": "Delon is a set of essential modules for NG-ALAIN.",
"keywords": [
"delon",
8 changes: 2 additions & 6 deletions packages/form/spec/form.spec.ts
Original file line number Diff line number Diff line change
@@ -527,12 +527,8 @@ describe('form: component', () => {
const namePath = '/name';
context.comp.updateFeedback(namePath, 'error');
page.dc().checkCount('.ant-form-item-has-error', 1).checkCount('.ant-form-item-has-feedback', 1);
context.comp.updateFeedback(namePath, 'success', 'left');
page
.dc()
.checkCount('.ant-form-item-has-success', 1)
.checkCount('.ant-form-item-has-feedback', 1)
.checkCount('.anticon-left', 1);
context.comp.updateFeedback(namePath, 'success');
page.dc().checkCount('.ant-form-item-has-success', 1).checkCount('.ant-form-item-has-feedback', 1);
context.comp.updateFeedback(namePath);

page.dc().checkCount('.ant-form-item-has-feedback', 0);
3 changes: 3 additions & 0 deletions packages/form/src/errors.ts
Original file line number Diff line number Diff line change
@@ -110,5 +110,8 @@ export interface ErrorSchema {
*/
feedback?: NzFormControlStatusType;

/**
* @deprecated Will be removed of NG-ZORRO don't support
*/
feedbackIcon?: string | null;
}
4 changes: 3 additions & 1 deletion packages/form/src/model/form.property.factory.ts
Original file line number Diff line number Diff line change
@@ -146,6 +146,8 @@ export class FormPropertyFactory {

private initializeRoot(rootProperty: PropertyGroup): void {
// rootProperty.init();
rootProperty._bindVisibility();
if (rootProperty.isRoot()) {
rootProperty._bindVisibility();
}
}
}
16 changes: 3 additions & 13 deletions packages/form/src/model/form.property.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { BehaviorSubject, combineLatest, Observable, distinctUntilChanged, map } from 'rxjs';

import { AlainSFConfig } from '@delon/util/config';
import { NzFormStatusService } from 'ng-zorro-antd/core/form';
import type { NzSafeAny } from 'ng-zorro-antd/core/types';
import type { NzFormControlStatusType } from 'ng-zorro-antd/form';

@@ -373,17 +374,9 @@ export abstract class FormProperty {

// #endregion

updateFeedback(status: NzFormControlStatusType = '', icon?: string | null): void {
updateFeedback(status: NzFormControlStatusType = ''): void {
this.ui.feedback = status;
this.ui.feedbackIcon =
icon ||
{
'': '',
error: 'close-circle-fill',
validating: 'loading',
success: 'check-circle-fill',
warning: 'exclamation-circle-fill'
}[status];
this.widget.injector.get(NzFormStatusService).formStatusChanges.next({ status, hasFeedback: !!status });
this.widget.detectChanges();
}
}
@@ -415,9 +408,6 @@ export abstract class PropertyGroup extends FormProperty {
forEachChildRecursive(fn: (formProperty: FormProperty) => void): void {
this.forEachChild(child => {
fn(child);
if (child instanceof PropertyGroup) {
(child as PropertyGroup).forEachChildRecursive(fn);
}
});
}

3 changes: 0 additions & 3 deletions packages/form/src/sf-item-wrap.component.html
Original file line number Diff line number Diff line change
@@ -35,9 +35,6 @@
<div class="ant-form-item-control-input-content">
<ng-content></ng-content>
</div>
<span class="ant-form-item-children-icon">
<i *ngIf="ui.feedbackIcon" nz-icon [nzType]="ui.feedbackIcon"></i>
</span>
</div>
<div *ngIf="!ui.onlyVisual && showError" @helpMotion class="ant-form-item-explain ant-form-item-explain-connected">
<div role="alert" class="ant-form-item-explain-error">
12 changes: 10 additions & 2 deletions packages/form/src/sf-item-wrap.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Component, Input, ViewEncapsulation } from '@angular/core';
import { Component, Input, OnChanges, ViewEncapsulation } from '@angular/core';

import { helpMotion } from 'ng-zorro-antd/core/animation';
import { NzFormStatusService } from 'ng-zorro-antd/core/form';

import type { SFSchema } from './schema/index';
import type { SFOptionalHelp, SFUISchemaItem } from './schema/ui';
@@ -12,7 +13,7 @@ import type { SFOptionalHelp, SFUISchemaItem } from './schema/ui';
preserveWhitespaces: false,
encapsulation: ViewEncapsulation.None
})
export class SFItemWrapComponent {
export class SFItemWrapComponent implements OnChanges {
_showTitle: boolean = false;
@Input() id?: string;
@Input() schema!: SFSchema;
@@ -32,4 +33,11 @@ export class SFItemWrapComponent {
get oh(): SFOptionalHelp {
return this.ui.optionalHelp as SFOptionalHelp;
}

constructor(private statusSrv: NzFormStatusService) {}

ngOnChanges(): void {
const hasError = !!this.error;
this.statusSrv.formStatusChanges.next({ status: hasError ? 'error' : '', hasFeedback: hasError });
}
}
5 changes: 4 additions & 1 deletion packages/form/src/sf-item.component.ts
Original file line number Diff line number Diff line change
@@ -12,6 +12,8 @@ import {
} from '@angular/core';
import { Subject } from 'rxjs';

import { NzFormStatusService } from 'ng-zorro-antd/core/form';

import { FormProperty } from './model/form.property';
import { SFUISchemaItem } from './schema/ui';
import { TerminatorService } from './terminator.service';
@@ -29,7 +31,8 @@ let nextUniqueId = 0;
<ng-container *ngTemplateOutlet="footer"></ng-container>
`,
preserveWhitespaces: false,
encapsulation: ViewEncapsulation.None
encapsulation: ViewEncapsulation.None,
providers: [NzFormStatusService]
})
export class SFItemComponent implements OnInit, OnChanges, OnDestroy {
private ref!: ComponentRef<Widget<FormProperty, SFUISchemaItem>>;
4 changes: 2 additions & 2 deletions packages/form/src/sf.component.ts
Original file line number Diff line number Diff line change
@@ -236,8 +236,8 @@ export class SFComponent implements OnInit, OnChanges, OnDestroy {
* this.sf.updateFeedback('/name');
* ```
*/
updateFeedback(path: string, status: NzFormControlStatusType = '', icon?: string | null): this {
this.getProperty(path)?.updateFeedback(status, icon);
updateFeedback(path: string, status: NzFormControlStatusType = ''): this {
this.getProperty(path)?.updateFeedback(status);
return this;
}