1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895 |
- var __extends = (this && this.__extends) || function (d, b) {
- for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- define("ADORE", ["require", "exports"], function (require, exports) {
- "use strict";
- (function (ADORE) {
- ADORE[ADORE["LEFT"] = 2] = "LEFT";
- ADORE[ADORE["RIGHT"] = 4] = "RIGHT";
- ADORE[ADORE["CENTER"] = 8] = "CENTER";
- ADORE[ADORE["Close"] = 16] = "Close";
- ADORE[ADORE["Normal"] = 0] = "Normal";
- ADORE[ADORE["Nav"] = 32] = "Nav";
- ADORE[ADORE["Footer"] = 64] = "Footer";
- ADORE[ADORE["Control"] = 262144] = "Control";
- ADORE[ADORE["Scrollable"] = 524288] = "Scrollable";
- ADORE[ADORE["CardPanel"] = 1048576] = "CardPanel";
- ADORE[ADORE["Password"] = 128] = "Password";
- ADORE[ADORE["Float"] = 256] = "Float";
- ADORE[ADORE["Flat"] = 512] = "Flat";
- ADORE[ADORE["Large"] = 1024] = "Large";
- ADORE[ADORE["Zoom"] = 32] = "Zoom";
- ADORE[ADORE["Switch"] = 33] = "Switch";
- ADORE[ADORE["ProductShowNoIncome"] = 34] = "ProductShowNoIncome";
- ADORE[ADORE["INFORMATION"] = 134217728] = "INFORMATION";
- ADORE[ADORE["CONFIRM"] = 268435456] = "CONFIRM";
- ADORE[ADORE["QUESTION"] = 536870912] = "QUESTION";
- ADORE[ADORE["MODAL"] = 1073741824] = "MODAL";
- ADORE[ADORE["Horizontal"] = 68] = "Horizontal";
- ADORE[ADORE["Vertical"] = 69] = "Vertical";
- ADORE[ADORE["Arrow"] = 73] = "Arrow";
- ADORE[ADORE["Graphics"] = 81] = "Graphics";
- })(exports.ADORE || (exports.ADORE = {}));
- var ADORE = exports.ADORE;
- });
- define("event/MessageType", ["require", "exports"], function (require, exports) {
- "use strict";
- (function (MessageType) {
- MessageType[MessageType["INIT"] = 6] = "INIT";
- MessageType[MessageType["WIDGET"] = 22] = "WIDGET";
- MessageType[MessageType["GPS"] = 24] = "GPS";
- MessageType[MessageType["FINISH"] = 38] = "FINISH";
- MessageType[MessageType["ERROR"] = 54] = "ERROR";
- MessageType[MessageType["ACTIVE_ELEMENT"] = 55] = "ACTIVE_ELEMENT";
- MessageType[MessageType["DISPLAY_FILTER"] = 56] = "DISPLAY_FILTER";
- MessageType[MessageType["DISPLAY"] = 58] = "DISPLAY";
- })(exports.MessageType || (exports.MessageType = {}));
- var MessageType = exports.MessageType;
- });
- define("Config", ["require", "exports"], function (require, exports) {
- "use strict";
- var Config = (function () {
- function Config() {
- }
- Config.init = function (args) {
- if (args.themePath) {
- $("head").find("#adoreTheme").remove();
- $("<link type='text/css' rel='stylesheet'>").attr({
- "id": "adoreTheme", "href": args.themePath
- }).appendTo(document.head);
- }
- };
- return Config;
- }());
- exports.Config = Config;
- });
- define("event/EventHub", ["require", "exports", "event/MessageType"], function (require, exports, MessageType_1) {
- "use strict";
- var EventHub = (function () {
- function EventHub() {
- }
- EventHub.dispatchEvent = function (msgType, attrs) {
- var evtObj = {
- msgType: msgType,
- attributes: attrs
- };
- var msg = JSON.stringify(evtObj);
- if (window["eventdispatch"]) {
- return window["eventdispatch"].dispatch(msg);
- }
- else if (window["cefQuery"]) {
- if (msgType === MessageType_1.MessageType.INIT || msgType === MessageType_1.MessageType.FINISH) {
- return window["cefQuery"]({
- request: msg,
- onSuccess: function (response) {
- },
- onFailure: function (error_code, error_message) {
- }
- });
- }
- else {
- try {
- EventHub.xmlHttpRequest.open("get", "adore://message?msg=" + msg +
- "×tamp=" + new Date().valueOf(), false);
- EventHub.xmlHttpRequest.send();
- return "true" === EventHub.xmlHttpRequest.responseText;
- }
- catch (e) {
- console.error(e);
- return false;
- }
- }
- }
- else if (window["dispatch"]) {
- return window["dispatch"](msg);
- }
- else {
- return confirm("adore://" + msg);
- }
- };
- EventHub.xmlHttpRequest = new XMLHttpRequest();
- return EventHub;
- }());
- exports.EventHub = EventHub;
- });
- define("event/Event", ["require", "exports"], function (require, exports) {
- "use strict";
- (function (Event) {
- Event[Event["DISPOSED"] = 12] = "DISPOSED";
- Event[Event["MOUSE_UP"] = 36] = "MOUSE_UP";
- Event[Event["MOUSE_DOWN"] = 37] = "MOUSE_DOWN";
- Event[Event["CLICK"] = 38] = "CLICK";
- Event[Event["MODIFY"] = 39] = "MODIFY";
- Event[Event["ON_CHANGE"] = 40] = "ON_CHANGE";
- Event[Event["BROWSER_EVENT"] = 41] = "BROWSER_EVENT";
- Event[Event["ON_FOCUS"] = 42] = "ON_FOCUS";
- Event[Event["KEY_UP"] = 43] = "KEY_UP";
- Event[Event["KEY_DONW"] = 44] = "KEY_DONW";
- Event[Event["SELECTION"] = 45] = "SELECTION";
- Event[Event["TOUCH_MOVE"] = 46] = "TOUCH_MOVE";
- Event[Event["LOOK_OVER"] = 47] = "LOOK_OVER";
- Event[Event["ON_SLIDING"] = 48] = "ON_SLIDING";
- Event[Event["ON_CLOSE"] = 49] = "ON_CLOSE";
- Event[Event["DOUBLE_CLICK"] = 50] = "DOUBLE_CLICK";
- })(exports.Event || (exports.Event = {}));
- var Event = exports.Event;
- });
- define("util/Map", ["require", "exports"], function (require, exports) {
- "use strict";
- var Map = (function () {
- function Map() {
- this.elements = new Array();
- }
- Map.prototype.put = function (key, value) {
- this.elements.push({ key: key, value: value });
- };
- Map.prototype.containsKey = function (key) {
- if (this.elements.length === 0) {
- return false;
- }
- else {
- for (var i = 0; i < this.elements.length; i++) {
- var element = this.elements[i];
- if (element.key === key) {
- return true;
- }
- }
- return false;
- }
- };
- Map.prototype.containsValue = function (value) {
- for (var i = 0; i < this.elements.length; i++) {
- var element = this.elements[i];
- if (element.value === value) {
- return true;
- }
- return false;
- }
- };
- Map.prototype.remove = function (key) {
- for (var i = 0; i < this.elements.length; i++) {
- var element = this.elements[i];
- if (element.key === key) {
- return this.elements.splice(i, 1);
- }
- }
- return null;
- };
- Map.prototype.getValue = function (key) {
- for (var i = 0; i < this.elements.length; i++) {
- var element = this.elements[i];
- if (element.key === key) {
- return element.value;
- }
- }
- return null;
- };
- Map.prototype.size = function () {
- return this.elements.length;
- };
- Map.prototype.clear = function () {
- this.elements.splice(0, this.size());
- };
- return Map;
- }());
- exports.Map = Map;
- });
- define("hotkey/Keys", ["require", "exports"], function (require, exports) {
- "use strict";
- (function (Keys) {
- Keys[Keys["BACKSPACE"] = 8] = "BACKSPACE";
- Keys[Keys["TAB"] = 9] = "TAB";
- Keys[Keys["CLEAR"] = 12] = "CLEAR";
- Keys[Keys["ENTER"] = 13] = "ENTER";
- Keys[Keys["SHIFT"] = 16] = "SHIFT";
- Keys[Keys["CTRL"] = 17] = "CTRL";
- Keys[Keys["ALT"] = 18] = "ALT";
- Keys[Keys["META"] = 91] = "META";
- Keys[Keys["PAUSE"] = 19] = "PAUSE";
- Keys[Keys["CAPS_LOCK"] = 20] = "CAPS_LOCK";
- Keys[Keys["ESCAPE"] = 27] = "ESCAPE";
- Keys[Keys["SPACE"] = 32] = "SPACE";
- Keys[Keys["PAGE_UP"] = 33] = "PAGE_UP";
- Keys[Keys["PAGE_DOWN"] = 34] = "PAGE_DOWN";
- Keys[Keys["END"] = 35] = "END";
- Keys[Keys["HOME"] = 36] = "HOME";
- Keys[Keys["LEFT_ARROW"] = 37] = "LEFT_ARROW";
- Keys[Keys["UP_ARROW"] = 38] = "UP_ARROW";
- Keys[Keys["RIGHT_ARROW"] = 39] = "RIGHT_ARROW";
- Keys[Keys["DOWN_ARROW"] = 40] = "DOWN_ARROW";
- Keys[Keys["INSERT"] = 45] = "INSERT";
- Keys[Keys["DELETE"] = 46] = "DELETE";
- Keys[Keys["HELP"] = 47] = "HELP";
- Keys[Keys["NUM_0"] = 48] = "NUM_0";
- Keys[Keys["NUM_1"] = 49] = "NUM_1";
- Keys[Keys["NUM_2"] = 50] = "NUM_2";
- Keys[Keys["NUM_3"] = 51] = "NUM_3";
- Keys[Keys["NUM_4"] = 52] = "NUM_4";
- Keys[Keys["NUM_5"] = 53] = "NUM_5";
- Keys[Keys["NUM_6"] = 54] = "NUM_6";
- Keys[Keys["NUM_7"] = 55] = "NUM_7";
- Keys[Keys["NUM_8"] = 56] = "NUM_8";
- Keys[Keys["NUM_9"] = 57] = "NUM_9";
- Keys[Keys["CHAR_A"] = 65] = "CHAR_A";
- Keys[Keys["CHAR_B"] = 66] = "CHAR_B";
- Keys[Keys["CHAR_C"] = 67] = "CHAR_C";
- Keys[Keys["CHAR_D"] = 68] = "CHAR_D";
- Keys[Keys["CHAR_E"] = 69] = "CHAR_E";
- Keys[Keys["CHAR_F"] = 70] = "CHAR_F";
- Keys[Keys["CHAR_G"] = 71] = "CHAR_G";
- Keys[Keys["CHAR_H"] = 72] = "CHAR_H";
- Keys[Keys["CHAR_I"] = 73] = "CHAR_I";
- Keys[Keys["CHAR_J"] = 74] = "CHAR_J";
- Keys[Keys["CHAR_K"] = 75] = "CHAR_K";
- Keys[Keys["CHAR_L"] = 76] = "CHAR_L";
- Keys[Keys["CHAR_M"] = 77] = "CHAR_M";
- Keys[Keys["CHAR_N"] = 78] = "CHAR_N";
- Keys[Keys["CHAR_O"] = 79] = "CHAR_O";
- Keys[Keys["CHAR_P"] = 80] = "CHAR_P";
- Keys[Keys["CHAR_Q"] = 81] = "CHAR_Q";
- Keys[Keys["CHAR_R"] = 82] = "CHAR_R";
- Keys[Keys["CHAR_S"] = 83] = "CHAR_S";
- Keys[Keys["CHAR_T"] = 84] = "CHAR_T";
- Keys[Keys["CHAR_U"] = 85] = "CHAR_U";
- Keys[Keys["CHAR_V"] = 86] = "CHAR_V";
- Keys[Keys["CHAR_W"] = 87] = "CHAR_W";
- Keys[Keys["CHAR_X"] = 88] = "CHAR_X";
- Keys[Keys["CHAR_Y"] = 89] = "CHAR_Y";
- Keys[Keys["CHAR_Z"] = 90] = "CHAR_Z";
- Keys[Keys["LEFT_WINDOW"] = 91] = "LEFT_WINDOW";
- Keys[Keys["RIGHT_WINDOW"] = 92] = "RIGHT_WINDOW";
- Keys[Keys["SELECT"] = 93] = "SELECT";
- Keys[Keys["NUMPAD_0"] = 96] = "NUMPAD_0";
- Keys[Keys["NUMPAD_1"] = 97] = "NUMPAD_1";
- Keys[Keys["NUMPAD_2"] = 98] = "NUMPAD_2";
- Keys[Keys["NUMPAD_3"] = 99] = "NUMPAD_3";
- Keys[Keys["NUMPAD_4"] = 100] = "NUMPAD_4";
- Keys[Keys["NUMPAD_5"] = 101] = "NUMPAD_5";
- Keys[Keys["NUMPAD_6"] = 102] = "NUMPAD_6";
- Keys[Keys["NUMPAD_7"] = 103] = "NUMPAD_7";
- Keys[Keys["NUMPAD_8"] = 104] = "NUMPAD_8";
- Keys[Keys["NUMPAD_9"] = 105] = "NUMPAD_9";
- Keys[Keys["NUMPAD_MULTIPLY"] = 106] = "NUMPAD_MULTIPLY";
- Keys[Keys["NUMPAD_PLUS"] = 107] = "NUMPAD_PLUS";
- Keys[Keys["NUMPAD_ENTER"] = 108] = "NUMPAD_ENTER";
- Keys[Keys["NUMPAD_MINUS"] = 109] = "NUMPAD_MINUS";
- Keys[Keys["NUMPAD_PERIOD"] = 110] = "NUMPAD_PERIOD";
- Keys[Keys["NUMPAD_DIVIDE"] = 111] = "NUMPAD_DIVIDE";
- Keys[Keys["F1"] = 112] = "F1";
- Keys[Keys["F2"] = 113] = "F2";
- Keys[Keys["F3"] = 114] = "F3";
- Keys[Keys["F4"] = 115] = "F4";
- Keys[Keys["F5"] = 116] = "F5";
- Keys[Keys["F6"] = 117] = "F6";
- Keys[Keys["F7"] = 118] = "F7";
- Keys[Keys["F8"] = 119] = "F8";
- Keys[Keys["F9"] = 120] = "F9";
- Keys[Keys["F10"] = 121] = "F10";
- Keys[Keys["F11"] = 122] = "F11";
- Keys[Keys["F12"] = 123] = "F12";
- Keys[Keys["F13"] = 124] = "F13";
- Keys[Keys["F14"] = 125] = "F14";
- Keys[Keys["F15"] = 126] = "F15";
- Keys[Keys["NUM_LOCK"] = 144] = "NUM_LOCK";
- Keys[Keys["SCROLL_LOCK"] = 145] = "SCROLL_LOCK";
- Keys[Keys["UP_DPAD"] = 175] = "UP_DPAD";
- Keys[Keys["DOWN_DPAD"] = 176] = "DOWN_DPAD";
- Keys[Keys["LEFT_DPAD"] = 177] = "LEFT_DPAD";
- Keys[Keys["RIGHT_DPAD"] = 178] = "RIGHT_DPAD";
- Keys[Keys["SLASH"] = 191] = "SLASH";
- })(exports.Keys || (exports.Keys = {}));
- var Keys = exports.Keys;
- });
- 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) {
- "use strict";
- var MessageDialog = (function (_super) {
- __extends(MessageDialog, _super);
- function MessageDialog(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.modal = true;
- this.$thisNode = $(MessageDialog.Template).attr("id", this.id);
- this.$wrapMessage = $(MessageDialog.TemplateWrap).attr("id", this.id + "_wrap");
- this.$titleNode = this.$thisNode.find("h4");
- this.$contentNode = this.$thisNode.find("pre").attr("id", this.id + "_p");
- this.$footerNode = this.$thisNode.find("div.modal-footer");
- }
- MessageDialog.prototype.setFocus = function () {
- };
- MessageDialog.prototype.setTitle = function (args) {
- this.$titleNode.text(args.title);
- };
- MessageDialog.prototype.setMessage = function (args) {
- this.$contentNode[0].innerHTML = args.message.replace(/</g, "<").replace(/>/g, ">");
- };
- MessageDialog.prototype.createBtnNode = function (btnLabel, code) {
- var _this = this;
- var $btnNode = $(MessageDialog.TemplateButton);
- $btnNode.text(btnLabel);
- $btnNode.appendTo(this.$footerNode);
- var own = this;
- $btnNode.on("click", function (e) {
- if (own.type === 2) {
- if (code === 0) {
- var value = own.$thisNode.find("input").val();
- EventHub_1.EventHub.dispatchEvent(MessageType_2.MessageType.WIDGET, { id: own.id, evtType: Event_1.Event.CLICK, inputText: value });
- }
- else {
- EventHub_1.EventHub.dispatchEvent(MessageType_2.MessageType.WIDGET, { id: own.id, evtType: Event_1.Event.CLICK, inputText: "" });
- }
- }
- else if (own.type === 1) {
- if (code === 0) {
- var text = own.$thisNode.find("select").val();
- EventHub_1.EventHub.dispatchEvent(MessageType_2.MessageType.WIDGET, { id: own.id, evtType: Event_1.Event.CLICK, inputText: text });
- }
- else {
- EventHub_1.EventHub.dispatchEvent(MessageType_2.MessageType.WIDGET, { id: own.id, evtType: Event_1.Event.CLICK, inputText: "" });
- }
- }
- else {
- EventHub_1.EventHub.dispatchEvent(MessageType_2.MessageType.WIDGET, { id: _this.id, evtType: Event_1.Event.CLICK, returnCode: code });
- }
- });
- $btnNode.on("focus", function (e) {
- _this.setCurrentFocusIndex(code);
- });
- };
- MessageDialog.prototype.setCurrentFocusIndex = function (index) {
- this.currentFocusIndex = index;
- };
- MessageDialog.prototype.setMessageType = function (args) {
- this.$footerNode.find("a").remove();
- var type = args.messageType;
- var tmpId = this.id;
- if (type === "confirm") {
- this.createBtnNode("Cancel", 1);
- this.createBtnNode("Ok", 0);
- }
- else if (type === "question") {
- this.createBtnNode("No", 1);
- this.createBtnNode("Yes", 0);
- }
- else if (type === "information") {
- this.createBtnNode("Ok", 0);
- }
- else if (type === "close") {
- this.createBtnNode("Cancel", 1);
- this.createBtnNode("Ok", 0);
- var closeIcon = $(MessageDialog.TemplateCloseButton);
- var $titleBlock = this.$thisNode.find(".adore_dialog_title");
- $titleBlock.append(closeIcon);
- }
- };
- MessageDialog.prototype.setButtonTexts = function (args) {
- this.$footerNode.find("a").remove();
- var btnLabels = args.buttonTexts;
- var btnLabelArr = btnLabels.split("<!-- split -->");
- var len = btnLabelArr.length;
- for (var i = len - 1; i >= 0; i--) {
- this.createBtnNode(btnLabelArr[i], i);
- }
- };
- MessageDialog.prototype.setModal = function (args) {
- this.modal = args.modal;
- };
- MessageDialog.prototype.show = function () {
- this.$thisNode.appendTo(this.$wrapMessage.find(".messageWrap"));
- this.$wrapMessage.appendTo(document.body);
- var own = this;
- var btns = $("#" + this.id).find("div.modal-footer").find("a").reverse();
- this.currentFocusIndex = 0;
- var index = this.currentFocusIndex;
- this.$thisNode.css({
- display: "block",
- opacity: 0,
- scaleX: "0.7"
- });
- this.$thisNode.velocity({ opacity: 1, scaleX: "1" }, {
- duration: 320,
- queue: false,
- ease: "easeOutCubic"
- });
- own.wrapBlockLocation();
- this.resizeListener = function () {
- own.wrapBlockLocation();
- };
- $(window).on("resize", this.resizeListener);
- if (window.innerWidth <= 600) {
- if (this.resetDialogSize("adore_dialog_mobile_size_level_1", "adore_dialog_mobile_size_level_2")) {
- this.resetDialogSize("adore_dialog_mobile_size_level_2", "adore_dialog_mobile_size_level_3");
- }
- }
- else {
- if (this.resetDialogSize("adore_dialog_size_level_1", "adore_dialog_size_level_2")) {
- this.resetDialogSize("adore_dialog_size_level_2", "adore_dialog_size_level_3");
- }
- }
- $(MessageDialog.TemplateOverlay).attr("id", this.id + "_overlay").appendTo(document.body);
- WidgetUtil_1.WidgetUtil.refreshDialogZIndex(this.$thisNode[0]);
- if (btns.length !== 0) {
- $(btns[index]).focus();
- }
- this.clickListener = function (e) {
- own.handleClick(e);
- };
- $(document).on("click", this.clickListener);
- };
- MessageDialog.prototype.handleKeydown = function (e) {
- var btns = this.$thisNode.find("div.modal-footer").find("a").reverse();
- if (e.keyCode === Keys_1.Keys.TAB || e.keyCode === Keys_1.Keys.DOWN_ARROW || e.keyCode === Keys_1.Keys.RIGHT_ARROW) {
- this.currentFocusIndex++;
- if (this.currentFocusIndex >= btns.length) {
- this.currentFocusIndex = 0;
- }
- $(btns[this.currentFocusIndex]).focus();
- e.preventDefault();
- }
- else if (e.keyCode === Keys_1.Keys.LEFT_ARROW || e.keyCode === Keys_1.Keys.UP_ARROW) {
- this.currentFocusIndex--;
- if (this.currentFocusIndex < 0) {
- this.currentFocusIndex = btns.length - 1;
- }
- $(btns[this.currentFocusIndex]).focus();
- e.preventDefault();
- }
- else if (e.keyCode === Keys_1.Keys.ENTER) {
- if (this.currentFocusIndex >= 0 && this.currentFocusIndex < btns.length) {
- $(btns[this.currentFocusIndex]).click();
- }
- e.preventDefault();
- }
- };
- MessageDialog.prototype.handleClick = function (e) {
- var btns = this.$thisNode.find("div.modal-footer").find("a");
- if (!btns.is(this)) {
- this.currentFocusIndex = -1;
- }
- };
- MessageDialog.prototype.wrapBlockLocation = function () {
- this.$wrapMessage.find(".myclass").css({
- "width": this.$thisNode.width(),
- "height": this.$thisNode.height(),
- "left": this.$thisNode.offset().left,
- "top": this.$thisNode.offset().top
- });
- };
- MessageDialog.prototype.resetDialogSize = function (removeClass, addClass) {
- var titleH = this.$thisNode.find("div.adore_dialog_title").height();
- var footerH = this.$footerNode.height();
- var contentH = this.$contentNode.height();
- var totalH = $("#" + this.id).height();
- var contentCanUseH = totalH - titleH - footerH;
- if (contentH >= contentCanUseH) {
- this.$thisNode.removeClass(removeClass).addClass(addClass);
- return true;
- }
- return false;
- };
- MessageDialog.prototype.dispose = function () {
- $("#" + this.id + "_overlay").remove();
- if (this.clickListener) {
- $(document).off("click", this.clickListener);
- }
- if (this.resizeListener) {
- $(window).off("resize", this.resizeListener);
- }
- _super.prototype.dispose.call(this);
- this.$wrapMessage.remove();
- };
- MessageDialog.prototype.handleKeyUpEvent = function (e) {
- };
- MessageDialog.prototype.handleKeyDownEvent = function (e, hasFilter) {
- this.handleKeydown(e);
- };
- MessageDialog.prototype.setInputType = function (args) {
- this.type = 2;
- var initialText = args.initialText;
- var $modalContent = this.$contentNode.parent();
- var $input = $("<input></input>");
- $input.val(initialText + "");
- $input.appendTo($modalContent);
- };
- MessageDialog.prototype.setComboType = function (args) {
- this.type = 1;
- var data = args.combo;
- var initialText = data.initialText;
- var comboArr = data.comboArr;
- if (!comboArr || comboArr.length === 0) {
- return;
- }
- var $t = $("<select></select>");
- for (var i = 0; i < comboArr.length; i++) {
- var option = $("<option></option>").text(comboArr[i] + "");
- if (initialText === comboArr[i]) {
- option.prop("selected", true);
- }
- option.appendTo($t);
- }
- $t.appendTo(this.$contentNode.parent());
- };
- 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>";
- MessageDialog.TemplateWrap = "\n\t <div class=\"messageWrap\">\n\t <iframe class=\"myclass\"></iframe><div class=\"messageWrap\"></div>\n </div>";
- MessageDialog.TemplateButton = "<a href=\"#\" class=\"waves-effect btn-flat modal-action modal-close adore_dialog_btn\">Ok</a>";
- MessageDialog.TemplateOverlay = "<div class=\"adore_lean_overlay\"></div>";
- 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 ";
- return MessageDialog;
- }(Widget_1.Widget));
- exports.MessageDialog = MessageDialog;
- });
- define("layout/Layout", ["require", "exports"], function (require, exports) {
- "use strict";
- var Layout = (function () {
- function Layout(composite) {
- this.composite = composite;
- }
- Layout.prototype.dispose = function () { };
- return Layout;
- }());
- exports.Layout = Layout;
- });
- define("layout/HeaderFooterLayoutData", ["require", "exports"], function (require, exports) {
- "use strict";
- var HeaderFooterLayoutData = (function () {
- function HeaderFooterLayoutData(args) {
- this.style = args.style;
- this.height = args.height;
- }
- HeaderFooterLayoutData.Style = {
- HEADER: 1,
- FOOTER: 2,
- BODY: 3
- };
- return HeaderFooterLayoutData;
- }());
- exports.HeaderFooterLayoutData = HeaderFooterLayoutData;
- });
- define("layout/HeaderFooterLayout", ["require", "exports", "widget/Composite", "layout/Layout", "layout/HeaderFooterLayoutData"], function (require, exports, Composite_1, Layout_1, HeaderFooterLayoutData_1) {
- "use strict";
- var HeaderFooterLayout = (function (_super) {
- __extends(HeaderFooterLayout, _super);
- function HeaderFooterLayout(composite, layoutOrientation, hiddenFooter) {
- _super.call(this, composite);
- this.layoutOrientation = HeaderFooterLayout.LayoutOrientation.VERTICAL;
- this.hiddenFooter = false;
- this.layoutOrientation = layoutOrientation;
- this.hiddenFooter = hiddenFooter;
- }
- HeaderFooterLayout.prototype.selectChildren = function () {
- for (var _i = 0, _a = this.composite.children; _i < _a.length; _i++) {
- var child = _a[_i];
- if (child.getId().indexOf("FloatPanelComposite") !== -1) {
- child.append();
- continue;
- }
- if (!(child instanceof Composite_1.Composite) || !(child.layoutData instanceof HeaderFooterLayoutData_1.HeaderFooterLayoutData)) {
- continue;
- }
- var layoutData = child.layoutData;
- if (!this.header && layoutData.style === HeaderFooterLayoutData_1.HeaderFooterLayoutData.Style.HEADER) {
- this.header = child;
- }
- else if (!this.footer && layoutData.style === HeaderFooterLayoutData_1.HeaderFooterLayoutData.Style.FOOTER) {
- this.footer = child;
- }
- else if (!this.body && layoutData.style === HeaderFooterLayoutData_1.HeaderFooterLayoutData.Style.BODY) {
- this.body = child;
- }
- }
- };
- HeaderFooterLayout.prototype.horizontalLayout = function () {
- var own = this;
- var headerWidth = 0;
- var footerWidth = 0;
- if (this.header) {
- headerWidth = this.header.layoutData.height;
- this.header.$thisNode.css({
- position: "absolute",
- height: "100%",
- width: headerWidth + "px"
- });
- this.header.append();
- }
- if (this.footer) {
- footerWidth = this.footer.layoutData.height;
- this.footer.$thisNode.css({
- position: "absolute",
- height: "100%",
- width: footerWidth + "px",
- bottom: "0px",
- top: "0px",
- right: "0px",
- transition: "width 0.4s"
- });
- this.footer.append();
- }
- if (this.body) {
- this.body.$thisNode.css({
- position: "absolute",
- top: 0,
- bottom: 0,
- left: headerWidth + "px",
- right: footerWidth + "px",
- transition: "width 0.4s"
- });
- this.body.append();
- }
- own.horizontalSizeChangeListener = function () {
- own.body.$thisNode.css({
- width: own.composite.$thisNode.get(0).clientWidth - own.header.$thisNode.get(0).clientWidth
- - own.footer.$thisNode.get(0).clientWidth + "px"
- });
- };
- $(window).on("resize", own.horizontalSizeChangeListener);
- };
- HeaderFooterLayout.prototype.verticalLayout = function () {
- var own = this;
- var headerHeight = 0;
- var footerHeight = 0;
- if (this.header) {
- headerHeight = this.header.layoutData.height;
- this.header.$thisNode.css({
- position: "absolute",
- width: "100%",
- height: headerHeight + "px"
- });
- this.header.append();
- }
- if (this.footer) {
- footerHeight = this.footer.layoutData.height;
- this.footer.$thisNode.css({
- position: "absolute",
- width: "100%",
- height: footerHeight + "px",
- bottom: "0px",
- left: "0px",
- right: "0px",
- transition: "height 0.4s"
- });
- this.footer.append();
- }
- if (this.body) {
- this.body.$thisNode.css({
- position: "absolute",
- left: 0,
- right: 0,
- top: headerHeight + "px",
- bottom: footerHeight + "px",
- transition: "height 0.4s"
- });
- this.body.append();
- }
- };
- HeaderFooterLayout.prototype.layout = function () {
- var css = this.composite.$thisNode.get(0).style;
- if (!css.position || css.position === "" || css.position === "static") {
- css.position = "relative";
- }
- this.selectChildren();
- if (this.layoutOrientation === HeaderFooterLayout.LayoutOrientation.HORIZONTAL) {
- this.horizontalLayout();
- }
- else {
- this.verticalLayout();
- }
- this.handleHiddenFooter();
- };
- HeaderFooterLayout.prototype.dispose = function () {
- if (this.headerMutationObserver) {
- this.headerMutationObserver.disconnect();
- }
- if (this.footerMutationObserver) {
- this.footerMutationObserver.disconnect();
- }
- $(window).off("resize", this.horizontalSizeChangeListener);
- };
- HeaderFooterLayout.prototype.toString = function () {
- return "HeaderFooterLayout";
- };
- HeaderFooterLayout.prototype.handleHiddenFooter = function () {
- if (this.hiddenFooter && this.footer && this.body) {
- var hideFooterButton_1 = $("<div class='adore_footer_hide_button waves-effect waves-light large mdi-content-clear'></div>");
- var showFooterButton_1 = $("<img src='images/layout/showFooterIcon.png' class='adore_footer_show_button waves-effect waves-light'></img>");
- var isVertical_1 = true;
- if (this.layoutOrientation === HeaderFooterLayout.LayoutOrientation.HORIZONTAL) {
- isVertical_1 = false;
- }
- hideFooterButton_1.css({
- transition: "opacity 0.2s,visibility 0.2s"
- });
- showFooterButton_1.css({
- transition: "opacity 0.2s,visibility 0.2s"
- });
- var own_1 = this;
- hideFooterButton_1.on("click", function () {
- own_1.hideFooter(hideFooterButton_1, showFooterButton_1, isVertical_1);
- });
- showFooterButton_1.on("click", function () {
- own_1.showFooter(hideFooterButton_1, showFooterButton_1, isVertical_1);
- });
- this.footer.$thisNode.append(hideFooterButton_1);
- this.composite.$thisNode.append(showFooterButton_1);
- this.hideFooter(hideFooterButton_1, showFooterButton_1, isVertical_1);
- }
- };
- HeaderFooterLayout.prototype.hideFooter = function (hideFooterButton, showFooterButton, isVertical) {
- hideFooterButton.css({
- visibility: "hidden",
- opacity: 0
- });
- showFooterButton.css({
- visibility: "visible",
- opacity: 1
- });
- var footerWidthOrHeight = this.footer.layoutData.height;
- if (isVertical) {
- this.footer.$thisNode.css({
- height: 0
- });
- this.body.$thisNode.css({
- height: this.composite.$thisNode.get(0).clientHeight - this.header.$thisNode.get(0).clientHeight + "px"
- });
- }
- else {
- this.footer.$thisNode.css({
- width: 0
- });
- this.body.$thisNode.css({
- width: this.composite.$thisNode.get(0).clientWidth - this.header.$thisNode.get(0).clientWidth + "px"
- });
- }
- };
- HeaderFooterLayout.prototype.showFooter = function (hideFooterButton, showFooterButton, isVertical) {
- hideFooterButton.css({
- visibility: "visible",
- opacity: 1
- });
- showFooterButton.css({
- visibility: "hidden",
- opacity: 0
- });
- var footerWidthOrHeight = this.footer.layoutData.height;
- if (isVertical) {
- this.footer.$thisNode.css({
- height: footerWidthOrHeight + "px"
- });
- this.body.$thisNode.css({
- height: this.composite.$thisNode.get(0).clientHeight - this.header.$thisNode.get(0).clientHeight -
- footerWidthOrHeight + "px"
- });
- }
- else {
- this.footer.$thisNode.css({
- width: footerWidthOrHeight + "px"
- });
- this.body.$thisNode.css({
- width: this.composite.$thisNode.get(0).clientWidth - this.header.$thisNode.get(0).clientWidth -
- footerWidthOrHeight + "px"
- });
- }
- };
- HeaderFooterLayout.LayoutOrientation = {
- VERTICAL: 0,
- HORIZONTAL: 1
- };
- return HeaderFooterLayout;
- }(Layout_1.Layout));
- exports.HeaderFooterLayout = HeaderFooterLayout;
- });
- define("layout/RowGridLayoutData", ["require", "exports"], function (require, exports) {
- "use strict";
- var RowGridLayoutData = (function () {
- function RowGridLayoutData(args) {
- this.s = args.s;
- this.m = args.m;
- this.l = args.l;
- this.os = args.os;
- this.om = args.om;
- this.ol = args.ol;
- this.row = args.row;
- }
- RowGridLayoutData.prototype.getColumn = function () {
- return "s" + this.s + " m" + this.m + " l" + this.l;
- };
- RowGridLayoutData.prototype.getOffset = function () {
- return "offset-s" + this.os + " offset-m" + this.om + " offset-l" + this.ol;
- };
- return RowGridLayoutData;
- }());
- exports.RowGridLayoutData = RowGridLayoutData;
- });
- define("layout/RowGridLayout", ["require", "exports", "widget/Composite", "layout/Layout", "layout/RowGridLayoutData"], function (require, exports, Composite_2, Layout_2, RowGridLayoutData_1) {
- "use strict";
- var RowGridLayout = (function (_super) {
- __extends(RowGridLayout, _super);
- function RowGridLayout(composite) {
- _super.call(this, composite);
- }
- RowGridLayout.prototype.toString = function () {
- return "RowGridLayout";
- };
- RowGridLayout.prototype.layout = function () {
- var rowCount = 0;
- for (var _i = 0, _a = this.composite.children; _i < _a.length; _i++) {
- var child = _a[_i];
- var layoutData = child.layoutData;
- if (layoutData instanceof RowGridLayoutData_1.RowGridLayoutData) {
- if (layoutData.row > rowCount) {
- rowCount = layoutData.row;
- }
- }
- }
- var $curRowDivs = [];
- for (var i = 0; i <= rowCount; i++) {
- var rowDiv = $("<div class='row'></div>");
- rowDiv.css("position", "relative");
- $curRowDivs.push(rowDiv);
- }
- $curRowDivs[rowCount].css("marginBottom", "0px");
- for (var _b = 0, _c = this.composite.children; _b < _c.length; _b++) {
- var child = _c[_b];
- var layoutData = child.layoutData;
- if (layoutData instanceof RowGridLayoutData_1.RowGridLayoutData) {
- if (child.getId().indexOf("FloatPanelComposite") !== -1) {
- child.append();
- continue;
- }
- var column = layoutData.getColumn();
- var offset = layoutData.getOffset();
- var row = layoutData.row;
- var style = column + " col " + offset;
- child.$thisNode.addClass(style);
- if (child instanceof Composite_2.Composite) {
- child.$thisNode.css({
- position: "relative"
- });
- }
- child.$thisNode.appendTo($curRowDivs[row]);
- }
- }
- if (this.$rowDivs) {
- for (var _d = 0, _e = this.$rowDivs; _d < _e.length; _d++) {
- var $rowDiv = _e[_d];
- $rowDiv.remove();
- }
- }
- this.$rowDivs = $curRowDivs;
- for (var i = 0; i <= rowCount; i++) {
- this.$rowDivs[i].appendTo(this.composite.$attachNode);
- }
- };
- return RowGridLayout;
- }(Layout_2.Layout));
- exports.RowGridLayout = RowGridLayout;
- });
- define("layout/FillLayout", ["require", "exports", "layout/Layout"], function (require, exports, Layout_3) {
- "use strict";
- var FillLayout = (function (_super) {
- __extends(FillLayout, _super);
- function FillLayout(composite) {
- _super.call(this, composite);
- }
- FillLayout.prototype.layout = function () {
- for (var _i = 0, _a = this.composite.children; _i < _a.length; _i++) {
- var child = _a[_i];
- child.$thisNode.css({
- position: "absolute",
- top: 0,
- bottom: 0,
- left: 0,
- right: 0
- });
- child.append();
- }
- };
- FillLayout.prototype.toString = function () {
- return "FillLayout";
- };
- return FillLayout;
- }(Layout_3.Layout));
- exports.FillLayout = FillLayout;
- });
- define("widget/CollapseButton", ["require", "exports", "widget/Widget", "util/WidgetManager"], function (require, exports, Widget_2, WidgetManager_1) {
- "use strict";
- var CollapseButton = (function (_super) {
- __extends(CollapseButton, _super);
- function CollapseButton(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.$thisNode = $(CollapseButton.Template).attr("id", id);
- }
- CollapseButton.prototype.bindSideNav = function (args) {
- var sideNavComposite = WidgetManager_1.WidgetManager.byId(args.sideNavId);
- var parentComposite = sideNavComposite.parent;
- var sideNavLayout = parentComposite.layout_;
- sideNavLayout.setCollapseButton(this);
- };
- CollapseButton.Template = "<a href=\"#\" class=\"button-collapse\"><i class=\"mdi-navigation-menu\" style=\"font-size:3rem;\"></i></a>";
- return CollapseButton;
- }(Widget_2.Widget));
- exports.CollapseButton = CollapseButton;
- });
- define("layout/SideNav", ["require", "exports"], function (require, exports) {
- "use strict";
- var SideNav = (function () {
- function SideNav() {
- this.panning = false;
- this.menuOut = false;
- }
- SideNav.prototype.removeMenu = function (restoreNav) {
- var _this = this;
- this.panning = false;
- this.menuOut = false;
- $("body").css({
- overflow: "",
- width: ""
- });
- $("#sidenav-overlay").velocity({ opacity: 0 }, {
- duration: 200,
- queue: false, easing: "easeOutQuad",
- complete: function () {
- $(this).remove();
- }
- });
- if (this.options.edge === "left") {
- this.$dragTarget.css({ width: "", right: "", left: "0" });
- this.$nav.velocity({ "translateX": "-100%" }, {
- duration: 200,
- queue: false,
- easing: "easeOutCubic",
- complete: function () {
- if (restoreNav === true) {
- _this.$nav.removeAttr("style");
- _this.$nav.css("width", _this.options.width);
- }
- }
- });
- }
- else {
- this.$dragTarget.css({ width: "", right: "0", left: "" });
- this.$nav.velocity({ "translateX": "100%" }, {
- duration: 200,
- queue: false,
- easing: "easeOutCubic",
- complete: function () {
- if (restoreNav === true) {
- _this.$nav.removeAttr("style");
- _this.$nav.css({
- "position": "absolute",
- "left": "calc(100% - " + _this.options.width + "px)",
- "right": 0, "width": _this.options.width
- });
- }
- }
- });
- }
- };
- SideNav.prototype.onPan = function (e) {
- if (e.gesture.pointerType === "touch") {
- var direction = e.gesture.direction;
- var x = e.gesture.center.x;
- var y = e.gesture.center.y;
- var velocityX = e.gesture.velocityX;
- var $body = $("body");
- var oldWidth = $body.innerWidth();
- $body.css("overflow", "hidden");
- $body.width(oldWidth);
- if ($("#sidenav-overlay").length === 0) {
- var overlay = $("<div id=\"sidenav-overlay\"></div>");
- overlay.css("opacity", 0).click(function () {
- this.removeMenu(false);
- });
- $("body").append(overlay);
- }
- if (this.options.edge === "left") {
- if (x > this.options.width) {
- x = this.options.width;
- }
- else if (x < 0) {
- x = 0;
- }
- }
- if (this.options.edge === "left") {
- if (x < (this.options.width / 2)) {
- this.menuOut = false;
- }
- else if (x >= (this.options.width / 2)) {
- this.menuOut = true;
- }
- this.$nav.css("transform", "translateX(" + (x - this.options.width) + "px)");
- }
- else {
- if (x < (window.innerWidth - this.options.width / 2)) {
- this.menuOut = true;
- }
- else if (x >= (window.innerWidth - this.options.width / 2)) {
- this.menuOut = false;
- }
- var rightPos = (x - this.options.width / 2);
- if (rightPos < 0) {
- rightPos = 0;
- }
- this.$nav.css("transform", "translateX(" + rightPos + "px)");
- }
- var overlayPerc = void 0;
- if (this.options.edge === "left") {
- overlayPerc = x / this.options.width;
- $("#sidenav-overlay").velocity({ opacity: overlayPerc }, { duration: 10, queue: false, easing: "easeOutQuad" });
- }
- else {
- overlayPerc = Math.abs((x - window.innerWidth) / this.options.width);
- $("#sidenav-overlay").velocity({ opacity: overlayPerc }, { duration: 10, queue: false, easing: "easeOutQuad" });
- }
- }
- };
- SideNav.prototype.onPanend = function (e) {
- if (e.gesture.pointerType === "touch") {
- var velocityX = e.gesture.velocityX;
- var x = e.gesture.center.x;
- var leftPos = x - this.options.width;
- var rightPos = x - this.options.width / 2;
- if (leftPos > 0) {
- leftPos = 0;
- }
- if (rightPos < 0) {
- rightPos = 0;
- }
- this.panning = false;
- if (this.options.edge === "left") {
- if ((this.menuOut && velocityX <= 0.3) || velocityX < -0.5) {
- if (leftPos !== 0) {
- this.$nav.velocity({ "translateX": [0, leftPos] }, { duration: 300, queue: false, easing: "easeOutQuad" });
- }
- $("#sidenav-overlay").velocity({ opacity: 1 }, { duration: 50, queue: false, easing: "easeOutQuad" });
- this.$dragTarget.css({ width: "50%", right: 0, left: "" });
- }
- else if (!this.menuOut || velocityX > 0.3) {
- $("body").css({
- overflow: "",
- width: ""
- });
- this.$nav.velocity({ "translateX": [-1 * this.options.width - 10, leftPos] }, { duration: 200, queue: false, easing: "easeOutQuad" });
- $("#sidenav-overlay").velocity({ opacity: 0 }, {
- duration: 200, queue: false, easing: "easeOutQuad",
- complete: function () {
- $(this).remove();
- }
- });
- this.$dragTarget.css({ width: "10px", right: "", left: 0 });
- }
- }
- else {
- if ((this.menuOut && velocityX >= -0.3) || velocityX > 0.5) {
- this.$nav.velocity({ "translateX": [0, rightPos] }, { duration: 300, queue: false, easing: "easeOutQuad" });
- $("#sidenav-overlay").velocity({ opacity: 1 }, { duration: 50, queue: false, easing: "easeOutQuad" });
- this.$dragTarget.css({ width: "50%", right: "", left: 0 });
- }
- else if (!this.menuOut || velocityX < -0.3) {
- $("body").css({
- overflow: "",
- width: ""
- });
- this.$nav.velocity({ "translateX": [this.options.width + 10, rightPos] }, { duration: 200, queue: false, easing: "easeOutQuad" });
- $("#sidenav-overlay").velocity({ opacity: 0 }, {
- duration: 200, queue: false, easing: "easeOutQuad",
- complete: function () {
- $(this).remove();
- }
- });
- this.$dragTarget.css({ width: "10px", right: 0, left: "" });
- }
- }
- }
- };
- SideNav.prototype.onResize = function (e) {
- if (window.innerWidth > 992) {
- if ($("#sidenav-overlay").length !== 0 && this.menuOut) {
- this.removeMenu(true);
- }
- else {
- this.$nav.css("transform", "translateX(0%)");
- }
- }
- else if (this.menuOut === false) {
- if (this.options.edge === "left") {
- this.$nav.css("transform", "translateX(-100%)");
- }
- else {
- this.$nav.css("transform", "translateX(100%)");
- }
- }
- this.refreshCollapseButton();
- };
- SideNav.prototype.init = function (nav_id, options) {
- var _this = this;
- var defaults = {
- width: 240,
- edge: "left",
- closeOnClick: false
- };
- this.options = $.extend(defaults, options);
- this.$nav = $("#" + nav_id);
- this.$dragTarget = $("<div class=\"drag-target\"></div>");
- $("body").append(this.$dragTarget);
- if (options.edge === "left") {
- this.$nav.css("transform", "translateX(-100%)");
- this.$dragTarget.css({ "left": 0 });
- }
- else {
- this.$nav.css({
- "transform": "translateX(100%)", "position": "absolute",
- "left": "calc(100% - " + this.options.width + "px)",
- "right": 0
- });
- this.$dragTarget.css({ "right": 0 });
- }
- if (this.$nav.hasClass("fixed")) {
- if (window.innerWidth > 992) {
- this.$nav.css("transform", "translateX(0)");
- }
- }
- this.refreshCollapseButton();
- if (this.$nav.hasClass("fixed")) {
- this.onResizeListener = function (e) { return _this.onResize(e); };
- $(window).on("resize", this.onResizeListener);
- }
- if (options.closeOnClick === true) {
- this.$nav.on("click.itemclick", "a:not(.collapsible-header)", function () { return _this.removeMenu(false); });
- }
- this.$dragTarget.on("click", function () { return _this.removeMenu(false); });
- this.$dragTarget.hammer({
- prevent_default: false
- }).bind("pan", function (e) { return _this.onPan(e); }).bind("panend", function (e) { return _this.onPanend(e); });
- };
- SideNav.prototype.show = function () {
- var _this = this;
- if (this.menuOut === true) {
- this.menuOut = false;
- this.panning = false;
- this.removeMenu(false);
- }
- else {
- var $body = $("body");
- var oldWidth = $body.innerWidth();
- $body.css("overflow", "hidden");
- $body.width(oldWidth);
- $("body").append(this.$dragTarget);
- if (this.options.edge === "left") {
- this.$dragTarget.css({ width: "50%", right: 0, left: "" });
- this.$nav.velocity({ "translateX": [0, -1 * this.options.width] }, { duration: 300, queue: false, easing: "easeOutQuad" });
- }
- else {
- this.$dragTarget.css({ width: "50%", right: "", left: 0 });
- this.$nav.velocity({ "translateX": [0, this.options.width] }, { duration: 300, queue: false, easing: "easeOutQuad" });
- }
- var overlay_1 = $("<div id=\"sidenav-overlay\"></div>");
- overlay_1.css("opacity", 0);
- overlay_1.click(function () {
- _this.menuOut = false;
- _this.panning = false;
- _this.removeMenu(false);
- overlay_1.velocity({ opacity: 0 }, {
- duration: 300, queue: false, easing: "easeOutQuad",
- complete: function () {
- overlay_1.remove();
- overlay_1 = null;
- }
- });
- });
- $("body").append(overlay_1);
- overlay_1.velocity({ opacity: 1 }, {
- duration: 300, queue: false, easing: "easeOutQuad",
- complete: function () {
- _this.menuOut = true;
- _this.panning = false;
- }
- });
- }
- };
- SideNav.prototype.hide = function () {
- $("#sidenav-overlay").trigger("click");
- };
- SideNav.prototype.bind = function ($button) {
- var _this = this;
- this.$button = $button;
- this.$button.click(function () {
- _this.show();
- return false;
- });
- this.refreshCollapseButton();
- };
- SideNav.prototype.refreshCollapseButton = function () {
- if (this.$button) {
- if (window.innerWidth > 992) {
- this.$button.css({ "visibility": "hidden", "opacity": "0" });
- }
- else {
- this.$button.css({ "visibility": "visible", "opacity": "1" });
- }
- }
- };
- SideNav.prototype.dispose = function () {
- if (this.onResizeListener) {
- $(window).off("resize", this.onResizeListener);
- }
- if (this.$dragTarget) {
- this.$dragTarget.remove();
- if (this.$dragTarget.data("hammer")) {
- this.$dragTarget.data("hammer").destroy();
- }
- }
- $("#sidenav-overlay").remove();
- };
- return SideNav;
- }());
- exports.SideNav = SideNav;
- });
- define("layout/SideNavLayoutData", ["require", "exports"], function (require, exports) {
- "use strict";
- var SideNavLayoutData = (function () {
- function SideNavLayoutData(args) {
- this.direction = args.direction;
- this.width = args.width;
- this.collapseButtonId = args.collapseButtonId;
- }
- SideNavLayoutData.NONE = 0;
- SideNavLayoutData.LEFT = 1;
- SideNavLayoutData.RIGHT = 2;
- return SideNavLayoutData;
- }());
- exports.SideNavLayoutData = SideNavLayoutData;
- });
- define("layout/SideNavLayout", ["require", "exports", "layout/Layout", "layout/SideNav", "layout/SideNavLayoutData"], function (require, exports, Layout_4, SideNav_1, SideNavLayoutData_1) {
- "use strict";
- var SideNavLayout = (function (_super) {
- __extends(SideNavLayout, _super);
- function SideNavLayout(composite) {
- _super.call(this, composite);
- this.hadBindedCollapse = false;
- }
- SideNavLayout.prototype.setCollapseButton = function (collapseButton) {
- this.collapseButton = collapseButton;
- this.bindCollapseButton();
- };
- SideNavLayout.prototype.bindCollapseButton = function () {
- if (!this.hadBindedCollapse && this.sideNav && this.collapseButton) {
- this.sideNav.bind(this.collapseButton.$thisNode);
- this.hadBindedCollapse = true;
- }
- };
- SideNavLayout.prototype.layout = function () {
- var navChild = null;
- var contentChild = null;
- var navLayoutData = null;
- for (var _i = 0, _a = this.composite.children; _i < _a.length; _i++) {
- var child = _a[_i];
- var direction = child.layoutData.direction;
- if (!navChild && direction !== SideNavLayoutData_1.SideNavLayoutData.NONE) {
- navChild = child;
- navLayoutData = child.layoutData;
- }
- else if (!contentChild && direction === SideNavLayoutData_1.SideNavLayoutData.NONE) {
- contentChild = child;
- }
- }
- contentChild.$thisNode.css({
- position: "absolute",
- left: 0,
- right: 0,
- top: 0,
- bottom: 0
- });
- this.$nav = $("<div class=\"side-nav fixed\" id=\"slide-out\"></div>");
- this.$nav.css("width", navLayoutData.width);
- this.$content = $("<div></div>");
- this.$content.css({
- position: "absolute",
- left: 0,
- right: 0,
- top: 0,
- bottom: 0
- });
- navChild.$thisNode.appendTo(this.$nav);
- contentChild.$thisNode.appendTo(this.$content);
- this.$nav.appendTo(this.composite.$attachNode);
- this.$content.appendTo(this.composite.$attachNode);
- this.sideNav = new SideNav_1.SideNav();
- this.bindCollapseButton();
- this.sideNav.init("slide-out", {
- width: navLayoutData.width,
- edge: navLayoutData.direction === SideNavLayoutData_1.SideNavLayoutData.LEFT ? "left" : "right"
- });
- this.mediaQueryList = window.matchMedia("only screen and (max-width : 992px)");
- var own = this;
- this.mediaQueryListener = function (mql) {
- if (mql.matches) {
- if (navLayoutData.direction === SideNavLayoutData_1.SideNavLayoutData.LEFT) {
- own.$content.css("left", 0);
- }
- else {
- own.$content.css("right", 0);
- }
- }
- else {
- if (navLayoutData.direction === SideNavLayoutData_1.SideNavLayoutData.LEFT) {
- own.$content.css("left", navLayoutData.width + "px");
- }
- else {
- own.$content.css("right", navLayoutData.width + "px");
- }
- }
- };
- this.mediaQueryList.addListener(this.mediaQueryListener);
- this.mediaQueryListener(this.mediaQueryList);
- };
- SideNavLayout.prototype.toString = function () {
- return "SideNavLayout";
- };
- SideNavLayout.prototype.dispose = function () {
- if (this.mediaQueryList && this.mediaQueryListener) {
- this.mediaQueryList.removeListener(this.mediaQueryListener);
- }
- if (this.sideNav) {
- this.sideNav.dispose();
- }
- if (this.$nav) {
- this.$nav.remove();
- }
- if (this.$content) {
- this.$content.remove();
- }
- };
- return SideNavLayout;
- }(Layout_4.Layout));
- exports.SideNavLayout = SideNavLayout;
- });
- 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) {
- "use strict";
- var Composite = (function (_super) {
- __extends(Composite, _super);
- function Composite(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.children = new Array();
- this.$thisNode = $("<div>").attr("id", this.id);
- this.$attachNode = this.$thisNode;
- if ((this.style & ADORE_1.ADORE.Control) === ADORE_1.ADORE.Control)
- this.$thisNode.css({
- position: "absolute",
- top: "48px",
- bottom: "0px",
- overflow: "hidden",
- right: "0",
- left: "0"
- });
- if ((this.style & ADORE_1.ADORE.CardPanel) === ADORE_1.ADORE.CardPanel) {
- this.$thisNode.addClass("card-panel");
- }
- if ((this.style & ADORE_1.ADORE.Scrollable) === ADORE_1.ADORE.Scrollable) {
- this.$thisNode.css("overflow", "auto");
- }
- }
- Composite.prototype.setFocus = function () {
- };
- Composite.prototype.setLayout = function (args) {
- if (this.layout_) {
- return;
- }
- var layout = args.layout;
- var type = layout.type;
- if (type === "RowGridLayout") {
- this.layout_ = new RowGridLayout_1.RowGridLayout(this);
- }
- else if (type === "HeaderFooterLayout") {
- this.layout_ = new HeaderFooterLayout_1.HeaderFooterLayout(this, layout.layoutOrientation, layout.hiddenFooter);
- }
- else if (type === "FillLayout") {
- this.layout_ = new FillLayout_1.FillLayout(this);
- }
- else if (type === "SideNavLayout") {
- this.layout_ = new SideNavLayout_1.SideNavLayout(this);
- }
- };
- Composite.prototype.layout = function () {
- this.doLayout();
- if (this.content) {
- this.setContentView({ content: this.content, script: this.script });
- }
- };
- Composite.prototype.doLayout = function () {
- if (!this.parent) {
- if (this.id.indexOf("Composite") !== -1) {
- this.$thisNode.css({
- "height": "100vh",
- "width": "100vw"
- });
- }
- this.$thisNode.appendTo(document.body);
- }
- if (!this.layout_) {
- return;
- }
- this.layout_.layout();
- for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
- var child = _a[_i];
- child.postLayout();
- }
- };
- Composite.prototype.setBackgroundImage = function (args) {
- this.backgroundImage = args.src;
- this.$thisNode.find("#" + this.id + "_img").remove();
- $("<img>").addClass("adore_background_image").attr({
- src: this.backgroundImage,
- id: this.id + "_img"
- }).prependTo(this.$thisNode);
- if (this.imageZIndex === 0 || this.imageZIndex) {
- this.setBackgroundImageZIndex({ "imageZIndex": this.imageZIndex });
- }
- };
- Composite.prototype.setBackgroundImageZIndex = function (args) {
- this.imageZIndex = args.imageZIndex;
- this.$thisNode.find("#" + this.id + "_img").css("z-index", this.imageZIndex);
- };
- Composite.prototype.setImageInDiv = function (args) {
- this.divImage = args.divImageSrc;
- if (this.$thisNode) {
- this.$thisNode.css("background-image", "url(" + this.divImage + ")");
- this.$thisNode.css("background-repeat", "round");
- }
- };
- Composite.prototype.setContentView = function (args) {
- var _this = this;
- this.content = args.content;
- this.script = args.script;
- if (this.$attachNode) {
- if (this.script && this.script.trim()) {
- var scriptArr = this.script.trim().split("\n");
- require(scriptArr, function () {
- _this.$attachNode.html(args.content);
- });
- }
- else {
- this.$attachNode.html(args.content);
- }
- }
- };
- Composite.prototype.addChild = function (child) {
- this.children.push(child);
- };
- Composite.prototype.dispose = function () {
- if (this.layout_) {
- this.layout_.dispose();
- }
- _super.prototype.dispose.call(this);
- };
- Composite.prototype.handleMouseDownEvent = function (e) {
- };
- Composite.prototype.handleMouseUpEvent = function (e) {
- };
- return Composite;
- }(Widget_3.Widget));
- exports.Composite = Composite;
- });
- define("hotkey/KeystrokeGenerator", ["require", "exports", "hotkey/Keys"], function (require, exports, Keys_2) {
- "use strict";
- var KeystrokeGenerator = (function () {
- function KeystrokeGenerator() {
- }
- KeystrokeGenerator.generateKeyStroke = function (e) {
- var stroke = "";
- var ctrlKey = e.ctrlKey;
- stroke = ctrlKey ? stroke + "CTRL+" : stroke;
- var shiftKey = e.shiftKey;
- stroke = shiftKey ? stroke + "SHIFT+" : stroke;
- var altKey = e.altKey;
- stroke = altKey ? stroke + "ALT+" : stroke;
- switch (e.keyCode) {
- case Keys_2.Keys.BACKSPACE:
- stroke = stroke + "BS";
- break;
- case Keys_2.Keys.TAB:
- stroke = stroke + "TAB";
- break;
- case Keys_2.Keys.CLEAR:
- stroke = stroke + "CLEAR";
- break;
- case Keys_2.Keys.ENTER:
- stroke = stroke + "CR";
- break;
- case Keys_2.Keys.CAPS_LOCK:
- stroke = stroke + "CAPS";
- break;
- case Keys_2.Keys.ESCAPE:
- stroke = stroke + "ESC";
- break;
- case Keys_2.Keys.SPACE:
- stroke = stroke + "SPACE";
- break;
- case Keys_2.Keys.PAGE_UP:
- stroke = stroke + "PAGE_UP";
- break;
- case Keys_2.Keys.PAGE_DOWN:
- stroke = stroke + "PAGE_DOWN";
- break;
- case Keys_2.Keys.END:
- stroke = stroke + "END";
- break;
- case Keys_2.Keys.HOME:
- stroke = stroke + "HOME";
- break;
- case Keys_2.Keys.LEFT_ARROW:
- stroke = stroke + "ARROW_LEFT";
- break;
- case Keys_2.Keys.UP_ARROW:
- stroke = stroke + "ARROW_UP";
- break;
- case Keys_2.Keys.RIGHT_ARROW:
- stroke = stroke + "ARROW_RIGHT";
- break;
- case Keys_2.Keys.DOWN_ARROW:
- stroke = stroke + "ARROW_DOWN";
- break;
- case Keys_2.Keys.INSERT:
- stroke = stroke + "INS";
- break;
- case Keys_2.Keys.DELETE:
- stroke = stroke + "DEL";
- break;
- case Keys_2.Keys.HELP:
- stroke = stroke + "HELP";
- break;
- case Keys_2.Keys.LEFT_WINDOW:
- stroke = stroke + "LEFT_WINDOW";
- break;
- case Keys_2.Keys.RIGHT_WINDOW:
- stroke = stroke + "RIGHT_WINDOW";
- break;
- case Keys_2.Keys.SELECT:
- stroke = stroke + "SELECT";
- break;
- case Keys_2.Keys.NUMPAD_0:
- stroke = stroke + "NUMPAD_0";
- break;
- case Keys_2.Keys.NUMPAD_1:
- stroke = stroke + "NUMPAD_1";
- break;
- case Keys_2.Keys.NUMPAD_2:
- stroke = stroke + "NUMPAD_2";
- break;
- case Keys_2.Keys.NUMPAD_3:
- stroke = stroke + "NUMPAD_3";
- break;
- case Keys_2.Keys.NUMPAD_4:
- stroke = stroke + "NUMPAD_4";
- break;
- case Keys_2.Keys.NUMPAD_5:
- stroke = stroke + "NUMPAD_5";
- break;
- case Keys_2.Keys.NUMPAD_6:
- stroke = stroke + "NUMPAD_6";
- break;
- case Keys_2.Keys.NUMPAD_7:
- stroke = stroke + "NUMPAD_7";
- break;
- case Keys_2.Keys.NUMPAD_8:
- stroke = stroke + "NUMPAD_8";
- break;
- case Keys_2.Keys.NUMPAD_9:
- stroke = stroke + "NUMPAD_9";
- break;
- case Keys_2.Keys.NUMPAD_MULTIPLY:
- stroke = stroke + "NUMPAD_MULTIPLY";
- break;
- case Keys_2.Keys.NUMPAD_PLUS:
- stroke = stroke + "NUMPAD_PLUS";
- break;
- case Keys_2.Keys.NUMPAD_ENTER:
- stroke = stroke + "CR";
- break;
- case Keys_2.Keys.NUMPAD_MINUS:
- stroke = stroke + "NUMPAD_MINUS";
- break;
- case Keys_2.Keys.NUMPAD_PERIOD:
- stroke = stroke + "NUMPAD_PERIOD";
- break;
- case Keys_2.Keys.NUMPAD_DIVIDE:
- stroke = stroke + "NUMPAD_DIVIDE";
- break;
- case Keys_2.Keys.F1:
- stroke = stroke + "F1";
- break;
- case Keys_2.Keys.F2:
- stroke = stroke + "F2";
- break;
- case Keys_2.Keys.F3:
- stroke = stroke + "F3";
- break;
- case Keys_2.Keys.F4:
- stroke = stroke + "F4";
- break;
- case Keys_2.Keys.F5:
- stroke = stroke + "F5";
- break;
- case Keys_2.Keys.F6:
- stroke = stroke + "F6";
- break;
- case Keys_2.Keys.F7:
- stroke = stroke + "F7";
- break;
- case Keys_2.Keys.F8:
- stroke = stroke + "F8";
- break;
- case Keys_2.Keys.F9:
- stroke = stroke + "F9";
- break;
- case Keys_2.Keys.F10:
- stroke = stroke + "F10";
- break;
- case Keys_2.Keys.F11:
- stroke = stroke + "F11";
- break;
- case Keys_2.Keys.F12:
- stroke = stroke + "F12";
- break;
- case Keys_2.Keys.F13:
- stroke = stroke + "F13";
- break;
- case Keys_2.Keys.F14:
- stroke = stroke + "F14";
- break;
- case Keys_2.Keys.F15:
- stroke = stroke + "F15";
- break;
- case Keys_2.Keys.NUM_LOCK:
- stroke = stroke + "NUM_LOCK";
- break;
- case Keys_2.Keys.SCROLL_LOCK:
- stroke = stroke + "SCROLL_LOCK";
- break;
- case Keys_2.Keys.UP_DPAD:
- stroke = stroke + "UP_DPAD";
- break;
- case Keys_2.Keys.DOWN_DPAD:
- stroke = stroke + "DOWN_DPAD";
- break;
- case Keys_2.Keys.LEFT_DPAD:
- stroke = stroke + "LEFT_DPAD";
- break;
- case Keys_2.Keys.RIGHT_DPAD:
- stroke = stroke + "RIGHT_DPAD";
- break;
- case Keys_2.Keys.NUM_0:
- stroke = stroke + "0";
- break;
- case Keys_2.Keys.NUM_1:
- stroke = stroke + "1";
- break;
- case Keys_2.Keys.NUM_2:
- stroke = stroke + "2";
- break;
- case Keys_2.Keys.NUM_3:
- stroke = stroke + "3";
- break;
- case Keys_2.Keys.NUM_4:
- stroke = stroke + "4";
- break;
- case Keys_2.Keys.NUM_5:
- stroke = stroke + "5";
- break;
- case Keys_2.Keys.NUM_6:
- stroke = stroke + "6";
- break;
- case Keys_2.Keys.NUM_7:
- stroke = stroke + "7";
- break;
- case Keys_2.Keys.NUM_8:
- stroke = stroke + "8";
- break;
- case Keys_2.Keys.NUM_9:
- stroke = stroke + "9";
- break;
- case Keys_2.Keys.CHAR_A:
- stroke = stroke + "A";
- break;
- case Keys_2.Keys.CHAR_B:
- stroke = stroke + "B";
- break;
- case Keys_2.Keys.CHAR_C:
- stroke = stroke + "C";
- break;
- case Keys_2.Keys.CHAR_D:
- stroke = stroke + "D";
- break;
- case Keys_2.Keys.CHAR_E:
- stroke = stroke + "E";
- break;
- case Keys_2.Keys.CHAR_F:
- stroke = stroke + "F";
- break;
- case Keys_2.Keys.CHAR_G:
- stroke = stroke + "G";
- break;
- case Keys_2.Keys.CHAR_H:
- stroke = stroke + "H";
- break;
- case Keys_2.Keys.CHAR_I:
- stroke = stroke + "I";
- break;
- case Keys_2.Keys.CHAR_J:
- stroke = stroke + "J";
- break;
- case Keys_2.Keys.CHAR_K:
- stroke = stroke + "K";
- break;
- case Keys_2.Keys.CHAR_L:
- stroke = stroke + "L";
- break;
- case Keys_2.Keys.CHAR_M:
- stroke = stroke + "M";
- break;
- case Keys_2.Keys.CHAR_N:
- stroke = stroke + "N";
- break;
- case Keys_2.Keys.CHAR_O:
- stroke = stroke + "O";
- break;
- case Keys_2.Keys.CHAR_P:
- stroke = stroke + "P";
- break;
- case Keys_2.Keys.CHAR_Q:
- stroke = stroke + "Q";
- break;
- case Keys_2.Keys.CHAR_R:
- stroke = stroke + "R";
- break;
- case Keys_2.Keys.CHAR_S:
- stroke = stroke + "S";
- break;
- case Keys_2.Keys.CHAR_T:
- stroke = stroke + "T";
- break;
- case Keys_2.Keys.CHAR_U:
- stroke = stroke + "U";
- break;
- case Keys_2.Keys.CHAR_V:
- stroke = stroke + "V";
- break;
- case Keys_2.Keys.CHAR_W:
- stroke = stroke + "W";
- break;
- case Keys_2.Keys.CHAR_X:
- stroke = stroke + "X";
- break;
- case Keys_2.Keys.CHAR_Y:
- stroke = stroke + "Y";
- break;
- case Keys_2.Keys.CHAR_Z:
- stroke = stroke + "Z";
- break;
- case Keys_2.Keys.SLASH:
- stroke = stroke + "/";
- break;
- default:
- }
- return stroke;
- };
- return KeystrokeGenerator;
- }());
- exports.KeystrokeGenerator = KeystrokeGenerator;
- });
- 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) {
- "use strict";
- var Widget = (function () {
- function Widget(parentId, id, style) {
- this.cssStyle = {};
- this.enabled = true;
- this.visible = true;
- this.id = id;
- this.style = style;
- WidgetManager_2.WidgetManager.register(this);
- if (parentId) {
- this.parent = parentId ? WidgetManager_2.WidgetManager.byId(parentId) : null;
- this.parent.addChild(this);
- }
- }
- Widget.prototype.getId = function () {
- return this.id;
- };
- Widget.prototype.sendFocusGain = function () {
- if (this.enabled) {
- EventHub_2.EventHub.dispatchEvent(MessageType_3.MessageType.WIDGET, { id: this.id, evtType: Event_2.Event.ON_FOCUS });
- }
- };
- Widget.prototype.append = function () {
- if (this.parent) {
- this.$thisNode.appendTo(this.parent.$attachNode);
- }
- else {
- this.$thisNode.appendTo(document.body);
- }
- };
- Widget.prototype.handleMouseDownEvent = function (e) {
- EventHub_2.EventHub.dispatchEvent(MessageType_3.MessageType.WIDGET, {
- id: this.id,
- evtType: Event_2.Event.MOUSE_DOWN,
- button: e.button
- });
- };
- Widget.prototype.handleMouseUpEvent = function (e) {
- EventHub_2.EventHub.dispatchEvent(MessageType_3.MessageType.WIDGET, {
- id: this.id,
- evtType: Event_2.Event.MOUSE_UP,
- button: e.button
- });
- };
- Widget.prototype.handleKeyDownEvent = function (e, hasFilter) {
- var filter = false;
- var keyStroke = KeystrokeGenerator_1.KeystrokeGenerator.generateKeyStroke(e);
- var keyEventObj = {
- id: this.id,
- evtType: Event_2.Event.KEY_DONW,
- altKey: e.altKey,
- shiftKey: e.shiftKey,
- ctrlKey: e.ctrlKey,
- keyCode: e.keyCode,
- keyStroke: keyStroke
- };
- if (e.keyCode === Keys_3.Keys.TAB) {
- e.preventDefault();
- }
- if (hasFilter) {
- filter = EventHub_2.EventHub.dispatchEvent(MessageType_3.MessageType.DISPLAY_FILTER, keyEventObj);
- }
- if (!filter) {
- EventHub_2.EventHub.dispatchEvent(MessageType_3.MessageType.WIDGET, keyEventObj);
- }
- else {
- e.preventDefault();
- e.stopPropagation();
- }
- };
- Widget.prototype.handleKeyUpEvent = function (e) {
- var keyStroke = KeystrokeGenerator_1.KeystrokeGenerator.generateKeyStroke(e);
- var keyEventObj = {
- id: this.id,
- evtType: Event_2.Event.KEY_UP,
- altKey: e.altKey,
- shiftKey: e.shiftKey,
- ctrlKey: e.ctrlKey,
- keyCode: e.keyCode,
- keyStroke: keyStroke
- };
- EventHub_2.EventHub.dispatchEvent(MessageType_3.MessageType.WIDGET, keyEventObj);
- };
- Widget.prototype.setEnabled = function (args) {
- this.enabled = args.enabled;
- if (this.enabled) {
- this.$thisNode.removeAttr("disabled");
- }
- else {
- this.$thisNode.attr("disabled", "disabled");
- }
- };
- Widget.prototype.isEnabled = function () {
- return this.enabled;
- };
- Widget.prototype.setVisible = function (args) {
- this.visible = args.visible;
- if (this.visible) {
- this.css({ cssStyle: { "display": "block" } });
- }
- else {
- this.css({ cssStyle: { "display": "none" } });
- }
- };
- Widget.prototype.isVisible = function () {
- return this.visible;
- };
- Widget.prototype.dispose = function () {
- WidgetManager_2.WidgetManager.unregister(this.id);
- this.$thisNode.remove();
- if (this.parent) {
- var index = this.parent.children.indexOf(this);
- this.parent.children.splice(index, 1);
- }
- };
- Widget.prototype.setFocus = function () {
- };
- ;
- Widget.prototype.setLayoutData = function (args) {
- var layout = this.parent ? this.parent.layout_ : undefined;
- if (layout) {
- var layoutData = args.layoutData;
- var layoutType = layout.toString();
- if (layoutType === "HeaderFooterLayout") {
- this.layoutData = new HeaderFooterLayoutData_2.HeaderFooterLayoutData(layoutData);
- }
- else if (layoutType === "RowGridLayout") {
- this.layoutData = new RowGridLayoutData_2.RowGridLayoutData(layoutData);
- }
- else if (layoutType === "SideNavLayout") {
- this.layoutData = new SideNavLayoutData_2.SideNavLayoutData(layoutData);
- }
- }
- };
- Widget.prototype.setBackgroundColor = function (attrs) {
- };
- Widget.prototype.css = function (args) {
- if (this.$thisNode) {
- this.$thisNode.css(args.cssStyle);
- }
- else {
- this.cssStyle = $.extend(this.cssStyle, args.cssStyle);
- }
- };
- Widget.prototype.toString = function () {
- return "Widget";
- };
- Widget.prototype.postLayout = function () {
- if (this.cssStyle) {
- this.$thisNode.css(this.cssStyle);
- this.cssStyle = null;
- }
- };
- Widget.prototype.initEvents = function (args) {
- var _this = this;
- setTimeout(function () {
- if (!_this.$thisNode) {
- _this.$thisNode = $("#" + _this.id);
- }
- for (var i = 0; i < args.events.length; i++) {
- switch (args.events[i]) {
- case Event_2.Event.CLICK:
- _this.$thisNode.on("click", function (e) {
- EventHub_2.EventHub.dispatchEvent(MessageType_3.MessageType.WIDGET, { id: _this.id, evtType: Event_2.Event.CLICK });
- });
- break;
- case Event_2.Event.MODIFY:
- _this.$thisNode.on("input", function (e) {
- EventHub_2.EventHub.dispatchEvent(MessageType_3.MessageType.WIDGET, {
- id: _this.id,
- text: $(_this).val(),
- evtType: Event_2.Event.MODIFY
- });
- });
- break;
- case Event_2.Event.ON_CHANGE:
- break;
- }
- }
- }, 800);
- };
- return Widget;
- }());
- exports.Widget = Widget;
- });
- define("util/WidgetManager", ["require", "exports", "util/Map"], function (require, exports, Map_1) {
- "use strict";
- var WidgetManager = (function () {
- function WidgetManager() {
- }
- WidgetManager.register = function (widget) {
- this.map.put(widget.getId(), widget);
- };
- WidgetManager.unregister = function (id) {
- this.map.remove(id);
- };
- WidgetManager.byId = function (id) {
- var widget = this.map.getValue(id);
- return widget;
- };
- WidgetManager.size = function () {
- return this.map.size();
- };
- WidgetManager.map = new Map_1.Map();
- return WidgetManager;
- }());
- exports.WidgetManager = WidgetManager;
- });
- define("util/WidgetUtil", ["require", "exports", "util/WidgetManager"], function (require, exports, WidgetManager_3) {
- "use strict";
- var WidgetUtil = (function () {
- function WidgetUtil() {
- }
- WidgetUtil.refreshDialogZIndex = function (htmlElement) {
- var thisZIndex = parseInt(htmlElement.style.zIndex);
- var maxZIndex = -1;
- var dialogNodes = $("div.adore_dialog");
- var i, tempZIndex;
- for (i = 0; i < dialogNodes.length; i++) {
- if (dialogNodes[i].id === htmlElement.id) {
- continue;
- }
- tempZIndex = parseInt(dialogNodes[i].style.zIndex);
- maxZIndex = tempZIndex > maxZIndex ? tempZIndex : maxZIndex;
- }
- var adoreShellNodes = $("div.adore_shell");
- for (i = 0; i < adoreShellNodes.length; i++) {
- if (adoreShellNodes[i].id === htmlElement.id) {
- continue;
- }
- tempZIndex = parseInt(adoreShellNodes[i].style.zIndex);
- maxZIndex = tempZIndex > maxZIndex ? tempZIndex : maxZIndex;
- }
- if (maxZIndex >= thisZIndex) {
- $(htmlElement).css("z-index", maxZIndex + 1);
- }
- };
- WidgetUtil.findWidgetByTarget = function (target) {
- if (!target) {
- return null;
- }
- var widget = WidgetManager_3.WidgetManager.byId(target.id);
- if (widget) {
- return widget;
- }
- else {
- return WidgetUtil.findWidgetByTarget(target.parentNode);
- }
- };
- WidgetUtil.elementExists = function (id) {
- if (id) {
- var $node = $("#" + id);
- if ($node.length !== 0) {
- return true;
- }
- }
- return false;
- };
- return WidgetUtil;
- }());
- exports.WidgetUtil = WidgetUtil;
- });
- define("event/DocumentEventInterceptor", ["require", "exports", "event/EventHub", "event/Event", "event/MessageType", "util/WidgetUtil"], function (require, exports, EventHub_3, Event_3, MessageType_4, WidgetUtil_2) {
- "use strict";
- var DocumentEventInterceptor = (function () {
- function DocumentEventInterceptor() {
- }
- DocumentEventInterceptor.addFilter = function (eventType) {
- this.eventTypeMap.push(eventType);
- };
- DocumentEventInterceptor.addDisplayEvent = function (eventType) {
- if (this.displayEvents.indexOf(eventType) === -1) {
- this.displayEvents.push(eventType);
- }
- };
- DocumentEventInterceptor.removeDisplayEvent = function (eventType) {
- for (var i = 0; i < this.displayEvents.length; i++) {
- if (eventType === this.displayEvents[i]) {
- this.displayEvents.splice(i, 1);
- }
- }
- };
- DocumentEventInterceptor.sendDisplayEvent = function (eventType) {
- if (this.displayEvents.indexOf(eventType) !== -1) {
- EventHub_3.EventHub.dispatchEvent(MessageType_4.MessageType.DISPLAY, { evtType: eventType });
- }
- };
- DocumentEventInterceptor.initInterceptor = function () {
- var _this = this;
- $(document).on("keydown", function (e) {
- var widget = WidgetUtil_2.WidgetUtil.findWidgetByTarget(e.target);
- if (widget && widget.isEnabled()) {
- if (_this.eventTypeMap.indexOf(Event_3.Event.KEY_DONW) !== -1) {
- widget.handleKeyDownEvent(e, true);
- }
- else {
- widget.handleKeyDownEvent(e, false);
- }
- }
- DocumentEventInterceptor.sendDisplayEvent(Event_3.Event.KEY_DONW);
- }).on("keyup", function (e) {
- var widget = WidgetUtil_2.WidgetUtil.findWidgetByTarget(e.target);
- if (widget && widget.isEnabled()) {
- widget.handleKeyUpEvent(e);
- }
- DocumentEventInterceptor.sendDisplayEvent(Event_3.Event.KEY_UP);
- }).on("mousedown", function (e) {
- var widget = WidgetUtil_2.WidgetUtil.findWidgetByTarget(e.target);
- if (widget && widget.isEnabled()) {
- widget.handleMouseDownEvent(e);
- }
- DocumentEventInterceptor.sendDisplayEvent(Event_3.Event.MOUSE_DOWN);
- }).on("mouseup", function (e, touchToClick) {
- var widget = WidgetUtil_2.WidgetUtil.findWidgetByTarget(e.target);
- if (widget && widget.isEnabled()) {
- if (touchToClick) {
- e.button = 0;
- }
- widget.handleMouseUpEvent(e);
- }
- DocumentEventInterceptor.sendDisplayEvent(Event_3.Event.MOUSE_UP);
- }).on("touchmove", function (e) {
- DocumentEventInterceptor.sendDisplayEvent(Event_3.Event.TOUCH_MOVE);
- });
- window.addEventListener("touchstart", function (e) {
- DocumentEventInterceptor.touchStartTimeStamp = e.timeStamp;
- DocumentEventInterceptor.touchStartTarget = e.target;
- DocumentEventInterceptor.touchHadMoved = false;
- DocumentEventInterceptor.touchStartY = e.changedTouches[0].pageY;
- DocumentEventInterceptor.touchStartX = e.changedTouches[0].pageX;
- });
- window.addEventListener("touchmove", function (e) {
- _this.touchHadMoved = true;
- });
- window.addEventListener("touchend", function (e) {
- if (!_this.touchHadMoved || e.target !== _this.touchStartTarget) {
- return;
- }
- var changeY = e.changedTouches[0].pageY - DocumentEventInterceptor.touchStartY;
- var changeX = e.changedTouches[0].pageX - DocumentEventInterceptor.touchStartX;
- changeX = changeX < 0 ? changeX * -1 : changeX;
- changeY = changeY < 0 ? changeY * -1 : changeY;
- var isClick = false;
- var touchTime = e.timeStamp - DocumentEventInterceptor.touchStartTimeStamp;
- if (touchTime <= 900 && changeX <= 80 && changeY <= 80) {
- isClick = true;
- }
- if (isClick) {
- var widget = WidgetUtil_2.WidgetUtil.findWidgetByTarget(e.target);
- if (widget) {
- var id = widget.getId();
- if (id.indexOf("TreeItem", 0) !== -1 || id.indexOf("TabItem", 0) !== -1
- || id.indexOf("MessageDialog", 0) !== -1) {
- $(e.target).click();
- }
- else {
- $(e.target).trigger("mouseup", "true");
- }
- }
- else {
- $(e.target).click();
- }
- }
- });
- };
- DocumentEventInterceptor.eventTypeMap = new Array();
- DocumentEventInterceptor.displayEvents = new Array();
- DocumentEventInterceptor.touchStartTimeStamp = 0;
- DocumentEventInterceptor.touchStartY = 0;
- DocumentEventInterceptor.touchStartX = 0;
- DocumentEventInterceptor.touchHadMoved = false;
- return DocumentEventInterceptor;
- }());
- exports.DocumentEventInterceptor = DocumentEventInterceptor;
- });
- define("App", ["require", "exports", "event/EventHub", "event/MessageType", "event/DocumentEventInterceptor"], function (require, exports, EventHub_4, MessageType_5, DocumentEventInterceptor_1) {
- "use strict";
- EventHub_4.EventHub.dispatchEvent(MessageType_5.MessageType.INIT, {});
- DocumentEventInterceptor_1.DocumentEventInterceptor.initInterceptor();
- });
- define("event/ExecutorEvent", ["require", "exports", "event/EventHub", "event/MessageType"], function (require, exports, EventHub_5, MessageType_6) {
- "use strict";
- var ExecutorEvent = (function () {
- function ExecutorEvent() {
- }
- ExecutorEvent.finish = function (id, args) {
- EventHub_5.EventHub.dispatchEvent(MessageType_6.MessageType.FINISH, { id: id, result: args });
- };
- ExecutorEvent.error = function (id, e) {
- EventHub_5.EventHub.dispatchEvent(MessageType_6.MessageType.ERROR, { id: id, error: e });
- };
- return ExecutorEvent;
- }());
- exports.ExecutorEvent = ExecutorEvent;
- });
- define("util/RequisiteUtil", ["require", "exports"], function (require, exports) {
- "use strict";
- var RequisiteUtil = (function () {
- function RequisiteUtil() {
- }
- RequisiteUtil.checkRequisite = function (isRequisite, widget, editable, value, msg) {
- if (isRequisite) {
- if (!widget.isEnabled() || !editable || value) {
- RequisiteUtil.removeRequisite(widget);
- }
- else {
- RequisiteUtil.addRequisite(widget);
- if (msg) {
- RequisiteUtil.showSpan(widget, msg);
- }
- }
- }
- };
- RequisiteUtil.addRequisite = function (widget) {
- widget.$thisNode.find("input").addClass("adore_InputRequisite");
- widget.$thisNode.find("textarea").addClass("adore_InputRequisite");
- widget.$thisNode.find("label").addClass("adore_requisiteColor");
- widget.$thisNode.find("i").addClass("adore_requisiteColor");
- };
- RequisiteUtil.removeRequisite = function (widget) {
- widget.$thisNode.find("input").removeClass("adore_InputRequisite");
- widget.$thisNode.find("textarea").removeClass("adore_InputRequisite");
- widget.$thisNode.find("label").removeClass("adore_requisiteColor");
- widget.$thisNode.find("i").removeClass("adore_requisiteColor");
- RequisiteUtil.hideSpan(widget);
- };
- RequisiteUtil.showSpan = function (widget, msg) {
- if (widget.$thisNode.find('span').css("display") === "none") {
- widget.$thisNode.find('span').html(msg).show().delay(2000).fadeOut(300);
- }
- };
- RequisiteUtil.hideSpan = function (widget) {
- widget.$thisNode.find("span").css("display", "none");
- };
- return RequisiteUtil;
- }());
- exports.RequisiteUtil = RequisiteUtil;
- });
- define("widget/validator/MaxLengthValidator", ["require", "exports"], function (require, exports) {
- "use strict";
- var MaxLengthValidator = (function () {
- function MaxLengthValidator(id, textNode, maxLength) {
- this.id = id;
- this.textNode = textNode;
- this.maxLength = maxLength;
- }
- MaxLengthValidator.prototype.setMaxLength = function (maxLength) {
- this.maxLength = maxLength;
- };
- MaxLengthValidator.prototype.handleModifyEvent = function () {
- if (this.maxLength < 0) {
- return;
- }
- var count = 0;
- for (var i = 0; i < this.textNode.value.length; i++) {
- var c = this.textNode.value.charCodeAt(i);
- if ((c >= 0x0001 && c <= 0x007e) || (0xff60 <= c && c <= 0xff9f)) {
- count++;
- }
- else {
- count += 2;
- }
- if (count > this.maxLength) {
- var selectionStart = this.textNode.selectionStart;
- var selectionEnd = this.textNode.selectionEnd;
- this.textNode.value = this.textNode.value.substr(0, i);
- if (selectionEnd <= i) {
- this.textNode.selectionStart = selectionStart;
- this.textNode.selectionEnd = selectionEnd;
- }
- break;
- }
- else if (count === this.maxLength) {
- }
- }
- };
- return MaxLengthValidator;
- }());
- exports.MaxLengthValidator = MaxLengthValidator;
- });
- define("widget/validator/PictureValidator", ["require", "exports", "hotkey/Keys"], function (require, exports, Keys_4) {
- "use strict";
- var PictureValidator = (function () {
- function PictureValidator(id, textNode, picture, adoreText) {
- this.leftAlignment = false;
- this.length = 0;
- this.cursorIndex = -1;
- this.id = id;
- this.textNode = textNode;
- this.startWithZeroReg = new RegExp("^0\\d+\\..*");
- this.startWithZeroMinusReg = new RegExp("^-0\\d+\\..*");
- this.startWithMinusReg = new RegExp("^-\\..*");
- var tmpPicture = picture;
- if (tmpPicture.indexOf("-") === 0) {
- this.leftAlignment = true;
- tmpPicture = tmpPicture.substring(1);
- }
- var newPictureBuffer = new Array();
- var singleQuotedBuffer = new Array();
- var inQuote = false;
- var num = 0;
- for (var index = 0; index < tmpPicture.length; index++) {
- var c = tmpPicture.charAt(index);
- if (c === "\"") {
- if (!inQuote) {
- singleQuotedBuffer.length = 0;
- inQuote = true;
- }
- else {
- if (num === 0) {
- num = 1;
- }
- for (var i = 0; i < num; i++) {
- var temp = singleQuotedBuffer[0];
- var savedString = newPictureBuffer.pop();
- var saveString = savedString ? temp + savedString : temp;
- newPictureBuffer.push(saveString);
- }
- num = 0;
- singleQuotedBuffer.length = 0;
- inQuote = false;
- }
- }
- else {
- if (!inQuote) {
- if (c < "0" || c > "9") {
- console.error(this.id + " --> picture init error: " + picture);
- }
- num = num * 10 + parseInt(c);
- }
- else {
- var char = singleQuotedBuffer.length === 0 ? c : singleQuotedBuffer.pop() + c;
- singleQuotedBuffer.push(char);
- }
- }
- }
- for (var i = 0; i < num; i++) {
- newPictureBuffer.push("X");
- }
- tmpPicture = newPictureBuffer[0];
- while (tmpPicture.indexOf(".") !== tmpPicture.lastIndexOf(".")) {
- var lastDotIndex = tmpPicture.lastIndexOf(".");
- tmpPicture = tmpPicture.substring(0, lastDotIndex)
- + tmpPicture.substring(lastDotIndex + 1);
- }
- this.length = tmpPicture.length;
- adoreText.setMaxLength(this.length);
- if (tmpPicture.charAt(0) === "0" || tmpPicture.charAt(0) === "C!") {
- }
- this.picture = tmpPicture;
- }
- PictureValidator.prototype.handleKeyDownEvent = function (e) {
- var textValue = this.textNode.value;
- if (this.length > 1) {
- var start = this.textNode.selectionStart;
- var end = this.textNode.selectionEnd;
- if (start === end) {
- if (e.keyCode === Keys_4.Keys.BACKSPACE) {
- if (PictureValidator.KNOWN_FLAGS.indexOf(this.picture.charAt(this.length
- - this.textNode.value.length + start - 1)) === -1) {
- this.textNode.selectionStart = --start;
- this.textNode.selectionEnd = --end;
- }
- if (this.textNode.value.indexOf("-0.") === 0 && start === 2) {
- this.textNode.value = this.textNode.value.substring(1);
- this.textNode.selectionStart = 1;
- this.textNode.selectionEnd = 1;
- e.preventDefault();
- }
- }
- if (e.keyCode === 127) {
- if (PictureValidator.KNOWN_FLAGS.indexOf(this.picture.charAt(this.picture.length
- - this.textNode.value.length + start)) === -1) {
- this.textNode.selectionStart = ++start;
- }
- }
- }
- }
- if (this.length > 0) {
- var byteLength = 0;
- for (var i = 0; i < this.textNode.value.length; i++) {
- var c = this.textNode.value.charCodeAt(i);
- if ((c >= 0x0001 && c <= 0x007e) || (0xff60 <= c && c <= 0xff9f)) {
- byteLength++;
- }
- else {
- byteLength += 2;
- }
- }
- if (textValue != null
- && byteLength >= this.length
- && (this.textNode.selectionEnd - this.textNode.selectionStart) === 0) {
- if (e.keyCode !== 8 && e.keyCode !== 127
- && e.keyCode !== Keys_4.Keys.RIGHT_ARROW
- && e.keyCode !== Keys_4.Keys.LEFT_ARROW) {
- if (this.picture.length > 0
- && this.picture.charAt(0) === "$") {
- return;
- }
- if (this.picture.indexOf(".") === -1) {
- e.preventDefault();
- }
- else {
- if (this.textNode.selectionStart <= this.textNode.value
- .indexOf(".") && e.char !== ".") {
- e.preventDefault();
- }
- }
- }
- }
- }
- };
- PictureValidator.prototype.handleModifyEvent = function () {
- this.cursorIndex = this.textNode.selectionEnd;
- var textValue = this.textNode.value;
- if (this.picture.charAt(0) === "$") {
- while (textValue.indexOf("$") === 0) {
- textValue = textValue.substring(1, textValue.length - 1);
- this.cursorIndex--;
- }
- this.cursorIndex = Math.max(this.cursorIndex, 0);
- }
- textValue = this.removeUnknownFlags(textValue, this.picture, true);
- var refinedPicture = this.removeUnknownFlags(this.picture, this.picture, false);
- if (textValue.lastIndexOf("-") > 0) {
- var otherFlag = refinedPicture.replace(/[90\\.]/g, "");
- if (otherFlag.length === 0) {
- var index = -1;
- while ((index = textValue.indexOf("-")) > -1) {
- if (index < (this.cursorIndex - 1)) {
- this.cursorIndex--;
- textValue = textValue.replace("-", "");
- }
- else {
- textValue = textValue.replace(/-/g, "");
- break;
- }
- }
- textValue = "-" + textValue;
- }
- }
- if (refinedPicture.indexOf(".") !== -1) {
- while (textValue.indexOf(".") !== textValue.lastIndexOf(".")) {
- textValue = textValue.substring(0, textValue.lastIndexOf("."))
- + textValue.substring(textValue.lastIndexOf(".") + 1);
- this.cursorIndex = textValue.indexOf(".") + 1;
- }
- if (textValue.indexOf(".") === -1) {
- textValue = textValue.substring(0, this.cursorIndex) + "."
- + textValue.substring(this.cursorIndex);
- }
- if (textValue.indexOf(".") === 0) {
- textValue = "0" + textValue;
- this.cursorIndex++;
- }
- else if (this.startWithZeroReg.test(textValue)) {
- textValue = textValue.substring(1);
- this.cursorIndex--;
- }
- else if (this.startWithZeroMinusReg.test(textValue)) {
- textValue = textValue.substring(0, 1) + textValue.substring(2);
- this.cursorIndex--;
- }
- if (this.startWithMinusReg.test(textValue)) {
- textValue = "-0" + textValue.substring(1);
- this.cursorIndex++;
- }
- var pictureSuffixLength = refinedPicture.length - 1
- - refinedPicture.indexOf(".");
- var strSuffixLength = textValue.length - 1 - textValue.indexOf(".");
- if (strSuffixLength > pictureSuffixLength) {
- var newLength = textValue.length - strSuffixLength
- + pictureSuffixLength;
- textValue = textValue.substring(0, newLength);
- this.cursorIndex = Math.min(textValue.length, this.cursorIndex);
- }
- for (var i = 0; i < pictureSuffixLength - strSuffixLength; i++) {
- textValue += "0";
- }
- }
- if (textValue.length > refinedPicture.length) {
- if (this.leftAlignment) {
- textValue = textValue.substring(0, refinedPicture.length);
- }
- else {
- textValue = textValue.substring(textValue.length - refinedPicture.length);
- }
- }
- for (var i = 0; i < textValue.length;) {
- if (refinedPicture.charAt(refinedPicture.length - textValue.length
- + i) === "^") {
- textValue = textValue.substring(0, i) + textValue.charAt(i).toUpperCase()
- + textValue.substring(i + 1);
- }
- if (!this.checkFormat(refinedPicture.charAt(refinedPicture.length
- - textValue.length + i), textValue.charAt(i), i)) {
- textValue = textValue.substring(0, i) + textValue.substring(i + 1);
- this.cursorIndex = i;
- }
- else {
- i++;
- }
- }
- var startWithMinus = false;
- if (textValue.indexOf("-") === 0) {
- textValue = textValue.substring(1);
- startWithMinus = true;
- }
- textValue = this.addUnknownFlags(textValue, this.picture);
- if (this.picture.charAt(0) === "$") {
- while (textValue.length < this.length) {
- textValue = "$" + textValue;
- this.cursorIndex++;
- }
- }
- if (startWithMinus) {
- textValue = "-" + textValue;
- }
- this.textNode.value = textValue;
- this.textNode.selectionStart = this.cursorIndex;
- this.textNode.selectionEnd = this.cursorIndex;
- };
- PictureValidator.prototype.removeUnknownFlags = function (textValue, picture, modifyCursorIndex) {
- var unknownFlags = "";
- for (var i = 0; i < picture.length; i++) {
- if (PictureValidator.KNOWN_FLAGS.indexOf(picture.charAt(i)) === -1) {
- unknownFlags += picture.charAt(i);
- }
- }
- for (var i = 0; i < unknownFlags.length; i++) {
- var j = textValue.indexOf(unknownFlags.charAt(i));
- if (j !== -1) {
- textValue = textValue.substring(0, j) + textValue.substring(j + 1);
- if (modifyCursorIndex && this.cursorIndex > j) {
- this.cursorIndex--;
- }
- }
- }
- return textValue;
- };
- PictureValidator.prototype.checkFormat = function (format, c, index) {
- switch (format) {
- case "$":
- if (c === "$") {
- for (var i = 0; i < index; i++) {
- if (this.textNode.value.charAt(i) !== "$")
- return false;
- }
- }
- if ((c < "0" || c > "9") && c !== "-") {
- return false;
- }
- if (c === "-" && index === 0)
- return true;
- if (c === "-") {
- for (var i = 0; i < index; i++) {
- if (this.textNode.value.charAt(i) !== "$")
- return false;
- }
- }
- break;
- case "9":
- if ((c < "0" || c > "9") && c !== "-") {
- return false;
- }
- if (c === "-" && index !== 0)
- return false;
- break;
- case "0":
- if (c < "0" || c > "9") {
- return false;
- }
- break;
- case "A":
- if ((c < "a" || c > "z") && (c < "A" || c > "Z")) {
- return false;
- }
- break;
- case "N":
- case "!":
- if ((c < "a" || c > "z") && (c < "A" || c > "Z")
- && (c < "0" || c > "9")) {
- return false;
- }
- break;
- case "C":
- if (c.charCodeAt(0) < 0x3400) {
- return false;
- }
- break;
- case "^":
- break;
- case "c":
- if (c.charCodeAt(0) >= 0x3400)
- return false;
- break;
- case "F":
- if (c.charCodeAt(0) < 256) {
- return false;
- }
- break;
- case "X":
- break;
- default:
- if (c === format)
- return true;
- if (c === "-" && index === 0)
- return true;
- return false;
- }
- return true;
- };
- PictureValidator.prototype.addUnknownFlags = function (s, picture) {
- for (var i = 0; i < s.length; i++) {
- if (PictureValidator.KNOWN_FLAGS.indexOf(picture.charAt(picture.length - 1 - i)) === -1) {
- s = s.substring(0, s.length - i)
- + picture.charAt(picture.length - 1 - i)
- + s.substring(s.length - i);
- if (this.cursorIndex > s.length - 1 - i) {
- this.cursorIndex++;
- }
- }
- }
- return s;
- };
- PictureValidator.KNOWN_FLAGS = "90^$AN!CcFX.";
- return PictureValidator;
- }());
- exports.PictureValidator = PictureValidator;
- });
- 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) {
- "use strict";
- var Text = (function (_super) {
- __extends(Text, _super);
- function Text(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.editable = true;
- this.requisite = false;
- this.maxLength = -1;
- var own = this;
- this.$thisNode = $(Text.Template).attr({
- id: this.id + "_containerNode"
- });
- this.$inputNode = this.$thisNode.find("input");
- this.$inputNode.attr("id", this.id).on("input", function (e) {
- if ($(this).prop('comStart'))
- return;
- own.handleOnInput();
- EventHub_6.EventHub.dispatchEvent(MessageType_7.MessageType.WIDGET, {
- id: id,
- text: $(this).val(),
- evtType: Event_4.Event.MODIFY,
- syncAttrName: "text"
- });
- }).on("focus", function () {
- own.sendFocusGain();
- SoftwareKeyboardUtil_1.SoftwareKeyboardUtil.refresh();
- }).on("blur", function () {
- RequisiteUtil_1.RequisiteUtil.checkRequisite(own.requisite, own, own.editable, own.$inputNode.val(), "请输入数据!");
- }).on('compositionstart', function () {
- $(this).prop('comStart', true);
- }).on('compositionend', function () {
- $(this).prop('comStart', false);
- });
- this.$thisNode.find("label").attr("for", this.id);
- if ((this.style & ADORE_2.ADORE.Password) === ADORE_2.ADORE.Password) {
- this.$inputNode.attr("type", "password");
- }
- }
- Text.prototype.handleOnInput = function () {
- this.maxLengthValidator.handleModifyEvent();
- if (this.pictureValidator)
- this.pictureValidator.handleModifyEvent();
- RequisiteUtil_1.RequisiteUtil.checkRequisite(this.requisite, this, this.editable, this.$inputNode.val(), "请输入数据!");
- };
- Text.prototype.setRequisite = function (args) {
- this.requisite = args.requisite;
- RequisiteUtil_1.RequisiteUtil.checkRequisite(this.requisite, this, this.editable, this.$inputNode.val(), "");
- };
- Text.prototype.setEnabled = function (args) {
- this.enabled = args.enabled;
- if (this.enabled) {
- this.$inputNode.removeAttr("disabled");
- this.$thisNode.find("i").removeClass("icon_disabled");
- }
- else {
- this.$inputNode.attr("disabled", "disabled");
- this.$thisNode.find("i").addClass("icon_disabled");
- }
- RequisiteUtil_1.RequisiteUtil.checkRequisite(this.requisite, this, this.editable, this.$inputNode.val(), "");
- };
- Text.prototype.setFocus = function () {
- if (document.activeElement !== this.$inputNode[0]) {
- this.$inputNode.focus();
- }
- RequisiteUtil_1.RequisiteUtil.checkRequisite(this.requisite, this, this.editable, this.$inputNode.val(), "请输入数据!");
- };
- Text.prototype.setText = function (args) {
- this.$inputNode.val(args.text);
- if (args.text.length > 0) {
- this.$inputNode.siblings("label, i").addClass("active");
- }
- else {
- this.$inputNode.siblings("label, i").removeClass("active");
- }
- RequisiteUtil_1.RequisiteUtil.checkRequisite(this.requisite, this, this.editable, this.$inputNode.val(), "");
- };
- Text.prototype.setIcon = function (args) {
- this.$thisNode.find("i").addClass(args.icon);
- if (this.$inputNode.val().length > 0)
- this.$inputNode.siblings("label, i").addClass("active");
- this.$thisNode.find("span").addClass("span_prefix");
- };
- Text.prototype.setName = function (args) {
- this.$thisNode.find("label").text(args.name);
- };
- Text.prototype.setPicture = function (args) {
- this.picture = args.picture;
- };
- Text.prototype.handleKeyDownEvent = function (e, hasFilter) {
- if (this.pictureValidator)
- this.pictureValidator.handleKeyDownEvent(e);
- _super.prototype.handleKeyDownEvent.call(this, e, hasFilter);
- };
- Text.prototype.handleMaxLength = function () {
- this.maxLengthValidator = new MaxLengthValidator_1.MaxLengthValidator(this.id, this.$inputNode[0], this.maxLength);
- };
- Text.prototype.setMaxLength = function (maxLength) {
- if (this.maxLengthValidator)
- this.maxLengthValidator.setMaxLength(maxLength);
- };
- Text.prototype.handlePicture = function (picture) {
- if (picture.length > 0 && picture.indexOf("\"") < 0) {
- if (picture.indexOf(",") >= 0 || picture.indexOf(".") >= 0) {
- console.error("非法的picutre:" + picture);
- picture = "";
- }
- var allNum = true;
- for (var i = 0; i < picture.length; i++) {
- var c = picture.charAt(i);
- if (c < "0" || c > "9") {
- allNum = false;
- break;
- }
- }
- if (allNum && picture.length > 2) {
- console.error("非法的picture:" + picture);
- picture = "";
- }
- }
- this.pictureValidator = new PictureValidator_1.PictureValidator(this.id, this.$inputNode[0], picture, this);
- };
- Text.prototype.setmaxLength = function (args) {
- this.maxLength = args.maxLength;
- };
- Text.prototype.postLayout = function () {
- this.handleMaxLength();
- if (this.picture)
- this.handlePicture(this.picture);
- };
- Text.prototype.setPanelID = function (args) {
- this.panelID = args.panelID;
- };
- Text.prototype.setEditable = function (args) {
- this.editable = args.editable;
- if (this.editable) {
- this.$inputNode.removeAttr("readOnly");
- }
- else {
- this.$inputNode.attr("readOnly", "readOnly");
- }
- RequisiteUtil_1.RequisiteUtil.checkRequisite(this.requisite, this, this.editable, this.$inputNode.val(), "");
- };
- Text.prototype.toString = function () {
- return "Text";
- };
- Text.prototype.setTooltip = function (args) {
- this.$inputNode.tooltip('remove');
- if (args.tooltip !== "") {
- this.$inputNode.attr("data-position", "right");
- this.$inputNode.attr("data-tooltip", args.tooltip);
- this.$inputNode.tooltip({ delay: 50 });
- }
- };
- 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 ";
- return Text;
- }(Widget_4.Widget));
- exports.Text = Text;
- });
- define("util/SoftwareKeyboardUtil", ["require", "exports", "util/WidgetUtil"], function (require, exports, WidgetUtil_3) {
- "use strict";
- var SoftwareKeyboardUtil = (function () {
- function SoftwareKeyboardUtil() {
- }
- SoftwareKeyboardUtil.handleSoftwareKeyboardShow = function (args) {
- this.keyboardShowed = true;
- this.proportion = args.proportion;
- this.refresh();
- };
- SoftwareKeyboardUtil.refresh = function () {
- if (this.keyboardShowed === true) {
- var keyboardHeightProportion = this.proportion;
- var element = document.activeElement;
- var widget = WidgetUtil_3.WidgetUtil.findWidgetByTarget(element);
- if (widget && widget.toString() === "Text") {
- var softKeyboardHeight = keyboardHeightProportion * window.innerHeight;
- var textWidget = widget;
- this.scroll(textWidget.panelID, widget.$thisNode[0], softKeyboardHeight);
- }
- }
- };
- SoftwareKeyboardUtil.refreshKeyboardHide = function () {
- $("#softKeyboardDiv").remove();
- if (this.lastPanelID) {
- $("#" + this.lastPanelID).css({ "overflow-y": this.lastOverflowYValue, "display": this.lastDisplayValue });
- this.lastPanelID = null;
- }
- };
- SoftwareKeyboardUtil.handleSoftwareKeyboardHide = function () {
- this.keyboardShowed = false;
- this.refreshKeyboardHide();
- };
- SoftwareKeyboardUtil.scroll = function (panelID, textNode, softKeyboardHeight) {
- if (this.lastPanelID !== panelID) {
- this.refreshKeyboardHide();
- }
- var top = this.getElementViewBottom(textNode);
- var i;
- if (softKeyboardHeight - top >= 1) {
- var containerNode = $("#" + panelID);
- this.lastPanelID = panelID;
- if ($("div.adore_shell_content").length !== 0) {
- var adoreShells = $("div.adore_shell_content");
- for (i = 0; i < adoreShells.length; i++) {
- if ($(adoreShells[i]).find("#" + panelID).length !== 0) {
- containerNode = $(adoreShells[i]);
- break;
- }
- }
- }
- var container = containerNode[0];
- this.lastOverflowYValue = containerNode.css("overflow-y");
- this.lastDisplayValue = containerNode.css("display");
- containerNode.css({ "overflow-y": "auto", "display": "block" });
- container.scrollTop = container.scrollTop + (softKeyboardHeight - top);
- var afterTop = this.getElementViewBottom(textNode);
- if (softKeyboardHeight - afterTop >= 1) {
- var tempDivNode = $("<div></div>").css({
- height: softKeyboardHeight + "px",
- width: "1px"
- }).attr({ id: "softKeyboardDiv" });
- if (containerNode.css("position") === "absolute") {
- var children = containerNode.children();
- var totalHeight = 0;
- for (i = 0; i < children.length; i++) {
- totalHeight += children[i].offsetHeight;
- }
- var tempDivTop = container.offsetHeight >= totalHeight ? container.offsetHeight : totalHeight;
- tempDivNode.css({
- position: "absolute",
- top: tempDivTop + "px"
- });
- }
- tempDivNode.appendTo(container);
- container.scrollTop = container.scrollTop + (softKeyboardHeight - afterTop);
- }
- }
- };
- SoftwareKeyboardUtil.getElementViewBottom = function (element) {
- var top = element.getBoundingClientRect().top;
- return window.innerHeight - top - element.offsetHeight;
- };
- return SoftwareKeyboardUtil;
- }());
- exports.SoftwareKeyboardUtil = SoftwareKeyboardUtil;
- });
- define("util/TabUtil", ["require", "exports", "event/EventHub", "event/Event", "event/MessageType"], function (require, exports, EventHub_7, Event_5, MessageType_8) {
- "use strict";
- var TabUtil = (function () {
- function TabUtil() {
- }
- TabUtil.handleTabLeftMoveClick = function (tabFolderId) {
- var tabs = $("#" + tabFolderId);
- var indexs = this.getBlockIndexs(tabs);
- var blockBegin = indexs[0], blockEnd = indexs[1];
- if (blockBegin <= 0) {
- return;
- }
- var lis = tabs.find("li.adore_tab");
- var count = this.tabLeftMove(tabs, lis, blockBegin);
- if (count <= 1) {
- this.tabLeftMove(tabs, lis, blockBegin - 1);
- }
- this.resetMovingIcon(tabs, lis);
- this.resetIndicator(tabs, lis);
- };
- TabUtil.handleTabRightMoveClick = function (tabFolderId) {
- var tabs = $("#" + tabFolderId);
- var indexs = this.getBlockIndexs(tabs);
- var blockBegin = indexs[0], blockEnd = indexs[1];
- var lis = tabs.find("li.adore_tab");
- if (this.isEndRight(tabs, lis)) {
- return;
- }
- var count = this.tabRightMove(tabs, lis, blockEnd);
- if (count <= 1) {
- this.tabRightMove(tabs, lis, blockEnd + 1);
- }
- this.resetMovingIcon(tabs, lis);
- this.resetIndicator(tabs, lis);
- };
- TabUtil.isEndRight = function (tabs, lis) {
- var indexs = this.getBlockIndexs(tabs);
- var endRight = false;
- if (indexs[1] === lis.length - 1) {
- var w = $(lis[indexs[1]]).width();
- this.resetAndGetRealWidth(tabs);
- var realW = $(lis[indexs[1]]).width();
- $(lis[indexs[1]]).width(w + "px");
- if (w === realW) {
- endRight = true;
- }
- }
- if (indexs[0] === indexs[1]) {
- endRight = true;
- }
- return endRight;
- };
- TabUtil.resetMovingIcon = function (tabs, lis) {
- if (tabs.find("li.tab_left_move").css("display") === "none") {
- return;
- }
- var indexs = this.getBlockIndexs(tabs);
- var endRight = this.isEndRight(tabs, lis);
- var arrowRight = tabs.find("li.tab_right_move").find("div");
- var arrowLeft = tabs.find("li.tab_left_move").find("div");
- arrowLeft.removeClass("arrow_not_active").removeClass("arrow_active");
- arrowRight.removeClass("arrow_not_active").removeClass("arrow_active");
- if (endRight) {
- arrowRight.addClass("arrow_not_active");
- }
- else {
- arrowRight.addClass("arrow_active");
- }
- if (indexs[0] === 0) {
- arrowLeft.addClass("arrow_not_active");
- }
- else {
- arrowLeft.addClass("arrow_active");
- }
- };
- TabUtil.tabLeftMove = function (tabs, lis, blockBegin) {
- lis.removeClass("tab_visible").addClass("tab_not_visible");
- var canUseWidth = tabs.width() - this.movingIconWidth - this.totalWidthPrefix;
- var usedWidth = 0;
- var i;
- this.resetAndGetRealWidth(tabs);
- for (i = blockBegin; i >= 0 && usedWidth < canUseWidth; i--) {
- $(lis[i]).addClass("tab_visible").removeClass("tab_not_visible");
- usedWidth += $(lis[i]).width();
- }
- for (i = blockBegin + 1; i < lis.length && usedWidth < canUseWidth; i++) {
- $(lis[i]).addClass("tab_visible").removeClass("tab_not_visible");
- usedWidth += $(lis[i]).width();
- }
- var tempIndexs = this.getBlockIndexs(tabs);
- var end = tempIndexs[1];
- if (usedWidth > canUseWidth) {
- $(lis[end]).width($(lis[end]).width() - (usedWidth - canUseWidth) + "px");
- }
- return tempIndexs[1] - tempIndexs[0] + 1;
- };
- TabUtil.tabRightMove = function (tabs, lis, blockEnd) {
- lis.removeClass("tab_visible").addClass("tab_not_visible");
- var canUseWidth = tabs.width() - this.movingIconWidth - this.totalWidthPrefix;
- var usedWidth = 0;
- var i;
- this.resetAndGetRealWidth(tabs);
- for (i = blockEnd; i < lis.length && usedWidth < canUseWidth; i++) {
- $(lis[i]).addClass("tab_visible").removeClass("tab_not_visible");
- usedWidth += $(lis[i]).width();
- }
- for (i = blockEnd - 1; i >= 0 && usedWidth < canUseWidth; i--) {
- $(lis[i]).addClass("tab_visible").removeClass("tab_not_visible");
- usedWidth += $(lis[i]).width();
- }
- var tempIndexs = this.getBlockIndexs(tabs);
- var end = tempIndexs[1], begin = tempIndexs[0];
- if (usedWidth > canUseWidth) {
- if (end === lis.length - 1 && end != begin) {
- $(lis[begin]).removeClass("tab_visible").addClass("tab_not_visible");
- }
- else {
- $(lis[end]).width($(lis[end]).width() - (usedWidth - canUseWidth) + "px");
- }
- }
- tempIndexs = this.getBlockIndexs(tabs);
- return tempIndexs[1] - tempIndexs[0] + 1;
- };
- TabUtil.getBlockIndexs = function (tabs) {
- var tabList = tabs.find("li.adore_tab");
- var blockBegin = 0, blockEnd = 0, i;
- for (i = 0; i < tabList.length; i++) {
- if ($(tabList[i]).css("display") === "block") {
- blockBegin = i;
- break;
- }
- }
- for (i = tabList.length - 1; i >= 0; i--) {
- if ($(tabList[i]).css("display") === "block") {
- blockEnd = i;
- break;
- }
- }
- return [blockBegin, blockEnd];
- };
- TabUtil.getPreTabIndex = function (tabs) {
- var preIndex = 0;
- var activeHref = tabs.find("a.active").attr("href");
- var tabList = tabs.find("li.adore_tab");
- var tmpHref;
- for (var i = 0; i < tabList.length; i++) {
- tmpHref = $(tabList[i]).find("a").attr("href");
- if (activeHref === tmpHref) {
- preIndex = i;
- break;
- }
- }
- var blockIndexs = this.getBlockIndexs(tabs);
- if (preIndex < blockIndexs[0]) {
- return -1;
- }
- if (preIndex > blockIndexs[1]) {
- return -2;
- }
- return preIndex - blockIndexs[0];
- };
- TabUtil.handleTabClick = function (e, currentTab, tabFolderId) {
- var tabs = $("#" + tabFolderId);
- var tabList = tabs.find("li.tab_visible");
- var currentIndex = 0;
- var currentHref = currentTab.attr("href");
- var tmpHref;
- for (var i = 0; i < tabList.length; i++) {
- tmpHref = $(tabList[i]).find("a").attr("href");
- if (currentHref === tmpHref) {
- currentIndex = i;
- break;
- }
- }
- var lis = tabs.find("li.adore_tab");
- var preIndex = this.getPreTabIndex(tabs);
- var activeHref = tabs.find("a.active").attr("href");
- $(activeHref).removeClass("tab_control_visible").addClass("tab_control_not_visible");
- tabs.find("a.active").removeClass("active");
- currentTab.addClass("active");
- $(currentHref).removeClass("tab_control_not_visible").addClass("tab_control_visible");
- var $tab_width = $(tabList[currentIndex]).width();
- var $indivatorLeft = this.getIndicatorLeftWidth(tabs, lis);
- var $indicator = tabs.find("div.my_indicator");
- if (preIndex === -2 || preIndex === -1) {
- $indicator.width(this.$tab_min_width + "px");
- }
- $indicator.velocity({ "left": $indivatorLeft, "width": $tab_width + "px" }, {
- duration: 300,
- queue: false,
- easing: 'easeOutQuad'
- });
- };
- TabUtil.resetAndGetRealWidth = function (tabs) {
- var lis = tabs.find("li.adore_tab");
- var tabRealWidth = 0;
- for (var i = 0; i < lis.length; i++) {
- var a = $(lis[i]).find("a");
- var text = a.text();
- var fontSize = a.css("font-size");
- var letterSpacing = a.css("letter-spacing");
- fontSize = parseFloat(fontSize.replace("px", ""));
- letterSpacing = parseFloat(letterSpacing.replace("px", ""));
- var t = (fontSize + letterSpacing) * text.length + this.$tab_min_width / 2;
- t = t > this.$tab_min_width ? t : this.$tab_min_width;
- tabRealWidth += t;
- $(lis[i]).width(t + "px");
- }
- return tabRealWidth;
- };
- TabUtil.refreshTabs = function (tabs) {
- var totalWidth = tabs.width() - this.totalWidthPrefix;
- var lis = tabs.find("li.adore_tab");
- var activeIndex = this.getActiveIndex(lis);
- lis.removeClass("tab_visible");
- lis.addClass("tab_not_visible");
- tabs.find("li.tab_left_move").css("display", "none");
- tabs.find("li.tab_right_move").css("display", "none");
- this.movingIconWidth = tabs.find("li.tab_left_move").width() + tabs.find("li.tab_right_move").width() + 10;
- var tabRealWidth = this.resetAndGetRealWidth(tabs);
- tabs.find("li.adore_tab_space").css("display", "none");
- if (tabRealWidth > totalWidth) {
- tabs.find("li.tab_left_move").css("display", "block");
- tabs.find("li.tab_right_move").css("display", "block");
- this.tabRightMove(tabs, lis, activeIndex);
- }
- else {
- lis.removeClass("tab_not_visible").addClass("tab_visible");
- tabs.find("li.adore_tab_space").css("display", "block");
- }
- tabs.find("div.indicator").remove();
- tabs.find("div.my_indicator").remove();
- var indicator = $("<div></div>").addClass("my_indicator");
- indicator.appendTo(tabs);
- this.resetIndicator(tabs, lis);
- this.resetMovingIcon(tabs, lis);
- };
- TabUtil.getActiveIndex = function (lis) {
- var activeIndex = 0;
- for (var i = 0; i < lis.length; i++) {
- if ($(lis[i]).find("a.active").length != 0) {
- activeIndex = i;
- break;
- }
- }
- return activeIndex;
- };
- TabUtil.resetIndicator = function (tabs, lis) {
- var indicatorLeft = this.getIndicatorLeftWidth(tabs, lis);
- var indicator = tabs.find("div.my_indicator");
- if (indicatorLeft === -1) {
- indicator.width(0);
- return;
- }
- var index = this.getActiveIndex(lis);
- indicator.width($(lis[index]).width() + "px");
- indicator.css("left", indicatorLeft + "px");
- };
- TabUtil.getIndicatorLeftWidth = function (tabs, lis) {
- var indexs = this.getBlockIndexs(tabs), activeIndex = this.getActiveIndex(lis), indicatorLeft = 0;
- if (activeIndex < indexs[0] || activeIndex > indexs[1]) {
- return -1;
- }
- if (tabs.find("li.tab_left_move").css("display") === "block") {
- indicatorLeft += this.movingLeftIconWidth;
- }
- else {
- indicatorLeft += this.totalWidthPrefix;
- }
- for (var i = indexs[0]; i < activeIndex; i++) {
- indicatorLeft += $(lis[i]).width();
- }
- return indicatorLeft;
- };
- TabUtil.init = function (tabs) {
- tabs.each(function () {
- var $this = $(this);
- var tabsId = $this.attr("id");
- var ownId = tabsId;
- if (ownId) {
- ownId = ownId.substring(0, ownId.length - 5);
- }
- $this.width('100%');
- var $active, $content, $links = $this.find('li.adore_tab a'), $tabs_width = $this.width(), $tab_width = $this.find('li').first().outerWidth(), $index = 0;
- $active = $($links.filter('[href="' + location.hash + '"]'));
- if ($active.length === 0) {
- $active = $(this).find('li.adore_tab a.active').first();
- }
- if ($active.length === 0) {
- $active = $(this).find('li.adore_tab a').first();
- }
- $active.addClass('active');
- $index = $links.index($active);
- if ($index < 0) {
- $index = 0;
- }
- $content = $($active[0].hash);
- $this.append("<div class=\"indicator\"></div>");
- var $indicator = $this.find('.indicator');
- if ($this.is(":visible")) {
- $indicator.css({ "right": $tabs_width - (($index + 1) * $tab_width) });
- $indicator.css({ "left": $index * $tab_width });
- }
- var resizeListener = tabs.data("resize_listener");
- if (!resizeListener) {
- resizeListener = function () {
- $tabs_width = $this.width();
- $tab_width = $this.find('li').first().outerWidth();
- if ($index < 0) {
- $index = 0;
- }
- if ($tab_width !== 0 && $tabs_width !== 0) {
- $indicator.css({ "right": $tabs_width - (($index + 1) * $tab_width) });
- $indicator.css({ "left": $index * $tab_width });
- }
- };
- tabs.data("resize_listener", resizeListener);
- $(window).on("resize", resizeListener);
- }
- $links.not($active).each(function () {
- $(this.hash).removeClass("tab_control_visible").addClass("tab_control_not_visible");
- });
- var clickListener = $this.data("click_listener");
- if (!clickListener) {
- clickListener = function (e) {
- if ($(this).parent().hasClass('disabled')) {
- e.preventDefault();
- return;
- }
- $tabs_width = $this.width();
- $tab_width = $this.find('li').first().outerWidth();
- $active.removeClass('active');
- $content.removeClass("tab_control_visible").addClass("tab_control_not_visible");
- $active = $(this);
- $content = $(this.hash);
- $links = $this.find('li.adore_tab a');
- $active.addClass('active');
- var $prev_index = $index;
- $index = $links.index($(this));
- if ($index < 0) {
- $index = 0;
- }
- $content.removeClass("tab_control_not_visible").addClass("tab_control_visible");
- if (($index - $prev_index) >= 0) {
- $indicator.velocity({ "right": $tabs_width - (($index + 1) * $tab_width) }, {
- duration: 300,
- queue: false,
- easing: 'easeOutQuad'
- });
- $indicator.velocity({ "left": $index * $tab_width }, {
- duration: 300,
- queue: false,
- easing: 'easeOutQuad',
- delay: 90
- });
- }
- else {
- $indicator.velocity({ "left": $index * $tab_width }, {
- duration: 300,
- queue: false,
- easing: 'easeOutQuad'
- });
- $indicator.velocity({ "right": $tabs_width - (($index + 1) * $tab_width) }, {
- duration: 300,
- queue: false,
- easing: 'easeOutQuad',
- delay: 90
- });
- }
- if ($index !== $prev_index) {
- EventHub_7.EventHub.dispatchEvent(MessageType_8.MessageType.WIDGET, {
- id: ownId,
- selectedIndex: $index + "",
- evtType: Event_5.Event.ON_CHANGE
- });
- }
- e.preventDefault();
- };
- $this.data("click_listener", clickListener);
- $this.on('click', 'a', clickListener);
- }
- });
- };
- TabUtil.tabsSwitch = function (tabs) {
- this.init(tabs);
- };
- TabUtil.$tab_min_width = 60;
- TabUtil.movingIconWidth = 70;
- TabUtil.movingLeftIconWidth = 40;
- TabUtil.totalWidthPrefix = 30;
- return TabUtil;
- }());
- exports.TabUtil = TabUtil;
- });
- define("util/VisibilityChangeUtil", ["require", "exports"], function (require, exports) {
- "use strict";
- var VisibilityChangeUtil = (function () {
- function VisibilityChangeUtil() {
- }
- VisibilityChangeUtil.findValue = function (id) {
- for (var i = 0; i < VisibilityChangeUtil.visibilityListener.length; i++) {
- if (VisibilityChangeUtil.visibilityListener[i].key === id) {
- return VisibilityChangeUtil.visibilityListener[i];
- }
- }
- return null;
- };
- VisibilityChangeUtil.refresh = function () {
- if (VisibilityChangeUtil.visibilityRunning) {
- if (VisibilityChangeUtil.visibilityListener.length === 0) {
- VisibilityChangeUtil.visibilityRunning = false;
- }
- }
- else {
- if (VisibilityChangeUtil.visibilityListener.length !== 0) {
- VisibilityChangeUtil.visibilityRunning = true;
- setTimeout(VisibilityChangeUtil.handleVisibilityChanged, VisibilityChangeUtil.frequency);
- }
- }
- };
- VisibilityChangeUtil.handleVisibilityChanged = function () {
- if (VisibilityChangeUtil.visibilityRunning) {
- var copyVisibilityListener = VisibilityChangeUtil.visibilityListener.slice(0, VisibilityChangeUtil.visibilityListener.length);
- for (var i = 0; i < copyVisibilityListener.length; i++) {
- var oldVisible = copyVisibilityListener[i].visible;
- var element = $("#" + copyVisibilityListener[i].key);
- if (element.length === 0) {
- VisibilityChangeUtil.removeVisibilityListener($("<div></div>").attr("id", copyVisibilityListener[i].key));
- continue;
- }
- var visible = element.is(":visible");
- if (visible !== oldVisible) {
- copyVisibilityListener[i].visible = visible;
- for (var j = 0; j < copyVisibilityListener[i].callbacks.length; j++) {
- copyVisibilityListener[i].callbacks[j](visible);
- }
- }
- }
- setTimeout(VisibilityChangeUtil.handleVisibilityChanged, VisibilityChangeUtil.frequency);
- }
- };
- VisibilityChangeUtil.addVisibilityListener = function (element, callback) {
- var id = element.attr("id");
- if (id) {
- var value = VisibilityChangeUtil.findValue(id);
- if (!value) {
- VisibilityChangeUtil.visibilityListener.push({
- key: id,
- callbacks: [callback],
- visible: element.is(":visible")
- });
- VisibilityChangeUtil.refresh();
- }
- else {
- value.callbacks.push(callback);
- }
- }
- };
- VisibilityChangeUtil.removeVisibilityListener = function (element) {
- var id = element.attr("id");
- if (id) {
- var value = VisibilityChangeUtil.findValue(id);
- if (value) {
- VisibilityChangeUtil.visibilityListener.splice(VisibilityChangeUtil.visibilityListener.indexOf(value), 1);
- VisibilityChangeUtil.refresh();
- }
- }
- };
- VisibilityChangeUtil.visibilityListener = new Array();
- VisibilityChangeUtil.visibilityRunning = false;
- VisibilityChangeUtil.frequency = 400;
- return VisibilityChangeUtil;
- }());
- exports.VisibilityChangeUtil = VisibilityChangeUtil;
- });
- define("widget/AdoreLoading", ["require", "exports"], function (require, exports) {
- "use strict";
- var AdoreLoading = (function () {
- function AdoreLoading() {
- }
- AdoreLoading.show = function (args) {
- var parentId = args.parentId;
- var parentNode = $("#" + parentId);
- if (parentNode.length === 0) {
- return;
- }
- if (parentNode.children("div.adore-loading").length !== 0) {
- return;
- }
- var $templateNode = $(AdoreLoading.Template);
- $templateNode.attr("id", "AdoreLoading_" + parentId);
- $templateNode.appendTo(parentNode);
- $templateNode.height(parentNode[0].scrollHeight);
- var p = this.getPosition(parentNode[0]);
- var top = (parentNode.height() / 2 + p[0]).toFixed(0) + "px";
- var left = (parentNode.width() / 2 + p[1]).toFixed(0) + "px";
- $templateNode.find(".preloader-wrapper").css({ top: top, left: left });
- $("#AdoreLoading_" + parentId).on("click keyup keydown mouseup mousedown", function (e) {
- e.stopPropagation();
- });
- };
- AdoreLoading.destroy = function (attrs) {
- $("#" + attrs.parentId).children("div.adore-loading").remove();
- };
- AdoreLoading.getPosition = function (obj) {
- var pos = [0, 0];
- if (obj && obj.offsetParent) {
- while (obj && obj.offsetParent) {
- pos[0] += obj.offsetTop;
- pos[1] += obj.offsetLeft;
- obj = obj.offsetParent;
- }
- }
- return pos;
- };
- 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>";
- return AdoreLoading;
- }());
- exports.AdoreLoading = AdoreLoading;
- });
- 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) {
- "use strict";
- var AdoreShell = (function (_super) {
- __extends(AdoreShell, _super);
- function AdoreShell(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.$thisNode = $(AdoreShell.TemplateNormal).attr("id", this.id);
- this.$attachNode = this.$thisNode.find("div.modal-content");
- if ((this.style & ADORE_3.ADORE.Close) === ADORE_3.ADORE.Close) {
- var own_2 = this;
- var $cancleIconNode = $(AdoreShell.TemplateClose);
- $cancleIconNode.appendTo(this.$thisNode.find("div.adore_shell_title"));
- $cancleIconNode.bind("click", function () {
- EventHub_8.EventHub.dispatchEvent(MessageType_9.MessageType.WIDGET, { "id": own_2.id, evtType: Event_6.Event.ON_CLOSE });
- });
- }
- }
- AdoreShell.prototype.setTitle = function (args) {
- var text = args.title;
- this.$thisNode.find("h4")[0].innerHTML = text;
- };
- AdoreShell.prototype.show = function () {
- this.$thisNode.find(".adore_shell").css({
- display: "block",
- opacity: 0,
- scaleX: "0.7"
- });
- this.$thisNode.find(".adore_shell").velocity({ opacity: 1, scaleX: "1" }, {
- duration: 320,
- queue: false,
- ease: "easeOutCubic"
- });
- this.$thisNode.find(".myclass").css({
- "width": this.$thisNode.find(".adore_shell").width(),
- "height": this.$thisNode.find(".adore_shell").height(),
- "left": this.$thisNode.find(".adore_shell").offset().left,
- "top": this.$thisNode.find(".adore_shell").offset().top
- });
- if (this.cssStyle) {
- this.$thisNode.find(".adore_shell").css(this.cssStyle);
- this.cssStyle = null;
- }
- $(AdoreShell.TemplateOverlay).attr("id", this.id + "_overlay").appendTo(document.body);
- WidgetUtil_4.WidgetUtil.refreshDialogZIndex(this.$thisNode.find(".adore_shell")[0]);
- var width = this.$thisNode.find(".adore_shell").css("width");
- var height = this.$thisNode.find(".adore_shell").css("height");
- if ((width && width.indexOf("%") === -1) || (height && height.indexOf("%") === -1)) {
- this.originWidth = width;
- this.originHeight = height;
- this.refreshSize();
- var own_3 = this;
- this.resizeListener = function (e) {
- own_3.refreshSize();
- };
- $(window).on("resize", this.resizeListener);
- }
- if (height && height.indexOf("%") !== -1) {
- height = height.replace(/%/, "");
- if (height >= 90) {
- this.$thisNode.find(".adore_shell").addClass("adore_shell_max_height");
- }
- }
- };
- AdoreShell.prototype.refreshSize = function () {
- var css = {};
- var totalW = window.innerWidth;
- var totalH = window.innerHeight;
- if (this.originWidth && this.originWidth.indexOf("%") === -1) {
- var width = this.originWidth.replace(/px/g, "");
- if (width >= totalW) {
- css = $.extend(css, { width: "100%" });
- }
- else {
- css = $.extend(css, { width: (width / (totalW * 0.01)) + "%" });
- }
- }
- if (this.originHeight && this.originHeight.indexOf("%") === -1) {
- var height = this.originHeight.replace(/px/g, "");
- var hProportion = 0;
- if (height >= totalH) {
- hProportion = 100;
- css = $.extend(css, { height: "100%" });
- }
- else {
- hProportion = height / (totalH * 0.01);
- css = $.extend(css, {
- height: hProportion + "%"
- });
- }
- if (hProportion >= 90) {
- this.$thisNode.find(".adore_shell").addClass("adore_shell_max_height");
- }
- else {
- this.$thisNode.find(".adore_shell").removeClass("adore_shell_max_height");
- }
- }
- this.$thisNode.find(".adore_shell").css(css);
- this.$thisNode.find(".myclass").css({
- "width": this.$thisNode.find(".adore_shell").width(),
- "height": this.$thisNode.find(".adore_shell").height(),
- "left": this.$thisNode.find(".adore_shell").offset().left,
- "top": this.$thisNode.find(".adore_shell").offset().top
- });
- };
- AdoreShell.prototype.dispose = function () {
- $("#" + this.id + "_overlay").remove();
- if (this.resizeListener) {
- $(window).off("resize", this.resizeListener);
- }
- _super.prototype.dispose.call(this);
- };
- AdoreShell.prototype.postLayout = function () {
- _super.prototype.postLayout.call(this);
- };
- 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>";
- AdoreShell.TemplateOverlay = "<div class=\"adore_lean_overlay\"></div>";
- AdoreShell.TemplateClose = "<div class=\"adore_shell_exit_button waves-effect waves-light large mdi-content-clear\"></div>";
- return AdoreShell;
- }(Composite_3.Composite));
- exports.AdoreShell = AdoreShell;
- });
- define("widget/Audio", ["require", "exports", "widget/Widget"], function (require, exports, Widget_5) {
- "use strict";
- var Audio = (function (_super) {
- __extends(Audio, _super);
- function Audio(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.$thisNode = $(Audio.Template).attr("id", this.id);
- this.$audioNode = this.$thisNode.find("audio");
- var audio = this.$audioNode.get(0);
- var own = this;
- audio.onended = function () {
- own.$thisNode.remove();
- };
- }
- Audio.prototype.setAudioPath = function (args) {
- var src = args.src;
- this.$audioNode.attr("src", src);
- };
- Audio.prototype.start = function () {
- var audio = this.$audioNode.get(0);
- if (audio.paused) {
- audio.play();
- }
- };
- Audio.prototype.stop = function () {
- var audio = this.$audioNode.get(0);
- if (!audio.paused) {
- audio.pause();
- audio.currentTime = 0;
- }
- };
- Audio.prototype.layout = function () {
- this.append();
- };
- Audio.Template = "<div><audio></audio></div>";
- return Audio;
- }(Widget_5.Widget));
- exports.Audio = Audio;
- });
- 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) {
- "use strict";
- var Button = (function (_super) {
- __extends(Button, _super);
- function Button(parentId, id, style) {
- var _this = this;
- _super.call(this, parentId, id, style);
- this.isFloat = false;
- this.isLarge = false;
- if ((this.style & ADORE_4.ADORE.Float) === ADORE_4.ADORE.Float) {
- this.$thisNode = $(Button.TemplateFloat).attr({ id: this.id });
- this.$btnNode = this.$thisNode.find("a").attr({ id: this.id });
- this.isFloat = true;
- }
- else if ((this.style & ADORE_4.ADORE.Flat) === ADORE_4.ADORE.Flat) {
- this.$thisNode = $(Button.TemplateFlat).attr({ id: this.id });
- this.$btnNode = this.$thisNode;
- }
- else if ((this.style & ADORE_4.ADORE.Normal) === ADORE_4.ADORE.Normal) {
- this.$thisNode = $(Button.TemplateNormal).attr({ id: this.id });
- this.$btnNode = this.$thisNode;
- }
- if ((this.style & ADORE_4.ADORE.Large) === ADORE_4.ADORE.Large) {
- this.$btnNode.addClass("btn-large");
- this.isLarge = true;
- }
- var own = this;
- this.$btnNode.on("click", function (e) {
- if (_this.enabled) {
- EventHub_9.EventHub.dispatchEvent(MessageType_10.MessageType.WIDGET, { id: _this.id, evtType: Event_7.Event.CLICK });
- }
- }).on("focus", function (e) {
- if (_this.enabled) {
- _this.sendFocusGain();
- }
- });
- }
- Button.prototype.setFocus = function () {
- if (document.activeElement !== this.$btnNode[0]) {
- this.$btnNode.focus();
- }
- };
- Button.prototype.setTooltip = function (args) {
- this.tooltip = args.tooltip;
- this.$thisNode.attr("data-tooltip", this.tooltip);
- this.$thisNode.tooltip({ delay: 50 });
- };
- Button.prototype.setEnabled = function (args) {
- _super.prototype.setEnabled.call(this, args);
- if (this.enabled) {
- this.$thisNode.removeClass("disabled");
- }
- else {
- this.$thisNode.addClass("disabled");
- }
- };
- Button.prototype.setText = function (args) {
- this.text = args.text;
- this.$btnNode.find("span").text(this.text);
- this.adjustInternalLayout();
- };
- Button.prototype.setIcon = function (args) {
- this.icon = args.icon;
- this.$btnNode.find("i").attr("class", this.icon);
- if (this.isLarge) {
- this.$btnNode.find("i").css("font-size", "3rem");
- }
- this.adjustInternalLayout();
- };
- Button.prototype.adjustInternalLayout = function () {
- if (this.icon && this.text) {
- this.$btnNode.find("span").addClass("adore_button_span");
- this.$btnNode.find("i").addClass("adore_button_icon");
- }
- else {
- this.$btnNode.find("span").removeClass("adore_button_span");
- this.$btnNode.find("i").removeClass("adore_button_icon");
- }
- };
- Button.prototype.postLayout = function () {
- window.Waves.displayEffect({ id: this.id });
- };
- Button.prototype.css = function (args) {
- if (this.isFloat) {
- this.$btnNode.css(args.cssStyle);
- }
- else {
- _super.prototype.css.call(this, args);
- }
- };
- Button.prototype.refreshToolbar = function (children) {
- children.postLayout();
- var childCls = children.$btnNode[1].className
- .replace("waves-effect btn-flat adore_button adore_button_flat btn-large", "");
- children.$btnNode.removeClass(childCls).addClass("adore_toolbar_color");
- };
- 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>";
- 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>";
- 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>";
- return Button;
- }(Widget_6.Widget));
- exports.Button = Button;
- });
- define("widget/CalendarCombo", ["require", "exports", "widget/Widget", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, Widget_7, EventHub_10, MessageType_11, Event_8) {
- "use strict";
- var CalendarCombo = (function (_super) {
- __extends(CalendarCombo, _super);
- function CalendarCombo(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.defaultPattern = "yyyymmmmdd";
- this.$thisNode = $(CalendarCombo.template).attr("id", this.id);
- this.$dateNode = this.$thisNode.find("input");
- this.dateElement = this.$dateNode.get(0);
- var own = this;
- this.dateElement.readOnly = true;
- this.$dateNode.on("change", function (e) {
- own.handleInput();
- });
- this.$dateNode.on("focus", function (e) {
- if (!own.isHadFocusGain()) {
- own.setHadFocusGain(true);
- own.sendFocusGain();
- }
- else {
- e.preventDefault();
- }
- own.handleFocus();
- });
- this.$thisNode.on("blur", function (e) {
- own.setHadFocusGain(false);
- own.handleBlur();
- });
- this.$dateNode.attr("id", this.id + "_date");
- this.$thisNode.find("label").attr("for", this.id + "_date");
- this.hadFocusGain = false;
- this.isLayout = false;
- this.enabled = true;
- this.hadCloseDatePicker = true;
- this.pattern = this.defaultPattern;
- }
- CalendarCombo.prototype.handleInput = function () {
- var date;
- var charNum;
- var charIndexOfMonthIcon;
- charIndexOfMonthIcon = this.dateElement.value.indexOf("月");
- date = this.dateElement.value.replace("月", "");
- charNum = date.length;
- if (charNum % 2 === 1) {
- var leftPartOfDate = date.slice(0, charIndexOfMonthIcon - 1);
- var rightPartOfDate = date.slice(charIndexOfMonthIcon - 1);
- date = leftPartOfDate + "0" + rightPartOfDate;
- }
- this.setText({ text: date });
- EventHub_10.EventHub.dispatchEvent(MessageType_11.MessageType.WIDGET, {
- id: this.id,
- text: date,
- evtType: Event_8.Event.MODIFY,
- syncAttrName: "text"
- });
- };
- CalendarCombo.prototype.postLayout = function () {
- var tmp = this.pattern;
- this.$dateNode.pickadate({
- selectMonths: true,
- selectYears: 30,
- format: tmp,
- monthsFull: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"],
- monthsShort: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
- weekdaysFull: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"],
- today: "今天",
- clear: "清除",
- close: "关闭"
- });
- this.isLayout = true;
- this.setText({ text: this.text });
- var own = this;
- this.$dateNode.on("close", function () {
- own.handleFocus();
- own.handleClose();
- own.setHadFocusGain(true);
- });
- this.$dateNode.on("open", function () {
- own.handleOpen();
- own.setHadFocusGain(true);
- });
- };
- CalendarCombo.prototype.isHadFocusGain = function () {
- return this.hadFocusGain;
- };
- CalendarCombo.prototype.setHadFocusGain = function (hadFocusGain) {
- this.hadFocusGain = hadFocusGain;
- };
- CalendarCombo.prototype.handleFocus = function () {
- this.$dateNode.addClass("adore_calendar_combo_focus");
- this.$dateNode.siblings("label").addClass("adore_calendar_combo_label_focus");
- this.$dateNode.siblings("label, i").addClass("active");
- this.$thisNode.focus();
- this.setText({ text: this.text });
- };
- CalendarCombo.prototype.handleClose = function () {
- this.hadCloseDatePicker = true;
- };
- CalendarCombo.prototype.handleOpen = function () {
- this.hadCloseDatePicker = false;
- };
- CalendarCombo.prototype.handleBlur = function () {
- this.$dateNode.removeClass("adore_calendar_combo_focus");
- this.$dateNode.siblings("label").removeClass("adore_calendar_combo_label_focus");
- var val = this.$dateNode.val();
- this.setText({ text: val });
- };
- CalendarCombo.prototype.setText = function (args) {
- this.text = args.text;
- if (this.isLayout) {
- this.dateElement.value = this.text;
- if (this.text && this.text.length > 0) {
- this.$dateNode.siblings("label,i").addClass("active");
- }
- else {
- this.$dateNode.siblings("label, i").removeClass("active");
- }
- }
- if (this.requisite) {
- if (args.text === null || args.text === "") {
- this.addRequisite();
- }
- else {
- this.removeRequisite();
- }
- }
- };
- CalendarCombo.prototype.setRequisite = function (args) {
- this.requisite = args.requisite;
- var tempText = this.text;
- this.setText({ text: tempText });
- };
- CalendarCombo.prototype.setIcon = function (args) {
- this.$thisNode.find("i").attr("class", args.icon);
- };
- CalendarCombo.prototype.setName = function (args) {
- this.$thisNode.find("label").text(args.name);
- };
- CalendarCombo.prototype.setEnabled = function (args) {
- this.enabled = args.enabled;
- if (this.enabled) {
- this.$thisNode.find("input").removeAttr("disabled");
- this.$thisNode.find("i").removeClass("icon_disabled");
- this.$thisNode.find("label").removeClass("adore_calendar_combo_label_disable");
- }
- else {
- this.$thisNode.find("input").attr("disabled", "disabled");
- this.$thisNode.find("i").addClass("icon_disabled");
- this.$thisNode.find("label").addClass("adore_calendar_combo_label_disable");
- }
- };
- CalendarCombo.prototype.setPattern = function (args) {
- this.pattern = args.pattern;
- this.pattern = this.pattern.replace("MM", "mmmm");
- if (this.pattern.length !== 12 && this.pattern.length !== 10) {
- this.pattern = this.defaultPattern;
- }
- else if (this.pattern.replace("yyyy", "").replace("mmmm", "").replace("dd", "").length !== 0 &&
- this.pattern.replace("yyyy", "").replace("mmmm", "").replace("dd", "").length !== 2) {
- this.pattern = this.defaultPattern;
- }
- var tmp = this.pattern;
- if (this.isLayout) {
- this.$dateNode.pickadate({
- format: tmp
- });
- }
- };
- CalendarCombo.prototype.setFocus = function () {
- if (this.hadFocusGain) {
- return;
- }
- if (this.hadCloseDatePicker && document.activeElement !== this.$dateNode[0]) {
- this.$dateNode.focus();
- }
- };
- CalendarCombo.prototype.handleKeyDownEvent = function (e, hasFilter) {
- if (this.hadCloseDatePicker) {
- _super.prototype.handleKeyDownEvent.call(this, e, hasFilter);
- }
- };
- CalendarCombo.prototype.handleKeyUpEvent = function (e) {
- if (this.hadCloseDatePicker) {
- _super.prototype.handleKeyUpEvent.call(this, e);
- }
- };
- CalendarCombo.prototype.addRequisite = function () {
- if (this.enabled) {
- this.$dateNode.addClass("adore_InputRequisite");
- this.$dateNode.siblings("label").addClass("adore_requisiteColor");
- this.$dateNode.siblings("i").addClass("adore_requisiteColor");
- this.$dateNode.removeClass("adore_calendar_combo_focus");
- this.$dateNode.siblings("label").removeClass("adore_calendar_combo_label_focus");
- }
- };
- CalendarCombo.prototype.removeRequisite = function () {
- this.$dateNode.removeClass("adore_InputRequisite");
- this.$dateNode.siblings("label").removeClass("adore_requisiteColor");
- this.$dateNode.siblings("i").removeClass("adore_requisiteColor");
- if (this.enabled && this.hadFocusGain) {
- this.$dateNode.addClass("adore_calendar_combo_focus");
- this.$dateNode.siblings("label").addClass("adore_calendar_combo_label_focus");
- }
- };
- 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 ";
- return CalendarCombo;
- }(Widget_7.Widget));
- exports.CalendarCombo = CalendarCombo;
- });
- define("widget/cef/ACefNativeWindow", ["require", "exports", "widget/Widget"], function (require, exports, Widget_8) {
- "use strict";
- var ACefNativeWindow = (function (_super) {
- __extends(ACefNativeWindow, _super);
- function ACefNativeWindow(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.hadWindowHandle = false;
- this.$thisNode = $(ACefNativeWindow.Template).attr({ id: this.id });
- this.$plugin = this.$thisNode.find("embed");
- }
- ACefNativeWindow.prototype.setHandle = function (args) {
- this.windowHandle = args.handle;
- if ($("#" + this.id).length !== 0) {
- if (this.windowHandle === 0 || this.windowHandle) {
- try {
- this.$plugin[0].setHandle(this.windowHandle);
- this.hadWindowHandle = true;
- }
- catch (e) {
- console.error(e);
- }
- }
- }
- };
- ACefNativeWindow.prototype.postLayout = function () {
- _super.prototype.postLayout.call(this);
- if ((this.windowHandle === 0 || this.windowHandle) && !this.hadWindowHandle) {
- if ($("#" + this.id).length !== 0) {
- setTimeout(this.setHandle({ handle: this.windowHandle }), 300);
- }
- else {
- var count_1 = 0;
- var own_4 = this;
- var func_1 = function () {
- if ($("#" + own_4.id).length !== 0) {
- own_4.setHandle({ handle: own_4.windowHandle });
- }
- else {
- count_1++;
- if (count_1 < 5) {
- setTimeout(func_1(), 500);
- }
- }
- };
- setTimeout(func_1, 300);
- }
- }
- };
- ACefNativeWindow.Template = "\n <div>\n <embed width=\"100%\" height=\"100%\" type=\"application/x-nativewindow\"></embed>\n </div>";
- return ACefNativeWindow;
- }(Widget_8.Widget));
- exports.ACefNativeWindow = ACefNativeWindow;
- });
- 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) {
- "use strict";
- var CheckButton = (function (_super) {
- __extends(CheckButton, _super);
- function CheckButton(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.isSwitch = false;
- if ((ADORE_5.ADORE.Switch & style) === ADORE_5.ADORE.Switch) {
- this.$thisNode = $(CheckButton.template1).attr("id", this.id);
- this.isSwitch = true;
- }
- else {
- this.$thisNode = $(CheckButton.template0).attr("id", this.id);
- }
- var tmpId = this.id;
- this.$thisNode.find("input[type=checkbox]").attr("id", this.id + "_checkbox").on("change", function (e) {
- EventHub_11.EventHub.dispatchEvent(MessageType_12.MessageType.WIDGET, {
- id: tmpId,
- checked: this.checked + "",
- evtType: Event_9.Event.ON_CHANGE,
- syncAttrName: this.checked
- });
- });
- if (this.isSwitch === false) {
- this.$thisNode.find("label").attr("for", this.id + "_checkbox");
- }
- var own = this;
- this.$thisNode.find("input").on("focus", function (e) {
- own.sendFocusGain();
- }).on("blur", function (e) {
- own.handleBlur();
- });
- }
- CheckButton.prototype.setName = function (args) {
- if (this.isSwitch === false) {
- this.$thisNode.find("label").text(args.name);
- }
- };
- CheckButton.prototype.setGroupName = function (args) {
- this.groupName = args.group;
- this.$thisNode.find("input").attr("name", this.groupName);
- };
- CheckButton.prototype.setChecked = function (args) {
- var isChecked = args.isChecked;
- var checked = this.$thisNode.find("input")[0].checked;
- if (isChecked !== checked) {
- if (this.enabled === false) {
- this.$thisNode.find("input").removeAttr("disabled");
- this.$thisNode.find("input").click();
- this.$thisNode.find("input").attr("disabled", "disabled");
- }
- else {
- this.$thisNode.find("input").click();
- }
- }
- };
- CheckButton.prototype.setEnabled = function (args) {
- this.enabled = args.enabled;
- if (this.enabled) {
- this.$thisNode.find("input").removeAttr("disabled");
- }
- else {
- this.$thisNode.find("input").attr("disabled", "disabled");
- }
- };
- CheckButton.prototype.handleBlur = function () {
- this.$thisNode.find("label").removeClass("adore_check_button_focus_label");
- };
- CheckButton.prototype.setFocus = function () {
- var inputNode = this.$thisNode.find("input");
- if (document.activeElement !== inputNode[0]) {
- inputNode.focus();
- }
- this.$thisNode.find("label").addClass("adore_check_button_focus_label");
- };
- CheckButton.prototype.handleKeyDownEvent = function (e, hasFilter) {
- if (e.keyCode === Keys_5.Keys.SPACE || e.keyCode === Keys_5.Keys.ENTER || e.keyCode === Keys_5.Keys.NUMPAD_ENTER) {
- this.$thisNode.find("input").click();
- e.preventDefault();
- return;
- }
- _super.prototype.handleKeyDownEvent.call(this, e, hasFilter);
- };
- CheckButton.prototype.handleKeyUpEvent = function (e) {
- if (e.keyCode === Keys_5.Keys.SPACE || e.keyCode === Keys_5.Keys.ENTER || e.keyCode === Keys_5.Keys.NUMPAD_ENTER) {
- return;
- }
- _super.prototype.handleKeyUpEvent.call(this, e);
- };
- CheckButton.template0 = "<div class=\"adore_check_button\">\n <input type=\"checkbox\" tabindex=\"-1\"/>\n <label></label>\n </div>";
- CheckButton.template1 = "<div class=\"switch\">\n <label>\n <input type=\"checkbox\" tabindex=\"-1\">\n <span class=\"lever\"></span>\n </label>\n </div>";
- return CheckButton;
- }(Widget_9.Widget));
- exports.CheckButton = CheckButton;
- });
- define("widget/Clock", ["require", "exports", "widget/Widget", "ADORE"], function (require, exports, Widget_10, ADORE_6) {
- "use strict";
- var Clock = (function (_super) {
- __extends(Clock, _super);
- function Clock(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.clockHeight = 300;
- this.DefaultClockSideLengthGS = 300;
- if (style === ADORE_6.ADORE.Normal) {
- this.$thisNode = $(Clock.ClockTemplateLS).attr({ id: this.id });
- this.$clockNode = this.$thisNode.find("nobr");
- this.setFontSize = this.setFontSizeLS;
- this.setAlignment = this.setAlignmentLS;
- this.startRedrawClock = this.startRedrawClockLS;
- this.setClockHeight = function (args) { };
- this.startRedrawClock();
- }
- else if ((style & ADORE_6.ADORE.Graphics) === ADORE_6.ADORE.Graphics) {
- this.$thisNode = $(Clock.ClockTemplateGS).attr({ id: this.id });
- this.setFontSize = function (args) { };
- this.setAlignment = function (args) { };
- this.startRedrawClock = function () { };
- this.setClockHeight = this.setClockHeightGS;
- }
- this.dispose = this.disposeClock;
- }
- Clock.prototype.setFontSizeLS = function (args) {
- this.$clockNode.css({ fontSize: args.fontSize });
- };
- Clock.prototype.setAlignmentLS = function (args) {
- this.$clockNode.css({ textAlign: args.alignment });
- };
- Clock.prototype.startRedrawClockLS = function () {
- var own = this;
- this.intervalId = setInterval(function () { own.redrawClockOnceLS(own); }, 1000);
- };
- Clock.prototype.redrawClockOnceLS = function (own) {
- var currentDate = new Date();
- var clockText;
- clockText = currentDate.getFullYear() + "-" + (+currentDate.getMonth() + 1) + "-" + currentDate.getDate() + " " + currentDate.getHours() + ":" + currentDate.getMinutes() + ":" + currentDate.getSeconds();
- own.$clockNode.get(0).innerHTML = clockText;
- };
- Clock.prototype.createClockPanelGS = function () {
- var mainGS = this.$thisNode.find(".clock-GS-main");
- var bodyGS = this.$thisNode.find(".clock-GS-body");
- var panelGS = this.$thisNode.find(".clock-GS-panel");
- var own = this;
- this.$thisNode.css("height", this.clockHeight + "px");
- var shortSideLength = Math.min(this.$thisNode.get(0).clientWidth, this.$thisNode.get(0).clientHeight);
- mainGS.css({ width: this.DefaultClockSideLengthGS + "px", height: this.DefaultClockSideLengthGS + "px" });
- mainGS.css("transform", "scale(" + (shortSideLength / this.DefaultClockSideLengthGS) + ")");
- var createMinuteLine = function (angle) {
- var anchor = $("<div>").add("clock-GS-anchor");
- var minuteLine = $("<div>").addClass("clock-GS-minuteLine");
- var radius = own.DefaultClockSideLengthGS / 2 * 0.8;
- anchor.css("transform", "rotate(" + angle + "deg)");
- minuteLine.css("transform", "translate(-50%,-100%) translateY(-" + radius + "px)");
- anchor.append(minuteLine);
- panelGS.append(anchor);
- };
- var createMinuteText = function (angle) {
- var minuteText = $("<div>").addClass("clock-GS-minuteText");
- var radius = own.DefaultClockSideLengthGS / 2 * 0.84;
- var topOffset = 0 - Math.cos(angle * Math.PI / 180) * radius;
- var leftOffset = Math.sin(angle * Math.PI / 180) * radius;
- minuteText.get(0).innerHTML = "" + angle / 6;
- minuteText.css({ top: topOffset + "px", left: leftOffset + "px" });
- panelGS.append(minuteText);
- };
- var createHourText = function (angle) {
- var hourText = $("<div>").addClass("clock-GS-hourText clock-GS-hour" + angle / 30);
- var radius = own.DefaultClockSideLengthGS / 2 * 0.65;
- var topOffset = 0 - Math.cos(angle * Math.PI / 180) * radius;
- var leftOffset = Math.sin(angle * Math.PI / 180) * radius;
- hourText.get(0).innerHTML = "" + angle / 30;
- hourText.css({ top: topOffset + "px", left: leftOffset + "px" });
- panelGS.append(hourText);
- };
- for (var angle = 1; angle <= 360; angle++) {
- if (angle % 6 === 0) {
- if (angle % 30 === 0) {
- createMinuteText(angle);
- createHourText(angle);
- }
- else {
- createMinuteLine(angle);
- }
- }
- }
- };
- Clock.prototype.createClockAnchorGS = function () {
- var hourAnchor = this.$thisNode.find(".clock-GS-hour-anchor");
- var minuterAnchor = this.$thisNode.find(".clock-GS-minute-anchor");
- var secondAnchor = this.$thisNode.find(".clock-GS-second-anchor");
- var now = new Date();
- var seconds = (now.getHours() >= 12 ? now.getHours() - 12 : now.getHours()) * 3600 + now.getMinutes() * 60 + now.getSeconds();
- var hourRotateAngle = seconds / 120;
- var minuteRotateAngle = (seconds / 10) % 360;
- var secondRotateAngle = (seconds * 6) % 360;
- hourAnchor.css("transform", "rotate(" + hourRotateAngle + "deg)");
- minuterAnchor.css("transform", "rotate(" + minuteRotateAngle + "deg)");
- secondAnchor.css("transform", "rotate(" + secondRotateAngle + "deg)");
- };
- Clock.prototype.setClockHeightGS = function (args) {
- this.clockHeight = args.height;
- this.$thisNode.css("height", this.clockHeight + "px");
- var shortSideLength = Math.min(this.$thisNode.get(0).clientWidth, this.$thisNode.get(0).clientHeight);
- if (shortSideLength !== 0) {
- this.$thisNode.find(".clock-GS-panel").css("transform", "scale(" + shortSideLength / this.DefaultClockSideLengthGS + ")");
- }
- };
- Clock.prototype.postLayout = function () {
- this.createClockPanelGS();
- this.createClockAnchorGS();
- };
- Clock.prototype.disposeClock = function () {
- if (this.intervalId) {
- clearInterval(this.intervalId);
- }
- _super.prototype.dispose.call(this);
- };
- 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 ";
- 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 ";
- return Clock;
- }(Widget_10.Widget));
- exports.Clock = Clock;
- });
- 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) {
- "use strict";
- var DateText = (function (_super) {
- __extends(DateText, _super);
- function DateText(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.$thisNode = $(DateText.TemplateCotainer).attr({ id: this.id + "_containerNode" });
- var own = this;
- this.maxLength = 8;
- this.$thisNode.find("input").attr("id", this.id).on("input", function (e) {
- own.handleOnInput();
- EventHub_12.EventHub.dispatchEvent(MessageType_13.MessageType.WIDGET, {
- id: id,
- text: $(this).val(),
- evtType: Event_10.Event.MODIFY,
- syncAttrName: "text"
- });
- }).on('focus', function () {
- own.sendFocusGain();
- SoftwareKeyboardUtil_2.SoftwareKeyboardUtil.refresh();
- }).on('blur', function () {
- own.checkRequisite();
- own.handleOnBlur();
- });
- }
- DateText.prototype.handleOnInput = function () {
- this.maxLengthValidator.handleModifyEvent();
- this.checkRequisite();
- if (!this.format) {
- this.format = "yyyy-MM-dd";
- }
- var content = this.$thisNode.find("input").val();
- if (content.length === 8) {
- var year = content.substr(0, 4);
- var month = content.substr(4, 2);
- var day = content.substr(6, 2);
- var date = new Date(year + "," + month + "," + day);
- if (date.toString().indexOf("Invalid") === -1) {
- var format_date = this.format;
- format_date = format_date.replace(/yyyy/, year).replace(/MM/, month).replace(/dd/, day);
- this.$thisNode.find("input").val(format_date);
- this.maxLengthValidator.setMaxLength(this.format.length);
- }
- }
- };
- DateText.prototype.handleOnBlur = function () {
- var $inputNode = this.$thisNode.find("input");
- if (!this.format) {
- this.format = "yyyy-MM-dd";
- }
- var content = $inputNode.val();
- if (content !== null) {
- if (content === "19000101" || content === "") {
- return;
- }
- else if (content.length >= 8) {
- var year = void 0, month = void 0, day = void 0;
- if (content.indexOf("-") !== -1) {
- var dateArray1 = content.split("-");
- year = dateArray1[0];
- month = dateArray1[1];
- day = dateArray1[2];
- }
- else if (content.indexOf("/") !== -1) {
- var dateArray2 = content.split("/");
- year = dateArray2[0];
- month = dateArray2[1];
- day = dateArray2[2];
- }
- else if (content.indexOf(".") === -1) {
- year = content.substr(0, 4);
- month = content.substr(4, 2);
- day = content.substr(6, 2);
- }
- var date = new Date(year + "," + month + "," + day);
- if (year !== "" && month !== "" && day !== "" && date.toString().indexOf("Invalid") === -1) {
- var format_date = this.format;
- format_date = format_date.replace(/yyyy/, year).replace(/MM/, month).replace(/dd/, day);
- $inputNode.val(format_date);
- return;
- }
- }
- }
- this.showSpan("输入有误,请重新输入!");
- this.$thisNode.find("input").focus();
- };
- DateText.prototype.checkRequisite = function () {
- if (this.requisite) {
- var inputSelector = this.$thisNode.find("input");
- var value = inputSelector.val();
- if (value) {
- this.removeRequisite();
- }
- else {
- this.addRequisite();
- this.showSpan("请输入数据!");
- }
- }
- };
- DateText.prototype.setRequisite = function (args) {
- this.requisite = args.requisite;
- if (this.requisite) {
- if (this.$thisNode.find("input").val()) {
- this.removeRequisite();
- }
- else {
- this.addRequisite();
- }
- }
- };
- DateText.prototype.setEnabled = function (args) {
- var enabled = args.enabled;
- var input = this.$thisNode.find("input");
- if (enabled) {
- input.removeAttr("disabled");
- this.$thisNode.find("i").removeClass("icon_disabled");
- if (this.requisite) {
- if (input.val() === null || input.val() === "") {
- this.addRequisite();
- }
- }
- }
- else {
- this.$thisNode.find("input").attr("disabled", "disabled");
- if (this.requisite) {
- this.removeRequisite();
- }
- this.$thisNode.find("i").addClass("icon_disabled");
- }
- };
- DateText.prototype.addRequisite = function () {
- this.$thisNode.find("input").addClass("adore_InputRequisite");
- this.$thisNode.find("label").addClass("adore_requisiteColor");
- this.$thisNode.find("i").addClass("adore_requisiteColor");
- };
- DateText.prototype.removeRequisite = function () {
- this.$thisNode.find("input").removeClass("adore_InputRequisite");
- this.$thisNode.find("label").removeClass("adore_requisiteColor");
- this.$thisNode.find("i").removeClass("adore_requisiteColor");
- };
- DateText.prototype.handleKeyDownEvent = function (e, hasFilter) {
- if (e.keyCode !== Keys_6.Keys.SHIFT && e.keyCode !== Keys_6.Keys.TAB
- && e.keyCode !== Keys_6.Keys.ENTER && e.keyCode !== Keys_6.Keys.LEFT_ARROW
- && e.keyCode !== Keys_6.Keys.UP_ARROW && e.keyCode !== Keys_6.Keys.RIGHT_ARROW
- && 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)
- && (e.keyCode < Keys_6.Keys.NUMPAD_0 || e.keyCode > Keys_6.Keys.NUMPAD_9)) {
- e.preventDefault();
- }
- var value = this.$thisNode.find("input").val();
- if (value.length > 8 && e.keyCode === Keys_6.Keys.BACKSPACE) {
- value = value.replace(/-/g, "").replace(/\//g, "");
- this.$thisNode.find("input").val(value);
- this.maxLengthValidator.setMaxLength(this.maxLength);
- }
- _super.prototype.handleKeyDownEvent.call(this, e, hasFilter);
- };
- DateText.prototype.setMaxLength = function (args) {
- this.maxLength = args.maxLength;
- };
- DateText.prototype.handleMaxLength = function () {
- var textNode = this.$thisNode.find("input")[0];
- this.maxLengthValidator = new MaxLengthValidator_2.MaxLengthValidator(this.id, textNode, this.maxLength);
- };
- DateText.prototype.setText = function (args) {
- var inputNode = this.$thisNode.find("input");
- inputNode.val(args.text);
- if (args.text.length > 0) {
- inputNode.siblings('label, i').addClass('active');
- }
- else {
- inputNode.siblings('label, i').removeClass('active');
- }
- };
- DateText.prototype.showSpan = function (msg) {
- if (this.$thisNode.find("span").css("display") === "none") {
- this.$thisNode.find("span").html(msg).show().delay(2000).fadeOut(300);
- }
- };
- DateText.prototype.setIcon = function (args) {
- this.$thisNode.find("i").addClass(args.icon);
- if (this.$thisNode.find("input").val().length > 0) {
- this.$thisNode.find("input").siblings("label, i").addClass("active");
- }
- this.$thisNode.find("span").addClass("span_prefix");
- };
- DateText.prototype.setFocus = function () {
- if (document.activeElement !== this.$thisNode.find("input")[0]) {
- this.$thisNode.find("input").focus();
- }
- };
- DateText.prototype.setName = function (args) {
- this.$thisNode.find("label").text(args.name);
- };
- DateText.prototype.setFormat = function (args) {
- this.format = args.format;
- };
- DateText.prototype.postLayout = function () {
- _super.prototype.postLayout.call(this);
- this.handleMaxLength();
- };
- DateText.TemplateCotainer = "\n <div class=\"input-field\">\n <input type=\"text\">\n <label></label>\n <span class=\"span_base\"></span>\n </div>\n ";
- return DateText;
- }(Widget_11.Widget));
- exports.DateText = DateText;
- });
- define("widget/DrawerMenu", ["require", "exports", "widget/Widget", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, Widget_12, EventHub_13, MessageType_14, Event_11) {
- "use strict";
- var DrawerMenu = (function (_super) {
- __extends(DrawerMenu, _super);
- function DrawerMenu(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.$thisNode = $(DrawerMenu.Template).attr("id", this.id);
- this.contentOne = new Array();
- this.contentTwo = new Array();
- this.contentThree = new Array();
- this.contentFour = new Array();
- }
- DrawerMenu.prototype.setContents = function (args) {
- var data = JSON.parse(args.attribute);
- for (var key in data) {
- var cutKey;
- var location;
- var m;
- var n;
- var k;
- var h;
- var belongTo = key.length - key.replace(/,/g, "").length;
- switch (belongTo) {
- case 0:
- this.contentOne[parseInt(key)] = data[key];
- this.contentTwo[parseInt(key)] = new Array();
- this.contentThree[parseInt(key)] = new Array();
- this.contentFour[parseInt(key)] = new Array();
- break;
- case 1:
- cutKey = key.substr(1, key.length - 2);
- location = cutKey.split(",");
- m = Number(location[0]);
- n = Number(location[1]);
- this.contentTwo[m][n] = data[key];
- this.contentThree[m][n] = new Array();
- this.contentFour[m][n] = new Array();
- break;
- case 2:
- cutKey = key.substr(1, key.length - 2);
- location = cutKey.split(",");
- var m = Number(location[0]);
- var n = Number(location[1]);
- var k = Number(location[2]);
- this.contentThree[m][n][k] = data[key];
- this.contentFour[m][n][k] = new Array();
- break;
- case 3:
- cutKey = key.substr(1, key.length - 2);
- location = cutKey.split(",");
- var m = Number(location[0]);
- var n = Number(location[1]);
- var k = Number(location[2]);
- var h = Number(location[3]);
- this.contentFour[m][n][k][h] = data[key];
- break;
- default:
- console.log("data error");
- break;
- }
- }
- };
- DrawerMenu.prototype.setIconPaths = function (args) {
- var pathData = JSON.parse(args.iconPaths);
- for (var key in pathData) {
- var path = pathData[key];
- if (path.indexOf("file:") === 0)
- path = path.replace(/\\/g, "\\\\");
- this.$thisNode.find("li:eq(" + parseInt(key) + ") a i.svg_icon").css({
- "background-image": "url(" + path + ")",
- "width": "1em",
- "height": "1em"
- });
- }
- };
- DrawerMenu.prototype.initDropdown = function () {
- var Index1 = 0, Index2 = 0, Index3 = 0, Index4 = 0;
- var flagTwo = false, flagThree = false, flagFour = false;
- var content = "";
- var own = this;
- var block_height = 48;
- var wrapperTwoNode = $("");
- var wrapperThreeNode = $("");
- var wrapperFourNode = $("");
- var drawerMenu_deg_twoNode = $("");
- var drawerMenu_deg_threeNode = $("");
- var drawerMenu_deg_fourNode = $("");
- for (var i = 0; i < this.contentTwo.length; i++) {
- if (this.contentTwo[i].length > 0) {
- flagTwo = true;
- break;
- }
- }
- for (var i = 0; i < this.contentThree.length; i++) {
- for (var j = 0; j < this.contentThree[i].length; j++) {
- if (this.contentThree[i][j].length > 0) {
- flagThree = true;
- break;
- }
- }
- if (flagThree) {
- break;
- }
- }
- for (var i = 0; i < this.contentFour.length; i++) {
- for (var j = 0; j < this.contentFour[i].length; j++) {
- for (var m = 0; m < this.contentFour[i][j].length; m++) {
- if (this.contentFour[i][j].length > 0) {
- flagFour = true;
- break;
- }
- }
- if (flagFour) {
- break;
- }
- }
- if (flagFour) {
- break;
- }
- }
- if (this.$thisNode.find("li").length > 0) {
- this.$thisNode.empty();
- $("#" + this.id + "wrapperTwo").remove();
- $("#" + this.id + "wrapperThree").remove();
- $("#" + this.id + "wrapperFour").remove();
- }
- for (var i_1 = 0, z = this.contentOne.length; i_1 < z; i_1++) {
- if (this.contentTwo[i_1].length > 0) {
- this.$thisNode.append($("<li><a href='###'><i class='svg_icon'></i>" + this.contentOne[i_1] + "<i class='fold'></i></a></li>"));
- }
- else {
- this.$thisNode.append($("<li><a href='###'><i class='svg_icon'></i>" + this.contentOne[i_1] + "</a></li>"));
- }
- }
- if (flagTwo) {
- 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");
- wrapperTwoNode.appendTo("body");
- drawerMenu_deg_twoNode = wrapperTwoNode.find(".dropdown-content");
- }
- if (flagThree) {
- 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");
- wrapperThreeNode.appendTo("body");
- drawerMenu_deg_threeNode = wrapperThreeNode.find(".dropdown-content");
- }
- if (flagFour) {
- 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");
- wrapperFourNode.appendTo("body");
- drawerMenu_deg_fourNode = wrapperFourNode.find(".dropdown-content");
- }
- this.$thisNode.on("mouseenter", "li", {
- contentTwo: this.contentTwo,
- contentThree: this.contentThree
- }, function (event) {
- drawerMenu_deg_twoNode.empty();
- wrapperTwoNode.find(".myclass").hide();
- wrapperTwoNode.find(".triangle").hide();
- drawerMenu_deg_threeNode.empty();
- wrapperThreeNode.find(".myclass").hide();
- wrapperThreeNode.find(".triangle").hide();
- Index1 = own.$thisNode.find("li").index($(this));
- own.$thisNode.find("li a i.fold").css({
- "background-image": "url(images/drawer_menu/icon_normal_arrow.png)"
- });
- own.$thisNode.find("li:eq(" + Index1 + ") a i.fold").css({
- "background-image": "url(images/drawer_menu/icon_pressed_arrow.png)"
- });
- for (var i = 0, z = event.data.contentTwo[Index1].length; i < z; i++) {
- if (event.data.contentThree[Index1][i].length > 0) {
- drawerMenu_deg_twoNode.append($("<li><a href='###'>" + event.data.contentTwo[Index1][i] + "<i class='fold'></i></a></li>"));
- }
- else {
- drawerMenu_deg_twoNode.append($("<li><a href='###'>" + event.data.contentTwo[Index1][i] + "</a></li>"));
- }
- }
- if (drawerMenu_deg_twoNode.find("li").length > 0) {
- var two_height = drawerMenu_deg_twoNode.height();
- var primate_height = $(this).offset().top;
- var screen_height = $(window).height();
- var aa = screen_height - primate_height - block_height;
- if (two_height + primate_height >= screen_height) {
- drawerMenu_deg_twoNode.css({
- "bottom": aa,
- "display": "block",
- "left": $(this).parent().outerWidth() + $(this).parent().offset().left + 12,
- "top": "auto"
- });
- drawerMenu_deg_twoNode.css({
- "max-height": near(screen_height - aa)
- });
- wrapperTwoNode.find(".myclass").css({
- "width": drawerMenu_deg_twoNode.width(),
- "height": drawerMenu_deg_twoNode.height(),
- "left": drawerMenu_deg_twoNode.css("left"),
- "bottom": drawerMenu_deg_twoNode.css("bottom"),
- "display": "block",
- "top": "auto"
- });
- wrapperTwoNode.find(".triangle").css({
- "left": parseInt(drawerMenu_deg_twoNode.css("left")) - 8,
- "bottom": parseInt(drawerMenu_deg_twoNode.css("bottom")) + 24,
- "display": "block",
- "top": "auto"
- });
- }
- else {
- drawerMenu_deg_twoNode.css({
- "top": primate_height,
- "display": "block",
- "left": $(this).parent().outerWidth() + $(this).parent().offset().left + 12,
- "bottom": "auto"
- });
- drawerMenu_deg_twoNode.css({
- "max-height": near($(window).height() - $(this).offset().top)
- });
- wrapperTwoNode.find(".myclass").css({
- "width": drawerMenu_deg_twoNode.width(),
- "height": drawerMenu_deg_twoNode.height(),
- "left": drawerMenu_deg_twoNode.css("left"),
- "top": drawerMenu_deg_twoNode.css("top"),
- "display": "block",
- "bottom": "auto"
- });
- wrapperTwoNode.find(".triangle").css({
- "left": parseInt(drawerMenu_deg_twoNode.css("left")) - 8,
- "top": parseInt(drawerMenu_deg_twoNode.css("top")) + 24,
- "display": "block",
- "bottom": "auto"
- });
- }
- }
- });
- this.$thisNode.on("mouseleave", "li", function (event) {
- var x = event.clientX;
- var y = event.clientY;
- if (drawerMenu_deg_twoNode.offset()) {
- var borderX = drawerMenu_deg_twoNode.offset().left + drawerMenu_deg_twoNode.width();
- var borderY = drawerMenu_deg_twoNode.offset().top + drawerMenu_deg_twoNode.height();
- if ((x >= drawerMenu_deg_twoNode.offset().left - 18) && (x <= borderX) && (y >= drawerMenu_deg_twoNode.offset().top + 10) && (y <= borderY)) {
- drawerMenu_deg_twoNode.show();
- wrapperTwoNode.find(".myclass").show();
- }
- else {
- $("#" + own.id + " li ").removeClass("block_fontcolor");
- cleanBlock();
- }
- }
- });
- this.$thisNode.on("click", "li", function (event) {
- var apple = $("#" + own.id + " li").index($(this));
- content = "" + apple;
- EventHub_13.EventHub.dispatchEvent(MessageType_14.MessageType.WIDGET, {
- id: own.id,
- degree: "1",
- location: content,
- evtType: Event_11.Event.CLICK
- });
- });
- drawerMenu_deg_twoNode.on("mouseenter", "li", {
- contentThree: this.contentThree,
- contentFour: this.contentFour
- }, function (event) {
- drawerMenu_deg_threeNode.empty();
- wrapperThreeNode.find(".myclass").hide();
- wrapperThreeNode.find(".triangle").hide();
- drawerMenu_deg_fourNode.empty();
- wrapperFourNode.find(".myclass").hide();
- wrapperFourNode.find(".triangle").hide();
- Index2 = drawerMenu_deg_twoNode.find("li").index($(this));
- drawerMenu_deg_twoNode.find(".fold").css({
- "background-image": "url(images/drawer_menu/icon_normal_arrow.png)"
- });
- drawerMenu_deg_twoNode.find("li:eq(" + Index2 + ") a i.fold").css({
- "background-image": "url(images/drawer_menu/icon_pressed_arrow.png)"
- });
- $(this).addClass("block_fontcolor").siblings().removeClass("block_fontcolor");
- for (var i = 0, z = event.data.contentThree[Index1][Index2].length; i < z; i++) {
- if (event.data.contentFour[Index1][Index2][i].length > 0) {
- drawerMenu_deg_threeNode.append($("<li><a href='###'>" + event.data.contentThree[Index1][Index2][i] + "<i class='fold'></i></a></li>"));
- }
- else {
- drawerMenu_deg_threeNode.append($("<li><a href='###'>" + event.data.contentThree[Index1][Index2][i] + "</a></li>"));
- }
- }
- if (drawerMenu_deg_threeNode.find("li").length > 0) {
- var three_height = drawerMenu_deg_threeNode.height();
- var primate_height = $(this).offset().top;
- var screen_height = $(window).height();
- var aa = screen_height - primate_height - block_height;
- if (primate_height > aa) {
- drawerMenu_deg_threeNode.css({
- "top": "auto",
- "left": drawerMenu_deg_twoNode.offset().left + drawerMenu_deg_twoNode.width() + 12,
- "display": "block",
- "bottom": aa
- });
- drawerMenu_deg_threeNode.css({
- "max-height": near(screen_height - aa)
- });
- wrapperThreeNode.find(".myclass").css({
- "width": drawerMenu_deg_threeNode.width(),
- "height": drawerMenu_deg_threeNode.height(),
- "top": drawerMenu_deg_threeNode.css("top"),
- "left": drawerMenu_deg_threeNode.css("left"),
- "display": "block",
- "bottom": drawerMenu_deg_threeNode.css("bottom")
- });
- wrapperThreeNode.find(".triangle").css({
- "left": parseInt(drawerMenu_deg_threeNode.css("left")) - 8,
- "bottom": parseInt(drawerMenu_deg_threeNode.css("bottom")) + 24,
- "display": "block",
- "top": "auto"
- });
- }
- else {
- drawerMenu_deg_threeNode.css({
- "top": $(this).offset().top,
- "left": drawerMenu_deg_twoNode.offset().left + drawerMenu_deg_twoNode.width() + 12,
- "display": "block",
- "bottom": "auto"
- });
- drawerMenu_deg_threeNode.css({
- "max-height": near($(window).height() - $(this).offset().top)
- });
- wrapperThreeNode.find(".myclass").css({
- "width": drawerMenu_deg_threeNode.width(),
- "height": drawerMenu_deg_threeNode.height(),
- "top": drawerMenu_deg_threeNode.css("top"),
- "left": drawerMenu_deg_threeNode.css("left"),
- "display": "block",
- "bottom": drawerMenu_deg_threeNode.css("bottom")
- });
- wrapperThreeNode.find(".triangle").css({
- "left": parseInt(drawerMenu_deg_threeNode.css("left")) - 8,
- "top": parseInt(drawerMenu_deg_threeNode.css("top")) + 24,
- "display": "block",
- "bottom": "auto"
- });
- }
- }
- });
- drawerMenu_deg_twoNode.on("mouseleave", function (event) {
- var x = event.clientX;
- var y = event.clientY;
- if (drawerMenu_deg_threeNode.offset()) {
- var borderX = drawerMenu_deg_threeNode.offset().left + drawerMenu_deg_threeNode.width();
- var borderY = drawerMenu_deg_threeNode.offset().top + drawerMenu_deg_threeNode.height();
- if ((x >= drawerMenu_deg_threeNode.offset().left - 18) && (x <= borderX) && (y >= drawerMenu_deg_threeNode.offset().top + 10) && (y <= borderY)) {
- drawerMenu_deg_threeNode.show();
- wrapperThreeNode.find(".myclass").show();
- }
- else {
- $("#" + own.id + " li").removeClass("block_fontcolor");
- cleanBlock();
- }
- }
- });
- drawerMenu_deg_twoNode.on("click", "li", function () {
- var apple = drawerMenu_deg_twoNode.find("li").index($(this));
- content = '[' + Index1 + ',' + apple + ']';
- EventHub_13.EventHub.dispatchEvent(MessageType_14.MessageType.WIDGET, {
- id: own.id,
- degree: "2",
- location: content,
- evtType: Event_11.Event.CLICK
- });
- if (drawerMenu_deg_threeNode.find("li").length == 0) {
- cleanBlock();
- }
- });
- drawerMenu_deg_threeNode.on("mouseenter", "li", {
- contentFour: this.contentFour
- }, function (event) {
- drawerMenu_deg_fourNode.empty();
- wrapperFourNode.find(".myclass").hide();
- wrapperFourNode.find(".triangle").hide();
- Index3 = drawerMenu_deg_threeNode.find("li").index($(this));
- drawerMenu_deg_threeNode.find(".fold").css({
- "background-image": "url(images/drawer_menu/icon_normal_arrow.png)"
- });
- drawerMenu_deg_threeNode.find("li:eq(" + Index3 + ") a i.fold").css({
- "background-image": "url(images/drawer_menu/icon_pressed_arrow.png)"
- });
- $(this).addClass("block_fontcolor").siblings().removeClass("block_fontcolor");
- for (var i = 0, z = event.data.contentFour[Index1][Index2][Index3].length; i < z; i++) {
- drawerMenu_deg_fourNode.append($("<li><a href='###'>" + event.data.contentFour[Index1][Index2][Index3][i] + "</a></li>"));
- }
- if (drawerMenu_deg_fourNode.find("li").length > 0) {
- var four_height = drawerMenu_deg_fourNode.height();
- var primate_height = $(this).offset().top;
- var screen_height = $(window).height();
- var aa = screen_height - primate_height - block_height;
- if (primate_height > aa) {
- drawerMenu_deg_fourNode.css({
- "top": "auto",
- "left": drawerMenu_deg_threeNode.offset().left + drawerMenu_deg_threeNode.width() + 12,
- "display": "block",
- "bottom": aa
- });
- drawerMenu_deg_fourNode.css({
- "max-height": near(screen_height - aa)
- });
- wrapperFourNode.find(".myclass").css({
- "width": drawerMenu_deg_fourNode.width(),
- "height": drawerMenu_deg_fourNode.height(),
- "top": drawerMenu_deg_fourNode.css("top"),
- "left": drawerMenu_deg_fourNode.css("left"),
- "display": "block",
- "bottom": drawerMenu_deg_fourNode.css("bottom")
- });
- wrapperFourNode.find(".triangle").css({
- "left": parseInt(drawerMenu_deg_fourNode.css("left")) - 8,
- "bottom": parseInt(drawerMenu_deg_fourNode.css("bottom")) + 24,
- "display": "block",
- "top": "auto"
- });
- }
- else {
- drawerMenu_deg_fourNode.css({
- "top": $(this).offset().top,
- "left": drawerMenu_deg_threeNode.offset().left + drawerMenu_deg_threeNode.width() + 12,
- "display": "block",
- "bottom": "auto"
- });
- drawerMenu_deg_fourNode.css({
- "max-height": near($(window).height() - $(this).offset().top)
- });
- wrapperFourNode.find(".myclass").css({
- "width": drawerMenu_deg_fourNode.width(),
- "height": drawerMenu_deg_fourNode.height(),
- "top": drawerMenu_deg_fourNode.css("top"),
- "left": drawerMenu_deg_fourNode.css("left"),
- "display": "block",
- "bottom": drawerMenu_deg_fourNode.css("bottom")
- });
- wrapperFourNode.find(".triangle").css({
- "left": parseInt(drawerMenu_deg_fourNode.css("left")) - 8,
- "bottom": "auto",
- "display": "block",
- "top": parseInt(drawerMenu_deg_fourNode.css("top")) + 24
- });
- }
- }
- });
- drawerMenu_deg_threeNode.on("mouseleave", function (event) {
- var x = event.clientX;
- var y = event.clientY;
- if (drawerMenu_deg_fourNode.offset()) {
- var borderX = drawerMenu_deg_fourNode.offset().left + drawerMenu_deg_fourNode.width();
- var borderY = drawerMenu_deg_fourNode.offset().top + drawerMenu_deg_fourNode.height();
- if ((x >= drawerMenu_deg_fourNode.offset().left - 18) && (x <= borderX) && (y >= drawerMenu_deg_fourNode.offset().top + 10) && (y <= borderY)) {
- drawerMenu_deg_fourNode.show();
- wrapperFourNode.find(".myclass").show();
- }
- else {
- $("#" + own.id + " li").removeClass("block_fontcolor");
- cleanBlock();
- }
- }
- });
- drawerMenu_deg_threeNode.on("click", "li", function (event) {
- Index3 = drawerMenu_deg_threeNode.find("li").index($(this));
- content = '[' + Index1 + ',' + Index2 + ',' + Index3 + ']';
- EventHub_13.EventHub.dispatchEvent(MessageType_14.MessageType.WIDGET, {
- id: own.id,
- degree: "3",
- location: content,
- evtType: Event_11.Event.CLICK
- });
- if (drawerMenu_deg_fourNode.find("li").length == 0) {
- cleanBlock();
- }
- });
- drawerMenu_deg_fourNode.on("mouseleave", "li", function (event) {
- var x = event.clientX;
- var y = event.clientY;
- var borderX = drawerMenu_deg_threeNode.offset().left + drawerMenu_deg_threeNode.width();
- var borderY = drawerMenu_deg_threeNode.offset().top + drawerMenu_deg_threeNode.height();
- var borderXX = drawerMenu_deg_fourNode.offset().left + drawerMenu_deg_fourNode.width();
- var borderYY = drawerMenu_deg_fourNode.offset().top + drawerMenu_deg_fourNode.height();
- if ((y <= drawerMenu_deg_fourNode.offset().top) || (x >= borderXX) || (y >= borderYY)) {
- cleanBlock();
- }
- if ((x < borderX) && (y > borderY)) {
- cleanBlock();
- }
- });
- drawerMenu_deg_fourNode.on("click", "li", function (event) {
- Index4 = drawerMenu_deg_fourNode.find("li").index($(this));
- content = '[' + Index1 + ',' + Index2 + ',' + Index3 + ',' + Index4 + ']';
- EventHub_13.EventHub.dispatchEvent(MessageType_14.MessageType.WIDGET, {
- id: own.id,
- degree: "4",
- location: content,
- evtType: Event_11.Event.CLICK
- });
- cleanBlock();
- });
- function cleanBlock() {
- drawerMenu_deg_fourNode.empty();
- drawerMenu_deg_fourNode.hide();
- drawerMenu_deg_threeNode.empty();
- drawerMenu_deg_threeNode.hide();
- drawerMenu_deg_twoNode.empty();
- drawerMenu_deg_twoNode.hide();
- wrapperTwoNode.find(".myclass").hide();
- wrapperThreeNode.find(".myclass").hide();
- wrapperFourNode.find(".myclass").hide();
- wrapperTwoNode.find(".triangle").hide();
- wrapperThreeNode.find(".triangle").hide();
- wrapperFourNode.find(".triangle").hide();
- own.$thisNode.find("li:eq(" + Index1 + ") a i.fold").css({
- "background-image": "url(images/drawer_menu/icon_normal_arrow.png)"
- });
- drawerMenu_deg_twoNode.css("max-height", "none");
- drawerMenu_deg_threeNode.css("max-height", "none");
- drawerMenu_deg_fourNode.css("max-height", "none");
- $("#" + own.id + " li").removeClass("block_fontcolor");
- drawerMenu_deg_twoNode.find("li").removeClass("block_fontcolor");
- drawerMenu_deg_threeNode.find("li").removeClass("block_fontcolor");
- drawerMenu_deg_fourNode.find("li").removeClass("block_fontcolor");
- }
- function near(numb) {
- var left, right, num;
- var block_height = 48;
- left = numb % block_height;
- num = numb - left;
- if (num < block_height) {
- num = block_height;
- }
- return num;
- }
- };
- DrawerMenu.prototype.dispose = function () {
- _super.prototype.dispose.call(this);
- $("#" + this.id + "wrapperTwo").remove();
- $("#" + this.id + "wrapperThree").remove();
- };
- DrawerMenu.Template = "<ul class='dropdown-content adore_drawerMenu adore-hidden-scrollbar'></ul>";
- return DrawerMenu;
- }(Widget_12.Widget));
- exports.DrawerMenu = DrawerMenu;
- });
- define("widget/echart/EChart", ["require", "exports", "widget/Widget", "util/VisibilityChangeUtil"], function (require, exports, Widget_13, VisibilityChangeUtil_1) {
- "use strict";
- var EChart = (function (_super) {
- __extends(EChart, _super);
- function EChart(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.option = {};
- this.hadVisibilityListener = false;
- var own = this;
- this.$thisNode = $(EChart.template).attr({ id: this.id });
- this.$chartNode = this.$thisNode.find("div");
- this.resizeFunction = function () {
- if (own.echart) {
- if (own.$thisNode.is(":visible")) {
- setTimeout(function () {
- own.echart.resize();
- }, 380);
- }
- else {
- if (!own.hadVisibilityListener) {
- VisibilityChangeUtil_1.VisibilityChangeUtil.addVisibilityListener(own.$thisNode, function (visible) {
- if (visible) {
- own.echart.resize();
- VisibilityChangeUtil_1.VisibilityChangeUtil.removeVisibilityListener(own.$thisNode);
- own.hadVisibilityListener = false;
- }
- });
- own.hadVisibilityListener = true;
- }
- }
- }
- };
- $(window).on("resize", this.resizeFunction);
- }
- EChart.prototype.addOption = function (args) {
- var option = JSON.parse(args.option);
- $.extend(true, this.option, option);
- if (this.echart) {
- this.echart.setOption(this.option);
- }
- };
- EChart.prototype.setOption = function (args) {
- var option = JSON.parse(args.option);
- if (this.echart) {
- this.option = option;
- this.echart.setOption(option);
- }
- else {
- this.option = option;
- }
- };
- EChart.prototype.dispose = function () {
- $(window).off("resize", this.resizeFunction);
- _super.prototype.dispose.call(this);
- };
- EChart.prototype.postLayout = function () {
- _super.prototype.postLayout.call(this);
- if (!this.echart) {
- this.echart = echarts.init(this.$chartNode.get(0));
- if (this.option) {
- this.echart.setOption(this.option);
- }
- }
- this.echart.resize();
- };
- EChart.prototype.clear = function () {
- if (this.echart) {
- this.echart.clear();
- }
- this.option = {};
- };
- EChart.template = "\n <div>\n <div style=\"width:100%;height:100%\"></div>\n <div>\n ";
- return EChart;
- }(Widget_13.Widget));
- exports.EChart = EChart;
- });
- define("widget/echart/BarChart", ["require", "exports", "widget/echart/EChart"], function (require, exports, EChart_1) {
- "use strict";
- var BarChart = (function (_super) {
- __extends(BarChart, _super);
- function BarChart() {
- _super.apply(this, arguments);
- this.data = new Array();
- this.title = "unset";
- this.subTitle = "";
- this.align = "horizontal";
- this.axisLabel = { categoryAxisLabel: "", dataAxisLabel: "" };
- this.categories = [];
- }
- BarChart.prototype.setTitle = function (args) {
- this.title = args.titles.title;
- this.subTitle = args.titles.subTitle;
- };
- BarChart.prototype.setData = function (args) {
- this.data = args.data;
- };
- BarChart.prototype.setAxisLabel = function (args) {
- this.axisLabel = { categoryAxisLabel: args.axisLabelInfo.categoryAxisLabel, dataAxisLabel: args.axisLabelInfo.dataAxisLabel };
- };
- BarChart.prototype.setAlign = function (args) {
- this.align = args.align;
- };
- BarChart.prototype.setCategories = function (args) {
- this.categories = args.categories;
- };
- BarChart.prototype.postLayout = function () {
- if (this.data) {
- this.redrawChart();
- }
- _super.prototype.postLayout.call(this);
- };
- BarChart.prototype.redrawChart = function () {
- var xAxisContent = {};
- var yAxisContent = {};
- if (this.align === "horizontal") {
- xAxisContent = {
- data: this.categories,
- name: this.axisLabel.categoryAxisLabel,
- silent: false,
- splitLine: {
- show: false
- }
- };
- yAxisContent = {
- name: this.axisLabel.dataAxisLabel
- };
- }
- else if (this.align === "vertical") {
- yAxisContent = {
- data: this.categories,
- name: this.axisLabel.categoryAxisLabel,
- silent: false,
- splitLine: {
- show: false
- }
- };
- xAxisContent = {
- name: this.axisLabel.dataAxisLabel
- };
- }
- ;
- var dataName = [];
- for (var _i = 0, _a = this.data; _i < _a.length; _i++) {
- var dataEntry = _a[_i];
- dataName.push(dataEntry.entryName);
- }
- var seriesContent = [];
- var i = 0;
- for (var _b = 0, _c = this.data; _b < _c.length; _b++) {
- var dataEntry = _c[_b];
- var dataTemplate = {
- "name": dataEntry.entryName,
- "type": "bar",
- "data": dataEntry.entryData
- };
- seriesContent.push(dataTemplate);
- i++;
- }
- var barOption = {
- title: {
- text: this.title,
- subtext: this.subTitle,
- left: "center"
- },
- legend: {
- data: dataName,
- align: "left",
- left: "left"
- },
- toolbox: {
- feature: {
- magicType: {
- type: ["stack", "tiled"]
- }
- }
- },
- tooltip: {},
- xAxis: xAxisContent,
- yAxis: yAxisContent,
- series: seriesContent
- };
- this.option = barOption;
- if (this.echart) {
- this.echart.setOption(this.option);
- this.echart.resize();
- }
- };
- return BarChart;
- }(EChart_1.EChart));
- exports.BarChart = BarChart;
- });
- define("widget/echart/PieChart", ["require", "exports", "widget/echart/EChart"], function (require, exports, EChart_2) {
- "use strict";
- var PieChart = (function (_super) {
- __extends(PieChart, _super);
- function PieChart() {
- _super.apply(this, arguments);
- this.data = new Array();
- this.dataName = "";
- this.title = "unset";
- this.subTitle = "";
- }
- PieChart.prototype.setData = function (args) {
- this.data = args.data;
- };
- PieChart.prototype.setDataName = function (args) {
- this.dataName = args.dataName;
- };
- PieChart.prototype.setTitle = function (args) {
- this.title = args.titles.title;
- this.subTitle = args.titles.subTitle;
- };
- PieChart.prototype.postLayout = function () {
- if (this.data) {
- this.redrawChart();
- }
- _super.prototype.postLayout.call(this);
- };
- PieChart.prototype.redrawChart = function () {
- var dataNameList = new Array();
- for (var _i = 0, _a = this.data; _i < _a.length; _i++) {
- var dataEntry = _a[_i];
- dataNameList.push(dataEntry.name);
- }
- var dataList = new Array();
- for (var _b = 0, _c = this.data; _b < _c.length; _b++) {
- var dataEntry = _c[_b];
- var dataTemplate = {
- value: dataEntry.value,
- name: dataEntry.name
- };
- dataList.push(dataTemplate);
- }
- var pieOption = {
- title: {
- text: this.title,
- subtext: this.subTitle,
- x: "center"
- },
- tooltip: {
- trigger: "item",
- formatter: "{a} <br/>{b} : {c} ({d}%)"
- },
- legend: {
- orient: "vertical",
- left: "left",
- data: dataNameList
- },
- series: [
- {
- name: this.dataName,
- type: "pie",
- radius: "70%",
- center: ["50%", "50%"],
- data: dataList,
- itemStyle: {
- emphasis: {
- shadowBlur: 10,
- shadowOffsetX: 0,
- shadowColor: "rgba(0, 0, 0, 0.5)"
- }
- }
- }
- ]
- };
- this.option = pieOption;
- if (this.echart) {
- this.echart.setOption(this.option);
- this.echart.resize();
- }
- };
- return PieChart;
- }(EChart_2.EChart));
- exports.PieChart = PieChart;
- });
- define("widget/echart/RadarChart", ["require", "exports", "widget/echart/EChart"], function (require, exports, EChart_3) {
- "use strict";
- var RadarChart = (function (_super) {
- __extends(RadarChart, _super);
- function RadarChart() {
- _super.apply(this, arguments);
- this.data = new Array();
- this.indicators = new Array();
- this.title = "unset";
- this.subTitle = "";
- }
- RadarChart.prototype.setData = function (args) {
- this.data = args.data;
- };
- RadarChart.prototype.setIndicators = function (args) {
- this.indicators = args.indicators;
- };
- RadarChart.prototype.setTitle = function (args) {
- this.title = args.titles.title;
- this.subTitle = args.titles.subTitle;
- };
- RadarChart.prototype.postLayout = function () {
- if (this.data) {
- this.redrawChart();
- }
- _super.prototype.postLayout.call(this);
- };
- RadarChart.prototype.redrawChart = function () {
- var indicatorsContent = new Array();
- for (var _i = 0, _a = this.indicators; _i < _a.length; _i++) {
- var indicator = _a[_i];
- var template = void 0;
- if (indicator.max) {
- template = {
- name: indicator.name, max: indicator.max
- };
- }
- else {
- template = {
- name: indicator.name
- };
- }
- indicatorsContent.push(template);
- }
- var legendData = new Array();
- var dataContent = [];
- for (var _b = 0, _c = this.data; _b < _c.length; _b++) {
- var dataEntry = _c[_b];
- var subDataTemplate = {
- value: dataEntry.value,
- name: dataEntry.name
- };
- legendData.push(dataEntry.name);
- dataContent.push(subDataTemplate);
- }
- var radarOption = {
- title: {
- text: this.title,
- subtext: this.subTitle,
- x: "center"
- },
- tooltip: {},
- legend: {
- data: legendData,
- x: "left",
- orient: "vertical"
- },
- radar: {
- radius: "70%",
- center: ["50%", "50%"],
- indicator: indicatorsContent
- },
- series: [{
- name: "",
- type: "radar",
- areaStyle: { normal: {} },
- data: dataContent
- }]
- };
- this.option = radarOption;
- if (this.echart) {
- this.echart.setOption(this.option);
- this.echart.resize();
- }
- };
- return RadarChart;
- }(EChart_3.EChart));
- exports.RadarChart = RadarChart;
- });
- 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) {
- "use strict";
- var ExpandableText = (function (_super) {
- __extends(ExpandableText, _super);
- function ExpandableText(parentId, id, style) {
- var _this = this;
- _super.call(this, parentId, id, style);
- this.maxShowItems = 5;
- this.currentIndex = -1;
- this.datas = [];
- this.maxShowItems = 5;
- this.expandableTextId = this.id;
- this.$thisNode = $(ExpandableText.TemplateNormal).attr("id", this.id);
- this.$attachNode = this.$thisNode;
- this.$textCode = this.$thisNode.find("input").attr("id", this.id + "_input");
- this.$thisNode.find("label").attr("for", this.id);
- var own = this;
- this.$textCode.on("input", function (e) {
- own.handleInput(e, _this.$textCode.val());
- });
- this.$textCode.on("keydown", function (e) {
- own.handleKeyDown(e);
- });
- this.$textCode.on("blur", function (e) {
- own.handleBlur(e);
- });
- this.$textCode.on("focus", function (e) {
- own.sendFocusGain();
- });
- }
- ExpandableText.prototype.setText = function (args) {
- this.$textCode.val(args.text);
- };
- ExpandableText.prototype.setName = function (args) {
- this.$thisNode.find("label").text(args.name);
- };
- ExpandableText.prototype.setItems = function (args) {
- this.datas = args.items;
- };
- ExpandableText.prototype.dispose = function () {
- _super.prototype.dispose.call(this);
- $("#" + this.expandableTextId + "_dropDown").remove();
- };
- ExpandableText.prototype.setFocus = function () {
- var $dropDownNode = $("#" + this.id + "_dropDown");
- if ($dropDownNode.css("display") !== "block" && document.activeElement !== this.$textCode[0]) {
- this.$textCode.focus();
- }
- };
- ExpandableText.prototype.setEnabled = function (args) {
- this.enabled = args.enabled;
- if (this.enabled) {
- this.$thisNode.find("input").removeAttr("disabled");
- }
- else {
- this.$thisNode.find("input").attr("disabled", "disabled");
- }
- };
- ExpandableText.prototype.setPlaceholder = function (args) {
- this.$thisNode.find("input").attr("placeholder", args.placeholder);
- };
- ExpandableText.prototype.handleKeyDown = function (e) {
- var dropDown = $("#" + this.expandableTextId + "_dropDown");
- var dis = dropDown.css("display");
- if (!dis || dis === "none") {
- if (e.keyCode === Keys_7.Keys.DOWN_ARROW) {
- this.showDropDown(e, "", true);
- }
- return;
- }
- var items = dropDown.find("li");
- if (items.length === 0) {
- return;
- }
- if (e.keyCode === Keys_7.Keys.UP_ARROW) {
- if (this.currentIndex === -1) {
- this.currentIndex = items.length - 1;
- }
- else {
- this.currentIndex--;
- }
- items.css("background-color", "#FFFFFF");
- if (this.currentIndex < 0) {
- this.currentIndex = -1;
- }
- else {
- $(items[this.currentIndex]).css("background-color", "#BEBEBE");
- this.$textCode.val($(items[this.currentIndex]).find("a").text().split(" ")[0]);
- }
- this.refreshScroll(dropDown, this.currentIndex);
- e.preventDefault();
- return;
- }
- else if (e.keyCode === Keys_7.Keys.DOWN_ARROW) {
- this.currentIndex++;
- items.css("background-color", "#FFFFFF");
- if (this.currentIndex >= items.length) {
- this.currentIndex = -1;
- }
- else {
- $(items[this.currentIndex]).css("background-color", "#BEBEBE");
- this.$textCode.val($(items[this.currentIndex]).find("a").text().split(" ")[0]);
- }
- this.refreshScroll(dropDown, this.currentIndex);
- e.preventDefault();
- return;
- }
- else if (e.keyCode === Keys_7.Keys.ENTER || e.keyCode === Keys_7.Keys.NUMPAD_ENTER) {
- dropDown.css("display", "none");
- if (this.currentIndex >= 0 && this.currentIndex < items.length) {
- var text = $(items[this.currentIndex]).find("a").text();
- var val = text.split(" ")[0];
- this.$textCode.val(val);
- EventHub_14.EventHub.dispatchEvent(MessageType_15.MessageType.WIDGET, { id: this.id, text: val, evtType: Event_12.Event.MODIFY });
- EventHub_14.EventHub.dispatchEvent(MessageType_15.MessageType.WIDGET, { id: this.id, evtType: Event_12.Event.CLICK });
- }
- }
- };
- ExpandableText.prototype.showDropDown = function (e, value, showAll) {
- var height = this.$textCode.height();
- this.scrollIndexs = [0, this.maxShowItems - 1];
- var pos = this.getPosition(this.$textCode[0]);
- var tmpHeight = height + pos[0] + 14;
- $("#" + this.expandableTextId + "_dropDown").remove();
- var $dropDown = $(ExpandableText.Template1).attr("id", this.expandableTextId + "_dropDown");
- $dropDown.attr({ mouseOn: "false" });
- $dropDown.appendTo(document.body);
- $dropDown.css("top", tmpHeight);
- $dropDown.css("left", pos[1]);
- $dropDown.css("background-color", "#FFFFFF");
- this.currentIndex = -1;
- var $liNode;
- if (this.datas) {
- if (showAll === true && value === "") {
- for (var i = 0; i < this.datas.length; i++) {
- $liNode = $(ExpandableText.Template2);
- $liNode.find("a").text(this.datas[i]);
- $liNode.appendTo($dropDown);
- }
- }
- else if (value != "") {
- for (var i = 0; i < this.datas.length; i++) {
- if (this.datas[i].toLocaleLowerCase().indexOf(value) >= 0) {
- $liNode = $(ExpandableText.Template2);
- $liNode.find("a").text(this.datas[i]);
- $liNode.appendTo($dropDown);
- }
- }
- }
- }
- var len = $dropDown.find("li").length;
- var inputNode = this.$textCode;
- var tmpId = this.expandableTextId;
- if (len > 0) {
- $dropDown.find("li").find("a").on("click", function (e) {
- var value = $(this).text();
- var newValue = value.split(" ")[0];
- $("#" + tmpId + "_input").val(newValue);
- $("#" + tmpId + "_dropDown").css("display", "none");
- EventHub_14.EventHub.dispatchEvent(MessageType_15.MessageType.WIDGET, { id: tmpId, text: newValue, evtType: Event_12.Event.MODIFY });
- EventHub_14.EventHub.dispatchEvent(MessageType_15.MessageType.WIDGET, { id: tmpId, evtType: Event_12.Event.CLICK });
- });
- $dropDown.on("mouseover", function (e) {
- $dropDown.attr("mouseOn", "true");
- });
- $dropDown.on("mouseout", function (e) {
- $dropDown.attr("mouseOn", "false");
- });
- $dropDown.css("display", "block");
- if (len > this.maxShowItems) {
- var h = $($dropDown.find("li")[0]).height();
- var maxHeight = h * this.maxShowItems;
- $dropDown.css("height", maxHeight);
- }
- var own = this;
- $(document).bind('click.' + this.expandableTextId + "_dropDown", function (e) {
- if ((!$dropDown.is(e.target) && !inputNode.is(e.target)) || $dropDown.css("display") === "none") {
- $dropDown.css("display", "none");
- $(document).unbind('click.' + tmpId + "_dropDown");
- }
- });
- }
- else {
- $dropDown.css("display", "none");
- }
- };
- ExpandableText.prototype.getPosition = function (obj) {
- var pos = [0, 0];
- if (obj && obj.offsetParent) {
- while (obj && obj.offsetParent) {
- pos[0] += obj.offsetTop;
- pos[1] += obj.offsetLeft;
- obj = obj.offsetParent;
- }
- }
- return pos;
- };
- ExpandableText.prototype.refreshScroll = function ($dropDown, currentIndex) {
- if (currentIndex === -1) {
- return;
- }
- var count = $dropDown.find("li").length - 1;
- var needRefresh = false;
- if (currentIndex < this.scrollIndexs[0]) {
- var endIndex = currentIndex + this.maxShowItems - 1;
- endIndex = endIndex > count ? count : endIndex;
- this.scrollIndexs = [currentIndex, endIndex];
- needRefresh = true;
- }
- else if (currentIndex > this.scrollIndexs[1]) {
- var beginIndex = currentIndex - this.maxShowItems + 1;
- beginIndex = beginIndex < 0 ? 0 : beginIndex;
- this.scrollIndexs = [beginIndex, currentIndex];
- needRefresh = true;
- }
- if (needRefresh) {
- var h = $dropDown.find("li").height();
- $dropDown[0].scrollTop = h * this.scrollIndexs[0];
- }
- };
- ExpandableText.prototype.handleInput = function (e, value) {
- var tmpId = this.expandableTextId;
- EventHub_14.EventHub.dispatchEvent(MessageType_15.MessageType.WIDGET, { id: tmpId, text: value, evtType: Event_12.Event.MODIFY });
- this.showDropDown(e, value.toLocaleLowerCase(), false);
- };
- ExpandableText.prototype.handleBlur = function (e) {
- var mouseOn = $("#" + this.expandableTextId + "_dropDown").attr("mouseOn");
- if (mouseOn === "false") {
- $("#" + this.expandableTextId + "_dropDown").css("display", "none");
- }
- };
- ExpandableText.prototype.handleKeyDownEvent = function (e, hasFilter) {
- if ($("#" + this.expandableTextId + "_dropDown").css("display") === "block") {
- if (e.keyCode === Keys_7.Keys.ENTER || e.keyCode === Keys_7.Keys.NUMPAD_ENTER || e.keyCode === Keys_7.Keys.DOWN_ARROW
- || e.keyCode === Keys_7.Keys.UP_ARROW) {
- return;
- }
- }
- if (e.keyCode === Keys_7.Keys.LEFT_ARROW
- || e.keyCode === Keys_7.Keys.RIGHT_ARROW) {
- return;
- }
- _super.prototype.handleKeyDownEvent.call(this, e, hasFilter);
- };
- ExpandableText.prototype.handleKeyUpEvent = function (e) {
- if ($("#" + this.expandableTextId + "_dropDown").css("display") === "block") {
- if (e.keyCode === Keys_7.Keys.ENTER || e.keyCode === Keys_7.Keys.NUMPAD_ENTER || e.keyCode === Keys_7.Keys.DOWN_ARROW
- || e.keyCode === Keys_7.Keys.UP_ARROW) {
- return;
- }
- }
- if (e.keyCode === Keys_7.Keys.LEFT_ARROW
- || e.keyCode === Keys_7.Keys.RIGHT_ARROW) {
- return;
- }
- _super.prototype.handleKeyUpEvent.call(this, e);
- };
- ExpandableText.TemplateNormal = "\n <div class=\"input-field\">\n <i></i>\n <input type=\"text\">\n <label></label>\n </div>";
- ExpandableText.Template1 = "\n <ul class=\"adore_dropDown dropdown-content\" style=\"opacity:1;\">\n </ul>";
- ExpandableText.Template2 = "\n <li>\n <a href='#!' style=\" \"></a>\n </li>";
- return ExpandableText;
- }(Widget_14.Widget));
- exports.ExpandableText = ExpandableText;
- });
- define("widget/FlatTree", ["require", "exports", "widget/Widget", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, Widget_15, EventHub_15, MessageType_16, Event_13) {
- "use strict";
- var FlatTree = (function (_super) {
- __extends(FlatTree, _super);
- function FlatTree(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.$thisNode = $(FlatTree.Template).attr("id", this.id);
- this.oneDegree = this.$thisNode.find(".wrap_flatTree:eq(0)").attr("id", "one_" + this.id);
- this.twoDegree = this.$thisNode.find(".wrap_flatTree:eq(1)").attr("id", "two_" + this.id);
- this.threeDegree = this.$thisNode.find(".wrap_flatTree:eq(2)").attr("id", "three_" + this.id);
- this.fourDegree = this.$thisNode.find(".wrap_flatTree:eq(3)").attr("id", "four_" + this.id);
- this.contentOne = new Array();
- this.contentTwo = new Array();
- this.contentThree = new Array();
- this.contentFour = new Array();
- }
- FlatTree.prototype.setContents = function (args) {
- var data = JSON.parse(args.attribute);
- for (var key in data) {
- var cutKey;
- var location;
- var m;
- var n;
- var k;
- var h;
- var belongTo = key.length - key.replace(/,/g, "").length;
- switch (belongTo) {
- case 0:
- this.contentOne[parseInt(key)] = data[key];
- this.contentTwo[parseInt(key)] = new Array();
- this.contentThree[parseInt(key)] = new Array();
- this.contentFour[parseInt(key)] = new Array();
- break;
- case 1:
- cutKey = key.substr(1, key.length - 2);
- location = cutKey.split(",");
- m = Number(location[0]);
- n = Number(location[1]);
- this.contentTwo[m][n] = data[key];
- this.contentThree[m][n] = new Array();
- this.contentFour[m][n] = new Array();
- break;
- case 2:
- cutKey = key.substr(1, key.length - 2);
- location = cutKey.split(",");
- var m = Number(location[0]);
- var n = Number(location[1]);
- var k = Number(location[2]);
- this.contentThree[m][n][k] = data[key];
- this.contentFour[m][n][k] = new Array();
- break;
- case 3:
- cutKey = key.substr(1, key.length - 2);
- location = cutKey.split(",");
- var m = Number(location[0]);
- var n = Number(location[1]);
- var k = Number(location[2]);
- var h = Number(location[3]);
- this.contentFour[m][n][k][h] = data[key];
- break;
- default:
- console.log("data error");
- break;
- }
- }
- };
- FlatTree.prototype.setIconPaths = function (args) {
- var pathData = JSON.parse(args.iconPaths);
- for (var key in pathData) {
- var path = pathData[key].replace(/\\/g, "\\\\");
- this.oneDegree.find("img:eq(" + parseInt(key) + ")").attr("src", path);
- }
- };
- FlatTree.prototype.setRootTitle = function (args) {
- this.$thisNode.find(".breadCumb a:eq(0)").html(args.rootTitle);
- };
- FlatTree.prototype.initFlatTree = function () {
- var Index1 = 0;
- var Index2 = 0;
- var Index3 = 0;
- var Index4 = 0;
- var own = this;
- this.$thisNode.find(".breadCumb a:eq(0)").html("全部菜单");
- for (var i = 0, z = this.contentOne.length; i < z; i++) {
- $(FlatTree.TemplateOneItem).appendTo(this.oneDegree);
- this.oneDegree.find("span:eq(" + i + ")").text(this.contentOne[i]);
- this.oneDegree.show();
- }
- this.oneDegree.on("click", "a", {
- contentTwo: this.contentTwo,
- contentThree: this.contentThree
- }, function (event) {
- Index1 = own.oneDegree.find("a").index($(this));
- if (event.data.contentTwo[Index1].length > 0) {
- for (var i = 0, z = event.data.contentTwo[Index1].length; i < z; i++) {
- $(FlatTree.TemplateOtherItem).appendTo(own.twoDegree);
- own.twoDegree.find("span:eq(" + i + ")").text(event.data.contentTwo[Index1][i]);
- if (event.data.contentThree[Index1][i].length > 0) {
- own.twoDegree.find("img:eq(" + i + ")").attr("src", "images/flat_tree/u235.png");
- }
- else {
- own.twoDegree.find("img:eq(" + i + ")").attr("src", "images/flat_tree/u88.png");
- }
- }
- own.$thisNode.find(".breadCumb a:eq(1)").html($(this).find("span").html());
- own.$thisNode.find(".breadCumb div:eq(0)").css("display", "inline-block");
- own.oneDegree.hide();
- own.twoDegree.show();
- }
- var content = "" + Index1;
- EventHub_15.EventHub.dispatchEvent(MessageType_16.MessageType.WIDGET, {
- id: own.id,
- location: content,
- evtType: Event_13.Event.CLICK
- });
- });
- this.twoDegree.on("click", "a", {
- contentThree: this.contentThree,
- contentFour: this.contentFour
- }, function (event) {
- Index2 = own.twoDegree.find("a").index($(this));
- if (event.data.contentThree[Index1][Index2].length > 0) {
- for (var i = 0, z = event.data.contentThree[Index1][Index2].length; i < z; i++) {
- $(FlatTree.TemplateOtherItem).appendTo(own.threeDegree);
- own.threeDegree.find("span:eq(" + i + ")").text(event.data.contentThree[Index1][Index2][i]);
- if (event.data.contentFour[Index1][Index2][i].length > 0) {
- own.threeDegree.find("img:eq(" + i + ")").attr("src", "images/flat_tree/u235.png");
- }
- else {
- own.threeDegree.find("img:eq(" + i + ")").attr("src", "images/flat_tree/u88.png");
- }
- }
- own.$thisNode.find(".breadCumb a:eq(2)").html($(this).find("span").html());
- own.$thisNode.find(".breadCumb div:eq(1)").css("display", "inline-block");
- own.twoDegree.hide();
- own.threeDegree.show();
- }
- var content = '[' + Index1 + ',' + Index2 + ']';
- EventHub_15.EventHub.dispatchEvent(MessageType_16.MessageType.WIDGET, {
- id: own.id,
- location: content,
- evtType: Event_13.Event.CLICK
- });
- });
- this.threeDegree.on("click", "a", {
- contentFour: this.contentFour
- }, function (event) {
- Index3 = own.threeDegree.find("a").index($(this));
- if (event.data.contentFour[Index1][Index2][Index3].length > 0) {
- for (var i = 0, z = event.data.contentFour[Index1][Index2][Index3].length; i < z; i++) {
- $(FlatTree.TemplateOtherItem).appendTo(own.fourDegree);
- own.fourDegree.find("span:eq(" + i + ")").text(event.data.contentFour[Index1][Index2][Index3][i]);
- own.fourDegree.find("img:eq(" + i + ")").attr("src", "images/flat_tree/u88.png");
- }
- own.$thisNode.find(".breadCumb a:eq(3)").html($(this).find("span").html());
- own.$thisNode.find(".breadCumb div:eq(2)").css("display", "inline-block");
- own.threeDegree.hide();
- own.fourDegree.show();
- }
- var content = '[' + Index1 + ',' + Index2 + ',' + Index3 + ']';
- EventHub_15.EventHub.dispatchEvent(MessageType_16.MessageType.WIDGET, {
- id: own.id,
- location: content,
- evtType: Event_13.Event.CLICK
- });
- });
- this.fourDegree.on("click", "a", function (event) {
- Index4 = own.fourDegree.find("a").index($(this));
- var content = '[' + Index1 + ',' + Index2 + ',' + Index3 + ',' + Index4 + ']';
- EventHub_15.EventHub.dispatchEvent(MessageType_16.MessageType.WIDGET, {
- id: own.id,
- location: content,
- evtType: Event_13.Event.CLICK
- });
- });
- own.$thisNode.find(".breadCumb a").on("click", function () {
- var index_bread = own.$thisNode.find(".breadCumb a").index($(this));
- own.$thisNode.find(".wrap_flatTree:eq(" + index_bread + ")").show().siblings(".wrap_flatTree").hide();
- own.$thisNode.find(".wrap_flatTree:eq(" + index_bread + ")").nextAll().empty();
- if (index_bread > 0) {
- $(this).parent("div").nextAll("div").hide();
- }
- else {
- $(this).nextAll("div").hide();
- }
- });
- };
- FlatTree.prototype.dispose = function () {
- _super.prototype.dispose.call(this);
- };
- 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>></span>\n <a href=\"javascript:void(0)\"></a>\n </div>\n <div>\n <span>></span>\n <a href=\"javascript:void(0)\"></a>\n </div>\n <div>\n <span>></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>";
- 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>";
- FlatTree.TemplateOtherItem = "\n <a class=\"otherItem\" href=\"javascript:void(0)\">\n <img class=\"img \" src=\"\">\n <span></span>\n </a>";
- return FlatTree;
- }(Widget_15.Widget));
- exports.FlatTree = FlatTree;
- });
- define("widget/FloatPanelButton", ["require", "exports", "widget/Widget"], function (require, exports, Widget_16) {
- "use strict";
- var FloatPanelButton = (function (_super) {
- __extends(FloatPanelButton, _super);
- function FloatPanelButton(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.$thisNode = $(FloatPanelButton.TemplateCotainer).attr({ id: this.id });
- }
- FloatPanelButton.prototype.setText = function (args) {
- var text = args.text;
- this.$thisNode.find(".personal_info_name").text(text);
- };
- FloatPanelButton.prototype.setImagePath = function (args) {
- var imagePath = args.imagePath;
- this.$thisNode.find("img.info_image").attr("src", imagePath);
- };
- 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 ";
- return FloatPanelButton;
- }(Widget_16.Widget));
- exports.FloatPanelButton = FloatPanelButton;
- });
- define("widget/FloatPanelComposite", ["require", "exports", "widget/Composite", "util/WidgetManager", "widget/CheckButton"], function (require, exports, Composite_4, WidgetManager_4, CheckButton_1) {
- "use strict";
- var FloatPanelComposite = (function (_super) {
- __extends(FloatPanelComposite, _super);
- function FloatPanelComposite(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.bindClickCount = 0;
- this.$wrapNode = $(FloatPanelComposite.TemplateWrapper).attr("id", this.id + "wrapper");
- this.$thisNode = $(FloatPanelComposite.TemplateCotainer).attr("id", this.id);
- this.$attachNode = this.$thisNode;
- this.$arrowNode = $(FloatPanelComposite.TemplateArrow).attr("id", "arrow" + this.id);
- var own = this;
- this.resizeListener = function () {
- if (own.$thisNode.css("display") === "block") {
- own.$thisNode.css("display", "none");
- own.$arrowNode.hide();
- $(".float_panel_iframe").hide();
- $(document).find(".personal_info_arrow").removeClass("mdi-navigation-arrow-drop-up").addClass("mdi-navigation-arrow-drop-down");
- }
- };
- $(window).on("resize", this.resizeListener);
- }
- FloatPanelComposite.prototype.getPosition = function (obj) {
- var pos = [0, 0];
- if (obj && obj.offsetParent) {
- while (obj && obj.offsetParent) {
- pos[0] += obj.offsetTop;
- pos[1] += obj.offsetLeft;
- obj = obj.offsetParent;
- }
- }
- return pos;
- };
- FloatPanelComposite.prototype.addDocumentBind = function (wid) {
- var own = this;
- $(document).bind('click.' + wid + "_dropDown", function (e) {
- var $source = $(document).find("#" + wid);
- var isSource = false;
- var sourceParent = e.target;
- while (sourceParent) {
- if ($source.is(sourceParent)) {
- isSource = true;
- break;
- }
- sourceParent = sourceParent.parentElement;
- }
- if (!isSource) {
- var isHide = true;
- if (own.$thisNode.css("display") !== "none") {
- var targetParent = e.target;
- while (targetParent) {
- if (own.$thisNode.is(targetParent)) {
- isHide = false;
- break;
- }
- targetParent = targetParent.parentElement;
- }
- if (isHide) {
- own.$thisNode.css("display", "none");
- own.$arrowNode.hide();
- $(".float_panel_iframe").hide();
- $source.find(".personal_info_arrow").removeClass("mdi-navigation-arrow-drop-up").addClass("mdi-navigation-arrow-drop-down");
- $(document).unbind('click.' + wid + "_dropDown");
- }
- }
- else {
- $(document).unbind('click.' + wid + "_dropDown");
- }
- }
- });
- };
- FloatPanelComposite.prototype.setLocation = function (target, isUp) {
- var pos = this.getPosition(target[0]);
- var height = target.height();
- var tmpHeight;
- var iframeTop;
- if (isUp) {
- tmpHeight = pos[0] - this.$thisNode.height() - 5;
- this.$arrowNode.css("top", pos[0] - 21);
- this.$arrowNode.removeClass("mdi-navigation-arrow-drop-up").addClass("mdi-navigation-arrow-drop-down");
- iframeTop = tmpHeight;
- }
- else {
- tmpHeight = height + pos[0] + 5;
- this.$arrowNode.css("top", tmpHeight - 19);
- iframeTop = this.$arrowNode.css("top");
- }
- this.$thisNode.css("top", tmpHeight);
- this.$thisNode.css("left", pos[1]);
- var width = this.$thisNode.width();
- var limitWidth = document.body.clientWidth - pos[1];
- if (width > limitWidth) {
- this.$thisNode.css("left", document.body.clientWidth - width - 2);
- }
- this.$arrowNode.css("left", pos[1] + this.$thisNode.width() / 3 * 2);
- $(".float_panel_content > div").css({
- "position": "static"
- });
- $(".float_panel_iframe").css({
- "width": this.$thisNode.width(),
- "height": this.$thisNode.height() + 20,
- "top": iframeTop,
- "left": this.$thisNode.css("left"),
- "display": "block"
- });
- };
- FloatPanelComposite.prototype.bindClick = function (args) {
- var wid = args.item.wid;
- var bindWidget = WidgetManager_4.WidgetManager.byId(wid);
- var own = this;
- if (bindWidget) {
- var $bindNode = bindWidget.$thisNode;
- if (bindWidget instanceof CheckButton_1.CheckButton) {
- $bindNode = $bindNode.find("input");
- }
- $bindNode.on("click", function (e) {
- if (own.$thisNode.css("display") === "none") {
- own.$thisNode.css("display", "block");
- own.$arrowNode.show();
- own.setLocation(bindWidget.$thisNode, args.item.isUp);
- own.addDocumentBind(wid);
- $(this).find(".personal_info_arrow").removeClass("mdi-navigation-arrow-drop-down").addClass("mdi-navigation-arrow-drop-up");
- }
- else {
- own.$thisNode.css("display", "none");
- own.$arrowNode.hide();
- $(".float_panel_iframe").hide();
- $(this).find(".personal_info_arrow").removeClass("mdi-navigation-arrow-drop-up").addClass("mdi-navigation-arrow-drop-down");
- }
- });
- }
- else {
- this.bindClickCount++;
- if (this.bindClickCount > 5) {
- return;
- }
- setTimeout(function () {
- own.bindClick(args);
- }, 300);
- }
- };
- FloatPanelComposite.prototype.dispose = function () {
- $(window).off("resize", this.resizeListener);
- _super.prototype.dispose.call(this);
- this.$wrapNode.remove();
- };
- FloatPanelComposite.prototype.setEnabled = function (args) {
- var enabled = args.enabled;
- if (!enabled) {
- if (this.$thisNode.css("display") !== "none") {
- this.$wrapNode.css("display", "none");
- this.$thisNode.css("display", "none");
- }
- }
- };
- FloatPanelComposite.prototype.setVisible = function (args) {
- var visible = args.visible;
- if (visible) {
- this.$wrapNode.css("display", "block");
- this.$thisNode.css("display", "block");
- }
- else {
- this.$wrapNode.css("display", "none");
- this.$thisNode.css("display", "none");
- }
- };
- FloatPanelComposite.prototype.append = function () {
- this.$thisNode.appendTo(this.$wrapNode.find(".content_wrap"));
- this.$arrowNode.appendTo(this.$wrapNode.find(".content_wrap"));
- this.$wrapNode.appendTo(document.body);
- };
- FloatPanelComposite.TemplateWrapper = "\n <div>\n\t <iframe class=\"float_panel_iframe\"></iframe>\n\t <div class=\"content_wrap\">\n\t </div>\n </div>\n ";
- FloatPanelComposite.TemplateCotainer = "<div class=\"float_panel_content adore-hidden-scrollbar\"></div>";
- FloatPanelComposite.TemplateArrow = "<i class=\"float_panel_arrow mdi-navigation-arrow-drop-up\"></i>";
- return FloatPanelComposite;
- }(Composite_4.Composite));
- exports.FloatPanelComposite = FloatPanelComposite;
- });
- define("widget/Group", ["require", "exports", "widget/Composite"], function (require, exports, Composite_5) {
- "use strict";
- var Group = (function (_super) {
- __extends(Group, _super);
- function Group(parentId, id, style) {
- _super.call(this, parentId, id, style);
- }
- Group.prototype.layout = function () {
- _super.prototype.layout.call(this);
- this.$thisNode.addClass("adore_group");
- $("<div class='adore_group_topCuttingLine'>").insertBefore(this.$thisNode);
- $("<div class='adore_group_bottomCuttingLine'>").insertBefore(this.$thisNode);
- };
- Group.prototype.toString = function () {
- return "Group";
- };
- Group.prototype.setFocus = function () {
- };
- return Group;
- }(Composite_5.Composite));
- exports.Group = Group;
- });
- define("widget/HTMLFragment", ["require", "exports", "widget/Widget"], function (require, exports, Widget_17) {
- "use strict";
- var HTMLFragment = (function (_super) {
- __extends(HTMLFragment, _super);
- function HTMLFragment(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.cssPaths = [];
- this.$thisNode = $(HTMLFragment.Template).attr({ id: this.id });
- }
- HTMLFragment.prototype.html = function (args) {
- if (args.html) {
- this.$thisNode.html(args.html);
- }
- };
- HTMLFragment.prototype.setHtmlFragments = function (args) {
- var htmls = args.htmlFragments;
- if (htmls && htmls.length > 0) {
- var tempArr = new Array();
- for (var i = 0; i < htmls.length; i++) {
- var fragmentNode = this.$thisNode.find("#" + htmls[i].fragmentID);
- if (fragmentNode.length > 0) {
- fragmentNode.html(htmls[i].html);
- }
- else {
- tempArr.push(htmls[i]);
- }
- }
- var count = args.count ? 0 : args.count;
- if (tempArr.length > 0 && count <= 2) {
- setTimeout(this.setHtmlFragments({ htmlFragments: tempArr, count: (count + 1) }), 200);
- }
- }
- };
- HTMLFragment.prototype.setImages = function (args) {
- var images = args.images;
- if (images && images.length > 0) {
- var tempArr = new Array();
- for (var i = 0; i < images.length; i++) {
- var imageNode = this.$thisNode.find("#" + images[i].imageID);
- if (imageNode.length > 0) {
- imageNode.attr("src", images[i].imagePath);
- }
- else {
- tempArr.push(images[i]);
- }
- }
- var count = args.count ? 0 : args.count;
- if (tempArr.length > 0 && count <= 2) {
- setTimeout(this.setImages({ images: tempArr, count: (count + 1) }), 200);
- }
- }
- };
- HTMLFragment.prototype.setTexts = function (args) {
- var texts = args.texts;
- if (texts && texts.length > 0) {
- var tempArr = new Array();
- for (var i = 0; i < texts.length; i++) {
- var textNode = this.$thisNode.find("#" + texts[i].textID);
- if (textNode.length > 0) {
- textNode.text(texts[i].text);
- }
- else {
- tempArr.push(texts[i]);
- }
- }
- var count = args.count ? 0 : args.count;
- if (tempArr.length > 0 && count <= 2) {
- setTimeout(this.setTexts({ texts: tempArr, count: (count + 1) }), 200);
- }
- }
- };
- HTMLFragment.prototype.setCssPaths = function (args) {
- var cssPaths = args.cssPaths;
- if (cssPaths && cssPaths.length > 0) {
- var $headNode = $("head");
- for (var i = 0; i < cssPaths.length; i++) {
- if ($headNode.find("#" + cssPaths[i].cssID).length === 0) {
- $("<link href='" + cssPaths[i].cssPath + "' type='text/css' rel='stylesheet'>").attr("id", cssPaths[i].cssID).appendTo($headNode);
- this.cssPaths.push(cssPaths[i].cssID);
- }
- }
- }
- };
- HTMLFragment.prototype.dispose = function () {
- _super.prototype.dispose.call(this);
- var $headNode = $("head");
- for (var i = 0; i < this.cssPaths.length; i++) {
- $headNode.find("#" + this.cssPaths[i]).remove();
- }
- this.cssPaths.splice(0, this.cssPaths.length);
- };
- HTMLFragment.Template = "<div></div>";
- return HTMLFragment;
- }(Widget_17.Widget));
- exports.HTMLFragment = HTMLFragment;
- });
- define("widget/IFrame", ["require", "exports", "widget/Widget"], function (require, exports, Widget_18) {
- "use strict";
- var IFrame = (function (_super) {
- __extends(IFrame, _super);
- function IFrame(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.$thisNode = $(IFrame.Template).attr({ id: this.id });
- var frameId = this.id;
- this.$thisNode.find("iframe").attr({ width: "100%", height: "100%" }).on("load", function () {
- });
- }
- IFrame.prototype.setURL = function (args) {
- var src = args.url;
- this.$thisNode.find("iframe").attr("src", src);
- };
- IFrame.prototype.setHighDpi = function (args) {
- var viewPortMeta = $("meta[name=viewport]");
- if (args.highDpi) {
- 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");
- }
- else {
- viewPortMeta.attr("content", "width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no");
- }
- };
- IFrame.prototype.execute = function (args) {
- var script = args.script;
- var myFrame = this.$thisNode.find("iframe")[0];
- if (myFrame.contentDocument) {
- var myDocument = myFrame.contentDocument;
- script = script.replace(/document/g, "myDocument");
- eval(script);
- }
- else {
- console.error("iframe.contentDocument not found!");
- }
- };
- IFrame.Template = "\n <div>\n <iFrame></iFrame>\n </div>";
- return IFrame;
- }(Widget_18.Widget));
- exports.IFrame = IFrame;
- });
- define("widget/Image", ["require", "exports", "widget/Widget", "ADORE"], function (require, exports, Widget_19, ADORE_7) {
- "use strict";
- var Image = (function (_super) {
- __extends(Image, _super);
- function Image(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.isLayout = false;
- this.isZoom = false;
- var tmpTemplate = Image.TemplateNormal;
- var isFloat = false;
- if ((style & ADORE_7.ADORE.Zoom) === ADORE_7.ADORE.Zoom) {
- tmpTemplate = Image.TemplateZoom;
- this.isZoom = true;
- }
- else if ((style & ADORE_7.ADORE.Float) === ADORE_7.ADORE.Float) {
- tmpTemplate = Image.TemplateFloat;
- isFloat = true;
- }
- this.$thisNode = $(tmpTemplate).attr({ id: this.id });
- if (isFloat) {
- this.$imgNode = this.$thisNode.find("img");
- }
- else {
- this.$imgNode = this.$thisNode;
- }
- this.$imgNode.attr({ alt: "图片不存在" });
- }
- Image.prototype.setSrc = function (args) {
- var path = args.src;
- this.$imgNode.attr("src", path);
- if (this.isLayout && this.isZoom) {
- this.$imgNode.materialbox();
- }
- };
- Image.prototype.setFocus = function () {
- };
- Image.prototype.postLayout = function () {
- if (this.isZoom) {
- this.$imgNode.materialbox();
- }
- this.isLayout = true;
- };
- Image.TemplateNormal = "<img class=\"responsive-img\">";
- Image.TemplateFloat = "\n <div>\n <img class=\"circle responsive-img\">\n </div>";
- Image.TemplateZoom = "<img class=\"materialboxed responsive-img\">";
- return Image;
- }(Widget_19.Widget));
- exports.Image = Image;
- });
- define("widget/ImageViewer", ["require", "exports", "widget/Widget", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, Widget_20, EventHub_16, MessageType_17, Event_14) {
- "use strict";
- var ImageViewer = (function (_super) {
- __extends(ImageViewer, _super);
- function ImageViewer(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.$thisNode = $(ImageViewer.Template).attr("id", this.id);
- this.$pictureList = this.$thisNode.find(".picture_list");
- this.$btnBig = this.$thisNode.find(".adore_picture_blowup");
- this.$btnSmall = this.$thisNode.find(".adore_picture_reduce");
- this.$btnReset = this.$thisNode.find(".adore_picture_reset");
- }
- ImageViewer.prototype.blowup = function () {
- this.imgWidth = $(".adore_picture_preview_img").width();
- this.imgHeight = $(".adore_picture_preview_img").height();
- if ((this.imgHeight <= this.imgHeight * 2) || (this.imgWidth <= this.imgWidth * 2)) {
- this.imgHeight = this.imgHeight + 20;
- this.imgWidth = this.imgWidth + 20;
- $(".adore_picture_preview_img").css("width", this.imgWidth + "px");
- $(".adore_picture_preview_img").css("height", this.imgHeight + "px");
- }
- };
- ImageViewer.prototype.reduce = function () {
- this.imgWidth = $(".adore_picture_preview_img").width();
- this.imgHeight = $(".adore_picture_preview_img").height();
- if ((this.imgHeight > 200) && (this.imgWidth > 200)) {
- this.imgHeight = this.imgHeight - 20;
- this.imgWidth = this.imgWidth - 20;
- $(".adore_picture_preview_img").css("width", this.imgWidth + "px");
- $(".adore_picture_preview_img").css("height", this.imgHeight + "px");
- }
- };
- ImageViewer.prototype.setImages = function (args) {
- this.imgs = args.imgs;
- if (this.imgs.length <= 0) {
- return;
- }
- var own = this;
- for (var i = 0; i < own.imgs.length; i++) {
- var flag = own.imgs[i].replace(/\//g, "v");
- flag = flag.replace(/\\/g, "v");
- flag = flag.replace(/\:/g, "v");
- flag = flag.replace(/\./g, "v");
- if (own.$pictureList.find("#" + flag).length <= 0) {
- 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>");
- }
- }
- this.$btnBig.click(function () {
- if (own.$thisNode.find(".adore_picture_preview_img").length > 0) {
- own.blowup();
- }
- });
- this.$btnSmall.click(function () {
- if (own.$thisNode.find(".adore_picture_preview_img").length > 0) {
- own.reduce();
- }
- });
- this.$btnReset.click(function () {
- if (own.$thisNode.find(".adore_picture_preview_img").length > 0) {
- $(".adore_picture_preview_img").css("width", own.width + "px");
- $(".adore_picture_preview_img").css("height", own.height + "px");
- }
- });
- this.$pictureList.click(function (event) {
- var $li = $(this).children();
- var cur = event.target;
- var imgSrc;
- own.$thisNode.find(".adore_picture_preview_img").remove();
- if ($(cur).is($li)) {
- $(cur).addClass("picture_select_current");
- $(cur).siblings().removeClass("picture_select_current");
- }
- else if ($(cur).is("img")) {
- $(cur).parent().addClass("picture_select_current");
- $(cur).parent().siblings().removeClass("picture_select_current");
- }
- var $pictureli = own.$thisNode.find(".picture_select_current");
- var $thisPicture = $pictureli.find(".adore_picture_list_img");
- imgSrc = $thisPicture.attr("src");
- if (imgSrc != null && imgSrc.length > 0) {
- own.$thisNode.find(".adore_picture_preview").append("<img src=\"" + imgSrc + "\" class=\"adore_picture_preview_img\"/>");
- own.width = $(".adore_picture_preview_img").width();
- own.height = $(".adore_picture_preview_img").height();
- }
- });
- var $checked = this.$thisNode.find("input[type='checkbox']");
- for (var i = 0; i < $checked.length; i++) {
- $checked.eq(i).click(function () {
- if ($(this).is(":checked")) {
- var result = $(this).val() + "";
- EventHub_16.EventHub.dispatchEvent(MessageType_17.MessageType.WIDGET, {
- id: own.id,
- selectedImage: result,
- evtType: Event_14.Event.CLICK
- });
- }
- });
- }
- };
- ImageViewer.prototype.removeImages = function (args) {
- var rImgs = args.removeImgs;
- for (var i = 0; i < rImgs.length; i++) {
- var result = rImgs[i].replace(/\//g, "v");
- result = result.replace(/\\/g, "v");
- result = result.replace(/\:/g, "v");
- result = result.replace(/\./g, "v");
- this.$thisNode.find("#" + result).remove();
- }
- };
- 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>";
- return ImageViewer;
- }(Widget_20.Widget));
- exports.ImageViewer = ImageViewer;
- });
- define("widget/integration/AbstractContainer", ["require", "exports", "widget/Composite"], function (require, exports, Composite_6) {
- "use strict";
- var AbstractContainer = (function (_super) {
- __extends(AbstractContainer, _super);
- function AbstractContainer(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.reinitCount = 0;
- AbstractContainer._this = this;
- this.$thisNode = $("#" + id);
- if (this.$thisNode.length === 0) {
- setTimeout(AbstractContainer._this.reinit, 200);
- }
- else {
- this.reset();
- }
- }
- AbstractContainer.prototype.reinit = function () {
- var own = AbstractContainer._this;
- own.$thisNode = $("#" + own.id);
- if (own.$thisNode.length === 0) {
- if (own.reinitCount < 10) {
- own.reinitCount++;
- setTimeout(own.reinit, 200);
- }
- else {
- console.error("not found element[" + own.id + "]");
- }
- }
- else {
- own.reset();
- }
- };
- AbstractContainer.prototype.toString = function () {
- return "AbstractContainer";
- };
- AbstractContainer.prototype.dispose = function () {
- _super.prototype.dispose.call(this);
- AbstractContainer._this = null;
- };
- AbstractContainer.prototype.append = function () {
- };
- AbstractContainer.prototype.layout = function () {
- };
- AbstractContainer.prototype.setLayoutData = function (args) {
- };
- return AbstractContainer;
- }(Composite_6.Composite));
- exports.AbstractContainer = AbstractContainer;
- });
- define("widget/integration/AbstractIntegration", ["require", "exports", "widget/Widget"], function (require, exports, Widget_21) {
- "use strict";
- var AbstractIntegration = (function (_super) {
- __extends(AbstractIntegration, _super);
- function AbstractIntegration(parentId, id, style) {
- _super.call(this, null, id, style);
- this.reinitCount = 0;
- this.$thisNode = $("#" + id);
- AbstractIntegration._this = this;
- if (this.$thisNode.length === 0) {
- setTimeout(AbstractIntegration._this.reinit, 200);
- }
- else {
- this.reset();
- }
- }
- AbstractIntegration.prototype.reinit = function () {
- var own = AbstractIntegration._this;
- own.$thisNode = $("#" + own.id);
- if (own.$thisNode.length === 0) {
- if (own.reinitCount < 10) {
- own.reinitCount++;
- setTimeout(own.reinit, 200);
- }
- else {
- console.error("not found element[" + own.id + "]");
- }
- }
- else {
- own.reset();
- }
- };
- AbstractIntegration.prototype.toString = function () {
- return "AbstractIntegration";
- };
- AbstractIntegration.prototype.dispose = function () {
- _super.prototype.dispose.call(this);
- AbstractIntegration._this = null;
- };
- AbstractIntegration.prototype.append = function () {
- };
- AbstractIntegration.prototype.layout = function () {
- };
- AbstractIntegration.prototype.setLayoutData = function (args) {
- };
- return AbstractIntegration;
- }(Widget_21.Widget));
- exports.AbstractIntegration = AbstractIntegration;
- });
- 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) {
- "use strict";
- var Button$ = (function (_super) {
- __extends(Button$, _super);
- function Button$(parentId, id, style) {
- _super.call(this, parentId, id, style);
- }
- Button$.prototype.reset = function () {
- var _this = this;
- this.$thisNode.on("click", function (e) {
- if (_this.enabled) {
- EventHub_17.EventHub.dispatchEvent(MessageType_18.MessageType.WIDGET, { id: _this.id, evtType: Event_15.Event.CLICK });
- }
- });
- if (this.text) {
- this.setText({ text: this.text });
- }
- };
- Button$.prototype.setText = function (args) {
- this.text = args.text;
- this.$thisNode.find("span[text]").html(args.text);
- };
- return Button$;
- }(AbstractIntegration_1.AbstractIntegration));
- exports.Button$ = Button$;
- });
- define("widget/integration/Composite$", ["require", "exports", "widget/integration/AbstractContainer"], function (require, exports, AbstractContainer_1) {
- "use strict";
- var Composite$ = (function (_super) {
- __extends(Composite$, _super);
- function Composite$(parentId, id, style) {
- _super.call(this, parentId, id, style);
- }
- Composite$.prototype.reset = function () {
- this.$attachNode = this.$thisNode;
- };
- return Composite$;
- }(AbstractContainer_1.AbstractContainer));
- exports.Composite$ = Composite$;
- });
- define("widget/integration/Label$", ["require", "exports", "widget/integration/AbstractIntegration"], function (require, exports, AbstractIntegration_2) {
- "use strict";
- var Label$ = (function (_super) {
- __extends(Label$, _super);
- function Label$(parentId, id, style) {
- _super.call(this, parentId, id, style);
- }
- Label$.prototype.reset = function () {
- if (this.text) {
- this.setText({ text: this.text });
- }
- };
- Label$.prototype.setText = function (args) {
- this.$thisNode[0].innerHTML = args.text;
- };
- return Label$;
- }(AbstractIntegration_2.AbstractIntegration));
- exports.Label$ = Label$;
- });
- 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) {
- "use strict";
- var Text$ = (function (_super) {
- __extends(Text$, _super);
- function Text$(parentId, id, style) {
- _super.call(this, parentId, id, style);
- }
- Text$.prototype.reset = function () {
- if ((this.style & ADORE_8.ADORE.Password) === ADORE_8.ADORE.Password) {
- this.$thisNode.find("input").attr("type", "password");
- }
- var id = this.id;
- this.$thisNode.find("input").attr("id", this.id).on("input", function (e) {
- EventHub_18.EventHub.dispatchEvent(MessageType_19.MessageType.WIDGET, {
- id: id,
- text: $(this).val(),
- evtType: Event_16.Event.MODIFY,
- syncAttrName: "text"
- });
- });
- if (this.text) {
- this.setText({ text: this.text });
- }
- if (this.editable) {
- this.setEditable({ editable: this.editable });
- }
- };
- Text$.prototype.setText = function (args) {
- this.text = args.text;
- this.$thisNode.find("input").val(args.text);
- };
- Text$.prototype.setEditable = function (args) {
- this.editable = args.editable;
- if (args.editable) {
- this.$thisNode.find("input").removeAttr("readOnly");
- }
- else {
- this.$thisNode.find("input").attr("readOnly", "readOnly");
- }
- };
- return Text$;
- }(AbstractIntegration_3.AbstractIntegration));
- exports.Text$ = Text$;
- });
- define("widget/Label", ["require", "exports", "widget/Widget"], function (require, exports, Widget_22) {
- "use strict";
- var Label = (function (_super) {
- __extends(Label, _super);
- function Label(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.$thisNode = $(Label.TemplateLabel).attr({ id: this.id });
- }
- Label.prototype.setText = function (args) {
- var text = args.text;
- this.$thisNode[0].innerHTML = text;
- };
- Label.prototype.setFontSize = function (args) {
- this.$thisNode.css({ fontSize: args.fontSize });
- };
- Label.prototype.setAlignment = function (args) {
- this.$thisNode.css({ textAlign: args.alignment });
- };
- Label.prototype.setFocus = function () {
- };
- Label.TemplateLabel = "<nobr class=\"adore_label\"></nobr>";
- return Label;
- }(Widget_22.Widget));
- exports.Label = Label;
- });
- 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) {
- "use strict";
- var List = (function (_super) {
- __extends(List, _super);
- function List(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.$thisNode = $(List.TemplateCotainer).attr("id", this.id);
- this.itemTemplate = List.TemplateHorizontal;
- this.isHorizontal = true;
- if ((this.style & ADORE_9.ADORE.Vertical) === ADORE_9.ADORE.Vertical) {
- this.isHorizontal = false;
- this.itemTemplate = List.TemplateVertical;
- }
- }
- List.prototype.addItems = function (args) {
- var items = args.items;
- var $father = this.$thisNode.parent();
- this.$thisNode.detach();
- if (!items || items.length === 0) {
- return;
- }
- for (var i = 0; i < items.length; i++) {
- if (items[i].name) {
- if (this.$thisNode.find("#" + items[i].name).length !== 0) {
- this.setItem(items[i]);
- }
- else {
- this.addItem(items[i]);
- }
- }
- }
- if (this.fontSize) {
- this.$thisNode.find("span").css({ fontSize: this.fontSize });
- }
- this.$thisNode.appendTo($father);
- };
- List.prototype.setItem = function (item) {
- var $itemNode = this.$thisNode.find("#" + item.name);
- this.setItemAttr($itemNode, item);
- };
- List.prototype.addItem = function (item) {
- var $itemNode = $(this.itemTemplate).attr({ id: item.name });
- $itemNode.appendTo(this.$thisNode);
- this.setItemAttr($itemNode, item);
- var own = this;
- $itemNode.find("a").on("click", function (e) {
- if (!own.enabled) {
- return;
- }
- $("a.adore_list_li_a_selected").removeClass("adore_list_li_a_selected");
- $(this).addClass("adore_list_li_a_selected");
- var itemIndex = own.indexOf($itemNode[0]);
- e.preventDefault();
- EventHub_19.EventHub.dispatchEvent(MessageType_20.MessageType.WIDGET, {
- id: own.id,
- selectIndex: itemIndex,
- evtType: Event_17.Event.ON_CHANGE
- });
- });
- };
- List.prototype.setItemAttr = function ($itemNode, item) {
- $itemNode.find("a").find("span").text(item.name);
- if (item.imagePath) {
- $itemNode.find("img").attr("src", item.imagePath);
- if (this.isHorizontal) {
- $itemNode.find("img").css({ width: "18px", height: "18px" });
- }
- else {
- $itemNode.find(".adore_list_span").css("margin-top", "-5px");
- }
- }
- if (item.msgNum) {
- var $msgNode = $itemNode.find(".adore_list_message");
- if ($msgNode.length === 0) {
- $msgNode = $(List.TemplateSpan);
- $itemNode.prepend($msgNode);
- if (this.isHorizontal) {
- $msgNode.addClass("adore_list_message_horizontal");
- }
- else {
- $msgNode.addClass("adore_list_message_vertical");
- }
- }
- }
- else {
- $itemNode.find(".adore_list_message").remove();
- }
- };
- List.prototype.setItems = function (args) {
- var items = args.items;
- this.clear();
- this.addItems({ items: items });
- };
- List.prototype.setFontSize = function (args) {
- this.fontSize = args.fontSize;
- if (this.$thisNode) {
- this.$thisNode.find("span").css({ fontSize: args.fontSize });
- }
- };
- List.prototype.indexOf = function (item) {
- var $items = this.$thisNode.find("li");
- for (var i = 0; i < $items.length; i++) {
- if (item === $items[i]) {
- return i;
- }
- }
- return -1;
- };
- List.prototype.select = function (args) {
- var index = args.index;
- var allA = this.$thisNode.find("a");
- if (index < 0 || index >= allA.length) {
- return;
- }
- $(allA[index]).trigger("click");
- };
- List.prototype.removeItem = function (args) {
- var ids = args.itemIds;
- if (ids && ids.length > 0) {
- for (var i = 0; i < ids.length; i++) {
- this.$thisNode.find("#" + ids[i]).remove();
- }
- }
- };
- List.prototype.clear = function () {
- this.$thisNode.find("li").remove();
- };
- List.prototype.setFocus = function () {
- };
- List.TemplateCotainer = "\n <ul class=\"adore_list\">\n </ul>";
- 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> ";
- 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>";
- List.TemplateSpan = "\n <span class=\"adore_list_message\"></span>";
- return List;
- }(Widget_23.Widget));
- exports.List = List;
- });
- define("widget/MessageList", ["require", "exports", "widget/Widget"], function (require, exports, Widget_24) {
- "use strict";
- var MessageList = (function (_super) {
- __extends(MessageList, _super);
- function MessageList(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.$thisNode = $(MessageList.Template).attr("id", this.id);
- }
- MessageList.prototype.sendMessages = function (args) {
- var messages = args.messages;
- var currentTime;
- if (!this.userName || this.userName.length === 0) {
- return;
- }
- for (var i = 0; i < messages.length; i++) {
- if (messages[i].source === this.userName) {
- if (!this.isShow || messages[i].time === currentTime) {
- 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> ");
- }
- else {
- 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> ");
- currentTime = messages[i].time;
- }
- }
- else if (messages[i].target === this.userName) {
- if (!this.isShow || messages[i].time === currentTime) {
- this.$thisNode.append("<div class=\"message clearfix\"><span class=\"triangle_left\"></span><div class=\"article_left\">" + messages[i].message + "</div></div>");
- }
- else {
- 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>");
- currentTime = messages[i].time;
- }
- }
- }
- };
- MessageList.prototype.setUserName = function (args) {
- this.userName = args.userName;
- };
- MessageList.prototype.isShowTime = function (args) {
- this.isShow = args.isShow;
- };
- MessageList.prototype.setFocus = function () {
- };
- MessageList.Template = "<div class=\"adore_message_list\"></div>";
- return MessageList;
- }(Widget_24.Widget));
- exports.MessageList = MessageList;
- });
- 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) {
- "use strict";
- var CustCollection = (function (_super) {
- __extends(CustCollection, _super);
- function CustCollection(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.$thisNode = $(CustCollection.TemplateBody).attr("id", this.id);
- this.itemHeaderTemplate = CustCollection.TemplateHeader;
- this.itemTemplate = CustCollection.TemplateContent;
- this.itemIconTemplate = CustCollection.TemplateImage;
- this.contentOne = new Array();
- this.contentTwo = new Array();
- }
- CustCollection.prototype.postLayout = function () {
- $(".collapsible").collapsible({
- accordion: false
- });
- };
- CustCollection.prototype.setContents = function (args) {
- var data = JSON.parse(args.attribute);
- for (var key in data) {
- var belongTo = key.length - key.replace(/,/g, "").length;
- switch (belongTo) {
- case 0:
- this.contentOne[parseInt(key)] = data[key];
- this.contentTwo[parseInt(key)] = new Array();
- break;
- case 1:
- var cutKey = key.substr(1, key.length - 2);
- var location_1 = cutKey.split(",");
- var m = Number(location_1[0]);
- var n = Number(location_1[1]);
- this.contentTwo[m][n] = data[key];
- break;
- default:
- console.log("data error");
- break;
- }
- }
- };
- CustCollection.prototype.initCollection = function () {
- var own = this;
- var flag = false;
- for (var i = 0; i < this.contentTwo.length; i++) {
- if (this.contentTwo[i].length > 0) {
- flag = true;
- break;
- }
- }
- if (flag) {
- for (var i = 0; i < this.contentOne.length; i++) {
- var itemHeaderNode = $(this.itemHeaderTemplate);
- itemHeaderNode.find("#itemHeader").text(this.contentOne[i]);
- this.$thisNode.find("#itemHeaderBody").append(itemHeaderNode);
- for (var j = 0; j < this.contentTwo[i].length; j++) {
- var itemNode = $(this.itemTemplate);
- var contentId = i + "_" + j;
- var itemContentNode = itemNode.find("#itemContent").attr("id", contentId);
- itemContentNode.text(this.contentTwo[i][j]);
- itemContentNode.append(this.itemIconTemplate);
- itemContentNode.on("click", function (event) {
- var tempAttr = this.id.split("_");
- $(this).children("img").remove();
- var indexString = "[" + tempAttr[0] + "," + tempAttr[1] + "]";
- EventHub_20.EventHub.dispatchEvent(MessageType_21.MessageType.WIDGET, {
- id: own.id,
- location: indexString,
- evtType: Event_18.Event.CLICK
- });
- });
- itemHeaderNode.find("#itemBody").append(itemNode);
- }
- }
- }
- };
- 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>";
- 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>";
- CustCollection.TemplateContent = "\n <a href=\"#!\" class=\"collection-item active waves-effect\">\n <div id=\"itemContent\"></div>\n </a>";
- 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%\">";
- return CustCollection;
- }(Widget_25.Widget));
- exports.CustCollection = CustCollection;
- });
- define("widget/Palette", ["require", "exports", "widget/Composite", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, Composite_7, EventHub_21, MessageType_22, Event_19) {
- "use strict";
- var Palette = (function (_super) {
- __extends(Palette, _super);
- function Palette(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.$thisNode = $(Palette.Template).attr("id", this.id);
- this.$leftBox = this.$thisNode.find(".select-box-left");
- this.$buttonUL = this.$thisNode.find("input[type='button']");
- this.$boxItem = this.$thisNode.find(".select-box-data");
- }
- Palette.prototype.setItems = function (args) {
- var items = args.items;
- this.addItems(items);
- var own = this;
- this.$buttonUL.click(function () {
- var i = $(this).index();
- var move = "";
- var targ = "";
- var direction = "";
- if (i === 0) {
- move = ".select-box-left li.select-current";
- targ = ".select-box-right";
- direction = "0";
- }
- if (i === 1) {
- move = "li.select-current";
- direction = "1";
- }
- if (i === 2) {
- move = ".select-box-right li.select-current";
- targ = ".select-box-left";
- direction = "2";
- }
- if (i === 3) {
- move = "li.select-current";
- direction = "3";
- }
- own.moveSelectBox(move, targ, direction);
- });
- this.$boxItem.click(function (event) {
- var $li = $(this).children();
- var cur = event.target;
- if ($(cur).is($li)) {
- $(cur).addClass("select-current");
- $(cur).siblings().removeClass("select-current");
- }
- });
- };
- Palette.prototype.addItems = function (items) {
- if (!items || items.length === 0) {
- return;
- }
- for (var i = 0; i < items.length; i++) {
- this.$leftBox.append("<li>" + items[i].name + "</li>");
- }
- };
- Palette.prototype.moveSelectBox = function (moveClass, targetClass, direction) {
- if ($(moveClass).length === 0) {
- return;
- }
- else {
- var own = this;
- if (direction === "0") {
- var removeItemText_1 = "";
- $.each($(moveClass), function () {
- $(this).remove().appendTo(targetClass + "");
- $(this).text($(this).text());
- removeItemText_1 = $(this).text();
- });
- $(targetClass + " .select-current").removeClass("select-current");
- EventHub_21.EventHub.dispatchEvent(MessageType_22.MessageType.WIDGET, {
- id: own.id,
- removeItemText: removeItemText_1,
- direction: direction,
- evtType: Event_19.Event.CLICK
- });
- }
- if (direction === "1") {
- moveClass = ".select-box-right li.select-current";
- if ($(moveClass).length === 0) {
- moveClass = ".select-box-left li.select-current";
- }
- $.each($(moveClass), function () {
- if ($(this).prev()) {
- $(this).prev().before($(this));
- }
- });
- $(moveClass).removeClass("select-current");
- }
- if (direction === "2") {
- var removeItemText = "";
- $.each($(moveClass), function () {
- $(this).remove().appendTo(targetClass + "");
- $(this).text($(this).text());
- });
- $(targetClass + " .select-current").removeClass("select-current");
- EventHub_21.EventHub.dispatchEvent(MessageType_22.MessageType.WIDGET, {
- id: own.id,
- removeItemText: removeItemText,
- direction: direction,
- evtType: Event_19.Event.CLICK
- });
- }
- if (direction === "3") {
- moveClass = ".select-box-right li.select-current";
- if ($(moveClass).length === 0) {
- moveClass = ".select-box-left li.select-current";
- }
- $.each($(moveClass), function () {
- if ($(this).next()) {
- $(this).next().after($(this));
- }
- });
- $(moveClass).removeClass("select-current");
- }
- }
- };
- Palette.prototype.setFocus = function () {
- };
- 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=\">\">\n <input type=\"button\" value=\"∧\">\n <input type=\"button\" value=\"<\">\n <input type=\"button\" value=\"∨\">\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>";
- return Palette;
- }(Composite_7.Composite));
- exports.Palette = Palette;
- });
- define("widget/PatternLock", ["require", "exports", "widget/Widget", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, Widget_26, EventHub_22, MessageType_23, Event_20) {
- "use strict";
- var PatternLock = (function (_super) {
- __extends(PatternLock, _super);
- function PatternLock(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.count = 1;
- this.$thisNode = $(PatternLock.Template).attr({ id: id });
- }
- PatternLock.prototype.setOptions = function (args) {
- this.options = args.options;
- };
- PatternLock.prototype.setArgs = function (args) {
- this.arg = args.arg;
- };
- PatternLock.prototype.setCount = function (args) {
- this.count = args.count;
- };
- PatternLock.prototype.layout = function () {
- this.append();
- this.$thisNode.GesturePasswd(this.options, this.arg);
- };
- PatternLock.prototype.show = function () {
- var own = this;
- var oldPwd = "-1";
- var flag = true;
- var count1 = 0;
- this.$thisNode.on("hasPasswd", function (e, passwd) {
- if (count1 === own.count - 1) {
- if (oldPwd === "-1") {
- own.$thisNode.trigger("passwdRight");
- EventHub_22.EventHub.dispatchEvent(MessageType_23.MessageType.WIDGET, { id: own.id, evtType: Event_20.Event.ON_SLIDING, password: passwd });
- own.$thisNode.closeModal();
- }
- else if (oldPwd !== passwd) {
- own.$thisNode.trigger("passwdWrong");
- EventHub_22.EventHub.dispatchEvent(MessageType_23.MessageType.WIDGET, { id: own.id, evtType: Event_20.Event.ON_SLIDING, password: "-1" });
- own.$thisNode.closeModal();
- }
- else {
- own.$thisNode.trigger("passwdWrong");
- EventHub_22.EventHub.dispatchEvent(MessageType_23.MessageType.WIDGET, { id: own.id, evtType: Event_20.Event.ON_SLIDING, password: passwd });
- own.$thisNode.closeModal();
- }
- }
- else if (count1 === 0) {
- own.$thisNode.trigger("passwdRight");
- oldPwd = passwd;
- count1 = count1 + 1;
- }
- else {
- if (oldPwd === passwd) {
- own.$thisNode.trigger("passwdRight");
- count1 = count1 + 1;
- }
- else {
- own.$thisNode.trigger("passwdWrong");
- EventHub_22.EventHub.dispatchEvent(MessageType_23.MessageType.WIDGET, { id: own.id, evtType: Event_20.Event.ON_SLIDING, password: "-1" });
- own.$thisNode.closeModal();
- }
- }
- });
- this.$thisNode.openModal({
- dismissible: false,
- opacity: .5,
- in_duration: 300,
- out_duration: 200
- });
- };
- PatternLock.prototype.dispose = function () {
- $(".lean-overlay").remove();
- $("#" + this.id + "_lean_overlay").remove();
- _super.prototype.dispose.call(this);
- };
- PatternLock.Template = "<div class=\"modal adore_patternlock\"></div>";
- return PatternLock;
- }(Widget_26.Widget));
- exports.PatternLock = PatternLock;
- var GesturePasswd = (function () {
- function GesturePasswd(element, option, arg) {
- this.$element = $(element);
- this.options = option;
- var that = this;
- this.pr = option.pointRadii;
- this.rr = option.roundRadii;
- this.o = option.space;
- this.color = option.color;
- this.$element.css({
- "position": "relation",
- "width": this.options.width,
- "height": this.options.height,
- "background-color": option.backgroundColor,
- "overflow": "hidden",
- "cursor": "default"
- });
- if (!$(element).attr("id")) {
- $(element).attr("id", (Math.random() * 65535).toString());
- }
- this.id = "#" + $(element).attr("id");
- this.result = "";
- this.pList = [];
- this.sList = [];
- this.tP = new Point(0, 0);
- this.$element.append("<canvas class='main-c' width=" + this.options.width + " height=" + this.options.height + ">");
- this.$c = $(this.id + " .main-c")[0];
- this.$ctx = this.$c.getContext("2d");
- this.initDraw();
- this.touched = false;
- $(this.id).on("mousedown touchstart", { that: that }, function (e) {
- e.data.that.touched = true;
- });
- $(this.id).on("mouseup touchend", { that: that }, function (e) {
- e.data.that.touched = false;
- that.$ctx.clearRect(0, 0, that.options.width, that.options.height);
- that.$ctx.beginPath();
- that.$ctx.putImageData(e.data.that.initImg, 0, 0);
- that.allDraw(that.options.lineColor);
- for (var p in that.sList) {
- if (e.data.that.pointInList(that.sList[p], e.data.that.pList)) {
- e.data.that.result = e.data.that.result + (e.data.that.pointInList(that.sList[p], e.data.that.pList)).toString();
- }
- }
- $(element).trigger("hasPasswd", that.result);
- });
- $(this.id).on("touchmove mousemove", { that: that }, function (e) {
- if (e.data.that.touched) {
- var x = e.pageX || e.originalEvent.targetTouches[0].pageX;
- var y = e.pageY || e.originalEvent.targetTouches[0].pageY;
- x = x - that.$element.offset().left;
- y = y - that.$element.offset().top;
- var p = e.data.that.isIn(x, y);
- console.log(x);
- if (p !== 0) {
- if (!e.data.that.pointInList(p, e.data.that.sList)) {
- e.data.that.sList.push(p);
- }
- }
- console.log(e.data.that.sList);
- e.data.that.draw(x, y);
- }
- });
- $(this.id).on("passwdWrong", { that: that }, function (e) {
- that.$ctx.clearRect(0, 0, that.options.width, that.options.height);
- that.$ctx.beginPath();
- that.$ctx.putImageData(that.initImg, 0, 0);
- that.allDraw("#cc1c21");
- that.result = "";
- that.pList = [];
- that.sList = [];
- setTimeout(function () {
- that.$ctx.clearRect(0, 0, that.options.width, that.options.height);
- that.$ctx.beginPath();
- that.initDraw();
- }, 500);
- });
- $(this.id).on("passwdRight", { that: that }, function (e) {
- that.$ctx.clearRect(0, 0, that.options.width, that.options.height);
- that.$ctx.beginPath();
- that.$ctx.putImageData(that.initImg, 0, 0);
- that.allDraw("#00a254");
- that.result = "";
- that.pList = [];
- that.sList = [];
- setTimeout(function () {
- that.$ctx.clearRect(0, 0, that.options.width, that.options.height);
- that.$ctx.beginPath();
- that.initDraw();
- }, 500);
- });
- }
- GesturePasswd.prototype.initDraw = function () {
- this.$ctx.strokeStyle = this.color;
- this.$ctx.lineWidth = 2;
- for (var j = 0; j < 3; j++) {
- for (var i = 0; i < 3; i++) {
- 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));
- 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);
- 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));
- if (this.pList.length < 9)
- this.pList.push(tem);
- }
- }
- this.$ctx.stroke();
- this.initImg = this.$ctx.getImageData(0, 0, this.options.width, this.options.height);
- };
- GesturePasswd.prototype.isIn = function (x, y) {
- for (var p in this.pList) {
- if ((Math.pow((x - this.pList[p]["x"]), 2) + Math.pow((y - this.pList[p]["y"]), 2)) < Math.pow(this.rr, 2)) {
- return this.pList[p];
- }
- }
- return 0;
- };
- GesturePasswd.prototype.pointDraw = function (c) {
- if (arguments.length > 0) {
- this.$ctx.strokeStyle = c;
- this.$ctx.fillStyle = c;
- }
- for (var p in this.sList) {
- this.$ctx.moveTo(this.sList[p]["x"] + this.pr, this.sList[p]["y"]);
- this.$ctx.arc(this.sList[p]["x"], this.sList[p]["y"], this.pr, 0, 2 * Math.PI);
- this.$ctx.fill();
- }
- };
- GesturePasswd.prototype.lineDraw = function (c) {
- if (arguments.length > 0) {
- this.$ctx.strokeStyle = c;
- this.$ctx.fillStyle = c;
- }
- if (this.sList.length > 0) {
- for (var p in this.sList) {
- if (p === "0") {
- console.log(this.sList[p]["x"], this.sList[p]["y"]);
- this.$ctx.moveTo(this.sList[p]["x"], this.sList[p]["y"]);
- continue;
- }
- this.$ctx.lineTo(this.sList[p]["x"], this.sList[p]["y"]);
- console.log(this.sList[p]["x"], this.sList[p]["y"]);
- }
- }
- };
- GesturePasswd.prototype.allDraw = function (c) {
- if (arguments.length > 0) {
- this.pointDraw(c);
- this.lineDraw(c);
- this.$ctx.stroke();
- }
- else {
- this.pointDraw();
- this.lineDraw();
- }
- };
- ;
- GesturePasswd.prototype.draw = function (x, y) {
- this.$ctx.clearRect(0, 0, this.options.width, this.options.height);
- this.$ctx.beginPath();
- this.$ctx.putImageData(this.initImg, 0, 0);
- this.$ctx.lineWidth = 4;
- this.pointDraw(this.options.lineColor);
- this.lineDraw(this.options.lineColor);
- this.$ctx.lineTo(x, y);
- this.$ctx.stroke();
- };
- GesturePasswd.prototype.pointInList = function (poi, list) {
- for (var p in list) {
- if (poi["x"] === list[p]["x"] && poi["y"] === list[p]["y"]) {
- var i = parseInt(p);
- return ++i;
- }
- }
- return false;
- };
- GesturePasswd.PatternLockDefaultOptions = {
- zindex: 100,
- roundRadii: 25,
- pointRadii: 6,
- space: 30,
- width: 240,
- height: 240,
- lineColor: "#00aec7",
- backgroundColor: "#252736",
- color: "#FFFFFF"
- };
- return GesturePasswd;
- }());
- exports.GesturePasswd = GesturePasswd;
- var Point = (function () {
- function Point(x, y) {
- this.x = x;
- this.y = y;
- }
- return Point;
- }());
- exports.Point = Point;
- ;
- (function ($) {
- function Plugin(option, arg) {
- this.each(function () {
- var $this = $(this);
- var options = $.extend({}, GesturePasswd.PatternLockDefaultOptions, typeof option === "object" && option);
- var data = $this.data("GesturePasswd");
- var action = typeof option === "string" ? option : NaN;
- if (!data)
- $this.data("danmu", (data = new GesturePasswd(this, options)));
- if (action)
- data[action](arg);
- });
- }
- $.fn.GesturePasswd = Plugin;
- })(jQuery);
- });
- define("widget/PictureList", ["require", "exports", "widget/Widget", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, Widget_27, EventHub_23, MessageType_24, Event_21) {
- "use strict";
- var PictureList = (function (_super) {
- __extends(PictureList, _super);
- function PictureList(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.$thisNode = $(PictureList.Template0).attr({ id: id });
- }
- PictureList.prototype.addItems = function (args) {
- var items = args.items;
- if (!items || items.length === 0) {
- return;
- }
- var $father = this.$thisNode.parent();
- if ($father.length !== 0) {
- this.$thisNode.detach();
- }
- for (var i = 0; i < items.length; i++) {
- if (items[i].id) {
- if (this.$thisNode.find("#" + items[i].id).length !== 0) {
- this.setItem(items[i]);
- }
- else {
- this.addItem(items[i]);
- }
- }
- else {
- this.addItem(items[i]);
- }
- }
- if ($father.length !== 0) {
- this.$thisNode.appendTo($father);
- }
- };
- PictureList.prototype.setItems = function (args) {
- var items = args.items;
- this.clear();
- this.addItems({ items: items });
- };
- PictureList.prototype.addItem = function (args) {
- var itemNode = args.id ? $(PictureList.Template1).attr({ id: args.id }) : $(PictureList.Template1);
- itemNode.appendTo(this.$thisNode);
- this.setItemAttr(itemNode, args);
- var own = this;
- itemNode.find("img").on("click", function (e) {
- var index = own.indexOf(itemNode[0]);
- var itemID = itemNode.attr("id");
- EventHub_23.EventHub.dispatchEvent(MessageType_24.MessageType.WIDGET, {
- id: own.id,
- evtType: Event_21.Event.CLICK,
- index: index,
- itemID: itemID
- });
- });
- };
- PictureList.prototype.indexOf = function (item) {
- var items = this.$thisNode.find("div.adore-picture-list-img");
- for (var i = 0; i < items.length; i++) {
- if (item === items[i]) {
- return i;
- }
- }
- return -1;
- };
- PictureList.prototype.setItem = function (args) {
- var itemNode = this.$thisNode.find("#" + args.id);
- this.setItemAttr(itemNode, args);
- };
- PictureList.prototype.setItemAttr = function (itemNode, args) {
- itemNode.find("img").attr("src", args.imagePath);
- };
- PictureList.prototype.removeItem = function (args) {
- var ids = args.itemIds;
- if (ids && ids.length > 0) {
- for (var i = 0; i < ids.length; i++) {
- this.$thisNode.find("#" + ids[i]).remove();
- }
- }
- };
- PictureList.prototype.clear = function () {
- this.$thisNode.find("div.adore-picture-list-img").remove();
- };
- PictureList.prototype.setFocus = function () {
- };
- PictureList.Template0 = " <div class=\"row\"></div>";
- PictureList.Template1 = "<div class=\"adore-picture-list-img col s4 m3 l2 waves-effect\"><img class=\"responsive-img\"></div>";
- return PictureList;
- }(Widget_27.Widget));
- exports.PictureList = PictureList;
- });
- 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) {
- "use strict";
- var RadioButton = (function (_super) {
- __extends(RadioButton, _super);
- function RadioButton(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.$thisNode = $(RadioButton.TemplateRadioButton).attr({ id: this.id });
- var tmpId = this.id;
- var own = this;
- this.$thisNode.find("input[type=radio]").attr("id", this.id + "_radio").on("change", function (e, options) {
- own.triggerOtherChangeEvent(this, options);
- EventHub_24.EventHub.dispatchEvent(MessageType_25.MessageType.WIDGET, {
- id: tmpId,
- checked: this.checked + "",
- evtType: Event_22.Event.ON_CHANGE,
- syncAttrName: this.checked
- });
- }).on("focus", function (e) {
- own.sendFocusGain();
- }).on("blur", function (e) {
- own.handleBlur();
- });
- this.$thisNode.find("label").attr("for", this.id + "_radio");
- }
- RadioButton.prototype.triggerOtherChangeEvent = function (thisGroup, options) {
- if (options === "setChecked") {
- return;
- }
- var $radioGroup = $("input[name='" + this.groupName + "']");
- for (var i = 0; i < $radioGroup.length; i++) {
- if ($($radioGroup[i]).attr("checked") === "checked") {
- $radioGroup[i].checked = false;
- $($radioGroup[i]).removeAttr("checked");
- $($radioGroup[i]).trigger("change", ["setChecked"]);
- break;
- }
- }
- $(thisGroup).attr("checked", "checked");
- };
- RadioButton.prototype.setName = function (args) {
- this.$thisNode.find("label").text(args.name);
- };
- RadioButton.prototype.setGroupName = function (args) {
- this.groupName = args.group;
- this.$thisNode.find("input").attr("name", this.groupName);
- };
- RadioButton.prototype.setChecked = function (args) {
- if (args.isChecked) {
- this.reset((this.$thisNode.find("input[type]")[0]));
- }
- };
- RadioButton.prototype.reset = function (thisGroup) {
- if (thisGroup.checked) {
- return;
- }
- var $radioGroup = $("input[name='" + this.groupName + "']");
- for (var i = 0; i < $radioGroup.length; i++) {
- if ($($radioGroup[i]).attr("checked") === "checked") {
- $radioGroup[i].checked = false;
- $($radioGroup[i]).removeAttr("checked");
- $($radioGroup[i]).trigger("change", ["setChecked"]);
- break;
- }
- }
- $(thisGroup).attr("checked", "checked");
- thisGroup.checked = true;
- $(thisGroup).trigger("change", ["setChecked"]);
- };
- RadioButton.prototype.setEnabled = function (args) {
- this.enabled = args.enabled;
- if (this.enabled) {
- this.$thisNode.find("input").removeAttr("disabled");
- }
- else {
- this.$thisNode.find("input").attr("disabled", "disabled");
- }
- };
- RadioButton.prototype.setFocus = function () {
- var inputNode = this.$thisNode.find("input");
- if (document.activeElement !== inputNode[0]) {
- inputNode.focus();
- }
- this.$thisNode.find("label").addClass("adore_check_button_focus_label");
- };
- RadioButton.prototype.handleBlur = function () {
- this.$thisNode.find("label").removeClass("adore_check_button_focus_label");
- };
- RadioButton.prototype.handleKeyDownEvent = function (e, hasFilter) {
- if (e.keyCode === Keys_8.Keys.SPACE || e.keyCode === Keys_8.Keys.ENTER || e.keyCode === Keys_8.Keys.NUMPAD_ENTER) {
- this.$thisNode.find("input").click();
- return;
- }
- _super.prototype.handleKeyDownEvent.call(this, e, hasFilter);
- };
- RadioButton.prototype.handleKeyUpEvent = function (e) {
- if (e.keyCode === Keys_8.Keys.SPACE || e.keyCode === Keys_8.Keys.ENTER || e.keyCode === Keys_8.Keys.NUMPAD_ENTER) {
- return;
- }
- _super.prototype.handleKeyUpEvent.call(this, e);
- };
- RadioButton.TemplateRadioButton = "<p>\n <input name=\"group1\" type=\"radio\"/>\n <label></label>\n </p>";
- return RadioButton;
- }(Widget_28.Widget));
- exports.RadioButton = RadioButton;
- });
- define("widget/RollingLabel", ["require", "exports", "widget/Widget"], function (require, exports, Widget_29) {
- "use strict";
- var RollingLabel = (function (_super) {
- __extends(RollingLabel, _super);
- function RollingLabel(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.$thisNode = $(RollingLabel.Template).attr("id", this.id);
- }
- RollingLabel.prototype.setText = function (args) {
- var text = args.text;
- this.$thisNode.text(text);
- };
- RollingLabel.prototype.setFocus = function () {
- };
- RollingLabel.Template = "<marquee class=\"adore_label\" scrollamount=\"5\"></marquee>";
- return RollingLabel;
- }(Widget_29.Widget));
- exports.RollingLabel = RollingLabel;
- });
- 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) {
- "use strict";
- var Select = (function (_super) {
- __extends(Select, _super);
- function Select(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.isLayout = false;
- this.hadIcon = false;
- this.maxShowItems = 6;
- this.focusLostFromText_DropDownShow_ArrowFocus = false;
- this.focusLostFromText_DropDownShow = false;
- this.$thisNode = $(Select.Template).attr("id", this.id);
- this.$iconNode = this.$thisNode.find("i:first").attr("id", this.id + "_icon");
- this.$dropDownArrow = this.$thisNode.find("i.mdi-navigation-arrow-drop-down").attr("id", this.id + "_arrow");
- this.$textCode = this.$thisNode.find("input").attr("id", this.id + "_input");
- this.$thisNode.find("label").attr("for", this.id + "_input");
- this.datas = [];
- this.selectDatas = new Array();
- this.maxShowItems = 6;
- this.scrollIndexs = [0, this.maxShowItems - 1];
- var own = this;
- var widgetId = this.id;
- this.$dropDownArrow.on("click", function (e) {
- var show = !own.isDropDownShow();
- if (show) {
- own.$textCode.focus();
- }
- own.showDropDown(widgetId, show, !show);
- });
- this.$textCode.on("keydown", function (e) {
- own.handleKeyDown(e, own.id);
- });
- this.$textCode.on("blur", function (e) {
- if (!own.focusLostFromText_DropDownShow) {
- own.handleOnBlur();
- }
- });
- this.$textCode.on("focus", function (e) {
- own.$textCode.select();
- own.sendFocusGain();
- });
- this.$textCode.on("input", function (e) {
- own.handleInput(e);
- });
- }
- Select.prototype.setItems = function (args) {
- this.datas = args.items;
- this.selectDatas.splice(0, this.selectDatas.length);
- for (var i = 0; i < this.datas.length; i++) {
- this.selectDatas.push(this.datas[i]);
- }
- };
- Select.prototype.handleMouseDownEvent = function (e) {
- this.focusLostFromText_DropDownShow = null;
- if (document.activeElement === this.$textCode.get(0) && this.isDropDownShow()) {
- this.focusLostFromText_DropDownShow = true;
- }
- else {
- this.focusLostFromText_DropDownShow = false;
- }
- _super.prototype.handleMouseDownEvent.call(this, e);
- };
- Select.prototype.handleMouseUpEvent = function (e) {
- this.focusLostFromText_DropDownShow = false;
- _super.prototype.handleMouseUpEvent.call(this, e);
- };
- Select.prototype.handleInput = function (e) {
- var value = this.$textCode.val();
- this.filterItems(value);
- this.showDropDown(this.id, true, false);
- };
- Select.prototype.handleOnBlur = function () {
- var value = this.$textCode.val();
- this.setText({ text: value });
- this.checkRequisite();
- var mouseOn = $("#" + this.id + "_dropDown").attr("mouseOn");
- if (mouseOn === "false") {
- this.showDropDown(this.id, false, false);
- }
- };
- Select.prototype.setName = function (args) {
- var name = args.name;
- this.$thisNode.find("label").text(name);
- };
- Select.prototype.setEnabled = function (args) {
- _super.prototype.setEnabled.call(this, args);
- var input = this.$thisNode.find("input");
- if (this.enabled) {
- input.removeAttr("disabled");
- this.$thisNode.find("i").removeClass("icon_disabled");
- if (this.requisite) {
- if (input.val() == null || input.val() === "") {
- this.addRequisite();
- }
- }
- }
- else {
- this.$thisNode.find("input").attr("disabled", "disabled");
- if (this.requisite) {
- this.removeRequisite();
- }
- this.$thisNode.find("i").addClass("icon_disabled");
- }
- };
- Select.prototype.postLayout = function () {
- this.isLayout = true;
- if (this.requisite) {
- this.setRequisite({ requisite: true });
- }
- };
- Select.prototype.setText = function (args) {
- var inputNode = this.$thisNode.find("input");
- inputNode.val(args.text);
- if (args.text.length > 0) {
- inputNode.siblings('label').addClass('active');
- this.$iconNode.addClass("active");
- }
- else {
- inputNode.siblings('label').removeClass('active');
- this.$iconNode.removeClass("active");
- }
- if ((args.text == null || args.text === "") && this.requisite) {
- this.addRequisite();
- }
- else {
- this.removeRequisite();
- }
- };
- Select.prototype.checkRequisite = function () {
- if (this.requisite) {
- var inputSelector = this.$thisNode.find('input');
- var value = inputSelector.val();
- if (value) {
- this.removeRequisite();
- }
- else {
- this.addRequisite();
- this.showSpan('请输入数据!');
- }
- }
- };
- Select.prototype.showSpan = function (msg) {
- if (this.$thisNode.find('span').css("display") === "none") {
- this.$thisNode.find('span').html(msg).show().delay(2000).fadeOut(300);
- }
- $("#" + this.id + "_dropDown").css("margin-top", "-21px");
- };
- Select.prototype.setRequisite = function (args) {
- this.requisite = args.requisite;
- if (!this.isLayout) {
- return;
- }
- if (this.requisite) {
- if (this.$thisNode.find('input').val()) {
- this.removeRequisite();
- }
- else {
- this.addRequisite();
- }
- }
- };
- Select.prototype.removeRequisite = function () {
- this.$thisNode.find('input').removeClass('adore_InputRequisite');
- this.$thisNode.find("label").removeClass('adore_requisiteColor');
- this.$iconNode.removeClass('adore_requisiteColor');
- this.hideSpan();
- };
- Select.prototype.hideSpan = function () {
- this.$thisNode.find('span').css('display', 'none');
- };
- Select.prototype.addRequisite = function () {
- this.$thisNode.find('input').addClass('adore_InputRequisite');
- this.$thisNode.find("label").addClass('adore_requisiteColor');
- this.$iconNode.addClass('adore_requisiteColor');
- };
- Select.prototype.setFocus = function () {
- var dropDownNode = $("#" + this.id + "_dropDown");
- if (this.$thisNode.find("input")[0] !== document.activeElement && dropDownNode.css("display") !== "block") {
- this.$thisNode.find("input").focus();
- }
- };
- Select.prototype.setIcon = function (args) {
- this.$iconNode.addClass(args.icon);
- if (args.icon) {
- this.hadIcon = true;
- }
- else {
- this.hadIcon = false;
- }
- if (this.$thisNode.find("input").val().length > 0) {
- this.$thisNode.find("input").siblings('label').addClass('active');
- this.$iconNode.addClass("active");
- }
- this.$thisNode.find('span').addClass('span_prefix');
- };
- Select.prototype.dispose = function () {
- $(document).unbind("click." + this.id);
- _super.prototype.dispose.call(this);
- $("#" + this.id + "_dropDown").remove();
- };
- Select.prototype.handleKeyDown = function (e, widgetId) {
- var dropDown = $("#" + widgetId + "_dropDown");
- var dis = dropDown.css("display");
- if (e.keyCode === Keys_9.Keys.BACKSPACE) {
- return;
- }
- if ((!dis || dis === "none") && e.keyCode !== Keys_9.Keys.ENTER) {
- if (e.keyCode === Keys_9.Keys.DOWN_ARROW || e.keyCode === Keys_9.Keys.SPACE) {
- this.showDropDown(widgetId, true, false);
- e.preventDefault();
- e.stopPropagation();
- }
- return;
- }
- var items = dropDown.find("li");
- var currentIndex = parseInt(dropDown.attr("currentIndex"));
- if (e.keyCode === Keys_9.Keys.UP_ARROW) {
- if (currentIndex === -1) {
- currentIndex = items.length - 1;
- }
- else {
- currentIndex--;
- }
- items.css("background-color", "#FFFFFF");
- if (currentIndex < 0) {
- currentIndex = -1;
- }
- else {
- $(items[currentIndex]).css("background-color", "#BEBEBE");
- this.setText({ text: this.selectDatas[currentIndex] });
- }
- this.refreshScroll(dropDown, currentIndex);
- e.preventDefault();
- }
- else if (e.keyCode === Keys_9.Keys.DOWN_ARROW) {
- currentIndex++;
- items.css("background-color", "#FFFFFF");
- if (currentIndex >= items.length) {
- currentIndex = -1;
- }
- else {
- $(items[currentIndex]).css("background-color", "#BEBEBE");
- this.setText({ text: this.selectDatas[currentIndex] });
- }
- this.refreshScroll(dropDown, currentIndex);
- e.preventDefault();
- }
- else if (e.keyCode === Keys_9.Keys.ENTER) {
- if (currentIndex >= 0 && currentIndex < items.length) {
- this.setText({ text: $(items[currentIndex]).text().trim() });
- this.checkRequisite();
- }
- this.showDropDown(this.id, false, true);
- e.preventDefault();
- e.stopPropagation();
- }
- dropDown.attr("currentIndex", currentIndex + "");
- };
- Select.prototype.refreshScroll = function (dropDown, currentIndex) {
- if (currentIndex === -1) {
- return;
- }
- var count = dropDown.find("li").length - 1;
- var needRefresh = false;
- if (currentIndex < this.scrollIndexs[0]) {
- var endIndex = currentIndex + this.maxShowItems - 1;
- endIndex = endIndex > count ? count : endIndex;
- this.scrollIndexs = [currentIndex, endIndex];
- needRefresh = true;
- }
- else if (currentIndex > this.scrollIndexs[1]) {
- var beginIndex = currentIndex - this.maxShowItems + 1;
- beginIndex = beginIndex < 0 ? 0 : beginIndex;
- this.scrollIndexs = [beginIndex, currentIndex];
- needRefresh = true;
- }
- if (needRefresh) {
- var h = dropDown.find("li").height();
- dropDown[0].scrollTop = h * this.scrollIndexs[0];
- }
- };
- Select.prototype.showDropDown = function (widgetId, show, changedFocus) {
- if (this.$thisNode.find("input").attr("disabled")) {
- return;
- }
- var isDropDownShow = this.isDropDownShow();
- if (!show) {
- $("#" + widgetId + "_dropDown").css("display", "none");
- this.handleModify(changedFocus);
- return;
- }
- var textCode = $("#" + widgetId + "_input");
- var width = textCode.width();
- var height = textCode.height();
- $("#" + widgetId + "_dropDown").remove();
- var dropDown = $(Select.TemplateDropdown).attr("id", widgetId + "_dropDown");
- dropDown.attr({ mouseOn: "false" });
- dropDown.appendTo(this.$thisNode);
- dropDown.attr("currentIndex", "-1");
- dropDown.attr("currentIndex", "-1");
- if (this.hadIcon) {
- dropDown.css("margin-left", " 3rem");
- }
- var liNode;
- if (this.selectDatas) {
- for (var i = 0; i < this.selectDatas.length; i++) {
- liNode = $(Select.TemplateLi).attr("index", i + "");
- liNode.find("a").text(this.selectDatas[i]);
- liNode.appendTo(dropDown);
- }
- }
- var len = dropDown.find("li").length;
- if (len > 0) {
- var tmpId_1 = widgetId;
- var own_5 = this;
- dropDown.find("li").find("a").on("click", function (e) {
- var value = $(this).text().trim();
- own_5.setText({ text: value });
- own_5.checkRequisite();
- own_5.showDropDown(tmpId_1, false, true);
- });
- dropDown.on("mouseover", function (e) {
- dropDown.attr("mouseOn", "true");
- });
- dropDown.on("mouseout", function (e) {
- dropDown.attr("mouseOn", "false");
- });
- dropDown.css("display", "block");
- dropDown.css("width", "135px");
- if (dropDown.width() < width) {
- dropDown.css("width", width);
- }
- if (this.$thisNode.find('span').css("display") === "block") {
- dropDown.css("margin-top", "-21px");
- }
- if (len > this.maxShowItems) {
- var h = $(dropDown.find("li")[0]).height();
- var maxHeight = h * this.maxShowItems;
- dropDown.css("height", maxHeight);
- }
- var dropdown_offsetTop = 0;
- var container_offsetTop = 0;
- var container_height = 0;
- var limit_height = 0;
- var $node = this.$thisNode;
- dropdown_offsetTop = dropDown.offset().top + 15;
- dropDown.addClass("adore_dropDown_show");
- while (1) {
- var tagname = $node.get(0).tagName;
- if (tagname.match("BODY") !== null) {
- container_height = $node.height();
- break;
- }
- var id_str = $node.attr("id");
- if (typeof (id_str) !== "undefined") {
- if (id_str.match("AdoreShell") !== null) {
- container_offsetTop = $node.offset().top;
- container_height = $node.height();
- break;
- }
- }
- $node = $node.parent();
- }
- limit_height = container_height + container_offsetTop - dropdown_offsetTop;
- if (dropDown.height() > limit_height) {
- var top_length = dropDown.height() - limit_height + 25;
- var str_length = "-" + top_length + "px";
- dropDown.css("margin-top", str_length);
- }
- }
- else {
- dropDown.css("display", "none");
- }
- };
- Select.prototype.handleKeyDownEvent = function (e, hasFilter) {
- if (this.handleKeyEvent(e)) {
- _super.prototype.handleKeyDownEvent.call(this, e, hasFilter);
- }
- };
- Select.prototype.handleKeyUpEvent = function (e) {
- if (this.handleKeyEvent(e)) {
- _super.prototype.handleKeyUpEvent.call(this, e);
- }
- };
- Select.prototype.handleKeyEvent = function (e) {
- if ($("#" + this.id + "_dropDown").css("display") === "block") {
- return false;
- }
- if (e.keyCode === Keys_9.Keys.DOWN_ARROW) {
- return false;
- }
- return true;
- };
- Select.prototype.getSelectedIndex = function (selectedText) {
- if (!selectedText || selectedText === "") {
- return -1;
- }
- else {
- for (var i = 0; i < this.datas.length; i++) {
- if (this.datas[i].indexOf(selectedText) != -1) {
- return i;
- }
- }
- return -1;
- }
- };
- Select.prototype.handleModify = function (changedFocus) {
- var selectedText = this.$textCode.val();
- var selectedIndex = this.getSelectedIndex(selectedText);
- if (selectedIndex >= 0) {
- this.setText({ text: this.datas[selectedIndex] });
- }
- else {
- this.setText({ text: "" });
- }
- EventHub_25.EventHub.dispatchEvent(MessageType_26.MessageType.WIDGET, {
- id: this.id,
- selectedIndex: selectedIndex + "",
- changedFocus: changedFocus + "",
- evtType: Event_23.Event.ON_CHANGE
- });
- this.reset();
- };
- Select.prototype.isDropDownShow = function () {
- var $dropDownNode = $("#" + this.id + "_dropDown");
- if ($dropDownNode) {
- var dis = $dropDownNode.css("display");
- if (dis) {
- if (dis === "block")
- return true;
- }
- }
- return false;
- };
- Select.prototype.refreshDropDownItemBGC = function (selectedIndex) {
- var $dropDown = $("#" + this.id + "_dropDown");
- var $items = $dropDown.find("li");
- $items.css("background-color", "#FFFFFF");
- if (selectedIndex < 0) {
- }
- else {
- $($items[selectedIndex]).css("background-color", "#BEBEBE");
- }
- };
- Select.prototype.filterItems = function (filterText) {
- this.selectDatas.splice(0, this.selectDatas.length);
- for (var i = 0; i < this.datas.length; i++) {
- if (this.datas[i].indexOf(filterText) != -1) {
- this.selectDatas.push(this.datas[i]);
- }
- }
- };
- Select.prototype.reset = function () {
- this.selectDatas.splice(0, this.selectDatas.length);
- for (var i = 0; i < this.datas.length; i++) {
- this.selectDatas.push(this.datas[i]);
- }
- };
- 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>";
- Select.TemplateDropdown = "<ul class= \"adore_dropDown dropdown-content\"></ul>";
- Select.TemplateLi = "\n <li>\n <a href='#!' class=\"waves-effect\"></a>\n </li>";
- return Select;
- }(Widget_30.Widget));
- exports.Select = Select;
- });
- define("widget/Slider", ["require", "exports", "widget/Widget", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, Widget_31, EventHub_26, MessageType_27, Event_24) {
- "use strict";
- var Slider = (function (_super) {
- __extends(Slider, _super);
- function Slider(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.$thisNode = $(Slider.Template).attr("id", this.id);
- this.slider = this.$thisNode[0];
- this.step = 1;
- this.min = 0;
- this.max = 100;
- this.startValue = 0;
- this.value = this.startValue;
- }
- Slider.prototype.setStep = function (args) {
- this.step = args.step;
- if (this.isLayout) {
- var own = this;
- this.slider.noUiSlider.updateOptions({
- step: own.step,
- range: {
- "min": own.min,
- "max": own.max
- }
- });
- }
- };
- Slider.prototype.setRange = function (args) {
- this.max = args.max;
- this.min = args.min;
- if (this.isLayout) {
- var own = this;
- this.slider.noUiSlider.updateOptions({
- range: {
- "min": own.min,
- "max": own.max
- }
- });
- }
- };
- Slider.prototype.setValue = function (args) {
- this.value = args.value;
- if (this.isLayout) {
- this.slider.noUiSlider.set(this.value);
- }
- };
- Slider.prototype.postLayout = function () {
- this.isLayout = true;
- var own = this;
- noUiSlider.create(this.slider, {
- start: this.min,
- step: own.step,
- connect: "lower",
- tooltips: [true],
- range: {
- "min": own.min,
- "max": own.max
- }
- });
- $(this.slider).find("div.noUi-tooltip").css({ display: "none" });
- this.slider.noUiSlider.on("start", function () {
- $(own.slider).find("div.noUi-tooltip").css({ display: "block" });
- own.startValue = own.slider.noUiSlider.get();
- });
- this.slider.noUiSlider.on("end", function () {
- $(own.slider).find("div.noUi-tooltip").css({ display: "none" });
- var endValue = own.slider.noUiSlider.get();
- if (own.startValue !== endValue) {
- EventHub_26.EventHub.dispatchEvent(MessageType_27.MessageType.WIDGET, {
- id: own.id,
- evtType: Event_24.Event.ON_CHANGE,
- value: endValue
- });
- }
- });
- };
- Slider.Template = "<div class=\"adore-slider\"></div>";
- return Slider;
- }(Widget_31.Widget));
- exports.Slider = Slider;
- });
- define("widget/tabfolder/TabFolder", ["require", "exports", "widget/Composite", "util/TabUtil"], function (require, exports, Composite_8, TabUtil_1) {
- "use strict";
- var TabFolder = (function (_super) {
- __extends(TabFolder, _super);
- function TabFolder(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.$thisNode = $(TabFolder.TemplateNormal).attr("id", this.id);
- var tmpTab = this.$thisNode.find(".adore_tabs");
- this.$tabs = tmpTab.attr("id", this.id + "_tabs");
- this.$attachNode = this.$thisNode;
- var tabFolderId = this.id + "_tabs";
- this.$tabs.find("li.tab_left_move").on("click", function (e) {
- TabUtil_1.TabUtil.handleTabLeftMoveClick(tabFolderId);
- });
- this.$tabs.find("li.tab_right_move").on("click", function (e) {
- TabUtil_1.TabUtil.handleTabRightMoveClick(tabFolderId);
- });
- this.originalWidth = window.innerWidth;
- var own = this;
- this.resizeListener = function () {
- if (window.innerWidth !== own.originalWidth) {
- own.originalWidth = window.innerWidth;
- var tabs = $("#" + tabFolderId);
- if (tabs.find("li.adore_tab").length !== 0) {
- TabUtil_1.TabUtil.tabsSwitch(tabs);
- TabUtil_1.TabUtil.refreshTabs(tabs);
- }
- }
- };
- $(window).on("resize", this.resizeListener);
- }
- TabFolder.prototype.addChild = function (child) {
- this.children.push(child);
- };
- TabFolder.prototype.layout = function () {
- if (!document.getElementById(this.id)) {
- this.$thisNode.appendTo(this.parent.$attachNode);
- }
- };
- TabFolder.prototype.dispose = function () {
- $(window).off("resize", this.resizeListener);
- var listener = this.$tabs.data("resize_listener");
- if (listener) {
- $(window).off("resize", listener);
- }
- _super.prototype.dispose.call(this);
- };
- 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>";
- return TabFolder;
- }(Composite_8.Composite));
- exports.TabFolder = TabFolder;
- });
- 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) {
- "use strict";
- var TabItem = (function (_super) {
- __extends(TabItem, _super);
- function TabItem(parentId, id, style) {
- _super.call(this, parentId, id, style);
- if (style == ADORE_10.ADORE.Close) {
- this.$thisNode = $(TabItem.TemplateClose).attr("id", this.id);
- }
- else {
- this.$thisNode = $(TabItem.TemplateNormal).attr("id", this.id);
- }
- this.$a = this.$thisNode.find("a");
- this.$i = this.$thisNode.find("i");
- var tabId = this.parent.getId();
- this.isLayout = false;
- var own = this;
- var parentTabsId = tabId + "_tabs";
- this.$a.on("click", function (e) {
- $("#" + parentTabsId).find("a").removeClass("tab_selected").addClass("tab_not_selected");
- $(this).removeClass("tab_not_selected").addClass("tab_selected");
- TabUtil_2.TabUtil.handleTabClick(e, $(this), parentTabsId);
- });
- this.$i.on("click", function () {
- EventHub_27.EventHub.dispatchEvent(MessageType_28.MessageType.WIDGET, {
- id: own.id,
- evtType: Event_25.Event.ON_CLOSE
- });
- });
- }
- TabItem.prototype.setText = function (args) {
- var text = args.text;
- this.$a.text(text);
- };
- TabItem.prototype.setControl = function (args) {
- this.$a.attr("href", "#" + args.control);
- this.relatedControlId = args.control;
- };
- TabItem.prototype.append = function () {
- if (this.parent && this.parent instanceof TabFolder_1.TabFolder) {
- var tempParent = this.parent;
- var lis = tempParent.$tabs.find("li.adore_tab");
- if (lis.length === 0) {
- this.$thisNode.insertAfter(tempParent.$tabs.find("li.tab_left_move"));
- }
- else {
- this.$thisNode.insertAfter($(lis[lis.length - 1]));
- }
- }
- else {
- this.$thisNode.appendTo(document.body);
- }
- };
- TabItem.prototype.layout = function () {
- if (this.relatedControlId) {
- var widget = WidgetManager_5.WidgetManager.byId(this.relatedControlId);
- if (widget) {
- widget.$thisNode.appendTo(this.parent.$attachNode);
- }
- }
- this.append();
- this.isLayout = true;
- if (this.isSelected === true) {
- this.selected(this.$thisNode);
- }
- else {
- var tabItemNodes = this.parent.$tabs.find(".adore_tab");
- if (tabItemNodes.length !== 0) {
- this.selected($(tabItemNodes[0]));
- }
- }
- };
- TabItem.prototype.dispose = function () {
- var tabs = this.parent.$tabs;
- var lis = tabs.find("li.adore_tab");
- var currentIndex = -1;
- var i;
- for (i = 0; i < lis.length; i++) {
- if ($(lis[i]).find("a").attr("href") === this.$a.attr("href")) {
- $(lis[i]).find("a").removeClass("active");
- currentIndex = i;
- break;
- }
- }
- if (currentIndex >= 0 && this.parent && this.parent instanceof TabFolder_1.TabFolder) {
- if (tabs.find("a.active").length <= 0) {
- var showIndex = void 0;
- if (currentIndex <= 0) {
- showIndex = currentIndex + 1;
- }
- else {
- showIndex = currentIndex - 1;
- }
- if (showIndex >= 0 && showIndex < lis.length) {
- var tmpA = $(lis[showIndex]).find("a");
- tmpA.addClass("active");
- $(tmpA.attr("href")).removeClass("tab_control_not_visible").addClass("tab_control_visible");
- tabs.find("a").removeClass("tab_selected").addClass("tab_not_selected");
- tmpA.removeClass("tab_not_selected").addClass("tab_selected");
- }
- }
- }
- _super.prototype.dispose.call(this);
- if (tabs.find(".adore_tab").length > 0) {
- TabUtil_2.TabUtil.tabsSwitch(tabs);
- TabUtil_2.TabUtil.refreshTabs(tabs);
- }
- else {
- tabs.find("div.my_indicator").remove();
- }
- };
- TabItem.prototype.setSelected = function () {
- this.isSelected = true;
- if (this.isLayout) {
- this.selected(this.$thisNode);
- }
- };
- TabItem.prototype.selected = function (selectTabItem) {
- var tabs = this.parent.$tabs;
- var a_active = tabs.find("a.active");
- var activeControl = a_active.attr("href");
- $(activeControl).removeClass("tab_control_visible").addClass("tab_control_not_visible");
- a_active.removeClass("active");
- var selectTabItemA = selectTabItem.find("a").addClass("active");
- var activeDiv = selectTabItemA.attr("href");
- $(activeDiv).removeClass("tab_control_not_visible").addClass("tab_control_visible");
- tabs.find("a").removeClass("tab_selected").addClass("tab_not_selected");
- selectTabItemA.removeClass("tab_not_selected").addClass("tab_selected");
- if (tabs.find(".adore_tab").length > 0) {
- TabUtil_2.TabUtil.tabsSwitch(tabs);
- TabUtil_2.TabUtil.refreshTabs(tabs);
- }
- };
- TabItem.TemplateNormal = "\n <li class=\"col adore_tab\">\n <a class=\"waves-effect\"></a>\n </li>";
- 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>";
- return TabItem;
- }(Widget_32.Widget));
- exports.TabItem = TabItem;
- });
- define("widget/table/TableConstants", ["require", "exports"], function (require, exports) {
- "use strict";
- var TableConstants = (function () {
- function TableConstants() {
- }
- TableConstants.CELL_TYPE_NULL = "null";
- TableConstants.CELL_TYPE_TEXT = "text";
- TableConstants.CELL_TYPE_COMBO = "combo";
- TableConstants.CELL_TYPE_CHECK = "check";
- TableConstants.CELL_TYPE_BUTTON = "button";
- return TableConstants;
- }());
- exports.TableConstants = TableConstants;
- });
- 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) {
- "use strict";
- var TableColumn = (function (_super) {
- __extends(TableColumn, _super);
- function TableColumn(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.width = -1;
- this.colIndex = -1;
- this.$thisNode = $(TableColumn.TemplateNormal).attr("id", this.id);
- this.$attachNode = this.$thisNode;
- this.$textNode = this.$attachNode;
- this.type = TableConstants_1.TableConstants.CELL_TYPE_NULL;
- this.visible = true;
- var that = this;
- var tableColumnId = this.id;
- this.$thisNode.on("click", function () {
- if (that.parent.isSortable === true) {
- var thisIndex = that.parent.columns.indexOf(that);
- var dataType = that.parent.columns[thisIndex].type;
- EventHub_28.EventHub.dispatchEvent(MessageType_29.MessageType.WIDGET, {
- id: tableColumnId,
- col: thisIndex,
- dataType: dataType,
- evtType: Event_26.Event.MODIFY
- });
- }
- });
- }
- TableColumn.prototype.setText = function (args) {
- this.$textNode.text(args.text);
- };
- TableColumn.prototype.layout = function () {
- this.doLayout();
- };
- TableColumn.prototype.doLayout = function () {
- this.append();
- if (this.parent) {
- this.parent.refreshColumnsWidth();
- }
- };
- TableColumn.prototype.setType = function (args) {
- this.type = args.type;
- this.changeStyleToCheck();
- };
- TableColumn.prototype.setOptions = function (args) {
- this.options = args.options;
- };
- TableColumn.prototype.append = function () {
- if (this.parent && this.parent.getId()) {
- if (this.parent.$tHead) {
- if (this.colIndex >= 0 && this.colIndex < (this.parent.columns.length - 1)) {
- var index = this.parent.columns.indexOf(this);
- this.parent.columns.splice(index, 1);
- this.$attachNode.insertBefore(this.parent.columns[this.colIndex].$attachNode.eq(0));
- this.parent.columns.splice(this.colIndex, 0, this);
- this.addTableColumnCell(this.colIndex);
- this.colIndex = -1;
- }
- else {
- var tempStyle = this.$thisNode.html();
- this.$thisNode.appendTo(this.parent.$tHead);
- }
- }
- else {
- this.$thisNode.appendTo(this.parent.$attachNode);
- }
- }
- else {
- this.$thisNode.appendTo(document.body);
- }
- };
- TableColumn.prototype.setAlignment = function (args) {
- this.alignment = args.alignment;
- this.alignmentContent = "left";
- if (args.alignment === ADORE_11.ADORE.RIGHT) {
- this.alignmentContent = "right";
- }
- else if (args.alignment === ADORE_11.ADORE.CENTER) {
- this.alignmentContent = "center";
- }
- this.$thisNode.css("text-align", this.alignmentContent);
- var index = this.parent.columns.indexOf(this);
- var tableItems = this.parent.$tBody.find("tr");
- for (var i = 0; i < tableItems.length; i++) {
- $($(tableItems[i]).find("td")[index]).css({ "text-align": this.alignmentContent });
- }
- };
- TableColumn.prototype.setVisible = function (args) {
- _super.prototype.setVisible.call(this, args);
- this.visible = args.visible;
- var index = this.parent.columns.indexOf(this);
- var tableItems = this.parent.$tBody.find("tr");
- var i;
- if (this.visible) {
- for (i = 0; i < tableItems.length; i++) {
- $($(tableItems[i]).find("td")[index]).css({ "display": "block" });
- }
- }
- else {
- for (i = 0; i < tableItems.length; i++) {
- $($(tableItems[i]).find("td")[index]).css({ "display": "none" });
- }
- }
- if (this.parent) {
- this.parent.refreshColumnsWidth();
- }
- };
- TableColumn.prototype.setEnabled = function (args) {
- _super.prototype.setEnabled.call(this, args);
- if (this.type === TableConstants_1.TableConstants.CELL_TYPE_NULL) {
- return;
- }
- var index = this.parent.columns.indexOf(this);
- var tableItems = this.parent.$tBody.find("tr");
- var i;
- var typeCell = "input";
- if (this.type === TableConstants_1.TableConstants.CELL_TYPE_BUTTON) {
- typeCell = "a";
- }
- else if (this.type === TableConstants_1.TableConstants.CELL_TYPE_COMBO) {
- typeCell = "select";
- }
- if (this.enabled) {
- for (i = 0; i < tableItems.length; i++) {
- $($(tableItems[i]).find("td")[index]).find(typeCell).removeAttr("disabled");
- }
- }
- else {
- for (i = 0; i < tableItems.length; i++) {
- $($(tableItems[i]).find("td")[index]).find(typeCell).attr("disabled", "disabled");
- }
- }
- };
- TableColumn.prototype.dispose = function () {
- _super.prototype.dispose.call(this);
- if (this.parent) {
- var index = this.parent.columns.indexOf(this);
- this.parent.columns.splice(index, 1);
- }
- };
- TableColumn.prototype.setFocus = function () {
- };
- TableColumn.prototype.changeStyleToCheck = function () {
- if (this.type === TableConstants_1.TableConstants.CELL_TYPE_CHECK) {
- var tempStyle = this.$attachNode.attr("style");
- this.$attachNode.remove();
- this.$attachNode = $(TableColumn.TemplateCheck).attr("id", this.id);
- this.$thisNode = this.$attachNode;
- this.$attachNode.find("input").attr("id", this.id + "demo");
- this.$textNode = this.$attachNode.find("label");
- this.$textNode.attr("for", this.id + "demo");
- this.$attachNode.attr("style", tempStyle);
- var that_1 = this;
- this.$attachNode.find("input").on("click", function () {
- var checked = $(this).prop("checked");
- var index = that_1.parent.columns.indexOf(that_1);
- var size = that_1.parent.items.length;
- for (var i = 0; i < size; i++) {
- that_1.parent.items[i].setCheckboxState(index, checked);
- }
- EventHub_28.EventHub.dispatchEvent(MessageType_29.MessageType.WIDGET, {
- id: that_1.id,
- col: that_1.parent.columns.indexOf(that_1),
- data: this.checked + "",
- type: "handleChecked",
- evtType: Event_26.Event.MODIFY
- });
- });
- }
- };
- TableColumn.prototype.setWidth = function (args) {
- this.width = args.width;
- var index = this.parent.columns.indexOf(this);
- this.$attachNode.css("width", this.width + "px");
- var tableItems = this.parent.$tBody.find("tr");
- var i;
- for (i = 0; i < tableItems.length; i++) {
- $($(tableItems[i]).find("td")[index]).css("width", this.width + "px");
- }
- };
- TableColumn.prototype.setRowNumCol = function (args) {
- if (args.rowNumCol) {
- var index = this.parent.columns.indexOf(this);
- this.parent.columns.splice(index, 1);
- this.parent.rowNumCol = this;
- this.$thisNode.unbind("click");
- }
- };
- TableColumn.prototype.refreshRowNumCol = function (index) {
- var tableItems = this.parent.$tBody.find("tr");
- for (var i = index; i < tableItems.length; i++) {
- $(tableItems[i]).find("td").eq(0).text((i + 1) + "");
- }
- };
- TableColumn.prototype.setColIndex = function (args) {
- this.colIndex = args.colIndex;
- };
- TableColumn.prototype.setFillData = function (args) {
- this.fillData = args.fillData;
- };
- TableColumn.prototype.addTableColumnCell = function (index) {
- this.parent.addTableColumnCell(index, this.fillData);
- };
- TableColumn.TemplateNormal = "<th></th>";
- 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>";
- return TableColumn;
- }(Widget_33.Widget));
- exports.TableColumn = TableColumn;
- });
- 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) {
- "use strict";
- var TableItem = (function (_super) {
- __extends(TableItem, _super);
- function TableItem(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.isComboFocus = false;
- this.isTextFocus = false;
- this.rowIndex = -1;
- this.tdNodeArray = new Array();
- this.$thisNode = $(TableItem.TemplateTr).attr("id", this.id);
- this.$attachNode = this.$thisNode;
- var tableId = this.parent.getId();
- var itemId = this.id;
- var own = this;
- this.$thisNode.on("click", function (e) {
- var preTr = $("#" + tableId).find("tr[hadSelected]");
- if (preTr.length > 0 && preTr[0] === e.currentTarget) {
- return;
- }
- var th = $(this).find("th");
- if (th.length > 0) {
- return;
- }
- preTr.removeClass("adore_table_item_selected");
- preTr.removeAttr("hadSelected");
- $(this).addClass("adore_table_item_selected");
- $(this).attr("hadSelected", "true");
- EventHub_29.EventHub.dispatchEvent(MessageType_30.MessageType.WIDGET, {
- id: tableId,
- itemId: itemId,
- evtType: Event_27.Event.CLICK
- });
- });
- }
- TableItem.prototype.setDatas = function (args) {
- var itemId = this.id;
- var datas = args.datas;
- var columns = this.parent.columns;
- var i, j, data, tdNode, id, comboNode, optionNode, cellText;
- this.$thisNode.find("td").html("<div style='display:none;'></div>");
- this.$thisNode.find("td").remove();
- this.tdNodeArray.splice(0, this.tdNodeArray.length);
- var own = this;
- this.addCellRowNum();
- for (i = 0; i < columns.length; i++) {
- this.addCell(i, datas[i]);
- }
- };
- TableItem.prototype.sendFocusGain = function () {
- var id = this.parent.getId;
- EventHub_29.EventHub.dispatchEvent(MessageType_30.MessageType.WIDGET, { id: id, evtType: Event_27.Event.ON_FOCUS });
- };
- TableItem.prototype.append = function () {
- if (this.parent) {
- if (this.parent.$tBody) {
- if (this.rowIndex >= 0 && this.rowIndex < (this.parent.items.length - 1)) {
- var index = this.parent.items.indexOf(this);
- this.parent.items.splice(index, 1);
- this.$attachNode.insertBefore(this.parent.items[this.rowIndex].$attachNode.eq(0));
- this.parent.items.splice(this.rowIndex, 0, this);
- this.parent.refreshCellRowNum();
- this.rowIndex = -1;
- }
- else {
- this.$thisNode.appendTo(this.parent.$tBody);
- }
- }
- else {
- this.$thisNode.appendTo(this.parent.$attachNode);
- }
- }
- else {
- this.$thisNode.appendTo(document.body);
- }
- };
- TableItem.prototype.layout = function () {
- this.append();
- };
- TableItem.prototype.clearSelection = function () {
- this.$thisNode.removeClass("adore_table_item_selected");
- this.$thisNode.removeAttr("hadSelected");
- };
- TableItem.prototype.setSelection = function () {
- this.$thisNode.addClass("adore_table_item_selected");
- this.$thisNode.attr("hadSelected", "true");
- };
- TableItem.prototype.setColor = function (args) {
- this.$thisNode.css("color", args.color);
- };
- TableItem.prototype.setEnabled = function (args) {
- };
- TableItem.prototype.setVisible = function (args) {
- };
- TableItem.prototype.dispose = function () {
- _super.prototype.dispose.call(this);
- if (this.parent) {
- var index = this.parent.items.indexOf(this);
- this.parent.items.splice(index, 1);
- if (this.parent.containRowNum) {
- this.parent.rowNumCol.refreshRowNumCol(index);
- }
- }
- };
- TableItem.prototype.handleKeyDownEvent = function (e, hasFilter) {
- if (e.keyCode == Keys_10.Keys.RIGHT_ARROW || e.keyCode == Keys_10.Keys.LEFT_ARROW) {
- if (!this.isTextFocus) {
- e.preventDefault();
- this.parent.handleKeyDownEvent(e, hasFilter);
- }
- else if (this.isComboFocus) {
- e.preventDefault();
- this.parent.handleKeyDownEvent(e, hasFilter);
- }
- }
- else if (e.keyCode == Keys_10.Keys.UP_ARROW || e.keyCode == Keys_10.Keys.DOWN_ARROW) {
- if (this.isComboFocus) {
- e.preventDefault();
- this.parent.handleKeyDownEvent(e, hasFilter);
- }
- else {
- this.parent.handleKeyDownEvent(e, hasFilter);
- }
- }
- else {
- this.parent.handleKeyDownEvent(e, hasFilter);
- }
- };
- TableItem.prototype.setCellSelection = function (args) {
- var colIndex = args.colIndex;
- var type = this.parent.columns[colIndex].type;
- var $tdNode = this.tdNodeArray[colIndex];
- switch (type) {
- case TableConstants_2.TableConstants.CELL_TYPE_TEXT:
- if (document.activeElement !== $tdNode.find("input")[0]) {
- $tdNode.find("input").focus();
- }
- break;
- case TableConstants_2.TableConstants.CELL_TYPE_COMBO:
- if (document.activeElement !== $tdNode.find("select")[0]) {
- $tdNode.find("select").focus();
- }
- break;
- case TableConstants_2.TableConstants.CELL_TYPE_CHECK:
- if (document.activeElement !== $tdNode.find("p")[0]) {
- $tdNode.find("p").focus();
- }
- break;
- case TableConstants_2.TableConstants.CELL_TYPE_BUTTON:
- if (document.activeElement !== $tdNode.find("a")[0]) {
- $tdNode.find("div").focus();
- }
- break;
- default:
- break;
- }
- };
- TableItem.prototype.setCheckValue = function (args) {
- var colIndex = args.colIndex;
- var $checkNode = this.tdNodeArray[colIndex].find("input");
- var value = $checkNode.prop("checked");
- $checkNode.prop("checked", !value);
- };
- TableItem.prototype.openSelect = function (args) {
- var colIndex = args.colIndex;
- var elem = this.tdNodeArray[colIndex].find("select");
- if (document.createEvent) {
- var e = document.createEvent("MouseEvents");
- e.initMouseEvent("mousedown");
- elem[0].dispatchEvent(e);
- }
- else if (elem[0].fireEvent) {
- elem[0].fireEvent("onmousedown");
- }
- };
- TableItem.prototype.setFocus = function () {
- };
- TableItem.prototype.setCheckboxState = function (index, checkboxState) {
- var $checkboxNode = this.tdNodeArray[index];
- $checkboxNode.find("input:checkbox").eq(0).prop("checked", checkboxState);
- $checkboxNode.find("input:checkbox").eq(0).prop("indeterminate", false);
- };
- TableItem.prototype.refreshHeadCheckboxState = function (index) {
- var $checkboxNode = this.tdNodeArray[index];
- var currentChecked = $checkboxNode.find("input").eq(0).prop("checked");
- var column = this.parent.columns[index];
- var $headCheckNode = column.$thisNode.find("input").eq(0);
- var size = this.parent.items.length;
- var state = -1;
- for (var i = 0; i < size; i++) {
- var tmpChecked = this.parent.items[i].getCheckboxState(index);
- if (tmpChecked) {
- if (state == -1) {
- state = 0;
- }
- else if (state != 0) {
- state = 2;
- break;
- }
- }
- else {
- if (state == -1) {
- state = 1;
- }
- else if (state != 1) {
- state = 2;
- break;
- }
- }
- }
- if (state == 0) {
- $headCheckNode.prop("checked", true);
- $headCheckNode.prop("indeterminate", false);
- }
- else if (state == 1) {
- $headCheckNode.prop("checked", false);
- $headCheckNode.prop("indeterminate", false);
- }
- else {
- $headCheckNode.prop("checked", false);
- $headCheckNode.prop("indeterminate", true);
- }
- };
- TableItem.prototype.getCheckboxState = function (index) {
- var $checkboxNode = this.tdNodeArray[index];
- return $checkboxNode.find("input").eq(0).prop("checked");
- };
- TableItem.prototype.addCellRowNum = function () {
- if (this.parent.containRowNum) {
- var index = this.parent.items.indexOf(this);
- var $tdNode = $(TableItem.TemplateNone);
- $tdNode.attr("title", (index + 1) + "");
- $tdNode.text((index + 1) + "");
- $tdNode.appendTo(this.$attachNode);
- $tdNode.css("text-align", "center");
- this.$rowNumNode = $tdNode;
- }
- };
- TableItem.prototype.refreshCellRowNum = function (index) {
- if (this.parent.containRowNum) {
- if (this.$rowNumNode) {
- this.$rowNumNode.text((index + 1) + "");
- }
- }
- };
- TableItem.prototype.addCell = function (colIndex, data) {
- var columns = this.parent.columns;
- var $tdNode, $comboNode, $optionNode, id, cellText;
- var own = this;
- var itemId = this.id;
- var tableId = this.parent.getId();
- var i = colIndex;
- cellText = TableConstants_2.TableConstants.CELL_TYPE_NULL;
- if (columns[i].type === TableConstants_2.TableConstants.CELL_TYPE_NULL) {
- $tdNode = $(TableItem.TemplateNone);
- $tdNode.attr("title", data);
- $tdNode.text(data);
- }
- else if (columns[i].type === TableConstants_2.TableConstants.CELL_TYPE_TEXT) {
- $tdNode = $(TableItem.TemplateText);
- $tdNode.find("input").val(data);
- cellText = "input";
- $tdNode.find("input").attr("col", i).on("input", function (e) {
- EventHub_29.EventHub.dispatchEvent(MessageType_30.MessageType.WIDGET, {
- id: itemId,
- col: own.getColIndex($tdNode),
- data: this.value,
- evtType: Event_27.Event.MODIFY
- });
- }).on("focus", function (e) {
- console.log("focus in : TEXT");
- own.isTextFocus = true;
- own.parent.isCellFocus = true;
- own.parent.sendFocusGain();
- EventHub_29.EventHub.dispatchEvent(MessageType_30.MessageType.WIDGET, {
- id: tableId,
- itemId: itemId,
- col: own.getColIndex($tdNode),
- evtType: Event_27.Event.CLICK
- });
- }).on("blur", function () {
- console.log("focus out : TEXT");
- own.isTextFocus = false;
- own.parent.isCellFocus = false;
- });
- }
- else if (columns[i].type === TableConstants_2.TableConstants.CELL_TYPE_CHECK) {
- $tdNode = $(TableItem.TemplateCheck);
- id = columns[i].id + "_" + this.id;
- $tdNode.find("input").attr("id", id);
- $tdNode.find("label").attr("for", id);
- cellText = "input";
- if (data === "true") {
- $tdNode.find("input").prop("checked", true);
- }
- $tdNode.find("input").attr("col", i).on("change", function (e) {
- EventHub_29.EventHub.dispatchEvent(MessageType_30.MessageType.WIDGET, {
- id: itemId,
- col: own.getColIndex($tdNode),
- data: this.checked + "",
- evtType: Event_27.Event.MODIFY
- });
- });
- $tdNode.find("input").attr("col", i).on("click", function (e) {
- var colIndex = own.getColIndex($tdNode);
- own.refreshHeadCheckboxState(parseInt(colIndex));
- });
- $tdNode.find("p").on("focus", function (e) {
- console.log("focus in : CHECK");
- own.parent.isCellFocus = true;
- own.parent.sendFocusGain();
- EventHub_29.EventHub.dispatchEvent(MessageType_30.MessageType.WIDGET, {
- id: tableId,
- itemId: itemId,
- col: own.getColIndex($tdNode),
- evtType: Event_27.Event.CLICK
- });
- }).on("blur", function () {
- own.parent.isCellFocus = false;
- });
- }
- else if (columns[i].type === TableConstants_2.TableConstants.CELL_TYPE_COMBO) {
- $tdNode = $(TableItem.TemplateCombo);
- cellText = "select";
- if (columns[i].options) {
- $comboNode = $tdNode.find("select");
- for (var j = 0; j < columns[i].options.length; j++) {
- $optionNode = $(TableItem.TemplateOption).text(columns[i].options[j]);
- if (columns[i].options[j] === data) {
- $optionNode.prop("selected", true);
- }
- $optionNode.appendTo($comboNode);
- }
- $comboNode.attr("col", i + "").on("change", function (e) {
- EventHub_29.EventHub.dispatchEvent(MessageType_30.MessageType.WIDGET, {
- id: itemId,
- col: own.getColIndex($tdNode),
- data: this.value,
- evtType: Event_27.Event.MODIFY
- });
- }).on("focus", function (e) {
- console.log("focus in : COMBO");
- own.parent.isCellFocus = true;
- own.isComboFocus = true;
- own.parent.sendFocusGain();
- EventHub_29.EventHub.dispatchEvent(MessageType_30.MessageType.WIDGET, {
- id: tableId,
- itemId: itemId,
- col: own.getColIndex($tdNode),
- evtType: Event_27.Event.CLICK
- });
- }).on("blur", function (e) {
- console.log("focus out : COMBO");
- own.isComboFocus = false;
- own.parent.isCellFocus = false;
- });
- $comboNode.on("click mousedown", function () {
- own.parent.isCellFocus = true;
- own.isComboFocus = true;
- EventHub_29.EventHub.dispatchEvent(MessageType_30.MessageType.WIDGET, {
- id: tableId,
- itemId: itemId,
- col: own.getColIndex($tdNode),
- evtType: Event_27.Event.CLICK
- });
- });
- }
- }
- else if (columns[i].type === TableConstants_2.TableConstants.CELL_TYPE_BUTTON) {
- $tdNode = $(TableItem.TemplateButton);
- var begin = data.indexOf("${");
- var end = data.indexOf("}");
- cellText = "a";
- if (begin !== -1 && end > begin) {
- var clazz = data.substring(begin + 2, end);
- if (clazz.indexOf("-") !== -1) {
- $tdNode.find("span").addClass(clazz);
- }
- else {
- $tdNode.find("span").addClass("adr-" + clazz);
- }
- }
- else {
- $tdNode.find("span").text(data);
- }
- $tdNode.find("div").attr("col", i + "").on("click", function (e) {
- EventHub_29.EventHub.dispatchEvent(MessageType_30.MessageType.WIDGET, {
- id: itemId,
- col: own.getColIndex($tdNode),
- data: data,
- evtType: Event_27.Event.MODIFY
- });
- }).on("focus", function (e) {
- own.parent.isCellFocus = true;
- own.parent.sendFocusGain();
- EventHub_29.EventHub.dispatchEvent(MessageType_30.MessageType.WIDGET, {
- id: tableId,
- itemId: itemId,
- col: own.getColIndex($tdNode),
- evtType: Event_27.Event.CLICK
- });
- }).on("blur", function () {
- own.parent.isCellFocus = false;
- });
- }
- if (colIndex < this.tdNodeArray.length) {
- var $tempNode = this.tdNodeArray[colIndex];
- $tdNode.insertBefore($tempNode.eq(0));
- this.tdNodeArray.splice(colIndex, 0, $tdNode);
- }
- else {
- $tdNode.appendTo(this.$attachNode);
- this.tdNodeArray.push($tdNode);
- }
- if (columns[i].type === TableConstants_2.TableConstants.CELL_TYPE_CHECK) {
- this.refreshHeadCheckboxState(i);
- }
- if (columns[i].visible === false) {
- $tdNode.css("display", "none");
- }
- if (columns[i].enabled === false && cellText !== TableConstants_2.TableConstants.CELL_TYPE_NULL) {
- $tdNode.find(cellText).attr("disabled", "disabled");
- }
- if (columns[i].alignmentContent) {
- $tdNode.css("text-align", columns[i].alignmentContent);
- }
- };
- TableItem.prototype.getColIndex = function (tdNode) {
- return this.tdNodeArray.indexOf(tdNode) + "";
- };
- TableItem.prototype.setRowIndex = function (args) {
- this.rowIndex = args.rowIndex;
- };
- TableItem.TemplateTr = "<tr></tr>";
- TableItem.TemplateNone = "<td></td>";
- TableItem.TemplateText = "\n <td>\n <input type=\"text\" style=\"border: none;text-align: inherit;width: 100%;font-size: 1rem;\"/>\n </td>";
- 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>";
- TableItem.TemplateCombo = "\n <td>\n <select class=\"browser-default\" style=\"display:inline;width: 100%;height:36px;\">\n </select>\n </td>";
- 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>";
- TableItem.TemplateOption = "<option></option>";
- return TableItem;
- }(Widget_34.Widget));
- exports.TableItem = TableItem;
- });
- 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) {
- "use strict";
- var Table = (function (_super) {
- __extends(Table, _super);
- function Table(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.columns = new Array();
- this.items = new Array();
- this.isSortable = true;
- this.isCellFocus = false;
- this.sortable = true;
- this.containRowNum = false;
- this.children = new Array();
- this.columns = new Array();
- this.items = new Array();
- this.$thisNode = $(Table.TemplateNormal).attr("id", this.id);
- this.$attachNode = this.$thisNode;
- this.$tHead = this.$thisNode.find("tr");
- this.$tBody = this.$thisNode.find("tbody");
- var own = this;
- this.isFocus = false;
- this.$thisNode.find("table").on("focus", function (e) {
- console.log("table focus in");
- own.sendFocusGain();
- own.isFocus = true;
- }).on("blur", function (e) {
- own.isFocus = false;
- });
- this.$thisNode.find("table").on("dblclick", function (e) {
- if (e.target.localName && e.target.localName === "th") {
- EventHub_30.EventHub.dispatchEvent(MessageType_31.MessageType.WIDGET, {
- id: own.id,
- evtType: Event_28.Event.DOUBLE_CLICK,
- header: true
- });
- }
- else {
- EventHub_30.EventHub.dispatchEvent(MessageType_31.MessageType.WIDGET, {
- id: own.id,
- evtType: Event_28.Event.DOUBLE_CLICK
- });
- }
- });
- }
- Table.prototype.addChild = function (child) {
- _super.prototype.addChild.call(this, child);
- if (child instanceof TableColumn_1.TableColumn) {
- this.columns.push(child);
- }
- else if (child instanceof TableItem_1.TableItem) {
- this.items.push(child);
- }
- };
- Table.prototype.sendFocusGain = function () {
- _super.prototype.sendFocusGain.call(this);
- this.isFocus = true;
- };
- Table.prototype.setFocus = function () {
- console.log("table setFocus");
- if (!this.isFocus) {
- this.sendFocusGain();
- }
- };
- Table.prototype.layout = function () {
- _super.prototype.layout.call(this);
- };
- Table.prototype.refreshColumnsWidth = function () {
- };
- Table.prototype.handleKeyDownEvent = function (e, hasFilter) {
- _super.prototype.handleKeyDownEvent.call(this, e, hasFilter);
- };
- Table.prototype.setSortable = function (args) {
- this.isSortable = args.isSortable;
- };
- Table.prototype.addRowNum = function (args) {
- this.containRowNum = args.containRowNum;
- };
- Table.prototype.addTableColumnCell = function (index, defaultData) {
- var itemSize = this.items.length;
- for (var i = 0; i < itemSize; i++) {
- this.items[i].addCell(index, defaultData);
- }
- };
- Table.prototype.reorder = function (args) {
- var reorderIndexed = args.reorderIndexes;
- var newItems = new Array();
- for (var i = 0; i < reorderIndexed.length; i++) {
- newItems[i] = this.items[reorderIndexed[i]];
- newItems[i].$thisNode.detach();
- }
- this.items = newItems;
- this.refreshCellRowNum();
- for (var i = 0; i < this.items.length; i++) {
- newItems[i].$thisNode.appendTo(this.$tBody);
- }
- };
- Table.prototype.refreshCellRowNum = function () {
- for (var i = 0; i < this.items.length; i++) {
- this.items[i].refreshCellRowNum(i);
- }
- };
- 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>";
- return Table;
- }(Composite_9.Composite));
- exports.Table = Table;
- });
- 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) {
- "use strict";
- var TextArea = (function (_super) {
- __extends(TextArea, _super);
- function TextArea(parentId, id, style) {
- _super.call(this, parentId, id, style);
- var own = this;
- this.$thisNode = $(TextArea.TemplateNormal).attr({
- id: this.id + "_containerNode"
- });
- this.$inputNode = this.$thisNode.find("textarea");
- this.$inputNode.attr("id", this.id).on("input", function (e) {
- if ($(this).prop("comStart"))
- return;
- own.handleOnInput();
- EventHub_31.EventHub.dispatchEvent(MessageType_32.MessageType.WIDGET, {
- id: id,
- text: $(this).val(),
- evtType: Event_29.Event.MODIFY,
- syncAttrName: "text"
- });
- }).on("focus", function () {
- own.sendFocusGain();
- }).on("blur", function () {
- RequisiteUtil_2.RequisiteUtil.checkRequisite(own.requisite, own, own.editable, own.$inputNode.val(), "请输入数据!");
- }).on("compositionstart", function () {
- $(this).prop("comStart", true);
- }).on('compositionend', function () {
- $(this).prop("comStart", false);
- });
- this.$thisNode.find("label").attr("for", this.id);
- }
- 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>";
- return TextArea;
- }(Text_1.Text));
- exports.TextArea = TextArea;
- });
- 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) {
- "use strict";
- var Toast = (function (_super) {
- __extends(Toast, _super);
- function Toast(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.$thisNode = $(Toast.TemplateToast).attr("id", this.id);
- this.buttonClickEventDispatch();
- }
- Toast.prototype.setContent = function (args) {
- this.$thisNode.find("span").eq(1).html(args.content.toastName);
- this.$thisNode.find("span").eq(2).html(args.content.receiveTime);
- };
- Toast.prototype.resetShowTime = function (args) {
- var own = this;
- if (own.timeoutSign) {
- clearTimeout(own.timeoutSign);
- }
- own.timeoutSign = setTimeout(function () {
- own.$thisNode.get(0).addEventListener("webkitAnimationEnd", function () {
- EventHub_32.EventHub.dispatchEvent(MessageType_33.MessageType.WIDGET, { id: own.id, evtType: Event_30.Event.ON_CLOSE });
- });
- own.$thisNode.addClass("removing");
- }, args.time * 1000);
- };
- Toast.prototype.buttonClickEventDispatch = function () {
- var own = this;
- var showButton = this.$thisNode.find(".showButton");
- var closeButton = this.$thisNode.find(".closeButton");
- showButton.on("click", function () {
- EventHub_32.EventHub.dispatchEvent(MessageType_33.MessageType.WIDGET, { id: own.id, evtType: Event_30.Event.CLICK });
- });
- closeButton.on("click", function () {
- own.$thisNode.get(0).addEventListener("webkitAnimationEnd", function () {
- EventHub_32.EventHub.dispatchEvent(MessageType_33.MessageType.WIDGET, { id: own.id, evtType: Event_30.Event.ON_CLOSE });
- });
- own.$thisNode.addClass("removing");
- });
- };
- 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 ";
- return Toast;
- }(Widget_35.Widget));
- exports.Toast = Toast;
- });
- define("widget/toast/ToastList", ["require", "exports", "widget/Composite"], function (require, exports, Composite_10) {
- "use strict";
- var ToastList = (function (_super) {
- __extends(ToastList, _super);
- function ToastList(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.$thisNode = $(ToastList.TemplateToastList).attr("id", this.id);
- this.$attachNode = this.$thisNode;
- }
- ToastList.prototype.layout = function () {
- this.$thisNode.appendTo($("body"));
- for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
- var child = _a[_i];
- child.$thisNode.appendTo(this.$thisNode);
- }
- };
- ToastList.prototype.setPosition = function (args) {
- this.$thisNode.css({
- "margin-top": args.position.top + "px",
- "margin-left": args.position.left + "px"
- });
- };
- ToastList.TemplateToastList = "\n <div class=\"adore_toast_list\"></div>\n ";
- return ToastList;
- }(Composite_10.Composite));
- exports.ToastList = ToastList;
- });
- define("widget/Toolbar", ["require", "exports", "widget/Composite", "widget/Button"], function (require, exports, Composite_11, Button_1) {
- "use strict";
- var Toolbar = (function (_super) {
- __extends(Toolbar, _super);
- function Toolbar(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.typeFlag = "";
- this.instance = "Toolbar";
- }
- Toolbar.prototype.toString = function () {
- return this.typeFlag;
- };
- Toolbar.prototype.createDropDownBox = function () {
- var own = this;
- var dropDownListWidth = 108;
- this.$ulNode = $("<ul>").addClass("card-panel adore_toolbar_dropDownList")
- .insertAfter(this.$thisNode)
- .css({ width: dropDownListWidth, display: "none", height: 0, padding: 0 })
- .on("click", function () {
- $(this).attr("popup", "true").css({ height: 0, display: "none" });
- });
- this.$dropDownBtn = $(Toolbar.Template)
- .appendTo(this.$attachNode).on("click", function () {
- if (parseInt(own.$ulNode.css("height").replace("px", "")) === 0) {
- own.$ulNode.attr("popup", "true").css({ height: own.children.length * 54, display: "block" });
- }
- else {
- own.$ulNode.attr("popup", "true").css({ height: 0, display: "none" });
- }
- });
- this.$attachNode = this.$ulNode;
- };
- Toolbar.prototype.layout = function () {
- _super.prototype.layout.call(this);
- var own = this;
- var originAttachNode = this.$attachNode;
- var dropDownListWidth = 108;
- if (parseInt(this.$thisNode.css("width").replace("px", "")) < dropDownListWidth) {
- this.typeFlag = "ToolBar";
- this.createDropDownBox();
- }
- $(window).resize(function () {
- if (parseInt(own.$thisNode.css("width").replace("px", "")) < dropDownListWidth) {
- if (own.$attachNode === originAttachNode) {
- if (own.$ulNode) {
- own.$attachNode = own.$ulNode;
- own.$ulNode.css({ display: "none", height: 0 });
- own.$dropDownBtn.css({ display: "block" });
- }
- else {
- own.createDropDownBox();
- }
- own.typeFlag = "ToolBar";
- for (var i = 0; i < own.children.length; i++) {
- if (own.children[i] instanceof Button_1.Button) {
- own.children[i].refreshToolbar(own.children[i]);
- }
- }
- }
- else {
- }
- }
- else {
- if (own.$attachNode === originAttachNode) {
- }
- else {
- own.$attachNode = originAttachNode;
- own.typeFlag = "";
- own.$dropDownBtn.css("display", "none");
- own.$ulNode.css({ display: "none", height: 0 });
- for (var i = 0; i < own.children.length; i++) {
- own.children[i].postLayout();
- }
- }
- }
- });
- };
- Toolbar.TemplateToolbar = "\n <nav class=\"top-nav adore_header\">\n <div></div>\n </nav>";
- 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 ";
- return Toolbar;
- }(Composite_11.Composite));
- exports.Toolbar = Toolbar;
- });
- 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) {
- "use strict";
- var AppointmentQueue = (function (_super) {
- __extends(AppointmentQueue, _super);
- function AppointmentQueue(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.$thisNode = $(AppointmentQueue.TemplateCotainer).attr({ id: this.id });
- }
- AppointmentQueue.prototype.addItems = function (args) {
- var items = args.items;
- if (!items || items.length === 0) {
- return;
- }
- for (var i = 0; i < items.length; i++) {
- if (items[i].id) {
- if (this.$thisNode.find("#" + items[i].id).length !== 0) {
- this.setItem(items[i]);
- }
- else {
- this.addItem(items[i]);
- }
- }
- }
- };
- AppointmentQueue.prototype.addItem = function (item) {
- var $itemNode = $(AppointmentQueue.TemplateQueue).attr({ id: item.id });
- $itemNode.appendTo(this.$thisNode);
- this.setWindowAttr($itemNode, item);
- var own = this;
- $itemNode.find(".appointment_queue_delete").on("click", function (e) {
- EventHub_33.EventHub.dispatchEvent(MessageType_34.MessageType.WIDGET, {
- id: own.id,
- removeId: item.id,
- evtType: Event_31.Event.MODIFY
- });
- });
- };
- AppointmentQueue.prototype.setWindowAttr = function ($itemNode, item) {
- var temp = item.id.split("k");
- if (item.id) {
- var $idNode = $itemNode.find(".appointment_queue_id");
- $idNode.text("预约编号:" + item.id);
- }
- if (item.mediumType) {
- var $mtNode = $itemNode.find(".appointment_queue_body_mediumtype");
- $mtNode.text("介质类型:" + item.mediumType);
- var $mtImg = $(AppointmentQueue.TemplateImage).appendTo($mtNode);
- $mtImg.attr("src", "images/appointment_queue/cardType.png");
- }
- if (item.mediumNum) {
- var $mnNode = $itemNode.find(".appointment_queue_body_mediumnum");
- var begin_mediumNum = item.mediumNum.substring(0, 6);
- var end_mediumNum = item.mediumNum.substring(11);
- var new_mediumNum = begin_mediumNum + "*****" + end_mediumNum;
- $mnNode.text("介质号码:" + new_mediumNum);
- var $mnImg = $(AppointmentQueue.TemplateImage).appendTo($mnNode);
- $mnImg.attr("src", "images/appointment_queue/jizhiNum.png");
- }
- if (temp[2]) {
- var $pnNode = $itemNode.find(".appointment_queue_body_phonenum");
- var begin_phoneNum = temp[2].substring(0, 3);
- var end_phoneNum = temp[2].substring(7);
- var new_phoneNum = begin_phoneNum + "****" + end_phoneNum;
- $pnNode.text("手机号码:" + new_phoneNum);
- var $pnImg = $(AppointmentQueue.TemplateImage).appendTo($pnNode);
- $pnImg.attr("src", "images/appointment_queue/phoneNum.png");
- }
- if (temp[0] && item.appointmentTime) {
- var s = temp[0].split("-");
- var str = s[0] + "年" + s[1] + "月" + s[2] + "日";
- var $atNode = $itemNode.find(".appointment_queue_body_appointmenttime");
- $atNode.text("预约时间:" + str + " " + item.appointmentTime);
- var $atImg = $(AppointmentQueue.TemplateImage).appendTo($atNode);
- $atImg.attr("src", "images/appointment_queue/time.png");
- }
- };
- AppointmentQueue.prototype.setItem = function (item) {
- var $itemNode = this.$thisNode.find("#" + item.id);
- this.setWindowAttr($itemNode, item);
- };
- AppointmentQueue.prototype.removeItems = function (args) {
- var ids = args.itemIds;
- if (ids && ids.length > 0) {
- for (var i = 0; i < ids.length; i++) {
- var $node = this.$thisNode.find("#" + ids[i]);
- $node.remove();
- }
- }
- };
- AppointmentQueue.prototype.clean = function () {
- this.$thisNode.find(".appointment_queue").remove();
- };
- AppointmentQueue.prototype.setFocus = function () {
- };
- AppointmentQueue.TemplateCotainer = "<div class=\"row\"></div>";
- 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 ";
- AppointmentQueue.TemplateImage = "<img/>";
- return AppointmentQueue;
- }(Widget_36.Widget));
- exports.AppointmentQueue = AppointmentQueue;
- });
- define("widget/transfernetwork/AppointmentTable", ["require", "exports", "widget/Widget"], function (require, exports, Widget_37) {
- "use strict";
- var AppointmentTable = (function (_super) {
- __extends(AppointmentTable, _super);
- function AppointmentTable(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.$thisNode = $(AppointmentTable.TemplateTime).attr("id", this.id);
- }
- AppointmentTable.prototype.addItems = function (args) {
- var items = args.items;
- if (!items || items.length === 0) {
- return;
- }
- for (var i = 0; i < items.length; i++) {
- if (items[i].id) {
- if (this.$thisNode.find("#" + items[i].id).length !== 0) {
- this.setItem(items[i]);
- }
- else {
- this.addItem(items[i]);
- }
- }
- }
- };
- AppointmentTable.prototype.addItem = function (item) {
- var $trNode = $(AppointmentTable.Template);
- var $table_containerNode = this.$thisNode.find(".appointment_table_scrollbar");
- if ($table_containerNode.find("table").length === 0) {
- var $first_tableNode = $(AppointmentTable.TemplateLeft).attr("id", item.id);
- $first_tableNode.appendTo($table_containerNode);
- $trNode.appendTo($first_tableNode);
- $trNode.find("td").text(item.id);
- $table_containerNode.css("width", "280px");
- for (var i = 0; i < Number(item.rowNum); i++) {
- if (i === Number(item.handle_appointmentTime) - 1) {
- $trNode = $(AppointmentTable.TemplateDate);
- $trNode.appendTo($first_tableNode);
- $trNode.find(".appointment_table_data_yes").attr("style", "width: " + 1 / Number(item.limitNum) * 100 + "%");
- $trNode.find(".appointment_table_data_yes").attr("title", "1");
- }
- else {
- $trNode = $(AppointmentTable.Template);
- $trNode.appendTo($first_tableNode);
- }
- }
- }
- else {
- var $tableNode = $(AppointmentTable.TemplateContent).attr("id", item.id);
- var item_year = Number(item.id.split("-")[0]);
- var item_month = Number(item.id.split("-")[1]);
- var item_date = Number(item.id.split("-")[2]);
- var i = 0;
- while ($table_containerNode.find("table").get(i)) {
- var table_id = $table_containerNode.find("table").get(i).id;
- var table_year = Number(table_id.split("-")[0]);
- var table_month = Number(table_id.split("-")[1]);
- var table_date = Number(table_id.split("-")[2]);
- if (item_year < table_year) {
- $tableNode.insertBefore($("#" + table_id));
- break;
- }
- else if (item_year === table_year) {
- if (item_month < table_month) {
- $tableNode.insertBefore($("#" + table_id));
- break;
- }
- else if (item_month === table_month) {
- if (item_date < table_date) {
- $tableNode.insertBefore($("#" + table_id));
- break;
- }
- }
- }
- i++;
- if (i === $table_containerNode.find("table").length) {
- $tableNode.appendTo($table_containerNode);
- }
- }
- if ($table_containerNode.find(".appointment_table_border_left")) {
- $table_containerNode.find(".appointment_table_border_left").removeClass("appointment_table_border_left");
- }
- $("#" + $table_containerNode.find("table").get(0).id).addClass("appointment_table_border_left");
- $trNode.appendTo($tableNode);
- $trNode.find("td").text(item.id);
- var arr_width = $table_containerNode.css("width").split("px");
- var num_width = Number(arr_width[0]) + 280;
- var str_width = num_width + "px";
- $table_containerNode.css("width", str_width);
- for (var i_2 = 0; i_2 < Number(item.rowNum); i_2++) {
- if (i_2 === Number(item.handle_appointmentTime) - 1) {
- $trNode = $(AppointmentTable.TemplateDate);
- $trNode.appendTo($tableNode);
- $trNode.find(".appointment_table_data_yes").attr("style", "width: " + 1 / Number(item.limitNum) * 100 + "%");
- $trNode.find(".appointment_table_data_yes").attr("title", "1");
- }
- else {
- $trNode = $(AppointmentTable.Template);
- $trNode.appendTo($tableNode);
- }
- }
- }
- };
- AppointmentTable.prototype.setItem = function (item) {
- if (item.handle_appointmentTime !== null && item.handle_appointmentTime.length !== 0) {
- var $tableNode = this.$thisNode.find("#" + item.id);
- var $trNode = $tableNode.find("tr").eq(Number(item.handle_appointmentTime));
- if ($trNode.find("div").length === 0) {
- if ($trNode.find("td").css("background-color") === "rgb(244, 247, 249)") {
- alert("此时间段不开放预约!");
- }
- else {
- var $new_trNode = $(AppointmentTable.TemplateDate);
- $trNode.replaceWith($new_trNode);
- $new_trNode.find(".appointment_table_data_yes").attr("style", "width: " + 1 / Number(item.limitNum) * 100 + "%");
- $new_trNode.find(".appointment_table_data_yes").attr("title", "1");
- }
- }
- else {
- if ($trNode.find(".appointment_table_data_yes").length !== 0) {
- var appointNum = Number($trNode.find(".appointment_table_data_yes").attr("title"));
- var arr_width = $trNode.find(".appointment_table_data_yes").css("width").split("px");
- var num_width = Number(arr_width[0]) / appointNum + Number(arr_width[0]);
- var str_width = num_width + "px";
- $trNode.find(".appointment_table_data_yes").css("width", str_width);
- appointNum = appointNum + 1;
- $trNode.find(".appointment_table_data_yes").attr("title", String(appointNum));
- $trNode.find(".appointment_table_text").text("已预约" + appointNum + "人");
- if (appointNum === Number(item.limitNum)) {
- $trNode.find(".appointment_table_data_yes").addClass("appointment_table_data_full")
- .removeClass("appointment_table_data_yes").css("width", "100%");
- $trNode.find(".appointment_table_text").text("已约满");
- }
- }
- else {
- if ($trNode.find(".appointment_table_data_full").length !== 0) {
- alert(item.id + "存在超出预约人数,请检查");
- }
- }
- }
- }
- };
- AppointmentTable.prototype.changeTimeTable = function (args) {
- var $timeNode = this.$thisNode.find(".appointment_table_tabletime table");
- $timeNode.empty();
- var time = args.time;
- var $first_timeNode = $(AppointmentTable.Template);
- $first_timeNode.appendTo($timeNode);
- $first_timeNode.find("td").text("全天");
- var origin_time = time[0];
- var timeNum = time[1];
- for (var i = 0; i <= timeNum; i++) {
- var $item_timeNode = $(AppointmentTable.Template);
- $item_timeNode.appendTo($timeNode);
- $item_timeNode.find("td").text(origin_time + ":00");
- origin_time = origin_time + 1;
- }
- };
- AppointmentTable.prototype.setDisallowAppoint = function (args) {
- var items = args.items;
- if (!items || items.length === 0) {
- return;
- }
- for (var i = 0; i < items.length; i++) {
- if (items[i].date) {
- if (this.$thisNode.find("#" + items[i].date).length !== 0) {
- var $tableNode = this.$thisNode.find("#" + items[i].date);
- var $trNode = $tableNode.find("tr").eq(Number(items[i].disallowTime));
- $trNode.find("td").css("background-color", "#f4f7f9");
- }
- else {
- break;
- }
- }
- }
- };
- AppointmentTable.prototype.removeItem = function (args) {
- var items = args.items;
- if (!items || items.length === 0) {
- return;
- }
- for (var i = 0; i < items.length; i++) {
- if (items[i].id) {
- if (this.$thisNode.find("#" + items[i].id).length !== 0) {
- var $tableNode = this.$thisNode.find("#" + items[i].id);
- var $trNode = $tableNode.find("tr").eq(Number(items[i].removeTime));
- if ($trNode.find(".appointment_table_data_yes").length !== 0) {
- var appointNum = Number($trNode.find(".appointment_table_data_yes").attr("title")) - 1;
- if (appointNum === 0) {
- $trNode.find("td").empty();
- }
- else {
- $trNode.find(".appointment_table_data_yes").attr("style", "width: " + appointNum / Number(items[i].limitNum) * 100 + "%");
- $trNode.find(".appointment_table_data_yes").attr("title", String(appointNum));
- $trNode.find(".appointment_table_text").text("已预约" + appointNum + "人");
- }
- }
- else {
- if ($trNode.find(".appointment_table_data_full").length !== 0) {
- var appointNum = Number($trNode.find(".appointment_table_data_full").attr("title")) - 1;
- $trNode.find(".appointment_table_data_full").addClass("appointment_table_data_yes").removeClass("appointment_table_data_full");
- $trNode.find(".appointment_table_data_yes").attr("style", "width: " + appointNum / Number(items[i].limitNum) * 100 + "%");
- $trNode.find(".appointment_table_data_yes").attr("title", String(appointNum));
- $trNode.find(".appointment_table_text").text("已预约" + appointNum + "人");
- }
- }
- }
- else {
- break;
- }
- }
- }
- };
- AppointmentTable.prototype.removeTable = function (args) {
- var itemIds = args.itemIds;
- if (!itemIds || itemIds.length === 0) {
- return;
- }
- for (var i = 0; i < itemIds.length; i++) {
- if (itemIds[i]) {
- if (this.$thisNode.find("#" + itemIds[i]).length !== 0) {
- this.$thisNode.find("#" + itemIds[i]).remove();
- }
- }
- }
- if (this.$thisNode.find(".appointment_table_scrollbar").find("table").length !== 0) {
- if (this.$thisNode.find(".appointment_table_border_left").length === 0) {
- this.$thisNode.find(".appointment_table_scrollbar").find("table").eq(0).addClass("appointment_table_border_left");
- }
- }
- };
- AppointmentTable.prototype.clear = function () {
- this.$thisNode.find(".appointment_table_scrollbar").empty();
- };
- 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>";
- AppointmentTable.TemplateLeft = "\n<table class=\"appointment_table_tablecontent appointment_table_border_left\">\n</table>";
- AppointmentTable.TemplateContent = "\n <table class=\"appointment_table_tablecontent\">\n</table>";
- AppointmentTable.Template = "<tr><td></td></tr>";
- 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";
- return AppointmentTable;
- }(Widget_37.Widget));
- exports.AppointmentTable = AppointmentTable;
- });
- define("widget/transfernetwork/BarGraph", ["require", "exports", "widget/Widget"], function (require, exports, Widget_38) {
- "use strict";
- var BarGraph = (function (_super) {
- __extends(BarGraph, _super);
- function BarGraph(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.data = new Array();
- this.option = {};
- var own = this;
- this.$thisNode = $(BarGraph.Template).attr("id", this.id);
- this.$graphNode = this.$thisNode.children("div");
- this.resizeFunction = function () {
- own.echart.resize();
- };
- $(window).on("resize", this.resizeFunction);
- }
- BarGraph.prototype.setData = function (args) {
- this.data = args.data;
- };
- BarGraph.prototype.clear = function () {
- this.data = [];
- this.option = [];
- this.echart.clear();
- };
- BarGraph.prototype.clearData = function () {
- this.data = [];
- var graphOption = {
- title: {
- text: "等待时间队列",
- subtext: "",
- x: "center"
- },
- tooltip: {
- trigger: "axis",
- axisPointer: {
- type: "line"
- }
- },
- legend: {
- data: ["预警内已等待时间", "距离预警时间", "超出预警时间"],
- orient: "vertical",
- x: "left"
- },
- grid: {
- top: "103px",
- left: "3%",
- right: "10%",
- bottom: "3%",
- containLabel: true
- },
- xAxis: {
- type: "category",
- name: "客户名称",
- data: [""],
- axisTick: {
- alignWithLabel: true
- }
- },
- yAxis: {
- type: "value",
- name: "时间/分"
- }
- };
- this.option = graphOption;
- if (this.echart) {
- this.echart.clear();
- this.echart.setOption(this.option);
- }
- };
- BarGraph.prototype.postLayout = function () {
- var own = this;
- if (this.data.length > 0) {
- this.redrawGraph();
- }
- if (!this.echart) {
- this.echart = echarts.init(this.$graphNode.get(0));
- if (this.option) {
- this.echart.setOption(this.option);
- }
- }
- };
- BarGraph.prototype.dispose = function () {
- $(window).off("resize", this.resizeFunction);
- _super.prototype.dispose.call(this);
- };
- BarGraph.prototype.redrawGraph = function () {
- var nameList = new Array();
- var blueValueList = new Array();
- var whiteValueList = new Array();
- var redValueList = new Array();
- var dValueList = new Array();
- for (var _i = 0, _a = this.data; _i < _a.length; _i++) {
- var entry = _a[_i];
- var dValue = entry.value - entry.alertValue;
- dValueList.push(dValue);
- var blueValue = void 0;
- var whiteValue = void 0;
- var redValue = void 0;
- if (dValue === 0) {
- blueValue = entry.value + "";
- whiteValue = "";
- redValue = "";
- }
- else if (dValue > 0) {
- blueValue = entry.alertValue + "";
- whiteValue = "";
- redValue = dValue + "";
- }
- else if (dValue < 0) {
- blueValue = entry.value + "";
- whiteValue = 0 - dValue + "";
- redValue = "";
- }
- blueValue = blueValue === "0" ? "" : blueValue;
- whiteValue = whiteValue === "0" ? "" : whiteValue;
- redValue = redValue === "0" ? "" : redValue;
- nameList.push(entry.name);
- blueValueList.push(blueValue);
- whiteValueList.push(whiteValue);
- redValueList.push(redValue);
- }
- var tempDValueList = dValueList.concat();
- tempDValueList.sort(function (a, b) {
- return a - b;
- });
- var signWhiteValue = tempDValueList[0];
- var signWhiteX = dValueList.indexOf(signWhiteValue);
- var signWhiteY = this.data[signWhiteX].alertValue;
- signWhiteValue = 0 - tempDValueList[0];
- var signRedValue = tempDValueList[tempDValueList.length - 1];
- var signRedX = dValueList.lastIndexOf(signRedValue);
- var signRedY = this.data[signRedX].value;
- var graphOption = {
- title: {
- text: "等待时间队列",
- subtext: "",
- x: "center"
- },
- tooltip: {
- trigger: "axis",
- axisPointer: {
- type: "line"
- }
- },
- legend: {
- data: ["预警内已等待时间", "距离预警时间", "超出预警时间"],
- orient: "vertical",
- x: "left"
- },
- grid: {
- top: "103px",
- left: "3%",
- right: "10%",
- bottom: "3%",
- containLabel: true
- },
- xAxis: {
- type: "category",
- name: "客户名称",
- data: nameList,
- axisTick: {
- alignWithLabel: true
- }
- },
- yAxis: {
- type: "value",
- name: "时间/分"
- },
- series: [
- {
- name: "预警内已等待时间",
- type: "bar",
- stack: "等待时间",
- label: {
- normal: {
- show: true,
- position: "inside"
- }
- },
- itemStyle: {
- normal: {
- color: "#004B97",
- borderColor: "#004B97"
- }
- },
- data: blueValueList
- },
- {
- name: "距离预警时间",
- type: "bar",
- stack: "等待时间",
- label: {
- normal: {
- show: true,
- position: "inside",
- textStyle: {
- color: "#009100"
- }
- }
- },
- itemStyle: {
- normal: {
- color: "#FCFCFC",
- borderColor: "#004B97"
- }
- },
- data: whiteValueList
- },
- {
- name: "超出预警时间",
- type: "bar",
- stack: "等待时间",
- label: {
- normal: {
- show: true,
- position: "inside"
- }
- },
- itemStyle: {
- normal: {
- color: "#CE0000",
- borderColor: "#CE0000"
- }
- },
- data: redValueList
- }
- ]
- };
- this.option = graphOption;
- if (this.echart) {
- this.echart.setOption(this.option);
- }
- };
- BarGraph.Template = "\n <div>\n <div style=\"width:100%;height:100%\"></div>\n </div>\n ";
- return BarGraph;
- }(Widget_38.Widget));
- exports.BarGraph = BarGraph;
- });
- define("widget/transfernetwork/BranchChart", ["require", "exports", "widget/echart/EChart"], function (require, exports, EChart_4) {
- "use strict";
- var BranchChart = (function (_super) {
- __extends(BranchChart, _super);
- function BranchChart() {
- _super.apply(this, arguments);
- this.netPointList = new Array();
- this.title = "unset";
- this.subTitle = "";
- }
- BranchChart.prototype.setData = function (args) {
- this.netPointList = new Array();
- this.netPointList.push({ pointName: "当前网点", distance: 0, walkTime: 0 });
- this.netPointList = this.netPointList.concat(args.netPointList);
- };
- BranchChart.prototype.setTitle = function (args) {
- this.title = args.titles.title;
- this.subTitle = args.titles.subTitle;
- };
- BranchChart.prototype.postLayout = function () {
- if (this.netPointList.length > 0) {
- this.redrawChart();
- }
- _super.prototype.postLayout.call(this);
- };
- BranchChart.prototype.getFormat = function (netPoint) {
- var $assistNode = $("<div>");
- var tableBlock = $("<div></div>").addClass("branchChart-table responsive-table");
- var table = $("<table class='centered'></table>");
- 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 ";
- var tableThead = $(tableTheadTemplate);
- var tableBody = $("<tbody></tbody>");
- var createRow = function (name, content) {
- var row = $("<tr>");
- var nameEntry = $("<td style='padding:5px 5px;width:50%'></td>").html(name);
- var contentEntry = $("<td style=\"padding:5px 5px;width:50%;overflow:auto\"></td>").html(content);
- row.append(nameEntry).append(contentEntry);
- return row;
- };
- tableBody.append(createRow("网点名称", netPoint.pointName));
- tableBody.append(createRow("和当前网点距离", netPoint.distance + "米"));
- tableBody.append(createRow("步行需要时间", netPoint.walkTime + "分钟"));
- if (netPoint.description && netPoint.description.length > 0) {
- for (var _i = 0, _a = netPoint.description; _i < _a.length; _i++) {
- var d = _a[_i];
- tableBody.append(createRow(d.descriptionName, d.descriptionContent));
- }
- }
- table.append(tableThead);
- table.append(tableBody);
- tableBlock.append(table);
- 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 ");
- if (netPoint.windowNumber && netPoint.waitInLineNumber) {
- var showNumberRow = showNumberTable.find("tbody").find("tr");
- showNumberRow.append(createRow(netPoint.windowNumber + "", netPoint.waitInLineNumber + ""));
- tableBlock.append(showNumberTable);
- }
- 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 ");
- if (netPoint.othersInfo && netPoint.othersInfo.length > 0) {
- var othersRow = othersTable.find("tbody").find("tr");
- var othersList = netPoint.othersInfo;
- for (var _b = 0, othersList_1 = othersList; _b < othersList_1.length; _b++) {
- var other = othersList_1[_b];
- othersRow.append(createRow(other.otherName, other.otherContent));
- }
- tableBlock.append(othersTable);
- }
- $assistNode.append(tableBlock);
- return $assistNode.html();
- };
- BranchChart.prototype.getMaxLength = function () {
- var distanceList = new Array();
- for (var _i = 0, _a = this.netPointList; _i < _a.length; _i++) {
- var netPoint = _a[_i];
- distanceList.push(netPoint.distance);
- }
- distanceList.sort(function (a, b) {
- return a - b;
- });
- return distanceList[distanceList.length - 1];
- };
- BranchChart.prototype.redrawChart = function () {
- var own = this;
- var maxLength = 1.1 * this.getMaxLength();
- var indicatorContent = new Array();
- for (var i = 0; i < this.netPointList.length; i++) {
- var indicatorEntry = {
- name: i > 0 ? this.netPointList[i].pointName + " \u6B65\u884C\u8DDD\u79BB:" + this.netPointList[i].distance + "\u7C73" : "",
- max: maxLength
- };
- indicatorContent.push(indicatorEntry);
- }
- var createDataEntry = function (index, value, length) {
- var valueList = new Array();
- for (var i = 0; i < length; i++) {
- valueList.push("");
- }
- valueList[index] = value.toString();
- var dataEntryTemplate = {
- value: valueList,
- name: index.toString(),
- symbol: "circle",
- symbolSize: 8
- };
- return dataEntryTemplate;
- };
- var dataContent = new Array();
- for (var i = 0; i < this.netPointList.length; i++) {
- dataContent.push(createDataEntry(i, this.netPointList[i].distance, this.netPointList.length));
- }
- var branchOption = {
- title: {
- text: this.title,
- subtext: this.subTitle,
- x: "center"
- },
- legend: {},
- tooltip: {
- formatter: function (params, ticket, callback) {
- var netPoint = own.netPointList[params.dataIndex];
- return own.getFormat(netPoint);
- },
- enterable: true,
- backgroundColor: "transparent",
- transitionDuration: 0.4,
- textStyle: {
- color: "black"
- },
- hideDelay: 50,
- position: function (point, params, dom) {
- var x = point[0];
- var y = point[1];
- var width = own.$thisNode.get(0).clientWidth;
- var height = own.$thisNode.get(0).clientHeight;
- var rX = x;
- var rY = y;
- if (x + 150 > width && x - 150 < 0) {
- return "inside";
- }
- else if (x + 150 > width) {
- rX = width - 150;
- }
- else if (x - 150 < 0) {
- rX = 150;
- }
- if (y + 200 > height && y - 200 < 0) {
- return "inside";
- }
- else if (y + 200 > height) {
- rY = height - 200;
- }
- else if (y - 200 < 0) {
- rY = 200;
- }
- return [rX - 150, rY - 200];
- }
- },
- radar: [
- {
- indicator: indicatorContent,
- center: ["50%", "50%"],
- radius: "70%",
- startAngle: 90,
- splitNumber: 5,
- shape: "circle",
- name: {
- textStyle: {
- color: "#003D79",
- fontSize: "13"
- }
- },
- splitArea: {
- areaStyle: {
- color: ["rgba(114, 172, 209, 1)",
- "rgba(114, 172, 209, 0.8)", "rgba(114, 172, 209, 0.6)",
- "rgba(114, 172, 209, 0.4)", "rgba(114, 172, 209, 0.2)"],
- shadowColor: "rgba(0, 0, 0, 0.3)",
- shadowBlur: 10
- }
- },
- axisLine: {
- lineStyle: {
- color: "rgba(114, 172, 209, 0.1)"
- }
- },
- splitLine: {
- lineStyle: {
- color: "rgba(114, 172, 209, 0.5)"
- }
- }
- }
- ],
- series: [
- {
- name: "雷达图",
- type: "radar",
- itemStyle: {
- normal: {
- shadowColor: "black",
- shadowBlur: 10,
- color: "white"
- }
- },
- data: dataContent
- }
- ]
- };
- this.option = branchOption;
- if (this.echart) {
- this.echart.setOption(this.option);
- }
- };
- return BranchChart;
- }(EChart_4.EChart));
- exports.BranchChart = BranchChart;
- });
- 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) {
- "use strict";
- var CustomQueue = (function (_super) {
- __extends(CustomQueue, _super);
- function CustomQueue(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.isSelected = false;
- this.movingControlPositions = new Array();
- this.checkDistance = 60;
- this.$thisNode = $(CustomQueue.TemplateCotainer).attr({ id: this.id });
- }
- CustomQueue.prototype.addItems = function (args) {
- var items = args.items;
- if (!items || items.length === 0) {
- return;
- }
- for (var i = 0; i < items.length; i++) {
- if (items[i].queue_num) {
- if (this.$thisNode.find("#" + items[i].queue_num).length !== 0) {
- this.setItem(items[i]);
- }
- else {
- this.addItem(items[i]);
- }
- }
- }
- this.setListeners();
- };
- CustomQueue.prototype.setItems = function (args) {
- var items = args.items;
- this.clear();
- this.addItems({ items: items });
- this.setListeners();
- };
- CustomQueue.prototype.setItem = function (item) {
- var itemNode = this.$thisNode.find("#" + item.queue_num);
- this.setCustomAttr(itemNode, item);
- };
- CustomQueue.prototype.addItem = function (item) {
- var itemNode = $(CustomQueue.TemplateQueue).attr({ id: item.queue_num });
- itemNode.appendTo(this.$thisNode);
- this.setCustomAttr(itemNode, item);
- var own = this;
- itemNode.find("p.custom_queue_footer").on("click", function (e) {
- var index = own.indexOf(itemNode[0]);
- var queueNO = itemNode.attr("id");
- EventHub_34.EventHub.dispatchEvent(MessageType_35.MessageType.WIDGET, {
- id: own.id,
- evtType: Event_32.Event.CLICK,
- index: index,
- queue_num: queueNO
- });
- });
- itemNode.find("div[lookOver]").on("click", function (e) {
- var index = own.indexOf(itemNode[0]);
- var queueNO = itemNode.attr("id");
- EventHub_34.EventHub.dispatchEvent(MessageType_35.MessageType.WIDGET, {
- id: own.id,
- evtType: Event_32.Event.LOOK_OVER,
- index: index,
- queue_num: queueNO
- });
- });
- };
- CustomQueue.prototype.indexOf = function (item) {
- var items = this.$thisNode.find("div.custom_queue_container");
- for (var i = 0; i < items.length; i++) {
- if (item === items[i]) {
- return i;
- }
- }
- return -1;
- };
- CustomQueue.prototype.setCustomAttr = function (itemNode, item) {
- itemNode.find(".custom_queue_id").text(item.queue_num);
- itemNode.find(".custom_queue_wait_time").text(item.waitting + "分钟");
- if (item.en_queue_time) {
- itemNode.find(".custom_queue_get_no_time").text(item.en_queue_time);
- }
- var customNameNode = itemNode.find(".custom_queue_name");
- if (item.name) {
- customNameNode.text(item.name);
- }
- if (item.sex) {
- var customSex = $(CustomQueue.TemplateImage).appendTo(customNameNode);
- customSex.css({ marginTop: "-5px" });
- if (item.sex === "男" || item.sex === "man" || item.sex === "1") {
- customSex.attr("src", "images/custom_queue/man.png");
- }
- else {
- customSex.attr("src", "images/custom_queue/woman.png");
- }
- }
- if (item.customLevel) {
- var customLevelNode = itemNode.find(".custom_queue_custom_level");
- customLevelNode.text("客户等级:" + item.customLevel);
- var customLevelImg = $(CustomQueue.TemplateImage).appendTo(customLevelNode);
- if (item.customLevel === "黄金客户") {
- customLevelImg.attr("src", "images/custom_queue/custom_level/huangjin.png");
- }
- else if (item.customLevel === "白金客户") {
- customLevelImg.attr("src", "images/custom_queue/custom_level/baijin.png");
- }
- else if (item.customLevel === "钻石客户") {
- customLevelImg.attr("src", "images/custom_queue/custom_level/zuanshi.png");
- }
- else {
- customLevelImg.attr("src", "images/custom_queue/custom_level/putong.png");
- }
- }
- if (item.businessFlag) {
- var imgArr = item.businessFlag.split(",");
- if (imgArr.length > 0) {
- var businessFlagNode = itemNode.find(".custom_queue_business_flag");
- businessFlagNode.find("img").remove();
- for (var i = 0; i < imgArr.length; i++) {
- $(CustomQueue.TemplateImage).attr("src", "images/custom_queue/business_flag/" + imgArr[i] + ".png").appendTo(businessFlagNode);
- }
- }
- }
- };
- CustomQueue.prototype.removeItem = function (args) {
- var ids = args.itemIds;
- if (ids && ids.length > 0) {
- for (var i = 0; i < ids.length; i++) {
- this.$thisNode.find("#" + ids[i]).remove();
- }
- }
- this.setListeners();
- };
- CustomQueue.prototype.clear = function () {
- this.$thisNode.find(".custom_queue_container").remove();
- this.setListeners();
- };
- CustomQueue.prototype.postLayout = function () {
- this.setListeners();
- };
- CustomQueue.prototype.dispose = function () {
- $(window).off("resize", this.resizeFunction);
- _super.prototype.dispose.call(this);
- };
- CustomQueue.prototype.setListeners = function () {
- var own = this;
- own.isSelected = false;
- own.selectedIndex = null;
- own.selectedUnitWidth = null;
- own.selectedUnit = null;
- own.targetIndex = null;
- own.movingControlPositions = new Array();
- own.animationUnit = null;
- own.resizeFunction = function () {
- own.setListeners();
- };
- $(window).on("resize", own.resizeFunction);
- if (this.$thisNode.find(".custom_queue_container").length === 0) {
- return;
- }
- var $units = this.$thisNode.find("div.custom_queue_container");
- var $unitsContainer = this.$thisNode;
- $units.each(function (index, elem) {
- var $elemNode = $(elem);
- var position = own.getUnitCenterPosition(elem);
- if ($elemNode.next().length < 0) {
- position.x = position.x + elem.clientWidth;
- }
- own.movingControlPositions.push(position);
- });
- var moveControl = function (e) {
- if (own.isSelected) {
- if (own.selectedUnit.style.position !== "absolute") {
- $(own.selectedUnit).addClass("selected");
- }
- own.selectedUnit.style.width = own.selectedUnitWidth + "px";
- own.selectedUnit.style.left = e.clientX - $unitsContainer.get(0).clientLeft
- - own.selectedUnit.clientWidth / 2 + "px";
- own.selectedUnit.style.top = e.clientY - $unitsContainer.get(0).clientTop
- - own.selectedUnit.clientHeight / 2 + "px";
- }
- };
- $units.each(function (index, elem) {
- elem.onmousedown = function (e) {
- if (!own.isSelected) {
- own.isSelected = true;
- own.selectedIndex = index;
- own.selectedUnit = elem;
- own.selectedUnitWidth = elem.clientWidth;
- moveControl(e);
- own.animationUnit = $(elem).next();
- if (own.animationUnit.length > 0) {
- own.animationUnit.removeClass("moveToLeft").addClass("moveToRight");
- }
- elem.onmouseup = function () {
- if (own.targetIndex === -1) {
- $units.removeClass("moveToLeft").removeClass("moveToRight").
- removeClass("selected").removeClass("inPosition");
- }
- else if (own.targetIndex > -1) {
- $units.removeClass("moveToLeft").removeClass("moveToRight").
- removeClass("selected").removeClass("inPosition");
- var $tempNode = $(own.selectedUnit);
- if (own.targetIndex > 0) {
- $units.eq(own.targetIndex - 1).after($tempNode);
- }
- else if (own.targetIndex === 0) {
- $units.eq(0).before($tempNode);
- }
- EventHub_34.EventHub.dispatchEvent(MessageType_35.MessageType.WIDGET, {
- id: own.id,
- evtType: Event_32.Event.ON_CHANGE,
- originIndex: own.selectedIndex,
- finalIndex: own.targetIndex
- });
- }
- $units.css({
- "width": "",
- "left": "",
- "top": ""
- });
- own.setListeners();
- e.preventDefault();
- };
- e.preventDefault();
- }
- };
- });
- $unitsContainer.get(0).onmousemove = function (e) {
- moveControl(e);
- if (own.isSelected) {
- var targetIndex = own.getTargetIndex(e, own.checkDistance);
- if (targetIndex >= own.selectedIndex) {
- targetIndex++;
- }
- if (own.targetIndex === undefined) {
- own.targetIndex = targetIndex;
- }
- if (own.targetIndex === -1 && targetIndex > -1) {
- own.animationUnit = $units.eq(targetIndex);
- $(own.selectedUnit).addClass("inPosition");
- own.animationUnit.removeClass("moveToLeft").addClass("moveToRight");
- }
- else if (own.targetIndex > -1 && targetIndex === -1) {
- $(own.selectedUnit).removeClass("inPosition");
- own.animationUnit.removeClass("moveToRight").addClass("moveToLeft");
- }
- own.targetIndex = targetIndex;
- }
- e.preventDefault();
- };
- };
- CustomQueue.prototype.getTargetIndex = function (event, checkDistance) {
- var own = this;
- var minDistance = checkDistance;
- var index = 0;
- var rIndex = -1;
- for (var _i = 0, _a = this.movingControlPositions; _i < _a.length; _i++) {
- var position = _a[_i];
- var dX = event.clientX - position.x;
- var dY = event.clientY - position.y;
- var dDistance = Math.sqrt(Math.pow(dX, 2) + Math.pow(dY, 2));
- if (dDistance < checkDistance) {
- if (dDistance < minDistance) {
- minDistance = dDistance;
- rIndex = index;
- }
- }
- index++;
- }
- return rIndex;
- };
- CustomQueue.prototype.getUnitCenterPosition = function (elem) {
- var startX = elem.offsetLeft;
- var startY = elem.offsetTop;
- var width = elem.clientWidth;
- var height = elem.clientHeight;
- var centerPosition = { x: startX + width / 2, y: startY + height / 2 };
- return centerPosition;
- };
- CustomQueue.TemplateCotainer = "<div class=\"row\"></div>";
- 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>";
- CustomQueue.TemplateImage = "<img/>";
- return CustomQueue;
- }(Widget_39.Widget));
- exports.CustomQueue = CustomQueue;
- });
- 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) {
- "use strict";
- var ProductShow = (function (_super) {
- __extends(ProductShow, _super);
- function ProductShow(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.$thisNode = $(ProductShow.TemplateRow).attr({ id: this.id });
- this.noIncome = false;
- var result = ADORE_12.ADORE.ProductShowNoIncome & style;
- if (result === ADORE_12.ADORE.ProductShowNoIncome) {
- this.noIncome = true;
- }
- }
- ProductShow.prototype.addItems = function (args) {
- var items = args.items;
- if (!items || items.length === 0) {
- return;
- }
- var $father = this.$thisNode.parent();
- this.$thisNode.detach();
- for (var i = 0; i < items.length; i++) {
- if (this.$thisNode.find("#" + items[i].id).length !== 0) {
- this.setItem(items[i]);
- }
- else {
- this.addItem(items[i]);
- }
- }
- this.$thisNode.appendTo($father);
- };
- ProductShow.prototype.setItems = function (args) {
- var items = args.items;
- this.clear();
- this.addItems({ items: items });
- };
- ProductShow.prototype.addItem = function (item) {
- var itemNode = $(ProductShow.TemplateShow).attr({ id: item.id });
- itemNode.appendTo(this.$thisNode);
- this.setItemAttr(itemNode, item);
- var own = this;
- itemNode.find("div.product-show-button").on("click", function (e) {
- var index = own.indexOf(itemNode[0]);
- var productID = itemNode.attr("id");
- EventHub_35.EventHub.dispatchEvent(MessageType_36.MessageType.WIDGET, {
- id: own.id,
- evtType: Event_33.Event.CLICK,
- index: index,
- itemID: productID
- });
- });
- };
- ProductShow.prototype.indexOf = function (item) {
- var items = this.$thisNode.find("div.product-show");
- for (var i = 0; i < items.length; i++) {
- if (item === items[i]) {
- return i;
- }
- }
- return -1;
- };
- ProductShow.prototype.setItem = function (item) {
- var itemNode = this.$thisNode.find("#" + item.id);
- this.setItemAttr(itemNode, item);
- };
- ProductShow.prototype.setItemAttr = function (itemNode, item) {
- itemNode.find("div.product-show-title").find("p").html(this.parseText(item.title));
- if (this.noIncome) {
- itemNode.find("div.product-show-income").css("display", "none");
- itemNode.find("div.product-show-subtitle").css("display", "none");
- itemNode.find("div.product-show-image").css("margin-top", "10px");
- itemNode.css("height", "408px");
- }
- else {
- itemNode.find("div.product-show-subtitle").find("p").html(this.parseText(item.subTitle));
- itemNode.find("div.product-show-income").find("p").text(item.income);
- }
- if (item.image) {
- itemNode.find("div.product-show-image").find("img").attr("src", item.image);
- }
- else {
- itemNode.find("div.product-show-image").find("img").attr("src", "../www/images/product_show/product-image.png");
- }
- itemNode.find("div.product-show-details").find("p").html(this.parseText(item.details));
- itemNode.find("div.product-show-button").find("p").text(item.btnText);
- };
- ProductShow.prototype.parseText = function (text) {
- if (text) {
- return text.replace(/\n/g, "<br>");
- }
- return "";
- };
- ProductShow.prototype.removeItem = function (args) {
- var ids = args.itemIds;
- if (ids && ids.length > 0) {
- for (var i = 0; i < ids.length; i++) {
- this.$thisNode.find("#" + ids[i]).remove();
- }
- }
- };
- ProductShow.prototype.clear = function () {
- this.$thisNode.find("div.product-show").remove();
- };
- ProductShow.TemplateRow = "<div class=\"row\"> </div>";
- 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> ";
- return ProductShow;
- }(Widget_40.Widget));
- exports.ProductShow = ProductShow;
- });
- 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) {
- "use strict";
- var WindowQueue = (function (_super) {
- __extends(WindowQueue, _super);
- function WindowQueue(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.$thisNode = $(WindowQueue.Template0).attr({ id: id });
- }
- WindowQueue.prototype.addItems = function (args) {
- var items = args.items;
- if (!items || items.length === 0) {
- return;
- }
- var $father = this.$thisNode.parent();
- if ($father.length !== 0) {
- this.$thisNode.detach();
- }
- for (var i = 0; i < items.length; i++) {
- if (items[i].win_num) {
- if (this.$thisNode.find("#" + items[i].win_num).length !== 0) {
- this.setItem(items[i]);
- }
- else {
- this.addItem(items[i]);
- }
- }
- }
- if ($father.length !== 0) {
- this.$thisNode.appendTo($father);
- }
- };
- WindowQueue.prototype.setItems = function (args) {
- var items = args.items;
- this.clear();
- this.addItems({ items: items });
- };
- WindowQueue.prototype.addItem = function (item) {
- var $itemNode = $(WindowQueue.Template1).attr({ id: item.win_num });
- $itemNode.appendTo(this.$thisNode);
- this.setWindowAttr($itemNode, item);
- var own = this;
- $itemNode.find("div.window_queue_body").on("click", function (e) {
- var index = own.indexOf($itemNode[0]);
- var win_num = $itemNode.attr("id");
- EventHub_36.EventHub.dispatchEvent(MessageType_37.MessageType.WIDGET, {
- id: own.id,
- evtType: Event_34.Event.LOOK_OVER,
- index: index,
- win_num: win_num
- });
- });
- };
- WindowQueue.prototype.setItem = function (item) {
- var $itemNode = this.$thisNode.find("#" + item.win_num);
- this.setWindowAttr($itemNode, item);
- };
- WindowQueue.prototype.setWindowAttr = function ($itemNode, item) {
- $itemNode.find(".window_queue_id")[0].innerHTML = WindowQueue.Template3 + item.win_num;
- if (item.status) {
- var windowQueueBody = $itemNode.find(".window_queue_body");
- windowQueueBody.removeClass("window_queue_body_border_style1").removeClass("window_queue_body_border_style2").removeClass("window_queue_body_border_style3");
- var $statusNode = $itemNode.find(".window_queue_status");
- $statusNode.text(item.status);
- var $statusImgNode = $(WindowQueue.Template2).appendTo($statusNode);
- if (item.status === "空闲") {
- $statusImgNode.attr("src", "images/window_queue/kongxian.png");
- windowQueueBody.addClass("window_queue_body_border_style1");
- }
- else if (item.status === "服务中") {
- $statusImgNode.attr("src", "images/window_queue/fuwuzhong.png");
- windowQueueBody.addClass("window_queue_body_border_style2");
- }
- else if (item.status === "离线") {
- $statusImgNode.attr("src", "images/window_queue/lixian.png");
- windowQueueBody.addClass("window_queue_body_border_style3");
- }
- else {
- $statusImgNode.attr("src", "images/window_queue/weizhi.png");
- windowQueueBody.addClass("window_queue_body_border_style3");
- }
- }
- if (item.tellerNo) {
- $itemNode.find(".window_queue_body_teller_no").text("柜员:" + item.tellerNo);
- }
- if (item.tellerName) {
- $itemNode.find(".window_queue_body_teller_name").text("姓名:" + item.tellerName);
- }
- if (item.queue_num) {
- $itemNode.find(".window_queue_body_service_custom").text("当前服务客户:" + item.queue_num);
- }
- if (item.serviceCustomLevel) {
- $itemNode.find(".window_queue_body_custom_level").text("客户等级:" + item.serviceCustomLevel);
- var customLevelNode = $itemNode.find(".window_queue_body_custom");
- customLevelNode.find("img").remove();
- var customLevelImg = $(WindowQueue.Template2).addClass("window_queue_body_custom_level_img").appendTo(customLevelNode);
- if (item.serviceCustomLevel === "黄金客户") {
- customLevelImg.attr("src", "images/custom_queue/custom_level/huangjin.png");
- }
- else if (item.serviceCustomLevel === "白金客户") {
- customLevelImg.attr("src", "images/custom_queue/custom_level/baijin.png");
- }
- else if (item.serviceCustomLevel === "钻石客户") {
- customLevelImg.attr("src", "images/custom_queue/custom_level/zuanshi.png");
- }
- else {
- customLevelImg.attr("src", "images/custom_queue/custom_level/putong.png");
- }
- }
- if (item.windowInfo) {
- $itemNode.find(".window_queue_body_footer_p").text(item.windowInfo);
- }
- };
- WindowQueue.prototype.removeItem = function (args) {
- var ids = args.itemIds;
- if (ids && ids.length > 0) {
- for (var i = 0; i < ids.length; i++) {
- this.$thisNode.find("#" + ids[i]).remove();
- }
- }
- };
- WindowQueue.prototype.indexOf = function (item) {
- var $items = this.$thisNode.find("div.window_queue_container");
- for (var i = 0; i < $items.length; i++) {
- if (item === $items[i]) {
- return i;
- }
- }
- return -1;
- };
- WindowQueue.prototype.clear = function () {
- this.$thisNode.find(".window_queue_container").remove();
- };
- WindowQueue.Template0 = "<div class=\"row\"></div>";
- 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>";
- WindowQueue.Template2 = "<img/>";
- WindowQueue.Template3 = "<img src=\"images/window_queue/window.png\"/>";
- return WindowQueue;
- }(Widget_41.Widget));
- exports.WindowQueue = WindowQueue;
- });
- 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) {
- "use strict";
- var TreeItem = (function (_super) {
- __extends(TreeItem, _super);
- function TreeItem(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.children = new Array();
- this.children = new Array();
- this.$thisNode = $(TreeItem.TemplateNormal).attr("id", this.id);
- this.$attachNode = this.$thisNode;
- this.$a = this.$thisNode.find("a");
- this.hadChildren = false;
- this.isTreeItem = true;
- if (this.parent) {
- this.treeId = this.parent.treeId;
- }
- var itemId = this.id;
- var own = this;
- this.$a.on("click", function (e) {
- clearTimeout(own.timeoutFunc);
- own.timeoutFunc = setTimeout(function () {
- own.handleClick(itemId, own.$attachNode);
- }, 300);
- });
- this.$a.on("dblclick", function (e) {
- clearTimeout(own.timeoutFunc);
- own.handleDBClick(itemId, $(this.parentNode));
- });
- this.$checkboxNode = this.$attachNode.find("div").eq(0);
- this.checkboxId = "";
- var tmpId = this.treeId;
- this.$checkboxNode.find("input").eq(0).on("click", function (e) {
- own.refreshCheckState();
- EventHub_37.EventHub.dispatchEvent(MessageType_38.MessageType.WIDGET, {
- id: own.treeId,
- evtType: Event_35.Event.ON_CHANGE,
- cid: own.id,
- checked: own.$checkboxNode.find("input").eq(0).prop("checked")
- });
- });
- }
- TreeItem.prototype.addChild = function (child) {
- this.children.push(child);
- };
- TreeItem.prototype.layout = function () {
- this.append();
- if (this.parent) {
- var treeNode = this.parent.$thisNode.find(".collapsible");
- if (treeNode) {
- treeNode.collapsible();
- }
- }
- };
- TreeItem.prototype.handleDBClick = function (itemId, $itemNode) {
- this.clickCircle(itemId, $itemNode);
- EventHub_37.EventHub.dispatchEvent(MessageType_38.MessageType.WIDGET, { id: itemId, treeId: this.treeId, evtType: Event_35.Event.DOUBLE_CLICK });
- };
- TreeItem.prototype.clickCircle = function (itemId, $itemNode) {
- var tmpId = this.treeId;
- var tree = $("#" + tmpId);
- tree.find("li.bold").removeClass("adore_tree_node_selected");
- $itemNode.addClass("adore_tree_node_selected");
- var treeNodeCircle = $itemNode.find("div.adore_tree_node_circle").first();
- if (treeNodeCircle.length !== 0) {
- var arrowSpan = $itemNode.find("span.adore_tree_node_arrow").first();
- var circleDiv = treeNodeCircle.find("div");
- if (treeNodeCircle.attr("expand") === "false") {
- treeNodeCircle.attr("expand", "true");
- treeNodeCircle.removeClass("adore_circle").addClass("adore_mincircle");
- circleDiv.text("-");
- circleDiv.removeClass("adore_addcharpan").addClass("adore_mincharpan");
- arrowSpan.addClass("adore_tree_node_arrow_click");
- }
- else {
- treeNodeCircle.attr("expand", "false");
- treeNodeCircle.removeClass("adore_mincircle").addClass("adore_circle");
- circleDiv.text("+");
- circleDiv.removeClass("adore_mincharpan").addClass("adore_addcharpan");
- arrowSpan.removeClass("adore_tree_node_arrow_click");
- }
- }
- };
- TreeItem.prototype.handleClick = function (itemId, $itemNode) {
- this.clickCircle(itemId, $itemNode);
- EventHub_37.EventHub.dispatchEvent(MessageType_38.MessageType.WIDGET, { id: itemId, treeId: this.treeId, evtType: Event_35.Event.CLICK });
- };
- TreeItem.prototype.changeParentStyle = function () {
- var parent = this.parent;
- if (!parent.hadChildren) {
- parent.$thisNode.remove();
- parent.$thisNode = $(TreeItem.TemplateComplex).attr("id", parent.id);
- parent.$attachNode = parent.$thisNode;
- parent.$a = parent.$thisNode.find("a");
- var own_6 = parent;
- var itemId_1 = parent.id;
- parent.$circleNode = parent.$attachNode.find("div.adore_tree_node_circle").first();
- parent.$a.on("click", function (e) {
- clearTimeout(own_6.timeoutFunc);
- own_6.timeoutFunc = setTimeout(function () {
- own_6.handleClick(itemId_1, parent.$attachNode);
- });
- });
- parent.$a.on("dblclick", function (e) {
- clearTimeout(own_6.timeoutFunc);
- own_6.handleDBClick(itemId_1, parent.$attachNode);
- });
- parent.$circleNode.on("click", function (e) {
- own_6.$a.click();
- });
- parent.$ul = parent.$thisNode.find("ul.collapsible").find("ul");
- parent.hadChildren = true;
- if (parent.text) {
- parent.setText({ text: parent.text });
- }
- var display = parent.$checkboxNode.css("display");
- parent.$checkboxNode = $(this.parent.$attachNode.find("div").get(2));
- parent.refreshCheckId(this.parent.checkboxId);
- parent.$checkboxNode.css("display", display);
- var tempParent = this.parent;
- var tmpId = this.treeId;
- parent.$checkboxNode.find("input").eq(0).on("click", function (e) {
- tempParent.refreshCheckState();
- EventHub_37.EventHub.dispatchEvent(MessageType_38.MessageType.WIDGET, {
- id: tmpId,
- evtType: Event_35.Event.ON_CHANGE,
- cid: own_6.id,
- checked: tempParent.$checkboxNode.find("input").eq(0).prop("checked")
- });
- });
- if (this.parent.parent) {
- if (this.parent.parent instanceof Tree_1.Tree) {
- this.parent.$thisNode.appendTo(this.parent.parent.$attachNode);
- }
- else if (this.parent.parent instanceof TreeItem) {
- var $liChildNodes = this.parent.parent.$ul.children("li");
- var size = $liChildNodes.length;
- var index = this.parent.parent.children.indexOf(this.parent);
- if (index < size) {
- this.parent.$thisNode.insertBefore($liChildNodes.eq(index));
- }
- else {
- this.parent.$thisNode.appendTo(this.parent.parent.$ul);
- }
- }
- }
- else {
- this.parent.$thisNode.appendTo(document.body);
- }
- }
- };
- TreeItem.prototype.append = function () {
- if (this.parent) {
- if (this.parent.isTreeItem) {
- this.changeParentStyle();
- this.$thisNode.appendTo(this.parent.$ul);
- }
- else {
- this.$thisNode.appendTo(this.parent.$attachNode);
- }
- }
- else {
- this.$thisNode.appendTo(document.body);
- }
- };
- TreeItem.prototype.setText = function (args) {
- this.text = args.text;
- this.$a.find("span").first().text(this.text);
- };
- TreeItem.prototype.setCheckboxId = function (args) {
- this.checkboxId = args.checkboxId;
- this.refreshCheckId(this.checkboxId);
- };
- TreeItem.prototype.refreshCheckId = function (checkboxId) {
- this.$checkboxNode.find("input").attr("id", checkboxId);
- this.$checkboxNode.find("label").attr("for", checkboxId);
- };
- TreeItem.prototype.viewCheckbox = function (args) {
- this.refreshViewCheckbox(args.viewCheckbox);
- };
- TreeItem.prototype.refreshViewCheckbox = function (viewCheckbox) {
- if (viewCheckbox) {
- this.$checkboxNode.css("display", "block");
- }
- else {
- this.$checkboxNode.css("display", "none");
- }
- };
- TreeItem.prototype.refreshCheckState = function () {
- var $checkbox = this.$checkboxNode.find("input").eq(0);
- var checked = $checkbox.prop("checked");
- this.$attachNode.find("input").prop("checked", checked);
- this.$attachNode.find("input").prop("indeterminate", false);
- var father = this.parent;
- while (father && father instanceof TreeItem) {
- var state = -1;
- var $checkboxes = father.$attachNode.find("input");
- var checkboxSize = $checkboxes.length;
- for (var i = 1; i < checkboxSize; i++) {
- var checkedTmp = $checkboxes.eq(i).prop("checked");
- if (checkedTmp) {
- if (state == -1) {
- state = 0;
- }
- else if (state != 0) {
- state = 2;
- break;
- }
- }
- else {
- if (state == -1) {
- state = 1;
- }
- else if (state != 1) {
- state = 2;
- break;
- }
- }
- }
- var $checoboxTmp = father.$attachNode.find("input").eq(0);
- if (state == 0) {
- $checoboxTmp.prop("checked", true);
- $checoboxTmp.prop("indeterminate", false);
- }
- else if (state == 1) {
- $checoboxTmp.prop("checked", false);
- $checoboxTmp.prop("indeterminate", false);
- }
- else {
- $checoboxTmp.prop("checked", false);
- $checoboxTmp.prop("indeterminate", true);
- }
- father = father.parent;
- }
- };
- TreeItem.prototype.setCheckboxState = function (checkboxState) {
- this.$checkboxNode.find("input").eq(0).prop("checked", checkboxState);
- this.$checkboxNode.find("input").eq(0).prop("indeterminate", false);
- };
- TreeItem.prototype.needRedForground = function (args) {
- var needRedForground = args.needRedForground;
- if (needRedForground) {
- this.$a.css("color", "red");
- }
- else {
- this.$a.css("color", "#444");
- }
- };
- 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>";
- 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>";
- return TreeItem;
- }(Composite_12.Composite));
- exports.TreeItem = TreeItem;
- });
- define("widget/tree/Tree", ["require", "exports", "widget/Composite", "util/WidgetManager"], function (require, exports, Composite_13, WidgetManager_6) {
- "use strict";
- var Tree = (function (_super) {
- __extends(Tree, _super);
- function Tree(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.children = new Array();
- this.candragAndDrop = false;
- this.indrag = false;
- this.children = new Array();
- this.$thisNode = $(Tree.TemplateNormal).attr("id", this.id);
- this.$attachNode = this.$thisNode.find("ul");
- this.treeId = this.id;
- var own = this;
- this.$thisNode.find("ul").on("focus", function (e) {
- console.log("tree focus in");
- own.sendFocusGain();
- }).on("blur", function (e) {
- });
- }
- Tree.prototype.addChild = function (child) {
- this.children.push(child);
- };
- Tree.prototype.removeItem = function (args) {
- var itemId = args.itemId;
- if (itemId != null) {
- this.$delectNode = this.$thisNode.find("#" + itemId);
- this.$delectNode.remove();
- }
- };
- Tree.prototype.dragAndDrop = function (args) {
- this.candragAndDrop = args.candragAndDrop;
- if (this.candragAndDrop === true) {
- this.initTree(this.treeId);
- }
- };
- Tree.prototype.initTree = function (id) {
- var root = document.getElementById(id);
- if (root === null) {
- return false;
- }
- this.initEv();
- };
- Tree.prototype.initEv = function () {
- var own = this;
- };
- Tree.prototype.layout = function () {
- };
- Tree.prototype.viewCheckbox = function (args) {
- var viewCheckbox = args.viewCheckbox;
- var $checkboxNodes = this.$attachNode.find("div input:checkbox").parent();
- if (viewCheckbox) {
- $checkboxNodes.css("display", "block");
- }
- else {
- $checkboxNodes.css("display", "none");
- }
- };
- Tree.prototype.setCheckBoxState = function (args) {
- var stateData = JSON.parse(args.checkBoxState);
- var z = this.$attachNode.find("label").length;
- for (var key in stateData) {
- var treeItem = WidgetManager_6.WidgetManager.byId(key);
- if (treeItem) {
- var checked = treeItem.$checkboxNode.find("input:checkbox").eq(0).prop("checked");
- if (checked !== stateData[key]) {
- treeItem.setCheckboxState(stateData[key]);
- treeItem.refreshCheckState();
- }
- }
- }
- };
- Tree.prototype.changeLeafLocation = function (args) {
- var treeItem = WidgetManager_6.WidgetManager.byId(args.treeItemId);
- var index = args.index;
- var size = treeItem.parent.children.length;
- if (index < 0 || index >= size) {
- index = size - 1;
- }
- var treeItemIndex = treeItem.parent.children.indexOf(treeItem);
- if (treeItemIndex === index) {
- return;
- }
- var afterTreeItem = treeItem.$attachNode.siblings().eq(args.index);
- treeItem.$attachNode.detach();
- treeItem.$attachNode.insertBefore(afterTreeItem);
- };
- Tree.prototype.moveNode = function (args) {
- var currentItem = WidgetManager_6.WidgetManager.byId(args.currentNodeId);
- currentItem.$attachNode.detach();
- if (currentItem.parent) {
- var index = currentItem.parent.children.indexOf(currentItem);
- currentItem.parent.children.splice(index, 1);
- }
- var targetItem = WidgetManager_6.WidgetManager.byId(args.targetNodeId);
- currentItem.parent = targetItem;
- targetItem.children.push(currentItem);
- currentItem.append();
- if (currentItem.parent) {
- var treeNode = currentItem.parent.$attachNode.find(".collapsible");
- if (treeNode) {
- treeNode.collapsible();
- }
- }
- };
- Tree.prototype.sendFocusGain = function () {
- _super.prototype.sendFocusGain.call(this);
- };
- Tree.prototype.setFocus = function () {
- this.sendFocusGain();
- };
- 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>";
- return Tree;
- }(Composite_13.Composite));
- exports.Tree = Tree;
- });
- define("widget/Video", ["require", "exports", "widget/Widget"], function (require, exports, Widget_42) {
- "use strict";
- var Video = (function (_super) {
- __extends(Video, _super);
- function Video(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.autoplay = false;
- this.$thisNode = $(Video.template).attr({ id: this.id });
- this.$videoNode = this.$thisNode.find("video").attr("id", this.id + "-content");
- this.videoElement = this.$videoNode.get(0);
- this.sourceElement = this.$thisNode.find("source")[0];
- var own = this;
- this.resizeListener = function () {
- own.refreshVideoWidth();
- };
- $(window).on("resize", this.resizeListener);
- }
- Video.prototype.playVideo = function () {
- this.videoElement.play();
- };
- Video.prototype.pauseVideo = function () {
- this.videoElement.pause();
- };
- Video.prototype.setVideoPath = function (args) {
- if (!args.path) {
- return;
- }
- var type = "ogg";
- var index = args.path.lastIndexOf(".");
- if (index !== -1) {
- type = args.path.substring(index + 1, args.path.length);
- }
- this.sourceElement.type = "video/" + type;
- this.sourceElement.src = args.path;
- this.videoElement.load();
- this.refreshVideoWidth();
- };
- Video.prototype.setAutoPlay = function (args) {
- if (args.autoPlay) {
- this.$videoNode.attr("autoplay", "autoplay");
- }
- else {
- this.$videoNode.removeAttr("autoplay");
- }
- };
- Video.prototype.postLayout = function () {
- _super.prototype.postLayout.call(this);
- this.refreshVideoWidth();
- };
- Video.prototype.refreshVideoWidth = function () {
- var w = this.$thisNode.css("width");
- if (w.indexOf("px") !== -1 || w.indexOf("%") !== -1 || w.indexOf("rem") !== -1) {
- this.$videoNode.css("width", w);
- }
- else {
- this.$videoNode.css("width", w + "px");
- }
- };
- Video.prototype.dispose = function () {
- $(window).off("resize", this.resizeListener);
- _super.prototype.dispose.call(this);
- };
- Video.template = "\n <div>\n <video controls=\"controls\">\n <source>\n </video>\n </div>\n ";
- return Video;
- }(Widget_42.Widget));
- exports.Video = Video;
- });
- define("widget/Wizard", ["require", "exports", "widget/Widget", "ADORE"], function (require, exports, Widget_43, ADORE_13) {
- "use strict";
- var Wizard = (function (_super) {
- __extends(Wizard, _super);
- function Wizard(parentId, id, style) {
- _super.call(this, parentId, id, style);
- this.$thisNode = $(Wizard.mainTemplate).attr("id", this.id);
- if (style === ADORE_13.ADORE.Normal) {
- this.setAllBlocks = this.setAllCircleBlocks;
- this.$thisNode.css({
- "background-color": Wizard.NORMAL_STYLE_COLOR
- });
- }
- else if (style === ADORE_13.ADORE.Arrow) {
- this.setAllBlocks = this.setAllArrowBlocks;
- this.$thisNode.css({
- "background-color": Wizard.ARROR_STYLE_COLOR
- });
- }
- }
- Wizard.prototype.setAllCircleBlocks = function (args) {
- var bs = args.blockStates;
- this.$thisNode.children().remove();
- for (var index = 1; index <= bs.length; index++) {
- var $blockNode = $(Wizard.circleBlockTemplate);
- var $outCircleNode = $blockNode.find(".wizard_CT_outCircle");
- var $circleTextNode = $blockNode.find(".wizard_CT_circleText");
- var $textNode = $blockNode.find(".wizard_CT_text");
- this.changeState($outCircleNode, bs[index - 1].state);
- $circleTextNode.html(index.toString());
- $textNode.html(bs[index - 1].text);
- this.$thisNode.append($blockNode);
- }
- };
- Wizard.prototype.setAllArrowBlocks = function (args) {
- var bs = args.blockStates;
- this.$thisNode.children().remove();
- for (var index = 1; index <= bs.length; index++) {
- var $blockNode = $(Wizard.arrowBlockTemplate);
- var $textNode = $blockNode.find(".wizard_AT_text_part");
- this.changeState($blockNode, bs[index - 1].state);
- $textNode.html(bs[index - 1].text);
- this.$thisNode.append($blockNode);
- }
- };
- Wizard.prototype.changeState = function ($node, state) {
- var own = this;
- if ($node.children().length > 0) {
- $node.removeClass("finished").removeClass("handling").
- removeClass("unreached").removeClass("unreachable").addClass(state);
- $node.children().each(function (index, e) {
- own.changeState($(e), state);
- });
- }
- else {
- $node.removeClass("finished").removeClass("handling").
- removeClass("unreached").removeClass("unreachable").addClass(state);
- }
- };
- Wizard.NORMAL_STYLE_COLOR = "#57668E";
- Wizard.ARROR_STYLE_COLOR = "#E4DEDE";
- Wizard.mainTemplate = "\n <div class=\"wizard\"></div>\n ";
- 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 ";
- 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 ";
- return Wizard;
- }(Widget_43.Widget));
- exports.Wizard = Wizard;
- });
- //# sourceMappingURL=adore.js.map
|