123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601 |
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: BI UI_Commons
- * (C) Copyright IBM Corp. 2017
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define('baglass/core-client/js/core-client/utils/ValidationUtils',['../i18n/Formatter', 'underscore', '../nls/StringResources', '../ui/dialogs/MessageBox'], function (Formatter, _, StringResources, MessageBox) {
- return {
- _getValidationMessages: function _getValidationMessages() {
- return {
- 'isNumber': function isNumber() {
- return StringResources.get('invalidNumber');
- },
- 'isEmail': function isEmail() {
- return StringResources.get('invalidEmailMessage');
- },
- 'maxLength': function (checkList, timeLocale) {
- timeLocale = timeLocale || {};
- return StringResources.get('exceedMaxLength', {
- 'maxLength': Formatter.formatNumber(checkList.maxLength, {
- 'locale': timeLocale.contentLocale
- })
- });
- }.bind(this),
- 'numericRange': function numericRange(checkList, timeLocale) {
- var errorMessage;
- if (checkList.numericRange.min !== undefined && checkList.numericRange.max !== undefined) {
- errorMessage = StringResources.get('numberOutOfRange', {
- 'min': Formatter.formatNumber(checkList.numericRange.min, {
- 'locale': timeLocale.contentLocale
- }),
- 'max': Formatter.formatNumber(checkList.numericRange.max, {
- 'locale': timeLocale.contentLocale
- })
- });
- } else if (checkList.numericRange.min !== undefined) {
- errorMessage = StringResources.get('numberTooSmall', {
- 'min': Formatter.formatNumber(checkList.numericRange.min, {
- 'locale': timeLocale.contentLocale
- })
- });
- } else if (checkList.numericRange.max !== undefined) {
- errorMessage = StringResources.get('numberTooBig', {
- 'max': Formatter.formatNumber(checkList.numericRange.max, {
- 'locale': timeLocale.contentLocale
- })
- });
- }
- return errorMessage;
- }
- };
- },
- /**
- * Validate an input
- * @param value {string} - the value to be validated
- * @param checkList {object} - the different 'validators' to be applied to the value
- * @param validationFailedCallback {function} - if the validation fails, a dialog will be shown. This callback will be called once that dialog is hidden by the user.
- * @return true|false depending if the value is valid
- */
- validateInput: function validateInput(value, checkList, validationFailedCallback, timeLocale) {
- var okCallback = function okCallback(e) {
- e.stopPropagation();
- MessageBox.inherited('ok', this, arguments);
- if (validationFailedCallback) {
- validationFailedCallback();
- }
- return false;
- };
- for (var validationCheck in checkList) {
- if (checkList.hasOwnProperty(validationCheck)) {
- // Function names for validation need to start with '_validate'
- var funcName = '_validate' + validationCheck.charAt(0).toUpperCase() + validationCheck.slice(1);
- if (this[funcName] && !this[funcName](value, checkList)) {
- var dlg = new MessageBox('warning', StringResources.get('invalidInput'), this.GET_VALIDATION_MESSAGES[validationCheck](checkList, timeLocale));
- dlg.ok = okCallback;
- dlg.open();
- return false;
- }
- }
- }
- return true;
- }
- };
- });
- //# sourceMappingURL=ValidationUtils.js.map
- ;
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2017
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('baglass/core-client/js/core-client/utils/GlassContextHelper',[], function () {
- 'use strict';
- var GlassContextHelper = function GlassContextHelper() {};
- /*
- @glassContext - glassContext
- @jqXHR - jQuery XMLHttpRequest returned by Glass Ajax service on fail
- Is temporary and should be removed when Glass handles the showing of error messages
- */
- GlassContextHelper.prototype.showAjaxServiceErrorMessage = function (glassContext, jqXHR) {
- var messages = '';
- if (jqXHR) {
- var responseJSON = jqXHR.responseJSON;
- if (responseJSON) {
- if (responseJSON.messages) {
- messages = jqXHR.responseJSON.messages.join('\n');
- } else if (responseJSON.cause) {
- try {
- var cause = JSON.parse(responseJSON.cause);
- if (cause.messages) {
- messages = cause.messages.join('\n');
- }
- } catch (e) {
- //if we get here, 'cause' is not a json object
- messages = responseJSON.cause;
- }
- }
- } else {
- messages = jqXHR.responseText;
- }
- }
- glassContext.appController.showErrorMessage(messages, 'Error');
- };
- /*
- @glassContext - glassContext
- @str - the message
- @options - an options jsonObject to pass to glass's showToast
- */
- GlassContextHelper.prototype.displayToast = function (glassContext, str, options) {
- glassContext.appController.showToast(str, options);
- };
- /*
- * preference - name of the preference setting to get. e.g contentLocale, email, etc
- */
- GlassContextHelper.prototype.getUserPreference = function (glassContext, preference) {
- return glassContext.getCoreSvc('.UserProfile').preferences[preference];
- };
- GlassContextHelper.prototype.getContentLocales = function (glassContext) {
- return glassContext.getCoreSvc('.Config').getContentLocales();
- };
- GlassContextHelper.prototype.getLocaleTime = function (glassContext) {
- var preferences = glassContext ? glassContext.getCoreSvc('.UserProfile').preferences : {};
- return {
- timeZone: preferences.timeZoneID || 'America/New_York',
- contentLocale: preferences.contentLocale || 'en'
- };
- };
- return new GlassContextHelper();
- });
- //# sourceMappingURL=GlassContextHelper.js.map
- ;
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2021
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('baglass/core-client/js/core-client/ui/properties/BaseProperty',['../core/View', 'jquery', 'underscore', '../../utils/BidiUtil', '../../utils/ContentFormatter', '../../utils/ValidationUtils', '../KeyCodes', '../../nls/StringResources', '../../utils/GlassContextHelper', '../dialogs/MessageBox'], function (View, $, _, BidiUtil, ContentFormatter, ValidationUtils, KeyCodes, StringResources, GlassContextHelper, MessageBox) {
- 'use strict';
- var BaseProperty = View.extend({
- /**
- @param options.id - unique id
- @param options.validator - for validating property value
- @param options.validator.script {boolean} - validation to check if value contains "<script"
- @param options.validator.isEmail {boolean} - validation to check if value is an email address
- @param options.validator.isNumber {boolean} - validation to check if value is a number
- @param options.staticValidationCallback {callback} - static validation to inform the user about issues on properties. Requires parent propertyUIControl.staticValidationMode to be true.
- If defined, will show an information icon and will call the callback on selection. If undefined, will not show any icon.
- @param options.customValidatorCallback {function} - called when the value changes. This method should return an object
- {
- 'isValid' : {boolean},
- 'message' : {error message},
- 'customHandler': {function} - optional
- }
- @param options.enterKeyCallback {function} - functions to call when the enter/Return key is pressed
- @param options.hasRange.min {number} - validation to check if value is greater than min
- @param options.hasRange.max {number} - validation to check if value is less than max
- @param options.maxLength {number} - validation to check if value as string length
- @param options.hidden {boolean} - should the field be hidden when rendering
- **/
- init: function init(options) {
- if (options.editable) {
- if (_.isUndefined(this.events)) {
- this.events = {};
- }
- this.events['focus .editable' + options.id] = '_onFocus';
- this.events['keydown .editable' + options.id] = '_onKeyDown';
- this.events['clicktap .toggleEdit' + options.id] = '_onToggleEdit';
- this.events['touchend .toggleEdit' + options.id] = '_handleEditClick';
- }
- BaseProperty.inherited('init', this, arguments);
- _.extend(this, options);
- this._modifiedProperties = {};
- this._lastChangedValue = this.value;
- this._isValidValue = true;
- this._updatedOnClose = false;
- },
- render: function render() {
- return Promise.resolve(this.doRender()).then(function () {
- this.processIndent();
- this.processEllipses();
- this.processStaticValidation();
- this.processHidden();
- this._updatedOnClose = false;
- }.bind(this));
- },
- /**
- * Each extending class must extend this method
- */
- doRender: function doRender() {
- //override
- },
- /**
- * re-render this property
- */
- onResize: function onResize() {
- //override
- },
- processIndent: function processIndent() {
- if (this.indent) {
- var node = this.getPropertyNode();
- if (node) {
- node.css('margin-left', this.indent * 10 + 'px');
- }
- }
- },
- /**
- Base class will take care of shortening any string that has the 'ellipses' class
- **/
- processEllipses: function processEllipses() {
- if (!this.ellipses) {
- return;
- }
- if (!this.getPropertyNode().is(':visible')) {
- return;
- }
- // Get all the nodes for the current widget that has the class 'ellipses'
- var $ellipses = this.getPropertyNode().find('.ellipses');
- $.each($ellipses, function (index, node) {
- ContentFormatter.middleShortenString(node);
- ContentFormatter.resizeInput(node);
- });
- },
- /**
- Base class will take care of showing the validation icon if the staticValidatorCallback is set
- **/
- processStaticValidation: function processStaticValidation($div) {
- if (!this.staticValidationCallback) {
- return;
- }
- if (!$div) {
- $div = this.getPropertyNode().closest('.propertyRow');
- }
- if ($div.closest('.propertyUIControl.staticValidationMode').length === 0) {
- return;
- }
- var validationAriaLabel = StringResources.get('validationControl');
- var $wrapper = $('<div>').addClass('validationIcon').prependTo($div).attr({
- tabindex: 0,
- title: validationAriaLabel
- });
- $('<svg><use style="pointer-events: none;" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#common-failed"></use></svg>').appendTo($wrapper);
- if (typeof this.staticValidationCallback === 'function') {
- $wrapper.on('primaryaction', function (evt) {
- this.staticValidationCallback(evt);
- evt.target = this.$el;
- this.$el.trigger(evt);
- evt.stopPropagation();
- }.bind(this));
- }
- },
- /**
- * Base class will take care of hiding the row when hidden is set
- */
- processHidden: function processHidden() {
- if (this.hidden) {
- this.hide();
- }
- },
- /**
- Returns the container node for the property
- **/
- getPropertyNode: function getPropertyNode() {
- if (!this._propertyNode) {
- this._propertyNode = this.$el.find('.property_' + this.id);
- }
- if (this._propertyNode.length === 0) {
- this._propertyNode = this.$el;
- }
- return this._propertyNode;
- },
- setFocus: function setFocus() {
- var $el = this.getPropertyNode().find('[tabindex=0]')[0];
- if ($el) {
- $el.focus();
- }
- },
- _hasValueChanged: function _hasValueChanged(propertyValue) {
- return this._lastChangedValue === undefined || this._lastChangedValue !== propertyValue;
- },
- _onChange: function _onChange(propertyName, propertyValue, targetSelector) {
- if (!this._validate(propertyValue)) {
- return false;
- }
- this.value = propertyValue;
- if (this._hasValueChanged(propertyValue)) {
- this._modifiedProperties[propertyName] = propertyValue;
- if (typeof this.onChange === 'function') {
- this._lastChangedValue = this.value;
- var options = targetSelector ? {
- focusSelector: targetSelector
- } : undefined;
- this.onChange(propertyName, propertyValue, options);
- }
- } else {
- this._modifiedProperties = {};
- }
- return true;
- },
- hasValidationError: function hasValidationError() {
- return !this._isValidValue;
- },
- _validate: function _validate(propertyValue) {
- // We should return a local variable as validation result since the global
- // one might be altered by a possible nested validation [Defect 261635]
- var isValidValue = this._isValidValue;
- if (this.validator) {
- var validationDialogCloseCallback = function () {
- this.setFocus();
- }.bind(this);
- var timeLocale = GlassContextHelper.getLocaleTime(this.glassContext);
- this._isValidValue = isValidValue = ValidationUtils.validateInput(propertyValue, this.validator, validationDialogCloseCallback, timeLocale);
- } else {
- if (this.customValidatorCallback) {
- var validationResponse = this.customValidatorCallback(propertyValue);
- this._isValidValue = isValidValue = !validationResponse || validationResponse.isValid !== false;
- if (validationResponse && validationResponse.isValid === false) {
- if (_.isFunction(validationResponse.customHandler)) {
- validationResponse.customHandler();
- } else if (this.showInlineError === true && this.showError) {
- this.showError(validationResponse.message);
- } else {
- var dlg = new MessageBox('warning', StringResources.get('invalidInput'), validationResponse.message);
- dlg.open();
- }
- } else {
- if (this.showInlineError && this.hideError) {
- this.hideError();
- }
- }
- }
- }
- return isValidValue;
- },
- getModifiedProperties: function getModifiedProperties() {
- return this._modifiedProperties;
- },
- _onBlur: function _onBlur() {
- var $target = this.getHTMLControl();
- $target.removeClass('focus');
- // add the changed property to the list of modified properties
- var propertyTextValue = this.preserveLineBreak ? $target.val().trim() : $target.val();
- var propertyValue;
- if (this.isString || isNaN(propertyTextValue) || propertyTextValue === '') {
- propertyValue = propertyTextValue;
- } else {
- if (this.parseFloat) {
- propertyValue = parseFloat(propertyTextValue);
- } else {
- propertyValue = this.decimalPlaces ? parseFloat(propertyTextValue).toFixed(this.decimalPlaces) : parseInt(propertyTextValue, 10);
- }
- }
- var targetClass = $target.attr('class');
- var targetClassSelector = targetClass ? '.' + targetClass.replace(/\s/g, '.') : '';
- var targetID = $target.attr('id');
- var targetIDSelector = targetID ? '#' + targetID : '';
- var targetSelector = targetIDSelector + targetClassSelector;
- var isChanged = this._onChange(this.name, propertyValue, targetSelector);
- if (isChanged) {
- if ($target.attr('value')) {
- $target.attr('value', propertyValue);
- }
- this.processEllipses();
- }
- // Reset the display css of the editIcon so the on hover will work again
- var $editIcon = this.$el.find('.editIcon' + this.id);
- $editIcon.css('display', '');
- this.getHTMLControl().off('blur.BaseProperty');
- },
- _onFocus: function _onFocus() {
- if (!this.editable) {
- return;
- }
- this.getHTMLControl().addClass('focus');
- // Make sure the edit icon is hidden (fix for ipad)
- var $editIcon = this.$el.find('.editIcon' + this.id);
- $editIcon.css('display', 'none');
- var $target = this.getHTMLControl();
- if (!this.isSTT) {
- BidiUtil.initElementForBidi($target[0]);
- }
- this._placeCaretAtEnd($target[0]);
- // Really sucks, but on the ipad showing the keyboard can cause the blur event to get fired.
- // Add the event in a timeout to give time for the keyboard to show up.
- setTimeout(function () {
- this.getHTMLControl().on('blur.BaseProperty', this._onBlur.bind(this));
- }.bind(this), 1);
- },
- _onToggleEdit: function _onToggleEdit() {
- //Give focus only if the element is not already focused
- if (!this.getHTMLControl().is(':focus')) {
- this.getHTMLControl().focus();
- }
- },
- /**
- Places the caret at the end of the content editable div or description textarea so that all browsers behave the same
- **/
- _placeCaretAtEnd: function _placeCaretAtEnd(node) {
- if ($(node).is('DIV')) {
- node.focus();
- var range = document.createRange();
- range.selectNodeContents(node);
- range.collapse(false);
- var sel = window.getSelection();
- sel.removeAllRanges();
- sel.addRange(range);
- } else if ($(node).is('TEXTAREA')) {
- if (node.createTextRange) {
- //IE
- var textArearange = node.createTextRange();
- textArearange.move('character', node.value.length);
- textArearange.select();
- } else {
- //Firefox and Chrome
- node.focus();
- node.setSelectionRange(node.value.length, node.value.length);
- }
- } else if ($(node).is('INPUT')) {
- // For input controls make sure we take as much room as possible when the control has focus
- if (this.ellipses) {
- $(node).css('width', '99%');
- }
- if (this.highlightTextOnFocus || !this._isValidValue) {
- // Need a settimeout here to let the focus action finish before selecting the text
- setTimeout(function () {
- $(node).select();
- if (node.setSelectionRange) {
- node.setSelectionRange(0, node.value.length);
- }
- }, 1);
- } else {
- // Setting the value to empty string and then back again will place the caret at the end
- $(node).val('');
- if (!this.isSTT || BidiUtil.userPreferredTextDir === '') {
- $(node).val(this.value);
- } else {
- $(node).val(BidiUtil.enforceTextDirectionForSTT(this.value));
- }
- }
- }
- },
- getHTMLControl: function getHTMLControl() {
- if (!this._htmlControl) {
- this._htmlControl = this.getPropertyNode().find('input');
- }
- return this._htmlControl;
- },
- enable: function enable() {
- if (this.readOnly) {
- return;
- }
- this.getPropertyNode().removeClass('disabled');
- this.getHTMLControl().removeAttr('disabled');
- this.getHTMLControl().attr('aria-disabled', 'false');
- },
- disable: function disable() {
- this.getPropertyNode().addClass('disabled');
- this.getHTMLControl().attr('disabled', 'disabled');
- this.getHTMLControl().attr('aria-disabled', 'true');
- },
- hide: function hide() {
- var node = this.getPropertyNode();
- node.addClass('hidden');
- node.attr('aria-hidden', 'true');
- },
- show: function show() {
- var node = this.getPropertyNode();
- node.removeClass('hidden');
- node.attr('aria-hidden', 'false');
- },
- _onKeyDown: function _onKeyDown(evt) {
- //Return key
- if (evt.keyCode === 13) {
- if (this.handleReturnKey) {
- this.getHTMLControl().blur();
- if (this.enterKeyCallback) {
- this.enterKeyCallback();
- }
- }
- // If we don't stop this event then any validation error dialog will automatically go away on the iPad. Why? I have no clue,
- // one of the great mysteries of the universe.
- // Validation errors are only possible on input controls
- if (evt.target.nodeName.toLowerCase() === 'input') {
- evt.stopPropagation();
- return false;
- }
- } else if (evt.keyCode === 27) {
- //Escape key
- return this._onEscFromInput(evt);
- } else if (evt.keyCode === KeyCodes.s && evt.ctrlKey) {
- this.getHTMLControl().blur();
- }
- },
- _onEscFromInput: function _onEscFromInput(evt) {
- // If value has changed, revert to the original value and stop the event
- if (this.getHTMLControl().val() !== String(this.value)) {
- this.getHTMLControl().val(this.value);
- evt.stopPropagation();
- return false;
- }
- return true;
- },
- /**
- Property sheet is closing, this is where we should do validation
- and rejecct the promise if the property isn't in a good state
- **/
- onClose: function onClose() {
- // Odd situtaiton on iPad where the input field still has focus
- // when the user taps off the slieout. Make sure we call onBlur directly
- // instead of using the event.
- // Odd situation where the control isn't in focus anymore but the _onBlur hasn't been called. Check to see
- // if our 'focus' class is still on the control, if it is _onBlur needs to be called. This happens in dashboard
- // when switching between widget properties.
- if ((this.getHTMLControl().is(':focus') || this.getHTMLControl().hasClass('focus')) && this.editable && !this._updatedOnClose) {
- this.getHTMLControl().off('blur.BaseProperty');
- this._onBlur();
- this._updatedOnClose = true;
- }
- return Promise.resolve();
- },
- remove: function remove() {
- this.getPropertyNode().remove();
- }
- });
- return BaseProperty;
- });
- //# sourceMappingURL=BaseProperty.js.map
- ;
- define('text!baglass/core-client/js/core-client/ui/properties/templates/Banner.html',[],function () { return ' <div class="propertyRow banner flex property_{{=it.id}}">\n \t{{? it.backButton}}\n\t\t<div class="headerBack">\n\t\t\t<div class="arrow blueArrow leftArrow leftAlignedArrow"></div>\n\t\t\t<div class="back blueText" tabindex="0" role="button">{{=it.strings.back}}</div>\n\t\t</div>\n\t{{?}}\n\t{{? it.iconFontClass}}\n\t\t<div class="propertiesBannerIcon {{=it.iconFontClass}}"></div>\n\t{{?}}\n\t{{? it.svgIcon}}\n\t\t<div class="propertiesBannerIcon" role="img" title="{{=it.svgToolTip}}">\n\t\t\t<svg class="svgIcon" role="presentation" >\n\t\t\t\t<text>{{=it.svgToolTip}}</text>\n\t\t\t\t<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{{=it.svgIcon}}"></use>\n\t\t\t</svg>\n\t\t</div>\n\t{{?}}\n\t{{? it.iconImgUrl}}\n\t\t<div class="propertiesBannerIcon">\n\t\t\t<img src="{{=it.iconImgUrl}}">\n\t\t</div>\n\t{{?}}\n\t{{? it.editable === true }}\n\n\t\t<input type="text" class="ellipses blueText propertyValue editable{{=it.id}} propertiesBannerLabel {{? it.name }}v_{{=it.name}}{{?}}" value="{{=_.escape(it.label)}}"{{?it.direction}} dir="{{=it.direction}}"{{?}}{{?it.ariaLabel}} aria-label="{{=it.ariaLabel}}"{{?}} tabindex="0"></input>\n\n\t\t<div class="propertyNameEdit toggleEdit{{=it.id}}" role="img" title="{{=it.strings.edit}}">\n\t\t\t<svg class="svgIcon editIcon editIcon{{=it.id}}" role="presentation">\n\t\t\t\t<text>{{=it.strings.edit}}</text>\n\t\t\t\t<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#common-edit"></use>\n\t\t\t</svg>\n\t\t</div>\n\t{{??}}\n\t\t<div class="propertiesBannerLabel ellipses {{? it.centerLabel === true}}centerBannerLabel{{?}} {{? it.name }}v_{{=it.name}}{{?}}"{{?it.direction}} dir="{{=it.direction}}"{{?}}{{?it.ariaLabel}} aria-label="{{=it.ariaLabel}}"{{?}}>{{=_.escape(it.label)}}</div>\n\t{{?}}\n\n\t{{?it.clickables}}\n\t<div class="bannerClickables flex">\n\t\t{{~it.clickables :item}}\n\t\t\t{{? item.type === \'text\'}}\n\t\t\t\t<div tabindex="0" class="{{?item.name}}{{=item.name}}{{=it.id}}{{?}}{{?!it.disabled}} clickable{{?}}" role="link">{{=_.escape(item.value)}}</div>\n\t\t\t{{?}}\n\t\t\t{{? item.type === \'icon\' && item.svgIcon}}\n\t\t\t\t<div class="{{?item.name}}{{=item.name}}{{=it.id}}{{?}}{{?!it.disabled}} clickable{{?}}"title="{{=_.escape(item.iconTooltip)}}" {{?item.clickCallback}} role="button" tabindex="0" {{?}}>\n\t\t\t\t\t<svg class="svgIcon" role="presentation">\n\t\t\t\t\t\t<use style="pointer-events: none;" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#{{=item.svgIcon}}"></use>\n\t\t\t\t\t\t<text>{{=_.escape(item.iconTooltip)}}</text>\n\t\t\t\t\t</svg>\n\t\t\t\t</div>\n\t\t\t{{?}}\n\t\t{{~}}\n\t{{?}}\n\t</div>\n\t{{? it.hintText}}\n\t\t<div class=\'bannerHintText\'>\n\t\t\t{{=it.hintText}}\n\t\t</div>\n\t{{?}}\n</div>\n';});
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2017
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('baglass/core-client/js/core-client/ui/properties/Banner',['./BaseProperty', '../../utils/BidiUtil', 'text!./templates/Banner.html', '../../nls/StringResources', 'doT', 'underscore'], function (BaseProperty, BidiUtil, bannerTemplate, StringResource, dot, _) {
- 'use strict';
- var Banner = BaseProperty.extend({
- ellipses: true,
- handleReturnKey: false,
- /**
- @param options.el {node} - container DOM node
- @param options.iconFontClass {string} - css class for the icon
- @param options.svgIcon {string} - the SVGs xslink:href property
- @param options.svgToolTip {string} - the tooltip and accessible label for the svgicon
- @param options.iconImgUrl {string} - image file
- @param options.value {string} - title to show in the banner
- @param options.centerLabel {boolean} - should the label be centered
- @param options.hintText {string} - helpful hint text below banner
- @param options.backButton {boolean} - should the < Back be displayed
- @param options.closeCallback {function} - function to call when the property sheet is closing
- @param options.readOnly {boolean}{optional} - default is false. If true, the UI will be rendered in a read-only mode
- @param options.editable {boolean}{optional} - default is false, if true the text value can be edited inline
- @param options.clickables {array} - array of clickables and callbacks, currently only support text
- @param options.ariaLabel {string} - if you want to override the default label for screen readers
- @param options.handleReturnKey {boolean} - process the 'Return/Enter' key press
- **/
- init: function init(options) {
- this.events = {};
- this.events['primaryaction .headerBack'] = '_goBack';
- if (options.clickables) {
- options.clickables.forEach(function (item) {
- if (item.name && item.clickCallback) {
- this.events['primaryaction .' + item.name + options.id] = item.clickCallback;
- }
- }.bind(this));
- }
- Banner.inherited('init', this, arguments);
- _.extend(this, options);
- if (!this.ariaLabel) {
- this.ariaLabel = StringResource.get('title');
- }
- },
- doRender: function doRender() {
- var templateOptions = {
- 'iconFontClass': this.iconClass,
- 'svgIcon': this.svgIcon,
- 'svgToolTip': this.svgToolTip,
- 'iconImgUrl': this.iconImgUrl,
- 'label': this.value,
- 'direction': BidiUtil.resolveBaseTextDir(this.value || ''),
- 'centerLabel': this.centerLabel,
- 'id': this.id,
- 'editable': this.editable && !this.readOnly,
- 'hintText': this.hintText,
- 'backButton': this.backButton,
- 'strings': {
- 'back': StringResource.get('back'),
- 'edit': StringResource.get('edit')
- },
- 'name': this.name,
- 'clickables': this.clickables,
- 'ariaLabel': this.ariaLabel
- };
- var sHtml = dot.template(bannerTemplate)(templateOptions);
- this.$el.append(sHtml);
- return;
- },
- _goBack: function _goBack() {
- if (this.closeCallback) {
- this.closeCallback();
- }
- }
- });
- return Banner;
- });
- //# sourceMappingURL=Banner.js.map
- ;
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2017
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('baglass/core-client/js/core-client/ui/properties/Button',['./BaseProperty', 'underscore', '../Button'], function (BaseProperty, _, _Button) {
- 'use strict';
- var Button = BaseProperty.extend({
- ellipses: true,
- /**
- @param options.el {node} - container DOM node
- @param options.label {string} - the button label
- @param options.onSelect {function} - callack
- @param options.primary {boolean} - if the button is the primary one
- **/
- init: function init(options) {
- Button.inherited('init', this, arguments);
- _.extend(this, options);
- },
- doRender: function doRender() {
- var cssClass = this.primary ? 'propertyButton primary' : 'propertyButton secondary';
- var MyButton = _Button;
- this._button = new MyButton({
- 'buttonSpec': {
- 'label': this.label,
- 'onSelect': this.onSelect,
- 'class': cssClass
- }
- });
- this._button.render();
- if (this.id !== undefined) {
- this._button.$el.addClass(this.id);
- }
- this.$el.append(this._button.$el);
- },
- disable: function disable() {
- this._button.$el.addClass('disabled');
- },
- enable: function enable() {
- this._button.$el.removeClass('disabled');
- }
- });
- return Button;
- });
- //# sourceMappingURL=Button.js.map
- ;
- define('text!baglass/core-client/js/core-client/ui/properties/templates/CheckBox.html',[],function () { return '<div class="{{? !it.nestedUIControl}}propertyRow{{?}} property_{{=it.id}}{{?it.readOnly}} disabled{{?}} clickable" >\n\t{{? !it.controlOnLeft}}\n\t\t{{? it.label}}\n\t\t\t<span class="checkbox_icon_{{=it.id}} icon_controlOnRight checkboxIcon"></span>\n\t\t\t<div class="propertyName l_{{=it.name}}" id="label{{=it.id}}">{{!it.label}}</div>\n\t\t{{?}}\n\t{{?? it.controlOnLeft}}\n\t\t{{? it.label}}\n\t\t\t<span class="checkbox_icon_{{=it.id}} checkboxIcon"></span>\n\t\t\t<div class="propertyName controlOnLeft l_{{=it.name}}" id="label{{=it.id}}">{{!it.label}}</div>\n\t\t{{?}}\n\t{{?}}\n\t<div class="checkbox{{? it.controlOnLeft === true}} controlOnLeft{{??}} rightAlign{{?}} {{=it.checked}}" {{? !it.readOnly}}tabindex="0"{{?}} role="checkbox" aria-checked={{=it.ariaChecked}} aria-disabled="{{?it.readOnly}}true{{??}}false{{?}}"{{?it.label}} aria-labelledby="label{{=it.id}}"{{?}}{{?it.ariaLabel}} aria-label="{{=it.ariaLabel}}"{{?}}>\n\t\t<div class="checkmark"></div>\n\t</div>\n</div>\n';});
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2017
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('baglass/core-client/js/core-client/ui/properties/CheckBox',['./BaseProperty', 'text!./templates/CheckBox.html', '../../utils/Utils', 'jquery', 'doT', 'underscore'], function (BaseProperty, checkboxTemplate, Utils, $, dot, _) {
- 'use strict';
- var CheckBox = BaseProperty.extend({
- /**
- * Creates a property with round checkbox.
- * @param options.id {string} - property id
- * @param options.el {node} - parent element
- * @param options.name {string} - property name
- * @param options.label {string} - property label
- * @param options.svgIcon {string} - property icon name
- * @param options.checked {boolean || string} - true or false or mixed
- * @param options.disabled {boolean} - default is false, set to true if you want the control disabled
- * @param options.onChange {function} - callback to be notified as soon as the change happens
- * @param options.controlOnLeft {boolean} - default to false, if true the control will be on the left
- * @param options.indent {int} - default 0, will indent by options.indent * 10px
- * @param options.readOnly {boolean} - optional, default is false. If true, the UI will be rendered in a read-only mode
- * @param options.nestedUIControl {boolean} - optional, default is false. Set to true if this UI Widget is being rendered by another UI Widget
- * @param options.ariaLabel {string} - if you want to override the default label for screen readers
- */
- init: function init(options) {
- this.events = {};
- this.events['clicktap .property_' + options.id] = '_handleClick';
- this.events['keydown .property_' + options.id] = '_handleKeyDown';
- this.checked = false;
- this.nestedUIControl = false;
- CheckBox.inherited('init', this, arguments);
- _.extend(this, options);
- },
- doRender: function doRender() {
- var sHtml = dot.template(checkboxTemplate)({
- 'label': this.label,
- 'checked': this.checked === 'mixed' ? 'indeterminate' : this.checked === true ? 'checked' : '',
- 'ariaChecked': this.checked,
- 'id': this.id,
- 'name': this.name,
- 'controlOnLeft': this.controlOnLeft || this.nestedUIControl,
- 'readOnly': this.readOnly || this.disabled,
- 'nestedUIControl': this.nestedUIControl,
- 'ariaLabel': this.ariaLabel
- });
- this.$el.append(sHtml);
- if (this.svgIcon) {
- this._setIcon();
- }
- return;
- },
- _handleClick: function _handleClick(event) {
- this.toggleCheckBox();
- event.stopPropagation();
- return false;
- },
- _hasValueChanged: function _hasValueChanged(propertyValue) {
- if (propertyValue === this.checked) {
- return false;
- }
- this.checked = propertyValue;
- return true;
- },
- _setIcon: function _setIcon() {
- Utils.setIcon(this.getPropertyNode().find('.checkbox_icon_' + this.id), 'common-' + this.svgIcon);
- },
- isChecked: function isChecked() {
- return this.checked === true;
- },
- check: function check(bCallCallback) {
- this._toggledCheckbox(true, bCallCallback);
- },
- uncheck: function uncheck(bCallCallback) {
- this._toggledCheckbox(false, bCallCallback);
- },
- toggleCheckBox: function toggleCheckBox(bCallCallback) {
- this._toggledCheckbox(!this.checked, bCallCallback);
- },
- indeterminateState: function indeterminateState(bCallCallback) {
- this._toggledCheckbox('mixed', bCallCallback);
- },
- _toggledCheckbox: function _toggledCheckbox(bChecked, bCallCallback) {
- var checkboxNode = this.getPropertyNode().find('.checkbox');
- if (bChecked === 'mixed') {
- checkboxNode.removeClass('checked');
- checkboxNode.addClass('indeterminate');
- checkboxNode.attr('aria-checked', 'mixed');
- } else if (bChecked === true) {
- checkboxNode.removeClass('indeterminate');
- checkboxNode.addClass('checked');
- checkboxNode.attr('aria-checked', 'true');
- } else {
- checkboxNode.removeClass('checked indeterminate');
- checkboxNode.attr('aria-checked', 'false');
- }
- var onChangeCallback = this.onChange;
- if (bCallCallback === false) {
- this.onChange = null;
- }
- this._onChange(this.name, bChecked);
- if (bCallCallback === false) {
- this.onChange = onChangeCallback;
- }
- },
- /**
- Override since we're not using a standard input control
- **/
- getHTMLControl: function getHTMLControl() {
- return this.getPropertyNode().find('.checkbox');
- },
- _handleKeyDown: function _handleKeyDown(evt) {
- if (evt.keyCode === 32 || evt.keyCode === 13) {
- // space || enter
- this.toggleCheckBox();
- evt.preventDefault();
- }
- }
- });
- return CheckBox;
- });
- //# sourceMappingURL=CheckBox.js.map
- ;
- define('text!baglass/core-client/js/core-client/ui/properties/templates/CollapsiblePicker.html',[],function () { return '<div class="{{? !it.nestedUIControl}}propertyRow {{?}}property_{{=it.id}}{{? it.readOnly}} disabled{{?}} {{? it.colorPicker}} colorPickerStyle{{?}}" {{?it.ariaLabel}} aria-label="{{=it.ariaLabel}}"{{?}}>\n\t<div class="collapsibleSectionToggle{{=it.id}} collapsiblePicker {{? it.name }}l_{{=it.name}}{{?}}{{? it.readOnly}} disabled{{?}}">\n\t\t{{? it.label}}\n\t\t\t<div id="label_{{=it.id}}" class="singleLine">\n\t\t\t\t{{=it.label}}{{? it.isRequired}}<span class="collapsiblePickerRequired">*</span>{{?}}\n\t\t\t</div>\n\t\t{{?}}\n\t\t<div class="selectedItemBox selectedItemBox{{=it.contentSize}} toggleSection{{=it.id}}{{? it.selectedValueType===\'Class\'}} {{=it.value}}{{?}}"\n\t\t\tdata-value="{{=it.value}}" role="link" tabindex="0"\n\t\t\taria-controls="region_{{=it.id}}" aria-haspopup="true" aria-labelledby="label_{{=it.id}}"\n\t\t\t{{? it.selectedValueType===\'ColorCode\'}}style="background:{{=it.value}};"\n\t\t\t{{?? it.selectedValueType===\'Class\'}}style="background:{{=it.hexValue}};"\n\t\t\t{{??}}\n\t\t\t{{?}}>\n\t\t\t\t{{? it.value && it.value.toLowerCase()===\'transparent\'}}<div class=\'transparentIndicator\'></div>{{?}}\n\t\t</div>\n\t\t{{?it.showHexValue}}\n\t\t<div class="selectedColorHex">\n\t\t\t{{=it.hexValue}}\n\t\t</div>\n\t\t{{?}}\n\t\t{{?it.displayLabel}}\n\t\t<div class="selectedLabel">\n\t\t\t{{=it.selectedLabel}}\n\t\t</div>\n\t\t{{?}}\n\t</div>\n\n\t<div class="collapsibleSection collapsiblePicker property_{{=it.id}}{{? it.readOnly}} disabled{{?}}" id="region_{{=it.id}}"\n\t\taria-hidden="true" aria-live="off" role="region"\n\t\t{{? it.ariaLabel}}aria-label="{{=it.ariaLabel}}"{{??}}aria-labelledby="label_{{=it.id}}"{{?}}>\n\n\t\t{{~it.items :item:index}}\n\t\t\t<div class="collapsiblePickerBox collapsiblePickerBox{{=it.contentSize}} {{=item.name}}{{? item.value===it.value}} selected{{?}}{{? item.type===\'Class\'}} {{=item.value}}{{?}}"\n\t\t\t\tdata-value="{{=item.value}}" data-name="{{=item.name}}" title="{{=item.label}}" role="button"\n\t\t\t\ttabindex="{{? it.readOnly}}-1{{??}}0{{?}}"\n\t\t\t\t{{?!item.hidden}}\n\t\t\t\t\t{{? item.type===\'ColorCode\'}}style="background:{{=item.value}};"{{?}}\n\t\t\t\t{{??}}\n\t\t\t\t\tstyle="display:none;"\n\t\t\t\t{{?}}\n\t\t\t\t{{? item.value===it.value}} aria-pressed="true"{{??}} aria-pressed="false"{{?}}\n\t\t\t\taria-disabled="{{? it.readOnly}}true{{??}}false{{?}}">\n\t\t\t\t\t{{? item.value && item.value.toLowerCase()===\'transparent\'}}<div class=\'transparentIndicator\'></div>{{?}}\n\t\t\t</div>\n\t\t{{~}}\n\t\t{{?it.addButton}}\n\t\t\t<div class="addCustomColor"></div>\n\t\t{{?}}\n\t</div>\n</div>\n';});
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2016, 2020
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('baglass/core-client/js/core-client/ui/properties/PropertyUIControl',['../core/View', 'underscore', 'jquery', '../../utils/ClassFactory', '../../utils/Deferred', '../../utils/Utils'], function (View, _, $, ClassFactory, Deferred, Utils) {
- 'use strict';
- var propertyUIControl = View.extend({
- _uiPropertiesComponentPath: '../ui/properties/',
- /**
- @param spec.el {node} - container node
- @param spec.items {array} - array of UI property widgets to render
- @param spec.glassContext {object} - the glass context object
- @param spec.closeCallback {function} - function to call when the property sheet is closing
- @param spec.onChange {function} - function to call when any of the properties change
- @param spec.readOnly {boolean} - optional, default is false. If true, the UI will be rendered in a read-only mode
- @param spec.primaryUIControl {boolean} - optional, default is true. If false then we're a nested control and shouldn't take up 100% of the height
- @param animatedSpinner {boolean} - optional, default is false. Set to true if primaryUIControl is true and an animated spinner is required for rendering the nested widgets
- @param spec.nestedUIControls {boolean} - optional, default is false. Set to true if a UI widget is redering other UI widgets (nested widgets)
- @param spec.ariaLabel {string} - optional, if provided the propertyUIControl container will have a tabindex of 0 and use the provided ariaLabel as a description
- @param spec.setFocusCallback {function} - optional, if you're using the propertyUIControl as your View and want to focus an element after it's done rendering
- @param spec.staticValidationMode {boolean} - if set to true, staticValidator will be active and all property controls will be indented.
- @param spec.loadlimit {integer} - optional, default is 600. This is the maximum number of items allowed before rendering in pages
- **/
- init: function init(spec) {
- propertyUIControl.inherited('init', this, arguments);
- this.readOnly = false;
- this.primaryUIControl = true;
- this.animatedSpinner = false;
- this.nestedUIControls = false;
- this.loadlimit = 600;
- // Array or property object
- this._aProperties = [];
- _.extend(this, spec);
- // Make it easy to find a property by name, so keep a map of them (not a copy, just a reference)
- this._oPropertyMap = {};
- // Certain properties like collapsible sections have their own propertyUIControl. Keep a list of them
- // so that we can find properties they display
- this._aNestedUIControls = [];
- this._uniqueNameSpace = 'resize.propertyuicontrol' + this.viewId;
- $(Utils.getCurrentWindow()).on(this._uniqueNameSpace, function () {
- this.onResize();
- }.bind(this));
- },
- render: function render() {
- if (this.$el.parent().hasClass('tab-content')) {
- this.primaryUIControl = false;
- }
- this.$el.addClass('propertyUIControl');
- if (this.ariaLabel) {
- this.$el.attr('aria-label', this.ariaLabel);
- this.$el.attr('role', 'region');
- }
- if (this.primaryUIControl) {
- this.$el.addClass('flexHeight');
- }
- this.$container = $('<div></div>', {
- 'class': 'containerUIControl'
- });
- if (this.primaryUIControl) {
- // Only add this class for the first PropertyUIControl inside the pane-content (glass div). This is to fix an issue
- // with nested propertyUIControls, we only want the first one to take up all the height
- this.$container.addClass('propertiesUIControlPageView');
- // Only need one banner at the top level
- this.$bannerContainer = $('<div></div>', {
- 'class': 'propertyUIControlBanner'
- });
- this.$el.prepend(this.$bannerContainer);
- }
- if (this.animatedSpinner === true) {
- this._spinnerEl = Utils.getSpinner();
- $(this._spinnerEl).addClass('animatedSpinner');
- this.$el.addClass('spinnerWrapper');
- this.$container.html($(this._spinnerEl)[0]);
- }
- if (this.staticValidationMode) {
- this.$el.addClass('staticValidationMode');
- }
- this.$el.append(this.$container);
- if (!this.items) {
- return Promise.resolve(this);
- } else {
- this.$itemContainer = $('<span></span>', {
- 'class': 'hidden itemContainerUIControl'
- });
- this.$container.append(this.$itemContainer);
- if (this.items.length > this.loadlimit) {
- // renderPages implements infinite scroll
- return this._renderPages(this.items, this.loadlimit);
- } else {
- return this.renderItems(this.items).then(function (ret) {
- this._postRender(ret);
- return ret.results;
- }.bind(this));
- }
- }
- },
- _postRender: function _postRender(ret) {
- this.$itemContainer.removeClass('hidden');
- ret.properties.forEach(function (prop) {
- if (_.isFunction(prop.processEllipses)) {
- prop.processEllipses();
- }
- });
- if (this._spinnerEl) {
- $(this._spinnerEl).remove();
- this.$el.removeClass('spinnerWrapper');
- delete this._spinnerEl;
- }
- },
- renderItems: function renderItems(items) {
- var aRequirePromises = [];
- items.forEach(function (itemSpec) {
- var module = !itemSpec.type ? itemSpec.module : this._uiPropertiesComponentPath + itemSpec.type;
- var requirePromise = ClassFactory.loadModule(module).then(function (Property) {
- Property = itemSpec.moduleClass ? Property[itemSpec.moduleClass] : Property;
- if (!itemSpec.el) {
- if (itemSpec.type === 'Banner' && this.$bannerContainer) {
- itemSpec.el = this.$bannerContainer[0];
- } else if (itemSpec.type === 'Footer') {
- itemSpec.el = this.$el;
- } else {
- itemSpec.el = this.$itemContainer[0];
- }
- }
- itemSpec.id = itemSpec.id ? itemSpec.id.replace(/\./g, '_') : _.uniqueId();
- itemSpec.glassContext = this.glassContext;
- itemSpec.closeCallback = itemSpec.doClose || this.onClose.bind(this);
- itemSpec.readOnly = itemSpec.readOnly !== undefined ? itemSpec.readOnly : this.readOnly;
- itemSpec.nestedUIControl = this.nestedUIControls;
- if (this.onChange && !itemSpec.onChange) {
- itemSpec.onChange = this.onChange;
- }
- var property = new Property(itemSpec);
- this._aProperties.push(property);
- if (itemSpec.name) {
- this._oPropertyMap[itemSpec.name] = property;
- }
- if (itemSpec.type === 'CollapsibleSection' || itemSpec.type === 'SingleLineLinks') {
- this._aNestedUIControls.push(property);
- }
- return property;
- }.bind(this));
- aRequirePromises.push(requirePromise);
- }.bind(this));
- return Promise.all(aRequirePromises).then(function (oProperties) {
- var aRenderPromises = [];
- oProperties.forEach(function (oProperty) {
- var renderPromise = oProperty.render();
- if (renderPromise) {
- aRenderPromises.push(renderPromise);
- }
- });
- return Promise.all(aRenderPromises).then(function (results) {
- return {
- results: results,
- properties: oProperties
- };
- });
- }.bind(this));
- },
- _renderPages: function _renderPages(items) {
- var loadlimit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.loadlimit;
- // queue for pages to render
- this._pagesToRender = [];
- while (items.length > 0) {
- this._pagesToRender.push(items.splice(0, loadlimit));
- }
- return this.renderItems(this._pagesToRender.shift()).then(function (ret) {
- this._postRender(ret);
- this._scrollNode = $.find('.containerUIControl');
- $(this._scrollNode).on('scroll', this._onScroll.bind(this));
- return ret.results;
- }.bind(this));
- },
- _onScroll: function _onScroll(event) {
- var $target = $(event.target);
- // check if scrolled to the bottom
- if ($target.scrollTop() + $target.innerHeight() >= $target[0].scrollHeight - 20) {
- if (this._pagesToRender.length > 0) {
- return this.renderItems(this._pagesToRender.shift()).bind(this);
- }
- }
- },
- hasValidationError: function hasValidationError() {
- for (var i = 0; i < this._aProperties.length; i = i + 1) {
- var item = this._aProperties[i];
- if (item.hasValidationError && item.hasValidationError()) {
- return true;
- }
- }
- return false;
- },
- hasModifiedProperties: function hasModifiedProperties() {
- var modifiedProperties = this.getModifiedProperties();
- if (!$.isEmptyObject(modifiedProperties)) {
- return true;
- }
- },
- getModifiedProperties: function getModifiedProperties() {
- var result = {};
- this._aProperties.forEach(function (item) {
- if (item.getModifiedProperties) {
- $.extend(result, item.getModifiedProperties());
- }
- });
- return result;
- },
- onClose: function onClose() {
- var deferred = new Deferred();
- var aPromises = [];
- this._aProperties.forEach(function (item) {
- if (item.onClose) {
- aPromises.push(item.onClose());
- }
- });
- Promise.all(aPromises).then(function () {
- if (this.closeCallback) {
- this.closeCallback(this.getModifiedProperties());
- }
- deferred.resolve();
- }.bind(this));
- return deferred.promise;
- },
- /**
- Loop through all the items and call remove on them
- **/
- remove: function remove() {
- this._aProperties.forEach(function (item) {
- if (item.remove) {
- item.remove();
- }
- });
- $(Utils.getCurrentWindow()).off(this._uniqueNameSpace);
- if (this.$container) {
- this.$container.remove();
- }
- },
- focus: function focus() {
- this.$el.attr('tabindex', 0);
- this.$el.focus();
- if (!this.ariaLabel) {
- console.log('Setting focus to property UI control container without an aria label.');
- }
- },
- /**
- Sets the focus to the property provided or will call the setFocusCallback
- @param propertyName - optional, if provided will set the focus to the property
- **/
- setFocus: function setFocus(propertyName) {
- if (propertyName) {
- var propertyObj = this.getProperty(propertyName);
- if (!propertyObj) {
- return;
- }
- propertyObj.setFocus();
- } else if (this.setFocusCallback) {
- this.setFocusCallback(this);
- }
- },
- /**
- Returns the property object for the given name
- **/
- getProperty: function getProperty(propertyName) {
- var property = this._oPropertyMap[propertyName];
- var i = 0;
- if (!property) {
- for (i = 0; i < this._aNestedUIControls.length; i = i + 1) {
- property = this._aNestedUIControls[i].getProperty(propertyName);
- if (property) {
- break;
- }
- }
- }
- if (!property && this._aProperties) {
- for (i = 0; i < this._aProperties.length; i++) {
- var prop = this._aProperties[i];
- if (prop.type === 'TabControl' && prop._tabs) {
- for (var y = 0; y < prop._tabs.length; y++) {
- var tab = prop._tabs[y];
- if (tab.tabContent && tab.tabContent.getPropertyUIControl) {
- var tabProperty = tab.tabContent.getPropertyUIControl().getProperty(propertyName);
- if (tabProperty) {
- return tabProperty;
- }
- }
- }
- }
- }
- }
- return property || null;
- },
- getProperties: function getProperties() {
- return this._aProperties;
- },
- /**
- * Remove the property with the given name from the UI.
- *
- * @param propertyName the property name
- *
- * @return <code>true</code> if the property was found and removed, <code>false</code> otherwise
- */
- removeProperty: function removeProperty(propertyName) {
- var property = this._oPropertyMap[propertyName],
- idx;
- if (property) {
- if (property.remove) {
- property.remove();
- }
- delete this._oPropertyMap[propertyName];
- idx = this._aNestedUIControls.indexOf(property);
- if (idx >= 0) {
- this._aNestedUIControls.splice(idx, 1);
- }
- idx = this._aProperties.indexOf(property);
- if (idx >= 0) {
- this._aProperties.splice(idx, 1);
- }
- }
- return !!property;
- },
- /**
- * called when the parent or main window is resized.
- *
- * @param _event the resize events
- * @param element the element causing the resize (if any)
- *
- * @return void
- * @protected
- */
- onResize: function onResize(_event, element) {
- void _event;
- void element;
- if (this._aProperties) {
- this._aProperties.forEach(function (oProperty) {
- if (oProperty.onResize) {
- oProperty.onResize();
- }
- });
- }
- }
- });
- return propertyUIControl;
- });
- //# sourceMappingURL=PropertyUIControl.js.map
- ;
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2016, 2017
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('baglass/core-client/js/core-client/ui/properties/PropertyContainerBaseClass',['./BaseProperty', 'jquery', 'underscore', './PropertyUIControl'], function (BaseProperty, $, _, PropertyUIControl) {
- 'use strict';
- /**
- Extend this class if your property control will nest other property controls.
- **/
- var PropertyContainerBaseClass = BaseProperty.extend({
- init: function init(options) {
- PropertyContainerBaseClass.inherited('init', this, arguments);
- _.extend(this, options);
- },
- initUIControl: function initUIControl(el) {
- var options = {
- 'glassContext': this.glassContext,
- 'el': el,
- 'readOnly': this.readOnly,
- 'items': this.items,
- 'onChange': this.onChange,
- 'primaryUIControl': false,
- 'nestedUIControls': $(el).hasClass('propertyRow')
- };
- if (this.items) {
- options.items = this.items;
- }
- this._oPropertyUIControl = new PropertyUIControl(options);
- },
- getModifiedProperties: function getModifiedProperties() {
- if (this._oPropertyUIControl) {
- return this._oPropertyUIControl.getModifiedProperties();
- }
- return {};
- },
- hasValidationError: function hasValidationError() {
- if (this._oPropertyUIControl) {
- return this._oPropertyUIControl.hasValidationError();
- }
- return false;
- },
- onClose: function onClose() {
- if (this._oPropertyUIControl) {
- return this._oPropertyUIControl.onClose();
- }
- },
- getProperty: function getProperty(propertyName) {
- return this._oPropertyUIControl ? this._oPropertyUIControl.getProperty(propertyName) : null;
- }
- });
- return PropertyContainerBaseClass;
- });
- //# sourceMappingURL=PropertyContainerBaseClass.js.map
- ;
- define('text!baglass/core-client/js/core-client/ui/properties/templates/SingleLineLinks.html',[],function () { return '<div class="propertyRow flex property_{{=it.id}} {{?it.readOnly}} disabled{{?}}"{{?it.clickCallback}} role="button"{{?!it.readOnly}} tabindex="0"{{?}}{{?}}>\n\t<div class="flex left singleLineLinks" style="flex:1 1 auto;">\n\t{{~it.left :item:i}}\n\t\t{{? item.type === \'text\'}}\n\t\t\t<div class="singleLine ellipses l_{{=it.name}}{{=i}}{{?item.name}} {{=item.name}}{{?}}{{?item.class}} {{=item.class}}{{?}}{{?item.clickCallback}} clickable{{=it.id}} clickCallback_left_{{=i}}_{{=it.id}}{{?!it.disabled}} clickable{{?}}{{?}}{{? item.hidden}} hidden{{?}}"{{?item.clickCallback}} role="link" {{? !it.readOnly}}tabindex="0"{{?}}{{?}}{{?item.name}} id="control_{{=item.name}}_{{=it.id}}"{{?}}{{?item.ariaLabelledby}} aria-labelledby="{{=item.ariaLabelledby}}"{{?}}>{{?item.labelFor}}<label for="control_{{=item.labelFor}}_{{=it.id}}">{{=_.escape(item.value)}}</label>{{??}}{{=_.escape(item.value)}}{{?}}</div>\n\t\t{{??}}\n\t\t\t{{? item.type === \'icon\'}}\n\t\t\t\t{{? item.svgIcon}}\n\t\t\t\t\t<div class="l_{{=it.name}}{{=i}}{{?item.name}} {{=item.name}}{{?}}{{?item.class}} {{=item.class}}{{?}}{{?item.clickCallback}} clickable{{=it.id}} clickCallback_left_{{=i}}_{{=it.id}}{{?!it.disabled}} clickable{{?}}{{?}}" title="{{=_.escape(item.iconTooltip)}}"{{?item.clickCallback}} role="button" {{? !it.readOnly}}tabindex="0"{{?}}{{?}}{{?item.name}} id="control_{{=item.name}}_{{=it.id}}"{{?}}{{?item.ariaLabelledby}} aria-labelledby="{{=item.ariaLabelledby}}"{{?}}{{?item.role}} role="{{=item.role}}" {{??}} role="img"{{?}}>\n\t\t\t\t\t\t<svg class="{{?item.clickCallback}}clickableLink {{?}}svgIcon" role="presentation">\n\t\t\t\t\t\t\t<use style="pointer-events: none;" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#{{=item.svgIcon}}"></use>\n\t\t\t\t\t\t\t<text>{{=_.escape(item.iconTooltip)}}</text>\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t</div>\n\t\t\t\t{{?}}\n\t\t\t{{??}}\n\t\t\t\t<div class="innerControlContainer_{{=item.type}}{{=it.id}}{{=i}} flex" {{?item.styles}}style="{{=item.styles}}"{{?}}></div>\n\t\t\t{{?}}\n\t\t{{?}}\n\t{{~}}\n\t</div>\n\t<div class="flex right singleLineLinks singleLineLinksFocusBounds">\n\t{{~it.right :item:j}}\n\t\t{{? item.type === \'text\'}}\n\t\t\t<div class="r_{{=it.name}}{{=i}}{{?item.name}} {{=item.name}}{{?}}{{?item.class}} {{=item.class}}{{?}}{{?item.clickCallback}} clickable{{=it.id}} clickCallback_right_{{=j}}_{{=it.id}}{{?!it.disabled}} clickable{{?}}{{?}}{{? item.hidden}} hidden{{?}}"{{?item.clickCallback}} role="link" {{? !it.readOnly}}tabindex="0"{{?}}{{?}}{{?item.name}} id="control_{{=item.name}}_{{=it.id}}"{{?}}{{?item.ariaLabelledby}} aria-labelledby="{{=item.ariaLabelledby}}"{{?}}>{{?item.labelFor}}<label labelFor="control_{{=item.labelFor}}_{{=it.id}}">{{=_.escape(item.value)}}</label>{{??}}{{=_.escape(item.value)}}{{?}}</div>\n\t\t\t{{? item.showRightArrow}}\n\t\t\t<svg class="{{?item.clickCallback}}clickableLink {{?}}svgIcon chevron">\n\t\t\t\t<use style="pointer-events: none;" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#common-chevron_right"></use>\n\t\t\t</svg>\n\t\t\t{{?}}\n\t\t\t{{??}}\n\t\t\t{{? item.type === \'icon\'}}\n\t\t\t\t{{? item.svgIcon}}\n\t\t\t\t\t<div class="r_{{=it.name}}{{=i}}{{?item.name}} {{=item.name}}{{?}}{{?item.class}} {{=item.class}}{{?}}{{?item.clickCallback}} clickable{{=it.id}} clickCallback_right_{{=j}}_{{=it.id}}{{?!it.disabled}} clickable{{?}}{{?}}" title="{{=_.escape(item.iconTooltip)}}"{{?item.clickCallback}} role="button" {{? !it.readOnly}}tabindex="0"{{?}}{{?}}{{?item.name}} id="control_{{=item.name}}_{{=it.id}}"{{?}}{{?item.ariaLabelledby}} aria-labelledby="{{=item.ariaLabelledby}}"{{?}}{{?item.role}} role="{{=item.role}}" {{??}} role="img"{{?}}>\n\t\t\t\t\t\t<svg class="{{?item.clickCallback}}clickableLink {{?}}svgIcon" role="presentation">\n\t\t\t\t\t\t\t<use style="pointer-events: none;" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#{{=item.svgIcon}}"></use>\n\t\t\t\t\t\t\t<text>{{=_.escape(item.iconTooltip)}}</text>\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t{{? item.showRightArrow}}\n\t\t\t\t\t\t\t<svg class="{{?item.clickCallback}}clickableLink {{?}}svgIcon chevron">\n\t\t\t\t\t\t\t\t<use style="pointer-events: none;" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#common-chevron_right"></use>\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t{{?}}\n\t\t\t\t\t</div>\n\t\t\t\t{{?}}\n\t\t\t{{??}}\n\t\t\t\t<div class="innerControlContainer_{{=item.type}}{{=it.id}}{{=j}} flex" {{?item.styles}}style="{{=item.styles}}"{{?}}></div>\n\t\t\t{{?}}\n\t\t{{?}}\n\t{{~}}\n\t</div>\n</div>\n';});
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2017
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('baglass/core-client/js/core-client/ui/properties/SingleLineLinks',['./PropertyContainerBaseClass', './PropertyUIControl', 'text!./templates/SingleLineLinks.html', 'jquery', 'doT', 'underscore'], function (PropertyContainerBaseClass, PropertyUIControl, singleLineLinks, $, dot, _) {
- 'use strict'; //NOSONAR
- var SingleLineLinks = PropertyContainerBaseClass.extend({
- ellipses: true,
- /**
- * Creates a property with single line and read-only link.
- * @param options.el {node}- parent element
- * @param options.id {string} - unique id
- * @param options.name {string} - name
- * @param options.readOnly {boolean} - default is false, set to true if you want the control read only
- * @param options.disabled {boolean} - default is false, set to true if you want the control disabled
- * @param options.indent {int} - default 0, will indent by options.indent * 10px
- * @param options.clickCallback {function} - function to call when it is clicked, declaring at this level makes the whole line a link.
- * @param options.items {array}
- * @param options.items.align {string} - align to left or right
- * @param options.items.items.type {string} - item type, currently support text|icon
- * @param options.items.items.value {string} - text value
- * @param options.items.items.name {string} - name of the item
- * @param options.items.items.svgIcon {string} - svg icon id
- * @param options.items.items.iconTooltip {string} - tooltip for the icon
- * @param options.items.items.aria-label {string} - aria-label for the icon
- * @param options.items.items.role {string} - role for the icon
- * @param options.items.items.showRightArrow {boolean} - show arrow on far right along with the icon
- * @param options.items.items.clickCallback {function} - function to call when it is clicked or tapped
- * @param options.items.items.styles {string} - Styles to apply to the control container
- * @param options.items.items.ariaLabel {string} - String to be used by JAWS
- * @param options.items.items.labelFor {string} - for types of text, if the text is to be used for a label of a control. Specify the name of the item the control is in
- * @param options.items.items.ariaLabelledby {string} - space seperated string of options.items.items.name that you want JAWS to read out when this control gets focus
- */
- init: function init(options) {
- this.events = {};
- this.subControls = [];
- options.items.forEach(function (group) {
- group.items.forEach(function (item, j) {
- if (item.clickCallback) {
- var selector = 'clickCallback_' + group.align + '_' + j + '_' + options.id;
- this.events['primaryaction .' + selector] = function (evt) {
- this._handleClick(evt, item.clickCallback);
- }.bind(this);
- }
- }.bind(this));
- }.bind(this));
- if (options.clickCallback) {
- this.events['primaryaction .property_' + options.id] = function (evt) {
- this._handleClick(evt, options.clickCallback);
- }.bind(this);
- }
- SingleLineLinks.inherited('init', this, arguments);
- _.extend(this, options);
- },
- doRender: function doRender() {
- var left = [];
- var right = [];
- for (var i = 0; i < this.items.length; i = i + 1) {
- if (this.items[i].align === 'left') {
- left = this.items[i].items;
- } else if (this.items[i].align === 'right') {
- right = this.items[i].items;
- }
- }
- left.forEach(this._updateAriaLabelledBy.bind(this));
- right.forEach(this._updateAriaLabelledBy.bind(this));
- var sHtml = dot.template(singleLineLinks)({
- 'disabled': this.disabled,
- 'id': this.id,
- 'left': left,
- 'right': right,
- 'clickCallback': this.clickCallback,
- 'readOnly': this.readOnly,
- 'name': this.name,
- 'styles': this.styles,
- 'showRightArrow': this.showRightArrow,
- 'role': this.role,
- 'iconTooltip': this.iconTooltip,
- 'hidden': this.hidden
- });
- this.$el.append(sHtml);
- var promiseArr = left.map(function (widget, index) {
- return this._postRender(widget, index);
- }.bind(this));
- right.forEach(function (widget, index) {
- promiseArr.push(this._postRender(widget, index));
- }.bind(this));
- return Promise.all(promiseArr).then(function () {
- if (this.disabled) {
- this.disable();
- }
- }.bind(this));
- },
- _updateAriaLabelledBy: function _updateAriaLabelledBy(controlSpec) {
- if (controlSpec.ariaLabelledby) {
- var aLabelledby = controlSpec.ariaLabelledby.split(' ');
- aLabelledby.forEach(function (value, index) {
- aLabelledby[index] = 'control_' + value + '_' + this.id;
- }.bind(this));
- controlSpec.ariaLabelledby = aLabelledby.join(' ');
- }
- },
- _postRender: function _postRender(controlSpec, index) {
- if (controlSpec.type !== 'text' && controlSpec.type !== 'icon') {
- if (!this._oPropertyUIControl) {
- this.initUIControl(this.$el.find('.propertyRow')[0]);
- }
- var $containerNode = this.$el.find('.innerControlContainer_' + controlSpec.type + this.id + index);
- if ($containerNode.length > 0) {
- controlSpec.el = $containerNode[0];
- controlSpec.id = this.id;
- return this._oPropertyUIControl.renderItems([controlSpec]);
- } else {
- return Promise.resolve();
- }
- } else {
- return Promise.resolve();
- }
- },
- _handleClick: function _handleClick(evt, callback) {
- if (!this.disabled && callback) {
- callback(evt);
- }
- },
- _findClickableNodes: function _findClickableNodes() {
- if (!this.clickable) {
- this.clickable = this.getPropertyNode().find('.clickable' + this.id);
- }
- return this.clickable;
- },
- disable: function disable() {
- this._toggleEnabled(true);
- this._propertyNode.addClass('disabled');
- if (this._oPropertyUIControl) {
- this._oPropertyUIControl.getProperties().forEach(function (property) {
- property.disable();
- });
- }
- },
- enable: function enable() {
- this._toggleEnabled(false);
- this._propertyNode.removeClass('disabled');
- if (this._oPropertyUIControl) {
- this._oPropertyUIControl.getProperties().forEach(function (property) {
- property.enable();
- });
- }
- },
- toggleEnabled: function toggleEnabled() {
- if (this.disabled) {
- this.enable();
- } else {
- this.disable();
- }
- },
- _toggleEnabled: function _toggleEnabled(disabled) {
- this.disabled = disabled;
- var clickableNodes = this._findClickableNodes();
- if (clickableNodes) {
- for (var i = 0; i < clickableNodes.length; i = i + 1) {
- var node = clickableNodes.get(i);
- if (disabled) {
- $(node).removeClass('clickable');
- } else {
- $(node).addClass('clickable');
- }
- }
- }
- },
- setValue: function setValue(subPropertyName, value) {
- this.getPropertyNode().find('.' + subPropertyName).text(value);
- this.processEllipses();
- }
- });
- return SingleLineLinks;
- });
- //# sourceMappingURL=SingleLineLinks.js.map
- ;
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('baglass/core-client/js/core-client/ui/properties/CollapsiblePicker',['./BaseProperty', 'text!./templates/CollapsiblePicker.html', 'jquery', 'underscore', 'react', 'authoring-common', './SingleLineLinks', '../../nls/StringResources', '../../utils/Utils'], function (BaseProperty, Template, $, _, React, AuthoringCommon, SingleLineLinks, StringResources, Utils) {
- 'use strict';
- var CustomColorDialog = AuthoringCommon.CustomColorDialog;
- var CollapsiblePicker = BaseProperty.extend({
- templateString: Template,
- // These map to what's in the SASS/CSS file
- contentSizeMap: {
- 'small': 'Sm',
- 'medium': 'Md',
- 'large': 'Lg'
- },
- /**
- * A generic collapsible property capable of displaying a supplied pick list for a given item type (eg SVGs, colours)
- *
- * @param {string} options.id - property id
- * @param {node} options.el - parent element
- * @param {string} options.name - property name
- * @param {string} options.label - property label
- * @param {array} options.items - array of items
- * @param {string} options.items.name - item name
- * @param {string} options.items.label - item label
- * @param {string} options.items.value - item value
- * @param {string} options.items.type - item type; 'ColorCode', 'Class', 'svg'
- * @param {fnction} options.onChange - callback to be notified as soon as the change happens
- * @param {function} options.onOpenChange - callback to be notified whenever the picker opens / closes
- * @param {boolean} [options.readOnly=false] - if true the UI will be rendered in a read-only mode
- * @param {boolean} [options.nestedUIControl=false] - Set to true if this UI Widget is being rendered by another UI Widget
- * @param {string} [options.ariaLabel] - if you want to override the default label for screen readers
- * @param {string} [options.selectedName] - initally select one of the items by its name
- * @param {object} [options.placeholder] - define a placeholder item to be show before the user selects an item. Note: Cannot
- * define this and have a 'selectedName' at the same time. selectedName will take precedent if both are defined.
- * @param {string} options.placeholder.name - item name
- * @param {string} options.placeholder.label - item label
- * @param {string} options.placeholder.value - item value
- * @param {string} options.placeholder.type - item type; 'ColorCode', 'Class', 'svg'
- * @param {boolean} [options.open=false] - if true, open(expand) the picker,
- * @param {boolean} [options.showHexValue=false] - if true, show a hex string
- * @param {boolean} [options.displayLabel] - if true, show specified display value string
- * @param {boolean} [options.addButton=false] - if true, show a link to create a custom color.
- * @param {function} [options.createCustomColor] - function to create a custom color item
- * @param {boolean} [options.closeOnSelect=true] - true to close the picker when a selection is made; false to leave it open
- * @param {string} [options.contentSize=small] - Size of icons to use; 'small', 'medium', 'large' for (32px, 40px, 48px respectively)
- * @param {string} [options.itemType=color] - The picker item type; Options are 'color' or 'svg'
- * @param {boolean} [options.isRequired=false] - When set to true if no 'selectedName' is given and a placeholder has been defined
- * then a red asterisk ( * ) is shown beside the label to indicate further user action is required
- * @param {boolean} [options.allowSameSelection=false] - true to trigger change event if selecting item that is already selected
- */
- init: function init(options) {
- this.events = {};
- this.events['clicktap .property_' + options.id + ' .collapsiblePickerBox'] = '_handleClick';
- this.events['keydown .property_' + options.id + ' .collapsiblePickerBox'] = '_handleKeyDown';
- this.events['clicktap .collapsibleSectionToggle' + options.id] = 'toggleCollapsibleSection';
- this.events['keydown .collapsibleSectionToggle' + options.id] = '_toggleCollapsibleSectionKeyDown';
- this.nestedUIControl = false;
- this.open = false;
- this.closeOnSelect = true;
- this.contentSize = 'small';
- this.itemType = 'color';
- this.isRequired = false;
- CollapsiblePicker.inherited('init', this, arguments);
- _.extend(this, options);
- this._isColorPicker = this.itemType === 'color';
- this._isRequired = !this.selectedName && this.placeholder && this.isRequired;
- },
- doRender: function doRender() {
- if (this.placeholder && !this.selectedName) {
- this.selectedItem = this.placeholder;
- } else {
- this.selectedItem = this._getSelectedItemFromName(this.selectedName);
- }
- var hexValue = this.selectedItem.type === 'ColorCode' ? this.selectedItem.value : this.selectedItem.hexValue;
- if (hexValue === 'transparent') {
- hexValue = '';
- }
- var sHtml = this.dotTemplate({
- 'name': this.name,
- 'label': this.label,
- 'items': this.items,
- 'id': this.id,
- 'readOnly': this.readOnly,
- 'value': this.selectedItem.value,
- 'hexValue': hexValue && hexValue.toUpperCase(),
- 'selectedValueType': this.selectedItem.type,
- 'showHexValue': this.showHexValue,
- 'displayLabel': this.displayLabel,
- 'selectedLabel': this.selectedItem.label,
- 'addButton': this.addButton,
- 'ariaLabel': this.ariaLabel,
- 'nestedUIControl': this.nestedUIControl,
- 'contentSize': this.contentSizeMap[this.contentSize.toLowerCase()] || this.contentSizeMap.small,
- 'colorPicker': this._isColorPicker,
- 'isRequired': this._isRequired
- });
- var $picker = $(sHtml);
- if (this.addButton) {
- var $container = $picker.find('.addCustomColor');
- var link = new SingleLineLinks({
- el: $container,
- name: this.name,
- id: this.id,
- type: 'SingleLineLinks',
- items: [{
- align: 'right',
- items: [{
- type: 'text',
- name: 'customColorLink',
- value: StringResources.get('addCustomColor'),
- clickCallback: this.addCustomColor.bind(this)
- }]
- }]
- });
- link.doRender();
- }
- this.$el.append($picker);
- if (this.open) {
- this._doToggleCollapsibleSection();
- }
- if (this.selectedItem.type === 'svg') {
- var $node = this.$el.find('.property_' + this.id + ' .selectedItemBox');
- Utils.setIcon($node, this.selectedItem.value, this.selectedItem.label, this.selectedItem.label);
- }
- this.$el.find('.property_' + this.id + ' .collapsiblePickerBox').each(function (index, el) {
- if (this.items[index].type.toLowerCase() === 'svg') {
- Utils.setIcon($(el), this.items[index].value, this.items[index].label, this.items[index].label);
- }
- }.bind(this));
- },
- toggleCollapsibleSection: function toggleCollapsibleSection() {
- // update state
- this.open = !this.open;
- this._doToggleCollapsibleSection();
- // notify open state change
- if (this.onOpenChange) {
- this.onOpenChange(this.name, this.open);
- }
- },
- openCollapsibleSection: function openCollapsibleSection() {
- if (this.open) {
- return;
- }
- this.open = !this.open;
- var $collasibleDiv = this.getCollapsibleDiv();
- $collasibleDiv.addClass('visible');
- this.$el.find('.toggleSection' + this.id).attr('aria-expanded', 'true');
- $collasibleDiv.attr('aria-hidden', 'false');
- },
- selectItem: function selectItem(event) {
- var $selectedNode = $(event.currentTarget);
- if ($selectedNode.data('name') !== this.getSelectedItem().name || this.allowSameSelection) {
- this.setSelectedItem($selectedNode);
- }
- if (this.closeOnSelect) {
- this.toggleCollapsibleSection();
- }
- },
- setSelectedItem: function setSelectedItem($selectedNode) {
- if (this._isRequired) {
- this._isRequired = false;
- this.$el.find('.collapsiblePickerRequired').remove();
- }
- this.selectedItem = this._getSelectedItemFromName($selectedNode.data('name'));
- var oldValue = this.getSelectedValue();
- this._unselectPreviousItem();
- this._updateSelectedNode($selectedNode);
- this._updatedSelectedNode(this.selectedItem.value, oldValue);
- this._onChange(this.name, this.getSelectedItem());
- },
- getSelectedItem: function getSelectedItem() {
- return {
- name: this.getSelectedName(),
- label: this.getSelectedLabel(),
- value: this.getSelectedValue(),
- type: this.getSelectedType()
- };
- },
- getCollapsibleDiv: function getCollapsibleDiv() {
- return this.$el.find('.collapsibleSection.property_' + this.id);
- },
- getSelectedNode: function getSelectedNode() {
- return this.$el.find('.property_' + this.id + ' .selected');
- },
- getSelectedName: function getSelectedName() {
- return this.getSelectedNode().data('name');
- },
- getSelectedValue: function getSelectedValue() {
- return this.getSelectedNode().data('value');
- },
- getSelectedLabel: function getSelectedLabel() {
- return this.getSelectedNode().attr('title');
- },
- getSelectedType: function getSelectedType() {
- var type;
- _.each(this.items, function (item) {
- if (_.isEqual(item.value, this.selectedItem.value)) {
- type = item.type;
- }
- }.bind(this));
- return type;
- },
- _getSelectedItemFromName: function _getSelectedItemFromName(name) {
- var selectedItem = this.items[0];
- _.each(this.items, function (item) {
- if (item.name === name) {
- selectedItem = item;
- }
- });
- return selectedItem;
- },
- _getSelectedItemFromValue: function _getSelectedItemFromValue(value) {
- var selectedItem = this.items[0];
- _.each(this.items, function (item) {
- if (item.value === value) {
- selectedItem = item;
- }
- });
- return selectedItem;
- },
- /**
- * @private
- *
- */
- _updatedSelectedNode: function _updatedSelectedNode(newValue, oldValue) {
- var $selectedItemBox = this.$el.find('.property_' + this.id + ' .selectedItemBox');
- if (oldValue && oldValue.toLowerCase() === 'transparent') {
- $selectedItemBox.find('.transparentIndicator').remove();
- }
- if (newValue && newValue.toLowerCase() === 'transparent') {
- $selectedItemBox.append('<div class="transparentIndicator"></div>');
- }
- var selectedType = this.getSelectedType();
- $selectedItemBox.removeAttr('style').removeClass(oldValue).find('.svgIcon').remove();
- if (selectedType === 'Class') {
- $selectedItemBox.addClass(newValue);
- } else if (selectedType === 'ColorCode') {
- $selectedItemBox.css('background', newValue);
- } else {
- // selectedType === 'svg'
- // Get the info and add a new SVG
- var item = this.getSelectedItem();
- Utils.setIcon($selectedItemBox, item.value, item.label, item.label);
- }
- if (this.showHexValue) {
- var colorValue = newValue.toLowerCase() === 'transparent' ? '' : Utils.rgbToHex($selectedItemBox.css('backgroundColor'));
- if (colorValue) {
- colorValue = colorValue.toUpperCase();
- }
- $selectedItemBox.siblings('.selectedColorHex').text(colorValue);
- }
- // Adding support to display a text value next to the picker
- if (this.displayLabel) {
- $selectedItemBox.siblings('.selectedLabel').text(this.getSelectedItem().label);
- }
- $selectedItemBox.attr({ 'data-value': newValue });
- },
- _updateSelectedNode: function _updateSelectedNode($selectedNode) {
- $selectedNode.addClass('selected').attr('aria-pressed', 'true');
- },
- _handleKeyDown: function _handleKeyDown(event) {
- // space || enter
- if (event.keyCode === 32 || event.keyCode === 13) {
- this.selectItem(event);
- }
- },
- _handleClick: function _handleClick(event) {
- this.selectItem(event);
- event.stopPropagation();
- },
- onChangeCustom: function onChangeCustom(color) {
- if (!color) {
- var logger = this.glassContext.getCoreSvc('.Logger');
- if (logger) {
- logger.error('No color returned by the Color Picker dialog.', this);
- }
- return;
- }
- this.selectedItem = this.createCustomColor(color);
- this.items.push(this.selectedItem);
- var oldValue = this.getSelectedValue();
- this._unselectPreviousItem();
- this._updatedSelectedNode(color, oldValue);
- this._onChange(this.name, this.selectedItem);
- },
- openCustomColorDialog: function openCustomColorDialog() {
- var dialog = void 0;
- var customColorComponent = React.createElement(CustomColorDialog, {
- key: 'colorDialog',
- glassContext: this.glassContext,
- ref: function ref(instance) {
- dialog = instance;
- },
- onChange: this.onChangeCustom.bind(this),
- onCloseDialog: Utils.removeTemporaryContainer.bind(this)
- });
- Utils.reactRender(customColorComponent, Utils.createTemporaryContainer()).then(function () {
- dialog.openDialog();
- });
- },
- addCustomColor: function addCustomColor(event) {
- this.openCustomColorDialog(event);
- },
- _unselectPreviousItem: function _unselectPreviousItem() {
- var $previousSelectedNode = this.getSelectedNode();
- $previousSelectedNode.removeClass('selected').attr('aria-pressed', 'false');
- },
- _toggleCollapsibleSectionKeyDown: function _toggleCollapsibleSectionKeyDown(evt) {
- // space || enter
- if (evt.keyCode === 32 || evt.keyCode === 13) {
- this.toggleCollapsibleSection();
- }
- },
- _doToggleCollapsibleSection: function _doToggleCollapsibleSection() {
- var $collasibleDiv = this.getCollapsibleDiv();
- $collasibleDiv.toggleClass('visible');
- var isVisible = $collasibleDiv.hasClass('visible');
- this.$el.find('.toggleSection' + this.id).attr('aria-expanded', isVisible ? 'true' : 'false');
- $collasibleDiv.attr('aria-hidden', isVisible ? 'false' : 'true');
- }
- });
- return CollapsiblePicker;
- });
- //# sourceMappingURL=CollapsiblePicker.js.map
- ;
- define('text!baglass/core-client/js/core-client/ui/properties/templates/CollapsibleSection.html',[],function () { return '{{?!it.hideSectionTitle }}\n<div class="{{? it.styleAsSimpleRow == true}}simpleCollapsibleSectionTitle propertyRow{{??}}collapsibleSectionTitle{{?}} collapsibleSectionToggle{{=it.id}} {{? it.name }}l_{{=it.name}}{{?}}">\n\t<div id="label_{{=it.id}}" class="singleLine">{{=it.label}}</div>\n\t<div class="rightAlign">\n\t\t<div class="arrow blueArrow downArrow toggleSection{{=it.id}}" aria-haspopup="true" aria-controls="region_{{=it.id}}" role="link" tabindex="0" aria-controls="region_{{=it.id}}" aria-labelledby="label_{{=it.id}}"></div>\n\t</div>\n</div>\n{{?}}\n<div class="collapsibleSection property_{{=it.id}}{{?it.horizontalAlign}} horizontalAlign{{?}}" id="region_{{=it.id}}" aria-hidden="true" aria-live="off"{{? it.hideSectionTitle}}{{? it.ariaLabel}} role="region" aria-label="{{=it.ariaLabel}}"{{?}}{{??}} role="region" aria-labelledby="label_{{=it.id}}"{{?}}></div>\n';});
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2020
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('baglass/core-client/js/core-client/ui/properties/CollapsibleSection',['./PropertyContainerBaseClass', 'text!./templates/CollapsibleSection.html', './PropertyUIControl', 'doT', 'jquery', 'underscore'], function (PropertyContainerBaseClass, CollapsibleSectionTemplate, PropertyUIControl, dot, $, _) {
- 'use strict';
- var CollapsibleSection = PropertyContainerBaseClass.extend({
- /**
- @param options.el {object} - Container DOM node
- @param options.label {String} - Label for the expandible section
- @param options.items {array} - array of UI widgets to show in the section
- @param options.id - unique id
- @param options.styleAsSimpleRow {boolean} - default false, if true will have normal property styles
- @param options.indent {int} - default 0, will indent by options.indent * 10px
- @param options.readOnly {boolean} - optional, default is false. If true, the UI will be rendered in a read-only mode
- @param options.onOpenChange {function} - callback notified whenever the section opens / closes
- @param options.hideSectionTitle {boolean} - default false
- @param options.horizontalAlign {boolean} - optional, default is false. If true, the properties in this section will be aligned horizontally.
- @param options.open {boolean} - default false. If true, section will be expanded on open
- **/
- init: function init(options) {
- this.events = {};
- this.events['clicktap .collapsibleSectionToggle' + options.id] = 'toggleCollapsibleSection';
- this.events['keydown .collapsibleSectionToggle' + options.id] = '_handleKeyDown';
- this.ellipses = true;
- CollapsibleSection.inherited('init', this, arguments);
- _.extend(this, options);
- },
- render: function render() {
- var sHtml = dot.template(CollapsibleSectionTemplate)({
- 'label': this.label,
- 'id': this.id,
- 'name': this.name,
- 'ariaLabel': this.ariaLabel,
- 'styleAsSimpleRow': this.styleAsSimpleRow,
- 'hideSectionTitle': this.hideSectionTitle,
- 'horizontalAlign': this.horizontalAlign
- });
- var $dom = $(sHtml).appendTo(this.$el);
- if (this.items) {
- this.initUIControl(this.getCollasibleDiv()[0]);
- this.processIndent();
- this.processStaticValidation($dom.first());
- if (this.open) {
- this._doToggleCollapsibleSection();
- }
- return this._oPropertyUIControl.render();
- } else {
- return Promise.resolve(true);
- }
- },
- getCollasibleDiv: function getCollasibleDiv() {
- return this.$el.find('.property_' + this.id);
- },
- _handleKeyDown: function _handleKeyDown(evt) {
- if (evt.keyCode === 32 || evt.keyCode === 13) {
- // space || enter
- this.toggleCollapsibleSection();
- }
- },
- /**
- Show/Hide the collapsible section
- **/
- toggleCollapsibleSection: function toggleCollapsibleSection() {
- // update state
- this.open = !this.open;
- this._doToggleCollapsibleSection();
- // notify open state change
- if (this.onOpenChange) {
- this.onOpenChange(this.name, this.open);
- }
- },
- _doToggleCollapsibleSection: function _doToggleCollapsibleSection() {
- this.getCollasibleDiv().toggleClass('visible');
- this.$el.find('.toggleSection' + this.id).toggleClass('upArrow');
- var isVisisble = this.getCollasibleDiv().hasClass('visible');
- this.$el.find('.toggleSection' + this.id).attr('aria-expanded', isVisisble ? 'true' : 'false');
- this.getCollasibleDiv().attr('aria-hidden', isVisisble ? 'false' : 'true');
- // Make sure any properties that have the 'ellipse' class gets processed when it's shown
- this.processEllipses();
- },
- isEmpty: function isEmpty() {
- return this.items === undefined || this.items === null;
- },
- refreshProperties: function refreshProperties(items) {
- this.items = items;
- if (this._oPropertyUIControl) {
- this._oPropertyUIControl.remove();
- }
- $(this.getCollasibleDiv()[0]).empty();
- this._oPropertyUIControl = new PropertyUIControl({
- 'glassContext': this.glassContext,
- 'el': this.getCollasibleDiv()[0],
- 'readOnly': this.readOnly,
- 'items': this.items,
- 'onChange': this.onChange,
- 'primaryUIControl': false,
- 'animatedSpinner': true
- });
- this.processIndent();
- return this._oPropertyUIControl.render();
- }
- });
- return CollapsibleSection;
- });
- //# sourceMappingURL=CollapsibleSection.js.map
- ;
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2016, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('baglass/core-client/js/core-client/ui/properties/ColorPicker',['./CollapsiblePicker'], function (CollapsiblePicker) {
- 'use strict';
- return CollapsiblePicker;
- });
- //# sourceMappingURL=ColorPicker.js.map
- ;
- define('text!baglass/core-client/js/core-client/ui/properties/templates/Input.html',[],function () { return ' {{?it.placeHolderText != \'\'}}{{? it.newLook}}\n <div class="propertyRow property_{{=it.id}}{{?it.readOnly}} disabled{{?}}">\n\t<div>\n\t\t<div class="l_{{=it.name}} inputHintText">{{?it.value != \'\'}}{{=it.placeHolderText}}{{??}} {{?}}</div>\n {{?}}{{?}}\n <div class="inputContainer {{=it.inputClass}}{{? it.showInlineError}} flex{{?}}" style="overflow:hidden;">\n\t<input id="control_{{=it.name}}_{{=it.id}}" type="{{=it.inputType}}" {{? it.inputType === \'password\'}}autocomplete="off"{{?}} class="{{? it.inputType != \'password\'}}{{? it.ellipses}}ellipses{{?}}{{?}} blueText editable{{=it.id}}{{? it.newLook}} newUXLook{{?}} {{=it.inputClass}}"{{? it.inputStyles}} style="{{=it.inputStyles}}"{{?}} {{?it.placeHolderText != \'\'}}placeholder="{{=it.placeHolderText}}"{{?}}value="{{=_.escape(it.value)}}"{{?it.direction}} dir="{{=it.direction}}"{{?}}{{?it.ariaLabel}} aria-label="{{=it.ariaLabel}}"{{?}} {{? !it.readOnly}}tabindex="0"{{??}}disabled{{?}}></input>\n</div>\n{{?it.placeHolderText != \'\'}}{{? it.newLook}}\n \t</div>\n</div>\n{{?}}{{?}}\n';});
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2017
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('baglass/core-client/js/core-client/ui/properties/Input',['./BaseProperty', 'text!./templates/Input.html', 'jquery', 'doT', '../../utils/BidiUtil', 'underscore', '../../utils/Utils'], function (BaseProperty, inputTemplate, $, dot, BidiUtil, _, Utils) {
- 'use strict';
- var Input = BaseProperty.extend({
- handleReturnKey: false,
- /**
- * Creates an input control
- * @param options.el {node}- parent element
- * @param options.name {string} - property name
- * @param options.value {string} - property value
- * @param options.disabled {boolean}{optional} - default is false, set to true if you want the control disabled
- * @param options.readOnly {boolean}{optional} - default is false. If true, the UI will be rendered in a read-only mode
- * @param options.ellipses {boolean}{optional} - default is true.
- * @param options.hintText {string}{options} - if set the hint text will appear above the input control
- * @param options.id {string} - unique id
- * @param options.onChange {function}{optional} - the callback function called when property value had been edited
- * @param options.indent {int} - default 0, will indent by options.indent * 10px
- * @param options.inputType {string} - default is text, but can set to password or anything supported by HTML
- * @param options.inputClass {string} - css class to apply to the container div
- * @param options.inputStyles {string} - any custom styles to place on the container div
- * @param options.highlightTextOnFocus {boolean} - if true, the text will be highlighed on focus
- * @param options.placeHolderText {string} - if you want text to be shown when the input is empty
- * @param options.ariaLabel {string} - label to be read by JAWS
- * @param options.handleReturnKey {boolean} - process the 'Return/Enter' key press
- * @param options.newLook {boolean} - if you want the input to have the new look
- * @param options.showInlineError {boolean} - if you want the error icon to show beside the input control
- * @param options.iSTT {boolean}{optional} - if true the text is displayed as Strutured Text (bidi feature)
- */
- init: function init(options) {
- this.inputType = 'text';
- this.inputClass = '';
- this.inputStyles = '';
- this.ellipses = true;
- this.highlightTextOnFocus = false;
- this.placeHolderText = '';
- // An input control is ALAWAYS editable. It can however be read-only
- options.editable = true;
- if (options.editable && options.newLook && options.placeHolderText) {
- if (_.isUndefined(this.events)) {
- this.events = {};
- }
- this.events['keyup .editable' + options.id] = '_onKeyUp';
- }
- Input.inherited('init', this, arguments);
- _.extend(this, options);
- if (this.inputType === 'password') {
- this.ellipses = false;
- }
- },
- /**
- * return the options for the html template
- */
- getTemplateOptions: function getTemplateOptions() {
- return {
- 'value': !this.isSTT || BidiUtil.userPreferredTextDir === '' ? this.value : BidiUtil.enforceTextDirectionForSTT(this.value),
- 'direction': !this.isSTT ? BidiUtil.resolveBaseTextDir(this.value || '') : '',
- 'id': this.id,
- 'readOnly': this.readOnly,
- 'name': this.name,
- 'inputType': this.inputType,
- 'inputClass': this.inputClass,
- 'inputStyles': this.inputStyles,
- 'ellipses': this.ellipses,
- 'placeHolderText': this.placeHolderText,
- 'ariaLabel': this.ariaLabel,
- 'newLook': this.newLook,
- 'showInlineError': this.showInlineError
- };
- },
- /**
- * return the html template
- */
- getHTMLTemplate: function getHTMLTemplate() {
- return inputTemplate;
- },
- doRender: function doRender() {
- var sHtml = dot.template(this.getHTMLTemplate())(this.getTemplateOptions());
- this.$el.append(sHtml);
- if (this.disabled) {
- this.disable();
- }
- return Promise.resolve(true);
- },
- setValue: function setValue(text) {
- var $input = this.getPropertyNode().find('input');
- if ($input.length > 0) {
- $input.val(text);
- } else {
- this.getPropertyNode().find('.propertyValue').text(text);
- }
- this.processEllipses();
- this._onChange(this.name, text);
- this._updateHintTextPlacement();
- },
- getValue: function getValue() {
- var $input = this.getPropertyNode().find('input');
- if ($input.length > 0) {
- return $input.val();
- }
- return '';
- },
- showError: function showError(errorMessage) {
- if (this.errorMessageNode) {
- this.errorMessageNode.attr('title', errorMessage);
- } else {
- this.errorMessageNode = $('<div>', {
- 'tabindex': 0,
- 'title': errorMessage,
- 'class': 'inlineValidationIcon'
- });
- $('<svg><use style="pointer-events: none;" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#common-failed"></use></svg>').appendTo(this.errorMessageNode);
- Utils.embedSVGIcon(this.errorMessageNode);
- var inputContainer = this.getPropertyNode().find('.inputContainer');
- inputContainer.append(this.errorMessageNode);
- inputContainer.find('input').addClass('error');
- }
- },
- hideError: function hideError() {
- if (this.errorMessageNode) {
- this.errorMessageNode.remove();
- this.getPropertyNode().find('input').removeClass('error');
- this.errorMessageNode = null;
- }
- },
- _onKeyUp: function _onKeyUp() {
- this._updateHintTextPlacement();
- },
- _updateHintTextPlacement: function _updateHintTextPlacement() {
- var value = this.getValue();
- if (this.newLook && this.placeHolderText) {
- var labelNode = this.getPropertyNode().find('.inputHintText');
- if (value === '') {
- labelNode.html(' ');
- } else {
- labelNode.text(this.placeHolderText);
- }
- }
- }
- });
- return Input;
- });
- //# sourceMappingURL=Input.js.map
- ;
- define('text!baglass/core-client/js/core-client/ui/properties/templates/SingleLineValue.html',[],function () { return '<div class="propertyRow property_{{=it.id}}{{? it.multiline == true}} multiline{{??}} flex{{?}}{{?it.readOnly}} disabled{{?}}">\n\t\t<div class="propertyName{{? it.multiline != true}} singleLine{{?}} l_{{=it.name}} textSelectable">\n\t\t\t<div id="label_{{=it.id}}" {{?it.editable}}for="control_{{=it.name}}_{{=it.id}}"{{?}} title="{{=it.label}}">{{=it.label}}</div>\n\t\t</div>\n\t\t{{? it.editable === true}}\n\t\t\t<div class="propertyNameEdit toggleEdit{{=it.id}}" role="img" title="{{=it.strings.edit}}">\n\t\t\t\t<svg class="svgIcon editIcon editIcon{{=it.id}}" role="presentation" >\n\t\t\t\t\t<text>{{=it.strings.edit}}</text>\n\t\t\t\t\t<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#common-edit"></use>\n\t\t\t\t</svg>\n\t\t\t</div>\n\t\t{{?}}\n\t{{? it.multiline == true}}\n\t<div class="multilineValue">\n\t{{?}}\n\t\t{{? it.editable}}\n\t\t\t<div class="placeholder_Input{{=it.id}} wideProperty"></div>\n\t\t{{??}}\n\t\t\t<div class="{{? it.multiline != true}}rightAlign{{?}}{{? it.editable}} inputContainer{{?}}" style="overflow:hidden;">\n\t\t\t\t<div id="value_{{=it.id}}" class="propertyValue ellipses textSelectable {{? it.editCallback === true}}secondaryEdit{{=it.id}} clickable{{?}} v_{{=it.name}}"{{?it.direction}} dir="{{=it.direction}}"{{?}}>{{=_.escape(it.value)}}</div>\n\t\t\t</div>\n\t\t{{?}}\n\t\t{{? it.editCallback === true}}\n\t\t\t<div {{? !it.readOnly}}tabindex="0"{{?}} role="button" aria-labelledby="label_{{=it.id}}{{?it.value && !it.editable}} value_{{=it.id}}{{?}}" class="arrow blueArrow clickable rightArrow secondaryEdit{{=it.id}} a_{{=it.name}}"></div>\n\t\t{{?}}\n\t{{? it.multiline == true}}\n\t</div>\n\t{{?}}\n</div>\n';});
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2021
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('baglass/core-client/js/core-client/ui/properties/SingleLineValue',['./BaseProperty', './Input', 'text!./templates/SingleLineValue.html', 'jquery', 'doT', '../../utils/BidiUtil', 'underscore', '../../nls/StringResources'], function (BaseProperty, Input, singleLineValue, $, dot, BidiUtil, _, StringResource) {
- 'use strict';
- var SingleLineValue = BaseProperty.extend({
- /**
- * Creates a property with single line and read-only value.
- * @param options.el {node}- parent element
- * @param options.name {string} - property name
- * @param options.label {string} - property label
- * @param options.value {string} - property value
- * @param options.disabled {boolean}{optional} - default is false, set to true if you want the control disabled
- * @param options.readOnly {boolean}{optional} - default is false. If true, the UI will be rendered in a read-only mode
- * @param options.editable {boolean}{optional} - default is false, if true the text value can be edited inline
- * @param options.editCallback {function}{optional} - callback to call when the secondary edit icon is clicked
- * @param options.id {string} - unique id
- * @param options.onChange {function}{optional} - the callback function called when property value had been edited
- * @param options.indent {int} - default 0, will indent by options.indent * 10px
- * @param options.multiline {boolean} - default false, if true the value will be on a separate line
- * @param options.inputType {string} - default is text, but can set to password or anything supported by HTML
- * @param options.iSTT {boolean}{optional} - if true the text is displayed as Strutured Text (bidi feature)
- * @param options.ellipses {boolean}{optional} - default is true, truncates text with ellipses
- */
- init: function init(options) {
- this.events = {};
- if (options.editCallback) {
- this.events['clicktap .secondaryEdit' + options.id] = '_handleClick';
- this.events['keydown .property_' + options.id] = '_handleKeyDown';
- }
- if (options.editable) {
- this.events['keydown .editable' + options.id] = '_colorInputBorder';
- }
- var defaultParams = {
- inputType: 'text',
- ellipses: true
- };
- SingleLineValue.inherited('init', this, arguments);
- _.extend(this, defaultParams, options);
- this.ellipses = this.inputType === 'password' ? false : this.ellipses;
- },
- doRender: function doRender() {
- SingleLineValue.inherited('doRender', this, arguments);
- var sHtml = dot.template(singleLineValue)({
- 'label': this.label,
- 'value': !this.isSTT || BidiUtil.userPreferredTextDir === '' ? this.value : BidiUtil.enforceTextDirectionForSTT(this.value),
- 'direction': !this.isSTT ? BidiUtil.resolveBaseTextDir(this.value || '') : '',
- 'editCallback': this.editCallback ? true : false,
- 'id': this.id,
- 'editable': this.editable && !this.readOnly,
- 'readOnly': this.readOnly,
- 'name': this.name,
- 'multiline': this.multiline,
- 'inputType': this.inputType,
- 'strings': {
- 'edit': StringResource.get('edit')
- },
- 'labelTitle': this.title || ''
- });
- this.$el.append(sHtml);
- if (this.svgIconClickCallback) {
- this.getPropertyNode().find('.svgIconClickCallback' + this.id).on('clicktap', function () {
- this._handleSvgIconClick();
- }.bind(this));
- }
- return this._renderInput().then(function () {
- if (this.disabled) {
- this.disable();
- }
- this._colorInputBorder();
- }.bind(this));
- },
- //called when the parent is resized.
- onResize: function onResize() {
- //update the text so it can re-ellipseseses it.
- this.setValue(!this.isSTT || BidiUtil.userPreferredTextDir === '' ? this.value : BidiUtil.enforceTextDirectionForSTT(this.value));
- },
- _renderInput: function _renderInput() {
- this.inputPlaceholder = this.$el.find('.placeholder_Input' + this.id);
- if (this.inputPlaceholder.length > 0) {
- this.ellipses = false; // The input control will handle it's own ellipses
- this.editable = false; // THe input ia the one that can be edited, not the SingleLineValue
- this._inputControl = new Input({
- 'el': this.inputPlaceholder[0],
- 'name': this.name,
- 'value': this.value,
- 'readOnly': this.readOnly,
- 'disabled': this.disabled,
- 'id': this.id,
- 'onChange': this.onChange,
- 'inputType': this.inputType,
- 'inputClass': this.multiline ? '' : 'rightAlign',
- 'ariaLabel': this.ariaLabel,
- 'validator': this.validator,
- 'isString': this.isString
- });
- return this._inputControl.render();
- } else {
- return Promise.resolve();
- }
- },
- _colorInputBorder: function _colorInputBorder() {
- var isEmpty = this.getHTMLControl().val();
- if (isEmpty === '') {
- this.getHTMLControl().addClass('empty');
- } else {
- this.getHTMLControl().removeClass('empty');
- }
- },
- _handleKeyDown: function _handleKeyDown(evt) {
- console.log('key down');
- if (evt.keyCode === 32 || evt.keyCode === 13) {
- // space || enter
- this._handleClick();
- }
- },
- _handleClick: function _handleClick() {
- if (this.editCallback) {
- this.editCallback();
- }
- },
- _handleSvgIconClick: function _handleSvgIconClick() {
- if (this.svgIconClickCallback) {
- this.svgIconClickCallback();
- }
- },
- disable: function disable() {
- if (this.editCallback) {
- if (!this._clickable) {
- this._clickable = this.getPropertyNode().find('.clickable');
- }
- if (!this._secondaryEdit) {
- this._secondaryEdit = this.getPropertyNode().find('.secondaryEdit' + this.id);
- }
- this._clickable.removeClass('clickable blueText');
- this._secondaryEdit.removeClass('blueArrow secondaryEdit' + this.id);
- }
- if (this._inputControl) {
- this._inputControl.disable();
- }
- if (this.editable) {
- SingleLineValue.inherited('disable', this, arguments);
- }
- },
- enable: function enable() {
- if (this._clickable) {
- this._clickable.addClass('clickable blueText');
- }
- if (this._secondaryEdit) {
- this._secondaryEdit.addClass('blueArrow secondaryEdit' + this.id);
- }
- if (this._inputControl) {
- this._inputControl.enable();
- }
- if (this.editable) {
- SingleLineValue.inherited('enable', this, arguments);
- }
- },
- setValue: function setValue(text) {
- if (this._inputControl) {
- this._inputControl.setValue(text);
- } else {
- this.getPropertyNode().find('.propertyValue').text(text);
- }
- this.processEllipses();
- this._onChange(this.name, text);
- this._colorInputBorder();
- },
- getModifiedProperties: function getModifiedProperties() {
- var result = $.extend({}, SingleLineValue.inherited('getModifiedProperties', this, arguments));
- if (this._inputControl) {
- $.extend(result, this._inputControl.getModifiedProperties());
- }
- return result;
- }
- });
- return SingleLineValue;
- });
- //# sourceMappingURL=SingleLineValue.js.map
- ;
- define('text!baglass/core-client/js/core-client/ui/properties/templates/DropDown.html',[],function () { return '<div class="{{? !it.nestedUIControl}}propertyRow{{?}} property_{{=it.id}}{{?it.readOnly}} disabled{{?}}">\n\t{{?it.label}}\n\t\t<div class="propertyName singleLine l_{{=it.name}}">\n\t\t\t<label for="control_{{=it.name}}_{{=it.id}}">{{=it.label}}</label>\n\t\t\t{{?it.coachMark}}<div class="coachMarkContainer"></div>{{?}}\n\t\t</div>\n\t{{?}}\n\t<div class="dropDown rightAlign">\n\t\t{{? it.ariaDescribedby}}<span class="screenReader" id="control_describedby_{{=it.id}}">{{=it.ariaDescribedby}}</span>{{?}}\n\t\t<select id="control_{{=it.name}}_{{=it.id}}"{{?it.ariaLabel}}aria-label="{{=it.ariaLabel}}"{{?}} class="dropDown{{=it.id}} v_{{=it.name}}"{{?it.readOnly}} disabled="disabled"{{?}}{{? it.style}} style="{{=it.style}}"{{?}} tabindex="0" {{? it.ariaDescribedby}}aria-describedby="control_describedby_{{=it.id}}"{{?}}>\n\t\t\t{{~it.options :option}}\n\t\t\t\t<option{{? option.cssClass}} class="{{=option.cssClass}}"{{?}} value="{{=_.escape(option.value)}}" {{? option.selected === true || it.defaultValue === option.value}}selected{{?}} {{? option.disabled === true}}disabled{{?}}>{{=_.escape(option.label)}}</option>\n\t\t\t{{~}}\n\t\t</select>\n\t</div>\n</div>\n';});
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2017
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('baglass/core-client/js/core-client/ui/properties/DropDown',['../Slideout', './BaseProperty', './SingleLineValue', '../../utils/Utils', 'text!./templates/DropDown.html', 'jquery', 'doT', 'underscore'], function (Slideout, BaseProperty, SingleLineValue, Utils, dropDownTemplate, $, dot, _) {
- 'use strict';
- var DropDown = BaseProperty.extend({
- /**
- * Creates a property with round checkbox.
- * @param options.id {string} - property id
- * @param options.el {node} - parent element
- * @param options.name {string} - property name
- * @param options.label {string} - property label
- * @param options.responsive {boolean} - default is true, whether or not we switch to a full page flyout for menus with a lot of items
- * @param options.disabled {boolean} - default is false, set to true if you want the control disabled
- * @param options.defaultValue {string} - the value of the option that should be selected by default
- * @param options.style {string} - css styles to apply to the select control
- * @param options.options {array} - Array of objects for each option in the select control
- * options.options.label {string} - Label for the option in the select control
- * options.options.value {string} - Value for the option in the select control
- * options.options.selected {boolean} - true if the option should be selected by default
- * options.options.cssClass {string} - cssClass for the option in the select control
- * @param options.onChange {function} - callback to be notified as soon as the change happens
- * @param options.ariaDescribedby {optional: string} - use this option to provide more information for screen readers
- *
- * The following params pertains to the slideout overlay
- * @param options.position {string} - Default is right. Indicates slideout position. Value is either 'right' or 'left'.
- * @param options.parentEl {optional: jQuery element} - Container element.
- * @param options.indent {int} - default 0, will indent by options.indent * 10px
- * @param options.readOnly {boolean} - optional, default is false. If true, the UI will be rendered in a read-only mode
- * @param options.nestedUIControl {boolean} - optional, default is false. Set to true if this UI Widget is being rendered by another UI Widget
- * @param options.ariaLabel {string} - if you want to override the default label for screen readers
- */
- position: 'right',
- ellipses: true,
- init: function init(options) {
- this.events = {};
- this.events['change .dropDown' + options.id] = '_handleChange';
- this.nestedUIControl = false;
- DropDown.inherited('init', this, arguments);
- _.extend(this, options);
- },
- doRender: function doRender() {
- // If there are >10 items and the parent element is provided, switch to a singleLineValue
- // with a editCallback. This is to have a full page select slideout.
- if (this.glassContext && this.responsive !== false && this.options.length > 10) {
- if (this.parentEl) {
- this._renderSingleSelectValue();
- return;
- }
- }
- this._renderCheckbox();
- },
- _renderSingleSelectValue: function _renderSingleSelectValue() {
- this.selectedIndex = 0; // Default to the first one in the options list
- var selected = _.find(this.options, function (options) {
- return options.selected;
- });
- var value = selected ? selected.value : this.defaultValue;
- if (value) {
- for (var i = 0; i < this.options.length; i++) {
- if (value === this.options[i].value) {
- this.selectedIndex = i;
- break;
- }
- }
- }
- this._singleLineValue = new SingleLineValue({
- 'el': this.$el,
- 'name': this.name,
- 'label': this.label,
- 'value': this.options[this.selectedIndex].label,
- 'editCallback': this._showPropertyEditView.bind(this),
- 'id': this.id,
- 'onChange': this._onChange.bind(this),
- 'disabled': this.disabled,
- 'indent': this.indent || 0,
- 'readOnly': this.readOnly
- });
- this._singleLineValue.render();
- },
- _renderCheckbox: function _renderCheckbox() {
- var sHtml = dot.template(dropDownTemplate)({
- 'label': this.label,
- 'selected': this.checked,
- 'id': this.id,
- 'defaultValue': this.defaultValue,
- 'options': this.options,
- 'name': this.name,
- 'readOnly': this.readOnly || this.disabled,
- 'nestedUIControl': this.nestedUIControl,
- 'ariaLabel': this.ariaLabel,
- 'ariaDescribedby': this.ariaDescribedby,
- 'style': this.style,
- 'coachMark': this.coachMark
- });
- this.$el.append(sHtml);
- if (this.coachMark && _.isFunction(this.coachMark.render)) {
- this.coachMark.render({
- $el: this.$el.find('.coachMarkContainer'),
- glassContext: this.glassContext
- });
- }
- },
- getHTMLControl: function getHTMLControl() {
- if (!this._$select) {
- this._$select = $('.dropDown' + this.id);
- }
- return this._$select;
- },
- enable: function enable() {
- this.disabled = false;
- if (this._singleLineValue) {
- this._singleLineValue.enable();
- } else {
- DropDown.inherited('enable', this, arguments);
- }
- this.getPropertyNode().removeClass('disabled');
- },
- disable: function disable() {
- this.disabled = true;
- if (this._singleLineValue) {
- this._singleLineValue.disable();
- } else {
- DropDown.inherited('disable', this, arguments);
- }
- this.getPropertyNode().addClass('disabled');
- },
- _handleChange: function _handleChange(event) {
- this._onChange(this.name, $(event.currentTarget)[0].value);
- if (Utils.isIpad()) {
- // ipad dropdown do not close when selecting it, force it by tapping on the button again
- $(event.currentTarget).trigger('tap');
- }
- },
- getSelectedValue: function getSelectedValue() {
- return this.getHTMLControl().find('option:selected').attr('value');
- },
- _onPropertyEditViewClose: function _onPropertyEditViewClose(modifiedProperty) {
- if (!this._oPropertyEditView) {
- return;
- }
- if (!modifiedProperty && this._oPropertyEditView.contentView && this._oPropertyEditView.contentView.getModifiedProperties) {
- modifiedProperty = this._oPropertyEditView.contentView.getModifiedProperties();
- }
- this._oPropertyEditView.hide();
- this._oPropertyEditView = null;
- if (modifiedProperty) {
- var newValue = modifiedProperty[this.name];
- for (var i = 0; i < this.options.length; i = i + 1) {
- if (this.options[i].value === newValue) {
- this.selectedIndex = i;
- break;
- }
- }
- // Update the text with the new value
- this.getPropertyNode().find('.propertyValue').text(this.options[this.selectedIndex].label);
- this._onChange(this.name, newValue);
- this.processEllipses();
- }
- this.setFocus();
- },
- /**
- Property sheet is closing, make sure our PropertyEditView (if open) gets cloased and
- the new value is updated
- **/
- onClose: function onClose() {
- return DropDown.inherited('onClose', this, arguments).then(this._onPropertyEditViewClose.bind(this));
- },
- /**
- Build up radio buttons for show in the PropertyEditView
- **/
- _showPropertyEditView: function _showPropertyEditView() {
- var overlaySlideoutEl = $('<div></div>');
- this.parentEl.append(overlaySlideoutEl);
- var overlaySlideout = new Slideout({
- 'glassContext': this.glassContext,
- 'position': this.position,
- 'el': overlaySlideoutEl,
- 'content': this._getPropertyEditViewSpec(),
- 'width': this.parentEl.width(),
- 'enableTabLooping': true
- });
- overlaySlideout.render().then(function () {
- overlaySlideout.show();
- });
- this._oPropertyEditView = overlaySlideout;
- },
- _getPropertyEditViewSpec: function _getPropertyEditViewSpec() {
- var radioButtons = [];
- $.each(this.options, function (index, option) {
- radioButtons.push({
- 'label': option.label,
- 'value': option.value
- });
- }.bind(this));
- var spec = {
- 'module': '../ui/properties/PropertyUIControl',
- 'closeCallback': this._onPropertyEditViewClose.bind(this),
- 'setFocusCallback': function (propertyUIControl) {
- propertyUIControl.setFocus(this.name);
- }.bind(this),
- 'items': [{
- 'value': this.label,
- 'centerLabel': true,
- 'type': 'Banner',
- 'backButton': true,
- 'ariaLabel': this.ariaLabel || this.label
- }, {
- 'type': 'RadioButtonGroup',
- 'name': this.name,
- 'separator': true,
- 'ariaLabel': this.ariaLabel || this.label,
- 'value': this.options[this.selectedIndex].value,
- 'items': radioButtons
- }]
- };
- return spec;
- },
- setValue: function setValue(value, fireOnChange) {
- // Find the index of the given value.
- for (var i = 0; i < this.options.length; i = i + 1) {
- if (this.options[i].value === value) {
- this.selectedIndex = i;
- break;
- }
- }
- if (this._singleLineValue) {
- this._singleLineValue.setValue(this.options[i].label, false);
- } else {
- this.getHTMLControl().val(value);
- }
- if (fireOnChange) {
- this._onChange(this.name, value);
- }
- }
- });
- return DropDown;
- });
- //# sourceMappingURL=DropDown.js.map
- ;
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2017
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('baglass/core-client/js/core-client/ui/properties/Footer',['./PropertyContainerBaseClass', 'jquery', 'underscore'], function (PropertyContainerBaseClass, $, _) {
- 'use strict';
- var Footer = PropertyContainerBaseClass.extend({
- ellipses: true,
- /**
- @param options.el {node} - container DOM node
- @param options.items {array} - array of controls to render. Currently only been tested with buttons
- **/
- init: function init(options) {
- this.events = {};
- Footer.inherited('init', this, arguments);
- _.extend(this, options);
- },
- doRender: function doRender() {
- var $footer = $('<footer></footer>');
- this.$el.append($footer);
- this.initUIControl($footer[0]);
- return this._oPropertyUIControl.render();
- }
- });
- return Footer;
- });
- //# sourceMappingURL=Footer.js.map
- ;
- define('text!baglass/core-client/js/core-client/ui/properties/templates/HierarchicalList.html',[],function () { return '<div>\n\t<table class=\'listTable\'>\n\t\t{{for(var prop1 in it.data){ }}\n\t\t\t<tr>\n\t\t\t\t<td class="listParent">{{!it.data[prop1].defaultName}}<td>\n\t\t\t</tr>\t\n\t\t\t{{for(var prop2 in it.data[prop1]["children"]){ }}\n\t\t\t\t<tr>\n\t\t\t\t\t<td class="listChild">{{!it.data[prop1]["children"][prop2].defaultName}}</td>\n\t\t\t\t</tr>\n\t\t\t{{ } }}\n\t\t{{ } }}\n\t</table>\n</div>\t\n';});
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2017
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('baglass/core-client/js/core-client/ui/properties/HierarchicalList',['./BaseProperty', '../../utils/BidiUtil', 'text!./templates/HierarchicalList.html', 'jquery', 'doT', 'underscore'], function (BaseProperty, BidiUtil, listTemplate, $, dot, _) {
- 'use strict';
- var HierarchicalList = BaseProperty.extend({
- /**
- * Creates a property with a hierarchical list of parents children. Read-only
- * @param options.el {node} - parent element
- * @param options.data [string] - hierarchical data
- * example:
- *[{
- * "defaultName": "Parent1",
- * "children": [{
- * "defaultName": "Child1"
- * },
- * {
- * "defaultName": "Child2"
- * }
- * ]
- *},
- {
- * "defaultName": "Parent2,
- * "children": []
- *}]
- */
- init: function init(options) {
- if (!this.events) {
- this.events = {};
- }
- this.events['keydown .editable' + options.id] = '_handleEditKeydown';
- HierarchicalList.inherited('init', this, arguments);
- _.extend(this, options);
- },
- doRender: function doRender() {
- var sHtml = dot.template(listTemplate)({
- 'data': this.data
- });
- this.$el.append(sHtml);
- this._setAutoGrow();
- return;
- },
- _setAutoGrow: function _setAutoGrow() {
- var listTable = this.$el.find('table').get(0);
- if (listTable && listTable.scrollHeight > listTable.clientHeight) {
- $(listTable).addClass('capEditableHeight');
- listTable.style.height = listTable.scrollHeight + 'px';
- }
- }
- });
- return HierarchicalList;
- });
- //# sourceMappingURL=HierarchicalList.js.map
- ;
- define('text!baglass/core-client/js/core-client/ui/properties/templates/HintText.html',[],function () { return '<div class="flex property_{{=it.id}}">\n\t{{?it.svgIcon}}\n\t<div class="{{?it.name}}i_{{=it.name}}{{?}}" role="img" title="{{=it.label}}">\n\t\t<svg class="svgIcon{{?it.svgIconClass}} {{=it.svgIconClass}}{{?}}" role="presentation">\n\t\t\t<title>{{=it.label}}</title>\n\t\t\t<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#{{=it.svgIcon}}"></use>\n\t\t</svg>\n\t</div>\n\t{{?}}\n\t<div class="l_{{=it.name}} hintText">{{=it.label}}</div>\n</div>';});
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2017
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('baglass/core-client/js/core-client/ui/properties/HintText',['./BaseProperty', 'text!./templates/HintText.html', 'doT', 'underscore'], function (BaseProperty, HintTextTemplate, dot, _) {
- 'use strict';
- var HintText = BaseProperty.extend({
- ellipses: true,
- /**
- @param options.el {node} - container DOM node
- @param options.label {string} - the text to display
- @param options.visibility {string} - the css visibility style, default to visible
- **/
- init: function init(options) {
- this.visibility = 'visible';
- HintText.inherited('init', this, arguments);
- _.extend(this, options);
- },
- doRender: function doRender() {
- var sHtml = dot.template(HintTextTemplate)({
- 'label': this.label,
- 'id': this.id,
- 'name': this.name,
- 'svgIcon': this.svgIcon,
- 'svgIconClass': this.svgIconClass ? this.svgIconClass : ''
- });
- this.$el.append(sHtml);
- this.setVisibility(this.visibility);
- this.$el.append(this._hintTextNode);
- },
- setVisibility: function setVisibility(visibility) {
- this.getPropertyNode().css('visibility', visibility);
- }
- });
- return HintText;
- });
- //# sourceMappingURL=HintText.js.map
- ;
- define('text!baglass/core-client/js/core-client/ui/properties/templates/RadioButtonGroup.html',[],function () { return '<ul class="radioGroup radiogroup_{{=it.id}}" role="radiogroup"{{?it.ariaLabel}} aria-label="{{=it.ariaLabel}}"{{?}}>\n{{~it.items : item:index}}\n\t<li class="propertyRow clickable radioButton property_{{=it.id}}{{?it.readOnly}} disabled{{?}}{{?item.value === it.value}} checked{{?}}" role="radio" aria-labelledby="{{=it.id}}radioButton{{=index}}"{{?item.value === it.value}} aria-checked="true" tabindex="0"{{??}} aria-checked="false"{{?it.selectOnNavigation === false}} tabindex="0"{{??}} tabindex="-1"{{?}}{{?}} aria-disabled="{{?it.readOnly}}true{{??}}false{{?}}" data-value="{{=item.value}}">\n\t\t{{? it.controlOnLeft !== true}}\n\t\t\t<div id="{{=it.id}}radioButton{{=index}}" class="radioButtonLabel radioLeft l_{{=it.name}}{{=index}}">{{=item.label}}</div>\n\t\t{{?}}\n\t\t<div class="roundButton roundButton{{=it.id}} circle {{? it.controlOnLeft === true}}radioLeft{{??}}radioRight{{?}}">\n\t\t\t<svg>\n\t\t\t\t<circle class="outer" cx="8" cy="8" r="7"/>\n\t\t\t\t<circle class="radioBtn inner" cx="8" cy="8" r="5"/>\n\t\t\t</svg>\n\t\t</div>\n\t\t{{? it.controlOnLeft === true}}\n\t\t\t<div id="{{=it.id}}radioButton{{=index}}" class="radioButtonLabel l_{{=it.name}}{{=index}} controlOnLeft">{{=item.label}}</div>\n\t\t{{?}}\n\t</li>\n\t{{? it.separator}}\n\t\t{{? it.length !== index}}\n\t\t\t<li class="separator"></li>\n\t\t{{?}}\n\t{{?}}\n{{~}}\n</ul>\n';});
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2017
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('baglass/core-client/js/core-client/ui/properties/RadioButtonGroup',['./BaseProperty', 'text!./templates/RadioButtonGroup.html', 'jquery', 'doT', 'underscore', '../KeyCodes'], function (BaseProperty, radioButtonTemplate, $, dot, _, KeyCodes) {
- 'use strict';
- var RadioButton = BaseProperty.extend({
- /**
- * Creates a property with round checkbox.
- * @param options.id {string} - property id
- * @param options.el {node} - parent element
- * @param options.name {string} - property name
- * @param options.separator {boolean} - wether to draw a horizontal separator between each radio button
- * @param options.value {string} - current value of the radio group
- * @param options.items {array} - array of radio buttons
- * @param options.items.label {string} - property label
- * @param options.items.value {string} - value for the radioButton
- * @param options.onChange {function} - callback to be notified as soon as the change happens
- * @param options.controlOnLeft {boolean} - default to false, if true the control will be on the left
- * @param options.indent {int} - default 0, will indent by options.indent * 10px
- * @param options.readOnly {boolean} - optional, default is false. If true, the UI will be rendered in a read-only mode
- * @param options.ariaLabel {string} - radio button group name for screen reader
- * @param options.selectOnNavigation {boolen} - should moving between the radio button automatically select them
- */
- defaultValue: null,
- init: function init(options) {
- this.events = {};
- this.events['primaryaction .property_' + options.id] = '_handleClick';
- RadioButton.inherited('init', this, arguments);
- _.extend(this, options);
- this.defaultValue = this.value;
- // Make sure we default selectOnNavigation to true
- if (this.selectOnNavigation !== false) {
- this.selectOnNavigation = true;
- }
- },
- doRender: function doRender() {
- var sHtml = dot.template(radioButtonTemplate)({
- 'id': this.id,
- 'value': this.value,
- 'name': this.name,
- 'items': this.items.map(function (item) {
- item.label = _.escape(item.label);
- return item;
- }),
- 'separator': this.separator,
- 'length': this.items.length - 1,
- 'controlOnLeft': this.controlOnLeft,
- 'readOnly': this.readOnly,
- 'ariaLabel': this.ariaLabel,
- 'selectOnNavigation': this.selectOnNavigation
- });
- this.$el.append(sHtml);
- this._postRender();
- return;
- },
- /**
- @override - Property UI control is a little different, each of the li elements has the property_<id> class. Override it so that the getPropertyNode
- function returns the ul element
- **/
- getPropertyNode: function getPropertyNode() {
- if (!this._propertyNode) {
- this._propertyNode = this.$el.find('.radiogroup_' + this.id);
- }
- if (this._propertyNode.length === 0) {
- this._propertyNode = this.$el;
- }
- return this._propertyNode;
- },
- _postRender: function _postRender() {
- this._$radioGroupNode = this.$el.find('ul.radiogroup_' + this.id);
- this._$radioGroupNode.find('li.radioButton').keydown(function (evt) {
- this._handleKeyDown(evt);
- }.bind(this));
- if (this.disabled) {
- this.disable();
- }
- },
- _selectRow: function _selectRow(rowNode) {
- var $rowNode = $(rowNode);
- this._uncheckCurrentSelection();
- $rowNode.attr('aria-checked', 'true');
- $rowNode.addClass('checked');
- $rowNode.attr('tabindex', '0');
- var value = $rowNode.data('value');
- this._onChange(this.name, value);
- },
- _handleClick: function _handleClick(event) {
- this._selectRow(event.currentTarget);
- event.stopPropagation();
- return false;
- },
- _hasValueChanged: function _hasValueChanged(propertyValue) {
- if (propertyValue === this.checked) {
- return false;
- }
- return true;
- },
- enable: function enable() {
- if (this.readOnly) {
- return;
- }
- this._setDisabled(false);
- },
- disable: function disable() {
- this._setDisabled(true);
- },
- _setDisabled: function _setDisabled(disabled) {
- this._$radioGroupNode.find('li.radioButton').each(function (index, row) {
- var $row = $(row);
- if (disabled) {
- $row.addClass('disabled');
- $row.attr('aria-disabled', 'true');
- } else {
- $row.removeClass('disabled');
- $row.attr('aria-disabled', 'false');
- }
- });
- },
- _uncheckCurrentSelection: function _uncheckCurrentSelection() {
- var $currentFocusedRow = this._$radioGroupNode.find('li.checked');
- $currentFocusedRow.removeClass('checked');
- $currentFocusedRow.attr('aria-checked', 'false');
- if (this.selectOnNavigation) {
- $currentFocusedRow.attr('tabindex', '-1');
- }
- },
- getValue: function getValue() {
- var $currentFocusedRow = this._$radioGroupNode.find('li.checked');
- return $currentFocusedRow.data('value');
- },
- setValue: function setValue(value, fireOnChange) {
- this._uncheckCurrentSelection();
- var givenValueNode = this._$radioGroupNode.find('li[data-value=' + value + ']')[0];
- value = givenValueNode ? value : null;
- if (givenValueNode) {
- this._selectRow(givenValueNode);
- }
- if (fireOnChange) {
- this._onChange(this.name, value);
- }
- },
- reset: function reset() {
- var $defaultValueNode = this._$radioGroupNode.find('li[data-value="' + this.defaultValue + '"]');
- this._selectRow($defaultValueNode);
- },
- _handleKeyDown: function _handleKeyDown(evt) {
- if (evt.keyCode === KeyCodes.UP_ARROW || evt.keyCode === KeyCodes.DOWN_ARROW || evt.keyCode === KeyCodes.LEFT_ARROW || evt.keyCode === KeyCodes.RIGHT_ARROW) {
- var currentFocusedRow = this._$radioGroupNode.find('li.checked');
- if (!currentFocusedRow.length) {
- currentFocusedRow = $(evt.currentTarget);
- }
- var $nextNode;
- if (evt.keyCode === KeyCodes.UP_ARROW || evt.keyCode === KeyCodes.LEFT_ARROW) {
- $nextNode = currentFocusedRow.prevAll('li.radioButton').first();
- if ($nextNode.length === 0) {
- $nextNode = currentFocusedRow.nextAll('li.radioButton').last();
- }
- } else {
- $nextNode = currentFocusedRow.nextAll('li.radioButton').first();
- if ($nextNode.length === 0) {
- $nextNode = currentFocusedRow.prevAll('li.radioButton').last();
- }
- }
- if (this.selectOnNavigation) {
- this._selectRow($nextNode);
- }
- $nextNode.focus();
- evt.preventDefault();
- return false;
- }
- }
- });
- return RadioButton;
- });
- //# sourceMappingURL=RadioButtonGroup.js.map
- ;
- define('text!baglass/core-client/js/core-client/ui/properties/templates/HorizontalRadioButtonGroup.html',[],function () { return '/**\n * Licensed Materials - Property of IBM\n * IBM Cognos Products: BI Content Explorer \n * (C) Copyright IBM Corp. 2015, 2017\n * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.\n */\n<div class="propertyRow propertyRowLineHeight{{?it.readOnly}} disabled{{?}} hradioButtonGroup_{{=it.id}}{{?it.label}} flex{{?}}">\n\t{{? it.label}}\n\t\t<div class="propertyName singleLine label_{{=it.name}}">{{=it.label}}</div>\n\t{{?}}\n\n\t<div class="hradioButtonGroup{{?!it.label}} controlOnLeft flex{{?}}">\n\t\t<ul class="radioGroup radiogroup_{{=it.id}}{{?!it.label}} flex{{?}}" role="radiogroup"{{?it.ariaLabel}} aria-label="{{=it.ariaLabel}}"{{?}}>\n\t\t\t{{~it.items : item:index}}\n\t\t\t\t<li class="hradioButton radioButton flex property_{{=it.id}} hradioButton{{=it.id}}{{?!it.label}} leftAlign{{?}}{{?item.value===it.value}} checked{{?}}" role="radio" aria-labelledby="{{=it.id}}radioButton{{=index}}"{{?item.value === it.value}} aria-checked="true" tabindex="0"{{??}} aria-checked="false" tabindex="-1"{{?}}aria-disabled="{{?it.readOnly}}true{{??}}false{{?}}" data-value="{{=item.value}}">\n\t\t\t\t\t<div class="rbutton roundButton">\n\t\t\t\t\t\t<svg>\n\t\t\t\t\t\t\t<circle class="outer" cx="8" cy="8" r="7"/>\n\t\t\t\t\t\t\t<circle class="radioBtn inner" cx="8" cy="8" r="5"/> \n\t\t\t\t\t\t</svg>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div id="{{=it.id}}radioButton{{=index}}" class="rlabel">{{=item.label}}</div>\n\t\t\t\t</li>\n\t\t\t{{~}}\n\t\t</ul>\n\t</div>\n</div>\n';});
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2015, 2017
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define('baglass/core-client/js/core-client/ui/properties/HorizontalRadioButtonGroup',['./RadioButtonGroup', 'text!./templates/HorizontalRadioButtonGroup.html', 'jquery', 'doT'], function (RadioButtonGroup, template, $, dot) {
- 'use strict';
- var HorizontalRadioButtonGroup = RadioButtonGroup.extend({
- /**
- * Creates a property with radio buttons displayed horizontally.
- *
- * @param options.id {string} - property id
- * @param options.el {node} - parent element
- * @param options.name {string} - property name
- * @param options.value {string} - current value of the radio group
- * @param options.items {array} - array of radio buttons
- * @param options.items.label {string} - radio option label
- * @param options.items.value {string} - value for the radioButton
- * @param options.onChange {function} - callback to be notified as soon as the change happens
- * @param options.indent {int} - default 0, will indent by options.indent * 10px
- * @param options.readOnly {boolean} - optional, default is false. If true, the UI will be rendered in a read-only mode
- * @param options.label - radio group label
- * @param options.ariaLabel - {string} not optional if options.label is missing. Use for accessible purposes.
- */
- init: function init() {
- HorizontalRadioButtonGroup.inherited('init', this, arguments);
- },
- doRender: function doRender() {
- var sHtml = dot.template(template)({
- 'id': this.id,
- 'label': this.label,
- 'value': this.value,
- 'name': this.name,
- 'items': this.items,
- 'readOnly': this.readOnly,
- 'ariaLabel': this.ariaLabel
- });
- this.$el.append(sHtml);
- this._postRender();
- return;
- },
- enable: function enable() {
- if (this.readOnly) {
- return;
- }
- this._setDisabled(false);
- },
- disable: function disable() {
- this._setDisabled(true);
- },
- _setDisabled: function _setDisabled(disabled) {
- var $hRBGroup = this.$el.find('.hradioButtonGroup_' + this.id);
- if (disabled) {
- $hRBGroup.addClass('disabled');
- } else {
- $hRBGroup.removeClass('disabled');
- }
- HorizontalRadioButtonGroup.inherited('_setDisabled', this, arguments);
- }
- });
- return HorizontalRadioButtonGroup;
- });
- //# sourceMappingURL=HorizontalRadioButtonGroup.js.map
- ;
- define('text!baglass/core-client/js/core-client/ui/properties/templates/IconCollection.html',[],function () { return '<div class="{{? !it.nestedUIControl}}propertyRow{{?}} property_{{=it.id}}{{?it.readOnly}} disabled{{?}}">\n\t<div class="iconCollectionContainer{{?it.showText}} showText{{?}}" {{?it.ariaLabel}} aria-label="{{=it.ariaLabel}}"{{?}}>\n\t{{~it.items :item:index}}\n\t\t{{?item.image}}\n\t\t\t<div class=\'itemOption itemImage\' role="button" data-name="{{=item.name}}" {{?it.readOnly}}tabindex="-1"{{??}}tabindex="0"{{?}}\n\t\t\t\t{{?item.ariaLabel}} aria-label="{{=item.ariaLabel}}"{{?}} title="{{=item.label}}">\n\t\t\t\t<div class="itemThumbnail"\n\t\t\t\t\talt="{{=item.image.altText}}"\n\t\t\t\t\trole="button"\n\t\t\t\t\taria-label="{{=item.image.altText}}"\n\t\t\t\t\ttitle="{{=item.image.altText}}"\n\t\t\t\t\tstyle="background-image: url(\'{{=item.image.imageLink}}\')">\n\t\t\t\t</div>\n\t\t{{??}}\n\t\t\t<div class=\'itemOption\' role="button" data-name="{{=item.name}}" {{?it.readOnly}}tabindex="-1"{{??}}tabindex="0"{{?}}\n\t\t\t\t{{?item.ariaLabel}} aria-label="{{=item.ariaLabel}}"{{?}} title="{{=item.label}}">\n\t\t\t{{?item.svg}}{{=item.svg}}{{?}}\n\t\t\t{{?it.showText && item.label}}<div class="itemLabel">{{=item.label}}</div>{{?}}\n\t\t{{?}}\n\t\t</div>\n\t{{~}}\n\t</div>\n</div>\n';});
- /*
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: Content Explorer
- * (C) Copyright IBM Corp. 2017
- *
- * US Government Users Restricted Rights - Use, duplication or disclosure
- * restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define('baglass/core-client/js/core-client/ui/properties/IconCollection',['jquery', 'doT', 'underscore', './BaseProperty', 'text!./templates/IconCollection.html', '../../utils/Utils', '../../utils/dom-utils', '../KeyCodes', 'hammerjs', 'jquery.hammer'], function ($, dot, _, BaseProperty, IconCollectionTemplate, Utils, DomUtils, KeyCodes) {
- 'use strict';
- var IconCollection = BaseProperty.extend({
- /**
- * Creates a property with the given list of icons that perform an action on
- * a mouse click or iPad tap events as well as on drag'n'drop events (with mouse or touch)
- * and on key down event (space or enter) when an item is focuse.
- *
- * @param options.id {string} - property id
- * @param options.el {node} - parent element
- * @param options.label {string} - property label
- * @param options.items {array} - array of icons
- * @param options.items.label {string} - icon label
- * @param options.items.name {string} - icon name
- * @param options.items.icon {string} - name of the SVG in the SVG bundle
- * @param options.items.svg {string} - the direct SVG to display
- * @param options.items.content {object} - an object that contains more information to use when clicking/dragging an item
- * @param options.readOnly {boolean} - optional, default is false. If true, the UI will be rendered in a read-only mode
- * @param options.nestedUIControl {boolean} - optional, default is false. Set to true if this UI Widget is being rendered by another UI Widget
- * @param options.ariaLabel {string} - optional, if you want to override the default label for screen readers
- * @param options.onItemClick {function} - The click/tap/key down handler will call this function to perform an action
- * @param options.onItemStartDrag {fuction} - The mousedown/drag events will call this function to perform an action
- */
- init: function init(options) {
- this.events = {};
- this.events['clicktap .property_' + options.id + ' .itemOption'] = '_onItemClick';
- this.events['mousedown .property_' + options.id + ' .itemOption'] = '_onItemMouseDownStartDrag';
- this.events['keydown .property_' + options.id + ' .itemOption'] = '_onItemKeyDown';
- this.nestedUIControl = false;
- IconCollection.inherited('init', this, arguments);
- _.extend(this, options);
- },
- doRender: function doRender() {
- var sHtml = dot.template(IconCollectionTemplate)({
- 'items': this.items,
- 'id': this.id,
- 'readOnly': this.readOnly,
- 'ariaLabel': this.ariaLabel || this.label,
- 'nestedUIControl': this.nestedUIControl,
- 'showText': this.showText
- });
- this.$el.append(sHtml);
- this.$el.find('.property_' + this.id + ' .itemOption').each(function (index, element) {
- if (this.items[index].icon) {
- Utils.setIcon($(element), this.items[index].icon, this.items[index].label, this.items[index].ariaLabel);
- }
- $(element).hammer();
- $(element).on('hold', this._onItemHoldAndStartDrag.bind(this));
- }.bind(this));
- },
- _getEntry: function _getEntry(target) {
- var $target = $(target).closest('.itemOption');
- var targetName = $target.data('name');
- var targetItem = _.find(this.items, function (item) {
- return item.name === targetName;
- });
- return targetItem.content;
- },
- _onItemKeyDown: function _onItemKeyDown(event) {
- if (event.keyCode === KeyCodes.ENTER || event.keyCode === KeyCodes.SPACE) {
- this._onItemClick(event);
- }
- },
- _onItemClick: function _onItemClick(event) {
- var currentTarget = event.currentTarget;
- if ($.data(currentTarget, '_clickEventReceived') !== true) {
- // Guard against adding two widgets at once during a double click.
- $.data(currentTarget, '_clickEventReceived', true);
- setTimeout(function () {
- $.data(currentTarget, '_clickEventReceived', false);
- }, 500);
- if (this.options.onItemClick) {
- var entry = this._getEntry(event.target);
- this.options.onItemClick(entry, event);
- if (event && event.gesture) {
- event.gesture.preventDefault();
- }
- }
- if (this.options.autoClose) {
- $('[data-toggle="dropdown"]').parent().removeClass('open');
- }
- }
- },
- _onStartDrag: function _onStartDrag(event) {
- if (this.options.onItemStartDrag) {
- if (event.preventDefault) {
- // prevent default drag behavior
- event.preventDefault();
- }
- var entry = this._getEntry(event.target);
- this.options.onItemStartDrag(entry, event);
- }
- },
- _onItemHoldAndStartDrag: function _onItemHoldAndStartDrag(event) {
- event.showAvatarImmediately = true;
- this._onStartDrag(event);
- },
- _onItemMouseDownStartDrag: function _onItemMouseDownStartDrag(event) {
- this._onStartDrag(event);
- }
- });
- return IconCollection;
- });
- //# sourceMappingURL=IconCollection.js.map
- ;
- define('text!baglass/core-client/js/core-client/ui/properties/templates/IconPicker.html',[],function () { return '<div class="{{? !it.nestedUIControl}}propertyRow{{?}} property_{{=it.id}}{{?it.readOnly}} disabled{{?}}">\n\t<div id="label_{{=it.id}}" class="singleLine iconPikcerLabel {{?it.name }} {{=it.name}}{{?}}">{{=it.label}}</div>\n\t<div class=\'iconPickerContainer\' {{?it.ariaLabel}} aria-label="{{=it.ariaLabel}}"{{?}} role="radiogroup">\n\t{{~it.items :item:index}}\n\t\t<div class =\'iconOption{{?it.values && it.values.indexOf(item.name)>-1}} selected{{?}}\' role="radio" aria-checked="{{?it.values && it.values.indexOf(item.name)>-1}}true{{??}}false{{?}}" data-value="{{=item.value}}" data-name="{{=item.name}}">{{?it.showLabels}}<div class=\'iconOptionLabel{{?it.name }}_{{=it.name}}{{?}}\'>{{=item.label}}</div>{{?}}</div>\n\t{{~}}\n\t</div>\n</div>\n';});
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2016, 2017
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('baglass/core-client/js/core-client/ui/properties/IconPicker',['./BaseProperty', 'text!./templates/IconPicker.html', 'jquery', 'doT', 'underscore', '../../utils/Utils', '../KeyCodes'], function (BaseProperty, IconPickerTemplate, $, dot, _, Utils, KeyCodes) {
- 'use strict';
- var IconPicker = BaseProperty.extend({
- /**
- * Creates a property with icon picker.
- * @param options.id {string} - property id
- * @param options.el {node} - parent element
- * @param options.name {string} - property name
- * @param options.label {string} - property label
- * @param options.items {array} - array of icons
- * @param options.items.name {string} - icon name
- * @param options.items.label {string} - icon label
- * @param options.items.value {string} - value for the icon to show. It can be svg or webfont. Svg passed in should be one color that they can be fillable from the root.
- * @param options.onChange {function} - callback to be notified as soon as the change happens
- * @param options.readOnly {boolean} - optional, default is false. If true, the UI will be rendered in a read-only mode
- * @param options.nestedUIControl {boolean} - optional, default is false. Set to true if this UI Widget is being rendered by another UI Widget
- * @param options.ariaLabel {string} - optional, if you want to override the default label for screen readers
- * @param options.values {array|string} - optional, an array or a string of the initial selected name(s)
- * @param options.useToggling {boolean} - optional, default is false, selecting a selected icon does not unselect it. If true, selecting a selected icon unselects it.
- * @param options.allowMultiple {boolean} - optional, default is false, only one icon is allowed to be selected. If true, the UI allows many icons to be selected.
- * @param options.showLabels {boolean} - optional, default is false, show labels under each icon.
- */
- init: function init(options) {
- this.events = {};
- this.events['clicktap .property_' + options.id + ' .iconOption'] = '_handleClick';
- this.events['keydown .property_' + options.id + ' .iconOption'] = '_handleKeyDown';
- this.nestedUIControl = false;
- this.useToggling = false;
- this.allowMultiple = false;
- this.showLabels = false;
- IconPicker.inherited('init', this, arguments);
- _.extend(this, options);
- if (_.isString(options.values)) {
- this.values = [options.values];
- }
- },
- doRender: function doRender() {
- var sHtml = dot.template(IconPickerTemplate)({
- 'name': this.name,
- 'label': this.label,
- 'items': this.items,
- 'id': this.id,
- 'readOnly': this.readOnly,
- 'values': this.values,
- 'ariaLabel': this.ariaLabel,
- 'nestedUIControl': this.nestedUIControl,
- 'showLabels': this.showLabels
- });
- this.$el.append(sHtml);
- var that = this;
- this.$el.find('.property_' + this.id + ' .iconOption').each(function (index) {
- Utils.setIcon($(this), that.items[index].value, that.items[index].label, that.items[index].label);
- $(this).find('.svgIcon').attr('tabindex', this.readOnly ? '-1' : '0');
- });
- },
- getSelectedOptions: function getSelectedOptions() {
- var selectedOptions = [];
- this.$el.find('.property_' + this.id + ' .iconOption.selected').each(function () {
- var selectedOption = {
- value: $(this).data('value'),
- name: $(this).data('name')
- };
- selectedOptions.push(selectedOption);
- });
- return selectedOptions;
- },
- _handleClick: function _handleClick(event) {
- this._selectNode(event.target);
- },
- _handleKeyDown: function _handleKeyDown(event) {
- if (event.keyCode === KeyCodes.ENTER || event.keyCode === KeyCodes.SPACE) {
- this._selectNode(event.target);
- }
- },
- _selectNode: function _selectNode(target) {
- var $target = $(target).closest('.iconOption');
- if ((!this.useToggling || !$target.hasClass('selected')) && !this.allowMultiple) {
- this._uncheckCurrentSelection();
- }
- if (this.useToggling || !this.allowMultiple || !$target.hasClass('selected')) {
- this._updateSelectedNode($target);
- }
- this._onChange(this.name, this.getSelectedOptions());
- },
- _updateSelectedNode: function _updateSelectedNode($node) {
- if ($node.hasClass('selected')) {
- $node.attr('aria-checked', 'false').removeClass('selected');
- } else {
- $node.attr('aria-checked', 'true').addClass('selected');
- }
- },
- _uncheckCurrentSelection: function _uncheckCurrentSelection() {
- this.$el.find('.property_' + this.id + ' .iconOption.selected').removeClass('selected').attr({
- 'aria-checked': 'false'
- });
- }
- });
- return IconPicker;
- });
- //# sourceMappingURL=IconPicker.js.map
- ;
- define('text!baglass/core-client/js/core-client/ui/properties/templates/InputLabel.html',[],function () { return '<div class="propertyRow property_{{=it.id}}{{? it.multiline == true}} multiline{{??}} flex{{?}}">\n\t<div class="propertyName {{? it.multiline != true}} singleLine{{?}} l_{{=it.name}}">\n\t\t<div id="label_{{=it.id}}" class="propertyNameText" title="{{=it.label}}"{{?it.editable}}for="control_{{=it.name}}_{{=it.id}}"{{?}}>{{=it.label}}</div>\n\t</div>\n\t<div class="{{? it.multiline != true}}rightAlign{{?}} inputContainer" style="overflow:hidden;">\n\t\t<div id="value_{{=it.id}}" class="propertyValue ellipses textSelectable {{? it.editCallback === true}}secondaryEdit{{=it.id}} clickable{{?}} v_{{=it.name}}"{{?it.direction}} dir="{{=it.direction}}"{{?}}>\n\t\t\t<input id="control_{{=it.name}}_{{=it.id}}"\n\t\t\t\ttype="{{=it.inputType}}"\n\t\t\t\tclass="{{? it.inputType != \'password\'}}{{? it.ellipses}}ellipses{{?}}{{?}} blueText editable{{=it.id}} newUXLook {{=it.inputClass}}"\n\t\t\t\t{{? it.inputStyles}} style="{{=it.inputStyles}}"{{?}}\n\t\t\t\t{{?it.placeHolderText != \'\'}}placeholder="{{=it.placeHolderText}}"{{?}}value="{{=_.escape(it.value)}}"{{?it.direction}}\n\t\t\t\tdir="{{=it.direction}}"{{?}}{{?it.ariaLabel}}\n\t\t\t\taria-label="{{=it.ariaLabel}}"{{?}}\n\t\t\t\t{{? !it.readOnly}}tabindex="0" {{??}} readOnly{{?}}>\n\t\t\t</input>\n\t\t</div>\n\t</div>\n</div>\n';});
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2017, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('baglass/core-client/js/core-client/ui/properties/InputLabel',['./Input', 'text!./templates/InputLabel.html', 'jquery', 'doT', '../../utils/BidiUtil', 'underscore'], function (Input, inputLabelTemplate, $, dot, BidiUtil, _) {
- 'use strict';
- /**
- * An extension of Label and provides a label and input.
- * For an example see PropertiesGeneralTab -> Advanced -> sharePath.
- */
- var InputLabel = Input.extend({
- /**
- * Creates an input control with a label. Same options as the parent Input, but with the addition of:
- * @param options.label {string}- the label to use
- */
- init: function init(options) {
- void options;
- InputLabel.inherited('init', this, arguments);
- this.ellipses = false;
- },
- /**
- * return the html template
- */
- getHTMLTemplate: function getHTMLTemplate() {
- return inputLabelTemplate;
- },
- /**
- * return the options for the html template
- */
- getTemplateOptions: function getTemplateOptions() {
- var options = InputLabel.inherited('getTemplateOptions', this, arguments);
- _.extend(options, { label: this.label, multiline: this.multiline });
- return options;
- }
- });
- return InputLabel;
- });
- //# sourceMappingURL=InputLabel.js.map
- ;
- define('text!baglass/core-client/js/core-client/ui/properties/templates/NewPalette.html',[],function () { return '\n<div class="ba-theme-default {{?it.id}}property_{{=it.id}}{{?}} paletteColors {{? it.selected }} selected {{?}} {{?it.readOnly}}readOnly{{?}}" aria-label="{{?it.ariaLabel}}{{!it.ariaLabel}} {{?}}{{!it.content.label}}" tabindex="0" data-id="{{=it.palette.id}}"{{?it.readOnly}} role="presentation"{{??}} role="button" aria-pressed= "{{?it.selected}}true{{??}}false{{?}}"{{?}}>\n\t<div class="paletteTop">\n\t\t<div class="paletteName ellipses">{{!it.content.label}}</div>\n\t\t<div class="paletteMenu" aria-label="{{=it.showMorePalette}}" title="{{=it.showMorePalette}}"></div>\n\t</div>\n\t<div class="paletteContent flex">\n\t{{let fillsArray = it.reverse === true ? it.content.fills.slice().reverse() : it.content.fills;}}\n\t{{?it.content.fillType === "continuous"}}\n<div class="gradientPalette" style=\'background:linear-gradient(to right, {{~fillsArray :value :index}}{{=value.fill}}{{?index < fillsArray.length-1}},{{?}}{{~}})\'></div>\n\t{{??}}\n\t\t{{~fillsArray :value :index}}\n\t\t\t{{?it.content.fillType === "simple"}}\n\t\t\t\t{{?value}}\n\t\t\t\t\t{{?value.toLowerCase()===\'transparent\'}}\n\t\t\t\t\t\t<div class="paletteOption" data-index={{=index}} data-value="{{=value}}">\n\t\t\t\t\t\t\t<div class=\'transparentIndicator\'></div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t{{??}}\n\t\t\t\t\t\t<div class="paletteOption {{? index >= it.maxColors }} hidden {{?}}" aria-hidden="{{? index >= it.maxColors }} true {{??}} false{{?}}"data-index={{=index}} data-value="{{=value}}" style=\'background:{{=value}}\'></div>\n\t\t\t\t\t{{?}}\n\t\t\t\t{{?}}\n\t\t\t{{??it.content.fillType==="ImgPath"}}\n\t\t\t\t<div class="paletteOption {{? index >= it.maxColors }} hidden {{?}}" aria-hidden="{{? index >= it.maxColors }} true {{??}} false{{?}}"data-index={{=index}} data-value="{{=value.pattern}}" style="background: url({{=it.content.path}}{{=value.pattern}}{{=it.content.fileType||it.defaultImageType}});"></div>\n\t\t\t{{?}}\n\t\t{{~}}\n\t\t {{? fillsArray.length > it.maxColors}}\n\t\t <div class="paletteBottom">\n\t\t\t<a class="showColorsButton showMoreColors" tabindex="0" aria-label="{{=it.showMoreColors}}">{{=it.showMoreColors}}</a>\n\t\t\t<a class="showColorsButton showLessColors hidden" tabindex="0" aria-hidden=true aria-label="{{=it.showLessColors}}">{{=it.showLessColors}}</a>\n\t\t</div>\n\t\t{{?}}\n\t{{?}}\n\t</div>\n</div>\n';});
- define('text!baglass/core-client/js/core-client/ui/properties/templates/SectionLabel.html',[],function () { return '<div class="propertyRow wrap property_{{=it.id}} sectionLabel">{{=it.label}}</div>\n';});
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2017
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('baglass/core-client/js/core-client/ui/properties/SectionLabel',['./BaseProperty', 'text!./templates/SectionLabel.html', 'underscore', 'doT'], function (BaseProperty, sectionLabelTemplate, _, dot) {
- 'use strict';
- var SectionLabel = BaseProperty.extend({
- /**
- * @param options.indent {int} - default 0, will indent by options.indent * 10px
- */
- init: function init(spec) {
- SectionLabel.inherited('init', this, arguments);
- _.extend(this, spec);
- },
- doRender: function doRender() {
- var sHtml = dot.template(sectionLabelTemplate)({
- 'label': this.label,
- 'id': this.id
- });
- this.$el.append(sHtml);
- return;
- },
- processStaticValidation: function processStaticValidation() {
- // Empty function to override BaseProperty processStaticValidation. Hide the icons from this UI element
- }
- });
- return SectionLabel;
- });
- //# sourceMappingURL=SectionLabel.js.map
- ;
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2018
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define('baglass/core-client/js/core-client/ui/ContextMenuButton',['react', 'prop-types', 'ca-ui-toolkit', './KeyCodes'], function (React, PropTypes, Toolkit, KeyCodes) {
- var Component = React.Component;
- var ContextMenu = Toolkit.ContextMenu;
- /**
- * Creates a button that will render a context menu when clicked
- * Uses the toolkit.ContextMenu
- * More doc : https://pages.github.ibm.com/BusinessAnalytics/ba-ui-toolkit/#/components/context-menu
- *
- * @param options.menuItems {array} - array of the items you want to render
- * @param options.menuItems.id {string} - item id
- * @param options.menuItems.label {string} - item label used to display
- * @param options.menuItems.value {string} - item value
- * @param options.id {string} - View id
- * @param options.placement {string} - Where the Context Menu will be positioned visually off of the triggerNode
- * @param options.onChange {string} - Function that is called when an item is selected
- * @param options.domNodeToAttachTo {function} - DOM node that the Context Menu will be attached to in the DOM
- * @param options.ariaLabel [String] - Label to use on the context menu button ...
- */
- var ContextMenuButton = function (_Component) {
- _inherits(ContextMenuButton, _Component);
- function ContextMenuButton(props) {
- _classCallCheck(this, ContextMenuButton);
- var _this = _possibleConstructorReturn(this, (ContextMenuButton.__proto__ || Object.getPrototypeOf(ContextMenuButton)).call(this, props));
- _this.state = {
- open: false
- };
- _this.menuItems = props.menuItems;
- _this.placement = props.placement;
- _this.domNodeToAttachTo = props.domNodeToAttachTo;
- _this.id = props.id;
- return _this;
- }
- _createClass(ContextMenuButton, [{
- key: 'openMenu',
- value: function openMenu(e) {
- e.stopPropagation();
- this.setState({ open: !this.state.open });
- }
- }, {
- key: 'onChange',
- value: function onChange(name, value) {
- this.setState({ open: !this.state.open });
- this.props.onChange(name, value);
- }
- }, {
- key: 'onKeyPressed',
- value: function onKeyPressed(e) {
- e.stopPropagation();
- if (e.keyCode === KeyCodes.ENTER || e.keyCode === KeyCodes.SPACE) {
- this.setState({ open: !this.state.open });
- }
- }
- }, {
- key: '_closeMenu',
- value: function _closeMenu() {
- this.setState({ open: !this.state.open });
- }
- }, {
- key: 'render',
- value: function render() {
- var open = this.state.open;
- return React.createElement(
- 'div',
- {
- className: 'contextMenuButton ' + this.id, tabIndex: '0',
- onClick: this.openMenu.bind(this), onKeyDown: this.onKeyPressed.bind(this),
- 'aria-label': this.props.ariaLabel, role: 'button'
- },
- React.createElement(
- 'svg',
- { className: 'svgIcon' },
- React.createElement('use', { xlinkHref: '#common-menuoverflow' })
- ),
- open && React.createElement(
- ContextMenu,
- {
- theme: true,
- placement: this.placement,
- onClose: this._closeMenu.bind(this),
- onChange: this.onChange.bind(this),
- domNodeToAttachTo: this.domNodeToAttachTo,
- className: 'ba-theme-default glassContextMenu ' + this.id },
- React.createElement(ContextMenu.List, { content: this.menuItems, name: 'contextMenu' })
- )
- );
- }
- }]);
- return ContextMenuButton;
- }(Component);
- ContextMenuButton.propTypes = {
- onChange: PropTypes.func.isRequired,
- menuItems: PropTypes.array.isRequired,
- domNodeToAttachTo: PropTypes.object,
- placement: PropTypes.string,
- id: PropTypes.string.isRequired,
- ariaLabel: PropTypes.string
- };
- ContextMenuButton.defaultProps = {
- placement: 'bottom',
- domNodeToAttachTo: document.body,
- ariaLabel: ''
- };
- return ContextMenuButton;
- });
- //# sourceMappingURL=ContextMenuButton.js.map
- ;
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2018, 2020
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- // jshint maxparams:13
- define('baglass/core-client/js/core-client/ui/properties/NewPalette',['./BaseProperty', 'text!./templates/NewPalette.html', './SectionLabel', './SingleLineLinks', 'react', 'jquery', '../../nls/StringResources', 'doT', 'underscore', '../KeyCodes', '../ContextMenuButton', '../../utils/Utils', 'authoring-common'], function (BaseProperty, PaletteTemplate, SectionLabel, SingleLineLinks, React, $, StringResources, dot, _, KeyCodes, ContextMenuButton, Utils, AuthoringCommon) {
- 'use strict';
- var DEFAULT_MAXCOLORS = 26;
- var CustomPalette = AuthoringCommon.CustomPalette;
- var DEFAULT_MENU_ITEMS = [{
- id: 'edit_palette',
- label: StringResources.get('edit_palette'),
- value: 'edit'
- }, {
- id: 'duplicate_palette',
- label: StringResources.get('duplicate_palette'),
- value: 'duplicate'
- }, {
- id: 'reverse_palette',
- label: StringResources.get('reverse_palette'),
- value: 'reverse'
- }, {
- id: 'delete_palette',
- label: StringResources.get('delete_palette'),
- value: 'delete'
- }];
- var Palette = BaseProperty.extend({
- /**
- * Creates a property with palette picker.
- * @param options.name {string} - property name
- * @param options.el {node} - parent element
- * @param options.hasSection {boolean} - boolean to show the section on top of the palette
- * @param options.canCreatePalettes {boolean} - optional, default is true, boolean to turn off the add palette button in the section header
- * @param options.sectionLabel {string} - section label
- * @param options.onCreatePalette {function} - callback when a palette is created.
- * @param options.changePaletteCb {function} - callback for the single link link
- * @param options.isAdminUI {boolean} - boolean to duplicate in global instead of custom
- * @param options.linkLabel {string} - label for the single line link
- * @param options.maxColors {int} - max number of colors shown
- * @param options.createPaletteType {string} - Type of palette to create when launching the palette dialog
- * @param options.menuItems {array} - list of the palette menu palette that you want to show, filtered with the item.value.
- * By default ['edit','duplicate','reverse','delete']
- * @param options.palette {object} - the selected palette that you want to display
- * @param options.palette.id {string} - palette id
- * @param options.palette.content {object} - Object storing the palette content
- * @param options.palette.content.label {string} - palette name
- * @param options.palette.content.fills {array} - array of color values
- * @param options.palette.content.fillType {array} - type of the values passed, can be "simple", "continuous" or "ImgPath" if its a pattern.
- * @param options.palette.content.path {string} - For 'ImgPath' type path defines the parent file path of the images
- * @param options.palette.content.fileType {string} - For 'ImgPath' type, fileType defines the type of the image. Default to '.svg'
- * @param options.readOnly {boolean} - optional, default is false. If true, the UI will be rendered in a read-only mode
- * @param options.ariaLabel {string} - optional, if you want to override the default label for screen readers
- *
- */
- init: function init(options) {
- this.readOnly = true;
- this.maxColors = DEFAULT_MAXCOLORS;
- this.reverse = false;
- this.defaultImageType = '.svg';
- this.events = {};
- this.events['clicktap .property_' + options.id + '.paletteColors:not(.readOnly)'] = '_handleClick';
- this.events['keydown .property_' + options.id + '.paletteColors:not(.readOnly)'] = '_handleKeyDown';
- this.events['clicktap .property_' + options.id + ' .showColorsButton'] = '_showHideColorsClick';
- this.events['keydown .property_' + options.id + ' .showColorsButton'] = '_showHideColorsKeyDown';
- Palette.inherited('init', this, arguments);
- _.extend(this, options);
- if (this.hasSection && this.sectionLabel) {
- var headerOptions = {
- el: this.$el,
- name: this.name,
- id: this.id + 'topSection',
- type: 'SingleLineLinks',
- items: [{
- align: 'left',
- items: [{
- type: 'text',
- name: 'currentPaletteLabel',
- value: this.sectionLabel
- }]
- }]
- };
- if (this.canCreatePalettes || this.canCreatePalettes === undefined) {
- headerOptions.items.push({
- align: 'right',
- items: [{
- name: 'addNewPalette',
- type: 'icon',
- svgIcon: 'common-add-new',
- iconTooltip: options.newPaletteLabel || StringResources.get('createPalette'),
- clickCallback: this.openCreateDialog.bind(this)
- }]
- });
- }
- this.header = new SingleLineLinks(headerOptions);
- }
- if (this.changePaletteCb && this.linkLabel) {
- this.link = new SingleLineLinks({
- el: this.$el,
- name: this.name,
- id: this.id,
- type: 'SingleLineLinks',
- items: [{
- align: 'right',
- items: [{
- type: 'text',
- name: 'changePalette',
- value: this.linkLabel,
- clickCallback: this.changePaletteCb
- }]
- }]
- });
- }
- },
- /**
- * Our NewPalette property might be nested in a collapsible section. Get the top level propertyUIControl node
- * for select and deselect operations.
- */
- _getContainerNode: function _getContainerNode() {
- if (!this.containerNode) {
- this.containerNode = this.$el.parentsUntil('.propertyUIControl.flexHeight');
- if (!this.containerNode) {
- this.containerNode = this.$el;
- }
- }
- return this.containerNode;
- },
- deselectPreviousPalette: function deselectPreviousPalette() {
- this._getContainerNode().find('.paletteColors.selected').removeClass('selected').attr('aria-pressed', 'false');
- },
- deselectPalette: function deselectPalette() {
- this._getContainerNode().find('.property_' + this.id).removeClass('selected').attr('aria-pressed', 'false');
- },
- selectPalette: function selectPalette() {
- this._getContainerNode().find('.property_' + this.id).addClass('selected').attr('aria-pressed', 'true');
- },
- handleSelectPalette: function handleSelectPalette() {
- this.deselectPreviousPalette();
- this.selectPalette();
- this._onChange(this.name, {
- reverse: this.reverse,
- id: this.palette.id,
- isSystem: this.palette.systemPalette
- });
- },
- _handleClick: function _handleClick(event) {
- if (event.target.tagName.toLowerCase() !== 'svg') {
- this.handleSelectPalette();
- }
- },
- _handleKeyDown: function _handleKeyDown(event) {
- if (event.keyCode === KeyCodes.ENTER || event.keyCode === KeyCodes.SPACE) {
- if (event.target.className.indexOf('contextMenuButton') === -1) {
- this.handleSelectPalette();
- }
- }
- },
- showHiddenColors: function showHiddenColors(e) {
- var palContent = $(e.target).parents('.paletteContent');
- if (palContent.find('.showLessColors').hasClass('hidden')) {
- palContent.find('.paletteOption.hidden').toggleClass('hidden');
- } else {
- $(palContent[0].querySelectorAll('.paletteOption:nth-child(n+' + (this.maxColors + 1) + ')')).toggleClass('hidden');
- }
- palContent.find('.showColorsButton').toggleClass('hidden');
- palContent.find('.showColorsButton.hidden').attr('aria-hidden', true);
- palContent.find('.showColorsButton:not(.hidden)').attr('aria-hidden', false);
- },
- _showHideColorsClick: function _showHideColorsClick(event) {
- event.stopPropagation();
- this.showHiddenColors(event);
- },
- _showHideColorsKeyDown: function _showHideColorsKeyDown(event) {
- event.stopPropagation();
- if (event.keyCode === KeyCodes.ENTER || event.keyCode === KeyCodes.SPACE) {
- this.showHiddenColors(event);
- }
- },
- onMenuChange: function onMenuChange(name, value) {
- var _this = this;
- var dialog;
- switch (value) {
- case 'edit':
- var editDialog = React.createElement(CustomPalette, {
- key: 'editPalette',
- glassContext: this.glassContext,
- paletteDef: this.palette.content,
- paletteId: this.palette.id,
- paletteType: this.createPaletteType,
- removeDialog: Utils.removeTemporaryContainer.bind(this),
- ref: function ref(instance) {
- dialog = instance;
- }
- });
- Utils.reactRender(editDialog, Utils.createTemporaryContainer()).then(function () {
- dialog.openDialog();
- });
- break;
- case 'duplicate':
- var dupPalette = _.extend({}, this.palette.content);
- dupPalette.label = StringResources.get('palette_copy', { paletteName: dupPalette.label });
- var duplicateDialog = React.createElement(CustomPalette, {
- key: 'duplicatePalette',
- glassContext: this.glassContext,
- paletteDef: dupPalette,
- paletteType: this.createPaletteType,
- removeDialog: Utils.removeTemporaryContainer.bind(this),
- type: this.isAdminUI ? 'global' : '',
- ref: function ref(instance) {
- dialog = instance;
- }
- });
- Utils.reactRender(duplicateDialog, Utils.createTemporaryContainer()).then(function () {
- dialog.openDialog();
- });
- break;
- case 'reverse':
- this.reverse = !this.reverse;
- this._onChange(this.name, {
- reverse: this.reverse
- });
- return this.reRender();
- case 'delete':
- this.glassContext.getSvc('.Palette').then(function (paletteSvc) {
- paletteSvc.deletePalette(_this.palette.id);
- });
- break;
- }
- },
- _filterItems: function _filterItems() {
- var _this2 = this;
- if (this.menuItems) {
- return _.filter(DEFAULT_MENU_ITEMS, function (item) {
- return _.contains(_this2.menuItems, item.value);
- });
- } else {
- return DEFAULT_MENU_ITEMS;
- }
- },
- onPaletteCreated: function onPaletteCreated(paletteId) {
- if (this.onCreatePalette) {
- this.onCreatePalette(paletteId);
- }
- },
- openCreateDialog: function openCreateDialog() {
- var dialog;
- var paletteComponent = React.createElement(CustomPalette, {
- key: 'createPalette',
- glassContext: this.glassContext,
- paletteType: this.createPaletteType,
- ref: function ref(instance) {
- dialog = instance;
- },
- onPaletteCreated: this.onPaletteCreated.bind(this),
- removeDialog: Utils.removeTemporaryContainer.bind(this)
- });
- Utils.reactRender(paletteComponent, Utils.createTemporaryContainer()).then(function () {
- dialog.openDialog();
- });
- },
- reRender: function reRender() {
- this.$el.find('*[class^=\'property_' + this.id + '\'], *[class*=\' property_' + this.id + '\']').remove();
- return this.doRender();
- },
- doRender: function doRender() {
- if (this.header) {
- this.header.doRender();
- }
- var sHtml = dot.template(PaletteTemplate)({
- 'id': this.id,
- 'palette': this.palette,
- 'readOnly': this.readOnly,
- 'ariaLabel': this.ariaLabel,
- 'selected': this.selected,
- 'maxColors': this.maxColors,
- 'showLessColors': StringResources.get('showLessColors'),
- 'showMoreColors': StringResources.get('showMoreColors'),
- 'content': this.palette.content,
- 'defaultImageType': this.defaultImageType,
- reverse: this.reverse,
- 'showMorePalette': StringResources.get('showMoreColorPalette')
- });
- this.$el.append(sHtml);
- if (this.link) {
- this.link.doRender();
- }
- var items = this._filterItems();
- if (items.length > 0) {
- var paletteMenu = this.$el.find('.property_' + this.id + ' .paletteMenu').get(0);
- var contextMenuButton = React.createElement(ContextMenuButton, {
- menuItems: items,
- onChange: this.onMenuChange.bind(this),
- domNodeToAttachTo: document.body,
- id: this.id,
- ariaLabel: StringResources.get('moreActionsForPalette', { paletteName: this.palette.content.label })
- });
- return Utils.reactRender(contextMenuButton, paletteMenu);
- } else {
- return Promise.resolve();
- }
- }
- });
- return Palette;
- });
- //# sourceMappingURL=NewPalette.js.map
- ;
- define('text!baglass/core-client/js/core-client/ui/properties/templates/OwnerRow.html',[],function () { return '<table role="presentation" class="propertyRow property_{{=it.id}}">\n\t<tbody>\n\t\t<tr>\n\t\t\t<td class="ownerImage">\n\t\t\t\t<div class="wft_owner"></div>\n\t\t\t</td>\n\t\t\t<td class="ownerName">\n\t\t\t\t<div class="propertyName lightText">{{=it.strings.owner}}</div>\n\t\t\t\t<div class="propertyValue darkText owner ellipses">{{=_.escape(it.owner)}}</div>\n\t\t\t</td>\n\t\t\t<td class="horizontalSeparator">\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<table class="propertyDetails" role="presentation">\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class="propertyName singleLine wrap lightText">{{=it.strings.created}}</td>\n\t\t\t\t\t\t<td class="propertyValue creationTime wrap darkText">{{=it.creationTime}}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class="propertyName singleLine wrap lightText">{{=it.strings.modified}}</td>\n\t\t\t\t\t\t<td class="propertyValue modificationTime wrap darkText">{{=it.modificationTime}}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t{{?it.refreshTime}}\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class="propertyName singleLine wrap lightText">{{=it.strings.dataRefreshed}}</td>\n\t\t\t\t\t\t<td class="propertyValue modificationTime wrap darkText">{{=it.refreshTime}}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t{{?}}\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class="propertyName singleLine wrap lightText">{{=it.strings.file}}</td>\n\t\t\t\t\t\t<td class="propertyValue fileType wrap darkText">{{=it.fileType}}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t</td>\n\t\t</tr>\n\t</tbody>\n</table>\n';});
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2017
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('baglass/core-client/js/core-client/ui/properties/OwnerRow',['./BaseProperty', 'text!./templates/OwnerRow.html', 'doT', 'underscore', '../../nls/StringResources'], function (BaseProperty, ownerTemplate, dot, _, StringResource) {
- 'use strict';
- /**
- UI Specific to showing object properties. This will render the
- owner, modificationTime and creationTime
- **/
- var Owner = BaseProperty.extend({
- name: 'ownerRow',
- ellipses: true,
- /**
- @param options.owner {String} - name of the owner
- @param options.modificationTime {String} - object modification time
- @param options.creationTime {String} - object creation time
- **/
- init: function init(options) {
- Owner.inherited('init', this, arguments);
- _.extend(options, options);
- },
- doRender: function doRender() {
- var sHtml = dot.template(ownerTemplate)({
- 'owner': this.owner,
- 'modificationTime': this.modificationTime || '',
- 'creationTime': this.creationTime || '',
- 'fileType': this.fileType,
- 'id': this.id,
- 'refreshTime': this.refreshTime || '',
- 'strings': {
- 'owner': StringResource.get('owner'),
- 'created': StringResource.get('createdWithColon'),
- 'modified': StringResource.get('modifiedWithColon'),
- 'file': StringResource.get('typeWithColon'),
- 'dataRefreshed': StringResource.get('dataRefWithColon')
- }
- });
- this.$el.append(sHtml);
- return;
- }
- });
- return Owner;
- });
- //# sourceMappingURL=OwnerRow.js.map
- ;
- define('text!baglass/core-client/js/core-client/ui/properties/templates/Palette.html',[],function () { return '<div class="{{? !it.nestedUIControl}}propertyRow{{?}} property_{{=it.id}}{{?it.readOnly}} disabled{{?}}"{{?it.ariaLabel}}aria-label="{{=it.ariaLabel}}"{{?}}>\n\t<div class="collapsibleSectionToggle{{=it.id}} palette {{? it.name }}l_{{=it.name}}{{?}}{{? it.readOnly}} disabled{{?}}">\n\t\t{{? it.label}}<div id="label_{{=it.id}}" class="singleLine">{{=it.label}}</div>{{?}}\n\t\t<div class="paletteContainer">\n\t\t\t<div class="pickedOption toggleSection{{=it.id}}" aria-haspopup="true" data-value="{{=it.value}}" role="button" tabindex="{{?it.readOnly}}-1{{??}}0{{?}}">\n\t\t\t{{~it.value :singleValue:i}}\n\t\t\t\t<div class=\'singlePaletteOption{{?it.selectedValueType==="Class"}} {{=singleValue}}{{?}}{{?i>=it.maxLength}} hiddenOption{{?}}\' style=\'width:{{=100/Math.min(it.value.length,it.maxLength)}}%;{{?it.selectedValueType==="ColorCode"}}background:{{=singleValue.toLowerCase()}};{{?}}{{?it.selectedValueType==="ImgPath"}}background:url({{=it.items[it.index].path}}{{=singleValue}}{{=it.items[it.index].fileType||it.defaultImageType}});"{{?}}\'></div>\n\t\t\t{{~}}\n\t\t\t</div>\n\t\t\t{{? it.enableReorder}}\n\t\t\t<div class="orderButton" role=\'button\' tabindex=\'{{?it.readOnly}}-1{{??}}0{{?}}\'>\n\t\t\t\t<svg class="svgIcon">\n\t\t\t\t\t<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#common-swap"></use>\n\t\t\t\t</svg>\n\t\t\t</div>\n\t\t\t{{?}}\n\t\t</div>\n\t\t\n\t</div>\n\t<div class="collapsibleSection collapsibleOptions property_{{=it.id}}{{?it.readOnly}} disabled{{?}}" id="region_{{=it.id}}" aria-hidden="true" aria-live="off" role="radiogroup"{{? it.ariaLabel}}aria-label="{{=it.ariaLabel}}"{{??}}aria-labelledby="label_{{=it.id}}"{{?}}>\n\t\t{{~it.items :item:index}}\n\t\t\t<div class="paletteOption {{?JSON.stringify(item.value).toLowerCase()===JSON.stringify(it.value).toLowerCase()}} selected{{?}}" title="{{=item.label}}" data-name=\'{{=item.name}}\' role="radio" tabindex="{{?it.readOnly}}-1{{??}}0{{?}}" aria-pressed="{{?JSON.stringify(item.value).toLowerCase()===JSON.stringify(it.value).toLowerCase()}}true{{??}}false{{?}}"aria-disabled="{{?it.readOnly}}true{{??}}false{{?}}">\n\t\t\t{{~item.value :singleValue:valueIndex}}\n\t\t\t\t<div class=\'singlePaletteOption{{?item.type==="Class"}} {{=singleValue}}{{?}}{{?valueIndex>=it.maxLength}} hiddenOption{{?}}\' data-value="{{\n\t\t\t\t=singleValue}}" style=\'width:{{=100/Math.min(item.value.length,it.maxLength)}}%;background:{{?item.type==="ColorCode"}}{{=singleValue}}{{?}}{{?item.type==="ImgPath"}}url({{=item.path}}{{=singleValue}}{{=item.fileType||it.defaultImageType}}){{?}};\'>\n\t\t\t\t</div>\n\t\t\t{{~}}\n\t\t\t</div>\n\n\t\t{{~}}\n\t</div>\n</div>';});
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2016, 2017
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('baglass/core-client/js/core-client/ui/properties/Palette',['./BaseProperty', 'text!./templates/Palette.html', 'jquery', 'doT', 'underscore', '../KeyCodes'], function (BaseProperty, PaletteTemplate, $, dot, _, KeyCodes) {
- 'use strict';
- var Palette = BaseProperty.extend({
- /**
- * Creates a property with palette picker.
- * @param options.id {string} - property id
- * @param options.el {node} - parent element
- * @param options.name {string} - property name
- * @param options.label {string} - property label
- * @param options.items {array} - array of all available palettes.
- * @param options.items.name {string} - palette name
- * @param options.items.label {string} - palette name
- * @param options.items.value {string} - an array of values for the palette. All of value arrays should have the same length
- * @param options.items.type {string} - type of color. It can be 'ColorCode', 'Class' or 'ImgPath'
- * @param options.items.path {string} - For 'ImgPath' type path defines the parent file path of the images
- * @param options.items.fileType {string} - For 'ImgPath' type, fileType defines the type of the image. Default to '.svg'
- * @param options.onChange {function} - callback to be notified as soon as the change happens
- * @param options.onOpenChange {function} - callback to be notified whenever the color picker opens / closes
- * @param options.readOnly {boolean} - optional, default is false. If true, the UI will be rendered in a read-only mode
- * @param options.nestedUIControl {boolean} - optional, default is false. Set to true if this UI Widget is being rendered by another UI Widget
- * @param options.ariaLabel {string} - optional, if you want to override the default label for screen readers
- * @param options.selectedName {string} - optional, the name of the initial selected color
- * @param options.reverse {boolean} - optional, true if the order is reversed
- * @param options.open {boolean} - optional, default is false. If true, open the color picker
- * @param options.enableReorder {boolean} - optional, default is false. If true, there shows a reorder button to reorder the palette option
- * @param options.maxValueLength {int} - optional, default is 5.
- */
- init: function init(options) {
- this.events = {};
- this.events['clicktap .property_' + options.id + ' .paletteOption'] = '_handleClick';
- this.events['keydown .property_' + options.id + ' .paletteOption'] = '_handleKeyDown';
- this.events['clicktap .property_' + options.id + ' .orderButton'] = '_handleReorderClick';
- this.events['keydown .property_' + options.id + ' .orderButton'] = '_handlerReorderKeydown';
- this.events['clicktap .collapsibleSectionToggle' + options.id] = 'toggleCollapsibleSection';
- this.events['keydown .collapsibleSectionToggle' + options.id] = '_toggleCollapsibleSectionKeyDown';
- this.nestedUIControl = false;
- this.open = false;
- this.enableReorder = false;
- this.reverse = false;
- this.defaultImageType = '.svg';
- this.maxValueLength = 5;
- Palette.inherited('init', this, arguments);
- _.extend(this, options);
- },
- doRender: function doRender() {
- this.index = this._getItemIndexFromName(this.selectedName);
- var sHtml = dot.template(PaletteTemplate)({
- 'name': this.name,
- 'label': this.label,
- 'items': this.items,
- 'id': this.id,
- 'readOnly': this.readOnly,
- 'value': this.getSelectedValueArray(),
- 'selectedValueType': this.getSelectedValueType(),
- 'ariaLabel': this.ariaLabel,
- 'nestedUIControl': this.nestedUIControl,
- 'enableReorder': this.enableReorder,
- 'index': this.index,
- 'maxLength': this.maxValueLength,
- 'defaultImageType': this.defaultImageType
- });
- this.$el.append(sHtml);
- if (this.reverse) {
- var $parentNodes = this.$el.find('.property_' + this.id + ' .pickedOption, .paletteOption');
- this._reverseChildren($parentNodes);
- }
- if (this.open) {
- this._doToggleCollapsibleSection();
- }
- },
- toggleCollapsibleSection: function toggleCollapsibleSection() {
- // update state
- this.open = !this.open;
- this._doToggleCollapsibleSection();
- // notify open state change
- if (this.onOpenChange) {
- this.onOpenChange(this.name, this.open);
- }
- },
- getCollasibleDiv: function getCollasibleDiv() {
- return this.$el.find('.collapsibleSection.property_' + this.id);
- },
- getToggleSectionNode: function getToggleSectionNode() {
- return this.$el.find('.toggleSection' + this.id);
- },
- setSelectedColor: function setSelectedColor(newIndex, $selectedNode) {
- this._unselectPreviousColor();
- this.index = newIndex;
- this._updateSelectedNode($selectedNode);
- this._updatePickedPaletteNode();
- this._onChange(this.name, this.getIsReversedAndSelectedItem());
- },
- getSelectedValueArray: function getSelectedValueArray() {
- if (_.isArray(this.items)) {
- return this.items[this.index].value;
- }
- },
- getSelectedColorNode: function getSelectedColorNode() {
- return this.$el.find('.property_' + this.id + ' .selected');
- },
- getIsReversedAndSelectedItem: function getIsReversedAndSelectedItem() {
- return {
- reverse: this.reverse,
- value: this.getSelectedValueArray(),
- name: this.getSelectedItemName()
- };
- },
- handleSelectColor: function handleSelectColor(event) {
- var $selectedNode = $(event.target).closest('.paletteOption');
- var name = $selectedNode.data('name');
- var newIndex = this._getItemIndexFromName(name);
- if (this.index !== newIndex) {
- this.setSelectedColor(newIndex, $selectedNode);
- }
- this.toggleCollapsibleSection();
- },
- getSelectedValueType: function getSelectedValueType() {
- if (_.isArray(this.items)) {
- return this.items[this.index].type;
- }
- },
- getSelectedItemName: function getSelectedItemName() {
- if (_.isArray(this.items)) {
- return this.items[this.index].name;
- }
- },
- _getItemIndexFromName: function _getItemIndexFromName(name) {
- var index;
- _.each(this.items, function (item, i) {
- if (item.name === name) {
- index = i;
- }
- });
- return index;
- },
- _updatePickedPaletteNode: function _updatePickedPaletteNode() {
- var type = this.getSelectedValueType();
- var value = this.getSelectedValueArray();
- var that = this;
- var $pickedOption = this.$el.find('.property_' + this.id + ' .pickedOption');
- $pickedOption.children().each(function (index) {
- if (type === 'ColorCode') {
- $(this).css('background', value[index]);
- } else if (type === 'ImgPath') {
- var item = that.items[that.index];
- var imgURL = item.path + value[index] + (item.fileType || that.defaultImageType);
- $(this).css('background', 'url(' + imgURL + ')');
- } else if (type === 'Class') {
- $(this).addClass(value[index]);
- }
- });
- if (this.reverse) {
- this._reverseChildren($pickedOption);
- }
- },
- _handleReorderClick: function _handleReorderClick(event) {
- event.stopPropagation();
- this._doReorder();
- },
- _handlerReorderKeydown: function _handlerReorderKeydown(event) {
- event.stopPropagation();
- // space || enter
- if (event.keyCode === KeyCodes.ENTER || event.keyCode === KeyCodes.SPACE) {
- this._doReorder();
- }
- },
- _doReorder: function _doReorder() {
- var $parentNodes = this.$el.find('.property_' + this.id + ' .pickedOption, .paletteOption');
- this._reverseChildren($parentNodes);
- this.reverse = !this.reverse;
- this._onChange(this.name, this.getIsReversedAndSelectedItem());
- },
- _reverseChildren: function _reverseChildren($parentNodes) {
- var that = this;
- $parentNodes.each(function () {
- var $children = $(this).children();
- $children.removeClass('hiddenOption');
- var diff = $children.length - that.maxValueLength;
- $children.slice(0, diff).addClass('hiddenOption');
- $(this).append($children.get().reverse());
- });
- },
- _updateSelectedNode: function _updateSelectedNode($selectedNode) {
- if ($selectedNode) {
- $selectedNode.addClass('selected').attr('aria-pressed', 'true');
- }
- },
- _handleKeyDown: function _handleKeyDown(event) {
- // space || enter
- if (event.keyCode === KeyCodes.ENTER || event.keyCode === KeyCodes.SPACE) {
- this.handleSelectColor(event);
- }
- },
- _handleClick: function _handleClick(event) {
- this.handleSelectColor(event);
- event.stopPropagation();
- },
- _unselectPreviousColor: function _unselectPreviousColor() {
- var $previousSelectedNode = this.getSelectedColorNode();
- $previousSelectedNode.removeClass('selected').attr('aria-pressed', 'false');
- var $toggleSectionNode = this.getToggleSectionNode();
- $toggleSectionNode.children().each(function () {
- $(this).css('background', '');
- // remove all of classes except for singlePaletteOption and hiddenOption
- if ($(this).hasClass('hiddenOption')) {
- $(this).attr('class', 'singlePaletteOption hiddenOption');
- } else {
- $(this).attr('class', 'singlePaletteOption');
- }
- });
- },
- _toggleCollapsibleSectionKeyDown: function _toggleCollapsibleSectionKeyDown(event) {
- // space || enter
- if (event.keyCode === KeyCodes.ENTER || event.keyCode === KeyCodes.SPACE) {
- this.toggleCollapsibleSection();
- }
- },
- _doToggleCollapsibleSection: function _doToggleCollapsibleSection() {
- var $collasibleDiv = this.getCollasibleDiv();
- $collasibleDiv.toggleClass('visible');
- var isVisible = $collasibleDiv.hasClass('visible');
- this.$el.find('.property_' + this.id + ' .toggleSection' + this.id).attr('aria-expanded', isVisible ? 'true' : 'false');
- $collasibleDiv.attr('aria-hidden', isVisible ? 'false' : 'true');
- }
- });
- return Palette;
- });
- //# sourceMappingURL=Palette.js.map
- ;
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2016, 2017
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- /**
- * Your 'main' property view should extend this View. For any subview (tabs) you need to extend the PropertyTabView
- **/
- define('baglass/core-client/js/core-client/ui/properties/PropertyPageView',['../View', 'underscore', '../../nls/StringResources', '../dialogs/ConfirmationDialog', '../KeyCodes', './PropertyUIControl'], function (View, _, StringResource, ConfirmationDialog, KeyCodes, PropertyUIControl) {
- 'use strict'; //NOSONAR
- var PropertyPageView = View.extend({
- _bIsCancelRequest: false,
- init: function init(options) {
- PropertyPageView.inherited('init', this, arguments);
- _.extend(this, options);
- this.$el.on('keydown', this._keydownHandler.bind(this));
- },
- renderPropertyUIControl: function renderPropertyUIControl(spec) {
- this._oPropertyUIControl = new PropertyUIControl(spec);
- return this._oPropertyUIControl.render().then(function () {
- return this._oPropertyUIControl;
- }.bind(this));
- },
- getPropertyUIControl: function getPropertyUIControl() {
- return this._oPropertyUIControl;
- },
- /**
- * Called by Glass so it knows if the slideout can be closed
- * returns a promise with a boolean
- */
- canHide: function canHide(option) {
- // Make sure we set this to false but we check if we can hide
- this._bIsCancelRequest = false;
- if (option.isEscape) {
- this._bIsCancelRequest = true;
- return this._canCancel();
- } else {
- return this._canClose();
- }
- },
- /**
- Override as needed
- **/
- setFocus: function setFocus() {
- this._oPropertyUIControl.focus();
- },
- onHide: function onHide() {
- if (this._bIsCancelRequest || !this._oPropertyUIControl) {
- return Promise.resolve(true);
- }
- return this._oPropertyUIControl.onClose().then(function () {
- return this._doSave();
- }.bind(this)).then(function () {
- this._oPropertyUIControl.remove();
- }.bind(this));
- },
- /**
- * Override as needed
- */
- _canClose: function _canClose() {
- if (this._oPropertyUIControl) {
- return this._oPropertyUIControl.onClose().then(function () {
- return !this._oPropertyUIControl.hasValidationError();
- }.bind(this));
- } else {
- return Promise.resolve(true);
- }
- },
- _canCancel: function _canCancel() {
- if (this._needToConfirmCancel()) {
- return this._confirmCancel();
- }
- return true;
- },
- /**
- * Override as needed
- */
- _doSave: function _doSave() {},
- /**
- * Override as needed
- */
- _needToConfirmCancel: function _needToConfirmCancel() {
- return this._oPropertyUIControl.hasModifiedProperties();
- },
- /**
- Override as needed
- **/
- _closeSlideout: function _closeSlideout() {
- this.slideout.hide();
- },
- _confirmCancel: function _confirmCancel() {
- return new Promise(function (resolve, reject) {
- var oConfirmationDialog = new ConfirmationDialog('confirmCancel', StringResource.get('confirmCancel'), StringResource.get('confirmCancelMessage'));
- oConfirmationDialog.confirm(resolve, reject);
- });
- },
- _keydownHandler: function _keydownHandler(event) {
- var key = event.keyCode || event.which;
- var bPropagateEvent = true;
- if (key === KeyCodes.s && event.ctrlKey) {
- this._closeSlideout();
- bPropagateEvent = false;
- }
- if (!bPropagateEvent) {
- event.stopPropagation();
- }
- return bPropagateEvent;
- }
- });
- return PropertyPageView;
- });
- //# sourceMappingURL=PropertyPageView.js.map
- ;
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2016, 2017
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('baglass/core-client/js/core-client/ui/properties/PropertyTabView',['../View', 'underscore', './PropertyUIControl'], function (View, _, PropertyUIControl) {
- 'use strict';
- var PropertyTabView = View.extend({
- init: function init(options) {
- PropertyTabView.inherited('init', this, arguments);
- _.extend(this, options);
- },
- renderPropertyUIControl: function renderPropertyUIControl(spec) {
- this._oPropertyUIControl = new PropertyUIControl(spec);
- return this._oPropertyUIControl.render().then(function () {
- return this._oPropertyUIControl;
- }.bind(this));
- },
- getPropertyUIControl: function getPropertyUIControl() {
- return this._oPropertyUIControl;
- },
- onClose: function onClose() {
- return this._oPropertyUIControl.onClose();
- },
- getModifiedProperties: function getModifiedProperties() {
- return this._oPropertyUIControl.getModifiedProperties();
- },
- hasValidationError: function hasValidationError() {
- return this._oPropertyUIControl.hasValidationError();
- }
- });
- return PropertyTabView;
- });
- //# sourceMappingURL=PropertyTabView.js.map
- ;
- define('text!baglass/core-client/js/core-client/ui/properties/templates/Separator.html',[],function () { return '<div class="separator property_{{=it.id}}"></div>';});
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2017
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('baglass/core-client/js/core-client/ui/properties/Separator',['./BaseProperty', 'text!./templates/Separator.html', 'underscore', 'doT'], function (BaseProperty, separatorTemplate, _, dot) {
- 'use strict'; //NOSONAR
- var Separator = BaseProperty.extend({
- /**
- * @param options.indent {int} - default 0, will indent by options.indent * 10px
- **/
- init: function init(spec) {
- Separator.inherited('init', this, arguments);
- _.extend(this, spec);
- },
- doRender: function doRender() {
- var sHtml = dot.template(separatorTemplate)({
- 'id': this.id
- });
- this.$el.append(sHtml);
- },
- processStaticValidation: function processStaticValidation() {
- // Empty function to override BaseProperty processStaticValidation. Hide the icons from this UI element
- }
- });
- return Separator;
- });
- //# sourceMappingURL=Separator.js.map
- ;
- define('text!baglass/core-client/js/core-client/ui/properties/templates/Split.html',[],function () { return '<div class="split flex property_{{=it.id}}">\n\t<div class="splitLeft">\n\t</div>\n\t<div class="splitRight">\n\t</div>\n</div>';});
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2017
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('baglass/core-client/js/core-client/ui/properties/Split',['./PropertyContainerBaseClass', './PropertyUIControl', 'text!./templates/Split.html', 'jquery', 'doT', 'underscore'], function (PropertyContainerBaseClass, PropertyUIControl, split, $, dot, _) {
- 'use strict';
- var Split = PropertyContainerBaseClass.extend({
- ellipses: true,
- /**
- @param options.el {node} - container DOM node
- @param options.items {array} - array of controls to render. Currently only been tested with buttons
- **/
- init: function init(options) {
- this.events = {};
- Split.inherited('init', this, arguments);
- _.extend(this, options);
- },
- doRender: function doRender() {
- var left = [];
- var right = [];
- for (var i = 0; i < this.items.length; i = i + 1) {
- if (this.items[i].align === 'left') {
- left = this.items[i].items;
- } else if (this.items[i].align === 'right') {
- right = this.items[i].items;
- }
- }
- var sHtml = dot.template(split)({
- 'disabled': this.disabled,
- 'id': this.id,
- 'readOnly': this.readOnly,
- 'name': this.name,
- 'styles': this.styles,
- 'role': this.role,
- 'hidden': this.hidden
- });
- this.$el.append(sHtml);
- return this._render(left, right);
- },
- getSplitLeftDiv: function getSplitLeftDiv() {
- return this.$el.find('.property_' + this.id + ' .splitLeft');
- },
- getSplitRightDiv: function getSplitRightDiv() {
- return this.$el.find('.property_' + this.id + ' .splitRight');
- },
- _render: function _render(left, right) {
- this.propertyUIControlLeft = this._renderSplit(this.getSplitLeftDiv(), left);
- this.propertyUIControlRight = this._renderSplit(this.getSplitRightDiv(), right);
- this.processIndent();
- return this.propertyUIControlLeft.render().then(function () {
- return this.propertyUIControlRight.render();
- }.bind(this));
- },
- _renderSplit: function _renderSplit(div, items) {
- var propertyUIControl = new PropertyUIControl({
- 'glassContext': this.glassContext,
- 'el': div,
- 'readOnly': this.readOnly,
- 'items': items,
- 'onChange': this.onChange,
- 'primaryUIControl': false
- });
- return propertyUIControl;
- }
- });
- return Split;
- });
- //# sourceMappingURL=Split.js.map
- ;
- define('text!baglass/core-client/js/core-client/ui/properties/templates/TabControl.html',[],function () { return '<div class="tabbable">\n <ul class="nav nav-tabs" role="tablist">\n </ul>\n <div class="tab-content">\n </div>\n</div>';});
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2017
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('baglass/core-client/js/core-client/ui/properties/TabControl',['./BaseProperty', 'text!./templates/TabControl.html', '../KeyCodes', 'doT', 'jquery', 'underscore', '../../utils/ClassFactory'], function (BaseProperty, tabTemplate, KeyCodes, dot, $, _, ClassFactory) {
- 'use strict'; //NOSONAR
- var TabControl = BaseProperty.extend({
- tabLabelPrefix: 'tabLabel_',
- /**
- * @param options.$el - JQuery node to append the table HTML
- * @param options.items {object} - An array of tab metadata. Must provide name, module, and objectInfo (containing all the basic properties of the object)
- * @param options.onTabChange {function} - callback notified whenever the selected tab changes
- *
- * @constructor
- */
- init: function init(options) {
- this.events = {};
- this.events['keydown .tab' + options.id] = '_handleKeyDown';
- TabControl.inherited('init', this, arguments);
- _.extend(this, options);
- this._tabs = [];
- },
- /**
- * Entry point: render template using JSON specification passed from caller
- **/
- render: function render() {
- var sHtml = dot.template(tabTemplate);
- this.$el.append(sHtml);
- if (this.items.length !== 0) {
- var selIndex = 0;
- this.items.forEach(function (item, index) {
- this._createTab(item, index);
- if (item.selected === true) {
- selIndex = index;
- }
- }.bind(this));
- return this.selectTab(this._tabs[selIndex]);
- } else {
- return Promise.resolve();
- }
- },
- remove: function remove() {
- TabControl.inherited('remove', this, arguments);
- this._tabs.forEach(function (tab) {
- if (tab.tabContent) {
- tab.tabContent.remove();
- }
- });
- this._tabs = [];
- },
- onClose: function onClose() {
- var aPromises = [];
- this._tabs.forEach(function (tab) {
- if (tab.tabContent && tab.tabContent.onClose) {
- aPromises.push(tab.tabContent.onClose());
- }
- });
- return Promise.all(aPromises);
- },
- _handleKeyDown: function _handleKeyDown(evt) {
- if (evt.keyCode !== KeyCodes.LEFT_ARROW && evt.keyCode !== KeyCodes.RIGHT_ARROW) {
- return true;
- }
- var target = $(evt.target);
- var tabIndex = Number(target.attr('tabNumber'));
- if (evt.keyCode === 37 /*left arrow*/) {
- tabIndex = tabIndex === 0 ? this._tabs.length - 1 : tabIndex - 1;
- } else if (evt.keyCode === 39 /*right arrow*/) {
- tabIndex = tabIndex >= this._tabs.length - 1 ? 0 : tabIndex + 1;
- }
- this.$el.find('.tabNumber' + tabIndex).focus();
- this.selectTab(this._tabs[tabIndex]);
- evt.stopPropagation();
- return false;
- },
- selectTab: function selectTab(tab) {
- if (!(tab && tab.item)) {
- return Promise.reject();
- } else if (!this._selectedTabObject || tab.item.name !== this._selectedTabObject.item.name) {
- this._hideTabContent(this._selectedTabObject);
- this._selectedTabObject = tab;
- return this._showTabContent(this._selectedTabObject).then(function () {
- if (this.onTabChange) {
- this.onTabChange(this.name, tab.item);
- }
- }.bind(this));
- } else {
- return Promise.resolve();
- }
- },
- selectTabByName: function selectTabByName(tabName) {
- var tab = _.find(this._tabs, function (tab) {
- return tab.item.name === tabName;
- });
- return this.selectTab(tab);
- },
- _hideTabContent: function _hideTabContent(tab) {
- if (tab) {
- if (tab.tabContent && tab.tabContent.hide) {
- tab.tabContent.hide();
- tab.tabContent.$el.attr('aria-hidden', 'true');
- }
- tab.pane.removeClass('active');
- tab.label.removeClass('active');
- tab.label.attr('aria-selected', 'false');
- tab.label.attr('tabindex', '-1');
- }
- },
- _showTabContent: function _showTabContent(tab) {
- // Note, we need to show the tab pane before we populate the tab so that any size calculations
- // can be done correctly
- tab.pane.addClass('active');
- return this._populateTab(tab).then(function () {
- tab.tabContent.show();
- tab.tabContent.$el.attr('aria-hidden', 'false');
- tab.label.addClass('active');
- tab.label.attr('aria-selected', 'true');
- tab.label.attr('tabindex', '0');
- return true;
- }.bind(this));
- },
- /**
- * @param item.name - Name of tab
- * @param item.module - Name of module to instantiate
- **/
- _createTab: function _createTab(item, index) {
- //used to store all aspects of a single tab in one object
- var tab = {};
- tab.item = item;
- tab.pane = this._createTabPane(index);
- tab.label = this._createTabLabel(tab, index);
- this.$el.find('div.tab-content').append(tab.pane);
- this.$el.find('ul.nav').append(tab.label);
- this.processStaticValidation.call(_.extend({}, this, {
- staticValidationCallback: tab.item.staticValidationCallback
- }), tab.label.find('a'));
- this._tabs.push(tab);
- },
- _createTabLabel: function _createTabLabel(tab, index) {
- var link = $('<a>', {
- 'class': this.tabLabelPrefix + tab.item.name.replace(' ', '_'),
- 'html': tab.item.name
- });
- var linkWrapper = $('<li></li>', {
- 'id': this.id + index,
- 'role': 'tab',
- 'aria-selected': 'false',
- 'class': 'tab' + this.id + ' tabNumber' + index,
- 'tabNumber': index,
- 'tabindex': '-1'
- });
- linkWrapper.on('primaryaction', function (e) {
- e.preventDefault();
- var tabIndex = Number(e.currentTarget.getAttribute('tabNumber'));
- this.selectTab(this._tabs[tabIndex]);
- }.bind(this));
- return linkWrapper.append(link);
- },
- _populateTab: function _populateTab(tab) {
- if (tab.tabContent) {
- return Promise.resolve(true);
- }
- return ClassFactory.loadModule(tab.item.module).then(function (TabContent) {
- tab.item.el = tab.pane;
- tab.item.glassContext = this.glassContext;
- // propagate onChange listener
- if (this.onChange && !tab.item.onChange) {
- tab.item.onChange = this.onChange;
- }
- tab.tabContent = new TabContent(tab.item);
- return tab.tabContent.render();
- }.bind(this)).then(function () {
- tab.tabContent.$el.attr('aria-hidden', 'false');
- if (tab.tabContent.show) {
- tab.tabContent.show();
- }
- return this;
- });
- },
- _createTabPane: function _createTabPane(index) {
- return $('<div>', {
- 'class': 'tab-pane',
- 'role': 'tabpanel',
- 'aria-labelledby': this.id + index,
- 'aria-hidden': 'true'
- });
- },
- getModifiedProperties: function getModifiedProperties() {
- var result = {};
- this._tabs.forEach(function (tab) {
- if (tab.tabContent && tab.tabContent.getModifiedProperties) {
- $.extend(result, tab.tabContent.getModifiedProperties());
- }
- });
- return result;
- },
- hasValidationError: function hasValidationError() {
- for (var i = 0; i < this._tabs.length; i = i + 1) {
- var tab = this._tabs[i];
- if (tab.tabContent && tab.tabContent.hasValidationError && tab.tabContent.hasValidationError()) {
- return true;
- }
- }
- return false;
- }
- });
- return TabControl;
- });
- //# sourceMappingURL=TabControl.js.map
- ;
- define('text!baglass/core-client/js/core-client/ui/properties/templates/TextArea.html',[],function () { return '<div class="propertyRow{{? it.multiline == true}} multiline{{?}} property_{{=it.id}}">\n\t<div class="flex">\n\t\t<div class="propertyName toggleEdit{{=it.id}} l_{{=it.name}}">\n\t\t\t<label for="control_{{=it.name}}_{{=it.id}}">{{=it.label}}</label>\n\t\t</div>\n\t\t{{? it.editable === true}}\n\t\t\t<div class="propertyNameEdit toggleEdit{{=it.id}}" role="img" title="{{=it.strings.edit}}">\n\t\t\t\t<svg class="svgIcon editIcon editIcon{{=it.id}}" role="presentation">\n\t\t\t\t\t<title>{{=it.strings.edit}}</title>\n\t\t\t\t\t<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#common-edit"></use>\n\t\t\t\t</svg>\n\t\t\t</div>\n\t\t{{?}}\n \t\t{{? it.multiline === false}}\n\t\t\t<textarea id="control_{{=it.name}}_{{=it.id}}" rows="1" class="propertyValue rightAlign{{? it.editable == true}} toggleEdit{{=it.id}} editable{{=it.id}}{{?}} wrap v_{{=it.name}}"{{? it.editable === false}} readOnly="true"{{?}}{{?it.direction}} dir="{{=it.direction}}"{{?}}{{?!it.editable}} readOnly="true"{{?}} {{?it.placeHolderText != \'\'}}placeholder="{{=it.placeHolderText}}"{{?}} tabindex="0">{{=_.escape(it.value)}}</textarea>\n \t\t{{?}}\n\t</div>\n \t{{? it.multiline == true}}\n\t\t<textarea id="control_{{=it.name}}_{{=it.id}}" rows="1" class="propertyValue{{? it.editable == true}} toggleEdit{{=it.id}} editable{{=it.id}}{{?}} wrap v_{{=it.name}}{{?it.readOnly}} changeTextColor{{?}}"{{? it.editable === false}} readOnly="true"{{?}}{{?it.direction}} dir="{{=it.direction}}"{{?}}{{?!it.editable}} readOnly="true"{{?}} {{?it.placeHolderText != \'\'}}placeholder="{{=it.placeHolderText}}"{{?}} tabindex="0">{{=_.escape(it.value)}}</textarea>\n\t{{?}}\n</div>\n';});
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('baglass/core-client/js/core-client/ui/properties/TextArea',['./BaseProperty', '../../utils/BidiUtil', 'text!./templates/TextArea.html', 'jquery', 'doT', 'underscore', '../../nls/StringResources'], function (BaseProperty, BidiUtil, textAreaTemplate, $, dot, _, StringResource) {
- 'use strict';
- var MultiLineValue = BaseProperty.extend({
- /**
- * Creates a property with multiline value. Value can be modified if the option, editable, is set to true.
- * @param options.el {node} - parent element
- * @param options.name {string} - property name
- * @param options.label {string} - property label
- * @param options.value {string} - property value
- * @param options.multiline {boolean} - default false, if true, label and value are on separete lines, if false, label and value are shown adjacently
- * @param options.editable {boolean} - true or false
- * @param options.readOnly {boolean} - optional, default is false. If true, the UI will be rendered in a read-only mode
- * @param options.id {string} - unique id
- * @param options.onChange {function} - the callback function called when property value had been edited
- * @param options.indent {int} - default 0, will indent by options.indent * 10px
- * @param options.placeHolderText {string} - optional, if you want text to be shown when the input is empty
- */
- init: function init(options) {
- if (options.editable) {
- if (!this.events) {
- this.events = {};
- }
- this.events['input .editable' + options.id] = '_handleEditInput';
- this.events['keydown .editable' + options.id] = '_handleEditKeydown';
- }
- MultiLineValue.inherited('init', this, arguments);
- if (!_.isString(options.placeHolderText)) {
- options.placeHolderText = '';
- }
- _.extend(this, options);
- this.preserveLineBreak = true;
- },
- doRender: function doRender() {
- var sHtml = dot.template(textAreaTemplate)({
- 'id': this.id,
- 'label': this.label,
- 'value': this.value,
- 'multiline': this.multiline,
- 'direction': BidiUtil.resolveBaseTextDir(this.value, true),
- 'editable': this.editable && !this.readOnly,
- 'name': this.name,
- 'readOnly': this.readOnly,
- 'strings': {
- 'edit': StringResource.get('edit')
- },
- 'placeHolderText': this.placeHolderText
- });
- this.$el.append(sHtml);
- this._setAutoGrow();
- return;
- },
- _handleEditKeydown: function _handleEditKeydown(evt) {
- //Escape key : revert changes
- if (evt.keyCode === 27) {
- return this._onEscFromInput(evt);
- } else {
- this._setAutoGrow();
- }
- },
- _handleEditInput: function _handleEditInput() {
- this._setAutoGrow();
- },
- _setAutoGrow: function _setAutoGrow() {
- var textArea = this.$el.find('textarea').get(0);
- if (textArea && textArea.scrollHeight > textArea.clientHeight) {
- $(textArea).addClass('capEditableHeight');
- textArea.style.height = textArea.scrollHeight + 'px';
- }
- },
- getHTMLControl: function getHTMLControl() {
- if (!this._htmlControl) {
- this._htmlControl = this.getPropertyNode().find('textarea');
- }
- return this._htmlControl;
- }
- });
- return MultiLineValue;
- });
- //# sourceMappingURL=TextArea.js.map
- ;
- define('text!baglass/core-client/js/core-client/ui/properties/templates/ToggleButton.html',[],function () { return '<div class="{{? !it.nestedUIControl}}propertyRow propertyRowLineHeight{{?}} property_{{=it.id}}{{?it.readOnly}} disabled{{?}} clickable">\n\t{{? it.label}}\n\t\t<div class="propertyName singleLine propertyNameText l_{{=it.name}}" title="{{=it.label}}" id="label{{=it.id}}">{{=it.label}}</div>\n\t{{?}}\n\n\t<div class="toggleButtonContainer toggleButton{{=it.id}}">\n\t\t<div class="toggleButton{{? it.checkedLabel == null && it.uncheckedLabel == null}} checkMarkLabel{{?}}{{? it.checked === true}} checked{{?}}" tabindex="0" role="checkbox" aria-checked="{{?it.checked}}true{{??}}false{{?}}" aria-disabled="{{?it.readOnly}}true{{??}}false{{?}}"{{?it.label}} aria-labelledby="label{{=it.id}}"{{?}}{{?it.ariaLabel}} aria-label="{{=it.ariaLabel}}"{{?}}>\n\t\t\t{{? it.checkedLabel != null}}<span>{{=it.checkedLabel}}</span>{{?}}\n\t\t\t{{? it.uncheckedLabel != null}}<span>{{=it.uncheckedLabel}}</span>{{?}}\n\t\t</div>\n\t</div>\n</div>\n';});
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2017
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('baglass/core-client/js/core-client/ui/properties/ToggleButton',['./BaseProperty', 'text!./templates/ToggleButton.html', 'jquery', 'doT', 'underscore'], function (BaseProperty, template, $, dot, _) {
- 'use strict';
- var ToggleButton = BaseProperty.extend({
- buttonSelector: '.toggleButton',
- /**
- * Creates a property with a toggle button.
- *
- * @param options.id {string} - property id
- * @param options.el {node} - parent element
- * @param options.name {string} - property name
- * @param options.label {string} - property label
- * @param options.checked {boolean} - true or false
- * @param options.disabled {boolean} - default is false, set to true if you want the control disabled
- * @param options.onChange {function} - callback to be notified as soon as the change happens
- * @param options.indent {int} - default 0, will indent by options.indent * 10px
- * @param options.readOnly {boolean}{optional} - true or false
- * @param options.nestedUIControl {boolean} - optional, default is false. Set to true if this UI Widget is being rendered by another UI Widget
- * @param options.ariaLabel {string} - if you want to override the default label for screen readers
- */
- init: function init(options) {
- this.events = {};
- this.events['clicktap .property_' + options.id] = '_handleClick';
- this.events['keydown .property_' + options.id] = '_handleKeyDown';
- this.checked = false;
- this.nestedUIControl = false;
- ToggleButton.inherited('init', this, arguments);
- _.extend(this, options);
- },
- doRender: function doRender() {
- var sHtml = dot.template(template)({
- 'label': this.label,
- 'checked': this.checked,
- 'id': this.id,
- 'name': this.name,
- 'readOnly': this.readOnly,
- 'uncheckedLabel': this.uncheckedLabel,
- 'checkedLabel': this.checkedLabel,
- 'nestedUIControl': this.nestedUIControl,
- 'ariaLabel': this.ariaLabel
- });
- this.$el.append(sHtml);
- if (this.disabled) {
- this.disable();
- }
- },
- /**
- Override since we're not using a standard input control
- **/
- getHTMLControl: function getHTMLControl() {
- return this.getPropertyNode().find(this.buttonSelector);
- },
- _handleClick: function _handleClick(event) {
- this._toggleButton();
- event.stopPropagation();
- return false;
- },
- isChecked: function isChecked() {
- var $control = this.getHTMLControl();
- return $control.hasClass('checked');
- },
- _toggleButton: function _toggleButton() {
- this.setValue(!this.isChecked(), true);
- },
- _hasValueChanged: function _hasValueChanged(propertyValue) {
- return propertyValue !== this.isChecked();
- },
- check: function check(fireOnChange) {
- this.setValue(true, fireOnChange);
- },
- uncheck: function uncheck(fireOnChange) {
- this.setValue(false, fireOnChange);
- },
- setValue: function setValue(checked, fireOnChange) {
- var $control = this.getHTMLControl();
- if (fireOnChange) {
- this._onChange(this.name, checked);
- }
- if (checked) {
- $control.addClass('checked');
- } else {
- $control.removeClass('checked');
- }
- $control.attr('aria-checked', checked ? 'true' : false);
- },
- _handleKeyDown: function _handleKeyDown(evt) {
- if (evt.keyCode === 32 || evt.keyCode === 13) {
- // space || enter
- this._toggleButton();
- }
- }
- });
- return ToggleButton;
- });
- //# sourceMappingURL=ToggleButton.js.map
- ;
- define('text!baglass/core-client/js/core-client/ui/properties/templates/ToggledCombo.html',[],function () { return '<div class="{{? !it.nestedUIControl}}propertyRow{{?}} property_{{=it.id}}{{?it.readOnly}} disabled{{?}} {{?it.name}}{{=it.name}}}{{?}}" {{?it.ariaLabel}}aria-label="{{=it.ariaLabel}}"{{?}}>\n\t<div class="toggledComboCheckBox"></div>\n\t<div class="toggledComboOptions">\n\t\t<div class="toggledComboInput"></div>\n\t\t<div class="toggledComboDropDown"></div>\n\t</div>\n\t{{? it.toggledComboHint}}<div class=\'toggledComboHint\'>{{=it.toggledComboHint}}</div>{{?}}\n</div>\n';});
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2017
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('baglass/core-client/js/core-client/ui/properties/ToggledCombo',['./BaseProperty', './CheckBox', './Input', './DropDown', './ToggleButton', 'text!./templates/ToggledCombo.html', 'jquery', 'doT', 'underscore'], function (BaseProperty, CheckBox, Input, DropDown, ToggleButton, Template, $, dot, _) {
- 'use strict';
- var ToggledCombo = BaseProperty.extend({
- /**
- * Creates a property with toggledCombo
- * @param options.id {string} - property id
- * @param options.el {node} - parent element
- * @param options.name {string} - property name
- * @param options.label {string} - property label
- * @param options.dropDownOptions {object} - An object for drop down control options
- * options.dropDownOptions.options {array} - Array of objects for each option in the select control
- * options.dropDownOptions.name {string} - Optional, drop down property name
- * options.dropDownOptions.defaultValue {string} - Optional, drop down default value
- * @param options.checkBoxOptions {object} - An object for check box control options
- * options.checkBoxOptions.checked {boolean} - Optional, the initial state of check box
- * options.checkBoxOptions.name {string} - Optional, check box property name
- * @param options.inputOptions {object} - An object for input control options
- * options.inputOptions.value {string} - Optional, the initial value of input
- * options.inputOptions.name {string} - Optional, input property name
- * @param options.validateInput {function} - optional, a function to validate the input field
- * @param options.onChange {function} - callback to be notified as soon as the change happens
- * @param options.readOnly {boolean} - optional, default is false. If true, the UI will be rendered in a read-only mode
- * @param options.nestedUIControl {boolean} - optional, default is false. Set to true if this UI Widget is being rendered by another UI Widget
- * @param options.ariaLabel {string} - optional, if you want to override the default label for screen readers
- * @param options.toggledComboHint {string} - optional, a hint displays below the control
- * @param options.useToggleButton {bool} - optional, if passed the control will use a toggle button switch instead of the usual checkbox
- */
- init: function init(options) {
- this.events = {};
- this.nestedUIControl = false;
- ToggledCombo.inherited('init', this, arguments);
- _.extend(this, options);
- },
- doRender: function doRender() {
- var sHtml = dot.template(Template)({
- 'name': this.name,
- 'id': this.id,
- 'readOnly': this.readOnly,
- 'ariaLabel': this.ariaLabel,
- 'nestedUIControl': this.nestedUIControl,
- 'toggledComboHint': this.toggledComboHint
- });
- this.$el.append(sHtml);
- this._renderCheckBox();
- this._renderInput();
- this._renderDropDown();
- },
- _renderCheckBox: function _renderCheckBox() {
- var checkboxOptions = {
- el: this.$el.find('.property_' + this.id + ' .toggledComboCheckBox')[0],
- id: this.id + '_checkbox',
- checked: this.checkBoxOptions.checked,
- name: this.checkBoxOptions.name,
- label: this.label,
- onChange: this._checkboxOnChange.bind(this)
- };
- this.checkBox = this.useToggleButton ? new ToggleButton(checkboxOptions) : new CheckBox(checkboxOptions);
- this.checkBox.doRender();
- },
- _renderInput: function _renderInput() {
- var inputOptions = {
- el: this.$el.find('.property_' + this.id + ' .toggledComboInput')[0],
- value: this.inputOptions.value,
- name: this.inputOptions.name,
- id: this.id + '_input',
- newLook: true,
- highlightTextOnFocus: true,
- ellipses: false,
- inputClass: 'narrowInput',
- customValidatorCallback: this._validateInput.bind(this),
- onChange: this._controlOnChange.bind(this),
- disabled: !this.checkBoxOptions.checked
- };
- this.input = new Input(inputOptions);
- this.input.doRender();
- },
- _renderDropDown: function _renderDropDown() {
- var dropDownOptions = {
- el: this.$el.find('.property_' + this.id + ' .toggledComboDropDown')[0],
- name: this.dropDownOptions.name,
- options: this.dropDownOptions.options,
- defaultValue: this.dropDownOptions.defaultValue,
- id: this.id + '_dropDown',
- ariaLabel: this.dropDownOptions.ariaDescribedby,
- onChange: this._controlOnChange.bind(this),
- disabled: !this.checkBoxOptions.checked,
- customValidatorCallback: this._validateDropDown.bind(this)
- };
- this.dropDown = new DropDown(dropDownOptions);
- this.dropDown.doRender();
- },
- _validateInput: function _validateInput(value) {
- return this._validateBase(value, this.dropDown.getSelectedValue());
- },
- _validateDropDown: function _validateDropDown(value) {
- return this._validateBase(parseInt(this.input.getValue(), 10), value);
- },
- _validateBase: function _validateBase(inputValue, dropDownValue) {
- var isValid = true;
- if (_.isFunction(this.validateInput)) {
- isValid = this.validateInput(inputValue, dropDownValue);
- }
- return {
- isValid: isValid,
- customHandler: this._resetInput.bind(this)
- };
- },
- _resetInput: function _resetInput() {
- this.input.setValue(this.inputOptions.value);
- this.dropDown.setValue(this.dropDownOptions.defaultValue || this.dropDownOptions.options[0].value);
- },
- _checkboxOnChange: function _checkboxOnChange(name, isChecked) {
- if (isChecked) {
- this.input.enable();
- this.dropDown.enable();
- } else {
- this.input.disable();
- this.dropDown.disable();
- }
- this._controlOnChange(isChecked);
- },
- _controlOnChange: function _controlOnChange(isChecked) {
- var values = this.getValues();
- if (_.isBoolean(isChecked)) {
- values[this.checkBoxOptions.name] = isChecked;
- }
- this._onChange(this.name, values);
- },
- getValues: function getValues() {
- var result = {};
- result[this.checkBoxOptions.name] = this.checkBox.isChecked();
- result[this.dropDownOptions.name] = this.dropDown.getSelectedValue();
- result[this.inputOptions.name] = this.input.getValue();
- return result;
- }
- });
- return ToggledCombo;
- });
- //# sourceMappingURL=ToggledCombo.js.map
- ;
- define('text!baglass/core-client/js/core-client/ui/properties/templates/TwoStageCombo.html',[],function () { return '<div class="{{? !it.nestedUIControl}}propertyRow {{?}}property_{{=it.id}}{{?it.readOnly}} disabled{{?}} {{?it.name}}{{=it.name}}{{?}}"\n\t{{?it.ariaLabel}}aria-label="{{=it.ariaLabel}}"{{?}}>\n\t<div class="twoStageComboControls"></div>\n</div>\n';});
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('baglass/core-client/js/core-client/ui/properties/TwoStageCombo',['./BaseProperty', './DropDown', './CollapsiblePicker', './Separator', 'text!./templates/TwoStageCombo.html', 'jquery', 'underscore'], function (BaseProperty, DropDown, CollapsiblePicker, Separator, Template, $, _) {
- 'use strict';
- var TwoStageCombo = BaseProperty.extend({
- templateString: Template,
- /**
- * Creates a property with a multi stage combo
- * @param {string} options.id - property id
- * @param {node} options.el - parent element
- * @param {string} options.name - property name
- * @param {string} options.label - property label
- * @param {object} options.dropDownOptions - An object for drop down control options (see DropDown.js)
- * @param {array} [options.collapsiblePickerOptions] - An array of CollapsiblePicker specs to use to show a picker when the equivalent
- * drop down item (at same index) is selected. I.e. second drop down item so the second spec is used to display a CollapsiblePicker
- * @param {function} options.onChange - callback to be notified as soon as the change happens
- * @param {boolean} [options.readOnly=false] - If true, the UI will be rendered in a read-only mode
- * @param {boolean} [options.nestedUIControl=false] - Set to true if this UI Widget is being rendered by another UI Widget
- * @param {string} [options.ariaLabel] - if you want to override the default label for screen readers
- */
- init: function init(options) {
- this.events = {};
- this.nestedUIControl = false;
- this.collapsiblePickerOptions = [];
- TwoStageCombo.inherited('init', this, arguments);
- _.extend(this, options);
- this.currentValue = this.dropDownOptions.defaultValue;
- },
- doRender: function doRender() {
- var sHtml = this.dotTemplate({
- 'name': this.name,
- 'id': this.id,
- 'readOnly': this.readOnly,
- 'ariaLabel': this.ariaLabel,
- 'nestedUIControl': this.nestedUIControl
- });
- this.$el.append(sHtml);
- this.$controls = this.$el.find('.property_' + this.id + ' .twoStageComboControls');
- this._renderDropDown();
- },
- _onChange: function _onChange(name, value) {
- this._updateCurrentValue(value);
- TwoStageCombo.inherited('_onChange', this, arguments);
- },
- _onChangeForDropDown: function _onChangeForDropDown(name, value) {
- var valuesList = [];
- for (var i = 0; i < this.dropDownOptions.options.length; i++) {
- valuesList.push(this.dropDownOptions.options[i].value);
- }
- var index = _.indexOf(valuesList, value);
- if (!this.collapsiblePickerOptions[index]) {
- if (this.collapsiblePicker) {
- this._removeSeparator();
- this._removeCollapsiblePicker();
- }
- if (value !== this.currentValue) {
- this._onChange(name, value);
- }
- } else {
- this._renderPickerControl(index);
- }
- },
- _onChangeForCollapsiblePicker: function _onChangeForCollapsiblePicker(name, value) {
- this._onChange(name, value);
- },
- _updateCurrentValue: function _updateCurrentValue(value) {
- this.currentValue = value;
- },
- _createControlNode: function _createControlNode(className) {
- var node = document.createElement('div');
- node.classList.add(className);
- this.$controls.append(node);
- return node;
- },
- _renderDropDown: function _renderDropDown() {
- var dropDownOptions = {
- id: this.id + '_dropDown',
- name: this.dropDownOptions.name,
- label: this.dropDownOptions.label,
- defaultValue: this.dropDownOptions.defaultValue,
- options: this.dropDownOptions.options,
- nestedUIControl: true,
- el: this._createControlNode('twoStageComboControl'),
- onChange: this._onChangeForDropDown.bind(this)
- };
- this.dropDown = new DropDown(dropDownOptions);
- this.dropDown.doRender();
- // Check to see if the defaultValue / currently selected value should show a CollapsiblePicker
- for (var i = 0; i < this.dropDownOptions.options.length; i++) {
- var item = this.dropDownOptions.options[i];
- if (item.value === this.dropDownOptions.defaultValue) {
- this._renderPickerControl(i);
- break;
- }
- }
- },
- _renderSeparator: function _renderSeparator() {
- this.separator = new Separator({
- id: this.id + '_separator',
- el: this.$controls[0],
- nestedUIControl: true
- });
- this.separator.doRender();
- },
- _renderPickerControl: function _renderPickerControl(index) {
- var options = this.collapsiblePickerOptions[index];
- if (options) {
- this._renderSeparator();
- options.id = this.id + '_collapsiblePicker';
- options.el = this._createControlNode('twoStageComboControl');
- options.open = true;
- options.readOnly = false;
- options.closeOnSelect = false;
- options.nestedUIControl = true;
- options.itemType = 'svg';
- options.onChange = this._onChangeForCollapsiblePicker.bind(this);
- this.collapsiblePicker = new CollapsiblePicker(options);
- this.collapsiblePicker.doRender();
- }
- },
- _removeSeparator: function _removeSeparator() {
- this.separator.hide();
- this.separator.remove();
- this.separator = null;
- },
- _removeCollapsiblePicker: function _removeCollapsiblePicker() {
- this.collapsiblePicker.hide();
- this.collapsiblePicker.remove();
- this.collapsiblePicker.$el.remove();
- this.collapsiblePicker = null;
- }
- });
- return TwoStageCombo;
- });
- //# sourceMappingURL=TwoStageCombo.js.map
- ;
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2016, 2017
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- // This file is used to create the require.js layers. Only the entry points are necessary
- define('baglass/core-client/js/core-client/ui/properties/all',['./Banner', './BaseProperty', './Button', './CheckBox', './CollapsiblePicker', './CollapsibleSection', './ColorPicker', './DropDown', './Footer', './HierarchicalList', './HintText', './HorizontalRadioButtonGroup', './IconCollection', './IconPicker', './Input', './InputLabel', './NewPalette', './OwnerRow', './Palette', './PropertyContainerBaseClass', './PropertyPageView', './PropertyTabView', './PropertyUIControl', './RadioButtonGroup', './SectionLabel', './Separator', './SingleLineLinks', './SingleLineValue', './Split', './TabControl', './TextArea', './ToggleButton', './ToggledCombo', './TwoStageCombo'], function () {
- 'use strict';
- });
- //# sourceMappingURL=all.js.map
- ;
- define("js/glass/propertiesBundle", function(){});
|