propertiesBundle.debug.js 220 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601
  1. /**
  2. * Licensed Materials - Property of IBM
  3. * IBM Cognos Products: BI UI_Commons
  4. * (C) Copyright IBM Corp. 2017
  5. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  6. */
  7. define('baglass/core-client/js/core-client/utils/ValidationUtils',['../i18n/Formatter', 'underscore', '../nls/StringResources', '../ui/dialogs/MessageBox'], function (Formatter, _, StringResources, MessageBox) {
  8. return {
  9. _getValidationMessages: function _getValidationMessages() {
  10. return {
  11. 'isNumber': function isNumber() {
  12. return StringResources.get('invalidNumber');
  13. },
  14. 'isEmail': function isEmail() {
  15. return StringResources.get('invalidEmailMessage');
  16. },
  17. 'maxLength': function (checkList, timeLocale) {
  18. timeLocale = timeLocale || {};
  19. return StringResources.get('exceedMaxLength', {
  20. 'maxLength': Formatter.formatNumber(checkList.maxLength, {
  21. 'locale': timeLocale.contentLocale
  22. })
  23. });
  24. }.bind(this),
  25. 'numericRange': function numericRange(checkList, timeLocale) {
  26. var errorMessage;
  27. if (checkList.numericRange.min !== undefined && checkList.numericRange.max !== undefined) {
  28. errorMessage = StringResources.get('numberOutOfRange', {
  29. 'min': Formatter.formatNumber(checkList.numericRange.min, {
  30. 'locale': timeLocale.contentLocale
  31. }),
  32. 'max': Formatter.formatNumber(checkList.numericRange.max, {
  33. 'locale': timeLocale.contentLocale
  34. })
  35. });
  36. } else if (checkList.numericRange.min !== undefined) {
  37. errorMessage = StringResources.get('numberTooSmall', {
  38. 'min': Formatter.formatNumber(checkList.numericRange.min, {
  39. 'locale': timeLocale.contentLocale
  40. })
  41. });
  42. } else if (checkList.numericRange.max !== undefined) {
  43. errorMessage = StringResources.get('numberTooBig', {
  44. 'max': Formatter.formatNumber(checkList.numericRange.max, {
  45. 'locale': timeLocale.contentLocale
  46. })
  47. });
  48. }
  49. return errorMessage;
  50. }
  51. };
  52. },
  53. /**
  54. * Validate an input
  55. * @param value {string} - the value to be validated
  56. * @param checkList {object} - the different 'validators' to be applied to the value
  57. * @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.
  58. * @return true|false depending if the value is valid
  59. */
  60. validateInput: function validateInput(value, checkList, validationFailedCallback, timeLocale) {
  61. var okCallback = function okCallback(e) {
  62. e.stopPropagation();
  63. MessageBox.inherited('ok', this, arguments);
  64. if (validationFailedCallback) {
  65. validationFailedCallback();
  66. }
  67. return false;
  68. };
  69. for (var validationCheck in checkList) {
  70. if (checkList.hasOwnProperty(validationCheck)) {
  71. // Function names for validation need to start with '_validate'
  72. var funcName = '_validate' + validationCheck.charAt(0).toUpperCase() + validationCheck.slice(1);
  73. if (this[funcName] && !this[funcName](value, checkList)) {
  74. var dlg = new MessageBox('warning', StringResources.get('invalidInput'), this.GET_VALIDATION_MESSAGES[validationCheck](checkList, timeLocale));
  75. dlg.ok = okCallback;
  76. dlg.open();
  77. return false;
  78. }
  79. }
  80. }
  81. return true;
  82. }
  83. };
  84. });
  85. //# sourceMappingURL=ValidationUtils.js.map
  86. ;
  87. /*
  88. *+------------------------------------------------------------------------+
  89. *| Licensed Materials - Property of IBM
  90. *| IBM Cognos Products: Content Explorer
  91. *| (C) Copyright IBM Corp. 2015, 2017
  92. *|
  93. *| US Government Users Restricted Rights - Use, duplication or disclosure
  94. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  95. *+------------------------------------------------------------------------+
  96. */
  97. define('baglass/core-client/js/core-client/utils/GlassContextHelper',[], function () {
  98. 'use strict';
  99. var GlassContextHelper = function GlassContextHelper() {};
  100. /*
  101. @glassContext - glassContext
  102. @jqXHR - jQuery XMLHttpRequest returned by Glass Ajax service on fail
  103. Is temporary and should be removed when Glass handles the showing of error messages
  104. */
  105. GlassContextHelper.prototype.showAjaxServiceErrorMessage = function (glassContext, jqXHR) {
  106. var messages = '';
  107. if (jqXHR) {
  108. var responseJSON = jqXHR.responseJSON;
  109. if (responseJSON) {
  110. if (responseJSON.messages) {
  111. messages = jqXHR.responseJSON.messages.join('\n');
  112. } else if (responseJSON.cause) {
  113. try {
  114. var cause = JSON.parse(responseJSON.cause);
  115. if (cause.messages) {
  116. messages = cause.messages.join('\n');
  117. }
  118. } catch (e) {
  119. //if we get here, 'cause' is not a json object
  120. messages = responseJSON.cause;
  121. }
  122. }
  123. } else {
  124. messages = jqXHR.responseText;
  125. }
  126. }
  127. glassContext.appController.showErrorMessage(messages, 'Error');
  128. };
  129. /*
  130. @glassContext - glassContext
  131. @str - the message
  132. @options - an options jsonObject to pass to glass's showToast
  133. */
  134. GlassContextHelper.prototype.displayToast = function (glassContext, str, options) {
  135. glassContext.appController.showToast(str, options);
  136. };
  137. /*
  138. * preference - name of the preference setting to get. e.g contentLocale, email, etc
  139. */
  140. GlassContextHelper.prototype.getUserPreference = function (glassContext, preference) {
  141. return glassContext.getCoreSvc('.UserProfile').preferences[preference];
  142. };
  143. GlassContextHelper.prototype.getContentLocales = function (glassContext) {
  144. return glassContext.getCoreSvc('.Config').getContentLocales();
  145. };
  146. GlassContextHelper.prototype.getLocaleTime = function (glassContext) {
  147. var preferences = glassContext ? glassContext.getCoreSvc('.UserProfile').preferences : {};
  148. return {
  149. timeZone: preferences.timeZoneID || 'America/New_York',
  150. contentLocale: preferences.contentLocale || 'en'
  151. };
  152. };
  153. return new GlassContextHelper();
  154. });
  155. //# sourceMappingURL=GlassContextHelper.js.map
  156. ;
  157. /*
  158. *+------------------------------------------------------------------------+
  159. *| Licensed Materials - Property of IBM
  160. *| IBM Cognos Products: Content Explorer
  161. *| (C) Copyright IBM Corp. 2015, 2021
  162. *|
  163. *| US Government Users Restricted Rights - Use, duplication or disclosure
  164. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  165. *+------------------------------------------------------------------------+
  166. */
  167. 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) {
  168. 'use strict';
  169. var BaseProperty = View.extend({
  170. /**
  171. @param options.id - unique id
  172. @param options.validator - for validating property value
  173. @param options.validator.script {boolean} - validation to check if value contains "<script"
  174. @param options.validator.isEmail {boolean} - validation to check if value is an email address
  175. @param options.validator.isNumber {boolean} - validation to check if value is a number
  176. @param options.staticValidationCallback {callback} - static validation to inform the user about issues on properties. Requires parent propertyUIControl.staticValidationMode to be true.
  177. If defined, will show an information icon and will call the callback on selection. If undefined, will not show any icon.
  178. @param options.customValidatorCallback {function} - called when the value changes. This method should return an object
  179. {
  180. 'isValid' : {boolean},
  181. 'message' : {error message},
  182. 'customHandler': {function} - optional
  183. }
  184. @param options.enterKeyCallback {function} - functions to call when the enter/Return key is pressed
  185. @param options.hasRange.min {number} - validation to check if value is greater than min
  186. @param options.hasRange.max {number} - validation to check if value is less than max
  187. @param options.maxLength {number} - validation to check if value as string length
  188. @param options.hidden {boolean} - should the field be hidden when rendering
  189. **/
  190. init: function init(options) {
  191. if (options.editable) {
  192. if (_.isUndefined(this.events)) {
  193. this.events = {};
  194. }
  195. this.events['focus .editable' + options.id] = '_onFocus';
  196. this.events['keydown .editable' + options.id] = '_onKeyDown';
  197. this.events['clicktap .toggleEdit' + options.id] = '_onToggleEdit';
  198. this.events['touchend .toggleEdit' + options.id] = '_handleEditClick';
  199. }
  200. BaseProperty.inherited('init', this, arguments);
  201. _.extend(this, options);
  202. this._modifiedProperties = {};
  203. this._lastChangedValue = this.value;
  204. this._isValidValue = true;
  205. this._updatedOnClose = false;
  206. },
  207. render: function render() {
  208. return Promise.resolve(this.doRender()).then(function () {
  209. this.processIndent();
  210. this.processEllipses();
  211. this.processStaticValidation();
  212. this.processHidden();
  213. this._updatedOnClose = false;
  214. }.bind(this));
  215. },
  216. /**
  217. * Each extending class must extend this method
  218. */
  219. doRender: function doRender() {
  220. //override
  221. },
  222. /**
  223. * re-render this property
  224. */
  225. onResize: function onResize() {
  226. //override
  227. },
  228. processIndent: function processIndent() {
  229. if (this.indent) {
  230. var node = this.getPropertyNode();
  231. if (node) {
  232. node.css('margin-left', this.indent * 10 + 'px');
  233. }
  234. }
  235. },
  236. /**
  237. Base class will take care of shortening any string that has the 'ellipses' class
  238. **/
  239. processEllipses: function processEllipses() {
  240. if (!this.ellipses) {
  241. return;
  242. }
  243. if (!this.getPropertyNode().is(':visible')) {
  244. return;
  245. }
  246. // Get all the nodes for the current widget that has the class 'ellipses'
  247. var $ellipses = this.getPropertyNode().find('.ellipses');
  248. $.each($ellipses, function (index, node) {
  249. ContentFormatter.middleShortenString(node);
  250. ContentFormatter.resizeInput(node);
  251. });
  252. },
  253. /**
  254. Base class will take care of showing the validation icon if the staticValidatorCallback is set
  255. **/
  256. processStaticValidation: function processStaticValidation($div) {
  257. if (!this.staticValidationCallback) {
  258. return;
  259. }
  260. if (!$div) {
  261. $div = this.getPropertyNode().closest('.propertyRow');
  262. }
  263. if ($div.closest('.propertyUIControl.staticValidationMode').length === 0) {
  264. return;
  265. }
  266. var validationAriaLabel = StringResources.get('validationControl');
  267. var $wrapper = $('<div>').addClass('validationIcon').prependTo($div).attr({
  268. tabindex: 0,
  269. title: validationAriaLabel
  270. });
  271. $('<svg><use style="pointer-events: none;" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#common-failed"></use></svg>').appendTo($wrapper);
  272. if (typeof this.staticValidationCallback === 'function') {
  273. $wrapper.on('primaryaction', function (evt) {
  274. this.staticValidationCallback(evt);
  275. evt.target = this.$el;
  276. this.$el.trigger(evt);
  277. evt.stopPropagation();
  278. }.bind(this));
  279. }
  280. },
  281. /**
  282. * Base class will take care of hiding the row when hidden is set
  283. */
  284. processHidden: function processHidden() {
  285. if (this.hidden) {
  286. this.hide();
  287. }
  288. },
  289. /**
  290. Returns the container node for the property
  291. **/
  292. getPropertyNode: function getPropertyNode() {
  293. if (!this._propertyNode) {
  294. this._propertyNode = this.$el.find('.property_' + this.id);
  295. }
  296. if (this._propertyNode.length === 0) {
  297. this._propertyNode = this.$el;
  298. }
  299. return this._propertyNode;
  300. },
  301. setFocus: function setFocus() {
  302. var $el = this.getPropertyNode().find('[tabindex=0]')[0];
  303. if ($el) {
  304. $el.focus();
  305. }
  306. },
  307. _hasValueChanged: function _hasValueChanged(propertyValue) {
  308. return this._lastChangedValue === undefined || this._lastChangedValue !== propertyValue;
  309. },
  310. _onChange: function _onChange(propertyName, propertyValue, targetSelector) {
  311. if (!this._validate(propertyValue)) {
  312. return false;
  313. }
  314. this.value = propertyValue;
  315. if (this._hasValueChanged(propertyValue)) {
  316. this._modifiedProperties[propertyName] = propertyValue;
  317. if (typeof this.onChange === 'function') {
  318. this._lastChangedValue = this.value;
  319. var options = targetSelector ? {
  320. focusSelector: targetSelector
  321. } : undefined;
  322. this.onChange(propertyName, propertyValue, options);
  323. }
  324. } else {
  325. this._modifiedProperties = {};
  326. }
  327. return true;
  328. },
  329. hasValidationError: function hasValidationError() {
  330. return !this._isValidValue;
  331. },
  332. _validate: function _validate(propertyValue) {
  333. // We should return a local variable as validation result since the global
  334. // one might be altered by a possible nested validation [Defect 261635]
  335. var isValidValue = this._isValidValue;
  336. if (this.validator) {
  337. var validationDialogCloseCallback = function () {
  338. this.setFocus();
  339. }.bind(this);
  340. var timeLocale = GlassContextHelper.getLocaleTime(this.glassContext);
  341. this._isValidValue = isValidValue = ValidationUtils.validateInput(propertyValue, this.validator, validationDialogCloseCallback, timeLocale);
  342. } else {
  343. if (this.customValidatorCallback) {
  344. var validationResponse = this.customValidatorCallback(propertyValue);
  345. this._isValidValue = isValidValue = !validationResponse || validationResponse.isValid !== false;
  346. if (validationResponse && validationResponse.isValid === false) {
  347. if (_.isFunction(validationResponse.customHandler)) {
  348. validationResponse.customHandler();
  349. } else if (this.showInlineError === true && this.showError) {
  350. this.showError(validationResponse.message);
  351. } else {
  352. var dlg = new MessageBox('warning', StringResources.get('invalidInput'), validationResponse.message);
  353. dlg.open();
  354. }
  355. } else {
  356. if (this.showInlineError && this.hideError) {
  357. this.hideError();
  358. }
  359. }
  360. }
  361. }
  362. return isValidValue;
  363. },
  364. getModifiedProperties: function getModifiedProperties() {
  365. return this._modifiedProperties;
  366. },
  367. _onBlur: function _onBlur() {
  368. var $target = this.getHTMLControl();
  369. $target.removeClass('focus');
  370. // add the changed property to the list of modified properties
  371. var propertyTextValue = this.preserveLineBreak ? $target.val().trim() : $target.val();
  372. var propertyValue;
  373. if (this.isString || isNaN(propertyTextValue) || propertyTextValue === '') {
  374. propertyValue = propertyTextValue;
  375. } else {
  376. if (this.parseFloat) {
  377. propertyValue = parseFloat(propertyTextValue);
  378. } else {
  379. propertyValue = this.decimalPlaces ? parseFloat(propertyTextValue).toFixed(this.decimalPlaces) : parseInt(propertyTextValue, 10);
  380. }
  381. }
  382. var targetClass = $target.attr('class');
  383. var targetClassSelector = targetClass ? '.' + targetClass.replace(/\s/g, '.') : '';
  384. var targetID = $target.attr('id');
  385. var targetIDSelector = targetID ? '#' + targetID : '';
  386. var targetSelector = targetIDSelector + targetClassSelector;
  387. var isChanged = this._onChange(this.name, propertyValue, targetSelector);
  388. if (isChanged) {
  389. if ($target.attr('value')) {
  390. $target.attr('value', propertyValue);
  391. }
  392. this.processEllipses();
  393. }
  394. // Reset the display css of the editIcon so the on hover will work again
  395. var $editIcon = this.$el.find('.editIcon' + this.id);
  396. $editIcon.css('display', '');
  397. this.getHTMLControl().off('blur.BaseProperty');
  398. },
  399. _onFocus: function _onFocus() {
  400. if (!this.editable) {
  401. return;
  402. }
  403. this.getHTMLControl().addClass('focus');
  404. // Make sure the edit icon is hidden (fix for ipad)
  405. var $editIcon = this.$el.find('.editIcon' + this.id);
  406. $editIcon.css('display', 'none');
  407. var $target = this.getHTMLControl();
  408. if (!this.isSTT) {
  409. BidiUtil.initElementForBidi($target[0]);
  410. }
  411. this._placeCaretAtEnd($target[0]);
  412. // Really sucks, but on the ipad showing the keyboard can cause the blur event to get fired.
  413. // Add the event in a timeout to give time for the keyboard to show up.
  414. setTimeout(function () {
  415. this.getHTMLControl().on('blur.BaseProperty', this._onBlur.bind(this));
  416. }.bind(this), 1);
  417. },
  418. _onToggleEdit: function _onToggleEdit() {
  419. //Give focus only if the element is not already focused
  420. if (!this.getHTMLControl().is(':focus')) {
  421. this.getHTMLControl().focus();
  422. }
  423. },
  424. /**
  425. Places the caret at the end of the content editable div or description textarea so that all browsers behave the same
  426. **/
  427. _placeCaretAtEnd: function _placeCaretAtEnd(node) {
  428. if ($(node).is('DIV')) {
  429. node.focus();
  430. var range = document.createRange();
  431. range.selectNodeContents(node);
  432. range.collapse(false);
  433. var sel = window.getSelection();
  434. sel.removeAllRanges();
  435. sel.addRange(range);
  436. } else if ($(node).is('TEXTAREA')) {
  437. if (node.createTextRange) {
  438. //IE
  439. var textArearange = node.createTextRange();
  440. textArearange.move('character', node.value.length);
  441. textArearange.select();
  442. } else {
  443. //Firefox and Chrome
  444. node.focus();
  445. node.setSelectionRange(node.value.length, node.value.length);
  446. }
  447. } else if ($(node).is('INPUT')) {
  448. // For input controls make sure we take as much room as possible when the control has focus
  449. if (this.ellipses) {
  450. $(node).css('width', '99%');
  451. }
  452. if (this.highlightTextOnFocus || !this._isValidValue) {
  453. // Need a settimeout here to let the focus action finish before selecting the text
  454. setTimeout(function () {
  455. $(node).select();
  456. if (node.setSelectionRange) {
  457. node.setSelectionRange(0, node.value.length);
  458. }
  459. }, 1);
  460. } else {
  461. // Setting the value to empty string and then back again will place the caret at the end
  462. $(node).val('');
  463. if (!this.isSTT || BidiUtil.userPreferredTextDir === '') {
  464. $(node).val(this.value);
  465. } else {
  466. $(node).val(BidiUtil.enforceTextDirectionForSTT(this.value));
  467. }
  468. }
  469. }
  470. },
  471. getHTMLControl: function getHTMLControl() {
  472. if (!this._htmlControl) {
  473. this._htmlControl = this.getPropertyNode().find('input');
  474. }
  475. return this._htmlControl;
  476. },
  477. enable: function enable() {
  478. if (this.readOnly) {
  479. return;
  480. }
  481. this.getPropertyNode().removeClass('disabled');
  482. this.getHTMLControl().removeAttr('disabled');
  483. this.getHTMLControl().attr('aria-disabled', 'false');
  484. },
  485. disable: function disable() {
  486. this.getPropertyNode().addClass('disabled');
  487. this.getHTMLControl().attr('disabled', 'disabled');
  488. this.getHTMLControl().attr('aria-disabled', 'true');
  489. },
  490. hide: function hide() {
  491. var node = this.getPropertyNode();
  492. node.addClass('hidden');
  493. node.attr('aria-hidden', 'true');
  494. },
  495. show: function show() {
  496. var node = this.getPropertyNode();
  497. node.removeClass('hidden');
  498. node.attr('aria-hidden', 'false');
  499. },
  500. _onKeyDown: function _onKeyDown(evt) {
  501. //Return key
  502. if (evt.keyCode === 13) {
  503. if (this.handleReturnKey) {
  504. this.getHTMLControl().blur();
  505. if (this.enterKeyCallback) {
  506. this.enterKeyCallback();
  507. }
  508. }
  509. // If we don't stop this event then any validation error dialog will automatically go away on the iPad. Why? I have no clue,
  510. // one of the great mysteries of the universe.
  511. // Validation errors are only possible on input controls
  512. if (evt.target.nodeName.toLowerCase() === 'input') {
  513. evt.stopPropagation();
  514. return false;
  515. }
  516. } else if (evt.keyCode === 27) {
  517. //Escape key
  518. return this._onEscFromInput(evt);
  519. } else if (evt.keyCode === KeyCodes.s && evt.ctrlKey) {
  520. this.getHTMLControl().blur();
  521. }
  522. },
  523. _onEscFromInput: function _onEscFromInput(evt) {
  524. // If value has changed, revert to the original value and stop the event
  525. if (this.getHTMLControl().val() !== String(this.value)) {
  526. this.getHTMLControl().val(this.value);
  527. evt.stopPropagation();
  528. return false;
  529. }
  530. return true;
  531. },
  532. /**
  533. Property sheet is closing, this is where we should do validation
  534. and rejecct the promise if the property isn't in a good state
  535. **/
  536. onClose: function onClose() {
  537. // Odd situtaiton on iPad where the input field still has focus
  538. // when the user taps off the slieout. Make sure we call onBlur directly
  539. // instead of using the event.
  540. // Odd situation where the control isn't in focus anymore but the _onBlur hasn't been called. Check to see
  541. // if our 'focus' class is still on the control, if it is _onBlur needs to be called. This happens in dashboard
  542. // when switching between widget properties.
  543. if ((this.getHTMLControl().is(':focus') || this.getHTMLControl().hasClass('focus')) && this.editable && !this._updatedOnClose) {
  544. this.getHTMLControl().off('blur.BaseProperty');
  545. this._onBlur();
  546. this._updatedOnClose = true;
  547. }
  548. return Promise.resolve();
  549. },
  550. remove: function remove() {
  551. this.getPropertyNode().remove();
  552. }
  553. });
  554. return BaseProperty;
  555. });
  556. //# sourceMappingURL=BaseProperty.js.map
  557. ;
  558. 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';});
  559. /*
  560. *+------------------------------------------------------------------------+
  561. *| Licensed Materials - Property of IBM
  562. *| IBM Cognos Products: Content Explorer
  563. *| (C) Copyright IBM Corp. 2015, 2017
  564. *|
  565. *| US Government Users Restricted Rights - Use, duplication or disclosure
  566. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  567. *+------------------------------------------------------------------------+
  568. */
  569. 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, _) {
  570. 'use strict';
  571. var Banner = BaseProperty.extend({
  572. ellipses: true,
  573. handleReturnKey: false,
  574. /**
  575. @param options.el {node} - container DOM node
  576. @param options.iconFontClass {string} - css class for the icon
  577. @param options.svgIcon {string} - the SVGs xslink:href property
  578. @param options.svgToolTip {string} - the tooltip and accessible label for the svgicon
  579. @param options.iconImgUrl {string} - image file
  580. @param options.value {string} - title to show in the banner
  581. @param options.centerLabel {boolean} - should the label be centered
  582. @param options.hintText {string} - helpful hint text below banner
  583. @param options.backButton {boolean} - should the < Back be displayed
  584. @param options.closeCallback {function} - function to call when the property sheet is closing
  585. @param options.readOnly {boolean}{optional} - default is false. If true, the UI will be rendered in a read-only mode
  586. @param options.editable {boolean}{optional} - default is false, if true the text value can be edited inline
  587. @param options.clickables {array} - array of clickables and callbacks, currently only support text
  588. @param options.ariaLabel {string} - if you want to override the default label for screen readers
  589. @param options.handleReturnKey {boolean} - process the 'Return/Enter' key press
  590. **/
  591. init: function init(options) {
  592. this.events = {};
  593. this.events['primaryaction .headerBack'] = '_goBack';
  594. if (options.clickables) {
  595. options.clickables.forEach(function (item) {
  596. if (item.name && item.clickCallback) {
  597. this.events['primaryaction .' + item.name + options.id] = item.clickCallback;
  598. }
  599. }.bind(this));
  600. }
  601. Banner.inherited('init', this, arguments);
  602. _.extend(this, options);
  603. if (!this.ariaLabel) {
  604. this.ariaLabel = StringResource.get('title');
  605. }
  606. },
  607. doRender: function doRender() {
  608. var templateOptions = {
  609. 'iconFontClass': this.iconClass,
  610. 'svgIcon': this.svgIcon,
  611. 'svgToolTip': this.svgToolTip,
  612. 'iconImgUrl': this.iconImgUrl,
  613. 'label': this.value,
  614. 'direction': BidiUtil.resolveBaseTextDir(this.value || ''),
  615. 'centerLabel': this.centerLabel,
  616. 'id': this.id,
  617. 'editable': this.editable && !this.readOnly,
  618. 'hintText': this.hintText,
  619. 'backButton': this.backButton,
  620. 'strings': {
  621. 'back': StringResource.get('back'),
  622. 'edit': StringResource.get('edit')
  623. },
  624. 'name': this.name,
  625. 'clickables': this.clickables,
  626. 'ariaLabel': this.ariaLabel
  627. };
  628. var sHtml = dot.template(bannerTemplate)(templateOptions);
  629. this.$el.append(sHtml);
  630. return;
  631. },
  632. _goBack: function _goBack() {
  633. if (this.closeCallback) {
  634. this.closeCallback();
  635. }
  636. }
  637. });
  638. return Banner;
  639. });
  640. //# sourceMappingURL=Banner.js.map
  641. ;
  642. /*
  643. *+------------------------------------------------------------------------+
  644. *| Licensed Materials - Property of IBM
  645. *| IBM Cognos Products: Content Explorer
  646. *| (C) Copyright IBM Corp. 2015, 2017
  647. *|
  648. *| US Government Users Restricted Rights - Use, duplication or disclosure
  649. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  650. *+------------------------------------------------------------------------+
  651. */
  652. define('baglass/core-client/js/core-client/ui/properties/Button',['./BaseProperty', 'underscore', '../Button'], function (BaseProperty, _, _Button) {
  653. 'use strict';
  654. var Button = BaseProperty.extend({
  655. ellipses: true,
  656. /**
  657. @param options.el {node} - container DOM node
  658. @param options.label {string} - the button label
  659. @param options.onSelect {function} - callack
  660. @param options.primary {boolean} - if the button is the primary one
  661. **/
  662. init: function init(options) {
  663. Button.inherited('init', this, arguments);
  664. _.extend(this, options);
  665. },
  666. doRender: function doRender() {
  667. var cssClass = this.primary ? 'propertyButton primary' : 'propertyButton secondary';
  668. var MyButton = _Button;
  669. this._button = new MyButton({
  670. 'buttonSpec': {
  671. 'label': this.label,
  672. 'onSelect': this.onSelect,
  673. 'class': cssClass
  674. }
  675. });
  676. this._button.render();
  677. if (this.id !== undefined) {
  678. this._button.$el.addClass(this.id);
  679. }
  680. this.$el.append(this._button.$el);
  681. },
  682. disable: function disable() {
  683. this._button.$el.addClass('disabled');
  684. },
  685. enable: function enable() {
  686. this._button.$el.removeClass('disabled');
  687. }
  688. });
  689. return Button;
  690. });
  691. //# sourceMappingURL=Button.js.map
  692. ;
  693. 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';});
  694. /*
  695. *+------------------------------------------------------------------------+
  696. *| Licensed Materials - Property of IBM
  697. *| IBM Cognos Products: Content Explorer
  698. *| (C) Copyright IBM Corp. 2015, 2017
  699. *|
  700. *| US Government Users Restricted Rights - Use, duplication or disclosure
  701. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  702. *+------------------------------------------------------------------------+
  703. */
  704. 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, _) {
  705. 'use strict';
  706. var CheckBox = BaseProperty.extend({
  707. /**
  708. * Creates a property with round checkbox.
  709. * @param options.id {string} - property id
  710. * @param options.el {node} - parent element
  711. * @param options.name {string} - property name
  712. * @param options.label {string} - property label
  713. * @param options.svgIcon {string} - property icon name
  714. * @param options.checked {boolean || string} - true or false or mixed
  715. * @param options.disabled {boolean} - default is false, set to true if you want the control disabled
  716. * @param options.onChange {function} - callback to be notified as soon as the change happens
  717. * @param options.controlOnLeft {boolean} - default to false, if true the control will be on the left
  718. * @param options.indent {int} - default 0, will indent by options.indent * 10px
  719. * @param options.readOnly {boolean} - optional, default is false. If true, the UI will be rendered in a read-only mode
  720. * @param options.nestedUIControl {boolean} - optional, default is false. Set to true if this UI Widget is being rendered by another UI Widget
  721. * @param options.ariaLabel {string} - if you want to override the default label for screen readers
  722. */
  723. init: function init(options) {
  724. this.events = {};
  725. this.events['clicktap .property_' + options.id] = '_handleClick';
  726. this.events['keydown .property_' + options.id] = '_handleKeyDown';
  727. this.checked = false;
  728. this.nestedUIControl = false;
  729. CheckBox.inherited('init', this, arguments);
  730. _.extend(this, options);
  731. },
  732. doRender: function doRender() {
  733. var sHtml = dot.template(checkboxTemplate)({
  734. 'label': this.label,
  735. 'checked': this.checked === 'mixed' ? 'indeterminate' : this.checked === true ? 'checked' : '',
  736. 'ariaChecked': this.checked,
  737. 'id': this.id,
  738. 'name': this.name,
  739. 'controlOnLeft': this.controlOnLeft || this.nestedUIControl,
  740. 'readOnly': this.readOnly || this.disabled,
  741. 'nestedUIControl': this.nestedUIControl,
  742. 'ariaLabel': this.ariaLabel
  743. });
  744. this.$el.append(sHtml);
  745. if (this.svgIcon) {
  746. this._setIcon();
  747. }
  748. return;
  749. },
  750. _handleClick: function _handleClick(event) {
  751. this.toggleCheckBox();
  752. event.stopPropagation();
  753. return false;
  754. },
  755. _hasValueChanged: function _hasValueChanged(propertyValue) {
  756. if (propertyValue === this.checked) {
  757. return false;
  758. }
  759. this.checked = propertyValue;
  760. return true;
  761. },
  762. _setIcon: function _setIcon() {
  763. Utils.setIcon(this.getPropertyNode().find('.checkbox_icon_' + this.id), 'common-' + this.svgIcon);
  764. },
  765. isChecked: function isChecked() {
  766. return this.checked === true;
  767. },
  768. check: function check(bCallCallback) {
  769. this._toggledCheckbox(true, bCallCallback);
  770. },
  771. uncheck: function uncheck(bCallCallback) {
  772. this._toggledCheckbox(false, bCallCallback);
  773. },
  774. toggleCheckBox: function toggleCheckBox(bCallCallback) {
  775. this._toggledCheckbox(!this.checked, bCallCallback);
  776. },
  777. indeterminateState: function indeterminateState(bCallCallback) {
  778. this._toggledCheckbox('mixed', bCallCallback);
  779. },
  780. _toggledCheckbox: function _toggledCheckbox(bChecked, bCallCallback) {
  781. var checkboxNode = this.getPropertyNode().find('.checkbox');
  782. if (bChecked === 'mixed') {
  783. checkboxNode.removeClass('checked');
  784. checkboxNode.addClass('indeterminate');
  785. checkboxNode.attr('aria-checked', 'mixed');
  786. } else if (bChecked === true) {
  787. checkboxNode.removeClass('indeterminate');
  788. checkboxNode.addClass('checked');
  789. checkboxNode.attr('aria-checked', 'true');
  790. } else {
  791. checkboxNode.removeClass('checked indeterminate');
  792. checkboxNode.attr('aria-checked', 'false');
  793. }
  794. var onChangeCallback = this.onChange;
  795. if (bCallCallback === false) {
  796. this.onChange = null;
  797. }
  798. this._onChange(this.name, bChecked);
  799. if (bCallCallback === false) {
  800. this.onChange = onChangeCallback;
  801. }
  802. },
  803. /**
  804. Override since we're not using a standard input control
  805. **/
  806. getHTMLControl: function getHTMLControl() {
  807. return this.getPropertyNode().find('.checkbox');
  808. },
  809. _handleKeyDown: function _handleKeyDown(evt) {
  810. if (evt.keyCode === 32 || evt.keyCode === 13) {
  811. // space || enter
  812. this.toggleCheckBox();
  813. evt.preventDefault();
  814. }
  815. }
  816. });
  817. return CheckBox;
  818. });
  819. //# sourceMappingURL=CheckBox.js.map
  820. ;
  821. 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';});
  822. /*
  823. *+------------------------------------------------------------------------+
  824. *| Licensed Materials - Property of IBM
  825. *| IBM Cognos Products: Content Explorer
  826. *| (C) Copyright IBM Corp. 2016, 2020
  827. *|
  828. *| US Government Users Restricted Rights - Use, duplication or disclosure
  829. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  830. *+------------------------------------------------------------------------+
  831. */
  832. 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) {
  833. 'use strict';
  834. var propertyUIControl = View.extend({
  835. _uiPropertiesComponentPath: '../ui/properties/',
  836. /**
  837. @param spec.el {node} - container node
  838. @param spec.items {array} - array of UI property widgets to render
  839. @param spec.glassContext {object} - the glass context object
  840. @param spec.closeCallback {function} - function to call when the property sheet is closing
  841. @param spec.onChange {function} - function to call when any of the properties change
  842. @param spec.readOnly {boolean} - optional, default is false. If true, the UI will be rendered in a read-only mode
  843. @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
  844. @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
  845. @param spec.nestedUIControls {boolean} - optional, default is false. Set to true if a UI widget is redering other UI widgets (nested widgets)
  846. @param spec.ariaLabel {string} - optional, if provided the propertyUIControl container will have a tabindex of 0 and use the provided ariaLabel as a description
  847. @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
  848. @param spec.staticValidationMode {boolean} - if set to true, staticValidator will be active and all property controls will be indented.
  849. @param spec.loadlimit {integer} - optional, default is 600. This is the maximum number of items allowed before rendering in pages
  850. **/
  851. init: function init(spec) {
  852. propertyUIControl.inherited('init', this, arguments);
  853. this.readOnly = false;
  854. this.primaryUIControl = true;
  855. this.animatedSpinner = false;
  856. this.nestedUIControls = false;
  857. this.loadlimit = 600;
  858. // Array or property object
  859. this._aProperties = [];
  860. _.extend(this, spec);
  861. // Make it easy to find a property by name, so keep a map of them (not a copy, just a reference)
  862. this._oPropertyMap = {};
  863. // Certain properties like collapsible sections have their own propertyUIControl. Keep a list of them
  864. // so that we can find properties they display
  865. this._aNestedUIControls = [];
  866. this._uniqueNameSpace = 'resize.propertyuicontrol' + this.viewId;
  867. $(Utils.getCurrentWindow()).on(this._uniqueNameSpace, function () {
  868. this.onResize();
  869. }.bind(this));
  870. },
  871. render: function render() {
  872. if (this.$el.parent().hasClass('tab-content')) {
  873. this.primaryUIControl = false;
  874. }
  875. this.$el.addClass('propertyUIControl');
  876. if (this.ariaLabel) {
  877. this.$el.attr('aria-label', this.ariaLabel);
  878. this.$el.attr('role', 'region');
  879. }
  880. if (this.primaryUIControl) {
  881. this.$el.addClass('flexHeight');
  882. }
  883. this.$container = $('<div></div>', {
  884. 'class': 'containerUIControl'
  885. });
  886. if (this.primaryUIControl) {
  887. // Only add this class for the first PropertyUIControl inside the pane-content (glass div). This is to fix an issue
  888. // with nested propertyUIControls, we only want the first one to take up all the height
  889. this.$container.addClass('propertiesUIControlPageView');
  890. // Only need one banner at the top level
  891. this.$bannerContainer = $('<div></div>', {
  892. 'class': 'propertyUIControlBanner'
  893. });
  894. this.$el.prepend(this.$bannerContainer);
  895. }
  896. if (this.animatedSpinner === true) {
  897. this._spinnerEl = Utils.getSpinner();
  898. $(this._spinnerEl).addClass('animatedSpinner');
  899. this.$el.addClass('spinnerWrapper');
  900. this.$container.html($(this._spinnerEl)[0]);
  901. }
  902. if (this.staticValidationMode) {
  903. this.$el.addClass('staticValidationMode');
  904. }
  905. this.$el.append(this.$container);
  906. if (!this.items) {
  907. return Promise.resolve(this);
  908. } else {
  909. this.$itemContainer = $('<span></span>', {
  910. 'class': 'hidden itemContainerUIControl'
  911. });
  912. this.$container.append(this.$itemContainer);
  913. if (this.items.length > this.loadlimit) {
  914. // renderPages implements infinite scroll
  915. return this._renderPages(this.items, this.loadlimit);
  916. } else {
  917. return this.renderItems(this.items).then(function (ret) {
  918. this._postRender(ret);
  919. return ret.results;
  920. }.bind(this));
  921. }
  922. }
  923. },
  924. _postRender: function _postRender(ret) {
  925. this.$itemContainer.removeClass('hidden');
  926. ret.properties.forEach(function (prop) {
  927. if (_.isFunction(prop.processEllipses)) {
  928. prop.processEllipses();
  929. }
  930. });
  931. if (this._spinnerEl) {
  932. $(this._spinnerEl).remove();
  933. this.$el.removeClass('spinnerWrapper');
  934. delete this._spinnerEl;
  935. }
  936. },
  937. renderItems: function renderItems(items) {
  938. var aRequirePromises = [];
  939. items.forEach(function (itemSpec) {
  940. var module = !itemSpec.type ? itemSpec.module : this._uiPropertiesComponentPath + itemSpec.type;
  941. var requirePromise = ClassFactory.loadModule(module).then(function (Property) {
  942. Property = itemSpec.moduleClass ? Property[itemSpec.moduleClass] : Property;
  943. if (!itemSpec.el) {
  944. if (itemSpec.type === 'Banner' && this.$bannerContainer) {
  945. itemSpec.el = this.$bannerContainer[0];
  946. } else if (itemSpec.type === 'Footer') {
  947. itemSpec.el = this.$el;
  948. } else {
  949. itemSpec.el = this.$itemContainer[0];
  950. }
  951. }
  952. itemSpec.id = itemSpec.id ? itemSpec.id.replace(/\./g, '_') : _.uniqueId();
  953. itemSpec.glassContext = this.glassContext;
  954. itemSpec.closeCallback = itemSpec.doClose || this.onClose.bind(this);
  955. itemSpec.readOnly = itemSpec.readOnly !== undefined ? itemSpec.readOnly : this.readOnly;
  956. itemSpec.nestedUIControl = this.nestedUIControls;
  957. if (this.onChange && !itemSpec.onChange) {
  958. itemSpec.onChange = this.onChange;
  959. }
  960. var property = new Property(itemSpec);
  961. this._aProperties.push(property);
  962. if (itemSpec.name) {
  963. this._oPropertyMap[itemSpec.name] = property;
  964. }
  965. if (itemSpec.type === 'CollapsibleSection' || itemSpec.type === 'SingleLineLinks') {
  966. this._aNestedUIControls.push(property);
  967. }
  968. return property;
  969. }.bind(this));
  970. aRequirePromises.push(requirePromise);
  971. }.bind(this));
  972. return Promise.all(aRequirePromises).then(function (oProperties) {
  973. var aRenderPromises = [];
  974. oProperties.forEach(function (oProperty) {
  975. var renderPromise = oProperty.render();
  976. if (renderPromise) {
  977. aRenderPromises.push(renderPromise);
  978. }
  979. });
  980. return Promise.all(aRenderPromises).then(function (results) {
  981. return {
  982. results: results,
  983. properties: oProperties
  984. };
  985. });
  986. }.bind(this));
  987. },
  988. _renderPages: function _renderPages(items) {
  989. var loadlimit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.loadlimit;
  990. // queue for pages to render
  991. this._pagesToRender = [];
  992. while (items.length > 0) {
  993. this._pagesToRender.push(items.splice(0, loadlimit));
  994. }
  995. return this.renderItems(this._pagesToRender.shift()).then(function (ret) {
  996. this._postRender(ret);
  997. this._scrollNode = $.find('.containerUIControl');
  998. $(this._scrollNode).on('scroll', this._onScroll.bind(this));
  999. return ret.results;
  1000. }.bind(this));
  1001. },
  1002. _onScroll: function _onScroll(event) {
  1003. var $target = $(event.target);
  1004. // check if scrolled to the bottom
  1005. if ($target.scrollTop() + $target.innerHeight() >= $target[0].scrollHeight - 20) {
  1006. if (this._pagesToRender.length > 0) {
  1007. return this.renderItems(this._pagesToRender.shift()).bind(this);
  1008. }
  1009. }
  1010. },
  1011. hasValidationError: function hasValidationError() {
  1012. for (var i = 0; i < this._aProperties.length; i = i + 1) {
  1013. var item = this._aProperties[i];
  1014. if (item.hasValidationError && item.hasValidationError()) {
  1015. return true;
  1016. }
  1017. }
  1018. return false;
  1019. },
  1020. hasModifiedProperties: function hasModifiedProperties() {
  1021. var modifiedProperties = this.getModifiedProperties();
  1022. if (!$.isEmptyObject(modifiedProperties)) {
  1023. return true;
  1024. }
  1025. },
  1026. getModifiedProperties: function getModifiedProperties() {
  1027. var result = {};
  1028. this._aProperties.forEach(function (item) {
  1029. if (item.getModifiedProperties) {
  1030. $.extend(result, item.getModifiedProperties());
  1031. }
  1032. });
  1033. return result;
  1034. },
  1035. onClose: function onClose() {
  1036. var deferred = new Deferred();
  1037. var aPromises = [];
  1038. this._aProperties.forEach(function (item) {
  1039. if (item.onClose) {
  1040. aPromises.push(item.onClose());
  1041. }
  1042. });
  1043. Promise.all(aPromises).then(function () {
  1044. if (this.closeCallback) {
  1045. this.closeCallback(this.getModifiedProperties());
  1046. }
  1047. deferred.resolve();
  1048. }.bind(this));
  1049. return deferred.promise;
  1050. },
  1051. /**
  1052. Loop through all the items and call remove on them
  1053. **/
  1054. remove: function remove() {
  1055. this._aProperties.forEach(function (item) {
  1056. if (item.remove) {
  1057. item.remove();
  1058. }
  1059. });
  1060. $(Utils.getCurrentWindow()).off(this._uniqueNameSpace);
  1061. if (this.$container) {
  1062. this.$container.remove();
  1063. }
  1064. },
  1065. focus: function focus() {
  1066. this.$el.attr('tabindex', 0);
  1067. this.$el.focus();
  1068. if (!this.ariaLabel) {
  1069. console.log('Setting focus to property UI control container without an aria label.');
  1070. }
  1071. },
  1072. /**
  1073. Sets the focus to the property provided or will call the setFocusCallback
  1074. @param propertyName - optional, if provided will set the focus to the property
  1075. **/
  1076. setFocus: function setFocus(propertyName) {
  1077. if (propertyName) {
  1078. var propertyObj = this.getProperty(propertyName);
  1079. if (!propertyObj) {
  1080. return;
  1081. }
  1082. propertyObj.setFocus();
  1083. } else if (this.setFocusCallback) {
  1084. this.setFocusCallback(this);
  1085. }
  1086. },
  1087. /**
  1088. Returns the property object for the given name
  1089. **/
  1090. getProperty: function getProperty(propertyName) {
  1091. var property = this._oPropertyMap[propertyName];
  1092. var i = 0;
  1093. if (!property) {
  1094. for (i = 0; i < this._aNestedUIControls.length; i = i + 1) {
  1095. property = this._aNestedUIControls[i].getProperty(propertyName);
  1096. if (property) {
  1097. break;
  1098. }
  1099. }
  1100. }
  1101. if (!property && this._aProperties) {
  1102. for (i = 0; i < this._aProperties.length; i++) {
  1103. var prop = this._aProperties[i];
  1104. if (prop.type === 'TabControl' && prop._tabs) {
  1105. for (var y = 0; y < prop._tabs.length; y++) {
  1106. var tab = prop._tabs[y];
  1107. if (tab.tabContent && tab.tabContent.getPropertyUIControl) {
  1108. var tabProperty = tab.tabContent.getPropertyUIControl().getProperty(propertyName);
  1109. if (tabProperty) {
  1110. return tabProperty;
  1111. }
  1112. }
  1113. }
  1114. }
  1115. }
  1116. }
  1117. return property || null;
  1118. },
  1119. getProperties: function getProperties() {
  1120. return this._aProperties;
  1121. },
  1122. /**
  1123. * Remove the property with the given name from the UI.
  1124. *
  1125. * @param propertyName the property name
  1126. *
  1127. * @return <code>true</code> if the property was found and removed, <code>false</code> otherwise
  1128. */
  1129. removeProperty: function removeProperty(propertyName) {
  1130. var property = this._oPropertyMap[propertyName],
  1131. idx;
  1132. if (property) {
  1133. if (property.remove) {
  1134. property.remove();
  1135. }
  1136. delete this._oPropertyMap[propertyName];
  1137. idx = this._aNestedUIControls.indexOf(property);
  1138. if (idx >= 0) {
  1139. this._aNestedUIControls.splice(idx, 1);
  1140. }
  1141. idx = this._aProperties.indexOf(property);
  1142. if (idx >= 0) {
  1143. this._aProperties.splice(idx, 1);
  1144. }
  1145. }
  1146. return !!property;
  1147. },
  1148. /**
  1149. * called when the parent or main window is resized.
  1150. *
  1151. * @param _event the resize events
  1152. * @param element the element causing the resize (if any)
  1153. *
  1154. * @return void
  1155. * @protected
  1156. */
  1157. onResize: function onResize(_event, element) {
  1158. void _event;
  1159. void element;
  1160. if (this._aProperties) {
  1161. this._aProperties.forEach(function (oProperty) {
  1162. if (oProperty.onResize) {
  1163. oProperty.onResize();
  1164. }
  1165. });
  1166. }
  1167. }
  1168. });
  1169. return propertyUIControl;
  1170. });
  1171. //# sourceMappingURL=PropertyUIControl.js.map
  1172. ;
  1173. /*
  1174. *+------------------------------------------------------------------------+
  1175. *| Licensed Materials - Property of IBM
  1176. *| IBM Cognos Products: Content Explorer
  1177. *| (C) Copyright IBM Corp. 2016, 2017
  1178. *|
  1179. *| US Government Users Restricted Rights - Use, duplication or disclosure
  1180. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  1181. *+------------------------------------------------------------------------+
  1182. */
  1183. define('baglass/core-client/js/core-client/ui/properties/PropertyContainerBaseClass',['./BaseProperty', 'jquery', 'underscore', './PropertyUIControl'], function (BaseProperty, $, _, PropertyUIControl) {
  1184. 'use strict';
  1185. /**
  1186. Extend this class if your property control will nest other property controls.
  1187. **/
  1188. var PropertyContainerBaseClass = BaseProperty.extend({
  1189. init: function init(options) {
  1190. PropertyContainerBaseClass.inherited('init', this, arguments);
  1191. _.extend(this, options);
  1192. },
  1193. initUIControl: function initUIControl(el) {
  1194. var options = {
  1195. 'glassContext': this.glassContext,
  1196. 'el': el,
  1197. 'readOnly': this.readOnly,
  1198. 'items': this.items,
  1199. 'onChange': this.onChange,
  1200. 'primaryUIControl': false,
  1201. 'nestedUIControls': $(el).hasClass('propertyRow')
  1202. };
  1203. if (this.items) {
  1204. options.items = this.items;
  1205. }
  1206. this._oPropertyUIControl = new PropertyUIControl(options);
  1207. },
  1208. getModifiedProperties: function getModifiedProperties() {
  1209. if (this._oPropertyUIControl) {
  1210. return this._oPropertyUIControl.getModifiedProperties();
  1211. }
  1212. return {};
  1213. },
  1214. hasValidationError: function hasValidationError() {
  1215. if (this._oPropertyUIControl) {
  1216. return this._oPropertyUIControl.hasValidationError();
  1217. }
  1218. return false;
  1219. },
  1220. onClose: function onClose() {
  1221. if (this._oPropertyUIControl) {
  1222. return this._oPropertyUIControl.onClose();
  1223. }
  1224. },
  1225. getProperty: function getProperty(propertyName) {
  1226. return this._oPropertyUIControl ? this._oPropertyUIControl.getProperty(propertyName) : null;
  1227. }
  1228. });
  1229. return PropertyContainerBaseClass;
  1230. });
  1231. //# sourceMappingURL=PropertyContainerBaseClass.js.map
  1232. ;
  1233. 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';});
  1234. /*
  1235. *+------------------------------------------------------------------------+
  1236. *| Licensed Materials - Property of IBM
  1237. *| IBM Cognos Products: Content Explorer
  1238. *| (C) Copyright IBM Corp. 2015, 2017
  1239. *|
  1240. *| US Government Users Restricted Rights - Use, duplication or disclosure
  1241. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  1242. *+------------------------------------------------------------------------+
  1243. */
  1244. define('baglass/core-client/js/core-client/ui/properties/SingleLineLinks',['./PropertyContainerBaseClass', './PropertyUIControl', 'text!./templates/SingleLineLinks.html', 'jquery', 'doT', 'underscore'], function (PropertyContainerBaseClass, PropertyUIControl, singleLineLinks, $, dot, _) {
  1245. 'use strict'; //NOSONAR
  1246. var SingleLineLinks = PropertyContainerBaseClass.extend({
  1247. ellipses: true,
  1248. /**
  1249. * Creates a property with single line and read-only link.
  1250. * @param options.el {node}- parent element
  1251. * @param options.id {string} - unique id
  1252. * @param options.name {string} - name
  1253. * @param options.readOnly {boolean} - default is false, set to true if you want the control read only
  1254. * @param options.disabled {boolean} - default is false, set to true if you want the control disabled
  1255. * @param options.indent {int} - default 0, will indent by options.indent * 10px
  1256. * @param options.clickCallback {function} - function to call when it is clicked, declaring at this level makes the whole line a link.
  1257. * @param options.items {array}
  1258. * @param options.items.align {string} - align to left or right
  1259. * @param options.items.items.type {string} - item type, currently support text|icon
  1260. * @param options.items.items.value {string} - text value
  1261. * @param options.items.items.name {string} - name of the item
  1262. * @param options.items.items.svgIcon {string} - svg icon id
  1263. * @param options.items.items.iconTooltip {string} - tooltip for the icon
  1264. * @param options.items.items.aria-label {string} - aria-label for the icon
  1265. * @param options.items.items.role {string} - role for the icon
  1266. * @param options.items.items.showRightArrow {boolean} - show arrow on far right along with the icon
  1267. * @param options.items.items.clickCallback {function} - function to call when it is clicked or tapped
  1268. * @param options.items.items.styles {string} - Styles to apply to the control container
  1269. * @param options.items.items.ariaLabel {string} - String to be used by JAWS
  1270. * @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
  1271. * @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
  1272. */
  1273. init: function init(options) {
  1274. this.events = {};
  1275. this.subControls = [];
  1276. options.items.forEach(function (group) {
  1277. group.items.forEach(function (item, j) {
  1278. if (item.clickCallback) {
  1279. var selector = 'clickCallback_' + group.align + '_' + j + '_' + options.id;
  1280. this.events['primaryaction .' + selector] = function (evt) {
  1281. this._handleClick(evt, item.clickCallback);
  1282. }.bind(this);
  1283. }
  1284. }.bind(this));
  1285. }.bind(this));
  1286. if (options.clickCallback) {
  1287. this.events['primaryaction .property_' + options.id] = function (evt) {
  1288. this._handleClick(evt, options.clickCallback);
  1289. }.bind(this);
  1290. }
  1291. SingleLineLinks.inherited('init', this, arguments);
  1292. _.extend(this, options);
  1293. },
  1294. doRender: function doRender() {
  1295. var left = [];
  1296. var right = [];
  1297. for (var i = 0; i < this.items.length; i = i + 1) {
  1298. if (this.items[i].align === 'left') {
  1299. left = this.items[i].items;
  1300. } else if (this.items[i].align === 'right') {
  1301. right = this.items[i].items;
  1302. }
  1303. }
  1304. left.forEach(this._updateAriaLabelledBy.bind(this));
  1305. right.forEach(this._updateAriaLabelledBy.bind(this));
  1306. var sHtml = dot.template(singleLineLinks)({
  1307. 'disabled': this.disabled,
  1308. 'id': this.id,
  1309. 'left': left,
  1310. 'right': right,
  1311. 'clickCallback': this.clickCallback,
  1312. 'readOnly': this.readOnly,
  1313. 'name': this.name,
  1314. 'styles': this.styles,
  1315. 'showRightArrow': this.showRightArrow,
  1316. 'role': this.role,
  1317. 'iconTooltip': this.iconTooltip,
  1318. 'hidden': this.hidden
  1319. });
  1320. this.$el.append(sHtml);
  1321. var promiseArr = left.map(function (widget, index) {
  1322. return this._postRender(widget, index);
  1323. }.bind(this));
  1324. right.forEach(function (widget, index) {
  1325. promiseArr.push(this._postRender(widget, index));
  1326. }.bind(this));
  1327. return Promise.all(promiseArr).then(function () {
  1328. if (this.disabled) {
  1329. this.disable();
  1330. }
  1331. }.bind(this));
  1332. },
  1333. _updateAriaLabelledBy: function _updateAriaLabelledBy(controlSpec) {
  1334. if (controlSpec.ariaLabelledby) {
  1335. var aLabelledby = controlSpec.ariaLabelledby.split(' ');
  1336. aLabelledby.forEach(function (value, index) {
  1337. aLabelledby[index] = 'control_' + value + '_' + this.id;
  1338. }.bind(this));
  1339. controlSpec.ariaLabelledby = aLabelledby.join(' ');
  1340. }
  1341. },
  1342. _postRender: function _postRender(controlSpec, index) {
  1343. if (controlSpec.type !== 'text' && controlSpec.type !== 'icon') {
  1344. if (!this._oPropertyUIControl) {
  1345. this.initUIControl(this.$el.find('.propertyRow')[0]);
  1346. }
  1347. var $containerNode = this.$el.find('.innerControlContainer_' + controlSpec.type + this.id + index);
  1348. if ($containerNode.length > 0) {
  1349. controlSpec.el = $containerNode[0];
  1350. controlSpec.id = this.id;
  1351. return this._oPropertyUIControl.renderItems([controlSpec]);
  1352. } else {
  1353. return Promise.resolve();
  1354. }
  1355. } else {
  1356. return Promise.resolve();
  1357. }
  1358. },
  1359. _handleClick: function _handleClick(evt, callback) {
  1360. if (!this.disabled && callback) {
  1361. callback(evt);
  1362. }
  1363. },
  1364. _findClickableNodes: function _findClickableNodes() {
  1365. if (!this.clickable) {
  1366. this.clickable = this.getPropertyNode().find('.clickable' + this.id);
  1367. }
  1368. return this.clickable;
  1369. },
  1370. disable: function disable() {
  1371. this._toggleEnabled(true);
  1372. this._propertyNode.addClass('disabled');
  1373. if (this._oPropertyUIControl) {
  1374. this._oPropertyUIControl.getProperties().forEach(function (property) {
  1375. property.disable();
  1376. });
  1377. }
  1378. },
  1379. enable: function enable() {
  1380. this._toggleEnabled(false);
  1381. this._propertyNode.removeClass('disabled');
  1382. if (this._oPropertyUIControl) {
  1383. this._oPropertyUIControl.getProperties().forEach(function (property) {
  1384. property.enable();
  1385. });
  1386. }
  1387. },
  1388. toggleEnabled: function toggleEnabled() {
  1389. if (this.disabled) {
  1390. this.enable();
  1391. } else {
  1392. this.disable();
  1393. }
  1394. },
  1395. _toggleEnabled: function _toggleEnabled(disabled) {
  1396. this.disabled = disabled;
  1397. var clickableNodes = this._findClickableNodes();
  1398. if (clickableNodes) {
  1399. for (var i = 0; i < clickableNodes.length; i = i + 1) {
  1400. var node = clickableNodes.get(i);
  1401. if (disabled) {
  1402. $(node).removeClass('clickable');
  1403. } else {
  1404. $(node).addClass('clickable');
  1405. }
  1406. }
  1407. }
  1408. },
  1409. setValue: function setValue(subPropertyName, value) {
  1410. this.getPropertyNode().find('.' + subPropertyName).text(value);
  1411. this.processEllipses();
  1412. }
  1413. });
  1414. return SingleLineLinks;
  1415. });
  1416. //# sourceMappingURL=SingleLineLinks.js.map
  1417. ;
  1418. /*
  1419. *+------------------------------------------------------------------------+
  1420. *| Licensed Materials - Property of IBM
  1421. *| IBM Cognos Products: Content Explorer
  1422. *| (C) Copyright IBM Corp. 2018
  1423. *|
  1424. *| US Government Users Restricted Rights - Use, duplication or disclosure
  1425. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  1426. *+------------------------------------------------------------------------+
  1427. */
  1428. 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) {
  1429. 'use strict';
  1430. var CustomColorDialog = AuthoringCommon.CustomColorDialog;
  1431. var CollapsiblePicker = BaseProperty.extend({
  1432. templateString: Template,
  1433. // These map to what's in the SASS/CSS file
  1434. contentSizeMap: {
  1435. 'small': 'Sm',
  1436. 'medium': 'Md',
  1437. 'large': 'Lg'
  1438. },
  1439. /**
  1440. * A generic collapsible property capable of displaying a supplied pick list for a given item type (eg SVGs, colours)
  1441. *
  1442. * @param {string} options.id - property id
  1443. * @param {node} options.el - parent element
  1444. * @param {string} options.name - property name
  1445. * @param {string} options.label - property label
  1446. * @param {array} options.items - array of items
  1447. * @param {string} options.items.name - item name
  1448. * @param {string} options.items.label - item label
  1449. * @param {string} options.items.value - item value
  1450. * @param {string} options.items.type - item type; 'ColorCode', 'Class', 'svg'
  1451. * @param {fnction} options.onChange - callback to be notified as soon as the change happens
  1452. * @param {function} options.onOpenChange - callback to be notified whenever the picker opens / closes
  1453. * @param {boolean} [options.readOnly=false] - if true the UI will be rendered in a read-only mode
  1454. * @param {boolean} [options.nestedUIControl=false] - Set to true if this UI Widget is being rendered by another UI Widget
  1455. * @param {string} [options.ariaLabel] - if you want to override the default label for screen readers
  1456. * @param {string} [options.selectedName] - initally select one of the items by its name
  1457. * @param {object} [options.placeholder] - define a placeholder item to be show before the user selects an item. Note: Cannot
  1458. * define this and have a 'selectedName' at the same time. selectedName will take precedent if both are defined.
  1459. * @param {string} options.placeholder.name - item name
  1460. * @param {string} options.placeholder.label - item label
  1461. * @param {string} options.placeholder.value - item value
  1462. * @param {string} options.placeholder.type - item type; 'ColorCode', 'Class', 'svg'
  1463. * @param {boolean} [options.open=false] - if true, open(expand) the picker,
  1464. * @param {boolean} [options.showHexValue=false] - if true, show a hex string
  1465. * @param {boolean} [options.displayLabel] - if true, show specified display value string
  1466. * @param {boolean} [options.addButton=false] - if true, show a link to create a custom color.
  1467. * @param {function} [options.createCustomColor] - function to create a custom color item
  1468. * @param {boolean} [options.closeOnSelect=true] - true to close the picker when a selection is made; false to leave it open
  1469. * @param {string} [options.contentSize=small] - Size of icons to use; 'small', 'medium', 'large' for (32px, 40px, 48px respectively)
  1470. * @param {string} [options.itemType=color] - The picker item type; Options are 'color' or 'svg'
  1471. * @param {boolean} [options.isRequired=false] - When set to true if no 'selectedName' is given and a placeholder has been defined
  1472. * then a red asterisk ( * ) is shown beside the label to indicate further user action is required
  1473. * @param {boolean} [options.allowSameSelection=false] - true to trigger change event if selecting item that is already selected
  1474. */
  1475. init: function init(options) {
  1476. this.events = {};
  1477. this.events['clicktap .property_' + options.id + ' .collapsiblePickerBox'] = '_handleClick';
  1478. this.events['keydown .property_' + options.id + ' .collapsiblePickerBox'] = '_handleKeyDown';
  1479. this.events['clicktap .collapsibleSectionToggle' + options.id] = 'toggleCollapsibleSection';
  1480. this.events['keydown .collapsibleSectionToggle' + options.id] = '_toggleCollapsibleSectionKeyDown';
  1481. this.nestedUIControl = false;
  1482. this.open = false;
  1483. this.closeOnSelect = true;
  1484. this.contentSize = 'small';
  1485. this.itemType = 'color';
  1486. this.isRequired = false;
  1487. CollapsiblePicker.inherited('init', this, arguments);
  1488. _.extend(this, options);
  1489. this._isColorPicker = this.itemType === 'color';
  1490. this._isRequired = !this.selectedName && this.placeholder && this.isRequired;
  1491. },
  1492. doRender: function doRender() {
  1493. if (this.placeholder && !this.selectedName) {
  1494. this.selectedItem = this.placeholder;
  1495. } else {
  1496. this.selectedItem = this._getSelectedItemFromName(this.selectedName);
  1497. }
  1498. var hexValue = this.selectedItem.type === 'ColorCode' ? this.selectedItem.value : this.selectedItem.hexValue;
  1499. if (hexValue === 'transparent') {
  1500. hexValue = '';
  1501. }
  1502. var sHtml = this.dotTemplate({
  1503. 'name': this.name,
  1504. 'label': this.label,
  1505. 'items': this.items,
  1506. 'id': this.id,
  1507. 'readOnly': this.readOnly,
  1508. 'value': this.selectedItem.value,
  1509. 'hexValue': hexValue && hexValue.toUpperCase(),
  1510. 'selectedValueType': this.selectedItem.type,
  1511. 'showHexValue': this.showHexValue,
  1512. 'displayLabel': this.displayLabel,
  1513. 'selectedLabel': this.selectedItem.label,
  1514. 'addButton': this.addButton,
  1515. 'ariaLabel': this.ariaLabel,
  1516. 'nestedUIControl': this.nestedUIControl,
  1517. 'contentSize': this.contentSizeMap[this.contentSize.toLowerCase()] || this.contentSizeMap.small,
  1518. 'colorPicker': this._isColorPicker,
  1519. 'isRequired': this._isRequired
  1520. });
  1521. var $picker = $(sHtml);
  1522. if (this.addButton) {
  1523. var $container = $picker.find('.addCustomColor');
  1524. var link = new SingleLineLinks({
  1525. el: $container,
  1526. name: this.name,
  1527. id: this.id,
  1528. type: 'SingleLineLinks',
  1529. items: [{
  1530. align: 'right',
  1531. items: [{
  1532. type: 'text',
  1533. name: 'customColorLink',
  1534. value: StringResources.get('addCustomColor'),
  1535. clickCallback: this.addCustomColor.bind(this)
  1536. }]
  1537. }]
  1538. });
  1539. link.doRender();
  1540. }
  1541. this.$el.append($picker);
  1542. if (this.open) {
  1543. this._doToggleCollapsibleSection();
  1544. }
  1545. if (this.selectedItem.type === 'svg') {
  1546. var $node = this.$el.find('.property_' + this.id + ' .selectedItemBox');
  1547. Utils.setIcon($node, this.selectedItem.value, this.selectedItem.label, this.selectedItem.label);
  1548. }
  1549. this.$el.find('.property_' + this.id + ' .collapsiblePickerBox').each(function (index, el) {
  1550. if (this.items[index].type.toLowerCase() === 'svg') {
  1551. Utils.setIcon($(el), this.items[index].value, this.items[index].label, this.items[index].label);
  1552. }
  1553. }.bind(this));
  1554. },
  1555. toggleCollapsibleSection: function toggleCollapsibleSection() {
  1556. // update state
  1557. this.open = !this.open;
  1558. this._doToggleCollapsibleSection();
  1559. // notify open state change
  1560. if (this.onOpenChange) {
  1561. this.onOpenChange(this.name, this.open);
  1562. }
  1563. },
  1564. openCollapsibleSection: function openCollapsibleSection() {
  1565. if (this.open) {
  1566. return;
  1567. }
  1568. this.open = !this.open;
  1569. var $collasibleDiv = this.getCollapsibleDiv();
  1570. $collasibleDiv.addClass('visible');
  1571. this.$el.find('.toggleSection' + this.id).attr('aria-expanded', 'true');
  1572. $collasibleDiv.attr('aria-hidden', 'false');
  1573. },
  1574. selectItem: function selectItem(event) {
  1575. var $selectedNode = $(event.currentTarget);
  1576. if ($selectedNode.data('name') !== this.getSelectedItem().name || this.allowSameSelection) {
  1577. this.setSelectedItem($selectedNode);
  1578. }
  1579. if (this.closeOnSelect) {
  1580. this.toggleCollapsibleSection();
  1581. }
  1582. },
  1583. setSelectedItem: function setSelectedItem($selectedNode) {
  1584. if (this._isRequired) {
  1585. this._isRequired = false;
  1586. this.$el.find('.collapsiblePickerRequired').remove();
  1587. }
  1588. this.selectedItem = this._getSelectedItemFromName($selectedNode.data('name'));
  1589. var oldValue = this.getSelectedValue();
  1590. this._unselectPreviousItem();
  1591. this._updateSelectedNode($selectedNode);
  1592. this._updatedSelectedNode(this.selectedItem.value, oldValue);
  1593. this._onChange(this.name, this.getSelectedItem());
  1594. },
  1595. getSelectedItem: function getSelectedItem() {
  1596. return {
  1597. name: this.getSelectedName(),
  1598. label: this.getSelectedLabel(),
  1599. value: this.getSelectedValue(),
  1600. type: this.getSelectedType()
  1601. };
  1602. },
  1603. getCollapsibleDiv: function getCollapsibleDiv() {
  1604. return this.$el.find('.collapsibleSection.property_' + this.id);
  1605. },
  1606. getSelectedNode: function getSelectedNode() {
  1607. return this.$el.find('.property_' + this.id + ' .selected');
  1608. },
  1609. getSelectedName: function getSelectedName() {
  1610. return this.getSelectedNode().data('name');
  1611. },
  1612. getSelectedValue: function getSelectedValue() {
  1613. return this.getSelectedNode().data('value');
  1614. },
  1615. getSelectedLabel: function getSelectedLabel() {
  1616. return this.getSelectedNode().attr('title');
  1617. },
  1618. getSelectedType: function getSelectedType() {
  1619. var type;
  1620. _.each(this.items, function (item) {
  1621. if (_.isEqual(item.value, this.selectedItem.value)) {
  1622. type = item.type;
  1623. }
  1624. }.bind(this));
  1625. return type;
  1626. },
  1627. _getSelectedItemFromName: function _getSelectedItemFromName(name) {
  1628. var selectedItem = this.items[0];
  1629. _.each(this.items, function (item) {
  1630. if (item.name === name) {
  1631. selectedItem = item;
  1632. }
  1633. });
  1634. return selectedItem;
  1635. },
  1636. _getSelectedItemFromValue: function _getSelectedItemFromValue(value) {
  1637. var selectedItem = this.items[0];
  1638. _.each(this.items, function (item) {
  1639. if (item.value === value) {
  1640. selectedItem = item;
  1641. }
  1642. });
  1643. return selectedItem;
  1644. },
  1645. /**
  1646. * @private
  1647. *
  1648. */
  1649. _updatedSelectedNode: function _updatedSelectedNode(newValue, oldValue) {
  1650. var $selectedItemBox = this.$el.find('.property_' + this.id + ' .selectedItemBox');
  1651. if (oldValue && oldValue.toLowerCase() === 'transparent') {
  1652. $selectedItemBox.find('.transparentIndicator').remove();
  1653. }
  1654. if (newValue && newValue.toLowerCase() === 'transparent') {
  1655. $selectedItemBox.append('<div class="transparentIndicator"></div>');
  1656. }
  1657. var selectedType = this.getSelectedType();
  1658. $selectedItemBox.removeAttr('style').removeClass(oldValue).find('.svgIcon').remove();
  1659. if (selectedType === 'Class') {
  1660. $selectedItemBox.addClass(newValue);
  1661. } else if (selectedType === 'ColorCode') {
  1662. $selectedItemBox.css('background', newValue);
  1663. } else {
  1664. // selectedType === 'svg'
  1665. // Get the info and add a new SVG
  1666. var item = this.getSelectedItem();
  1667. Utils.setIcon($selectedItemBox, item.value, item.label, item.label);
  1668. }
  1669. if (this.showHexValue) {
  1670. var colorValue = newValue.toLowerCase() === 'transparent' ? '' : Utils.rgbToHex($selectedItemBox.css('backgroundColor'));
  1671. if (colorValue) {
  1672. colorValue = colorValue.toUpperCase();
  1673. }
  1674. $selectedItemBox.siblings('.selectedColorHex').text(colorValue);
  1675. }
  1676. // Adding support to display a text value next to the picker
  1677. if (this.displayLabel) {
  1678. $selectedItemBox.siblings('.selectedLabel').text(this.getSelectedItem().label);
  1679. }
  1680. $selectedItemBox.attr({ 'data-value': newValue });
  1681. },
  1682. _updateSelectedNode: function _updateSelectedNode($selectedNode) {
  1683. $selectedNode.addClass('selected').attr('aria-pressed', 'true');
  1684. },
  1685. _handleKeyDown: function _handleKeyDown(event) {
  1686. // space || enter
  1687. if (event.keyCode === 32 || event.keyCode === 13) {
  1688. this.selectItem(event);
  1689. }
  1690. },
  1691. _handleClick: function _handleClick(event) {
  1692. this.selectItem(event);
  1693. event.stopPropagation();
  1694. },
  1695. onChangeCustom: function onChangeCustom(color) {
  1696. if (!color) {
  1697. var logger = this.glassContext.getCoreSvc('.Logger');
  1698. if (logger) {
  1699. logger.error('No color returned by the Color Picker dialog.', this);
  1700. }
  1701. return;
  1702. }
  1703. this.selectedItem = this.createCustomColor(color);
  1704. this.items.push(this.selectedItem);
  1705. var oldValue = this.getSelectedValue();
  1706. this._unselectPreviousItem();
  1707. this._updatedSelectedNode(color, oldValue);
  1708. this._onChange(this.name, this.selectedItem);
  1709. },
  1710. openCustomColorDialog: function openCustomColorDialog() {
  1711. var dialog = void 0;
  1712. var customColorComponent = React.createElement(CustomColorDialog, {
  1713. key: 'colorDialog',
  1714. glassContext: this.glassContext,
  1715. ref: function ref(instance) {
  1716. dialog = instance;
  1717. },
  1718. onChange: this.onChangeCustom.bind(this),
  1719. onCloseDialog: Utils.removeTemporaryContainer.bind(this)
  1720. });
  1721. Utils.reactRender(customColorComponent, Utils.createTemporaryContainer()).then(function () {
  1722. dialog.openDialog();
  1723. });
  1724. },
  1725. addCustomColor: function addCustomColor(event) {
  1726. this.openCustomColorDialog(event);
  1727. },
  1728. _unselectPreviousItem: function _unselectPreviousItem() {
  1729. var $previousSelectedNode = this.getSelectedNode();
  1730. $previousSelectedNode.removeClass('selected').attr('aria-pressed', 'false');
  1731. },
  1732. _toggleCollapsibleSectionKeyDown: function _toggleCollapsibleSectionKeyDown(evt) {
  1733. // space || enter
  1734. if (evt.keyCode === 32 || evt.keyCode === 13) {
  1735. this.toggleCollapsibleSection();
  1736. }
  1737. },
  1738. _doToggleCollapsibleSection: function _doToggleCollapsibleSection() {
  1739. var $collasibleDiv = this.getCollapsibleDiv();
  1740. $collasibleDiv.toggleClass('visible');
  1741. var isVisible = $collasibleDiv.hasClass('visible');
  1742. this.$el.find('.toggleSection' + this.id).attr('aria-expanded', isVisible ? 'true' : 'false');
  1743. $collasibleDiv.attr('aria-hidden', isVisible ? 'false' : 'true');
  1744. }
  1745. });
  1746. return CollapsiblePicker;
  1747. });
  1748. //# sourceMappingURL=CollapsiblePicker.js.map
  1749. ;
  1750. 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';});
  1751. /*
  1752. *+------------------------------------------------------------------------+
  1753. *| Licensed Materials - Property of IBM
  1754. *| IBM Cognos Products: Content Explorer
  1755. *| (C) Copyright IBM Corp. 2015, 2020
  1756. *|
  1757. *| US Government Users Restricted Rights - Use, duplication or disclosure
  1758. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  1759. *+------------------------------------------------------------------------+
  1760. */
  1761. define('baglass/core-client/js/core-client/ui/properties/CollapsibleSection',['./PropertyContainerBaseClass', 'text!./templates/CollapsibleSection.html', './PropertyUIControl', 'doT', 'jquery', 'underscore'], function (PropertyContainerBaseClass, CollapsibleSectionTemplate, PropertyUIControl, dot, $, _) {
  1762. 'use strict';
  1763. var CollapsibleSection = PropertyContainerBaseClass.extend({
  1764. /**
  1765. @param options.el {object} - Container DOM node
  1766. @param options.label {String} - Label for the expandible section
  1767. @param options.items {array} - array of UI widgets to show in the section
  1768. @param options.id - unique id
  1769. @param options.styleAsSimpleRow {boolean} - default false, if true will have normal property styles
  1770. @param options.indent {int} - default 0, will indent by options.indent * 10px
  1771. @param options.readOnly {boolean} - optional, default is false. If true, the UI will be rendered in a read-only mode
  1772. @param options.onOpenChange {function} - callback notified whenever the section opens / closes
  1773. @param options.hideSectionTitle {boolean} - default false
  1774. @param options.horizontalAlign {boolean} - optional, default is false. If true, the properties in this section will be aligned horizontally.
  1775. @param options.open {boolean} - default false. If true, section will be expanded on open
  1776. **/
  1777. init: function init(options) {
  1778. this.events = {};
  1779. this.events['clicktap .collapsibleSectionToggle' + options.id] = 'toggleCollapsibleSection';
  1780. this.events['keydown .collapsibleSectionToggle' + options.id] = '_handleKeyDown';
  1781. this.ellipses = true;
  1782. CollapsibleSection.inherited('init', this, arguments);
  1783. _.extend(this, options);
  1784. },
  1785. render: function render() {
  1786. var sHtml = dot.template(CollapsibleSectionTemplate)({
  1787. 'label': this.label,
  1788. 'id': this.id,
  1789. 'name': this.name,
  1790. 'ariaLabel': this.ariaLabel,
  1791. 'styleAsSimpleRow': this.styleAsSimpleRow,
  1792. 'hideSectionTitle': this.hideSectionTitle,
  1793. 'horizontalAlign': this.horizontalAlign
  1794. });
  1795. var $dom = $(sHtml).appendTo(this.$el);
  1796. if (this.items) {
  1797. this.initUIControl(this.getCollasibleDiv()[0]);
  1798. this.processIndent();
  1799. this.processStaticValidation($dom.first());
  1800. if (this.open) {
  1801. this._doToggleCollapsibleSection();
  1802. }
  1803. return this._oPropertyUIControl.render();
  1804. } else {
  1805. return Promise.resolve(true);
  1806. }
  1807. },
  1808. getCollasibleDiv: function getCollasibleDiv() {
  1809. return this.$el.find('.property_' + this.id);
  1810. },
  1811. _handleKeyDown: function _handleKeyDown(evt) {
  1812. if (evt.keyCode === 32 || evt.keyCode === 13) {
  1813. // space || enter
  1814. this.toggleCollapsibleSection();
  1815. }
  1816. },
  1817. /**
  1818. Show/Hide the collapsible section
  1819. **/
  1820. toggleCollapsibleSection: function toggleCollapsibleSection() {
  1821. // update state
  1822. this.open = !this.open;
  1823. this._doToggleCollapsibleSection();
  1824. // notify open state change
  1825. if (this.onOpenChange) {
  1826. this.onOpenChange(this.name, this.open);
  1827. }
  1828. },
  1829. _doToggleCollapsibleSection: function _doToggleCollapsibleSection() {
  1830. this.getCollasibleDiv().toggleClass('visible');
  1831. this.$el.find('.toggleSection' + this.id).toggleClass('upArrow');
  1832. var isVisisble = this.getCollasibleDiv().hasClass('visible');
  1833. this.$el.find('.toggleSection' + this.id).attr('aria-expanded', isVisisble ? 'true' : 'false');
  1834. this.getCollasibleDiv().attr('aria-hidden', isVisisble ? 'false' : 'true');
  1835. // Make sure any properties that have the 'ellipse' class gets processed when it's shown
  1836. this.processEllipses();
  1837. },
  1838. isEmpty: function isEmpty() {
  1839. return this.items === undefined || this.items === null;
  1840. },
  1841. refreshProperties: function refreshProperties(items) {
  1842. this.items = items;
  1843. if (this._oPropertyUIControl) {
  1844. this._oPropertyUIControl.remove();
  1845. }
  1846. $(this.getCollasibleDiv()[0]).empty();
  1847. this._oPropertyUIControl = new PropertyUIControl({
  1848. 'glassContext': this.glassContext,
  1849. 'el': this.getCollasibleDiv()[0],
  1850. 'readOnly': this.readOnly,
  1851. 'items': this.items,
  1852. 'onChange': this.onChange,
  1853. 'primaryUIControl': false,
  1854. 'animatedSpinner': true
  1855. });
  1856. this.processIndent();
  1857. return this._oPropertyUIControl.render();
  1858. }
  1859. });
  1860. return CollapsibleSection;
  1861. });
  1862. //# sourceMappingURL=CollapsibleSection.js.map
  1863. ;
  1864. /*
  1865. *+------------------------------------------------------------------------+
  1866. *| Licensed Materials - Property of IBM
  1867. *| IBM Cognos Products: Content Explorer
  1868. *| (C) Copyright IBM Corp. 2016, 2018
  1869. *|
  1870. *| US Government Users Restricted Rights - Use, duplication or disclosure
  1871. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  1872. *+------------------------------------------------------------------------+
  1873. */
  1874. define('baglass/core-client/js/core-client/ui/properties/ColorPicker',['./CollapsiblePicker'], function (CollapsiblePicker) {
  1875. 'use strict';
  1876. return CollapsiblePicker;
  1877. });
  1878. //# sourceMappingURL=ColorPicker.js.map
  1879. ;
  1880. 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}}{{??}}&nbsp;{{?}}</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';});
  1881. /*
  1882. *+------------------------------------------------------------------------+
  1883. *| Licensed Materials - Property of IBM
  1884. *| IBM Cognos Products: Content Explorer
  1885. *| (C) Copyright IBM Corp. 2017
  1886. *|
  1887. *| US Government Users Restricted Rights - Use, duplication or disclosure
  1888. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  1889. *+------------------------------------------------------------------------+
  1890. */
  1891. 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) {
  1892. 'use strict';
  1893. var Input = BaseProperty.extend({
  1894. handleReturnKey: false,
  1895. /**
  1896. * Creates an input control
  1897. * @param options.el {node}- parent element
  1898. * @param options.name {string} - property name
  1899. * @param options.value {string} - property value
  1900. * @param options.disabled {boolean}{optional} - default is false, set to true if you want the control disabled
  1901. * @param options.readOnly {boolean}{optional} - default is false. If true, the UI will be rendered in a read-only mode
  1902. * @param options.ellipses {boolean}{optional} - default is true.
  1903. * @param options.hintText {string}{options} - if set the hint text will appear above the input control
  1904. * @param options.id {string} - unique id
  1905. * @param options.onChange {function}{optional} - the callback function called when property value had been edited
  1906. * @param options.indent {int} - default 0, will indent by options.indent * 10px
  1907. * @param options.inputType {string} - default is text, but can set to password or anything supported by HTML
  1908. * @param options.inputClass {string} - css class to apply to the container div
  1909. * @param options.inputStyles {string} - any custom styles to place on the container div
  1910. * @param options.highlightTextOnFocus {boolean} - if true, the text will be highlighed on focus
  1911. * @param options.placeHolderText {string} - if you want text to be shown when the input is empty
  1912. * @param options.ariaLabel {string} - label to be read by JAWS
  1913. * @param options.handleReturnKey {boolean} - process the 'Return/Enter' key press
  1914. * @param options.newLook {boolean} - if you want the input to have the new look
  1915. * @param options.showInlineError {boolean} - if you want the error icon to show beside the input control
  1916. * @param options.iSTT {boolean}{optional} - if true the text is displayed as Strutured Text (bidi feature)
  1917. */
  1918. init: function init(options) {
  1919. this.inputType = 'text';
  1920. this.inputClass = '';
  1921. this.inputStyles = '';
  1922. this.ellipses = true;
  1923. this.highlightTextOnFocus = false;
  1924. this.placeHolderText = '';
  1925. // An input control is ALAWAYS editable. It can however be read-only
  1926. options.editable = true;
  1927. if (options.editable && options.newLook && options.placeHolderText) {
  1928. if (_.isUndefined(this.events)) {
  1929. this.events = {};
  1930. }
  1931. this.events['keyup .editable' + options.id] = '_onKeyUp';
  1932. }
  1933. Input.inherited('init', this, arguments);
  1934. _.extend(this, options);
  1935. if (this.inputType === 'password') {
  1936. this.ellipses = false;
  1937. }
  1938. },
  1939. /**
  1940. * return the options for the html template
  1941. */
  1942. getTemplateOptions: function getTemplateOptions() {
  1943. return {
  1944. 'value': !this.isSTT || BidiUtil.userPreferredTextDir === '' ? this.value : BidiUtil.enforceTextDirectionForSTT(this.value),
  1945. 'direction': !this.isSTT ? BidiUtil.resolveBaseTextDir(this.value || '') : '',
  1946. 'id': this.id,
  1947. 'readOnly': this.readOnly,
  1948. 'name': this.name,
  1949. 'inputType': this.inputType,
  1950. 'inputClass': this.inputClass,
  1951. 'inputStyles': this.inputStyles,
  1952. 'ellipses': this.ellipses,
  1953. 'placeHolderText': this.placeHolderText,
  1954. 'ariaLabel': this.ariaLabel,
  1955. 'newLook': this.newLook,
  1956. 'showInlineError': this.showInlineError
  1957. };
  1958. },
  1959. /**
  1960. * return the html template
  1961. */
  1962. getHTMLTemplate: function getHTMLTemplate() {
  1963. return inputTemplate;
  1964. },
  1965. doRender: function doRender() {
  1966. var sHtml = dot.template(this.getHTMLTemplate())(this.getTemplateOptions());
  1967. this.$el.append(sHtml);
  1968. if (this.disabled) {
  1969. this.disable();
  1970. }
  1971. return Promise.resolve(true);
  1972. },
  1973. setValue: function setValue(text) {
  1974. var $input = this.getPropertyNode().find('input');
  1975. if ($input.length > 0) {
  1976. $input.val(text);
  1977. } else {
  1978. this.getPropertyNode().find('.propertyValue').text(text);
  1979. }
  1980. this.processEllipses();
  1981. this._onChange(this.name, text);
  1982. this._updateHintTextPlacement();
  1983. },
  1984. getValue: function getValue() {
  1985. var $input = this.getPropertyNode().find('input');
  1986. if ($input.length > 0) {
  1987. return $input.val();
  1988. }
  1989. return '';
  1990. },
  1991. showError: function showError(errorMessage) {
  1992. if (this.errorMessageNode) {
  1993. this.errorMessageNode.attr('title', errorMessage);
  1994. } else {
  1995. this.errorMessageNode = $('<div>', {
  1996. 'tabindex': 0,
  1997. 'title': errorMessage,
  1998. 'class': 'inlineValidationIcon'
  1999. });
  2000. $('<svg><use style="pointer-events: none;" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#common-failed"></use></svg>').appendTo(this.errorMessageNode);
  2001. Utils.embedSVGIcon(this.errorMessageNode);
  2002. var inputContainer = this.getPropertyNode().find('.inputContainer');
  2003. inputContainer.append(this.errorMessageNode);
  2004. inputContainer.find('input').addClass('error');
  2005. }
  2006. },
  2007. hideError: function hideError() {
  2008. if (this.errorMessageNode) {
  2009. this.errorMessageNode.remove();
  2010. this.getPropertyNode().find('input').removeClass('error');
  2011. this.errorMessageNode = null;
  2012. }
  2013. },
  2014. _onKeyUp: function _onKeyUp() {
  2015. this._updateHintTextPlacement();
  2016. },
  2017. _updateHintTextPlacement: function _updateHintTextPlacement() {
  2018. var value = this.getValue();
  2019. if (this.newLook && this.placeHolderText) {
  2020. var labelNode = this.getPropertyNode().find('.inputHintText');
  2021. if (value === '') {
  2022. labelNode.html('&nbsp;');
  2023. } else {
  2024. labelNode.text(this.placeHolderText);
  2025. }
  2026. }
  2027. }
  2028. });
  2029. return Input;
  2030. });
  2031. //# sourceMappingURL=Input.js.map
  2032. ;
  2033. 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';});
  2034. /*
  2035. *+------------------------------------------------------------------------+
  2036. *| Licensed Materials - Property of IBM
  2037. *| IBM Cognos Products: Content Explorer
  2038. *| (C) Copyright IBM Corp. 2015, 2021
  2039. *|
  2040. *| US Government Users Restricted Rights - Use, duplication or disclosure
  2041. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  2042. *+------------------------------------------------------------------------+
  2043. */
  2044. 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) {
  2045. 'use strict';
  2046. var SingleLineValue = BaseProperty.extend({
  2047. /**
  2048. * Creates a property with single line and read-only value.
  2049. * @param options.el {node}- parent element
  2050. * @param options.name {string} - property name
  2051. * @param options.label {string} - property label
  2052. * @param options.value {string} - property value
  2053. * @param options.disabled {boolean}{optional} - default is false, set to true if you want the control disabled
  2054. * @param options.readOnly {boolean}{optional} - default is false. If true, the UI will be rendered in a read-only mode
  2055. * @param options.editable {boolean}{optional} - default is false, if true the text value can be edited inline
  2056. * @param options.editCallback {function}{optional} - callback to call when the secondary edit icon is clicked
  2057. * @param options.id {string} - unique id
  2058. * @param options.onChange {function}{optional} - the callback function called when property value had been edited
  2059. * @param options.indent {int} - default 0, will indent by options.indent * 10px
  2060. * @param options.multiline {boolean} - default false, if true the value will be on a separate line
  2061. * @param options.inputType {string} - default is text, but can set to password or anything supported by HTML
  2062. * @param options.iSTT {boolean}{optional} - if true the text is displayed as Strutured Text (bidi feature)
  2063. * @param options.ellipses {boolean}{optional} - default is true, truncates text with ellipses
  2064. */
  2065. init: function init(options) {
  2066. this.events = {};
  2067. if (options.editCallback) {
  2068. this.events['clicktap .secondaryEdit' + options.id] = '_handleClick';
  2069. this.events['keydown .property_' + options.id] = '_handleKeyDown';
  2070. }
  2071. if (options.editable) {
  2072. this.events['keydown .editable' + options.id] = '_colorInputBorder';
  2073. }
  2074. var defaultParams = {
  2075. inputType: 'text',
  2076. ellipses: true
  2077. };
  2078. SingleLineValue.inherited('init', this, arguments);
  2079. _.extend(this, defaultParams, options);
  2080. this.ellipses = this.inputType === 'password' ? false : this.ellipses;
  2081. },
  2082. doRender: function doRender() {
  2083. SingleLineValue.inherited('doRender', this, arguments);
  2084. var sHtml = dot.template(singleLineValue)({
  2085. 'label': this.label,
  2086. 'value': !this.isSTT || BidiUtil.userPreferredTextDir === '' ? this.value : BidiUtil.enforceTextDirectionForSTT(this.value),
  2087. 'direction': !this.isSTT ? BidiUtil.resolveBaseTextDir(this.value || '') : '',
  2088. 'editCallback': this.editCallback ? true : false,
  2089. 'id': this.id,
  2090. 'editable': this.editable && !this.readOnly,
  2091. 'readOnly': this.readOnly,
  2092. 'name': this.name,
  2093. 'multiline': this.multiline,
  2094. 'inputType': this.inputType,
  2095. 'strings': {
  2096. 'edit': StringResource.get('edit')
  2097. },
  2098. 'labelTitle': this.title || ''
  2099. });
  2100. this.$el.append(sHtml);
  2101. if (this.svgIconClickCallback) {
  2102. this.getPropertyNode().find('.svgIconClickCallback' + this.id).on('clicktap', function () {
  2103. this._handleSvgIconClick();
  2104. }.bind(this));
  2105. }
  2106. return this._renderInput().then(function () {
  2107. if (this.disabled) {
  2108. this.disable();
  2109. }
  2110. this._colorInputBorder();
  2111. }.bind(this));
  2112. },
  2113. //called when the parent is resized.
  2114. onResize: function onResize() {
  2115. //update the text so it can re-ellipseseses it.
  2116. this.setValue(!this.isSTT || BidiUtil.userPreferredTextDir === '' ? this.value : BidiUtil.enforceTextDirectionForSTT(this.value));
  2117. },
  2118. _renderInput: function _renderInput() {
  2119. this.inputPlaceholder = this.$el.find('.placeholder_Input' + this.id);
  2120. if (this.inputPlaceholder.length > 0) {
  2121. this.ellipses = false; // The input control will handle it's own ellipses
  2122. this.editable = false; // THe input ia the one that can be edited, not the SingleLineValue
  2123. this._inputControl = new Input({
  2124. 'el': this.inputPlaceholder[0],
  2125. 'name': this.name,
  2126. 'value': this.value,
  2127. 'readOnly': this.readOnly,
  2128. 'disabled': this.disabled,
  2129. 'id': this.id,
  2130. 'onChange': this.onChange,
  2131. 'inputType': this.inputType,
  2132. 'inputClass': this.multiline ? '' : 'rightAlign',
  2133. 'ariaLabel': this.ariaLabel,
  2134. 'validator': this.validator,
  2135. 'isString': this.isString
  2136. });
  2137. return this._inputControl.render();
  2138. } else {
  2139. return Promise.resolve();
  2140. }
  2141. },
  2142. _colorInputBorder: function _colorInputBorder() {
  2143. var isEmpty = this.getHTMLControl().val();
  2144. if (isEmpty === '') {
  2145. this.getHTMLControl().addClass('empty');
  2146. } else {
  2147. this.getHTMLControl().removeClass('empty');
  2148. }
  2149. },
  2150. _handleKeyDown: function _handleKeyDown(evt) {
  2151. console.log('key down');
  2152. if (evt.keyCode === 32 || evt.keyCode === 13) {
  2153. // space || enter
  2154. this._handleClick();
  2155. }
  2156. },
  2157. _handleClick: function _handleClick() {
  2158. if (this.editCallback) {
  2159. this.editCallback();
  2160. }
  2161. },
  2162. _handleSvgIconClick: function _handleSvgIconClick() {
  2163. if (this.svgIconClickCallback) {
  2164. this.svgIconClickCallback();
  2165. }
  2166. },
  2167. disable: function disable() {
  2168. if (this.editCallback) {
  2169. if (!this._clickable) {
  2170. this._clickable = this.getPropertyNode().find('.clickable');
  2171. }
  2172. if (!this._secondaryEdit) {
  2173. this._secondaryEdit = this.getPropertyNode().find('.secondaryEdit' + this.id);
  2174. }
  2175. this._clickable.removeClass('clickable blueText');
  2176. this._secondaryEdit.removeClass('blueArrow secondaryEdit' + this.id);
  2177. }
  2178. if (this._inputControl) {
  2179. this._inputControl.disable();
  2180. }
  2181. if (this.editable) {
  2182. SingleLineValue.inherited('disable', this, arguments);
  2183. }
  2184. },
  2185. enable: function enable() {
  2186. if (this._clickable) {
  2187. this._clickable.addClass('clickable blueText');
  2188. }
  2189. if (this._secondaryEdit) {
  2190. this._secondaryEdit.addClass('blueArrow secondaryEdit' + this.id);
  2191. }
  2192. if (this._inputControl) {
  2193. this._inputControl.enable();
  2194. }
  2195. if (this.editable) {
  2196. SingleLineValue.inherited('enable', this, arguments);
  2197. }
  2198. },
  2199. setValue: function setValue(text) {
  2200. if (this._inputControl) {
  2201. this._inputControl.setValue(text);
  2202. } else {
  2203. this.getPropertyNode().find('.propertyValue').text(text);
  2204. }
  2205. this.processEllipses();
  2206. this._onChange(this.name, text);
  2207. this._colorInputBorder();
  2208. },
  2209. getModifiedProperties: function getModifiedProperties() {
  2210. var result = $.extend({}, SingleLineValue.inherited('getModifiedProperties', this, arguments));
  2211. if (this._inputControl) {
  2212. $.extend(result, this._inputControl.getModifiedProperties());
  2213. }
  2214. return result;
  2215. }
  2216. });
  2217. return SingleLineValue;
  2218. });
  2219. //# sourceMappingURL=SingleLineValue.js.map
  2220. ;
  2221. 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';});
  2222. /*
  2223. *+------------------------------------------------------------------------+
  2224. *| Licensed Materials - Property of IBM
  2225. *| IBM Cognos Products: Content Explorer
  2226. *| (C) Copyright IBM Corp. 2015, 2017
  2227. *|
  2228. *| US Government Users Restricted Rights - Use, duplication or disclosure
  2229. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  2230. *+------------------------------------------------------------------------+
  2231. */
  2232. 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, _) {
  2233. 'use strict';
  2234. var DropDown = BaseProperty.extend({
  2235. /**
  2236. * Creates a property with round checkbox.
  2237. * @param options.id {string} - property id
  2238. * @param options.el {node} - parent element
  2239. * @param options.name {string} - property name
  2240. * @param options.label {string} - property label
  2241. * @param options.responsive {boolean} - default is true, whether or not we switch to a full page flyout for menus with a lot of items
  2242. * @param options.disabled {boolean} - default is false, set to true if you want the control disabled
  2243. * @param options.defaultValue {string} - the value of the option that should be selected by default
  2244. * @param options.style {string} - css styles to apply to the select control
  2245. * @param options.options {array} - Array of objects for each option in the select control
  2246. * options.options.label {string} - Label for the option in the select control
  2247. * options.options.value {string} - Value for the option in the select control
  2248. * options.options.selected {boolean} - true if the option should be selected by default
  2249. * options.options.cssClass {string} - cssClass for the option in the select control
  2250. * @param options.onChange {function} - callback to be notified as soon as the change happens
  2251. * @param options.ariaDescribedby {optional: string} - use this option to provide more information for screen readers
  2252. *
  2253. * The following params pertains to the slideout overlay
  2254. * @param options.position {string} - Default is right. Indicates slideout position. Value is either 'right' or 'left'.
  2255. * @param options.parentEl {optional: jQuery element} - Container element.
  2256. * @param options.indent {int} - default 0, will indent by options.indent * 10px
  2257. * @param options.readOnly {boolean} - optional, default is false. If true, the UI will be rendered in a read-only mode
  2258. * @param options.nestedUIControl {boolean} - optional, default is false. Set to true if this UI Widget is being rendered by another UI Widget
  2259. * @param options.ariaLabel {string} - if you want to override the default label for screen readers
  2260. */
  2261. position: 'right',
  2262. ellipses: true,
  2263. init: function init(options) {
  2264. this.events = {};
  2265. this.events['change .dropDown' + options.id] = '_handleChange';
  2266. this.nestedUIControl = false;
  2267. DropDown.inherited('init', this, arguments);
  2268. _.extend(this, options);
  2269. },
  2270. doRender: function doRender() {
  2271. // If there are >10 items and the parent element is provided, switch to a singleLineValue
  2272. // with a editCallback. This is to have a full page select slideout.
  2273. if (this.glassContext && this.responsive !== false && this.options.length > 10) {
  2274. if (this.parentEl) {
  2275. this._renderSingleSelectValue();
  2276. return;
  2277. }
  2278. }
  2279. this._renderCheckbox();
  2280. },
  2281. _renderSingleSelectValue: function _renderSingleSelectValue() {
  2282. this.selectedIndex = 0; // Default to the first one in the options list
  2283. var selected = _.find(this.options, function (options) {
  2284. return options.selected;
  2285. });
  2286. var value = selected ? selected.value : this.defaultValue;
  2287. if (value) {
  2288. for (var i = 0; i < this.options.length; i++) {
  2289. if (value === this.options[i].value) {
  2290. this.selectedIndex = i;
  2291. break;
  2292. }
  2293. }
  2294. }
  2295. this._singleLineValue = new SingleLineValue({
  2296. 'el': this.$el,
  2297. 'name': this.name,
  2298. 'label': this.label,
  2299. 'value': this.options[this.selectedIndex].label,
  2300. 'editCallback': this._showPropertyEditView.bind(this),
  2301. 'id': this.id,
  2302. 'onChange': this._onChange.bind(this),
  2303. 'disabled': this.disabled,
  2304. 'indent': this.indent || 0,
  2305. 'readOnly': this.readOnly
  2306. });
  2307. this._singleLineValue.render();
  2308. },
  2309. _renderCheckbox: function _renderCheckbox() {
  2310. var sHtml = dot.template(dropDownTemplate)({
  2311. 'label': this.label,
  2312. 'selected': this.checked,
  2313. 'id': this.id,
  2314. 'defaultValue': this.defaultValue,
  2315. 'options': this.options,
  2316. 'name': this.name,
  2317. 'readOnly': this.readOnly || this.disabled,
  2318. 'nestedUIControl': this.nestedUIControl,
  2319. 'ariaLabel': this.ariaLabel,
  2320. 'ariaDescribedby': this.ariaDescribedby,
  2321. 'style': this.style,
  2322. 'coachMark': this.coachMark
  2323. });
  2324. this.$el.append(sHtml);
  2325. if (this.coachMark && _.isFunction(this.coachMark.render)) {
  2326. this.coachMark.render({
  2327. $el: this.$el.find('.coachMarkContainer'),
  2328. glassContext: this.glassContext
  2329. });
  2330. }
  2331. },
  2332. getHTMLControl: function getHTMLControl() {
  2333. if (!this._$select) {
  2334. this._$select = $('.dropDown' + this.id);
  2335. }
  2336. return this._$select;
  2337. },
  2338. enable: function enable() {
  2339. this.disabled = false;
  2340. if (this._singleLineValue) {
  2341. this._singleLineValue.enable();
  2342. } else {
  2343. DropDown.inherited('enable', this, arguments);
  2344. }
  2345. this.getPropertyNode().removeClass('disabled');
  2346. },
  2347. disable: function disable() {
  2348. this.disabled = true;
  2349. if (this._singleLineValue) {
  2350. this._singleLineValue.disable();
  2351. } else {
  2352. DropDown.inherited('disable', this, arguments);
  2353. }
  2354. this.getPropertyNode().addClass('disabled');
  2355. },
  2356. _handleChange: function _handleChange(event) {
  2357. this._onChange(this.name, $(event.currentTarget)[0].value);
  2358. if (Utils.isIpad()) {
  2359. // ipad dropdown do not close when selecting it, force it by tapping on the button again
  2360. $(event.currentTarget).trigger('tap');
  2361. }
  2362. },
  2363. getSelectedValue: function getSelectedValue() {
  2364. return this.getHTMLControl().find('option:selected').attr('value');
  2365. },
  2366. _onPropertyEditViewClose: function _onPropertyEditViewClose(modifiedProperty) {
  2367. if (!this._oPropertyEditView) {
  2368. return;
  2369. }
  2370. if (!modifiedProperty && this._oPropertyEditView.contentView && this._oPropertyEditView.contentView.getModifiedProperties) {
  2371. modifiedProperty = this._oPropertyEditView.contentView.getModifiedProperties();
  2372. }
  2373. this._oPropertyEditView.hide();
  2374. this._oPropertyEditView = null;
  2375. if (modifiedProperty) {
  2376. var newValue = modifiedProperty[this.name];
  2377. for (var i = 0; i < this.options.length; i = i + 1) {
  2378. if (this.options[i].value === newValue) {
  2379. this.selectedIndex = i;
  2380. break;
  2381. }
  2382. }
  2383. // Update the text with the new value
  2384. this.getPropertyNode().find('.propertyValue').text(this.options[this.selectedIndex].label);
  2385. this._onChange(this.name, newValue);
  2386. this.processEllipses();
  2387. }
  2388. this.setFocus();
  2389. },
  2390. /**
  2391. Property sheet is closing, make sure our PropertyEditView (if open) gets cloased and
  2392. the new value is updated
  2393. **/
  2394. onClose: function onClose() {
  2395. return DropDown.inherited('onClose', this, arguments).then(this._onPropertyEditViewClose.bind(this));
  2396. },
  2397. /**
  2398. Build up radio buttons for show in the PropertyEditView
  2399. **/
  2400. _showPropertyEditView: function _showPropertyEditView() {
  2401. var overlaySlideoutEl = $('<div></div>');
  2402. this.parentEl.append(overlaySlideoutEl);
  2403. var overlaySlideout = new Slideout({
  2404. 'glassContext': this.glassContext,
  2405. 'position': this.position,
  2406. 'el': overlaySlideoutEl,
  2407. 'content': this._getPropertyEditViewSpec(),
  2408. 'width': this.parentEl.width(),
  2409. 'enableTabLooping': true
  2410. });
  2411. overlaySlideout.render().then(function () {
  2412. overlaySlideout.show();
  2413. });
  2414. this._oPropertyEditView = overlaySlideout;
  2415. },
  2416. _getPropertyEditViewSpec: function _getPropertyEditViewSpec() {
  2417. var radioButtons = [];
  2418. $.each(this.options, function (index, option) {
  2419. radioButtons.push({
  2420. 'label': option.label,
  2421. 'value': option.value
  2422. });
  2423. }.bind(this));
  2424. var spec = {
  2425. 'module': '../ui/properties/PropertyUIControl',
  2426. 'closeCallback': this._onPropertyEditViewClose.bind(this),
  2427. 'setFocusCallback': function (propertyUIControl) {
  2428. propertyUIControl.setFocus(this.name);
  2429. }.bind(this),
  2430. 'items': [{
  2431. 'value': this.label,
  2432. 'centerLabel': true,
  2433. 'type': 'Banner',
  2434. 'backButton': true,
  2435. 'ariaLabel': this.ariaLabel || this.label
  2436. }, {
  2437. 'type': 'RadioButtonGroup',
  2438. 'name': this.name,
  2439. 'separator': true,
  2440. 'ariaLabel': this.ariaLabel || this.label,
  2441. 'value': this.options[this.selectedIndex].value,
  2442. 'items': radioButtons
  2443. }]
  2444. };
  2445. return spec;
  2446. },
  2447. setValue: function setValue(value, fireOnChange) {
  2448. // Find the index of the given value.
  2449. for (var i = 0; i < this.options.length; i = i + 1) {
  2450. if (this.options[i].value === value) {
  2451. this.selectedIndex = i;
  2452. break;
  2453. }
  2454. }
  2455. if (this._singleLineValue) {
  2456. this._singleLineValue.setValue(this.options[i].label, false);
  2457. } else {
  2458. this.getHTMLControl().val(value);
  2459. }
  2460. if (fireOnChange) {
  2461. this._onChange(this.name, value);
  2462. }
  2463. }
  2464. });
  2465. return DropDown;
  2466. });
  2467. //# sourceMappingURL=DropDown.js.map
  2468. ;
  2469. /*
  2470. *+------------------------------------------------------------------------+
  2471. *| Licensed Materials - Property of IBM
  2472. *| IBM Cognos Products: Content Explorer
  2473. *| (C) Copyright IBM Corp. 2015, 2017
  2474. *|
  2475. *| US Government Users Restricted Rights - Use, duplication or disclosure
  2476. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  2477. *+------------------------------------------------------------------------+
  2478. */
  2479. define('baglass/core-client/js/core-client/ui/properties/Footer',['./PropertyContainerBaseClass', 'jquery', 'underscore'], function (PropertyContainerBaseClass, $, _) {
  2480. 'use strict';
  2481. var Footer = PropertyContainerBaseClass.extend({
  2482. ellipses: true,
  2483. /**
  2484. @param options.el {node} - container DOM node
  2485. @param options.items {array} - array of controls to render. Currently only been tested with buttons
  2486. **/
  2487. init: function init(options) {
  2488. this.events = {};
  2489. Footer.inherited('init', this, arguments);
  2490. _.extend(this, options);
  2491. },
  2492. doRender: function doRender() {
  2493. var $footer = $('<footer></footer>');
  2494. this.$el.append($footer);
  2495. this.initUIControl($footer[0]);
  2496. return this._oPropertyUIControl.render();
  2497. }
  2498. });
  2499. return Footer;
  2500. });
  2501. //# sourceMappingURL=Footer.js.map
  2502. ;
  2503. 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';});
  2504. /*
  2505. *+------------------------------------------------------------------------+
  2506. *| Licensed Materials - Property of IBM
  2507. *| IBM Cognos Products: Content Explorer
  2508. *| (C) Copyright IBM Corp. 2015, 2017
  2509. *|
  2510. *| US Government Users Restricted Rights - Use, duplication or disclosure
  2511. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  2512. *+------------------------------------------------------------------------+
  2513. */
  2514. 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, _) {
  2515. 'use strict';
  2516. var HierarchicalList = BaseProperty.extend({
  2517. /**
  2518. * Creates a property with a hierarchical list of parents children. Read-only
  2519. * @param options.el {node} - parent element
  2520. * @param options.data [string] - hierarchical data
  2521. * example:
  2522. *[{
  2523. * "defaultName": "Parent1",
  2524. * "children": [{
  2525. * "defaultName": "Child1"
  2526. * },
  2527. * {
  2528. * "defaultName": "Child2"
  2529. * }
  2530. * ]
  2531. *},
  2532. {
  2533. * "defaultName": "Parent2,
  2534. * "children": []
  2535. *}]
  2536. */
  2537. init: function init(options) {
  2538. if (!this.events) {
  2539. this.events = {};
  2540. }
  2541. this.events['keydown .editable' + options.id] = '_handleEditKeydown';
  2542. HierarchicalList.inherited('init', this, arguments);
  2543. _.extend(this, options);
  2544. },
  2545. doRender: function doRender() {
  2546. var sHtml = dot.template(listTemplate)({
  2547. 'data': this.data
  2548. });
  2549. this.$el.append(sHtml);
  2550. this._setAutoGrow();
  2551. return;
  2552. },
  2553. _setAutoGrow: function _setAutoGrow() {
  2554. var listTable = this.$el.find('table').get(0);
  2555. if (listTable && listTable.scrollHeight > listTable.clientHeight) {
  2556. $(listTable).addClass('capEditableHeight');
  2557. listTable.style.height = listTable.scrollHeight + 'px';
  2558. }
  2559. }
  2560. });
  2561. return HierarchicalList;
  2562. });
  2563. //# sourceMappingURL=HierarchicalList.js.map
  2564. ;
  2565. 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>';});
  2566. /*
  2567. *+------------------------------------------------------------------------+
  2568. *| Licensed Materials - Property of IBM
  2569. *| IBM Cognos Products: Content Explorer
  2570. *| (C) Copyright IBM Corp. 2015, 2017
  2571. *|
  2572. *| US Government Users Restricted Rights - Use, duplication or disclosure
  2573. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  2574. *+------------------------------------------------------------------------+
  2575. */
  2576. define('baglass/core-client/js/core-client/ui/properties/HintText',['./BaseProperty', 'text!./templates/HintText.html', 'doT', 'underscore'], function (BaseProperty, HintTextTemplate, dot, _) {
  2577. 'use strict';
  2578. var HintText = BaseProperty.extend({
  2579. ellipses: true,
  2580. /**
  2581. @param options.el {node} - container DOM node
  2582. @param options.label {string} - the text to display
  2583. @param options.visibility {string} - the css visibility style, default to visible
  2584. **/
  2585. init: function init(options) {
  2586. this.visibility = 'visible';
  2587. HintText.inherited('init', this, arguments);
  2588. _.extend(this, options);
  2589. },
  2590. doRender: function doRender() {
  2591. var sHtml = dot.template(HintTextTemplate)({
  2592. 'label': this.label,
  2593. 'id': this.id,
  2594. 'name': this.name,
  2595. 'svgIcon': this.svgIcon,
  2596. 'svgIconClass': this.svgIconClass ? this.svgIconClass : ''
  2597. });
  2598. this.$el.append(sHtml);
  2599. this.setVisibility(this.visibility);
  2600. this.$el.append(this._hintTextNode);
  2601. },
  2602. setVisibility: function setVisibility(visibility) {
  2603. this.getPropertyNode().css('visibility', visibility);
  2604. }
  2605. });
  2606. return HintText;
  2607. });
  2608. //# sourceMappingURL=HintText.js.map
  2609. ;
  2610. 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';});
  2611. /*
  2612. *+------------------------------------------------------------------------+
  2613. *| Licensed Materials - Property of IBM
  2614. *| IBM Cognos Products: Content Explorer
  2615. *| (C) Copyright IBM Corp. 2015, 2017
  2616. *|
  2617. *| US Government Users Restricted Rights - Use, duplication or disclosure
  2618. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  2619. *+------------------------------------------------------------------------+
  2620. */
  2621. define('baglass/core-client/js/core-client/ui/properties/RadioButtonGroup',['./BaseProperty', 'text!./templates/RadioButtonGroup.html', 'jquery', 'doT', 'underscore', '../KeyCodes'], function (BaseProperty, radioButtonTemplate, $, dot, _, KeyCodes) {
  2622. 'use strict';
  2623. var RadioButton = BaseProperty.extend({
  2624. /**
  2625. * Creates a property with round checkbox.
  2626. * @param options.id {string} - property id
  2627. * @param options.el {node} - parent element
  2628. * @param options.name {string} - property name
  2629. * @param options.separator {boolean} - wether to draw a horizontal separator between each radio button
  2630. * @param options.value {string} - current value of the radio group
  2631. * @param options.items {array} - array of radio buttons
  2632. * @param options.items.label {string} - property label
  2633. * @param options.items.value {string} - value for the radioButton
  2634. * @param options.onChange {function} - callback to be notified as soon as the change happens
  2635. * @param options.controlOnLeft {boolean} - default to false, if true the control will be on the left
  2636. * @param options.indent {int} - default 0, will indent by options.indent * 10px
  2637. * @param options.readOnly {boolean} - optional, default is false. If true, the UI will be rendered in a read-only mode
  2638. * @param options.ariaLabel {string} - radio button group name for screen reader
  2639. * @param options.selectOnNavigation {boolen} - should moving between the radio button automatically select them
  2640. */
  2641. defaultValue: null,
  2642. init: function init(options) {
  2643. this.events = {};
  2644. this.events['primaryaction .property_' + options.id] = '_handleClick';
  2645. RadioButton.inherited('init', this, arguments);
  2646. _.extend(this, options);
  2647. this.defaultValue = this.value;
  2648. // Make sure we default selectOnNavigation to true
  2649. if (this.selectOnNavigation !== false) {
  2650. this.selectOnNavigation = true;
  2651. }
  2652. },
  2653. doRender: function doRender() {
  2654. var sHtml = dot.template(radioButtonTemplate)({
  2655. 'id': this.id,
  2656. 'value': this.value,
  2657. 'name': this.name,
  2658. 'items': this.items.map(function (item) {
  2659. item.label = _.escape(item.label);
  2660. return item;
  2661. }),
  2662. 'separator': this.separator,
  2663. 'length': this.items.length - 1,
  2664. 'controlOnLeft': this.controlOnLeft,
  2665. 'readOnly': this.readOnly,
  2666. 'ariaLabel': this.ariaLabel,
  2667. 'selectOnNavigation': this.selectOnNavigation
  2668. });
  2669. this.$el.append(sHtml);
  2670. this._postRender();
  2671. return;
  2672. },
  2673. /**
  2674. @override - Property UI control is a little different, each of the li elements has the property_<id> class. Override it so that the getPropertyNode
  2675. function returns the ul element
  2676. **/
  2677. getPropertyNode: function getPropertyNode() {
  2678. if (!this._propertyNode) {
  2679. this._propertyNode = this.$el.find('.radiogroup_' + this.id);
  2680. }
  2681. if (this._propertyNode.length === 0) {
  2682. this._propertyNode = this.$el;
  2683. }
  2684. return this._propertyNode;
  2685. },
  2686. _postRender: function _postRender() {
  2687. this._$radioGroupNode = this.$el.find('ul.radiogroup_' + this.id);
  2688. this._$radioGroupNode.find('li.radioButton').keydown(function (evt) {
  2689. this._handleKeyDown(evt);
  2690. }.bind(this));
  2691. if (this.disabled) {
  2692. this.disable();
  2693. }
  2694. },
  2695. _selectRow: function _selectRow(rowNode) {
  2696. var $rowNode = $(rowNode);
  2697. this._uncheckCurrentSelection();
  2698. $rowNode.attr('aria-checked', 'true');
  2699. $rowNode.addClass('checked');
  2700. $rowNode.attr('tabindex', '0');
  2701. var value = $rowNode.data('value');
  2702. this._onChange(this.name, value);
  2703. },
  2704. _handleClick: function _handleClick(event) {
  2705. this._selectRow(event.currentTarget);
  2706. event.stopPropagation();
  2707. return false;
  2708. },
  2709. _hasValueChanged: function _hasValueChanged(propertyValue) {
  2710. if (propertyValue === this.checked) {
  2711. return false;
  2712. }
  2713. return true;
  2714. },
  2715. enable: function enable() {
  2716. if (this.readOnly) {
  2717. return;
  2718. }
  2719. this._setDisabled(false);
  2720. },
  2721. disable: function disable() {
  2722. this._setDisabled(true);
  2723. },
  2724. _setDisabled: function _setDisabled(disabled) {
  2725. this._$radioGroupNode.find('li.radioButton').each(function (index, row) {
  2726. var $row = $(row);
  2727. if (disabled) {
  2728. $row.addClass('disabled');
  2729. $row.attr('aria-disabled', 'true');
  2730. } else {
  2731. $row.removeClass('disabled');
  2732. $row.attr('aria-disabled', 'false');
  2733. }
  2734. });
  2735. },
  2736. _uncheckCurrentSelection: function _uncheckCurrentSelection() {
  2737. var $currentFocusedRow = this._$radioGroupNode.find('li.checked');
  2738. $currentFocusedRow.removeClass('checked');
  2739. $currentFocusedRow.attr('aria-checked', 'false');
  2740. if (this.selectOnNavigation) {
  2741. $currentFocusedRow.attr('tabindex', '-1');
  2742. }
  2743. },
  2744. getValue: function getValue() {
  2745. var $currentFocusedRow = this._$radioGroupNode.find('li.checked');
  2746. return $currentFocusedRow.data('value');
  2747. },
  2748. setValue: function setValue(value, fireOnChange) {
  2749. this._uncheckCurrentSelection();
  2750. var givenValueNode = this._$radioGroupNode.find('li[data-value=' + value + ']')[0];
  2751. value = givenValueNode ? value : null;
  2752. if (givenValueNode) {
  2753. this._selectRow(givenValueNode);
  2754. }
  2755. if (fireOnChange) {
  2756. this._onChange(this.name, value);
  2757. }
  2758. },
  2759. reset: function reset() {
  2760. var $defaultValueNode = this._$radioGroupNode.find('li[data-value="' + this.defaultValue + '"]');
  2761. this._selectRow($defaultValueNode);
  2762. },
  2763. _handleKeyDown: function _handleKeyDown(evt) {
  2764. if (evt.keyCode === KeyCodes.UP_ARROW || evt.keyCode === KeyCodes.DOWN_ARROW || evt.keyCode === KeyCodes.LEFT_ARROW || evt.keyCode === KeyCodes.RIGHT_ARROW) {
  2765. var currentFocusedRow = this._$radioGroupNode.find('li.checked');
  2766. if (!currentFocusedRow.length) {
  2767. currentFocusedRow = $(evt.currentTarget);
  2768. }
  2769. var $nextNode;
  2770. if (evt.keyCode === KeyCodes.UP_ARROW || evt.keyCode === KeyCodes.LEFT_ARROW) {
  2771. $nextNode = currentFocusedRow.prevAll('li.radioButton').first();
  2772. if ($nextNode.length === 0) {
  2773. $nextNode = currentFocusedRow.nextAll('li.radioButton').last();
  2774. }
  2775. } else {
  2776. $nextNode = currentFocusedRow.nextAll('li.radioButton').first();
  2777. if ($nextNode.length === 0) {
  2778. $nextNode = currentFocusedRow.prevAll('li.radioButton').last();
  2779. }
  2780. }
  2781. if (this.selectOnNavigation) {
  2782. this._selectRow($nextNode);
  2783. }
  2784. $nextNode.focus();
  2785. evt.preventDefault();
  2786. return false;
  2787. }
  2788. }
  2789. });
  2790. return RadioButton;
  2791. });
  2792. //# sourceMappingURL=RadioButtonGroup.js.map
  2793. ;
  2794. 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';});
  2795. /**
  2796. * Licensed Materials - Property of IBM
  2797. * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2015, 2017
  2798. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  2799. */
  2800. define('baglass/core-client/js/core-client/ui/properties/HorizontalRadioButtonGroup',['./RadioButtonGroup', 'text!./templates/HorizontalRadioButtonGroup.html', 'jquery', 'doT'], function (RadioButtonGroup, template, $, dot) {
  2801. 'use strict';
  2802. var HorizontalRadioButtonGroup = RadioButtonGroup.extend({
  2803. /**
  2804. * Creates a property with radio buttons displayed horizontally.
  2805. *
  2806. * @param options.id {string} - property id
  2807. * @param options.el {node} - parent element
  2808. * @param options.name {string} - property name
  2809. * @param options.value {string} - current value of the radio group
  2810. * @param options.items {array} - array of radio buttons
  2811. * @param options.items.label {string} - radio option label
  2812. * @param options.items.value {string} - value for the radioButton
  2813. * @param options.onChange {function} - callback to be notified as soon as the change happens
  2814. * @param options.indent {int} - default 0, will indent by options.indent * 10px
  2815. * @param options.readOnly {boolean} - optional, default is false. If true, the UI will be rendered in a read-only mode
  2816. * @param options.label - radio group label
  2817. * @param options.ariaLabel - {string} not optional if options.label is missing. Use for accessible purposes.
  2818. */
  2819. init: function init() {
  2820. HorizontalRadioButtonGroup.inherited('init', this, arguments);
  2821. },
  2822. doRender: function doRender() {
  2823. var sHtml = dot.template(template)({
  2824. 'id': this.id,
  2825. 'label': this.label,
  2826. 'value': this.value,
  2827. 'name': this.name,
  2828. 'items': this.items,
  2829. 'readOnly': this.readOnly,
  2830. 'ariaLabel': this.ariaLabel
  2831. });
  2832. this.$el.append(sHtml);
  2833. this._postRender();
  2834. return;
  2835. },
  2836. enable: function enable() {
  2837. if (this.readOnly) {
  2838. return;
  2839. }
  2840. this._setDisabled(false);
  2841. },
  2842. disable: function disable() {
  2843. this._setDisabled(true);
  2844. },
  2845. _setDisabled: function _setDisabled(disabled) {
  2846. var $hRBGroup = this.$el.find('.hradioButtonGroup_' + this.id);
  2847. if (disabled) {
  2848. $hRBGroup.addClass('disabled');
  2849. } else {
  2850. $hRBGroup.removeClass('disabled');
  2851. }
  2852. HorizontalRadioButtonGroup.inherited('_setDisabled', this, arguments);
  2853. }
  2854. });
  2855. return HorizontalRadioButtonGroup;
  2856. });
  2857. //# sourceMappingURL=HorizontalRadioButtonGroup.js.map
  2858. ;
  2859. 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';});
  2860. /*
  2861. * Licensed Materials - Property of IBM
  2862. * IBM Cognos Products: Content Explorer
  2863. * (C) Copyright IBM Corp. 2017
  2864. *
  2865. * US Government Users Restricted Rights - Use, duplication or disclosure
  2866. * restricted by GSA ADP Schedule Contract with IBM Corp.
  2867. */
  2868. 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) {
  2869. 'use strict';
  2870. var IconCollection = BaseProperty.extend({
  2871. /**
  2872. * Creates a property with the given list of icons that perform an action on
  2873. * a mouse click or iPad tap events as well as on drag'n'drop events (with mouse or touch)
  2874. * and on key down event (space or enter) when an item is focuse.
  2875. *
  2876. * @param options.id {string} - property id
  2877. * @param options.el {node} - parent element
  2878. * @param options.label {string} - property label
  2879. * @param options.items {array} - array of icons
  2880. * @param options.items.label {string} - icon label
  2881. * @param options.items.name {string} - icon name
  2882. * @param options.items.icon {string} - name of the SVG in the SVG bundle
  2883. * @param options.items.svg {string} - the direct SVG to display
  2884. * @param options.items.content {object} - an object that contains more information to use when clicking/dragging an item
  2885. * @param options.readOnly {boolean} - optional, default is false. If true, the UI will be rendered in a read-only mode
  2886. * @param options.nestedUIControl {boolean} - optional, default is false. Set to true if this UI Widget is being rendered by another UI Widget
  2887. * @param options.ariaLabel {string} - optional, if you want to override the default label for screen readers
  2888. * @param options.onItemClick {function} - The click/tap/key down handler will call this function to perform an action
  2889. * @param options.onItemStartDrag {fuction} - The mousedown/drag events will call this function to perform an action
  2890. */
  2891. init: function init(options) {
  2892. this.events = {};
  2893. this.events['clicktap .property_' + options.id + ' .itemOption'] = '_onItemClick';
  2894. this.events['mousedown .property_' + options.id + ' .itemOption'] = '_onItemMouseDownStartDrag';
  2895. this.events['keydown .property_' + options.id + ' .itemOption'] = '_onItemKeyDown';
  2896. this.nestedUIControl = false;
  2897. IconCollection.inherited('init', this, arguments);
  2898. _.extend(this, options);
  2899. },
  2900. doRender: function doRender() {
  2901. var sHtml = dot.template(IconCollectionTemplate)({
  2902. 'items': this.items,
  2903. 'id': this.id,
  2904. 'readOnly': this.readOnly,
  2905. 'ariaLabel': this.ariaLabel || this.label,
  2906. 'nestedUIControl': this.nestedUIControl,
  2907. 'showText': this.showText
  2908. });
  2909. this.$el.append(sHtml);
  2910. this.$el.find('.property_' + this.id + ' .itemOption').each(function (index, element) {
  2911. if (this.items[index].icon) {
  2912. Utils.setIcon($(element), this.items[index].icon, this.items[index].label, this.items[index].ariaLabel);
  2913. }
  2914. $(element).hammer();
  2915. $(element).on('hold', this._onItemHoldAndStartDrag.bind(this));
  2916. }.bind(this));
  2917. },
  2918. _getEntry: function _getEntry(target) {
  2919. var $target = $(target).closest('.itemOption');
  2920. var targetName = $target.data('name');
  2921. var targetItem = _.find(this.items, function (item) {
  2922. return item.name === targetName;
  2923. });
  2924. return targetItem.content;
  2925. },
  2926. _onItemKeyDown: function _onItemKeyDown(event) {
  2927. if (event.keyCode === KeyCodes.ENTER || event.keyCode === KeyCodes.SPACE) {
  2928. this._onItemClick(event);
  2929. }
  2930. },
  2931. _onItemClick: function _onItemClick(event) {
  2932. var currentTarget = event.currentTarget;
  2933. if ($.data(currentTarget, '_clickEventReceived') !== true) {
  2934. // Guard against adding two widgets at once during a double click.
  2935. $.data(currentTarget, '_clickEventReceived', true);
  2936. setTimeout(function () {
  2937. $.data(currentTarget, '_clickEventReceived', false);
  2938. }, 500);
  2939. if (this.options.onItemClick) {
  2940. var entry = this._getEntry(event.target);
  2941. this.options.onItemClick(entry, event);
  2942. if (event && event.gesture) {
  2943. event.gesture.preventDefault();
  2944. }
  2945. }
  2946. if (this.options.autoClose) {
  2947. $('[data-toggle="dropdown"]').parent().removeClass('open');
  2948. }
  2949. }
  2950. },
  2951. _onStartDrag: function _onStartDrag(event) {
  2952. if (this.options.onItemStartDrag) {
  2953. if (event.preventDefault) {
  2954. // prevent default drag behavior
  2955. event.preventDefault();
  2956. }
  2957. var entry = this._getEntry(event.target);
  2958. this.options.onItemStartDrag(entry, event);
  2959. }
  2960. },
  2961. _onItemHoldAndStartDrag: function _onItemHoldAndStartDrag(event) {
  2962. event.showAvatarImmediately = true;
  2963. this._onStartDrag(event);
  2964. },
  2965. _onItemMouseDownStartDrag: function _onItemMouseDownStartDrag(event) {
  2966. this._onStartDrag(event);
  2967. }
  2968. });
  2969. return IconCollection;
  2970. });
  2971. //# sourceMappingURL=IconCollection.js.map
  2972. ;
  2973. 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';});
  2974. /*
  2975. *+------------------------------------------------------------------------+
  2976. *| Licensed Materials - Property of IBM
  2977. *| IBM Cognos Products: Content Explorer
  2978. *| (C) Copyright IBM Corp. 2016, 2017
  2979. *|
  2980. *| US Government Users Restricted Rights - Use, duplication or disclosure
  2981. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  2982. *+------------------------------------------------------------------------+
  2983. */
  2984. 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) {
  2985. 'use strict';
  2986. var IconPicker = BaseProperty.extend({
  2987. /**
  2988. * Creates a property with icon picker.
  2989. * @param options.id {string} - property id
  2990. * @param options.el {node} - parent element
  2991. * @param options.name {string} - property name
  2992. * @param options.label {string} - property label
  2993. * @param options.items {array} - array of icons
  2994. * @param options.items.name {string} - icon name
  2995. * @param options.items.label {string} - icon label
  2996. * @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.
  2997. * @param options.onChange {function} - callback to be notified as soon as the change happens
  2998. * @param options.readOnly {boolean} - optional, default is false. If true, the UI will be rendered in a read-only mode
  2999. * @param options.nestedUIControl {boolean} - optional, default is false. Set to true if this UI Widget is being rendered by another UI Widget
  3000. * @param options.ariaLabel {string} - optional, if you want to override the default label for screen readers
  3001. * @param options.values {array|string} - optional, an array or a string of the initial selected name(s)
  3002. * @param options.useToggling {boolean} - optional, default is false, selecting a selected icon does not unselect it. If true, selecting a selected icon unselects it.
  3003. * @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.
  3004. * @param options.showLabels {boolean} - optional, default is false, show labels under each icon.
  3005. */
  3006. init: function init(options) {
  3007. this.events = {};
  3008. this.events['clicktap .property_' + options.id + ' .iconOption'] = '_handleClick';
  3009. this.events['keydown .property_' + options.id + ' .iconOption'] = '_handleKeyDown';
  3010. this.nestedUIControl = false;
  3011. this.useToggling = false;
  3012. this.allowMultiple = false;
  3013. this.showLabels = false;
  3014. IconPicker.inherited('init', this, arguments);
  3015. _.extend(this, options);
  3016. if (_.isString(options.values)) {
  3017. this.values = [options.values];
  3018. }
  3019. },
  3020. doRender: function doRender() {
  3021. var sHtml = dot.template(IconPickerTemplate)({
  3022. 'name': this.name,
  3023. 'label': this.label,
  3024. 'items': this.items,
  3025. 'id': this.id,
  3026. 'readOnly': this.readOnly,
  3027. 'values': this.values,
  3028. 'ariaLabel': this.ariaLabel,
  3029. 'nestedUIControl': this.nestedUIControl,
  3030. 'showLabels': this.showLabels
  3031. });
  3032. this.$el.append(sHtml);
  3033. var that = this;
  3034. this.$el.find('.property_' + this.id + ' .iconOption').each(function (index) {
  3035. Utils.setIcon($(this), that.items[index].value, that.items[index].label, that.items[index].label);
  3036. $(this).find('.svgIcon').attr('tabindex', this.readOnly ? '-1' : '0');
  3037. });
  3038. },
  3039. getSelectedOptions: function getSelectedOptions() {
  3040. var selectedOptions = [];
  3041. this.$el.find('.property_' + this.id + ' .iconOption.selected').each(function () {
  3042. var selectedOption = {
  3043. value: $(this).data('value'),
  3044. name: $(this).data('name')
  3045. };
  3046. selectedOptions.push(selectedOption);
  3047. });
  3048. return selectedOptions;
  3049. },
  3050. _handleClick: function _handleClick(event) {
  3051. this._selectNode(event.target);
  3052. },
  3053. _handleKeyDown: function _handleKeyDown(event) {
  3054. if (event.keyCode === KeyCodes.ENTER || event.keyCode === KeyCodes.SPACE) {
  3055. this._selectNode(event.target);
  3056. }
  3057. },
  3058. _selectNode: function _selectNode(target) {
  3059. var $target = $(target).closest('.iconOption');
  3060. if ((!this.useToggling || !$target.hasClass('selected')) && !this.allowMultiple) {
  3061. this._uncheckCurrentSelection();
  3062. }
  3063. if (this.useToggling || !this.allowMultiple || !$target.hasClass('selected')) {
  3064. this._updateSelectedNode($target);
  3065. }
  3066. this._onChange(this.name, this.getSelectedOptions());
  3067. },
  3068. _updateSelectedNode: function _updateSelectedNode($node) {
  3069. if ($node.hasClass('selected')) {
  3070. $node.attr('aria-checked', 'false').removeClass('selected');
  3071. } else {
  3072. $node.attr('aria-checked', 'true').addClass('selected');
  3073. }
  3074. },
  3075. _uncheckCurrentSelection: function _uncheckCurrentSelection() {
  3076. this.$el.find('.property_' + this.id + ' .iconOption.selected').removeClass('selected').attr({
  3077. 'aria-checked': 'false'
  3078. });
  3079. }
  3080. });
  3081. return IconPicker;
  3082. });
  3083. //# sourceMappingURL=IconPicker.js.map
  3084. ;
  3085. 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';});
  3086. /*
  3087. *+------------------------------------------------------------------------+
  3088. *| Licensed Materials - Property of IBM
  3089. *| IBM Cognos Products: Content Explorer
  3090. *| (C) Copyright IBM Corp. 2017, 2018
  3091. *|
  3092. *| US Government Users Restricted Rights - Use, duplication or disclosure
  3093. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  3094. *+------------------------------------------------------------------------+
  3095. */
  3096. 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, _) {
  3097. 'use strict';
  3098. /**
  3099. * An extension of Label and provides a label and input.
  3100. * For an example see PropertiesGeneralTab -> Advanced -> sharePath.
  3101. */
  3102. var InputLabel = Input.extend({
  3103. /**
  3104. * Creates an input control with a label. Same options as the parent Input, but with the addition of:
  3105. * @param options.label {string}- the label to use
  3106. */
  3107. init: function init(options) {
  3108. void options;
  3109. InputLabel.inherited('init', this, arguments);
  3110. this.ellipses = false;
  3111. },
  3112. /**
  3113. * return the html template
  3114. */
  3115. getHTMLTemplate: function getHTMLTemplate() {
  3116. return inputLabelTemplate;
  3117. },
  3118. /**
  3119. * return the options for the html template
  3120. */
  3121. getTemplateOptions: function getTemplateOptions() {
  3122. var options = InputLabel.inherited('getTemplateOptions', this, arguments);
  3123. _.extend(options, { label: this.label, multiline: this.multiline });
  3124. return options;
  3125. }
  3126. });
  3127. return InputLabel;
  3128. });
  3129. //# sourceMappingURL=InputLabel.js.map
  3130. ;
  3131. 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';});
  3132. 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';});
  3133. /*
  3134. *+------------------------------------------------------------------------+
  3135. *| Licensed Materials - Property of IBM
  3136. *| IBM Cognos Products: Content Explorer
  3137. *| (C) Copyright IBM Corp. 2015, 2017
  3138. *|
  3139. *| US Government Users Restricted Rights - Use, duplication or disclosure
  3140. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  3141. *+------------------------------------------------------------------------+
  3142. */
  3143. define('baglass/core-client/js/core-client/ui/properties/SectionLabel',['./BaseProperty', 'text!./templates/SectionLabel.html', 'underscore', 'doT'], function (BaseProperty, sectionLabelTemplate, _, dot) {
  3144. 'use strict';
  3145. var SectionLabel = BaseProperty.extend({
  3146. /**
  3147. * @param options.indent {int} - default 0, will indent by options.indent * 10px
  3148. */
  3149. init: function init(spec) {
  3150. SectionLabel.inherited('init', this, arguments);
  3151. _.extend(this, spec);
  3152. },
  3153. doRender: function doRender() {
  3154. var sHtml = dot.template(sectionLabelTemplate)({
  3155. 'label': this.label,
  3156. 'id': this.id
  3157. });
  3158. this.$el.append(sHtml);
  3159. return;
  3160. },
  3161. processStaticValidation: function processStaticValidation() {
  3162. // Empty function to override BaseProperty processStaticValidation. Hide the icons from this UI element
  3163. }
  3164. });
  3165. return SectionLabel;
  3166. });
  3167. //# sourceMappingURL=SectionLabel.js.map
  3168. ;
  3169. 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; }; }();
  3170. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3171. 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; }
  3172. 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; }
  3173. /**
  3174. * Licensed Materials - Property of IBM
  3175. * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2018
  3176. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  3177. */
  3178. define('baglass/core-client/js/core-client/ui/ContextMenuButton',['react', 'prop-types', 'ca-ui-toolkit', './KeyCodes'], function (React, PropTypes, Toolkit, KeyCodes) {
  3179. var Component = React.Component;
  3180. var ContextMenu = Toolkit.ContextMenu;
  3181. /**
  3182. * Creates a button that will render a context menu when clicked
  3183. * Uses the toolkit.ContextMenu
  3184. * More doc : https://pages.github.ibm.com/BusinessAnalytics/ba-ui-toolkit/#/components/context-menu
  3185. *
  3186. * @param options.menuItems {array} - array of the items you want to render
  3187. * @param options.menuItems.id {string} - item id
  3188. * @param options.menuItems.label {string} - item label used to display
  3189. * @param options.menuItems.value {string} - item value
  3190. * @param options.id {string} - View id
  3191. * @param options.placement {string} - Where the Context Menu will be positioned visually off of the triggerNode
  3192. * @param options.onChange {string} - Function that is called when an item is selected
  3193. * @param options.domNodeToAttachTo {function} - DOM node that the Context Menu will be attached to in the DOM
  3194. * @param options.ariaLabel [String] - Label to use on the context menu button ...
  3195. */
  3196. var ContextMenuButton = function (_Component) {
  3197. _inherits(ContextMenuButton, _Component);
  3198. function ContextMenuButton(props) {
  3199. _classCallCheck(this, ContextMenuButton);
  3200. var _this = _possibleConstructorReturn(this, (ContextMenuButton.__proto__ || Object.getPrototypeOf(ContextMenuButton)).call(this, props));
  3201. _this.state = {
  3202. open: false
  3203. };
  3204. _this.menuItems = props.menuItems;
  3205. _this.placement = props.placement;
  3206. _this.domNodeToAttachTo = props.domNodeToAttachTo;
  3207. _this.id = props.id;
  3208. return _this;
  3209. }
  3210. _createClass(ContextMenuButton, [{
  3211. key: 'openMenu',
  3212. value: function openMenu(e) {
  3213. e.stopPropagation();
  3214. this.setState({ open: !this.state.open });
  3215. }
  3216. }, {
  3217. key: 'onChange',
  3218. value: function onChange(name, value) {
  3219. this.setState({ open: !this.state.open });
  3220. this.props.onChange(name, value);
  3221. }
  3222. }, {
  3223. key: 'onKeyPressed',
  3224. value: function onKeyPressed(e) {
  3225. e.stopPropagation();
  3226. if (e.keyCode === KeyCodes.ENTER || e.keyCode === KeyCodes.SPACE) {
  3227. this.setState({ open: !this.state.open });
  3228. }
  3229. }
  3230. }, {
  3231. key: '_closeMenu',
  3232. value: function _closeMenu() {
  3233. this.setState({ open: !this.state.open });
  3234. }
  3235. }, {
  3236. key: 'render',
  3237. value: function render() {
  3238. var open = this.state.open;
  3239. return React.createElement(
  3240. 'div',
  3241. {
  3242. className: 'contextMenuButton ' + this.id, tabIndex: '0',
  3243. onClick: this.openMenu.bind(this), onKeyDown: this.onKeyPressed.bind(this),
  3244. 'aria-label': this.props.ariaLabel, role: 'button'
  3245. },
  3246. React.createElement(
  3247. 'svg',
  3248. { className: 'svgIcon' },
  3249. React.createElement('use', { xlinkHref: '#common-menuoverflow' })
  3250. ),
  3251. open && React.createElement(
  3252. ContextMenu,
  3253. {
  3254. theme: true,
  3255. placement: this.placement,
  3256. onClose: this._closeMenu.bind(this),
  3257. onChange: this.onChange.bind(this),
  3258. domNodeToAttachTo: this.domNodeToAttachTo,
  3259. className: 'ba-theme-default glassContextMenu ' + this.id },
  3260. React.createElement(ContextMenu.List, { content: this.menuItems, name: 'contextMenu' })
  3261. )
  3262. );
  3263. }
  3264. }]);
  3265. return ContextMenuButton;
  3266. }(Component);
  3267. ContextMenuButton.propTypes = {
  3268. onChange: PropTypes.func.isRequired,
  3269. menuItems: PropTypes.array.isRequired,
  3270. domNodeToAttachTo: PropTypes.object,
  3271. placement: PropTypes.string,
  3272. id: PropTypes.string.isRequired,
  3273. ariaLabel: PropTypes.string
  3274. };
  3275. ContextMenuButton.defaultProps = {
  3276. placement: 'bottom',
  3277. domNodeToAttachTo: document.body,
  3278. ariaLabel: ''
  3279. };
  3280. return ContextMenuButton;
  3281. });
  3282. //# sourceMappingURL=ContextMenuButton.js.map
  3283. ;
  3284. /*
  3285. *+------------------------------------------------------------------------+
  3286. *| Licensed Materials - Property of IBM
  3287. *| IBM Cognos Products: Content Explorer
  3288. *| (C) Copyright IBM Corp. 2018, 2020
  3289. *|
  3290. *| US Government Users Restricted Rights - Use, duplication or disclosure
  3291. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  3292. *+------------------------------------------------------------------------+
  3293. */
  3294. // jshint maxparams:13
  3295. 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) {
  3296. 'use strict';
  3297. var DEFAULT_MAXCOLORS = 26;
  3298. var CustomPalette = AuthoringCommon.CustomPalette;
  3299. var DEFAULT_MENU_ITEMS = [{
  3300. id: 'edit_palette',
  3301. label: StringResources.get('edit_palette'),
  3302. value: 'edit'
  3303. }, {
  3304. id: 'duplicate_palette',
  3305. label: StringResources.get('duplicate_palette'),
  3306. value: 'duplicate'
  3307. }, {
  3308. id: 'reverse_palette',
  3309. label: StringResources.get('reverse_palette'),
  3310. value: 'reverse'
  3311. }, {
  3312. id: 'delete_palette',
  3313. label: StringResources.get('delete_palette'),
  3314. value: 'delete'
  3315. }];
  3316. var Palette = BaseProperty.extend({
  3317. /**
  3318. * Creates a property with palette picker.
  3319. * @param options.name {string} - property name
  3320. * @param options.el {node} - parent element
  3321. * @param options.hasSection {boolean} - boolean to show the section on top of the palette
  3322. * @param options.canCreatePalettes {boolean} - optional, default is true, boolean to turn off the add palette button in the section header
  3323. * @param options.sectionLabel {string} - section label
  3324. * @param options.onCreatePalette {function} - callback when a palette is created.
  3325. * @param options.changePaletteCb {function} - callback for the single link link
  3326. * @param options.isAdminUI {boolean} - boolean to duplicate in global instead of custom
  3327. * @param options.linkLabel {string} - label for the single line link
  3328. * @param options.maxColors {int} - max number of colors shown
  3329. * @param options.createPaletteType {string} - Type of palette to create when launching the palette dialog
  3330. * @param options.menuItems {array} - list of the palette menu palette that you want to show, filtered with the item.value.
  3331. * By default ['edit','duplicate','reverse','delete']
  3332. * @param options.palette {object} - the selected palette that you want to display
  3333. * @param options.palette.id {string} - palette id
  3334. * @param options.palette.content {object} - Object storing the palette content
  3335. * @param options.palette.content.label {string} - palette name
  3336. * @param options.palette.content.fills {array} - array of color values
  3337. * @param options.palette.content.fillType {array} - type of the values passed, can be "simple", "continuous" or "ImgPath" if its a pattern.
  3338. * @param options.palette.content.path {string} - For 'ImgPath' type path defines the parent file path of the images
  3339. * @param options.palette.content.fileType {string} - For 'ImgPath' type, fileType defines the type of the image. Default to '.svg'
  3340. * @param options.readOnly {boolean} - optional, default is false. If true, the UI will be rendered in a read-only mode
  3341. * @param options.ariaLabel {string} - optional, if you want to override the default label for screen readers
  3342. *
  3343. */
  3344. init: function init(options) {
  3345. this.readOnly = true;
  3346. this.maxColors = DEFAULT_MAXCOLORS;
  3347. this.reverse = false;
  3348. this.defaultImageType = '.svg';
  3349. this.events = {};
  3350. this.events['clicktap .property_' + options.id + '.paletteColors:not(.readOnly)'] = '_handleClick';
  3351. this.events['keydown .property_' + options.id + '.paletteColors:not(.readOnly)'] = '_handleKeyDown';
  3352. this.events['clicktap .property_' + options.id + ' .showColorsButton'] = '_showHideColorsClick';
  3353. this.events['keydown .property_' + options.id + ' .showColorsButton'] = '_showHideColorsKeyDown';
  3354. Palette.inherited('init', this, arguments);
  3355. _.extend(this, options);
  3356. if (this.hasSection && this.sectionLabel) {
  3357. var headerOptions = {
  3358. el: this.$el,
  3359. name: this.name,
  3360. id: this.id + 'topSection',
  3361. type: 'SingleLineLinks',
  3362. items: [{
  3363. align: 'left',
  3364. items: [{
  3365. type: 'text',
  3366. name: 'currentPaletteLabel',
  3367. value: this.sectionLabel
  3368. }]
  3369. }]
  3370. };
  3371. if (this.canCreatePalettes || this.canCreatePalettes === undefined) {
  3372. headerOptions.items.push({
  3373. align: 'right',
  3374. items: [{
  3375. name: 'addNewPalette',
  3376. type: 'icon',
  3377. svgIcon: 'common-add-new',
  3378. iconTooltip: options.newPaletteLabel || StringResources.get('createPalette'),
  3379. clickCallback: this.openCreateDialog.bind(this)
  3380. }]
  3381. });
  3382. }
  3383. this.header = new SingleLineLinks(headerOptions);
  3384. }
  3385. if (this.changePaletteCb && this.linkLabel) {
  3386. this.link = new SingleLineLinks({
  3387. el: this.$el,
  3388. name: this.name,
  3389. id: this.id,
  3390. type: 'SingleLineLinks',
  3391. items: [{
  3392. align: 'right',
  3393. items: [{
  3394. type: 'text',
  3395. name: 'changePalette',
  3396. value: this.linkLabel,
  3397. clickCallback: this.changePaletteCb
  3398. }]
  3399. }]
  3400. });
  3401. }
  3402. },
  3403. /**
  3404. * Our NewPalette property might be nested in a collapsible section. Get the top level propertyUIControl node
  3405. * for select and deselect operations.
  3406. */
  3407. _getContainerNode: function _getContainerNode() {
  3408. if (!this.containerNode) {
  3409. this.containerNode = this.$el.parentsUntil('.propertyUIControl.flexHeight');
  3410. if (!this.containerNode) {
  3411. this.containerNode = this.$el;
  3412. }
  3413. }
  3414. return this.containerNode;
  3415. },
  3416. deselectPreviousPalette: function deselectPreviousPalette() {
  3417. this._getContainerNode().find('.paletteColors.selected').removeClass('selected').attr('aria-pressed', 'false');
  3418. },
  3419. deselectPalette: function deselectPalette() {
  3420. this._getContainerNode().find('.property_' + this.id).removeClass('selected').attr('aria-pressed', 'false');
  3421. },
  3422. selectPalette: function selectPalette() {
  3423. this._getContainerNode().find('.property_' + this.id).addClass('selected').attr('aria-pressed', 'true');
  3424. },
  3425. handleSelectPalette: function handleSelectPalette() {
  3426. this.deselectPreviousPalette();
  3427. this.selectPalette();
  3428. this._onChange(this.name, {
  3429. reverse: this.reverse,
  3430. id: this.palette.id,
  3431. isSystem: this.palette.systemPalette
  3432. });
  3433. },
  3434. _handleClick: function _handleClick(event) {
  3435. if (event.target.tagName.toLowerCase() !== 'svg') {
  3436. this.handleSelectPalette();
  3437. }
  3438. },
  3439. _handleKeyDown: function _handleKeyDown(event) {
  3440. if (event.keyCode === KeyCodes.ENTER || event.keyCode === KeyCodes.SPACE) {
  3441. if (event.target.className.indexOf('contextMenuButton') === -1) {
  3442. this.handleSelectPalette();
  3443. }
  3444. }
  3445. },
  3446. showHiddenColors: function showHiddenColors(e) {
  3447. var palContent = $(e.target).parents('.paletteContent');
  3448. if (palContent.find('.showLessColors').hasClass('hidden')) {
  3449. palContent.find('.paletteOption.hidden').toggleClass('hidden');
  3450. } else {
  3451. $(palContent[0].querySelectorAll('.paletteOption:nth-child(n+' + (this.maxColors + 1) + ')')).toggleClass('hidden');
  3452. }
  3453. palContent.find('.showColorsButton').toggleClass('hidden');
  3454. palContent.find('.showColorsButton.hidden').attr('aria-hidden', true);
  3455. palContent.find('.showColorsButton:not(.hidden)').attr('aria-hidden', false);
  3456. },
  3457. _showHideColorsClick: function _showHideColorsClick(event) {
  3458. event.stopPropagation();
  3459. this.showHiddenColors(event);
  3460. },
  3461. _showHideColorsKeyDown: function _showHideColorsKeyDown(event) {
  3462. event.stopPropagation();
  3463. if (event.keyCode === KeyCodes.ENTER || event.keyCode === KeyCodes.SPACE) {
  3464. this.showHiddenColors(event);
  3465. }
  3466. },
  3467. onMenuChange: function onMenuChange(name, value) {
  3468. var _this = this;
  3469. var dialog;
  3470. switch (value) {
  3471. case 'edit':
  3472. var editDialog = React.createElement(CustomPalette, {
  3473. key: 'editPalette',
  3474. glassContext: this.glassContext,
  3475. paletteDef: this.palette.content,
  3476. paletteId: this.palette.id,
  3477. paletteType: this.createPaletteType,
  3478. removeDialog: Utils.removeTemporaryContainer.bind(this),
  3479. ref: function ref(instance) {
  3480. dialog = instance;
  3481. }
  3482. });
  3483. Utils.reactRender(editDialog, Utils.createTemporaryContainer()).then(function () {
  3484. dialog.openDialog();
  3485. });
  3486. break;
  3487. case 'duplicate':
  3488. var dupPalette = _.extend({}, this.palette.content);
  3489. dupPalette.label = StringResources.get('palette_copy', { paletteName: dupPalette.label });
  3490. var duplicateDialog = React.createElement(CustomPalette, {
  3491. key: 'duplicatePalette',
  3492. glassContext: this.glassContext,
  3493. paletteDef: dupPalette,
  3494. paletteType: this.createPaletteType,
  3495. removeDialog: Utils.removeTemporaryContainer.bind(this),
  3496. type: this.isAdminUI ? 'global' : '',
  3497. ref: function ref(instance) {
  3498. dialog = instance;
  3499. }
  3500. });
  3501. Utils.reactRender(duplicateDialog, Utils.createTemporaryContainer()).then(function () {
  3502. dialog.openDialog();
  3503. });
  3504. break;
  3505. case 'reverse':
  3506. this.reverse = !this.reverse;
  3507. this._onChange(this.name, {
  3508. reverse: this.reverse
  3509. });
  3510. return this.reRender();
  3511. case 'delete':
  3512. this.glassContext.getSvc('.Palette').then(function (paletteSvc) {
  3513. paletteSvc.deletePalette(_this.palette.id);
  3514. });
  3515. break;
  3516. }
  3517. },
  3518. _filterItems: function _filterItems() {
  3519. var _this2 = this;
  3520. if (this.menuItems) {
  3521. return _.filter(DEFAULT_MENU_ITEMS, function (item) {
  3522. return _.contains(_this2.menuItems, item.value);
  3523. });
  3524. } else {
  3525. return DEFAULT_MENU_ITEMS;
  3526. }
  3527. },
  3528. onPaletteCreated: function onPaletteCreated(paletteId) {
  3529. if (this.onCreatePalette) {
  3530. this.onCreatePalette(paletteId);
  3531. }
  3532. },
  3533. openCreateDialog: function openCreateDialog() {
  3534. var dialog;
  3535. var paletteComponent = React.createElement(CustomPalette, {
  3536. key: 'createPalette',
  3537. glassContext: this.glassContext,
  3538. paletteType: this.createPaletteType,
  3539. ref: function ref(instance) {
  3540. dialog = instance;
  3541. },
  3542. onPaletteCreated: this.onPaletteCreated.bind(this),
  3543. removeDialog: Utils.removeTemporaryContainer.bind(this)
  3544. });
  3545. Utils.reactRender(paletteComponent, Utils.createTemporaryContainer()).then(function () {
  3546. dialog.openDialog();
  3547. });
  3548. },
  3549. reRender: function reRender() {
  3550. this.$el.find('*[class^=\'property_' + this.id + '\'], *[class*=\' property_' + this.id + '\']').remove();
  3551. return this.doRender();
  3552. },
  3553. doRender: function doRender() {
  3554. if (this.header) {
  3555. this.header.doRender();
  3556. }
  3557. var sHtml = dot.template(PaletteTemplate)({
  3558. 'id': this.id,
  3559. 'palette': this.palette,
  3560. 'readOnly': this.readOnly,
  3561. 'ariaLabel': this.ariaLabel,
  3562. 'selected': this.selected,
  3563. 'maxColors': this.maxColors,
  3564. 'showLessColors': StringResources.get('showLessColors'),
  3565. 'showMoreColors': StringResources.get('showMoreColors'),
  3566. 'content': this.palette.content,
  3567. 'defaultImageType': this.defaultImageType,
  3568. reverse: this.reverse,
  3569. 'showMorePalette': StringResources.get('showMoreColorPalette')
  3570. });
  3571. this.$el.append(sHtml);
  3572. if (this.link) {
  3573. this.link.doRender();
  3574. }
  3575. var items = this._filterItems();
  3576. if (items.length > 0) {
  3577. var paletteMenu = this.$el.find('.property_' + this.id + ' .paletteMenu').get(0);
  3578. var contextMenuButton = React.createElement(ContextMenuButton, {
  3579. menuItems: items,
  3580. onChange: this.onMenuChange.bind(this),
  3581. domNodeToAttachTo: document.body,
  3582. id: this.id,
  3583. ariaLabel: StringResources.get('moreActionsForPalette', { paletteName: this.palette.content.label })
  3584. });
  3585. return Utils.reactRender(contextMenuButton, paletteMenu);
  3586. } else {
  3587. return Promise.resolve();
  3588. }
  3589. }
  3590. });
  3591. return Palette;
  3592. });
  3593. //# sourceMappingURL=NewPalette.js.map
  3594. ;
  3595. 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';});
  3596. /*
  3597. *+------------------------------------------------------------------------+
  3598. *| Licensed Materials - Property of IBM
  3599. *| IBM Cognos Products: Content Explorer
  3600. *| (C) Copyright IBM Corp. 2015, 2017
  3601. *|
  3602. *| US Government Users Restricted Rights - Use, duplication or disclosure
  3603. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  3604. *+------------------------------------------------------------------------+
  3605. */
  3606. define('baglass/core-client/js/core-client/ui/properties/OwnerRow',['./BaseProperty', 'text!./templates/OwnerRow.html', 'doT', 'underscore', '../../nls/StringResources'], function (BaseProperty, ownerTemplate, dot, _, StringResource) {
  3607. 'use strict';
  3608. /**
  3609. UI Specific to showing object properties. This will render the
  3610. owner, modificationTime and creationTime
  3611. **/
  3612. var Owner = BaseProperty.extend({
  3613. name: 'ownerRow',
  3614. ellipses: true,
  3615. /**
  3616. @param options.owner {String} - name of the owner
  3617. @param options.modificationTime {String} - object modification time
  3618. @param options.creationTime {String} - object creation time
  3619. **/
  3620. init: function init(options) {
  3621. Owner.inherited('init', this, arguments);
  3622. _.extend(options, options);
  3623. },
  3624. doRender: function doRender() {
  3625. var sHtml = dot.template(ownerTemplate)({
  3626. 'owner': this.owner,
  3627. 'modificationTime': this.modificationTime || '',
  3628. 'creationTime': this.creationTime || '',
  3629. 'fileType': this.fileType,
  3630. 'id': this.id,
  3631. 'refreshTime': this.refreshTime || '',
  3632. 'strings': {
  3633. 'owner': StringResource.get('owner'),
  3634. 'created': StringResource.get('createdWithColon'),
  3635. 'modified': StringResource.get('modifiedWithColon'),
  3636. 'file': StringResource.get('typeWithColon'),
  3637. 'dataRefreshed': StringResource.get('dataRefWithColon')
  3638. }
  3639. });
  3640. this.$el.append(sHtml);
  3641. return;
  3642. }
  3643. });
  3644. return Owner;
  3645. });
  3646. //# sourceMappingURL=OwnerRow.js.map
  3647. ;
  3648. 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>';});
  3649. /*
  3650. *+------------------------------------------------------------------------+
  3651. *| Licensed Materials - Property of IBM
  3652. *| IBM Cognos Products: Content Explorer
  3653. *| (C) Copyright IBM Corp. 2016, 2017
  3654. *|
  3655. *| US Government Users Restricted Rights - Use, duplication or disclosure
  3656. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  3657. *+------------------------------------------------------------------------+
  3658. */
  3659. define('baglass/core-client/js/core-client/ui/properties/Palette',['./BaseProperty', 'text!./templates/Palette.html', 'jquery', 'doT', 'underscore', '../KeyCodes'], function (BaseProperty, PaletteTemplate, $, dot, _, KeyCodes) {
  3660. 'use strict';
  3661. var Palette = BaseProperty.extend({
  3662. /**
  3663. * Creates a property with palette picker.
  3664. * @param options.id {string} - property id
  3665. * @param options.el {node} - parent element
  3666. * @param options.name {string} - property name
  3667. * @param options.label {string} - property label
  3668. * @param options.items {array} - array of all available palettes.
  3669. * @param options.items.name {string} - palette name
  3670. * @param options.items.label {string} - palette name
  3671. * @param options.items.value {string} - an array of values for the palette. All of value arrays should have the same length
  3672. * @param options.items.type {string} - type of color. It can be 'ColorCode', 'Class' or 'ImgPath'
  3673. * @param options.items.path {string} - For 'ImgPath' type path defines the parent file path of the images
  3674. * @param options.items.fileType {string} - For 'ImgPath' type, fileType defines the type of the image. Default to '.svg'
  3675. * @param options.onChange {function} - callback to be notified as soon as the change happens
  3676. * @param options.onOpenChange {function} - callback to be notified whenever the color picker opens / closes
  3677. * @param options.readOnly {boolean} - optional, default is false. If true, the UI will be rendered in a read-only mode
  3678. * @param options.nestedUIControl {boolean} - optional, default is false. Set to true if this UI Widget is being rendered by another UI Widget
  3679. * @param options.ariaLabel {string} - optional, if you want to override the default label for screen readers
  3680. * @param options.selectedName {string} - optional, the name of the initial selected color
  3681. * @param options.reverse {boolean} - optional, true if the order is reversed
  3682. * @param options.open {boolean} - optional, default is false. If true, open the color picker
  3683. * @param options.enableReorder {boolean} - optional, default is false. If true, there shows a reorder button to reorder the palette option
  3684. * @param options.maxValueLength {int} - optional, default is 5.
  3685. */
  3686. init: function init(options) {
  3687. this.events = {};
  3688. this.events['clicktap .property_' + options.id + ' .paletteOption'] = '_handleClick';
  3689. this.events['keydown .property_' + options.id + ' .paletteOption'] = '_handleKeyDown';
  3690. this.events['clicktap .property_' + options.id + ' .orderButton'] = '_handleReorderClick';
  3691. this.events['keydown .property_' + options.id + ' .orderButton'] = '_handlerReorderKeydown';
  3692. this.events['clicktap .collapsibleSectionToggle' + options.id] = 'toggleCollapsibleSection';
  3693. this.events['keydown .collapsibleSectionToggle' + options.id] = '_toggleCollapsibleSectionKeyDown';
  3694. this.nestedUIControl = false;
  3695. this.open = false;
  3696. this.enableReorder = false;
  3697. this.reverse = false;
  3698. this.defaultImageType = '.svg';
  3699. this.maxValueLength = 5;
  3700. Palette.inherited('init', this, arguments);
  3701. _.extend(this, options);
  3702. },
  3703. doRender: function doRender() {
  3704. this.index = this._getItemIndexFromName(this.selectedName);
  3705. var sHtml = dot.template(PaletteTemplate)({
  3706. 'name': this.name,
  3707. 'label': this.label,
  3708. 'items': this.items,
  3709. 'id': this.id,
  3710. 'readOnly': this.readOnly,
  3711. 'value': this.getSelectedValueArray(),
  3712. 'selectedValueType': this.getSelectedValueType(),
  3713. 'ariaLabel': this.ariaLabel,
  3714. 'nestedUIControl': this.nestedUIControl,
  3715. 'enableReorder': this.enableReorder,
  3716. 'index': this.index,
  3717. 'maxLength': this.maxValueLength,
  3718. 'defaultImageType': this.defaultImageType
  3719. });
  3720. this.$el.append(sHtml);
  3721. if (this.reverse) {
  3722. var $parentNodes = this.$el.find('.property_' + this.id + ' .pickedOption, .paletteOption');
  3723. this._reverseChildren($parentNodes);
  3724. }
  3725. if (this.open) {
  3726. this._doToggleCollapsibleSection();
  3727. }
  3728. },
  3729. toggleCollapsibleSection: function toggleCollapsibleSection() {
  3730. // update state
  3731. this.open = !this.open;
  3732. this._doToggleCollapsibleSection();
  3733. // notify open state change
  3734. if (this.onOpenChange) {
  3735. this.onOpenChange(this.name, this.open);
  3736. }
  3737. },
  3738. getCollasibleDiv: function getCollasibleDiv() {
  3739. return this.$el.find('.collapsibleSection.property_' + this.id);
  3740. },
  3741. getToggleSectionNode: function getToggleSectionNode() {
  3742. return this.$el.find('.toggleSection' + this.id);
  3743. },
  3744. setSelectedColor: function setSelectedColor(newIndex, $selectedNode) {
  3745. this._unselectPreviousColor();
  3746. this.index = newIndex;
  3747. this._updateSelectedNode($selectedNode);
  3748. this._updatePickedPaletteNode();
  3749. this._onChange(this.name, this.getIsReversedAndSelectedItem());
  3750. },
  3751. getSelectedValueArray: function getSelectedValueArray() {
  3752. if (_.isArray(this.items)) {
  3753. return this.items[this.index].value;
  3754. }
  3755. },
  3756. getSelectedColorNode: function getSelectedColorNode() {
  3757. return this.$el.find('.property_' + this.id + ' .selected');
  3758. },
  3759. getIsReversedAndSelectedItem: function getIsReversedAndSelectedItem() {
  3760. return {
  3761. reverse: this.reverse,
  3762. value: this.getSelectedValueArray(),
  3763. name: this.getSelectedItemName()
  3764. };
  3765. },
  3766. handleSelectColor: function handleSelectColor(event) {
  3767. var $selectedNode = $(event.target).closest('.paletteOption');
  3768. var name = $selectedNode.data('name');
  3769. var newIndex = this._getItemIndexFromName(name);
  3770. if (this.index !== newIndex) {
  3771. this.setSelectedColor(newIndex, $selectedNode);
  3772. }
  3773. this.toggleCollapsibleSection();
  3774. },
  3775. getSelectedValueType: function getSelectedValueType() {
  3776. if (_.isArray(this.items)) {
  3777. return this.items[this.index].type;
  3778. }
  3779. },
  3780. getSelectedItemName: function getSelectedItemName() {
  3781. if (_.isArray(this.items)) {
  3782. return this.items[this.index].name;
  3783. }
  3784. },
  3785. _getItemIndexFromName: function _getItemIndexFromName(name) {
  3786. var index;
  3787. _.each(this.items, function (item, i) {
  3788. if (item.name === name) {
  3789. index = i;
  3790. }
  3791. });
  3792. return index;
  3793. },
  3794. _updatePickedPaletteNode: function _updatePickedPaletteNode() {
  3795. var type = this.getSelectedValueType();
  3796. var value = this.getSelectedValueArray();
  3797. var that = this;
  3798. var $pickedOption = this.$el.find('.property_' + this.id + ' .pickedOption');
  3799. $pickedOption.children().each(function (index) {
  3800. if (type === 'ColorCode') {
  3801. $(this).css('background', value[index]);
  3802. } else if (type === 'ImgPath') {
  3803. var item = that.items[that.index];
  3804. var imgURL = item.path + value[index] + (item.fileType || that.defaultImageType);
  3805. $(this).css('background', 'url(' + imgURL + ')');
  3806. } else if (type === 'Class') {
  3807. $(this).addClass(value[index]);
  3808. }
  3809. });
  3810. if (this.reverse) {
  3811. this._reverseChildren($pickedOption);
  3812. }
  3813. },
  3814. _handleReorderClick: function _handleReorderClick(event) {
  3815. event.stopPropagation();
  3816. this._doReorder();
  3817. },
  3818. _handlerReorderKeydown: function _handlerReorderKeydown(event) {
  3819. event.stopPropagation();
  3820. // space || enter
  3821. if (event.keyCode === KeyCodes.ENTER || event.keyCode === KeyCodes.SPACE) {
  3822. this._doReorder();
  3823. }
  3824. },
  3825. _doReorder: function _doReorder() {
  3826. var $parentNodes = this.$el.find('.property_' + this.id + ' .pickedOption, .paletteOption');
  3827. this._reverseChildren($parentNodes);
  3828. this.reverse = !this.reverse;
  3829. this._onChange(this.name, this.getIsReversedAndSelectedItem());
  3830. },
  3831. _reverseChildren: function _reverseChildren($parentNodes) {
  3832. var that = this;
  3833. $parentNodes.each(function () {
  3834. var $children = $(this).children();
  3835. $children.removeClass('hiddenOption');
  3836. var diff = $children.length - that.maxValueLength;
  3837. $children.slice(0, diff).addClass('hiddenOption');
  3838. $(this).append($children.get().reverse());
  3839. });
  3840. },
  3841. _updateSelectedNode: function _updateSelectedNode($selectedNode) {
  3842. if ($selectedNode) {
  3843. $selectedNode.addClass('selected').attr('aria-pressed', 'true');
  3844. }
  3845. },
  3846. _handleKeyDown: function _handleKeyDown(event) {
  3847. // space || enter
  3848. if (event.keyCode === KeyCodes.ENTER || event.keyCode === KeyCodes.SPACE) {
  3849. this.handleSelectColor(event);
  3850. }
  3851. },
  3852. _handleClick: function _handleClick(event) {
  3853. this.handleSelectColor(event);
  3854. event.stopPropagation();
  3855. },
  3856. _unselectPreviousColor: function _unselectPreviousColor() {
  3857. var $previousSelectedNode = this.getSelectedColorNode();
  3858. $previousSelectedNode.removeClass('selected').attr('aria-pressed', 'false');
  3859. var $toggleSectionNode = this.getToggleSectionNode();
  3860. $toggleSectionNode.children().each(function () {
  3861. $(this).css('background', '');
  3862. // remove all of classes except for singlePaletteOption and hiddenOption
  3863. if ($(this).hasClass('hiddenOption')) {
  3864. $(this).attr('class', 'singlePaletteOption hiddenOption');
  3865. } else {
  3866. $(this).attr('class', 'singlePaletteOption');
  3867. }
  3868. });
  3869. },
  3870. _toggleCollapsibleSectionKeyDown: function _toggleCollapsibleSectionKeyDown(event) {
  3871. // space || enter
  3872. if (event.keyCode === KeyCodes.ENTER || event.keyCode === KeyCodes.SPACE) {
  3873. this.toggleCollapsibleSection();
  3874. }
  3875. },
  3876. _doToggleCollapsibleSection: function _doToggleCollapsibleSection() {
  3877. var $collasibleDiv = this.getCollasibleDiv();
  3878. $collasibleDiv.toggleClass('visible');
  3879. var isVisible = $collasibleDiv.hasClass('visible');
  3880. this.$el.find('.property_' + this.id + ' .toggleSection' + this.id).attr('aria-expanded', isVisible ? 'true' : 'false');
  3881. $collasibleDiv.attr('aria-hidden', isVisible ? 'false' : 'true');
  3882. }
  3883. });
  3884. return Palette;
  3885. });
  3886. //# sourceMappingURL=Palette.js.map
  3887. ;
  3888. /*
  3889. *+------------------------------------------------------------------------+
  3890. *| Licensed Materials - Property of IBM
  3891. *| IBM Cognos Products: Content Explorer
  3892. *| (C) Copyright IBM Corp. 2016, 2017
  3893. *|
  3894. *| US Government Users Restricted Rights - Use, duplication or disclosure
  3895. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  3896. *+------------------------------------------------------------------------+
  3897. */
  3898. /**
  3899. * Your 'main' property view should extend this View. For any subview (tabs) you need to extend the PropertyTabView
  3900. **/
  3901. define('baglass/core-client/js/core-client/ui/properties/PropertyPageView',['../View', 'underscore', '../../nls/StringResources', '../dialogs/ConfirmationDialog', '../KeyCodes', './PropertyUIControl'], function (View, _, StringResource, ConfirmationDialog, KeyCodes, PropertyUIControl) {
  3902. 'use strict'; //NOSONAR
  3903. var PropertyPageView = View.extend({
  3904. _bIsCancelRequest: false,
  3905. init: function init(options) {
  3906. PropertyPageView.inherited('init', this, arguments);
  3907. _.extend(this, options);
  3908. this.$el.on('keydown', this._keydownHandler.bind(this));
  3909. },
  3910. renderPropertyUIControl: function renderPropertyUIControl(spec) {
  3911. this._oPropertyUIControl = new PropertyUIControl(spec);
  3912. return this._oPropertyUIControl.render().then(function () {
  3913. return this._oPropertyUIControl;
  3914. }.bind(this));
  3915. },
  3916. getPropertyUIControl: function getPropertyUIControl() {
  3917. return this._oPropertyUIControl;
  3918. },
  3919. /**
  3920. * Called by Glass so it knows if the slideout can be closed
  3921. * returns a promise with a boolean
  3922. */
  3923. canHide: function canHide(option) {
  3924. // Make sure we set this to false but we check if we can hide
  3925. this._bIsCancelRequest = false;
  3926. if (option.isEscape) {
  3927. this._bIsCancelRequest = true;
  3928. return this._canCancel();
  3929. } else {
  3930. return this._canClose();
  3931. }
  3932. },
  3933. /**
  3934. Override as needed
  3935. **/
  3936. setFocus: function setFocus() {
  3937. this._oPropertyUIControl.focus();
  3938. },
  3939. onHide: function onHide() {
  3940. if (this._bIsCancelRequest || !this._oPropertyUIControl) {
  3941. return Promise.resolve(true);
  3942. }
  3943. return this._oPropertyUIControl.onClose().then(function () {
  3944. return this._doSave();
  3945. }.bind(this)).then(function () {
  3946. this._oPropertyUIControl.remove();
  3947. }.bind(this));
  3948. },
  3949. /**
  3950. * Override as needed
  3951. */
  3952. _canClose: function _canClose() {
  3953. if (this._oPropertyUIControl) {
  3954. return this._oPropertyUIControl.onClose().then(function () {
  3955. return !this._oPropertyUIControl.hasValidationError();
  3956. }.bind(this));
  3957. } else {
  3958. return Promise.resolve(true);
  3959. }
  3960. },
  3961. _canCancel: function _canCancel() {
  3962. if (this._needToConfirmCancel()) {
  3963. return this._confirmCancel();
  3964. }
  3965. return true;
  3966. },
  3967. /**
  3968. * Override as needed
  3969. */
  3970. _doSave: function _doSave() {},
  3971. /**
  3972. * Override as needed
  3973. */
  3974. _needToConfirmCancel: function _needToConfirmCancel() {
  3975. return this._oPropertyUIControl.hasModifiedProperties();
  3976. },
  3977. /**
  3978. Override as needed
  3979. **/
  3980. _closeSlideout: function _closeSlideout() {
  3981. this.slideout.hide();
  3982. },
  3983. _confirmCancel: function _confirmCancel() {
  3984. return new Promise(function (resolve, reject) {
  3985. var oConfirmationDialog = new ConfirmationDialog('confirmCancel', StringResource.get('confirmCancel'), StringResource.get('confirmCancelMessage'));
  3986. oConfirmationDialog.confirm(resolve, reject);
  3987. });
  3988. },
  3989. _keydownHandler: function _keydownHandler(event) {
  3990. var key = event.keyCode || event.which;
  3991. var bPropagateEvent = true;
  3992. if (key === KeyCodes.s && event.ctrlKey) {
  3993. this._closeSlideout();
  3994. bPropagateEvent = false;
  3995. }
  3996. if (!bPropagateEvent) {
  3997. event.stopPropagation();
  3998. }
  3999. return bPropagateEvent;
  4000. }
  4001. });
  4002. return PropertyPageView;
  4003. });
  4004. //# sourceMappingURL=PropertyPageView.js.map
  4005. ;
  4006. /*
  4007. *+------------------------------------------------------------------------+
  4008. *| Licensed Materials - Property of IBM
  4009. *| IBM Cognos Products: Content Explorer
  4010. *| (C) Copyright IBM Corp. 2016, 2017
  4011. *|
  4012. *| US Government Users Restricted Rights - Use, duplication or disclosure
  4013. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  4014. *+------------------------------------------------------------------------+
  4015. */
  4016. define('baglass/core-client/js/core-client/ui/properties/PropertyTabView',['../View', 'underscore', './PropertyUIControl'], function (View, _, PropertyUIControl) {
  4017. 'use strict';
  4018. var PropertyTabView = View.extend({
  4019. init: function init(options) {
  4020. PropertyTabView.inherited('init', this, arguments);
  4021. _.extend(this, options);
  4022. },
  4023. renderPropertyUIControl: function renderPropertyUIControl(spec) {
  4024. this._oPropertyUIControl = new PropertyUIControl(spec);
  4025. return this._oPropertyUIControl.render().then(function () {
  4026. return this._oPropertyUIControl;
  4027. }.bind(this));
  4028. },
  4029. getPropertyUIControl: function getPropertyUIControl() {
  4030. return this._oPropertyUIControl;
  4031. },
  4032. onClose: function onClose() {
  4033. return this._oPropertyUIControl.onClose();
  4034. },
  4035. getModifiedProperties: function getModifiedProperties() {
  4036. return this._oPropertyUIControl.getModifiedProperties();
  4037. },
  4038. hasValidationError: function hasValidationError() {
  4039. return this._oPropertyUIControl.hasValidationError();
  4040. }
  4041. });
  4042. return PropertyTabView;
  4043. });
  4044. //# sourceMappingURL=PropertyTabView.js.map
  4045. ;
  4046. define('text!baglass/core-client/js/core-client/ui/properties/templates/Separator.html',[],function () { return '<div class="separator property_{{=it.id}}"></div>';});
  4047. /*
  4048. *+------------------------------------------------------------------------+
  4049. *| Licensed Materials - Property of IBM
  4050. *| IBM Cognos Products: Content Explorer
  4051. *| (C) Copyright IBM Corp. 2015, 2017
  4052. *|
  4053. *| US Government Users Restricted Rights - Use, duplication or disclosure
  4054. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  4055. *+------------------------------------------------------------------------+
  4056. */
  4057. define('baglass/core-client/js/core-client/ui/properties/Separator',['./BaseProperty', 'text!./templates/Separator.html', 'underscore', 'doT'], function (BaseProperty, separatorTemplate, _, dot) {
  4058. 'use strict'; //NOSONAR
  4059. var Separator = BaseProperty.extend({
  4060. /**
  4061. * @param options.indent {int} - default 0, will indent by options.indent * 10px
  4062. **/
  4063. init: function init(spec) {
  4064. Separator.inherited('init', this, arguments);
  4065. _.extend(this, spec);
  4066. },
  4067. doRender: function doRender() {
  4068. var sHtml = dot.template(separatorTemplate)({
  4069. 'id': this.id
  4070. });
  4071. this.$el.append(sHtml);
  4072. },
  4073. processStaticValidation: function processStaticValidation() {
  4074. // Empty function to override BaseProperty processStaticValidation. Hide the icons from this UI element
  4075. }
  4076. });
  4077. return Separator;
  4078. });
  4079. //# sourceMappingURL=Separator.js.map
  4080. ;
  4081. 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>';});
  4082. /*
  4083. *+------------------------------------------------------------------------+
  4084. *| Licensed Materials - Property of IBM
  4085. *| IBM Cognos Products: Content Explorer
  4086. *| (C) Copyright IBM Corp. 2015, 2017
  4087. *|
  4088. *| US Government Users Restricted Rights - Use, duplication or disclosure
  4089. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  4090. *+------------------------------------------------------------------------+
  4091. */
  4092. define('baglass/core-client/js/core-client/ui/properties/Split',['./PropertyContainerBaseClass', './PropertyUIControl', 'text!./templates/Split.html', 'jquery', 'doT', 'underscore'], function (PropertyContainerBaseClass, PropertyUIControl, split, $, dot, _) {
  4093. 'use strict';
  4094. var Split = PropertyContainerBaseClass.extend({
  4095. ellipses: true,
  4096. /**
  4097. @param options.el {node} - container DOM node
  4098. @param options.items {array} - array of controls to render. Currently only been tested with buttons
  4099. **/
  4100. init: function init(options) {
  4101. this.events = {};
  4102. Split.inherited('init', this, arguments);
  4103. _.extend(this, options);
  4104. },
  4105. doRender: function doRender() {
  4106. var left = [];
  4107. var right = [];
  4108. for (var i = 0; i < this.items.length; i = i + 1) {
  4109. if (this.items[i].align === 'left') {
  4110. left = this.items[i].items;
  4111. } else if (this.items[i].align === 'right') {
  4112. right = this.items[i].items;
  4113. }
  4114. }
  4115. var sHtml = dot.template(split)({
  4116. 'disabled': this.disabled,
  4117. 'id': this.id,
  4118. 'readOnly': this.readOnly,
  4119. 'name': this.name,
  4120. 'styles': this.styles,
  4121. 'role': this.role,
  4122. 'hidden': this.hidden
  4123. });
  4124. this.$el.append(sHtml);
  4125. return this._render(left, right);
  4126. },
  4127. getSplitLeftDiv: function getSplitLeftDiv() {
  4128. return this.$el.find('.property_' + this.id + ' .splitLeft');
  4129. },
  4130. getSplitRightDiv: function getSplitRightDiv() {
  4131. return this.$el.find('.property_' + this.id + ' .splitRight');
  4132. },
  4133. _render: function _render(left, right) {
  4134. this.propertyUIControlLeft = this._renderSplit(this.getSplitLeftDiv(), left);
  4135. this.propertyUIControlRight = this._renderSplit(this.getSplitRightDiv(), right);
  4136. this.processIndent();
  4137. return this.propertyUIControlLeft.render().then(function () {
  4138. return this.propertyUIControlRight.render();
  4139. }.bind(this));
  4140. },
  4141. _renderSplit: function _renderSplit(div, items) {
  4142. var propertyUIControl = new PropertyUIControl({
  4143. 'glassContext': this.glassContext,
  4144. 'el': div,
  4145. 'readOnly': this.readOnly,
  4146. 'items': items,
  4147. 'onChange': this.onChange,
  4148. 'primaryUIControl': false
  4149. });
  4150. return propertyUIControl;
  4151. }
  4152. });
  4153. return Split;
  4154. });
  4155. //# sourceMappingURL=Split.js.map
  4156. ;
  4157. 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>';});
  4158. /*
  4159. *+------------------------------------------------------------------------+
  4160. *| Licensed Materials - Property of IBM
  4161. *| IBM Cognos Products: Content Explorer
  4162. *| (C) Copyright IBM Corp. 2015, 2017
  4163. *|
  4164. *| US Government Users Restricted Rights - Use, duplication or disclosure
  4165. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  4166. *+------------------------------------------------------------------------+
  4167. */
  4168. 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) {
  4169. 'use strict'; //NOSONAR
  4170. var TabControl = BaseProperty.extend({
  4171. tabLabelPrefix: 'tabLabel_',
  4172. /**
  4173. * @param options.$el - JQuery node to append the table HTML
  4174. * @param options.items {object} - An array of tab metadata. Must provide name, module, and objectInfo (containing all the basic properties of the object)
  4175. * @param options.onTabChange {function} - callback notified whenever the selected tab changes
  4176. *
  4177. * @constructor
  4178. */
  4179. init: function init(options) {
  4180. this.events = {};
  4181. this.events['keydown .tab' + options.id] = '_handleKeyDown';
  4182. TabControl.inherited('init', this, arguments);
  4183. _.extend(this, options);
  4184. this._tabs = [];
  4185. },
  4186. /**
  4187. * Entry point: render template using JSON specification passed from caller
  4188. **/
  4189. render: function render() {
  4190. var sHtml = dot.template(tabTemplate);
  4191. this.$el.append(sHtml);
  4192. if (this.items.length !== 0) {
  4193. var selIndex = 0;
  4194. this.items.forEach(function (item, index) {
  4195. this._createTab(item, index);
  4196. if (item.selected === true) {
  4197. selIndex = index;
  4198. }
  4199. }.bind(this));
  4200. return this.selectTab(this._tabs[selIndex]);
  4201. } else {
  4202. return Promise.resolve();
  4203. }
  4204. },
  4205. remove: function remove() {
  4206. TabControl.inherited('remove', this, arguments);
  4207. this._tabs.forEach(function (tab) {
  4208. if (tab.tabContent) {
  4209. tab.tabContent.remove();
  4210. }
  4211. });
  4212. this._tabs = [];
  4213. },
  4214. onClose: function onClose() {
  4215. var aPromises = [];
  4216. this._tabs.forEach(function (tab) {
  4217. if (tab.tabContent && tab.tabContent.onClose) {
  4218. aPromises.push(tab.tabContent.onClose());
  4219. }
  4220. });
  4221. return Promise.all(aPromises);
  4222. },
  4223. _handleKeyDown: function _handleKeyDown(evt) {
  4224. if (evt.keyCode !== KeyCodes.LEFT_ARROW && evt.keyCode !== KeyCodes.RIGHT_ARROW) {
  4225. return true;
  4226. }
  4227. var target = $(evt.target);
  4228. var tabIndex = Number(target.attr('tabNumber'));
  4229. if (evt.keyCode === 37 /*left arrow*/) {
  4230. tabIndex = tabIndex === 0 ? this._tabs.length - 1 : tabIndex - 1;
  4231. } else if (evt.keyCode === 39 /*right arrow*/) {
  4232. tabIndex = tabIndex >= this._tabs.length - 1 ? 0 : tabIndex + 1;
  4233. }
  4234. this.$el.find('.tabNumber' + tabIndex).focus();
  4235. this.selectTab(this._tabs[tabIndex]);
  4236. evt.stopPropagation();
  4237. return false;
  4238. },
  4239. selectTab: function selectTab(tab) {
  4240. if (!(tab && tab.item)) {
  4241. return Promise.reject();
  4242. } else if (!this._selectedTabObject || tab.item.name !== this._selectedTabObject.item.name) {
  4243. this._hideTabContent(this._selectedTabObject);
  4244. this._selectedTabObject = tab;
  4245. return this._showTabContent(this._selectedTabObject).then(function () {
  4246. if (this.onTabChange) {
  4247. this.onTabChange(this.name, tab.item);
  4248. }
  4249. }.bind(this));
  4250. } else {
  4251. return Promise.resolve();
  4252. }
  4253. },
  4254. selectTabByName: function selectTabByName(tabName) {
  4255. var tab = _.find(this._tabs, function (tab) {
  4256. return tab.item.name === tabName;
  4257. });
  4258. return this.selectTab(tab);
  4259. },
  4260. _hideTabContent: function _hideTabContent(tab) {
  4261. if (tab) {
  4262. if (tab.tabContent && tab.tabContent.hide) {
  4263. tab.tabContent.hide();
  4264. tab.tabContent.$el.attr('aria-hidden', 'true');
  4265. }
  4266. tab.pane.removeClass('active');
  4267. tab.label.removeClass('active');
  4268. tab.label.attr('aria-selected', 'false');
  4269. tab.label.attr('tabindex', '-1');
  4270. }
  4271. },
  4272. _showTabContent: function _showTabContent(tab) {
  4273. // Note, we need to show the tab pane before we populate the tab so that any size calculations
  4274. // can be done correctly
  4275. tab.pane.addClass('active');
  4276. return this._populateTab(tab).then(function () {
  4277. tab.tabContent.show();
  4278. tab.tabContent.$el.attr('aria-hidden', 'false');
  4279. tab.label.addClass('active');
  4280. tab.label.attr('aria-selected', 'true');
  4281. tab.label.attr('tabindex', '0');
  4282. return true;
  4283. }.bind(this));
  4284. },
  4285. /**
  4286. * @param item.name - Name of tab
  4287. * @param item.module - Name of module to instantiate
  4288. **/
  4289. _createTab: function _createTab(item, index) {
  4290. //used to store all aspects of a single tab in one object
  4291. var tab = {};
  4292. tab.item = item;
  4293. tab.pane = this._createTabPane(index);
  4294. tab.label = this._createTabLabel(tab, index);
  4295. this.$el.find('div.tab-content').append(tab.pane);
  4296. this.$el.find('ul.nav').append(tab.label);
  4297. this.processStaticValidation.call(_.extend({}, this, {
  4298. staticValidationCallback: tab.item.staticValidationCallback
  4299. }), tab.label.find('a'));
  4300. this._tabs.push(tab);
  4301. },
  4302. _createTabLabel: function _createTabLabel(tab, index) {
  4303. var link = $('<a>', {
  4304. 'class': this.tabLabelPrefix + tab.item.name.replace(' ', '_'),
  4305. 'html': tab.item.name
  4306. });
  4307. var linkWrapper = $('<li></li>', {
  4308. 'id': this.id + index,
  4309. 'role': 'tab',
  4310. 'aria-selected': 'false',
  4311. 'class': 'tab' + this.id + ' tabNumber' + index,
  4312. 'tabNumber': index,
  4313. 'tabindex': '-1'
  4314. });
  4315. linkWrapper.on('primaryaction', function (e) {
  4316. e.preventDefault();
  4317. var tabIndex = Number(e.currentTarget.getAttribute('tabNumber'));
  4318. this.selectTab(this._tabs[tabIndex]);
  4319. }.bind(this));
  4320. return linkWrapper.append(link);
  4321. },
  4322. _populateTab: function _populateTab(tab) {
  4323. if (tab.tabContent) {
  4324. return Promise.resolve(true);
  4325. }
  4326. return ClassFactory.loadModule(tab.item.module).then(function (TabContent) {
  4327. tab.item.el = tab.pane;
  4328. tab.item.glassContext = this.glassContext;
  4329. // propagate onChange listener
  4330. if (this.onChange && !tab.item.onChange) {
  4331. tab.item.onChange = this.onChange;
  4332. }
  4333. tab.tabContent = new TabContent(tab.item);
  4334. return tab.tabContent.render();
  4335. }.bind(this)).then(function () {
  4336. tab.tabContent.$el.attr('aria-hidden', 'false');
  4337. if (tab.tabContent.show) {
  4338. tab.tabContent.show();
  4339. }
  4340. return this;
  4341. });
  4342. },
  4343. _createTabPane: function _createTabPane(index) {
  4344. return $('<div>', {
  4345. 'class': 'tab-pane',
  4346. 'role': 'tabpanel',
  4347. 'aria-labelledby': this.id + index,
  4348. 'aria-hidden': 'true'
  4349. });
  4350. },
  4351. getModifiedProperties: function getModifiedProperties() {
  4352. var result = {};
  4353. this._tabs.forEach(function (tab) {
  4354. if (tab.tabContent && tab.tabContent.getModifiedProperties) {
  4355. $.extend(result, tab.tabContent.getModifiedProperties());
  4356. }
  4357. });
  4358. return result;
  4359. },
  4360. hasValidationError: function hasValidationError() {
  4361. for (var i = 0; i < this._tabs.length; i = i + 1) {
  4362. var tab = this._tabs[i];
  4363. if (tab.tabContent && tab.tabContent.hasValidationError && tab.tabContent.hasValidationError()) {
  4364. return true;
  4365. }
  4366. }
  4367. return false;
  4368. }
  4369. });
  4370. return TabControl;
  4371. });
  4372. //# sourceMappingURL=TabControl.js.map
  4373. ;
  4374. 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';});
  4375. /*
  4376. *+------------------------------------------------------------------------+
  4377. *| Licensed Materials - Property of IBM
  4378. *| IBM Cognos Products: Content Explorer
  4379. *| (C) Copyright IBM Corp. 2015, 2018
  4380. *|
  4381. *| US Government Users Restricted Rights - Use, duplication or disclosure
  4382. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  4383. *+------------------------------------------------------------------------+
  4384. */
  4385. 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) {
  4386. 'use strict';
  4387. var MultiLineValue = BaseProperty.extend({
  4388. /**
  4389. * Creates a property with multiline value. Value can be modified if the option, editable, is set to true.
  4390. * @param options.el {node} - parent element
  4391. * @param options.name {string} - property name
  4392. * @param options.label {string} - property label
  4393. * @param options.value {string} - property value
  4394. * @param options.multiline {boolean} - default false, if true, label and value are on separete lines, if false, label and value are shown adjacently
  4395. * @param options.editable {boolean} - true or false
  4396. * @param options.readOnly {boolean} - optional, default is false. If true, the UI will be rendered in a read-only mode
  4397. * @param options.id {string} - unique id
  4398. * @param options.onChange {function} - the callback function called when property value had been edited
  4399. * @param options.indent {int} - default 0, will indent by options.indent * 10px
  4400. * @param options.placeHolderText {string} - optional, if you want text to be shown when the input is empty
  4401. */
  4402. init: function init(options) {
  4403. if (options.editable) {
  4404. if (!this.events) {
  4405. this.events = {};
  4406. }
  4407. this.events['input .editable' + options.id] = '_handleEditInput';
  4408. this.events['keydown .editable' + options.id] = '_handleEditKeydown';
  4409. }
  4410. MultiLineValue.inherited('init', this, arguments);
  4411. if (!_.isString(options.placeHolderText)) {
  4412. options.placeHolderText = '';
  4413. }
  4414. _.extend(this, options);
  4415. this.preserveLineBreak = true;
  4416. },
  4417. doRender: function doRender() {
  4418. var sHtml = dot.template(textAreaTemplate)({
  4419. 'id': this.id,
  4420. 'label': this.label,
  4421. 'value': this.value,
  4422. 'multiline': this.multiline,
  4423. 'direction': BidiUtil.resolveBaseTextDir(this.value, true),
  4424. 'editable': this.editable && !this.readOnly,
  4425. 'name': this.name,
  4426. 'readOnly': this.readOnly,
  4427. 'strings': {
  4428. 'edit': StringResource.get('edit')
  4429. },
  4430. 'placeHolderText': this.placeHolderText
  4431. });
  4432. this.$el.append(sHtml);
  4433. this._setAutoGrow();
  4434. return;
  4435. },
  4436. _handleEditKeydown: function _handleEditKeydown(evt) {
  4437. //Escape key : revert changes
  4438. if (evt.keyCode === 27) {
  4439. return this._onEscFromInput(evt);
  4440. } else {
  4441. this._setAutoGrow();
  4442. }
  4443. },
  4444. _handleEditInput: function _handleEditInput() {
  4445. this._setAutoGrow();
  4446. },
  4447. _setAutoGrow: function _setAutoGrow() {
  4448. var textArea = this.$el.find('textarea').get(0);
  4449. if (textArea && textArea.scrollHeight > textArea.clientHeight) {
  4450. $(textArea).addClass('capEditableHeight');
  4451. textArea.style.height = textArea.scrollHeight + 'px';
  4452. }
  4453. },
  4454. getHTMLControl: function getHTMLControl() {
  4455. if (!this._htmlControl) {
  4456. this._htmlControl = this.getPropertyNode().find('textarea');
  4457. }
  4458. return this._htmlControl;
  4459. }
  4460. });
  4461. return MultiLineValue;
  4462. });
  4463. //# sourceMappingURL=TextArea.js.map
  4464. ;
  4465. 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';});
  4466. /*
  4467. *+------------------------------------------------------------------------+
  4468. *| Licensed Materials - Property of IBM
  4469. *| IBM Cognos Products: Content Explorer
  4470. *| (C) Copyright IBM Corp. 2015, 2017
  4471. *|
  4472. *| US Government Users Restricted Rights - Use, duplication or disclosure
  4473. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  4474. *+------------------------------------------------------------------------+
  4475. */
  4476. define('baglass/core-client/js/core-client/ui/properties/ToggleButton',['./BaseProperty', 'text!./templates/ToggleButton.html', 'jquery', 'doT', 'underscore'], function (BaseProperty, template, $, dot, _) {
  4477. 'use strict';
  4478. var ToggleButton = BaseProperty.extend({
  4479. buttonSelector: '.toggleButton',
  4480. /**
  4481. * Creates a property with a toggle button.
  4482. *
  4483. * @param options.id {string} - property id
  4484. * @param options.el {node} - parent element
  4485. * @param options.name {string} - property name
  4486. * @param options.label {string} - property label
  4487. * @param options.checked {boolean} - true or false
  4488. * @param options.disabled {boolean} - default is false, set to true if you want the control disabled
  4489. * @param options.onChange {function} - callback to be notified as soon as the change happens
  4490. * @param options.indent {int} - default 0, will indent by options.indent * 10px
  4491. * @param options.readOnly {boolean}{optional} - true or false
  4492. * @param options.nestedUIControl {boolean} - optional, default is false. Set to true if this UI Widget is being rendered by another UI Widget
  4493. * @param options.ariaLabel {string} - if you want to override the default label for screen readers
  4494. */
  4495. init: function init(options) {
  4496. this.events = {};
  4497. this.events['clicktap .property_' + options.id] = '_handleClick';
  4498. this.events['keydown .property_' + options.id] = '_handleKeyDown';
  4499. this.checked = false;
  4500. this.nestedUIControl = false;
  4501. ToggleButton.inherited('init', this, arguments);
  4502. _.extend(this, options);
  4503. },
  4504. doRender: function doRender() {
  4505. var sHtml = dot.template(template)({
  4506. 'label': this.label,
  4507. 'checked': this.checked,
  4508. 'id': this.id,
  4509. 'name': this.name,
  4510. 'readOnly': this.readOnly,
  4511. 'uncheckedLabel': this.uncheckedLabel,
  4512. 'checkedLabel': this.checkedLabel,
  4513. 'nestedUIControl': this.nestedUIControl,
  4514. 'ariaLabel': this.ariaLabel
  4515. });
  4516. this.$el.append(sHtml);
  4517. if (this.disabled) {
  4518. this.disable();
  4519. }
  4520. },
  4521. /**
  4522. Override since we're not using a standard input control
  4523. **/
  4524. getHTMLControl: function getHTMLControl() {
  4525. return this.getPropertyNode().find(this.buttonSelector);
  4526. },
  4527. _handleClick: function _handleClick(event) {
  4528. this._toggleButton();
  4529. event.stopPropagation();
  4530. return false;
  4531. },
  4532. isChecked: function isChecked() {
  4533. var $control = this.getHTMLControl();
  4534. return $control.hasClass('checked');
  4535. },
  4536. _toggleButton: function _toggleButton() {
  4537. this.setValue(!this.isChecked(), true);
  4538. },
  4539. _hasValueChanged: function _hasValueChanged(propertyValue) {
  4540. return propertyValue !== this.isChecked();
  4541. },
  4542. check: function check(fireOnChange) {
  4543. this.setValue(true, fireOnChange);
  4544. },
  4545. uncheck: function uncheck(fireOnChange) {
  4546. this.setValue(false, fireOnChange);
  4547. },
  4548. setValue: function setValue(checked, fireOnChange) {
  4549. var $control = this.getHTMLControl();
  4550. if (fireOnChange) {
  4551. this._onChange(this.name, checked);
  4552. }
  4553. if (checked) {
  4554. $control.addClass('checked');
  4555. } else {
  4556. $control.removeClass('checked');
  4557. }
  4558. $control.attr('aria-checked', checked ? 'true' : false);
  4559. },
  4560. _handleKeyDown: function _handleKeyDown(evt) {
  4561. if (evt.keyCode === 32 || evt.keyCode === 13) {
  4562. // space || enter
  4563. this._toggleButton();
  4564. }
  4565. }
  4566. });
  4567. return ToggleButton;
  4568. });
  4569. //# sourceMappingURL=ToggleButton.js.map
  4570. ;
  4571. 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';});
  4572. /*
  4573. *+------------------------------------------------------------------------+
  4574. *| Licensed Materials - Property of IBM
  4575. *| IBM Cognos Products: Content Explorer
  4576. *| (C) Copyright IBM Corp. 2017
  4577. *|
  4578. *| US Government Users Restricted Rights - Use, duplication or disclosure
  4579. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  4580. *+------------------------------------------------------------------------+
  4581. */
  4582. 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, _) {
  4583. 'use strict';
  4584. var ToggledCombo = BaseProperty.extend({
  4585. /**
  4586. * Creates a property with toggledCombo
  4587. * @param options.id {string} - property id
  4588. * @param options.el {node} - parent element
  4589. * @param options.name {string} - property name
  4590. * @param options.label {string} - property label
  4591. * @param options.dropDownOptions {object} - An object for drop down control options
  4592. * options.dropDownOptions.options {array} - Array of objects for each option in the select control
  4593. * options.dropDownOptions.name {string} - Optional, drop down property name
  4594. * options.dropDownOptions.defaultValue {string} - Optional, drop down default value
  4595. * @param options.checkBoxOptions {object} - An object for check box control options
  4596. * options.checkBoxOptions.checked {boolean} - Optional, the initial state of check box
  4597. * options.checkBoxOptions.name {string} - Optional, check box property name
  4598. * @param options.inputOptions {object} - An object for input control options
  4599. * options.inputOptions.value {string} - Optional, the initial value of input
  4600. * options.inputOptions.name {string} - Optional, input property name
  4601. * @param options.validateInput {function} - optional, a function to validate the input field
  4602. * @param options.onChange {function} - callback to be notified as soon as the change happens
  4603. * @param options.readOnly {boolean} - optional, default is false. If true, the UI will be rendered in a read-only mode
  4604. * @param options.nestedUIControl {boolean} - optional, default is false. Set to true if this UI Widget is being rendered by another UI Widget
  4605. * @param options.ariaLabel {string} - optional, if you want to override the default label for screen readers
  4606. * @param options.toggledComboHint {string} - optional, a hint displays below the control
  4607. * @param options.useToggleButton {bool} - optional, if passed the control will use a toggle button switch instead of the usual checkbox
  4608. */
  4609. init: function init(options) {
  4610. this.events = {};
  4611. this.nestedUIControl = false;
  4612. ToggledCombo.inherited('init', this, arguments);
  4613. _.extend(this, options);
  4614. },
  4615. doRender: function doRender() {
  4616. var sHtml = dot.template(Template)({
  4617. 'name': this.name,
  4618. 'id': this.id,
  4619. 'readOnly': this.readOnly,
  4620. 'ariaLabel': this.ariaLabel,
  4621. 'nestedUIControl': this.nestedUIControl,
  4622. 'toggledComboHint': this.toggledComboHint
  4623. });
  4624. this.$el.append(sHtml);
  4625. this._renderCheckBox();
  4626. this._renderInput();
  4627. this._renderDropDown();
  4628. },
  4629. _renderCheckBox: function _renderCheckBox() {
  4630. var checkboxOptions = {
  4631. el: this.$el.find('.property_' + this.id + ' .toggledComboCheckBox')[0],
  4632. id: this.id + '_checkbox',
  4633. checked: this.checkBoxOptions.checked,
  4634. name: this.checkBoxOptions.name,
  4635. label: this.label,
  4636. onChange: this._checkboxOnChange.bind(this)
  4637. };
  4638. this.checkBox = this.useToggleButton ? new ToggleButton(checkboxOptions) : new CheckBox(checkboxOptions);
  4639. this.checkBox.doRender();
  4640. },
  4641. _renderInput: function _renderInput() {
  4642. var inputOptions = {
  4643. el: this.$el.find('.property_' + this.id + ' .toggledComboInput')[0],
  4644. value: this.inputOptions.value,
  4645. name: this.inputOptions.name,
  4646. id: this.id + '_input',
  4647. newLook: true,
  4648. highlightTextOnFocus: true,
  4649. ellipses: false,
  4650. inputClass: 'narrowInput',
  4651. customValidatorCallback: this._validateInput.bind(this),
  4652. onChange: this._controlOnChange.bind(this),
  4653. disabled: !this.checkBoxOptions.checked
  4654. };
  4655. this.input = new Input(inputOptions);
  4656. this.input.doRender();
  4657. },
  4658. _renderDropDown: function _renderDropDown() {
  4659. var dropDownOptions = {
  4660. el: this.$el.find('.property_' + this.id + ' .toggledComboDropDown')[0],
  4661. name: this.dropDownOptions.name,
  4662. options: this.dropDownOptions.options,
  4663. defaultValue: this.dropDownOptions.defaultValue,
  4664. id: this.id + '_dropDown',
  4665. ariaLabel: this.dropDownOptions.ariaDescribedby,
  4666. onChange: this._controlOnChange.bind(this),
  4667. disabled: !this.checkBoxOptions.checked,
  4668. customValidatorCallback: this._validateDropDown.bind(this)
  4669. };
  4670. this.dropDown = new DropDown(dropDownOptions);
  4671. this.dropDown.doRender();
  4672. },
  4673. _validateInput: function _validateInput(value) {
  4674. return this._validateBase(value, this.dropDown.getSelectedValue());
  4675. },
  4676. _validateDropDown: function _validateDropDown(value) {
  4677. return this._validateBase(parseInt(this.input.getValue(), 10), value);
  4678. },
  4679. _validateBase: function _validateBase(inputValue, dropDownValue) {
  4680. var isValid = true;
  4681. if (_.isFunction(this.validateInput)) {
  4682. isValid = this.validateInput(inputValue, dropDownValue);
  4683. }
  4684. return {
  4685. isValid: isValid,
  4686. customHandler: this._resetInput.bind(this)
  4687. };
  4688. },
  4689. _resetInput: function _resetInput() {
  4690. this.input.setValue(this.inputOptions.value);
  4691. this.dropDown.setValue(this.dropDownOptions.defaultValue || this.dropDownOptions.options[0].value);
  4692. },
  4693. _checkboxOnChange: function _checkboxOnChange(name, isChecked) {
  4694. if (isChecked) {
  4695. this.input.enable();
  4696. this.dropDown.enable();
  4697. } else {
  4698. this.input.disable();
  4699. this.dropDown.disable();
  4700. }
  4701. this._controlOnChange(isChecked);
  4702. },
  4703. _controlOnChange: function _controlOnChange(isChecked) {
  4704. var values = this.getValues();
  4705. if (_.isBoolean(isChecked)) {
  4706. values[this.checkBoxOptions.name] = isChecked;
  4707. }
  4708. this._onChange(this.name, values);
  4709. },
  4710. getValues: function getValues() {
  4711. var result = {};
  4712. result[this.checkBoxOptions.name] = this.checkBox.isChecked();
  4713. result[this.dropDownOptions.name] = this.dropDown.getSelectedValue();
  4714. result[this.inputOptions.name] = this.input.getValue();
  4715. return result;
  4716. }
  4717. });
  4718. return ToggledCombo;
  4719. });
  4720. //# sourceMappingURL=ToggledCombo.js.map
  4721. ;
  4722. 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';});
  4723. /*
  4724. *+------------------------------------------------------------------------+
  4725. *| Licensed Materials - Property of IBM
  4726. *| IBM Cognos Products: Content Explorer
  4727. *| (C) Copyright IBM Corp. 2018
  4728. *|
  4729. *| US Government Users Restricted Rights - Use, duplication or disclosure
  4730. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  4731. *+------------------------------------------------------------------------+
  4732. */
  4733. 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, $, _) {
  4734. 'use strict';
  4735. var TwoStageCombo = BaseProperty.extend({
  4736. templateString: Template,
  4737. /**
  4738. * Creates a property with a multi stage combo
  4739. * @param {string} options.id - property id
  4740. * @param {node} options.el - parent element
  4741. * @param {string} options.name - property name
  4742. * @param {string} options.label - property label
  4743. * @param {object} options.dropDownOptions - An object for drop down control options (see DropDown.js)
  4744. * @param {array} [options.collapsiblePickerOptions] - An array of CollapsiblePicker specs to use to show a picker when the equivalent
  4745. * drop down item (at same index) is selected. I.e. second drop down item so the second spec is used to display a CollapsiblePicker
  4746. * @param {function} options.onChange - callback to be notified as soon as the change happens
  4747. * @param {boolean} [options.readOnly=false] - If true, the UI will be rendered in a read-only mode
  4748. * @param {boolean} [options.nestedUIControl=false] - Set to true if this UI Widget is being rendered by another UI Widget
  4749. * @param {string} [options.ariaLabel] - if you want to override the default label for screen readers
  4750. */
  4751. init: function init(options) {
  4752. this.events = {};
  4753. this.nestedUIControl = false;
  4754. this.collapsiblePickerOptions = [];
  4755. TwoStageCombo.inherited('init', this, arguments);
  4756. _.extend(this, options);
  4757. this.currentValue = this.dropDownOptions.defaultValue;
  4758. },
  4759. doRender: function doRender() {
  4760. var sHtml = this.dotTemplate({
  4761. 'name': this.name,
  4762. 'id': this.id,
  4763. 'readOnly': this.readOnly,
  4764. 'ariaLabel': this.ariaLabel,
  4765. 'nestedUIControl': this.nestedUIControl
  4766. });
  4767. this.$el.append(sHtml);
  4768. this.$controls = this.$el.find('.property_' + this.id + ' .twoStageComboControls');
  4769. this._renderDropDown();
  4770. },
  4771. _onChange: function _onChange(name, value) {
  4772. this._updateCurrentValue(value);
  4773. TwoStageCombo.inherited('_onChange', this, arguments);
  4774. },
  4775. _onChangeForDropDown: function _onChangeForDropDown(name, value) {
  4776. var valuesList = [];
  4777. for (var i = 0; i < this.dropDownOptions.options.length; i++) {
  4778. valuesList.push(this.dropDownOptions.options[i].value);
  4779. }
  4780. var index = _.indexOf(valuesList, value);
  4781. if (!this.collapsiblePickerOptions[index]) {
  4782. if (this.collapsiblePicker) {
  4783. this._removeSeparator();
  4784. this._removeCollapsiblePicker();
  4785. }
  4786. if (value !== this.currentValue) {
  4787. this._onChange(name, value);
  4788. }
  4789. } else {
  4790. this._renderPickerControl(index);
  4791. }
  4792. },
  4793. _onChangeForCollapsiblePicker: function _onChangeForCollapsiblePicker(name, value) {
  4794. this._onChange(name, value);
  4795. },
  4796. _updateCurrentValue: function _updateCurrentValue(value) {
  4797. this.currentValue = value;
  4798. },
  4799. _createControlNode: function _createControlNode(className) {
  4800. var node = document.createElement('div');
  4801. node.classList.add(className);
  4802. this.$controls.append(node);
  4803. return node;
  4804. },
  4805. _renderDropDown: function _renderDropDown() {
  4806. var dropDownOptions = {
  4807. id: this.id + '_dropDown',
  4808. name: this.dropDownOptions.name,
  4809. label: this.dropDownOptions.label,
  4810. defaultValue: this.dropDownOptions.defaultValue,
  4811. options: this.dropDownOptions.options,
  4812. nestedUIControl: true,
  4813. el: this._createControlNode('twoStageComboControl'),
  4814. onChange: this._onChangeForDropDown.bind(this)
  4815. };
  4816. this.dropDown = new DropDown(dropDownOptions);
  4817. this.dropDown.doRender();
  4818. // Check to see if the defaultValue / currently selected value should show a CollapsiblePicker
  4819. for (var i = 0; i < this.dropDownOptions.options.length; i++) {
  4820. var item = this.dropDownOptions.options[i];
  4821. if (item.value === this.dropDownOptions.defaultValue) {
  4822. this._renderPickerControl(i);
  4823. break;
  4824. }
  4825. }
  4826. },
  4827. _renderSeparator: function _renderSeparator() {
  4828. this.separator = new Separator({
  4829. id: this.id + '_separator',
  4830. el: this.$controls[0],
  4831. nestedUIControl: true
  4832. });
  4833. this.separator.doRender();
  4834. },
  4835. _renderPickerControl: function _renderPickerControl(index) {
  4836. var options = this.collapsiblePickerOptions[index];
  4837. if (options) {
  4838. this._renderSeparator();
  4839. options.id = this.id + '_collapsiblePicker';
  4840. options.el = this._createControlNode('twoStageComboControl');
  4841. options.open = true;
  4842. options.readOnly = false;
  4843. options.closeOnSelect = false;
  4844. options.nestedUIControl = true;
  4845. options.itemType = 'svg';
  4846. options.onChange = this._onChangeForCollapsiblePicker.bind(this);
  4847. this.collapsiblePicker = new CollapsiblePicker(options);
  4848. this.collapsiblePicker.doRender();
  4849. }
  4850. },
  4851. _removeSeparator: function _removeSeparator() {
  4852. this.separator.hide();
  4853. this.separator.remove();
  4854. this.separator = null;
  4855. },
  4856. _removeCollapsiblePicker: function _removeCollapsiblePicker() {
  4857. this.collapsiblePicker.hide();
  4858. this.collapsiblePicker.remove();
  4859. this.collapsiblePicker.$el.remove();
  4860. this.collapsiblePicker = null;
  4861. }
  4862. });
  4863. return TwoStageCombo;
  4864. });
  4865. //# sourceMappingURL=TwoStageCombo.js.map
  4866. ;
  4867. /*
  4868. *+------------------------------------------------------------------------+
  4869. *| Licensed Materials - Property of IBM
  4870. *| IBM Cognos Products: Content Explorer
  4871. *| (C) Copyright IBM Corp. 2016, 2017
  4872. *|
  4873. *| US Government Users Restricted Rights - Use, duplication or disclosure
  4874. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  4875. *+------------------------------------------------------------------------+
  4876. */
  4877. // This file is used to create the require.js layers. Only the entry points are necessary
  4878. 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 () {
  4879. 'use strict';
  4880. });
  4881. //# sourceMappingURL=all.js.map
  4882. ;
  4883. define("js/glass/propertiesBundle", function(){});