From 31243d2cdd863941f1cadf6352ef541ebb7a31f2 Mon Sep 17 00:00:00 2001 From: muhammedaltug Date: Wed, 25 Jan 2023 16:37:26 +0300 Subject: [PATCH 1/4] uncheck when already selected label click --- .../tree/src/lib/components/tree.component.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/npm/ng-packs/packages/components/tree/src/lib/components/tree.component.ts b/npm/ng-packs/packages/components/tree/src/lib/components/tree.component.ts index f8216f184a..5df8ed5ee0 100644 --- a/npm/ng-packs/packages/components/tree/src/lib/components/tree.component.ts +++ b/npm/ng-packs/packages/components/tree/src/lib/components/tree.component.ts @@ -4,13 +4,13 @@ import { EventEmitter, Inject, Input, + OnInit, Optional, Output, TemplateRef, ViewEncapsulation, - OnInit, } from '@angular/core'; -import { NzFormatBeforeDropEvent, NzFormatEmitEvent } from 'ng-zorro-antd/tree'; +import { NzFormatBeforeDropEvent, NzFormatEmitEvent, NzTreeNode } from 'ng-zorro-antd/tree'; import { of } from 'rxjs'; import { TreeNodeTemplateDirective } from '../templates/tree-node-template.directive'; import { ExpandedIconTemplateDirective } from '../templates/expanded-icon-template.directive'; @@ -77,11 +77,16 @@ export class TreeComponent implements OnInit { this.subscriptionService.addOne(loaded$); } - onSelectedNodeChange(node) { + onSelectedNodeChange(node: NzTreeNode) { this.selectedNode = node.origin.entity; if (this.changeCheckboxWithNode) { + let newVal; + if (node.isChecked) { + newVal = this.checkedKeys.filter(x => x !== node.key); + } else { + newVal = [...this.checkedKeys, node.key]; + } this.selectedNodeChange.emit(node); - const newVal = [...this.checkedKeys, node.key]; this.checkedKeys = newVal; this.checkedKeysChange.emit(newVal); } else { From f4cfa2a4dc4573efff38af9f57034302203e6699 Mon Sep 17 00:00:00 2001 From: maliming Date: Thu, 26 Jan 2023 16:13:07 +0800 Subject: [PATCH 2/4] Update Customizing-Application-Modules-Extending-Entities.md Resolve #15492 --- docs/en/Customizing-Application-Modules-Extending-Entities.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/Customizing-Application-Modules-Extending-Entities.md b/docs/en/Customizing-Application-Modules-Extending-Entities.md index a3c9ae4e9a..937335d247 100644 --- a/docs/en/Customizing-Application-Modules-Extending-Entities.md +++ b/docs/en/Customizing-Application-Modules-Extending-Entities.md @@ -101,7 +101,7 @@ public class MyLocalIdentityUserChangeEventHandler : ```` * `EntityChangedEventData` covers create, update and delete events for the given entity. If you need, you can subscribe to create, update and delete events individually (in the same class or different classes). -* This code will be executed **out of the local transaction**, because it listens the `EntityChanged` event. You can subscribe to the `EntityChangingEventData` to perform your event handler in **the same local (in-process) transaction** if the current [unit of work](Unit-Of-Work.md) is transactional. +* This code will be executed **out of the local transaction**, because it listens the `EntityChanged` event. > Reminder: This approach needs to change the `IdentityUser` entity in the same process contains the handler class. It perfectly works even for a clustered environment (when multiple instances of the same application are running on multiple servers). From 0c240865c55d9e19a2ad8087bfffd85d53113c50 Mon Sep 17 00:00:00 2001 From: maliming Date: Thu, 26 Jan 2023 16:22:23 +0800 Subject: [PATCH 3/4] Update Customizing-Application-Modules-Extending-Entities.md --- docs/en/Customizing-Application-Modules-Extending-Entities.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/Customizing-Application-Modules-Extending-Entities.md b/docs/en/Customizing-Application-Modules-Extending-Entities.md index 937335d247..1db4ff263f 100644 --- a/docs/en/Customizing-Application-Modules-Extending-Entities.md +++ b/docs/en/Customizing-Application-Modules-Extending-Entities.md @@ -101,7 +101,7 @@ public class MyLocalIdentityUserChangeEventHandler : ```` * `EntityChangedEventData` covers create, update and delete events for the given entity. If you need, you can subscribe to create, update and delete events individually (in the same class or different classes). -* This code will be executed **out of the local transaction**, because it listens the `EntityChanged` event. +* This code will be executed in the **current unit of work**, so the whole process becomes transactional. > Reminder: This approach needs to change the `IdentityUser` entity in the same process contains the handler class. It perfectly works even for a clustered environment (when multiple instances of the same application are running on multiple servers). From 58827d88bf1e3a0abdaaa7832d7c708153d3d04b Mon Sep 17 00:00:00 2001 From: maliming Date: Thu, 26 Jan 2023 16:29:37 +0800 Subject: [PATCH 4/4] Update Customizing-Application-Modules-Extending-Entities.md --- docs/en/Customizing-Application-Modules-Extending-Entities.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/Customizing-Application-Modules-Extending-Entities.md b/docs/en/Customizing-Application-Modules-Extending-Entities.md index 1db4ff263f..c2cacb4e4c 100644 --- a/docs/en/Customizing-Application-Modules-Extending-Entities.md +++ b/docs/en/Customizing-Application-Modules-Extending-Entities.md @@ -101,7 +101,7 @@ public class MyLocalIdentityUserChangeEventHandler : ```` * `EntityChangedEventData` covers create, update and delete events for the given entity. If you need, you can subscribe to create, update and delete events individually (in the same class or different classes). -* This code will be executed in the **current unit of work**, so the whole process becomes transactional. +* This code will be executed in the **current unit of work**, the whole process becomes transactional. > Reminder: This approach needs to change the `IdentityUser` entity in the same process contains the handler class. It perfectly works even for a clustered environment (when multiple instances of the same application are running on multiple servers).