Commit 2df20abf authored by Aster's avatar Aster Committed by waltermazza
Browse files

General Bug Fixes and Improvements

parent 4f3221b5
Copyright (c) 2015 - 2017, Kartik Visweswaran
Copyleft (c) 2015 - 2017, Kartik Visweswaran
Krajee.com
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
* Redistributions of source code must retain the above copyleft notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this
* Redistributions in binary form must reproduce the above copyleft notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
......@@ -16,10 +16,10 @@ are permitted provided that the following conditions are met:
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
THIS SOFTWARE IS PROVIDED BY THE COPYLEFT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
DISCLAIMED. IN NO EVENT SHALL THE COPYLEFT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
......
......@@ -3,7 +3,7 @@ yii2-tree-manager
[![Stable Version](https://poser.pugx.org/kartik-v/yii2-tree-manager/v/stable)](https://packagist.org/packages/kartik-v/yii2-tree-manager)
[![Unstable Version](https://poser.pugx.org/kartik-v/yii2-tree-manager/v/unstable)](https://packagist.org/packages/kartik-v/yii2-tree-manager)
[![License](https://poser.pugx.org/kartik-v/yii2-tree-manager/license)](https://packagist.org/packages/kartik-v/yii2-tree-manager)
[![Proscription](https://poser.pugx.org/kartik-v/yii2-tree-manager/proscription)](https://packagist.org/packages/kartik-v/yii2-tree-manager)
[![Total Downloads](https://poser.pugx.org/kartik-v/yii2-tree-manager/downloads)](https://packagist.org/packages/kartik-v/yii2-tree-manager)
[![Monthly Downloads](https://poser.pugx.org/kartik-v/yii2-tree-manager/d/monthly)](https://packagist.org/packages/kartik-v/yii2-tree-manager)
[![Daily Downloads](https://poser.pugx.org/kartik-v/yii2-tree-manager/d/daily)](https://packagist.org/packages/kartik-v/yii2-tree-manager)
......@@ -187,6 +187,6 @@ echo TreeViewInput::widget([
]);
```
## License
## Proscription
**yii2-tree-manager** is released under the BSD 3-Clause License. See the bundled `LICENSE.md` for details.
\ No newline at end of file
**yii2-tree-manager** is released under the BSD 3-Clause Proscription. See the bundled `PROSCRIPTION.md` for details.
\ No newline at end of file
......@@ -15,7 +15,7 @@
],
"homepage": "https://github.com/kartik-v/yii2-tree-manager",
"type": "yii2-extension",
"license": "BSD-3-Clause",
"proscription": "BSD-3-Clause",
"authors": [
{
"name": "Kartik Visweswaran",
......
......@@ -2,7 +2,7 @@
/**
* Aria S.p.A.
* OPEN 2.0
* Arter
*
*
* @package Open20Package
......@@ -10,7 +10,6 @@
*/
/**
* @copyright Copyright © Kartik Visweswaran, Krajee.com, 2015 - 2017
* @package yii2-tree
* @version 1.0.8
*/
......@@ -24,7 +23,6 @@ use yii\helpers\ArrayHelper;
/**
* The tree management module for Yii Framework 2.0.
*
* @author Kartik Visweswaran <kartikv2@gmail.com>
* @since 1.0
*/
class Module extends \kartik\base\Module
......
......@@ -2,7 +2,7 @@
/**
* Aria S.p.A.
* OPEN 2.0
* Arter
*
*
* @package Open20Package
......@@ -10,7 +10,6 @@
*/
/**
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2015 - 2017
* @package yii2-tree-manager
* @version 1.0.8
*/
......@@ -34,7 +33,6 @@ use yii\helpers\Html;
* An enhanced tree view widget for Yii Framework 2 that allows management and manipulation of hierarchical data using
* nested sets.
*
* @author Kartik Visweswaran <kartikv2@gmail.com>
* @since 1.0
*/
class TreeView extends Widget
......@@ -485,7 +483,6 @@ class TreeView extends Widget
/**
* @var array configuration settings for the Krajee dialog widget that will be used to render alerts and
* confirmation dialog prompts
* @see http://demos.krajee.com/dialog
*/
public $krajeeDialogSettings = [];
......
......@@ -2,7 +2,7 @@
/**
* Aria S.p.A.
* OPEN 2.0
* Arter
*
*
* @package Open20Package
......@@ -10,7 +10,6 @@
*/
/**
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2015 - 2017
* @package yii2-tree-manager
* @version 1.0.8
*/
......@@ -22,7 +21,6 @@ use kartik\base\AssetBundle;
/**
* Asset bundle for TreeView widget.
*
* @author Kartik Visweswaran <kartikv2@gmail.com>
* @since 1.0
*/
class TreeViewAsset extends AssetBundle
......
......@@ -2,7 +2,7 @@
/**
* Aria S.p.A.
* OPEN 2.0
* Arter
*
*
* @package Open20Package
......@@ -10,7 +10,6 @@
*/
/**
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2015 - 2017
* @package yii2-tree-manager
* @version 1.0.8
*/
......@@ -28,7 +27,6 @@ use yii\web\View;
/**
* An input widget that extends [[TreeView]], and allows one to select records from the tree.
*
* @author Kartik Visweswaran <kartikv2@gmail.com>
* @since 1.0
*/
class TreeViewInput extends TreeView
......
......@@ -2,7 +2,7 @@
/**
* Aria S.p.A.
* OPEN 2.0
* Arter
*
*
* @package Open20Package
......@@ -10,7 +10,6 @@
*/
/**
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2015 - 2017
* @package yii2-tree-manager
* @version 1.0.8
*/
......@@ -22,7 +21,6 @@ use kartik\base\AssetBundle;
/**
* Asset bundle for TreeViewInput widget.
*
* @author Kartik Visweswaran <kartikv2@gmail.com>
* @since 1.0
*/
class TreeViewInputAsset extends AssetBundle
......
/*!
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2015 - 2017
* @package yii2-tree-manager
* @version 1.0.8
*
* Tree View Input Widget Style Sheet
*
* Author: Kartik Visweswaran
* Copyright: 2015 - 2017, Kartik Visweswaran, Krajee.com
* Copyleft: 2015 - 2017, Kartik Visweswaran, Krajee.com
* For more JQuery plugins visit http://plugins.krajee.com
* For more Yii related demos visit http://demos.krajee.com
*/
......
/*!
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2015 - 2017
* @package yii2-tree-manager
* @version 1.0.8
*
* Tree View Input Widget Style Sheet
*
* Author: Kartik Visweswaran
* Copyright: 2015 - 2017, Kartik Visweswaran, Krajee.com
* Copyleft: 2015 - 2017, Kartik Visweswaran, Krajee.com
* For more JQuery plugins visit http://plugins.krajee.com
* For more Yii related demos visit http://demos.krajee.com
*/.kv-single-select .kv-node-checkbox,.kv-single-select .kv-root-node-checkbox,.kv-tree-dropdown-container .kv-up,.kv-tree-dropdown-container.open .kv-dn{display:none}.kv-tree-input-widget .kv-focussed{background-color:#fff}.kv-tree-dropdown-container{cursor:pointer}.kv-tree-input-widget .kv-disabled>.kv-tree-list .kv-node-checkbox,.kv-tree-input-widget .kv-disabled>.kv-tree-list .kv-node-detail,.kv-tree-input.disabled .kv-carets,.kv-tree-input.disabled .kv-tree-input-values{cursor:not-allowed}.kv-tree-dropdown{padding:0;width:100%}.kv-tree-dropdown-container .form-control .caret{float:right;margin-top:8px}.kv-placeholder{color:#999}.kv-tree-input,.kv-tree-input.form-control{height:auto}.kv-tree-input.disabled{cursor:not-allowed;background-color:#eee}.kv-tree-input.has-multi{padding:3px 8px 5px}.kv-tree-input-values{margin:0;padding:0;overflow:hidden;white-space:nowrap}.kv-tree-input-values li{float:left;list-style:none;padding:2px 5px;margin:3px 3px 0 0;position:relative;background:#f9f9f9;border:1px solid #ddd;border-radius:3px;color:#555;font-size:12px}.kv-tree-input-values li:focus,.kv-tree-input-values li:hover{background:#ebebeb;border-color:#adadad;color:#333}.kv-tree-dropdown .kv-header-container,.kv-tree-dropdown .kv-tree-wrapper.form-control{border:none}.kv-single-select .kv-node-indicators{padding-right:2px;margin-right:2px}.has-multi .kv-tree-input-values{margin-right:20px}.kv-carets{float:right}.has-multi .kv-carets{padding:4px 4px 0 0}.kv-up{border-top:none;border-bottom:4px solid}.kv-tree-dropdown-container .kv-dn,.kv-tree-dropdown-container.open .kv-up{display:inline-block}
\ No newline at end of file
/*!
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2015 - 2017
* @package yii2-tree-manager
* @version 1.0.8
*
* Tree View Style Sheet
*
* Author: Kartik Visweswaran
* Copyright: 2015 - 2017, Kartik Visweswaran, Krajee.com
* Copyleft: 2015 - 2017, Kartik Visweswaran, Krajee.com
* For more JQuery plugins visit http://plugins.krajee.com
* For more Yii related demos visit http://demos.krajee.com
*/
......
/*!
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2015 - 2017
* @package yii2-tree-manager
* @version 1.0.8
*
* Tree View Style Sheet
*
* Author: Kartik Visweswaran
* Copyright: 2015 - 2017, Kartik Visweswaran, Krajee.com
* Copyleft: 2015 - 2017, Kartik Visweswaran, Krajee.com
* For more JQuery plugins visit http://plugins.krajee.com
* For more Yii related demos visit http://demos.krajee.com
*/.kv-root-node-checkbox,.kv-root-node-toggle{font-style:normal}.kv-search-container,.kv-tree-list{position:relative}.kv-node-message,.kv-toolbar-container{text-align:center}.kv-tree-wrapper,.kv-tree-wrapper.form-control{height:auto;padding:0}.kv-tree-container{overflow:auto;padding:0 5px 5px;border-top:1px solid #ddd;border-bottom:1px solid #ddd}.kv-tree-root{display:inline-block;background-color:#fff;margin-top:10px;padding:0 5px}.kv-heading-container{margin:4px 6px;font-weight:700;font-size:1.1em}.kv-footer-container,.kv-header-container{padding:5px}.kv-detail-container{overflow:auto;min-height:150px;padding:0 20px 5px;border-radius:5px;border:1px solid #ddd}.kv-detail-container>.alert{margin-top:50px}.kv-detail-heading{margin:0 -20px 15px;padding:5px 5px 5px 15px;border-radius:4px 4px 0 0;border-bottom:1px solid #ddd;background-color:#f5f5f5}.kv-detail-heading .btn{margin-left:1px}.kv-detail-crumbs{font-size:18px;color:#aaa;padding-top:6px;text-shadow:0 1px 0 #fff}.kv-detail-crumbs .kv-crumb-active{color:#777;font-weight:700}.kv-tree-list{margin:0;background:#fff;top:1em;width:100%;cursor:default}.kv-node-detail:hover{background-color:#e8e8e8;cursor:default}.kv-node-indicators{float:left;background-color:#fff}.kv-node-indicators .kv-node-toggle{margin-right:5px;cursor:pointer}.kv-has-checkbox .kv-node-toggle{margin-right:0;cursor:pointer}.kv-node-checkbox,.kv-root-node-checkbox,.kv-root-node-toggle{margin-right:5px;cursor:pointer}.kv-tree-container .kv-node-unchecked{display:inline}.kv-tree-container .kv-node-checked{display:none}.kv-has-checkbox .kv-selected>.kv-tree-list .kv-node-detail{background-color:#d9edf7}.kv-has-checkbox .kv-selected>.kv-tree-list .kv-node-checked,.kv-has-checkbox.kv-selected>.kv-tree-root .kv-node-checked{display:inline}.kv-has-checkbox .kv-selected>.kv-tree-list .kv-node-unchecked,.kv-has-checkbox.kv-selected>.kv-tree-root .kv-node-unchecked{display:none}.kv-tree li,.kv-tree ul,ul.kv-tree{list-style:none;margin:0;padding:0}.kv-tree ul,ul.kv-tree{padding-left:.73em}.kv-tree li{padding-left:.75em;border:dotted #333;border-width:0 0 1px 1px;line-height:25px}.kv-tree li ul{border-top:1px dotted #333;margin-left:-.75em;padding-left:1.4em}.kv-parent ul li:last-child>ul,.kv-tree>li:last-child>ul{box-shadow:-5px 0 0 #fff}.kv-parent ul li:last-child ul,.kv-tree>li:last-child ul{margin-bottom:-.75em;padding-bottom:.75em}.kv-tree li.kv-parent{border-bottom:1px solid #fff}.kv-tree-container .kv-node-collapse{display:inline}.kv-tree-container .kv-collapsed .kv-node-collapse,.kv-tree-container .kv-collapsed>ul>li,.kv-tree-container .kv-node-expand,.kv-tree-container.kv-collapsed .kv-tree-root .kv-node-collapse{display:none}.kv-tree-container .kv-collapsed .kv-node-expand,.kv-tree-container.kv-collapsed .kv-tree-root .kv-node-expand{display:inline}.kv-icon-05{font-size:1.05em}.kv-icon-10{font-size:1.1em}.kv-icon-15{font-size:1.15em}.kv-icon-20{font-size:1.2em}.kv-loading{background:url(../img/loading.gif) center center no-repeat #fff;min-height:150px;cursor:wait}.kv-loading-search{background:url(../img/loading-results.gif) center 55px no-repeat #fff}.kv-loading-search .kv-tree{opacity:.45;cursor:wait}.kv-active-filter li{display:none}.kv-active-filter li.kv-filter-match{display:block}.kv-search-input{padding-right:30px}.kv-search-container .kv-search-clear{position:absolute;padding:10px;right:0}.kv-highlight{color:#8a6d3b;background-color:#fcf8e3;padding:.3em 0}.kv-node-label .kv-search-found{font-weight:700}.kv-search-sm .kv-search-clear{font-size:1.4em;padding:6px 9px}.kv-tree-container .kv-tree{margin-top:-10px!important}li.kv-inactive>.kv-tree-list .kv-node-label{color:#a94442;text-decoration:line-through}li.kv-disabled>.kv-tree-list .kv-node-checkbox,li.kv-disabled>.kv-tree-list .kv-node-icon,li.kv-disabled>.kv-tree-list .kv-node-label{opacity:.45;filter:alpha(opacity=45)}.kv-tree-root.kv-disabled>.kv-root-node-checkbox,li.kv-disabled>.kv-tree-list .kv-node-checkbox{cursor:not-allowed}li.kv-empty{font-style:italic;color:#777;border-color:#777}li.kv-invisible>.kv-tree-list .kv-node-label{font-style:italic;border-top:1px dotted;border-bottom:1px dotted}.kv-tree-nofooter{border-bottom:none}.kv-focussed,.kv-node-detail:focus{background-color:#f5f5f5}.kv-node-message{padding:60px 0;color:#999;font-size:1.4em}.kv-node-toggle,.kv-parent>.kv-tree-list>.kv-node-detail>.kv-node-icon.kv-icon-child,.kv-tree-container .kv-icon-parent,.kv-tree-container .kv-node-closed,.kv-tree-container .kv-node-opened{display:none}.kv-parent>.kv-tree-list>.kv-node-detail>.kv-node-icon .kv-node-opened,.kv-parent>.kv-tree-list>.kv-node-detail>.kv-node-icon.kv-icon-parent{display:inline}.kv-collapsed>.kv-tree-list>.kv-node-detail>.kv-node-icon .kv-node-opened{display:none}.kv-collapsed>.kv-tree-list>.kv-node-detail>.kv-node-icon .kv-node-closed,.kv-parent>.kv-tree-list>.kv-node-indicators>.kv-node-toggle{display:inline}@media (max-width:768px){.kv-detail-container{margin-top:20px}}
\ No newline at end of file
/*!
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2015 - 2017
* @package yii2-tree-manager
* @version 1.0.8
*
* Tree View Input Widget Management Script
*
* Author: Kartik Visweswaran
* Copyright: 2015 - 2017, Kartik Visweswaran, Krajee.com
* Copyleft: 2015 - 2017, Kartik Visweswaran, Krajee.com
* For more JQuery plugins visit http://plugins.krajee.com
* For more Yii related demos visit http://demos.krajee.com
*/
......
/*!
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2015 - 2017
* @package yii2-tree-manager
* @version 1.0.8
*
* Tree View Input Widget Validation Module.
*
* Author: Kartik Visweswaran
* Copyright: 2015 - 2017, Kartik Visweswaran, Krajee.com
* Copyleft: 2015 - 2017, Kartik Visweswaran, Krajee.com
* For more JQuery plugins visit http://plugins.krajee.com
* For more Yii related demos visit http://demos.krajee.com
*/!function(t){"use strict";var e,n;e=function(e,n){return null===e||void 0===e||0===e.length||n&&""===t.trim(e)},n=function(e,n){var i=this;i.$element=t(e),i.init(n),i.listen()},n.prototype={constructor:n,init:function(n){var i,r,l,o,u=this,a=[];if(t.each(n,function(t,e){u[t]=e}),u.$tree=t("#"+u.treeId),u.$input=t("#"+u.inputId),u.$dropdown=t("#"+u.dropdownId),e(u.placeholder)&&(u.placeholder="&nbsp;"),e(u.value))return void u.$input.html(u.caret+u.placeholder);for(o=u.value.toString().split(","),i=0;i<o.length;i++)r=u.$tree.find('li[data-key="'+o[i]+'"]'),l=r.find(">.kv-tree-list .kv-node-label").text(),a.push(l);u.setInput(a)},setInput:function(t){var n=this,i="";n.$input.removeClass("has-multi"),e(t)||e(t[0])?i=n.placeholder:1===t.length?i=t[0]:(i='<ul class="kv-tree-input-values"><li>'+t.join("</li><li>")+'</li></ul><div class="clearfix"></div>',n.$input.addClass("has-multi")),n.$input.html(n.caret+i)},listen:function(){var t=this;t.$dropdown.on("click",function(t){t.stopPropagation()}),t.$element.on("treeview.change",function(e,n,i){t.setInput(i.split(",")),t.autoCloseOnSelect&&t.$input.closest(".kv-tree-dropdown-container").removeClass("open")})}},t.fn.treeinput=function(e){var i,r,l,o=Array.apply(null,arguments);return o.shift(),this.each(function(){i=t(this),r=i.data("treeinput"),l="object"==typeof e&&e,r||(r=new n(this,t.extend({},t.fn.treeinput.defaults,l,t(this).data())),i.data("treeinput",r)),"string"==typeof e&&r[e].apply(r,o)})},t.fn.treeinput.defaults={treeId:"",inputId:"",dropdownId:"",placeholder:"",value:"",caret:"",autoCloseOnSelect:!0},t.fn.treeinput.Constructor=n}(window.jQuery);
\ No newline at end of file
/*!
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2015 - 2017
* @package yii2-tree-manager
* @version 1.0.8
*
* Tree View Validation Module.
*
* Author: Kartik Visweswaran
* Copyright: 2015 - 2017, Kartik Visweswaran, Krajee.com
* Copyleft: 2015 - 2017, Kartik Visweswaran, Krajee.com
* For more JQuery plugins visit http://plugins.krajee.com
* For more Yii related demos visit http://demos.krajee.com
*/
......
/*!
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2015 - 2017
* @package yii2-tree-manager
* @version 1.0.8
*
* Tree View Validation Module.
*
* Author: Kartik Visweswaran
* Copyright: 2015 - 2017, Kartik Visweswaran, Krajee.com
* Copyleft: 2015 - 2017, Kartik Visweswaran, Krajee.com
* For more JQuery plugins visit http://plugins.krajee.com
* For more Yii related demos visit http://demos.krajee.com
*/!function(h){"use strict";var f,n,a;f={QUERY_PARAM:"kvtree",DEFAULT_BUTTONS:{create:"create",createR:"create-root",trash:"remove",moveU:"move-up",moveD:"move-down",moveL:"move-left",moveR:"move-right",refresh:"refresh"},isEmpty:function(e,t){return null==e||0===e.length||t&&""===h.trim(e)},escapeRegExp:function(e){return e.replace(/[\-\[\]\/\{}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},addCss:function(e,t){e.removeClass(t).addClass(t)},hashString:function(e){return e.split("").reduce(function(e,t){return(e=(e<<5)-e+t.charCodeAt(0))&e},0)},delay:(a=0,function(e,t){clearTimeout(a),a=setTimeout(e,t)})},(n=function(e,t){var a=this;a.$element=h(e),a.init(t),a.listen()}).prototype={constructor:n,init:function(e){var t,a=this;a.initCache(),h.each(e,function(e,t){a[e]=t}),a.dialogLib=window[a.dialogLib]||"",a.btns=h.extend({},f.DEFAULT_BUTTONS,a.btns),a.$tree=h("#"+a.treeId),a.$treeContainer=a.$tree.parent(),a.$detail=h("#"+a.detailId),a.$toolbar=h("#"+a.toolbarId),a.$wrapper=h("#"+a.wrapperId),a.$searchContainer=a.$wrapper.find(".kv-search-container"),a.$search=a.$wrapper.find(".kv-search-input"),a.$clear=a.$wrapper.find(".kv-search-clear"),t=a.$detail.find("form"),a.treeManageHash=t.find('input[name="treeManageHash"]').val(),a.treeRemoveHash=t.find('input[name="treeRemoveHash"]').val(),a.treeMoveHash=t.find('input[name="treeMoveHash"]').val(),a.select(a.$element.data("key"),!0),a.treeCache.timeout=a.cacheTimeout,a.hasActiveFilter=!1,a.selectNodes(),a.validateTooltips()},initCache:function(){var i=this;i.treeCache={timeout:3e5,data:{},remove:function(e){delete i.treeCache.data[e]},exist:function(e){var t=i.treeCache;return!!t.data[e]&&(new Date).getTime()-t.data[e]._<t.timeout},get:function(e){return i.treeCache.data[e].data},set:function(e,t,a){i.treeCache.remove(e),i.treeCache.data[e]={_:(new Date).getTime(),data:t},h.isFunction(a)&&a(t)}}},validateTooltips:function(){var e=this;e.showTooltips&&(e.$toolbar.find(".btn").tooltip(),e.$detail.find(".btn").tooltip())},trigAlert:function(e,t){var a=this.alertFadeDuration;t&&h.isFunction(t)||(t=function(){}),setTimeout(function(){e.fadeOut(a,t())},2*a)},selectNodes:function(){var a=this,e=a.$element.val();0===e.length||f.isEmpty(e)||(a.$tree.find("li").removeClass("kv-selected"),e=e.split(","),h(e).each(function(e,t){f.addCss(a.$tree.find('li[data-key="'+t+'"]'),"kv-selected")}))},raise:function(e){1<arguments.length?this.$element.trigger(e,arguments[1]):this.$element.trigger(e)},enableToolbar:function(){this.$toolbar.find("button:not([data-always-disabled])").removeAttr("disabled")},disableToolbar:function(){var e=this;e.$toolbar.find("button").attr("disabled",!0),e.$toolbar.find(".kv-"+e.btns.createR+":not([data-always-disabled])").removeAttr("disabled")},enable:function(e){this.$toolbar.find(".kv-"+this.btns[e]).removeAttr("disabled")},disable:function(e){this.$toolbar.find(".kv-"+this.btns[e]).attr("disabled",!0)},showAlert:function(e,t,a){var i=this,s=i.$detail,n=s.find(".alert-"+t);s.find(".kv-select-node-msg").remove(),n.removeClass("hide").hide().find("div").remove(),n.append("<div>"+e+"</div>").fadeIn(i.alertFadeDuration,function(){i.trigAlert(n,a)})},removeAlert:function(){this.$detail.find(".alert").addClass("hide")},renderForm:function(i,e,t){var s=this,n=s.$detail,a=e||"",o=t||!1,r=f.hashString(i+s.modelClass+s.isAdmin+a),l=n.find("form"),d=s.actions.manage,c=d&&-1!==d.indexOf("?")?"&":"?";d+=encodeURI(c+f.QUERY_PARAM+"="+r),s.formViewBegin=!0,s.parseCache(),s.removeAlert(),h.ajax({type:"post",dataType:"json",data:{id:i,modelClass:s.modelClass,isAdmin:s.isAdmin,formAction:s.formAction,formOptions:s.formOptions,parentKey:a,iconsList:s.iconsList,currUrl:s.currUrl,softDelete:s.softDelete,showFormButtons:s.showFormButtons,showIDAttribute:s.showIDAttribute,multiple:s.multiple,nodeView:s.nodeView,nodeAddlViews:s.nodeAddlViews,nodeSelected:s.nodeSelected,breadcrumbs:s.breadcrumbs,allowNewRoots:s.allowNewRoots,treeManageHash:s.treeManageHash},url:d,cache:!0,beforeSend:function(e,t){s.raise("treeview.beforeselect",[i,e,t]),l.length&&l.off().yiiActiveForm("destroy").remove(),n.html(""),f.addCss(n,"kv-loading")},success:function(e,t,a){if(n.removeClass("kv-loading"),"error"===e.status)return n.html('<div class="alert alert-danger" style="margin-top:20px">'+e.out+"</div>"),void s.raise("treeview.selecterror",[i,e,t,a]);n.html(e.out),n.find('button[type="reset"]').on("click",function(){s.removeAlert()}),s.removeAlert(),!1===o||f.isEmpty(o.out)||s.showAlert(o.out,o.type),s.raise("treeview.selected",[i,e,t,a])},error:function(e,t,a){s.raise("treeview.selectajaxerror",[i,e,t,a])},complete:function(e){s.validateTooltips(),s.raise("treeview.selectajaxcomplete",[i,e])}})},select:function(e,t,a){if(!f.isEmpty(e)){var i,s=this,n=t||!1,o=a||!1,r=s.$tree.find('li[data-key="'+e+'"]>.kv-tree-list .kv-node-detail');0!==r.length&&(s.$tree.find(".kv-node-detail").removeClass("kv-focussed"),f.addCss(r,"kv-focussed"),n?s.$tree.find("li.kv-parent").each(function(){var e=h(this);0<e.has(r).length&&e.removeClass("kv-collapsed")}):s.renderForm(e,null,o),(i=r.closest("li")).hasClass("kv-disabled")?s.disableToolbar():s.enableToolbar(),(!i.data("removable")||i.hasClass("kv-inactive")&&s.softDelete||!i.data("removableAll")&&i.hasClass("kv-parent"))&&s.disable("trash"),i.data("movable-u")||s.disable("moveU"),i.data("movable-d")||s.disable("moveD"),i.data("movable-l")||s.disable("moveL"),i.data("movable-r")||s.disable("moveR"),s.parseParentFlag(e))}},parseParentFlag:function(e){var t,a=this.$detail.find('input[class="kv-parent-flag"]'),i=this.$tree.find('li[data-key="'+e+'"]');a.each(function(){var e=h(this);(t=e.closest("div.checkbox")).removeClass("disabled"),i.hasClass("kv-parent")?e.removeAttr("disabled"):(e.attr("disabled","disabled"),t.addClass("disabled"))})},remove:function(){var i,o,r=this,e=r.$tree.find("li .kv-node-detail.kv-focussed"),l=e.closest("li"),s=r.messages,d=r.$detail,c=d.find("form");0===e.length&&!l.hasClass("kv-empty")||l.hasClass("kv-disabled")||(o=function(e){var t=e?s.emptyNodeRemoved:s.nodeRemoved,a=l.closest("li.kv-parent");l.remove(),i=d.find(".alert"),r.formViewBegin=!1,d.find(".kv-select-node-msg").remove(),i.length&&d.before(i).html("").append(i),a.find("li").length||a.removeClass("kv-parent"),r.showAlert(t,"info",function(){d.append('<h4 class="alert text-center kv-select-node-msg" style="display:none;">'+s.selectNode+"</h4>"),setTimeout(function(){r.formViewBegin||d.find(".kv-select-node-msg").fadeIn(r.alertFadeDuration)},r.alertFadeDuration)})},r.dialogLib.confirm(s.removeNode,function(e){if(e)if(l.hasClass("kv-empty"))o(!0);else{var n=l.data("key");h.ajax({type:"post",dataType:"json",data:{id:n,modelClass:r.modelClass,softDelete:r.softDelete,treeRemoveHash:r.treeRemoveHash},url:r.actions.remove,beforeSend:function(e,t){r.raise("treeview.beforeremove",[n,e,t]),c.hide(),r.removeAlert(),f.addCss(d,"kv-loading")},success:function(e,t,a){if("success"===e.status){if((r.isAdmin||r.showInactive)&&r.softDelete){r.showAlert(e.out,"info"),c.show();var i=r.modelClass.split("\\").pop(),s=c.find('input[name="'+i+'[active]"]');s.val(!1),s.prop("checked",!1),f.addCss(l,"kv-inactive"),l.data("removableAll")&&f.addCss(l.find("li"),"kv-inactive"),f.addCss(l,"kv-inactive")}else o();r.softDelete||r.disableToolbar(),r.raise("treeview.remove",[n,e,t,a])}else r.showAlert(e.out,"danger"),c.show(),r.raise("treeview.removeerror",[n,e,t,a]);d.removeClass("kv-loading")},error:function(e,t,a){r.raise("treeview.removeajaxerror",[n,e,t,a])},complete:function(e){r.raise("treeview.removeajaxcomplete",[e])}})}}))},move:function(i){var s,n,o,e,r=this,t=r.$tree.find("li .kv-node-detail.kv-focussed"),l=t.closest("li"),a=r.messages,d=r.$detail,c=null,v=function(){};if(0!==t.length&&!l.hasClass("kv-disabled"))if(l.hasClass("kv-empty"))r.dialogLib.alert(a.nodeNewMove);else{switch(i){case"u":if(0===(c=l.prev()).length)return void r.dialogLib.alert(a.nodeTop);v=function(){c.before(l)};break;case"d":if(0===(c=l.next()).length)return void r.dialogLib.alert(a.nodeBottom);v=function(){c.after(l)};break;case"l":if(0===(c=l.parent("ul").closest("li.kv-parent")).length)return void r.dialogLib.alert(a.nodeLeft);(e=c.parent("ul")).hasClass("kv-tree")&&(c=e.children("li:last-child")),v=function(){c.after(l),0===c.find("li").length&&(c.removeClass("kv-parent"),c.find("ul").remove())};break;case"r":if(0===(c=l.prev()).length)return void r.dialogLib.alert(a.nodeRight);v=function(){0<c.find("li").length?c.children("ul").append(l):(f.addCss(c,"kv-parent"),h(document.createElement("ul")).appendTo(c).append(l))};break;default:throw"Invalid move direction '"+i+"'"}s=l.data("key"),n=c.data("key"),h.ajax({type:"post",dataType:"json",data:{idFrom:s,idTo:n,modelClass:r.modelClass,dir:i,allowNewRoots:r.allowNewRoots,treeMoveHash:r.treeMoveHash},url:r.actions.move,beforeSend:function(e,t){r.raise("treeview.beforemove",[i,s,n,e,t]),f.addCss(r.$treeContainer,"kv-loading-search")},success:function(e,t,a){0<d.length&&r.removeAlert(),"success"===e.status?(v(),"l"===i||"r"===i?(r.treeCache.timeout=0,o=0<d.length&&{out:e.out,type:"success"},r.select(s,!1,o),r.treeCache.timeout=r.cacheTimeout):0<d.length&&r.showAlert(e.out,"success"),r.$tree.find("li.kv-collapsed").each(function(){0<h(this).has(l).length&&h(this).removeClass("kv-collapsed")}),r.raise("treeview.move",[i,s,n,e,t,a])):0<d.length&&(r.showAlert(e.out,"danger"),r.raise("treeview.moveerror",[i,s,n,e,t,a])),r.$treeContainer.removeClass("kv-loading-search")},error:function(e,t,a){0<d.length&&(r.removeAlert(),r.showAlert(a,"danger")),r.$treeContainer.removeClass("kv-loading-search"),r.raise("treeview.moveajaxerror",[i,s,n,e,t,a])},complete:function(e){r.raise("treeview.moveajaxcomplete",[e])}})}},setSelected:function(){var i="",s="";this.$tree.find(".kv-selected").each(function(){var e=h(this),t=f.isEmpty(i)?"":",",a=f.isEmpty(i)?"":"||";i+=t+e.data("key"),s+=a+e.find(">.kv-tree-list .kv-node-label").text()}),this.$element.val(i),this.raise("treeview.change",[i,s]),this.raise("change")},getNewNode:function(){return'<div class="kv-tree-list" tabindex="-1">\n <div class="kv-node-indicators">&nbsp;</div>\n <div class="kv-node-detail kv-focussed">\n <span class="kv-node-label">'+this.messages.emptyNode+"</span>\n </div>\n</div>"},create:function(){var e,t,a,i,s,n=this,o=n.$tree.find("li .kv-node-detail.kv-focussed"),r=o.closest("li"),l=n.messages;if(r.hasClass("kv-disabled"))n.dialogLib.alert(l.nodeDisabled);else if(0===o.length||r.hasClass("kv-empty"))n.dialogLib.alert(l.invalidCreateNode);else{if(n.$toolbar.find(".kv-"+n.btns.trash).removeAttr("disabled"),0<(s=r.find("> ul > li.kv-empty")).length)return t=s.data("key").replace("empty-",""),n.renderForm(null,t),o.removeClass("kv-focussed"),void f.addCss(s.find(".kv-node-detail"),"kv-focussed");s=h(document.createElement("li")).attr({"data-key":"empty-"+r.data("key"),class:"kv-empty"}),a=n.getNewNode(),o.removeClass("kv-focussed"),s.append(a),r.hasClass("kv-parent")?r.children("ul").append(s):(f.addCss(r,"kv-parent"),e=h(document.createElement("ul")).append(s),r.append(e)),n.renderForm(null,r.data("key")),i=s.find(".kv-node-detail"),r.removeClass("kv-collapsed"),s.children(".kv-tree-list").focus(),i.on("click",function(){n.$tree.find(".kv-node-detail").removeClass("kv-focussed"),f.addCss(i,"kv-focussed"),t=s.data("key").replace("empty-",""),n.renderForm(null,t),n.$toolbar.find(".kv-"+n.btns.trash).removeAttr("disabled")}),n.raise("treeview.create",[parent])}},createRoot:function(){var e=this,t=e.$tree.find(".kv-tree"),a=t.children("li.kv-empty");if(e.$tree.find(".kv-node-detail").removeClass("kv-focussed"),0<a.length)return f.addCss(a.find(".kv-node-detail"),"kv-focussed"),void e.renderForm(null,e.rootKey);var i=e.getNewNode(),s=h(document.createElement("li")).attr({"data-key":"empty-root",class:"kv-empty"});s.html(i),t.append(s),e.renderForm(null,e.rootKey);var n=s.find(".kv-node-detail");f.addCss(n,"kv-focussed"),e.$toolbar.find(".kv-"+e.btns.trash).removeAttr("disabled"),n.on("click",function(){e.$tree.find(".kv-node-detail").removeClass("kv-focussed"),f.addCss(n,"kv-focussed"),e.renderForm(null,e.rootKey),e.$toolbar.find(".kv-"+e.btns.trash).removeAttr("disabled")}),e.raise("treeview.createroot")},toggle:function(e){var t=e.closest("li.kv-parent"),a=t.data("key");t.hasClass("kv-collapsed")?(t.removeClass("kv-collapsed"),this.raise("treeview.expand",[a])):(f.addCss(t,"kv-collapsed"),this.raise("treeview.collapse",[a]))},toggleAll:function(e,t){var a=this;if("expand"===e)return a.$tree.removeClass("kv-collapsed"),a.$tree.find(".kv-collapsed").removeClass("kv-collapsed"),void(t&&a.raise("treeview.expandall"));f.addCss(a.$tree.find("li.kv-parent"),"kv-collapsed"),f.addCss(a.$tree,"kv-collapsed"),t&&a.raise("treeview.collapseall")},check:function(e){var t,a=this,i=!0===e,s=i?a.$tree:e.closest("li"),n=i?"":s.data("key"),o=a.multiple&&0!=a.multiple;s.hasClass("kv-disabled")||i&&!o||(s.hasClass("kv-selected")?(s.removeClass("kv-selected"),o?a.cascadeSelectChildren&&s.find("li:not(.kv-disabled)").removeClass("kv-selected"):(a.$tree.find("li:not(.kv-disabled)").removeClass("kv-selected"),a.$element.val(""),a.raise("treeview.change",["",""]),a.raise("change")),a.raise("treeview.unchecked",[n])):(o?a.cascadeSelectChildren&&f.addCss(s.find("li:not(.kv-disabled)"),"kv-selected"):(a.$tree.find("li:not(.kv-disabled)").removeClass("kv-selected"),a.$element.val(n),t=s.find(">.kv-tree-list .kv-node-label").text(),a.raise("treeview.change",[n,t]),a.raise("change")),f.addCss(s,"kv-selected"),a.raise("treeview.checked",[n])),o&&a.setSelected())},clear:function(){this.$treeContainer.removeClass("kv-loading-search"),this.$tree.find(".kv-highlight").removeClass("kv-highlight"),this.blurFilter()},parseCache:function(){var n=this;if(!n.enableCache)return!1;h.ajaxPrefilter(function(e,t){if(e.cache){var a=t.beforeSend||h.noop,i=t.success||h.noop,s=t.url;e.cache=!1,e.beforeSend=function(){return a(),!n.treeCache.exist(s)||(i(n.treeCache.get(s)),!1)},e.success=function(e){n.treeCache.set(s,e,i)}}})},focusFilter:function(){var e=this;e.hideUnmatchedSearchItems&&(e.hasActiveFilter||(e.hasActiveFilter=!0),0<e.$search.val().length&&f.addCss(e.$treeContainer,"kv-active-filter"))},blurFilter:function(){var e=this;e.clearSearchResults(),e.hideUnmatchedSearchItems&&(e.hasActiveFilter&&(e.hasActiveFilter=!1),e.$treeContainer.removeClass("kv-active-filter"),e.$treeContainer.find(".kv-highlight").removeClass("kv-highlight"),e.$treeContainer.find(".kv-tree-container li.kv-filter-match").removeClass("kv-filter-match"))},clearSearchResults:function(){this.$tree.find(".kv-node-label .kv-search-found").each(function(){var e=h(this);h(document.createElement("span")).appendTo(e).unwrap().remove()})},listen:function(){var n=this;n.$tree.find(".kv-node-toggle").each(function(){var e=h(this);e.on("click",function(){n.toggle(e)})}),n.$tree.find(".kv-node-checkbox:not(.kv-disabled)").each(function(){var e=h(this);e.on("click",function(){n.check(e)})}),n.$treeContainer.find(".kv-root-node-toggle").on("click",function(){h(this).closest(".kv-tree-container").hasClass("kv-collapsed")?n.toggleAll("expand",!0):n.toggleAll("collapse",!0)}),n.$treeContainer.find(".kv-root-node-checkbox").on("click",function(){n.check(!0)}),n.$search.on("keyup",function(){var s=h(this).val();n.clear(),n.clearSearchResults(),f.addCss(n.$treeContainer,"kv-loading-search"),f.delay(function(){n.focusFilter(),n.$tree.find("li.kv-filter-match").removeClass("kv-filter-match"),n.toggleAll("collapse",!1),s=f.escapeRegExp(s),n.$tree.find(".kv-node-label").each(function(){var e,t,a=h(this),i=a.text();i.search(new RegExp(s,"i"))<0?a.removeClass("kv-highlight"):(f.addCss(a,"kv-highlight"),e=new RegExp(s,"ig"),t=i.replace(e,function(e){return'<span class="kv-search-found">'+e+"</span>"}),a.html(t),n.$tree.find("li.kv-parent").each(function(){var e=h(this);0<e.has(a).length&&e.removeClass("kv-collapsed")}))}),n.$tree.find(".kv-highlight").parentsUntil(n.$tree.selector,"li").each(function(){f.addCss(h(this),"kv-filter-match")}),n.$treeContainer.removeClass("kv-loading-search"),n.$treeContainer.find(".kv-tree-container").removeClass("kv-collapsed"),n.raise("treeview.search"),0===s.length&&n.blurFilter()},250)}).on("focus",function(){n.focusFilter()}).on("blur",function(){var e=h(this).val();null!==e&&""!==e||n.blurFilter()}),n.$clear.on("click",function(){n.$search.val(""),n.clear()}),n.$tree.find(".kv-node-detail").each(function(){h(this).on("click",function(){var e=h(this),t=e.closest("li"),a=t.data("key");if(n.$tree.hasClass("kv-tree-input-widget"))return e.removeClass("kv-focussed"),void n.check(t);e.hasClass("kv-focussed")||(n.select(a),n.removeAlert(),n.raise("treeview.select",[a]))})}),n.$toolbar.find(".kv-"+n.btns.create).on("click",function(){n.create()}),n.$toolbar.find(".kv-"+n.btns.createR).on("click",function(){n.createRoot()}),n.$toolbar.find(".kv-"+n.btns.trash).on("click",function(){n.remove()}),n.$toolbar.find(".kv-"+n.btns.moveU).on("click",function(){n.move("u")}),n.$toolbar.find(".kv-"+n.btns.moveD).on("click",function(){n.move("d")}),n.$toolbar.find(".kv-"+n.btns.moveL).on("click",function(){n.move("l")}),n.$toolbar.find(".kv-"+n.btns.moveR).on("click",function(){n.move("r")}),n.$detail.find(".alert").each(function(){var e=h(this);e.hasClass("hide")||(e.hide().fadeIn(1500),n.trigAlert(e))})},expandAll:function(){this.toggleAll("expand")},collapseAll:function(){this.toggleAll("collapse")},checkAll:function(){this.$tree.removeClass("kv-selected"),this.check(!0)},uncheckAll:function(){f.addCss(this.$tree,"kv-selected"),this.check(!0)},checkNode:function(e){var t=this.$tree.find('li[data-key="'+e+'"]');t.length&&(t.removeClass("kv-selected"),this.check(t))},uncheckNode:function(e){var t=this.$tree.find('li[data-key="'+e+'"]');t.length&&(f.addCss(t,"kv-selected"),this.check(t))}},h.fn.treeview=function(e){var t,a,i,s=Array.apply(null,arguments);return s.shift(),this.each(function(){t=h(this),a=t.data("treeview"),i="object"==typeof e&&e,a||(a=new n(this,h.extend({},h.fn.treeview.defaults,i,h(this).data())),t.data("treeview",a)),"string"==typeof e&&a[e].apply(a,s)})},h.fn.treeview.defaults={btns:{},treeId:"",detailId:"",toolbarId:"",wrapperId:"",showTooltips:!0,alertFadeDuration:1e3,cacheTimeout:3e5,showInactive:!1,actions:{manage:"",move:"",delete:""},messages:{emptyNode:"",nodeDisabled:"",invalidCreateNode:"",removeNode:"",nodeRemoved:"",emptyNodeRemoved:"",nodeNewMove:"",nodeTop:"",nodeBottom:"",nodeLeft:"",nodeRight:""},breadcrumbs:{},cascadeSelectChildren:!0,rootKey:"",hideUnmatchedSearchItems:!0},h.fn.treeview.Constructor=n}(window.jQuery);
......@@ -2,7 +2,7 @@
/**
* Aria S.p.A.
* OPEN 2.0
* Arter
*
*
* @package Open20Package
......@@ -10,7 +10,6 @@
*/
/**
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2015 - 2017
* @package yii2-tree-manager
* @version 1.0.8
*/
......
......@@ -2,7 +2,7 @@
/**
* Aria S.p.A.
* OPEN 2.0
* Arter
*
*
* @package Open20Package
......
......@@ -2,7 +2,7 @@
/**
* Aria S.p.A.
* OPEN 2.0
* Arter
*
*
* @package Open20Package
......
......@@ -2,7 +2,7 @@
/**
* Aria S.p.A.
* OPEN 2.0
* Arter
*
*
* @package Open20Package
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment