UNPKG

@progress/kendo-angular-treelist

Version:

Kendo UI TreeList for Angular - Display hierarchical data in an Angular tree grid view that supports sorting, filtering, paging, and much more.

62 lines (61 loc) 3.02 kB
/**----------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the project root for more information *-------------------------------------------------------------------------------------------*/ import { Directive, Input } from '@angular/core'; import { RowEditingDirectiveBase } from './row-editing-directive-base'; import { TreeListComponent } from '../treelist.component'; import { markAllAsTouched } from './utils'; import * as i0 from "@angular/core"; import * as i1 from "../treelist.component"; /** * A directive that encapsulates the editing operations of the TreeList when using the * Reactive Forms. [See example](slug:editing_directives_treelist#toc-reactive-editing-directive). * * @example * ```html * <kendo-treelist [kendoTreeListReactiveEditing]="createFormGroup"> * <kendo-treelist-column field="name" title="Name"></kendo-treelist-column> * <kendo-treelist-column field="age" title="Age"></kendo-treelist-column> * </kendo-treelist> * ``` * @remarks * Applied to: {@link TreeListComponent}. */ export class ReactiveEditingDirective extends RowEditingDirectiveBase { treelist; /** * The function that creates the `FormGroup` for the edited model. */ createFormGroup; constructor(treelist) { super(treelist); this.treelist = treelist; } createModel(args) { return this.createFormGroup(args); } saveModel({ dataItem, formGroup, isNew }) { if (!formGroup.dirty && !isNew) { return; } if (formGroup.valid) { this.editService.assignValues(dataItem, formGroup.value); return dataItem; } markAllAsTouched(formGroup); } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ReactiveEditingDirective, deps: [{ token: i1.TreeListComponent }], target: i0.ɵɵFactoryTarget.Directive }); static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: ReactiveEditingDirective, isStandalone: true, selector: "[kendoTreeListReactiveEditing]", inputs: { createFormGroup: ["kendoTreeListReactiveEditing", "createFormGroup"] }, exportAs: ["kendoTreeListReactiveEditing"], usesInheritance: true, ngImport: i0 }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ReactiveEditingDirective, decorators: [{ type: Directive, args: [{ exportAs: 'kendoTreeListReactiveEditing', selector: '[kendoTreeListReactiveEditing]', standalone: true }] }], ctorParameters: function () { return [{ type: i1.TreeListComponent }]; }, propDecorators: { createFormGroup: [{ type: Input, args: ['kendoTreeListReactiveEditing'] }] } });