All Projects → AmirkabirDataMiners → ADM-treeView

AmirkabirDataMiners / ADM-treeView

Licence: MIT license
Pure AngularJs TreeView

Programming Languages

HTML
75241 projects
CSS
56736 projects
javascript
184084 projects - #8 most used programming language
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to ADM-treeView

Jocs.github.io
💯Jocs 的个人博客,所有的文章都在 issues 里面
Stars: ✭ 840 (+2700%)
Mutual labels:  angularjs, promise
Angular1 Async Filter
Angular2 async pipe implemented as Angular 1 filter to handle promises & RxJS observables
Stars: ✭ 59 (+96.67%)
Mutual labels:  angularjs, promise
Angular Promise Buttons
Chilled loading buttons for AngularJS
Stars: ✭ 156 (+420%)
Mutual labels:  angularjs, promise
transceiver
Channel based event bus with request/reply pattern, using promises. For node & browser.
Stars: ✭ 25 (-16.67%)
Mutual labels:  promise
hangman-game
A responsive hangman game built with vanilla javascript, html, and css. Animated with GSAP and canvas animations.
Stars: ✭ 22 (-26.67%)
Mutual labels:  promise
percy-node
Utilities for visual regression testing in node based testing setups (like Protractor) for use with percy.io
Stars: ✭ 17 (-43.33%)
Mutual labels:  angularjs
angular-heremaps
AngularJS directive for working with Here Maps
Stars: ✭ 19 (-36.67%)
Mutual labels:  angularjs
angularjs-es6-starter-kit
Basic AngularJS, ES6, Webpack Starter Kit Project which includes Bootstrap 4 also. This is a boilerplate for AngularJS SPA with Bootstrap 4.
Stars: ✭ 28 (-6.67%)
Mutual labels:  angularjs
react-folder-tree
A versatile react treeview library that supports custom icons and event handlers
Stars: ✭ 56 (+86.67%)
Mutual labels:  treeview
Beetle.js
🪲 Javascript ORM, manage your data easily.
Stars: ✭ 53 (+76.67%)
Mutual labels:  angularjs
Promise.allSettled
ES Proposal spec-compliant shim for Promise.allSettled
Stars: ✭ 93 (+210%)
Mutual labels:  promise
gravitee-management-webui
Gravitee.io - API Management - Management UI
Stars: ✭ 107 (+256.67%)
Mutual labels:  angularjs
conquerant
lightweight async/await for Clojure
Stars: ✭ 31 (+3.33%)
Mutual labels:  promise
IoT-Modelling-Tool
IoT Modelling Tool is a platform which allows users to have their own devices and components modeled in order to represent and manage a physical environment.
Stars: ✭ 16 (-46.67%)
Mutual labels:  angularjs
make-cancellable-promise
Make any Promise cancellable.
Stars: ✭ 17 (-43.33%)
Mutual labels:  promise
lightflow
A tiny Promise-inspired control flow library for browser and Node.js.
Stars: ✭ 29 (-3.33%)
Mutual labels:  promise
emacs-promise
Promises/A+ for Emacs
Stars: ✭ 56 (+86.67%)
Mutual labels:  promise
angular-sticky-navigation-directive
Angular directive to make a sticky element, quick demo here: http://ng-milk.github.io/angular-sticky-navigation-directive/
Stars: ✭ 20 (-33.33%)
Mutual labels:  angularjs
ypereirareis.github.io
DevOps, Symfony and VueJs developer. Articles and experiences on docker, grafana, prometheus, RabbitMQ, PHP, MySQL, Admin, Nginx, Haproxy, SSH,...
Stars: ✭ 15 (-50%)
Mutual labels:  angularjs
iworker
Promise-based wrapper for worker_threads
Stars: ✭ 18 (-40%)
Mutual labels:  promise

ADM-treeView

Version   Version   AngularJs   License MIT

Pure AngularJs TreeView by ADM | Amirkabir Data Miners

ADM-treeView cover

Updates in V1.2.0

  • Nothing changed since V1.0.1, the version upgrade is just because of npm bug.

Demo

See ADMtrv live HERE.


Implementation steps

Step 1: Install ADM-treeView

npm install adm-trv
bower install adm-trv

Step 2: Include the files in your app

<!doctype html>
<html ng-app="myApp">
    <head>
        <link rel="stylesheet" href="css/ADM-treeView.min.css" />
        <script src="js/angular.min.js"></script>
        <script src="js/ADM-treeView.min.js"></script>
        ...
    </head>
    <body>
        ...
    </body>
</html>

Step 3: Inject the ADM-treeView module

var app = angular.module('myApp', ['ADM-treeView']);

Step 4: Add the adm-trv directive to a DOM element

<adm-trv ng-model="model"></adm-trv>

Options

Set options for entire of app

app.config(['ADMtrvProvider', function(ADMtrv) {
    ADMtrv.setConfigs({
        childName: 'kids',
        title: '$item.mainDS.title',
        trackBy: '$item.mainDS.id',
        dictionary: {
            noItem: ' :( '
        },
        ...
    });
}]);

Set options for each directive

