_ace.js 9.6 KB

123456
  1. // Licensed Materials - Property of IBM
  2. // IBM Cognos Products: rs
  3. // (C) Copyright IBM Corp. 2003, 2022.
  4. // US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  5. define([],function(){"use strict";function _ace(_9dh, _p8h, _q8h, _w58, _bti, _j07){this._smg=_9dh;this._fkg=_p8h;this._r3i=_bti;this._gkg=_q8h;this._8t7=_w58;this._zo6=_j07;this._f3i=_p8h.selectSingleNode("style/dataFormat");this._dv4={};this._929={};this._9y1={};this._yye={};};_ace.prototype._zoh=function(){var _7dh=this._smg._4e4();var _9xi=this._gkg.getAttribute("idDataSet");var _wah;for(var _h7n=0; _h7n<_7dh.dataSets.length;++_h7n){var _6fc=_7dh.dataSets[_h7n];if(_6fc.id==_9xi){_wah=_6fc;break;}}this._g9d=[_dth._hr9(this._gkg, "RS_geoCodeLatitude"),_dth._hr9(this._gkg, "RS_geoCodeLongitude")].filter(Boolean);if(!_wah){this._vgd=_frh._c6j("IDS_VIS_BAD_DATASET", _9xi);return false;}if(!this._r3i){this._vgd=_frh._c6j("IDS_VIS_NODATA_FOR_DATASET", this._gkg.getAttribute("name"));return false;}this._829={};this._829.id=_wah.id;this._829.idx=_h7n;this._829.rows=[];this._829.fields=[];this._3p7=[];this._929={};for(var i=0; i<_wah.slots.length;++i){var _ybn=_wah.slots[i];var _9um={};this._829.fields.push(_9um);_9um.id=_ybn.id;_9um.handling=_ybn.handling;if(_ybn.type=="category"){_9um.categories=[];this._3p7.push(_ybn.id);}else{var _32k=_8qn._8x(this._gkg, "vcSlots/vcSlotData", "idSlot", _ybn.id);if(_32k){var _yxd=_32k.selectSingleNode("vcSlotDsColumns/vcSlotDsColumn");if(_yxd){var _l5m=this._r3i._375(_yxd.getAttribute("refDsColumn"));if(_l5m){this._9y1[_ybn.id]=this._xf5(_32k, _l5m); }var _xlf=_yxd.selectSingleNode("vcValueFormat/dataFormat");if(_xlf){this._929[_ybn.id]=_xlf;}}}}_9um.optional=_ybn.optional;}var _b78=this._r3i._c56();this._l9d=[];this._ir5={};var _9ul=this._829.fields;var _qdf=0;var _149=[];var _zkc=this._8t7.getAttribute("viz_listSeparator");_zkc=(_zkc==null)?",":_zkc;for(var _ypm=0; _ypm<_9ul.length;++_ypm){var _rbl=_9ul[_ypm];var _ppf={};_ppf._nsk=_rbl;var _ram=_rbl.id;var _32k=_8qn._8x(this._gkg, "vcSlots/vcSlotData", "idSlot", _ram);if(!_32k){if(_rbl.optional){continue;}this._vgd=_frh._c6j("IDS_VIS_BAD_VALUE_FIELD", _ram);return false;}var _2yb=_ppf._rnb=_8qn._fde(null, _32k.selectNodes("vcSlotDsColumns/vcSlotDsColumn/@refDsColumn"));var _czb=_ppf._6ob=this._r3i._xnh(_2yb);var _3a9=_czb.length;if(_rbl.categories){_ppf._5r2=[];for(var i=0; i<_2yb.length;++i){var _u9k=_2yb[i];var _z1m=this._gkg.selectSingleNode( "vcSlotDsColumns/vcSlotDsColumn[@refDsColumns=" + _cgm._zxc( _u9k ) + "]/vcValueFormat/dataFormat" );if(_z1m&&!this._929._ykl()){var _tw2={};_ppf._5r2[i]=_tw2;for(var _7yf in this._929){var _m39=[];_m39.push(_z1m);_m39.push(this._929[_7yf]);_m39.push(this._9y1[_7yf]);_m39.push(this._f3i);_tw2[_7yf]=this._zo6._sp1(_m39);}}}if(_3a9==0){if(_rbl.optional){continue;}if(!_rbl.categories){this._vgd=_frh._c6j("IDS_VIS_BAD_CATEGORY_FIELD", _ram);return false;}_ppf._0x8=true;var _705=this._8t7.selectSingleNode("span[@rs_vcEmptySlotValue=" + _cgm._zxc( _ram ) + "]");_ppf._nv4=_705?_705.text:null;_149.push(_ppf);}else if(_rbl.categories){var _uld=_ppf._9ad=(_32k.getAttribute("valueRange")=="filtered"); _ppf._p04=_rbl.handling=="numeric";var _pt5=_ppf._xn5=[];for(var i=0; i<_3a9;++i){var _cmn=_czb[i];_pt5[i]=_cmn.formattedValues&&!_ppf._p04?_cmn.formattedValues:_cmn.values;}if(_uld){_rbl.categories=[];}else if(_3a9>1){var _u4f=[];var _pzb=_ppf._9ob=[0];for(var i=0; i<_3a9;++i){_pzb[i]=_u4f.length;_u4f=_u4f.concat(_pt5[i]);}_rbl.categories=_u4f;}else{_rbl.categories=_pt5[0];}}else{_ppf._vw8=true;for(var i=0; i<_ppf._rnb.length;++i){var _u9k=_ppf._rnb[i];var _a9k=this._r3i._187(_u9k);switch(_a9k){case "number":case "decimal":break;default:this._vgd=_frh._c6j("IDS_VIS_BAD_FIELD_TYPE", _ram, _u9k, _a9k);return false;}}}}else{var _32k=_8qn._8x(this._gkg, "vcSlots/vcSlotData", "idSlot", _ram);var _d3k=_32k.selectSingleNode("vcSlotDsColumns/vcSlotDsColumn");if(!_d3k){if(_rbl.optional){continue;}this._vgd=_frh._c6j("IDS_VIS_BAD_VALUE_FIELD", _ram);return false;}_ppf._apk=true;if(_32k.getAttribute("decimal")=="true"){_ppf._szh=true;}}var _qfh;var _r3h=this._8t7.selectSingleNode("span[@rs_vcSlotLabel=" + _cgm._zxc( _ram ) + "]");if(_r3h){_qfh=_r3h.text;}else{var _t4f=[];for(var i=0; i<_ppf._6ob.length;++i){var _cmn=_ppf._6ob[i];_t4f.push(_cmn.label||_cmn.name);}_qfh=_t4f.join(_zkc);}_rbl.label=_qfh||"";var _349=_ppf._dw8=[];for(var i=0; i<_ppf._rnb.length;++i){var _d2l=_b78[_ppf._rnb[i]];_349.push(_d2l);_qdf=_d2l;}this._ir5[_ppf._nsk.id]=this._l9d.length;this._l9d.push(_ppf);}for(var _vpm=0; _vpm<_149.length; _vpm++){var _7bh=_149[_vpm]; if(_7bh._nv4==null){_7bh._nv4=this._7w3();}_7bh._nv4=_7bh._nv4||"";if(_7bh._nsk.categories){_7bh._nsk.categories=[_7bh._nv4];}}return this._cv9(this._r3i);};_ace.prototype._usc=function(){return this._829.idx;};_ace.prototype._8r9=function(){return true;};_ace.prototype._8ik=function(){return this._vgd;};_ace.prototype._7w3=function(){var _dwm="";var _e1h=0;for(var i=0; i<this._l9d.length; i++){if(this._l9d[i]._apk){_dwm=this._l9d[i]._nsk.label;_e1h++;}}if(_e1h==1){return _dwm;}return "";};_ace.prototype._cv9=function(_bti){if(this._vgd){return false;}this._r3i=_bti;return this._xi6(this._r3i._4kl());};_ace.prototype._dm=function(){var _qul=[];if(Object.keys(this._yye).length){var _5kd=this._l9d;if(this._g9d.length){_5kd=[];for(var i=0;i<this._l9d.length;i++){var _9um=this._l9d[i];if(this._g9d.indexOf(_9um._nsk.id)!=-1){_5kd.push(_9um);}}}var _8vj=_5kd.length;var _6qf=this._r3i._4kl(); var _d5n=_6qf.rows;for(var _ekn in this._yye){var _hga=[];for(var ix=0; ix<_8vj;++ix){var _ujn=_5kd[ix]._dw8[0];_hga.push(this._2f5(_6qf.columns[_ujn].values, _ujn, _6qf.rows, _ekn));}_qul.push(_hga);}}return _qul;};_ace.prototype._xi6=function(_6qf){ var _eqf={};var _01l=this._829.idx;var _5kd=this._l9d;var _8vj=_5kd.length;var _d5n=_6qf.rows;for(var ix=0; ix<_8vj;++ix){var _9um=this._l9d[ix];var _77k=_eqf[_9um._nsk.id]={label:_9um._nsk.label,dataType:_9um._apk||_9um._p04?"numeric":"string"};if(_9um._apk||_9um._vw8){var _ujn=_9um._dw8[0];var _zfi=_9um._szh?this._uj4:this._58d;_77k.accessor=_zfi.bind(this, _ujn, _d5n);var _mjn=_9um._nsk.min;var _ljn=_9um._nsk.max;if((_mjn!==undefined)&&(_ljn!==undefined)){_77k.domain=[_mjn, _ljn];} }else if(_9um._0x8){_77k.accessor=this._pu3.bind(this, _9um._nv4);}else if(_9um._dw8.length==1){var _cmn=_9um._6ob[0];var _s7i=_9um._xn5[0];var _ujn=_9um._dw8[0];var _zfi;if(_s7i){_zfi=_9um._p04?this._ih1:this._2f5; _77k.accessor=_zfi.bind(this, _s7i, _ujn, _d5n);}else{_zfi=_9um._p04?this._uj4:this._58d;_77k.accessor=_zfi.bind(this, _ujn, _d5n);}if(!_9um._9ad){_77k.domain=_s7i;}}else{_77k.accessor=this._162.bind(this, _9um._xn5, _9um._dw8, _d5n);if(!_9um._9ad){var _nzb=[];for(var i=0; i<_9um._xn5.length;++i){_nzb=_nzb.concat(_9um._xn5[i]);}_77k.domain=_nzb;}}}this._smg._951().SetDataByAccessors(_01l, _d5n.length, _eqf);return true;};_ace.prototype._58d=function(_ujn,_d5n,_ekn){return _d5n[_ekn][_ujn];};_ace.prototype._uj4=function(_ujn,_d5n,_ekn){var _1dl=_d5n[_ekn][_ujn];return _1dl?parseFloat(_1dl):null;};_ace.prototype._2f5=function(_s7i,_ujn,_d5n,_ekn){return _s7i[_d5n[_ekn][_ujn]];};_ace.prototype._ih1=function(_s7i,_ujn,_d5n,_ekn){var _1dl=_s7i[_d5n[_ekn][_ujn]];var _8pm=parseFloat(_1dl);if(isNaN(_8pm)){this._yye[_ekn]=true; return null;}return _8pm;};_ace.prototype._162=function(_pt5,_349,_d5n,_ekn){var _muk=_d5n[_ekn];var _cuj=null;var ip;for(ip=0; ip<_349.length;++ip){_cuj=_muk[_349[ip]];if(_cuj!=null){break;}}return(_cuj===null)?null:_pt5[ip][_cuj];};_ace.prototype._pu3=function(_lic,_ekn){return _lic;};_ace.prototype._682=function(_tvj,_uae){var _muk=(_tvj!==undefined)?this._r3i._4kl().rows[_tvj]:null;if(_muk){for(var _ypm=this._3p7.length-1;_ypm>=0;_ypm--){var _kic=this._3p7[_ypm];var _coa=this._ir5[_kic];if(_coa!==undefined){var _9um=this._l9d[_coa];var _tw2;for(var i=0; i<_9um._dw8.length;++i){if(_muk[_9um._dw8[i]]!=null){_tw2=_9um._5r2[i];break;}}if(_tw2){return _tw2[_uae];}}}}return null;};_ace.prototype._xf5=function(_32k,_jbh){var _y2h=_32k.ownerDocument.createElement("dataFormat");_y2h.setAttribute ("iid", _32k.getAttribute ("iid"));var _z1m=_32k.ownerDocument.createElement(_jbh.type); for(var _lsn in _jbh){_z1m.setAttribute(_lsn, _jbh[_lsn]);}_y2h.appendChild(_z1m);return _y2h;};_ace.prototype._jw3=function(_ram){if(!this._dv4[_ram]){var _tuk=[];_tuk.push(this._929[_ram]); _tuk.push(this._9y1[_ram]); _tuk.push(this._f3i);this._dv4[_ram]=this._zo6._sp1(_tuk, true);}return this._dv4[_ram];};_ace.prototype._ac4=function(_8pm,_uae,_tvj){var _uxm=((_8pm!==null)&&!isNaN(_8pm))?_8pm.toString(10):"";var _l5m=this._682(_tvj, _uae)||this._jw3(_uae);return (_uxm!=="")?_oa6._6ie( _uxm )._y1g( _l5m ):"";};_ace.prototype._e8b=function(_d5n){if(_d5n.length==0){return null;}var _r3e={attributes:[],values:[]};var _6qf=this._r3i._4kl();var _eul=[];var _ekn=_d5n[0];var _muk=_6qf.rows[_ekn];var _1ti={};if(_d5n.length>1){var _fji=_muk.length;for(var j=0; j<_fji; j++){for(var i=1; i<_d5n.length; i++){var _spg=_6qf.rows[_d5n[i]];if(_spg[j]!=_muk[j]){_1ti[j]=true;break;}}}}for(var _ypm=0;_ypm<this._l9d.length;_ypm++){var _9um=this._l9d[_ypm];var _349=_9um._dw8;if(_349.length==0){continue;}if(_9um._apk){var _ujn=_349[0];if(!_1ti[_ujn]){var _8pm=_muk[_ujn];_r3e.values.push({label:_9um._nsk.label,value:this._ac4(_8pm, _9um._nsk.id, _ekn)});}}else{if(this._g9d.indexOf(_9um._nsk.id)!=-1){continue;}var _349=_9um._dw8;var _cuj=null;var ip;for(ip=0; ip<_349.length;++ip){_cuj=_muk[_349[ip]];if(_cuj!=null){break;}}var _s5k=_9um._6ob[ip];var _x8k=_s5k.label||_s5k.name;var _zic=(_cuj===null)?" null":(_9um._vw8?_cuj.toString():_9um._xn5[ip][_cuj]);_r3e.attributes.push({label:_x8k,value:_zic});}}return _r3e;};_ace.prototype._toh=function(){return this._g9d.length>0;};return _ace;});