⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 isc_grids.js

📁 javascript 很酷的类库
💻 JS
📖 第 1 页 / 共 5 页
字号:
/*  SmartClient Ajax RIA system  Version 6.5/LGPL Development Only (2008-04-30)  Copyright 2000-2007 Isomorphic Software, Inc. All rights reserved.  "SmartClient" is a trademark of Isomorphic Software, Inc.  LICENSE NOTICE     INSTALLATION OR USE OF THIS SOFTWARE INDICATES YOUR ACCEPTANCE OF THE     SOFTWARE EVALUATION LICENSE AGREEMENT. If you have received this file     without an Isomorphic Software license file, please see:         http://www.isomorphic.com/licenses/isc_eval_license_050316.html     You are not required to accept this agreement, however, nothing else     grants you the right to copy or use this software. Unauthorized copying     and use of this software is a violation of international copyright law.  EVALUATION ONLY     This software is provided for limited evaluation purposes only. You must     acquire a deployment license from Isomorphic Software in order to use     the SmartClient system, or any portion thereof, in any non-evaluation     application, including internal or non-commercial applications.  PROPRIETARY & PROTECTED MATERIAL     This software contains proprietary materials that are protected by     contract and intellectual property law. YOU ARE EXPRESSLY PROHIBITED     FROM ATTEMPTING TO REVERSE ENGINEER THIS SOFTWARE OR MODIFY THIS     SOFTWARE FOR HUMAN READABILITY.  CONTACT ISOMORPHIC     For more information regarding license rights and restrictions, or to     report possible license violations, please contact Isomorphic Software     by email (licensing@isomorphic.com) or web (www.isomorphic.com).*/if(window.isc&&window.isc.module_Core&&!window.isc.module_Grids){isc.module_Grids=1;isc._moduleStart=isc._Grids_start=(isc.timestamp?isc.timestamp():new Date().getTime());if(isc._moduleEnd&&(!isc.Log||(isc.Log && isc.Log.logIsDebugEnabled('loadTime')))){isc._pTM={ message:'Grids load/parse time: ' + (isc._moduleStart-isc._moduleEnd) + 'ms', category:'loadTime'};if(isc.Log && isc.Log.logDebug)isc.Log.logDebug(isc._pTM.message,'loadTime')else if(isc._preLog)isc._preLog[isc._preLog.length]=isc._pTMelse isc._preLog=[isc._pTM]}isc.ClassFactory.defineInterface("List");isc.List.addInterfaceMethods({init:function(){if(!this.data)this.data=[]},first:function(){return this.get(0)},last:function(){return this.get(this.getLength()-1)},indexOf:function(_1,_2,_3){if(_2==null)_2=0;if(_3==null)_3=this.getLength()-1;for(var i=_2;i<=_3;i++){if(this.get(i)==_1)return i}return-1},lastIndexOf:function(_1,_2,_3){if(_2==null)_2=this.getLength()-1;if(_3==null)_3=0;for(var i=_2;i>=_3;i--)if(this.get(i)==_1)return i;return-1},findNextIndex:function(_1,_2,_3,_4){var _5=this.getLength();if(_1==null)_1=0;else if(_1>=_5)return-1;if(_4==null)_4=_5-1;if(_2==null)return-1;if(isc.isA.String(_2)){for(var i=_1;i<=_4;i++){var _7=this.get(i);if(_7&&_7[_2]==_3)return i}return-1}else{return this.findNextMatch(_2,_1,_4)}},findAll:function(_1,_2){if(_1==null)return null;if(isc.isA.String(_1)){var _3=null,l=this.getLength();for(var i=0;i<l;i++){var _6=this.get(i);if(_6&&_6[_1]==_2){if(_3==null)_3=[];_3.add(_6)}}return _3}else{return this.findAllMatches(_1)}},getRange:function(_1,_2){if(_2==null)_2=this.getLength()-1;var _3=[];for(var i=_1;i<_2;i++){_3[_3.length]=this.get(i)}return _3},duplicate:function(){return this.newInstance().addList(this)},add:function(_1,_2){var _3;if(_2!==_3){return this.addAt(_1,_2)}this.addAt(_1,this.getLength());return _1},setLength:function(_1){this.$ed();if(_1>this.getLength()){var _2;while(_1>this.getLength())this.add(_2)}else{while(_1<this.getLength())this.removeAt(this.getLength()-1)}this.$ee()},addListAt:function(_1,_2){this.$ed();var _3=_1.getLength();for(var i=0;i<_3;i++){this.addAt(_1.get(i),_2+i)}this.$ee();return _1},remove:function(_1){var _2=this.indexOf(_1);if(_2==-1)return false;this.$ed();var _3=this.getLength();for(var i=_2;i<_3;i++)this.set(i,this.get(i+1));this.setLength(_3-1);this.$ee();return true},removeList:function(_1){if(_1==null)return null;this.$ed();var _2=false;for(var i=0;i<this.getLength();i++){var _4=this.get(i);if(_1.contains(_4)){_2=true;this.removeAt(i);i--}}this.$ee();return _1},sort:function(_1){var _2=this.getRange(0,this.getLength());_2.sort(_1);for(var i=0;i<_2.length;i++)this.set(i,_2[i]);return this},sortByProperty:function(_1,_2,_3,_4){var _5=this.getRange(0,this.getLength());_5.sortByProperty(_1,_2,_3,_4);for(var i=0;i<_5.length;i++)this.set(i,_5[i]);return this},dataChanged:function(){}});isc.$27b=function(){var _1=["isEmpty","contains","containsAll","intersect","equals","getItems","addList","getValueMap","removeEvery","$ed","$ee","$52z","getItem","setItem","removeItem","clearAll","find","findIndex","findNextMatch","findAllMatches","findByKeys","size","subList","addAll","removeAll","clear"];var _2={};for(var i=0;i<_1.length;i++){var _4=_1[i];_2[_4]=Array.prototype[_4]}isc.List.addInterfaceMethods(_2)}isc.$27b();isc.A=isc.isA;isc.B=isc._allFuncs;isc.C=isc.B._maxIndex;isc.D=isc._funcClasses;isc.D[isc.C]=isc.A.Class;isc.A.$27c="List";isc.B.push(isc.A.List=function(_1){if(_1==null)return false;if(isc.isA.Array(_1))return true;return _1.isA&&_1.isA(this.$27c)});isc.B._maxIndex=isc.C+1;isc.ClassFactory.defineClass("Tree",null,"List");isc.A=isc.Tree;isc.A.FOLDERS_AND_LEAVES=null;isc.A.FOLDERS_ONLY="folders";isc.A.LEAVES_ONLY="leaves";isc.A.UNLOADED=null;isc.A.LOADING="loading";isc.A.FOLDERS_LOADED="folders";isc.A.LOADED="loaded";isc.A.autoID=0;isc.A=isc.Tree.getPrototype();isc.A.modelType="children";isc.A.isFolderProperty="isFolder";isc.A.autoSetupParentLinks=true;isc.A.pathDelim="/";isc.A.treeProperty="$42c";isc.A.nameProperty="name";isc.A.titleProperty="title";isc.A.childrenProperty="children";isc.A.cacheOpenList=true;isc.A.sortDirection=Array.ASCENDING;isc.A.showRoot=false;isc.A.autoOpenRoot=true;isc.A.separateFolders=false;isc.A.defaultNodeTitle="Untitled";isc.A.defaultLoadState=isc.Tree.UNLOADED;isc.A=isc.Tree.getPrototype();isc.B=isc._allFuncs;isc.C=isc.B._maxIndex;isc.D=isc._funcClasses;isc.D[isc.C]=isc.A.Class;isc.A.$27d=0;isc.A.loadBatchSize=50;isc.B.push(isc.A.init=function(){isc.ClassFactory.addGlobalID(this);if(!this.parentProperty)this.parentProperty="_parent_"+this.ID;if(!this.isFolderProperty)this.isFolderProperty="_isFolder_"+this.ID;if(this.idField==null)this.idField="id";if(this.parentIdField==null)this.parentIdField="parentId";if(!this.openProperty)this.openProperty="_isOpen_"+this.ID;this.setRoot(this.root||this.makeRoot());if(this.loadOnInit&&this.loadBatchSize>=0)this.loadSubtree(null,null,true)},isc.A.destroy=function(){if(window[this.ID]==this)window[this.ID]=null},isc.A.makeRoot=function(){var _1={};var _2;if(this.idField!==_2)_1[this.idField]=this.rootValue;return _1},isc.A.convertToFolder=function(_1){_1[this.isFolderProperty]=true},isc.A.makeNode=function(_1,_2){var _3=this.find(_1);if(_3){if(_2)this.convertToFolder(_3);return _3}var _4=_1.split(this.pathDelim);var _5=this.getRoot()[this.nameProperty];if(_5.endsWith(this.pathDelim))_5=_5.substring(0,_5.length-this.pathDelim.length);if(_4[0]!=_5)_4.addAt(_5,0);var _6=_4[_4.length-1],_7=(_6!=isc.emptyString);if(!_7){_4.length=_4.length-1;_6=_4[_4.length-1]}var _8=_4.slice(0,(_4.length-1)).join(this.pathDelim)+this.pathDelim;var _9=this.find(_8);if(_9==null){_9=this.find(_8.substring(0,_8.length-this.pathDelim.length))}if(!_9){_9=this.makeNode(_8,_2)}else if(!this.isFolder(_9)){this.convertToFolder(_9)}var _3={};_3[this.nameProperty]=_6;if(!_7)this.convertToFolder(_3);return this.add(_3,_9)},isc.A.isRoot=function(_1){return this.root==_1},isc.A.setupParentLinks=function(_1){if(!_1)_1=this.root;this.nodeIndex[_1[this.idField]]=_1;var _2=_1[this.childrenProperty];if(_2){this.setLoadState(_1,isc.Tree.LOADED);if(!isc.isAn.Array(_2)){_2=_1[this.childrenProperty]=[_2]}}if(!_2||_2.length==0)return;for(var i=0,_4=_2.length,_5;i<_4;i++){_5=_2[i];if(!_5)continue;if(_5[this.parentIdField]==null&&_1[this.idField]!=null)_5[this.parentIdField]=_1[this.idField];_5[this.parentProperty]=_1;if(this.isFolder(_5))this.setupParentLinks(_5);else this.nodeIndex[_5[this.idField]]=_5}},isc.A.connectByParentID=function(_1,_2,_3,_4,_5){this.linkNodes(_1,_2,_3,_4,_5)},isc.A.connectByParentId=function(_1,_2,_3,_4,_5){this.linkNodes(_1,_2,_3,_4,_5)},isc.A.linkNodes=function(_1,_2,_3,_4,_5,_6){if(this.modelType=="fields"){this.connectByFields(_1);return}_1=_1||this.data;_2=_2||this.idField;_3=_3||this.parentIdField;_4=_4||this.rootValue;var _7=_1;var _8=this.logIsDebugEnabled("treeLinking");while(_7.length>0){var _9=_7,_10=false;_7=[];for(var i=0;i<_9.length;i++){var _12=_9[i],_13=_12[_3],_14=this.nodeIndex[_13];if(_14!=null){if(_8){this.logDebug("found parent "+_14[_2]+" for child "+_12[_2],"treeLinking")}this.$27e(_12,_14);_10=true}else if(_13==null&&_6){this.$27e(_12,_6);_10=true}else if(_13!=_4&&_13!=null&&_13!=-1&&_13!=isc.emptyString){if(_8){this.logDebug("couldn't place child: "+_12[_2],"treeLinking")}_7.add(_12)}else{if(_8){this.logDebug("root node: "+_12[_2],"treeLinking")}this.$27e(_12,this.root);_10=true}}if(_8){this.logDebug("end of linking pass: "+_7.length+" unplaced children"+", found new parents: "+_10,"treeLinking")}if(!_10&&_7.length>0){this.logWarn("Couldn't find parents: "+_7.getProperty(_3)+", unplaced children: "+_7.getProperty(_2),"treeLinking");break}}this.$27f();this.dataChanged()},isc.A.connectByFields=function(_1){if(!_1)_1=this.data;for(var i=0;i<_1.length;i++){this.addNodeByFields(_1[i])}},isc.A.addNodeByFields=function(_1){var _2=this.root;for(var i=0;i<this.fieldOrder.length;i++){var _4=this.fieldOrder[i],_5=_1[_4];var _6=_5,_7=this.findChildNum(_2,_6),_8;if(_7!=-1){_8=this.getChildren(_2).get(_7)}else{_8={};_8[this.nameProperty]=_6;this.add(_8,_2);this.convertToFolder(_8)}_2=_8}this.add(_1,_2)},isc.A.getRoot=function(){return this.root},isc.A.setRoot=function(_1,_2){this.root=_1;if(_1&&this.parentProperty.endsWith(this.ID))_1[this.parentProperty]=null;if(this.rootValue==null)this.rootValue=this.root[this.idField];var _3=this.root[this.nameProperty];if(_3==null||_3==isc.emptyString)this.root[this.nameProperty]=this.pathDelim;if(!this.isFolder(this.root))this.convertToFolder(this.root);this.nodeIndex={};if("parent"==this.modelType){if(this.data)this.linkNodes()}else if("fields"==this.modelType){if(this.data)this.connectByFields()}else if("children"==this.modelType){if(this.autoSetupParentLinks)this.setupParentLinks();if(this.data){var _4=this.data;this.data=null;this.addList(_4,this.root)}}else{this.logWarn("Unsupported modelType: "+this.modelType)}if(_2!==false&&(this.autoOpenRoot||_2)){this.openFolder(_1)}this.$27f();this.dataChanged()},isc.A.getCleanNodeData=function(_1,_2){if(_1==null)return null;var _3=[],_4=false;if(!isc.isAn.Array(_1)){_1=[_1];_4=true}for(var i=0;i<_1.length;i++){var _6=_1[i],_7={};for(var _8 in _6){if(_8==this.parentProperty||_8=="$27g"||_8=="$42c"||_8.startsWith("_isOpen_")||_8.startsWith("_isFolder_")||_8.startsWith("$399")||_8=="$40a"||_8.startsWith("_selection_")||(_2==false&&_8==this.childrenProperty))continue;_7[_8]=_6[_8];if(_8==this.childrenProperty&&isc.isAn.Array(_7[_8])){_7[_8]=this.getCleanNodeData(_7[_8])}}_3.add(_7)}if(_4)return _3[0];return _3},isc.A.getName=function(_1){var _2=isc.$ad;if(!_1)return _2;var _3=_1[this.nameProperty];if(_3==null)_3=_1[this.idField];if(_3==null){if(!this.isDescendantOf(_1,this.root)&&_1!=this.root)return null;if(!this.$27h)this.$27h=isc.Tree.autoID+++"_";_3=this.$27h+this.$27d++}if(!isc.isA.String(_3))_3=_2+_3;_1[this.nameProperty]=_3;return _3},isc.A.getTitle=function(_1){if(!_1)return null;if(_1[this.titleProperty]!=null)return _1[this.titleProperty];var _2=_1[this.nameProperty];if(_2==null)_2=this.defaultNodeTitle;return(isc.endsWith(_2,this.pathDelim)?_2.substring(0,_2.length-this.pathDelim.length):_2)},isc.A.getPath=function(_1){var _2=this.getParent(_1);if(_2==null)return this.getName(_1);var _3=this.getName(_2);return this.getPath(_2)+(_3==this.pathDelim?isc.emptyString:this.pathDelim)+this.getName(_1)},isc.A.getParentPath=function(_1){var _2=this.getName(_1),_3=this.getPath(_1);return _3.substring(0,_3.length-_2.length-this.pathDelim.length)}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -