diff --git a/docs/en/Customizing-Application-Modules-Extending-Entities.md b/docs/en/Customizing-Application-Modules-Extending-Entities.md index a3c9ae4e9a..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 **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 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). 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 {