adore.js 502 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895
  1. var __extends = (this && this.__extends) || function (d, b) {
  2. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  3. function __() { this.constructor = d; }
  4. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  5. };
  6. define("ADORE", ["require", "exports"], function (require, exports) {
  7. "use strict";
  8. (function (ADORE) {
  9. ADORE[ADORE["LEFT"] = 2] = "LEFT";
  10. ADORE[ADORE["RIGHT"] = 4] = "RIGHT";
  11. ADORE[ADORE["CENTER"] = 8] = "CENTER";
  12. ADORE[ADORE["Close"] = 16] = "Close";
  13. ADORE[ADORE["Normal"] = 0] = "Normal";
  14. ADORE[ADORE["Nav"] = 32] = "Nav";
  15. ADORE[ADORE["Footer"] = 64] = "Footer";
  16. ADORE[ADORE["Control"] = 262144] = "Control";
  17. ADORE[ADORE["Scrollable"] = 524288] = "Scrollable";
  18. ADORE[ADORE["CardPanel"] = 1048576] = "CardPanel";
  19. ADORE[ADORE["Password"] = 128] = "Password";
  20. ADORE[ADORE["Float"] = 256] = "Float";
  21. ADORE[ADORE["Flat"] = 512] = "Flat";
  22. ADORE[ADORE["Large"] = 1024] = "Large";
  23. ADORE[ADORE["Zoom"] = 32] = "Zoom";
  24. ADORE[ADORE["Switch"] = 33] = "Switch";
  25. ADORE[ADORE["ProductShowNoIncome"] = 34] = "ProductShowNoIncome";
  26. ADORE[ADORE["INFORMATION"] = 134217728] = "INFORMATION";
  27. ADORE[ADORE["CONFIRM"] = 268435456] = "CONFIRM";
  28. ADORE[ADORE["QUESTION"] = 536870912] = "QUESTION";
  29. ADORE[ADORE["MODAL"] = 1073741824] = "MODAL";
  30. ADORE[ADORE["Horizontal"] = 68] = "Horizontal";
  31. ADORE[ADORE["Vertical"] = 69] = "Vertical";
  32. ADORE[ADORE["Arrow"] = 73] = "Arrow";
  33. ADORE[ADORE["Graphics"] = 81] = "Graphics";
  34. })(exports.ADORE || (exports.ADORE = {}));
  35. var ADORE = exports.ADORE;
  36. });
  37. define("event/MessageType", ["require", "exports"], function (require, exports) {
  38. "use strict";
  39. (function (MessageType) {
  40. MessageType[MessageType["INIT"] = 6] = "INIT";
  41. MessageType[MessageType["WIDGET"] = 22] = "WIDGET";
  42. MessageType[MessageType["GPS"] = 24] = "GPS";
  43. MessageType[MessageType["FINISH"] = 38] = "FINISH";
  44. MessageType[MessageType["ERROR"] = 54] = "ERROR";
  45. MessageType[MessageType["ACTIVE_ELEMENT"] = 55] = "ACTIVE_ELEMENT";
  46. MessageType[MessageType["DISPLAY_FILTER"] = 56] = "DISPLAY_FILTER";
  47. MessageType[MessageType["DISPLAY"] = 58] = "DISPLAY";
  48. })(exports.MessageType || (exports.MessageType = {}));
  49. var MessageType = exports.MessageType;
  50. });
  51. define("Config", ["require", "exports"], function (require, exports) {
  52. "use strict";
  53. var Config = (function () {
  54. function Config() {
  55. }
  56. Config.init = function (args) {
  57. if (args.themePath) {
  58. $("head").find("#adoreTheme").remove();
  59. $("<link type='text/css' rel='stylesheet'>").attr({
  60. "id": "adoreTheme", "href": args.themePath
  61. }).appendTo(document.head);
  62. }
  63. };
  64. return Config;
  65. }());
  66. exports.Config = Config;
  67. });
  68. define("event/EventHub", ["require", "exports", "event/MessageType"], function (require, exports, MessageType_1) {
  69. "use strict";
  70. var EventHub = (function () {
  71. function EventHub() {
  72. }
  73. EventHub.dispatchEvent = function (msgType, attrs) {
  74. var evtObj = {
  75. msgType: msgType,
  76. attributes: attrs
  77. };
  78. var msg = JSON.stringify(evtObj);
  79. if (window["eventdispatch"]) {
  80. return window["eventdispatch"].dispatch(msg);
  81. }
  82. else if (window["cefQuery"]) {
  83. if (msgType === MessageType_1.MessageType.INIT || msgType === MessageType_1.MessageType.FINISH) {
  84. return window["cefQuery"]({
  85. request: msg,
  86. onSuccess: function (response) {
  87. },
  88. onFailure: function (error_code, error_message) {
  89. }
  90. });
  91. }
  92. else {
  93. try {
  94. EventHub.xmlHttpRequest.open("get", "adore://message?msg=" + msg +
  95. "&timestamp=" + new Date().valueOf(), false);
  96. EventHub.xmlHttpRequest.send();
  97. return "true" === EventHub.xmlHttpRequest.responseText;
  98. }
  99. catch (e) {
  100. console.error(e);
  101. return false;
  102. }
  103. }
  104. }
  105. else if (window["dispatch"]) {
  106. return window["dispatch"](msg);
  107. }
  108. else {
  109. return confirm("adore://" + msg);
  110. }
  111. };
  112. EventHub.xmlHttpRequest = new XMLHttpRequest();
  113. return EventHub;
  114. }());
  115. exports.EventHub = EventHub;
  116. });
  117. define("event/Event", ["require", "exports"], function (require, exports) {
  118. "use strict";
  119. (function (Event) {
  120. Event[Event["DISPOSED"] = 12] = "DISPOSED";
  121. Event[Event["MOUSE_UP"] = 36] = "MOUSE_UP";
  122. Event[Event["MOUSE_DOWN"] = 37] = "MOUSE_DOWN";
  123. Event[Event["CLICK"] = 38] = "CLICK";
  124. Event[Event["MODIFY"] = 39] = "MODIFY";
  125. Event[Event["ON_CHANGE"] = 40] = "ON_CHANGE";
  126. Event[Event["BROWSER_EVENT"] = 41] = "BROWSER_EVENT";
  127. Event[Event["ON_FOCUS"] = 42] = "ON_FOCUS";
  128. Event[Event["KEY_UP"] = 43] = "KEY_UP";
  129. Event[Event["KEY_DONW"] = 44] = "KEY_DONW";
  130. Event[Event["SELECTION"] = 45] = "SELECTION";
  131. Event[Event["TOUCH_MOVE"] = 46] = "TOUCH_MOVE";
  132. Event[Event["LOOK_OVER"] = 47] = "LOOK_OVER";
  133. Event[Event["ON_SLIDING"] = 48] = "ON_SLIDING";
  134. Event[Event["ON_CLOSE"] = 49] = "ON_CLOSE";
  135. Event[Event["DOUBLE_CLICK"] = 50] = "DOUBLE_CLICK";
  136. })(exports.Event || (exports.Event = {}));
  137. var Event = exports.Event;
  138. });
  139. define("util/Map", ["require", "exports"], function (require, exports) {
  140. "use strict";
  141. var Map = (function () {
  142. function Map() {
  143. this.elements = new Array();
  144. }
  145. Map.prototype.put = function (key, value) {
  146. this.elements.push({ key: key, value: value });
  147. };
  148. Map.prototype.containsKey = function (key) {
  149. if (this.elements.length === 0) {
  150. return false;
  151. }
  152. else {
  153. for (var i = 0; i < this.elements.length; i++) {
  154. var element = this.elements[i];
  155. if (element.key === key) {
  156. return true;
  157. }
  158. }
  159. return false;
  160. }
  161. };
  162. Map.prototype.containsValue = function (value) {
  163. for (var i = 0; i < this.elements.length; i++) {
  164. var element = this.elements[i];
  165. if (element.value === value) {
  166. return true;
  167. }
  168. return false;
  169. }
  170. };
  171. Map.prototype.remove = function (key) {
  172. for (var i = 0; i < this.elements.length; i++) {
  173. var element = this.elements[i];
  174. if (element.key === key) {
  175. return this.elements.splice(i, 1);
  176. }
  177. }
  178. return null;
  179. };
  180. Map.prototype.getValue = function (key) {
  181. for (var i = 0; i < this.elements.length; i++) {
  182. var element = this.elements[i];
  183. if (element.key === key) {
  184. return element.value;
  185. }
  186. }
  187. return null;
  188. };
  189. Map.prototype.size = function () {
  190. return this.elements.length;
  191. };
  192. Map.prototype.clear = function () {
  193. this.elements.splice(0, this.size());
  194. };
  195. return Map;
  196. }());
  197. exports.Map = Map;
  198. });
  199. define("hotkey/Keys", ["require", "exports"], function (require, exports) {
  200. "use strict";
  201. (function (Keys) {
  202. Keys[Keys["BACKSPACE"] = 8] = "BACKSPACE";
  203. Keys[Keys["TAB"] = 9] = "TAB";
  204. Keys[Keys["CLEAR"] = 12] = "CLEAR";
  205. Keys[Keys["ENTER"] = 13] = "ENTER";
  206. Keys[Keys["SHIFT"] = 16] = "SHIFT";
  207. Keys[Keys["CTRL"] = 17] = "CTRL";
  208. Keys[Keys["ALT"] = 18] = "ALT";
  209. Keys[Keys["META"] = 91] = "META";
  210. Keys[Keys["PAUSE"] = 19] = "PAUSE";
  211. Keys[Keys["CAPS_LOCK"] = 20] = "CAPS_LOCK";
  212. Keys[Keys["ESCAPE"] = 27] = "ESCAPE";
  213. Keys[Keys["SPACE"] = 32] = "SPACE";
  214. Keys[Keys["PAGE_UP"] = 33] = "PAGE_UP";
  215. Keys[Keys["PAGE_DOWN"] = 34] = "PAGE_DOWN";
  216. Keys[Keys["END"] = 35] = "END";
  217. Keys[Keys["HOME"] = 36] = "HOME";
  218. Keys[Keys["LEFT_ARROW"] = 37] = "LEFT_ARROW";
  219. Keys[Keys["UP_ARROW"] = 38] = "UP_ARROW";
  220. Keys[Keys["RIGHT_ARROW"] = 39] = "RIGHT_ARROW";
  221. Keys[Keys["DOWN_ARROW"] = 40] = "DOWN_ARROW";
  222. Keys[Keys["INSERT"] = 45] = "INSERT";
  223. Keys[Keys["DELETE"] = 46] = "DELETE";
  224. Keys[Keys["HELP"] = 47] = "HELP";
  225. Keys[Keys["NUM_0"] = 48] = "NUM_0";
  226. Keys[Keys["NUM_1"] = 49] = "NUM_1";
  227. Keys[Keys["NUM_2"] = 50] = "NUM_2";
  228. Keys[Keys["NUM_3"] = 51] = "NUM_3";
  229. Keys[Keys["NUM_4"] = 52] = "NUM_4";
  230. Keys[Keys["NUM_5"] = 53] = "NUM_5";
  231. Keys[Keys["NUM_6"] = 54] = "NUM_6";
  232. Keys[Keys["NUM_7"] = 55] = "NUM_7";
  233. Keys[Keys["NUM_8"] = 56] = "NUM_8";
  234. Keys[Keys["NUM_9"] = 57] = "NUM_9";
  235. Keys[Keys["CHAR_A"] = 65] = "CHAR_A";
  236. Keys[Keys["CHAR_B"] = 66] = "CHAR_B";
  237. Keys[Keys["CHAR_C"] = 67] = "CHAR_C";
  238. Keys[Keys["CHAR_D"] = 68] = "CHAR_D";
  239. Keys[Keys["CHAR_E"] = 69] = "CHAR_E";
  240. Keys[Keys["CHAR_F"] = 70] = "CHAR_F";
  241. Keys[Keys["CHAR_G"] = 71] = "CHAR_G";
  242. Keys[Keys["CHAR_H"] = 72] = "CHAR_H";
  243. Keys[Keys["CHAR_I"] = 73] = "CHAR_I";
  244. Keys[Keys["CHAR_J"] = 74] = "CHAR_J";
  245. Keys[Keys["CHAR_K"] = 75] = "CHAR_K";
  246. Keys[Keys["CHAR_L"] = 76] = "CHAR_L";
  247. Keys[Keys["CHAR_M"] = 77] = "CHAR_M";
  248. Keys[Keys["CHAR_N"] = 78] = "CHAR_N";
  249. Keys[Keys["CHAR_O"] = 79] = "CHAR_O";
  250. Keys[Keys["CHAR_P"] = 80] = "CHAR_P";
  251. Keys[Keys["CHAR_Q"] = 81] = "CHAR_Q";
  252. Keys[Keys["CHAR_R"] = 82] = "CHAR_R";
  253. Keys[Keys["CHAR_S"] = 83] = "CHAR_S";
  254. Keys[Keys["CHAR_T"] = 84] = "CHAR_T";
  255. Keys[Keys["CHAR_U"] = 85] = "CHAR_U";
  256. Keys[Keys["CHAR_V"] = 86] = "CHAR_V";
  257. Keys[Keys["CHAR_W"] = 87] = "CHAR_W";
  258. Keys[Keys["CHAR_X"] = 88] = "CHAR_X";
  259. Keys[Keys["CHAR_Y"] = 89] = "CHAR_Y";
  260. Keys[Keys["CHAR_Z"] = 90] = "CHAR_Z";
  261. Keys[Keys["LEFT_WINDOW"] = 91] = "LEFT_WINDOW";
  262. Keys[Keys["RIGHT_WINDOW"] = 92] = "RIGHT_WINDOW";
  263. Keys[Keys["SELECT"] = 93] = "SELECT";
  264. Keys[Keys["NUMPAD_0"] = 96] = "NUMPAD_0";
  265. Keys[Keys["NUMPAD_1"] = 97] = "NUMPAD_1";
  266. Keys[Keys["NUMPAD_2"] = 98] = "NUMPAD_2";
  267. Keys[Keys["NUMPAD_3"] = 99] = "NUMPAD_3";
  268. Keys[Keys["NUMPAD_4"] = 100] = "NUMPAD_4";
  269. Keys[Keys["NUMPAD_5"] = 101] = "NUMPAD_5";
  270. Keys[Keys["NUMPAD_6"] = 102] = "NUMPAD_6";
  271. Keys[Keys["NUMPAD_7"] = 103] = "NUMPAD_7";
  272. Keys[Keys["NUMPAD_8"] = 104] = "NUMPAD_8";
  273. Keys[Keys["NUMPAD_9"] = 105] = "NUMPAD_9";
  274. Keys[Keys["NUMPAD_MULTIPLY"] = 106] = "NUMPAD_MULTIPLY";
  275. Keys[Keys["NUMPAD_PLUS"] = 107] = "NUMPAD_PLUS";
  276. Keys[Keys["NUMPAD_ENTER"] = 108] = "NUMPAD_ENTER";
  277. Keys[Keys["NUMPAD_MINUS"] = 109] = "NUMPAD_MINUS";
  278. Keys[Keys["NUMPAD_PERIOD"] = 110] = "NUMPAD_PERIOD";
  279. Keys[Keys["NUMPAD_DIVIDE"] = 111] = "NUMPAD_DIVIDE";
  280. Keys[Keys["F1"] = 112] = "F1";
  281. Keys[Keys["F2"] = 113] = "F2";
  282. Keys[Keys["F3"] = 114] = "F3";
  283. Keys[Keys["F4"] = 115] = "F4";
  284. Keys[Keys["F5"] = 116] = "F5";
  285. Keys[Keys["F6"] = 117] = "F6";
  286. Keys[Keys["F7"] = 118] = "F7";
  287. Keys[Keys["F8"] = 119] = "F8";
  288. Keys[Keys["F9"] = 120] = "F9";
  289. Keys[Keys["F10"] = 121] = "F10";
  290. Keys[Keys["F11"] = 122] = "F11";
  291. Keys[Keys["F12"] = 123] = "F12";
  292. Keys[Keys["F13"] = 124] = "F13";
  293. Keys[Keys["F14"] = 125] = "F14";
  294. Keys[Keys["F15"] = 126] = "F15";
  295. Keys[Keys["NUM_LOCK"] = 144] = "NUM_LOCK";
  296. Keys[Keys["SCROLL_LOCK"] = 145] = "SCROLL_LOCK";
  297. Keys[Keys["UP_DPAD"] = 175] = "UP_DPAD";
  298. Keys[Keys["DOWN_DPAD"] = 176] = "DOWN_DPAD";
  299. Keys[Keys["LEFT_DPAD"] = 177] = "LEFT_DPAD";
  300. Keys[Keys["RIGHT_DPAD"] = 178] = "RIGHT_DPAD";
  301. Keys[Keys["SLASH"] = 191] = "SLASH";
  302. })(exports.Keys || (exports.Keys = {}));
  303. var Keys = exports.Keys;
  304. });
  305. define("widget/MessageDialog", ["require", "exports", "widget/Widget", "event/EventHub", "event/Event", "event/MessageType", "util/WidgetUtil", "hotkey/Keys"], function (require, exports, Widget_1, EventHub_1, Event_1, MessageType_2, WidgetUtil_1, Keys_1) {
  306. "use strict";
  307. var MessageDialog = (function (_super) {
  308. __extends(MessageDialog, _super);
  309. function MessageDialog(parentId, id, style) {
  310. _super.call(this, parentId, id, style);
  311. this.modal = true;
  312. this.$thisNode = $(MessageDialog.Template).attr("id", this.id);
  313. this.$wrapMessage = $(MessageDialog.TemplateWrap).attr("id", this.id + "_wrap");
  314. this.$titleNode = this.$thisNode.find("h4");
  315. this.$contentNode = this.$thisNode.find("pre").attr("id", this.id + "_p");
  316. this.$footerNode = this.$thisNode.find("div.modal-footer");
  317. }
  318. MessageDialog.prototype.setFocus = function () {
  319. };
  320. MessageDialog.prototype.setTitle = function (args) {
  321. this.$titleNode.text(args.title);
  322. };
  323. MessageDialog.prototype.setMessage = function (args) {
  324. this.$contentNode[0].innerHTML = args.message.replace(/</g, "&lt;").replace(/>/g, "&gt;");
  325. };
  326. MessageDialog.prototype.createBtnNode = function (btnLabel, code) {
  327. var _this = this;
  328. var $btnNode = $(MessageDialog.TemplateButton);
  329. $btnNode.text(btnLabel);
  330. $btnNode.appendTo(this.$footerNode);
  331. var own = this;
  332. $btnNode.on("click", function (e) {
  333. if (own.type === 2) {
  334. if (code === 0) {
  335. var value = own.$thisNode.find("input").val();
  336. EventHub_1.EventHub.dispatchEvent(MessageType_2.MessageType.WIDGET, { id: own.id, evtType: Event_1.Event.CLICK, inputText: value });
  337. }
  338. else {
  339. EventHub_1.EventHub.dispatchEvent(MessageType_2.MessageType.WIDGET, { id: own.id, evtType: Event_1.Event.CLICK, inputText: "" });
  340. }
  341. }
  342. else if (own.type === 1) {
  343. if (code === 0) {
  344. var text = own.$thisNode.find("select").val();
  345. EventHub_1.EventHub.dispatchEvent(MessageType_2.MessageType.WIDGET, { id: own.id, evtType: Event_1.Event.CLICK, inputText: text });
  346. }
  347. else {
  348. EventHub_1.EventHub.dispatchEvent(MessageType_2.MessageType.WIDGET, { id: own.id, evtType: Event_1.Event.CLICK, inputText: "" });
  349. }
  350. }
  351. else {
  352. EventHub_1.EventHub.dispatchEvent(MessageType_2.MessageType.WIDGET, { id: _this.id, evtType: Event_1.Event.CLICK, returnCode: code });
  353. }
  354. });
  355. $btnNode.on("focus", function (e) {
  356. _this.setCurrentFocusIndex(code);
  357. });
  358. };
  359. MessageDialog.prototype.setCurrentFocusIndex = function (index) {
  360. this.currentFocusIndex = index;
  361. };
  362. MessageDialog.prototype.setMessageType = function (args) {
  363. this.$footerNode.find("a").remove();
  364. var type = args.messageType;
  365. var tmpId = this.id;
  366. if (type === "confirm") {
  367. this.createBtnNode("Cancel", 1);
  368. this.createBtnNode("Ok", 0);
  369. }
  370. else if (type === "question") {
  371. this.createBtnNode("No", 1);
  372. this.createBtnNode("Yes", 0);
  373. }
  374. else if (type === "information") {
  375. this.createBtnNode("Ok", 0);
  376. }
  377. else if (type === "close") {
  378. this.createBtnNode("Cancel", 1);
  379. this.createBtnNode("Ok", 0);
  380. var closeIcon = $(MessageDialog.TemplateCloseButton);
  381. var $titleBlock = this.$thisNode.find(".adore_dialog_title");
  382. $titleBlock.append(closeIcon);
  383. }
  384. };
  385. MessageDialog.prototype.setButtonTexts = function (args) {
  386. this.$footerNode.find("a").remove();
  387. var btnLabels = args.buttonTexts;
  388. var btnLabelArr = btnLabels.split("<!-- split -->");
  389. var len = btnLabelArr.length;
  390. for (var i = len - 1; i >= 0; i--) {
  391. this.createBtnNode(btnLabelArr[i], i);
  392. }
  393. };
  394. MessageDialog.prototype.setModal = function (args) {
  395. this.modal = args.modal;
  396. };
  397. MessageDialog.prototype.show = function () {
  398. this.$thisNode.appendTo(this.$wrapMessage.find(".messageWrap"));
  399. this.$wrapMessage.appendTo(document.body);
  400. var own = this;
  401. var btns = $("#" + this.id).find("div.modal-footer").find("a").reverse();
  402. this.currentFocusIndex = 0;
  403. var index = this.currentFocusIndex;
  404. this.$thisNode.css({
  405. display: "block",
  406. opacity: 0,
  407. scaleX: "0.7"
  408. });
  409. this.$thisNode.velocity({ opacity: 1, scaleX: "1" }, {
  410. duration: 320,
  411. queue: false,
  412. ease: "easeOutCubic"
  413. });
  414. own.wrapBlockLocation();
  415. this.resizeListener = function () {
  416. own.wrapBlockLocation();
  417. };
  418. $(window).on("resize", this.resizeListener);
  419. if (window.innerWidth <= 600) {
  420. if (this.resetDialogSize("adore_dialog_mobile_size_level_1", "adore_dialog_mobile_size_level_2")) {
  421. this.resetDialogSize("adore_dialog_mobile_size_level_2", "adore_dialog_mobile_size_level_3");
  422. }
  423. }
  424. else {
  425. if (this.resetDialogSize("adore_dialog_size_level_1", "adore_dialog_size_level_2")) {
  426. this.resetDialogSize("adore_dialog_size_level_2", "adore_dialog_size_level_3");
  427. }
  428. }
  429. $(MessageDialog.TemplateOverlay).attr("id", this.id + "_overlay").appendTo(document.body);
  430. WidgetUtil_1.WidgetUtil.refreshDialogZIndex(this.$thisNode[0]);
  431. if (btns.length !== 0) {
  432. $(btns[index]).focus();
  433. }
  434. this.clickListener = function (e) {
  435. own.handleClick(e);
  436. };
  437. $(document).on("click", this.clickListener);
  438. };
  439. MessageDialog.prototype.handleKeydown = function (e) {
  440. var btns = this.$thisNode.find("div.modal-footer").find("a").reverse();
  441. if (e.keyCode === Keys_1.Keys.TAB || e.keyCode === Keys_1.Keys.DOWN_ARROW || e.keyCode === Keys_1.Keys.RIGHT_ARROW) {
  442. this.currentFocusIndex++;
  443. if (this.currentFocusIndex >= btns.length) {
  444. this.currentFocusIndex = 0;
  445. }
  446. $(btns[this.currentFocusIndex]).focus();
  447. e.preventDefault();
  448. }
  449. else if (e.keyCode === Keys_1.Keys.LEFT_ARROW || e.keyCode === Keys_1.Keys.UP_ARROW) {
  450. this.currentFocusIndex--;
  451. if (this.currentFocusIndex < 0) {
  452. this.currentFocusIndex = btns.length - 1;
  453. }
  454. $(btns[this.currentFocusIndex]).focus();
  455. e.preventDefault();
  456. }
  457. else if (e.keyCode === Keys_1.Keys.ENTER) {
  458. if (this.currentFocusIndex >= 0 && this.currentFocusIndex < btns.length) {
  459. $(btns[this.currentFocusIndex]).click();
  460. }
  461. e.preventDefault();
  462. }
  463. };
  464. MessageDialog.prototype.handleClick = function (e) {
  465. var btns = this.$thisNode.find("div.modal-footer").find("a");
  466. if (!btns.is(this)) {
  467. this.currentFocusIndex = -1;
  468. }
  469. };
  470. MessageDialog.prototype.wrapBlockLocation = function () {
  471. this.$wrapMessage.find(".myclass").css({
  472. "width": this.$thisNode.width(),
  473. "height": this.$thisNode.height(),
  474. "left": this.$thisNode.offset().left,
  475. "top": this.$thisNode.offset().top
  476. });
  477. };
  478. MessageDialog.prototype.resetDialogSize = function (removeClass, addClass) {
  479. var titleH = this.$thisNode.find("div.adore_dialog_title").height();
  480. var footerH = this.$footerNode.height();
  481. var contentH = this.$contentNode.height();
  482. var totalH = $("#" + this.id).height();
  483. var contentCanUseH = totalH - titleH - footerH;
  484. if (contentH >= contentCanUseH) {
  485. this.$thisNode.removeClass(removeClass).addClass(addClass);
  486. return true;
  487. }
  488. return false;
  489. };
  490. MessageDialog.prototype.dispose = function () {
  491. $("#" + this.id + "_overlay").remove();
  492. if (this.clickListener) {
  493. $(document).off("click", this.clickListener);
  494. }
  495. if (this.resizeListener) {
  496. $(window).off("resize", this.resizeListener);
  497. }
  498. _super.prototype.dispose.call(this);
  499. this.$wrapMessage.remove();
  500. };
  501. MessageDialog.prototype.handleKeyUpEvent = function (e) {
  502. };
  503. MessageDialog.prototype.handleKeyDownEvent = function (e, hasFilter) {
  504. this.handleKeydown(e);
  505. };
  506. MessageDialog.prototype.setInputType = function (args) {
  507. this.type = 2;
  508. var initialText = args.initialText;
  509. var $modalContent = this.$contentNode.parent();
  510. var $input = $("<input></input>");
  511. $input.val(initialText + "");
  512. $input.appendTo($modalContent);
  513. };
  514. MessageDialog.prototype.setComboType = function (args) {
  515. this.type = 1;
  516. var data = args.combo;
  517. var initialText = data.initialText;
  518. var comboArr = data.comboArr;
  519. if (!comboArr || comboArr.length === 0) {
  520. return;
  521. }
  522. var $t = $("<select></select>");
  523. for (var i = 0; i < comboArr.length; i++) {
  524. var option = $("<option></option>").text(comboArr[i] + "");
  525. if (initialText === comboArr[i]) {
  526. option.prop("selected", true);
  527. }
  528. option.appendTo($t);
  529. }
  530. $t.appendTo(this.$contentNode.parent());
  531. };
  532. MessageDialog.Template = "\n <div class=\"modal modal-fixed-footer adore_dialog adore_dialog_size_level_1\">\n <div class=\"adore_dialog_title\">\n <h4 class=\"adore_dialog_title_content\"></h4>\n </div>\n <div class=\"modal-content adore_dialog_message\">\n <pre class=\"adore_dialog_message_content\"></pre>\n </div>\n <div class=\"modal-footer\"></div>\n </div>";
  533. MessageDialog.TemplateWrap = "\n\t <div class=\"messageWrap\">\n\t <iframe class=\"myclass\"></iframe><div class=\"messageWrap\"></div>\n </div>";
  534. MessageDialog.TemplateButton = "<a href=\"#\" class=\"waves-effect btn-flat modal-action modal-close adore_dialog_btn\">Ok</a>";
  535. MessageDialog.TemplateOverlay = "<div class=\"adore_lean_overlay\"></div>";
  536. MessageDialog.TemplateCloseButton = "\n <a href=\"#\" class=\"waves-effect btn-flat modal-action modal-close adore_dialog_btn adore_dialog_cancel_icon large mdi-content-clear\">\n </a>\n ";
  537. return MessageDialog;
  538. }(Widget_1.Widget));
  539. exports.MessageDialog = MessageDialog;
  540. });
  541. define("layout/Layout", ["require", "exports"], function (require, exports) {
  542. "use strict";
  543. var Layout = (function () {
  544. function Layout(composite) {
  545. this.composite = composite;
  546. }
  547. Layout.prototype.dispose = function () { };
  548. return Layout;
  549. }());
  550. exports.Layout = Layout;
  551. });
  552. define("layout/HeaderFooterLayoutData", ["require", "exports"], function (require, exports) {
  553. "use strict";
  554. var HeaderFooterLayoutData = (function () {
  555. function HeaderFooterLayoutData(args) {
  556. this.style = args.style;
  557. this.height = args.height;
  558. }
  559. HeaderFooterLayoutData.Style = {
  560. HEADER: 1,
  561. FOOTER: 2,
  562. BODY: 3
  563. };
  564. return HeaderFooterLayoutData;
  565. }());
  566. exports.HeaderFooterLayoutData = HeaderFooterLayoutData;
  567. });
  568. define("layout/HeaderFooterLayout", ["require", "exports", "widget/Composite", "layout/Layout", "layout/HeaderFooterLayoutData"], function (require, exports, Composite_1, Layout_1, HeaderFooterLayoutData_1) {
  569. "use strict";
  570. var HeaderFooterLayout = (function (_super) {
  571. __extends(HeaderFooterLayout, _super);
  572. function HeaderFooterLayout(composite, layoutOrientation, hiddenFooter) {
  573. _super.call(this, composite);
  574. this.layoutOrientation = HeaderFooterLayout.LayoutOrientation.VERTICAL;
  575. this.hiddenFooter = false;
  576. this.layoutOrientation = layoutOrientation;
  577. this.hiddenFooter = hiddenFooter;
  578. }
  579. HeaderFooterLayout.prototype.selectChildren = function () {
  580. for (var _i = 0, _a = this.composite.children; _i < _a.length; _i++) {
  581. var child = _a[_i];
  582. if (child.getId().indexOf("FloatPanelComposite") !== -1) {
  583. child.append();
  584. continue;
  585. }
  586. if (!(child instanceof Composite_1.Composite) || !(child.layoutData instanceof HeaderFooterLayoutData_1.HeaderFooterLayoutData)) {
  587. continue;
  588. }
  589. var layoutData = child.layoutData;
  590. if (!this.header && layoutData.style === HeaderFooterLayoutData_1.HeaderFooterLayoutData.Style.HEADER) {
  591. this.header = child;
  592. }
  593. else if (!this.footer && layoutData.style === HeaderFooterLayoutData_1.HeaderFooterLayoutData.Style.FOOTER) {
  594. this.footer = child;
  595. }
  596. else if (!this.body && layoutData.style === HeaderFooterLayoutData_1.HeaderFooterLayoutData.Style.BODY) {
  597. this.body = child;
  598. }
  599. }
  600. };
  601. HeaderFooterLayout.prototype.horizontalLayout = function () {
  602. var own = this;
  603. var headerWidth = 0;
  604. var footerWidth = 0;
  605. if (this.header) {
  606. headerWidth = this.header.layoutData.height;
  607. this.header.$thisNode.css({
  608. position: "absolute",
  609. height: "100%",
  610. width: headerWidth + "px"
  611. });
  612. this.header.append();
  613. }
  614. if (this.footer) {
  615. footerWidth = this.footer.layoutData.height;
  616. this.footer.$thisNode.css({
  617. position: "absolute",
  618. height: "100%",
  619. width: footerWidth + "px",
  620. bottom: "0px",
  621. top: "0px",
  622. right: "0px",
  623. transition: "width 0.4s"
  624. });
  625. this.footer.append();
  626. }
  627. if (this.body) {
  628. this.body.$thisNode.css({
  629. position: "absolute",
  630. top: 0,
  631. bottom: 0,
  632. left: headerWidth + "px",
  633. right: footerWidth + "px",
  634. transition: "width 0.4s"
  635. });
  636. this.body.append();
  637. }
  638. own.horizontalSizeChangeListener = function () {
  639. own.body.$thisNode.css({
  640. width: own.composite.$thisNode.get(0).clientWidth - own.header.$thisNode.get(0).clientWidth
  641. - own.footer.$thisNode.get(0).clientWidth + "px"
  642. });
  643. };
  644. $(window).on("resize", own.horizontalSizeChangeListener);
  645. };
  646. HeaderFooterLayout.prototype.verticalLayout = function () {
  647. var own = this;
  648. var headerHeight = 0;
  649. var footerHeight = 0;
  650. if (this.header) {
  651. headerHeight = this.header.layoutData.height;
  652. this.header.$thisNode.css({
  653. position: "absolute",
  654. width: "100%",
  655. height: headerHeight + "px"
  656. });
  657. this.header.append();
  658. }
  659. if (this.footer) {
  660. footerHeight = this.footer.layoutData.height;
  661. this.footer.$thisNode.css({
  662. position: "absolute",
  663. width: "100%",
  664. height: footerHeight + "px",
  665. bottom: "0px",
  666. left: "0px",
  667. right: "0px",
  668. transition: "height 0.4s"
  669. });
  670. this.footer.append();
  671. }
  672. if (this.body) {
  673. this.body.$thisNode.css({
  674. position: "absolute",
  675. left: 0,
  676. right: 0,
  677. top: headerHeight + "px",
  678. bottom: footerHeight + "px",
  679. transition: "height 0.4s"
  680. });
  681. this.body.append();
  682. }
  683. };
  684. HeaderFooterLayout.prototype.layout = function () {
  685. var css = this.composite.$thisNode.get(0).style;
  686. if (!css.position || css.position === "" || css.position === "static") {
  687. css.position = "relative";
  688. }
  689. this.selectChildren();
  690. if (this.layoutOrientation === HeaderFooterLayout.LayoutOrientation.HORIZONTAL) {
  691. this.horizontalLayout();
  692. }
  693. else {
  694. this.verticalLayout();
  695. }
  696. this.handleHiddenFooter();
  697. };
  698. HeaderFooterLayout.prototype.dispose = function () {
  699. if (this.headerMutationObserver) {
  700. this.headerMutationObserver.disconnect();
  701. }
  702. if (this.footerMutationObserver) {
  703. this.footerMutationObserver.disconnect();
  704. }
  705. $(window).off("resize", this.horizontalSizeChangeListener);
  706. };
  707. HeaderFooterLayout.prototype.toString = function () {
  708. return "HeaderFooterLayout";
  709. };
  710. HeaderFooterLayout.prototype.handleHiddenFooter = function () {
  711. if (this.hiddenFooter && this.footer && this.body) {
  712. var hideFooterButton_1 = $("<div class='adore_footer_hide_button waves-effect waves-light large mdi-content-clear'></div>");
  713. var showFooterButton_1 = $("<img src='images/layout/showFooterIcon.png' class='adore_footer_show_button waves-effect waves-light'></img>");
  714. var isVertical_1 = true;
  715. if (this.layoutOrientation === HeaderFooterLayout.LayoutOrientation.HORIZONTAL) {
  716. isVertical_1 = false;
  717. }
  718. hideFooterButton_1.css({
  719. transition: "opacity 0.2s,visibility 0.2s"
  720. });
  721. showFooterButton_1.css({
  722. transition: "opacity 0.2s,visibility 0.2s"
  723. });
  724. var own_1 = this;
  725. hideFooterButton_1.on("click", function () {
  726. own_1.hideFooter(hideFooterButton_1, showFooterButton_1, isVertical_1);
  727. });
  728. showFooterButton_1.on("click", function () {
  729. own_1.showFooter(hideFooterButton_1, showFooterButton_1, isVertical_1);
  730. });
  731. this.footer.$thisNode.append(hideFooterButton_1);
  732. this.composite.$thisNode.append(showFooterButton_1);
  733. this.hideFooter(hideFooterButton_1, showFooterButton_1, isVertical_1);
  734. }
  735. };
  736. HeaderFooterLayout.prototype.hideFooter = function (hideFooterButton, showFooterButton, isVertical) {
  737. hideFooterButton.css({
  738. visibility: "hidden",
  739. opacity: 0
  740. });
  741. showFooterButton.css({
  742. visibility: "visible",
  743. opacity: 1
  744. });
  745. var footerWidthOrHeight = this.footer.layoutData.height;
  746. if (isVertical) {
  747. this.footer.$thisNode.css({
  748. height: 0
  749. });
  750. this.body.$thisNode.css({
  751. height: this.composite.$thisNode.get(0).clientHeight - this.header.$thisNode.get(0).clientHeight + "px"
  752. });
  753. }
  754. else {
  755. this.footer.$thisNode.css({
  756. width: 0
  757. });
  758. this.body.$thisNode.css({
  759. width: this.composite.$thisNode.get(0).clientWidth - this.header.$thisNode.get(0).clientWidth + "px"
  760. });
  761. }
  762. };
  763. HeaderFooterLayout.prototype.showFooter = function (hideFooterButton, showFooterButton, isVertical) {
  764. hideFooterButton.css({
  765. visibility: "visible",
  766. opacity: 1
  767. });
  768. showFooterButton.css({
  769. visibility: "hidden",
  770. opacity: 0
  771. });
  772. var footerWidthOrHeight = this.footer.layoutData.height;
  773. if (isVertical) {
  774. this.footer.$thisNode.css({
  775. height: footerWidthOrHeight + "px"
  776. });
  777. this.body.$thisNode.css({
  778. height: this.composite.$thisNode.get(0).clientHeight - this.header.$thisNode.get(0).clientHeight -
  779. footerWidthOrHeight + "px"
  780. });
  781. }
  782. else {
  783. this.footer.$thisNode.css({
  784. width: footerWidthOrHeight + "px"
  785. });
  786. this.body.$thisNode.css({
  787. width: this.composite.$thisNode.get(0).clientWidth - this.header.$thisNode.get(0).clientWidth -
  788. footerWidthOrHeight + "px"
  789. });
  790. }
  791. };
  792. HeaderFooterLayout.LayoutOrientation = {
  793. VERTICAL: 0,
  794. HORIZONTAL: 1
  795. };
  796. return HeaderFooterLayout;
  797. }(Layout_1.Layout));
  798. exports.HeaderFooterLayout = HeaderFooterLayout;
  799. });
  800. define("layout/RowGridLayoutData", ["require", "exports"], function (require, exports) {
  801. "use strict";
  802. var RowGridLayoutData = (function () {
  803. function RowGridLayoutData(args) {
  804. this.s = args.s;
  805. this.m = args.m;
  806. this.l = args.l;
  807. this.os = args.os;
  808. this.om = args.om;
  809. this.ol = args.ol;
  810. this.row = args.row;
  811. }
  812. RowGridLayoutData.prototype.getColumn = function () {
  813. return "s" + this.s + " m" + this.m + " l" + this.l;
  814. };
  815. RowGridLayoutData.prototype.getOffset = function () {
  816. return "offset-s" + this.os + " offset-m" + this.om + " offset-l" + this.ol;
  817. };
  818. return RowGridLayoutData;
  819. }());
  820. exports.RowGridLayoutData = RowGridLayoutData;
  821. });
  822. define("layout/RowGridLayout", ["require", "exports", "widget/Composite", "layout/Layout", "layout/RowGridLayoutData"], function (require, exports, Composite_2, Layout_2, RowGridLayoutData_1) {
  823. "use strict";
  824. var RowGridLayout = (function (_super) {
  825. __extends(RowGridLayout, _super);
  826. function RowGridLayout(composite) {
  827. _super.call(this, composite);
  828. }
  829. RowGridLayout.prototype.toString = function () {
  830. return "RowGridLayout";
  831. };
  832. RowGridLayout.prototype.layout = function () {
  833. var rowCount = 0;
  834. for (var _i = 0, _a = this.composite.children; _i < _a.length; _i++) {
  835. var child = _a[_i];
  836. var layoutData = child.layoutData;
  837. if (layoutData instanceof RowGridLayoutData_1.RowGridLayoutData) {
  838. if (layoutData.row > rowCount) {
  839. rowCount = layoutData.row;
  840. }
  841. }
  842. }
  843. var $curRowDivs = [];
  844. for (var i = 0; i <= rowCount; i++) {
  845. var rowDiv = $("<div class='row'></div>");
  846. rowDiv.css("position", "relative");
  847. $curRowDivs.push(rowDiv);
  848. }
  849. $curRowDivs[rowCount].css("marginBottom", "0px");
  850. for (var _b = 0, _c = this.composite.children; _b < _c.length; _b++) {
  851. var child = _c[_b];
  852. var layoutData = child.layoutData;
  853. if (layoutData instanceof RowGridLayoutData_1.RowGridLayoutData) {
  854. if (child.getId().indexOf("FloatPanelComposite") !== -1) {
  855. child.append();
  856. continue;
  857. }
  858. var column = layoutData.getColumn();
  859. var offset = layoutData.getOffset();
  860. var row = layoutData.row;
  861. var style = column + " col " + offset;
  862. child.$thisNode.addClass(style);
  863. if (child instanceof Composite_2.Composite) {
  864. child.$thisNode.css({
  865. position: "relative"
  866. });
  867. }
  868. child.$thisNode.appendTo($curRowDivs[row]);
  869. }
  870. }
  871. if (this.$rowDivs) {
  872. for (var _d = 0, _e = this.$rowDivs; _d < _e.length; _d++) {
  873. var $rowDiv = _e[_d];
  874. $rowDiv.remove();
  875. }
  876. }
  877. this.$rowDivs = $curRowDivs;
  878. for (var i = 0; i <= rowCount; i++) {
  879. this.$rowDivs[i].appendTo(this.composite.$attachNode);
  880. }
  881. };
  882. return RowGridLayout;
  883. }(Layout_2.Layout));
  884. exports.RowGridLayout = RowGridLayout;
  885. });
  886. define("layout/FillLayout", ["require", "exports", "layout/Layout"], function (require, exports, Layout_3) {
  887. "use strict";
  888. var FillLayout = (function (_super) {
  889. __extends(FillLayout, _super);
  890. function FillLayout(composite) {
  891. _super.call(this, composite);
  892. }
  893. FillLayout.prototype.layout = function () {
  894. for (var _i = 0, _a = this.composite.children; _i < _a.length; _i++) {
  895. var child = _a[_i];
  896. child.$thisNode.css({
  897. position: "absolute",
  898. top: 0,
  899. bottom: 0,
  900. left: 0,
  901. right: 0
  902. });
  903. child.append();
  904. }
  905. };
  906. FillLayout.prototype.toString = function () {
  907. return "FillLayout";
  908. };
  909. return FillLayout;
  910. }(Layout_3.Layout));
  911. exports.FillLayout = FillLayout;
  912. });
  913. define("widget/CollapseButton", ["require", "exports", "widget/Widget", "util/WidgetManager"], function (require, exports, Widget_2, WidgetManager_1) {
  914. "use strict";
  915. var CollapseButton = (function (_super) {
  916. __extends(CollapseButton, _super);
  917. function CollapseButton(parentId, id, style) {
  918. _super.call(this, parentId, id, style);
  919. this.$thisNode = $(CollapseButton.Template).attr("id", id);
  920. }
  921. CollapseButton.prototype.bindSideNav = function (args) {
  922. var sideNavComposite = WidgetManager_1.WidgetManager.byId(args.sideNavId);
  923. var parentComposite = sideNavComposite.parent;
  924. var sideNavLayout = parentComposite.layout_;
  925. sideNavLayout.setCollapseButton(this);
  926. };
  927. CollapseButton.Template = "<a href=\"#\" class=\"button-collapse\"><i class=\"mdi-navigation-menu\" style=\"font-size:3rem;\"></i></a>";
  928. return CollapseButton;
  929. }(Widget_2.Widget));
  930. exports.CollapseButton = CollapseButton;
  931. });
  932. define("layout/SideNav", ["require", "exports"], function (require, exports) {
  933. "use strict";
  934. var SideNav = (function () {
  935. function SideNav() {
  936. this.panning = false;
  937. this.menuOut = false;
  938. }
  939. SideNav.prototype.removeMenu = function (restoreNav) {
  940. var _this = this;
  941. this.panning = false;
  942. this.menuOut = false;
  943. $("body").css({
  944. overflow: "",
  945. width: ""
  946. });
  947. $("#sidenav-overlay").velocity({ opacity: 0 }, {
  948. duration: 200,
  949. queue: false, easing: "easeOutQuad",
  950. complete: function () {
  951. $(this).remove();
  952. }
  953. });
  954. if (this.options.edge === "left") {
  955. this.$dragTarget.css({ width: "", right: "", left: "0" });
  956. this.$nav.velocity({ "translateX": "-100%" }, {
  957. duration: 200,
  958. queue: false,
  959. easing: "easeOutCubic",
  960. complete: function () {
  961. if (restoreNav === true) {
  962. _this.$nav.removeAttr("style");
  963. _this.$nav.css("width", _this.options.width);
  964. }
  965. }
  966. });
  967. }
  968. else {
  969. this.$dragTarget.css({ width: "", right: "0", left: "" });
  970. this.$nav.velocity({ "translateX": "100%" }, {
  971. duration: 200,
  972. queue: false,
  973. easing: "easeOutCubic",
  974. complete: function () {
  975. if (restoreNav === true) {
  976. _this.$nav.removeAttr("style");
  977. _this.$nav.css({
  978. "position": "absolute",
  979. "left": "calc(100% - " + _this.options.width + "px)",
  980. "right": 0, "width": _this.options.width
  981. });
  982. }
  983. }
  984. });
  985. }
  986. };
  987. SideNav.prototype.onPan = function (e) {
  988. if (e.gesture.pointerType === "touch") {
  989. var direction = e.gesture.direction;
  990. var x = e.gesture.center.x;
  991. var y = e.gesture.center.y;
  992. var velocityX = e.gesture.velocityX;
  993. var $body = $("body");
  994. var oldWidth = $body.innerWidth();
  995. $body.css("overflow", "hidden");
  996. $body.width(oldWidth);
  997. if ($("#sidenav-overlay").length === 0) {
  998. var overlay = $("<div id=\"sidenav-overlay\"></div>");
  999. overlay.css("opacity", 0).click(function () {
  1000. this.removeMenu(false);
  1001. });
  1002. $("body").append(overlay);
  1003. }
  1004. if (this.options.edge === "left") {
  1005. if (x > this.options.width) {
  1006. x = this.options.width;
  1007. }
  1008. else if (x < 0) {
  1009. x = 0;
  1010. }
  1011. }
  1012. if (this.options.edge === "left") {
  1013. if (x < (this.options.width / 2)) {
  1014. this.menuOut = false;
  1015. }
  1016. else if (x >= (this.options.width / 2)) {
  1017. this.menuOut = true;
  1018. }
  1019. this.$nav.css("transform", "translateX(" + (x - this.options.width) + "px)");
  1020. }
  1021. else {
  1022. if (x < (window.innerWidth - this.options.width / 2)) {
  1023. this.menuOut = true;
  1024. }
  1025. else if (x >= (window.innerWidth - this.options.width / 2)) {
  1026. this.menuOut = false;
  1027. }
  1028. var rightPos = (x - this.options.width / 2);
  1029. if (rightPos < 0) {
  1030. rightPos = 0;
  1031. }
  1032. this.$nav.css("transform", "translateX(" + rightPos + "px)");
  1033. }
  1034. var overlayPerc = void 0;
  1035. if (this.options.edge === "left") {
  1036. overlayPerc = x / this.options.width;
  1037. $("#sidenav-overlay").velocity({ opacity: overlayPerc }, { duration: 10, queue: false, easing: "easeOutQuad" });
  1038. }
  1039. else {
  1040. overlayPerc = Math.abs((x - window.innerWidth) / this.options.width);
  1041. $("#sidenav-overlay").velocity({ opacity: overlayPerc }, { duration: 10, queue: false, easing: "easeOutQuad" });
  1042. }
  1043. }
  1044. };
  1045. SideNav.prototype.onPanend = function (e) {
  1046. if (e.gesture.pointerType === "touch") {
  1047. var velocityX = e.gesture.velocityX;
  1048. var x = e.gesture.center.x;
  1049. var leftPos = x - this.options.width;
  1050. var rightPos = x - this.options.width / 2;
  1051. if (leftPos > 0) {
  1052. leftPos = 0;
  1053. }
  1054. if (rightPos < 0) {
  1055. rightPos = 0;
  1056. }
  1057. this.panning = false;
  1058. if (this.options.edge === "left") {
  1059. if ((this.menuOut && velocityX <= 0.3) || velocityX < -0.5) {
  1060. if (leftPos !== 0) {
  1061. this.$nav.velocity({ "translateX": [0, leftPos] }, { duration: 300, queue: false, easing: "easeOutQuad" });
  1062. }
  1063. $("#sidenav-overlay").velocity({ opacity: 1 }, { duration: 50, queue: false, easing: "easeOutQuad" });
  1064. this.$dragTarget.css({ width: "50%", right: 0, left: "" });
  1065. }
  1066. else if (!this.menuOut || velocityX > 0.3) {
  1067. $("body").css({
  1068. overflow: "",
  1069. width: ""
  1070. });
  1071. this.$nav.velocity({ "translateX": [-1 * this.options.width - 10, leftPos] }, { duration: 200, queue: false, easing: "easeOutQuad" });
  1072. $("#sidenav-overlay").velocity({ opacity: 0 }, {
  1073. duration: 200, queue: false, easing: "easeOutQuad",
  1074. complete: function () {
  1075. $(this).remove();
  1076. }
  1077. });
  1078. this.$dragTarget.css({ width: "10px", right: "", left: 0 });
  1079. }
  1080. }
  1081. else {
  1082. if ((this.menuOut && velocityX >= -0.3) || velocityX > 0.5) {
  1083. this.$nav.velocity({ "translateX": [0, rightPos] }, { duration: 300, queue: false, easing: "easeOutQuad" });
  1084. $("#sidenav-overlay").velocity({ opacity: 1 }, { duration: 50, queue: false, easing: "easeOutQuad" });
  1085. this.$dragTarget.css({ width: "50%", right: "", left: 0 });
  1086. }
  1087. else if (!this.menuOut || velocityX < -0.3) {
  1088. $("body").css({
  1089. overflow: "",
  1090. width: ""
  1091. });
  1092. this.$nav.velocity({ "translateX": [this.options.width + 10, rightPos] }, { duration: 200, queue: false, easing: "easeOutQuad" });
  1093. $("#sidenav-overlay").velocity({ opacity: 0 }, {
  1094. duration: 200, queue: false, easing: "easeOutQuad",
  1095. complete: function () {
  1096. $(this).remove();
  1097. }
  1098. });
  1099. this.$dragTarget.css({ width: "10px", right: 0, left: "" });
  1100. }
  1101. }
  1102. }
  1103. };
  1104. SideNav.prototype.onResize = function (e) {
  1105. if (window.innerWidth > 992) {
  1106. if ($("#sidenav-overlay").length !== 0 && this.menuOut) {
  1107. this.removeMenu(true);
  1108. }
  1109. else {
  1110. this.$nav.css("transform", "translateX(0%)");
  1111. }
  1112. }
  1113. else if (this.menuOut === false) {
  1114. if (this.options.edge === "left") {
  1115. this.$nav.css("transform", "translateX(-100%)");
  1116. }
  1117. else {
  1118. this.$nav.css("transform", "translateX(100%)");
  1119. }
  1120. }
  1121. this.refreshCollapseButton();
  1122. };
  1123. SideNav.prototype.init = function (nav_id, options) {
  1124. var _this = this;
  1125. var defaults = {
  1126. width: 240,
  1127. edge: "left",
  1128. closeOnClick: false
  1129. };
  1130. this.options = $.extend(defaults, options);
  1131. this.$nav = $("#" + nav_id);
  1132. this.$dragTarget = $("<div class=\"drag-target\"></div>");
  1133. $("body").append(this.$dragTarget);
  1134. if (options.edge === "left") {
  1135. this.$nav.css("transform", "translateX(-100%)");
  1136. this.$dragTarget.css({ "left": 0 });
  1137. }
  1138. else {
  1139. this.$nav.css({
  1140. "transform": "translateX(100%)", "position": "absolute",
  1141. "left": "calc(100% - " + this.options.width + "px)",
  1142. "right": 0
  1143. });
  1144. this.$dragTarget.css({ "right": 0 });
  1145. }
  1146. if (this.$nav.hasClass("fixed")) {
  1147. if (window.innerWidth > 992) {
  1148. this.$nav.css("transform", "translateX(0)");
  1149. }
  1150. }
  1151. this.refreshCollapseButton();
  1152. if (this.$nav.hasClass("fixed")) {
  1153. this.onResizeListener = function (e) { return _this.onResize(e); };
  1154. $(window).on("resize", this.onResizeListener);
  1155. }
  1156. if (options.closeOnClick === true) {
  1157. this.$nav.on("click.itemclick", "a:not(.collapsible-header)", function () { return _this.removeMenu(false); });
  1158. }
  1159. this.$dragTarget.on("click", function () { return _this.removeMenu(false); });
  1160. this.$dragTarget.hammer({
  1161. prevent_default: false
  1162. }).bind("pan", function (e) { return _this.onPan(e); }).bind("panend", function (e) { return _this.onPanend(e); });
  1163. };
  1164. SideNav.prototype.show = function () {
  1165. var _this = this;
  1166. if (this.menuOut === true) {
  1167. this.menuOut = false;
  1168. this.panning = false;
  1169. this.removeMenu(false);
  1170. }
  1171. else {
  1172. var $body = $("body");
  1173. var oldWidth = $body.innerWidth();
  1174. $body.css("overflow", "hidden");
  1175. $body.width(oldWidth);
  1176. $("body").append(this.$dragTarget);
  1177. if (this.options.edge === "left") {
  1178. this.$dragTarget.css({ width: "50%", right: 0, left: "" });
  1179. this.$nav.velocity({ "translateX": [0, -1 * this.options.width] }, { duration: 300, queue: false, easing: "easeOutQuad" });
  1180. }
  1181. else {
  1182. this.$dragTarget.css({ width: "50%", right: "", left: 0 });
  1183. this.$nav.velocity({ "translateX": [0, this.options.width] }, { duration: 300, queue: false, easing: "easeOutQuad" });
  1184. }
  1185. var overlay_1 = $("<div id=\"sidenav-overlay\"></div>");
  1186. overlay_1.css("opacity", 0);
  1187. overlay_1.click(function () {
  1188. _this.menuOut = false;
  1189. _this.panning = false;
  1190. _this.removeMenu(false);
  1191. overlay_1.velocity({ opacity: 0 }, {
  1192. duration: 300, queue: false, easing: "easeOutQuad",
  1193. complete: function () {
  1194. overlay_1.remove();
  1195. overlay_1 = null;
  1196. }
  1197. });
  1198. });
  1199. $("body").append(overlay_1);
  1200. overlay_1.velocity({ opacity: 1 }, {
  1201. duration: 300, queue: false, easing: "easeOutQuad",
  1202. complete: function () {
  1203. _this.menuOut = true;
  1204. _this.panning = false;
  1205. }
  1206. });
  1207. }
  1208. };
  1209. SideNav.prototype.hide = function () {
  1210. $("#sidenav-overlay").trigger("click");
  1211. };
  1212. SideNav.prototype.bind = function ($button) {
  1213. var _this = this;
  1214. this.$button = $button;
  1215. this.$button.click(function () {
  1216. _this.show();
  1217. return false;
  1218. });
  1219. this.refreshCollapseButton();
  1220. };
  1221. SideNav.prototype.refreshCollapseButton = function () {
  1222. if (this.$button) {
  1223. if (window.innerWidth > 992) {
  1224. this.$button.css({ "visibility": "hidden", "opacity": "0" });
  1225. }
  1226. else {
  1227. this.$button.css({ "visibility": "visible", "opacity": "1" });
  1228. }
  1229. }
  1230. };
  1231. SideNav.prototype.dispose = function () {
  1232. if (this.onResizeListener) {
  1233. $(window).off("resize", this.onResizeListener);
  1234. }
  1235. if (this.$dragTarget) {
  1236. this.$dragTarget.remove();
  1237. if (this.$dragTarget.data("hammer")) {
  1238. this.$dragTarget.data("hammer").destroy();
  1239. }
  1240. }
  1241. $("#sidenav-overlay").remove();
  1242. };
  1243. return SideNav;
  1244. }());
  1245. exports.SideNav = SideNav;
  1246. });
  1247. define("layout/SideNavLayoutData", ["require", "exports"], function (require, exports) {
  1248. "use strict";
  1249. var SideNavLayoutData = (function () {
  1250. function SideNavLayoutData(args) {
  1251. this.direction = args.direction;
  1252. this.width = args.width;
  1253. this.collapseButtonId = args.collapseButtonId;
  1254. }
  1255. SideNavLayoutData.NONE = 0;
  1256. SideNavLayoutData.LEFT = 1;
  1257. SideNavLayoutData.RIGHT = 2;
  1258. return SideNavLayoutData;
  1259. }());
  1260. exports.SideNavLayoutData = SideNavLayoutData;
  1261. });
  1262. define("layout/SideNavLayout", ["require", "exports", "layout/Layout", "layout/SideNav", "layout/SideNavLayoutData"], function (require, exports, Layout_4, SideNav_1, SideNavLayoutData_1) {
  1263. "use strict";
  1264. var SideNavLayout = (function (_super) {
  1265. __extends(SideNavLayout, _super);
  1266. function SideNavLayout(composite) {
  1267. _super.call(this, composite);
  1268. this.hadBindedCollapse = false;
  1269. }
  1270. SideNavLayout.prototype.setCollapseButton = function (collapseButton) {
  1271. this.collapseButton = collapseButton;
  1272. this.bindCollapseButton();
  1273. };
  1274. SideNavLayout.prototype.bindCollapseButton = function () {
  1275. if (!this.hadBindedCollapse && this.sideNav && this.collapseButton) {
  1276. this.sideNav.bind(this.collapseButton.$thisNode);
  1277. this.hadBindedCollapse = true;
  1278. }
  1279. };
  1280. SideNavLayout.prototype.layout = function () {
  1281. var navChild = null;
  1282. var contentChild = null;
  1283. var navLayoutData = null;
  1284. for (var _i = 0, _a = this.composite.children; _i < _a.length; _i++) {
  1285. var child = _a[_i];
  1286. var direction = child.layoutData.direction;
  1287. if (!navChild && direction !== SideNavLayoutData_1.SideNavLayoutData.NONE) {
  1288. navChild = child;
  1289. navLayoutData = child.layoutData;
  1290. }
  1291. else if (!contentChild && direction === SideNavLayoutData_1.SideNavLayoutData.NONE) {
  1292. contentChild = child;
  1293. }
  1294. }
  1295. contentChild.$thisNode.css({
  1296. position: "absolute",
  1297. left: 0,
  1298. right: 0,
  1299. top: 0,
  1300. bottom: 0
  1301. });
  1302. this.$nav = $("<div class=\"side-nav fixed\" id=\"slide-out\"></div>");
  1303. this.$nav.css("width", navLayoutData.width);
  1304. this.$content = $("<div></div>");
  1305. this.$content.css({
  1306. position: "absolute",
  1307. left: 0,
  1308. right: 0,
  1309. top: 0,
  1310. bottom: 0
  1311. });
  1312. navChild.$thisNode.appendTo(this.$nav);
  1313. contentChild.$thisNode.appendTo(this.$content);
  1314. this.$nav.appendTo(this.composite.$attachNode);
  1315. this.$content.appendTo(this.composite.$attachNode);
  1316. this.sideNav = new SideNav_1.SideNav();
  1317. this.bindCollapseButton();
  1318. this.sideNav.init("slide-out", {
  1319. width: navLayoutData.width,
  1320. edge: navLayoutData.direction === SideNavLayoutData_1.SideNavLayoutData.LEFT ? "left" : "right"
  1321. });
  1322. this.mediaQueryList = window.matchMedia("only screen and (max-width : 992px)");
  1323. var own = this;
  1324. this.mediaQueryListener = function (mql) {
  1325. if (mql.matches) {
  1326. if (navLayoutData.direction === SideNavLayoutData_1.SideNavLayoutData.LEFT) {
  1327. own.$content.css("left", 0);
  1328. }
  1329. else {
  1330. own.$content.css("right", 0);
  1331. }
  1332. }
  1333. else {
  1334. if (navLayoutData.direction === SideNavLayoutData_1.SideNavLayoutData.LEFT) {
  1335. own.$content.css("left", navLayoutData.width + "px");
  1336. }
  1337. else {
  1338. own.$content.css("right", navLayoutData.width + "px");
  1339. }
  1340. }
  1341. };
  1342. this.mediaQueryList.addListener(this.mediaQueryListener);
  1343. this.mediaQueryListener(this.mediaQueryList);
  1344. };
  1345. SideNavLayout.prototype.toString = function () {
  1346. return "SideNavLayout";
  1347. };
  1348. SideNavLayout.prototype.dispose = function () {
  1349. if (this.mediaQueryList && this.mediaQueryListener) {
  1350. this.mediaQueryList.removeListener(this.mediaQueryListener);
  1351. }
  1352. if (this.sideNav) {
  1353. this.sideNav.dispose();
  1354. }
  1355. if (this.$nav) {
  1356. this.$nav.remove();
  1357. }
  1358. if (this.$content) {
  1359. this.$content.remove();
  1360. }
  1361. };
  1362. return SideNavLayout;
  1363. }(Layout_4.Layout));
  1364. exports.SideNavLayout = SideNavLayout;
  1365. });
  1366. define("widget/Composite", ["require", "exports", "widget/Widget", "layout/HeaderFooterLayout", "layout/RowGridLayout", "layout/FillLayout", "layout/SideNavLayout", "ADORE"], function (require, exports, Widget_3, HeaderFooterLayout_1, RowGridLayout_1, FillLayout_1, SideNavLayout_1, ADORE_1) {
  1367. "use strict";
  1368. var Composite = (function (_super) {
  1369. __extends(Composite, _super);
  1370. function Composite(parentId, id, style) {
  1371. _super.call(this, parentId, id, style);
  1372. this.children = new Array();
  1373. this.$thisNode = $("<div>").attr("id", this.id);
  1374. this.$attachNode = this.$thisNode;
  1375. if ((this.style & ADORE_1.ADORE.Control) === ADORE_1.ADORE.Control)
  1376. this.$thisNode.css({
  1377. position: "absolute",
  1378. top: "48px",
  1379. bottom: "0px",
  1380. overflow: "hidden",
  1381. right: "0",
  1382. left: "0"
  1383. });
  1384. if ((this.style & ADORE_1.ADORE.CardPanel) === ADORE_1.ADORE.CardPanel) {
  1385. this.$thisNode.addClass("card-panel");
  1386. }
  1387. if ((this.style & ADORE_1.ADORE.Scrollable) === ADORE_1.ADORE.Scrollable) {
  1388. this.$thisNode.css("overflow", "auto");
  1389. }
  1390. }
  1391. Composite.prototype.setFocus = function () {
  1392. };
  1393. Composite.prototype.setLayout = function (args) {
  1394. if (this.layout_) {
  1395. return;
  1396. }
  1397. var layout = args.layout;
  1398. var type = layout.type;
  1399. if (type === "RowGridLayout") {
  1400. this.layout_ = new RowGridLayout_1.RowGridLayout(this);
  1401. }
  1402. else if (type === "HeaderFooterLayout") {
  1403. this.layout_ = new HeaderFooterLayout_1.HeaderFooterLayout(this, layout.layoutOrientation, layout.hiddenFooter);
  1404. }
  1405. else if (type === "FillLayout") {
  1406. this.layout_ = new FillLayout_1.FillLayout(this);
  1407. }
  1408. else if (type === "SideNavLayout") {
  1409. this.layout_ = new SideNavLayout_1.SideNavLayout(this);
  1410. }
  1411. };
  1412. Composite.prototype.layout = function () {
  1413. this.doLayout();
  1414. if (this.content) {
  1415. this.setContentView({ content: this.content, script: this.script });
  1416. }
  1417. };
  1418. Composite.prototype.doLayout = function () {
  1419. if (!this.parent) {
  1420. if (this.id.indexOf("Composite") !== -1) {
  1421. this.$thisNode.css({
  1422. "height": "100vh",
  1423. "width": "100vw"
  1424. });
  1425. }
  1426. this.$thisNode.appendTo(document.body);
  1427. }
  1428. if (!this.layout_) {
  1429. return;
  1430. }
  1431. this.layout_.layout();
  1432. for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
  1433. var child = _a[_i];
  1434. child.postLayout();
  1435. }
  1436. };
  1437. Composite.prototype.setBackgroundImage = function (args) {
  1438. this.backgroundImage = args.src;
  1439. this.$thisNode.find("#" + this.id + "_img").remove();
  1440. $("<img>").addClass("adore_background_image").attr({
  1441. src: this.backgroundImage,
  1442. id: this.id + "_img"
  1443. }).prependTo(this.$thisNode);
  1444. if (this.imageZIndex === 0 || this.imageZIndex) {
  1445. this.setBackgroundImageZIndex({ "imageZIndex": this.imageZIndex });
  1446. }
  1447. };
  1448. Composite.prototype.setBackgroundImageZIndex = function (args) {
  1449. this.imageZIndex = args.imageZIndex;
  1450. this.$thisNode.find("#" + this.id + "_img").css("z-index", this.imageZIndex);
  1451. };
  1452. Composite.prototype.setImageInDiv = function (args) {
  1453. this.divImage = args.divImageSrc;
  1454. if (this.$thisNode) {
  1455. this.$thisNode.css("background-image", "url(" + this.divImage + ")");
  1456. this.$thisNode.css("background-repeat", "round");
  1457. }
  1458. };
  1459. Composite.prototype.setContentView = function (args) {
  1460. var _this = this;
  1461. this.content = args.content;
  1462. this.script = args.script;
  1463. if (this.$attachNode) {
  1464. if (this.script && this.script.trim()) {
  1465. var scriptArr = this.script.trim().split("\n");
  1466. require(scriptArr, function () {
  1467. _this.$attachNode.html(args.content);
  1468. });
  1469. }
  1470. else {
  1471. this.$attachNode.html(args.content);
  1472. }
  1473. }
  1474. };
  1475. Composite.prototype.addChild = function (child) {
  1476. this.children.push(child);
  1477. };
  1478. Composite.prototype.dispose = function () {
  1479. if (this.layout_) {
  1480. this.layout_.dispose();
  1481. }
  1482. _super.prototype.dispose.call(this);
  1483. };
  1484. Composite.prototype.handleMouseDownEvent = function (e) {
  1485. };
  1486. Composite.prototype.handleMouseUpEvent = function (e) {
  1487. };
  1488. return Composite;
  1489. }(Widget_3.Widget));
  1490. exports.Composite = Composite;
  1491. });
  1492. define("hotkey/KeystrokeGenerator", ["require", "exports", "hotkey/Keys"], function (require, exports, Keys_2) {
  1493. "use strict";
  1494. var KeystrokeGenerator = (function () {
  1495. function KeystrokeGenerator() {
  1496. }
  1497. KeystrokeGenerator.generateKeyStroke = function (e) {
  1498. var stroke = "";
  1499. var ctrlKey = e.ctrlKey;
  1500. stroke = ctrlKey ? stroke + "CTRL+" : stroke;
  1501. var shiftKey = e.shiftKey;
  1502. stroke = shiftKey ? stroke + "SHIFT+" : stroke;
  1503. var altKey = e.altKey;
  1504. stroke = altKey ? stroke + "ALT+" : stroke;
  1505. switch (e.keyCode) {
  1506. case Keys_2.Keys.BACKSPACE:
  1507. stroke = stroke + "BS";
  1508. break;
  1509. case Keys_2.Keys.TAB:
  1510. stroke = stroke + "TAB";
  1511. break;
  1512. case Keys_2.Keys.CLEAR:
  1513. stroke = stroke + "CLEAR";
  1514. break;
  1515. case Keys_2.Keys.ENTER:
  1516. stroke = stroke + "CR";
  1517. break;
  1518. case Keys_2.Keys.CAPS_LOCK:
  1519. stroke = stroke + "CAPS";
  1520. break;
  1521. case Keys_2.Keys.ESCAPE:
  1522. stroke = stroke + "ESC";
  1523. break;
  1524. case Keys_2.Keys.SPACE:
  1525. stroke = stroke + "SPACE";
  1526. break;
  1527. case Keys_2.Keys.PAGE_UP:
  1528. stroke = stroke + "PAGE_UP";
  1529. break;
  1530. case Keys_2.Keys.PAGE_DOWN:
  1531. stroke = stroke + "PAGE_DOWN";
  1532. break;
  1533. case Keys_2.Keys.END:
  1534. stroke = stroke + "END";
  1535. break;
  1536. case Keys_2.Keys.HOME:
  1537. stroke = stroke + "HOME";
  1538. break;
  1539. case Keys_2.Keys.LEFT_ARROW:
  1540. stroke = stroke + "ARROW_LEFT";
  1541. break;
  1542. case Keys_2.Keys.UP_ARROW:
  1543. stroke = stroke + "ARROW_UP";
  1544. break;
  1545. case Keys_2.Keys.RIGHT_ARROW:
  1546. stroke = stroke + "ARROW_RIGHT";
  1547. break;
  1548. case Keys_2.Keys.DOWN_ARROW:
  1549. stroke = stroke + "ARROW_DOWN";
  1550. break;
  1551. case Keys_2.Keys.INSERT:
  1552. stroke = stroke + "INS";
  1553. break;
  1554. case Keys_2.Keys.DELETE:
  1555. stroke = stroke + "DEL";
  1556. break;
  1557. case Keys_2.Keys.HELP:
  1558. stroke = stroke + "HELP";
  1559. break;
  1560. case Keys_2.Keys.LEFT_WINDOW:
  1561. stroke = stroke + "LEFT_WINDOW";
  1562. break;
  1563. case Keys_2.Keys.RIGHT_WINDOW:
  1564. stroke = stroke + "RIGHT_WINDOW";
  1565. break;
  1566. case Keys_2.Keys.SELECT:
  1567. stroke = stroke + "SELECT";
  1568. break;
  1569. case Keys_2.Keys.NUMPAD_0:
  1570. stroke = stroke + "NUMPAD_0";
  1571. break;
  1572. case Keys_2.Keys.NUMPAD_1:
  1573. stroke = stroke + "NUMPAD_1";
  1574. break;
  1575. case Keys_2.Keys.NUMPAD_2:
  1576. stroke = stroke + "NUMPAD_2";
  1577. break;
  1578. case Keys_2.Keys.NUMPAD_3:
  1579. stroke = stroke + "NUMPAD_3";
  1580. break;
  1581. case Keys_2.Keys.NUMPAD_4:
  1582. stroke = stroke + "NUMPAD_4";
  1583. break;
  1584. case Keys_2.Keys.NUMPAD_5:
  1585. stroke = stroke + "NUMPAD_5";
  1586. break;
  1587. case Keys_2.Keys.NUMPAD_6:
  1588. stroke = stroke + "NUMPAD_6";
  1589. break;
  1590. case Keys_2.Keys.NUMPAD_7:
  1591. stroke = stroke + "NUMPAD_7";
  1592. break;
  1593. case Keys_2.Keys.NUMPAD_8:
  1594. stroke = stroke + "NUMPAD_8";
  1595. break;
  1596. case Keys_2.Keys.NUMPAD_9:
  1597. stroke = stroke + "NUMPAD_9";
  1598. break;
  1599. case Keys_2.Keys.NUMPAD_MULTIPLY:
  1600. stroke = stroke + "NUMPAD_MULTIPLY";
  1601. break;
  1602. case Keys_2.Keys.NUMPAD_PLUS:
  1603. stroke = stroke + "NUMPAD_PLUS";
  1604. break;
  1605. case Keys_2.Keys.NUMPAD_ENTER:
  1606. stroke = stroke + "CR";
  1607. break;
  1608. case Keys_2.Keys.NUMPAD_MINUS:
  1609. stroke = stroke + "NUMPAD_MINUS";
  1610. break;
  1611. case Keys_2.Keys.NUMPAD_PERIOD:
  1612. stroke = stroke + "NUMPAD_PERIOD";
  1613. break;
  1614. case Keys_2.Keys.NUMPAD_DIVIDE:
  1615. stroke = stroke + "NUMPAD_DIVIDE";
  1616. break;
  1617. case Keys_2.Keys.F1:
  1618. stroke = stroke + "F1";
  1619. break;
  1620. case Keys_2.Keys.F2:
  1621. stroke = stroke + "F2";
  1622. break;
  1623. case Keys_2.Keys.F3:
  1624. stroke = stroke + "F3";
  1625. break;
  1626. case Keys_2.Keys.F4:
  1627. stroke = stroke + "F4";
  1628. break;
  1629. case Keys_2.Keys.F5:
  1630. stroke = stroke + "F5";
  1631. break;
  1632. case Keys_2.Keys.F6:
  1633. stroke = stroke + "F6";
  1634. break;
  1635. case Keys_2.Keys.F7:
  1636. stroke = stroke + "F7";
  1637. break;
  1638. case Keys_2.Keys.F8:
  1639. stroke = stroke + "F8";
  1640. break;
  1641. case Keys_2.Keys.F9:
  1642. stroke = stroke + "F9";
  1643. break;
  1644. case Keys_2.Keys.F10:
  1645. stroke = stroke + "F10";
  1646. break;
  1647. case Keys_2.Keys.F11:
  1648. stroke = stroke + "F11";
  1649. break;
  1650. case Keys_2.Keys.F12:
  1651. stroke = stroke + "F12";
  1652. break;
  1653. case Keys_2.Keys.F13:
  1654. stroke = stroke + "F13";
  1655. break;
  1656. case Keys_2.Keys.F14:
  1657. stroke = stroke + "F14";
  1658. break;
  1659. case Keys_2.Keys.F15:
  1660. stroke = stroke + "F15";
  1661. break;
  1662. case Keys_2.Keys.NUM_LOCK:
  1663. stroke = stroke + "NUM_LOCK";
  1664. break;
  1665. case Keys_2.Keys.SCROLL_LOCK:
  1666. stroke = stroke + "SCROLL_LOCK";
  1667. break;
  1668. case Keys_2.Keys.UP_DPAD:
  1669. stroke = stroke + "UP_DPAD";
  1670. break;
  1671. case Keys_2.Keys.DOWN_DPAD:
  1672. stroke = stroke + "DOWN_DPAD";
  1673. break;
  1674. case Keys_2.Keys.LEFT_DPAD:
  1675. stroke = stroke + "LEFT_DPAD";
  1676. break;
  1677. case Keys_2.Keys.RIGHT_DPAD:
  1678. stroke = stroke + "RIGHT_DPAD";
  1679. break;
  1680. case Keys_2.Keys.NUM_0:
  1681. stroke = stroke + "0";
  1682. break;
  1683. case Keys_2.Keys.NUM_1:
  1684. stroke = stroke + "1";
  1685. break;
  1686. case Keys_2.Keys.NUM_2:
  1687. stroke = stroke + "2";
  1688. break;
  1689. case Keys_2.Keys.NUM_3:
  1690. stroke = stroke + "3";
  1691. break;
  1692. case Keys_2.Keys.NUM_4:
  1693. stroke = stroke + "4";
  1694. break;
  1695. case Keys_2.Keys.NUM_5:
  1696. stroke = stroke + "5";
  1697. break;
  1698. case Keys_2.Keys.NUM_6:
  1699. stroke = stroke + "6";
  1700. break;
  1701. case Keys_2.Keys.NUM_7:
  1702. stroke = stroke + "7";
  1703. break;
  1704. case Keys_2.Keys.NUM_8:
  1705. stroke = stroke + "8";
  1706. break;
  1707. case Keys_2.Keys.NUM_9:
  1708. stroke = stroke + "9";
  1709. break;
  1710. case Keys_2.Keys.CHAR_A:
  1711. stroke = stroke + "A";
  1712. break;
  1713. case Keys_2.Keys.CHAR_B:
  1714. stroke = stroke + "B";
  1715. break;
  1716. case Keys_2.Keys.CHAR_C:
  1717. stroke = stroke + "C";
  1718. break;
  1719. case Keys_2.Keys.CHAR_D:
  1720. stroke = stroke + "D";
  1721. break;
  1722. case Keys_2.Keys.CHAR_E:
  1723. stroke = stroke + "E";
  1724. break;
  1725. case Keys_2.Keys.CHAR_F:
  1726. stroke = stroke + "F";
  1727. break;
  1728. case Keys_2.Keys.CHAR_G:
  1729. stroke = stroke + "G";
  1730. break;
  1731. case Keys_2.Keys.CHAR_H:
  1732. stroke = stroke + "H";
  1733. break;
  1734. case Keys_2.Keys.CHAR_I:
  1735. stroke = stroke + "I";
  1736. break;
  1737. case Keys_2.Keys.CHAR_J:
  1738. stroke = stroke + "J";
  1739. break;
  1740. case Keys_2.Keys.CHAR_K:
  1741. stroke = stroke + "K";
  1742. break;
  1743. case Keys_2.Keys.CHAR_L:
  1744. stroke = stroke + "L";
  1745. break;
  1746. case Keys_2.Keys.CHAR_M:
  1747. stroke = stroke + "M";
  1748. break;
  1749. case Keys_2.Keys.CHAR_N:
  1750. stroke = stroke + "N";
  1751. break;
  1752. case Keys_2.Keys.CHAR_O:
  1753. stroke = stroke + "O";
  1754. break;
  1755. case Keys_2.Keys.CHAR_P:
  1756. stroke = stroke + "P";
  1757. break;
  1758. case Keys_2.Keys.CHAR_Q:
  1759. stroke = stroke + "Q";
  1760. break;
  1761. case Keys_2.Keys.CHAR_R:
  1762. stroke = stroke + "R";
  1763. break;
  1764. case Keys_2.Keys.CHAR_S:
  1765. stroke = stroke + "S";
  1766. break;
  1767. case Keys_2.Keys.CHAR_T:
  1768. stroke = stroke + "T";
  1769. break;
  1770. case Keys_2.Keys.CHAR_U:
  1771. stroke = stroke + "U";
  1772. break;
  1773. case Keys_2.Keys.CHAR_V:
  1774. stroke = stroke + "V";
  1775. break;
  1776. case Keys_2.Keys.CHAR_W:
  1777. stroke = stroke + "W";
  1778. break;
  1779. case Keys_2.Keys.CHAR_X:
  1780. stroke = stroke + "X";
  1781. break;
  1782. case Keys_2.Keys.CHAR_Y:
  1783. stroke = stroke + "Y";
  1784. break;
  1785. case Keys_2.Keys.CHAR_Z:
  1786. stroke = stroke + "Z";
  1787. break;
  1788. case Keys_2.Keys.SLASH:
  1789. stroke = stroke + "/";
  1790. break;
  1791. default:
  1792. }
  1793. return stroke;
  1794. };
  1795. return KeystrokeGenerator;
  1796. }());
  1797. exports.KeystrokeGenerator = KeystrokeGenerator;
  1798. });
  1799. define("widget/Widget", ["require", "exports", "util/WidgetManager", "event/EventHub", "event/MessageType", "event/Event", "hotkey/Keys", "hotkey/KeystrokeGenerator", "layout/HeaderFooterLayoutData", "layout/RowGridLayoutData", "layout/SideNavLayoutData"], function (require, exports, WidgetManager_2, EventHub_2, MessageType_3, Event_2, Keys_3, KeystrokeGenerator_1, HeaderFooterLayoutData_2, RowGridLayoutData_2, SideNavLayoutData_2) {
  1800. "use strict";
  1801. var Widget = (function () {
  1802. function Widget(parentId, id, style) {
  1803. this.cssStyle = {};
  1804. this.enabled = true;
  1805. this.visible = true;
  1806. this.id = id;
  1807. this.style = style;
  1808. WidgetManager_2.WidgetManager.register(this);
  1809. if (parentId) {
  1810. this.parent = parentId ? WidgetManager_2.WidgetManager.byId(parentId) : null;
  1811. this.parent.addChild(this);
  1812. }
  1813. }
  1814. Widget.prototype.getId = function () {
  1815. return this.id;
  1816. };
  1817. Widget.prototype.sendFocusGain = function () {
  1818. if (this.enabled) {
  1819. EventHub_2.EventHub.dispatchEvent(MessageType_3.MessageType.WIDGET, { id: this.id, evtType: Event_2.Event.ON_FOCUS });
  1820. }
  1821. };
  1822. Widget.prototype.append = function () {
  1823. if (this.parent) {
  1824. this.$thisNode.appendTo(this.parent.$attachNode);
  1825. }
  1826. else {
  1827. this.$thisNode.appendTo(document.body);
  1828. }
  1829. };
  1830. Widget.prototype.handleMouseDownEvent = function (e) {
  1831. EventHub_2.EventHub.dispatchEvent(MessageType_3.MessageType.WIDGET, {
  1832. id: this.id,
  1833. evtType: Event_2.Event.MOUSE_DOWN,
  1834. button: e.button
  1835. });
  1836. };
  1837. Widget.prototype.handleMouseUpEvent = function (e) {
  1838. EventHub_2.EventHub.dispatchEvent(MessageType_3.MessageType.WIDGET, {
  1839. id: this.id,
  1840. evtType: Event_2.Event.MOUSE_UP,
  1841. button: e.button
  1842. });
  1843. };
  1844. Widget.prototype.handleKeyDownEvent = function (e, hasFilter) {
  1845. var filter = false;
  1846. var keyStroke = KeystrokeGenerator_1.KeystrokeGenerator.generateKeyStroke(e);
  1847. var keyEventObj = {
  1848. id: this.id,
  1849. evtType: Event_2.Event.KEY_DONW,
  1850. altKey: e.altKey,
  1851. shiftKey: e.shiftKey,
  1852. ctrlKey: e.ctrlKey,
  1853. keyCode: e.keyCode,
  1854. keyStroke: keyStroke
  1855. };
  1856. if (e.keyCode === Keys_3.Keys.TAB) {
  1857. e.preventDefault();
  1858. }
  1859. if (hasFilter) {
  1860. filter = EventHub_2.EventHub.dispatchEvent(MessageType_3.MessageType.DISPLAY_FILTER, keyEventObj);
  1861. }
  1862. if (!filter) {
  1863. EventHub_2.EventHub.dispatchEvent(MessageType_3.MessageType.WIDGET, keyEventObj);
  1864. }
  1865. else {
  1866. e.preventDefault();
  1867. e.stopPropagation();
  1868. }
  1869. };
  1870. Widget.prototype.handleKeyUpEvent = function (e) {
  1871. var keyStroke = KeystrokeGenerator_1.KeystrokeGenerator.generateKeyStroke(e);
  1872. var keyEventObj = {
  1873. id: this.id,
  1874. evtType: Event_2.Event.KEY_UP,
  1875. altKey: e.altKey,
  1876. shiftKey: e.shiftKey,
  1877. ctrlKey: e.ctrlKey,
  1878. keyCode: e.keyCode,
  1879. keyStroke: keyStroke
  1880. };
  1881. EventHub_2.EventHub.dispatchEvent(MessageType_3.MessageType.WIDGET, keyEventObj);
  1882. };
  1883. Widget.prototype.setEnabled = function (args) {
  1884. this.enabled = args.enabled;
  1885. if (this.enabled) {
  1886. this.$thisNode.removeAttr("disabled");
  1887. }
  1888. else {
  1889. this.$thisNode.attr("disabled", "disabled");
  1890. }
  1891. };
  1892. Widget.prototype.isEnabled = function () {
  1893. return this.enabled;
  1894. };
  1895. Widget.prototype.setVisible = function (args) {
  1896. this.visible = args.visible;
  1897. if (this.visible) {
  1898. this.css({ cssStyle: { "display": "block" } });
  1899. }
  1900. else {
  1901. this.css({ cssStyle: { "display": "none" } });
  1902. }
  1903. };
  1904. Widget.prototype.isVisible = function () {
  1905. return this.visible;
  1906. };
  1907. Widget.prototype.dispose = function () {
  1908. WidgetManager_2.WidgetManager.unregister(this.id);
  1909. this.$thisNode.remove();
  1910. if (this.parent) {
  1911. var index = this.parent.children.indexOf(this);
  1912. this.parent.children.splice(index, 1);
  1913. }
  1914. };
  1915. Widget.prototype.setFocus = function () {
  1916. };
  1917. ;
  1918. Widget.prototype.setLayoutData = function (args) {
  1919. var layout = this.parent ? this.parent.layout_ : undefined;
  1920. if (layout) {
  1921. var layoutData = args.layoutData;
  1922. var layoutType = layout.toString();
  1923. if (layoutType === "HeaderFooterLayout") {
  1924. this.layoutData = new HeaderFooterLayoutData_2.HeaderFooterLayoutData(layoutData);
  1925. }
  1926. else if (layoutType === "RowGridLayout") {
  1927. this.layoutData = new RowGridLayoutData_2.RowGridLayoutData(layoutData);
  1928. }
  1929. else if (layoutType === "SideNavLayout") {
  1930. this.layoutData = new SideNavLayoutData_2.SideNavLayoutData(layoutData);
  1931. }
  1932. }
  1933. };
  1934. Widget.prototype.setBackgroundColor = function (attrs) {
  1935. };
  1936. Widget.prototype.css = function (args) {
  1937. if (this.$thisNode) {
  1938. this.$thisNode.css(args.cssStyle);
  1939. }
  1940. else {
  1941. this.cssStyle = $.extend(this.cssStyle, args.cssStyle);
  1942. }
  1943. };
  1944. Widget.prototype.toString = function () {
  1945. return "Widget";
  1946. };
  1947. Widget.prototype.postLayout = function () {
  1948. if (this.cssStyle) {
  1949. this.$thisNode.css(this.cssStyle);
  1950. this.cssStyle = null;
  1951. }
  1952. };
  1953. Widget.prototype.initEvents = function (args) {
  1954. var _this = this;
  1955. setTimeout(function () {
  1956. if (!_this.$thisNode) {
  1957. _this.$thisNode = $("#" + _this.id);
  1958. }
  1959. for (var i = 0; i < args.events.length; i++) {
  1960. switch (args.events[i]) {
  1961. case Event_2.Event.CLICK:
  1962. _this.$thisNode.on("click", function (e) {
  1963. EventHub_2.EventHub.dispatchEvent(MessageType_3.MessageType.WIDGET, { id: _this.id, evtType: Event_2.Event.CLICK });
  1964. });
  1965. break;
  1966. case Event_2.Event.MODIFY:
  1967. _this.$thisNode.on("input", function (e) {
  1968. EventHub_2.EventHub.dispatchEvent(MessageType_3.MessageType.WIDGET, {
  1969. id: _this.id,
  1970. text: $(_this).val(),
  1971. evtType: Event_2.Event.MODIFY
  1972. });
  1973. });
  1974. break;
  1975. case Event_2.Event.ON_CHANGE:
  1976. break;
  1977. }
  1978. }
  1979. }, 800);
  1980. };
  1981. return Widget;
  1982. }());
  1983. exports.Widget = Widget;
  1984. });
  1985. define("util/WidgetManager", ["require", "exports", "util/Map"], function (require, exports, Map_1) {
  1986. "use strict";
  1987. var WidgetManager = (function () {
  1988. function WidgetManager() {
  1989. }
  1990. WidgetManager.register = function (widget) {
  1991. this.map.put(widget.getId(), widget);
  1992. };
  1993. WidgetManager.unregister = function (id) {
  1994. this.map.remove(id);
  1995. };
  1996. WidgetManager.byId = function (id) {
  1997. var widget = this.map.getValue(id);
  1998. return widget;
  1999. };
  2000. WidgetManager.size = function () {
  2001. return this.map.size();
  2002. };
  2003. WidgetManager.map = new Map_1.Map();
  2004. return WidgetManager;
  2005. }());
  2006. exports.WidgetManager = WidgetManager;
  2007. });
  2008. define("util/WidgetUtil", ["require", "exports", "util/WidgetManager"], function (require, exports, WidgetManager_3) {
  2009. "use strict";
  2010. var WidgetUtil = (function () {
  2011. function WidgetUtil() {
  2012. }
  2013. WidgetUtil.refreshDialogZIndex = function (htmlElement) {
  2014. var thisZIndex = parseInt(htmlElement.style.zIndex);
  2015. var maxZIndex = -1;
  2016. var dialogNodes = $("div.adore_dialog");
  2017. var i, tempZIndex;
  2018. for (i = 0; i < dialogNodes.length; i++) {
  2019. if (dialogNodes[i].id === htmlElement.id) {
  2020. continue;
  2021. }
  2022. tempZIndex = parseInt(dialogNodes[i].style.zIndex);
  2023. maxZIndex = tempZIndex > maxZIndex ? tempZIndex : maxZIndex;
  2024. }
  2025. var adoreShellNodes = $("div.adore_shell");
  2026. for (i = 0; i < adoreShellNodes.length; i++) {
  2027. if (adoreShellNodes[i].id === htmlElement.id) {
  2028. continue;
  2029. }
  2030. tempZIndex = parseInt(adoreShellNodes[i].style.zIndex);
  2031. maxZIndex = tempZIndex > maxZIndex ? tempZIndex : maxZIndex;
  2032. }
  2033. if (maxZIndex >= thisZIndex) {
  2034. $(htmlElement).css("z-index", maxZIndex + 1);
  2035. }
  2036. };
  2037. WidgetUtil.findWidgetByTarget = function (target) {
  2038. if (!target) {
  2039. return null;
  2040. }
  2041. var widget = WidgetManager_3.WidgetManager.byId(target.id);
  2042. if (widget) {
  2043. return widget;
  2044. }
  2045. else {
  2046. return WidgetUtil.findWidgetByTarget(target.parentNode);
  2047. }
  2048. };
  2049. WidgetUtil.elementExists = function (id) {
  2050. if (id) {
  2051. var $node = $("#" + id);
  2052. if ($node.length !== 0) {
  2053. return true;
  2054. }
  2055. }
  2056. return false;
  2057. };
  2058. return WidgetUtil;
  2059. }());
  2060. exports.WidgetUtil = WidgetUtil;
  2061. });
  2062. define("event/DocumentEventInterceptor", ["require", "exports", "event/EventHub", "event/Event", "event/MessageType", "util/WidgetUtil"], function (require, exports, EventHub_3, Event_3, MessageType_4, WidgetUtil_2) {
  2063. "use strict";
  2064. var DocumentEventInterceptor = (function () {
  2065. function DocumentEventInterceptor() {
  2066. }
  2067. DocumentEventInterceptor.addFilter = function (eventType) {
  2068. this.eventTypeMap.push(eventType);
  2069. };
  2070. DocumentEventInterceptor.addDisplayEvent = function (eventType) {
  2071. if (this.displayEvents.indexOf(eventType) === -1) {
  2072. this.displayEvents.push(eventType);
  2073. }
  2074. };
  2075. DocumentEventInterceptor.removeDisplayEvent = function (eventType) {
  2076. for (var i = 0; i < this.displayEvents.length; i++) {
  2077. if (eventType === this.displayEvents[i]) {
  2078. this.displayEvents.splice(i, 1);
  2079. }
  2080. }
  2081. };
  2082. DocumentEventInterceptor.sendDisplayEvent = function (eventType) {
  2083. if (this.displayEvents.indexOf(eventType) !== -1) {
  2084. EventHub_3.EventHub.dispatchEvent(MessageType_4.MessageType.DISPLAY, { evtType: eventType });
  2085. }
  2086. };
  2087. DocumentEventInterceptor.initInterceptor = function () {
  2088. var _this = this;
  2089. $(document).on("keydown", function (e) {
  2090. var widget = WidgetUtil_2.WidgetUtil.findWidgetByTarget(e.target);
  2091. if (widget && widget.isEnabled()) {
  2092. if (_this.eventTypeMap.indexOf(Event_3.Event.KEY_DONW) !== -1) {
  2093. widget.handleKeyDownEvent(e, true);
  2094. }
  2095. else {
  2096. widget.handleKeyDownEvent(e, false);
  2097. }
  2098. }
  2099. DocumentEventInterceptor.sendDisplayEvent(Event_3.Event.KEY_DONW);
  2100. }).on("keyup", function (e) {
  2101. var widget = WidgetUtil_2.WidgetUtil.findWidgetByTarget(e.target);
  2102. if (widget && widget.isEnabled()) {
  2103. widget.handleKeyUpEvent(e);
  2104. }
  2105. DocumentEventInterceptor.sendDisplayEvent(Event_3.Event.KEY_UP);
  2106. }).on("mousedown", function (e) {
  2107. var widget = WidgetUtil_2.WidgetUtil.findWidgetByTarget(e.target);
  2108. if (widget && widget.isEnabled()) {
  2109. widget.handleMouseDownEvent(e);
  2110. }
  2111. DocumentEventInterceptor.sendDisplayEvent(Event_3.Event.MOUSE_DOWN);
  2112. }).on("mouseup", function (e, touchToClick) {
  2113. var widget = WidgetUtil_2.WidgetUtil.findWidgetByTarget(e.target);
  2114. if (widget && widget.isEnabled()) {
  2115. if (touchToClick) {
  2116. e.button = 0;
  2117. }
  2118. widget.handleMouseUpEvent(e);
  2119. }
  2120. DocumentEventInterceptor.sendDisplayEvent(Event_3.Event.MOUSE_UP);
  2121. }).on("touchmove", function (e) {
  2122. DocumentEventInterceptor.sendDisplayEvent(Event_3.Event.TOUCH_MOVE);
  2123. });
  2124. window.addEventListener("touchstart", function (e) {
  2125. DocumentEventInterceptor.touchStartTimeStamp = e.timeStamp;
  2126. DocumentEventInterceptor.touchStartTarget = e.target;
  2127. DocumentEventInterceptor.touchHadMoved = false;
  2128. DocumentEventInterceptor.touchStartY = e.changedTouches[0].pageY;
  2129. DocumentEventInterceptor.touchStartX = e.changedTouches[0].pageX;
  2130. });
  2131. window.addEventListener("touchmove", function (e) {
  2132. _this.touchHadMoved = true;
  2133. });
  2134. window.addEventListener("touchend", function (e) {
  2135. if (!_this.touchHadMoved || e.target !== _this.touchStartTarget) {
  2136. return;
  2137. }
  2138. var changeY = e.changedTouches[0].pageY - DocumentEventInterceptor.touchStartY;
  2139. var changeX = e.changedTouches[0].pageX - DocumentEventInterceptor.touchStartX;
  2140. changeX = changeX < 0 ? changeX * -1 : changeX;
  2141. changeY = changeY < 0 ? changeY * -1 : changeY;
  2142. var isClick = false;
  2143. var touchTime = e.timeStamp - DocumentEventInterceptor.touchStartTimeStamp;
  2144. if (touchTime <= 900 && changeX <= 80 && changeY <= 80) {
  2145. isClick = true;
  2146. }
  2147. if (isClick) {
  2148. var widget = WidgetUtil_2.WidgetUtil.findWidgetByTarget(e.target);
  2149. if (widget) {
  2150. var id = widget.getId();
  2151. if (id.indexOf("TreeItem", 0) !== -1 || id.indexOf("TabItem", 0) !== -1
  2152. || id.indexOf("MessageDialog", 0) !== -1) {
  2153. $(e.target).click();
  2154. }
  2155. else {
  2156. $(e.target).trigger("mouseup", "true");
  2157. }
  2158. }
  2159. else {
  2160. $(e.target).click();
  2161. }
  2162. }
  2163. });
  2164. };
  2165. DocumentEventInterceptor.eventTypeMap = new Array();
  2166. DocumentEventInterceptor.displayEvents = new Array();
  2167. DocumentEventInterceptor.touchStartTimeStamp = 0;
  2168. DocumentEventInterceptor.touchStartY = 0;
  2169. DocumentEventInterceptor.touchStartX = 0;
  2170. DocumentEventInterceptor.touchHadMoved = false;
  2171. return DocumentEventInterceptor;
  2172. }());
  2173. exports.DocumentEventInterceptor = DocumentEventInterceptor;
  2174. });
  2175. define("App", ["require", "exports", "event/EventHub", "event/MessageType", "event/DocumentEventInterceptor"], function (require, exports, EventHub_4, MessageType_5, DocumentEventInterceptor_1) {
  2176. "use strict";
  2177. EventHub_4.EventHub.dispatchEvent(MessageType_5.MessageType.INIT, {});
  2178. DocumentEventInterceptor_1.DocumentEventInterceptor.initInterceptor();
  2179. });
  2180. define("event/ExecutorEvent", ["require", "exports", "event/EventHub", "event/MessageType"], function (require, exports, EventHub_5, MessageType_6) {
  2181. "use strict";
  2182. var ExecutorEvent = (function () {
  2183. function ExecutorEvent() {
  2184. }
  2185. ExecutorEvent.finish = function (id, args) {
  2186. EventHub_5.EventHub.dispatchEvent(MessageType_6.MessageType.FINISH, { id: id, result: args });
  2187. };
  2188. ExecutorEvent.error = function (id, e) {
  2189. EventHub_5.EventHub.dispatchEvent(MessageType_6.MessageType.ERROR, { id: id, error: e });
  2190. };
  2191. return ExecutorEvent;
  2192. }());
  2193. exports.ExecutorEvent = ExecutorEvent;
  2194. });
  2195. define("util/RequisiteUtil", ["require", "exports"], function (require, exports) {
  2196. "use strict";
  2197. var RequisiteUtil = (function () {
  2198. function RequisiteUtil() {
  2199. }
  2200. RequisiteUtil.checkRequisite = function (isRequisite, widget, editable, value, msg) {
  2201. if (isRequisite) {
  2202. if (!widget.isEnabled() || !editable || value) {
  2203. RequisiteUtil.removeRequisite(widget);
  2204. }
  2205. else {
  2206. RequisiteUtil.addRequisite(widget);
  2207. if (msg) {
  2208. RequisiteUtil.showSpan(widget, msg);
  2209. }
  2210. }
  2211. }
  2212. };
  2213. RequisiteUtil.addRequisite = function (widget) {
  2214. widget.$thisNode.find("input").addClass("adore_InputRequisite");
  2215. widget.$thisNode.find("textarea").addClass("adore_InputRequisite");
  2216. widget.$thisNode.find("label").addClass("adore_requisiteColor");
  2217. widget.$thisNode.find("i").addClass("adore_requisiteColor");
  2218. };
  2219. RequisiteUtil.removeRequisite = function (widget) {
  2220. widget.$thisNode.find("input").removeClass("adore_InputRequisite");
  2221. widget.$thisNode.find("textarea").removeClass("adore_InputRequisite");
  2222. widget.$thisNode.find("label").removeClass("adore_requisiteColor");
  2223. widget.$thisNode.find("i").removeClass("adore_requisiteColor");
  2224. RequisiteUtil.hideSpan(widget);
  2225. };
  2226. RequisiteUtil.showSpan = function (widget, msg) {
  2227. if (widget.$thisNode.find('span').css("display") === "none") {
  2228. widget.$thisNode.find('span').html(msg).show().delay(2000).fadeOut(300);
  2229. }
  2230. };
  2231. RequisiteUtil.hideSpan = function (widget) {
  2232. widget.$thisNode.find("span").css("display", "none");
  2233. };
  2234. return RequisiteUtil;
  2235. }());
  2236. exports.RequisiteUtil = RequisiteUtil;
  2237. });
  2238. define("widget/validator/MaxLengthValidator", ["require", "exports"], function (require, exports) {
  2239. "use strict";
  2240. var MaxLengthValidator = (function () {
  2241. function MaxLengthValidator(id, textNode, maxLength) {
  2242. this.id = id;
  2243. this.textNode = textNode;
  2244. this.maxLength = maxLength;
  2245. }
  2246. MaxLengthValidator.prototype.setMaxLength = function (maxLength) {
  2247. this.maxLength = maxLength;
  2248. };
  2249. MaxLengthValidator.prototype.handleModifyEvent = function () {
  2250. if (this.maxLength < 0) {
  2251. return;
  2252. }
  2253. var count = 0;
  2254. for (var i = 0; i < this.textNode.value.length; i++) {
  2255. var c = this.textNode.value.charCodeAt(i);
  2256. if ((c >= 0x0001 && c <= 0x007e) || (0xff60 <= c && c <= 0xff9f)) {
  2257. count++;
  2258. }
  2259. else {
  2260. count += 2;
  2261. }
  2262. if (count > this.maxLength) {
  2263. var selectionStart = this.textNode.selectionStart;
  2264. var selectionEnd = this.textNode.selectionEnd;
  2265. this.textNode.value = this.textNode.value.substr(0, i);
  2266. if (selectionEnd <= i) {
  2267. this.textNode.selectionStart = selectionStart;
  2268. this.textNode.selectionEnd = selectionEnd;
  2269. }
  2270. break;
  2271. }
  2272. else if (count === this.maxLength) {
  2273. }
  2274. }
  2275. };
  2276. return MaxLengthValidator;
  2277. }());
  2278. exports.MaxLengthValidator = MaxLengthValidator;
  2279. });
  2280. define("widget/validator/PictureValidator", ["require", "exports", "hotkey/Keys"], function (require, exports, Keys_4) {
  2281. "use strict";
  2282. var PictureValidator = (function () {
  2283. function PictureValidator(id, textNode, picture, adoreText) {
  2284. this.leftAlignment = false;
  2285. this.length = 0;
  2286. this.cursorIndex = -1;
  2287. this.id = id;
  2288. this.textNode = textNode;
  2289. this.startWithZeroReg = new RegExp("^0\\d+\\..*");
  2290. this.startWithZeroMinusReg = new RegExp("^-0\\d+\\..*");
  2291. this.startWithMinusReg = new RegExp("^-\\..*");
  2292. var tmpPicture = picture;
  2293. if (tmpPicture.indexOf("-") === 0) {
  2294. this.leftAlignment = true;
  2295. tmpPicture = tmpPicture.substring(1);
  2296. }
  2297. var newPictureBuffer = new Array();
  2298. var singleQuotedBuffer = new Array();
  2299. var inQuote = false;
  2300. var num = 0;
  2301. for (var index = 0; index < tmpPicture.length; index++) {
  2302. var c = tmpPicture.charAt(index);
  2303. if (c === "\"") {
  2304. if (!inQuote) {
  2305. singleQuotedBuffer.length = 0;
  2306. inQuote = true;
  2307. }
  2308. else {
  2309. if (num === 0) {
  2310. num = 1;
  2311. }
  2312. for (var i = 0; i < num; i++) {
  2313. var temp = singleQuotedBuffer[0];
  2314. var savedString = newPictureBuffer.pop();
  2315. var saveString = savedString ? temp + savedString : temp;
  2316. newPictureBuffer.push(saveString);
  2317. }
  2318. num = 0;
  2319. singleQuotedBuffer.length = 0;
  2320. inQuote = false;
  2321. }
  2322. }
  2323. else {
  2324. if (!inQuote) {
  2325. if (c < "0" || c > "9") {
  2326. console.error(this.id + " --> picture init error: " + picture);
  2327. }
  2328. num = num * 10 + parseInt(c);
  2329. }
  2330. else {
  2331. var char = singleQuotedBuffer.length === 0 ? c : singleQuotedBuffer.pop() + c;
  2332. singleQuotedBuffer.push(char);
  2333. }
  2334. }
  2335. }
  2336. for (var i = 0; i < num; i++) {
  2337. newPictureBuffer.push("X");
  2338. }
  2339. tmpPicture = newPictureBuffer[0];
  2340. while (tmpPicture.indexOf(".") !== tmpPicture.lastIndexOf(".")) {
  2341. var lastDotIndex = tmpPicture.lastIndexOf(".");
  2342. tmpPicture = tmpPicture.substring(0, lastDotIndex)
  2343. + tmpPicture.substring(lastDotIndex + 1);
  2344. }
  2345. this.length = tmpPicture.length;
  2346. adoreText.setMaxLength(this.length);
  2347. if (tmpPicture.charAt(0) === "0" || tmpPicture.charAt(0) === "C!") {
  2348. }
  2349. this.picture = tmpPicture;
  2350. }
  2351. PictureValidator.prototype.handleKeyDownEvent = function (e) {
  2352. var textValue = this.textNode.value;
  2353. if (this.length > 1) {
  2354. var start = this.textNode.selectionStart;
  2355. var end = this.textNode.selectionEnd;
  2356. if (start === end) {
  2357. if (e.keyCode === Keys_4.Keys.BACKSPACE) {
  2358. if (PictureValidator.KNOWN_FLAGS.indexOf(this.picture.charAt(this.length
  2359. - this.textNode.value.length + start - 1)) === -1) {
  2360. this.textNode.selectionStart = --start;
  2361. this.textNode.selectionEnd = --end;
  2362. }
  2363. if (this.textNode.value.indexOf("-0.") === 0 && start === 2) {
  2364. this.textNode.value = this.textNode.value.substring(1);
  2365. this.textNode.selectionStart = 1;
  2366. this.textNode.selectionEnd = 1;
  2367. e.preventDefault();
  2368. }
  2369. }
  2370. if (e.keyCode === 127) {
  2371. if (PictureValidator.KNOWN_FLAGS.indexOf(this.picture.charAt(this.picture.length
  2372. - this.textNode.value.length + start)) === -1) {
  2373. this.textNode.selectionStart = ++start;
  2374. }
  2375. }
  2376. }
  2377. }
  2378. if (this.length > 0) {
  2379. var byteLength = 0;
  2380. for (var i = 0; i < this.textNode.value.length; i++) {
  2381. var c = this.textNode.value.charCodeAt(i);
  2382. if ((c >= 0x0001 && c <= 0x007e) || (0xff60 <= c && c <= 0xff9f)) {
  2383. byteLength++;
  2384. }
  2385. else {
  2386. byteLength += 2;
  2387. }
  2388. }
  2389. if (textValue != null
  2390. && byteLength >= this.length
  2391. && (this.textNode.selectionEnd - this.textNode.selectionStart) === 0) {
  2392. if (e.keyCode !== 8 && e.keyCode !== 127
  2393. && e.keyCode !== Keys_4.Keys.RIGHT_ARROW
  2394. && e.keyCode !== Keys_4.Keys.LEFT_ARROW) {
  2395. if (this.picture.length > 0
  2396. && this.picture.charAt(0) === "$") {
  2397. return;
  2398. }
  2399. if (this.picture.indexOf(".") === -1) {
  2400. e.preventDefault();
  2401. }
  2402. else {
  2403. if (this.textNode.selectionStart <= this.textNode.value
  2404. .indexOf(".") && e.char !== ".") {
  2405. e.preventDefault();
  2406. }
  2407. }
  2408. }
  2409. }
  2410. }
  2411. };
  2412. PictureValidator.prototype.handleModifyEvent = function () {
  2413. this.cursorIndex = this.textNode.selectionEnd;
  2414. var textValue = this.textNode.value;
  2415. if (this.picture.charAt(0) === "$") {
  2416. while (textValue.indexOf("$") === 0) {
  2417. textValue = textValue.substring(1, textValue.length - 1);
  2418. this.cursorIndex--;
  2419. }
  2420. this.cursorIndex = Math.max(this.cursorIndex, 0);
  2421. }
  2422. textValue = this.removeUnknownFlags(textValue, this.picture, true);
  2423. var refinedPicture = this.removeUnknownFlags(this.picture, this.picture, false);
  2424. if (textValue.lastIndexOf("-") > 0) {
  2425. var otherFlag = refinedPicture.replace(/[90\\.]/g, "");
  2426. if (otherFlag.length === 0) {
  2427. var index = -1;
  2428. while ((index = textValue.indexOf("-")) > -1) {
  2429. if (index < (this.cursorIndex - 1)) {
  2430. this.cursorIndex--;
  2431. textValue = textValue.replace("-", "");
  2432. }
  2433. else {
  2434. textValue = textValue.replace(/-/g, "");
  2435. break;
  2436. }
  2437. }
  2438. textValue = "-" + textValue;
  2439. }
  2440. }
  2441. if (refinedPicture.indexOf(".") !== -1) {
  2442. while (textValue.indexOf(".") !== textValue.lastIndexOf(".")) {
  2443. textValue = textValue.substring(0, textValue.lastIndexOf("."))
  2444. + textValue.substring(textValue.lastIndexOf(".") + 1);
  2445. this.cursorIndex = textValue.indexOf(".") + 1;
  2446. }
  2447. if (textValue.indexOf(".") === -1) {
  2448. textValue = textValue.substring(0, this.cursorIndex) + "."
  2449. + textValue.substring(this.cursorIndex);
  2450. }
  2451. if (textValue.indexOf(".") === 0) {
  2452. textValue = "0" + textValue;
  2453. this.cursorIndex++;
  2454. }
  2455. else if (this.startWithZeroReg.test(textValue)) {
  2456. textValue = textValue.substring(1);
  2457. this.cursorIndex--;
  2458. }
  2459. else if (this.startWithZeroMinusReg.test(textValue)) {
  2460. textValue = textValue.substring(0, 1) + textValue.substring(2);
  2461. this.cursorIndex--;
  2462. }
  2463. if (this.startWithMinusReg.test(textValue)) {
  2464. textValue = "-0" + textValue.substring(1);
  2465. this.cursorIndex++;
  2466. }
  2467. var pictureSuffixLength = refinedPicture.length - 1
  2468. - refinedPicture.indexOf(".");
  2469. var strSuffixLength = textValue.length - 1 - textValue.indexOf(".");
  2470. if (strSuffixLength > pictureSuffixLength) {
  2471. var newLength = textValue.length - strSuffixLength
  2472. + pictureSuffixLength;
  2473. textValue = textValue.substring(0, newLength);
  2474. this.cursorIndex = Math.min(textValue.length, this.cursorIndex);
  2475. }
  2476. for (var i = 0; i < pictureSuffixLength - strSuffixLength; i++) {
  2477. textValue += "0";
  2478. }
  2479. }
  2480. if (textValue.length > refinedPicture.length) {
  2481. if (this.leftAlignment) {
  2482. textValue = textValue.substring(0, refinedPicture.length);
  2483. }
  2484. else {
  2485. textValue = textValue.substring(textValue.length - refinedPicture.length);
  2486. }
  2487. }
  2488. for (var i = 0; i < textValue.length;) {
  2489. if (refinedPicture.charAt(refinedPicture.length - textValue.length
  2490. + i) === "^") {
  2491. textValue = textValue.substring(0, i) + textValue.charAt(i).toUpperCase()
  2492. + textValue.substring(i + 1);
  2493. }
  2494. if (!this.checkFormat(refinedPicture.charAt(refinedPicture.length
  2495. - textValue.length + i), textValue.charAt(i), i)) {
  2496. textValue = textValue.substring(0, i) + textValue.substring(i + 1);
  2497. this.cursorIndex = i;
  2498. }
  2499. else {
  2500. i++;
  2501. }
  2502. }
  2503. var startWithMinus = false;
  2504. if (textValue.indexOf("-") === 0) {
  2505. textValue = textValue.substring(1);
  2506. startWithMinus = true;
  2507. }
  2508. textValue = this.addUnknownFlags(textValue, this.picture);
  2509. if (this.picture.charAt(0) === "$") {
  2510. while (textValue.length < this.length) {
  2511. textValue = "$" + textValue;
  2512. this.cursorIndex++;
  2513. }
  2514. }
  2515. if (startWithMinus) {
  2516. textValue = "-" + textValue;
  2517. }
  2518. this.textNode.value = textValue;
  2519. this.textNode.selectionStart = this.cursorIndex;
  2520. this.textNode.selectionEnd = this.cursorIndex;
  2521. };
  2522. PictureValidator.prototype.removeUnknownFlags = function (textValue, picture, modifyCursorIndex) {
  2523. var unknownFlags = "";
  2524. for (var i = 0; i < picture.length; i++) {
  2525. if (PictureValidator.KNOWN_FLAGS.indexOf(picture.charAt(i)) === -1) {
  2526. unknownFlags += picture.charAt(i);
  2527. }
  2528. }
  2529. for (var i = 0; i < unknownFlags.length; i++) {
  2530. var j = textValue.indexOf(unknownFlags.charAt(i));
  2531. if (j !== -1) {
  2532. textValue = textValue.substring(0, j) + textValue.substring(j + 1);
  2533. if (modifyCursorIndex && this.cursorIndex > j) {
  2534. this.cursorIndex--;
  2535. }
  2536. }
  2537. }
  2538. return textValue;
  2539. };
  2540. PictureValidator.prototype.checkFormat = function (format, c, index) {
  2541. switch (format) {
  2542. case "$":
  2543. if (c === "$") {
  2544. for (var i = 0; i < index; i++) {
  2545. if (this.textNode.value.charAt(i) !== "$")
  2546. return false;
  2547. }
  2548. }
  2549. if ((c < "0" || c > "9") && c !== "-") {
  2550. return false;
  2551. }
  2552. if (c === "-" && index === 0)
  2553. return true;
  2554. if (c === "-") {
  2555. for (var i = 0; i < index; i++) {
  2556. if (this.textNode.value.charAt(i) !== "$")
  2557. return false;
  2558. }
  2559. }
  2560. break;
  2561. case "9":
  2562. if ((c < "0" || c > "9") && c !== "-") {
  2563. return false;
  2564. }
  2565. if (c === "-" && index !== 0)
  2566. return false;
  2567. break;
  2568. case "0":
  2569. if (c < "0" || c > "9") {
  2570. return false;
  2571. }
  2572. break;
  2573. case "A":
  2574. if ((c < "a" || c > "z") && (c < "A" || c > "Z")) {
  2575. return false;
  2576. }
  2577. break;
  2578. case "N":
  2579. case "!":
  2580. if ((c < "a" || c > "z") && (c < "A" || c > "Z")
  2581. && (c < "0" || c > "9")) {
  2582. return false;
  2583. }
  2584. break;
  2585. case "C":
  2586. if (c.charCodeAt(0) < 0x3400) {
  2587. return false;
  2588. }
  2589. break;
  2590. case "^":
  2591. break;
  2592. case "c":
  2593. if (c.charCodeAt(0) >= 0x3400)
  2594. return false;
  2595. break;
  2596. case "F":
  2597. if (c.charCodeAt(0) < 256) {
  2598. return false;
  2599. }
  2600. break;
  2601. case "X":
  2602. break;
  2603. default:
  2604. if (c === format)
  2605. return true;
  2606. if (c === "-" && index === 0)
  2607. return true;
  2608. return false;
  2609. }
  2610. return true;
  2611. };
  2612. PictureValidator.prototype.addUnknownFlags = function (s, picture) {
  2613. for (var i = 0; i < s.length; i++) {
  2614. if (PictureValidator.KNOWN_FLAGS.indexOf(picture.charAt(picture.length - 1 - i)) === -1) {
  2615. s = s.substring(0, s.length - i)
  2616. + picture.charAt(picture.length - 1 - i)
  2617. + s.substring(s.length - i);
  2618. if (this.cursorIndex > s.length - 1 - i) {
  2619. this.cursorIndex++;
  2620. }
  2621. }
  2622. }
  2623. return s;
  2624. };
  2625. PictureValidator.KNOWN_FLAGS = "90^$AN!CcFX.";
  2626. return PictureValidator;
  2627. }());
  2628. exports.PictureValidator = PictureValidator;
  2629. });
  2630. define("widget/Text", ["require", "exports", "widget/Widget", "ADORE", "event/EventHub", "event/MessageType", "event/Event", "widget/validator/MaxLengthValidator", "widget/validator/PictureValidator", "util/SoftwareKeyboardUtil", "util/RequisiteUtil"], function (require, exports, Widget_4, ADORE_2, EventHub_6, MessageType_7, Event_4, MaxLengthValidator_1, PictureValidator_1, SoftwareKeyboardUtil_1, RequisiteUtil_1) {
  2631. "use strict";
  2632. var Text = (function (_super) {
  2633. __extends(Text, _super);
  2634. function Text(parentId, id, style) {
  2635. _super.call(this, parentId, id, style);
  2636. this.editable = true;
  2637. this.requisite = false;
  2638. this.maxLength = -1;
  2639. var own = this;
  2640. this.$thisNode = $(Text.Template).attr({
  2641. id: this.id + "_containerNode"
  2642. });
  2643. this.$inputNode = this.$thisNode.find("input");
  2644. this.$inputNode.attr("id", this.id).on("input", function (e) {
  2645. if ($(this).prop('comStart'))
  2646. return;
  2647. own.handleOnInput();
  2648. EventHub_6.EventHub.dispatchEvent(MessageType_7.MessageType.WIDGET, {
  2649. id: id,
  2650. text: $(this).val(),
  2651. evtType: Event_4.Event.MODIFY,
  2652. syncAttrName: "text"
  2653. });
  2654. }).on("focus", function () {
  2655. own.sendFocusGain();
  2656. SoftwareKeyboardUtil_1.SoftwareKeyboardUtil.refresh();
  2657. }).on("blur", function () {
  2658. RequisiteUtil_1.RequisiteUtil.checkRequisite(own.requisite, own, own.editable, own.$inputNode.val(), "请输入数据!");
  2659. }).on('compositionstart', function () {
  2660. $(this).prop('comStart', true);
  2661. }).on('compositionend', function () {
  2662. $(this).prop('comStart', false);
  2663. });
  2664. this.$thisNode.find("label").attr("for", this.id);
  2665. if ((this.style & ADORE_2.ADORE.Password) === ADORE_2.ADORE.Password) {
  2666. this.$inputNode.attr("type", "password");
  2667. }
  2668. }
  2669. Text.prototype.handleOnInput = function () {
  2670. this.maxLengthValidator.handleModifyEvent();
  2671. if (this.pictureValidator)
  2672. this.pictureValidator.handleModifyEvent();
  2673. RequisiteUtil_1.RequisiteUtil.checkRequisite(this.requisite, this, this.editable, this.$inputNode.val(), "请输入数据!");
  2674. };
  2675. Text.prototype.setRequisite = function (args) {
  2676. this.requisite = args.requisite;
  2677. RequisiteUtil_1.RequisiteUtil.checkRequisite(this.requisite, this, this.editable, this.$inputNode.val(), "");
  2678. };
  2679. Text.prototype.setEnabled = function (args) {
  2680. this.enabled = args.enabled;
  2681. if (this.enabled) {
  2682. this.$inputNode.removeAttr("disabled");
  2683. this.$thisNode.find("i").removeClass("icon_disabled");
  2684. }
  2685. else {
  2686. this.$inputNode.attr("disabled", "disabled");
  2687. this.$thisNode.find("i").addClass("icon_disabled");
  2688. }
  2689. RequisiteUtil_1.RequisiteUtil.checkRequisite(this.requisite, this, this.editable, this.$inputNode.val(), "");
  2690. };
  2691. Text.prototype.setFocus = function () {
  2692. if (document.activeElement !== this.$inputNode[0]) {
  2693. this.$inputNode.focus();
  2694. }
  2695. RequisiteUtil_1.RequisiteUtil.checkRequisite(this.requisite, this, this.editable, this.$inputNode.val(), "请输入数据!");
  2696. };
  2697. Text.prototype.setText = function (args) {
  2698. this.$inputNode.val(args.text);
  2699. if (args.text.length > 0) {
  2700. this.$inputNode.siblings("label, i").addClass("active");
  2701. }
  2702. else {
  2703. this.$inputNode.siblings("label, i").removeClass("active");
  2704. }
  2705. RequisiteUtil_1.RequisiteUtil.checkRequisite(this.requisite, this, this.editable, this.$inputNode.val(), "");
  2706. };
  2707. Text.prototype.setIcon = function (args) {
  2708. this.$thisNode.find("i").addClass(args.icon);
  2709. if (this.$inputNode.val().length > 0)
  2710. this.$inputNode.siblings("label, i").addClass("active");
  2711. this.$thisNode.find("span").addClass("span_prefix");
  2712. };
  2713. Text.prototype.setName = function (args) {
  2714. this.$thisNode.find("label").text(args.name);
  2715. };
  2716. Text.prototype.setPicture = function (args) {
  2717. this.picture = args.picture;
  2718. };
  2719. Text.prototype.handleKeyDownEvent = function (e, hasFilter) {
  2720. if (this.pictureValidator)
  2721. this.pictureValidator.handleKeyDownEvent(e);
  2722. _super.prototype.handleKeyDownEvent.call(this, e, hasFilter);
  2723. };
  2724. Text.prototype.handleMaxLength = function () {
  2725. this.maxLengthValidator = new MaxLengthValidator_1.MaxLengthValidator(this.id, this.$inputNode[0], this.maxLength);
  2726. };
  2727. Text.prototype.setMaxLength = function (maxLength) {
  2728. if (this.maxLengthValidator)
  2729. this.maxLengthValidator.setMaxLength(maxLength);
  2730. };
  2731. Text.prototype.handlePicture = function (picture) {
  2732. if (picture.length > 0 && picture.indexOf("\"") < 0) {
  2733. if (picture.indexOf(",") >= 0 || picture.indexOf(".") >= 0) {
  2734. console.error("非法的picutre:" + picture);
  2735. picture = "";
  2736. }
  2737. var allNum = true;
  2738. for (var i = 0; i < picture.length; i++) {
  2739. var c = picture.charAt(i);
  2740. if (c < "0" || c > "9") {
  2741. allNum = false;
  2742. break;
  2743. }
  2744. }
  2745. if (allNum && picture.length > 2) {
  2746. console.error("非法的picture:" + picture);
  2747. picture = "";
  2748. }
  2749. }
  2750. this.pictureValidator = new PictureValidator_1.PictureValidator(this.id, this.$inputNode[0], picture, this);
  2751. };
  2752. Text.prototype.setmaxLength = function (args) {
  2753. this.maxLength = args.maxLength;
  2754. };
  2755. Text.prototype.postLayout = function () {
  2756. this.handleMaxLength();
  2757. if (this.picture)
  2758. this.handlePicture(this.picture);
  2759. };
  2760. Text.prototype.setPanelID = function (args) {
  2761. this.panelID = args.panelID;
  2762. };
  2763. Text.prototype.setEditable = function (args) {
  2764. this.editable = args.editable;
  2765. if (this.editable) {
  2766. this.$inputNode.removeAttr("readOnly");
  2767. }
  2768. else {
  2769. this.$inputNode.attr("readOnly", "readOnly");
  2770. }
  2771. RequisiteUtil_1.RequisiteUtil.checkRequisite(this.requisite, this, this.editable, this.$inputNode.val(), "");
  2772. };
  2773. Text.prototype.toString = function () {
  2774. return "Text";
  2775. };
  2776. Text.prototype.setTooltip = function (args) {
  2777. this.$inputNode.tooltip('remove');
  2778. if (args.tooltip !== "") {
  2779. this.$inputNode.attr("data-position", "right");
  2780. this.$inputNode.attr("data-tooltip", args.tooltip);
  2781. this.$inputNode.tooltip({ delay: 50 });
  2782. }
  2783. };
  2784. Text.Template = "\n <div class=\"input-field\">\n <i class=\"icon_normal\"></i>\n <input type=\"text\">\n <label></label>\n <span class=\"span_base\"></span>\n </div>\n ";
  2785. return Text;
  2786. }(Widget_4.Widget));
  2787. exports.Text = Text;
  2788. });
  2789. define("util/SoftwareKeyboardUtil", ["require", "exports", "util/WidgetUtil"], function (require, exports, WidgetUtil_3) {
  2790. "use strict";
  2791. var SoftwareKeyboardUtil = (function () {
  2792. function SoftwareKeyboardUtil() {
  2793. }
  2794. SoftwareKeyboardUtil.handleSoftwareKeyboardShow = function (args) {
  2795. this.keyboardShowed = true;
  2796. this.proportion = args.proportion;
  2797. this.refresh();
  2798. };
  2799. SoftwareKeyboardUtil.refresh = function () {
  2800. if (this.keyboardShowed === true) {
  2801. var keyboardHeightProportion = this.proportion;
  2802. var element = document.activeElement;
  2803. var widget = WidgetUtil_3.WidgetUtil.findWidgetByTarget(element);
  2804. if (widget && widget.toString() === "Text") {
  2805. var softKeyboardHeight = keyboardHeightProportion * window.innerHeight;
  2806. var textWidget = widget;
  2807. this.scroll(textWidget.panelID, widget.$thisNode[0], softKeyboardHeight);
  2808. }
  2809. }
  2810. };
  2811. SoftwareKeyboardUtil.refreshKeyboardHide = function () {
  2812. $("#softKeyboardDiv").remove();
  2813. if (this.lastPanelID) {
  2814. $("#" + this.lastPanelID).css({ "overflow-y": this.lastOverflowYValue, "display": this.lastDisplayValue });
  2815. this.lastPanelID = null;
  2816. }
  2817. };
  2818. SoftwareKeyboardUtil.handleSoftwareKeyboardHide = function () {
  2819. this.keyboardShowed = false;
  2820. this.refreshKeyboardHide();
  2821. };
  2822. SoftwareKeyboardUtil.scroll = function (panelID, textNode, softKeyboardHeight) {
  2823. if (this.lastPanelID !== panelID) {
  2824. this.refreshKeyboardHide();
  2825. }
  2826. var top = this.getElementViewBottom(textNode);
  2827. var i;
  2828. if (softKeyboardHeight - top >= 1) {
  2829. var containerNode = $("#" + panelID);
  2830. this.lastPanelID = panelID;
  2831. if ($("div.adore_shell_content").length !== 0) {
  2832. var adoreShells = $("div.adore_shell_content");
  2833. for (i = 0; i < adoreShells.length; i++) {
  2834. if ($(adoreShells[i]).find("#" + panelID).length !== 0) {
  2835. containerNode = $(adoreShells[i]);
  2836. break;
  2837. }
  2838. }
  2839. }
  2840. var container = containerNode[0];
  2841. this.lastOverflowYValue = containerNode.css("overflow-y");
  2842. this.lastDisplayValue = containerNode.css("display");
  2843. containerNode.css({ "overflow-y": "auto", "display": "block" });
  2844. container.scrollTop = container.scrollTop + (softKeyboardHeight - top);
  2845. var afterTop = this.getElementViewBottom(textNode);
  2846. if (softKeyboardHeight - afterTop >= 1) {
  2847. var tempDivNode = $("<div></div>").css({
  2848. height: softKeyboardHeight + "px",
  2849. width: "1px"
  2850. }).attr({ id: "softKeyboardDiv" });
  2851. if (containerNode.css("position") === "absolute") {
  2852. var children = containerNode.children();
  2853. var totalHeight = 0;
  2854. for (i = 0; i < children.length; i++) {
  2855. totalHeight += children[i].offsetHeight;
  2856. }
  2857. var tempDivTop = container.offsetHeight >= totalHeight ? container.offsetHeight : totalHeight;
  2858. tempDivNode.css({
  2859. position: "absolute",
  2860. top: tempDivTop + "px"
  2861. });
  2862. }
  2863. tempDivNode.appendTo(container);
  2864. container.scrollTop = container.scrollTop + (softKeyboardHeight - afterTop);
  2865. }
  2866. }
  2867. };
  2868. SoftwareKeyboardUtil.getElementViewBottom = function (element) {
  2869. var top = element.getBoundingClientRect().top;
  2870. return window.innerHeight - top - element.offsetHeight;
  2871. };
  2872. return SoftwareKeyboardUtil;
  2873. }());
  2874. exports.SoftwareKeyboardUtil = SoftwareKeyboardUtil;
  2875. });
  2876. define("util/TabUtil", ["require", "exports", "event/EventHub", "event/Event", "event/MessageType"], function (require, exports, EventHub_7, Event_5, MessageType_8) {
  2877. "use strict";
  2878. var TabUtil = (function () {
  2879. function TabUtil() {
  2880. }
  2881. TabUtil.handleTabLeftMoveClick = function (tabFolderId) {
  2882. var tabs = $("#" + tabFolderId);
  2883. var indexs = this.getBlockIndexs(tabs);
  2884. var blockBegin = indexs[0], blockEnd = indexs[1];
  2885. if (blockBegin <= 0) {
  2886. return;
  2887. }
  2888. var lis = tabs.find("li.adore_tab");
  2889. var count = this.tabLeftMove(tabs, lis, blockBegin);
  2890. if (count <= 1) {
  2891. this.tabLeftMove(tabs, lis, blockBegin - 1);
  2892. }
  2893. this.resetMovingIcon(tabs, lis);
  2894. this.resetIndicator(tabs, lis);
  2895. };
  2896. TabUtil.handleTabRightMoveClick = function (tabFolderId) {
  2897. var tabs = $("#" + tabFolderId);
  2898. var indexs = this.getBlockIndexs(tabs);
  2899. var blockBegin = indexs[0], blockEnd = indexs[1];
  2900. var lis = tabs.find("li.adore_tab");
  2901. if (this.isEndRight(tabs, lis)) {
  2902. return;
  2903. }
  2904. var count = this.tabRightMove(tabs, lis, blockEnd);
  2905. if (count <= 1) {
  2906. this.tabRightMove(tabs, lis, blockEnd + 1);
  2907. }
  2908. this.resetMovingIcon(tabs, lis);
  2909. this.resetIndicator(tabs, lis);
  2910. };
  2911. TabUtil.isEndRight = function (tabs, lis) {
  2912. var indexs = this.getBlockIndexs(tabs);
  2913. var endRight = false;
  2914. if (indexs[1] === lis.length - 1) {
  2915. var w = $(lis[indexs[1]]).width();
  2916. this.resetAndGetRealWidth(tabs);
  2917. var realW = $(lis[indexs[1]]).width();
  2918. $(lis[indexs[1]]).width(w + "px");
  2919. if (w === realW) {
  2920. endRight = true;
  2921. }
  2922. }
  2923. if (indexs[0] === indexs[1]) {
  2924. endRight = true;
  2925. }
  2926. return endRight;
  2927. };
  2928. TabUtil.resetMovingIcon = function (tabs, lis) {
  2929. if (tabs.find("li.tab_left_move").css("display") === "none") {
  2930. return;
  2931. }
  2932. var indexs = this.getBlockIndexs(tabs);
  2933. var endRight = this.isEndRight(tabs, lis);
  2934. var arrowRight = tabs.find("li.tab_right_move").find("div");
  2935. var arrowLeft = tabs.find("li.tab_left_move").find("div");
  2936. arrowLeft.removeClass("arrow_not_active").removeClass("arrow_active");
  2937. arrowRight.removeClass("arrow_not_active").removeClass("arrow_active");
  2938. if (endRight) {
  2939. arrowRight.addClass("arrow_not_active");
  2940. }
  2941. else {
  2942. arrowRight.addClass("arrow_active");
  2943. }
  2944. if (indexs[0] === 0) {
  2945. arrowLeft.addClass("arrow_not_active");
  2946. }
  2947. else {
  2948. arrowLeft.addClass("arrow_active");
  2949. }
  2950. };
  2951. TabUtil.tabLeftMove = function (tabs, lis, blockBegin) {
  2952. lis.removeClass("tab_visible").addClass("tab_not_visible");
  2953. var canUseWidth = tabs.width() - this.movingIconWidth - this.totalWidthPrefix;
  2954. var usedWidth = 0;
  2955. var i;
  2956. this.resetAndGetRealWidth(tabs);
  2957. for (i = blockBegin; i >= 0 && usedWidth < canUseWidth; i--) {
  2958. $(lis[i]).addClass("tab_visible").removeClass("tab_not_visible");
  2959. usedWidth += $(lis[i]).width();
  2960. }
  2961. for (i = blockBegin + 1; i < lis.length && usedWidth < canUseWidth; i++) {
  2962. $(lis[i]).addClass("tab_visible").removeClass("tab_not_visible");
  2963. usedWidth += $(lis[i]).width();
  2964. }
  2965. var tempIndexs = this.getBlockIndexs(tabs);
  2966. var end = tempIndexs[1];
  2967. if (usedWidth > canUseWidth) {
  2968. $(lis[end]).width($(lis[end]).width() - (usedWidth - canUseWidth) + "px");
  2969. }
  2970. return tempIndexs[1] - tempIndexs[0] + 1;
  2971. };
  2972. TabUtil.tabRightMove = function (tabs, lis, blockEnd) {
  2973. lis.removeClass("tab_visible").addClass("tab_not_visible");
  2974. var canUseWidth = tabs.width() - this.movingIconWidth - this.totalWidthPrefix;
  2975. var usedWidth = 0;
  2976. var i;
  2977. this.resetAndGetRealWidth(tabs);
  2978. for (i = blockEnd; i < lis.length && usedWidth < canUseWidth; i++) {
  2979. $(lis[i]).addClass("tab_visible").removeClass("tab_not_visible");
  2980. usedWidth += $(lis[i]).width();
  2981. }
  2982. for (i = blockEnd - 1; i >= 0 && usedWidth < canUseWidth; i--) {
  2983. $(lis[i]).addClass("tab_visible").removeClass("tab_not_visible");
  2984. usedWidth += $(lis[i]).width();
  2985. }
  2986. var tempIndexs = this.getBlockIndexs(tabs);
  2987. var end = tempIndexs[1], begin = tempIndexs[0];
  2988. if (usedWidth > canUseWidth) {
  2989. if (end === lis.length - 1 && end != begin) {
  2990. $(lis[begin]).removeClass("tab_visible").addClass("tab_not_visible");
  2991. }
  2992. else {
  2993. $(lis[end]).width($(lis[end]).width() - (usedWidth - canUseWidth) + "px");
  2994. }
  2995. }
  2996. tempIndexs = this.getBlockIndexs(tabs);
  2997. return tempIndexs[1] - tempIndexs[0] + 1;
  2998. };
  2999. TabUtil.getBlockIndexs = function (tabs) {
  3000. var tabList = tabs.find("li.adore_tab");
  3001. var blockBegin = 0, blockEnd = 0, i;
  3002. for (i = 0; i < tabList.length; i++) {
  3003. if ($(tabList[i]).css("display") === "block") {
  3004. blockBegin = i;
  3005. break;
  3006. }
  3007. }
  3008. for (i = tabList.length - 1; i >= 0; i--) {
  3009. if ($(tabList[i]).css("display") === "block") {
  3010. blockEnd = i;
  3011. break;
  3012. }
  3013. }
  3014. return [blockBegin, blockEnd];
  3015. };
  3016. TabUtil.getPreTabIndex = function (tabs) {
  3017. var preIndex = 0;
  3018. var activeHref = tabs.find("a.active").attr("href");
  3019. var tabList = tabs.find("li.adore_tab");
  3020. var tmpHref;
  3021. for (var i = 0; i < tabList.length; i++) {
  3022. tmpHref = $(tabList[i]).find("a").attr("href");
  3023. if (activeHref === tmpHref) {
  3024. preIndex = i;
  3025. break;
  3026. }
  3027. }
  3028. var blockIndexs = this.getBlockIndexs(tabs);
  3029. if (preIndex < blockIndexs[0]) {
  3030. return -1;
  3031. }
  3032. if (preIndex > blockIndexs[1]) {
  3033. return -2;
  3034. }
  3035. return preIndex - blockIndexs[0];
  3036. };
  3037. TabUtil.handleTabClick = function (e, currentTab, tabFolderId) {
  3038. var tabs = $("#" + tabFolderId);
  3039. var tabList = tabs.find("li.tab_visible");
  3040. var currentIndex = 0;
  3041. var currentHref = currentTab.attr("href");
  3042. var tmpHref;
  3043. for (var i = 0; i < tabList.length; i++) {
  3044. tmpHref = $(tabList[i]).find("a").attr("href");
  3045. if (currentHref === tmpHref) {
  3046. currentIndex = i;
  3047. break;
  3048. }
  3049. }
  3050. var lis = tabs.find("li.adore_tab");
  3051. var preIndex = this.getPreTabIndex(tabs);
  3052. var activeHref = tabs.find("a.active").attr("href");
  3053. $(activeHref).removeClass("tab_control_visible").addClass("tab_control_not_visible");
  3054. tabs.find("a.active").removeClass("active");
  3055. currentTab.addClass("active");
  3056. $(currentHref).removeClass("tab_control_not_visible").addClass("tab_control_visible");
  3057. var $tab_width = $(tabList[currentIndex]).width();
  3058. var $indivatorLeft = this.getIndicatorLeftWidth(tabs, lis);
  3059. var $indicator = tabs.find("div.my_indicator");
  3060. if (preIndex === -2 || preIndex === -1) {
  3061. $indicator.width(this.$tab_min_width + "px");
  3062. }
  3063. $indicator.velocity({ "left": $indivatorLeft, "width": $tab_width + "px" }, {
  3064. duration: 300,
  3065. queue: false,
  3066. easing: 'easeOutQuad'
  3067. });
  3068. };
  3069. TabUtil.resetAndGetRealWidth = function (tabs) {
  3070. var lis = tabs.find("li.adore_tab");
  3071. var tabRealWidth = 0;
  3072. for (var i = 0; i < lis.length; i++) {
  3073. var a = $(lis[i]).find("a");
  3074. var text = a.text();
  3075. var fontSize = a.css("font-size");
  3076. var letterSpacing = a.css("letter-spacing");
  3077. fontSize = parseFloat(fontSize.replace("px", ""));
  3078. letterSpacing = parseFloat(letterSpacing.replace("px", ""));
  3079. var t = (fontSize + letterSpacing) * text.length + this.$tab_min_width / 2;
  3080. t = t > this.$tab_min_width ? t : this.$tab_min_width;
  3081. tabRealWidth += t;
  3082. $(lis[i]).width(t + "px");
  3083. }
  3084. return tabRealWidth;
  3085. };
  3086. TabUtil.refreshTabs = function (tabs) {
  3087. var totalWidth = tabs.width() - this.totalWidthPrefix;
  3088. var lis = tabs.find("li.adore_tab");
  3089. var activeIndex = this.getActiveIndex(lis);
  3090. lis.removeClass("tab_visible");
  3091. lis.addClass("tab_not_visible");
  3092. tabs.find("li.tab_left_move").css("display", "none");
  3093. tabs.find("li.tab_right_move").css("display", "none");
  3094. this.movingIconWidth = tabs.find("li.tab_left_move").width() + tabs.find("li.tab_right_move").width() + 10;
  3095. var tabRealWidth = this.resetAndGetRealWidth(tabs);
  3096. tabs.find("li.adore_tab_space").css("display", "none");
  3097. if (tabRealWidth > totalWidth) {
  3098. tabs.find("li.tab_left_move").css("display", "block");
  3099. tabs.find("li.tab_right_move").css("display", "block");
  3100. this.tabRightMove(tabs, lis, activeIndex);
  3101. }
  3102. else {
  3103. lis.removeClass("tab_not_visible").addClass("tab_visible");
  3104. tabs.find("li.adore_tab_space").css("display", "block");
  3105. }
  3106. tabs.find("div.indicator").remove();
  3107. tabs.find("div.my_indicator").remove();
  3108. var indicator = $("<div></div>").addClass("my_indicator");
  3109. indicator.appendTo(tabs);
  3110. this.resetIndicator(tabs, lis);
  3111. this.resetMovingIcon(tabs, lis);
  3112. };
  3113. TabUtil.getActiveIndex = function (lis) {
  3114. var activeIndex = 0;
  3115. for (var i = 0; i < lis.length; i++) {
  3116. if ($(lis[i]).find("a.active").length != 0) {
  3117. activeIndex = i;
  3118. break;
  3119. }
  3120. }
  3121. return activeIndex;
  3122. };
  3123. TabUtil.resetIndicator = function (tabs, lis) {
  3124. var indicatorLeft = this.getIndicatorLeftWidth(tabs, lis);
  3125. var indicator = tabs.find("div.my_indicator");
  3126. if (indicatorLeft === -1) {
  3127. indicator.width(0);
  3128. return;
  3129. }
  3130. var index = this.getActiveIndex(lis);
  3131. indicator.width($(lis[index]).width() + "px");
  3132. indicator.css("left", indicatorLeft + "px");
  3133. };
  3134. TabUtil.getIndicatorLeftWidth = function (tabs, lis) {
  3135. var indexs = this.getBlockIndexs(tabs), activeIndex = this.getActiveIndex(lis), indicatorLeft = 0;
  3136. if (activeIndex < indexs[0] || activeIndex > indexs[1]) {
  3137. return -1;
  3138. }
  3139. if (tabs.find("li.tab_left_move").css("display") === "block") {
  3140. indicatorLeft += this.movingLeftIconWidth;
  3141. }
  3142. else {
  3143. indicatorLeft += this.totalWidthPrefix;
  3144. }
  3145. for (var i = indexs[0]; i < activeIndex; i++) {
  3146. indicatorLeft += $(lis[i]).width();
  3147. }
  3148. return indicatorLeft;
  3149. };
  3150. TabUtil.init = function (tabs) {
  3151. tabs.each(function () {
  3152. var $this = $(this);
  3153. var tabsId = $this.attr("id");
  3154. var ownId = tabsId;
  3155. if (ownId) {
  3156. ownId = ownId.substring(0, ownId.length - 5);
  3157. }
  3158. $this.width('100%');
  3159. var $active, $content, $links = $this.find('li.adore_tab a'), $tabs_width = $this.width(), $tab_width = $this.find('li').first().outerWidth(), $index = 0;
  3160. $active = $($links.filter('[href="' + location.hash + '"]'));
  3161. if ($active.length === 0) {
  3162. $active = $(this).find('li.adore_tab a.active').first();
  3163. }
  3164. if ($active.length === 0) {
  3165. $active = $(this).find('li.adore_tab a').first();
  3166. }
  3167. $active.addClass('active');
  3168. $index = $links.index($active);
  3169. if ($index < 0) {
  3170. $index = 0;
  3171. }
  3172. $content = $($active[0].hash);
  3173. $this.append("<div class=\"indicator\"></div>");
  3174. var $indicator = $this.find('.indicator');
  3175. if ($this.is(":visible")) {
  3176. $indicator.css({ "right": $tabs_width - (($index + 1) * $tab_width) });
  3177. $indicator.css({ "left": $index * $tab_width });
  3178. }
  3179. var resizeListener = tabs.data("resize_listener");
  3180. if (!resizeListener) {
  3181. resizeListener = function () {
  3182. $tabs_width = $this.width();
  3183. $tab_width = $this.find('li').first().outerWidth();
  3184. if ($index < 0) {
  3185. $index = 0;
  3186. }
  3187. if ($tab_width !== 0 && $tabs_width !== 0) {
  3188. $indicator.css({ "right": $tabs_width - (($index + 1) * $tab_width) });
  3189. $indicator.css({ "left": $index * $tab_width });
  3190. }
  3191. };
  3192. tabs.data("resize_listener", resizeListener);
  3193. $(window).on("resize", resizeListener);
  3194. }
  3195. $links.not($active).each(function () {
  3196. $(this.hash).removeClass("tab_control_visible").addClass("tab_control_not_visible");
  3197. });
  3198. var clickListener = $this.data("click_listener");
  3199. if (!clickListener) {
  3200. clickListener = function (e) {
  3201. if ($(this).parent().hasClass('disabled')) {
  3202. e.preventDefault();
  3203. return;
  3204. }
  3205. $tabs_width = $this.width();
  3206. $tab_width = $this.find('li').first().outerWidth();
  3207. $active.removeClass('active');
  3208. $content.removeClass("tab_control_visible").addClass("tab_control_not_visible");
  3209. $active = $(this);
  3210. $content = $(this.hash);
  3211. $links = $this.find('li.adore_tab a');
  3212. $active.addClass('active');
  3213. var $prev_index = $index;
  3214. $index = $links.index($(this));
  3215. if ($index < 0) {
  3216. $index = 0;
  3217. }
  3218. $content.removeClass("tab_control_not_visible").addClass("tab_control_visible");
  3219. if (($index - $prev_index) >= 0) {
  3220. $indicator.velocity({ "right": $tabs_width - (($index + 1) * $tab_width) }, {
  3221. duration: 300,
  3222. queue: false,
  3223. easing: 'easeOutQuad'
  3224. });
  3225. $indicator.velocity({ "left": $index * $tab_width }, {
  3226. duration: 300,
  3227. queue: false,
  3228. easing: 'easeOutQuad',
  3229. delay: 90
  3230. });
  3231. }
  3232. else {
  3233. $indicator.velocity({ "left": $index * $tab_width }, {
  3234. duration: 300,
  3235. queue: false,
  3236. easing: 'easeOutQuad'
  3237. });
  3238. $indicator.velocity({ "right": $tabs_width - (($index + 1) * $tab_width) }, {
  3239. duration: 300,
  3240. queue: false,
  3241. easing: 'easeOutQuad',
  3242. delay: 90
  3243. });
  3244. }
  3245. if ($index !== $prev_index) {
  3246. EventHub_7.EventHub.dispatchEvent(MessageType_8.MessageType.WIDGET, {
  3247. id: ownId,
  3248. selectedIndex: $index + "",
  3249. evtType: Event_5.Event.ON_CHANGE
  3250. });
  3251. }
  3252. e.preventDefault();
  3253. };
  3254. $this.data("click_listener", clickListener);
  3255. $this.on('click', 'a', clickListener);
  3256. }
  3257. });
  3258. };
  3259. TabUtil.tabsSwitch = function (tabs) {
  3260. this.init(tabs);
  3261. };
  3262. TabUtil.$tab_min_width = 60;
  3263. TabUtil.movingIconWidth = 70;
  3264. TabUtil.movingLeftIconWidth = 40;
  3265. TabUtil.totalWidthPrefix = 30;
  3266. return TabUtil;
  3267. }());
  3268. exports.TabUtil = TabUtil;
  3269. });
  3270. define("util/VisibilityChangeUtil", ["require", "exports"], function (require, exports) {
  3271. "use strict";
  3272. var VisibilityChangeUtil = (function () {
  3273. function VisibilityChangeUtil() {
  3274. }
  3275. VisibilityChangeUtil.findValue = function (id) {
  3276. for (var i = 0; i < VisibilityChangeUtil.visibilityListener.length; i++) {
  3277. if (VisibilityChangeUtil.visibilityListener[i].key === id) {
  3278. return VisibilityChangeUtil.visibilityListener[i];
  3279. }
  3280. }
  3281. return null;
  3282. };
  3283. VisibilityChangeUtil.refresh = function () {
  3284. if (VisibilityChangeUtil.visibilityRunning) {
  3285. if (VisibilityChangeUtil.visibilityListener.length === 0) {
  3286. VisibilityChangeUtil.visibilityRunning = false;
  3287. }
  3288. }
  3289. else {
  3290. if (VisibilityChangeUtil.visibilityListener.length !== 0) {
  3291. VisibilityChangeUtil.visibilityRunning = true;
  3292. setTimeout(VisibilityChangeUtil.handleVisibilityChanged, VisibilityChangeUtil.frequency);
  3293. }
  3294. }
  3295. };
  3296. VisibilityChangeUtil.handleVisibilityChanged = function () {
  3297. if (VisibilityChangeUtil.visibilityRunning) {
  3298. var copyVisibilityListener = VisibilityChangeUtil.visibilityListener.slice(0, VisibilityChangeUtil.visibilityListener.length);
  3299. for (var i = 0; i < copyVisibilityListener.length; i++) {
  3300. var oldVisible = copyVisibilityListener[i].visible;
  3301. var element = $("#" + copyVisibilityListener[i].key);
  3302. if (element.length === 0) {
  3303. VisibilityChangeUtil.removeVisibilityListener($("<div></div>").attr("id", copyVisibilityListener[i].key));
  3304. continue;
  3305. }
  3306. var visible = element.is(":visible");
  3307. if (visible !== oldVisible) {
  3308. copyVisibilityListener[i].visible = visible;
  3309. for (var j = 0; j < copyVisibilityListener[i].callbacks.length; j++) {
  3310. copyVisibilityListener[i].callbacks[j](visible);
  3311. }
  3312. }
  3313. }
  3314. setTimeout(VisibilityChangeUtil.handleVisibilityChanged, VisibilityChangeUtil.frequency);
  3315. }
  3316. };
  3317. VisibilityChangeUtil.addVisibilityListener = function (element, callback) {
  3318. var id = element.attr("id");
  3319. if (id) {
  3320. var value = VisibilityChangeUtil.findValue(id);
  3321. if (!value) {
  3322. VisibilityChangeUtil.visibilityListener.push({
  3323. key: id,
  3324. callbacks: [callback],
  3325. visible: element.is(":visible")
  3326. });
  3327. VisibilityChangeUtil.refresh();
  3328. }
  3329. else {
  3330. value.callbacks.push(callback);
  3331. }
  3332. }
  3333. };
  3334. VisibilityChangeUtil.removeVisibilityListener = function (element) {
  3335. var id = element.attr("id");
  3336. if (id) {
  3337. var value = VisibilityChangeUtil.findValue(id);
  3338. if (value) {
  3339. VisibilityChangeUtil.visibilityListener.splice(VisibilityChangeUtil.visibilityListener.indexOf(value), 1);
  3340. VisibilityChangeUtil.refresh();
  3341. }
  3342. }
  3343. };
  3344. VisibilityChangeUtil.visibilityListener = new Array();
  3345. VisibilityChangeUtil.visibilityRunning = false;
  3346. VisibilityChangeUtil.frequency = 400;
  3347. return VisibilityChangeUtil;
  3348. }());
  3349. exports.VisibilityChangeUtil = VisibilityChangeUtil;
  3350. });
  3351. define("widget/AdoreLoading", ["require", "exports"], function (require, exports) {
  3352. "use strict";
  3353. var AdoreLoading = (function () {
  3354. function AdoreLoading() {
  3355. }
  3356. AdoreLoading.show = function (args) {
  3357. var parentId = args.parentId;
  3358. var parentNode = $("#" + parentId);
  3359. if (parentNode.length === 0) {
  3360. return;
  3361. }
  3362. if (parentNode.children("div.adore-loading").length !== 0) {
  3363. return;
  3364. }
  3365. var $templateNode = $(AdoreLoading.Template);
  3366. $templateNode.attr("id", "AdoreLoading_" + parentId);
  3367. $templateNode.appendTo(parentNode);
  3368. $templateNode.height(parentNode[0].scrollHeight);
  3369. var p = this.getPosition(parentNode[0]);
  3370. var top = (parentNode.height() / 2 + p[0]).toFixed(0) + "px";
  3371. var left = (parentNode.width() / 2 + p[1]).toFixed(0) + "px";
  3372. $templateNode.find(".preloader-wrapper").css({ top: top, left: left });
  3373. $("#AdoreLoading_" + parentId).on("click keyup keydown mouseup mousedown", function (e) {
  3374. e.stopPropagation();
  3375. });
  3376. };
  3377. AdoreLoading.destroy = function (attrs) {
  3378. $("#" + attrs.parentId).children("div.adore-loading").remove();
  3379. };
  3380. AdoreLoading.getPosition = function (obj) {
  3381. var pos = [0, 0];
  3382. if (obj && obj.offsetParent) {
  3383. while (obj && obj.offsetParent) {
  3384. pos[0] += obj.offsetTop;
  3385. pos[1] += obj.offsetLeft;
  3386. obj = obj.offsetParent;
  3387. }
  3388. }
  3389. return pos;
  3390. };
  3391. AdoreLoading.Template = "\n <div class=\"adore-loading\">\n <div class=\"preloader-wrapper small active\">\n <div class=\"spinner-layer\">\n <div class=\"circle-clipper left\">\n <div class=\"circle\"></div>\n </div>\n <div class=\"gap-patch\">\n <div class=\"circle\"></div>\n </div>\n <div class=\"circle-clipper right\">\n <div class=\"circle\"></div>\n </div>\n </div>\n </div>\n </div>";
  3392. return AdoreLoading;
  3393. }());
  3394. exports.AdoreLoading = AdoreLoading;
  3395. });
  3396. define("widget/AdoreShell", ["require", "exports", "widget/Composite", "ADORE", "event/EventHub", "event/MessageType", "event/Event", "util/WidgetUtil"], function (require, exports, Composite_3, ADORE_3, EventHub_8, MessageType_9, Event_6, WidgetUtil_4) {
  3397. "use strict";
  3398. var AdoreShell = (function (_super) {
  3399. __extends(AdoreShell, _super);
  3400. function AdoreShell(parentId, id, style) {
  3401. _super.call(this, parentId, id, style);
  3402. this.$thisNode = $(AdoreShell.TemplateNormal).attr("id", this.id);
  3403. this.$attachNode = this.$thisNode.find("div.modal-content");
  3404. if ((this.style & ADORE_3.ADORE.Close) === ADORE_3.ADORE.Close) {
  3405. var own_2 = this;
  3406. var $cancleIconNode = $(AdoreShell.TemplateClose);
  3407. $cancleIconNode.appendTo(this.$thisNode.find("div.adore_shell_title"));
  3408. $cancleIconNode.bind("click", function () {
  3409. EventHub_8.EventHub.dispatchEvent(MessageType_9.MessageType.WIDGET, { "id": own_2.id, evtType: Event_6.Event.ON_CLOSE });
  3410. });
  3411. }
  3412. }
  3413. AdoreShell.prototype.setTitle = function (args) {
  3414. var text = args.title;
  3415. this.$thisNode.find("h4")[0].innerHTML = text;
  3416. };
  3417. AdoreShell.prototype.show = function () {
  3418. this.$thisNode.find(".adore_shell").css({
  3419. display: "block",
  3420. opacity: 0,
  3421. scaleX: "0.7"
  3422. });
  3423. this.$thisNode.find(".adore_shell").velocity({ opacity: 1, scaleX: "1" }, {
  3424. duration: 320,
  3425. queue: false,
  3426. ease: "easeOutCubic"
  3427. });
  3428. this.$thisNode.find(".myclass").css({
  3429. "width": this.$thisNode.find(".adore_shell").width(),
  3430. "height": this.$thisNode.find(".adore_shell").height(),
  3431. "left": this.$thisNode.find(".adore_shell").offset().left,
  3432. "top": this.$thisNode.find(".adore_shell").offset().top
  3433. });
  3434. if (this.cssStyle) {
  3435. this.$thisNode.find(".adore_shell").css(this.cssStyle);
  3436. this.cssStyle = null;
  3437. }
  3438. $(AdoreShell.TemplateOverlay).attr("id", this.id + "_overlay").appendTo(document.body);
  3439. WidgetUtil_4.WidgetUtil.refreshDialogZIndex(this.$thisNode.find(".adore_shell")[0]);
  3440. var width = this.$thisNode.find(".adore_shell").css("width");
  3441. var height = this.$thisNode.find(".adore_shell").css("height");
  3442. if ((width && width.indexOf("%") === -1) || (height && height.indexOf("%") === -1)) {
  3443. this.originWidth = width;
  3444. this.originHeight = height;
  3445. this.refreshSize();
  3446. var own_3 = this;
  3447. this.resizeListener = function (e) {
  3448. own_3.refreshSize();
  3449. };
  3450. $(window).on("resize", this.resizeListener);
  3451. }
  3452. if (height && height.indexOf("%") !== -1) {
  3453. height = height.replace(/%/, "");
  3454. if (height >= 90) {
  3455. this.$thisNode.find(".adore_shell").addClass("adore_shell_max_height");
  3456. }
  3457. }
  3458. };
  3459. AdoreShell.prototype.refreshSize = function () {
  3460. var css = {};
  3461. var totalW = window.innerWidth;
  3462. var totalH = window.innerHeight;
  3463. if (this.originWidth && this.originWidth.indexOf("%") === -1) {
  3464. var width = this.originWidth.replace(/px/g, "");
  3465. if (width >= totalW) {
  3466. css = $.extend(css, { width: "100%" });
  3467. }
  3468. else {
  3469. css = $.extend(css, { width: (width / (totalW * 0.01)) + "%" });
  3470. }
  3471. }
  3472. if (this.originHeight && this.originHeight.indexOf("%") === -1) {
  3473. var height = this.originHeight.replace(/px/g, "");
  3474. var hProportion = 0;
  3475. if (height >= totalH) {
  3476. hProportion = 100;
  3477. css = $.extend(css, { height: "100%" });
  3478. }
  3479. else {
  3480. hProportion = height / (totalH * 0.01);
  3481. css = $.extend(css, {
  3482. height: hProportion + "%"
  3483. });
  3484. }
  3485. if (hProportion >= 90) {
  3486. this.$thisNode.find(".adore_shell").addClass("adore_shell_max_height");
  3487. }
  3488. else {
  3489. this.$thisNode.find(".adore_shell").removeClass("adore_shell_max_height");
  3490. }
  3491. }
  3492. this.$thisNode.find(".adore_shell").css(css);
  3493. this.$thisNode.find(".myclass").css({
  3494. "width": this.$thisNode.find(".adore_shell").width(),
  3495. "height": this.$thisNode.find(".adore_shell").height(),
  3496. "left": this.$thisNode.find(".adore_shell").offset().left,
  3497. "top": this.$thisNode.find(".adore_shell").offset().top
  3498. });
  3499. };
  3500. AdoreShell.prototype.dispose = function () {
  3501. $("#" + this.id + "_overlay").remove();
  3502. if (this.resizeListener) {
  3503. $(window).off("resize", this.resizeListener);
  3504. }
  3505. _super.prototype.dispose.call(this);
  3506. };
  3507. AdoreShell.prototype.postLayout = function () {
  3508. _super.prototype.postLayout.call(this);
  3509. };
  3510. AdoreShell.TemplateNormal = "<div class=\"wrap_modal\"><iframe class=\"myclass\"></iframe>\n <div>\n <div class=\"modal modal-fixed-footer adore_shell\">\n <div class=\"adore_shell_title\">\n <h4 class=\"adore_shell_title_content\"></h4>\n </div>\n <div class=\"modal-content adore_shell_content\"></div>\n </div></div></div>";
  3511. AdoreShell.TemplateOverlay = "<div class=\"adore_lean_overlay\"></div>";
  3512. AdoreShell.TemplateClose = "<div class=\"adore_shell_exit_button waves-effect waves-light large mdi-content-clear\"></div>";
  3513. return AdoreShell;
  3514. }(Composite_3.Composite));
  3515. exports.AdoreShell = AdoreShell;
  3516. });
  3517. define("widget/Audio", ["require", "exports", "widget/Widget"], function (require, exports, Widget_5) {
  3518. "use strict";
  3519. var Audio = (function (_super) {
  3520. __extends(Audio, _super);
  3521. function Audio(parentId, id, style) {
  3522. _super.call(this, parentId, id, style);
  3523. this.$thisNode = $(Audio.Template).attr("id", this.id);
  3524. this.$audioNode = this.$thisNode.find("audio");
  3525. var audio = this.$audioNode.get(0);
  3526. var own = this;
  3527. audio.onended = function () {
  3528. own.$thisNode.remove();
  3529. };
  3530. }
  3531. Audio.prototype.setAudioPath = function (args) {
  3532. var src = args.src;
  3533. this.$audioNode.attr("src", src);
  3534. };
  3535. Audio.prototype.start = function () {
  3536. var audio = this.$audioNode.get(0);
  3537. if (audio.paused) {
  3538. audio.play();
  3539. }
  3540. };
  3541. Audio.prototype.stop = function () {
  3542. var audio = this.$audioNode.get(0);
  3543. if (!audio.paused) {
  3544. audio.pause();
  3545. audio.currentTime = 0;
  3546. }
  3547. };
  3548. Audio.prototype.layout = function () {
  3549. this.append();
  3550. };
  3551. Audio.Template = "<div><audio></audio></div>";
  3552. return Audio;
  3553. }(Widget_5.Widget));
  3554. exports.Audio = Audio;
  3555. });
  3556. define("widget/Button", ["require", "exports", "widget/Widget", "ADORE", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, Widget_6, ADORE_4, EventHub_9, MessageType_10, Event_7) {
  3557. "use strict";
  3558. var Button = (function (_super) {
  3559. __extends(Button, _super);
  3560. function Button(parentId, id, style) {
  3561. var _this = this;
  3562. _super.call(this, parentId, id, style);
  3563. this.isFloat = false;
  3564. this.isLarge = false;
  3565. if ((this.style & ADORE_4.ADORE.Float) === ADORE_4.ADORE.Float) {
  3566. this.$thisNode = $(Button.TemplateFloat).attr({ id: this.id });
  3567. this.$btnNode = this.$thisNode.find("a").attr({ id: this.id });
  3568. this.isFloat = true;
  3569. }
  3570. else if ((this.style & ADORE_4.ADORE.Flat) === ADORE_4.ADORE.Flat) {
  3571. this.$thisNode = $(Button.TemplateFlat).attr({ id: this.id });
  3572. this.$btnNode = this.$thisNode;
  3573. }
  3574. else if ((this.style & ADORE_4.ADORE.Normal) === ADORE_4.ADORE.Normal) {
  3575. this.$thisNode = $(Button.TemplateNormal).attr({ id: this.id });
  3576. this.$btnNode = this.$thisNode;
  3577. }
  3578. if ((this.style & ADORE_4.ADORE.Large) === ADORE_4.ADORE.Large) {
  3579. this.$btnNode.addClass("btn-large");
  3580. this.isLarge = true;
  3581. }
  3582. var own = this;
  3583. this.$btnNode.on("click", function (e) {
  3584. if (_this.enabled) {
  3585. EventHub_9.EventHub.dispatchEvent(MessageType_10.MessageType.WIDGET, { id: _this.id, evtType: Event_7.Event.CLICK });
  3586. }
  3587. }).on("focus", function (e) {
  3588. if (_this.enabled) {
  3589. _this.sendFocusGain();
  3590. }
  3591. });
  3592. }
  3593. Button.prototype.setFocus = function () {
  3594. if (document.activeElement !== this.$btnNode[0]) {
  3595. this.$btnNode.focus();
  3596. }
  3597. };
  3598. Button.prototype.setTooltip = function (args) {
  3599. this.tooltip = args.tooltip;
  3600. this.$thisNode.attr("data-tooltip", this.tooltip);
  3601. this.$thisNode.tooltip({ delay: 50 });
  3602. };
  3603. Button.prototype.setEnabled = function (args) {
  3604. _super.prototype.setEnabled.call(this, args);
  3605. if (this.enabled) {
  3606. this.$thisNode.removeClass("disabled");
  3607. }
  3608. else {
  3609. this.$thisNode.addClass("disabled");
  3610. }
  3611. };
  3612. Button.prototype.setText = function (args) {
  3613. this.text = args.text;
  3614. this.$btnNode.find("span").text(this.text);
  3615. this.adjustInternalLayout();
  3616. };
  3617. Button.prototype.setIcon = function (args) {
  3618. this.icon = args.icon;
  3619. this.$btnNode.find("i").attr("class", this.icon);
  3620. if (this.isLarge) {
  3621. this.$btnNode.find("i").css("font-size", "3rem");
  3622. }
  3623. this.adjustInternalLayout();
  3624. };
  3625. Button.prototype.adjustInternalLayout = function () {
  3626. if (this.icon && this.text) {
  3627. this.$btnNode.find("span").addClass("adore_button_span");
  3628. this.$btnNode.find("i").addClass("adore_button_icon");
  3629. }
  3630. else {
  3631. this.$btnNode.find("span").removeClass("adore_button_span");
  3632. this.$btnNode.find("i").removeClass("adore_button_icon");
  3633. }
  3634. };
  3635. Button.prototype.postLayout = function () {
  3636. window.Waves.displayEffect({ id: this.id });
  3637. };
  3638. Button.prototype.css = function (args) {
  3639. if (this.isFloat) {
  3640. this.$btnNode.css(args.cssStyle);
  3641. }
  3642. else {
  3643. _super.prototype.css.call(this, args);
  3644. }
  3645. };
  3646. Button.prototype.refreshToolbar = function (children) {
  3647. children.postLayout();
  3648. var childCls = children.$btnNode[1].className
  3649. .replace("waves-effect btn-flat adore_button adore_button_flat btn-large", "");
  3650. children.$btnNode.removeClass(childCls).addClass("adore_toolbar_color");
  3651. };
  3652. Button.TemplateNormal = "\n <div class=\"waves-effect waves-light btn adore_button\" tabindex=\"-1\" data-position=\"top\" data-delay=\"50\">\n <span></span>\n <i></i>\n </div>";
  3653. Button.TemplateFloat = "\n <div>\n <a class=\"btn-floating waves-effect waves-light adore_button\" tabindex=\"-1\" data-position=\"top\" data-delay=\"50\"><span></span><i></i></a>\n </div>";
  3654. Button.TemplateFlat = "<a class=\"waves-effect btn-flat adore_button adore_button_flat\" tabindex=\"-1\" data-position=\"top\" data-delay=\"50\"><i></i><span></span></a>";
  3655. return Button;
  3656. }(Widget_6.Widget));
  3657. exports.Button = Button;
  3658. });
  3659. define("widget/CalendarCombo", ["require", "exports", "widget/Widget", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, Widget_7, EventHub_10, MessageType_11, Event_8) {
  3660. "use strict";
  3661. var CalendarCombo = (function (_super) {
  3662. __extends(CalendarCombo, _super);
  3663. function CalendarCombo(parentId, id, style) {
  3664. _super.call(this, parentId, id, style);
  3665. this.defaultPattern = "yyyymmmmdd";
  3666. this.$thisNode = $(CalendarCombo.template).attr("id", this.id);
  3667. this.$dateNode = this.$thisNode.find("input");
  3668. this.dateElement = this.$dateNode.get(0);
  3669. var own = this;
  3670. this.dateElement.readOnly = true;
  3671. this.$dateNode.on("change", function (e) {
  3672. own.handleInput();
  3673. });
  3674. this.$dateNode.on("focus", function (e) {
  3675. if (!own.isHadFocusGain()) {
  3676. own.setHadFocusGain(true);
  3677. own.sendFocusGain();
  3678. }
  3679. else {
  3680. e.preventDefault();
  3681. }
  3682. own.handleFocus();
  3683. });
  3684. this.$thisNode.on("blur", function (e) {
  3685. own.setHadFocusGain(false);
  3686. own.handleBlur();
  3687. });
  3688. this.$dateNode.attr("id", this.id + "_date");
  3689. this.$thisNode.find("label").attr("for", this.id + "_date");
  3690. this.hadFocusGain = false;
  3691. this.isLayout = false;
  3692. this.enabled = true;
  3693. this.hadCloseDatePicker = true;
  3694. this.pattern = this.defaultPattern;
  3695. }
  3696. CalendarCombo.prototype.handleInput = function () {
  3697. var date;
  3698. var charNum;
  3699. var charIndexOfMonthIcon;
  3700. charIndexOfMonthIcon = this.dateElement.value.indexOf("月");
  3701. date = this.dateElement.value.replace("月", "");
  3702. charNum = date.length;
  3703. if (charNum % 2 === 1) {
  3704. var leftPartOfDate = date.slice(0, charIndexOfMonthIcon - 1);
  3705. var rightPartOfDate = date.slice(charIndexOfMonthIcon - 1);
  3706. date = leftPartOfDate + "0" + rightPartOfDate;
  3707. }
  3708. this.setText({ text: date });
  3709. EventHub_10.EventHub.dispatchEvent(MessageType_11.MessageType.WIDGET, {
  3710. id: this.id,
  3711. text: date,
  3712. evtType: Event_8.Event.MODIFY,
  3713. syncAttrName: "text"
  3714. });
  3715. };
  3716. CalendarCombo.prototype.postLayout = function () {
  3717. var tmp = this.pattern;
  3718. this.$dateNode.pickadate({
  3719. selectMonths: true,
  3720. selectYears: 30,
  3721. format: tmp,
  3722. monthsFull: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"],
  3723. monthsShort: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
  3724. weekdaysFull: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"],
  3725. today: "今天",
  3726. clear: "清除",
  3727. close: "关闭"
  3728. });
  3729. this.isLayout = true;
  3730. this.setText({ text: this.text });
  3731. var own = this;
  3732. this.$dateNode.on("close", function () {
  3733. own.handleFocus();
  3734. own.handleClose();
  3735. own.setHadFocusGain(true);
  3736. });
  3737. this.$dateNode.on("open", function () {
  3738. own.handleOpen();
  3739. own.setHadFocusGain(true);
  3740. });
  3741. };
  3742. CalendarCombo.prototype.isHadFocusGain = function () {
  3743. return this.hadFocusGain;
  3744. };
  3745. CalendarCombo.prototype.setHadFocusGain = function (hadFocusGain) {
  3746. this.hadFocusGain = hadFocusGain;
  3747. };
  3748. CalendarCombo.prototype.handleFocus = function () {
  3749. this.$dateNode.addClass("adore_calendar_combo_focus");
  3750. this.$dateNode.siblings("label").addClass("adore_calendar_combo_label_focus");
  3751. this.$dateNode.siblings("label, i").addClass("active");
  3752. this.$thisNode.focus();
  3753. this.setText({ text: this.text });
  3754. };
  3755. CalendarCombo.prototype.handleClose = function () {
  3756. this.hadCloseDatePicker = true;
  3757. };
  3758. CalendarCombo.prototype.handleOpen = function () {
  3759. this.hadCloseDatePicker = false;
  3760. };
  3761. CalendarCombo.prototype.handleBlur = function () {
  3762. this.$dateNode.removeClass("adore_calendar_combo_focus");
  3763. this.$dateNode.siblings("label").removeClass("adore_calendar_combo_label_focus");
  3764. var val = this.$dateNode.val();
  3765. this.setText({ text: val });
  3766. };
  3767. CalendarCombo.prototype.setText = function (args) {
  3768. this.text = args.text;
  3769. if (this.isLayout) {
  3770. this.dateElement.value = this.text;
  3771. if (this.text && this.text.length > 0) {
  3772. this.$dateNode.siblings("label,i").addClass("active");
  3773. }
  3774. else {
  3775. this.$dateNode.siblings("label, i").removeClass("active");
  3776. }
  3777. }
  3778. if (this.requisite) {
  3779. if (args.text === null || args.text === "") {
  3780. this.addRequisite();
  3781. }
  3782. else {
  3783. this.removeRequisite();
  3784. }
  3785. }
  3786. };
  3787. CalendarCombo.prototype.setRequisite = function (args) {
  3788. this.requisite = args.requisite;
  3789. var tempText = this.text;
  3790. this.setText({ text: tempText });
  3791. };
  3792. CalendarCombo.prototype.setIcon = function (args) {
  3793. this.$thisNode.find("i").attr("class", args.icon);
  3794. };
  3795. CalendarCombo.prototype.setName = function (args) {
  3796. this.$thisNode.find("label").text(args.name);
  3797. };
  3798. CalendarCombo.prototype.setEnabled = function (args) {
  3799. this.enabled = args.enabled;
  3800. if (this.enabled) {
  3801. this.$thisNode.find("input").removeAttr("disabled");
  3802. this.$thisNode.find("i").removeClass("icon_disabled");
  3803. this.$thisNode.find("label").removeClass("adore_calendar_combo_label_disable");
  3804. }
  3805. else {
  3806. this.$thisNode.find("input").attr("disabled", "disabled");
  3807. this.$thisNode.find("i").addClass("icon_disabled");
  3808. this.$thisNode.find("label").addClass("adore_calendar_combo_label_disable");
  3809. }
  3810. };
  3811. CalendarCombo.prototype.setPattern = function (args) {
  3812. this.pattern = args.pattern;
  3813. this.pattern = this.pattern.replace("MM", "mmmm");
  3814. if (this.pattern.length !== 12 && this.pattern.length !== 10) {
  3815. this.pattern = this.defaultPattern;
  3816. }
  3817. else if (this.pattern.replace("yyyy", "").replace("mmmm", "").replace("dd", "").length !== 0 &&
  3818. this.pattern.replace("yyyy", "").replace("mmmm", "").replace("dd", "").length !== 2) {
  3819. this.pattern = this.defaultPattern;
  3820. }
  3821. var tmp = this.pattern;
  3822. if (this.isLayout) {
  3823. this.$dateNode.pickadate({
  3824. format: tmp
  3825. });
  3826. }
  3827. };
  3828. CalendarCombo.prototype.setFocus = function () {
  3829. if (this.hadFocusGain) {
  3830. return;
  3831. }
  3832. if (this.hadCloseDatePicker && document.activeElement !== this.$dateNode[0]) {
  3833. this.$dateNode.focus();
  3834. }
  3835. };
  3836. CalendarCombo.prototype.handleKeyDownEvent = function (e, hasFilter) {
  3837. if (this.hadCloseDatePicker) {
  3838. _super.prototype.handleKeyDownEvent.call(this, e, hasFilter);
  3839. }
  3840. };
  3841. CalendarCombo.prototype.handleKeyUpEvent = function (e) {
  3842. if (this.hadCloseDatePicker) {
  3843. _super.prototype.handleKeyUpEvent.call(this, e);
  3844. }
  3845. };
  3846. CalendarCombo.prototype.addRequisite = function () {
  3847. if (this.enabled) {
  3848. this.$dateNode.addClass("adore_InputRequisite");
  3849. this.$dateNode.siblings("label").addClass("adore_requisiteColor");
  3850. this.$dateNode.siblings("i").addClass("adore_requisiteColor");
  3851. this.$dateNode.removeClass("adore_calendar_combo_focus");
  3852. this.$dateNode.siblings("label").removeClass("adore_calendar_combo_label_focus");
  3853. }
  3854. };
  3855. CalendarCombo.prototype.removeRequisite = function () {
  3856. this.$dateNode.removeClass("adore_InputRequisite");
  3857. this.$dateNode.siblings("label").removeClass("adore_requisiteColor");
  3858. this.$dateNode.siblings("i").removeClass("adore_requisiteColor");
  3859. if (this.enabled && this.hadFocusGain) {
  3860. this.$dateNode.addClass("adore_calendar_combo_focus");
  3861. this.$dateNode.siblings("label").addClass("adore_calendar_combo_label_focus");
  3862. }
  3863. };
  3864. CalendarCombo.template = "\n <div class=\"input-field adore_calendar_combo\" tabIndex=\"-1\">\n <i></i>\n <input type=\"date\" class=\"datepicker\" tabIndex=\"-1\">\n <label></label>\n </div>\n ";
  3865. return CalendarCombo;
  3866. }(Widget_7.Widget));
  3867. exports.CalendarCombo = CalendarCombo;
  3868. });
  3869. define("widget/cef/ACefNativeWindow", ["require", "exports", "widget/Widget"], function (require, exports, Widget_8) {
  3870. "use strict";
  3871. var ACefNativeWindow = (function (_super) {
  3872. __extends(ACefNativeWindow, _super);
  3873. function ACefNativeWindow(parentId, id, style) {
  3874. _super.call(this, parentId, id, style);
  3875. this.hadWindowHandle = false;
  3876. this.$thisNode = $(ACefNativeWindow.Template).attr({ id: this.id });
  3877. this.$plugin = this.$thisNode.find("embed");
  3878. }
  3879. ACefNativeWindow.prototype.setHandle = function (args) {
  3880. this.windowHandle = args.handle;
  3881. if ($("#" + this.id).length !== 0) {
  3882. if (this.windowHandle === 0 || this.windowHandle) {
  3883. try {
  3884. this.$plugin[0].setHandle(this.windowHandle);
  3885. this.hadWindowHandle = true;
  3886. }
  3887. catch (e) {
  3888. console.error(e);
  3889. }
  3890. }
  3891. }
  3892. };
  3893. ACefNativeWindow.prototype.postLayout = function () {
  3894. _super.prototype.postLayout.call(this);
  3895. if ((this.windowHandle === 0 || this.windowHandle) && !this.hadWindowHandle) {
  3896. if ($("#" + this.id).length !== 0) {
  3897. setTimeout(this.setHandle({ handle: this.windowHandle }), 300);
  3898. }
  3899. else {
  3900. var count_1 = 0;
  3901. var own_4 = this;
  3902. var func_1 = function () {
  3903. if ($("#" + own_4.id).length !== 0) {
  3904. own_4.setHandle({ handle: own_4.windowHandle });
  3905. }
  3906. else {
  3907. count_1++;
  3908. if (count_1 < 5) {
  3909. setTimeout(func_1(), 500);
  3910. }
  3911. }
  3912. };
  3913. setTimeout(func_1, 300);
  3914. }
  3915. }
  3916. };
  3917. ACefNativeWindow.Template = "\n <div>\n <embed width=\"100%\" height=\"100%\" type=\"application/x-nativewindow\"></embed>\n </div>";
  3918. return ACefNativeWindow;
  3919. }(Widget_8.Widget));
  3920. exports.ACefNativeWindow = ACefNativeWindow;
  3921. });
  3922. define("widget/CheckButton", ["require", "exports", "widget/Widget", "ADORE", "event/EventHub", "event/MessageType", "event/Event", "hotkey/Keys"], function (require, exports, Widget_9, ADORE_5, EventHub_11, MessageType_12, Event_9, Keys_5) {
  3923. "use strict";
  3924. var CheckButton = (function (_super) {
  3925. __extends(CheckButton, _super);
  3926. function CheckButton(parentId, id, style) {
  3927. _super.call(this, parentId, id, style);
  3928. this.isSwitch = false;
  3929. if ((ADORE_5.ADORE.Switch & style) === ADORE_5.ADORE.Switch) {
  3930. this.$thisNode = $(CheckButton.template1).attr("id", this.id);
  3931. this.isSwitch = true;
  3932. }
  3933. else {
  3934. this.$thisNode = $(CheckButton.template0).attr("id", this.id);
  3935. }
  3936. var tmpId = this.id;
  3937. this.$thisNode.find("input[type=checkbox]").attr("id", this.id + "_checkbox").on("change", function (e) {
  3938. EventHub_11.EventHub.dispatchEvent(MessageType_12.MessageType.WIDGET, {
  3939. id: tmpId,
  3940. checked: this.checked + "",
  3941. evtType: Event_9.Event.ON_CHANGE,
  3942. syncAttrName: this.checked
  3943. });
  3944. });
  3945. if (this.isSwitch === false) {
  3946. this.$thisNode.find("label").attr("for", this.id + "_checkbox");
  3947. }
  3948. var own = this;
  3949. this.$thisNode.find("input").on("focus", function (e) {
  3950. own.sendFocusGain();
  3951. }).on("blur", function (e) {
  3952. own.handleBlur();
  3953. });
  3954. }
  3955. CheckButton.prototype.setName = function (args) {
  3956. if (this.isSwitch === false) {
  3957. this.$thisNode.find("label").text(args.name);
  3958. }
  3959. };
  3960. CheckButton.prototype.setGroupName = function (args) {
  3961. this.groupName = args.group;
  3962. this.$thisNode.find("input").attr("name", this.groupName);
  3963. };
  3964. CheckButton.prototype.setChecked = function (args) {
  3965. var isChecked = args.isChecked;
  3966. var checked = this.$thisNode.find("input")[0].checked;
  3967. if (isChecked !== checked) {
  3968. if (this.enabled === false) {
  3969. this.$thisNode.find("input").removeAttr("disabled");
  3970. this.$thisNode.find("input").click();
  3971. this.$thisNode.find("input").attr("disabled", "disabled");
  3972. }
  3973. else {
  3974. this.$thisNode.find("input").click();
  3975. }
  3976. }
  3977. };
  3978. CheckButton.prototype.setEnabled = function (args) {
  3979. this.enabled = args.enabled;
  3980. if (this.enabled) {
  3981. this.$thisNode.find("input").removeAttr("disabled");
  3982. }
  3983. else {
  3984. this.$thisNode.find("input").attr("disabled", "disabled");
  3985. }
  3986. };
  3987. CheckButton.prototype.handleBlur = function () {
  3988. this.$thisNode.find("label").removeClass("adore_check_button_focus_label");
  3989. };
  3990. CheckButton.prototype.setFocus = function () {
  3991. var inputNode = this.$thisNode.find("input");
  3992. if (document.activeElement !== inputNode[0]) {
  3993. inputNode.focus();
  3994. }
  3995. this.$thisNode.find("label").addClass("adore_check_button_focus_label");
  3996. };
  3997. CheckButton.prototype.handleKeyDownEvent = function (e, hasFilter) {
  3998. if (e.keyCode === Keys_5.Keys.SPACE || e.keyCode === Keys_5.Keys.ENTER || e.keyCode === Keys_5.Keys.NUMPAD_ENTER) {
  3999. this.$thisNode.find("input").click();
  4000. e.preventDefault();
  4001. return;
  4002. }
  4003. _super.prototype.handleKeyDownEvent.call(this, e, hasFilter);
  4004. };
  4005. CheckButton.prototype.handleKeyUpEvent = function (e) {
  4006. if (e.keyCode === Keys_5.Keys.SPACE || e.keyCode === Keys_5.Keys.ENTER || e.keyCode === Keys_5.Keys.NUMPAD_ENTER) {
  4007. return;
  4008. }
  4009. _super.prototype.handleKeyUpEvent.call(this, e);
  4010. };
  4011. CheckButton.template0 = "<div class=\"adore_check_button\">\n <input type=\"checkbox\" tabindex=\"-1\"/>\n <label></label>\n </div>";
  4012. CheckButton.template1 = "<div class=\"switch\">\n <label>\n <input type=\"checkbox\" tabindex=\"-1\">\n <span class=\"lever\"></span>\n </label>\n </div>";
  4013. return CheckButton;
  4014. }(Widget_9.Widget));
  4015. exports.CheckButton = CheckButton;
  4016. });
  4017. define("widget/Clock", ["require", "exports", "widget/Widget", "ADORE"], function (require, exports, Widget_10, ADORE_6) {
  4018. "use strict";
  4019. var Clock = (function (_super) {
  4020. __extends(Clock, _super);
  4021. function Clock(parentId, id, style) {
  4022. _super.call(this, parentId, id, style);
  4023. this.clockHeight = 300;
  4024. this.DefaultClockSideLengthGS = 300;
  4025. if (style === ADORE_6.ADORE.Normal) {
  4026. this.$thisNode = $(Clock.ClockTemplateLS).attr({ id: this.id });
  4027. this.$clockNode = this.$thisNode.find("nobr");
  4028. this.setFontSize = this.setFontSizeLS;
  4029. this.setAlignment = this.setAlignmentLS;
  4030. this.startRedrawClock = this.startRedrawClockLS;
  4031. this.setClockHeight = function (args) { };
  4032. this.startRedrawClock();
  4033. }
  4034. else if ((style & ADORE_6.ADORE.Graphics) === ADORE_6.ADORE.Graphics) {
  4035. this.$thisNode = $(Clock.ClockTemplateGS).attr({ id: this.id });
  4036. this.setFontSize = function (args) { };
  4037. this.setAlignment = function (args) { };
  4038. this.startRedrawClock = function () { };
  4039. this.setClockHeight = this.setClockHeightGS;
  4040. }
  4041. this.dispose = this.disposeClock;
  4042. }
  4043. Clock.prototype.setFontSizeLS = function (args) {
  4044. this.$clockNode.css({ fontSize: args.fontSize });
  4045. };
  4046. Clock.prototype.setAlignmentLS = function (args) {
  4047. this.$clockNode.css({ textAlign: args.alignment });
  4048. };
  4049. Clock.prototype.startRedrawClockLS = function () {
  4050. var own = this;
  4051. this.intervalId = setInterval(function () { own.redrawClockOnceLS(own); }, 1000);
  4052. };
  4053. Clock.prototype.redrawClockOnceLS = function (own) {
  4054. var currentDate = new Date();
  4055. var clockText;
  4056. clockText = currentDate.getFullYear() + "-" + (+currentDate.getMonth() + 1) + "-" + currentDate.getDate() + " " + currentDate.getHours() + ":" + currentDate.getMinutes() + ":" + currentDate.getSeconds();
  4057. own.$clockNode.get(0).innerHTML = clockText;
  4058. };
  4059. Clock.prototype.createClockPanelGS = function () {
  4060. var mainGS = this.$thisNode.find(".clock-GS-main");
  4061. var bodyGS = this.$thisNode.find(".clock-GS-body");
  4062. var panelGS = this.$thisNode.find(".clock-GS-panel");
  4063. var own = this;
  4064. this.$thisNode.css("height", this.clockHeight + "px");
  4065. var shortSideLength = Math.min(this.$thisNode.get(0).clientWidth, this.$thisNode.get(0).clientHeight);
  4066. mainGS.css({ width: this.DefaultClockSideLengthGS + "px", height: this.DefaultClockSideLengthGS + "px" });
  4067. mainGS.css("transform", "scale(" + (shortSideLength / this.DefaultClockSideLengthGS) + ")");
  4068. var createMinuteLine = function (angle) {
  4069. var anchor = $("<div>").add("clock-GS-anchor");
  4070. var minuteLine = $("<div>").addClass("clock-GS-minuteLine");
  4071. var radius = own.DefaultClockSideLengthGS / 2 * 0.8;
  4072. anchor.css("transform", "rotate(" + angle + "deg)");
  4073. minuteLine.css("transform", "translate(-50%,-100%) translateY(-" + radius + "px)");
  4074. anchor.append(minuteLine);
  4075. panelGS.append(anchor);
  4076. };
  4077. var createMinuteText = function (angle) {
  4078. var minuteText = $("<div>").addClass("clock-GS-minuteText");
  4079. var radius = own.DefaultClockSideLengthGS / 2 * 0.84;
  4080. var topOffset = 0 - Math.cos(angle * Math.PI / 180) * radius;
  4081. var leftOffset = Math.sin(angle * Math.PI / 180) * radius;
  4082. minuteText.get(0).innerHTML = "" + angle / 6;
  4083. minuteText.css({ top: topOffset + "px", left: leftOffset + "px" });
  4084. panelGS.append(minuteText);
  4085. };
  4086. var createHourText = function (angle) {
  4087. var hourText = $("<div>").addClass("clock-GS-hourText clock-GS-hour" + angle / 30);
  4088. var radius = own.DefaultClockSideLengthGS / 2 * 0.65;
  4089. var topOffset = 0 - Math.cos(angle * Math.PI / 180) * radius;
  4090. var leftOffset = Math.sin(angle * Math.PI / 180) * radius;
  4091. hourText.get(0).innerHTML = "" + angle / 30;
  4092. hourText.css({ top: topOffset + "px", left: leftOffset + "px" });
  4093. panelGS.append(hourText);
  4094. };
  4095. for (var angle = 1; angle <= 360; angle++) {
  4096. if (angle % 6 === 0) {
  4097. if (angle % 30 === 0) {
  4098. createMinuteText(angle);
  4099. createHourText(angle);
  4100. }
  4101. else {
  4102. createMinuteLine(angle);
  4103. }
  4104. }
  4105. }
  4106. };
  4107. Clock.prototype.createClockAnchorGS = function () {
  4108. var hourAnchor = this.$thisNode.find(".clock-GS-hour-anchor");
  4109. var minuterAnchor = this.$thisNode.find(".clock-GS-minute-anchor");
  4110. var secondAnchor = this.$thisNode.find(".clock-GS-second-anchor");
  4111. var now = new Date();
  4112. var seconds = (now.getHours() >= 12 ? now.getHours() - 12 : now.getHours()) * 3600 + now.getMinutes() * 60 + now.getSeconds();
  4113. var hourRotateAngle = seconds / 120;
  4114. var minuteRotateAngle = (seconds / 10) % 360;
  4115. var secondRotateAngle = (seconds * 6) % 360;
  4116. hourAnchor.css("transform", "rotate(" + hourRotateAngle + "deg)");
  4117. minuterAnchor.css("transform", "rotate(" + minuteRotateAngle + "deg)");
  4118. secondAnchor.css("transform", "rotate(" + secondRotateAngle + "deg)");
  4119. };
  4120. Clock.prototype.setClockHeightGS = function (args) {
  4121. this.clockHeight = args.height;
  4122. this.$thisNode.css("height", this.clockHeight + "px");
  4123. var shortSideLength = Math.min(this.$thisNode.get(0).clientWidth, this.$thisNode.get(0).clientHeight);
  4124. if (shortSideLength !== 0) {
  4125. this.$thisNode.find(".clock-GS-panel").css("transform", "scale(" + shortSideLength / this.DefaultClockSideLengthGS + ")");
  4126. }
  4127. };
  4128. Clock.prototype.postLayout = function () {
  4129. this.createClockPanelGS();
  4130. this.createClockAnchorGS();
  4131. };
  4132. Clock.prototype.disposeClock = function () {
  4133. if (this.intervalId) {
  4134. clearInterval(this.intervalId);
  4135. }
  4136. _super.prototype.dispose.call(this);
  4137. };
  4138. Clock.ClockTemplateLS = "\n <div style=\"display: flex;align-items: center;justify-content: center;width: 100%\">\n <nobr class=\"adore_label\" style=\"width:100%\"></nobr>\n </div>\n ";
  4139. Clock.ClockTemplateGS = "\n <div style=\"display: flex;align-items: center;justify-content: center;width: 100%\">\n <div class=\"clock-GS-main\">\n <div class=\"clock-GS-body\">\n <div class=\"clock-GS-panel\"></div>\n <div class=\"clock-GS-hour-anchor\">\n <div class=\"clock-GS-hour-rotate\">\n <div class=\"clock-GS-hour-thinhand\"></div>\n <div class=\"clock-GS-hour-fathand\"></div>\n </div>\n </div>\n <div class=\"clock-GS-minute-anchor\">\n <div class=\"clock-GS-minute-rotate\">\n <div class=\"clock-GS-minute-thinhand\"></div>\n <div class=\"clock-GS-minute-fathand\"></div>\n </div>\n </div>\n <div class=\"clock-GS-second-anchor\">\n <div class=\"clock-GS-second-rotate\">\n <div class=\"clock-GS-second-hand\"></div>\n </div>\n </div>\n </div>\n </div>\n </div>\n ";
  4140. return Clock;
  4141. }(Widget_10.Widget));
  4142. exports.Clock = Clock;
  4143. });
  4144. define("widget/DateText", ["require", "exports", "widget/Widget", "widget/validator/MaxLengthValidator", "event/EventHub", "event/MessageType", "event/Event", "util/SoftwareKeyboardUtil", "hotkey/Keys"], function (require, exports, Widget_11, MaxLengthValidator_2, EventHub_12, MessageType_13, Event_10, SoftwareKeyboardUtil_2, Keys_6) {
  4145. "use strict";
  4146. var DateText = (function (_super) {
  4147. __extends(DateText, _super);
  4148. function DateText(parentId, id, style) {
  4149. _super.call(this, parentId, id, style);
  4150. this.$thisNode = $(DateText.TemplateCotainer).attr({ id: this.id + "_containerNode" });
  4151. var own = this;
  4152. this.maxLength = 8;
  4153. this.$thisNode.find("input").attr("id", this.id).on("input", function (e) {
  4154. own.handleOnInput();
  4155. EventHub_12.EventHub.dispatchEvent(MessageType_13.MessageType.WIDGET, {
  4156. id: id,
  4157. text: $(this).val(),
  4158. evtType: Event_10.Event.MODIFY,
  4159. syncAttrName: "text"
  4160. });
  4161. }).on('focus', function () {
  4162. own.sendFocusGain();
  4163. SoftwareKeyboardUtil_2.SoftwareKeyboardUtil.refresh();
  4164. }).on('blur', function () {
  4165. own.checkRequisite();
  4166. own.handleOnBlur();
  4167. });
  4168. }
  4169. DateText.prototype.handleOnInput = function () {
  4170. this.maxLengthValidator.handleModifyEvent();
  4171. this.checkRequisite();
  4172. if (!this.format) {
  4173. this.format = "yyyy-MM-dd";
  4174. }
  4175. var content = this.$thisNode.find("input").val();
  4176. if (content.length === 8) {
  4177. var year = content.substr(0, 4);
  4178. var month = content.substr(4, 2);
  4179. var day = content.substr(6, 2);
  4180. var date = new Date(year + "," + month + "," + day);
  4181. if (date.toString().indexOf("Invalid") === -1) {
  4182. var format_date = this.format;
  4183. format_date = format_date.replace(/yyyy/, year).replace(/MM/, month).replace(/dd/, day);
  4184. this.$thisNode.find("input").val(format_date);
  4185. this.maxLengthValidator.setMaxLength(this.format.length);
  4186. }
  4187. }
  4188. };
  4189. DateText.prototype.handleOnBlur = function () {
  4190. var $inputNode = this.$thisNode.find("input");
  4191. if (!this.format) {
  4192. this.format = "yyyy-MM-dd";
  4193. }
  4194. var content = $inputNode.val();
  4195. if (content !== null) {
  4196. if (content === "19000101" || content === "") {
  4197. return;
  4198. }
  4199. else if (content.length >= 8) {
  4200. var year = void 0, month = void 0, day = void 0;
  4201. if (content.indexOf("-") !== -1) {
  4202. var dateArray1 = content.split("-");
  4203. year = dateArray1[0];
  4204. month = dateArray1[1];
  4205. day = dateArray1[2];
  4206. }
  4207. else if (content.indexOf("/") !== -1) {
  4208. var dateArray2 = content.split("/");
  4209. year = dateArray2[0];
  4210. month = dateArray2[1];
  4211. day = dateArray2[2];
  4212. }
  4213. else if (content.indexOf(".") === -1) {
  4214. year = content.substr(0, 4);
  4215. month = content.substr(4, 2);
  4216. day = content.substr(6, 2);
  4217. }
  4218. var date = new Date(year + "," + month + "," + day);
  4219. if (year !== "" && month !== "" && day !== "" && date.toString().indexOf("Invalid") === -1) {
  4220. var format_date = this.format;
  4221. format_date = format_date.replace(/yyyy/, year).replace(/MM/, month).replace(/dd/, day);
  4222. $inputNode.val(format_date);
  4223. return;
  4224. }
  4225. }
  4226. }
  4227. this.showSpan("输入有误,请重新输入!");
  4228. this.$thisNode.find("input").focus();
  4229. };
  4230. DateText.prototype.checkRequisite = function () {
  4231. if (this.requisite) {
  4232. var inputSelector = this.$thisNode.find("input");
  4233. var value = inputSelector.val();
  4234. if (value) {
  4235. this.removeRequisite();
  4236. }
  4237. else {
  4238. this.addRequisite();
  4239. this.showSpan("请输入数据!");
  4240. }
  4241. }
  4242. };
  4243. DateText.prototype.setRequisite = function (args) {
  4244. this.requisite = args.requisite;
  4245. if (this.requisite) {
  4246. if (this.$thisNode.find("input").val()) {
  4247. this.removeRequisite();
  4248. }
  4249. else {
  4250. this.addRequisite();
  4251. }
  4252. }
  4253. };
  4254. DateText.prototype.setEnabled = function (args) {
  4255. var enabled = args.enabled;
  4256. var input = this.$thisNode.find("input");
  4257. if (enabled) {
  4258. input.removeAttr("disabled");
  4259. this.$thisNode.find("i").removeClass("icon_disabled");
  4260. if (this.requisite) {
  4261. if (input.val() === null || input.val() === "") {
  4262. this.addRequisite();
  4263. }
  4264. }
  4265. }
  4266. else {
  4267. this.$thisNode.find("input").attr("disabled", "disabled");
  4268. if (this.requisite) {
  4269. this.removeRequisite();
  4270. }
  4271. this.$thisNode.find("i").addClass("icon_disabled");
  4272. }
  4273. };
  4274. DateText.prototype.addRequisite = function () {
  4275. this.$thisNode.find("input").addClass("adore_InputRequisite");
  4276. this.$thisNode.find("label").addClass("adore_requisiteColor");
  4277. this.$thisNode.find("i").addClass("adore_requisiteColor");
  4278. };
  4279. DateText.prototype.removeRequisite = function () {
  4280. this.$thisNode.find("input").removeClass("adore_InputRequisite");
  4281. this.$thisNode.find("label").removeClass("adore_requisiteColor");
  4282. this.$thisNode.find("i").removeClass("adore_requisiteColor");
  4283. };
  4284. DateText.prototype.handleKeyDownEvent = function (e, hasFilter) {
  4285. if (e.keyCode !== Keys_6.Keys.SHIFT && e.keyCode !== Keys_6.Keys.TAB
  4286. && e.keyCode !== Keys_6.Keys.ENTER && e.keyCode !== Keys_6.Keys.LEFT_ARROW
  4287. && e.keyCode !== Keys_6.Keys.UP_ARROW && e.keyCode !== Keys_6.Keys.RIGHT_ARROW
  4288. && e.keyCode !== Keys_6.Keys.DOWN_ARROW && e.keyCode !== Keys_6.Keys.BACKSPACE && (e.keyCode < Keys_6.Keys.NUM_0 || e.keyCode > Keys_6.Keys.NUM_9)
  4289. && (e.keyCode < Keys_6.Keys.NUMPAD_0 || e.keyCode > Keys_6.Keys.NUMPAD_9)) {
  4290. e.preventDefault();
  4291. }
  4292. var value = this.$thisNode.find("input").val();
  4293. if (value.length > 8 && e.keyCode === Keys_6.Keys.BACKSPACE) {
  4294. value = value.replace(/-/g, "").replace(/\//g, "");
  4295. this.$thisNode.find("input").val(value);
  4296. this.maxLengthValidator.setMaxLength(this.maxLength);
  4297. }
  4298. _super.prototype.handleKeyDownEvent.call(this, e, hasFilter);
  4299. };
  4300. DateText.prototype.setMaxLength = function (args) {
  4301. this.maxLength = args.maxLength;
  4302. };
  4303. DateText.prototype.handleMaxLength = function () {
  4304. var textNode = this.$thisNode.find("input")[0];
  4305. this.maxLengthValidator = new MaxLengthValidator_2.MaxLengthValidator(this.id, textNode, this.maxLength);
  4306. };
  4307. DateText.prototype.setText = function (args) {
  4308. var inputNode = this.$thisNode.find("input");
  4309. inputNode.val(args.text);
  4310. if (args.text.length > 0) {
  4311. inputNode.siblings('label, i').addClass('active');
  4312. }
  4313. else {
  4314. inputNode.siblings('label, i').removeClass('active');
  4315. }
  4316. };
  4317. DateText.prototype.showSpan = function (msg) {
  4318. if (this.$thisNode.find("span").css("display") === "none") {
  4319. this.$thisNode.find("span").html(msg).show().delay(2000).fadeOut(300);
  4320. }
  4321. };
  4322. DateText.prototype.setIcon = function (args) {
  4323. this.$thisNode.find("i").addClass(args.icon);
  4324. if (this.$thisNode.find("input").val().length > 0) {
  4325. this.$thisNode.find("input").siblings("label, i").addClass("active");
  4326. }
  4327. this.$thisNode.find("span").addClass("span_prefix");
  4328. };
  4329. DateText.prototype.setFocus = function () {
  4330. if (document.activeElement !== this.$thisNode.find("input")[0]) {
  4331. this.$thisNode.find("input").focus();
  4332. }
  4333. };
  4334. DateText.prototype.setName = function (args) {
  4335. this.$thisNode.find("label").text(args.name);
  4336. };
  4337. DateText.prototype.setFormat = function (args) {
  4338. this.format = args.format;
  4339. };
  4340. DateText.prototype.postLayout = function () {
  4341. _super.prototype.postLayout.call(this);
  4342. this.handleMaxLength();
  4343. };
  4344. DateText.TemplateCotainer = "\n <div class=\"input-field\">\n <input type=\"text\">\n <label></label>\n <span class=\"span_base\"></span>\n </div>\n ";
  4345. return DateText;
  4346. }(Widget_11.Widget));
  4347. exports.DateText = DateText;
  4348. });
  4349. define("widget/DrawerMenu", ["require", "exports", "widget/Widget", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, Widget_12, EventHub_13, MessageType_14, Event_11) {
  4350. "use strict";
  4351. var DrawerMenu = (function (_super) {
  4352. __extends(DrawerMenu, _super);
  4353. function DrawerMenu(parentId, id, style) {
  4354. _super.call(this, parentId, id, style);
  4355. this.$thisNode = $(DrawerMenu.Template).attr("id", this.id);
  4356. this.contentOne = new Array();
  4357. this.contentTwo = new Array();
  4358. this.contentThree = new Array();
  4359. this.contentFour = new Array();
  4360. }
  4361. DrawerMenu.prototype.setContents = function (args) {
  4362. var data = JSON.parse(args.attribute);
  4363. for (var key in data) {
  4364. var cutKey;
  4365. var location;
  4366. var m;
  4367. var n;
  4368. var k;
  4369. var h;
  4370. var belongTo = key.length - key.replace(/,/g, "").length;
  4371. switch (belongTo) {
  4372. case 0:
  4373. this.contentOne[parseInt(key)] = data[key];
  4374. this.contentTwo[parseInt(key)] = new Array();
  4375. this.contentThree[parseInt(key)] = new Array();
  4376. this.contentFour[parseInt(key)] = new Array();
  4377. break;
  4378. case 1:
  4379. cutKey = key.substr(1, key.length - 2);
  4380. location = cutKey.split(",");
  4381. m = Number(location[0]);
  4382. n = Number(location[1]);
  4383. this.contentTwo[m][n] = data[key];
  4384. this.contentThree[m][n] = new Array();
  4385. this.contentFour[m][n] = new Array();
  4386. break;
  4387. case 2:
  4388. cutKey = key.substr(1, key.length - 2);
  4389. location = cutKey.split(",");
  4390. var m = Number(location[0]);
  4391. var n = Number(location[1]);
  4392. var k = Number(location[2]);
  4393. this.contentThree[m][n][k] = data[key];
  4394. this.contentFour[m][n][k] = new Array();
  4395. break;
  4396. case 3:
  4397. cutKey = key.substr(1, key.length - 2);
  4398. location = cutKey.split(",");
  4399. var m = Number(location[0]);
  4400. var n = Number(location[1]);
  4401. var k = Number(location[2]);
  4402. var h = Number(location[3]);
  4403. this.contentFour[m][n][k][h] = data[key];
  4404. break;
  4405. default:
  4406. console.log("data error");
  4407. break;
  4408. }
  4409. }
  4410. };
  4411. DrawerMenu.prototype.setIconPaths = function (args) {
  4412. var pathData = JSON.parse(args.iconPaths);
  4413. for (var key in pathData) {
  4414. var path = pathData[key];
  4415. if (path.indexOf("file:") === 0)
  4416. path = path.replace(/\\/g, "\\\\");
  4417. this.$thisNode.find("li:eq(" + parseInt(key) + ") a i.svg_icon").css({
  4418. "background-image": "url(" + path + ")",
  4419. "width": "1em",
  4420. "height": "1em"
  4421. });
  4422. }
  4423. };
  4424. DrawerMenu.prototype.initDropdown = function () {
  4425. var Index1 = 0, Index2 = 0, Index3 = 0, Index4 = 0;
  4426. var flagTwo = false, flagThree = false, flagFour = false;
  4427. var content = "";
  4428. var own = this;
  4429. var block_height = 48;
  4430. var wrapperTwoNode = $("");
  4431. var wrapperThreeNode = $("");
  4432. var wrapperFourNode = $("");
  4433. var drawerMenu_deg_twoNode = $("");
  4434. var drawerMenu_deg_threeNode = $("");
  4435. var drawerMenu_deg_fourNode = $("");
  4436. for (var i = 0; i < this.contentTwo.length; i++) {
  4437. if (this.contentTwo[i].length > 0) {
  4438. flagTwo = true;
  4439. break;
  4440. }
  4441. }
  4442. for (var i = 0; i < this.contentThree.length; i++) {
  4443. for (var j = 0; j < this.contentThree[i].length; j++) {
  4444. if (this.contentThree[i][j].length > 0) {
  4445. flagThree = true;
  4446. break;
  4447. }
  4448. }
  4449. if (flagThree) {
  4450. break;
  4451. }
  4452. }
  4453. for (var i = 0; i < this.contentFour.length; i++) {
  4454. for (var j = 0; j < this.contentFour[i].length; j++) {
  4455. for (var m = 0; m < this.contentFour[i][j].length; m++) {
  4456. if (this.contentFour[i][j].length > 0) {
  4457. flagFour = true;
  4458. break;
  4459. }
  4460. }
  4461. if (flagFour) {
  4462. break;
  4463. }
  4464. }
  4465. if (flagFour) {
  4466. break;
  4467. }
  4468. }
  4469. if (this.$thisNode.find("li").length > 0) {
  4470. this.$thisNode.empty();
  4471. $("#" + this.id + "wrapperTwo").remove();
  4472. $("#" + this.id + "wrapperThree").remove();
  4473. $("#" + this.id + "wrapperFour").remove();
  4474. }
  4475. for (var i_1 = 0, z = this.contentOne.length; i_1 < z; i_1++) {
  4476. if (this.contentTwo[i_1].length > 0) {
  4477. this.$thisNode.append($("<li><a href='###'><i class='svg_icon'></i>" + this.contentOne[i_1] + "<i class='fold'></i></a></li>"));
  4478. }
  4479. else {
  4480. this.$thisNode.append($("<li><a href='###'><i class='svg_icon'></i>" + this.contentOne[i_1] + "</a></li>"));
  4481. }
  4482. }
  4483. if (flagTwo) {
  4484. wrapperTwoNode = $("<div><iframe class='myclass'></iframe><div><i class='triangle'></i><ul class='drawerMenu_deg_two dropdown-content show_drawerMenu'></ul></div></div>").attr("id", this.id + "wrapperTwo");
  4485. wrapperTwoNode.appendTo("body");
  4486. drawerMenu_deg_twoNode = wrapperTwoNode.find(".dropdown-content");
  4487. }
  4488. if (flagThree) {
  4489. wrapperThreeNode = $("<div><iframe class='myclass'></iframe><div><i class='triangle'></i><ul class='drawerMenu_deg_three dropdown-content show_drawerMenu'></ul></div></div>").attr("id", this.id + "wrapperThree");
  4490. wrapperThreeNode.appendTo("body");
  4491. drawerMenu_deg_threeNode = wrapperThreeNode.find(".dropdown-content");
  4492. }
  4493. if (flagFour) {
  4494. wrapperFourNode = $("<div><iframe class='myclass'></iframe><div><i class='triangle'></i><ul class='drawerMenu_deg_four dropdown-content show_drawerMenu'></ul></div></div>").attr("id", this.id + "wrapperFour");
  4495. wrapperFourNode.appendTo("body");
  4496. drawerMenu_deg_fourNode = wrapperFourNode.find(".dropdown-content");
  4497. }
  4498. this.$thisNode.on("mouseenter", "li", {
  4499. contentTwo: this.contentTwo,
  4500. contentThree: this.contentThree
  4501. }, function (event) {
  4502. drawerMenu_deg_twoNode.empty();
  4503. wrapperTwoNode.find(".myclass").hide();
  4504. wrapperTwoNode.find(".triangle").hide();
  4505. drawerMenu_deg_threeNode.empty();
  4506. wrapperThreeNode.find(".myclass").hide();
  4507. wrapperThreeNode.find(".triangle").hide();
  4508. Index1 = own.$thisNode.find("li").index($(this));
  4509. own.$thisNode.find("li a i.fold").css({
  4510. "background-image": "url(images/drawer_menu/icon_normal_arrow.png)"
  4511. });
  4512. own.$thisNode.find("li:eq(" + Index1 + ") a i.fold").css({
  4513. "background-image": "url(images/drawer_menu/icon_pressed_arrow.png)"
  4514. });
  4515. for (var i = 0, z = event.data.contentTwo[Index1].length; i < z; i++) {
  4516. if (event.data.contentThree[Index1][i].length > 0) {
  4517. drawerMenu_deg_twoNode.append($("<li><a href='###'>" + event.data.contentTwo[Index1][i] + "<i class='fold'></i></a></li>"));
  4518. }
  4519. else {
  4520. drawerMenu_deg_twoNode.append($("<li><a href='###'>" + event.data.contentTwo[Index1][i] + "</a></li>"));
  4521. }
  4522. }
  4523. if (drawerMenu_deg_twoNode.find("li").length > 0) {
  4524. var two_height = drawerMenu_deg_twoNode.height();
  4525. var primate_height = $(this).offset().top;
  4526. var screen_height = $(window).height();
  4527. var aa = screen_height - primate_height - block_height;
  4528. if (two_height + primate_height >= screen_height) {
  4529. drawerMenu_deg_twoNode.css({
  4530. "bottom": aa,
  4531. "display": "block",
  4532. "left": $(this).parent().outerWidth() + $(this).parent().offset().left + 12,
  4533. "top": "auto"
  4534. });
  4535. drawerMenu_deg_twoNode.css({
  4536. "max-height": near(screen_height - aa)
  4537. });
  4538. wrapperTwoNode.find(".myclass").css({
  4539. "width": drawerMenu_deg_twoNode.width(),
  4540. "height": drawerMenu_deg_twoNode.height(),
  4541. "left": drawerMenu_deg_twoNode.css("left"),
  4542. "bottom": drawerMenu_deg_twoNode.css("bottom"),
  4543. "display": "block",
  4544. "top": "auto"
  4545. });
  4546. wrapperTwoNode.find(".triangle").css({
  4547. "left": parseInt(drawerMenu_deg_twoNode.css("left")) - 8,
  4548. "bottom": parseInt(drawerMenu_deg_twoNode.css("bottom")) + 24,
  4549. "display": "block",
  4550. "top": "auto"
  4551. });
  4552. }
  4553. else {
  4554. drawerMenu_deg_twoNode.css({
  4555. "top": primate_height,
  4556. "display": "block",
  4557. "left": $(this).parent().outerWidth() + $(this).parent().offset().left + 12,
  4558. "bottom": "auto"
  4559. });
  4560. drawerMenu_deg_twoNode.css({
  4561. "max-height": near($(window).height() - $(this).offset().top)
  4562. });
  4563. wrapperTwoNode.find(".myclass").css({
  4564. "width": drawerMenu_deg_twoNode.width(),
  4565. "height": drawerMenu_deg_twoNode.height(),
  4566. "left": drawerMenu_deg_twoNode.css("left"),
  4567. "top": drawerMenu_deg_twoNode.css("top"),
  4568. "display": "block",
  4569. "bottom": "auto"
  4570. });
  4571. wrapperTwoNode.find(".triangle").css({
  4572. "left": parseInt(drawerMenu_deg_twoNode.css("left")) - 8,
  4573. "top": parseInt(drawerMenu_deg_twoNode.css("top")) + 24,
  4574. "display": "block",
  4575. "bottom": "auto"
  4576. });
  4577. }
  4578. }
  4579. });
  4580. this.$thisNode.on("mouseleave", "li", function (event) {
  4581. var x = event.clientX;
  4582. var y = event.clientY;
  4583. if (drawerMenu_deg_twoNode.offset()) {
  4584. var borderX = drawerMenu_deg_twoNode.offset().left + drawerMenu_deg_twoNode.width();
  4585. var borderY = drawerMenu_deg_twoNode.offset().top + drawerMenu_deg_twoNode.height();
  4586. if ((x >= drawerMenu_deg_twoNode.offset().left - 18) && (x <= borderX) && (y >= drawerMenu_deg_twoNode.offset().top + 10) && (y <= borderY)) {
  4587. drawerMenu_deg_twoNode.show();
  4588. wrapperTwoNode.find(".myclass").show();
  4589. }
  4590. else {
  4591. $("#" + own.id + " li ").removeClass("block_fontcolor");
  4592. cleanBlock();
  4593. }
  4594. }
  4595. });
  4596. this.$thisNode.on("click", "li", function (event) {
  4597. var apple = $("#" + own.id + " li").index($(this));
  4598. content = "" + apple;
  4599. EventHub_13.EventHub.dispatchEvent(MessageType_14.MessageType.WIDGET, {
  4600. id: own.id,
  4601. degree: "1",
  4602. location: content,
  4603. evtType: Event_11.Event.CLICK
  4604. });
  4605. });
  4606. drawerMenu_deg_twoNode.on("mouseenter", "li", {
  4607. contentThree: this.contentThree,
  4608. contentFour: this.contentFour
  4609. }, function (event) {
  4610. drawerMenu_deg_threeNode.empty();
  4611. wrapperThreeNode.find(".myclass").hide();
  4612. wrapperThreeNode.find(".triangle").hide();
  4613. drawerMenu_deg_fourNode.empty();
  4614. wrapperFourNode.find(".myclass").hide();
  4615. wrapperFourNode.find(".triangle").hide();
  4616. Index2 = drawerMenu_deg_twoNode.find("li").index($(this));
  4617. drawerMenu_deg_twoNode.find(".fold").css({
  4618. "background-image": "url(images/drawer_menu/icon_normal_arrow.png)"
  4619. });
  4620. drawerMenu_deg_twoNode.find("li:eq(" + Index2 + ") a i.fold").css({
  4621. "background-image": "url(images/drawer_menu/icon_pressed_arrow.png)"
  4622. });
  4623. $(this).addClass("block_fontcolor").siblings().removeClass("block_fontcolor");
  4624. for (var i = 0, z = event.data.contentThree[Index1][Index2].length; i < z; i++) {
  4625. if (event.data.contentFour[Index1][Index2][i].length > 0) {
  4626. drawerMenu_deg_threeNode.append($("<li><a href='###'>" + event.data.contentThree[Index1][Index2][i] + "<i class='fold'></i></a></li>"));
  4627. }
  4628. else {
  4629. drawerMenu_deg_threeNode.append($("<li><a href='###'>" + event.data.contentThree[Index1][Index2][i] + "</a></li>"));
  4630. }
  4631. }
  4632. if (drawerMenu_deg_threeNode.find("li").length > 0) {
  4633. var three_height = drawerMenu_deg_threeNode.height();
  4634. var primate_height = $(this).offset().top;
  4635. var screen_height = $(window).height();
  4636. var aa = screen_height - primate_height - block_height;
  4637. if (primate_height > aa) {
  4638. drawerMenu_deg_threeNode.css({
  4639. "top": "auto",
  4640. "left": drawerMenu_deg_twoNode.offset().left + drawerMenu_deg_twoNode.width() + 12,
  4641. "display": "block",
  4642. "bottom": aa
  4643. });
  4644. drawerMenu_deg_threeNode.css({
  4645. "max-height": near(screen_height - aa)
  4646. });
  4647. wrapperThreeNode.find(".myclass").css({
  4648. "width": drawerMenu_deg_threeNode.width(),
  4649. "height": drawerMenu_deg_threeNode.height(),
  4650. "top": drawerMenu_deg_threeNode.css("top"),
  4651. "left": drawerMenu_deg_threeNode.css("left"),
  4652. "display": "block",
  4653. "bottom": drawerMenu_deg_threeNode.css("bottom")
  4654. });
  4655. wrapperThreeNode.find(".triangle").css({
  4656. "left": parseInt(drawerMenu_deg_threeNode.css("left")) - 8,
  4657. "bottom": parseInt(drawerMenu_deg_threeNode.css("bottom")) + 24,
  4658. "display": "block",
  4659. "top": "auto"
  4660. });
  4661. }
  4662. else {
  4663. drawerMenu_deg_threeNode.css({
  4664. "top": $(this).offset().top,
  4665. "left": drawerMenu_deg_twoNode.offset().left + drawerMenu_deg_twoNode.width() + 12,
  4666. "display": "block",
  4667. "bottom": "auto"
  4668. });
  4669. drawerMenu_deg_threeNode.css({
  4670. "max-height": near($(window).height() - $(this).offset().top)
  4671. });
  4672. wrapperThreeNode.find(".myclass").css({
  4673. "width": drawerMenu_deg_threeNode.width(),
  4674. "height": drawerMenu_deg_threeNode.height(),
  4675. "top": drawerMenu_deg_threeNode.css("top"),
  4676. "left": drawerMenu_deg_threeNode.css("left"),
  4677. "display": "block",
  4678. "bottom": drawerMenu_deg_threeNode.css("bottom")
  4679. });
  4680. wrapperThreeNode.find(".triangle").css({
  4681. "left": parseInt(drawerMenu_deg_threeNode.css("left")) - 8,
  4682. "top": parseInt(drawerMenu_deg_threeNode.css("top")) + 24,
  4683. "display": "block",
  4684. "bottom": "auto"
  4685. });
  4686. }
  4687. }
  4688. });
  4689. drawerMenu_deg_twoNode.on("mouseleave", function (event) {
  4690. var x = event.clientX;
  4691. var y = event.clientY;
  4692. if (drawerMenu_deg_threeNode.offset()) {
  4693. var borderX = drawerMenu_deg_threeNode.offset().left + drawerMenu_deg_threeNode.width();
  4694. var borderY = drawerMenu_deg_threeNode.offset().top + drawerMenu_deg_threeNode.height();
  4695. if ((x >= drawerMenu_deg_threeNode.offset().left - 18) && (x <= borderX) && (y >= drawerMenu_deg_threeNode.offset().top + 10) && (y <= borderY)) {
  4696. drawerMenu_deg_threeNode.show();
  4697. wrapperThreeNode.find(".myclass").show();
  4698. }
  4699. else {
  4700. $("#" + own.id + " li").removeClass("block_fontcolor");
  4701. cleanBlock();
  4702. }
  4703. }
  4704. });
  4705. drawerMenu_deg_twoNode.on("click", "li", function () {
  4706. var apple = drawerMenu_deg_twoNode.find("li").index($(this));
  4707. content = '[' + Index1 + ',' + apple + ']';
  4708. EventHub_13.EventHub.dispatchEvent(MessageType_14.MessageType.WIDGET, {
  4709. id: own.id,
  4710. degree: "2",
  4711. location: content,
  4712. evtType: Event_11.Event.CLICK
  4713. });
  4714. if (drawerMenu_deg_threeNode.find("li").length == 0) {
  4715. cleanBlock();
  4716. }
  4717. });
  4718. drawerMenu_deg_threeNode.on("mouseenter", "li", {
  4719. contentFour: this.contentFour
  4720. }, function (event) {
  4721. drawerMenu_deg_fourNode.empty();
  4722. wrapperFourNode.find(".myclass").hide();
  4723. wrapperFourNode.find(".triangle").hide();
  4724. Index3 = drawerMenu_deg_threeNode.find("li").index($(this));
  4725. drawerMenu_deg_threeNode.find(".fold").css({
  4726. "background-image": "url(images/drawer_menu/icon_normal_arrow.png)"
  4727. });
  4728. drawerMenu_deg_threeNode.find("li:eq(" + Index3 + ") a i.fold").css({
  4729. "background-image": "url(images/drawer_menu/icon_pressed_arrow.png)"
  4730. });
  4731. $(this).addClass("block_fontcolor").siblings().removeClass("block_fontcolor");
  4732. for (var i = 0, z = event.data.contentFour[Index1][Index2][Index3].length; i < z; i++) {
  4733. drawerMenu_deg_fourNode.append($("<li><a href='###'>" + event.data.contentFour[Index1][Index2][Index3][i] + "</a></li>"));
  4734. }
  4735. if (drawerMenu_deg_fourNode.find("li").length > 0) {
  4736. var four_height = drawerMenu_deg_fourNode.height();
  4737. var primate_height = $(this).offset().top;
  4738. var screen_height = $(window).height();
  4739. var aa = screen_height - primate_height - block_height;
  4740. if (primate_height > aa) {
  4741. drawerMenu_deg_fourNode.css({
  4742. "top": "auto",
  4743. "left": drawerMenu_deg_threeNode.offset().left + drawerMenu_deg_threeNode.width() + 12,
  4744. "display": "block",
  4745. "bottom": aa
  4746. });
  4747. drawerMenu_deg_fourNode.css({
  4748. "max-height": near(screen_height - aa)
  4749. });
  4750. wrapperFourNode.find(".myclass").css({
  4751. "width": drawerMenu_deg_fourNode.width(),
  4752. "height": drawerMenu_deg_fourNode.height(),
  4753. "top": drawerMenu_deg_fourNode.css("top"),
  4754. "left": drawerMenu_deg_fourNode.css("left"),
  4755. "display": "block",
  4756. "bottom": drawerMenu_deg_fourNode.css("bottom")
  4757. });
  4758. wrapperFourNode.find(".triangle").css({
  4759. "left": parseInt(drawerMenu_deg_fourNode.css("left")) - 8,
  4760. "bottom": parseInt(drawerMenu_deg_fourNode.css("bottom")) + 24,
  4761. "display": "block",
  4762. "top": "auto"
  4763. });
  4764. }
  4765. else {
  4766. drawerMenu_deg_fourNode.css({
  4767. "top": $(this).offset().top,
  4768. "left": drawerMenu_deg_threeNode.offset().left + drawerMenu_deg_threeNode.width() + 12,
  4769. "display": "block",
  4770. "bottom": "auto"
  4771. });
  4772. drawerMenu_deg_fourNode.css({
  4773. "max-height": near($(window).height() - $(this).offset().top)
  4774. });
  4775. wrapperFourNode.find(".myclass").css({
  4776. "width": drawerMenu_deg_fourNode.width(),
  4777. "height": drawerMenu_deg_fourNode.height(),
  4778. "top": drawerMenu_deg_fourNode.css("top"),
  4779. "left": drawerMenu_deg_fourNode.css("left"),
  4780. "display": "block",
  4781. "bottom": drawerMenu_deg_fourNode.css("bottom")
  4782. });
  4783. wrapperFourNode.find(".triangle").css({
  4784. "left": parseInt(drawerMenu_deg_fourNode.css("left")) - 8,
  4785. "bottom": "auto",
  4786. "display": "block",
  4787. "top": parseInt(drawerMenu_deg_fourNode.css("top")) + 24
  4788. });
  4789. }
  4790. }
  4791. });
  4792. drawerMenu_deg_threeNode.on("mouseleave", function (event) {
  4793. var x = event.clientX;
  4794. var y = event.clientY;
  4795. if (drawerMenu_deg_fourNode.offset()) {
  4796. var borderX = drawerMenu_deg_fourNode.offset().left + drawerMenu_deg_fourNode.width();
  4797. var borderY = drawerMenu_deg_fourNode.offset().top + drawerMenu_deg_fourNode.height();
  4798. if ((x >= drawerMenu_deg_fourNode.offset().left - 18) && (x <= borderX) && (y >= drawerMenu_deg_fourNode.offset().top + 10) && (y <= borderY)) {
  4799. drawerMenu_deg_fourNode.show();
  4800. wrapperFourNode.find(".myclass").show();
  4801. }
  4802. else {
  4803. $("#" + own.id + " li").removeClass("block_fontcolor");
  4804. cleanBlock();
  4805. }
  4806. }
  4807. });
  4808. drawerMenu_deg_threeNode.on("click", "li", function (event) {
  4809. Index3 = drawerMenu_deg_threeNode.find("li").index($(this));
  4810. content = '[' + Index1 + ',' + Index2 + ',' + Index3 + ']';
  4811. EventHub_13.EventHub.dispatchEvent(MessageType_14.MessageType.WIDGET, {
  4812. id: own.id,
  4813. degree: "3",
  4814. location: content,
  4815. evtType: Event_11.Event.CLICK
  4816. });
  4817. if (drawerMenu_deg_fourNode.find("li").length == 0) {
  4818. cleanBlock();
  4819. }
  4820. });
  4821. drawerMenu_deg_fourNode.on("mouseleave", "li", function (event) {
  4822. var x = event.clientX;
  4823. var y = event.clientY;
  4824. var borderX = drawerMenu_deg_threeNode.offset().left + drawerMenu_deg_threeNode.width();
  4825. var borderY = drawerMenu_deg_threeNode.offset().top + drawerMenu_deg_threeNode.height();
  4826. var borderXX = drawerMenu_deg_fourNode.offset().left + drawerMenu_deg_fourNode.width();
  4827. var borderYY = drawerMenu_deg_fourNode.offset().top + drawerMenu_deg_fourNode.height();
  4828. if ((y <= drawerMenu_deg_fourNode.offset().top) || (x >= borderXX) || (y >= borderYY)) {
  4829. cleanBlock();
  4830. }
  4831. if ((x < borderX) && (y > borderY)) {
  4832. cleanBlock();
  4833. }
  4834. });
  4835. drawerMenu_deg_fourNode.on("click", "li", function (event) {
  4836. Index4 = drawerMenu_deg_fourNode.find("li").index($(this));
  4837. content = '[' + Index1 + ',' + Index2 + ',' + Index3 + ',' + Index4 + ']';
  4838. EventHub_13.EventHub.dispatchEvent(MessageType_14.MessageType.WIDGET, {
  4839. id: own.id,
  4840. degree: "4",
  4841. location: content,
  4842. evtType: Event_11.Event.CLICK
  4843. });
  4844. cleanBlock();
  4845. });
  4846. function cleanBlock() {
  4847. drawerMenu_deg_fourNode.empty();
  4848. drawerMenu_deg_fourNode.hide();
  4849. drawerMenu_deg_threeNode.empty();
  4850. drawerMenu_deg_threeNode.hide();
  4851. drawerMenu_deg_twoNode.empty();
  4852. drawerMenu_deg_twoNode.hide();
  4853. wrapperTwoNode.find(".myclass").hide();
  4854. wrapperThreeNode.find(".myclass").hide();
  4855. wrapperFourNode.find(".myclass").hide();
  4856. wrapperTwoNode.find(".triangle").hide();
  4857. wrapperThreeNode.find(".triangle").hide();
  4858. wrapperFourNode.find(".triangle").hide();
  4859. own.$thisNode.find("li:eq(" + Index1 + ") a i.fold").css({
  4860. "background-image": "url(images/drawer_menu/icon_normal_arrow.png)"
  4861. });
  4862. drawerMenu_deg_twoNode.css("max-height", "none");
  4863. drawerMenu_deg_threeNode.css("max-height", "none");
  4864. drawerMenu_deg_fourNode.css("max-height", "none");
  4865. $("#" + own.id + " li").removeClass("block_fontcolor");
  4866. drawerMenu_deg_twoNode.find("li").removeClass("block_fontcolor");
  4867. drawerMenu_deg_threeNode.find("li").removeClass("block_fontcolor");
  4868. drawerMenu_deg_fourNode.find("li").removeClass("block_fontcolor");
  4869. }
  4870. function near(numb) {
  4871. var left, right, num;
  4872. var block_height = 48;
  4873. left = numb % block_height;
  4874. num = numb - left;
  4875. if (num < block_height) {
  4876. num = block_height;
  4877. }
  4878. return num;
  4879. }
  4880. };
  4881. DrawerMenu.prototype.dispose = function () {
  4882. _super.prototype.dispose.call(this);
  4883. $("#" + this.id + "wrapperTwo").remove();
  4884. $("#" + this.id + "wrapperThree").remove();
  4885. };
  4886. DrawerMenu.Template = "<ul class='dropdown-content adore_drawerMenu adore-hidden-scrollbar'></ul>";
  4887. return DrawerMenu;
  4888. }(Widget_12.Widget));
  4889. exports.DrawerMenu = DrawerMenu;
  4890. });
  4891. define("widget/echart/EChart", ["require", "exports", "widget/Widget", "util/VisibilityChangeUtil"], function (require, exports, Widget_13, VisibilityChangeUtil_1) {
  4892. "use strict";
  4893. var EChart = (function (_super) {
  4894. __extends(EChart, _super);
  4895. function EChart(parentId, id, style) {
  4896. _super.call(this, parentId, id, style);
  4897. this.option = {};
  4898. this.hadVisibilityListener = false;
  4899. var own = this;
  4900. this.$thisNode = $(EChart.template).attr({ id: this.id });
  4901. this.$chartNode = this.$thisNode.find("div");
  4902. this.resizeFunction = function () {
  4903. if (own.echart) {
  4904. if (own.$thisNode.is(":visible")) {
  4905. setTimeout(function () {
  4906. own.echart.resize();
  4907. }, 380);
  4908. }
  4909. else {
  4910. if (!own.hadVisibilityListener) {
  4911. VisibilityChangeUtil_1.VisibilityChangeUtil.addVisibilityListener(own.$thisNode, function (visible) {
  4912. if (visible) {
  4913. own.echart.resize();
  4914. VisibilityChangeUtil_1.VisibilityChangeUtil.removeVisibilityListener(own.$thisNode);
  4915. own.hadVisibilityListener = false;
  4916. }
  4917. });
  4918. own.hadVisibilityListener = true;
  4919. }
  4920. }
  4921. }
  4922. };
  4923. $(window).on("resize", this.resizeFunction);
  4924. }
  4925. EChart.prototype.addOption = function (args) {
  4926. var option = JSON.parse(args.option);
  4927. $.extend(true, this.option, option);
  4928. if (this.echart) {
  4929. this.echart.setOption(this.option);
  4930. }
  4931. };
  4932. EChart.prototype.setOption = function (args) {
  4933. var option = JSON.parse(args.option);
  4934. if (this.echart) {
  4935. this.option = option;
  4936. this.echart.setOption(option);
  4937. }
  4938. else {
  4939. this.option = option;
  4940. }
  4941. };
  4942. EChart.prototype.dispose = function () {
  4943. $(window).off("resize", this.resizeFunction);
  4944. _super.prototype.dispose.call(this);
  4945. };
  4946. EChart.prototype.postLayout = function () {
  4947. _super.prototype.postLayout.call(this);
  4948. if (!this.echart) {
  4949. this.echart = echarts.init(this.$chartNode.get(0));
  4950. if (this.option) {
  4951. this.echart.setOption(this.option);
  4952. }
  4953. }
  4954. this.echart.resize();
  4955. };
  4956. EChart.prototype.clear = function () {
  4957. if (this.echart) {
  4958. this.echart.clear();
  4959. }
  4960. this.option = {};
  4961. };
  4962. EChart.template = "\n <div>\n <div style=\"width:100%;height:100%\"></div>\n <div>\n ";
  4963. return EChart;
  4964. }(Widget_13.Widget));
  4965. exports.EChart = EChart;
  4966. });
  4967. define("widget/echart/BarChart", ["require", "exports", "widget/echart/EChart"], function (require, exports, EChart_1) {
  4968. "use strict";
  4969. var BarChart = (function (_super) {
  4970. __extends(BarChart, _super);
  4971. function BarChart() {
  4972. _super.apply(this, arguments);
  4973. this.data = new Array();
  4974. this.title = "unset";
  4975. this.subTitle = "";
  4976. this.align = "horizontal";
  4977. this.axisLabel = { categoryAxisLabel: "", dataAxisLabel: "" };
  4978. this.categories = [];
  4979. }
  4980. BarChart.prototype.setTitle = function (args) {
  4981. this.title = args.titles.title;
  4982. this.subTitle = args.titles.subTitle;
  4983. };
  4984. BarChart.prototype.setData = function (args) {
  4985. this.data = args.data;
  4986. };
  4987. BarChart.prototype.setAxisLabel = function (args) {
  4988. this.axisLabel = { categoryAxisLabel: args.axisLabelInfo.categoryAxisLabel, dataAxisLabel: args.axisLabelInfo.dataAxisLabel };
  4989. };
  4990. BarChart.prototype.setAlign = function (args) {
  4991. this.align = args.align;
  4992. };
  4993. BarChart.prototype.setCategories = function (args) {
  4994. this.categories = args.categories;
  4995. };
  4996. BarChart.prototype.postLayout = function () {
  4997. if (this.data) {
  4998. this.redrawChart();
  4999. }
  5000. _super.prototype.postLayout.call(this);
  5001. };
  5002. BarChart.prototype.redrawChart = function () {
  5003. var xAxisContent = {};
  5004. var yAxisContent = {};
  5005. if (this.align === "horizontal") {
  5006. xAxisContent = {
  5007. data: this.categories,
  5008. name: this.axisLabel.categoryAxisLabel,
  5009. silent: false,
  5010. splitLine: {
  5011. show: false
  5012. }
  5013. };
  5014. yAxisContent = {
  5015. name: this.axisLabel.dataAxisLabel
  5016. };
  5017. }
  5018. else if (this.align === "vertical") {
  5019. yAxisContent = {
  5020. data: this.categories,
  5021. name: this.axisLabel.categoryAxisLabel,
  5022. silent: false,
  5023. splitLine: {
  5024. show: false
  5025. }
  5026. };
  5027. xAxisContent = {
  5028. name: this.axisLabel.dataAxisLabel
  5029. };
  5030. }
  5031. ;
  5032. var dataName = [];
  5033. for (var _i = 0, _a = this.data; _i < _a.length; _i++) {
  5034. var dataEntry = _a[_i];
  5035. dataName.push(dataEntry.entryName);
  5036. }
  5037. var seriesContent = [];
  5038. var i = 0;
  5039. for (var _b = 0, _c = this.data; _b < _c.length; _b++) {
  5040. var dataEntry = _c[_b];
  5041. var dataTemplate = {
  5042. "name": dataEntry.entryName,
  5043. "type": "bar",
  5044. "data": dataEntry.entryData
  5045. };
  5046. seriesContent.push(dataTemplate);
  5047. i++;
  5048. }
  5049. var barOption = {
  5050. title: {
  5051. text: this.title,
  5052. subtext: this.subTitle,
  5053. left: "center"
  5054. },
  5055. legend: {
  5056. data: dataName,
  5057. align: "left",
  5058. left: "left"
  5059. },
  5060. toolbox: {
  5061. feature: {
  5062. magicType: {
  5063. type: ["stack", "tiled"]
  5064. }
  5065. }
  5066. },
  5067. tooltip: {},
  5068. xAxis: xAxisContent,
  5069. yAxis: yAxisContent,
  5070. series: seriesContent
  5071. };
  5072. this.option = barOption;
  5073. if (this.echart) {
  5074. this.echart.setOption(this.option);
  5075. this.echart.resize();
  5076. }
  5077. };
  5078. return BarChart;
  5079. }(EChart_1.EChart));
  5080. exports.BarChart = BarChart;
  5081. });
  5082. define("widget/echart/PieChart", ["require", "exports", "widget/echart/EChart"], function (require, exports, EChart_2) {
  5083. "use strict";
  5084. var PieChart = (function (_super) {
  5085. __extends(PieChart, _super);
  5086. function PieChart() {
  5087. _super.apply(this, arguments);
  5088. this.data = new Array();
  5089. this.dataName = "";
  5090. this.title = "unset";
  5091. this.subTitle = "";
  5092. }
  5093. PieChart.prototype.setData = function (args) {
  5094. this.data = args.data;
  5095. };
  5096. PieChart.prototype.setDataName = function (args) {
  5097. this.dataName = args.dataName;
  5098. };
  5099. PieChart.prototype.setTitle = function (args) {
  5100. this.title = args.titles.title;
  5101. this.subTitle = args.titles.subTitle;
  5102. };
  5103. PieChart.prototype.postLayout = function () {
  5104. if (this.data) {
  5105. this.redrawChart();
  5106. }
  5107. _super.prototype.postLayout.call(this);
  5108. };
  5109. PieChart.prototype.redrawChart = function () {
  5110. var dataNameList = new Array();
  5111. for (var _i = 0, _a = this.data; _i < _a.length; _i++) {
  5112. var dataEntry = _a[_i];
  5113. dataNameList.push(dataEntry.name);
  5114. }
  5115. var dataList = new Array();
  5116. for (var _b = 0, _c = this.data; _b < _c.length; _b++) {
  5117. var dataEntry = _c[_b];
  5118. var dataTemplate = {
  5119. value: dataEntry.value,
  5120. name: dataEntry.name
  5121. };
  5122. dataList.push(dataTemplate);
  5123. }
  5124. var pieOption = {
  5125. title: {
  5126. text: this.title,
  5127. subtext: this.subTitle,
  5128. x: "center"
  5129. },
  5130. tooltip: {
  5131. trigger: "item",
  5132. formatter: "{a} <br/>{b} : {c} ({d}%)"
  5133. },
  5134. legend: {
  5135. orient: "vertical",
  5136. left: "left",
  5137. data: dataNameList
  5138. },
  5139. series: [
  5140. {
  5141. name: this.dataName,
  5142. type: "pie",
  5143. radius: "70%",
  5144. center: ["50%", "50%"],
  5145. data: dataList,
  5146. itemStyle: {
  5147. emphasis: {
  5148. shadowBlur: 10,
  5149. shadowOffsetX: 0,
  5150. shadowColor: "rgba(0, 0, 0, 0.5)"
  5151. }
  5152. }
  5153. }
  5154. ]
  5155. };
  5156. this.option = pieOption;
  5157. if (this.echart) {
  5158. this.echart.setOption(this.option);
  5159. this.echart.resize();
  5160. }
  5161. };
  5162. return PieChart;
  5163. }(EChart_2.EChart));
  5164. exports.PieChart = PieChart;
  5165. });
  5166. define("widget/echart/RadarChart", ["require", "exports", "widget/echart/EChart"], function (require, exports, EChart_3) {
  5167. "use strict";
  5168. var RadarChart = (function (_super) {
  5169. __extends(RadarChart, _super);
  5170. function RadarChart() {
  5171. _super.apply(this, arguments);
  5172. this.data = new Array();
  5173. this.indicators = new Array();
  5174. this.title = "unset";
  5175. this.subTitle = "";
  5176. }
  5177. RadarChart.prototype.setData = function (args) {
  5178. this.data = args.data;
  5179. };
  5180. RadarChart.prototype.setIndicators = function (args) {
  5181. this.indicators = args.indicators;
  5182. };
  5183. RadarChart.prototype.setTitle = function (args) {
  5184. this.title = args.titles.title;
  5185. this.subTitle = args.titles.subTitle;
  5186. };
  5187. RadarChart.prototype.postLayout = function () {
  5188. if (this.data) {
  5189. this.redrawChart();
  5190. }
  5191. _super.prototype.postLayout.call(this);
  5192. };
  5193. RadarChart.prototype.redrawChart = function () {
  5194. var indicatorsContent = new Array();
  5195. for (var _i = 0, _a = this.indicators; _i < _a.length; _i++) {
  5196. var indicator = _a[_i];
  5197. var template = void 0;
  5198. if (indicator.max) {
  5199. template = {
  5200. name: indicator.name, max: indicator.max
  5201. };
  5202. }
  5203. else {
  5204. template = {
  5205. name: indicator.name
  5206. };
  5207. }
  5208. indicatorsContent.push(template);
  5209. }
  5210. var legendData = new Array();
  5211. var dataContent = [];
  5212. for (var _b = 0, _c = this.data; _b < _c.length; _b++) {
  5213. var dataEntry = _c[_b];
  5214. var subDataTemplate = {
  5215. value: dataEntry.value,
  5216. name: dataEntry.name
  5217. };
  5218. legendData.push(dataEntry.name);
  5219. dataContent.push(subDataTemplate);
  5220. }
  5221. var radarOption = {
  5222. title: {
  5223. text: this.title,
  5224. subtext: this.subTitle,
  5225. x: "center"
  5226. },
  5227. tooltip: {},
  5228. legend: {
  5229. data: legendData,
  5230. x: "left",
  5231. orient: "vertical"
  5232. },
  5233. radar: {
  5234. radius: "70%",
  5235. center: ["50%", "50%"],
  5236. indicator: indicatorsContent
  5237. },
  5238. series: [{
  5239. name: "",
  5240. type: "radar",
  5241. areaStyle: { normal: {} },
  5242. data: dataContent
  5243. }]
  5244. };
  5245. this.option = radarOption;
  5246. if (this.echart) {
  5247. this.echart.setOption(this.option);
  5248. this.echart.resize();
  5249. }
  5250. };
  5251. return RadarChart;
  5252. }(EChart_3.EChart));
  5253. exports.RadarChart = RadarChart;
  5254. });
  5255. define("widget/ExpandableText", ["require", "exports", "widget/Widget", "event/EventHub", "event/MessageType", "event/Event", "hotkey/Keys"], function (require, exports, Widget_14, EventHub_14, MessageType_15, Event_12, Keys_7) {
  5256. "use strict";
  5257. var ExpandableText = (function (_super) {
  5258. __extends(ExpandableText, _super);
  5259. function ExpandableText(parentId, id, style) {
  5260. var _this = this;
  5261. _super.call(this, parentId, id, style);
  5262. this.maxShowItems = 5;
  5263. this.currentIndex = -1;
  5264. this.datas = [];
  5265. this.maxShowItems = 5;
  5266. this.expandableTextId = this.id;
  5267. this.$thisNode = $(ExpandableText.TemplateNormal).attr("id", this.id);
  5268. this.$attachNode = this.$thisNode;
  5269. this.$textCode = this.$thisNode.find("input").attr("id", this.id + "_input");
  5270. this.$thisNode.find("label").attr("for", this.id);
  5271. var own = this;
  5272. this.$textCode.on("input", function (e) {
  5273. own.handleInput(e, _this.$textCode.val());
  5274. });
  5275. this.$textCode.on("keydown", function (e) {
  5276. own.handleKeyDown(e);
  5277. });
  5278. this.$textCode.on("blur", function (e) {
  5279. own.handleBlur(e);
  5280. });
  5281. this.$textCode.on("focus", function (e) {
  5282. own.sendFocusGain();
  5283. });
  5284. }
  5285. ExpandableText.prototype.setText = function (args) {
  5286. this.$textCode.val(args.text);
  5287. };
  5288. ExpandableText.prototype.setName = function (args) {
  5289. this.$thisNode.find("label").text(args.name);
  5290. };
  5291. ExpandableText.prototype.setItems = function (args) {
  5292. this.datas = args.items;
  5293. };
  5294. ExpandableText.prototype.dispose = function () {
  5295. _super.prototype.dispose.call(this);
  5296. $("#" + this.expandableTextId + "_dropDown").remove();
  5297. };
  5298. ExpandableText.prototype.setFocus = function () {
  5299. var $dropDownNode = $("#" + this.id + "_dropDown");
  5300. if ($dropDownNode.css("display") !== "block" && document.activeElement !== this.$textCode[0]) {
  5301. this.$textCode.focus();
  5302. }
  5303. };
  5304. ExpandableText.prototype.setEnabled = function (args) {
  5305. this.enabled = args.enabled;
  5306. if (this.enabled) {
  5307. this.$thisNode.find("input").removeAttr("disabled");
  5308. }
  5309. else {
  5310. this.$thisNode.find("input").attr("disabled", "disabled");
  5311. }
  5312. };
  5313. ExpandableText.prototype.setPlaceholder = function (args) {
  5314. this.$thisNode.find("input").attr("placeholder", args.placeholder);
  5315. };
  5316. ExpandableText.prototype.handleKeyDown = function (e) {
  5317. var dropDown = $("#" + this.expandableTextId + "_dropDown");
  5318. var dis = dropDown.css("display");
  5319. if (!dis || dis === "none") {
  5320. if (e.keyCode === Keys_7.Keys.DOWN_ARROW) {
  5321. this.showDropDown(e, "", true);
  5322. }
  5323. return;
  5324. }
  5325. var items = dropDown.find("li");
  5326. if (items.length === 0) {
  5327. return;
  5328. }
  5329. if (e.keyCode === Keys_7.Keys.UP_ARROW) {
  5330. if (this.currentIndex === -1) {
  5331. this.currentIndex = items.length - 1;
  5332. }
  5333. else {
  5334. this.currentIndex--;
  5335. }
  5336. items.css("background-color", "#FFFFFF");
  5337. if (this.currentIndex < 0) {
  5338. this.currentIndex = -1;
  5339. }
  5340. else {
  5341. $(items[this.currentIndex]).css("background-color", "#BEBEBE");
  5342. this.$textCode.val($(items[this.currentIndex]).find("a").text().split(" ")[0]);
  5343. }
  5344. this.refreshScroll(dropDown, this.currentIndex);
  5345. e.preventDefault();
  5346. return;
  5347. }
  5348. else if (e.keyCode === Keys_7.Keys.DOWN_ARROW) {
  5349. this.currentIndex++;
  5350. items.css("background-color", "#FFFFFF");
  5351. if (this.currentIndex >= items.length) {
  5352. this.currentIndex = -1;
  5353. }
  5354. else {
  5355. $(items[this.currentIndex]).css("background-color", "#BEBEBE");
  5356. this.$textCode.val($(items[this.currentIndex]).find("a").text().split(" ")[0]);
  5357. }
  5358. this.refreshScroll(dropDown, this.currentIndex);
  5359. e.preventDefault();
  5360. return;
  5361. }
  5362. else if (e.keyCode === Keys_7.Keys.ENTER || e.keyCode === Keys_7.Keys.NUMPAD_ENTER) {
  5363. dropDown.css("display", "none");
  5364. if (this.currentIndex >= 0 && this.currentIndex < items.length) {
  5365. var text = $(items[this.currentIndex]).find("a").text();
  5366. var val = text.split(" ")[0];
  5367. this.$textCode.val(val);
  5368. EventHub_14.EventHub.dispatchEvent(MessageType_15.MessageType.WIDGET, { id: this.id, text: val, evtType: Event_12.Event.MODIFY });
  5369. EventHub_14.EventHub.dispatchEvent(MessageType_15.MessageType.WIDGET, { id: this.id, evtType: Event_12.Event.CLICK });
  5370. }
  5371. }
  5372. };
  5373. ExpandableText.prototype.showDropDown = function (e, value, showAll) {
  5374. var height = this.$textCode.height();
  5375. this.scrollIndexs = [0, this.maxShowItems - 1];
  5376. var pos = this.getPosition(this.$textCode[0]);
  5377. var tmpHeight = height + pos[0] + 14;
  5378. $("#" + this.expandableTextId + "_dropDown").remove();
  5379. var $dropDown = $(ExpandableText.Template1).attr("id", this.expandableTextId + "_dropDown");
  5380. $dropDown.attr({ mouseOn: "false" });
  5381. $dropDown.appendTo(document.body);
  5382. $dropDown.css("top", tmpHeight);
  5383. $dropDown.css("left", pos[1]);
  5384. $dropDown.css("background-color", "#FFFFFF");
  5385. this.currentIndex = -1;
  5386. var $liNode;
  5387. if (this.datas) {
  5388. if (showAll === true && value === "") {
  5389. for (var i = 0; i < this.datas.length; i++) {
  5390. $liNode = $(ExpandableText.Template2);
  5391. $liNode.find("a").text(this.datas[i]);
  5392. $liNode.appendTo($dropDown);
  5393. }
  5394. }
  5395. else if (value != "") {
  5396. for (var i = 0; i < this.datas.length; i++) {
  5397. if (this.datas[i].toLocaleLowerCase().indexOf(value) >= 0) {
  5398. $liNode = $(ExpandableText.Template2);
  5399. $liNode.find("a").text(this.datas[i]);
  5400. $liNode.appendTo($dropDown);
  5401. }
  5402. }
  5403. }
  5404. }
  5405. var len = $dropDown.find("li").length;
  5406. var inputNode = this.$textCode;
  5407. var tmpId = this.expandableTextId;
  5408. if (len > 0) {
  5409. $dropDown.find("li").find("a").on("click", function (e) {
  5410. var value = $(this).text();
  5411. var newValue = value.split(" ")[0];
  5412. $("#" + tmpId + "_input").val(newValue);
  5413. $("#" + tmpId + "_dropDown").css("display", "none");
  5414. EventHub_14.EventHub.dispatchEvent(MessageType_15.MessageType.WIDGET, { id: tmpId, text: newValue, evtType: Event_12.Event.MODIFY });
  5415. EventHub_14.EventHub.dispatchEvent(MessageType_15.MessageType.WIDGET, { id: tmpId, evtType: Event_12.Event.CLICK });
  5416. });
  5417. $dropDown.on("mouseover", function (e) {
  5418. $dropDown.attr("mouseOn", "true");
  5419. });
  5420. $dropDown.on("mouseout", function (e) {
  5421. $dropDown.attr("mouseOn", "false");
  5422. });
  5423. $dropDown.css("display", "block");
  5424. if (len > this.maxShowItems) {
  5425. var h = $($dropDown.find("li")[0]).height();
  5426. var maxHeight = h * this.maxShowItems;
  5427. $dropDown.css("height", maxHeight);
  5428. }
  5429. var own = this;
  5430. $(document).bind('click.' + this.expandableTextId + "_dropDown", function (e) {
  5431. if ((!$dropDown.is(e.target) && !inputNode.is(e.target)) || $dropDown.css("display") === "none") {
  5432. $dropDown.css("display", "none");
  5433. $(document).unbind('click.' + tmpId + "_dropDown");
  5434. }
  5435. });
  5436. }
  5437. else {
  5438. $dropDown.css("display", "none");
  5439. }
  5440. };
  5441. ExpandableText.prototype.getPosition = function (obj) {
  5442. var pos = [0, 0];
  5443. if (obj && obj.offsetParent) {
  5444. while (obj && obj.offsetParent) {
  5445. pos[0] += obj.offsetTop;
  5446. pos[1] += obj.offsetLeft;
  5447. obj = obj.offsetParent;
  5448. }
  5449. }
  5450. return pos;
  5451. };
  5452. ExpandableText.prototype.refreshScroll = function ($dropDown, currentIndex) {
  5453. if (currentIndex === -1) {
  5454. return;
  5455. }
  5456. var count = $dropDown.find("li").length - 1;
  5457. var needRefresh = false;
  5458. if (currentIndex < this.scrollIndexs[0]) {
  5459. var endIndex = currentIndex + this.maxShowItems - 1;
  5460. endIndex = endIndex > count ? count : endIndex;
  5461. this.scrollIndexs = [currentIndex, endIndex];
  5462. needRefresh = true;
  5463. }
  5464. else if (currentIndex > this.scrollIndexs[1]) {
  5465. var beginIndex = currentIndex - this.maxShowItems + 1;
  5466. beginIndex = beginIndex < 0 ? 0 : beginIndex;
  5467. this.scrollIndexs = [beginIndex, currentIndex];
  5468. needRefresh = true;
  5469. }
  5470. if (needRefresh) {
  5471. var h = $dropDown.find("li").height();
  5472. $dropDown[0].scrollTop = h * this.scrollIndexs[0];
  5473. }
  5474. };
  5475. ExpandableText.prototype.handleInput = function (e, value) {
  5476. var tmpId = this.expandableTextId;
  5477. EventHub_14.EventHub.dispatchEvent(MessageType_15.MessageType.WIDGET, { id: tmpId, text: value, evtType: Event_12.Event.MODIFY });
  5478. this.showDropDown(e, value.toLocaleLowerCase(), false);
  5479. };
  5480. ExpandableText.prototype.handleBlur = function (e) {
  5481. var mouseOn = $("#" + this.expandableTextId + "_dropDown").attr("mouseOn");
  5482. if (mouseOn === "false") {
  5483. $("#" + this.expandableTextId + "_dropDown").css("display", "none");
  5484. }
  5485. };
  5486. ExpandableText.prototype.handleKeyDownEvent = function (e, hasFilter) {
  5487. if ($("#" + this.expandableTextId + "_dropDown").css("display") === "block") {
  5488. if (e.keyCode === Keys_7.Keys.ENTER || e.keyCode === Keys_7.Keys.NUMPAD_ENTER || e.keyCode === Keys_7.Keys.DOWN_ARROW
  5489. || e.keyCode === Keys_7.Keys.UP_ARROW) {
  5490. return;
  5491. }
  5492. }
  5493. if (e.keyCode === Keys_7.Keys.LEFT_ARROW
  5494. || e.keyCode === Keys_7.Keys.RIGHT_ARROW) {
  5495. return;
  5496. }
  5497. _super.prototype.handleKeyDownEvent.call(this, e, hasFilter);
  5498. };
  5499. ExpandableText.prototype.handleKeyUpEvent = function (e) {
  5500. if ($("#" + this.expandableTextId + "_dropDown").css("display") === "block") {
  5501. if (e.keyCode === Keys_7.Keys.ENTER || e.keyCode === Keys_7.Keys.NUMPAD_ENTER || e.keyCode === Keys_7.Keys.DOWN_ARROW
  5502. || e.keyCode === Keys_7.Keys.UP_ARROW) {
  5503. return;
  5504. }
  5505. }
  5506. if (e.keyCode === Keys_7.Keys.LEFT_ARROW
  5507. || e.keyCode === Keys_7.Keys.RIGHT_ARROW) {
  5508. return;
  5509. }
  5510. _super.prototype.handleKeyUpEvent.call(this, e);
  5511. };
  5512. ExpandableText.TemplateNormal = "\n <div class=\"input-field\">\n <i></i>\n <input type=\"text\">\n <label></label>\n </div>";
  5513. ExpandableText.Template1 = "\n <ul class=\"adore_dropDown dropdown-content\" style=\"opacity:1;\">\n </ul>";
  5514. ExpandableText.Template2 = "\n <li>\n <a href='#!' style=\" \"></a>\n </li>";
  5515. return ExpandableText;
  5516. }(Widget_14.Widget));
  5517. exports.ExpandableText = ExpandableText;
  5518. });
  5519. define("widget/FlatTree", ["require", "exports", "widget/Widget", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, Widget_15, EventHub_15, MessageType_16, Event_13) {
  5520. "use strict";
  5521. var FlatTree = (function (_super) {
  5522. __extends(FlatTree, _super);
  5523. function FlatTree(parentId, id, style) {
  5524. _super.call(this, parentId, id, style);
  5525. this.$thisNode = $(FlatTree.Template).attr("id", this.id);
  5526. this.oneDegree = this.$thisNode.find(".wrap_flatTree:eq(0)").attr("id", "one_" + this.id);
  5527. this.twoDegree = this.$thisNode.find(".wrap_flatTree:eq(1)").attr("id", "two_" + this.id);
  5528. this.threeDegree = this.$thisNode.find(".wrap_flatTree:eq(2)").attr("id", "three_" + this.id);
  5529. this.fourDegree = this.$thisNode.find(".wrap_flatTree:eq(3)").attr("id", "four_" + this.id);
  5530. this.contentOne = new Array();
  5531. this.contentTwo = new Array();
  5532. this.contentThree = new Array();
  5533. this.contentFour = new Array();
  5534. }
  5535. FlatTree.prototype.setContents = function (args) {
  5536. var data = JSON.parse(args.attribute);
  5537. for (var key in data) {
  5538. var cutKey;
  5539. var location;
  5540. var m;
  5541. var n;
  5542. var k;
  5543. var h;
  5544. var belongTo = key.length - key.replace(/,/g, "").length;
  5545. switch (belongTo) {
  5546. case 0:
  5547. this.contentOne[parseInt(key)] = data[key];
  5548. this.contentTwo[parseInt(key)] = new Array();
  5549. this.contentThree[parseInt(key)] = new Array();
  5550. this.contentFour[parseInt(key)] = new Array();
  5551. break;
  5552. case 1:
  5553. cutKey = key.substr(1, key.length - 2);
  5554. location = cutKey.split(",");
  5555. m = Number(location[0]);
  5556. n = Number(location[1]);
  5557. this.contentTwo[m][n] = data[key];
  5558. this.contentThree[m][n] = new Array();
  5559. this.contentFour[m][n] = new Array();
  5560. break;
  5561. case 2:
  5562. cutKey = key.substr(1, key.length - 2);
  5563. location = cutKey.split(",");
  5564. var m = Number(location[0]);
  5565. var n = Number(location[1]);
  5566. var k = Number(location[2]);
  5567. this.contentThree[m][n][k] = data[key];
  5568. this.contentFour[m][n][k] = new Array();
  5569. break;
  5570. case 3:
  5571. cutKey = key.substr(1, key.length - 2);
  5572. location = cutKey.split(",");
  5573. var m = Number(location[0]);
  5574. var n = Number(location[1]);
  5575. var k = Number(location[2]);
  5576. var h = Number(location[3]);
  5577. this.contentFour[m][n][k][h] = data[key];
  5578. break;
  5579. default:
  5580. console.log("data error");
  5581. break;
  5582. }
  5583. }
  5584. };
  5585. FlatTree.prototype.setIconPaths = function (args) {
  5586. var pathData = JSON.parse(args.iconPaths);
  5587. for (var key in pathData) {
  5588. var path = pathData[key].replace(/\\/g, "\\\\");
  5589. this.oneDegree.find("img:eq(" + parseInt(key) + ")").attr("src", path);
  5590. }
  5591. };
  5592. FlatTree.prototype.setRootTitle = function (args) {
  5593. this.$thisNode.find(".breadCumb a:eq(0)").html(args.rootTitle);
  5594. };
  5595. FlatTree.prototype.initFlatTree = function () {
  5596. var Index1 = 0;
  5597. var Index2 = 0;
  5598. var Index3 = 0;
  5599. var Index4 = 0;
  5600. var own = this;
  5601. this.$thisNode.find(".breadCumb a:eq(0)").html("全部菜单");
  5602. for (var i = 0, z = this.contentOne.length; i < z; i++) {
  5603. $(FlatTree.TemplateOneItem).appendTo(this.oneDegree);
  5604. this.oneDegree.find("span:eq(" + i + ")").text(this.contentOne[i]);
  5605. this.oneDegree.show();
  5606. }
  5607. this.oneDegree.on("click", "a", {
  5608. contentTwo: this.contentTwo,
  5609. contentThree: this.contentThree
  5610. }, function (event) {
  5611. Index1 = own.oneDegree.find("a").index($(this));
  5612. if (event.data.contentTwo[Index1].length > 0) {
  5613. for (var i = 0, z = event.data.contentTwo[Index1].length; i < z; i++) {
  5614. $(FlatTree.TemplateOtherItem).appendTo(own.twoDegree);
  5615. own.twoDegree.find("span:eq(" + i + ")").text(event.data.contentTwo[Index1][i]);
  5616. if (event.data.contentThree[Index1][i].length > 0) {
  5617. own.twoDegree.find("img:eq(" + i + ")").attr("src", "images/flat_tree/u235.png");
  5618. }
  5619. else {
  5620. own.twoDegree.find("img:eq(" + i + ")").attr("src", "images/flat_tree/u88.png");
  5621. }
  5622. }
  5623. own.$thisNode.find(".breadCumb a:eq(1)").html($(this).find("span").html());
  5624. own.$thisNode.find(".breadCumb div:eq(0)").css("display", "inline-block");
  5625. own.oneDegree.hide();
  5626. own.twoDegree.show();
  5627. }
  5628. var content = "" + Index1;
  5629. EventHub_15.EventHub.dispatchEvent(MessageType_16.MessageType.WIDGET, {
  5630. id: own.id,
  5631. location: content,
  5632. evtType: Event_13.Event.CLICK
  5633. });
  5634. });
  5635. this.twoDegree.on("click", "a", {
  5636. contentThree: this.contentThree,
  5637. contentFour: this.contentFour
  5638. }, function (event) {
  5639. Index2 = own.twoDegree.find("a").index($(this));
  5640. if (event.data.contentThree[Index1][Index2].length > 0) {
  5641. for (var i = 0, z = event.data.contentThree[Index1][Index2].length; i < z; i++) {
  5642. $(FlatTree.TemplateOtherItem).appendTo(own.threeDegree);
  5643. own.threeDegree.find("span:eq(" + i + ")").text(event.data.contentThree[Index1][Index2][i]);
  5644. if (event.data.contentFour[Index1][Index2][i].length > 0) {
  5645. own.threeDegree.find("img:eq(" + i + ")").attr("src", "images/flat_tree/u235.png");
  5646. }
  5647. else {
  5648. own.threeDegree.find("img:eq(" + i + ")").attr("src", "images/flat_tree/u88.png");
  5649. }
  5650. }
  5651. own.$thisNode.find(".breadCumb a:eq(2)").html($(this).find("span").html());
  5652. own.$thisNode.find(".breadCumb div:eq(1)").css("display", "inline-block");
  5653. own.twoDegree.hide();
  5654. own.threeDegree.show();
  5655. }
  5656. var content = '[' + Index1 + ',' + Index2 + ']';
  5657. EventHub_15.EventHub.dispatchEvent(MessageType_16.MessageType.WIDGET, {
  5658. id: own.id,
  5659. location: content,
  5660. evtType: Event_13.Event.CLICK
  5661. });
  5662. });
  5663. this.threeDegree.on("click", "a", {
  5664. contentFour: this.contentFour
  5665. }, function (event) {
  5666. Index3 = own.threeDegree.find("a").index($(this));
  5667. if (event.data.contentFour[Index1][Index2][Index3].length > 0) {
  5668. for (var i = 0, z = event.data.contentFour[Index1][Index2][Index3].length; i < z; i++) {
  5669. $(FlatTree.TemplateOtherItem).appendTo(own.fourDegree);
  5670. own.fourDegree.find("span:eq(" + i + ")").text(event.data.contentFour[Index1][Index2][Index3][i]);
  5671. own.fourDegree.find("img:eq(" + i + ")").attr("src", "images/flat_tree/u88.png");
  5672. }
  5673. own.$thisNode.find(".breadCumb a:eq(3)").html($(this).find("span").html());
  5674. own.$thisNode.find(".breadCumb div:eq(2)").css("display", "inline-block");
  5675. own.threeDegree.hide();
  5676. own.fourDegree.show();
  5677. }
  5678. var content = '[' + Index1 + ',' + Index2 + ',' + Index3 + ']';
  5679. EventHub_15.EventHub.dispatchEvent(MessageType_16.MessageType.WIDGET, {
  5680. id: own.id,
  5681. location: content,
  5682. evtType: Event_13.Event.CLICK
  5683. });
  5684. });
  5685. this.fourDegree.on("click", "a", function (event) {
  5686. Index4 = own.fourDegree.find("a").index($(this));
  5687. var content = '[' + Index1 + ',' + Index2 + ',' + Index3 + ',' + Index4 + ']';
  5688. EventHub_15.EventHub.dispatchEvent(MessageType_16.MessageType.WIDGET, {
  5689. id: own.id,
  5690. location: content,
  5691. evtType: Event_13.Event.CLICK
  5692. });
  5693. });
  5694. own.$thisNode.find(".breadCumb a").on("click", function () {
  5695. var index_bread = own.$thisNode.find(".breadCumb a").index($(this));
  5696. own.$thisNode.find(".wrap_flatTree:eq(" + index_bread + ")").show().siblings(".wrap_flatTree").hide();
  5697. own.$thisNode.find(".wrap_flatTree:eq(" + index_bread + ")").nextAll().empty();
  5698. if (index_bread > 0) {
  5699. $(this).parent("div").nextAll("div").hide();
  5700. }
  5701. else {
  5702. $(this).nextAll("div").hide();
  5703. }
  5704. });
  5705. };
  5706. FlatTree.prototype.dispose = function () {
  5707. _super.prototype.dispose.call(this);
  5708. };
  5709. FlatTree.Template = "\n <div class=\"adore_flatTree\">\n <div class=\"breadCumb\">\n <!-- \u6839\u76EE\u5F55 -->\n <a href=\"javascript:void(0)\"></a>\n <div>\n <span>&gt;</span>\n <a href=\"javascript:void(0)\"></a>\n </div>\n <div>\n <span>&gt;</span>\n <a href=\"javascript:void(0)\"></a>\n </div>\n <div>\n <span>&gt;</span>\n <a href=\"javascript:void(0)\"></a>\n </div>\n </div>\n <div class=\"wrap_flatTree\">\n </div>\n <div class=\"wrap_flatTree\">\n </div>\n <div class=\"wrap_flatTree\">\n </div>\n <div class=\"wrap_flatTree\">\n </div>\n </div>";
  5710. FlatTree.TemplateOneItem = "\n <a class=\"oneItem\" href=\"javascript:void(0)\">\n <img class=\"img \" src=\"images/flat_tree/u152.png\">\n <span></span>\n </a>";
  5711. FlatTree.TemplateOtherItem = "\n <a class=\"otherItem\" href=\"javascript:void(0)\">\n <img class=\"img \" src=\"\">\n <span></span>\n </a>";
  5712. return FlatTree;
  5713. }(Widget_15.Widget));
  5714. exports.FlatTree = FlatTree;
  5715. });
  5716. define("widget/FloatPanelButton", ["require", "exports", "widget/Widget"], function (require, exports, Widget_16) {
  5717. "use strict";
  5718. var FloatPanelButton = (function (_super) {
  5719. __extends(FloatPanelButton, _super);
  5720. function FloatPanelButton(parentId, id, style) {
  5721. _super.call(this, parentId, id, style);
  5722. this.$thisNode = $(FloatPanelButton.TemplateCotainer).attr({ id: this.id });
  5723. }
  5724. FloatPanelButton.prototype.setText = function (args) {
  5725. var text = args.text;
  5726. this.$thisNode.find(".personal_info_name").text(text);
  5727. };
  5728. FloatPanelButton.prototype.setImagePath = function (args) {
  5729. var imagePath = args.imagePath;
  5730. this.$thisNode.find("img.info_image").attr("src", imagePath);
  5731. };
  5732. FloatPanelButton.TemplateCotainer = "\n <div class=\"personal_info\">\n <img class=\"info_image\"/>\n <span class=\"personal_info_name\"></span><i class=\"mdi-navigation-arrow-drop-down personal_info_arrow\"></i>\n </div>\n ";
  5733. return FloatPanelButton;
  5734. }(Widget_16.Widget));
  5735. exports.FloatPanelButton = FloatPanelButton;
  5736. });
  5737. define("widget/FloatPanelComposite", ["require", "exports", "widget/Composite", "util/WidgetManager", "widget/CheckButton"], function (require, exports, Composite_4, WidgetManager_4, CheckButton_1) {
  5738. "use strict";
  5739. var FloatPanelComposite = (function (_super) {
  5740. __extends(FloatPanelComposite, _super);
  5741. function FloatPanelComposite(parentId, id, style) {
  5742. _super.call(this, parentId, id, style);
  5743. this.bindClickCount = 0;
  5744. this.$wrapNode = $(FloatPanelComposite.TemplateWrapper).attr("id", this.id + "wrapper");
  5745. this.$thisNode = $(FloatPanelComposite.TemplateCotainer).attr("id", this.id);
  5746. this.$attachNode = this.$thisNode;
  5747. this.$arrowNode = $(FloatPanelComposite.TemplateArrow).attr("id", "arrow" + this.id);
  5748. var own = this;
  5749. this.resizeListener = function () {
  5750. if (own.$thisNode.css("display") === "block") {
  5751. own.$thisNode.css("display", "none");
  5752. own.$arrowNode.hide();
  5753. $(".float_panel_iframe").hide();
  5754. $(document).find(".personal_info_arrow").removeClass("mdi-navigation-arrow-drop-up").addClass("mdi-navigation-arrow-drop-down");
  5755. }
  5756. };
  5757. $(window).on("resize", this.resizeListener);
  5758. }
  5759. FloatPanelComposite.prototype.getPosition = function (obj) {
  5760. var pos = [0, 0];
  5761. if (obj && obj.offsetParent) {
  5762. while (obj && obj.offsetParent) {
  5763. pos[0] += obj.offsetTop;
  5764. pos[1] += obj.offsetLeft;
  5765. obj = obj.offsetParent;
  5766. }
  5767. }
  5768. return pos;
  5769. };
  5770. FloatPanelComposite.prototype.addDocumentBind = function (wid) {
  5771. var own = this;
  5772. $(document).bind('click.' + wid + "_dropDown", function (e) {
  5773. var $source = $(document).find("#" + wid);
  5774. var isSource = false;
  5775. var sourceParent = e.target;
  5776. while (sourceParent) {
  5777. if ($source.is(sourceParent)) {
  5778. isSource = true;
  5779. break;
  5780. }
  5781. sourceParent = sourceParent.parentElement;
  5782. }
  5783. if (!isSource) {
  5784. var isHide = true;
  5785. if (own.$thisNode.css("display") !== "none") {
  5786. var targetParent = e.target;
  5787. while (targetParent) {
  5788. if (own.$thisNode.is(targetParent)) {
  5789. isHide = false;
  5790. break;
  5791. }
  5792. targetParent = targetParent.parentElement;
  5793. }
  5794. if (isHide) {
  5795. own.$thisNode.css("display", "none");
  5796. own.$arrowNode.hide();
  5797. $(".float_panel_iframe").hide();
  5798. $source.find(".personal_info_arrow").removeClass("mdi-navigation-arrow-drop-up").addClass("mdi-navigation-arrow-drop-down");
  5799. $(document).unbind('click.' + wid + "_dropDown");
  5800. }
  5801. }
  5802. else {
  5803. $(document).unbind('click.' + wid + "_dropDown");
  5804. }
  5805. }
  5806. });
  5807. };
  5808. FloatPanelComposite.prototype.setLocation = function (target, isUp) {
  5809. var pos = this.getPosition(target[0]);
  5810. var height = target.height();
  5811. var tmpHeight;
  5812. var iframeTop;
  5813. if (isUp) {
  5814. tmpHeight = pos[0] - this.$thisNode.height() - 5;
  5815. this.$arrowNode.css("top", pos[0] - 21);
  5816. this.$arrowNode.removeClass("mdi-navigation-arrow-drop-up").addClass("mdi-navigation-arrow-drop-down");
  5817. iframeTop = tmpHeight;
  5818. }
  5819. else {
  5820. tmpHeight = height + pos[0] + 5;
  5821. this.$arrowNode.css("top", tmpHeight - 19);
  5822. iframeTop = this.$arrowNode.css("top");
  5823. }
  5824. this.$thisNode.css("top", tmpHeight);
  5825. this.$thisNode.css("left", pos[1]);
  5826. var width = this.$thisNode.width();
  5827. var limitWidth = document.body.clientWidth - pos[1];
  5828. if (width > limitWidth) {
  5829. this.$thisNode.css("left", document.body.clientWidth - width - 2);
  5830. }
  5831. this.$arrowNode.css("left", pos[1] + this.$thisNode.width() / 3 * 2);
  5832. $(".float_panel_content > div").css({
  5833. "position": "static"
  5834. });
  5835. $(".float_panel_iframe").css({
  5836. "width": this.$thisNode.width(),
  5837. "height": this.$thisNode.height() + 20,
  5838. "top": iframeTop,
  5839. "left": this.$thisNode.css("left"),
  5840. "display": "block"
  5841. });
  5842. };
  5843. FloatPanelComposite.prototype.bindClick = function (args) {
  5844. var wid = args.item.wid;
  5845. var bindWidget = WidgetManager_4.WidgetManager.byId(wid);
  5846. var own = this;
  5847. if (bindWidget) {
  5848. var $bindNode = bindWidget.$thisNode;
  5849. if (bindWidget instanceof CheckButton_1.CheckButton) {
  5850. $bindNode = $bindNode.find("input");
  5851. }
  5852. $bindNode.on("click", function (e) {
  5853. if (own.$thisNode.css("display") === "none") {
  5854. own.$thisNode.css("display", "block");
  5855. own.$arrowNode.show();
  5856. own.setLocation(bindWidget.$thisNode, args.item.isUp);
  5857. own.addDocumentBind(wid);
  5858. $(this).find(".personal_info_arrow").removeClass("mdi-navigation-arrow-drop-down").addClass("mdi-navigation-arrow-drop-up");
  5859. }
  5860. else {
  5861. own.$thisNode.css("display", "none");
  5862. own.$arrowNode.hide();
  5863. $(".float_panel_iframe").hide();
  5864. $(this).find(".personal_info_arrow").removeClass("mdi-navigation-arrow-drop-up").addClass("mdi-navigation-arrow-drop-down");
  5865. }
  5866. });
  5867. }
  5868. else {
  5869. this.bindClickCount++;
  5870. if (this.bindClickCount > 5) {
  5871. return;
  5872. }
  5873. setTimeout(function () {
  5874. own.bindClick(args);
  5875. }, 300);
  5876. }
  5877. };
  5878. FloatPanelComposite.prototype.dispose = function () {
  5879. $(window).off("resize", this.resizeListener);
  5880. _super.prototype.dispose.call(this);
  5881. this.$wrapNode.remove();
  5882. };
  5883. FloatPanelComposite.prototype.setEnabled = function (args) {
  5884. var enabled = args.enabled;
  5885. if (!enabled) {
  5886. if (this.$thisNode.css("display") !== "none") {
  5887. this.$wrapNode.css("display", "none");
  5888. this.$thisNode.css("display", "none");
  5889. }
  5890. }
  5891. };
  5892. FloatPanelComposite.prototype.setVisible = function (args) {
  5893. var visible = args.visible;
  5894. if (visible) {
  5895. this.$wrapNode.css("display", "block");
  5896. this.$thisNode.css("display", "block");
  5897. }
  5898. else {
  5899. this.$wrapNode.css("display", "none");
  5900. this.$thisNode.css("display", "none");
  5901. }
  5902. };
  5903. FloatPanelComposite.prototype.append = function () {
  5904. this.$thisNode.appendTo(this.$wrapNode.find(".content_wrap"));
  5905. this.$arrowNode.appendTo(this.$wrapNode.find(".content_wrap"));
  5906. this.$wrapNode.appendTo(document.body);
  5907. };
  5908. FloatPanelComposite.TemplateWrapper = "\n <div>\n\t <iframe class=\"float_panel_iframe\"></iframe>\n\t <div class=\"content_wrap\">\n\t </div>\n </div>\n ";
  5909. FloatPanelComposite.TemplateCotainer = "<div class=\"float_panel_content adore-hidden-scrollbar\"></div>";
  5910. FloatPanelComposite.TemplateArrow = "<i class=\"float_panel_arrow mdi-navigation-arrow-drop-up\"></i>";
  5911. return FloatPanelComposite;
  5912. }(Composite_4.Composite));
  5913. exports.FloatPanelComposite = FloatPanelComposite;
  5914. });
  5915. define("widget/Group", ["require", "exports", "widget/Composite"], function (require, exports, Composite_5) {
  5916. "use strict";
  5917. var Group = (function (_super) {
  5918. __extends(Group, _super);
  5919. function Group(parentId, id, style) {
  5920. _super.call(this, parentId, id, style);
  5921. }
  5922. Group.prototype.layout = function () {
  5923. _super.prototype.layout.call(this);
  5924. this.$thisNode.addClass("adore_group");
  5925. $("<div class='adore_group_topCuttingLine'>").insertBefore(this.$thisNode);
  5926. $("<div class='adore_group_bottomCuttingLine'>").insertBefore(this.$thisNode);
  5927. };
  5928. Group.prototype.toString = function () {
  5929. return "Group";
  5930. };
  5931. Group.prototype.setFocus = function () {
  5932. };
  5933. return Group;
  5934. }(Composite_5.Composite));
  5935. exports.Group = Group;
  5936. });
  5937. define("widget/HTMLFragment", ["require", "exports", "widget/Widget"], function (require, exports, Widget_17) {
  5938. "use strict";
  5939. var HTMLFragment = (function (_super) {
  5940. __extends(HTMLFragment, _super);
  5941. function HTMLFragment(parentId, id, style) {
  5942. _super.call(this, parentId, id, style);
  5943. this.cssPaths = [];
  5944. this.$thisNode = $(HTMLFragment.Template).attr({ id: this.id });
  5945. }
  5946. HTMLFragment.prototype.html = function (args) {
  5947. if (args.html) {
  5948. this.$thisNode.html(args.html);
  5949. }
  5950. };
  5951. HTMLFragment.prototype.setHtmlFragments = function (args) {
  5952. var htmls = args.htmlFragments;
  5953. if (htmls && htmls.length > 0) {
  5954. var tempArr = new Array();
  5955. for (var i = 0; i < htmls.length; i++) {
  5956. var fragmentNode = this.$thisNode.find("#" + htmls[i].fragmentID);
  5957. if (fragmentNode.length > 0) {
  5958. fragmentNode.html(htmls[i].html);
  5959. }
  5960. else {
  5961. tempArr.push(htmls[i]);
  5962. }
  5963. }
  5964. var count = args.count ? 0 : args.count;
  5965. if (tempArr.length > 0 && count <= 2) {
  5966. setTimeout(this.setHtmlFragments({ htmlFragments: tempArr, count: (count + 1) }), 200);
  5967. }
  5968. }
  5969. };
  5970. HTMLFragment.prototype.setImages = function (args) {
  5971. var images = args.images;
  5972. if (images && images.length > 0) {
  5973. var tempArr = new Array();
  5974. for (var i = 0; i < images.length; i++) {
  5975. var imageNode = this.$thisNode.find("#" + images[i].imageID);
  5976. if (imageNode.length > 0) {
  5977. imageNode.attr("src", images[i].imagePath);
  5978. }
  5979. else {
  5980. tempArr.push(images[i]);
  5981. }
  5982. }
  5983. var count = args.count ? 0 : args.count;
  5984. if (tempArr.length > 0 && count <= 2) {
  5985. setTimeout(this.setImages({ images: tempArr, count: (count + 1) }), 200);
  5986. }
  5987. }
  5988. };
  5989. HTMLFragment.prototype.setTexts = function (args) {
  5990. var texts = args.texts;
  5991. if (texts && texts.length > 0) {
  5992. var tempArr = new Array();
  5993. for (var i = 0; i < texts.length; i++) {
  5994. var textNode = this.$thisNode.find("#" + texts[i].textID);
  5995. if (textNode.length > 0) {
  5996. textNode.text(texts[i].text);
  5997. }
  5998. else {
  5999. tempArr.push(texts[i]);
  6000. }
  6001. }
  6002. var count = args.count ? 0 : args.count;
  6003. if (tempArr.length > 0 && count <= 2) {
  6004. setTimeout(this.setTexts({ texts: tempArr, count: (count + 1) }), 200);
  6005. }
  6006. }
  6007. };
  6008. HTMLFragment.prototype.setCssPaths = function (args) {
  6009. var cssPaths = args.cssPaths;
  6010. if (cssPaths && cssPaths.length > 0) {
  6011. var $headNode = $("head");
  6012. for (var i = 0; i < cssPaths.length; i++) {
  6013. if ($headNode.find("#" + cssPaths[i].cssID).length === 0) {
  6014. $("<link href='" + cssPaths[i].cssPath + "' type='text/css' rel='stylesheet'>").attr("id", cssPaths[i].cssID).appendTo($headNode);
  6015. this.cssPaths.push(cssPaths[i].cssID);
  6016. }
  6017. }
  6018. }
  6019. };
  6020. HTMLFragment.prototype.dispose = function () {
  6021. _super.prototype.dispose.call(this);
  6022. var $headNode = $("head");
  6023. for (var i = 0; i < this.cssPaths.length; i++) {
  6024. $headNode.find("#" + this.cssPaths[i]).remove();
  6025. }
  6026. this.cssPaths.splice(0, this.cssPaths.length);
  6027. };
  6028. HTMLFragment.Template = "<div></div>";
  6029. return HTMLFragment;
  6030. }(Widget_17.Widget));
  6031. exports.HTMLFragment = HTMLFragment;
  6032. });
  6033. define("widget/IFrame", ["require", "exports", "widget/Widget"], function (require, exports, Widget_18) {
  6034. "use strict";
  6035. var IFrame = (function (_super) {
  6036. __extends(IFrame, _super);
  6037. function IFrame(parentId, id, style) {
  6038. _super.call(this, parentId, id, style);
  6039. this.$thisNode = $(IFrame.Template).attr({ id: this.id });
  6040. var frameId = this.id;
  6041. this.$thisNode.find("iframe").attr({ width: "100%", height: "100%" }).on("load", function () {
  6042. });
  6043. }
  6044. IFrame.prototype.setURL = function (args) {
  6045. var src = args.url;
  6046. this.$thisNode.find("iframe").attr("src", src);
  6047. };
  6048. IFrame.prototype.setHighDpi = function (args) {
  6049. var viewPortMeta = $("meta[name=viewport]");
  6050. if (args.highDpi) {
  6051. viewPortMeta.attr("content", "user-scalable=no, initial-scale=0.5, maximum-scale=0.5, minimum-scale=0.5, width=device-width, height=device-height, target-densitydpi=device-dpi");
  6052. }
  6053. else {
  6054. viewPortMeta.attr("content", "width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no");
  6055. }
  6056. };
  6057. IFrame.prototype.execute = function (args) {
  6058. var script = args.script;
  6059. var myFrame = this.$thisNode.find("iframe")[0];
  6060. if (myFrame.contentDocument) {
  6061. var myDocument = myFrame.contentDocument;
  6062. script = script.replace(/document/g, "myDocument");
  6063. eval(script);
  6064. }
  6065. else {
  6066. console.error("iframe.contentDocument not found!");
  6067. }
  6068. };
  6069. IFrame.Template = "\n <div>\n <iFrame></iFrame>\n </div>";
  6070. return IFrame;
  6071. }(Widget_18.Widget));
  6072. exports.IFrame = IFrame;
  6073. });
  6074. define("widget/Image", ["require", "exports", "widget/Widget", "ADORE"], function (require, exports, Widget_19, ADORE_7) {
  6075. "use strict";
  6076. var Image = (function (_super) {
  6077. __extends(Image, _super);
  6078. function Image(parentId, id, style) {
  6079. _super.call(this, parentId, id, style);
  6080. this.isLayout = false;
  6081. this.isZoom = false;
  6082. var tmpTemplate = Image.TemplateNormal;
  6083. var isFloat = false;
  6084. if ((style & ADORE_7.ADORE.Zoom) === ADORE_7.ADORE.Zoom) {
  6085. tmpTemplate = Image.TemplateZoom;
  6086. this.isZoom = true;
  6087. }
  6088. else if ((style & ADORE_7.ADORE.Float) === ADORE_7.ADORE.Float) {
  6089. tmpTemplate = Image.TemplateFloat;
  6090. isFloat = true;
  6091. }
  6092. this.$thisNode = $(tmpTemplate).attr({ id: this.id });
  6093. if (isFloat) {
  6094. this.$imgNode = this.$thisNode.find("img");
  6095. }
  6096. else {
  6097. this.$imgNode = this.$thisNode;
  6098. }
  6099. this.$imgNode.attr({ alt: "图片不存在" });
  6100. }
  6101. Image.prototype.setSrc = function (args) {
  6102. var path = args.src;
  6103. this.$imgNode.attr("src", path);
  6104. if (this.isLayout && this.isZoom) {
  6105. this.$imgNode.materialbox();
  6106. }
  6107. };
  6108. Image.prototype.setFocus = function () {
  6109. };
  6110. Image.prototype.postLayout = function () {
  6111. if (this.isZoom) {
  6112. this.$imgNode.materialbox();
  6113. }
  6114. this.isLayout = true;
  6115. };
  6116. Image.TemplateNormal = "<img class=\"responsive-img\">";
  6117. Image.TemplateFloat = "\n <div>\n <img class=\"circle responsive-img\">\n </div>";
  6118. Image.TemplateZoom = "<img class=\"materialboxed responsive-img\">";
  6119. return Image;
  6120. }(Widget_19.Widget));
  6121. exports.Image = Image;
  6122. });
  6123. define("widget/ImageViewer", ["require", "exports", "widget/Widget", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, Widget_20, EventHub_16, MessageType_17, Event_14) {
  6124. "use strict";
  6125. var ImageViewer = (function (_super) {
  6126. __extends(ImageViewer, _super);
  6127. function ImageViewer(parentId, id, style) {
  6128. _super.call(this, parentId, id, style);
  6129. this.$thisNode = $(ImageViewer.Template).attr("id", this.id);
  6130. this.$pictureList = this.$thisNode.find(".picture_list");
  6131. this.$btnBig = this.$thisNode.find(".adore_picture_blowup");
  6132. this.$btnSmall = this.$thisNode.find(".adore_picture_reduce");
  6133. this.$btnReset = this.$thisNode.find(".adore_picture_reset");
  6134. }
  6135. ImageViewer.prototype.blowup = function () {
  6136. this.imgWidth = $(".adore_picture_preview_img").width();
  6137. this.imgHeight = $(".adore_picture_preview_img").height();
  6138. if ((this.imgHeight <= this.imgHeight * 2) || (this.imgWidth <= this.imgWidth * 2)) {
  6139. this.imgHeight = this.imgHeight + 20;
  6140. this.imgWidth = this.imgWidth + 20;
  6141. $(".adore_picture_preview_img").css("width", this.imgWidth + "px");
  6142. $(".adore_picture_preview_img").css("height", this.imgHeight + "px");
  6143. }
  6144. };
  6145. ImageViewer.prototype.reduce = function () {
  6146. this.imgWidth = $(".adore_picture_preview_img").width();
  6147. this.imgHeight = $(".adore_picture_preview_img").height();
  6148. if ((this.imgHeight > 200) && (this.imgWidth > 200)) {
  6149. this.imgHeight = this.imgHeight - 20;
  6150. this.imgWidth = this.imgWidth - 20;
  6151. $(".adore_picture_preview_img").css("width", this.imgWidth + "px");
  6152. $(".adore_picture_preview_img").css("height", this.imgHeight + "px");
  6153. }
  6154. };
  6155. ImageViewer.prototype.setImages = function (args) {
  6156. this.imgs = args.imgs;
  6157. if (this.imgs.length <= 0) {
  6158. return;
  6159. }
  6160. var own = this;
  6161. for (var i = 0; i < own.imgs.length; i++) {
  6162. var flag = own.imgs[i].replace(/\//g, "v");
  6163. flag = flag.replace(/\\/g, "v");
  6164. flag = flag.replace(/\:/g, "v");
  6165. flag = flag.replace(/\./g, "v");
  6166. if (own.$pictureList.find("#" + flag).length <= 0) {
  6167. own.$pictureList.append("<li id=\"" + flag + "\"><div style=\"float: left\"><input type='checkbox' value=\"" + own.imgs[i] + "\" name=\"choose\" class=\"adore_picture_checkbox\"/></div><img src=\"" + own.imgs[i] + "\" class=\"adore_picture_list_img\"/></li>");
  6168. }
  6169. }
  6170. this.$btnBig.click(function () {
  6171. if (own.$thisNode.find(".adore_picture_preview_img").length > 0) {
  6172. own.blowup();
  6173. }
  6174. });
  6175. this.$btnSmall.click(function () {
  6176. if (own.$thisNode.find(".adore_picture_preview_img").length > 0) {
  6177. own.reduce();
  6178. }
  6179. });
  6180. this.$btnReset.click(function () {
  6181. if (own.$thisNode.find(".adore_picture_preview_img").length > 0) {
  6182. $(".adore_picture_preview_img").css("width", own.width + "px");
  6183. $(".adore_picture_preview_img").css("height", own.height + "px");
  6184. }
  6185. });
  6186. this.$pictureList.click(function (event) {
  6187. var $li = $(this).children();
  6188. var cur = event.target;
  6189. var imgSrc;
  6190. own.$thisNode.find(".adore_picture_preview_img").remove();
  6191. if ($(cur).is($li)) {
  6192. $(cur).addClass("picture_select_current");
  6193. $(cur).siblings().removeClass("picture_select_current");
  6194. }
  6195. else if ($(cur).is("img")) {
  6196. $(cur).parent().addClass("picture_select_current");
  6197. $(cur).parent().siblings().removeClass("picture_select_current");
  6198. }
  6199. var $pictureli = own.$thisNode.find(".picture_select_current");
  6200. var $thisPicture = $pictureli.find(".adore_picture_list_img");
  6201. imgSrc = $thisPicture.attr("src");
  6202. if (imgSrc != null && imgSrc.length > 0) {
  6203. own.$thisNode.find(".adore_picture_preview").append("<img src=\"" + imgSrc + "\" class=\"adore_picture_preview_img\"/>");
  6204. own.width = $(".adore_picture_preview_img").width();
  6205. own.height = $(".adore_picture_preview_img").height();
  6206. }
  6207. });
  6208. var $checked = this.$thisNode.find("input[type='checkbox']");
  6209. for (var i = 0; i < $checked.length; i++) {
  6210. $checked.eq(i).click(function () {
  6211. if ($(this).is(":checked")) {
  6212. var result = $(this).val() + "";
  6213. EventHub_16.EventHub.dispatchEvent(MessageType_17.MessageType.WIDGET, {
  6214. id: own.id,
  6215. selectedImage: result,
  6216. evtType: Event_14.Event.CLICK
  6217. });
  6218. }
  6219. });
  6220. }
  6221. };
  6222. ImageViewer.prototype.removeImages = function (args) {
  6223. var rImgs = args.removeImgs;
  6224. for (var i = 0; i < rImgs.length; i++) {
  6225. var result = rImgs[i].replace(/\//g, "v");
  6226. result = result.replace(/\\/g, "v");
  6227. result = result.replace(/\:/g, "v");
  6228. result = result.replace(/\./g, "v");
  6229. this.$thisNode.find("#" + result).remove();
  6230. }
  6231. };
  6232. ImageViewer.Template = "\n <div class=\"adore_picture\">\n <div class=\"adore_picture_left\">\n <div class=\"adore_picture_text\">\u56FE\u7247\u5217\u8868</div>\n <!-- \u56FE\u7247\u5217\u8868-->\n <div class=\"adore_picture_list\">\n <ul class=\"picture_list\">\n \n </ul>\n </div>\n </div>\n <div class=\"adore_picture_right\">\n <div class=\"adore_picture_text\">\u56FE\u7247\u9884\u89C8</div>\n <!-- \u653E\u5927\u7F29\u5C0F\u6309\u94AE-->\n <div style=\"display: inline-block;width: 100%\">\n <img src=\"images/image_viewer/icon_blow_up.png\" class=\"adore_picture_blowup\" value=\"\u653E\u5927\" style=\"margin-right: 15px;float: right\"/>\n <img src=\"images/image_viewer/icon_reset.png\" class=\"adore_picture_reset\" value=\"\u8FD8\u539F\" style=\"margin-right: 15px;float: right\"/>\n <img src=\"images/image_viewer/icon_reduce.png\" class=\"adore_picture_reduce\" value=\"\u7F29\u5C0F\" style=\"margin-right: 15px;float: right\"/>\n </div>\n <!-- \u5927\u56FE\u9884\u89C8-->\n <div class=\"adore_picture_preview\">\n \n </div>\n </div>\n </div>";
  6233. return ImageViewer;
  6234. }(Widget_20.Widget));
  6235. exports.ImageViewer = ImageViewer;
  6236. });
  6237. define("widget/integration/AbstractContainer", ["require", "exports", "widget/Composite"], function (require, exports, Composite_6) {
  6238. "use strict";
  6239. var AbstractContainer = (function (_super) {
  6240. __extends(AbstractContainer, _super);
  6241. function AbstractContainer(parentId, id, style) {
  6242. _super.call(this, parentId, id, style);
  6243. this.reinitCount = 0;
  6244. AbstractContainer._this = this;
  6245. this.$thisNode = $("#" + id);
  6246. if (this.$thisNode.length === 0) {
  6247. setTimeout(AbstractContainer._this.reinit, 200);
  6248. }
  6249. else {
  6250. this.reset();
  6251. }
  6252. }
  6253. AbstractContainer.prototype.reinit = function () {
  6254. var own = AbstractContainer._this;
  6255. own.$thisNode = $("#" + own.id);
  6256. if (own.$thisNode.length === 0) {
  6257. if (own.reinitCount < 10) {
  6258. own.reinitCount++;
  6259. setTimeout(own.reinit, 200);
  6260. }
  6261. else {
  6262. console.error("not found element[" + own.id + "]");
  6263. }
  6264. }
  6265. else {
  6266. own.reset();
  6267. }
  6268. };
  6269. AbstractContainer.prototype.toString = function () {
  6270. return "AbstractContainer";
  6271. };
  6272. AbstractContainer.prototype.dispose = function () {
  6273. _super.prototype.dispose.call(this);
  6274. AbstractContainer._this = null;
  6275. };
  6276. AbstractContainer.prototype.append = function () {
  6277. };
  6278. AbstractContainer.prototype.layout = function () {
  6279. };
  6280. AbstractContainer.prototype.setLayoutData = function (args) {
  6281. };
  6282. return AbstractContainer;
  6283. }(Composite_6.Composite));
  6284. exports.AbstractContainer = AbstractContainer;
  6285. });
  6286. define("widget/integration/AbstractIntegration", ["require", "exports", "widget/Widget"], function (require, exports, Widget_21) {
  6287. "use strict";
  6288. var AbstractIntegration = (function (_super) {
  6289. __extends(AbstractIntegration, _super);
  6290. function AbstractIntegration(parentId, id, style) {
  6291. _super.call(this, null, id, style);
  6292. this.reinitCount = 0;
  6293. this.$thisNode = $("#" + id);
  6294. AbstractIntegration._this = this;
  6295. if (this.$thisNode.length === 0) {
  6296. setTimeout(AbstractIntegration._this.reinit, 200);
  6297. }
  6298. else {
  6299. this.reset();
  6300. }
  6301. }
  6302. AbstractIntegration.prototype.reinit = function () {
  6303. var own = AbstractIntegration._this;
  6304. own.$thisNode = $("#" + own.id);
  6305. if (own.$thisNode.length === 0) {
  6306. if (own.reinitCount < 10) {
  6307. own.reinitCount++;
  6308. setTimeout(own.reinit, 200);
  6309. }
  6310. else {
  6311. console.error("not found element[" + own.id + "]");
  6312. }
  6313. }
  6314. else {
  6315. own.reset();
  6316. }
  6317. };
  6318. AbstractIntegration.prototype.toString = function () {
  6319. return "AbstractIntegration";
  6320. };
  6321. AbstractIntegration.prototype.dispose = function () {
  6322. _super.prototype.dispose.call(this);
  6323. AbstractIntegration._this = null;
  6324. };
  6325. AbstractIntegration.prototype.append = function () {
  6326. };
  6327. AbstractIntegration.prototype.layout = function () {
  6328. };
  6329. AbstractIntegration.prototype.setLayoutData = function (args) {
  6330. };
  6331. return AbstractIntegration;
  6332. }(Widget_21.Widget));
  6333. exports.AbstractIntegration = AbstractIntegration;
  6334. });
  6335. define("widget/integration/Button$", ["require", "exports", "widget/integration/AbstractIntegration", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, AbstractIntegration_1, EventHub_17, MessageType_18, Event_15) {
  6336. "use strict";
  6337. var Button$ = (function (_super) {
  6338. __extends(Button$, _super);
  6339. function Button$(parentId, id, style) {
  6340. _super.call(this, parentId, id, style);
  6341. }
  6342. Button$.prototype.reset = function () {
  6343. var _this = this;
  6344. this.$thisNode.on("click", function (e) {
  6345. if (_this.enabled) {
  6346. EventHub_17.EventHub.dispatchEvent(MessageType_18.MessageType.WIDGET, { id: _this.id, evtType: Event_15.Event.CLICK });
  6347. }
  6348. });
  6349. if (this.text) {
  6350. this.setText({ text: this.text });
  6351. }
  6352. };
  6353. Button$.prototype.setText = function (args) {
  6354. this.text = args.text;
  6355. this.$thisNode.find("span[text]").html(args.text);
  6356. };
  6357. return Button$;
  6358. }(AbstractIntegration_1.AbstractIntegration));
  6359. exports.Button$ = Button$;
  6360. });
  6361. define("widget/integration/Composite$", ["require", "exports", "widget/integration/AbstractContainer"], function (require, exports, AbstractContainer_1) {
  6362. "use strict";
  6363. var Composite$ = (function (_super) {
  6364. __extends(Composite$, _super);
  6365. function Composite$(parentId, id, style) {
  6366. _super.call(this, parentId, id, style);
  6367. }
  6368. Composite$.prototype.reset = function () {
  6369. this.$attachNode = this.$thisNode;
  6370. };
  6371. return Composite$;
  6372. }(AbstractContainer_1.AbstractContainer));
  6373. exports.Composite$ = Composite$;
  6374. });
  6375. define("widget/integration/Label$", ["require", "exports", "widget/integration/AbstractIntegration"], function (require, exports, AbstractIntegration_2) {
  6376. "use strict";
  6377. var Label$ = (function (_super) {
  6378. __extends(Label$, _super);
  6379. function Label$(parentId, id, style) {
  6380. _super.call(this, parentId, id, style);
  6381. }
  6382. Label$.prototype.reset = function () {
  6383. if (this.text) {
  6384. this.setText({ text: this.text });
  6385. }
  6386. };
  6387. Label$.prototype.setText = function (args) {
  6388. this.$thisNode[0].innerHTML = args.text;
  6389. };
  6390. return Label$;
  6391. }(AbstractIntegration_2.AbstractIntegration));
  6392. exports.Label$ = Label$;
  6393. });
  6394. define("widget/integration/Text$", ["require", "exports", "widget/integration/AbstractIntegration", "ADORE", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, AbstractIntegration_3, ADORE_8, EventHub_18, MessageType_19, Event_16) {
  6395. "use strict";
  6396. var Text$ = (function (_super) {
  6397. __extends(Text$, _super);
  6398. function Text$(parentId, id, style) {
  6399. _super.call(this, parentId, id, style);
  6400. }
  6401. Text$.prototype.reset = function () {
  6402. if ((this.style & ADORE_8.ADORE.Password) === ADORE_8.ADORE.Password) {
  6403. this.$thisNode.find("input").attr("type", "password");
  6404. }
  6405. var id = this.id;
  6406. this.$thisNode.find("input").attr("id", this.id).on("input", function (e) {
  6407. EventHub_18.EventHub.dispatchEvent(MessageType_19.MessageType.WIDGET, {
  6408. id: id,
  6409. text: $(this).val(),
  6410. evtType: Event_16.Event.MODIFY,
  6411. syncAttrName: "text"
  6412. });
  6413. });
  6414. if (this.text) {
  6415. this.setText({ text: this.text });
  6416. }
  6417. if (this.editable) {
  6418. this.setEditable({ editable: this.editable });
  6419. }
  6420. };
  6421. Text$.prototype.setText = function (args) {
  6422. this.text = args.text;
  6423. this.$thisNode.find("input").val(args.text);
  6424. };
  6425. Text$.prototype.setEditable = function (args) {
  6426. this.editable = args.editable;
  6427. if (args.editable) {
  6428. this.$thisNode.find("input").removeAttr("readOnly");
  6429. }
  6430. else {
  6431. this.$thisNode.find("input").attr("readOnly", "readOnly");
  6432. }
  6433. };
  6434. return Text$;
  6435. }(AbstractIntegration_3.AbstractIntegration));
  6436. exports.Text$ = Text$;
  6437. });
  6438. define("widget/Label", ["require", "exports", "widget/Widget"], function (require, exports, Widget_22) {
  6439. "use strict";
  6440. var Label = (function (_super) {
  6441. __extends(Label, _super);
  6442. function Label(parentId, id, style) {
  6443. _super.call(this, parentId, id, style);
  6444. this.$thisNode = $(Label.TemplateLabel).attr({ id: this.id });
  6445. }
  6446. Label.prototype.setText = function (args) {
  6447. var text = args.text;
  6448. this.$thisNode[0].innerHTML = text;
  6449. };
  6450. Label.prototype.setFontSize = function (args) {
  6451. this.$thisNode.css({ fontSize: args.fontSize });
  6452. };
  6453. Label.prototype.setAlignment = function (args) {
  6454. this.$thisNode.css({ textAlign: args.alignment });
  6455. };
  6456. Label.prototype.setFocus = function () {
  6457. };
  6458. Label.TemplateLabel = "<nobr class=\"adore_label\"></nobr>";
  6459. return Label;
  6460. }(Widget_22.Widget));
  6461. exports.Label = Label;
  6462. });
  6463. define("widget/List", ["require", "exports", "widget/Widget", "ADORE", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, Widget_23, ADORE_9, EventHub_19, MessageType_20, Event_17) {
  6464. "use strict";
  6465. var List = (function (_super) {
  6466. __extends(List, _super);
  6467. function List(parentId, id, style) {
  6468. _super.call(this, parentId, id, style);
  6469. this.$thisNode = $(List.TemplateCotainer).attr("id", this.id);
  6470. this.itemTemplate = List.TemplateHorizontal;
  6471. this.isHorizontal = true;
  6472. if ((this.style & ADORE_9.ADORE.Vertical) === ADORE_9.ADORE.Vertical) {
  6473. this.isHorizontal = false;
  6474. this.itemTemplate = List.TemplateVertical;
  6475. }
  6476. }
  6477. List.prototype.addItems = function (args) {
  6478. var items = args.items;
  6479. var $father = this.$thisNode.parent();
  6480. this.$thisNode.detach();
  6481. if (!items || items.length === 0) {
  6482. return;
  6483. }
  6484. for (var i = 0; i < items.length; i++) {
  6485. if (items[i].name) {
  6486. if (this.$thisNode.find("#" + items[i].name).length !== 0) {
  6487. this.setItem(items[i]);
  6488. }
  6489. else {
  6490. this.addItem(items[i]);
  6491. }
  6492. }
  6493. }
  6494. if (this.fontSize) {
  6495. this.$thisNode.find("span").css({ fontSize: this.fontSize });
  6496. }
  6497. this.$thisNode.appendTo($father);
  6498. };
  6499. List.prototype.setItem = function (item) {
  6500. var $itemNode = this.$thisNode.find("#" + item.name);
  6501. this.setItemAttr($itemNode, item);
  6502. };
  6503. List.prototype.addItem = function (item) {
  6504. var $itemNode = $(this.itemTemplate).attr({ id: item.name });
  6505. $itemNode.appendTo(this.$thisNode);
  6506. this.setItemAttr($itemNode, item);
  6507. var own = this;
  6508. $itemNode.find("a").on("click", function (e) {
  6509. if (!own.enabled) {
  6510. return;
  6511. }
  6512. $("a.adore_list_li_a_selected").removeClass("adore_list_li_a_selected");
  6513. $(this).addClass("adore_list_li_a_selected");
  6514. var itemIndex = own.indexOf($itemNode[0]);
  6515. e.preventDefault();
  6516. EventHub_19.EventHub.dispatchEvent(MessageType_20.MessageType.WIDGET, {
  6517. id: own.id,
  6518. selectIndex: itemIndex,
  6519. evtType: Event_17.Event.ON_CHANGE
  6520. });
  6521. });
  6522. };
  6523. List.prototype.setItemAttr = function ($itemNode, item) {
  6524. $itemNode.find("a").find("span").text(item.name);
  6525. if (item.imagePath) {
  6526. $itemNode.find("img").attr("src", item.imagePath);
  6527. if (this.isHorizontal) {
  6528. $itemNode.find("img").css({ width: "18px", height: "18px" });
  6529. }
  6530. else {
  6531. $itemNode.find(".adore_list_span").css("margin-top", "-5px");
  6532. }
  6533. }
  6534. if (item.msgNum) {
  6535. var $msgNode = $itemNode.find(".adore_list_message");
  6536. if ($msgNode.length === 0) {
  6537. $msgNode = $(List.TemplateSpan);
  6538. $itemNode.prepend($msgNode);
  6539. if (this.isHorizontal) {
  6540. $msgNode.addClass("adore_list_message_horizontal");
  6541. }
  6542. else {
  6543. $msgNode.addClass("adore_list_message_vertical");
  6544. }
  6545. }
  6546. }
  6547. else {
  6548. $itemNode.find(".adore_list_message").remove();
  6549. }
  6550. };
  6551. List.prototype.setItems = function (args) {
  6552. var items = args.items;
  6553. this.clear();
  6554. this.addItems({ items: items });
  6555. };
  6556. List.prototype.setFontSize = function (args) {
  6557. this.fontSize = args.fontSize;
  6558. if (this.$thisNode) {
  6559. this.$thisNode.find("span").css({ fontSize: args.fontSize });
  6560. }
  6561. };
  6562. List.prototype.indexOf = function (item) {
  6563. var $items = this.$thisNode.find("li");
  6564. for (var i = 0; i < $items.length; i++) {
  6565. if (item === $items[i]) {
  6566. return i;
  6567. }
  6568. }
  6569. return -1;
  6570. };
  6571. List.prototype.select = function (args) {
  6572. var index = args.index;
  6573. var allA = this.$thisNode.find("a");
  6574. if (index < 0 || index >= allA.length) {
  6575. return;
  6576. }
  6577. $(allA[index]).trigger("click");
  6578. };
  6579. List.prototype.removeItem = function (args) {
  6580. var ids = args.itemIds;
  6581. if (ids && ids.length > 0) {
  6582. for (var i = 0; i < ids.length; i++) {
  6583. this.$thisNode.find("#" + ids[i]).remove();
  6584. }
  6585. }
  6586. };
  6587. List.prototype.clear = function () {
  6588. this.$thisNode.find("li").remove();
  6589. };
  6590. List.prototype.setFocus = function () {
  6591. };
  6592. List.TemplateCotainer = "\n <ul class=\"adore_list\">\n </ul>";
  6593. List.TemplateHorizontal = "\n <li class=\"adore_list_li_horizontal\">\n <a href=\"#\" class=\"adore_list_li_a waves-effect\">\n <img class=\"adore_list_img_horizontal\">\n <span class=\"adore_list_span adore_list_span_horizontal\"></span>\n </a>\n </li> ";
  6594. List.TemplateVertical = "\n <li class=\"adore_list_li_vertical\">\n <a href=\"#\" class=\"adore_list_li_a waves-effect\">\n <img>\n\n <div class=\"adore_list_span\">\n <span></span>\n </div>\n </a>\n </li>";
  6595. List.TemplateSpan = "\n <span class=\"adore_list_message\"></span>";
  6596. return List;
  6597. }(Widget_23.Widget));
  6598. exports.List = List;
  6599. });
  6600. define("widget/MessageList", ["require", "exports", "widget/Widget"], function (require, exports, Widget_24) {
  6601. "use strict";
  6602. var MessageList = (function (_super) {
  6603. __extends(MessageList, _super);
  6604. function MessageList(parentId, id, style) {
  6605. _super.call(this, parentId, id, style);
  6606. this.$thisNode = $(MessageList.Template).attr("id", this.id);
  6607. }
  6608. MessageList.prototype.sendMessages = function (args) {
  6609. var messages = args.messages;
  6610. var currentTime;
  6611. if (!this.userName || this.userName.length === 0) {
  6612. return;
  6613. }
  6614. for (var i = 0; i < messages.length; i++) {
  6615. if (messages[i].source === this.userName) {
  6616. if (!this.isShow || messages[i].time === currentTime) {
  6617. this.$thisNode.append("<div class=\"message clearfix\"><div class=\"message_blank\"></div><span class=\"triangle_right\"> </span><div class=\"article_right\">" + messages[i].message + "</div></div> ");
  6618. }
  6619. else {
  6620. this.$thisNode.append("<div class=\"message clearfix\"><div class=\"message_list_time\">" + messages[i].time + "</div><span class=\"triangle_right\"></span><div class=\"article_right\">" + messages[i].message + "</div></div> ");
  6621. currentTime = messages[i].time;
  6622. }
  6623. }
  6624. else if (messages[i].target === this.userName) {
  6625. if (!this.isShow || messages[i].time === currentTime) {
  6626. this.$thisNode.append("<div class=\"message clearfix\"><span class=\"triangle_left\"></span><div class=\"article_left\">" + messages[i].message + "</div></div>");
  6627. }
  6628. else {
  6629. this.$thisNode.append("<div class=\"message clearfix\"><div class=\"message_list_time\">" + messages[i].time + "</div><span class=\"triangle_left\"></span><div class=\"article_left\">" + messages[i].message + "</div></div>");
  6630. currentTime = messages[i].time;
  6631. }
  6632. }
  6633. }
  6634. };
  6635. MessageList.prototype.setUserName = function (args) {
  6636. this.userName = args.userName;
  6637. };
  6638. MessageList.prototype.isShowTime = function (args) {
  6639. this.isShow = args.isShow;
  6640. };
  6641. MessageList.prototype.setFocus = function () {
  6642. };
  6643. MessageList.Template = "<div class=\"adore_message_list\"></div>";
  6644. return MessageList;
  6645. }(Widget_24.Widget));
  6646. exports.MessageList = MessageList;
  6647. });
  6648. define("widget/other/CustCollection", ["require", "exports", "widget/Widget", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, Widget_25, EventHub_20, MessageType_21, Event_18) {
  6649. "use strict";
  6650. var CustCollection = (function (_super) {
  6651. __extends(CustCollection, _super);
  6652. function CustCollection(parentId, id, style) {
  6653. _super.call(this, parentId, id, style);
  6654. this.$thisNode = $(CustCollection.TemplateBody).attr("id", this.id);
  6655. this.itemHeaderTemplate = CustCollection.TemplateHeader;
  6656. this.itemTemplate = CustCollection.TemplateContent;
  6657. this.itemIconTemplate = CustCollection.TemplateImage;
  6658. this.contentOne = new Array();
  6659. this.contentTwo = new Array();
  6660. }
  6661. CustCollection.prototype.postLayout = function () {
  6662. $(".collapsible").collapsible({
  6663. accordion: false
  6664. });
  6665. };
  6666. CustCollection.prototype.setContents = function (args) {
  6667. var data = JSON.parse(args.attribute);
  6668. for (var key in data) {
  6669. var belongTo = key.length - key.replace(/,/g, "").length;
  6670. switch (belongTo) {
  6671. case 0:
  6672. this.contentOne[parseInt(key)] = data[key];
  6673. this.contentTwo[parseInt(key)] = new Array();
  6674. break;
  6675. case 1:
  6676. var cutKey = key.substr(1, key.length - 2);
  6677. var location_1 = cutKey.split(",");
  6678. var m = Number(location_1[0]);
  6679. var n = Number(location_1[1]);
  6680. this.contentTwo[m][n] = data[key];
  6681. break;
  6682. default:
  6683. console.log("data error");
  6684. break;
  6685. }
  6686. }
  6687. };
  6688. CustCollection.prototype.initCollection = function () {
  6689. var own = this;
  6690. var flag = false;
  6691. for (var i = 0; i < this.contentTwo.length; i++) {
  6692. if (this.contentTwo[i].length > 0) {
  6693. flag = true;
  6694. break;
  6695. }
  6696. }
  6697. if (flag) {
  6698. for (var i = 0; i < this.contentOne.length; i++) {
  6699. var itemHeaderNode = $(this.itemHeaderTemplate);
  6700. itemHeaderNode.find("#itemHeader").text(this.contentOne[i]);
  6701. this.$thisNode.find("#itemHeaderBody").append(itemHeaderNode);
  6702. for (var j = 0; j < this.contentTwo[i].length; j++) {
  6703. var itemNode = $(this.itemTemplate);
  6704. var contentId = i + "_" + j;
  6705. var itemContentNode = itemNode.find("#itemContent").attr("id", contentId);
  6706. itemContentNode.text(this.contentTwo[i][j]);
  6707. itemContentNode.append(this.itemIconTemplate);
  6708. itemContentNode.on("click", function (event) {
  6709. var tempAttr = this.id.split("_");
  6710. $(this).children("img").remove();
  6711. var indexString = "[" + tempAttr[0] + "," + tempAttr[1] + "]";
  6712. EventHub_20.EventHub.dispatchEvent(MessageType_21.MessageType.WIDGET, {
  6713. id: own.id,
  6714. location: indexString,
  6715. evtType: Event_18.Event.CLICK
  6716. });
  6717. });
  6718. itemHeaderNode.find("#itemBody").append(itemNode);
  6719. }
  6720. }
  6721. }
  6722. };
  6723. CustCollection.TemplateBody = "\n <div class=\"adore-hidden-scrollbar\" style=\"overflow: auto\">\n <ul id=\"itemHeaderBody\" class=\"collapsible\" data-collapsible=\"expandable\" style=\"background-color: #f5f5f5\">\n </ul>\n </div>";
  6724. CustCollection.TemplateHeader = "\n <li style=\"width: 100%\">\n <div id=\"itemHeader\" class=\"collapsible-header\" style=\"color: #6e7888;background-color: #e6e6e6\"></div>\n <div class=\"collapsible-body\">\n <div id=\"itemBody\" class=\"collection\">\n </div>\n </div>\n </li>";
  6725. CustCollection.TemplateContent = "\n <a href=\"#!\" class=\"collection-item active waves-effect\">\n <div id=\"itemContent\"></div>\n </a>";
  6726. CustCollection.TemplateImage = "\n <img src=\"images/cust_collection/new.jpg\"\n alt=\"\"\n class=\"circle\"\n style=\"width: 6%;float:left;margin-top: 2%;margin-left: -8%\">";
  6727. return CustCollection;
  6728. }(Widget_25.Widget));
  6729. exports.CustCollection = CustCollection;
  6730. });
  6731. define("widget/Palette", ["require", "exports", "widget/Composite", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, Composite_7, EventHub_21, MessageType_22, Event_19) {
  6732. "use strict";
  6733. var Palette = (function (_super) {
  6734. __extends(Palette, _super);
  6735. function Palette(parentId, id, style) {
  6736. _super.call(this, parentId, id, style);
  6737. this.$thisNode = $(Palette.Template).attr("id", this.id);
  6738. this.$leftBox = this.$thisNode.find(".select-box-left");
  6739. this.$buttonUL = this.$thisNode.find("input[type='button']");
  6740. this.$boxItem = this.$thisNode.find(".select-box-data");
  6741. }
  6742. Palette.prototype.setItems = function (args) {
  6743. var items = args.items;
  6744. this.addItems(items);
  6745. var own = this;
  6746. this.$buttonUL.click(function () {
  6747. var i = $(this).index();
  6748. var move = "";
  6749. var targ = "";
  6750. var direction = "";
  6751. if (i === 0) {
  6752. move = ".select-box-left li.select-current";
  6753. targ = ".select-box-right";
  6754. direction = "0";
  6755. }
  6756. if (i === 1) {
  6757. move = "li.select-current";
  6758. direction = "1";
  6759. }
  6760. if (i === 2) {
  6761. move = ".select-box-right li.select-current";
  6762. targ = ".select-box-left";
  6763. direction = "2";
  6764. }
  6765. if (i === 3) {
  6766. move = "li.select-current";
  6767. direction = "3";
  6768. }
  6769. own.moveSelectBox(move, targ, direction);
  6770. });
  6771. this.$boxItem.click(function (event) {
  6772. var $li = $(this).children();
  6773. var cur = event.target;
  6774. if ($(cur).is($li)) {
  6775. $(cur).addClass("select-current");
  6776. $(cur).siblings().removeClass("select-current");
  6777. }
  6778. });
  6779. };
  6780. Palette.prototype.addItems = function (items) {
  6781. if (!items || items.length === 0) {
  6782. return;
  6783. }
  6784. for (var i = 0; i < items.length; i++) {
  6785. this.$leftBox.append("<li>" + items[i].name + "</li>");
  6786. }
  6787. };
  6788. Palette.prototype.moveSelectBox = function (moveClass, targetClass, direction) {
  6789. if ($(moveClass).length === 0) {
  6790. return;
  6791. }
  6792. else {
  6793. var own = this;
  6794. if (direction === "0") {
  6795. var removeItemText_1 = "";
  6796. $.each($(moveClass), function () {
  6797. $(this).remove().appendTo(targetClass + "");
  6798. $(this).text($(this).text());
  6799. removeItemText_1 = $(this).text();
  6800. });
  6801. $(targetClass + " .select-current").removeClass("select-current");
  6802. EventHub_21.EventHub.dispatchEvent(MessageType_22.MessageType.WIDGET, {
  6803. id: own.id,
  6804. removeItemText: removeItemText_1,
  6805. direction: direction,
  6806. evtType: Event_19.Event.CLICK
  6807. });
  6808. }
  6809. if (direction === "1") {
  6810. moveClass = ".select-box-right li.select-current";
  6811. if ($(moveClass).length === 0) {
  6812. moveClass = ".select-box-left li.select-current";
  6813. }
  6814. $.each($(moveClass), function () {
  6815. if ($(this).prev()) {
  6816. $(this).prev().before($(this));
  6817. }
  6818. });
  6819. $(moveClass).removeClass("select-current");
  6820. }
  6821. if (direction === "2") {
  6822. var removeItemText = "";
  6823. $.each($(moveClass), function () {
  6824. $(this).remove().appendTo(targetClass + "");
  6825. $(this).text($(this).text());
  6826. });
  6827. $(targetClass + " .select-current").removeClass("select-current");
  6828. EventHub_21.EventHub.dispatchEvent(MessageType_22.MessageType.WIDGET, {
  6829. id: own.id,
  6830. removeItemText: removeItemText,
  6831. direction: direction,
  6832. evtType: Event_19.Event.CLICK
  6833. });
  6834. }
  6835. if (direction === "3") {
  6836. moveClass = ".select-box-right li.select-current";
  6837. if ($(moveClass).length === 0) {
  6838. moveClass = ".select-box-left li.select-current";
  6839. }
  6840. $.each($(moveClass), function () {
  6841. if ($(this).next()) {
  6842. $(this).next().after($(this));
  6843. }
  6844. });
  6845. $(moveClass).removeClass("select-current");
  6846. }
  6847. }
  6848. };
  6849. Palette.prototype.setFocus = function () {
  6850. };
  6851. Palette.Template = "\n <div class=\"adore_palette\">\n <!-- \u5DE6\u4FA7-->\n <div class=\"select-box col s5 m5 l5\">\n <ul class=\"select-box-data select-box-left\">\n </ul>\n </div>\n <!-- \u4E2D\u95F4-->\n <div class=\"select-btn col s2 m2 l2\">\n <div >\n <input type=\"button\" value=\"&gt;\">\n <input type=\"button\" value=\"&and;\">\n <input type=\"button\" value=\"&lt;\">\n <input type=\"button\" value=\"&or;\">\n </div>\n </div>\n <!-- \u53F3\u4FA7-->\n <div class=\"select-box col s5 m5 l5\">\n <ul class=\"select-box-data select-box-right\"></ul>\n </div>\n</div>";
  6852. return Palette;
  6853. }(Composite_7.Composite));
  6854. exports.Palette = Palette;
  6855. });
  6856. define("widget/PatternLock", ["require", "exports", "widget/Widget", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, Widget_26, EventHub_22, MessageType_23, Event_20) {
  6857. "use strict";
  6858. var PatternLock = (function (_super) {
  6859. __extends(PatternLock, _super);
  6860. function PatternLock(parentId, id, style) {
  6861. _super.call(this, parentId, id, style);
  6862. this.count = 1;
  6863. this.$thisNode = $(PatternLock.Template).attr({ id: id });
  6864. }
  6865. PatternLock.prototype.setOptions = function (args) {
  6866. this.options = args.options;
  6867. };
  6868. PatternLock.prototype.setArgs = function (args) {
  6869. this.arg = args.arg;
  6870. };
  6871. PatternLock.prototype.setCount = function (args) {
  6872. this.count = args.count;
  6873. };
  6874. PatternLock.prototype.layout = function () {
  6875. this.append();
  6876. this.$thisNode.GesturePasswd(this.options, this.arg);
  6877. };
  6878. PatternLock.prototype.show = function () {
  6879. var own = this;
  6880. var oldPwd = "-1";
  6881. var flag = true;
  6882. var count1 = 0;
  6883. this.$thisNode.on("hasPasswd", function (e, passwd) {
  6884. if (count1 === own.count - 1) {
  6885. if (oldPwd === "-1") {
  6886. own.$thisNode.trigger("passwdRight");
  6887. EventHub_22.EventHub.dispatchEvent(MessageType_23.MessageType.WIDGET, { id: own.id, evtType: Event_20.Event.ON_SLIDING, password: passwd });
  6888. own.$thisNode.closeModal();
  6889. }
  6890. else if (oldPwd !== passwd) {
  6891. own.$thisNode.trigger("passwdWrong");
  6892. EventHub_22.EventHub.dispatchEvent(MessageType_23.MessageType.WIDGET, { id: own.id, evtType: Event_20.Event.ON_SLIDING, password: "-1" });
  6893. own.$thisNode.closeModal();
  6894. }
  6895. else {
  6896. own.$thisNode.trigger("passwdWrong");
  6897. EventHub_22.EventHub.dispatchEvent(MessageType_23.MessageType.WIDGET, { id: own.id, evtType: Event_20.Event.ON_SLIDING, password: passwd });
  6898. own.$thisNode.closeModal();
  6899. }
  6900. }
  6901. else if (count1 === 0) {
  6902. own.$thisNode.trigger("passwdRight");
  6903. oldPwd = passwd;
  6904. count1 = count1 + 1;
  6905. }
  6906. else {
  6907. if (oldPwd === passwd) {
  6908. own.$thisNode.trigger("passwdRight");
  6909. count1 = count1 + 1;
  6910. }
  6911. else {
  6912. own.$thisNode.trigger("passwdWrong");
  6913. EventHub_22.EventHub.dispatchEvent(MessageType_23.MessageType.WIDGET, { id: own.id, evtType: Event_20.Event.ON_SLIDING, password: "-1" });
  6914. own.$thisNode.closeModal();
  6915. }
  6916. }
  6917. });
  6918. this.$thisNode.openModal({
  6919. dismissible: false,
  6920. opacity: .5,
  6921. in_duration: 300,
  6922. out_duration: 200
  6923. });
  6924. };
  6925. PatternLock.prototype.dispose = function () {
  6926. $(".lean-overlay").remove();
  6927. $("#" + this.id + "_lean_overlay").remove();
  6928. _super.prototype.dispose.call(this);
  6929. };
  6930. PatternLock.Template = "<div class=\"modal adore_patternlock\"></div>";
  6931. return PatternLock;
  6932. }(Widget_26.Widget));
  6933. exports.PatternLock = PatternLock;
  6934. var GesturePasswd = (function () {
  6935. function GesturePasswd(element, option, arg) {
  6936. this.$element = $(element);
  6937. this.options = option;
  6938. var that = this;
  6939. this.pr = option.pointRadii;
  6940. this.rr = option.roundRadii;
  6941. this.o = option.space;
  6942. this.color = option.color;
  6943. this.$element.css({
  6944. "position": "relation",
  6945. "width": this.options.width,
  6946. "height": this.options.height,
  6947. "background-color": option.backgroundColor,
  6948. "overflow": "hidden",
  6949. "cursor": "default"
  6950. });
  6951. if (!$(element).attr("id")) {
  6952. $(element).attr("id", (Math.random() * 65535).toString());
  6953. }
  6954. this.id = "#" + $(element).attr("id");
  6955. this.result = "";
  6956. this.pList = [];
  6957. this.sList = [];
  6958. this.tP = new Point(0, 0);
  6959. this.$element.append("<canvas class='main-c' width=" + this.options.width + " height=" + this.options.height + ">");
  6960. this.$c = $(this.id + " .main-c")[0];
  6961. this.$ctx = this.$c.getContext("2d");
  6962. this.initDraw();
  6963. this.touched = false;
  6964. $(this.id).on("mousedown touchstart", { that: that }, function (e) {
  6965. e.data.that.touched = true;
  6966. });
  6967. $(this.id).on("mouseup touchend", { that: that }, function (e) {
  6968. e.data.that.touched = false;
  6969. that.$ctx.clearRect(0, 0, that.options.width, that.options.height);
  6970. that.$ctx.beginPath();
  6971. that.$ctx.putImageData(e.data.that.initImg, 0, 0);
  6972. that.allDraw(that.options.lineColor);
  6973. for (var p in that.sList) {
  6974. if (e.data.that.pointInList(that.sList[p], e.data.that.pList)) {
  6975. e.data.that.result = e.data.that.result + (e.data.that.pointInList(that.sList[p], e.data.that.pList)).toString();
  6976. }
  6977. }
  6978. $(element).trigger("hasPasswd", that.result);
  6979. });
  6980. $(this.id).on("touchmove mousemove", { that: that }, function (e) {
  6981. if (e.data.that.touched) {
  6982. var x = e.pageX || e.originalEvent.targetTouches[0].pageX;
  6983. var y = e.pageY || e.originalEvent.targetTouches[0].pageY;
  6984. x = x - that.$element.offset().left;
  6985. y = y - that.$element.offset().top;
  6986. var p = e.data.that.isIn(x, y);
  6987. console.log(x);
  6988. if (p !== 0) {
  6989. if (!e.data.that.pointInList(p, e.data.that.sList)) {
  6990. e.data.that.sList.push(p);
  6991. }
  6992. }
  6993. console.log(e.data.that.sList);
  6994. e.data.that.draw(x, y);
  6995. }
  6996. });
  6997. $(this.id).on("passwdWrong", { that: that }, function (e) {
  6998. that.$ctx.clearRect(0, 0, that.options.width, that.options.height);
  6999. that.$ctx.beginPath();
  7000. that.$ctx.putImageData(that.initImg, 0, 0);
  7001. that.allDraw("#cc1c21");
  7002. that.result = "";
  7003. that.pList = [];
  7004. that.sList = [];
  7005. setTimeout(function () {
  7006. that.$ctx.clearRect(0, 0, that.options.width, that.options.height);
  7007. that.$ctx.beginPath();
  7008. that.initDraw();
  7009. }, 500);
  7010. });
  7011. $(this.id).on("passwdRight", { that: that }, function (e) {
  7012. that.$ctx.clearRect(0, 0, that.options.width, that.options.height);
  7013. that.$ctx.beginPath();
  7014. that.$ctx.putImageData(that.initImg, 0, 0);
  7015. that.allDraw("#00a254");
  7016. that.result = "";
  7017. that.pList = [];
  7018. that.sList = [];
  7019. setTimeout(function () {
  7020. that.$ctx.clearRect(0, 0, that.options.width, that.options.height);
  7021. that.$ctx.beginPath();
  7022. that.initDraw();
  7023. }, 500);
  7024. });
  7025. }
  7026. GesturePasswd.prototype.initDraw = function () {
  7027. this.$ctx.strokeStyle = this.color;
  7028. this.$ctx.lineWidth = 2;
  7029. for (var j = 0; j < 3; j++) {
  7030. for (var i = 0; i < 3; i++) {
  7031. this.$ctx.moveTo(this.o / 2 + this.rr * 2 + i * (this.o + 2 * this.rr), this.o / 2 + this.rr + j * (this.o + 2 * this.rr));
  7032. this.$ctx.arc(this.o / 2 + this.rr + i * (this.o + 2 * this.rr), this.o / 2 + this.rr + j * (this.o + 2 * this.rr), this.rr, 0, 2 * Math.PI);
  7033. var tem = new Point(this.o / 2 + this.rr + i * (this.o + 2 * this.rr), this.o / 2 + this.rr + j * (this.o + 2 * this.rr));
  7034. if (this.pList.length < 9)
  7035. this.pList.push(tem);
  7036. }
  7037. }
  7038. this.$ctx.stroke();
  7039. this.initImg = this.$ctx.getImageData(0, 0, this.options.width, this.options.height);
  7040. };
  7041. GesturePasswd.prototype.isIn = function (x, y) {
  7042. for (var p in this.pList) {
  7043. if ((Math.pow((x - this.pList[p]["x"]), 2) + Math.pow((y - this.pList[p]["y"]), 2)) < Math.pow(this.rr, 2)) {
  7044. return this.pList[p];
  7045. }
  7046. }
  7047. return 0;
  7048. };
  7049. GesturePasswd.prototype.pointDraw = function (c) {
  7050. if (arguments.length > 0) {
  7051. this.$ctx.strokeStyle = c;
  7052. this.$ctx.fillStyle = c;
  7053. }
  7054. for (var p in this.sList) {
  7055. this.$ctx.moveTo(this.sList[p]["x"] + this.pr, this.sList[p]["y"]);
  7056. this.$ctx.arc(this.sList[p]["x"], this.sList[p]["y"], this.pr, 0, 2 * Math.PI);
  7057. this.$ctx.fill();
  7058. }
  7059. };
  7060. GesturePasswd.prototype.lineDraw = function (c) {
  7061. if (arguments.length > 0) {
  7062. this.$ctx.strokeStyle = c;
  7063. this.$ctx.fillStyle = c;
  7064. }
  7065. if (this.sList.length > 0) {
  7066. for (var p in this.sList) {
  7067. if (p === "0") {
  7068. console.log(this.sList[p]["x"], this.sList[p]["y"]);
  7069. this.$ctx.moveTo(this.sList[p]["x"], this.sList[p]["y"]);
  7070. continue;
  7071. }
  7072. this.$ctx.lineTo(this.sList[p]["x"], this.sList[p]["y"]);
  7073. console.log(this.sList[p]["x"], this.sList[p]["y"]);
  7074. }
  7075. }
  7076. };
  7077. GesturePasswd.prototype.allDraw = function (c) {
  7078. if (arguments.length > 0) {
  7079. this.pointDraw(c);
  7080. this.lineDraw(c);
  7081. this.$ctx.stroke();
  7082. }
  7083. else {
  7084. this.pointDraw();
  7085. this.lineDraw();
  7086. }
  7087. };
  7088. ;
  7089. GesturePasswd.prototype.draw = function (x, y) {
  7090. this.$ctx.clearRect(0, 0, this.options.width, this.options.height);
  7091. this.$ctx.beginPath();
  7092. this.$ctx.putImageData(this.initImg, 0, 0);
  7093. this.$ctx.lineWidth = 4;
  7094. this.pointDraw(this.options.lineColor);
  7095. this.lineDraw(this.options.lineColor);
  7096. this.$ctx.lineTo(x, y);
  7097. this.$ctx.stroke();
  7098. };
  7099. GesturePasswd.prototype.pointInList = function (poi, list) {
  7100. for (var p in list) {
  7101. if (poi["x"] === list[p]["x"] && poi["y"] === list[p]["y"]) {
  7102. var i = parseInt(p);
  7103. return ++i;
  7104. }
  7105. }
  7106. return false;
  7107. };
  7108. GesturePasswd.PatternLockDefaultOptions = {
  7109. zindex: 100,
  7110. roundRadii: 25,
  7111. pointRadii: 6,
  7112. space: 30,
  7113. width: 240,
  7114. height: 240,
  7115. lineColor: "#00aec7",
  7116. backgroundColor: "#252736",
  7117. color: "#FFFFFF"
  7118. };
  7119. return GesturePasswd;
  7120. }());
  7121. exports.GesturePasswd = GesturePasswd;
  7122. var Point = (function () {
  7123. function Point(x, y) {
  7124. this.x = x;
  7125. this.y = y;
  7126. }
  7127. return Point;
  7128. }());
  7129. exports.Point = Point;
  7130. ;
  7131. (function ($) {
  7132. function Plugin(option, arg) {
  7133. this.each(function () {
  7134. var $this = $(this);
  7135. var options = $.extend({}, GesturePasswd.PatternLockDefaultOptions, typeof option === "object" && option);
  7136. var data = $this.data("GesturePasswd");
  7137. var action = typeof option === "string" ? option : NaN;
  7138. if (!data)
  7139. $this.data("danmu", (data = new GesturePasswd(this, options)));
  7140. if (action)
  7141. data[action](arg);
  7142. });
  7143. }
  7144. $.fn.GesturePasswd = Plugin;
  7145. })(jQuery);
  7146. });
  7147. define("widget/PictureList", ["require", "exports", "widget/Widget", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, Widget_27, EventHub_23, MessageType_24, Event_21) {
  7148. "use strict";
  7149. var PictureList = (function (_super) {
  7150. __extends(PictureList, _super);
  7151. function PictureList(parentId, id, style) {
  7152. _super.call(this, parentId, id, style);
  7153. this.$thisNode = $(PictureList.Template0).attr({ id: id });
  7154. }
  7155. PictureList.prototype.addItems = function (args) {
  7156. var items = args.items;
  7157. if (!items || items.length === 0) {
  7158. return;
  7159. }
  7160. var $father = this.$thisNode.parent();
  7161. if ($father.length !== 0) {
  7162. this.$thisNode.detach();
  7163. }
  7164. for (var i = 0; i < items.length; i++) {
  7165. if (items[i].id) {
  7166. if (this.$thisNode.find("#" + items[i].id).length !== 0) {
  7167. this.setItem(items[i]);
  7168. }
  7169. else {
  7170. this.addItem(items[i]);
  7171. }
  7172. }
  7173. else {
  7174. this.addItem(items[i]);
  7175. }
  7176. }
  7177. if ($father.length !== 0) {
  7178. this.$thisNode.appendTo($father);
  7179. }
  7180. };
  7181. PictureList.prototype.setItems = function (args) {
  7182. var items = args.items;
  7183. this.clear();
  7184. this.addItems({ items: items });
  7185. };
  7186. PictureList.prototype.addItem = function (args) {
  7187. var itemNode = args.id ? $(PictureList.Template1).attr({ id: args.id }) : $(PictureList.Template1);
  7188. itemNode.appendTo(this.$thisNode);
  7189. this.setItemAttr(itemNode, args);
  7190. var own = this;
  7191. itemNode.find("img").on("click", function (e) {
  7192. var index = own.indexOf(itemNode[0]);
  7193. var itemID = itemNode.attr("id");
  7194. EventHub_23.EventHub.dispatchEvent(MessageType_24.MessageType.WIDGET, {
  7195. id: own.id,
  7196. evtType: Event_21.Event.CLICK,
  7197. index: index,
  7198. itemID: itemID
  7199. });
  7200. });
  7201. };
  7202. PictureList.prototype.indexOf = function (item) {
  7203. var items = this.$thisNode.find("div.adore-picture-list-img");
  7204. for (var i = 0; i < items.length; i++) {
  7205. if (item === items[i]) {
  7206. return i;
  7207. }
  7208. }
  7209. return -1;
  7210. };
  7211. PictureList.prototype.setItem = function (args) {
  7212. var itemNode = this.$thisNode.find("#" + args.id);
  7213. this.setItemAttr(itemNode, args);
  7214. };
  7215. PictureList.prototype.setItemAttr = function (itemNode, args) {
  7216. itemNode.find("img").attr("src", args.imagePath);
  7217. };
  7218. PictureList.prototype.removeItem = function (args) {
  7219. var ids = args.itemIds;
  7220. if (ids && ids.length > 0) {
  7221. for (var i = 0; i < ids.length; i++) {
  7222. this.$thisNode.find("#" + ids[i]).remove();
  7223. }
  7224. }
  7225. };
  7226. PictureList.prototype.clear = function () {
  7227. this.$thisNode.find("div.adore-picture-list-img").remove();
  7228. };
  7229. PictureList.prototype.setFocus = function () {
  7230. };
  7231. PictureList.Template0 = " <div class=\"row\"></div>";
  7232. PictureList.Template1 = "<div class=\"adore-picture-list-img col s4 m3 l2 waves-effect\"><img class=\"responsive-img\"></div>";
  7233. return PictureList;
  7234. }(Widget_27.Widget));
  7235. exports.PictureList = PictureList;
  7236. });
  7237. define("widget/RadioButton", ["require", "exports", "widget/Widget", "event/EventHub", "event/MessageType", "event/Event", "hotkey/Keys"], function (require, exports, Widget_28, EventHub_24, MessageType_25, Event_22, Keys_8) {
  7238. "use strict";
  7239. var RadioButton = (function (_super) {
  7240. __extends(RadioButton, _super);
  7241. function RadioButton(parentId, id, style) {
  7242. _super.call(this, parentId, id, style);
  7243. this.$thisNode = $(RadioButton.TemplateRadioButton).attr({ id: this.id });
  7244. var tmpId = this.id;
  7245. var own = this;
  7246. this.$thisNode.find("input[type=radio]").attr("id", this.id + "_radio").on("change", function (e, options) {
  7247. own.triggerOtherChangeEvent(this, options);
  7248. EventHub_24.EventHub.dispatchEvent(MessageType_25.MessageType.WIDGET, {
  7249. id: tmpId,
  7250. checked: this.checked + "",
  7251. evtType: Event_22.Event.ON_CHANGE,
  7252. syncAttrName: this.checked
  7253. });
  7254. }).on("focus", function (e) {
  7255. own.sendFocusGain();
  7256. }).on("blur", function (e) {
  7257. own.handleBlur();
  7258. });
  7259. this.$thisNode.find("label").attr("for", this.id + "_radio");
  7260. }
  7261. RadioButton.prototype.triggerOtherChangeEvent = function (thisGroup, options) {
  7262. if (options === "setChecked") {
  7263. return;
  7264. }
  7265. var $radioGroup = $("input[name='" + this.groupName + "']");
  7266. for (var i = 0; i < $radioGroup.length; i++) {
  7267. if ($($radioGroup[i]).attr("checked") === "checked") {
  7268. $radioGroup[i].checked = false;
  7269. $($radioGroup[i]).removeAttr("checked");
  7270. $($radioGroup[i]).trigger("change", ["setChecked"]);
  7271. break;
  7272. }
  7273. }
  7274. $(thisGroup).attr("checked", "checked");
  7275. };
  7276. RadioButton.prototype.setName = function (args) {
  7277. this.$thisNode.find("label").text(args.name);
  7278. };
  7279. RadioButton.prototype.setGroupName = function (args) {
  7280. this.groupName = args.group;
  7281. this.$thisNode.find("input").attr("name", this.groupName);
  7282. };
  7283. RadioButton.prototype.setChecked = function (args) {
  7284. if (args.isChecked) {
  7285. this.reset((this.$thisNode.find("input[type]")[0]));
  7286. }
  7287. };
  7288. RadioButton.prototype.reset = function (thisGroup) {
  7289. if (thisGroup.checked) {
  7290. return;
  7291. }
  7292. var $radioGroup = $("input[name='" + this.groupName + "']");
  7293. for (var i = 0; i < $radioGroup.length; i++) {
  7294. if ($($radioGroup[i]).attr("checked") === "checked") {
  7295. $radioGroup[i].checked = false;
  7296. $($radioGroup[i]).removeAttr("checked");
  7297. $($radioGroup[i]).trigger("change", ["setChecked"]);
  7298. break;
  7299. }
  7300. }
  7301. $(thisGroup).attr("checked", "checked");
  7302. thisGroup.checked = true;
  7303. $(thisGroup).trigger("change", ["setChecked"]);
  7304. };
  7305. RadioButton.prototype.setEnabled = function (args) {
  7306. this.enabled = args.enabled;
  7307. if (this.enabled) {
  7308. this.$thisNode.find("input").removeAttr("disabled");
  7309. }
  7310. else {
  7311. this.$thisNode.find("input").attr("disabled", "disabled");
  7312. }
  7313. };
  7314. RadioButton.prototype.setFocus = function () {
  7315. var inputNode = this.$thisNode.find("input");
  7316. if (document.activeElement !== inputNode[0]) {
  7317. inputNode.focus();
  7318. }
  7319. this.$thisNode.find("label").addClass("adore_check_button_focus_label");
  7320. };
  7321. RadioButton.prototype.handleBlur = function () {
  7322. this.$thisNode.find("label").removeClass("adore_check_button_focus_label");
  7323. };
  7324. RadioButton.prototype.handleKeyDownEvent = function (e, hasFilter) {
  7325. if (e.keyCode === Keys_8.Keys.SPACE || e.keyCode === Keys_8.Keys.ENTER || e.keyCode === Keys_8.Keys.NUMPAD_ENTER) {
  7326. this.$thisNode.find("input").click();
  7327. return;
  7328. }
  7329. _super.prototype.handleKeyDownEvent.call(this, e, hasFilter);
  7330. };
  7331. RadioButton.prototype.handleKeyUpEvent = function (e) {
  7332. if (e.keyCode === Keys_8.Keys.SPACE || e.keyCode === Keys_8.Keys.ENTER || e.keyCode === Keys_8.Keys.NUMPAD_ENTER) {
  7333. return;
  7334. }
  7335. _super.prototype.handleKeyUpEvent.call(this, e);
  7336. };
  7337. RadioButton.TemplateRadioButton = "<p>\n <input name=\"group1\" type=\"radio\"/>\n <label></label>\n </p>";
  7338. return RadioButton;
  7339. }(Widget_28.Widget));
  7340. exports.RadioButton = RadioButton;
  7341. });
  7342. define("widget/RollingLabel", ["require", "exports", "widget/Widget"], function (require, exports, Widget_29) {
  7343. "use strict";
  7344. var RollingLabel = (function (_super) {
  7345. __extends(RollingLabel, _super);
  7346. function RollingLabel(parentId, id, style) {
  7347. _super.call(this, parentId, id, style);
  7348. this.$thisNode = $(RollingLabel.Template).attr("id", this.id);
  7349. }
  7350. RollingLabel.prototype.setText = function (args) {
  7351. var text = args.text;
  7352. this.$thisNode.text(text);
  7353. };
  7354. RollingLabel.prototype.setFocus = function () {
  7355. };
  7356. RollingLabel.Template = "<marquee class=\"adore_label\" scrollamount=\"5\"></marquee>";
  7357. return RollingLabel;
  7358. }(Widget_29.Widget));
  7359. exports.RollingLabel = RollingLabel;
  7360. });
  7361. define("widget/Select", ["require", "exports", "widget/Widget", "event/Event", "event/MessageType", "event/EventHub", "hotkey/Keys"], function (require, exports, Widget_30, Event_23, MessageType_26, EventHub_25, Keys_9) {
  7362. "use strict";
  7363. var Select = (function (_super) {
  7364. __extends(Select, _super);
  7365. function Select(parentId, id, style) {
  7366. _super.call(this, parentId, id, style);
  7367. this.isLayout = false;
  7368. this.hadIcon = false;
  7369. this.maxShowItems = 6;
  7370. this.focusLostFromText_DropDownShow_ArrowFocus = false;
  7371. this.focusLostFromText_DropDownShow = false;
  7372. this.$thisNode = $(Select.Template).attr("id", this.id);
  7373. this.$iconNode = this.$thisNode.find("i:first").attr("id", this.id + "_icon");
  7374. this.$dropDownArrow = this.$thisNode.find("i.mdi-navigation-arrow-drop-down").attr("id", this.id + "_arrow");
  7375. this.$textCode = this.$thisNode.find("input").attr("id", this.id + "_input");
  7376. this.$thisNode.find("label").attr("for", this.id + "_input");
  7377. this.datas = [];
  7378. this.selectDatas = new Array();
  7379. this.maxShowItems = 6;
  7380. this.scrollIndexs = [0, this.maxShowItems - 1];
  7381. var own = this;
  7382. var widgetId = this.id;
  7383. this.$dropDownArrow.on("click", function (e) {
  7384. var show = !own.isDropDownShow();
  7385. if (show) {
  7386. own.$textCode.focus();
  7387. }
  7388. own.showDropDown(widgetId, show, !show);
  7389. });
  7390. this.$textCode.on("keydown", function (e) {
  7391. own.handleKeyDown(e, own.id);
  7392. });
  7393. this.$textCode.on("blur", function (e) {
  7394. if (!own.focusLostFromText_DropDownShow) {
  7395. own.handleOnBlur();
  7396. }
  7397. });
  7398. this.$textCode.on("focus", function (e) {
  7399. own.$textCode.select();
  7400. own.sendFocusGain();
  7401. });
  7402. this.$textCode.on("input", function (e) {
  7403. own.handleInput(e);
  7404. });
  7405. }
  7406. Select.prototype.setItems = function (args) {
  7407. this.datas = args.items;
  7408. this.selectDatas.splice(0, this.selectDatas.length);
  7409. for (var i = 0; i < this.datas.length; i++) {
  7410. this.selectDatas.push(this.datas[i]);
  7411. }
  7412. };
  7413. Select.prototype.handleMouseDownEvent = function (e) {
  7414. this.focusLostFromText_DropDownShow = null;
  7415. if (document.activeElement === this.$textCode.get(0) && this.isDropDownShow()) {
  7416. this.focusLostFromText_DropDownShow = true;
  7417. }
  7418. else {
  7419. this.focusLostFromText_DropDownShow = false;
  7420. }
  7421. _super.prototype.handleMouseDownEvent.call(this, e);
  7422. };
  7423. Select.prototype.handleMouseUpEvent = function (e) {
  7424. this.focusLostFromText_DropDownShow = false;
  7425. _super.prototype.handleMouseUpEvent.call(this, e);
  7426. };
  7427. Select.prototype.handleInput = function (e) {
  7428. var value = this.$textCode.val();
  7429. this.filterItems(value);
  7430. this.showDropDown(this.id, true, false);
  7431. };
  7432. Select.prototype.handleOnBlur = function () {
  7433. var value = this.$textCode.val();
  7434. this.setText({ text: value });
  7435. this.checkRequisite();
  7436. var mouseOn = $("#" + this.id + "_dropDown").attr("mouseOn");
  7437. if (mouseOn === "false") {
  7438. this.showDropDown(this.id, false, false);
  7439. }
  7440. };
  7441. Select.prototype.setName = function (args) {
  7442. var name = args.name;
  7443. this.$thisNode.find("label").text(name);
  7444. };
  7445. Select.prototype.setEnabled = function (args) {
  7446. _super.prototype.setEnabled.call(this, args);
  7447. var input = this.$thisNode.find("input");
  7448. if (this.enabled) {
  7449. input.removeAttr("disabled");
  7450. this.$thisNode.find("i").removeClass("icon_disabled");
  7451. if (this.requisite) {
  7452. if (input.val() == null || input.val() === "") {
  7453. this.addRequisite();
  7454. }
  7455. }
  7456. }
  7457. else {
  7458. this.$thisNode.find("input").attr("disabled", "disabled");
  7459. if (this.requisite) {
  7460. this.removeRequisite();
  7461. }
  7462. this.$thisNode.find("i").addClass("icon_disabled");
  7463. }
  7464. };
  7465. Select.prototype.postLayout = function () {
  7466. this.isLayout = true;
  7467. if (this.requisite) {
  7468. this.setRequisite({ requisite: true });
  7469. }
  7470. };
  7471. Select.prototype.setText = function (args) {
  7472. var inputNode = this.$thisNode.find("input");
  7473. inputNode.val(args.text);
  7474. if (args.text.length > 0) {
  7475. inputNode.siblings('label').addClass('active');
  7476. this.$iconNode.addClass("active");
  7477. }
  7478. else {
  7479. inputNode.siblings('label').removeClass('active');
  7480. this.$iconNode.removeClass("active");
  7481. }
  7482. if ((args.text == null || args.text === "") && this.requisite) {
  7483. this.addRequisite();
  7484. }
  7485. else {
  7486. this.removeRequisite();
  7487. }
  7488. };
  7489. Select.prototype.checkRequisite = function () {
  7490. if (this.requisite) {
  7491. var inputSelector = this.$thisNode.find('input');
  7492. var value = inputSelector.val();
  7493. if (value) {
  7494. this.removeRequisite();
  7495. }
  7496. else {
  7497. this.addRequisite();
  7498. this.showSpan('请输入数据!');
  7499. }
  7500. }
  7501. };
  7502. Select.prototype.showSpan = function (msg) {
  7503. if (this.$thisNode.find('span').css("display") === "none") {
  7504. this.$thisNode.find('span').html(msg).show().delay(2000).fadeOut(300);
  7505. }
  7506. $("#" + this.id + "_dropDown").css("margin-top", "-21px");
  7507. };
  7508. Select.prototype.setRequisite = function (args) {
  7509. this.requisite = args.requisite;
  7510. if (!this.isLayout) {
  7511. return;
  7512. }
  7513. if (this.requisite) {
  7514. if (this.$thisNode.find('input').val()) {
  7515. this.removeRequisite();
  7516. }
  7517. else {
  7518. this.addRequisite();
  7519. }
  7520. }
  7521. };
  7522. Select.prototype.removeRequisite = function () {
  7523. this.$thisNode.find('input').removeClass('adore_InputRequisite');
  7524. this.$thisNode.find("label").removeClass('adore_requisiteColor');
  7525. this.$iconNode.removeClass('adore_requisiteColor');
  7526. this.hideSpan();
  7527. };
  7528. Select.prototype.hideSpan = function () {
  7529. this.$thisNode.find('span').css('display', 'none');
  7530. };
  7531. Select.prototype.addRequisite = function () {
  7532. this.$thisNode.find('input').addClass('adore_InputRequisite');
  7533. this.$thisNode.find("label").addClass('adore_requisiteColor');
  7534. this.$iconNode.addClass('adore_requisiteColor');
  7535. };
  7536. Select.prototype.setFocus = function () {
  7537. var dropDownNode = $("#" + this.id + "_dropDown");
  7538. if (this.$thisNode.find("input")[0] !== document.activeElement && dropDownNode.css("display") !== "block") {
  7539. this.$thisNode.find("input").focus();
  7540. }
  7541. };
  7542. Select.prototype.setIcon = function (args) {
  7543. this.$iconNode.addClass(args.icon);
  7544. if (args.icon) {
  7545. this.hadIcon = true;
  7546. }
  7547. else {
  7548. this.hadIcon = false;
  7549. }
  7550. if (this.$thisNode.find("input").val().length > 0) {
  7551. this.$thisNode.find("input").siblings('label').addClass('active');
  7552. this.$iconNode.addClass("active");
  7553. }
  7554. this.$thisNode.find('span').addClass('span_prefix');
  7555. };
  7556. Select.prototype.dispose = function () {
  7557. $(document).unbind("click." + this.id);
  7558. _super.prototype.dispose.call(this);
  7559. $("#" + this.id + "_dropDown").remove();
  7560. };
  7561. Select.prototype.handleKeyDown = function (e, widgetId) {
  7562. var dropDown = $("#" + widgetId + "_dropDown");
  7563. var dis = dropDown.css("display");
  7564. if (e.keyCode === Keys_9.Keys.BACKSPACE) {
  7565. return;
  7566. }
  7567. if ((!dis || dis === "none") && e.keyCode !== Keys_9.Keys.ENTER) {
  7568. if (e.keyCode === Keys_9.Keys.DOWN_ARROW || e.keyCode === Keys_9.Keys.SPACE) {
  7569. this.showDropDown(widgetId, true, false);
  7570. e.preventDefault();
  7571. e.stopPropagation();
  7572. }
  7573. return;
  7574. }
  7575. var items = dropDown.find("li");
  7576. var currentIndex = parseInt(dropDown.attr("currentIndex"));
  7577. if (e.keyCode === Keys_9.Keys.UP_ARROW) {
  7578. if (currentIndex === -1) {
  7579. currentIndex = items.length - 1;
  7580. }
  7581. else {
  7582. currentIndex--;
  7583. }
  7584. items.css("background-color", "#FFFFFF");
  7585. if (currentIndex < 0) {
  7586. currentIndex = -1;
  7587. }
  7588. else {
  7589. $(items[currentIndex]).css("background-color", "#BEBEBE");
  7590. this.setText({ text: this.selectDatas[currentIndex] });
  7591. }
  7592. this.refreshScroll(dropDown, currentIndex);
  7593. e.preventDefault();
  7594. }
  7595. else if (e.keyCode === Keys_9.Keys.DOWN_ARROW) {
  7596. currentIndex++;
  7597. items.css("background-color", "#FFFFFF");
  7598. if (currentIndex >= items.length) {
  7599. currentIndex = -1;
  7600. }
  7601. else {
  7602. $(items[currentIndex]).css("background-color", "#BEBEBE");
  7603. this.setText({ text: this.selectDatas[currentIndex] });
  7604. }
  7605. this.refreshScroll(dropDown, currentIndex);
  7606. e.preventDefault();
  7607. }
  7608. else if (e.keyCode === Keys_9.Keys.ENTER) {
  7609. if (currentIndex >= 0 && currentIndex < items.length) {
  7610. this.setText({ text: $(items[currentIndex]).text().trim() });
  7611. this.checkRequisite();
  7612. }
  7613. this.showDropDown(this.id, false, true);
  7614. e.preventDefault();
  7615. e.stopPropagation();
  7616. }
  7617. dropDown.attr("currentIndex", currentIndex + "");
  7618. };
  7619. Select.prototype.refreshScroll = function (dropDown, currentIndex) {
  7620. if (currentIndex === -1) {
  7621. return;
  7622. }
  7623. var count = dropDown.find("li").length - 1;
  7624. var needRefresh = false;
  7625. if (currentIndex < this.scrollIndexs[0]) {
  7626. var endIndex = currentIndex + this.maxShowItems - 1;
  7627. endIndex = endIndex > count ? count : endIndex;
  7628. this.scrollIndexs = [currentIndex, endIndex];
  7629. needRefresh = true;
  7630. }
  7631. else if (currentIndex > this.scrollIndexs[1]) {
  7632. var beginIndex = currentIndex - this.maxShowItems + 1;
  7633. beginIndex = beginIndex < 0 ? 0 : beginIndex;
  7634. this.scrollIndexs = [beginIndex, currentIndex];
  7635. needRefresh = true;
  7636. }
  7637. if (needRefresh) {
  7638. var h = dropDown.find("li").height();
  7639. dropDown[0].scrollTop = h * this.scrollIndexs[0];
  7640. }
  7641. };
  7642. Select.prototype.showDropDown = function (widgetId, show, changedFocus) {
  7643. if (this.$thisNode.find("input").attr("disabled")) {
  7644. return;
  7645. }
  7646. var isDropDownShow = this.isDropDownShow();
  7647. if (!show) {
  7648. $("#" + widgetId + "_dropDown").css("display", "none");
  7649. this.handleModify(changedFocus);
  7650. return;
  7651. }
  7652. var textCode = $("#" + widgetId + "_input");
  7653. var width = textCode.width();
  7654. var height = textCode.height();
  7655. $("#" + widgetId + "_dropDown").remove();
  7656. var dropDown = $(Select.TemplateDropdown).attr("id", widgetId + "_dropDown");
  7657. dropDown.attr({ mouseOn: "false" });
  7658. dropDown.appendTo(this.$thisNode);
  7659. dropDown.attr("currentIndex", "-1");
  7660. dropDown.attr("currentIndex", "-1");
  7661. if (this.hadIcon) {
  7662. dropDown.css("margin-left", " 3rem");
  7663. }
  7664. var liNode;
  7665. if (this.selectDatas) {
  7666. for (var i = 0; i < this.selectDatas.length; i++) {
  7667. liNode = $(Select.TemplateLi).attr("index", i + "");
  7668. liNode.find("a").text(this.selectDatas[i]);
  7669. liNode.appendTo(dropDown);
  7670. }
  7671. }
  7672. var len = dropDown.find("li").length;
  7673. if (len > 0) {
  7674. var tmpId_1 = widgetId;
  7675. var own_5 = this;
  7676. dropDown.find("li").find("a").on("click", function (e) {
  7677. var value = $(this).text().trim();
  7678. own_5.setText({ text: value });
  7679. own_5.checkRequisite();
  7680. own_5.showDropDown(tmpId_1, false, true);
  7681. });
  7682. dropDown.on("mouseover", function (e) {
  7683. dropDown.attr("mouseOn", "true");
  7684. });
  7685. dropDown.on("mouseout", function (e) {
  7686. dropDown.attr("mouseOn", "false");
  7687. });
  7688. dropDown.css("display", "block");
  7689. dropDown.css("width", "135px");
  7690. if (dropDown.width() < width) {
  7691. dropDown.css("width", width);
  7692. }
  7693. if (this.$thisNode.find('span').css("display") === "block") {
  7694. dropDown.css("margin-top", "-21px");
  7695. }
  7696. if (len > this.maxShowItems) {
  7697. var h = $(dropDown.find("li")[0]).height();
  7698. var maxHeight = h * this.maxShowItems;
  7699. dropDown.css("height", maxHeight);
  7700. }
  7701. var dropdown_offsetTop = 0;
  7702. var container_offsetTop = 0;
  7703. var container_height = 0;
  7704. var limit_height = 0;
  7705. var $node = this.$thisNode;
  7706. dropdown_offsetTop = dropDown.offset().top + 15;
  7707. dropDown.addClass("adore_dropDown_show");
  7708. while (1) {
  7709. var tagname = $node.get(0).tagName;
  7710. if (tagname.match("BODY") !== null) {
  7711. container_height = $node.height();
  7712. break;
  7713. }
  7714. var id_str = $node.attr("id");
  7715. if (typeof (id_str) !== "undefined") {
  7716. if (id_str.match("AdoreShell") !== null) {
  7717. container_offsetTop = $node.offset().top;
  7718. container_height = $node.height();
  7719. break;
  7720. }
  7721. }
  7722. $node = $node.parent();
  7723. }
  7724. limit_height = container_height + container_offsetTop - dropdown_offsetTop;
  7725. if (dropDown.height() > limit_height) {
  7726. var top_length = dropDown.height() - limit_height + 25;
  7727. var str_length = "-" + top_length + "px";
  7728. dropDown.css("margin-top", str_length);
  7729. }
  7730. }
  7731. else {
  7732. dropDown.css("display", "none");
  7733. }
  7734. };
  7735. Select.prototype.handleKeyDownEvent = function (e, hasFilter) {
  7736. if (this.handleKeyEvent(e)) {
  7737. _super.prototype.handleKeyDownEvent.call(this, e, hasFilter);
  7738. }
  7739. };
  7740. Select.prototype.handleKeyUpEvent = function (e) {
  7741. if (this.handleKeyEvent(e)) {
  7742. _super.prototype.handleKeyUpEvent.call(this, e);
  7743. }
  7744. };
  7745. Select.prototype.handleKeyEvent = function (e) {
  7746. if ($("#" + this.id + "_dropDown").css("display") === "block") {
  7747. return false;
  7748. }
  7749. if (e.keyCode === Keys_9.Keys.DOWN_ARROW) {
  7750. return false;
  7751. }
  7752. return true;
  7753. };
  7754. Select.prototype.getSelectedIndex = function (selectedText) {
  7755. if (!selectedText || selectedText === "") {
  7756. return -1;
  7757. }
  7758. else {
  7759. for (var i = 0; i < this.datas.length; i++) {
  7760. if (this.datas[i].indexOf(selectedText) != -1) {
  7761. return i;
  7762. }
  7763. }
  7764. return -1;
  7765. }
  7766. };
  7767. Select.prototype.handleModify = function (changedFocus) {
  7768. var selectedText = this.$textCode.val();
  7769. var selectedIndex = this.getSelectedIndex(selectedText);
  7770. if (selectedIndex >= 0) {
  7771. this.setText({ text: this.datas[selectedIndex] });
  7772. }
  7773. else {
  7774. this.setText({ text: "" });
  7775. }
  7776. EventHub_25.EventHub.dispatchEvent(MessageType_26.MessageType.WIDGET, {
  7777. id: this.id,
  7778. selectedIndex: selectedIndex + "",
  7779. changedFocus: changedFocus + "",
  7780. evtType: Event_23.Event.ON_CHANGE
  7781. });
  7782. this.reset();
  7783. };
  7784. Select.prototype.isDropDownShow = function () {
  7785. var $dropDownNode = $("#" + this.id + "_dropDown");
  7786. if ($dropDownNode) {
  7787. var dis = $dropDownNode.css("display");
  7788. if (dis) {
  7789. if (dis === "block")
  7790. return true;
  7791. }
  7792. }
  7793. return false;
  7794. };
  7795. Select.prototype.refreshDropDownItemBGC = function (selectedIndex) {
  7796. var $dropDown = $("#" + this.id + "_dropDown");
  7797. var $items = $dropDown.find("li");
  7798. $items.css("background-color", "#FFFFFF");
  7799. if (selectedIndex < 0) {
  7800. }
  7801. else {
  7802. $($items[selectedIndex]).css("background-color", "#BEBEBE");
  7803. }
  7804. };
  7805. Select.prototype.filterItems = function (filterText) {
  7806. this.selectDatas.splice(0, this.selectDatas.length);
  7807. for (var i = 0; i < this.datas.length; i++) {
  7808. if (this.datas[i].indexOf(filterText) != -1) {
  7809. this.selectDatas.push(this.datas[i]);
  7810. }
  7811. }
  7812. };
  7813. Select.prototype.reset = function () {
  7814. this.selectDatas.splice(0, this.selectDatas.length);
  7815. for (var i = 0; i < this.datas.length; i++) {
  7816. this.selectDatas.push(this.datas[i]);
  7817. }
  7818. };
  7819. Select.Template = "\n <div class=\"input-field\">\n <i class=\"icon_normal\"></i>\n <i class=\"mdi-navigation-arrow-drop-down adore_select_arrow\"></i>\n <input type=\"text\">\n <label></label>\n <span class=\"span_base\"></span>\n </div>";
  7820. Select.TemplateDropdown = "<ul class= \"adore_dropDown dropdown-content\"></ul>";
  7821. Select.TemplateLi = "\n <li>\n <a href='#!' class=\"waves-effect\"></a>\n </li>";
  7822. return Select;
  7823. }(Widget_30.Widget));
  7824. exports.Select = Select;
  7825. });
  7826. define("widget/Slider", ["require", "exports", "widget/Widget", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, Widget_31, EventHub_26, MessageType_27, Event_24) {
  7827. "use strict";
  7828. var Slider = (function (_super) {
  7829. __extends(Slider, _super);
  7830. function Slider(parentId, id, style) {
  7831. _super.call(this, parentId, id, style);
  7832. this.$thisNode = $(Slider.Template).attr("id", this.id);
  7833. this.slider = this.$thisNode[0];
  7834. this.step = 1;
  7835. this.min = 0;
  7836. this.max = 100;
  7837. this.startValue = 0;
  7838. this.value = this.startValue;
  7839. }
  7840. Slider.prototype.setStep = function (args) {
  7841. this.step = args.step;
  7842. if (this.isLayout) {
  7843. var own = this;
  7844. this.slider.noUiSlider.updateOptions({
  7845. step: own.step,
  7846. range: {
  7847. "min": own.min,
  7848. "max": own.max
  7849. }
  7850. });
  7851. }
  7852. };
  7853. Slider.prototype.setRange = function (args) {
  7854. this.max = args.max;
  7855. this.min = args.min;
  7856. if (this.isLayout) {
  7857. var own = this;
  7858. this.slider.noUiSlider.updateOptions({
  7859. range: {
  7860. "min": own.min,
  7861. "max": own.max
  7862. }
  7863. });
  7864. }
  7865. };
  7866. Slider.prototype.setValue = function (args) {
  7867. this.value = args.value;
  7868. if (this.isLayout) {
  7869. this.slider.noUiSlider.set(this.value);
  7870. }
  7871. };
  7872. Slider.prototype.postLayout = function () {
  7873. this.isLayout = true;
  7874. var own = this;
  7875. noUiSlider.create(this.slider, {
  7876. start: this.min,
  7877. step: own.step,
  7878. connect: "lower",
  7879. tooltips: [true],
  7880. range: {
  7881. "min": own.min,
  7882. "max": own.max
  7883. }
  7884. });
  7885. $(this.slider).find("div.noUi-tooltip").css({ display: "none" });
  7886. this.slider.noUiSlider.on("start", function () {
  7887. $(own.slider).find("div.noUi-tooltip").css({ display: "block" });
  7888. own.startValue = own.slider.noUiSlider.get();
  7889. });
  7890. this.slider.noUiSlider.on("end", function () {
  7891. $(own.slider).find("div.noUi-tooltip").css({ display: "none" });
  7892. var endValue = own.slider.noUiSlider.get();
  7893. if (own.startValue !== endValue) {
  7894. EventHub_26.EventHub.dispatchEvent(MessageType_27.MessageType.WIDGET, {
  7895. id: own.id,
  7896. evtType: Event_24.Event.ON_CHANGE,
  7897. value: endValue
  7898. });
  7899. }
  7900. });
  7901. };
  7902. Slider.Template = "<div class=\"adore-slider\"></div>";
  7903. return Slider;
  7904. }(Widget_31.Widget));
  7905. exports.Slider = Slider;
  7906. });
  7907. define("widget/tabfolder/TabFolder", ["require", "exports", "widget/Composite", "util/TabUtil"], function (require, exports, Composite_8, TabUtil_1) {
  7908. "use strict";
  7909. var TabFolder = (function (_super) {
  7910. __extends(TabFolder, _super);
  7911. function TabFolder(parentId, id, style) {
  7912. _super.call(this, parentId, id, style);
  7913. this.$thisNode = $(TabFolder.TemplateNormal).attr("id", this.id);
  7914. var tmpTab = this.$thisNode.find(".adore_tabs");
  7915. this.$tabs = tmpTab.attr("id", this.id + "_tabs");
  7916. this.$attachNode = this.$thisNode;
  7917. var tabFolderId = this.id + "_tabs";
  7918. this.$tabs.find("li.tab_left_move").on("click", function (e) {
  7919. TabUtil_1.TabUtil.handleTabLeftMoveClick(tabFolderId);
  7920. });
  7921. this.$tabs.find("li.tab_right_move").on("click", function (e) {
  7922. TabUtil_1.TabUtil.handleTabRightMoveClick(tabFolderId);
  7923. });
  7924. this.originalWidth = window.innerWidth;
  7925. var own = this;
  7926. this.resizeListener = function () {
  7927. if (window.innerWidth !== own.originalWidth) {
  7928. own.originalWidth = window.innerWidth;
  7929. var tabs = $("#" + tabFolderId);
  7930. if (tabs.find("li.adore_tab").length !== 0) {
  7931. TabUtil_1.TabUtil.tabsSwitch(tabs);
  7932. TabUtil_1.TabUtil.refreshTabs(tabs);
  7933. }
  7934. }
  7935. };
  7936. $(window).on("resize", this.resizeListener);
  7937. }
  7938. TabFolder.prototype.addChild = function (child) {
  7939. this.children.push(child);
  7940. };
  7941. TabFolder.prototype.layout = function () {
  7942. if (!document.getElementById(this.id)) {
  7943. this.$thisNode.appendTo(this.parent.$attachNode);
  7944. }
  7945. };
  7946. TabFolder.prototype.dispose = function () {
  7947. $(window).off("resize", this.resizeListener);
  7948. var listener = this.$tabs.data("resize_listener");
  7949. if (listener) {
  7950. $(window).off("resize", listener);
  7951. }
  7952. _super.prototype.dispose.call(this);
  7953. };
  7954. TabFolder.TemplateNormal = "\n <div>\n <ul class=\"adore_tabs\">\n <li class=\"adore_tab_space col\"></li>\n <li class=\"tab_left_move col\"><div class=\"arrow_left\"/></li>\n <li class=\"tab_right_move\"><div class=\"arrow_right\"/></li>\n </ul>\n </div>";
  7955. return TabFolder;
  7956. }(Composite_8.Composite));
  7957. exports.TabFolder = TabFolder;
  7958. });
  7959. define("widget/tabfolder/TabItem", ["require", "exports", "widget/Widget", "event/EventHub", "event/MessageType", "event/Event", "ADORE", "util/WidgetManager", "util/TabUtil", "widget/tabfolder/TabFolder"], function (require, exports, Widget_32, EventHub_27, MessageType_28, Event_25, ADORE_10, WidgetManager_5, TabUtil_2, TabFolder_1) {
  7960. "use strict";
  7961. var TabItem = (function (_super) {
  7962. __extends(TabItem, _super);
  7963. function TabItem(parentId, id, style) {
  7964. _super.call(this, parentId, id, style);
  7965. if (style == ADORE_10.ADORE.Close) {
  7966. this.$thisNode = $(TabItem.TemplateClose).attr("id", this.id);
  7967. }
  7968. else {
  7969. this.$thisNode = $(TabItem.TemplateNormal).attr("id", this.id);
  7970. }
  7971. this.$a = this.$thisNode.find("a");
  7972. this.$i = this.$thisNode.find("i");
  7973. var tabId = this.parent.getId();
  7974. this.isLayout = false;
  7975. var own = this;
  7976. var parentTabsId = tabId + "_tabs";
  7977. this.$a.on("click", function (e) {
  7978. $("#" + parentTabsId).find("a").removeClass("tab_selected").addClass("tab_not_selected");
  7979. $(this).removeClass("tab_not_selected").addClass("tab_selected");
  7980. TabUtil_2.TabUtil.handleTabClick(e, $(this), parentTabsId);
  7981. });
  7982. this.$i.on("click", function () {
  7983. EventHub_27.EventHub.dispatchEvent(MessageType_28.MessageType.WIDGET, {
  7984. id: own.id,
  7985. evtType: Event_25.Event.ON_CLOSE
  7986. });
  7987. });
  7988. }
  7989. TabItem.prototype.setText = function (args) {
  7990. var text = args.text;
  7991. this.$a.text(text);
  7992. };
  7993. TabItem.prototype.setControl = function (args) {
  7994. this.$a.attr("href", "#" + args.control);
  7995. this.relatedControlId = args.control;
  7996. };
  7997. TabItem.prototype.append = function () {
  7998. if (this.parent && this.parent instanceof TabFolder_1.TabFolder) {
  7999. var tempParent = this.parent;
  8000. var lis = tempParent.$tabs.find("li.adore_tab");
  8001. if (lis.length === 0) {
  8002. this.$thisNode.insertAfter(tempParent.$tabs.find("li.tab_left_move"));
  8003. }
  8004. else {
  8005. this.$thisNode.insertAfter($(lis[lis.length - 1]));
  8006. }
  8007. }
  8008. else {
  8009. this.$thisNode.appendTo(document.body);
  8010. }
  8011. };
  8012. TabItem.prototype.layout = function () {
  8013. if (this.relatedControlId) {
  8014. var widget = WidgetManager_5.WidgetManager.byId(this.relatedControlId);
  8015. if (widget) {
  8016. widget.$thisNode.appendTo(this.parent.$attachNode);
  8017. }
  8018. }
  8019. this.append();
  8020. this.isLayout = true;
  8021. if (this.isSelected === true) {
  8022. this.selected(this.$thisNode);
  8023. }
  8024. else {
  8025. var tabItemNodes = this.parent.$tabs.find(".adore_tab");
  8026. if (tabItemNodes.length !== 0) {
  8027. this.selected($(tabItemNodes[0]));
  8028. }
  8029. }
  8030. };
  8031. TabItem.prototype.dispose = function () {
  8032. var tabs = this.parent.$tabs;
  8033. var lis = tabs.find("li.adore_tab");
  8034. var currentIndex = -1;
  8035. var i;
  8036. for (i = 0; i < lis.length; i++) {
  8037. if ($(lis[i]).find("a").attr("href") === this.$a.attr("href")) {
  8038. $(lis[i]).find("a").removeClass("active");
  8039. currentIndex = i;
  8040. break;
  8041. }
  8042. }
  8043. if (currentIndex >= 0 && this.parent && this.parent instanceof TabFolder_1.TabFolder) {
  8044. if (tabs.find("a.active").length <= 0) {
  8045. var showIndex = void 0;
  8046. if (currentIndex <= 0) {
  8047. showIndex = currentIndex + 1;
  8048. }
  8049. else {
  8050. showIndex = currentIndex - 1;
  8051. }
  8052. if (showIndex >= 0 && showIndex < lis.length) {
  8053. var tmpA = $(lis[showIndex]).find("a");
  8054. tmpA.addClass("active");
  8055. $(tmpA.attr("href")).removeClass("tab_control_not_visible").addClass("tab_control_visible");
  8056. tabs.find("a").removeClass("tab_selected").addClass("tab_not_selected");
  8057. tmpA.removeClass("tab_not_selected").addClass("tab_selected");
  8058. }
  8059. }
  8060. }
  8061. _super.prototype.dispose.call(this);
  8062. if (tabs.find(".adore_tab").length > 0) {
  8063. TabUtil_2.TabUtil.tabsSwitch(tabs);
  8064. TabUtil_2.TabUtil.refreshTabs(tabs);
  8065. }
  8066. else {
  8067. tabs.find("div.my_indicator").remove();
  8068. }
  8069. };
  8070. TabItem.prototype.setSelected = function () {
  8071. this.isSelected = true;
  8072. if (this.isLayout) {
  8073. this.selected(this.$thisNode);
  8074. }
  8075. };
  8076. TabItem.prototype.selected = function (selectTabItem) {
  8077. var tabs = this.parent.$tabs;
  8078. var a_active = tabs.find("a.active");
  8079. var activeControl = a_active.attr("href");
  8080. $(activeControl).removeClass("tab_control_visible").addClass("tab_control_not_visible");
  8081. a_active.removeClass("active");
  8082. var selectTabItemA = selectTabItem.find("a").addClass("active");
  8083. var activeDiv = selectTabItemA.attr("href");
  8084. $(activeDiv).removeClass("tab_control_not_visible").addClass("tab_control_visible");
  8085. tabs.find("a").removeClass("tab_selected").addClass("tab_not_selected");
  8086. selectTabItemA.removeClass("tab_not_selected").addClass("tab_selected");
  8087. if (tabs.find(".adore_tab").length > 0) {
  8088. TabUtil_2.TabUtil.tabsSwitch(tabs);
  8089. TabUtil_2.TabUtil.refreshTabs(tabs);
  8090. }
  8091. };
  8092. TabItem.TemplateNormal = "\n <li class=\"col adore_tab\">\n <a class=\"waves-effect\"></a>\n </li>";
  8093. TabItem.TemplateClose = "\n <li class=\"tab col adore_tab\" style=\"position:relative;\">\n <i class=\"tab_icon_close\"></i>\n <a class=\"waves-effect\" style=\"position:absolute;\"></a>\n </li>";
  8094. return TabItem;
  8095. }(Widget_32.Widget));
  8096. exports.TabItem = TabItem;
  8097. });
  8098. define("widget/table/TableConstants", ["require", "exports"], function (require, exports) {
  8099. "use strict";
  8100. var TableConstants = (function () {
  8101. function TableConstants() {
  8102. }
  8103. TableConstants.CELL_TYPE_NULL = "null";
  8104. TableConstants.CELL_TYPE_TEXT = "text";
  8105. TableConstants.CELL_TYPE_COMBO = "combo";
  8106. TableConstants.CELL_TYPE_CHECK = "check";
  8107. TableConstants.CELL_TYPE_BUTTON = "button";
  8108. return TableConstants;
  8109. }());
  8110. exports.TableConstants = TableConstants;
  8111. });
  8112. define("widget/table/TableColumn", ["require", "exports", "widget/Widget", "event/EventHub", "event/MessageType", "event/Event", "ADORE", "widget/table/TableConstants"], function (require, exports, Widget_33, EventHub_28, MessageType_29, Event_26, ADORE_11, TableConstants_1) {
  8113. "use strict";
  8114. var TableColumn = (function (_super) {
  8115. __extends(TableColumn, _super);
  8116. function TableColumn(parentId, id, style) {
  8117. _super.call(this, parentId, id, style);
  8118. this.width = -1;
  8119. this.colIndex = -1;
  8120. this.$thisNode = $(TableColumn.TemplateNormal).attr("id", this.id);
  8121. this.$attachNode = this.$thisNode;
  8122. this.$textNode = this.$attachNode;
  8123. this.type = TableConstants_1.TableConstants.CELL_TYPE_NULL;
  8124. this.visible = true;
  8125. var that = this;
  8126. var tableColumnId = this.id;
  8127. this.$thisNode.on("click", function () {
  8128. if (that.parent.isSortable === true) {
  8129. var thisIndex = that.parent.columns.indexOf(that);
  8130. var dataType = that.parent.columns[thisIndex].type;
  8131. EventHub_28.EventHub.dispatchEvent(MessageType_29.MessageType.WIDGET, {
  8132. id: tableColumnId,
  8133. col: thisIndex,
  8134. dataType: dataType,
  8135. evtType: Event_26.Event.MODIFY
  8136. });
  8137. }
  8138. });
  8139. }
  8140. TableColumn.prototype.setText = function (args) {
  8141. this.$textNode.text(args.text);
  8142. };
  8143. TableColumn.prototype.layout = function () {
  8144. this.doLayout();
  8145. };
  8146. TableColumn.prototype.doLayout = function () {
  8147. this.append();
  8148. if (this.parent) {
  8149. this.parent.refreshColumnsWidth();
  8150. }
  8151. };
  8152. TableColumn.prototype.setType = function (args) {
  8153. this.type = args.type;
  8154. this.changeStyleToCheck();
  8155. };
  8156. TableColumn.prototype.setOptions = function (args) {
  8157. this.options = args.options;
  8158. };
  8159. TableColumn.prototype.append = function () {
  8160. if (this.parent && this.parent.getId()) {
  8161. if (this.parent.$tHead) {
  8162. if (this.colIndex >= 0 && this.colIndex < (this.parent.columns.length - 1)) {
  8163. var index = this.parent.columns.indexOf(this);
  8164. this.parent.columns.splice(index, 1);
  8165. this.$attachNode.insertBefore(this.parent.columns[this.colIndex].$attachNode.eq(0));
  8166. this.parent.columns.splice(this.colIndex, 0, this);
  8167. this.addTableColumnCell(this.colIndex);
  8168. this.colIndex = -1;
  8169. }
  8170. else {
  8171. var tempStyle = this.$thisNode.html();
  8172. this.$thisNode.appendTo(this.parent.$tHead);
  8173. }
  8174. }
  8175. else {
  8176. this.$thisNode.appendTo(this.parent.$attachNode);
  8177. }
  8178. }
  8179. else {
  8180. this.$thisNode.appendTo(document.body);
  8181. }
  8182. };
  8183. TableColumn.prototype.setAlignment = function (args) {
  8184. this.alignment = args.alignment;
  8185. this.alignmentContent = "left";
  8186. if (args.alignment === ADORE_11.ADORE.RIGHT) {
  8187. this.alignmentContent = "right";
  8188. }
  8189. else if (args.alignment === ADORE_11.ADORE.CENTER) {
  8190. this.alignmentContent = "center";
  8191. }
  8192. this.$thisNode.css("text-align", this.alignmentContent);
  8193. var index = this.parent.columns.indexOf(this);
  8194. var tableItems = this.parent.$tBody.find("tr");
  8195. for (var i = 0; i < tableItems.length; i++) {
  8196. $($(tableItems[i]).find("td")[index]).css({ "text-align": this.alignmentContent });
  8197. }
  8198. };
  8199. TableColumn.prototype.setVisible = function (args) {
  8200. _super.prototype.setVisible.call(this, args);
  8201. this.visible = args.visible;
  8202. var index = this.parent.columns.indexOf(this);
  8203. var tableItems = this.parent.$tBody.find("tr");
  8204. var i;
  8205. if (this.visible) {
  8206. for (i = 0; i < tableItems.length; i++) {
  8207. $($(tableItems[i]).find("td")[index]).css({ "display": "block" });
  8208. }
  8209. }
  8210. else {
  8211. for (i = 0; i < tableItems.length; i++) {
  8212. $($(tableItems[i]).find("td")[index]).css({ "display": "none" });
  8213. }
  8214. }
  8215. if (this.parent) {
  8216. this.parent.refreshColumnsWidth();
  8217. }
  8218. };
  8219. TableColumn.prototype.setEnabled = function (args) {
  8220. _super.prototype.setEnabled.call(this, args);
  8221. if (this.type === TableConstants_1.TableConstants.CELL_TYPE_NULL) {
  8222. return;
  8223. }
  8224. var index = this.parent.columns.indexOf(this);
  8225. var tableItems = this.parent.$tBody.find("tr");
  8226. var i;
  8227. var typeCell = "input";
  8228. if (this.type === TableConstants_1.TableConstants.CELL_TYPE_BUTTON) {
  8229. typeCell = "a";
  8230. }
  8231. else if (this.type === TableConstants_1.TableConstants.CELL_TYPE_COMBO) {
  8232. typeCell = "select";
  8233. }
  8234. if (this.enabled) {
  8235. for (i = 0; i < tableItems.length; i++) {
  8236. $($(tableItems[i]).find("td")[index]).find(typeCell).removeAttr("disabled");
  8237. }
  8238. }
  8239. else {
  8240. for (i = 0; i < tableItems.length; i++) {
  8241. $($(tableItems[i]).find("td")[index]).find(typeCell).attr("disabled", "disabled");
  8242. }
  8243. }
  8244. };
  8245. TableColumn.prototype.dispose = function () {
  8246. _super.prototype.dispose.call(this);
  8247. if (this.parent) {
  8248. var index = this.parent.columns.indexOf(this);
  8249. this.parent.columns.splice(index, 1);
  8250. }
  8251. };
  8252. TableColumn.prototype.setFocus = function () {
  8253. };
  8254. TableColumn.prototype.changeStyleToCheck = function () {
  8255. if (this.type === TableConstants_1.TableConstants.CELL_TYPE_CHECK) {
  8256. var tempStyle = this.$attachNode.attr("style");
  8257. this.$attachNode.remove();
  8258. this.$attachNode = $(TableColumn.TemplateCheck).attr("id", this.id);
  8259. this.$thisNode = this.$attachNode;
  8260. this.$attachNode.find("input").attr("id", this.id + "demo");
  8261. this.$textNode = this.$attachNode.find("label");
  8262. this.$textNode.attr("for", this.id + "demo");
  8263. this.$attachNode.attr("style", tempStyle);
  8264. var that_1 = this;
  8265. this.$attachNode.find("input").on("click", function () {
  8266. var checked = $(this).prop("checked");
  8267. var index = that_1.parent.columns.indexOf(that_1);
  8268. var size = that_1.parent.items.length;
  8269. for (var i = 0; i < size; i++) {
  8270. that_1.parent.items[i].setCheckboxState(index, checked);
  8271. }
  8272. EventHub_28.EventHub.dispatchEvent(MessageType_29.MessageType.WIDGET, {
  8273. id: that_1.id,
  8274. col: that_1.parent.columns.indexOf(that_1),
  8275. data: this.checked + "",
  8276. type: "handleChecked",
  8277. evtType: Event_26.Event.MODIFY
  8278. });
  8279. });
  8280. }
  8281. };
  8282. TableColumn.prototype.setWidth = function (args) {
  8283. this.width = args.width;
  8284. var index = this.parent.columns.indexOf(this);
  8285. this.$attachNode.css("width", this.width + "px");
  8286. var tableItems = this.parent.$tBody.find("tr");
  8287. var i;
  8288. for (i = 0; i < tableItems.length; i++) {
  8289. $($(tableItems[i]).find("td")[index]).css("width", this.width + "px");
  8290. }
  8291. };
  8292. TableColumn.prototype.setRowNumCol = function (args) {
  8293. if (args.rowNumCol) {
  8294. var index = this.parent.columns.indexOf(this);
  8295. this.parent.columns.splice(index, 1);
  8296. this.parent.rowNumCol = this;
  8297. this.$thisNode.unbind("click");
  8298. }
  8299. };
  8300. TableColumn.prototype.refreshRowNumCol = function (index) {
  8301. var tableItems = this.parent.$tBody.find("tr");
  8302. for (var i = index; i < tableItems.length; i++) {
  8303. $(tableItems[i]).find("td").eq(0).text((i + 1) + "");
  8304. }
  8305. };
  8306. TableColumn.prototype.setColIndex = function (args) {
  8307. this.colIndex = args.colIndex;
  8308. };
  8309. TableColumn.prototype.setFillData = function (args) {
  8310. this.fillData = args.fillData;
  8311. };
  8312. TableColumn.prototype.addTableColumnCell = function (index) {
  8313. this.parent.addTableColumnCell(index, this.fillData);
  8314. };
  8315. TableColumn.TemplateNormal = "<th></th>";
  8316. TableColumn.TemplateCheck = "\n <th>\n <p tabindex=\"-1\">\n <input type=\"checkbox\" id=\"\" tabindex=\"-1\" class=\"filled-in\"/>\n <label for=\"\" style=\"margin-top: 9px\"></label>\n </p>\n </th>";
  8317. return TableColumn;
  8318. }(Widget_33.Widget));
  8319. exports.TableColumn = TableColumn;
  8320. });
  8321. define("widget/table/TableItem", ["require", "exports", "widget/Widget", "event/EventHub", "event/MessageType", "event/Event", "hotkey/Keys", "widget/table/TableConstants"], function (require, exports, Widget_34, EventHub_29, MessageType_30, Event_27, Keys_10, TableConstants_2) {
  8322. "use strict";
  8323. var TableItem = (function (_super) {
  8324. __extends(TableItem, _super);
  8325. function TableItem(parentId, id, style) {
  8326. _super.call(this, parentId, id, style);
  8327. this.isComboFocus = false;
  8328. this.isTextFocus = false;
  8329. this.rowIndex = -1;
  8330. this.tdNodeArray = new Array();
  8331. this.$thisNode = $(TableItem.TemplateTr).attr("id", this.id);
  8332. this.$attachNode = this.$thisNode;
  8333. var tableId = this.parent.getId();
  8334. var itemId = this.id;
  8335. var own = this;
  8336. this.$thisNode.on("click", function (e) {
  8337. var preTr = $("#" + tableId).find("tr[hadSelected]");
  8338. if (preTr.length > 0 && preTr[0] === e.currentTarget) {
  8339. return;
  8340. }
  8341. var th = $(this).find("th");
  8342. if (th.length > 0) {
  8343. return;
  8344. }
  8345. preTr.removeClass("adore_table_item_selected");
  8346. preTr.removeAttr("hadSelected");
  8347. $(this).addClass("adore_table_item_selected");
  8348. $(this).attr("hadSelected", "true");
  8349. EventHub_29.EventHub.dispatchEvent(MessageType_30.MessageType.WIDGET, {
  8350. id: tableId,
  8351. itemId: itemId,
  8352. evtType: Event_27.Event.CLICK
  8353. });
  8354. });
  8355. }
  8356. TableItem.prototype.setDatas = function (args) {
  8357. var itemId = this.id;
  8358. var datas = args.datas;
  8359. var columns = this.parent.columns;
  8360. var i, j, data, tdNode, id, comboNode, optionNode, cellText;
  8361. this.$thisNode.find("td").html("<div style='display:none;'></div>");
  8362. this.$thisNode.find("td").remove();
  8363. this.tdNodeArray.splice(0, this.tdNodeArray.length);
  8364. var own = this;
  8365. this.addCellRowNum();
  8366. for (i = 0; i < columns.length; i++) {
  8367. this.addCell(i, datas[i]);
  8368. }
  8369. };
  8370. TableItem.prototype.sendFocusGain = function () {
  8371. var id = this.parent.getId;
  8372. EventHub_29.EventHub.dispatchEvent(MessageType_30.MessageType.WIDGET, { id: id, evtType: Event_27.Event.ON_FOCUS });
  8373. };
  8374. TableItem.prototype.append = function () {
  8375. if (this.parent) {
  8376. if (this.parent.$tBody) {
  8377. if (this.rowIndex >= 0 && this.rowIndex < (this.parent.items.length - 1)) {
  8378. var index = this.parent.items.indexOf(this);
  8379. this.parent.items.splice(index, 1);
  8380. this.$attachNode.insertBefore(this.parent.items[this.rowIndex].$attachNode.eq(0));
  8381. this.parent.items.splice(this.rowIndex, 0, this);
  8382. this.parent.refreshCellRowNum();
  8383. this.rowIndex = -1;
  8384. }
  8385. else {
  8386. this.$thisNode.appendTo(this.parent.$tBody);
  8387. }
  8388. }
  8389. else {
  8390. this.$thisNode.appendTo(this.parent.$attachNode);
  8391. }
  8392. }
  8393. else {
  8394. this.$thisNode.appendTo(document.body);
  8395. }
  8396. };
  8397. TableItem.prototype.layout = function () {
  8398. this.append();
  8399. };
  8400. TableItem.prototype.clearSelection = function () {
  8401. this.$thisNode.removeClass("adore_table_item_selected");
  8402. this.$thisNode.removeAttr("hadSelected");
  8403. };
  8404. TableItem.prototype.setSelection = function () {
  8405. this.$thisNode.addClass("adore_table_item_selected");
  8406. this.$thisNode.attr("hadSelected", "true");
  8407. };
  8408. TableItem.prototype.setColor = function (args) {
  8409. this.$thisNode.css("color", args.color);
  8410. };
  8411. TableItem.prototype.setEnabled = function (args) {
  8412. };
  8413. TableItem.prototype.setVisible = function (args) {
  8414. };
  8415. TableItem.prototype.dispose = function () {
  8416. _super.prototype.dispose.call(this);
  8417. if (this.parent) {
  8418. var index = this.parent.items.indexOf(this);
  8419. this.parent.items.splice(index, 1);
  8420. if (this.parent.containRowNum) {
  8421. this.parent.rowNumCol.refreshRowNumCol(index);
  8422. }
  8423. }
  8424. };
  8425. TableItem.prototype.handleKeyDownEvent = function (e, hasFilter) {
  8426. if (e.keyCode == Keys_10.Keys.RIGHT_ARROW || e.keyCode == Keys_10.Keys.LEFT_ARROW) {
  8427. if (!this.isTextFocus) {
  8428. e.preventDefault();
  8429. this.parent.handleKeyDownEvent(e, hasFilter);
  8430. }
  8431. else if (this.isComboFocus) {
  8432. e.preventDefault();
  8433. this.parent.handleKeyDownEvent(e, hasFilter);
  8434. }
  8435. }
  8436. else if (e.keyCode == Keys_10.Keys.UP_ARROW || e.keyCode == Keys_10.Keys.DOWN_ARROW) {
  8437. if (this.isComboFocus) {
  8438. e.preventDefault();
  8439. this.parent.handleKeyDownEvent(e, hasFilter);
  8440. }
  8441. else {
  8442. this.parent.handleKeyDownEvent(e, hasFilter);
  8443. }
  8444. }
  8445. else {
  8446. this.parent.handleKeyDownEvent(e, hasFilter);
  8447. }
  8448. };
  8449. TableItem.prototype.setCellSelection = function (args) {
  8450. var colIndex = args.colIndex;
  8451. var type = this.parent.columns[colIndex].type;
  8452. var $tdNode = this.tdNodeArray[colIndex];
  8453. switch (type) {
  8454. case TableConstants_2.TableConstants.CELL_TYPE_TEXT:
  8455. if (document.activeElement !== $tdNode.find("input")[0]) {
  8456. $tdNode.find("input").focus();
  8457. }
  8458. break;
  8459. case TableConstants_2.TableConstants.CELL_TYPE_COMBO:
  8460. if (document.activeElement !== $tdNode.find("select")[0]) {
  8461. $tdNode.find("select").focus();
  8462. }
  8463. break;
  8464. case TableConstants_2.TableConstants.CELL_TYPE_CHECK:
  8465. if (document.activeElement !== $tdNode.find("p")[0]) {
  8466. $tdNode.find("p").focus();
  8467. }
  8468. break;
  8469. case TableConstants_2.TableConstants.CELL_TYPE_BUTTON:
  8470. if (document.activeElement !== $tdNode.find("a")[0]) {
  8471. $tdNode.find("div").focus();
  8472. }
  8473. break;
  8474. default:
  8475. break;
  8476. }
  8477. };
  8478. TableItem.prototype.setCheckValue = function (args) {
  8479. var colIndex = args.colIndex;
  8480. var $checkNode = this.tdNodeArray[colIndex].find("input");
  8481. var value = $checkNode.prop("checked");
  8482. $checkNode.prop("checked", !value);
  8483. };
  8484. TableItem.prototype.openSelect = function (args) {
  8485. var colIndex = args.colIndex;
  8486. var elem = this.tdNodeArray[colIndex].find("select");
  8487. if (document.createEvent) {
  8488. var e = document.createEvent("MouseEvents");
  8489. e.initMouseEvent("mousedown");
  8490. elem[0].dispatchEvent(e);
  8491. }
  8492. else if (elem[0].fireEvent) {
  8493. elem[0].fireEvent("onmousedown");
  8494. }
  8495. };
  8496. TableItem.prototype.setFocus = function () {
  8497. };
  8498. TableItem.prototype.setCheckboxState = function (index, checkboxState) {
  8499. var $checkboxNode = this.tdNodeArray[index];
  8500. $checkboxNode.find("input:checkbox").eq(0).prop("checked", checkboxState);
  8501. $checkboxNode.find("input:checkbox").eq(0).prop("indeterminate", false);
  8502. };
  8503. TableItem.prototype.refreshHeadCheckboxState = function (index) {
  8504. var $checkboxNode = this.tdNodeArray[index];
  8505. var currentChecked = $checkboxNode.find("input").eq(0).prop("checked");
  8506. var column = this.parent.columns[index];
  8507. var $headCheckNode = column.$thisNode.find("input").eq(0);
  8508. var size = this.parent.items.length;
  8509. var state = -1;
  8510. for (var i = 0; i < size; i++) {
  8511. var tmpChecked = this.parent.items[i].getCheckboxState(index);
  8512. if (tmpChecked) {
  8513. if (state == -1) {
  8514. state = 0;
  8515. }
  8516. else if (state != 0) {
  8517. state = 2;
  8518. break;
  8519. }
  8520. }
  8521. else {
  8522. if (state == -1) {
  8523. state = 1;
  8524. }
  8525. else if (state != 1) {
  8526. state = 2;
  8527. break;
  8528. }
  8529. }
  8530. }
  8531. if (state == 0) {
  8532. $headCheckNode.prop("checked", true);
  8533. $headCheckNode.prop("indeterminate", false);
  8534. }
  8535. else if (state == 1) {
  8536. $headCheckNode.prop("checked", false);
  8537. $headCheckNode.prop("indeterminate", false);
  8538. }
  8539. else {
  8540. $headCheckNode.prop("checked", false);
  8541. $headCheckNode.prop("indeterminate", true);
  8542. }
  8543. };
  8544. TableItem.prototype.getCheckboxState = function (index) {
  8545. var $checkboxNode = this.tdNodeArray[index];
  8546. return $checkboxNode.find("input").eq(0).prop("checked");
  8547. };
  8548. TableItem.prototype.addCellRowNum = function () {
  8549. if (this.parent.containRowNum) {
  8550. var index = this.parent.items.indexOf(this);
  8551. var $tdNode = $(TableItem.TemplateNone);
  8552. $tdNode.attr("title", (index + 1) + "");
  8553. $tdNode.text((index + 1) + "");
  8554. $tdNode.appendTo(this.$attachNode);
  8555. $tdNode.css("text-align", "center");
  8556. this.$rowNumNode = $tdNode;
  8557. }
  8558. };
  8559. TableItem.prototype.refreshCellRowNum = function (index) {
  8560. if (this.parent.containRowNum) {
  8561. if (this.$rowNumNode) {
  8562. this.$rowNumNode.text((index + 1) + "");
  8563. }
  8564. }
  8565. };
  8566. TableItem.prototype.addCell = function (colIndex, data) {
  8567. var columns = this.parent.columns;
  8568. var $tdNode, $comboNode, $optionNode, id, cellText;
  8569. var own = this;
  8570. var itemId = this.id;
  8571. var tableId = this.parent.getId();
  8572. var i = colIndex;
  8573. cellText = TableConstants_2.TableConstants.CELL_TYPE_NULL;
  8574. if (columns[i].type === TableConstants_2.TableConstants.CELL_TYPE_NULL) {
  8575. $tdNode = $(TableItem.TemplateNone);
  8576. $tdNode.attr("title", data);
  8577. $tdNode.text(data);
  8578. }
  8579. else if (columns[i].type === TableConstants_2.TableConstants.CELL_TYPE_TEXT) {
  8580. $tdNode = $(TableItem.TemplateText);
  8581. $tdNode.find("input").val(data);
  8582. cellText = "input";
  8583. $tdNode.find("input").attr("col", i).on("input", function (e) {
  8584. EventHub_29.EventHub.dispatchEvent(MessageType_30.MessageType.WIDGET, {
  8585. id: itemId,
  8586. col: own.getColIndex($tdNode),
  8587. data: this.value,
  8588. evtType: Event_27.Event.MODIFY
  8589. });
  8590. }).on("focus", function (e) {
  8591. console.log("focus in : TEXT");
  8592. own.isTextFocus = true;
  8593. own.parent.isCellFocus = true;
  8594. own.parent.sendFocusGain();
  8595. EventHub_29.EventHub.dispatchEvent(MessageType_30.MessageType.WIDGET, {
  8596. id: tableId,
  8597. itemId: itemId,
  8598. col: own.getColIndex($tdNode),
  8599. evtType: Event_27.Event.CLICK
  8600. });
  8601. }).on("blur", function () {
  8602. console.log("focus out : TEXT");
  8603. own.isTextFocus = false;
  8604. own.parent.isCellFocus = false;
  8605. });
  8606. }
  8607. else if (columns[i].type === TableConstants_2.TableConstants.CELL_TYPE_CHECK) {
  8608. $tdNode = $(TableItem.TemplateCheck);
  8609. id = columns[i].id + "_" + this.id;
  8610. $tdNode.find("input").attr("id", id);
  8611. $tdNode.find("label").attr("for", id);
  8612. cellText = "input";
  8613. if (data === "true") {
  8614. $tdNode.find("input").prop("checked", true);
  8615. }
  8616. $tdNode.find("input").attr("col", i).on("change", function (e) {
  8617. EventHub_29.EventHub.dispatchEvent(MessageType_30.MessageType.WIDGET, {
  8618. id: itemId,
  8619. col: own.getColIndex($tdNode),
  8620. data: this.checked + "",
  8621. evtType: Event_27.Event.MODIFY
  8622. });
  8623. });
  8624. $tdNode.find("input").attr("col", i).on("click", function (e) {
  8625. var colIndex = own.getColIndex($tdNode);
  8626. own.refreshHeadCheckboxState(parseInt(colIndex));
  8627. });
  8628. $tdNode.find("p").on("focus", function (e) {
  8629. console.log("focus in : CHECK");
  8630. own.parent.isCellFocus = true;
  8631. own.parent.sendFocusGain();
  8632. EventHub_29.EventHub.dispatchEvent(MessageType_30.MessageType.WIDGET, {
  8633. id: tableId,
  8634. itemId: itemId,
  8635. col: own.getColIndex($tdNode),
  8636. evtType: Event_27.Event.CLICK
  8637. });
  8638. }).on("blur", function () {
  8639. own.parent.isCellFocus = false;
  8640. });
  8641. }
  8642. else if (columns[i].type === TableConstants_2.TableConstants.CELL_TYPE_COMBO) {
  8643. $tdNode = $(TableItem.TemplateCombo);
  8644. cellText = "select";
  8645. if (columns[i].options) {
  8646. $comboNode = $tdNode.find("select");
  8647. for (var j = 0; j < columns[i].options.length; j++) {
  8648. $optionNode = $(TableItem.TemplateOption).text(columns[i].options[j]);
  8649. if (columns[i].options[j] === data) {
  8650. $optionNode.prop("selected", true);
  8651. }
  8652. $optionNode.appendTo($comboNode);
  8653. }
  8654. $comboNode.attr("col", i + "").on("change", function (e) {
  8655. EventHub_29.EventHub.dispatchEvent(MessageType_30.MessageType.WIDGET, {
  8656. id: itemId,
  8657. col: own.getColIndex($tdNode),
  8658. data: this.value,
  8659. evtType: Event_27.Event.MODIFY
  8660. });
  8661. }).on("focus", function (e) {
  8662. console.log("focus in : COMBO");
  8663. own.parent.isCellFocus = true;
  8664. own.isComboFocus = true;
  8665. own.parent.sendFocusGain();
  8666. EventHub_29.EventHub.dispatchEvent(MessageType_30.MessageType.WIDGET, {
  8667. id: tableId,
  8668. itemId: itemId,
  8669. col: own.getColIndex($tdNode),
  8670. evtType: Event_27.Event.CLICK
  8671. });
  8672. }).on("blur", function (e) {
  8673. console.log("focus out : COMBO");
  8674. own.isComboFocus = false;
  8675. own.parent.isCellFocus = false;
  8676. });
  8677. $comboNode.on("click mousedown", function () {
  8678. own.parent.isCellFocus = true;
  8679. own.isComboFocus = true;
  8680. EventHub_29.EventHub.dispatchEvent(MessageType_30.MessageType.WIDGET, {
  8681. id: tableId,
  8682. itemId: itemId,
  8683. col: own.getColIndex($tdNode),
  8684. evtType: Event_27.Event.CLICK
  8685. });
  8686. });
  8687. }
  8688. }
  8689. else if (columns[i].type === TableConstants_2.TableConstants.CELL_TYPE_BUTTON) {
  8690. $tdNode = $(TableItem.TemplateButton);
  8691. var begin = data.indexOf("${");
  8692. var end = data.indexOf("}");
  8693. cellText = "a";
  8694. if (begin !== -1 && end > begin) {
  8695. var clazz = data.substring(begin + 2, end);
  8696. if (clazz.indexOf("-") !== -1) {
  8697. $tdNode.find("span").addClass(clazz);
  8698. }
  8699. else {
  8700. $tdNode.find("span").addClass("adr-" + clazz);
  8701. }
  8702. }
  8703. else {
  8704. $tdNode.find("span").text(data);
  8705. }
  8706. $tdNode.find("div").attr("col", i + "").on("click", function (e) {
  8707. EventHub_29.EventHub.dispatchEvent(MessageType_30.MessageType.WIDGET, {
  8708. id: itemId,
  8709. col: own.getColIndex($tdNode),
  8710. data: data,
  8711. evtType: Event_27.Event.MODIFY
  8712. });
  8713. }).on("focus", function (e) {
  8714. own.parent.isCellFocus = true;
  8715. own.parent.sendFocusGain();
  8716. EventHub_29.EventHub.dispatchEvent(MessageType_30.MessageType.WIDGET, {
  8717. id: tableId,
  8718. itemId: itemId,
  8719. col: own.getColIndex($tdNode),
  8720. evtType: Event_27.Event.CLICK
  8721. });
  8722. }).on("blur", function () {
  8723. own.parent.isCellFocus = false;
  8724. });
  8725. }
  8726. if (colIndex < this.tdNodeArray.length) {
  8727. var $tempNode = this.tdNodeArray[colIndex];
  8728. $tdNode.insertBefore($tempNode.eq(0));
  8729. this.tdNodeArray.splice(colIndex, 0, $tdNode);
  8730. }
  8731. else {
  8732. $tdNode.appendTo(this.$attachNode);
  8733. this.tdNodeArray.push($tdNode);
  8734. }
  8735. if (columns[i].type === TableConstants_2.TableConstants.CELL_TYPE_CHECK) {
  8736. this.refreshHeadCheckboxState(i);
  8737. }
  8738. if (columns[i].visible === false) {
  8739. $tdNode.css("display", "none");
  8740. }
  8741. if (columns[i].enabled === false && cellText !== TableConstants_2.TableConstants.CELL_TYPE_NULL) {
  8742. $tdNode.find(cellText).attr("disabled", "disabled");
  8743. }
  8744. if (columns[i].alignmentContent) {
  8745. $tdNode.css("text-align", columns[i].alignmentContent);
  8746. }
  8747. };
  8748. TableItem.prototype.getColIndex = function (tdNode) {
  8749. return this.tdNodeArray.indexOf(tdNode) + "";
  8750. };
  8751. TableItem.prototype.setRowIndex = function (args) {
  8752. this.rowIndex = args.rowIndex;
  8753. };
  8754. TableItem.TemplateTr = "<tr></tr>";
  8755. TableItem.TemplateNone = "<td></td>";
  8756. TableItem.TemplateText = "\n <td>\n <input type=\"text\" style=\"border: none;text-align: inherit;width: 100%;font-size: 1rem;\"/>\n </td>";
  8757. TableItem.TemplateCheck = "\n <td>\n <p tabindex=\"-1\">\n <input type=\"checkbox\" id=\"\" class=\"filled-in\"/>\n <label for=\"\" style=\"margin-top: 9px\"></label>\n </p>\n </td>";
  8758. TableItem.TemplateCombo = "\n <td>\n <select class=\"browser-default\" style=\"display:inline;width: 100%;height:36px;\">\n </select>\n </td>";
  8759. TableItem.TemplateButton = "\n <td>\n <div class=\"waves-effect waves-light btn adore_button\" style=\"background: #17D1C8;\" tabindex=\"-1\" data-position=\"top\" data-delay=\"50\"><span></span><i></i></div>\n </td>";
  8760. TableItem.TemplateOption = "<option></option>";
  8761. return TableItem;
  8762. }(Widget_34.Widget));
  8763. exports.TableItem = TableItem;
  8764. });
  8765. define("widget/table/Table", ["require", "exports", "event/EventHub", "event/MessageType", "event/Event", "widget/table/TableColumn", "widget/table/TableItem", "widget/Composite"], function (require, exports, EventHub_30, MessageType_31, Event_28, TableColumn_1, TableItem_1, Composite_9) {
  8766. "use strict";
  8767. var Table = (function (_super) {
  8768. __extends(Table, _super);
  8769. function Table(parentId, id, style) {
  8770. _super.call(this, parentId, id, style);
  8771. this.columns = new Array();
  8772. this.items = new Array();
  8773. this.isSortable = true;
  8774. this.isCellFocus = false;
  8775. this.sortable = true;
  8776. this.containRowNum = false;
  8777. this.children = new Array();
  8778. this.columns = new Array();
  8779. this.items = new Array();
  8780. this.$thisNode = $(Table.TemplateNormal).attr("id", this.id);
  8781. this.$attachNode = this.$thisNode;
  8782. this.$tHead = this.$thisNode.find("tr");
  8783. this.$tBody = this.$thisNode.find("tbody");
  8784. var own = this;
  8785. this.isFocus = false;
  8786. this.$thisNode.find("table").on("focus", function (e) {
  8787. console.log("table focus in");
  8788. own.sendFocusGain();
  8789. own.isFocus = true;
  8790. }).on("blur", function (e) {
  8791. own.isFocus = false;
  8792. });
  8793. this.$thisNode.find("table").on("dblclick", function (e) {
  8794. if (e.target.localName && e.target.localName === "th") {
  8795. EventHub_30.EventHub.dispatchEvent(MessageType_31.MessageType.WIDGET, {
  8796. id: own.id,
  8797. evtType: Event_28.Event.DOUBLE_CLICK,
  8798. header: true
  8799. });
  8800. }
  8801. else {
  8802. EventHub_30.EventHub.dispatchEvent(MessageType_31.MessageType.WIDGET, {
  8803. id: own.id,
  8804. evtType: Event_28.Event.DOUBLE_CLICK
  8805. });
  8806. }
  8807. });
  8808. }
  8809. Table.prototype.addChild = function (child) {
  8810. _super.prototype.addChild.call(this, child);
  8811. if (child instanceof TableColumn_1.TableColumn) {
  8812. this.columns.push(child);
  8813. }
  8814. else if (child instanceof TableItem_1.TableItem) {
  8815. this.items.push(child);
  8816. }
  8817. };
  8818. Table.prototype.sendFocusGain = function () {
  8819. _super.prototype.sendFocusGain.call(this);
  8820. this.isFocus = true;
  8821. };
  8822. Table.prototype.setFocus = function () {
  8823. console.log("table setFocus");
  8824. if (!this.isFocus) {
  8825. this.sendFocusGain();
  8826. }
  8827. };
  8828. Table.prototype.layout = function () {
  8829. _super.prototype.layout.call(this);
  8830. };
  8831. Table.prototype.refreshColumnsWidth = function () {
  8832. };
  8833. Table.prototype.handleKeyDownEvent = function (e, hasFilter) {
  8834. _super.prototype.handleKeyDownEvent.call(this, e, hasFilter);
  8835. };
  8836. Table.prototype.setSortable = function (args) {
  8837. this.isSortable = args.isSortable;
  8838. };
  8839. Table.prototype.addRowNum = function (args) {
  8840. this.containRowNum = args.containRowNum;
  8841. };
  8842. Table.prototype.addTableColumnCell = function (index, defaultData) {
  8843. var itemSize = this.items.length;
  8844. for (var i = 0; i < itemSize; i++) {
  8845. this.items[i].addCell(index, defaultData);
  8846. }
  8847. };
  8848. Table.prototype.reorder = function (args) {
  8849. var reorderIndexed = args.reorderIndexes;
  8850. var newItems = new Array();
  8851. for (var i = 0; i < reorderIndexed.length; i++) {
  8852. newItems[i] = this.items[reorderIndexed[i]];
  8853. newItems[i].$thisNode.detach();
  8854. }
  8855. this.items = newItems;
  8856. this.refreshCellRowNum();
  8857. for (var i = 0; i < this.items.length; i++) {
  8858. newItems[i].$thisNode.appendTo(this.$tBody);
  8859. }
  8860. };
  8861. Table.prototype.refreshCellRowNum = function () {
  8862. for (var i = 0; i < this.items.length; i++) {
  8863. this.items[i].refreshCellRowNum(i);
  8864. }
  8865. };
  8866. Table.TemplateNormal = "\n <div style=\"overflow: auto; outline: 0;\">\n <table style=\"outline: 0;\" class=\"adore_table\" tabindex=\"-1\">\n <thead>\n <tr style=\"color:#000\"> \n </tr>\n </thead>\n <tbody>\n </tbody>\n </table>\n </div>";
  8867. return Table;
  8868. }(Composite_9.Composite));
  8869. exports.Table = Table;
  8870. });
  8871. define("widget/TextArea", ["require", "exports", "event/EventHub", "event/MessageType", "event/Event", "widget/Text", "util/RequisiteUtil"], function (require, exports, EventHub_31, MessageType_32, Event_29, Text_1, RequisiteUtil_2) {
  8872. "use strict";
  8873. var TextArea = (function (_super) {
  8874. __extends(TextArea, _super);
  8875. function TextArea(parentId, id, style) {
  8876. _super.call(this, parentId, id, style);
  8877. var own = this;
  8878. this.$thisNode = $(TextArea.TemplateNormal).attr({
  8879. id: this.id + "_containerNode"
  8880. });
  8881. this.$inputNode = this.$thisNode.find("textarea");
  8882. this.$inputNode.attr("id", this.id).on("input", function (e) {
  8883. if ($(this).prop("comStart"))
  8884. return;
  8885. own.handleOnInput();
  8886. EventHub_31.EventHub.dispatchEvent(MessageType_32.MessageType.WIDGET, {
  8887. id: id,
  8888. text: $(this).val(),
  8889. evtType: Event_29.Event.MODIFY,
  8890. syncAttrName: "text"
  8891. });
  8892. }).on("focus", function () {
  8893. own.sendFocusGain();
  8894. }).on("blur", function () {
  8895. RequisiteUtil_2.RequisiteUtil.checkRequisite(own.requisite, own, own.editable, own.$inputNode.val(), "请输入数据!");
  8896. }).on("compositionstart", function () {
  8897. $(this).prop("comStart", true);
  8898. }).on('compositionend', function () {
  8899. $(this).prop("comStart", false);
  8900. });
  8901. this.$thisNode.find("label").attr("for", this.id);
  8902. }
  8903. TextArea.TemplateNormal = "\n <div class=\"input-field\">\n <i class=\"icon_normal\"></i>\n <textarea class=\"materialize-textarea\"></textarea>\n <label></label>\n <span class=\"span_base\"></span>\n </div>";
  8904. return TextArea;
  8905. }(Text_1.Text));
  8906. exports.TextArea = TextArea;
  8907. });
  8908. define("widget/toast/Toast", ["require", "exports", "widget/Widget", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, Widget_35, EventHub_32, MessageType_33, Event_30) {
  8909. "use strict";
  8910. var Toast = (function (_super) {
  8911. __extends(Toast, _super);
  8912. function Toast(parentId, id, style) {
  8913. _super.call(this, parentId, id, style);
  8914. this.$thisNode = $(Toast.TemplateToast).attr("id", this.id);
  8915. this.buttonClickEventDispatch();
  8916. }
  8917. Toast.prototype.setContent = function (args) {
  8918. this.$thisNode.find("span").eq(1).html(args.content.toastName);
  8919. this.$thisNode.find("span").eq(2).html(args.content.receiveTime);
  8920. };
  8921. Toast.prototype.resetShowTime = function (args) {
  8922. var own = this;
  8923. if (own.timeoutSign) {
  8924. clearTimeout(own.timeoutSign);
  8925. }
  8926. own.timeoutSign = setTimeout(function () {
  8927. own.$thisNode.get(0).addEventListener("webkitAnimationEnd", function () {
  8928. EventHub_32.EventHub.dispatchEvent(MessageType_33.MessageType.WIDGET, { id: own.id, evtType: Event_30.Event.ON_CLOSE });
  8929. });
  8930. own.$thisNode.addClass("removing");
  8931. }, args.time * 1000);
  8932. };
  8933. Toast.prototype.buttonClickEventDispatch = function () {
  8934. var own = this;
  8935. var showButton = this.$thisNode.find(".showButton");
  8936. var closeButton = this.$thisNode.find(".closeButton");
  8937. showButton.on("click", function () {
  8938. EventHub_32.EventHub.dispatchEvent(MessageType_33.MessageType.WIDGET, { id: own.id, evtType: Event_30.Event.CLICK });
  8939. });
  8940. closeButton.on("click", function () {
  8941. own.$thisNode.get(0).addEventListener("webkitAnimationEnd", function () {
  8942. EventHub_32.EventHub.dispatchEvent(MessageType_33.MessageType.WIDGET, { id: own.id, evtType: Event_30.Event.ON_CLOSE });
  8943. });
  8944. own.$thisNode.addClass("removing");
  8945. });
  8946. };
  8947. Toast.TemplateToast = "\n <div class=\"adore_toast\">\n <span>\u6211\u7684\u4EFB\u52A1</span>\n <span></span>\n <span></span>\n <div class=\"showButton waves-effect waves-light large\">\u67E5\u770B</div>\n <div class=\"closeButton waves-effect waves-light large mdi-content-clear\"></div>\n </div>\n ";
  8948. return Toast;
  8949. }(Widget_35.Widget));
  8950. exports.Toast = Toast;
  8951. });
  8952. define("widget/toast/ToastList", ["require", "exports", "widget/Composite"], function (require, exports, Composite_10) {
  8953. "use strict";
  8954. var ToastList = (function (_super) {
  8955. __extends(ToastList, _super);
  8956. function ToastList(parentId, id, style) {
  8957. _super.call(this, parentId, id, style);
  8958. this.$thisNode = $(ToastList.TemplateToastList).attr("id", this.id);
  8959. this.$attachNode = this.$thisNode;
  8960. }
  8961. ToastList.prototype.layout = function () {
  8962. this.$thisNode.appendTo($("body"));
  8963. for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
  8964. var child = _a[_i];
  8965. child.$thisNode.appendTo(this.$thisNode);
  8966. }
  8967. };
  8968. ToastList.prototype.setPosition = function (args) {
  8969. this.$thisNode.css({
  8970. "margin-top": args.position.top + "px",
  8971. "margin-left": args.position.left + "px"
  8972. });
  8973. };
  8974. ToastList.TemplateToastList = "\n <div class=\"adore_toast_list\"></div>\n ";
  8975. return ToastList;
  8976. }(Composite_10.Composite));
  8977. exports.ToastList = ToastList;
  8978. });
  8979. define("widget/Toolbar", ["require", "exports", "widget/Composite", "widget/Button"], function (require, exports, Composite_11, Button_1) {
  8980. "use strict";
  8981. var Toolbar = (function (_super) {
  8982. __extends(Toolbar, _super);
  8983. function Toolbar(parentId, id, style) {
  8984. _super.call(this, parentId, id, style);
  8985. this.typeFlag = "";
  8986. this.instance = "Toolbar";
  8987. }
  8988. Toolbar.prototype.toString = function () {
  8989. return this.typeFlag;
  8990. };
  8991. Toolbar.prototype.createDropDownBox = function () {
  8992. var own = this;
  8993. var dropDownListWidth = 108;
  8994. this.$ulNode = $("<ul>").addClass("card-panel adore_toolbar_dropDownList")
  8995. .insertAfter(this.$thisNode)
  8996. .css({ width: dropDownListWidth, display: "none", height: 0, padding: 0 })
  8997. .on("click", function () {
  8998. $(this).attr("popup", "true").css({ height: 0, display: "none" });
  8999. });
  9000. this.$dropDownBtn = $(Toolbar.Template)
  9001. .appendTo(this.$attachNode).on("click", function () {
  9002. if (parseInt(own.$ulNode.css("height").replace("px", "")) === 0) {
  9003. own.$ulNode.attr("popup", "true").css({ height: own.children.length * 54, display: "block" });
  9004. }
  9005. else {
  9006. own.$ulNode.attr("popup", "true").css({ height: 0, display: "none" });
  9007. }
  9008. });
  9009. this.$attachNode = this.$ulNode;
  9010. };
  9011. Toolbar.prototype.layout = function () {
  9012. _super.prototype.layout.call(this);
  9013. var own = this;
  9014. var originAttachNode = this.$attachNode;
  9015. var dropDownListWidth = 108;
  9016. if (parseInt(this.$thisNode.css("width").replace("px", "")) < dropDownListWidth) {
  9017. this.typeFlag = "ToolBar";
  9018. this.createDropDownBox();
  9019. }
  9020. $(window).resize(function () {
  9021. if (parseInt(own.$thisNode.css("width").replace("px", "")) < dropDownListWidth) {
  9022. if (own.$attachNode === originAttachNode) {
  9023. if (own.$ulNode) {
  9024. own.$attachNode = own.$ulNode;
  9025. own.$ulNode.css({ display: "none", height: 0 });
  9026. own.$dropDownBtn.css({ display: "block" });
  9027. }
  9028. else {
  9029. own.createDropDownBox();
  9030. }
  9031. own.typeFlag = "ToolBar";
  9032. for (var i = 0; i < own.children.length; i++) {
  9033. if (own.children[i] instanceof Button_1.Button) {
  9034. own.children[i].refreshToolbar(own.children[i]);
  9035. }
  9036. }
  9037. }
  9038. else {
  9039. }
  9040. }
  9041. else {
  9042. if (own.$attachNode === originAttachNode) {
  9043. }
  9044. else {
  9045. own.$attachNode = originAttachNode;
  9046. own.typeFlag = "";
  9047. own.$dropDownBtn.css("display", "none");
  9048. own.$ulNode.css({ display: "none", height: 0 });
  9049. for (var i = 0; i < own.children.length; i++) {
  9050. own.children[i].postLayout();
  9051. }
  9052. }
  9053. }
  9054. });
  9055. };
  9056. Toolbar.TemplateToolbar = "\n <nav class=\"top-nav adore_header\">\n <div></div>\n </nav>";
  9057. Toolbar.Template = "\n <a class=\"waves-effect btn-flat adore_button adore_button_flat btn-large\" style=\"color:white\" tabindex=\"-1\">\n <i style=\"position: absolute;right: 10px;font-size: 2.4em\" class=\"mdi-navigation-more-vert\">\n </i>\n <span>\n </span>\n </a>\n ";
  9058. return Toolbar;
  9059. }(Composite_11.Composite));
  9060. exports.Toolbar = Toolbar;
  9061. });
  9062. define("widget/transfernetwork/AppointmentQueue", ["require", "exports", "widget/Widget", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, Widget_36, EventHub_33, MessageType_34, Event_31) {
  9063. "use strict";
  9064. var AppointmentQueue = (function (_super) {
  9065. __extends(AppointmentQueue, _super);
  9066. function AppointmentQueue(parentId, id, style) {
  9067. _super.call(this, parentId, id, style);
  9068. this.$thisNode = $(AppointmentQueue.TemplateCotainer).attr({ id: this.id });
  9069. }
  9070. AppointmentQueue.prototype.addItems = function (args) {
  9071. var items = args.items;
  9072. if (!items || items.length === 0) {
  9073. return;
  9074. }
  9075. for (var i = 0; i < items.length; i++) {
  9076. if (items[i].id) {
  9077. if (this.$thisNode.find("#" + items[i].id).length !== 0) {
  9078. this.setItem(items[i]);
  9079. }
  9080. else {
  9081. this.addItem(items[i]);
  9082. }
  9083. }
  9084. }
  9085. };
  9086. AppointmentQueue.prototype.addItem = function (item) {
  9087. var $itemNode = $(AppointmentQueue.TemplateQueue).attr({ id: item.id });
  9088. $itemNode.appendTo(this.$thisNode);
  9089. this.setWindowAttr($itemNode, item);
  9090. var own = this;
  9091. $itemNode.find(".appointment_queue_delete").on("click", function (e) {
  9092. EventHub_33.EventHub.dispatchEvent(MessageType_34.MessageType.WIDGET, {
  9093. id: own.id,
  9094. removeId: item.id,
  9095. evtType: Event_31.Event.MODIFY
  9096. });
  9097. });
  9098. };
  9099. AppointmentQueue.prototype.setWindowAttr = function ($itemNode, item) {
  9100. var temp = item.id.split("k");
  9101. if (item.id) {
  9102. var $idNode = $itemNode.find(".appointment_queue_id");
  9103. $idNode.text("预约编号:" + item.id);
  9104. }
  9105. if (item.mediumType) {
  9106. var $mtNode = $itemNode.find(".appointment_queue_body_mediumtype");
  9107. $mtNode.text("介质类型:" + item.mediumType);
  9108. var $mtImg = $(AppointmentQueue.TemplateImage).appendTo($mtNode);
  9109. $mtImg.attr("src", "images/appointment_queue/cardType.png");
  9110. }
  9111. if (item.mediumNum) {
  9112. var $mnNode = $itemNode.find(".appointment_queue_body_mediumnum");
  9113. var begin_mediumNum = item.mediumNum.substring(0, 6);
  9114. var end_mediumNum = item.mediumNum.substring(11);
  9115. var new_mediumNum = begin_mediumNum + "*****" + end_mediumNum;
  9116. $mnNode.text("介质号码:" + new_mediumNum);
  9117. var $mnImg = $(AppointmentQueue.TemplateImage).appendTo($mnNode);
  9118. $mnImg.attr("src", "images/appointment_queue/jizhiNum.png");
  9119. }
  9120. if (temp[2]) {
  9121. var $pnNode = $itemNode.find(".appointment_queue_body_phonenum");
  9122. var begin_phoneNum = temp[2].substring(0, 3);
  9123. var end_phoneNum = temp[2].substring(7);
  9124. var new_phoneNum = begin_phoneNum + "****" + end_phoneNum;
  9125. $pnNode.text("手机号码:" + new_phoneNum);
  9126. var $pnImg = $(AppointmentQueue.TemplateImage).appendTo($pnNode);
  9127. $pnImg.attr("src", "images/appointment_queue/phoneNum.png");
  9128. }
  9129. if (temp[0] && item.appointmentTime) {
  9130. var s = temp[0].split("-");
  9131. var str = s[0] + "年" + s[1] + "月" + s[2] + "日";
  9132. var $atNode = $itemNode.find(".appointment_queue_body_appointmenttime");
  9133. $atNode.text("预约时间:" + str + " " + item.appointmentTime);
  9134. var $atImg = $(AppointmentQueue.TemplateImage).appendTo($atNode);
  9135. $atImg.attr("src", "images/appointment_queue/time.png");
  9136. }
  9137. };
  9138. AppointmentQueue.prototype.setItem = function (item) {
  9139. var $itemNode = this.$thisNode.find("#" + item.id);
  9140. this.setWindowAttr($itemNode, item);
  9141. };
  9142. AppointmentQueue.prototype.removeItems = function (args) {
  9143. var ids = args.itemIds;
  9144. if (ids && ids.length > 0) {
  9145. for (var i = 0; i < ids.length; i++) {
  9146. var $node = this.$thisNode.find("#" + ids[i]);
  9147. $node.remove();
  9148. }
  9149. }
  9150. };
  9151. AppointmentQueue.prototype.clean = function () {
  9152. this.$thisNode.find(".appointment_queue").remove();
  9153. };
  9154. AppointmentQueue.prototype.setFocus = function () {
  9155. };
  9156. AppointmentQueue.TemplateCotainer = "<div class=\"row\"></div>";
  9157. AppointmentQueue.TemplateQueue = "\n <div class=\"col s6 m6 l5 appointment_queue\">\n <div class=\"appointment_queue_shadow\">\n <div class=\"appointment_queue_header\">\n <div class=\"appointment_queue_id\"></div>\n <input class=\"appointment_queue_delete\" type=\"image\" src=\"images/appointment_queue/del.png\"/>\n </div>\n <div class=\"appointment_queue_body\">\n <p class=\"appointment_queue_body_content appointment_queue_body_mediumtype\"><img class=\"appointment_queue_body_img\" src=\"images/appointment_queue/cardType.png\"/>\u4ECB\u8D28\u7C7B\u578B\uFF1A</p>\n\n <p class=\"appointment_queue_body_content appointment_queue_body_mediumnum\"><img class=\"appointment_queue_body_img\" src=\"images/appointment_queue/jizhiNum.png\"/>\u4ECB\u8D28\u53F7\u7801\uFF1A</p>\n\n <p class=\"appointment_queue_body_content appointment_queue_body_phonenum\"><img class=\"appointment_queue_body_img\" src=\"images/appointment_queue/phoneNum.png\"/>\u624B\u673A\u53F7\u7801\uFF1A</p>\n\n <p class=\"appointment_queue_body_content appointment_queue_body_appointmenttime\"><img class=\"appointment_queue_body_img\" src=\"images/appointment_queue/time.png\"/>\u9884\u7EA6\u65F6\u95F4\uFF1A</p>\n </div>\n </div>\n </div>\n ";
  9158. AppointmentQueue.TemplateImage = "<img/>";
  9159. return AppointmentQueue;
  9160. }(Widget_36.Widget));
  9161. exports.AppointmentQueue = AppointmentQueue;
  9162. });
  9163. define("widget/transfernetwork/AppointmentTable", ["require", "exports", "widget/Widget"], function (require, exports, Widget_37) {
  9164. "use strict";
  9165. var AppointmentTable = (function (_super) {
  9166. __extends(AppointmentTable, _super);
  9167. function AppointmentTable(parentId, id, style) {
  9168. _super.call(this, parentId, id, style);
  9169. this.$thisNode = $(AppointmentTable.TemplateTime).attr("id", this.id);
  9170. }
  9171. AppointmentTable.prototype.addItems = function (args) {
  9172. var items = args.items;
  9173. if (!items || items.length === 0) {
  9174. return;
  9175. }
  9176. for (var i = 0; i < items.length; i++) {
  9177. if (items[i].id) {
  9178. if (this.$thisNode.find("#" + items[i].id).length !== 0) {
  9179. this.setItem(items[i]);
  9180. }
  9181. else {
  9182. this.addItem(items[i]);
  9183. }
  9184. }
  9185. }
  9186. };
  9187. AppointmentTable.prototype.addItem = function (item) {
  9188. var $trNode = $(AppointmentTable.Template);
  9189. var $table_containerNode = this.$thisNode.find(".appointment_table_scrollbar");
  9190. if ($table_containerNode.find("table").length === 0) {
  9191. var $first_tableNode = $(AppointmentTable.TemplateLeft).attr("id", item.id);
  9192. $first_tableNode.appendTo($table_containerNode);
  9193. $trNode.appendTo($first_tableNode);
  9194. $trNode.find("td").text(item.id);
  9195. $table_containerNode.css("width", "280px");
  9196. for (var i = 0; i < Number(item.rowNum); i++) {
  9197. if (i === Number(item.handle_appointmentTime) - 1) {
  9198. $trNode = $(AppointmentTable.TemplateDate);
  9199. $trNode.appendTo($first_tableNode);
  9200. $trNode.find(".appointment_table_data_yes").attr("style", "width: " + 1 / Number(item.limitNum) * 100 + "%");
  9201. $trNode.find(".appointment_table_data_yes").attr("title", "1");
  9202. }
  9203. else {
  9204. $trNode = $(AppointmentTable.Template);
  9205. $trNode.appendTo($first_tableNode);
  9206. }
  9207. }
  9208. }
  9209. else {
  9210. var $tableNode = $(AppointmentTable.TemplateContent).attr("id", item.id);
  9211. var item_year = Number(item.id.split("-")[0]);
  9212. var item_month = Number(item.id.split("-")[1]);
  9213. var item_date = Number(item.id.split("-")[2]);
  9214. var i = 0;
  9215. while ($table_containerNode.find("table").get(i)) {
  9216. var table_id = $table_containerNode.find("table").get(i).id;
  9217. var table_year = Number(table_id.split("-")[0]);
  9218. var table_month = Number(table_id.split("-")[1]);
  9219. var table_date = Number(table_id.split("-")[2]);
  9220. if (item_year < table_year) {
  9221. $tableNode.insertBefore($("#" + table_id));
  9222. break;
  9223. }
  9224. else if (item_year === table_year) {
  9225. if (item_month < table_month) {
  9226. $tableNode.insertBefore($("#" + table_id));
  9227. break;
  9228. }
  9229. else if (item_month === table_month) {
  9230. if (item_date < table_date) {
  9231. $tableNode.insertBefore($("#" + table_id));
  9232. break;
  9233. }
  9234. }
  9235. }
  9236. i++;
  9237. if (i === $table_containerNode.find("table").length) {
  9238. $tableNode.appendTo($table_containerNode);
  9239. }
  9240. }
  9241. if ($table_containerNode.find(".appointment_table_border_left")) {
  9242. $table_containerNode.find(".appointment_table_border_left").removeClass("appointment_table_border_left");
  9243. }
  9244. $("#" + $table_containerNode.find("table").get(0).id).addClass("appointment_table_border_left");
  9245. $trNode.appendTo($tableNode);
  9246. $trNode.find("td").text(item.id);
  9247. var arr_width = $table_containerNode.css("width").split("px");
  9248. var num_width = Number(arr_width[0]) + 280;
  9249. var str_width = num_width + "px";
  9250. $table_containerNode.css("width", str_width);
  9251. for (var i_2 = 0; i_2 < Number(item.rowNum); i_2++) {
  9252. if (i_2 === Number(item.handle_appointmentTime) - 1) {
  9253. $trNode = $(AppointmentTable.TemplateDate);
  9254. $trNode.appendTo($tableNode);
  9255. $trNode.find(".appointment_table_data_yes").attr("style", "width: " + 1 / Number(item.limitNum) * 100 + "%");
  9256. $trNode.find(".appointment_table_data_yes").attr("title", "1");
  9257. }
  9258. else {
  9259. $trNode = $(AppointmentTable.Template);
  9260. $trNode.appendTo($tableNode);
  9261. }
  9262. }
  9263. }
  9264. };
  9265. AppointmentTable.prototype.setItem = function (item) {
  9266. if (item.handle_appointmentTime !== null && item.handle_appointmentTime.length !== 0) {
  9267. var $tableNode = this.$thisNode.find("#" + item.id);
  9268. var $trNode = $tableNode.find("tr").eq(Number(item.handle_appointmentTime));
  9269. if ($trNode.find("div").length === 0) {
  9270. if ($trNode.find("td").css("background-color") === "rgb(244, 247, 249)") {
  9271. alert("此时间段不开放预约!");
  9272. }
  9273. else {
  9274. var $new_trNode = $(AppointmentTable.TemplateDate);
  9275. $trNode.replaceWith($new_trNode);
  9276. $new_trNode.find(".appointment_table_data_yes").attr("style", "width: " + 1 / Number(item.limitNum) * 100 + "%");
  9277. $new_trNode.find(".appointment_table_data_yes").attr("title", "1");
  9278. }
  9279. }
  9280. else {
  9281. if ($trNode.find(".appointment_table_data_yes").length !== 0) {
  9282. var appointNum = Number($trNode.find(".appointment_table_data_yes").attr("title"));
  9283. var arr_width = $trNode.find(".appointment_table_data_yes").css("width").split("px");
  9284. var num_width = Number(arr_width[0]) / appointNum + Number(arr_width[0]);
  9285. var str_width = num_width + "px";
  9286. $trNode.find(".appointment_table_data_yes").css("width", str_width);
  9287. appointNum = appointNum + 1;
  9288. $trNode.find(".appointment_table_data_yes").attr("title", String(appointNum));
  9289. $trNode.find(".appointment_table_text").text("已预约" + appointNum + "人");
  9290. if (appointNum === Number(item.limitNum)) {
  9291. $trNode.find(".appointment_table_data_yes").addClass("appointment_table_data_full")
  9292. .removeClass("appointment_table_data_yes").css("width", "100%");
  9293. $trNode.find(".appointment_table_text").text("已约满");
  9294. }
  9295. }
  9296. else {
  9297. if ($trNode.find(".appointment_table_data_full").length !== 0) {
  9298. alert(item.id + "存在超出预约人数,请检查");
  9299. }
  9300. }
  9301. }
  9302. }
  9303. };
  9304. AppointmentTable.prototype.changeTimeTable = function (args) {
  9305. var $timeNode = this.$thisNode.find(".appointment_table_tabletime table");
  9306. $timeNode.empty();
  9307. var time = args.time;
  9308. var $first_timeNode = $(AppointmentTable.Template);
  9309. $first_timeNode.appendTo($timeNode);
  9310. $first_timeNode.find("td").text("全天");
  9311. var origin_time = time[0];
  9312. var timeNum = time[1];
  9313. for (var i = 0; i <= timeNum; i++) {
  9314. var $item_timeNode = $(AppointmentTable.Template);
  9315. $item_timeNode.appendTo($timeNode);
  9316. $item_timeNode.find("td").text(origin_time + ":00");
  9317. origin_time = origin_time + 1;
  9318. }
  9319. };
  9320. AppointmentTable.prototype.setDisallowAppoint = function (args) {
  9321. var items = args.items;
  9322. if (!items || items.length === 0) {
  9323. return;
  9324. }
  9325. for (var i = 0; i < items.length; i++) {
  9326. if (items[i].date) {
  9327. if (this.$thisNode.find("#" + items[i].date).length !== 0) {
  9328. var $tableNode = this.$thisNode.find("#" + items[i].date);
  9329. var $trNode = $tableNode.find("tr").eq(Number(items[i].disallowTime));
  9330. $trNode.find("td").css("background-color", "#f4f7f9");
  9331. }
  9332. else {
  9333. break;
  9334. }
  9335. }
  9336. }
  9337. };
  9338. AppointmentTable.prototype.removeItem = function (args) {
  9339. var items = args.items;
  9340. if (!items || items.length === 0) {
  9341. return;
  9342. }
  9343. for (var i = 0; i < items.length; i++) {
  9344. if (items[i].id) {
  9345. if (this.$thisNode.find("#" + items[i].id).length !== 0) {
  9346. var $tableNode = this.$thisNode.find("#" + items[i].id);
  9347. var $trNode = $tableNode.find("tr").eq(Number(items[i].removeTime));
  9348. if ($trNode.find(".appointment_table_data_yes").length !== 0) {
  9349. var appointNum = Number($trNode.find(".appointment_table_data_yes").attr("title")) - 1;
  9350. if (appointNum === 0) {
  9351. $trNode.find("td").empty();
  9352. }
  9353. else {
  9354. $trNode.find(".appointment_table_data_yes").attr("style", "width: " + appointNum / Number(items[i].limitNum) * 100 + "%");
  9355. $trNode.find(".appointment_table_data_yes").attr("title", String(appointNum));
  9356. $trNode.find(".appointment_table_text").text("已预约" + appointNum + "人");
  9357. }
  9358. }
  9359. else {
  9360. if ($trNode.find(".appointment_table_data_full").length !== 0) {
  9361. var appointNum = Number($trNode.find(".appointment_table_data_full").attr("title")) - 1;
  9362. $trNode.find(".appointment_table_data_full").addClass("appointment_table_data_yes").removeClass("appointment_table_data_full");
  9363. $trNode.find(".appointment_table_data_yes").attr("style", "width: " + appointNum / Number(items[i].limitNum) * 100 + "%");
  9364. $trNode.find(".appointment_table_data_yes").attr("title", String(appointNum));
  9365. $trNode.find(".appointment_table_text").text("已预约" + appointNum + "人");
  9366. }
  9367. }
  9368. }
  9369. else {
  9370. break;
  9371. }
  9372. }
  9373. }
  9374. };
  9375. AppointmentTable.prototype.removeTable = function (args) {
  9376. var itemIds = args.itemIds;
  9377. if (!itemIds || itemIds.length === 0) {
  9378. return;
  9379. }
  9380. for (var i = 0; i < itemIds.length; i++) {
  9381. if (itemIds[i]) {
  9382. if (this.$thisNode.find("#" + itemIds[i]).length !== 0) {
  9383. this.$thisNode.find("#" + itemIds[i]).remove();
  9384. }
  9385. }
  9386. }
  9387. if (this.$thisNode.find(".appointment_table_scrollbar").find("table").length !== 0) {
  9388. if (this.$thisNode.find(".appointment_table_border_left").length === 0) {
  9389. this.$thisNode.find(".appointment_table_scrollbar").find("table").eq(0).addClass("appointment_table_border_left");
  9390. }
  9391. }
  9392. };
  9393. AppointmentTable.prototype.clear = function () {
  9394. this.$thisNode.find(".appointment_table_scrollbar").empty();
  9395. };
  9396. AppointmentTable.TemplateTime = "\n <div>\n <div class=\"appointment_table_tabletime\">\n <table>\n <tr><td>\u5168\u5929</td></tr>\n <tr><td>9:00</td></tr>\n <tr><td>10:00</td></tr>\n <tr><td>11:00</td></tr>\n <tr><td>12:00</td></tr>\n <tr><td>13:00</td></tr>\n <tr><td>14:00</td></tr>\n <tr><td>15:00</td></tr>\n <tr><td>16:00</td></tr>\n <tr><td>17:00</td></tr>\n </table>\n </div>\n <div class=\"appointment_table_line\">\n <span class=\"appointment_table_color_gray_small\"></span>\n <span class=\"appointment_table_line_font\" >\u4E0D\u5F00\u653E\u9884\u7EA6</span>\n <span class=\"appointment_table_color_white_small\"></span>\n <span class=\"appointment_table_line_font\">\u65E0\u9884\u7EA6\u8BB0\u5F55</span>\n <span class=\"appointment_table_color_blue_small\"></span>\n <span class=\"appointment_table_line_font\">\u6709\u9884\u7EA6\u8BB0\u5F55\u4E14\u672A\u6EE1</span>\n <span class=\"appointment_table_color_red_small\"></span>\n <span class=\"appointment_table_line_font\">\u5DF2\u7EA6\u6EE1</span>\n </div>\n <div class=\"appointment_table\">\n <div class=\"appointment_table_scrollbar\">\n </div>\n </div>\n</div>";
  9397. AppointmentTable.TemplateLeft = "\n<table class=\"appointment_table_tablecontent appointment_table_border_left\">\n</table>";
  9398. AppointmentTable.TemplateContent = "\n <table class=\"appointment_table_tablecontent\">\n</table>";
  9399. AppointmentTable.Template = "<tr><td></td></tr>";
  9400. AppointmentTable.TemplateDate = "\n <tr><td><div class=\"appointment_table_data_yes\"><div class=\"appointment_table_text\">\u5DF2\u9884\u7EA61\u4EBA</div></div></td></tr>\n";
  9401. return AppointmentTable;
  9402. }(Widget_37.Widget));
  9403. exports.AppointmentTable = AppointmentTable;
  9404. });
  9405. define("widget/transfernetwork/BarGraph", ["require", "exports", "widget/Widget"], function (require, exports, Widget_38) {
  9406. "use strict";
  9407. var BarGraph = (function (_super) {
  9408. __extends(BarGraph, _super);
  9409. function BarGraph(parentId, id, style) {
  9410. _super.call(this, parentId, id, style);
  9411. this.data = new Array();
  9412. this.option = {};
  9413. var own = this;
  9414. this.$thisNode = $(BarGraph.Template).attr("id", this.id);
  9415. this.$graphNode = this.$thisNode.children("div");
  9416. this.resizeFunction = function () {
  9417. own.echart.resize();
  9418. };
  9419. $(window).on("resize", this.resizeFunction);
  9420. }
  9421. BarGraph.prototype.setData = function (args) {
  9422. this.data = args.data;
  9423. };
  9424. BarGraph.prototype.clear = function () {
  9425. this.data = [];
  9426. this.option = [];
  9427. this.echart.clear();
  9428. };
  9429. BarGraph.prototype.clearData = function () {
  9430. this.data = [];
  9431. var graphOption = {
  9432. title: {
  9433. text: "等待时间队列",
  9434. subtext: "",
  9435. x: "center"
  9436. },
  9437. tooltip: {
  9438. trigger: "axis",
  9439. axisPointer: {
  9440. type: "line"
  9441. }
  9442. },
  9443. legend: {
  9444. data: ["预警内已等待时间", "距离预警时间", "超出预警时间"],
  9445. orient: "vertical",
  9446. x: "left"
  9447. },
  9448. grid: {
  9449. top: "103px",
  9450. left: "3%",
  9451. right: "10%",
  9452. bottom: "3%",
  9453. containLabel: true
  9454. },
  9455. xAxis: {
  9456. type: "category",
  9457. name: "客户名称",
  9458. data: [""],
  9459. axisTick: {
  9460. alignWithLabel: true
  9461. }
  9462. },
  9463. yAxis: {
  9464. type: "value",
  9465. name: "时间/分"
  9466. }
  9467. };
  9468. this.option = graphOption;
  9469. if (this.echart) {
  9470. this.echart.clear();
  9471. this.echart.setOption(this.option);
  9472. }
  9473. };
  9474. BarGraph.prototype.postLayout = function () {
  9475. var own = this;
  9476. if (this.data.length > 0) {
  9477. this.redrawGraph();
  9478. }
  9479. if (!this.echart) {
  9480. this.echart = echarts.init(this.$graphNode.get(0));
  9481. if (this.option) {
  9482. this.echart.setOption(this.option);
  9483. }
  9484. }
  9485. };
  9486. BarGraph.prototype.dispose = function () {
  9487. $(window).off("resize", this.resizeFunction);
  9488. _super.prototype.dispose.call(this);
  9489. };
  9490. BarGraph.prototype.redrawGraph = function () {
  9491. var nameList = new Array();
  9492. var blueValueList = new Array();
  9493. var whiteValueList = new Array();
  9494. var redValueList = new Array();
  9495. var dValueList = new Array();
  9496. for (var _i = 0, _a = this.data; _i < _a.length; _i++) {
  9497. var entry = _a[_i];
  9498. var dValue = entry.value - entry.alertValue;
  9499. dValueList.push(dValue);
  9500. var blueValue = void 0;
  9501. var whiteValue = void 0;
  9502. var redValue = void 0;
  9503. if (dValue === 0) {
  9504. blueValue = entry.value + "";
  9505. whiteValue = "";
  9506. redValue = "";
  9507. }
  9508. else if (dValue > 0) {
  9509. blueValue = entry.alertValue + "";
  9510. whiteValue = "";
  9511. redValue = dValue + "";
  9512. }
  9513. else if (dValue < 0) {
  9514. blueValue = entry.value + "";
  9515. whiteValue = 0 - dValue + "";
  9516. redValue = "";
  9517. }
  9518. blueValue = blueValue === "0" ? "" : blueValue;
  9519. whiteValue = whiteValue === "0" ? "" : whiteValue;
  9520. redValue = redValue === "0" ? "" : redValue;
  9521. nameList.push(entry.name);
  9522. blueValueList.push(blueValue);
  9523. whiteValueList.push(whiteValue);
  9524. redValueList.push(redValue);
  9525. }
  9526. var tempDValueList = dValueList.concat();
  9527. tempDValueList.sort(function (a, b) {
  9528. return a - b;
  9529. });
  9530. var signWhiteValue = tempDValueList[0];
  9531. var signWhiteX = dValueList.indexOf(signWhiteValue);
  9532. var signWhiteY = this.data[signWhiteX].alertValue;
  9533. signWhiteValue = 0 - tempDValueList[0];
  9534. var signRedValue = tempDValueList[tempDValueList.length - 1];
  9535. var signRedX = dValueList.lastIndexOf(signRedValue);
  9536. var signRedY = this.data[signRedX].value;
  9537. var graphOption = {
  9538. title: {
  9539. text: "等待时间队列",
  9540. subtext: "",
  9541. x: "center"
  9542. },
  9543. tooltip: {
  9544. trigger: "axis",
  9545. axisPointer: {
  9546. type: "line"
  9547. }
  9548. },
  9549. legend: {
  9550. data: ["预警内已等待时间", "距离预警时间", "超出预警时间"],
  9551. orient: "vertical",
  9552. x: "left"
  9553. },
  9554. grid: {
  9555. top: "103px",
  9556. left: "3%",
  9557. right: "10%",
  9558. bottom: "3%",
  9559. containLabel: true
  9560. },
  9561. xAxis: {
  9562. type: "category",
  9563. name: "客户名称",
  9564. data: nameList,
  9565. axisTick: {
  9566. alignWithLabel: true
  9567. }
  9568. },
  9569. yAxis: {
  9570. type: "value",
  9571. name: "时间/分"
  9572. },
  9573. series: [
  9574. {
  9575. name: "预警内已等待时间",
  9576. type: "bar",
  9577. stack: "等待时间",
  9578. label: {
  9579. normal: {
  9580. show: true,
  9581. position: "inside"
  9582. }
  9583. },
  9584. itemStyle: {
  9585. normal: {
  9586. color: "#004B97",
  9587. borderColor: "#004B97"
  9588. }
  9589. },
  9590. data: blueValueList
  9591. },
  9592. {
  9593. name: "距离预警时间",
  9594. type: "bar",
  9595. stack: "等待时间",
  9596. label: {
  9597. normal: {
  9598. show: true,
  9599. position: "inside",
  9600. textStyle: {
  9601. color: "#009100"
  9602. }
  9603. }
  9604. },
  9605. itemStyle: {
  9606. normal: {
  9607. color: "#FCFCFC",
  9608. borderColor: "#004B97"
  9609. }
  9610. },
  9611. data: whiteValueList
  9612. },
  9613. {
  9614. name: "超出预警时间",
  9615. type: "bar",
  9616. stack: "等待时间",
  9617. label: {
  9618. normal: {
  9619. show: true,
  9620. position: "inside"
  9621. }
  9622. },
  9623. itemStyle: {
  9624. normal: {
  9625. color: "#CE0000",
  9626. borderColor: "#CE0000"
  9627. }
  9628. },
  9629. data: redValueList
  9630. }
  9631. ]
  9632. };
  9633. this.option = graphOption;
  9634. if (this.echart) {
  9635. this.echart.setOption(this.option);
  9636. }
  9637. };
  9638. BarGraph.Template = "\n <div>\n <div style=\"width:100%;height:100%\"></div>\n </div>\n ";
  9639. return BarGraph;
  9640. }(Widget_38.Widget));
  9641. exports.BarGraph = BarGraph;
  9642. });
  9643. define("widget/transfernetwork/BranchChart", ["require", "exports", "widget/echart/EChart"], function (require, exports, EChart_4) {
  9644. "use strict";
  9645. var BranchChart = (function (_super) {
  9646. __extends(BranchChart, _super);
  9647. function BranchChart() {
  9648. _super.apply(this, arguments);
  9649. this.netPointList = new Array();
  9650. this.title = "unset";
  9651. this.subTitle = "";
  9652. }
  9653. BranchChart.prototype.setData = function (args) {
  9654. this.netPointList = new Array();
  9655. this.netPointList.push({ pointName: "当前网点", distance: 0, walkTime: 0 });
  9656. this.netPointList = this.netPointList.concat(args.netPointList);
  9657. };
  9658. BranchChart.prototype.setTitle = function (args) {
  9659. this.title = args.titles.title;
  9660. this.subTitle = args.titles.subTitle;
  9661. };
  9662. BranchChart.prototype.postLayout = function () {
  9663. if (this.netPointList.length > 0) {
  9664. this.redrawChart();
  9665. }
  9666. _super.prototype.postLayout.call(this);
  9667. };
  9668. BranchChart.prototype.getFormat = function (netPoint) {
  9669. var $assistNode = $("<div>");
  9670. var tableBlock = $("<div></div>").addClass("branchChart-table responsive-table");
  9671. var table = $("<table class='centered'></table>");
  9672. var tableTheadTemplate = "\n <thead>\n <tr>\n <th data-field=\"name\" style=\"width:50%\">\u9879\u76EE\u540D\u79F0</th>\n <th data-field=\"name\" style=\"width:50%\">\u63CF\u8FF0/\u503C</th>\n </tr>\n </thead>\n ";
  9673. var tableThead = $(tableTheadTemplate);
  9674. var tableBody = $("<tbody></tbody>");
  9675. var createRow = function (name, content) {
  9676. var row = $("<tr>");
  9677. var nameEntry = $("<td style='padding:5px 5px;width:50%'></td>").html(name);
  9678. var contentEntry = $("<td style=\"padding:5px 5px;width:50%;overflow:auto\"></td>").html(content);
  9679. row.append(nameEntry).append(contentEntry);
  9680. return row;
  9681. };
  9682. tableBody.append(createRow("网点名称", netPoint.pointName));
  9683. tableBody.append(createRow("和当前网点距离", netPoint.distance + "米"));
  9684. tableBody.append(createRow("步行需要时间", netPoint.walkTime + "分钟"));
  9685. if (netPoint.description && netPoint.description.length > 0) {
  9686. for (var _i = 0, _a = netPoint.description; _i < _a.length; _i++) {
  9687. var d = _a[_i];
  9688. tableBody.append(createRow(d.descriptionName, d.descriptionContent));
  9689. }
  9690. }
  9691. table.append(tableThead);
  9692. table.append(tableBody);
  9693. tableBlock.append(table);
  9694. var showNumberTable = $("\n <table class=\"centered\" style=\"width:70%;margin-left:15%;\">\n <thead>\n <tr>\n <th data-field=\"name\" style=\"width:50%\">\u7F51\u70B9\u7A97\u53E3\u6570\u91CF</th>\n <th data-field=\"name\" style=\"width:50%\">\u5F53\u524D\u7B49\u5F85\u4EBA\u6570</th>\n </tr>\n </thead>\n <tbody>\n <tr></tr>\n </tbody>\n </table>\n ");
  9695. if (netPoint.windowNumber && netPoint.waitInLineNumber) {
  9696. var showNumberRow = showNumberTable.find("tbody").find("tr");
  9697. showNumberRow.append(createRow(netPoint.windowNumber + "", netPoint.waitInLineNumber + ""));
  9698. tableBlock.append(showNumberTable);
  9699. }
  9700. var othersTable = $("\n <table class=\"centered\">\n <thead>\n <tr>\n <th data-field=\"name\" style=\"width:50%\">\u5176\u4ED6\u6570\u636E\u540D\u79F0</th>\n <th data-field=\"name\" style=\"width:50%\">\u5176\u4ED6\u6570\u636E\u6570\u503C</th>\n </tr>\n </thead>\n <tbody>\n <tr></tr>\n </tbody>\n </table>\n ");
  9701. if (netPoint.othersInfo && netPoint.othersInfo.length > 0) {
  9702. var othersRow = othersTable.find("tbody").find("tr");
  9703. var othersList = netPoint.othersInfo;
  9704. for (var _b = 0, othersList_1 = othersList; _b < othersList_1.length; _b++) {
  9705. var other = othersList_1[_b];
  9706. othersRow.append(createRow(other.otherName, other.otherContent));
  9707. }
  9708. tableBlock.append(othersTable);
  9709. }
  9710. $assistNode.append(tableBlock);
  9711. return $assistNode.html();
  9712. };
  9713. BranchChart.prototype.getMaxLength = function () {
  9714. var distanceList = new Array();
  9715. for (var _i = 0, _a = this.netPointList; _i < _a.length; _i++) {
  9716. var netPoint = _a[_i];
  9717. distanceList.push(netPoint.distance);
  9718. }
  9719. distanceList.sort(function (a, b) {
  9720. return a - b;
  9721. });
  9722. return distanceList[distanceList.length - 1];
  9723. };
  9724. BranchChart.prototype.redrawChart = function () {
  9725. var own = this;
  9726. var maxLength = 1.1 * this.getMaxLength();
  9727. var indicatorContent = new Array();
  9728. for (var i = 0; i < this.netPointList.length; i++) {
  9729. var indicatorEntry = {
  9730. name: i > 0 ? this.netPointList[i].pointName + " \u6B65\u884C\u8DDD\u79BB:" + this.netPointList[i].distance + "\u7C73" : "",
  9731. max: maxLength
  9732. };
  9733. indicatorContent.push(indicatorEntry);
  9734. }
  9735. var createDataEntry = function (index, value, length) {
  9736. var valueList = new Array();
  9737. for (var i = 0; i < length; i++) {
  9738. valueList.push("");
  9739. }
  9740. valueList[index] = value.toString();
  9741. var dataEntryTemplate = {
  9742. value: valueList,
  9743. name: index.toString(),
  9744. symbol: "circle",
  9745. symbolSize: 8
  9746. };
  9747. return dataEntryTemplate;
  9748. };
  9749. var dataContent = new Array();
  9750. for (var i = 0; i < this.netPointList.length; i++) {
  9751. dataContent.push(createDataEntry(i, this.netPointList[i].distance, this.netPointList.length));
  9752. }
  9753. var branchOption = {
  9754. title: {
  9755. text: this.title,
  9756. subtext: this.subTitle,
  9757. x: "center"
  9758. },
  9759. legend: {},
  9760. tooltip: {
  9761. formatter: function (params, ticket, callback) {
  9762. var netPoint = own.netPointList[params.dataIndex];
  9763. return own.getFormat(netPoint);
  9764. },
  9765. enterable: true,
  9766. backgroundColor: "transparent",
  9767. transitionDuration: 0.4,
  9768. textStyle: {
  9769. color: "black"
  9770. },
  9771. hideDelay: 50,
  9772. position: function (point, params, dom) {
  9773. var x = point[0];
  9774. var y = point[1];
  9775. var width = own.$thisNode.get(0).clientWidth;
  9776. var height = own.$thisNode.get(0).clientHeight;
  9777. var rX = x;
  9778. var rY = y;
  9779. if (x + 150 > width && x - 150 < 0) {
  9780. return "inside";
  9781. }
  9782. else if (x + 150 > width) {
  9783. rX = width - 150;
  9784. }
  9785. else if (x - 150 < 0) {
  9786. rX = 150;
  9787. }
  9788. if (y + 200 > height && y - 200 < 0) {
  9789. return "inside";
  9790. }
  9791. else if (y + 200 > height) {
  9792. rY = height - 200;
  9793. }
  9794. else if (y - 200 < 0) {
  9795. rY = 200;
  9796. }
  9797. return [rX - 150, rY - 200];
  9798. }
  9799. },
  9800. radar: [
  9801. {
  9802. indicator: indicatorContent,
  9803. center: ["50%", "50%"],
  9804. radius: "70%",
  9805. startAngle: 90,
  9806. splitNumber: 5,
  9807. shape: "circle",
  9808. name: {
  9809. textStyle: {
  9810. color: "#003D79",
  9811. fontSize: "13"
  9812. }
  9813. },
  9814. splitArea: {
  9815. areaStyle: {
  9816. color: ["rgba(114, 172, 209, 1)",
  9817. "rgba(114, 172, 209, 0.8)", "rgba(114, 172, 209, 0.6)",
  9818. "rgba(114, 172, 209, 0.4)", "rgba(114, 172, 209, 0.2)"],
  9819. shadowColor: "rgba(0, 0, 0, 0.3)",
  9820. shadowBlur: 10
  9821. }
  9822. },
  9823. axisLine: {
  9824. lineStyle: {
  9825. color: "rgba(114, 172, 209, 0.1)"
  9826. }
  9827. },
  9828. splitLine: {
  9829. lineStyle: {
  9830. color: "rgba(114, 172, 209, 0.5)"
  9831. }
  9832. }
  9833. }
  9834. ],
  9835. series: [
  9836. {
  9837. name: "雷达图",
  9838. type: "radar",
  9839. itemStyle: {
  9840. normal: {
  9841. shadowColor: "black",
  9842. shadowBlur: 10,
  9843. color: "white"
  9844. }
  9845. },
  9846. data: dataContent
  9847. }
  9848. ]
  9849. };
  9850. this.option = branchOption;
  9851. if (this.echart) {
  9852. this.echart.setOption(this.option);
  9853. }
  9854. };
  9855. return BranchChart;
  9856. }(EChart_4.EChart));
  9857. exports.BranchChart = BranchChart;
  9858. });
  9859. define("widget/transfernetwork/CustomQueue", ["require", "exports", "widget/Widget", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, Widget_39, EventHub_34, MessageType_35, Event_32) {
  9860. "use strict";
  9861. var CustomQueue = (function (_super) {
  9862. __extends(CustomQueue, _super);
  9863. function CustomQueue(parentId, id, style) {
  9864. _super.call(this, parentId, id, style);
  9865. this.isSelected = false;
  9866. this.movingControlPositions = new Array();
  9867. this.checkDistance = 60;
  9868. this.$thisNode = $(CustomQueue.TemplateCotainer).attr({ id: this.id });
  9869. }
  9870. CustomQueue.prototype.addItems = function (args) {
  9871. var items = args.items;
  9872. if (!items || items.length === 0) {
  9873. return;
  9874. }
  9875. for (var i = 0; i < items.length; i++) {
  9876. if (items[i].queue_num) {
  9877. if (this.$thisNode.find("#" + items[i].queue_num).length !== 0) {
  9878. this.setItem(items[i]);
  9879. }
  9880. else {
  9881. this.addItem(items[i]);
  9882. }
  9883. }
  9884. }
  9885. this.setListeners();
  9886. };
  9887. CustomQueue.prototype.setItems = function (args) {
  9888. var items = args.items;
  9889. this.clear();
  9890. this.addItems({ items: items });
  9891. this.setListeners();
  9892. };
  9893. CustomQueue.prototype.setItem = function (item) {
  9894. var itemNode = this.$thisNode.find("#" + item.queue_num);
  9895. this.setCustomAttr(itemNode, item);
  9896. };
  9897. CustomQueue.prototype.addItem = function (item) {
  9898. var itemNode = $(CustomQueue.TemplateQueue).attr({ id: item.queue_num });
  9899. itemNode.appendTo(this.$thisNode);
  9900. this.setCustomAttr(itemNode, item);
  9901. var own = this;
  9902. itemNode.find("p.custom_queue_footer").on("click", function (e) {
  9903. var index = own.indexOf(itemNode[0]);
  9904. var queueNO = itemNode.attr("id");
  9905. EventHub_34.EventHub.dispatchEvent(MessageType_35.MessageType.WIDGET, {
  9906. id: own.id,
  9907. evtType: Event_32.Event.CLICK,
  9908. index: index,
  9909. queue_num: queueNO
  9910. });
  9911. });
  9912. itemNode.find("div[lookOver]").on("click", function (e) {
  9913. var index = own.indexOf(itemNode[0]);
  9914. var queueNO = itemNode.attr("id");
  9915. EventHub_34.EventHub.dispatchEvent(MessageType_35.MessageType.WIDGET, {
  9916. id: own.id,
  9917. evtType: Event_32.Event.LOOK_OVER,
  9918. index: index,
  9919. queue_num: queueNO
  9920. });
  9921. });
  9922. };
  9923. CustomQueue.prototype.indexOf = function (item) {
  9924. var items = this.$thisNode.find("div.custom_queue_container");
  9925. for (var i = 0; i < items.length; i++) {
  9926. if (item === items[i]) {
  9927. return i;
  9928. }
  9929. }
  9930. return -1;
  9931. };
  9932. CustomQueue.prototype.setCustomAttr = function (itemNode, item) {
  9933. itemNode.find(".custom_queue_id").text(item.queue_num);
  9934. itemNode.find(".custom_queue_wait_time").text(item.waitting + "分钟");
  9935. if (item.en_queue_time) {
  9936. itemNode.find(".custom_queue_get_no_time").text(item.en_queue_time);
  9937. }
  9938. var customNameNode = itemNode.find(".custom_queue_name");
  9939. if (item.name) {
  9940. customNameNode.text(item.name);
  9941. }
  9942. if (item.sex) {
  9943. var customSex = $(CustomQueue.TemplateImage).appendTo(customNameNode);
  9944. customSex.css({ marginTop: "-5px" });
  9945. if (item.sex === "男" || item.sex === "man" || item.sex === "1") {
  9946. customSex.attr("src", "images/custom_queue/man.png");
  9947. }
  9948. else {
  9949. customSex.attr("src", "images/custom_queue/woman.png");
  9950. }
  9951. }
  9952. if (item.customLevel) {
  9953. var customLevelNode = itemNode.find(".custom_queue_custom_level");
  9954. customLevelNode.text("客户等级:" + item.customLevel);
  9955. var customLevelImg = $(CustomQueue.TemplateImage).appendTo(customLevelNode);
  9956. if (item.customLevel === "黄金客户") {
  9957. customLevelImg.attr("src", "images/custom_queue/custom_level/huangjin.png");
  9958. }
  9959. else if (item.customLevel === "白金客户") {
  9960. customLevelImg.attr("src", "images/custom_queue/custom_level/baijin.png");
  9961. }
  9962. else if (item.customLevel === "钻石客户") {
  9963. customLevelImg.attr("src", "images/custom_queue/custom_level/zuanshi.png");
  9964. }
  9965. else {
  9966. customLevelImg.attr("src", "images/custom_queue/custom_level/putong.png");
  9967. }
  9968. }
  9969. if (item.businessFlag) {
  9970. var imgArr = item.businessFlag.split(",");
  9971. if (imgArr.length > 0) {
  9972. var businessFlagNode = itemNode.find(".custom_queue_business_flag");
  9973. businessFlagNode.find("img").remove();
  9974. for (var i = 0; i < imgArr.length; i++) {
  9975. $(CustomQueue.TemplateImage).attr("src", "images/custom_queue/business_flag/" + imgArr[i] + ".png").appendTo(businessFlagNode);
  9976. }
  9977. }
  9978. }
  9979. };
  9980. CustomQueue.prototype.removeItem = function (args) {
  9981. var ids = args.itemIds;
  9982. if (ids && ids.length > 0) {
  9983. for (var i = 0; i < ids.length; i++) {
  9984. this.$thisNode.find("#" + ids[i]).remove();
  9985. }
  9986. }
  9987. this.setListeners();
  9988. };
  9989. CustomQueue.prototype.clear = function () {
  9990. this.$thisNode.find(".custom_queue_container").remove();
  9991. this.setListeners();
  9992. };
  9993. CustomQueue.prototype.postLayout = function () {
  9994. this.setListeners();
  9995. };
  9996. CustomQueue.prototype.dispose = function () {
  9997. $(window).off("resize", this.resizeFunction);
  9998. _super.prototype.dispose.call(this);
  9999. };
  10000. CustomQueue.prototype.setListeners = function () {
  10001. var own = this;
  10002. own.isSelected = false;
  10003. own.selectedIndex = null;
  10004. own.selectedUnitWidth = null;
  10005. own.selectedUnit = null;
  10006. own.targetIndex = null;
  10007. own.movingControlPositions = new Array();
  10008. own.animationUnit = null;
  10009. own.resizeFunction = function () {
  10010. own.setListeners();
  10011. };
  10012. $(window).on("resize", own.resizeFunction);
  10013. if (this.$thisNode.find(".custom_queue_container").length === 0) {
  10014. return;
  10015. }
  10016. var $units = this.$thisNode.find("div.custom_queue_container");
  10017. var $unitsContainer = this.$thisNode;
  10018. $units.each(function (index, elem) {
  10019. var $elemNode = $(elem);
  10020. var position = own.getUnitCenterPosition(elem);
  10021. if ($elemNode.next().length < 0) {
  10022. position.x = position.x + elem.clientWidth;
  10023. }
  10024. own.movingControlPositions.push(position);
  10025. });
  10026. var moveControl = function (e) {
  10027. if (own.isSelected) {
  10028. if (own.selectedUnit.style.position !== "absolute") {
  10029. $(own.selectedUnit).addClass("selected");
  10030. }
  10031. own.selectedUnit.style.width = own.selectedUnitWidth + "px";
  10032. own.selectedUnit.style.left = e.clientX - $unitsContainer.get(0).clientLeft
  10033. - own.selectedUnit.clientWidth / 2 + "px";
  10034. own.selectedUnit.style.top = e.clientY - $unitsContainer.get(0).clientTop
  10035. - own.selectedUnit.clientHeight / 2 + "px";
  10036. }
  10037. };
  10038. $units.each(function (index, elem) {
  10039. elem.onmousedown = function (e) {
  10040. if (!own.isSelected) {
  10041. own.isSelected = true;
  10042. own.selectedIndex = index;
  10043. own.selectedUnit = elem;
  10044. own.selectedUnitWidth = elem.clientWidth;
  10045. moveControl(e);
  10046. own.animationUnit = $(elem).next();
  10047. if (own.animationUnit.length > 0) {
  10048. own.animationUnit.removeClass("moveToLeft").addClass("moveToRight");
  10049. }
  10050. elem.onmouseup = function () {
  10051. if (own.targetIndex === -1) {
  10052. $units.removeClass("moveToLeft").removeClass("moveToRight").
  10053. removeClass("selected").removeClass("inPosition");
  10054. }
  10055. else if (own.targetIndex > -1) {
  10056. $units.removeClass("moveToLeft").removeClass("moveToRight").
  10057. removeClass("selected").removeClass("inPosition");
  10058. var $tempNode = $(own.selectedUnit);
  10059. if (own.targetIndex > 0) {
  10060. $units.eq(own.targetIndex - 1).after($tempNode);
  10061. }
  10062. else if (own.targetIndex === 0) {
  10063. $units.eq(0).before($tempNode);
  10064. }
  10065. EventHub_34.EventHub.dispatchEvent(MessageType_35.MessageType.WIDGET, {
  10066. id: own.id,
  10067. evtType: Event_32.Event.ON_CHANGE,
  10068. originIndex: own.selectedIndex,
  10069. finalIndex: own.targetIndex
  10070. });
  10071. }
  10072. $units.css({
  10073. "width": "",
  10074. "left": "",
  10075. "top": ""
  10076. });
  10077. own.setListeners();
  10078. e.preventDefault();
  10079. };
  10080. e.preventDefault();
  10081. }
  10082. };
  10083. });
  10084. $unitsContainer.get(0).onmousemove = function (e) {
  10085. moveControl(e);
  10086. if (own.isSelected) {
  10087. var targetIndex = own.getTargetIndex(e, own.checkDistance);
  10088. if (targetIndex >= own.selectedIndex) {
  10089. targetIndex++;
  10090. }
  10091. if (own.targetIndex === undefined) {
  10092. own.targetIndex = targetIndex;
  10093. }
  10094. if (own.targetIndex === -1 && targetIndex > -1) {
  10095. own.animationUnit = $units.eq(targetIndex);
  10096. $(own.selectedUnit).addClass("inPosition");
  10097. own.animationUnit.removeClass("moveToLeft").addClass("moveToRight");
  10098. }
  10099. else if (own.targetIndex > -1 && targetIndex === -1) {
  10100. $(own.selectedUnit).removeClass("inPosition");
  10101. own.animationUnit.removeClass("moveToRight").addClass("moveToLeft");
  10102. }
  10103. own.targetIndex = targetIndex;
  10104. }
  10105. e.preventDefault();
  10106. };
  10107. };
  10108. CustomQueue.prototype.getTargetIndex = function (event, checkDistance) {
  10109. var own = this;
  10110. var minDistance = checkDistance;
  10111. var index = 0;
  10112. var rIndex = -1;
  10113. for (var _i = 0, _a = this.movingControlPositions; _i < _a.length; _i++) {
  10114. var position = _a[_i];
  10115. var dX = event.clientX - position.x;
  10116. var dY = event.clientY - position.y;
  10117. var dDistance = Math.sqrt(Math.pow(dX, 2) + Math.pow(dY, 2));
  10118. if (dDistance < checkDistance) {
  10119. if (dDistance < minDistance) {
  10120. minDistance = dDistance;
  10121. rIndex = index;
  10122. }
  10123. }
  10124. index++;
  10125. }
  10126. return rIndex;
  10127. };
  10128. CustomQueue.prototype.getUnitCenterPosition = function (elem) {
  10129. var startX = elem.offsetLeft;
  10130. var startY = elem.offsetTop;
  10131. var width = elem.clientWidth;
  10132. var height = elem.clientHeight;
  10133. var centerPosition = { x: startX + width / 2, y: startY + height / 2 };
  10134. return centerPosition;
  10135. };
  10136. CustomQueue.TemplateCotainer = "<div class=\"row\"></div>";
  10137. CustomQueue.TemplateQueue = "\n <div class=\"col s6 m4 l3 custom_queue_container\">\n <div class=\"custom_queue_container_second\">\n <p class=\"custom_queue_id\"><!--A001--></p>\n\n <div class=\"custom_queue_roundness\" lookOver>\n <p class=\"custom_queue_roundness_header_p\">\u5DF2\u7B49\u5F85\u65F6\u95F4</p>\n\n <p class=\"custom_queue_roundness_header_p custom_queue_wait_time\"><!--x\u5206\u949F--></p>\n\n <div class=\"custom_queue_roundness_middle_div\">\n </div>\n\n <p class=\"custom_queue_roundness_footer_p\">\u53D6\u53F7\u65F6\u95F4</p>\n\n <p class=\"custom_queue_roundness_footer_p custom_queue_get_no_time\"><!--12:09:11--></p>\n </div>\n\n <div class=\"custom_queue_body\" lookOver>\n <p class=\"custom_queue_name\"><!--\u9A6C\u5FD7<img src=\"images/custom_queue/man.png\"\n style=\"margin-top:-5px;\"/>--></p>\n </div>\n <p class=\"custom_queue_custom_level\">\u5BA2\u6237\u7B49\u7EA7\uFF1A\u666E\u901A\u5BA2\u6237<img\n src=\"images/custom_queue/custom_level/putong.png\"/></p>\n\n <div class=\"custom_queue_business_flag\">\n </div>\n\n <p class=\"custom_queue_footer\"><img src=\"images/custom_queue/tiaozheng.png\"/>\u8C03\u6574</p>\n </div>\n </div>";
  10138. CustomQueue.TemplateImage = "<img/>";
  10139. return CustomQueue;
  10140. }(Widget_39.Widget));
  10141. exports.CustomQueue = CustomQueue;
  10142. });
  10143. define("widget/transfernetwork/ProductShow", ["require", "exports", "widget/Widget", "ADORE", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, Widget_40, ADORE_12, EventHub_35, MessageType_36, Event_33) {
  10144. "use strict";
  10145. var ProductShow = (function (_super) {
  10146. __extends(ProductShow, _super);
  10147. function ProductShow(parentId, id, style) {
  10148. _super.call(this, parentId, id, style);
  10149. this.$thisNode = $(ProductShow.TemplateRow).attr({ id: this.id });
  10150. this.noIncome = false;
  10151. var result = ADORE_12.ADORE.ProductShowNoIncome & style;
  10152. if (result === ADORE_12.ADORE.ProductShowNoIncome) {
  10153. this.noIncome = true;
  10154. }
  10155. }
  10156. ProductShow.prototype.addItems = function (args) {
  10157. var items = args.items;
  10158. if (!items || items.length === 0) {
  10159. return;
  10160. }
  10161. var $father = this.$thisNode.parent();
  10162. this.$thisNode.detach();
  10163. for (var i = 0; i < items.length; i++) {
  10164. if (this.$thisNode.find("#" + items[i].id).length !== 0) {
  10165. this.setItem(items[i]);
  10166. }
  10167. else {
  10168. this.addItem(items[i]);
  10169. }
  10170. }
  10171. this.$thisNode.appendTo($father);
  10172. };
  10173. ProductShow.prototype.setItems = function (args) {
  10174. var items = args.items;
  10175. this.clear();
  10176. this.addItems({ items: items });
  10177. };
  10178. ProductShow.prototype.addItem = function (item) {
  10179. var itemNode = $(ProductShow.TemplateShow).attr({ id: item.id });
  10180. itemNode.appendTo(this.$thisNode);
  10181. this.setItemAttr(itemNode, item);
  10182. var own = this;
  10183. itemNode.find("div.product-show-button").on("click", function (e) {
  10184. var index = own.indexOf(itemNode[0]);
  10185. var productID = itemNode.attr("id");
  10186. EventHub_35.EventHub.dispatchEvent(MessageType_36.MessageType.WIDGET, {
  10187. id: own.id,
  10188. evtType: Event_33.Event.CLICK,
  10189. index: index,
  10190. itemID: productID
  10191. });
  10192. });
  10193. };
  10194. ProductShow.prototype.indexOf = function (item) {
  10195. var items = this.$thisNode.find("div.product-show");
  10196. for (var i = 0; i < items.length; i++) {
  10197. if (item === items[i]) {
  10198. return i;
  10199. }
  10200. }
  10201. return -1;
  10202. };
  10203. ProductShow.prototype.setItem = function (item) {
  10204. var itemNode = this.$thisNode.find("#" + item.id);
  10205. this.setItemAttr(itemNode, item);
  10206. };
  10207. ProductShow.prototype.setItemAttr = function (itemNode, item) {
  10208. itemNode.find("div.product-show-title").find("p").html(this.parseText(item.title));
  10209. if (this.noIncome) {
  10210. itemNode.find("div.product-show-income").css("display", "none");
  10211. itemNode.find("div.product-show-subtitle").css("display", "none");
  10212. itemNode.find("div.product-show-image").css("margin-top", "10px");
  10213. itemNode.css("height", "408px");
  10214. }
  10215. else {
  10216. itemNode.find("div.product-show-subtitle").find("p").html(this.parseText(item.subTitle));
  10217. itemNode.find("div.product-show-income").find("p").text(item.income);
  10218. }
  10219. if (item.image) {
  10220. itemNode.find("div.product-show-image").find("img").attr("src", item.image);
  10221. }
  10222. else {
  10223. itemNode.find("div.product-show-image").find("img").attr("src", "../www/images/product_show/product-image.png");
  10224. }
  10225. itemNode.find("div.product-show-details").find("p").html(this.parseText(item.details));
  10226. itemNode.find("div.product-show-button").find("p").text(item.btnText);
  10227. };
  10228. ProductShow.prototype.parseText = function (text) {
  10229. if (text) {
  10230. return text.replace(/\n/g, "<br>");
  10231. }
  10232. return "";
  10233. };
  10234. ProductShow.prototype.removeItem = function (args) {
  10235. var ids = args.itemIds;
  10236. if (ids && ids.length > 0) {
  10237. for (var i = 0; i < ids.length; i++) {
  10238. this.$thisNode.find("#" + ids[i]).remove();
  10239. }
  10240. }
  10241. };
  10242. ProductShow.prototype.clear = function () {
  10243. this.$thisNode.find("div.product-show").remove();
  10244. };
  10245. ProductShow.TemplateRow = "<div class=\"row\"> </div>";
  10246. ProductShow.TemplateShow = "\n <div class=\"col s6 m6 l4 product-show\">\n <div class=\"product-show-container\">\n <img class=\"product-show-container-img\" src=\"../www/images/product_show/hot-sell.png\">\n\n <div class=\"product-show-container-prefix\">\n <div class=\"product-show-title\">\n <p></p>\n </div>\n <div class=\"product-show-second-container\">\n <div class=\"product-show-subtitle\">\n <p></p>\n </div>\n <div class=\"product-show-income\">\n <p></p>\n </div>\n <div class=\"product-show-image\">\n <img style=\"max-width: 100%;max-height: 100%;\">\n </div>\n <div class=\"product-show-details\">\n <p class=\"product-show-details-content\">\n \n </p>\n </div>\n <div class=\"product-show-button\">\n <p></p>\n </div>\n </div>\n </div>\n </div>\n</div> ";
  10247. return ProductShow;
  10248. }(Widget_40.Widget));
  10249. exports.ProductShow = ProductShow;
  10250. });
  10251. define("widget/transfernetwork/WindowQueue", ["require", "exports", "widget/Widget", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, Widget_41, EventHub_36, MessageType_37, Event_34) {
  10252. "use strict";
  10253. var WindowQueue = (function (_super) {
  10254. __extends(WindowQueue, _super);
  10255. function WindowQueue(parentId, id, style) {
  10256. _super.call(this, parentId, id, style);
  10257. this.$thisNode = $(WindowQueue.Template0).attr({ id: id });
  10258. }
  10259. WindowQueue.prototype.addItems = function (args) {
  10260. var items = args.items;
  10261. if (!items || items.length === 0) {
  10262. return;
  10263. }
  10264. var $father = this.$thisNode.parent();
  10265. if ($father.length !== 0) {
  10266. this.$thisNode.detach();
  10267. }
  10268. for (var i = 0; i < items.length; i++) {
  10269. if (items[i].win_num) {
  10270. if (this.$thisNode.find("#" + items[i].win_num).length !== 0) {
  10271. this.setItem(items[i]);
  10272. }
  10273. else {
  10274. this.addItem(items[i]);
  10275. }
  10276. }
  10277. }
  10278. if ($father.length !== 0) {
  10279. this.$thisNode.appendTo($father);
  10280. }
  10281. };
  10282. WindowQueue.prototype.setItems = function (args) {
  10283. var items = args.items;
  10284. this.clear();
  10285. this.addItems({ items: items });
  10286. };
  10287. WindowQueue.prototype.addItem = function (item) {
  10288. var $itemNode = $(WindowQueue.Template1).attr({ id: item.win_num });
  10289. $itemNode.appendTo(this.$thisNode);
  10290. this.setWindowAttr($itemNode, item);
  10291. var own = this;
  10292. $itemNode.find("div.window_queue_body").on("click", function (e) {
  10293. var index = own.indexOf($itemNode[0]);
  10294. var win_num = $itemNode.attr("id");
  10295. EventHub_36.EventHub.dispatchEvent(MessageType_37.MessageType.WIDGET, {
  10296. id: own.id,
  10297. evtType: Event_34.Event.LOOK_OVER,
  10298. index: index,
  10299. win_num: win_num
  10300. });
  10301. });
  10302. };
  10303. WindowQueue.prototype.setItem = function (item) {
  10304. var $itemNode = this.$thisNode.find("#" + item.win_num);
  10305. this.setWindowAttr($itemNode, item);
  10306. };
  10307. WindowQueue.prototype.setWindowAttr = function ($itemNode, item) {
  10308. $itemNode.find(".window_queue_id")[0].innerHTML = WindowQueue.Template3 + item.win_num;
  10309. if (item.status) {
  10310. var windowQueueBody = $itemNode.find(".window_queue_body");
  10311. windowQueueBody.removeClass("window_queue_body_border_style1").removeClass("window_queue_body_border_style2").removeClass("window_queue_body_border_style3");
  10312. var $statusNode = $itemNode.find(".window_queue_status");
  10313. $statusNode.text(item.status);
  10314. var $statusImgNode = $(WindowQueue.Template2).appendTo($statusNode);
  10315. if (item.status === "空闲") {
  10316. $statusImgNode.attr("src", "images/window_queue/kongxian.png");
  10317. windowQueueBody.addClass("window_queue_body_border_style1");
  10318. }
  10319. else if (item.status === "服务中") {
  10320. $statusImgNode.attr("src", "images/window_queue/fuwuzhong.png");
  10321. windowQueueBody.addClass("window_queue_body_border_style2");
  10322. }
  10323. else if (item.status === "离线") {
  10324. $statusImgNode.attr("src", "images/window_queue/lixian.png");
  10325. windowQueueBody.addClass("window_queue_body_border_style3");
  10326. }
  10327. else {
  10328. $statusImgNode.attr("src", "images/window_queue/weizhi.png");
  10329. windowQueueBody.addClass("window_queue_body_border_style3");
  10330. }
  10331. }
  10332. if (item.tellerNo) {
  10333. $itemNode.find(".window_queue_body_teller_no").text("柜员:" + item.tellerNo);
  10334. }
  10335. if (item.tellerName) {
  10336. $itemNode.find(".window_queue_body_teller_name").text("姓名:" + item.tellerName);
  10337. }
  10338. if (item.queue_num) {
  10339. $itemNode.find(".window_queue_body_service_custom").text("当前服务客户:" + item.queue_num);
  10340. }
  10341. if (item.serviceCustomLevel) {
  10342. $itemNode.find(".window_queue_body_custom_level").text("客户等级:" + item.serviceCustomLevel);
  10343. var customLevelNode = $itemNode.find(".window_queue_body_custom");
  10344. customLevelNode.find("img").remove();
  10345. var customLevelImg = $(WindowQueue.Template2).addClass("window_queue_body_custom_level_img").appendTo(customLevelNode);
  10346. if (item.serviceCustomLevel === "黄金客户") {
  10347. customLevelImg.attr("src", "images/custom_queue/custom_level/huangjin.png");
  10348. }
  10349. else if (item.serviceCustomLevel === "白金客户") {
  10350. customLevelImg.attr("src", "images/custom_queue/custom_level/baijin.png");
  10351. }
  10352. else if (item.serviceCustomLevel === "钻石客户") {
  10353. customLevelImg.attr("src", "images/custom_queue/custom_level/zuanshi.png");
  10354. }
  10355. else {
  10356. customLevelImg.attr("src", "images/custom_queue/custom_level/putong.png");
  10357. }
  10358. }
  10359. if (item.windowInfo) {
  10360. $itemNode.find(".window_queue_body_footer_p").text(item.windowInfo);
  10361. }
  10362. };
  10363. WindowQueue.prototype.removeItem = function (args) {
  10364. var ids = args.itemIds;
  10365. if (ids && ids.length > 0) {
  10366. for (var i = 0; i < ids.length; i++) {
  10367. this.$thisNode.find("#" + ids[i]).remove();
  10368. }
  10369. }
  10370. };
  10371. WindowQueue.prototype.indexOf = function (item) {
  10372. var $items = this.$thisNode.find("div.window_queue_container");
  10373. for (var i = 0; i < $items.length; i++) {
  10374. if (item === $items[i]) {
  10375. return i;
  10376. }
  10377. }
  10378. return -1;
  10379. };
  10380. WindowQueue.prototype.clear = function () {
  10381. this.$thisNode.find(".window_queue_container").remove();
  10382. };
  10383. WindowQueue.Template0 = "<div class=\"row\"></div>";
  10384. WindowQueue.Template1 = "<div class=\"col s6 m4 l3 window_queue_container\">\n <div>\n <div class=\"window_queue_header\">\n <p class=\"window_queue_id\"><!--\u7A97\u53E31-1-->\n </p>\n\n <p class=\"window_queue_status\">\u7A7A\u95F2<img src=\"images/window_queue/kongxian.png\"/></p>\n </div>\n <div class=\"window_queue_body\">\n <p class=\"window_queue_body_teller_info window_queue_body_teller_no\">\u67DC\u5458\uFF1A\u6682\u65E0</p>\n\n <p class=\"window_queue_body_teller_info window_queue_body_teller_name\">\u59D3\u540D\uFF1A\u6682\u65E0</p>\n <img class=\"window_queue_body_img\" src=\"images/window_queue/guiyuan.png\"/>\n\n <div class=\"window_queue_body_line\"></div>\n <p class=\"window_queue_body_service_custom\">\u5F53\u524D\u670D\u52A1\u5BA2\u6237\uFF1A\u6682\u65E0</p>\n\n <div class=\"window_queue_body_middle\"></div>\n <div class=\"window_queue_body_custom\">\n <p class=\"window_queue_body_custom_level\">\u5BA2\u6237\u7B49\u7EA7\uFF1A\u6682\u65E0</p>\n </div>\n <div class=\"window_queue_body_line\"></div>\n\n <div class=\"window_queue_body_footer\">\n <p class=\"window_queue_body_footer_p\">\u6682\u65E0\u6B64\u7A97\u53E3\u8BE6\u7EC6\u6570\u636E......</p>\n </div>\n </div>\n </div>\n </div>";
  10385. WindowQueue.Template2 = "<img/>";
  10386. WindowQueue.Template3 = "<img src=\"images/window_queue/window.png\"/>";
  10387. return WindowQueue;
  10388. }(Widget_41.Widget));
  10389. exports.WindowQueue = WindowQueue;
  10390. });
  10391. define("widget/tree/TreeItem", ["require", "exports", "event/EventHub", "event/MessageType", "event/Event", "widget/tree/Tree", "widget/Composite"], function (require, exports, EventHub_37, MessageType_38, Event_35, Tree_1, Composite_12) {
  10392. "use strict";
  10393. var TreeItem = (function (_super) {
  10394. __extends(TreeItem, _super);
  10395. function TreeItem(parentId, id, style) {
  10396. _super.call(this, parentId, id, style);
  10397. this.children = new Array();
  10398. this.children = new Array();
  10399. this.$thisNode = $(TreeItem.TemplateNormal).attr("id", this.id);
  10400. this.$attachNode = this.$thisNode;
  10401. this.$a = this.$thisNode.find("a");
  10402. this.hadChildren = false;
  10403. this.isTreeItem = true;
  10404. if (this.parent) {
  10405. this.treeId = this.parent.treeId;
  10406. }
  10407. var itemId = this.id;
  10408. var own = this;
  10409. this.$a.on("click", function (e) {
  10410. clearTimeout(own.timeoutFunc);
  10411. own.timeoutFunc = setTimeout(function () {
  10412. own.handleClick(itemId, own.$attachNode);
  10413. }, 300);
  10414. });
  10415. this.$a.on("dblclick", function (e) {
  10416. clearTimeout(own.timeoutFunc);
  10417. own.handleDBClick(itemId, $(this.parentNode));
  10418. });
  10419. this.$checkboxNode = this.$attachNode.find("div").eq(0);
  10420. this.checkboxId = "";
  10421. var tmpId = this.treeId;
  10422. this.$checkboxNode.find("input").eq(0).on("click", function (e) {
  10423. own.refreshCheckState();
  10424. EventHub_37.EventHub.dispatchEvent(MessageType_38.MessageType.WIDGET, {
  10425. id: own.treeId,
  10426. evtType: Event_35.Event.ON_CHANGE,
  10427. cid: own.id,
  10428. checked: own.$checkboxNode.find("input").eq(0).prop("checked")
  10429. });
  10430. });
  10431. }
  10432. TreeItem.prototype.addChild = function (child) {
  10433. this.children.push(child);
  10434. };
  10435. TreeItem.prototype.layout = function () {
  10436. this.append();
  10437. if (this.parent) {
  10438. var treeNode = this.parent.$thisNode.find(".collapsible");
  10439. if (treeNode) {
  10440. treeNode.collapsible();
  10441. }
  10442. }
  10443. };
  10444. TreeItem.prototype.handleDBClick = function (itemId, $itemNode) {
  10445. this.clickCircle(itemId, $itemNode);
  10446. EventHub_37.EventHub.dispatchEvent(MessageType_38.MessageType.WIDGET, { id: itemId, treeId: this.treeId, evtType: Event_35.Event.DOUBLE_CLICK });
  10447. };
  10448. TreeItem.prototype.clickCircle = function (itemId, $itemNode) {
  10449. var tmpId = this.treeId;
  10450. var tree = $("#" + tmpId);
  10451. tree.find("li.bold").removeClass("adore_tree_node_selected");
  10452. $itemNode.addClass("adore_tree_node_selected");
  10453. var treeNodeCircle = $itemNode.find("div.adore_tree_node_circle").first();
  10454. if (treeNodeCircle.length !== 0) {
  10455. var arrowSpan = $itemNode.find("span.adore_tree_node_arrow").first();
  10456. var circleDiv = treeNodeCircle.find("div");
  10457. if (treeNodeCircle.attr("expand") === "false") {
  10458. treeNodeCircle.attr("expand", "true");
  10459. treeNodeCircle.removeClass("adore_circle").addClass("adore_mincircle");
  10460. circleDiv.text("-");
  10461. circleDiv.removeClass("adore_addcharpan").addClass("adore_mincharpan");
  10462. arrowSpan.addClass("adore_tree_node_arrow_click");
  10463. }
  10464. else {
  10465. treeNodeCircle.attr("expand", "false");
  10466. treeNodeCircle.removeClass("adore_mincircle").addClass("adore_circle");
  10467. circleDiv.text("+");
  10468. circleDiv.removeClass("adore_mincharpan").addClass("adore_addcharpan");
  10469. arrowSpan.removeClass("adore_tree_node_arrow_click");
  10470. }
  10471. }
  10472. };
  10473. TreeItem.prototype.handleClick = function (itemId, $itemNode) {
  10474. this.clickCircle(itemId, $itemNode);
  10475. EventHub_37.EventHub.dispatchEvent(MessageType_38.MessageType.WIDGET, { id: itemId, treeId: this.treeId, evtType: Event_35.Event.CLICK });
  10476. };
  10477. TreeItem.prototype.changeParentStyle = function () {
  10478. var parent = this.parent;
  10479. if (!parent.hadChildren) {
  10480. parent.$thisNode.remove();
  10481. parent.$thisNode = $(TreeItem.TemplateComplex).attr("id", parent.id);
  10482. parent.$attachNode = parent.$thisNode;
  10483. parent.$a = parent.$thisNode.find("a");
  10484. var own_6 = parent;
  10485. var itemId_1 = parent.id;
  10486. parent.$circleNode = parent.$attachNode.find("div.adore_tree_node_circle").first();
  10487. parent.$a.on("click", function (e) {
  10488. clearTimeout(own_6.timeoutFunc);
  10489. own_6.timeoutFunc = setTimeout(function () {
  10490. own_6.handleClick(itemId_1, parent.$attachNode);
  10491. });
  10492. });
  10493. parent.$a.on("dblclick", function (e) {
  10494. clearTimeout(own_6.timeoutFunc);
  10495. own_6.handleDBClick(itemId_1, parent.$attachNode);
  10496. });
  10497. parent.$circleNode.on("click", function (e) {
  10498. own_6.$a.click();
  10499. });
  10500. parent.$ul = parent.$thisNode.find("ul.collapsible").find("ul");
  10501. parent.hadChildren = true;
  10502. if (parent.text) {
  10503. parent.setText({ text: parent.text });
  10504. }
  10505. var display = parent.$checkboxNode.css("display");
  10506. parent.$checkboxNode = $(this.parent.$attachNode.find("div").get(2));
  10507. parent.refreshCheckId(this.parent.checkboxId);
  10508. parent.$checkboxNode.css("display", display);
  10509. var tempParent = this.parent;
  10510. var tmpId = this.treeId;
  10511. parent.$checkboxNode.find("input").eq(0).on("click", function (e) {
  10512. tempParent.refreshCheckState();
  10513. EventHub_37.EventHub.dispatchEvent(MessageType_38.MessageType.WIDGET, {
  10514. id: tmpId,
  10515. evtType: Event_35.Event.ON_CHANGE,
  10516. cid: own_6.id,
  10517. checked: tempParent.$checkboxNode.find("input").eq(0).prop("checked")
  10518. });
  10519. });
  10520. if (this.parent.parent) {
  10521. if (this.parent.parent instanceof Tree_1.Tree) {
  10522. this.parent.$thisNode.appendTo(this.parent.parent.$attachNode);
  10523. }
  10524. else if (this.parent.parent instanceof TreeItem) {
  10525. var $liChildNodes = this.parent.parent.$ul.children("li");
  10526. var size = $liChildNodes.length;
  10527. var index = this.parent.parent.children.indexOf(this.parent);
  10528. if (index < size) {
  10529. this.parent.$thisNode.insertBefore($liChildNodes.eq(index));
  10530. }
  10531. else {
  10532. this.parent.$thisNode.appendTo(this.parent.parent.$ul);
  10533. }
  10534. }
  10535. }
  10536. else {
  10537. this.parent.$thisNode.appendTo(document.body);
  10538. }
  10539. }
  10540. };
  10541. TreeItem.prototype.append = function () {
  10542. if (this.parent) {
  10543. if (this.parent.isTreeItem) {
  10544. this.changeParentStyle();
  10545. this.$thisNode.appendTo(this.parent.$ul);
  10546. }
  10547. else {
  10548. this.$thisNode.appendTo(this.parent.$attachNode);
  10549. }
  10550. }
  10551. else {
  10552. this.$thisNode.appendTo(document.body);
  10553. }
  10554. };
  10555. TreeItem.prototype.setText = function (args) {
  10556. this.text = args.text;
  10557. this.$a.find("span").first().text(this.text);
  10558. };
  10559. TreeItem.prototype.setCheckboxId = function (args) {
  10560. this.checkboxId = args.checkboxId;
  10561. this.refreshCheckId(this.checkboxId);
  10562. };
  10563. TreeItem.prototype.refreshCheckId = function (checkboxId) {
  10564. this.$checkboxNode.find("input").attr("id", checkboxId);
  10565. this.$checkboxNode.find("label").attr("for", checkboxId);
  10566. };
  10567. TreeItem.prototype.viewCheckbox = function (args) {
  10568. this.refreshViewCheckbox(args.viewCheckbox);
  10569. };
  10570. TreeItem.prototype.refreshViewCheckbox = function (viewCheckbox) {
  10571. if (viewCheckbox) {
  10572. this.$checkboxNode.css("display", "block");
  10573. }
  10574. else {
  10575. this.$checkboxNode.css("display", "none");
  10576. }
  10577. };
  10578. TreeItem.prototype.refreshCheckState = function () {
  10579. var $checkbox = this.$checkboxNode.find("input").eq(0);
  10580. var checked = $checkbox.prop("checked");
  10581. this.$attachNode.find("input").prop("checked", checked);
  10582. this.$attachNode.find("input").prop("indeterminate", false);
  10583. var father = this.parent;
  10584. while (father && father instanceof TreeItem) {
  10585. var state = -1;
  10586. var $checkboxes = father.$attachNode.find("input");
  10587. var checkboxSize = $checkboxes.length;
  10588. for (var i = 1; i < checkboxSize; i++) {
  10589. var checkedTmp = $checkboxes.eq(i).prop("checked");
  10590. if (checkedTmp) {
  10591. if (state == -1) {
  10592. state = 0;
  10593. }
  10594. else if (state != 0) {
  10595. state = 2;
  10596. break;
  10597. }
  10598. }
  10599. else {
  10600. if (state == -1) {
  10601. state = 1;
  10602. }
  10603. else if (state != 1) {
  10604. state = 2;
  10605. break;
  10606. }
  10607. }
  10608. }
  10609. var $checoboxTmp = father.$attachNode.find("input").eq(0);
  10610. if (state == 0) {
  10611. $checoboxTmp.prop("checked", true);
  10612. $checoboxTmp.prop("indeterminate", false);
  10613. }
  10614. else if (state == 1) {
  10615. $checoboxTmp.prop("checked", false);
  10616. $checoboxTmp.prop("indeterminate", false);
  10617. }
  10618. else {
  10619. $checoboxTmp.prop("checked", false);
  10620. $checoboxTmp.prop("indeterminate", true);
  10621. }
  10622. father = father.parent;
  10623. }
  10624. };
  10625. TreeItem.prototype.setCheckboxState = function (checkboxState) {
  10626. this.$checkboxNode.find("input").eq(0).prop("checked", checkboxState);
  10627. this.$checkboxNode.find("input").eq(0).prop("indeterminate", false);
  10628. };
  10629. TreeItem.prototype.needRedForground = function (args) {
  10630. var needRedForground = args.needRedForground;
  10631. if (needRedForground) {
  10632. this.$a.css("color", "red");
  10633. }
  10634. else {
  10635. this.$a.css("color", "#444");
  10636. }
  10637. };
  10638. TreeItem.TemplateNormal = "\n <li class=\"bold adore_tree\" >\n <div class=\"adore_tree_node_checkbox_simple\">\t\n <input type=\"checkbox\" class=\"filled-in\">\t\n <label style=\"font-size: 0;line-height: 16px;\"></label>\n </div>\n <a href=\"#\" class=\"waves-effect adore_tree_a adore_tree_simple_a\">\n <span></span>\n </a>\n </li>";
  10639. TreeItem.TemplateComplex = "\n <li class=\"no-padding adore_tree\">\n <ul class=\"collapsible collapsible-accordion adore_tree\">\n <li class=\"bold adore_tree\">\n\n <div class=\"adore_tree_node_circle adore_circle waves-effect\" expand=\"false\"><div class=\"adore_addcharpan\">+</div></div>\n\n <div class=\"adore_tree_node_checkbox_complex\">\n <input type=\"checkbox\" class=\"filled-in\">\n <label style=\"font-size: 0;line-height: 16px;\"></label>\n </div>\n \n <a class=\"collapsible-header waves-effect adore_tree_a adore_tree_complex_a\">\n <span></span>\n <span class=\"adore_tree_node_arrow\">></span>\n </a>\n\n <div class=\"collapsible-body adore_tree adore_tree_ul_div\">\n <ul>\n\n </ul>\n </div>\n </li>\n </ul>\n </li>";
  10640. return TreeItem;
  10641. }(Composite_12.Composite));
  10642. exports.TreeItem = TreeItem;
  10643. });
  10644. define("widget/tree/Tree", ["require", "exports", "widget/Composite", "util/WidgetManager"], function (require, exports, Composite_13, WidgetManager_6) {
  10645. "use strict";
  10646. var Tree = (function (_super) {
  10647. __extends(Tree, _super);
  10648. function Tree(parentId, id, style) {
  10649. _super.call(this, parentId, id, style);
  10650. this.children = new Array();
  10651. this.candragAndDrop = false;
  10652. this.indrag = false;
  10653. this.children = new Array();
  10654. this.$thisNode = $(Tree.TemplateNormal).attr("id", this.id);
  10655. this.$attachNode = this.$thisNode.find("ul");
  10656. this.treeId = this.id;
  10657. var own = this;
  10658. this.$thisNode.find("ul").on("focus", function (e) {
  10659. console.log("tree focus in");
  10660. own.sendFocusGain();
  10661. }).on("blur", function (e) {
  10662. });
  10663. }
  10664. Tree.prototype.addChild = function (child) {
  10665. this.children.push(child);
  10666. };
  10667. Tree.prototype.removeItem = function (args) {
  10668. var itemId = args.itemId;
  10669. if (itemId != null) {
  10670. this.$delectNode = this.$thisNode.find("#" + itemId);
  10671. this.$delectNode.remove();
  10672. }
  10673. };
  10674. Tree.prototype.dragAndDrop = function (args) {
  10675. this.candragAndDrop = args.candragAndDrop;
  10676. if (this.candragAndDrop === true) {
  10677. this.initTree(this.treeId);
  10678. }
  10679. };
  10680. Tree.prototype.initTree = function (id) {
  10681. var root = document.getElementById(id);
  10682. if (root === null) {
  10683. return false;
  10684. }
  10685. this.initEv();
  10686. };
  10687. Tree.prototype.initEv = function () {
  10688. var own = this;
  10689. };
  10690. Tree.prototype.layout = function () {
  10691. };
  10692. Tree.prototype.viewCheckbox = function (args) {
  10693. var viewCheckbox = args.viewCheckbox;
  10694. var $checkboxNodes = this.$attachNode.find("div input:checkbox").parent();
  10695. if (viewCheckbox) {
  10696. $checkboxNodes.css("display", "block");
  10697. }
  10698. else {
  10699. $checkboxNodes.css("display", "none");
  10700. }
  10701. };
  10702. Tree.prototype.setCheckBoxState = function (args) {
  10703. var stateData = JSON.parse(args.checkBoxState);
  10704. var z = this.$attachNode.find("label").length;
  10705. for (var key in stateData) {
  10706. var treeItem = WidgetManager_6.WidgetManager.byId(key);
  10707. if (treeItem) {
  10708. var checked = treeItem.$checkboxNode.find("input:checkbox").eq(0).prop("checked");
  10709. if (checked !== stateData[key]) {
  10710. treeItem.setCheckboxState(stateData[key]);
  10711. treeItem.refreshCheckState();
  10712. }
  10713. }
  10714. }
  10715. };
  10716. Tree.prototype.changeLeafLocation = function (args) {
  10717. var treeItem = WidgetManager_6.WidgetManager.byId(args.treeItemId);
  10718. var index = args.index;
  10719. var size = treeItem.parent.children.length;
  10720. if (index < 0 || index >= size) {
  10721. index = size - 1;
  10722. }
  10723. var treeItemIndex = treeItem.parent.children.indexOf(treeItem);
  10724. if (treeItemIndex === index) {
  10725. return;
  10726. }
  10727. var afterTreeItem = treeItem.$attachNode.siblings().eq(args.index);
  10728. treeItem.$attachNode.detach();
  10729. treeItem.$attachNode.insertBefore(afterTreeItem);
  10730. };
  10731. Tree.prototype.moveNode = function (args) {
  10732. var currentItem = WidgetManager_6.WidgetManager.byId(args.currentNodeId);
  10733. currentItem.$attachNode.detach();
  10734. if (currentItem.parent) {
  10735. var index = currentItem.parent.children.indexOf(currentItem);
  10736. currentItem.parent.children.splice(index, 1);
  10737. }
  10738. var targetItem = WidgetManager_6.WidgetManager.byId(args.targetNodeId);
  10739. currentItem.parent = targetItem;
  10740. targetItem.children.push(currentItem);
  10741. currentItem.append();
  10742. if (currentItem.parent) {
  10743. var treeNode = currentItem.parent.$attachNode.find(".collapsible");
  10744. if (treeNode) {
  10745. treeNode.collapsible();
  10746. }
  10747. }
  10748. };
  10749. Tree.prototype.sendFocusGain = function () {
  10750. _super.prototype.sendFocusGain.call(this);
  10751. };
  10752. Tree.prototype.setFocus = function () {
  10753. this.sendFocusGain();
  10754. };
  10755. Tree.TemplateNormal = "\n <div style=\"overflow:auto;\">\n <ul tabindex=\"-1\" class=\"side-nav adore_tree adore_root_tree\" style=\"left:0px;width:100%; position: inherit;webkit-box-shadow:none;box-shadow:none;transform:none;\">\n </ul>\n </div>";
  10756. return Tree;
  10757. }(Composite_13.Composite));
  10758. exports.Tree = Tree;
  10759. });
  10760. define("widget/Video", ["require", "exports", "widget/Widget"], function (require, exports, Widget_42) {
  10761. "use strict";
  10762. var Video = (function (_super) {
  10763. __extends(Video, _super);
  10764. function Video(parentId, id, style) {
  10765. _super.call(this, parentId, id, style);
  10766. this.autoplay = false;
  10767. this.$thisNode = $(Video.template).attr({ id: this.id });
  10768. this.$videoNode = this.$thisNode.find("video").attr("id", this.id + "-content");
  10769. this.videoElement = this.$videoNode.get(0);
  10770. this.sourceElement = this.$thisNode.find("source")[0];
  10771. var own = this;
  10772. this.resizeListener = function () {
  10773. own.refreshVideoWidth();
  10774. };
  10775. $(window).on("resize", this.resizeListener);
  10776. }
  10777. Video.prototype.playVideo = function () {
  10778. this.videoElement.play();
  10779. };
  10780. Video.prototype.pauseVideo = function () {
  10781. this.videoElement.pause();
  10782. };
  10783. Video.prototype.setVideoPath = function (args) {
  10784. if (!args.path) {
  10785. return;
  10786. }
  10787. var type = "ogg";
  10788. var index = args.path.lastIndexOf(".");
  10789. if (index !== -1) {
  10790. type = args.path.substring(index + 1, args.path.length);
  10791. }
  10792. this.sourceElement.type = "video/" + type;
  10793. this.sourceElement.src = args.path;
  10794. this.videoElement.load();
  10795. this.refreshVideoWidth();
  10796. };
  10797. Video.prototype.setAutoPlay = function (args) {
  10798. if (args.autoPlay) {
  10799. this.$videoNode.attr("autoplay", "autoplay");
  10800. }
  10801. else {
  10802. this.$videoNode.removeAttr("autoplay");
  10803. }
  10804. };
  10805. Video.prototype.postLayout = function () {
  10806. _super.prototype.postLayout.call(this);
  10807. this.refreshVideoWidth();
  10808. };
  10809. Video.prototype.refreshVideoWidth = function () {
  10810. var w = this.$thisNode.css("width");
  10811. if (w.indexOf("px") !== -1 || w.indexOf("%") !== -1 || w.indexOf("rem") !== -1) {
  10812. this.$videoNode.css("width", w);
  10813. }
  10814. else {
  10815. this.$videoNode.css("width", w + "px");
  10816. }
  10817. };
  10818. Video.prototype.dispose = function () {
  10819. $(window).off("resize", this.resizeListener);
  10820. _super.prototype.dispose.call(this);
  10821. };
  10822. Video.template = "\n <div>\n <video controls=\"controls\">\n <source>\n </video>\n </div>\n ";
  10823. return Video;
  10824. }(Widget_42.Widget));
  10825. exports.Video = Video;
  10826. });
  10827. define("widget/Wizard", ["require", "exports", "widget/Widget", "ADORE"], function (require, exports, Widget_43, ADORE_13) {
  10828. "use strict";
  10829. var Wizard = (function (_super) {
  10830. __extends(Wizard, _super);
  10831. function Wizard(parentId, id, style) {
  10832. _super.call(this, parentId, id, style);
  10833. this.$thisNode = $(Wizard.mainTemplate).attr("id", this.id);
  10834. if (style === ADORE_13.ADORE.Normal) {
  10835. this.setAllBlocks = this.setAllCircleBlocks;
  10836. this.$thisNode.css({
  10837. "background-color": Wizard.NORMAL_STYLE_COLOR
  10838. });
  10839. }
  10840. else if (style === ADORE_13.ADORE.Arrow) {
  10841. this.setAllBlocks = this.setAllArrowBlocks;
  10842. this.$thisNode.css({
  10843. "background-color": Wizard.ARROR_STYLE_COLOR
  10844. });
  10845. }
  10846. }
  10847. Wizard.prototype.setAllCircleBlocks = function (args) {
  10848. var bs = args.blockStates;
  10849. this.$thisNode.children().remove();
  10850. for (var index = 1; index <= bs.length; index++) {
  10851. var $blockNode = $(Wizard.circleBlockTemplate);
  10852. var $outCircleNode = $blockNode.find(".wizard_CT_outCircle");
  10853. var $circleTextNode = $blockNode.find(".wizard_CT_circleText");
  10854. var $textNode = $blockNode.find(".wizard_CT_text");
  10855. this.changeState($outCircleNode, bs[index - 1].state);
  10856. $circleTextNode.html(index.toString());
  10857. $textNode.html(bs[index - 1].text);
  10858. this.$thisNode.append($blockNode);
  10859. }
  10860. };
  10861. Wizard.prototype.setAllArrowBlocks = function (args) {
  10862. var bs = args.blockStates;
  10863. this.$thisNode.children().remove();
  10864. for (var index = 1; index <= bs.length; index++) {
  10865. var $blockNode = $(Wizard.arrowBlockTemplate);
  10866. var $textNode = $blockNode.find(".wizard_AT_text_part");
  10867. this.changeState($blockNode, bs[index - 1].state);
  10868. $textNode.html(bs[index - 1].text);
  10869. this.$thisNode.append($blockNode);
  10870. }
  10871. };
  10872. Wizard.prototype.changeState = function ($node, state) {
  10873. var own = this;
  10874. if ($node.children().length > 0) {
  10875. $node.removeClass("finished").removeClass("handling").
  10876. removeClass("unreached").removeClass("unreachable").addClass(state);
  10877. $node.children().each(function (index, e) {
  10878. own.changeState($(e), state);
  10879. });
  10880. }
  10881. else {
  10882. $node.removeClass("finished").removeClass("handling").
  10883. removeClass("unreached").removeClass("unreachable").addClass(state);
  10884. }
  10885. };
  10886. Wizard.NORMAL_STYLE_COLOR = "#57668E";
  10887. Wizard.ARROR_STYLE_COLOR = "#E4DEDE";
  10888. Wizard.mainTemplate = "\n <div class=\"wizard\"></div>\n ";
  10889. Wizard.circleBlockTemplate = "\n <div class=\"wizard_CT_block\">\n <div class=\"wizard_CT_line_block\">\n <hr class=\"wizard_CT_left_line\"/>\n </div>\n <div class=\"wizard_CT_index_block\">\n <div class=\"wizard_CT_outCircle unreached\">\n <div class=\"wizard_CT_inCircle unreached\">\n <span class=\"wizard_CT_circleText unreached\">1</span>\n\n <div class=\"wizard_CT_left_tick unreached\"></div>\n <div class=\"wizard_CT_right_tick unreached\"></div>\n </div>\n </div>\n </div>\n <div class=\"wizard_CT_line_block\">\n <hr class=\"wizard_CT_right_line\"/>\n </div>\n <div class=\"wizard_CT_text_block\">\n <span class=\"wizard_CT_text\"></span>\n </div>\n </div>\n ";
  10890. Wizard.arrowBlockTemplate = "\n <div class=\"wizard_AT_block\">\n <div class=\"wizard_AT_left_part unreached\"></div>\n <div class=\"wizard_AT_center_block unreached\">\n <span class=\"wizard_AT_text_part unreached\"></span>\n </div>\n <div class=\"wizard_AT_right_part unreached\"></div>\n </div>\n ";
  10891. return Wizard;
  10892. }(Widget_43.Widget));
  10893. exports.Wizard = Wizard;
  10894. });
  10895. //# sourceMappingURL=adore.js.map