From 6742c8405a1016d1ed28bfe586ce1af88057c9e3 Mon Sep 17 00:00:00 2001 From: Yaroslav Date: Tue, 15 Jan 2019 17:26:45 +0200 Subject: [PATCH] init v2.5.0 --- README.MD | 46 +++++++++++++++++-- projects/ngx-tree-dnd/README.md | 46 +++++++++++++++++-- projects/ngx-tree-dnd/package.json | 2 +- .../src/lib/models/tree-view.model.ts | 1 + .../ngx-tree-dnd-children.component.ts | 5 +- .../ngx-tree-dnd-parent.component.html | 2 +- .../ngx-tree-dnd-parent.component.ts | 19 ++++++-- .../src/lib/ngx-tree-dnd.service.ts | 26 +++++++++-- src/app/app.component.html | 11 ++++- src/app/app.component.ts | 14 +++++- 10 files changed, 151 insertions(+), 21 deletions(-) diff --git a/README.MD b/README.MD index 0eda154..ca70c2e 100644 --- a/README.MD +++ b/README.MD @@ -317,24 +317,61 @@ in you component file: } ``` -### onremoveitem() -Trigger removing action item +### onStartDeleteItem() +Trigger start Deleting action item #### example in you template file: ```xml - + ``` in you component file: ```typescript - onRemoveItem(event) { + onStartDeleteItem(event) { console.log(event); } ``` +### onFinishDeleteItem() +Trigger start Deleting action item + +#### example + +in you template file: + +```xml + +``` +in you component file: + +```typescript + onFinishDeleteItem(event) { + console.log(event); + } +``` + +### onCancelDeleteItem() +Trigger start Deleting action item + +#### example + +in you template file: + +```xml + +``` +in you component file: + +```typescript + onCancelDeleteItem(event) { + console.log(event); + } +``` + + ### 3. Config You can enable/disable and set some elements on tree by write simple config: @@ -354,6 +391,7 @@ in you component file: showAddButtons: true, // show/hide add button for all elements showRenameButtons: true, // show/hide rename buttons for all elements showDeleteButtons: true, // show/hide delete buttons for all elements + showRootActionButtons: true, // shlow/hide root action bottons enableExpandButtons: true, // // show/hide expand buttons for all elements enableDragging: true, // enable/disable dragging rootTitle: 'Root', // Tree titile name diff --git a/projects/ngx-tree-dnd/README.md b/projects/ngx-tree-dnd/README.md index 0eda154..a2dc7c0 100644 --- a/projects/ngx-tree-dnd/README.md +++ b/projects/ngx-tree-dnd/README.md @@ -317,24 +317,61 @@ in you component file: } ``` -### onremoveitem() -Trigger removing action item +### onStartDeleteItem() +Trigger start Deleting action item #### example in you template file: ```xml - + ``` in you component file: ```typescript - onRemoveItem(event) { + onStartDelete(event) { console.log(event); } ``` +### onFinishDeleteItem() +Trigger finish deleting action item + +#### example + +in you template file: + +```xml + +``` +in you component file: + +```typescript + onFinishDelete(event) { + console.log(event); + } +``` + +### onCancelDeleteItem() +Trigger cancel deleting action item + +#### example + +in you template file: + +```xml + +``` +in you component file: + +```typescript + onCancelDelete(event) { + console.log(event); + } +``` + + ### 3. Config You can enable/disable and set some elements on tree by write simple config: @@ -354,6 +391,7 @@ in you component file: showAddButtons: true, // show/hide add button for all elements showRenameButtons: true, // show/hide rename buttons for all elements showDeleteButtons: true, // show/hide delete buttons for all elements + showRootActionButtons: true, // shlow/hide root action bottons enableExpandButtons: true, // // show/hide expand buttons for all elements enableDragging: true, // enable/disable dragging rootTitle: 'Root', // Tree titile name diff --git a/projects/ngx-tree-dnd/package.json b/projects/ngx-tree-dnd/package.json index 4683dc8..1c0a5bd 100644 --- a/projects/ngx-tree-dnd/package.json +++ b/projects/ngx-tree-dnd/package.json @@ -1,6 +1,6 @@ { "name": "ngx-tree-dnd", - "version": "2.4.3", + "version": "2.5.0", "repository": { "type": "git", "url": "https://github.com/Zicrael/ngx-tree-dnd" diff --git a/projects/ngx-tree-dnd/src/lib/models/tree-view.model.ts b/projects/ngx-tree-dnd/src/lib/models/tree-view.model.ts index 1fc5154..44829ea 100644 --- a/projects/ngx-tree-dnd/src/lib/models/tree-view.model.ts +++ b/projects/ngx-tree-dnd/src/lib/models/tree-view.model.ts @@ -40,6 +40,7 @@ export interface TreeConfig { showRenameButtons?: boolean; showDeleteButtons?: boolean; enableExpandButtons?: boolean; + showRootActionButtons?: boolean; // actions enableDragging?: boolean; rootTitle?: string; diff --git a/projects/ngx-tree-dnd/src/lib/ngx-tree-dnd-children/ngx-tree-dnd-children.component.ts b/projects/ngx-tree-dnd/src/lib/ngx-tree-dnd-children/ngx-tree-dnd-children.component.ts index 4525d71..5d33fab 100644 --- a/projects/ngx-tree-dnd/src/lib/ngx-tree-dnd-children/ngx-tree-dnd-children.component.ts +++ b/projects/ngx-tree-dnd/src/lib/ngx-tree-dnd-children/ngx-tree-dnd-children.component.ts @@ -133,7 +133,10 @@ export class NgxTreeChildrenComponent implements AfterViewInit { } /* - Event: onremoveitem; + Events: + onStartDeleteItem, + onFinishDeleteItem, + onCancelDeleteItem. Check is item edit, then if name empty delete item. Call deleteItem() from tree service. */ diff --git a/projects/ngx-tree-dnd/src/lib/ngx-tree-dnd-parent/ngx-tree-dnd-parent.component.html b/projects/ngx-tree-dnd/src/lib/ngx-tree-dnd-parent/ngx-tree-dnd-parent.component.html index 8ca3e1c..6c2ee5c 100644 --- a/projects/ngx-tree-dnd/src/lib/ngx-tree-dnd-parent/ngx-tree-dnd-parent.component.html +++ b/projects/ngx-tree-dnd/src/lib/ngx-tree-dnd-parent/ngx-tree-dnd-parent.component.html @@ -4,7 +4,7 @@ {{userConfig.rootTitle}} -
+