META-INF.resources.static.js.view.angular-json-tree.min.js Maven / Gradle / Ivy
/*global angular */
!function(){"use strict";var e={is:function(e,a){return Object.prototype.toString.call(e).slice(8,-1)===a},whatClass:function(e){return Object.prototype.toString.call(e).slice(8,-1)},forKeys:function(e,a){for(var n in e)if(e.hasOwnProperty(n)&&"function"!=typeof e[n]&&a(n,e[n]))break}};angular.module("angular-json-tree",["ajs.RecursiveDirectiveHelper"]).directive("jsonTree",[function(){return{restrict:"E",scope:{object:"=",startExpanded:"&?",rootName:"&?"},template:' '}}]).directive("jsonNode",["ajsRecursiveDirectiveHelper",function(a){return{restrict:"E",scope:{key:"=",value:"=",startExpanded:"&?"},compile:function(e){return a.compile(e,this)},template:' {{key}} {{value}} {{preview}} -
',pre:function(a,n,s){if(n.addClass(e.whatClass(a.value).toLowerCase()),e.is(a.value,"Object")||e.is(a.value,"Array")){a.isExpandable=!0,n.addClass("expandable");var t=e.is(a.value,"Array");a.preview=t?"[ ":"{ ",e.forKeys(a.value,function(e,n){t?a.preview+=n+", ":a.preview+=e+": "+n+", "}),a.preview=a.preview.substring(0,a.preview.length-(a.preview.length>2?2:0))+(t?" ]":" }"),a.startExpanded&&a.startExpanded()&&(a.shouldRender=!0,n.addClass("expanded")),a.isExpanded=a.startExpanded?a.startExpanded():!1,a.toggleExpanded=function(){a.isExpanded=!a.isExpanded,a.isExpanded?n.addClass("expanded"):n.removeClass("expanded"),a.shouldRender=!0}}else a.isExpandable=!1,n.addClass("not-expandable")}}}]),angular.module("ajs.RecursiveDirectiveHelper",[]).factory("ajsRecursiveDirectiveHelper",["$compile",function(e){return{compile:function(a,n){angular.isFunction(n)&&(n={post:n});var s,t=a.contents().remove();return{pre:n&&n.pre?n.pre:null,post:function(a,r){s||(s=e(t)),s(a,function(e){r.append(e)}),n&&n.post&&n.post.apply(null,arguments)}}}}}])}();
© 2015 - 2025 Weber Informatics LLC | Privacy Policy