<!-- pass options from controller -->
<adm-trv ng-model="ctrl.model1" configs="tree1Options"></adm-trv>
<!-- or write them inline -->
<adm-trv ng-model="ctrl.model1" configs="{childName: 'levels', readOnly: true}"></adm-trv>

Quick look

Name Type Default Description
childName String childs Set the name of childs wrapper. (e.g. 'childs', 'categories', ...)
title String $item.title Set path to 'title'. '$item' can be ignore and path can be nested. (e.g. '$item.titleHolder1.titleHolder2.title')
singleRoot Boolean False When it's true only one main root can be add.
readOnly Boolean False This option disable add, edit and delete methods.
selectable Boolean False Add checkbox before title to enable multi selecting.
trackBy String -- For selectable mode, can be useful for finding items. '$item' can be ignore and path can be nested. (e.g. '$item.mainDS.id')
maxDepth Number -- Set maxDepth for treeView.
direction String ltr Change treeView direction. (e.g. 'ltr', 'rtl')
dictionary Object (EN) Change buttons and placeholders name upon your language. Check the Docs below.
onKidOpen Function -- Pass HTML content to show it on leaf clicking. accept both 'string' and 'promise' to fill the content.
onAdd Function -- Event on adding item to tree. Can return promise to wait for server response and add server 'id' to object.
onEdit Function -- Event on editing item. Can return promise to wait for server response.
onDelete Function -- Event on deleting item. Can return promise to wait for server response.

onKidOpen event

In readOnly mode 'onKidOpen' event fire whenever the tree leafs clicked! You can return HTML content directly or by promise to show under leaf.

// return string
$scope.tree2_2Options = {
    childName: 'categories',
    readOnly: true,
    onKidOpen: function(node) {
        return 'The Node title is: "' + node.title + '"';
    }
}

// return promise
$scope.tree2_2Options = {
    childName: 'categories',
    readOnly: true,
    onKidOpen: function(node) {
        var deferred = $q.defer();
        setTimeout(function() {
            deferred.resolve('The Node title is: "' + node.title + '"');
        }, 2000);
        return deferred.promise;
    }
}

onAdd event

The 'onAdd' event fire on adding item to tree. In case you want to post each node to server on add event, you can return promise to adm-trv to add node after server response. Return value can be 'Object' or 'Boolean'.

  • Boolean: adm-trv continue adding node to tree by catching 'true' value.
  • Object: In case server add 'Id' to your object after inserting to DB, that might be need for further editing or deleting, adm-trv will extend client object with your returned object. Return false to avoid adding node to tree.
// return Booelan
$scope.tree3_1Options = {
    childName: 'organizations',
    dictionary: {
        titlePlaceholder: 'A-Z only ...'
    },
    onAdd: function(parentNode, newNode, titleOnly) {
        return !/[^a-zA-Z]/.test(titleOnly);
    }
}

//return promise
$scope.tree3_2Options = {
    childName: 'organizations',
    onAdd: function(parentNode, newNode, titleOnly) {
        var deferred = $q.defer();
        setTimeout(function() {
            deferred.resolve({
                id: Math.floor(Math.random() * 1000)
            });
        }, 500);
        return deferred.promise;
    }
}

onEdit & onDelete events

// return Booelan
$scope.tree4_1Options = {
    onEdit: function (currentNode, parentNode) {
        return true; // or False
    },
    onDelete: function (currentNode, parentNode) {
        return true; // or False
    }
}


//return promise
$scope.tree4_2Options = {
    onEdit: function (currentNode, parentNode) {
        var deferred = $q.defer();
        setTimeout(function() {
            deferred.resolve(true); // or False
        }, 500);
        return deferred.promise;
    },
    onDelete: function (currentNode, parentNode) {
        var deferred = $q.defer();
        setTimeout(function() {
            deferred.resolve(true); // or False
        }, 500);
        return deferred.promise;
    }
}

Selectable

<adm-trv ng-model="ctrl.model4_1" selected="ctrl.model4_1Selected" configs="tree4_1Options"></adm-trv>
<adm-trv ng-model="ctrl.model4_2" selected="ctrl.model4_2Selected" configs="tree4_2Options"></adm-trv>
$scope.ctrl.model4_1Selected = [];
$scope.tree4_1Options = {
    childName: 'bAghAlies',
    selectable: true
}

$scope.ctrl.model4_2Selected = [];
$scope.tree4_2Options = {
    childName: 'bAghAlies',
    title: '$item.mainBAghAliDS.title',
    trackBy: '$item.mainBAghAliDS.id',
    selectable: true
}

Dictionary

$scope.tree5_1Options = {
    childName: 'golAbies',
    dictionary: {
        noItem: 'No golAbi! :(',
        titlePlaceholder: 'Type ...',
        rootAddBtn: 'Add main golAbi',
        confirmBtn: 'YES',
        cancelBtn: 'NO'
    }
}

$scope.tree5_2Options = {
    childName: 'golAbies',
    direction: 'rtl',
    dictionary: {
        noItem: 'موردی وجود ندارد!',
        titlePlaceholder: 'عنوان ...',
        rootAddBtn: 'افزودن',
        confirmBtn: 'تایید',
        cancelBtn: 'انصراف'
    }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].